From: Cris Di Sclafani Date: Fri, 29 Jan 2021 13:22:41 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.14 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=ca900185058a476804c716fe94da65bb979b6d1e;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0ae3afd..817ba1a 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-29T11:48:54.212Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T13:14:59.327Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b709cc6..1e7f4b9 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-29T11:48:54.212Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T13:14:59.327Z", "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 a34e927..e384d11 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 _0x7b8d=['exports','INTEGER'];(function(_0x3ddfb4,_0x2d50e7){var _0x34051e=function(_0xbe6933){while(--_0xbe6933){_0x3ddfb4['push'](_0x3ddfb4['shift']());}};_0x34051e(++_0x2d50e7);}(_0x7b8d,0xfa));var _0xd7b8=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x7b8d[_0x46a38b];return _0x346e75;};'use strict';var Sequelize=require('sequelize');module[_0xd7b8('0x0')]={'ChatInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xd7b8('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x64ad=['sequelize','exports','INTEGER'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0x64ad,0x1e0));var _0xd64a=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x64ad[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require(_0xd64a('0x0'));module[_0xd64a('0x1')]={'ChatInteractionId':{'type':Sequelize[_0xd64a('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xd64a('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index 2147f5e..684c5ab 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 _0xdb9a=['type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','catch','show','params','length','includeAll','include','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','UserChatInteractions','UserProfileResource','end','error','stack','name','send','UserChatInteraction','rawAttributes','fieldName'];(function(_0x2718b8,_0x51f0e0){var _0x4ddafc=function(_0x1fa8c3){while(--_0x1fa8c3){_0x2718b8['push'](_0x2718b8['shift']());}};_0x4ddafc(++_0x51f0e0);}(_0xdb9a,0xce));var _0xadb9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb9a[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xadb9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xadb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xadb9('0x2'));var rp=require(_0xadb9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xadb9('0x4'));var util=require(_0xadb9('0x5'));var path=require(_0xadb9('0x6'));var sox=require(_0xadb9('0x7'));var csv=require(_0xadb9('0x8'));var ejs=require(_0xadb9('0x9'));var fs=require('fs');var _=require(_0xadb9('0xa'));var squel=require(_0xadb9('0xb'));var crypto=require('crypto');var jsforce=require(_0xadb9('0xc'));var deskjs=require(_0xadb9('0xd'));var toCsv=require(_0xadb9('0x8'));var querystring=require(_0xadb9('0xe'));var Papa=require(_0xadb9('0xf'));var Redis=require('ioredis');var authService=require(_0xadb9('0x10'));var qs=require(_0xadb9('0x11'));var as=require(_0xadb9('0x12'));var hardwareService=require(_0xadb9('0x13'));var logger=require(_0xadb9('0x14'))(_0xadb9('0x15'));var utils=require(_0xadb9('0x16'));var config=require(_0xadb9('0x17'));var licenseUtil=require(_0xadb9('0x18'));var db=require(_0xadb9('0x19'))['db'];function respondWithStatusCode(_0x569fe0,_0x11a7d3){_0x11a7d3=_0x11a7d3||0xcc;return function(_0x566d06){if(_0x566d06){return _0x569fe0[_0xadb9('0x1a')](_0x11a7d3);}return _0x569fe0[_0xadb9('0x1b')](_0x11a7d3)['end']();};}function respondWithResult(_0x3cce1d,_0x9e6483){_0x9e6483=_0x9e6483||0xc8;return function(_0x317e47){if(_0x317e47){return _0x3cce1d['status'](_0x9e6483)[_0xadb9('0x1c')](_0x317e47);}};}function respondWithFilteredResult(_0x5021d3,_0x4d6025){return function(_0x3e784e){if(_0x3e784e){var _0xf9b577=_0x3e784e[_0xadb9('0x1d')],_0x3a8237=_0x4d6025['offset'],_0x3ad6a1=_0x4d6025[_0xadb9('0x1e')]+_0x4d6025[_0xadb9('0x1f')],_0x3b6c66;if(_0x3ad6a1>=_0xf9b577){_0x3ad6a1=_0xf9b577;_0x3b6c66=0xc8;}else{_0x3b6c66=0xce;}_0x5021d3[_0xadb9('0x1b')](_0x3b6c66);return _0x5021d3['set'](_0xadb9('0x20'),_0x3a8237+'-'+_0x3ad6a1+'/'+_0xf9b577)[_0xadb9('0x1c')](_0x3e784e);}return null;};}function patchUpdates(_0xa5676a){return function(_0x4330bb){try{jsonpatch[_0xadb9('0x21')](_0x4330bb,_0xa5676a,!![]);}catch(_0x26df30){return BPromise[_0xadb9('0x22')](_0x26df30);}return _0x4330bb[_0xadb9('0x23')]();};}function saveUpdates(_0x1fddac,_0x11e8c0){return function(_0xb72376){if(_0xb72376){return _0xb72376[_0xadb9('0x24')](_0x1fddac)['then'](function(_0xfa7051){return _0xfa7051;});}return null;};}function removeEntity(_0x5d2e27,_0x16496a){return function(_0x5ec7cc){if(_0x5ec7cc){return _0x5ec7cc[_0xadb9('0x25')]()[_0xadb9('0x26')](function(){var _0x566c8c=_0x5ec7cc['get']({'plain':!![]});var _0x43d689=_0xadb9('0x27');return db[_0xadb9('0x28')][_0xadb9('0x25')]({'where':{'type':_0x43d689,'resourceId':_0x566c8c['id']}})['then'](function(){return _0x5ec7cc;});})[_0xadb9('0x26')](function(){_0x5d2e27[_0xadb9('0x1b')](0xcc)[_0xadb9('0x29')]();});}};}function handleEntityNotFound(_0x5ac6e3,_0x139762){return function(_0x5be912){if(!_0x5be912){_0x5ac6e3[_0xadb9('0x1a')](0x194);}return _0x5be912;};}function handleError(_0xfbd858,_0x3f1cd1){_0x3f1cd1=_0x3f1cd1||0x1f4;return function(_0x569520){logger[_0xadb9('0x2a')](_0x569520[_0xadb9('0x2b')]);if(_0x569520[_0xadb9('0x2c')]){delete _0x569520[_0xadb9('0x2c')];}_0xfbd858[_0xadb9('0x1b')](_0x3f1cd1)[_0xadb9('0x2d')](_0x569520);};}exports['index']=function(_0x1a05ac,_0x483146){var _0x4c8def={},_0x38b67c={},_0x3f5ca3={'count':0x0,'rows':[]};var _0x5783ce=_['map'](db[_0xadb9('0x2e')][_0xadb9('0x2f')],function(_0x1461d3){return{'name':_0x1461d3[_0xadb9('0x30')],'type':_0x1461d3[_0xadb9('0x31')][_0xadb9('0x32')]};});_0x38b67c[_0xadb9('0x33')]=_['map'](_0x5783ce,_0xadb9('0x2c'));_0x38b67c['query']=_[_0xadb9('0x34')](_0x1a05ac[_0xadb9('0x35')]);_0x38b67c[_0xadb9('0x36')]=_[_0xadb9('0x37')](_0x38b67c[_0xadb9('0x33')],_0x38b67c['query']);_0x4c8def['attributes']=_[_0xadb9('0x37')](_0x38b67c[_0xadb9('0x33')],qs[_0xadb9('0x38')](_0x1a05ac[_0xadb9('0x35')]['fields']));_0x4c8def[_0xadb9('0x39')]=_0x4c8def[_0xadb9('0x39')]['length']?_0x4c8def[_0xadb9('0x39')]:_0x38b67c['model'];if(!_0x1a05ac[_0xadb9('0x35')][_0xadb9('0x3a')](_0xadb9('0x3b'))){_0x4c8def[_0xadb9('0x1f')]=qs[_0xadb9('0x1f')](_0x1a05ac['query'][_0xadb9('0x1f')]);_0x4c8def[_0xadb9('0x1e')]=qs['offset'](_0x1a05ac[_0xadb9('0x35')][_0xadb9('0x1e')]);}_0x4c8def[_0xadb9('0x3c')]=qs[_0xadb9('0x3d')](_0x1a05ac['query']['sort']);_0x4c8def[_0xadb9('0x3e')]=qs[_0xadb9('0x36')](_[_0xadb9('0x3f')](_0x1a05ac[_0xadb9('0x35')],_0x38b67c[_0xadb9('0x36')]),_0x5783ce);if(_0x1a05ac[_0xadb9('0x35')][_0xadb9('0x40')]){_0x4c8def[_0xadb9('0x3e')]=_[_0xadb9('0x41')](_0x4c8def['where'],{'$or':_[_0xadb9('0x42')](_0x5783ce,function(_0x3b00f6){if(_0x3b00f6[_0xadb9('0x31')]!=='VIRTUAL'){var _0x360b36={};_0x360b36[_0x3b00f6[_0xadb9('0x2c')]]={'$like':'%'+_0x1a05ac[_0xadb9('0x35')]['filter']+'%'};return _0x360b36;}})});}_0x4c8def=_[_0xadb9('0x41')]({},_0x4c8def,_0x1a05ac['options']);var _0x44a1fc={'where':_0x4c8def[_0xadb9('0x3e')]};return db['UserChatInteraction'][_0xadb9('0x1d')](_0x44a1fc)[_0xadb9('0x26')](function(_0x4c39fe){_0x3f5ca3[_0xadb9('0x1d')]=_0x4c39fe;if(_0x1a05ac[_0xadb9('0x35')]['includeAll']){_0x4c8def['include']=[{'all':!![]}];}return db[_0xadb9('0x2e')]['findAll'](_0x4c8def);})[_0xadb9('0x26')](function(_0x2ea4cc){_0x3f5ca3['rows']=_0x2ea4cc;return _0x3f5ca3;})[_0xadb9('0x26')](respondWithFilteredResult(_0x483146,_0x4c8def))[_0xadb9('0x43')](handleError(_0x483146,null));};exports[_0xadb9('0x44')]=function(_0x1f1882,_0x113b47){var _0x86f11e={'raw':!![],'where':{'id':_0x1f1882[_0xadb9('0x45')]['id']}},_0x4c758c={};_0x4c758c[_0xadb9('0x33')]=_[_0xadb9('0x34')](db[_0xadb9('0x2e')][_0xadb9('0x2f')]);_0x4c758c[_0xadb9('0x35')]=_[_0xadb9('0x34')](_0x1f1882[_0xadb9('0x35')]);_0x4c758c[_0xadb9('0x36')]=_[_0xadb9('0x37')](_0x4c758c[_0xadb9('0x33')],_0x4c758c[_0xadb9('0x35')]);_0x86f11e[_0xadb9('0x39')]=_[_0xadb9('0x37')](_0x4c758c[_0xadb9('0x33')],qs[_0xadb9('0x38')](_0x1f1882[_0xadb9('0x35')][_0xadb9('0x38')]));_0x86f11e[_0xadb9('0x39')]=_0x86f11e[_0xadb9('0x39')][_0xadb9('0x46')]?_0x86f11e['attributes']:_0x4c758c[_0xadb9('0x33')];if(_0x1f1882[_0xadb9('0x35')][_0xadb9('0x47')]){_0x86f11e[_0xadb9('0x48')]=[{'all':!![]}];}_0x86f11e=_[_0xadb9('0x41')]({},_0x86f11e,_0x1f1882[_0xadb9('0x49')]);return db[_0xadb9('0x2e')][_0xadb9('0x4a')](_0x86f11e)[_0xadb9('0x26')](handleEntityNotFound(_0x113b47,null))[_0xadb9('0x26')](respondWithResult(_0x113b47,null))[_0xadb9('0x43')](handleError(_0x113b47,null));};exports[_0xadb9('0x4b')]=function(_0x31a635,_0x40a361){return db[_0xadb9('0x2e')][_0xadb9('0x4b')](_0x31a635[_0xadb9('0x4c')],{})[_0xadb9('0x26')](function(_0x8548b6){var _0xbf9ce7=_0x31a635['user'][_0xadb9('0x4d')]({'plain':!![]});if(!_0xbf9ce7)throw new Error(_0xadb9('0x4e'));if(_0xbf9ce7[_0xadb9('0x4f')]===_0xadb9('0x50')){var _0x4616d0=_0x8548b6[_0xadb9('0x4d')]({'plain':!![]});var _0x387c1e=_0xadb9('0x27');return db[_0xadb9('0x51')][_0xadb9('0x4a')]({'where':{'name':_0x387c1e,'userProfileId':_0xbf9ce7[_0xadb9('0x52')]},'raw':!![]})[_0xadb9('0x26')](function(_0x2f5a2d){if(_0x2f5a2d&&_0x2f5a2d[_0xadb9('0x53')]===0x0){return db['UserProfileResource'][_0xadb9('0x4b')]({'name':_0x4616d0[_0xadb9('0x2c')],'resourceId':_0x4616d0['id'],'type':_0x2f5a2d[_0xadb9('0x2c')],'sectionId':_0x2f5a2d['id']},{})[_0xadb9('0x26')](function(){return _0x8548b6;});}else{return _0x8548b6;}})[_0xadb9('0x43')](function(_0x4c1c23){logger['error'](_0xadb9('0x54'),_0x4c1c23);throw _0x4c1c23;});}return _0x8548b6;})[_0xadb9('0x26')](respondWithResult(_0x40a361,0xc9))[_0xadb9('0x43')](handleError(_0x40a361,null));};exports[_0xadb9('0x24')]=function(_0x563813,_0x7e4d7d){if(_0x563813[_0xadb9('0x4c')]['id']){delete _0x563813['body']['id'];}return db[_0xadb9('0x2e')][_0xadb9('0x4a')]({'where':{'id':_0x563813[_0xadb9('0x45')]['id']}})[_0xadb9('0x26')](handleEntityNotFound(_0x7e4d7d,null))[_0xadb9('0x26')](saveUpdates(_0x563813['body'],null))['then'](respondWithResult(_0x7e4d7d,null))['catch'](handleError(_0x7e4d7d,null));};exports[_0xadb9('0x25')]=function(_0x1ad6bd,_0x2b8863){return db[_0xadb9('0x2e')]['find']({'where':{'id':_0x1ad6bd[_0xadb9('0x45')]['id']}})[_0xadb9('0x26')](handleEntityNotFound(_0x2b8863,null))['then'](removeEntity(_0x2b8863,null))[_0xadb9('0x43')](handleError(_0x2b8863,null));}; \ No newline at end of file +var _0xf3b7=['keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','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','status','end','json','count','offset','limit','set','reject','save','destroy','then','get','UserChatInteractions','UserProfileResource','sendStatus','error','stack','send','index','map','UserChatInteraction','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x1b78fa,_0x59d010){var _0xabbe39=function(_0x4ae3ee){while(--_0x4ae3ee){_0x1b78fa['push'](_0x1b78fa['shift']());}};_0xabbe39(++_0x59d010);}(_0xf3b7,0x119));var _0x7f3b=function(_0x509e04,_0x2cda25){_0x509e04=_0x509e04-0x0;var _0x1f7107=_0xf3b7[_0x509e04];return _0x1f7107;};'use strict';var pdf=require(_0x7f3b('0x0'));var emlformat=require(_0x7f3b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7f3b('0x2'));var jsonpatch=require(_0x7f3b('0x3'));var rp=require(_0x7f3b('0x4'));var moment=require(_0x7f3b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7f3b('0x6'));var util=require(_0x7f3b('0x7'));var path=require(_0x7f3b('0x8'));var sox=require('sox');var csv=require(_0x7f3b('0x9'));var ejs=require(_0x7f3b('0xa'));var fs=require('fs');var _=require(_0x7f3b('0xb'));var squel=require(_0x7f3b('0xc'));var crypto=require(_0x7f3b('0xd'));var jsforce=require(_0x7f3b('0xe'));var deskjs=require(_0x7f3b('0xf'));var toCsv=require(_0x7f3b('0x9'));var querystring=require(_0x7f3b('0x10'));var Papa=require(_0x7f3b('0x11'));var Redis=require(_0x7f3b('0x12'));var authService=require(_0x7f3b('0x13'));var qs=require(_0x7f3b('0x14'));var as=require(_0x7f3b('0x15'));var hardwareService=require(_0x7f3b('0x16'));var logger=require(_0x7f3b('0x17'))(_0x7f3b('0x18'));var utils=require(_0x7f3b('0x19'));var config=require(_0x7f3b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x193577,_0x560cf4){_0x560cf4=_0x560cf4||0xcc;return function(_0xbd9e61){if(_0xbd9e61){return _0x193577['sendStatus'](_0x560cf4);}return _0x193577[_0x7f3b('0x1b')](_0x560cf4)[_0x7f3b('0x1c')]();};}function respondWithResult(_0xb3fcc,_0x2ecef3){_0x2ecef3=_0x2ecef3||0xc8;return function(_0xef733a){if(_0xef733a){return _0xb3fcc[_0x7f3b('0x1b')](_0x2ecef3)[_0x7f3b('0x1d')](_0xef733a);}};}function respondWithFilteredResult(_0x51c227,_0x8c2469){return function(_0x163996){if(_0x163996){var _0x2bdbcb=_0x163996[_0x7f3b('0x1e')],_0x1784a0=_0x8c2469[_0x7f3b('0x1f')],_0xcc1ac8=_0x8c2469[_0x7f3b('0x1f')]+_0x8c2469[_0x7f3b('0x20')],_0x58a63e;if(_0xcc1ac8>=_0x2bdbcb){_0xcc1ac8=_0x2bdbcb;_0x58a63e=0xc8;}else{_0x58a63e=0xce;}_0x51c227[_0x7f3b('0x1b')](_0x58a63e);return _0x51c227[_0x7f3b('0x21')]('Content-Range',_0x1784a0+'-'+_0xcc1ac8+'/'+_0x2bdbcb)[_0x7f3b('0x1d')](_0x163996);}return null;};}function patchUpdates(_0x1a92c6){return function(_0x5f0769){try{jsonpatch['apply'](_0x5f0769,_0x1a92c6,!![]);}catch(_0x504d10){return BPromise[_0x7f3b('0x22')](_0x504d10);}return _0x5f0769[_0x7f3b('0x23')]();};}function saveUpdates(_0x27111b,_0x1c7c00){return function(_0x6c7bbb){if(_0x6c7bbb){return _0x6c7bbb['update'](_0x27111b)['then'](function(_0x5a9452){return _0x5a9452;});}return null;};}function removeEntity(_0x4fc2f0,_0x50cf2f){return function(_0x5170f3){if(_0x5170f3){return _0x5170f3[_0x7f3b('0x24')]()[_0x7f3b('0x25')](function(){var _0x3dcb71=_0x5170f3[_0x7f3b('0x26')]({'plain':!![]});var _0x440218=_0x7f3b('0x27');return db[_0x7f3b('0x28')][_0x7f3b('0x24')]({'where':{'type':_0x440218,'resourceId':_0x3dcb71['id']}})[_0x7f3b('0x25')](function(){return _0x5170f3;});})[_0x7f3b('0x25')](function(){_0x4fc2f0[_0x7f3b('0x1b')](0xcc)[_0x7f3b('0x1c')]();});}};}function handleEntityNotFound(_0x2e8e97,_0xe05885){return function(_0x153d92){if(!_0x153d92){_0x2e8e97[_0x7f3b('0x29')](0x194);}return _0x153d92;};}function handleError(_0x3aaf4e,_0x575ed1){_0x575ed1=_0x575ed1||0x1f4;return function(_0x1b5e18){logger[_0x7f3b('0x2a')](_0x1b5e18[_0x7f3b('0x2b')]);if(_0x1b5e18['name']){delete _0x1b5e18['name'];}_0x3aaf4e[_0x7f3b('0x1b')](_0x575ed1)[_0x7f3b('0x2c')](_0x1b5e18);};}exports[_0x7f3b('0x2d')]=function(_0x2f0c1d,_0x5a51d6){var _0x2a125d={},_0x9bee51={},_0x5efceb={'count':0x0,'rows':[]};var _0x2f2755=_[_0x7f3b('0x2e')](db[_0x7f3b('0x2f')][_0x7f3b('0x30')],function(_0x4e10cd){return{'name':_0x4e10cd[_0x7f3b('0x31')],'type':_0x4e10cd[_0x7f3b('0x32')][_0x7f3b('0x33')]};});_0x9bee51[_0x7f3b('0x34')]=_[_0x7f3b('0x2e')](_0x2f2755,_0x7f3b('0x35'));_0x9bee51[_0x7f3b('0x36')]=_[_0x7f3b('0x37')](_0x2f0c1d[_0x7f3b('0x36')]);_0x9bee51[_0x7f3b('0x38')]=_[_0x7f3b('0x39')](_0x9bee51[_0x7f3b('0x34')],_0x9bee51['query']);_0x2a125d[_0x7f3b('0x3a')]=_[_0x7f3b('0x39')](_0x9bee51[_0x7f3b('0x34')],qs['fields'](_0x2f0c1d[_0x7f3b('0x36')][_0x7f3b('0x3b')]));_0x2a125d['attributes']=_0x2a125d['attributes'][_0x7f3b('0x3c')]?_0x2a125d[_0x7f3b('0x3a')]:_0x9bee51[_0x7f3b('0x34')];if(!_0x2f0c1d['query']['hasOwnProperty']('nolimit')){_0x2a125d['limit']=qs['limit'](_0x2f0c1d['query'][_0x7f3b('0x20')]);_0x2a125d[_0x7f3b('0x1f')]=qs[_0x7f3b('0x1f')](_0x2f0c1d[_0x7f3b('0x36')][_0x7f3b('0x1f')]);}_0x2a125d[_0x7f3b('0x3d')]=qs[_0x7f3b('0x3e')](_0x2f0c1d['query'][_0x7f3b('0x3e')]);_0x2a125d[_0x7f3b('0x3f')]=qs[_0x7f3b('0x38')](_[_0x7f3b('0x40')](_0x2f0c1d['query'],_0x9bee51[_0x7f3b('0x38')]),_0x2f2755);if(_0x2f0c1d[_0x7f3b('0x36')]['filter']){_0x2a125d[_0x7f3b('0x3f')]=_[_0x7f3b('0x41')](_0x2a125d[_0x7f3b('0x3f')],{'$or':_[_0x7f3b('0x2e')](_0x2f2755,function(_0x51dedc){if(_0x51dedc['type']!==_0x7f3b('0x42')){var _0x89cdc3={};_0x89cdc3[_0x51dedc[_0x7f3b('0x35')]]={'$like':'%'+_0x2f0c1d[_0x7f3b('0x36')][_0x7f3b('0x43')]+'%'};return _0x89cdc3;}})});}_0x2a125d=_['merge']({},_0x2a125d,_0x2f0c1d[_0x7f3b('0x44')]);var _0x25e26e={'where':_0x2a125d['where']};return db['UserChatInteraction']['count'](_0x25e26e)['then'](function(_0x19563c){_0x5efceb[_0x7f3b('0x1e')]=_0x19563c;if(_0x2f0c1d['query'][_0x7f3b('0x45')]){_0x2a125d[_0x7f3b('0x46')]=[{'all':!![]}];}return db[_0x7f3b('0x2f')][_0x7f3b('0x47')](_0x2a125d);})[_0x7f3b('0x25')](function(_0x45d984){_0x5efceb[_0x7f3b('0x48')]=_0x45d984;return _0x5efceb;})[_0x7f3b('0x25')](respondWithFilteredResult(_0x5a51d6,_0x2a125d))[_0x7f3b('0x49')](handleError(_0x5a51d6,null));};exports['show']=function(_0x45ce52,_0x1fb68e){var _0x58a197={'raw':!![],'where':{'id':_0x45ce52[_0x7f3b('0x4a')]['id']}},_0x27bb31={};_0x27bb31[_0x7f3b('0x34')]=_[_0x7f3b('0x37')](db[_0x7f3b('0x2f')][_0x7f3b('0x30')]);_0x27bb31['query']=_['keys'](_0x45ce52['query']);_0x27bb31[_0x7f3b('0x38')]=_[_0x7f3b('0x39')](_0x27bb31[_0x7f3b('0x34')],_0x27bb31[_0x7f3b('0x36')]);_0x58a197['attributes']=_[_0x7f3b('0x39')](_0x27bb31[_0x7f3b('0x34')],qs['fields'](_0x45ce52[_0x7f3b('0x36')][_0x7f3b('0x3b')]));_0x58a197[_0x7f3b('0x3a')]=_0x58a197[_0x7f3b('0x3a')][_0x7f3b('0x3c')]?_0x58a197[_0x7f3b('0x3a')]:_0x27bb31[_0x7f3b('0x34')];if(_0x45ce52['query'][_0x7f3b('0x45')]){_0x58a197['include']=[{'all':!![]}];}_0x58a197=_[_0x7f3b('0x41')]({},_0x58a197,_0x45ce52['options']);return db[_0x7f3b('0x2f')][_0x7f3b('0x4b')](_0x58a197)[_0x7f3b('0x25')](handleEntityNotFound(_0x1fb68e,null))[_0x7f3b('0x25')](respondWithResult(_0x1fb68e,null))['catch'](handleError(_0x1fb68e,null));};exports[_0x7f3b('0x4c')]=function(_0x2e7b46,_0x1a2795){return db[_0x7f3b('0x2f')][_0x7f3b('0x4c')](_0x2e7b46['body'],{})[_0x7f3b('0x25')](function(_0x44a945){var _0x2765fe=_0x2e7b46[_0x7f3b('0x4d')][_0x7f3b('0x26')]({'plain':!![]});if(!_0x2765fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2765fe[_0x7f3b('0x4e')]===_0x7f3b('0x4d')){var _0x4c7594=_0x44a945[_0x7f3b('0x26')]({'plain':!![]});var _0x5c9bf2=_0x7f3b('0x27');return db[_0x7f3b('0x4f')]['find']({'where':{'name':_0x5c9bf2,'userProfileId':_0x2765fe[_0x7f3b('0x50')]},'raw':!![]})['then'](function(_0x288e45){if(_0x288e45&&_0x288e45[_0x7f3b('0x51')]===0x0){return db[_0x7f3b('0x28')]['create']({'name':_0x4c7594['name'],'resourceId':_0x4c7594['id'],'type':_0x288e45[_0x7f3b('0x35')],'sectionId':_0x288e45['id']},{})[_0x7f3b('0x25')](function(){return _0x44a945;});}else{return _0x44a945;}})[_0x7f3b('0x49')](function(_0x55d13d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55d13d);throw _0x55d13d;});}return _0x44a945;})[_0x7f3b('0x25')](respondWithResult(_0x1a2795,0xc9))[_0x7f3b('0x49')](handleError(_0x1a2795,null));};exports[_0x7f3b('0x52')]=function(_0x31381d,_0x1e3168){if(_0x31381d[_0x7f3b('0x53')]['id']){delete _0x31381d['body']['id'];}return db['UserChatInteraction'][_0x7f3b('0x4b')]({'where':{'id':_0x31381d['params']['id']}})[_0x7f3b('0x25')](handleEntityNotFound(_0x1e3168,null))[_0x7f3b('0x25')](saveUpdates(_0x31381d[_0x7f3b('0x53')],null))['then'](respondWithResult(_0x1e3168,null))[_0x7f3b('0x49')](handleError(_0x1e3168,null));};exports[_0x7f3b('0x24')]=function(_0x411ded,_0x3162b7){return db[_0x7f3b('0x2f')]['find']({'where':{'id':_0x411ded[_0x7f3b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3162b7,null))['then'](removeEntity(_0x3162b7,null))[_0x7f3b('0x49')](handleError(_0x3162b7,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index f98d392..64cb1e0 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 _0xdd75=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserChatInteraction.attributes','define','util'];(function(_0x2976d5,_0x394a5e){var _0x4b57e0=function(_0x3c9508){while(--_0x3c9508){_0x2976d5['push'](_0x2976d5['shift']());}};_0x4b57e0(++_0x394a5e);}(_0xdd75,0x18b));var _0x5dd7=function(_0x273502,_0x1c173c){_0x273502=_0x273502-0x0;var _0x379e87=_0xdd75[_0x273502];return _0x379e87;};'use strict';var _=require('lodash');var util=require(_0x5dd7('0x0'));var logger=require(_0x5dd7('0x1'))(_0x5dd7('0x2'));var moment=require(_0x5dd7('0x3'));var BPromise=require(_0x5dd7('0x4'));var rp=require(_0x5dd7('0x5'));var fs=require('fs');var path=require(_0x5dd7('0x6'));var rimraf=require(_0x5dd7('0x7'));var config=require(_0x5dd7('0x8'));var attributes=require(_0x5dd7('0x9'));module['exports']=function(_0x441085,_0x4019b7){return _0x441085[_0x5dd7('0xa')]('UserChatInteraction',attributes,{'tableName':'user_has_chat_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a73=['define','UserChatInteraction','user_has_chat_interactions','api','moment','bluebird','request-promise','rimraf','../../config/environment','./UserChatInteraction.attributes','exports'];(function(_0x444281,_0x2658d9){var _0x2fe481=function(_0x4ac145){while(--_0x4ac145){_0x444281['push'](_0x444281['shift']());}};_0x2fe481(++_0x2658d9);}(_0x0a73,0x1f2));var _0x30a7=function(_0x26dc96,_0x10c6f5){_0x26dc96=_0x26dc96-0x0;var _0x30b7be=_0x0a73[_0x26dc96];return _0x30b7be;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x30a7('0x0'));var moment=require(_0x30a7('0x1'));var BPromise=require(_0x30a7('0x2'));var rp=require(_0x30a7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30a7('0x4'));var config=require(_0x30a7('0x5'));var attributes=require(_0x30a7('0x6'));module[_0x30a7('0x7')]=function(_0x1ab93d,_0x50737b){return _0x1ab93d[_0x30a7('0x8')](_0x30a7('0x9'),attributes,{'tableName':_0x30a7('0xa'),'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 867b7cd..fed6a9e 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 _0x6fee=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x4299c4,_0xb792f4){var _0x8785c9=function(_0x10e4a9){while(--_0x10e4a9){_0x4299c4['push'](_0x4299c4['shift']());}};_0x8785c9(++_0xb792f4);}(_0x6fee,0xad));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe6fe('0x0'));var moment=require(_0xe6fe('0x1'));var BPromise=require(_0xe6fe('0x2'));var rs=require(_0xe6fe('0x3'));var fs=require('fs');var Redis=require(_0xe6fe('0x4'));var db=require(_0xe6fe('0x5'))['db'];var utils=require(_0xe6fe('0x6'));var logger=require(_0xe6fe('0x7'))(_0xe6fe('0x8'));var config=require(_0xe6fe('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe6fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38be30,_0x26259e,_0x270a68){return new BPromise(function(_0x128e78,_0x19011e){return client[_0xe6fe('0xb')](_0x38be30,_0x270a68)[_0xe6fe('0xc')](function(_0x33df8c){logger[_0xe6fe('0xd')](_0xe6fe('0xe'),_0x26259e,_0xe6fe('0xf'));logger[_0xe6fe('0x10')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x26259e,_0xe6fe('0xf'),JSON['stringify'](_0x33df8c));if(_0x33df8c[_0xe6fe('0x11')]){if(_0x33df8c[_0xe6fe('0x11')][_0xe6fe('0x12')]===0x1f4){logger[_0xe6fe('0x11')](_0xe6fe('0xe'),_0x26259e,_0x33df8c[_0xe6fe('0x11')]['message']);return _0x19011e(_0x33df8c[_0xe6fe('0x11')]['message']);}logger[_0xe6fe('0x11')](_0xe6fe('0xe'),_0x26259e,_0x33df8c[_0xe6fe('0x11')][_0xe6fe('0x13')]);return _0x128e78(_0x33df8c[_0xe6fe('0x11')][_0xe6fe('0x13')]);}else{logger['info'](_0xe6fe('0xe'),_0x26259e,_0xe6fe('0xf'));_0x128e78(_0x33df8c[_0xe6fe('0x14')][_0xe6fe('0x13')]);}})[_0xe6fe('0x15')](function(_0x15ada0){logger['error'](_0xe6fe('0xe'),_0x26259e,_0x15ada0);_0x19011e(_0x15ada0);});});} \ No newline at end of file +var _0xe885=['info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x417dd5,_0x44ab67){var _0x1f110c=function(_0x17f28d){while(--_0x17f28d){_0x417dd5['push'](_0x417dd5['shift']());}};_0x1f110c(++_0x44ab67);}(_0xe885,0x1ac));var _0x5e88=function(_0x1769e5,_0x449f13){_0x1769e5=_0x1769e5-0x0;var _0x153de8=_0xe885[_0x1769e5];return _0x153de8;};'use strict';var _=require(_0x5e88('0x0'));var util=require(_0x5e88('0x1'));var moment=require(_0x5e88('0x2'));var BPromise=require(_0x5e88('0x3'));var rs=require(_0x5e88('0x4'));var fs=require('fs');var Redis=require(_0x5e88('0x5'));var db=require(_0x5e88('0x6'))['db'];var utils=require(_0x5e88('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5e88('0x8'));var jayson=require(_0x5e88('0x9'));var client=jayson[_0x5e88('0xa')][_0x5e88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b5291,_0xf809af,_0x4cf534){return new BPromise(function(_0x1f9c13,_0x36b935){return client['request'](_0x1b5291,_0x4cf534)['then'](function(_0x1075bd){logger[_0x5e88('0xc')](_0x5e88('0xd'),_0xf809af,_0x5e88('0xe'));logger[_0x5e88('0xf')](_0x5e88('0x10'),_0xf809af,'request\x20sent',JSON['stringify'](_0x1075bd));if(_0x1075bd[_0x5e88('0x11')]){if(_0x1075bd[_0x5e88('0x11')][_0x5e88('0x12')]===0x1f4){logger['error'](_0x5e88('0xd'),_0xf809af,_0x1075bd[_0x5e88('0x11')]['message']);return _0x36b935(_0x1075bd['error']['message']);}logger[_0x5e88('0x11')](_0x5e88('0xd'),_0xf809af,_0x1075bd[_0x5e88('0x11')][_0x5e88('0x13')]);return _0x1f9c13(_0x1075bd[_0x5e88('0x11')][_0x5e88('0x13')]);}else{logger[_0x5e88('0xc')](_0x5e88('0xd'),_0xf809af,'request\x20sent');_0x1f9c13(_0x1075bd['result'][_0x5e88('0x13')]);}})['catch'](function(_0x5b6279){logger[_0x5e88('0x11')](_0x5e88('0xd'),_0xf809af,_0x5b6279);_0x36b935(_0x5b6279);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index b0ae9ef..de1d23b 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 _0xf745=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show'];(function(_0x51e8c4,_0xb80d6){var _0xbc9969=function(_0x47e58a){while(--_0x47e58a){_0x51e8c4['push'](_0x51e8c4['shift']());}};_0xbc9969(++_0xb80d6);}(_0xf745,0x138));var _0x5f74=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf745[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x5f74('0x0'));var util=require(_0x5f74('0x1'));var path=require(_0x5f74('0x2'));var timeout=require(_0x5f74('0x3'));var express=require(_0x5f74('0x4'));var router=express[_0x5f74('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5f74('0x6'));var config=require(_0x5f74('0x7'));var controller=require('./UserChatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5f74('0x8')]);router['get'](_0x5f74('0x9'),auth[_0x5f74('0xa')](),controller[_0x5f74('0xb')]);router[_0x5f74('0xc')]('/',auth['isAuthenticated'](),controller[_0x5f74('0xd')]);router['put'](_0x5f74('0x9'),auth[_0x5f74('0xa')](),controller[_0x5f74('0xe')]);router[_0x5f74('0xf')](_0x5f74('0x9'),auth[_0x5f74('0xa')](),controller[_0x5f74('0x10')]);module[_0x5f74('0x11')]=router; \ No newline at end of file +var _0x4965=['put','delete','/:id','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserChatInteraction.controller','get','isAuthenticated','show','post'];(function(_0x31ae71,_0x1c3de0){var _0x7d40e8=function(_0x346280){while(--_0x346280){_0x31ae71['push'](_0x31ae71['shift']());}};_0x7d40e8(++_0x1c3de0);}(_0x4965,0xaf));var _0x5496=function(_0x4e25fe,_0x24b0c2){_0x4e25fe=_0x4e25fe-0x0;var _0x17fc4d=_0x4965[_0x4e25fe];return _0x17fc4d;};'use strict';var multer=require(_0x5496('0x0'));var util=require(_0x5496('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5496('0x2'));var router=express[_0x5496('0x3')]();var auth=require(_0x5496('0x4'));var interaction=require(_0x5496('0x5'));var config=require(_0x5496('0x6'));var controller=require(_0x5496('0x7'));router[_0x5496('0x8')]('/',auth[_0x5496('0x9')](),controller['index']);router['get']('/:id',auth[_0x5496('0x9')](),controller[_0x5496('0xa')]);router[_0x5496('0xb')]('/',auth[_0x5496('0x9')](),controller['create']);router[_0x5496('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5496('0xd')](_0x5496('0xe'),auth[_0x5496('0x9')](),controller[_0x5496('0xf')]);module[_0x5496('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index 44f2d23..a746f41 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 _0x22e8=['INTEGER'];(function(_0x473150,_0xc3b8e){var _0x13d585=function(_0x546231){while(--_0x546231){_0x473150['push'](_0x473150['shift']());}};_0x13d585(++_0xc3b8e);}(_0x22e8,0xb0));var _0x822e=function(_0x3b3a02,_0x556603){_0x3b3a02=_0x3b3a02-0x0;var _0x48a62d=_0x22e8[_0x3b3a02];return _0x48a62d;};'use strict';var Sequelize=require('sequelize');module['exports']={'FaxInteractionId':{'type':Sequelize[_0x822e('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x822e('0x0')],'primaryKey':!![]}}; \ No newline at end of file +var _0x8ead=['exports','INTEGER','sequelize'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x8ead,0x1c4));var _0xd8ea=function(_0x15da14,_0x3b8014){_0x15da14=_0x15da14-0x0;var _0x5cf224=_0x8ead[_0x15da14];return _0x5cf224;};'use strict';var Sequelize=require(_0xd8ea('0x0'));module[_0xd8ea('0x1')]={'FaxInteractionId':{'type':Sequelize[_0xd8ea('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xd8ea('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 41d8e95..eddb0c7 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 _0x15dc=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','reject','save','update','then','destroy','get','UserFaxInteractions','UserProfileResource','sendStatus','error','stack','name','index','map','UserFaxInteraction','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x37449e,_0x328f3a){var _0x2d22ad=function(_0x27080c){while(--_0x27080c){_0x37449e['push'](_0x37449e['shift']());}};_0x2d22ad(++_0x328f3a);}(_0x15dc,0x191));var _0xc15d=function(_0xdff4d0,_0x284cbf){_0xdff4d0=_0xdff4d0-0x0;var _0x9f262a=_0x15dc[_0xdff4d0];return _0x9f262a;};'use strict';var pdf=require(_0xc15d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc15d('0x1'));var zipdir=require(_0xc15d('0x2'));var jsonpatch=require(_0xc15d('0x3'));var rp=require('request-promise');var moment=require(_0xc15d('0x4'));var BPromise=require(_0xc15d('0x5'));var Mustache=require(_0xc15d('0x6'));var util=require(_0xc15d('0x7'));var path=require(_0xc15d('0x8'));var sox=require(_0xc15d('0x9'));var csv=require('to-csv');var ejs=require(_0xc15d('0xa'));var fs=require('fs');var _=require(_0xc15d('0xb'));var squel=require(_0xc15d('0xc'));var crypto=require(_0xc15d('0xd'));var jsforce=require(_0xc15d('0xe'));var deskjs=require(_0xc15d('0xf'));var toCsv=require(_0xc15d('0x10'));var querystring=require(_0xc15d('0x11'));var Papa=require('papaparse');var Redis=require(_0xc15d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc15d('0x13'));var as=require(_0xc15d('0x14'));var hardwareService=require(_0xc15d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc15d('0x16'));var config=require(_0xc15d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc15d('0x18'))['db'];function respondWithStatusCode(_0x3809b2,_0x5000a2){_0x5000a2=_0x5000a2||0xcc;return function(_0x4dc17b){if(_0x4dc17b){return _0x3809b2['sendStatus'](_0x5000a2);}return _0x3809b2[_0xc15d('0x19')](_0x5000a2)[_0xc15d('0x1a')]();};}function respondWithResult(_0xee3b11,_0x2bac51){_0x2bac51=_0x2bac51||0xc8;return function(_0x417734){if(_0x417734){return _0xee3b11[_0xc15d('0x19')](_0x2bac51)['json'](_0x417734);}};}function respondWithFilteredResult(_0x9e4143,_0x29260a){return function(_0x22e961){if(_0x22e961){var _0x5a8e80=_0x22e961[_0xc15d('0x1b')],_0x315718=_0x29260a[_0xc15d('0x1c')],_0x107a2a=_0x29260a['offset']+_0x29260a[_0xc15d('0x1d')],_0x2b0fe9;if(_0x107a2a>=_0x5a8e80){_0x107a2a=_0x5a8e80;_0x2b0fe9=0xc8;}else{_0x2b0fe9=0xce;}_0x9e4143[_0xc15d('0x19')](_0x2b0fe9);return _0x9e4143[_0xc15d('0x1e')]('Content-Range',_0x315718+'-'+_0x107a2a+'/'+_0x5a8e80)['json'](_0x22e961);}return null;};}function patchUpdates(_0x48f51f){return function(_0x256464){try{jsonpatch['apply'](_0x256464,_0x48f51f,!![]);}catch(_0x212cc9){return BPromise[_0xc15d('0x1f')](_0x212cc9);}return _0x256464[_0xc15d('0x20')]();};}function saveUpdates(_0x2af0f3,_0x301113){return function(_0x2eca0e){if(_0x2eca0e){return _0x2eca0e[_0xc15d('0x21')](_0x2af0f3)[_0xc15d('0x22')](function(_0xce941f){return _0xce941f;});}return null;};}function removeEntity(_0x2e3c9a,_0x8eba7f){return function(_0x4c3a0c){if(_0x4c3a0c){return _0x4c3a0c[_0xc15d('0x23')]()['then'](function(){var _0xa3face=_0x4c3a0c[_0xc15d('0x24')]({'plain':!![]});var _0x5e22d9=_0xc15d('0x25');return db[_0xc15d('0x26')]['destroy']({'where':{'type':_0x5e22d9,'resourceId':_0xa3face['id']}})[_0xc15d('0x22')](function(){return _0x4c3a0c;});})[_0xc15d('0x22')](function(){_0x2e3c9a[_0xc15d('0x19')](0xcc)[_0xc15d('0x1a')]();});}};}function handleEntityNotFound(_0x4acfe2,_0x1a24e6){return function(_0x343943){if(!_0x343943){_0x4acfe2[_0xc15d('0x27')](0x194);}return _0x343943;};}function handleError(_0x248f07,_0x13587e){_0x13587e=_0x13587e||0x1f4;return function(_0x57bee9){logger[_0xc15d('0x28')](_0x57bee9[_0xc15d('0x29')]);if(_0x57bee9[_0xc15d('0x2a')]){delete _0x57bee9[_0xc15d('0x2a')];}_0x248f07[_0xc15d('0x19')](_0x13587e)['send'](_0x57bee9);};}exports[_0xc15d('0x2b')]=function(_0xb8b14c,_0x4c02b2){var _0x512d17={},_0x2d98a0={},_0x156d6b={'count':0x0,'rows':[]};var _0x24469a=_[_0xc15d('0x2c')](db[_0xc15d('0x2d')][_0xc15d('0x2e')],function(_0xa01110){return{'name':_0xa01110[_0xc15d('0x2f')],'type':_0xa01110[_0xc15d('0x30')]['key']};});_0x2d98a0[_0xc15d('0x31')]=_[_0xc15d('0x2c')](_0x24469a,'name');_0x2d98a0[_0xc15d('0x32')]=_['keys'](_0xb8b14c[_0xc15d('0x32')]);_0x2d98a0['filters']=_[_0xc15d('0x33')](_0x2d98a0[_0xc15d('0x31')],_0x2d98a0[_0xc15d('0x32')]);_0x512d17[_0xc15d('0x34')]=_[_0xc15d('0x33')](_0x2d98a0['model'],qs[_0xc15d('0x35')](_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x35')]));_0x512d17[_0xc15d('0x34')]=_0x512d17[_0xc15d('0x34')][_0xc15d('0x36')]?_0x512d17[_0xc15d('0x34')]:_0x2d98a0[_0xc15d('0x31')];if(!_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x37')](_0xc15d('0x38'))){_0x512d17[_0xc15d('0x1d')]=qs[_0xc15d('0x1d')](_0xb8b14c['query'][_0xc15d('0x1d')]);_0x512d17[_0xc15d('0x1c')]=qs[_0xc15d('0x1c')](_0xb8b14c['query'][_0xc15d('0x1c')]);}_0x512d17[_0xc15d('0x39')]=qs['sort'](_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x3a')]);_0x512d17[_0xc15d('0x3b')]=qs[_0xc15d('0x3c')](_[_0xc15d('0x3d')](_0xb8b14c['query'],_0x2d98a0[_0xc15d('0x3c')]),_0x24469a);if(_0xb8b14c['query']['filter']){_0x512d17[_0xc15d('0x3b')]=_[_0xc15d('0x3e')](_0x512d17[_0xc15d('0x3b')],{'$or':_['map'](_0x24469a,function(_0x37e7cb){if(_0x37e7cb[_0xc15d('0x30')]!==_0xc15d('0x3f')){var _0x2f5631={};_0x2f5631[_0x37e7cb[_0xc15d('0x2a')]]={'$like':'%'+_0xb8b14c['query'][_0xc15d('0x40')]+'%'};return _0x2f5631;}})});}_0x512d17=_[_0xc15d('0x3e')]({},_0x512d17,_0xb8b14c['options']);var _0x350461={'where':_0x512d17[_0xc15d('0x3b')]};return db[_0xc15d('0x2d')][_0xc15d('0x1b')](_0x350461)[_0xc15d('0x22')](function(_0x3a7647){_0x156d6b[_0xc15d('0x1b')]=_0x3a7647;if(_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x41')]){_0x512d17[_0xc15d('0x42')]=[{'all':!![]}];}return db[_0xc15d('0x2d')][_0xc15d('0x43')](_0x512d17);})['then'](function(_0x280177){_0x156d6b['rows']=_0x280177;return _0x156d6b;})['then'](respondWithFilteredResult(_0x4c02b2,_0x512d17))['catch'](handleError(_0x4c02b2,null));};exports[_0xc15d('0x44')]=function(_0x584f70,_0x405aa2){var _0x44c8b7={'raw':!![],'where':{'id':_0x584f70[_0xc15d('0x45')]['id']}},_0x2a4d78={};_0x2a4d78['model']=_[_0xc15d('0x46')](db[_0xc15d('0x2d')][_0xc15d('0x2e')]);_0x2a4d78[_0xc15d('0x32')]=_[_0xc15d('0x46')](_0x584f70[_0xc15d('0x32')]);_0x2a4d78[_0xc15d('0x3c')]=_['intersection'](_0x2a4d78[_0xc15d('0x31')],_0x2a4d78[_0xc15d('0x32')]);_0x44c8b7[_0xc15d('0x34')]=_[_0xc15d('0x33')](_0x2a4d78[_0xc15d('0x31')],qs[_0xc15d('0x35')](_0x584f70[_0xc15d('0x32')][_0xc15d('0x35')]));_0x44c8b7[_0xc15d('0x34')]=_0x44c8b7[_0xc15d('0x34')][_0xc15d('0x36')]?_0x44c8b7['attributes']:_0x2a4d78[_0xc15d('0x31')];if(_0x584f70[_0xc15d('0x32')][_0xc15d('0x41')]){_0x44c8b7[_0xc15d('0x42')]=[{'all':!![]}];}_0x44c8b7=_[_0xc15d('0x3e')]({},_0x44c8b7,_0x584f70[_0xc15d('0x47')]);return db[_0xc15d('0x2d')][_0xc15d('0x48')](_0x44c8b7)[_0xc15d('0x22')](handleEntityNotFound(_0x405aa2,null))[_0xc15d('0x22')](respondWithResult(_0x405aa2,null))[_0xc15d('0x49')](handleError(_0x405aa2,null));};exports[_0xc15d('0x4a')]=function(_0x1e084c,_0x406dae){return db['UserFaxInteraction'][_0xc15d('0x4a')](_0x1e084c[_0xc15d('0x4b')],{})[_0xc15d('0x22')](function(_0x3d6eb0){var _0x3e67b0=_0x1e084c[_0xc15d('0x4c')][_0xc15d('0x24')]({'plain':!![]});if(!_0x3e67b0)throw new Error(_0xc15d('0x4d'));if(_0x3e67b0[_0xc15d('0x4e')]==='user'){var _0x45b1e2=_0x3d6eb0[_0xc15d('0x24')]({'plain':!![]});var _0xd58757=_0xc15d('0x25');return db[_0xc15d('0x4f')]['find']({'where':{'name':_0xd58757,'userProfileId':_0x3e67b0[_0xc15d('0x50')]},'raw':!![]})[_0xc15d('0x22')](function(_0x467e42){if(_0x467e42&&_0x467e42['autoAssociation']===0x0){return db['UserProfileResource'][_0xc15d('0x4a')]({'name':_0x45b1e2['name'],'resourceId':_0x45b1e2['id'],'type':_0x467e42['name'],'sectionId':_0x467e42['id']},{})[_0xc15d('0x22')](function(){return _0x3d6eb0;});}else{return _0x3d6eb0;}})[_0xc15d('0x49')](function(_0x249f97){logger[_0xc15d('0x28')](_0xc15d('0x51'),_0x249f97);throw _0x249f97;});}return _0x3d6eb0;})[_0xc15d('0x22')](respondWithResult(_0x406dae,0xc9))[_0xc15d('0x49')](handleError(_0x406dae,null));};exports[_0xc15d('0x21')]=function(_0x44af31,_0x2fd489){if(_0x44af31[_0xc15d('0x4b')]['id']){delete _0x44af31[_0xc15d('0x4b')]['id'];}return db['UserFaxInteraction'][_0xc15d('0x48')]({'where':{'id':_0x44af31[_0xc15d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fd489,null))[_0xc15d('0x22')](saveUpdates(_0x44af31[_0xc15d('0x4b')],null))['then'](respondWithResult(_0x2fd489,null))[_0xc15d('0x49')](handleError(_0x2fd489,null));};exports[_0xc15d('0x23')]=function(_0x173297,_0x1738bf){return db['UserFaxInteraction'][_0xc15d('0x48')]({'where':{'id':_0x173297[_0xc15d('0x45')]['id']}})[_0xc15d('0x22')](handleEntityNotFound(_0x1738bf,null))[_0xc15d('0x22')](removeEntity(_0x1738bf,null))[_0xc15d('0x49')](handleError(_0x1738bf,null));}; \ No newline at end of file +var _0xdfcf=['attributes','intersection','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../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','UserFaxInteractions','UserProfileResource','error','stack','name','send','index','UserFaxInteraction','fieldName','type','key','model','map','query','keys','filters'];(function(_0x316e62,_0x51cdbd){var _0x2f9854=function(_0x24f44c){while(--_0x24f44c){_0x316e62['push'](_0x316e62['shift']());}};_0x2f9854(++_0x51cdbd);}(_0xdfcf,0x1aa));var _0xfdfc=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xdfcf[_0xc0a3d3];return _0x3386e8;};'use strict';var pdf=require(_0xfdfc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfdfc('0x1'));var zipdir=require(_0xfdfc('0x2'));var jsonpatch=require(_0xfdfc('0x3'));var rp=require(_0xfdfc('0x4'));var moment=require(_0xfdfc('0x5'));var BPromise=require(_0xfdfc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfdfc('0x7'));var sox=require('sox');var csv=require(_0xfdfc('0x8'));var ejs=require(_0xfdfc('0x9'));var fs=require('fs');var _=require(_0xfdfc('0xa'));var squel=require(_0xfdfc('0xb'));var crypto=require(_0xfdfc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfdfc('0xd'));var toCsv=require(_0xfdfc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfdfc('0xe'));var authService=require(_0xfdfc('0xf'));var qs=require(_0xfdfc('0x10'));var as=require(_0xfdfc('0x11'));var hardwareService=require(_0xfdfc('0x12'));var logger=require('../../config/logger')(_0xfdfc('0x13'));var utils=require(_0xfdfc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfdfc('0x15'));var db=require(_0xfdfc('0x16'))['db'];function respondWithStatusCode(_0x4b50f4,_0x3022f6){_0x3022f6=_0x3022f6||0xcc;return function(_0x454882){if(_0x454882){return _0x4b50f4[_0xfdfc('0x17')](_0x3022f6);}return _0x4b50f4[_0xfdfc('0x18')](_0x3022f6)[_0xfdfc('0x19')]();};}function respondWithResult(_0x17152b,_0x414f76){_0x414f76=_0x414f76||0xc8;return function(_0x4392a5){if(_0x4392a5){return _0x17152b[_0xfdfc('0x18')](_0x414f76)[_0xfdfc('0x1a')](_0x4392a5);}};}function respondWithFilteredResult(_0x40a59f,_0x94fa73){return function(_0x33553e){if(_0x33553e){var _0xd582db=_0x33553e[_0xfdfc('0x1b')],_0xf96db9=_0x94fa73[_0xfdfc('0x1c')],_0x5dd7d7=_0x94fa73['offset']+_0x94fa73[_0xfdfc('0x1d')],_0x22ce27;if(_0x5dd7d7>=_0xd582db){_0x5dd7d7=_0xd582db;_0x22ce27=0xc8;}else{_0x22ce27=0xce;}_0x40a59f['status'](_0x22ce27);return _0x40a59f[_0xfdfc('0x1e')](_0xfdfc('0x1f'),_0xf96db9+'-'+_0x5dd7d7+'/'+_0xd582db)['json'](_0x33553e);}return null;};}function patchUpdates(_0x50c0d0){return function(_0x220253){try{jsonpatch[_0xfdfc('0x20')](_0x220253,_0x50c0d0,!![]);}catch(_0x75e660){return BPromise[_0xfdfc('0x21')](_0x75e660);}return _0x220253[_0xfdfc('0x22')]();};}function saveUpdates(_0x1b77d3,_0x21e7bf){return function(_0x175243){if(_0x175243){return _0x175243['update'](_0x1b77d3)[_0xfdfc('0x23')](function(_0x4fcf0b){return _0x4fcf0b;});}return null;};}function removeEntity(_0x15d0fa,_0x4c824a){return function(_0x28eeca){if(_0x28eeca){return _0x28eeca[_0xfdfc('0x24')]()[_0xfdfc('0x23')](function(){var _0x5c0035=_0x28eeca[_0xfdfc('0x25')]({'plain':!![]});var _0x2ca379=_0xfdfc('0x26');return db[_0xfdfc('0x27')][_0xfdfc('0x24')]({'where':{'type':_0x2ca379,'resourceId':_0x5c0035['id']}})[_0xfdfc('0x23')](function(){return _0x28eeca;});})[_0xfdfc('0x23')](function(){_0x15d0fa[_0xfdfc('0x18')](0xcc)[_0xfdfc('0x19')]();});}};}function handleEntityNotFound(_0x1ad50f,_0x381910){return function(_0x621cff){if(!_0x621cff){_0x1ad50f['sendStatus'](0x194);}return _0x621cff;};}function handleError(_0x31a924,_0x3e56bd){_0x3e56bd=_0x3e56bd||0x1f4;return function(_0x21c745){logger[_0xfdfc('0x28')](_0x21c745[_0xfdfc('0x29')]);if(_0x21c745[_0xfdfc('0x2a')]){delete _0x21c745[_0xfdfc('0x2a')];}_0x31a924[_0xfdfc('0x18')](_0x3e56bd)[_0xfdfc('0x2b')](_0x21c745);};}exports[_0xfdfc('0x2c')]=function(_0xae350,_0x3da919){var _0x27a04c={},_0x3925ce={},_0x5d6f1c={'count':0x0,'rows':[]};var _0x4b95c3=_['map'](db[_0xfdfc('0x2d')]['rawAttributes'],function(_0x4775eb){return{'name':_0x4775eb[_0xfdfc('0x2e')],'type':_0x4775eb[_0xfdfc('0x2f')][_0xfdfc('0x30')]};});_0x3925ce[_0xfdfc('0x31')]=_[_0xfdfc('0x32')](_0x4b95c3,_0xfdfc('0x2a'));_0x3925ce[_0xfdfc('0x33')]=_[_0xfdfc('0x34')](_0xae350['query']);_0x3925ce[_0xfdfc('0x35')]=_['intersection'](_0x3925ce[_0xfdfc('0x31')],_0x3925ce['query']);_0x27a04c[_0xfdfc('0x36')]=_[_0xfdfc('0x37')](_0x3925ce[_0xfdfc('0x31')],qs[_0xfdfc('0x38')](_0xae350[_0xfdfc('0x33')][_0xfdfc('0x38')]));_0x27a04c[_0xfdfc('0x36')]=_0x27a04c[_0xfdfc('0x36')]['length']?_0x27a04c[_0xfdfc('0x36')]:_0x3925ce['model'];if(!_0xae350[_0xfdfc('0x33')][_0xfdfc('0x39')]('nolimit')){_0x27a04c[_0xfdfc('0x1d')]=qs[_0xfdfc('0x1d')](_0xae350[_0xfdfc('0x33')][_0xfdfc('0x1d')]);_0x27a04c['offset']=qs['offset'](_0xae350[_0xfdfc('0x33')][_0xfdfc('0x1c')]);}_0x27a04c['order']=qs[_0xfdfc('0x3a')](_0xae350['query']['sort']);_0x27a04c[_0xfdfc('0x3b')]=qs[_0xfdfc('0x35')](_['pick'](_0xae350[_0xfdfc('0x33')],_0x3925ce['filters']),_0x4b95c3);if(_0xae350[_0xfdfc('0x33')][_0xfdfc('0x3c')]){_0x27a04c[_0xfdfc('0x3b')]=_[_0xfdfc('0x3d')](_0x27a04c['where'],{'$or':_[_0xfdfc('0x32')](_0x4b95c3,function(_0xe5ad10){if(_0xe5ad10['type']!==_0xfdfc('0x3e')){var _0x4f07fc={};_0x4f07fc[_0xe5ad10[_0xfdfc('0x2a')]]={'$like':'%'+_0xae350[_0xfdfc('0x33')][_0xfdfc('0x3c')]+'%'};return _0x4f07fc;}})});}_0x27a04c=_[_0xfdfc('0x3d')]({},_0x27a04c,_0xae350[_0xfdfc('0x3f')]);var _0x3aabec={'where':_0x27a04c['where']};return db['UserFaxInteraction'][_0xfdfc('0x1b')](_0x3aabec)['then'](function(_0x2a8a67){_0x5d6f1c['count']=_0x2a8a67;if(_0xae350['query'][_0xfdfc('0x40')]){_0x27a04c[_0xfdfc('0x41')]=[{'all':!![]}];}return db[_0xfdfc('0x2d')][_0xfdfc('0x42')](_0x27a04c);})[_0xfdfc('0x23')](function(_0x4f0f46){_0x5d6f1c[_0xfdfc('0x43')]=_0x4f0f46;return _0x5d6f1c;})[_0xfdfc('0x23')](respondWithFilteredResult(_0x3da919,_0x27a04c))[_0xfdfc('0x44')](handleError(_0x3da919,null));};exports[_0xfdfc('0x45')]=function(_0x25b086,_0xdc2871){var _0x3c31ae={'raw':!![],'where':{'id':_0x25b086[_0xfdfc('0x46')]['id']}},_0x35b2d5={};_0x35b2d5[_0xfdfc('0x31')]=_[_0xfdfc('0x34')](db[_0xfdfc('0x2d')]['rawAttributes']);_0x35b2d5[_0xfdfc('0x33')]=_['keys'](_0x25b086[_0xfdfc('0x33')]);_0x35b2d5[_0xfdfc('0x35')]=_[_0xfdfc('0x37')](_0x35b2d5[_0xfdfc('0x31')],_0x35b2d5[_0xfdfc('0x33')]);_0x3c31ae['attributes']=_['intersection'](_0x35b2d5[_0xfdfc('0x31')],qs[_0xfdfc('0x38')](_0x25b086['query'][_0xfdfc('0x38')]));_0x3c31ae[_0xfdfc('0x36')]=_0x3c31ae[_0xfdfc('0x36')]['length']?_0x3c31ae[_0xfdfc('0x36')]:_0x35b2d5[_0xfdfc('0x31')];if(_0x25b086['query'][_0xfdfc('0x40')]){_0x3c31ae[_0xfdfc('0x41')]=[{'all':!![]}];}_0x3c31ae=_[_0xfdfc('0x3d')]({},_0x3c31ae,_0x25b086['options']);return db[_0xfdfc('0x2d')][_0xfdfc('0x47')](_0x3c31ae)['then'](handleEntityNotFound(_0xdc2871,null))['then'](respondWithResult(_0xdc2871,null))['catch'](handleError(_0xdc2871,null));};exports[_0xfdfc('0x48')]=function(_0x43f297,_0x1fd15c){return db[_0xfdfc('0x2d')][_0xfdfc('0x48')](_0x43f297[_0xfdfc('0x49')],{})['then'](function(_0x58d171){var _0x3f89fd=_0x43f297[_0xfdfc('0x4a')]['get']({'plain':!![]});if(!_0x3f89fd)throw new Error(_0xfdfc('0x4b'));if(_0x3f89fd[_0xfdfc('0x4c')]===_0xfdfc('0x4a')){var _0x37f1c1=_0x58d171[_0xfdfc('0x25')]({'plain':!![]});var _0x33414e=_0xfdfc('0x26');return db[_0xfdfc('0x4d')][_0xfdfc('0x47')]({'where':{'name':_0x33414e,'userProfileId':_0x3f89fd[_0xfdfc('0x4e')]},'raw':!![]})[_0xfdfc('0x23')](function(_0x17d139){if(_0x17d139&&_0x17d139['autoAssociation']===0x0){return db[_0xfdfc('0x27')][_0xfdfc('0x48')]({'name':_0x37f1c1[_0xfdfc('0x2a')],'resourceId':_0x37f1c1['id'],'type':_0x17d139[_0xfdfc('0x2a')],'sectionId':_0x17d139['id']},{})[_0xfdfc('0x23')](function(){return _0x58d171;});}else{return _0x58d171;}})[_0xfdfc('0x44')](function(_0x4209f4){logger[_0xfdfc('0x28')](_0xfdfc('0x4f'),_0x4209f4);throw _0x4209f4;});}return _0x58d171;})[_0xfdfc('0x23')](respondWithResult(_0x1fd15c,0xc9))[_0xfdfc('0x44')](handleError(_0x1fd15c,null));};exports['update']=function(_0x523bb3,_0x276c41){if(_0x523bb3[_0xfdfc('0x49')]['id']){delete _0x523bb3[_0xfdfc('0x49')]['id'];}return db[_0xfdfc('0x2d')][_0xfdfc('0x47')]({'where':{'id':_0x523bb3[_0xfdfc('0x46')]['id']}})[_0xfdfc('0x23')](handleEntityNotFound(_0x276c41,null))[_0xfdfc('0x23')](saveUpdates(_0x523bb3[_0xfdfc('0x49')],null))[_0xfdfc('0x23')](respondWithResult(_0x276c41,null))[_0xfdfc('0x44')](handleError(_0x276c41,null));};exports[_0xfdfc('0x24')]=function(_0x1399a2,_0x4a0d0c){return db[_0xfdfc('0x2d')][_0xfdfc('0x47')]({'where':{'id':_0x1399a2['params']['id']}})[_0xfdfc('0x23')](handleEntityNotFound(_0x4a0d0c,null))['then'](removeEntity(_0x4a0d0c,null))[_0xfdfc('0x44')](handleError(_0x4a0d0c,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index b6612d9..b7868f4 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(_0x4cccfc,_0x1b0d1c){var _0x2103b3=function(_0x3f99db){while(--_0x3f99db){_0x4cccfc['push'](_0x4cccfc['shift']());}};_0x2103b3(++_0x1b0d1c);}(_0xdb28,0x106));var _0x8db2=function(_0x106590,_0x143a18){_0x106590=_0x106590-0x0;var _0x104fbc=_0xdb28[_0x106590];return _0x104fbc;};'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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','lodash','util'];(function(_0x2e7ee5,_0x31bda8){var _0x1ca754=function(_0x3b92be){while(--_0x3b92be){_0x2e7ee5['push'](_0x2e7ee5['shift']());}};_0x1ca754(++_0x31bda8);}(_0xdb28,0x106));var _0x8db2=function(_0x137735,_0xc5d4f7){_0x137735=_0x137735-0x0;var _0x26f1cd=_0xdb28[_0x137735];return _0x26f1cd;};'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 diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index 465534f..ee45559 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 _0x361f=['request','then','info','UserFaxInteraction,\x20%s,\x20%s','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x339bb2,_0x271e84){var _0x323ba1=function(_0xe5160a){while(--_0xe5160a){_0x339bb2['push'](_0x339bb2['shift']());}};_0x323ba1(++_0x271e84);}(_0x361f,0xc8));var _0xf361=function(_0x317aa3,_0x6dd3a9){_0x317aa3=_0x317aa3-0x0;var _0x309c1f=_0x361f[_0x317aa3];return _0x309c1f;};'use strict';var _=require(_0xf361('0x0'));var util=require('util');var moment=require(_0xf361('0x1'));var BPromise=require('bluebird');var rs=require(_0xf361('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf361('0x3'))['db'];var utils=require(_0xf361('0x4'));var logger=require('../../config/logger')(_0xf361('0x5'));var config=require(_0xf361('0x6'));var jayson=require(_0xf361('0x7'));var client=jayson[_0xf361('0x8')][_0xf361('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x287e4a,_0x5436cb,_0x57de06){return new BPromise(function(_0x4c7f26,_0x15552d){return client[_0xf361('0xa')](_0x287e4a,_0x57de06)[_0xf361('0xb')](function(_0x4d7ff8){logger[_0xf361('0xc')](_0xf361('0xd'),_0x5436cb,'request\x20sent');logger['debug'](_0xf361('0xe'),_0x5436cb,_0xf361('0xf'),JSON['stringify'](_0x4d7ff8));if(_0x4d7ff8[_0xf361('0x10')]){if(_0x4d7ff8[_0xf361('0x10')][_0xf361('0x11')]===0x1f4){logger['error']('UserFaxInteraction,\x20%s,\x20%s',_0x5436cb,_0x4d7ff8[_0xf361('0x10')][_0xf361('0x12')]);return _0x15552d(_0x4d7ff8['error'][_0xf361('0x12')]);}logger[_0xf361('0x10')]('UserFaxInteraction,\x20%s,\x20%s',_0x5436cb,_0x4d7ff8[_0xf361('0x10')]['message']);return _0x4c7f26(_0x4d7ff8[_0xf361('0x10')][_0xf361('0x12')]);}else{logger[_0xf361('0xc')](_0xf361('0xd'),_0x5436cb,'request\x20sent');_0x4c7f26(_0x4d7ff8[_0xf361('0x13')]['message']);}})[_0xf361('0x14')](function(_0x469d5d){logger[_0xf361('0x10')](_0xf361('0xd'),_0x5436cb,_0x469d5d);_0x15552d(_0x469d5d);});});} \ No newline at end of file +var _0x06ae=['UserFaxInteraction,\x20%s,\x20%s','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x06ae,0xcb));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe06a('0x0'));var util=require(_0xe06a('0x1'));var moment=require(_0xe06a('0x2'));var BPromise=require(_0xe06a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe06a('0x4'))['db'];var utils=require(_0xe06a('0x5'));var logger=require(_0xe06a('0x6'))(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var jayson=require(_0xe06a('0x9'));var client=jayson[_0xe06a('0xa')][_0xe06a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fca64,_0x18177a,_0x43d482){return new BPromise(function(_0x5e5796,_0x459500){return client['request'](_0x3fca64,_0x43d482)[_0xe06a('0xc')](function(_0x23972a){logger['info'](_0xe06a('0xd'),_0x18177a,_0xe06a('0xe'));logger[_0xe06a('0xf')](_0xe06a('0x10'),_0x18177a,'request\x20sent',JSON[_0xe06a('0x11')](_0x23972a));if(_0x23972a[_0xe06a('0x12')]){if(_0x23972a[_0xe06a('0x12')][_0xe06a('0x13')]===0x1f4){logger[_0xe06a('0x12')](_0xe06a('0xd'),_0x18177a,_0x23972a[_0xe06a('0x12')][_0xe06a('0x14')]);return _0x459500(_0x23972a[_0xe06a('0x12')]['message']);}logger[_0xe06a('0x12')](_0xe06a('0xd'),_0x18177a,_0x23972a['error'][_0xe06a('0x14')]);return _0x5e5796(_0x23972a[_0xe06a('0x12')][_0xe06a('0x14')]);}else{logger[_0xe06a('0x15')](_0xe06a('0xd'),_0x18177a,_0xe06a('0xe'));_0x5e5796(_0x23972a[_0xe06a('0x16')][_0xe06a('0x14')]);}})[_0xe06a('0x17')](function(_0x49bed1){logger[_0xe06a('0x12')](_0xe06a('0xd'),_0x18177a,_0x49bed1);_0x459500(_0x49bed1);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index fd0a7e7..10fbbc0 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 _0x166e=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','update','destroy','exports','multer'];(function(_0x5c43e1,_0x4c1705){var _0x397fa7=function(_0x4485e8){while(--_0x4485e8){_0x5c43e1['push'](_0x5c43e1['shift']());}};_0x397fa7(++_0x4c1705);}(_0x166e,0x9f));var _0xe166=function(_0x2f067b,_0x23d257){_0x2f067b=_0x2f067b-0x0;var _0x1b7a26=_0x166e[_0x2f067b];return _0x1b7a26;};'use strict';var multer=require(_0xe166('0x0'));var util=require(_0xe166('0x1'));var path=require(_0xe166('0x2'));var timeout=require(_0xe166('0x3'));var express=require(_0xe166('0x4'));var router=express[_0xe166('0x5')]();var auth=require(_0xe166('0x6'));var interaction=require(_0xe166('0x7'));var config=require('../../config/environment');var controller=require('./UserFaxInteraction.controller');router[_0xe166('0x8')]('/',auth[_0xe166('0x9')](),controller[_0xe166('0xa')]);router['get'](_0xe166('0xb'),auth[_0xe166('0x9')](),controller['show']);router[_0xe166('0xc')]('/',auth[_0xe166('0x9')](),controller['create']);router['put']('/:id',auth[_0xe166('0x9')](),controller[_0xe166('0xd')]);router['delete'](_0xe166('0xb'),auth[_0xe166('0x9')](),controller[_0xe166('0xe')]);module[_0xe166('0xf')]=router; \ No newline at end of file +var _0xe174=['isAuthenticated','show','create','put','delete','exports','multer','util','express','../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','get','index','/:id'];(function(_0x5928dd,_0x359e76){var _0x2df574=function(_0x5dcf39){while(--_0x5dcf39){_0x5928dd['push'](_0x5928dd['shift']());}};_0x2df574(++_0x359e76);}(_0xe174,0x1c8));var _0x4e17=function(_0x116c77,_0x4d1eff){_0x116c77=_0x116c77-0x0;var _0x583f06=_0xe174[_0x116c77];return _0x583f06;};'use strict';var multer=require(_0x4e17('0x0'));var util=require(_0x4e17('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e17('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4e17('0x3'));var config=require(_0x4e17('0x4'));var controller=require(_0x4e17('0x5'));router[_0x4e17('0x6')]('/',auth['isAuthenticated'](),controller[_0x4e17('0x7')]);router[_0x4e17('0x6')](_0x4e17('0x8'),auth[_0x4e17('0x9')](),controller[_0x4e17('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e17('0xb')]);router[_0x4e17('0xc')](_0x4e17('0x8'),auth[_0x4e17('0x9')](),controller['update']);router[_0x4e17('0xd')](_0x4e17('0x8'),auth[_0x4e17('0x9')](),controller['destroy']);module[_0x4e17('0xe')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index aa366d1..e48fe2f 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 _0xf49b=['exports','INTEGER'];(function(_0x1bc7ac,_0x1eed0e){var _0x5a35d7=function(_0x1496c6){while(--_0x1496c6){_0x1bc7ac['push'](_0x1bc7ac['shift']());}};_0x5a35d7(++_0x1eed0e);}(_0xf49b,0xe4));var _0xbf49=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf49b[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xbf49('0x0')]={'MailInteractionId':{'type':Sequelize[_0xbf49('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xbf49('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xa7f0=['INTEGER','sequelize','exports'];(function(_0x30f0f0,_0x3346a0){var _0x34fc82=function(_0x12b75d){while(--_0x12b75d){_0x30f0f0['push'](_0x30f0f0['shift']());}};_0x34fc82(++_0x3346a0);}(_0xa7f0,0xdc));var _0x0a7f=function(_0x2652b2,_0x5ea05b){_0x2652b2=_0x2652b2-0x0;var _0x5781a1=_0xa7f0[_0x2652b2];return _0x5781a1;};'use strict';var Sequelize=require(_0x0a7f('0x0'));module[_0x0a7f('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0a7f('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 363a64d..4151c11 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 _0x4892=['create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','json','apply','reject','save','update','then','get','UserMailInteractions','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','UserMailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0xc60b8d,_0x2d220a){var _0x42349a=function(_0x3bd09e){while(--_0x3bd09e){_0xc60b8d['push'](_0xc60b8d['shift']());}};_0x42349a(++_0x2d220a);}(_0x4892,0x1b0));var _0x2489=function(_0x29d753,_0x118d2d){_0x29d753=_0x29d753-0x0;var _0x55682a=_0x4892[_0x29d753];return _0x55682a;};'use strict';var pdf=require(_0x2489('0x0'));var emlformat=require(_0x2489('0x1'));var rimraf=require(_0x2489('0x2'));var zipdir=require(_0x2489('0x3'));var jsonpatch=require(_0x2489('0x4'));var rp=require('request-promise');var moment=require(_0x2489('0x5'));var BPromise=require(_0x2489('0x6'));var Mustache=require('mustache');var util=require(_0x2489('0x7'));var path=require(_0x2489('0x8'));var sox=require(_0x2489('0x9'));var csv=require(_0x2489('0xa'));var ejs=require(_0x2489('0xb'));var fs=require('fs');var _=require(_0x2489('0xc'));var squel=require(_0x2489('0xd'));var crypto=require(_0x2489('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2489('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2489('0x10'));var Redis=require(_0x2489('0x11'));var authService=require(_0x2489('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2489('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2489('0x14'))(_0x2489('0x15'));var utils=require(_0x2489('0x16'));var config=require(_0x2489('0x17'));var licenseUtil=require(_0x2489('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1257f5,_0x3a5cfb){_0x3a5cfb=_0x3a5cfb||0xcc;return function(_0x1824c3){if(_0x1824c3){return _0x1257f5['sendStatus'](_0x3a5cfb);}return _0x1257f5[_0x2489('0x19')](_0x3a5cfb)[_0x2489('0x1a')]();};}function respondWithResult(_0x1c74a0,_0x2e0bcd){_0x2e0bcd=_0x2e0bcd||0xc8;return function(_0x4bbc4d){if(_0x4bbc4d){return _0x1c74a0[_0x2489('0x19')](_0x2e0bcd)['json'](_0x4bbc4d);}};}function respondWithFilteredResult(_0x1c0a5d,_0x5df47b){return function(_0x1374e8){if(_0x1374e8){var _0x3f6274=_0x1374e8[_0x2489('0x1b')],_0x36197b=_0x5df47b['offset'],_0xc1b535=_0x5df47b[_0x2489('0x1c')]+_0x5df47b[_0x2489('0x1d')],_0x46413e;if(_0xc1b535>=_0x3f6274){_0xc1b535=_0x3f6274;_0x46413e=0xc8;}else{_0x46413e=0xce;}_0x1c0a5d[_0x2489('0x19')](_0x46413e);return _0x1c0a5d[_0x2489('0x1e')]('Content-Range',_0x36197b+'-'+_0xc1b535+'/'+_0x3f6274)[_0x2489('0x1f')](_0x1374e8);}return null;};}function patchUpdates(_0x79d5b8){return function(_0xdc51d4){try{jsonpatch[_0x2489('0x20')](_0xdc51d4,_0x79d5b8,!![]);}catch(_0x4d7462){return BPromise[_0x2489('0x21')](_0x4d7462);}return _0xdc51d4[_0x2489('0x22')]();};}function saveUpdates(_0x30e0d3,_0x53a28d){return function(_0x146326){if(_0x146326){return _0x146326[_0x2489('0x23')](_0x30e0d3)['then'](function(_0x540158){return _0x540158;});}return null;};}function removeEntity(_0x41be80,_0x50d7b0){return function(_0x540860){if(_0x540860){return _0x540860['destroy']()[_0x2489('0x24')](function(){var _0x32170f=_0x540860[_0x2489('0x25')]({'plain':!![]});var _0x27d3e5=_0x2489('0x26');return db[_0x2489('0x27')][_0x2489('0x28')]({'where':{'type':_0x27d3e5,'resourceId':_0x32170f['id']}})['then'](function(){return _0x540860;});})['then'](function(){_0x41be80[_0x2489('0x19')](0xcc)[_0x2489('0x1a')]();});}};}function handleEntityNotFound(_0x57f86,_0x1449b8){return function(_0x1d31f1){if(!_0x1d31f1){_0x57f86[_0x2489('0x29')](0x194);}return _0x1d31f1;};}function handleError(_0x588c21,_0x510e4e){_0x510e4e=_0x510e4e||0x1f4;return function(_0xc3711a){logger[_0x2489('0x2a')](_0xc3711a[_0x2489('0x2b')]);if(_0xc3711a[_0x2489('0x2c')]){delete _0xc3711a[_0x2489('0x2c')];}_0x588c21[_0x2489('0x19')](_0x510e4e)['send'](_0xc3711a);};}exports[_0x2489('0x2d')]=function(_0x39a36c,_0x1fb9b9){var _0x18748b={},_0x503c39={},_0x526278={'count':0x0,'rows':[]};var _0x498b84=_[_0x2489('0x2e')](db[_0x2489('0x2f')][_0x2489('0x30')],function(_0x37b513){return{'name':_0x37b513[_0x2489('0x31')],'type':_0x37b513[_0x2489('0x32')][_0x2489('0x33')]};});_0x503c39[_0x2489('0x34')]=_[_0x2489('0x2e')](_0x498b84,_0x2489('0x2c'));_0x503c39[_0x2489('0x35')]=_[_0x2489('0x36')](_0x39a36c[_0x2489('0x35')]);_0x503c39[_0x2489('0x37')]=_[_0x2489('0x38')](_0x503c39[_0x2489('0x34')],_0x503c39[_0x2489('0x35')]);_0x18748b[_0x2489('0x39')]=_[_0x2489('0x38')](_0x503c39[_0x2489('0x34')],qs[_0x2489('0x3a')](_0x39a36c['query'][_0x2489('0x3a')]));_0x18748b[_0x2489('0x39')]=_0x18748b[_0x2489('0x39')][_0x2489('0x3b')]?_0x18748b[_0x2489('0x39')]:_0x503c39[_0x2489('0x34')];if(!_0x39a36c['query'][_0x2489('0x3c')](_0x2489('0x3d'))){_0x18748b['limit']=qs[_0x2489('0x1d')](_0x39a36c[_0x2489('0x35')][_0x2489('0x1d')]);_0x18748b[_0x2489('0x1c')]=qs[_0x2489('0x1c')](_0x39a36c[_0x2489('0x35')][_0x2489('0x1c')]);}_0x18748b[_0x2489('0x3e')]=qs[_0x2489('0x3f')](_0x39a36c[_0x2489('0x35')]['sort']);_0x18748b[_0x2489('0x40')]=qs['filters'](_[_0x2489('0x41')](_0x39a36c[_0x2489('0x35')],_0x503c39[_0x2489('0x37')]),_0x498b84);if(_0x39a36c[_0x2489('0x35')][_0x2489('0x42')]){_0x18748b[_0x2489('0x40')]=_[_0x2489('0x43')](_0x18748b[_0x2489('0x40')],{'$or':_['map'](_0x498b84,function(_0x41d302){if(_0x41d302[_0x2489('0x32')]!==_0x2489('0x44')){var _0x4e0b80={};_0x4e0b80[_0x41d302[_0x2489('0x2c')]]={'$like':'%'+_0x39a36c[_0x2489('0x35')][_0x2489('0x42')]+'%'};return _0x4e0b80;}})});}_0x18748b=_[_0x2489('0x43')]({},_0x18748b,_0x39a36c[_0x2489('0x45')]);var _0x10a017={'where':_0x18748b[_0x2489('0x40')]};return db['UserMailInteraction'][_0x2489('0x1b')](_0x10a017)[_0x2489('0x24')](function(_0x34efd8){_0x526278[_0x2489('0x1b')]=_0x34efd8;if(_0x39a36c['query'][_0x2489('0x46')]){_0x18748b[_0x2489('0x47')]=[{'all':!![]}];}return db['UserMailInteraction'][_0x2489('0x48')](_0x18748b);})[_0x2489('0x24')](function(_0x295a29){_0x526278[_0x2489('0x49')]=_0x295a29;return _0x526278;})[_0x2489('0x24')](respondWithFilteredResult(_0x1fb9b9,_0x18748b))[_0x2489('0x4a')](handleError(_0x1fb9b9,null));};exports[_0x2489('0x4b')]=function(_0x445cd2,_0x1b67cd){var _0x1a7775={'raw':!![],'where':{'id':_0x445cd2[_0x2489('0x4c')]['id']}},_0x407e99={};_0x407e99[_0x2489('0x34')]=_[_0x2489('0x36')](db['UserMailInteraction'][_0x2489('0x30')]);_0x407e99[_0x2489('0x35')]=_[_0x2489('0x36')](_0x445cd2['query']);_0x407e99[_0x2489('0x37')]=_[_0x2489('0x38')](_0x407e99['model'],_0x407e99[_0x2489('0x35')]);_0x1a7775[_0x2489('0x39')]=_['intersection'](_0x407e99[_0x2489('0x34')],qs[_0x2489('0x3a')](_0x445cd2[_0x2489('0x35')][_0x2489('0x3a')]));_0x1a7775[_0x2489('0x39')]=_0x1a7775[_0x2489('0x39')][_0x2489('0x3b')]?_0x1a7775[_0x2489('0x39')]:_0x407e99[_0x2489('0x34')];if(_0x445cd2[_0x2489('0x35')][_0x2489('0x46')]){_0x1a7775['include']=[{'all':!![]}];}_0x1a7775=_['merge']({},_0x1a7775,_0x445cd2[_0x2489('0x45')]);return db[_0x2489('0x2f')][_0x2489('0x4d')](_0x1a7775)['then'](handleEntityNotFound(_0x1b67cd,null))[_0x2489('0x24')](respondWithResult(_0x1b67cd,null))[_0x2489('0x4a')](handleError(_0x1b67cd,null));};exports[_0x2489('0x4e')]=function(_0x148d91,_0x3a3e61){return db[_0x2489('0x2f')][_0x2489('0x4e')](_0x148d91['body'],{})[_0x2489('0x24')](function(_0x5677c0){var _0x5aa68c=_0x148d91[_0x2489('0x4f')][_0x2489('0x25')]({'plain':!![]});if(!_0x5aa68c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5aa68c[_0x2489('0x50')]===_0x2489('0x4f')){var _0x58a32a=_0x5677c0['get']({'plain':!![]});var _0x4667f1='UserMailInteractions';return db[_0x2489('0x51')][_0x2489('0x4d')]({'where':{'name':_0x4667f1,'userProfileId':_0x5aa68c['userProfileId']},'raw':!![]})['then'](function(_0xa2e892){if(_0xa2e892&&_0xa2e892[_0x2489('0x52')]===0x0){return db['UserProfileResource'][_0x2489('0x4e')]({'name':_0x58a32a[_0x2489('0x2c')],'resourceId':_0x58a32a['id'],'type':_0xa2e892[_0x2489('0x2c')],'sectionId':_0xa2e892['id']},{})[_0x2489('0x24')](function(){return _0x5677c0;});}else{return _0x5677c0;}})[_0x2489('0x4a')](function(_0x5a2c0a){logger[_0x2489('0x2a')](_0x2489('0x53'),_0x5a2c0a);throw _0x5a2c0a;});}return _0x5677c0;})['then'](respondWithResult(_0x3a3e61,0xc9))[_0x2489('0x4a')](handleError(_0x3a3e61,null));};exports[_0x2489('0x23')]=function(_0x24b1c6,_0x2d6aaf){if(_0x24b1c6[_0x2489('0x54')]['id']){delete _0x24b1c6[_0x2489('0x54')]['id'];}return db[_0x2489('0x2f')][_0x2489('0x4d')]({'where':{'id':_0x24b1c6[_0x2489('0x4c')]['id']}})[_0x2489('0x24')](handleEntityNotFound(_0x2d6aaf,null))['then'](saveUpdates(_0x24b1c6[_0x2489('0x54')],null))[_0x2489('0x24')](respondWithResult(_0x2d6aaf,null))[_0x2489('0x4a')](handleError(_0x2d6aaf,null));};exports[_0x2489('0x28')]=function(_0x3a3cd2,_0x379e1c){return db[_0x2489('0x2f')]['find']({'where':{'id':_0x3a3cd2[_0x2489('0x4c')]['id']}})[_0x2489('0x24')](handleEntityNotFound(_0x379e1c,null))['then'](removeEntity(_0x379e1c,null))['catch'](handleError(_0x379e1c,null));}; \ No newline at end of file +var _0xafbc=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','UserMailInteractions','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','UserMailInteraction','includeAll','include','findAll','show','params','keys','find','create','body','user'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0xafbc,0x1f4));var _0xcafb=function(_0x4b7634,_0x2579e4){_0x4b7634=_0x4b7634-0x0;var _0x836c83=_0xafbc[_0x4b7634];return _0x836c83;};'use strict';var pdf=require(_0xcafb('0x0'));var emlformat=require(_0xcafb('0x1'));var rimraf=require(_0xcafb('0x2'));var zipdir=require(_0xcafb('0x3'));var jsonpatch=require(_0xcafb('0x4'));var rp=require(_0xcafb('0x5'));var moment=require('moment');var BPromise=require(_0xcafb('0x6'));var Mustache=require(_0xcafb('0x7'));var util=require(_0xcafb('0x8'));var path=require(_0xcafb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcafb('0xa'));var squel=require(_0xcafb('0xb'));var crypto=require(_0xcafb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcafb('0xd'));var toCsv=require(_0xcafb('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcafb('0xf'));var qs=require(_0xcafb('0x10'));var as=require(_0xcafb('0x11'));var hardwareService=require(_0xcafb('0x12'));var logger=require(_0xcafb('0x13'))(_0xcafb('0x14'));var utils=require('../../config/utils');var config=require(_0xcafb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcafb('0x16'))['db'];function respondWithStatusCode(_0x3bf8f9,_0x45a073){_0x45a073=_0x45a073||0xcc;return function(_0x5ef89a){if(_0x5ef89a){return _0x3bf8f9[_0xcafb('0x17')](_0x45a073);}return _0x3bf8f9[_0xcafb('0x18')](_0x45a073)['end']();};}function respondWithResult(_0xde04f1,_0x5bde01){_0x5bde01=_0x5bde01||0xc8;return function(_0x36f331){if(_0x36f331){return _0xde04f1[_0xcafb('0x18')](_0x5bde01)[_0xcafb('0x19')](_0x36f331);}};}function respondWithFilteredResult(_0x3cc57e,_0xd87dd4){return function(_0x4f02f1){if(_0x4f02f1){var _0x57b760=_0x4f02f1[_0xcafb('0x1a')],_0x3d482e=_0xd87dd4[_0xcafb('0x1b')],_0xff0225=_0xd87dd4[_0xcafb('0x1b')]+_0xd87dd4[_0xcafb('0x1c')],_0xe74346;if(_0xff0225>=_0x57b760){_0xff0225=_0x57b760;_0xe74346=0xc8;}else{_0xe74346=0xce;}_0x3cc57e[_0xcafb('0x18')](_0xe74346);return _0x3cc57e[_0xcafb('0x1d')](_0xcafb('0x1e'),_0x3d482e+'-'+_0xff0225+'/'+_0x57b760)[_0xcafb('0x19')](_0x4f02f1);}return null;};}function patchUpdates(_0x1b4b4f){return function(_0x242a1e){try{jsonpatch['apply'](_0x242a1e,_0x1b4b4f,!![]);}catch(_0x5352d7){return BPromise[_0xcafb('0x1f')](_0x5352d7);}return _0x242a1e['save']();};}function saveUpdates(_0x154485,_0xf48faa){return function(_0x2155b5){if(_0x2155b5){return _0x2155b5[_0xcafb('0x20')](_0x154485)[_0xcafb('0x21')](function(_0x5cfb79){return _0x5cfb79;});}return null;};}function removeEntity(_0x38c224,_0x25a502){return function(_0xe00f3d){if(_0xe00f3d){return _0xe00f3d[_0xcafb('0x22')]()[_0xcafb('0x21')](function(){var _0x385d19=_0xe00f3d['get']({'plain':!![]});var _0x5efae0=_0xcafb('0x23');return db[_0xcafb('0x24')]['destroy']({'where':{'type':_0x5efae0,'resourceId':_0x385d19['id']}})[_0xcafb('0x21')](function(){return _0xe00f3d;});})[_0xcafb('0x21')](function(){_0x38c224[_0xcafb('0x18')](0xcc)[_0xcafb('0x25')]();});}};}function handleEntityNotFound(_0xb6d42f,_0x5e892e){return function(_0xcf56cc){if(!_0xcf56cc){_0xb6d42f['sendStatus'](0x194);}return _0xcf56cc;};}function handleError(_0x174cc2,_0x2c1476){_0x2c1476=_0x2c1476||0x1f4;return function(_0xb23d19){logger[_0xcafb('0x26')](_0xb23d19[_0xcafb('0x27')]);if(_0xb23d19[_0xcafb('0x28')]){delete _0xb23d19[_0xcafb('0x28')];}_0x174cc2['status'](_0x2c1476)[_0xcafb('0x29')](_0xb23d19);};}exports[_0xcafb('0x2a')]=function(_0x3082f8,_0x3cd49b){var _0x21c14c={},_0x15d4f5={},_0xc520f1={'count':0x0,'rows':[]};var _0x37c28f=_[_0xcafb('0x2b')](db['UserMailInteraction'][_0xcafb('0x2c')],function(_0x29e52e){return{'name':_0x29e52e[_0xcafb('0x2d')],'type':_0x29e52e[_0xcafb('0x2e')][_0xcafb('0x2f')]};});_0x15d4f5[_0xcafb('0x30')]=_['map'](_0x37c28f,_0xcafb('0x28'));_0x15d4f5['query']=_['keys'](_0x3082f8[_0xcafb('0x31')]);_0x15d4f5[_0xcafb('0x32')]=_['intersection'](_0x15d4f5[_0xcafb('0x30')],_0x15d4f5[_0xcafb('0x31')]);_0x21c14c[_0xcafb('0x33')]=_[_0xcafb('0x34')](_0x15d4f5[_0xcafb('0x30')],qs['fields'](_0x3082f8[_0xcafb('0x31')][_0xcafb('0x35')]));_0x21c14c[_0xcafb('0x33')]=_0x21c14c[_0xcafb('0x33')][_0xcafb('0x36')]?_0x21c14c[_0xcafb('0x33')]:_0x15d4f5['model'];if(!_0x3082f8[_0xcafb('0x31')][_0xcafb('0x37')](_0xcafb('0x38'))){_0x21c14c[_0xcafb('0x1c')]=qs['limit'](_0x3082f8[_0xcafb('0x31')][_0xcafb('0x1c')]);_0x21c14c[_0xcafb('0x1b')]=qs[_0xcafb('0x1b')](_0x3082f8[_0xcafb('0x31')]['offset']);}_0x21c14c['order']=qs[_0xcafb('0x39')](_0x3082f8[_0xcafb('0x31')][_0xcafb('0x39')]);_0x21c14c[_0xcafb('0x3a')]=qs[_0xcafb('0x32')](_[_0xcafb('0x3b')](_0x3082f8[_0xcafb('0x31')],_0x15d4f5[_0xcafb('0x32')]),_0x37c28f);if(_0x3082f8[_0xcafb('0x31')][_0xcafb('0x3c')]){_0x21c14c['where']=_[_0xcafb('0x3d')](_0x21c14c[_0xcafb('0x3a')],{'$or':_[_0xcafb('0x2b')](_0x37c28f,function(_0x12ebe8){if(_0x12ebe8[_0xcafb('0x2e')]!==_0xcafb('0x3e')){var _0x1d0bf={};_0x1d0bf[_0x12ebe8['name']]={'$like':'%'+_0x3082f8[_0xcafb('0x31')][_0xcafb('0x3c')]+'%'};return _0x1d0bf;}})});}_0x21c14c=_['merge']({},_0x21c14c,_0x3082f8['options']);var _0xae7a6e={'where':_0x21c14c[_0xcafb('0x3a')]};return db[_0xcafb('0x3f')][_0xcafb('0x1a')](_0xae7a6e)[_0xcafb('0x21')](function(_0x4b3ce3){_0xc520f1[_0xcafb('0x1a')]=_0x4b3ce3;if(_0x3082f8['query'][_0xcafb('0x40')]){_0x21c14c[_0xcafb('0x41')]=[{'all':!![]}];}return db[_0xcafb('0x3f')][_0xcafb('0x42')](_0x21c14c);})[_0xcafb('0x21')](function(_0xa7fd50){_0xc520f1['rows']=_0xa7fd50;return _0xc520f1;})[_0xcafb('0x21')](respondWithFilteredResult(_0x3cd49b,_0x21c14c))['catch'](handleError(_0x3cd49b,null));};exports[_0xcafb('0x43')]=function(_0x482c77,_0x366645){var _0x45e332={'raw':!![],'where':{'id':_0x482c77[_0xcafb('0x44')]['id']}},_0x3d1c60={};_0x3d1c60[_0xcafb('0x30')]=_[_0xcafb('0x45')](db[_0xcafb('0x3f')]['rawAttributes']);_0x3d1c60[_0xcafb('0x31')]=_['keys'](_0x482c77[_0xcafb('0x31')]);_0x3d1c60[_0xcafb('0x32')]=_[_0xcafb('0x34')](_0x3d1c60[_0xcafb('0x30')],_0x3d1c60[_0xcafb('0x31')]);_0x45e332[_0xcafb('0x33')]=_['intersection'](_0x3d1c60[_0xcafb('0x30')],qs[_0xcafb('0x35')](_0x482c77[_0xcafb('0x31')]['fields']));_0x45e332[_0xcafb('0x33')]=_0x45e332[_0xcafb('0x33')]['length']?_0x45e332[_0xcafb('0x33')]:_0x3d1c60[_0xcafb('0x30')];if(_0x482c77['query'][_0xcafb('0x40')]){_0x45e332[_0xcafb('0x41')]=[{'all':!![]}];}_0x45e332=_[_0xcafb('0x3d')]({},_0x45e332,_0x482c77['options']);return db[_0xcafb('0x3f')][_0xcafb('0x46')](_0x45e332)[_0xcafb('0x21')](handleEntityNotFound(_0x366645,null))[_0xcafb('0x21')](respondWithResult(_0x366645,null))['catch'](handleError(_0x366645,null));};exports['create']=function(_0x3d6385,_0x3f1919){return db[_0xcafb('0x3f')][_0xcafb('0x47')](_0x3d6385[_0xcafb('0x48')],{})['then'](function(_0x32520d){var _0x54e033=_0x3d6385[_0xcafb('0x49')][_0xcafb('0x4a')]({'plain':!![]});if(!_0x54e033)throw new Error(_0xcafb('0x4b'));if(_0x54e033[_0xcafb('0x4c')]===_0xcafb('0x49')){var _0x88d110=_0x32520d[_0xcafb('0x4a')]({'plain':!![]});var _0xf05e86=_0xcafb('0x23');return db[_0xcafb('0x4d')]['find']({'where':{'name':_0xf05e86,'userProfileId':_0x54e033[_0xcafb('0x4e')]},'raw':!![]})[_0xcafb('0x21')](function(_0x320257){if(_0x320257&&_0x320257[_0xcafb('0x4f')]===0x0){return db['UserProfileResource'][_0xcafb('0x47')]({'name':_0x88d110[_0xcafb('0x28')],'resourceId':_0x88d110['id'],'type':_0x320257['name'],'sectionId':_0x320257['id']},{})[_0xcafb('0x21')](function(){return _0x32520d;});}else{return _0x32520d;}})['catch'](function(_0x852868){logger['error'](_0xcafb('0x50'),_0x852868);throw _0x852868;});}return _0x32520d;})[_0xcafb('0x21')](respondWithResult(_0x3f1919,0xc9))[_0xcafb('0x51')](handleError(_0x3f1919,null));};exports[_0xcafb('0x20')]=function(_0x3d12fd,_0x50c250){if(_0x3d12fd[_0xcafb('0x48')]['id']){delete _0x3d12fd['body']['id'];}return db[_0xcafb('0x3f')][_0xcafb('0x46')]({'where':{'id':_0x3d12fd['params']['id']}})[_0xcafb('0x21')](handleEntityNotFound(_0x50c250,null))[_0xcafb('0x21')](saveUpdates(_0x3d12fd[_0xcafb('0x48')],null))[_0xcafb('0x21')](respondWithResult(_0x50c250,null))[_0xcafb('0x51')](handleError(_0x50c250,null));};exports[_0xcafb('0x22')]=function(_0xbb5e0a,_0x2bc655){return db[_0xcafb('0x3f')][_0xcafb('0x46')]({'where':{'id':_0xbb5e0a['params']['id']}})['then'](handleEntityNotFound(_0x2bc655,null))['then'](removeEntity(_0x2bc655,null))[_0xcafb('0x51')](handleError(_0x2bc655,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 6988501..a1c520a 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 _0x3eaf=['../../config/environment','exports','define','UserMailInteraction','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4dcefd,_0x189f76){var _0xad1798=function(_0x27c602){while(--_0x27c602){_0x4dcefd['push'](_0x4dcefd['shift']());}};_0xad1798(++_0x189f76);}(_0x3eaf,0x190));var _0xf3ea=function(_0x17b74f,_0x1574ee){_0x17b74f=_0x17b74f-0x0;var _0x1e256b=_0x3eaf[_0x17b74f];return _0x1e256b;};'use strict';var _=require(_0xf3ea('0x0'));var util=require(_0xf3ea('0x1'));var logger=require(_0xf3ea('0x2'))(_0xf3ea('0x3'));var moment=require(_0xf3ea('0x4'));var BPromise=require(_0xf3ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3ea('0x6'));var rimraf=require(_0xf3ea('0x7'));var config=require(_0xf3ea('0x8'));var attributes=require('./UserMailInteraction.attributes');module[_0xf3ea('0x9')]=function(_0x526261,_0x3b5ca9){return _0x526261[_0xf3ea('0xa')](_0xf3ea('0xb'),attributes,{'tableName':'user_has_mail_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddb4=['request-promise','../../config/environment','./UserMailInteraction.attributes','define','UserMailInteraction','user_has_mail_interactions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2ec904,_0x172237){var _0xbbc179=function(_0x3e3cee){while(--_0x3e3cee){_0x2ec904['push'](_0x2ec904['shift']());}};_0xbbc179(++_0x172237);}(_0xddb4,0x162));var _0x4ddb=function(_0x4257b6,_0x2348c7){_0x4257b6=_0x4257b6-0x0;var _0x4ad68c=_0xddb4[_0x4257b6];return _0x4ad68c;};'use strict';var _=require(_0x4ddb('0x0'));var util=require(_0x4ddb('0x1'));var logger=require(_0x4ddb('0x2'))(_0x4ddb('0x3'));var moment=require(_0x4ddb('0x4'));var BPromise=require(_0x4ddb('0x5'));var rp=require(_0x4ddb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ddb('0x7'));var attributes=require(_0x4ddb('0x8'));module['exports']=function(_0x53a1db,_0x4b47f1){return _0x53a1db[_0x4ddb('0x9')](_0x4ddb('0xa'),attributes,{'tableName':_0x4ddb('0xb'),'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 db096b2..0663fdd 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 _0xf971=['info','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x53767b,_0x3aa30b){var _0x29f67b=function(_0xd1d3e8){while(--_0xd1d3e8){_0x53767b['push'](_0x53767b['shift']());}};_0x29f67b(++_0x3aa30b);}(_0xf971,0x17e));var _0x1f97=function(_0x5f2901,_0x1efed1){_0x5f2901=_0x5f2901-0x0;var _0x4e4cf4=_0xf971[_0x5f2901];return _0x4e4cf4;};'use strict';var _=require(_0x1f97('0x0'));var util=require('util');var moment=require(_0x1f97('0x1'));var BPromise=require(_0x1f97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f97('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f97('0x4'));var logger=require(_0x1f97('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1f97('0x6'));var client=jayson[_0x1f97('0x7')][_0x1f97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615a6,_0x834b08,_0x354f64){return new BPromise(function(_0x489805,_0x413e10){return client['request'](_0x1615a6,_0x354f64)[_0x1f97('0x9')](function(_0x3162fb){logger['info'](_0x1f97('0xa'),_0x834b08,_0x1f97('0xb'));logger[_0x1f97('0xc')](_0x1f97('0xd'),_0x834b08,_0x1f97('0xb'),JSON[_0x1f97('0xe')](_0x3162fb));if(_0x3162fb['error']){if(_0x3162fb[_0x1f97('0xf')]['code']===0x1f4){logger[_0x1f97('0xf')](_0x1f97('0xa'),_0x834b08,_0x3162fb[_0x1f97('0xf')][_0x1f97('0x10')]);return _0x413e10(_0x3162fb[_0x1f97('0xf')][_0x1f97('0x10')]);}logger[_0x1f97('0xf')](_0x1f97('0xa'),_0x834b08,_0x3162fb[_0x1f97('0xf')]['message']);return _0x489805(_0x3162fb['error'][_0x1f97('0x10')]);}else{logger[_0x1f97('0x11')](_0x1f97('0xa'),_0x834b08,_0x1f97('0xb'));_0x489805(_0x3162fb[_0x1f97('0x12')][_0x1f97('0x10')]);}})['catch'](function(_0x34f6a7){logger[_0x1f97('0xf')]('UserMailInteraction,\x20%s,\x20%s',_0x834b08,_0x34f6a7);_0x413e10(_0x34f6a7);});});} \ No newline at end of file +var _0x6859=['../../config/environment','jayson/promise','client','http','request','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0x6859,0x1b3));var _0x9685=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x6859[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require(_0x9685('0x0'));var moment=require(_0x9685('0x1'));var BPromise=require(_0x9685('0x2'));var rs=require(_0x9685('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9685('0x4'));var logger=require('../../config/logger')(_0x9685('0x5'));var config=require(_0x9685('0x6'));var jayson=require(_0x9685('0x7'));var client=jayson[_0x9685('0x8')][_0x9685('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b1d6e,_0x56f264,_0x35f3a2){return new BPromise(function(_0x518622,_0x54ed50){return client[_0x9685('0xa')](_0x2b1d6e,_0x35f3a2)['then'](function(_0xbe52dd){logger[_0x9685('0xb')](_0x9685('0xc'),_0x56f264,_0x9685('0xd'));logger[_0x9685('0xe')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x56f264,'request\x20sent',JSON[_0x9685('0xf')](_0xbe52dd));if(_0xbe52dd[_0x9685('0x10')]){if(_0xbe52dd[_0x9685('0x10')][_0x9685('0x11')]===0x1f4){logger['error'](_0x9685('0xc'),_0x56f264,_0xbe52dd[_0x9685('0x10')][_0x9685('0x12')]);return _0x54ed50(_0xbe52dd['error'][_0x9685('0x12')]);}logger[_0x9685('0x10')](_0x9685('0xc'),_0x56f264,_0xbe52dd['error'][_0x9685('0x12')]);return _0x518622(_0xbe52dd[_0x9685('0x10')][_0x9685('0x12')]);}else{logger['info']('UserMailInteraction,\x20%s,\x20%s',_0x56f264,'request\x20sent');_0x518622(_0xbe52dd[_0x9685('0x13')][_0x9685('0x12')]);}})[_0x9685('0x14')](function(_0x5319f9){logger[_0x9685('0x10')]('UserMailInteraction,\x20%s,\x20%s',_0x56f264,_0x5319f9);_0x54ed50(_0x5319f9);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index c01eeb4..ad0b6d7 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 _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(_0x29e4ac,_0x581359){var _0x430493=function(_0x3f2f9c){while(--_0x3f2f9c){_0x29e4ac['push'](_0x29e4ac['shift']());}};_0x430493(++_0x581359);}(_0x5fab,0x177));var _0xb5fa=function(_0x56e423,_0x98016e){_0x56e423=_0x56e423-0x0;var _0x331ddb=_0x5fab[_0x56e423];return _0x331ddb;};'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 +var _0x6f47=['put','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','/:id','post','create'];(function(_0x555569,_0x15669b){var _0x2541ff=function(_0x5aef2b){while(--_0x5aef2b){_0x555569['push'](_0x555569['shift']());}};_0x2541ff(++_0x15669b);}(_0x6f47,0xc7));var _0x76f4=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x6f47[_0x38ced4];return _0x547c07;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['show']);router[_0x76f4('0x9')]('/',auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0xb')](_0x76f4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x76f4('0xc')](_0x76f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x76f4('0xd')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 29b4e2b..bc6fab9 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 _0x20ea=['sequelize','exports','INTEGER'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x20ea,0x1c5));var _0xa20e=function(_0x2dc5fb,_0x286604){_0x2dc5fb=_0x2dc5fb-0x0;var _0x2cb12a=_0x20ea[_0x2dc5fb];return _0x2cb12a;};'use strict';var Sequelize=require(_0xa20e('0x0'));module[_0xa20e('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0xa20e('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xa20e('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xb25b=['exports','INTEGER'];(function(_0x5f52a4,_0x5706d9){var _0xde1bce=function(_0x16ef65){while(--_0x16ef65){_0x5f52a4['push'](_0x5f52a4['shift']());}};_0xde1bce(++_0x5706d9);}(_0xb25b,0x80));var _0xbb25=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb25b[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xbb25('0x0')]={'OpenchannelInteractionId':{'type':Sequelize[_0xbb25('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xbb25('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index 6de21d1..4fd23a4 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 _0x152b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserOpenchannelInteraction','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x152b,0x1e7));var _0xb152=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x152b[_0x373096];return _0x14a6d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb152('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb152('0x1'));var moment=require(_0xb152('0x2'));var BPromise=require(_0xb152('0x3'));var Mustache=require(_0xb152('0x4'));var util=require(_0xb152('0x5'));var path=require(_0xb152('0x6'));var sox=require('sox');var csv=require(_0xb152('0x7'));var ejs=require(_0xb152('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb152('0x9'));var crypto=require(_0xb152('0xa'));var jsforce=require(_0xb152('0xb'));var deskjs=require(_0xb152('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb152('0xd'));var Redis=require(_0xb152('0xe'));var authService=require(_0xb152('0xf'));var qs=require(_0xb152('0x10'));var as=require(_0xb152('0x11'));var hardwareService=require(_0xb152('0x12'));var logger=require('../../config/logger')(_0xb152('0x13'));var utils=require(_0xb152('0x14'));var config=require(_0xb152('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb152('0x16'))['db'];function respondWithStatusCode(_0x6ffa58,_0x2c85ff){_0x2c85ff=_0x2c85ff||0xcc;return function(_0x53bc0d){if(_0x53bc0d){return _0x6ffa58[_0xb152('0x17')](_0x2c85ff);}return _0x6ffa58[_0xb152('0x18')](_0x2c85ff)[_0xb152('0x19')]();};}function respondWithResult(_0x3121ae,_0x1d80c9){_0x1d80c9=_0x1d80c9||0xc8;return function(_0x2035de){if(_0x2035de){return _0x3121ae['status'](_0x1d80c9)[_0xb152('0x1a')](_0x2035de);}};}function respondWithFilteredResult(_0x1d6a5b,_0x11a8a8){return function(_0x2d529f){if(_0x2d529f){var _0x3b15c8=_0x2d529f[_0xb152('0x1b')],_0x44855f=_0x11a8a8[_0xb152('0x1c')],_0x29e6f2=_0x11a8a8['offset']+_0x11a8a8['limit'],_0x2c9b99;if(_0x29e6f2>=_0x3b15c8){_0x29e6f2=_0x3b15c8;_0x2c9b99=0xc8;}else{_0x2c9b99=0xce;}_0x1d6a5b['status'](_0x2c9b99);return _0x1d6a5b[_0xb152('0x1d')](_0xb152('0x1e'),_0x44855f+'-'+_0x29e6f2+'/'+_0x3b15c8)[_0xb152('0x1a')](_0x2d529f);}return null;};}function patchUpdates(_0x115641){return function(_0x1217a2){try{jsonpatch[_0xb152('0x1f')](_0x1217a2,_0x115641,!![]);}catch(_0x537625){return BPromise[_0xb152('0x20')](_0x537625);}return _0x1217a2[_0xb152('0x21')]();};}function saveUpdates(_0x357f99,_0x4e448b){return function(_0x5b0f0b){if(_0x5b0f0b){return _0x5b0f0b[_0xb152('0x22')](_0x357f99)[_0xb152('0x23')](function(_0x35bc33){return _0x35bc33;});}return null;};}function removeEntity(_0x1c6868,_0x3605ec){return function(_0x27fcd0){if(_0x27fcd0){return _0x27fcd0[_0xb152('0x24')]()[_0xb152('0x23')](function(){var _0x1a9b46=_0x27fcd0['get']({'plain':!![]});var _0x75fd78=_0xb152('0x25');return db['UserProfileResource'][_0xb152('0x24')]({'where':{'type':_0x75fd78,'resourceId':_0x1a9b46['id']}})[_0xb152('0x23')](function(){return _0x27fcd0;});})['then'](function(){_0x1c6868[_0xb152('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ad5a3,_0x3b585c){return function(_0x502e7b){if(!_0x502e7b){_0x5ad5a3[_0xb152('0x17')](0x194);}return _0x502e7b;};}function handleError(_0x40081c,_0x15fe3f){_0x15fe3f=_0x15fe3f||0x1f4;return function(_0x30e4a9){logger[_0xb152('0x26')](_0x30e4a9[_0xb152('0x27')]);if(_0x30e4a9[_0xb152('0x28')]){delete _0x30e4a9[_0xb152('0x28')];}_0x40081c[_0xb152('0x18')](_0x15fe3f)[_0xb152('0x29')](_0x30e4a9);};}exports[_0xb152('0x2a')]=function(_0x5c8ca0,_0x5b59e9){var _0x2fbd24={},_0x5c1258={},_0x2f328e={'count':0x0,'rows':[]};var _0xdce042=_[_0xb152('0x2b')](db[_0xb152('0x25')]['rawAttributes'],function(_0x3128fa){return{'name':_0x3128fa[_0xb152('0x2c')],'type':_0x3128fa[_0xb152('0x2d')]['key']};});_0x5c1258[_0xb152('0x2e')]=_[_0xb152('0x2b')](_0xdce042,_0xb152('0x28'));_0x5c1258[_0xb152('0x2f')]=_['keys'](_0x5c8ca0[_0xb152('0x2f')]);_0x5c1258[_0xb152('0x30')]=_[_0xb152('0x31')](_0x5c1258['model'],_0x5c1258[_0xb152('0x2f')]);_0x2fbd24[_0xb152('0x32')]=_[_0xb152('0x31')](_0x5c1258[_0xb152('0x2e')],qs[_0xb152('0x33')](_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x33')]));_0x2fbd24[_0xb152('0x32')]=_0x2fbd24['attributes'][_0xb152('0x34')]?_0x2fbd24[_0xb152('0x32')]:_0x5c1258[_0xb152('0x2e')];if(!_0x5c8ca0['query']['hasOwnProperty'](_0xb152('0x35'))){_0x2fbd24[_0xb152('0x36')]=qs[_0xb152('0x36')](_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x36')]);_0x2fbd24[_0xb152('0x1c')]=qs[_0xb152('0x1c')](_0x5c8ca0['query'][_0xb152('0x1c')]);}_0x2fbd24[_0xb152('0x37')]=qs[_0xb152('0x38')](_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x38')]);_0x2fbd24[_0xb152('0x39')]=qs[_0xb152('0x30')](_[_0xb152('0x3a')](_0x5c8ca0[_0xb152('0x2f')],_0x5c1258[_0xb152('0x30')]),_0xdce042);if(_0x5c8ca0[_0xb152('0x2f')]['filter']){_0x2fbd24[_0xb152('0x39')]=_['merge'](_0x2fbd24[_0xb152('0x39')],{'$or':_['map'](_0xdce042,function(_0x7c40ee){if(_0x7c40ee['type']!==_0xb152('0x3b')){var _0x372203={};_0x372203[_0x7c40ee[_0xb152('0x28')]]={'$like':'%'+_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x3c')]+'%'};return _0x372203;}})});}_0x2fbd24=_['merge']({},_0x2fbd24,_0x5c8ca0[_0xb152('0x3d')]);var _0x4c5465={'where':_0x2fbd24['where']};return db[_0xb152('0x25')][_0xb152('0x1b')](_0x4c5465)['then'](function(_0x5a53de){_0x2f328e['count']=_0x5a53de;if(_0x5c8ca0['query'][_0xb152('0x3e')]){_0x2fbd24[_0xb152('0x3f')]=[{'all':!![]}];}return db[_0xb152('0x25')]['findAll'](_0x2fbd24);})[_0xb152('0x23')](function(_0x226f56){_0x2f328e[_0xb152('0x40')]=_0x226f56;return _0x2f328e;})[_0xb152('0x23')](respondWithFilteredResult(_0x5b59e9,_0x2fbd24))[_0xb152('0x41')](handleError(_0x5b59e9,null));};exports[_0xb152('0x42')]=function(_0x24357a,_0x3cceb9){var _0x2d7112={'raw':!![],'where':{'id':_0x24357a[_0xb152('0x43')]['id']}},_0x5d97b1={};_0x5d97b1[_0xb152('0x2e')]=_['keys'](db[_0xb152('0x25')][_0xb152('0x44')]);_0x5d97b1[_0xb152('0x2f')]=_[_0xb152('0x45')](_0x24357a['query']);_0x5d97b1[_0xb152('0x30')]=_['intersection'](_0x5d97b1[_0xb152('0x2e')],_0x5d97b1[_0xb152('0x2f')]);_0x2d7112[_0xb152('0x32')]=_[_0xb152('0x31')](_0x5d97b1['model'],qs[_0xb152('0x33')](_0x24357a[_0xb152('0x2f')][_0xb152('0x33')]));_0x2d7112[_0xb152('0x32')]=_0x2d7112[_0xb152('0x32')][_0xb152('0x34')]?_0x2d7112['attributes']:_0x5d97b1[_0xb152('0x2e')];if(_0x24357a['query']['includeAll']){_0x2d7112[_0xb152('0x3f')]=[{'all':!![]}];}_0x2d7112=_['merge']({},_0x2d7112,_0x24357a[_0xb152('0x3d')]);return db[_0xb152('0x25')]['find'](_0x2d7112)[_0xb152('0x23')](handleEntityNotFound(_0x3cceb9,null))[_0xb152('0x23')](respondWithResult(_0x3cceb9,null))[_0xb152('0x41')](handleError(_0x3cceb9,null));};exports[_0xb152('0x46')]=function(_0x58003b,_0x58c207){return db[_0xb152('0x25')][_0xb152('0x46')](_0x58003b[_0xb152('0x47')],{})['then'](function(_0x437b20){var _0x19e606=_0x58003b[_0xb152('0x48')][_0xb152('0x49')]({'plain':!![]});if(!_0x19e606)throw new Error(_0xb152('0x4a'));if(_0x19e606[_0xb152('0x4b')]===_0xb152('0x48')){var _0x16bcda=_0x437b20[_0xb152('0x49')]({'plain':!![]});var _0xbcf51a='UserOpenchannelInteraction';return db[_0xb152('0x4c')][_0xb152('0x4d')]({'where':{'name':_0xbcf51a,'userProfileId':_0x19e606[_0xb152('0x4e')]},'raw':!![]})[_0xb152('0x23')](function(_0x984731){if(_0x984731&&_0x984731[_0xb152('0x4f')]===0x0){return db['UserProfileResource'][_0xb152('0x46')]({'name':_0x16bcda[_0xb152('0x28')],'resourceId':_0x16bcda['id'],'type':_0x984731['name'],'sectionId':_0x984731['id']},{})[_0xb152('0x23')](function(){return _0x437b20;});}else{return _0x437b20;}})['catch'](function(_0x28a3fb){logger[_0xb152('0x26')](_0xb152('0x50'),_0x28a3fb);throw _0x28a3fb;});}return _0x437b20;})['then'](respondWithResult(_0x58c207,0xc9))[_0xb152('0x41')](handleError(_0x58c207,null));};exports[_0xb152('0x22')]=function(_0xd31282,_0x4a3339){if(_0xd31282['body']['id']){delete _0xd31282[_0xb152('0x47')]['id'];}return db[_0xb152('0x25')]['find']({'where':{'id':_0xd31282['params']['id']}})[_0xb152('0x23')](handleEntityNotFound(_0x4a3339,null))[_0xb152('0x23')](saveUpdates(_0xd31282[_0xb152('0x47')],null))['then'](respondWithResult(_0x4a3339,null))[_0xb152('0x41')](handleError(_0x4a3339,null));};exports[_0xb152('0x24')]=function(_0x3cdbf3,_0xcb7b79){return db[_0xb152('0x25')][_0xb152('0x4d')]({'where':{'id':_0x3cdbf3['params']['id']}})[_0xb152('0x23')](handleEntityNotFound(_0xcb7b79,null))[_0xb152('0x23')](removeEntity(_0xcb7b79,null))[_0xb152('0x41')](handleError(_0xcb7b79,null));}; \ No newline at end of file +var _0x46de=['includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','UserOpenchannelInteraction','UserProfileResource','destroy','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','VIRTUAL','merge','options'];(function(_0x477085,_0x12d305){var _0x389743=function(_0x4fc616){while(--_0x4fc616){_0x477085['push'](_0x477085['shift']());}};_0x389743(++_0x12d305);}(_0x46de,0x1c3));var _0xe46d=function(_0x235f7f,_0x4cc112){_0x235f7f=_0x235f7f-0x0;var _0x3bf31e=_0x46de[_0x235f7f];return _0x3bf31e;};'use strict';var pdf=require(_0xe46d('0x0'));var emlformat=require(_0xe46d('0x1'));var rimraf=require(_0xe46d('0x2'));var zipdir=require(_0xe46d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe46d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe46d('0x5'));var util=require(_0xe46d('0x6'));var path=require(_0xe46d('0x7'));var sox=require(_0xe46d('0x8'));var csv=require(_0xe46d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe46d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe46d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe46d('0xc'));var Redis=require(_0xe46d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe46d('0xe'));var as=require(_0xe46d('0xf'));var hardwareService=require(_0xe46d('0x10'));var logger=require('../../config/logger')(_0xe46d('0x11'));var utils=require(_0xe46d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe46d('0x13'));var db=require(_0xe46d('0x14'))['db'];function respondWithStatusCode(_0x53d62d,_0x10ddd1){_0x10ddd1=_0x10ddd1||0xcc;return function(_0x552b9b){if(_0x552b9b){return _0x53d62d[_0xe46d('0x15')](_0x10ddd1);}return _0x53d62d[_0xe46d('0x16')](_0x10ddd1)[_0xe46d('0x17')]();};}function respondWithResult(_0x395683,_0x825a45){_0x825a45=_0x825a45||0xc8;return function(_0x513e4f){if(_0x513e4f){return _0x395683[_0xe46d('0x16')](_0x825a45)[_0xe46d('0x18')](_0x513e4f);}};}function respondWithFilteredResult(_0xcd9e25,_0x513b3f){return function(_0x912830){if(_0x912830){var _0x4fa714=_0x912830[_0xe46d('0x19')],_0x151fd7=_0x513b3f[_0xe46d('0x1a')],_0x414a8e=_0x513b3f[_0xe46d('0x1a')]+_0x513b3f[_0xe46d('0x1b')],_0x23f7d1;if(_0x414a8e>=_0x4fa714){_0x414a8e=_0x4fa714;_0x23f7d1=0xc8;}else{_0x23f7d1=0xce;}_0xcd9e25[_0xe46d('0x16')](_0x23f7d1);return _0xcd9e25['set'](_0xe46d('0x1c'),_0x151fd7+'-'+_0x414a8e+'/'+_0x4fa714)[_0xe46d('0x18')](_0x912830);}return null;};}function patchUpdates(_0x4bdeb4){return function(_0x124297){try{jsonpatch[_0xe46d('0x1d')](_0x124297,_0x4bdeb4,!![]);}catch(_0x2ded64){return BPromise[_0xe46d('0x1e')](_0x2ded64);}return _0x124297[_0xe46d('0x1f')]();};}function saveUpdates(_0x6826fe,_0x10f4e1){return function(_0x4e71d5){if(_0x4e71d5){return _0x4e71d5[_0xe46d('0x20')](_0x6826fe)[_0xe46d('0x21')](function(_0x41d1e4){return _0x41d1e4;});}return null;};}function removeEntity(_0xab8797,_0x5d9336){return function(_0x511978){if(_0x511978){return _0x511978['destroy']()[_0xe46d('0x21')](function(){var _0x27f5a6=_0x511978[_0xe46d('0x22')]({'plain':!![]});var _0x1d310c=_0xe46d('0x23');return db[_0xe46d('0x24')][_0xe46d('0x25')]({'where':{'type':_0x1d310c,'resourceId':_0x27f5a6['id']}})[_0xe46d('0x21')](function(){return _0x511978;});})[_0xe46d('0x21')](function(){_0xab8797[_0xe46d('0x16')](0xcc)[_0xe46d('0x17')]();});}};}function handleEntityNotFound(_0x3516df,_0x19724c){return function(_0x302b49){if(!_0x302b49){_0x3516df[_0xe46d('0x15')](0x194);}return _0x302b49;};}function handleError(_0x431c82,_0x260051){_0x260051=_0x260051||0x1f4;return function(_0x4924b2){logger[_0xe46d('0x26')](_0x4924b2['stack']);if(_0x4924b2[_0xe46d('0x27')]){delete _0x4924b2['name'];}_0x431c82[_0xe46d('0x16')](_0x260051)['send'](_0x4924b2);};}exports[_0xe46d('0x28')]=function(_0xc95e36,_0x3bb776){var _0x14ad49={},_0x5352d3={},_0x3443fd={'count':0x0,'rows':[]};var _0x9bd941=_[_0xe46d('0x29')](db[_0xe46d('0x23')][_0xe46d('0x2a')],function(_0x5501d1){return{'name':_0x5501d1[_0xe46d('0x2b')],'type':_0x5501d1[_0xe46d('0x2c')]['key']};});_0x5352d3[_0xe46d('0x2d')]=_[_0xe46d('0x29')](_0x9bd941,_0xe46d('0x27'));_0x5352d3[_0xe46d('0x2e')]=_[_0xe46d('0x2f')](_0xc95e36['query']);_0x5352d3[_0xe46d('0x30')]=_[_0xe46d('0x31')](_0x5352d3[_0xe46d('0x2d')],_0x5352d3['query']);_0x14ad49[_0xe46d('0x32')]=_[_0xe46d('0x31')](_0x5352d3['model'],qs[_0xe46d('0x33')](_0xc95e36[_0xe46d('0x2e')][_0xe46d('0x33')]));_0x14ad49['attributes']=_0x14ad49['attributes'][_0xe46d('0x34')]?_0x14ad49[_0xe46d('0x32')]:_0x5352d3[_0xe46d('0x2d')];if(!_0xc95e36[_0xe46d('0x2e')][_0xe46d('0x35')]('nolimit')){_0x14ad49[_0xe46d('0x1b')]=qs['limit'](_0xc95e36[_0xe46d('0x2e')][_0xe46d('0x1b')]);_0x14ad49[_0xe46d('0x1a')]=qs[_0xe46d('0x1a')](_0xc95e36[_0xe46d('0x2e')]['offset']);}_0x14ad49['order']=qs[_0xe46d('0x36')](_0xc95e36[_0xe46d('0x2e')][_0xe46d('0x36')]);_0x14ad49['where']=qs['filters'](_[_0xe46d('0x37')](_0xc95e36['query'],_0x5352d3[_0xe46d('0x30')]),_0x9bd941);if(_0xc95e36[_0xe46d('0x2e')][_0xe46d('0x38')]){_0x14ad49['where']=_['merge'](_0x14ad49['where'],{'$or':_[_0xe46d('0x29')](_0x9bd941,function(_0x48b63d){if(_0x48b63d[_0xe46d('0x2c')]!==_0xe46d('0x39')){var _0x13a552={};_0x13a552[_0x48b63d[_0xe46d('0x27')]]={'$like':'%'+_0xc95e36[_0xe46d('0x2e')][_0xe46d('0x38')]+'%'};return _0x13a552;}})});}_0x14ad49=_[_0xe46d('0x3a')]({},_0x14ad49,_0xc95e36[_0xe46d('0x3b')]);var _0x12dd6a={'where':_0x14ad49['where']};return db[_0xe46d('0x23')]['count'](_0x12dd6a)['then'](function(_0x33119e){_0x3443fd[_0xe46d('0x19')]=_0x33119e;if(_0xc95e36[_0xe46d('0x2e')][_0xe46d('0x3c')]){_0x14ad49[_0xe46d('0x3d')]=[{'all':!![]}];}return db[_0xe46d('0x23')]['findAll'](_0x14ad49);})[_0xe46d('0x21')](function(_0x26b550){_0x3443fd['rows']=_0x26b550;return _0x3443fd;})[_0xe46d('0x21')](respondWithFilteredResult(_0x3bb776,_0x14ad49))[_0xe46d('0x3e')](handleError(_0x3bb776,null));};exports[_0xe46d('0x3f')]=function(_0x5e48ec,_0x441d5e){var _0x1c525f={'raw':!![],'where':{'id':_0x5e48ec[_0xe46d('0x40')]['id']}},_0x59dd76={};_0x59dd76[_0xe46d('0x2d')]=_[_0xe46d('0x2f')](db[_0xe46d('0x23')][_0xe46d('0x2a')]);_0x59dd76[_0xe46d('0x2e')]=_[_0xe46d('0x2f')](_0x5e48ec[_0xe46d('0x2e')]);_0x59dd76[_0xe46d('0x30')]=_[_0xe46d('0x31')](_0x59dd76[_0xe46d('0x2d')],_0x59dd76[_0xe46d('0x2e')]);_0x1c525f[_0xe46d('0x32')]=_[_0xe46d('0x31')](_0x59dd76[_0xe46d('0x2d')],qs[_0xe46d('0x33')](_0x5e48ec['query']['fields']));_0x1c525f[_0xe46d('0x32')]=_0x1c525f[_0xe46d('0x32')][_0xe46d('0x34')]?_0x1c525f[_0xe46d('0x32')]:_0x59dd76[_0xe46d('0x2d')];if(_0x5e48ec[_0xe46d('0x2e')]['includeAll']){_0x1c525f[_0xe46d('0x3d')]=[{'all':!![]}];}_0x1c525f=_[_0xe46d('0x3a')]({},_0x1c525f,_0x5e48ec[_0xe46d('0x3b')]);return db['UserOpenchannelInteraction'][_0xe46d('0x41')](_0x1c525f)[_0xe46d('0x21')](handleEntityNotFound(_0x441d5e,null))['then'](respondWithResult(_0x441d5e,null))[_0xe46d('0x3e')](handleError(_0x441d5e,null));};exports['create']=function(_0x39f2e5,_0x5a24a6){return db[_0xe46d('0x23')][_0xe46d('0x42')](_0x39f2e5[_0xe46d('0x43')],{})['then'](function(_0x2c4d21){var _0x2d4b83=_0x39f2e5[_0xe46d('0x44')][_0xe46d('0x22')]({'plain':!![]});if(!_0x2d4b83)throw new Error(_0xe46d('0x45'));if(_0x2d4b83['role']==='user'){var _0x2db26b=_0x2c4d21['get']({'plain':!![]});var _0x1d2aa6=_0xe46d('0x23');return db[_0xe46d('0x46')][_0xe46d('0x41')]({'where':{'name':_0x1d2aa6,'userProfileId':_0x2d4b83[_0xe46d('0x47')]},'raw':!![]})[_0xe46d('0x21')](function(_0x571cee){if(_0x571cee&&_0x571cee[_0xe46d('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x2db26b[_0xe46d('0x27')],'resourceId':_0x2db26b['id'],'type':_0x571cee[_0xe46d('0x27')],'sectionId':_0x571cee['id']},{})[_0xe46d('0x21')](function(){return _0x2c4d21;});}else{return _0x2c4d21;}})['catch'](function(_0x23f887){logger[_0xe46d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23f887);throw _0x23f887;});}return _0x2c4d21;})[_0xe46d('0x21')](respondWithResult(_0x5a24a6,0xc9))[_0xe46d('0x3e')](handleError(_0x5a24a6,null));};exports['update']=function(_0x362e0e,_0x38fcd6){if(_0x362e0e[_0xe46d('0x43')]['id']){delete _0x362e0e[_0xe46d('0x43')]['id'];}return db[_0xe46d('0x23')]['find']({'where':{'id':_0x362e0e[_0xe46d('0x40')]['id']}})['then'](handleEntityNotFound(_0x38fcd6,null))[_0xe46d('0x21')](saveUpdates(_0x362e0e[_0xe46d('0x43')],null))[_0xe46d('0x21')](respondWithResult(_0x38fcd6,null))[_0xe46d('0x3e')](handleError(_0x38fcd6,null));};exports[_0xe46d('0x25')]=function(_0x5816ef,_0x10eb02){return db[_0xe46d('0x23')]['find']({'where':{'id':_0x5816ef[_0xe46d('0x40')]['id']}})[_0xe46d('0x21')](handleEntityNotFound(_0x10eb02,null))[_0xe46d('0x21')](removeEntity(_0x10eb02,null))[_0xe46d('0x3e')](handleError(_0x10eb02,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index b2302a7..b6a069d 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 _0x9251=['user_has_openchannel_interactions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./UserOpenchannelInteraction.attributes','exports','UserOpenchannelInteraction'];(function(_0x514a57,_0x3f68f0){var _0x5814ac=function(_0x538d37){while(--_0x538d37){_0x514a57['push'](_0x514a57['shift']());}};_0x5814ac(++_0x3f68f0);}(_0x9251,0x1ef));var _0x1925=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x9251[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x1925('0x0'));var util=require(_0x1925('0x1'));var logger=require(_0x1925('0x2'))(_0x1925('0x3'));var moment=require(_0x1925('0x4'));var BPromise=require(_0x1925('0x5'));var rp=require(_0x1925('0x6'));var fs=require('fs');var path=require(_0x1925('0x7'));var rimraf=require(_0x1925('0x8'));var config=require('../../config/environment');var attributes=require(_0x1925('0x9'));module[_0x1925('0xa')]=function(_0x55d1e9,_0x2e019e){return _0x55d1e9['define'](_0x1925('0xb'),attributes,{'tableName':_0x1925('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad06=['path','rimraf','./UserOpenchannelInteraction.attributes','define','UserOpenchannelInteraction','user_has_openchannel_interactions','lodash','util','../../config/logger','api','moment'];(function(_0x5f4b22,_0x919535){var _0x40bd49=function(_0x37fb86){while(--_0x37fb86){_0x5f4b22['push'](_0x5f4b22['shift']());}};_0x40bd49(++_0x919535);}(_0xad06,0x17c));var _0x6ad0=function(_0x5f0079,_0x4a82e8){_0x5f0079=_0x5f0079-0x0;var _0x4816a3=_0xad06[_0x5f0079];return _0x4816a3;};'use strict';var _=require(_0x6ad0('0x0'));var util=require(_0x6ad0('0x1'));var logger=require(_0x6ad0('0x2'))(_0x6ad0('0x3'));var moment=require(_0x6ad0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ad0('0x5'));var rimraf=require(_0x6ad0('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ad0('0x7'));module['exports']=function(_0x3aaeda,_0x2a6299){return _0x3aaeda[_0x6ad0('0x8')](_0x6ad0('0x9'),attributes,{'tableName':_0x6ad0('0xa'),'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 09a42fa..00d0fe3 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 _0x6237=['http','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x54228c,_0x401158){var _0x52b709=function(_0x38f8cd){while(--_0x38f8cd){_0x54228c['push'](_0x54228c['shift']());}};_0x52b709(++_0x401158);}(_0x6237,0xc4));var _0x7623=function(_0x5c7883,_0x2d0e2e){_0x5c7883=_0x5c7883-0x0;var _0x2e4777=_0x6237[_0x5c7883];return _0x2e4777;};'use strict';var _=require(_0x7623('0x0'));var util=require(_0x7623('0x1'));var moment=require(_0x7623('0x2'));var BPromise=require(_0x7623('0x3'));var rs=require(_0x7623('0x4'));var fs=require('fs');var Redis=require(_0x7623('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7623('0x6'));var logger=require(_0x7623('0x7'))(_0x7623('0x8'));var config=require('../../config/environment');var jayson=require(_0x7623('0x9'));var client=jayson[_0x7623('0xa')][_0x7623('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3457da,_0x4c1464,_0x2f43b6){return new BPromise(function(_0x25fea2,_0x1fbc97){return client['request'](_0x3457da,_0x2f43b6)[_0x7623('0xc')](function(_0xb98922){logger[_0x7623('0xd')](_0x7623('0xe'),_0x4c1464,_0x7623('0xf'));logger['debug'](_0x7623('0x10'),_0x4c1464,'request\x20sent',JSON[_0x7623('0x11')](_0xb98922));if(_0xb98922[_0x7623('0x12')]){if(_0xb98922[_0x7623('0x12')][_0x7623('0x13')]===0x1f4){logger[_0x7623('0x12')](_0x7623('0xe'),_0x4c1464,_0xb98922['error'][_0x7623('0x14')]);return _0x1fbc97(_0xb98922[_0x7623('0x12')]['message']);}logger['error'](_0x7623('0xe'),_0x4c1464,_0xb98922['error']['message']);return _0x25fea2(_0xb98922[_0x7623('0x12')][_0x7623('0x14')]);}else{logger[_0x7623('0xd')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x4c1464,'request\x20sent');_0x25fea2(_0xb98922[_0x7623('0x15')][_0x7623('0x14')]);}})[_0x7623('0x16')](function(_0x2ca890){logger[_0x7623('0x12')](_0x7623('0xe'),_0x4c1464,_0x2ca890);_0x1fbc97(_0x2ca890);});});} \ No newline at end of file +var _0xc95b=['error','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc95b,0x124));var _0xbc95=function(_0x2b425d,_0x43ec95){_0x2b425d=_0x2b425d-0x0;var _0x4de01b=_0xc95b[_0x2b425d];return _0x4de01b;};'use strict';var _=require(_0xbc95('0x0'));var util=require('util');var moment=require(_0xbc95('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc95('0x3'))['db'];var utils=require(_0xbc95('0x4'));var logger=require(_0xbc95('0x5'))(_0xbc95('0x6'));var config=require(_0xbc95('0x7'));var jayson=require(_0xbc95('0x8'));var client=jayson[_0xbc95('0x9')][_0xbc95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5697e7,_0xa5bd55,_0x55289f){return new BPromise(function(_0x3e5de0,_0x2345b6){return client['request'](_0x5697e7,_0x55289f)[_0xbc95('0xb')](function(_0x114ed4){logger['info'](_0xbc95('0xc'),_0xa5bd55,'request\x20sent');logger['debug']('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xa5bd55,_0xbc95('0xd'),JSON['stringify'](_0x114ed4));if(_0x114ed4[_0xbc95('0xe')]){if(_0x114ed4['error']['code']===0x1f4){logger[_0xbc95('0xe')](_0xbc95('0xc'),_0xa5bd55,_0x114ed4[_0xbc95('0xe')][_0xbc95('0xf')]);return _0x2345b6(_0x114ed4[_0xbc95('0xe')][_0xbc95('0xf')]);}logger[_0xbc95('0xe')](_0xbc95('0xc'),_0xa5bd55,_0x114ed4[_0xbc95('0xe')][_0xbc95('0xf')]);return _0x3e5de0(_0x114ed4['error'][_0xbc95('0xf')]);}else{logger['info'](_0xbc95('0xc'),_0xa5bd55,'request\x20sent');_0x3e5de0(_0x114ed4['result']['message']);}})[_0xbc95('0x10')](function(_0x41c372){logger['error'](_0xbc95('0xc'),_0xa5bd55,_0x41c372);_0x2345b6(_0x41c372);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 466a7b2..a635be6 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 _0x6779=['./UserOpenchannelInteraction.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5534b7,_0xbe6ba4){var _0x34af05=function(_0x2f8d94){while(--_0x2f8d94){_0x5534b7['push'](_0x5534b7['shift']());}};_0x34af05(++_0xbe6ba4);}(_0x6779,0x1bb));var _0x9677=function(_0x3c368e,_0x5496e6){_0x3c368e=_0x3c368e-0x0;var _0xa76859=_0x6779[_0x3c368e];return _0xa76859;};'use strict';var multer=require('multer');var util=require(_0x9677('0x0'));var path=require(_0x9677('0x1'));var timeout=require(_0x9677('0x2'));var express=require(_0x9677('0x3'));var router=express[_0x9677('0x4')]();var auth=require(_0x9677('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9677('0x6'));var controller=require(_0x9677('0x7'));router[_0x9677('0x8')]('/',auth[_0x9677('0x9')](),controller[_0x9677('0xa')]);router[_0x9677('0x8')](_0x9677('0xb'),auth[_0x9677('0x9')](),controller[_0x9677('0xc')]);router[_0x9677('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9677('0xe')](_0x9677('0xb'),auth[_0x9677('0x9')](),controller[_0x9677('0xf')]);router['delete']('/:id',auth[_0x9677('0x9')](),controller[_0x9677('0x10')]);module[_0x9677('0x11')]=router; \ No newline at end of file +var _0x15e0=['connect-timeout','express','Router','../../components/auth/service','./UserOpenchannelInteraction.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util','path'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x15e0,0x85));var _0x015e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15e0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x015e('0x0'));var util=require(_0x015e('0x1'));var path=require(_0x015e('0x2'));var timeout=require(_0x015e('0x3'));var express=require(_0x015e('0x4'));var router=express[_0x015e('0x5')]();var auth=require(_0x015e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x015e('0x7'));router[_0x015e('0x8')]('/',auth[_0x015e('0x9')](),controller[_0x015e('0xa')]);router[_0x015e('0x8')](_0x015e('0xb'),auth[_0x015e('0x9')](),controller[_0x015e('0xc')]);router['post']('/',auth[_0x015e('0x9')](),controller[_0x015e('0xd')]);router[_0x015e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x015e('0xf')]);router['delete'](_0x015e('0xb'),auth[_0x015e('0x9')](),controller[_0x015e('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 3ba0cc0..d30edc7 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 _0xbf90=['sequelize','INTEGER'];(function(_0x1efd6d,_0xa1657e){var _0x22d6e3=function(_0x3fc028){while(--_0x3fc028){_0x1efd6d['push'](_0x1efd6d['shift']());}};_0x22d6e3(++_0xa1657e);}(_0xbf90,0x1b4));var _0x0bf9=function(_0x2a02ca,_0x1003e8){_0x2a02ca=_0x2a02ca-0x0;var _0x5d058e=_0xbf90[_0x2a02ca];return _0x5d058e;};'use strict';var Sequelize=require(_0x0bf9('0x0'));module['exports']={'SmsInteractionId':{'type':Sequelize[_0x0bf9('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0bf9('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xa52e=['sequelize','INTEGER'];(function(_0x1859f1,_0x19cd42){var _0x426855=function(_0x5d33b8){while(--_0x5d33b8){_0x1859f1['push'](_0x1859f1['shift']());}};_0x426855(++_0x19cd42);}(_0xa52e,0xea));var _0xea52=function(_0x2a8c49,_0xa3abc0){_0x2a8c49=_0x2a8c49-0x0;var _0x3f0da8=_0xa52e[_0x2a8c49];return _0x3f0da8;};'use strict';var Sequelize=require(_0xea52('0x0'));module['exports']={'SmsInteractionId':{'type':Sequelize[_0xea52('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xea52('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 24b8778..d35daf2 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(_0x36b087,_0x19caa9){var _0x41123e=function(_0x1e4693){while(--_0x1e4693){_0x36b087['push'](_0x36b087['shift']());}};_0x41123e(++_0x19caa9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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(_0x4f0d36,_0x2ef8b5){var _0x1eb2a6=function(_0x2ab3ee){while(--_0x2ab3ee){_0x4f0d36['push'](_0x4f0d36['shift']());}};_0x1eb2a6(++_0x2ef8b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 7e76638..6d1a435 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 _0xa5ed=['path','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions','lodash','../../config/logger','moment','request-promise'];(function(_0xd83e3,_0x162b7b){var _0x83645b=function(_0xdcf001){while(--_0xdcf001){_0xd83e3['push'](_0xd83e3['shift']());}};_0x83645b(++_0x162b7b);}(_0xa5ed,0x1d5));var _0xda5e=function(_0x5ab3c3,_0x36beda){_0x5ab3c3=_0x5ab3c3-0x0;var _0x25d4e4=_0xa5ed[_0x5ab3c3];return _0x25d4e4;};'use strict';var _=require(_0xda5e('0x0'));var util=require('util');var logger=require(_0xda5e('0x1'))('api');var moment=require(_0xda5e('0x2'));var BPromise=require('bluebird');var rp=require(_0xda5e('0x3'));var fs=require('fs');var path=require(_0xda5e('0x4'));var rimraf=require('rimraf');var config=require(_0xda5e('0x5'));var attributes=require(_0xda5e('0x6'));module[_0xda5e('0x7')]=function(_0x26f95f,_0x6a96fc){return _0x26f95f[_0xda5e('0x8')](_0xda5e('0x9'),attributes,{'tableName':_0xda5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4255=['bluebird','request-promise','path','rimraf','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','lodash','util','../../config/logger','api','moment'];(function(_0x356c63,_0x48d4ce){var _0x158552=function(_0x162e11){while(--_0x162e11){_0x356c63['push'](_0x356c63['shift']());}};_0x158552(++_0x48d4ce);}(_0x4255,0x1c9));var _0x5425=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x4255[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x5425('0x0'));var util=require(_0x5425('0x1'));var logger=require(_0x5425('0x2'))(_0x5425('0x3'));var moment=require(_0x5425('0x4'));var BPromise=require(_0x5425('0x5'));var rp=require(_0x5425('0x6'));var fs=require('fs');var path=require(_0x5425('0x7'));var rimraf=require(_0x5425('0x8'));var config=require(_0x5425('0x9'));var attributes=require(_0x5425('0xa'));module[_0x5425('0xb')]=function(_0x54906b,_0xdd6b33){return _0x54906b[_0x5425('0xc')](_0x5425('0xd'),attributes,{'tableName':'user_has_sms_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js index 7d2174e..dbf2649 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 _0x57c3=['catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserSmsInteraction,\x20%s,\x20%s','UserSmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0xe7d5ae,_0x5e6ff3){var _0x227e7b=function(_0x272ce3){while(--_0x272ce3){_0xe7d5ae['push'](_0xe7d5ae['shift']());}};_0x227e7b(++_0x5e6ff3);}(_0x57c3,0x135));var _0x357c=function(_0x547f8b,_0x4660ff){_0x547f8b=_0x547f8b-0x0;var _0x2c7521=_0x57c3[_0x547f8b];return _0x2c7521;};'use strict';var _=require('lodash');var util=require(_0x357c('0x0'));var moment=require(_0x357c('0x1'));var BPromise=require('bluebird');var rs=require(_0x357c('0x2'));var fs=require('fs');var Redis=require(_0x357c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x357c('0x4'));var logger=require(_0x357c('0x5'))(_0x357c('0x6'));var config=require(_0x357c('0x7'));var jayson=require(_0x357c('0x8'));var client=jayson[_0x357c('0x9')][_0x357c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39b426,_0x42f90e,_0x34a16c){return new BPromise(function(_0x3e9de9,_0x1921ee){return client[_0x357c('0xb')](_0x39b426,_0x34a16c)['then'](function(_0x3039ce){logger['info'](_0x357c('0xc'),_0x42f90e,'request\x20sent');logger['debug'](_0x357c('0xd'),_0x42f90e,_0x357c('0xe'),JSON[_0x357c('0xf')](_0x3039ce));if(_0x3039ce[_0x357c('0x10')]){if(_0x3039ce[_0x357c('0x10')][_0x357c('0x11')]===0x1f4){logger['error']('UserSmsInteraction,\x20%s,\x20%s',_0x42f90e,_0x3039ce[_0x357c('0x10')]['message']);return _0x1921ee(_0x3039ce[_0x357c('0x10')]['message']);}logger[_0x357c('0x10')](_0x357c('0xc'),_0x42f90e,_0x3039ce[_0x357c('0x10')]['message']);return _0x3e9de9(_0x3039ce[_0x357c('0x10')][_0x357c('0x12')]);}else{logger[_0x357c('0x13')](_0x357c('0xc'),_0x42f90e,_0x357c('0xe'));_0x3e9de9(_0x3039ce[_0x357c('0x14')][_0x357c('0x12')]);}})[_0x357c('0x15')](function(_0x5bccea){logger['error'](_0x357c('0xc'),_0x42f90e,_0x5bccea);_0x1921ee(_0x5bccea);});});} \ No newline at end of file +var _0xc690=['message','result','lodash','util','randomstring','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4311e1,_0x358b56){var _0x25bffd=function(_0x478610){while(--_0x478610){_0x4311e1['push'](_0x4311e1['shift']());}};_0x25bffd(++_0x358b56);}(_0xc690,0x17e));var _0x0c69=function(_0xfcfa0c,_0x408695){_0xfcfa0c=_0xfcfa0c-0x0;var _0xe43ea1=_0xc690[_0xfcfa0c];return _0xe43ea1;};'use strict';var _=require(_0x0c69('0x0'));var util=require(_0x0c69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c69('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0c69('0x3'));var jayson=require(_0x0c69('0x4'));var client=jayson[_0x0c69('0x5')][_0x0c69('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15c7ba,_0xccbe8d,_0x38c5f9){return new BPromise(function(_0x31a24f,_0x2d8df9){return client[_0x0c69('0x7')](_0x15c7ba,_0x38c5f9)[_0x0c69('0x8')](function(_0x5ddd71){logger[_0x0c69('0x9')](_0x0c69('0xa'),_0xccbe8d,_0x0c69('0xb'));logger[_0x0c69('0xc')](_0x0c69('0xd'),_0xccbe8d,_0x0c69('0xb'),JSON[_0x0c69('0xe')](_0x5ddd71));if(_0x5ddd71[_0x0c69('0xf')]){if(_0x5ddd71[_0x0c69('0xf')][_0x0c69('0x10')]===0x1f4){logger[_0x0c69('0xf')]('UserSmsInteraction,\x20%s,\x20%s',_0xccbe8d,_0x5ddd71[_0x0c69('0xf')]['message']);return _0x2d8df9(_0x5ddd71[_0x0c69('0xf')]['message']);}logger[_0x0c69('0xf')]('UserSmsInteraction,\x20%s,\x20%s',_0xccbe8d,_0x5ddd71[_0x0c69('0xf')][_0x0c69('0x11')]);return _0x31a24f(_0x5ddd71[_0x0c69('0xf')][_0x0c69('0x11')]);}else{logger['info'](_0x0c69('0xa'),_0xccbe8d,_0x0c69('0xb'));_0x31a24f(_0x5ddd71[_0x0c69('0x12')][_0x0c69('0x11')]);}})['catch'](function(_0x146229){logger[_0x0c69('0xf')]('UserSmsInteraction,\x20%s,\x20%s',_0xccbe8d,_0x146229);_0x2d8df9(_0x146229);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 115df6c..3f4e671 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 _0xaaf5=['connect-timeout','express','../../components/interaction/service','./UserSmsInteraction.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4c96e4,_0x2fe2ea){var _0x2dd5d2=function(_0x3f040d){while(--_0x3f040d){_0x4c96e4['push'](_0x4c96e4['shift']());}};_0x2dd5d2(++_0x2fe2ea);}(_0xaaf5,0x10d));var _0x5aaf=function(_0x18662a,_0x393120){_0x18662a=_0x18662a-0x0;var _0xfdcd66=_0xaaf5[_0x18662a];return _0xfdcd66;};'use strict';var multer=require(_0x5aaf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5aaf('0x1'));var express=require(_0x5aaf('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5aaf('0x3'));var config=require('../../config/environment');var controller=require(_0x5aaf('0x4'));router['get']('/',auth[_0x5aaf('0x5')](),controller['index']);router[_0x5aaf('0x6')](_0x5aaf('0x7'),auth[_0x5aaf('0x5')](),controller[_0x5aaf('0x8')]);router[_0x5aaf('0x9')]('/',auth[_0x5aaf('0x5')](),controller['create']);router[_0x5aaf('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5aaf('0xb')]);router[_0x5aaf('0xc')](_0x5aaf('0x7'),auth[_0x5aaf('0x5')](),controller[_0x5aaf('0xd')]);module[_0x5aaf('0xe')]=router; \ No newline at end of file +var _0xf4bc=['path','connect-timeout','express','Router','../../components/interaction/service','./UserSmsInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','multer','util'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xf4bc,0x86));var _0xcf4b=function(_0x5527c0,_0x1c0a4e){_0x5527c0=_0x5527c0-0x0;var _0xf8a931=_0xf4bc[_0x5527c0];return _0xf8a931;};'use strict';var multer=require(_0xcf4b('0x0'));var util=require(_0xcf4b('0x1'));var path=require(_0xcf4b('0x2'));var timeout=require(_0xcf4b('0x3'));var express=require(_0xcf4b('0x4'));var router=express[_0xcf4b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf4b('0x6'));var config=require('../../config/environment');var controller=require(_0xcf4b('0x7'));router[_0xcf4b('0x8')]('/',auth[_0xcf4b('0x9')](),controller[_0xcf4b('0xa')]);router['get'](_0xcf4b('0xb'),auth[_0xcf4b('0x9')](),controller[_0xcf4b('0xc')]);router[_0xcf4b('0xd')]('/',auth[_0xcf4b('0x9')](),controller[_0xcf4b('0xe')]);router[_0xcf4b('0xf')](_0xcf4b('0xb'),auth[_0xcf4b('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcf4b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index 47b8ef9..38f545a 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 _0xa120=['INTEGER','sequelize','exports'];(function(_0x46dce0,_0x2e12a8){var _0x254615=function(_0x172af0){while(--_0x172af0){_0x46dce0['push'](_0x46dce0['shift']());}};_0x254615(++_0x2e12a8);}(_0xa120,0xf4));var _0x0a12=function(_0x1db55c,_0x3eb48f){_0x1db55c=_0x1db55c-0x0;var _0x447229=_0xa120[_0x1db55c];return _0x447229;};'use strict';var Sequelize=require(_0x0a12('0x0'));module[_0x0a12('0x1')]={'WhatsappInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0a12('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x9515=['INTEGER','sequelize'];(function(_0x1aac40,_0x205b63){var _0x3d1126=function(_0xc71007){while(--_0xc71007){_0x1aac40['push'](_0x1aac40['shift']());}};_0x3d1126(++_0x205b63);}(_0x9515,0xe7));var _0x5951=function(_0x305b6a,_0x368b7c){_0x305b6a=_0x305b6a-0x0;var _0x1e3eb4=_0x9515[_0x305b6a];return _0x1e3eb4;};'use strict';var Sequelize=require(_0x5951('0x0'));module['exports']={'WhatsappInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x5951('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 99d5d21..bf29547 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 _0x3298=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','UserWhatsappInteraction','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserWhatsappInteractions','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','crypto','desk.js'];(function(_0x2cf1d8,_0x3d3512){var _0x2872dd=function(_0x1aabc7){while(--_0x1aabc7){_0x2cf1d8['push'](_0x2cf1d8['shift']());}};_0x2872dd(++_0x3d3512);}(_0x3298,0x137));var _0x8329=function(_0xa1b92e,_0x163513){_0xa1b92e=_0xa1b92e-0x0;var _0x3722c4=_0x3298[_0xa1b92e];return _0x3722c4;};'use strict';var pdf=require(_0x8329('0x0'));var emlformat=require(_0x8329('0x1'));var rimraf=require(_0x8329('0x2'));var zipdir=require(_0x8329('0x3'));var jsonpatch=require(_0x8329('0x4'));var rp=require('request-promise');var moment=require(_0x8329('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8329('0x6'));var path=require('path');var sox=require(_0x8329('0x7'));var csv=require(_0x8329('0x8'));var ejs=require(_0x8329('0x9'));var fs=require('fs');var _=require(_0x8329('0xa'));var squel=require('squel');var crypto=require(_0x8329('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8329('0xc'));var toCsv=require(_0x8329('0x8'));var querystring=require(_0x8329('0xd'));var Papa=require(_0x8329('0xe'));var Redis=require(_0x8329('0xf'));var authService=require(_0x8329('0x10'));var qs=require(_0x8329('0x11'));var as=require(_0x8329('0x12'));var hardwareService=require(_0x8329('0x13'));var logger=require(_0x8329('0x14'))('api');var utils=require(_0x8329('0x15'));var config=require(_0x8329('0x16'));var licenseUtil=require(_0x8329('0x17'));var db=require(_0x8329('0x18'))['db'];function respondWithStatusCode(_0x1635c9,_0x5438f4){_0x5438f4=_0x5438f4||0xcc;return function(_0x4afb26){if(_0x4afb26){return _0x1635c9[_0x8329('0x19')](_0x5438f4);}return _0x1635c9[_0x8329('0x1a')](_0x5438f4)['end']();};}function respondWithResult(_0x4f45cd,_0x36a87c){_0x36a87c=_0x36a87c||0xc8;return function(_0x191a12){if(_0x191a12){return _0x4f45cd['status'](_0x36a87c)[_0x8329('0x1b')](_0x191a12);}};}function respondWithFilteredResult(_0x34c413,_0x320346){return function(_0x4857f4){if(_0x4857f4){var _0x4fceeb=_0x4857f4[_0x8329('0x1c')],_0x348219=_0x320346[_0x8329('0x1d')],_0x2a71e8=_0x320346[_0x8329('0x1d')]+_0x320346[_0x8329('0x1e')],_0x389e82;if(_0x2a71e8>=_0x4fceeb){_0x2a71e8=_0x4fceeb;_0x389e82=0xc8;}else{_0x389e82=0xce;}_0x34c413[_0x8329('0x1a')](_0x389e82);return _0x34c413['set'](_0x8329('0x1f'),_0x348219+'-'+_0x2a71e8+'/'+_0x4fceeb)[_0x8329('0x1b')](_0x4857f4);}return null;};}function patchUpdates(_0x3d6f49){return function(_0x20db15){try{jsonpatch['apply'](_0x20db15,_0x3d6f49,!![]);}catch(_0x1a3212){return BPromise[_0x8329('0x20')](_0x1a3212);}return _0x20db15['save']();};}function saveUpdates(_0x25a23e,_0x4c501c){return function(_0x4f9208){if(_0x4f9208){return _0x4f9208[_0x8329('0x21')](_0x25a23e)[_0x8329('0x22')](function(_0x1f05d4){return _0x1f05d4;});}return null;};}function removeEntity(_0x25b40b,_0x3e6ba7){return function(_0x4e3705){if(_0x4e3705){return _0x4e3705['destroy']()[_0x8329('0x22')](function(){var _0x125fcd=_0x4e3705['get']({'plain':!![]});var _0x3515db='UserWhatsappInteractions';return db['UserProfileResource'][_0x8329('0x23')]({'where':{'type':_0x3515db,'resourceId':_0x125fcd['id']}})['then'](function(){return _0x4e3705;});})[_0x8329('0x22')](function(){_0x25b40b[_0x8329('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1059aa,_0x1c6795){return function(_0x177def){if(!_0x177def){_0x1059aa['sendStatus'](0x194);}return _0x177def;};}function handleError(_0x5384b1,_0x1f73a9){_0x1f73a9=_0x1f73a9||0x1f4;return function(_0x3a16fe){logger[_0x8329('0x24')](_0x3a16fe[_0x8329('0x25')]);if(_0x3a16fe[_0x8329('0x26')]){delete _0x3a16fe[_0x8329('0x26')];}_0x5384b1['status'](_0x1f73a9)[_0x8329('0x27')](_0x3a16fe);};}exports['index']=function(_0x3e6c62,_0x11d955){var _0x258729={},_0x359dd7={},_0x1de830={'count':0x0,'rows':[]};var _0x195527=_['map'](db['UserWhatsappInteraction']['rawAttributes'],function(_0x1ea249){return{'name':_0x1ea249['fieldName'],'type':_0x1ea249[_0x8329('0x28')][_0x8329('0x29')]};});_0x359dd7[_0x8329('0x2a')]=_[_0x8329('0x2b')](_0x195527,_0x8329('0x26'));_0x359dd7[_0x8329('0x2c')]=_[_0x8329('0x2d')](_0x3e6c62['query']);_0x359dd7[_0x8329('0x2e')]=_['intersection'](_0x359dd7[_0x8329('0x2a')],_0x359dd7[_0x8329('0x2c')]);_0x258729[_0x8329('0x2f')]=_[_0x8329('0x30')](_0x359dd7[_0x8329('0x2a')],qs[_0x8329('0x31')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x31')]));_0x258729[_0x8329('0x2f')]=_0x258729[_0x8329('0x2f')]['length']?_0x258729[_0x8329('0x2f')]:_0x359dd7['model'];if(!_0x3e6c62[_0x8329('0x2c')][_0x8329('0x32')](_0x8329('0x33'))){_0x258729[_0x8329('0x1e')]=qs[_0x8329('0x1e')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x1e')]);_0x258729[_0x8329('0x1d')]=qs[_0x8329('0x1d')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x1d')]);}_0x258729[_0x8329('0x34')]=qs[_0x8329('0x35')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x35')]);_0x258729['where']=qs[_0x8329('0x2e')](_[_0x8329('0x36')](_0x3e6c62[_0x8329('0x2c')],_0x359dd7[_0x8329('0x2e')]),_0x195527);if(_0x3e6c62['query'][_0x8329('0x37')]){_0x258729[_0x8329('0x38')]=_['merge'](_0x258729[_0x8329('0x38')],{'$or':_[_0x8329('0x2b')](_0x195527,function(_0x503ec8){if(_0x503ec8['type']!==_0x8329('0x39')){var _0x5d5407={};_0x5d5407[_0x503ec8['name']]={'$like':'%'+_0x3e6c62[_0x8329('0x2c')][_0x8329('0x37')]+'%'};return _0x5d5407;}})});}_0x258729=_[_0x8329('0x3a')]({},_0x258729,_0x3e6c62[_0x8329('0x3b')]);var _0x582594={'where':_0x258729['where']};return db[_0x8329('0x3c')][_0x8329('0x1c')](_0x582594)['then'](function(_0x5b8d2b){_0x1de830[_0x8329('0x1c')]=_0x5b8d2b;if(_0x3e6c62[_0x8329('0x2c')][_0x8329('0x3d')]){_0x258729[_0x8329('0x3e')]=[{'all':!![]}];}return db[_0x8329('0x3c')][_0x8329('0x3f')](_0x258729);})[_0x8329('0x22')](function(_0x104524){_0x1de830[_0x8329('0x40')]=_0x104524;return _0x1de830;})[_0x8329('0x22')](respondWithFilteredResult(_0x11d955,_0x258729))[_0x8329('0x41')](handleError(_0x11d955,null));};exports[_0x8329('0x42')]=function(_0x4beae4,_0x6d6d1c){var _0x1d2450={'raw':!![],'where':{'id':_0x4beae4[_0x8329('0x43')]['id']}},_0x5d98c4={};_0x5d98c4[_0x8329('0x2a')]=_[_0x8329('0x2d')](db[_0x8329('0x3c')][_0x8329('0x44')]);_0x5d98c4[_0x8329('0x2c')]=_[_0x8329('0x2d')](_0x4beae4[_0x8329('0x2c')]);_0x5d98c4[_0x8329('0x2e')]=_[_0x8329('0x30')](_0x5d98c4['model'],_0x5d98c4[_0x8329('0x2c')]);_0x1d2450[_0x8329('0x2f')]=_[_0x8329('0x30')](_0x5d98c4[_0x8329('0x2a')],qs['fields'](_0x4beae4[_0x8329('0x2c')][_0x8329('0x31')]));_0x1d2450[_0x8329('0x2f')]=_0x1d2450[_0x8329('0x2f')]['length']?_0x1d2450['attributes']:_0x5d98c4[_0x8329('0x2a')];if(_0x4beae4['query'][_0x8329('0x3d')]){_0x1d2450[_0x8329('0x3e')]=[{'all':!![]}];}_0x1d2450=_[_0x8329('0x3a')]({},_0x1d2450,_0x4beae4['options']);return db['UserWhatsappInteraction'][_0x8329('0x45')](_0x1d2450)['then'](handleEntityNotFound(_0x6d6d1c,null))['then'](respondWithResult(_0x6d6d1c,null))[_0x8329('0x41')](handleError(_0x6d6d1c,null));};exports[_0x8329('0x46')]=function(_0x317c18,_0x265968){return db[_0x8329('0x3c')][_0x8329('0x46')](_0x317c18[_0x8329('0x47')],{})[_0x8329('0x22')](function(_0xf5fbe4){var _0x188157=_0x317c18[_0x8329('0x48')][_0x8329('0x49')]({'plain':!![]});if(!_0x188157)throw new Error(_0x8329('0x4a'));if(_0x188157[_0x8329('0x4b')]===_0x8329('0x48')){var _0x564498=_0xf5fbe4['get']({'plain':!![]});var _0x22600a=_0x8329('0x4c');return db[_0x8329('0x4d')]['find']({'where':{'name':_0x22600a,'userProfileId':_0x188157['userProfileId']},'raw':!![]})[_0x8329('0x22')](function(_0x42e450){if(_0x42e450&&_0x42e450[_0x8329('0x4e')]===0x0){return db[_0x8329('0x4f')][_0x8329('0x46')]({'name':_0x564498[_0x8329('0x26')],'resourceId':_0x564498['id'],'type':_0x42e450[_0x8329('0x26')],'sectionId':_0x42e450['id']},{})['then'](function(){return _0xf5fbe4;});}else{return _0xf5fbe4;}})['catch'](function(_0x11f9d6){logger[_0x8329('0x24')](_0x8329('0x50'),_0x11f9d6);throw _0x11f9d6;});}return _0xf5fbe4;})[_0x8329('0x22')](respondWithResult(_0x265968,0xc9))[_0x8329('0x41')](handleError(_0x265968,null));};exports[_0x8329('0x21')]=function(_0x595803,_0x34e675){if(_0x595803[_0x8329('0x47')]['id']){delete _0x595803['body']['id'];}return db[_0x8329('0x3c')]['find']({'where':{'id':_0x595803[_0x8329('0x43')]['id']}})['then'](handleEntityNotFound(_0x34e675,null))['then'](saveUpdates(_0x595803[_0x8329('0x47')],null))[_0x8329('0x22')](respondWithResult(_0x34e675,null))['catch'](handleError(_0x34e675,null));};exports[_0x8329('0x23')]=function(_0xa2ef25,_0x3f1d3b){return db['UserWhatsappInteraction']['find']({'where':{'id':_0xa2ef25[_0x8329('0x43')]['id']}})[_0x8329('0x22')](handleEntityNotFound(_0x3f1d3b,null))[_0x8329('0x22')](removeEntity(_0x3f1d3b,null))[_0x8329('0x41')](handleError(_0x3f1d3b,null));}; \ No newline at end of file +var _0xf12e=['moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','reject','save','then','get','UserWhatsappInteractions','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','limit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','UserWhatsappInteraction','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x771cec,_0x57b072){var _0x46688c=function(_0x365cf4){while(--_0x365cf4){_0x771cec['push'](_0x771cec['shift']());}};_0x46688c(++_0x57b072);}(_0xf12e,0x147));var _0xef12=function(_0x4c19a1,_0x15197f){_0x4c19a1=_0x4c19a1-0x0;var _0x58ac50=_0xf12e[_0x4c19a1];return _0x58ac50;};'use strict';var pdf=require(_0xef12('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xef12('0x1'));var zipdir=require(_0xef12('0x2'));var jsonpatch=require(_0xef12('0x3'));var rp=require(_0xef12('0x4'));var moment=require(_0xef12('0x5'));var BPromise=require(_0xef12('0x6'));var Mustache=require('mustache');var util=require(_0xef12('0x7'));var path=require(_0xef12('0x8'));var sox=require(_0xef12('0x9'));var csv=require('to-csv');var ejs=require(_0xef12('0xa'));var fs=require('fs');var _=require(_0xef12('0xb'));var squel=require('squel');var crypto=require(_0xef12('0xc'));var jsforce=require(_0xef12('0xd'));var deskjs=require(_0xef12('0xe'));var toCsv=require(_0xef12('0xf'));var querystring=require(_0xef12('0x10'));var Papa=require(_0xef12('0x11'));var Redis=require('ioredis');var authService=require(_0xef12('0x12'));var qs=require(_0xef12('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef12('0x14'));var logger=require(_0xef12('0x15'))(_0xef12('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef12('0x17'));var db=require(_0xef12('0x18'))['db'];function respondWithStatusCode(_0x28a3eb,_0x87f211){_0x87f211=_0x87f211||0xcc;return function(_0x26429b){if(_0x26429b){return _0x28a3eb[_0xef12('0x19')](_0x87f211);}return _0x28a3eb[_0xef12('0x1a')](_0x87f211)[_0xef12('0x1b')]();};}function respondWithResult(_0x1f8231,_0x371c55){_0x371c55=_0x371c55||0xc8;return function(_0x145346){if(_0x145346){return _0x1f8231[_0xef12('0x1a')](_0x371c55)['json'](_0x145346);}};}function respondWithFilteredResult(_0x55451a,_0x5ce133){return function(_0x3b68b6){if(_0x3b68b6){var _0x4ba81c=_0x3b68b6[_0xef12('0x1c')],_0x460a32=_0x5ce133[_0xef12('0x1d')],_0x30f1dc=_0x5ce133[_0xef12('0x1d')]+_0x5ce133['limit'],_0x4b4a4d;if(_0x30f1dc>=_0x4ba81c){_0x30f1dc=_0x4ba81c;_0x4b4a4d=0xc8;}else{_0x4b4a4d=0xce;}_0x55451a[_0xef12('0x1a')](_0x4b4a4d);return _0x55451a['set'](_0xef12('0x1e'),_0x460a32+'-'+_0x30f1dc+'/'+_0x4ba81c)[_0xef12('0x1f')](_0x3b68b6);}return null;};}function patchUpdates(_0x2b6b42){return function(_0x36044b){try{jsonpatch['apply'](_0x36044b,_0x2b6b42,!![]);}catch(_0x45c378){return BPromise[_0xef12('0x20')](_0x45c378);}return _0x36044b[_0xef12('0x21')]();};}function saveUpdates(_0x876605,_0x505107){return function(_0x2e84b0){if(_0x2e84b0){return _0x2e84b0['update'](_0x876605)[_0xef12('0x22')](function(_0x1450c1){return _0x1450c1;});}return null;};}function removeEntity(_0x43d16f,_0x4b437d){return function(_0x12efcc){if(_0x12efcc){return _0x12efcc['destroy']()[_0xef12('0x22')](function(){var _0x22eee9=_0x12efcc[_0xef12('0x23')]({'plain':!![]});var _0xed137c=_0xef12('0x24');return db[_0xef12('0x25')][_0xef12('0x26')]({'where':{'type':_0xed137c,'resourceId':_0x22eee9['id']}})[_0xef12('0x22')](function(){return _0x12efcc;});})[_0xef12('0x22')](function(){_0x43d16f[_0xef12('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0550,_0x4e67c4){return function(_0xea05f0){if(!_0xea05f0){_0x4f0550[_0xef12('0x19')](0x194);}return _0xea05f0;};}function handleError(_0x5a98d9,_0x38d1f6){_0x38d1f6=_0x38d1f6||0x1f4;return function(_0x296498){logger[_0xef12('0x27')](_0x296498['stack']);if(_0x296498[_0xef12('0x28')]){delete _0x296498['name'];}_0x5a98d9[_0xef12('0x1a')](_0x38d1f6)[_0xef12('0x29')](_0x296498);};}exports[_0xef12('0x2a')]=function(_0x7886d1,_0xc52b75){var _0x516caf={},_0x2d46a1={},_0x2e5ba9={'count':0x0,'rows':[]};var _0x529d1e=_[_0xef12('0x2b')](db['UserWhatsappInteraction'][_0xef12('0x2c')],function(_0x188186){return{'name':_0x188186[_0xef12('0x2d')],'type':_0x188186[_0xef12('0x2e')][_0xef12('0x2f')]};});_0x2d46a1[_0xef12('0x30')]=_['map'](_0x529d1e,_0xef12('0x28'));_0x2d46a1['query']=_[_0xef12('0x31')](_0x7886d1[_0xef12('0x32')]);_0x2d46a1['filters']=_[_0xef12('0x33')](_0x2d46a1[_0xef12('0x30')],_0x2d46a1[_0xef12('0x32')]);_0x516caf[_0xef12('0x34')]=_[_0xef12('0x33')](_0x2d46a1[_0xef12('0x30')],qs['fields'](_0x7886d1[_0xef12('0x32')][_0xef12('0x35')]));_0x516caf['attributes']=_0x516caf[_0xef12('0x34')][_0xef12('0x36')]?_0x516caf[_0xef12('0x34')]:_0x2d46a1[_0xef12('0x30')];if(!_0x7886d1[_0xef12('0x32')]['hasOwnProperty']('nolimit')){_0x516caf[_0xef12('0x37')]=qs[_0xef12('0x37')](_0x7886d1['query'][_0xef12('0x37')]);_0x516caf[_0xef12('0x1d')]=qs[_0xef12('0x1d')](_0x7886d1[_0xef12('0x32')][_0xef12('0x1d')]);}_0x516caf['order']=qs[_0xef12('0x38')](_0x7886d1[_0xef12('0x32')]['sort']);_0x516caf[_0xef12('0x39')]=qs[_0xef12('0x3a')](_[_0xef12('0x3b')](_0x7886d1[_0xef12('0x32')],_0x2d46a1[_0xef12('0x3a')]),_0x529d1e);if(_0x7886d1[_0xef12('0x32')][_0xef12('0x3c')]){_0x516caf[_0xef12('0x39')]=_[_0xef12('0x3d')](_0x516caf[_0xef12('0x39')],{'$or':_[_0xef12('0x2b')](_0x529d1e,function(_0x2a8470){if(_0x2a8470['type']!==_0xef12('0x3e')){var _0x5522c5={};_0x5522c5[_0x2a8470['name']]={'$like':'%'+_0x7886d1['query'][_0xef12('0x3c')]+'%'};return _0x5522c5;}})});}_0x516caf=_[_0xef12('0x3d')]({},_0x516caf,_0x7886d1['options']);var _0x4bd17f={'where':_0x516caf[_0xef12('0x39')]};return db['UserWhatsappInteraction']['count'](_0x4bd17f)[_0xef12('0x22')](function(_0x34ea0e){_0x2e5ba9[_0xef12('0x1c')]=_0x34ea0e;if(_0x7886d1[_0xef12('0x32')]['includeAll']){_0x516caf[_0xef12('0x3f')]=[{'all':!![]}];}return db['UserWhatsappInteraction'][_0xef12('0x40')](_0x516caf);})['then'](function(_0x2c1cf9){_0x2e5ba9[_0xef12('0x41')]=_0x2c1cf9;return _0x2e5ba9;})['then'](respondWithFilteredResult(_0xc52b75,_0x516caf))[_0xef12('0x42')](handleError(_0xc52b75,null));};exports[_0xef12('0x43')]=function(_0x4b299d,_0x5ab3f8){var _0x17becc={'raw':!![],'where':{'id':_0x4b299d[_0xef12('0x44')]['id']}},_0x4e105d={};_0x4e105d[_0xef12('0x30')]=_[_0xef12('0x31')](db[_0xef12('0x45')]['rawAttributes']);_0x4e105d[_0xef12('0x32')]=_[_0xef12('0x31')](_0x4b299d[_0xef12('0x32')]);_0x4e105d[_0xef12('0x3a')]=_[_0xef12('0x33')](_0x4e105d[_0xef12('0x30')],_0x4e105d[_0xef12('0x32')]);_0x17becc['attributes']=_['intersection'](_0x4e105d[_0xef12('0x30')],qs[_0xef12('0x35')](_0x4b299d['query'][_0xef12('0x35')]));_0x17becc['attributes']=_0x17becc[_0xef12('0x34')]['length']?_0x17becc[_0xef12('0x34')]:_0x4e105d[_0xef12('0x30')];if(_0x4b299d['query'][_0xef12('0x46')]){_0x17becc['include']=[{'all':!![]}];}_0x17becc=_[_0xef12('0x3d')]({},_0x17becc,_0x4b299d[_0xef12('0x47')]);return db['UserWhatsappInteraction'][_0xef12('0x48')](_0x17becc)['then'](handleEntityNotFound(_0x5ab3f8,null))['then'](respondWithResult(_0x5ab3f8,null))[_0xef12('0x42')](handleError(_0x5ab3f8,null));};exports[_0xef12('0x49')]=function(_0x542735,_0x1e5c13){return db['UserWhatsappInteraction'][_0xef12('0x49')](_0x542735[_0xef12('0x4a')],{})[_0xef12('0x22')](function(_0x3012ab){var _0x2e5b34=_0x542735[_0xef12('0x4b')][_0xef12('0x23')]({'plain':!![]});if(!_0x2e5b34)throw new Error(_0xef12('0x4c'));if(_0x2e5b34[_0xef12('0x4d')]===_0xef12('0x4b')){var _0x510c3b=_0x3012ab['get']({'plain':!![]});var _0x2946f3=_0xef12('0x24');return db[_0xef12('0x4e')][_0xef12('0x48')]({'where':{'name':_0x2946f3,'userProfileId':_0x2e5b34[_0xef12('0x4f')]},'raw':!![]})[_0xef12('0x22')](function(_0x27d700){if(_0x27d700&&_0x27d700[_0xef12('0x50')]===0x0){return db['UserProfileResource'][_0xef12('0x49')]({'name':_0x510c3b[_0xef12('0x28')],'resourceId':_0x510c3b['id'],'type':_0x27d700[_0xef12('0x28')],'sectionId':_0x27d700['id']},{})[_0xef12('0x22')](function(){return _0x3012ab;});}else{return _0x3012ab;}})['catch'](function(_0x152a79){logger['error'](_0xef12('0x51'),_0x152a79);throw _0x152a79;});}return _0x3012ab;})['then'](respondWithResult(_0x1e5c13,0xc9))[_0xef12('0x42')](handleError(_0x1e5c13,null));};exports[_0xef12('0x52')]=function(_0x593f0e,_0x470d67){if(_0x593f0e[_0xef12('0x4a')]['id']){delete _0x593f0e['body']['id'];}return db[_0xef12('0x45')][_0xef12('0x48')]({'where':{'id':_0x593f0e[_0xef12('0x44')]['id']}})[_0xef12('0x22')](handleEntityNotFound(_0x470d67,null))['then'](saveUpdates(_0x593f0e[_0xef12('0x4a')],null))[_0xef12('0x22')](respondWithResult(_0x470d67,null))[_0xef12('0x42')](handleError(_0x470d67,null));};exports[_0xef12('0x26')]=function(_0xe4a8f,_0x327891){return db['UserWhatsappInteraction'][_0xef12('0x48')]({'where':{'id':_0xe4a8f[_0xef12('0x44')]['id']}})[_0xef12('0x22')](handleEntityNotFound(_0x327891,null))[_0xef12('0x22')](removeEntity(_0x327891,null))[_0xef12('0x42')](handleError(_0x327891,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 514c4ca..a649908 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 _0x8824=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0x8824,0xe0));var _0x4882=function(_0x55b735,_0xaee0a7){_0x55b735=_0x55b735-0x0;var _0x33931d=_0x8824[_0x55b735];return _0x33931d;};'use strict';var _=require(_0x4882('0x0'));var util=require(_0x4882('0x1'));var logger=require(_0x4882('0x2'))(_0x4882('0x3'));var moment=require(_0x4882('0x4'));var BPromise=require(_0x4882('0x5'));var rp=require(_0x4882('0x6'));var fs=require('fs');var path=require(_0x4882('0x7'));var rimraf=require(_0x4882('0x8'));var config=require(_0x4882('0x9'));var attributes=require(_0x4882('0xa'));module[_0x4882('0xb')]=function(_0x3a0d90,_0x30e4f3){return _0x3a0d90[_0x4882('0xc')](_0x4882('0xd'),attributes,{'tableName':_0x4882('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44b5=['../../config/environment','./UserWhatsappInteraction.attributes','define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x134d5d,_0x379731){var _0x2667ce=function(_0x138f78){while(--_0x138f78){_0x134d5d['push'](_0x134d5d['shift']());}};_0x2667ce(++_0x379731);}(_0x44b5,0xc8));var _0x544b=function(_0x47c148,_0x40c8b9){_0x47c148=_0x47c148-0x0;var _0x4414b6=_0x44b5[_0x47c148];return _0x4414b6;};'use strict';var _=require(_0x544b('0x0'));var util=require('util');var logger=require(_0x544b('0x1'))(_0x544b('0x2'));var moment=require(_0x544b('0x3'));var BPromise=require(_0x544b('0x4'));var rp=require(_0x544b('0x5'));var fs=require('fs');var path=require(_0x544b('0x6'));var rimraf=require(_0x544b('0x7'));var config=require(_0x544b('0x8'));var attributes=require(_0x544b('0x9'));module['exports']=function(_0x4cf2f9,_0x17eede){return _0x4cf2f9[_0x544b('0xa')](_0x544b('0xb'),attributes,{'tableName':_0x544b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js index 6eb8fdf..4e6479d 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 _0xbb63=['../../config/logger','rpc','../../config/environment','client','http','then','info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x1aab86,_0x46a993){var _0x549b72=function(_0x53a272){while(--_0x53a272){_0x1aab86['push'](_0x1aab86['shift']());}};_0x549b72(++_0x46a993);}(_0xbb63,0x119));var _0x3bb6=function(_0x1c4db2,_0x3cb299){_0x1c4db2=_0x1c4db2-0x0;var _0x2bbfd7=_0xbb63[_0x1c4db2];return _0x2bbfd7;};'use strict';var _=require(_0x3bb6('0x0'));var util=require('util');var moment=require(_0x3bb6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bb6('0x2'));var db=require(_0x3bb6('0x3'))['db'];var utils=require(_0x3bb6('0x4'));var logger=require(_0x3bb6('0x5'))(_0x3bb6('0x6'));var config=require(_0x3bb6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3bb6('0x8')][_0x3bb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1beb1d,_0x63cb2c,_0x2181ca){return new BPromise(function(_0x401aee,_0x5d39db){return client['request'](_0x1beb1d,_0x2181ca)[_0x3bb6('0xa')](function(_0x580b62){logger[_0x3bb6('0xb')](_0x3bb6('0xc'),_0x63cb2c,_0x3bb6('0xd'));logger[_0x3bb6('0xe')](_0x3bb6('0xf'),_0x63cb2c,'request\x20sent',JSON[_0x3bb6('0x10')](_0x580b62));if(_0x580b62[_0x3bb6('0x11')]){if(_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x12')]===0x1f4){logger['error']('UserWhatsappInteraction,\x20%s,\x20%s',_0x63cb2c,_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x13')]);return _0x5d39db(_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x13')]);}logger['error'](_0x3bb6('0xc'),_0x63cb2c,_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x13')]);return _0x401aee(_0x580b62[_0x3bb6('0x11')]['message']);}else{logger['info'](_0x3bb6('0xc'),_0x63cb2c,_0x3bb6('0xd'));_0x401aee(_0x580b62[_0x3bb6('0x14')]['message']);}})[_0x3bb6('0x15')](function(_0x3455ab){logger[_0x3bb6('0x11')](_0x3bb6('0xc'),_0x63cb2c,_0x3455ab);_0x5d39db(_0x3455ab);});});} \ No newline at end of file +var _0x268c=['UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4905e6,_0xf1295c){var _0x1f7655=function(_0xae0a7a){while(--_0xae0a7a){_0x4905e6['push'](_0x4905e6['shift']());}};_0x1f7655(++_0xf1295c);}(_0x268c,0xc0));var _0xc268=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x268c[_0x15dbca];return _0x326533;};'use strict';var _=require(_0xc268('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc268('0x1'));var rs=require(_0xc268('0x2'));var fs=require('fs');var Redis=require(_0xc268('0x3'));var db=require(_0xc268('0x4'))['db'];var utils=require(_0xc268('0x5'));var logger=require(_0xc268('0x6'))(_0xc268('0x7'));var config=require(_0xc268('0x8'));var jayson=require(_0xc268('0x9'));var client=jayson[_0xc268('0xa')][_0xc268('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x318d66,_0x5b2bdc,_0x1474b6){return new BPromise(function(_0x447137,_0x272ac2){return client[_0xc268('0xc')](_0x318d66,_0x1474b6)[_0xc268('0xd')](function(_0x2e2cd4){logger[_0xc268('0xe')](_0xc268('0xf'),_0x5b2bdc,_0xc268('0x10'));logger[_0xc268('0x11')](_0xc268('0x12'),_0x5b2bdc,_0xc268('0x10'),JSON[_0xc268('0x13')](_0x2e2cd4));if(_0x2e2cd4[_0xc268('0x14')]){if(_0x2e2cd4['error']['code']===0x1f4){logger[_0xc268('0x14')](_0xc268('0xf'),_0x5b2bdc,_0x2e2cd4[_0xc268('0x14')][_0xc268('0x15')]);return _0x272ac2(_0x2e2cd4[_0xc268('0x14')][_0xc268('0x15')]);}logger[_0xc268('0x14')](_0xc268('0xf'),_0x5b2bdc,_0x2e2cd4['error'][_0xc268('0x15')]);return _0x447137(_0x2e2cd4[_0xc268('0x14')][_0xc268('0x15')]);}else{logger[_0xc268('0xe')](_0xc268('0xf'),_0x5b2bdc,_0xc268('0x10'));_0x447137(_0x2e2cd4[_0xc268('0x16')][_0xc268('0x15')]);}})['catch'](function(_0x6485bc){logger[_0xc268('0x14')](_0xc268('0xf'),_0x5b2bdc,_0x6485bc);_0x272ac2(_0x6485bc);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index d3a2f91..f834155 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 _0xfa20=['./UserWhatsappInteraction.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb3b7e,_0x261956){var _0x448662=function(_0x485714){while(--_0x485714){_0xb3b7e['push'](_0xb3b7e['shift']());}};_0x448662(++_0x261956);}(_0xfa20,0x141));var _0x0fa2=function(_0x3d829d,_0x5af899){_0x3d829d=_0x3d829d-0x0;var _0x318701=_0xfa20[_0x3d829d];return _0x318701;};'use strict';var multer=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var path=require(_0x0fa2('0x2'));var timeout=require(_0x0fa2('0x3'));var express=require(_0x0fa2('0x4'));var router=express[_0x0fa2('0x5')]();var auth=require(_0x0fa2('0x6'));var interaction=require(_0x0fa2('0x7'));var config=require(_0x0fa2('0x8'));var controller=require(_0x0fa2('0x9'));router[_0x0fa2('0xa')]('/',auth['isAuthenticated'](),controller[_0x0fa2('0xb')]);router[_0x0fa2('0xa')]('/:id',auth[_0x0fa2('0xc')](),controller[_0x0fa2('0xd')]);router[_0x0fa2('0xe')]('/',auth[_0x0fa2('0xc')](),controller[_0x0fa2('0xf')]);router[_0x0fa2('0x10')](_0x0fa2('0x11'),auth[_0x0fa2('0xc')](),controller[_0x0fa2('0x12')]);router[_0x0fa2('0x13')]('/:id',auth[_0x0fa2('0xc')](),controller[_0x0fa2('0x14')]);module[_0x0fa2('0x15')]=router; \ No newline at end of file +var _0x3070=['get','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x12c32c,_0x13af3b){var _0x39b809=function(_0x278d4e){while(--_0x278d4e){_0x12c32c['push'](_0x12c32c['shift']());}};_0x39b809(++_0x13af3b);}(_0x3070,0x75));var _0x0307=function(_0x5d3cb2,_0x3f05d6){_0x5d3cb2=_0x5d3cb2-0x0;var _0x427ecf=_0x3070[_0x5d3cb2];return _0x427ecf;};'use strict';var multer=require('multer');var util=require(_0x0307('0x0'));var path=require('path');var timeout=require(_0x0307('0x1'));var express=require(_0x0307('0x2'));var router=express[_0x0307('0x3')]();var auth=require(_0x0307('0x4'));var interaction=require(_0x0307('0x5'));var config=require(_0x0307('0x6'));var controller=require('./UserWhatsappInteraction.controller');router['get']('/',auth[_0x0307('0x7')](),controller[_0x0307('0x8')]);router[_0x0307('0x9')](_0x0307('0xa'),auth['isAuthenticated'](),controller[_0x0307('0xb')]);router[_0x0307('0xc')]('/',auth['isAuthenticated'](),controller[_0x0307('0xd')]);router[_0x0307('0xe')](_0x0307('0xa'),auth[_0x0307('0x7')](),controller[_0x0307('0xf')]);router[_0x0307('0x10')](_0x0307('0xa'),auth[_0x0307('0x7')](),controller[_0x0307('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index aaf353f..d23dbd4 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 _0x76b2=['VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x76b2,0xcf));var _0x276b=function(_0x2a4265,_0x2e1d7c){_0x2a4265=_0x2a4265-0x0;var _0x2a1492=_0x76b2[_0x2a4265];return _0x2a1492;};'use strict';var Sequelize=require(_0x276b('0x0'));module['exports']={'name':{'type':Sequelize[_0x276b('0x1')],'get':function(_0x50bf3b){return this[_0x276b('0x2')]('action');}},'action':{'type':Sequelize[_0x276b('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x276b('0x4'),_0x276b('0x5'),_0x276b('0x6'),_0x276b('0x7'),_0x276b('0x8'),_0x276b('0x9'),_0x276b('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x276b('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x276b('0xc')},'data2':{'type':Sequelize[_0x276b('0x3')](0x1000),'comment':_0x276b('0xd')},'data3':{'type':Sequelize[_0x276b('0x3')](0x1000),'comment':_0x276b('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x276b('0x3')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x276b('0xf')]}}; \ No newline at end of file +var _0x722b=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','getDataValue','action','integration','motionbar','urlForward','browser','bot'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x722b,0x1d7));var _0xb722=function(_0x11e82c,_0x2ba53f){_0x11e82c=_0x11e82c-0x0;var _0x149db3=_0x722b[_0x11e82c];return _0x149db3;};'use strict';var Sequelize=require(_0xb722('0x0'));module[_0xb722('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x31a453){return this[_0xb722('0x2')](_0xb722('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xb722('0x4'),_0xb722('0x5'),'jscripty',_0xb722('0x6'),_0xb722('0x7'),_0xb722('0x8'),'script']],'msg':_0xb722('0x9')}},'comment':_0xb722('0x9')},'data1':{'type':Sequelize[_0xb722('0xa')](0x1000),'comment':_0xb722('0xb')},'data2':{'type':Sequelize[_0xb722('0xa')](0x1000),'comment':_0xb722('0xc')},'data3':{'type':Sequelize[_0xb722('0xa')](0x1000),'comment':_0xb722('0xd')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0xb722('0xa')](0x1000)},'data6':{'type':Sequelize[_0xb722('0xa')]},'data7':{'type':Sequelize[_0xb722('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 86c6307..c324ca7 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 _0xe7de=['name','send','body','find','catch','Action','params','html-pdf','eml-format','rimraf','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0xb9a1a2,_0x47681f){var _0x390542=function(_0x11205a){while(--_0x11205a){_0xb9a1a2['push'](_0xb9a1a2['shift']());}};_0x390542(++_0x47681f);}(_0xe7de,0x165));var _0xee7d=function(_0x4b589b,_0x1a1ee8){_0x4b589b=_0x4b589b-0x0;var _0x44f3fb=_0xe7de[_0x4b589b];return _0x44f3fb;};'use strict';var pdf=require(_0xee7d('0x0'));var emlformat=require(_0xee7d('0x1'));var rimraf=require(_0xee7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee7d('0x3'));var moment=require(_0xee7d('0x4'));var BPromise=require(_0xee7d('0x5'));var Mustache=require(_0xee7d('0x6'));var util=require(_0xee7d('0x7'));var path=require(_0xee7d('0x8'));var sox=require(_0xee7d('0x9'));var csv=require(_0xee7d('0xa'));var ejs=require(_0xee7d('0xb'));var fs=require('fs');var _=require(_0xee7d('0xc'));var squel=require(_0xee7d('0xd'));var crypto=require(_0xee7d('0xe'));var jsforce=require(_0xee7d('0xf'));var deskjs=require(_0xee7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee7d('0x11'));var Papa=require(_0xee7d('0x12'));var Redis=require(_0xee7d('0x13'));var authService=require(_0xee7d('0x14'));var qs=require(_0xee7d('0x15'));var as=require(_0xee7d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7d('0x17'))('api');var utils=require(_0xee7d('0x18'));var config=require(_0xee7d('0x19'));var licenseUtil=require(_0xee7d('0x1a'));var db=require(_0xee7d('0x1b'))['db'];function respondWithStatusCode(_0xdfb04b,_0xb4c933){_0xb4c933=_0xb4c933||0xcc;return function(_0x3e9daa){if(_0x3e9daa){return _0xdfb04b[_0xee7d('0x1c')](_0xb4c933);}return _0xdfb04b[_0xee7d('0x1d')](_0xb4c933)[_0xee7d('0x1e')]();};}function respondWithResult(_0x41ca24,_0x47eb16){_0x47eb16=_0x47eb16||0xc8;return function(_0x4bfdab){if(_0x4bfdab){return _0x41ca24[_0xee7d('0x1d')](_0x47eb16)[_0xee7d('0x1f')](_0x4bfdab);}};}function respondWithFilteredResult(_0x4ab8a6,_0x1211a1){return function(_0x1a2976){if(_0x1a2976){var _0x1dc47c=_0x1a2976[_0xee7d('0x20')],_0x5c40f8=_0x1211a1[_0xee7d('0x21')],_0x3f76e6=_0x1211a1[_0xee7d('0x21')]+_0x1211a1[_0xee7d('0x22')],_0x2bcd81;if(_0x3f76e6>=_0x1dc47c){_0x3f76e6=_0x1dc47c;_0x2bcd81=0xc8;}else{_0x2bcd81=0xce;}_0x4ab8a6['status'](_0x2bcd81);return _0x4ab8a6[_0xee7d('0x23')](_0xee7d('0x24'),_0x5c40f8+'-'+_0x3f76e6+'/'+_0x1dc47c)[_0xee7d('0x1f')](_0x1a2976);}return null;};}function patchUpdates(_0x597981){return function(_0x277738){try{jsonpatch['apply'](_0x277738,_0x597981,!![]);}catch(_0x1ef8ea){return BPromise[_0xee7d('0x25')](_0x1ef8ea);}return _0x277738[_0xee7d('0x26')]();};}function saveUpdates(_0x4f6445,_0x113a05){return function(_0x52b104){if(_0x52b104){return _0x52b104[_0xee7d('0x27')](_0x4f6445)[_0xee7d('0x28')](function(_0x269835){return _0x269835;});}return null;};}function removeEntity(_0xed4f9f,_0x52eaf4){return function(_0x32ad6e){if(_0x32ad6e){return _0x32ad6e[_0xee7d('0x29')]()[_0xee7d('0x28')](function(){_0xed4f9f[_0xee7d('0x1d')](0xcc)[_0xee7d('0x1e')]();});}};}function handleEntityNotFound(_0x4d0efb,_0x172850){return function(_0x34af16){if(!_0x34af16){_0x4d0efb[_0xee7d('0x1c')](0x194);}return _0x34af16;};}function handleError(_0x56a680,_0x1a2fe5){_0x1a2fe5=_0x1a2fe5||0x1f4;return function(_0x293382){logger[_0xee7d('0x2a')](_0x293382['stack']);if(_0x293382[_0xee7d('0x2b')]){delete _0x293382[_0xee7d('0x2b')];}_0x56a680[_0xee7d('0x1d')](_0x1a2fe5)[_0xee7d('0x2c')](_0x293382);};}exports[_0xee7d('0x27')]=function(_0x1b4492,_0xb727c9){if(_0x1b4492[_0xee7d('0x2d')]['id']){delete _0x1b4492[_0xee7d('0x2d')]['id'];}return db['Action'][_0xee7d('0x2e')]({'where':{'id':_0x1b4492['params']['id']}})['then'](handleEntityNotFound(_0xb727c9,null))[_0xee7d('0x28')](saveUpdates(_0x1b4492['body'],null))[_0xee7d('0x28')](respondWithResult(_0xb727c9,null))[_0xee7d('0x2f')](handleError(_0xb727c9,null));};exports['destroy']=function(_0x6b6174,_0x1d1990){return db[_0xee7d('0x30')][_0xee7d('0x2e')]({'where':{'id':_0x6b6174[_0xee7d('0x31')]['id']}})['then'](handleEntityNotFound(_0x1d1990,null))[_0xee7d('0x28')](removeEntity(_0x1d1990,null))[_0xee7d('0x2f')](handleError(_0x1d1990,null));}; \ No newline at end of file +var _0xe451=['stack','name','send','body','Action','params','find','catch','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','Content-Range','update','destroy','then','sendStatus','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe451,0xec));var _0x1e45=function(_0x59601c,_0xb1c237){_0x59601c=_0x59601c-0x0;var _0x510ec2=_0xe451[_0x59601c];return _0x510ec2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1e45('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e45('0x1'));var BPromise=require(_0x1e45('0x2'));var Mustache=require(_0x1e45('0x3'));var util=require(_0x1e45('0x4'));var path=require('path');var sox=require(_0x1e45('0x5'));var csv=require(_0x1e45('0x6'));var ejs=require(_0x1e45('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e45('0x8'));var crypto=require(_0x1e45('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e45('0x6'));var querystring=require(_0x1e45('0xa'));var Papa=require(_0x1e45('0xb'));var Redis=require('ioredis');var authService=require(_0x1e45('0xc'));var qs=require(_0x1e45('0xd'));var as=require(_0x1e45('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e45('0xf'));var utils=require(_0x1e45('0x10'));var config=require(_0x1e45('0x11'));var licenseUtil=require(_0x1e45('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cafc,_0x2ec564){_0x2ec564=_0x2ec564||0xcc;return function(_0x3d25a8){if(_0x3d25a8){return _0x16cafc['sendStatus'](_0x2ec564);}return _0x16cafc[_0x1e45('0x13')](_0x2ec564)[_0x1e45('0x14')]();};}function respondWithResult(_0x31215a,_0x21f68d){_0x21f68d=_0x21f68d||0xc8;return function(_0x5b3ee1){if(_0x5b3ee1){return _0x31215a[_0x1e45('0x13')](_0x21f68d)['json'](_0x5b3ee1);}};}function respondWithFilteredResult(_0xf66042,_0x2c7ace){return function(_0x4e1400){if(_0x4e1400){var _0xfdeae3=_0x4e1400[_0x1e45('0x15')],_0x258249=_0x2c7ace[_0x1e45('0x16')],_0x3d8420=_0x2c7ace[_0x1e45('0x16')]+_0x2c7ace[_0x1e45('0x17')],_0x1e5b73;if(_0x3d8420>=_0xfdeae3){_0x3d8420=_0xfdeae3;_0x1e5b73=0xc8;}else{_0x1e5b73=0xce;}_0xf66042[_0x1e45('0x13')](_0x1e5b73);return _0xf66042['set'](_0x1e45('0x18'),_0x258249+'-'+_0x3d8420+'/'+_0xfdeae3)['json'](_0x4e1400);}return null;};}function patchUpdates(_0x5129aa){return function(_0x17c63a){try{jsonpatch['apply'](_0x17c63a,_0x5129aa,!![]);}catch(_0x4e949d){return BPromise['reject'](_0x4e949d);}return _0x17c63a['save']();};}function saveUpdates(_0x207335,_0x4476eb){return function(_0x4a641c){if(_0x4a641c){return _0x4a641c[_0x1e45('0x19')](_0x207335)['then'](function(_0x4bb0d8){return _0x4bb0d8;});}return null;};}function removeEntity(_0x41cfae,_0x59aaa7){return function(_0x4ffe97){if(_0x4ffe97){return _0x4ffe97[_0x1e45('0x1a')]()[_0x1e45('0x1b')](function(){_0x41cfae['status'](0xcc)[_0x1e45('0x14')]();});}};}function handleEntityNotFound(_0x2fb478,_0x40c216){return function(_0x2d3b49){if(!_0x2d3b49){_0x2fb478[_0x1e45('0x1c')](0x194);}return _0x2d3b49;};}function handleError(_0x3dc1c0,_0x39284e){_0x39284e=_0x39284e||0x1f4;return function(_0x55e968){logger[_0x1e45('0x1d')](_0x55e968[_0x1e45('0x1e')]);if(_0x55e968[_0x1e45('0x1f')]){delete _0x55e968[_0x1e45('0x1f')];}_0x3dc1c0[_0x1e45('0x13')](_0x39284e)[_0x1e45('0x20')](_0x55e968);};}exports[_0x1e45('0x19')]=function(_0x587f3f,_0x2dd79e){if(_0x587f3f[_0x1e45('0x21')]['id']){delete _0x587f3f[_0x1e45('0x21')]['id'];}return db[_0x1e45('0x22')]['find']({'where':{'id':_0x587f3f[_0x1e45('0x23')]['id']}})[_0x1e45('0x1b')](handleEntityNotFound(_0x2dd79e,null))[_0x1e45('0x1b')](saveUpdates(_0x587f3f['body'],null))[_0x1e45('0x1b')](respondWithResult(_0x2dd79e,null))['catch'](handleError(_0x2dd79e,null));};exports[_0x1e45('0x1a')]=function(_0x55a329,_0x53c4e0){return db[_0x1e45('0x22')][_0x1e45('0x24')]({'where':{'id':_0x55a329[_0x1e45('0x23')]['id']}})[_0x1e45('0x1b')](handleEntityNotFound(_0x53c4e0,null))['then'](removeEntity(_0x53c4e0,null))[_0x1e45('0x25')](handleError(_0x53c4e0,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5526b8b..72857c7 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 _0x0d48=['exports','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./action.attributes'];(function(_0x122cfb,_0x2d1b8a){var _0x1f0dc2=function(_0x171d0d){while(--_0x171d0d){_0x122cfb['push'](_0x122cfb['shift']());}};_0x1f0dc2(++_0x2d1b8a);}(_0x0d48,0x18d));var _0x80d4=function(_0x22b9b7,_0x203492){_0x22b9b7=_0x22b9b7-0x0;var _0xbd7673=_0x0d48[_0x22b9b7];return _0xbd7673;};'use strict';var _=require(_0x80d4('0x0'));var util=require(_0x80d4('0x1'));var logger=require(_0x80d4('0x2'))('api');var moment=require(_0x80d4('0x3'));var BPromise=require(_0x80d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80d4('0x5'));var rimraf=require(_0x80d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x80d4('0x7'));module[_0x80d4('0x8')]=function(_0x18f377,_0x11caa8){return _0x18f377['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f0b=['./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x280913,_0x54bc18){var _0x4cb874=function(_0x58d09a){while(--_0x58d09a){_0x280913['push'](_0x280913['shift']());}};_0x4cb874(++_0x54bc18);}(_0x5f0b,0xa0));var _0xb5f0=function(_0x99b94a,_0x5640eb){_0x99b94a=_0x99b94a-0x0;var _0x4886ed=_0x5f0b[_0x99b94a];return _0x4886ed;};'use strict';var _=require(_0xb5f0('0x0'));var util=require(_0xb5f0('0x1'));var logger=require(_0xb5f0('0x2'))(_0xb5f0('0x3'));var moment=require(_0xb5f0('0x4'));var BPromise=require(_0xb5f0('0x5'));var rp=require(_0xb5f0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb5f0('0x7'));var attributes=require(_0xb5f0('0x8'));module[_0xb5f0('0x9')]=function(_0x12bc9a,_0xac298c){return _0x12bc9a[_0xb5f0('0xa')]('Action',attributes,{'tableName':_0xb5f0('0xb'),'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 f444d65..ec699f3 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 _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(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x46971f,_0x1f035a){var _0x1aec96=function(_0x151f0d){while(--_0x151f0d){_0x46971f['push'](_0x46971f['shift']());}};_0x1aec96(++_0x1f035a);}(_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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 255bd59..fa1e2bb 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 _0x4b08=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','multer','util'];(function(_0x5e2d0b,_0xc52482){var _0x3d84d9=function(_0x2e326e){while(--_0x2e326e){_0x5e2d0b['push'](_0x5e2d0b['shift']());}};_0x3d84d9(++_0xc52482);}(_0x4b08,0x112));var _0x84b0=function(_0x9068a1,_0x1db890){_0x9068a1=_0x9068a1-0x0;var _0xa396b8=_0x4b08[_0x9068a1];return _0xa396b8;};'use strict';var multer=require(_0x84b0('0x0'));var util=require(_0x84b0('0x1'));var path=require(_0x84b0('0x2'));var timeout=require(_0x84b0('0x3'));var express=require(_0x84b0('0x4'));var router=express['Router']();var auth=require(_0x84b0('0x5'));var interaction=require(_0x84b0('0x6'));var config=require(_0x84b0('0x7'));var controller=require('./action.controller');router[_0x84b0('0x8')]('/:id',auth[_0x84b0('0x9')](),controller[_0x84b0('0xa')]);router[_0x84b0('0xb')]('/:id',auth[_0x84b0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf419=['../../components/interaction/service','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0xf419,0x11f));var _0x9f41=function(_0x148f4a,_0x30d172){_0x148f4a=_0x148f4a-0x0;var _0xb0d85f=_0xf419[_0x148f4a];return _0xb0d85f;};'use strict';var multer=require(_0x9f41('0x0'));var util=require(_0x9f41('0x1'));var path=require(_0x9f41('0x2'));var timeout=require(_0x9f41('0x3'));var express=require(_0x9f41('0x4'));var router=express[_0x9f41('0x5')]();var auth=require(_0x9f41('0x6'));var interaction=require(_0x9f41('0x7'));var config=require('../../config/environment');var controller=require('./action.controller');router['put'](_0x9f41('0x8'),auth[_0x9f41('0x9')](),controller[_0x9f41('0xa')]);router[_0x9f41('0xb')](_0x9f41('0x8'),auth['isAuthenticated'](),controller[_0x9f41('0xc')]);module[_0x9f41('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index f3f89eb..2524ca4 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 _0x72a9=['STRING','TEXT','sequelize'];(function(_0x40c488,_0x5abea5){var _0x526b6=function(_0x162552){while(--_0x162552){_0x40c488['push'](_0x40c488['shift']());}};_0x526b6(++_0x5abea5);}(_0x72a9,0x113));var _0x972a=function(_0x10c8ed,_0x321b59){_0x10c8ed=_0x10c8ed-0x0;var _0x2dbe22=_0x72a9[_0x10c8ed];return _0x2dbe22;};'use strict';var Sequelize=require(_0x972a('0x0'));module['exports']={'name':{'type':Sequelize[_0x972a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x972a('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x972a('0x2')]},'joins':{'type':Sequelize[_0x972a('0x2')]}}; \ No newline at end of file +var _0x6b5b=['TEXT','exports','STRING'];(function(_0x48eb63,_0x1e84ee){var _0x427b3d=function(_0x5f326d){while(--_0x5f326d){_0x48eb63['push'](_0x48eb63['shift']());}};_0x427b3d(++_0x1e84ee);}(_0x6b5b,0x1c0));var _0xb6b5=function(_0xe179ee,_0x2c7d47){_0xe179ee=_0xe179ee-0x0;var _0x24570e=_0x6b5b[_0xe179ee];return _0x24570e;};'use strict';var Sequelize=require('sequelize');module[_0xb6b5('0x0')]={'name':{'type':Sequelize[_0xb6b5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb6b5('0x1')]},'parent':{'type':Sequelize[_0xb6b5('0x1')]},'table':{'type':Sequelize[_0xb6b5('0x1')]},'conditions':{'type':Sequelize[_0xb6b5('0x2')]},'joins':{'type':Sequelize[_0xb6b5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c6f39b8..081d910 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 _0x0b99=['group','field','condition','value','getFields','ValidationErrorItem','findAll','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','DATE(%s)','AnalyticMetric','groupBy','parse','sequelize','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','rows','catch','show','params','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0x0b99,0xec));var _0x90b9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0b99[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x90b9('0x0'));var zipdir=require(_0x90b9('0x1'));var jsonpatch=require(_0x90b9('0x2'));var rp=require(_0x90b9('0x3'));var moment=require(_0x90b9('0x4'));var BPromise=require(_0x90b9('0x5'));var Mustache=require(_0x90b9('0x6'));var util=require(_0x90b9('0x7'));var path=require(_0x90b9('0x8'));var sox=require(_0x90b9('0x9'));var csv=require('to-csv');var ejs=require(_0x90b9('0xa'));var fs=require('fs');var _=require(_0x90b9('0xb'));var squel=require(_0x90b9('0xc'));var crypto=require(_0x90b9('0xd'));var jsforce=require(_0x90b9('0xe'));var deskjs=require(_0x90b9('0xf'));var toCsv=require(_0x90b9('0x10'));var querystring=require(_0x90b9('0x11'));var Papa=require(_0x90b9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x90b9('0x13'));var as=require(_0x90b9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90b9('0x15'));var utils=require(_0x90b9('0x16'));var config=require(_0x90b9('0x17'));var licenseUtil=require(_0x90b9('0x18'));var db=require(_0x90b9('0x19'))['db'];var dbH=require(_0x90b9('0x19'))[_0x90b9('0x1a')];function respondWithStatusCode(_0x5e7dcc,_0x33cbc7){_0x33cbc7=_0x33cbc7||0xcc;return function(_0x441e86){if(_0x441e86){return _0x5e7dcc[_0x90b9('0x1b')](_0x33cbc7);}return _0x5e7dcc[_0x90b9('0x1c')](_0x33cbc7)['end']();};}function respondWithResult(_0x51f30b,_0x2acee6){_0x2acee6=_0x2acee6||0xc8;return function(_0x53e18c){if(_0x53e18c){return _0x51f30b[_0x90b9('0x1c')](_0x2acee6)[_0x90b9('0x1d')](_0x53e18c);}};}function respondWithFilteredResult(_0x2eb656,_0x37d5f0){return function(_0x26a9e4){if(_0x26a9e4){var _0x12a0a5=_0x26a9e4[_0x90b9('0x1e')],_0x3faac5=_0x37d5f0[_0x90b9('0x1f')],_0xefcce4=_0x37d5f0[_0x90b9('0x1f')]+_0x37d5f0[_0x90b9('0x20')],_0x29b1fc;if(_0xefcce4>=_0x12a0a5){_0xefcce4=_0x12a0a5;_0x29b1fc=0xc8;}else{_0x29b1fc=0xce;}_0x2eb656[_0x90b9('0x1c')](_0x29b1fc);return _0x2eb656['set'](_0x90b9('0x21'),_0x3faac5+'-'+_0xefcce4+'/'+_0x12a0a5)[_0x90b9('0x1d')](_0x26a9e4);}return null;};}function patchUpdates(_0x39b8bd){return function(_0xecea63){try{jsonpatch[_0x90b9('0x22')](_0xecea63,_0x39b8bd,!![]);}catch(_0x420880){return BPromise[_0x90b9('0x23')](_0x420880);}return _0xecea63[_0x90b9('0x24')]();};}function saveUpdates(_0x98e59e,_0x5d75ce){return function(_0x5679f7){if(_0x5679f7){return _0x5679f7[_0x90b9('0x25')](_0x98e59e)[_0x90b9('0x26')](function(_0x26d7db){return _0x26d7db;});}return null;};}function removeEntity(_0x3b30c9,_0x491303){return function(_0x52bdde){if(_0x52bdde){return _0x52bdde[_0x90b9('0x27')]()['then'](function(){var _0x5f3760=_0x52bdde['get']({'plain':!![]});var _0x299c20=_0x90b9('0x28');return db[_0x90b9('0x29')]['destroy']({'where':{'type':_0x299c20,'resourceId':_0x5f3760['id']}})['then'](function(){return _0x52bdde;});})['then'](function(){_0x3b30c9[_0x90b9('0x1c')](0xcc)[_0x90b9('0x2a')]();});}};}function handleEntityNotFound(_0x3a0061,_0x38fcc2){return function(_0x3a99e6){if(!_0x3a99e6){_0x3a0061['sendStatus'](0x194);}return _0x3a99e6;};}function handleError(_0x18fe5a,_0x4ef0b9){_0x4ef0b9=_0x4ef0b9||0x1f4;return function(_0x4232eb){logger[_0x90b9('0x2b')](_0x4232eb[_0x90b9('0x2c')]);if(_0x4232eb['name']){delete _0x4232eb[_0x90b9('0x2d')];}_0x18fe5a['status'](_0x4ef0b9)[_0x90b9('0x2e')](_0x4232eb);};}exports[_0x90b9('0x2f')]=function(_0x162859,_0x88a7f5){var _0x5becd0={},_0x555d48={},_0x484192={'count':0x0,'rows':[]};var _0x43f6e0=_[_0x90b9('0x30')](db[_0x90b9('0x31')][_0x90b9('0x32')],function(_0x4690d8){return{'name':_0x4690d8[_0x90b9('0x33')],'type':_0x4690d8[_0x90b9('0x34')]['key']};});_0x555d48[_0x90b9('0x35')]=_[_0x90b9('0x30')](_0x43f6e0,'name');_0x555d48[_0x90b9('0x36')]=_[_0x90b9('0x37')](_0x162859[_0x90b9('0x36')]);_0x555d48['filters']=_[_0x90b9('0x38')](_0x555d48['model'],_0x555d48[_0x90b9('0x36')]);_0x5becd0[_0x90b9('0x39')]=_[_0x90b9('0x38')](_0x555d48['model'],qs[_0x90b9('0x3a')](_0x162859[_0x90b9('0x36')]['fields']));_0x5becd0[_0x90b9('0x39')]=_0x5becd0[_0x90b9('0x39')][_0x90b9('0x3b')]?_0x5becd0[_0x90b9('0x39')]:_0x555d48['model'];if(!_0x162859['query'][_0x90b9('0x3c')](_0x90b9('0x3d'))){_0x5becd0[_0x90b9('0x20')]=qs[_0x90b9('0x20')](_0x162859[_0x90b9('0x36')][_0x90b9('0x20')]);_0x5becd0['offset']=qs['offset'](_0x162859[_0x90b9('0x36')][_0x90b9('0x1f')]);}_0x5becd0['order']=qs[_0x90b9('0x3e')](_0x162859['query']['sort']);_0x5becd0['where']=qs[_0x90b9('0x3f')](_[_0x90b9('0x40')](_0x162859[_0x90b9('0x36')],_0x555d48[_0x90b9('0x3f')]),_0x43f6e0);if(_0x162859[_0x90b9('0x36')][_0x90b9('0x41')]){_0x5becd0[_0x90b9('0x42')]=_[_0x90b9('0x43')](_0x5becd0[_0x90b9('0x42')],{'$or':_[_0x90b9('0x30')](_0x43f6e0,function(_0xb5db1){if(_0xb5db1[_0x90b9('0x34')]!=='VIRTUAL'){var _0x2e607b={};_0x2e607b[_0xb5db1[_0x90b9('0x2d')]]={'$like':'%'+_0x162859['query'][_0x90b9('0x41')]+'%'};return _0x2e607b;}})});}_0x5becd0=_[_0x90b9('0x43')]({},_0x5becd0,_0x162859[_0x90b9('0x44')]);var _0x463daf={'where':_0x5becd0[_0x90b9('0x42')]};return db[_0x90b9('0x31')]['count'](_0x463daf)[_0x90b9('0x26')](function(_0x5398a1){_0x484192[_0x90b9('0x1e')]=_0x5398a1;if(_0x162859['query'][_0x90b9('0x45')]){_0x5becd0['include']=[{'all':!![]}];}return db[_0x90b9('0x31')]['findAll'](_0x5becd0);})[_0x90b9('0x26')](function(_0x1ff64d){_0x484192[_0x90b9('0x46')]=_0x1ff64d;return _0x484192;})[_0x90b9('0x26')](respondWithFilteredResult(_0x88a7f5,_0x5becd0))[_0x90b9('0x47')](handleError(_0x88a7f5,null));};exports[_0x90b9('0x48')]=function(_0x9144bd,_0x21f3fd){var _0x21268b={'raw':![],'where':{'id':_0x9144bd[_0x90b9('0x49')]['id']}},_0x2ac3ed={};_0x2ac3ed[_0x90b9('0x35')]=_[_0x90b9('0x37')](db['AnalyticCustomReport']['rawAttributes']);_0x2ac3ed['query']=_[_0x90b9('0x37')](_0x9144bd[_0x90b9('0x36')]);_0x2ac3ed['filters']=_[_0x90b9('0x38')](_0x2ac3ed[_0x90b9('0x35')],_0x2ac3ed[_0x90b9('0x36')]);_0x21268b['attributes']=_[_0x90b9('0x38')](_0x2ac3ed[_0x90b9('0x35')],qs[_0x90b9('0x3a')](_0x9144bd[_0x90b9('0x36')]['fields']));_0x21268b[_0x90b9('0x39')]=_0x21268b[_0x90b9('0x39')]['length']?_0x21268b[_0x90b9('0x39')]:_0x2ac3ed['model'];if(_0x9144bd[_0x90b9('0x36')][_0x90b9('0x45')]){_0x21268b[_0x90b9('0x4a')]=[{'all':!![]}];}_0x21268b=_['merge']({},_0x21268b,_0x9144bd[_0x90b9('0x44')]);return db[_0x90b9('0x31')]['find'](_0x21268b)['then'](handleEntityNotFound(_0x21f3fd,null))['then'](respondWithResult(_0x21f3fd,null))[_0x90b9('0x47')](handleError(_0x21f3fd,null));};exports[_0x90b9('0x4b')]=function(_0x5215b3,_0x10187f){return db[_0x90b9('0x31')]['create'](_0x5215b3['body'],{})[_0x90b9('0x26')](function(_0x122e7d){var _0xb4682=_0x5215b3['user'][_0x90b9('0x4c')]({'plain':!![]});if(!_0xb4682)throw new Error(_0x90b9('0x4d'));if(_0xb4682[_0x90b9('0x4e')]===_0x90b9('0x4f')){var _0x356702=_0x122e7d[_0x90b9('0x4c')]({'plain':!![]});var _0x406ede=_0x90b9('0x50');return db[_0x90b9('0x51')]['find']({'where':{'name':_0x406ede,'userProfileId':_0xb4682[_0x90b9('0x52')]},'raw':!![]})[_0x90b9('0x26')](function(_0x1138f3){if(_0x1138f3&&_0x1138f3[_0x90b9('0x53')]===0x0){return db[_0x90b9('0x29')][_0x90b9('0x4b')]({'name':_0x356702[_0x90b9('0x2d')],'resourceId':_0x356702['id'],'type':_0x90b9('0x28'),'sectionId':_0x1138f3['id']},{})[_0x90b9('0x26')](function(){return _0x122e7d;});}else{return _0x122e7d;}})[_0x90b9('0x47')](function(_0x22eb61){logger['error'](_0x90b9('0x54'),_0x22eb61);throw _0x22eb61;});}return _0x122e7d;})['then'](respondWithResult(_0x10187f,0xc9))[_0x90b9('0x47')](handleError(_0x10187f,null));};exports['update']=function(_0x4ee2a2,_0x5714db){if(_0x4ee2a2[_0x90b9('0x55')]['id']){delete _0x4ee2a2[_0x90b9('0x55')]['id'];}return db[_0x90b9('0x31')][_0x90b9('0x56')]({'where':{'id':_0x4ee2a2[_0x90b9('0x49')]['id']}})[_0x90b9('0x26')](handleEntityNotFound(_0x5714db,null))[_0x90b9('0x26')](saveUpdates(_0x4ee2a2[_0x90b9('0x55')],null))[_0x90b9('0x26')](respondWithResult(_0x5714db,null))[_0x90b9('0x47')](handleError(_0x5714db,null));};exports['destroy']=function(_0x46682e,_0x2fb1a4){return db[_0x90b9('0x31')]['find']({'where':{'id':_0x46682e[_0x90b9('0x49')]['id']}})[_0x90b9('0x26')](handleEntityNotFound(_0x2fb1a4,null))['then'](removeEntity(_0x2fb1a4,null))['catch'](handleError(_0x2fb1a4,null));};exports[_0x90b9('0x57')]=function(_0x344a4e,_0x9bac75){var _0x548477=0xa;var _0xb53dbd=[_0x90b9('0x58'),_0x90b9('0x59'),_0x90b9('0x5a'),_0x90b9('0x5b')];var _0x46242a={'SUM':_0x90b9('0x5c'),'COUNT':_0x90b9('0x5d'),'COUNT DISTINCT':_0x90b9('0x5e'),'MAX':_0x90b9('0x5f'),'MIN':_0x90b9('0x60'),'AVG':_0x90b9('0x61'),'GROUP_CONCAT':_0x90b9('0x62'),'GROUP_CONCAT ASC':_0x90b9('0x63'),'GROUP_CONCAT DESC':_0x90b9('0x64')};var _0x2bce79={'SEC_TO_TIME':_0x90b9('0x65'),'DATE':'DATE(%s)','HOUR':_0x90b9('0x66'),'ROUND':_0x90b9('0x67'),'UNIX_TIMESTAMP':_0x90b9('0x68')};var _0x429568=function(_0x40eab1){return!_[_0x90b9('0x69')]([_0x90b9('0x6a'),_0x90b9('0x6b'),_0x90b9('0x6c'),_0x90b9('0x6d')],_0x40eab1);};var _0x36a6b5=function(_0x5f4ac4){if(!_0x5f4ac4||!_0x5f4ac4[_0x90b9('0x6e')][_0x90b9('0x3b')]){return'';}for(var _0x3c4dce='(',_0x31812f=0x0;_0x31812f<_0x5f4ac4[_0x90b9('0x6e')][_0x90b9('0x3b')];_0x31812f+=0x1){_0x31812f>0x0&&(_0x3c4dce+='\x20'+_0x5f4ac4[_0x90b9('0x6f')]+'\x20');_0x3c4dce+=_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x70')]?_0x36a6b5(_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x70')]):_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x71')]+'\x20'+_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x72')]+(_0x429568(_0x5f4ac4['rules'][_0x31812f][_0x90b9('0x72')])?'\x20'+_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x73')]:'');}return _0x3c4dce+')';};var _0x257244={'where':{'id':_0x344a4e['params']['id']}},_0x31ff9e,_0x33542b,_0x22e02b,_0x3c6458,_0x363f07;_0x257244=_[_0x90b9('0x43')]({},_0x257244,_0x344a4e[_0x90b9('0x44')]);return db['AnalyticCustomReport'][_0x90b9('0x56')](_0x257244)[_0x90b9('0x26')](function(_0x73f464){if(_0x73f464){_0x31ff9e=_0x73f464;return _0x73f464[_0x90b9('0x74')]();}return null;})[_0x90b9('0x26')](function(_0xea473f){if(_0xea473f){if(!_0xea473f[_0x90b9('0x3b')]){throw new db['Sequelize'][(_0x90b9('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x33542b=_0xea473f;return db['AnalyticMetric'][_0x90b9('0x76')]({'raw':!![]});}return null;})[_0x90b9('0x26')](function(_0x1c1280){if(_0x1c1280){_0x22e02b=_['keyBy'](_0x1c1280,'id');var _0x1037ad;var _0x40db25=squel[_0x90b9('0x77')]();_0x40db25[_0x90b9('0x78')](_0x31ff9e[_0x90b9('0x79')]);for(var _0x367529=0x0;_0x367529<_0x33542b['length'];_0x367529+=0x1){_0x1037ad=_0x33542b[_0x367529][_0x90b9('0x7a')]?_0x22e02b[_0x33542b[_0x367529][_0x90b9('0x7a')]][_0x90b9('0x7b')]:_0x33542b[_0x367529][_0x90b9('0x71')];_0x1037ad=_0x33542b[_0x367529][_0x90b9('0x7c')]?_[_0x90b9('0x7d')](_0x46242a[_0x33542b[_0x367529][_0x90b9('0x7c')]],'%s',_0x1037ad):_0x1037ad;_0x1037ad=_0x33542b[_0x367529]['format']?_[_0x90b9('0x7d')](_0x2bce79[_0x33542b[_0x367529][_0x90b9('0x7e')]],'%s',_0x1037ad):_0x1037ad;if(_0x33542b[_0x367529]['groupBy']){_0x40db25['group'](_0x1037ad);}_0x33542b[_0x367529][_0x90b9('0x7f')]&&_0x40db25[_0x90b9('0x80')](_0x1037ad,_0x33542b[_0x367529]['orderBy']===_0x90b9('0x81')?![]:!![]);_0x40db25[_0x90b9('0x71')](_0x1037ad,_0x33542b[_0x367529][_0x90b9('0x82')]||_0x1037ad);}if(_0x31ff9e[_0x90b9('0x83')]){_0x31ff9e[_0x90b9('0x83')]=JSON['parse'](_0x31ff9e[_0x90b9('0x83')]);for(var _0x56b55e=0x0;_0x56b55e<_0x31ff9e[_0x90b9('0x83')][_0x90b9('0x3b')];_0x56b55e+=0x1){if(_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x34')]&&_[_0x90b9('0x69')](_0xb53dbd,_0x31ff9e['joins'][_0x56b55e][_0x90b9('0x34')])&&_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x84')]&&_0x31ff9e['joins'][_0x56b55e][_0x90b9('0x85')]&&_0x31ff9e[_0x90b9('0x83')][_0x56b55e]['foreignKey']){_0x40db25[_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x34')]](_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x85')],null,util[_0x90b9('0x7e')](_0x90b9('0x86'),_0x31ff9e[_0x90b9('0x79')],_0x31ff9e[_0x90b9('0x83')][_0x56b55e]['parentKey'],_0x31ff9e['joins'][_0x56b55e][_0x90b9('0x85')],_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x87')]));}}}if(_0x31ff9e[_0x90b9('0x88')]){_0x31ff9e[_0x90b9('0x88')]=JSON['parse'](_0x31ff9e[_0x90b9('0x88')]);_0x40db25[_0x90b9('0x42')](_0x36a6b5(_0x31ff9e[_0x90b9('0x88')]['group']));}_0x363f07=_0x40db25[_0x90b9('0x89')]();_0x40db25['limit'](_0x548477);_0x40db25['offset'](0x0);logger[_0x90b9('0x8a')](_0x90b9('0x8b'),_0x40db25[_0x90b9('0x8c')]());return db['sequelize'][_0x90b9('0x36')](_0x40db25[_0x90b9('0x8c')](),{'type':db['sequelize'][_0x90b9('0x8d')]['SELECT']});}})['then'](respondWithResult(_0x9bac75,null))['catch'](handleError(_0x9bac75,null));};function runReport(_0x44bcb2,_0x27affa,_0x518875){var _0x15b6bf=_0x27affa[_0x90b9('0x2d')];var _0x37a3a2=0xa;var _0x433a06=[_0x90b9('0x58'),_0x90b9('0x59'),_0x90b9('0x5a'),_0x90b9('0x5b')];var _0x5f1883={'SUM':'SUM(%s)','COUNT':_0x90b9('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x90b9('0x5f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x90b9('0x62'),'GROUP_CONCAT ASC':_0x90b9('0x63'),'GROUP_CONCAT DESC':_0x90b9('0x64')};var _0x254a29={'SEC_TO_TIME':_0x90b9('0x65'),'DATE':_0x90b9('0x8e'),'HOUR':_0x90b9('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x90b9('0x68')};var _0x3e2257=function(_0xb6f3af){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x90b9('0x6c'),_0x90b9('0x6d')],_0xb6f3af);};var _0x3a2787=function(_0xedd2ab){if(!_0xedd2ab||!_0xedd2ab[_0x90b9('0x6e')][_0x90b9('0x3b')]){return'';}for(var _0x23f119='(',_0x1d7b4b=0x0;_0x1d7b4b<_0xedd2ab['rules'][_0x90b9('0x3b')];_0x1d7b4b+=0x1){_0x1d7b4b>0x0&&(_0x23f119+='\x20'+_0xedd2ab[_0x90b9('0x6f')]+'\x20');_0x23f119+=_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x70')]?_0x3a2787(_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x70')]):_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x71')]+'\x20'+_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x72')]+(_0x3e2257(_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x72')])?'\x20'+_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x73')]:'');}return _0x23f119+')';};var _0x2b8715={'where':{'id':_0x44bcb2['id']}},_0x4ea074,_0x24208f,_0x3d5ca1,_0xf940a2,_0x392892;_0x2b8715=_[_0x90b9('0x43')]({},_0x2b8715,_0x518875);return db['AnalyticCustomReport'][_0x90b9('0x56')](_0x2b8715)['then'](function(_0x1227a4){if(_0x1227a4){_0x4ea074=_0x1227a4;return _0x1227a4[_0x90b9('0x74')]();}return null;})['then'](function(_0x4af2a3){if(_0x4af2a3){if(!_0x4af2a3[_0x90b9('0x3b')]){throw new db['Sequelize'][(_0x90b9('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x24208f=_0x4af2a3;return db[_0x90b9('0x8f')][_0x90b9('0x76')]({'raw':!![]});}return null;})[_0x90b9('0x26')](function(_0x42354b){if(_0x42354b){_0x3d5ca1=_['keyBy'](_0x42354b,'id');var _0x17630a;var _0x44e136=squel['select']();_0x44e136[_0x90b9('0x78')](_0x4ea074[_0x90b9('0x79')]);for(var _0x58786b=0x0;_0x58786b<_0x24208f['length'];_0x58786b+=0x1){_0x17630a=_0x24208f[_0x58786b]['MetricId']?_0x3d5ca1[_0x24208f[_0x58786b][_0x90b9('0x7a')]][_0x90b9('0x7b')]:_0x24208f[_0x58786b][_0x90b9('0x71')];_0x17630a=_0x24208f[_0x58786b][_0x90b9('0x7c')]?_[_0x90b9('0x7d')](_0x5f1883[_0x24208f[_0x58786b][_0x90b9('0x7c')]],'%s',_0x17630a):_0x17630a;_0x17630a=_0x24208f[_0x58786b]['format']?_[_0x90b9('0x7d')](_0x254a29[_0x24208f[_0x58786b]['format']],'%s',_0x17630a):_0x17630a;if(_0x24208f[_0x58786b][_0x90b9('0x90')]){_0x44e136[_0x90b9('0x70')](_0x17630a);}_0x24208f[_0x58786b]['orderBy']&&_0x44e136[_0x90b9('0x80')](_0x17630a,_0x24208f[_0x58786b]['orderBy']===_0x90b9('0x81')?![]:!![]);_0x44e136[_0x90b9('0x71')](_0x17630a,_0x24208f[_0x58786b]['alias']||_0x17630a);}if(_0x4ea074[_0x90b9('0x83')]){_0x4ea074['joins']=JSON[_0x90b9('0x91')](_0x4ea074['joins']);for(var _0x2e475d=0x0;_0x2e475d<_0x4ea074[_0x90b9('0x83')][_0x90b9('0x3b')];_0x2e475d+=0x1){if(_0x4ea074[_0x90b9('0x83')][_0x2e475d]['type']&&_[_0x90b9('0x69')](_0x433a06,_0x4ea074[_0x90b9('0x83')][_0x2e475d]['type'])&&_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x84')]&&_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x85')]&&_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x87')]){_0x44e136[_0x4ea074[_0x90b9('0x83')][_0x2e475d]['type']](_0x4ea074[_0x90b9('0x83')][_0x2e475d]['foreignTable'],null,util[_0x90b9('0x7e')](_0x90b9('0x86'),_0x4ea074[_0x90b9('0x79')],_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x84')],_0x4ea074['joins'][_0x2e475d]['foreignTable'],_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x87')]));}}}if(_0x4ea074[_0x90b9('0x88')]){_0x4ea074['conditions']=JSON[_0x90b9('0x91')](_0x4ea074['conditions']);_0x44e136['where'](_0x3a2787(_0x4ea074[_0x90b9('0x88')]['group']));}_0x392892=_0x44e136['clone']();_0x44e136['limit'](_0x37a3a2);_0x44e136[_0x90b9('0x1f')](0x0);logger[_0x90b9('0x8a')](_0x90b9('0x8b'),_0x44e136[_0x90b9('0x8c')]());return db['sequelize'][_0x90b9('0x36')](_0x44e136[_0x90b9('0x8c')](),{'type':db[_0x90b9('0x92')][_0x90b9('0x8d')][_0x90b9('0x93')]});}})[_0x90b9('0x26')](function(_0x52e314){if(!_0x52e314[_0x90b9('0x3b')]){throw new db['Sequelize'][(_0x90b9('0x75'))](_0x90b9('0x94'),0xcc);}if(_0x27affa[_0x90b9('0x95')]===_0x90b9('0x96')){return null;}var _0x4e216b=_[_0x90b9('0x43')](_0x27affa,{'name':_0x27affa[_0x90b9('0x97')]||_0x27affa[_0x90b9('0x2d')]||_0x4ea074[_0x90b9('0x2d')],'basename':_0x15b6bf,'savename':util[_0x90b9('0x7e')](_0x90b9('0x98'),_0x27affa[_0x90b9('0x2d')]||_0x4ea074[_0x90b9('0x2d')],require('randomstring')[_0x90b9('0x99')](0x4),_0x27affa[_0x90b9('0x95')]||_0x90b9('0x9a')),'reportId':_0x4ea074['id'],'reportType':_0x90b9('0x9b')});return db[_0x90b9('0x9c')][_0x90b9('0x4b')](_0x4e216b,{'raw':!![]});})[_0x90b9('0x26')](function(_0x224731){if(_0x4ea074[_0x90b9('0x79')]===_0x90b9('0x9d')){_0x392892[_0x90b9('0x42')](_0x4ea074[_0x90b9('0x79')]+_0x90b9('0x9e'),_0x27affa[_0x90b9('0x9f')],_0x27affa[_0x90b9('0xa0')]);}else{_0x392892[_0x90b9('0x42')](_0x4ea074[_0x90b9('0x79')]+_0x90b9('0xa1'),_0x27affa[_0x90b9('0x9f')],_0x27affa[_0x90b9('0xa0')]);}if(_0x224731){logger['info'](_0x90b9('0xa2'),_0x392892[_0x90b9('0x8c')]());require(_0x90b9('0xa3'))[_0x90b9('0xa4')](path[_0x90b9('0x58')](__dirname,_0x90b9('0xa5'),_0x224731[_0x90b9('0x95')]),[_0x224731['id'],_0x392892[_0x90b9('0x8c')](),path[_0x90b9('0x58')](__dirname,_0x90b9('0xa6'),_0x224731[_0x90b9('0xa7')]),_0x15b6bf]);return _0x224731;}else{var _0x24e04b=squel[_0x90b9('0x77')]();_0x24e04b[_0x90b9('0x78')]('('+_0x392892[_0x90b9('0x8c')]()+')','countTable');_0x24e04b[_0x90b9('0x71')](_0x90b9('0xa8'),_0x90b9('0x1e'));_0x392892[_0x90b9('0x20')](_0x27affa['limit']||_0x37a3a2);_0x392892[_0x90b9('0x1f')](_0x27affa[_0x90b9('0x1f')]||0x0);return dbH[_0x90b9('0x92')][_0x90b9('0x36')](_0x24e04b[_0x90b9('0x8c')](),{'type':dbH['sequelize'][_0x90b9('0x8d')][_0x90b9('0x93')]})[_0x90b9('0x26')](function(_0x37e304){if(!_0x37e304[_0x90b9('0x3b')]){_0xf940a2=0x0;}else{_0xf940a2=_0x37e304[0x0][_0x90b9('0x1e')]||0x0;}return dbH['sequelize'][_0x90b9('0x36')](_0x392892[_0x90b9('0x8c')](),{'type':dbH[_0x90b9('0x92')][_0x90b9('0x8d')][_0x90b9('0x93')]});})[_0x90b9('0x26')](function(_0x312e3e){return{'rows':_0x312e3e||[],'count':_0xf940a2};});}});}exports[_0x90b9('0xa9')]=function(_0x32c97f,_0x5b006f){return runReport(_0x32c97f['params'],_0x32c97f[_0x90b9('0x36')],_0x32c97f[_0x90b9('0x44')])['then'](respondWithResult(_0x5b006f,null))[_0x90b9('0x47')](handleError(_0x5b006f,null));};exports[_0x90b9('0xaa')]=runReport;exports[_0x90b9('0x36')]=function(_0x214557,_0x113ba7){var _0x2096f4=0xa;var _0x4be406=[_0x90b9('0x58'),_0x90b9('0x59'),_0x90b9('0x5a'),_0x90b9('0x5b')];var _0x492775={'SUM':_0x90b9('0x5c'),'COUNT':_0x90b9('0x5d'),'COUNT DISTINCT':_0x90b9('0x5e'),'MAX':_0x90b9('0x5f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x90b9('0x62'),'GROUP_CONCAT ASC':_0x90b9('0x63'),'GROUP_CONCAT DESC':_0x90b9('0x64')};var _0x4ddb91={'SEC_TO_TIME':_0x90b9('0x65'),'DATE':_0x90b9('0x8e'),'HOUR':_0x90b9('0x66'),'ROUND':_0x90b9('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x6f76bd=function(_0x41d346){return!_['includes']([_0x90b9('0x6a'),_0x90b9('0x6b'),'IS\x20EMPTY',_0x90b9('0x6d')],_0x41d346);};var _0x256b6e=function(_0x2783b5){if(!_0x2783b5||!_0x2783b5[_0x90b9('0x6e')][_0x90b9('0x3b')]){return'';}for(var _0x1ead71='(',_0x134364=0x0;_0x134364<_0x2783b5[_0x90b9('0x6e')]['length'];_0x134364+=0x1){_0x134364>0x0&&(_0x1ead71+='\x20'+_0x2783b5['operator']+'\x20');_0x1ead71+=_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x70')]?_0x256b6e(_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x70')]):_0x2783b5['rules'][_0x134364][_0x90b9('0x71')]+'\x20'+_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x72')]+(_0x6f76bd(_0x2783b5[_0x90b9('0x6e')][_0x134364]['condition'])?'\x20'+_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x73')]:'');}return _0x1ead71+')';};var _0x3752e4={'where':{'id':_0x214557[_0x90b9('0x49')]['id']}},_0x3e11bb,_0x3d016d,_0x26dc4c,_0x303ef4,_0xc3355f;_0x3752e4=_[_0x90b9('0x43')]({},_0x3752e4,_0x214557[_0x90b9('0x44')]);return db[_0x90b9('0x31')][_0x90b9('0x56')](_0x3752e4)[_0x90b9('0x26')](function(_0x5fdca1){if(_0x5fdca1){_0x3e11bb=_0x5fdca1;return _0x5fdca1[_0x90b9('0x74')]();}return null;})['then'](function(_0x484223){if(_0x484223){if(!_0x484223[_0x90b9('0x3b')]){throw new db[(_0x90b9('0xab'))][(_0x90b9('0x75'))](_0x90b9('0xac'),0x193);}_0x3d016d=_0x484223;return db['AnalyticMetric'][_0x90b9('0x76')]({'raw':!![]});}return null;})[_0x90b9('0x26')](function(_0x264388){if(_0x264388){_0x26dc4c=_[_0x90b9('0xad')](_0x264388,'id');var _0xf616da;var _0x5c3a2d=squel[_0x90b9('0x77')]();_0x5c3a2d[_0x90b9('0x78')](_0x3e11bb['table']);for(var _0x49e158=0x0;_0x49e158<_0x3d016d['length'];_0x49e158+=0x1){_0xf616da=_0x3d016d[_0x49e158][_0x90b9('0x7a')]?_0x26dc4c[_0x3d016d[_0x49e158][_0x90b9('0x7a')]][_0x90b9('0x7b')]:_0x3d016d[_0x49e158]['field'];_0xf616da=_0x3d016d[_0x49e158]['function']?_[_0x90b9('0x7d')](_0x492775[_0x3d016d[_0x49e158][_0x90b9('0x7c')]],'%s',_0xf616da):_0xf616da;_0xf616da=_0x3d016d[_0x49e158]['format']?_['replace'](_0x4ddb91[_0x3d016d[_0x49e158][_0x90b9('0x7e')]],'%s',_0xf616da):_0xf616da;if(_0x3d016d[_0x49e158][_0x90b9('0x90')]){_0x5c3a2d[_0x90b9('0x70')](_0xf616da);}_0x3d016d[_0x49e158][_0x90b9('0x7f')]&&_0x5c3a2d['order'](_0xf616da,_0x3d016d[_0x49e158][_0x90b9('0x7f')]===_0x90b9('0x81')?![]:!![]);_0x5c3a2d[_0x90b9('0x71')](_0xf616da,_0x3d016d[_0x49e158][_0x90b9('0x82')]||_0xf616da);}if(_0x3e11bb['joins']){_0x3e11bb['joins']=JSON[_0x90b9('0x91')](_0x3e11bb[_0x90b9('0x83')]);for(var _0x4205b2=0x0;_0x4205b2<_0x3e11bb['joins']['length'];_0x4205b2+=0x1){if(_0x3e11bb['joins'][_0x4205b2][_0x90b9('0x34')]&&_[_0x90b9('0x69')](_0x4be406,_0x3e11bb['joins'][_0x4205b2][_0x90b9('0x34')])&&_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x84')]&&_0x3e11bb[_0x90b9('0x83')][_0x4205b2]['foreignTable']&&_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x87')]){_0x5c3a2d[_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x34')]](_0x3e11bb['joins'][_0x4205b2][_0x90b9('0x85')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3e11bb[_0x90b9('0x79')],_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x84')],_0x3e11bb['joins'][_0x4205b2]['foreignTable'],_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x87')]));}}}if(_0x3e11bb[_0x90b9('0x88')]){_0x3e11bb[_0x90b9('0x88')]=JSON[_0x90b9('0x91')](_0x3e11bb['conditions']);_0x5c3a2d['where'](_0x256b6e(_0x3e11bb[_0x90b9('0x88')][_0x90b9('0x70')]));}_0xc3355f=_0x5c3a2d[_0x90b9('0x89')]();_0x5c3a2d['limit'](_0x2096f4);_0x5c3a2d[_0x90b9('0x1f')](0x0);logger[_0x90b9('0x8a')](_0x90b9('0x8b'),_0x5c3a2d[_0x90b9('0x8c')]());return db['sequelize'][_0x90b9('0x36')](_0x5c3a2d[_0x90b9('0x8c')](),{'type':db['sequelize']['QueryTypes'][_0x90b9('0x93')]});}})[_0x90b9('0x26')](function(){return{'sql':_0xc3355f[_0x90b9('0x8c')]()};})[_0x90b9('0x26')](respondWithResult(_0x113ba7,null))['catch'](handleError(_0x113ba7,null));}; \ No newline at end of file +var _0x9c23=['debug','toString','sequelize','SELECT','cross_join','COUNT(DISTINCT\x20%s)','getFields','orderBy','order','clone','Limited\x20Query:','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','run','runReport','HOUR(%s)','select','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','CustomReports','destroy','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c23,0xd3));var _0x39c2=function(_0x2d604d,_0x51a1f5){_0x2d604d=_0x2d604d-0x0;var _0x159761=_0x9c23[_0x2d604d];return _0x159761;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x39c2('0x0'));var jsonpatch=require(_0x39c2('0x1'));var rp=require(_0x39c2('0x2'));var moment=require(_0x39c2('0x3'));var BPromise=require(_0x39c2('0x4'));var Mustache=require(_0x39c2('0x5'));var util=require(_0x39c2('0x6'));var path=require(_0x39c2('0x7'));var sox=require(_0x39c2('0x8'));var csv=require('to-csv');var ejs=require(_0x39c2('0x9'));var fs=require('fs');var _=require(_0x39c2('0xa'));var squel=require(_0x39c2('0xb'));var crypto=require('crypto');var jsforce=require(_0x39c2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x39c2('0xd'));var querystring=require('querystring');var Papa=require(_0x39c2('0xe'));var Redis=require(_0x39c2('0xf'));var authService=require(_0x39c2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x39c2('0x11'));var hardwareService=require(_0x39c2('0x12'));var logger=require(_0x39c2('0x13'))(_0x39c2('0x14'));var utils=require(_0x39c2('0x15'));var config=require(_0x39c2('0x16'));var licenseUtil=require(_0x39c2('0x17'));var db=require(_0x39c2('0x18'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x35c9dd,_0x494288){_0x494288=_0x494288||0xcc;return function(_0xab6af9){if(_0xab6af9){return _0x35c9dd[_0x39c2('0x19')](_0x494288);}return _0x35c9dd[_0x39c2('0x1a')](_0x494288)['end']();};}function respondWithResult(_0x20e400,_0x375c62){_0x375c62=_0x375c62||0xc8;return function(_0x33b975){if(_0x33b975){return _0x20e400[_0x39c2('0x1a')](_0x375c62)['json'](_0x33b975);}};}function respondWithFilteredResult(_0x18ed11,_0xe6674e){return function(_0x4e17c2){if(_0x4e17c2){var _0x3d2687=_0x4e17c2[_0x39c2('0x1b')],_0xb0101b=_0xe6674e['offset'],_0x369be0=_0xe6674e[_0x39c2('0x1c')]+_0xe6674e[_0x39c2('0x1d')],_0x520128;if(_0x369be0>=_0x3d2687){_0x369be0=_0x3d2687;_0x520128=0xc8;}else{_0x520128=0xce;}_0x18ed11['status'](_0x520128);return _0x18ed11[_0x39c2('0x1e')](_0x39c2('0x1f'),_0xb0101b+'-'+_0x369be0+'/'+_0x3d2687)['json'](_0x4e17c2);}return null;};}function patchUpdates(_0x2542b4){return function(_0x5093fe){try{jsonpatch[_0x39c2('0x20')](_0x5093fe,_0x2542b4,!![]);}catch(_0x2dc863){return BPromise[_0x39c2('0x21')](_0x2dc863);}return _0x5093fe[_0x39c2('0x22')]();};}function saveUpdates(_0x1dd2df,_0x22a0c3){return function(_0x10cf32){if(_0x10cf32){return _0x10cf32[_0x39c2('0x23')](_0x1dd2df)[_0x39c2('0x24')](function(_0x190c2f){return _0x190c2f;});}return null;};}function removeEntity(_0x1187c2,_0x1252c4){return function(_0x4b9ba5){if(_0x4b9ba5){return _0x4b9ba5['destroy']()[_0x39c2('0x24')](function(){var _0x6766a9=_0x4b9ba5['get']({'plain':!![]});var _0x4f0868=_0x39c2('0x25');return db['UserProfileResource'][_0x39c2('0x26')]({'where':{'type':_0x4f0868,'resourceId':_0x6766a9['id']}})[_0x39c2('0x24')](function(){return _0x4b9ba5;});})[_0x39c2('0x24')](function(){_0x1187c2['status'](0xcc)[_0x39c2('0x27')]();});}};}function handleEntityNotFound(_0x56d406,_0x1f42d9){return function(_0x107abb){if(!_0x107abb){_0x56d406[_0x39c2('0x19')](0x194);}return _0x107abb;};}function handleError(_0x4aed4d,_0x4308d7){_0x4308d7=_0x4308d7||0x1f4;return function(_0x16f33d){logger[_0x39c2('0x28')](_0x16f33d[_0x39c2('0x29')]);if(_0x16f33d[_0x39c2('0x2a')]){delete _0x16f33d['name'];}_0x4aed4d[_0x39c2('0x1a')](_0x4308d7)[_0x39c2('0x2b')](_0x16f33d);};}exports[_0x39c2('0x2c')]=function(_0x4badac,_0x55a76e){var _0x428829={},_0x23132b={},_0xed15ed={'count':0x0,'rows':[]};var _0x563f9c=_[_0x39c2('0x2d')](db[_0x39c2('0x2e')][_0x39c2('0x2f')],function(_0x10ea42){return{'name':_0x10ea42['fieldName'],'type':_0x10ea42['type'][_0x39c2('0x30')]};});_0x23132b[_0x39c2('0x31')]=_['map'](_0x563f9c,_0x39c2('0x2a'));_0x23132b[_0x39c2('0x32')]=_[_0x39c2('0x33')](_0x4badac[_0x39c2('0x32')]);_0x23132b[_0x39c2('0x34')]=_[_0x39c2('0x35')](_0x23132b[_0x39c2('0x31')],_0x23132b[_0x39c2('0x32')]);_0x428829[_0x39c2('0x36')]=_['intersection'](_0x23132b[_0x39c2('0x31')],qs[_0x39c2('0x37')](_0x4badac['query']['fields']));_0x428829[_0x39c2('0x36')]=_0x428829[_0x39c2('0x36')][_0x39c2('0x38')]?_0x428829[_0x39c2('0x36')]:_0x23132b['model'];if(!_0x4badac[_0x39c2('0x32')][_0x39c2('0x39')](_0x39c2('0x3a'))){_0x428829[_0x39c2('0x1d')]=qs[_0x39c2('0x1d')](_0x4badac['query']['limit']);_0x428829[_0x39c2('0x1c')]=qs[_0x39c2('0x1c')](_0x4badac[_0x39c2('0x32')]['offset']);}_0x428829['order']=qs[_0x39c2('0x3b')](_0x4badac[_0x39c2('0x32')][_0x39c2('0x3b')]);_0x428829[_0x39c2('0x3c')]=qs[_0x39c2('0x34')](_[_0x39c2('0x3d')](_0x4badac[_0x39c2('0x32')],_0x23132b[_0x39c2('0x34')]),_0x563f9c);if(_0x4badac[_0x39c2('0x32')][_0x39c2('0x3e')]){_0x428829[_0x39c2('0x3c')]=_[_0x39c2('0x3f')](_0x428829['where'],{'$or':_['map'](_0x563f9c,function(_0x548c46){if(_0x548c46[_0x39c2('0x40')]!==_0x39c2('0x41')){var _0xea7aaf={};_0xea7aaf[_0x548c46[_0x39c2('0x2a')]]={'$like':'%'+_0x4badac[_0x39c2('0x32')][_0x39c2('0x3e')]+'%'};return _0xea7aaf;}})});}_0x428829=_['merge']({},_0x428829,_0x4badac[_0x39c2('0x42')]);var _0x4f3794={'where':_0x428829[_0x39c2('0x3c')]};return db[_0x39c2('0x2e')][_0x39c2('0x1b')](_0x4f3794)[_0x39c2('0x24')](function(_0x12ac3b){_0xed15ed[_0x39c2('0x1b')]=_0x12ac3b;if(_0x4badac[_0x39c2('0x32')][_0x39c2('0x43')]){_0x428829[_0x39c2('0x44')]=[{'all':!![]}];}return db[_0x39c2('0x2e')][_0x39c2('0x45')](_0x428829);})[_0x39c2('0x24')](function(_0x2b02b0){_0xed15ed[_0x39c2('0x46')]=_0x2b02b0;return _0xed15ed;})[_0x39c2('0x24')](respondWithFilteredResult(_0x55a76e,_0x428829))[_0x39c2('0x47')](handleError(_0x55a76e,null));};exports[_0x39c2('0x48')]=function(_0x3ccca0,_0x5da01b){var _0xe6efb0={'raw':![],'where':{'id':_0x3ccca0[_0x39c2('0x49')]['id']}},_0x104987={};_0x104987[_0x39c2('0x31')]=_['keys'](db[_0x39c2('0x2e')][_0x39c2('0x2f')]);_0x104987[_0x39c2('0x32')]=_[_0x39c2('0x33')](_0x3ccca0['query']);_0x104987[_0x39c2('0x34')]=_[_0x39c2('0x35')](_0x104987[_0x39c2('0x31')],_0x104987['query']);_0xe6efb0['attributes']=_[_0x39c2('0x35')](_0x104987[_0x39c2('0x31')],qs[_0x39c2('0x37')](_0x3ccca0[_0x39c2('0x32')][_0x39c2('0x37')]));_0xe6efb0[_0x39c2('0x36')]=_0xe6efb0[_0x39c2('0x36')][_0x39c2('0x38')]?_0xe6efb0[_0x39c2('0x36')]:_0x104987[_0x39c2('0x31')];if(_0x3ccca0[_0x39c2('0x32')][_0x39c2('0x43')]){_0xe6efb0[_0x39c2('0x44')]=[{'all':!![]}];}_0xe6efb0=_[_0x39c2('0x3f')]({},_0xe6efb0,_0x3ccca0[_0x39c2('0x42')]);return db[_0x39c2('0x2e')][_0x39c2('0x4a')](_0xe6efb0)[_0x39c2('0x24')](handleEntityNotFound(_0x5da01b,null))[_0x39c2('0x24')](respondWithResult(_0x5da01b,null))[_0x39c2('0x47')](handleError(_0x5da01b,null));};exports[_0x39c2('0x4b')]=function(_0x3d537d,_0x380a48){return db[_0x39c2('0x2e')][_0x39c2('0x4b')](_0x3d537d[_0x39c2('0x4c')],{})[_0x39c2('0x24')](function(_0x59ef30){var _0x21dba5=_0x3d537d[_0x39c2('0x4d')][_0x39c2('0x4e')]({'plain':!![]});if(!_0x21dba5)throw new Error(_0x39c2('0x4f'));if(_0x21dba5[_0x39c2('0x50')]===_0x39c2('0x4d')){var _0x1569df=_0x59ef30['get']({'plain':!![]});var _0x62cdd6='Reports';return db[_0x39c2('0x51')][_0x39c2('0x4a')]({'where':{'name':_0x62cdd6,'userProfileId':_0x21dba5[_0x39c2('0x52')]},'raw':!![]})[_0x39c2('0x24')](function(_0x449dc3){if(_0x449dc3&&_0x449dc3[_0x39c2('0x53')]===0x0){return db[_0x39c2('0x54')][_0x39c2('0x4b')]({'name':_0x1569df[_0x39c2('0x2a')],'resourceId':_0x1569df['id'],'type':_0x39c2('0x25'),'sectionId':_0x449dc3['id']},{})[_0x39c2('0x24')](function(){return _0x59ef30;});}else{return _0x59ef30;}})[_0x39c2('0x47')](function(_0x373582){logger['error'](_0x39c2('0x55'),_0x373582);throw _0x373582;});}return _0x59ef30;})[_0x39c2('0x24')](respondWithResult(_0x380a48,0xc9))[_0x39c2('0x47')](handleError(_0x380a48,null));};exports['update']=function(_0x215b15,_0x55a806){if(_0x215b15[_0x39c2('0x4c')]['id']){delete _0x215b15[_0x39c2('0x4c')]['id'];}return db[_0x39c2('0x2e')][_0x39c2('0x4a')]({'where':{'id':_0x215b15[_0x39c2('0x49')]['id']}})['then'](handleEntityNotFound(_0x55a806,null))[_0x39c2('0x24')](saveUpdates(_0x215b15[_0x39c2('0x4c')],null))[_0x39c2('0x24')](respondWithResult(_0x55a806,null))['catch'](handleError(_0x55a806,null));};exports[_0x39c2('0x26')]=function(_0x3d3d47,_0xa8caa1){return db['AnalyticCustomReport'][_0x39c2('0x4a')]({'where':{'id':_0x3d3d47[_0x39c2('0x49')]['id']}})[_0x39c2('0x24')](handleEntityNotFound(_0xa8caa1,null))['then'](removeEntity(_0xa8caa1,null))[_0x39c2('0x47')](handleError(_0xa8caa1,null));};exports[_0x39c2('0x56')]=function(_0x188060,_0x13f6f6){var _0xd5fbf7=0xa;var _0x6ddb3c=[_0x39c2('0x57'),_0x39c2('0x58'),_0x39c2('0x59'),'cross_join'];var _0x388595={'SUM':_0x39c2('0x5a'),'COUNT':_0x39c2('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x39c2('0x5c'),'MIN':_0x39c2('0x5d'),'AVG':_0x39c2('0x5e'),'GROUP_CONCAT':_0x39c2('0x5f'),'GROUP_CONCAT ASC':_0x39c2('0x60'),'GROUP_CONCAT DESC':_0x39c2('0x61')};var _0x44dc42={'SEC_TO_TIME':_0x39c2('0x62'),'DATE':_0x39c2('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x39c2('0x64'),'UNIX_TIMESTAMP':_0x39c2('0x65')};var _0x50c704=function(_0x2ed4c1){return!_[_0x39c2('0x66')]([_0x39c2('0x67'),_0x39c2('0x68'),_0x39c2('0x69'),_0x39c2('0x6a')],_0x2ed4c1);};var _0x5ed454=function(_0x5d4f81){if(!_0x5d4f81||!_0x5d4f81[_0x39c2('0x6b')][_0x39c2('0x38')]){return'';}for(var _0x4f51b0='(',_0x45ae69=0x0;_0x45ae69<_0x5d4f81['rules'][_0x39c2('0x38')];_0x45ae69+=0x1){_0x45ae69>0x0&&(_0x4f51b0+='\x20'+_0x5d4f81[_0x39c2('0x6c')]+'\x20');_0x4f51b0+=_0x5d4f81[_0x39c2('0x6b')][_0x45ae69]['group']?_0x5ed454(_0x5d4f81[_0x39c2('0x6b')][_0x45ae69][_0x39c2('0x6d')]):_0x5d4f81[_0x39c2('0x6b')][_0x45ae69][_0x39c2('0x6e')]+'\x20'+_0x5d4f81['rules'][_0x45ae69][_0x39c2('0x6f')]+(_0x50c704(_0x5d4f81[_0x39c2('0x6b')][_0x45ae69][_0x39c2('0x6f')])?'\x20'+_0x5d4f81['rules'][_0x45ae69][_0x39c2('0x70')]:'');}return _0x4f51b0+')';};var _0x27229b={'where':{'id':_0x188060[_0x39c2('0x49')]['id']}},_0x363868,_0x7640e1,_0x35f9b6,_0x27d68d,_0x8f825d;_0x27229b=_['merge']({},_0x27229b,_0x188060[_0x39c2('0x42')]);return db[_0x39c2('0x2e')][_0x39c2('0x4a')](_0x27229b)[_0x39c2('0x24')](function(_0x26977d){if(_0x26977d){_0x363868=_0x26977d;return _0x26977d['getFields']();}return null;})[_0x39c2('0x24')](function(_0x14c55e){if(_0x14c55e){if(!_0x14c55e[_0x39c2('0x38')]){throw new db[(_0x39c2('0x71'))][(_0x39c2('0x72'))](_0x39c2('0x73'),0x193);}_0x7640e1=_0x14c55e;return db[_0x39c2('0x74')][_0x39c2('0x45')]({'raw':!![]});}return null;})['then'](function(_0x4a9850){if(_0x4a9850){_0x35f9b6=_[_0x39c2('0x75')](_0x4a9850,'id');var _0x13f00a;var _0x411032=squel['select']();_0x411032[_0x39c2('0x76')](_0x363868[_0x39c2('0x77')]);for(var _0x145e17=0x0;_0x145e17<_0x7640e1[_0x39c2('0x38')];_0x145e17+=0x1){_0x13f00a=_0x7640e1[_0x145e17]['MetricId']?_0x35f9b6[_0x7640e1[_0x145e17][_0x39c2('0x78')]][_0x39c2('0x79')]:_0x7640e1[_0x145e17][_0x39c2('0x6e')];_0x13f00a=_0x7640e1[_0x145e17][_0x39c2('0x7a')]?_['replace'](_0x388595[_0x7640e1[_0x145e17][_0x39c2('0x7a')]],'%s',_0x13f00a):_0x13f00a;_0x13f00a=_0x7640e1[_0x145e17]['format']?_[_0x39c2('0x7b')](_0x44dc42[_0x7640e1[_0x145e17][_0x39c2('0x7c')]],'%s',_0x13f00a):_0x13f00a;if(_0x7640e1[_0x145e17][_0x39c2('0x7d')]){_0x411032[_0x39c2('0x6d')](_0x13f00a);}_0x7640e1[_0x145e17]['orderBy']&&_0x411032['order'](_0x13f00a,_0x7640e1[_0x145e17]['orderBy']===_0x39c2('0x7e')?![]:!![]);_0x411032[_0x39c2('0x6e')](_0x13f00a,_0x7640e1[_0x145e17][_0x39c2('0x7f')]||_0x13f00a);}if(_0x363868[_0x39c2('0x80')]){_0x363868[_0x39c2('0x80')]=JSON['parse'](_0x363868[_0x39c2('0x80')]);for(var _0x3a09c0=0x0;_0x3a09c0<_0x363868['joins']['length'];_0x3a09c0+=0x1){if(_0x363868[_0x39c2('0x80')][_0x3a09c0]['type']&&_[_0x39c2('0x66')](_0x6ddb3c,_0x363868[_0x39c2('0x80')][_0x3a09c0][_0x39c2('0x40')])&&_0x363868[_0x39c2('0x80')][_0x3a09c0][_0x39c2('0x81')]&&_0x363868['joins'][_0x3a09c0][_0x39c2('0x82')]&&_0x363868[_0x39c2('0x80')][_0x3a09c0][_0x39c2('0x83')]){_0x411032[_0x363868['joins'][_0x3a09c0][_0x39c2('0x40')]](_0x363868[_0x39c2('0x80')][_0x3a09c0][_0x39c2('0x82')],null,util[_0x39c2('0x7c')](_0x39c2('0x84'),_0x363868[_0x39c2('0x77')],_0x363868['joins'][_0x3a09c0]['parentKey'],_0x363868[_0x39c2('0x80')][_0x3a09c0][_0x39c2('0x82')],_0x363868[_0x39c2('0x80')][_0x3a09c0]['foreignKey']));}}}if(_0x363868['conditions']){_0x363868[_0x39c2('0x85')]=JSON[_0x39c2('0x86')](_0x363868[_0x39c2('0x85')]);_0x411032[_0x39c2('0x3c')](_0x5ed454(_0x363868[_0x39c2('0x85')][_0x39c2('0x6d')]));}_0x8f825d=_0x411032['clone']();_0x411032[_0x39c2('0x1d')](_0xd5fbf7);_0x411032[_0x39c2('0x1c')](0x0);logger[_0x39c2('0x87')]('Limited\x20Query:',_0x411032[_0x39c2('0x88')]());return db[_0x39c2('0x89')][_0x39c2('0x32')](_0x411032[_0x39c2('0x88')](),{'type':db[_0x39c2('0x89')]['QueryTypes'][_0x39c2('0x8a')]});}})[_0x39c2('0x24')](respondWithResult(_0x13f6f6,null))[_0x39c2('0x47')](handleError(_0x13f6f6,null));};function runReport(_0x500846,_0x1a99e3,_0x3e6e73){var _0x276da7=_0x1a99e3['name'];var _0x1a893a=0xa;var _0x477395=['join',_0x39c2('0x58'),_0x39c2('0x59'),_0x39c2('0x8b')];var _0x556848={'SUM':_0x39c2('0x5a'),'COUNT':_0x39c2('0x5b'),'COUNT DISTINCT':_0x39c2('0x8c'),'MAX':'MAX(%s)','MIN':_0x39c2('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x39c2('0x5f'),'GROUP_CONCAT ASC':_0x39c2('0x60'),'GROUP_CONCAT DESC':_0x39c2('0x61')};var _0x2c968c={'SEC_TO_TIME':_0x39c2('0x62'),'DATE':_0x39c2('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x39c2('0x64'),'UNIX_TIMESTAMP':_0x39c2('0x65')};var _0x2ab3d4=function(_0x44ebfe){return!_[_0x39c2('0x66')]([_0x39c2('0x67'),_0x39c2('0x68'),_0x39c2('0x69'),_0x39c2('0x6a')],_0x44ebfe);};var _0x197360=function(_0x595c5b){if(!_0x595c5b||!_0x595c5b[_0x39c2('0x6b')][_0x39c2('0x38')]){return'';}for(var _0x3498e3='(',_0x10506c=0x0;_0x10506c<_0x595c5b[_0x39c2('0x6b')][_0x39c2('0x38')];_0x10506c+=0x1){_0x10506c>0x0&&(_0x3498e3+='\x20'+_0x595c5b[_0x39c2('0x6c')]+'\x20');_0x3498e3+=_0x595c5b['rules'][_0x10506c][_0x39c2('0x6d')]?_0x197360(_0x595c5b[_0x39c2('0x6b')][_0x10506c]['group']):_0x595c5b['rules'][_0x10506c][_0x39c2('0x6e')]+'\x20'+_0x595c5b['rules'][_0x10506c]['condition']+(_0x2ab3d4(_0x595c5b[_0x39c2('0x6b')][_0x10506c][_0x39c2('0x6f')])?'\x20'+_0x595c5b[_0x39c2('0x6b')][_0x10506c][_0x39c2('0x70')]:'');}return _0x3498e3+')';};var _0x23d280={'where':{'id':_0x500846['id']}},_0x1ed846,_0x42d9d6,_0x26c7e2,_0x36d829,_0x298d25;_0x23d280=_['merge']({},_0x23d280,_0x3e6e73);return db[_0x39c2('0x2e')]['find'](_0x23d280)['then'](function(_0x1e3529){if(_0x1e3529){_0x1ed846=_0x1e3529;return _0x1e3529[_0x39c2('0x8d')]();}return null;})[_0x39c2('0x24')](function(_0x5c328c){if(_0x5c328c){if(!_0x5c328c[_0x39c2('0x38')]){throw new db[(_0x39c2('0x71'))][(_0x39c2('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x42d9d6=_0x5c328c;return db['AnalyticMetric'][_0x39c2('0x45')]({'raw':!![]});}return null;})[_0x39c2('0x24')](function(_0x3b3e2e){if(_0x3b3e2e){_0x26c7e2=_[_0x39c2('0x75')](_0x3b3e2e,'id');var _0x5350b;var _0x14615a=squel['select']();_0x14615a[_0x39c2('0x76')](_0x1ed846['table']);for(var _0x5e8862=0x0;_0x5e8862<_0x42d9d6['length'];_0x5e8862+=0x1){_0x5350b=_0x42d9d6[_0x5e8862]['MetricId']?_0x26c7e2[_0x42d9d6[_0x5e8862][_0x39c2('0x78')]][_0x39c2('0x79')]:_0x42d9d6[_0x5e8862][_0x39c2('0x6e')];_0x5350b=_0x42d9d6[_0x5e8862][_0x39c2('0x7a')]?_[_0x39c2('0x7b')](_0x556848[_0x42d9d6[_0x5e8862][_0x39c2('0x7a')]],'%s',_0x5350b):_0x5350b;_0x5350b=_0x42d9d6[_0x5e8862][_0x39c2('0x7c')]?_[_0x39c2('0x7b')](_0x2c968c[_0x42d9d6[_0x5e8862][_0x39c2('0x7c')]],'%s',_0x5350b):_0x5350b;if(_0x42d9d6[_0x5e8862][_0x39c2('0x7d')]){_0x14615a[_0x39c2('0x6d')](_0x5350b);}_0x42d9d6[_0x5e8862][_0x39c2('0x8e')]&&_0x14615a[_0x39c2('0x8f')](_0x5350b,_0x42d9d6[_0x5e8862][_0x39c2('0x8e')]===_0x39c2('0x7e')?![]:!![]);_0x14615a[_0x39c2('0x6e')](_0x5350b,_0x42d9d6[_0x5e8862][_0x39c2('0x7f')]||_0x5350b);}if(_0x1ed846[_0x39c2('0x80')]){_0x1ed846[_0x39c2('0x80')]=JSON[_0x39c2('0x86')](_0x1ed846[_0x39c2('0x80')]);for(var _0x202c18=0x0;_0x202c18<_0x1ed846[_0x39c2('0x80')][_0x39c2('0x38')];_0x202c18+=0x1){if(_0x1ed846['joins'][_0x202c18]['type']&&_['includes'](_0x477395,_0x1ed846[_0x39c2('0x80')][_0x202c18][_0x39c2('0x40')])&&_0x1ed846['joins'][_0x202c18][_0x39c2('0x81')]&&_0x1ed846['joins'][_0x202c18][_0x39c2('0x82')]&&_0x1ed846[_0x39c2('0x80')][_0x202c18]['foreignKey']){_0x14615a[_0x1ed846[_0x39c2('0x80')][_0x202c18][_0x39c2('0x40')]](_0x1ed846[_0x39c2('0x80')][_0x202c18][_0x39c2('0x82')],null,util[_0x39c2('0x7c')](_0x39c2('0x84'),_0x1ed846[_0x39c2('0x77')],_0x1ed846[_0x39c2('0x80')][_0x202c18]['parentKey'],_0x1ed846[_0x39c2('0x80')][_0x202c18][_0x39c2('0x82')],_0x1ed846[_0x39c2('0x80')][_0x202c18][_0x39c2('0x83')]));}}}if(_0x1ed846[_0x39c2('0x85')]){_0x1ed846[_0x39c2('0x85')]=JSON['parse'](_0x1ed846[_0x39c2('0x85')]);_0x14615a['where'](_0x197360(_0x1ed846[_0x39c2('0x85')][_0x39c2('0x6d')]));}_0x298d25=_0x14615a[_0x39c2('0x90')]();_0x14615a[_0x39c2('0x1d')](_0x1a893a);_0x14615a[_0x39c2('0x1c')](0x0);logger[_0x39c2('0x87')](_0x39c2('0x91'),_0x14615a[_0x39c2('0x88')]());return db[_0x39c2('0x89')][_0x39c2('0x32')](_0x14615a[_0x39c2('0x88')](),{'type':db[_0x39c2('0x89')][_0x39c2('0x92')][_0x39c2('0x8a')]});}})[_0x39c2('0x24')](function(_0x3e02bb){if(!_0x3e02bb[_0x39c2('0x38')]){throw new db[(_0x39c2('0x71'))][(_0x39c2('0x72'))](_0x39c2('0x93'),0xcc);}if(_0x1a99e3[_0x39c2('0x94')]===_0x39c2('0x95')){return null;}var _0x56adf6=_[_0x39c2('0x3f')](_0x1a99e3,{'name':_0x1a99e3[_0x39c2('0x96')]||_0x1a99e3['name']||_0x1ed846[_0x39c2('0x2a')],'basename':_0x276da7,'savename':util[_0x39c2('0x7c')](_0x39c2('0x97'),_0x1a99e3[_0x39c2('0x2a')]||_0x1ed846[_0x39c2('0x2a')],require(_0x39c2('0x98'))[_0x39c2('0x99')](0x4),_0x1a99e3[_0x39c2('0x94')]||_0x39c2('0x9a')),'reportId':_0x1ed846['id'],'reportType':_0x39c2('0x9b')});return db[_0x39c2('0x9c')][_0x39c2('0x4b')](_0x56adf6,{'raw':!![]});})[_0x39c2('0x24')](function(_0xc50f31){if(_0x1ed846[_0x39c2('0x77')]===_0x39c2('0x9d')){_0x298d25['where'](_0x1ed846['table']+_0x39c2('0x9e'),_0x1a99e3[_0x39c2('0x9f')],_0x1a99e3['endDate']);}else{_0x298d25['where'](_0x1ed846['table']+_0x39c2('0xa0'),_0x1a99e3['startDate'],_0x1a99e3[_0x39c2('0xa1')]);}if(_0xc50f31){logger[_0x39c2('0xa2')](_0x39c2('0xa3'),_0x298d25['toString']());require(_0x39c2('0xa4'))[_0x39c2('0xa5')](path[_0x39c2('0x57')](__dirname,'../../components/export/',_0xc50f31['output']),[_0xc50f31['id'],_0x298d25['toString'](),path[_0x39c2('0x57')](__dirname,_0x39c2('0xa6'),_0xc50f31[_0x39c2('0xa7')]),_0x276da7]);return _0xc50f31;}else{var _0x23f151=squel['select']();_0x23f151[_0x39c2('0x76')]('('+_0x298d25['toString']()+')','countTable');_0x23f151[_0x39c2('0x6e')](_0x39c2('0xa8'),'count');_0x298d25[_0x39c2('0x1d')](_0x1a99e3['limit']||_0x1a893a);_0x298d25[_0x39c2('0x1c')](_0x1a99e3[_0x39c2('0x1c')]||0x0);return dbH['sequelize'][_0x39c2('0x32')](_0x23f151[_0x39c2('0x88')](),{'type':dbH[_0x39c2('0x89')][_0x39c2('0x92')][_0x39c2('0x8a')]})[_0x39c2('0x24')](function(_0x5ec560){if(!_0x5ec560['length']){_0x36d829=0x0;}else{_0x36d829=_0x5ec560[0x0][_0x39c2('0x1b')]||0x0;}return dbH['sequelize'][_0x39c2('0x32')](_0x298d25[_0x39c2('0x88')](),{'type':dbH[_0x39c2('0x89')]['QueryTypes'][_0x39c2('0x8a')]});})[_0x39c2('0x24')](function(_0x2d7b56){return{'rows':_0x2d7b56||[],'count':_0x36d829};});}});}exports[_0x39c2('0xa9')]=function(_0x20652d,_0xbe59ac){return runReport(_0x20652d[_0x39c2('0x49')],_0x20652d[_0x39c2('0x32')],_0x20652d['options'])['then'](respondWithResult(_0xbe59ac,null))[_0x39c2('0x47')](handleError(_0xbe59ac,null));};exports[_0x39c2('0xaa')]=runReport;exports[_0x39c2('0x32')]=function(_0x26af86,_0x87c8e8){var _0x5bf9d6=0xa;var _0x26b93b=[_0x39c2('0x57'),_0x39c2('0x58'),'right_join',_0x39c2('0x8b')];var _0x14dfea={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x39c2('0x5d'),'AVG':_0x39c2('0x5e'),'GROUP_CONCAT':_0x39c2('0x5f'),'GROUP_CONCAT ASC':_0x39c2('0x60'),'GROUP_CONCAT DESC':_0x39c2('0x61')};var _0x456072={'SEC_TO_TIME':_0x39c2('0x62'),'DATE':_0x39c2('0x63'),'HOUR':_0x39c2('0xab'),'ROUND':_0x39c2('0x64'),'UNIX_TIMESTAMP':_0x39c2('0x65')};var _0x158fcc=function(_0x4798d6){return!_[_0x39c2('0x66')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x39c2('0x6a')],_0x4798d6);};var _0xad1d74=function(_0x290ed4){if(!_0x290ed4||!_0x290ed4[_0x39c2('0x6b')][_0x39c2('0x38')]){return'';}for(var _0x31c31c='(',_0x1aaa73=0x0;_0x1aaa73<_0x290ed4['rules']['length'];_0x1aaa73+=0x1){_0x1aaa73>0x0&&(_0x31c31c+='\x20'+_0x290ed4[_0x39c2('0x6c')]+'\x20');_0x31c31c+=_0x290ed4[_0x39c2('0x6b')][_0x1aaa73][_0x39c2('0x6d')]?_0xad1d74(_0x290ed4[_0x39c2('0x6b')][_0x1aaa73][_0x39c2('0x6d')]):_0x290ed4[_0x39c2('0x6b')][_0x1aaa73]['field']+'\x20'+_0x290ed4[_0x39c2('0x6b')][_0x1aaa73]['condition']+(_0x158fcc(_0x290ed4['rules'][_0x1aaa73][_0x39c2('0x6f')])?'\x20'+_0x290ed4[_0x39c2('0x6b')][_0x1aaa73]['value']:'');}return _0x31c31c+')';};var _0x1a2d73={'where':{'id':_0x26af86['params']['id']}},_0x246dff,_0x1ac7a9,_0x25c5cf,_0x378cfc,_0x14c0ef;_0x1a2d73=_[_0x39c2('0x3f')]({},_0x1a2d73,_0x26af86[_0x39c2('0x42')]);return db[_0x39c2('0x2e')][_0x39c2('0x4a')](_0x1a2d73)[_0x39c2('0x24')](function(_0x39d1d0){if(_0x39d1d0){_0x246dff=_0x39d1d0;return _0x39d1d0[_0x39c2('0x8d')]();}return null;})[_0x39c2('0x24')](function(_0x407540){if(_0x407540){if(!_0x407540[_0x39c2('0x38')]){throw new db[(_0x39c2('0x71'))][(_0x39c2('0x72'))](_0x39c2('0x73'),0x193);}_0x1ac7a9=_0x407540;return db[_0x39c2('0x74')]['findAll']({'raw':!![]});}return null;})[_0x39c2('0x24')](function(_0x475af0){if(_0x475af0){_0x25c5cf=_[_0x39c2('0x75')](_0x475af0,'id');var _0x591e2f;var _0x3842b1=squel[_0x39c2('0xac')]();_0x3842b1['from'](_0x246dff[_0x39c2('0x77')]);for(var _0x2e67bc=0x0;_0x2e67bc<_0x1ac7a9[_0x39c2('0x38')];_0x2e67bc+=0x1){_0x591e2f=_0x1ac7a9[_0x2e67bc][_0x39c2('0x78')]?_0x25c5cf[_0x1ac7a9[_0x2e67bc]['MetricId']][_0x39c2('0x79')]:_0x1ac7a9[_0x2e67bc][_0x39c2('0x6e')];_0x591e2f=_0x1ac7a9[_0x2e67bc]['function']?_[_0x39c2('0x7b')](_0x14dfea[_0x1ac7a9[_0x2e67bc][_0x39c2('0x7a')]],'%s',_0x591e2f):_0x591e2f;_0x591e2f=_0x1ac7a9[_0x2e67bc][_0x39c2('0x7c')]?_[_0x39c2('0x7b')](_0x456072[_0x1ac7a9[_0x2e67bc]['format']],'%s',_0x591e2f):_0x591e2f;if(_0x1ac7a9[_0x2e67bc][_0x39c2('0x7d')]){_0x3842b1[_0x39c2('0x6d')](_0x591e2f);}_0x1ac7a9[_0x2e67bc][_0x39c2('0x8e')]&&_0x3842b1[_0x39c2('0x8f')](_0x591e2f,_0x1ac7a9[_0x2e67bc][_0x39c2('0x8e')]==='DESC'?![]:!![]);_0x3842b1[_0x39c2('0x6e')](_0x591e2f,_0x1ac7a9[_0x2e67bc]['alias']||_0x591e2f);}if(_0x246dff['joins']){_0x246dff[_0x39c2('0x80')]=JSON[_0x39c2('0x86')](_0x246dff[_0x39c2('0x80')]);for(var _0x2d369a=0x0;_0x2d369a<_0x246dff['joins'][_0x39c2('0x38')];_0x2d369a+=0x1){if(_0x246dff['joins'][_0x2d369a][_0x39c2('0x40')]&&_['includes'](_0x26b93b,_0x246dff[_0x39c2('0x80')][_0x2d369a][_0x39c2('0x40')])&&_0x246dff[_0x39c2('0x80')][_0x2d369a]['parentKey']&&_0x246dff['joins'][_0x2d369a][_0x39c2('0x82')]&&_0x246dff[_0x39c2('0x80')][_0x2d369a][_0x39c2('0x83')]){_0x3842b1[_0x246dff[_0x39c2('0x80')][_0x2d369a]['type']](_0x246dff[_0x39c2('0x80')][_0x2d369a][_0x39c2('0x82')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x246dff[_0x39c2('0x77')],_0x246dff['joins'][_0x2d369a][_0x39c2('0x81')],_0x246dff[_0x39c2('0x80')][_0x2d369a][_0x39c2('0x82')],_0x246dff['joins'][_0x2d369a][_0x39c2('0x83')]));}}}if(_0x246dff[_0x39c2('0x85')]){_0x246dff[_0x39c2('0x85')]=JSON['parse'](_0x246dff[_0x39c2('0x85')]);_0x3842b1['where'](_0xad1d74(_0x246dff['conditions'][_0x39c2('0x6d')]));}_0x14c0ef=_0x3842b1[_0x39c2('0x90')]();_0x3842b1[_0x39c2('0x1d')](_0x5bf9d6);_0x3842b1[_0x39c2('0x1c')](0x0);logger[_0x39c2('0x87')](_0x39c2('0x91'),_0x3842b1[_0x39c2('0x88')]());return db[_0x39c2('0x89')][_0x39c2('0x32')](_0x3842b1[_0x39c2('0x88')](),{'type':db[_0x39c2('0x89')][_0x39c2('0x92')][_0x39c2('0x8a')]});}})[_0x39c2('0x24')](function(){return{'sql':_0x14c0ef['toString']()};})[_0x39c2('0x24')](respondWithResult(_0x87c8e8,null))['catch'](handleError(_0x87c8e8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5f03e52..4799f17 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 _0x76a4=['./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','bluebird','request-promise','path'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x76a4,0x136));var _0x476a=function(_0x4287a2,_0x288a84){_0x4287a2=_0x4287a2-0x0;var _0x16aa67=_0x76a4[_0x4287a2];return _0x16aa67;};'use strict';var _=require(_0x476a('0x0'));var util=require(_0x476a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x476a('0x2'));var rp=require(_0x476a('0x3'));var fs=require('fs');var path=require(_0x476a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x476a('0x5'));module[_0x476a('0x6')]=function(_0x2074cc,_0x2883f7){return _0x2074cc['define'](_0x476a('0x7'),attributes,{'tableName':_0x476a('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcae4=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3d7763,_0x12e2ef){var _0x2906ce=function(_0x364603){while(--_0x364603){_0x3d7763['push'](_0x3d7763['shift']());}};_0x2906ce(++_0x12e2ef);}(_0xcae4,0x65));var _0x4cae=function(_0x4b80e5,_0x3553e6){_0x4b80e5=_0x4b80e5-0x0;var _0x298493=_0xcae4[_0x4b80e5];return _0x298493;};'use strict';var _=require(_0x4cae('0x0'));var util=require(_0x4cae('0x1'));var logger=require(_0x4cae('0x2'))(_0x4cae('0x3'));var moment=require(_0x4cae('0x4'));var BPromise=require('bluebird');var rp=require(_0x4cae('0x5'));var fs=require('fs');var path=require(_0x4cae('0x6'));var rimraf=require(_0x4cae('0x7'));var config=require(_0x4cae('0x8'));var attributes=require(_0x4cae('0x9'));module[_0x4cae('0xa')]=function(_0xe04037,_0x13b502){return _0xe04037[_0x4cae('0xb')](_0x4cae('0xc'),attributes,{'tableName':_0x4cae('0xd'),'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 23900db..5da8b24 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 _0x2219=['error','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','request\x20sent','stringify','code'];(function(_0x43747e,_0x13b832){var _0x7fb853=function(_0x4b1028){while(--_0x4b1028){_0x43747e['push'](_0x43747e['shift']());}};_0x7fb853(++_0x13b832);}(_0x2219,0x9d));var _0x9221=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x2219[_0x461886];return _0x295e0a;};'use strict';var _=require(_0x9221('0x0'));var util=require(_0x9221('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9221('0x2'));var fs=require('fs');var Redis=require(_0x9221('0x3'));var db=require(_0x9221('0x4'))['db'];var utils=require(_0x9221('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9221('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9221('0x7')][_0x9221('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24546e,_0x4801b5,_0xef7a38){return new BPromise(function(_0x4a1c77,_0x3bdc6e){return client['request'](_0x24546e,_0xef7a38)[_0x9221('0x9')](function(_0x435bde){logger[_0x9221('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'),JSON[_0x9221('0xc')](_0x435bde));if(_0x435bde['error']){if(_0x435bde['error'][_0x9221('0xd')]===0x1f4){logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x435bde[_0x9221('0xe')][_0x9221('0x10')]);return _0x3bdc6e(_0x435bde[_0x9221('0xe')]['message']);}logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x435bde[_0x9221('0xe')]['message']);return _0x4a1c77(_0x435bde[_0x9221('0xe')]['message']);}else{logger[_0x9221('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'));_0x4a1c77(_0x435bde[_0x9221('0x11')]['message']);}})[_0x9221('0x12')](function(_0x86231f){logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x86231f);_0x3bdc6e(_0x86231f);});});} \ No newline at end of file +var _0x938e=['error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x17bcce,_0x39ec4a){var _0x47fccb=function(_0x4cd19b){while(--_0x4cd19b){_0x17bcce['push'](_0x17bcce['shift']());}};_0x47fccb(++_0x39ec4a);}(_0x938e,0x1ab));var _0xe938=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x938e[_0x2300c7];return _0x23f720;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe938('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe938('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe938('0x2'))(_0xe938('0x3'));var config=require(_0xe938('0x4'));var jayson=require(_0xe938('0x5'));var client=jayson[_0xe938('0x6')][_0xe938('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2502fd,_0x2b50f9,_0x11fe2e){return new BPromise(function(_0x3be28d,_0x5cd49d){return client['request'](_0x2502fd,_0x11fe2e)[_0xe938('0x8')](function(_0x270179){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x2b50f9,'request\x20sent');logger[_0xe938('0x9')](_0xe938('0xa'),_0x2b50f9,_0xe938('0xb'),JSON[_0xe938('0xc')](_0x270179));if(_0x270179['error']){if(_0x270179[_0xe938('0xd')][_0xe938('0xe')]===0x1f4){logger[_0xe938('0xd')](_0xe938('0xf'),_0x2b50f9,_0x270179[_0xe938('0xd')][_0xe938('0x10')]);return _0x5cd49d(_0x270179[_0xe938('0xd')][_0xe938('0x10')]);}logger['error'](_0xe938('0xf'),_0x2b50f9,_0x270179[_0xe938('0xd')][_0xe938('0x10')]);return _0x3be28d(_0x270179[_0xe938('0xd')][_0xe938('0x10')]);}else{logger[_0xe938('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2b50f9,_0xe938('0xb'));_0x3be28d(_0x270179[_0xe938('0x12')][_0xe938('0x10')]);}})[_0xe938('0x13')](function(_0x17fb48){logger['error'](_0xe938('0xf'),_0x2b50f9,_0x17fb48);_0x5cd49d(_0x17fb48);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9a9fa23..6ce8fea 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 _0x995a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','run','post','create','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x357236,_0x4ed379){var _0x4e6626=function(_0x4eb4db){while(--_0x4eb4db){_0x357236['push'](_0x357236['shift']());}};_0x4e6626(++_0x4ed379);}(_0x995a,0xd8));var _0xa995=function(_0x95dfb1,_0x3c3d38){_0x95dfb1=_0x95dfb1-0x0;var _0x3e5ea4=_0x995a[_0x95dfb1];return _0x3e5ea4;};'use strict';var multer=require(_0xa995('0x0'));var util=require(_0xa995('0x1'));var path=require('path');var timeout=require(_0xa995('0x2'));var express=require(_0xa995('0x3'));var router=express[_0xa995('0x4')]();var auth=require(_0xa995('0x5'));var interaction=require(_0xa995('0x6'));var config=require(_0xa995('0x7'));var controller=require(_0xa995('0x8'));router[_0xa995('0x9')]('/',auth[_0xa995('0xa')](),controller['index']);router['get'](_0xa995('0xb'),auth['isAuthenticated'](),controller[_0xa995('0xc')]);router[_0xa995('0x9')](_0xa995('0xd'),auth[_0xa995('0xa')](),controller['preview']);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xa995('0xe')]);router[_0xa995('0x9')]('/:id/query',auth[_0xa995('0xa')](),controller['query']);router[_0xa995('0xf')]('/',auth[_0xa995('0xa')](),controller[_0xa995('0x10')]);router['put'](_0xa995('0xb'),auth[_0xa995('0xa')](),controller[_0xa995('0x11')]);router['delete'](_0xa995('0xb'),auth['isAuthenticated'](),controller[_0xa995('0x12')]);module[_0xa995('0x13')]=router; \ No newline at end of file +var _0xb786=['isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x569f52,_0xb3e0f){var _0x5df031=function(_0x5b965a){while(--_0x5b965a){_0x569f52['push'](_0x569f52['shift']());}};_0x5df031(++_0xb3e0f);}(_0xb786,0x88));var _0x6b78=function(_0x5d27bc,_0x3a7b60){_0x5d27bc=_0x5d27bc-0x0;var _0x5734cc=_0xb786[_0x5d27bc];return _0x5734cc;};'use strict';var multer=require(_0x6b78('0x0'));var util=require(_0x6b78('0x1'));var path=require(_0x6b78('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b78('0x3'));var router=express['Router']();var auth=require(_0x6b78('0x4'));var interaction=require(_0x6b78('0x5'));var config=require(_0x6b78('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x6b78('0x7')]('/',auth[_0x6b78('0x8')](),controller[_0x6b78('0x9')]);router[_0x6b78('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6b78('0x7')](_0x6b78('0xa'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xb')]);router['get'](_0x6b78('0xc'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xd')]);router['get'](_0x6b78('0xe'),auth[_0x6b78('0x8')](),controller[_0x6b78('0xf')]);router[_0x6b78('0x10')]('/',auth[_0x6b78('0x8')](),controller[_0x6b78('0x11')]);router[_0x6b78('0x12')](_0x6b78('0x13'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x14')]);router[_0x6b78('0x15')](_0x6b78('0x13'),auth[_0x6b78('0x8')](),controller[_0x6b78('0x16')]);module[_0x6b78('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 08c52b3..803f288 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 _0x029c=['STRING','TEXT','exports'];(function(_0x713a06,_0x2eebcb){var _0x4844e7=function(_0x702361){while(--_0x702361){_0x713a06['push'](_0x713a06['shift']());}};_0x4844e7(++_0x2eebcb);}(_0x029c,0x1ac));var _0xc029=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x029c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc029('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc029('0x1')]},'parent':{'type':Sequelize[_0xc029('0x1')]},'table':{'type':Sequelize[_0xc029('0x1')]},'conditions':{'type':Sequelize[_0xc029('0x2')]},'joins':{'type':Sequelize[_0xc029('0x2')]}}; \ No newline at end of file +var _0x0b94=['TEXT','sequelize','STRING'];(function(_0x425fa4,_0x57779f){var _0x2802d5=function(_0xefd94a){while(--_0xefd94a){_0x425fa4['push'](_0x425fa4['shift']());}};_0x2802d5(++_0x57779f);}(_0x0b94,0x13f));var _0x40b9=function(_0x43b4b5,_0x529f1c){_0x43b4b5=_0x43b4b5-0x0;var _0x472201=_0x0b94[_0x43b4b5];return _0x472201;};'use strict';var Sequelize=require(_0x40b9('0x0'));module['exports']={'name':{'type':Sequelize[_0x40b9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x40b9('0x1')]},'parent':{'type':Sequelize[_0x40b9('0x1')]},'table':{'type':Sequelize[_0x40b9('0x1')]},'conditions':{'type':Sequelize[_0x40b9('0x2')]},'joins':{'type':Sequelize[_0x40b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 3b924b7..abb7097 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 _0x3549=['orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','ValidationErrorItem','keyBy','select','groupBy','debug','web','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','run','AVG(%s)','HOUR(%s)','ROUND(%s)','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','from','table','MetricId','metric','replace','function','format'];(function(_0x23c791,_0xa8bee3){var _0x57b777=function(_0x25f8c4){while(--_0x25f8c4){_0x23c791['push'](_0x23c791['shift']());}};_0x57b777(++_0xa8bee3);}(_0x3549,0x179));var _0x9354=function(_0x375921,_0x5c862e){_0x375921=_0x375921-0x0;var _0x1eba9a=_0x3549[_0x375921];return _0x1eba9a;};'use strict';var pdf=require(_0x9354('0x0'));var emlformat=require(_0x9354('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9354('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9354('0x3'));var moment=require(_0x9354('0x4'));var BPromise=require(_0x9354('0x5'));var Mustache=require(_0x9354('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9354('0x7'));var ejs=require(_0x9354('0x8'));var fs=require('fs');var _=require(_0x9354('0x9'));var squel=require(_0x9354('0xa'));var crypto=require(_0x9354('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9354('0xc'));var toCsv=require(_0x9354('0x7'));var querystring=require(_0x9354('0xd'));var Papa=require(_0x9354('0xe'));var Redis=require(_0x9354('0xf'));var authService=require(_0x9354('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9354('0x11'));var hardwareService=require(_0x9354('0x12'));var logger=require('../../config/logger')(_0x9354('0x13'));var utils=require('../../config/utils');var config=require(_0x9354('0x14'));var licenseUtil=require(_0x9354('0x15'));var db=require(_0x9354('0x16'))['db'];var dbH=require(_0x9354('0x16'))['dbH'];function respondWithStatusCode(_0x96704b,_0x1e0a89){_0x1e0a89=_0x1e0a89||0xcc;return function(_0x5f464e){if(_0x5f464e){return _0x96704b[_0x9354('0x17')](_0x1e0a89);}return _0x96704b[_0x9354('0x18')](_0x1e0a89)['end']();};}function respondWithResult(_0x9d6faf,_0x5b5d9a){_0x5b5d9a=_0x5b5d9a||0xc8;return function(_0x104700){if(_0x104700){return _0x9d6faf[_0x9354('0x18')](_0x5b5d9a)[_0x9354('0x19')](_0x104700);}};}function respondWithFilteredResult(_0x5494cf,_0x41ab57){return function(_0x115454){if(_0x115454){var _0x39a892=_0x115454[_0x9354('0x1a')],_0x56a948=_0x41ab57[_0x9354('0x1b')],_0x3f02ce=_0x41ab57[_0x9354('0x1b')]+_0x41ab57[_0x9354('0x1c')],_0x7c0c15;if(_0x3f02ce>=_0x39a892){_0x3f02ce=_0x39a892;_0x7c0c15=0xc8;}else{_0x7c0c15=0xce;}_0x5494cf[_0x9354('0x18')](_0x7c0c15);return _0x5494cf[_0x9354('0x1d')]('Content-Range',_0x56a948+'-'+_0x3f02ce+'/'+_0x39a892)[_0x9354('0x19')](_0x115454);}return null;};}function patchUpdates(_0x30b8d3){return function(_0x1a91d5){try{jsonpatch[_0x9354('0x1e')](_0x1a91d5,_0x30b8d3,!![]);}catch(_0x8729b6){return BPromise[_0x9354('0x1f')](_0x8729b6);}return _0x1a91d5[_0x9354('0x20')]();};}function saveUpdates(_0x47676b,_0x18c98a){return function(_0x5c73ec){if(_0x5c73ec){return _0x5c73ec[_0x9354('0x21')](_0x47676b)[_0x9354('0x22')](function(_0x1e6315){return _0x1e6315;});}return null;};}function removeEntity(_0x680d44,_0x141a2f){return function(_0x1e156e){if(_0x1e156e){return _0x1e156e[_0x9354('0x23')]()[_0x9354('0x22')](function(){var _0x11a245=_0x1e156e[_0x9354('0x24')]({'plain':!![]});var _0x392265='DefaultReports';return db[_0x9354('0x25')][_0x9354('0x23')]({'where':{'type':_0x392265,'resourceId':_0x11a245['id']}})['then'](function(){return _0x1e156e;});})[_0x9354('0x22')](function(){_0x680d44[_0x9354('0x18')](0xcc)[_0x9354('0x26')]();});}};}function handleEntityNotFound(_0x29113c,_0x4f90b2){return function(_0x5dc490){if(!_0x5dc490){_0x29113c[_0x9354('0x17')](0x194);}return _0x5dc490;};}function handleError(_0xe627d0,_0x3dbe20){_0x3dbe20=_0x3dbe20||0x1f4;return function(_0xb2f424){logger[_0x9354('0x27')](_0xb2f424[_0x9354('0x28')]);if(_0xb2f424[_0x9354('0x29')]){delete _0xb2f424[_0x9354('0x29')];}_0xe627d0[_0x9354('0x18')](_0x3dbe20)[_0x9354('0x2a')](_0xb2f424);};}exports[_0x9354('0x2b')]=function(_0x55407c,_0x4d8491){var _0x2f3aab={},_0x2df35a={},_0x504f61={'count':0x0,'rows':[]};var _0xf7978f=_[_0x9354('0x2c')](db[_0x9354('0x2d')][_0x9354('0x2e')],function(_0x281fc4){return{'name':_0x281fc4[_0x9354('0x2f')],'type':_0x281fc4[_0x9354('0x30')][_0x9354('0x31')]};});_0x2df35a[_0x9354('0x32')]=_[_0x9354('0x2c')](_0xf7978f,_0x9354('0x29'));_0x2df35a['query']=_['keys'](_0x55407c['query']);_0x2df35a[_0x9354('0x33')]=_[_0x9354('0x34')](_0x2df35a[_0x9354('0x32')],_0x2df35a[_0x9354('0x35')]);_0x2f3aab[_0x9354('0x36')]=_[_0x9354('0x34')](_0x2df35a['model'],qs[_0x9354('0x37')](_0x55407c[_0x9354('0x35')][_0x9354('0x37')]));_0x2f3aab[_0x9354('0x36')]=_0x2f3aab[_0x9354('0x36')][_0x9354('0x38')]?_0x2f3aab[_0x9354('0x36')]:_0x2df35a[_0x9354('0x32')];if(!_0x55407c[_0x9354('0x35')][_0x9354('0x39')](_0x9354('0x3a'))){_0x2f3aab['limit']=qs['limit'](_0x55407c[_0x9354('0x35')][_0x9354('0x1c')]);_0x2f3aab[_0x9354('0x1b')]=qs[_0x9354('0x1b')](_0x55407c[_0x9354('0x35')]['offset']);}_0x2f3aab[_0x9354('0x3b')]=qs[_0x9354('0x3c')](_0x55407c[_0x9354('0x35')][_0x9354('0x3c')]);_0x2f3aab['where']=qs[_0x9354('0x33')](_[_0x9354('0x3d')](_0x55407c[_0x9354('0x35')],_0x2df35a[_0x9354('0x33')]),_0xf7978f);if(_0x55407c[_0x9354('0x35')][_0x9354('0x3e')]){_0x2f3aab[_0x9354('0x3f')]=_[_0x9354('0x40')](_0x2f3aab[_0x9354('0x3f')],{'$or':_[_0x9354('0x2c')](_0xf7978f,function(_0x50eaec){if(_0x50eaec[_0x9354('0x30')]!=='VIRTUAL'){var _0x586ea5={};_0x586ea5[_0x50eaec[_0x9354('0x29')]]={'$like':'%'+_0x55407c[_0x9354('0x35')][_0x9354('0x3e')]+'%'};return _0x586ea5;}})});}_0x2f3aab=_[_0x9354('0x40')]({},_0x2f3aab,_0x55407c[_0x9354('0x41')]);var _0x329013={'where':_0x2f3aab[_0x9354('0x3f')]};return db[_0x9354('0x2d')][_0x9354('0x1a')](_0x329013)[_0x9354('0x22')](function(_0x4304af){_0x504f61['count']=_0x4304af;if(_0x55407c[_0x9354('0x35')]['includeAll']){_0x2f3aab[_0x9354('0x42')]=[{'all':!![]}];}return db[_0x9354('0x2d')][_0x9354('0x43')](_0x2f3aab);})[_0x9354('0x22')](function(_0x2b9b95){_0x504f61['rows']=_0x2b9b95;return _0x504f61;})[_0x9354('0x22')](respondWithFilteredResult(_0x4d8491,_0x2f3aab))[_0x9354('0x44')](handleError(_0x4d8491,null));};exports[_0x9354('0x45')]=function(_0x19975a,_0x589f9d){var _0x2c0aee={'raw':!![],'where':{'id':_0x19975a[_0x9354('0x46')]['id']}},_0x455bd5={};_0x455bd5[_0x9354('0x32')]=_[_0x9354('0x47')](db['AnalyticDefaultReport'][_0x9354('0x2e')]);_0x455bd5[_0x9354('0x35')]=_['keys'](_0x19975a[_0x9354('0x35')]);_0x455bd5[_0x9354('0x33')]=_[_0x9354('0x34')](_0x455bd5[_0x9354('0x32')],_0x455bd5['query']);_0x2c0aee[_0x9354('0x36')]=_[_0x9354('0x34')](_0x455bd5[_0x9354('0x32')],qs[_0x9354('0x37')](_0x19975a['query']['fields']));_0x2c0aee[_0x9354('0x36')]=_0x2c0aee[_0x9354('0x36')][_0x9354('0x38')]?_0x2c0aee['attributes']:_0x455bd5[_0x9354('0x32')];if(_0x19975a[_0x9354('0x35')][_0x9354('0x48')]){_0x2c0aee[_0x9354('0x42')]=[{'all':!![]}];}_0x2c0aee=_[_0x9354('0x40')]({},_0x2c0aee,_0x19975a[_0x9354('0x41')]);return db[_0x9354('0x2d')][_0x9354('0x49')](_0x2c0aee)[_0x9354('0x22')](handleEntityNotFound(_0x589f9d,null))[_0x9354('0x22')](respondWithResult(_0x589f9d,null))[_0x9354('0x44')](handleError(_0x589f9d,null));};exports['create']=function(_0x3f3555,_0x3e6cee){return db[_0x9354('0x2d')][_0x9354('0x4a')](_0x3f3555[_0x9354('0x4b')],{})[_0x9354('0x22')](function(_0x5562bb){var _0x216668=_0x3f3555[_0x9354('0x4c')][_0x9354('0x24')]({'plain':!![]});if(!_0x216668)throw new Error(_0x9354('0x4d'));if(_0x216668[_0x9354('0x4e')]===_0x9354('0x4c')){var _0xd68920=_0x5562bb[_0x9354('0x24')]({'plain':!![]});var _0x14d32c=_0x9354('0x4f');return db[_0x9354('0x50')][_0x9354('0x49')]({'where':{'name':_0x14d32c,'userProfileId':_0x216668[_0x9354('0x51')]},'raw':!![]})[_0x9354('0x22')](function(_0x51a7bb){if(_0x51a7bb&&_0x51a7bb[_0x9354('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0xd68920[_0x9354('0x29')],'resourceId':_0xd68920['id'],'type':'DefaultReports','sectionId':_0x51a7bb['id']},{})[_0x9354('0x22')](function(){return _0x5562bb;});}else{return _0x5562bb;}})['catch'](function(_0x51fa71){logger[_0x9354('0x27')](_0x9354('0x53'),_0x51fa71);throw _0x51fa71;});}return _0x5562bb;})['then'](respondWithResult(_0x3e6cee,0xc9))[_0x9354('0x44')](handleError(_0x3e6cee,null));};exports[_0x9354('0x21')]=function(_0x36184a,_0x53284c){if(_0x36184a[_0x9354('0x4b')]['id']){delete _0x36184a[_0x9354('0x4b')]['id'];}return db[_0x9354('0x2d')][_0x9354('0x49')]({'where':{'id':_0x36184a[_0x9354('0x46')]['id']}})[_0x9354('0x22')](handleEntityNotFound(_0x53284c,null))['then'](saveUpdates(_0x36184a[_0x9354('0x4b')],null))[_0x9354('0x22')](respondWithResult(_0x53284c,null))[_0x9354('0x44')](handleError(_0x53284c,null));};exports[_0x9354('0x23')]=function(_0x3e4912,_0x56673f){return db[_0x9354('0x2d')][_0x9354('0x49')]({'where':{'id':_0x3e4912[_0x9354('0x46')]['id']}})[_0x9354('0x22')](handleEntityNotFound(_0x56673f,null))['then'](removeEntity(_0x56673f,null))[_0x9354('0x44')](handleError(_0x56673f,null));};exports[_0x9354('0x54')]=function(_0x1ed0cd,_0x40c8d5){var _0x505b4c=0xa;var _0xb3def9=['join',_0x9354('0x55'),_0x9354('0x56'),_0x9354('0x57')];var _0x4a3e5d={'SUM':'SUM(%s)','COUNT':_0x9354('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9354('0x59'),'MIN':_0x9354('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9354('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9354('0x5c')};var _0x5b3433={'SEC_TO_TIME':_0x9354('0x5d'),'DATE':_0x9354('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9354('0x5f')};var _0x50e5f3=function(_0x51f6f6){return!_['includes']([_0x9354('0x60'),_0x9354('0x61'),'IS\x20EMPTY',_0x9354('0x62')],_0x51f6f6);};var _0x2d0f68=function(_0x1df7ba){if(!_0x1df7ba||!_0x1df7ba[_0x9354('0x63')][_0x9354('0x38')]){return'';}for(var _0x28fad9='(',_0x51d1c1=0x0;_0x51d1c1<_0x1df7ba[_0x9354('0x63')][_0x9354('0x38')];_0x51d1c1+=0x1){_0x51d1c1>0x0&&(_0x28fad9+='\x20'+_0x1df7ba[_0x9354('0x64')]+'\x20');_0x28fad9+=_0x1df7ba['rules'][_0x51d1c1][_0x9354('0x65')]?_0x2d0f68(_0x1df7ba['rules'][_0x51d1c1][_0x9354('0x65')]):_0x1df7ba['rules'][_0x51d1c1][_0x9354('0x66')]+'\x20'+_0x1df7ba[_0x9354('0x63')][_0x51d1c1][_0x9354('0x67')]+(_0x50e5f3(_0x1df7ba[_0x9354('0x63')][_0x51d1c1][_0x9354('0x67')])?'\x20'+_0x1df7ba[_0x9354('0x63')][_0x51d1c1][_0x9354('0x68')]:'');}return _0x28fad9+')';};var _0x2b9306={'where':{'id':_0x1ed0cd[_0x9354('0x46')]['id']}},_0x10736e,_0x3cae02,_0x15c9b1,_0x82122f,_0x2ccef2;_0x2b9306=_[_0x9354('0x40')]({},_0x2b9306,_0x1ed0cd[_0x9354('0x41')]);return db['AnalyticDefaultReport'][_0x9354('0x49')](_0x2b9306)[_0x9354('0x22')](function(_0x2e8f75){if(_0x2e8f75){_0x10736e=_0x2e8f75;return _0x2e8f75[_0x9354('0x69')]();}return null;})[_0x9354('0x22')](function(_0x49b24b){if(_0x49b24b){if(!_0x49b24b[_0x9354('0x38')]){throw new db[(_0x9354('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cae02=_0x49b24b;return db[_0x9354('0x6b')][_0x9354('0x43')]({'raw':!![]});}return null;})[_0x9354('0x22')](function(_0x2ef277){if(_0x2ef277){_0x15c9b1=_['keyBy'](_0x2ef277,'id');var _0x26809e;var _0x3b22d0=squel['select']();_0x3b22d0[_0x9354('0x6c')](_0x10736e[_0x9354('0x6d')]);for(var _0x2b893e=0x0;_0x2b893e<_0x3cae02[_0x9354('0x38')];_0x2b893e+=0x1){_0x26809e=_0x3cae02[_0x2b893e][_0x9354('0x6e')]?_0x15c9b1[_0x3cae02[_0x2b893e][_0x9354('0x6e')]][_0x9354('0x6f')]:_0x3cae02[_0x2b893e][_0x9354('0x66')];_0x26809e=_0x3cae02[_0x2b893e]['function']?_[_0x9354('0x70')](_0x4a3e5d[_0x3cae02[_0x2b893e][_0x9354('0x71')]],'%s',_0x26809e):_0x26809e;_0x26809e=_0x3cae02[_0x2b893e][_0x9354('0x72')]?_['replace'](_0x5b3433[_0x3cae02[_0x2b893e]['format']],'%s',_0x26809e):_0x26809e;if(_0x3cae02[_0x2b893e]['groupBy']){_0x3b22d0[_0x9354('0x65')](_0x26809e);}_0x3cae02[_0x2b893e][_0x9354('0x73')]&&_0x3b22d0['order'](_0x26809e,_0x3cae02[_0x2b893e]['orderBy']===_0x9354('0x74')?![]:!![]);_0x3b22d0[_0x9354('0x66')](_0x26809e,_0x3cae02[_0x2b893e][_0x9354('0x75')]||_0x26809e);}if(_0x10736e[_0x9354('0x76')]){_0x10736e['joins']=JSON[_0x9354('0x77')](_0x10736e['joins']);for(var _0x45ba38=0x0;_0x45ba38<_0x10736e[_0x9354('0x76')][_0x9354('0x38')];_0x45ba38+=0x1){if(_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x30')]&&_[_0x9354('0x78')](_0xb3def9,_0x10736e['joins'][_0x45ba38]['type'])&&_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x79')]&&_0x10736e['joins'][_0x45ba38][_0x9354('0x7a')]&&_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x7b')]){_0x3b22d0[_0x10736e['joins'][_0x45ba38][_0x9354('0x30')]](_0x10736e[_0x9354('0x76')][_0x45ba38]['foreignTable'],null,util[_0x9354('0x72')](_0x9354('0x7c'),_0x10736e[_0x9354('0x6d')],_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x79')],_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x7a')],_0x10736e[_0x9354('0x76')][_0x45ba38]['foreignKey']));}}}if(_0x10736e[_0x9354('0x7d')]){_0x10736e[_0x9354('0x7d')]=JSON[_0x9354('0x77')](_0x10736e[_0x9354('0x7d')]);_0x3b22d0['where'](_0x2d0f68(_0x10736e[_0x9354('0x7d')][_0x9354('0x65')]));}_0x2ccef2=_0x3b22d0[_0x9354('0x7e')]();_0x3b22d0['limit'](_0x505b4c);_0x3b22d0[_0x9354('0x1b')](0x0);logger['debug'](_0x9354('0x7f'),_0x3b22d0[_0x9354('0x80')]());return db[_0x9354('0x81')]['query'](_0x3b22d0[_0x9354('0x80')](),{'type':db['sequelize'][_0x9354('0x82')][_0x9354('0x83')]});}})[_0x9354('0x22')](respondWithResult(_0x40c8d5,null))[_0x9354('0x44')](handleError(_0x40c8d5,null));};function runReport(_0x4e21e4,_0x2ce213,_0x466b83){var _0x2893d6=_0x2ce213[_0x9354('0x29')];var _0x40ec3f=0xa;var _0xa780fe=['join',_0x9354('0x55'),'right_join',_0x9354('0x57')];var _0x423598={'SUM':_0x9354('0x84'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9354('0x85'),'MAX':_0x9354('0x59'),'MIN':_0x9354('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9354('0x5c')};var _0x211816={'SEC_TO_TIME':_0x9354('0x5d'),'DATE':_0x9354('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9354('0x5f')};var _0x3f7ef9=function(_0x1241c0){return!_[_0x9354('0x78')]([_0x9354('0x60'),'IS\x20NOT\x20NULL',_0x9354('0x86'),_0x9354('0x62')],_0x1241c0);};var _0x16771d=function(_0x3a30e1){if(!_0x3a30e1||!_0x3a30e1[_0x9354('0x63')][_0x9354('0x38')]){return'';}for(var _0x3dcfb6='(',_0x538499=0x0;_0x538499<_0x3a30e1[_0x9354('0x63')][_0x9354('0x38')];_0x538499+=0x1){_0x538499>0x0&&(_0x3dcfb6+='\x20'+_0x3a30e1[_0x9354('0x64')]+'\x20');_0x3dcfb6+=_0x3a30e1['rules'][_0x538499][_0x9354('0x65')]?_0x16771d(_0x3a30e1[_0x9354('0x63')][_0x538499]['group']):_0x3a30e1['rules'][_0x538499]['field']+'\x20'+_0x3a30e1['rules'][_0x538499]['condition']+(_0x3f7ef9(_0x3a30e1[_0x9354('0x63')][_0x538499]['condition'])?'\x20'+_0x3a30e1[_0x9354('0x63')][_0x538499]['value']:'');}return _0x3dcfb6+')';};var _0x270e38={'where':{'id':_0x4e21e4['id']}},_0x2743a4,_0x28cea0,_0x190f93,_0x557706,_0x47f024;_0x270e38=_[_0x9354('0x40')]({},_0x270e38,_0x466b83);return db['AnalyticDefaultReport'][_0x9354('0x49')](_0x270e38)[_0x9354('0x22')](function(_0x24728f){if(_0x24728f){_0x2743a4=_0x24728f;return _0x24728f['getFields']();}return null;})['then'](function(_0x2a3aaf){if(_0x2a3aaf){if(!_0x2a3aaf[_0x9354('0x38')]){throw new db[(_0x9354('0x6a'))][(_0x9354('0x87'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x28cea0=_0x2a3aaf;return db['AnalyticMetric'][_0x9354('0x43')]({'raw':!![]});}return null;})[_0x9354('0x22')](function(_0x33f738){if(_0x33f738){_0x190f93=_[_0x9354('0x88')](_0x33f738,'id');var _0xeeaf81;var _0x59ca22=squel[_0x9354('0x89')]();_0x59ca22[_0x9354('0x6c')](_0x2743a4[_0x9354('0x6d')]);for(var _0x43b0e9=0x0;_0x43b0e9<_0x28cea0[_0x9354('0x38')];_0x43b0e9+=0x1){_0xeeaf81=_0x28cea0[_0x43b0e9][_0x9354('0x6e')]?_0x190f93[_0x28cea0[_0x43b0e9][_0x9354('0x6e')]][_0x9354('0x6f')]:_0x28cea0[_0x43b0e9]['field'];_0xeeaf81=_0x28cea0[_0x43b0e9][_0x9354('0x71')]?_[_0x9354('0x70')](_0x423598[_0x28cea0[_0x43b0e9]['function']],'%s',_0xeeaf81):_0xeeaf81;_0xeeaf81=_0x28cea0[_0x43b0e9][_0x9354('0x72')]?_[_0x9354('0x70')](_0x211816[_0x28cea0[_0x43b0e9][_0x9354('0x72')]],'%s',_0xeeaf81):_0xeeaf81;if(_0x28cea0[_0x43b0e9][_0x9354('0x8a')]){_0x59ca22['group'](_0xeeaf81);}_0x28cea0[_0x43b0e9][_0x9354('0x73')]&&_0x59ca22[_0x9354('0x3b')](_0xeeaf81,_0x28cea0[_0x43b0e9]['orderBy']===_0x9354('0x74')?![]:!![]);_0x59ca22[_0x9354('0x66')](_0xeeaf81,_0x28cea0[_0x43b0e9][_0x9354('0x75')]||_0xeeaf81);}if(_0x2743a4['joins']){_0x2743a4['joins']=JSON[_0x9354('0x77')](_0x2743a4[_0x9354('0x76')]);for(var _0x18451=0x0;_0x18451<_0x2743a4['joins'][_0x9354('0x38')];_0x18451+=0x1){if(_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x30')]&&_[_0x9354('0x78')](_0xa780fe,_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x30')])&&_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x79')]&&_0x2743a4['joins'][_0x18451][_0x9354('0x7a')]&&_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x7b')]){_0x59ca22[_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x30')]](_0x2743a4['joins'][_0x18451][_0x9354('0x7a')],null,util[_0x9354('0x72')]('%s.%s\x20=\x20%s.%s',_0x2743a4[_0x9354('0x6d')],_0x2743a4[_0x9354('0x76')][_0x18451]['parentKey'],_0x2743a4['joins'][_0x18451]['foreignTable'],_0x2743a4[_0x9354('0x76')][_0x18451]['foreignKey']));}}}if(_0x2743a4[_0x9354('0x7d')]){_0x2743a4[_0x9354('0x7d')]=JSON[_0x9354('0x77')](_0x2743a4[_0x9354('0x7d')]);_0x59ca22[_0x9354('0x3f')](_0x16771d(_0x2743a4[_0x9354('0x7d')][_0x9354('0x65')]));}_0x47f024=_0x59ca22['clone']();_0x59ca22['limit'](_0x40ec3f);_0x59ca22[_0x9354('0x1b')](0x0);logger[_0x9354('0x8b')]('Limited\x20Query:',_0x59ca22['toString']());return db['sequelize']['query'](_0x59ca22['toString'](),{'type':db[_0x9354('0x81')][_0x9354('0x82')][_0x9354('0x83')]});}})[_0x9354('0x22')](function(_0x55586d){if(!_0x55586d[_0x9354('0x38')]){throw new db['Sequelize'][(_0x9354('0x87'))]('No\x20available\x20data',0xcc);}if(_0x2ce213['output']===_0x9354('0x8c')){return null;}var _0x449bea=_[_0x9354('0x40')](_0x2ce213,{'name':_0x2ce213['fullPath']||_0x2ce213[_0x9354('0x29')]||_0x2743a4[_0x9354('0x29')],'basename':_0x2893d6,'savename':util['format'](_0x9354('0x8d'),_0x2ce213[_0x9354('0x29')]||_0x2743a4[_0x9354('0x29')],require(_0x9354('0x8e'))[_0x9354('0x8f')](0x4),_0x2ce213['output']||_0x9354('0x90')),'reportId':_0x2743a4['id'],'reportType':_0x9354('0x91')});return db[_0x9354('0x92')][_0x9354('0x4a')](_0x449bea,{'raw':!![]});})[_0x9354('0x22')](function(_0x3fbaf5){if(_0x2743a4['table']===_0x9354('0x93')){_0x47f024[_0x9354('0x3f')](_0x2743a4[_0x9354('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2ce213[_0x9354('0x94')],_0x2ce213[_0x9354('0x95')]);}else{_0x47f024[_0x9354('0x3f')](_0x2743a4[_0x9354('0x6d')]+_0x9354('0x96'),_0x2ce213[_0x9354('0x94')],_0x2ce213[_0x9354('0x95')]);}if(_0x3fbaf5){logger[_0x9354('0x97')](_0x9354('0x98'),_0x47f024[_0x9354('0x80')]());require('child_process')[_0x9354('0x99')](path['join'](__dirname,_0x9354('0x9a'),_0x3fbaf5[_0x9354('0x9b')]),[_0x3fbaf5['id'],_0x47f024[_0x9354('0x80')](),path['join'](__dirname,_0x9354('0x9c'),_0x3fbaf5[_0x9354('0x9d')]),_0x2893d6]);return _0x3fbaf5;}else{var _0x4a8017=squel[_0x9354('0x89')]();_0x4a8017[_0x9354('0x6c')]('('+_0x47f024[_0x9354('0x80')]()+')',_0x9354('0x9e'));_0x4a8017['field'](_0x9354('0x9f'),_0x9354('0x1a'));_0x47f024[_0x9354('0x1c')](_0x2ce213[_0x9354('0x1c')]||_0x40ec3f);_0x47f024[_0x9354('0x1b')](_0x2ce213[_0x9354('0x1b')]||0x0);return dbH['sequelize']['query'](_0x4a8017[_0x9354('0x80')](),{'type':dbH[_0x9354('0x81')]['QueryTypes'][_0x9354('0x83')]})[_0x9354('0x22')](function(_0x5f0474){if(!_0x5f0474[_0x9354('0x38')]){_0x557706=0x0;}else{_0x557706=_0x5f0474[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x47f024[_0x9354('0x80')](),{'type':dbH[_0x9354('0x81')]['QueryTypes'][_0x9354('0x83')]});})[_0x9354('0x22')](function(_0x418ec1){return{'rows':_0x418ec1||[],'count':_0x557706};});}});}exports[_0x9354('0xa0')]=function(_0x4f377f,_0x55c6fc){return runReport(_0x4f377f[_0x9354('0x46')],_0x4f377f[_0x9354('0x35')],_0x4f377f[_0x9354('0x41')])[_0x9354('0x22')](respondWithResult(_0x55c6fc,null))[_0x9354('0x44')](handleError(_0x55c6fc,null));};exports['runReport']=runReport;exports[_0x9354('0x35')]=function(_0x320e33,_0x5958d4){var _0x1f2e1e=0xa;var _0x6e95c5=['join',_0x9354('0x55'),'right_join',_0x9354('0x57')];var _0x45e766={'SUM':'SUM(%s)','COUNT':_0x9354('0x58'),'COUNT DISTINCT':_0x9354('0x85'),'MAX':_0x9354('0x59'),'MIN':_0x9354('0x5a'),'AVG':_0x9354('0xa1'),'GROUP_CONCAT':_0x9354('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc43b55={'SEC_TO_TIME':_0x9354('0x5d'),'DATE':'DATE(%s)','HOUR':_0x9354('0xa2'),'ROUND':_0x9354('0xa3'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x51e66b=function(_0x16e279){return!_[_0x9354('0x78')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x9354('0x86'),_0x9354('0x62')],_0x16e279);};var _0x287bbf=function(_0xd540b6){if(!_0xd540b6||!_0xd540b6[_0x9354('0x63')][_0x9354('0x38')]){return'';}for(var _0x2e0195='(',_0x20f770=0x0;_0x20f770<_0xd540b6[_0x9354('0x63')][_0x9354('0x38')];_0x20f770+=0x1){_0x20f770>0x0&&(_0x2e0195+='\x20'+_0xd540b6[_0x9354('0x64')]+'\x20');_0x2e0195+=_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x65')]?_0x287bbf(_0xd540b6[_0x9354('0x63')][_0x20f770]['group']):_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x66')]+'\x20'+_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x67')]+(_0x51e66b(_0xd540b6[_0x9354('0x63')][_0x20f770]['condition'])?'\x20'+_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x68')]:'');}return _0x2e0195+')';};var _0x2f2283={'where':{'id':_0x320e33['params']['id']}},_0x592e4c,_0x2ca80d,_0x35baa7,_0x3e0b88,_0x595012;_0x2f2283=_[_0x9354('0x40')]({},_0x2f2283,_0x320e33[_0x9354('0x41')]);return db[_0x9354('0x2d')][_0x9354('0x49')](_0x2f2283)[_0x9354('0x22')](function(_0x6ac0ac){if(_0x6ac0ac){_0x592e4c=_0x6ac0ac;return _0x6ac0ac[_0x9354('0x69')]();}return null;})[_0x9354('0x22')](function(_0x120645){if(_0x120645){if(!_0x120645[_0x9354('0x38')]){throw new db[(_0x9354('0x6a'))][(_0x9354('0x87'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ca80d=_0x120645;return db[_0x9354('0x6b')][_0x9354('0x43')]({'raw':!![]});}return null;})[_0x9354('0x22')](function(_0x58d605){if(_0x58d605){_0x35baa7=_[_0x9354('0x88')](_0x58d605,'id');var _0x1cdb2f;var _0x14b7b4=squel[_0x9354('0x89')]();_0x14b7b4[_0x9354('0x6c')](_0x592e4c[_0x9354('0x6d')]);for(var _0x304ad2=0x0;_0x304ad2<_0x2ca80d[_0x9354('0x38')];_0x304ad2+=0x1){_0x1cdb2f=_0x2ca80d[_0x304ad2][_0x9354('0x6e')]?_0x35baa7[_0x2ca80d[_0x304ad2][_0x9354('0x6e')]][_0x9354('0x6f')]:_0x2ca80d[_0x304ad2]['field'];_0x1cdb2f=_0x2ca80d[_0x304ad2]['function']?_[_0x9354('0x70')](_0x45e766[_0x2ca80d[_0x304ad2]['function']],'%s',_0x1cdb2f):_0x1cdb2f;_0x1cdb2f=_0x2ca80d[_0x304ad2][_0x9354('0x72')]?_[_0x9354('0x70')](_0xc43b55[_0x2ca80d[_0x304ad2]['format']],'%s',_0x1cdb2f):_0x1cdb2f;if(_0x2ca80d[_0x304ad2][_0x9354('0x8a')]){_0x14b7b4[_0x9354('0x65')](_0x1cdb2f);}_0x2ca80d[_0x304ad2][_0x9354('0x73')]&&_0x14b7b4['order'](_0x1cdb2f,_0x2ca80d[_0x304ad2][_0x9354('0x73')]===_0x9354('0x74')?![]:!![]);_0x14b7b4[_0x9354('0x66')](_0x1cdb2f,_0x2ca80d[_0x304ad2]['alias']||_0x1cdb2f);}if(_0x592e4c['joins']){_0x592e4c[_0x9354('0x76')]=JSON['parse'](_0x592e4c[_0x9354('0x76')]);for(var _0x283f68=0x0;_0x283f68<_0x592e4c[_0x9354('0x76')][_0x9354('0x38')];_0x283f68+=0x1){if(_0x592e4c['joins'][_0x283f68][_0x9354('0x30')]&&_[_0x9354('0x78')](_0x6e95c5,_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x30')])&&_0x592e4c[_0x9354('0x76')][_0x283f68]['parentKey']&&_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x7a')]&&_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x7b')]){_0x14b7b4[_0x592e4c[_0x9354('0x76')][_0x283f68]['type']](_0x592e4c['joins'][_0x283f68][_0x9354('0x7a')],null,util['format'](_0x9354('0x7c'),_0x592e4c['table'],_0x592e4c[_0x9354('0x76')][_0x283f68]['parentKey'],_0x592e4c[_0x9354('0x76')][_0x283f68]['foreignTable'],_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x7b')]));}}}if(_0x592e4c[_0x9354('0x7d')]){_0x592e4c[_0x9354('0x7d')]=JSON[_0x9354('0x77')](_0x592e4c['conditions']);_0x14b7b4['where'](_0x287bbf(_0x592e4c['conditions']['group']));}_0x595012=_0x14b7b4[_0x9354('0x7e')]();_0x14b7b4['limit'](_0x1f2e1e);_0x14b7b4[_0x9354('0x1b')](0x0);logger[_0x9354('0x8b')](_0x9354('0x7f'),_0x14b7b4[_0x9354('0x80')]());return db[_0x9354('0x81')][_0x9354('0x35')](_0x14b7b4[_0x9354('0x80')](),{'type':db[_0x9354('0x81')][_0x9354('0x82')][_0x9354('0x83')]});}})[_0x9354('0x22')](function(){return{'sql':_0x595012[_0x9354('0x80')]()};})[_0x9354('0x22')](respondWithResult(_0x5958d4,null))['catch'](handleError(_0x5958d4,null));}; \ No newline at end of file +var _0x0ee0=['where','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','DefaultReports','body','params','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','operator','rules','group','field','condition','value','merge','Sequelize','ValidationErrorItem','AnalyticMetric','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','right_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','getFields','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','debug','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','output','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','pick'];(function(_0xfe4370,_0x4032c3){var _0x2e9a4c=function(_0x182c70){while(--_0x182c70){_0xfe4370['push'](_0xfe4370['shift']());}};_0x2e9a4c(++_0x4032c3);}(_0x0ee0,0x68));var _0x00ee=function(_0x5d10b2,_0x4fba33){_0x5d10b2=_0x5d10b2-0x0;var _0x5e3f2d=_0x0ee0[_0x5d10b2];return _0x5e3f2d;};'use strict';var pdf=require(_0x00ee('0x0'));var emlformat=require(_0x00ee('0x1'));var rimraf=require(_0x00ee('0x2'));var zipdir=require(_0x00ee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00ee('0x4'));var moment=require(_0x00ee('0x5'));var BPromise=require(_0x00ee('0x6'));var Mustache=require(_0x00ee('0x7'));var util=require('util');var path=require('path');var sox=require(_0x00ee('0x8'));var csv=require(_0x00ee('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x00ee('0xa'));var crypto=require(_0x00ee('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x00ee('0x9'));var querystring=require(_0x00ee('0xc'));var Papa=require(_0x00ee('0xd'));var Redis=require('ioredis');var authService=require(_0x00ee('0xe'));var qs=require(_0x00ee('0xf'));var as=require(_0x00ee('0x10'));var hardwareService=require(_0x00ee('0x11'));var logger=require('../../config/logger')(_0x00ee('0x12'));var utils=require('../../config/utils');var config=require(_0x00ee('0x13'));var licenseUtil=require(_0x00ee('0x14'));var db=require(_0x00ee('0x15'))['db'];var dbH=require(_0x00ee('0x15'))[_0x00ee('0x16')];function respondWithStatusCode(_0x1d642b,_0x427906){_0x427906=_0x427906||0xcc;return function(_0x34297d){if(_0x34297d){return _0x1d642b[_0x00ee('0x17')](_0x427906);}return _0x1d642b[_0x00ee('0x18')](_0x427906)[_0x00ee('0x19')]();};}function respondWithResult(_0x2c0d4b,_0x938a26){_0x938a26=_0x938a26||0xc8;return function(_0x56faf8){if(_0x56faf8){return _0x2c0d4b['status'](_0x938a26)[_0x00ee('0x1a')](_0x56faf8);}};}function respondWithFilteredResult(_0x3b3171,_0x2bfeaf){return function(_0x410c9f){if(_0x410c9f){var _0x6a5ebf=_0x410c9f[_0x00ee('0x1b')],_0x5780ee=_0x2bfeaf[_0x00ee('0x1c')],_0x42ab4a=_0x2bfeaf[_0x00ee('0x1c')]+_0x2bfeaf[_0x00ee('0x1d')],_0x26e226;if(_0x42ab4a>=_0x6a5ebf){_0x42ab4a=_0x6a5ebf;_0x26e226=0xc8;}else{_0x26e226=0xce;}_0x3b3171[_0x00ee('0x18')](_0x26e226);return _0x3b3171[_0x00ee('0x1e')](_0x00ee('0x1f'),_0x5780ee+'-'+_0x42ab4a+'/'+_0x6a5ebf)[_0x00ee('0x1a')](_0x410c9f);}return null;};}function patchUpdates(_0x36f0cf){return function(_0x53d54b){try{jsonpatch[_0x00ee('0x20')](_0x53d54b,_0x36f0cf,!![]);}catch(_0x49f9ad){return BPromise[_0x00ee('0x21')](_0x49f9ad);}return _0x53d54b[_0x00ee('0x22')]();};}function saveUpdates(_0x1d646d,_0x478686){return function(_0x587f5a){if(_0x587f5a){return _0x587f5a[_0x00ee('0x23')](_0x1d646d)[_0x00ee('0x24')](function(_0x539ea7){return _0x539ea7;});}return null;};}function removeEntity(_0x1a248d,_0x74480f){return function(_0x4e079d){if(_0x4e079d){return _0x4e079d['destroy']()[_0x00ee('0x24')](function(){var _0x1ac3d5=_0x4e079d[_0x00ee('0x25')]({'plain':!![]});var _0x40edb3='DefaultReports';return db[_0x00ee('0x26')][_0x00ee('0x27')]({'where':{'type':_0x40edb3,'resourceId':_0x1ac3d5['id']}})['then'](function(){return _0x4e079d;});})[_0x00ee('0x24')](function(){_0x1a248d[_0x00ee('0x18')](0xcc)[_0x00ee('0x19')]();});}};}function handleEntityNotFound(_0x3d49,_0xb01652){return function(_0xaaabc5){if(!_0xaaabc5){_0x3d49[_0x00ee('0x17')](0x194);}return _0xaaabc5;};}function handleError(_0x38af27,_0x14d775){_0x14d775=_0x14d775||0x1f4;return function(_0x1018d4){logger[_0x00ee('0x28')](_0x1018d4['stack']);if(_0x1018d4[_0x00ee('0x29')]){delete _0x1018d4[_0x00ee('0x29')];}_0x38af27[_0x00ee('0x18')](_0x14d775)[_0x00ee('0x2a')](_0x1018d4);};}exports[_0x00ee('0x2b')]=function(_0x2a2510,_0x33b900){var _0x90a700={},_0x126e8d={},_0x42049d={'count':0x0,'rows':[]};var _0x11f93c=_[_0x00ee('0x2c')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x402dd2){return{'name':_0x402dd2[_0x00ee('0x2d')],'type':_0x402dd2[_0x00ee('0x2e')][_0x00ee('0x2f')]};});_0x126e8d[_0x00ee('0x30')]=_[_0x00ee('0x2c')](_0x11f93c,_0x00ee('0x29'));_0x126e8d[_0x00ee('0x31')]=_['keys'](_0x2a2510[_0x00ee('0x31')]);_0x126e8d[_0x00ee('0x32')]=_['intersection'](_0x126e8d[_0x00ee('0x30')],_0x126e8d['query']);_0x90a700[_0x00ee('0x33')]=_[_0x00ee('0x34')](_0x126e8d[_0x00ee('0x30')],qs[_0x00ee('0x35')](_0x2a2510[_0x00ee('0x31')][_0x00ee('0x35')]));_0x90a700['attributes']=_0x90a700[_0x00ee('0x33')][_0x00ee('0x36')]?_0x90a700[_0x00ee('0x33')]:_0x126e8d[_0x00ee('0x30')];if(!_0x2a2510[_0x00ee('0x31')]['hasOwnProperty']('nolimit')){_0x90a700[_0x00ee('0x1d')]=qs[_0x00ee('0x1d')](_0x2a2510[_0x00ee('0x31')][_0x00ee('0x1d')]);_0x90a700[_0x00ee('0x1c')]=qs[_0x00ee('0x1c')](_0x2a2510['query'][_0x00ee('0x1c')]);}_0x90a700[_0x00ee('0x37')]=qs[_0x00ee('0x38')](_0x2a2510[_0x00ee('0x31')][_0x00ee('0x38')]);_0x90a700['where']=qs[_0x00ee('0x32')](_[_0x00ee('0x39')](_0x2a2510[_0x00ee('0x31')],_0x126e8d[_0x00ee('0x32')]),_0x11f93c);if(_0x2a2510[_0x00ee('0x31')]['filter']){_0x90a700[_0x00ee('0x3a')]=_['merge'](_0x90a700[_0x00ee('0x3a')],{'$or':_[_0x00ee('0x2c')](_0x11f93c,function(_0x32687f){if(_0x32687f[_0x00ee('0x2e')]!==_0x00ee('0x3b')){var _0x824330={};_0x824330[_0x32687f[_0x00ee('0x29')]]={'$like':'%'+_0x2a2510[_0x00ee('0x31')]['filter']+'%'};return _0x824330;}})});}_0x90a700=_['merge']({},_0x90a700,_0x2a2510[_0x00ee('0x3c')]);var _0x23bb65={'where':_0x90a700[_0x00ee('0x3a')]};return db[_0x00ee('0x3d')][_0x00ee('0x1b')](_0x23bb65)[_0x00ee('0x24')](function(_0x2f5978){_0x42049d[_0x00ee('0x1b')]=_0x2f5978;if(_0x2a2510[_0x00ee('0x31')][_0x00ee('0x3e')]){_0x90a700[_0x00ee('0x3f')]=[{'all':!![]}];}return db[_0x00ee('0x3d')][_0x00ee('0x40')](_0x90a700);})['then'](function(_0x15187d){_0x42049d[_0x00ee('0x41')]=_0x15187d;return _0x42049d;})['then'](respondWithFilteredResult(_0x33b900,_0x90a700))[_0x00ee('0x42')](handleError(_0x33b900,null));};exports[_0x00ee('0x43')]=function(_0xa95cd,_0x2d6946){var _0x2a5d65={'raw':!![],'where':{'id':_0xa95cd['params']['id']}},_0x565b69={};_0x565b69[_0x00ee('0x30')]=_[_0x00ee('0x44')](db['AnalyticDefaultReport']['rawAttributes']);_0x565b69[_0x00ee('0x31')]=_[_0x00ee('0x44')](_0xa95cd['query']);_0x565b69[_0x00ee('0x32')]=_[_0x00ee('0x34')](_0x565b69['model'],_0x565b69[_0x00ee('0x31')]);_0x2a5d65[_0x00ee('0x33')]=_[_0x00ee('0x34')](_0x565b69['model'],qs[_0x00ee('0x35')](_0xa95cd[_0x00ee('0x31')][_0x00ee('0x35')]));_0x2a5d65[_0x00ee('0x33')]=_0x2a5d65[_0x00ee('0x33')]['length']?_0x2a5d65[_0x00ee('0x33')]:_0x565b69['model'];if(_0xa95cd[_0x00ee('0x31')]['includeAll']){_0x2a5d65[_0x00ee('0x3f')]=[{'all':!![]}];}_0x2a5d65=_['merge']({},_0x2a5d65,_0xa95cd[_0x00ee('0x3c')]);return db['AnalyticDefaultReport'][_0x00ee('0x45')](_0x2a5d65)[_0x00ee('0x24')](handleEntityNotFound(_0x2d6946,null))[_0x00ee('0x24')](respondWithResult(_0x2d6946,null))[_0x00ee('0x42')](handleError(_0x2d6946,null));};exports[_0x00ee('0x46')]=function(_0x1fd16d,_0x15eba1){return db[_0x00ee('0x3d')][_0x00ee('0x46')](_0x1fd16d['body'],{})[_0x00ee('0x24')](function(_0x569d10){var _0x4bfd4d=_0x1fd16d[_0x00ee('0x47')][_0x00ee('0x25')]({'plain':!![]});if(!_0x4bfd4d)throw new Error(_0x00ee('0x48'));if(_0x4bfd4d[_0x00ee('0x49')]===_0x00ee('0x47')){var _0x52c38d=_0x569d10[_0x00ee('0x25')]({'plain':!![]});var _0x466686=_0x00ee('0x4a');return db[_0x00ee('0x4b')][_0x00ee('0x45')]({'where':{'name':_0x466686,'userProfileId':_0x4bfd4d[_0x00ee('0x4c')]},'raw':!![]})[_0x00ee('0x24')](function(_0x2b063a){if(_0x2b063a&&_0x2b063a['autoAssociation']===0x0){return db[_0x00ee('0x26')][_0x00ee('0x46')]({'name':_0x52c38d[_0x00ee('0x29')],'resourceId':_0x52c38d['id'],'type':_0x00ee('0x4d'),'sectionId':_0x2b063a['id']},{})[_0x00ee('0x24')](function(){return _0x569d10;});}else{return _0x569d10;}})[_0x00ee('0x42')](function(_0x4d260f){logger[_0x00ee('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d260f);throw _0x4d260f;});}return _0x569d10;})['then'](respondWithResult(_0x15eba1,0xc9))[_0x00ee('0x42')](handleError(_0x15eba1,null));};exports['update']=function(_0x181be9,_0x2f7287){if(_0x181be9[_0x00ee('0x4e')]['id']){delete _0x181be9[_0x00ee('0x4e')]['id'];}return db['AnalyticDefaultReport'][_0x00ee('0x45')]({'where':{'id':_0x181be9[_0x00ee('0x4f')]['id']}})[_0x00ee('0x24')](handleEntityNotFound(_0x2f7287,null))[_0x00ee('0x24')](saveUpdates(_0x181be9['body'],null))[_0x00ee('0x24')](respondWithResult(_0x2f7287,null))[_0x00ee('0x42')](handleError(_0x2f7287,null));};exports[_0x00ee('0x27')]=function(_0x210e47,_0x7fd917){return db[_0x00ee('0x3d')]['find']({'where':{'id':_0x210e47[_0x00ee('0x4f')]['id']}})[_0x00ee('0x24')](handleEntityNotFound(_0x7fd917,null))[_0x00ee('0x24')](removeEntity(_0x7fd917,null))[_0x00ee('0x42')](handleError(_0x7fd917,null));};exports['preview']=function(_0x2906dd,_0x1dc481){var _0x4fd27c=0xa;var _0x362113=[_0x00ee('0x50'),_0x00ee('0x51'),'right_join',_0x00ee('0x52')];var _0x34bd46={'SUM':_0x00ee('0x53'),'COUNT':_0x00ee('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x00ee('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x00ee('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x00ee('0x57')};var _0x3f5333={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x00ee('0x58'),'HOUR':_0x00ee('0x59'),'ROUND':_0x00ee('0x5a'),'UNIX_TIMESTAMP':_0x00ee('0x5b')};var _0x49fb94=function(_0xcb2ec4){return!_[_0x00ee('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xcb2ec4);};var _0x3b36b8=function(_0x2c459e){if(!_0x2c459e||!_0x2c459e['rules'][_0x00ee('0x36')]){return'';}for(var _0x218d1a='(',_0x216ffb=0x0;_0x216ffb<_0x2c459e['rules'][_0x00ee('0x36')];_0x216ffb+=0x1){_0x216ffb>0x0&&(_0x218d1a+='\x20'+_0x2c459e[_0x00ee('0x5d')]+'\x20');_0x218d1a+=_0x2c459e[_0x00ee('0x5e')][_0x216ffb][_0x00ee('0x5f')]?_0x3b36b8(_0x2c459e[_0x00ee('0x5e')][_0x216ffb]['group']):_0x2c459e['rules'][_0x216ffb][_0x00ee('0x60')]+'\x20'+_0x2c459e[_0x00ee('0x5e')][_0x216ffb][_0x00ee('0x61')]+(_0x49fb94(_0x2c459e[_0x00ee('0x5e')][_0x216ffb]['condition'])?'\x20'+_0x2c459e[_0x00ee('0x5e')][_0x216ffb][_0x00ee('0x62')]:'');}return _0x218d1a+')';};var _0x216965={'where':{'id':_0x2906dd[_0x00ee('0x4f')]['id']}},_0x3c407a,_0x50f605,_0xdd60c6,_0x49a234,_0x1e5c5d;_0x216965=_[_0x00ee('0x63')]({},_0x216965,_0x2906dd[_0x00ee('0x3c')]);return db[_0x00ee('0x3d')]['find'](_0x216965)['then'](function(_0x3a68b4){if(_0x3a68b4){_0x3c407a=_0x3a68b4;return _0x3a68b4['getFields']();}return null;})[_0x00ee('0x24')](function(_0x101387){if(_0x101387){if(!_0x101387[_0x00ee('0x36')]){throw new db[(_0x00ee('0x64'))][(_0x00ee('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x50f605=_0x101387;return db[_0x00ee('0x66')][_0x00ee('0x40')]({'raw':!![]});}return null;})['then'](function(_0x298363){if(_0x298363){_0xdd60c6=_['keyBy'](_0x298363,'id');var _0x11f736;var _0x13ef86=squel[_0x00ee('0x67')]();_0x13ef86[_0x00ee('0x68')](_0x3c407a['table']);for(var _0x36e2a4=0x0;_0x36e2a4<_0x50f605[_0x00ee('0x36')];_0x36e2a4+=0x1){_0x11f736=_0x50f605[_0x36e2a4][_0x00ee('0x69')]?_0xdd60c6[_0x50f605[_0x36e2a4][_0x00ee('0x69')]][_0x00ee('0x6a')]:_0x50f605[_0x36e2a4][_0x00ee('0x60')];_0x11f736=_0x50f605[_0x36e2a4][_0x00ee('0x6b')]?_[_0x00ee('0x6c')](_0x34bd46[_0x50f605[_0x36e2a4]['function']],'%s',_0x11f736):_0x11f736;_0x11f736=_0x50f605[_0x36e2a4][_0x00ee('0x6d')]?_[_0x00ee('0x6c')](_0x3f5333[_0x50f605[_0x36e2a4][_0x00ee('0x6d')]],'%s',_0x11f736):_0x11f736;if(_0x50f605[_0x36e2a4][_0x00ee('0x6e')]){_0x13ef86['group'](_0x11f736);}_0x50f605[_0x36e2a4][_0x00ee('0x6f')]&&_0x13ef86[_0x00ee('0x37')](_0x11f736,_0x50f605[_0x36e2a4][_0x00ee('0x6f')]===_0x00ee('0x70')?![]:!![]);_0x13ef86[_0x00ee('0x60')](_0x11f736,_0x50f605[_0x36e2a4][_0x00ee('0x71')]||_0x11f736);}if(_0x3c407a[_0x00ee('0x72')]){_0x3c407a['joins']=JSON[_0x00ee('0x73')](_0x3c407a[_0x00ee('0x72')]);for(var _0x481bcb=0x0;_0x481bcb<_0x3c407a[_0x00ee('0x72')][_0x00ee('0x36')];_0x481bcb+=0x1){if(_0x3c407a[_0x00ee('0x72')][_0x481bcb][_0x00ee('0x2e')]&&_[_0x00ee('0x5c')](_0x362113,_0x3c407a[_0x00ee('0x72')][_0x481bcb][_0x00ee('0x2e')])&&_0x3c407a['joins'][_0x481bcb][_0x00ee('0x74')]&&_0x3c407a['joins'][_0x481bcb][_0x00ee('0x75')]&&_0x3c407a[_0x00ee('0x72')][_0x481bcb][_0x00ee('0x76')]){_0x13ef86[_0x3c407a[_0x00ee('0x72')][_0x481bcb][_0x00ee('0x2e')]](_0x3c407a[_0x00ee('0x72')][_0x481bcb][_0x00ee('0x75')],null,util['format'](_0x00ee('0x77'),_0x3c407a[_0x00ee('0x78')],_0x3c407a['joins'][_0x481bcb]['parentKey'],_0x3c407a[_0x00ee('0x72')][_0x481bcb]['foreignTable'],_0x3c407a[_0x00ee('0x72')][_0x481bcb]['foreignKey']));}}}if(_0x3c407a['conditions']){_0x3c407a[_0x00ee('0x79')]=JSON['parse'](_0x3c407a[_0x00ee('0x79')]);_0x13ef86[_0x00ee('0x3a')](_0x3b36b8(_0x3c407a[_0x00ee('0x79')][_0x00ee('0x5f')]));}_0x1e5c5d=_0x13ef86[_0x00ee('0x7a')]();_0x13ef86[_0x00ee('0x1d')](_0x4fd27c);_0x13ef86['offset'](0x0);logger['debug'](_0x00ee('0x7b'),_0x13ef86[_0x00ee('0x7c')]());return db[_0x00ee('0x7d')]['query'](_0x13ef86['toString'](),{'type':db[_0x00ee('0x7d')]['QueryTypes'][_0x00ee('0x7e')]});}})[_0x00ee('0x24')](respondWithResult(_0x1dc481,null))['catch'](handleError(_0x1dc481,null));};function runReport(_0xa565a1,_0xb328ac,_0x2a7813){var _0x1c137b=_0xb328ac['name'];var _0xf1e880=0xa;var _0x290ca2=['join',_0x00ee('0x51'),_0x00ee('0x7f'),'cross_join'];var _0x2f6140={'SUM':_0x00ee('0x53'),'COUNT':_0x00ee('0x54'),'COUNT DISTINCT':_0x00ee('0x80'),'MAX':_0x00ee('0x55'),'MIN':_0x00ee('0x81'),'AVG':_0x00ee('0x82'),'GROUP_CONCAT':_0x00ee('0x56'),'GROUP_CONCAT ASC':_0x00ee('0x83'),'GROUP_CONCAT DESC':_0x00ee('0x57')};var _0x5d08d4={'SEC_TO_TIME':_0x00ee('0x84'),'DATE':_0x00ee('0x58'),'HOUR':_0x00ee('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x13e3c9=function(_0x2d1c6a){return!_[_0x00ee('0x5c')]([_0x00ee('0x85'),_0x00ee('0x86'),'IS\x20EMPTY',_0x00ee('0x87')],_0x2d1c6a);};var _0x18476c=function(_0x250bc3){if(!_0x250bc3||!_0x250bc3['rules'][_0x00ee('0x36')]){return'';}for(var _0x2d4faf='(',_0x8c8934=0x0;_0x8c8934<_0x250bc3[_0x00ee('0x5e')][_0x00ee('0x36')];_0x8c8934+=0x1){_0x8c8934>0x0&&(_0x2d4faf+='\x20'+_0x250bc3[_0x00ee('0x5d')]+'\x20');_0x2d4faf+=_0x250bc3[_0x00ee('0x5e')][_0x8c8934]['group']?_0x18476c(_0x250bc3[_0x00ee('0x5e')][_0x8c8934][_0x00ee('0x5f')]):_0x250bc3[_0x00ee('0x5e')][_0x8c8934]['field']+'\x20'+_0x250bc3[_0x00ee('0x5e')][_0x8c8934][_0x00ee('0x61')]+(_0x13e3c9(_0x250bc3[_0x00ee('0x5e')][_0x8c8934]['condition'])?'\x20'+_0x250bc3[_0x00ee('0x5e')][_0x8c8934][_0x00ee('0x62')]:'');}return _0x2d4faf+')';};var _0x45e3f6={'where':{'id':_0xa565a1['id']}},_0x1521aa,_0x382885,_0x453611,_0x3fda4f,_0x1dfc22;_0x45e3f6=_['merge']({},_0x45e3f6,_0x2a7813);return db[_0x00ee('0x3d')][_0x00ee('0x45')](_0x45e3f6)[_0x00ee('0x24')](function(_0x57f42f){if(_0x57f42f){_0x1521aa=_0x57f42f;return _0x57f42f[_0x00ee('0x88')]();}return null;})[_0x00ee('0x24')](function(_0x154362){if(_0x154362){if(!_0x154362[_0x00ee('0x36')]){throw new db[(_0x00ee('0x64'))]['ValidationErrorItem'](_0x00ee('0x89'),0x193);}_0x382885=_0x154362;return db[_0x00ee('0x66')][_0x00ee('0x40')]({'raw':!![]});}return null;})['then'](function(_0x2f6b71){if(_0x2f6b71){_0x453611=_[_0x00ee('0x8a')](_0x2f6b71,'id');var _0x21174f;var _0x583eb1=squel['select']();_0x583eb1['from'](_0x1521aa[_0x00ee('0x78')]);for(var _0x440194=0x0;_0x440194<_0x382885[_0x00ee('0x36')];_0x440194+=0x1){_0x21174f=_0x382885[_0x440194][_0x00ee('0x69')]?_0x453611[_0x382885[_0x440194]['MetricId']][_0x00ee('0x6a')]:_0x382885[_0x440194][_0x00ee('0x60')];_0x21174f=_0x382885[_0x440194]['function']?_[_0x00ee('0x6c')](_0x2f6140[_0x382885[_0x440194][_0x00ee('0x6b')]],'%s',_0x21174f):_0x21174f;_0x21174f=_0x382885[_0x440194]['format']?_[_0x00ee('0x6c')](_0x5d08d4[_0x382885[_0x440194][_0x00ee('0x6d')]],'%s',_0x21174f):_0x21174f;if(_0x382885[_0x440194][_0x00ee('0x6e')]){_0x583eb1[_0x00ee('0x5f')](_0x21174f);}_0x382885[_0x440194][_0x00ee('0x6f')]&&_0x583eb1[_0x00ee('0x37')](_0x21174f,_0x382885[_0x440194][_0x00ee('0x6f')]===_0x00ee('0x70')?![]:!![]);_0x583eb1[_0x00ee('0x60')](_0x21174f,_0x382885[_0x440194]['alias']||_0x21174f);}if(_0x1521aa[_0x00ee('0x72')]){_0x1521aa['joins']=JSON['parse'](_0x1521aa[_0x00ee('0x72')]);for(var _0x2402f8=0x0;_0x2402f8<_0x1521aa['joins'][_0x00ee('0x36')];_0x2402f8+=0x1){if(_0x1521aa[_0x00ee('0x72')][_0x2402f8]['type']&&_['includes'](_0x290ca2,_0x1521aa['joins'][_0x2402f8][_0x00ee('0x2e')])&&_0x1521aa[_0x00ee('0x72')][_0x2402f8][_0x00ee('0x74')]&&_0x1521aa['joins'][_0x2402f8]['foreignTable']&&_0x1521aa[_0x00ee('0x72')][_0x2402f8][_0x00ee('0x76')]){_0x583eb1[_0x1521aa['joins'][_0x2402f8][_0x00ee('0x2e')]](_0x1521aa[_0x00ee('0x72')][_0x2402f8][_0x00ee('0x75')],null,util[_0x00ee('0x6d')]('%s.%s\x20=\x20%s.%s',_0x1521aa[_0x00ee('0x78')],_0x1521aa[_0x00ee('0x72')][_0x2402f8][_0x00ee('0x74')],_0x1521aa[_0x00ee('0x72')][_0x2402f8][_0x00ee('0x75')],_0x1521aa['joins'][_0x2402f8][_0x00ee('0x76')]));}}}if(_0x1521aa['conditions']){_0x1521aa['conditions']=JSON['parse'](_0x1521aa['conditions']);_0x583eb1[_0x00ee('0x3a')](_0x18476c(_0x1521aa['conditions'][_0x00ee('0x5f')]));}_0x1dfc22=_0x583eb1[_0x00ee('0x7a')]();_0x583eb1['limit'](_0xf1e880);_0x583eb1[_0x00ee('0x1c')](0x0);logger[_0x00ee('0x8b')](_0x00ee('0x7b'),_0x583eb1[_0x00ee('0x7c')]());return db[_0x00ee('0x7d')][_0x00ee('0x31')](_0x583eb1[_0x00ee('0x7c')](),{'type':db[_0x00ee('0x7d')]['QueryTypes'][_0x00ee('0x7e')]});}})['then'](function(_0x222738){if(!_0x222738[_0x00ee('0x36')]){throw new db[(_0x00ee('0x64'))][(_0x00ee('0x65'))]('No\x20available\x20data',0xcc);}if(_0xb328ac['output']===_0x00ee('0x8c')){return null;}var _0x1b823f=_[_0x00ee('0x63')](_0xb328ac,{'name':_0xb328ac[_0x00ee('0x8d')]||_0xb328ac[_0x00ee('0x29')]||_0x1521aa[_0x00ee('0x29')],'basename':_0x1c137b,'savename':util[_0x00ee('0x6d')](_0x00ee('0x8e'),_0xb328ac[_0x00ee('0x29')]||_0x1521aa['name'],require(_0x00ee('0x8f'))[_0x00ee('0x90')](0x4),_0xb328ac['output']||_0x00ee('0x91')),'reportId':_0x1521aa['id'],'reportType':_0x00ee('0x92')});return db['AnalyticExtractedReport'][_0x00ee('0x46')](_0x1b823f,{'raw':!![]});})[_0x00ee('0x24')](function(_0x4260be){if(_0x1521aa[_0x00ee('0x78')]===_0x00ee('0x93')){_0x1dfc22['where'](_0x1521aa[_0x00ee('0x78')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xb328ac[_0x00ee('0x94')],_0xb328ac[_0x00ee('0x95')]);}else{_0x1dfc22[_0x00ee('0x3a')](_0x1521aa['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xb328ac[_0x00ee('0x94')],_0xb328ac[_0x00ee('0x95')]);}if(_0x4260be){logger[_0x00ee('0x96')](_0x00ee('0x97'),_0x1dfc22['toString']());require(_0x00ee('0x98'))[_0x00ee('0x99')](path['join'](__dirname,_0x00ee('0x9a'),_0x4260be[_0x00ee('0x9b')]),[_0x4260be['id'],_0x1dfc22[_0x00ee('0x7c')](),path[_0x00ee('0x50')](__dirname,_0x00ee('0x9c'),_0x4260be[_0x00ee('0x9d')]),_0x1c137b]);return _0x4260be;}else{var _0x454192=squel['select']();_0x454192[_0x00ee('0x68')]('('+_0x1dfc22[_0x00ee('0x7c')]()+')','countTable');_0x454192[_0x00ee('0x60')](_0x00ee('0x9e'),_0x00ee('0x1b'));_0x1dfc22[_0x00ee('0x1d')](_0xb328ac['limit']||_0xf1e880);_0x1dfc22['offset'](_0xb328ac[_0x00ee('0x1c')]||0x0);return dbH['sequelize'][_0x00ee('0x31')](_0x454192[_0x00ee('0x7c')](),{'type':dbH[_0x00ee('0x7d')][_0x00ee('0x9f')][_0x00ee('0x7e')]})['then'](function(_0x3b5aac){if(!_0x3b5aac[_0x00ee('0x36')]){_0x3fda4f=0x0;}else{_0x3fda4f=_0x3b5aac[0x0][_0x00ee('0x1b')]||0x0;}return dbH[_0x00ee('0x7d')][_0x00ee('0x31')](_0x1dfc22[_0x00ee('0x7c')](),{'type':dbH['sequelize'][_0x00ee('0x9f')]['SELECT']});})[_0x00ee('0x24')](function(_0x3f63f5){return{'rows':_0x3f63f5||[],'count':_0x3fda4f};});}});}exports[_0x00ee('0xa0')]=function(_0x211139,_0x422f40){return runReport(_0x211139['params'],_0x211139[_0x00ee('0x31')],_0x211139[_0x00ee('0x3c')])[_0x00ee('0x24')](respondWithResult(_0x422f40,null))[_0x00ee('0x42')](handleError(_0x422f40,null));};exports[_0x00ee('0xa1')]=runReport;exports['query']=function(_0x183f5d,_0x423a63){var _0x47e070=0xa;var _0x38b20a=[_0x00ee('0x50'),_0x00ee('0x51'),_0x00ee('0x7f'),_0x00ee('0x52')];var _0x43eb00={'SUM':_0x00ee('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x00ee('0x80'),'MAX':_0x00ee('0x55'),'MIN':_0x00ee('0x81'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x00ee('0x56'),'GROUP_CONCAT ASC':_0x00ee('0x83'),'GROUP_CONCAT DESC':_0x00ee('0x57')};var _0xcba74d={'SEC_TO_TIME':_0x00ee('0x84'),'DATE':_0x00ee('0x58'),'HOUR':_0x00ee('0x59'),'ROUND':_0x00ee('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x36b5dd=function(_0x3a8c10){return!_[_0x00ee('0x5c')]([_0x00ee('0x85'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x00ee('0x87')],_0x3a8c10);};var _0x48e4a3=function(_0x2b5b06){if(!_0x2b5b06||!_0x2b5b06[_0x00ee('0x5e')][_0x00ee('0x36')]){return'';}for(var _0x2db937='(',_0x33478f=0x0;_0x33478f<_0x2b5b06[_0x00ee('0x5e')]['length'];_0x33478f+=0x1){_0x33478f>0x0&&(_0x2db937+='\x20'+_0x2b5b06[_0x00ee('0x5d')]+'\x20');_0x2db937+=_0x2b5b06['rules'][_0x33478f][_0x00ee('0x5f')]?_0x48e4a3(_0x2b5b06[_0x00ee('0x5e')][_0x33478f][_0x00ee('0x5f')]):_0x2b5b06[_0x00ee('0x5e')][_0x33478f][_0x00ee('0x60')]+'\x20'+_0x2b5b06[_0x00ee('0x5e')][_0x33478f]['condition']+(_0x36b5dd(_0x2b5b06[_0x00ee('0x5e')][_0x33478f][_0x00ee('0x61')])?'\x20'+_0x2b5b06[_0x00ee('0x5e')][_0x33478f]['value']:'');}return _0x2db937+')';};var _0x8fcf7e={'where':{'id':_0x183f5d[_0x00ee('0x4f')]['id']}},_0x194a29,_0x1d6895,_0x4ba396,_0x241ddd,_0x2fd6b8;_0x8fcf7e=_[_0x00ee('0x63')]({},_0x8fcf7e,_0x183f5d[_0x00ee('0x3c')]);return db[_0x00ee('0x3d')]['find'](_0x8fcf7e)[_0x00ee('0x24')](function(_0x396b44){if(_0x396b44){_0x194a29=_0x396b44;return _0x396b44[_0x00ee('0x88')]();}return null;})[_0x00ee('0x24')](function(_0x8812f1){if(_0x8812f1){if(!_0x8812f1[_0x00ee('0x36')]){throw new db[(_0x00ee('0x64'))][(_0x00ee('0x65'))](_0x00ee('0x89'),0x193);}_0x1d6895=_0x8812f1;return db['AnalyticMetric'][_0x00ee('0x40')]({'raw':!![]});}return null;})[_0x00ee('0x24')](function(_0x2fe46b){if(_0x2fe46b){_0x4ba396=_[_0x00ee('0x8a')](_0x2fe46b,'id');var _0xc4f70b;var _0x316386=squel[_0x00ee('0x67')]();_0x316386[_0x00ee('0x68')](_0x194a29['table']);for(var _0x4baf82=0x0;_0x4baf82<_0x1d6895['length'];_0x4baf82+=0x1){_0xc4f70b=_0x1d6895[_0x4baf82][_0x00ee('0x69')]?_0x4ba396[_0x1d6895[_0x4baf82][_0x00ee('0x69')]]['metric']:_0x1d6895[_0x4baf82][_0x00ee('0x60')];_0xc4f70b=_0x1d6895[_0x4baf82][_0x00ee('0x6b')]?_['replace'](_0x43eb00[_0x1d6895[_0x4baf82]['function']],'%s',_0xc4f70b):_0xc4f70b;_0xc4f70b=_0x1d6895[_0x4baf82]['format']?_[_0x00ee('0x6c')](_0xcba74d[_0x1d6895[_0x4baf82][_0x00ee('0x6d')]],'%s',_0xc4f70b):_0xc4f70b;if(_0x1d6895[_0x4baf82]['groupBy']){_0x316386[_0x00ee('0x5f')](_0xc4f70b);}_0x1d6895[_0x4baf82]['orderBy']&&_0x316386[_0x00ee('0x37')](_0xc4f70b,_0x1d6895[_0x4baf82][_0x00ee('0x6f')]===_0x00ee('0x70')?![]:!![]);_0x316386[_0x00ee('0x60')](_0xc4f70b,_0x1d6895[_0x4baf82][_0x00ee('0x71')]||_0xc4f70b);}if(_0x194a29[_0x00ee('0x72')]){_0x194a29[_0x00ee('0x72')]=JSON['parse'](_0x194a29[_0x00ee('0x72')]);for(var _0x44de9d=0x0;_0x44de9d<_0x194a29[_0x00ee('0x72')][_0x00ee('0x36')];_0x44de9d+=0x1){if(_0x194a29['joins'][_0x44de9d]['type']&&_[_0x00ee('0x5c')](_0x38b20a,_0x194a29['joins'][_0x44de9d][_0x00ee('0x2e')])&&_0x194a29[_0x00ee('0x72')][_0x44de9d]['parentKey']&&_0x194a29[_0x00ee('0x72')][_0x44de9d][_0x00ee('0x75')]&&_0x194a29[_0x00ee('0x72')][_0x44de9d]['foreignKey']){_0x316386[_0x194a29[_0x00ee('0x72')][_0x44de9d][_0x00ee('0x2e')]](_0x194a29[_0x00ee('0x72')][_0x44de9d][_0x00ee('0x75')],null,util['format'](_0x00ee('0x77'),_0x194a29[_0x00ee('0x78')],_0x194a29[_0x00ee('0x72')][_0x44de9d][_0x00ee('0x74')],_0x194a29['joins'][_0x44de9d][_0x00ee('0x75')],_0x194a29[_0x00ee('0x72')][_0x44de9d][_0x00ee('0x76')]));}}}if(_0x194a29[_0x00ee('0x79')]){_0x194a29[_0x00ee('0x79')]=JSON['parse'](_0x194a29[_0x00ee('0x79')]);_0x316386[_0x00ee('0x3a')](_0x48e4a3(_0x194a29['conditions'][_0x00ee('0x5f')]));}_0x2fd6b8=_0x316386['clone']();_0x316386[_0x00ee('0x1d')](_0x47e070);_0x316386[_0x00ee('0x1c')](0x0);logger[_0x00ee('0x8b')]('Limited\x20Query:',_0x316386[_0x00ee('0x7c')]());return db[_0x00ee('0x7d')][_0x00ee('0x31')](_0x316386[_0x00ee('0x7c')](),{'type':db[_0x00ee('0x7d')][_0x00ee('0x9f')][_0x00ee('0x7e')]});}})[_0x00ee('0x24')](function(){return{'sql':_0x2fd6b8[_0x00ee('0x7c')]()};})[_0x00ee('0x24')](respondWithResult(_0x423a63,null))[_0x00ee('0x42')](handleError(_0x423a63,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 26d8d0e..f2a9717 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 _0x6055=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6055,0x15e));var _0x5605=function(_0x33727e,_0x4b8475){_0x33727e=_0x33727e-0x0;var _0x96ecb4=_0x6055[_0x33727e];return _0x96ecb4;};'use strict';var _=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var logger=require(_0x5605('0x2'))(_0x5605('0x3'));var moment=require(_0x5605('0x4'));var BPromise=require(_0x5605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5605('0x6'));var rimraf=require(_0x5605('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x5605('0x8')]=function(_0x4b8056,_0x5c64fe){return _0x4b8056[_0x5605('0x9')](_0x5605('0xa'),attributes,{'tableName':_0x5605('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8810=['analytics_default_reports','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x5da80f,_0x21787c){var _0x3e2307=function(_0x212856){while(--_0x212856){_0x5da80f['push'](_0x5da80f['shift']());}};_0x3e2307(++_0x21787c);}(_0x8810,0x85));var _0x0881=function(_0x21833c,_0x5813c0){_0x21833c=_0x21833c-0x0;var _0x17728a=_0x8810[_0x21833c];return _0x17728a;};'use strict';var _=require(_0x0881('0x0'));var util=require(_0x0881('0x1'));var logger=require('../../config/logger')(_0x0881('0x2'));var moment=require(_0x0881('0x3'));var BPromise=require('bluebird');var rp=require(_0x0881('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0881('0x5'));var config=require(_0x0881('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x0881('0x7')]=function(_0x191c84,_0xb43a46){return _0x191c84[_0x0881('0x8')](_0x0881('0x9'),attributes,{'tableName':_0x0881('0xa'),'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 a584a48..6009314 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 _0x515d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x594b52,_0x232e60){var _0x36b369=function(_0x5b421e){while(--_0x5b421e){_0x594b52['push'](_0x594b52['shift']());}};_0x36b369(++_0x232e60);}(_0x515d,0x104));var _0xd515=function(_0x4df974,_0x46b306){_0x4df974=_0x4df974-0x0;var _0x39bf27=_0x515d[_0x4df974];return _0x39bf27;};'use strict';var _=require('lodash');var util=require(_0xd515('0x0'));var moment=require(_0xd515('0x1'));var BPromise=require(_0xd515('0x2'));var rs=require(_0xd515('0x3'));var fs=require('fs');var Redis=require(_0xd515('0x4'));var db=require(_0xd515('0x5'))['db'];var utils=require(_0xd515('0x6'));var logger=require(_0xd515('0x7'))('rpc');var config=require(_0xd515('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd515('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1130fc,_0x43d633,_0x26a25d){return new BPromise(function(_0x2ec6e2,_0x55a0da){return client[_0xd515('0xa')](_0x1130fc,_0x26a25d)[_0xd515('0xb')](function(_0x138086){logger[_0xd515('0xc')](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));logger['debug'](_0xd515('0xf'),_0x43d633,_0xd515('0xe'),JSON[_0xd515('0x10')](_0x138086));if(_0x138086[_0xd515('0x11')]){if(_0x138086['error'][_0xd515('0x12')]===0x1f4){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x55a0da(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x2ec6e2(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}else{logger['info'](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));_0x2ec6e2(_0x138086[_0xd515('0x14')][_0xd515('0x13')]);}})[_0xd515('0x15')](function(_0x33dbb6){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x33dbb6);_0x55a0da(_0x33dbb6);});});} \ No newline at end of file +var _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x36d384,_0x1355ad){var _0x442bbe=function(_0x261e37){while(--_0x261e37){_0x36d384['push'](_0x36d384['shift']());}};_0x442bbe(++_0x1355ad);}(_0xa75b,0x170));var _0xba75=function(_0x7ff3cf,_0x44f27f){_0x7ff3cf=_0x7ff3cf-0x0;var _0x2e9594=_0xa75b[_0x7ff3cf];return _0x2e9594;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e119d50..4e8a563 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 _0x94d9=['../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x395b5f,_0x484d26){var _0x326e43=function(_0x6c670e){while(--_0x6c670e){_0x395b5f['push'](_0x395b5f['shift']());}};_0x326e43(++_0x484d26);}(_0x94d9,0x1c5));var _0x994d=function(_0x5c07c0,_0x520c4f){_0x5c07c0=_0x5c07c0-0x0;var _0xbed828=_0x94d9[_0x5c07c0];return _0xbed828;};'use strict';var multer=require('multer');var util=require(_0x994d('0x0'));var path=require(_0x994d('0x1'));var timeout=require(_0x994d('0x2'));var express=require(_0x994d('0x3'));var router=express[_0x994d('0x4')]();var auth=require(_0x994d('0x5'));var interaction=require(_0x994d('0x6'));var config=require(_0x994d('0x7'));var controller=require(_0x994d('0x8'));router[_0x994d('0x9')]('/',auth[_0x994d('0xa')](),controller[_0x994d('0xb')]);router[_0x994d('0x9')](_0x994d('0xc'),auth[_0x994d('0xa')](),controller[_0x994d('0xd')]);router['get'](_0x994d('0xe'),auth['isAuthenticated'](),controller[_0x994d('0xf')]);router[_0x994d('0x9')](_0x994d('0x10'),auth[_0x994d('0xa')](),controller[_0x994d('0x11')]);router['get'](_0x994d('0x12'),auth['isAuthenticated'](),controller[_0x994d('0x13')]);router['post']('/',auth[_0x994d('0xa')](),controller['create']);router[_0x994d('0x14')](_0x994d('0xc'),auth[_0x994d('0xa')](),controller[_0x994d('0x15')]);router['delete'](_0x994d('0xc'),auth[_0x994d('0xa')](),controller[_0x994d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa9cf=['delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/query','post','update'];(function(_0x489986,_0x5bba1f){var _0x4ef441=function(_0x89583e){while(--_0x89583e){_0x489986['push'](_0x489986['shift']());}};_0x4ef441(++_0x5bba1f);}(_0xa9cf,0xf1));var _0xfa9c=function(_0x27a14,_0x296811){_0x27a14=_0x27a14-0x0;var _0x540b61=_0xa9cf[_0x27a14];return _0x540b61;};'use strict';var multer=require(_0xfa9c('0x0'));var util=require(_0xfa9c('0x1'));var path=require(_0xfa9c('0x2'));var timeout=require(_0xfa9c('0x3'));var express=require(_0xfa9c('0x4'));var router=express[_0xfa9c('0x5')]();var auth=require(_0xfa9c('0x6'));var interaction=require(_0xfa9c('0x7'));var config=require(_0xfa9c('0x8'));var controller=require(_0xfa9c('0x9'));router[_0xfa9c('0xa')]('/',auth[_0xfa9c('0xb')](),controller[_0xfa9c('0xc')]);router[_0xfa9c('0xa')](_0xfa9c('0xd'),auth[_0xfa9c('0xb')](),controller[_0xfa9c('0xe')]);router['get']('/:id/preview',auth[_0xfa9c('0xb')](),controller[_0xfa9c('0xf')]);router[_0xfa9c('0xa')]('/:id/run',auth[_0xfa9c('0xb')](),controller['run']);router[_0xfa9c('0xa')](_0xfa9c('0x10'),auth[_0xfa9c('0xb')](),controller['query']);router[_0xfa9c('0x11')]('/',auth[_0xfa9c('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfa9c('0x12')]);router[_0xfa9c('0x13')](_0xfa9c('0xd'),auth[_0xfa9c('0xb')](),controller['destroy']);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 4873284..95f1005 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 _0x279d=['pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv'];(function(_0x13daa2,_0x223f9c){var _0x54681e=function(_0x5c6f87){while(--_0x5c6f87){_0x13daa2['push'](_0x13daa2['shift']());}};_0x54681e(++_0x223f9c);}(_0x279d,0x14b));var _0xd279=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x279d[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0xd279('0x0'));var moment=require('moment');module[_0xd279('0x1')]={'name':{'type':Sequelize[_0xd279('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd279('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd279('0x3')](_0xd279('0x4'),_0xd279('0x5'),_0xd279('0x6')),'allowNull':![],'defaultValue':_0xd279('0x4')},'savename':{'type':Sequelize[_0xd279('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xd279('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0xd279('0x8'),_0xd279('0x9')),'allowNull':![],'defaultValue':_0xd279('0x8')},'reportId':{'type':Sequelize[_0xd279('0xa')](0xb)[_0xd279('0xb')]},'reportType':{'type':Sequelize[_0xd279('0x2')]}}; \ No newline at end of file +var _0xe9ad=['DATE','Loading','manual','scheduled','moment','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe9ad,0xb4));var _0xde9a=function(_0x2b4cd0,_0x457878){_0x2b4cd0=_0x2b4cd0-0x0;var _0x474616=_0xe9ad[_0x2b4cd0];return _0x474616;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xde9a('0x0'));module[_0xde9a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xde9a('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xde9a('0x3')](_0xde9a('0x4'),_0xde9a('0x5'),_0xde9a('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xde9a('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xde9a('0x7')]},'endDate':{'type':Sequelize[_0xde9a('0x7')]},'status':{'type':Sequelize[_0xde9a('0x2')],'defaultValue':_0xde9a('0x8')},'type':{'type':Sequelize['ENUM'](_0xde9a('0x9'),_0xde9a('0xa')),'allowNull':![],'defaultValue':_0xde9a('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xde9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7c23f71..428917b 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 _0x88e9=['findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','root','format','%s.%s','basename','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','Content-Range','json','save','update','destroy','then','get','ExtractedReports','UserProfileResource','end','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x88e9,0x198));var _0x988e=function(_0x1e71fd,_0x38ce90){_0x1e71fd=_0x1e71fd-0x0;var _0x39282a=_0x88e9[_0x1e71fd];return _0x39282a;};'use strict';var pdf=require(_0x988e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x988e('0x1'));var zipdir=require(_0x988e('0x2'));var jsonpatch=require(_0x988e('0x3'));var rp=require(_0x988e('0x4'));var moment=require('moment');var BPromise=require(_0x988e('0x5'));var Mustache=require(_0x988e('0x6'));var util=require(_0x988e('0x7'));var path=require(_0x988e('0x8'));var sox=require(_0x988e('0x9'));var csv=require(_0x988e('0xa'));var ejs=require(_0x988e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x988e('0xc'));var jsforce=require(_0x988e('0xd'));var deskjs=require(_0x988e('0xe'));var toCsv=require(_0x988e('0xa'));var querystring=require(_0x988e('0xf'));var Papa=require(_0x988e('0x10'));var Redis=require(_0x988e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x988e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x988e('0x13'))('api');var utils=require(_0x988e('0x14'));var config=require(_0x988e('0x15'));var licenseUtil=require(_0x988e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1afe17,_0x59db0b){_0x59db0b=_0x59db0b||0xcc;return function(_0x502b6a){if(_0x502b6a){return _0x1afe17[_0x988e('0x17')](_0x59db0b);}return _0x1afe17[_0x988e('0x18')](_0x59db0b)['end']();};}function respondWithResult(_0x1b1d25,_0xcf5b43){_0xcf5b43=_0xcf5b43||0xc8;return function(_0x5b7f6e){if(_0x5b7f6e){return _0x1b1d25[_0x988e('0x18')](_0xcf5b43)['json'](_0x5b7f6e);}};}function respondWithFilteredResult(_0x2e02b8,_0x17bdd2){return function(_0x3e8aa8){if(_0x3e8aa8){var _0x51d34d=_0x3e8aa8[_0x988e('0x19')],_0x1f6a66=_0x17bdd2[_0x988e('0x1a')],_0x4236bd=_0x17bdd2[_0x988e('0x1a')]+_0x17bdd2[_0x988e('0x1b')],_0x34f140;if(_0x4236bd>=_0x51d34d){_0x4236bd=_0x51d34d;_0x34f140=0xc8;}else{_0x34f140=0xce;}_0x2e02b8[_0x988e('0x18')](_0x34f140);return _0x2e02b8['set'](_0x988e('0x1c'),_0x1f6a66+'-'+_0x4236bd+'/'+_0x51d34d)[_0x988e('0x1d')](_0x3e8aa8);}return null;};}function patchUpdates(_0x2dc83d){return function(_0x5ca189){try{jsonpatch['apply'](_0x5ca189,_0x2dc83d,!![]);}catch(_0x23ae24){return BPromise['reject'](_0x23ae24);}return _0x5ca189[_0x988e('0x1e')]();};}function saveUpdates(_0x27a551,_0x50a70d){return function(_0x240dbe){if(_0x240dbe){return _0x240dbe[_0x988e('0x1f')](_0x27a551)['then'](function(_0x113c34){return _0x113c34;});}return null;};}function removeEntity(_0x1bd0d2,_0x48a493){return function(_0x37119b){if(_0x37119b){return _0x37119b[_0x988e('0x20')]()[_0x988e('0x21')](function(){var _0x4fb8ed=_0x37119b[_0x988e('0x22')]({'plain':!![]});var _0x4b90e7=_0x988e('0x23');return db[_0x988e('0x24')][_0x988e('0x20')]({'where':{'type':_0x4b90e7,'resourceId':_0x4fb8ed['id']}})['then'](function(){return _0x37119b;});})[_0x988e('0x21')](function(){_0x1bd0d2[_0x988e('0x18')](0xcc)[_0x988e('0x25')]();});}};}function handleEntityNotFound(_0x5d35c4,_0x17ba12){return function(_0x3cb567){if(!_0x3cb567){_0x5d35c4[_0x988e('0x17')](0x194);}return _0x3cb567;};}function handleError(_0xf05dfd,_0xdd1abf){_0xdd1abf=_0xdd1abf||0x1f4;return function(_0x42935f){logger['error'](_0x42935f[_0x988e('0x26')]);if(_0x42935f[_0x988e('0x27')]){delete _0x42935f[_0x988e('0x27')];}_0xf05dfd[_0x988e('0x18')](_0xdd1abf)[_0x988e('0x28')](_0x42935f);};}exports[_0x988e('0x29')]=function(_0x188df5,_0x219537){var _0x377939={},_0x530f80={},_0x356f96={'count':0x0,'rows':[]};var _0x2e7c1d=_[_0x988e('0x2a')](db[_0x988e('0x2b')]['rawAttributes'],function(_0x306861){return{'name':_0x306861[_0x988e('0x2c')],'type':_0x306861[_0x988e('0x2d')][_0x988e('0x2e')]};});_0x530f80[_0x988e('0x2f')]=_['map'](_0x2e7c1d,_0x988e('0x27'));_0x530f80['query']=_[_0x988e('0x30')](_0x188df5[_0x988e('0x31')]);_0x530f80[_0x988e('0x32')]=_[_0x988e('0x33')](_0x530f80['model'],_0x530f80['query']);_0x377939[_0x988e('0x34')]=_[_0x988e('0x33')](_0x530f80[_0x988e('0x2f')],qs[_0x988e('0x35')](_0x188df5[_0x988e('0x31')]['fields']));_0x377939['attributes']=_0x377939[_0x988e('0x34')][_0x988e('0x36')]?_0x377939[_0x988e('0x34')]:_0x530f80['model'];if(!_0x188df5[_0x988e('0x31')][_0x988e('0x37')](_0x988e('0x38'))){_0x377939[_0x988e('0x1b')]=qs[_0x988e('0x1b')](_0x188df5[_0x988e('0x31')][_0x988e('0x1b')]);_0x377939['offset']=qs['offset'](_0x188df5[_0x988e('0x31')][_0x988e('0x1a')]);}_0x377939[_0x988e('0x39')]=qs[_0x988e('0x3a')](_0x188df5[_0x988e('0x31')][_0x988e('0x3a')]);_0x377939[_0x988e('0x3b')]=qs['filters'](_[_0x988e('0x3c')](_0x188df5[_0x988e('0x31')],_0x530f80['filters']),_0x2e7c1d);if(_0x188df5['query'][_0x988e('0x3d')]){_0x377939[_0x988e('0x3b')]=_[_0x988e('0x3e')](_0x377939[_0x988e('0x3b')],{'$or':_[_0x988e('0x2a')](_0x2e7c1d,function(_0x1f67f4){if(_0x1f67f4['type']!==_0x988e('0x3f')){var _0x4ad06d={};_0x4ad06d[_0x1f67f4[_0x988e('0x27')]]={'$like':'%'+_0x188df5[_0x988e('0x31')]['filter']+'%'};return _0x4ad06d;}})});}_0x377939=_[_0x988e('0x3e')]({},_0x377939,_0x188df5[_0x988e('0x40')]);var _0x2bb8d4={'where':_0x377939[_0x988e('0x3b')]};return db['AnalyticExtractedReport'][_0x988e('0x19')](_0x2bb8d4)[_0x988e('0x21')](function(_0x532989){_0x356f96['count']=_0x532989;if(_0x188df5['query'][_0x988e('0x41')]){_0x377939[_0x988e('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x988e('0x43')](_0x377939);})['then'](function(_0x381567){_0x356f96['rows']=_0x381567;return _0x356f96;})[_0x988e('0x21')](respondWithFilteredResult(_0x219537,_0x377939))[_0x988e('0x44')](handleError(_0x219537,null));};exports[_0x988e('0x45')]=function(_0x5bbd6f,_0x38d7da){var _0x2abc09={'raw':!![],'where':{'id':_0x5bbd6f[_0x988e('0x46')]['id']}},_0x2eca72={};_0x2eca72[_0x988e('0x2f')]=_[_0x988e('0x30')](db[_0x988e('0x2b')]['rawAttributes']);_0x2eca72[_0x988e('0x31')]=_[_0x988e('0x30')](_0x5bbd6f[_0x988e('0x31')]);_0x2eca72['filters']=_[_0x988e('0x33')](_0x2eca72['model'],_0x2eca72[_0x988e('0x31')]);_0x2abc09[_0x988e('0x34')]=_['intersection'](_0x2eca72[_0x988e('0x2f')],qs[_0x988e('0x35')](_0x5bbd6f[_0x988e('0x31')][_0x988e('0x35')]));_0x2abc09[_0x988e('0x34')]=_0x2abc09['attributes'][_0x988e('0x36')]?_0x2abc09[_0x988e('0x34')]:_0x2eca72[_0x988e('0x2f')];if(_0x5bbd6f['query'][_0x988e('0x41')]){_0x2abc09['include']=[{'all':!![]}];}_0x2abc09=_['merge']({},_0x2abc09,_0x5bbd6f[_0x988e('0x40')]);return db[_0x988e('0x2b')][_0x988e('0x47')](_0x2abc09)[_0x988e('0x21')](handleEntityNotFound(_0x38d7da,null))[_0x988e('0x21')](respondWithResult(_0x38d7da,null))['catch'](handleError(_0x38d7da,null));};exports[_0x988e('0x48')]=function(_0x586058,_0x42002b){return db[_0x988e('0x2b')][_0x988e('0x48')](_0x586058[_0x988e('0x49')],{})['then'](function(_0x46c344){var _0x1fd8d3=_0x586058[_0x988e('0x4a')][_0x988e('0x22')]({'plain':!![]});if(!_0x1fd8d3)throw new Error(_0x988e('0x4b'));if(_0x1fd8d3[_0x988e('0x4c')]===_0x988e('0x4a')){var _0x2879d3=_0x46c344[_0x988e('0x22')]({'plain':!![]});var _0x5b4c4e=_0x988e('0x23');return db[_0x988e('0x4d')]['find']({'where':{'name':_0x5b4c4e,'userProfileId':_0x1fd8d3['userProfileId']},'raw':!![]})['then'](function(_0x4f5637){if(_0x4f5637&&_0x4f5637[_0x988e('0x4e')]===0x0){return db[_0x988e('0x24')][_0x988e('0x48')]({'name':_0x2879d3[_0x988e('0x27')],'resourceId':_0x2879d3['id'],'type':_0x4f5637[_0x988e('0x27')],'sectionId':_0x4f5637['id']},{})[_0x988e('0x21')](function(){return _0x46c344;});}else{return _0x46c344;}})['catch'](function(_0x3f37cf){logger[_0x988e('0x4f')](_0x988e('0x50'),_0x3f37cf);throw _0x3f37cf;});}return _0x46c344;})[_0x988e('0x21')](respondWithResult(_0x42002b,0xc9))[_0x988e('0x44')](handleError(_0x42002b,null));};exports[_0x988e('0x1f')]=function(_0x22add3,_0x45642e){if(_0x22add3[_0x988e('0x49')]['id']){delete _0x22add3[_0x988e('0x49')]['id'];}return db[_0x988e('0x2b')]['find']({'where':{'id':_0x22add3[_0x988e('0x46')]['id']}})[_0x988e('0x21')](handleEntityNotFound(_0x45642e,null))[_0x988e('0x21')](saveUpdates(_0x22add3['body'],null))[_0x988e('0x21')](respondWithResult(_0x45642e,null))['catch'](handleError(_0x45642e,null));};exports[_0x988e('0x20')]=function(_0x51f484,_0x5df0f6){return db[_0x988e('0x2b')][_0x988e('0x47')]({'where':{'id':_0x51f484[_0x988e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5df0f6,null))[_0x988e('0x21')](removeEntity(_0x5df0f6,null))[_0x988e('0x44')](handleError(_0x5df0f6,null));};exports[_0x988e('0x51')]=function(_0x19bf18,_0x1bc659,_0x356f9b){return db[_0x988e('0x2b')]['find']({'where':{'id':_0x19bf18[_0x988e('0x46')]['id']},'attributes':[_0x988e('0x27'),'basename',_0x988e('0x52'),_0x988e('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x1bc659,null))[_0x988e('0x21')](function(_0x14c1f0){if(_0x14c1f0){if(!fs[_0x988e('0x54')](path['join'](config['root'],_0x988e('0x55'),_0x14c1f0['savename']))){throw new db[(_0x988e('0x56'))][(_0x988e('0x57'))](_0x988e('0x58'));}if(_0x19bf18[_0x988e('0x31')]['exists']){return _0x1bc659['sendStatus'](0xc8);}return _0x1bc659[_0x988e('0x51')](path[_0x988e('0x59')](config[_0x988e('0x5a')],_0x988e('0x55'),_0x14c1f0[_0x988e('0x52')]),util[_0x988e('0x5b')](_0x988e('0x5c'),_0x14c1f0[_0x988e('0x5d')]||_0x14c1f0[_0x988e('0x27')],_0x14c1f0['output'][_0x988e('0x5e')]()));}})[_0x988e('0x44')](handleError(_0x1bc659,null));}; \ No newline at end of file +var _0x0693=['VIRTUAL','options','count','includeAll','findAll','show','params','include','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','set','Content-Range','apply','update','then','ExtractedReports','UserProfileResource','destroy','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','type'];(function(_0x6ebad4,_0x268d49){var _0x265f3c=function(_0x32291a){while(--_0x32291a){_0x6ebad4['push'](_0x6ebad4['shift']());}};_0x265f3c(++_0x268d49);}(_0x0693,0x1e6));var _0x3069=function(_0x1e3411,_0x5a9dd4){_0x1e3411=_0x1e3411-0x0;var _0x3a3c10=_0x0693[_0x1e3411];return _0x3a3c10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3069('0x0'));var rimraf=require(_0x3069('0x1'));var zipdir=require(_0x3069('0x2'));var jsonpatch=require(_0x3069('0x3'));var rp=require(_0x3069('0x4'));var moment=require(_0x3069('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3069('0x6'));var util=require(_0x3069('0x7'));var path=require(_0x3069('0x8'));var sox=require('sox');var csv=require(_0x3069('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3069('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3069('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3069('0x9'));var querystring=require(_0x3069('0xc'));var Papa=require('papaparse');var Redis=require(_0x3069('0xd'));var authService=require(_0x3069('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3069('0xf'));var hardwareService=require(_0x3069('0x10'));var logger=require('../../config/logger')(_0x3069('0x11'));var utils=require(_0x3069('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3069('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59faec,_0x299a2f){_0x299a2f=_0x299a2f||0xcc;return function(_0xf93e12){if(_0xf93e12){return _0x59faec[_0x3069('0x14')](_0x299a2f);}return _0x59faec[_0x3069('0x15')](_0x299a2f)['end']();};}function respondWithResult(_0x30cd02,_0x539374){_0x539374=_0x539374||0xc8;return function(_0x3ea42e){if(_0x3ea42e){return _0x30cd02[_0x3069('0x15')](_0x539374)[_0x3069('0x16')](_0x3ea42e);}};}function respondWithFilteredResult(_0x4435c3,_0x478b82){return function(_0x5bd167){if(_0x5bd167){var _0x1b6572=_0x5bd167['count'],_0x4813ae=_0x478b82['offset'],_0x4026b7=_0x478b82['offset']+_0x478b82['limit'],_0x899da9;if(_0x4026b7>=_0x1b6572){_0x4026b7=_0x1b6572;_0x899da9=0xc8;}else{_0x899da9=0xce;}_0x4435c3[_0x3069('0x15')](_0x899da9);return _0x4435c3[_0x3069('0x17')](_0x3069('0x18'),_0x4813ae+'-'+_0x4026b7+'/'+_0x1b6572)[_0x3069('0x16')](_0x5bd167);}return null;};}function patchUpdates(_0x525088){return function(_0x2044ee){try{jsonpatch[_0x3069('0x19')](_0x2044ee,_0x525088,!![]);}catch(_0x59a049){return BPromise['reject'](_0x59a049);}return _0x2044ee['save']();};}function saveUpdates(_0x2aa2a4,_0x16c6b0){return function(_0x1119f7){if(_0x1119f7){return _0x1119f7[_0x3069('0x1a')](_0x2aa2a4)[_0x3069('0x1b')](function(_0x3b3fce){return _0x3b3fce;});}return null;};}function removeEntity(_0x433a1c,_0x5bb5eb){return function(_0x381a3b){if(_0x381a3b){return _0x381a3b['destroy']()[_0x3069('0x1b')](function(){var _0xa77898=_0x381a3b['get']({'plain':!![]});var _0x880fba=_0x3069('0x1c');return db[_0x3069('0x1d')][_0x3069('0x1e')]({'where':{'type':_0x880fba,'resourceId':_0xa77898['id']}})['then'](function(){return _0x381a3b;});})[_0x3069('0x1b')](function(){_0x433a1c[_0x3069('0x15')](0xcc)[_0x3069('0x1f')]();});}};}function handleEntityNotFound(_0x3f76f7,_0x275f15){return function(_0x4f9d7){if(!_0x4f9d7){_0x3f76f7[_0x3069('0x14')](0x194);}return _0x4f9d7;};}function handleError(_0x9f6526,_0x15c23f){_0x15c23f=_0x15c23f||0x1f4;return function(_0x40c952){logger[_0x3069('0x20')](_0x40c952[_0x3069('0x21')]);if(_0x40c952[_0x3069('0x22')]){delete _0x40c952['name'];}_0x9f6526[_0x3069('0x15')](_0x15c23f)[_0x3069('0x23')](_0x40c952);};}exports[_0x3069('0x24')]=function(_0x13f275,_0x42ebc9){var _0x2cf77c={},_0x5ed7ad={},_0x42aa5b={'count':0x0,'rows':[]};var _0x96c66c=_[_0x3069('0x25')](db[_0x3069('0x26')][_0x3069('0x27')],function(_0x3cc65f){return{'name':_0x3cc65f[_0x3069('0x28')],'type':_0x3cc65f['type'][_0x3069('0x29')]};});_0x5ed7ad['model']=_[_0x3069('0x25')](_0x96c66c,_0x3069('0x22'));_0x5ed7ad[_0x3069('0x2a')]=_[_0x3069('0x2b')](_0x13f275[_0x3069('0x2a')]);_0x5ed7ad[_0x3069('0x2c')]=_[_0x3069('0x2d')](_0x5ed7ad[_0x3069('0x2e')],_0x5ed7ad[_0x3069('0x2a')]);_0x2cf77c[_0x3069('0x2f')]=_[_0x3069('0x2d')](_0x5ed7ad[_0x3069('0x2e')],qs[_0x3069('0x30')](_0x13f275['query'][_0x3069('0x30')]));_0x2cf77c[_0x3069('0x2f')]=_0x2cf77c[_0x3069('0x2f')][_0x3069('0x31')]?_0x2cf77c[_0x3069('0x2f')]:_0x5ed7ad[_0x3069('0x2e')];if(!_0x13f275[_0x3069('0x2a')][_0x3069('0x32')](_0x3069('0x33'))){_0x2cf77c['limit']=qs[_0x3069('0x34')](_0x13f275[_0x3069('0x2a')][_0x3069('0x34')]);_0x2cf77c[_0x3069('0x35')]=qs['offset'](_0x13f275['query']['offset']);}_0x2cf77c[_0x3069('0x36')]=qs['sort'](_0x13f275[_0x3069('0x2a')][_0x3069('0x37')]);_0x2cf77c[_0x3069('0x38')]=qs[_0x3069('0x2c')](_[_0x3069('0x39')](_0x13f275[_0x3069('0x2a')],_0x5ed7ad[_0x3069('0x2c')]),_0x96c66c);if(_0x13f275[_0x3069('0x2a')]['filter']){_0x2cf77c[_0x3069('0x38')]=_[_0x3069('0x3a')](_0x2cf77c[_0x3069('0x38')],{'$or':_['map'](_0x96c66c,function(_0x21df5d){if(_0x21df5d[_0x3069('0x3b')]!==_0x3069('0x3c')){var _0x337666={};_0x337666[_0x21df5d[_0x3069('0x22')]]={'$like':'%'+_0x13f275['query']['filter']+'%'};return _0x337666;}})});}_0x2cf77c=_['merge']({},_0x2cf77c,_0x13f275[_0x3069('0x3d')]);var _0x456daf={'where':_0x2cf77c[_0x3069('0x38')]};return db[_0x3069('0x26')]['count'](_0x456daf)[_0x3069('0x1b')](function(_0xf1e57f){_0x42aa5b[_0x3069('0x3e')]=_0xf1e57f;if(_0x13f275['query'][_0x3069('0x3f')]){_0x2cf77c['include']=[{'all':!![]}];}return db[_0x3069('0x26')][_0x3069('0x40')](_0x2cf77c);})[_0x3069('0x1b')](function(_0x292721){_0x42aa5b['rows']=_0x292721;return _0x42aa5b;})['then'](respondWithFilteredResult(_0x42ebc9,_0x2cf77c))['catch'](handleError(_0x42ebc9,null));};exports[_0x3069('0x41')]=function(_0x485d09,_0x39c91c){var _0x4bdd54={'raw':!![],'where':{'id':_0x485d09[_0x3069('0x42')]['id']}},_0x5aa89a={};_0x5aa89a['model']=_[_0x3069('0x2b')](db[_0x3069('0x26')][_0x3069('0x27')]);_0x5aa89a[_0x3069('0x2a')]=_[_0x3069('0x2b')](_0x485d09[_0x3069('0x2a')]);_0x5aa89a[_0x3069('0x2c')]=_[_0x3069('0x2d')](_0x5aa89a[_0x3069('0x2e')],_0x5aa89a[_0x3069('0x2a')]);_0x4bdd54[_0x3069('0x2f')]=_[_0x3069('0x2d')](_0x5aa89a[_0x3069('0x2e')],qs[_0x3069('0x30')](_0x485d09[_0x3069('0x2a')][_0x3069('0x30')]));_0x4bdd54[_0x3069('0x2f')]=_0x4bdd54[_0x3069('0x2f')][_0x3069('0x31')]?_0x4bdd54[_0x3069('0x2f')]:_0x5aa89a[_0x3069('0x2e')];if(_0x485d09[_0x3069('0x2a')]['includeAll']){_0x4bdd54[_0x3069('0x43')]=[{'all':!![]}];}_0x4bdd54=_['merge']({},_0x4bdd54,_0x485d09[_0x3069('0x3d')]);return db[_0x3069('0x26')][_0x3069('0x44')](_0x4bdd54)[_0x3069('0x1b')](handleEntityNotFound(_0x39c91c,null))[_0x3069('0x1b')](respondWithResult(_0x39c91c,null))[_0x3069('0x45')](handleError(_0x39c91c,null));};exports[_0x3069('0x46')]=function(_0x23e899,_0x555787){return db['AnalyticExtractedReport'][_0x3069('0x46')](_0x23e899[_0x3069('0x47')],{})['then'](function(_0x29cc05){var _0x5ca3e2=_0x23e899[_0x3069('0x48')][_0x3069('0x49')]({'plain':!![]});if(!_0x5ca3e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ca3e2[_0x3069('0x4a')]==='user'){var _0x53e100=_0x29cc05[_0x3069('0x49')]({'plain':!![]});var _0x41af1a=_0x3069('0x1c');return db[_0x3069('0x4b')][_0x3069('0x44')]({'where':{'name':_0x41af1a,'userProfileId':_0x5ca3e2[_0x3069('0x4c')]},'raw':!![]})[_0x3069('0x1b')](function(_0x2a2241){if(_0x2a2241&&_0x2a2241[_0x3069('0x4d')]===0x0){return db[_0x3069('0x1d')][_0x3069('0x46')]({'name':_0x53e100[_0x3069('0x22')],'resourceId':_0x53e100['id'],'type':_0x2a2241['name'],'sectionId':_0x2a2241['id']},{})[_0x3069('0x1b')](function(){return _0x29cc05;});}else{return _0x29cc05;}})[_0x3069('0x45')](function(_0x689c60){logger[_0x3069('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x689c60);throw _0x689c60;});}return _0x29cc05;})[_0x3069('0x1b')](respondWithResult(_0x555787,0xc9))['catch'](handleError(_0x555787,null));};exports[_0x3069('0x1a')]=function(_0x272f73,_0x32cb55){if(_0x272f73[_0x3069('0x47')]['id']){delete _0x272f73[_0x3069('0x47')]['id'];}return db[_0x3069('0x26')][_0x3069('0x44')]({'where':{'id':_0x272f73[_0x3069('0x42')]['id']}})[_0x3069('0x1b')](handleEntityNotFound(_0x32cb55,null))[_0x3069('0x1b')](saveUpdates(_0x272f73[_0x3069('0x47')],null))[_0x3069('0x1b')](respondWithResult(_0x32cb55,null))[_0x3069('0x45')](handleError(_0x32cb55,null));};exports[_0x3069('0x1e')]=function(_0x161007,_0x35308e){return db['AnalyticExtractedReport'][_0x3069('0x44')]({'where':{'id':_0x161007[_0x3069('0x42')]['id']}})[_0x3069('0x1b')](handleEntityNotFound(_0x35308e,null))['then'](removeEntity(_0x35308e,null))['catch'](handleError(_0x35308e,null));};exports[_0x3069('0x4e')]=function(_0xba5b43,_0x5902bb,_0x5af09d){return db[_0x3069('0x26')][_0x3069('0x44')]({'where':{'id':_0xba5b43[_0x3069('0x42')]['id']},'attributes':[_0x3069('0x22'),_0x3069('0x4f'),_0x3069('0x50'),_0x3069('0x51')],'raw':!![]})[_0x3069('0x1b')](handleEntityNotFound(_0x5902bb,null))[_0x3069('0x1b')](function(_0xb3cb04){if(_0xb3cb04){if(!fs[_0x3069('0x52')](path[_0x3069('0x53')](config['root'],_0x3069('0x54'),_0xb3cb04[_0x3069('0x50')]))){throw new db[(_0x3069('0x55'))][(_0x3069('0x56'))](_0x3069('0x57'));}if(_0xba5b43['query'][_0x3069('0x58')]){return _0x5902bb['sendStatus'](0xc8);}return _0x5902bb[_0x3069('0x4e')](path[_0x3069('0x53')](config['root'],_0x3069('0x54'),_0xb3cb04[_0x3069('0x50')]),util[_0x3069('0x59')]('%s.%s',_0xb3cb04[_0x3069('0x4f')]||_0xb3cb04[_0x3069('0x22')],_0xb3cb04['output'][_0x3069('0x5a')]()));}})['catch'](handleError(_0x5902bb,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 00be143..f2d5607 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 _0x3de3=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x235ba7,_0xf32628){var _0x2ff3f7=function(_0x28da31){while(--_0x28da31){_0x235ba7['push'](_0x235ba7['shift']());}};_0x2ff3f7(++_0xf32628);}(_0x3de3,0x1ab));var _0x33de=function(_0x1d70e0,_0x4fb9d9){_0x1d70e0=_0x1d70e0-0x0;var _0x390829=_0x3de3[_0x1d70e0];return _0x390829;};'use strict';var _=require(_0x33de('0x0'));var util=require(_0x33de('0x1'));var logger=require(_0x33de('0x2'))(_0x33de('0x3'));var moment=require(_0x33de('0x4'));var BPromise=require(_0x33de('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33de('0x6'));var rimraf=require(_0x33de('0x7'));var config=require(_0x33de('0x8'));var attributes=require(_0x33de('0x9'));module[_0x33de('0xa')]=function(_0x2a3254,_0x55f0c3){return _0x2a3254['define'](_0x33de('0xb'),attributes,{'tableName':_0x33de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94e2=['analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x28e486,_0x3f1229){var _0x3ffc09=function(_0x3226c9){while(--_0x3226c9){_0x28e486['push'](_0x28e486['shift']());}};_0x3ffc09(++_0x3f1229);}(_0x94e2,0x1a5));var _0x294e=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0x94e2[_0x3bee55];return _0x5649d2;};'use strict';var _=require(_0x294e('0x0'));var util=require(_0x294e('0x1'));var logger=require(_0x294e('0x2'))(_0x294e('0x3'));var moment=require(_0x294e('0x4'));var BPromise=require(_0x294e('0x5'));var rp=require(_0x294e('0x6'));var fs=require('fs');var path=require(_0x294e('0x7'));var rimraf=require(_0x294e('0x8'));var config=require(_0x294e('0x9'));var attributes=require(_0x294e('0xa'));module[_0x294e('0xb')]=function(_0xc5a26f,_0x3c77a9){return _0xc5a26f[_0x294e('0xc')]('AnalyticExtractedReport',attributes,{'tableName':_0x294e('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 8ac5ad4..9196123 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 _0x0ec2=['http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x0ec2,0xcf));var _0x20ec=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0x0ec2[_0x5d88c0];return _0x1b40f0;};'use strict';var _=require(_0x20ec('0x0'));var util=require(_0x20ec('0x1'));var moment=require(_0x20ec('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ec('0x3'));var db=require(_0x20ec('0x4'))['db'];var utils=require(_0x20ec('0x5'));var logger=require(_0x20ec('0x6'))(_0x20ec('0x7'));var config=require(_0x20ec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x20ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ddcd8,_0x4ee144,_0x40651d){return new BPromise(function(_0x43d40e,_0x5e888f){return client['request'](_0x3ddcd8,_0x40651d)[_0x20ec('0xa')](function(_0x1daec4){logger['info'](_0x20ec('0xb'),_0x4ee144,_0x20ec('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4ee144,'request\x20sent',JSON['stringify'](_0x1daec4));if(_0x1daec4[_0x20ec('0xd')]){if(_0x1daec4[_0x20ec('0xd')][_0x20ec('0xe')]===0x1f4){logger[_0x20ec('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ee144,_0x1daec4[_0x20ec('0xd')][_0x20ec('0xf')]);return _0x5e888f(_0x1daec4[_0x20ec('0xd')][_0x20ec('0xf')]);}logger[_0x20ec('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ee144,_0x1daec4['error'][_0x20ec('0xf')]);return _0x43d40e(_0x1daec4[_0x20ec('0xd')][_0x20ec('0xf')]);}else{logger['info'](_0x20ec('0xb'),_0x4ee144,_0x20ec('0xc'));_0x43d40e(_0x1daec4[_0x20ec('0x10')]['message']);}})[_0x20ec('0x11')](function(_0x4a2da9){logger[_0x20ec('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ee144,_0x4a2da9);_0x5e888f(_0x4a2da9);});});} \ No newline at end of file +var _0xcaaf=['../../config/logger','http','request','then','info','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23ce40,_0xcc9a2){var _0x169e30=function(_0x5d8733){while(--_0x5d8733){_0x23ce40['push'](_0x23ce40['shift']());}};_0x169e30(++_0xcc9a2);}(_0xcaaf,0xdc));var _0xfcaa=function(_0x3d0d2d,_0xb9dd36){_0x3d0d2d=_0x3d0d2d-0x0;var _0x542028=_0xcaaf[_0x3d0d2d];return _0x542028;};'use strict';var _=require(_0xfcaa('0x0'));var util=require(_0xfcaa('0x1'));var moment=require(_0xfcaa('0x2'));var BPromise=require(_0xfcaa('0x3'));var rs=require(_0xfcaa('0x4'));var fs=require('fs');var Redis=require(_0xfcaa('0x5'));var db=require(_0xfcaa('0x6'))['db'];var utils=require(_0xfcaa('0x7'));var logger=require(_0xfcaa('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfcaa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x512116,_0x1ab603,_0xdc9daf){return new BPromise(function(_0x2c91b3,_0x2cbfda){return client[_0xfcaa('0xa')](_0x512116,_0xdc9daf)[_0xfcaa('0xb')](function(_0x4b5b40){logger[_0xfcaa('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1ab603,'request\x20sent');logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1ab603,'request\x20sent',JSON[_0xfcaa('0xd')](_0x4b5b40));if(_0x4b5b40[_0xfcaa('0xe')]){if(_0x4b5b40[_0xfcaa('0xe')]['code']===0x1f4){logger[_0xfcaa('0xe')](_0xfcaa('0xf'),_0x1ab603,_0x4b5b40[_0xfcaa('0xe')][_0xfcaa('0x10')]);return _0x2cbfda(_0x4b5b40['error']['message']);}logger[_0xfcaa('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1ab603,_0x4b5b40[_0xfcaa('0xe')][_0xfcaa('0x10')]);return _0x2c91b3(_0x4b5b40[_0xfcaa('0xe')][_0xfcaa('0x10')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1ab603,_0xfcaa('0x11'));_0x2c91b3(_0x4b5b40['result']['message']);}})[_0xfcaa('0x12')](function(_0x49958e){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1ab603,_0x49958e);_0x2cbfda(_0x49958e);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index fabaab1..c16d4c0 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 _0xb64e=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0xfcfe92,_0x14ea66){var _0x166ba1=function(_0x45f01a){while(--_0x45f01a){_0xfcfe92['push'](_0xfcfe92['shift']());}};_0x166ba1(++_0x14ea66);}(_0xb64e,0x89));var _0xeb64=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xb64e[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0xeb64('0x0'));var util=require(_0xeb64('0x1'));var path=require('path');var timeout=require(_0xeb64('0x2'));var express=require(_0xeb64('0x3'));var router=express[_0xeb64('0x4')]();var auth=require(_0xeb64('0x5'));var interaction=require(_0xeb64('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xeb64('0x7')]('/',auth[_0xeb64('0x8')](),controller[_0xeb64('0x9')]);router[_0xeb64('0x7')](_0xeb64('0xa'),auth[_0xeb64('0x8')](),controller[_0xeb64('0xb')]);router[_0xeb64('0x7')]('/:id/download',auth[_0xeb64('0x8')](),controller['download']);router[_0xeb64('0xc')]('/',auth['isAuthenticated'](),controller[_0xeb64('0xd')]);router[_0xeb64('0xe')](_0xeb64('0xa'),auth[_0xeb64('0x8')](),controller[_0xeb64('0xf')]);router['delete'](_0xeb64('0xa'),auth[_0xeb64('0x8')](),controller[_0xeb64('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8bec=['create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','show','/:id/download','download','post'];(function(_0x90e9ab,_0x426802){var _0xdfa58b=function(_0x3d760e){while(--_0x3d760e){_0x90e9ab['push'](_0x90e9ab['shift']());}};_0xdfa58b(++_0x426802);}(_0x8bec,0x6e));var _0xc8be=function(_0x1de76c,_0x5beff3){_0x1de76c=_0x1de76c-0x0;var _0x277b11=_0x8bec[_0x1de76c];return _0x277b11;};'use strict';var multer=require(_0xc8be('0x0'));var util=require(_0xc8be('0x1'));var path=require(_0xc8be('0x2'));var timeout=require(_0xc8be('0x3'));var express=require('express');var router=express[_0xc8be('0x4')]();var auth=require(_0xc8be('0x5'));var interaction=require(_0xc8be('0x6'));var config=require(_0xc8be('0x7'));var controller=require(_0xc8be('0x8'));router[_0xc8be('0x9')]('/',auth['isAuthenticated'](),controller[_0xc8be('0xa')]);router['get']('/:id',auth[_0xc8be('0xb')](),controller[_0xc8be('0xc')]);router[_0xc8be('0x9')](_0xc8be('0xd'),auth[_0xc8be('0xb')](),controller[_0xc8be('0xe')]);router[_0xc8be('0xf')]('/',auth['isAuthenticated'](),controller[_0xc8be('0x10')]);router[_0xc8be('0x11')](_0xc8be('0x12'),auth[_0xc8be('0xb')](),controller[_0xc8be('0x13')]);router['delete'](_0xc8be('0x12'),auth['isAuthenticated'](),controller[_0xc8be('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c832683..554dfa9 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3d0b10,_0x993cdd){var _0x16121b=function(_0xb8a246){while(--_0xb8a246){_0x3d0b10['push'](_0x3d0b10['shift']());}};_0x16121b(++_0x993cdd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x5fc3[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1034b2,_0x432fd7){var _0xc638be=function(_0x584a01){while(--_0x584a01){_0x1034b2['push'](_0x1034b2['shift']());}};_0xc638be(++_0x432fd7);}(_0x1261,0x144));var _0x1126=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0x1261[_0x33d4a2];return _0x2c793f;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ae3b3df..382ee8f 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 _0x72d8=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticFieldReport','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0x480ab1,_0x2ab18d){var _0xb8e7b4=function(_0x9ea56d){while(--_0x9ea56d){_0x480ab1['push'](_0x480ab1['shift']());}};_0xb8e7b4(++_0x2ab18d);}(_0x72d8,0x135));var _0x872d=function(_0x585199,_0x10d223){_0x585199=_0x585199-0x0;var _0x4f5eaf=_0x72d8[_0x585199];return _0x4f5eaf;};'use strict';var pdf=require(_0x872d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x872d('0x1'));var zipdir=require(_0x872d('0x2'));var jsonpatch=require(_0x872d('0x3'));var rp=require(_0x872d('0x4'));var moment=require(_0x872d('0x5'));var BPromise=require(_0x872d('0x6'));var Mustache=require(_0x872d('0x7'));var util=require(_0x872d('0x8'));var path=require(_0x872d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x872d('0xa'));var fs=require('fs');var _=require(_0x872d('0xb'));var squel=require(_0x872d('0xc'));var crypto=require(_0x872d('0xd'));var jsforce=require(_0x872d('0xe'));var deskjs=require(_0x872d('0xf'));var toCsv=require(_0x872d('0x10'));var querystring=require(_0x872d('0x11'));var Papa=require('papaparse');var Redis=require(_0x872d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x872d('0x13'));var as=require(_0x872d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x872d('0x15'))('api');var utils=require(_0x872d('0x16'));var config=require(_0x872d('0x17'));var licenseUtil=require(_0x872d('0x18'));var db=require(_0x872d('0x19'))['db'];function respondWithStatusCode(_0x1ac371,_0x91657b){_0x91657b=_0x91657b||0xcc;return function(_0xd6cc4e){if(_0xd6cc4e){return _0x1ac371[_0x872d('0x1a')](_0x91657b);}return _0x1ac371[_0x872d('0x1b')](_0x91657b)[_0x872d('0x1c')]();};}function respondWithResult(_0x4b9767,_0x5d3233){_0x5d3233=_0x5d3233||0xc8;return function(_0x24254b){if(_0x24254b){return _0x4b9767[_0x872d('0x1b')](_0x5d3233)[_0x872d('0x1d')](_0x24254b);}};}function respondWithFilteredResult(_0x268ec1,_0xb754a5){return function(_0xac9df1){if(_0xac9df1){var _0x438f1e=_0xac9df1['count'],_0x30a1c8=_0xb754a5[_0x872d('0x1e')],_0x476eeb=_0xb754a5[_0x872d('0x1e')]+_0xb754a5[_0x872d('0x1f')],_0x21fad3;if(_0x476eeb>=_0x438f1e){_0x476eeb=_0x438f1e;_0x21fad3=0xc8;}else{_0x21fad3=0xce;}_0x268ec1[_0x872d('0x1b')](_0x21fad3);return _0x268ec1['set'](_0x872d('0x20'),_0x30a1c8+'-'+_0x476eeb+'/'+_0x438f1e)[_0x872d('0x1d')](_0xac9df1);}return null;};}function patchUpdates(_0x2377ec){return function(_0x56e4ec){try{jsonpatch[_0x872d('0x21')](_0x56e4ec,_0x2377ec,!![]);}catch(_0x35e56f){return BPromise[_0x872d('0x22')](_0x35e56f);}return _0x56e4ec[_0x872d('0x23')]();};}function saveUpdates(_0x1d94fb,_0x3b57ac){return function(_0x4c6b0c){if(_0x4c6b0c){return _0x4c6b0c['update'](_0x1d94fb)[_0x872d('0x24')](function(_0x1a5bf8){return _0x1a5bf8;});}return null;};}function removeEntity(_0x186cd0,_0x342cb1){return function(_0x200f67){if(_0x200f67){return _0x200f67[_0x872d('0x25')]()[_0x872d('0x24')](function(){_0x186cd0['status'](0xcc)[_0x872d('0x1c')]();});}};}function handleEntityNotFound(_0x499b7e,_0x19450f){return function(_0x19b0b7){if(!_0x19b0b7){_0x499b7e['sendStatus'](0x194);}return _0x19b0b7;};}function handleError(_0x476034,_0x433d22){_0x433d22=_0x433d22||0x1f4;return function(_0x4d64f4){logger[_0x872d('0x26')](_0x4d64f4[_0x872d('0x27')]);if(_0x4d64f4['name']){delete _0x4d64f4[_0x872d('0x28')];}_0x476034['status'](_0x433d22)['send'](_0x4d64f4);};}exports[_0x872d('0x29')]=function(_0xa2a2a7,_0x53fb33){var _0x52a956={},_0x286355={},_0x2dcab9={'count':0x0,'rows':[]};var _0x54c107=_[_0x872d('0x2a')](db[_0x872d('0x2b')]['rawAttributes'],function(_0x3f9839){return{'name':_0x3f9839[_0x872d('0x2c')],'type':_0x3f9839[_0x872d('0x2d')]['key']};});_0x286355[_0x872d('0x2e')]=_[_0x872d('0x2a')](_0x54c107,_0x872d('0x28'));_0x286355[_0x872d('0x2f')]=_['keys'](_0xa2a2a7[_0x872d('0x2f')]);_0x286355['filters']=_[_0x872d('0x30')](_0x286355[_0x872d('0x2e')],_0x286355['query']);_0x52a956[_0x872d('0x31')]=_['intersection'](_0x286355[_0x872d('0x2e')],qs['fields'](_0xa2a2a7['query'][_0x872d('0x32')]));_0x52a956[_0x872d('0x31')]=_0x52a956[_0x872d('0x31')][_0x872d('0x33')]?_0x52a956['attributes']:_0x286355[_0x872d('0x2e')];if(!_0xa2a2a7[_0x872d('0x2f')]['hasOwnProperty'](_0x872d('0x34'))){_0x52a956[_0x872d('0x1f')]=qs[_0x872d('0x1f')](_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x1f')]);_0x52a956['offset']=qs[_0x872d('0x1e')](_0xa2a2a7[_0x872d('0x2f')]['offset']);}_0x52a956[_0x872d('0x35')]=qs[_0x872d('0x36')](_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x36')]);_0x52a956[_0x872d('0x37')]=qs[_0x872d('0x38')](_['pick'](_0xa2a2a7[_0x872d('0x2f')],_0x286355[_0x872d('0x38')]),_0x54c107);if(_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x39')]){_0x52a956['where']=_[_0x872d('0x3a')](_0x52a956[_0x872d('0x37')],{'$or':_[_0x872d('0x2a')](_0x54c107,function(_0x3bdd3c){if(_0x3bdd3c[_0x872d('0x2d')]!==_0x872d('0x3b')){var _0x18acd2={};_0x18acd2[_0x3bdd3c[_0x872d('0x28')]]={'$like':'%'+_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x39')]+'%'};return _0x18acd2;}})});}_0x52a956=_['merge']({},_0x52a956,_0xa2a2a7['options']);var _0x986b49={'where':_0x52a956[_0x872d('0x37')]};return db['AnalyticFieldReport']['count'](_0x986b49)[_0x872d('0x24')](function(_0x13de03){_0x2dcab9['count']=_0x13de03;if(_0xa2a2a7['query'][_0x872d('0x3c')]){_0x52a956[_0x872d('0x3d')]=[{'all':!![]}];}return db[_0x872d('0x2b')][_0x872d('0x3e')](_0x52a956);})[_0x872d('0x24')](function(_0x174298){_0x2dcab9[_0x872d('0x3f')]=_0x174298;return _0x2dcab9;})[_0x872d('0x24')](respondWithFilteredResult(_0x53fb33,_0x52a956))[_0x872d('0x40')](handleError(_0x53fb33,null));};exports[_0x872d('0x41')]=function(_0x3ed936,_0x5015dd){var _0x2e458c={'raw':![],'where':{'id':_0x3ed936[_0x872d('0x42')]['id']}},_0x4eeef4={};_0x4eeef4[_0x872d('0x2e')]=_[_0x872d('0x43')](db[_0x872d('0x2b')]['rawAttributes']);_0x4eeef4[_0x872d('0x2f')]=_[_0x872d('0x43')](_0x3ed936['query']);_0x4eeef4[_0x872d('0x38')]=_[_0x872d('0x30')](_0x4eeef4[_0x872d('0x2e')],_0x4eeef4['query']);_0x2e458c['attributes']=_[_0x872d('0x30')](_0x4eeef4[_0x872d('0x2e')],qs[_0x872d('0x32')](_0x3ed936[_0x872d('0x2f')][_0x872d('0x32')]));_0x2e458c[_0x872d('0x31')]=_0x2e458c[_0x872d('0x31')][_0x872d('0x33')]?_0x2e458c[_0x872d('0x31')]:_0x4eeef4[_0x872d('0x2e')];if(_0x3ed936['query'][_0x872d('0x3c')]){_0x2e458c['include']=[{'all':!![]}];}_0x2e458c=_[_0x872d('0x3a')]({},_0x2e458c,_0x3ed936[_0x872d('0x44')]);return db[_0x872d('0x2b')][_0x872d('0x45')](_0x2e458c)[_0x872d('0x24')](handleEntityNotFound(_0x5015dd,null))[_0x872d('0x24')](respondWithResult(_0x5015dd,null))[_0x872d('0x40')](handleError(_0x5015dd,null));};exports[_0x872d('0x46')]=function(_0x2b63f8,_0x594b65){return db[_0x872d('0x2b')]['create'](_0x2b63f8[_0x872d('0x47')],{})[_0x872d('0x24')](respondWithResult(_0x594b65,0xc9))['catch'](handleError(_0x594b65,null));};exports[_0x872d('0x48')]=function(_0xc8f960,_0x941680){return db['AnalyticFieldReport'][_0x872d('0x48')](_0xc8f960[_0x872d('0x47')],{'raw':![],'individualHooks':!![]})[_0x872d('0x24')](respondWithResult(_0x941680,0xc9))['catch'](handleError(_0x941680,null));};exports['update']=function(_0x1514f0,_0x406be2){if(_0x1514f0[_0x872d('0x47')]['id']){delete _0x1514f0[_0x872d('0x47')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x1514f0[_0x872d('0x42')]['id']}})[_0x872d('0x24')](handleEntityNotFound(_0x406be2,null))[_0x872d('0x24')](saveUpdates(_0x1514f0[_0x872d('0x47')],null))[_0x872d('0x24')](respondWithResult(_0x406be2,null))[_0x872d('0x40')](handleError(_0x406be2,null));};exports[_0x872d('0x25')]=function(_0x2ec1f8,_0x51448e){return db[_0x872d('0x2b')][_0x872d('0x45')]({'where':{'id':_0x2ec1f8[_0x872d('0x42')]['id']}})[_0x872d('0x24')](handleEntityNotFound(_0x51448e,null))[_0x872d('0x24')](removeEntity(_0x51448e,null))['catch'](handleError(_0x51448e,null));};exports[_0x872d('0x49')]=function(_0x3ad71e,_0x1a2dee){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x3ad71e[_0x872d('0x2f')][_0x872d('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1a2dee,0xcc))[_0x872d('0x40')](handleError(_0x1a2dee,null));};exports[_0x872d('0x4b')]=function(_0x3411d5,_0x43009d,_0x1b0b08){return db[_0x872d('0x4c')]['findOne']({'where':{'id':_0x3411d5['params']['id']}})[_0x872d('0x24')](handleEntityNotFound(_0x43009d,null))[_0x872d('0x24')](function(_0x1837fc){if(_0x1837fc){return db[_0x872d('0x4d')][_0x872d('0x4e')](function(_0x563b91){return db[_0x872d('0x2b')][_0x872d('0x25')]({'where':{'CustomReportId':_0x3411d5['params']['id']},'transaction':_0x563b91})[_0x872d('0x24')](function(_0x225753){var _0x49517f=_[_0x872d('0x2a')](_0x3411d5[_0x872d('0x47')],function(_0x462571){delete _0x462571['id'];_0x462571[_0x872d('0x4f')]=_0x3411d5[_0x872d('0x42')]['id'];return _0x462571;});return db['AnalyticFieldReport'][_0x872d('0x48')](_0x49517f,{'transaction':_0x563b91});});})[_0x872d('0x24')](function(){return db['AnalyticFieldReport'][_0x872d('0x3e')]({'where':{'CustomReportId':_0x3411d5[_0x872d('0x42')]['id']}});});}})[_0x872d('0x24')](respondWithResult(_0x43009d,null))[_0x872d('0x40')](handleError(_0x43009d,null));}; \ No newline at end of file +var _0x4835=['index','map','AnalyticFieldReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','merge','where','includeAll','include','findAll','rows','catch','show','rawAttributes','length','options','create','body','update','find','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','bulkCreate','html-pdf','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x4835,0x162));var _0x5483=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x4835[_0x8b8564];return _0x360c61;};'use strict';var pdf=require(_0x5483('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5483('0x1'));var moment=require('moment');var BPromise=require(_0x5483('0x2'));var Mustache=require('mustache');var util=require(_0x5483('0x3'));var path=require('path');var sox=require(_0x5483('0x4'));var csv=require(_0x5483('0x5'));var ejs=require(_0x5483('0x6'));var fs=require('fs');var _=require(_0x5483('0x7'));var squel=require(_0x5483('0x8'));var crypto=require('crypto');var jsforce=require(_0x5483('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5483('0x5'));var querystring=require(_0x5483('0xa'));var Papa=require(_0x5483('0xb'));var Redis=require('ioredis');var authService=require(_0x5483('0xc'));var qs=require(_0x5483('0xd'));var as=require(_0x5483('0xe'));var hardwareService=require(_0x5483('0xf'));var logger=require(_0x5483('0x10'))('api');var utils=require(_0x5483('0x11'));var config=require(_0x5483('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5483('0x13'))['db'];function respondWithStatusCode(_0x438bd1,_0x54f380){_0x54f380=_0x54f380||0xcc;return function(_0x3b9fae){if(_0x3b9fae){return _0x438bd1[_0x5483('0x14')](_0x54f380);}return _0x438bd1['status'](_0x54f380)[_0x5483('0x15')]();};}function respondWithResult(_0x965711,_0x16a466){_0x16a466=_0x16a466||0xc8;return function(_0x10441e){if(_0x10441e){return _0x965711[_0x5483('0x16')](_0x16a466)[_0x5483('0x17')](_0x10441e);}};}function respondWithFilteredResult(_0x9039af,_0x323bd1){return function(_0x3be167){if(_0x3be167){var _0x40ed39=_0x3be167[_0x5483('0x18')],_0x47e925=_0x323bd1[_0x5483('0x19')],_0x235e18=_0x323bd1[_0x5483('0x19')]+_0x323bd1[_0x5483('0x1a')],_0x20827a;if(_0x235e18>=_0x40ed39){_0x235e18=_0x40ed39;_0x20827a=0xc8;}else{_0x20827a=0xce;}_0x9039af[_0x5483('0x16')](_0x20827a);return _0x9039af[_0x5483('0x1b')](_0x5483('0x1c'),_0x47e925+'-'+_0x235e18+'/'+_0x40ed39)['json'](_0x3be167);}return null;};}function patchUpdates(_0x132ba2){return function(_0xf0a7db){try{jsonpatch[_0x5483('0x1d')](_0xf0a7db,_0x132ba2,!![]);}catch(_0x32c479){return BPromise[_0x5483('0x1e')](_0x32c479);}return _0xf0a7db['save']();};}function saveUpdates(_0x47026a,_0x38bae3){return function(_0xbffe72){if(_0xbffe72){return _0xbffe72['update'](_0x47026a)[_0x5483('0x1f')](function(_0x15c911){return _0x15c911;});}return null;};}function removeEntity(_0x9a2d3c,_0x194c54){return function(_0x2814af){if(_0x2814af){return _0x2814af[_0x5483('0x20')]()['then'](function(){_0x9a2d3c[_0x5483('0x16')](0xcc)[_0x5483('0x15')]();});}};}function handleEntityNotFound(_0x91be2e,_0x55a785){return function(_0x1fc85f){if(!_0x1fc85f){_0x91be2e[_0x5483('0x14')](0x194);}return _0x1fc85f;};}function handleError(_0x2f681a,_0x4b016b){_0x4b016b=_0x4b016b||0x1f4;return function(_0x58bed5){logger[_0x5483('0x21')](_0x58bed5[_0x5483('0x22')]);if(_0x58bed5[_0x5483('0x23')]){delete _0x58bed5['name'];}_0x2f681a[_0x5483('0x16')](_0x4b016b)['send'](_0x58bed5);};}exports[_0x5483('0x24')]=function(_0x418de1,_0x4c58c0){var _0x390846={},_0x3a4d79={},_0x1fa822={'count':0x0,'rows':[]};var _0x37ad03=_[_0x5483('0x25')](db[_0x5483('0x26')]['rawAttributes'],function(_0x49fee3){return{'name':_0x49fee3[_0x5483('0x27')],'type':_0x49fee3[_0x5483('0x28')][_0x5483('0x29')]};});_0x3a4d79['model']=_[_0x5483('0x25')](_0x37ad03,'name');_0x3a4d79[_0x5483('0x2a')]=_[_0x5483('0x2b')](_0x418de1['query']);_0x3a4d79[_0x5483('0x2c')]=_[_0x5483('0x2d')](_0x3a4d79[_0x5483('0x2e')],_0x3a4d79[_0x5483('0x2a')]);_0x390846[_0x5483('0x2f')]=_['intersection'](_0x3a4d79['model'],qs[_0x5483('0x30')](_0x418de1[_0x5483('0x2a')][_0x5483('0x30')]));_0x390846['attributes']=_0x390846[_0x5483('0x2f')]['length']?_0x390846['attributes']:_0x3a4d79[_0x5483('0x2e')];if(!_0x418de1[_0x5483('0x2a')]['hasOwnProperty'](_0x5483('0x31'))){_0x390846[_0x5483('0x1a')]=qs[_0x5483('0x1a')](_0x418de1[_0x5483('0x2a')]['limit']);_0x390846['offset']=qs[_0x5483('0x19')](_0x418de1['query'][_0x5483('0x19')]);}_0x390846[_0x5483('0x32')]=qs[_0x5483('0x33')](_0x418de1['query']['sort']);_0x390846['where']=qs['filters'](_[_0x5483('0x34')](_0x418de1[_0x5483('0x2a')],_0x3a4d79[_0x5483('0x2c')]),_0x37ad03);if(_0x418de1[_0x5483('0x2a')][_0x5483('0x35')]){_0x390846['where']=_[_0x5483('0x36')](_0x390846[_0x5483('0x37')],{'$or':_['map'](_0x37ad03,function(_0x893c40){if(_0x893c40['type']!=='VIRTUAL'){var _0x4026a7={};_0x4026a7[_0x893c40[_0x5483('0x23')]]={'$like':'%'+_0x418de1[_0x5483('0x2a')]['filter']+'%'};return _0x4026a7;}})});}_0x390846=_['merge']({},_0x390846,_0x418de1['options']);var _0x57b4c2={'where':_0x390846[_0x5483('0x37')]};return db[_0x5483('0x26')][_0x5483('0x18')](_0x57b4c2)['then'](function(_0x2ed77c){_0x1fa822[_0x5483('0x18')]=_0x2ed77c;if(_0x418de1[_0x5483('0x2a')][_0x5483('0x38')]){_0x390846[_0x5483('0x39')]=[{'all':!![]}];}return db[_0x5483('0x26')][_0x5483('0x3a')](_0x390846);})['then'](function(_0x2735cc){_0x1fa822[_0x5483('0x3b')]=_0x2735cc;return _0x1fa822;})[_0x5483('0x1f')](respondWithFilteredResult(_0x4c58c0,_0x390846))[_0x5483('0x3c')](handleError(_0x4c58c0,null));};exports[_0x5483('0x3d')]=function(_0x417951,_0x4a0738){var _0x176399={'raw':![],'where':{'id':_0x417951['params']['id']}},_0x4e3826={};_0x4e3826[_0x5483('0x2e')]=_[_0x5483('0x2b')](db[_0x5483('0x26')][_0x5483('0x3e')]);_0x4e3826[_0x5483('0x2a')]=_[_0x5483('0x2b')](_0x417951[_0x5483('0x2a')]);_0x4e3826[_0x5483('0x2c')]=_[_0x5483('0x2d')](_0x4e3826[_0x5483('0x2e')],_0x4e3826[_0x5483('0x2a')]);_0x176399[_0x5483('0x2f')]=_[_0x5483('0x2d')](_0x4e3826[_0x5483('0x2e')],qs[_0x5483('0x30')](_0x417951[_0x5483('0x2a')]['fields']));_0x176399[_0x5483('0x2f')]=_0x176399[_0x5483('0x2f')][_0x5483('0x3f')]?_0x176399[_0x5483('0x2f')]:_0x4e3826['model'];if(_0x417951[_0x5483('0x2a')][_0x5483('0x38')]){_0x176399[_0x5483('0x39')]=[{'all':!![]}];}_0x176399=_['merge']({},_0x176399,_0x417951[_0x5483('0x40')]);return db['AnalyticFieldReport']['find'](_0x176399)[_0x5483('0x1f')](handleEntityNotFound(_0x4a0738,null))[_0x5483('0x1f')](respondWithResult(_0x4a0738,null))[_0x5483('0x3c')](handleError(_0x4a0738,null));};exports[_0x5483('0x41')]=function(_0x2979dc,_0xa848d8){return db[_0x5483('0x26')][_0x5483('0x41')](_0x2979dc['body'],{})['then'](respondWithResult(_0xa848d8,0xc9))[_0x5483('0x3c')](handleError(_0xa848d8,null));};exports['bulkCreate']=function(_0x3511ba,_0xd57967){return db['AnalyticFieldReport']['bulkCreate'](_0x3511ba[_0x5483('0x42')],{'raw':![],'individualHooks':!![]})[_0x5483('0x1f')](respondWithResult(_0xd57967,0xc9))[_0x5483('0x3c')](handleError(_0xd57967,null));};exports[_0x5483('0x43')]=function(_0x50dc1e,_0x5344d3){if(_0x50dc1e['body']['id']){delete _0x50dc1e[_0x5483('0x42')]['id'];}return db[_0x5483('0x26')][_0x5483('0x44')]({'where':{'id':_0x50dc1e[_0x5483('0x45')]['id']}})['then'](handleEntityNotFound(_0x5344d3,null))['then'](saveUpdates(_0x50dc1e[_0x5483('0x42')],null))['then'](respondWithResult(_0x5344d3,null))[_0x5483('0x3c')](handleError(_0x5344d3,null));};exports[_0x5483('0x20')]=function(_0x48b85b,_0x37465c){return db['AnalyticFieldReport'][_0x5483('0x44')]({'where':{'id':_0x48b85b[_0x5483('0x45')]['id']}})['then'](handleEntityNotFound(_0x37465c,null))[_0x5483('0x1f')](removeEntity(_0x37465c,null))['catch'](handleError(_0x37465c,null));};exports[_0x5483('0x46')]=function(_0x334525,_0x57390c){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x334525[_0x5483('0x2a')][_0x5483('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x5483('0x1f')](respondWithResult(_0x57390c,0xcc))[_0x5483('0x3c')](handleError(_0x57390c,null));};exports[_0x5483('0x48')]=function(_0x5899d7,_0x1700ee,_0x1d2aaf){return db[_0x5483('0x49')]['findOne']({'where':{'id':_0x5899d7[_0x5483('0x45')]['id']}})[_0x5483('0x1f')](handleEntityNotFound(_0x1700ee,null))[_0x5483('0x1f')](function(_0x33439e){if(_0x33439e){return db[_0x5483('0x4a')][_0x5483('0x4b')](function(_0x55520f){return db[_0x5483('0x26')][_0x5483('0x20')]({'where':{'CustomReportId':_0x5899d7[_0x5483('0x45')]['id']},'transaction':_0x55520f})[_0x5483('0x1f')](function(_0x5934fd){var _0xfe0185=_[_0x5483('0x25')](_0x5899d7[_0x5483('0x42')],function(_0xca52e3){delete _0xca52e3['id'];_0xca52e3[_0x5483('0x4c')]=_0x5899d7[_0x5483('0x45')]['id'];return _0xca52e3;});return db['AnalyticFieldReport'][_0x5483('0x4d')](_0xfe0185,{'transaction':_0x55520f});});})[_0x5483('0x1f')](function(){return db['AnalyticFieldReport'][_0x5483('0x3a')]({'where':{'CustomReportId':_0x5899d7['params']['id']}});});}})['then'](respondWithResult(_0x1700ee,null))[_0x5483('0x3c')](handleError(_0x1700ee,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index abfbc20..a61d8c6 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 _0x6833=['rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','request-promise','path'];(function(_0x1deafa,_0x3686f4){var _0x270f78=function(_0x150daa){while(--_0x150daa){_0x1deafa['push'](_0x1deafa['shift']());}};_0x270f78(++_0x3686f4);}(_0x6833,0xa5));var _0x3683=function(_0x558137,_0x2073b0){_0x558137=_0x558137-0x0;var _0xdb81d9=_0x6833[_0x558137];return _0xdb81d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3683('0x0'))(_0x3683('0x1'));var moment=require(_0x3683('0x2'));var BPromise=require('bluebird');var rp=require(_0x3683('0x3'));var fs=require('fs');var path=require(_0x3683('0x4'));var rimraf=require(_0x3683('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x3683('0x6')]=function(_0x544bbd,_0x5014af){return _0x544bbd[_0x3683('0x7')](_0x3683('0x8'),attributes,{'tableName':_0x3683('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc50=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0xa61372,_0x3f9ba0){var _0x3ff295=function(_0x5bf051){while(--_0x5bf051){_0xa61372['push'](_0xa61372['shift']());}};_0x3ff295(++_0x3f9ba0);}(_0xdc50,0x1bc));var _0x0dc5=function(_0x11e6e2,_0x915227){_0x11e6e2=_0x11e6e2-0x0;var _0x55d84d=_0xdc50[_0x11e6e2];return _0x55d84d;};'use strict';var _=require(_0x0dc5('0x0'));var util=require('util');var logger=require(_0x0dc5('0x1'))(_0x0dc5('0x2'));var moment=require(_0x0dc5('0x3'));var BPromise=require(_0x0dc5('0x4'));var rp=require(_0x0dc5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dc5('0x6'));var config=require(_0x0dc5('0x7'));var attributes=require(_0x0dc5('0x8'));module[_0x0dc5('0x9')]=function(_0x411a76,_0x3dafdb){return _0x411a76[_0x0dc5('0xa')](_0x0dc5('0xb'),attributes,{'tableName':_0x0dc5('0xc'),'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 9942c88..e6ef6c4 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 _0x9d8f=['request\x20sent','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x4d515d,_0x108c96){var _0x58fe07=function(_0x2e18bf){while(--_0x2e18bf){_0x4d515d['push'](_0x4d515d['shift']());}};_0x58fe07(++_0x108c96);}(_0x9d8f,0x132));var _0xf9d8=function(_0x14c500,_0x4d1d6a){_0x14c500=_0x14c500-0x0;var _0x45ee40=_0x9d8f[_0x14c500];return _0x45ee40;};'use strict';var _=require(_0xf9d8('0x0'));var util=require('util');var moment=require(_0xf9d8('0x1'));var BPromise=require(_0xf9d8('0x2'));var rs=require(_0xf9d8('0x3'));var fs=require('fs');var Redis=require(_0xf9d8('0x4'));var db=require(_0xf9d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9d8('0x6'))(_0xf9d8('0x7'));var config=require(_0xf9d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9d8('0x9')][_0xf9d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25d285,_0xe27bb9,_0x394184){return new BPromise(function(_0x59bf49,_0x5a1265){return client[_0xf9d8('0xb')](_0x25d285,_0x394184)[_0xf9d8('0xc')](function(_0x49b97a){logger[_0xf9d8('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,'request\x20sent');logger[_0xf9d8('0xe')](_0xf9d8('0xf'),_0xe27bb9,_0xf9d8('0x10'),JSON['stringify'](_0x49b97a));if(_0x49b97a[_0xf9d8('0x11')]){if(_0x49b97a[_0xf9d8('0x11')][_0xf9d8('0x12')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,_0x49b97a['error'][_0xf9d8('0x13')]);return _0x5a1265(_0x49b97a[_0xf9d8('0x11')][_0xf9d8('0x13')]);}logger[_0xf9d8('0x11')](_0xf9d8('0x14'),_0xe27bb9,_0x49b97a['error'][_0xf9d8('0x13')]);return _0x59bf49(_0x49b97a['error'][_0xf9d8('0x13')]);}else{logger[_0xf9d8('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,_0xf9d8('0x10'));_0x59bf49(_0x49b97a[_0xf9d8('0x15')][_0xf9d8('0x13')]);}})[_0xf9d8('0x16')](function(_0x4c1cfe){logger[_0xf9d8('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,_0x4c1cfe);_0x5a1265(_0x4c1cfe);});});} \ No newline at end of file +var _0x8dee=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0xe0dee2,_0x35d2a8){var _0x568ed0=function(_0x3b1644){while(--_0x3b1644){_0xe0dee2['push'](_0xe0dee2['shift']());}};_0x568ed0(++_0x35d2a8);}(_0x8dee,0x16e));var _0xe8de=function(_0x2f97ce,_0x42cda9){_0x2f97ce=_0x2f97ce-0x0;var _0x48e361=_0x8dee[_0x2f97ce];return _0x48e361;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe8de('0x0'));var rs=require(_0xe8de('0x1'));var fs=require('fs');var Redis=require(_0xe8de('0x2'));var db=require(_0xe8de('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8de('0x4'))(_0xe8de('0x5'));var config=require('../../config/environment');var jayson=require(_0xe8de('0x6'));var client=jayson[_0xe8de('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3af848,_0x172dbc,_0x5f5993){return new BPromise(function(_0x1ca8cb,_0x3d7b86){return client[_0xe8de('0x8')](_0x3af848,_0x5f5993)['then'](function(_0x5e9467){logger[_0xe8de('0x9')](_0xe8de('0xa'),_0x172dbc,_0xe8de('0xb'));logger['debug'](_0xe8de('0xc'),_0x172dbc,_0xe8de('0xb'),JSON['stringify'](_0x5e9467));if(_0x5e9467[_0xe8de('0xd')]){if(_0x5e9467['error'][_0xe8de('0xe')]===0x1f4){logger['error'](_0xe8de('0xa'),_0x172dbc,_0x5e9467['error']['message']);return _0x3d7b86(_0x5e9467['error'][_0xe8de('0xf')]);}logger[_0xe8de('0xd')](_0xe8de('0xa'),_0x172dbc,_0x5e9467[_0xe8de('0xd')][_0xe8de('0xf')]);return _0x1ca8cb(_0x5e9467[_0xe8de('0xd')][_0xe8de('0xf')]);}else{logger['info'](_0xe8de('0xa'),_0x172dbc,_0xe8de('0xb'));_0x1ca8cb(_0x5e9467[_0xe8de('0x10')][_0xe8de('0xf')]);}})[_0xe8de('0x11')](function(_0x34e179){logger[_0xe8de('0xd')](_0xe8de('0xa'),_0x172dbc,_0x34e179);_0x3d7b86(_0x34e179);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 97eefdf..aac86fe 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 _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x314d3f,_0x249185){var _0x54a5a5=function(_0x528619){while(--_0x528619){_0x314d3f['push'](_0x314d3f['shift']());}};_0x54a5a5(++_0x249185);}(_0x814b,0x1a2));var _0xb814=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0x814b[_0x301c34];return _0x1a8c5a;};'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('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file +var _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x861e02,_0x33f772){var _0x48fc24=function(_0x21b4d3){while(--_0x21b4d3){_0x861e02['push'](_0x861e02['shift']());}};_0x48fc24(++_0x33f772);}(_0xe14b,0x93));var _0xbe14=function(_0x30c762,_0x2b125){_0x30c762=_0x30c762-0x0;var _0x266469=_0xe14b[_0x30c762];return _0x266469;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 243eb2b..42c7728 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 _0x8769=['TEXT','STRING','sequelize','exports','name'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8769,0x110));var _0x9876=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x8769[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0x9876('0x0'));module[_0x9876('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9876('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x9876('0x3')]},'description':{'type':Sequelize[_0x9876('0x4')]}}; \ No newline at end of file +var _0x55f1=['STRING','name','TEXT','sequelize'];(function(_0x530a14,_0x19c695){var _0x1b6d20=function(_0xd2604c){while(--_0xd2604c){_0x530a14['push'](_0x530a14['shift']());}};_0x1b6d20(++_0x19c695);}(_0x55f1,0x9b));var _0x155f=function(_0x2e2498,_0x11d52b){_0x2e2498=_0x2e2498-0x0;var _0x1d5adc=_0x55f1[_0x2e2498];return _0x1d5adc;};'use strict';var Sequelize=require(_0x155f('0x0'));module['exports']={'name':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'unique':_0x155f('0x2')},'table':{'type':Sequelize[_0x155f('0x1')]},'metric':{'type':Sequelize[_0x155f('0x3')]},'description':{'type':Sequelize[_0x155f('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 591eb9a..681848e 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 _0x2b2d=['send','index','map','AnalyticMetric','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name'];(function(_0x487d10,_0x555612){var _0x1620db=function(_0x23056a){while(--_0x23056a){_0x487d10['push'](_0x487d10['shift']());}};_0x1620db(++_0x555612);}(_0x2b2d,0x127));var _0xd2b2=function(_0x42160c,_0x30e856){_0x42160c=_0x42160c-0x0;var _0xdba9cb=_0x2b2d[_0x42160c];return _0xdba9cb;};'use strict';var pdf=require(_0xd2b2('0x0'));var emlformat=require(_0xd2b2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd2b2('0x2'));var rp=require(_0xd2b2('0x3'));var moment=require(_0xd2b2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2b2('0x5'));var path=require(_0xd2b2('0x6'));var sox=require(_0xd2b2('0x7'));var csv=require(_0xd2b2('0x8'));var ejs=require(_0xd2b2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd2b2('0xa'));var crypto=require(_0xd2b2('0xb'));var jsforce=require(_0xd2b2('0xc'));var deskjs=require(_0xd2b2('0xd'));var toCsv=require(_0xd2b2('0x8'));var querystring=require(_0xd2b2('0xe'));var Papa=require(_0xd2b2('0xf'));var Redis=require(_0xd2b2('0x10'));var authService=require(_0xd2b2('0x11'));var qs=require(_0xd2b2('0x12'));var as=require(_0xd2b2('0x13'));var hardwareService=require(_0xd2b2('0x14'));var logger=require(_0xd2b2('0x15'))(_0xd2b2('0x16'));var utils=require(_0xd2b2('0x17'));var config=require(_0xd2b2('0x18'));var licenseUtil=require(_0xd2b2('0x19'));var db=require(_0xd2b2('0x1a'))['db'];function respondWithStatusCode(_0x3c28e6,_0x55983e){_0x55983e=_0x55983e||0xcc;return function(_0x35c5c5){if(_0x35c5c5){return _0x3c28e6['sendStatus'](_0x55983e);}return _0x3c28e6[_0xd2b2('0x1b')](_0x55983e)[_0xd2b2('0x1c')]();};}function respondWithResult(_0x4e7072,_0x24acc3){_0x24acc3=_0x24acc3||0xc8;return function(_0x459e54){if(_0x459e54){return _0x4e7072[_0xd2b2('0x1b')](_0x24acc3)[_0xd2b2('0x1d')](_0x459e54);}};}function respondWithFilteredResult(_0x31c9cb,_0x8fdd8b){return function(_0x3494a6){if(_0x3494a6){var _0x4a52d6=_0x3494a6[_0xd2b2('0x1e')],_0x3a96cc=_0x8fdd8b['offset'],_0x5bb6d1=_0x8fdd8b['offset']+_0x8fdd8b['limit'],_0x3def31;if(_0x5bb6d1>=_0x4a52d6){_0x5bb6d1=_0x4a52d6;_0x3def31=0xc8;}else{_0x3def31=0xce;}_0x31c9cb[_0xd2b2('0x1b')](_0x3def31);return _0x31c9cb[_0xd2b2('0x1f')](_0xd2b2('0x20'),_0x3a96cc+'-'+_0x5bb6d1+'/'+_0x4a52d6)['json'](_0x3494a6);}return null;};}function patchUpdates(_0x1de7d9){return function(_0x26f657){try{jsonpatch[_0xd2b2('0x21')](_0x26f657,_0x1de7d9,!![]);}catch(_0xf7a184){return BPromise[_0xd2b2('0x22')](_0xf7a184);}return _0x26f657['save']();};}function saveUpdates(_0x3dcfa4,_0x2271a1){return function(_0x45a50a){if(_0x45a50a){return _0x45a50a[_0xd2b2('0x23')](_0x3dcfa4)[_0xd2b2('0x24')](function(_0x4bda7a){return _0x4bda7a;});}return null;};}function removeEntity(_0x4073bc,_0x532bc5){return function(_0x3e63df){if(_0x3e63df){return _0x3e63df[_0xd2b2('0x25')]()['then'](function(){var _0xcb1e9f=_0x3e63df[_0xd2b2('0x26')]({'plain':!![]});var _0xa3ba6e=_0xd2b2('0x27');return db[_0xd2b2('0x28')][_0xd2b2('0x25')]({'where':{'type':_0xa3ba6e,'resourceId':_0xcb1e9f['id']}})['then'](function(){return _0x3e63df;});})[_0xd2b2('0x24')](function(){_0x4073bc['status'](0xcc)[_0xd2b2('0x1c')]();});}};}function handleEntityNotFound(_0xa3c3dd,_0x5c782a){return function(_0xfd5b36){if(!_0xfd5b36){_0xa3c3dd[_0xd2b2('0x29')](0x194);}return _0xfd5b36;};}function handleError(_0x5bf271,_0x185f4f){_0x185f4f=_0x185f4f||0x1f4;return function(_0x18757b){logger[_0xd2b2('0x2a')](_0x18757b[_0xd2b2('0x2b')]);if(_0x18757b[_0xd2b2('0x2c')]){delete _0x18757b['name'];}_0x5bf271[_0xd2b2('0x1b')](_0x185f4f)[_0xd2b2('0x2d')](_0x18757b);};}exports[_0xd2b2('0x2e')]=function(_0x534ddb,_0x52bacb){var _0x1381aa={},_0x52fa6c={},_0x116a89={'count':0x0,'rows':[]};var _0x555d6c=_[_0xd2b2('0x2f')](db[_0xd2b2('0x30')]['rawAttributes'],function(_0x2c30e8){return{'name':_0x2c30e8[_0xd2b2('0x31')],'type':_0x2c30e8[_0xd2b2('0x32')][_0xd2b2('0x33')]};});_0x52fa6c[_0xd2b2('0x34')]=_[_0xd2b2('0x2f')](_0x555d6c,_0xd2b2('0x2c'));_0x52fa6c[_0xd2b2('0x35')]=_['keys'](_0x534ddb[_0xd2b2('0x35')]);_0x52fa6c[_0xd2b2('0x36')]=_[_0xd2b2('0x37')](_0x52fa6c[_0xd2b2('0x34')],_0x52fa6c[_0xd2b2('0x35')]);_0x1381aa['attributes']=_[_0xd2b2('0x37')](_0x52fa6c['model'],qs[_0xd2b2('0x38')](_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x38')]));_0x1381aa[_0xd2b2('0x39')]=_0x1381aa[_0xd2b2('0x39')][_0xd2b2('0x3a')]?_0x1381aa[_0xd2b2('0x39')]:_0x52fa6c[_0xd2b2('0x34')];if(!_0x534ddb[_0xd2b2('0x35')]['hasOwnProperty'](_0xd2b2('0x3b'))){_0x1381aa[_0xd2b2('0x3c')]=qs[_0xd2b2('0x3c')](_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x3c')]);_0x1381aa[_0xd2b2('0x3d')]=qs[_0xd2b2('0x3d')](_0x534ddb[_0xd2b2('0x35')]['offset']);}_0x1381aa['order']=qs[_0xd2b2('0x3e')](_0x534ddb['query']['sort']);_0x1381aa[_0xd2b2('0x3f')]=qs[_0xd2b2('0x36')](_[_0xd2b2('0x40')](_0x534ddb[_0xd2b2('0x35')],_0x52fa6c[_0xd2b2('0x36')]),_0x555d6c);if(_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x41')]){_0x1381aa[_0xd2b2('0x3f')]=_['merge'](_0x1381aa[_0xd2b2('0x3f')],{'$or':_['map'](_0x555d6c,function(_0x19bbc3){if(_0x19bbc3[_0xd2b2('0x32')]!==_0xd2b2('0x42')){var _0x5811dc={};_0x5811dc[_0x19bbc3[_0xd2b2('0x2c')]]={'$like':'%'+_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x41')]+'%'};return _0x5811dc;}})});}_0x1381aa=_['merge']({},_0x1381aa,_0x534ddb['options']);var _0x469480={'where':_0x1381aa['where']};return db[_0xd2b2('0x30')]['count'](_0x469480)[_0xd2b2('0x24')](function(_0x10d3ea){_0x116a89['count']=_0x10d3ea;if(_0x534ddb['query'][_0xd2b2('0x43')]){_0x1381aa[_0xd2b2('0x44')]=[{'all':!![]}];}return db[_0xd2b2('0x30')][_0xd2b2('0x45')](_0x1381aa);})['then'](function(_0x161dbf){_0x116a89[_0xd2b2('0x46')]=_0x161dbf;return _0x116a89;})[_0xd2b2('0x24')](respondWithFilteredResult(_0x52bacb,_0x1381aa))['catch'](handleError(_0x52bacb,null));};exports[_0xd2b2('0x47')]=function(_0x390caf,_0x419ca0){var _0x3093f6={'raw':!![],'where':{'id':_0x390caf[_0xd2b2('0x48')]['id']}},_0x351eb8={};_0x351eb8[_0xd2b2('0x34')]=_[_0xd2b2('0x49')](db['AnalyticMetric']['rawAttributes']);_0x351eb8['query']=_['keys'](_0x390caf['query']);_0x351eb8['filters']=_[_0xd2b2('0x37')](_0x351eb8[_0xd2b2('0x34')],_0x351eb8[_0xd2b2('0x35')]);_0x3093f6[_0xd2b2('0x39')]=_[_0xd2b2('0x37')](_0x351eb8[_0xd2b2('0x34')],qs[_0xd2b2('0x38')](_0x390caf[_0xd2b2('0x35')][_0xd2b2('0x38')]));_0x3093f6[_0xd2b2('0x39')]=_0x3093f6[_0xd2b2('0x39')][_0xd2b2('0x3a')]?_0x3093f6[_0xd2b2('0x39')]:_0x351eb8[_0xd2b2('0x34')];if(_0x390caf['query']['includeAll']){_0x3093f6['include']=[{'all':!![]}];}_0x3093f6=_[_0xd2b2('0x4a')]({},_0x3093f6,_0x390caf[_0xd2b2('0x4b')]);return db[_0xd2b2('0x30')][_0xd2b2('0x4c')](_0x3093f6)[_0xd2b2('0x24')](handleEntityNotFound(_0x419ca0,null))[_0xd2b2('0x24')](respondWithResult(_0x419ca0,null))[_0xd2b2('0x4d')](handleError(_0x419ca0,null));};exports[_0xd2b2('0x4e')]=function(_0x43888f,_0x68449e){return db['AnalyticMetric'][_0xd2b2('0x4e')](_0x43888f[_0xd2b2('0x4f')],{})[_0xd2b2('0x24')](function(_0x2beae5){var _0x30f630=_0x43888f['user'][_0xd2b2('0x26')]({'plain':!![]});if(!_0x30f630)throw new Error(_0xd2b2('0x50'));if(_0x30f630['role']===_0xd2b2('0x51')){var _0x15a2b6=_0x2beae5[_0xd2b2('0x26')]({'plain':!![]});var _0x4e3690='Metrics';return db[_0xd2b2('0x52')][_0xd2b2('0x4c')]({'where':{'name':_0x4e3690,'userProfileId':_0x30f630[_0xd2b2('0x53')]},'raw':!![]})[_0xd2b2('0x24')](function(_0x1da44c){if(_0x1da44c&&_0x1da44c[_0xd2b2('0x54')]===0x0){return db[_0xd2b2('0x28')]['create']({'name':_0x15a2b6[_0xd2b2('0x2c')],'resourceId':_0x15a2b6['id'],'type':_0x1da44c['name'],'sectionId':_0x1da44c['id']},{})[_0xd2b2('0x24')](function(){return _0x2beae5;});}else{return _0x2beae5;}})['catch'](function(_0x15ee8c){logger[_0xd2b2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15ee8c);throw _0x15ee8c;});}return _0x2beae5;})[_0xd2b2('0x24')](respondWithResult(_0x68449e,0xc9))[_0xd2b2('0x4d')](handleError(_0x68449e,null));};exports[_0xd2b2('0x23')]=function(_0x490faf,_0x4d9ea0){if(_0x490faf['body']['id']){delete _0x490faf[_0xd2b2('0x4f')]['id'];}return db[_0xd2b2('0x30')][_0xd2b2('0x4c')]({'where':{'id':_0x490faf[_0xd2b2('0x48')]['id']}})[_0xd2b2('0x24')](handleEntityNotFound(_0x4d9ea0,null))[_0xd2b2('0x24')](saveUpdates(_0x490faf['body'],null))[_0xd2b2('0x24')](respondWithResult(_0x4d9ea0,null))[_0xd2b2('0x4d')](handleError(_0x4d9ea0,null));};exports['destroy']=function(_0x3b9830,_0x267b34){return db[_0xd2b2('0x30')]['find']({'where':{'id':_0x3b9830[_0xd2b2('0x48')]['id']}})[_0xd2b2('0x24')](handleEntityNotFound(_0x267b34,null))[_0xd2b2('0x24')](removeEntity(_0x267b34,null))[_0xd2b2('0x4d')](handleError(_0x267b34,null));}; \ No newline at end of file +var _0xd412=['options','includeAll','include','findAll','rows','catch','show','params','AnalyticMetric','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','apply','reject','update','then','Metrics','UserProfileResource','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter'];(function(_0x440f64,_0x297554){var _0x302b5b=function(_0x1b2404){while(--_0x1b2404){_0x440f64['push'](_0x440f64['shift']());}};_0x302b5b(++_0x297554);}(_0xd412,0x18e));var _0x2d41=function(_0x1233d1,_0x15cf04){_0x1233d1=_0x1233d1-0x0;var _0x56ee5e=_0xd412[_0x1233d1];return _0x56ee5e;};'use strict';var pdf=require(_0x2d41('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d41('0x1'));var jsonpatch=require(_0x2d41('0x2'));var rp=require('request-promise');var moment=require(_0x2d41('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d41('0x4'));var path=require(_0x2d41('0x5'));var sox=require('sox');var csv=require(_0x2d41('0x6'));var ejs=require(_0x2d41('0x7'));var fs=require('fs');var _=require(_0x2d41('0x8'));var squel=require('squel');var crypto=require(_0x2d41('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2d41('0xa'));var toCsv=require(_0x2d41('0x6'));var querystring=require(_0x2d41('0xb'));var Papa=require(_0x2d41('0xc'));var Redis=require('ioredis');var authService=require(_0x2d41('0xd'));var qs=require(_0x2d41('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d41('0xf'));var logger=require(_0x2d41('0x10'))('api');var utils=require(_0x2d41('0x11'));var config=require(_0x2d41('0x12'));var licenseUtil=require(_0x2d41('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x274f07,_0x333ca0){_0x333ca0=_0x333ca0||0xcc;return function(_0x274731){if(_0x274731){return _0x274f07[_0x2d41('0x14')](_0x333ca0);}return _0x274f07[_0x2d41('0x15')](_0x333ca0)['end']();};}function respondWithResult(_0x924db1,_0x408963){_0x408963=_0x408963||0xc8;return function(_0x2ab83b){if(_0x2ab83b){return _0x924db1['status'](_0x408963)[_0x2d41('0x16')](_0x2ab83b);}};}function respondWithFilteredResult(_0x2ea98f,_0x1aa229){return function(_0x37e9bb){if(_0x37e9bb){var _0x5d255e=_0x37e9bb[_0x2d41('0x17')],_0x351f8f=_0x1aa229[_0x2d41('0x18')],_0x255568=_0x1aa229[_0x2d41('0x18')]+_0x1aa229[_0x2d41('0x19')],_0x55329d;if(_0x255568>=_0x5d255e){_0x255568=_0x5d255e;_0x55329d=0xc8;}else{_0x55329d=0xce;}_0x2ea98f[_0x2d41('0x15')](_0x55329d);return _0x2ea98f['set']('Content-Range',_0x351f8f+'-'+_0x255568+'/'+_0x5d255e)[_0x2d41('0x16')](_0x37e9bb);}return null;};}function patchUpdates(_0x342ffc){return function(_0x496462){try{jsonpatch[_0x2d41('0x1a')](_0x496462,_0x342ffc,!![]);}catch(_0x45895d){return BPromise[_0x2d41('0x1b')](_0x45895d);}return _0x496462['save']();};}function saveUpdates(_0xf76112,_0x445146){return function(_0x241de7){if(_0x241de7){return _0x241de7[_0x2d41('0x1c')](_0xf76112)['then'](function(_0x116d1a){return _0x116d1a;});}return null;};}function removeEntity(_0x189674,_0x1579b7){return function(_0x172eba){if(_0x172eba){return _0x172eba['destroy']()[_0x2d41('0x1d')](function(){var _0x174508=_0x172eba['get']({'plain':!![]});var _0x431559=_0x2d41('0x1e');return db[_0x2d41('0x1f')][_0x2d41('0x20')]({'where':{'type':_0x431559,'resourceId':_0x174508['id']}})['then'](function(){return _0x172eba;});})[_0x2d41('0x1d')](function(){_0x189674[_0x2d41('0x15')](0xcc)[_0x2d41('0x21')]();});}};}function handleEntityNotFound(_0x4173a1,_0x55b049){return function(_0x2293da){if(!_0x2293da){_0x4173a1[_0x2d41('0x14')](0x194);}return _0x2293da;};}function handleError(_0x56deab,_0x207f6b){_0x207f6b=_0x207f6b||0x1f4;return function(_0x2780bb){logger[_0x2d41('0x22')](_0x2780bb['stack']);if(_0x2780bb[_0x2d41('0x23')]){delete _0x2780bb[_0x2d41('0x23')];}_0x56deab[_0x2d41('0x15')](_0x207f6b)['send'](_0x2780bb);};}exports[_0x2d41('0x24')]=function(_0x3581aa,_0x5708b3){var _0x4a3729={},_0x4a7e4e={},_0x1062c8={'count':0x0,'rows':[]};var _0x243640=_[_0x2d41('0x25')](db['AnalyticMetric'][_0x2d41('0x26')],function(_0xa9c8cf){return{'name':_0xa9c8cf[_0x2d41('0x27')],'type':_0xa9c8cf['type'][_0x2d41('0x28')]};});_0x4a7e4e[_0x2d41('0x29')]=_[_0x2d41('0x25')](_0x243640,_0x2d41('0x23'));_0x4a7e4e['query']=_[_0x2d41('0x2a')](_0x3581aa[_0x2d41('0x2b')]);_0x4a7e4e[_0x2d41('0x2c')]=_[_0x2d41('0x2d')](_0x4a7e4e[_0x2d41('0x29')],_0x4a7e4e[_0x2d41('0x2b')]);_0x4a3729[_0x2d41('0x2e')]=_[_0x2d41('0x2d')](_0x4a7e4e['model'],qs[_0x2d41('0x2f')](_0x3581aa[_0x2d41('0x2b')][_0x2d41('0x2f')]));_0x4a3729[_0x2d41('0x2e')]=_0x4a3729[_0x2d41('0x2e')][_0x2d41('0x30')]?_0x4a3729[_0x2d41('0x2e')]:_0x4a7e4e[_0x2d41('0x29')];if(!_0x3581aa[_0x2d41('0x2b')][_0x2d41('0x31')]('nolimit')){_0x4a3729['limit']=qs[_0x2d41('0x19')](_0x3581aa['query']['limit']);_0x4a3729[_0x2d41('0x18')]=qs[_0x2d41('0x18')](_0x3581aa['query'][_0x2d41('0x18')]);}_0x4a3729[_0x2d41('0x32')]=qs[_0x2d41('0x33')](_0x3581aa[_0x2d41('0x2b')][_0x2d41('0x33')]);_0x4a3729[_0x2d41('0x34')]=qs[_0x2d41('0x2c')](_[_0x2d41('0x35')](_0x3581aa['query'],_0x4a7e4e[_0x2d41('0x2c')]),_0x243640);if(_0x3581aa['query']['filter']){_0x4a3729[_0x2d41('0x34')]=_[_0x2d41('0x36')](_0x4a3729[_0x2d41('0x34')],{'$or':_[_0x2d41('0x25')](_0x243640,function(_0x2429fe){if(_0x2429fe[_0x2d41('0x37')]!==_0x2d41('0x38')){var _0x2d93ff={};_0x2d93ff[_0x2429fe[_0x2d41('0x23')]]={'$like':'%'+_0x3581aa[_0x2d41('0x2b')][_0x2d41('0x39')]+'%'};return _0x2d93ff;}})});}_0x4a3729=_['merge']({},_0x4a3729,_0x3581aa[_0x2d41('0x3a')]);var _0x5979fb={'where':_0x4a3729[_0x2d41('0x34')]};return db['AnalyticMetric'][_0x2d41('0x17')](_0x5979fb)[_0x2d41('0x1d')](function(_0x243ca8){_0x1062c8[_0x2d41('0x17')]=_0x243ca8;if(_0x3581aa[_0x2d41('0x2b')][_0x2d41('0x3b')]){_0x4a3729[_0x2d41('0x3c')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x2d41('0x3d')](_0x4a3729);})['then'](function(_0x4a2bec){_0x1062c8[_0x2d41('0x3e')]=_0x4a2bec;return _0x1062c8;})[_0x2d41('0x1d')](respondWithFilteredResult(_0x5708b3,_0x4a3729))[_0x2d41('0x3f')](handleError(_0x5708b3,null));};exports[_0x2d41('0x40')]=function(_0x23753,_0x266059){var _0xf9b91={'raw':!![],'where':{'id':_0x23753[_0x2d41('0x41')]['id']}},_0x316e4d={};_0x316e4d[_0x2d41('0x29')]=_[_0x2d41('0x2a')](db[_0x2d41('0x42')][_0x2d41('0x26')]);_0x316e4d[_0x2d41('0x2b')]=_[_0x2d41('0x2a')](_0x23753[_0x2d41('0x2b')]);_0x316e4d[_0x2d41('0x2c')]=_[_0x2d41('0x2d')](_0x316e4d[_0x2d41('0x29')],_0x316e4d['query']);_0xf9b91['attributes']=_[_0x2d41('0x2d')](_0x316e4d['model'],qs[_0x2d41('0x2f')](_0x23753[_0x2d41('0x2b')]['fields']));_0xf9b91[_0x2d41('0x2e')]=_0xf9b91[_0x2d41('0x2e')][_0x2d41('0x30')]?_0xf9b91[_0x2d41('0x2e')]:_0x316e4d[_0x2d41('0x29')];if(_0x23753['query']['includeAll']){_0xf9b91[_0x2d41('0x3c')]=[{'all':!![]}];}_0xf9b91=_[_0x2d41('0x36')]({},_0xf9b91,_0x23753[_0x2d41('0x3a')]);return db[_0x2d41('0x42')][_0x2d41('0x43')](_0xf9b91)[_0x2d41('0x1d')](handleEntityNotFound(_0x266059,null))[_0x2d41('0x1d')](respondWithResult(_0x266059,null))[_0x2d41('0x3f')](handleError(_0x266059,null));};exports[_0x2d41('0x44')]=function(_0xf1e63b,_0x435a2c){return db['AnalyticMetric'][_0x2d41('0x44')](_0xf1e63b[_0x2d41('0x45')],{})[_0x2d41('0x1d')](function(_0x3aef59){var _0x417b1b=_0xf1e63b[_0x2d41('0x46')][_0x2d41('0x47')]({'plain':!![]});if(!_0x417b1b)throw new Error(_0x2d41('0x48'));if(_0x417b1b['role']===_0x2d41('0x46')){var _0x4727fb=_0x3aef59['get']({'plain':!![]});var _0x215c3c=_0x2d41('0x1e');return db[_0x2d41('0x49')][_0x2d41('0x43')]({'where':{'name':_0x215c3c,'userProfileId':_0x417b1b['userProfileId']},'raw':!![]})[_0x2d41('0x1d')](function(_0xd0cd8e){if(_0xd0cd8e&&_0xd0cd8e[_0x2d41('0x4a')]===0x0){return db[_0x2d41('0x1f')]['create']({'name':_0x4727fb['name'],'resourceId':_0x4727fb['id'],'type':_0xd0cd8e[_0x2d41('0x23')],'sectionId':_0xd0cd8e['id']},{})[_0x2d41('0x1d')](function(){return _0x3aef59;});}else{return _0x3aef59;}})[_0x2d41('0x3f')](function(_0x4cec5f){logger[_0x2d41('0x22')](_0x2d41('0x4b'),_0x4cec5f);throw _0x4cec5f;});}return _0x3aef59;})[_0x2d41('0x1d')](respondWithResult(_0x435a2c,0xc9))[_0x2d41('0x3f')](handleError(_0x435a2c,null));};exports['update']=function(_0x51e5da,_0x55369d){if(_0x51e5da[_0x2d41('0x45')]['id']){delete _0x51e5da[_0x2d41('0x45')]['id'];}return db[_0x2d41('0x42')][_0x2d41('0x43')]({'where':{'id':_0x51e5da[_0x2d41('0x41')]['id']}})[_0x2d41('0x1d')](handleEntityNotFound(_0x55369d,null))[_0x2d41('0x1d')](saveUpdates(_0x51e5da['body'],null))['then'](respondWithResult(_0x55369d,null))[_0x2d41('0x3f')](handleError(_0x55369d,null));};exports[_0x2d41('0x20')]=function(_0xcd4b51,_0x1bf4d2){return db[_0x2d41('0x42')][_0x2d41('0x43')]({'where':{'id':_0xcd4b51['params']['id']}})[_0x2d41('0x1d')](handleEntityNotFound(_0x1bf4d2,null))[_0x2d41('0x1d')](removeEntity(_0x1bf4d2,null))['catch'](handleError(_0x1bf4d2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fda9306..9cde3af 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 _0xb44a=['analytics_metrics','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb44a,0xa6));var _0xab44=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xb44a[_0x4394b6];return _0x360244;};'use strict';var _=require(_0xab44('0x0'));var util=require('util');var logger=require(_0xab44('0x1'))(_0xab44('0x2'));var moment=require('moment');var BPromise=require(_0xab44('0x3'));var rp=require(_0xab44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab44('0x5'));var config=require(_0xab44('0x6'));var attributes=require(_0xab44('0x7'));module[_0xab44('0x8')]=function(_0x2d19e9,_0x4505a8){return _0x2d19e9['define'](_0xab44('0x9'),attributes,{'tableName':_0xab44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5be=['api','moment','path','rimraf','exports','AnalyticMetric','analytics_metrics','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc5be,0xbf));var _0xec5b=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xc5be[_0x1da527];return _0x40fc7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec5b('0x0'))(_0xec5b('0x1'));var moment=require(_0xec5b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xec5b('0x3'));var rimraf=require(_0xec5b('0x4'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xec5b('0x5')]=function(_0x1cd42c,_0x44eb5c){return _0x1cd42c['define'](_0xec5b('0x6'),attributes,{'tableName':_0xec5b('0x7'),'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 4f91540..9ecd98d 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 _0xd449=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x55c3be,_0x24029d){var _0x25011d=function(_0x542fee){while(--_0x542fee){_0x55c3be['push'](_0x55c3be['shift']());}};_0x25011d(++_0x24029d);}(_0xd449,0x17b));var _0x9d44=function(_0x405dc0,_0x5f2898){_0x405dc0=_0x405dc0-0x0;var _0x1ed46d=_0xd449[_0x405dc0];return _0x1ed46d;};'use strict';var _=require(_0x9d44('0x0'));var util=require(_0x9d44('0x1'));var moment=require(_0x9d44('0x2'));var BPromise=require(_0x9d44('0x3'));var rs=require(_0x9d44('0x4'));var fs=require('fs');var Redis=require(_0x9d44('0x5'));var db=require(_0x9d44('0x6'))['db'];var utils=require(_0x9d44('0x7'));var logger=require(_0x9d44('0x8'))(_0x9d44('0x9'));var config=require(_0x9d44('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9d44('0xb')][_0x9d44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x728234,_0x17aea3,_0x57166d){return new BPromise(function(_0x3ce183,_0xf2250e){return client[_0x9d44('0xd')](_0x728234,_0x57166d)[_0x9d44('0xe')](function(_0x23b038){logger[_0x9d44('0xf')](_0x9d44('0x10'),_0x17aea3,_0x9d44('0x11'));logger[_0x9d44('0x12')](_0x9d44('0x13'),_0x17aea3,_0x9d44('0x11'),JSON[_0x9d44('0x14')](_0x23b038));if(_0x23b038[_0x9d44('0x15')]){if(_0x23b038[_0x9d44('0x15')][_0x9d44('0x16')]===0x1f4){logger[_0x9d44('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x17aea3,_0x23b038[_0x9d44('0x15')][_0x9d44('0x17')]);return _0xf2250e(_0x23b038[_0x9d44('0x15')][_0x9d44('0x17')]);}logger[_0x9d44('0x15')](_0x9d44('0x10'),_0x17aea3,_0x23b038[_0x9d44('0x15')][_0x9d44('0x17')]);return _0x3ce183(_0x23b038['error'][_0x9d44('0x17')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x17aea3,_0x9d44('0x11'));_0x3ce183(_0x23b038[_0x9d44('0x18')][_0x9d44('0x17')]);}})['catch'](function(_0x13386f){logger[_0x9d44('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x17aea3,_0x13386f);_0xf2250e(_0x13386f);});});} \ No newline at end of file +var _0xd8d0=['client','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x220dcc,_0x1af218){var _0x34ec78=function(_0x283633){while(--_0x283633){_0x220dcc['push'](_0x220dcc['shift']());}};_0x34ec78(++_0x1af218);}(_0xd8d0,0x162));var _0x0d8d=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xd8d0[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x0d8d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0d8d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0d8d('0x2'))(_0x0d8d('0x3'));var config=require(_0x0d8d('0x4'));var jayson=require(_0x0d8d('0x5'));var client=jayson[_0x0d8d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7382,_0x1dce9f,_0x2a2e48){return new BPromise(function(_0x46bc2a,_0x1ad7e3){return client['request'](_0x2d7382,_0x2a2e48)[_0x0d8d('0x7')](function(_0x166d49){logger['info'](_0x0d8d('0x8'),_0x1dce9f,_0x0d8d('0x9'));logger[_0x0d8d('0xa')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1dce9f,_0x0d8d('0x9'),JSON[_0x0d8d('0xb')](_0x166d49));if(_0x166d49['error']){if(_0x166d49[_0x0d8d('0xc')][_0x0d8d('0xd')]===0x1f4){logger[_0x0d8d('0xc')](_0x0d8d('0x8'),_0x1dce9f,_0x166d49[_0x0d8d('0xc')]['message']);return _0x1ad7e3(_0x166d49[_0x0d8d('0xc')][_0x0d8d('0xe')]);}logger[_0x0d8d('0xc')](_0x0d8d('0x8'),_0x1dce9f,_0x166d49[_0x0d8d('0xc')][_0x0d8d('0xe')]);return _0x46bc2a(_0x166d49['error']['message']);}else{logger[_0x0d8d('0xf')](_0x0d8d('0x8'),_0x1dce9f,_0x0d8d('0x9'));_0x46bc2a(_0x166d49[_0x0d8d('0x10')]['message']);}})[_0x0d8d('0x11')](function(_0x5c8bbc){logger[_0x0d8d('0xc')](_0x0d8d('0x8'),_0x1dce9f,_0x5c8bbc);_0x1ad7e3(_0x5c8bbc);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7179f38..287110f 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 _0xc2c7=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','put','/:id'];(function(_0xa55f23,_0x148a48){var _0x5172c0=function(_0x1c6cee){while(--_0x1c6cee){_0xa55f23['push'](_0xa55f23['shift']());}};_0x5172c0(++_0x148a48);}(_0xc2c7,0x134));var _0x7c2c=function(_0x39d332,_0x870fcc){_0x39d332=_0x39d332-0x0;var _0x49b7e3=_0xc2c7[_0x39d332];return _0x49b7e3;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var auth=require(_0x7c2c('0x5'));var interaction=require(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x9')]);router[_0x7c2c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7c2c('0xb')]('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xc')]);router[_0x7c2c('0xd')](_0x7c2c('0xe'),auth['isAuthenticated'](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x10')](_0x7c2c('0xe'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x11')]);module[_0x7c2c('0x12')]=router; \ No newline at end of file +var _0x4975=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy'];(function(_0x23762a,_0x575336){var _0x5686e2=function(_0x55a453){while(--_0x55a453){_0x23762a['push'](_0x23762a['shift']());}};_0x5686e2(++_0x575336);}(_0x4975,0x86));var _0x5497=function(_0x4d96bc,_0x430927){_0x4d96bc=_0x4d96bc-0x0;var _0x3de827=_0x4975[_0x4d96bc];return _0x3de827;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var auth=require(_0x5497('0x5'));var interaction=require(_0x5497('0x6'));var config=require(_0x5497('0x7'));var controller=require(_0x5497('0x8'));router[_0x5497('0x9')]('/',auth[_0x5497('0xa')](),controller['index']);router[_0x5497('0x9')]('/:id',auth[_0x5497('0xa')](),controller[_0x5497('0xb')]);router[_0x5497('0xc')]('/',auth['isAuthenticated'](),controller[_0x5497('0xd')]);router['put'](_0x5497('0xe'),auth[_0x5497('0xa')](),controller[_0x5497('0xf')]);router[_0x5497('0x10')](_0x5497('0xe'),auth[_0x5497('0xa')](),controller[_0x5497('0x11')]);module[_0x5497('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 53fadcb..1ee6279 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 _0x9620=['TEXT','sequelize','exports'];(function(_0x39674c,_0x3abbe1){var _0x5cf0c0=function(_0x2918d5){while(--_0x2918d5){_0x39674c['push'](_0x39674c['shift']());}};_0x5cf0c0(++_0x3abbe1);}(_0x9620,0x10f));var _0x0962=function(_0x20ae19,_0x367fb4){_0x20ae19=_0x20ae19-0x0;var _0xd245d2=_0x9620[_0x20ae19];return _0xd245d2;};'use strict';var Sequelize=require(_0x0962('0x0'));module[_0x0962('0x1')]={'tree':{'type':Sequelize[_0x0962('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5f27=['TEXT','sequelize','exports'];(function(_0xfd0f2a,_0x53ca7c){var _0x1705b7=function(_0x2fdecd){while(--_0x2fdecd){_0xfd0f2a['push'](_0xfd0f2a['shift']());}};_0x1705b7(++_0x53ca7c);}(_0x5f27,0x172));var _0x75f2=function(_0x111829,_0x5c23e1){_0x111829=_0x111829-0x0;var _0x15c88d=_0x5f27[_0x111829];return _0x15c88d;};'use strict';var Sequelize=require(_0x75f2('0x0'));module[_0x75f2('0x1')]={'tree':{'type':Sequelize[_0x75f2('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 2d075cb..62a6cf6 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 _0x4baf=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','AnalyticTreeReport','fieldName','type','key','model','map','keys','query','filters'];(function(_0xb7e8b0,_0x278fad){var _0xf72202=function(_0x4fea55){while(--_0x4fea55){_0xb7e8b0['push'](_0xb7e8b0['shift']());}};_0xf72202(++_0x278fad);}(_0x4baf,0x177));var _0xf4ba=function(_0x434ba4,_0x4a5665){_0x434ba4=_0x434ba4-0x0;var _0x49844e=_0x4baf[_0x434ba4];return _0x49844e;};'use strict';var pdf=require(_0xf4ba('0x0'));var emlformat=require(_0xf4ba('0x1'));var rimraf=require(_0xf4ba('0x2'));var zipdir=require(_0xf4ba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ba('0x4'));var moment=require(_0xf4ba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4ba('0x6'));var util=require(_0xf4ba('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4ba('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf4ba('0x9'));var jsforce=require(_0xf4ba('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf4ba('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4ba('0xc'));var qs=require(_0xf4ba('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf4ba('0xe'));var utils=require(_0xf4ba('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xf4ba('0x10'));var db=require(_0xf4ba('0x11'))['db'];function respondWithStatusCode(_0x217d05,_0x431c63){_0x431c63=_0x431c63||0xcc;return function(_0x29f2d8){if(_0x29f2d8){return _0x217d05[_0xf4ba('0x12')](_0x431c63);}return _0x217d05['status'](_0x431c63)[_0xf4ba('0x13')]();};}function respondWithResult(_0x4d3aae,_0x316c1b){_0x316c1b=_0x316c1b||0xc8;return function(_0x34d59a){if(_0x34d59a){return _0x4d3aae[_0xf4ba('0x14')](_0x316c1b)[_0xf4ba('0x15')](_0x34d59a);}};}function respondWithFilteredResult(_0x248c6e,_0x95ebce){return function(_0x3e36af){if(_0x3e36af){var _0xf996c=_0x3e36af[_0xf4ba('0x16')],_0x48c11f=_0x95ebce['offset'],_0x26f666=_0x95ebce[_0xf4ba('0x17')]+_0x95ebce[_0xf4ba('0x18')],_0x8a0ae3;if(_0x26f666>=_0xf996c){_0x26f666=_0xf996c;_0x8a0ae3=0xc8;}else{_0x8a0ae3=0xce;}_0x248c6e[_0xf4ba('0x14')](_0x8a0ae3);return _0x248c6e[_0xf4ba('0x19')](_0xf4ba('0x1a'),_0x48c11f+'-'+_0x26f666+'/'+_0xf996c)[_0xf4ba('0x15')](_0x3e36af);}return null;};}function patchUpdates(_0x48e40e){return function(_0x3fe140){try{jsonpatch[_0xf4ba('0x1b')](_0x3fe140,_0x48e40e,!![]);}catch(_0x47c1dd){return BPromise[_0xf4ba('0x1c')](_0x47c1dd);}return _0x3fe140[_0xf4ba('0x1d')]();};}function saveUpdates(_0x4b7a3e,_0x14fa66){return function(_0x4cec4b){if(_0x4cec4b){return _0x4cec4b['update'](_0x4b7a3e)['then'](function(_0x18b75a){return _0x18b75a;});}return null;};}function removeEntity(_0x5f7a15,_0x55a1d9){return function(_0x4eee8f){if(_0x4eee8f){return _0x4eee8f[_0xf4ba('0x1e')]()['then'](function(){_0x5f7a15[_0xf4ba('0x14')](0xcc)[_0xf4ba('0x13')]();});}};}function handleEntityNotFound(_0x30fb3b,_0x30bf2e){return function(_0x5f121c){if(!_0x5f121c){_0x30fb3b['sendStatus'](0x194);}return _0x5f121c;};}function handleError(_0x1e0d9f,_0x558a63){_0x558a63=_0x558a63||0x1f4;return function(_0x340256){logger[_0xf4ba('0x1f')](_0x340256[_0xf4ba('0x20')]);if(_0x340256[_0xf4ba('0x21')]){delete _0x340256['name'];}_0x1e0d9f[_0xf4ba('0x14')](_0x558a63)[_0xf4ba('0x22')](_0x340256);};}exports[_0xf4ba('0x23')]=function(_0x44199f,_0x434177){var _0x3231aa={},_0x34373a={},_0x16d4f3={'count':0x0,'rows':[]};var _0x1e5cab=_['map'](db[_0xf4ba('0x24')]['rawAttributes'],function(_0x1d49d0){return{'name':_0x1d49d0[_0xf4ba('0x25')],'type':_0x1d49d0[_0xf4ba('0x26')][_0xf4ba('0x27')]};});_0x34373a[_0xf4ba('0x28')]=_[_0xf4ba('0x29')](_0x1e5cab,_0xf4ba('0x21'));_0x34373a['query']=_[_0xf4ba('0x2a')](_0x44199f[_0xf4ba('0x2b')]);_0x34373a[_0xf4ba('0x2c')]=_['intersection'](_0x34373a[_0xf4ba('0x28')],_0x34373a[_0xf4ba('0x2b')]);_0x3231aa[_0xf4ba('0x2d')]=_[_0xf4ba('0x2e')](_0x34373a[_0xf4ba('0x28')],qs[_0xf4ba('0x2f')](_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x2f')]));_0x3231aa['attributes']=_0x3231aa[_0xf4ba('0x2d')][_0xf4ba('0x30')]?_0x3231aa[_0xf4ba('0x2d')]:_0x34373a[_0xf4ba('0x28')];if(!_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x31')](_0xf4ba('0x32'))){_0x3231aa['limit']=qs[_0xf4ba('0x18')](_0x44199f['query'][_0xf4ba('0x18')]);_0x3231aa['offset']=qs[_0xf4ba('0x17')](_0x44199f['query'][_0xf4ba('0x17')]);}_0x3231aa[_0xf4ba('0x33')]=qs['sort'](_0x44199f['query']['sort']);_0x3231aa[_0xf4ba('0x34')]=qs[_0xf4ba('0x2c')](_[_0xf4ba('0x35')](_0x44199f[_0xf4ba('0x2b')],_0x34373a[_0xf4ba('0x2c')]),_0x1e5cab);if(_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x36')]){_0x3231aa[_0xf4ba('0x34')]=_[_0xf4ba('0x37')](_0x3231aa[_0xf4ba('0x34')],{'$or':_[_0xf4ba('0x29')](_0x1e5cab,function(_0x5ed830){if(_0x5ed830[_0xf4ba('0x26')]!=='VIRTUAL'){var _0x477feb={};_0x477feb[_0x5ed830[_0xf4ba('0x21')]]={'$like':'%'+_0x44199f[_0xf4ba('0x2b')]['filter']+'%'};return _0x477feb;}})});}_0x3231aa=_[_0xf4ba('0x37')]({},_0x3231aa,_0x44199f[_0xf4ba('0x38')]);var _0x5b0019={'where':_0x3231aa['where']};return db[_0xf4ba('0x24')][_0xf4ba('0x16')](_0x5b0019)[_0xf4ba('0x39')](function(_0x146843){_0x16d4f3[_0xf4ba('0x16')]=_0x146843;if(_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x3a')]){_0x3231aa[_0xf4ba('0x3b')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xf4ba('0x3c')](_0x3231aa);})[_0xf4ba('0x39')](function(_0x236c2c){_0x16d4f3[_0xf4ba('0x3d')]=_0x236c2c;return _0x16d4f3;})[_0xf4ba('0x39')](respondWithFilteredResult(_0x434177,_0x3231aa))[_0xf4ba('0x3e')](handleError(_0x434177,null));};exports[_0xf4ba('0x3f')]=function(_0x4d4909,_0x4f5fbe){var _0x54a564={'raw':!![],'where':{'id':_0x4d4909[_0xf4ba('0x40')]['id']}},_0x4c25f2={};_0x4c25f2[_0xf4ba('0x28')]=_[_0xf4ba('0x2a')](db[_0xf4ba('0x24')][_0xf4ba('0x41')]);_0x4c25f2[_0xf4ba('0x2b')]=_['keys'](_0x4d4909['query']);_0x4c25f2[_0xf4ba('0x2c')]=_[_0xf4ba('0x2e')](_0x4c25f2[_0xf4ba('0x28')],_0x4c25f2[_0xf4ba('0x2b')]);_0x54a564['attributes']=_['intersection'](_0x4c25f2[_0xf4ba('0x28')],qs[_0xf4ba('0x2f')](_0x4d4909[_0xf4ba('0x2b')][_0xf4ba('0x2f')]));_0x54a564[_0xf4ba('0x2d')]=_0x54a564[_0xf4ba('0x2d')][_0xf4ba('0x30')]?_0x54a564[_0xf4ba('0x2d')]:_0x4c25f2[_0xf4ba('0x28')];if(_0x4d4909[_0xf4ba('0x2b')][_0xf4ba('0x3a')]){_0x54a564[_0xf4ba('0x3b')]=[{'all':!![]}];}_0x54a564=_[_0xf4ba('0x37')]({},_0x54a564,_0x4d4909[_0xf4ba('0x38')]);return db[_0xf4ba('0x24')][_0xf4ba('0x42')](_0x54a564)['then'](handleEntityNotFound(_0x4f5fbe,null))['then'](respondWithResult(_0x4f5fbe,null))[_0xf4ba('0x3e')](handleError(_0x4f5fbe,null));};exports[_0xf4ba('0x43')]=function(_0x130c8e,_0xedb9af){return db[_0xf4ba('0x24')]['create'](_0x130c8e['body'],{})[_0xf4ba('0x39')](respondWithResult(_0xedb9af,0xc9))[_0xf4ba('0x3e')](handleError(_0xedb9af,null));};exports[_0xf4ba('0x44')]=function(_0xb17291,_0x532108){if(_0xb17291[_0xf4ba('0x45')]['id']){delete _0xb17291[_0xf4ba('0x45')]['id'];}return db[_0xf4ba('0x24')][_0xf4ba('0x42')]({'where':{'id':_0xb17291[_0xf4ba('0x40')]['id']}})[_0xf4ba('0x39')](handleEntityNotFound(_0x532108,null))[_0xf4ba('0x39')](saveUpdates(_0xb17291[_0xf4ba('0x45')],null))[_0xf4ba('0x39')](respondWithResult(_0x532108,null))['catch'](handleError(_0x532108,null));};exports[_0xf4ba('0x1e')]=function(_0x841312,_0x10f996){return db[_0xf4ba('0x24')][_0xf4ba('0x42')]({'where':{'id':_0x841312[_0xf4ba('0x40')]['id']}})['then'](handleEntityNotFound(_0x10f996,null))[_0xf4ba('0x39')](removeEntity(_0x10f996,null))[_0xf4ba('0x3e')](handleError(_0x10f996,null));}; \ No newline at end of file +var _0x1fd7=['apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','find','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','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/utils','../../config/license/util','../../mysqldb','status','count','offset','limit','Content-Range','json'];(function(_0x17a249,_0x4f941c){var _0x19e05f=function(_0x19aced){while(--_0x19aced){_0x17a249['push'](_0x17a249['shift']());}};_0x19e05f(++_0x4f941c);}(_0x1fd7,0x14f));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x71fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x71fd('0x1'));var zipdir=require(_0x71fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71fd('0x3'));var Mustache=require(_0x71fd('0x4'));var util=require(_0x71fd('0x5'));var path=require(_0x71fd('0x6'));var sox=require('sox');var csv=require(_0x71fd('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x71fd('0x8'));var squel=require('squel');var crypto=require(_0x71fd('0x9'));var jsforce=require(_0x71fd('0xa'));var deskjs=require(_0x71fd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71fd('0xc'));var Papa=require(_0x71fd('0xd'));var Redis=require(_0x71fd('0xe'));var authService=require(_0x71fd('0xf'));var qs=require(_0x71fd('0x10'));var as=require(_0x71fd('0x11'));var hardwareService=require(_0x71fd('0x12'));var logger=require(_0x71fd('0x13'))(_0x71fd('0x14'));var utils=require(_0x71fd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x71fd('0x16'));var db=require(_0x71fd('0x17'))['db'];function respondWithStatusCode(_0x445ee0,_0x37365f){_0x37365f=_0x37365f||0xcc;return function(_0x3b06ab){if(_0x3b06ab){return _0x445ee0['sendStatus'](_0x37365f);}return _0x445ee0[_0x71fd('0x18')](_0x37365f)['end']();};}function respondWithResult(_0x4b639c,_0x2571cc){_0x2571cc=_0x2571cc||0xc8;return function(_0x484dac){if(_0x484dac){return _0x4b639c[_0x71fd('0x18')](_0x2571cc)['json'](_0x484dac);}};}function respondWithFilteredResult(_0x374812,_0x23cc27){return function(_0x486336){if(_0x486336){var _0x537af2=_0x486336[_0x71fd('0x19')],_0x5b1ec9=_0x23cc27[_0x71fd('0x1a')],_0x42080c=_0x23cc27[_0x71fd('0x1a')]+_0x23cc27[_0x71fd('0x1b')],_0x152656;if(_0x42080c>=_0x537af2){_0x42080c=_0x537af2;_0x152656=0xc8;}else{_0x152656=0xce;}_0x374812['status'](_0x152656);return _0x374812['set'](_0x71fd('0x1c'),_0x5b1ec9+'-'+_0x42080c+'/'+_0x537af2)[_0x71fd('0x1d')](_0x486336);}return null;};}function patchUpdates(_0x147754){return function(_0x3ca67c){try{jsonpatch[_0x71fd('0x1e')](_0x3ca67c,_0x147754,!![]);}catch(_0x12d6e3){return BPromise[_0x71fd('0x1f')](_0x12d6e3);}return _0x3ca67c['save']();};}function saveUpdates(_0x57b3e9,_0x1b6820){return function(_0x2e75d8){if(_0x2e75d8){return _0x2e75d8[_0x71fd('0x20')](_0x57b3e9)[_0x71fd('0x21')](function(_0x15adf9){return _0x15adf9;});}return null;};}function removeEntity(_0x5102aa,_0xf665fc){return function(_0x3272e1){if(_0x3272e1){return _0x3272e1[_0x71fd('0x22')]()['then'](function(){_0x5102aa[_0x71fd('0x18')](0xcc)[_0x71fd('0x23')]();});}};}function handleEntityNotFound(_0x5d738f,_0x32ff53){return function(_0x559fa1){if(!_0x559fa1){_0x5d738f[_0x71fd('0x24')](0x194);}return _0x559fa1;};}function handleError(_0x2d3b2c,_0x34897a){_0x34897a=_0x34897a||0x1f4;return function(_0x40acfc){logger[_0x71fd('0x25')](_0x40acfc[_0x71fd('0x26')]);if(_0x40acfc[_0x71fd('0x27')]){delete _0x40acfc[_0x71fd('0x27')];}_0x2d3b2c['status'](_0x34897a)[_0x71fd('0x28')](_0x40acfc);};}exports[_0x71fd('0x29')]=function(_0x1c46bb,_0x9c2f8f){var _0x3b1bfc={},_0x1406c8={},_0x13f670={'count':0x0,'rows':[]};var _0x3e512b=_[_0x71fd('0x2a')](db[_0x71fd('0x2b')][_0x71fd('0x2c')],function(_0x5067a6){return{'name':_0x5067a6[_0x71fd('0x2d')],'type':_0x5067a6[_0x71fd('0x2e')][_0x71fd('0x2f')]};});_0x1406c8[_0x71fd('0x30')]=_[_0x71fd('0x2a')](_0x3e512b,_0x71fd('0x27'));_0x1406c8[_0x71fd('0x31')]=_[_0x71fd('0x32')](_0x1c46bb['query']);_0x1406c8[_0x71fd('0x33')]=_[_0x71fd('0x34')](_0x1406c8[_0x71fd('0x30')],_0x1406c8['query']);_0x3b1bfc['attributes']=_[_0x71fd('0x34')](_0x1406c8[_0x71fd('0x30')],qs[_0x71fd('0x35')](_0x1c46bb[_0x71fd('0x31')]['fields']));_0x3b1bfc[_0x71fd('0x36')]=_0x3b1bfc[_0x71fd('0x36')][_0x71fd('0x37')]?_0x3b1bfc[_0x71fd('0x36')]:_0x1406c8[_0x71fd('0x30')];if(!_0x1c46bb[_0x71fd('0x31')]['hasOwnProperty'](_0x71fd('0x38'))){_0x3b1bfc[_0x71fd('0x1b')]=qs[_0x71fd('0x1b')](_0x1c46bb['query']['limit']);_0x3b1bfc[_0x71fd('0x1a')]=qs[_0x71fd('0x1a')](_0x1c46bb['query'][_0x71fd('0x1a')]);}_0x3b1bfc['order']=qs['sort'](_0x1c46bb[_0x71fd('0x31')][_0x71fd('0x39')]);_0x3b1bfc[_0x71fd('0x3a')]=qs[_0x71fd('0x33')](_[_0x71fd('0x3b')](_0x1c46bb['query'],_0x1406c8[_0x71fd('0x33')]),_0x3e512b);if(_0x1c46bb['query'][_0x71fd('0x3c')]){_0x3b1bfc[_0x71fd('0x3a')]=_[_0x71fd('0x3d')](_0x3b1bfc[_0x71fd('0x3a')],{'$or':_[_0x71fd('0x2a')](_0x3e512b,function(_0x264f3d){if(_0x264f3d[_0x71fd('0x2e')]!==_0x71fd('0x3e')){var _0x3a380a={};_0x3a380a[_0x264f3d['name']]={'$like':'%'+_0x1c46bb[_0x71fd('0x31')][_0x71fd('0x3c')]+'%'};return _0x3a380a;}})});}_0x3b1bfc=_['merge']({},_0x3b1bfc,_0x1c46bb[_0x71fd('0x3f')]);var _0x3fe58d={'where':_0x3b1bfc[_0x71fd('0x3a')]};return db[_0x71fd('0x2b')][_0x71fd('0x19')](_0x3fe58d)[_0x71fd('0x21')](function(_0x2c7383){_0x13f670[_0x71fd('0x19')]=_0x2c7383;if(_0x1c46bb[_0x71fd('0x31')][_0x71fd('0x40')]){_0x3b1bfc['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x71fd('0x41')](_0x3b1bfc);})[_0x71fd('0x21')](function(_0x322d37){_0x13f670[_0x71fd('0x42')]=_0x322d37;return _0x13f670;})[_0x71fd('0x21')](respondWithFilteredResult(_0x9c2f8f,_0x3b1bfc))[_0x71fd('0x43')](handleError(_0x9c2f8f,null));};exports[_0x71fd('0x44')]=function(_0x2ef00f,_0x13828b){var _0x396d28={'raw':!![],'where':{'id':_0x2ef00f[_0x71fd('0x45')]['id']}},_0x31ec82={};_0x31ec82[_0x71fd('0x30')]=_[_0x71fd('0x32')](db[_0x71fd('0x2b')][_0x71fd('0x2c')]);_0x31ec82[_0x71fd('0x31')]=_[_0x71fd('0x32')](_0x2ef00f[_0x71fd('0x31')]);_0x31ec82[_0x71fd('0x33')]=_[_0x71fd('0x34')](_0x31ec82[_0x71fd('0x30')],_0x31ec82[_0x71fd('0x31')]);_0x396d28[_0x71fd('0x36')]=_[_0x71fd('0x34')](_0x31ec82[_0x71fd('0x30')],qs[_0x71fd('0x35')](_0x2ef00f[_0x71fd('0x31')][_0x71fd('0x35')]));_0x396d28[_0x71fd('0x36')]=_0x396d28['attributes']['length']?_0x396d28[_0x71fd('0x36')]:_0x31ec82['model'];if(_0x2ef00f[_0x71fd('0x31')]['includeAll']){_0x396d28['include']=[{'all':!![]}];}_0x396d28=_[_0x71fd('0x3d')]({},_0x396d28,_0x2ef00f[_0x71fd('0x3f')]);return db['AnalyticTreeReport']['find'](_0x396d28)[_0x71fd('0x21')](handleEntityNotFound(_0x13828b,null))['then'](respondWithResult(_0x13828b,null))[_0x71fd('0x43')](handleError(_0x13828b,null));};exports[_0x71fd('0x46')]=function(_0x1b8e25,_0xf9d07f){return db[_0x71fd('0x2b')][_0x71fd('0x46')](_0x1b8e25[_0x71fd('0x47')],{})[_0x71fd('0x21')](respondWithResult(_0xf9d07f,0xc9))[_0x71fd('0x43')](handleError(_0xf9d07f,null));};exports['update']=function(_0x5d8357,_0x52b83b){if(_0x5d8357[_0x71fd('0x47')]['id']){delete _0x5d8357[_0x71fd('0x47')]['id'];}return db['AnalyticTreeReport'][_0x71fd('0x48')]({'where':{'id':_0x5d8357[_0x71fd('0x45')]['id']}})[_0x71fd('0x21')](handleEntityNotFound(_0x52b83b,null))['then'](saveUpdates(_0x5d8357['body'],null))[_0x71fd('0x21')](respondWithResult(_0x52b83b,null))['catch'](handleError(_0x52b83b,null));};exports[_0x71fd('0x22')]=function(_0x4c2d08,_0x10c894){return db[_0x71fd('0x2b')]['find']({'where':{'id':_0x4c2d08['params']['id']}})['then'](handleEntityNotFound(_0x10c894,null))[_0x71fd('0x21')](removeEntity(_0x10c894,null))[_0x71fd('0x43')](handleError(_0x10c894,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7806ff8..9d11174 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 _0xb7de=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports'];(function(_0x401dba,_0x4ddd33){var _0x42f909=function(_0x3b0247){while(--_0x3b0247){_0x401dba['push'](_0x401dba['shift']());}};_0x42f909(++_0x4ddd33);}(_0xb7de,0xc7));var _0xeb7d=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xb7de[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var logger=require(_0xeb7d('0x2'))('api');var moment=require(_0xeb7d('0x3'));var BPromise=require(_0xeb7d('0x4'));var rp=require(_0xeb7d('0x5'));var fs=require('fs');var path=require(_0xeb7d('0x6'));var rimraf=require(_0xeb7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb7d('0x8'));module[_0xeb7d('0x9')]=function(_0xadf4,_0x433c32){return _0xadf4[_0xeb7d('0xa')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02b6=['analytics_report_trees','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport'];(function(_0x12e3b9,_0x460cf6){var _0x3de075=function(_0x182f1a){while(--_0x182f1a){_0x12e3b9['push'](_0x12e3b9['shift']());}};_0x3de075(++_0x460cf6);}(_0x02b6,0xfe));var _0x602b=function(_0x4c5213,_0x1afc89){_0x4c5213=_0x4c5213-0x0;var _0x4d401b=_0x02b6[_0x4c5213];return _0x4d401b;};'use strict';var _=require(_0x602b('0x0'));var util=require('util');var logger=require(_0x602b('0x1'))(_0x602b('0x2'));var moment=require(_0x602b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x602b('0x4'));var rimraf=require(_0x602b('0x5'));var config=require(_0x602b('0x6'));var attributes=require(_0x602b('0x7'));module['exports']=function(_0x175178,_0x51b9b7){return _0x175178[_0x602b('0x8')](_0x602b('0x9'),attributes,{'tableName':_0x602b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 52e4382..560c4d4 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 _0xf580=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1def1f,_0x230a88){var _0x3fb6ad=function(_0x52a66f){while(--_0x52a66f){_0x1def1f['push'](_0x1def1f['shift']());}};_0x3fb6ad(++_0x230a88);}(_0xf580,0x71));var _0x0f58=function(_0xdb7468,_0x4efe3b){_0xdb7468=_0xdb7468-0x0;var _0x438ed0=_0xf580[_0xdb7468];return _0x438ed0;};'use strict';var _=require(_0x0f58('0x0'));var util=require(_0x0f58('0x1'));var moment=require(_0x0f58('0x2'));var BPromise=require(_0x0f58('0x3'));var rs=require(_0x0f58('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f58('0x5'))['db'];var utils=require(_0x0f58('0x6'));var logger=require(_0x0f58('0x7'))(_0x0f58('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f58('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2da258,_0x24bed4,_0x1da550){return new BPromise(function(_0x26a2be,_0x333780){return client[_0x0f58('0xa')](_0x2da258,_0x1da550)['then'](function(_0x5881fd){logger['info'](_0x0f58('0xb'),_0x24bed4,_0x0f58('0xc'));logger[_0x0f58('0xd')](_0x0f58('0xe'),_0x24bed4,'request\x20sent',JSON[_0x0f58('0xf')](_0x5881fd));if(_0x5881fd[_0x0f58('0x10')]){if(_0x5881fd[_0x0f58('0x10')][_0x0f58('0x11')]===0x1f4){logger[_0x0f58('0x10')](_0x0f58('0xb'),_0x24bed4,_0x5881fd[_0x0f58('0x10')][_0x0f58('0x12')]);return _0x333780(_0x5881fd[_0x0f58('0x10')]['message']);}logger['error'](_0x0f58('0xb'),_0x24bed4,_0x5881fd[_0x0f58('0x10')][_0x0f58('0x12')]);return _0x26a2be(_0x5881fd[_0x0f58('0x10')][_0x0f58('0x12')]);}else{logger[_0x0f58('0x13')](_0x0f58('0xb'),_0x24bed4,_0x0f58('0xc'));_0x26a2be(_0x5881fd[_0x0f58('0x14')]['message']);}})[_0x0f58('0x15')](function(_0x2b05ca){logger[_0x0f58('0x10')](_0x0f58('0xb'),_0x24bed4,_0x2b05ca);_0x333780(_0x2b05ca);});});} \ No newline at end of file +var _0x1bba=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x1bba,0xd4));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa1bb('0x0'));var util=require(_0xa1bb('0x1'));var moment=require(_0xa1bb('0x2'));var BPromise=require(_0xa1bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1bb('0x4'))['db'];var utils=require(_0xa1bb('0x5'));var logger=require('../../config/logger')(_0xa1bb('0x6'));var config=require(_0xa1bb('0x7'));var jayson=require(_0xa1bb('0x8'));var client=jayson[_0xa1bb('0x9')][_0xa1bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x155c0d,_0x5af703,_0x2b4566){return new BPromise(function(_0x3f7af7,_0x1f4124){return client[_0xa1bb('0xb')](_0x155c0d,_0x2b4566)[_0xa1bb('0xc')](function(_0x3b6800){logger['info'](_0xa1bb('0xd'),_0x5af703,_0xa1bb('0xe'));logger[_0xa1bb('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x5af703,_0xa1bb('0xe'),JSON['stringify'](_0x3b6800));if(_0x3b6800[_0xa1bb('0x10')]){if(_0x3b6800[_0xa1bb('0x10')]['code']===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x5af703,_0x3b6800[_0xa1bb('0x10')][_0xa1bb('0x11')]);return _0x1f4124(_0x3b6800[_0xa1bb('0x10')]['message']);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x5af703,_0x3b6800[_0xa1bb('0x10')][_0xa1bb('0x11')]);return _0x3f7af7(_0x3b6800[_0xa1bb('0x10')][_0xa1bb('0x11')]);}else{logger[_0xa1bb('0x12')](_0xa1bb('0xd'),_0x5af703,_0xa1bb('0xe'));_0x3f7af7(_0x3b6800[_0xa1bb('0x13')]['message']);}})[_0xa1bb('0x14')](function(_0x55de92){logger['error'](_0xa1bb('0xd'),_0x5af703,_0x55de92);_0x1f4124(_0x55de92);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0b430f2..9bb6175 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 _0xf8a3=['isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','/:id','post'];(function(_0x46f047,_0x23a936){var _0x352bef=function(_0x99c3cb){while(--_0x99c3cb){_0x46f047['push'](_0x46f047['shift']());}};_0x352bef(++_0x23a936);}(_0xf8a3,0xa6));var _0x3f8a=function(_0x4d1d50,_0x4feedb){_0x4d1d50=_0x4d1d50-0x0;var _0x2ae3aa=_0xf8a3[_0x4d1d50];return _0x2ae3aa;};'use strict';var multer=require(_0x3f8a('0x0'));var util=require(_0x3f8a('0x1'));var path=require(_0x3f8a('0x2'));var timeout=require(_0x3f8a('0x3'));var express=require('express');var router=express[_0x3f8a('0x4')]();var auth=require(_0x3f8a('0x5'));var interaction=require(_0x3f8a('0x6'));var config=require('../../config/environment');var controller=require(_0x3f8a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3f8a('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3f8a('0x9')]('/',auth[_0x3f8a('0xa')](),controller['create']);router[_0x3f8a('0xb')]('/:id',auth[_0x3f8a('0xa')](),controller[_0x3f8a('0xc')]);router[_0x3f8a('0xd')]('/:id',auth[_0x3f8a('0xa')](),controller[_0x3f8a('0xe')]);module[_0x3f8a('0xf')]=router; \ No newline at end of file +var _0x9a23=['update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x253b37,_0xdb7ae0){var _0x24b147=function(_0x38c58d){while(--_0x38c58d){_0x253b37['push'](_0x253b37['shift']());}};_0x24b147(++_0xdb7ae0);}(_0x9a23,0x164));var _0x39a2=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x9a23[_0x11005e];return _0x29338f;};'use strict';var multer=require('multer');var util=require(_0x39a2('0x0'));var path=require('path');var timeout=require(_0x39a2('0x1'));var express=require(_0x39a2('0x2'));var router=express[_0x39a2('0x3')]();var auth=require(_0x39a2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x39a2('0x5')]);router['get'](_0x39a2('0x6'),auth[_0x39a2('0x7')](),controller[_0x39a2('0x8')]);router[_0x39a2('0x9')]('/',auth[_0x39a2('0x7')](),controller[_0x39a2('0xa')]);router[_0x39a2('0xb')](_0x39a2('0x6'),auth[_0x39a2('0x7')](),controller[_0x39a2('0xc')]);router[_0x39a2('0xd')]('/:id',auth[_0x39a2('0x7')](),controller[_0x39a2('0xe')]);module[_0x39a2('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9a4b148..2c58555 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 _0xf4bd=['sequelize','exports','STRING'];(function(_0x5ac65f,_0x285b8){var _0x31164e=function(_0x684dbe){while(--_0x684dbe){_0x5ac65f['push'](_0x5ac65f['shift']());}};_0x31164e(++_0x285b8);}(_0xf4bd,0xe4));var _0xdf4b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf4bd[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xdf4b('0x0'));module[_0xdf4b('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xdf4b('0x2')]},'type':{'type':Sequelize[_0xdf4b('0x2')]}}; \ No newline at end of file +var _0x5d0d=['exports','STRING','sequelize'];(function(_0x2803c8,_0x40ab83){var _0x38f99a=function(_0x301b11){while(--_0x301b11){_0x2803c8['push'](_0x2803c8['shift']());}};_0x38f99a(++_0x40ab83);}(_0x5d0d,0x83));var _0xd5d0=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x5d0d[_0x3430aa];return _0x2ac5c;};'use strict';var Sequelize=require(_0xd5d0('0x0'));module[_0xd5d0('0x1')]={'name':{'type':Sequelize[_0xd5d0('0x2')]},'basename':{'type':Sequelize[_0xd5d0('0x2')]},'type':{'type':Sequelize[_0xd5d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 24b7904..44fd114 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 _0x43e4=['show','params','options','find','omit','createdAt','updatedAt','body','create','originalname','basename','filename','file','mimetype','download','findOne','root','server/files/attachments/','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','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','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x43e4,0x10e));var _0x443e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x43e4[_0x122096];return _0x3d1966;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x443e('0x0'));var rimraf=require(_0x443e('0x1'));var zipdir=require(_0x443e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x443e('0x3'));var BPromise=require(_0x443e('0x4'));var Mustache=require('mustache');var util=require(_0x443e('0x5'));var path=require(_0x443e('0x6'));var sox=require(_0x443e('0x7'));var csv=require(_0x443e('0x8'));var ejs=require(_0x443e('0x9'));var fs=require('fs');var _=require(_0x443e('0xa'));var squel=require(_0x443e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x443e('0xc'));var toCsv=require(_0x443e('0x8'));var querystring=require('querystring');var Papa=require(_0x443e('0xd'));var Redis=require('ioredis');var authService=require(_0x443e('0xe'));var qs=require(_0x443e('0xf'));var as=require(_0x443e('0x10'));var hardwareService=require(_0x443e('0x11'));var logger=require(_0x443e('0x12'))(_0x443e('0x13'));var utils=require(_0x443e('0x14'));var config=require(_0x443e('0x15'));var licenseUtil=require(_0x443e('0x16'));var db=require(_0x443e('0x17'))['db'];function respondWithStatusCode(_0x55f495,_0x6bdca4){_0x6bdca4=_0x6bdca4||0xcc;return function(_0x290286){if(_0x290286){return _0x55f495[_0x443e('0x18')](_0x6bdca4);}return _0x55f495[_0x443e('0x19')](_0x6bdca4)[_0x443e('0x1a')]();};}function respondWithResult(_0x49fce3,_0x2753dd){_0x2753dd=_0x2753dd||0xc8;return function(_0xe30faa){if(_0xe30faa){return _0x49fce3[_0x443e('0x19')](_0x2753dd)[_0x443e('0x1b')](_0xe30faa);}};}function respondWithFilteredResult(_0x1b2ffd,_0x382223){return function(_0xecbe22){if(_0xecbe22){var _0x4d3143=_0xecbe22[_0x443e('0x1c')],_0x478f95=_0x382223[_0x443e('0x1d')],_0x2d6866=_0x382223['offset']+_0x382223[_0x443e('0x1e')],_0x3a91c4;if(_0x2d6866>=_0x4d3143){_0x2d6866=_0x4d3143;_0x3a91c4=0xc8;}else{_0x3a91c4=0xce;}_0x1b2ffd[_0x443e('0x19')](_0x3a91c4);return _0x1b2ffd[_0x443e('0x1f')](_0x443e('0x20'),_0x478f95+'-'+_0x2d6866+'/'+_0x4d3143)[_0x443e('0x1b')](_0xecbe22);}return null;};}function patchUpdates(_0x5f471d){return function(_0x16ee17){try{jsonpatch[_0x443e('0x21')](_0x16ee17,_0x5f471d,!![]);}catch(_0x1836fe){return BPromise['reject'](_0x1836fe);}return _0x16ee17[_0x443e('0x22')]();};}function saveUpdates(_0x4271d9,_0x1a6b91){return function(_0x5bee52){if(_0x5bee52){return _0x5bee52[_0x443e('0x23')](_0x4271d9)[_0x443e('0x24')](function(_0x5461fd){return _0x5461fd;});}return null;};}function removeEntity(_0x3315ed,_0xc7afe0){return function(_0xa8b06c){if(_0xa8b06c){return _0xa8b06c[_0x443e('0x25')]()[_0x443e('0x24')](function(){_0x3315ed[_0x443e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32864c,_0x5fda13){return function(_0x2a714d){if(!_0x2a714d){_0x32864c['sendStatus'](0x194);}return _0x2a714d;};}function handleError(_0x355a1e,_0x1ee168){_0x1ee168=_0x1ee168||0x1f4;return function(_0x3e68b5){logger[_0x443e('0x26')](_0x3e68b5['stack']);if(_0x3e68b5[_0x443e('0x27')]){delete _0x3e68b5[_0x443e('0x27')];}_0x355a1e['status'](_0x1ee168)['send'](_0x3e68b5);};}exports[_0x443e('0x28')]=function(_0x36a2a9,_0x38b912){var _0x4a6c92={},_0x42708e={},_0x2406cb={'count':0x0,'rows':[]};var _0x4cff4d=_[_0x443e('0x29')](db[_0x443e('0x2a')][_0x443e('0x2b')],function(_0x2ecb7d){return{'name':_0x2ecb7d[_0x443e('0x2c')],'type':_0x2ecb7d[_0x443e('0x2d')]['key']};});_0x42708e[_0x443e('0x2e')]=_[_0x443e('0x29')](_0x4cff4d,_0x443e('0x27'));_0x42708e[_0x443e('0x2f')]=_[_0x443e('0x30')](_0x36a2a9[_0x443e('0x2f')]);_0x42708e[_0x443e('0x31')]=_[_0x443e('0x32')](_0x42708e['model'],_0x42708e[_0x443e('0x2f')]);_0x4a6c92['attributes']=_[_0x443e('0x32')](_0x42708e[_0x443e('0x2e')],qs['fields'](_0x36a2a9[_0x443e('0x2f')][_0x443e('0x33')]));_0x4a6c92[_0x443e('0x34')]=_0x4a6c92['attributes'][_0x443e('0x35')]?_0x4a6c92[_0x443e('0x34')]:_0x42708e[_0x443e('0x2e')];if(!_0x36a2a9[_0x443e('0x2f')][_0x443e('0x36')](_0x443e('0x37'))){_0x4a6c92['limit']=qs[_0x443e('0x1e')](_0x36a2a9[_0x443e('0x2f')][_0x443e('0x1e')]);_0x4a6c92[_0x443e('0x1d')]=qs[_0x443e('0x1d')](_0x36a2a9[_0x443e('0x2f')]['offset']);}_0x4a6c92['order']=qs[_0x443e('0x38')](_0x36a2a9['query'][_0x443e('0x38')]);_0x4a6c92[_0x443e('0x39')]=qs[_0x443e('0x31')](_[_0x443e('0x3a')](_0x36a2a9[_0x443e('0x2f')],_0x42708e[_0x443e('0x31')]),_0x4cff4d);if(_0x36a2a9[_0x443e('0x2f')][_0x443e('0x3b')]){_0x4a6c92[_0x443e('0x39')]=_['merge'](_0x4a6c92['where'],{'$or':_[_0x443e('0x29')](_0x4cff4d,function(_0x2df401){if(_0x2df401[_0x443e('0x2d')]!==_0x443e('0x3c')){var _0x2a0fed={};_0x2a0fed[_0x2df401[_0x443e('0x27')]]={'$like':'%'+_0x36a2a9[_0x443e('0x2f')]['filter']+'%'};return _0x2a0fed;}})});}_0x4a6c92=_[_0x443e('0x3d')]({},_0x4a6c92,_0x36a2a9['options']);var _0x77a927={'where':_0x4a6c92[_0x443e('0x39')]};return db['Attachment'][_0x443e('0x1c')](_0x77a927)[_0x443e('0x24')](function(_0x53571b){_0x2406cb[_0x443e('0x1c')]=_0x53571b;if(_0x36a2a9[_0x443e('0x2f')][_0x443e('0x3e')]){_0x4a6c92[_0x443e('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x443e('0x40')](_0x4a6c92);})['then'](function(_0x21869c){_0x2406cb['rows']=_0x21869c;return _0x2406cb;})['then'](respondWithFilteredResult(_0x38b912,_0x4a6c92))[_0x443e('0x41')](handleError(_0x38b912,null));};exports[_0x443e('0x42')]=function(_0x3436c4,_0x1a7a25){var _0x4d09f5={'raw':!![],'where':{'id':_0x3436c4[_0x443e('0x43')]['id']}},_0x1ab793={};_0x1ab793['model']=_[_0x443e('0x30')](db['Attachment'][_0x443e('0x2b')]);_0x1ab793[_0x443e('0x2f')]=_[_0x443e('0x30')](_0x3436c4[_0x443e('0x2f')]);_0x1ab793[_0x443e('0x31')]=_['intersection'](_0x1ab793[_0x443e('0x2e')],_0x1ab793[_0x443e('0x2f')]);_0x4d09f5[_0x443e('0x34')]=_[_0x443e('0x32')](_0x1ab793[_0x443e('0x2e')],qs['fields'](_0x3436c4[_0x443e('0x2f')][_0x443e('0x33')]));_0x4d09f5[_0x443e('0x34')]=_0x4d09f5[_0x443e('0x34')]['length']?_0x4d09f5['attributes']:_0x1ab793['model'];if(_0x3436c4[_0x443e('0x2f')][_0x443e('0x3e')]){_0x4d09f5[_0x443e('0x3f')]=[{'all':!![]}];}_0x4d09f5=_[_0x443e('0x3d')]({},_0x4d09f5,_0x3436c4[_0x443e('0x44')]);return db[_0x443e('0x2a')]['find'](_0x4d09f5)['then'](handleEntityNotFound(_0x1a7a25,null))[_0x443e('0x24')](respondWithResult(_0x1a7a25,null))[_0x443e('0x41')](handleError(_0x1a7a25,null));};exports['clone']=function(_0x5a6c79,_0x5cae88){var _0x3e99d8={'where':{'id':_0x5a6c79['params']['id']}},_0x4100d={};_0x4100d[_0x443e('0x2e')]=_[_0x443e('0x30')](db[_0x443e('0x2a')][_0x443e('0x2b')]);_0x3e99d8['attributes']=_[_0x443e('0x32')](_0x4100d[_0x443e('0x2e')],qs[_0x443e('0x33')](_0x5a6c79[_0x443e('0x2f')][_0x443e('0x33')]));_0x3e99d8['attributes']=_0x3e99d8[_0x443e('0x34')][_0x443e('0x35')]?_0x3e99d8[_0x443e('0x34')]:_0x4100d['model'];if(_0x5a6c79[_0x443e('0x2f')][_0x443e('0x3e')]){_0x3e99d8[_0x443e('0x3f')]=[{'all':!![]}];}_0x3e99d8=_['merge']({},_0x3e99d8,_0x5a6c79[_0x443e('0x44')]);return db[_0x443e('0x2a')][_0x443e('0x45')](_0x3e99d8)['then'](handleEntityNotFound(_0x5cae88,null))[_0x443e('0x24')](function(_0x577d95){if(_0x577d95){var _0x1027c2=_0x577d95['get']({'plain':!![]});_0x1027c2=qs[_0x443e('0x46')](_0x1027c2,['id',_0x443e('0x47'),_0x443e('0x48')]);_0x5a6c79[_0x443e('0x49')]=_[_0x443e('0x46')](_0x5a6c79[_0x443e('0x49')],['id',_0x443e('0x47'),_0x443e('0x48')]);return db['Attachment'][_0x443e('0x4a')](_['merge'](_0x1027c2,_0x5a6c79[_0x443e('0x49')]),{'include':_0x5a6c79[_0x443e('0x2f')][_0x443e('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5cae88,0xc9))[_0x443e('0x41')](handleError(_0x5cae88,null));};exports[_0x443e('0x23')]=function(_0x20f0a3,_0x3b9e61){if(_0x20f0a3[_0x443e('0x49')]['id']){delete _0x20f0a3[_0x443e('0x49')]['id'];}return db[_0x443e('0x2a')][_0x443e('0x45')]({'where':{'id':_0x20f0a3['params']['id']}})[_0x443e('0x24')](handleEntityNotFound(_0x3b9e61,null))[_0x443e('0x24')](saveUpdates(_0x20f0a3[_0x443e('0x49')],null))['then'](respondWithResult(_0x3b9e61,null))[_0x443e('0x41')](handleError(_0x3b9e61,null));};exports[_0x443e('0x25')]=function(_0x43014a,_0x5478ca){return db[_0x443e('0x2a')]['find']({'where':{'id':_0x43014a[_0x443e('0x43')]['id']}})[_0x443e('0x24')](handleEntityNotFound(_0x5478ca,null))[_0x443e('0x24')](removeEntity(_0x5478ca,null))[_0x443e('0x41')](handleError(_0x5478ca,null));};exports[_0x443e('0x4a')]=function(_0x43176b,_0xaac13,_0x4523fe){_0x43176b[_0x443e('0x49')]['name']=_0x43176b['file'][_0x443e('0x4b')];_0x43176b['body'][_0x443e('0x4c')]=_0x43176b['file'][_0x443e('0x4d')];_0x43176b['body'][_0x443e('0x2d')]=_0x43176b[_0x443e('0x4e')][_0x443e('0x4f')];return db[_0x443e('0x2a')]['create'](_0x43176b[_0x443e('0x49')])[_0x443e('0x24')](respondWithResult(_0xaac13,0xc9))[_0x443e('0x41')](handleError(_0xaac13,null));};exports[_0x443e('0x50')]=function(_0x1e62c4,_0x3986be,_0x263781){return db[_0x443e('0x2a')][_0x443e('0x51')]({'where':{'id':_0x1e62c4[_0x443e('0x43')]['id']},'raw':!![]})[_0x443e('0x24')](handleEntityNotFound(_0x3986be,null))[_0x443e('0x24')](function(_0x43b021){if(_0x43b021){return _0x3986be[_0x443e('0x50')](path['join'](config[_0x443e('0x52')],_0x443e('0x53'),_0x43b021['basename']));}})[_0x443e('0x41')](handleError(_0x3986be,null));}; \ No newline at end of file +var _0x1720=['stack','name','send','index','map','Attachment','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','pick','filter','where','merge','options','include','findAll','rows','params','find','catch','rawAttributes','get','createdAt','updatedAt','body','omit','create','includeAll','update','destroy','originalname','basename','file','mimetype','download','findOne','server/files/attachments/','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','json','apply','reject','save','then','error'];(function(_0x1a7edf,_0x5c4e04){var _0x56c1d9=function(_0x23947e){while(--_0x23947e){_0x1a7edf['push'](_0x1a7edf['shift']());}};_0x56c1d9(++_0x5c4e04);}(_0x1720,0x133));var _0x0172=function(_0x581b0b,_0x258e98){_0x581b0b=_0x581b0b-0x0;var _0x47f5e1=_0x1720[_0x581b0b];return _0x47f5e1;};'use strict';var pdf=require(_0x0172('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0172('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0172('0x2'));var rp=require(_0x0172('0x3'));var moment=require(_0x0172('0x4'));var BPromise=require(_0x0172('0x5'));var Mustache=require(_0x0172('0x6'));var util=require(_0x0172('0x7'));var path=require(_0x0172('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0172('0x9'));var squel=require(_0x0172('0xa'));var crypto=require(_0x0172('0xb'));var jsforce=require(_0x0172('0xc'));var deskjs=require(_0x0172('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0172('0xe'));var Papa=require('papaparse');var Redis=require(_0x0172('0xf'));var authService=require(_0x0172('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0172('0x11'));var hardwareService=require(_0x0172('0x12'));var logger=require(_0x0172('0x13'))(_0x0172('0x14'));var utils=require(_0x0172('0x15'));var config=require(_0x0172('0x16'));var licenseUtil=require(_0x0172('0x17'));var db=require(_0x0172('0x18'))['db'];function respondWithStatusCode(_0x466358,_0x153e57){_0x153e57=_0x153e57||0xcc;return function(_0x51e569){if(_0x51e569){return _0x466358[_0x0172('0x19')](_0x153e57);}return _0x466358[_0x0172('0x1a')](_0x153e57)[_0x0172('0x1b')]();};}function respondWithResult(_0x38ef68,_0x2518e2){_0x2518e2=_0x2518e2||0xc8;return function(_0x260655){if(_0x260655){return _0x38ef68['status'](_0x2518e2)['json'](_0x260655);}};}function respondWithFilteredResult(_0x186c8b,_0x165088){return function(_0x116d10){if(_0x116d10){var _0x3c0f61=_0x116d10[_0x0172('0x1c')],_0x24cc09=_0x165088['offset'],_0x29bb5a=_0x165088['offset']+_0x165088[_0x0172('0x1d')],_0x4d15ee;if(_0x29bb5a>=_0x3c0f61){_0x29bb5a=_0x3c0f61;_0x4d15ee=0xc8;}else{_0x4d15ee=0xce;}_0x186c8b[_0x0172('0x1a')](_0x4d15ee);return _0x186c8b[_0x0172('0x1e')]('Content-Range',_0x24cc09+'-'+_0x29bb5a+'/'+_0x3c0f61)[_0x0172('0x1f')](_0x116d10);}return null;};}function patchUpdates(_0x1e625e){return function(_0x468049){try{jsonpatch[_0x0172('0x20')](_0x468049,_0x1e625e,!![]);}catch(_0xf10234){return BPromise[_0x0172('0x21')](_0xf10234);}return _0x468049[_0x0172('0x22')]();};}function saveUpdates(_0x3d15f9,_0x3337ce){return function(_0x1aeaff){if(_0x1aeaff){return _0x1aeaff['update'](_0x3d15f9)[_0x0172('0x23')](function(_0x4bc59d){return _0x4bc59d;});}return null;};}function removeEntity(_0x59abfb,_0x168e51){return function(_0x25c51c){if(_0x25c51c){return _0x25c51c['destroy']()[_0x0172('0x23')](function(){_0x59abfb[_0x0172('0x1a')](0xcc)[_0x0172('0x1b')]();});}};}function handleEntityNotFound(_0x5b2d6c,_0x580a2e){return function(_0x57d655){if(!_0x57d655){_0x5b2d6c[_0x0172('0x19')](0x194);}return _0x57d655;};}function handleError(_0x375c63,_0x3c2979){_0x3c2979=_0x3c2979||0x1f4;return function(_0x53e9f4){logger[_0x0172('0x24')](_0x53e9f4[_0x0172('0x25')]);if(_0x53e9f4[_0x0172('0x26')]){delete _0x53e9f4[_0x0172('0x26')];}_0x375c63[_0x0172('0x1a')](_0x3c2979)[_0x0172('0x27')](_0x53e9f4);};}exports[_0x0172('0x28')]=function(_0x5e5e6b,_0x4a77c6){var _0x49a111={},_0x2936ad={},_0x5e025c={'count':0x0,'rows':[]};var _0x1c3b1f=_[_0x0172('0x29')](db[_0x0172('0x2a')]['rawAttributes'],function(_0x5974b8){return{'name':_0x5974b8[_0x0172('0x2b')],'type':_0x5974b8[_0x0172('0x2c')][_0x0172('0x2d')]};});_0x2936ad['model']=_[_0x0172('0x29')](_0x1c3b1f,_0x0172('0x26'));_0x2936ad[_0x0172('0x2e')]=_[_0x0172('0x2f')](_0x5e5e6b[_0x0172('0x2e')]);_0x2936ad[_0x0172('0x30')]=_['intersection'](_0x2936ad[_0x0172('0x31')],_0x2936ad[_0x0172('0x2e')]);_0x49a111[_0x0172('0x32')]=_[_0x0172('0x33')](_0x2936ad[_0x0172('0x31')],qs[_0x0172('0x34')](_0x5e5e6b[_0x0172('0x2e')]['fields']));_0x49a111[_0x0172('0x32')]=_0x49a111[_0x0172('0x32')][_0x0172('0x35')]?_0x49a111[_0x0172('0x32')]:_0x2936ad[_0x0172('0x31')];if(!_0x5e5e6b[_0x0172('0x2e')][_0x0172('0x36')](_0x0172('0x37'))){_0x49a111[_0x0172('0x1d')]=qs[_0x0172('0x1d')](_0x5e5e6b['query'][_0x0172('0x1d')]);_0x49a111[_0x0172('0x38')]=qs[_0x0172('0x38')](_0x5e5e6b[_0x0172('0x2e')][_0x0172('0x38')]);}_0x49a111[_0x0172('0x39')]=qs['sort'](_0x5e5e6b[_0x0172('0x2e')]['sort']);_0x49a111['where']=qs[_0x0172('0x30')](_[_0x0172('0x3a')](_0x5e5e6b['query'],_0x2936ad[_0x0172('0x30')]),_0x1c3b1f);if(_0x5e5e6b[_0x0172('0x2e')][_0x0172('0x3b')]){_0x49a111[_0x0172('0x3c')]=_[_0x0172('0x3d')](_0x49a111[_0x0172('0x3c')],{'$or':_['map'](_0x1c3b1f,function(_0x2505d5){if(_0x2505d5[_0x0172('0x2c')]!=='VIRTUAL'){var _0x13d04d={};_0x13d04d[_0x2505d5[_0x0172('0x26')]]={'$like':'%'+_0x5e5e6b[_0x0172('0x2e')]['filter']+'%'};return _0x13d04d;}})});}_0x49a111=_['merge']({},_0x49a111,_0x5e5e6b[_0x0172('0x3e')]);var _0x2159fb={'where':_0x49a111[_0x0172('0x3c')]};return db[_0x0172('0x2a')][_0x0172('0x1c')](_0x2159fb)[_0x0172('0x23')](function(_0x39de5d){_0x5e025c['count']=_0x39de5d;if(_0x5e5e6b['query']['includeAll']){_0x49a111[_0x0172('0x3f')]=[{'all':!![]}];}return db[_0x0172('0x2a')][_0x0172('0x40')](_0x49a111);})[_0x0172('0x23')](function(_0x2561e5){_0x5e025c[_0x0172('0x41')]=_0x2561e5;return _0x5e025c;})['then'](respondWithFilteredResult(_0x4a77c6,_0x49a111))['catch'](handleError(_0x4a77c6,null));};exports['show']=function(_0x3a03d3,_0x373669){var _0x29e02d={'raw':!![],'where':{'id':_0x3a03d3[_0x0172('0x42')]['id']}},_0x410072={};_0x410072['model']=_[_0x0172('0x2f')](db[_0x0172('0x2a')]['rawAttributes']);_0x410072[_0x0172('0x2e')]=_[_0x0172('0x2f')](_0x3a03d3['query']);_0x410072[_0x0172('0x30')]=_['intersection'](_0x410072[_0x0172('0x31')],_0x410072[_0x0172('0x2e')]);_0x29e02d[_0x0172('0x32')]=_[_0x0172('0x33')](_0x410072[_0x0172('0x31')],qs[_0x0172('0x34')](_0x3a03d3[_0x0172('0x2e')][_0x0172('0x34')]));_0x29e02d[_0x0172('0x32')]=_0x29e02d[_0x0172('0x32')][_0x0172('0x35')]?_0x29e02d[_0x0172('0x32')]:_0x410072['model'];if(_0x3a03d3[_0x0172('0x2e')]['includeAll']){_0x29e02d['include']=[{'all':!![]}];}_0x29e02d=_['merge']({},_0x29e02d,_0x3a03d3[_0x0172('0x3e')]);return db['Attachment'][_0x0172('0x43')](_0x29e02d)[_0x0172('0x23')](handleEntityNotFound(_0x373669,null))[_0x0172('0x23')](respondWithResult(_0x373669,null))[_0x0172('0x44')](handleError(_0x373669,null));};exports['clone']=function(_0x5b393f,_0x56ce48){var _0x6c7d00={'where':{'id':_0x5b393f[_0x0172('0x42')]['id']}},_0x445f74={};_0x445f74[_0x0172('0x31')]=_[_0x0172('0x2f')](db[_0x0172('0x2a')][_0x0172('0x45')]);_0x6c7d00[_0x0172('0x32')]=_[_0x0172('0x33')](_0x445f74[_0x0172('0x31')],qs[_0x0172('0x34')](_0x5b393f[_0x0172('0x2e')][_0x0172('0x34')]));_0x6c7d00['attributes']=_0x6c7d00['attributes'][_0x0172('0x35')]?_0x6c7d00[_0x0172('0x32')]:_0x445f74[_0x0172('0x31')];if(_0x5b393f['query']['includeAll']){_0x6c7d00[_0x0172('0x3f')]=[{'all':!![]}];}_0x6c7d00=_[_0x0172('0x3d')]({},_0x6c7d00,_0x5b393f[_0x0172('0x3e')]);return db['Attachment']['find'](_0x6c7d00)[_0x0172('0x23')](handleEntityNotFound(_0x56ce48,null))['then'](function(_0xe00b2a){if(_0xe00b2a){var _0x117db1=_0xe00b2a[_0x0172('0x46')]({'plain':!![]});_0x117db1=qs['omit'](_0x117db1,['id',_0x0172('0x47'),_0x0172('0x48')]);_0x5b393f[_0x0172('0x49')]=_[_0x0172('0x4a')](_0x5b393f[_0x0172('0x49')],['id',_0x0172('0x47'),_0x0172('0x48')]);return db[_0x0172('0x2a')][_0x0172('0x4b')](_['merge'](_0x117db1,_0x5b393f['body']),{'include':_0x5b393f['query'][_0x0172('0x4c')]?[{'all':!![]}]:undefined});}})[_0x0172('0x23')](respondWithResult(_0x56ce48,0xc9))[_0x0172('0x44')](handleError(_0x56ce48,null));};exports[_0x0172('0x4d')]=function(_0x4c07e8,_0x53036e){if(_0x4c07e8[_0x0172('0x49')]['id']){delete _0x4c07e8[_0x0172('0x49')]['id'];}return db['Attachment'][_0x0172('0x43')]({'where':{'id':_0x4c07e8[_0x0172('0x42')]['id']}})['then'](handleEntityNotFound(_0x53036e,null))[_0x0172('0x23')](saveUpdates(_0x4c07e8[_0x0172('0x49')],null))[_0x0172('0x23')](respondWithResult(_0x53036e,null))['catch'](handleError(_0x53036e,null));};exports[_0x0172('0x4e')]=function(_0x346314,_0x4f0e37){return db['Attachment'][_0x0172('0x43')]({'where':{'id':_0x346314[_0x0172('0x42')]['id']}})[_0x0172('0x23')](handleEntityNotFound(_0x4f0e37,null))[_0x0172('0x23')](removeEntity(_0x4f0e37,null))[_0x0172('0x44')](handleError(_0x4f0e37,null));};exports['create']=function(_0x3a7c3f,_0x16ac1b,_0x976b2c){_0x3a7c3f['body'][_0x0172('0x26')]=_0x3a7c3f['file'][_0x0172('0x4f')];_0x3a7c3f[_0x0172('0x49')][_0x0172('0x50')]=_0x3a7c3f['file']['filename'];_0x3a7c3f['body'][_0x0172('0x2c')]=_0x3a7c3f[_0x0172('0x51')][_0x0172('0x52')];return db['Attachment'][_0x0172('0x4b')](_0x3a7c3f[_0x0172('0x49')])['then'](respondWithResult(_0x16ac1b,0xc9))['catch'](handleError(_0x16ac1b,null));};exports[_0x0172('0x53')]=function(_0x32aa60,_0x2b0021,_0x2d94f5){return db[_0x0172('0x2a')][_0x0172('0x54')]({'where':{'id':_0x32aa60['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2b0021,null))[_0x0172('0x23')](function(_0x5e2847){if(_0x5e2847){return _0x2b0021['download'](path['join'](config['root'],_0x0172('0x55'),_0x5e2847[_0x0172('0x50')]));}})[_0x0172('0x44')](handleError(_0x2b0021,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0c17f46..f16ae80 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 _0xf3aa=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash'];(function(_0x4039fb,_0xfe2645){var _0x2ae743=function(_0x5bb365){while(--_0x5bb365){_0x4039fb['push'](_0x4039fb['shift']());}};_0x2ae743(++_0xfe2645);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x37df6c,_0x2a9666){_0x37df6c=_0x37df6c-0x0;var _0x41f7aa=_0xf3aa[_0x37df6c];return _0x41f7aa;};'use strict';var _=require(_0xaf3a('0x0'));var util=require(_0xaf3a('0x1'));var logger=require(_0xaf3a('0x2'))(_0xaf3a('0x3'));var moment=require('moment');var BPromise=require(_0xaf3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaf3a('0x5'));var config=require(_0xaf3a('0x6'));var attributes=require(_0xaf3a('0x7'));module[_0xaf3a('0x8')]=function(_0x3050e3,_0x141196){return _0x3050e3[_0xaf3a('0x9')](_0xaf3a('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ce=['Attachment','attachments','lodash','api','moment','bluebird','request-promise','define'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xf4ce,0xf2));var _0xef4c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf4ce[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xef4c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef4c('0x1'));var moment=require(_0xef4c('0x2'));var BPromise=require(_0xef4c('0x3'));var rp=require(_0xef4c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x2488f4,_0x3e7b2a){return _0x2488f4[_0xef4c('0x5')](_0xef4c('0x6'),attributes,{'tableName':_0xef4c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 3a0e4cb..7a8e622 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 _0x54f5=['request\x20sent','stringify','error','message','result','catch','CreateAttachment','Attachment','create','body','options','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x29265b,_0x1d301f){var _0x2434be=function(_0x190420){while(--_0x190420){_0x29265b['push'](_0x29265b['shift']());}};_0x2434be(++_0x1d301f);}(_0x54f5,0x178));var _0x554f=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x54f5[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0x554f('0x0'));var util=require('util');var moment=require(_0x554f('0x1'));var BPromise=require('bluebird');var rs=require(_0x554f('0x2'));var fs=require('fs');var Redis=require(_0x554f('0x3'));var db=require(_0x554f('0x4'))['db'];var utils=require(_0x554f('0x5'));var logger=require('../../config/logger')(_0x554f('0x6'));var config=require(_0x554f('0x7'));var jayson=require(_0x554f('0x8'));var client=jayson['client'][_0x554f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1eb26b,_0x270dd9,_0x4ae347){return new BPromise(function(_0x2776ec,_0x20a19d){return client[_0x554f('0xa')](_0x1eb26b,_0x4ae347)[_0x554f('0xb')](function(_0x2dff9b){logger[_0x554f('0xc')](_0x554f('0xd'),_0x270dd9,_0x554f('0xe'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x270dd9,_0x554f('0xe'),JSON[_0x554f('0xf')](_0x2dff9b));if(_0x2dff9b[_0x554f('0x10')]){if(_0x2dff9b['error']['code']===0x1f4){logger[_0x554f('0x10')](_0x554f('0xd'),_0x270dd9,_0x2dff9b['error']['message']);return _0x20a19d(_0x2dff9b[_0x554f('0x10')][_0x554f('0x11')]);}logger[_0x554f('0x10')](_0x554f('0xd'),_0x270dd9,_0x2dff9b[_0x554f('0x10')][_0x554f('0x11')]);return _0x2776ec(_0x2dff9b[_0x554f('0x10')][_0x554f('0x11')]);}else{logger[_0x554f('0xc')](_0x554f('0xd'),_0x270dd9,'request\x20sent');_0x2776ec(_0x2dff9b[_0x554f('0x12')][_0x554f('0x11')]);}})[_0x554f('0x13')](function(_0x3ee8e0){logger[_0x554f('0x10')](_0x554f('0xd'),_0x270dd9,_0x3ee8e0);_0x20a19d(_0x3ee8e0);});});}exports[_0x554f('0x14')]=function(_0x51dab2){var _0x481b15=this;return new Promise(function(_0x3b01be,_0x591d23){return db[_0x554f('0x15')][_0x554f('0x16')](_0x51dab2[_0x554f('0x17')],{'raw':_0x51dab2[_0x554f('0x18')]?_0x51dab2['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e119b){logger[_0x554f('0xc')]('CreateAttachment',_0x51dab2);logger[_0x554f('0x19')](_0x554f('0x14'),_0x51dab2,JSON[_0x554f('0xf')](_0x1e119b));_0x3b01be(_0x1e119b);})['catch'](function(_0x258473){logger[_0x554f('0x10')](_0x554f('0x14'),_0x258473[_0x554f('0x11')],_0x51dab2);_0x591d23(_0x481b15['error'](0x1f4,_0x258473['message']));});});}; \ No newline at end of file +var _0x2f59=['result','catch','CreateAttachment','Attachment','create','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x13116e,_0x599973){var _0x58bf7e=function(_0x229ddc){while(--_0x229ddc){_0x13116e['push'](_0x13116e['shift']());}};_0x58bf7e(++_0x599973);}(_0x2f59,0xd7));var _0x92f5=function(_0x13d46e,_0xb71980){_0x13d46e=_0x13d46e-0x0;var _0x30e59b=_0x2f59[_0x13d46e];return _0x30e59b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92f5('0x0'));var BPromise=require('bluebird');var rs=require(_0x92f5('0x1'));var fs=require('fs');var Redis=require(_0x92f5('0x2'));var db=require(_0x92f5('0x3'))['db'];var utils=require(_0x92f5('0x4'));var logger=require(_0x92f5('0x5'))(_0x92f5('0x6'));var config=require(_0x92f5('0x7'));var jayson=require(_0x92f5('0x8'));var client=jayson[_0x92f5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53cdab,_0x59faae,_0x1f9b1c){return new BPromise(function(_0x171f47,_0x6c6d21){return client[_0x92f5('0xa')](_0x53cdab,_0x1f9b1c)[_0x92f5('0xb')](function(_0x5ffcbc){logger[_0x92f5('0xc')](_0x92f5('0xd'),_0x59faae,'request\x20sent');logger[_0x92f5('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x59faae,_0x92f5('0xf'),JSON['stringify'](_0x5ffcbc));if(_0x5ffcbc[_0x92f5('0x10')]){if(_0x5ffcbc[_0x92f5('0x10')][_0x92f5('0x11')]===0x1f4){logger['error'](_0x92f5('0xd'),_0x59faae,_0x5ffcbc[_0x92f5('0x10')][_0x92f5('0x12')]);return _0x6c6d21(_0x5ffcbc[_0x92f5('0x10')][_0x92f5('0x12')]);}logger[_0x92f5('0x10')]('Attachment,\x20%s,\x20%s',_0x59faae,_0x5ffcbc[_0x92f5('0x10')][_0x92f5('0x12')]);return _0x171f47(_0x5ffcbc[_0x92f5('0x10')][_0x92f5('0x12')]);}else{logger[_0x92f5('0xc')](_0x92f5('0xd'),_0x59faae,'request\x20sent');_0x171f47(_0x5ffcbc[_0x92f5('0x13')][_0x92f5('0x12')]);}})[_0x92f5('0x14')](function(_0x5e30b1){logger[_0x92f5('0x10')](_0x92f5('0xd'),_0x59faae,_0x5e30b1);_0x6c6d21(_0x5e30b1);});});}exports[_0x92f5('0x15')]=function(_0x3d6c30){var _0x164b63=this;return new Promise(function(_0x538d05,_0x2754a0){return db[_0x92f5('0x16')][_0x92f5('0x17')](_0x3d6c30['body'],{'raw':_0x3d6c30['options']?_0x3d6c30[_0x92f5('0x18')][_0x92f5('0x19')]===undefined?!![]:![]:!![]})[_0x92f5('0xb')](function(_0x126533){logger['info'](_0x92f5('0x15'),_0x3d6c30);logger['debug']('CreateAttachment',_0x3d6c30,JSON['stringify'](_0x126533));_0x538d05(_0x126533);})[_0x92f5('0x14')](function(_0x384c07){logger[_0x92f5('0x10')](_0x92f5('0x15'),_0x384c07[_0x92f5('0x12')],_0x3d6c30);_0x2754a0(_0x164b63[_0x92f5('0x10')](0x1f4,_0x384c07['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 95c62ee..be1a2a5 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 _0x7348=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','post','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','file','create','put','delete','destroy','exports','util'];(function(_0x5e46d7,_0xd36bbb){var _0xce1f6d=function(_0x3285be){while(--_0x3285be){_0x5e46d7['push'](_0x5e46d7['shift']());}};_0xce1f6d(++_0xd36bbb);}(_0x7348,0x16b));var _0x8734=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7348[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x8734('0x0'));var path=require(_0x8734('0x1'));var timeout=require('connect-timeout');var express=require(_0x8734('0x2'));var router=express[_0x8734('0x3')]();var auth=require(_0x8734('0x4'));var interaction=require(_0x8734('0x5'));var config=require(_0x8734('0x6'));var controller=require('./attachment.controller');router[_0x8734('0x7')]('/',auth['isAuthenticated'](),controller[_0x8734('0x8')]);router['get'](_0x8734('0x9'),auth[_0x8734('0xa')](),controller[_0x8734('0xb')]);router['get'](_0x8734('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x8734('0xd')]('/:id/clone',auth[_0x8734('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x8734('0xe')]({'destination':function(_0x398e71,_0x2ab38d,_0x326d26){_0x326d26(null,path['join'](config[_0x8734('0xf')],_0x8734('0x10')));},'filename':function(_0x32b0be,_0x9c3bf3,_0xca1e47){_0xca1e47(null,util[_0x8734('0x11')](_0x8734('0x12'),Date['now'](),_0x9c3bf3[_0x8734('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0x8734('0x14')),controller[_0x8734('0x15')]);router[_0x8734('0x16')](_0x8734('0x9'),auth[_0x8734('0xa')](),controller['update']);router[_0x8734('0x17')](_0x8734('0x9'),auth['isAuthenticated'](),controller[_0x8734('0x18')]);module[_0x8734('0x19')]=router; \ No newline at end of file +var _0x2d0b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','download','post','/:id/clone','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0x6d31bf,_0x30b243){var _0x367ef8=function(_0x286e05){while(--_0x286e05){_0x6d31bf['push'](_0x6d31bf['shift']());}};_0x367ef8(++_0x30b243);}(_0x2d0b,0x102));var _0xb2d0=function(_0xa4b92e,_0x342d77){_0xa4b92e=_0xa4b92e-0x0;var _0x3e45e3=_0x2d0b[_0xa4b92e];return _0x3e45e3;};'use strict';var multer=require('multer');var util=require(_0xb2d0('0x0'));var path=require(_0xb2d0('0x1'));var timeout=require(_0xb2d0('0x2'));var express=require('express');var router=express[_0xb2d0('0x3')]();var auth=require(_0xb2d0('0x4'));var interaction=require(_0xb2d0('0x5'));var config=require(_0xb2d0('0x6'));var controller=require('./attachment.controller');router[_0xb2d0('0x7')]('/',auth['isAuthenticated'](),controller[_0xb2d0('0x8')]);router[_0xb2d0('0x7')](_0xb2d0('0x9'),auth[_0xb2d0('0xa')](),controller[_0xb2d0('0xb')]);router[_0xb2d0('0x7')](_0xb2d0('0xc'),auth[_0xb2d0('0xa')](),controller[_0xb2d0('0xd')]);router[_0xb2d0('0xe')](_0xb2d0('0xf'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46f51b,_0x584e34,_0x49efa2){_0x49efa2(null,path['join'](config[_0xb2d0('0x10')],_0xb2d0('0x11')));},'filename':function(_0x2b124b,_0x4f7a57,_0x19e3e8){_0x19e3e8(null,util['format'](_0xb2d0('0x12'),Date[_0xb2d0('0x13')](),_0x4f7a57[_0xb2d0('0x14')][_0xb2d0('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb2d0('0xe')]('/',upload[_0xb2d0('0x16')](_0xb2d0('0x17')),controller[_0xb2d0('0x18')]);router[_0xb2d0('0x19')](_0xb2d0('0x9'),auth[_0xb2d0('0xa')](),controller[_0xb2d0('0x1a')]);router[_0xb2d0('0x1b')](_0xb2d0('0x9'),auth[_0xb2d0('0xa')](),controller['destroy']);module[_0xb2d0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 81e9753..eabed13 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 _0x58d4=['profile','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts','then','User','emails','value','admin','user','agent','disabled','blockDuration','blocked','blockedAt','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login'];(function(_0x2c89e9,_0x1756cc){var _0x55b4b5=function(_0x366cc9){while(--_0x366cc9){_0x2c89e9['push'](_0x2c89e9['shift']());}};_0x55b4b5(++_0x1756cc);}(_0x58d4,0x16a));var _0x458d=function(_0x4df8d9,_0x5818fb){_0x4df8d9=_0x4df8d9-0x0;var _0x223be6=_0x58d4[_0x4df8d9];return _0x223be6;};'use strict';var _=require(_0x458d('0x0'));var passport=require(_0x458d('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x458d('0x2')];var moment=require(_0x458d('0x3'));var db=require(_0x458d('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x458d('0x5'))[_0x458d('0x6')];var utils=require(_0x458d('0x7'));exports[_0x458d('0x8')]=passport[_0x458d('0x9')](_0x458d('0xa'),{'failureRedirect':_0x458d('0xb'),'scope':[_0x458d('0xc'),'email'],'session':![]});exports['callback']=passport[_0x458d('0x9')](_0x458d('0xa'),{'failureRedirect':_0x458d('0xb'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x458d('0xa')]?config[_0x458d('0xa')][_0x458d('0xd')]:'id','clientSecret':config[_0x458d('0xa')]?config['google'][_0x458d('0xe')]:_0x458d('0xf'),'callbackURL':config[_0x458d('0xa')]?config[_0x458d('0xa')][_0x458d('0x10')]:''},function(_0x4e5b43,_0x41da65,_0x48fec5,_0x38fa31){var _0xbbc875,_0x26da3a;return db[_0x458d('0x11')]['findOne']({'where':{'id':0x1},'attributes':[_0x458d('0x12'),'blockDuration'],'raw':!![]})[_0x458d('0x13')](function(_0x59fa4f){_0xbbc875=_0x59fa4f;return db[_0x458d('0x14')]['find']({'where':{'email':_['map'](_0x48fec5[_0x458d('0x15')],_0x458d('0x16')),'role':{'$or':[_0x458d('0x17'),_0x458d('0x18'),_0x458d('0x19')]}}});})[_0x458d('0x13')](function(_0x38a2ca){_0x26da3a=_0x38a2ca;if(_0x26da3a){if(_0x26da3a[_0x458d('0x1a')]){return _0x38fa31('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0xbbc875[_0x458d('0x1b')]>0x0){if(_0x26da3a[_0x458d('0x1c')]){if(moment(_0x26da3a[_0x458d('0x1d')])['add'](_0xbbc875[_0x458d('0x1b')],'minutes')>moment()){return _0x38fa31(_0x458d('0x1e'));}else{return utils[_0x458d('0x1f')](_0x26da3a,0x0,![],null)[_0x458d('0x13')](function(){return utils[_0x458d('0x20')](_0x26da3a);})[_0x458d('0x13')](function(){return _0x38fa31(null,_0x26da3a);});}}else{return utils['getLicense'](_0x26da3a)['then'](function(){return _0x38fa31(null,_0x26da3a);});}}else{return utils['getLicense'](_0x26da3a)[_0x458d('0x13')](function(){return _0x38fa31(null,_0x26da3a);});}}return _0x38fa31(_0x458d('0x1e'));})[_0x458d('0x21')](function(_0x5a0b9b){_0x38fa31(_0x5a0b9b);});})); \ No newline at end of file +var _0x1729=['getLicense','catch','Strategy','moment','../../mysqldb','signToken','../../config/utils','login','/login','profile','callback','authenticate','google','clientID','clientSecret','secret','callbackURL','Setting','findOne','then','find','emails','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','blockDuration','minutes','clearBlockUser'];(function(_0x588d47,_0x49d228){var _0x2d6a74=function(_0x26647f){while(--_0x26647f){_0x588d47['push'](_0x588d47['shift']());}};_0x2d6a74(++_0x49d228);}(_0x1729,0x7e));var _0x9172=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x1729[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x9172('0x0')];var moment=require(_0x9172('0x1'));var db=require(_0x9172('0x2'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x9172('0x3')];var utils=require(_0x9172('0x4'));exports[_0x9172('0x5')]=passport['authenticate']('google',{'failureRedirect':_0x9172('0x6'),'scope':[_0x9172('0x7'),'email'],'session':![]});exports[_0x9172('0x8')]=passport[_0x9172('0x9')](_0x9172('0xa'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x9172('0xa')]?config[_0x9172('0xa')][_0x9172('0xb')]:'id','clientSecret':config[_0x9172('0xa')]?config[_0x9172('0xa')][_0x9172('0xc')]:_0x9172('0xd'),'callbackURL':config[_0x9172('0xa')]?config['google'][_0x9172('0xe')]:''},function(_0x382897,_0x529ae1,_0x14c344,_0x3ae1eb){var _0x275a6,_0xde70ac;return db[_0x9172('0xf')][_0x9172('0x10')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x9172('0x11')](function(_0x148d1c){_0x275a6=_0x148d1c;return db['User'][_0x9172('0x12')]({'where':{'email':_['map'](_0x14c344[_0x9172('0x13')],'value'),'role':{'$or':[_0x9172('0x14'),_0x9172('0x15'),'agent']}}});})[_0x9172('0x11')](function(_0x3553fe){_0xde70ac=_0x3553fe;if(_0xde70ac){if(_0xde70ac['disabled']){return _0x3ae1eb(_0x9172('0x16'));}else if(_0x275a6['blockDuration']>0x0){if(_0xde70ac[_0x9172('0x17')]){if(moment(_0xde70ac[_0x9172('0x18')])[_0x9172('0x19')](_0x275a6[_0x9172('0x1a')],_0x9172('0x1b'))>moment()){return _0x3ae1eb(_0x9172('0x16'));}else{return utils[_0x9172('0x1c')](_0xde70ac,0x0,![],null)['then'](function(){return utils[_0x9172('0x1d')](_0xde70ac);})[_0x9172('0x11')](function(){return _0x3ae1eb(null,_0xde70ac);});}}else{return utils[_0x9172('0x1d')](_0xde70ac)[_0x9172('0x11')](function(){return _0x3ae1eb(null,_0xde70ac);});}}else{return utils[_0x9172('0x1d')](_0xde70ac)[_0x9172('0x11')](function(){return _0x3ae1eb(null,_0xde70ac);});}}return _0x3ae1eb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x9172('0x1e')](function(_0x1543fd){_0x3ae1eb(_0x1543fd);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8efa117..dc3891d 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 _0x385b=['callback','isMiddleware','login','setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x119b79,_0x4b0875){var _0x3da1f8=function(_0x464505){while(--_0x464505){_0x119b79['push'](_0x119b79['shift']());}};_0x3da1f8(++_0x4b0875);}(_0x385b,0x1a7));var _0xb385=function(_0x2a32e1,_0x2dd0ff){_0x2a32e1=_0x2a32e1-0x0;var _0x1691d2=_0x385b[_0x2a32e1];return _0x1691d2;};'use strict';var express=require('express');var passport=require(_0xb385('0x0'));var router=express['Router']();var controller=require(_0xb385('0x1'));var userController=require(_0xb385('0x2'));var authService=require(_0xb385('0x3'));router[_0xb385('0x4')]('/',controller['login']);router[_0xb385('0x4')](_0xb385('0x5'),controller[_0xb385('0x6')],authService[_0xb385('0x7')],userController[_0xb385('0x8')],authService[_0xb385('0x9')]);module[_0xb385('0xa')]=router; \ No newline at end of file +var _0xbe02=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller'];(function(_0x75b067,_0xd0bd97){var _0xf293e8=function(_0x1b812c){while(--_0x1b812c){_0x75b067['push'](_0x75b067['shift']());}};_0xf293e8(++_0xd0bd97);}(_0xbe02,0x146));var _0x2be0=function(_0x571e19,_0x41c61c){_0x571e19=_0x571e19-0x0;var _0xcb76a1=_0xbe02[_0x571e19];return _0xcb76a1;};'use strict';var express=require(_0x2be0('0x0'));var passport=require(_0x2be0('0x1'));var router=express[_0x2be0('0x2')]();var controller=require(_0x2be0('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x2be0('0x4'));router[_0x2be0('0x5')]('/',controller[_0x2be0('0x6')]);router[_0x2be0('0x5')](_0x2be0('0x7'),controller[_0x2be0('0x8')],authService[_0x2be0('0x9')],userController[_0x2be0('0x6')],authService[_0x2be0('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 41a4694..3f878cf 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 _0xafc4=['headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','send','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','disabled','getLicense','catch','find','MailServerOut','Smtp','service','host','port','secure','authentication','pass','merge','format','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xafc4,0x69));var _0x4afc=function(_0x2e9495,_0x233e11){_0x2e9495=_0x2e9495-0x0;var _0x33a76e=_0xafc4[_0x2e9495];return _0x33a76e;};'use strict';var util=require(_0x4afc('0x0'));var passport=require('passport');var LocalStrategy=require(_0x4afc('0x1'))['Strategy'];var jayson=require(_0x4afc('0x2'));var _=require(_0x4afc('0x3'));var rs=require(_0x4afc('0x4'));var moment=require(_0x4afc('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0x4afc('0x6')][_0x4afc('0x7')]({'port':0x232b});function localAuthenticate(_0x16953b,_0x1bb281,_0xc828d9,_0xaf053d){var _0x5e1e29,_0x31e165;return db[_0x4afc('0x8')][_0x4afc('0x9')]({'where':{'id':0x1},'attributes':[_0x4afc('0xa'),_0x4afc('0xb')],'raw':!![]})[_0x4afc('0xc')](function(_0x5542ec){_0x5e1e29=_0x5542ec;return _0x16953b['findOne']({'attributes':['id',_0x4afc('0xd'),'password',_0x4afc('0xe'),_0x4afc('0xf'),'disabled',_0x4afc('0x10'),_0x4afc('0x11'),_0x4afc('0x12')],'where':{'name':_0x1bb281,'role':{'$or':[_0x4afc('0x13'),_0x4afc('0x14'),_0x4afc('0x15')]}}});})[_0x4afc('0xc')](function(_0x23b03e){if(!_0x23b03e||_0x23b03e&&_0x23b03e['name']!==_0x1bb281){throw new Error(_0x4afc('0x16'));}else{_0x31e165=_0x23b03e;return _0x31e165;}})[_0x4afc('0xc')](function(){_0x31e165[_0x4afc('0x17')](_0xc828d9,function(_0x1e2c31,_0x5f2dc9){var _0x4e32e8=_0x31e165[_0x4afc('0x12')]+0x1;if(_0x1e2c31){return _0xaf053d(_0x1e2c31);}else if(!_0x5f2dc9){if(_0x31e165['disabled']){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else if(_0x5e1e29[_0x4afc('0xa')]>0x0){if(_0x31e165[_0x4afc('0x10')]){if(_0x5e1e29[_0x4afc('0xb')]>0x0){if(moment(_0x31e165[_0x4afc('0x11')])[_0x4afc('0x18')](_0x5e1e29[_0x4afc('0xb')],_0x4afc('0x19'))>moment()){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else{return utils[_0x4afc('0x1a')](_0x31e165,_0x4e32e8,![],null)[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{if(_0x4e32e8>=_0x5e1e29[_0x4afc('0xa')]){return utils[_0x4afc('0x1a')](_0x31e165,0x0,!![],moment())[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x4afc('0x1a')](_0x31e165,_0x4e32e8,![],null)[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});});}}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{if(_0x31e165[_0x4afc('0x1b')]){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else if(_0x5e1e29[_0x4afc('0xa')]>0x0){if(_0x31e165['blocked']){if(_0x5e1e29[_0x4afc('0xb')]>0x0){if(moment(_0x31e165[_0x4afc('0x11')])['add'](_0x5e1e29[_0x4afc('0xb')],'minutes')>moment()){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else{return utils[_0x4afc('0x1a')](_0x31e165,0x0,![],null)[_0x4afc('0xc')](function(){return utils[_0x4afc('0x1c')](_0x31e165);})[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);});}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{return utils[_0x4afc('0x1a')](_0x31e165,0x0,![],null)[_0x4afc('0xc')](function(){return utils[_0x4afc('0x1c')](_0x31e165);})[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);})[_0x4afc('0x1d')](function(_0x359c07){return _0xaf053d(null,![],_0x359c07);});}}else{if(_0x31e165[_0x4afc('0x10')]){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4afc('0x1c')](_0x31e165)[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);});}}}});})[_0x4afc('0x1d')](function(_0x4e254d){return _0xaf053d(null,![],_0x4e254d);});}function sendServiceMail(_0x52212d){return db['MailAccount'][_0x4afc('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x4afc('0xd'),'email'],'include':[{'model':db[_0x4afc('0x1f')],'as':_0x4afc('0x20')}]})['then'](function(_0x514278){if(!_0x514278){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3bae1a={'tls':{'rejectUnauthorized':![]}};if(_0x514278[_0x4afc('0x20')][_0x4afc('0x21')]){_0x3bae1a[_0x4afc('0x21')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x21')];}else{_0x3bae1a['host']=_0x514278[_0x4afc('0x20')][_0x4afc('0x22')];_0x3bae1a[_0x4afc('0x23')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x23')];_0x3bae1a[_0x4afc('0x24')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x24')];}if(_0x514278['Smtp'][_0x4afc('0x25')]){_0x3bae1a['auth']={'user':_0x514278['Smtp'][_0x4afc('0x14')],'pass':_0x514278[_0x4afc('0x20')][_0x4afc('0x26')]};}var _0x3d4ab5={'account':_0x3bae1a,'message':_[_0x4afc('0x27')]({'from':util[_0x4afc('0x28')]('\x22%s\x22\x20<%s>',_0x514278[_0x4afc('0xd')],_0x514278[_0x4afc('0x29')]||_0x514278[_0x4afc('0x20')][_0x4afc('0x14')])},_0x52212d)};return client[_0x4afc('0x2a')](_0x4afc('0x2b'),_0x3d4ab5);})['then'](function(_0x22eea2){if(_0x22eea2[_0x4afc('0x2c')]){throw new Error(util[_0x4afc('0x28')](_0x4afc('0x2d'),_0x22eea2['error']['message']||JSON[_0x4afc('0x2e')](_0x22eea2[_0x4afc('0x2c')])));}return!![];});}function handleError(_0x17ea03,_0x5edfe1,_0x5790a2){return _0x17ea03[_0x4afc('0x2f')](_0x5edfe1||0x1f4)['send']({'message':_0x5790a2?_0x5790a2['message']||_0x5790a2:''});}exports[_0x4afc('0x30')]=function(_0x1dc853,_0x2be40e,_0x3e41f5){passport[_0x4afc('0x17')](_0x4afc('0x31'),function(_0x453e12,_0x29c0df,_0x3ccc5a){var _0x38f762=_0x453e12||_0x3ccc5a;if(_0x38f762){return handleError(_0x2be40e,0x191,_0x38f762);}if(!_0x29c0df){return handleError(_0x2be40e,0x194,{'message':_0x4afc('0x32')});}else{var _0x3ef2aa={'payload':{'id':_0x29c0df['id'],'role':_0x29c0df[_0x4afc('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x4afc('0x33')](_0x3ef2aa)[_0x4afc('0xc')](function(_0x5589be){_0x2be40e[_0x4afc('0x34')]({'id':_0x29c0df['id'],'token':_0x5589be,'statusCall':'','isAlreadyLogged':_0x29c0df[_0x4afc('0x35')]});});}})(_0x1dc853,_0x2be40e,_0x3e41f5);};exports[_0x4afc('0x36')]=function(_0xe6db12,_0x12db1d,_0x260b06){if(!_0xe6db12[_0x4afc('0x37')]['email']){return handleError(_0x12db1d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5ee5d7=rs[_0x4afc('0x38')]();_0xe6db12[_0x4afc('0x37')]['email']=_0xe6db12[_0x4afc('0x37')][_0x4afc('0x29')][_0x4afc('0x39')]()[_0x4afc('0x3a')]();var _0x545109;return db[_0x4afc('0x8')][_0x4afc('0x9')]({'where':{'id':0x1},'attributes':[_0x4afc('0xa'),_0x4afc('0xb')],'raw':!![]})[_0x4afc('0xc')](function(_0x2404fc){_0x545109=_0x2404fc;return db['User'][_0x4afc('0x1e')]({'where':{'email':_0xe6db12['body'][_0x4afc('0x29')]}});})[_0x4afc('0xc')](function(_0x212441){if(!_0x212441){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x212441['disabled']){throw new Error(_0x4afc('0x3b'));}if(_0x212441[_0x4afc('0x10')]){if(moment(_0x212441[_0x4afc('0x11')])[_0x4afc('0x18')](_0x545109[_0x4afc('0xb')],_0x4afc('0x19'))>moment()){throw new Error(_0x4afc('0x3c'));}else{_0x212441[_0x4afc('0x10')]=![];_0x212441['blockedAt']=null;}}_0x212441[_0x4afc('0x3d')]=_0x5ee5d7;_0x212441[_0x4afc('0x3e')]=Date['now']()+0x36ee80;return _0x212441[_0x4afc('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0xe6db12[_0x4afc('0x37')][_0x4afc('0x29')],'subject':_0x4afc('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x4afc('0x41')+_0x4afc('0x42')+_0xe6db12[_0x4afc('0x43')][_0x4afc('0x22')]+_0x4afc('0x44')+_0x5ee5d7+'\x0a\x0a'+_0x4afc('0x45')});})['then'](function(){_0x12db1d['status'](0xc8)['send']({'message':_0x4afc('0x46')});})[_0x4afc('0x1d')](function(_0x42e274){return handleError(_0x12db1d,0x1f4,_0x42e274);});};exports[_0x4afc('0x47')]=function(_0xb5cca9,_0x122cbc,_0x22e8b0){return db[_0x4afc('0x48')][_0x4afc('0x1e')]({'where':{'resetPasswordToken':_0xb5cca9[_0x4afc('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0x4afc('0x4a')]()}}})['then'](function(_0x4861a5){if(!_0x4861a5){throw new Error(_0x4afc('0x4b'));}return db['Setting'][_0x4afc('0x9')]({'attributes':['id',_0x4afc('0x4c'),_0x4afc('0x4d'),_0x4afc('0x4e')]})['then'](function(_0x46461f){if(_0x46461f['securePassword'])authService[_0x4afc('0x4f')](_0xb5cca9[_0x4afc('0x37')][_0x4afc('0x50')]);if(!_0x46461f[_0x4afc('0x4d')]||!_0x4861a5[_0x4afc('0x51')])return _0x4861a5;authService[_0x4afc('0x52')](_0xb5cca9[_0x4afc('0x37')][_0x4afc('0x50')],_0x4861a5[_0x4afc('0x51')],_0x46461f[_0x4afc('0x4e')]);return _0x4861a5;})[_0x4afc('0xc')](function(){_0x4861a5[_0x4afc('0x50')]=_0xb5cca9['body'][_0x4afc('0x50')];_0x4861a5[_0x4afc('0x3d')]=null;_0x4861a5[_0x4afc('0x3e')]=null;return _0x4861a5[_0x4afc('0x3f')]();});})[_0x4afc('0xc')](function(){_0x122cbc[_0x4afc('0x2f')](0xc8)[_0x4afc('0x53')]({'message':_0x4afc('0x54')});})[_0x4afc('0x1d')](function(_0x3df333){return handleError(_0x122cbc,0x1f4,_0x3df333);});};passport[_0x4afc('0x55')](new LocalStrategy({'usernameField':_0x4afc('0xd'),'passwordField':_0x4afc('0x50')},function(_0x5c1421,_0x2abf25,_0x549ee4){return localAuthenticate(db[_0x4afc('0x48')],_0x5c1421,_0x2abf25,_0x549ee4);})); \ No newline at end of file +var _0xc6ac=['passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','signToken','json','online','forgot','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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\x20Email\x20sent!','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','use','util'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x6a44de,_0x18ecd2){_0x6a44de=_0x6a44de-0x0;var _0x401b2b=_0xc6ac[_0x6a44de];return _0x401b2b;};'use strict';var util=require(_0xcc6a('0x0'));var passport=require(_0xcc6a('0x1'));var LocalStrategy=require(_0xcc6a('0x2'))[_0xcc6a('0x3')];var jayson=require(_0xcc6a('0x4'));var _=require(_0xcc6a('0x5'));var rs=require(_0xcc6a('0x6'));var moment=require(_0xcc6a('0x7'));var db=require(_0xcc6a('0x8'))['db'];var authService=require(_0xcc6a('0x9'));var utils=require(_0xcc6a('0xa'));var client=jayson[_0xcc6a('0xb')][_0xcc6a('0xc')]({'port':0x232b});function localAuthenticate(_0x197bd7,_0x5f3887,_0x3dd497,_0x11b919){var _0xf02261,_0x560cc4;return db[_0xcc6a('0xd')][_0xcc6a('0xe')]({'where':{'id':0x1},'attributes':[_0xcc6a('0xf'),_0xcc6a('0x10')],'raw':!![]})[_0xcc6a('0x11')](function(_0x5e91a2){_0xf02261=_0x5e91a2;return _0x197bd7[_0xcc6a('0xe')]({'attributes':['id',_0xcc6a('0x12'),_0xcc6a('0x13'),'salt',_0xcc6a('0x14'),_0xcc6a('0x15'),_0xcc6a('0x16'),'blockedAt','loginAttempts'],'where':{'name':_0x5f3887,'role':{'$or':[_0xcc6a('0x17'),_0xcc6a('0x18'),_0xcc6a('0x19')]}}});})['then'](function(_0x483ed4){if(!_0x483ed4||_0x483ed4&&_0x483ed4[_0xcc6a('0x12')]!==_0x5f3887){throw new Error(_0xcc6a('0x1a'));}else{_0x560cc4=_0x483ed4;return _0x560cc4;}})[_0xcc6a('0x11')](function(){_0x560cc4[_0xcc6a('0x1b')](_0x3dd497,function(_0x96f9de,_0x337ec5){var _0x4133fa=_0x560cc4[_0xcc6a('0x1c')]+0x1;if(_0x96f9de){return _0x11b919(_0x96f9de);}else if(!_0x337ec5){if(_0x560cc4['disabled']){return _0x11b919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xf02261['allowedLoginAttempts']>0x0){if(_0x560cc4[_0xcc6a('0x16')]){if(_0xf02261[_0xcc6a('0x10')]>0x0){if(moment(_0x560cc4[_0xcc6a('0x1d')])[_0xcc6a('0x1e')](_0xf02261[_0xcc6a('0x10')],_0xcc6a('0x1f'))>moment()){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}else{return utils[_0xcc6a('0x20')](_0x560cc4,_0x4133fa,![],null)[_0xcc6a('0x11')](function(){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});});}}else{return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}}else{if(_0x4133fa>=_0xf02261['allowedLoginAttempts']){return utils[_0xcc6a('0x20')](_0x560cc4,0x0,!![],moment())[_0xcc6a('0x11')](function(){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});});}else{return utils[_0xcc6a('0x20')](_0x560cc4,_0x4133fa,![],null)[_0xcc6a('0x11')](function(){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});});}}}else{return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}}else{if(_0x560cc4[_0xcc6a('0x15')]){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}else if(_0xf02261[_0xcc6a('0xf')]>0x0){if(_0x560cc4[_0xcc6a('0x16')]){if(_0xf02261[_0xcc6a('0x10')]>0x0){if(moment(_0x560cc4['blockedAt'])[_0xcc6a('0x1e')](_0xf02261[_0xcc6a('0x10')],_0xcc6a('0x1f'))>moment()){return _0x11b919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xcc6a('0x20')](_0x560cc4,0x0,![],null)[_0xcc6a('0x11')](function(){return utils[_0xcc6a('0x21')](_0x560cc4);})[_0xcc6a('0x11')](function(){return _0x11b919(null,_0x560cc4);});}}else{return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}}else{return utils[_0xcc6a('0x20')](_0x560cc4,0x0,![],null)['then'](function(){return utils[_0xcc6a('0x21')](_0x560cc4);})[_0xcc6a('0x11')](function(){return _0x11b919(null,_0x560cc4);})[_0xcc6a('0x22')](function(_0x5f27e5){return _0x11b919(null,![],_0x5f27e5);});}}else{if(_0x560cc4[_0xcc6a('0x16')]){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}else{return utils['getLicense'](_0x560cc4)[_0xcc6a('0x11')](function(){return _0x11b919(null,_0x560cc4);});}}}});})[_0xcc6a('0x22')](function(_0x3233d1){return _0x11b919(null,![],_0x3233d1);});}function sendServiceMail(_0x473f88){return db['MailAccount'][_0xcc6a('0x23')]({'where':{'service':!![]},'attributes':['id',_0xcc6a('0x12'),_0xcc6a('0x24')],'include':[{'model':db['MailServerOut'],'as':_0xcc6a('0x25')}]})['then'](function(_0x4f67d3){if(!_0x4f67d3){throw new Error(_0xcc6a('0x26'));}var _0x2e9f41={'tls':{'rejectUnauthorized':![]}};if(_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x27')]){_0x2e9f41[_0xcc6a('0x27')]=_0x4f67d3[_0xcc6a('0x25')]['service'];}else{_0x2e9f41[_0xcc6a('0x28')]=_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x28')];_0x2e9f41[_0xcc6a('0x29')]=_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x29')];_0x2e9f41[_0xcc6a('0x2a')]=_0x4f67d3[_0xcc6a('0x25')]['secure'];}if(_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x2b')]){_0x2e9f41[_0xcc6a('0x2c')]={'user':_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x18')],'pass':_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x2d')]};}var _0x5afbbc={'account':_0x2e9f41,'message':_[_0xcc6a('0x2e')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x4f67d3['name'],_0x4f67d3[_0xcc6a('0x24')]||_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x18')])},_0x473f88)};return client[_0xcc6a('0x2f')](_0xcc6a('0x30'),_0x5afbbc);})['then'](function(_0x58f6ee){if(_0x58f6ee[_0xcc6a('0x31')]){throw new Error(util[_0xcc6a('0x32')](_0xcc6a('0x33'),_0x58f6ee['error'][_0xcc6a('0x34')]||JSON[_0xcc6a('0x35')](_0x58f6ee[_0xcc6a('0x31')])));}return!![];});}function handleError(_0xa326b2,_0x73bf0d,_0x24175b){return _0xa326b2[_0xcc6a('0x36')](_0x73bf0d||0x1f4)[_0xcc6a('0x37')]({'message':_0x24175b?_0x24175b[_0xcc6a('0x34')]||_0x24175b:''});}exports[_0xcc6a('0x38')]=function(_0x5b11c8,_0x2c14ba,_0x15d87f){passport[_0xcc6a('0x1b')](_0xcc6a('0x39'),function(_0x33e8c8,_0x11e5b1,_0x386cbc){var _0x57dafe=_0x33e8c8||_0x386cbc;if(_0x57dafe){return handleError(_0x2c14ba,0x191,_0x57dafe);}if(!_0x11e5b1){return handleError(_0x2c14ba,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1d3e45={'payload':{'id':_0x11e5b1['id'],'role':_0x11e5b1[_0xcc6a('0x14')]},'options':{'expiresIn':0x15180}};return authService[_0xcc6a('0x3a')](_0x1d3e45)[_0xcc6a('0x11')](function(_0x1e628b){_0x2c14ba[_0xcc6a('0x3b')]({'id':_0x11e5b1['id'],'token':_0x1e628b,'statusCall':'','isAlreadyLogged':_0x11e5b1[_0xcc6a('0x3c')]});});}})(_0x5b11c8,_0x2c14ba,_0x15d87f);};exports[_0xcc6a('0x3d')]=function(_0x49b65c,_0x56bc7d,_0x470e3b){if(!_0x49b65c['body']['email']){return handleError(_0x56bc7d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x674e04=rs[_0xcc6a('0x3e')]();_0x49b65c[_0xcc6a('0x3f')][_0xcc6a('0x24')]=_0x49b65c[_0xcc6a('0x3f')]['email'][_0xcc6a('0x40')]()[_0xcc6a('0x41')]();var _0x17e5a0;return db[_0xcc6a('0xd')][_0xcc6a('0xe')]({'where':{'id':0x1},'attributes':[_0xcc6a('0xf'),'blockDuration'],'raw':!![]})[_0xcc6a('0x11')](function(_0xa4d48a){_0x17e5a0=_0xa4d48a;return db[_0xcc6a('0x42')][_0xcc6a('0x23')]({'where':{'email':_0x49b65c['body'][_0xcc6a('0x24')]}});})['then'](function(_0x351529){if(!_0x351529){throw new Error(_0xcc6a('0x43'));}if(_0x351529[_0xcc6a('0x15')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x351529[_0xcc6a('0x16')]){if(moment(_0x351529[_0xcc6a('0x1d')])[_0xcc6a('0x1e')](_0x17e5a0['blockDuration'],'minutes')>moment()){throw new Error(_0xcc6a('0x44'));}else{_0x351529[_0xcc6a('0x16')]=![];_0x351529[_0xcc6a('0x1d')]=null;}}_0x351529[_0xcc6a('0x45')]=_0x674e04;_0x351529[_0xcc6a('0x46')]=Date['now']()+0x36ee80;return _0x351529[_0xcc6a('0x47')]();})[_0xcc6a('0x11')](function(){return sendServiceMail({'to':_0x49b65c['body'][_0xcc6a('0x24')],'subject':_0xcc6a('0x48'),'text':_0xcc6a('0x49')+_0xcc6a('0x4a')+_0xcc6a('0x4b')+_0x49b65c[_0xcc6a('0x4c')]['host']+'/reset/'+_0x674e04+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xcc6a('0x11')](function(){_0x56bc7d[_0xcc6a('0x36')](0xc8)[_0xcc6a('0x37')]({'message':_0xcc6a('0x4d')});})['catch'](function(_0x1c3bb8){return handleError(_0x56bc7d,0x1f4,_0x1c3bb8);});};exports['reset']=function(_0x3aa7dd,_0x4299ca,_0xcfc540){return db[_0xcc6a('0x42')][_0xcc6a('0x23')]({'where':{'resetPasswordToken':_0x3aa7dd[_0xcc6a('0x4e')]['token'],'resetPasswordExpires':{'$gt':Date[_0xcc6a('0x4f')]()}}})[_0xcc6a('0x11')](function(_0x681e75){if(!_0x681e75){throw new Error(_0xcc6a('0x50'));}return db[_0xcc6a('0xd')][_0xcc6a('0xe')]({'attributes':['id',_0xcc6a('0x51'),_0xcc6a('0x52'),_0xcc6a('0x53')]})[_0xcc6a('0x11')](function(_0x486072){if(_0x486072[_0xcc6a('0x51')])authService[_0xcc6a('0x54')](_0x3aa7dd[_0xcc6a('0x3f')][_0xcc6a('0x13')]);if(!_0x486072[_0xcc6a('0x52')]||!_0x681e75[_0xcc6a('0x55')])return _0x681e75;authService['validatePasswordHistory'](_0x3aa7dd['body'][_0xcc6a('0x13')],_0x681e75['previousPasswords'],_0x486072[_0xcc6a('0x53')]);return _0x681e75;})[_0xcc6a('0x11')](function(){_0x681e75[_0xcc6a('0x13')]=_0x3aa7dd[_0xcc6a('0x3f')][_0xcc6a('0x13')];_0x681e75[_0xcc6a('0x45')]=null;_0x681e75[_0xcc6a('0x46')]=null;return _0x681e75[_0xcc6a('0x47')]();});})[_0xcc6a('0x11')](function(){_0x4299ca[_0xcc6a('0x36')](0xc8)[_0xcc6a('0x37')]({'message':'Password\x20reset!'});})[_0xcc6a('0x22')](function(_0x48eed9){return handleError(_0x4299ca,0x1f4,_0x48eed9);});};passport[_0xcc6a('0x56')](new LocalStrategy({'usernameField':_0xcc6a('0x12'),'passwordField':_0xcc6a('0x13')},function(_0x571a0a,_0x446abb,_0x58ff89){return localAuthenticate(db[_0xcc6a('0x42')],_0x571a0a,_0x446abb,_0x58ff89);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index fa8f3fc..d297416 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 _0x0e0d=['/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller','login','post'];(function(_0x1b591b,_0x6d2e2b){var _0x3c24f0=function(_0x265093){while(--_0x265093){_0x1b591b['push'](_0x1b591b['shift']());}};_0x3c24f0(++_0x6d2e2b);}(_0x0e0d,0xdc));var _0xd0e0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0e0d[_0x2641f9];return _0x585741;};'use strict';var express=require(_0xd0e0('0x0'));var router=express[_0xd0e0('0x1')]();var controller=require(_0xd0e0('0x2'));router['post']('/',controller[_0xd0e0('0x3')]);router[_0xd0e0('0x4')](_0xd0e0('0x5'),controller[_0xd0e0('0x6')]);router['post'](_0xd0e0('0x7'),controller[_0xd0e0('0x8')]);module['exports']=router; \ No newline at end of file +var _0x52db=['login','/forgot','forgot','post','/reset/:token','reset','exports','express'];(function(_0x2aaeba,_0x30f142){var _0x1f6ab4=function(_0x1cc2dd){while(--_0x1cc2dd){_0x2aaeba['push'](_0x2aaeba['shift']());}};_0x1f6ab4(++_0x30f142);}(_0x52db,0x7f));var _0xb52d=function(_0x578c1a,_0x3e720f){_0x578c1a=_0x578c1a-0x0;var _0x1cfbac=_0x52db[_0x578c1a];return _0x1cfbac;};'use strict';var express=require(_0xb52d('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0xb52d('0x1')]);router['post'](_0xb52d('0x2'),controller[_0xb52d('0x3')]);router[_0xb52d('0x4')](_0xb52d('0x5'),controller[_0xb52d('0x6')]);module[_0xb52d('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e726102..3484381 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 _0xdcc8=['INTEGER','sequelize','exports','STRING'];(function(_0x2bd9c7,_0x4b96cf){var _0x2328a8=function(_0x37c945){while(--_0x37c945){_0x2bd9c7['push'](_0x2bd9c7['shift']());}};_0x2328a8(++_0x4b96cf);}(_0xdcc8,0x1d9));var _0x8dcc=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xdcc8[_0xcf5436];return _0xc4f5c8;};'use strict';var Sequelize=require(_0x8dcc('0x0'));module[_0x8dcc('0x1')]={'name':{'type':Sequelize[_0x8dcc('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8dcc('0x2')]},'description':{'type':Sequelize[_0x8dcc('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8dcc('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6ce0=['STRING','exports'];(function(_0x3caae9,_0x2c9e39){var _0x115d3d=function(_0x3dbf0b){while(--_0x3dbf0b){_0x3caae9['push'](_0x3caae9['shift']());}};_0x115d3d(++_0x2c9e39);}(_0x6ce0,0x11f));var _0x06ce=function(_0x4dddcc,_0x5dae19){_0x4dddcc=_0x4dddcc-0x0;var _0x2e9da1=_0x6ce0[_0x4dddcc];return _0x2e9da1;};'use strict';var Sequelize=require('sequelize');module[_0x06ce('0x0')]={'name':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x06ce('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 c23e9fc..2cbc969 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(_0x40beba,_0x2917e2){var _0x3ababf=function(_0x29fbb7){while(--_0x29fbb7){_0x40beba['push'](_0x40beba['shift']());}};_0x3ababf(++_0x2917e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x4ab93b,_0x1b05bb){var _0x2b4bdd=function(_0x2be77e){while(--_0x2be77e){_0x4ab93b['push'](_0x4ab93b['shift']());}};_0x2b4bdd(++_0x1b05bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 65cac62..caddb59 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 _0x3077=['lodash','../../config/logger','moment','request-promise','path','rimraf','define','Automation','tools_automations'];(function(_0x133407,_0x25d043){var _0x1d9232=function(_0x360dd8){while(--_0x360dd8){_0x133407['push'](_0x133407['shift']());}};_0x1d9232(++_0x25d043);}(_0x3077,0x144));var _0x7307=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x3077[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x7307('0x0'));var util=require('util');var logger=require(_0x7307('0x1'))('api');var moment=require(_0x7307('0x2'));var BPromise=require('bluebird');var rp=require(_0x7307('0x3'));var fs=require('fs');var path=require(_0x7307('0x4'));var rimraf=require(_0x7307('0x5'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module['exports']=function(_0x483a8c,_0x502b12){return _0x483a8c[_0x7307('0x6')](_0x7307('0x7'),attributes,{'tableName':_0x7307('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8897=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','lodash','util'];(function(_0x593cfd,_0x45c866){var _0x213361=function(_0x2ee548){while(--_0x2ee548){_0x593cfd['push'](_0x593cfd['shift']());}};_0x213361(++_0x45c866);}(_0x8897,0x132));var _0x7889=function(_0x1ebef9,_0x282e7a){_0x1ebef9=_0x1ebef9-0x0;var _0x18b656=_0x8897[_0x1ebef9];return _0x18b656;};'use strict';var _=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var logger=require(_0x7889('0x2'))(_0x7889('0x3'));var moment=require(_0x7889('0x4'));var BPromise=require(_0x7889('0x5'));var rp=require(_0x7889('0x6'));var fs=require('fs');var path=require(_0x7889('0x7'));var rimraf=require(_0x7889('0x8'));var config=require(_0x7889('0x9'));var attributes=require(_0x7889('0xa'));module[_0x7889('0xb')]=function(_0x3c30d7,_0x840398){return _0x3c30d7[_0x7889('0xc')](_0x7889('0xd'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index ce3e0c2..2ec30a6 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 _0x16e8=['message','catch','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5232c4,_0x27a478){var _0x408bc9=function(_0x321f2d){while(--_0x321f2d){_0x5232c4['push'](_0x5232c4['shift']());}};_0x408bc9(++_0x27a478);}(_0x16e8,0x1ab));var _0x816e=function(_0x242278,_0x140d7f){_0x242278=_0x242278-0x0;var _0x557d3a=_0x16e8[_0x242278];return _0x557d3a;};'use strict';var _=require(_0x816e('0x0'));var util=require('util');var moment=require(_0x816e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x816e('0x2'));var logger=require(_0x816e('0x3'))(_0x816e('0x4'));var config=require(_0x816e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x816e('0x6')][_0x816e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c8165,_0x50e42f,_0x41c0dd){return new BPromise(function(_0x434d43,_0x120093){return client[_0x816e('0x8')](_0x5c8165,_0x41c0dd)['then'](function(_0x29bd05){logger[_0x816e('0x9')](_0x816e('0xa'),_0x50e42f,_0x816e('0xb'));logger['debug'](_0x816e('0xc'),_0x50e42f,_0x816e('0xb'),JSON['stringify'](_0x29bd05));if(_0x29bd05[_0x816e('0xd')]){if(_0x29bd05[_0x816e('0xd')][_0x816e('0xe')]===0x1f4){logger[_0x816e('0xd')](_0x816e('0xa'),_0x50e42f,_0x29bd05['error'][_0x816e('0xf')]);return _0x120093(_0x29bd05[_0x816e('0xd')][_0x816e('0xf')]);}logger[_0x816e('0xd')](_0x816e('0xa'),_0x50e42f,_0x29bd05[_0x816e('0xd')][_0x816e('0xf')]);return _0x434d43(_0x29bd05[_0x816e('0xd')][_0x816e('0xf')]);}else{logger[_0x816e('0x9')]('Automation,\x20%s,\x20%s',_0x50e42f,'request\x20sent');_0x434d43(_0x29bd05['result']['message']);}})[_0x816e('0x10')](function(_0x5a38ea){logger['error']('Automation,\x20%s,\x20%s',_0x50e42f,_0x5a38ea);_0x120093(_0x5a38ea);});});} \ No newline at end of file +var _0xd8bb=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x32e7d6,_0x682bc5){var _0x5427cf=function(_0x365c2d){while(--_0x365c2d){_0x32e7d6['push'](_0x32e7d6['shift']());}};_0x5427cf(++_0x682bc5);}(_0xd8bb,0x113));var _0xbd8b=function(_0x6ac921,_0x30f1d8){_0x6ac921=_0x6ac921-0x0;var _0x41f8aa=_0xd8bb[_0x6ac921];return _0x41f8aa;};'use strict';var _=require('lodash');var util=require(_0xbd8b('0x0'));var moment=require(_0xbd8b('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd8b('0x2'));var fs=require('fs');var Redis=require(_0xbd8b('0x3'));var db=require(_0xbd8b('0x4'))['db'];var utils=require(_0xbd8b('0x5'));var logger=require(_0xbd8b('0x6'))(_0xbd8b('0x7'));var config=require('../../config/environment');var jayson=require(_0xbd8b('0x8'));var client=jayson['client'][_0xbd8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16fea5,_0x4a3ed2,_0x1007c9){return new BPromise(function(_0x5beacb,_0x13d55d){return client[_0xbd8b('0xa')](_0x16fea5,_0x1007c9)[_0xbd8b('0xb')](function(_0x1b1359){logger[_0xbd8b('0xc')]('Automation,\x20%s,\x20%s',_0x4a3ed2,_0xbd8b('0xd'));logger['debug'](_0xbd8b('0xe'),_0x4a3ed2,'request\x20sent',JSON['stringify'](_0x1b1359));if(_0x1b1359[_0xbd8b('0xf')]){if(_0x1b1359['error']['code']===0x1f4){logger[_0xbd8b('0xf')](_0xbd8b('0x10'),_0x4a3ed2,_0x1b1359['error']['message']);return _0x13d55d(_0x1b1359['error'][_0xbd8b('0x11')]);}logger[_0xbd8b('0xf')](_0xbd8b('0x10'),_0x4a3ed2,_0x1b1359[_0xbd8b('0xf')]['message']);return _0x5beacb(_0x1b1359['error']['message']);}else{logger[_0xbd8b('0xc')](_0xbd8b('0x10'),_0x4a3ed2,_0xbd8b('0xd'));_0x5beacb(_0x1b1359[_0xbd8b('0x12')][_0xbd8b('0x11')]);}})[_0xbd8b('0x13')](function(_0xf50b73){logger[_0xbd8b('0xf')]('Automation,\x20%s,\x20%s',_0x4a3ed2,_0xf50b73);_0x13d55d(_0xf50b73);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 7d3df8c..67050a9 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 _0x6b74=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x40967b,_0x192c3b){var _0xea18da=function(_0x387f4f){while(--_0x387f4f){_0x40967b['push'](_0x40967b['shift']());}};_0xea18da(++_0x192c3b);}(_0x6b74,0xcc));var _0x46b7=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x6b74[_0x144b30];return _0x1bb7bc;};'use strict';var multer=require(_0x46b7('0x0'));var util=require(_0x46b7('0x1'));var path=require('path');var timeout=require(_0x46b7('0x2'));var express=require(_0x46b7('0x3'));var router=express['Router']();var auth=require(_0x46b7('0x4'));var interaction=require(_0x46b7('0x5'));var config=require(_0x46b7('0x6'));var controller=require('./automation.controller');router['get']('/',auth[_0x46b7('0x7')](),controller[_0x46b7('0x8')]);router['get'](_0x46b7('0x9'),auth[_0x46b7('0x7')](),controller['show']);router[_0x46b7('0xa')](_0x46b7('0xb'),auth[_0x46b7('0x7')](),controller[_0x46b7('0xc')]);router['get'](_0x46b7('0xd'),auth[_0x46b7('0x7')](),controller[_0x46b7('0xe')]);router[_0x46b7('0xf')]('/',auth[_0x46b7('0x7')](),controller[_0x46b7('0x10')]);router[_0x46b7('0xf')](_0x46b7('0xb'),auth[_0x46b7('0x7')](),controller[_0x46b7('0x11')]);router['post'](_0x46b7('0xd'),auth[_0x46b7('0x7')](),controller[_0x46b7('0x12')]);router[_0x46b7('0x13')](_0x46b7('0x9'),auth['isAuthenticated'](),controller[_0x46b7('0x14')]);router['delete'](_0x46b7('0x9'),auth[_0x46b7('0x7')](),controller[_0x46b7('0x15')]);module[_0x46b7('0x16')]=router; \ No newline at end of file +var _0x8e3f=['./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var path=require(_0xf8e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8e3('0x3'));var router=express[_0xf8e3('0x4')]();var auth=require(_0xf8e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e3('0x6'));var controller=require(_0xf8e3('0x7'));router['get']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x9')]);router[_0xf8e3('0xa')](_0xf8e3('0xb'),auth['isAuthenticated'](),controller[_0xf8e3('0xc')]);router[_0xf8e3('0xa')](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0xe')]);router[_0xf8e3('0xa')](_0xf8e3('0xf'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x10')]);router[_0xf8e3('0x11')]('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x12')]);router['post'](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x13')]);router['post'](_0xf8e3('0xf'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x14')]);router[_0xf8e3('0x15')]('/:id',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x16')]);router[_0xf8e3('0x17')]('/:id',auth[_0xf8e3('0x8')](),controller['destroy']);module[_0xf8e3('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7ce1957..3118da7 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 _0x608c=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\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','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC'];(function(_0x347dbe,_0x4d8899){var _0x29c81e=function(_0x168e05){while(--_0x168e05){_0x347dbe['push'](_0x347dbe['shift']());}};_0x29c81e(++_0x4d8899);}(_0x608c,0x185));var _0xc608=function(_0x53d55c,_0x2e3d2b){_0x53d55c=_0x53d55c-0x0;var _0x35b1ed=_0x608c[_0x53d55c];return _0x35b1ed;};'use strict';var Sequelize=require(_0xc608('0x0'));module[_0xc608('0x1')]={'name':{'type':Sequelize[_0xc608('0x2')],'unique':_0xc608('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc608('0x4')](_0xc608('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xc608('0x2')]},'active':{'type':Sequelize[_0xc608('0x6')],'defaultValue':0x0,'comment':_0xc608('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xc608('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc608('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc608('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc608('0xa')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc608('0x2')],'defaultValue':_0xc608('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xc608('0x4')](_0xc608('0xf'),_0xc608('0x10'),_0xc608('0x11')),'defaultValue':_0xc608('0xf')},'dialAMDActive':{'type':Sequelize[_0xc608('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc608('0xa')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc608('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc608('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc608('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc608('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc608('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc608('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc608('0xa')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc608('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc608('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc608('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc608('0x1b'),_0xc608('0x1c')),'defaultValue':_0xc608('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc608('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc608('0x1d')},'dialCutDigit':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc608('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0x25')}}; \ No newline at end of file +var _0xae1e=['onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','never'];(function(_0x1aba9c,_0x465976){var _0x414891=function(_0x179f91){while(--_0x179f91){_0x1aba9c['push'](_0x1aba9c['shift']());}};_0x414891(++_0x465976);}(_0xae1e,0x133));var _0xeae1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xae1e[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xeae1('0x0'));module[_0xeae1('0x1')]={'name':{'type':Sequelize[_0xeae1('0x2')],'unique':_0xeae1('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xeae1('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xeae1('0x2')]},'active':{'type':Sequelize[_0xeae1('0x5')],'defaultValue':0x0,'comment':_0xeae1('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xeae1('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xeae1('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae1('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae1('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae1('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xeae1('0x7')](0x5)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x3,'comment':_0xeae1('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae1('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xeae1('0xe')},'dialTimezone':{'type':Sequelize[_0xeae1('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xeae1('0xf')]('always',_0xeae1('0x10'),_0xeae1('0x11')),'defaultValue':_0xeae1('0x12')},'dialAMDActive':{'type':Sequelize[_0xeae1('0x5')],'defaultValue':0x0,'comment':_0xeae1('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xeae1('0x7')](0x9)[_0xeae1('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xeae1('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xeae1('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xeae1('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xeae1('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xeae1('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xeae1('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xeae1('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xeae1('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xeae1('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xeae1('0x7')](0x9)[_0xeae1('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xeae1('0x7')](0x5)[_0xeae1('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xeae1('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xeae1('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xeae1('0xf')](_0xeae1('0x1a'),_0xeae1('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xeae1('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xeae1('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xeae1('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xeae1('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xeae1('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xeae1('0x7')](0x5)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae1('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xeae1('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae1('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xeae1('0x7')](0x5)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae1('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xeae1('0x7')](0x3)[_0xeae1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae1('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xeae1('0x7')](0x5)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae1('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae1('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xeae1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 76002c1..f90e8be 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(_0x2271e7,_0x6f9edb){var _0xe67a83=function(_0x367b2e){while(--_0x367b2e){_0x2271e7['push'](_0x2271e7['shift']());}};_0xe67a83(++_0x6f9edb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x51a209,_0x3010c7){var _0x2cc97e=function(_0xf0a29f){while(--_0xf0a29f){_0x51a209['push'](_0x51a209['shift']());}};_0x2cc97e(++_0x3010c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 3754d93..a8d997b 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 _0x3175=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns'];(function(_0xd6dabc,_0x28d763){var _0x5eb6fa=function(_0x32d109){while(--_0x32d109){_0xd6dabc['push'](_0xd6dabc['shift']());}};_0x5eb6fa(++_0x28d763);}(_0x3175,0x18c));var _0x5317=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x3175[_0x15e6fe];return _0x34894d;};'use strict';var _=require(_0x5317('0x0'));var util=require(_0x5317('0x1'));var logger=require(_0x5317('0x2'))(_0x5317('0x3'));var moment=require('moment');var BPromise=require(_0x5317('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5317('0x5'));var config=require(_0x5317('0x6'));var attributes=require(_0x5317('0x7'));module[_0x5317('0x8')]=function(_0x104c63,_0x52c257){return _0x104c63[_0x5317('0x9')](_0x5317('0xa'),attributes,{'tableName':_0x5317('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20b5=['rimraf','../../config/environment','./campaign.attributes','define','Campaign','lodash','api','moment','path'];(function(_0x107844,_0x41926f){var _0x40c2b5=function(_0x2d0c58){while(--_0x2d0c58){_0x107844['push'](_0x107844['shift']());}};_0x40c2b5(++_0x41926f);}(_0x20b5,0x83));var _0x520b=function(_0x421446,_0x19af26){_0x421446=_0x421446-0x0;var _0x40e2a6=_0x20b5[_0x421446];return _0x40e2a6;};'use strict';var _=require(_0x520b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x520b('0x1'));var moment=require(_0x520b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x520b('0x3'));var rimraf=require(_0x520b('0x4'));var config=require(_0x520b('0x5'));var attributes=require(_0x520b('0x6'));module['exports']=function(_0x170294,_0x26e3a0){return _0x170294[_0x520b('0x7')](_0x520b('0x8'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 29eac00..d10c1d7 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x38ddb2,_0x1141e1){var _0x22ee32=function(_0x4f48d7){while(--_0x4f48d7){_0x38ddb2['push'](_0x38ddb2['shift']());}};_0x22ee32(++_0x1141e1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1f36a0,_0x43d338){var _0xe00103=function(_0x2f6ff8){while(--_0x2f6ff8){_0x1f36a0['push'](_0x1f36a0['shift']());}};_0xe00103(++_0x43d338);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index fa8d27d..2ae53b3 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 _0x07ea=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','addLists','addBlackLists','put','update','destroy','delete','removeBlackLists','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','getHoppers','get','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x151d4a,_0xbc53e7){var _0xce4d46=function(_0x2c444b){while(--_0x2c444b){_0x151d4a['push'](_0x151d4a['shift']());}};_0xce4d46(++_0xbc53e7);}(_0x07ea,0x177));var _0xa07e=function(_0x3d0dc2,_0x5b3ee4){_0x3d0dc2=_0x3d0dc2-0x0;var _0x2b9e29=_0x07ea[_0x3d0dc2];return _0x2b9e29;};'use strict';var multer=require(_0xa07e('0x0'));var util=require(_0xa07e('0x1'));var path=require(_0xa07e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa07e('0x3')]();var auth=require(_0xa07e('0x4'));var interaction=require(_0xa07e('0x5'));var config=require(_0xa07e('0x6'));var controller=require('./campaign.controller');router['get']('/',auth[_0xa07e('0x7')](),controller[_0xa07e('0x8')]);router['get'](_0xa07e('0x9'),auth[_0xa07e('0x7')](),controller['show']);router['get']('/:id/hoppers',auth[_0xa07e('0x7')](),controller[_0xa07e('0xa')]);router[_0xa07e('0xb')](_0xa07e('0xc'),auth[_0xa07e('0x7')](),controller[_0xa07e('0xd')]);router[_0xa07e('0xb')](_0xa07e('0xe'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xa07e('0xb')](_0xa07e('0xf'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x10')]);router[_0xa07e('0xb')](_0xa07e('0x11'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x12')]);router[_0xa07e('0xb')](_0xa07e('0x13'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x14')]);router[_0xa07e('0x15')]('/',auth[_0xa07e('0x7')](),controller[_0xa07e('0x16')]);router[_0xa07e('0x15')]('/:id/clone',auth[_0xa07e('0x7')](),controller['clone']);router[_0xa07e('0x15')](_0xa07e('0x11'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x17')]);router[_0xa07e('0x15')](_0xa07e('0x13'),auth['isAuthenticated'](),controller[_0xa07e('0x18')]);router[_0xa07e('0x19')](_0xa07e('0x9'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x1a')]);router['delete'](_0xa07e('0x9'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x1b')]);router[_0xa07e('0x1c')](_0xa07e('0x11'),auth[_0xa07e('0x7')](),controller['removeLists']);router[_0xa07e('0x1c')]('/:id/blacklists',auth[_0xa07e('0x7')](),controller[_0xa07e('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x875a=['update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x875a,0xaf));var _0xa875=function(_0x325c29,_0x583209){_0x325c29=_0x325c29-0x0;var _0x5421eb=_0x875a[_0x325c29];return _0x5421eb;};'use strict';var multer=require(_0xa875('0x0'));var util=require(_0xa875('0x1'));var path=require(_0xa875('0x2'));var timeout=require(_0xa875('0x3'));var express=require(_0xa875('0x4'));var router=express['Router']();var auth=require(_0xa875('0x5'));var interaction=require(_0xa875('0x6'));var config=require('../../config/environment');var controller=require(_0xa875('0x7'));router['get']('/',auth[_0xa875('0x8')](),controller[_0xa875('0x9')]);router[_0xa875('0xa')](_0xa875('0xb'),auth[_0xa875('0x8')](),controller[_0xa875('0xc')]);router[_0xa875('0xa')]('/:id/hoppers',auth[_0xa875('0x8')](),controller[_0xa875('0xd')]);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xa875('0xe')]);router[_0xa875('0xa')](_0xa875('0xf'),auth[_0xa875('0x8')](),controller[_0xa875('0x10')]);router[_0xa875('0xa')](_0xa875('0x11'),auth[_0xa875('0x8')](),controller[_0xa875('0x12')]);router[_0xa875('0xa')](_0xa875('0x13'),auth[_0xa875('0x8')](),controller[_0xa875('0x14')]);router[_0xa875('0xa')](_0xa875('0x15'),auth['isAuthenticated'](),controller[_0xa875('0x16')]);router['post']('/',auth[_0xa875('0x8')](),controller[_0xa875('0x17')]);router[_0xa875('0x18')](_0xa875('0x19'),auth[_0xa875('0x8')](),controller[_0xa875('0x1a')]);router[_0xa875('0x18')](_0xa875('0x13'),auth['isAuthenticated'](),controller[_0xa875('0x1b')]);router[_0xa875('0x18')](_0xa875('0x15'),auth[_0xa875('0x8')](),controller[_0xa875('0x1c')]);router['put'](_0xa875('0xb'),auth[_0xa875('0x8')](),controller[_0xa875('0x1d')]);router[_0xa875('0x1e')](_0xa875('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xa875('0x1e')](_0xa875('0x13'),auth[_0xa875('0x8')](),controller[_0xa875('0x1f')]);router['delete']('/:id/blacklists',auth[_0xa875('0x8')](),controller[_0xa875('0x20')]);module[_0xa875('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 9996791..be70362 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 _0xf95e=['sequelize','exports','TEXT','STRING','VIRTUAL','key'];(function(_0x2c469a,_0x59bf69){var _0x5efb79=function(_0x1d0a87){while(--_0x1d0a87){_0x2c469a['push'](_0x2c469a['shift']());}};_0x5efb79(++_0x59bf69);}(_0xf95e,0x10e));var _0xef95=function(_0x2fa095,_0x5bed1a){_0x2fa095=_0x2fa095-0x0;var _0x34b3de=_0xf95e[_0x2fa095];return _0x34b3de;};'use strict';var Sequelize=require(_0xef95('0x0'));module[_0xef95('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xef95('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xef95('0x3')]},'name':{'type':Sequelize[_0xef95('0x4')],'get':function(){return this['getDataValue'](_0xef95('0x5'));}}}; \ No newline at end of file +var _0x4408=['sequelize','exports','STRING','VIRTUAL','getDataValue','key'];(function(_0x11c716,_0x52d5e6){var _0x11fbb1=function(_0x188a3d){while(--_0x188a3d){_0x11c716['push'](_0x11c716['shift']());}};_0x11fbb1(++_0x52d5e6);}(_0x4408,0x132));var _0x8440=function(_0x971169,_0x496307){_0x971169=_0x971169-0x0;var _0x292fd5=_0x4408[_0x971169];return _0x292fd5;};'use strict';var Sequelize=require(_0x8440('0x0'));module[_0x8440('0x1')]={'key':{'type':Sequelize[_0x8440('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x8440('0x3')],'get':function(){return this[_0x8440('0x4')](_0x8440('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2547f96..2ecab13 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(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 5817642..d1a2d10 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 _0x67ae=['path','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67ae,0xbe));var _0xe67a=function(_0x1df107,_0x46509d){_0x1df107=_0x1df107-0x0;var _0x1cebc2=_0x67ae[_0x1df107];return _0x1cebc2;};'use strict';var _=require('lodash');var util=require(_0xe67a('0x0'));var logger=require(_0xe67a('0x1'))(_0xe67a('0x2'));var moment=require(_0xe67a('0x3'));var BPromise=require(_0xe67a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe67a('0x5'));var rimraf=require('rimraf');var config=require(_0xe67a('0x6'));var attributes=require(_0xe67a('0x7'));module[_0xe67a('0x8')]=function(_0x34d397,_0x4554c6){return _0x34d397[_0xe67a('0x9')]('CannedAnswer',attributes,{'tableName':_0xe67a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe67a('0xb'),'collate':_0xe67a('0xc')});}; \ No newline at end of file +var _0x4517=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x59b9ea,_0x549a84){var _0x8ef4c7=function(_0x47b5b2){while(--_0x47b5b2){_0x59b9ea['push'](_0x59b9ea['shift']());}};_0x8ef4c7(++_0x549a84);}(_0x4517,0x112));var _0x7451=function(_0x2a4022,_0x5c4446){_0x2a4022=_0x2a4022-0x0;var _0xf5da64=_0x4517[_0x2a4022];return _0xf5da64;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var logger=require(_0x7451('0x1'))('api');var moment=require(_0x7451('0x2'));var BPromise=require(_0x7451('0x3'));var rp=require(_0x7451('0x4'));var fs=require('fs');var path=require(_0x7451('0x5'));var rimraf=require(_0x7451('0x6'));var config=require(_0x7451('0x7'));var attributes=require(_0x7451('0x8'));module[_0x7451('0x9')]=function(_0x451332,_0x3489f9){return _0x451332[_0x7451('0xa')](_0x7451('0xb'),attributes,{'tableName':_0x7451('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7451('0xd'),'collate':_0x7451('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 8907312..5c74bb1 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 _0xc4bd=['info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4bd,0x15a));var _0xdc4b=function(_0xf0e4e4,_0x1b8e97){_0xf0e4e4=_0xf0e4e4-0x0;var _0x283a0d=_0xc4bd[_0xf0e4e4];return _0x283a0d;};'use strict';var _=require(_0xdc4b('0x0'));var util=require(_0xdc4b('0x1'));var moment=require(_0xdc4b('0x2'));var BPromise=require(_0xdc4b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc4b('0x4'));var db=require(_0xdc4b('0x5'))['db'];var utils=require(_0xdc4b('0x6'));var logger=require(_0xdc4b('0x7'))(_0xdc4b('0x8'));var config=require(_0xdc4b('0x9'));var jayson=require(_0xdc4b('0xa'));var client=jayson[_0xdc4b('0xb')][_0xdc4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31a749,_0x173dde,_0x15bff2){return new BPromise(function(_0x4e6da2,_0x488096){return client[_0xdc4b('0xd')](_0x31a749,_0x15bff2)['then'](function(_0x31f3a2){logger[_0xdc4b('0xe')](_0xdc4b('0xf'),_0x173dde,'request\x20sent');logger[_0xdc4b('0x10')](_0xdc4b('0x11'),_0x173dde,_0xdc4b('0x12'),JSON[_0xdc4b('0x13')](_0x31f3a2));if(_0x31f3a2[_0xdc4b('0x14')]){if(_0x31f3a2[_0xdc4b('0x14')]['code']===0x1f4){logger[_0xdc4b('0x14')](_0xdc4b('0xf'),_0x173dde,_0x31f3a2[_0xdc4b('0x14')]['message']);return _0x488096(_0x31f3a2[_0xdc4b('0x14')][_0xdc4b('0x15')]);}logger[_0xdc4b('0x14')](_0xdc4b('0xf'),_0x173dde,_0x31f3a2['error'][_0xdc4b('0x15')]);return _0x4e6da2(_0x31f3a2[_0xdc4b('0x14')]['message']);}else{logger[_0xdc4b('0xe')](_0xdc4b('0xf'),_0x173dde,'request\x20sent');_0x4e6da2(_0x31f3a2[_0xdc4b('0x16')][_0xdc4b('0x15')]);}})[_0xdc4b('0x17')](function(_0x3a66d4){logger[_0xdc4b('0x14')](_0xdc4b('0xf'),_0x173dde,_0x3a66d4);_0x488096(_0x3a66d4);});});} \ No newline at end of file +var _0x3071=['stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s'];(function(_0x33a4bf,_0x4bc8ec){var _0xbfcfd3=function(_0x5f0f62){while(--_0x5f0f62){_0x33a4bf['push'](_0x33a4bf['shift']());}};_0xbfcfd3(++_0x4bc8ec);}(_0x3071,0x1b5));var _0x1307=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x3071[_0x31ced5];return _0x10d9e5;};'use strict';var _=require('lodash');var util=require(_0x1307('0x0'));var moment=require('moment');var BPromise=require(_0x1307('0x1'));var rs=require(_0x1307('0x2'));var fs=require('fs');var Redis=require(_0x1307('0x3'));var db=require(_0x1307('0x4'))['db'];var utils=require(_0x1307('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1307('0x6'));var client=jayson[_0x1307('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2efe1b,_0x49e9ef,_0x35b806){return new BPromise(function(_0xa975e9,_0x38e03f){return client['request'](_0x2efe1b,_0x35b806)[_0x1307('0x8')](function(_0x3e26fb){logger[_0x1307('0x9')](_0x1307('0xa'),_0x49e9ef,_0x1307('0xb'));logger['debug'](_0x1307('0xc'),_0x49e9ef,_0x1307('0xb'),JSON[_0x1307('0xd')](_0x3e26fb));if(_0x3e26fb['error']){if(_0x3e26fb[_0x1307('0xe')][_0x1307('0xf')]===0x1f4){logger[_0x1307('0xe')](_0x1307('0xa'),_0x49e9ef,_0x3e26fb[_0x1307('0xe')][_0x1307('0x10')]);return _0x38e03f(_0x3e26fb[_0x1307('0xe')][_0x1307('0x10')]);}logger['error'](_0x1307('0xa'),_0x49e9ef,_0x3e26fb[_0x1307('0xe')][_0x1307('0x10')]);return _0xa975e9(_0x3e26fb['error']['message']);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x49e9ef,_0x1307('0xb'));_0xa975e9(_0x3e26fb[_0x1307('0x11')]['message']);}})['catch'](function(_0x17bc62){logger['error'](_0x1307('0xa'),_0x49e9ef,_0x17bc62);_0x38e03f(_0x17bc62);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 6a09efe..b953266 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 _0x93a0=['destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x7712a,_0x554787){var _0x4d815a=function(_0x2d8844){while(--_0x2d8844){_0x7712a['push'](_0x7712a['shift']());}};_0x4d815a(++_0x554787);}(_0x93a0,0x1f2));var _0x093a=function(_0x4e43ab,_0x148206){_0x4e43ab=_0x4e43ab-0x0;var _0x8a4a51=_0x93a0[_0x4e43ab];return _0x8a4a51;};'use strict';var multer=require(_0x093a('0x0'));var util=require(_0x093a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x093a('0x2'));var router=express['Router']();var auth=require(_0x093a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x093a('0x4'));var controller=require('./cannedAnswer.controller');router[_0x093a('0x5')]('/',auth[_0x093a('0x6')](),controller[_0x093a('0x7')]);router[_0x093a('0x5')]('/:id',auth[_0x093a('0x6')](),controller[_0x093a('0x8')]);router[_0x093a('0x9')]('/',auth[_0x093a('0x6')](),controller[_0x093a('0xa')]);router[_0x093a('0xb')](_0x093a('0xc'),auth['isAuthenticated'](),controller[_0x093a('0xd')]);router['delete'](_0x093a('0xc'),auth[_0x093a('0x6')](),controller[_0x093a('0xe')]);module[_0x093a('0xf')]=router; \ No newline at end of file +var _0xff76=['index','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xff76,0x125));var _0x6ff7=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xff76[_0x411add];return _0x238242;};'use strict';var multer=require('multer');var util=require(_0x6ff7('0x0'));var path=require(_0x6ff7('0x1'));var timeout=require(_0x6ff7('0x2'));var express=require(_0x6ff7('0x3'));var router=express[_0x6ff7('0x4')]();var auth=require(_0x6ff7('0x5'));var interaction=require(_0x6ff7('0x6'));var config=require(_0x6ff7('0x7'));var controller=require(_0x6ff7('0x8'));router[_0x6ff7('0x9')]('/',auth[_0x6ff7('0xa')](),controller[_0x6ff7('0xb')]);router[_0x6ff7('0x9')](_0x6ff7('0xc'),auth[_0x6ff7('0xa')](),controller[_0x6ff7('0xd')]);router['post']('/',auth[_0x6ff7('0xa')](),controller[_0x6ff7('0xe')]);router[_0x6ff7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6ff7('0x10')]);router[_0x6ff7('0x11')](_0x6ff7('0xc'),auth[_0x6ff7('0xa')](),controller[_0x6ff7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f8da6af..2db0376 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 _0x0a05=['INTEGER','exports','DATE','STRING'];(function(_0xbc835a,_0x4f2231){var _0xc708b6=function(_0x5ac732){while(--_0x5ac732){_0xbc835a['push'](_0xbc835a['shift']());}};_0xc708b6(++_0x4f2231);}(_0x0a05,0x125));var _0x50a0=function(_0x219cc1,_0x3d03b5){_0x219cc1=_0x219cc1-0x0;var _0x177034=_0x0a05[_0x219cc1];return _0x177034;};'use strict';var Sequelize=require('sequelize');module[_0x50a0('0x0')]={'calldate':{'type':Sequelize[_0x50a0('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x50a0('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x50a0('0x2')]},'dcontext':{'type':Sequelize[_0x50a0('0x2')]},'channel':{'type':Sequelize[_0x50a0('0x2')]},'dstchannel':{'type':Sequelize[_0x50a0('0x2')]},'lastapp':{'type':Sequelize[_0x50a0('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x50a0('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x50a0('0x2')]},'amaflags':{'type':Sequelize[_0x50a0('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x50a0('0x2')]},'uniqueid':{'type':Sequelize[_0x50a0('0x2')]},'linkedid':{'type':Sequelize[_0x50a0('0x2')]},'sequence':{'type':Sequelize[_0x50a0('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x50a0('0x2')]},'tag':{'type':Sequelize[_0x50a0('0x2')]}}; \ No newline at end of file +var _0xb138=['STRING','INTEGER','sequelize','DATE'];(function(_0x527dfc,_0x821843){var _0x578b9f=function(_0x15538d){while(--_0x15538d){_0x527dfc['push'](_0x527dfc['shift']());}};_0x578b9f(++_0x821843);}(_0xb138,0x1f2));var _0x8b13=function(_0xe4ca7f,_0x100702){_0xe4ca7f=_0xe4ca7f-0x0;var _0x47a0e7=_0xb138[_0xe4ca7f];return _0x47a0e7;};'use strict';var Sequelize=require(_0x8b13('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x8b13('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x8b13('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8b13('0x2')]},'dcontext':{'type':Sequelize[_0x8b13('0x2')]},'channel':{'type':Sequelize[_0x8b13('0x2')]},'dstchannel':{'type':Sequelize[_0x8b13('0x2')]},'lastapp':{'type':Sequelize[_0x8b13('0x2')]},'lastdata':{'type':Sequelize[_0x8b13('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8b13('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8b13('0x2')]},'amaflags':{'type':Sequelize[_0x8b13('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'userfield':{'type':Sequelize[_0x8b13('0x2')]},'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'linkedid':{'type':Sequelize[_0x8b13('0x2')]},'sequence':{'type':Sequelize[_0x8b13('0x2')]},'peeraccount':{'type':Sequelize[_0x8b13('0x2')]},'type':{'type':Sequelize[_0x8b13('0x2')]},'tag':{'type':Sequelize[_0x8b13('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 70970d8..a12e8e3 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 _0x1bd1=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1372d6,_0x1d5b02){var _0x23e4fc=function(_0x483bd3){while(--_0x483bd3){_0x1372d6['push'](_0x1372d6['shift']());}};_0x23e4fc(++_0x1d5b02);}(_0x1bd1,0x149));var _0x11bd=function(_0xff6e4,_0x3d82fb){_0xff6e4=_0xff6e4-0x0;var _0x3ada16=_0x1bd1[_0xff6e4];return _0x3ada16;};'use strict';var pdf=require(_0x11bd('0x0'));var emlformat=require(_0x11bd('0x1'));var rimraf=require(_0x11bd('0x2'));var zipdir=require(_0x11bd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11bd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x11bd('0x5'));var util=require(_0x11bd('0x6'));var path=require(_0x11bd('0x7'));var sox=require(_0x11bd('0x8'));var csv=require(_0x11bd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11bd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11bd('0xb'));var toCsv=require(_0x11bd('0x9'));var querystring=require(_0x11bd('0xc'));var Papa=require('papaparse');var Redis=require(_0x11bd('0xd'));var authService=require(_0x11bd('0xe'));var qs=require(_0x11bd('0xf'));var as=require(_0x11bd('0x10'));var hardwareService=require(_0x11bd('0x11'));var logger=require(_0x11bd('0x12'))(_0x11bd('0x13'));var utils=require('../../config/utils');var config=require(_0x11bd('0x14'));var licenseUtil=require(_0x11bd('0x15'));var db=require(_0x11bd('0x16'))['db'];function respondWithStatusCode(_0x2822ae,_0x1c2cae){_0x1c2cae=_0x1c2cae||0xcc;return function(_0x4675cb){if(_0x4675cb){return _0x2822ae[_0x11bd('0x17')](_0x1c2cae);}return _0x2822ae['status'](_0x1c2cae)[_0x11bd('0x18')]();};}function respondWithResult(_0x458c8a,_0x787ba1){_0x787ba1=_0x787ba1||0xc8;return function(_0x42a703){if(_0x42a703){return _0x458c8a[_0x11bd('0x19')](_0x787ba1)[_0x11bd('0x1a')](_0x42a703);}};}function respondWithFilteredResult(_0x48b342,_0x1e9483){return function(_0x229def){if(_0x229def){var _0x130fb6=_0x229def['count'],_0x330b9b=_0x1e9483[_0x11bd('0x1b')],_0xd0ed1e=_0x1e9483['offset']+_0x1e9483[_0x11bd('0x1c')],_0x4ace12;if(_0xd0ed1e>=_0x130fb6){_0xd0ed1e=_0x130fb6;_0x4ace12=0xc8;}else{_0x4ace12=0xce;}_0x48b342['status'](_0x4ace12);return _0x48b342[_0x11bd('0x1d')](_0x11bd('0x1e'),_0x330b9b+'-'+_0xd0ed1e+'/'+_0x130fb6)['json'](_0x229def);}return null;};}function patchUpdates(_0x28c0dc){return function(_0x3b9a63){try{jsonpatch['apply'](_0x3b9a63,_0x28c0dc,!![]);}catch(_0x250ac9){return BPromise[_0x11bd('0x1f')](_0x250ac9);}return _0x3b9a63[_0x11bd('0x20')]();};}function saveUpdates(_0x118d74,_0x4a822c){return function(_0x36fcec){if(_0x36fcec){return _0x36fcec['update'](_0x118d74)[_0x11bd('0x21')](function(_0x28a023){return _0x28a023;});}return null;};}function removeEntity(_0x4798aa,_0xff1a34){return function(_0x4719ad){if(_0x4719ad){return _0x4719ad[_0x11bd('0x22')]()[_0x11bd('0x21')](function(){_0x4798aa['status'](0xcc)[_0x11bd('0x18')]();});}};}function handleEntityNotFound(_0x5a62cd,_0x3a5778){return function(_0x30f916){if(!_0x30f916){_0x5a62cd['sendStatus'](0x194);}return _0x30f916;};}function handleError(_0x59244a,_0x34c39a){_0x34c39a=_0x34c39a||0x1f4;return function(_0x3fce90){logger[_0x11bd('0x23')](_0x3fce90[_0x11bd('0x24')]);if(_0x3fce90['name']){delete _0x3fce90[_0x11bd('0x25')];}_0x59244a['status'](_0x34c39a)[_0x11bd('0x26')](_0x3fce90);};}exports[_0x11bd('0x27')]=function(_0x9a1e96,_0x5ce880){var _0x427e30={},_0xc982d7={},_0x65b7d9={'count':0x0,'rows':[]};var _0x17ad5e=_[_0x11bd('0x28')](db[_0x11bd('0x29')]['rawAttributes'],function(_0x5a1371){return{'name':_0x5a1371[_0x11bd('0x2a')],'type':_0x5a1371[_0x11bd('0x2b')][_0x11bd('0x2c')]};});_0xc982d7[_0x11bd('0x2d')]=_[_0x11bd('0x28')](_0x17ad5e,_0x11bd('0x25'));_0xc982d7[_0x11bd('0x2e')]=_['keys'](_0x9a1e96[_0x11bd('0x2e')]);_0xc982d7[_0x11bd('0x2f')]=_[_0x11bd('0x30')](_0xc982d7['model'],_0xc982d7['query']);_0x427e30[_0x11bd('0x31')]=_[_0x11bd('0x30')](_0xc982d7[_0x11bd('0x2d')],qs[_0x11bd('0x32')](_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x32')]));_0x427e30[_0x11bd('0x31')]=_0x427e30[_0x11bd('0x31')]['length']?_0x427e30['attributes']:_0xc982d7[_0x11bd('0x2d')];if(!_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x33')]('nolimit')){_0x427e30['limit']=qs[_0x11bd('0x1c')](_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x1c')]);_0x427e30[_0x11bd('0x1b')]=qs['offset'](_0x9a1e96[_0x11bd('0x2e')]['offset']);}_0x427e30[_0x11bd('0x34')]=qs[_0x11bd('0x35')](_0x9a1e96[_0x11bd('0x2e')]['sort']);_0x427e30[_0x11bd('0x36')]=qs[_0x11bd('0x2f')](_[_0x11bd('0x37')](_0x9a1e96[_0x11bd('0x2e')],_0xc982d7['filters']),_0x17ad5e);if(_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x38')]){_0x427e30[_0x11bd('0x36')]=_['merge'](_0x427e30[_0x11bd('0x36')],{'$or':_[_0x11bd('0x28')](_0x17ad5e,function(_0x43db16){if(_0x43db16['type']!=='VIRTUAL'){var _0xcc2d6b={};_0xcc2d6b[_0x43db16[_0x11bd('0x25')]]={'$like':'%'+_0x9a1e96['query'][_0x11bd('0x38')]+'%'};return _0xcc2d6b;}})});}_0x427e30=_[_0x11bd('0x39')]({},_0x427e30,_0x9a1e96['options']);var _0x4b4bee={'where':_0x427e30[_0x11bd('0x36')]};return db[_0x11bd('0x29')]['count'](_0x4b4bee)['then'](function(_0x10ae33){_0x65b7d9['count']=_0x10ae33;if(_0x9a1e96['query'][_0x11bd('0x3a')]){_0x427e30[_0x11bd('0x3b')]=[{'all':!![]}];}return db[_0x11bd('0x29')][_0x11bd('0x3c')](_0x427e30);})['then'](function(_0x272d16){_0x65b7d9['rows']=_0x272d16;return _0x65b7d9;})[_0x11bd('0x21')](respondWithFilteredResult(_0x5ce880,_0x427e30))[_0x11bd('0x3d')](handleError(_0x5ce880,null));};exports[_0x11bd('0x3e')]=function(_0x4ff48e,_0x3b144d){var _0x4c2f8b={'raw':!![],'where':{'id':_0x4ff48e[_0x11bd('0x3f')]['id']}},_0x77e04f={};_0x77e04f[_0x11bd('0x2d')]=_['keys'](db[_0x11bd('0x29')][_0x11bd('0x40')]);_0x77e04f['query']=_['keys'](_0x4ff48e[_0x11bd('0x2e')]);_0x77e04f[_0x11bd('0x2f')]=_[_0x11bd('0x30')](_0x77e04f[_0x11bd('0x2d')],_0x77e04f[_0x11bd('0x2e')]);_0x4c2f8b['attributes']=_[_0x11bd('0x30')](_0x77e04f[_0x11bd('0x2d')],qs['fields'](_0x4ff48e['query'][_0x11bd('0x32')]));_0x4c2f8b[_0x11bd('0x31')]=_0x4c2f8b['attributes']['length']?_0x4c2f8b[_0x11bd('0x31')]:_0x77e04f['model'];if(_0x4ff48e['query']['includeAll']){_0x4c2f8b['include']=[{'all':!![]}];}_0x4c2f8b=_[_0x11bd('0x39')]({},_0x4c2f8b,_0x4ff48e['options']);return db[_0x11bd('0x29')]['find'](_0x4c2f8b)['then'](handleEntityNotFound(_0x3b144d,null))[_0x11bd('0x21')](respondWithResult(_0x3b144d,null))['catch'](handleError(_0x3b144d,null));};exports[_0x11bd('0x41')]=function(_0x24f23e,_0x5a223b){return db[_0x11bd('0x29')][_0x11bd('0x41')](_0x24f23e[_0x11bd('0x42')],{})[_0x11bd('0x21')](respondWithResult(_0x5a223b,0xc9))[_0x11bd('0x3d')](handleError(_0x5a223b,null));};exports['update']=function(_0x22bf7f,_0x4f208f){if(_0x22bf7f[_0x11bd('0x42')]['id']){delete _0x22bf7f[_0x11bd('0x42')]['id'];}return db[_0x11bd('0x29')][_0x11bd('0x43')]({'where':{'id':_0x22bf7f['params']['id']}})[_0x11bd('0x21')](handleEntityNotFound(_0x4f208f,null))['then'](saveUpdates(_0x22bf7f[_0x11bd('0x42')],null))[_0x11bd('0x21')](respondWithResult(_0x4f208f,null))[_0x11bd('0x3d')](handleError(_0x4f208f,null));};exports[_0x11bd('0x22')]=function(_0xecaf27,_0x34dce2){return db[_0x11bd('0x29')][_0x11bd('0x43')]({'where':{'id':_0xecaf27[_0x11bd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x34dce2,null))[_0x11bd('0x21')](removeEntity(_0x34dce2,null))[_0x11bd('0x3d')](handleError(_0x34dce2,null));};exports[_0x11bd('0x44')]=function(_0x3efd5c,_0x1a6198){return db[_0x11bd('0x29')][_0x11bd('0x44')]()[_0x11bd('0x21')](respondWithResult(_0x1a6198,null))[_0x11bd('0x3d')](handleError(_0x1a6198,null));}; \ No newline at end of file +var _0x1fa2=['error','stack','name','Cdr','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','then','rows','catch','show','keys','length','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','destroy'];(function(_0x1d6a82,_0x2ba55d){var _0x5d189c=function(_0x54244b){while(--_0x54244b){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5d189c(++_0x2ba55d);}(_0x1fa2,0xb9));var _0x21fa=function(_0x2a1c95,_0x131109){_0x2a1c95=_0x2a1c95-0x0;var _0x33c700=_0x1fa2[_0x2a1c95];return _0x33c700;};'use strict';var pdf=require(_0x21fa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21fa('0x1'));var zipdir=require(_0x21fa('0x2'));var jsonpatch=require(_0x21fa('0x3'));var rp=require(_0x21fa('0x4'));var moment=require(_0x21fa('0x5'));var BPromise=require(_0x21fa('0x6'));var Mustache=require(_0x21fa('0x7'));var util=require(_0x21fa('0x8'));var path=require(_0x21fa('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x21fa('0xa'));var squel=require(_0x21fa('0xb'));var crypto=require(_0x21fa('0xc'));var jsforce=require(_0x21fa('0xd'));var deskjs=require(_0x21fa('0xe'));var toCsv=require(_0x21fa('0xf'));var querystring=require('querystring');var Papa=require(_0x21fa('0x10'));var Redis=require(_0x21fa('0x11'));var authService=require(_0x21fa('0x12'));var qs=require(_0x21fa('0x13'));var as=require(_0x21fa('0x14'));var hardwareService=require(_0x21fa('0x15'));var logger=require('../../config/logger')(_0x21fa('0x16'));var utils=require(_0x21fa('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x21fa('0x18'));var db=require(_0x21fa('0x19'))['db'];function respondWithStatusCode(_0x3b7aab,_0x455adb){_0x455adb=_0x455adb||0xcc;return function(_0x77e402){if(_0x77e402){return _0x3b7aab[_0x21fa('0x1a')](_0x455adb);}return _0x3b7aab[_0x21fa('0x1b')](_0x455adb)[_0x21fa('0x1c')]();};}function respondWithResult(_0x2fce30,_0x3658eb){_0x3658eb=_0x3658eb||0xc8;return function(_0xc6038c){if(_0xc6038c){return _0x2fce30['status'](_0x3658eb)[_0x21fa('0x1d')](_0xc6038c);}};}function respondWithFilteredResult(_0x1dc0ac,_0x1a0152){return function(_0x541a06){if(_0x541a06){var _0x30d291=_0x541a06['count'],_0x15769a=_0x1a0152['offset'],_0x4b923a=_0x1a0152[_0x21fa('0x1e')]+_0x1a0152['limit'],_0x4c5bce;if(_0x4b923a>=_0x30d291){_0x4b923a=_0x30d291;_0x4c5bce=0xc8;}else{_0x4c5bce=0xce;}_0x1dc0ac['status'](_0x4c5bce);return _0x1dc0ac[_0x21fa('0x1f')](_0x21fa('0x20'),_0x15769a+'-'+_0x4b923a+'/'+_0x30d291)[_0x21fa('0x1d')](_0x541a06);}return null;};}function patchUpdates(_0x575bf8){return function(_0x25ba50){try{jsonpatch[_0x21fa('0x21')](_0x25ba50,_0x575bf8,!![]);}catch(_0x42e09c){return BPromise['reject'](_0x42e09c);}return _0x25ba50[_0x21fa('0x22')]();};}function saveUpdates(_0x35df21,_0x4b514b){return function(_0x5530c6){if(_0x5530c6){return _0x5530c6[_0x21fa('0x23')](_0x35df21)['then'](function(_0x544a88){return _0x544a88;});}return null;};}function removeEntity(_0x4f5ce0,_0x13f2fe){return function(_0x2f4c8a){if(_0x2f4c8a){return _0x2f4c8a[_0x21fa('0x24')]()['then'](function(){_0x4f5ce0[_0x21fa('0x1b')](0xcc)[_0x21fa('0x1c')]();});}};}function handleEntityNotFound(_0xec11d,_0xffbdf){return function(_0x554be9){if(!_0x554be9){_0xec11d[_0x21fa('0x1a')](0x194);}return _0x554be9;};}function handleError(_0x5f22e5,_0x451224){_0x451224=_0x451224||0x1f4;return function(_0x3cb57b){logger[_0x21fa('0x25')](_0x3cb57b[_0x21fa('0x26')]);if(_0x3cb57b[_0x21fa('0x27')]){delete _0x3cb57b['name'];}_0x5f22e5[_0x21fa('0x1b')](_0x451224)['send'](_0x3cb57b);};}exports['index']=function(_0x3bd002,_0x171a27){var _0x31b5ab={},_0x584e58={},_0x1d609d={'count':0x0,'rows':[]};var _0x1f89f0=_['map'](db[_0x21fa('0x28')][_0x21fa('0x29')],function(_0x33a97c){return{'name':_0x33a97c[_0x21fa('0x2a')],'type':_0x33a97c[_0x21fa('0x2b')]['key']};});_0x584e58[_0x21fa('0x2c')]=_[_0x21fa('0x2d')](_0x1f89f0,_0x21fa('0x27'));_0x584e58[_0x21fa('0x2e')]=_['keys'](_0x3bd002[_0x21fa('0x2e')]);_0x584e58[_0x21fa('0x2f')]=_[_0x21fa('0x30')](_0x584e58[_0x21fa('0x2c')],_0x584e58[_0x21fa('0x2e')]);_0x31b5ab[_0x21fa('0x31')]=_[_0x21fa('0x30')](_0x584e58[_0x21fa('0x2c')],qs[_0x21fa('0x32')](_0x3bd002['query'][_0x21fa('0x32')]));_0x31b5ab[_0x21fa('0x31')]=_0x31b5ab[_0x21fa('0x31')]['length']?_0x31b5ab[_0x21fa('0x31')]:_0x584e58[_0x21fa('0x2c')];if(!_0x3bd002[_0x21fa('0x2e')][_0x21fa('0x33')](_0x21fa('0x34'))){_0x31b5ab['limit']=qs[_0x21fa('0x35')](_0x3bd002[_0x21fa('0x2e')][_0x21fa('0x35')]);_0x31b5ab[_0x21fa('0x1e')]=qs[_0x21fa('0x1e')](_0x3bd002['query'][_0x21fa('0x1e')]);}_0x31b5ab[_0x21fa('0x36')]=qs['sort'](_0x3bd002[_0x21fa('0x2e')]['sort']);_0x31b5ab[_0x21fa('0x37')]=qs['filters'](_[_0x21fa('0x38')](_0x3bd002[_0x21fa('0x2e')],_0x584e58['filters']),_0x1f89f0);if(_0x3bd002[_0x21fa('0x2e')]['filter']){_0x31b5ab[_0x21fa('0x37')]=_[_0x21fa('0x39')](_0x31b5ab['where'],{'$or':_['map'](_0x1f89f0,function(_0x2d0bbc){if(_0x2d0bbc[_0x21fa('0x2b')]!==_0x21fa('0x3a')){var _0x4e18aa={};_0x4e18aa[_0x2d0bbc[_0x21fa('0x27')]]={'$like':'%'+_0x3bd002[_0x21fa('0x2e')][_0x21fa('0x3b')]+'%'};return _0x4e18aa;}})});}_0x31b5ab=_[_0x21fa('0x39')]({},_0x31b5ab,_0x3bd002['options']);var _0x31edce={'where':_0x31b5ab[_0x21fa('0x37')]};return db[_0x21fa('0x28')][_0x21fa('0x3c')](_0x31edce)['then'](function(_0x344782){_0x1d609d[_0x21fa('0x3c')]=_0x344782;if(_0x3bd002[_0x21fa('0x2e')][_0x21fa('0x3d')]){_0x31b5ab[_0x21fa('0x3e')]=[{'all':!![]}];}return db[_0x21fa('0x28')][_0x21fa('0x3f')](_0x31b5ab);})[_0x21fa('0x40')](function(_0x1b1b5d){_0x1d609d[_0x21fa('0x41')]=_0x1b1b5d;return _0x1d609d;})[_0x21fa('0x40')](respondWithFilteredResult(_0x171a27,_0x31b5ab))[_0x21fa('0x42')](handleError(_0x171a27,null));};exports[_0x21fa('0x43')]=function(_0x4b48a4,_0x47ea3c){var _0x4c081d={'raw':!![],'where':{'id':_0x4b48a4['params']['id']}},_0x43c8f7={};_0x43c8f7['model']=_[_0x21fa('0x44')](db['Cdr'][_0x21fa('0x29')]);_0x43c8f7['query']=_[_0x21fa('0x44')](_0x4b48a4[_0x21fa('0x2e')]);_0x43c8f7[_0x21fa('0x2f')]=_[_0x21fa('0x30')](_0x43c8f7[_0x21fa('0x2c')],_0x43c8f7['query']);_0x4c081d[_0x21fa('0x31')]=_['intersection'](_0x43c8f7['model'],qs[_0x21fa('0x32')](_0x4b48a4[_0x21fa('0x2e')][_0x21fa('0x32')]));_0x4c081d['attributes']=_0x4c081d[_0x21fa('0x31')][_0x21fa('0x45')]?_0x4c081d['attributes']:_0x43c8f7[_0x21fa('0x2c')];if(_0x4b48a4[_0x21fa('0x2e')]['includeAll']){_0x4c081d[_0x21fa('0x3e')]=[{'all':!![]}];}_0x4c081d=_[_0x21fa('0x39')]({},_0x4c081d,_0x4b48a4['options']);return db[_0x21fa('0x28')][_0x21fa('0x46')](_0x4c081d)[_0x21fa('0x40')](handleEntityNotFound(_0x47ea3c,null))[_0x21fa('0x40')](respondWithResult(_0x47ea3c,null))['catch'](handleError(_0x47ea3c,null));};exports[_0x21fa('0x47')]=function(_0x34ae0d,_0x54fbdd){return db[_0x21fa('0x28')]['create'](_0x34ae0d[_0x21fa('0x48')],{})[_0x21fa('0x40')](respondWithResult(_0x54fbdd,0xc9))[_0x21fa('0x42')](handleError(_0x54fbdd,null));};exports[_0x21fa('0x23')]=function(_0xe8a538,_0x26ba1f){if(_0xe8a538[_0x21fa('0x48')]['id']){delete _0xe8a538[_0x21fa('0x48')]['id'];}return db[_0x21fa('0x28')][_0x21fa('0x46')]({'where':{'id':_0xe8a538['params']['id']}})[_0x21fa('0x40')](handleEntityNotFound(_0x26ba1f,null))['then'](saveUpdates(_0xe8a538[_0x21fa('0x48')],null))['then'](respondWithResult(_0x26ba1f,null))[_0x21fa('0x42')](handleError(_0x26ba1f,null));};exports[_0x21fa('0x24')]=function(_0xa883,_0x143d6d){return db[_0x21fa('0x28')][_0x21fa('0x46')]({'where':{'id':_0xa883['params']['id']}})['then'](handleEntityNotFound(_0x143d6d,null))['then'](removeEntity(_0x143d6d,null))[_0x21fa('0x42')](handleError(_0x143d6d,null));};exports[_0x21fa('0x49')]=function(_0x420769,_0x4df2c4){return db[_0x21fa('0x28')][_0x21fa('0x49')]()[_0x21fa('0x40')](respondWithResult(_0x4df2c4,null))[_0x21fa('0x42')](handleError(_0x4df2c4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 470ee09..a8ec422 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 _0x4819=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','Cdr'];(function(_0x312e66,_0x53721b){var _0x42794a=function(_0x27a4b6){while(--_0x27a4b6){_0x312e66['push'](_0x312e66['shift']());}};_0x42794a(++_0x53721b);}(_0x4819,0xcd));var _0x9481=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0x4819[_0x3bfdde];return _0x3f752a;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['calldate']},{'name':_0x9481('0xe'),'fields':['disposition']},{'name':_0x9481('0xf'),'fields':['dst']},{'name':_0x9481('0x10'),'fields':[_0x9481('0x10')]},{'name':_0x9481('0x11'),'fields':[_0x9481('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4819=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','Cdr'];(function(_0x3d7bd4,_0x5d4b5a){var _0x1c2314=function(_0x3076e8){while(--_0x3076e8){_0x3d7bd4['push'](_0x3d7bd4['shift']());}};_0x1c2314(++_0x5d4b5a);}(_0x4819,0xcd));var _0x9481=function(_0x4f33ff,_0x4cc52d){_0x4f33ff=_0x4f33ff-0x0;var _0x40e19c=_0x4819[_0x4f33ff];return _0x40e19c;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['calldate']},{'name':_0x9481('0xe'),'fields':['disposition']},{'name':_0x9481('0xf'),'fields':['dst']},{'name':_0x9481('0x10'),'fields':[_0x9481('0x10')]},{'name':_0x9481('0x11'),'fields':[_0x9481('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 9cbfab8..dbcdc44 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 _0x24f4=['bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x24f4,0x1f2));var _0x424f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x424f('0x0'));var moment=require(_0x424f('0x1'));var BPromise=require(_0x424f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x424f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x424f('0x4'));var config=require(_0x424f('0x5'));var jayson=require(_0x424f('0x6'));var client=jayson[_0x424f('0x7')][_0x424f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x769cea,_0x56d92f,_0x54fca1){return new BPromise(function(_0x34ff64,_0xf32758){return client[_0x424f('0x9')](_0x769cea,_0x54fca1)[_0x424f('0xa')](function(_0x5dc693){logger[_0x424f('0xb')](_0x424f('0xc'),_0x56d92f,_0x424f('0xd'));logger[_0x424f('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x56d92f,'request\x20sent',JSON[_0x424f('0xf')](_0x5dc693));if(_0x5dc693['error']){if(_0x5dc693[_0x424f('0x10')][_0x424f('0x11')]===0x1f4){logger[_0x424f('0x10')](_0x424f('0xc'),_0x56d92f,_0x5dc693[_0x424f('0x10')]['message']);return _0xf32758(_0x5dc693[_0x424f('0x10')][_0x424f('0x12')]);}logger[_0x424f('0x10')]('Cdr,\x20%s,\x20%s',_0x56d92f,_0x5dc693[_0x424f('0x10')]['message']);return _0x34ff64(_0x5dc693[_0x424f('0x10')][_0x424f('0x12')]);}else{logger[_0x424f('0xb')]('Cdr,\x20%s,\x20%s',_0x56d92f,'request\x20sent');_0x34ff64(_0x5dc693['result'][_0x424f('0x12')]);}})[_0x424f('0x13')](function(_0x5b75da){logger[_0x424f('0x10')](_0x424f('0xc'),_0x56d92f,_0x5b75da);_0xf32758(_0x5b75da);});});} \ No newline at end of file +var _0x9205=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','Cdr,\x20%s,\x20%s'];(function(_0x2dacdd,_0x387f13){var _0x3727e3=function(_0x415f8e){while(--_0x415f8e){_0x2dacdd['push'](_0x2dacdd['shift']());}};_0x3727e3(++_0x387f13);}(_0x9205,0x183));var _0x5920=function(_0x3b9d72,_0x2d62fb){_0x3b9d72=_0x3b9d72-0x0;var _0x3cda47=_0x9205[_0x3b9d72];return _0x3cda47;};'use strict';var _=require(_0x5920('0x0'));var util=require(_0x5920('0x1'));var moment=require(_0x5920('0x2'));var BPromise=require(_0x5920('0x3'));var rs=require(_0x5920('0x4'));var fs=require('fs');var Redis=require(_0x5920('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5920('0x6'));var logger=require('../../config/logger')(_0x5920('0x7'));var config=require(_0x5920('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5920('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2391cf,_0x132c22,_0x225c45){return new BPromise(function(_0x3bff94,_0x1c2d5e){return client[_0x5920('0xa')](_0x2391cf,_0x225c45)['then'](function(_0x5c9a61){logger['info'](_0x5920('0xb'),_0x132c22,_0x5920('0xc'));logger[_0x5920('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x132c22,_0x5920('0xc'),JSON[_0x5920('0xe')](_0x5c9a61));if(_0x5c9a61[_0x5920('0xf')]){if(_0x5c9a61['error'][_0x5920('0x10')]===0x1f4){logger[_0x5920('0xf')](_0x5920('0xb'),_0x132c22,_0x5c9a61['error']['message']);return _0x1c2d5e(_0x5c9a61[_0x5920('0xf')][_0x5920('0x11')]);}logger['error'](_0x5920('0xb'),_0x132c22,_0x5c9a61[_0x5920('0xf')][_0x5920('0x11')]);return _0x3bff94(_0x5c9a61[_0x5920('0xf')][_0x5920('0x11')]);}else{logger[_0x5920('0x12')](_0x5920('0xb'),_0x132c22,'request\x20sent');_0x3bff94(_0x5c9a61[_0x5920('0x13')][_0x5920('0x11')]);}})[_0x5920('0x14')](function(_0x1b3e63){logger[_0x5920('0xf')](_0x5920('0xb'),_0x132c22,_0x1b3e63);_0x1c2d5e(_0x1b3e63);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 31fd62e..797c21d 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 _0x9826=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cdr.controller','isAuthenticated','/describe','get','post','put','/:id','update'];(function(_0x29d2b7,_0x5892c7){var _0x109807=function(_0x351d6d){while(--_0x351d6d){_0x29d2b7['push'](_0x29d2b7['shift']());}};_0x109807(++_0x5892c7);}(_0x9826,0x69));var _0x6982=function(_0x52d8f3,_0x2dd866){_0x52d8f3=_0x52d8f3-0x0;var _0x4247b3=_0x9826[_0x52d8f3];return _0x4247b3;};'use strict';var multer=require(_0x6982('0x0'));var util=require(_0x6982('0x1'));var path=require(_0x6982('0x2'));var timeout=require('connect-timeout');var express=require(_0x6982('0x3'));var router=express['Router']();var auth=require(_0x6982('0x4'));var interaction=require(_0x6982('0x5'));var config=require('../../config/environment');var controller=require(_0x6982('0x6'));router['get']('/',auth[_0x6982('0x7')](),controller['index']);router['get'](_0x6982('0x8'),auth[_0x6982('0x7')](),controller['describe']);router[_0x6982('0x9')]('/:id',auth[_0x6982('0x7')](),controller['show']);router[_0x6982('0xa')]('/',auth[_0x6982('0x7')](),controller['create']);router[_0x6982('0xb')](_0x6982('0xc'),auth[_0x6982('0x7')](),controller[_0x6982('0xd')]);router[_0x6982('0xe')]('/:id',auth[_0x6982('0x7')](),controller[_0x6982('0xf')]);module[_0x6982('0x10')]=router; \ No newline at end of file +var _0xb18c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5077c4,_0x1b9060){var _0x1595a8=function(_0x5e23c7){while(--_0x5e23c7){_0x5077c4['push'](_0x5077c4['shift']());}};_0x1595a8(++_0x1b9060);}(_0xb18c,0x10e));var _0xcb18=function(_0x5972a3,_0x1b141d){_0x5972a3=_0x5972a3-0x0;var _0x25ac50=_0xb18c[_0x5972a3];return _0x25ac50;};'use strict';var multer=require('multer');var util=require(_0xcb18('0x0'));var path=require(_0xcb18('0x1'));var timeout=require(_0xcb18('0x2'));var express=require(_0xcb18('0x3'));var router=express[_0xcb18('0x4')]();var auth=require(_0xcb18('0x5'));var interaction=require(_0xcb18('0x6'));var config=require(_0xcb18('0x7'));var controller=require(_0xcb18('0x8'));router['get']('/',auth[_0xcb18('0x9')](),controller[_0xcb18('0xa')]);router[_0xcb18('0xb')](_0xcb18('0xc'),auth[_0xcb18('0x9')](),controller[_0xcb18('0xd')]);router[_0xcb18('0xb')](_0xcb18('0xe'),auth[_0xcb18('0x9')](),controller['show']);router[_0xcb18('0xf')]('/',auth[_0xcb18('0x9')](),controller['create']);router[_0xcb18('0x10')](_0xcb18('0xe'),auth['isAuthenticated'](),controller[_0xcb18('0x11')]);router[_0xcb18('0x12')](_0xcb18('0xe'),auth[_0xcb18('0x9')](),controller[_0xcb18('0x13')]);module[_0xcb18('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 5c9d774..ddcd22a 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 _0x4469=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x180ab8,_0x385215){var _0x416953=function(_0x2563ae){while(--_0x2563ae){_0x180ab8['push'](_0x180ab8['shift']());}};_0x416953(++_0x385215);}(_0x4469,0x12f));var _0x9446=function(_0x118e5a,_0x251168){_0x118e5a=_0x118e5a-0x0;var _0x41a093=_0x4469[_0x118e5a];return _0x41a093;};'use strict';var Sequelize=require(_0x9446('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9446('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9446('0x2')],'allowNull':![],'defaultValue':_0x9446('0x3')},'appdata':{'type':Sequelize[_0x9446('0x4')]()},'description':{'type':Sequelize[_0x9446('0x2')]},'interval':{'type':Sequelize[_0x9446('0x2')],'defaultValue':_0x9446('0x5')}}; \ No newline at end of file +var _0x0f38=['*,*,*,*','sequelize','exports','noop'];(function(_0x158f9d,_0x3497f0){var _0x8f812b=function(_0x361002){while(--_0x361002){_0x158f9d['push'](_0x158f9d['shift']());}};_0x8f812b(++_0x3497f0);}(_0x0f38,0x109));var _0x80f3=function(_0x4e03f0,_0x2c2eeb){_0x4e03f0=_0x4e03f0-0x0;var _0x206c67=_0x0f38[_0x4e03f0];return _0x206c67;};'use strict';var Sequelize=require(_0x80f3('0x0'));module[_0x80f3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x80f3('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x80f3('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3f0a023..094696f 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 _0x6678=['../../config/environment','sendStatus','status','count','offset','limit','set','json','apply','reject','update','then','end','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','filters','intersection','query','attributes','fields','length','includeAll','include','merge','find','catch','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6678,0x1aa));var _0x8667=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x6678[_0x29e0eb];return _0x597d2d;};'use strict';var pdf=require(_0x8667('0x0'));var emlformat=require(_0x8667('0x1'));var rimraf=require(_0x8667('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8667('0x3'));var moment=require(_0x8667('0x4'));var BPromise=require(_0x8667('0x5'));var Mustache=require(_0x8667('0x6'));var util=require(_0x8667('0x7'));var path=require(_0x8667('0x8'));var sox=require(_0x8667('0x9'));var csv=require(_0x8667('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8667('0xb'));var jsforce=require(_0x8667('0xc'));var deskjs=require(_0x8667('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8667('0xe'));var Papa=require(_0x8667('0xf'));var Redis=require(_0x8667('0x10'));var authService=require(_0x8667('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8667('0x12'));var hardwareService=require(_0x8667('0x13'));var logger=require(_0x8667('0x14'))('api');var utils=require(_0x8667('0x15'));var config=require(_0x8667('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41064f,_0x1d6799){_0x1d6799=_0x1d6799||0xcc;return function(_0x481a30){if(_0x481a30){return _0x41064f[_0x8667('0x17')](_0x1d6799);}return _0x41064f[_0x8667('0x18')](_0x1d6799)['end']();};}function respondWithResult(_0x3af73f,_0x6c36e){_0x6c36e=_0x6c36e||0xc8;return function(_0x352423){if(_0x352423){return _0x3af73f[_0x8667('0x18')](_0x6c36e)['json'](_0x352423);}};}function respondWithFilteredResult(_0x114576,_0x1cd186){return function(_0x136160){if(_0x136160){var _0x3469b9=_0x136160[_0x8667('0x19')],_0x45de4f=_0x1cd186[_0x8667('0x1a')],_0x5ebfc6=_0x1cd186[_0x8667('0x1a')]+_0x1cd186[_0x8667('0x1b')],_0x40ac49;if(_0x5ebfc6>=_0x3469b9){_0x5ebfc6=_0x3469b9;_0x40ac49=0xc8;}else{_0x40ac49=0xce;}_0x114576[_0x8667('0x18')](_0x40ac49);return _0x114576[_0x8667('0x1c')]('Content-Range',_0x45de4f+'-'+_0x5ebfc6+'/'+_0x3469b9)[_0x8667('0x1d')](_0x136160);}return null;};}function patchUpdates(_0x279468){return function(_0x269910){try{jsonpatch[_0x8667('0x1e')](_0x269910,_0x279468,!![]);}catch(_0x5993f0){return BPromise[_0x8667('0x1f')](_0x5993f0);}return _0x269910['save']();};}function saveUpdates(_0x1e0467,_0x127bd6){return function(_0x466c97){if(_0x466c97){return _0x466c97[_0x8667('0x20')](_0x1e0467)[_0x8667('0x21')](function(_0x476a96){return _0x476a96;});}return null;};}function removeEntity(_0x5366bb,_0x3451db){return function(_0x3111ba){if(_0x3111ba){return _0x3111ba['destroy']()[_0x8667('0x21')](function(){_0x5366bb[_0x8667('0x18')](0xcc)[_0x8667('0x22')]();});}};}function handleEntityNotFound(_0x5da326,_0x28691c){return function(_0x25dd17){if(!_0x25dd17){_0x5da326['sendStatus'](0x194);}return _0x25dd17;};}function handleError(_0x581783,_0x4f6224){_0x4f6224=_0x4f6224||0x1f4;return function(_0x13762d){logger['error'](_0x13762d[_0x8667('0x23')]);if(_0x13762d['name']){delete _0x13762d[_0x8667('0x24')];}_0x581783[_0x8667('0x18')](_0x4f6224)[_0x8667('0x25')](_0x13762d);};}exports[_0x8667('0x26')]=function(_0x257844,_0x4c4758){var _0x443ff3={'raw':!![],'where':{'id':_0x257844[_0x8667('0x27')]['id']}},_0x2eb7f1={};_0x2eb7f1[_0x8667('0x28')]=_[_0x8667('0x29')](db[_0x8667('0x2a')][_0x8667('0x2b')]);_0x2eb7f1['query']=_['keys'](_0x257844['query']);_0x2eb7f1[_0x8667('0x2c')]=_[_0x8667('0x2d')](_0x2eb7f1[_0x8667('0x28')],_0x2eb7f1[_0x8667('0x2e')]);_0x443ff3[_0x8667('0x2f')]=_[_0x8667('0x2d')](_0x2eb7f1[_0x8667('0x28')],qs[_0x8667('0x30')](_0x257844[_0x8667('0x2e')][_0x8667('0x30')]));_0x443ff3['attributes']=_0x443ff3[_0x8667('0x2f')][_0x8667('0x31')]?_0x443ff3[_0x8667('0x2f')]:_0x2eb7f1['model'];if(_0x257844[_0x8667('0x2e')][_0x8667('0x32')]){_0x443ff3[_0x8667('0x33')]=[{'all':!![]}];}_0x443ff3=_[_0x8667('0x34')]({},_0x443ff3,_0x257844['options']);return db[_0x8667('0x2a')][_0x8667('0x35')](_0x443ff3)[_0x8667('0x21')](handleEntityNotFound(_0x4c4758,null))[_0x8667('0x21')](respondWithResult(_0x4c4758,null))[_0x8667('0x36')](handleError(_0x4c4758,null));};exports[_0x8667('0x20')]=function(_0x3f8f39,_0x344294){if(_0x3f8f39[_0x8667('0x37')]['id']){delete _0x3f8f39[_0x8667('0x37')]['id'];}return db[_0x8667('0x2a')][_0x8667('0x35')]({'where':{'id':_0x3f8f39['params']['id']}})[_0x8667('0x21')](handleEntityNotFound(_0x344294,null))['then'](saveUpdates(_0x3f8f39[_0x8667('0x37')],null))[_0x8667('0x21')](respondWithResult(_0x344294,null))['catch'](handleError(_0x344294,null));};exports['destroy']=function(_0x3ab225,_0x4c42e4){return db[_0x8667('0x2a')][_0x8667('0x35')]({'where':{'id':_0x3ab225['params']['id']}})[_0x8667('0x21')](handleEntityNotFound(_0x4c42e4,null))[_0x8667('0x21')](removeEntity(_0x4c42e4,null))[_0x8667('0x36')](handleError(_0x4c42e4,null));}; \ No newline at end of file +var _0x6713=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','destroy','then','error','name','send','params','keys','ChatApplication','rawAttributes','filters','intersection','attributes','model','fields','query','length','includeAll','include','find','catch','update','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox'];(function(_0x3ac276,_0x213407){var _0xc9f585=function(_0x36f3d4){while(--_0x36f3d4){_0x3ac276['push'](_0x3ac276['shift']());}};_0xc9f585(++_0x213407);}(_0x6713,0x6a));var _0x3671=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x6713[_0x3899d1];return _0xeb4a7d;};'use strict';var pdf=require(_0x3671('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3671('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3671('0x2'));var rp=require(_0x3671('0x3'));var moment=require(_0x3671('0x4'));var BPromise=require(_0x3671('0x5'));var Mustache=require(_0x3671('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3671('0x7'));var csv=require(_0x3671('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3671('0x9'));var squel=require(_0x3671('0xa'));var crypto=require(_0x3671('0xb'));var jsforce=require(_0x3671('0xc'));var deskjs=require(_0x3671('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3671('0xe'));var Papa=require(_0x3671('0xf'));var Redis=require(_0x3671('0x10'));var authService=require(_0x3671('0x11'));var qs=require(_0x3671('0x12'));var as=require(_0x3671('0x13'));var hardwareService=require(_0x3671('0x14'));var logger=require(_0x3671('0x15'))(_0x3671('0x16'));var utils=require(_0x3671('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3671('0x18'));var db=require(_0x3671('0x19'))['db'];function respondWithStatusCode(_0x2feb8b,_0x2ecc3b){_0x2ecc3b=_0x2ecc3b||0xcc;return function(_0x47ac54){if(_0x47ac54){return _0x2feb8b[_0x3671('0x1a')](_0x2ecc3b);}return _0x2feb8b['status'](_0x2ecc3b)[_0x3671('0x1b')]();};}function respondWithResult(_0x20f5d7,_0x48f4b2){_0x48f4b2=_0x48f4b2||0xc8;return function(_0x5c09f6){if(_0x5c09f6){return _0x20f5d7[_0x3671('0x1c')](_0x48f4b2)[_0x3671('0x1d')](_0x5c09f6);}};}function respondWithFilteredResult(_0x1f5648,_0x25b295){return function(_0xe5c943){if(_0xe5c943){var _0x43d164=_0xe5c943[_0x3671('0x1e')],_0x20af06=_0x25b295[_0x3671('0x1f')],_0x447654=_0x25b295[_0x3671('0x1f')]+_0x25b295[_0x3671('0x20')],_0x3ec9aa;if(_0x447654>=_0x43d164){_0x447654=_0x43d164;_0x3ec9aa=0xc8;}else{_0x3ec9aa=0xce;}_0x1f5648[_0x3671('0x1c')](_0x3ec9aa);return _0x1f5648[_0x3671('0x21')](_0x3671('0x22'),_0x20af06+'-'+_0x447654+'/'+_0x43d164)[_0x3671('0x1d')](_0xe5c943);}return null;};}function patchUpdates(_0x3517d6){return function(_0x76df67){try{jsonpatch['apply'](_0x76df67,_0x3517d6,!![]);}catch(_0x23346d){return BPromise['reject'](_0x23346d);}return _0x76df67['save']();};}function saveUpdates(_0xdbdd3b,_0x510cac){return function(_0x5d33c8){if(_0x5d33c8){return _0x5d33c8['update'](_0xdbdd3b)['then'](function(_0x25634d){return _0x25634d;});}return null;};}function removeEntity(_0x4d5cb1,_0x244ce0){return function(_0x15c222){if(_0x15c222){return _0x15c222[_0x3671('0x23')]()[_0x3671('0x24')](function(){_0x4d5cb1[_0x3671('0x1c')](0xcc)[_0x3671('0x1b')]();});}};}function handleEntityNotFound(_0x1d44e8,_0x17a833){return function(_0x51f1f6){if(!_0x51f1f6){_0x1d44e8[_0x3671('0x1a')](0x194);}return _0x51f1f6;};}function handleError(_0x25e2ff,_0xe52e8e){_0xe52e8e=_0xe52e8e||0x1f4;return function(_0x56bbe9){logger[_0x3671('0x25')](_0x56bbe9['stack']);if(_0x56bbe9['name']){delete _0x56bbe9[_0x3671('0x26')];}_0x25e2ff[_0x3671('0x1c')](_0xe52e8e)[_0x3671('0x27')](_0x56bbe9);};}exports['show']=function(_0x33ccf1,_0x155a1e){var _0x5d7a3b={'raw':!![],'where':{'id':_0x33ccf1[_0x3671('0x28')]['id']}},_0x7c4f26={};_0x7c4f26['model']=_[_0x3671('0x29')](db[_0x3671('0x2a')][_0x3671('0x2b')]);_0x7c4f26['query']=_[_0x3671('0x29')](_0x33ccf1['query']);_0x7c4f26[_0x3671('0x2c')]=_[_0x3671('0x2d')](_0x7c4f26['model'],_0x7c4f26['query']);_0x5d7a3b[_0x3671('0x2e')]=_[_0x3671('0x2d')](_0x7c4f26[_0x3671('0x2f')],qs[_0x3671('0x30')](_0x33ccf1[_0x3671('0x31')][_0x3671('0x30')]));_0x5d7a3b[_0x3671('0x2e')]=_0x5d7a3b['attributes'][_0x3671('0x32')]?_0x5d7a3b['attributes']:_0x7c4f26[_0x3671('0x2f')];if(_0x33ccf1[_0x3671('0x31')][_0x3671('0x33')]){_0x5d7a3b[_0x3671('0x34')]=[{'all':!![]}];}_0x5d7a3b=_['merge']({},_0x5d7a3b,_0x33ccf1['options']);return db[_0x3671('0x2a')][_0x3671('0x35')](_0x5d7a3b)['then'](handleEntityNotFound(_0x155a1e,null))['then'](respondWithResult(_0x155a1e,null))[_0x3671('0x36')](handleError(_0x155a1e,null));};exports[_0x3671('0x37')]=function(_0x136c77,_0x3e265b){if(_0x136c77[_0x3671('0x38')]['id']){delete _0x136c77['body']['id'];}return db[_0x3671('0x2a')][_0x3671('0x35')]({'where':{'id':_0x136c77[_0x3671('0x28')]['id']}})[_0x3671('0x24')](handleEntityNotFound(_0x3e265b,null))['then'](saveUpdates(_0x136c77[_0x3671('0x38')],null))[_0x3671('0x24')](respondWithResult(_0x3e265b,null))['catch'](handleError(_0x3e265b,null));};exports[_0x3671('0x23')]=function(_0x428211,_0x4099c3){return db[_0x3671('0x2a')][_0x3671('0x35')]({'where':{'id':_0x428211[_0x3671('0x28')]['id']}})[_0x3671('0x24')](handleEntityNotFound(_0x4099c3,null))[_0x3671('0x24')](removeEntity(_0x4099c3,null))[_0x3671('0x36')](handleError(_0x4099c3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index afb2a37..1dcc231 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 086e683..c057449 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 _0xf11f=['rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x4d1965,_0x43152e){var _0xdcfade=function(_0x3d3b8a){while(--_0x3d3b8a){_0x4d1965['push'](_0x4d1965['shift']());}};_0xdcfade(++_0x43152e);}(_0xf11f,0x16a));var _0xff11=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0xf11f[_0xffd8b0];return _0x301ba0;};'use strict';var _=require('lodash');var util=require(_0xff11('0x0'));var moment=require(_0xff11('0x1'));var BPromise=require(_0xff11('0x2'));var rs=require(_0xff11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff11('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff11('0x5'))(_0xff11('0x6'));var config=require(_0xff11('0x7'));var jayson=require(_0xff11('0x8'));var client=jayson[_0xff11('0x9')][_0xff11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9d7e0,_0x91b2d7,_0x362839){return new BPromise(function(_0x22d83b,_0x4a4feb){return client[_0xff11('0xb')](_0x9d7e0,_0x362839)[_0xff11('0xc')](function(_0x2a3a39){logger['info'](_0xff11('0xd'),_0x91b2d7,'request\x20sent');logger[_0xff11('0xe')](_0xff11('0xf'),_0x91b2d7,'request\x20sent',JSON[_0xff11('0x10')](_0x2a3a39));if(_0x2a3a39[_0xff11('0x11')]){if(_0x2a3a39[_0xff11('0x11')]['code']===0x1f4){logger[_0xff11('0x11')](_0xff11('0xd'),_0x91b2d7,_0x2a3a39['error'][_0xff11('0x12')]);return _0x4a4feb(_0x2a3a39[_0xff11('0x11')][_0xff11('0x12')]);}logger[_0xff11('0x11')](_0xff11('0xd'),_0x91b2d7,_0x2a3a39[_0xff11('0x11')][_0xff11('0x12')]);return _0x22d83b(_0x2a3a39[_0xff11('0x11')][_0xff11('0x12')]);}else{logger[_0xff11('0x13')]('ChatApplication,\x20%s,\x20%s',_0x91b2d7,_0xff11('0x14'));_0x22d83b(_0x2a3a39[_0xff11('0x15')][_0xff11('0x12')]);}})[_0xff11('0x16')](function(_0x26b5f8){logger['error'](_0xff11('0xd'),_0x91b2d7,_0x26b5f8);_0x4a4feb(_0x26b5f8);});});} \ No newline at end of file +var _0x81b6=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x81b6,0x193));var _0x681b=function(_0x3c267f,_0x996eee){_0x3c267f=_0x3c267f-0x0;var _0x4f4929=_0x81b6[_0x3c267f];return _0x4f4929;};'use strict';var _=require(_0x681b('0x0'));var util=require(_0x681b('0x1'));var moment=require(_0x681b('0x2'));var BPromise=require('bluebird');var rs=require(_0x681b('0x3'));var fs=require('fs');var Redis=require(_0x681b('0x4'));var db=require(_0x681b('0x5'))['db'];var utils=require(_0x681b('0x6'));var logger=require(_0x681b('0x7'))(_0x681b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x681b('0x9')][_0x681b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x266556,_0x1b0fb8,_0x292751){return new BPromise(function(_0x231ce8,_0x409270){return client['request'](_0x266556,_0x292751)[_0x681b('0xb')](function(_0x581f14){logger[_0x681b('0xc')](_0x681b('0xd'),_0x1b0fb8,_0x681b('0xe'));logger[_0x681b('0xf')](_0x681b('0x10'),_0x1b0fb8,'request\x20sent',JSON[_0x681b('0x11')](_0x581f14));if(_0x581f14[_0x681b('0x12')]){if(_0x581f14[_0x681b('0x12')][_0x681b('0x13')]===0x1f4){logger[_0x681b('0x12')](_0x681b('0xd'),_0x1b0fb8,_0x581f14[_0x681b('0x12')][_0x681b('0x14')]);return _0x409270(_0x581f14[_0x681b('0x12')][_0x681b('0x14')]);}logger[_0x681b('0x12')](_0x681b('0xd'),_0x1b0fb8,_0x581f14[_0x681b('0x12')][_0x681b('0x14')]);return _0x231ce8(_0x581f14[_0x681b('0x12')][_0x681b('0x14')]);}else{logger[_0x681b('0xc')](_0x681b('0xd'),_0x1b0fb8,'request\x20sent');_0x231ce8(_0x581f14[_0x681b('0x15')][_0x681b('0x14')]);}})[_0x681b('0x16')](function(_0x416089){logger[_0x681b('0x12')]('ChatApplication,\x20%s,\x20%s',_0x1b0fb8,_0x416089);_0x409270(_0x416089);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a119ad9..282ee05 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 _0xf43b=['get','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./chatApplication.controller'];(function(_0x1c15d1,_0x412776){var _0x278c59=function(_0x350236){while(--_0x350236){_0x1c15d1['push'](_0x1c15d1['shift']());}};_0x278c59(++_0x412776);}(_0xf43b,0x1e4));var _0xbf43=function(_0x2372a1,_0x4c6967){_0x2372a1=_0x2372a1-0x0;var _0x146610=_0xf43b[_0x2372a1];return _0x146610;};'use strict';var multer=require(_0xbf43('0x0'));var util=require('util');var path=require(_0xbf43('0x1'));var timeout=require(_0xbf43('0x2'));var express=require('express');var router=express[_0xbf43('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf43('0x4'));var config=require('../../config/environment');var controller=require(_0xbf43('0x5'));router[_0xbf43('0x6')]('/:id',auth[_0xbf43('0x7')](),controller['show']);router[_0xbf43('0x8')](_0xbf43('0x9'),auth['isAuthenticated'](),controller[_0xbf43('0xa')]);router[_0xbf43('0xb')]('/:id',auth[_0xbf43('0x7')](),controller[_0xbf43('0xc')]);module[_0xbf43('0xd')]=router; \ No newline at end of file +var _0x8049=['Router','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','put','update','destroy','connect-timeout'];(function(_0x3ca313,_0x4878c3){var _0x1d24e1=function(_0x4cb9fa){while(--_0x4cb9fa){_0x3ca313['push'](_0x3ca313['shift']());}};_0x1d24e1(++_0x4878c3);}(_0x8049,0x1a3));var _0x9804=function(_0x34b12e,_0xfbbca3){_0x34b12e=_0x34b12e-0x0;var _0x3780b4=_0x8049[_0x34b12e];return _0x3780b4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9804('0x0'));var express=require('express');var router=express[_0x9804('0x1')]();var auth=require(_0x9804('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x9804('0x3'));var controller=require(_0x9804('0x4'));router['get'](_0x9804('0x5'),auth[_0x9804('0x6')](),controller['show']);router[_0x9804('0x7')](_0x9804('0x5'),auth[_0x9804('0x6')](),controller[_0x9804('0x8')]);router['delete'](_0x9804('0x5'),auth[_0x9804('0x6')](),controller[_0x9804('0x9')]);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 b2622c1..fe86ce9 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 _0x0aa1=['STRING','sequelize','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0aa1,0xaf));var _0x10aa=function(_0x145ef5,_0x2b1108){_0x145ef5=_0x145ef5-0x0;var _0x1634ba=_0x0aa1[_0x145ef5];return _0x1634ba;};'use strict';var Sequelize=require(_0x10aa('0x0'));module[_0x10aa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x10aa('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x11ef=['BOOLEAN','sequelize','exports','STRING'];(function(_0x458b0,_0x15f01d){var _0x294e1f=function(_0x39b297){while(--_0x39b297){_0x458b0['push'](_0x458b0['shift']());}};_0x294e1f(++_0x15f01d);}(_0x11ef,0x1e1));var _0xf11e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x11ef[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xf11e('0x0'));module[_0xf11e('0x1')]={'name':{'type':Sequelize[_0xf11e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf11e('0x2')]},'write':{'type':Sequelize[_0xf11e('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 b269f87..7d4d923 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 _0xba34=['limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','filter','where','merge','VIRTUAL','options','count','findAll','rows','params','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','User','order','sort','pick','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xba34,0x119));var _0x4ba3=function(_0x41f36a,_0x5acabd){_0x41f36a=_0x41f36a-0x0;var _0x5ad7be=_0xba34[_0x41f36a];return _0x5ad7be;};'use strict';var pdf=require(_0x4ba3('0x0'));var emlformat=require(_0x4ba3('0x1'));var rimraf=require(_0x4ba3('0x2'));var zipdir=require(_0x4ba3('0x3'));var jsonpatch=require(_0x4ba3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ba3('0x5'));var util=require(_0x4ba3('0x6'));var path=require(_0x4ba3('0x7'));var sox=require(_0x4ba3('0x8'));var csv=require(_0x4ba3('0x9'));var ejs=require(_0x4ba3('0xa'));var fs=require('fs');var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x9'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];config[_0x4ba3('0x19')]=_['defaults'](config[_0x4ba3('0x19')],{'host':_0x4ba3('0x1a'),'port':0x18eb});var socket=require(_0x4ba3('0x1b'))(new Redis(config[_0x4ba3('0x19')]));require(_0x4ba3('0x1c'))[_0x4ba3('0x1d')](socket);var jayson=require(_0x4ba3('0x1e'));var client=jayson[_0x4ba3('0x1f')][_0x4ba3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x401366,_0x36638b,_0x301359,_0x29a9d1){return new BPromise(function(_0x25f584,_0x40e75b){var _0x1b7776=_0x29a9d1||client;return _0x1b7776['request'](_0x401366,_0x301359)[_0x4ba3('0x21')](function(_0x788277){logger[_0x4ba3('0x22')](_0x4ba3('0x23'),_0x36638b,'request\x20sent');logger[_0x4ba3('0x24')](_0x4ba3('0x25'),_0x36638b,_0x4ba3('0x26'),JSON[_0x4ba3('0x27')](_0x788277));if(_0x788277[_0x4ba3('0x28')]){if(_0x788277[_0x4ba3('0x28')]['code']===0x1f4){logger['error'](_0x4ba3('0x23'),_0x36638b,_0x788277['error'][_0x4ba3('0x29')]);return _0x40e75b(_0x788277[_0x4ba3('0x28')][_0x4ba3('0x29')]);}logger[_0x4ba3('0x28')](_0x4ba3('0x23'),_0x36638b,_0x788277[_0x4ba3('0x28')]['message']);return _0x25f584(_0x788277[_0x4ba3('0x28')][_0x4ba3('0x29')]);}else{logger['info'](_0x4ba3('0x23'),_0x36638b,'request\x20sent');_0x25f584(_0x788277[_0x4ba3('0x2a')][_0x4ba3('0x29')]);}})[_0x4ba3('0x2b')](function(_0x37e6f3){logger[_0x4ba3('0x28')](_0x4ba3('0x23'),_0x36638b,_0x37e6f3);_0x40e75b(_0x37e6f3);});});}function respondWithStatusCode(_0x159596,_0xe1f7d2){_0xe1f7d2=_0xe1f7d2||0xcc;return function(_0x6cecf3){if(_0x6cecf3){return _0x159596[_0x4ba3('0x2c')](_0xe1f7d2);}return _0x159596['status'](_0xe1f7d2)[_0x4ba3('0x2d')]();};}function respondWithResult(_0x13c353,_0x2311ed){_0x2311ed=_0x2311ed||0xc8;return function(_0x5adaab){if(_0x5adaab){return _0x13c353[_0x4ba3('0x2e')](_0x2311ed)[_0x4ba3('0x2f')](_0x5adaab);}};}function respondWithFilteredResult(_0x44d78c,_0x5a3588){return function(_0x10cae6){if(_0x10cae6){var _0x843276=_0x10cae6['count'],_0x34ecb4=_0x5a3588[_0x4ba3('0x30')],_0x22394d=_0x5a3588[_0x4ba3('0x30')]+_0x5a3588[_0x4ba3('0x31')],_0x4a339e;if(_0x22394d>=_0x843276){_0x22394d=_0x843276;_0x4a339e=0xc8;}else{_0x4a339e=0xce;}_0x44d78c[_0x4ba3('0x2e')](_0x4a339e);return _0x44d78c[_0x4ba3('0x32')](_0x4ba3('0x33'),_0x34ecb4+'-'+_0x22394d+'/'+_0x843276)['json'](_0x10cae6);}return null;};}function patchUpdates(_0x27444b){return function(_0x28f36c){try{jsonpatch[_0x4ba3('0x34')](_0x28f36c,_0x27444b,!![]);}catch(_0xbf95b3){return BPromise[_0x4ba3('0x35')](_0xbf95b3);}return _0x28f36c[_0x4ba3('0x36')]();};}function saveUpdates(_0x457236,_0x272a49){return function(_0x133e76){if(_0x133e76){return _0x133e76[_0x4ba3('0x37')](_0x457236)['then'](function(_0x5a453f){return _0x5a453f;});}return null;};}function removeEntity(_0x4e2af0,_0x2d226a){return function(_0xd033d7){if(_0xd033d7){return _0xd033d7[_0x4ba3('0x38')]()[_0x4ba3('0x21')](function(){_0x4e2af0[_0x4ba3('0x2e')](0xcc)[_0x4ba3('0x2d')]();});}};}function handleEntityNotFound(_0x137551,_0xe1abe8){return function(_0x2f3495){if(!_0x2f3495){_0x137551[_0x4ba3('0x2c')](0x194);}return _0x2f3495;};}function handleError(_0x437a20,_0x3439cb){_0x3439cb=_0x3439cb||0x1f4;return function(_0x54535c){logger[_0x4ba3('0x28')](_0x54535c[_0x4ba3('0x39')]);if(_0x54535c[_0x4ba3('0x3a')]){delete _0x54535c['name'];}_0x437a20[_0x4ba3('0x2e')](_0x3439cb)['send'](_0x54535c);};}exports[_0x4ba3('0x3b')]=function(_0x1cc70e,_0x426e11){var _0x2b213b={},_0xf892e1={},_0x3d977c={'count':0x0,'rows':[]};var _0x53e39a=_[_0x4ba3('0x3c')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')],function(_0x4b702b){return{'name':_0x4b702b[_0x4ba3('0x3f')],'type':_0x4b702b[_0x4ba3('0x40')]['key']};});_0xf892e1[_0x4ba3('0x41')]=_['map'](_0x53e39a,'name');_0xf892e1[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x1cc70e[_0x4ba3('0x42')]);_0xf892e1[_0x4ba3('0x44')]=_[_0x4ba3('0x45')](_0xf892e1['model'],_0xf892e1[_0x4ba3('0x42')]);_0x2b213b[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0xf892e1[_0x4ba3('0x41')],qs[_0x4ba3('0x47')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x2b213b[_0x4ba3('0x46')]=_0x2b213b['attributes'][_0x4ba3('0x48')]?_0x2b213b[_0x4ba3('0x46')]:_0xf892e1[_0x4ba3('0x41')];if(!_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x49')](_0x4ba3('0x4a'))){_0x2b213b[_0x4ba3('0x31')]=qs[_0x4ba3('0x31')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x31')]);_0x2b213b[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x30')]);}_0x2b213b['order']=qs['sort'](_0x1cc70e['query']['sort']);_0x2b213b['where']=qs[_0x4ba3('0x44')](_['pick'](_0x1cc70e[_0x4ba3('0x42')],_0xf892e1['filters']),_0x53e39a);if(_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x2b213b[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x2b213b[_0x4ba3('0x4c')],{'$or':_['map'](_0x53e39a,function(_0x138467){if(_0x138467['type']!==_0x4ba3('0x4e')){var _0x50f27a={};_0x50f27a[_0x138467[_0x4ba3('0x3a')]]={'$like':'%'+_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x4b')]+'%'};return _0x50f27a;}})});}_0x2b213b=_[_0x4ba3('0x4d')]({},_0x2b213b,_0x1cc70e[_0x4ba3('0x4f')]);var _0xb5b940={'where':_0x2b213b[_0x4ba3('0x4c')]};return db['ChatGroup'][_0x4ba3('0x50')](_0xb5b940)[_0x4ba3('0x21')](function(_0x1e418c){_0x3d977c[_0x4ba3('0x50')]=_0x1e418c;if(_0x1cc70e[_0x4ba3('0x42')]['includeAll']){_0x2b213b['include']=[{'all':!![]}];}return db[_0x4ba3('0x3d')][_0x4ba3('0x51')](_0x2b213b);})[_0x4ba3('0x21')](function(_0x4b4de9){_0x3d977c[_0x4ba3('0x52')]=_0x4b4de9;return _0x3d977c;})[_0x4ba3('0x21')](respondWithFilteredResult(_0x426e11,_0x2b213b))[_0x4ba3('0x2b')](handleError(_0x426e11,null));};exports['show']=function(_0x47f588,_0x34dc04){var _0x482a83={'raw':!![],'where':{'id':_0x47f588[_0x4ba3('0x53')]['id']}},_0x439acf={};_0x439acf[_0x4ba3('0x41')]=_[_0x4ba3('0x43')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')]);_0x439acf['query']=_[_0x4ba3('0x43')](_0x47f588[_0x4ba3('0x42')]);_0x439acf['filters']=_[_0x4ba3('0x45')](_0x439acf[_0x4ba3('0x41')],_0x439acf[_0x4ba3('0x42')]);_0x482a83[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0x439acf['model'],qs[_0x4ba3('0x47')](_0x47f588[_0x4ba3('0x42')]['fields']));_0x482a83[_0x4ba3('0x46')]=_0x482a83[_0x4ba3('0x46')][_0x4ba3('0x48')]?_0x482a83[_0x4ba3('0x46')]:_0x439acf[_0x4ba3('0x41')];if(_0x47f588[_0x4ba3('0x42')][_0x4ba3('0x54')]){_0x482a83[_0x4ba3('0x55')]=[{'all':!![]}];}_0x482a83=_[_0x4ba3('0x4d')]({},_0x482a83,_0x47f588[_0x4ba3('0x4f')]);return db[_0x4ba3('0x3d')][_0x4ba3('0x56')](_0x482a83)[_0x4ba3('0x21')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x21')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x2b')](handleError(_0x34dc04,null));};exports['create']=function(_0x5e7ed5,_0x589d82){return db[_0x4ba3('0x3d')][_0x4ba3('0x57')](_0x5e7ed5[_0x4ba3('0x58')],{})[_0x4ba3('0x21')](respondWithResult(_0x589d82,0xc9))[_0x4ba3('0x2b')](handleError(_0x589d82,null));};exports['update']=function(_0x3920c0,_0x4620ae){if(_0x3920c0[_0x4ba3('0x58')]['id']){delete _0x3920c0[_0x4ba3('0x58')]['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x3920c0[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4620ae,null))[_0x4ba3('0x21')](saveUpdates(_0x3920c0[_0x4ba3('0x58')],null))[_0x4ba3('0x21')](respondWithResult(_0x4620ae,null))[_0x4ba3('0x2b')](handleError(_0x4620ae,null));};exports[_0x4ba3('0x38')]=function(_0x328314,_0x4fa64d){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x328314[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4fa64d,null))[_0x4ba3('0x21')](removeEntity(_0x4fa64d,null))[_0x4ba3('0x2b')](handleError(_0x4fa64d,null));};exports[_0x4ba3('0x59')]=function(_0x3f6174,_0x581512){return db[_0x4ba3('0x3d')][_0x4ba3('0x59')]()[_0x4ba3('0x21')](respondWithResult(_0x581512,null))['catch'](handleError(_0x581512,null));};exports[_0x4ba3('0x5a')]=function(_0x4b072c,_0x1b7c4e,_0x4cc10a){return db[_0x4ba3('0x5b')][_0x4ba3('0x50')]({'where':{'ChatGroupId':_0x4b072c[_0x4ba3('0x53')]['id'],'ToId':_0x4b072c['user']['id'],'read':![]}})[_0x4ba3('0x21')](function(_0xaef1b){return{'id':_[_0x4ba3('0x5c')](_0x4b072c[_0x4ba3('0x53')]['id']),'count':_0xaef1b};})[_0x4ba3('0x21')](respondWithResult(_0x1b7c4e,null))['catch'](handleError(_0x1b7c4e,null));};exports[_0x4ba3('0x5d')]=function(_0x252195,_0x34cc21,_0x469ef0){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x252195[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x34cc21,null))[_0x4ba3('0x21')](function(_0x6b3329){if(_0x6b3329){return _0x6b3329[_0x4ba3('0x5d')](_0x252195['body'][_0x4ba3('0x5e')],_[_0x4ba3('0x5f')](_0x252195['body'],['ids','id'])||{});}})[_0x4ba3('0x21')](respondWithResult(_0x34cc21,null))[_0x4ba3('0x2b')](handleError(_0x34cc21,null));};exports['getMembers']=function(_0x220c83,_0x30bb71,_0x1fb2aa){var _0x589214={};var _0x1f5815={};var _0x46224;var _0x1af489;return db[_0x4ba3('0x3d')][_0x4ba3('0x60')]({'where':{'id':_0x220c83[_0x4ba3('0x53')]['id']}})['then'](handleEntityNotFound(_0x30bb71,null))[_0x4ba3('0x21')](function(_0x2c0408){if(_0x2c0408){_0x46224=_0x2c0408;_0x1f5815[_0x4ba3('0x41')]=_['keys'](db[_0x4ba3('0x61')][_0x4ba3('0x3e')]);_0x1f5815[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x220c83[_0x4ba3('0x42')]);_0x1f5815[_0x4ba3('0x44')]=_[_0x4ba3('0x45')](_0x1f5815[_0x4ba3('0x41')],_0x1f5815['query']);_0x589214['attributes']=_[_0x4ba3('0x45')](_0x1f5815['model'],qs[_0x4ba3('0x47')](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x589214['attributes']=_0x589214[_0x4ba3('0x46')][_0x4ba3('0x48')]?_0x589214[_0x4ba3('0x46')]:_0x1f5815['model'];_0x589214[_0x4ba3('0x62')]=qs['sort'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x63')]);_0x589214['where']=qs[_0x4ba3('0x44')](_[_0x4ba3('0x64')](_0x220c83[_0x4ba3('0x42')],_0x1f5815[_0x4ba3('0x44')]));if(_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x589214[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x589214[_0x4ba3('0x4c')],{'$or':_['map'](_0x589214[_0x4ba3('0x46')],function(_0x306e2f){var _0x3853e1={};_0x3853e1[_0x306e2f]={'$like':'%'+_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x4b')]+'%'};return _0x3853e1;})});}_0x589214=_[_0x4ba3('0x4d')]({},_0x589214,_0x220c83[_0x4ba3('0x4f')]);return _0x46224[_0x4ba3('0x65')](_0x589214);}})[_0x4ba3('0x21')](function(_0x1a3180){if(_0x1a3180){_0x1af489=_0x1a3180[_0x4ba3('0x48')];if(!_0x220c83[_0x4ba3('0x42')]['hasOwnProperty'](_0x4ba3('0x4a'))){_0x589214[_0x4ba3('0x31')]=qs['limit'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x31')]);_0x589214['offset']=qs['offset'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x30')]);}return _0x46224[_0x4ba3('0x65')](_0x589214);}})[_0x4ba3('0x21')](function(_0x37b966){if(_0x37b966){return _0x37b966?{'count':_0x1af489,'rows':_0x37b966}:null;}})[_0x4ba3('0x21')](respondWithResult(_0x30bb71,null))[_0x4ba3('0x2b')](handleError(_0x30bb71,null));};exports[_0x4ba3('0x66')]=function(_0x516c41,_0x272480,_0x5bab62){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x516c41[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x272480,null))[_0x4ba3('0x21')](function(_0x254f91){if(_0x254f91){return _0x254f91[_0x4ba3('0x66')](_0x516c41[_0x4ba3('0x42')]['ids']);}})[_0x4ba3('0x21')](respondWithStatusCode(_0x272480,null))[_0x4ba3('0x2b')](handleError(_0x272480,null));};exports[_0x4ba3('0x67')]=function(_0x5a1872,_0x9bd44d,_0xdab676){if(_0x5a1872[_0x4ba3('0x58')]['id']){delete _0x5a1872[_0x4ba3('0x58')]['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x5a1872[_0x4ba3('0x53')]['id']}})['then'](handleEntityNotFound(_0x9bd44d,null))['then'](function(_0x42ce25){if(_0x42ce25){_0x5a1872['body'][_0x4ba3('0x68')]=_0x42ce25['id'];return db[_0x4ba3('0x5b')][_0x4ba3('0x57')](_0x5a1872[_0x4ba3('0x58')]);}})['then'](respondWithResult(_0x9bd44d,null))['catch'](handleError(_0x9bd44d,null));};exports[_0x4ba3('0x69')]=function(_0x2b2132,_0x4e856e,_0x62f9cf){var _0x39fb64={};var _0x6a2d81={};var _0x1e8232;var _0x329609;return db[_0x4ba3('0x3d')][_0x4ba3('0x60')]({'where':{'id':_0x2b2132['params']['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4e856e,null))[_0x4ba3('0x21')](function(_0x211d2b){if(_0x211d2b){_0x1e8232=_0x211d2b;_0x6a2d81['model']=_[_0x4ba3('0x43')](db[_0x4ba3('0x5b')]['rawAttributes']);_0x6a2d81[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x2b2132['query']);_0x6a2d81['filters']=_['intersection'](_0x6a2d81['model'],_0x6a2d81[_0x4ba3('0x42')]);_0x39fb64[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0x6a2d81[_0x4ba3('0x41')],qs[_0x4ba3('0x47')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x39fb64['attributes']=_0x39fb64[_0x4ba3('0x46')]['length']?_0x39fb64[_0x4ba3('0x46')]:_0x6a2d81['model'];_0x39fb64[_0x4ba3('0x62')]=qs[_0x4ba3('0x63')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x63')]);_0x39fb64[_0x4ba3('0x4c')]=qs['filters'](_['pick'](_0x2b2132[_0x4ba3('0x42')],_0x6a2d81[_0x4ba3('0x44')]));if(_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x39fb64[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x39fb64[_0x4ba3('0x4c')],{'$or':_[_0x4ba3('0x3c')](_0x39fb64[_0x4ba3('0x46')],function(_0x35441e){var _0x217ea4={};_0x217ea4[_0x35441e]={'$like':'%'+_0x2b2132[_0x4ba3('0x42')]['filter']+'%'};return _0x217ea4;})});}if(_0x2b2132[_0x4ba3('0x42')]['$gte']){var _0x3f5309=_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x6a')][_0x4ba3('0x6b')](',');var _0x48cd14={};_0x48cd14[_0x3f5309[0x0]]={'$gte':moment(_0x3f5309[0x1])[_0x4ba3('0x6c')](_0x4ba3('0x6d'))};_0x39fb64[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x39fb64['where'],_0x48cd14);}_0x39fb64=_['merge']({},_0x39fb64,_0x2b2132[_0x4ba3('0x4f')]);return _0x1e8232[_0x4ba3('0x69')](_0x39fb64);}})[_0x4ba3('0x21')](function(_0x5db456){if(_0x5db456){_0x329609=_0x5db456[_0x4ba3('0x48')];if(!_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x49')](_0x4ba3('0x4a'))){_0x39fb64[_0x4ba3('0x31')]=qs[_0x4ba3('0x31')](_0x2b2132['query'][_0x4ba3('0x31')]);_0x39fb64['offset']=qs[_0x4ba3('0x30')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x30')]);}return _0x1e8232[_0x4ba3('0x69')](_0x39fb64);}})['then'](function(_0x11be49){if(_0x11be49){return _0x11be49?{'count':_0x329609,'rows':_0x11be49}:null;}})[_0x4ba3('0x21')](respondWithResult(_0x4e856e,null))['catch'](handleError(_0x4e856e,null));}; \ No newline at end of file +var _0x3974=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','stack','name','index','ChatGroup','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','order','sort','where','pick','filters','filter','merge','type','options','findAll','rows','show','params','length','includeAll','include','find','catch','create','body','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','findOne','User','getMembers','hasOwnProperty','removeMembers','ids','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x31f6a4,_0x80c253){var _0x56ca42=function(_0x38b31f){while(--_0x38b31f){_0x31f6a4['push'](_0x31f6a4['shift']());}};_0x56ca42(++_0x80c253);}(_0x3974,0xbc));var _0x4397=function(_0x2045d9,_0x4e4edf){_0x2045d9=_0x2045d9-0x0;var _0x48ffe3=_0x3974[_0x2045d9];return _0x48ffe3;};'use strict';var pdf=require(_0x4397('0x0'));var emlformat=require(_0x4397('0x1'));var rimraf=require(_0x4397('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4397('0x3'));var moment=require(_0x4397('0x4'));var BPromise=require(_0x4397('0x5'));var Mustache=require(_0x4397('0x6'));var util=require(_0x4397('0x7'));var path=require('path');var sox=require(_0x4397('0x8'));var csv=require(_0x4397('0x9'));var ejs=require(_0x4397('0xa'));var fs=require('fs');var _=require(_0x4397('0xb'));var squel=require('squel');var crypto=require(_0x4397('0xc'));var jsforce=require(_0x4397('0xd'));var deskjs=require(_0x4397('0xe'));var toCsv=require(_0x4397('0x9'));var querystring=require('querystring');var Papa=require(_0x4397('0xf'));var Redis=require(_0x4397('0x10'));var authService=require(_0x4397('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4397('0x12'));var logger=require(_0x4397('0x13'))(_0x4397('0x14'));var utils=require('../../config/utils');var config=require(_0x4397('0x15'));var licenseUtil=require(_0x4397('0x16'));var db=require(_0x4397('0x17'))['db'];config['redis']=_[_0x4397('0x18')](config[_0x4397('0x19')],{'host':_0x4397('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4397('0x19')]));require('./chatGroup.socket')[_0x4397('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4397('0x1c')][_0x4397('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3b6dfa,_0x1aa61f,_0x172ce2,_0x423224){return new BPromise(function(_0x4fa1fa,_0x428f3b){var _0x380666=_0x423224||client;return _0x380666[_0x4397('0x1e')](_0x3b6dfa,_0x172ce2)[_0x4397('0x1f')](function(_0x3a60c1){logger[_0x4397('0x20')](_0x4397('0x21'),_0x1aa61f,_0x4397('0x22'));logger[_0x4397('0x23')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1aa61f,'request\x20sent',JSON[_0x4397('0x24')](_0x3a60c1));if(_0x3a60c1[_0x4397('0x25')]){if(_0x3a60c1[_0x4397('0x25')][_0x4397('0x26')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1aa61f,_0x3a60c1[_0x4397('0x25')][_0x4397('0x27')]);return _0x428f3b(_0x3a60c1['error']['message']);}logger['error'](_0x4397('0x21'),_0x1aa61f,_0x3a60c1[_0x4397('0x25')]['message']);return _0x4fa1fa(_0x3a60c1[_0x4397('0x25')][_0x4397('0x27')]);}else{logger['info'](_0x4397('0x21'),_0x1aa61f,_0x4397('0x22'));_0x4fa1fa(_0x3a60c1[_0x4397('0x28')][_0x4397('0x27')]);}})['catch'](function(_0x514472){logger['error'](_0x4397('0x21'),_0x1aa61f,_0x514472);_0x428f3b(_0x514472);});});}function respondWithStatusCode(_0x404c69,_0x1d8f8e){_0x1d8f8e=_0x1d8f8e||0xcc;return function(_0x4fc725){if(_0x4fc725){return _0x404c69[_0x4397('0x29')](_0x1d8f8e);}return _0x404c69[_0x4397('0x2a')](_0x1d8f8e)[_0x4397('0x2b')]();};}function respondWithResult(_0xe78a54,_0x47161d){_0x47161d=_0x47161d||0xc8;return function(_0x1c224b){if(_0x1c224b){return _0xe78a54[_0x4397('0x2a')](_0x47161d)[_0x4397('0x2c')](_0x1c224b);}};}function respondWithFilteredResult(_0x73cad0,_0xc76066){return function(_0x550b0d){if(_0x550b0d){var _0x5291e9=_0x550b0d[_0x4397('0x2d')],_0x3ce44f=_0xc76066['offset'],_0x575536=_0xc76066[_0x4397('0x2e')]+_0xc76066[_0x4397('0x2f')],_0x3d6188;if(_0x575536>=_0x5291e9){_0x575536=_0x5291e9;_0x3d6188=0xc8;}else{_0x3d6188=0xce;}_0x73cad0[_0x4397('0x2a')](_0x3d6188);return _0x73cad0['set'](_0x4397('0x30'),_0x3ce44f+'-'+_0x575536+'/'+_0x5291e9)[_0x4397('0x2c')](_0x550b0d);}return null;};}function patchUpdates(_0x4302a5){return function(_0x4c94e9){try{jsonpatch[_0x4397('0x31')](_0x4c94e9,_0x4302a5,!![]);}catch(_0x48a27e){return BPromise[_0x4397('0x32')](_0x48a27e);}return _0x4c94e9['save']();};}function saveUpdates(_0xde4e77,_0x63f7e0){return function(_0x338519){if(_0x338519){return _0x338519[_0x4397('0x33')](_0xde4e77)[_0x4397('0x1f')](function(_0x2a7eb7){return _0x2a7eb7;});}return null;};}function removeEntity(_0x56af5c,_0x39e78b){return function(_0x22657d){if(_0x22657d){return _0x22657d['destroy']()['then'](function(){_0x56af5c['status'](0xcc)[_0x4397('0x2b')]();});}};}function handleEntityNotFound(_0x108f79,_0x29d98f){return function(_0x2219e3){if(!_0x2219e3){_0x108f79[_0x4397('0x29')](0x194);}return _0x2219e3;};}function handleError(_0x1ad3b0,_0x134523){_0x134523=_0x134523||0x1f4;return function(_0x4c9bad){logger['error'](_0x4c9bad[_0x4397('0x34')]);if(_0x4c9bad[_0x4397('0x35')]){delete _0x4c9bad[_0x4397('0x35')];}_0x1ad3b0[_0x4397('0x2a')](_0x134523)['send'](_0x4c9bad);};}exports[_0x4397('0x36')]=function(_0x26ed15,_0x463c7e){var _0x319b2f={},_0x4d88ad={},_0x5589c2={'count':0x0,'rows':[]};var _0x1b2160=_['map'](db[_0x4397('0x37')][_0x4397('0x38')],function(_0x1d46ef){return{'name':_0x1d46ef['fieldName'],'type':_0x1d46ef['type'][_0x4397('0x39')]};});_0x4d88ad[_0x4397('0x3a')]=_[_0x4397('0x3b')](_0x1b2160,_0x4397('0x35'));_0x4d88ad[_0x4397('0x3c')]=_[_0x4397('0x3d')](_0x26ed15['query']);_0x4d88ad['filters']=_[_0x4397('0x3e')](_0x4d88ad['model'],_0x4d88ad[_0x4397('0x3c')]);_0x319b2f[_0x4397('0x3f')]=_[_0x4397('0x3e')](_0x4d88ad[_0x4397('0x3a')],qs[_0x4397('0x40')](_0x26ed15[_0x4397('0x3c')]['fields']));_0x319b2f[_0x4397('0x3f')]=_0x319b2f[_0x4397('0x3f')]['length']?_0x319b2f[_0x4397('0x3f')]:_0x4d88ad[_0x4397('0x3a')];if(!_0x26ed15[_0x4397('0x3c')]['hasOwnProperty']('nolimit')){_0x319b2f[_0x4397('0x2f')]=qs['limit'](_0x26ed15[_0x4397('0x3c')][_0x4397('0x2f')]);_0x319b2f[_0x4397('0x2e')]=qs[_0x4397('0x2e')](_0x26ed15['query'][_0x4397('0x2e')]);}_0x319b2f[_0x4397('0x41')]=qs[_0x4397('0x42')](_0x26ed15[_0x4397('0x3c')][_0x4397('0x42')]);_0x319b2f[_0x4397('0x43')]=qs['filters'](_[_0x4397('0x44')](_0x26ed15[_0x4397('0x3c')],_0x4d88ad[_0x4397('0x45')]),_0x1b2160);if(_0x26ed15['query'][_0x4397('0x46')]){_0x319b2f[_0x4397('0x43')]=_[_0x4397('0x47')](_0x319b2f[_0x4397('0x43')],{'$or':_[_0x4397('0x3b')](_0x1b2160,function(_0x18f4e2){if(_0x18f4e2[_0x4397('0x48')]!=='VIRTUAL'){var _0x220e53={};_0x220e53[_0x18f4e2[_0x4397('0x35')]]={'$like':'%'+_0x26ed15[_0x4397('0x3c')]['filter']+'%'};return _0x220e53;}})});}_0x319b2f=_[_0x4397('0x47')]({},_0x319b2f,_0x26ed15[_0x4397('0x49')]);var _0x213b8a={'where':_0x319b2f[_0x4397('0x43')]};return db[_0x4397('0x37')][_0x4397('0x2d')](_0x213b8a)[_0x4397('0x1f')](function(_0x60bc33){_0x5589c2[_0x4397('0x2d')]=_0x60bc33;if(_0x26ed15[_0x4397('0x3c')]['includeAll']){_0x319b2f['include']=[{'all':!![]}];}return db[_0x4397('0x37')][_0x4397('0x4a')](_0x319b2f);})[_0x4397('0x1f')](function(_0x3dcffa){_0x5589c2[_0x4397('0x4b')]=_0x3dcffa;return _0x5589c2;})[_0x4397('0x1f')](respondWithFilteredResult(_0x463c7e,_0x319b2f))['catch'](handleError(_0x463c7e,null));};exports[_0x4397('0x4c')]=function(_0x2dc479,_0x5d095a){var _0x47904b={'raw':!![],'where':{'id':_0x2dc479[_0x4397('0x4d')]['id']}},_0x36041a={};_0x36041a[_0x4397('0x3a')]=_['keys'](db[_0x4397('0x37')][_0x4397('0x38')]);_0x36041a['query']=_[_0x4397('0x3d')](_0x2dc479['query']);_0x36041a[_0x4397('0x45')]=_['intersection'](_0x36041a[_0x4397('0x3a')],_0x36041a[_0x4397('0x3c')]);_0x47904b[_0x4397('0x3f')]=_[_0x4397('0x3e')](_0x36041a[_0x4397('0x3a')],qs[_0x4397('0x40')](_0x2dc479['query'][_0x4397('0x40')]));_0x47904b[_0x4397('0x3f')]=_0x47904b[_0x4397('0x3f')][_0x4397('0x4e')]?_0x47904b[_0x4397('0x3f')]:_0x36041a['model'];if(_0x2dc479[_0x4397('0x3c')][_0x4397('0x4f')]){_0x47904b[_0x4397('0x50')]=[{'all':!![]}];}_0x47904b=_[_0x4397('0x47')]({},_0x47904b,_0x2dc479[_0x4397('0x49')]);return db[_0x4397('0x37')][_0x4397('0x51')](_0x47904b)['then'](handleEntityNotFound(_0x5d095a,null))['then'](respondWithResult(_0x5d095a,null))[_0x4397('0x52')](handleError(_0x5d095a,null));};exports[_0x4397('0x53')]=function(_0xb1ae58,_0x33ba77){return db[_0x4397('0x37')][_0x4397('0x53')](_0xb1ae58[_0x4397('0x54')],{})[_0x4397('0x1f')](respondWithResult(_0x33ba77,0xc9))[_0x4397('0x52')](handleError(_0x33ba77,null));};exports['update']=function(_0x47c4f6,_0x4eda1b){if(_0x47c4f6[_0x4397('0x54')]['id']){delete _0x47c4f6[_0x4397('0x54')]['id'];}return db[_0x4397('0x37')][_0x4397('0x51')]({'where':{'id':_0x47c4f6[_0x4397('0x4d')]['id']}})[_0x4397('0x1f')](handleEntityNotFound(_0x4eda1b,null))['then'](saveUpdates(_0x47c4f6[_0x4397('0x54')],null))['then'](respondWithResult(_0x4eda1b,null))[_0x4397('0x52')](handleError(_0x4eda1b,null));};exports[_0x4397('0x55')]=function(_0x310c2a,_0x4016b1){return db['ChatGroup'][_0x4397('0x51')]({'where':{'id':_0x310c2a[_0x4397('0x4d')]['id']}})[_0x4397('0x1f')](handleEntityNotFound(_0x4016b1,null))['then'](removeEntity(_0x4016b1,null))['catch'](handleError(_0x4016b1,null));};exports[_0x4397('0x56')]=function(_0x28afc0,_0x237241){return db['ChatGroup'][_0x4397('0x56')]()[_0x4397('0x1f')](respondWithResult(_0x237241,null))[_0x4397('0x52')](handleError(_0x237241,null));};exports[_0x4397('0x57')]=function(_0x47d6e6,_0x553e8a,_0x1ac960){return db[_0x4397('0x58')][_0x4397('0x2d')]({'where':{'ChatGroupId':_0x47d6e6[_0x4397('0x4d')]['id'],'ToId':_0x47d6e6['user']['id'],'read':![]}})[_0x4397('0x1f')](function(_0x56ae09){return{'id':_[_0x4397('0x59')](_0x47d6e6[_0x4397('0x4d')]['id']),'count':_0x56ae09};})[_0x4397('0x1f')](respondWithResult(_0x553e8a,null))[_0x4397('0x52')](handleError(_0x553e8a,null));};exports[_0x4397('0x5a')]=function(_0x2474ca,_0x140c89,_0x34a1de){return db[_0x4397('0x37')][_0x4397('0x51')]({'where':{'id':_0x2474ca['params']['id']}})[_0x4397('0x1f')](handleEntityNotFound(_0x140c89,null))[_0x4397('0x1f')](function(_0x21755c){if(_0x21755c){return _0x21755c[_0x4397('0x5a')](_0x2474ca[_0x4397('0x54')]['ids'],_[_0x4397('0x5b')](_0x2474ca[_0x4397('0x54')],['ids','id'])||{});}})[_0x4397('0x1f')](respondWithResult(_0x140c89,null))['catch'](handleError(_0x140c89,null));};exports['getMembers']=function(_0x410f26,_0x715c7e,_0x251f5f){var _0x545f5e={};var _0x5ffcf4={};var _0x3be223;var _0x388fae;return db[_0x4397('0x37')][_0x4397('0x5c')]({'where':{'id':_0x410f26[_0x4397('0x4d')]['id']}})['then'](handleEntityNotFound(_0x715c7e,null))[_0x4397('0x1f')](function(_0x12e0e1){if(_0x12e0e1){_0x3be223=_0x12e0e1;_0x5ffcf4[_0x4397('0x3a')]=_['keys'](db[_0x4397('0x5d')][_0x4397('0x38')]);_0x5ffcf4[_0x4397('0x3c')]=_[_0x4397('0x3d')](_0x410f26['query']);_0x5ffcf4[_0x4397('0x45')]=_['intersection'](_0x5ffcf4[_0x4397('0x3a')],_0x5ffcf4['query']);_0x545f5e[_0x4397('0x3f')]=_[_0x4397('0x3e')](_0x5ffcf4[_0x4397('0x3a')],qs[_0x4397('0x40')](_0x410f26[_0x4397('0x3c')]['fields']));_0x545f5e[_0x4397('0x3f')]=_0x545f5e[_0x4397('0x3f')][_0x4397('0x4e')]?_0x545f5e['attributes']:_0x5ffcf4[_0x4397('0x3a')];_0x545f5e[_0x4397('0x41')]=qs[_0x4397('0x42')](_0x410f26[_0x4397('0x3c')][_0x4397('0x42')]);_0x545f5e[_0x4397('0x43')]=qs['filters'](_[_0x4397('0x44')](_0x410f26[_0x4397('0x3c')],_0x5ffcf4['filters']));if(_0x410f26[_0x4397('0x3c')][_0x4397('0x46')]){_0x545f5e['where']=_[_0x4397('0x47')](_0x545f5e['where'],{'$or':_[_0x4397('0x3b')](_0x545f5e['attributes'],function(_0x4ae258){var _0x11136d={};_0x11136d[_0x4ae258]={'$like':'%'+_0x410f26[_0x4397('0x3c')][_0x4397('0x46')]+'%'};return _0x11136d;})});}_0x545f5e=_[_0x4397('0x47')]({},_0x545f5e,_0x410f26[_0x4397('0x49')]);return _0x3be223[_0x4397('0x5e')](_0x545f5e);}})[_0x4397('0x1f')](function(_0x5b4582){if(_0x5b4582){_0x388fae=_0x5b4582[_0x4397('0x4e')];if(!_0x410f26[_0x4397('0x3c')][_0x4397('0x5f')]('nolimit')){_0x545f5e['limit']=qs[_0x4397('0x2f')](_0x410f26[_0x4397('0x3c')][_0x4397('0x2f')]);_0x545f5e[_0x4397('0x2e')]=qs[_0x4397('0x2e')](_0x410f26['query'][_0x4397('0x2e')]);}return _0x3be223[_0x4397('0x5e')](_0x545f5e);}})[_0x4397('0x1f')](function(_0x2abe0c){if(_0x2abe0c){return _0x2abe0c?{'count':_0x388fae,'rows':_0x2abe0c}:null;}})[_0x4397('0x1f')](respondWithResult(_0x715c7e,null))[_0x4397('0x52')](handleError(_0x715c7e,null));};exports['removeMembers']=function(_0x362cf4,_0x4140f1,_0x404670){return db['ChatGroup'][_0x4397('0x51')]({'where':{'id':_0x362cf4['params']['id']}})['then'](handleEntityNotFound(_0x4140f1,null))['then'](function(_0x29daed){if(_0x29daed){return _0x29daed[_0x4397('0x60')](_0x362cf4[_0x4397('0x3c')][_0x4397('0x61')]);}})[_0x4397('0x1f')](respondWithStatusCode(_0x4140f1,null))[_0x4397('0x52')](handleError(_0x4140f1,null));};exports['addMessage']=function(_0x540473,_0x31eb4f,_0x332823){if(_0x540473['body']['id']){delete _0x540473[_0x4397('0x54')]['id'];}return db['ChatGroup'][_0x4397('0x51')]({'where':{'id':_0x540473['params']['id']}})[_0x4397('0x1f')](handleEntityNotFound(_0x31eb4f,null))[_0x4397('0x1f')](function(_0x2e31c5){if(_0x2e31c5){_0x540473[_0x4397('0x54')][_0x4397('0x62')]=_0x2e31c5['id'];return db[_0x4397('0x58')][_0x4397('0x53')](_0x540473[_0x4397('0x54')]);}})[_0x4397('0x1f')](respondWithResult(_0x31eb4f,null))['catch'](handleError(_0x31eb4f,null));};exports['getMessages']=function(_0x130273,_0x22904a,_0x4a9f50){var _0x197c5b={};var _0x3c082a={};var _0xa6c879;var _0x15483e;return db[_0x4397('0x37')]['findOne']({'where':{'id':_0x130273[_0x4397('0x4d')]['id']}})[_0x4397('0x1f')](handleEntityNotFound(_0x22904a,null))[_0x4397('0x1f')](function(_0x138277){if(_0x138277){_0xa6c879=_0x138277;_0x3c082a[_0x4397('0x3a')]=_[_0x4397('0x3d')](db['ChatInternalMessage'][_0x4397('0x38')]);_0x3c082a[_0x4397('0x3c')]=_[_0x4397('0x3d')](_0x130273[_0x4397('0x3c')]);_0x3c082a[_0x4397('0x45')]=_[_0x4397('0x3e')](_0x3c082a[_0x4397('0x3a')],_0x3c082a[_0x4397('0x3c')]);_0x197c5b[_0x4397('0x3f')]=_[_0x4397('0x3e')](_0x3c082a[_0x4397('0x3a')],qs['fields'](_0x130273['query'][_0x4397('0x40')]));_0x197c5b[_0x4397('0x3f')]=_0x197c5b[_0x4397('0x3f')][_0x4397('0x4e')]?_0x197c5b['attributes']:_0x3c082a['model'];_0x197c5b[_0x4397('0x41')]=qs['sort'](_0x130273[_0x4397('0x3c')][_0x4397('0x42')]);_0x197c5b[_0x4397('0x43')]=qs[_0x4397('0x45')](_['pick'](_0x130273[_0x4397('0x3c')],_0x3c082a[_0x4397('0x45')]));if(_0x130273[_0x4397('0x3c')][_0x4397('0x46')]){_0x197c5b['where']=_['merge'](_0x197c5b[_0x4397('0x43')],{'$or':_['map'](_0x197c5b[_0x4397('0x3f')],function(_0x9a52c5){var _0x50a9de={};_0x50a9de[_0x9a52c5]={'$like':'%'+_0x130273[_0x4397('0x3c')]['filter']+'%'};return _0x50a9de;})});}if(_0x130273[_0x4397('0x3c')][_0x4397('0x63')]){var _0x18b225=_0x130273[_0x4397('0x3c')]['$gte']['split'](',');var _0x2e4b91={};_0x2e4b91[_0x18b225[0x0]]={'$gte':moment(_0x18b225[0x1])[_0x4397('0x64')](_0x4397('0x65'))};_0x197c5b['where']=_[_0x4397('0x47')](_0x197c5b[_0x4397('0x43')],_0x2e4b91);}_0x197c5b=_[_0x4397('0x47')]({},_0x197c5b,_0x130273[_0x4397('0x49')]);return _0xa6c879[_0x4397('0x66')](_0x197c5b);}})[_0x4397('0x1f')](function(_0x9b3d38){if(_0x9b3d38){_0x15483e=_0x9b3d38[_0x4397('0x4e')];if(!_0x130273[_0x4397('0x3c')][_0x4397('0x5f')]('nolimit')){_0x197c5b[_0x4397('0x2f')]=qs[_0x4397('0x2f')](_0x130273['query'][_0x4397('0x2f')]);_0x197c5b[_0x4397('0x2e')]=qs[_0x4397('0x2e')](_0x130273[_0x4397('0x3c')]['offset']);}return _0xa6c879['getMessages'](_0x197c5b);}})[_0x4397('0x1f')](function(_0x6c5026){if(_0x6c5026){return _0x6c5026?{'count':_0x15483e,'rows':_0x6c5026}:null;}})[_0x4397('0x1f')](respondWithResult(_0x22904a,null))[_0x4397('0x52')](handleError(_0x22904a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c77dd3b..2a4a215 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(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x2032,0xd9));var _0x2203=function(_0x20334b,_0x1c4df8){_0x20334b=_0x20334b-0x0;var _0x42e1bb=_0x2032[_0x20334b];return _0x42e1bb;};'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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x2032,0xd9));var _0x2203=function(_0x35673b,_0x837839){_0x35673b=_0x35673b-0x0;var _0x4ea020=_0x2032[_0x35673b];return _0x4ea020;};'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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 4c68b0d..0ce1f55 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 _0x3a32=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash'];(function(_0x262158,_0x3e3c22){var _0x158652=function(_0x224097){while(--_0x224097){_0x262158['push'](_0x262158['shift']());}};_0x158652(++_0x3e3c22);}(_0x3a32,0x9b));var _0x23a3=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x3a32[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var logger=require(_0x23a3('0x2'))(_0x23a3('0x3'));var moment=require(_0x23a3('0x4'));var BPromise=require(_0x23a3('0x5'));var rp=require(_0x23a3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23a3('0x7'));var attributes=require(_0x23a3('0x8'));module['exports']=function(_0x3b1735,_0x529b70){return _0x3b1735[_0x23a3('0x9')](_0x23a3('0xa'),attributes,{'tableName':_0x23a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x1a6007,_0x350755){var _0x120665=function(_0x51e6ba){while(--_0x51e6ba){_0x1a6007['push'](_0x1a6007['shift']());}};_0x120665(++_0x350755);}(_0xe8f7,0x137));var _0x7e8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe8f7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7e8f('0x0'));var util=require('util');var logger=require(_0x7e8f('0x1'))(_0x7e8f('0x2'));var moment=require(_0x7e8f('0x3'));var BPromise=require(_0x7e8f('0x4'));var rp=require(_0x7e8f('0x5'));var fs=require('fs');var path=require(_0x7e8f('0x6'));var rimraf=require(_0x7e8f('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x7e8f('0x8')]=function(_0x26595e,_0x4c084e){return _0x26595e[_0x7e8f('0x9')](_0x7e8f('0xa'),attributes,{'tableName':_0x7e8f('0xb'),'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 4c84f91..69d20ec 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 _0x1b90=['error','message','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x1b90,0xde));var _0x01b9=function(_0x20497e,_0x23a72a){_0x20497e=_0x20497e-0x0;var _0x2eb086=_0x1b90[_0x20497e];return _0x2eb086;};'use strict';var _=require(_0x01b9('0x0'));var util=require(_0x01b9('0x1'));var moment=require(_0x01b9('0x2'));var BPromise=require(_0x01b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x01b9('0x5'))(_0x01b9('0x6'));var config=require(_0x01b9('0x7'));var jayson=require(_0x01b9('0x8'));var client=jayson[_0x01b9('0x9')][_0x01b9('0xa')]({'port':0x232a});config[_0x01b9('0xb')]=_['defaults'](config[_0x01b9('0xb')],{'host':_0x01b9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01b9('0xb')]));require('./chatGroup.socket')[_0x01b9('0xd')](socket);function respondWithRpcPromise(_0x4056ef,_0x220f6b,_0x5c07d3){return new BPromise(function(_0xac67eb,_0x4fe814){return client[_0x01b9('0xe')](_0x4056ef,_0x5c07d3)[_0x01b9('0xf')](function(_0x20c255){logger[_0x01b9('0x10')](_0x01b9('0x11'),_0x220f6b,_0x01b9('0x12'));logger[_0x01b9('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x220f6b,_0x01b9('0x12'),JSON['stringify'](_0x20c255));if(_0x20c255['error']){if(_0x20c255[_0x01b9('0x14')]['code']===0x1f4){logger[_0x01b9('0x14')]('ChatGroup,\x20%s,\x20%s',_0x220f6b,_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);return _0x4fe814(_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);}logger[_0x01b9('0x14')](_0x01b9('0x11'),_0x220f6b,_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);return _0xac67eb(_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);}else{logger[_0x01b9('0x10')](_0x01b9('0x11'),_0x220f6b,_0x01b9('0x12'));_0xac67eb(_0x20c255['result'][_0x01b9('0x15')]);}})['catch'](function(_0x268237){logger[_0x01b9('0x14')](_0x01b9('0x11'),_0x220f6b,_0x268237);_0x4fe814(_0x268237);});});} \ No newline at end of file +var _0xef36=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef36,0x113));var _0x6ef3=function(_0x5b023a,_0x1d53ed){_0x5b023a=_0x5b023a-0x0;var _0x1cf13e=_0xef36[_0x5b023a];return _0x1cf13e;};'use strict';var _=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var moment=require(_0x6ef3('0x2'));var BPromise=require(_0x6ef3('0x3'));var rs=require(_0x6ef3('0x4'));var fs=require('fs');var Redis=require(_0x6ef3('0x5'));var db=require(_0x6ef3('0x6'))['db'];var utils=require(_0x6ef3('0x7'));var logger=require('../../config/logger')(_0x6ef3('0x8'));var config=require(_0x6ef3('0x9'));var jayson=require(_0x6ef3('0xa'));var client=jayson[_0x6ef3('0xb')][_0x6ef3('0xc')]({'port':0x232a});config[_0x6ef3('0xd')]=_[_0x6ef3('0xe')](config[_0x6ef3('0xd')],{'host':_0x6ef3('0xf'),'port':0x18eb});var socket=require(_0x6ef3('0x10'))(new Redis(config[_0x6ef3('0xd')]));require(_0x6ef3('0x11'))[_0x6ef3('0x12')](socket);function respondWithRpcPromise(_0x306bc1,_0xd98379,_0x3fb9f7){return new BPromise(function(_0x651e76,_0x23b22a){return client[_0x6ef3('0x13')](_0x306bc1,_0x3fb9f7)[_0x6ef3('0x14')](function(_0xc3f1b7){logger['info'](_0x6ef3('0x15'),_0xd98379,'request\x20sent');logger[_0x6ef3('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xd98379,'request\x20sent',JSON[_0x6ef3('0x17')](_0xc3f1b7));if(_0xc3f1b7[_0x6ef3('0x18')]){if(_0xc3f1b7['error']['code']===0x1f4){logger[_0x6ef3('0x18')]('ChatGroup,\x20%s,\x20%s',_0xd98379,_0xc3f1b7['error'][_0x6ef3('0x19')]);return _0x23b22a(_0xc3f1b7[_0x6ef3('0x18')][_0x6ef3('0x19')]);}logger['error'](_0x6ef3('0x15'),_0xd98379,_0xc3f1b7[_0x6ef3('0x18')]['message']);return _0x651e76(_0xc3f1b7['error']['message']);}else{logger[_0x6ef3('0x1a')](_0x6ef3('0x15'),_0xd98379,_0x6ef3('0x1b'));_0x651e76(_0xc3f1b7[_0x6ef3('0x1c')][_0x6ef3('0x19')]);}})['catch'](function(_0x1f8c94){logger[_0x6ef3('0x18')]('ChatGroup,\x20%s,\x20%s',_0xd98379,_0x1f8c94);_0x23b22a(_0x1f8c94);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3c9cb78..89ac2ba 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 _0xf05b=['./chatGroup.events','save','remove','update','removeListener','chatGroup:'];(function(_0x468fe2,_0x450e2e){var _0x340e7d=function(_0x5896d9){while(--_0x5896d9){_0x468fe2['push'](_0x468fe2['shift']());}};_0x340e7d(++_0x450e2e);}(_0xf05b,0x13e));var _0xbf05=function(_0x5349eb,_0x6329e3){_0x5349eb=_0x5349eb-0x0;var _0x307ea6=_0xf05b[_0x5349eb];return _0x307ea6;};'use strict';var ChatGroupEvents=require(_0xbf05('0x0'));var events=[_0xbf05('0x1'),_0xbf05('0x2'),_0xbf05('0x3')];function createListener(_0x1419b5,_0x2c1e47){return function(_0x4360b2){_0x2c1e47['emit'](_0x1419b5,_0x4360b2);};}function removeListener(_0x9b8253,_0x21e64a){return function(){ChatGroupEvents[_0xbf05('0x4')](_0x9b8253,_0x21e64a);};}exports['register']=function(_0x12726e){for(var _0x30dd8a=0x0,_0x3779cb=events['length'];_0x30dd8a<_0x3779cb;_0x30dd8a++){var _0x3e24e3=events[_0x30dd8a];var _0x4d391c=createListener(_0xbf05('0x5')+_0x3e24e3,_0x12726e);ChatGroupEvents['on'](_0x3e24e3,_0x4d391c);}}; \ No newline at end of file +var _0xe62b=['register','length','./chatGroup.events','save','remove','emit'];(function(_0x35191b,_0x5c4993){var _0x594b7d=function(_0x368506){while(--_0x368506){_0x35191b['push'](_0x35191b['shift']());}};_0x594b7d(++_0x5c4993);}(_0xe62b,0x1ac));var _0xbe62=function(_0x384eb2,_0x1a9317){_0x384eb2=_0x384eb2-0x0;var _0x1a2036=_0xe62b[_0x384eb2];return _0x1a2036;};'use strict';var ChatGroupEvents=require(_0xbe62('0x0'));var events=[_0xbe62('0x1'),_0xbe62('0x2'),'update'];function createListener(_0x4cf498,_0x2c8dd5){return function(_0x41a19c){_0x2c8dd5[_0xbe62('0x3')](_0x4cf498,_0x41a19c);};}function removeListener(_0x310725,_0x5834b9){return function(){ChatGroupEvents['removeListener'](_0x310725,_0x5834b9);};}exports[_0xbe62('0x4')]=function(_0x1c80da){for(var _0x566153=0x0,_0x1e85fb=events[_0xbe62('0x5')];_0x566153<_0x1e85fb;_0x566153++){var _0x38271d=events[_0x566153];var _0x28e9c7=createListener('chatGroup:'+_0x38271d,_0x1c80da);ChatGroupEvents['on'](_0x38271d,_0x28e9c7);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 79cc3b0..a6aa7fb 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 _0x429c=['removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','/:id','update','delete','destroy'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x429c,0x1bc));var _0xc429=function(_0x176eb5,_0x5ef548){_0x176eb5=_0x176eb5-0x0;var _0xf66001=_0x429c[_0x176eb5];return _0xf66001;};'use strict';var multer=require(_0xc429('0x0'));var util=require('util');var path=require(_0xc429('0x1'));var timeout=require(_0xc429('0x2'));var express=require(_0xc429('0x3'));var router=express[_0xc429('0x4')]();var auth=require(_0xc429('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc429('0x6'));var controller=require(_0xc429('0x7'));router[_0xc429('0x8')]('/',auth[_0xc429('0x9')](),controller[_0xc429('0xa')]);router[_0xc429('0x8')](_0xc429('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc429('0x8')]('/:id/unread',auth[_0xc429('0x9')](),controller[_0xc429('0xc')]);router[_0xc429('0x8')](_0xc429('0xd'),auth[_0xc429('0x9')](),controller['getMembers']);router[_0xc429('0x8')](_0xc429('0xe'),auth[_0xc429('0x9')](),controller[_0xc429('0xf')]);router[_0xc429('0x10')]('/',auth[_0xc429('0x9')](),controller[_0xc429('0x11')]);router[_0xc429('0x10')](_0xc429('0xd'),auth['isAuthenticated'](),controller[_0xc429('0x12')]);router[_0xc429('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc429('0x13')]);router['put'](_0xc429('0x14'),auth['isAuthenticated'](),controller[_0xc429('0x15')]);router[_0xc429('0x16')](_0xc429('0x14'),auth[_0xc429('0x9')](),controller[_0xc429('0x17')]);router[_0xc429('0x16')](_0xc429('0xd'),auth[_0xc429('0x9')](),controller[_0xc429('0x18')]);module[_0xc429('0x19')]=router; \ No newline at end of file +var _0x57f9=['index','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated'];(function(_0x1ff084,_0x35f3b8){var _0x5d5c6d=function(_0x2b1f99){while(--_0x2b1f99){_0x1ff084['push'](_0x1ff084['shift']());}};_0x5d5c6d(++_0x35f3b8);}(_0x57f9,0xff));var _0x957f=function(_0x5c1400,_0x4fa191){_0x5c1400=_0x5c1400-0x0;var _0x7585b0=_0x57f9[_0x5c1400];return _0x7585b0;};'use strict';var multer=require(_0x957f('0x0'));var util=require('util');var path=require(_0x957f('0x1'));var timeout=require(_0x957f('0x2'));var express=require(_0x957f('0x3'));var router=express[_0x957f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x957f('0x5'));var config=require('../../config/environment');var controller=require(_0x957f('0x6'));router[_0x957f('0x7')]('/',auth[_0x957f('0x8')](),controller[_0x957f('0x9')]);router['get']('/describe',auth[_0x957f('0x8')](),controller['describe']);router[_0x957f('0x7')]('/:id',auth[_0x957f('0x8')](),controller['show']);router[_0x957f('0x7')](_0x957f('0xa'),auth['isAuthenticated'](),controller['getUnread']);router['get'](_0x957f('0xb'),auth[_0x957f('0x8')](),controller[_0x957f('0xc')]);router['get'](_0x957f('0xd'),auth[_0x957f('0x8')](),controller[_0x957f('0xe')]);router[_0x957f('0xf')]('/',auth[_0x957f('0x8')](),controller[_0x957f('0x10')]);router[_0x957f('0xf')](_0x957f('0xb'),auth[_0x957f('0x8')](),controller[_0x957f('0x11')]);router['post'](_0x957f('0xd'),auth[_0x957f('0x8')](),controller['addMessage']);router[_0x957f('0x12')](_0x957f('0x13'),auth[_0x957f('0x8')](),controller[_0x957f('0x14')]);router[_0x957f('0x15')](_0x957f('0x13'),auth[_0x957f('0x8')](),controller[_0x957f('0x16')]);router[_0x957f('0x15')](_0x957f('0xb'),auth[_0x957f('0x8')](),controller['removeMembers']);module[_0x957f('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e979d3e..770fedd 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 _0xcca7=['ENUM','star','thumb','TEXT','STRING','DATE','out','exports','BOOLEAN'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcca7,0xe8));var _0x7cca=function(_0x419217,_0x1fe67f){_0x419217=_0x419217-0x0;var _0x234cea=_0xcca7[_0x419217];return _0x234cea;};'use strict';var Sequelize=require('sequelize');module[_0x7cca('0x0')]={'closed':{'type':Sequelize[_0x7cca('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x7cca('0x2')](_0x7cca('0x3'),_0x7cca('0x4')),'defaultValue':_0x7cca('0x3')},'ratingMessage':{'type':Sequelize[_0x7cca('0x5')]},'pathTranscript':{'type':Sequelize[_0x7cca('0x5')]},'mailTranscript':{'type':Sequelize[_0x7cca('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7cca('0x7')]},'disposition':{'type':Sequelize[_0x7cca('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7cca('0x6')]},'note':{'type':Sequelize[_0x7cca('0x6')]},'browserName':{'type':Sequelize[_0x7cca('0x6')]},'browserVersion':{'type':Sequelize[_0x7cca('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7cca('0x6')]},'deviceModel':{'type':Sequelize[_0x7cca('0x6')]},'deviceVendor':{'type':Sequelize[_0x7cca('0x6')]},'deviceType':{'type':Sequelize[_0x7cca('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7cca('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x7cca('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7cca('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7cca('0x2')]('in',_0x7cca('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7cca('0x6')]},'customerPort':{'type':Sequelize[_0x7cca('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x7cca('0x5')]}}; \ No newline at end of file +var _0x47fd=['INTEGER','ENUM','star','thumb','TEXT','DATE','STRING','out','sequelize','exports','BOOLEAN'];(function(_0x632aa4,_0x20076f){var _0x82b9d3=function(_0x11cf5c){while(--_0x11cf5c){_0x632aa4['push'](_0x632aa4['shift']());}};_0x82b9d3(++_0x20076f);}(_0x47fd,0x13c));var _0xd47f=function(_0x2d93d4,_0x149172){_0x2d93d4=_0x2d93d4-0x0;var _0x44df30=_0x47fd[_0x2d93d4];return _0x44df30;};'use strict';var Sequelize=require(_0xd47f('0x0'));module[_0xd47f('0x1')]={'closed':{'type':Sequelize[_0xd47f('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd47f('0x3')]},'ratingType':{'type':Sequelize[_0xd47f('0x4')](_0xd47f('0x5'),_0xd47f('0x6')),'defaultValue':_0xd47f('0x5')},'ratingMessage':{'type':Sequelize[_0xd47f('0x7')]},'pathTranscript':{'type':Sequelize[_0xd47f('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd47f('0x8')]},'disposition':{'type':Sequelize[_0xd47f('0x9')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd47f('0x9')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xd47f('0x9')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xd47f('0x9')]},'deviceVendor':{'type':Sequelize[_0xd47f('0x9')]},'deviceType':{'type':Sequelize[_0xd47f('0x9')]},'referer':{'type':Sequelize[_0xd47f('0x7')]},'customerIp':{'type':Sequelize[_0xd47f('0x9')]},'formData':{'type':Sequelize[_0xd47f('0x7')]('long')},'read1stAt':{'type':Sequelize[_0xd47f('0x8')]},'lastMsgAt':{'type':Sequelize[_0xd47f('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd47f('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd47f('0x9')]},'customerPort':{'type':Sequelize[_0xd47f('0x9')]},'vidaooSessionId':{'type':Sequelize[_0xd47f('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e7e73ee..3bee8a1 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 _0xcce8=['POST','MotionCWB:','follow','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','CmContact','Messages','agentAlias','System','%s%d','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','nolimit','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','alias','setTags','spread','emit','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','Account','Owner','get','mkdirSync','10px','40px','30px','%s\x20#%d','Chat','YYYY-MM-DD','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','tail','basename','createReadStream','pipe','createWriteStream','direction','firstName','renderFile','views','downloadInteraction.html','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','merge','ChatInteraction','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','sequelize','groupBy','ChatInteractionId','push','all','rows','show','params','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation'];(function(_0x4de738,_0x62487d){var _0x19632b=function(_0x39a513){while(--_0x39a513){_0x4de738['push'](_0x4de738['shift']());}};_0x19632b(++_0x62487d);}(_0xcce8,0x1a5));var _0x8cce=function(_0x5b2763,_0x45372a){_0x5b2763=_0x5b2763-0x0;var _0x4ffc7f=_0xcce8[_0x5b2763];return _0x4ffc7f;};'use strict';var pdf=require(_0x8cce('0x0'));var emlformat=require(_0x8cce('0x1'));var rimraf=require(_0x8cce('0x2'));var zipdir=require(_0x8cce('0x3'));var jsonpatch=require(_0x8cce('0x4'));var rp=require(_0x8cce('0x5'));var moment=require(_0x8cce('0x6'));var BPromise=require(_0x8cce('0x7'));var Mustache=require(_0x8cce('0x8'));var util=require(_0x8cce('0x9'));var path=require('path');var sox=require(_0x8cce('0xa'));var csv=require(_0x8cce('0xb'));var ejs=require(_0x8cce('0xc'));var fs=require('fs');var _=require(_0x8cce('0xd'));var squel=require(_0x8cce('0xe'));var crypto=require(_0x8cce('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8cce('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cce('0x11'));var qs=require(_0x8cce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cce('0x13'));var logger=require(_0x8cce('0x14'))(_0x8cce('0x15'));var utils=require('../../config/utils');var config=require(_0x8cce('0x16'));var licenseUtil=require(_0x8cce('0x17'));var db=require(_0x8cce('0x18'))['db'];config[_0x8cce('0x19')]=_['defaults'](config[_0x8cce('0x19')],{'host':_0x8cce('0x1a'),'port':0x18eb});var socket=require(_0x8cce('0x1b'))(new Redis(config[_0x8cce('0x19')]));require('./chatInteraction.socket')[_0x8cce('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8cce('0x1d')]({'port':0x232b});var client9004=jayson['client'][_0x8cce('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3e13e5,_0x13fa21,_0x17706c,_0xdbbfe3){return new BPromise(function(_0x251edd,_0xdf18b0){var _0x44fd50=_0xdbbfe3||client;return _0x44fd50[_0x8cce('0x1e')](_0x3e13e5,_0x17706c)[_0x8cce('0x1f')](function(_0x4f017b){logger[_0x8cce('0x20')](_0x8cce('0x21'),_0x13fa21,'request\x20sent');logger[_0x8cce('0x22')](_0x8cce('0x23'),_0x13fa21,_0x8cce('0x24'),JSON[_0x8cce('0x25')](_0x4f017b));if(_0x4f017b[_0x8cce('0x26')]){if(_0x4f017b['error'][_0x8cce('0x27')]===0x1f4){logger[_0x8cce('0x26')](_0x8cce('0x21'),_0x13fa21,_0x4f017b[_0x8cce('0x26')]['message']);return _0xdf18b0(_0x4f017b[_0x8cce('0x26')]['message']);}logger[_0x8cce('0x26')](_0x8cce('0x21'),_0x13fa21,_0x4f017b[_0x8cce('0x26')][_0x8cce('0x28')]);return _0x251edd(_0x4f017b['error'][_0x8cce('0x28')]);}else{logger[_0x8cce('0x20')](_0x8cce('0x21'),_0x13fa21,_0x8cce('0x24'));_0x251edd(_0x4f017b[_0x8cce('0x29')]['message']);}})[_0x8cce('0x2a')](function(_0x3e191d){logger[_0x8cce('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x13fa21,_0x3e191d);_0xdf18b0(_0x3e191d);});});}function respondWithStatusCode(_0x4d3260,_0x3b55c4){_0x3b55c4=_0x3b55c4||0xcc;return function(_0x592e11){if(_0x592e11){return _0x4d3260['sendStatus'](_0x3b55c4);}return _0x4d3260[_0x8cce('0x2b')](_0x3b55c4)[_0x8cce('0x2c')]();};}function respondWithResult(_0x2c2fe9,_0x2b82b8){_0x2b82b8=_0x2b82b8||0xc8;return function(_0x419c2b){if(_0x419c2b){return _0x2c2fe9[_0x8cce('0x2b')](_0x2b82b8)[_0x8cce('0x2d')](_0x419c2b);}};}function respondWithFilteredResult(_0x16d469,_0x28d61b){return function(_0x3b1c49){if(_0x3b1c49){var _0x4cb528=_0x3b1c49[_0x8cce('0x2e')],_0x41eb3c=_0x28d61b[_0x8cce('0x2f')],_0x18afd0=_0x28d61b['offset']+_0x28d61b[_0x8cce('0x30')],_0x445918;if(_0x18afd0>=_0x4cb528){_0x18afd0=_0x4cb528;_0x445918=0xc8;}else{_0x445918=0xce;}_0x16d469[_0x8cce('0x2b')](_0x445918);return _0x16d469[_0x8cce('0x31')](_0x8cce('0x32'),_0x41eb3c+'-'+_0x18afd0+'/'+_0x4cb528)[_0x8cce('0x2d')](_0x3b1c49);}return null;};}function patchUpdates(_0x4038a3){return function(_0x42b9f4){try{jsonpatch[_0x8cce('0x33')](_0x42b9f4,_0x4038a3,!![]);}catch(_0x3f8448){return BPromise[_0x8cce('0x34')](_0x3f8448);}return _0x42b9f4['save']();};}function saveUpdates(_0x45b363,_0x139207){return function(_0x48e120){if(_0x48e120){return _0x48e120[_0x8cce('0x35')](_0x45b363)[_0x8cce('0x1f')](function(_0x2f739e){return _0x2f739e;});}return null;};}function removeEntity(_0x42ccf1,_0x3ed4ea){return function(_0x45af8a){if(_0x45af8a){return _0x45af8a[_0x8cce('0x36')]()[_0x8cce('0x1f')](function(){_0x42ccf1[_0x8cce('0x2b')](0xcc)[_0x8cce('0x2c')]();});}};}function handleEntityNotFound(_0x5d1392,_0x1bded9){return function(_0x246636){if(!_0x246636){_0x5d1392[_0x8cce('0x37')](0x194);}return _0x246636;};}function handleError(_0x4b8cfc,_0x2c60b4){_0x2c60b4=_0x2c60b4||0x1f4;return function(_0x5f2004){logger[_0x8cce('0x26')](_0x5f2004[_0x8cce('0x38')]);if(_0x5f2004[_0x8cce('0x39')]){delete _0x5f2004['name'];}_0x4b8cfc[_0x8cce('0x2b')](_0x2c60b4)[_0x8cce('0x3a')](_0x5f2004);};}function getInteractionUsers(_0x9a8616,_0x302882){return new BPromise(function(_0x56d45e,_0x51462f){try{if(_0x302882[_0x9a8616['id']]){_0x9a8616[_0x8cce('0x3b')]=_[_0x8cce('0x3c')](_0x302882[_0x9a8616['id']],function(_0xd8b56b){return{'id':_0xd8b56b['id'],'fullname':_0xd8b56b[_0x8cce('0x3d')]};});}}catch(_0xaa7bab){_0x51462f(_0xaa7bab);}_0x56d45e(_0x9a8616);});}function getInteractionTags(_0x304686,_0xace26d){return new BPromise(function(_0x3189e2,_0x3c6267){try{if(_0x304686[_0x8cce('0x3e')]){_0x304686[_0x8cce('0x3f')]=[];_0x304686[_0x8cce('0x3e')]['split'](',')[_0x8cce('0x40')](function(_0x3a37f7){_0x304686['Tags']['push'](_0xace26d[_0x3a37f7]);});}delete _0x304686[_0x8cce('0x3e')];}catch(_0xfa44ae){_0x3c6267(_0xfa44ae);}_0x3189e2(_0x304686);});}function updateChatInteraction(_0x4ee788,_0x102448,_0x5769c6){return new BPromise(function(_0xaa2f89,_0x2786ce){return getInteractionUsers(_0x4ee788,_0x5769c6)['then'](function(_0x434091){return getInteractionTags(_0x434091,_0x102448);})[_0x8cce('0x1f')](function(_0x32e110){_0xaa2f89(_0x32e110);})[_0x8cce('0x2a')](function(_0x50d3d3){_0x2786ce(_0x50d3d3);});});}exports[_0x8cce('0x41')]=function(_0x208922,_0x3942cf){var _0x3d6ca3={},_0x399548={},_0x1b434a={'count':0x0,'rows':[]};var _0x1d3fd5=_['map'](db['ChatInteraction']['rawAttributes'],function(_0x1d6166){return{'name':_0x1d6166[_0x8cce('0x42')],'type':_0x1d6166[_0x8cce('0x43')][_0x8cce('0x44')]};});_0x399548[_0x8cce('0x45')]=_[_0x8cce('0x3c')](_0x1d3fd5,_0x8cce('0x39'));_0x399548[_0x8cce('0x46')]=_[_0x8cce('0x47')](_0x208922[_0x8cce('0x46')]);_0x399548[_0x8cce('0x48')]=_[_0x8cce('0x49')](_0x399548[_0x8cce('0x45')],_0x399548[_0x8cce('0x46')]);_0x3d6ca3['attributes']=_[_0x8cce('0x49')](_0x399548[_0x8cce('0x45')],qs[_0x8cce('0x4a')](_0x208922['query'][_0x8cce('0x4a')]));_0x3d6ca3[_0x8cce('0x4b')]=_0x3d6ca3[_0x8cce('0x4b')][_0x8cce('0x4c')]?_0x3d6ca3[_0x8cce('0x4b')]:_0x399548[_0x8cce('0x45')];if(!_0x208922[_0x8cce('0x46')][_0x8cce('0x4d')]('nolimit')){_0x3d6ca3[_0x8cce('0x30')]=qs[_0x8cce('0x30')](_0x208922['query'][_0x8cce('0x30')]);_0x3d6ca3['offset']=qs['offset'](_0x208922[_0x8cce('0x46')][_0x8cce('0x2f')]);}_0x3d6ca3['order']=qs[_0x8cce('0x4e')](_0x208922[_0x8cce('0x46')][_0x8cce('0x4e')]);_0x3d6ca3[_0x8cce('0x4f')]=qs[_0x8cce('0x48')](_[_0x8cce('0x50')](_0x208922[_0x8cce('0x46')],_0x399548[_0x8cce('0x48')]),_0x1d3fd5);var _0xd04185=[];var _0x5be9a2=squel[_0x8cce('0x51')]()[_0x8cce('0x52')]('id')['field'](_0x8cce('0x39'))[_0x8cce('0x52')](_0x8cce('0x53'))[_0x8cce('0x54')](_0x8cce('0x55'));var _0x21a00b=squel[_0x8cce('0x51')]()[_0x8cce('0x52')](_0x8cce('0x56'))['field'](_0x8cce('0x57'))[_0x8cce('0x52')]('ui.ChatInteractionId')['from'](_0x8cce('0x58'),'ui')[_0x8cce('0x59')]('users','u',_0x8cce('0x5a'));var _0x5d2b47=squel[_0x8cce('0x51')]()[_0x8cce('0x54')](_0x8cce('0x5b'),'i')[_0x8cce('0x59')](_0x8cce('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8cce('0x59')](_0x8cce('0x5d'),'o',_0x8cce('0x5e'))[_0x8cce('0x59')](_0x8cce('0x5f'),'a',_0x8cce('0x60'))[_0x8cce('0x59')]('chat_messages','me',_0x8cce('0x61'))[_0x8cce('0x59')](_0x8cce('0x62'),'it',_0x8cce('0x63'))[_0x8cce('0x59')]('tools_tags','t',_0x8cce('0x64'));var _0x3542fa=squel['expr']();var _0xc3f0c5=[];var _0x53706b=squel[_0x8cce('0x65')]();var _0x3309b7;if(_0x208922['query'][_0x8cce('0x66')]){_0x3309b7=as['parseSearch'](_0x208922['query'][_0x8cce('0x66')]);var _0x4a989b=_0x3309b7[_0x8cce('0x67')];for(var _0x53614b=0x0;_0x53614b<_0x3309b7['conditions'][_0x8cce('0x4c')];_0x53614b++){var _0x51f0cb=_0x3309b7['conditions'][_0x53614b];var _0x4db26c='i';var _0x536902=_[_0x8cce('0x68')](_0x1d3fd5,[_0x8cce('0x39'),_0x51f0cb[_0x8cce('0x52')]]);if(!_0x536902){switch(_0x51f0cb[_0x8cce('0x52')]){case _0x8cce('0x69'):if(_0x51f0cb[_0x8cce('0x6a')]==0x1){_0x5d2b47[_0x8cce('0x6b')]('`'+_0x51f0cb[_0x8cce('0x52')]+_0x8cce('0x6c'));}else{_0x5d2b47['having']('`'+_0x51f0cb['field']+_0x8cce('0x6d'));}break;case _0x8cce('0x6e'):if(_0x51f0cb[_0x8cce('0x6f')]==='$substring'){if(_0x51f0cb['value'][_0x8cce('0x70')]('\x20')[_0x8cce('0x4c')]>0x1){_0x3542fa[_0x4a989b](_0x8cce('0x71'),qs[_0x8cce('0x72')](_0x51f0cb['value']),null);}else{var _0x833fba='%'+_0x51f0cb[_0x8cce('0x6a')]+'%';_0x3542fa[_0x4a989b](_0x8cce('0x73'),_0x833fba,_0x833fba,_0x833fba);}}else{_0x536902=_['find'](_0x1d3fd5,[_0x8cce('0x39'),_0x8cce('0x74')]);_0x51f0cb[_0x8cce('0x52')]=_0x8cce('0x74');_0x1242a4=as[_0x8cce('0x75')](_0x4db26c,_0x536902[_0x8cce('0x43')],_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x2c')]);}break;case'Tag':var _0x35df13=_0x51f0cb[_0x8cce('0x6a')]['split'](',')[_0x8cce('0x3c')](function(_0x12c1fe){return Number(_0x12c1fe);});_0x35df13['forEach'](function(_0x43e61d){_0x53706b['or'](_0x8cce('0x78'),'%,'+_0x43e61d+',%');});_0xc3f0c5=_['union'](_0xc3f0c5,_0x35df13);break;case _0x8cce('0x79'):if(_0x51f0cb['operator']===_0x8cce('0x7a')){_0x3542fa[_0x4a989b](_0x8cce('0x7b'),'%'+_0x51f0cb[_0x8cce('0x6a')]+'%',null);}else{_0x536902=_[_0x8cce('0x68')](_0x1d3fd5,[_0x8cce('0x39'),_0x8cce('0x7c')]);_0x51f0cb['field']='UserId';_0x1242a4=as['buildExpression'](_0x4db26c,_0x536902[_0x8cce('0x43')],_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')]['end']);}break;case _0x8cce('0x7d'):_0x1242a4=as[_0x8cce('0x75')]('me',null,_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x2c')]);break;}}else{var _0x1242a4=as[_0x8cce('0x75')](_0x4db26c,_0x536902[_0x8cce('0x43')],_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x2c')]);}}}else{var _0x186c92=_(_0x208922[_0x8cce('0x46')])[_0x8cce('0x47')]()['map'](function(_0x157d6f){return _[_0x8cce('0x7e')](_0x1d3fd5,[_0x8cce('0x39'),_0x157d6f])?_0x157d6f:undefined;})['compact']()[_0x8cce('0x6a')]();if(!_['isEmpty'](_0x186c92)){_0x186c92[_0x8cce('0x40')](function(_0x4e1176){if(_0x4e1176==='ChatWebsiteId'){_0x5d2b47[_0x8cce('0x4f')](_0x8cce('0x7f'),[][_0x8cce('0x80')](_0x208922[_0x8cce('0x46')][_0x4e1176]));}else if(_0x4e1176===_0x8cce('0x81')){var _0x37edc8=JSON['parse'](_0x208922[_0x8cce('0x46')][_0x4e1176])[_0x8cce('0x82')];var _0x48ca19=JSON[_0x8cce('0x83')](_0x208922['query'][_0x4e1176])[_0x8cce('0x84')];_0x5d2b47[_0x8cce('0x4f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x37edc8,_0x48ca19);}else{if(_0x208922[_0x8cce('0x46')][_0x4e1176]===_0x8cce('0x85')){_0x5d2b47[_0x8cce('0x4f')]('i.'+_0x4e1176+'\x20IS\x20NULL');}else{_0x5d2b47[_0x8cce('0x4f')]('i.'+_0x4e1176+_0x8cce('0x86'),_0x208922[_0x8cce('0x46')][_0x4e1176]);}}});}if(_0x208922[_0x8cce('0x46')][_0x8cce('0x87')]){if(_0x208922['query'][_0x8cce('0x87')]==0x1){_0x5d2b47['having'](_0x8cce('0x88'));}else{_0x5d2b47[_0x8cce('0x6b')]('`unreadMessages`\x20>\x200');}}if(_0x208922[_0x8cce('0x46')]['tag']){_0xc3f0c5=_['isArray'](_0x208922[_0x8cce('0x46')][_0x8cce('0x89')])?_0x208922[_0x8cce('0x46')][_0x8cce('0x89')]:new Array(_0x208922['query'][_0x8cce('0x89')]);_0xc3f0c5[_0x8cce('0x40')](function(_0x4debbe){_0x53706b['or'](_0x8cce('0x78'),'%,'+_0x4debbe+',%');});}if(_0x208922['query'][_0x8cce('0x8a')]){var _0x50a9c=_0x208922['query']['filter'][_0x8cce('0x8b')]('\x5c','\x5c\x5c')[_0x8cce('0x8b')](/'/g,'\x27\x27');if(qs[_0x8cce('0x8c')](_0x50a9c)){_0x3542fa['or'](_0x8cce('0x8d'),_0x50a9c+'%');}else{_0x3542fa['or'](_0x8cce('0x8e'),qs['getFullTextValue'](_0x50a9c))['or'](_0x8cce('0x8f'),_0x50a9c+'%');}}}_0x5d2b47['where'](_0x3542fa);_0x5d2b47[_0x8cce('0x90')]('i.id');var _0x3f9ab4={'type':db[_0x8cce('0x91')][_0x8cce('0x92')][_0x8cce('0x93')],'raw':!![]};var _0x52f6eb=_0x5d2b47['clone']();_0x52f6eb['field']('i.id');_0x52f6eb[_0x8cce('0x52')](_0x8cce('0x94'),_0x8cce('0x69'));if(_0x3d6ca3[_0x8cce('0x95')]){_0x3d6ca3[_0x8cce('0x95')][_0x8cce('0x40')](function(_0x3001af){var _0x18ea62=_0x3001af[0x0]===_0x8cce('0x96')?_0x3001af[0x0]:'i.'+_0x3001af[0x0];_0x5d2b47[_0x8cce('0x95')](_0x18ea62,_0x3001af[0x1]===_0x8cce('0x97')?![]:!![]);});}if(!_[_0x8cce('0x98')](_0xc3f0c5)){_0x5d2b47[_0x8cce('0x6b')](_0x53706b);_0x52f6eb['where'](_0x8cce('0x99'),_0xc3f0c5);}BPromise['resolve']()[_0x8cce('0x1f')](function(){if(!_0x3309b7){if(_0x208922[_0x8cce('0x46')][_0x8cce('0x9a')]||_0x208922['query'][_0x8cce('0x9b')])return;_0x52f6eb[_0x8cce('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5d2b47['where'](_0x8cce('0x9c'));return;}if(_0x208922['user'][_0x8cce('0x9d')]!==_0x8cce('0x9e'))return;return _0x208922[_0x8cce('0x9f')][_0x8cce('0xa0')]({'attributes':['id'],'raw':!![]})[_0x8cce('0x1f')](function(_0x97dbdd){if(_[_0x8cce('0x98')](_0x97dbdd)){_0x52f6eb[_0x8cce('0x4f')](_0x8cce('0xa1'));_0x5d2b47['where'](_0x8cce('0xa1'));}else{_0x52f6eb['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x8cce('0x3c')](_0x97dbdd,'id'));_0x5d2b47[_0x8cce('0x4f')](_0x8cce('0x7f'),_[_0x8cce('0x3c')](_0x97dbdd,'id'));}});})['then'](function(){if(_0x208922[_0x8cce('0x9f')][_0x8cce('0x9d')]===_0x8cce('0x9e')&&!_0x3309b7&&!_0x208922[_0x8cce('0x46')][_0x8cce('0x9a')])return[];return db['sequelize']['query'](_0x52f6eb[_0x8cce('0xa2')](),_0x3f9ab4);})['then'](function(_0x21ea41){_0x1b434a[_0x8cce('0x2e')]=_0x21ea41['length'];if(_0x1b434a[_0x8cce('0x2e')]===0x0)return[];return db['sequelize'][_0x8cce('0x46')](_0x5be9a2[_0x8cce('0xa2')](),_0x3f9ab4)[_0x8cce('0x1f')](function(_0x410792){_0xd04185=_['keyBy'](_0x410792,'id');_0x3f9ab4=_[_0x8cce('0xa3')](_0x3f9ab4,{'model':db[_0x8cce('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x208922[_0x8cce('0x46')][_0x8cce('0x4a')]){_0x3d6ca3[_0x8cce('0x4b')][_0x8cce('0x40')](function(_0x52eec7){_0x5d2b47[_0x8cce('0x52')]('i.'+_0x52eec7);});}else{_0x5d2b47['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5d2b47['field']('a.key',_0x8cce('0xa5'));_0x5d2b47['field']('a.mandatoryDisposition',_0x8cce('0xa6'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xa7'),_0x8cce('0x96'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xa8'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xa9'),_0x8cce('0xaa'));_0x5d2b47[_0x8cce('0x52')]('c.lastName',_0x8cce('0xab'));_0x5d2b47[_0x8cce('0x52')]('c.email',_0x8cce('0xac'));_0x5d2b47['field'](_0x8cce('0xad'),_0x8cce('0xae'));_0x5d2b47['field'](_0x8cce('0xaf'),'Contact.mobile');_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xb0'),_0x8cce('0xb1'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xb2'),_0x8cce('0xb3'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xb4'),_0x8cce('0xb5'));_0x5d2b47['field'](_0x8cce('0xb6'),_0x8cce('0x3e'));}if(_0x3d6ca3['limit'])_0x5d2b47[_0x8cce('0x30')](_0x3d6ca3[_0x8cce('0x30')]);if(_0x3d6ca3['offset'])_0x5d2b47[_0x8cce('0x2f')](_0x3d6ca3['offset']);return db['sequelize'][_0x8cce('0x46')](_0x5d2b47[_0x8cce('0xa2')](),_0x3f9ab4);})[_0x8cce('0x1f')](function(_0x587629){_0x21a00b['where'](_0x8cce('0xb7'),_[_0x8cce('0x3c')](_0x587629,'id'));return db[_0x8cce('0xb8')][_0x8cce('0x46')](_0x21a00b[_0x8cce('0xa2')](),_0x3f9ab4)[_0x8cce('0x1f')](function(_0x21a4d0){var _0x4bcdf7=_[_0x8cce('0xb9')](_0x21a4d0,_0x8cce('0xba'));var _0x553a75=[];_0x587629[_0x8cce('0x40')](function(_0x411365){_0x553a75[_0x8cce('0xbb')](updateChatInteraction(_0x411365,_0xd04185,_0x4bcdf7));});return BPromise[_0x8cce('0xbc')](_0x553a75);});});})[_0x8cce('0x1f')](function(_0x401a37){_0x1b434a[_0x8cce('0xbd')]=_0x401a37;return _0x1b434a;})['then'](respondWithFilteredResult(_0x3942cf,_0x3d6ca3))[_0x8cce('0x2a')](handleError(_0x3942cf,null));};exports[_0x8cce('0xbe')]=function(_0x3ddea0,_0x4a073c){var _0x44d924={'raw':![],'where':{'id':_0x3ddea0[_0x8cce('0xbf')]['id']}},_0x368177={};_0x368177[_0x8cce('0x45')]=_[_0x8cce('0x47')](db[_0x8cce('0xa4')]['rawAttributes']);_0x368177['query']=_[_0x8cce('0x47')](_0x3ddea0[_0x8cce('0x46')]);_0x368177['filters']=_['intersection'](_0x368177[_0x8cce('0x45')],_0x368177['query']);_0x44d924[_0x8cce('0x4b')]=_['intersection'](_0x368177['model'],qs[_0x8cce('0x4a')](_0x3ddea0[_0x8cce('0x46')][_0x8cce('0x4a')]));_0x44d924[_0x8cce('0x4b')]=_0x44d924['attributes'][_0x8cce('0x4c')]?_0x44d924[_0x8cce('0x4b')]:_0x368177[_0x8cce('0x45')];if(_0x3ddea0[_0x8cce('0x46')]['includeAll']){_0x44d924[_0x8cce('0xc0')]=[{'all':!![]}];}_0x44d924=_[_0x8cce('0xa3')]({},_0x44d924,_0x3ddea0[_0x8cce('0xc1')]);return db[_0x8cce('0xa4')][_0x8cce('0x68')](_0x44d924)[_0x8cce('0x1f')](handleEntityNotFound(_0x4a073c,null))[_0x8cce('0x1f')](respondWithResult(_0x4a073c,null))[_0x8cce('0x2a')](handleError(_0x4a073c,null));};exports['create']=function(_0x5b377f,_0x5cd42c){return db[_0x8cce('0xa4')][_0x8cce('0xc2')](_0x5b377f['body'],{})['then'](respondWithResult(_0x5cd42c,0xc9))[_0x8cce('0x2a')](handleError(_0x5cd42c,null));};exports[_0x8cce('0x35')]=function(_0x5bd0e7,_0x44f549){if(_0x5bd0e7[_0x8cce('0x7d')]['id']){delete _0x5bd0e7['body']['id'];}return db[_0x8cce('0xa4')][_0x8cce('0x68')]({'where':{'id':_0x5bd0e7[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x44f549,null))['then'](saveUpdates(_0x5bd0e7[_0x8cce('0x7d')],null))[_0x8cce('0x1f')](respondWithResult(_0x44f549,null))[_0x8cce('0x2a')](handleError(_0x44f549,null));};exports[_0x8cce('0x36')]=function(_0x9d4aec,_0x34b6e4){return db[_0x8cce('0xa4')]['find']({'where':{'id':_0x9d4aec[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x34b6e4,null))[_0x8cce('0x1f')](removeEntity(_0x34b6e4,null))[_0x8cce('0x2a')](handleError(_0x34b6e4,null));};exports['describe']=function(_0x29968a,_0x4b5445){return db['ChatInteraction'][_0x8cce('0xc3')]()['then'](respondWithResult(_0x4b5445,null))[_0x8cce('0x2a')](handleError(_0x4b5445,null));};exports[_0x8cce('0xc4')]=function(_0x53781e,_0x290340){var _0x35445b=_0x53781e[_0x8cce('0xbf')]['id'];var _0x13dd22;var _0x2bc7b6;var _0x434929;return db[_0x8cce('0xa4')]['findOne']({'where':{'id':_0x35445b}})[_0x8cce('0x1f')](function(_0x4629fa){_0x13dd22=_0x4629fa;return db[_0x8cce('0xc5')][_0x8cce('0xc6')]({'where':{'id':_0x4629fa[_0x8cce('0x9a')]},'attributes':['id',_0x8cce('0xc7'),_0x8cce('0xc8')],'raw':!![]});})[_0x8cce('0x1f')](function(_0x5672f4){if(_0x5672f4&&_0x5672f4['vidaooApiKey']&&_0x5672f4[_0x8cce('0xc8')]){_0x2bc7b6=_0x5672f4;var _0x401a3b={'rejectUnauthorized':![],'method':_0x8cce('0xc9'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x5672f4[_0x8cce('0xc7')]},'body':{'name':_0x8cce('0xca')+_0x35445b},'redirect':_0x8cce('0xcb'),'json':!![]};return rp(_0x401a3b);}else{throw new db[(_0x8cce('0x91'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8cce('0x1f')](function(_0x5e729c){_0x434929=_0x5e729c;if(_0x434929['id']){var _0x1213fe={'body':_0x434929[_0x8cce('0xcc')],'ChatWebsiteId':_0x2bc7b6['id'],'ChatInteractionId':_0x13dd22['id'],'direction':_0x8cce('0xcd'),'UserId':_0x53781e[_0x8cce('0x9f')]['id']};return db[_0x8cce('0xce')][_0x8cce('0xc2')](_0x1213fe,{});}else{throw new db[(_0x8cce('0x91'))][(_0x8cce('0xcf'))](_0x8cce('0xd0'));}})['then'](function(){return _0x13dd22[_0x8cce('0xd1')]({'vidaooSessionId':_0x434929['id']});})[_0x8cce('0x1f')](respondWithResult(_0x290340,null))[_0x8cce('0x2a')](handleError(_0x290340,null));};exports['customUpdate']=function(_0x1327dc,_0x1e5e59){if(_0x1327dc[_0x8cce('0x7d')]['id']){delete _0x1327dc[_0x8cce('0x7d')]['id'];}return db[_0x8cce('0xa4')]['find']({'where':{'id':_0x1327dc['params']['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x1e5e59,null))[_0x8cce('0x1f')](saveUpdates(_0x1327dc['body'],null))[_0x8cce('0x1f')](respondWithResult(_0x1e5e59,null))['catch'](handleError(_0x1e5e59,null));};exports[_0x8cce('0xd2')]=function(_0x15404e,_0x404bbb,_0x3f9a41){if(_0x15404e[_0x8cce('0x7d')]['id']){delete _0x15404e[_0x8cce('0x7d')]['id'];}return db[_0x8cce('0xa4')]['find']({'where':{'id':_0x15404e[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](function(_0x29c98e){if(!_0x29c98e){logger[_0x8cce('0x26')](_0x8cce('0xd3'),_0x8cce('0xd2'),0x194,'entity\x20not\x20found');_0x404bbb[_0x8cce('0x37')](0x194);}else{if(_0x29c98e[_0x8cce('0x7c')]){throw new db['Sequelize'][(_0x8cce('0xcf'))](_0x8cce('0xd4'));}}return _0x29c98e;})[_0x8cce('0x1f')](function(_0x18bf93){if(_0x18bf93){return _0x18bf93[_0x8cce('0x35')]({'closed':_0x15404e[_0x8cce('0x7d')][_0x8cce('0xd5')],'disposition':_0x15404e[_0x8cce('0x7d')][_0x8cce('0xd6')]})[_0x8cce('0x1f')](function(_0x5c8d37){return _0x5c8d37;});}})[_0x8cce('0x1f')](function(_0x47b369){return respondWithRpcPromise(_0x8cce('0xd7'),_0x8cce('0xd2'),_0x15404e['body'],client9004);})[_0x8cce('0x1f')](respondWithResult(_0x404bbb,null))['catch'](handleError(_0x404bbb,null));};exports[_0x8cce('0xd8')]=function(_0x15cc93,_0xb1fbe0,_0x518528){_0x15cc93[_0x8cce('0x7d')][_0x8cce('0x39')]=_0x15cc93['file']['originalname'];_0x15cc93[_0x8cce('0x7d')]['basename']=_0x15cc93[_0x8cce('0xd9')][_0x8cce('0xda')];_0x15cc93['body'][_0x8cce('0x43')]=_0x15cc93[_0x8cce('0xd9')][_0x8cce('0xdb')];return db[_0x8cce('0xdc')][_0x8cce('0xc2')](_0x15cc93[_0x8cce('0x7d')])['then'](respondWithResult(_0xb1fbe0,0xc9))[_0x8cce('0x2a')](handleError(_0xb1fbe0,null));};exports[_0x8cce('0xdd')]=function(_0x35accf,_0x11fa93,_0x30986c){return db[_0x8cce('0xa4')]['findOne']({'where':{'id':_0x35accf[_0x8cce('0xbf')]['id']},'raw':!![]})[_0x8cce('0x1f')](handleEntityNotFound(_0x11fa93,null))[_0x8cce('0x1f')](function(_0x24b7f6){if(_0x24b7f6){if(_0x24b7f6[_0x8cce('0xd5')]){return _0x11fa93['status'](0x193)[_0x8cce('0x2d')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x8cce('0xc6')]({'where':{'id':_0x35accf['query'][_0x8cce('0xde')]},'raw':!![]})[_0x8cce('0x1f')](handleEntityNotFound(_0x11fa93,null));}})[_0x8cce('0x1f')](function(_0x1a975b){if(_0x1a975b){return _0x11fa93[_0x8cce('0xdf')](path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0xe2'),_0x1a975b['basename']));}})[_0x8cce('0x2a')](handleError(_0x11fa93,null));};exports[_0x8cce('0xe3')]=function(_0x41ecbc,_0x5a69d3){var _0x37179f=null;var _0x75c346=null;var _0xd25fc6=null;var _0x3f808f=null;if(_0x41ecbc[_0x8cce('0x7d')]['id']){delete _0x41ecbc['body']['id'];}if(_0x41ecbc['body'][_0x8cce('0xe4')]){_0x3f808f=path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0xe5'),util[_0x8cce('0xe6')](_0x8cce('0xe7'),Date['now']()));_0x41ecbc['body'][_0x8cce('0xe8')]=_0x3f808f;}return db[_0x8cce('0xa4')][_0x8cce('0x68')]({'where':{'id':_0x41ecbc[_0x8cce('0xbf')]['id']},'include':[{'model':db[_0x8cce('0xce')],'as':'Messages','include':[{'model':db['User'],'as':_0x8cce('0x79')}]}]})[_0x8cce('0x1f')](handleEntityNotFound(_0x5a69d3,null))[_0x8cce('0x1f')](saveUpdates(_0x41ecbc['body'],null))[_0x8cce('0x1f')](function(_0x49a9c0){if(_0x49a9c0){_0x37179f=_0x49a9c0;return db['ChatWebsite'][_0x8cce('0x68')]({'where':{'id':_0x37179f[_0x8cce('0x9a')]}});}})[_0x8cce('0x1f')](function(_0x3178ed){if(_0x3178ed){_0xd25fc6=_0x3178ed;return db[_0x8cce('0xe9')]['find']({'where':{'id':_0x37179f[_0x8cce('0x74')]}});}})[_0x8cce('0x1f')](function(_0x254d1c){if(_0x254d1c){_0x75c346=_0x254d1c;if(_0x3f808f){var _0x1c471e=null;for(var _0x49ec9f=0x1;_0x49ec9f<_0x37179f[_0x8cce('0xea')][_0x8cce('0x4c')];++_0x49ec9f){_0x1c471e=_0x37179f[_0x8cce('0xea')][_0x49ec9f];var _0x1f425a=_0x1c471e[_0x8cce('0x7c')]?util[_0x8cce('0xe6')]('%s%d',_0xd25fc6[_0x8cce('0xeb')],_0x1c471e[_0x8cce('0x7c')]):_0x8cce('0xec');var _0x23c2a2=_0x41ecbc[_0x8cce('0x7d')]['customer']||util[_0x8cce('0xe6')](_0x8cce('0xed'),'Visitor',_0x1c471e[_0x8cce('0x74')]);switch(_0xd25fc6['agentIdentifier']){case'website_alias':_0x1f425a=_0x1c471e['UserId']?util[_0x8cce('0xe6')](_0x8cce('0xed'),_0xd25fc6[_0x8cce('0xeb')],_0x1c471e['UserId']):_0x8cce('0xec');break;case _0x8cce('0xee'):_0x1f425a=_0x1c471e[_0x8cce('0x7c')]?_0x1c471e[_0x8cce('0x79')]['alias']||_0x1c471e[_0x8cce('0x79')][_0x8cce('0x3d')]:'System';break;case _0x8cce('0xef'):_0x1f425a=_0x1c471e[_0x8cce('0x7c')]?_0x1c471e['User']['fullname']:'System';break;default:_0x1f425a=_0x1c471e[_0x8cce('0x7c')]?util['format'](_0x8cce('0xed'),_0xd25fc6[_0x8cce('0xeb')],_0x1c471e[_0x8cce('0x7c')]):_0x8cce('0xec');}var _0x454677=util[_0x8cce('0xe6')](_0x8cce('0xf0'),moment(_0x1c471e['createdAt'])[_0x8cce('0xe6')](_0x8cce('0xf1')),_0x1c471e['direction']==='in'?_0x23c2a2:_0x1f425a,_0x1c471e['body']);if(!_0x1c471e[_0x8cce('0xf2')]){fs[_0x8cce('0xf3')](_0x3f808f,_0x454677);}}return db[_0x8cce('0xf4')][_0x8cce('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0x8cce('0xf5')],'as':_0x8cce('0xf6'),'raw':!![]}]});}}})[_0x8cce('0x1f')](function(_0x1f0cae){if(_0x1f0cae&&_0x1f0cae['Smtp']&&_0x41ecbc[_0x8cce('0x7d')]){var _0x40c098={'tls':{'rejectUnauthorized':![]}};if(_0x1f0cae['Smtp'][_0x8cce('0xf7')]){_0x40c098[_0x8cce('0xf7')]=_0x1f0cae[_0x8cce('0xf6')][_0x8cce('0xf7')];}else{_0x40c098[_0x8cce('0xf8')]=_0x1f0cae[_0x8cce('0xf6')]['host'];_0x40c098[_0x8cce('0xf9')]=_0x1f0cae['Smtp']['port'];_0x40c098[_0x8cce('0xfa')]=_0x1f0cae[_0x8cce('0xf6')]['secure'];}if(_0x1f0cae['Smtp'][_0x8cce('0xfb')]){_0x40c098[_0x8cce('0xfc')]={'user':_0x1f0cae['Smtp']['user'],'pass':_0x1f0cae[_0x8cce('0xf6')][_0x8cce('0xfd')]};}return respondWithRpcPromise('SendMail',_0x8cce('0xfe'),{'account':_0x40c098,'message':{'from':util[_0x8cce('0xe6')](_0x8cce('0xff'),_0x1f0cae[_0x8cce('0x39')],_0x1f0cae[_0x8cce('0x100')]||_0x1f0cae[_0x8cce('0xf6')][_0x8cce('0x9f')]),'to':_0x41ecbc[_0x8cce('0x7d')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x8cce('0xe6')](_0x8cce('0x101'),_0x41ecbc[_0x8cce('0x7d')][_0x8cce('0xe4')]),'attachments':[{'path':_0x3f808f}]}})['then'](function(){return _0x37179f;})['catch'](function(_0x21fc40){console[_0x8cce('0x26')](_0x21fc40);});}else{return _0x37179f;}})[_0x8cce('0x1f')](respondWithStatusCode(_0x5a69d3,0xc8))[_0x8cce('0x2a')](handleError(_0x5a69d3,null));};exports[_0x8cce('0x102')]=function(_0x1a5932,_0x40c97f,_0x40e24e){return db[_0x8cce('0xce')][_0x8cce('0x68')]({'where':{'id':_0x1a5932[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x40c97f,null))[_0x8cce('0x1f')](function(_0x500d28){if(_0x500d28){return _0x500d28[_0x8cce('0x102')](_0x1a5932[_0x8cce('0x7d')][_0x8cce('0x103')],_[_0x8cce('0x104')](_0x1a5932[_0x8cce('0x7d')],[_0x8cce('0x103'),'id'])||{});}})[_0x8cce('0x1f')](respondWithResult(_0x40c97f,null))['catch'](handleError(_0x40c97f,null));};exports[_0x8cce('0x105')]=function(_0x2ebfe6,_0x387686,_0x244a01){var _0x42cd93={'raw':![],'where':{}};var _0x51270f={};var _0x2d29ae={'count':0x0,'rows':[]};return db[_0x8cce('0xa4')][_0x8cce('0xc6')]({'where':{'id':_0x2ebfe6[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x387686,null))[_0x8cce('0x1f')](function(_0x49295a){if(_0x49295a){_0x51270f[_0x8cce('0x45')]=_[_0x8cce('0x47')](db[_0x8cce('0xce')][_0x8cce('0x106')]);_0x51270f[_0x8cce('0x46')]=_[_0x8cce('0x47')](_0x2ebfe6[_0x8cce('0x46')]);_0x51270f[_0x8cce('0x48')]=_[_0x8cce('0x49')](_0x51270f[_0x8cce('0x45')],_0x51270f[_0x8cce('0x46')]);_0x42cd93[_0x8cce('0x4b')]=_[_0x8cce('0x49')](_0x51270f[_0x8cce('0x45')],qs[_0x8cce('0x4a')](_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x4a')]));_0x42cd93[_0x8cce('0x4b')]=_0x42cd93[_0x8cce('0x4b')]['length']?_0x42cd93[_0x8cce('0x4b')]:_0x51270f[_0x8cce('0x45')];if(!_0x2ebfe6[_0x8cce('0x46')]['hasOwnProperty'](_0x8cce('0x107'))){_0x42cd93[_0x8cce('0x30')]=qs[_0x8cce('0x30')](_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x30')]);_0x42cd93[_0x8cce('0x2f')]=qs['offset'](_0x2ebfe6['query'][_0x8cce('0x2f')]);}_0x42cd93[_0x8cce('0x95')]=qs[_0x8cce('0x4e')](_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x4e')]);_0x42cd93['where']=qs['filters'](_['pick'](_0x2ebfe6['query'],_0x51270f[_0x8cce('0x48')]));_0x42cd93[_0x8cce('0x4f')]['ChatInteractionId']=_0x49295a['id'];if(_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x8a')]){_0x42cd93[_0x8cce('0x4f')]=_[_0x8cce('0xa3')](_0x42cd93['where'],{'$or':_['map'](_0x42cd93[_0x8cce('0x4b')],function(_0x37a3e8){var _0x1f0a80={};_0x1f0a80[_0x37a3e8]={'$like':'%'+_0x2ebfe6['query']['filter']+'%'};return _0x1f0a80;})});}if(_0x2ebfe6[_0x8cce('0x46')]['$gte']){var _0x26ace2=_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x82')][_0x8cce('0x70')](',');var _0x20cbb3={};_0x20cbb3[_0x26ace2[0x0]]={'$gte':moment(_0x26ace2[0x1])['format'](_0x8cce('0x108'))};_0x42cd93[_0x8cce('0x4f')]=_[_0x8cce('0xa3')](_0x42cd93['where'],_0x20cbb3);}_0x42cd93=_[_0x8cce('0xa3')]({},_0x42cd93,_0x2ebfe6[_0x8cce('0xc1')]);return db[_0x8cce('0xce')][_0x8cce('0x2e')]({'where':_0x42cd93['where']})[_0x8cce('0x1f')](function(_0x1b810c){_0x2d29ae[_0x8cce('0x2e')]=_0x1b810c;if(_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x109')]){_0x42cd93['include']=[{'all':!![]}];}return db[_0x8cce('0xce')][_0x8cce('0x10a')](_0x42cd93);})[_0x8cce('0x1f')](function(_0x594d73){_0x2d29ae['rows']=_0x594d73;return _0x2d29ae;});}})[_0x8cce('0x1f')](respondWithFilteredResult(_0x387686,_0x42cd93))[_0x8cce('0x2a')](handleError(_0x387686,null));};exports[_0x8cce('0x10b')]=function(_0x522db9,_0x578749,_0x25ab0c){var _0x4acc09={'where':{}},_0xf9dc9c={},_0x372b42={'count':0x0,'rows':[]};return db[_0x8cce('0xa4')]['findOne']({'where':{'id':_0x522db9['params']['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x578749,null))[_0x8cce('0x1f')](function(_0x2f860c){if(_0x2f860c){_0xf9dc9c[_0x8cce('0x45')]=_[_0x8cce('0x47')](db[_0x8cce('0xce')][_0x8cce('0x106')]);_0xf9dc9c[_0x8cce('0x46')]=_[_0x8cce('0x47')](_0x522db9[_0x8cce('0x46')]);_0xf9dc9c[_0x8cce('0x48')]=_[_0x8cce('0x49')](_0xf9dc9c[_0x8cce('0x45')],_0xf9dc9c[_0x8cce('0x46')]);_0x4acc09[_0x8cce('0x4b')]=_[_0x8cce('0x49')](_0xf9dc9c[_0x8cce('0x45')],qs[_0x8cce('0x4a')](_0x522db9[_0x8cce('0x46')]['fields']));_0x4acc09[_0x8cce('0x4b')]=_0x4acc09[_0x8cce('0x4b')][_0x8cce('0x4c')]?_0x4acc09[_0x8cce('0x4b')]:_0xf9dc9c[_0x8cce('0x45')];if(!_0x522db9[_0x8cce('0x46')][_0x8cce('0x4d')](_0x8cce('0x107'))){_0x4acc09[_0x8cce('0x30')]=qs[_0x8cce('0x30')](_0x522db9['query'][_0x8cce('0x30')]);_0x4acc09[_0x8cce('0x2f')]=qs[_0x8cce('0x2f')](_0x522db9[_0x8cce('0x46')][_0x8cce('0x2f')]);}_0x4acc09[_0x8cce('0x95')]=qs[_0x8cce('0x4e')](_0x522db9[_0x8cce('0x46')][_0x8cce('0x4e')]);_0x4acc09[_0x8cce('0x4f')]=qs[_0x8cce('0x48')](_[_0x8cce('0x50')](_0x522db9[_0x8cce('0x46')],_0xf9dc9c[_0x8cce('0x48')]));_0x4acc09[_0x8cce('0x4f')][_0x8cce('0xba')]=_0x2f860c['id'];if(_0x522db9[_0x8cce('0x46')]['filter']){_0x4acc09[_0x8cce('0x4f')]=_[_0x8cce('0xa3')](_0x4acc09[_0x8cce('0x4f')],{'$or':_[_0x8cce('0x3c')](_0x4acc09[_0x8cce('0x4b')],function(_0x14fcb9){var _0x27f175={};_0x27f175[_0x14fcb9]={'$like':'%'+_0x522db9[_0x8cce('0x46')][_0x8cce('0x8a')]+'%'};return _0x27f175;})});}_0x4acc09[_0x8cce('0x4f')][_0x8cce('0xf2')]=![];if(_0x522db9[_0x8cce('0x46')]['id']){_0x4acc09[_0x8cce('0x4f')]['id']={'$gt':_0x522db9[_0x8cce('0x46')]['id']};}_0x4acc09=_[_0x8cce('0xa3')]({},_0x4acc09,_0x522db9[_0x8cce('0xc1')]);return db[_0x8cce('0xce')][_0x8cce('0x2e')]({'where':_0x4acc09[_0x8cce('0x4f')]})['then'](function(_0x36b115){_0x372b42['count']=_0x36b115;_0x4acc09[_0x8cce('0xc0')]=[];if(_0x522db9['query']['includeAgent']){_0x4acc09['include'][_0x8cce('0xbb')]({'model':db['User'],'as':'User','attributes':['id','fullname',_0x8cce('0x10c')]});}if(_0x522db9[_0x8cce('0x46')][_0x8cce('0x109')]){_0x4acc09['include']=[{'all':!![]}];}return db['ChatMessage'][_0x8cce('0x10a')](_0x4acc09);})[_0x8cce('0x1f')](function(_0x26ebfa){_0x372b42['rows']=_0x26ebfa;return _0x372b42;});}})[_0x8cce('0x1f')](respondWithFilteredResult(_0x578749,_0x4acc09))[_0x8cce('0x2a')](handleError(_0x578749,null));};exports['addTags']=function(_0x3d2f0f,_0x23ab5b,_0x30f004){return db['ChatInteraction'][_0x8cce('0x68')]({'where':{'id':_0x3d2f0f[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x23ab5b,null))['then'](function(_0x8b6b33){if(_0x8b6b33){return _0x8b6b33[_0x8cce('0x10d')](_0x3d2f0f['body'][_0x8cce('0x103')],_[_0x8cce('0x104')](_0x3d2f0f['body'],[_0x8cce('0x103'),'id'])||{})[_0x8cce('0x10e')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8cce('0x39'),_0x8cce('0x53')],'where':{'id':_0x3d2f0f[_0x8cce('0x7d')]['ids']}});})['then'](function(_0x1bdbcb){socket[_0x8cce('0x10f')]('chatInteractionTags:save',{'id':Number(_0x3d2f0f[_0x8cce('0xbf')]['id']),'tags':_0x1bdbcb||[]});return{'id':Number(_0x3d2f0f['params']['id']),'tags':_0x1bdbcb||[]};});}})['then'](respondWithResult(_0x23ab5b,null))['catch'](handleError(_0x23ab5b,null));};exports[_0x8cce('0x110')]=function(_0x532dc4,_0x112df0,_0x20c781){return db[_0x8cce('0xa4')][_0x8cce('0x68')]({'where':{'id':_0x532dc4['params']['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x112df0,null))[_0x8cce('0x1f')](function(_0x2539f4){if(_0x2539f4){return _0x2539f4[_0x8cce('0x110')](_0x532dc4[_0x8cce('0x46')][_0x8cce('0x103')]);}})[_0x8cce('0x1f')](respondWithStatusCode(_0x112df0,null))[_0x8cce('0x2a')](handleError(_0x112df0,null));};exports[_0x8cce('0xdf')]=function(_0x5c2137,_0x90b9b8){var _0x31ab43=moment()[_0x8cce('0x111')]()['toString']();var _0xaa1a71=path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0x112'),_0x8cce('0x113'),_0x8cce('0x114'));var _0x5152fd=path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0x112'),_0x8cce('0x113'),_0x8cce('0x115'));var _0x585383=path[_0x8cce('0xe0')](_0xaa1a71,_0x31ab43);var _0x589603=util[_0x8cce('0xe6')](_0x8cce('0x116'),_0x5c2137[_0x8cce('0xbf')]['id'],_0x31ab43);var _0x506731=path[_0x8cce('0xe0')](_0xaa1a71,_0x589603);var _0x95f37f=[];_0x95f37f[_0x8cce('0xbb')]({'model':db[_0x8cce('0x79')],'as':_0x8cce('0x79'),'attributes':['id','fullname'],'raw':!![]});_0x95f37f['push']({'model':db[_0x8cce('0xe9')],'as':_0x8cce('0x6e'),'attributes':['id','firstName',_0x8cce('0x117')],'raw':!![]});if(_0x5c2137['query'][_0x8cce('0x115')]){_0x95f37f[_0x8cce('0xbb')]({'model':db['Attachment'],'as':_0x8cce('0xdc'),'raw':!![]});}var _0x7a68d=[{'model':db[_0x8cce('0xce')],'as':_0x8cce('0xea'),'attributes':['id',_0x8cce('0x7d'),'createdAt','direction',_0x8cce('0xf2'),_0x8cce('0x87')],'include':_0x95f37f}];_0x7a68d[_0x8cce('0xbb')]({'model':db[_0x8cce('0xc5')],'as':_0x8cce('0x118'),'attributes':['id','name']});_0x7a68d['push']({'model':db[_0x8cce('0x79')],'as':_0x8cce('0x119'),'attributes':['id','fullname']});return db['ChatInteraction']['find']({'where':{'id':_0x5c2137[_0x8cce('0xbf')]['id']},'include':_0x7a68d})['then'](handleEntityNotFound(_0x90b9b8,null))[_0x8cce('0x1f')](function(_0x1c5232){if(_0x1c5232){var _0x324248=_0x1c5232[_0x8cce('0x11a')]({'plain':!![]});fs[_0x8cce('0x11b')](_0x585383);var _0x2d6597={'format':'A4','border':_0x8cce('0x11c'),'header':{'height':_0x8cce('0x11d'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x8cce('0x11e'),'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[_0x8cce('0xe6')](_0x8cce('0x11f'),_0x8cce('0x120'),_0x324248['id']),moment()[_0x8cce('0xe6')](_0x8cce('0x121'))['toString']())}}};var _0x24f9ba={'channel':'Chat','account':_0x324248['Account'][_0x8cce('0x39')],'agent':_0x324248[_0x8cce('0x119')]?_0x324248['Owner']['fullname']:'N.A.','createdAt':moment(_0x324248[_0x8cce('0x81')])[_0x8cce('0xe6')](_0x8cce('0x108'))[_0x8cce('0xa2')](),'closedAt':_0x324248[_0x8cce('0xd5')]?moment(_0x324248[_0x8cce('0x122')])[_0x8cce('0xe6')](_0x8cce('0x108'))[_0x8cce('0xa2')]():'','disposition':_0x324248[_0x8cce('0xd6')],'chatInfo':{'browser':_0x324248[_0x8cce('0x123')],'os':_0x324248[_0x8cce('0x124')],'referer':_0x324248[_0x8cce('0x125')],'customerIp':_0x324248[_0x8cce('0x126')],'customerPort':_0x324248[_0x8cce('0x127')]?_0x324248[_0x8cce('0x127')]:_0x8cce('0x128')},'messages':_(_0x324248['Messages'])[_0x8cce('0x129')]()[_0x8cce('0x8a')]({'secret':![]})['map'](function(_0x42ddb7){if(_0x42ddb7['Attachment']){var _0x32e519=path['join'](_0x5152fd,_0x42ddb7[_0x8cce('0xdc')][_0x8cce('0x12a')]);if(fs['existsSync'](_0x32e519)){fs[_0x8cce('0x12b')](_0x32e519)[_0x8cce('0x12c')](fs[_0x8cce('0x12d')](path['join'](_0x585383,_0x42ddb7[_0x8cce('0xdc')][_0x8cce('0x12a')])));}}return{'date':moment(_0x42ddb7[_0x8cce('0x81')])[_0x8cce('0xe6')](_0x8cce('0x108'))[_0x8cce('0xa2')](),'sender':_0x42ddb7[_0x8cce('0x12e')]===_0x8cce('0xcd')?_0x42ddb7[_0x8cce('0x79')]?_0x42ddb7['User']['fullname']:_0x8cce('0xec'):_0x42ddb7['Contact'][_0x8cce('0x12f')]+(_0x42ddb7[_0x8cce('0x6e')][_0x8cce('0x117')]?'\x20'+_0x42ddb7[_0x8cce('0x6e')][_0x8cce('0x117')]:''),'body':_0x42ddb7[_0x8cce('0xdc')]?_0x42ddb7['Attachment'][_0x8cce('0x12a')]:_0x42ddb7[_0x8cce('0x7d')],'direction':_0x42ddb7['direction']===_0x8cce('0xcd')?'A':'C','secret':_0x42ddb7[_0x8cce('0xf2')],'read':_0x42ddb7[_0x8cce('0x87')],'attachment':_0x42ddb7[_0x8cce('0xdc')]};})[_0x8cce('0x6a')]()};return ejs[_0x8cce('0x130')](path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0x112'),_0x8cce('0x131'),_0x8cce('0x132')),{'interaction':_0x24f9ba})[_0x8cce('0x1f')](function(_0x59b7a){return new BPromise(function(_0x2fb16c,_0x16aaa6){pdf[_0x8cce('0xc2')](_0x59b7a,_0x2d6597)['toFile'](path[_0x8cce('0xe0')](_0x585383,_0x8cce('0x133')+_0x324248['id']+'-'+_0x31ab43+'.pdf'),function(_0x4261ef,_0x10fcc0){if(_0x4261ef)return _0x16aaa6(_0x4261ef);_0x2fb16c(_0x10fcc0);});});})[_0x8cce('0x1f')](function(){return new BPromise(function(_0xf836f2,_0x5a4994){zipdir(_0x585383,{'saveTo':_0x506731},function(_0xc76de6,_0x3be21d){if(_0xc76de6)return _0x5a4994(_0xc76de6);return _0xf836f2(_0x3be21d);});})[_0x8cce('0x1f')](function(){return new BPromise(function(_0x13aa09,_0x301a40){rimraf(_0x585383,function(_0x2fbc30){if(_0x2fbc30)_0x301a40(_0x2fbc30);return _0x13aa09();});});})[_0x8cce('0x1f')](function(){return _0x90b9b8[_0x8cce('0xdf')](_0x506731,_0x589603,function(_0x151a4b){if(_0x151a4b){console[_0x8cce('0x134')](_0x8cce('0x135'),_0x151a4b);}else{fs[_0x8cce('0x136')](_0x506731);}});});});}else{return _0x90b9b8[_0x8cce('0x37')](0xc8);}})['catch'](handleError(_0x90b9b8,null));}; \ No newline at end of file +var _0x974c=['it.ChatInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','length','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','ContactId','buildExpression','type','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','start','body','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','t.id\x20IN\x20?','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','push','rows','params','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','server/files/chat/upload/','format','transcript-%s.txt','Messages','CmContact','UserId','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','MailAccount','MailServerOut','Smtp','service','host','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','alias','setTags','omit','spread','emit','chatInteractionTags:save','removeTags','download','server','files','attachments','firstName','lastName','Owner','get','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Account','N.A.','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','out','renderFile','views','toFile','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','stack','name','send','map','fullname','TagIds','Tags','split','forEach','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','field','color','select','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x974c,0xd4));var _0xc974=function(_0x867a9b,_0x36efd0){_0x867a9b=_0x867a9b-0x0;var _0x59f303=_0x974c[_0x867a9b];return _0x59f303;};'use strict';var pdf=require(_0xc974('0x0'));var emlformat=require(_0xc974('0x1'));var rimraf=require(_0xc974('0x2'));var zipdir=require(_0xc974('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc974('0x4'));var moment=require(_0xc974('0x5'));var BPromise=require(_0xc974('0x6'));var Mustache=require('mustache');var util=require(_0xc974('0x7'));var path=require(_0xc974('0x8'));var sox=require(_0xc974('0x9'));var csv=require('to-csv');var ejs=require(_0xc974('0xa'));var fs=require('fs');var _=require(_0xc974('0xb'));var squel=require(_0xc974('0xc'));var crypto=require('crypto');var jsforce=require(_0xc974('0xd'));var deskjs=require(_0xc974('0xe'));var toCsv=require(_0xc974('0xf'));var querystring=require('querystring');var Papa=require(_0xc974('0x10'));var Redis=require(_0xc974('0x11'));var authService=require(_0xc974('0x12'));var qs=require(_0xc974('0x13'));var as=require(_0xc974('0x14'));var hardwareService=require(_0xc974('0x15'));var logger=require(_0xc974('0x16'))(_0xc974('0x17'));var utils=require('../../config/utils');var config=require(_0xc974('0x18'));var licenseUtil=require(_0xc974('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc974('0x1a')](config['redis'],{'host':_0xc974('0x1b'),'port':0x18eb});var socket=require(_0xc974('0x1c'))(new Redis(config[_0xc974('0x1d')]));require(_0xc974('0x1e'))['register'](socket);var jayson=require(_0xc974('0x1f'));var client=jayson[_0xc974('0x20')]['http']({'port':0x232b});var client9004=jayson[_0xc974('0x20')][_0xc974('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x1bc364,_0x3873db,_0x3e9d47,_0x356a82){return new BPromise(function(_0x229c5c,_0x276ec){var _0x31b8d8=_0x356a82||client;return _0x31b8d8[_0xc974('0x22')](_0x1bc364,_0x3e9d47)[_0xc974('0x23')](function(_0x36e377){logger['info'](_0xc974('0x24'),_0x3873db,_0xc974('0x25'));logger[_0xc974('0x26')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3873db,_0xc974('0x25'),JSON[_0xc974('0x27')](_0x36e377));if(_0x36e377[_0xc974('0x28')]){if(_0x36e377[_0xc974('0x28')][_0xc974('0x29')]===0x1f4){logger[_0xc974('0x28')](_0xc974('0x24'),_0x3873db,_0x36e377[_0xc974('0x28')][_0xc974('0x2a')]);return _0x276ec(_0x36e377[_0xc974('0x28')][_0xc974('0x2a')]);}logger[_0xc974('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x3873db,_0x36e377[_0xc974('0x28')][_0xc974('0x2a')]);return _0x229c5c(_0x36e377[_0xc974('0x28')][_0xc974('0x2a')]);}else{logger[_0xc974('0x2b')](_0xc974('0x24'),_0x3873db,_0xc974('0x25'));_0x229c5c(_0x36e377[_0xc974('0x2c')][_0xc974('0x2a')]);}})[_0xc974('0x2d')](function(_0x41d095){logger[_0xc974('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x3873db,_0x41d095);_0x276ec(_0x41d095);});});}function respondWithStatusCode(_0x4f09ee,_0x511b8f){_0x511b8f=_0x511b8f||0xcc;return function(_0x4ae691){if(_0x4ae691){return _0x4f09ee[_0xc974('0x2e')](_0x511b8f);}return _0x4f09ee[_0xc974('0x2f')](_0x511b8f)[_0xc974('0x30')]();};}function respondWithResult(_0x174346,_0x5971e0){_0x5971e0=_0x5971e0||0xc8;return function(_0xd7e485){if(_0xd7e485){return _0x174346[_0xc974('0x2f')](_0x5971e0)[_0xc974('0x31')](_0xd7e485);}};}function respondWithFilteredResult(_0x45627a,_0x107eec){return function(_0x465957){if(_0x465957){var _0xcd28d1=_0x465957[_0xc974('0x32')],_0x3977ff=_0x107eec[_0xc974('0x33')],_0x2c52b0=_0x107eec[_0xc974('0x33')]+_0x107eec[_0xc974('0x34')],_0x1a09be;if(_0x2c52b0>=_0xcd28d1){_0x2c52b0=_0xcd28d1;_0x1a09be=0xc8;}else{_0x1a09be=0xce;}_0x45627a[_0xc974('0x2f')](_0x1a09be);return _0x45627a[_0xc974('0x35')]('Content-Range',_0x3977ff+'-'+_0x2c52b0+'/'+_0xcd28d1)['json'](_0x465957);}return null;};}function patchUpdates(_0x1b2aef){return function(_0x3ee3f3){try{jsonpatch[_0xc974('0x36')](_0x3ee3f3,_0x1b2aef,!![]);}catch(_0x5319ef){return BPromise[_0xc974('0x37')](_0x5319ef);}return _0x3ee3f3['save']();};}function saveUpdates(_0x30bbc0,_0x65a177){return function(_0x3c925f){if(_0x3c925f){return _0x3c925f[_0xc974('0x38')](_0x30bbc0)['then'](function(_0x30fff0){return _0x30fff0;});}return null;};}function removeEntity(_0x3dbf81,_0x596116){return function(_0x38e0be){if(_0x38e0be){return _0x38e0be[_0xc974('0x39')]()[_0xc974('0x23')](function(){_0x3dbf81[_0xc974('0x2f')](0xcc)[_0xc974('0x30')]();});}};}function handleEntityNotFound(_0x278cf1,_0x19c339){return function(_0x19f990){if(!_0x19f990){_0x278cf1[_0xc974('0x2e')](0x194);}return _0x19f990;};}function handleError(_0x3437b9,_0x153a18){_0x153a18=_0x153a18||0x1f4;return function(_0x1df516){logger[_0xc974('0x28')](_0x1df516[_0xc974('0x3a')]);if(_0x1df516[_0xc974('0x3b')]){delete _0x1df516[_0xc974('0x3b')];}_0x3437b9[_0xc974('0x2f')](_0x153a18)[_0xc974('0x3c')](_0x1df516);};}function getInteractionUsers(_0x2aa32a,_0x4dc339){return new BPromise(function(_0x20c6e0,_0x1ab578){try{if(_0x4dc339[_0x2aa32a['id']]){_0x2aa32a['Users']=_[_0xc974('0x3d')](_0x4dc339[_0x2aa32a['id']],function(_0x582ecb){return{'id':_0x582ecb['id'],'fullname':_0x582ecb[_0xc974('0x3e')]};});}}catch(_0x20e56b){_0x1ab578(_0x20e56b);}_0x20c6e0(_0x2aa32a);});}function getInteractionTags(_0x2f87d6,_0x1ebe8d){return new BPromise(function(_0x4f0b03,_0x15f659){try{if(_0x2f87d6[_0xc974('0x3f')]){_0x2f87d6[_0xc974('0x40')]=[];_0x2f87d6[_0xc974('0x3f')][_0xc974('0x41')](',')[_0xc974('0x42')](function(_0xadb3dc){_0x2f87d6['Tags']['push'](_0x1ebe8d[_0xadb3dc]);});}delete _0x2f87d6[_0xc974('0x3f')];}catch(_0x504e89){_0x15f659(_0x504e89);}_0x4f0b03(_0x2f87d6);});}function updateChatInteraction(_0x9b405e,_0x23cd99,_0x32456b){return new BPromise(function(_0xfe574c,_0x9f0797){return getInteractionUsers(_0x9b405e,_0x32456b)['then'](function(_0x42f6a4){return getInteractionTags(_0x42f6a4,_0x23cd99);})[_0xc974('0x23')](function(_0x304462){_0xfe574c(_0x304462);})[_0xc974('0x2d')](function(_0x377442){_0x9f0797(_0x377442);});});}exports[_0xc974('0x43')]=function(_0x23f22e,_0xb14b21){var _0x490b86={},_0xb7ed3a={},_0xab2ee3={'count':0x0,'rows':[]};var _0x49fc81=_[_0xc974('0x3d')](db['ChatInteraction'][_0xc974('0x44')],function(_0x70d678){return{'name':_0x70d678[_0xc974('0x45')],'type':_0x70d678['type'][_0xc974('0x46')]};});_0xb7ed3a[_0xc974('0x47')]=_[_0xc974('0x3d')](_0x49fc81,_0xc974('0x3b'));_0xb7ed3a[_0xc974('0x48')]=_[_0xc974('0x49')](_0x23f22e[_0xc974('0x48')]);_0xb7ed3a[_0xc974('0x4a')]=_[_0xc974('0x4b')](_0xb7ed3a['model'],_0xb7ed3a['query']);_0x490b86[_0xc974('0x4c')]=_[_0xc974('0x4b')](_0xb7ed3a[_0xc974('0x47')],qs[_0xc974('0x4d')](_0x23f22e[_0xc974('0x48')]['fields']));_0x490b86['attributes']=_0x490b86[_0xc974('0x4c')]['length']?_0x490b86['attributes']:_0xb7ed3a[_0xc974('0x47')];if(!_0x23f22e[_0xc974('0x48')][_0xc974('0x4e')](_0xc974('0x4f'))){_0x490b86[_0xc974('0x34')]=qs[_0xc974('0x34')](_0x23f22e[_0xc974('0x48')][_0xc974('0x34')]);_0x490b86['offset']=qs[_0xc974('0x33')](_0x23f22e[_0xc974('0x48')][_0xc974('0x33')]);}_0x490b86[_0xc974('0x50')]=qs[_0xc974('0x51')](_0x23f22e[_0xc974('0x48')][_0xc974('0x51')]);_0x490b86['where']=qs[_0xc974('0x4a')](_[_0xc974('0x52')](_0x23f22e[_0xc974('0x48')],_0xb7ed3a[_0xc974('0x4a')]),_0x49fc81);var _0x5c7b8c=[];var _0x5aa6d1=squel['select']()[_0xc974('0x53')]('id')[_0xc974('0x53')]('name')['field'](_0xc974('0x54'))['from']('tools_tags');var _0x45809f=squel[_0xc974('0x55')]()[_0xc974('0x53')](_0xc974('0x56'))[_0xc974('0x53')](_0xc974('0x57'))[_0xc974('0x53')](_0xc974('0x58'))[_0xc974('0x59')](_0xc974('0x5a'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x30965c=squel[_0xc974('0x55')]()['from'](_0xc974('0x5b'),'i')['left_join'](_0xc974('0x5c'),'c',_0xc974('0x5d'))[_0xc974('0x5e')](_0xc974('0x5f'),'o',_0xc974('0x60'))[_0xc974('0x5e')]('chat_websites','a',_0xc974('0x61'))[_0xc974('0x5e')](_0xc974('0x62'),'me',_0xc974('0x63'))[_0xc974('0x5e')](_0xc974('0x64'),'it',_0xc974('0x65'))[_0xc974('0x5e')](_0xc974('0x66'),'t','t.id\x20=\x20it.TagId');var _0x582de7=squel['expr']();var _0x40f7=[];var _0x42fb8d=squel[_0xc974('0x67')]();var _0x54055a;if(_0x23f22e[_0xc974('0x48')]['search']){_0x54055a=as['parseSearch'](_0x23f22e[_0xc974('0x48')][_0xc974('0x68')]);var _0x5a0211=_0x54055a[_0xc974('0x69')];for(var _0x90a789=0x0;_0x90a789<_0x54055a['conditions'][_0xc974('0x6a')];_0x90a789++){var _0x4f7343=_0x54055a[_0xc974('0x6b')][_0x90a789];var _0x5cd94c='i';var _0x18037e=_['find'](_0x49fc81,[_0xc974('0x3b'),_0x4f7343['field']]);if(!_0x18037e){switch(_0x4f7343[_0xc974('0x53')]){case _0xc974('0x6c'):if(_0x4f7343['value']==0x1){_0x30965c[_0xc974('0x6d')]('`'+_0x4f7343[_0xc974('0x53')]+'`\x20=\x200');}else{_0x30965c[_0xc974('0x6d')]('`'+_0x4f7343[_0xc974('0x53')]+_0xc974('0x6e'));}break;case _0xc974('0x6f'):if(_0x4f7343[_0xc974('0x70')]===_0xc974('0x71')){if(_0x4f7343[_0xc974('0x72')]['split']('\x20')[_0xc974('0x6a')]>0x1){_0x582de7[_0x5a0211]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc974('0x73')](_0x4f7343['value']),null);}else{var _0x448ced='%'+_0x4f7343[_0xc974('0x72')]+'%';_0x582de7[_0x5a0211]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x448ced,_0x448ced,_0x448ced);}}else{_0x18037e=_['find'](_0x49fc81,[_0xc974('0x3b'),'ContactId']);_0x4f7343['field']=_0xc974('0x74');_0x52b437=as[_0xc974('0x75')](_0x5cd94c,_0x18037e[_0xc974('0x76')],_0x4f7343);_0x582de7[_0x5a0211](_0x52b437[_0xc974('0x77')],_0x52b437['value']['start'],_0x52b437[_0xc974('0x72')][_0xc974('0x30')]);}break;case _0xc974('0x78'):var _0x59e7d5=_0x4f7343[_0xc974('0x72')][_0xc974('0x41')](',')[_0xc974('0x3d')](function(_0x7e5c73){return Number(_0x7e5c73);});_0x59e7d5[_0xc974('0x42')](function(_0x4e39c6){_0x42fb8d['or'](_0xc974('0x79'),'%,'+_0x4e39c6+',%');});_0x40f7=_[_0xc974('0x7a')](_0x40f7,_0x59e7d5);break;case _0xc974('0x7b'):if(_0x4f7343[_0xc974('0x70')]===_0xc974('0x71')){_0x582de7[_0x5a0211](_0xc974('0x7c'),'%'+_0x4f7343[_0xc974('0x72')]+'%',null);}else{_0x18037e=_[_0xc974('0x7d')](_0x49fc81,[_0xc974('0x3b'),'UserId']);_0x4f7343[_0xc974('0x53')]='UserId';_0x52b437=as['buildExpression'](_0x5cd94c,_0x18037e[_0xc974('0x76')],_0x4f7343);_0x582de7[_0x5a0211](_0x52b437[_0xc974('0x77')],_0x52b437[_0xc974('0x72')][_0xc974('0x7e')],_0x52b437[_0xc974('0x72')][_0xc974('0x30')]);}break;case _0xc974('0x7f'):_0x52b437=as['buildExpression']('me',null,_0x4f7343);_0x582de7[_0x5a0211](_0x52b437['text'],_0x52b437[_0xc974('0x72')]['start'],_0x52b437[_0xc974('0x72')][_0xc974('0x30')]);break;}}else{var _0x52b437=as['buildExpression'](_0x5cd94c,_0x18037e[_0xc974('0x76')],_0x4f7343);_0x582de7[_0x5a0211](_0x52b437['text'],_0x52b437[_0xc974('0x72')][_0xc974('0x7e')],_0x52b437[_0xc974('0x72')][_0xc974('0x30')]);}}}else{var _0x5ae7a4=_(_0x23f22e[_0xc974('0x48')])['keys']()['map'](function(_0x59ecb9){return _['some'](_0x49fc81,[_0xc974('0x3b'),_0x59ecb9])?_0x59ecb9:undefined;})[_0xc974('0x80')]()[_0xc974('0x72')]();if(!_['isEmpty'](_0x5ae7a4)){_0x5ae7a4[_0xc974('0x42')](function(_0x54019b){if(_0x54019b==='ChatWebsiteId'){_0x30965c['where'](_0xc974('0x81'),[][_0xc974('0x82')](_0x23f22e[_0xc974('0x48')][_0x54019b]));}else if(_0x54019b===_0xc974('0x83')){var _0x1039ef=JSON[_0xc974('0x84')](_0x23f22e[_0xc974('0x48')][_0x54019b])[_0xc974('0x85')];var _0x448836=JSON[_0xc974('0x84')](_0x23f22e[_0xc974('0x48')][_0x54019b])[_0xc974('0x86')];_0x30965c[_0xc974('0x87')](_0xc974('0x88'),_0x1039ef,_0x448836);}else{if(_0x23f22e[_0xc974('0x48')][_0x54019b]==='null'){_0x30965c[_0xc974('0x87')]('i.'+_0x54019b+_0xc974('0x89'));}else{_0x30965c[_0xc974('0x87')]('i.'+_0x54019b+_0xc974('0x8a'),_0x23f22e[_0xc974('0x48')][_0x54019b]);}}});}if(_0x23f22e[_0xc974('0x48')][_0xc974('0x8b')]){if(_0x23f22e['query'][_0xc974('0x8b')]==0x1){_0x30965c[_0xc974('0x6d')]('`unreadMessages`\x20=\x200');}else{_0x30965c[_0xc974('0x6d')]('`unreadMessages`\x20>\x200');}}if(_0x23f22e[_0xc974('0x48')][_0xc974('0x8c')]){_0x40f7=_['isArray'](_0x23f22e['query'][_0xc974('0x8c')])?_0x23f22e[_0xc974('0x48')]['tag']:new Array(_0x23f22e[_0xc974('0x48')]['tag']);_0x40f7[_0xc974('0x42')](function(_0x300347){_0x42fb8d['or'](_0xc974('0x79'),'%,'+_0x300347+',%');});}if(_0x23f22e[_0xc974('0x48')]['filter']){var _0x364a2a=_0x23f22e[_0xc974('0x48')][_0xc974('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xc974('0x8e')](/'/g,'\x27\x27');if(qs[_0xc974('0x8f')](_0x364a2a)){_0x582de7['or']('i.id\x20LIKE\x20?',_0x364a2a+'%');}else{_0x582de7['or'](_0xc974('0x90'),qs[_0xc974('0x73')](_0x364a2a))['or'](_0xc974('0x91'),_0x364a2a+'%');}}}_0x30965c[_0xc974('0x87')](_0x582de7);_0x30965c[_0xc974('0x92')](_0xc974('0x93'));var _0x205a8b={'type':db[_0xc974('0x94')][_0xc974('0x95')][_0xc974('0x96')],'raw':!![]};var _0x17836b=_0x30965c[_0xc974('0x97')]();_0x17836b['field'](_0xc974('0x93'));_0x17836b['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc974('0x6c'));if(_0x490b86[_0xc974('0x50')]){_0x490b86[_0xc974('0x50')][_0xc974('0x42')](function(_0x81ef77){var _0x509c18=_0x81ef77[0x0]===_0xc974('0x98')?_0x81ef77[0x0]:'i.'+_0x81ef77[0x0];_0x30965c[_0xc974('0x50')](_0x509c18,_0x81ef77[0x1]===_0xc974('0x99')?![]:!![]);});}if(!_[_0xc974('0x9a')](_0x40f7)){_0x30965c['having'](_0x42fb8d);_0x17836b[_0xc974('0x87')](_0xc974('0x9b'),_0x40f7);}BPromise['resolve']()[_0xc974('0x23')](function(){if(!_0x54055a){if(_0x23f22e['query'][_0xc974('0x9c')]||_0x23f22e[_0xc974('0x48')][_0xc974('0x9d')])return;_0x17836b[_0xc974('0x87')](_0xc974('0x9e'));_0x30965c[_0xc974('0x87')](_0xc974('0x9e'));return;}if(_0x23f22e[_0xc974('0x9f')]['role']!==_0xc974('0xa0'))return;return _0x23f22e[_0xc974('0x9f')][_0xc974('0xa1')]({'attributes':['id'],'raw':!![]})[_0xc974('0x23')](function(_0x360ccf){if(_[_0xc974('0x9a')](_0x360ccf)){_0x17836b[_0xc974('0x87')](_0xc974('0xa2'));_0x30965c['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x17836b[_0xc974('0x87')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x360ccf,'id'));_0x30965c[_0xc974('0x87')]('i.ChatWebsiteId\x20IN\x20?',_[_0xc974('0x3d')](_0x360ccf,'id'));}});})[_0xc974('0x23')](function(){if(_0x23f22e['user']['role']===_0xc974('0xa0')&&!_0x54055a&&!_0x23f22e['query'][_0xc974('0x9c')])return[];return db[_0xc974('0xa3')][_0xc974('0x48')](_0x17836b[_0xc974('0xa4')](),_0x205a8b);})[_0xc974('0x23')](function(_0x52a66b){_0xab2ee3[_0xc974('0x32')]=_0x52a66b[_0xc974('0x6a')];if(_0xab2ee3[_0xc974('0x32')]===0x0)return[];return db['sequelize'][_0xc974('0x48')](_0x5aa6d1[_0xc974('0xa4')](),_0x205a8b)['then'](function(_0x446075){_0x5c7b8c=_[_0xc974('0xa5')](_0x446075,'id');_0x205a8b=_[_0xc974('0xa6')](_0x205a8b,{'model':db[_0xc974('0xa7')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x23f22e[_0xc974('0x48')][_0xc974('0x4d')]){_0x490b86['attributes']['forEach'](function(_0x4b2f38){_0x30965c[_0xc974('0x53')]('i.'+_0x4b2f38);});}else{_0x30965c[_0xc974('0x53')](_0xc974('0xa8'),_0xc974('0x6c'));_0x30965c[_0xc974('0x53')](_0xc974('0xa9'),'Account.key');_0x30965c[_0xc974('0x53')](_0xc974('0xaa'),_0xc974('0xab'));_0x30965c['field'](_0xc974('0xac'),_0xc974('0x98'));_0x30965c[_0xc974('0x53')]('i.*');_0x30965c['field'](_0xc974('0xad'),_0xc974('0xae'));_0x30965c[_0xc974('0x53')](_0xc974('0xaf'),_0xc974('0xb0'));_0x30965c[_0xc974('0x53')](_0xc974('0xb1'),_0xc974('0xb2'));_0x30965c[_0xc974('0x53')](_0xc974('0xb3'),'Contact.phone');_0x30965c[_0xc974('0x53')]('c.mobile',_0xc974('0xb4'));_0x30965c[_0xc974('0x53')](_0xc974('0xb5'),_0xc974('0xb6'));_0x30965c[_0xc974('0x53')](_0xc974('0xb7'),_0xc974('0xb8'));_0x30965c[_0xc974('0x53')](_0xc974('0xb9'),'Owner.internal');_0x30965c[_0xc974('0x53')](_0xc974('0xba'),_0xc974('0x3f'));}if(_0x490b86[_0xc974('0x34')])_0x30965c['limit'](_0x490b86[_0xc974('0x34')]);if(_0x490b86['offset'])_0x30965c[_0xc974('0x33')](_0x490b86['offset']);return db[_0xc974('0xa3')][_0xc974('0x48')](_0x30965c[_0xc974('0xa4')](),_0x205a8b);})[_0xc974('0x23')](function(_0x378392){_0x45809f[_0xc974('0x87')](_0xc974('0xbb'),_[_0xc974('0x3d')](_0x378392,'id'));return db[_0xc974('0xa3')][_0xc974('0x48')](_0x45809f['toString'](),_0x205a8b)[_0xc974('0x23')](function(_0x1cdee1){var _0x39af25=_[_0xc974('0xbc')](_0x1cdee1,'ChatInteractionId');var _0x3237e7=[];_0x378392[_0xc974('0x42')](function(_0x184470){_0x3237e7[_0xc974('0xbd')](updateChatInteraction(_0x184470,_0x5c7b8c,_0x39af25));});return BPromise['all'](_0x3237e7);});});})[_0xc974('0x23')](function(_0x1e9af8){_0xab2ee3[_0xc974('0xbe')]=_0x1e9af8;return _0xab2ee3;})[_0xc974('0x23')](respondWithFilteredResult(_0xb14b21,_0x490b86))[_0xc974('0x2d')](handleError(_0xb14b21,null));};exports['show']=function(_0xbc5a6,_0xe1ee25){var _0x9f3894={'raw':![],'where':{'id':_0xbc5a6[_0xc974('0xbf')]['id']}},_0x256d70={};_0x256d70[_0xc974('0x47')]=_[_0xc974('0x49')](db[_0xc974('0xa7')][_0xc974('0x44')]);_0x256d70[_0xc974('0x48')]=_[_0xc974('0x49')](_0xbc5a6[_0xc974('0x48')]);_0x256d70['filters']=_[_0xc974('0x4b')](_0x256d70[_0xc974('0x47')],_0x256d70[_0xc974('0x48')]);_0x9f3894[_0xc974('0x4c')]=_[_0xc974('0x4b')](_0x256d70['model'],qs['fields'](_0xbc5a6[_0xc974('0x48')][_0xc974('0x4d')]));_0x9f3894[_0xc974('0x4c')]=_0x9f3894['attributes'][_0xc974('0x6a')]?_0x9f3894[_0xc974('0x4c')]:_0x256d70['model'];if(_0xbc5a6[_0xc974('0x48')][_0xc974('0xc0')]){_0x9f3894[_0xc974('0xc1')]=[{'all':!![]}];}_0x9f3894=_['merge']({},_0x9f3894,_0xbc5a6[_0xc974('0xc2')]);return db[_0xc974('0xa7')][_0xc974('0x7d')](_0x9f3894)[_0xc974('0x23')](handleEntityNotFound(_0xe1ee25,null))['then'](respondWithResult(_0xe1ee25,null))[_0xc974('0x2d')](handleError(_0xe1ee25,null));};exports['create']=function(_0x4f5124,_0x37ddbb){return db[_0xc974('0xa7')][_0xc974('0xc3')](_0x4f5124[_0xc974('0x7f')],{})[_0xc974('0x23')](respondWithResult(_0x37ddbb,0xc9))[_0xc974('0x2d')](handleError(_0x37ddbb,null));};exports[_0xc974('0x38')]=function(_0x72d2f6,_0x877569){if(_0x72d2f6['body']['id']){delete _0x72d2f6[_0xc974('0x7f')]['id'];}return db[_0xc974('0xa7')][_0xc974('0x7d')]({'where':{'id':_0x72d2f6[_0xc974('0xbf')]['id']}})['then'](handleEntityNotFound(_0x877569,null))[_0xc974('0x23')](saveUpdates(_0x72d2f6['body'],null))[_0xc974('0x23')](respondWithResult(_0x877569,null))[_0xc974('0x2d')](handleError(_0x877569,null));};exports['destroy']=function(_0x414ef5,_0x87fea1){return db[_0xc974('0xa7')][_0xc974('0x7d')]({'where':{'id':_0x414ef5['params']['id']}})[_0xc974('0x23')](handleEntityNotFound(_0x87fea1,null))['then'](removeEntity(_0x87fea1,null))['catch'](handleError(_0x87fea1,null));};exports['describe']=function(_0x3f71eb,_0x5eab53){return db[_0xc974('0xa7')][_0xc974('0xc4')]()[_0xc974('0x23')](respondWithResult(_0x5eab53,null))[_0xc974('0x2d')](handleError(_0x5eab53,null));};exports[_0xc974('0xc5')]=function(_0x45acdb,_0xd3343e){var _0x38c848=_0x45acdb[_0xc974('0xbf')]['id'];var _0x46c702;var _0x2e002a;var _0x4cb3c1;return db['ChatInteraction'][_0xc974('0xc6')]({'where':{'id':_0x38c848}})['then'](function(_0x596f3b){_0x46c702=_0x596f3b;return db[_0xc974('0xc7')]['findOne']({'where':{'id':_0x596f3b['ChatWebsiteId']},'attributes':['id',_0xc974('0xc8'),_0xc974('0xc9')],'raw':!![]});})['then'](function(_0x574a84){if(_0x574a84&&_0x574a84['vidaooApiKey']&&_0x574a84[_0xc974('0xc9')]){_0x2e002a=_0x574a84;var _0x2765c6={'rejectUnauthorized':![],'method':_0xc974('0xca'),'uri':_0xc974('0xcb'),'headers':{'X-APIKEY':_0x574a84[_0xc974('0xc8')]},'body':{'name':_0xc974('0xcc')+_0x38c848},'redirect':_0xc974('0xcd'),'json':!![]};return rp(_0x2765c6);}else{throw new db[(_0xc974('0x94'))][(_0xc974('0xce'))](_0xc974('0xcf'));}})[_0xc974('0x23')](function(_0x1bfaf3){_0x4cb3c1=_0x1bfaf3;if(_0x4cb3c1['id']){var _0x2485a5={'body':_0x4cb3c1[_0xc974('0xd0')],'ChatWebsiteId':_0x2e002a['id'],'ChatInteractionId':_0x46c702['id'],'direction':'out','UserId':_0x45acdb['user']['id']};return db[_0xc974('0xd1')][_0xc974('0xc3')](_0x2485a5,{});}else{throw new db[(_0xc974('0x94'))][(_0xc974('0xce'))](_0xc974('0xd2'));}})[_0xc974('0x23')](function(){return _0x46c702[_0xc974('0xd3')]({'vidaooSessionId':_0x4cb3c1['id']});})['then'](respondWithResult(_0xd3343e,null))['catch'](handleError(_0xd3343e,null));};exports[_0xc974('0xd4')]=function(_0x32e749,_0x20706e){if(_0x32e749[_0xc974('0x7f')]['id']){delete _0x32e749[_0xc974('0x7f')]['id'];}return db['ChatInteraction'][_0xc974('0x7d')]({'where':{'id':_0x32e749['params']['id']}})[_0xc974('0x23')](handleEntityNotFound(_0x20706e,null))[_0xc974('0x23')](saveUpdates(_0x32e749[_0xc974('0x7f')],null))[_0xc974('0x23')](respondWithResult(_0x20706e,null))[_0xc974('0x2d')](handleError(_0x20706e,null));};exports[_0xc974('0xd5')]=function(_0x147b08,_0x497578,_0x55eead){if(_0x147b08[_0xc974('0x7f')]['id']){delete _0x147b08[_0xc974('0x7f')]['id'];}return db['ChatInteraction'][_0xc974('0x7d')]({'where':{'id':_0x147b08[_0xc974('0xbf')]['id']}})['then'](function(_0x3ff960){if(!_0x3ff960){logger[_0xc974('0x28')](_0xc974('0xd6'),_0xc974('0xd5'),0x194,_0xc974('0xd7'));_0x497578[_0xc974('0x2e')](0x194);}else{if(_0x3ff960['UserId']){throw new db['Sequelize']['ValidationError'](_0xc974('0xd8'));}}return _0x3ff960;})[_0xc974('0x23')](function(_0x14fc05){if(_0x14fc05){return _0x14fc05[_0xc974('0x38')]({'closed':_0x147b08['body'][_0xc974('0xd9')],'disposition':_0x147b08['body']['disposition']})[_0xc974('0x23')](function(_0x9e2932){return _0x9e2932;});}})['then'](function(_0x5b0362){return respondWithRpcPromise(_0xc974('0xda'),_0xc974('0xd5'),_0x147b08[_0xc974('0x7f')],client9004);})[_0xc974('0x23')](respondWithResult(_0x497578,null))[_0xc974('0x2d')](handleError(_0x497578,null));};exports[_0xc974('0xdb')]=function(_0x5b268f,_0x258946,_0x527cb3){_0x5b268f[_0xc974('0x7f')]['name']=_0x5b268f[_0xc974('0xdc')][_0xc974('0xdd')];_0x5b268f[_0xc974('0x7f')][_0xc974('0xde')]=_0x5b268f[_0xc974('0xdc')][_0xc974('0xdf')];_0x5b268f[_0xc974('0x7f')]['type']=_0x5b268f[_0xc974('0xdc')][_0xc974('0xe0')];return db['Attachment'][_0xc974('0xc3')](_0x5b268f[_0xc974('0x7f')])['then'](respondWithResult(_0x258946,0xc9))[_0xc974('0x2d')](handleError(_0x258946,null));};exports[_0xc974('0xe1')]=function(_0x563c51,_0xd9038,_0x4fbb29){return db['ChatInteraction']['findOne']({'where':{'id':_0x563c51[_0xc974('0xbf')]['id']},'raw':!![]})[_0xc974('0x23')](handleEntityNotFound(_0xd9038,null))[_0xc974('0x23')](function(_0x24fdaa){if(_0x24fdaa){if(_0x24fdaa[_0xc974('0xd9')]){return _0xd9038[_0xc974('0x2f')](0x193)['json']({'status':0x193,'message':_0xc974('0xe2')});}return db[_0xc974('0xe3')][_0xc974('0xc6')]({'where':{'id':_0x563c51[_0xc974('0x48')][_0xc974('0xe4')]},'raw':!![]})[_0xc974('0x23')](handleEntityNotFound(_0xd9038,null));}})[_0xc974('0x23')](function(_0x9f4bf7){if(_0x9f4bf7){return _0xd9038['download'](path[_0xc974('0xe5')](config[_0xc974('0xe6')],_0xc974('0xe7'),_0x9f4bf7['basename']));}})[_0xc974('0x2d')](handleError(_0xd9038,null));};exports['close']=function(_0x4c98c7,_0x44d491){var _0x32ff13=null;var _0x22970f=null;var _0x45d501=null;var _0x5afdf0=null;if(_0x4c98c7['body']['id']){delete _0x4c98c7[_0xc974('0x7f')]['id'];}if(_0x4c98c7[_0xc974('0x7f')]['mailTranscript']){_0x5afdf0=path[_0xc974('0xe5')](config['root'],_0xc974('0xe8'),util[_0xc974('0xe9')](_0xc974('0xea'),Date['now']()));_0x4c98c7[_0xc974('0x7f')]['pathTranscript']=_0x5afdf0;}return db[_0xc974('0xa7')][_0xc974('0x7d')]({'where':{'id':_0x4c98c7[_0xc974('0xbf')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xc974('0xeb'),'include':[{'model':db[_0xc974('0x7b')],'as':_0xc974('0x7b')}]}]})[_0xc974('0x23')](handleEntityNotFound(_0x44d491,null))['then'](saveUpdates(_0x4c98c7[_0xc974('0x7f')],null))[_0xc974('0x23')](function(_0x4b3448){if(_0x4b3448){_0x32ff13=_0x4b3448;return db[_0xc974('0xc7')]['find']({'where':{'id':_0x32ff13['ChatWebsiteId']}});}})['then'](function(_0x36860e){if(_0x36860e){_0x45d501=_0x36860e;return db[_0xc974('0xec')][_0xc974('0x7d')]({'where':{'id':_0x32ff13['ContactId']}});}})[_0xc974('0x23')](function(_0x2a03a4){if(_0x2a03a4){_0x22970f=_0x2a03a4;if(_0x5afdf0){var _0x392929=null;for(var _0x1b9e57=0x1;_0x1b9e57<_0x32ff13[_0xc974('0xeb')][_0xc974('0x6a')];++_0x1b9e57){_0x392929=_0x32ff13[_0xc974('0xeb')][_0x1b9e57];var _0x4888df=_0x392929[_0xc974('0xed')]?util[_0xc974('0xe9')]('%s%d',_0x45d501[_0xc974('0xee')],_0x392929[_0xc974('0xed')]):_0xc974('0xef');var _0x175617=_0x4c98c7[_0xc974('0x7f')][_0xc974('0xf0')]||util[_0xc974('0xe9')](_0xc974('0xf1'),_0xc974('0xf2'),_0x392929[_0xc974('0x74')]);switch(_0x45d501[_0xc974('0xf3')]){case'website_alias':_0x4888df=_0x392929[_0xc974('0xed')]?util[_0xc974('0xe9')](_0xc974('0xf1'),_0x45d501[_0xc974('0xee')],_0x392929['UserId']):'System';break;case _0xc974('0xf4'):_0x4888df=_0x392929[_0xc974('0xed')]?_0x392929[_0xc974('0x7b')]['alias']||_0x392929[_0xc974('0x7b')][_0xc974('0x3e')]:_0xc974('0xef');break;case _0xc974('0xf5'):_0x4888df=_0x392929[_0xc974('0xed')]?_0x392929[_0xc974('0x7b')][_0xc974('0x3e')]:_0xc974('0xef');break;default:_0x4888df=_0x392929['UserId']?util[_0xc974('0xe9')](_0xc974('0xf1'),_0x45d501['agentAlias'],_0x392929[_0xc974('0xed')]):_0xc974('0xef');}var _0x4b69b2=util[_0xc974('0xe9')](_0xc974('0xf6'),moment(_0x392929[_0xc974('0x83')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x392929[_0xc974('0xf7')]==='in'?_0x175617:_0x4888df,_0x392929['body']);if(!_0x392929[_0xc974('0xf8')]){fs['appendFileSync'](_0x5afdf0,_0x4b69b2);}}return db[_0xc974('0xf9')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xc974('0xfa')],'as':'Smtp','raw':!![]}]});}}})['then'](function(_0x3e047a){if(_0x3e047a&&_0x3e047a['Smtp']&&_0x4c98c7[_0xc974('0x7f')]){var _0x47c8e7={'tls':{'rejectUnauthorized':![]}};if(_0x3e047a[_0xc974('0xfb')]['service']){_0x47c8e7[_0xc974('0xfc')]=_0x3e047a[_0xc974('0xfb')][_0xc974('0xfc')];}else{_0x47c8e7[_0xc974('0xfd')]=_0x3e047a['Smtp'][_0xc974('0xfd')];_0x47c8e7['port']=_0x3e047a[_0xc974('0xfb')]['port'];_0x47c8e7[_0xc974('0xfe')]=_0x3e047a[_0xc974('0xfb')]['secure'];}if(_0x3e047a[_0xc974('0xfb')][_0xc974('0xff')]){_0x47c8e7[_0xc974('0x100')]={'user':_0x3e047a[_0xc974('0xfb')][_0xc974('0x9f')],'pass':_0x3e047a[_0xc974('0xfb')]['pass']};}return respondWithRpcPromise(_0xc974('0x101'),_0xc974('0x102'),{'account':_0x47c8e7,'message':{'from':util[_0xc974('0xe9')](_0xc974('0x103'),_0x3e047a[_0xc974('0x3b')],_0x3e047a[_0xc974('0x104')]||_0x3e047a[_0xc974('0xfb')][_0xc974('0x9f')]),'to':_0x4c98c7[_0xc974('0x7f')][_0xc974('0x105')],'subject':_0xc974('0x106'),'text':util['format'](_0xc974('0x107'),_0x4c98c7[_0xc974('0x7f')][_0xc974('0x105')]),'attachments':[{'path':_0x5afdf0}]}})[_0xc974('0x23')](function(){return _0x32ff13;})[_0xc974('0x2d')](function(_0x4d152d){console[_0xc974('0x28')](_0x4d152d);});}else{return _0x32ff13;}})[_0xc974('0x23')](respondWithStatusCode(_0x44d491,0xc8))[_0xc974('0x2d')](handleError(_0x44d491,null));};exports[_0xc974('0x108')]=function(_0x19fef1,_0x2ea33a,_0x21bd76){return db[_0xc974('0xd1')]['find']({'where':{'id':_0x19fef1[_0xc974('0xbf')]['id']}})[_0xc974('0x23')](handleEntityNotFound(_0x2ea33a,null))[_0xc974('0x23')](function(_0x2bf0e2){if(_0x2bf0e2){return _0x2bf0e2['addMessage'](_0x19fef1[_0xc974('0x7f')]['ids'],_['omit'](_0x19fef1['body'],[_0xc974('0x109'),'id'])||{});}})[_0xc974('0x23')](respondWithResult(_0x2ea33a,null))[_0xc974('0x2d')](handleError(_0x2ea33a,null));};exports[_0xc974('0x10a')]=function(_0xc58622,_0x280891,_0x5a25e4){var _0x29c5c6={'raw':![],'where':{}};var _0x433314={};var _0x66c7a1={'count':0x0,'rows':[]};return db[_0xc974('0xa7')][_0xc974('0xc6')]({'where':{'id':_0xc58622[_0xc974('0xbf')]['id']}})[_0xc974('0x23')](handleEntityNotFound(_0x280891,null))[_0xc974('0x23')](function(_0x3b9d0b){if(_0x3b9d0b){_0x433314['model']=_[_0xc974('0x49')](db['ChatMessage'][_0xc974('0x44')]);_0x433314[_0xc974('0x48')]=_[_0xc974('0x49')](_0xc58622['query']);_0x433314['filters']=_[_0xc974('0x4b')](_0x433314['model'],_0x433314[_0xc974('0x48')]);_0x29c5c6[_0xc974('0x4c')]=_['intersection'](_0x433314[_0xc974('0x47')],qs['fields'](_0xc58622['query'][_0xc974('0x4d')]));_0x29c5c6['attributes']=_0x29c5c6[_0xc974('0x4c')][_0xc974('0x6a')]?_0x29c5c6[_0xc974('0x4c')]:_0x433314['model'];if(!_0xc58622[_0xc974('0x48')][_0xc974('0x4e')](_0xc974('0x4f'))){_0x29c5c6[_0xc974('0x34')]=qs[_0xc974('0x34')](_0xc58622[_0xc974('0x48')]['limit']);_0x29c5c6['offset']=qs[_0xc974('0x33')](_0xc58622['query'][_0xc974('0x33')]);}_0x29c5c6[_0xc974('0x50')]=qs[_0xc974('0x51')](_0xc58622[_0xc974('0x48')][_0xc974('0x51')]);_0x29c5c6[_0xc974('0x87')]=qs[_0xc974('0x4a')](_['pick'](_0xc58622[_0xc974('0x48')],_0x433314['filters']));_0x29c5c6[_0xc974('0x87')][_0xc974('0x10b')]=_0x3b9d0b['id'];if(_0xc58622[_0xc974('0x48')]['filter']){_0x29c5c6[_0xc974('0x87')]=_['merge'](_0x29c5c6[_0xc974('0x87')],{'$or':_['map'](_0x29c5c6[_0xc974('0x4c')],function(_0x21c514){var _0x1623e3={};_0x1623e3[_0x21c514]={'$like':'%'+_0xc58622[_0xc974('0x48')][_0xc974('0x8d')]+'%'};return _0x1623e3;})});}if(_0xc58622['query'][_0xc974('0x85')]){var _0x28c7d2=_0xc58622[_0xc974('0x48')][_0xc974('0x85')]['split'](',');var _0x43bc73={};_0x43bc73[_0x28c7d2[0x0]]={'$gte':moment(_0x28c7d2[0x1])[_0xc974('0xe9')](_0xc974('0x10c'))};_0x29c5c6[_0xc974('0x87')]=_[_0xc974('0xa6')](_0x29c5c6['where'],_0x43bc73);}_0x29c5c6=_[_0xc974('0xa6')]({},_0x29c5c6,_0xc58622[_0xc974('0xc2')]);return db[_0xc974('0xd1')][_0xc974('0x32')]({'where':_0x29c5c6['where']})[_0xc974('0x23')](function(_0x4da5d7){_0x66c7a1[_0xc974('0x32')]=_0x4da5d7;if(_0xc58622['query']['includeAll']){_0x29c5c6[_0xc974('0xc1')]=[{'all':!![]}];}return db[_0xc974('0xd1')][_0xc974('0x10d')](_0x29c5c6);})[_0xc974('0x23')](function(_0x52f05c){_0x66c7a1['rows']=_0x52f05c;return _0x66c7a1;});}})[_0xc974('0x23')](respondWithFilteredResult(_0x280891,_0x29c5c6))[_0xc974('0x2d')](handleError(_0x280891,null));};exports[_0xc974('0x10e')]=function(_0x276762,_0x20a7fa,_0x43da0e){var _0x47b32f={'where':{}},_0x25b4ef={},_0x2072c6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc974('0xc6')]({'where':{'id':_0x276762[_0xc974('0xbf')]['id']}})['then'](handleEntityNotFound(_0x20a7fa,null))[_0xc974('0x23')](function(_0x4d259b){if(_0x4d259b){_0x25b4ef[_0xc974('0x47')]=_[_0xc974('0x49')](db[_0xc974('0xd1')][_0xc974('0x44')]);_0x25b4ef[_0xc974('0x48')]=_['keys'](_0x276762[_0xc974('0x48')]);_0x25b4ef[_0xc974('0x4a')]=_[_0xc974('0x4b')](_0x25b4ef[_0xc974('0x47')],_0x25b4ef['query']);_0x47b32f[_0xc974('0x4c')]=_['intersection'](_0x25b4ef[_0xc974('0x47')],qs[_0xc974('0x4d')](_0x276762[_0xc974('0x48')][_0xc974('0x4d')]));_0x47b32f[_0xc974('0x4c')]=_0x47b32f[_0xc974('0x4c')][_0xc974('0x6a')]?_0x47b32f[_0xc974('0x4c')]:_0x25b4ef[_0xc974('0x47')];if(!_0x276762[_0xc974('0x48')][_0xc974('0x4e')]('nolimit')){_0x47b32f[_0xc974('0x34')]=qs[_0xc974('0x34')](_0x276762['query'][_0xc974('0x34')]);_0x47b32f[_0xc974('0x33')]=qs[_0xc974('0x33')](_0x276762[_0xc974('0x48')]['offset']);}_0x47b32f[_0xc974('0x50')]=qs[_0xc974('0x51')](_0x276762[_0xc974('0x48')][_0xc974('0x51')]);_0x47b32f[_0xc974('0x87')]=qs[_0xc974('0x4a')](_[_0xc974('0x52')](_0x276762['query'],_0x25b4ef['filters']));_0x47b32f[_0xc974('0x87')][_0xc974('0x10b')]=_0x4d259b['id'];if(_0x276762[_0xc974('0x48')]['filter']){_0x47b32f[_0xc974('0x87')]=_['merge'](_0x47b32f[_0xc974('0x87')],{'$or':_[_0xc974('0x3d')](_0x47b32f['attributes'],function(_0x802adc){var _0x5043d6={};_0x5043d6[_0x802adc]={'$like':'%'+_0x276762[_0xc974('0x48')]['filter']+'%'};return _0x5043d6;})});}_0x47b32f['where'][_0xc974('0xf8')]=![];if(_0x276762[_0xc974('0x48')]['id']){_0x47b32f[_0xc974('0x87')]['id']={'$gt':_0x276762['query']['id']};}_0x47b32f=_[_0xc974('0xa6')]({},_0x47b32f,_0x276762['options']);return db[_0xc974('0xd1')]['count']({'where':_0x47b32f['where']})[_0xc974('0x23')](function(_0x1445d5){_0x2072c6[_0xc974('0x32')]=_0x1445d5;_0x47b32f[_0xc974('0xc1')]=[];if(_0x276762['query'][_0xc974('0x10f')]){_0x47b32f[_0xc974('0xc1')][_0xc974('0xbd')]({'model':db[_0xc974('0x7b')],'as':_0xc974('0x7b'),'attributes':['id',_0xc974('0x3e'),_0xc974('0x110')]});}if(_0x276762[_0xc974('0x48')][_0xc974('0xc0')]){_0x47b32f[_0xc974('0xc1')]=[{'all':!![]}];}return db['ChatMessage'][_0xc974('0x10d')](_0x47b32f);})[_0xc974('0x23')](function(_0xe7dcd){_0x2072c6[_0xc974('0xbe')]=_0xe7dcd;return _0x2072c6;});}})['then'](respondWithFilteredResult(_0x20a7fa,_0x47b32f))['catch'](handleError(_0x20a7fa,null));};exports['addTags']=function(_0x30f586,_0x534bcd,_0x51f2b8){return db['ChatInteraction']['find']({'where':{'id':_0x30f586[_0xc974('0xbf')]['id']}})['then'](handleEntityNotFound(_0x534bcd,null))['then'](function(_0x14143e){if(_0x14143e){return _0x14143e[_0xc974('0x111')](_0x30f586[_0xc974('0x7f')]['ids'],_[_0xc974('0x112')](_0x30f586['body'],[_0xc974('0x109'),'id'])||{})[_0xc974('0x113')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x30f586[_0xc974('0x7f')][_0xc974('0x109')]}});})['then'](function(_0x11c4b7){socket[_0xc974('0x114')](_0xc974('0x115'),{'id':Number(_0x30f586[_0xc974('0xbf')]['id']),'tags':_0x11c4b7||[]});return{'id':Number(_0x30f586[_0xc974('0xbf')]['id']),'tags':_0x11c4b7||[]};});}})['then'](respondWithResult(_0x534bcd,null))[_0xc974('0x2d')](handleError(_0x534bcd,null));};exports[_0xc974('0x116')]=function(_0x47d78c,_0xaf1fb7,_0x3ad4fa){return db[_0xc974('0xa7')][_0xc974('0x7d')]({'where':{'id':_0x47d78c[_0xc974('0xbf')]['id']}})[_0xc974('0x23')](handleEntityNotFound(_0xaf1fb7,null))[_0xc974('0x23')](function(_0xec054){if(_0xec054){return _0xec054[_0xc974('0x116')](_0x47d78c[_0xc974('0x48')][_0xc974('0x109')]);}})[_0xc974('0x23')](respondWithStatusCode(_0xaf1fb7,null))[_0xc974('0x2d')](handleError(_0xaf1fb7,null));};exports[_0xc974('0x117')]=function(_0x4227d3,_0x47406f){var _0x38857e=moment()['unix']()['toString']();var _0x454595=path[_0xc974('0xe5')](config[_0xc974('0xe6')],_0xc974('0x118'),_0xc974('0x119'),'tmp');var _0x563b1d=path[_0xc974('0xe5')](config[_0xc974('0xe6')],_0xc974('0x118'),'files',_0xc974('0x11a'));var _0x3e5569=path[_0xc974('0xe5')](_0x454595,_0x38857e);var _0x2e78f4=util[_0xc974('0xe9')]('transcript-%d-%s.zip',_0x4227d3[_0xc974('0xbf')]['id'],_0x38857e);var _0x276db3=path[_0xc974('0xe5')](_0x454595,_0x2e78f4);var _0x5b2824=[];_0x5b2824[_0xc974('0xbd')]({'model':db['User'],'as':_0xc974('0x7b'),'attributes':['id',_0xc974('0x3e')],'raw':!![]});_0x5b2824['push']({'model':db[_0xc974('0xec')],'as':_0xc974('0x6f'),'attributes':['id',_0xc974('0x11b'),_0xc974('0x11c')],'raw':!![]});if(_0x4227d3[_0xc974('0x48')][_0xc974('0x11a')]){_0x5b2824[_0xc974('0xbd')]({'model':db[_0xc974('0xe3')],'as':_0xc974('0xe3'),'raw':!![]});}var _0x427367=[{'model':db['ChatMessage'],'as':_0xc974('0xeb'),'attributes':['id',_0xc974('0x7f'),_0xc974('0x83'),'direction',_0xc974('0xf8'),_0xc974('0x8b')],'include':_0x5b2824}];_0x427367[_0xc974('0xbd')]({'model':db[_0xc974('0xc7')],'as':'Account','attributes':['id',_0xc974('0x3b')]});_0x427367['push']({'model':db[_0xc974('0x7b')],'as':_0xc974('0x11d'),'attributes':['id','fullname']});return db[_0xc974('0xa7')][_0xc974('0x7d')]({'where':{'id':_0x4227d3[_0xc974('0xbf')]['id']},'include':_0x427367})[_0xc974('0x23')](handleEntityNotFound(_0x47406f,null))[_0xc974('0x23')](function(_0x1eeb93){if(_0x1eeb93){var _0x3bde71=_0x1eeb93[_0xc974('0x11e')]({'plain':!![]});fs['mkdirSync'](_0x3e5569);var _0x2d183f={'format':'A4','border':_0xc974('0x11f'),'header':{'height':'40px','contents':{'first':_0xc974('0x120')}},'footer':{'height':_0xc974('0x121'),'contents':{'default':util[_0xc974('0xe9')](_0xc974('0x122'),util[_0xc974('0xe9')](_0xc974('0x123'),_0xc974('0x124'),_0x3bde71['id']),moment()[_0xc974('0xe9')](_0xc974('0x125'))[_0xc974('0xa4')]())}}};var _0x472bc7={'channel':'Chat','account':_0x3bde71[_0xc974('0x126')][_0xc974('0x3b')],'agent':_0x3bde71[_0xc974('0x11d')]?_0x3bde71[_0xc974('0x11d')]['fullname']:_0xc974('0x127'),'createdAt':moment(_0x3bde71[_0xc974('0x83')])[_0xc974('0xe9')](_0xc974('0x10c'))[_0xc974('0xa4')](),'closedAt':_0x3bde71[_0xc974('0xd9')]?moment(_0x3bde71[_0xc974('0x128')])['format'](_0xc974('0x10c'))[_0xc974('0xa4')]():'','disposition':_0x3bde71[_0xc974('0x129')],'chatInfo':{'browser':_0x3bde71[_0xc974('0x12a')],'os':_0x3bde71[_0xc974('0x12b')],'referer':_0x3bde71[_0xc974('0x12c')],'customerIp':_0x3bde71[_0xc974('0x12d')],'customerPort':_0x3bde71[_0xc974('0x12e')]?_0x3bde71['customerPort']:'N.A.'},'messages':_(_0x3bde71[_0xc974('0xeb')])[_0xc974('0x12f')]()[_0xc974('0x8d')]({'secret':![]})['map'](function(_0x3e05f5){if(_0x3e05f5[_0xc974('0xe3')]){var _0x51649f=path[_0xc974('0xe5')](_0x563b1d,_0x3e05f5[_0xc974('0xe3')]['basename']);if(fs[_0xc974('0x130')](_0x51649f)){fs[_0xc974('0x131')](_0x51649f)[_0xc974('0x132')](fs['createWriteStream'](path['join'](_0x3e5569,_0x3e05f5[_0xc974('0xe3')][_0xc974('0xde')])));}}return{'date':moment(_0x3e05f5['createdAt'])[_0xc974('0xe9')](_0xc974('0x10c'))[_0xc974('0xa4')](),'sender':_0x3e05f5[_0xc974('0xf7')]===_0xc974('0x133')?_0x3e05f5[_0xc974('0x7b')]?_0x3e05f5[_0xc974('0x7b')]['fullname']:_0xc974('0xef'):_0x3e05f5[_0xc974('0x6f')][_0xc974('0x11b')]+(_0x3e05f5[_0xc974('0x6f')][_0xc974('0x11c')]?'\x20'+_0x3e05f5[_0xc974('0x6f')][_0xc974('0x11c')]:''),'body':_0x3e05f5['Attachment']?_0x3e05f5[_0xc974('0xe3')]['basename']:_0x3e05f5[_0xc974('0x7f')],'direction':_0x3e05f5[_0xc974('0xf7')]===_0xc974('0x133')?'A':'C','secret':_0x3e05f5[_0xc974('0xf8')],'read':_0x3e05f5['read'],'attachment':_0x3e05f5[_0xc974('0xe3')]};})[_0xc974('0x72')]()};return ejs[_0xc974('0x134')](path['join'](config[_0xc974('0xe6')],_0xc974('0x118'),_0xc974('0x135'),'downloadInteraction.html'),{'interaction':_0x472bc7})['then'](function(_0x367dfb){return new BPromise(function(_0x52a7da,_0x14fb35){pdf[_0xc974('0xc3')](_0x367dfb,_0x2d183f)[_0xc974('0x136')](path[_0xc974('0xe5')](_0x3e5569,'transcript-'+_0x3bde71['id']+'-'+_0x38857e+'.pdf'),function(_0x261746,_0xa5667e){if(_0x261746)return _0x14fb35(_0x261746);_0x52a7da(_0xa5667e);});});})[_0xc974('0x23')](function(){return new BPromise(function(_0x320f13,_0x472e17){zipdir(_0x3e5569,{'saveTo':_0x276db3},function(_0x50cf1c,_0xc7ab52){if(_0x50cf1c)return _0x472e17(_0x50cf1c);return _0x320f13(_0xc7ab52);});})[_0xc974('0x23')](function(){return new BPromise(function(_0x35bd9e,_0x34ce8d){rimraf(_0x3e5569,function(_0x2fc625){if(_0x2fc625)_0x34ce8d(_0x2fc625);return _0x35bd9e();});});})[_0xc974('0x23')](function(){return _0x47406f[_0xc974('0x117')](_0x276db3,_0x2e78f4,function(_0x43087f){if(_0x43087f){console[_0xc974('0x137')](_0xc974('0x138'),_0x43087f);}else{fs['unlinkSync'](_0x276db3);}});});});}else{return _0x47406f['sendStatus'](0xc8);}})['catch'](handleError(_0x47406f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 63a94b8..1978af8 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 _0x91d2=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1c6c0d,_0x164210){var _0x3e6970=function(_0x598e06){while(--_0x598e06){_0x1c6c0d['push'](_0x1c6c0d['shift']());}};_0x3e6970(++_0x164210);}(_0x91d2,0x188));var _0x291d=function(_0x3cf8bb,_0x29e863){_0x3cf8bb=_0x3cf8bb-0x0;var _0x367eb5=_0x91d2[_0x3cf8bb];return _0x367eb5;};'use strict';var EventEmitter=require(_0x291d('0x0'));var ChatInteraction=require(_0x291d('0x1'))['db'][_0x291d('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x291d('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x291d('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x291d('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc2febe){return function(_0x41179c,_0x18ae71,_0x56ade4){_0x41179c[_0x291d('0x6')]({'attributes':['id'],'raw':!![]})[_0x291d('0x7')](function(_0x3b934c){_0x41179c[_0x291d('0x8')](_0x291d('0x9'),_0x3b934c[_0x291d('0xa')](function(_0x151d2d){return{'id':_0x151d2d['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x41179c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x291d('0x7')](function(_0x411c93){_0x41179c[_0x291d('0x8')](_0x291d('0xb'),_0x411c93[_0x291d('0xc')]);ChatInteractionEvents[_0x291d('0xd')](_0xc2febe+':'+_0x41179c['id'],_0x41179c);ChatInteractionEvents[_0x291d('0xd')](_0xc2febe,_0x41179c);_0x56ade4(null);})[_0x291d('0xe')](_0x56ade4(null));};}for(var e in events){if(events[_0x291d('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x291d('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xa7f8=['setDataValue','map','findAll','length','emit','catch','exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','then'];(function(_0x575e6d,_0x1e19ac){var _0x5d4dfd=function(_0x553717){while(--_0x553717){_0x575e6d['push'](_0x575e6d['shift']());}};_0x5d4dfd(++_0x1e19ac);}(_0xa7f8,0x160));var _0x8a7f=function(_0x52b655,_0x5132ac){_0x52b655=_0x52b655-0x0;var _0x4185fc=_0xa7f8[_0x52b655];return _0x4185fc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x8a7f('0x0'))['db'][_0x8a7f('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x8a7f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a7f('0x3'),'afterUpdate':_0x8a7f('0x4'),'afterDestroy':_0x8a7f('0x5')};function emitEvent(_0x47a7d5){return function(_0x35fd45,_0x21ae45,_0x3bbc21){_0x35fd45[_0x8a7f('0x6')]({'attributes':['id'],'raw':!![]})[_0x8a7f('0x7')](function(_0x4ce596){_0x35fd45[_0x8a7f('0x8')]('Users',_0x4ce596[_0x8a7f('0x9')](function(_0xebb4cd){return{'id':_0xebb4cd['id']};}));return ChatMessage[_0x8a7f('0xa')]({'where':{'ChatInteractionId':_0x35fd45['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x367975){_0x35fd45['setDataValue']('unreadMessages',_0x367975[_0x8a7f('0xb')]);ChatInteractionEvents[_0x8a7f('0xc')](_0x47a7d5+':'+_0x35fd45['id'],_0x35fd45);ChatInteractionEvents['emit'](_0x47a7d5,_0x35fd45);_0x3bbc21(null);})[_0x8a7f('0xd')](_0x3bbc21(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x8a7f('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index f1f299f..074b871 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 _0xef43=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0xef43,0xd6));var _0x3ef4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xef43[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x3ef4('0x0'));var logger=require(_0x3ef4('0x1'))(_0x3ef4('0x2'));var moment=require(_0x3ef4('0x3'));var BPromise=require(_0x3ef4('0x4'));var rp=require(_0x3ef4('0x5'));var fs=require('fs');var path=require(_0x3ef4('0x6'));var rimraf=require(_0x3ef4('0x7'));var config=require(_0x3ef4('0x8'));var attributes=require(_0x3ef4('0x9'));module['exports']=function(_0x220632,_0x22c907){return _0x220632[_0x3ef4('0xa')](_0x3ef4('0xb'),attributes,{'tableName':_0x3ef4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d18d2,_0x4baefd,_0x2011c6){if(_0x1d18d2[_0x3ef4('0xd')](_0x3ef4('0xe'))){_0x1d18d2[_0x3ef4('0xf')]=moment()[_0x3ef4('0x10')](_0x3ef4('0x11'));}_0x2011c6(null,_0x1d18d2);}},'charset':_0x3ef4('0x12'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x418d=['moment','bluebird','path','rimraf','./chatInteraction.attributes','define','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x418d,0x165));var _0xd418=function(_0x4c7ab2,_0x2d334c){_0x4c7ab2=_0x4c7ab2-0x0;var _0x2884d0=_0x418d[_0x4c7ab2];return _0x2884d0;};'use strict';var _=require('lodash');var util=require(_0xd418('0x0'));var logger=require(_0xd418('0x1'))(_0xd418('0x2'));var moment=require(_0xd418('0x3'));var BPromise=require(_0xd418('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd418('0x5'));var rimraf=require(_0xd418('0x6'));var config=require('../../config/environment');var attributes=require(_0xd418('0x7'));module['exports']=function(_0x50b7bd,_0xfce681){return _0x50b7bd[_0xd418('0x8')]('ChatInteraction',attributes,{'tableName':_0xd418('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x264478,_0x5c1b8e,_0x44defb){if(_0x264478['changed'](_0xd418('0xa'))){_0x264478[_0xd418('0xb')]=moment()[_0xd418('0xc')](_0xd418('0xd'));}_0x44defb(null,_0x264478);}},'charset':'utf8mb4','collate':_0xd418('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 77641ae..20adb9d 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 _0xa76a=['body','options','raw','where','attributes','catch','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update'];(function(_0x4d67e7,_0x1b1950){var _0x1c1cb4=function(_0xf9e8de){while(--_0xf9e8de){_0x4d67e7['push'](_0x4d67e7['shift']());}};_0x1c1cb4(++_0x1b1950);}(_0xa76a,0xe3));var _0xaa76=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xa76a[_0x725a4c];return _0x37b2cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa76('0x0'));var BPromise=require(_0xaa76('0x1'));var rs=require(_0xaa76('0x2'));var fs=require('fs');var Redis=require(_0xaa76('0x3'));var db=require(_0xaa76('0x4'))['db'];var utils=require(_0xaa76('0x5'));var logger=require(_0xaa76('0x6'))('rpc');var config=require(_0xaa76('0x7'));var jayson=require(_0xaa76('0x8'));var client=jayson[_0xaa76('0x9')][_0xaa76('0xa')]({'port':0x232a});config[_0xaa76('0xb')]=_[_0xaa76('0xc')](config[_0xaa76('0xb')],{'host':_0xaa76('0xd'),'port':0x18eb});var socket=require(_0xaa76('0xe'))(new Redis(config['redis']));require(_0xaa76('0xf'))['register'](socket);function respondWithRpcPromise(_0x3969a5,_0x19e54d,_0x4f75ef){return new BPromise(function(_0x54ae23,_0x495e86){return client[_0xaa76('0x10')](_0x3969a5,_0x4f75ef)[_0xaa76('0x11')](function(_0x2cb905){logger[_0xaa76('0x12')](_0xaa76('0x13'),_0x19e54d,_0xaa76('0x14'));logger[_0xaa76('0x15')](_0xaa76('0x16'),_0x19e54d,_0xaa76('0x14'),JSON[_0xaa76('0x17')](_0x2cb905));if(_0x2cb905[_0xaa76('0x18')]){if(_0x2cb905[_0xaa76('0x18')][_0xaa76('0x19')]===0x1f4){logger[_0xaa76('0x18')](_0xaa76('0x13'),_0x19e54d,_0x2cb905[_0xaa76('0x18')]['message']);return _0x495e86(_0x2cb905[_0xaa76('0x18')]['message']);}logger[_0xaa76('0x18')](_0xaa76('0x13'),_0x19e54d,_0x2cb905[_0xaa76('0x18')][_0xaa76('0x1a')]);return _0x54ae23(_0x2cb905[_0xaa76('0x18')][_0xaa76('0x1a')]);}else{logger[_0xaa76('0x12')](_0xaa76('0x13'),_0x19e54d,_0xaa76('0x14'));_0x54ae23(_0x2cb905[_0xaa76('0x1b')][_0xaa76('0x1a')]);}})['catch'](function(_0x2c2a38){logger[_0xaa76('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x19e54d,_0x2c2a38);_0x495e86(_0x2c2a38);});});}exports[_0xaa76('0x1c')]=function(_0x5a1720){var _0x2b6bfb=this;return new Promise(function(_0x41ea31,_0x43ffa4){return db[_0xaa76('0x1d')][_0xaa76('0x1e')](_0x5a1720[_0xaa76('0x1f')],{'raw':_0x5a1720[_0xaa76('0x20')]?_0x5a1720[_0xaa76('0x20')][_0xaa76('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a1720[_0xaa76('0x20')]?_0x5a1720[_0xaa76('0x20')][_0xaa76('0x22')]||null:null,'attributes':_0x5a1720['options']?_0x5a1720['options'][_0xaa76('0x23')]||null:null,'limit':_0x5a1720['options']?_0x5a1720[_0xaa76('0x20')]['limit']||null:null})[_0xaa76('0x11')](function(_0x3700b4){logger[_0xaa76('0x12')]('UpdateChatInteraction',_0x5a1720);logger['debug'](_0xaa76('0x1c'),_0x5a1720,JSON['stringify'](_0x3700b4));_0x41ea31(_0x3700b4);})[_0xaa76('0x24')](function(_0x2be2a3){logger[_0xaa76('0x18')](_0xaa76('0x1c'),_0x2be2a3['message'],_0x5a1720);_0x43ffa4(_0x2b6bfb['error'](0x1f4,_0x2be2a3['message']));});});};exports[_0xaa76('0x25')]=function(_0x1fb711){return new Promise(function(_0x83a532,_0x27cbac){return db['ChatInteraction'][_0xaa76('0x26')]({'where':_0x1fb711[_0xaa76('0x20')]?_0x1fb711[_0xaa76('0x20')][_0xaa76('0x22')]||null:null})[_0xaa76('0x11')](function(_0x27c4a6){if(_0x27c4a6){return _0x27c4a6[_0xaa76('0x27')](_0x1fb711['body'][_0xaa76('0x28')],_['omit'](_0x1fb711[_0xaa76('0x1f')],[_0xaa76('0x28'),'id'])||{});}})[_0xaa76('0x29')](function(_0x42f3fb){logger['info'](_0xaa76('0x2a'),_0x1fb711);logger[_0xaa76('0x15')](_0xaa76('0x2a'),_0x1fb711,JSON['stringify'](_0x42f3fb));_0x83a532(_0x42f3fb);})[_0xaa76('0x24')](function(_0x34955f){logger[_0xaa76('0x18')](_0xaa76('0x2a'),_0x34955f['message'],_0x1fb711);_0x27cbac(_this[_0xaa76('0x18')](0x1f4,_0x34955f[_0xaa76('0x1a')]));});});}; \ No newline at end of file +var _0xf111=['info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','debug','AddTagsToChatInteraction','where','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','then'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xf111,0x9f));var _0x1f11=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xf111[_0x2eb3db];return _0x358f33;};'use strict';var _=require('lodash');var util=require(_0x1f11('0x0'));var moment=require(_0x1f11('0x1'));var BPromise=require(_0x1f11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f11('0x3'));var db=require(_0x1f11('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f11('0x5'))(_0x1f11('0x6'));var config=require(_0x1f11('0x7'));var jayson=require(_0x1f11('0x8'));var client=jayson[_0x1f11('0x9')][_0x1f11('0xa')]({'port':0x232a});config[_0x1f11('0xb')]=_['defaults'](config['redis'],{'host':_0x1f11('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f11('0xb')]));require(_0x1f11('0xd'))[_0x1f11('0xe')](socket);function respondWithRpcPromise(_0x2dea96,_0x5a626c,_0x143463){return new BPromise(function(_0x1fc3cd,_0x297659){return client['request'](_0x2dea96,_0x143463)[_0x1f11('0xf')](function(_0x1fd91b){logger[_0x1f11('0x10')](_0x1f11('0x11'),_0x5a626c,_0x1f11('0x12'));logger['debug'](_0x1f11('0x13'),_0x5a626c,_0x1f11('0x12'),JSON[_0x1f11('0x14')](_0x1fd91b));if(_0x1fd91b[_0x1f11('0x15')]){if(_0x1fd91b['error'][_0x1f11('0x16')]===0x1f4){logger[_0x1f11('0x15')](_0x1f11('0x11'),_0x5a626c,_0x1fd91b['error'][_0x1f11('0x17')]);return _0x297659(_0x1fd91b['error'][_0x1f11('0x17')]);}logger[_0x1f11('0x15')](_0x1f11('0x11'),_0x5a626c,_0x1fd91b[_0x1f11('0x15')]['message']);return _0x1fc3cd(_0x1fd91b[_0x1f11('0x15')][_0x1f11('0x17')]);}else{logger[_0x1f11('0x10')](_0x1f11('0x11'),_0x5a626c,_0x1f11('0x12'));_0x1fc3cd(_0x1fd91b[_0x1f11('0x18')][_0x1f11('0x17')]);}})[_0x1f11('0x19')](function(_0x4388ed){logger['error'](_0x1f11('0x11'),_0x5a626c,_0x4388ed);_0x297659(_0x4388ed);});});}exports[_0x1f11('0x1a')]=function(_0x2088b7){var _0x46b606=this;return new Promise(function(_0x5d607e,_0x3b74ad){return db[_0x1f11('0x1b')]['update'](_0x2088b7[_0x1f11('0x1c')],{'raw':_0x2088b7['options']?_0x2088b7[_0x1f11('0x1d')][_0x1f11('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2088b7[_0x1f11('0x1d')]?_0x2088b7[_0x1f11('0x1d')]['where']||null:null,'attributes':_0x2088b7['options']?_0x2088b7[_0x1f11('0x1d')]['attributes']||null:null,'limit':_0x2088b7['options']?_0x2088b7['options']['limit']||null:null})[_0x1f11('0xf')](function(_0x344657){logger[_0x1f11('0x10')]('UpdateChatInteraction',_0x2088b7);logger[_0x1f11('0x1f')]('UpdateChatInteraction',_0x2088b7,JSON[_0x1f11('0x14')](_0x344657));_0x5d607e(_0x344657);})['catch'](function(_0x171a44){logger['error'](_0x1f11('0x1a'),_0x171a44[_0x1f11('0x17')],_0x2088b7);_0x3b74ad(_0x46b606['error'](0x1f4,_0x171a44[_0x1f11('0x17')]));});});};exports[_0x1f11('0x20')]=function(_0x57fd7d){return new Promise(function(_0x1c975c,_0x2621fa){return db[_0x1f11('0x1b')]['find']({'where':_0x57fd7d['options']?_0x57fd7d[_0x1f11('0x1d')][_0x1f11('0x21')]||null:null})['then'](function(_0x16e595){if(_0x16e595){return _0x16e595['addTags'](_0x57fd7d[_0x1f11('0x1c')]['ids'],_['omit'](_0x57fd7d[_0x1f11('0x1c')],['ids','id'])||{});}})['spread'](function(_0x30d212){logger['info']('AddTags',_0x57fd7d);logger[_0x1f11('0x1f')](_0x1f11('0x22'),_0x57fd7d,JSON[_0x1f11('0x14')](_0x30d212));_0x1c975c(_0x30d212);})['catch'](function(_0x424db2){logger[_0x1f11('0x15')](_0x1f11('0x22'),_0x424db2[_0x1f11('0x17')],_0x57fd7d);_0x2621fa(_this[_0x1f11('0x15')](0x1f4,_0x424db2['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8f19df5..3cd8c1f 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 _0x5a82=['update','emit','register','length','chatInteraction:','./chatInteraction.events','remove'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5a82,0x108));var _0x25a8=function(_0x3464e0,_0x1b8e8a){_0x3464e0=_0x3464e0-0x0;var _0x266ab2=_0x5a82[_0x3464e0];return _0x266ab2;};'use strict';var ChatInteractionEvents=require(_0x25a8('0x0'));var events=['save',_0x25a8('0x1'),_0x25a8('0x2')];function createListener(_0x245e61,_0x74edf2){return function(_0x49a9bf){_0x74edf2[_0x25a8('0x3')](_0x245e61,_0x49a9bf);};}function removeListener(_0x546912,_0x3a88a7){return function(){ChatInteractionEvents['removeListener'](_0x546912,_0x3a88a7);};}exports[_0x25a8('0x4')]=function(_0xc34c5d){for(var _0x278e79=0x0,_0x2bffbf=events[_0x25a8('0x5')];_0x278e79<_0x2bffbf;_0x278e79++){var _0x4e8cda=events[_0x278e79];var _0x40d747=createListener(_0x25a8('0x6')+_0x4e8cda,_0xc34c5d);ChatInteractionEvents['on'](_0x4e8cda,_0x40d747);}}; \ No newline at end of file +var _0xa17b=['remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x1ec7ee,_0x2ff44d){var _0x20b3d7=function(_0x156e17){while(--_0x156e17){_0x1ec7ee['push'](_0x1ec7ee['shift']());}};_0x20b3d7(++_0x2ff44d);}(_0xa17b,0x7d));var _0xba17=function(_0x49bf79,_0x398131){_0x49bf79=_0x49bf79-0x0;var _0x147b4e=_0xa17b[_0x49bf79];return _0x147b4e;};'use strict';var ChatInteractionEvents=require(_0xba17('0x0'));var events=['save',_0xba17('0x1'),_0xba17('0x2')];function createListener(_0x4e8abb,_0x565048){return function(_0x56b229){_0x565048[_0xba17('0x3')](_0x4e8abb,_0x56b229);};}function removeListener(_0x339687,_0xebfe32){return function(){ChatInteractionEvents[_0xba17('0x4')](_0x339687,_0xebfe32);};}exports[_0xba17('0x5')]=function(_0x4b4503){for(var _0x6c9ab0=0x0,_0x56a21e=events['length'];_0x6c9ab0<_0x56a21e;_0x6c9ab0++){var _0x4d47b6=events[_0x6c9ab0];var _0x116e55=createListener(_0xba17('0x6')+_0x4d47b6,_0x4b4503);ChatInteractionEvents['on'](_0x4d47b6,_0x116e55);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 00ec4ca..991a6a6 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 _0xe360=['show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','single','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/abandon','close','chatinteraction:destroy','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/:id'];(function(_0x2db9c8,_0x2c9a49){var _0x493551=function(_0x494e5a){while(--_0x494e5a){_0x2db9c8['push'](_0x2db9c8['shift']());}};_0x493551(++_0x2c9a49);}(_0xe360,0x119));var _0x0e36=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xe360[_0x5e6cb8];return _0x3faeb3;};'use strict';var multer=require('multer');var util=require(_0x0e36('0x0'));var path=require(_0x0e36('0x1'));var timeout=require(_0x0e36('0x2'));var express=require(_0x0e36('0x3'));var router=express[_0x0e36('0x4')]();var auth=require(_0x0e36('0x5'));var interaction=require(_0x0e36('0x6'));var config=require(_0x0e36('0x7'));var controller=require(_0x0e36('0x8'));router[_0x0e36('0x9')]('/',auth[_0x0e36('0xa')](),controller[_0x0e36('0xb')]);router[_0x0e36('0x9')]('/describe',auth[_0x0e36('0xa')](),controller['describe']);router[_0x0e36('0x9')](_0x0e36('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x0e36('0xd')]);router[_0x0e36('0x9')](_0x0e36('0xe'),auth[_0x0e36('0xf')](),controller[_0x0e36('0x10')]);router[_0x0e36('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0e36('0x11')]);router['get'](_0x0e36('0x12'),auth[_0x0e36('0xf')](),controller[_0x0e36('0x13')]);router['get'](_0x0e36('0x14'),auth['isAuthenticated'](),controller['download']);router[_0x0e36('0x15')]('/',auth[_0x0e36('0xa')](),controller[_0x0e36('0x16')]);router[_0x0e36('0x15')](_0x0e36('0x17'),auth[_0x0e36('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x0e36('0x18')]({'destination':function(_0x5453d6,_0x11246c,_0x46e25f){_0x46e25f(null,path['join'](config[_0x0e36('0x19')],_0x0e36('0x1a')));},'filename':function(_0x3fba3b,_0x38f8b7,_0x223e4f){_0x223e4f(null,util[_0x0e36('0x1b')](_0x0e36('0x1c'),Date['now'](),_0x38f8b7[_0x0e36('0x1d')][_0x0e36('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0e36('0x15')]('/:id/attachment_upload',upload[_0x0e36('0x1f')]('file'),controller['attachmentUpload']);router[_0x0e36('0x15')](_0x0e36('0x20'),auth[_0x0e36('0xf')](),controller[_0x0e36('0x21')]);router[_0x0e36('0x15')](_0x0e36('0x22'),auth[_0x0e36('0xa')](),interaction[_0x0e36('0x23')](_0x0e36('0x24'),_0x0e36('0x25')),controller['addTags']);router[_0x0e36('0x26')](_0x0e36('0xc'),auth[_0x0e36('0xa')](),interaction['tracked']('chat','chatinteraction:update'),controller[_0x0e36('0x27')]);router[_0x0e36('0x26')](_0x0e36('0x28'),controller[_0x0e36('0x29')]);router[_0x0e36('0x26')](_0x0e36('0x2a'),auth[_0x0e36('0xf')](),controller['abandon']);router['put']('/:id/close',controller[_0x0e36('0x2b')]);router['delete'](_0x0e36('0xc'),auth[_0x0e36('0xa')](),interaction[_0x0e36('0x23')](_0x0e36('0x24'),_0x0e36('0x2c')),controller[_0x0e36('0x2d')]);router[_0x0e36('0x2e')](_0x0e36('0x22'),auth[_0x0e36('0xa')](),controller[_0x0e36('0x2f')]);module[_0x0e36('0x30')]=router; \ No newline at end of file +var _0xb951=['tracked','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','getMessages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','%s-%s','originalname','/:id/attachment_upload','single','file','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','put'];(function(_0x2ce715,_0x22e80c){var _0x41c7bb=function(_0x3b8b6c){while(--_0x3b8b6c){_0x2ce715['push'](_0x2ce715['shift']());}};_0x41c7bb(++_0x22e80c);}(_0xb951,0x1b3));var _0x1b95=function(_0x24905c,_0x5ae0ac){_0x24905c=_0x24905c-0x0;var _0x3c64fb=_0xb951[_0x24905c];return _0x3c64fb;};'use strict';var multer=require(_0x1b95('0x0'));var util=require(_0x1b95('0x1'));var path=require(_0x1b95('0x2'));var timeout=require(_0x1b95('0x3'));var express=require(_0x1b95('0x4'));var router=express[_0x1b95('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1b95('0x6'));var config=require('../../config/environment');var controller=require(_0x1b95('0x7'));router[_0x1b95('0x8')]('/',auth[_0x1b95('0x9')](),controller['index']);router[_0x1b95('0x8')](_0x1b95('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1b95('0x8')](_0x1b95('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x1b95('0xc')]);router[_0x1b95('0x8')]('/:id/attachment_download',auth[_0x1b95('0xd')](),controller[_0x1b95('0xe')]);router[_0x1b95('0x8')]('/:id/messages',auth[_0x1b95('0x9')](),controller[_0x1b95('0xf')]);router[_0x1b95('0x8')]('/:id/my_messages',auth[_0x1b95('0xd')](),controller[_0x1b95('0x10')]);router['get']('/:id/download',auth[_0x1b95('0x9')](),controller[_0x1b95('0x11')]);router[_0x1b95('0x12')]('/',auth[_0x1b95('0x9')](),controller[_0x1b95('0x13')]);router['post'](_0x1b95('0x14'),auth[_0x1b95('0x9')](),controller[_0x1b95('0x15')]);var upload=multer({'storage':multer[_0x1b95('0x16')]({'destination':function(_0x272e89,_0x16314a,_0x284b10){_0x284b10(null,path[_0x1b95('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x548240,_0x117bba,_0x5a9164){_0x5a9164(null,util['format'](_0x1b95('0x18'),Date['now'](),_0x117bba[_0x1b95('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x1b95('0x1a'),upload[_0x1b95('0x1b')](_0x1b95('0x1c')),controller['attachmentUpload']);router['post'](_0x1b95('0x1d'),auth[_0x1b95('0xd')](),controller[_0x1b95('0x1e')]);router[_0x1b95('0x12')](_0x1b95('0x1f'),auth[_0x1b95('0x9')](),interaction['tracked'](_0x1b95('0x20'),_0x1b95('0x21')),controller['addTags']);router[_0x1b95('0x22')]('/:id',auth[_0x1b95('0x9')](),interaction[_0x1b95('0x23')](_0x1b95('0x20'),_0x1b95('0x24')),controller[_0x1b95('0x25')]);router['put']('/:id/custom_update',controller[_0x1b95('0x26')]);router[_0x1b95('0x22')](_0x1b95('0x27'),auth[_0x1b95('0xd')](),controller[_0x1b95('0x28')]);router[_0x1b95('0x22')](_0x1b95('0x29'),controller[_0x1b95('0x2a')]);router[_0x1b95('0x2b')](_0x1b95('0xb'),auth[_0x1b95('0x9')](),interaction[_0x1b95('0x23')](_0x1b95('0x20'),_0x1b95('0x2c')),controller['destroy']);router[_0x1b95('0x2b')](_0x1b95('0x1f'),auth[_0x1b95('0x9')](),controller[_0x1b95('0x2d')]);module[_0x1b95('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 def42f4..4eafcd7 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 _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x294bd1,_0x24e0cb){var _0x55603d=function(_0xde5d4d){while(--_0xde5d4d){_0x294bd1['push'](_0x294bd1['shift']());}};_0x55603d(++_0x24e0cb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36bdfc,_0x3c67f1){_0x36bdfc=_0x36bdfc-0x0;var _0x22a5be=_0x5f2f[_0x36bdfc];return _0x22a5be;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x0b0e=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0x0b0e[_0x204ad4];return _0x50675f;};'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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 2b13167..46d577d 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 _0xfeaf=['UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','status','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','model','query','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','intersection','find','catch','create','body','describe','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','agent','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId'];(function(_0xc83a19,_0x40f352){var _0x489adf=function(_0x3375f0){while(--_0x3375f0){_0xc83a19['push'](_0xc83a19['shift']());}};_0x489adf(++_0x40f352);}(_0xfeaf,0x73));var _0xffea=function(_0x2cb008,_0x4480b1){_0x2cb008=_0x2cb008-0x0;var _0x5b3c72=_0xfeaf[_0x2cb008];return _0x5b3c72;};'use strict';var pdf=require(_0xffea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xffea('0x1'));var zipdir=require(_0xffea('0x2'));var jsonpatch=require(_0xffea('0x3'));var rp=require(_0xffea('0x4'));var moment=require(_0xffea('0x5'));var BPromise=require(_0xffea('0x6'));var Mustache=require(_0xffea('0x7'));var util=require(_0xffea('0x8'));var path=require(_0xffea('0x9'));var sox=require(_0xffea('0xa'));var csv=require(_0xffea('0xb'));var ejs=require(_0xffea('0xc'));var fs=require('fs');var _=require(_0xffea('0xd'));var squel=require('squel');var crypto=require(_0xffea('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xffea('0xf'));var toCsv=require(_0xffea('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xffea('0x10'));var qs=require(_0xffea('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffea('0x12'));var logger=require(_0xffea('0x13'))(_0xffea('0x14'));var utils=require(_0xffea('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xffea('0x16')]=_[_0xffea('0x17')](config[_0xffea('0x16')],{'host':_0xffea('0x18'),'port':0x18eb});var socket=require(_0xffea('0x19'))(new Redis(config['redis']));require(_0xffea('0x1a'))['register'](socket);function respondWithStatusCode(_0xf58b0b,_0x481627){_0x481627=_0x481627||0xcc;return function(_0x810622){if(_0x810622){return _0xf58b0b[_0xffea('0x1b')](_0x481627);}return _0xf58b0b['status'](_0x481627)[_0xffea('0x1c')]();};}function respondWithResult(_0x4bfedb,_0x3150d0){_0x3150d0=_0x3150d0||0xc8;return function(_0x809d1d){if(_0x809d1d){return _0x4bfedb['status'](_0x3150d0)[_0xffea('0x1d')](_0x809d1d);}};}function respondWithFilteredResult(_0x5e20d9,_0x490397){return function(_0x35c089){if(_0x35c089){var _0x1a1bbd=_0x35c089[_0xffea('0x1e')],_0x569245=_0x490397[_0xffea('0x1f')],_0x13116b=_0x490397[_0xffea('0x1f')]+_0x490397['limit'],_0x215721;if(_0x13116b>=_0x1a1bbd){_0x13116b=_0x1a1bbd;_0x215721=0xc8;}else{_0x215721=0xce;}_0x5e20d9['status'](_0x215721);return _0x5e20d9[_0xffea('0x20')](_0xffea('0x21'),_0x569245+'-'+_0x13116b+'/'+_0x1a1bbd)[_0xffea('0x1d')](_0x35c089);}return null;};}function patchUpdates(_0x119844){return function(_0x52885c){try{jsonpatch[_0xffea('0x22')](_0x52885c,_0x119844,!![]);}catch(_0x44ea7f){return BPromise[_0xffea('0x23')](_0x44ea7f);}return _0x52885c[_0xffea('0x24')]();};}function saveUpdates(_0x17ccc8,_0x1c841b){return function(_0x567f60){if(_0x567f60){return _0x567f60[_0xffea('0x25')](_0x17ccc8)[_0xffea('0x26')](function(_0xa9de44){return _0xa9de44;});}return null;};}function removeEntity(_0x5cdd1b,_0x322a65){return function(_0x338efe){if(_0x338efe){return _0x338efe['destroy']()[_0xffea('0x26')](function(){_0x5cdd1b[_0xffea('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc39bc,_0x21def0){return function(_0xd3de7e){if(!_0xd3de7e){_0xcc39bc[_0xffea('0x1b')](0x194);}return _0xd3de7e;};}function handleError(_0x3e97d7,_0x590e74){_0x590e74=_0x590e74||0x1f4;return function(_0x1c8923){logger[_0xffea('0x28')](_0x1c8923[_0xffea('0x29')]);if(_0x1c8923['name']){delete _0x1c8923[_0xffea('0x2a')];}_0x3e97d7[_0xffea('0x27')](_0x590e74)[_0xffea('0x2b')](_0x1c8923);};}exports[_0xffea('0x2c')]=function(_0xddc041,_0x235609){var _0x4471ca={},_0x1532fc={},_0x11d16b={'count':0x0,'rows':[]};var _0x34cca2=_[_0xffea('0x2d')](db[_0xffea('0x2e')]['rawAttributes'],function(_0x282afd){return{'name':_0x282afd[_0xffea('0x2f')],'type':_0x282afd[_0xffea('0x30')]['key']};});_0x1532fc[_0xffea('0x31')]=_[_0xffea('0x2d')](_0x34cca2,_0xffea('0x2a'));_0x1532fc[_0xffea('0x32')]=_['keys'](_0xddc041[_0xffea('0x32')]);_0x1532fc['filters']=_['intersection'](_0x1532fc[_0xffea('0x31')],_0x1532fc[_0xffea('0x32')]);_0x4471ca['attributes']=_['intersection'](_0x1532fc['model'],qs['fields'](_0xddc041[_0xffea('0x32')][_0xffea('0x33')]));_0x4471ca['attributes']=_0x4471ca['attributes'][_0xffea('0x34')]?_0x4471ca[_0xffea('0x35')]:_0x1532fc[_0xffea('0x31')];if(!_0xddc041[_0xffea('0x32')][_0xffea('0x36')](_0xffea('0x37'))){_0x4471ca['limit']=qs[_0xffea('0x38')](_0xddc041['query'][_0xffea('0x38')]);_0x4471ca['offset']=qs[_0xffea('0x1f')](_0xddc041[_0xffea('0x32')][_0xffea('0x1f')]);}_0x4471ca[_0xffea('0x39')]=qs['sort'](_0xddc041['query'][_0xffea('0x3a')]);_0x4471ca[_0xffea('0x3b')]=qs[_0xffea('0x3c')](_['pick'](_0xddc041[_0xffea('0x32')],_0x1532fc[_0xffea('0x3c')]),_0x34cca2);if(_0xddc041[_0xffea('0x32')][_0xffea('0x3d')]){_0x4471ca[_0xffea('0x3b')]=_[_0xffea('0x3e')](_0x4471ca[_0xffea('0x3b')],{'$or':_[_0xffea('0x2d')](_0x34cca2,function(_0x5b29a2){if(_0x5b29a2[_0xffea('0x30')]!==_0xffea('0x3f')){var _0x56284c={};_0x56284c[_0x5b29a2[_0xffea('0x2a')]]={'$like':'%'+_0xddc041[_0xffea('0x32')][_0xffea('0x3d')]+'%'};return _0x56284c;}})});}_0x4471ca=_[_0xffea('0x3e')]({},_0x4471ca,_0xddc041[_0xffea('0x40')]);var _0x9a4606={'where':_0x4471ca[_0xffea('0x3b')]};return db['ChatInternalMessage']['count'](_0x9a4606)['then'](function(_0xf20854){_0x11d16b['count']=_0xf20854;if(_0xddc041[_0xffea('0x32')][_0xffea('0x41')]){_0x4471ca[_0xffea('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xffea('0x43')](_0x4471ca);})['then'](function(_0x2ef905){_0x11d16b[_0xffea('0x44')]=_0x2ef905;return _0x11d16b;})[_0xffea('0x26')](respondWithFilteredResult(_0x235609,_0x4471ca))['catch'](handleError(_0x235609,null));};exports['show']=function(_0x3ab783,_0x44e305){var _0x2459f5={'raw':!![],'where':{'id':_0x3ab783[_0xffea('0x45')]['id']}},_0x28c09a={};_0x28c09a[_0xffea('0x31')]=_[_0xffea('0x46')](db[_0xffea('0x2e')][_0xffea('0x47')]);_0x28c09a[_0xffea('0x32')]=_[_0xffea('0x46')](_0x3ab783[_0xffea('0x32')]);_0x28c09a[_0xffea('0x3c')]=_['intersection'](_0x28c09a['model'],_0x28c09a[_0xffea('0x32')]);_0x2459f5[_0xffea('0x35')]=_[_0xffea('0x48')](_0x28c09a[_0xffea('0x31')],qs[_0xffea('0x33')](_0x3ab783['query'][_0xffea('0x33')]));_0x2459f5[_0xffea('0x35')]=_0x2459f5[_0xffea('0x35')][_0xffea('0x34')]?_0x2459f5[_0xffea('0x35')]:_0x28c09a[_0xffea('0x31')];if(_0x3ab783[_0xffea('0x32')][_0xffea('0x41')]){_0x2459f5[_0xffea('0x42')]=[{'all':!![]}];}_0x2459f5=_[_0xffea('0x3e')]({},_0x2459f5,_0x3ab783[_0xffea('0x40')]);return db[_0xffea('0x2e')][_0xffea('0x49')](_0x2459f5)[_0xffea('0x26')](handleEntityNotFound(_0x44e305,null))[_0xffea('0x26')](respondWithResult(_0x44e305,null))[_0xffea('0x4a')](handleError(_0x44e305,null));};exports[_0xffea('0x4b')]=function(_0x1cf037,_0x3d322b){return db[_0xffea('0x2e')][_0xffea('0x4b')](_0x1cf037[_0xffea('0x4c')],{})[_0xffea('0x26')](respondWithResult(_0x3d322b,0xc9))[_0xffea('0x4a')](handleError(_0x3d322b,null));};exports['update']=function(_0xdabd3c,_0x51399c){if(_0xdabd3c[_0xffea('0x4c')]['id']){delete _0xdabd3c['body']['id'];}return db[_0xffea('0x2e')][_0xffea('0x49')]({'where':{'id':_0xdabd3c[_0xffea('0x45')]['id']}})[_0xffea('0x26')](handleEntityNotFound(_0x51399c,null))[_0xffea('0x26')](saveUpdates(_0xdabd3c[_0xffea('0x4c')],null))[_0xffea('0x26')](respondWithResult(_0x51399c,null))[_0xffea('0x4a')](handleError(_0x51399c,null));};exports['destroy']=function(_0x43be6b,_0x5b0fa9){return db['ChatInternalMessage'][_0xffea('0x49')]({'where':{'id':_0x43be6b[_0xffea('0x45')]['id']}})[_0xffea('0x26')](handleEntityNotFound(_0x5b0fa9,null))[_0xffea('0x26')](removeEntity(_0x5b0fa9,null))['catch'](handleError(_0x5b0fa9,null));};exports[_0xffea('0x4d')]=function(_0x3a2356,_0x23324e){return db[_0xffea('0x2e')][_0xffea('0x4d')]()['then'](respondWithResult(_0x23324e,null))[_0xffea('0x4a')](handleError(_0x23324e,null));};function wrapUser(_0x3b5aad){return function(_0x2e81ba){var _0x41b2cc=_0x3b5aad['get']({'plain':!![]});_0x41b2cc[_0xffea('0x4e')]=[];if(_0x2e81ba){_0x41b2cc[_0xffea('0x4f')]=_0x2e81ba[_0xffea('0x50')];_0x41b2cc['lastMessage']=_0x2e81ba;}else{_0x41b2cc[_0xffea('0x4f')]=moment(0x0)[_0xffea('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x41b2cc[_0xffea('0x52')]={};}return _0x41b2cc;};}exports[_0xffea('0x53')]=function(_0x41040b,_0x11ed57,_0x554066){var _0x4f49be=[];return db[_0xffea('0x54')][_0xffea('0x43')]({'where':{'role':[_0xffea('0x55'),'admin',_0xffea('0x56')]},'attributes':['id',_0xffea('0x57'),_0xffea('0x2a'),_0xffea('0x58'),_0xffea('0x59'),_0xffea('0x5a'),_0xffea('0x5b'),'lastLoginAt',_0xffea('0x5c'),_0xffea('0x5d')],'order':qs[_0xffea('0x3a')](_0xffea('0x5e')),'include':[{'model':db['VoiceQueue'],'as':_0xffea('0x5f'),'attributes':['id','name',_0xffea('0x30')],'through':{'attributes':[]}}]})[_0xffea('0x26')](function(_0x13d929){if(_0x13d929){var _0x3567b6=_0x41040b[_0xffea('0x56')]['get']({'plain':!![]});if(!_0x3567b6)throw new Error(_0xffea('0x60'));if(_0x3567b6[_0xffea('0x58')]===_0xffea('0x56')){return db['UserProfileSection']['find']({'where':{'name':_0xffea('0x61'),'userProfileId':_0x3567b6[_0xffea('0x62')]},'raw':!![]})['then'](function(_0x1e8489){if(_0x1e8489){if(_0x1e8489['autoAssociation']===0x0){return db[_0xffea('0x63')][_0xffea('0x43')]({'where':{'sectionId':_0x1e8489['id']},'raw':!![]})[_0xffea('0x26')](function(_0x21002f){var _0x3128a1=[];if(_[_0xffea('0x64')](_0x21002f)){_0x3128a1=_[_0xffea('0x3d')](_0x13d929,function(_0x34ef67){if(_0x34ef67[_0xffea('0x58')]!=='agent'){return _0x34ef67;}});return _0x3128a1;}else{for(var _0x38fbb6=0x0;_0x38fbb6<_0x13d929[_0xffea('0x34')];_0x38fbb6++){var _0x5e62f2=_0x13d929[_0x38fbb6];if(_0x5e62f2[_0xffea('0x58')]==='agent'){var _0x593e95=_[_0xffea('0x49')](_0x21002f,function(_0x434a14){return _0x434a14[_0xffea('0x65')]===_0x5e62f2['id'];});if(_0x593e95)_0x3128a1['push'](_0x5e62f2);}else{_0x3128a1[_0xffea('0x66')](_0x5e62f2);}}return _0x3128a1;}});}else{return _0x13d929;}}else{var _0x426528=_['filter'](_0x13d929,function(_0x3f525a){if(_0x3f525a[_0xffea('0x58')]!==_0xffea('0x55')){return _0x3f525a;}});return _0x426528;}});}else{return _0x13d929;}}})[_0xffea('0x26')](function(_0x58c351){var _0x55349c=[];if(_0x58c351){_0x4f49be=_0x58c351;for(var _0x434c55=0x0;_0x434c55<_0x58c351[_0xffea('0x34')];_0x434c55+=0x1){_0x4f49be[_0x434c55][_0xffea('0x4e')]=[];_0x55349c[_0xffea('0x66')](db['ChatInternalMessage'][_0xffea('0x49')]({'where':{'FromId':[_0x41040b['user']['id'],_0x58c351[_0x434c55]['id']],'ToId':[_0x41040b[_0xffea('0x56')]['id'],_0x58c351[_0x434c55]['id']],'ChatGroupId':null},'attributes':['id',_0xffea('0x50'),_0xffea('0x67'),'ToId',_0xffea('0x68'),'body'],'order':qs['sort'](_0xffea('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x58c351[_0x434c55])));}return BPromise[_0xffea('0x6a')](_0x55349c);}return[];})[_0xffea('0x26')](function(_0x4b5a09){return{'rows':_0x4b5a09,'count':_0x4b5a09[_0xffea('0x34')]};})['then'](respondWithResult(_0x11ed57,null))[_0xffea('0x4a')](handleError(_0x11ed57,null));}; \ No newline at end of file +var _0x92f3=['order','sort','pick','filters','filter','merge','where','VIRTUAL','options','ChatInternalMessage','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','agent','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','autoAssociation','UserProfileResource','isEmpty','push','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit'];(function(_0x20a854,_0x3378a8){var _0x2f0c98=function(_0x25dc1f){while(--_0x25dc1f){_0x20a854['push'](_0x20a854['shift']());}};_0x2f0c98(++_0x3378a8);}(_0x92f3,0x1de));var _0x392f=function(_0xa92ea7,_0x47d6c2){_0xa92ea7=_0xa92ea7-0x0;var _0x2441ff=_0x92f3[_0xa92ea7];return _0x2441ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x392f('0x0'));var rimraf=require(_0x392f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x392f('0x2'));var rp=require(_0x392f('0x3'));var moment=require(_0x392f('0x4'));var BPromise=require(_0x392f('0x5'));var Mustache=require('mustache');var util=require(_0x392f('0x6'));var path=require(_0x392f('0x7'));var sox=require(_0x392f('0x8'));var csv=require(_0x392f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x392f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x392f('0xb'));var toCsv=require(_0x392f('0x9'));var querystring=require(_0x392f('0xc'));var Papa=require(_0x392f('0xd'));var Redis=require(_0x392f('0xe'));var authService=require(_0x392f('0xf'));var qs=require(_0x392f('0x10'));var as=require(_0x392f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x392f('0x12'))(_0x392f('0x13'));var utils=require(_0x392f('0x14'));var config=require(_0x392f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x392f('0x16'))['db'];config[_0x392f('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x392f('0x18'))(new Redis(config[_0x392f('0x17')]));require(_0x392f('0x19'))[_0x392f('0x1a')](socket);function respondWithStatusCode(_0x11816d,_0xd2d8de){_0xd2d8de=_0xd2d8de||0xcc;return function(_0x314c2a){if(_0x314c2a){return _0x11816d[_0x392f('0x1b')](_0xd2d8de);}return _0x11816d[_0x392f('0x1c')](_0xd2d8de)[_0x392f('0x1d')]();};}function respondWithResult(_0x51c29a,_0x38691f){_0x38691f=_0x38691f||0xc8;return function(_0x356fb8){if(_0x356fb8){return _0x51c29a[_0x392f('0x1c')](_0x38691f)['json'](_0x356fb8);}};}function respondWithFilteredResult(_0xad147c,_0x4c782b){return function(_0x2f116c){if(_0x2f116c){var _0xed28f9=_0x2f116c['count'],_0x1d2b02=_0x4c782b[_0x392f('0x1e')],_0x206438=_0x4c782b[_0x392f('0x1e')]+_0x4c782b[_0x392f('0x1f')],_0x3481f5;if(_0x206438>=_0xed28f9){_0x206438=_0xed28f9;_0x3481f5=0xc8;}else{_0x3481f5=0xce;}_0xad147c[_0x392f('0x1c')](_0x3481f5);return _0xad147c[_0x392f('0x20')](_0x392f('0x21'),_0x1d2b02+'-'+_0x206438+'/'+_0xed28f9)[_0x392f('0x22')](_0x2f116c);}return null;};}function patchUpdates(_0x20c15f){return function(_0x2484f0){try{jsonpatch[_0x392f('0x23')](_0x2484f0,_0x20c15f,!![]);}catch(_0x2ed197){return BPromise[_0x392f('0x24')](_0x2ed197);}return _0x2484f0[_0x392f('0x25')]();};}function saveUpdates(_0x54acd1,_0x327dd7){return function(_0x4bf5bc){if(_0x4bf5bc){return _0x4bf5bc[_0x392f('0x26')](_0x54acd1)[_0x392f('0x27')](function(_0x198ef9){return _0x198ef9;});}return null;};}function removeEntity(_0x1355e2,_0x5b69b2){return function(_0x5ee189){if(_0x5ee189){return _0x5ee189[_0x392f('0x28')]()[_0x392f('0x27')](function(){_0x1355e2[_0x392f('0x1c')](0xcc)[_0x392f('0x1d')]();});}};}function handleEntityNotFound(_0x5f3fb5,_0x78b4da){return function(_0x2f0782){if(!_0x2f0782){_0x5f3fb5['sendStatus'](0x194);}return _0x2f0782;};}function handleError(_0x525f2c,_0x39c23a){_0x39c23a=_0x39c23a||0x1f4;return function(_0x3aa415){logger[_0x392f('0x29')](_0x3aa415[_0x392f('0x2a')]);if(_0x3aa415['name']){delete _0x3aa415[_0x392f('0x2b')];}_0x525f2c[_0x392f('0x1c')](_0x39c23a)['send'](_0x3aa415);};}exports[_0x392f('0x2c')]=function(_0x1543d6,_0x370924){var _0x51445d={},_0x521420={},_0x3043e6={'count':0x0,'rows':[]};var _0x347515=_[_0x392f('0x2d')](db['ChatInternalMessage'][_0x392f('0x2e')],function(_0x10e652){return{'name':_0x10e652[_0x392f('0x2f')],'type':_0x10e652[_0x392f('0x30')][_0x392f('0x31')]};});_0x521420[_0x392f('0x32')]=_[_0x392f('0x2d')](_0x347515,_0x392f('0x2b'));_0x521420['query']=_['keys'](_0x1543d6['query']);_0x521420['filters']=_[_0x392f('0x33')](_0x521420[_0x392f('0x32')],_0x521420[_0x392f('0x34')]);_0x51445d[_0x392f('0x35')]=_[_0x392f('0x33')](_0x521420[_0x392f('0x32')],qs[_0x392f('0x36')](_0x1543d6[_0x392f('0x34')][_0x392f('0x36')]));_0x51445d['attributes']=_0x51445d['attributes']['length']?_0x51445d[_0x392f('0x35')]:_0x521420[_0x392f('0x32')];if(!_0x1543d6[_0x392f('0x34')][_0x392f('0x37')](_0x392f('0x38'))){_0x51445d['limit']=qs[_0x392f('0x1f')](_0x1543d6[_0x392f('0x34')][_0x392f('0x1f')]);_0x51445d[_0x392f('0x1e')]=qs[_0x392f('0x1e')](_0x1543d6[_0x392f('0x34')][_0x392f('0x1e')]);}_0x51445d[_0x392f('0x39')]=qs[_0x392f('0x3a')](_0x1543d6['query']['sort']);_0x51445d['where']=qs['filters'](_[_0x392f('0x3b')](_0x1543d6['query'],_0x521420[_0x392f('0x3c')]),_0x347515);if(_0x1543d6[_0x392f('0x34')][_0x392f('0x3d')]){_0x51445d['where']=_[_0x392f('0x3e')](_0x51445d[_0x392f('0x3f')],{'$or':_[_0x392f('0x2d')](_0x347515,function(_0x4b366c){if(_0x4b366c[_0x392f('0x30')]!==_0x392f('0x40')){var _0x19b29f={};_0x19b29f[_0x4b366c['name']]={'$like':'%'+_0x1543d6['query'][_0x392f('0x3d')]+'%'};return _0x19b29f;}})});}_0x51445d=_[_0x392f('0x3e')]({},_0x51445d,_0x1543d6[_0x392f('0x41')]);var _0x108641={'where':_0x51445d['where']};return db[_0x392f('0x42')][_0x392f('0x43')](_0x108641)[_0x392f('0x27')](function(_0x2a5965){_0x3043e6['count']=_0x2a5965;if(_0x1543d6[_0x392f('0x34')][_0x392f('0x44')]){_0x51445d[_0x392f('0x45')]=[{'all':!![]}];}return db[_0x392f('0x42')][_0x392f('0x46')](_0x51445d);})[_0x392f('0x27')](function(_0x2f9f4d){_0x3043e6[_0x392f('0x47')]=_0x2f9f4d;return _0x3043e6;})[_0x392f('0x27')](respondWithFilteredResult(_0x370924,_0x51445d))[_0x392f('0x48')](handleError(_0x370924,null));};exports[_0x392f('0x49')]=function(_0x568cc4,_0x593301){var _0x9816c6={'raw':!![],'where':{'id':_0x568cc4[_0x392f('0x4a')]['id']}},_0xe9a01e={};_0xe9a01e['model']=_[_0x392f('0x4b')](db[_0x392f('0x42')][_0x392f('0x2e')]);_0xe9a01e['query']=_[_0x392f('0x4b')](_0x568cc4['query']);_0xe9a01e['filters']=_[_0x392f('0x33')](_0xe9a01e[_0x392f('0x32')],_0xe9a01e[_0x392f('0x34')]);_0x9816c6['attributes']=_[_0x392f('0x33')](_0xe9a01e[_0x392f('0x32')],qs[_0x392f('0x36')](_0x568cc4[_0x392f('0x34')]['fields']));_0x9816c6[_0x392f('0x35')]=_0x9816c6[_0x392f('0x35')][_0x392f('0x4c')]?_0x9816c6['attributes']:_0xe9a01e[_0x392f('0x32')];if(_0x568cc4['query'][_0x392f('0x44')]){_0x9816c6[_0x392f('0x45')]=[{'all':!![]}];}_0x9816c6=_[_0x392f('0x3e')]({},_0x9816c6,_0x568cc4['options']);return db[_0x392f('0x42')][_0x392f('0x4d')](_0x9816c6)[_0x392f('0x27')](handleEntityNotFound(_0x593301,null))['then'](respondWithResult(_0x593301,null))['catch'](handleError(_0x593301,null));};exports['create']=function(_0x304c92,_0x2b3ba2){return db[_0x392f('0x42')][_0x392f('0x4e')](_0x304c92[_0x392f('0x4f')],{})[_0x392f('0x27')](respondWithResult(_0x2b3ba2,0xc9))['catch'](handleError(_0x2b3ba2,null));};exports[_0x392f('0x26')]=function(_0x54f145,_0x403d26){if(_0x54f145[_0x392f('0x4f')]['id']){delete _0x54f145[_0x392f('0x4f')]['id'];}return db[_0x392f('0x42')][_0x392f('0x4d')]({'where':{'id':_0x54f145[_0x392f('0x4a')]['id']}})[_0x392f('0x27')](handleEntityNotFound(_0x403d26,null))['then'](saveUpdates(_0x54f145['body'],null))['then'](respondWithResult(_0x403d26,null))[_0x392f('0x48')](handleError(_0x403d26,null));};exports[_0x392f('0x28')]=function(_0x1d1c94,_0x577c84){return db['ChatInternalMessage'][_0x392f('0x4d')]({'where':{'id':_0x1d1c94[_0x392f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x577c84,null))[_0x392f('0x27')](removeEntity(_0x577c84,null))[_0x392f('0x48')](handleError(_0x577c84,null));};exports['describe']=function(_0xbaac06,_0x72ad45){return db['ChatInternalMessage'][_0x392f('0x50')]()[_0x392f('0x27')](respondWithResult(_0x72ad45,null))[_0x392f('0x48')](handleError(_0x72ad45,null));};function wrapUser(_0x8164b0){return function(_0x384176){var _0xc973d8=_0x8164b0[_0x392f('0x51')]({'plain':!![]});_0xc973d8[_0x392f('0x52')]=[];if(_0x384176){_0xc973d8[_0x392f('0x53')]=_0x384176[_0x392f('0x54')];_0xc973d8[_0x392f('0x55')]=_0x384176;}else{_0xc973d8[_0x392f('0x53')]=moment(0x0)[_0x392f('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0xc973d8[_0x392f('0x55')]={};}return _0xc973d8;};}exports['getUsers']=function(_0x4cf3e4,_0x5f5d0c,_0x159788){var _0x922880=[];return db['User']['findAll']({'where':{'role':[_0x392f('0x57'),'admin','user']},'attributes':['id',_0x392f('0x58'),_0x392f('0x2b'),_0x392f('0x59'),_0x392f('0x5a'),_0x392f('0x5b'),_0x392f('0x5c'),_0x392f('0x5d'),'allowmessenger',_0x392f('0x5e')],'order':qs['sort'](_0x392f('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0x392f('0x60'),'attributes':['id','name',_0x392f('0x30')],'through':{'attributes':[]}}]})[_0x392f('0x27')](function(_0xaf3c1a){if(_0xaf3c1a){var _0x2ba636=_0x4cf3e4[_0x392f('0x61')][_0x392f('0x51')]({'plain':!![]});if(!_0x2ba636)throw new Error(_0x392f('0x62'));if(_0x2ba636['role']===_0x392f('0x61')){return db['UserProfileSection'][_0x392f('0x4d')]({'where':{'name':_0x392f('0x63'),'userProfileId':_0x2ba636['userProfileId']},'raw':!![]})['then'](function(_0x4624ea){if(_0x4624ea){if(_0x4624ea[_0x392f('0x64')]===0x0){return db[_0x392f('0x65')][_0x392f('0x46')]({'where':{'sectionId':_0x4624ea['id']},'raw':!![]})['then'](function(_0x3e3669){var _0x3593fe=[];if(_[_0x392f('0x66')](_0x3e3669)){_0x3593fe=_['filter'](_0xaf3c1a,function(_0x2ab1a5){if(_0x2ab1a5[_0x392f('0x59')]!=='agent'){return _0x2ab1a5;}});return _0x3593fe;}else{for(var _0x2f17bc=0x0;_0x2f17bc<_0xaf3c1a[_0x392f('0x4c')];_0x2f17bc++){var _0x144366=_0xaf3c1a[_0x2f17bc];if(_0x144366[_0x392f('0x59')]===_0x392f('0x57')){var _0x19e3f7=_[_0x392f('0x4d')](_0x3e3669,function(_0x50d9e2){return _0x50d9e2['resourceId']===_0x144366['id'];});if(_0x19e3f7)_0x3593fe[_0x392f('0x67')](_0x144366);}else{_0x3593fe[_0x392f('0x67')](_0x144366);}}return _0x3593fe;}});}else{return _0xaf3c1a;}}else{var _0x2ecc46=_[_0x392f('0x3d')](_0xaf3c1a,function(_0x48c306){if(_0x48c306['role']!=='agent'){return _0x48c306;}});return _0x2ecc46;}});}else{return _0xaf3c1a;}}})[_0x392f('0x27')](function(_0x5b8afd){var _0x3513c1=[];if(_0x5b8afd){_0x922880=_0x5b8afd;for(var _0x3b0465=0x0;_0x3b0465<_0x5b8afd[_0x392f('0x4c')];_0x3b0465+=0x1){_0x922880[_0x3b0465][_0x392f('0x52')]=[];_0x3513c1[_0x392f('0x67')](db[_0x392f('0x42')][_0x392f('0x4d')]({'where':{'FromId':[_0x4cf3e4[_0x392f('0x61')]['id'],_0x5b8afd[_0x3b0465]['id']],'ToId':[_0x4cf3e4[_0x392f('0x61')]['id'],_0x5b8afd[_0x3b0465]['id']],'ChatGroupId':null},'attributes':['id',_0x392f('0x54'),'FromId','ToId',_0x392f('0x68'),_0x392f('0x4f')],'order':qs['sort'](_0x392f('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5b8afd[_0x3b0465])));}return BPromise[_0x392f('0x6a')](_0x3513c1);}return[];})[_0x392f('0x27')](function(_0x22735f){return{'rows':_0x22735f,'count':_0x22735f[_0x392f('0x4c')]};})[_0x392f('0x27')](respondWithResult(_0x5f5d0c,null))[_0x392f('0x48')](handleError(_0x5f5d0c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 95bfaec..6e0e0f9 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 _0x1c55=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x1c55,0x1e3));var _0x51c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c55[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x51c5('0x0'));var ChatInternalMessage=require(_0x51c5('0x1'))['db'][_0x51c5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x51c5('0x3')](0x0);var events={'afterCreate':_0x51c5('0x4'),'afterUpdate':_0x51c5('0x5'),'afterDestroy':_0x51c5('0x6')};function emitEvent(_0xe10c0e){return function(_0xa01afc,_0x29fab9,_0x49156c){ChatInternalMessageEvents[_0x51c5('0x7')](_0xe10c0e+':'+_0xa01afc['id'],_0xa01afc);ChatInternalMessageEvents[_0x51c5('0x7')](_0xe10c0e,_0xa01afc);_0x49156c(null);};}for(var e in events){if(events[_0x51c5('0x8')](e)){var event=events[e];ChatInternalMessage[_0x51c5('0x9')](e,emitEvent(event));}}module[_0x51c5('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc6ab=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xc6ab,0x96));var _0xbc6a=function(_0x900b9a,_0x1eb72a){_0x900b9a=_0x900b9a-0x0;var _0x42507f=_0xc6ab[_0x900b9a];return _0x42507f;};'use strict';var EventEmitter=require(_0xbc6a('0x0'));var ChatInternalMessage=require(_0xbc6a('0x1'))['db'][_0xbc6a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbc6a('0x3')](0x0);var events={'afterCreate':_0xbc6a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xbf9d02){return function(_0x1c351c,_0x3808e0,_0x3f7109){ChatInternalMessageEvents[_0xbc6a('0x5')](_0xbf9d02+':'+_0x1c351c['id'],_0x1c351c);ChatInternalMessageEvents['emit'](_0xbf9d02,_0x1c351c);_0x3f7109(null);};}for(var e in events){if(events[_0xbc6a('0x6')](e)){var event=events[e];ChatInternalMessage[_0xbc6a('0x7')](e,emitEvent(event));}}module[_0xbc6a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 60e8a6d..267f57c 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 _0xcb91=['path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x3f010d,_0x1392cc){var _0x45e0bb=function(_0x3ef95d){while(--_0x3ef95d){_0x3f010d['push'](_0x3f010d['shift']());}};_0x45e0bb(++_0x1392cc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcb91[_0x25701b];return _0x3a8a2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cb9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x662fdf,_0x49e50f){var _0x375fbc=function(_0x415bc7){while(--_0x415bc7){_0x662fdf['push'](_0x662fdf['shift']());}};_0x375fbc(++_0x49e50f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var 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':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b16c054..0aa45c6 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 _0xc05b=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ab976,_0x481420){var _0x252db5=function(_0x1cadce){while(--_0x1cadce){_0x3ab976['push'](_0x3ab976['shift']());}};_0x252db5(++_0x481420);}(_0xc05b,0xb8));var _0xbc05=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xc05b[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0xbc05('0x0'));var util=require(_0xbc05('0x1'));var moment=require('moment');var BPromise=require(_0xbc05('0x2'));var rs=require(_0xbc05('0x3'));var fs=require('fs');var Redis=require(_0xbc05('0x4'));var db=require(_0xbc05('0x5'))['db'];var utils=require(_0xbc05('0x6'));var logger=require(_0xbc05('0x7'))(_0xbc05('0x8'));var config=require(_0xbc05('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc05('0xa')][_0xbc05('0xb')]({'port':0x232a});config[_0xbc05('0xc')]=_[_0xbc05('0xd')](config['redis'],{'host':_0xbc05('0xe'),'port':0x18eb});var socket=require(_0xbc05('0xf'))(new Redis(config[_0xbc05('0xc')]));require(_0xbc05('0x10'))[_0xbc05('0x11')](socket);function respondWithRpcPromise(_0x40c5d1,_0x399178,_0x131e47){return new BPromise(function(_0x4d23be,_0x53c85a){return client['request'](_0x40c5d1,_0x131e47)[_0xbc05('0x12')](function(_0x1ff740){logger[_0xbc05('0x13')](_0xbc05('0x14'),_0x399178,_0xbc05('0x15'));logger[_0xbc05('0x16')](_0xbc05('0x17'),_0x399178,_0xbc05('0x15'),JSON[_0xbc05('0x18')](_0x1ff740));if(_0x1ff740[_0xbc05('0x19')]){if(_0x1ff740[_0xbc05('0x19')][_0xbc05('0x1a')]===0x1f4){logger[_0xbc05('0x19')](_0xbc05('0x14'),_0x399178,_0x1ff740[_0xbc05('0x19')][_0xbc05('0x1b')]);return _0x53c85a(_0x1ff740['error'][_0xbc05('0x1b')]);}logger['error'](_0xbc05('0x14'),_0x399178,_0x1ff740['error'][_0xbc05('0x1b')]);return _0x4d23be(_0x1ff740['error'][_0xbc05('0x1b')]);}else{logger[_0xbc05('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x399178,_0xbc05('0x15'));_0x4d23be(_0x1ff740[_0xbc05('0x1c')]['message']);}})[_0xbc05('0x1d')](function(_0x45628b){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x399178,_0x45628b);_0x53c85a(_0x45628b);});});} \ No newline at end of file +var _0x1901=['localhost','register','request','then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x1901,0x70));var _0x1190=function(_0x7777c7,_0x278b61){_0x7777c7=_0x7777c7-0x0;var _0x363a0e=_0x1901[_0x7777c7];return _0x363a0e;};'use strict';var _=require(_0x1190('0x0'));var util=require(_0x1190('0x1'));var moment=require(_0x1190('0x2'));var BPromise=require(_0x1190('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1190('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1190('0x5'));var logger=require(_0x1190('0x6'))(_0x1190('0x7'));var config=require(_0x1190('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1190('0x9')][_0x1190('0xa')]({'port':0x232a});config[_0x1190('0xb')]=_[_0x1190('0xc')](config['redis'],{'host':_0x1190('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1190('0xb')]));require('./chatInternalMessage.socket')[_0x1190('0xe')](socket);function respondWithRpcPromise(_0x2cae41,_0x15982c,_0x38bb6a){return new BPromise(function(_0x3926c4,_0x116ccb){return client[_0x1190('0xf')](_0x2cae41,_0x38bb6a)[_0x1190('0x10')](function(_0x2b6bb1){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x15982c,_0x1190('0x11'));logger[_0x1190('0x12')](_0x1190('0x13'),_0x15982c,_0x1190('0x11'),JSON['stringify'](_0x2b6bb1));if(_0x2b6bb1[_0x1190('0x14')]){if(_0x2b6bb1['error'][_0x1190('0x15')]===0x1f4){logger[_0x1190('0x14')](_0x1190('0x16'),_0x15982c,_0x2b6bb1[_0x1190('0x14')]['message']);return _0x116ccb(_0x2b6bb1['error']['message']);}logger[_0x1190('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x15982c,_0x2b6bb1[_0x1190('0x14')][_0x1190('0x17')]);return _0x3926c4(_0x2b6bb1[_0x1190('0x14')][_0x1190('0x17')]);}else{logger[_0x1190('0x18')](_0x1190('0x16'),_0x15982c,_0x1190('0x11'));_0x3926c4(_0x2b6bb1['result'][_0x1190('0x17')]);}})['catch'](function(_0x2cead1){logger[_0x1190('0x14')](_0x1190('0x16'),_0x15982c,_0x2cead1);_0x116ccb(_0x2cead1);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b2cfa6f..f610fe0 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 _0xa4ba=['remove','update','removeListener','register','save'];(function(_0x4b81b6,_0x4a3dd1){var _0x5d1879=function(_0x216a43){while(--_0x216a43){_0x4b81b6['push'](_0x4b81b6['shift']());}};_0x5d1879(++_0x4a3dd1);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa4ba[_0x4ae6ef];return _0x3cbb4e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xaa4b('0x0'),_0xaa4b('0x1'),_0xaa4b('0x2')];function createListener(_0x27f13f,_0x55304b){return function(_0x102c1d){_0x55304b['emit'](_0x27f13f,_0x102c1d);};}function removeListener(_0x54f0ce,_0xeb83b1){return function(){ChatInternalMessageEvents[_0xaa4b('0x3')](_0x54f0ce,_0xeb83b1);};}exports[_0xaa4b('0x4')]=function(_0x146035){for(var _0x4809a9=0x0,_0x40f127=events['length'];_0x4809a9<_0x40f127;_0x4809a9++){var _0x3a6f0d=events[_0x4809a9];var _0x50ce72=createListener('chatInternalMessage:'+_0x3a6f0d,_0x146035);ChatInternalMessageEvents['on'](_0x3a6f0d,_0x50ce72);}}; \ No newline at end of file +var _0x43f3=['chatInternalMessage:','save','remove','removeListener','length'];(function(_0x4109eb,_0xda5670){var _0xdb36a4=function(_0x314df6){while(--_0x314df6){_0x4109eb['push'](_0x4109eb['shift']());}};_0xdb36a4(++_0xda5670);}(_0x43f3,0xab));var _0x343f=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x43f3[_0x273dc5];return _0x46dae7;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x343f('0x0'),_0x343f('0x1'),'update'];function createListener(_0x31adea,_0x56b1ea){return function(_0x26241f){_0x56b1ea['emit'](_0x31adea,_0x26241f);};}function removeListener(_0x3339a9,_0x24b4e8){return function(){ChatInternalMessageEvents[_0x343f('0x2')](_0x3339a9,_0x24b4e8);};}exports['register']=function(_0x2ec994){for(var _0x693775=0x0,_0x28d670=events[_0x343f('0x3')];_0x693775<_0x28d670;_0x693775++){var _0x288ae7=events[_0x693775];var _0x2808b9=createListener(_0x343f('0x4')+_0x288ae7,_0x2ec994);ChatInternalMessageEvents['on'](_0x288ae7,_0x2808b9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 85b6326..14a09b5 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(_0xb6fa1c,_0x5333c5){var _0x576211=function(_0x2eb30e){while(--_0x2eb30e){_0xb6fa1c['push'](_0xb6fa1c['shift']());}};_0x576211(++_0x5333c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xcb91[_0x51bda1];return _0x1ce08c;};'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 _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x47cf8d,_0x4e0973){var _0x4063ac=function(_0x2a08bd){while(--_0x2a08bd){_0x47cf8d['push'](_0x47cf8d['shift']());}};_0x4063ac(++_0x4e0973);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index eb33878..2183d55 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 _0x04e8=['BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT','medium'];(function(_0x2a37a4,_0x464b98){var _0x29d935=function(_0xff7180){while(--_0xff7180){_0x2a37a4['push'](_0x2a37a4['shift']());}};_0x29d935(++_0x464b98);}(_0x04e8,0x1ad));var _0x804e=function(_0x436001,_0x2c2b15){_0x436001=_0x436001-0x0;var _0x44cd04=_0x04e8[_0x436001];return _0x44cd04;};'use strict';var Sequelize=require('sequelize');module[_0x804e('0x0')]={'body':{'type':Sequelize[_0x804e('0x1')](_0x804e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x804e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x804e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x804e('0x4')]('in',_0x804e('0x5')),'defaultValue':_0x804e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x804e('0x6')]},'providerName':{'type':Sequelize[_0x804e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1fb9=['TEXT','sequelize','exports','BOOLEAN','ENUM','out','DATE'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1fb9,0x1cf));var _0x91fb=function(_0x40c601,_0x25997e){_0x40c601=_0x40c601-0x0;var _0x214a0=_0x1fb9[_0x40c601];return _0x214a0;};'use strict';var Sequelize=require(_0x91fb('0x0'));module[_0x91fb('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x91fb('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x91fb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x91fb('0x3')]('in',_0x91fb('0x4')),'defaultValue':_0x91fb('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x91fb('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x91fb('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e193b9c..f1afa7d 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 _0x7846=['destroy','name','send','index','map','ChatMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','update','describe','../../config/logger','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','set','json','apply','reject'];(function(_0x177179,_0x2580aa){var _0xe94765=function(_0x17b8a9){while(--_0x17b8a9){_0x177179['push'](_0x177179['shift']());}};_0xe94765(++_0x2580aa);}(_0x7846,0x1b0));var _0x6784=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x7846[_0xd39959];return _0x1ff69c;};'use strict';var pdf=require(_0x6784('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6784('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6784('0x2'));var moment=require('moment');var BPromise=require(_0x6784('0x3'));var Mustache=require(_0x6784('0x4'));var util=require(_0x6784('0x5'));var path=require(_0x6784('0x6'));var sox=require(_0x6784('0x7'));var csv=require(_0x6784('0x8'));var ejs=require(_0x6784('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6784('0xa'));var crypto=require(_0x6784('0xb'));var jsforce=require(_0x6784('0xc'));var deskjs=require(_0x6784('0xd'));var toCsv=require(_0x6784('0x8'));var querystring=require(_0x6784('0xe'));var Papa=require(_0x6784('0xf'));var Redis=require(_0x6784('0x10'));var authService=require(_0x6784('0x11'));var qs=require(_0x6784('0x12'));var as=require(_0x6784('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6784('0x14'));var utils=require(_0x6784('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6784('0x16'));var db=require(_0x6784('0x17'))['db'];config['redis']=_[_0x6784('0x18')](config[_0x6784('0x19')],{'host':_0x6784('0x1a'),'port':0x18eb});var socket=require(_0x6784('0x1b'))(new Redis(config[_0x6784('0x19')]));require(_0x6784('0x1c'))[_0x6784('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6784('0x1e')][_0x6784('0x1f')]({'port':0x232c});var client9002=jayson[_0x6784('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5411d8,_0x268f60,_0x31f66e,_0x7474e7){return new BPromise(function(_0x1e3428,_0x3b9f15){var _0x1d8b18=_0x7474e7||client;return _0x1d8b18[_0x6784('0x20')](_0x5411d8,_0x31f66e)[_0x6784('0x21')](function(_0x462464){logger[_0x6784('0x22')](_0x6784('0x23'),_0x268f60,_0x6784('0x24'));logger['debug'](_0x6784('0x25'),_0x268f60,_0x6784('0x24'),JSON[_0x6784('0x26')](_0x462464));if(_0x462464['error']){if(_0x462464[_0x6784('0x27')][_0x6784('0x28')]===0x1f4){logger[_0x6784('0x27')]('ChatMessage,\x20%s,\x20%s',_0x268f60,_0x462464['error'][_0x6784('0x29')]);return _0x3b9f15(_0x462464['error'][_0x6784('0x29')]);}logger[_0x6784('0x27')](_0x6784('0x23'),_0x268f60,_0x462464['error'][_0x6784('0x29')]);return _0x1e3428(_0x462464['error'][_0x6784('0x29')]);}else{logger[_0x6784('0x22')](_0x6784('0x23'),_0x268f60,_0x6784('0x24'));_0x1e3428(_0x462464[_0x6784('0x2a')][_0x6784('0x29')]);}})[_0x6784('0x2b')](function(_0x5ca4e2){logger[_0x6784('0x27')](_0x6784('0x23'),_0x268f60,_0x5ca4e2);_0x3b9f15(_0x5ca4e2);});});}function respondWithStatusCode(_0x3f71e7,_0xd9e54b){_0xd9e54b=_0xd9e54b||0xcc;return function(_0x21e742){if(_0x21e742){return _0x3f71e7[_0x6784('0x2c')](_0xd9e54b);}return _0x3f71e7[_0x6784('0x2d')](_0xd9e54b)[_0x6784('0x2e')]();};}function respondWithResult(_0x5bf02c,_0x5c66e){_0x5c66e=_0x5c66e||0xc8;return function(_0x4385fc){if(_0x4385fc){return _0x5bf02c[_0x6784('0x2d')](_0x5c66e)['json'](_0x4385fc);}};}function respondWithFilteredResult(_0x1204c7,_0x9a2175){return function(_0x58c163){if(_0x58c163){var _0x271889=_0x58c163['count'],_0x3b6094=_0x9a2175['offset'],_0x1fc9d6=_0x9a2175[_0x6784('0x2f')]+_0x9a2175['limit'],_0x49fd54;if(_0x1fc9d6>=_0x271889){_0x1fc9d6=_0x271889;_0x49fd54=0xc8;}else{_0x49fd54=0xce;}_0x1204c7[_0x6784('0x2d')](_0x49fd54);return _0x1204c7[_0x6784('0x30')]('Content-Range',_0x3b6094+'-'+_0x1fc9d6+'/'+_0x271889)[_0x6784('0x31')](_0x58c163);}return null;};}function patchUpdates(_0x12a153){return function(_0x4f4fea){try{jsonpatch[_0x6784('0x32')](_0x4f4fea,_0x12a153,!![]);}catch(_0x4eea6d){return BPromise[_0x6784('0x33')](_0x4eea6d);}return _0x4f4fea['save']();};}function saveUpdates(_0x11371e,_0x5131bc){return function(_0x2b23b7){if(_0x2b23b7){return _0x2b23b7['update'](_0x11371e)[_0x6784('0x21')](function(_0x38ab2a){return _0x38ab2a;});}return null;};}function removeEntity(_0x1245a7,_0x1a953d){return function(_0x338db4){if(_0x338db4){return _0x338db4[_0x6784('0x34')]()['then'](function(){_0x1245a7[_0x6784('0x2d')](0xcc)[_0x6784('0x2e')]();});}};}function handleEntityNotFound(_0x53754a,_0x360472){return function(_0x5807fa){if(!_0x5807fa){_0x53754a[_0x6784('0x2c')](0x194);}return _0x5807fa;};}function handleError(_0x2c0bf5,_0x5c7a16){_0x5c7a16=_0x5c7a16||0x1f4;return function(_0x24edbf){logger[_0x6784('0x27')](_0x24edbf['stack']);if(_0x24edbf[_0x6784('0x35')]){delete _0x24edbf[_0x6784('0x35')];}_0x2c0bf5[_0x6784('0x2d')](_0x5c7a16)[_0x6784('0x36')](_0x24edbf);};}exports[_0x6784('0x37')]=function(_0x496ef5,_0x18e9f6){var _0x469cdc={},_0x57b650={},_0x254fe4={'count':0x0,'rows':[]};var _0x552d5f=_[_0x6784('0x38')](db[_0x6784('0x39')]['rawAttributes'],function(_0x4b984b){return{'name':_0x4b984b[_0x6784('0x3a')],'type':_0x4b984b['type'][_0x6784('0x3b')]};});_0x57b650['model']=_[_0x6784('0x38')](_0x552d5f,_0x6784('0x35'));_0x57b650[_0x6784('0x3c')]=_[_0x6784('0x3d')](_0x496ef5[_0x6784('0x3c')]);_0x57b650[_0x6784('0x3e')]=_[_0x6784('0x3f')](_0x57b650[_0x6784('0x40')],_0x57b650[_0x6784('0x3c')]);_0x469cdc[_0x6784('0x41')]=_['intersection'](_0x57b650['model'],qs[_0x6784('0x42')](_0x496ef5[_0x6784('0x3c')][_0x6784('0x42')]));_0x469cdc[_0x6784('0x41')]=_0x469cdc[_0x6784('0x41')][_0x6784('0x43')]?_0x469cdc['attributes']:_0x57b650[_0x6784('0x40')];if(!_0x496ef5[_0x6784('0x3c')][_0x6784('0x44')](_0x6784('0x45'))){_0x469cdc[_0x6784('0x46')]=qs[_0x6784('0x46')](_0x496ef5[_0x6784('0x3c')]['limit']);_0x469cdc[_0x6784('0x2f')]=qs[_0x6784('0x2f')](_0x496ef5['query'][_0x6784('0x2f')]);}_0x469cdc[_0x6784('0x47')]=qs[_0x6784('0x48')](_0x496ef5[_0x6784('0x3c')][_0x6784('0x48')]);_0x469cdc[_0x6784('0x49')]=qs[_0x6784('0x3e')](_[_0x6784('0x4a')](_0x496ef5[_0x6784('0x3c')],_0x57b650[_0x6784('0x3e')]),_0x552d5f);if(_0x496ef5['query'][_0x6784('0x4b')]){_0x469cdc[_0x6784('0x49')]=_[_0x6784('0x4c')](_0x469cdc[_0x6784('0x49')],{'$or':_[_0x6784('0x38')](_0x552d5f,function(_0x384ff1){if(_0x384ff1[_0x6784('0x4d')]!==_0x6784('0x4e')){var _0x48aa6d={};_0x48aa6d[_0x384ff1['name']]={'$like':'%'+_0x496ef5['query']['filter']+'%'};return _0x48aa6d;}})});}_0x469cdc=_[_0x6784('0x4c')]({},_0x469cdc,_0x496ef5['options']);var _0x41ddcc={'where':_0x469cdc['where']};return db[_0x6784('0x39')][_0x6784('0x4f')](_0x41ddcc)['then'](function(_0x248a99){_0x254fe4[_0x6784('0x4f')]=_0x248a99;if(_0x496ef5[_0x6784('0x3c')][_0x6784('0x50')]){_0x469cdc[_0x6784('0x51')]=[{'all':!![]}];}return db[_0x6784('0x39')][_0x6784('0x52')](_0x469cdc);})[_0x6784('0x21')](function(_0x4ef76b){_0x254fe4[_0x6784('0x53')]=_0x4ef76b;return _0x254fe4;})[_0x6784('0x21')](respondWithFilteredResult(_0x18e9f6,_0x469cdc))[_0x6784('0x2b')](handleError(_0x18e9f6,null));};exports[_0x6784('0x54')]=function(_0x227491,_0x1c559c){var _0x3bb7fd={'raw':!![],'where':{'id':_0x227491[_0x6784('0x55')]['id']}},_0x2c2d30={};_0x2c2d30[_0x6784('0x40')]=_[_0x6784('0x3d')](db[_0x6784('0x39')][_0x6784('0x56')]);_0x2c2d30['query']=_[_0x6784('0x3d')](_0x227491[_0x6784('0x3c')]);_0x2c2d30[_0x6784('0x3e')]=_[_0x6784('0x3f')](_0x2c2d30['model'],_0x2c2d30['query']);_0x3bb7fd['attributes']=_[_0x6784('0x3f')](_0x2c2d30[_0x6784('0x40')],qs[_0x6784('0x42')](_0x227491[_0x6784('0x3c')][_0x6784('0x42')]));_0x3bb7fd[_0x6784('0x41')]=_0x3bb7fd[_0x6784('0x41')][_0x6784('0x43')]?_0x3bb7fd['attributes']:_0x2c2d30[_0x6784('0x40')];if(_0x227491['query']['includeAll']){_0x3bb7fd[_0x6784('0x51')]=[{'all':!![]}];}_0x3bb7fd=_[_0x6784('0x4c')]({},_0x3bb7fd,_0x227491['options']);return db[_0x6784('0x39')][_0x6784('0x57')](_0x3bb7fd)[_0x6784('0x21')](handleEntityNotFound(_0x1c559c,null))[_0x6784('0x21')](respondWithResult(_0x1c559c,null))[_0x6784('0x2b')](handleError(_0x1c559c,null));};exports['create']=function(_0x436e63,_0x12730b){return db[_0x6784('0x39')]['create'](_0x436e63[_0x6784('0x58')],{})['then'](respondWithResult(_0x12730b,0xc9))[_0x6784('0x2b')](handleError(_0x12730b,null));};exports[_0x6784('0x59')]=function(_0x2e9d7e,_0x4df267){if(_0x2e9d7e[_0x6784('0x58')]['id']){delete _0x2e9d7e[_0x6784('0x58')]['id'];}return db['ChatMessage'][_0x6784('0x57')]({'where':{'id':_0x2e9d7e[_0x6784('0x55')]['id']}})[_0x6784('0x21')](handleEntityNotFound(_0x4df267,null))[_0x6784('0x21')](saveUpdates(_0x2e9d7e[_0x6784('0x58')],null))[_0x6784('0x21')](respondWithResult(_0x4df267,null))[_0x6784('0x2b')](handleError(_0x4df267,null));};exports[_0x6784('0x34')]=function(_0x36bc05,_0x513739){return db[_0x6784('0x39')][_0x6784('0x57')]({'where':{'id':_0x36bc05[_0x6784('0x55')]['id']}})[_0x6784('0x21')](handleEntityNotFound(_0x513739,null))['then'](removeEntity(_0x513739,null))['catch'](handleError(_0x513739,null));};exports[_0x6784('0x5a')]=function(_0x5dc9e6,_0x4c3992){return db[_0x6784('0x39')][_0x6784('0x5a')]()[_0x6784('0x21')](respondWithResult(_0x4c3992,null))['catch'](handleError(_0x4c3992,null));};var interaction_log=require(_0x6784('0x5b'))(_0x6784('0x5c'));exports[_0x6784('0x5d')]=function(_0x46cb35,_0x12640d,_0x49033a){var _0x36e985={'channel':_0x6784('0x5e')};if(_0x46cb35[_0x6784('0x58')]['id']){delete _0x46cb35[_0x6784('0x58')]['id'];}_0x46cb35['body'][_0x6784('0x5f')]=!![];_0x46cb35[_0x6784('0x58')]['readAt']=moment()[_0x6784('0x60')](_0x6784('0x61'));_0x46cb35[_0x6784('0x58')][_0x6784('0x62')]=_0x46cb35[_0x6784('0x58')][_0x6784('0x62')]||_0x46cb35['user']['id'];return db[_0x6784('0x39')][_0x6784('0x57')]({'where':{'id':_0x46cb35[_0x6784('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x6784('0x63')],'as':_0x6784('0x64')}]})[_0x6784('0x21')](handleEntityNotFound(_0x12640d,null))[_0x6784('0x21')](saveUpdates(_0x46cb35[_0x6784('0x58')],null))[_0x6784('0x21')](function(_0x55637c){if(_0x55637c){_0x36e985[_0x6784('0x29')]=_0x55637c[_0x6784('0x65')]({'plain':!![]});return db['ChatInteraction'][_0x6784('0x57')]({'where':{'id':_0x55637c['ChatInteractionId']}});}return null;})[_0x6784('0x21')](handleEntityNotFound(_0x12640d,null))[_0x6784('0x21')](function(_0x38fd17){if(_0x38fd17){return _0x38fd17[_0x6784('0x59')]({'UserId':_0x46cb35['body'][_0x6784('0x62')],'read1stAt':_[_0x6784('0x66')](_0x38fd17[_0x6784('0x67')])?moment()['format'](_0x6784('0x61')):undefined});}return null;})[_0x6784('0x21')](function(_0x23836c){if(_0x23836c){_0x36e985[_0x6784('0x68')]=_0x23836c['get']({'plain':!![]});interaction_log['info'](_0x6784('0x69'),_0x46cb35[_0x6784('0x6a')]['id'],_0x46cb35['user'][_0x6784('0x35')],_0x46cb35['user'][_0x6784('0x6b')],_0x36e985[_0x6784('0x68')]['id'],_0x46cb35[_0x6784('0x58')]?JSON[_0x6784('0x26')](_0x46cb35['body']):_0x6784('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x6784('0x6d'),_0x36e985);}return null;})['then'](function(_0x5d23a7){if(_0x5d23a7){if(_0x46cb35[_0x6784('0x58')][_0x6784('0x6e')]){_0x36e985[_0x6784('0x29')][_0x6784('0x6f')]=util[_0x6784('0x60')](_0x6784('0x70'),_0x46cb35[_0x6784('0x6a')][_0x6784('0x35')]);_0x36e985[_0x6784('0x29')][_0x6784('0x71')]=_0x36e985['channel'];_0x36e985[_0x6784('0x29')][_0x6784('0x72')]='accept';return respondWithRpcPromise(_0x6784('0x73'),_0x6784('0x73'),{'event':'acceptmessage','message':_[_0x6784('0x4c')](_0x36e985['message'],JSON['parse'](_0x36e985[_0x6784('0x68')]['formData']))},client9002)[_0x6784('0x21')](function(){return _0x36e985;});}return _0x36e985;}return null;})[_0x6784('0x21')](respondWithResult(_0x12640d,null))['catch'](handleError(_0x12640d,null));};var interaction_log=require('../../config/logger')(_0x6784('0x5c'));exports[_0x6784('0x33')]=function(_0x91de63,_0x19f7b6,_0x2416cb){var _0x1ace3c={'agent':{},'channel':_0x6784('0x5e')};if(_0x91de63[_0x6784('0x58')]['id']){delete _0x91de63[_0x6784('0x58')]['id'];}_0x91de63[_0x6784('0x58')][_0x6784('0x62')]=_0x91de63[_0x6784('0x58')]['UserId']||_0x91de63[_0x6784('0x6a')]['id'];_0x1ace3c['agent']['id']=_0x91de63['body']['UserId'];return db[_0x6784('0x39')]['find']({'where':{'id':_0x91de63['params']['id'],'UserId':null}})[_0x6784('0x21')](handleEntityNotFound(_0x19f7b6,null))['then'](function(_0x1ce111){if(_0x1ce111){_0x1ace3c[_0x6784('0x29')]=_0x1ce111[_0x6784('0x65')]({'plain':!![]});return db[_0x6784('0x74')][_0x6784('0x57')]({'where':{'id':_0x1ce111[_0x6784('0x75')]}});}return null;})[_0x6784('0x21')](handleEntityNotFound(_0x19f7b6,null))[_0x6784('0x21')](function(_0xe31bff){if(_0xe31bff){_0x1ace3c[_0x6784('0x68')]=_0xe31bff[_0x6784('0x65')]({'plain':!![]});interaction_log[_0x6784('0x22')](_0x6784('0x76'),_0x91de63[_0x6784('0x6a')]['id'],_0x91de63[_0x6784('0x6a')][_0x6784('0x35')],_0x91de63[_0x6784('0x6a')][_0x6784('0x6b')],_0x1ace3c['interaction']['id'],_0x91de63['body']?JSON[_0x6784('0x26')](_0x91de63[_0x6784('0x58')]):_0x6784('0x6c'));return respondWithRpcPromise(_0x6784('0x77'),'rejectMessage',_0x1ace3c);}return null;})[_0x6784('0x21')](function(_0x38301f){if(_0x38301f){_0x38301f['message'][_0x6784('0x6f')]=util[_0x6784('0x60')]('SIP/%s',_0x91de63[_0x6784('0x6a')]['name']);_0x38301f['message'][_0x6784('0x71')]=_0x1ace3c[_0x6784('0x71')];_0x38301f['message'][_0x6784('0x72')]='reject';respondWithRpcPromise(_0x6784('0x73'),_0x6784('0x73'),{'event':_0x6784('0x78'),'message':_0x38301f[_0x6784('0x29')]},client9002);return _0x1ace3c;}return null;})[_0x6784('0x21')](respondWithResult(_0x19f7b6,null))[_0x6784('0x2b')](handleError(_0x19f7b6,null));}; \ No newline at end of file +var _0xa4fc=['sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','include','options','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','parse','formData','agent','ChatInteraction','RejectMessage','rejectmessage','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x25f0cd,_0x4cde3e){var _0x1f442d=function(_0x4fffd1){while(--_0x4fffd1){_0x25f0cd['push'](_0x25f0cd['shift']());}};_0x1f442d(++_0x4cde3e);}(_0xa4fc,0x19c));var _0xca4f=function(_0x33108d,_0x3bf92c){_0x33108d=_0x33108d-0x0;var _0x3c5125=_0xa4fc[_0x33108d];return _0x3c5125;};'use strict';var pdf=require(_0xca4f('0x0'));var emlformat=require(_0xca4f('0x1'));var rimraf=require(_0xca4f('0x2'));var zipdir=require(_0xca4f('0x3'));var jsonpatch=require(_0xca4f('0x4'));var rp=require(_0xca4f('0x5'));var moment=require(_0xca4f('0x6'));var BPromise=require(_0xca4f('0x7'));var Mustache=require(_0xca4f('0x8'));var util=require(_0xca4f('0x9'));var path=require('path');var sox=require(_0xca4f('0xa'));var csv=require(_0xca4f('0xb'));var ejs=require(_0xca4f('0xc'));var fs=require('fs');var _=require(_0xca4f('0xd'));var squel=require(_0xca4f('0xe'));var crypto=require(_0xca4f('0xf'));var jsforce=require(_0xca4f('0x10'));var deskjs=require(_0xca4f('0x11'));var toCsv=require(_0xca4f('0xb'));var querystring=require('querystring');var Papa=require(_0xca4f('0x12'));var Redis=require(_0xca4f('0x13'));var authService=require(_0xca4f('0x14'));var qs=require(_0xca4f('0x15'));var as=require(_0xca4f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca4f('0x17'))(_0xca4f('0x18'));var utils=require(_0xca4f('0x19'));var config=require(_0xca4f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xca4f('0x1b')]=_[_0xca4f('0x1c')](config[_0xca4f('0x1b')],{'host':_0xca4f('0x1d'),'port':0x18eb});var socket=require(_0xca4f('0x1e'))(new Redis(config[_0xca4f('0x1b')]));require(_0xca4f('0x1f'))['register'](socket);var jayson=require(_0xca4f('0x20'));var client=jayson['client'][_0xca4f('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x511b75,_0x2b6494,_0x6f5b0f,_0x317d7f){return new BPromise(function(_0x2b6688,_0x1761a0){var _0x22e8a5=_0x317d7f||client;return _0x22e8a5[_0xca4f('0x22')](_0x511b75,_0x6f5b0f)[_0xca4f('0x23')](function(_0xec245d){logger[_0xca4f('0x24')](_0xca4f('0x25'),_0x2b6494,_0xca4f('0x26'));logger[_0xca4f('0x27')](_0xca4f('0x28'),_0x2b6494,_0xca4f('0x26'),JSON['stringify'](_0xec245d));if(_0xec245d[_0xca4f('0x29')]){if(_0xec245d[_0xca4f('0x29')][_0xca4f('0x2a')]===0x1f4){logger[_0xca4f('0x29')](_0xca4f('0x25'),_0x2b6494,_0xec245d[_0xca4f('0x29')][_0xca4f('0x2b')]);return _0x1761a0(_0xec245d[_0xca4f('0x29')]['message']);}logger[_0xca4f('0x29')](_0xca4f('0x25'),_0x2b6494,_0xec245d[_0xca4f('0x29')][_0xca4f('0x2b')]);return _0x2b6688(_0xec245d[_0xca4f('0x29')][_0xca4f('0x2b')]);}else{logger[_0xca4f('0x24')](_0xca4f('0x25'),_0x2b6494,_0xca4f('0x26'));_0x2b6688(_0xec245d[_0xca4f('0x2c')][_0xca4f('0x2b')]);}})[_0xca4f('0x2d')](function(_0xe8f1a1){logger[_0xca4f('0x29')]('ChatMessage,\x20%s,\x20%s',_0x2b6494,_0xe8f1a1);_0x1761a0(_0xe8f1a1);});});}function respondWithStatusCode(_0x421bed,_0x3f17b8){_0x3f17b8=_0x3f17b8||0xcc;return function(_0x424771){if(_0x424771){return _0x421bed[_0xca4f('0x2e')](_0x3f17b8);}return _0x421bed[_0xca4f('0x2f')](_0x3f17b8)[_0xca4f('0x30')]();};}function respondWithResult(_0x5d59fd,_0x5e96ca){_0x5e96ca=_0x5e96ca||0xc8;return function(_0xd31532){if(_0xd31532){return _0x5d59fd[_0xca4f('0x2f')](_0x5e96ca)[_0xca4f('0x31')](_0xd31532);}};}function respondWithFilteredResult(_0x4e120f,_0x37e310){return function(_0x368343){if(_0x368343){var _0x1b124a=_0x368343[_0xca4f('0x32')],_0x51875e=_0x37e310[_0xca4f('0x33')],_0x31a93b=_0x37e310[_0xca4f('0x33')]+_0x37e310[_0xca4f('0x34')],_0x3cf60f;if(_0x31a93b>=_0x1b124a){_0x31a93b=_0x1b124a;_0x3cf60f=0xc8;}else{_0x3cf60f=0xce;}_0x4e120f[_0xca4f('0x2f')](_0x3cf60f);return _0x4e120f[_0xca4f('0x35')](_0xca4f('0x36'),_0x51875e+'-'+_0x31a93b+'/'+_0x1b124a)[_0xca4f('0x31')](_0x368343);}return null;};}function patchUpdates(_0x2a0791){return function(_0x514bb1){try{jsonpatch['apply'](_0x514bb1,_0x2a0791,!![]);}catch(_0x2251f2){return BPromise[_0xca4f('0x37')](_0x2251f2);}return _0x514bb1['save']();};}function saveUpdates(_0x43edab,_0x5c2616){return function(_0x2c4916){if(_0x2c4916){return _0x2c4916[_0xca4f('0x38')](_0x43edab)[_0xca4f('0x23')](function(_0x11213f){return _0x11213f;});}return null;};}function removeEntity(_0x3abea2,_0x431636){return function(_0x2b1daa){if(_0x2b1daa){return _0x2b1daa[_0xca4f('0x39')]()['then'](function(){_0x3abea2[_0xca4f('0x2f')](0xcc)[_0xca4f('0x30')]();});}};}function handleEntityNotFound(_0x49a464,_0x57f050){return function(_0x4ee152){if(!_0x4ee152){_0x49a464[_0xca4f('0x2e')](0x194);}return _0x4ee152;};}function handleError(_0x41a391,_0x3e2781){_0x3e2781=_0x3e2781||0x1f4;return function(_0x101f4c){logger[_0xca4f('0x29')](_0x101f4c['stack']);if(_0x101f4c[_0xca4f('0x3a')]){delete _0x101f4c[_0xca4f('0x3a')];}_0x41a391[_0xca4f('0x2f')](_0x3e2781)[_0xca4f('0x3b')](_0x101f4c);};}exports[_0xca4f('0x3c')]=function(_0x48a624,_0x264c13){var _0x40e1b1={},_0x37b994={},_0x21c237={'count':0x0,'rows':[]};var _0x716b7a=_[_0xca4f('0x3d')](db[_0xca4f('0x3e')][_0xca4f('0x3f')],function(_0x4e7b2a){return{'name':_0x4e7b2a[_0xca4f('0x40')],'type':_0x4e7b2a[_0xca4f('0x41')]['key']};});_0x37b994[_0xca4f('0x42')]=_['map'](_0x716b7a,'name');_0x37b994[_0xca4f('0x43')]=_[_0xca4f('0x44')](_0x48a624[_0xca4f('0x43')]);_0x37b994[_0xca4f('0x45')]=_[_0xca4f('0x46')](_0x37b994[_0xca4f('0x42')],_0x37b994['query']);_0x40e1b1['attributes']=_[_0xca4f('0x46')](_0x37b994[_0xca4f('0x42')],qs['fields'](_0x48a624[_0xca4f('0x43')][_0xca4f('0x47')]));_0x40e1b1[_0xca4f('0x48')]=_0x40e1b1['attributes'][_0xca4f('0x49')]?_0x40e1b1[_0xca4f('0x48')]:_0x37b994[_0xca4f('0x42')];if(!_0x48a624[_0xca4f('0x43')][_0xca4f('0x4a')]('nolimit')){_0x40e1b1[_0xca4f('0x34')]=qs[_0xca4f('0x34')](_0x48a624['query']['limit']);_0x40e1b1[_0xca4f('0x33')]=qs[_0xca4f('0x33')](_0x48a624[_0xca4f('0x43')][_0xca4f('0x33')]);}_0x40e1b1[_0xca4f('0x4b')]=qs[_0xca4f('0x4c')](_0x48a624['query'][_0xca4f('0x4c')]);_0x40e1b1[_0xca4f('0x4d')]=qs[_0xca4f('0x45')](_[_0xca4f('0x4e')](_0x48a624[_0xca4f('0x43')],_0x37b994['filters']),_0x716b7a);if(_0x48a624[_0xca4f('0x43')][_0xca4f('0x4f')]){_0x40e1b1[_0xca4f('0x4d')]=_[_0xca4f('0x50')](_0x40e1b1[_0xca4f('0x4d')],{'$or':_['map'](_0x716b7a,function(_0x4dfc7d){if(_0x4dfc7d['type']!=='VIRTUAL'){var _0x24b984={};_0x24b984[_0x4dfc7d['name']]={'$like':'%'+_0x48a624[_0xca4f('0x43')][_0xca4f('0x4f')]+'%'};return _0x24b984;}})});}_0x40e1b1=_[_0xca4f('0x50')]({},_0x40e1b1,_0x48a624['options']);var _0x4f8ae7={'where':_0x40e1b1[_0xca4f('0x4d')]};return db[_0xca4f('0x3e')]['count'](_0x4f8ae7)[_0xca4f('0x23')](function(_0x31749c){_0x21c237['count']=_0x31749c;if(_0x48a624[_0xca4f('0x43')][_0xca4f('0x51')]){_0x40e1b1['include']=[{'all':!![]}];}return db[_0xca4f('0x3e')][_0xca4f('0x52')](_0x40e1b1);})[_0xca4f('0x23')](function(_0xd01935){_0x21c237[_0xca4f('0x53')]=_0xd01935;return _0x21c237;})[_0xca4f('0x23')](respondWithFilteredResult(_0x264c13,_0x40e1b1))[_0xca4f('0x2d')](handleError(_0x264c13,null));};exports[_0xca4f('0x54')]=function(_0x2ef5d7,_0x112ef0){var _0x2cea78={'raw':!![],'where':{'id':_0x2ef5d7[_0xca4f('0x55')]['id']}},_0x3da937={};_0x3da937[_0xca4f('0x42')]=_[_0xca4f('0x44')](db['ChatMessage'][_0xca4f('0x3f')]);_0x3da937[_0xca4f('0x43')]=_[_0xca4f('0x44')](_0x2ef5d7['query']);_0x3da937['filters']=_[_0xca4f('0x46')](_0x3da937[_0xca4f('0x42')],_0x3da937[_0xca4f('0x43')]);_0x2cea78[_0xca4f('0x48')]=_[_0xca4f('0x46')](_0x3da937['model'],qs[_0xca4f('0x47')](_0x2ef5d7['query'][_0xca4f('0x47')]));_0x2cea78[_0xca4f('0x48')]=_0x2cea78['attributes'][_0xca4f('0x49')]?_0x2cea78[_0xca4f('0x48')]:_0x3da937[_0xca4f('0x42')];if(_0x2ef5d7[_0xca4f('0x43')][_0xca4f('0x51')]){_0x2cea78[_0xca4f('0x56')]=[{'all':!![]}];}_0x2cea78=_[_0xca4f('0x50')]({},_0x2cea78,_0x2ef5d7[_0xca4f('0x57')]);return db[_0xca4f('0x3e')][_0xca4f('0x58')](_0x2cea78)[_0xca4f('0x23')](handleEntityNotFound(_0x112ef0,null))[_0xca4f('0x23')](respondWithResult(_0x112ef0,null))[_0xca4f('0x2d')](handleError(_0x112ef0,null));};exports[_0xca4f('0x59')]=function(_0x5f2777,_0x5b47f9){return db[_0xca4f('0x3e')]['create'](_0x5f2777[_0xca4f('0x5a')],{})['then'](respondWithResult(_0x5b47f9,0xc9))['catch'](handleError(_0x5b47f9,null));};exports['update']=function(_0x496df0,_0x51a918){if(_0x496df0[_0xca4f('0x5a')]['id']){delete _0x496df0[_0xca4f('0x5a')]['id'];}return db[_0xca4f('0x3e')][_0xca4f('0x58')]({'where':{'id':_0x496df0[_0xca4f('0x55')]['id']}})[_0xca4f('0x23')](handleEntityNotFound(_0x51a918,null))[_0xca4f('0x23')](saveUpdates(_0x496df0[_0xca4f('0x5a')],null))['then'](respondWithResult(_0x51a918,null))[_0xca4f('0x2d')](handleError(_0x51a918,null));};exports[_0xca4f('0x39')]=function(_0x59aa6b,_0x1f8a89){return db[_0xca4f('0x3e')]['find']({'where':{'id':_0x59aa6b[_0xca4f('0x55')]['id']}})[_0xca4f('0x23')](handleEntityNotFound(_0x1f8a89,null))[_0xca4f('0x23')](removeEntity(_0x1f8a89,null))[_0xca4f('0x2d')](handleError(_0x1f8a89,null));};exports[_0xca4f('0x5b')]=function(_0x3d052e,_0x51188f){return db[_0xca4f('0x3e')][_0xca4f('0x5b')]()['then'](respondWithResult(_0x51188f,null))['catch'](handleError(_0x51188f,null));};var interaction_log=require(_0xca4f('0x17'))(_0xca4f('0x5c'));exports[_0xca4f('0x5d')]=function(_0x1971ea,_0x2d84d8,_0x445907){var _0x283753={'channel':_0xca4f('0x5e')};if(_0x1971ea[_0xca4f('0x5a')]['id']){delete _0x1971ea['body']['id'];}_0x1971ea[_0xca4f('0x5a')][_0xca4f('0x5f')]=!![];_0x1971ea['body']['readAt']=moment()[_0xca4f('0x60')](_0xca4f('0x61'));_0x1971ea[_0xca4f('0x5a')][_0xca4f('0x62')]=_0x1971ea['body'][_0xca4f('0x62')]||_0x1971ea['user']['id'];return db[_0xca4f('0x3e')][_0xca4f('0x58')]({'where':{'id':_0x1971ea[_0xca4f('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xca4f('0x63')],'as':_0xca4f('0x64')}]})[_0xca4f('0x23')](handleEntityNotFound(_0x2d84d8,null))[_0xca4f('0x23')](saveUpdates(_0x1971ea['body'],null))[_0xca4f('0x23')](function(_0x355217){if(_0x355217){_0x283753['message']=_0x355217[_0xca4f('0x65')]({'plain':!![]});return db['ChatInteraction'][_0xca4f('0x58')]({'where':{'id':_0x355217['ChatInteractionId']}});}return null;})[_0xca4f('0x23')](handleEntityNotFound(_0x2d84d8,null))[_0xca4f('0x23')](function(_0x51265a){if(_0x51265a){return _0x51265a['update']({'UserId':_0x1971ea[_0xca4f('0x5a')][_0xca4f('0x62')],'read1stAt':_[_0xca4f('0x66')](_0x51265a[_0xca4f('0x67')])?moment()[_0xca4f('0x60')](_0xca4f('0x61')):undefined});}return null;})[_0xca4f('0x23')](function(_0x1b2620){if(_0x1b2620){_0x283753[_0xca4f('0x68')]=_0x1b2620[_0xca4f('0x65')]({'plain':!![]});interaction_log[_0xca4f('0x24')](_0xca4f('0x69'),_0x1971ea[_0xca4f('0x6a')]['id'],_0x1971ea[_0xca4f('0x6a')][_0xca4f('0x3a')],_0x1971ea[_0xca4f('0x6a')][_0xca4f('0x6b')],_0x283753[_0xca4f('0x68')]['id'],_0x1971ea[_0xca4f('0x5a')]?JSON['stringify'](_0x1971ea[_0xca4f('0x5a')]):_0xca4f('0x6c'));return respondWithRpcPromise(_0xca4f('0x6d'),_0xca4f('0x6e'),_0x283753);}return null;})['then'](function(_0x37546f){if(_0x37546f){if(_0x1971ea[_0xca4f('0x5a')]['manual']){_0x283753[_0xca4f('0x2b')][_0xca4f('0x6f')]=util[_0xca4f('0x60')](_0xca4f('0x70'),_0x1971ea[_0xca4f('0x6a')][_0xca4f('0x3a')]);_0x283753[_0xca4f('0x2b')][_0xca4f('0x71')]=_0x283753['channel'];_0x283753[_0xca4f('0x2b')][_0xca4f('0x72')]=_0xca4f('0x5d');return respondWithRpcPromise(_0xca4f('0x73'),_0xca4f('0x73'),{'event':'acceptmessage','message':_['merge'](_0x283753[_0xca4f('0x2b')],JSON[_0xca4f('0x74')](_0x283753['interaction'][_0xca4f('0x75')]))},client9002)[_0xca4f('0x23')](function(){return _0x283753;});}return _0x283753;}return null;})[_0xca4f('0x23')](respondWithResult(_0x2d84d8,null))[_0xca4f('0x2d')](handleError(_0x2d84d8,null));};var interaction_log=require(_0xca4f('0x17'))(_0xca4f('0x5c'));exports[_0xca4f('0x37')]=function(_0x47f2e1,_0x3e69d5,_0x5bcb3f){var _0x40a209={'agent':{},'channel':_0xca4f('0x5e')};if(_0x47f2e1['body']['id']){delete _0x47f2e1[_0xca4f('0x5a')]['id'];}_0x47f2e1[_0xca4f('0x5a')][_0xca4f('0x62')]=_0x47f2e1['body']['UserId']||_0x47f2e1['user']['id'];_0x40a209[_0xca4f('0x76')]['id']=_0x47f2e1[_0xca4f('0x5a')][_0xca4f('0x62')];return db[_0xca4f('0x3e')][_0xca4f('0x58')]({'where':{'id':_0x47f2e1[_0xca4f('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e69d5,null))[_0xca4f('0x23')](function(_0x57b14e){if(_0x57b14e){_0x40a209[_0xca4f('0x2b')]=_0x57b14e[_0xca4f('0x65')]({'plain':!![]});return db[_0xca4f('0x77')][_0xca4f('0x58')]({'where':{'id':_0x57b14e['ChatInteractionId']}});}return null;})[_0xca4f('0x23')](handleEntityNotFound(_0x3e69d5,null))[_0xca4f('0x23')](function(_0x1135fa){if(_0x1135fa){_0x40a209[_0xca4f('0x68')]=_0x1135fa[_0xca4f('0x65')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47f2e1[_0xca4f('0x6a')]['id'],_0x47f2e1[_0xca4f('0x6a')][_0xca4f('0x3a')],_0x47f2e1[_0xca4f('0x6a')][_0xca4f('0x6b')],_0x40a209[_0xca4f('0x68')]['id'],_0x47f2e1[_0xca4f('0x5a')]?JSON['stringify'](_0x47f2e1[_0xca4f('0x5a')]):_0xca4f('0x6c'));return respondWithRpcPromise(_0xca4f('0x78'),'rejectMessage',_0x40a209);}return null;})[_0xca4f('0x23')](function(_0x1feb42){if(_0x1feb42){_0x1feb42[_0xca4f('0x2b')][_0xca4f('0x6f')]=util[_0xca4f('0x60')](_0xca4f('0x70'),_0x47f2e1[_0xca4f('0x6a')][_0xca4f('0x3a')]);_0x1feb42[_0xca4f('0x2b')]['channel']=_0x40a209[_0xca4f('0x71')];_0x1feb42[_0xca4f('0x2b')][_0xca4f('0x72')]=_0xca4f('0x37');respondWithRpcPromise('EventManager',_0xca4f('0x73'),{'event':_0xca4f('0x79'),'message':_0x1feb42[_0xca4f('0x2b')]},client9002);return _0x40a209;}return null;})[_0xca4f('0x23')](respondWithResult(_0x3e69d5,null))[_0xca4f('0x2d')](handleError(_0x3e69d5,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 11d278c..2ff5b39 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 _0xf158=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x399334,_0x4e7be9){var _0x37e5ef=function(_0x414671){while(--_0x414671){_0x399334['push'](_0x399334['shift']());}};_0x37e5ef(++_0x4e7be9);}(_0xf158,0x79));var _0x8f15=function(_0x175961,_0x2a1df0){_0x175961=_0x175961-0x0;var _0xa9c4ee=_0xf158[_0x175961];return _0xa9c4ee;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8f15('0x0'))['db'][_0x8f15('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8f15('0x2')](0x0);var events={'afterCreate':_0x8f15('0x3'),'afterUpdate':_0x8f15('0x4'),'afterDestroy':'remove'};function emitEvent(_0x362529){return function(_0x20a7b4,_0x453c87,_0x8ecdb3){ChatMessageEvents[_0x8f15('0x5')](_0x362529+':'+_0x20a7b4['id'],_0x20a7b4);ChatMessageEvents[_0x8f15('0x5')](_0x362529,_0x20a7b4);_0x8ecdb3(null);};}for(var e in events){if(events[_0x8f15('0x6')](e)){var event=events[e];ChatMessage[_0x8f15('0x7')](e,emitEvent(event));}}module[_0x8f15('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x2c42=['exports','events','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x9c32bb,_0x185bb5){var _0x4f3e7b=function(_0x461b0e){while(--_0x461b0e){_0x9c32bb['push'](_0x9c32bb['shift']());}};_0x4f3e7b(++_0x185bb5);}(_0x2c42,0xb5));var _0x22c4=function(_0x5e84a8,_0x58688c){_0x5e84a8=_0x5e84a8-0x0;var _0x2cc9c0=_0x2c42[_0x5e84a8];return _0x2cc9c0;};'use strict';var EventEmitter=require(_0x22c4('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x22c4('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22c531){return function(_0x4ae7a5,_0x48ec46,_0x1ead7b){ChatMessageEvents['emit'](_0x22c531+':'+_0x4ae7a5['id'],_0x4ae7a5);ChatMessageEvents[_0x22c4('0x2')](_0x22c531,_0x4ae7a5);_0x1ead7b(null);};}for(var e in events){if(events[_0x22c4('0x3')](e)){var event=events[e];ChatMessage[_0x22c4('0x4')](e,emitEvent(event));}}module[_0x22c4('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 8fac9b9..8575556 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 _0xc31a=['bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash'];(function(_0x537b8b,_0xe4edc9){var _0xbd8b33=function(_0x39370e){while(--_0x39370e){_0x537b8b['push'](_0x537b8b['shift']());}};_0xbd8b33(++_0xe4edc9);}(_0xc31a,0x19f));var _0xac31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc31a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xac31('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xac31('0x1'));var rp=require(_0xac31('0x2'));var fs=require('fs');var path=require(_0xac31('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac31('0x4'));module[_0xac31('0x5')]=function(_0x3b62ed,_0x5952fb){return _0x3b62ed[_0xac31('0x6')](_0xac31('0x7'),attributes,{'tableName':_0xac31('0x8'),'paranoid':![],'indexes':[{'name':_0xac31('0x9'),'fields':[_0xac31('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x484981,_0x242038,_0x180e10){var _0x2fa100=_0x3b62ed[_0xac31('0xb')];var _0x199039=_0x484981[_0xac31('0xc')]({'plain':!![]});if(_0x199039[_0xac31('0xd')]['toLowerCase']()==='in'||_0x199039[_0xac31('0xd')][_0xac31('0xe')]()===_0xac31('0xf')&&!_0x199039[_0xac31('0x10')]&&!_[_0xac31('0x11')](_0x199039[_0xac31('0x12')])){_0x2fa100[_0xac31('0x13')][_0xac31('0x14')]({'where':{'id':_0x199039['ChatInteractionId']}})[_0xac31('0x15')](function(_0x1e8d27){if(_0x1e8d27){_0x1e8d27[_0xac31('0x16')]({'lastMsgAt':_0x199039[_0xac31('0x17')],'lastMsgDirection':_0x199039[_0xac31('0xd')]['toLowerCase']()});}})[_0xac31('0x18')](function(_0x254c56){console['error'](_0x254c56);});}_0x180e10();}},'charset':'utf8mb4','collate':_0xac31('0x19')});}; \ No newline at end of file +var _0xf642=['path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','ChatInteraction','findOne','createdAt','catch','error','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1ac87f,_0x185331){var _0x49c015=function(_0x5803fa){while(--_0x5803fa){_0x1ac87f['push'](_0x1ac87f['shift']());}};_0x49c015(++_0x185331);}(_0xf642,0x12e));var _0x2f64=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0xf642[_0x555ebb];return _0x3c0a4a;};'use strict';var _=require(_0x2f64('0x0'));var util=require(_0x2f64('0x1'));var logger=require('../../config/logger')(_0x2f64('0x2'));var moment=require(_0x2f64('0x3'));var BPromise=require(_0x2f64('0x4'));var rp=require(_0x2f64('0x5'));var fs=require('fs');var path=require(_0x2f64('0x6'));var rimraf=require(_0x2f64('0x7'));var config=require(_0x2f64('0x8'));var attributes=require(_0x2f64('0x9'));module[_0x2f64('0xa')]=function(_0x1805b9,_0x352758){return _0x1805b9[_0x2f64('0xb')](_0x2f64('0xc'),attributes,{'tableName':_0x2f64('0xd'),'paranoid':![],'indexes':[{'name':_0x2f64('0xe'),'fields':[_0x2f64('0xf')],'type':_0x2f64('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e8859,_0x533abe,_0xb70f12){var _0xdd271c=_0x1805b9[_0x2f64('0x11')];var _0x155893=_0x2e8859[_0x2f64('0x12')]({'plain':!![]});if(_0x155893[_0x2f64('0x13')][_0x2f64('0x14')]()==='in'||_0x155893[_0x2f64('0x13')][_0x2f64('0x14')]()===_0x2f64('0x15')&&!_0x155893['secret']&&!_[_0x2f64('0x16')](_0x155893['UserId'])){_0xdd271c[_0x2f64('0x17')][_0x2f64('0x18')]({'where':{'id':_0x155893['ChatInteractionId']}})['then'](function(_0x2b417f){if(_0x2b417f){_0x2b417f['update']({'lastMsgAt':_0x155893[_0x2f64('0x19')],'lastMsgDirection':_0x155893[_0x2f64('0x13')][_0x2f64('0x14')]()});}})[_0x2f64('0x1a')](function(_0x228215){console[_0x2f64('0x1b')](_0x228215);});}_0xb70f12();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 17551cc..a34731d 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 _0xa054=['redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','options','raw','CreateChatMessage','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x498f41,_0x350d11){var _0x87eea=function(_0x56ce92){while(--_0x56ce92){_0x498f41['push'](_0x498f41['shift']());}};_0x87eea(++_0x350d11);}(_0xa054,0x1ab));var _0x4a05=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xa054[_0x117f4c];return _0x2b24e9;};'use strict';var _=require('lodash');var util=require(_0x4a05('0x0'));var moment=require(_0x4a05('0x1'));var BPromise=require(_0x4a05('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(_0x4a05('0x3'))('rpc');var config=require(_0x4a05('0x4'));var jayson=require(_0x4a05('0x5'));var client=jayson[_0x4a05('0x6')][_0x4a05('0x7')]({'port':0x232a});config[_0x4a05('0x8')]=_[_0x4a05('0x9')](config[_0x4a05('0x8')],{'host':_0x4a05('0xa'),'port':0x18eb});var socket=require(_0x4a05('0xb'))(new Redis(config['redis']));require(_0x4a05('0xc'))['register'](socket);function respondWithRpcPromise(_0x3c4e5a,_0x1cf478,_0x3e2d51){return new BPromise(function(_0x446539,_0x108d30){return client['request'](_0x3c4e5a,_0x3e2d51)[_0x4a05('0xd')](function(_0x5cf75d){logger[_0x4a05('0xe')](_0x4a05('0xf'),_0x1cf478,_0x4a05('0x10'));logger[_0x4a05('0x11')](_0x4a05('0x12'),_0x1cf478,_0x4a05('0x10'),JSON[_0x4a05('0x13')](_0x5cf75d));if(_0x5cf75d[_0x4a05('0x14')]){if(_0x5cf75d['error'][_0x4a05('0x15')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1cf478,_0x5cf75d['error'][_0x4a05('0x16')]);return _0x108d30(_0x5cf75d['error'][_0x4a05('0x16')]);}logger[_0x4a05('0x14')](_0x4a05('0xf'),_0x1cf478,_0x5cf75d[_0x4a05('0x14')][_0x4a05('0x16')]);return _0x446539(_0x5cf75d[_0x4a05('0x14')][_0x4a05('0x16')]);}else{logger[_0x4a05('0xe')]('ChatMessage,\x20%s,\x20%s',_0x1cf478,_0x4a05('0x10'));_0x446539(_0x5cf75d[_0x4a05('0x17')][_0x4a05('0x16')]);}})[_0x4a05('0x18')](function(_0x26d023){logger['error'](_0x4a05('0xf'),_0x1cf478,_0x26d023);_0x108d30(_0x26d023);});});}exports['CreateChatMessage']=function(_0x50c4c9){var _0x40b746=this;return new Promise(function(_0xe16c46,_0x5f5dfe){return db[_0x4a05('0x19')]['create'](_0x50c4c9['body'],{'raw':_0x50c4c9[_0x4a05('0x1a')]?_0x50c4c9[_0x4a05('0x1a')][_0x4a05('0x1b')]===undefined?!![]:![]:!![]})[_0x4a05('0xd')](function(_0x516b9e){logger[_0x4a05('0xe')](_0x4a05('0x1c'),_0x50c4c9);logger[_0x4a05('0x11')](_0x4a05('0x1c'),_0x50c4c9,JSON[_0x4a05('0x13')](_0x516b9e));_0xe16c46(_0x516b9e);})[_0x4a05('0x18')](function(_0x2cfda4){logger['error'](_0x4a05('0x1c'),_0x2cfda4[_0x4a05('0x16')],_0x50c4c9);_0x5f5dfe(_0x40b746[_0x4a05('0x14')](0x1f4,_0x2cfda4['message']));});});}; \ No newline at end of file +var _0x20bb=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatMessage.socket','register','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','create','body','options','raw','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x2b757b,_0x3537fd){var _0x4974ee=function(_0x3db32b){while(--_0x3db32b){_0x2b757b['push'](_0x2b757b['shift']());}};_0x4974ee(++_0x3537fd);}(_0x20bb,0x78));var _0xb20b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x20bb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb20b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb20b('0x1'));var fs=require('fs');var Redis=require(_0xb20b('0x2'));var db=require(_0xb20b('0x3'))['db'];var utils=require(_0xb20b('0x4'));var logger=require('../../config/logger')(_0xb20b('0x5'));var config=require(_0xb20b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb20b('0x7')][_0xb20b('0x8')]({'port':0x232a});config[_0xb20b('0x9')]=_[_0xb20b('0xa')](config[_0xb20b('0x9')],{'host':_0xb20b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb20b('0x9')]));require(_0xb20b('0xc'))[_0xb20b('0xd')](socket);function respondWithRpcPromise(_0x9a1f70,_0x19bf4a,_0x4b0475){return new BPromise(function(_0x235e7b,_0x390e00){return client['request'](_0x9a1f70,_0x4b0475)[_0xb20b('0xe')](function(_0x19783d){logger[_0xb20b('0xf')]('ChatMessage,\x20%s,\x20%s',_0x19bf4a,_0xb20b('0x10'));logger[_0xb20b('0x11')](_0xb20b('0x12'),_0x19bf4a,_0xb20b('0x10'),JSON[_0xb20b('0x13')](_0x19783d));if(_0x19783d['error']){if(_0x19783d[_0xb20b('0x14')][_0xb20b('0x15')]===0x1f4){logger[_0xb20b('0x14')](_0xb20b('0x16'),_0x19bf4a,_0x19783d['error'][_0xb20b('0x17')]);return _0x390e00(_0x19783d[_0xb20b('0x14')]['message']);}logger[_0xb20b('0x14')](_0xb20b('0x16'),_0x19bf4a,_0x19783d[_0xb20b('0x14')][_0xb20b('0x17')]);return _0x235e7b(_0x19783d['error']['message']);}else{logger[_0xb20b('0xf')](_0xb20b('0x16'),_0x19bf4a,_0xb20b('0x10'));_0x235e7b(_0x19783d[_0xb20b('0x18')]['message']);}})[_0xb20b('0x19')](function(_0x10ac6a){logger[_0xb20b('0x14')]('ChatMessage,\x20%s,\x20%s',_0x19bf4a,_0x10ac6a);_0x390e00(_0x10ac6a);});});}exports[_0xb20b('0x1a')]=function(_0x2b618c){var _0x283f93=this;return new Promise(function(_0x2ff64b,_0x55b123){return db['ChatMessage'][_0xb20b('0x1b')](_0x2b618c[_0xb20b('0x1c')],{'raw':_0x2b618c[_0xb20b('0x1d')]?_0x2b618c[_0xb20b('0x1d')][_0xb20b('0x1e')]===undefined?!![]:![]:!![]})[_0xb20b('0xe')](function(_0x18ebd5){logger[_0xb20b('0xf')](_0xb20b('0x1a'),_0x2b618c);logger['debug'](_0xb20b('0x1a'),_0x2b618c,JSON['stringify'](_0x18ebd5));_0x2ff64b(_0x18ebd5);})[_0xb20b('0x19')](function(_0x3a3d87){logger[_0xb20b('0x14')](_0xb20b('0x1a'),_0x3a3d87[_0xb20b('0x17')],_0x2b618c);_0x55b123(_0x283f93['error'](0x1f4,_0x3a3d87[_0xb20b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ebf2826..2561b5a 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 _0x2675=['register','length','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x2675,0x75));var _0x5267=function(_0xaaf1dd,_0x131aa5){_0xaaf1dd=_0xaaf1dd-0x0;var _0x1546b7=_0x2675[_0xaaf1dd];return _0x1546b7;};'use strict';var ChatMessageEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){ChatMessageEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);ChatMessageEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file +var _0xc2c7=['register','chatMessage:','save','remove','update','emit'];(function(_0x5821a3,_0x3c7e4d){var _0xfd3377=function(_0x8117cd){while(--_0x8117cd){_0x5821a3['push'](_0x5821a3['shift']());}};_0xfd3377(++_0x3c7e4d);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4ac9fb,_0x46a0a1){_0x4ac9fb=_0x4ac9fb-0x0;var _0x50ae4d=_0xc2c7[_0x4ac9fb];return _0x50ae4d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7c2c('0x0'),_0x7c2c('0x1'),_0x7c2c('0x2')];function createListener(_0x330870,_0x380d13){return function(_0x237e4d){_0x380d13[_0x7c2c('0x3')](_0x330870,_0x237e4d);};}function removeListener(_0x116f8a,_0x4bbc14){return function(){ChatMessageEvents['removeListener'](_0x116f8a,_0x4bbc14);};}exports[_0x7c2c('0x4')]=function(_0x42ecc9){for(var _0x23c038=0x0,_0x54f027=events['length'];_0x23c038<_0x54f027;_0x23c038++){var _0x5a1027=events[_0x23c038];var _0x2274cd=createListener(_0x7c2c('0x5')+_0x5a1027,_0x42ecc9);ChatMessageEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e86b773..7034d54 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 _0xd21e=['post','chat','chatmessage:create','put','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x420b42,_0x2cf1d7){var _0x4d2fbf=function(_0x4f3b4){while(--_0x4f3b4){_0x420b42['push'](_0x420b42['shift']());}};_0x4d2fbf(++_0x2cf1d7);}(_0xd21e,0x11c));var _0xed21=function(_0x565ae4,_0x44dce7){_0x565ae4=_0x565ae4-0x0;var _0x4f5c97=_0xd21e[_0x565ae4];return _0x4f5c97;};'use strict';var multer=require(_0xed21('0x0'));var util=require(_0xed21('0x1'));var path=require(_0xed21('0x2'));var timeout=require(_0xed21('0x3'));var express=require(_0xed21('0x4'));var router=express[_0xed21('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed21('0x6'));var controller=require(_0xed21('0x7'));router[_0xed21('0x8')]('/',auth['isAuthenticated'](),controller[_0xed21('0x9')]);router[_0xed21('0x8')](_0xed21('0xa'),auth[_0xed21('0xb')](),controller[_0xed21('0xc')]);router[_0xed21('0x8')](_0xed21('0xd'),auth[_0xed21('0xb')](),controller[_0xed21('0xe')]);router[_0xed21('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xed21('0x10'),_0xed21('0x11')),controller['create']);router[_0xed21('0x12')](_0xed21('0xd'),controller['update']);router[_0xed21('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xed21('0x13')]);router['put'](_0xed21('0x14'),auth['isAuthenticated'](),controller[_0xed21('0x15')]);router['delete'](_0xed21('0xd'),auth[_0xed21('0xb')](),controller[_0xed21('0x16')]);module['exports']=router; \ No newline at end of file +var _0x44d8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','tracked','chat','put','/:id','update','/:id/accept','/:id/reject','reject','destroy','exports'];(function(_0x220fa9,_0x4255fb){var _0x518ed5=function(_0x280cd9){while(--_0x280cd9){_0x220fa9['push'](_0x220fa9['shift']());}};_0x518ed5(++_0x4255fb);}(_0x44d8,0x15e));var _0x844d=function(_0x42138b,_0x4c42c2){_0x42138b=_0x42138b-0x0;var _0x1d106b=_0x44d8[_0x42138b];return _0x1d106b;};'use strict';var multer=require(_0x844d('0x0'));var util=require(_0x844d('0x1'));var path=require(_0x844d('0x2'));var timeout=require(_0x844d('0x3'));var express=require('express');var router=express[_0x844d('0x4')]();var auth=require(_0x844d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x844d('0x6'));var controller=require(_0x844d('0x7'));router[_0x844d('0x8')]('/',auth['isAuthenticated'](),controller[_0x844d('0x9')]);router['get'](_0x844d('0xa'),auth[_0x844d('0xb')](),controller[_0x844d('0xc')]);router['get']('/:id',auth[_0x844d('0xb')](),controller[_0x844d('0xd')]);router[_0x844d('0xe')]('/',auth[_0x844d('0xb')](),interaction[_0x844d('0xf')](_0x844d('0x10'),'chatmessage:create'),controller['create']);router[_0x844d('0x11')](_0x844d('0x12'),controller[_0x844d('0x13')]);router['put'](_0x844d('0x14'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x844d('0x15'),auth[_0x844d('0xb')](),controller[_0x844d('0x16')]);router['delete'](_0x844d('0x12'),auth[_0x844d('0xb')](),controller[_0x844d('0x17')]);module[_0x844d('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 4f3398c..3d611b5 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 _0x8b5e=['TEXT','medium','exports'];(function(_0x45b2fb,_0xb2178a){var _0x4109a0=function(_0x3c0860){while(--_0x3c0860){_0x45b2fb['push'](_0x45b2fb['shift']());}};_0x4109a0(++_0xb2178a);}(_0x8b5e,0x110));var _0xe8b5=function(_0xda85f7,_0x23017a){_0xda85f7=_0xda85f7-0x0;var _0x354a8d=_0x8b5e[_0xda85f7];return _0x354a8d;};'use strict';var Sequelize=require('sequelize');module[_0xe8b5('0x0')]={'body':{'type':Sequelize[_0xe8b5('0x1')](_0xe8b5('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xd08a=['medium','exports','TEXT'];(function(_0x141ead,_0x3da1bc){var _0x5c344a=function(_0x362f12){while(--_0x362f12){_0x141ead['push'](_0x141ead['shift']());}};_0x5c344a(++_0x3da1bc);}(_0xd08a,0xdf));var _0xad08=function(_0x1e503a,_0x5d394a){_0x1e503a=_0x1e503a-0x0;var _0x4f6f93=_0xd08a[_0x1e503a];return _0x4f6f93;};'use strict';var Sequelize=require('sequelize');module[_0xad08('0x0')]={'body':{'type':Sequelize[_0xad08('0x1')](_0xad08('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 5064b5f..d16f314 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 _0x25c9=['includeAll','include','findAll','show','params','merge','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ChatOfflineMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','options','count'];(function(_0x136c93,_0x3542d6){var _0x4ae852=function(_0x410cc2){while(--_0x410cc2){_0x136c93['push'](_0x136c93['shift']());}};_0x4ae852(++_0x3542d6);}(_0x25c9,0x1d9));var _0x925c=function(_0x118fa9,_0x219b95){_0x118fa9=_0x118fa9-0x0;var _0x161649=_0x25c9[_0x118fa9];return _0x161649;};'use strict';var pdf=require(_0x925c('0x0'));var emlformat=require(_0x925c('0x1'));var rimraf=require(_0x925c('0x2'));var zipdir=require(_0x925c('0x3'));var jsonpatch=require(_0x925c('0x4'));var rp=require(_0x925c('0x5'));var moment=require(_0x925c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x925c('0x7'));var util=require('util');var path=require(_0x925c('0x8'));var sox=require(_0x925c('0x9'));var csv=require('to-csv');var ejs=require(_0x925c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x925c('0xb'));var crypto=require(_0x925c('0xc'));var jsforce=require(_0x925c('0xd'));var deskjs=require(_0x925c('0xe'));var toCsv=require(_0x925c('0xf'));var querystring=require('querystring');var Papa=require(_0x925c('0x10'));var Redis=require(_0x925c('0x11'));var authService=require(_0x925c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x925c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x925c('0x14'))(_0x925c('0x15'));var utils=require(_0x925c('0x16'));var config=require(_0x925c('0x17'));var licenseUtil=require(_0x925c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x454e3a,_0x4414d1){_0x4414d1=_0x4414d1||0xcc;return function(_0x2fdd3b){if(_0x2fdd3b){return _0x454e3a['sendStatus'](_0x4414d1);}return _0x454e3a[_0x925c('0x19')](_0x4414d1)[_0x925c('0x1a')]();};}function respondWithResult(_0x2f8f5a,_0x3859f9){_0x3859f9=_0x3859f9||0xc8;return function(_0x4df95a){if(_0x4df95a){return _0x2f8f5a['status'](_0x3859f9)[_0x925c('0x1b')](_0x4df95a);}};}function respondWithFilteredResult(_0x68093d,_0x2f8156){return function(_0x255285){if(_0x255285){var _0x824020=_0x255285['count'],_0x330af5=_0x2f8156[_0x925c('0x1c')],_0x3f79fe=_0x2f8156[_0x925c('0x1c')]+_0x2f8156[_0x925c('0x1d')],_0x531853;if(_0x3f79fe>=_0x824020){_0x3f79fe=_0x824020;_0x531853=0xc8;}else{_0x531853=0xce;}_0x68093d[_0x925c('0x19')](_0x531853);return _0x68093d[_0x925c('0x1e')](_0x925c('0x1f'),_0x330af5+'-'+_0x3f79fe+'/'+_0x824020)['json'](_0x255285);}return null;};}function patchUpdates(_0x36fb59){return function(_0x1c6a50){try{jsonpatch[_0x925c('0x20')](_0x1c6a50,_0x36fb59,!![]);}catch(_0x17ee54){return BPromise[_0x925c('0x21')](_0x17ee54);}return _0x1c6a50[_0x925c('0x22')]();};}function saveUpdates(_0x53fb3d,_0x504df6){return function(_0x35dbd6){if(_0x35dbd6){return _0x35dbd6[_0x925c('0x23')](_0x53fb3d)[_0x925c('0x24')](function(_0x53e67d){return _0x53e67d;});}return null;};}function removeEntity(_0xb1a660,_0x51468e){return function(_0x291327){if(_0x291327){return _0x291327[_0x925c('0x25')]()[_0x925c('0x24')](function(){_0xb1a660[_0x925c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274950,_0x1adfff){return function(_0x32c21f){if(!_0x32c21f){_0x274950[_0x925c('0x26')](0x194);}return _0x32c21f;};}function handleError(_0x4a5520,_0x18a7c2){_0x18a7c2=_0x18a7c2||0x1f4;return function(_0x33aac6){logger[_0x925c('0x27')](_0x33aac6[_0x925c('0x28')]);if(_0x33aac6[_0x925c('0x29')]){delete _0x33aac6[_0x925c('0x29')];}_0x4a5520[_0x925c('0x19')](_0x18a7c2)[_0x925c('0x2a')](_0x33aac6);};}exports[_0x925c('0x2b')]=function(_0x21b9e5,_0x4de001){var _0x1000fc={},_0x439d48={},_0x23cefe={'count':0x0,'rows':[]};var _0x2787b4=_['map'](db[_0x925c('0x2c')][_0x925c('0x2d')],function(_0x169a2f){return{'name':_0x169a2f[_0x925c('0x2e')],'type':_0x169a2f['type'][_0x925c('0x2f')]};});_0x439d48['model']=_['map'](_0x2787b4,_0x925c('0x29'));_0x439d48[_0x925c('0x30')]=_[_0x925c('0x31')](_0x21b9e5[_0x925c('0x30')]);_0x439d48[_0x925c('0x32')]=_[_0x925c('0x33')](_0x439d48[_0x925c('0x34')],_0x439d48[_0x925c('0x30')]);_0x1000fc['attributes']=_[_0x925c('0x33')](_0x439d48[_0x925c('0x34')],qs[_0x925c('0x35')](_0x21b9e5['query'][_0x925c('0x35')]));_0x1000fc[_0x925c('0x36')]=_0x1000fc['attributes'][_0x925c('0x37')]?_0x1000fc[_0x925c('0x36')]:_0x439d48[_0x925c('0x34')];if(!_0x21b9e5[_0x925c('0x30')][_0x925c('0x38')](_0x925c('0x39'))){_0x1000fc[_0x925c('0x1d')]=qs[_0x925c('0x1d')](_0x21b9e5[_0x925c('0x30')][_0x925c('0x1d')]);_0x1000fc[_0x925c('0x1c')]=qs[_0x925c('0x1c')](_0x21b9e5['query'][_0x925c('0x1c')]);}_0x1000fc[_0x925c('0x3a')]=qs[_0x925c('0x3b')](_0x21b9e5[_0x925c('0x30')][_0x925c('0x3b')]);_0x1000fc[_0x925c('0x3c')]=qs[_0x925c('0x32')](_['pick'](_0x21b9e5[_0x925c('0x30')],_0x439d48[_0x925c('0x32')]),_0x2787b4);if(_0x21b9e5['query'][_0x925c('0x3d')]){_0x1000fc[_0x925c('0x3c')]=_['merge'](_0x1000fc[_0x925c('0x3c')],{'$or':_[_0x925c('0x3e')](_0x2787b4,function(_0x6d069){if(_0x6d069['type']!==_0x925c('0x3f')){var _0x192516={};_0x192516[_0x6d069[_0x925c('0x29')]]={'$like':'%'+_0x21b9e5[_0x925c('0x30')][_0x925c('0x3d')]+'%'};return _0x192516;}})});}_0x1000fc=_['merge']({},_0x1000fc,_0x21b9e5[_0x925c('0x40')]);var _0x3382ee={'where':_0x1000fc[_0x925c('0x3c')]};return db['ChatOfflineMessage'][_0x925c('0x41')](_0x3382ee)[_0x925c('0x24')](function(_0x340d26){_0x23cefe[_0x925c('0x41')]=_0x340d26;if(_0x21b9e5['query'][_0x925c('0x42')]){_0x1000fc[_0x925c('0x43')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x925c('0x44')](_0x1000fc);})[_0x925c('0x24')](function(_0x2283d2){_0x23cefe['rows']=_0x2283d2;return _0x23cefe;})[_0x925c('0x24')](respondWithFilteredResult(_0x4de001,_0x1000fc))['catch'](handleError(_0x4de001,null));};exports[_0x925c('0x45')]=function(_0x188ffa,_0x512c6f){var _0x47e3dd={'raw':!![],'where':{'id':_0x188ffa[_0x925c('0x46')]['id']}},_0x13621f={};_0x13621f['model']=_[_0x925c('0x31')](db['ChatOfflineMessage'][_0x925c('0x2d')]);_0x13621f[_0x925c('0x30')]=_[_0x925c('0x31')](_0x188ffa['query']);_0x13621f['filters']=_[_0x925c('0x33')](_0x13621f[_0x925c('0x34')],_0x13621f[_0x925c('0x30')]);_0x47e3dd[_0x925c('0x36')]=_['intersection'](_0x13621f['model'],qs[_0x925c('0x35')](_0x188ffa[_0x925c('0x30')][_0x925c('0x35')]));_0x47e3dd['attributes']=_0x47e3dd[_0x925c('0x36')][_0x925c('0x37')]?_0x47e3dd[_0x925c('0x36')]:_0x13621f['model'];if(_0x188ffa[_0x925c('0x30')]['includeAll']){_0x47e3dd[_0x925c('0x43')]=[{'all':!![]}];}_0x47e3dd=_[_0x925c('0x47')]({},_0x47e3dd,_0x188ffa[_0x925c('0x40')]);return db[_0x925c('0x2c')][_0x925c('0x48')](_0x47e3dd)[_0x925c('0x24')](handleEntityNotFound(_0x512c6f,null))[_0x925c('0x24')](respondWithResult(_0x512c6f,null))[_0x925c('0x49')](handleError(_0x512c6f,null));};exports['create']=function(_0x4d25ea,_0x1208b1){return db[_0x925c('0x2c')][_0x925c('0x4a')](_0x4d25ea[_0x925c('0x4b')],{})['then'](respondWithResult(_0x1208b1,0xc9))[_0x925c('0x49')](handleError(_0x1208b1,null));};exports[_0x925c('0x23')]=function(_0x327775,_0x35f065){if(_0x327775[_0x925c('0x4b')]['id']){delete _0x327775['body']['id'];}return db[_0x925c('0x2c')][_0x925c('0x48')]({'where':{'id':_0x327775[_0x925c('0x46')]['id']}})[_0x925c('0x24')](handleEntityNotFound(_0x35f065,null))['then'](saveUpdates(_0x327775['body'],null))[_0x925c('0x24')](respondWithResult(_0x35f065,null))[_0x925c('0x49')](handleError(_0x35f065,null));};exports[_0x925c('0x25')]=function(_0x2fe99f,_0x1196d8){return db[_0x925c('0x2c')][_0x925c('0x48')]({'where':{'id':_0x2fe99f[_0x925c('0x46')]['id']}})[_0x925c('0x24')](handleEntityNotFound(_0x1196d8,null))[_0x925c('0x24')](removeEntity(_0x1196d8,null))[_0x925c('0x49')](handleError(_0x1196d8,null));};exports[_0x925c('0x4c')]=function(_0x84e97c,_0x34d004){return db[_0x925c('0x2c')][_0x925c('0x4c')]()['then'](respondWithResult(_0x34d004,null))[_0x925c('0x49')](handleError(_0x34d004,null));}; \ No newline at end of file +var _0xb396=['params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','index','map','ChatOfflineMessage','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','include','findAll','rows','catch','show'];(function(_0xc3ed91,_0x21615a){var _0x2610ef=function(_0x31bede){while(--_0x31bede){_0xc3ed91['push'](_0xc3ed91['shift']());}};_0x2610ef(++_0x21615a);}(_0xb396,0x1e8));var _0x6b39=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb396[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x6b39('0x0'));var emlformat=require(_0x6b39('0x1'));var rimraf=require(_0x6b39('0x2'));var zipdir=require(_0x6b39('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b39('0x4'));var moment=require(_0x6b39('0x5'));var BPromise=require(_0x6b39('0x6'));var Mustache=require(_0x6b39('0x7'));var util=require(_0x6b39('0x8'));var path=require(_0x6b39('0x9'));var sox=require('sox');var csv=require(_0x6b39('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b39('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b39('0xc'));var deskjs=require(_0x6b39('0xd'));var toCsv=require(_0x6b39('0xa'));var querystring=require(_0x6b39('0xe'));var Papa=require(_0x6b39('0xf'));var Redis=require(_0x6b39('0x10'));var authService=require(_0x6b39('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b39('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6b39('0x13'));var db=require(_0x6b39('0x14'))['db'];function respondWithStatusCode(_0x513855,_0x51ba26){_0x51ba26=_0x51ba26||0xcc;return function(_0x14aeea){if(_0x14aeea){return _0x513855[_0x6b39('0x15')](_0x51ba26);}return _0x513855[_0x6b39('0x16')](_0x51ba26)[_0x6b39('0x17')]();};}function respondWithResult(_0x104167,_0x53ed1e){_0x53ed1e=_0x53ed1e||0xc8;return function(_0x3d12b0){if(_0x3d12b0){return _0x104167['status'](_0x53ed1e)[_0x6b39('0x18')](_0x3d12b0);}};}function respondWithFilteredResult(_0x18c3c7,_0x2b190b){return function(_0x49277f){if(_0x49277f){var _0x84b853=_0x49277f[_0x6b39('0x19')],_0x5426f5=_0x2b190b[_0x6b39('0x1a')],_0x27cf58=_0x2b190b[_0x6b39('0x1a')]+_0x2b190b[_0x6b39('0x1b')],_0x2e18bf;if(_0x27cf58>=_0x84b853){_0x27cf58=_0x84b853;_0x2e18bf=0xc8;}else{_0x2e18bf=0xce;}_0x18c3c7[_0x6b39('0x16')](_0x2e18bf);return _0x18c3c7[_0x6b39('0x1c')]('Content-Range',_0x5426f5+'-'+_0x27cf58+'/'+_0x84b853)['json'](_0x49277f);}return null;};}function patchUpdates(_0x14968a){return function(_0x217527){try{jsonpatch[_0x6b39('0x1d')](_0x217527,_0x14968a,!![]);}catch(_0x3a8b5b){return BPromise[_0x6b39('0x1e')](_0x3a8b5b);}return _0x217527[_0x6b39('0x1f')]();};}function saveUpdates(_0x458e7d,_0x560024){return function(_0x30f50a){if(_0x30f50a){return _0x30f50a[_0x6b39('0x20')](_0x458e7d)['then'](function(_0x187ab1){return _0x187ab1;});}return null;};}function removeEntity(_0x39502d,_0x3b7250){return function(_0x19e40f){if(_0x19e40f){return _0x19e40f['destroy']()[_0x6b39('0x21')](function(){_0x39502d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6fd12,_0x2e4fbf){return function(_0x1f70bd){if(!_0x1f70bd){_0x6fd12['sendStatus'](0x194);}return _0x1f70bd;};}function handleError(_0x4ebc33,_0x503d6f){_0x503d6f=_0x503d6f||0x1f4;return function(_0x49ac9b){logger[_0x6b39('0x22')](_0x49ac9b[_0x6b39('0x23')]);if(_0x49ac9b[_0x6b39('0x24')]){delete _0x49ac9b['name'];}_0x4ebc33[_0x6b39('0x16')](_0x503d6f)['send'](_0x49ac9b);};}exports[_0x6b39('0x25')]=function(_0x4f0c90,_0x2e4527){var _0x2dfdd4={},_0x19f53b={},_0x478821={'count':0x0,'rows':[]};var _0x240333=_[_0x6b39('0x26')](db[_0x6b39('0x27')]['rawAttributes'],function(_0x1689fb){return{'name':_0x1689fb[_0x6b39('0x28')],'type':_0x1689fb[_0x6b39('0x29')]['key']};});_0x19f53b[_0x6b39('0x2a')]=_[_0x6b39('0x26')](_0x240333,_0x6b39('0x24'));_0x19f53b['query']=_[_0x6b39('0x2b')](_0x4f0c90[_0x6b39('0x2c')]);_0x19f53b[_0x6b39('0x2d')]=_[_0x6b39('0x2e')](_0x19f53b[_0x6b39('0x2a')],_0x19f53b[_0x6b39('0x2c')]);_0x2dfdd4[_0x6b39('0x2f')]=_['intersection'](_0x19f53b[_0x6b39('0x2a')],qs[_0x6b39('0x30')](_0x4f0c90['query'][_0x6b39('0x30')]));_0x2dfdd4[_0x6b39('0x2f')]=_0x2dfdd4[_0x6b39('0x2f')][_0x6b39('0x31')]?_0x2dfdd4[_0x6b39('0x2f')]:_0x19f53b[_0x6b39('0x2a')];if(!_0x4f0c90['query'][_0x6b39('0x32')](_0x6b39('0x33'))){_0x2dfdd4[_0x6b39('0x1b')]=qs[_0x6b39('0x1b')](_0x4f0c90['query'][_0x6b39('0x1b')]);_0x2dfdd4[_0x6b39('0x1a')]=qs[_0x6b39('0x1a')](_0x4f0c90[_0x6b39('0x2c')][_0x6b39('0x1a')]);}_0x2dfdd4[_0x6b39('0x34')]=qs[_0x6b39('0x35')](_0x4f0c90[_0x6b39('0x2c')][_0x6b39('0x35')]);_0x2dfdd4['where']=qs['filters'](_[_0x6b39('0x36')](_0x4f0c90[_0x6b39('0x2c')],_0x19f53b[_0x6b39('0x2d')]),_0x240333);if(_0x4f0c90['query']['filter']){_0x2dfdd4[_0x6b39('0x37')]=_[_0x6b39('0x38')](_0x2dfdd4[_0x6b39('0x37')],{'$or':_[_0x6b39('0x26')](_0x240333,function(_0xd44d24){if(_0xd44d24[_0x6b39('0x29')]!=='VIRTUAL'){var _0x3ba9fe={};_0x3ba9fe[_0xd44d24[_0x6b39('0x24')]]={'$like':'%'+_0x4f0c90[_0x6b39('0x2c')][_0x6b39('0x39')]+'%'};return _0x3ba9fe;}})});}_0x2dfdd4=_['merge']({},_0x2dfdd4,_0x4f0c90[_0x6b39('0x3a')]);var _0x1cf4eb={'where':_0x2dfdd4[_0x6b39('0x37')]};return db[_0x6b39('0x27')][_0x6b39('0x19')](_0x1cf4eb)[_0x6b39('0x21')](function(_0x171e8d){_0x478821[_0x6b39('0x19')]=_0x171e8d;if(_0x4f0c90['query']['includeAll']){_0x2dfdd4[_0x6b39('0x3b')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x6b39('0x3c')](_0x2dfdd4);})[_0x6b39('0x21')](function(_0x86456f){_0x478821[_0x6b39('0x3d')]=_0x86456f;return _0x478821;})[_0x6b39('0x21')](respondWithFilteredResult(_0x2e4527,_0x2dfdd4))[_0x6b39('0x3e')](handleError(_0x2e4527,null));};exports[_0x6b39('0x3f')]=function(_0x59b1dd,_0x128169){var _0x130e72={'raw':!![],'where':{'id':_0x59b1dd[_0x6b39('0x40')]['id']}},_0x42c31e={};_0x42c31e[_0x6b39('0x2a')]=_[_0x6b39('0x2b')](db[_0x6b39('0x27')]['rawAttributes']);_0x42c31e[_0x6b39('0x2c')]=_[_0x6b39('0x2b')](_0x59b1dd[_0x6b39('0x2c')]);_0x42c31e['filters']=_[_0x6b39('0x2e')](_0x42c31e[_0x6b39('0x2a')],_0x42c31e[_0x6b39('0x2c')]);_0x130e72[_0x6b39('0x2f')]=_[_0x6b39('0x2e')](_0x42c31e[_0x6b39('0x2a')],qs[_0x6b39('0x30')](_0x59b1dd[_0x6b39('0x2c')]['fields']));_0x130e72[_0x6b39('0x2f')]=_0x130e72[_0x6b39('0x2f')][_0x6b39('0x31')]?_0x130e72[_0x6b39('0x2f')]:_0x42c31e[_0x6b39('0x2a')];if(_0x59b1dd[_0x6b39('0x2c')]['includeAll']){_0x130e72[_0x6b39('0x3b')]=[{'all':!![]}];}_0x130e72=_[_0x6b39('0x38')]({},_0x130e72,_0x59b1dd['options']);return db['ChatOfflineMessage'][_0x6b39('0x41')](_0x130e72)[_0x6b39('0x21')](handleEntityNotFound(_0x128169,null))[_0x6b39('0x21')](respondWithResult(_0x128169,null))[_0x6b39('0x3e')](handleError(_0x128169,null));};exports[_0x6b39('0x42')]=function(_0x20ec0d,_0x4f97be){return db[_0x6b39('0x27')]['create'](_0x20ec0d[_0x6b39('0x43')],{})['then'](respondWithResult(_0x4f97be,0xc9))[_0x6b39('0x3e')](handleError(_0x4f97be,null));};exports[_0x6b39('0x20')]=function(_0x479a97,_0x4c6339){if(_0x479a97['body']['id']){delete _0x479a97['body']['id'];}return db[_0x6b39('0x27')]['find']({'where':{'id':_0x479a97[_0x6b39('0x40')]['id']}})[_0x6b39('0x21')](handleEntityNotFound(_0x4c6339,null))[_0x6b39('0x21')](saveUpdates(_0x479a97[_0x6b39('0x43')],null))[_0x6b39('0x21')](respondWithResult(_0x4c6339,null))[_0x6b39('0x3e')](handleError(_0x4c6339,null));};exports['destroy']=function(_0x27a4bf,_0x2de7ac){return db[_0x6b39('0x27')][_0x6b39('0x41')]({'where':{'id':_0x27a4bf[_0x6b39('0x40')]['id']}})['then'](handleEntityNotFound(_0x2de7ac,null))['then'](removeEntity(_0x2de7ac,null))[_0x6b39('0x3e')](handleError(_0x2de7ac,null));};exports[_0x6b39('0x44')]=function(_0x234f83,_0x2864f3){return db[_0x6b39('0x27')][_0x6b39('0x44')]()['then'](respondWithResult(_0x2864f3,null))[_0x6b39('0x3e')](handleError(_0x2864f3,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 635849e..53209ad 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 _0xa37e=['bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x14028a,_0x23e0f1){var _0x17bbb6=function(_0x3e6b3c){while(--_0x3e6b3c){_0x14028a['push'](_0x14028a['shift']());}};_0x17bbb6(++_0x23e0f1);}(_0xa37e,0x97));var _0xea37=function(_0x3e568d,_0x11e839){_0x3e568d=_0x3e568d-0x0;var _0x4a2886=_0xa37e[_0x3e568d];return _0x4a2886;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea37('0x9'),'collate':_0xea37('0xa')});}; \ No newline at end of file +var _0x3937=['../../config/logger','api','bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3937,0xbf));var _0x7393=function(_0x2a4300,_0x16244f){_0x2a4300=_0x2a4300-0x0;var _0x3f1108=_0x3937[_0x2a4300];return _0x3f1108;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var moment=require('moment');var BPromise=require(_0x7393('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7393('0x4'));var rimraf=require('rimraf');var config=require(_0x7393('0x5'));var attributes=require(_0x7393('0x6'));module[_0x7393('0x7')]=function(_0x1f538f,_0x15eabd){return _0x1f538f[_0x7393('0x8')](_0x7393('0x9'),attributes,{'tableName':_0x7393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7393('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 57f043e..45071c0 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 _0x4022=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xc89a30,_0x5e8cf6){var _0x4d9488=function(_0x471704){while(--_0x471704){_0xc89a30['push'](_0xc89a30['shift']());}};_0x4d9488(++_0x5e8cf6);}(_0x4022,0xed));var _0x2402=function(_0x22760d,_0x34c88f){_0x22760d=_0x22760d-0x0;var _0x184582=_0x4022[_0x22760d];return _0x184582;};'use strict';var _=require('lodash');var util=require(_0x2402('0x0'));var moment=require(_0x2402('0x1'));var BPromise=require(_0x2402('0x2'));var rs=require(_0x2402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2402('0x4'))['db'];var utils=require(_0x2402('0x5'));var logger=require('../../config/logger')(_0x2402('0x6'));var config=require(_0x2402('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2402('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fbf3a,_0x4ca65e,_0x1607f0){return new BPromise(function(_0x291cb9,_0x5407c0){return client[_0x2402('0x9')](_0x1fbf3a,_0x1607f0)[_0x2402('0xa')](function(_0x97837e){logger[_0x2402('0xb')](_0x2402('0xc'),_0x4ca65e,'request\x20sent');logger['debug'](_0x2402('0xd'),_0x4ca65e,_0x2402('0xe'),JSON[_0x2402('0xf')](_0x97837e));if(_0x97837e[_0x2402('0x10')]){if(_0x97837e[_0x2402('0x10')][_0x2402('0x11')]===0x1f4){logger['error'](_0x2402('0xc'),_0x4ca65e,_0x97837e[_0x2402('0x10')][_0x2402('0x12')]);return _0x5407c0(_0x97837e['error']['message']);}logger[_0x2402('0x10')](_0x2402('0xc'),_0x4ca65e,_0x97837e[_0x2402('0x10')][_0x2402('0x12')]);return _0x291cb9(_0x97837e[_0x2402('0x10')]['message']);}else{logger[_0x2402('0xb')](_0x2402('0xc'),_0x4ca65e,_0x2402('0xe'));_0x291cb9(_0x97837e[_0x2402('0x13')][_0x2402('0x12')]);}})[_0x2402('0x14')](function(_0x54a380){logger[_0x2402('0x10')](_0x2402('0xc'),_0x4ca65e,_0x54a380);_0x5407c0(_0x54a380);});});} \ No newline at end of file +var _0xad03=['util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1a613d,_0x50352d){var _0x284d94=function(_0x48800c){while(--_0x48800c){_0x1a613d['push'](_0x1a613d['shift']());}};_0x284d94(++_0x50352d);}(_0xad03,0x99));var _0x3ad0=function(_0x3e720f,_0x2e9da6){_0x3e720f=_0x3e720f-0x0;var _0x8cc82e=_0xad03[_0x3e720f];return _0x8cc82e;};'use strict';var _=require(_0x3ad0('0x0'));var util=require(_0x3ad0('0x1'));var moment=require(_0x3ad0('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ad0('0x3'));var fs=require('fs');var Redis=require(_0x3ad0('0x4'));var db=require(_0x3ad0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3ad0('0x6'));var config=require('../../config/environment');var jayson=require(_0x3ad0('0x7'));var client=jayson[_0x3ad0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57267b,_0x1c0905,_0x177505){return new BPromise(function(_0xd07031,_0x8f4c64){return client[_0x3ad0('0x9')](_0x57267b,_0x177505)[_0x3ad0('0xa')](function(_0x18c19a){logger['info'](_0x3ad0('0xb'),_0x1c0905,_0x3ad0('0xc'));logger[_0x3ad0('0xd')](_0x3ad0('0xe'),_0x1c0905,_0x3ad0('0xc'),JSON[_0x3ad0('0xf')](_0x18c19a));if(_0x18c19a[_0x3ad0('0x10')]){if(_0x18c19a[_0x3ad0('0x10')][_0x3ad0('0x11')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1c0905,_0x18c19a[_0x3ad0('0x10')][_0x3ad0('0x12')]);return _0x8f4c64(_0x18c19a[_0x3ad0('0x10')][_0x3ad0('0x12')]);}logger['error'](_0x3ad0('0xb'),_0x1c0905,_0x18c19a[_0x3ad0('0x10')][_0x3ad0('0x12')]);return _0xd07031(_0x18c19a['error']['message']);}else{logger[_0x3ad0('0x13')](_0x3ad0('0xb'),_0x1c0905,_0x3ad0('0xc'));_0xd07031(_0x18c19a[_0x3ad0('0x14')][_0x3ad0('0x12')]);}})[_0x3ad0('0x15')](function(_0x5121a8){logger[_0x3ad0('0x10')](_0x3ad0('0xb'),_0x1c0905,_0x5121a8);_0x8f4c64(_0x5121a8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 585726b..50ef206 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 _0x8f7a=['util','path','connect-timeout','express','Router','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x317fa5,_0x4d1a62){var _0x455117=function(_0x1c0fd2){while(--_0x1c0fd2){_0x317fa5['push'](_0x317fa5['shift']());}};_0x455117(++_0x4d1a62);}(_0x8f7a,0xfc));var _0xa8f7=function(_0x19085d,_0x5d8bc0){_0x19085d=_0x19085d-0x0;var _0xdb3f69=_0x8f7a[_0x19085d];return _0xdb3f69;};'use strict';var multer=require('multer');var util=require(_0xa8f7('0x0'));var path=require(_0xa8f7('0x1'));var timeout=require(_0xa8f7('0x2'));var express=require(_0xa8f7('0x3'));var router=express[_0xa8f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8f7('0x5'));router[_0xa8f7('0x6')]('/',auth['isAuthenticated'](),controller[_0xa8f7('0x7')]);router['get'](_0xa8f7('0x8'),auth[_0xa8f7('0x9')](),controller['describe']);router[_0xa8f7('0x6')](_0xa8f7('0xa'),auth[_0xa8f7('0x9')](),controller[_0xa8f7('0xb')]);router[_0xa8f7('0xc')]('/',auth[_0xa8f7('0x9')](),controller['create']);router[_0xa8f7('0xd')](_0xa8f7('0xa'),auth[_0xa8f7('0x9')](),controller[_0xa8f7('0xe')]);router[_0xa8f7('0xf')]('/:id',auth[_0xa8f7('0x9')](),controller[_0xa8f7('0x10')]);module[_0xa8f7('0x11')]=router; \ No newline at end of file +var _0xe498=['describe','/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe'];(function(_0xf2b391,_0x288096){var _0x4f674f=function(_0x558123){while(--_0x558123){_0xf2b391['push'](_0xf2b391['shift']());}};_0x4f674f(++_0x288096);}(_0xe498,0xef));var _0x8e49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe498[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8e49('0x0'));var util=require(_0x8e49('0x1'));var path=require('path');var timeout=require(_0x8e49('0x2'));var express=require(_0x8e49('0x3'));var router=express[_0x8e49('0x4')]();var auth=require(_0x8e49('0x5'));var interaction=require(_0x8e49('0x6'));var config=require(_0x8e49('0x7'));var controller=require(_0x8e49('0x8'));router['get']('/',auth[_0x8e49('0x9')](),controller[_0x8e49('0xa')]);router[_0x8e49('0xb')](_0x8e49('0xc'),auth[_0x8e49('0x9')](),controller[_0x8e49('0xd')]);router['get'](_0x8e49('0xe'),auth[_0x8e49('0x9')](),controller['show']);router['post']('/',auth[_0x8e49('0x9')](),controller[_0x8e49('0xf')]);router[_0x8e49('0x10')]('/:id',auth[_0x8e49('0x9')](),controller[_0x8e49('0x11')]);router[_0x8e49('0x12')]('/:id',auth[_0x8e49('0x9')](),controller[_0x8e49('0x13')]);module[_0x8e49('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 97f8153..b5cc29a 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 _0x4667=['timeout','STRING','INTEGER','ENUM','mouseOver'];(function(_0x101cbc,_0x3df009){var _0x4e6167=function(_0x3a5543){while(--_0x3a5543){_0x101cbc['push'](_0x101cbc['shift']());}};_0x4e6167(++_0x3df009);}(_0x4667,0x1d4));var _0x7466=function(_0x5e32cb,_0x4a7d72){_0x5e32cb=_0x5e32cb-0x0;var _0x118b5d=_0x4667[_0x5e32cb];return _0x118b5d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7466('0x0')](_0x7466('0x1'),_0x7466('0x2')),'defaultValue':_0x7466('0x1')},'selector':{'type':Sequelize[_0x7466('0x3')]},'timeout':{'type':Sequelize[_0x7466('0x4')]}}; \ No newline at end of file +var _0x2c05=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c05,0x154));var _0x52c0=function(_0x1c4741,_0x72d5be){_0x1c4741=_0x1c4741-0x0;var _0x92e0ae=_0x2c05[_0x1c4741];return _0x92e0ae;};'use strict';var Sequelize=require(_0x52c0('0x0'));module[_0x52c0('0x1')]={'name':{'type':Sequelize[_0x52c0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x52c0('0x3')](_0x52c0('0x4'),_0x52c0('0x5')),'defaultValue':_0x52c0('0x4')},'selector':{'type':Sequelize[_0x52c0('0x2')]},'timeout':{'type':Sequelize[_0x52c0('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5a6f623..bee72f0 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 _0xae62=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','show','params','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','include','merge','find','catch','create','body','html-pdf','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x1bc1a8,_0x47c6de){var _0x1467b9=function(_0x16dc46){while(--_0x16dc46){_0x1bc1a8['push'](_0x1bc1a8['shift']());}};_0x1467b9(++_0x47c6de);}(_0xae62,0xf6));var _0x2ae6=function(_0x59f063,_0x1d7528){_0x59f063=_0x59f063-0x0;var _0x3d6c03=_0xae62[_0x59f063];return _0x3d6c03;};'use strict';var pdf=require(_0x2ae6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ae6('0x1'));var rp=require(_0x2ae6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2ae6('0x3'));var sox=require(_0x2ae6('0x4'));var csv=require(_0x2ae6('0x5'));var ejs=require(_0x2ae6('0x6'));var fs=require('fs');var _=require(_0x2ae6('0x7'));var squel=require('squel');var crypto=require(_0x2ae6('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x2ae6('0x9'));var toCsv=require(_0x2ae6('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2ae6('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x2ae6('0xb'));var as=require(_0x2ae6('0xc'));var hardwareService=require(_0x2ae6('0xd'));var logger=require(_0x2ae6('0xe'))(_0x2ae6('0xf'));var utils=require(_0x2ae6('0x10'));var config=require(_0x2ae6('0x11'));var licenseUtil=require(_0x2ae6('0x12'));var db=require(_0x2ae6('0x13'))['db'];function respondWithStatusCode(_0x2ec5e9,_0x238224){_0x238224=_0x238224||0xcc;return function(_0x5ef94e){if(_0x5ef94e){return _0x2ec5e9[_0x2ae6('0x14')](_0x238224);}return _0x2ec5e9[_0x2ae6('0x15')](_0x238224)[_0x2ae6('0x16')]();};}function respondWithResult(_0x154f90,_0x8cba08){_0x8cba08=_0x8cba08||0xc8;return function(_0x14d487){if(_0x14d487){return _0x154f90[_0x2ae6('0x15')](_0x8cba08)[_0x2ae6('0x17')](_0x14d487);}};}function respondWithFilteredResult(_0x4ae87c,_0x350100){return function(_0x37215a){if(_0x37215a){var _0x5c5075=_0x37215a[_0x2ae6('0x18')],_0x5147d9=_0x350100[_0x2ae6('0x19')],_0x1d82d2=_0x350100[_0x2ae6('0x19')]+_0x350100[_0x2ae6('0x1a')],_0x2f6079;if(_0x1d82d2>=_0x5c5075){_0x1d82d2=_0x5c5075;_0x2f6079=0xc8;}else{_0x2f6079=0xce;}_0x4ae87c['status'](_0x2f6079);return _0x4ae87c[_0x2ae6('0x1b')](_0x2ae6('0x1c'),_0x5147d9+'-'+_0x1d82d2+'/'+_0x5c5075)['json'](_0x37215a);}return null;};}function patchUpdates(_0x18b49b){return function(_0x9d5bea){try{jsonpatch[_0x2ae6('0x1d')](_0x9d5bea,_0x18b49b,!![]);}catch(_0x5b891d){return BPromise['reject'](_0x5b891d);}return _0x9d5bea[_0x2ae6('0x1e')]();};}function saveUpdates(_0x51d313,_0x49ff5c){return function(_0x3bf668){if(_0x3bf668){return _0x3bf668[_0x2ae6('0x1f')](_0x51d313)[_0x2ae6('0x20')](function(_0x3035a6){return _0x3035a6;});}return null;};}function removeEntity(_0x2018ad,_0x3dd76){return function(_0x2c1427){if(_0x2c1427){return _0x2c1427[_0x2ae6('0x21')]()[_0x2ae6('0x20')](function(){_0x2018ad[_0x2ae6('0x15')](0xcc)[_0x2ae6('0x16')]();});}};}function handleEntityNotFound(_0x307940,_0x30ebb2){return function(_0x2391a4){if(!_0x2391a4){_0x307940[_0x2ae6('0x14')](0x194);}return _0x2391a4;};}function handleError(_0x6de840,_0x211e47){_0x211e47=_0x211e47||0x1f4;return function(_0x3dc5a2){logger[_0x2ae6('0x22')](_0x3dc5a2[_0x2ae6('0x23')]);if(_0x3dc5a2[_0x2ae6('0x24')]){delete _0x3dc5a2[_0x2ae6('0x24')];}_0x6de840[_0x2ae6('0x15')](_0x211e47)['send'](_0x3dc5a2);};}exports[_0x2ae6('0x25')]=function(_0x190f1f,_0x4ae457){var _0x38aeb7={'raw':!![],'where':{'id':_0x190f1f[_0x2ae6('0x26')]['id']}},_0x3d3e5f={};_0x3d3e5f['model']=_['keys'](db[_0x2ae6('0x27')][_0x2ae6('0x28')]);_0x3d3e5f['query']=_['keys'](_0x190f1f[_0x2ae6('0x29')]);_0x3d3e5f[_0x2ae6('0x2a')]=_[_0x2ae6('0x2b')](_0x3d3e5f['model'],_0x3d3e5f[_0x2ae6('0x29')]);_0x38aeb7[_0x2ae6('0x2c')]=_[_0x2ae6('0x2b')](_0x3d3e5f[_0x2ae6('0x2d')],qs[_0x2ae6('0x2e')](_0x190f1f[_0x2ae6('0x29')]['fields']));_0x38aeb7['attributes']=_0x38aeb7['attributes'][_0x2ae6('0x2f')]?_0x38aeb7[_0x2ae6('0x2c')]:_0x3d3e5f[_0x2ae6('0x2d')];if(_0x190f1f[_0x2ae6('0x29')]['includeAll']){_0x38aeb7[_0x2ae6('0x30')]=[{'all':!![]}];}_0x38aeb7=_[_0x2ae6('0x31')]({},_0x38aeb7,_0x190f1f['options']);return db['ChatProactiveAction'][_0x2ae6('0x32')](_0x38aeb7)[_0x2ae6('0x20')](handleEntityNotFound(_0x4ae457,null))[_0x2ae6('0x20')](respondWithResult(_0x4ae457,null))[_0x2ae6('0x33')](handleError(_0x4ae457,null));};exports[_0x2ae6('0x34')]=function(_0x294916,_0x4d0107){return db[_0x2ae6('0x27')][_0x2ae6('0x34')](_0x294916[_0x2ae6('0x35')],{})[_0x2ae6('0x20')](respondWithResult(_0x4d0107,0xc9))[_0x2ae6('0x33')](handleError(_0x4d0107,null));};exports['update']=function(_0x22a9a5,_0x3692f7){if(_0x22a9a5[_0x2ae6('0x35')]['id']){delete _0x22a9a5['body']['id'];}return db[_0x2ae6('0x27')][_0x2ae6('0x32')]({'where':{'id':_0x22a9a5[_0x2ae6('0x26')]['id']}})[_0x2ae6('0x20')](handleEntityNotFound(_0x3692f7,null))[_0x2ae6('0x20')](saveUpdates(_0x22a9a5[_0x2ae6('0x35')],null))['then'](respondWithResult(_0x3692f7,null))[_0x2ae6('0x33')](handleError(_0x3692f7,null));};exports[_0x2ae6('0x21')]=function(_0x3405f2,_0x58c7f3){return db[_0x2ae6('0x27')]['find']({'where':{'id':_0x3405f2[_0x2ae6('0x26')]['id']}})['then'](handleEntityNotFound(_0x58c7f3,null))['then'](removeEntity(_0x58c7f3,null))[_0x2ae6('0x33')](handleError(_0x58c7f3,null));}; \ No newline at end of file +var _0xebb8=['show','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x309b09,_0xe4c181){var _0x7b38d7=function(_0x3c2277){while(--_0x3c2277){_0x309b09['push'](_0x309b09['shift']());}};_0x7b38d7(++_0xe4c181);}(_0xebb8,0x1d4));var _0x8ebb=function(_0x58b62f,_0x24f66e){_0x58b62f=_0x58b62f-0x0;var _0x4d098e=_0xebb8[_0x58b62f];return _0x4d098e;};'use strict';var pdf=require(_0x8ebb('0x0'));var emlformat=require(_0x8ebb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8ebb('0x2'));var jsonpatch=require(_0x8ebb('0x3'));var rp=require(_0x8ebb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8ebb('0x5'));var util=require(_0x8ebb('0x6'));var path=require(_0x8ebb('0x7'));var sox=require(_0x8ebb('0x8'));var csv=require('to-csv');var ejs=require(_0x8ebb('0x9'));var fs=require('fs');var _=require(_0x8ebb('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8ebb('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ebb('0xc'));var Papa=require(_0x8ebb('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ebb('0xe'));var hardwareService=require(_0x8ebb('0xf'));var logger=require('../../config/logger')(_0x8ebb('0x10'));var utils=require('../../config/utils');var config=require(_0x8ebb('0x11'));var licenseUtil=require(_0x8ebb('0x12'));var db=require(_0x8ebb('0x13'))['db'];function respondWithStatusCode(_0x1ef0b9,_0x147ae7){_0x147ae7=_0x147ae7||0xcc;return function(_0x1c7d45){if(_0x1c7d45){return _0x1ef0b9[_0x8ebb('0x14')](_0x147ae7);}return _0x1ef0b9[_0x8ebb('0x15')](_0x147ae7)[_0x8ebb('0x16')]();};}function respondWithResult(_0x3c73fc,_0x373326){_0x373326=_0x373326||0xc8;return function(_0x4500f4){if(_0x4500f4){return _0x3c73fc[_0x8ebb('0x15')](_0x373326)[_0x8ebb('0x17')](_0x4500f4);}};}function respondWithFilteredResult(_0x25e19f,_0x1006d0){return function(_0x376319){if(_0x376319){var _0x525a26=_0x376319['count'],_0x3058d1=_0x1006d0[_0x8ebb('0x18')],_0x232c5b=_0x1006d0['offset']+_0x1006d0[_0x8ebb('0x19')],_0x35a29d;if(_0x232c5b>=_0x525a26){_0x232c5b=_0x525a26;_0x35a29d=0xc8;}else{_0x35a29d=0xce;}_0x25e19f['status'](_0x35a29d);return _0x25e19f['set']('Content-Range',_0x3058d1+'-'+_0x232c5b+'/'+_0x525a26)['json'](_0x376319);}return null;};}function patchUpdates(_0x140db5){return function(_0x6ba285){try{jsonpatch[_0x8ebb('0x1a')](_0x6ba285,_0x140db5,!![]);}catch(_0x5f079a){return BPromise[_0x8ebb('0x1b')](_0x5f079a);}return _0x6ba285[_0x8ebb('0x1c')]();};}function saveUpdates(_0x4838eb,_0x1fb87d){return function(_0x1d84c9){if(_0x1d84c9){return _0x1d84c9[_0x8ebb('0x1d')](_0x4838eb)[_0x8ebb('0x1e')](function(_0x1bd83f){return _0x1bd83f;});}return null;};}function removeEntity(_0x5aefd1,_0x20fcf4){return function(_0x4c8763){if(_0x4c8763){return _0x4c8763[_0x8ebb('0x1f')]()[_0x8ebb('0x1e')](function(){_0x5aefd1[_0x8ebb('0x15')](0xcc)[_0x8ebb('0x16')]();});}};}function handleEntityNotFound(_0x24b44d,_0x50ec5){return function(_0x1bc45a){if(!_0x1bc45a){_0x24b44d[_0x8ebb('0x14')](0x194);}return _0x1bc45a;};}function handleError(_0x5f0c7e,_0xa7d653){_0xa7d653=_0xa7d653||0x1f4;return function(_0xd7f276){logger[_0x8ebb('0x20')](_0xd7f276[_0x8ebb('0x21')]);if(_0xd7f276[_0x8ebb('0x22')]){delete _0xd7f276[_0x8ebb('0x22')];}_0x5f0c7e[_0x8ebb('0x15')](_0xa7d653)[_0x8ebb('0x23')](_0xd7f276);};}exports[_0x8ebb('0x24')]=function(_0x23170a,_0x300209){var _0x46aee7={'raw':!![],'where':{'id':_0x23170a['params']['id']}},_0x4814eb={};_0x4814eb['model']=_[_0x8ebb('0x25')](db['ChatProactiveAction'][_0x8ebb('0x26')]);_0x4814eb[_0x8ebb('0x27')]=_[_0x8ebb('0x25')](_0x23170a[_0x8ebb('0x27')]);_0x4814eb[_0x8ebb('0x28')]=_['intersection'](_0x4814eb[_0x8ebb('0x29')],_0x4814eb[_0x8ebb('0x27')]);_0x46aee7[_0x8ebb('0x2a')]=_[_0x8ebb('0x2b')](_0x4814eb[_0x8ebb('0x29')],qs[_0x8ebb('0x2c')](_0x23170a['query'][_0x8ebb('0x2c')]));_0x46aee7[_0x8ebb('0x2a')]=_0x46aee7[_0x8ebb('0x2a')][_0x8ebb('0x2d')]?_0x46aee7[_0x8ebb('0x2a')]:_0x4814eb[_0x8ebb('0x29')];if(_0x23170a[_0x8ebb('0x27')][_0x8ebb('0x2e')]){_0x46aee7[_0x8ebb('0x2f')]=[{'all':!![]}];}_0x46aee7=_[_0x8ebb('0x30')]({},_0x46aee7,_0x23170a[_0x8ebb('0x31')]);return db[_0x8ebb('0x32')][_0x8ebb('0x33')](_0x46aee7)[_0x8ebb('0x1e')](handleEntityNotFound(_0x300209,null))[_0x8ebb('0x1e')](respondWithResult(_0x300209,null))[_0x8ebb('0x34')](handleError(_0x300209,null));};exports[_0x8ebb('0x35')]=function(_0x2b454b,_0x1134a7){return db[_0x8ebb('0x32')][_0x8ebb('0x35')](_0x2b454b[_0x8ebb('0x36')],{})[_0x8ebb('0x1e')](respondWithResult(_0x1134a7,0xc9))[_0x8ebb('0x34')](handleError(_0x1134a7,null));};exports[_0x8ebb('0x1d')]=function(_0x1aae41,_0x11ed7c){if(_0x1aae41['body']['id']){delete _0x1aae41[_0x8ebb('0x36')]['id'];}return db['ChatProactiveAction'][_0x8ebb('0x33')]({'where':{'id':_0x1aae41['params']['id']}})[_0x8ebb('0x1e')](handleEntityNotFound(_0x11ed7c,null))[_0x8ebb('0x1e')](saveUpdates(_0x1aae41['body'],null))[_0x8ebb('0x1e')](respondWithResult(_0x11ed7c,null))['catch'](handleError(_0x11ed7c,null));};exports[_0x8ebb('0x1f')]=function(_0x19539c,_0x29cb4c){return db[_0x8ebb('0x32')][_0x8ebb('0x33')]({'where':{'id':_0x19539c[_0x8ebb('0x37')]['id']}})[_0x8ebb('0x1e')](handleEntityNotFound(_0x29cb4c,null))[_0x8ebb('0x1e')](removeEntity(_0x29cb4c,null))[_0x8ebb('0x34')](handleError(_0x29cb4c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index d8accb4..9d305a5 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 _0x8867=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x643b38,_0x3481a8){var _0x450bfc=function(_0x31b241){while(--_0x31b241){_0x643b38['push'](_0x643b38['shift']());}};_0x450bfc(++_0x3481a8);}(_0x8867,0x131));var _0x7886=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x8867[_0x1e2080];return _0x260111;};'use strict';var _=require(_0x7886('0x0'));var util=require(_0x7886('0x1'));var logger=require(_0x7886('0x2'))(_0x7886('0x3'));var moment=require('moment');var BPromise=require(_0x7886('0x4'));var rp=require(_0x7886('0x5'));var fs=require('fs');var path=require(_0x7886('0x6'));var rimraf=require(_0x7886('0x7'));var config=require(_0x7886('0x8'));var attributes=require(_0x7886('0x9'));module[_0x7886('0xa')]=function(_0x16ee5e,_0x17a691){return _0x16ee5e['define'](_0x7886('0xb'),attributes,{'tableName':_0x7886('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22eb=['util','../../config/logger','api','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define','lodash'];(function(_0xcb46d4,_0x1c52af){var _0x299ead=function(_0x27ce9e){while(--_0x27ce9e){_0xcb46d4['push'](_0xcb46d4['shift']());}};_0x299ead(++_0x1c52af);}(_0x22eb,0x1e9));var _0xb22e=function(_0x14f168,_0x39680e){_0x14f168=_0x14f168-0x0;var _0x612e60=_0x22eb[_0x14f168];return _0x612e60;};'use strict';var _=require(_0xb22e('0x0'));var util=require(_0xb22e('0x1'));var logger=require(_0xb22e('0x2'))(_0xb22e('0x3'));var moment=require('moment');var BPromise=require(_0xb22e('0x4'));var rp=require(_0xb22e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb22e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb22e('0x7'));module[_0xb22e('0x8')]=function(_0x38cdfa,_0xd11f60){return _0x38cdfa[_0xb22e('0x9')]('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 3e2a743..d84204e 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 _0xa75d=['client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43b360,_0x3ebf0a){var _0x551b40=function(_0x4d0504){while(--_0x4d0504){_0x43b360['push'](_0x43b360['shift']());}};_0x551b40(++_0x3ebf0a);}(_0xa75d,0xf3));var _0xda75=function(_0x47f550,_0x141aa2){_0x47f550=_0x47f550-0x0;var _0x4a5316=_0xa75d[_0x47f550];return _0x4a5316;};'use strict';var _=require(_0xda75('0x0'));var util=require(_0xda75('0x1'));var moment=require(_0xda75('0x2'));var BPromise=require(_0xda75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda75('0x4'))['db'];var utils=require(_0xda75('0x5'));var logger=require(_0xda75('0x6'))(_0xda75('0x7'));var config=require(_0xda75('0x8'));var jayson=require(_0xda75('0x9'));var client=jayson[_0xda75('0xa')][_0xda75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20f963,_0x36abc3,_0x3d90e8){return new BPromise(function(_0x39ecdd,_0x40d949){return client[_0xda75('0xc')](_0x20f963,_0x3d90e8)[_0xda75('0xd')](function(_0x59f01f){logger[_0xda75('0xe')](_0xda75('0xf'),_0x36abc3,'request\x20sent');logger[_0xda75('0x10')](_0xda75('0x11'),_0x36abc3,'request\x20sent',JSON[_0xda75('0x12')](_0x59f01f));if(_0x59f01f[_0xda75('0x13')]){if(_0x59f01f[_0xda75('0x13')][_0xda75('0x14')]===0x1f4){logger['error'](_0xda75('0xf'),_0x36abc3,_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);return _0x40d949(_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);}logger[_0xda75('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x36abc3,_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);return _0x39ecdd(_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);}else{logger[_0xda75('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x36abc3,_0xda75('0x16'));_0x39ecdd(_0x59f01f['result']['message']);}})['catch'](function(_0x2918f3){logger[_0xda75('0x13')](_0xda75('0xf'),_0x36abc3,_0x2918f3);_0x40d949(_0x2918f3);});});} \ No newline at end of file +var _0x0e9a=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','moment'];(function(_0x45940b,_0x392fab){var _0x49946a=function(_0x5aa855){while(--_0x5aa855){_0x45940b['push'](_0x45940b['shift']());}};_0x49946a(++_0x392fab);}(_0x0e9a,0x1ca));var _0xa0e9=function(_0x317de8,_0x28302f){_0x317de8=_0x317de8-0x0;var _0x1fb88f=_0x0e9a[_0x317de8];return _0x1fb88f;};'use strict';var _=require(_0xa0e9('0x0'));var util=require('util');var moment=require(_0xa0e9('0x1'));var BPromise=require(_0xa0e9('0x2'));var rs=require(_0xa0e9('0x3'));var fs=require('fs');var Redis=require(_0xa0e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0e9('0x5'));var logger=require('../../config/logger')(_0xa0e9('0x6'));var config=require(_0xa0e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa0e9('0x8')][_0xa0e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c2d0d,_0x3d6b30,_0x3f372f){return new BPromise(function(_0x17968c,_0x2587ee){return client[_0xa0e9('0xa')](_0x4c2d0d,_0x3f372f)[_0xa0e9('0xb')](function(_0x391acd){logger[_0xa0e9('0xc')](_0xa0e9('0xd'),_0x3d6b30,_0xa0e9('0xe'));logger['debug'](_0xa0e9('0xf'),_0x3d6b30,_0xa0e9('0xe'),JSON[_0xa0e9('0x10')](_0x391acd));if(_0x391acd['error']){if(_0x391acd['error'][_0xa0e9('0x11')]===0x1f4){logger[_0xa0e9('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x3d6b30,_0x391acd[_0xa0e9('0x12')][_0xa0e9('0x13')]);return _0x2587ee(_0x391acd[_0xa0e9('0x12')]['message']);}logger[_0xa0e9('0x12')](_0xa0e9('0xd'),_0x3d6b30,_0x391acd[_0xa0e9('0x12')][_0xa0e9('0x13')]);return _0x17968c(_0x391acd[_0xa0e9('0x12')][_0xa0e9('0x13')]);}else{logger[_0xa0e9('0xc')](_0xa0e9('0xd'),_0x3d6b30,'request\x20sent');_0x17968c(_0x391acd['result'][_0xa0e9('0x13')]);}})['catch'](function(_0x56fc28){logger['error'](_0xa0e9('0xd'),_0x3d6b30,_0x56fc28);_0x2587ee(_0x56fc28);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c8cdd6e..55ff57e 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 _0x078c=['/:id','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post','create','put','update'];(function(_0x5358a5,_0x3b3843){var _0x1f1ef0=function(_0x28e800){while(--_0x28e800){_0x5358a5['push'](_0x5358a5['shift']());}};_0x1f1ef0(++_0x3b3843);}(_0x078c,0xa5));var _0xc078=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x078c[_0x25b4a4];return _0x707267;};'use strict';var multer=require('multer');var util=require(_0xc078('0x0'));var path=require(_0xc078('0x1'));var timeout=require(_0xc078('0x2'));var express=require(_0xc078('0x3'));var router=express['Router']();var auth=require(_0xc078('0x4'));var interaction=require(_0xc078('0x5'));var config=require(_0xc078('0x6'));var controller=require(_0xc078('0x7'));router[_0xc078('0x8')]('/:id',auth[_0xc078('0x9')](),controller[_0xc078('0xa')]);router[_0xc078('0xb')]('/',auth[_0xc078('0x9')](),controller[_0xc078('0xc')]);router[_0xc078('0xd')]('/:id',auth[_0xc078('0x9')](),controller[_0xc078('0xe')]);router['delete'](_0xc078('0xf'),auth[_0xc078('0x9')](),controller[_0xc078('0x10')]);module[_0xc078('0x11')]=router; \ No newline at end of file +var _0x5ce6=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','put'];(function(_0x151262,_0x3fd888){var _0x2ec73e=function(_0x13d608){while(--_0x13d608){_0x151262['push'](_0x151262['shift']());}};_0x2ec73e(++_0x3fd888);}(_0x5ce6,0x1cf));var _0x65ce=function(_0xe2b3bf,_0x8f706e){_0xe2b3bf=_0xe2b3bf-0x0;var _0x2ae4d3=_0x5ce6[_0xe2b3bf];return _0x2ae4d3;};'use strict';var multer=require(_0x65ce('0x0'));var util=require(_0x65ce('0x1'));var path=require(_0x65ce('0x2'));var timeout=require(_0x65ce('0x3'));var express=require('express');var router=express[_0x65ce('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x65ce('0x5'));var controller=require(_0x65ce('0x6'));router[_0x65ce('0x7')](_0x65ce('0x8'),auth['isAuthenticated'](),controller[_0x65ce('0x9')]);router[_0x65ce('0xa')]('/',auth[_0x65ce('0xb')](),controller['create']);router[_0x65ce('0xc')](_0x65ce('0x8'),auth['isAuthenticated'](),controller[_0x65ce('0xd')]);router[_0x65ce('0xe')](_0x65ce('0x8'),auth[_0x65ce('0xb')](),controller[_0x65ce('0xf')]);module[_0x65ce('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 711f7c8..949a954 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 _0x072f=['beepall','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x2d447b,_0x3e0215){var _0x14106a=function(_0x6388){while(--_0x6388){_0x2d447b['push'](_0x2d447b['shift']());}};_0x14106a(++_0x3e0215);}(_0x072f,0xb0));var _0xf072=function(_0x35daba,_0x38f48f){_0x35daba=_0x35daba-0x0;var _0x57971a=_0x072f[_0x35daba];return _0x57971a;};'use strict';var Sequelize=require(_0xf072('0x0'));module[_0xf072('0x1')]={'name':{'type':Sequelize[_0xf072('0x2')],'unique':_0xf072('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf072('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf072('0x4')](_0xf072('0x5'),_0xf072('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x1422=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x198b58,_0x5c4199){var _0x2719f7=function(_0x1dac8a){while(--_0x1dac8a){_0x198b58['push'](_0x198b58['shift']());}};_0x2719f7(++_0x5c4199);}(_0x1422,0x103));var _0x2142=function(_0x3578f7,_0x596166){_0x3578f7=_0x3578f7-0x0;var _0x2af14c=_0x1422[_0x3578f7];return _0x2af14c;};'use strict';var Sequelize=require(_0x2142('0x0'));module[_0x2142('0x1')]={'name':{'type':Sequelize[_0x2142('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2142('0x2')]},'timeout':{'type':Sequelize[_0x2142('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2142('0x4')](_0x2142('0x5'),_0x2142('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4101c20..b7ce6ca 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 _0x2d1b=['code','ChatQueue,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','set','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','sendStatus','stack','name','send','index','map','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatQueue','count','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','chatPause','getTeams','ids','Team','Agents','voicePause','interface','sequelize','addTeams','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','transaction','isEmpty','userChatQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2d1b,0x71));var _0xb2d1=function(_0x19980b,_0xd37e12){_0x19980b=_0x19980b-0x0;var _0x33fac3=_0x2d1b[_0x19980b];return _0x33fac3;};'use strict';var pdf=require(_0xb2d1('0x0'));var emlformat=require(_0xb2d1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb2d1('0x2'));var jsonpatch=require(_0xb2d1('0x3'));var rp=require(_0xb2d1('0x4'));var moment=require(_0xb2d1('0x5'));var BPromise=require(_0xb2d1('0x6'));var Mustache=require(_0xb2d1('0x7'));var util=require(_0xb2d1('0x8'));var path=require(_0xb2d1('0x9'));var sox=require('sox');var csv=require(_0xb2d1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2d1('0xb'));var squel=require(_0xb2d1('0xc'));var crypto=require(_0xb2d1('0xd'));var jsforce=require(_0xb2d1('0xe'));var deskjs=require(_0xb2d1('0xf'));var toCsv=require(_0xb2d1('0xa'));var querystring=require(_0xb2d1('0x10'));var Papa=require(_0xb2d1('0x11'));var Redis=require(_0xb2d1('0x12'));var authService=require(_0xb2d1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb2d1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2d1('0x15'))(_0xb2d1('0x16'));var utils=require(_0xb2d1('0x17'));var config=require(_0xb2d1('0x18'));var licenseUtil=require(_0xb2d1('0x19'));var db=require(_0xb2d1('0x1a'))['db'];config[_0xb2d1('0x1b')]=_['defaults'](config['redis'],{'host':_0xb2d1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2d1('0x1b')]));require('./chatQueue.socket')[_0xb2d1('0x1d')](socket);var jayson=require(_0xb2d1('0x1e'));var client=jayson[_0xb2d1('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd418db,_0x2df977,_0x1f7332,_0x4311da){return new BPromise(function(_0x399692,_0x1adf2a){var _0x5cd905=_0x4311da||client;return _0x5cd905[_0xb2d1('0x20')](_0xd418db,_0x1f7332)[_0xb2d1('0x21')](function(_0x5dedd2){logger['info']('ChatQueue,\x20%s,\x20%s',_0x2df977,_0xb2d1('0x22'));logger[_0xb2d1('0x23')](_0xb2d1('0x24'),_0x2df977,_0xb2d1('0x22'),JSON[_0xb2d1('0x25')](_0x5dedd2));if(_0x5dedd2[_0xb2d1('0x26')]){if(_0x5dedd2['error'][_0xb2d1('0x27')]===0x1f4){logger[_0xb2d1('0x26')](_0xb2d1('0x28'),_0x2df977,_0x5dedd2[_0xb2d1('0x26')]['message']);return _0x1adf2a(_0x5dedd2[_0xb2d1('0x26')][_0xb2d1('0x29')]);}logger[_0xb2d1('0x26')]('ChatQueue,\x20%s,\x20%s',_0x2df977,_0x5dedd2[_0xb2d1('0x26')]['message']);return _0x399692(_0x5dedd2[_0xb2d1('0x26')]['message']);}else{logger['info'](_0xb2d1('0x28'),_0x2df977,_0xb2d1('0x22'));_0x399692(_0x5dedd2['result'][_0xb2d1('0x29')]);}})[_0xb2d1('0x2a')](function(_0x5878a3){logger['error'](_0xb2d1('0x28'),_0x2df977,_0x5878a3);_0x1adf2a(_0x5878a3);});});}function respondWithStatusCode(_0x5b2f0b,_0x228bd2){_0x228bd2=_0x228bd2||0xcc;return function(_0x56a7fb){if(_0x56a7fb){return _0x5b2f0b['sendStatus'](_0x228bd2);}return _0x5b2f0b[_0xb2d1('0x2b')](_0x228bd2)[_0xb2d1('0x2c')]();};}function respondWithResult(_0x5c6ce1,_0x486b80){_0x486b80=_0x486b80||0xc8;return function(_0x29e810){if(_0x29e810){return _0x5c6ce1['status'](_0x486b80)[_0xb2d1('0x2d')](_0x29e810);}};}function respondWithFilteredResult(_0x2a9b95,_0x23cf2a){return function(_0x4ee25c){if(_0x4ee25c){var _0x3465a1=_0x4ee25c['count'],_0x7c701=_0x23cf2a[_0xb2d1('0x2e')],_0x242a3f=_0x23cf2a[_0xb2d1('0x2e')]+_0x23cf2a[_0xb2d1('0x2f')],_0x559b09;if(_0x242a3f>=_0x3465a1){_0x242a3f=_0x3465a1;_0x559b09=0xc8;}else{_0x559b09=0xce;}_0x2a9b95[_0xb2d1('0x2b')](_0x559b09);return _0x2a9b95[_0xb2d1('0x30')]('Content-Range',_0x7c701+'-'+_0x242a3f+'/'+_0x3465a1)[_0xb2d1('0x2d')](_0x4ee25c);}return null;};}function patchUpdates(_0x5cc646){return function(_0x1cd608){try{jsonpatch[_0xb2d1('0x31')](_0x1cd608,_0x5cc646,!![]);}catch(_0xd01992){return BPromise[_0xb2d1('0x32')](_0xd01992);}return _0x1cd608[_0xb2d1('0x33')]();};}function saveUpdates(_0x173f94,_0x280e63){return function(_0x2dc276){if(_0x2dc276){return _0x2dc276[_0xb2d1('0x34')](_0x173f94)[_0xb2d1('0x21')](function(_0x40a733){return _0x40a733;});}return null;};}function removeEntity(_0xda479c,_0x545ca5){return function(_0x334c50){if(_0x334c50){return _0x334c50[_0xb2d1('0x35')]()[_0xb2d1('0x21')](function(){var _0x304157=_0x334c50['get']({'plain':!![]});var _0xbe366d=_0xb2d1('0x36');return db[_0xb2d1('0x37')][_0xb2d1('0x35')]({'where':{'type':_0xbe366d,'resourceId':_0x304157['id']}})[_0xb2d1('0x21')](function(){return _0x334c50;});})[_0xb2d1('0x21')](function(){_0xda479c[_0xb2d1('0x2b')](0xcc)[_0xb2d1('0x2c')]();});}};}function handleEntityNotFound(_0x415b37,_0x560f2b){return function(_0x5d417d){if(!_0x5d417d){_0x415b37[_0xb2d1('0x38')](0x194);}return _0x5d417d;};}function handleError(_0x57f066,_0x4e6106){_0x4e6106=_0x4e6106||0x1f4;return function(_0x2ebc56){logger['error'](_0x2ebc56[_0xb2d1('0x39')]);if(_0x2ebc56[_0xb2d1('0x3a')]){delete _0x2ebc56['name'];}_0x57f066['status'](_0x4e6106)[_0xb2d1('0x3b')](_0x2ebc56);};}exports[_0xb2d1('0x3c')]=function(_0x48d992,_0x1a07c2){var _0x38dc62={},_0x49e405={},_0x69d340={'count':0x0,'rows':[]};var _0x62eb27=_[_0xb2d1('0x3d')](db['ChatQueue']['rawAttributes'],function(_0x18ece2){return{'name':_0x18ece2['fieldName'],'type':_0x18ece2[_0xb2d1('0x3e')]['key']};});_0x49e405['model']=_[_0xb2d1('0x3d')](_0x62eb27,_0xb2d1('0x3a'));_0x49e405[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x48d992['query']);_0x49e405['filters']=_[_0xb2d1('0x41')](_0x49e405[_0xb2d1('0x42')],_0x49e405[_0xb2d1('0x3f')]);_0x38dc62[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x49e405[_0xb2d1('0x42')],qs[_0xb2d1('0x44')](_0x48d992[_0xb2d1('0x3f')]['fields']));_0x38dc62[_0xb2d1('0x43')]=_0x38dc62[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x38dc62[_0xb2d1('0x43')]:_0x49e405[_0xb2d1('0x42')];if(!_0x48d992['query'][_0xb2d1('0x46')](_0xb2d1('0x47'))){_0x38dc62[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x2f')]);_0x38dc62['offset']=qs[_0xb2d1('0x2e')](_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x2e')]);}_0x38dc62['order']=qs[_0xb2d1('0x48')](_0x48d992['query'][_0xb2d1('0x48')]);_0x38dc62[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x48d992[_0xb2d1('0x3f')],_0x49e405['filters']),_0x62eb27);if(_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x4c')]){_0x38dc62[_0xb2d1('0x49')]=_[_0xb2d1('0x4d')](_0x38dc62[_0xb2d1('0x49')],{'$or':_[_0xb2d1('0x3d')](_0x62eb27,function(_0x1ca967){if(_0x1ca967[_0xb2d1('0x3e')]!==_0xb2d1('0x4e')){var _0x4dfd38={};_0x4dfd38[_0x1ca967[_0xb2d1('0x3a')]]={'$like':'%'+_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0x4dfd38;}})});}_0x38dc62=_[_0xb2d1('0x4d')]({},_0x38dc62,_0x48d992[_0xb2d1('0x4f')]);var _0x6bc61={'where':_0x38dc62['where']};return db[_0xb2d1('0x50')]['count'](_0x6bc61)[_0xb2d1('0x21')](function(_0x3525f8){_0x69d340[_0xb2d1('0x51')]=_0x3525f8;if(_0x48d992[_0xb2d1('0x3f')]['includeAll']){_0x38dc62[_0xb2d1('0x52')]=[{'all':!![]}];}return db[_0xb2d1('0x50')][_0xb2d1('0x53')](_0x38dc62);})[_0xb2d1('0x21')](function(_0x2a162a){_0x69d340[_0xb2d1('0x54')]=_0x2a162a;return _0x69d340;})['then'](respondWithFilteredResult(_0x1a07c2,_0x38dc62))['catch'](handleError(_0x1a07c2,null));};exports[_0xb2d1('0x55')]=function(_0x3897bc,_0x14942f){var _0x4e5458={'raw':!![],'where':{'id':_0x3897bc[_0xb2d1('0x56')]['id']}},_0x4ccd1f={};_0x4ccd1f[_0xb2d1('0x42')]=_[_0xb2d1('0x40')](db['ChatQueue'][_0xb2d1('0x57')]);_0x4ccd1f['query']=_[_0xb2d1('0x40')](_0x3897bc[_0xb2d1('0x3f')]);_0x4ccd1f[_0xb2d1('0x4a')]=_[_0xb2d1('0x41')](_0x4ccd1f[_0xb2d1('0x42')],_0x4ccd1f[_0xb2d1('0x3f')]);_0x4e5458[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x4ccd1f[_0xb2d1('0x42')],qs[_0xb2d1('0x44')](_0x3897bc[_0xb2d1('0x3f')][_0xb2d1('0x44')]));_0x4e5458[_0xb2d1('0x43')]=_0x4e5458['attributes'][_0xb2d1('0x45')]?_0x4e5458[_0xb2d1('0x43')]:_0x4ccd1f['model'];if(_0x3897bc[_0xb2d1('0x3f')][_0xb2d1('0x58')]){_0x4e5458[_0xb2d1('0x52')]=[{'all':!![]}];}_0x4e5458=_[_0xb2d1('0x4d')]({},_0x4e5458,_0x3897bc[_0xb2d1('0x4f')]);return db[_0xb2d1('0x50')][_0xb2d1('0x59')](_0x4e5458)[_0xb2d1('0x21')](handleEntityNotFound(_0x14942f,null))[_0xb2d1('0x21')](respondWithResult(_0x14942f,null))[_0xb2d1('0x2a')](handleError(_0x14942f,null));};exports[_0xb2d1('0x5a')]=function(_0x3e397b,_0x5d38fb){return db[_0xb2d1('0x50')]['create'](_0x3e397b[_0xb2d1('0x5b')],{})['then'](function(_0x51d04e){var _0x2c0447=_0x3e397b['user'][_0xb2d1('0x5c')]({'plain':!![]});if(!_0x2c0447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c0447[_0xb2d1('0x5d')]===_0xb2d1('0x5e')){var _0x582154=_0x51d04e[_0xb2d1('0x5c')]({'plain':!![]});var _0x4b9a56=_0xb2d1('0x36');return db[_0xb2d1('0x5f')][_0xb2d1('0x59')]({'where':{'name':_0x4b9a56,'userProfileId':_0x2c0447[_0xb2d1('0x60')]},'raw':!![]})[_0xb2d1('0x21')](function(_0x4d9a22){if(_0x4d9a22&&_0x4d9a22[_0xb2d1('0x61')]===0x0){return db[_0xb2d1('0x37')][_0xb2d1('0x5a')]({'name':_0x582154[_0xb2d1('0x3a')],'resourceId':_0x582154['id'],'type':_0x4d9a22[_0xb2d1('0x3a')],'sectionId':_0x4d9a22['id']},{})[_0xb2d1('0x21')](function(){return _0x51d04e;});}else{return _0x51d04e;}})[_0xb2d1('0x2a')](function(_0x572eff){logger[_0xb2d1('0x26')](_0xb2d1('0x62'),_0x572eff);throw _0x572eff;});}return _0x51d04e;})['then'](respondWithResult(_0x5d38fb,0xc9))[_0xb2d1('0x2a')](handleError(_0x5d38fb,null));};exports[_0xb2d1('0x34')]=function(_0x50b2fc,_0x31b293){if(_0x50b2fc[_0xb2d1('0x5b')]['id']){delete _0x50b2fc[_0xb2d1('0x5b')]['id'];}return db[_0xb2d1('0x50')]['find']({'where':{'id':_0x50b2fc[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x31b293,null))[_0xb2d1('0x21')](saveUpdates(_0x50b2fc[_0xb2d1('0x5b')],null))[_0xb2d1('0x21')](respondWithResult(_0x31b293,null))[_0xb2d1('0x2a')](handleError(_0x31b293,null));};exports['destroy']=function(_0x4fc9b3,_0xc9929c){return db[_0xb2d1('0x50')][_0xb2d1('0x59')]({'where':{'id':_0x4fc9b3['params']['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0xc9929c,null))[_0xb2d1('0x21')](removeEntity(_0xc9929c,null))[_0xb2d1('0x2a')](handleError(_0xc9929c,null));};exports[_0xb2d1('0x63')]=function(_0x220204,_0x695947){return db[_0xb2d1('0x50')][_0xb2d1('0x63')]()[_0xb2d1('0x21')](respondWithResult(_0x695947,null))[_0xb2d1('0x2a')](handleError(_0x695947,null));};exports[_0xb2d1('0x64')]=function(_0x3413ab,_0x49e60a,_0x17d744){var _0x191089={'raw':!![],'where':{}},_0x480597={},_0x3048db;return db[_0xb2d1('0x50')][_0xb2d1('0x65')]({'where':{'id':_0x3413ab[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x49e60a,null))['then'](function(_0x29fcf8){if(_0x29fcf8){_0x3048db=_0x29fcf8['get']({'plain':!![]});_0x480597[_0xb2d1('0x42')]=_[_0xb2d1('0x40')](db[_0xb2d1('0x66')][_0xb2d1('0x57')]);_0x480597[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x3413ab[_0xb2d1('0x3f')]);_0x480597[_0xb2d1('0x4a')]=_[_0xb2d1('0x41')](_0x480597['model'],_0x480597[_0xb2d1('0x3f')]);_0x191089[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x480597['model'],qs['fields'](_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x44')]));_0x191089[_0xb2d1('0x43')]=_0x191089[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x191089['attributes']:_0x480597[_0xb2d1('0x42')];if(!_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x46')]('nolimit')){_0x191089[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x2f')]);_0x191089[_0xb2d1('0x2e')]=qs['offset'](_0x3413ab[_0xb2d1('0x3f')]['offset']);}_0x191089[_0xb2d1('0x67')]=qs['sort'](_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x48')]);_0x191089[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x3413ab[_0xb2d1('0x3f')],_0x480597[_0xb2d1('0x4a')]));_0x191089['where'][_0xb2d1('0x68')]=_0x29fcf8['id'];if(_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x4c')]){_0x191089['where']=_[_0xb2d1('0x4d')](_0x191089[_0xb2d1('0x49')],{'$or':_[_0xb2d1('0x3d')](_0x191089[_0xb2d1('0x43')],function(_0x42ef2){var _0x1fb469={};_0x1fb469[_0x42ef2]={'$like':'%'+_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0x1fb469;})});}_0x191089=_['merge']({},_0x191089,_0x3413ab[_0xb2d1('0x4f')]);return db['UserChatQueue'][_0xb2d1('0x53')](_0x191089);}})[_0xb2d1('0x21')](function(_0x1c76a0){if(_0x1c76a0){return db[_0xb2d1('0x69')][_0xb2d1('0x6a')]({'where':{'id':_[_0xb2d1('0x3d')](_0x1c76a0,_0xb2d1('0x6b')),'role':'agent'},'attributes':['id','name','chatPause',_0xb2d1('0x6c'),_0xb2d1('0x6d')]});}})[_0xb2d1('0x21')](function(_0x2af75a){if(_0x2af75a){return{'count':_0x2af75a['count'],'rows':_['map'](_0x2af75a[_0xb2d1('0x54')],function(_0x113dfb){return{'membername':_0x113dfb[_0xb2d1('0x3a')],'UserId':_0x113dfb['id'],'queue_name':_0x3048db[_0xb2d1('0x3a')],'ChatQueueId':_0x3048db['id'],'interface':util[_0xb2d1('0x6e')](_0xb2d1('0x6f'),'SIP',_0x113dfb['name']),'penalty':0x0,'paused':_0x113dfb[_0xb2d1('0x70')],'createdAt':_0x113dfb['createdAt'],'updatedAt':_0x113dfb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x49e60a,_0x191089))['catch'](handleError(_0x49e60a,null));};exports[_0xb2d1('0x71')]=function(_0x35dd9b,_0x433f1c,_0x45ad71){var _0x3dbc66={};var _0x433f33={};var _0x9eddb5;var _0xb0e406;return db[_0xb2d1('0x50')][_0xb2d1('0x65')]({'where':{'id':_0x35dd9b[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x433f1c,null))[_0xb2d1('0x21')](function(_0x457ede){if(_0x457ede){_0x9eddb5=_0x457ede;_0x433f33[_0xb2d1('0x42')]=_[_0xb2d1('0x40')](db['Team'][_0xb2d1('0x57')]);_0x433f33[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x35dd9b[_0xb2d1('0x3f')]);_0x433f33['filters']=_[_0xb2d1('0x41')](_0x433f33['model'],_0x433f33[_0xb2d1('0x3f')]);_0x3dbc66[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x433f33[_0xb2d1('0x42')],qs[_0xb2d1('0x44')](_0x35dd9b[_0xb2d1('0x3f')]['fields']));_0x3dbc66[_0xb2d1('0x43')]=_0x3dbc66[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x3dbc66[_0xb2d1('0x43')]:_0x433f33[_0xb2d1('0x42')];_0x3dbc66[_0xb2d1('0x67')]=qs[_0xb2d1('0x48')](_0x35dd9b[_0xb2d1('0x3f')]['sort']);_0x3dbc66[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x35dd9b[_0xb2d1('0x3f')],_0x433f33[_0xb2d1('0x4a')]));if(_0x35dd9b['query'][_0xb2d1('0x4c')]){_0x3dbc66[_0xb2d1('0x49')]=_[_0xb2d1('0x4d')](_0x3dbc66[_0xb2d1('0x49')],{'$or':_[_0xb2d1('0x3d')](_0x3dbc66[_0xb2d1('0x43')],function(_0x536b68){var _0x1e5af2={};_0x1e5af2[_0x536b68]={'$like':'%'+_0x35dd9b[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0x1e5af2;})});}_0x3dbc66=_['merge']({},_0x3dbc66,_0x35dd9b['options']);return _0x9eddb5[_0xb2d1('0x71')](_0x3dbc66);}})[_0xb2d1('0x21')](function(_0x4de7b7){if(_0x4de7b7){_0xb0e406=_0x4de7b7[_0xb2d1('0x45')];if(!_0x35dd9b['query']['hasOwnProperty']('nolimit')){_0x3dbc66[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x35dd9b[_0xb2d1('0x3f')]['limit']);_0x3dbc66[_0xb2d1('0x2e')]=qs[_0xb2d1('0x2e')](_0x35dd9b['query'][_0xb2d1('0x2e')]);}return _0x9eddb5[_0xb2d1('0x71')](_0x3dbc66);}})[_0xb2d1('0x21')](function(_0x38ee10){if(_0x38ee10){return _0x38ee10?{'count':_0xb0e406,'rows':_0x38ee10}:null;}})[_0xb2d1('0x21')](respondWithResult(_0x433f1c,null))[_0xb2d1('0x2a')](handleError(_0x433f1c,null));};exports['addTeams']=function(_0x322424,_0xab5db0,_0x521733){var _0x270f4b=_0x322424['body'][_0xb2d1('0x72')];return db[_0xb2d1('0x73')][_0xb2d1('0x53')]({'where':{'id':_0x270f4b},'attributes':['id'],'include':[{'model':db[_0xb2d1('0x69')],'as':_0xb2d1('0x74'),'attributes':['id',_0xb2d1('0x3a'),'online',_0xb2d1('0x75'),_0xb2d1('0x76')],'raw':!![]}]})[_0xb2d1('0x21')](function(_0x5420b0){if(_0x5420b0){var _0x5aaef6=_['flatMap'](_0x5420b0,function(_0xe862ae){var _0x1c4b79=_0xe862ae['get']({'plain':!![]});return _0x1c4b79['Agents'];});return db[_0xb2d1('0x50')][_0xb2d1('0x59')]({'where':{'id':_0x322424[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](function(_0x3ce58f){return db[_0xb2d1('0x77')]['transaction'](function(_0x35b5a1){return _0x3ce58f[_0xb2d1('0x78')](_0x270f4b,{'transaction':_0x35b5a1})['then'](function(){return BPromise['each'](_0x5aaef6,function(_0x3267a0){return db[_0xb2d1('0x66')]['findOrCreate']({'where':{'UserId':_0x3267a0['id'],'ChatQueueId':_0x322424[_0xb2d1('0x56')]['id']},'transaction':_0x35b5a1});});})[_0xb2d1('0x21')](function(){_0x5aaef6[_0xb2d1('0x79')](function(_0x1cae7b){socket[_0xb2d1('0x7a')](_0xb2d1('0x7b'),{'UserId':_0x1cae7b['id'],'ChatQueueId':_0x3ce58f['id']});});});});});}})[_0xb2d1('0x21')](respondWithStatusCode(_0xab5db0,null))[_0xb2d1('0x2a')](handleError(_0xab5db0,null));};exports[_0xb2d1('0x7c')]=function(_0x378754,_0x1fb596,_0x551ab7){return db[_0xb2d1('0x73')][_0xb2d1('0x53')]({'where':{'id':_0x378754[_0xb2d1('0x3f')][_0xb2d1('0x72')]},'attributes':['id'],'include':[{'model':db[_0xb2d1('0x69')],'as':_0xb2d1('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb2d1('0x21')](handleEntityNotFound(_0x1fb596,null))[_0xb2d1('0x21')](function(_0x4fc980){var _0x279112=_[_0xb2d1('0x3d')](_0x4fc980,'id');var _0x5a2b99=[];var _0x96eb9d=[];var _0x2fa865=squel[_0xb2d1('0x7d')]();_0x2fa865['field'](_0xb2d1('0x7e'))[_0xb2d1('0x7f')](_0xb2d1('0x80'),'tq')[_0xb2d1('0x81')](_0xb2d1('0x82'),'ut',_0xb2d1('0x83'))[_0xb2d1('0x49')](_0xb2d1('0x84'),_0x378754['params']['id']);for(var _0x2c31c5=0x0;_0x2c31c5<_0x4fc980[_0xb2d1('0x45')];_0x2c31c5+=0x1){let _0x377e69=_0x4fc980[_0x2c31c5];for(var _0x3453d7=0x0;_0x3453d7<_0x377e69[_0xb2d1('0x74')][_0xb2d1('0x45')];_0x3453d7+=0x1){let _0x2c93b3=_0x377e69[_0xb2d1('0x74')][_0x3453d7];var _0x428e2d=_0x2fa865[_0xb2d1('0x85')]();_0x428e2d['where'](_0xb2d1('0x86'),_0x2c93b3['id']);_0x96eb9d[_0xb2d1('0x87')](db[_0xb2d1('0x77')][_0xb2d1('0x3f')](_0x428e2d[_0xb2d1('0x88')](),{'type':db['sequelize'][_0xb2d1('0x89')]['SELECT']})[_0xb2d1('0x21')](function(_0x4e2f3a){if(_0x4e2f3a[_0xb2d1('0x45')]===0x1){return _0x2c93b3['id'];}else{var _0x4aa241=_[_0xb2d1('0x8a')](_[_0xb2d1('0x3d')](_0x4e2f3a,'TeamId'),function(_0x491972){return _[_0xb2d1('0x8b')](_0x279112,_0x491972);});if(_0x4aa241){return _0x2c93b3['id'];}}}));}}return BPromise[_0xb2d1('0x8c')](_0x96eb9d)[_0xb2d1('0x21')](function(_0x131777){_0x5a2b99=_(_0x5a2b99)[_0xb2d1('0x8d')](_0x131777)[_0xb2d1('0x8e')]()[_0xb2d1('0x8f')]();return db['ChatQueue'][_0xb2d1('0x59')]({'where':{'id':_0x378754['params']['id']}})[_0xb2d1('0x21')](function(_0x329fc3){return db[_0xb2d1('0x77')][_0xb2d1('0x90')](function(_0x3256d5){return _0x329fc3[_0xb2d1('0x7c')](_0x378754[_0xb2d1('0x3f')][_0xb2d1('0x72')],{'transaction':_0x3256d5})['then'](function(){if(!_[_0xb2d1('0x91')](_0x5a2b99)){return _0x329fc3['removeAgents'](_0x5a2b99,{'transaction':_0x3256d5});}})[_0xb2d1('0x21')](function(){_0x5a2b99[_0xb2d1('0x79')](function(_0x125c6d){socket[_0xb2d1('0x7a')](_0xb2d1('0x92'),{'UserId':_0x125c6d,'ChatQueueId':_0x329fc3['id']});});});});});});})[_0xb2d1('0x21')](respondWithStatusCode(_0x1fb596,null))['catch'](handleError(_0x1fb596,null));};exports[_0xb2d1('0x93')]=function(_0x2b6933,_0x4e28dd,_0x6d3e87){return db['ChatQueue'][_0xb2d1('0x59')]({'where':{'id':_0x2b6933[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x4e28dd,null))[_0xb2d1('0x21')](function(_0x272ab4){if(_0x272ab4){return _0x272ab4[_0xb2d1('0x93')](_0x2b6933[_0xb2d1('0x5b')][_0xb2d1('0x72')],_['omit'](_0x2b6933[_0xb2d1('0x5b')],['ids','id'])||{})[_0xb2d1('0x94')](function(_0x54d4e1){for(var _0x3d6983=0x0;_0x3d6983<_0x2b6933[_0xb2d1('0x5b')][_0xb2d1('0x72')][_0xb2d1('0x45')];_0x3d6983+=0x1){socket[_0xb2d1('0x7a')](_0xb2d1('0x7b'),{'UserId':_0x2b6933[_0xb2d1('0x5b')]['ids'][_0x3d6983],'ChatQueueId':_0x2b6933['params']['id']});}return _0x54d4e1;});}})[_0xb2d1('0x21')](respondWithResult(_0x4e28dd,null))[_0xb2d1('0x2a')](handleError(_0x4e28dd,null));};exports['removeAgents']=function(_0x28da0c,_0x1d7441,_0x6558a5){return db[_0xb2d1('0x50')]['find']({'where':{'id':_0x28da0c[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x1d7441,null))[_0xb2d1('0x21')](function(_0x2aa742){if(_0x2aa742){return _0x2aa742[_0xb2d1('0x95')](_0x28da0c[_0xb2d1('0x3f')]['ids'])[_0xb2d1('0x21')](function(){if(_[_0xb2d1('0x96')](_0x28da0c['query']['ids'])){for(var _0x361861=0x0;_0x361861<_0x28da0c[_0xb2d1('0x3f')][_0xb2d1('0x72')][_0xb2d1('0x45')];_0x361861+=0x1){socket[_0xb2d1('0x7a')]('userChatQueue:remove',{'UserId':Number(_0x28da0c['query'][_0xb2d1('0x72')][_0x361861]),'ChatQueueId':Number(_0x28da0c[_0xb2d1('0x56')]['id'])});}}else{socket[_0xb2d1('0x7a')](_0xb2d1('0x92'),{'UserId':Number(_0x28da0c[_0xb2d1('0x3f')][_0xb2d1('0x72')]),'ChatQueueId':Number(_0x28da0c[_0xb2d1('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d7441,null))[_0xb2d1('0x2a')](handleError(_0x1d7441,null));};exports[_0xb2d1('0x97')]=function(_0x493990,_0x383cba,_0x265532){var _0x156050={};var _0x4534f6={};var _0x542350;var _0x1eb369;return db[_0xb2d1('0x50')]['findOne']({'where':{'id':_0x493990[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x383cba,null))['then'](function(_0x235f6c){if(_0x235f6c){_0x542350=_0x235f6c;_0x4534f6['model']=_[_0xb2d1('0x40')](db[_0xb2d1('0x69')][_0xb2d1('0x57')]);_0x4534f6[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x493990['query']);_0x4534f6[_0xb2d1('0x4a')]=_['intersection'](_0x4534f6[_0xb2d1('0x42')],_0x4534f6[_0xb2d1('0x3f')]);_0x156050[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x4534f6[_0xb2d1('0x42')],qs['fields'](_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x44')]));_0x156050[_0xb2d1('0x43')]=_0x156050[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x156050[_0xb2d1('0x43')]:_0x4534f6[_0xb2d1('0x42')];_0x156050['order']=qs['sort'](_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x48')]);_0x156050[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x493990[_0xb2d1('0x3f')],_0x4534f6['filters']));if(_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x4c')]){_0x156050[_0xb2d1('0x49')]=_[_0xb2d1('0x4d')](_0x156050['where'],{'$or':_['map'](_0x156050[_0xb2d1('0x43')],function(_0x41cc01){var _0xe3e1b1={};_0xe3e1b1[_0x41cc01]={'$like':'%'+_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0xe3e1b1;})});}_0x156050=_[_0xb2d1('0x4d')]({},_0x156050,_0x493990[_0xb2d1('0x4f')]);return _0x542350['getAgents'](_0x156050);}})[_0xb2d1('0x21')](function(_0x1eb512){if(_0x1eb512){_0x1eb369=_0x1eb512[_0xb2d1('0x45')];if(!_0x493990['query'][_0xb2d1('0x46')](_0xb2d1('0x47'))){_0x156050[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x2f')]);_0x156050['offset']=qs[_0xb2d1('0x2e')](_0x493990[_0xb2d1('0x3f')]['offset']);}return _0x542350[_0xb2d1('0x97')](_0x156050);}})[_0xb2d1('0x21')](function(_0x29e1aa){if(_0x29e1aa){return _0x29e1aa?{'count':_0x1eb369,'rows':_0x29e1aa}:null;}})[_0xb2d1('0x21')](respondWithResult(_0x383cba,null))[_0xb2d1('0x2a')](handleError(_0x383cba,null));}; \ No newline at end of file +var _0x4c1e=['map','ChatQueue','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','ChatQueueId','User','findAndCountAll','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','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?','push','sequelize','QueryTypes','SELECT','every','includes','union','compact','value','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','hasOwnProperty','html-pdf','rimraf','zip-dir','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','get','ChatQueues','end','stack','name'];(function(_0x18f1da,_0x8c786){var _0x451698=function(_0x5bf969){while(--_0x5bf969){_0x18f1da['push'](_0x18f1da['shift']());}};_0x451698(++_0x8c786);}(_0x4c1e,0xe7));var _0xe4c1=function(_0x2bf22d,_0x34479c){_0x2bf22d=_0x2bf22d-0x0;var _0x417874=_0x4c1e[_0x2bf22d];return _0x417874;};'use strict';var pdf=require(_0xe4c1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe4c1('0x1'));var zipdir=require(_0xe4c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe4c1('0x3'));var Mustache=require('mustache');var util=require(_0xe4c1('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xe4c1('0x5'));var ejs=require(_0xe4c1('0x6'));var fs=require('fs');var _=require(_0xe4c1('0x7'));var squel=require(_0xe4c1('0x8'));var crypto=require(_0xe4c1('0x9'));var jsforce=require(_0xe4c1('0xa'));var deskjs=require(_0xe4c1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe4c1('0xc'));var Papa=require('papaparse');var Redis=require(_0xe4c1('0xd'));var authService=require(_0xe4c1('0xe'));var qs=require(_0xe4c1('0xf'));var as=require(_0xe4c1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4c1('0x11'))('api');var utils=require(_0xe4c1('0x12'));var config=require(_0xe4c1('0x13'));var licenseUtil=require(_0xe4c1('0x14'));var db=require('../../mysqldb')['db'];config[_0xe4c1('0x15')]=_['defaults'](config[_0xe4c1('0x15')],{'host':_0xe4c1('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4c1('0x15')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0xe4c1('0x17'));var client=jayson[_0xe4c1('0x18')][_0xe4c1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x52e0a4,_0x5d9cf0,_0x2178cf,_0x471b23){return new BPromise(function(_0x24e416,_0x40f68b){var _0x37e2ff=_0x471b23||client;return _0x37e2ff[_0xe4c1('0x1a')](_0x52e0a4,_0x2178cf)[_0xe4c1('0x1b')](function(_0x911a70){logger[_0xe4c1('0x1c')](_0xe4c1('0x1d'),_0x5d9cf0,_0xe4c1('0x1e'));logger[_0xe4c1('0x1f')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5d9cf0,_0xe4c1('0x1e'),JSON[_0xe4c1('0x20')](_0x911a70));if(_0x911a70[_0xe4c1('0x21')]){if(_0x911a70[_0xe4c1('0x21')]['code']===0x1f4){logger[_0xe4c1('0x21')](_0xe4c1('0x1d'),_0x5d9cf0,_0x911a70['error'][_0xe4c1('0x22')]);return _0x40f68b(_0x911a70[_0xe4c1('0x21')]['message']);}logger[_0xe4c1('0x21')](_0xe4c1('0x1d'),_0x5d9cf0,_0x911a70[_0xe4c1('0x21')][_0xe4c1('0x22')]);return _0x24e416(_0x911a70[_0xe4c1('0x21')][_0xe4c1('0x22')]);}else{logger[_0xe4c1('0x1c')](_0xe4c1('0x1d'),_0x5d9cf0,'request\x20sent');_0x24e416(_0x911a70[_0xe4c1('0x23')][_0xe4c1('0x22')]);}})[_0xe4c1('0x24')](function(_0x71b7e3){logger[_0xe4c1('0x21')](_0xe4c1('0x1d'),_0x5d9cf0,_0x71b7e3);_0x40f68b(_0x71b7e3);});});}function respondWithStatusCode(_0x35a9bf,_0x2f928d){_0x2f928d=_0x2f928d||0xcc;return function(_0x6785fa){if(_0x6785fa){return _0x35a9bf[_0xe4c1('0x25')](_0x2f928d);}return _0x35a9bf[_0xe4c1('0x26')](_0x2f928d)['end']();};}function respondWithResult(_0x476b51,_0x21d285){_0x21d285=_0x21d285||0xc8;return function(_0x3ec6e0){if(_0x3ec6e0){return _0x476b51[_0xe4c1('0x26')](_0x21d285)[_0xe4c1('0x27')](_0x3ec6e0);}};}function respondWithFilteredResult(_0x5b407b,_0x37bb8a){return function(_0x4f937e){if(_0x4f937e){var _0x3ab875=_0x4f937e[_0xe4c1('0x28')],_0x3d6c99=_0x37bb8a[_0xe4c1('0x29')],_0x566360=_0x37bb8a[_0xe4c1('0x29')]+_0x37bb8a[_0xe4c1('0x2a')],_0x271b33;if(_0x566360>=_0x3ab875){_0x566360=_0x3ab875;_0x271b33=0xc8;}else{_0x271b33=0xce;}_0x5b407b[_0xe4c1('0x26')](_0x271b33);return _0x5b407b['set'](_0xe4c1('0x2b'),_0x3d6c99+'-'+_0x566360+'/'+_0x3ab875)['json'](_0x4f937e);}return null;};}function patchUpdates(_0x8350af){return function(_0x1f0ad6){try{jsonpatch['apply'](_0x1f0ad6,_0x8350af,!![]);}catch(_0x29ca52){return BPromise[_0xe4c1('0x2c')](_0x29ca52);}return _0x1f0ad6[_0xe4c1('0x2d')]();};}function saveUpdates(_0x55cad5,_0x312efa){return function(_0x21adce){if(_0x21adce){return _0x21adce[_0xe4c1('0x2e')](_0x55cad5)[_0xe4c1('0x1b')](function(_0x273712){return _0x273712;});}return null;};}function removeEntity(_0x425528,_0x145f90){return function(_0x4e598b){if(_0x4e598b){return _0x4e598b[_0xe4c1('0x2f')]()[_0xe4c1('0x1b')](function(){var _0x4e03e6=_0x4e598b[_0xe4c1('0x30')]({'plain':!![]});var _0x57bb20=_0xe4c1('0x31');return db['UserProfileResource'][_0xe4c1('0x2f')]({'where':{'type':_0x57bb20,'resourceId':_0x4e03e6['id']}})['then'](function(){return _0x4e598b;});})[_0xe4c1('0x1b')](function(){_0x425528['status'](0xcc)[_0xe4c1('0x32')]();});}};}function handleEntityNotFound(_0x5e0e91,_0x5c9ede){return function(_0x3a8765){if(!_0x3a8765){_0x5e0e91['sendStatus'](0x194);}return _0x3a8765;};}function handleError(_0x15daef,_0x9c3b25){_0x9c3b25=_0x9c3b25||0x1f4;return function(_0x2a905f){logger[_0xe4c1('0x21')](_0x2a905f[_0xe4c1('0x33')]);if(_0x2a905f[_0xe4c1('0x34')]){delete _0x2a905f['name'];}_0x15daef['status'](_0x9c3b25)['send'](_0x2a905f);};}exports['index']=function(_0x43962b,_0x52e1fe){var _0x255f66={},_0x5ae999={},_0x40f781={'count':0x0,'rows':[]};var _0x2de245=_[_0xe4c1('0x35')](db[_0xe4c1('0x36')][_0xe4c1('0x37')],function(_0x4cfe24){return{'name':_0x4cfe24[_0xe4c1('0x38')],'type':_0x4cfe24['type']['key']};});_0x5ae999[_0xe4c1('0x39')]=_['map'](_0x2de245,'name');_0x5ae999[_0xe4c1('0x3a')]=_[_0xe4c1('0x3b')](_0x43962b[_0xe4c1('0x3a')]);_0x5ae999[_0xe4c1('0x3c')]=_['intersection'](_0x5ae999[_0xe4c1('0x39')],_0x5ae999[_0xe4c1('0x3a')]);_0x255f66[_0xe4c1('0x3d')]=_[_0xe4c1('0x3e')](_0x5ae999[_0xe4c1('0x39')],qs[_0xe4c1('0x3f')](_0x43962b[_0xe4c1('0x3a')][_0xe4c1('0x3f')]));_0x255f66['attributes']=_0x255f66[_0xe4c1('0x3d')][_0xe4c1('0x40')]?_0x255f66['attributes']:_0x5ae999[_0xe4c1('0x39')];if(!_0x43962b[_0xe4c1('0x3a')]['hasOwnProperty']('nolimit')){_0x255f66[_0xe4c1('0x2a')]=qs['limit'](_0x43962b[_0xe4c1('0x3a')][_0xe4c1('0x2a')]);_0x255f66[_0xe4c1('0x29')]=qs[_0xe4c1('0x29')](_0x43962b[_0xe4c1('0x3a')]['offset']);}_0x255f66[_0xe4c1('0x41')]=qs[_0xe4c1('0x42')](_0x43962b['query'][_0xe4c1('0x42')]);_0x255f66[_0xe4c1('0x43')]=qs['filters'](_[_0xe4c1('0x44')](_0x43962b[_0xe4c1('0x3a')],_0x5ae999[_0xe4c1('0x3c')]),_0x2de245);if(_0x43962b[_0xe4c1('0x3a')][_0xe4c1('0x45')]){_0x255f66[_0xe4c1('0x43')]=_[_0xe4c1('0x46')](_0x255f66[_0xe4c1('0x43')],{'$or':_[_0xe4c1('0x35')](_0x2de245,function(_0x432701){if(_0x432701['type']!==_0xe4c1('0x47')){var _0x2fc85c={};_0x2fc85c[_0x432701[_0xe4c1('0x34')]]={'$like':'%'+_0x43962b[_0xe4c1('0x3a')][_0xe4c1('0x45')]+'%'};return _0x2fc85c;}})});}_0x255f66=_[_0xe4c1('0x46')]({},_0x255f66,_0x43962b[_0xe4c1('0x48')]);var _0x4957f7={'where':_0x255f66[_0xe4c1('0x43')]};return db[_0xe4c1('0x36')][_0xe4c1('0x28')](_0x4957f7)[_0xe4c1('0x1b')](function(_0x193a32){_0x40f781[_0xe4c1('0x28')]=_0x193a32;if(_0x43962b[_0xe4c1('0x3a')][_0xe4c1('0x49')]){_0x255f66[_0xe4c1('0x4a')]=[{'all':!![]}];}return db[_0xe4c1('0x36')][_0xe4c1('0x4b')](_0x255f66);})[_0xe4c1('0x1b')](function(_0x363d0b){_0x40f781[_0xe4c1('0x4c')]=_0x363d0b;return _0x40f781;})['then'](respondWithFilteredResult(_0x52e1fe,_0x255f66))[_0xe4c1('0x24')](handleError(_0x52e1fe,null));};exports[_0xe4c1('0x4d')]=function(_0xf6dfa0,_0x29c79a){var _0x7457d1={'raw':!![],'where':{'id':_0xf6dfa0[_0xe4c1('0x4e')]['id']}},_0x56a8ce={};_0x56a8ce[_0xe4c1('0x39')]=_[_0xe4c1('0x3b')](db[_0xe4c1('0x36')][_0xe4c1('0x37')]);_0x56a8ce[_0xe4c1('0x3a')]=_['keys'](_0xf6dfa0[_0xe4c1('0x3a')]);_0x56a8ce[_0xe4c1('0x3c')]=_['intersection'](_0x56a8ce[_0xe4c1('0x39')],_0x56a8ce['query']);_0x7457d1[_0xe4c1('0x3d')]=_[_0xe4c1('0x3e')](_0x56a8ce[_0xe4c1('0x39')],qs['fields'](_0xf6dfa0[_0xe4c1('0x3a')][_0xe4c1('0x3f')]));_0x7457d1[_0xe4c1('0x3d')]=_0x7457d1[_0xe4c1('0x3d')][_0xe4c1('0x40')]?_0x7457d1[_0xe4c1('0x3d')]:_0x56a8ce[_0xe4c1('0x39')];if(_0xf6dfa0[_0xe4c1('0x3a')]['includeAll']){_0x7457d1[_0xe4c1('0x4a')]=[{'all':!![]}];}_0x7457d1=_['merge']({},_0x7457d1,_0xf6dfa0[_0xe4c1('0x48')]);return db[_0xe4c1('0x36')][_0xe4c1('0x4f')](_0x7457d1)['then'](handleEntityNotFound(_0x29c79a,null))[_0xe4c1('0x1b')](respondWithResult(_0x29c79a,null))['catch'](handleError(_0x29c79a,null));};exports[_0xe4c1('0x50')]=function(_0x16253b,_0x4dd88e){return db[_0xe4c1('0x36')][_0xe4c1('0x50')](_0x16253b[_0xe4c1('0x51')],{})[_0xe4c1('0x1b')](function(_0x59b291){var _0x34b3f7=_0x16253b['user'][_0xe4c1('0x30')]({'plain':!![]});if(!_0x34b3f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34b3f7['role']===_0xe4c1('0x52')){var _0x1aab3b=_0x59b291['get']({'plain':!![]});var _0x1abb55=_0xe4c1('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x1abb55,'userProfileId':_0x34b3f7[_0xe4c1('0x53')]},'raw':!![]})[_0xe4c1('0x1b')](function(_0x52e201){if(_0x52e201&&_0x52e201[_0xe4c1('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1aab3b[_0xe4c1('0x34')],'resourceId':_0x1aab3b['id'],'type':_0x52e201[_0xe4c1('0x34')],'sectionId':_0x52e201['id']},{})[_0xe4c1('0x1b')](function(){return _0x59b291;});}else{return _0x59b291;}})[_0xe4c1('0x24')](function(_0x3a694a){logger[_0xe4c1('0x21')](_0xe4c1('0x55'),_0x3a694a);throw _0x3a694a;});}return _0x59b291;})[_0xe4c1('0x1b')](respondWithResult(_0x4dd88e,0xc9))[_0xe4c1('0x24')](handleError(_0x4dd88e,null));};exports['update']=function(_0x5f04a9,_0xf04086){if(_0x5f04a9['body']['id']){delete _0x5f04a9[_0xe4c1('0x51')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x5f04a9[_0xe4c1('0x4e')]['id']}})[_0xe4c1('0x1b')](handleEntityNotFound(_0xf04086,null))['then'](saveUpdates(_0x5f04a9['body'],null))['then'](respondWithResult(_0xf04086,null))[_0xe4c1('0x24')](handleError(_0xf04086,null));};exports['destroy']=function(_0x27aaa4,_0x172ea3){return db[_0xe4c1('0x36')][_0xe4c1('0x4f')]({'where':{'id':_0x27aaa4[_0xe4c1('0x4e')]['id']}})[_0xe4c1('0x1b')](handleEntityNotFound(_0x172ea3,null))[_0xe4c1('0x1b')](removeEntity(_0x172ea3,null))[_0xe4c1('0x24')](handleError(_0x172ea3,null));};exports['describe']=function(_0x4760a1,_0x5e5584){return db['ChatQueue'][_0xe4c1('0x56')]()[_0xe4c1('0x1b')](respondWithResult(_0x5e5584,null))['catch'](handleError(_0x5e5584,null));};exports[_0xe4c1('0x57')]=function(_0x4c26fe,_0x262015,_0x114370){var _0x5282b0={'raw':!![],'where':{}},_0xb48732={},_0x563bc7;return db[_0xe4c1('0x36')][_0xe4c1('0x58')]({'where':{'id':_0x4c26fe[_0xe4c1('0x4e')]['id']}})[_0xe4c1('0x1b')](handleEntityNotFound(_0x262015,null))[_0xe4c1('0x1b')](function(_0x56c63a){if(_0x56c63a){_0x563bc7=_0x56c63a[_0xe4c1('0x30')]({'plain':!![]});_0xb48732[_0xe4c1('0x39')]=_[_0xe4c1('0x3b')](db[_0xe4c1('0x59')][_0xe4c1('0x37')]);_0xb48732[_0xe4c1('0x3a')]=_[_0xe4c1('0x3b')](_0x4c26fe[_0xe4c1('0x3a')]);_0xb48732[_0xe4c1('0x3c')]=_['intersection'](_0xb48732[_0xe4c1('0x39')],_0xb48732['query']);_0x5282b0[_0xe4c1('0x3d')]=_[_0xe4c1('0x3e')](_0xb48732[_0xe4c1('0x39')],qs[_0xe4c1('0x3f')](_0x4c26fe[_0xe4c1('0x3a')][_0xe4c1('0x3f')]));_0x5282b0[_0xe4c1('0x3d')]=_0x5282b0[_0xe4c1('0x3d')][_0xe4c1('0x40')]?_0x5282b0['attributes']:_0xb48732[_0xe4c1('0x39')];if(!_0x4c26fe['query']['hasOwnProperty'](_0xe4c1('0x5a'))){_0x5282b0[_0xe4c1('0x2a')]=qs[_0xe4c1('0x2a')](_0x4c26fe[_0xe4c1('0x3a')]['limit']);_0x5282b0['offset']=qs[_0xe4c1('0x29')](_0x4c26fe[_0xe4c1('0x3a')][_0xe4c1('0x29')]);}_0x5282b0[_0xe4c1('0x41')]=qs[_0xe4c1('0x42')](_0x4c26fe['query'][_0xe4c1('0x42')]);_0x5282b0['where']=qs[_0xe4c1('0x3c')](_[_0xe4c1('0x44')](_0x4c26fe[_0xe4c1('0x3a')],_0xb48732['filters']));_0x5282b0[_0xe4c1('0x43')][_0xe4c1('0x5b')]=_0x56c63a['id'];if(_0x4c26fe['query'][_0xe4c1('0x45')]){_0x5282b0[_0xe4c1('0x43')]=_[_0xe4c1('0x46')](_0x5282b0[_0xe4c1('0x43')],{'$or':_['map'](_0x5282b0['attributes'],function(_0x4b5c62){var _0x4076f5={};_0x4076f5[_0x4b5c62]={'$like':'%'+_0x4c26fe[_0xe4c1('0x3a')][_0xe4c1('0x45')]+'%'};return _0x4076f5;})});}_0x5282b0=_['merge']({},_0x5282b0,_0x4c26fe['options']);return db[_0xe4c1('0x59')][_0xe4c1('0x4b')](_0x5282b0);}})[_0xe4c1('0x1b')](function(_0x370139){if(_0x370139){return db[_0xe4c1('0x5c')][_0xe4c1('0x5d')]({'where':{'id':_['map'](_0x370139,'UserId'),'role':_0xe4c1('0x5e')},'attributes':['id',_0xe4c1('0x34'),_0xe4c1('0x5f'),'updatedAt',_0xe4c1('0x60')]});}})[_0xe4c1('0x1b')](function(_0x1b115a){if(_0x1b115a){return{'count':_0x1b115a[_0xe4c1('0x28')],'rows':_['map'](_0x1b115a[_0xe4c1('0x4c')],function(_0x202058){return{'membername':_0x202058[_0xe4c1('0x34')],'UserId':_0x202058['id'],'queue_name':_0x563bc7[_0xe4c1('0x34')],'ChatQueueId':_0x563bc7['id'],'interface':util[_0xe4c1('0x61')](_0xe4c1('0x62'),_0xe4c1('0x63'),_0x202058[_0xe4c1('0x34')]),'penalty':0x0,'paused':_0x202058['chatPause'],'createdAt':_0x202058[_0xe4c1('0x60')],'updatedAt':_0x202058[_0xe4c1('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4c1('0x1b')](respondWithFilteredResult(_0x262015,_0x5282b0))[_0xe4c1('0x24')](handleError(_0x262015,null));};exports[_0xe4c1('0x65')]=function(_0x1cea45,_0x28d50a,_0x15d374){var _0x2201ee={};var _0x2303b4={};var _0x297abf;var _0x43e557;return db[_0xe4c1('0x36')][_0xe4c1('0x58')]({'where':{'id':_0x1cea45['params']['id']}})['then'](handleEntityNotFound(_0x28d50a,null))[_0xe4c1('0x1b')](function(_0x3976b9){if(_0x3976b9){_0x297abf=_0x3976b9;_0x2303b4[_0xe4c1('0x39')]=_[_0xe4c1('0x3b')](db[_0xe4c1('0x66')]['rawAttributes']);_0x2303b4['query']=_[_0xe4c1('0x3b')](_0x1cea45['query']);_0x2303b4[_0xe4c1('0x3c')]=_['intersection'](_0x2303b4['model'],_0x2303b4[_0xe4c1('0x3a')]);_0x2201ee[_0xe4c1('0x3d')]=_[_0xe4c1('0x3e')](_0x2303b4['model'],qs[_0xe4c1('0x3f')](_0x1cea45[_0xe4c1('0x3a')][_0xe4c1('0x3f')]));_0x2201ee[_0xe4c1('0x3d')]=_0x2201ee[_0xe4c1('0x3d')]['length']?_0x2201ee[_0xe4c1('0x3d')]:_0x2303b4['model'];_0x2201ee[_0xe4c1('0x41')]=qs[_0xe4c1('0x42')](_0x1cea45[_0xe4c1('0x3a')][_0xe4c1('0x42')]);_0x2201ee[_0xe4c1('0x43')]=qs[_0xe4c1('0x3c')](_[_0xe4c1('0x44')](_0x1cea45['query'],_0x2303b4[_0xe4c1('0x3c')]));if(_0x1cea45[_0xe4c1('0x3a')][_0xe4c1('0x45')]){_0x2201ee[_0xe4c1('0x43')]=_[_0xe4c1('0x46')](_0x2201ee[_0xe4c1('0x43')],{'$or':_[_0xe4c1('0x35')](_0x2201ee[_0xe4c1('0x3d')],function(_0x5d5fe0){var _0x4c3ea5={};_0x4c3ea5[_0x5d5fe0]={'$like':'%'+_0x1cea45[_0xe4c1('0x3a')][_0xe4c1('0x45')]+'%'};return _0x4c3ea5;})});}_0x2201ee=_[_0xe4c1('0x46')]({},_0x2201ee,_0x1cea45['options']);return _0x297abf[_0xe4c1('0x65')](_0x2201ee);}})[_0xe4c1('0x1b')](function(_0x45e1dc){if(_0x45e1dc){_0x43e557=_0x45e1dc['length'];if(!_0x1cea45[_0xe4c1('0x3a')]['hasOwnProperty']('nolimit')){_0x2201ee[_0xe4c1('0x2a')]=qs[_0xe4c1('0x2a')](_0x1cea45[_0xe4c1('0x3a')][_0xe4c1('0x2a')]);_0x2201ee[_0xe4c1('0x29')]=qs[_0xe4c1('0x29')](_0x1cea45[_0xe4c1('0x3a')]['offset']);}return _0x297abf[_0xe4c1('0x65')](_0x2201ee);}})[_0xe4c1('0x1b')](function(_0x308cd0){if(_0x308cd0){return _0x308cd0?{'count':_0x43e557,'rows':_0x308cd0}:null;}})[_0xe4c1('0x1b')](respondWithResult(_0x28d50a,null))['catch'](handleError(_0x28d50a,null));};exports[_0xe4c1('0x67')]=function(_0x1036f6,_0x2948d1,_0x10d538){var _0x54338e=_0x1036f6['body'][_0xe4c1('0x68')];return db[_0xe4c1('0x66')][_0xe4c1('0x4b')]({'where':{'id':_0x54338e},'attributes':['id'],'include':[{'model':db[_0xe4c1('0x5c')],'as':_0xe4c1('0x69'),'attributes':['id',_0xe4c1('0x34'),_0xe4c1('0x6a'),_0xe4c1('0x6b'),_0xe4c1('0x6c')],'raw':!![]}]})['then'](function(_0x3ae61f){if(_0x3ae61f){var _0x19978b=_['flatMap'](_0x3ae61f,function(_0x2ec5c2){var _0x1305cb=_0x2ec5c2[_0xe4c1('0x30')]({'plain':!![]});return _0x1305cb['Agents'];});return db[_0xe4c1('0x36')][_0xe4c1('0x4f')]({'where':{'id':_0x1036f6['params']['id']}})['then'](function(_0x39d436){return db['sequelize'][_0xe4c1('0x6d')](function(_0x4c9490){return _0x39d436[_0xe4c1('0x67')](_0x54338e,{'transaction':_0x4c9490})[_0xe4c1('0x1b')](function(){return BPromise[_0xe4c1('0x6e')](_0x19978b,function(_0x5d0c05){return db[_0xe4c1('0x59')][_0xe4c1('0x6f')]({'where':{'UserId':_0x5d0c05['id'],'ChatQueueId':_0x1036f6[_0xe4c1('0x4e')]['id']},'transaction':_0x4c9490});});})[_0xe4c1('0x1b')](function(){_0x19978b[_0xe4c1('0x70')](function(_0x3e9198){socket[_0xe4c1('0x71')](_0xe4c1('0x72'),{'UserId':_0x3e9198['id'],'ChatQueueId':_0x39d436['id']});});});});});}})['then'](respondWithStatusCode(_0x2948d1,null))[_0xe4c1('0x24')](handleError(_0x2948d1,null));};exports['removeTeams']=function(_0x3d3ef7,_0x46edf9,_0x137dc2){return db['Team']['findAll']({'where':{'id':_0x3d3ef7[_0xe4c1('0x3a')][_0xe4c1('0x68')]},'attributes':['id'],'include':[{'model':db[_0xe4c1('0x5c')],'as':_0xe4c1('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe4c1('0x1b')](handleEntityNotFound(_0x46edf9,null))[_0xe4c1('0x1b')](function(_0x15e50c){var _0x38f015=_['map'](_0x15e50c,'id');var _0x3b3d1f=[];var _0x5b38c7=[];var _0x4196f8=squel[_0xe4c1('0x73')]();_0x4196f8[_0xe4c1('0x74')](_0xe4c1('0x75'))[_0xe4c1('0x76')](_0xe4c1('0x77'),'tq')[_0xe4c1('0x78')](_0xe4c1('0x79'),'ut',_0xe4c1('0x7a'))[_0xe4c1('0x43')](_0xe4c1('0x7b'),_0x3d3ef7[_0xe4c1('0x4e')]['id']);for(var _0x5ac2dc=0x0;_0x5ac2dc<_0x15e50c[_0xe4c1('0x40')];_0x5ac2dc+=0x1){let _0x428927=_0x15e50c[_0x5ac2dc];for(var _0x1a3897=0x0;_0x1a3897<_0x428927[_0xe4c1('0x69')][_0xe4c1('0x40')];_0x1a3897+=0x1){let _0x2f7e2c=_0x428927['Agents'][_0x1a3897];var _0x359aaa=_0x4196f8[_0xe4c1('0x7c')]();_0x359aaa[_0xe4c1('0x43')](_0xe4c1('0x7d'),_0x2f7e2c['id']);_0x5b38c7[_0xe4c1('0x7e')](db[_0xe4c1('0x7f')]['query'](_0x359aaa['toString'](),{'type':db[_0xe4c1('0x7f')][_0xe4c1('0x80')][_0xe4c1('0x81')]})[_0xe4c1('0x1b')](function(_0x280e32){if(_0x280e32[_0xe4c1('0x40')]===0x1){return _0x2f7e2c['id'];}else{var _0x3a03f2=_[_0xe4c1('0x82')](_[_0xe4c1('0x35')](_0x280e32,'TeamId'),function(_0x1655cc){return _[_0xe4c1('0x83')](_0x38f015,_0x1655cc);});if(_0x3a03f2){return _0x2f7e2c['id'];}}}));}}return BPromise['all'](_0x5b38c7)['then'](function(_0x4ca873){_0x3b3d1f=_(_0x3b3d1f)[_0xe4c1('0x84')](_0x4ca873)[_0xe4c1('0x85')]()[_0xe4c1('0x86')]();return db[_0xe4c1('0x36')]['find']({'where':{'id':_0x3d3ef7[_0xe4c1('0x4e')]['id']}})[_0xe4c1('0x1b')](function(_0x399078){return db[_0xe4c1('0x7f')][_0xe4c1('0x6d')](function(_0x2273fe){return _0x399078['removeTeams'](_0x3d3ef7['query'][_0xe4c1('0x68')],{'transaction':_0x2273fe})['then'](function(){if(!_['isEmpty'](_0x3b3d1f)){return _0x399078['removeAgents'](_0x3b3d1f,{'transaction':_0x2273fe});}})[_0xe4c1('0x1b')](function(){_0x3b3d1f[_0xe4c1('0x70')](function(_0x42f92a){socket[_0xe4c1('0x71')](_0xe4c1('0x87'),{'UserId':_0x42f92a,'ChatQueueId':_0x399078['id']});});});});});});})[_0xe4c1('0x1b')](respondWithStatusCode(_0x46edf9,null))[_0xe4c1('0x24')](handleError(_0x46edf9,null));};exports[_0xe4c1('0x88')]=function(_0xb17171,_0xc8db2d,_0x44ef4d){return db[_0xe4c1('0x36')][_0xe4c1('0x4f')]({'where':{'id':_0xb17171[_0xe4c1('0x4e')]['id']}})[_0xe4c1('0x1b')](handleEntityNotFound(_0xc8db2d,null))['then'](function(_0x12ba8c){if(_0x12ba8c){return _0x12ba8c[_0xe4c1('0x88')](_0xb17171[_0xe4c1('0x51')]['ids'],_[_0xe4c1('0x89')](_0xb17171[_0xe4c1('0x51')],[_0xe4c1('0x68'),'id'])||{})[_0xe4c1('0x8a')](function(_0x9c6dfe){for(var _0x1e773f=0x0;_0x1e773f<_0xb17171[_0xe4c1('0x51')][_0xe4c1('0x68')][_0xe4c1('0x40')];_0x1e773f+=0x1){socket[_0xe4c1('0x71')]('userChatQueue:save',{'UserId':_0xb17171[_0xe4c1('0x51')]['ids'][_0x1e773f],'ChatQueueId':_0xb17171[_0xe4c1('0x4e')]['id']});}return _0x9c6dfe;});}})['then'](respondWithResult(_0xc8db2d,null))[_0xe4c1('0x24')](handleError(_0xc8db2d,null));};exports[_0xe4c1('0x8b')]=function(_0x5c33b1,_0x2e1129,_0x952242){return db[_0xe4c1('0x36')][_0xe4c1('0x4f')]({'where':{'id':_0x5c33b1[_0xe4c1('0x4e')]['id']}})[_0xe4c1('0x1b')](handleEntityNotFound(_0x2e1129,null))['then'](function(_0x334a54){if(_0x334a54){return _0x334a54[_0xe4c1('0x8b')](_0x5c33b1[_0xe4c1('0x3a')][_0xe4c1('0x68')])[_0xe4c1('0x1b')](function(){if(_['isArray'](_0x5c33b1[_0xe4c1('0x3a')][_0xe4c1('0x68')])){for(var _0x5bd20c=0x0;_0x5bd20c<_0x5c33b1[_0xe4c1('0x3a')][_0xe4c1('0x68')][_0xe4c1('0x40')];_0x5bd20c+=0x1){socket[_0xe4c1('0x71')](_0xe4c1('0x87'),{'UserId':Number(_0x5c33b1[_0xe4c1('0x3a')][_0xe4c1('0x68')][_0x5bd20c]),'ChatQueueId':Number(_0x5c33b1[_0xe4c1('0x4e')]['id'])});}}else{socket[_0xe4c1('0x71')](_0xe4c1('0x87'),{'UserId':Number(_0x5c33b1[_0xe4c1('0x3a')][_0xe4c1('0x68')]),'ChatQueueId':Number(_0x5c33b1['params']['id'])});}});}})[_0xe4c1('0x1b')](respondWithStatusCode(_0x2e1129,null))['catch'](handleError(_0x2e1129,null));};exports[_0xe4c1('0x8c')]=function(_0x1484b0,_0x3c72dd,_0x59c231){var _0x34a113={};var _0x30bd1a={};var _0x182fff;var _0x394ca1;return db['ChatQueue']['findOne']({'where':{'id':_0x1484b0['params']['id']}})[_0xe4c1('0x1b')](handleEntityNotFound(_0x3c72dd,null))[_0xe4c1('0x1b')](function(_0x5d1c68){if(_0x5d1c68){_0x182fff=_0x5d1c68;_0x30bd1a[_0xe4c1('0x39')]=_[_0xe4c1('0x3b')](db[_0xe4c1('0x5c')][_0xe4c1('0x37')]);_0x30bd1a[_0xe4c1('0x3a')]=_[_0xe4c1('0x3b')](_0x1484b0[_0xe4c1('0x3a')]);_0x30bd1a[_0xe4c1('0x3c')]=_[_0xe4c1('0x3e')](_0x30bd1a[_0xe4c1('0x39')],_0x30bd1a[_0xe4c1('0x3a')]);_0x34a113[_0xe4c1('0x3d')]=_[_0xe4c1('0x3e')](_0x30bd1a['model'],qs[_0xe4c1('0x3f')](_0x1484b0['query'][_0xe4c1('0x3f')]));_0x34a113['attributes']=_0x34a113[_0xe4c1('0x3d')][_0xe4c1('0x40')]?_0x34a113['attributes']:_0x30bd1a[_0xe4c1('0x39')];_0x34a113[_0xe4c1('0x41')]=qs[_0xe4c1('0x42')](_0x1484b0[_0xe4c1('0x3a')][_0xe4c1('0x42')]);_0x34a113[_0xe4c1('0x43')]=qs['filters'](_[_0xe4c1('0x44')](_0x1484b0['query'],_0x30bd1a['filters']));if(_0x1484b0[_0xe4c1('0x3a')][_0xe4c1('0x45')]){_0x34a113[_0xe4c1('0x43')]=_['merge'](_0x34a113[_0xe4c1('0x43')],{'$or':_[_0xe4c1('0x35')](_0x34a113[_0xe4c1('0x3d')],function(_0x12fc51){var _0x3b3c0b={};_0x3b3c0b[_0x12fc51]={'$like':'%'+_0x1484b0[_0xe4c1('0x3a')][_0xe4c1('0x45')]+'%'};return _0x3b3c0b;})});}_0x34a113=_[_0xe4c1('0x46')]({},_0x34a113,_0x1484b0[_0xe4c1('0x48')]);return _0x182fff[_0xe4c1('0x8c')](_0x34a113);}})[_0xe4c1('0x1b')](function(_0x265282){if(_0x265282){_0x394ca1=_0x265282[_0xe4c1('0x40')];if(!_0x1484b0[_0xe4c1('0x3a')][_0xe4c1('0x8d')](_0xe4c1('0x5a'))){_0x34a113['limit']=qs[_0xe4c1('0x2a')](_0x1484b0['query'][_0xe4c1('0x2a')]);_0x34a113['offset']=qs[_0xe4c1('0x29')](_0x1484b0[_0xe4c1('0x3a')][_0xe4c1('0x29')]);}return _0x182fff[_0xe4c1('0x8c')](_0x34a113);}})['then'](function(_0x3bf7d3){if(_0x3bf7d3){return _0x3bf7d3?{'count':_0x394ca1,'rows':_0x3bf7d3}:null;}})[_0xe4c1('0x1b')](respondWithResult(_0x3c72dd,null))[_0xe4c1('0x24')](handleError(_0x3c72dd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9c6bc00..4749447 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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x17c038,_0x12868e){var _0x547a2d=function(_0x538beb){while(--_0x538beb){_0x17c038['push'](_0x17c038['shift']());}};_0x547a2d(++_0x12868e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3074f1,_0x4901aa){_0x3074f1=_0x3074f1-0x0;var _0x149af8=_0x0b0e[_0x3074f1];return _0x149af8;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4b311b,_0x2b92ad){var _0x492be5=function(_0x1b9ef4){while(--_0x1b9ef4){_0x4b311b['push'](_0x4b311b['shift']());}};_0x492be5(++_0x2b92ad);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x0b0e[_0x18776a];return _0x484e4a;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 279ee9b..147b74a 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 _0xe787=['exports','define','ChatQueue','chat_queues','util','api','bluebird','request-promise','rimraf','./chatQueue.attributes'];(function(_0x41779e,_0x52f603){var _0x10be61=function(_0x1afdd9){while(--_0x1afdd9){_0x41779e['push'](_0x41779e['shift']());}};_0x10be61(++_0x52f603);}(_0xe787,0x130));var _0x7e78=function(_0xdf3db6,_0x2a1952){_0xdf3db6=_0xdf3db6-0x0;var _0x4b7a65=_0xe787[_0xdf3db6];return _0x4b7a65;};'use strict';var _=require('lodash');var util=require(_0x7e78('0x0'));var logger=require('../../config/logger')(_0x7e78('0x1'));var moment=require('moment');var BPromise=require(_0x7e78('0x2'));var rp=require(_0x7e78('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e78('0x4'));var config=require('../../config/environment');var attributes=require(_0x7e78('0x5'));module[_0x7e78('0x6')]=function(_0x1c0edd,_0x4f5ce0){return _0x1c0edd[_0x7e78('0x7')](_0x7e78('0x8'),attributes,{'tableName':_0x7e78('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf20f=['path','rimraf','../../config/environment','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x595179,_0x8f721a){var _0xc73996=function(_0x15e00a){while(--_0x15e00a){_0x595179['push'](_0x595179['shift']());}};_0xc73996(++_0x8f721a);}(_0xf20f,0x14b));var _0xff20=function(_0x408e9c,_0x62ea04){_0x408e9c=_0x408e9c-0x0;var _0x3ce863=_0xf20f[_0x408e9c];return _0x3ce863;};'use strict';var _=require(_0xff20('0x0'));var util=require(_0xff20('0x1'));var logger=require(_0xff20('0x2'))(_0xff20('0x3'));var moment=require(_0xff20('0x4'));var BPromise=require(_0xff20('0x5'));var rp=require(_0xff20('0x6'));var fs=require('fs');var path=require(_0xff20('0x7'));var rimraf=require(_0xff20('0x8'));var config=require(_0xff20('0x9'));var attributes=require('./chatQueue.attributes');module[_0xff20('0xa')]=function(_0x3c23af,_0x3ccaa5){return _0x3c23af['define'](_0xff20('0xb'),attributes,{'tableName':_0xff20('0xc'),'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 7d46d54..ba16a96 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 _0x6351=['ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','include','map','model','then','ShowChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatQueue.socket','request'];(function(_0x2b90e4,_0x47049c){var _0x42c402=function(_0x48c5c0){while(--_0x48c5c0){_0x2b90e4['push'](_0x2b90e4['shift']());}};_0x42c402(++_0x47049c);}(_0x6351,0x12f));var _0x1635=function(_0x351865,_0x595cbe){_0x351865=_0x351865-0x0;var _0x28e5ff=_0x6351[_0x351865];return _0x28e5ff;};'use strict';var _=require(_0x1635('0x0'));var util=require(_0x1635('0x1'));var moment=require(_0x1635('0x2'));var BPromise=require(_0x1635('0x3'));var rs=require(_0x1635('0x4'));var fs=require('fs');var Redis=require(_0x1635('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1635('0x6'));var logger=require(_0x1635('0x7'))(_0x1635('0x8'));var config=require(_0x1635('0x9'));var jayson=require(_0x1635('0xa'));var client=jayson[_0x1635('0xb')][_0x1635('0xc')]({'port':0x232a});config[_0x1635('0xd')]=_['defaults'](config[_0x1635('0xd')],{'host':_0x1635('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1635('0xf'))['register'](socket);function respondWithRpcPromise(_0x171ac7,_0xf373ff,_0x4f109e){return new BPromise(function(_0x114dc4,_0xfcb242){return client[_0x1635('0x10')](_0x171ac7,_0x4f109e)['then'](function(_0x59a50f){logger['info'](_0x1635('0x11'),_0xf373ff,_0x1635('0x12'));logger[_0x1635('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xf373ff,'request\x20sent',JSON[_0x1635('0x14')](_0x59a50f));if(_0x59a50f['error']){if(_0x59a50f[_0x1635('0x15')][_0x1635('0x16')]===0x1f4){logger[_0x1635('0x15')](_0x1635('0x11'),_0xf373ff,_0x59a50f[_0x1635('0x15')]['message']);return _0xfcb242(_0x59a50f['error'][_0x1635('0x17')]);}logger[_0x1635('0x15')]('ChatQueue,\x20%s,\x20%s',_0xf373ff,_0x59a50f['error'][_0x1635('0x17')]);return _0x114dc4(_0x59a50f[_0x1635('0x15')][_0x1635('0x17')]);}else{logger[_0x1635('0x18')](_0x1635('0x11'),_0xf373ff,_0x1635('0x12'));_0x114dc4(_0x59a50f[_0x1635('0x19')][_0x1635('0x17')]);}})[_0x1635('0x1a')](function(_0x5e19a3){logger[_0x1635('0x15')](_0x1635('0x11'),_0xf373ff,_0x5e19a3);_0xfcb242(_0x5e19a3);});});}exports[_0x1635('0x1b')]=function(_0x4e1534){var _0x1b4c92=this;return new Promise(function(_0x57c947,_0x29fbbc){return db[_0x1635('0x1c')]['findAll']({'raw':_0x4e1534['options']?_0x4e1534[_0x1635('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4e1534['options']?_0x4e1534['options'][_0x1635('0x1e')]||null:null,'attributes':_0x4e1534[_0x1635('0x1d')]?_0x4e1534[_0x1635('0x1d')][_0x1635('0x1f')]||null:null,'limit':_0x4e1534[_0x1635('0x1d')]?_0x4e1534['options'][_0x1635('0x20')]||null:null,'include':_0x4e1534[_0x1635('0x1d')]?_0x4e1534[_0x1635('0x1d')][_0x1635('0x21')]?_[_0x1635('0x22')](_0x4e1534[_0x1635('0x1d')]['include'],function(_0x21a7ac){return{'model':db[_0x21a7ac['model']],'as':_0x21a7ac['as'],'attributes':_0x21a7ac[_0x1635('0x1f')],'include':_0x21a7ac[_0x1635('0x21')]?_[_0x1635('0x22')](_0x21a7ac['include'],function(_0x4aec56){return{'model':db[_0x4aec56[_0x1635('0x23')]],'as':_0x4aec56['as'],'attributes':_0x4aec56['attributes'],'include':_0x4aec56[_0x1635('0x21')]?_[_0x1635('0x22')](_0x4aec56[_0x1635('0x21')],function(_0x3bff45){return{'model':db[_0x3bff45[_0x1635('0x23')]],'as':_0x3bff45['as'],'attributes':_0x3bff45[_0x1635('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1635('0x24')](function(_0x57fb1e){logger[_0x1635('0x18')]('GetChatQueue',_0x4e1534);logger['debug'](_0x1635('0x1b'),_0x4e1534,JSON[_0x1635('0x14')](_0x57fb1e));_0x57c947(_0x57fb1e);})['catch'](function(_0x2c5420){logger[_0x1635('0x15')](_0x1635('0x1b'),_0x2c5420[_0x1635('0x17')],_0x4e1534);_0x29fbbc(_0x1b4c92[_0x1635('0x15')](0x1f4,_0x2c5420[_0x1635('0x17')]));});});};exports[_0x1635('0x25')]=function(_0x14333e){var _0x2121fb=this;return new Promise(function(_0x1195f5,_0x636fd9){return db[_0x1635('0x1c')][_0x1635('0x26')]({'raw':_0x14333e[_0x1635('0x1d')]?_0x14333e[_0x1635('0x1d')][_0x1635('0x27')]===undefined?!![]:![]:!![],'where':_0x14333e['options']?_0x14333e[_0x1635('0x1d')][_0x1635('0x1e')]||null:null,'attributes':_0x14333e['options']?_0x14333e[_0x1635('0x1d')][_0x1635('0x1f')]||null:null,'include':_0x14333e[_0x1635('0x1d')]?_0x14333e[_0x1635('0x1d')][_0x1635('0x21')]?_[_0x1635('0x22')](_0x14333e[_0x1635('0x1d')][_0x1635('0x21')],function(_0x2cad12){return{'model':db[_0x2cad12['model']],'as':_0x2cad12['as'],'attributes':_0x2cad12[_0x1635('0x1f')],'include':_0x2cad12[_0x1635('0x21')]?_[_0x1635('0x22')](_0x2cad12[_0x1635('0x21')],function(_0x195ee0){return{'model':db[_0x195ee0[_0x1635('0x23')]],'as':_0x195ee0['as'],'attributes':_0x195ee0[_0x1635('0x1f')],'include':_0x195ee0[_0x1635('0x21')]?_['map'](_0x195ee0[_0x1635('0x21')],function(_0x53d95b){return{'model':db[_0x53d95b[_0x1635('0x23')]],'as':_0x53d95b['as'],'attributes':_0x53d95b[_0x1635('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1635('0x24')](function(_0x57ab92){logger[_0x1635('0x18')](_0x1635('0x25'),_0x14333e);logger['debug'](_0x1635('0x25'),_0x14333e,JSON[_0x1635('0x14')](_0x57ab92));_0x1195f5(_0x57ab92);})[_0x1635('0x1a')](function(_0x565aab){logger[_0x1635('0x15')]('ShowChatQueue',_0x565aab[_0x1635('0x17')],_0x14333e);_0x636fd9(_0x2121fb[_0x1635('0x15')](0x1f4,_0x565aab[_0x1635('0x17')]));});});}; \ No newline at end of file +var _0xf6ed=['request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','options','raw','limit','map','include','model','attributes','find','where','info','ShowChatQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','redis','defaults','localhost','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s'];(function(_0x31db04,_0x46bf91){var _0xe4e01=function(_0x32eba7){while(--_0x32eba7){_0x31db04['push'](_0x31db04['shift']());}};_0xe4e01(++_0x46bf91);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x29241f,_0x1845bc){_0x29241f=_0x29241f-0x0;var _0x4b3d06=_0xf6ed[_0x29241f];return _0x4b3d06;};'use strict';var _=require(_0xdf6e('0x0'));var util=require('util');var moment=require(_0xdf6e('0x1'));var BPromise=require(_0xdf6e('0x2'));var rs=require(_0xdf6e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf6e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdf6e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdf6e('0x6')]['http']({'port':0x232a});config[_0xdf6e('0x7')]=_[_0xdf6e('0x8')](config[_0xdf6e('0x7')],{'host':_0xdf6e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf6e('0x7')]));require(_0xdf6e('0xa'))[_0xdf6e('0xb')](socket);function respondWithRpcPromise(_0x2c4100,_0x3a8881,_0x56d897){return new BPromise(function(_0x92cde3,_0x5ad59b){return client[_0xdf6e('0xc')](_0x2c4100,_0x56d897)['then'](function(_0x336554){logger['info'](_0xdf6e('0xd'),_0x3a8881,_0xdf6e('0xe'));logger['debug'](_0xdf6e('0xf'),_0x3a8881,_0xdf6e('0xe'),JSON[_0xdf6e('0x10')](_0x336554));if(_0x336554[_0xdf6e('0x11')]){if(_0x336554[_0xdf6e('0x11')][_0xdf6e('0x12')]===0x1f4){logger['error'](_0xdf6e('0xd'),_0x3a8881,_0x336554['error'][_0xdf6e('0x13')]);return _0x5ad59b(_0x336554[_0xdf6e('0x11')][_0xdf6e('0x13')]);}logger[_0xdf6e('0x11')](_0xdf6e('0xd'),_0x3a8881,_0x336554[_0xdf6e('0x11')][_0xdf6e('0x13')]);return _0x92cde3(_0x336554['error'][_0xdf6e('0x13')]);}else{logger['info'](_0xdf6e('0xd'),_0x3a8881,_0xdf6e('0xe'));_0x92cde3(_0x336554['result']['message']);}})[_0xdf6e('0x14')](function(_0x3c6a2e){logger[_0xdf6e('0x11')]('ChatQueue,\x20%s,\x20%s',_0x3a8881,_0x3c6a2e);_0x5ad59b(_0x3c6a2e);});});}exports[_0xdf6e('0x15')]=function(_0xb5a770){var _0x15282f=this;return new Promise(function(_0x27e7e5,_0x198f92){return db[_0xdf6e('0x16')]['findAll']({'raw':_0xb5a770[_0xdf6e('0x17')]?_0xb5a770[_0xdf6e('0x17')][_0xdf6e('0x18')]===undefined?!![]:![]:!![],'where':_0xb5a770['options']?_0xb5a770[_0xdf6e('0x17')]['where']||null:null,'attributes':_0xb5a770[_0xdf6e('0x17')]?_0xb5a770[_0xdf6e('0x17')]['attributes']||null:null,'limit':_0xb5a770[_0xdf6e('0x17')]?_0xb5a770[_0xdf6e('0x17')][_0xdf6e('0x19')]||null:null,'include':_0xb5a770[_0xdf6e('0x17')]?_0xb5a770['options']['include']?_[_0xdf6e('0x1a')](_0xb5a770['options'][_0xdf6e('0x1b')],function(_0xf10cda){return{'model':db[_0xf10cda[_0xdf6e('0x1c')]],'as':_0xf10cda['as'],'attributes':_0xf10cda[_0xdf6e('0x1d')],'include':_0xf10cda['include']?_[_0xdf6e('0x1a')](_0xf10cda[_0xdf6e('0x1b')],function(_0x9cdeba){return{'model':db[_0x9cdeba['model']],'as':_0x9cdeba['as'],'attributes':_0x9cdeba[_0xdf6e('0x1d')],'include':_0x9cdeba[_0xdf6e('0x1b')]?_[_0xdf6e('0x1a')](_0x9cdeba[_0xdf6e('0x1b')],function(_0x5c75f3){return{'model':db[_0x5c75f3[_0xdf6e('0x1c')]],'as':_0x5c75f3['as'],'attributes':_0x5c75f3[_0xdf6e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6b4289){logger['info'](_0xdf6e('0x15'),_0xb5a770);logger['debug'](_0xdf6e('0x15'),_0xb5a770,JSON['stringify'](_0x6b4289));_0x27e7e5(_0x6b4289);})[_0xdf6e('0x14')](function(_0x1ff9c7){logger['error'](_0xdf6e('0x15'),_0x1ff9c7[_0xdf6e('0x13')],_0xb5a770);_0x198f92(_0x15282f[_0xdf6e('0x11')](0x1f4,_0x1ff9c7[_0xdf6e('0x13')]));});});};exports['ShowChatQueue']=function(_0x341d47){var _0x291ea7=this;return new Promise(function(_0x31c250,_0x2dd018){return db[_0xdf6e('0x16')][_0xdf6e('0x1e')]({'raw':_0x341d47[_0xdf6e('0x17')]?_0x341d47[_0xdf6e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x341d47['options']?_0x341d47[_0xdf6e('0x17')][_0xdf6e('0x1f')]||null:null,'attributes':_0x341d47['options']?_0x341d47['options'][_0xdf6e('0x1d')]||null:null,'include':_0x341d47[_0xdf6e('0x17')]?_0x341d47[_0xdf6e('0x17')][_0xdf6e('0x1b')]?_[_0xdf6e('0x1a')](_0x341d47[_0xdf6e('0x17')][_0xdf6e('0x1b')],function(_0x3304d1){return{'model':db[_0x3304d1[_0xdf6e('0x1c')]],'as':_0x3304d1['as'],'attributes':_0x3304d1['attributes'],'include':_0x3304d1['include']?_[_0xdf6e('0x1a')](_0x3304d1['include'],function(_0x233398){return{'model':db[_0x233398[_0xdf6e('0x1c')]],'as':_0x233398['as'],'attributes':_0x233398['attributes'],'include':_0x233398[_0xdf6e('0x1b')]?_['map'](_0x233398[_0xdf6e('0x1b')],function(_0x271592){return{'model':db[_0x271592['model']],'as':_0x271592['as'],'attributes':_0x271592[_0xdf6e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42e177){logger[_0xdf6e('0x20')](_0xdf6e('0x21'),_0x341d47);logger['debug'](_0xdf6e('0x21'),_0x341d47,JSON[_0xdf6e('0x10')](_0x42e177));_0x31c250(_0x42e177);})[_0xdf6e('0x14')](function(_0x1d4284){logger[_0xdf6e('0x11')]('ShowChatQueue',_0x1d4284[_0xdf6e('0x13')],_0x341d47);_0x2dd018(_0x291ea7[_0xdf6e('0x11')](0x1f4,_0x1d4284[_0xdf6e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 04a9f14..0deb8fd 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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x57591e,_0x228d28){var _0x2add02=function(_0xdf89dd){while(--_0xdf89dd){_0x57591e['push'](_0x57591e['shift']());}};_0x2add02(++_0x228d28);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x4ef7bc,_0x1e8207){var _0x30a74f=function(_0x5c728e){while(--_0x5c728e){_0x4ef7bc['push'](_0x4ef7bc['shift']());}};_0x30a74f(++_0x1e8207);}(_0xb10b,0x12a));var _0xbb10=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0xb10b[_0x455150];return _0x12ca9c;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e668efa..faf66d2 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 _0xce5a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout'];(function(_0x1cb4ac,_0x4c7bba){var _0x414348=function(_0x1127f4){while(--_0x1127f4){_0x1cb4ac['push'](_0x1cb4ac['shift']());}};_0x414348(++_0x4c7bba);}(_0xce5a,0x93));var _0xace5=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xce5a[_0x403c20];return _0x2b271a;};'use strict';var multer=require('multer');var util=require(_0xace5('0x0'));var path=require(_0xace5('0x1'));var timeout=require(_0xace5('0x2'));var express=require(_0xace5('0x3'));var router=express[_0xace5('0x4')]();var auth=require(_0xace5('0x5'));var interaction=require(_0xace5('0x6'));var config=require(_0xace5('0x7'));var controller=require('./chatQueue.controller');router[_0xace5('0x8')]('/',auth[_0xace5('0x9')](),controller[_0xace5('0xa')]);router['get'](_0xace5('0xb'),auth['isAuthenticated'](),controller[_0xace5('0xc')]);router[_0xace5('0x8')](_0xace5('0xd'),auth[_0xace5('0x9')](),controller[_0xace5('0xe')]);router[_0xace5('0x8')](_0xace5('0xf'),auth['isAuthenticated'](),controller[_0xace5('0x10')]);router[_0xace5('0x8')](_0xace5('0x11'),auth[_0xace5('0x9')](),controller[_0xace5('0x12')]);router[_0xace5('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xace5('0x13')]('/',auth[_0xace5('0x9')](),controller[_0xace5('0x14')]);router[_0xace5('0x13')](_0xace5('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xace5('0x13')](_0xace5('0x15'),auth[_0xace5('0x9')](),controller[_0xace5('0x16')]);router[_0xace5('0x17')](_0xace5('0xd'),auth[_0xace5('0x9')](),controller[_0xace5('0x18')]);router[_0xace5('0x19')]('/:id',auth[_0xace5('0x9')](),controller[_0xace5('0x1a')]);router[_0xace5('0x19')](_0xace5('0x11'),auth[_0xace5('0x9')](),controller[_0xace5('0x1b')]);router[_0xace5('0x19')](_0xace5('0x15'),auth[_0xace5('0x9')](),controller[_0xace5('0x1c')]);module[_0xace5('0x1d')]=router; \ No newline at end of file +var _0x1233=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams'];(function(_0x3cc1ca,_0x42e033){var _0x4007ff=function(_0x2608a2){while(--_0x2608a2){_0x3cc1ca['push'](_0x3cc1ca['shift']());}};_0x4007ff(++_0x42e033);}(_0x1233,0x11f));var _0x3123=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0x1233[_0x1ca9eb];return _0x2e284e;};'use strict';var multer=require(_0x3123('0x0'));var util=require(_0x3123('0x1'));var path=require(_0x3123('0x2'));var timeout=require(_0x3123('0x3'));var express=require(_0x3123('0x4'));var router=express[_0x3123('0x5')]();var auth=require(_0x3123('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3123('0x7'));var controller=require(_0x3123('0x8'));router[_0x3123('0x9')]('/',auth['isAuthenticated'](),controller[_0x3123('0xa')]);router[_0x3123('0x9')](_0x3123('0xb'),auth[_0x3123('0xc')](),controller[_0x3123('0xd')]);router['get'](_0x3123('0xe'),auth[_0x3123('0xc')](),controller['show']);router['get']('/:id/members',auth[_0x3123('0xc')](),controller[_0x3123('0xf')]);router[_0x3123('0x9')](_0x3123('0x10'),auth[_0x3123('0xc')](),controller[_0x3123('0x11')]);router['get'](_0x3123('0x12'),auth[_0x3123('0xc')](),controller['getAgents']);router[_0x3123('0x13')]('/',auth[_0x3123('0xc')](),controller['create']);router[_0x3123('0x13')](_0x3123('0x10'),auth[_0x3123('0xc')](),controller[_0x3123('0x14')]);router['post'](_0x3123('0x12'),auth[_0x3123('0xc')](),controller[_0x3123('0x15')]);router[_0x3123('0x16')](_0x3123('0xe'),auth['isAuthenticated'](),controller[_0x3123('0x17')]);router[_0x3123('0x18')]('/:id',auth[_0x3123('0xc')](),controller[_0x3123('0x19')]);router[_0x3123('0x18')](_0x3123('0x10'),auth['isAuthenticated'](),controller[_0x3123('0x1a')]);router[_0x3123('0x18')]('/:id/users',auth[_0x3123('0xc')](),controller[_0x3123('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index caab015..0f75073 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 _0x2283=['moment','sequelize','exports','DATE'];(function(_0x51171d,_0x4e363f){var _0x40ab70=function(_0x29bf4d){while(--_0x29bf4d){_0x51171d['push'](_0x51171d['shift']());}};_0x40ab70(++_0x4e363f);}(_0x2283,0x1dc));var _0x3228=function(_0x313c3f,_0x54abd6){_0x313c3f=_0x313c3f-0x0;var _0x1aef06=_0x2283[_0x313c3f];return _0x1aef06;};'use strict';var moment=require(_0x3228('0x0'));var Sequelize=require(_0x3228('0x1'));module[_0x3228('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3228('0x3')]},'leaveAt':{'type':Sequelize[_0x3228('0x3')]},'acceptAt':{'type':Sequelize[_0x3228('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xacae=['DATE','exports','STRING'];(function(_0x5eb402,_0x1a75f1){var _0x3f282c=function(_0x58de0c){while(--_0x58de0c){_0x5eb402['push'](_0x5eb402['shift']());}};_0x3f282c(++_0x1a75f1);}(_0xacae,0xa3));var _0xeaca=function(_0x4b69fb,_0x26a7b9){_0x4b69fb=_0x4b69fb-0x0;var _0x1217ca=_0xacae[_0x4b69fb];return _0x1217ca;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xeaca('0x0')]={'uniqueid':{'type':Sequelize[_0xeaca('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xeaca('0x1')]},'joinAt':{'type':Sequelize[_0xeaca('0x2')]},'leaveAt':{'type':Sequelize[_0xeaca('0x2')]},'acceptAt':{'type':Sequelize[_0xeaca('0x2')]},'exitAt':{'type':Sequelize[_0xeaca('0x2')]},'reason':{'type':Sequelize[_0xeaca('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0f11415..b643f31 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 _0xb104=['name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xb104,0x72));var _0x4b10=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xb104[_0x38537f];return _0x141e23;};'use strict';var pdf=require(_0x4b10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b10('0x1'));var zipdir=require(_0x4b10('0x2'));var jsonpatch=require(_0x4b10('0x3'));var rp=require(_0x4b10('0x4'));var moment=require(_0x4b10('0x5'));var BPromise=require(_0x4b10('0x6'));var Mustache=require(_0x4b10('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4b10('0x8'));var csv=require(_0x4b10('0x9'));var ejs=require(_0x4b10('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4b10('0xb'));var crypto=require(_0x4b10('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4b10('0xd'));var toCsv=require(_0x4b10('0x9'));var querystring=require(_0x4b10('0xe'));var Papa=require(_0x4b10('0xf'));var Redis=require(_0x4b10('0x10'));var authService=require(_0x4b10('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4b10('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b10('0x13'))(_0x4b10('0x14'));var utils=require('../../config/utils');var config=require(_0x4b10('0x15'));var licenseUtil=require(_0x4b10('0x16'));var db=require(_0x4b10('0x17'))['db'];function respondWithStatusCode(_0x1c68f2,_0x3a0356){_0x3a0356=_0x3a0356||0xcc;return function(_0x1f48dd){if(_0x1f48dd){return _0x1c68f2[_0x4b10('0x18')](_0x3a0356);}return _0x1c68f2['status'](_0x3a0356)[_0x4b10('0x19')]();};}function respondWithResult(_0x107827,_0x47a922){_0x47a922=_0x47a922||0xc8;return function(_0x2afa12){if(_0x2afa12){return _0x107827[_0x4b10('0x1a')](_0x47a922)[_0x4b10('0x1b')](_0x2afa12);}};}function respondWithFilteredResult(_0x368657,_0xcfc6c4){return function(_0x4cf824){if(_0x4cf824){var _0x3ff184=_0x4cf824['count'],_0x269840=_0xcfc6c4[_0x4b10('0x1c')],_0x50f4fd=_0xcfc6c4[_0x4b10('0x1c')]+_0xcfc6c4[_0x4b10('0x1d')],_0x55bd9d;if(_0x50f4fd>=_0x3ff184){_0x50f4fd=_0x3ff184;_0x55bd9d=0xc8;}else{_0x55bd9d=0xce;}_0x368657[_0x4b10('0x1a')](_0x55bd9d);return _0x368657['set'](_0x4b10('0x1e'),_0x269840+'-'+_0x50f4fd+'/'+_0x3ff184)[_0x4b10('0x1b')](_0x4cf824);}return null;};}function patchUpdates(_0x49753e){return function(_0x245a02){try{jsonpatch[_0x4b10('0x1f')](_0x245a02,_0x49753e,!![]);}catch(_0x556de8){return BPromise[_0x4b10('0x20')](_0x556de8);}return _0x245a02[_0x4b10('0x21')]();};}function saveUpdates(_0x181b7b,_0x2ce637){return function(_0xd166bd){if(_0xd166bd){return _0xd166bd[_0x4b10('0x22')](_0x181b7b)[_0x4b10('0x23')](function(_0x5177ad){return _0x5177ad;});}return null;};}function removeEntity(_0x463504,_0x11432c){return function(_0x511d8b){if(_0x511d8b){return _0x511d8b['destroy']()[_0x4b10('0x23')](function(){_0x463504['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2c3a,_0x51975f){return function(_0xc300c){if(!_0xc300c){_0x2a2c3a['sendStatus'](0x194);}return _0xc300c;};}function handleError(_0x10e60f,_0x93d203){_0x93d203=_0x93d203||0x1f4;return function(_0x1d94e6){logger[_0x4b10('0x24')](_0x1d94e6[_0x4b10('0x25')]);if(_0x1d94e6['name']){delete _0x1d94e6[_0x4b10('0x26')];}_0x10e60f[_0x4b10('0x1a')](_0x93d203)['send'](_0x1d94e6);};}exports[_0x4b10('0x27')]=function(_0x3298bd,_0x411ff5){var _0x45544d={},_0x4cd7a0={},_0x4572f1={'count':0x0,'rows':[]};var _0x7936c0=_[_0x4b10('0x28')](db[_0x4b10('0x29')][_0x4b10('0x2a')],function(_0x5dc491){return{'name':_0x5dc491[_0x4b10('0x2b')],'type':_0x5dc491[_0x4b10('0x2c')][_0x4b10('0x2d')]};});_0x4cd7a0[_0x4b10('0x2e')]=_[_0x4b10('0x28')](_0x7936c0,_0x4b10('0x26'));_0x4cd7a0[_0x4b10('0x2f')]=_[_0x4b10('0x30')](_0x3298bd[_0x4b10('0x2f')]);_0x4cd7a0[_0x4b10('0x31')]=_['intersection'](_0x4cd7a0['model'],_0x4cd7a0['query']);_0x45544d['attributes']=_[_0x4b10('0x32')](_0x4cd7a0[_0x4b10('0x2e')],qs[_0x4b10('0x33')](_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x33')]));_0x45544d[_0x4b10('0x34')]=_0x45544d[_0x4b10('0x34')]['length']?_0x45544d[_0x4b10('0x34')]:_0x4cd7a0['model'];if(!_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x35')](_0x4b10('0x36'))){_0x45544d['limit']=qs[_0x4b10('0x1d')](_0x3298bd[_0x4b10('0x2f')]['limit']);_0x45544d[_0x4b10('0x1c')]=qs[_0x4b10('0x1c')](_0x3298bd['query'][_0x4b10('0x1c')]);}_0x45544d[_0x4b10('0x37')]=qs[_0x4b10('0x38')](_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x38')]);_0x45544d[_0x4b10('0x39')]=qs[_0x4b10('0x31')](_[_0x4b10('0x3a')](_0x3298bd[_0x4b10('0x2f')],_0x4cd7a0['filters']),_0x7936c0);if(_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x3b')]){_0x45544d[_0x4b10('0x39')]=_[_0x4b10('0x3c')](_0x45544d['where'],{'$or':_[_0x4b10('0x28')](_0x7936c0,function(_0x27f5b0){if(_0x27f5b0[_0x4b10('0x2c')]!==_0x4b10('0x3d')){var _0x4beb0d={};_0x4beb0d[_0x27f5b0[_0x4b10('0x26')]]={'$like':'%'+_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x3b')]+'%'};return _0x4beb0d;}})});}_0x45544d=_[_0x4b10('0x3c')]({},_0x45544d,_0x3298bd['options']);var _0x5e9b4d={'where':_0x45544d[_0x4b10('0x39')]};return db[_0x4b10('0x29')][_0x4b10('0x3e')](_0x5e9b4d)['then'](function(_0x2fbd9d){_0x4572f1[_0x4b10('0x3e')]=_0x2fbd9d;if(_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x3f')]){_0x45544d[_0x4b10('0x40')]=[{'all':!![]}];}return db[_0x4b10('0x29')][_0x4b10('0x41')](_0x45544d);})[_0x4b10('0x23')](function(_0x26a8c9){_0x4572f1[_0x4b10('0x42')]=_0x26a8c9;return _0x4572f1;})['then'](respondWithFilteredResult(_0x411ff5,_0x45544d))[_0x4b10('0x43')](handleError(_0x411ff5,null));};exports[_0x4b10('0x44')]=function(_0x352dda,_0x495bce){var _0x3333a5={'raw':!![],'where':{'id':_0x352dda[_0x4b10('0x45')]['id']}},_0x34b753={};_0x34b753[_0x4b10('0x2e')]=_['keys'](db[_0x4b10('0x29')]['rawAttributes']);_0x34b753['query']=_[_0x4b10('0x30')](_0x352dda[_0x4b10('0x2f')]);_0x34b753[_0x4b10('0x31')]=_['intersection'](_0x34b753['model'],_0x34b753[_0x4b10('0x2f')]);_0x3333a5[_0x4b10('0x34')]=_[_0x4b10('0x32')](_0x34b753[_0x4b10('0x2e')],qs[_0x4b10('0x33')](_0x352dda[_0x4b10('0x2f')]['fields']));_0x3333a5['attributes']=_0x3333a5[_0x4b10('0x34')]['length']?_0x3333a5['attributes']:_0x34b753[_0x4b10('0x2e')];if(_0x352dda['query'][_0x4b10('0x3f')]){_0x3333a5[_0x4b10('0x40')]=[{'all':!![]}];}_0x3333a5=_[_0x4b10('0x3c')]({},_0x3333a5,_0x352dda[_0x4b10('0x46')]);return db[_0x4b10('0x29')][_0x4b10('0x47')](_0x3333a5)[_0x4b10('0x23')](handleEntityNotFound(_0x495bce,null))[_0x4b10('0x23')](respondWithResult(_0x495bce,null))[_0x4b10('0x43')](handleError(_0x495bce,null));};exports[_0x4b10('0x48')]=function(_0x51e825,_0xfd54af){return db[_0x4b10('0x29')][_0x4b10('0x48')](_0x51e825[_0x4b10('0x49')],{})['then'](respondWithResult(_0xfd54af,0xc9))[_0x4b10('0x43')](handleError(_0xfd54af,null));};exports['update']=function(_0x24677b,_0x5d8761){if(_0x24677b[_0x4b10('0x49')]['id']){delete _0x24677b[_0x4b10('0x49')]['id'];}return db['ChatQueueReport'][_0x4b10('0x47')]({'where':{'id':_0x24677b[_0x4b10('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d8761,null))['then'](saveUpdates(_0x24677b[_0x4b10('0x49')],null))['then'](respondWithResult(_0x5d8761,null))[_0x4b10('0x43')](handleError(_0x5d8761,null));};exports[_0x4b10('0x4a')]=function(_0xb7e0e0,_0x5f51a6){return db[_0x4b10('0x29')][_0x4b10('0x47')]({'where':{'id':_0xb7e0e0[_0x4b10('0x45')]['id']}})[_0x4b10('0x23')](handleEntityNotFound(_0x5f51a6,null))['then'](removeEntity(_0x5f51a6,null))[_0x4b10('0x43')](handleError(_0x5f51a6,null));};exports['describe']=function(_0x208fd3,_0x1ea6c2){return db[_0x4b10('0x29')][_0x4b10('0x4b')]()[_0x4b10('0x23')](respondWithResult(_0x1ea6c2,null))['catch'](handleError(_0x1ea6c2,null));}; \ No newline at end of file +var _0x2e8b=['update','then','destroy','error','stack','name','send','index','ChatQueueReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','create','catch','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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','apply','reject','save'];(function(_0x928b87,_0x53480a){var _0x1e7638=function(_0x1e2184){while(--_0x1e2184){_0x928b87['push'](_0x928b87['shift']());}};_0x1e7638(++_0x53480a);}(_0x2e8b,0x1ee));var _0xb2e8=function(_0x109f8c,_0x15f3cb){_0x109f8c=_0x109f8c-0x0;var _0x550181=_0x2e8b[_0x109f8c];return _0x550181;};'use strict';var pdf=require(_0xb2e8('0x0'));var emlformat=require(_0xb2e8('0x1'));var rimraf=require(_0xb2e8('0x2'));var zipdir=require(_0xb2e8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2e8('0x4'));var moment=require(_0xb2e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb2e8('0x6'));var util=require(_0xb2e8('0x7'));var path=require(_0xb2e8('0x8'));var sox=require('sox');var csv=require(_0xb2e8('0x9'));var ejs=require(_0xb2e8('0xa'));var fs=require('fs');var _=require(_0xb2e8('0xb'));var squel=require(_0xb2e8('0xc'));var crypto=require(_0xb2e8('0xd'));var jsforce=require(_0xb2e8('0xe'));var deskjs=require(_0xb2e8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb2e8('0x10'));var Papa=require('papaparse');var Redis=require(_0xb2e8('0x11'));var authService=require(_0xb2e8('0x12'));var qs=require(_0xb2e8('0x13'));var as=require(_0xb2e8('0x14'));var hardwareService=require(_0xb2e8('0x15'));var logger=require(_0xb2e8('0x16'))(_0xb2e8('0x17'));var utils=require(_0xb2e8('0x18'));var config=require(_0xb2e8('0x19'));var licenseUtil=require(_0xb2e8('0x1a'));var db=require(_0xb2e8('0x1b'))['db'];function respondWithStatusCode(_0x372504,_0x45d015){_0x45d015=_0x45d015||0xcc;return function(_0x46cfcf){if(_0x46cfcf){return _0x372504[_0xb2e8('0x1c')](_0x45d015);}return _0x372504[_0xb2e8('0x1d')](_0x45d015)[_0xb2e8('0x1e')]();};}function respondWithResult(_0x5dbafb,_0x360b06){_0x360b06=_0x360b06||0xc8;return function(_0x5548a0){if(_0x5548a0){return _0x5dbafb[_0xb2e8('0x1d')](_0x360b06)[_0xb2e8('0x1f')](_0x5548a0);}};}function respondWithFilteredResult(_0x271aa2,_0x9a87c0){return function(_0x190ab9){if(_0x190ab9){var _0x51cc0e=_0x190ab9[_0xb2e8('0x20')],_0x329f06=_0x9a87c0[_0xb2e8('0x21')],_0x14fe19=_0x9a87c0[_0xb2e8('0x21')]+_0x9a87c0[_0xb2e8('0x22')],_0x3515d5;if(_0x14fe19>=_0x51cc0e){_0x14fe19=_0x51cc0e;_0x3515d5=0xc8;}else{_0x3515d5=0xce;}_0x271aa2[_0xb2e8('0x1d')](_0x3515d5);return _0x271aa2['set']('Content-Range',_0x329f06+'-'+_0x14fe19+'/'+_0x51cc0e)[_0xb2e8('0x1f')](_0x190ab9);}return null;};}function patchUpdates(_0x4cee49){return function(_0x5f404a){try{jsonpatch[_0xb2e8('0x23')](_0x5f404a,_0x4cee49,!![]);}catch(_0x7f3c78){return BPromise[_0xb2e8('0x24')](_0x7f3c78);}return _0x5f404a[_0xb2e8('0x25')]();};}function saveUpdates(_0x370744,_0x1f81cc){return function(_0x3d2fb9){if(_0x3d2fb9){return _0x3d2fb9[_0xb2e8('0x26')](_0x370744)[_0xb2e8('0x27')](function(_0x3d0c72){return _0x3d0c72;});}return null;};}function removeEntity(_0x160989,_0x4e114c){return function(_0x2881d9){if(_0x2881d9){return _0x2881d9[_0xb2e8('0x28')]()[_0xb2e8('0x27')](function(){_0x160989[_0xb2e8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21bf13,_0x4ed92f){return function(_0x320225){if(!_0x320225){_0x21bf13[_0xb2e8('0x1c')](0x194);}return _0x320225;};}function handleError(_0x3c4b4f,_0xe7ec95){_0xe7ec95=_0xe7ec95||0x1f4;return function(_0x44c261){logger[_0xb2e8('0x29')](_0x44c261[_0xb2e8('0x2a')]);if(_0x44c261[_0xb2e8('0x2b')]){delete _0x44c261[_0xb2e8('0x2b')];}_0x3c4b4f[_0xb2e8('0x1d')](_0xe7ec95)[_0xb2e8('0x2c')](_0x44c261);};}exports[_0xb2e8('0x2d')]=function(_0x550a40,_0x38cbb9){var _0xcadf29={},_0x450809={},_0x359abc={'count':0x0,'rows':[]};var _0x5b05ce=_['map'](db[_0xb2e8('0x2e')][_0xb2e8('0x2f')],function(_0x4f1e40){return{'name':_0x4f1e40['fieldName'],'type':_0x4f1e40[_0xb2e8('0x30')]['key']};});_0x450809[_0xb2e8('0x31')]=_[_0xb2e8('0x32')](_0x5b05ce,_0xb2e8('0x2b'));_0x450809[_0xb2e8('0x33')]=_[_0xb2e8('0x34')](_0x550a40['query']);_0x450809[_0xb2e8('0x35')]=_[_0xb2e8('0x36')](_0x450809['model'],_0x450809[_0xb2e8('0x33')]);_0xcadf29['attributes']=_[_0xb2e8('0x36')](_0x450809[_0xb2e8('0x31')],qs['fields'](_0x550a40[_0xb2e8('0x33')]['fields']));_0xcadf29[_0xb2e8('0x37')]=_0xcadf29[_0xb2e8('0x37')][_0xb2e8('0x38')]?_0xcadf29[_0xb2e8('0x37')]:_0x450809[_0xb2e8('0x31')];if(!_0x550a40[_0xb2e8('0x33')][_0xb2e8('0x39')](_0xb2e8('0x3a'))){_0xcadf29['limit']=qs['limit'](_0x550a40[_0xb2e8('0x33')][_0xb2e8('0x22')]);_0xcadf29[_0xb2e8('0x21')]=qs[_0xb2e8('0x21')](_0x550a40[_0xb2e8('0x33')]['offset']);}_0xcadf29['order']=qs[_0xb2e8('0x3b')](_0x550a40['query'][_0xb2e8('0x3b')]);_0xcadf29[_0xb2e8('0x3c')]=qs[_0xb2e8('0x35')](_[_0xb2e8('0x3d')](_0x550a40[_0xb2e8('0x33')],_0x450809[_0xb2e8('0x35')]),_0x5b05ce);if(_0x550a40[_0xb2e8('0x33')][_0xb2e8('0x3e')]){_0xcadf29[_0xb2e8('0x3c')]=_[_0xb2e8('0x3f')](_0xcadf29[_0xb2e8('0x3c')],{'$or':_[_0xb2e8('0x32')](_0x5b05ce,function(_0x457e53){if(_0x457e53[_0xb2e8('0x30')]!==_0xb2e8('0x40')){var _0x55fd9f={};_0x55fd9f[_0x457e53[_0xb2e8('0x2b')]]={'$like':'%'+_0x550a40[_0xb2e8('0x33')][_0xb2e8('0x3e')]+'%'};return _0x55fd9f;}})});}_0xcadf29=_[_0xb2e8('0x3f')]({},_0xcadf29,_0x550a40[_0xb2e8('0x41')]);var _0x2b7a64={'where':_0xcadf29[_0xb2e8('0x3c')]};return db[_0xb2e8('0x2e')]['count'](_0x2b7a64)[_0xb2e8('0x27')](function(_0x563f7d){_0x359abc[_0xb2e8('0x20')]=_0x563f7d;if(_0x550a40[_0xb2e8('0x33')][_0xb2e8('0x42')]){_0xcadf29[_0xb2e8('0x43')]=[{'all':!![]}];}return db[_0xb2e8('0x2e')]['findAll'](_0xcadf29);})['then'](function(_0x5b791e){_0x359abc[_0xb2e8('0x44')]=_0x5b791e;return _0x359abc;})[_0xb2e8('0x27')](respondWithFilteredResult(_0x38cbb9,_0xcadf29))['catch'](handleError(_0x38cbb9,null));};exports[_0xb2e8('0x45')]=function(_0x37ae81,_0x56a867){var _0x469504={'raw':!![],'where':{'id':_0x37ae81[_0xb2e8('0x46')]['id']}},_0x47dec2={};_0x47dec2[_0xb2e8('0x31')]=_[_0xb2e8('0x34')](db[_0xb2e8('0x2e')][_0xb2e8('0x2f')]);_0x47dec2['query']=_[_0xb2e8('0x34')](_0x37ae81[_0xb2e8('0x33')]);_0x47dec2['filters']=_[_0xb2e8('0x36')](_0x47dec2[_0xb2e8('0x31')],_0x47dec2[_0xb2e8('0x33')]);_0x469504[_0xb2e8('0x37')]=_[_0xb2e8('0x36')](_0x47dec2[_0xb2e8('0x31')],qs['fields'](_0x37ae81[_0xb2e8('0x33')]['fields']));_0x469504[_0xb2e8('0x37')]=_0x469504[_0xb2e8('0x37')][_0xb2e8('0x38')]?_0x469504[_0xb2e8('0x37')]:_0x47dec2['model'];if(_0x37ae81[_0xb2e8('0x33')][_0xb2e8('0x42')]){_0x469504[_0xb2e8('0x43')]=[{'all':!![]}];}_0x469504=_[_0xb2e8('0x3f')]({},_0x469504,_0x37ae81['options']);return db[_0xb2e8('0x2e')]['find'](_0x469504)['then'](handleEntityNotFound(_0x56a867,null))[_0xb2e8('0x27')](respondWithResult(_0x56a867,null))['catch'](handleError(_0x56a867,null));};exports[_0xb2e8('0x47')]=function(_0xdca82f,_0x32cf54){return db[_0xb2e8('0x2e')][_0xb2e8('0x47')](_0xdca82f['body'],{})[_0xb2e8('0x27')](respondWithResult(_0x32cf54,0xc9))[_0xb2e8('0x48')](handleError(_0x32cf54,null));};exports[_0xb2e8('0x26')]=function(_0x376a05,_0x45b0a0){if(_0x376a05[_0xb2e8('0x49')]['id']){delete _0x376a05[_0xb2e8('0x49')]['id'];}return db[_0xb2e8('0x2e')]['find']({'where':{'id':_0x376a05[_0xb2e8('0x46')]['id']}})['then'](handleEntityNotFound(_0x45b0a0,null))[_0xb2e8('0x27')](saveUpdates(_0x376a05[_0xb2e8('0x49')],null))['then'](respondWithResult(_0x45b0a0,null))[_0xb2e8('0x48')](handleError(_0x45b0a0,null));};exports[_0xb2e8('0x28')]=function(_0x1c27c9,_0x56930c){return db[_0xb2e8('0x2e')][_0xb2e8('0x4a')]({'where':{'id':_0x1c27c9[_0xb2e8('0x46')]['id']}})[_0xb2e8('0x27')](handleEntityNotFound(_0x56930c,null))['then'](removeEntity(_0x56930c,null))[_0xb2e8('0x48')](handleError(_0x56930c,null));};exports[_0xb2e8('0x4b')]=function(_0x520017,_0x298db8){return db['ChatQueueReport']['describe']()[_0xb2e8('0x27')](respondWithResult(_0x298db8,null))[_0xb2e8('0x48')](handleError(_0x298db8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 8b2740c..7d73cf2 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 _0x4235=['ChatQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x186550,_0x26f3ee){var _0x4b4c70=function(_0x2e255e){while(--_0x2e255e){_0x186550['push'](_0x186550['shift']());}};_0x4b4c70(++_0x26f3ee);}(_0x4235,0x9e));var _0x5423=function(_0x2ecbfd,_0x5bacbc){_0x2ecbfd=_0x2ecbfd-0x0;var _0x2c65a2=_0x4235[_0x2ecbfd];return _0x2c65a2;};'use strict';var _=require(_0x5423('0x0'));var util=require(_0x5423('0x1'));var logger=require('../../config/logger')(_0x5423('0x2'));var moment=require(_0x5423('0x3'));var BPromise=require(_0x5423('0x4'));var rp=require(_0x5423('0x5'));var fs=require('fs');var path=require(_0x5423('0x6'));var rimraf=require('rimraf');var config=require(_0x5423('0x7'));var attributes=require(_0x5423('0x8'));module[_0x5423('0x9')]=function(_0x327e7d,_0x4d8e84){return _0x327e7d[_0x5423('0xa')](_0x5423('0xb'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x5423('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x932b=['path','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x38cf38,_0x12ce83){var _0x2e7888=function(_0x39a690){while(--_0x39a690){_0x38cf38['push'](_0x38cf38['shift']());}};_0x2e7888(++_0x12ce83);}(_0x932b,0xff));var _0xb932=function(_0x1e0de7,_0x28b328){_0x1e0de7=_0x1e0de7-0x0;var _0x212ce6=_0x932b[_0x1e0de7];return _0x212ce6;};'use strict';var _=require(_0xb932('0x0'));var util=require(_0xb932('0x1'));var logger=require(_0xb932('0x2'))(_0xb932('0x3'));var moment=require('moment');var BPromise=require(_0xb932('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb932('0x5'));var rimraf=require(_0xb932('0x6'));var config=require(_0xb932('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0xb932('0x8')]=function(_0x4e99a7,_0x6949bd){return _0x4e99a7[_0xb932('0x9')](_0xb932('0xa'),attributes,{'tableName':_0xb932('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb932('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 5c6c18d..f30ce3a 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 _0xfc31=['../../config/environment','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3f16f6,_0x3854b5){var _0x18dcdb=function(_0xff47b1){while(--_0xff47b1){_0x3f16f6['push'](_0x3f16f6['shift']());}};_0x18dcdb(++_0x3854b5);}(_0xfc31,0xf9));var _0x1fc3=function(_0x552d5b,_0x4d16f4){_0x552d5b=_0x552d5b-0x0;var _0xb5bee1=_0xfc31[_0x552d5b];return _0xb5bee1;};'use strict';var _=require(_0x1fc3('0x0'));var util=require(_0x1fc3('0x1'));var moment=require('moment');var BPromise=require(_0x1fc3('0x2'));var rs=require(_0x1fc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fc3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fc3('0x5'))(_0x1fc3('0x6'));var config=require(_0x1fc3('0x7'));var jayson=require(_0x1fc3('0x8'));var client=jayson[_0x1fc3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4957b3,_0x4ee0b1,_0x9f7917){return new BPromise(function(_0x8f58f3,_0x1dd227){return client[_0x1fc3('0xa')](_0x4957b3,_0x9f7917)[_0x1fc3('0xb')](function(_0x3494a1){logger['info'](_0x1fc3('0xc'),_0x4ee0b1,_0x1fc3('0xd'));logger[_0x1fc3('0xe')](_0x1fc3('0xf'),_0x4ee0b1,_0x1fc3('0xd'),JSON[_0x1fc3('0x10')](_0x3494a1));if(_0x3494a1[_0x1fc3('0x11')]){if(_0x3494a1['error']['code']===0x1f4){logger[_0x1fc3('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4ee0b1,_0x3494a1['error']['message']);return _0x1dd227(_0x3494a1[_0x1fc3('0x11')][_0x1fc3('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4ee0b1,_0x3494a1[_0x1fc3('0x11')][_0x1fc3('0x12')]);return _0x8f58f3(_0x3494a1[_0x1fc3('0x11')]['message']);}else{logger[_0x1fc3('0x13')](_0x1fc3('0xc'),_0x4ee0b1,_0x1fc3('0xd'));_0x8f58f3(_0x3494a1[_0x1fc3('0x14')][_0x1fc3('0x12')]);}})[_0x1fc3('0x15')](function(_0x2d08e5){logger[_0x1fc3('0x11')](_0x1fc3('0xc'),_0x4ee0b1,_0x2d08e5);_0x1dd227(_0x2d08e5);});});}exports[_0x1fc3('0x16')]=function(_0x15e6cd){var _0x229204=this;return new Promise(function(_0xcf7ffb,_0x3c946a){return db[_0x1fc3('0x17')]['create'](_0x15e6cd[_0x1fc3('0x18')],{'raw':_0x15e6cd[_0x1fc3('0x19')]?_0x15e6cd[_0x1fc3('0x19')][_0x1fc3('0x1a')]===undefined?!![]:![]:!![]})[_0x1fc3('0xb')](function(_0x2b2ec3){logger[_0x1fc3('0x13')]('CreateChatQueueReport',_0x15e6cd);logger[_0x1fc3('0xe')](_0x1fc3('0x16'),_0x15e6cd,JSON['stringify'](_0x2b2ec3));_0xcf7ffb(_0x2b2ec3);})[_0x1fc3('0x15')](function(_0x5791f7){logger[_0x1fc3('0x11')](_0x1fc3('0x16'),_0x5791f7[_0x1fc3('0x12')],_0x15e6cd);_0x3c946a(_0x229204[_0x1fc3('0x11')](0x1f4,_0x5791f7['message']));});});};exports[_0x1fc3('0x1b')]=function(_0x6131f1){var _0x49f6b6=this;return new Promise(function(_0x50b25a,_0x58bb41){return db['ChatQueueReport'][_0x1fc3('0x1c')](_0x6131f1[_0x1fc3('0x18')],{'raw':_0x6131f1['options']?_0x6131f1[_0x1fc3('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6131f1[_0x1fc3('0x19')]?_0x6131f1[_0x1fc3('0x19')][_0x1fc3('0x1d')]||null:null,'attributes':_0x6131f1[_0x1fc3('0x19')]?_0x6131f1[_0x1fc3('0x19')][_0x1fc3('0x1e')]||null:null,'limit':_0x6131f1[_0x1fc3('0x19')]?_0x6131f1[_0x1fc3('0x19')][_0x1fc3('0x1f')]||null:null})[_0x1fc3('0xb')](function(_0x232bdf){logger[_0x1fc3('0x13')](_0x1fc3('0x1b'),_0x6131f1);logger[_0x1fc3('0xe')](_0x1fc3('0x1b'),_0x6131f1,JSON[_0x1fc3('0x10')](_0x232bdf));_0x50b25a(_0x232bdf);})[_0x1fc3('0x15')](function(_0x210ac0){logger['error']('UpdateChatQueueReport',_0x210ac0[_0x1fc3('0x12')],_0x6131f1);_0x58bb41(_0x49f6b6[_0x1fc3('0x11')](0x1f4,_0x210ac0[_0x1fc3('0x12')]));});});}; \ No newline at end of file +var _0x531c=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','CreateChatQueueReport','ChatQueueReport','create','body','options','catch','UpdateChatQueueReport','update','raw','where','attributes'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0x531c,0xe0));var _0xc531=function(_0x30e33c,_0x2db57e){_0x30e33c=_0x30e33c-0x0;var _0x1ca401=_0x531c[_0x30e33c];return _0x1ca401;};'use strict';var _=require(_0xc531('0x0'));var util=require(_0xc531('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc531('0x2'));var fs=require('fs');var Redis=require(_0xc531('0x3'));var db=require(_0xc531('0x4'))['db'];var utils=require(_0xc531('0x5'));var logger=require(_0xc531('0x6'))(_0xc531('0x7'));var config=require(_0xc531('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc531('0x9')][_0xc531('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57a553,_0x3b2a9a,_0x421f42){return new BPromise(function(_0x35023b,_0x222d74){return client['request'](_0x57a553,_0x421f42)[_0xc531('0xb')](function(_0x42897a){logger[_0xc531('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x3b2a9a,_0xc531('0xd'));logger[_0xc531('0xe')](_0xc531('0xf'),_0x3b2a9a,_0xc531('0xd'),JSON[_0xc531('0x10')](_0x42897a));if(_0x42897a[_0xc531('0x11')]){if(_0x42897a['error'][_0xc531('0x12')]===0x1f4){logger[_0xc531('0x11')](_0xc531('0x13'),_0x3b2a9a,_0x42897a['error']['message']);return _0x222d74(_0x42897a[_0xc531('0x11')]['message']);}logger[_0xc531('0x11')](_0xc531('0x13'),_0x3b2a9a,_0x42897a[_0xc531('0x11')][_0xc531('0x14')]);return _0x35023b(_0x42897a[_0xc531('0x11')][_0xc531('0x14')]);}else{logger[_0xc531('0xc')](_0xc531('0x13'),_0x3b2a9a,'request\x20sent');_0x35023b(_0x42897a['result'][_0xc531('0x14')]);}})['catch'](function(_0x33f64e){logger['error'](_0xc531('0x13'),_0x3b2a9a,_0x33f64e);_0x222d74(_0x33f64e);});});}exports[_0xc531('0x15')]=function(_0x1f68ac){var _0x5b160a=this;return new Promise(function(_0x57d261,_0xd06eca){return db[_0xc531('0x16')][_0xc531('0x17')](_0x1f68ac[_0xc531('0x18')],{'raw':_0x1f68ac['options']?_0x1f68ac[_0xc531('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc531('0xb')](function(_0x2a8a8b){logger[_0xc531('0xc')](_0xc531('0x15'),_0x1f68ac);logger[_0xc531('0xe')](_0xc531('0x15'),_0x1f68ac,JSON['stringify'](_0x2a8a8b));_0x57d261(_0x2a8a8b);})[_0xc531('0x1a')](function(_0x5285bf){logger[_0xc531('0x11')]('CreateChatQueueReport',_0x5285bf[_0xc531('0x14')],_0x1f68ac);_0xd06eca(_0x5b160a['error'](0x1f4,_0x5285bf[_0xc531('0x14')]));});});};exports[_0xc531('0x1b')]=function(_0x56ca44){var _0x4ae98f=this;return new Promise(function(_0x583036,_0x417861){return db[_0xc531('0x16')][_0xc531('0x1c')](_0x56ca44[_0xc531('0x18')],{'raw':_0x56ca44[_0xc531('0x19')]?_0x56ca44[_0xc531('0x19')][_0xc531('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56ca44[_0xc531('0x19')]?_0x56ca44['options'][_0xc531('0x1e')]||null:null,'attributes':_0x56ca44[_0xc531('0x19')]?_0x56ca44['options'][_0xc531('0x1f')]||null:null,'limit':_0x56ca44['options']?_0x56ca44[_0xc531('0x19')]['limit']||null:null})[_0xc531('0xb')](function(_0x444d87){logger[_0xc531('0xc')]('UpdateChatQueueReport',_0x56ca44);logger[_0xc531('0xe')]('UpdateChatQueueReport',_0x56ca44,JSON[_0xc531('0x10')](_0x444d87));_0x583036(_0x444d87);})[_0xc531('0x1a')](function(_0x5ef3f0){logger[_0xc531('0x11')](_0xc531('0x1b'),_0x5ef3f0[_0xc531('0x14')],_0x56ca44);_0x417861(_0x4ae98f[_0xc531('0x11')](0x1f4,_0x5ef3f0[_0xc531('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 9067c32..33ea643 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 _0xc853=['put','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc853,0xf1));var _0x3c85=function(_0x5d0db5,_0x148cba){_0x5d0db5=_0x5d0db5-0x0;var _0x2c13e1=_0xc853[_0x5d0db5];return _0x2c13e1;};'use strict';var multer=require(_0x3c85('0x0'));var util=require(_0x3c85('0x1'));var path=require(_0x3c85('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c85('0x3'));var router=express[_0x3c85('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c85('0x5'));var config=require('../../config/environment');var controller=require(_0x3c85('0x6'));router['get']('/',auth[_0x3c85('0x7')](),controller['index']);router['get'](_0x3c85('0x8'),auth[_0x3c85('0x7')](),controller[_0x3c85('0x9')]);router['get'](_0x3c85('0xa'),auth['isAuthenticated'](),controller[_0x3c85('0xb')]);router[_0x3c85('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c85('0xd')]);router[_0x3c85('0xe')](_0x3c85('0xa'),auth[_0x3c85('0x7')](),controller['update']);router[_0x3c85('0xf')]('/:id',auth[_0x3c85('0x7')](),controller[_0x3c85('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdd5d=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xdd5d,0x1e5));var _0xddd5=function(_0x4efcfb,_0x5dc3b4){_0x4efcfb=_0x4efcfb-0x0;var _0x120c8c=_0xdd5d[_0x4efcfb];return _0x120c8c;};'use strict';var multer=require(_0xddd5('0x0'));var util=require(_0xddd5('0x1'));var path=require(_0xddd5('0x2'));var timeout=require(_0xddd5('0x3'));var express=require('express');var router=express[_0xddd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xddd5('0x5'));var controller=require('./chatQueueReport.controller');router[_0xddd5('0x6')]('/',auth[_0xddd5('0x7')](),controller[_0xddd5('0x8')]);router[_0xddd5('0x6')](_0xddd5('0x9'),auth[_0xddd5('0x7')](),controller[_0xddd5('0xa')]);router[_0xddd5('0x6')](_0xddd5('0xb'),auth[_0xddd5('0x7')](),controller[_0xddd5('0xc')]);router[_0xddd5('0xd')]('/',auth[_0xddd5('0x7')](),controller[_0xddd5('0xe')]);router[_0xddd5('0xf')]('/:id',auth[_0xddd5('0x7')](),controller[_0xddd5('0x10')]);router[_0xddd5('0x11')](_0xddd5('0xb'),auth[_0xddd5('0x7')](),controller[_0xddd5('0x12')]);module[_0xddd5('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ed56eed..8944cef 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 _0xa619=['account','agent','queue','DATE','NOW','moment','exports','STRING'];(function(_0x5629e9,_0x5e670d){var _0x5280ab=function(_0x48d650){while(--_0x48d650){_0x5629e9['push'](_0x5629e9['shift']());}};_0x5280ab(++_0x5e670d);}(_0xa619,0x1e5));var _0x9a61=function(_0x3f753d,_0x34caab){_0x3f753d=_0x3f753d-0x0;var _0x36131d=_0xa619[_0x3f753d];return _0x36131d;};'use strict';var moment=require(_0x9a61('0x0'));var Sequelize=require('sequelize');module[_0x9a61('0x1')]={'uniqueid':{'type':Sequelize[_0x9a61('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9a61('0x3'),_0x9a61('0x4'),_0x9a61('0x5')),'allowNull':![],'defaultValue':_0x9a61('0x5')},'transferredAt':{'type':Sequelize[_0x9a61('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x9a61('0x7')]}}; \ No newline at end of file +var _0x0215=['moment','exports','STRING','ENUM','account','agent','queue','NOW'];(function(_0x380498,_0x51b6ae){var _0x2e0dfe=function(_0x172e97){while(--_0x172e97){_0x380498['push'](_0x380498['shift']());}};_0x2e0dfe(++_0x51b6ae);}(_0x0215,0x138));var _0x5021=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x0215[_0x18afca];return _0x11603f;};'use strict';var moment=require(_0x5021('0x0'));var Sequelize=require('sequelize');module[_0x5021('0x1')]={'uniqueid':{'type':Sequelize[_0x5021('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5021('0x3')](_0x5021('0x4'),_0x5021('0x5'),_0x5021('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5021('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8948ca9..b39f4b6 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 _0x7d85=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','stack','name','send','map','ChatTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto'];(function(_0x15db61,_0x36b1b7){var _0x2e8178=function(_0x3cedf2){while(--_0x3cedf2){_0x15db61['push'](_0x15db61['shift']());}};_0x2e8178(++_0x36b1b7);}(_0x7d85,0x87));var _0x57d8=function(_0x345d55,_0x7bee08){_0x345d55=_0x345d55-0x0;var _0x59802b=_0x7d85[_0x345d55];return _0x59802b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57d8('0x0'));var rimraf=require(_0x57d8('0x1'));var zipdir=require(_0x57d8('0x2'));var jsonpatch=require(_0x57d8('0x3'));var rp=require(_0x57d8('0x4'));var moment=require(_0x57d8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x57d8('0x6'));var util=require(_0x57d8('0x7'));var path=require(_0x57d8('0x8'));var sox=require('sox');var csv=require(_0x57d8('0x9'));var ejs=require(_0x57d8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57d8('0xb'));var crypto=require(_0x57d8('0xc'));var jsforce=require(_0x57d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x57d8('0x9'));var querystring=require(_0x57d8('0xe'));var Papa=require(_0x57d8('0xf'));var Redis=require(_0x57d8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x57d8('0x11'));var as=require(_0x57d8('0x12'));var hardwareService=require(_0x57d8('0x13'));var logger=require(_0x57d8('0x14'))(_0x57d8('0x15'));var utils=require('../../config/utils');var config=require(_0x57d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x701e18,_0xaf0b96){_0xaf0b96=_0xaf0b96||0xcc;return function(_0x3c5df7){if(_0x3c5df7){return _0x701e18[_0x57d8('0x17')](_0xaf0b96);}return _0x701e18[_0x57d8('0x18')](_0xaf0b96)[_0x57d8('0x19')]();};}function respondWithResult(_0x376d20,_0x50d48a){_0x50d48a=_0x50d48a||0xc8;return function(_0x36816a){if(_0x36816a){return _0x376d20[_0x57d8('0x18')](_0x50d48a)[_0x57d8('0x1a')](_0x36816a);}};}function respondWithFilteredResult(_0xb4961b,_0x1c103f){return function(_0x21b99b){if(_0x21b99b){var _0x41e397=_0x21b99b['count'],_0x877819=_0x1c103f[_0x57d8('0x1b')],_0x32d7de=_0x1c103f[_0x57d8('0x1b')]+_0x1c103f['limit'],_0x2a7aae;if(_0x32d7de>=_0x41e397){_0x32d7de=_0x41e397;_0x2a7aae=0xc8;}else{_0x2a7aae=0xce;}_0xb4961b[_0x57d8('0x18')](_0x2a7aae);return _0xb4961b[_0x57d8('0x1c')]('Content-Range',_0x877819+'-'+_0x32d7de+'/'+_0x41e397)[_0x57d8('0x1a')](_0x21b99b);}return null;};}function patchUpdates(_0x457447){return function(_0x34b49d){try{jsonpatch[_0x57d8('0x1d')](_0x34b49d,_0x457447,!![]);}catch(_0xc6dd6c){return BPromise[_0x57d8('0x1e')](_0xc6dd6c);}return _0x34b49d[_0x57d8('0x1f')]();};}function saveUpdates(_0x19ab96,_0x13670f){return function(_0x3c3b3a){if(_0x3c3b3a){return _0x3c3b3a[_0x57d8('0x20')](_0x19ab96)[_0x57d8('0x21')](function(_0x29cc9d){return _0x29cc9d;});}return null;};}function removeEntity(_0x4b0489,_0x4eeb6d){return function(_0x23fd99){if(_0x23fd99){return _0x23fd99[_0x57d8('0x22')]()['then'](function(){_0x4b0489[_0x57d8('0x18')](0xcc)[_0x57d8('0x19')]();});}};}function handleEntityNotFound(_0x3c5c30,_0x46d074){return function(_0x4527eb){if(!_0x4527eb){_0x3c5c30[_0x57d8('0x17')](0x194);}return _0x4527eb;};}function handleError(_0x1224b2,_0x2a0a7a){_0x2a0a7a=_0x2a0a7a||0x1f4;return function(_0x5dc95c){logger['error'](_0x5dc95c[_0x57d8('0x23')]);if(_0x5dc95c[_0x57d8('0x24')]){delete _0x5dc95c['name'];}_0x1224b2[_0x57d8('0x18')](_0x2a0a7a)[_0x57d8('0x25')](_0x5dc95c);};}exports['index']=function(_0x2b68f8,_0x39127b){var _0x141131={},_0x1ddcde={},_0x382b42={'count':0x0,'rows':[]};var _0x2020af=_[_0x57d8('0x26')](db[_0x57d8('0x27')][_0x57d8('0x28')],function(_0x39d8dd){return{'name':_0x39d8dd['fieldName'],'type':_0x39d8dd[_0x57d8('0x29')][_0x57d8('0x2a')]};});_0x1ddcde['model']=_[_0x57d8('0x26')](_0x2020af,'name');_0x1ddcde[_0x57d8('0x2b')]=_[_0x57d8('0x2c')](_0x2b68f8[_0x57d8('0x2b')]);_0x1ddcde[_0x57d8('0x2d')]=_[_0x57d8('0x2e')](_0x1ddcde[_0x57d8('0x2f')],_0x1ddcde[_0x57d8('0x2b')]);_0x141131[_0x57d8('0x30')]=_[_0x57d8('0x2e')](_0x1ddcde[_0x57d8('0x2f')],qs['fields'](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x31')]));_0x141131[_0x57d8('0x30')]=_0x141131[_0x57d8('0x30')][_0x57d8('0x32')]?_0x141131[_0x57d8('0x30')]:_0x1ddcde[_0x57d8('0x2f')];if(!_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x33')](_0x57d8('0x34'))){_0x141131[_0x57d8('0x35')]=qs[_0x57d8('0x35')](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x35')]);_0x141131['offset']=qs[_0x57d8('0x1b')](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x1b')]);}_0x141131[_0x57d8('0x36')]=qs[_0x57d8('0x37')](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x37')]);_0x141131['where']=qs[_0x57d8('0x2d')](_[_0x57d8('0x38')](_0x2b68f8['query'],_0x1ddcde[_0x57d8('0x2d')]),_0x2020af);if(_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x39')]){_0x141131[_0x57d8('0x3a')]=_[_0x57d8('0x3b')](_0x141131[_0x57d8('0x3a')],{'$or':_['map'](_0x2020af,function(_0x1e26d4){if(_0x1e26d4[_0x57d8('0x29')]!==_0x57d8('0x3c')){var _0x40ce0e={};_0x40ce0e[_0x1e26d4[_0x57d8('0x24')]]={'$like':'%'+_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x39')]+'%'};return _0x40ce0e;}})});}_0x141131=_[_0x57d8('0x3b')]({},_0x141131,_0x2b68f8[_0x57d8('0x3d')]);var _0x2ab96e={'where':_0x141131['where']};return db[_0x57d8('0x27')][_0x57d8('0x3e')](_0x2ab96e)[_0x57d8('0x21')](function(_0x3509e3){_0x382b42['count']=_0x3509e3;if(_0x2b68f8[_0x57d8('0x2b')]['includeAll']){_0x141131[_0x57d8('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x57d8('0x40')](_0x141131);})[_0x57d8('0x21')](function(_0x5f4731){_0x382b42[_0x57d8('0x41')]=_0x5f4731;return _0x382b42;})[_0x57d8('0x21')](respondWithFilteredResult(_0x39127b,_0x141131))[_0x57d8('0x42')](handleError(_0x39127b,null));};exports[_0x57d8('0x43')]=function(_0x149876,_0x38425a){var _0xde7b0d={'raw':!![],'where':{'id':_0x149876['params']['id']}},_0x9ba5fa={};_0x9ba5fa['model']=_['keys'](db[_0x57d8('0x27')]['rawAttributes']);_0x9ba5fa[_0x57d8('0x2b')]=_['keys'](_0x149876[_0x57d8('0x2b')]);_0x9ba5fa[_0x57d8('0x2d')]=_[_0x57d8('0x2e')](_0x9ba5fa['model'],_0x9ba5fa[_0x57d8('0x2b')]);_0xde7b0d[_0x57d8('0x30')]=_['intersection'](_0x9ba5fa['model'],qs[_0x57d8('0x31')](_0x149876['query']['fields']));_0xde7b0d[_0x57d8('0x30')]=_0xde7b0d['attributes']['length']?_0xde7b0d['attributes']:_0x9ba5fa[_0x57d8('0x2f')];if(_0x149876[_0x57d8('0x2b')][_0x57d8('0x44')]){_0xde7b0d['include']=[{'all':!![]}];}_0xde7b0d=_[_0x57d8('0x3b')]({},_0xde7b0d,_0x149876['options']);return db['ChatTransferReport'][_0x57d8('0x45')](_0xde7b0d)[_0x57d8('0x21')](handleEntityNotFound(_0x38425a,null))[_0x57d8('0x21')](respondWithResult(_0x38425a,null))[_0x57d8('0x42')](handleError(_0x38425a,null));};exports[_0x57d8('0x46')]=function(_0x254d07,_0x1fa1c7){return db[_0x57d8('0x27')][_0x57d8('0x46')](_0x254d07[_0x57d8('0x47')],{})[_0x57d8('0x21')](respondWithResult(_0x1fa1c7,0xc9))[_0x57d8('0x42')](handleError(_0x1fa1c7,null));};exports['update']=function(_0x24fa1c,_0x18320c){if(_0x24fa1c[_0x57d8('0x47')]['id']){delete _0x24fa1c[_0x57d8('0x47')]['id'];}return db[_0x57d8('0x27')][_0x57d8('0x45')]({'where':{'id':_0x24fa1c['params']['id']}})['then'](handleEntityNotFound(_0x18320c,null))[_0x57d8('0x21')](saveUpdates(_0x24fa1c['body'],null))[_0x57d8('0x21')](respondWithResult(_0x18320c,null))[_0x57d8('0x42')](handleError(_0x18320c,null));};exports[_0x57d8('0x22')]=function(_0x2c379d,_0x380546){return db[_0x57d8('0x27')][_0x57d8('0x45')]({'where':{'id':_0x2c379d[_0x57d8('0x48')]['id']}})[_0x57d8('0x21')](handleEntityNotFound(_0x380546,null))[_0x57d8('0x21')](removeEntity(_0x380546,null))[_0x57d8('0x42')](handleError(_0x380546,null));};exports[_0x57d8('0x49')]=function(_0xafcb68,_0x158be2){return db[_0x57d8('0x27')][_0x57d8('0x49')]()['then'](respondWithResult(_0x158be2,null))[_0x57d8('0x42')](handleError(_0x158be2,null));}; \ No newline at end of file +var _0xe9a9=['sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','index','map','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x41639b,_0x27bd1d){var _0xd942f9=function(_0xec8dae){while(--_0xec8dae){_0x41639b['push'](_0x41639b['shift']());}};_0xd942f9(++_0x27bd1d);}(_0xe9a9,0x190));var _0x9e9a=function(_0x437a60,_0xe17787){_0x437a60=_0x437a60-0x0;var _0x1ed7cd=_0xe9a9[_0x437a60];return _0x1ed7cd;};'use strict';var pdf=require(_0x9e9a('0x0'));var emlformat=require(_0x9e9a('0x1'));var rimraf=require(_0x9e9a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e9a('0x3'));var rp=require(_0x9e9a('0x4'));var moment=require(_0x9e9a('0x5'));var BPromise=require(_0x9e9a('0x6'));var Mustache=require(_0x9e9a('0x7'));var util=require(_0x9e9a('0x8'));var path=require('path');var sox=require(_0x9e9a('0x9'));var csv=require(_0x9e9a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9e9a('0xb'));var crypto=require(_0x9e9a('0xc'));var jsforce=require(_0x9e9a('0xd'));var deskjs=require(_0x9e9a('0xe'));var toCsv=require(_0x9e9a('0xa'));var querystring=require(_0x9e9a('0xf'));var Papa=require(_0x9e9a('0x10'));var Redis=require('ioredis');var authService=require(_0x9e9a('0x11'));var qs=require(_0x9e9a('0x12'));var as=require(_0x9e9a('0x13'));var hardwareService=require(_0x9e9a('0x14'));var logger=require(_0x9e9a('0x15'))(_0x9e9a('0x16'));var utils=require(_0x9e9a('0x17'));var config=require(_0x9e9a('0x18'));var licenseUtil=require(_0x9e9a('0x19'));var db=require(_0x9e9a('0x1a'))['db'];function respondWithStatusCode(_0xe04f24,_0x1a3d01){_0x1a3d01=_0x1a3d01||0xcc;return function(_0x502d82){if(_0x502d82){return _0xe04f24[_0x9e9a('0x1b')](_0x1a3d01);}return _0xe04f24[_0x9e9a('0x1c')](_0x1a3d01)[_0x9e9a('0x1d')]();};}function respondWithResult(_0xf31b4a,_0x2b3632){_0x2b3632=_0x2b3632||0xc8;return function(_0x49420a){if(_0x49420a){return _0xf31b4a[_0x9e9a('0x1c')](_0x2b3632)[_0x9e9a('0x1e')](_0x49420a);}};}function respondWithFilteredResult(_0xfb2849,_0x2e0d91){return function(_0x392914){if(_0x392914){var _0xff204d=_0x392914[_0x9e9a('0x1f')],_0x3fd545=_0x2e0d91[_0x9e9a('0x20')],_0x4b0e6a=_0x2e0d91[_0x9e9a('0x20')]+_0x2e0d91[_0x9e9a('0x21')],_0x330cf0;if(_0x4b0e6a>=_0xff204d){_0x4b0e6a=_0xff204d;_0x330cf0=0xc8;}else{_0x330cf0=0xce;}_0xfb2849[_0x9e9a('0x1c')](_0x330cf0);return _0xfb2849['set'](_0x9e9a('0x22'),_0x3fd545+'-'+_0x4b0e6a+'/'+_0xff204d)['json'](_0x392914);}return null;};}function patchUpdates(_0x5c40cb){return function(_0x3028e7){try{jsonpatch[_0x9e9a('0x23')](_0x3028e7,_0x5c40cb,!![]);}catch(_0x22e557){return BPromise[_0x9e9a('0x24')](_0x22e557);}return _0x3028e7[_0x9e9a('0x25')]();};}function saveUpdates(_0xc171ff,_0x81cc47){return function(_0xb6fe1f){if(_0xb6fe1f){return _0xb6fe1f[_0x9e9a('0x26')](_0xc171ff)['then'](function(_0x577c20){return _0x577c20;});}return null;};}function removeEntity(_0xa3a083,_0x4d8066){return function(_0x5acf60){if(_0x5acf60){return _0x5acf60['destroy']()[_0x9e9a('0x27')](function(){_0xa3a083[_0x9e9a('0x1c')](0xcc)[_0x9e9a('0x1d')]();});}};}function handleEntityNotFound(_0x18ae41,_0x317826){return function(_0x1f3d8b){if(!_0x1f3d8b){_0x18ae41['sendStatus'](0x194);}return _0x1f3d8b;};}function handleError(_0x41d582,_0x1d7bff){_0x1d7bff=_0x1d7bff||0x1f4;return function(_0x483ff7){logger['error'](_0x483ff7[_0x9e9a('0x28')]);if(_0x483ff7['name']){delete _0x483ff7['name'];}_0x41d582[_0x9e9a('0x1c')](_0x1d7bff)['send'](_0x483ff7);};}exports[_0x9e9a('0x29')]=function(_0x121811,_0x177d15){var _0x5c9da8={},_0x5f3531={},_0x1336b8={'count':0x0,'rows':[]};var _0x2189cf=_[_0x9e9a('0x2a')](db['ChatTransferReport']['rawAttributes'],function(_0x51899b){return{'name':_0x51899b['fieldName'],'type':_0x51899b[_0x9e9a('0x2b')][_0x9e9a('0x2c')]};});_0x5f3531[_0x9e9a('0x2d')]=_['map'](_0x2189cf,_0x9e9a('0x2e'));_0x5f3531[_0x9e9a('0x2f')]=_[_0x9e9a('0x30')](_0x121811[_0x9e9a('0x2f')]);_0x5f3531[_0x9e9a('0x31')]=_[_0x9e9a('0x32')](_0x5f3531[_0x9e9a('0x2d')],_0x5f3531[_0x9e9a('0x2f')]);_0x5c9da8[_0x9e9a('0x33')]=_[_0x9e9a('0x32')](_0x5f3531[_0x9e9a('0x2d')],qs[_0x9e9a('0x34')](_0x121811[_0x9e9a('0x2f')][_0x9e9a('0x34')]));_0x5c9da8['attributes']=_0x5c9da8[_0x9e9a('0x33')][_0x9e9a('0x35')]?_0x5c9da8['attributes']:_0x5f3531[_0x9e9a('0x2d')];if(!_0x121811[_0x9e9a('0x2f')][_0x9e9a('0x36')](_0x9e9a('0x37'))){_0x5c9da8[_0x9e9a('0x21')]=qs['limit'](_0x121811['query']['limit']);_0x5c9da8[_0x9e9a('0x20')]=qs[_0x9e9a('0x20')](_0x121811[_0x9e9a('0x2f')][_0x9e9a('0x20')]);}_0x5c9da8['order']=qs[_0x9e9a('0x38')](_0x121811[_0x9e9a('0x2f')][_0x9e9a('0x38')]);_0x5c9da8[_0x9e9a('0x39')]=qs[_0x9e9a('0x31')](_[_0x9e9a('0x3a')](_0x121811['query'],_0x5f3531[_0x9e9a('0x31')]),_0x2189cf);if(_0x121811[_0x9e9a('0x2f')][_0x9e9a('0x3b')]){_0x5c9da8[_0x9e9a('0x39')]=_[_0x9e9a('0x3c')](_0x5c9da8[_0x9e9a('0x39')],{'$or':_[_0x9e9a('0x2a')](_0x2189cf,function(_0x508040){if(_0x508040[_0x9e9a('0x2b')]!==_0x9e9a('0x3d')){var _0x4b50c2={};_0x4b50c2[_0x508040[_0x9e9a('0x2e')]]={'$like':'%'+_0x121811[_0x9e9a('0x2f')][_0x9e9a('0x3b')]+'%'};return _0x4b50c2;}})});}_0x5c9da8=_[_0x9e9a('0x3c')]({},_0x5c9da8,_0x121811[_0x9e9a('0x3e')]);var _0x101483={'where':_0x5c9da8[_0x9e9a('0x39')]};return db[_0x9e9a('0x3f')][_0x9e9a('0x1f')](_0x101483)[_0x9e9a('0x27')](function(_0x4ab6d8){_0x1336b8['count']=_0x4ab6d8;if(_0x121811['query'][_0x9e9a('0x40')]){_0x5c9da8[_0x9e9a('0x41')]=[{'all':!![]}];}return db[_0x9e9a('0x3f')]['findAll'](_0x5c9da8);})['then'](function(_0x5f3355){_0x1336b8[_0x9e9a('0x42')]=_0x5f3355;return _0x1336b8;})[_0x9e9a('0x27')](respondWithFilteredResult(_0x177d15,_0x5c9da8))['catch'](handleError(_0x177d15,null));};exports[_0x9e9a('0x43')]=function(_0x3c45c1,_0x92cbe0){var _0x30b9bd={'raw':!![],'where':{'id':_0x3c45c1[_0x9e9a('0x44')]['id']}},_0x24be86={};_0x24be86[_0x9e9a('0x2d')]=_[_0x9e9a('0x30')](db[_0x9e9a('0x3f')][_0x9e9a('0x45')]);_0x24be86[_0x9e9a('0x2f')]=_['keys'](_0x3c45c1[_0x9e9a('0x2f')]);_0x24be86[_0x9e9a('0x31')]=_[_0x9e9a('0x32')](_0x24be86['model'],_0x24be86['query']);_0x30b9bd[_0x9e9a('0x33')]=_['intersection'](_0x24be86[_0x9e9a('0x2d')],qs[_0x9e9a('0x34')](_0x3c45c1[_0x9e9a('0x2f')][_0x9e9a('0x34')]));_0x30b9bd[_0x9e9a('0x33')]=_0x30b9bd[_0x9e9a('0x33')][_0x9e9a('0x35')]?_0x30b9bd['attributes']:_0x24be86[_0x9e9a('0x2d')];if(_0x3c45c1['query'][_0x9e9a('0x40')]){_0x30b9bd[_0x9e9a('0x41')]=[{'all':!![]}];}_0x30b9bd=_[_0x9e9a('0x3c')]({},_0x30b9bd,_0x3c45c1[_0x9e9a('0x3e')]);return db['ChatTransferReport']['find'](_0x30b9bd)['then'](handleEntityNotFound(_0x92cbe0,null))[_0x9e9a('0x27')](respondWithResult(_0x92cbe0,null))[_0x9e9a('0x46')](handleError(_0x92cbe0,null));};exports[_0x9e9a('0x47')]=function(_0x9c1964,_0xaa1755){return db[_0x9e9a('0x3f')][_0x9e9a('0x47')](_0x9c1964[_0x9e9a('0x48')],{})[_0x9e9a('0x27')](respondWithResult(_0xaa1755,0xc9))['catch'](handleError(_0xaa1755,null));};exports['update']=function(_0x2b9e32,_0x11d0de){if(_0x2b9e32['body']['id']){delete _0x2b9e32['body']['id'];}return db[_0x9e9a('0x3f')][_0x9e9a('0x49')]({'where':{'id':_0x2b9e32[_0x9e9a('0x44')]['id']}})['then'](handleEntityNotFound(_0x11d0de,null))[_0x9e9a('0x27')](saveUpdates(_0x2b9e32['body'],null))[_0x9e9a('0x27')](respondWithResult(_0x11d0de,null))[_0x9e9a('0x46')](handleError(_0x11d0de,null));};exports[_0x9e9a('0x4a')]=function(_0x145d10,_0x217fd1){return db[_0x9e9a('0x3f')][_0x9e9a('0x49')]({'where':{'id':_0x145d10[_0x9e9a('0x44')]['id']}})['then'](handleEntityNotFound(_0x217fd1,null))[_0x9e9a('0x27')](removeEntity(_0x217fd1,null))['catch'](handleError(_0x217fd1,null));};exports[_0x9e9a('0x4b')]=function(_0x5d708d,_0x52ade3){return db['ChatTransferReport']['describe']()[_0x9e9a('0x27')](respondWithResult(_0x52ade3,null))[_0x9e9a('0x46')](handleError(_0x52ade3,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3f9293f..878a7b0 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 _0x6828=['exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x2b1b1b,_0x28a22f){var _0x525975=function(_0x377618){while(--_0x377618){_0x2b1b1b['push'](_0x2b1b1b['shift']());}};_0x525975(++_0x28a22f);}(_0x6828,0xe6));var _0x8682=function(_0x1c4a61,_0x4a2338){_0x1c4a61=_0x1c4a61-0x0;var _0xcd27df=_0x6828[_0x1c4a61];return _0xcd27df;};'use strict';var _=require(_0x8682('0x0'));var util=require(_0x8682('0x1'));var logger=require(_0x8682('0x2'))(_0x8682('0x3'));var moment=require('moment');var BPromise=require(_0x8682('0x4'));var rp=require(_0x8682('0x5'));var fs=require('fs');var path=require(_0x8682('0x6'));var rimraf=require(_0x8682('0x7'));var config=require(_0x8682('0x8'));var attributes=require(_0x8682('0x9'));module[_0x8682('0xa')]=function(_0x13c75a,_0x1c0055){return _0x13c75a[_0x8682('0xb')](_0x8682('0xc'),attributes,{'tableName':_0x8682('0xd'),'paranoid':![],'indexes':[{'name':_0x8682('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xabbe=['report_chat_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','ChatTransferReport'];(function(_0x647476,_0x3926fb){var _0x81464f=function(_0x21b0f0){while(--_0x21b0f0){_0x647476['push'](_0x647476['shift']());}};_0x81464f(++_0x3926fb);}(_0xabbe,0x70));var _0xeabb=function(_0x3159c6,_0x57c4ef){_0x3159c6=_0x3159c6-0x0;var _0x4dcab2=_0xabbe[_0x3159c6];return _0x4dcab2;};'use strict';var _=require(_0xeabb('0x0'));var util=require('util');var logger=require(_0xeabb('0x1'))('api');var moment=require(_0xeabb('0x2'));var BPromise=require(_0xeabb('0x3'));var rp=require(_0xeabb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeabb('0x5'));var attributes=require(_0xeabb('0x6'));module['exports']=function(_0xfb506,_0x3cb3a4){return _0xfb506['define'](_0xeabb('0x7'),attributes,{'tableName':_0xeabb('0x8'),'paranoid':![],'indexes':[{'name':_0xeabb('0x9'),'fields':[_0xeabb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d8fb078..55a0ed0 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 _0xa28c=['request\x20sent','debug','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa28c,0x14a));var _0xca28=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xa28c[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xca28('0x0'));var util=require('util');var moment=require(_0xca28('0x1'));var BPromise=require(_0xca28('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca28('0x3'));var db=require(_0xca28('0x4'))['db'];var utils=require(_0xca28('0x5'));var logger=require(_0xca28('0x6'))('rpc');var config=require(_0xca28('0x7'));var jayson=require(_0xca28('0x8'));var client=jayson[_0xca28('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba840e,_0x3d793f,_0x10f88d){return new BPromise(function(_0x4327a3,_0xfebb83){return client['request'](_0xba840e,_0x10f88d)['then'](function(_0xd7025e){logger[_0xca28('0xa')](_0xca28('0xb'),_0x3d793f,_0xca28('0xc'));logger[_0xca28('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x3d793f,_0xca28('0xc'),JSON[_0xca28('0xe')](_0xd7025e));if(_0xd7025e[_0xca28('0xf')]){if(_0xd7025e[_0xca28('0xf')][_0xca28('0x10')]===0x1f4){logger[_0xca28('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x3d793f,_0xd7025e[_0xca28('0xf')][_0xca28('0x11')]);return _0xfebb83(_0xd7025e[_0xca28('0xf')][_0xca28('0x11')]);}logger[_0xca28('0xf')](_0xca28('0xb'),_0x3d793f,_0xd7025e[_0xca28('0xf')][_0xca28('0x11')]);return _0x4327a3(_0xd7025e['error'][_0xca28('0x11')]);}else{logger['info'](_0xca28('0xb'),_0x3d793f,'request\x20sent');_0x4327a3(_0xd7025e['result'][_0xca28('0x11')]);}})['catch'](function(_0x4a4bb5){logger[_0xca28('0xf')](_0xca28('0xb'),_0x3d793f,_0x4a4bb5);_0xfebb83(_0x4a4bb5);});});} \ No newline at end of file +var _0xfbf1=['request\x20sent','debug','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0xfbf1,0xe5));var _0x1fbf=function(_0x1f2332,_0x1f851c){_0x1f2332=_0x1f2332-0x0;var _0x9c4cd6=_0xfbf1[_0x1f2332];return _0x9c4cd6;};'use strict';var _=require(_0x1fbf('0x0'));var util=require(_0x1fbf('0x1'));var moment=require(_0x1fbf('0x2'));var BPromise=require(_0x1fbf('0x3'));var rs=require(_0x1fbf('0x4'));var fs=require('fs');var Redis=require(_0x1fbf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fbf('0x6'));var logger=require('../../config/logger')(_0x1fbf('0x7'));var config=require(_0x1fbf('0x8'));var jayson=require(_0x1fbf('0x9'));var client=jayson[_0x1fbf('0xa')][_0x1fbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x195a89,_0x4680d0,_0x10ebb8){return new BPromise(function(_0x3fe081,_0x1abfad){return client['request'](_0x195a89,_0x10ebb8)[_0x1fbf('0xc')](function(_0x18d9e1){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4680d0,_0x1fbf('0xd'));logger[_0x1fbf('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4680d0,_0x1fbf('0xd'),JSON[_0x1fbf('0xf')](_0x18d9e1));if(_0x18d9e1[_0x1fbf('0x10')]){if(_0x18d9e1[_0x1fbf('0x10')][_0x1fbf('0x11')]===0x1f4){logger[_0x1fbf('0x10')](_0x1fbf('0x12'),_0x4680d0,_0x18d9e1[_0x1fbf('0x10')]['message']);return _0x1abfad(_0x18d9e1[_0x1fbf('0x10')][_0x1fbf('0x13')]);}logger[_0x1fbf('0x10')](_0x1fbf('0x12'),_0x4680d0,_0x18d9e1[_0x1fbf('0x10')][_0x1fbf('0x13')]);return _0x3fe081(_0x18d9e1[_0x1fbf('0x10')]['message']);}else{logger['info'](_0x1fbf('0x12'),_0x4680d0,_0x1fbf('0xd'));_0x3fe081(_0x18d9e1[_0x1fbf('0x14')][_0x1fbf('0x13')]);}})[_0x1fbf('0x15')](function(_0x214789){logger[_0x1fbf('0x10')](_0x1fbf('0x12'),_0x4680d0,_0x214789);_0x1abfad(_0x214789);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9d933ef..211b827 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(_0x4b6470,_0x5d7257){var _0x5679f0=function(_0x4d3024){while(--_0x4d3024){_0x4b6470['push'](_0x4b6470['shift']());}};_0x5679f0(++_0x5d7257);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x757a,0xde));var _0xa757=function(_0x179728,_0x322682){_0x179728=_0x179728-0x0;var _0x18bb69=_0x757a[_0x179728];return _0x18bb69;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index c80db8a..b987a45 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 _0x6753=['bottom_right','alternate','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','text','name','input','getDataValue','onlineForm','parse','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6753,0xa1));var _0x3675=function(_0x11b39e,_0x5d7e04){_0x11b39e=_0x11b39e-0x0;var _0x4a8729=_0x6753[_0x11b39e];return _0x4a8729;};'use strict';var Sequelize=require(_0x3675('0x0'));var rs=require(_0x3675('0x1'));module[_0x3675('0x2')]={'name':{'type':Sequelize[_0x3675('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3675('0x4')},'description':{'type':Sequelize[_0x3675('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x6')},'customerAlias':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':_0x3675('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':_0x3675('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':_0x3675('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3675('0x3')]},'animation':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3675('0xb')](_0x3675('0xc'),_0x3675('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0xe')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0xf')},'offline_chat_button':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x10')},'header_offline':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x11')},'download_transcript':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3675('0x13')]},'closingQuestion':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x15')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x16')},'placeholderMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x17')},'closingMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x18')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x10')},'skipMessageButton':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x3675('0xb')](_0x3675('0x19'),_0x3675('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3675('0x13')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0x3675('0x1b'),'required':!![]},'props':{'title':_0x3675('0x1c'),'helpText':''}},{'type':_0x3675('0x1d'),'props':{'title':_0x3675('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3675('0x5'),'type':_0x3675('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3675('0x1e')](_0x3675('0x1f'))?JSON[_0x3675('0x20')](this[_0x3675('0x1e')](_0x3675('0x1f'))):{};},'set':function(_0x53f77e){return this['setDataValue'](_0x3675('0x1f'),JSON[_0x3675('0x21')](_0x53f77e));}},'offlineForm':{'type':Sequelize[_0x3675('0x13')],'defaultValue':function(){return JSON[_0x3675('0x21')]({'items':[{'type':_0x3675('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x3675('0x22'),'config':{'placeholder':_0x3675('0x23')},'props':{'title':'Comments','helpText':_0x3675('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x3675('0x1e')](_0x3675('0x25'))?JSON[_0x3675('0x20')](this['getDataValue']('offlineForm')):{};},'set':function(_0x3ab457){return this['setDataValue'](_0x3675('0x25'),JSON[_0x3675('0x21')](_0x3ab457));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3675('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3675('0x3')]},'forwardOffline':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x27')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x2c')},'sendUnmanaged':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3675('0x13')]},'showAgentAvatar':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3675('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3675('0x13')],'defaultValue':function(){return _0x3675('0x2d');}},'notificationSound':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x2f')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x30')},'defaultTitle':{'type':Sequelize[_0x3675('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3675('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3675('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x3675('0x13')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![],'comment':_0x3675('0x31'),'set':function(_0x11f775){if(!_0x11f775)this[_0x3675('0x32')]('mandatoryDispositionPauseId',null);this[_0x3675('0x32')](_0x3675('0x33'),_0x11f775);}},'vidaooEscalation':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3675('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdd0c=['website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback','star','stringify','name','text','getDataValue','onlineForm','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4b342e,_0x425550){var _0x42e1cd=function(_0x3df952){while(--_0x3df952){_0x4b342e['push'](_0x4b342e['shift']());}};_0x42e1cd(++_0x425550);}(_0xdd0c,0x165));var _0xcdd0=function(_0x3fd753,_0xaf070f){_0x3fd753=_0x3fd753-0x0;var _0x38a49d=_0xdd0c[_0x3fd753];return _0x38a49d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcdd0('0x0'));module[_0xcdd0('0x1')]={'name':{'type':Sequelize[_0xcdd0('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcdd0('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x4')},'mapKeyOffline':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x4')},'key':{'type':Sequelize[_0xcdd0('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xcdd0('0x5')},'customerAlias':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xcdd0('0x2')],'allowNull':![],'defaultValue':_0xcdd0('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xcdd0('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcdd0('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xcdd0('0x2')]},'animation':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcdd0('0x8')](_0xcdd0('0x9'),_0xcdd0('0xa')),'defaultValue':_0xcdd0('0x9')},'header_online':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0xb')},'start_chat_button':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcdd0('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xcdd0('0xf')]},'closingQuestion':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcdd0('0x11')},'noteTitle':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x12')},'placeholderMessage':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x13')},'closingMessage':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x14')},'closingMessageButton':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x15')},'skipMessageButton':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0xcdd0('0x17'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xcdd0('0xf')],'defaultValue':function(){return JSON[_0xcdd0('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xcdd0('0x19'),'type':_0xcdd0('0x1a'),'required':!![]},'props':{'title':_0xcdd0('0x19'),'helpText':''}},{'type':'input','props':{'title':_0xcdd0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xcdd0('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xcdd0('0x1b')](_0xcdd0('0x1c'))?JSON['parse'](this[_0xcdd0('0x1b')]('onlineForm')):{};},'set':function(_0x3797c2){return this[_0xcdd0('0x1d')](_0xcdd0('0x1c'),JSON['stringify'](_0x3797c2));}},'offlineForm':{'type':Sequelize[_0xcdd0('0xf')],'defaultValue':function(){return JSON[_0xcdd0('0x18')]({'items':[{'type':_0xcdd0('0x1e'),'props':{'title':_0xcdd0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xcdd0('0x4'),'type':_0xcdd0('0x4')},'variable':null},{'type':_0xcdd0('0x1f'),'config':{'placeholder':_0xcdd0('0x20')},'props':{'title':_0xcdd0('0x20'),'helpText':_0xcdd0('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xcdd0('0x1b')]('offlineForm')?JSON[_0xcdd0('0x22')](this[_0xcdd0('0x1b')](_0xcdd0('0x23'))):{};},'set':function(_0x5b8635){return this[_0xcdd0('0x1d')](_0xcdd0('0x23'),JSON[_0xcdd0('0x18')](_0x5b8635));}},'token':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':function(){return rs[_0xcdd0('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xcdd0('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x25')},'waitingMessage':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xcdd0('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xcdd0('0x29')},'sendUnmanaged':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xcdd0('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xcdd0('0xf')],'defaultValue':function(){return _0xcdd0('0x2a');}},'notificationSound':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xcdd0('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xcdd0('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':_0xcdd0('0x2c')},'defaultTitle':{'type':Sequelize[_0xcdd0('0x2')]},'customerAvatar':{'type':Sequelize[_0xcdd0('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xcdd0('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcdd0('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcdd0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xcdd0('0x2e')},'systemAvatar':{'type':Sequelize[_0xcdd0('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xcdd0('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x321223){if(!_0x321223)this['setDataValue'](_0xcdd0('0x30'),null);this['setDataValue'](_0xcdd0('0x31'),_0x321223);}},'vidaooEscalation':{'type':Sequelize[_0xcdd0('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xcdd0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0a5b8d5..5d74ad9 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 _0xb83d=['systemAvatar','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','ValidationError','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','account','applications','Applications','list','priority','Contacts','defaults','customerIp','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','forcedOwnership','Start','EventManager','offline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','OFFLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','x-forwarded-for','x-real-ip','replace','render','textColor','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','User','eml-format','zip-dir','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','redis','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','fields','options','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','describe','findOne','Disposition','order','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png'];(function(_0x48fa89,_0x40bb61){var _0x1d9aeb=function(_0x1e9ce6){while(--_0x1e9ce6){_0x48fa89['push'](_0x48fa89['shift']());}};_0x1d9aeb(++_0x40bb61);}(_0xb83d,0x98));var _0xdb83=function(_0x222e2d,_0x1036b6){_0x222e2d=_0x222e2d-0x0;var _0x2f0355=_0xb83d[_0x222e2d];return _0x2f0355;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdb83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb83('0x2'));var Mustache=require('mustache');var util=require(_0xdb83('0x3'));var path=require(_0xdb83('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb83('0x5'));var fs=require('fs');var _=require(_0xdb83('0x6'));var squel=require('squel');var crypto=require(_0xdb83('0x7'));var jsforce=require(_0xdb83('0x8'));var deskjs=require(_0xdb83('0x9'));var toCsv=require(_0xdb83('0xa'));var querystring=require(_0xdb83('0xb'));var Papa=require('papaparse');var Redis=require(_0xdb83('0xc'));var authService=require(_0xdb83('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xdb83('0xe'));var hardwareService=require(_0xdb83('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdb83('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdb83('0x11')]=_['defaults'](config[_0xdb83('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb83('0x12'))(new Redis(config[_0xdb83('0x11')]));require(_0xdb83('0x13'))[_0xdb83('0x14')](socket);var jayson=require(_0xdb83('0x15'));var client=jayson[_0xdb83('0x16')][_0xdb83('0x17')]({'port':0x232c});var client9002=jayson[_0xdb83('0x16')][_0xdb83('0x17')]({'port':0x232a});var client9003=jayson[_0xdb83('0x16')][_0xdb83('0x17')]({'port':0x232b});function respondWithRpcPromise(_0x4bc8c0,_0x19fdaa,_0xe0b672,_0x2cc09d){return new BPromise(function(_0x846f78,_0x3df609){var _0x494aa0=_0x2cc09d||client;return _0x494aa0[_0xdb83('0x18')](_0x4bc8c0,_0xe0b672)[_0xdb83('0x19')](function(_0x5932e2){logger['info'](_0xdb83('0x1a'),_0x19fdaa,'request\x20sent');logger['debug'](_0xdb83('0x1b'),_0x19fdaa,_0xdb83('0x1c'),JSON[_0xdb83('0x1d')](_0x5932e2));if(_0x5932e2[_0xdb83('0x1e')]){if(_0x5932e2[_0xdb83('0x1e')][_0xdb83('0x1f')]===0x1f4){logger[_0xdb83('0x1e')](_0xdb83('0x1a'),_0x19fdaa,_0x5932e2[_0xdb83('0x1e')][_0xdb83('0x20')]);return _0x3df609(_0x5932e2[_0xdb83('0x1e')][_0xdb83('0x20')]);}logger[_0xdb83('0x1e')](_0xdb83('0x1a'),_0x19fdaa,_0x5932e2[_0xdb83('0x1e')]['message']);return _0x846f78(_0x5932e2[_0xdb83('0x1e')]['message']);}else{logger[_0xdb83('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x19fdaa,_0xdb83('0x1c'));_0x846f78(_0x5932e2['result']['message']);}})[_0xdb83('0x22')](function(_0x450570){logger[_0xdb83('0x1e')](_0xdb83('0x1a'),_0x19fdaa,_0x450570);_0x3df609(_0x450570);});});}function respondWithStatusCode(_0x5d918e,_0x5e1a0f){_0x5e1a0f=_0x5e1a0f||0xcc;return function(_0x123c1b){if(_0x123c1b){return _0x5d918e[_0xdb83('0x23')](_0x5e1a0f);}return _0x5d918e[_0xdb83('0x24')](_0x5e1a0f)[_0xdb83('0x25')]();};}function respondWithResult(_0x33262d,_0x160e00){_0x160e00=_0x160e00||0xc8;return function(_0x30bab5){if(_0x30bab5){return _0x33262d[_0xdb83('0x24')](_0x160e00)[_0xdb83('0x26')](_0x30bab5);}};}function respondWithFilteredResult(_0x1bb9ba,_0x2b039b){return function(_0x10a327){if(_0x10a327){var _0x277de1=_0x10a327[_0xdb83('0x27')],_0x5241e1=_0x2b039b[_0xdb83('0x28')],_0x535b21=_0x2b039b[_0xdb83('0x28')]+_0x2b039b['limit'],_0x2f7e0c;if(_0x535b21>=_0x277de1){_0x535b21=_0x277de1;_0x2f7e0c=0xc8;}else{_0x2f7e0c=0xce;}_0x1bb9ba['status'](_0x2f7e0c);return _0x1bb9ba['set'](_0xdb83('0x29'),_0x5241e1+'-'+_0x535b21+'/'+_0x277de1)[_0xdb83('0x26')](_0x10a327);}return null;};}function patchUpdates(_0x433493){return function(_0x57d50e){try{jsonpatch[_0xdb83('0x2a')](_0x57d50e,_0x433493,!![]);}catch(_0x455ab5){return BPromise['reject'](_0x455ab5);}return _0x57d50e[_0xdb83('0x2b')]();};}function saveUpdates(_0x4fcf56,_0x2590d7){return function(_0xd734c){if(_0xd734c){return _0xd734c[_0xdb83('0x2c')](_0x4fcf56)[_0xdb83('0x19')](function(_0x50562e){return _0x50562e;});}return null;};}function removeEntity(_0x3e8111,_0x2c2848){return function(_0x47d450){if(_0x47d450){return _0x47d450[_0xdb83('0x2d')]()[_0xdb83('0x19')](function(){var _0x1e6985=_0x47d450[_0xdb83('0x2e')]({'plain':!![]});var _0x35e178=_0xdb83('0x2f');return db[_0xdb83('0x30')][_0xdb83('0x2d')]({'where':{'type':_0x35e178,'resourceId':_0x1e6985['id']}})[_0xdb83('0x19')](function(){return _0x47d450;});})[_0xdb83('0x19')](function(){_0x3e8111[_0xdb83('0x24')](0xcc)[_0xdb83('0x25')]();});}};}function handleEntityNotFound(_0xc71490,_0x422786){return function(_0x16d1f1){if(!_0x16d1f1){_0xc71490[_0xdb83('0x23')](0x194);}return _0x16d1f1;};}function handleError(_0x1e972c,_0x40d0ca){_0x40d0ca=_0x40d0ca||0x1f4;return function(_0x1cdf9c){logger['error'](_0x1cdf9c['stack']);if(_0x1cdf9c[_0xdb83('0x31')]){delete _0x1cdf9c[_0xdb83('0x31')];}_0x1e972c['status'](_0x40d0ca)['send'](_0x1cdf9c);};}exports[_0xdb83('0x32')]=function(_0x59050d,_0x3ae760){var _0xb1de11={'include':[{'model':db[_0xdb83('0x33')],'as':_0xdb83('0x34')}]},_0x1f53bc={},_0x20947a={'count':0x0,'rows':[]};var _0x374934=_[_0xdb83('0x35')](db[_0xdb83('0x36')]['rawAttributes'],function(_0x3336a8){return{'name':_0x3336a8[_0xdb83('0x37')],'type':_0x3336a8[_0xdb83('0x38')][_0xdb83('0x39')]};});_0x1f53bc[_0xdb83('0x3a')]=_[_0xdb83('0x35')](_0x374934,_0xdb83('0x31'));_0x1f53bc[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x59050d[_0xdb83('0x3b')]);_0x1f53bc[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x1f53bc[_0xdb83('0x3a')],_0x1f53bc[_0xdb83('0x3b')]);_0xb1de11[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x1f53bc['model'],qs['fields'](_0x59050d[_0xdb83('0x3b')]['fields']));_0xb1de11[_0xdb83('0x3f')]=_0xb1de11[_0xdb83('0x3f')][_0xdb83('0x40')]?_0xb1de11[_0xdb83('0x3f')]:_0x1f53bc[_0xdb83('0x3a')];if(!_0x59050d[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0xb1de11[_0xdb83('0x43')]=qs['limit'](_0x59050d[_0xdb83('0x3b')]['limit']);_0xb1de11[_0xdb83('0x28')]=qs['offset'](_0x59050d[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0xb1de11['order']=qs[_0xdb83('0x44')](_0x59050d['query'][_0xdb83('0x44')]);_0xb1de11[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x59050d[_0xdb83('0x3b')],_0x1f53bc[_0xdb83('0x3d')]),_0x374934);if(_0x59050d[_0xdb83('0x3b')][_0xdb83('0x47')]){_0xb1de11[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0xb1de11[_0xdb83('0x45')],{'$or':_['map'](_0x374934,function(_0x917915){if(_0x917915['type']!==_0xdb83('0x49')){var _0x52ace8={};_0x52ace8[_0x917915[_0xdb83('0x31')]]={'$like':'%'+_0x59050d[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x52ace8;}})});}_0xb1de11=_['merge']({},_0xb1de11,_0x59050d['options']);var _0x51fe7c={'where':_0xb1de11[_0xdb83('0x45')]};return db[_0xdb83('0x36')][_0xdb83('0x27')](_0x51fe7c)['then'](function(_0x315de2){_0x20947a['count']=_0x315de2;if(_0x59050d[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0xb1de11[_0xdb83('0x4b')]=[{'all':!![]}];}return db[_0xdb83('0x36')][_0xdb83('0x4c')](_0xb1de11);})['then'](function(_0x360fb4){_0x20947a['rows']=_0x360fb4;return _0x20947a;})[_0xdb83('0x19')](respondWithFilteredResult(_0x3ae760,_0xb1de11))[_0xdb83('0x22')](handleError(_0x3ae760,null));};exports[_0xdb83('0x4d')]=function(_0x4bcbe1,_0x230c1a){var _0x1d1add={'raw':![],'where':{'id':_0x4bcbe1[_0xdb83('0x4e')]['id']},'include':[{'model':db['Pause'],'as':_0xdb83('0x34')}]},_0x29d96c={};_0x29d96c['model']=_[_0xdb83('0x3c')](db[_0xdb83('0x36')][_0xdb83('0x4f')]);_0x29d96c['query']=_[_0xdb83('0x3c')](_0x4bcbe1[_0xdb83('0x3b')]);_0x29d96c[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x29d96c[_0xdb83('0x3a')],_0x29d96c['query']);_0x1d1add[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x29d96c[_0xdb83('0x3a')],qs['fields'](_0x4bcbe1[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x1d1add[_0xdb83('0x3f')]=_0x1d1add[_0xdb83('0x3f')]['length']?_0x1d1add[_0xdb83('0x3f')]:_0x29d96c[_0xdb83('0x3a')];if(_0x4bcbe1['query'][_0xdb83('0x4a')]){_0x1d1add[_0xdb83('0x4b')]=[{'all':!![]}];}_0x1d1add=_[_0xdb83('0x48')]({},_0x1d1add,_0x4bcbe1[_0xdb83('0x51')]);return db['ChatWebsite'][_0xdb83('0x52')](_0x1d1add)[_0xdb83('0x19')](handleEntityNotFound(_0x230c1a,null))[_0xdb83('0x19')](respondWithResult(_0x230c1a,null))[_0xdb83('0x22')](handleError(_0x230c1a,null));};exports[_0xdb83('0x53')]=function(_0xaee0c,_0x486e89){return db['ChatWebsite'][_0xdb83('0x53')](_0xaee0c[_0xdb83('0x54')],{})[_0xdb83('0x19')](function(_0x171193){var _0x3b78c9=_0xaee0c[_0xdb83('0x55')]['get']({'plain':!![]});if(!_0x3b78c9)throw new Error(_0xdb83('0x56'));if(_0x3b78c9[_0xdb83('0x57')]===_0xdb83('0x55')){var _0x19d844=_0x171193[_0xdb83('0x2e')]({'plain':!![]});var _0x4db11f=_0xdb83('0x2f');return db[_0xdb83('0x58')][_0xdb83('0x52')]({'where':{'name':_0x4db11f,'userProfileId':_0x3b78c9[_0xdb83('0x59')]},'raw':!![]})['then'](function(_0x1632f8){if(_0x1632f8&&_0x1632f8[_0xdb83('0x5a')]===0x0){return db[_0xdb83('0x30')][_0xdb83('0x53')]({'name':_0x19d844[_0xdb83('0x31')],'resourceId':_0x19d844['id'],'type':_0x1632f8[_0xdb83('0x31')],'sectionId':_0x1632f8['id']},{})['then'](function(){return _0x171193;});}else{return _0x171193;}})[_0xdb83('0x22')](function(_0x10000b){logger[_0xdb83('0x1e')](_0xdb83('0x5b'),_0x10000b);throw _0x10000b;});}return _0x171193;})[_0xdb83('0x19')](respondWithResult(_0x486e89,0xc9))['catch'](handleError(_0x486e89,null));};exports['update']=function(_0x47f387,_0x1efff8){if(_0x47f387[_0xdb83('0x54')]['id']){delete _0x47f387[_0xdb83('0x54')]['id'];}return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x47f387[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0x33')],'as':_0xdb83('0x34')}]})['then'](handleEntityNotFound(_0x1efff8,null))[_0xdb83('0x19')](saveUpdates(_0x47f387[_0xdb83('0x54')],null))[_0xdb83('0x19')](respondWithResult(_0x1efff8,null))['catch'](handleError(_0x1efff8,null));};exports[_0xdb83('0x2d')]=function(_0x3254dc,_0x416b1d){return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x3254dc[_0xdb83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x416b1d,null))[_0xdb83('0x19')](removeEntity(_0x416b1d,null))['catch'](handleError(_0x416b1d,null));};exports[_0xdb83('0x5c')]=function(_0x4640ec,_0x9b2023){return db[_0xdb83('0x36')][_0xdb83('0x5c')]()[_0xdb83('0x19')](respondWithResult(_0x9b2023,null))['catch'](handleError(_0x9b2023,null));};exports['addDisposition']=function(_0x14d9fa,_0x297317,_0xde890c){if(_0x14d9fa[_0xdb83('0x54')]['id']){delete _0x14d9fa[_0xdb83('0x54')]['id'];}return db[_0xdb83('0x36')]['find']({'where':{'id':_0x14d9fa[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x297317,null))[_0xdb83('0x19')](function(_0x4d09e0){if(_0x4d09e0){_0x14d9fa[_0xdb83('0x54')]['ChatWebsiteId']=_0x4d09e0['id'];return db['Disposition'][_0xdb83('0x53')](_0x14d9fa[_0xdb83('0x54')]);}})[_0xdb83('0x19')](respondWithResult(_0x297317,null))[_0xdb83('0x22')](handleError(_0x297317,null));};exports['getDispositions']=function(_0x7950d8,_0x2f6710,_0x371f4a){var _0x30d895={'raw':![],'where':{}};var _0x42555d={};var _0xfa4da7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdb83('0x5d')]({'where':{'id':_0x7950d8['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x2f6710,null))['then'](function(_0x5a208b){if(_0x5a208b){_0x42555d[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db[_0xdb83('0x5e')][_0xdb83('0x4f')]);_0x42555d[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x7950d8['query']);_0x42555d[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x42555d['model'],_0x42555d[_0xdb83('0x3b')]);_0x30d895[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x42555d[_0xdb83('0x3a')],qs[_0xdb83('0x50')](_0x7950d8[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x30d895['attributes']=_0x30d895['attributes'][_0xdb83('0x40')]?_0x30d895[_0xdb83('0x3f')]:_0x42555d[_0xdb83('0x3a')];if(!_0x7950d8[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0x30d895[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x7950d8[_0xdb83('0x3b')]['limit']);_0x30d895[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x7950d8['query'][_0xdb83('0x28')]);}_0x30d895[_0xdb83('0x5f')]=qs[_0xdb83('0x44')](_0x7950d8[_0xdb83('0x3b')]['sort']);_0x30d895[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x7950d8[_0xdb83('0x3b')],_0x42555d[_0xdb83('0x3d')]));_0x30d895[_0xdb83('0x45')][_0xdb83('0x60')]=_0x5a208b['id'];if(_0x7950d8['query']['filter']){_0x30d895[_0xdb83('0x45')]=_['merge'](_0x30d895[_0xdb83('0x45')],{'$or':_['map'](_0x30d895['attributes'],function(_0x1bb252){var _0x56e18c={};_0x56e18c[_0x1bb252]={'$like':'%'+_0x7950d8[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x56e18c;})});}_0x30d895=_[_0xdb83('0x48')]({},_0x30d895,_0x7950d8[_0xdb83('0x51')]);return db[_0xdb83('0x5e')][_0xdb83('0x27')]({'where':_0x30d895[_0xdb83('0x45')]})[_0xdb83('0x19')](function(_0x4d4903){_0xfa4da7[_0xdb83('0x27')]=_0x4d4903;if(_0x7950d8[_0xdb83('0x3b')]['includeAll']){_0x30d895[_0xdb83('0x4b')]=[{'all':!![]}];}return db[_0xdb83('0x5e')][_0xdb83('0x4c')](_0x30d895);})[_0xdb83('0x19')](function(_0x3fbb4e){_0xfa4da7[_0xdb83('0x61')]=_0x3fbb4e;return _0xfa4da7;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x2f6710,_0x30d895))[_0xdb83('0x22')](handleError(_0x2f6710,null));};exports[_0xdb83('0x62')]=function(_0x59ce90,_0x26c92e,_0x59ddc9){return db['ChatWebsite']['find']({'where':{'id':_0x59ce90[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x26c92e,null))[_0xdb83('0x19')](function(_0xb6577d){if(_0xb6577d){return _0xb6577d[_0xdb83('0x62')](_0x59ce90[_0xdb83('0x3b')][_0xdb83('0x63')]);}})['then'](respondWithStatusCode(_0x26c92e,null))['catch'](handleError(_0x26c92e,null));};exports[_0xdb83('0x64')]=function(_0x358178,_0x2d0bc8,_0x497539){if(_0x358178[_0xdb83('0x54')]['id']){delete _0x358178[_0xdb83('0x54')]['id'];}return db[_0xdb83('0x36')]['find']({'where':{'id':_0x358178['params']['id']}})['then'](handleEntityNotFound(_0x2d0bc8,null))[_0xdb83('0x19')](function(_0xc3f6c){if(_0xc3f6c){_0x358178[_0xdb83('0x54')][_0xdb83('0x60')]=_0xc3f6c['id'];return db[_0xdb83('0x65')][_0xdb83('0x53')](_0x358178[_0xdb83('0x54')]);}})[_0xdb83('0x19')](respondWithResult(_0x2d0bc8,null))['catch'](handleError(_0x2d0bc8,null));};exports[_0xdb83('0x66')]=function(_0x414d66,_0x1952c4,_0x2bec29){var _0x4429f4={'raw':![],'where':{}};var _0x86697e={};var _0x47a4e6={'count':0x0,'rows':[]};return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x414d66[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x1952c4,null))[_0xdb83('0x19')](function(_0x450962){if(_0x450962){_0x86697e[_0xdb83('0x3a')]=_['keys'](db[_0xdb83('0x65')][_0xdb83('0x4f')]);_0x86697e['query']=_[_0xdb83('0x3c')](_0x414d66[_0xdb83('0x3b')]);_0x86697e[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x86697e[_0xdb83('0x3a')],_0x86697e['query']);_0x4429f4[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x86697e[_0xdb83('0x3a')],qs[_0xdb83('0x50')](_0x414d66[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x4429f4[_0xdb83('0x3f')]=_0x4429f4[_0xdb83('0x3f')]['length']?_0x4429f4[_0xdb83('0x3f')]:_0x86697e[_0xdb83('0x3a')];if(!_0x414d66['query']['hasOwnProperty'](_0xdb83('0x42'))){_0x4429f4[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x414d66[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x4429f4[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x414d66[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0x4429f4['order']=qs[_0xdb83('0x44')](_0x414d66['query'][_0xdb83('0x44')]);_0x4429f4['where']=qs['filters'](_[_0xdb83('0x46')](_0x414d66[_0xdb83('0x3b')],_0x86697e[_0xdb83('0x3d')]));_0x4429f4[_0xdb83('0x45')][_0xdb83('0x60')]=_0x450962['id'];if(_0x414d66[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x4429f4[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x4429f4[_0xdb83('0x45')],{'$or':_[_0xdb83('0x35')](_0x4429f4[_0xdb83('0x3f')],function(_0x1d7e8c){var _0xa72152={};_0xa72152[_0x1d7e8c]={'$like':'%'+_0x414d66[_0xdb83('0x3b')]['filter']+'%'};return _0xa72152;})});}_0x4429f4=_['merge']({},_0x4429f4,_0x414d66[_0xdb83('0x51')]);return db['CannedAnswer'][_0xdb83('0x27')]({'where':_0x4429f4[_0xdb83('0x45')]})[_0xdb83('0x19')](function(_0x130697){_0x47a4e6[_0xdb83('0x27')]=_0x130697;if(_0x414d66[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0x4429f4['include']=[{'all':!![]}];}return db[_0xdb83('0x65')][_0xdb83('0x4c')](_0x4429f4);})['then'](function(_0x14ab40){_0x47a4e6[_0xdb83('0x61')]=_0x14ab40;return _0x47a4e6;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x1952c4,_0x4429f4))[_0xdb83('0x22')](handleError(_0x1952c4,null));};exports[_0xdb83('0x67')]=function(_0x40ba72,_0x24bc38,_0xb4af2e){return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x40ba72[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x24bc38,null))[_0xdb83('0x19')](function(_0x31d937){if(_0x31d937){return _0x31d937[_0xdb83('0x67')](_0x40ba72[_0xdb83('0x3b')][_0xdb83('0x63')]);}})[_0xdb83('0x19')](respondWithStatusCode(_0x24bc38,null))['catch'](handleError(_0x24bc38,null));};exports[_0xdb83('0x68')]=function(_0x31fb12,_0x279fbb,_0x1c4f00){_0x31fb12[_0xdb83('0x54')][_0xdb83('0x69')]=_0x31fb12[_0xdb83('0x6a')][_0xdb83('0x6b')];return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x31fb12[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x279fbb,null))[_0xdb83('0x19')](saveUpdates(_0x31fb12[_0xdb83('0x54')],null))['then'](respondWithResult(_0x279fbb,null))[_0xdb83('0x22')](handleError(_0x279fbb,null));};exports[_0xdb83('0x6c')]=function(_0x226728,_0x45a504,_0x8ba3b3){_0x226728[_0xdb83('0x54')][_0xdb83('0x6d')]=_0x226728[_0xdb83('0x6a')]['filename'];return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x226728['params']['id']}})['then'](handleEntityNotFound(_0x45a504,null))[_0xdb83('0x19')](saveUpdates(_0x226728['body'],null))[_0xdb83('0x19')](respondWithResult(_0x45a504,null))[_0xdb83('0x22')](handleError(_0x45a504,null));};exports[_0xdb83('0x6e')]=function(_0x26d83f,_0x363d0d,_0x2d8328){_0x26d83f['body'][_0xdb83('0x6f')]=_0x26d83f['file'][_0xdb83('0x6b')];return db['ChatWebsite'][_0xdb83('0x52')]({'where':{'id':_0x26d83f[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x363d0d,null))[_0xdb83('0x19')](saveUpdates(_0x26d83f['body'],null))[_0xdb83('0x19')](respondWithResult(_0x363d0d,null))['catch'](handleError(_0x363d0d,null));};exports[_0xdb83('0x70')]=function(_0x4034ba,_0x304b6c,_0x34bdbd){_0x4034ba[_0xdb83('0x54')]['systemAvatar']=_0x4034ba[_0xdb83('0x6a')][_0xdb83('0x6b')];return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x4034ba[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x304b6c,null))['then'](saveUpdates(_0x4034ba[_0xdb83('0x54')],null))[_0xdb83('0x19')](respondWithResult(_0x304b6c,null))['catch'](handleError(_0x304b6c,null));};exports[_0xdb83('0x71')]=function(_0x1dbc46,_0x15b376,_0x195637){var _0x19c7a6=path['join'](config[_0xdb83('0x72')],_0xdb83('0x73'));var _0x314c4a={'where':{'id':_0x1dbc46['params']['id']},'attributes':['id',_0xdb83('0x69')],'raw':!![]};var _0x109625=![];return require('../../config/license/util')[_0xdb83('0x74')]()[_0xdb83('0x19')](function(_0x409b77){if(_0x409b77){_0x109625=_0x409b77[_0xdb83('0x75')];}})[_0xdb83('0x19')](function(){return db[_0xdb83('0x36')][_0xdb83('0x52')](_0x314c4a);})[_0xdb83('0x19')](handleEntityNotFound(_0x15b376,null))[_0xdb83('0x19')](function(_0x1e9102){if(_0x1e9102){if(!_[_0xdb83('0x76')](_0x1e9102[_0xdb83('0x69')])){if(fs[_0xdb83('0x77')](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x79'),_0x1e9102[_0xdb83('0x69')]))&&_0x109625){_0x19c7a6=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x79'),_0x1e9102[_0xdb83('0x69')]);}}return _0x15b376[_0xdb83('0x7a')](_0x19c7a6);}})[_0xdb83('0x22')](handleError(_0x15b376,null));};exports[_0xdb83('0x7b')]=function(_0x76a567,_0x5ca66a,_0x117fa8){var _0x5a4d11=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x7c'));var _0x1e890a={'where':{'id':_0x76a567[_0xdb83('0x4e')]['id']},'attributes':['id',_0xdb83('0x6d')],'raw':!![]};return db[_0xdb83('0x36')]['find'](_0x1e890a)[_0xdb83('0x19')](handleEntityNotFound(_0x5ca66a,null))[_0xdb83('0x19')](function(_0x16e52a){if(_0x16e52a){if(!_[_0xdb83('0x76')](_0x16e52a[_0xdb83('0x6d')])){if(fs[_0xdb83('0x77')](path[_0xdb83('0x78')](config['root'],_0xdb83('0x7d'),_0x16e52a['agentAvatar']))){_0x5a4d11=path['join'](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0x16e52a[_0xdb83('0x6d')]);}}return _0x5ca66a[_0xdb83('0x7a')](_0x5a4d11);}})[_0xdb83('0x22')](handleError(_0x5ca66a,null));};exports['getCustomerAvatar']=function(_0x14a0c6,_0xf482df,_0x268ad6){var _0x4d4cee=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x7e'));var _0x564d2a={'where':{'id':_0x14a0c6['params']['id']},'attributes':['id','customerAvatar',_0xdb83('0x7f')],'raw':!![]};return db[_0xdb83('0x36')][_0xdb83('0x52')](_0x564d2a)[_0xdb83('0x19')](handleEntityNotFound(_0xf482df,null))['then'](function(_0xbec92f){if(_0xbec92f){if(!_[_0xdb83('0x76')](_0xbec92f['customerAvatar'])){if(fs[_0xdb83('0x77')](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0xbec92f[_0xdb83('0x6f')]))&&_0xbec92f['showCustomerAvatar']){_0x4d4cee=path['join'](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0xbec92f['customerAvatar']);}}return _0xf482df['download'](_0x4d4cee);}})[_0xdb83('0x22')](handleError(_0xf482df,null));};exports[_0xdb83('0x80')]=function(_0x3e00dd,_0x3f0416,_0xf7a5a2){var _0x1d785e=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x81'));var _0x1493da={'where':{'id':_0x3e00dd['params']['id']},'attributes':['id',_0xdb83('0x82')],'raw':!![]};return db['ChatWebsite'][_0xdb83('0x52')](_0x1493da)[_0xdb83('0x19')](handleEntityNotFound(_0x3f0416,null))[_0xdb83('0x19')](function(_0x488c8f){if(_0x488c8f){if(!_[_0xdb83('0x76')](_0x488c8f['systemAvatar'])){if(fs[_0xdb83('0x77')](path['join'](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0x488c8f[_0xdb83('0x82')]))){_0x1d785e=path['join'](config['root'],_0xdb83('0x7d'),_0x488c8f[_0xdb83('0x82')]);}}return _0x3f0416['download'](_0x1d785e);}})['catch'](handleError(_0x3f0416,null));};exports[_0xdb83('0x83')]=function(_0x1435d1,_0x2a7c60,_0x1cdb07){var _0x546e43=require(_0xdb83('0x84'));var _0xd0e6c4=new _0x546e43();var _0x34ef42=_0xd0e6c4[_0xdb83('0x85')](_0x1435d1[_0xdb83('0x86')]['user-agent'])[_0xdb83('0x87')]();var _0x2ed948={'body':_0x1435d1[_0xdb83('0x54')],'channel':_0xdb83('0x88')};var _0x11b320=[];var _0x5e51ef=[];var _0x424721={};var _0x5714a8=![];return db[_0xdb83('0x89')][_0xdb83('0x5c')]()[_0xdb83('0x19')](function(_0x35ad21){if(!_0x35ad21){throw new db[(_0xdb83('0x8a'))]['ValidationError'](_0xdb83('0x8b'));}_0x11b320=_['difference'](_['keys'](_0x35ad21),[_0xdb83('0x8c'),_0xdb83('0x8d')]);_0x5e51ef=_[_0xdb83('0x8e')](_[_0xdb83('0x3c')](_0x35ad21),[_0xdb83('0x8c'),_0xdb83('0x8d'),_0xdb83('0x8f'),_0xdb83('0x90')]);if(_0x1435d1[_0xdb83('0x54')]['id']){delete _0x1435d1[_0xdb83('0x54')]['id'];}if(_[_0xdb83('0x76')](_0x1435d1[_0xdb83('0x54')]['from'])){throw new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x92'));}if(_[_0xdb83('0x76')](_0x1435d1[_0xdb83('0x54')][_0xdb83('0x54')])||_0x1435d1[_0xdb83('0x54')]['body']===''){throw new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x93'));}if(_[_0xdb83('0x76')](_0x1435d1['body'][_0xdb83('0x94')])){throw new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x95')+_0x5e51ef);}if(!_[_0xdb83('0x96')](_0x5e51ef,_0x1435d1[_0xdb83('0x54')][_0xdb83('0x94')])){throw new db[(_0xdb83('0x8a'))]['ValidationError'](_0xdb83('0x97')+_0x5e51ef);}_0x424721[_0x1435d1[_0xdb83('0x54')][_0xdb83('0x94')]]=_0x1435d1[_0xdb83('0x54')][_0xdb83('0x98')];})[_0xdb83('0x19')](function(){return db[_0xdb83('0x36')]['find']({'where':{'id':_0x1435d1[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0x99')],'as':_0xdb83('0x9a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x424721,'limit':0x1,'order':[[_0xdb83('0x8d'),'DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x2a7c60,null))[_0xdb83('0x19')](function(_0x1e0b63){if(_0x1e0b63&&_0x1e0b63[_0xdb83('0x9a')]){_0x2ed948[_0xdb83('0x9b')]=_0x1e0b63;_0x2ed948[_0xdb83('0x9c')]=_0x1e0b63[_0xdb83('0x9d')];_0x2ed948[_0xdb83('0x9e')]=_0x1e0b63[_0xdb83('0x9a')];_0x2ed948[_0xdb83('0x9c')]=_['orderBy'](_0x2ed948['applications'],[_0xdb83('0x9f')],['asc']);if(_0x2ed948[_0xdb83('0x9b')]['Applications']){delete _0x2ed948[_0xdb83('0x9b')][_0xdb83('0x9d')];}if(_0x2ed948['account'][_0xdb83('0x9a')]&&_0x2ed948[_0xdb83('0x9b')][_0xdb83('0x9a')]['Contacts']['length']){return _0x2ed948[_0xdb83('0x9b')][_0xdb83('0x9a')][_0xdb83('0xa0')][0x0];}var _0x3e400b=_[_0xdb83('0xa1')](_0x1435d1['body'],{'firstName':_0x1435d1[_0xdb83('0x54')][_0xdb83('0x98')],'ListId':_0x1e0b63['ListId']});_0x3e400b[_0x1435d1[_0xdb83('0x54')]['mapKey']]=_0x1435d1['body']['from'];return db[_0xdb83('0x89')][_0xdb83('0x53')](_0x3e400b,{'fields':_0x11b320,'raw':!![]});}})[_0xdb83('0x19')](handleEntityNotFound(_0x2a7c60,null))[_0xdb83('0x19')](function(_0x27bc84){_0x2ed948['contact']=_0x27bc84;var _0x5e5810=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xa2')];if(_0x1435d1[_0xdb83('0x86')][_0xdb83('0xa3')]){_0x5e5810=_0x1435d1[_0xdb83('0x86')]['cf-connecting-ip'];}else if(_0x1435d1['headers']['x-forwarded-for']){_0x5e5810=_[_0xdb83('0xa4')](_0x1435d1[_0xdb83('0x86')]['x-forwarded-for'][_0xdb83('0xa5')](','));}if(_0x27bc84){var _0x41aaa5={'ContactId':_0x27bc84['id'],'ChatWebsiteId':_0x1435d1[_0xdb83('0x4e')]['id'],'from':(_0x27bc84[_0xdb83('0xa6')]||'')+'\x20'+(_0x27bc84[_0xdb83('0xa7')]||''),'customerIp':_0x5e5810,'customerPort':_0x1435d1[_0xdb83('0x86')][_0xdb83('0xa8')]?_0x1435d1[_0xdb83('0x86')][_0xdb83('0xa8')]:null,'referer':_0x1435d1[_0xdb83('0x54')][_0xdb83('0xa9')],'browserName':_0x34ef42[_0xdb83('0xaa')][_0xdb83('0x31')]&&_0x34ef42['browser'][_0xdb83('0xab')]?util[_0xdb83('0xac')](_0xdb83('0xad'),_0x34ef42[_0xdb83('0xaa')][_0xdb83('0x31')],_0x34ef42[_0xdb83('0xaa')][_0xdb83('0xab')]):_0xdb83('0xae'),'browserVersion':_0x34ef42['browser']['version']||_0xdb83('0xae'),'osName':util[_0xdb83('0xac')](_0xdb83('0xad'),_0x34ef42['os']['name'],_0x34ef42['os'][_0xdb83('0xab')]),'osVersion':_0x34ef42['os'][_0xdb83('0xab')],'deviceModel':_0x34ef42[_0xdb83('0xaf')][_0xdb83('0x3a')]&&_0x34ef42[_0xdb83('0xaf')]['vendor']?util[_0xdb83('0xac')](_0xdb83('0xb0'),_0x34ef42[_0xdb83('0xaf')]['model'],_0x34ef42[_0xdb83('0xaf')][_0xdb83('0xb1')],_0x34ef42[_0xdb83('0xaf')][_0xdb83('0x38')]):null,'deviceVendor':_0x34ef42[_0xdb83('0xaf')][_0xdb83('0xb1')],'deviceType':_0x34ef42[_0xdb83('0xaf')][_0xdb83('0x38')],'formData':JSON[_0xdb83('0x1d')](_0x1435d1[_0xdb83('0x54')])};var _0xa7521e={'ChatWebsiteId':_0x1435d1['params']['id'],'closed':![]};if(_0x1435d1[_0xdb83('0x54')]['threadId']){_0xa7521e[_0xdb83('0xb2')]=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')];return db[_0xdb83('0xb3')][_0xdb83('0x52')]({'where':_0xa7521e})[_0xdb83('0x19')](function(_0x64ea82){if(_0x64ea82){return[_0x64ea82,![]];}_0x41aaa5['threadId']=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')];_0x41aaa5[_0xdb83('0xb4')]=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb4')];return db[_0xdb83('0xb3')]['create'](_0x41aaa5)['then'](function(_0x42bd75){return[_0x42bd75,!![]];});});}_0xa7521e[_0xdb83('0xb5')]=_0x27bc84['id'];if(_0x1435d1['body'][_0xdb83('0xb6')]&&_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb6')]['id']){_0xa7521e['id']=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb6')]['id'];return db[_0xdb83('0xb3')][_0xdb83('0x52')]({'where':_0xa7521e})[_0xdb83('0x19')](function(_0x48b5fc){if(_0x48b5fc){return[_0x48b5fc,![]];}return db['ChatInteraction']['create'](_0x41aaa5)[_0xdb83('0x19')](function(_0x952256){return[_0x952256,!![]];});});}return db['ChatInteraction'][_0xdb83('0x53')](_0x41aaa5)['then'](function(_0x586041){return[_0x586041,!![]];});}})['spread'](function(_0x109a4b,_0x34ba19){if(_0x109a4b){_0x5714a8=_0x34ba19;if(!_0x34ba19){var _0x4c216b={'from':(_0x2ed948[_0xdb83('0xb7')]['firstName']||'')+'\x20'+(_0x2ed948[_0xdb83('0xb7')]['lastName']||'')};if(_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')]&&_0x1435d1['body'][_0xdb83('0xb8')]&&_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')]!=_0x1435d1['body'][_0xdb83('0xb8')]){_0x4c216b[_0xdb83('0xb2')]=_0x1435d1['body'][_0xdb83('0xb8')];}return _0x109a4b[_0xdb83('0x2c')](_0x4c216b);}else{return _0x109a4b;}}})[_0xdb83('0x19')](function(_0x22debe){_0x2ed948[_0xdb83('0xb6')]=_0x22debe['get']({'plain':!![]});_0x2ed948[_0xdb83('0xb6')][_0xdb83('0xb9')]=_0x5714a8;if(_0x2ed948[_0xdb83('0xb6')]['created']){if(_0x2ed948['account'][_0xdb83('0xba')]){_0x2ed948['applications'][_0xdb83('0xbb')]({'id':0x0,'priority':_0x2ed948[_0xdb83('0x9c')][_0xdb83('0x40')]+0x1,'app':_0xdb83('0xbc'),'appdata':_0xdb83('0xbd'),'interval':_0xdb83('0xbe')});}}return db[_0xdb83('0xbf')]['create']({'body':_0x1435d1[_0xdb83('0x54')]['body'],'ChatWebsiteId':_0x1435d1[_0xdb83('0x4e')]['id'],'ChatInteractionId':_0x22debe['id'],'direction':'in','ContactId':_0x2ed948[_0xdb83('0xb7')]['id'],'AttachmentId':_0x1435d1['body'][_0xdb83('0xc0')]});})[_0xdb83('0x19')](function(_0x2de67d){_0x2ed948['message']=_0x2de67d;if(_0x2ed948[_0xdb83('0xb6')]['UserId']){return db['User'][_0xdb83('0x52')]({'attributes':['id',_0xdb83('0x31')],'where':{'id':_0x2ed948[_0xdb83('0xb6')][_0xdb83('0xc1')]}})['then'](function(_0x25eb9b){if(_0x25eb9b){_0x2ed948['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xdb83('0xc2'),'appdata':_0x25eb9b['name']+','+(_0x2ed948[_0xdb83('0x9b')]['waitForTheAssignedAgent']||0xa),'interval':_0xdb83('0xbe')});_0x2ed948[_0xdb83('0xc3')]=!![];}return respondWithRpcPromise(_0xdb83('0xc4'),'startRouting',_0x2ed948);});}return respondWithRpcPromise('Start','startRouting',_0x2ed948);})[_0xdb83('0x19')](function(_0x68f25c){respondWithRpcPromise(_0xdb83('0xc5'),_0xdb83('0xc5'),{'event':_0xdb83('0x83'),'message':_0x68f25c},client9002);return _0x68f25c;})[_0xdb83('0x19')](respondWithResult(_0x2a7c60,null))[_0xdb83('0x22')](handleError(_0x2a7c60,null));};exports[_0xdb83('0xc6')]=function(_0x52bb7c,_0x32bcf1,_0x30fd21){var _0x2b60dc,_0x110dfa,_0x5aea20;var _0xac7256=[];var _0x1f3b65=[];var _0x58177={};return db[_0xdb83('0x89')]['describe']()[_0xdb83('0x19')](function(_0x210a7c){if(!_0x210a7c){throw new db[(_0xdb83('0x8a'))]['ValidationError'](_0xdb83('0x8b'));}_0x1f3b65=_[_0xdb83('0x8e')](_[_0xdb83('0x3c')](_0x210a7c),['createdAt',_0xdb83('0x8d')]);_0xac7256=_[_0xdb83('0x8e')](_[_0xdb83('0x3c')](_0x210a7c),['createdAt',_0xdb83('0x8d'),'CompanyId',_0xdb83('0x90')]);if(_0x52bb7c['body']['id']){delete _0x52bb7c['body']['id'];}if(_[_0xdb83('0x76')](_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x98')])){throw _0x32bcf1['status'](0x1f4)['send'](new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x92')));}if(_[_0xdb83('0x76')](_0x52bb7c['body']['body'])||_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x54')]===''){throw _0x32bcf1[_0xdb83('0x24')](0x1f4)[_0xdb83('0xc7')](new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x93')));}if(_[_0xdb83('0x76')](_0x52bb7c[_0xdb83('0x54')]['mapKeyOffline'])){throw _0x32bcf1['status'](0x1f4)[_0xdb83('0xc7')](new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0xc8')+_0xac7256));}if(!_[_0xdb83('0x96')](_0xac7256,_0x52bb7c[_0xdb83('0x54')][_0xdb83('0xc9')])){throw _0x32bcf1[_0xdb83('0x24')](0x1f4)['send'](new db['Sequelize'][(_0xdb83('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xac7256));}_0x58177[_0x52bb7c[_0xdb83('0x54')][_0xdb83('0xc9')]]=_0x52bb7c['body'][_0xdb83('0x98')];})[_0xdb83('0x19')](function(){return db['ChatWebsite'][_0xdb83('0x52')]({'where':{'id':_0x52bb7c[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0x99')],'as':_0xdb83('0x9a')}]});})[_0xdb83('0x19')](handleEntityNotFound(_0x32bcf1,null))[_0xdb83('0x19')](function(_0x4b3abe){if(_0x4b3abe&&_0x4b3abe[_0xdb83('0x9a')]){_0x110dfa=_0x4b3abe;var _0x5da5cc=_['defaults'](_0x52bb7c[_0xdb83('0x54')],{'firstName':_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x98')],'phone':_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x98')],'ListId':_0x4b3abe['ListId']});_0x5da5cc[_0x52bb7c[_0xdb83('0x54')]['mapKeyOffline']]=_0x52bb7c['body'][_0xdb83('0x98')];return db['CmContact'][_0xdb83('0xca')]({'where':_0x58177,'defaults':_0x5da5cc});}})[_0xdb83('0xcb')](function(_0x341d41){if(_0x341d41){_0x5aea20=_0x341d41;var _0x50de1b=fs[_0xdb83('0xcc')](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0xcd')),'utf8');var _0x4fbac7=ejs['render'](_0x50de1b,{'body':_[_0xdb83('0xce')](_0x52bb7c['body']['body']),'bodyTitle':_0x110dfa[_0xdb83('0xcf')]});return db[_0xdb83('0xd0')]['create']({'body':_0x4fbac7,'ContactId':_0x341d41['id'],'ChatWebsiteId':_0x110dfa['id']});}})[_0xdb83('0x19')](function(_0x1ac6c3){if(_0x1ac6c3){_0x2b60dc=_0x1ac6c3;return db[_0xdb83('0xd1')][_0xdb83('0x5d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xdb83('0xd2'),'raw':!![]}]});}})[_0xdb83('0x19')](function(_0x1c6e03){if(_0x1c6e03&&_0x1c6e03[_0xdb83('0xd2')]&&_0x110dfa[_0xdb83('0xd3')]){var _0x4b3fba={'tls':{'rejectUnauthorized':![]}};if(_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd4')]){_0x4b3fba[_0xdb83('0xd4')]=_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd4')];}else{_0x4b3fba['host']=_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd5')];_0x4b3fba[_0xdb83('0xd6')]=_0x1c6e03[_0xdb83('0xd2')]['port'];_0x4b3fba[_0xdb83('0xd7')]=_0x1c6e03['Smtp']['secure'];}if(_0x1c6e03[_0xdb83('0xd2')]['authentication']){_0x4b3fba[_0xdb83('0xd8')]={'user':_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0x55')],'pass':_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd9')]};}return respondWithRpcPromise('SendMail',_0xdb83('0xda'),{'account':_0x4b3fba,'message':{'from':util['format'](_0xdb83('0xdb'),_0x1c6e03[_0xdb83('0x31')],_0x1c6e03[_0xdb83('0xdc')]||_0x1c6e03[_0xdb83('0xd2')]['user']),'to':_0x110dfa[_0xdb83('0xd3')],'subject':_0x110dfa[_0xdb83('0xdd')],'text':_0x2b60dc['body']}},client9003)[_0xdb83('0x19')](function(){return _0x2b60dc;})[_0xdb83('0x22')](function(_0x3810fa){console['error'](_0x3810fa);});}})[_0xdb83('0x19')](function(){if(_0x2b60dc){return _0x2b60dc;}})['then'](respondWithResult(_0x32bcf1,null))[_0xdb83('0x22')](handleError(_0x32bcf1,null));};exports[_0xdb83('0xde')]=function(_0x2240a7,_0x1c9e6a,_0x5538e7){return db[_0xdb83('0xb3')]['find']({'where':{'id':_0x2240a7['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x1c9e6a,null))[_0xdb83('0x19')](function(_0x286012){if(_0x286012){return _0x286012['addInteraction'](_0x2240a7['body'][_0xdb83('0x63')],_[_0xdb83('0xdf')](_0x2240a7[_0xdb83('0x54')],[_0xdb83('0x63'),'id'])||{});}})['then'](respondWithResult(_0x1c9e6a,null))[_0xdb83('0x22')](handleError(_0x1c9e6a,null));};exports['getInteractions']=function(_0x118089,_0x580bb3,_0x478ba9){var _0x2db036={'raw':![],'where':{}};var _0x2d482a={};var _0x36a62c={'count':0x0,'rows':[]};return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x118089[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x580bb3,null))[_0xdb83('0x19')](function(_0x274a49){if(_0x274a49){_0x2d482a[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db['ChatInteraction'][_0xdb83('0x4f')]);_0x2d482a['query']=_['keys'](_0x118089[_0xdb83('0x3b')]);_0x2d482a[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x2d482a[_0xdb83('0x3a')],_0x2d482a[_0xdb83('0x3b')]);_0x2db036[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x2d482a[_0xdb83('0x3a')],qs[_0xdb83('0x50')](_0x118089['query'][_0xdb83('0x50')]));_0x2db036[_0xdb83('0x3f')]=_0x2db036[_0xdb83('0x3f')][_0xdb83('0x40')]?_0x2db036[_0xdb83('0x3f')]:_0x2d482a[_0xdb83('0x3a')];if(!_0x118089[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0x2db036['limit']=qs[_0xdb83('0x43')](_0x118089[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x2db036['offset']=qs[_0xdb83('0x28')](_0x118089[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0x2db036[_0xdb83('0x5f')]=qs[_0xdb83('0x44')](_0x118089[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x2db036[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x118089[_0xdb83('0x3b')],_0x2d482a[_0xdb83('0x3d')]));_0x2db036['where']['ChatWebsiteId']=_0x274a49['id'];if(_0x118089['query'][_0xdb83('0x47')]){_0x2db036[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x2db036['where'],{'$or':_[_0xdb83('0x35')](_0x2db036['attributes'],function(_0x50c7b7){var _0x4cb025={};_0x4cb025[_0x50c7b7]={'$like':'%'+_0x118089[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x4cb025;})});}_0x2db036=_[_0xdb83('0x48')]({},_0x2db036,_0x118089[_0xdb83('0x51')]);return db[_0xdb83('0xb3')][_0xdb83('0x27')]({'where':_0x2db036[_0xdb83('0x45')]})[_0xdb83('0x19')](function(_0x457417){_0x36a62c[_0xdb83('0x27')]=_0x457417;if(_0x118089[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0x2db036[_0xdb83('0x4b')]=[{'model':db['CmContact'],'as':_0xdb83('0xe0'),'required':![]},{'model':db['User'],'as':_0xdb83('0xe1'),'attributes':[_0xdb83('0x31'),_0xdb83('0xe2'),'internal'],'required':![]},{'model':db[_0xdb83('0xe3')],'as':_0xdb83('0xe4'),'attributes':['id','name',_0xdb83('0xe5')],'where':_0x118089['query'][_0xdb83('0xe6')]?{'id':_0x118089['query'][_0xdb83('0xe6')]}:undefined,'required':_0x118089[_0xdb83('0x3b')][_0xdb83('0xe6')]?!![]:![]}];}return db[_0xdb83('0xb3')]['findAll'](_0x2db036);})[_0xdb83('0x19')](function(_0x53c068){_0x36a62c['rows']=_0x53c068;return _0x36a62c;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x580bb3,_0x2db036))[_0xdb83('0x22')](handleError(_0x580bb3,null));};function iftimePromise(_0x29f3ae,_0x4b49b5){return respondWithRpcPromise(_0xdb83('0xe7'),_0xdb83('0xe8'),{'command':_0x4b49b5[_0xdb83('0xe9')]?util[_0xdb83('0xac')](_0xdb83('0xea'),_0x29f3ae['interval'],_0x4b49b5[_0xdb83('0xe9')]):util[_0xdb83('0xac')](_0xdb83('0xeb'),_0x29f3ae[_0xdb83('0xec')])},client9002)[_0xdb83('0x19')](function(_0x104983){var _0x241f27=_0x104983&&_0x104983[_0xdb83('0xed')](_0xdb83('0xee'))>=0x0?!![]:![];logger[_0xdb83('0x21')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4b49b5['id'],_0x29f3ae['id'],_0x29f3ae['interval'],_0x241f27?'ONLINE':_0xdb83('0xef'),_0x4b49b5[_0xdb83('0xe9')]?_0x4b49b5['timezone']:_0xdb83('0xf0'));return _0x241f27;})[_0xdb83('0x22')](function(_0x2e6718){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4b49b5['id'],_0x29f3ae['id'],_0x29f3ae[_0xdb83('0xec')],util[_0xdb83('0xf1')](_0x2e6718,{'showHidden':![],'depth':null}),_0x4b49b5[_0xdb83('0xe9')]?_0x4b49b5[_0xdb83('0xe9')]:'No\x20timezone');return![];});}exports[_0xdb83('0xe8')]=function(_0x2fe171,_0x50c078,_0x574ff4){var _0x314a98=0x0;var _0x1b5dce=0x0;var _0x366980=![];var _0x51a252;var _0x4dbfb1;return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x2fe171[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0xf2')],'as':_0xdb83('0xf2'),'include':[{'model':db[_0xdb83('0xf2')],'as':_0xdb83('0xf3'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x50c078,null))[_0xdb83('0x19')](function(_0x4548f1){if(_0x4548f1){_0x51a252=_0x4548f1;return _0x4548f1['getProactiveActions']({'raw':!![]});}})[_0xdb83('0x19')](function(_0x33625a){if(_0x51a252){if(_0x33625a){_0x4dbfb1=_0x33625a;}}return require(_0xdb83('0xf4'))[_0xdb83('0x74')]();})['then'](function(_0x29ab51){if(_0x29ab51){_0x1b5dce=_0x29ab51[_0xdb83('0xf5')];_0x366980=_0x29ab51[_0xdb83('0x75')];}})[_0xdb83('0x19')](function(){return db[_0xdb83('0xb3')][_0xdb83('0x27')]({'where':{'closed':![]}});})[_0xdb83('0x19')](function(_0x410f71){_0x314a98=_0x410f71;if(_0x1b5dce&&_0x410f71>_0x1b5dce){return db[_0xdb83('0xf6')][_0xdb83('0x5d')]({'where':{'id':0x1}})[_0xdb83('0x19')](function(_0x3dac03){if(_0x3dac03){_0x3dac03[_0xdb83('0xf7')](_0xdb83('0xf8'));}});}})[_0xdb83('0x19')](function(){if(_0x51a252['Interval']&&_0x51a252[_0xdb83('0xf2')][_0xdb83('0xf3')]){var _0x239b3d=[];for(var _0x210a59=0x0;_0x210a59<_0x51a252[_0xdb83('0xf2')][_0xdb83('0xf3')][_0xdb83('0x40')];_0x210a59++){var _0x144ab1=_0x51a252[_0xdb83('0xf2')][_0xdb83('0xf3')][_0x210a59][_0xdb83('0x2e')]({'plain':!![]});_0x239b3d[_0xdb83('0xbb')](iftimePromise(_0x144ab1,_0x51a252));}return BPromise[_0xdb83('0xf9')](_0x239b3d)[_0xdb83('0x19')](function(_0x13e94d){return _[_0xdb83('0xfa')](_0x13e94d);});}else{return!![];}})[_0xdb83('0x19')](function(_0x28cebd){var _0x3defec=fs['readFileSync'](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0xfb')),_0xdb83('0xfc'));var _0x2c8b75={'remote':_0x51a252[_0xdb83('0xfd')],'query':querystring['stringify'](_[_0xdb83('0x48')](_0x51a252['get']({'plain':!![]}),{'customerIp':_0x2fe171['headers'][_0xdb83('0xfe')]||_0x2fe171[_0xdb83('0x86')][_0xdb83('0xff')]||_0x2fe171['connection']['remoteAddress']||_0x2fe171['ip'],'referer':_0x2fe171[_0xdb83('0x86')][_0xdb83('0xa9')],'openedInteractions':_0x314a98,'maxInteractions':_0x1b5dce,'virtual':_0x366980[_0xdb83('0xf5')],'online':_0x28cebd,'custom':_0x366980}))[_0xdb83('0x100')](/'/g,'\x5c\x27')};_0x50c078['send'](ejs['render'](Mustache[_0xdb83('0x101')](_0x3defec,_0x2c8b75),{'proactiveActions':_0x4dbfb1,'alignment':_0x51a252['alignment'],'verticalAlignment':_0x51a252['verticalAlignment'],'div_color':_0x51a252[_0xdb83('0xe5')],'text_color':_0x51a252[_0xdb83('0x102')]}));})[_0xdb83('0x22')](handleError(_0x50c078,null));};exports['addApplications']=function(_0x1a34ff,_0x176db4,_0x492047){return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x1a34ff[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x176db4,null))['then'](function(_0x4b6b9a){if(_0x4b6b9a){return db['sequelize'][_0xdb83('0x103')](function(_0x40eb4a){return db[_0xdb83('0x104')][_0xdb83('0x2d')]({'where':{'ChatWebsiteId':_0x1a34ff['params']['id']},'transaction':_0x40eb4a})[_0xdb83('0x19')](function(_0x2dbd84){var _0x387a6b=_[_0xdb83('0x35')](_0x1a34ff[_0xdb83('0x54')],function(_0x55a328){_0x55a328[_0xdb83('0x60')]=_0x1a34ff[_0xdb83('0x4e')]['id'];return _0x55a328;});return db['ChatApplication'][_0xdb83('0x105')](_0x387a6b,{'transaction':_0x40eb4a});});})[_0xdb83('0x19')](function(){return db[_0xdb83('0x104')][_0xdb83('0x106')]({'where':{'ChatWebsiteId':_0x1a34ff[_0xdb83('0x4e')]['id']},'order':_0xdb83('0x9f')});});}})['then'](respondWithResult(_0x176db4,null))[_0xdb83('0x22')](handleError(_0x176db4,null));};exports[_0xdb83('0x107')]=function(_0x383e48,_0x420773,_0x46eb90){var _0x8c29e={};var _0x2c4efb={};var _0x56c01b;var _0x589dde;return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x383e48['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x420773,null))[_0xdb83('0x19')](function(_0x48cc0c){if(_0x48cc0c){_0x56c01b=_0x48cc0c;_0x2c4efb['model']=_[_0xdb83('0x3c')](db[_0xdb83('0x104')][_0xdb83('0x4f')]);_0x2c4efb[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x383e48[_0xdb83('0x3b')]);_0x2c4efb[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x2c4efb['model'],_0x2c4efb[_0xdb83('0x3b')]);_0x8c29e[_0xdb83('0x3f')]=_['intersection'](_0x2c4efb['model'],qs[_0xdb83('0x50')](_0x383e48[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x8c29e[_0xdb83('0x3f')]=_0x8c29e[_0xdb83('0x3f')]['length']?_0x8c29e['attributes']:_0x2c4efb['model'];_0x8c29e[_0xdb83('0x5f')]=qs['sort'](_0x383e48[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x8c29e[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x383e48[_0xdb83('0x3b')],_0x2c4efb[_0xdb83('0x3d')]));if(_0x383e48[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x8c29e[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x8c29e[_0xdb83('0x45')],{'$or':_[_0xdb83('0x35')](_0x8c29e[_0xdb83('0x3f')],function(_0x8d7f25){var _0x366b42={};_0x366b42[_0x8d7f25]={'$like':'%'+_0x383e48['query'][_0xdb83('0x47')]+'%'};return _0x366b42;})});}_0x8c29e=_[_0xdb83('0x48')]({},_0x8c29e,_0x383e48[_0xdb83('0x51')]);return _0x56c01b[_0xdb83('0x107')](_0x8c29e);}})[_0xdb83('0x19')](function(_0xf19dfd){if(_0xf19dfd){_0x589dde=_0xf19dfd['length'];if(!_0x383e48[_0xdb83('0x3b')]['hasOwnProperty'](_0xdb83('0x42'))){_0x8c29e[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x383e48[_0xdb83('0x3b')]['limit']);_0x8c29e[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x383e48['query'][_0xdb83('0x28')]);}return _0x56c01b[_0xdb83('0x107')](_0x8c29e);}})['then'](function(_0x400c2f){if(_0x400c2f){return _0x400c2f?{'count':_0x589dde,'rows':_0x400c2f}:null;}})[_0xdb83('0x19')](respondWithResult(_0x420773,null))[_0xdb83('0x22')](handleError(_0x420773,null));};exports[_0xdb83('0x108')]=function(_0x26c133,_0x381ef7,_0x8876fb){return db[_0xdb83('0x109')][_0xdb83('0x52')]({'where':{'id':_0x26c133[_0xdb83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x381ef7,null))[_0xdb83('0x19')](function(_0x453fc1){if(_0x453fc1){return _0x453fc1[_0xdb83('0x108')](_0x26c133['body'][_0xdb83('0x63')],_[_0xdb83('0xdf')](_0x26c133[_0xdb83('0x54')],['ids','id'])||{});}})['then'](respondWithResult(_0x381ef7,null))[_0xdb83('0x22')](handleError(_0x381ef7,null));};exports[_0xdb83('0x10a')]=function(_0x2bee80,_0xaa55f2,_0x25bd73){var _0x5d6931={};var _0x1ec9ba={};var _0x3eac0e;var _0x4af340;return db['ChatWebsite'][_0xdb83('0x5d')]({'where':{'id':_0x2bee80[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0xaa55f2,null))[_0xdb83('0x19')](function(_0xfca476){if(_0xfca476){_0x3eac0e=_0xfca476;_0x1ec9ba[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db[_0xdb83('0x10b')][_0xdb83('0x4f')]);_0x1ec9ba[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x2bee80[_0xdb83('0x3b')]);_0x1ec9ba[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x1ec9ba['model'],_0x1ec9ba['query']);_0x5d6931[_0xdb83('0x3f')]=_['intersection'](_0x1ec9ba['model'],qs[_0xdb83('0x50')](_0x2bee80['query']['fields']));_0x5d6931['attributes']=_0x5d6931[_0xdb83('0x3f')][_0xdb83('0x40')]?_0x5d6931['attributes']:_0x1ec9ba[_0xdb83('0x3a')];_0x5d6931['order']=qs[_0xdb83('0x44')](_0x2bee80[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x5d6931['where']=qs['filters'](_[_0xdb83('0x46')](_0x2bee80['query'],_0x1ec9ba[_0xdb83('0x3d')]));if(_0x2bee80[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x5d6931['where']=_[_0xdb83('0x48')](_0x5d6931[_0xdb83('0x45')],{'$or':_['map'](_0x5d6931[_0xdb83('0x3f')],function(_0x502769){var _0x5b2199={};_0x5b2199[_0x502769]={'$like':'%'+_0x2bee80[_0xdb83('0x3b')]['filter']+'%'};return _0x5b2199;})});}_0x5d6931=_['merge']({},_0x5d6931,_0x2bee80[_0xdb83('0x51')]);return _0x3eac0e['getProactiveActions'](_0x5d6931);}})[_0xdb83('0x19')](function(_0x4f9439){if(_0x4f9439){_0x4af340=_0x4f9439[_0xdb83('0x40')];if(!_0x2bee80[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0x5d6931[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x2bee80['query'][_0xdb83('0x43')]);_0x5d6931[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x2bee80['query'][_0xdb83('0x28')]);}return _0x3eac0e[_0xdb83('0x10a')](_0x5d6931);}})[_0xdb83('0x19')](function(_0x441673){if(_0x441673){return _0x441673?{'count':_0x4af340,'rows':_0x441673}:null;}})['then'](respondWithResult(_0xaa55f2,null))[_0xdb83('0x22')](handleError(_0xaa55f2,null));};exports[_0xdb83('0x10c')]=function(_0xf579eb,_0x369e61,_0x5a3a54){var _0x4eafbc=_0xf579eb[_0xdb83('0x3b')][_0xdb83('0x10d')]==='false'?'offlineForm':_0xdb83('0x10e');return db[_0xdb83('0x36')][_0xdb83('0x52')]({'attributes':['id',_0x4eafbc],'where':{'id':_0xf579eb[_0xdb83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x369e61,null))[_0xdb83('0x19')](function(_0x17d4cf){if(_0x17d4cf){var _0x5df2b4=_0x17d4cf[_0x4eafbc];var _0x536f7c=_0x5df2b4&&_0x5df2b4['items']?_0x5df2b4[_0xdb83('0x10f')]:[];_0x369e61[_0xdb83('0xc7')]({'fromKey':_[_0xdb83('0x76')](_0x5df2b4['fromKey'])?undefined:_0x5df2b4[_0xdb83('0x110')],'count':_0x536f7c[_0xdb83('0x40')],'rows':_0x536f7c});}})['catch'](handleError(_0x369e61,null));};exports[_0xdb83('0x111')]=function(_0x51ed6e,_0x2e680b,_0x49508f){var _0x4805bd={'raw':![],'where':{}};var _0x5c956f={};var _0x3ed3d3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdb83('0x5d')]({'where':{'id':_0x51ed6e[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x2e680b,null))[_0xdb83('0x19')](function(_0x3c7677){if(_0x3c7677){_0x5c956f['model']=_[_0xdb83('0x3c')](db[_0xdb83('0xd0')][_0xdb83('0x4f')]);_0x5c956f[_0xdb83('0x3b')]=_['keys'](_0x51ed6e[_0xdb83('0x3b')]);_0x5c956f['filters']=_['intersection'](_0x5c956f[_0xdb83('0x3a')],_0x5c956f['query']);_0x4805bd['attributes']=_[_0xdb83('0x3e')](_0x5c956f[_0xdb83('0x3a')],qs['fields'](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x4805bd['attributes']=_0x4805bd['attributes'][_0xdb83('0x40')]?_0x4805bd[_0xdb83('0x3f')]:_0x5c956f[_0xdb83('0x3a')];if(!_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x41')]('nolimit')){_0x4805bd[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x4805bd[_0xdb83('0x28')]=qs['offset'](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0x4805bd[_0xdb83('0x5f')]=qs[_0xdb83('0x44')](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x4805bd[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x51ed6e[_0xdb83('0x3b')],_0x5c956f['filters']));_0x4805bd[_0xdb83('0x45')][_0xdb83('0x60')]=_0x3c7677['id'];if(_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x4805bd[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x4805bd['where'],{'$or':_[_0xdb83('0x35')](_0x4805bd['attributes'],function(_0x41c405){var _0x135dcb={};_0x135dcb[_0x41c405]={'$like':'%'+_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x135dcb;})});}_0x4805bd=_['merge']({},_0x4805bd,_0x51ed6e[_0xdb83('0x51')]);return db[_0xdb83('0xd0')][_0xdb83('0x27')]({'where':_0x4805bd['where']})[_0xdb83('0x19')](function(_0x14b5d4){_0x3ed3d3[_0xdb83('0x27')]=_0x14b5d4;if(_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0x4805bd[_0xdb83('0x4b')]=[{'all':!![]}];}else{_0x4805bd[_0xdb83('0x4b')]=[{'model':db[_0xdb83('0x89')],'as':_0xdb83('0xe0'),'required':![]}];}return db[_0xdb83('0xd0')][_0xdb83('0x4c')](_0x4805bd);})[_0xdb83('0x19')](function(_0x52023c){_0x3ed3d3[_0xdb83('0x61')]=_0x52023c;return _0x3ed3d3;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x2e680b,_0x4805bd))['catch'](handleError(_0x2e680b,null));};exports[_0xdb83('0x112')]=function(_0x172edf,_0x48b24c,_0x40f99f){return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x172edf['params']['id']}})['then'](handleEntityNotFound(_0x48b24c,null))[_0xdb83('0x19')](function(_0x497037){if(_0x497037){return _0x497037['addAgents'](_0x172edf['body'][_0xdb83('0x63')],_[_0xdb83('0xdf')](_0x172edf[_0xdb83('0x54')],[_0xdb83('0x63'),'id'])||{})['spread'](function(_0x40d395){for(var _0x2caf1d=0x0;_0x2caf1d<_0x172edf[_0xdb83('0x54')][_0xdb83('0x63')][_0xdb83('0x40')];_0x2caf1d+=0x1){socket[_0xdb83('0x113')](_0xdb83('0x114'),{'UserId':_0x172edf[_0xdb83('0x54')][_0xdb83('0x63')][_0x2caf1d],'ChatWebsiteId':_0x172edf['params']['id']});}return _0x40d395;});}})[_0xdb83('0x19')](respondWithResult(_0x48b24c,null))[_0xdb83('0x22')](handleError(_0x48b24c,null));};exports[_0xdb83('0x115')]=function(_0x454fb9,_0x373723,_0x2a57a0){return db[_0xdb83('0x36')]['find']({'where':{'id':_0x454fb9[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x373723,null))[_0xdb83('0x19')](function(_0x598a2c){if(_0x598a2c){return _0x598a2c[_0xdb83('0x115')](_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')])[_0xdb83('0x19')](function(){if(_[_0xdb83('0x116')](_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')])){for(var _0xeb4ee3=0x0;_0xeb4ee3<_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')][_0xdb83('0x40')];_0xeb4ee3+=0x1){socket[_0xdb83('0x113')]('userChatWebsite:remove',{'UserId':Number(_0x454fb9['query'][_0xdb83('0x63')][_0xeb4ee3]),'ChatWebsiteId':Number(_0x454fb9[_0xdb83('0x4e')]['id'])});}}else{socket[_0xdb83('0x113')](_0xdb83('0x117'),{'UserId':Number(_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')]),'ChatWebsiteId':Number(_0x454fb9[_0xdb83('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x373723,null))[_0xdb83('0x22')](handleError(_0x373723,null));};exports[_0xdb83('0x118')]=function(_0x34de9e,_0x23628f,_0x78833b){var _0x2b72f1={};var _0x9fa083={};var _0x115c80;var _0x237c71;return db[_0xdb83('0x36')]['findOne']({'where':{'id':_0x34de9e['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x23628f,null))[_0xdb83('0x19')](function(_0x599904){if(_0x599904){_0x115c80=_0x599904;_0x9fa083[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db[_0xdb83('0x119')]['rawAttributes']);_0x9fa083['query']=_[_0xdb83('0x3c')](_0x34de9e[_0xdb83('0x3b')]);_0x9fa083[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x9fa083[_0xdb83('0x3a')],_0x9fa083[_0xdb83('0x3b')]);_0x2b72f1[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x9fa083['model'],qs[_0xdb83('0x50')](_0x34de9e[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x2b72f1['attributes']=_0x2b72f1[_0xdb83('0x3f')][_0xdb83('0x40')]?_0x2b72f1[_0xdb83('0x3f')]:_0x9fa083['model'];_0x2b72f1['order']=qs['sort'](_0x34de9e['query'][_0xdb83('0x44')]);_0x2b72f1[_0xdb83('0x45')]=qs['filters'](_[_0xdb83('0x46')](_0x34de9e[_0xdb83('0x3b')],_0x9fa083['filters']));if(_0x34de9e[_0xdb83('0x3b')]['filter']){_0x2b72f1['where']=_['merge'](_0x2b72f1[_0xdb83('0x45')],{'$or':_['map'](_0x2b72f1[_0xdb83('0x3f')],function(_0x228ed8){var _0xf0b8ad={};_0xf0b8ad[_0x228ed8]={'$like':'%'+_0x34de9e['query']['filter']+'%'};return _0xf0b8ad;})});}_0x2b72f1=_[_0xdb83('0x48')]({},_0x2b72f1,_0x34de9e['options']);return _0x115c80['getAgents'](_0x2b72f1);}})[_0xdb83('0x19')](function(_0x50ca26){if(_0x50ca26){_0x237c71=_0x50ca26['length'];if(!_0x34de9e[_0xdb83('0x3b')]['hasOwnProperty'](_0xdb83('0x42'))){_0x2b72f1[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x34de9e[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x2b72f1[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x34de9e[_0xdb83('0x3b')][_0xdb83('0x28')]);}return _0x115c80[_0xdb83('0x118')](_0x2b72f1);}})['then'](function(_0x1ad629){if(_0x1ad629){return _0x1ad629?{'count':_0x237c71,'rows':_0x1ad629}:null;}})[_0xdb83('0x19')](respondWithResult(_0x23628f,null))['catch'](handleError(_0x23628f,null));}; \ No newline at end of file +var _0x01f5=['query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','user','userProfileId','autoAssociation','update','body','describe','addDisposition','ChatWebsiteId','Disposition','create','getDispositions','keys','hasOwnProperty','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addLogo','sitepic','file','addAvatar','agentAvatar','addCustomerAvatar','filename','addSystemAvatar','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','customerAvatar','getSystemAvatar','systemAvatar','existsSync','notify','setUA','headers','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','account','applications','Applications','list','orderBy','priority','asc','defaults','ListId','contact','cf-connecting-ip','x-forwarded-for','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','offlineMessageSubject','addInteraction','getInteractions','Contact','Owner','internal','Tag','Tags','color','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','x-real-ip','connection','replace','render','alignment','verticalAlignment','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','get','ChatWebsites','UserProfileResource','destroy','end','stack','name','send','index','Pause','ChatWebsite','rawAttributes','fieldName','key','model','map'];(function(_0x12c55d,_0x178a39){var _0x342c55=function(_0x42d933){while(--_0x42d933){_0x12c55d['push'](_0x12c55d['shift']());}};_0x342c55(++_0x178a39);}(_0x01f5,0xd5));var _0x501f=function(_0x5b1551,_0x4ad506){_0x5b1551=_0x5b1551-0x0;var _0x266298=_0x01f5[_0x5b1551];return _0x266298;};'use strict';var pdf=require(_0x501f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x501f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x501f('0x2'));var rp=require('request-promise');var moment=require(_0x501f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x501f('0x4'));var util=require(_0x501f('0x5'));var path=require(_0x501f('0x6'));var sox=require(_0x501f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x501f('0x8'));var squel=require(_0x501f('0x9'));var crypto=require(_0x501f('0xa'));var jsforce=require(_0x501f('0xb'));var deskjs=require(_0x501f('0xc'));var toCsv=require(_0x501f('0xd'));var querystring=require('querystring');var Papa=require(_0x501f('0xe'));var Redis=require(_0x501f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x501f('0x10'));var as=require(_0x501f('0x11'));var hardwareService=require(_0x501f('0x12'));var logger=require(_0x501f('0x13'))('api');var utils=require(_0x501f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x501f('0x15'));var db=require(_0x501f('0x16'))['db'];config[_0x501f('0x17')]=_['defaults'](config[_0x501f('0x17')],{'host':_0x501f('0x18'),'port':0x18eb});var socket=require(_0x501f('0x19'))(new Redis(config[_0x501f('0x17')]));require(_0x501f('0x1a'))[_0x501f('0x1b')](socket);var jayson=require(_0x501f('0x1c'));var client=jayson[_0x501f('0x1d')][_0x501f('0x1e')]({'port':0x232c});var client9002=jayson[_0x501f('0x1d')][_0x501f('0x1e')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x2834e7,_0xd2f471,_0x553951,_0x10fc83){return new BPromise(function(_0x279b32,_0x5c4e4e){var _0x28870b=_0x10fc83||client;return _0x28870b[_0x501f('0x1f')](_0x2834e7,_0x553951)[_0x501f('0x20')](function(_0x10e10f){logger[_0x501f('0x21')](_0x501f('0x22'),_0xd2f471,_0x501f('0x23'));logger[_0x501f('0x24')](_0x501f('0x25'),_0xd2f471,_0x501f('0x23'),JSON['stringify'](_0x10e10f));if(_0x10e10f['error']){if(_0x10e10f[_0x501f('0x26')][_0x501f('0x27')]===0x1f4){logger[_0x501f('0x26')](_0x501f('0x22'),_0xd2f471,_0x10e10f[_0x501f('0x26')][_0x501f('0x28')]);return _0x5c4e4e(_0x10e10f['error'][_0x501f('0x28')]);}logger[_0x501f('0x26')](_0x501f('0x22'),_0xd2f471,_0x10e10f['error'][_0x501f('0x28')]);return _0x279b32(_0x10e10f[_0x501f('0x26')]['message']);}else{logger[_0x501f('0x21')](_0x501f('0x22'),_0xd2f471,_0x501f('0x23'));_0x279b32(_0x10e10f[_0x501f('0x29')][_0x501f('0x28')]);}})[_0x501f('0x2a')](function(_0x3d6a83){logger['error'](_0x501f('0x22'),_0xd2f471,_0x3d6a83);_0x5c4e4e(_0x3d6a83);});});}function respondWithStatusCode(_0xdd1443,_0x31ca3b){_0x31ca3b=_0x31ca3b||0xcc;return function(_0x53799d){if(_0x53799d){return _0xdd1443[_0x501f('0x2b')](_0x31ca3b);}return _0xdd1443[_0x501f('0x2c')](_0x31ca3b)['end']();};}function respondWithResult(_0x5e6fba,_0x7ef493){_0x7ef493=_0x7ef493||0xc8;return function(_0x4c1da9){if(_0x4c1da9){return _0x5e6fba['status'](_0x7ef493)[_0x501f('0x2d')](_0x4c1da9);}};}function respondWithFilteredResult(_0x122ecf,_0x19e904){return function(_0x12e81b){if(_0x12e81b){var _0x48f011=_0x12e81b[_0x501f('0x2e')],_0x508c36=_0x19e904[_0x501f('0x2f')],_0x116b91=_0x19e904[_0x501f('0x2f')]+_0x19e904[_0x501f('0x30')],_0x5f58d4;if(_0x116b91>=_0x48f011){_0x116b91=_0x48f011;_0x5f58d4=0xc8;}else{_0x5f58d4=0xce;}_0x122ecf[_0x501f('0x2c')](_0x5f58d4);return _0x122ecf['set'](_0x501f('0x31'),_0x508c36+'-'+_0x116b91+'/'+_0x48f011)[_0x501f('0x2d')](_0x12e81b);}return null;};}function patchUpdates(_0x377163){return function(_0x2250ee){try{jsonpatch['apply'](_0x2250ee,_0x377163,!![]);}catch(_0xebfbfd){return BPromise[_0x501f('0x32')](_0xebfbfd);}return _0x2250ee[_0x501f('0x33')]();};}function saveUpdates(_0x1b7095,_0x108f58){return function(_0x225727){if(_0x225727){return _0x225727['update'](_0x1b7095)['then'](function(_0x1eddd9){return _0x1eddd9;});}return null;};}function removeEntity(_0x21aa85,_0x10108f){return function(_0x29c637){if(_0x29c637){return _0x29c637['destroy']()[_0x501f('0x20')](function(){var _0x522e52=_0x29c637[_0x501f('0x34')]({'plain':!![]});var _0x43af04=_0x501f('0x35');return db[_0x501f('0x36')][_0x501f('0x37')]({'where':{'type':_0x43af04,'resourceId':_0x522e52['id']}})[_0x501f('0x20')](function(){return _0x29c637;});})['then'](function(){_0x21aa85[_0x501f('0x2c')](0xcc)[_0x501f('0x38')]();});}};}function handleEntityNotFound(_0x2d26f0,_0x29c263){return function(_0x5d17b5){if(!_0x5d17b5){_0x2d26f0[_0x501f('0x2b')](0x194);}return _0x5d17b5;};}function handleError(_0x40cfd6,_0x20387a){_0x20387a=_0x20387a||0x1f4;return function(_0x21480c){logger['error'](_0x21480c[_0x501f('0x39')]);if(_0x21480c[_0x501f('0x3a')]){delete _0x21480c[_0x501f('0x3a')];}_0x40cfd6['status'](_0x20387a)[_0x501f('0x3b')](_0x21480c);};}exports[_0x501f('0x3c')]=function(_0x214255,_0x5874fe){var _0x20e2a2={'include':[{'model':db[_0x501f('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1ad67c={},_0x478570={'count':0x0,'rows':[]};var _0x4f2ce0=_['map'](db[_0x501f('0x3e')][_0x501f('0x3f')],function(_0x120c11){return{'name':_0x120c11[_0x501f('0x40')],'type':_0x120c11['type'][_0x501f('0x41')]};});_0x1ad67c[_0x501f('0x42')]=_[_0x501f('0x43')](_0x4f2ce0,_0x501f('0x3a'));_0x1ad67c[_0x501f('0x44')]=_['keys'](_0x214255[_0x501f('0x44')]);_0x1ad67c['filters']=_[_0x501f('0x45')](_0x1ad67c['model'],_0x1ad67c['query']);_0x20e2a2['attributes']=_[_0x501f('0x45')](_0x1ad67c[_0x501f('0x42')],qs[_0x501f('0x46')](_0x214255[_0x501f('0x44')][_0x501f('0x46')]));_0x20e2a2[_0x501f('0x47')]=_0x20e2a2[_0x501f('0x47')][_0x501f('0x48')]?_0x20e2a2[_0x501f('0x47')]:_0x1ad67c['model'];if(!_0x214255[_0x501f('0x44')]['hasOwnProperty'](_0x501f('0x49'))){_0x20e2a2[_0x501f('0x30')]=qs[_0x501f('0x30')](_0x214255[_0x501f('0x44')][_0x501f('0x30')]);_0x20e2a2['offset']=qs['offset'](_0x214255['query'][_0x501f('0x2f')]);}_0x20e2a2[_0x501f('0x4a')]=qs['sort'](_0x214255['query'][_0x501f('0x4b')]);_0x20e2a2[_0x501f('0x4c')]=qs[_0x501f('0x4d')](_[_0x501f('0x4e')](_0x214255[_0x501f('0x44')],_0x1ad67c[_0x501f('0x4d')]),_0x4f2ce0);if(_0x214255['query']['filter']){_0x20e2a2[_0x501f('0x4c')]=_[_0x501f('0x4f')](_0x20e2a2['where'],{'$or':_[_0x501f('0x43')](_0x4f2ce0,function(_0x45d06f){if(_0x45d06f[_0x501f('0x50')]!==_0x501f('0x51')){var _0x4bdb0e={};_0x4bdb0e[_0x45d06f[_0x501f('0x3a')]]={'$like':'%'+_0x214255[_0x501f('0x44')][_0x501f('0x52')]+'%'};return _0x4bdb0e;}})});}_0x20e2a2=_[_0x501f('0x4f')]({},_0x20e2a2,_0x214255[_0x501f('0x53')]);var _0x367a64={'where':_0x20e2a2['where']};return db[_0x501f('0x3e')][_0x501f('0x2e')](_0x367a64)[_0x501f('0x20')](function(_0x46e18a){_0x478570[_0x501f('0x2e')]=_0x46e18a;if(_0x214255['query'][_0x501f('0x54')]){_0x20e2a2[_0x501f('0x55')]=[{'all':!![]}];}return db[_0x501f('0x3e')][_0x501f('0x56')](_0x20e2a2);})[_0x501f('0x20')](function(_0x2a7601){_0x478570[_0x501f('0x57')]=_0x2a7601;return _0x478570;})[_0x501f('0x20')](respondWithFilteredResult(_0x5874fe,_0x20e2a2))[_0x501f('0x2a')](handleError(_0x5874fe,null));};exports[_0x501f('0x58')]=function(_0x318b1b,_0x2f697a){var _0x32a2f1={'raw':![],'where':{'id':_0x318b1b[_0x501f('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x6258cd={};_0x6258cd[_0x501f('0x42')]=_['keys'](db[_0x501f('0x3e')]['rawAttributes']);_0x6258cd['query']=_['keys'](_0x318b1b[_0x501f('0x44')]);_0x6258cd[_0x501f('0x4d')]=_[_0x501f('0x45')](_0x6258cd[_0x501f('0x42')],_0x6258cd[_0x501f('0x44')]);_0x32a2f1[_0x501f('0x47')]=_[_0x501f('0x45')](_0x6258cd['model'],qs['fields'](_0x318b1b[_0x501f('0x44')]['fields']));_0x32a2f1['attributes']=_0x32a2f1[_0x501f('0x47')][_0x501f('0x48')]?_0x32a2f1[_0x501f('0x47')]:_0x6258cd[_0x501f('0x42')];if(_0x318b1b[_0x501f('0x44')][_0x501f('0x54')]){_0x32a2f1[_0x501f('0x55')]=[{'all':!![]}];}_0x32a2f1=_[_0x501f('0x4f')]({},_0x32a2f1,_0x318b1b[_0x501f('0x53')]);return db[_0x501f('0x3e')][_0x501f('0x5a')](_0x32a2f1)[_0x501f('0x20')](handleEntityNotFound(_0x2f697a,null))[_0x501f('0x20')](respondWithResult(_0x2f697a,null))[_0x501f('0x2a')](handleError(_0x2f697a,null));};exports['create']=function(_0x3d52f0,_0x32289c){return db[_0x501f('0x3e')]['create'](_0x3d52f0['body'],{})[_0x501f('0x20')](function(_0x4a51d3){var _0x218eb8=_0x3d52f0[_0x501f('0x5b')][_0x501f('0x34')]({'plain':!![]});if(!_0x218eb8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x218eb8['role']==='user'){var _0x4f3d12=_0x4a51d3['get']({'plain':!![]});var _0x4ca934=_0x501f('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x4ca934,'userProfileId':_0x218eb8[_0x501f('0x5c')]},'raw':!![]})[_0x501f('0x20')](function(_0x1de08a){if(_0x1de08a&&_0x1de08a[_0x501f('0x5d')]===0x0){return db[_0x501f('0x36')]['create']({'name':_0x4f3d12[_0x501f('0x3a')],'resourceId':_0x4f3d12['id'],'type':_0x1de08a[_0x501f('0x3a')],'sectionId':_0x1de08a['id']},{})[_0x501f('0x20')](function(){return _0x4a51d3;});}else{return _0x4a51d3;}})[_0x501f('0x2a')](function(_0x1de14a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1de14a);throw _0x1de14a;});}return _0x4a51d3;})[_0x501f('0x20')](respondWithResult(_0x32289c,0xc9))[_0x501f('0x2a')](handleError(_0x32289c,null));};exports[_0x501f('0x5e')]=function(_0x9bdd1b,_0x2a60b3){if(_0x9bdd1b[_0x501f('0x5f')]['id']){delete _0x9bdd1b['body']['id'];}return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x9bdd1b[_0x501f('0x59')]['id']},'include':[{'model':db[_0x501f('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2a60b3,null))[_0x501f('0x20')](saveUpdates(_0x9bdd1b[_0x501f('0x5f')],null))[_0x501f('0x20')](respondWithResult(_0x2a60b3,null))['catch'](handleError(_0x2a60b3,null));};exports[_0x501f('0x37')]=function(_0x2584e9,_0x4fc506){return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x2584e9[_0x501f('0x59')]['id']}})['then'](handleEntityNotFound(_0x4fc506,null))[_0x501f('0x20')](removeEntity(_0x4fc506,null))[_0x501f('0x2a')](handleError(_0x4fc506,null));};exports[_0x501f('0x60')]=function(_0x2a4541,_0x6b66a8){return db[_0x501f('0x3e')][_0x501f('0x60')]()[_0x501f('0x20')](respondWithResult(_0x6b66a8,null))[_0x501f('0x2a')](handleError(_0x6b66a8,null));};exports[_0x501f('0x61')]=function(_0x43d0f5,_0x554dce,_0x37416b){if(_0x43d0f5['body']['id']){delete _0x43d0f5['body']['id'];}return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x43d0f5[_0x501f('0x59')]['id']}})['then'](handleEntityNotFound(_0x554dce,null))['then'](function(_0x5e9e5f){if(_0x5e9e5f){_0x43d0f5[_0x501f('0x5f')][_0x501f('0x62')]=_0x5e9e5f['id'];return db[_0x501f('0x63')][_0x501f('0x64')](_0x43d0f5[_0x501f('0x5f')]);}})[_0x501f('0x20')](respondWithResult(_0x554dce,null))[_0x501f('0x2a')](handleError(_0x554dce,null));};exports[_0x501f('0x65')]=function(_0x13a388,_0x3009da,_0x5d3005){var _0x4c7f2e={'raw':![],'where':{}};var _0x51a898={};var _0x5c9274={'count':0x0,'rows':[]};return db[_0x501f('0x3e')]['findOne']({'where':{'id':_0x13a388['params']['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x3009da,null))['then'](function(_0x4ec1b4){if(_0x4ec1b4){_0x51a898[_0x501f('0x42')]=_['keys'](db[_0x501f('0x63')]['rawAttributes']);_0x51a898[_0x501f('0x44')]=_[_0x501f('0x66')](_0x13a388['query']);_0x51a898[_0x501f('0x4d')]=_[_0x501f('0x45')](_0x51a898[_0x501f('0x42')],_0x51a898['query']);_0x4c7f2e[_0x501f('0x47')]=_[_0x501f('0x45')](_0x51a898[_0x501f('0x42')],qs[_0x501f('0x46')](_0x13a388[_0x501f('0x44')]['fields']));_0x4c7f2e['attributes']=_0x4c7f2e[_0x501f('0x47')][_0x501f('0x48')]?_0x4c7f2e[_0x501f('0x47')]:_0x51a898[_0x501f('0x42')];if(!_0x13a388[_0x501f('0x44')][_0x501f('0x67')](_0x501f('0x49'))){_0x4c7f2e[_0x501f('0x30')]=qs[_0x501f('0x30')](_0x13a388[_0x501f('0x44')][_0x501f('0x30')]);_0x4c7f2e[_0x501f('0x2f')]=qs[_0x501f('0x2f')](_0x13a388[_0x501f('0x44')][_0x501f('0x2f')]);}_0x4c7f2e[_0x501f('0x4a')]=qs['sort'](_0x13a388['query'][_0x501f('0x4b')]);_0x4c7f2e[_0x501f('0x4c')]=qs[_0x501f('0x4d')](_[_0x501f('0x4e')](_0x13a388[_0x501f('0x44')],_0x51a898[_0x501f('0x4d')]));_0x4c7f2e['where'][_0x501f('0x62')]=_0x4ec1b4['id'];if(_0x13a388[_0x501f('0x44')][_0x501f('0x52')]){_0x4c7f2e['where']=_['merge'](_0x4c7f2e['where'],{'$or':_[_0x501f('0x43')](_0x4c7f2e['attributes'],function(_0x2f0e03){var _0x234759={};_0x234759[_0x2f0e03]={'$like':'%'+_0x13a388[_0x501f('0x44')]['filter']+'%'};return _0x234759;})});}_0x4c7f2e=_['merge']({},_0x4c7f2e,_0x13a388[_0x501f('0x53')]);return db[_0x501f('0x63')][_0x501f('0x2e')]({'where':_0x4c7f2e[_0x501f('0x4c')]})[_0x501f('0x20')](function(_0x469e99){_0x5c9274[_0x501f('0x2e')]=_0x469e99;if(_0x13a388[_0x501f('0x44')]['includeAll']){_0x4c7f2e[_0x501f('0x55')]=[{'all':!![]}];}return db[_0x501f('0x63')][_0x501f('0x56')](_0x4c7f2e);})[_0x501f('0x20')](function(_0x28e0f5){_0x5c9274[_0x501f('0x57')]=_0x28e0f5;return _0x5c9274;});}})[_0x501f('0x20')](respondWithFilteredResult(_0x3009da,_0x4c7f2e))[_0x501f('0x2a')](handleError(_0x3009da,null));};exports[_0x501f('0x68')]=function(_0x39b875,_0x300d50,_0x1ec04d){return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x39b875[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x300d50,null))['then'](function(_0x3eaa5e){if(_0x3eaa5e){return _0x3eaa5e[_0x501f('0x68')](_0x39b875['query']['ids']);}})['then'](respondWithStatusCode(_0x300d50,null))[_0x501f('0x2a')](handleError(_0x300d50,null));};exports['addAnswer']=function(_0x257a16,_0x1f8665,_0x3e37a1){if(_0x257a16['body']['id']){delete _0x257a16[_0x501f('0x5f')]['id'];}return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x257a16['params']['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x1f8665,null))['then'](function(_0x491068){if(_0x491068){_0x257a16[_0x501f('0x5f')][_0x501f('0x62')]=_0x491068['id'];return db[_0x501f('0x69')][_0x501f('0x64')](_0x257a16[_0x501f('0x5f')]);}})[_0x501f('0x20')](respondWithResult(_0x1f8665,null))['catch'](handleError(_0x1f8665,null));};exports[_0x501f('0x6a')]=function(_0x4995c5,_0x422219,_0x14b878){var _0x303709={'raw':![],'where':{}};var _0x2e2a4b={};var _0x4491b1={'count':0x0,'rows':[]};return db[_0x501f('0x3e')][_0x501f('0x6b')]({'where':{'id':_0x4995c5[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x422219,null))[_0x501f('0x20')](function(_0x418ae5){if(_0x418ae5){_0x2e2a4b[_0x501f('0x42')]=_[_0x501f('0x66')](db[_0x501f('0x69')][_0x501f('0x3f')]);_0x2e2a4b[_0x501f('0x44')]=_[_0x501f('0x66')](_0x4995c5[_0x501f('0x44')]);_0x2e2a4b[_0x501f('0x4d')]=_[_0x501f('0x45')](_0x2e2a4b['model'],_0x2e2a4b[_0x501f('0x44')]);_0x303709[_0x501f('0x47')]=_[_0x501f('0x45')](_0x2e2a4b[_0x501f('0x42')],qs['fields'](_0x4995c5[_0x501f('0x44')]['fields']));_0x303709['attributes']=_0x303709[_0x501f('0x47')][_0x501f('0x48')]?_0x303709['attributes']:_0x2e2a4b['model'];if(!_0x4995c5[_0x501f('0x44')][_0x501f('0x67')]('nolimit')){_0x303709[_0x501f('0x30')]=qs[_0x501f('0x30')](_0x4995c5['query']['limit']);_0x303709[_0x501f('0x2f')]=qs[_0x501f('0x2f')](_0x4995c5[_0x501f('0x44')]['offset']);}_0x303709[_0x501f('0x4a')]=qs['sort'](_0x4995c5[_0x501f('0x44')][_0x501f('0x4b')]);_0x303709['where']=qs[_0x501f('0x4d')](_['pick'](_0x4995c5[_0x501f('0x44')],_0x2e2a4b[_0x501f('0x4d')]));_0x303709[_0x501f('0x4c')]['ChatWebsiteId']=_0x418ae5['id'];if(_0x4995c5[_0x501f('0x44')][_0x501f('0x52')]){_0x303709[_0x501f('0x4c')]=_[_0x501f('0x4f')](_0x303709['where'],{'$or':_[_0x501f('0x43')](_0x303709[_0x501f('0x47')],function(_0xc806c5){var _0x33c51b={};_0x33c51b[_0xc806c5]={'$like':'%'+_0x4995c5[_0x501f('0x44')]['filter']+'%'};return _0x33c51b;})});}_0x303709=_['merge']({},_0x303709,_0x4995c5['options']);return db[_0x501f('0x69')][_0x501f('0x2e')]({'where':_0x303709[_0x501f('0x4c')]})[_0x501f('0x20')](function(_0xf0fe4a){_0x4491b1['count']=_0xf0fe4a;if(_0x4995c5[_0x501f('0x44')][_0x501f('0x54')]){_0x303709[_0x501f('0x55')]=[{'all':!![]}];}return db[_0x501f('0x69')][_0x501f('0x56')](_0x303709);})[_0x501f('0x20')](function(_0x31caf7){_0x4491b1[_0x501f('0x57')]=_0x31caf7;return _0x4491b1;});}})[_0x501f('0x20')](respondWithFilteredResult(_0x422219,_0x303709))[_0x501f('0x2a')](handleError(_0x422219,null));};exports[_0x501f('0x6c')]=function(_0x1a6eea,_0x415262,_0x344f2d){return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x1a6eea[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x415262,null))[_0x501f('0x20')](function(_0x2f28c4){if(_0x2f28c4){return _0x2f28c4['removeAnswers'](_0x1a6eea[_0x501f('0x44')][_0x501f('0x6d')]);}})[_0x501f('0x20')](respondWithStatusCode(_0x415262,null))['catch'](handleError(_0x415262,null));};exports[_0x501f('0x6e')]=function(_0x11018d,_0x907364,_0x6f9535){_0x11018d[_0x501f('0x5f')][_0x501f('0x6f')]=_0x11018d[_0x501f('0x70')]['filename'];return db[_0x501f('0x3e')]['find']({'where':{'id':_0x11018d['params']['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x907364,null))[_0x501f('0x20')](saveUpdates(_0x11018d[_0x501f('0x5f')],null))[_0x501f('0x20')](respondWithResult(_0x907364,null))[_0x501f('0x2a')](handleError(_0x907364,null));};exports[_0x501f('0x71')]=function(_0x14cdbb,_0x6715d3,_0x50e777){_0x14cdbb['body'][_0x501f('0x72')]=_0x14cdbb[_0x501f('0x70')]['filename'];return db[_0x501f('0x3e')]['find']({'where':{'id':_0x14cdbb[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x6715d3,null))[_0x501f('0x20')](saveUpdates(_0x14cdbb[_0x501f('0x5f')],null))['then'](respondWithResult(_0x6715d3,null))['catch'](handleError(_0x6715d3,null));};exports[_0x501f('0x73')]=function(_0x575d09,_0x33c70a,_0x4077d8){_0x575d09[_0x501f('0x5f')]['customerAvatar']=_0x575d09[_0x501f('0x70')][_0x501f('0x74')];return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x575d09[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x33c70a,null))[_0x501f('0x20')](saveUpdates(_0x575d09[_0x501f('0x5f')],null))[_0x501f('0x20')](respondWithResult(_0x33c70a,null))['catch'](handleError(_0x33c70a,null));};exports[_0x501f('0x75')]=function(_0x2969d2,_0x1523ec,_0x234866){_0x2969d2['body']['systemAvatar']=_0x2969d2[_0x501f('0x70')][_0x501f('0x74')];return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x2969d2[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x1523ec,null))[_0x501f('0x20')](saveUpdates(_0x2969d2[_0x501f('0x5f')],null))[_0x501f('0x20')](respondWithResult(_0x1523ec,null))[_0x501f('0x2a')](handleError(_0x1523ec,null));};exports['getLogo']=function(_0x5293e8,_0x3fef8f,_0x43cddd){var _0x5dbec7=path[_0x501f('0x76')](config['root'],_0x501f('0x77'));var _0x39fbce={'where':{'id':_0x5293e8[_0x501f('0x59')]['id']},'attributes':['id',_0x501f('0x6f')],'raw':!![]};var _0x4b993b=![];return require(_0x501f('0x15'))[_0x501f('0x78')]()[_0x501f('0x20')](function(_0x16e45c){if(_0x16e45c){_0x4b993b=_0x16e45c[_0x501f('0x79')];}})[_0x501f('0x20')](function(){return db[_0x501f('0x3e')][_0x501f('0x5a')](_0x39fbce);})[_0x501f('0x20')](handleEntityNotFound(_0x3fef8f,null))[_0x501f('0x20')](function(_0x5e35d8){if(_0x5e35d8){if(!_[_0x501f('0x7a')](_0x5e35d8[_0x501f('0x6f')])){if(fs['existsSync'](path['join'](config['root'],_0x501f('0x7b'),_0x5e35d8[_0x501f('0x6f')]))&&_0x4b993b){_0x5dbec7=path[_0x501f('0x76')](config[_0x501f('0x7c')],_0x501f('0x7b'),_0x5e35d8[_0x501f('0x6f')]);}}return _0x3fef8f[_0x501f('0x7d')](_0x5dbec7);}})[_0x501f('0x2a')](handleError(_0x3fef8f,null));};exports[_0x501f('0x7e')]=function(_0x495969,_0x2b6a3c,_0x575da7){var _0x5e93e0=path['join'](config[_0x501f('0x7c')],_0x501f('0x7f'));var _0x57c0c5={'where':{'id':_0x495969[_0x501f('0x59')]['id']},'attributes':['id',_0x501f('0x72')],'raw':!![]};return db[_0x501f('0x3e')]['find'](_0x57c0c5)['then'](handleEntityNotFound(_0x2b6a3c,null))[_0x501f('0x20')](function(_0x2410c8){if(_0x2410c8){if(!_[_0x501f('0x7a')](_0x2410c8[_0x501f('0x72')])){if(fs['existsSync'](path[_0x501f('0x76')](config[_0x501f('0x7c')],_0x501f('0x80'),_0x2410c8[_0x501f('0x72')]))){_0x5e93e0=path[_0x501f('0x76')](config[_0x501f('0x7c')],_0x501f('0x80'),_0x2410c8[_0x501f('0x72')]);}}return _0x2b6a3c[_0x501f('0x7d')](_0x5e93e0);}})[_0x501f('0x2a')](handleError(_0x2b6a3c,null));};exports[_0x501f('0x81')]=function(_0x2fe50b,_0x2147a4,_0x8b02e4){var _0x51c191=path[_0x501f('0x76')](config[_0x501f('0x7c')],'server/files/images/avatars/customer_avatar.png');var _0x15a709={'where':{'id':_0x2fe50b[_0x501f('0x59')]['id']},'attributes':['id',_0x501f('0x82'),'showCustomerAvatar'],'raw':!![]};return db[_0x501f('0x3e')][_0x501f('0x5a')](_0x15a709)[_0x501f('0x20')](handleEntityNotFound(_0x2147a4,null))[_0x501f('0x20')](function(_0x4050af){if(_0x4050af){if(!_[_0x501f('0x7a')](_0x4050af['customerAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0x501f('0x80'),_0x4050af['customerAvatar']))&&_0x4050af['showCustomerAvatar']){_0x51c191=path[_0x501f('0x76')](config[_0x501f('0x7c')],_0x501f('0x80'),_0x4050af['customerAvatar']);}}return _0x2147a4['download'](_0x51c191);}})[_0x501f('0x2a')](handleError(_0x2147a4,null));};exports[_0x501f('0x83')]=function(_0x5f24cd,_0x674b29,_0x2ded7b){var _0x136824=path['join'](config[_0x501f('0x7c')],'server/files/images/avatars/system_avatar.png');var _0x5e7d6a={'where':{'id':_0x5f24cd[_0x501f('0x59')]['id']},'attributes':['id',_0x501f('0x84')],'raw':!![]};return db[_0x501f('0x3e')][_0x501f('0x5a')](_0x5e7d6a)[_0x501f('0x20')](handleEntityNotFound(_0x674b29,null))[_0x501f('0x20')](function(_0xce4d9e){if(_0xce4d9e){if(!_[_0x501f('0x7a')](_0xce4d9e['systemAvatar'])){if(fs[_0x501f('0x85')](path[_0x501f('0x76')](config['root'],_0x501f('0x80'),_0xce4d9e[_0x501f('0x84')]))){_0x136824=path['join'](config['root'],'server/files/images/avatars/',_0xce4d9e[_0x501f('0x84')]);}}return _0x674b29[_0x501f('0x7d')](_0x136824);}})[_0x501f('0x2a')](handleError(_0x674b29,null));};exports[_0x501f('0x86')]=function(_0x424462,_0x3cd447,_0x549c65){var _0x2e9bdf=require('user-agent-parser');var _0x57d463=new _0x2e9bdf();var _0x4ecfce=_0x57d463[_0x501f('0x87')](_0x424462[_0x501f('0x88')]['user-agent'])[_0x501f('0x89')]();var _0x1e2de0={'body':_0x424462['body'],'channel':'chat'};var _0x4ff778=[];var _0x143eb8=[];var _0x31b540={};var _0x2a2d81=![];return db[_0x501f('0x8a')]['describe']()[_0x501f('0x20')](function(_0x25e586){if(!_0x25e586){throw new db['Sequelize'][(_0x501f('0x8b'))](_0x501f('0x8c'));}_0x4ff778=_[_0x501f('0x8d')](_[_0x501f('0x66')](_0x25e586),[_0x501f('0x8e'),_0x501f('0x8f')]);_0x143eb8=_['difference'](_[_0x501f('0x66')](_0x25e586),[_0x501f('0x8e'),_0x501f('0x8f'),_0x501f('0x90'),'ListId']);if(_0x424462[_0x501f('0x5f')]['id']){delete _0x424462['body']['id'];}if(_['isNil'](_0x424462[_0x501f('0x5f')][_0x501f('0x91')])){throw new db[(_0x501f('0x92'))][(_0x501f('0x8b'))](_0x501f('0x93'));}if(_['isNil'](_0x424462[_0x501f('0x5f')][_0x501f('0x5f')])||_0x424462[_0x501f('0x5f')][_0x501f('0x5f')]===''){throw new db[(_0x501f('0x92'))][(_0x501f('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x424462[_0x501f('0x5f')]['mapKey'])){throw new db[(_0x501f('0x92'))][(_0x501f('0x8b'))](_0x501f('0x94')+_0x143eb8);}if(!_[_0x501f('0x95')](_0x143eb8,_0x424462['body'][_0x501f('0x96')])){throw new db['Sequelize']['ValidationError'](_0x501f('0x97')+_0x143eb8);}_0x31b540[_0x424462[_0x501f('0x5f')]['mapKey']]=_0x424462[_0x501f('0x5f')][_0x501f('0x91')];})[_0x501f('0x20')](function(){return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x424462[_0x501f('0x59')]['id']},'include':[{'model':db[_0x501f('0x98')],'as':_0x501f('0x99'),'include':[{'model':db[_0x501f('0x8a')],'as':_0x501f('0x9a'),'where':_0x31b540,'limit':0x1,'order':[['updatedAt',_0x501f('0x9b')]]}]},{'model':db[_0x501f('0x9c')],'as':'Applications'}]});})[_0x501f('0x20')](handleEntityNotFound(_0x3cd447,null))[_0x501f('0x20')](function(_0x21b240){if(_0x21b240&&_0x21b240[_0x501f('0x99')]){_0x1e2de0[_0x501f('0x9d')]=_0x21b240;_0x1e2de0[_0x501f('0x9e')]=_0x21b240[_0x501f('0x9f')];_0x1e2de0[_0x501f('0xa0')]=_0x21b240[_0x501f('0x99')];_0x1e2de0[_0x501f('0x9e')]=_[_0x501f('0xa1')](_0x1e2de0[_0x501f('0x9e')],[_0x501f('0xa2')],[_0x501f('0xa3')]);if(_0x1e2de0[_0x501f('0x9d')][_0x501f('0x9f')]){delete _0x1e2de0[_0x501f('0x9d')][_0x501f('0x9f')];}if(_0x1e2de0['account'][_0x501f('0x99')]&&_0x1e2de0[_0x501f('0x9d')][_0x501f('0x99')][_0x501f('0x9a')]['length']){return _0x1e2de0[_0x501f('0x9d')][_0x501f('0x99')]['Contacts'][0x0];}var _0x35235c=_[_0x501f('0xa4')](_0x424462['body'],{'firstName':_0x424462[_0x501f('0x5f')]['from'],'ListId':_0x21b240[_0x501f('0xa5')]});_0x35235c[_0x424462[_0x501f('0x5f')][_0x501f('0x96')]]=_0x424462[_0x501f('0x5f')]['from'];return db['CmContact']['create'](_0x35235c,{'fields':_0x4ff778,'raw':!![]});}})['then'](handleEntityNotFound(_0x3cd447,null))[_0x501f('0x20')](function(_0x1e4029){_0x1e2de0[_0x501f('0xa6')]=_0x1e4029;var _0x598ddb=_0x424462[_0x501f('0x5f')]['customerIp'];if(_0x424462['headers']['cf-connecting-ip']){_0x598ddb=_0x424462[_0x501f('0x88')][_0x501f('0xa7')];}else if(_0x424462[_0x501f('0x88')][_0x501f('0xa8')]){_0x598ddb=_['first'](_0x424462[_0x501f('0x88')][_0x501f('0xa8')]['split'](','));}if(_0x1e4029){var _0x26aea3={'ContactId':_0x1e4029['id'],'ChatWebsiteId':_0x424462['params']['id'],'from':(_0x1e4029['firstName']||'')+'\x20'+(_0x1e4029[_0x501f('0xa9')]||''),'customerIp':_0x598ddb,'customerPort':_0x424462[_0x501f('0x88')][_0x501f('0xaa')]?_0x424462['headers'][_0x501f('0xaa')]:null,'referer':_0x424462['body'][_0x501f('0xab')],'browserName':_0x4ecfce[_0x501f('0xac')]['name']&&_0x4ecfce[_0x501f('0xac')][_0x501f('0xad')]?util[_0x501f('0xae')](_0x501f('0xaf'),_0x4ecfce[_0x501f('0xac')][_0x501f('0x3a')],_0x4ecfce['browser'][_0x501f('0xad')]):_0x501f('0xb0'),'browserVersion':_0x4ecfce[_0x501f('0xac')][_0x501f('0xad')]||_0x501f('0xb0'),'osName':util[_0x501f('0xae')](_0x501f('0xaf'),_0x4ecfce['os'][_0x501f('0x3a')],_0x4ecfce['os'][_0x501f('0xad')]),'osVersion':_0x4ecfce['os'][_0x501f('0xad')],'deviceModel':_0x4ecfce['device']['model']&&_0x4ecfce[_0x501f('0xb1')]['vendor']?util[_0x501f('0xae')]('%s\x20%s\x20%s',_0x4ecfce[_0x501f('0xb1')][_0x501f('0x42')],_0x4ecfce[_0x501f('0xb1')][_0x501f('0xb2')],_0x4ecfce[_0x501f('0xb1')][_0x501f('0x50')]):null,'deviceVendor':_0x4ecfce['device'][_0x501f('0xb2')],'deviceType':_0x4ecfce[_0x501f('0xb1')][_0x501f('0x50')],'formData':JSON[_0x501f('0xb3')](_0x424462[_0x501f('0x5f')])};var _0x2b3016={'ChatWebsiteId':_0x424462[_0x501f('0x59')]['id'],'closed':![]};if(_0x424462[_0x501f('0x5f')][_0x501f('0xb4')]){_0x2b3016[_0x501f('0xb4')]=_0x424462[_0x501f('0x5f')]['threadId'];return db[_0x501f('0xb5')][_0x501f('0x5a')]({'where':_0x2b3016})[_0x501f('0x20')](function(_0x2256ac){if(_0x2256ac){return[_0x2256ac,![]];}_0x26aea3[_0x501f('0xb4')]=_0x424462[_0x501f('0x5f')][_0x501f('0xb4')];_0x26aea3[_0x501f('0xb6')]=_0x424462['body']['externalUrl'];return db['ChatInteraction'][_0x501f('0x64')](_0x26aea3)[_0x501f('0x20')](function(_0x122690){return[_0x122690,!![]];});});}_0x2b3016['ContactId']=_0x1e4029['id'];if(_0x424462[_0x501f('0x5f')][_0x501f('0xb7')]&&_0x424462[_0x501f('0x5f')][_0x501f('0xb7')]['id']){_0x2b3016['id']=_0x424462['body'][_0x501f('0xb7')]['id'];return db[_0x501f('0xb5')][_0x501f('0x5a')]({'where':_0x2b3016})[_0x501f('0x20')](function(_0x2be9ec){if(_0x2be9ec){return[_0x2be9ec,![]];}return db[_0x501f('0xb5')][_0x501f('0x64')](_0x26aea3)[_0x501f('0x20')](function(_0x184e6c){return[_0x184e6c,!![]];});});}return db[_0x501f('0xb5')][_0x501f('0x64')](_0x26aea3)[_0x501f('0x20')](function(_0x47b778){return[_0x47b778,!![]];});}})[_0x501f('0xb8')](function(_0x731db8,_0x2391a4){if(_0x731db8){_0x2a2d81=_0x2391a4;if(!_0x2391a4){var _0x20afbc={'from':(_0x1e2de0['contact'][_0x501f('0xb9')]||'')+'\x20'+(_0x1e2de0[_0x501f('0xa6')]['lastName']||'')};if(_0x424462[_0x501f('0x5f')][_0x501f('0xb4')]&&_0x424462['body'][_0x501f('0xba')]&&_0x424462[_0x501f('0x5f')][_0x501f('0xb4')]!=_0x424462[_0x501f('0x5f')][_0x501f('0xba')]){_0x20afbc[_0x501f('0xb4')]=_0x424462[_0x501f('0x5f')]['messageId'];}return _0x731db8['update'](_0x20afbc);}else{return _0x731db8;}}})[_0x501f('0x20')](function(_0x300bb6){_0x1e2de0['interaction']=_0x300bb6[_0x501f('0x34')]({'plain':!![]});_0x1e2de0[_0x501f('0xb7')]['created']=_0x2a2d81;if(_0x1e2de0['interaction'][_0x501f('0xbb')]){if(_0x1e2de0[_0x501f('0x9d')]['autoclose']){_0x1e2de0[_0x501f('0x9e')][_0x501f('0xbc')]({'id':0x0,'priority':_0x1e2de0['applications'][_0x501f('0x48')]+0x1,'app':_0x501f('0xbd'),'appdata':_0x501f('0xbe'),'interval':_0x501f('0xbf')});}}return db[_0x501f('0xc0')]['create']({'body':_0x424462[_0x501f('0x5f')]['body'],'ChatWebsiteId':_0x424462[_0x501f('0x59')]['id'],'ChatInteractionId':_0x300bb6['id'],'direction':'in','ContactId':_0x1e2de0[_0x501f('0xa6')]['id'],'AttachmentId':_0x424462[_0x501f('0x5f')][_0x501f('0xc1')]});})[_0x501f('0x20')](function(_0x374f5d){_0x1e2de0[_0x501f('0x28')]=_0x374f5d;if(_0x1e2de0[_0x501f('0xb7')][_0x501f('0xc2')]){return db[_0x501f('0xc3')]['find']({'attributes':['id','name'],'where':{'id':_0x1e2de0[_0x501f('0xb7')][_0x501f('0xc2')]}})[_0x501f('0x20')](function(_0x16babc){if(_0x16babc){_0x1e2de0[_0x501f('0x9e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x501f('0xc4'),'appdata':_0x16babc[_0x501f('0x3a')]+','+(_0x1e2de0[_0x501f('0x9d')][_0x501f('0xc5')]||0xa),'interval':'*,*,*,*'});_0x1e2de0['forcedOwnership']=!![];}return respondWithRpcPromise(_0x501f('0xc6'),_0x501f('0xc7'),_0x1e2de0);});}return respondWithRpcPromise(_0x501f('0xc6'),_0x501f('0xc7'),_0x1e2de0);})[_0x501f('0x20')](function(_0x29c6d3){respondWithRpcPromise(_0x501f('0xc8'),'EventManager',{'event':_0x501f('0x86'),'message':_0x29c6d3},client9002);return _0x29c6d3;})[_0x501f('0x20')](respondWithResult(_0x3cd447,null))[_0x501f('0x2a')](handleError(_0x3cd447,null));};exports[_0x501f('0xc9')]=function(_0x2ab01d,_0x540543,_0x43c841){var _0x40af53,_0x40ae97,_0x369699;var _0x1722f9=[];var _0x4653f4=[];var _0x297d94={};return db[_0x501f('0x8a')][_0x501f('0x60')]()[_0x501f('0x20')](function(_0x2b6b12){if(!_0x2b6b12){throw new db[(_0x501f('0x92'))][(_0x501f('0x8b'))](_0x501f('0x8c'));}_0x4653f4=_[_0x501f('0x8d')](_[_0x501f('0x66')](_0x2b6b12),[_0x501f('0x8e'),_0x501f('0x8f')]);_0x1722f9=_[_0x501f('0x8d')](_[_0x501f('0x66')](_0x2b6b12),['createdAt','updatedAt','CompanyId','ListId']);if(_0x2ab01d[_0x501f('0x5f')]['id']){delete _0x2ab01d[_0x501f('0x5f')]['id'];}if(_[_0x501f('0x7a')](_0x2ab01d['body'][_0x501f('0x91')])){throw _0x540543['status'](0x1f4)['send'](new db[(_0x501f('0x92'))]['ValidationError'](_0x501f('0x93')));}if(_['isNil'](_0x2ab01d[_0x501f('0x5f')][_0x501f('0x5f')])||_0x2ab01d[_0x501f('0x5f')][_0x501f('0x5f')]===''){throw _0x540543['status'](0x1f4)[_0x501f('0x3b')](new db['Sequelize'][(_0x501f('0x8b'))](_0x501f('0xca')));}if(_[_0x501f('0x7a')](_0x2ab01d['body'][_0x501f('0xcb')])){throw _0x540543['status'](0x1f4)['send'](new db['Sequelize'][(_0x501f('0x8b'))](_0x501f('0xcc')+_0x1722f9));}if(!_[_0x501f('0x95')](_0x1722f9,_0x2ab01d[_0x501f('0x5f')][_0x501f('0xcb')])){throw _0x540543[_0x501f('0x2c')](0x1f4)[_0x501f('0x3b')](new db['Sequelize'][(_0x501f('0x8b'))](_0x501f('0xcd')+_0x1722f9));}_0x297d94[_0x2ab01d['body'][_0x501f('0xcb')]]=_0x2ab01d['body'][_0x501f('0x91')];})['then'](function(){return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x2ab01d[_0x501f('0x59')]['id']},'include':[{'model':db[_0x501f('0x98')],'as':_0x501f('0x99')}]});})['then'](handleEntityNotFound(_0x540543,null))[_0x501f('0x20')](function(_0x24b4d7){if(_0x24b4d7&&_0x24b4d7['List']){_0x40ae97=_0x24b4d7;var _0x126309=_[_0x501f('0xa4')](_0x2ab01d[_0x501f('0x5f')],{'firstName':_0x2ab01d['body'][_0x501f('0x91')],'phone':_0x2ab01d[_0x501f('0x5f')][_0x501f('0x91')],'ListId':_0x24b4d7[_0x501f('0xa5')]});_0x126309[_0x2ab01d[_0x501f('0x5f')][_0x501f('0xcb')]]=_0x2ab01d[_0x501f('0x5f')][_0x501f('0x91')];return db[_0x501f('0x8a')][_0x501f('0xce')]({'where':_0x297d94,'defaults':_0x126309});}})[_0x501f('0xb8')](function(_0x45e1f8){if(_0x45e1f8){_0x369699=_0x45e1f8;var _0x4081ce=fs[_0x501f('0xcf')](path['join'](config[_0x501f('0x7c')],_0x501f('0xd0')),_0x501f('0xd1'));var _0x5d6046=ejs['render'](_0x4081ce,{'body':_[_0x501f('0xd2')](_0x2ab01d[_0x501f('0x5f')]['body']),'bodyTitle':_0x40ae97[_0x501f('0xd3')]});return db['ChatOfflineMessage'][_0x501f('0x64')]({'body':_0x5d6046,'ContactId':_0x45e1f8['id'],'ChatWebsiteId':_0x40ae97['id']});}})[_0x501f('0x20')](function(_0x284e69){if(_0x284e69){_0x40af53=_0x284e69;return db[_0x501f('0xd4')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x501f('0xd5')],'as':'Smtp','raw':!![]}]});}})[_0x501f('0x20')](function(_0x4f48e3){if(_0x4f48e3&&_0x4f48e3[_0x501f('0xd6')]&&_0x40ae97[_0x501f('0xd7')]){var _0x5ed30d={'tls':{'rejectUnauthorized':![]}};if(_0x4f48e3[_0x501f('0xd6')][_0x501f('0xd8')]){_0x5ed30d['service']=_0x4f48e3[_0x501f('0xd6')][_0x501f('0xd8')];}else{_0x5ed30d[_0x501f('0xd9')]=_0x4f48e3[_0x501f('0xd6')][_0x501f('0xd9')];_0x5ed30d['port']=_0x4f48e3[_0x501f('0xd6')][_0x501f('0xda')];_0x5ed30d[_0x501f('0xdb')]=_0x4f48e3[_0x501f('0xd6')]['secure'];}if(_0x4f48e3[_0x501f('0xd6')][_0x501f('0xdc')]){_0x5ed30d[_0x501f('0xdd')]={'user':_0x4f48e3[_0x501f('0xd6')][_0x501f('0x5b')],'pass':_0x4f48e3[_0x501f('0xd6')][_0x501f('0xde')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5ed30d,'message':{'from':util[_0x501f('0xae')]('\x22%s\x22\x20<%s>',_0x4f48e3['name'],_0x4f48e3['email']||_0x4f48e3[_0x501f('0xd6')][_0x501f('0x5b')]),'to':_0x40ae97[_0x501f('0xd7')],'subject':_0x40ae97[_0x501f('0xdf')],'text':_0x40af53['body']}},client9003)[_0x501f('0x20')](function(){return _0x40af53;})[_0x501f('0x2a')](function(_0x49629a){console['error'](_0x49629a);});}})['then'](function(){if(_0x40af53){return _0x40af53;}})[_0x501f('0x20')](respondWithResult(_0x540543,null))[_0x501f('0x2a')](handleError(_0x540543,null));};exports[_0x501f('0xe0')]=function(_0x1e5d92,_0x4da21b,_0x58fa82){return db['ChatInteraction'][_0x501f('0x5a')]({'where':{'id':_0x1e5d92[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x4da21b,null))['then'](function(_0x335012){if(_0x335012){return _0x335012[_0x501f('0xe0')](_0x1e5d92[_0x501f('0x5f')]['ids'],_['omit'](_0x1e5d92[_0x501f('0x5f')],[_0x501f('0x6d'),'id'])||{});}})[_0x501f('0x20')](respondWithResult(_0x4da21b,null))[_0x501f('0x2a')](handleError(_0x4da21b,null));};exports[_0x501f('0xe1')]=function(_0xcdad27,_0x1ff14f,_0x3c26d3){var _0x36928e={'raw':![],'where':{}};var _0x105500={};var _0x5a5533={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x501f('0x6b')]({'where':{'id':_0xcdad27[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x1ff14f,null))['then'](function(_0x405eaa){if(_0x405eaa){_0x105500[_0x501f('0x42')]=_[_0x501f('0x66')](db[_0x501f('0xb5')][_0x501f('0x3f')]);_0x105500[_0x501f('0x44')]=_['keys'](_0xcdad27[_0x501f('0x44')]);_0x105500['filters']=_['intersection'](_0x105500[_0x501f('0x42')],_0x105500[_0x501f('0x44')]);_0x36928e['attributes']=_[_0x501f('0x45')](_0x105500['model'],qs[_0x501f('0x46')](_0xcdad27[_0x501f('0x44')]['fields']));_0x36928e[_0x501f('0x47')]=_0x36928e[_0x501f('0x47')][_0x501f('0x48')]?_0x36928e[_0x501f('0x47')]:_0x105500[_0x501f('0x42')];if(!_0xcdad27[_0x501f('0x44')][_0x501f('0x67')](_0x501f('0x49'))){_0x36928e[_0x501f('0x30')]=qs[_0x501f('0x30')](_0xcdad27[_0x501f('0x44')][_0x501f('0x30')]);_0x36928e[_0x501f('0x2f')]=qs[_0x501f('0x2f')](_0xcdad27[_0x501f('0x44')][_0x501f('0x2f')]);}_0x36928e[_0x501f('0x4a')]=qs['sort'](_0xcdad27[_0x501f('0x44')][_0x501f('0x4b')]);_0x36928e[_0x501f('0x4c')]=qs[_0x501f('0x4d')](_['pick'](_0xcdad27['query'],_0x105500[_0x501f('0x4d')]));_0x36928e['where'][_0x501f('0x62')]=_0x405eaa['id'];if(_0xcdad27['query'][_0x501f('0x52')]){_0x36928e[_0x501f('0x4c')]=_[_0x501f('0x4f')](_0x36928e[_0x501f('0x4c')],{'$or':_[_0x501f('0x43')](_0x36928e[_0x501f('0x47')],function(_0x1f7d24){var _0x452f3b={};_0x452f3b[_0x1f7d24]={'$like':'%'+_0xcdad27['query'][_0x501f('0x52')]+'%'};return _0x452f3b;})});}_0x36928e=_['merge']({},_0x36928e,_0xcdad27['options']);return db[_0x501f('0xb5')][_0x501f('0x2e')]({'where':_0x36928e['where']})[_0x501f('0x20')](function(_0x23f536){_0x5a5533['count']=_0x23f536;if(_0xcdad27[_0x501f('0x44')][_0x501f('0x54')]){_0x36928e[_0x501f('0x55')]=[{'model':db[_0x501f('0x8a')],'as':_0x501f('0xe2'),'required':![]},{'model':db[_0x501f('0xc3')],'as':_0x501f('0xe3'),'attributes':[_0x501f('0x3a'),'fullname',_0x501f('0xe4')],'required':![]},{'model':db[_0x501f('0xe5')],'as':_0x501f('0xe6'),'attributes':['id',_0x501f('0x3a'),_0x501f('0xe7')],'where':_0xcdad27[_0x501f('0x44')]['tag']?{'id':_0xcdad27[_0x501f('0x44')]['tag']}:undefined,'required':_0xcdad27[_0x501f('0x44')]['tag']?!![]:![]}];}return db[_0x501f('0xb5')][_0x501f('0x56')](_0x36928e);})[_0x501f('0x20')](function(_0x266474){_0x5a5533[_0x501f('0x57')]=_0x266474;return _0x5a5533;});}})[_0x501f('0x20')](respondWithFilteredResult(_0x1ff14f,_0x36928e))[_0x501f('0x2a')](handleError(_0x1ff14f,null));};function iftimePromise(_0x2c9986,_0x553bc2){return respondWithRpcPromise('Command',_0x501f('0xe8'),{'command':_0x553bc2[_0x501f('0xe9')]?util['format'](_0x501f('0xea'),_0x2c9986[_0x501f('0xeb')],_0x553bc2['timezone']):util[_0x501f('0xae')]('iftime\x20%s',_0x2c9986[_0x501f('0xeb')])},client9002)[_0x501f('0x20')](function(_0x9ce9ed){var _0x357938=_0x9ce9ed&&_0x9ce9ed[_0x501f('0xec')](_0x501f('0xed'))>=0x0?!![]:![];logger[_0x501f('0x21')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x553bc2['id'],_0x2c9986['id'],_0x2c9986[_0x501f('0xeb')],_0x357938?_0x501f('0xee'):_0x501f('0xef'),_0x553bc2[_0x501f('0xe9')]?_0x553bc2['timezone']:'No\x20timezone');return _0x357938;})['catch'](function(_0xc23ead){logger[_0x501f('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x553bc2['id'],_0x2c9986['id'],_0x2c9986[_0x501f('0xeb')],util[_0x501f('0xf0')](_0xc23ead,{'showHidden':![],'depth':null}),_0x553bc2[_0x501f('0xe9')]?_0x553bc2[_0x501f('0xe9')]:_0x501f('0xf1'));return![];});}exports[_0x501f('0xe8')]=function(_0xd7e204,_0x284635,_0x4889f8){var _0x418250=0x0;var _0x305d12=0x0;var _0x5c84b7=![];var _0x1b4f59;var _0x1a04ec;return db[_0x501f('0x3e')]['find']({'where':{'id':_0xd7e204[_0x501f('0x59')]['id']},'include':[{'model':db[_0x501f('0xf2')],'as':_0x501f('0xf2'),'include':[{'model':db[_0x501f('0xf2')],'as':_0x501f('0xf3'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x284635,null))[_0x501f('0x20')](function(_0x5e9ac3){if(_0x5e9ac3){_0x1b4f59=_0x5e9ac3;return _0x5e9ac3[_0x501f('0xf4')]({'raw':!![]});}})[_0x501f('0x20')](function(_0x2043db){if(_0x1b4f59){if(_0x2043db){_0x1a04ec=_0x2043db;}}return require('../../config/license/util')[_0x501f('0x78')]();})[_0x501f('0x20')](function(_0x754098){if(_0x754098){_0x305d12=_0x754098[_0x501f('0xf5')];_0x5c84b7=_0x754098['custom'];}})[_0x501f('0x20')](function(){return db[_0x501f('0xb5')][_0x501f('0x2e')]({'where':{'closed':![]}});})[_0x501f('0x20')](function(_0x3a152d){_0x418250=_0x3a152d;if(_0x305d12&&_0x3a152d>_0x305d12){return db['License']['findOne']({'where':{'id':0x1}})[_0x501f('0x20')](function(_0x1c05ad){if(_0x1c05ad){_0x1c05ad[_0x501f('0xf6')](_0x501f('0xf7'));}});}})[_0x501f('0x20')](function(){if(_0x1b4f59[_0x501f('0xf2')]&&_0x1b4f59[_0x501f('0xf2')][_0x501f('0xf3')]){var _0x49c9c1=[];for(var _0x4174c4=0x0;_0x4174c4<_0x1b4f59['Interval']['Intervals'][_0x501f('0x48')];_0x4174c4++){var _0x2ed7ce=_0x1b4f59[_0x501f('0xf2')][_0x501f('0xf3')][_0x4174c4][_0x501f('0x34')]({'plain':!![]});_0x49c9c1[_0x501f('0xbc')](iftimePromise(_0x2ed7ce,_0x1b4f59));}return BPromise[_0x501f('0xf8')](_0x49c9c1)[_0x501f('0x20')](function(_0x45a2f1){return _[_0x501f('0xf9')](_0x45a2f1);});}else{return!![];}})[_0x501f('0x20')](function(_0x279782){var _0x3caa96=fs[_0x501f('0xcf')](path['join'](config['root'],_0x501f('0xfa')),'utf8');var _0x5be650={'remote':_0x1b4f59['remote'],'query':querystring[_0x501f('0xb3')](_[_0x501f('0x4f')](_0x1b4f59[_0x501f('0x34')]({'plain':!![]}),{'customerIp':_0xd7e204[_0x501f('0x88')]['x-forwarded-for']||_0xd7e204[_0x501f('0x88')][_0x501f('0xfb')]||_0xd7e204[_0x501f('0xfc')]['remoteAddress']||_0xd7e204['ip'],'referer':_0xd7e204[_0x501f('0x88')]['referer'],'openedInteractions':_0x418250,'maxInteractions':_0x305d12,'virtual':_0x5c84b7[_0x501f('0xf5')],'online':_0x279782,'custom':_0x5c84b7}))[_0x501f('0xfd')](/'/g,'\x5c\x27')};_0x284635[_0x501f('0x3b')](ejs[_0x501f('0xfe')](Mustache[_0x501f('0xfe')](_0x3caa96,_0x5be650),{'proactiveActions':_0x1a04ec,'alignment':_0x1b4f59[_0x501f('0xff')],'verticalAlignment':_0x1b4f59[_0x501f('0x100')],'div_color':_0x1b4f59['color'],'text_color':_0x1b4f59['textColor']}));})[_0x501f('0x2a')](handleError(_0x284635,null));};exports[_0x501f('0x101')]=function(_0x16d168,_0x282831,_0x14ff8b){return db[_0x501f('0x3e')]['findOne']({'where':{'id':_0x16d168[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x282831,null))[_0x501f('0x20')](function(_0x2b0da2){if(_0x2b0da2){return db[_0x501f('0x102')][_0x501f('0x103')](function(_0x2ef9e3){return db[_0x501f('0x9c')]['destroy']({'where':{'ChatWebsiteId':_0x16d168[_0x501f('0x59')]['id']},'transaction':_0x2ef9e3})[_0x501f('0x20')](function(_0x46d98b){var _0x309617=_['map'](_0x16d168[_0x501f('0x5f')],function(_0x240ba9){_0x240ba9[_0x501f('0x62')]=_0x16d168[_0x501f('0x59')]['id'];return _0x240ba9;});return db['ChatApplication'][_0x501f('0x104')](_0x309617,{'transaction':_0x2ef9e3});});})[_0x501f('0x20')](function(){return db['ChatApplication'][_0x501f('0x105')]({'where':{'ChatWebsiteId':_0x16d168[_0x501f('0x59')]['id']},'order':_0x501f('0xa2')});});}})[_0x501f('0x20')](respondWithResult(_0x282831,null))['catch'](handleError(_0x282831,null));};exports['getApplications']=function(_0xd66030,_0x4237ab,_0x5d4007){var _0x39eb3b={};var _0x440e01={};var _0x468677;var _0x409a59;return db[_0x501f('0x3e')][_0x501f('0x6b')]({'where':{'id':_0xd66030[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x4237ab,null))[_0x501f('0x20')](function(_0xd3aff6){if(_0xd3aff6){_0x468677=_0xd3aff6;_0x440e01['model']=_[_0x501f('0x66')](db['ChatApplication'][_0x501f('0x3f')]);_0x440e01['query']=_[_0x501f('0x66')](_0xd66030['query']);_0x440e01[_0x501f('0x4d')]=_['intersection'](_0x440e01[_0x501f('0x42')],_0x440e01['query']);_0x39eb3b['attributes']=_[_0x501f('0x45')](_0x440e01[_0x501f('0x42')],qs[_0x501f('0x46')](_0xd66030['query'][_0x501f('0x46')]));_0x39eb3b[_0x501f('0x47')]=_0x39eb3b[_0x501f('0x47')][_0x501f('0x48')]?_0x39eb3b[_0x501f('0x47')]:_0x440e01[_0x501f('0x42')];_0x39eb3b[_0x501f('0x4a')]=qs['sort'](_0xd66030['query'][_0x501f('0x4b')]);_0x39eb3b[_0x501f('0x4c')]=qs[_0x501f('0x4d')](_['pick'](_0xd66030[_0x501f('0x44')],_0x440e01[_0x501f('0x4d')]));if(_0xd66030['query']['filter']){_0x39eb3b[_0x501f('0x4c')]=_[_0x501f('0x4f')](_0x39eb3b[_0x501f('0x4c')],{'$or':_[_0x501f('0x43')](_0x39eb3b[_0x501f('0x47')],function(_0x3679e7){var _0x1576dc={};_0x1576dc[_0x3679e7]={'$like':'%'+_0xd66030[_0x501f('0x44')][_0x501f('0x52')]+'%'};return _0x1576dc;})});}_0x39eb3b=_['merge']({},_0x39eb3b,_0xd66030['options']);return _0x468677[_0x501f('0x106')](_0x39eb3b);}})['then'](function(_0x57432d){if(_0x57432d){_0x409a59=_0x57432d['length'];if(!_0xd66030[_0x501f('0x44')]['hasOwnProperty'](_0x501f('0x49'))){_0x39eb3b[_0x501f('0x30')]=qs[_0x501f('0x30')](_0xd66030['query'][_0x501f('0x30')]);_0x39eb3b[_0x501f('0x2f')]=qs['offset'](_0xd66030[_0x501f('0x44')][_0x501f('0x2f')]);}return _0x468677[_0x501f('0x106')](_0x39eb3b);}})['then'](function(_0x29e92e){if(_0x29e92e){return _0x29e92e?{'count':_0x409a59,'rows':_0x29e92e}:null;}})[_0x501f('0x20')](respondWithResult(_0x4237ab,null))[_0x501f('0x2a')](handleError(_0x4237ab,null));};exports[_0x501f('0x107')]=function(_0x2f70f2,_0x3055ee,_0x356209){return db['chatProactiveAction'][_0x501f('0x5a')]({'where':{'id':_0x2f70f2[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x3055ee,null))[_0x501f('0x20')](function(_0xe2fcd9){if(_0xe2fcd9){return _0xe2fcd9['addProactiveActions'](_0x2f70f2[_0x501f('0x5f')][_0x501f('0x6d')],_[_0x501f('0x108')](_0x2f70f2[_0x501f('0x5f')],[_0x501f('0x6d'),'id'])||{});}})[_0x501f('0x20')](respondWithResult(_0x3055ee,null))['catch'](handleError(_0x3055ee,null));};exports['getProactiveActions']=function(_0x2aa809,_0x2bf054,_0x471954){var _0x37d922={};var _0x48c327={};var _0x37da6d;var _0x3b4e24;return db[_0x501f('0x3e')][_0x501f('0x6b')]({'where':{'id':_0x2aa809['params']['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x2bf054,null))[_0x501f('0x20')](function(_0x1d9f35){if(_0x1d9f35){_0x37da6d=_0x1d9f35;_0x48c327[_0x501f('0x42')]=_['keys'](db[_0x501f('0x109')][_0x501f('0x3f')]);_0x48c327[_0x501f('0x44')]=_[_0x501f('0x66')](_0x2aa809[_0x501f('0x44')]);_0x48c327['filters']=_[_0x501f('0x45')](_0x48c327[_0x501f('0x42')],_0x48c327[_0x501f('0x44')]);_0x37d922['attributes']=_['intersection'](_0x48c327[_0x501f('0x42')],qs[_0x501f('0x46')](_0x2aa809[_0x501f('0x44')][_0x501f('0x46')]));_0x37d922[_0x501f('0x47')]=_0x37d922[_0x501f('0x47')][_0x501f('0x48')]?_0x37d922[_0x501f('0x47')]:_0x48c327[_0x501f('0x42')];_0x37d922['order']=qs[_0x501f('0x4b')](_0x2aa809['query']['sort']);_0x37d922[_0x501f('0x4c')]=qs['filters'](_[_0x501f('0x4e')](_0x2aa809[_0x501f('0x44')],_0x48c327['filters']));if(_0x2aa809[_0x501f('0x44')]['filter']){_0x37d922['where']=_[_0x501f('0x4f')](_0x37d922['where'],{'$or':_[_0x501f('0x43')](_0x37d922[_0x501f('0x47')],function(_0x1add56){var _0x49620a={};_0x49620a[_0x1add56]={'$like':'%'+_0x2aa809['query'][_0x501f('0x52')]+'%'};return _0x49620a;})});}_0x37d922=_[_0x501f('0x4f')]({},_0x37d922,_0x2aa809[_0x501f('0x53')]);return _0x37da6d['getProactiveActions'](_0x37d922);}})[_0x501f('0x20')](function(_0x1dcc03){if(_0x1dcc03){_0x3b4e24=_0x1dcc03[_0x501f('0x48')];if(!_0x2aa809[_0x501f('0x44')]['hasOwnProperty'](_0x501f('0x49'))){_0x37d922['limit']=qs[_0x501f('0x30')](_0x2aa809[_0x501f('0x44')][_0x501f('0x30')]);_0x37d922[_0x501f('0x2f')]=qs[_0x501f('0x2f')](_0x2aa809[_0x501f('0x44')][_0x501f('0x2f')]);}return _0x37da6d[_0x501f('0xf4')](_0x37d922);}})['then'](function(_0x5039a0){if(_0x5039a0){return _0x5039a0?{'count':_0x3b4e24,'rows':_0x5039a0}:null;}})[_0x501f('0x20')](respondWithResult(_0x2bf054,null))['catch'](handleError(_0x2bf054,null));};exports[_0x501f('0x10a')]=function(_0x7dd32a,_0x1ea59b,_0x289f91){var _0x469984=_0x7dd32a[_0x501f('0x44')][_0x501f('0x10b')]===_0x501f('0x10c')?_0x501f('0x10d'):_0x501f('0x10e');return db['ChatWebsite']['find']({'attributes':['id',_0x469984],'where':{'id':_0x7dd32a[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x1ea59b,null))[_0x501f('0x20')](function(_0x165f3d){if(_0x165f3d){var _0x5aa385=_0x165f3d[_0x469984];var _0x31bcd8=_0x5aa385&&_0x5aa385[_0x501f('0x10f')]?_0x5aa385[_0x501f('0x10f')]:[];_0x1ea59b[_0x501f('0x3b')]({'fromKey':_[_0x501f('0x7a')](_0x5aa385['fromKey'])?undefined:_0x5aa385[_0x501f('0x110')],'count':_0x31bcd8['length'],'rows':_0x31bcd8});}})[_0x501f('0x2a')](handleError(_0x1ea59b,null));};exports[_0x501f('0x111')]=function(_0x15f296,_0x5e7f29,_0x56e99c){var _0x2b7bbc={'raw':![],'where':{}};var _0xc0f457={};var _0x4f959b={'count':0x0,'rows':[]};return db[_0x501f('0x3e')][_0x501f('0x6b')]({'where':{'id':_0x15f296[_0x501f('0x59')]['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x5e7f29,null))['then'](function(_0x5167ec){if(_0x5167ec){_0xc0f457['model']=_[_0x501f('0x66')](db[_0x501f('0x112')][_0x501f('0x3f')]);_0xc0f457[_0x501f('0x44')]=_[_0x501f('0x66')](_0x15f296[_0x501f('0x44')]);_0xc0f457[_0x501f('0x4d')]=_[_0x501f('0x45')](_0xc0f457['model'],_0xc0f457[_0x501f('0x44')]);_0x2b7bbc[_0x501f('0x47')]=_[_0x501f('0x45')](_0xc0f457[_0x501f('0x42')],qs[_0x501f('0x46')](_0x15f296[_0x501f('0x44')]['fields']));_0x2b7bbc[_0x501f('0x47')]=_0x2b7bbc['attributes'][_0x501f('0x48')]?_0x2b7bbc['attributes']:_0xc0f457[_0x501f('0x42')];if(!_0x15f296[_0x501f('0x44')][_0x501f('0x67')](_0x501f('0x49'))){_0x2b7bbc[_0x501f('0x30')]=qs[_0x501f('0x30')](_0x15f296[_0x501f('0x44')][_0x501f('0x30')]);_0x2b7bbc[_0x501f('0x2f')]=qs[_0x501f('0x2f')](_0x15f296['query'][_0x501f('0x2f')]);}_0x2b7bbc[_0x501f('0x4a')]=qs[_0x501f('0x4b')](_0x15f296[_0x501f('0x44')][_0x501f('0x4b')]);_0x2b7bbc[_0x501f('0x4c')]=qs[_0x501f('0x4d')](_[_0x501f('0x4e')](_0x15f296['query'],_0xc0f457[_0x501f('0x4d')]));_0x2b7bbc[_0x501f('0x4c')]['ChatWebsiteId']=_0x5167ec['id'];if(_0x15f296[_0x501f('0x44')][_0x501f('0x52')]){_0x2b7bbc[_0x501f('0x4c')]=_[_0x501f('0x4f')](_0x2b7bbc[_0x501f('0x4c')],{'$or':_[_0x501f('0x43')](_0x2b7bbc[_0x501f('0x47')],function(_0x3403bd){var _0xcc9dab={};_0xcc9dab[_0x3403bd]={'$like':'%'+_0x15f296[_0x501f('0x44')]['filter']+'%'};return _0xcc9dab;})});}_0x2b7bbc=_[_0x501f('0x4f')]({},_0x2b7bbc,_0x15f296[_0x501f('0x53')]);return db[_0x501f('0x112')]['count']({'where':_0x2b7bbc[_0x501f('0x4c')]})[_0x501f('0x20')](function(_0x573526){_0x4f959b[_0x501f('0x2e')]=_0x573526;if(_0x15f296[_0x501f('0x44')][_0x501f('0x54')]){_0x2b7bbc['include']=[{'all':!![]}];}else{_0x2b7bbc[_0x501f('0x55')]=[{'model':db[_0x501f('0x8a')],'as':_0x501f('0xe2'),'required':![]}];}return db[_0x501f('0x112')][_0x501f('0x56')](_0x2b7bbc);})[_0x501f('0x20')](function(_0x3f2488){_0x4f959b[_0x501f('0x57')]=_0x3f2488;return _0x4f959b;});}})[_0x501f('0x20')](respondWithFilteredResult(_0x5e7f29,_0x2b7bbc))[_0x501f('0x2a')](handleError(_0x5e7f29,null));};exports[_0x501f('0x113')]=function(_0x1b1da8,_0x249442,_0x2744d1){return db[_0x501f('0x3e')][_0x501f('0x5a')]({'where':{'id':_0x1b1da8['params']['id']}})[_0x501f('0x20')](handleEntityNotFound(_0x249442,null))[_0x501f('0x20')](function(_0x32fef5){if(_0x32fef5){return _0x32fef5[_0x501f('0x113')](_0x1b1da8['body'][_0x501f('0x6d')],_[_0x501f('0x108')](_0x1b1da8[_0x501f('0x5f')],[_0x501f('0x6d'),'id'])||{})[_0x501f('0xb8')](function(_0x799be3){for(var _0x574871=0x0;_0x574871<_0x1b1da8[_0x501f('0x5f')][_0x501f('0x6d')][_0x501f('0x48')];_0x574871+=0x1){socket['emit'](_0x501f('0x114'),{'UserId':_0x1b1da8[_0x501f('0x5f')][_0x501f('0x6d')][_0x574871],'ChatWebsiteId':_0x1b1da8[_0x501f('0x59')]['id']});}return _0x799be3;});}})[_0x501f('0x20')](respondWithResult(_0x249442,null))['catch'](handleError(_0x249442,null));};exports[_0x501f('0x115')]=function(_0x2519ef,_0xfe7775,_0x471b4a){return db['ChatWebsite'][_0x501f('0x5a')]({'where':{'id':_0x2519ef[_0x501f('0x59')]['id']}})['then'](handleEntityNotFound(_0xfe7775,null))['then'](function(_0x38f11e){if(_0x38f11e){return _0x38f11e[_0x501f('0x115')](_0x2519ef['query']['ids'])['then'](function(){if(_['isArray'](_0x2519ef[_0x501f('0x44')][_0x501f('0x6d')])){for(var _0x5380a7=0x0;_0x5380a7<_0x2519ef['query'][_0x501f('0x6d')][_0x501f('0x48')];_0x5380a7+=0x1){socket[_0x501f('0x116')]('userChatWebsite:remove',{'UserId':Number(_0x2519ef[_0x501f('0x44')]['ids'][_0x5380a7]),'ChatWebsiteId':Number(_0x2519ef[_0x501f('0x59')]['id'])});}}else{socket[_0x501f('0x116')](_0x501f('0x117'),{'UserId':Number(_0x2519ef[_0x501f('0x44')][_0x501f('0x6d')]),'ChatWebsiteId':Number(_0x2519ef['params']['id'])});}});}})[_0x501f('0x20')](respondWithStatusCode(_0xfe7775,null))[_0x501f('0x2a')](handleError(_0xfe7775,null));};exports[_0x501f('0x118')]=function(_0x52143c,_0x3f7196,_0x5e1ff3){var _0x540d31={};var _0x544788={};var _0x438b1f;var _0x5af588;return db[_0x501f('0x3e')]['findOne']({'where':{'id':_0x52143c[_0x501f('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f7196,null))[_0x501f('0x20')](function(_0x3c4fc7){if(_0x3c4fc7){_0x438b1f=_0x3c4fc7;_0x544788[_0x501f('0x42')]=_[_0x501f('0x66')](db[_0x501f('0xc3')][_0x501f('0x3f')]);_0x544788['query']=_['keys'](_0x52143c[_0x501f('0x44')]);_0x544788[_0x501f('0x4d')]=_[_0x501f('0x45')](_0x544788[_0x501f('0x42')],_0x544788[_0x501f('0x44')]);_0x540d31[_0x501f('0x47')]=_[_0x501f('0x45')](_0x544788[_0x501f('0x42')],qs[_0x501f('0x46')](_0x52143c[_0x501f('0x44')][_0x501f('0x46')]));_0x540d31[_0x501f('0x47')]=_0x540d31[_0x501f('0x47')][_0x501f('0x48')]?_0x540d31['attributes']:_0x544788['model'];_0x540d31[_0x501f('0x4a')]=qs[_0x501f('0x4b')](_0x52143c[_0x501f('0x44')]['sort']);_0x540d31['where']=qs[_0x501f('0x4d')](_[_0x501f('0x4e')](_0x52143c[_0x501f('0x44')],_0x544788['filters']));if(_0x52143c[_0x501f('0x44')][_0x501f('0x52')]){_0x540d31[_0x501f('0x4c')]=_[_0x501f('0x4f')](_0x540d31['where'],{'$or':_[_0x501f('0x43')](_0x540d31[_0x501f('0x47')],function(_0x5911e4){var _0xe05918={};_0xe05918[_0x5911e4]={'$like':'%'+_0x52143c[_0x501f('0x44')][_0x501f('0x52')]+'%'};return _0xe05918;})});}_0x540d31=_[_0x501f('0x4f')]({},_0x540d31,_0x52143c[_0x501f('0x53')]);return _0x438b1f[_0x501f('0x118')](_0x540d31);}})[_0x501f('0x20')](function(_0x4cab1a){if(_0x4cab1a){_0x5af588=_0x4cab1a[_0x501f('0x48')];if(!_0x52143c[_0x501f('0x44')][_0x501f('0x67')](_0x501f('0x49'))){_0x540d31[_0x501f('0x30')]=qs[_0x501f('0x30')](_0x52143c[_0x501f('0x44')][_0x501f('0x30')]);_0x540d31[_0x501f('0x2f')]=qs[_0x501f('0x2f')](_0x52143c[_0x501f('0x44')][_0x501f('0x2f')]);}return _0x438b1f[_0x501f('0x118')](_0x540d31);}})[_0x501f('0x20')](function(_0x3c1899){if(_0x3c1899){return _0x3c1899?{'count':_0x5af588,'rows':_0x3c1899}:null;}})[_0x501f('0x20')](respondWithResult(_0x3f7196,null))[_0x501f('0x2a')](handleError(_0x3f7196,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8c9e20c..64229e0 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 _0x3308=['hook','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20ac35,_0x278bff){var _0x147230=function(_0xe5cc5c){while(--_0xe5cc5c){_0x20ac35['push'](_0x20ac35['shift']());}};_0x147230(++_0x278bff);}(_0x3308,0x12e));var _0x8330=function(_0x2ac6f6,_0x41fe18){_0x2ac6f6=_0x2ac6f6-0x0;var _0x52796b=_0x3308[_0x2ac6f6];return _0x52796b;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8330('0x0')](0x0);var events={'afterCreate':_0x8330('0x1'),'afterUpdate':_0x8330('0x2'),'afterDestroy':_0x8330('0x3')};function emitEvent(_0x508fce){return function(_0x5f52e6,_0x28d8af,_0x1e706f){ChatWebsiteEvents[_0x8330('0x4')](_0x508fce+':'+_0x5f52e6['id'],_0x5f52e6);ChatWebsiteEvents[_0x8330('0x4')](_0x508fce,_0x5f52e6);_0x1e706f(null);};}for(var e in events){if(events[_0x8330('0x5')](e)){var event=events[e];ChatWebsite[_0x8330('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xa61f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0xa61f,0x14d));var _0xfa61=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa61f[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xfa61('0x0'));var ChatWebsite=require(_0xfa61('0x1'))['db'][_0xfa61('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xfa61('0x3')](0x0);var events={'afterCreate':_0xfa61('0x4'),'afterUpdate':_0xfa61('0x5'),'afterDestroy':_0xfa61('0x6')};function emitEvent(_0x3b94fb){return function(_0x4a10e1,_0x3ef2cf,_0x50153f){ChatWebsiteEvents['emit'](_0x3b94fb+':'+_0x4a10e1['id'],_0x4a10e1);ChatWebsiteEvents[_0xfa61('0x7')](_0x3b94fb,_0x4a10e1);_0x50153f(null);};}for(var e in events){if(events[_0xfa61('0x8')](e)){var event=events[e];ChatWebsite[_0xfa61('0x9')](e,emitEvent(event));}}module[_0xfa61('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 5cd49fa..4266c15 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 _0xa0bc=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird'];(function(_0x416fb1,_0x5d71e5){var _0x2f2aa9=function(_0x1ce333){while(--_0x1ce333){_0x416fb1['push'](_0x416fb1['shift']());}};_0x2f2aa9(++_0x5d71e5);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x684c=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var logger=require('../../config/logger')(_0xc684('0x2'));var moment=require(_0xc684('0x3'));var BPromise=require(_0xc684('0x4'));var rp=require(_0xc684('0x5'));var fs=require('fs');var path=require(_0xc684('0x6'));var rimraf=require('rimraf');var config=require(_0xc684('0x7'));var attributes=require(_0xc684('0x8'));module[_0xc684('0x9')]=function(_0x4487f6,_0x46cb0e){return _0x4487f6[_0xc684('0xa')](_0xc684('0xb'),attributes,{'tableName':_0xc684('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index c2c65a7..ca7d59f 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 _0x8e3f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x42dc89,_0x45bace){var _0x5bdfbb=function(_0x51fb75){while(--_0x51fb75){_0x42dc89['push'](_0x42dc89['shift']());}};_0x5bdfbb(++_0x45bace);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});} \ No newline at end of file +var _0x2a07=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x551906,_0x569941){var _0x58bfb6=function(_0x1eb6de){while(--_0x1eb6de){_0x551906['push'](_0x551906['shift']());}};_0x58bfb6(++_0x569941);}(_0x2a07,0x74));var _0x72a0=function(_0x18daeb,_0x1b8ff3){_0x18daeb=_0x18daeb-0x0;var _0x425a30=_0x2a07[_0x18daeb];return _0x425a30;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});config[_0x72a0('0xd')]=_[_0x72a0('0xe')](config[_0x72a0('0xd')],{'host':_0x72a0('0xf'),'port':0x18eb});var socket=require(_0x72a0('0x10'))(new Redis(config[_0x72a0('0xd')]));require(_0x72a0('0x11'))[_0x72a0('0x12')](socket);function respondWithRpcPromise(_0x5c1d1e,_0x169dc2,_0x1109f7){return new BPromise(function(_0x54abf6,_0x46fb8a){return client[_0x72a0('0x13')](_0x5c1d1e,_0x1109f7)[_0x72a0('0x14')](function(_0x44d7cf){logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));logger[_0x72a0('0x17')](_0x72a0('0x18'),_0x169dc2,_0x72a0('0x16'),JSON[_0x72a0('0x19')](_0x44d7cf));if(_0x44d7cf[_0x72a0('0x1a')]){if(_0x44d7cf[_0x72a0('0x1a')]['code']===0x1f4){logger['error'](_0x72a0('0x1b'),_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x46fb8a(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}logger[_0x72a0('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x54abf6(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}else{logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));_0x54abf6(_0x44d7cf[_0x72a0('0x1d')][_0x72a0('0x1c')]);}})['catch'](function(_0x144bfc){logger[_0x72a0('0x1a')](_0x72a0('0x1b'),_0x169dc2,_0x144bfc);_0x46fb8a(_0x144bfc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index fab94cb..92eb69f 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14fd93,_0x1904f2){_0x14fd93=_0x14fd93-0x0;var _0x2a2afd=_0x5f2f[_0x14fd93];return _0x2a2afd;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x51d9c7,_0x1b0652){_0x51d9c7=_0x51d9c7-0x0;var _0x144a43=_0x5f2f[_0x51d9c7];return _0x144a43;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b6c44c1..2bae26f 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 _0xa7fc=['getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','server/files/images/avatars/','originalname','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users'];(function(_0x96359,_0x220250){var _0x13ce0f=function(_0x41d54a){while(--_0x41d54a){_0x96359['push'](_0x96359['shift']());}};_0x13ce0f(++_0x220250);}(_0xa7fc,0xe7));var _0xca7f=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0xa7fc[_0x156a0d];return _0x98a9ba;};'use strict';var multer=require(_0xca7f('0x0'));var util=require('util');var path=require(_0xca7f('0x1'));var timeout=require(_0xca7f('0x2'));var express=require(_0xca7f('0x3'));var router=express['Router']();var auth=require(_0xca7f('0x4'));var interaction=require(_0xca7f('0x5'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xca7f('0x6')]('/',auth[_0xca7f('0x7')](),controller['index']);router[_0xca7f('0x6')]('/describe',auth[_0xca7f('0x7')](),controller[_0xca7f('0x8')]);router[_0xca7f('0x6')](_0xca7f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xca7f('0x6')](_0xca7f('0xa'),auth['isAuthenticated'](),controller[_0xca7f('0xb')]);router['get'](_0xca7f('0xc'),auth[_0xca7f('0x7')](),controller[_0xca7f('0xd')]);router[_0xca7f('0x6')](_0xca7f('0xe'),controller[_0xca7f('0xf')]);router[_0xca7f('0x6')](_0xca7f('0x10'),controller[_0xca7f('0x11')]);router['get'](_0xca7f('0x12'),controller[_0xca7f('0x13')]);router['get'](_0xca7f('0x14'),controller[_0xca7f('0x15')]);router[_0xca7f('0x6')](_0xca7f('0x16'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x17')]);router[_0xca7f('0x6')]('/:id/snippet',controller[_0xca7f('0x18')]);router[_0xca7f('0x6')](_0xca7f('0x19'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x1a')]);router[_0xca7f('0x6')]('/:id/proactive_actions',auth[_0xca7f('0x7')](),controller[_0xca7f('0x1b')]);router[_0xca7f('0x6')](_0xca7f('0x1c'),controller[_0xca7f('0x1d')]);router[_0xca7f('0x6')](_0xca7f('0x1e'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x1f')]);router['get'](_0xca7f('0x20'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x21')]);router[_0xca7f('0x22')]('/',auth[_0xca7f('0x7')](),controller[_0xca7f('0x23')]);router[_0xca7f('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xca7f('0x24')]);router[_0xca7f('0x22')](_0xca7f('0xc'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x25')]);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x568dbb,_0x40c2c9,_0x575c97){_0x575c97(null,path[_0xca7f('0x27')](config[_0xca7f('0x28')],_0xca7f('0x29')));},'filename':function(_0x2b6586,_0x4bf51b,_0x3ad3cb){_0x3ad3cb(null,util[_0xca7f('0x2a')](_0xca7f('0x2b'),Date[_0xca7f('0x2c')](),_0x4bf51b['originalname']));}})});router['post']('/:id/logo',upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller[_0xca7f('0x2f')]);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x4723a5,_0x1aa8b6,_0x43a3c9){_0x43a3c9(null,path[_0xca7f('0x27')](config['root'],_0xca7f('0x30')));},'filename':function(_0x193612,_0x4754d9,_0x5d8858){_0x5d8858(null,util['format'](_0xca7f('0x2b'),Date['now'](),_0x4754d9[_0xca7f('0x31')]));}})});router[_0xca7f('0x22')](_0xca7f('0x10'),upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x4ba7a8,_0x1e9986,_0xa077fc){_0xa077fc(null,path[_0xca7f('0x27')](config['root'],_0xca7f('0x30')));},'filename':function(_0x4c5328,_0x4f4e6b,_0x33945c){_0x33945c(null,util[_0xca7f('0x2a')](_0xca7f('0x2b'),Date[_0xca7f('0x2c')](),_0x4f4e6b[_0xca7f('0x31')]));}})});router[_0xca7f('0x22')](_0xca7f('0x12'),upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller[_0xca7f('0x32')]);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x1bc09d,_0xa8ba42,_0x300495){_0x300495(null,path['join'](config[_0xca7f('0x28')],_0xca7f('0x30')));},'filename':function(_0x45e8e4,_0x9ee75,_0x3fe58a){_0x3fe58a(null,util[_0xca7f('0x2a')](_0xca7f('0x2b'),Date['now'](),_0x9ee75['originalname']));}})});router[_0xca7f('0x22')](_0xca7f('0x14'),upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller['addSystemAvatar']);router['post'](_0xca7f('0x33'),controller[_0xca7f('0x34')]);router[_0xca7f('0x22')](_0xca7f('0x35'),controller[_0xca7f('0x36')]);router[_0xca7f('0x22')](_0xca7f('0x16'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x37')]);router[_0xca7f('0x22')]('/:id/applications',auth[_0xca7f('0x7')](),controller[_0xca7f('0x38')]);router[_0xca7f('0x22')]('/:id/proactive_actions',auth[_0xca7f('0x7')](),controller[_0xca7f('0x39')]);router[_0xca7f('0x22')](_0xca7f('0x20'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x3a')]);router[_0xca7f('0x3b')](_0xca7f('0x9'),auth['isAuthenticated'](),controller[_0xca7f('0x3c')]);router[_0xca7f('0x3d')](_0xca7f('0x9'),auth[_0xca7f('0x7')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xca7f('0x7')](),controller[_0xca7f('0x3e')]);router[_0xca7f('0x3d')](_0xca7f('0xc'),auth['isAuthenticated'](),controller[_0xca7f('0x3f')]);router[_0xca7f('0x3d')](_0xca7f('0x20'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x40')]);module[_0xca7f('0x41')]=router; \ No newline at end of file +var _0xd730=['/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addProactiveActions','put','delete','destroy','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/:id','show','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','%s-%s'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd730,0x8b));var _0x0d73=function(_0x43a09e,_0x5bf7bb){_0x43a09e=_0x43a09e-0x0;var _0x32cc70=_0xd730[_0x43a09e];return _0x32cc70;};'use strict';var multer=require(_0x0d73('0x0'));var util=require(_0x0d73('0x1'));var path=require(_0x0d73('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d73('0x3'));var router=express[_0x0d73('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d73('0x5'));var config=require(_0x0d73('0x6'));var controller=require(_0x0d73('0x7'));router['get']('/',auth[_0x0d73('0x8')](),controller[_0x0d73('0x9')]);router[_0x0d73('0xa')]('/describe',auth[_0x0d73('0x8')](),controller['describe']);router[_0x0d73('0xa')](_0x0d73('0xb'),auth[_0x0d73('0x8')](),controller[_0x0d73('0xc')]);router['get']('/:id/dispositions',auth[_0x0d73('0x8')](),controller['getDispositions']);router[_0x0d73('0xa')]('/:id/canned_answers',auth[_0x0d73('0x8')](),controller[_0x0d73('0xd')]);router[_0x0d73('0xa')](_0x0d73('0xe'),controller[_0x0d73('0xf')]);router[_0x0d73('0xa')](_0x0d73('0x10'),controller[_0x0d73('0x11')]);router[_0x0d73('0xa')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x0d73('0xa')]('/:id/system_avatar',controller['getSystemAvatar']);router['get'](_0x0d73('0x12'),auth[_0x0d73('0x8')](),controller[_0x0d73('0x13')]);router['get'](_0x0d73('0x14'),controller[_0x0d73('0x15')]);router['get'](_0x0d73('0x16'),auth[_0x0d73('0x8')](),controller[_0x0d73('0x17')]);router[_0x0d73('0xa')](_0x0d73('0x18'),auth['isAuthenticated'](),controller[_0x0d73('0x19')]);router[_0x0d73('0xa')](_0x0d73('0x1a'),controller[_0x0d73('0x1b')]);router[_0x0d73('0xa')](_0x0d73('0x1c'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x0d73('0xa')]('/:id/users',auth[_0x0d73('0x8')](),controller[_0x0d73('0x1d')]);router[_0x0d73('0x1e')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0d73('0x1e')]('/:id/dispositions',auth[_0x0d73('0x8')](),controller[_0x0d73('0x1f')]);router['post'](_0x0d73('0x20'),auth['isAuthenticated'](),controller[_0x0d73('0x21')]);var upload=multer({'storage':multer[_0x0d73('0x22')]({'destination':function(_0x458f50,_0x1cf755,_0x29f493){_0x29f493(null,path[_0x0d73('0x23')](config[_0x0d73('0x24')],_0x0d73('0x25')));},'filename':function(_0x430d8d,_0x13b739,_0x1a1541){_0x1a1541(null,util[_0x0d73('0x26')]('%s-%s',Date[_0x0d73('0x27')](),_0x13b739[_0x0d73('0x28')]));}})});router['post'](_0x0d73('0xe'),upload[_0x0d73('0x29')](_0x0d73('0x2a')),controller[_0x0d73('0x2b')]);var upload=multer({'storage':multer[_0x0d73('0x22')]({'destination':function(_0x34863a,_0x2a28fd,_0x25a602){_0x25a602(null,path[_0x0d73('0x23')](config[_0x0d73('0x24')],_0x0d73('0x2c')));},'filename':function(_0x2e4432,_0x5af89a,_0x17bf17){_0x17bf17(null,util[_0x0d73('0x26')]('%s-%s',Date[_0x0d73('0x27')](),_0x5af89a[_0x0d73('0x28')]));}})});router[_0x0d73('0x1e')](_0x0d73('0x10'),upload[_0x0d73('0x29')](_0x0d73('0x2a')),controller[_0x0d73('0x2d')]);var upload=multer({'storage':multer[_0x0d73('0x22')]({'destination':function(_0x86ff73,_0xa791bd,_0x46f6b8){_0x46f6b8(null,path[_0x0d73('0x23')](config[_0x0d73('0x24')],_0x0d73('0x2c')));},'filename':function(_0x42398c,_0x2c143e,_0x3993c1){_0x3993c1(null,util[_0x0d73('0x26')](_0x0d73('0x2e'),Date[_0x0d73('0x27')](),_0x2c143e[_0x0d73('0x28')]));}})});router['post'](_0x0d73('0x2f'),upload[_0x0d73('0x29')](_0x0d73('0x2a')),controller[_0x0d73('0x30')]);var upload=multer({'storage':multer[_0x0d73('0x22')]({'destination':function(_0x337c1b,_0x3fd213,_0x24ea76){_0x24ea76(null,path[_0x0d73('0x23')](config[_0x0d73('0x24')],_0x0d73('0x2c')));},'filename':function(_0x517456,_0x53dcbd,_0x52e22e){_0x52e22e(null,util[_0x0d73('0x26')]('%s-%s',Date[_0x0d73('0x27')](),_0x53dcbd[_0x0d73('0x28')]));}})});router['post'](_0x0d73('0x31'),upload[_0x0d73('0x29')](_0x0d73('0x2a')),controller[_0x0d73('0x32')]);router[_0x0d73('0x1e')](_0x0d73('0x33'),controller[_0x0d73('0x34')]);router[_0x0d73('0x1e')](_0x0d73('0x35'),controller['offline']);router[_0x0d73('0x1e')](_0x0d73('0x12'),auth[_0x0d73('0x8')](),controller['addInteraction']);router[_0x0d73('0x1e')](_0x0d73('0x16'),auth['isAuthenticated'](),controller['addApplications']);router[_0x0d73('0x1e')](_0x0d73('0x18'),auth[_0x0d73('0x8')](),controller[_0x0d73('0x36')]);router[_0x0d73('0x1e')]('/:id/users',auth[_0x0d73('0x8')](),controller['addAgents']);router[_0x0d73('0x37')](_0x0d73('0xb'),auth[_0x0d73('0x8')](),controller['update']);router[_0x0d73('0x38')](_0x0d73('0xb'),auth[_0x0d73('0x8')](),controller[_0x0d73('0x39')]);router['delete'](_0x0d73('0x3a'),auth[_0x0d73('0x8')](),controller[_0x0d73('0x3b')]);router[_0x0d73('0x38')](_0x0d73('0x20'),auth[_0x0d73('0x8')](),controller['removeAnswers']);router[_0x0d73('0x38')]('/:id/users',auth[_0x0d73('0x8')](),controller[_0x0d73('0x3c')]);module[_0x0d73('0x3d')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 45e9a86..6a0bc68 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 _0x714c=['AmazonAWS','Google','exports','STRING','ENUM'];(function(_0x700278,_0x5c4895){var _0x14da28=function(_0x2f9f08){while(--_0x2f9f08){_0x700278['push'](_0x700278['shift']());}};_0x14da28(++_0x5c4895);}(_0x714c,0x18d));var _0xc714=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x714c[_0x5d6e35];return _0x5d7ada;};'use strict';var Sequelize=require('sequelize');module[_0xc714('0x0')]={'name':{'type':Sequelize[_0xc714('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc714('0x2')](_0xc714('0x3'),_0xc714('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc714('0x1')]}}; \ No newline at end of file +var _0xafc4=['Google','sequelize','STRING','AmazonAWS'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xafc4,0x69));var _0x4afc=function(_0x1daf1f,_0x53a1ee){_0x1daf1f=_0x1daf1f-0x0;var _0x30d686=_0xafc4[_0x1daf1f];return _0x30d686;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x4afc('0x2'),_0x4afc('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x4afc('0x1')]},'data2':{'type':Sequelize[_0x4afc('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 3c82827..f333920 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 _0xabe7=['show','params','merge','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','end','status','json','count','set','apply','reject','then','destroy','sendStatus','error','stack','map','CloudProvider','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x443520,_0x2fe333){var _0x20afa5=function(_0x13cf74){while(--_0x13cf74){_0x443520['push'](_0x443520['shift']());}};_0x20afa5(++_0x2fe333);}(_0xabe7,0x1b0));var _0x7abe=function(_0x52c06e,_0x37b1a0){_0x52c06e=_0x52c06e-0x0;var _0x5ab3c4=_0xabe7[_0x52c06e];return _0x5ab3c4;};'use strict';var pdf=require(_0x7abe('0x0'));var emlformat=require(_0x7abe('0x1'));var rimraf=require(_0x7abe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7abe('0x3'));var rp=require(_0x7abe('0x4'));var moment=require(_0x7abe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7abe('0x6'));var util=require(_0x7abe('0x7'));var path=require('path');var sox=require(_0x7abe('0x8'));var csv=require(_0x7abe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7abe('0xa'));var squel=require(_0x7abe('0xb'));var crypto=require(_0x7abe('0xc'));var jsforce=require(_0x7abe('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7abe('0xe'));var Papa=require(_0x7abe('0xf'));var Redis=require(_0x7abe('0x10'));var authService=require(_0x7abe('0x11'));var qs=require(_0x7abe('0x12'));var as=require(_0x7abe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7abe('0x14'));var utils=require('../../config/utils');var config=require(_0x7abe('0x15'));var licenseUtil=require(_0x7abe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x344bcc,_0x1852aa){_0x1852aa=_0x1852aa||0xcc;return function(_0x52b4fe){if(_0x52b4fe){return _0x344bcc['sendStatus'](_0x1852aa);}return _0x344bcc['status'](_0x1852aa)[_0x7abe('0x17')]();};}function respondWithResult(_0x4ae3f0,_0x2b7f07){_0x2b7f07=_0x2b7f07||0xc8;return function(_0x3e5e11){if(_0x3e5e11){return _0x4ae3f0[_0x7abe('0x18')](_0x2b7f07)[_0x7abe('0x19')](_0x3e5e11);}};}function respondWithFilteredResult(_0x4738a2,_0xcd4c2c){return function(_0x4e0d20){if(_0x4e0d20){var _0x4fe2f4=_0x4e0d20[_0x7abe('0x1a')],_0x467052=_0xcd4c2c['offset'],_0x4a6cbf=_0xcd4c2c['offset']+_0xcd4c2c['limit'],_0x35929f;if(_0x4a6cbf>=_0x4fe2f4){_0x4a6cbf=_0x4fe2f4;_0x35929f=0xc8;}else{_0x35929f=0xce;}_0x4738a2['status'](_0x35929f);return _0x4738a2[_0x7abe('0x1b')]('Content-Range',_0x467052+'-'+_0x4a6cbf+'/'+_0x4fe2f4)[_0x7abe('0x19')](_0x4e0d20);}return null;};}function patchUpdates(_0x17b180){return function(_0x28041b){try{jsonpatch[_0x7abe('0x1c')](_0x28041b,_0x17b180,!![]);}catch(_0xe86293){return BPromise[_0x7abe('0x1d')](_0xe86293);}return _0x28041b['save']();};}function saveUpdates(_0x368f9d,_0x5d5a1c){return function(_0x185018){if(_0x185018){return _0x185018['update'](_0x368f9d)[_0x7abe('0x1e')](function(_0x447e0a){return _0x447e0a;});}return null;};}function removeEntity(_0x9a758f,_0x1a2b22){return function(_0x15e0c3){if(_0x15e0c3){return _0x15e0c3[_0x7abe('0x1f')]()['then'](function(){_0x9a758f[_0x7abe('0x18')](0xcc)[_0x7abe('0x17')]();});}};}function handleEntityNotFound(_0x4e4293,_0x3b1f2d){return function(_0x43f61a){if(!_0x43f61a){_0x4e4293[_0x7abe('0x20')](0x194);}return _0x43f61a;};}function handleError(_0x37ec2b,_0x244b54){_0x244b54=_0x244b54||0x1f4;return function(_0x19ce00){logger[_0x7abe('0x21')](_0x19ce00[_0x7abe('0x22')]);if(_0x19ce00['name']){delete _0x19ce00['name'];}_0x37ec2b[_0x7abe('0x18')](_0x244b54)['send'](_0x19ce00);};}exports['index']=function(_0x5c3366,_0x2339a4){var _0xa6a52d={},_0x39cd99={},_0x2fe37e={'count':0x0,'rows':[]};var _0x2a07c2=_[_0x7abe('0x23')](db[_0x7abe('0x24')][_0x7abe('0x25')],function(_0x20cfd9){return{'name':_0x20cfd9[_0x7abe('0x26')],'type':_0x20cfd9[_0x7abe('0x27')][_0x7abe('0x28')]};});_0x39cd99[_0x7abe('0x29')]=_[_0x7abe('0x23')](_0x2a07c2,_0x7abe('0x2a'));_0x39cd99[_0x7abe('0x2b')]=_[_0x7abe('0x2c')](_0x5c3366['query']);_0x39cd99[_0x7abe('0x2d')]=_[_0x7abe('0x2e')](_0x39cd99[_0x7abe('0x29')],_0x39cd99[_0x7abe('0x2b')]);_0xa6a52d[_0x7abe('0x2f')]=_[_0x7abe('0x2e')](_0x39cd99[_0x7abe('0x29')],qs[_0x7abe('0x30')](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x30')]));_0xa6a52d[_0x7abe('0x2f')]=_0xa6a52d[_0x7abe('0x2f')][_0x7abe('0x31')]?_0xa6a52d[_0x7abe('0x2f')]:_0x39cd99[_0x7abe('0x29')];if(!_0x5c3366['query'][_0x7abe('0x32')](_0x7abe('0x33'))){_0xa6a52d['limit']=qs[_0x7abe('0x34')](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x34')]);_0xa6a52d[_0x7abe('0x35')]=qs['offset'](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x35')]);}_0xa6a52d['order']=qs[_0x7abe('0x36')](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x36')]);_0xa6a52d[_0x7abe('0x37')]=qs[_0x7abe('0x2d')](_[_0x7abe('0x38')](_0x5c3366[_0x7abe('0x2b')],_0x39cd99[_0x7abe('0x2d')]),_0x2a07c2);if(_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x39')]){_0xa6a52d[_0x7abe('0x37')]=_['merge'](_0xa6a52d[_0x7abe('0x37')],{'$or':_['map'](_0x2a07c2,function(_0x415419){if(_0x415419[_0x7abe('0x27')]!==_0x7abe('0x3a')){var _0x22d41a={};_0x22d41a[_0x415419[_0x7abe('0x2a')]]={'$like':'%'+_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x39')]+'%'};return _0x22d41a;}})});}_0xa6a52d=_['merge']({},_0xa6a52d,_0x5c3366[_0x7abe('0x3b')]);var _0x4a5f6a={'where':_0xa6a52d[_0x7abe('0x37')]};return db[_0x7abe('0x24')][_0x7abe('0x1a')](_0x4a5f6a)[_0x7abe('0x1e')](function(_0x2c87cf){_0x2fe37e['count']=_0x2c87cf;if(_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x3c')]){_0xa6a52d[_0x7abe('0x3d')]=[{'all':!![]}];}return db[_0x7abe('0x24')][_0x7abe('0x3e')](_0xa6a52d);})['then'](function(_0x86a746){_0x2fe37e[_0x7abe('0x3f')]=_0x86a746;return _0x2fe37e;})[_0x7abe('0x1e')](respondWithFilteredResult(_0x2339a4,_0xa6a52d))[_0x7abe('0x40')](handleError(_0x2339a4,null));};exports[_0x7abe('0x41')]=function(_0x1eb0c0,_0x3db589){var _0x35d48a={'raw':!![],'where':{'id':_0x1eb0c0[_0x7abe('0x42')]['id']}},_0x1377c1={};_0x1377c1[_0x7abe('0x29')]=_[_0x7abe('0x2c')](db[_0x7abe('0x24')][_0x7abe('0x25')]);_0x1377c1['query']=_[_0x7abe('0x2c')](_0x1eb0c0[_0x7abe('0x2b')]);_0x1377c1[_0x7abe('0x2d')]=_['intersection'](_0x1377c1['model'],_0x1377c1[_0x7abe('0x2b')]);_0x35d48a['attributes']=_[_0x7abe('0x2e')](_0x1377c1[_0x7abe('0x29')],qs[_0x7abe('0x30')](_0x1eb0c0[_0x7abe('0x2b')][_0x7abe('0x30')]));_0x35d48a[_0x7abe('0x2f')]=_0x35d48a[_0x7abe('0x2f')]['length']?_0x35d48a['attributes']:_0x1377c1[_0x7abe('0x29')];if(_0x1eb0c0['query']['includeAll']){_0x35d48a[_0x7abe('0x3d')]=[{'all':!![]}];}_0x35d48a=_[_0x7abe('0x43')]({},_0x35d48a,_0x1eb0c0[_0x7abe('0x3b')]);return db[_0x7abe('0x24')][_0x7abe('0x44')](_0x35d48a)[_0x7abe('0x1e')](handleEntityNotFound(_0x3db589,null))[_0x7abe('0x1e')](respondWithResult(_0x3db589,null))[_0x7abe('0x40')](handleError(_0x3db589,null));};exports[_0x7abe('0x45')]=function(_0x535e7d,_0x269723){return db[_0x7abe('0x24')][_0x7abe('0x45')](_0x535e7d[_0x7abe('0x46')],{})[_0x7abe('0x1e')](respondWithResult(_0x269723,0xc9))[_0x7abe('0x40')](handleError(_0x269723,null));};exports['update']=function(_0x35c32d,_0x273c6){if(_0x35c32d['body']['id']){delete _0x35c32d[_0x7abe('0x46')]['id'];}return db[_0x7abe('0x24')][_0x7abe('0x44')]({'where':{'id':_0x35c32d[_0x7abe('0x42')]['id']}})[_0x7abe('0x1e')](handleEntityNotFound(_0x273c6,null))['then'](saveUpdates(_0x35c32d[_0x7abe('0x46')],null))[_0x7abe('0x1e')](respondWithResult(_0x273c6,null))[_0x7abe('0x40')](handleError(_0x273c6,null));};exports[_0x7abe('0x1f')]=function(_0x182b12,_0x391769){return db[_0x7abe('0x24')][_0x7abe('0x44')]({'where':{'id':_0x182b12[_0x7abe('0x42')]['id']}})['then'](handleEntityNotFound(_0x391769,null))[_0x7abe('0x1e')](removeEntity(_0x391769,null))[_0x7abe('0x40')](handleError(_0x391769,null));}; \ No newline at end of file +var _0x6f09=['mustache','util','path','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','CloudProvider','includeAll','include','rows','catch','show','length','find','create','body','params','html-pdf','rimraf','zip-dir','request-promise'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6f09,0x1ac));var _0x96f0=function(_0x19f264,_0x51f5e8){_0x19f264=_0x19f264-0x0;var _0x42890b=_0x6f09[_0x19f264];return _0x42890b;};'use strict';var pdf=require(_0x96f0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x96f0('0x1'));var zipdir=require(_0x96f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96f0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x96f0('0x4'));var util=require(_0x96f0('0x5'));var path=require(_0x96f0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x96f0('0x7'));var fs=require('fs');var _=require(_0x96f0('0x8'));var squel=require('squel');var crypto=require(_0x96f0('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x96f0('0xa'));var querystring=require(_0x96f0('0xb'));var Papa=require(_0x96f0('0xc'));var Redis=require(_0x96f0('0xd'));var authService=require(_0x96f0('0xe'));var qs=require(_0x96f0('0xf'));var as=require(_0x96f0('0x10'));var hardwareService=require(_0x96f0('0x11'));var logger=require(_0x96f0('0x12'))(_0x96f0('0x13'));var utils=require('../../config/utils');var config=require(_0x96f0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x96f0('0x15'))['db'];function respondWithStatusCode(_0x2a3355,_0x1cf5ff){_0x1cf5ff=_0x1cf5ff||0xcc;return function(_0x562fc4){if(_0x562fc4){return _0x2a3355['sendStatus'](_0x1cf5ff);}return _0x2a3355[_0x96f0('0x16')](_0x1cf5ff)[_0x96f0('0x17')]();};}function respondWithResult(_0x530d52,_0x5ea235){_0x5ea235=_0x5ea235||0xc8;return function(_0x5a8a5a){if(_0x5a8a5a){return _0x530d52[_0x96f0('0x16')](_0x5ea235)['json'](_0x5a8a5a);}};}function respondWithFilteredResult(_0x302616,_0xb641b8){return function(_0x5971af){if(_0x5971af){var _0x41cc5a=_0x5971af[_0x96f0('0x18')],_0x505186=_0xb641b8[_0x96f0('0x19')],_0x4afad1=_0xb641b8[_0x96f0('0x19')]+_0xb641b8[_0x96f0('0x1a')],_0x23e321;if(_0x4afad1>=_0x41cc5a){_0x4afad1=_0x41cc5a;_0x23e321=0xc8;}else{_0x23e321=0xce;}_0x302616['status'](_0x23e321);return _0x302616[_0x96f0('0x1b')](_0x96f0('0x1c'),_0x505186+'-'+_0x4afad1+'/'+_0x41cc5a)[_0x96f0('0x1d')](_0x5971af);}return null;};}function patchUpdates(_0x16e4d1){return function(_0x26b48c){try{jsonpatch[_0x96f0('0x1e')](_0x26b48c,_0x16e4d1,!![]);}catch(_0x1d198b){return BPromise[_0x96f0('0x1f')](_0x1d198b);}return _0x26b48c[_0x96f0('0x20')]();};}function saveUpdates(_0x391690,_0x5544c9){return function(_0x949970){if(_0x949970){return _0x949970[_0x96f0('0x21')](_0x391690)[_0x96f0('0x22')](function(_0xe38962){return _0xe38962;});}return null;};}function removeEntity(_0x2dc1b0,_0x10701b){return function(_0x18ac61){if(_0x18ac61){return _0x18ac61[_0x96f0('0x23')]()['then'](function(){_0x2dc1b0[_0x96f0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x567684,_0x405b13){return function(_0x4becfa){if(!_0x4becfa){_0x567684['sendStatus'](0x194);}return _0x4becfa;};}function handleError(_0x11941b,_0x5f0c75){_0x5f0c75=_0x5f0c75||0x1f4;return function(_0x58aa21){logger[_0x96f0('0x24')](_0x58aa21[_0x96f0('0x25')]);if(_0x58aa21['name']){delete _0x58aa21[_0x96f0('0x26')];}_0x11941b['status'](_0x5f0c75)['send'](_0x58aa21);};}exports[_0x96f0('0x27')]=function(_0x333b3d,_0xf66ed0){var _0x14ebfa={},_0x30790a={},_0x5a7205={'count':0x0,'rows':[]};var _0x2c5f82=_[_0x96f0('0x28')](db['CloudProvider'][_0x96f0('0x29')],function(_0x32b080){return{'name':_0x32b080[_0x96f0('0x2a')],'type':_0x32b080[_0x96f0('0x2b')][_0x96f0('0x2c')]};});_0x30790a[_0x96f0('0x2d')]=_[_0x96f0('0x28')](_0x2c5f82,_0x96f0('0x26'));_0x30790a['query']=_[_0x96f0('0x2e')](_0x333b3d[_0x96f0('0x2f')]);_0x30790a[_0x96f0('0x30')]=_['intersection'](_0x30790a['model'],_0x30790a[_0x96f0('0x2f')]);_0x14ebfa[_0x96f0('0x31')]=_[_0x96f0('0x32')](_0x30790a['model'],qs['fields'](_0x333b3d['query'][_0x96f0('0x33')]));_0x14ebfa[_0x96f0('0x31')]=_0x14ebfa[_0x96f0('0x31')]['length']?_0x14ebfa[_0x96f0('0x31')]:_0x30790a[_0x96f0('0x2d')];if(!_0x333b3d[_0x96f0('0x2f')][_0x96f0('0x34')](_0x96f0('0x35'))){_0x14ebfa[_0x96f0('0x1a')]=qs['limit'](_0x333b3d[_0x96f0('0x2f')][_0x96f0('0x1a')]);_0x14ebfa[_0x96f0('0x19')]=qs[_0x96f0('0x19')](_0x333b3d[_0x96f0('0x2f')][_0x96f0('0x19')]);}_0x14ebfa[_0x96f0('0x36')]=qs['sort'](_0x333b3d['query'][_0x96f0('0x37')]);_0x14ebfa[_0x96f0('0x38')]=qs['filters'](_[_0x96f0('0x39')](_0x333b3d[_0x96f0('0x2f')],_0x30790a[_0x96f0('0x30')]),_0x2c5f82);if(_0x333b3d['query'][_0x96f0('0x3a')]){_0x14ebfa['where']=_['merge'](_0x14ebfa[_0x96f0('0x38')],{'$or':_[_0x96f0('0x28')](_0x2c5f82,function(_0x2b678c){if(_0x2b678c['type']!==_0x96f0('0x3b')){var _0x455443={};_0x455443[_0x2b678c[_0x96f0('0x26')]]={'$like':'%'+_0x333b3d[_0x96f0('0x2f')]['filter']+'%'};return _0x455443;}})});}_0x14ebfa=_['merge']({},_0x14ebfa,_0x333b3d[_0x96f0('0x3c')]);var _0x2b4c73={'where':_0x14ebfa[_0x96f0('0x38')]};return db[_0x96f0('0x3d')][_0x96f0('0x18')](_0x2b4c73)[_0x96f0('0x22')](function(_0x39ad8a){_0x5a7205['count']=_0x39ad8a;if(_0x333b3d[_0x96f0('0x2f')][_0x96f0('0x3e')]){_0x14ebfa[_0x96f0('0x3f')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x14ebfa);})[_0x96f0('0x22')](function(_0x5c720c){_0x5a7205[_0x96f0('0x40')]=_0x5c720c;return _0x5a7205;})[_0x96f0('0x22')](respondWithFilteredResult(_0xf66ed0,_0x14ebfa))[_0x96f0('0x41')](handleError(_0xf66ed0,null));};exports[_0x96f0('0x42')]=function(_0x14153a,_0x3d195d){var _0x1c8c98={'raw':!![],'where':{'id':_0x14153a['params']['id']}},_0x453f3f={};_0x453f3f[_0x96f0('0x2d')]=_['keys'](db[_0x96f0('0x3d')][_0x96f0('0x29')]);_0x453f3f[_0x96f0('0x2f')]=_[_0x96f0('0x2e')](_0x14153a[_0x96f0('0x2f')]);_0x453f3f[_0x96f0('0x30')]=_[_0x96f0('0x32')](_0x453f3f[_0x96f0('0x2d')],_0x453f3f[_0x96f0('0x2f')]);_0x1c8c98[_0x96f0('0x31')]=_[_0x96f0('0x32')](_0x453f3f[_0x96f0('0x2d')],qs['fields'](_0x14153a['query']['fields']));_0x1c8c98[_0x96f0('0x31')]=_0x1c8c98[_0x96f0('0x31')][_0x96f0('0x43')]?_0x1c8c98[_0x96f0('0x31')]:_0x453f3f[_0x96f0('0x2d')];if(_0x14153a[_0x96f0('0x2f')][_0x96f0('0x3e')]){_0x1c8c98[_0x96f0('0x3f')]=[{'all':!![]}];}_0x1c8c98=_['merge']({},_0x1c8c98,_0x14153a['options']);return db[_0x96f0('0x3d')][_0x96f0('0x44')](_0x1c8c98)['then'](handleEntityNotFound(_0x3d195d,null))[_0x96f0('0x22')](respondWithResult(_0x3d195d,null))[_0x96f0('0x41')](handleError(_0x3d195d,null));};exports['create']=function(_0x4e42d0,_0x5746dc){return db[_0x96f0('0x3d')][_0x96f0('0x45')](_0x4e42d0[_0x96f0('0x46')],{})[_0x96f0('0x22')](respondWithResult(_0x5746dc,0xc9))[_0x96f0('0x41')](handleError(_0x5746dc,null));};exports[_0x96f0('0x21')]=function(_0xbd9e78,_0x2c4087){if(_0xbd9e78['body']['id']){delete _0xbd9e78['body']['id'];}return db[_0x96f0('0x3d')][_0x96f0('0x44')]({'where':{'id':_0xbd9e78[_0x96f0('0x47')]['id']}})[_0x96f0('0x22')](handleEntityNotFound(_0x2c4087,null))[_0x96f0('0x22')](saveUpdates(_0xbd9e78[_0x96f0('0x46')],null))[_0x96f0('0x22')](respondWithResult(_0x2c4087,null))[_0x96f0('0x41')](handleError(_0x2c4087,null));};exports[_0x96f0('0x23')]=function(_0x36cf8c,_0x408cd0){return db[_0x96f0('0x3d')][_0x96f0('0x44')]({'where':{'id':_0x36cf8c[_0x96f0('0x47')]['id']}})[_0x96f0('0x22')](handleEntityNotFound(_0x408cd0,null))[_0x96f0('0x22')](removeEntity(_0x408cd0,null))[_0x96f0('0x41')](handleError(_0x408cd0,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f96af0c..8c9ffc5 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 _0xbd43=['CloudProvider','cloud_providers','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x42e565,_0x3a6c33){var _0x16c40b=function(_0x18974f){while(--_0x18974f){_0x42e565['push'](_0x42e565['shift']());}};_0x16c40b(++_0x3a6c33);}(_0xbd43,0xde));var _0x3bd4=function(_0x5954ae,_0x3fae55){_0x5954ae=_0x5954ae-0x0;var _0x7f562d=_0xbd43[_0x5954ae];return _0x7f562d;};'use strict';var _=require(_0x3bd4('0x0'));var util=require(_0x3bd4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3bd4('0x2'));var BPromise=require(_0x3bd4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bd4('0x4'));var rimraf=require(_0x3bd4('0x5'));var config=require(_0x3bd4('0x6'));var attributes=require(_0x3bd4('0x7'));module[_0x3bd4('0x8')]=function(_0x140845,_0x3b39ea){return _0x140845['define'](_0x3bd4('0x9'),attributes,{'tableName':_0x3bd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87b4=['request-promise','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','moment','bluebird'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x87b4,0x193));var _0x487b=function(_0x38dec9,_0xd7b9a7){_0x38dec9=_0x38dec9-0x0;var _0x5d808b=_0x87b4[_0x38dec9];return _0x5d808b;};'use strict';var _=require(_0x487b('0x0'));var util=require(_0x487b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x487b('0x2'));var BPromise=require(_0x487b('0x3'));var rp=require(_0x487b('0x4'));var fs=require('fs');var path=require(_0x487b('0x5'));var rimraf=require('rimraf');var config=require(_0x487b('0x6'));var attributes=require(_0x487b('0x7'));module['exports']=function(_0x12c6ec,_0x21996e){return _0x12c6ec[_0x487b('0x8')](_0x487b('0x9'),attributes,{'tableName':_0x487b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index f30e9a5..83b897f 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 _0x109c=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x2c6256,_0x404ccf){var _0x4db857=function(_0x40bb9f){while(--_0x40bb9f){_0x2c6256['push'](_0x2c6256['shift']());}};_0x4db857(++_0x404ccf);}(_0x109c,0x9c));var _0xc109=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x109c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc109('0x0'));var util=require(_0xc109('0x1'));var moment=require(_0xc109('0x2'));var BPromise=require(_0xc109('0x3'));var rs=require(_0xc109('0x4'));var fs=require('fs');var Redis=require(_0xc109('0x5'));var db=require(_0xc109('0x6'))['db'];var utils=require(_0xc109('0x7'));var logger=require(_0xc109('0x8'))(_0xc109('0x9'));var config=require('../../config/environment');var jayson=require(_0xc109('0xa'));var client=jayson[_0xc109('0xb')][_0xc109('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f8988,_0x28ee08,_0xbed534){return new BPromise(function(_0x61769a,_0x574a5f){return client[_0xc109('0xd')](_0x1f8988,_0xbed534)[_0xc109('0xe')](function(_0x346bab){logger[_0xc109('0xf')](_0xc109('0x10'),_0x28ee08,_0xc109('0x11'));logger[_0xc109('0x12')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x28ee08,_0xc109('0x11'),JSON['stringify'](_0x346bab));if(_0x346bab['error']){if(_0x346bab[_0xc109('0x13')]['code']===0x1f4){logger[_0xc109('0x13')](_0xc109('0x10'),_0x28ee08,_0x346bab['error'][_0xc109('0x14')]);return _0x574a5f(_0x346bab[_0xc109('0x13')]['message']);}logger[_0xc109('0x13')](_0xc109('0x10'),_0x28ee08,_0x346bab['error']['message']);return _0x61769a(_0x346bab['error'][_0xc109('0x14')]);}else{logger[_0xc109('0xf')](_0xc109('0x10'),_0x28ee08,_0xc109('0x11'));_0x61769a(_0x346bab[_0xc109('0x15')]['message']);}})['catch'](function(_0x2313a3){logger[_0xc109('0x13')]('CloudProvider,\x20%s,\x20%s',_0x28ee08,_0x2313a3);_0x574a5f(_0x2313a3);});});} \ No newline at end of file +var _0xe34f=['CloudProvider,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x9f3cc8,_0x4a98d3){var _0x425ed1=function(_0x37bff1){while(--_0x37bff1){_0x9f3cc8['push'](_0x9f3cc8['shift']());}};_0x425ed1(++_0x4a98d3);}(_0xe34f,0x18b));var _0xfe34=function(_0x3eb440,_0x3c7952){_0x3eb440=_0x3eb440-0x0;var _0x443fe0=_0xe34f[_0x3eb440];return _0x443fe0;};'use strict';var _=require(_0xfe34('0x0'));var util=require(_0xfe34('0x1'));var moment=require(_0xfe34('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe34('0x3'));var fs=require('fs');var Redis=require(_0xfe34('0x4'));var db=require(_0xfe34('0x5'))['db'];var utils=require(_0xfe34('0x6'));var logger=require('../../config/logger')(_0xfe34('0x7'));var config=require(_0xfe34('0x8'));var jayson=require(_0xfe34('0x9'));var client=jayson['client'][_0xfe34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c869,_0xf679b7,_0x7e2bb6){return new BPromise(function(_0x3bcba6,_0x4745ba){return client[_0xfe34('0xb')](_0x5c869,_0x7e2bb6)[_0xfe34('0xc')](function(_0x51265d){logger['info']('CloudProvider,\x20%s,\x20%s',_0xf679b7,_0xfe34('0xd'));logger[_0xfe34('0xe')](_0xfe34('0xf'),_0xf679b7,'request\x20sent',JSON[_0xfe34('0x10')](_0x51265d));if(_0x51265d[_0xfe34('0x11')]){if(_0x51265d['error'][_0xfe34('0x12')]===0x1f4){logger[_0xfe34('0x11')](_0xfe34('0x13'),_0xf679b7,_0x51265d['error'][_0xfe34('0x14')]);return _0x4745ba(_0x51265d['error'][_0xfe34('0x14')]);}logger[_0xfe34('0x11')](_0xfe34('0x13'),_0xf679b7,_0x51265d[_0xfe34('0x11')]['message']);return _0x3bcba6(_0x51265d[_0xfe34('0x11')][_0xfe34('0x14')]);}else{logger[_0xfe34('0x15')](_0xfe34('0x13'),_0xf679b7,_0xfe34('0xd'));_0x3bcba6(_0x51265d[_0xfe34('0x16')][_0xfe34('0x14')]);}})['catch'](function(_0x3ca62b){logger[_0xfe34('0x11')](_0xfe34('0x13'),_0xf679b7,_0x3ca62b);_0x4745ba(_0x3ca62b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 412b7b3..555917c 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 _0x9fba=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','show','put','/:id','update','destroy','multer','util'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x9fba,0x11b));var _0xa9fb=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x9fba[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0xa9fb('0x0'));var util=require(_0xa9fb('0x1'));var path=require(_0xa9fb('0x2'));var timeout=require(_0xa9fb('0x3'));var express=require(_0xa9fb('0x4'));var router=express['Router']();var auth=require(_0xa9fb('0x5'));var interaction=require(_0xa9fb('0x6'));var config=require('../../config/environment');var controller=require(_0xa9fb('0x7'));router[_0xa9fb('0x8')]('/',auth[_0xa9fb('0x9')](),controller['index']);router[_0xa9fb('0x8')]('/:id',auth[_0xa9fb('0x9')](),controller[_0xa9fb('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa9fb('0xb')](_0xa9fb('0xc'),auth[_0xa9fb('0x9')](),controller[_0xa9fb('0xd')]);router['delete'](_0xa9fb('0xc'),auth[_0xa9fb('0x9')](),controller[_0xa9fb('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5430=['/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5430,0x9f));var _0x0543=function(_0x5ca75e,_0x5841fc){_0x5ca75e=_0x5ca75e-0x0;var _0x51723d=_0x5430[_0x5ca75e];return _0x51723d;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express['Router']();var auth=require(_0x0543('0x5'));var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require(_0x0543('0x7'));router[_0x0543('0x8')]('/',auth[_0x0543('0x9')](),controller[_0x0543('0xa')]);router[_0x0543('0x8')](_0x0543('0xb'),auth[_0x0543('0x9')](),controller['show']);router[_0x0543('0xc')]('/',auth[_0x0543('0x9')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')](_0x0543('0xb'),auth[_0x0543('0x9')](),controller[_0x0543('0xf')]);router[_0x0543('0x10')](_0x0543('0xb'),auth[_0x0543('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4dbfb62..ca2798a 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 _0x569c=['name','STRING'];(function(_0x48e4a4,_0x15df90){var _0x5e0849=function(_0x315254){while(--_0x315254){_0x48e4a4['push'](_0x48e4a4['shift']());}};_0x5e0849(++_0x15df90);}(_0x569c,0x1a8));var _0xc569=function(_0x2b4ac7,_0x33859a){_0x2b4ac7=_0x2b4ac7-0x0;var _0x2ba2c9=_0x569c[_0x2b4ac7];return _0x2ba2c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc569('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc569('0x1')]},'phone':{'type':Sequelize[_0xc569('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc569('0x1')]},'street':{'type':Sequelize[_0xc569('0x1')]},'postalCode':{'type':Sequelize[_0xc569('0x1')]},'city':{'type':Sequelize[_0xc569('0x1')]},'country':{'type':Sequelize[_0xc569('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc569('0x1')]},'sStreet':{'type':Sequelize[_0xc569('0x1')]},'sPostalCode':{'type':Sequelize[_0xc569('0x1')]},'sCity':{'type':Sequelize[_0xc569('0x1')]},'sCountry':{'type':Sequelize[_0xc569('0x1')]},'description':{'type':Sequelize[_0xc569('0x1')]}}; \ No newline at end of file +var _0x264e=['sequelize','exports','STRING'];(function(_0x47cafd,_0x295c75){var _0x339754=function(_0xd1360e){while(--_0xd1360e){_0x47cafd['push'](_0x47cafd['shift']());}};_0x339754(++_0x295c75);}(_0x264e,0x171));var _0xe264=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x264e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe264('0x0'));module[_0xe264('0x1')]={'name':{'type':Sequelize[_0xe264('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe264('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xe264('0x2')]},'phone':{'type':Sequelize[_0xe264('0x2')]},'fax':{'type':Sequelize[_0xe264('0x2')]},'type':{'type':Sequelize[_0xe264('0x2')]},'street':{'type':Sequelize[_0xe264('0x2')]},'postalCode':{'type':Sequelize[_0xe264('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe264('0x2')]},'email':{'type':Sequelize[_0xe264('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe264('0x2')]},'sStreet':{'type':Sequelize[_0xe264('0x2')]},'sPostalCode':{'type':Sequelize[_0xe264('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe264('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b057dd0..2b08aaa 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 _0xa97f=['merge','map','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','error','addContacts','CmContact','ids','getContacts','findOne','options','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','Companies','UserProfileResource','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xa97f,0x6d));var _0xfa97=function(_0x212fe8,_0x3edb40){_0x212fe8=_0x212fe8-0x0;var _0x42bac3=_0xa97f[_0x212fe8];return _0x42bac3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa97('0x0'));var rimraf=require(_0xfa97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa97('0x2'));var rp=require(_0xfa97('0x3'));var moment=require(_0xfa97('0x4'));var BPromise=require(_0xfa97('0x5'));var Mustache=require(_0xfa97('0x6'));var util=require(_0xfa97('0x7'));var path=require(_0xfa97('0x8'));var sox=require(_0xfa97('0x9'));var csv=require('to-csv');var ejs=require(_0xfa97('0xa'));var fs=require('fs');var _=require(_0xfa97('0xb'));var squel=require(_0xfa97('0xc'));var crypto=require('crypto');var jsforce=require(_0xfa97('0xd'));var deskjs=require(_0xfa97('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa97('0xf'));var Papa=require(_0xfa97('0x10'));var Redis=require(_0xfa97('0x11'));var authService=require(_0xfa97('0x12'));var qs=require(_0xfa97('0x13'));var as=require(_0xfa97('0x14'));var hardwareService=require(_0xfa97('0x15'));var logger=require(_0xfa97('0x16'))(_0xfa97('0x17'));var utils=require(_0xfa97('0x18'));var config=require(_0xfa97('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa97('0x1a'))['db'];function respondWithStatusCode(_0x54d9fa,_0x5221f9){_0x5221f9=_0x5221f9||0xcc;return function(_0x4caa80){if(_0x4caa80){return _0x54d9fa[_0xfa97('0x1b')](_0x5221f9);}return _0x54d9fa[_0xfa97('0x1c')](_0x5221f9)[_0xfa97('0x1d')]();};}function respondWithResult(_0x419807,_0x20cee2){_0x20cee2=_0x20cee2||0xc8;return function(_0x79dd4d){if(_0x79dd4d){return _0x419807[_0xfa97('0x1c')](_0x20cee2)['json'](_0x79dd4d);}};}function respondWithFilteredResult(_0x5392d3,_0x16c8c8){return function(_0x2c0a63){if(_0x2c0a63){var _0x47c7db=_0x2c0a63[_0xfa97('0x1e')],_0x27a39e=_0x16c8c8[_0xfa97('0x1f')],_0x450328=_0x16c8c8[_0xfa97('0x1f')]+_0x16c8c8[_0xfa97('0x20')],_0x4b2eb7;if(_0x450328>=_0x47c7db){_0x450328=_0x47c7db;_0x4b2eb7=0xc8;}else{_0x4b2eb7=0xce;}_0x5392d3['status'](_0x4b2eb7);return _0x5392d3[_0xfa97('0x21')](_0xfa97('0x22'),_0x27a39e+'-'+_0x450328+'/'+_0x47c7db)[_0xfa97('0x23')](_0x2c0a63);}return null;};}function patchUpdates(_0x530e34){return function(_0x45b773){try{jsonpatch['apply'](_0x45b773,_0x530e34,!![]);}catch(_0x5eb490){return BPromise[_0xfa97('0x24')](_0x5eb490);}return _0x45b773['save']();};}function saveUpdates(_0x20848c,_0x4d84a6){return function(_0x2687b0){if(_0x2687b0){return _0x2687b0[_0xfa97('0x25')](_0x20848c)[_0xfa97('0x26')](function(_0x2376be){return _0x2376be;});}return null;};}function removeEntity(_0x1a5a83,_0x48e3de){return function(_0x213609){if(_0x213609){return _0x213609[_0xfa97('0x27')]()[_0xfa97('0x26')](function(){var _0x3f601a=_0x213609[_0xfa97('0x28')]({'plain':!![]});var _0x2b4a13=_0xfa97('0x29');return db[_0xfa97('0x2a')][_0xfa97('0x27')]({'where':{'type':_0x2b4a13,'resourceId':_0x3f601a['id']}})[_0xfa97('0x26')](function(){return _0x213609;});})[_0xfa97('0x26')](function(){_0x1a5a83[_0xfa97('0x1c')](0xcc)[_0xfa97('0x1d')]();});}};}function handleEntityNotFound(_0x4534c7,_0x784950){return function(_0x363a65){if(!_0x363a65){_0x4534c7['sendStatus'](0x194);}return _0x363a65;};}function handleError(_0x53d4e0,_0x1b60f8){_0x1b60f8=_0x1b60f8||0x1f4;return function(_0x360d2a){logger['error'](_0x360d2a['stack']);if(_0x360d2a[_0xfa97('0x2b')]){delete _0x360d2a[_0xfa97('0x2b')];}_0x53d4e0['status'](_0x1b60f8)[_0xfa97('0x2c')](_0x360d2a);};}exports[_0xfa97('0x2d')]=function(_0x1e8f92,_0xf0d04a){var _0x49cc49={},_0x366493={},_0x6c5b23={'count':0x0,'rows':[]};return db[_0xfa97('0x2e')][_0xfa97('0x2f')]()[_0xfa97('0x26')](function(_0x39da0a){_0x366493[_0xfa97('0x30')]=_[_0xfa97('0x31')](_0x39da0a);_0x366493[_0xfa97('0x32')]=_[_0xfa97('0x31')](_0x1e8f92[_0xfa97('0x32')]);_0x366493['filters']=_[_0xfa97('0x33')](_0x366493[_0xfa97('0x30')],_0x366493[_0xfa97('0x32')]);_0x49cc49[_0xfa97('0x34')]=_[_0xfa97('0x33')](_0x366493[_0xfa97('0x30')],qs[_0xfa97('0x35')](_0x1e8f92[_0xfa97('0x32')]['fields']));_0x49cc49[_0xfa97('0x34')]=_0x49cc49['attributes'][_0xfa97('0x36')]?_0x49cc49[_0xfa97('0x34')]:_0x366493[_0xfa97('0x30')];if(!_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x37')](_0xfa97('0x38'))){_0x49cc49[_0xfa97('0x20')]=qs['limit'](_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x20')]);_0x49cc49['offset']=qs[_0xfa97('0x1f')](_0x1e8f92[_0xfa97('0x32')]['offset']);}_0x49cc49[_0xfa97('0x39')]=qs['sort'](_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x3a')]);_0x49cc49['where']=qs[_0xfa97('0x3b')](_[_0xfa97('0x3c')](_0x1e8f92[_0xfa97('0x32')],_0x366493[_0xfa97('0x3b')]),_0x39da0a);if(_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x3d')]){_0x49cc49[_0xfa97('0x3e')]=_[_0xfa97('0x3f')](_0x49cc49['where'],{'$or':_[_0xfa97('0x40')](_0x49cc49[_0xfa97('0x34')],function(_0x392852){var _0x2ad95c={};_0x2ad95c[_0x392852]={'$like':'%'+_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x3d')]+'%'};return _0x2ad95c;})});}_0x49cc49=_['merge']({},_0x49cc49,_0x1e8f92['options']);var _0xe0fc44={'where':_0x49cc49['where']};return db[_0xfa97('0x2e')][_0xfa97('0x1e')](_0xe0fc44)['then'](function(_0x4c3ddb){_0x6c5b23[_0xfa97('0x1e')]=_0x4c3ddb;if(_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x41')]){_0x49cc49[_0xfa97('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0xfa97('0x43')](_0x49cc49);})['then'](function(_0x4a2d54){_0x6c5b23[_0xfa97('0x44')]=_0x4a2d54;return _0x6c5b23;})[_0xfa97('0x26')](respondWithFilteredResult(_0xf0d04a,_0x49cc49))[_0xfa97('0x45')](handleError(_0xf0d04a,null));})['catch'](handleError(_0xf0d04a,null));};exports['show']=function(_0x1a52fb,_0x36f41e){var _0x55b16b={'raw':![],'where':{'id':_0x1a52fb[_0xfa97('0x46')]['id']}},_0x302c42={};_0x302c42[_0xfa97('0x30')]=_[_0xfa97('0x31')](db[_0xfa97('0x2e')][_0xfa97('0x47')]);_0x302c42[_0xfa97('0x32')]=_[_0xfa97('0x31')](_0x1a52fb['query']);_0x302c42[_0xfa97('0x3b')]=_[_0xfa97('0x33')](_0x302c42[_0xfa97('0x30')],_0x302c42[_0xfa97('0x32')]);_0x55b16b['attributes']=_[_0xfa97('0x33')](_0x302c42[_0xfa97('0x30')],qs[_0xfa97('0x35')](_0x1a52fb[_0xfa97('0x32')]['fields']));_0x55b16b[_0xfa97('0x34')]=_0x55b16b[_0xfa97('0x34')][_0xfa97('0x36')]?_0x55b16b[_0xfa97('0x34')]:_0x302c42['model'];if(_0x1a52fb[_0xfa97('0x32')][_0xfa97('0x41')]){_0x55b16b['include']=[{'all':!![]}];}_0x55b16b=_[_0xfa97('0x3f')]({},_0x55b16b,_0x1a52fb['options']);return db[_0xfa97('0x2e')]['find'](_0x55b16b)[_0xfa97('0x26')](handleEntityNotFound(_0x36f41e,null))[_0xfa97('0x26')](respondWithResult(_0x36f41e,null))[_0xfa97('0x45')](handleError(_0x36f41e,null));};exports['create']=function(_0x591fdf,_0x185f39){return db[_0xfa97('0x2e')][_0xfa97('0x48')](_0x591fdf[_0xfa97('0x49')],{})['then'](function(_0x465900){var _0x2ed925=_0x591fdf[_0xfa97('0x4a')]['get']({'plain':!![]});if(!_0x2ed925)throw new Error(_0xfa97('0x4b'));if(_0x2ed925['role']===_0xfa97('0x4a')){var _0x4ca1e4=_0x465900[_0xfa97('0x28')]({'plain':!![]});var _0x1bef5f=_0xfa97('0x29');return db[_0xfa97('0x4c')][_0xfa97('0x4d')]({'where':{'name':_0x1bef5f,'userProfileId':_0x2ed925[_0xfa97('0x4e')]},'raw':!![]})[_0xfa97('0x26')](function(_0x52ce51){if(_0x52ce51&&_0x52ce51['autoAssociation']===0x0){return db[_0xfa97('0x2a')]['create']({'name':_0x4ca1e4['name'],'resourceId':_0x4ca1e4['id'],'type':_0x52ce51[_0xfa97('0x2b')],'sectionId':_0x52ce51['id']},{})[_0xfa97('0x26')](function(){return _0x465900;});}else{return _0x465900;}})[_0xfa97('0x45')](function(_0x3adc3d){logger[_0xfa97('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3adc3d);throw _0x3adc3d;});}return _0x465900;})[_0xfa97('0x26')](respondWithResult(_0x185f39,0xc9))['catch'](handleError(_0x185f39,null));};exports[_0xfa97('0x25')]=function(_0x148527,_0xb706b1){if(_0x148527[_0xfa97('0x49')]['id']){delete _0x148527['body']['id'];}return db['CmCompany'][_0xfa97('0x4d')]({'where':{'id':_0x148527[_0xfa97('0x46')]['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0xb706b1,null))[_0xfa97('0x26')](saveUpdates(_0x148527[_0xfa97('0x49')],null))['then'](respondWithResult(_0xb706b1,null))[_0xfa97('0x45')](handleError(_0xb706b1,null));};exports[_0xfa97('0x27')]=function(_0x1e3b80,_0x4209e7){return db[_0xfa97('0x2e')]['find']({'where':{'id':_0x1e3b80[_0xfa97('0x46')]['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0x4209e7,null))['then'](removeEntity(_0x4209e7,null))[_0xfa97('0x45')](handleError(_0x4209e7,null));};exports['describe']=function(_0x541a4a,_0x4cda04){return db['CmCompany'][_0xfa97('0x2f')]()['then'](respondWithResult(_0x4cda04,null))[_0xfa97('0x45')](handleError(_0x4cda04,null));};exports[_0xfa97('0x50')]=function(_0x584fd2,_0x109bf3,_0x399a1c){return db[_0xfa97('0x51')][_0xfa97('0x4d')]({'where':{'id':_0x584fd2[_0xfa97('0x46')]['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0x109bf3,null))[_0xfa97('0x26')](function(_0x5c55fc){if(_0x5c55fc){return _0x5c55fc[_0xfa97('0x50')](_0x584fd2[_0xfa97('0x49')][_0xfa97('0x52')],_['omit'](_0x584fd2[_0xfa97('0x49')],[_0xfa97('0x52'),'id'])||{});}})['then'](respondWithResult(_0x109bf3,null))[_0xfa97('0x45')](handleError(_0x109bf3,null));};exports[_0xfa97('0x53')]=function(_0x33a5d5,_0x3424b1,_0x55c7d4){var _0x5113ec={};var _0xef5307={};var _0x52f300;var _0x473f63;return db[_0xfa97('0x2e')][_0xfa97('0x54')]({'where':{'id':_0x33a5d5['params']['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0x3424b1,null))[_0xfa97('0x26')](function(_0x2fa348){if(_0x2fa348){_0x52f300=_0x2fa348;_0xef5307[_0xfa97('0x30')]=_[_0xfa97('0x31')](db[_0xfa97('0x51')][_0xfa97('0x47')]);_0xef5307[_0xfa97('0x32')]=_[_0xfa97('0x31')](_0x33a5d5[_0xfa97('0x32')]);_0xef5307['filters']=_['intersection'](_0xef5307[_0xfa97('0x30')],_0xef5307[_0xfa97('0x32')]);_0x5113ec[_0xfa97('0x34')]=_['intersection'](_0xef5307[_0xfa97('0x30')],qs[_0xfa97('0x35')](_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x35')]));_0x5113ec[_0xfa97('0x34')]=_0x5113ec[_0xfa97('0x34')]['length']?_0x5113ec[_0xfa97('0x34')]:_0xef5307[_0xfa97('0x30')];_0x5113ec[_0xfa97('0x39')]=qs['sort'](_0x33a5d5['query'][_0xfa97('0x3a')]);_0x5113ec['where']=qs[_0xfa97('0x3b')](_[_0xfa97('0x3c')](_0x33a5d5[_0xfa97('0x32')],_0xef5307[_0xfa97('0x3b')]));if(_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x3d')]){_0x5113ec[_0xfa97('0x3e')]=_[_0xfa97('0x3f')](_0x5113ec[_0xfa97('0x3e')],{'$or':_[_0xfa97('0x40')](_0x5113ec[_0xfa97('0x34')],function(_0x10ffcd){var _0xbe2621={};_0xbe2621[_0x10ffcd]={'$like':'%'+_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x3d')]+'%'};return _0xbe2621;})});}_0x5113ec=_[_0xfa97('0x3f')]({},_0x5113ec,_0x33a5d5[_0xfa97('0x55')]);return _0x52f300[_0xfa97('0x53')](_0x5113ec);}})[_0xfa97('0x26')](function(_0x145b6d){if(_0x145b6d){_0x473f63=_0x145b6d[_0xfa97('0x36')];if(!_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x37')]('nolimit')){_0x5113ec[_0xfa97('0x20')]=qs['limit'](_0x33a5d5['query']['limit']);_0x5113ec[_0xfa97('0x1f')]=qs[_0xfa97('0x1f')](_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x1f')]);}return _0x52f300['getContacts'](_0x5113ec);}})[_0xfa97('0x26')](function(_0x147a47){if(_0x147a47){return _0x147a47?{'count':_0x473f63,'rows':_0x147a47}:null;}})[_0xfa97('0x26')](respondWithResult(_0x3424b1,null))[_0xfa97('0x45')](handleError(_0x3424b1,null));}; \ No newline at end of file +var _0x1a4b=['filter','map','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','getContacts','findOne','rawAttributes','html-pdf','rimraf','zip-dir','request-promise','moment','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x1a4b,0x112));var _0xb1a4=function(_0x1afb8e,_0x5d62f3){_0x1afb8e=_0x1afb8e-0x0;var _0x218427=_0x1a4b[_0x1afb8e];return _0x218427;};'use strict';var pdf=require(_0xb1a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb1a4('0x1'));var zipdir=require(_0xb1a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1a4('0x3'));var moment=require(_0xb1a4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb1a4('0x5'));var csv=require(_0xb1a4('0x6'));var ejs=require(_0xb1a4('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb1a4('0x8'));var crypto=require(_0xb1a4('0x9'));var jsforce=require(_0xb1a4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb1a4('0x6'));var querystring=require(_0xb1a4('0xb'));var Papa=require(_0xb1a4('0xc'));var Redis=require('ioredis');var authService=require(_0xb1a4('0xd'));var qs=require(_0xb1a4('0xe'));var as=require(_0xb1a4('0xf'));var hardwareService=require(_0xb1a4('0x10'));var logger=require('../../config/logger')(_0xb1a4('0x11'));var utils=require('../../config/utils');var config=require(_0xb1a4('0x12'));var licenseUtil=require(_0xb1a4('0x13'));var db=require(_0xb1a4('0x14'))['db'];function respondWithStatusCode(_0x56523b,_0x4ecdb1){_0x4ecdb1=_0x4ecdb1||0xcc;return function(_0x522a4a){if(_0x522a4a){return _0x56523b['sendStatus'](_0x4ecdb1);}return _0x56523b[_0xb1a4('0x15')](_0x4ecdb1)[_0xb1a4('0x16')]();};}function respondWithResult(_0x392182,_0x241993){_0x241993=_0x241993||0xc8;return function(_0x1925b1){if(_0x1925b1){return _0x392182['status'](_0x241993)[_0xb1a4('0x17')](_0x1925b1);}};}function respondWithFilteredResult(_0x4740d2,_0x43d6a4){return function(_0x30eaff){if(_0x30eaff){var _0x42566e=_0x30eaff[_0xb1a4('0x18')],_0x8b004e=_0x43d6a4[_0xb1a4('0x19')],_0x5e29df=_0x43d6a4['offset']+_0x43d6a4[_0xb1a4('0x1a')],_0x15542e;if(_0x5e29df>=_0x42566e){_0x5e29df=_0x42566e;_0x15542e=0xc8;}else{_0x15542e=0xce;}_0x4740d2[_0xb1a4('0x15')](_0x15542e);return _0x4740d2['set']('Content-Range',_0x8b004e+'-'+_0x5e29df+'/'+_0x42566e)[_0xb1a4('0x17')](_0x30eaff);}return null;};}function patchUpdates(_0x1a6234){return function(_0x2f65d2){try{jsonpatch[_0xb1a4('0x1b')](_0x2f65d2,_0x1a6234,!![]);}catch(_0x54d427){return BPromise[_0xb1a4('0x1c')](_0x54d427);}return _0x2f65d2[_0xb1a4('0x1d')]();};}function saveUpdates(_0x29a719,_0x5e329c){return function(_0x5ca9e0){if(_0x5ca9e0){return _0x5ca9e0[_0xb1a4('0x1e')](_0x29a719)[_0xb1a4('0x1f')](function(_0x13d23d){return _0x13d23d;});}return null;};}function removeEntity(_0x5b693c,_0x7aa55f){return function(_0x5bb885){if(_0x5bb885){return _0x5bb885[_0xb1a4('0x20')]()[_0xb1a4('0x1f')](function(){var _0x43d4dd=_0x5bb885[_0xb1a4('0x21')]({'plain':!![]});var _0x13038f='Companies';return db[_0xb1a4('0x22')][_0xb1a4('0x20')]({'where':{'type':_0x13038f,'resourceId':_0x43d4dd['id']}})[_0xb1a4('0x1f')](function(){return _0x5bb885;});})[_0xb1a4('0x1f')](function(){_0x5b693c[_0xb1a4('0x15')](0xcc)[_0xb1a4('0x16')]();});}};}function handleEntityNotFound(_0x23c866,_0x1a50f3){return function(_0x526233){if(!_0x526233){_0x23c866[_0xb1a4('0x23')](0x194);}return _0x526233;};}function handleError(_0x334264,_0x316510){_0x316510=_0x316510||0x1f4;return function(_0x31495d){logger[_0xb1a4('0x24')](_0x31495d[_0xb1a4('0x25')]);if(_0x31495d[_0xb1a4('0x26')]){delete _0x31495d[_0xb1a4('0x26')];}_0x334264[_0xb1a4('0x15')](_0x316510)[_0xb1a4('0x27')](_0x31495d);};}exports[_0xb1a4('0x28')]=function(_0x2b7cd6,_0x2d3db7){var _0x3785c8={},_0x5eb32f={},_0x1796ef={'count':0x0,'rows':[]};return db[_0xb1a4('0x29')]['describe']()['then'](function(_0x3aa2d1){_0x5eb32f['model']=_['keys'](_0x3aa2d1);_0x5eb32f['query']=_['keys'](_0x2b7cd6['query']);_0x5eb32f[_0xb1a4('0x2a')]=_[_0xb1a4('0x2b')](_0x5eb32f[_0xb1a4('0x2c')],_0x5eb32f[_0xb1a4('0x2d')]);_0x3785c8[_0xb1a4('0x2e')]=_[_0xb1a4('0x2b')](_0x5eb32f[_0xb1a4('0x2c')],qs[_0xb1a4('0x2f')](_0x2b7cd6[_0xb1a4('0x2d')]['fields']));_0x3785c8[_0xb1a4('0x2e')]=_0x3785c8[_0xb1a4('0x2e')][_0xb1a4('0x30')]?_0x3785c8[_0xb1a4('0x2e')]:_0x5eb32f[_0xb1a4('0x2c')];if(!_0x2b7cd6['query'][_0xb1a4('0x31')]('nolimit')){_0x3785c8[_0xb1a4('0x1a')]=qs[_0xb1a4('0x1a')](_0x2b7cd6[_0xb1a4('0x2d')][_0xb1a4('0x1a')]);_0x3785c8[_0xb1a4('0x19')]=qs[_0xb1a4('0x19')](_0x2b7cd6[_0xb1a4('0x2d')][_0xb1a4('0x19')]);}_0x3785c8[_0xb1a4('0x32')]=qs[_0xb1a4('0x33')](_0x2b7cd6[_0xb1a4('0x2d')]['sort']);_0x3785c8[_0xb1a4('0x34')]=qs[_0xb1a4('0x2a')](_[_0xb1a4('0x35')](_0x2b7cd6['query'],_0x5eb32f[_0xb1a4('0x2a')]),_0x3aa2d1);if(_0x2b7cd6['query'][_0xb1a4('0x36')]){_0x3785c8['where']=_['merge'](_0x3785c8[_0xb1a4('0x34')],{'$or':_[_0xb1a4('0x37')](_0x3785c8[_0xb1a4('0x2e')],function(_0x3feaf3){var _0x268490={};_0x268490[_0x3feaf3]={'$like':'%'+_0x2b7cd6[_0xb1a4('0x2d')][_0xb1a4('0x36')]+'%'};return _0x268490;})});}_0x3785c8=_[_0xb1a4('0x38')]({},_0x3785c8,_0x2b7cd6[_0xb1a4('0x39')]);var _0x2d041e={'where':_0x3785c8[_0xb1a4('0x34')]};return db[_0xb1a4('0x29')][_0xb1a4('0x18')](_0x2d041e)[_0xb1a4('0x1f')](function(_0xe3e906){_0x1796ef[_0xb1a4('0x18')]=_0xe3e906;if(_0x2b7cd6[_0xb1a4('0x2d')][_0xb1a4('0x3a')]){_0x3785c8[_0xb1a4('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0xb1a4('0x3c')](_0x3785c8);})[_0xb1a4('0x1f')](function(_0x51ee36){_0x1796ef[_0xb1a4('0x3d')]=_0x51ee36;return _0x1796ef;})[_0xb1a4('0x1f')](respondWithFilteredResult(_0x2d3db7,_0x3785c8))['catch'](handleError(_0x2d3db7,null));})[_0xb1a4('0x3e')](handleError(_0x2d3db7,null));};exports[_0xb1a4('0x3f')]=function(_0x193464,_0x757c4){var _0xc88ca6={'raw':![],'where':{'id':_0x193464[_0xb1a4('0x40')]['id']}},_0x2f5cdd={};_0x2f5cdd[_0xb1a4('0x2c')]=_[_0xb1a4('0x41')](db[_0xb1a4('0x29')]['rawAttributes']);_0x2f5cdd[_0xb1a4('0x2d')]=_[_0xb1a4('0x41')](_0x193464[_0xb1a4('0x2d')]);_0x2f5cdd[_0xb1a4('0x2a')]=_[_0xb1a4('0x2b')](_0x2f5cdd[_0xb1a4('0x2c')],_0x2f5cdd[_0xb1a4('0x2d')]);_0xc88ca6[_0xb1a4('0x2e')]=_['intersection'](_0x2f5cdd[_0xb1a4('0x2c')],qs[_0xb1a4('0x2f')](_0x193464[_0xb1a4('0x2d')][_0xb1a4('0x2f')]));_0xc88ca6[_0xb1a4('0x2e')]=_0xc88ca6[_0xb1a4('0x2e')][_0xb1a4('0x30')]?_0xc88ca6[_0xb1a4('0x2e')]:_0x2f5cdd[_0xb1a4('0x2c')];if(_0x193464[_0xb1a4('0x2d')][_0xb1a4('0x3a')]){_0xc88ca6[_0xb1a4('0x3b')]=[{'all':!![]}];}_0xc88ca6=_[_0xb1a4('0x38')]({},_0xc88ca6,_0x193464[_0xb1a4('0x39')]);return db['CmCompany'][_0xb1a4('0x42')](_0xc88ca6)[_0xb1a4('0x1f')](handleEntityNotFound(_0x757c4,null))[_0xb1a4('0x1f')](respondWithResult(_0x757c4,null))[_0xb1a4('0x3e')](handleError(_0x757c4,null));};exports[_0xb1a4('0x43')]=function(_0x26b63d,_0x319641){return db[_0xb1a4('0x29')]['create'](_0x26b63d[_0xb1a4('0x44')],{})[_0xb1a4('0x1f')](function(_0x43a17b){var _0xe28e4b=_0x26b63d[_0xb1a4('0x45')][_0xb1a4('0x21')]({'plain':!![]});if(!_0xe28e4b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe28e4b['role']===_0xb1a4('0x45')){var _0x5c1b6b=_0x43a17b[_0xb1a4('0x21')]({'plain':!![]});var _0x13dd11=_0xb1a4('0x46');return db[_0xb1a4('0x47')][_0xb1a4('0x42')]({'where':{'name':_0x13dd11,'userProfileId':_0xe28e4b[_0xb1a4('0x48')]},'raw':!![]})['then'](function(_0x84e367){if(_0x84e367&&_0x84e367[_0xb1a4('0x49')]===0x0){return db[_0xb1a4('0x22')][_0xb1a4('0x43')]({'name':_0x5c1b6b[_0xb1a4('0x26')],'resourceId':_0x5c1b6b['id'],'type':_0x84e367[_0xb1a4('0x26')],'sectionId':_0x84e367['id']},{})[_0xb1a4('0x1f')](function(){return _0x43a17b;});}else{return _0x43a17b;}})[_0xb1a4('0x3e')](function(_0x20faa3){logger[_0xb1a4('0x24')](_0xb1a4('0x4a'),_0x20faa3);throw _0x20faa3;});}return _0x43a17b;})[_0xb1a4('0x1f')](respondWithResult(_0x319641,0xc9))[_0xb1a4('0x3e')](handleError(_0x319641,null));};exports['update']=function(_0x560f0e,_0x443639){if(_0x560f0e['body']['id']){delete _0x560f0e[_0xb1a4('0x44')]['id'];}return db[_0xb1a4('0x29')][_0xb1a4('0x42')]({'where':{'id':_0x560f0e[_0xb1a4('0x40')]['id']}})['then'](handleEntityNotFound(_0x443639,null))['then'](saveUpdates(_0x560f0e[_0xb1a4('0x44')],null))[_0xb1a4('0x1f')](respondWithResult(_0x443639,null))[_0xb1a4('0x3e')](handleError(_0x443639,null));};exports['destroy']=function(_0xcf104c,_0x2e6fcd){return db['CmCompany'][_0xb1a4('0x42')]({'where':{'id':_0xcf104c['params']['id']}})[_0xb1a4('0x1f')](handleEntityNotFound(_0x2e6fcd,null))[_0xb1a4('0x1f')](removeEntity(_0x2e6fcd,null))[_0xb1a4('0x3e')](handleError(_0x2e6fcd,null));};exports[_0xb1a4('0x4b')]=function(_0x125b20,_0x1f258f){return db[_0xb1a4('0x29')][_0xb1a4('0x4b')]()['then'](respondWithResult(_0x1f258f,null))[_0xb1a4('0x3e')](handleError(_0x1f258f,null));};exports[_0xb1a4('0x4c')]=function(_0x1ea764,_0x221c7d,_0x19ff6f){return db[_0xb1a4('0x4d')][_0xb1a4('0x42')]({'where':{'id':_0x1ea764[_0xb1a4('0x40')]['id']}})[_0xb1a4('0x1f')](handleEntityNotFound(_0x221c7d,null))[_0xb1a4('0x1f')](function(_0x955bd8){if(_0x955bd8){return _0x955bd8['addContacts'](_0x1ea764['body'][_0xb1a4('0x4e')],_['omit'](_0x1ea764[_0xb1a4('0x44')],[_0xb1a4('0x4e'),'id'])||{});}})[_0xb1a4('0x1f')](respondWithResult(_0x221c7d,null))[_0xb1a4('0x3e')](handleError(_0x221c7d,null));};exports[_0xb1a4('0x4f')]=function(_0x50e7b3,_0x21e9d8,_0x202b32){var _0x1aeab8={};var _0x29ae70={};var _0x52c932;var _0x4f94b4;return db[_0xb1a4('0x29')][_0xb1a4('0x50')]({'where':{'id':_0x50e7b3[_0xb1a4('0x40')]['id']}})[_0xb1a4('0x1f')](handleEntityNotFound(_0x21e9d8,null))['then'](function(_0x485ed8){if(_0x485ed8){_0x52c932=_0x485ed8;_0x29ae70[_0xb1a4('0x2c')]=_[_0xb1a4('0x41')](db[_0xb1a4('0x4d')][_0xb1a4('0x51')]);_0x29ae70['query']=_[_0xb1a4('0x41')](_0x50e7b3[_0xb1a4('0x2d')]);_0x29ae70['filters']=_['intersection'](_0x29ae70['model'],_0x29ae70[_0xb1a4('0x2d')]);_0x1aeab8[_0xb1a4('0x2e')]=_[_0xb1a4('0x2b')](_0x29ae70[_0xb1a4('0x2c')],qs['fields'](_0x50e7b3['query']['fields']));_0x1aeab8[_0xb1a4('0x2e')]=_0x1aeab8[_0xb1a4('0x2e')][_0xb1a4('0x30')]?_0x1aeab8[_0xb1a4('0x2e')]:_0x29ae70['model'];_0x1aeab8['order']=qs[_0xb1a4('0x33')](_0x50e7b3[_0xb1a4('0x2d')][_0xb1a4('0x33')]);_0x1aeab8[_0xb1a4('0x34')]=qs[_0xb1a4('0x2a')](_['pick'](_0x50e7b3['query'],_0x29ae70[_0xb1a4('0x2a')]));if(_0x50e7b3[_0xb1a4('0x2d')][_0xb1a4('0x36')]){_0x1aeab8[_0xb1a4('0x34')]=_[_0xb1a4('0x38')](_0x1aeab8['where'],{'$or':_[_0xb1a4('0x37')](_0x1aeab8[_0xb1a4('0x2e')],function(_0x554779){var _0x4c10d9={};_0x4c10d9[_0x554779]={'$like':'%'+_0x50e7b3[_0xb1a4('0x2d')]['filter']+'%'};return _0x4c10d9;})});}_0x1aeab8=_[_0xb1a4('0x38')]({},_0x1aeab8,_0x50e7b3[_0xb1a4('0x39')]);return _0x52c932['getContacts'](_0x1aeab8);}})[_0xb1a4('0x1f')](function(_0xe3981f){if(_0xe3981f){_0x4f94b4=_0xe3981f[_0xb1a4('0x30')];if(!_0x50e7b3['query']['hasOwnProperty']('nolimit')){_0x1aeab8[_0xb1a4('0x1a')]=qs['limit'](_0x50e7b3[_0xb1a4('0x2d')][_0xb1a4('0x1a')]);_0x1aeab8[_0xb1a4('0x19')]=qs[_0xb1a4('0x19')](_0x50e7b3[_0xb1a4('0x2d')][_0xb1a4('0x19')]);}return _0x52c932[_0xb1a4('0x4f')](_0x1aeab8);}})[_0xb1a4('0x1f')](function(_0x40c517){if(_0x40c517){return _0x40c517?{'count':_0x4f94b4,'rows':_0x40c517}:null;}})[_0xb1a4('0x1f')](respondWithResult(_0x21e9d8,null))[_0xb1a4('0x3e')](handleError(_0x21e9d8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 01718ec..f17f082 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 _0x815b=['./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x815b,0xb4));var _0xb815=function(_0x5736b7,_0x43cf28){_0x5736b7=_0x5736b7-0x0;var _0x27cd4e=_0x815b[_0x5736b7];return _0x27cd4e;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var logger=require(_0xb815('0x2'))(_0xb815('0x3'));var moment=require(_0xb815('0x4'));var BPromise=require('bluebird');var rp=require(_0xb815('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb815('0x6'));var attributes=require(_0xb815('0x7'));module[_0xb815('0x8')]=function(_0x5a5c18,_0x466899){return _0x5a5c18[_0xb815('0x9')]('CmCompany',attributes,{'tableName':_0xb815('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02a7=['cm_companies','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany'];(function(_0x3e9030,_0x16c384){var _0x526b49=function(_0x3228fe){while(--_0x3228fe){_0x3e9030['push'](_0x3e9030['shift']());}};_0x526b49(++_0x16c384);}(_0x02a7,0x7a));var _0x702a=function(_0x1dd165,_0x3f5574){_0x1dd165=_0x1dd165-0x0;var _0x36fc91=_0x02a7[_0x1dd165];return _0x36fc91;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a1a1234..fba11fc 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 _0x8f87=['client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43a55f,_0x39a263){var _0x504877=function(_0x4f0ac8){while(--_0x4f0ac8){_0x43a55f['push'](_0x43a55f['shift']());}};_0x504877(++_0x39a263);}(_0x8f87,0x109));var _0x78f8=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x8f87[_0x533110];return _0xc3c866;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x78f8('0x0'));var rs=require(_0x78f8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78f8('0x2'))['db'];var utils=require(_0x78f8('0x3'));var logger=require(_0x78f8('0x4'))(_0x78f8('0x5'));var config=require(_0x78f8('0x6'));var jayson=require(_0x78f8('0x7'));var client=jayson[_0x78f8('0x8')][_0x78f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb159a,_0x1eab97,_0x36b9be){return new BPromise(function(_0x4635e8,_0x1075f8){return client[_0x78f8('0xa')](_0xb159a,_0x36b9be)[_0x78f8('0xb')](function(_0xe466e1){logger['info'](_0x78f8('0xc'),_0x1eab97,_0x78f8('0xd'));logger[_0x78f8('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1eab97,_0x78f8('0xd'),JSON[_0x78f8('0xf')](_0xe466e1));if(_0xe466e1[_0x78f8('0x10')]){if(_0xe466e1[_0x78f8('0x10')][_0x78f8('0x11')]===0x1f4){logger[_0x78f8('0x10')](_0x78f8('0xc'),_0x1eab97,_0xe466e1['error'][_0x78f8('0x12')]);return _0x1075f8(_0xe466e1['error'][_0x78f8('0x12')]);}logger[_0x78f8('0x10')](_0x78f8('0xc'),_0x1eab97,_0xe466e1['error']['message']);return _0x4635e8(_0xe466e1[_0x78f8('0x10')][_0x78f8('0x12')]);}else{logger[_0x78f8('0x13')](_0x78f8('0xc'),_0x1eab97,_0x78f8('0xd'));_0x4635e8(_0xe466e1[_0x78f8('0x14')]['message']);}})['catch'](function(_0x109f86){logger[_0x78f8('0x10')](_0x78f8('0xc'),_0x1eab97,_0x109f86);_0x1075f8(_0x109f86);});});} \ No newline at end of file +var _0x3ec3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x3ec3,0x9d));var _0x33ec=function(_0x138916,_0x534dde){_0x138916=_0x138916-0x0;var _0x4c8600=_0x3ec3[_0x138916];return _0x4c8600;};'use strict';var _=require(_0x33ec('0x0'));var util=require('util');var moment=require(_0x33ec('0x1'));var BPromise=require(_0x33ec('0x2'));var rs=require(_0x33ec('0x3'));var fs=require('fs');var Redis=require(_0x33ec('0x4'));var db=require(_0x33ec('0x5'))['db'];var utils=require(_0x33ec('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x33ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x33ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38425c,_0x97ab87,_0x1ce2cf){return new BPromise(function(_0xca3ec8,_0x2a1db8){return client[_0x33ec('0x9')](_0x38425c,_0x1ce2cf)[_0x33ec('0xa')](function(_0x3b49d0){logger[_0x33ec('0xb')](_0x33ec('0xc'),_0x97ab87,'request\x20sent');logger[_0x33ec('0xd')](_0x33ec('0xe'),_0x97ab87,_0x33ec('0xf'),JSON['stringify'](_0x3b49d0));if(_0x3b49d0[_0x33ec('0x10')]){if(_0x3b49d0['error'][_0x33ec('0x11')]===0x1f4){logger['error'](_0x33ec('0xc'),_0x97ab87,_0x3b49d0[_0x33ec('0x10')]['message']);return _0x2a1db8(_0x3b49d0[_0x33ec('0x10')][_0x33ec('0x12')]);}logger[_0x33ec('0x10')]('CmCompany,\x20%s,\x20%s',_0x97ab87,_0x3b49d0[_0x33ec('0x10')][_0x33ec('0x12')]);return _0xca3ec8(_0x3b49d0[_0x33ec('0x10')][_0x33ec('0x12')]);}else{logger[_0x33ec('0xb')](_0x33ec('0xc'),_0x97ab87,'request\x20sent');_0xca3ec8(_0x3b49d0[_0x33ec('0x13')][_0x33ec('0x12')]);}})['catch'](function(_0x151d10){logger[_0x33ec('0x10')]('CmCompany,\x20%s,\x20%s',_0x97ab87,_0x151d10);_0x2a1db8(_0x151d10);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index fcd0701..2055709 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 _0xc1c6=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','getContacts','post','/:id/contacts','put','delete','destroy','exports'];(function(_0x2c69dd,_0x5e57f7){var _0x44d269=function(_0x32e9ed){while(--_0x32e9ed){_0x2c69dd['push'](_0x2c69dd['shift']());}};_0x44d269(++_0x5e57f7);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x17f75c,_0x252406){_0x17f75c=_0x17f75c-0x0;var _0x5bde93=_0xc1c6[_0x17f75c];return _0x5bde93;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/describe',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0x8')](_0x6c1c('0xa'),auth['isAuthenticated'](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x8')]('/:id/contacts',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0xc')]);router[_0x6c1c('0xd')]('/',auth[_0x6c1c('0x7')](),controller['create']);router[_0x6c1c('0xd')](_0x6c1c('0xe'),auth[_0x6c1c('0x7')](),controller['addContacts']);router[_0x6c1c('0xf')](_0x6c1c('0xa'),auth[_0x6c1c('0x7')](),controller['update']);router[_0x6c1c('0x10')]('/:id',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x11')]);module[_0x6c1c('0x12')]=router; \ No newline at end of file +var _0xaebd=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x2d7559,_0x313639){_0x2d7559=_0x2d7559-0x0;var _0x4b2067=_0xaebd[_0x2d7559];return _0x4b2067;};'use strict';var multer=require(_0xdaeb('0x0'));var util=require('util');var path=require(_0xdaeb('0x1'));var timeout=require(_0xdaeb('0x2'));var express=require(_0xdaeb('0x3'));var router=express[_0xdaeb('0x4')]();var auth=require(_0xdaeb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdaeb('0x6'));var controller=require(_0xdaeb('0x7'));router[_0xdaeb('0x8')]('/',auth[_0xdaeb('0x9')](),controller[_0xdaeb('0xa')]);router['get'](_0xdaeb('0xb'),auth[_0xdaeb('0x9')](),controller['describe']);router['get'](_0xdaeb('0xc'),auth[_0xdaeb('0x9')](),controller[_0xdaeb('0xd')]);router['get'](_0xdaeb('0xe'),auth['isAuthenticated'](),controller[_0xdaeb('0xf')]);router['post']('/',auth[_0xdaeb('0x9')](),controller['create']);router[_0xdaeb('0x10')](_0xdaeb('0xe'),auth['isAuthenticated'](),controller['addContacts']);router[_0xdaeb('0x11')]('/:id',auth[_0xdaeb('0x9')](),controller[_0xdaeb('0x12')]);router[_0xdaeb('0x13')](_0xdaeb('0xc'),auth[_0xdaeb('0x9')](),controller[_0xdaeb('0x14')]);module[_0xdaeb('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2c6950c..775af2e 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 _0x208a=['INTEGER','NOW','lodash','sequelize','STRING','TEXT'];(function(_0x4dbda8,_0xbce830){var _0x1149ed=function(_0x299a39){while(--_0x299a39){_0x4dbda8['push'](_0x4dbda8['shift']());}};_0x1149ed(++_0xbce830);}(_0x208a,0x1e2));var _0xa208=function(_0x2031cf,_0x2de6ee){_0x2031cf=_0x2031cf-0x0;var _0x290057=_0x208a[_0x2031cf];return _0x290057;};'use strict';var _=require(_0xa208('0x0'));var Sequelize=require(_0xa208('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xa208('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa208('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa208('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa208('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa208('0x3')]},'phone':{'type':Sequelize[_0xa208('0x2')]},'mobile':{'type':Sequelize[_0xa208('0x2')]},'fax':{'type':Sequelize[_0xa208('0x2')]},'email':{'type':Sequelize[_0xa208('0x2')]},'url':{'type':Sequelize[_0xa208('0x2')]},'facebook':{'type':Sequelize[_0xa208('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xa208('0x2')]},'teams':{'type':Sequelize[_0xa208('0x2')]},'viber':{'type':Sequelize[_0xa208('0x2')]},'line':{'type':Sequelize[_0xa208('0x2')]},'wechat':{'type':Sequelize[_0xa208('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xa208('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xa208('0x5')]}}; \ No newline at end of file +var _0xdc99=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0xdc99,0xad));var _0x9dc9=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xdc99[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x9dc9('0x0'));var Sequelize=require(_0x9dc9('0x1'));module[_0x9dc9('0x2')]={'firstName':{'type':Sequelize[_0x9dc9('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9dc9('0x3')]},'street':{'type':Sequelize[_0x9dc9('0x3')]},'postalCode':{'type':Sequelize[_0x9dc9('0x3')]},'city':{'type':Sequelize[_0x9dc9('0x3')]},'country':{'type':Sequelize[_0x9dc9('0x3')]},'dateOfBirth':{'type':Sequelize[_0x9dc9('0x3')]},'description':{'type':Sequelize[_0x9dc9('0x4')]},'phone':{'type':Sequelize[_0x9dc9('0x3')]},'mobile':{'type':Sequelize[_0x9dc9('0x3')]},'fax':{'type':Sequelize[_0x9dc9('0x3')]},'email':{'type':Sequelize[_0x9dc9('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x9dc9('0x3')]},'fb_data':{'type':Sequelize[_0x9dc9('0x3')]},'twitter':{'type':Sequelize[_0x9dc9('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x9dc9('0x3')]},'viber':{'type':Sequelize[_0x9dc9('0x3')]},'line':{'type':Sequelize[_0x9dc9('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x9dc9('0x5')]},'priority':{'type':Sequelize[_0x9dc9('0x5')](0x2)[_0x9dc9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9dc9('0x7')],'defaultValue':Sequelize[_0x9dc9('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 77c6cfb..8e64cf6 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 _0x6250=['DATE','buildExpression','map','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','QueryTypes','c.id','order','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.phone','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','destroy','params','tags','columnName','displayName','findAll','alias','custom','body','get','mergeWith','isArray','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','color','$and','omit','format','cf_%d','setFields','id\x20=\x20?','values','phone','getTags','Tag','rawAttributes','options','setTags','getHoppers','includeAll','include','getHopperHistories','nolimit','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','binding','../../components/import/cm/csv2','stringify','message','exit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','send','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','pick','select','field','tools_tags','from','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','expr','search','sqlOperator','conditions','find','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','fieldType','datetime','castTo'];(function(_0x54813d,_0x101c1f){var _0x561eea=function(_0x1faa0a){while(--_0x1faa0a){_0x54813d['push'](_0x54813d['shift']());}};_0x561eea(++_0x101c1f);}(_0x6250,0x91));var _0x0625=function(_0x5ad4e5,_0x214ce9){_0x5ad4e5=_0x5ad4e5-0x0;var _0x12480e=_0x6250[_0x5ad4e5];return _0x12480e;};'use strict';var pdf=require(_0x0625('0x0'));var emlformat=require(_0x0625('0x1'));var rimraf=require(_0x0625('0x2'));var zipdir=require(_0x0625('0x3'));var jsonpatch=require(_0x0625('0x4'));var rp=require(_0x0625('0x5'));var moment=require(_0x0625('0x6'));var BPromise=require(_0x0625('0x7'));var Mustache=require('mustache');var util=require(_0x0625('0x8'));var path=require('path');var sox=require(_0x0625('0x9'));var csv=require(_0x0625('0xa'));var ejs=require(_0x0625('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0625('0xc'));var crypto=require(_0x0625('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0625('0xe'));var Papa=require(_0x0625('0xf'));var Redis=require(_0x0625('0x10'));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(_0x0625('0x11'))(_0x0625('0x12'));var utils=require('../../config/utils');var config=require(_0x0625('0x13'));var licenseUtil=require(_0x0625('0x14'));var db=require(_0x0625('0x15'))['db'];config[_0x0625('0x16')]=_[_0x0625('0x17')](config[_0x0625('0x16')],{'host':_0x0625('0x18'),'port':0x18eb});var socket=require(_0x0625('0x19'))(new Redis(config['redis']));require(_0x0625('0x1a'))[_0x0625('0x1b')](socket);function respondWithStatusCode(_0x17c4ef,_0x2dee53){_0x2dee53=_0x2dee53||0xcc;return function(_0x366bd0){if(_0x366bd0){return _0x17c4ef[_0x0625('0x1c')](_0x2dee53);}return _0x17c4ef[_0x0625('0x1d')](_0x2dee53)[_0x0625('0x1e')]();};}function respondWithResult(_0x4447c6,_0x531e25){_0x531e25=_0x531e25||0xc8;return function(_0x328507){if(_0x328507){return _0x4447c6[_0x0625('0x1d')](_0x531e25)['json'](_0x328507);}};}function respondWithFilteredResult(_0xd88298,_0xf2929){return function(_0xb7b942){if(_0xb7b942){var _0x51bb07=_0xb7b942[_0x0625('0x1f')],_0x20eb30=_0xf2929[_0x0625('0x20')],_0x4e8c7b=_0xf2929['offset']+_0xf2929['limit'],_0x33dc09;if(_0x4e8c7b>=_0x51bb07){_0x4e8c7b=_0x51bb07;_0x33dc09=0xc8;}else{_0x33dc09=0xce;}_0xd88298[_0x0625('0x1d')](_0x33dc09);return _0xd88298[_0x0625('0x21')](_0x0625('0x22'),_0x20eb30+'-'+_0x4e8c7b+'/'+_0x51bb07)[_0x0625('0x23')](_0xb7b942);}return null;};}function patchUpdates(_0x3f0f49){return function(_0x2cae1d){try{jsonpatch[_0x0625('0x24')](_0x2cae1d,_0x3f0f49,!![]);}catch(_0x19de63){return BPromise[_0x0625('0x25')](_0x19de63);}return _0x2cae1d[_0x0625('0x26')]();};}function saveUpdates(_0x21266a,_0x327bec){return function(_0xe0737e){if(_0xe0737e){return _0xe0737e[_0x0625('0x27')](_0x21266a)[_0x0625('0x28')](function(_0x3d715d){return _0x3d715d;});}return null;};}function removeEntity(_0xbf62d1,_0x25d137){return function(_0x4d7a91){if(_0x4d7a91){return _0x4d7a91['destroy']()['then'](function(){_0xbf62d1[_0x0625('0x1d')](0xcc)[_0x0625('0x1e')]();});}};}function handleEntityNotFound(_0x533633,_0x476b71){return function(_0x3effd8){if(!_0x3effd8){_0x533633[_0x0625('0x1c')](0x194);}return _0x3effd8;};}function handleError(_0x5617be,_0x1766b5){_0x1766b5=_0x1766b5||0x1f4;return function(_0x1fe7e){logger[_0x0625('0x29')](_0x1fe7e['stack']);if(_0x1fe7e[_0x0625('0x2a')]){delete _0x1fe7e[_0x0625('0x2a')];}_0x5617be[_0x0625('0x1d')](_0x1766b5)[_0x0625('0x2b')](_0x1fe7e);};}exports['index']=function(_0x1488a1,_0x5cab6a){var _0x16b4f1={},_0x4d0a69={},_0x1143b9={'count':0x0,'rows':[]};return db['CmContact'][_0x0625('0x2c')]()['then'](function(_0x691a75){var _0x4533fc=[];for(var _0xed012a=0x0;_0xed012a0x1){_0x1a34fa['or'](_0x0625('0x69'),qs[_0x0625('0x6a')](_0x6f05b7),null);}else{if(qs[_0x0625('0x6b')](_0x6f05b7)){_0x1a34fa['or'](_0x0625('0x6c'),_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x6d'),_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x6e'),_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x6f'),_0x6f05b7+'%');}else if(qs[_0x0625('0x70')](_0x6f05b7)){_0x1a34fa['or']('c.email\x20LIKE\x20?',_0x6f05b7+'%');}else{_0x1a34fa['or']('c.firstName\x20LIKE\x20?','%'+_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x71'),'%'+_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x72'),'%'+_0x6f05b7+'%');}}}}_0x4ed7e9[_0x0625('0x4a')](_0x1a34fa);_0x4ed7e9[_0x0625('0x73')]('c.id');var _0xb383f7={'type':db['Sequelize'][_0x0625('0x74')]['SELECT'],'raw':!![]};var _0x386d98=_0x4ed7e9['clone']()[_0x0625('0x42')](_0x0625('0x75'));if(_0x16b4f1[_0x0625('0x76')]){_0x16b4f1['order'][_0x0625('0x52')](function(_0x1ae0b9){_0x4ed7e9[_0x0625('0x76')]('c.'+_0x1ae0b9[0x0],_0x1ae0b9[0x1]===_0x0625('0x77')?![]:!![]);});}if(!_[_0x0625('0x62')](_0x336cf3)){_0x4ed7e9[_0x0625('0x78')](_0x5db772);_0x386d98[_0x0625('0x4a')](_0x0625('0x79'),_0x336cf3);}BPromise[_0x0625('0x7a')]()[_0x0625('0x28')](function(){if(!_0x184ba7)return;if(_0x1488a1[_0x0625('0x7b')][_0x0625('0x7c')]!==_0x0625('0x7d'))return;if(!_[_0x0625('0x7e')](_0x184ba7[_0x0625('0x4e')],[_0x0625('0x42'),_0x0625('0x55')])){return _0x1488a1[_0x0625('0x7b')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0xd4c0a4){if(_[_0x0625('0x62')](_0xd4c0a4)){_0x386d98[_0x0625('0x4a')](_0x0625('0x7f'));_0x4ed7e9['where']('c.ListId\x20IS\x20NULL');}else{_0x386d98[_0x0625('0x4a')]('c.ListId\x20IN\x20?',_[_0x0625('0x5e')](_0xd4c0a4,'id'));_0x4ed7e9[_0x0625('0x4a')](_0x0625('0x64'),_[_0x0625('0x5e')](_0xd4c0a4,'id'));}});}})['then'](function(){if(_0x1488a1[_0x0625('0x7b')][_0x0625('0x7c')]===_0x0625('0x7d')&&!_0x184ba7&&!_0x1488a1['query']['ListId'])return[];return db[_0x0625('0x80')][_0x0625('0x38')](_0x386d98['toString'](),_0xb383f7);})[_0x0625('0x28')](function(_0x1a1607){_0x1143b9[_0x0625('0x1f')]=_0x1a1607[_0x0625('0x2e')];if(_0x1143b9[_0x0625('0x1f')]===0x0)return[];return db['sequelize'][_0x0625('0x38')](_0x2fb876[_0x0625('0x81')](),_0xb383f7)[_0x0625('0x28')](function(_0x3e5ef8){_0xc37b62=_[_0x0625('0x82')](_0x3e5ef8,'id');_0xb383f7=_[_0x0625('0x83')](_0xb383f7,{'model':db[_0x0625('0x84')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1488a1[_0x0625('0x38')][_0x0625('0x3c')]){_0x16b4f1[_0x0625('0x3b')][_0x0625('0x52')](function(_0x486c26){_0x4ed7e9['field']('c.'+_0x486c26);});}else{_0x4ed7e9[_0x0625('0x42')]('c.id');_0x4ed7e9['field'](_0x0625('0x85'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x86'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x87'));_0x4ed7e9[_0x0625('0x42')]('c.mobile');_0x4ed7e9[_0x0625('0x42')]('c.fax');_0x4ed7e9[_0x0625('0x42')](_0x0625('0x88'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x89'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x8a'));_0x4ed7e9[_0x0625('0x42')]('c.deletedAt');_0x4ed7e9[_0x0625('0x42')](_0x0625('0x8b'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x8c'),'TagIds');}if(_0x16b4f1[_0x0625('0x3e')])_0x4ed7e9['limit'](_0x16b4f1['limit']);if(_0x16b4f1['offset'])_0x4ed7e9[_0x0625('0x20')](_0x16b4f1[_0x0625('0x20')]);return db[_0x0625('0x80')][_0x0625('0x38')](_0x4ed7e9[_0x0625('0x81')](),_0xb383f7);});})[_0x0625('0x28')](function(_0x4fca5c){_0x4fca5c[_0x0625('0x52')](function(_0x496c44){if(_0x496c44[_0x0625('0x8d')]){_0x496c44[_0x0625('0x8e')]=[];_0x496c44[_0x0625('0x8d')][_0x0625('0x51')](',')[_0x0625('0x52')](function(_0x3b01f3){_0x496c44[_0x0625('0x8e')]['push'](_0xc37b62[_0x3b01f3]);});}delete _0x496c44[_0x0625('0x8d')];});_0x1143b9[_0x0625('0x8f')]=_0x4fca5c;return _0x1143b9;})[_0x0625('0x28')](respondWithFilteredResult(_0x5cab6a,_0x16b4f1));})[_0x0625('0x90')](handleError(_0x5cab6a,null));};exports[_0x0625('0x91')]=function(_0x41bb8c,_0x28daba){return db[_0x0625('0x84')][_0x0625('0x4f')]({'where':{'id':_0x41bb8c[_0x0625('0x92')]['id']}})[_0x0625('0x28')](handleEntityNotFound(_0x28daba,null))['then'](removeEntity(_0x28daba,null))[_0x0625('0x90')](handleError(_0x28daba,null));};exports[_0x0625('0x2c')]=function(_0x4ca4c7,_0x1a2be3){return db[_0x0625('0x84')][_0x0625('0x2c')]()['then'](function(_0x175704){delete _0x175704[_0x0625('0x93')];for(var _0x43b928=0x0;_0x43b928=_0x63833){_0xfc6d3d=_0x63833;_0x5d69ef=0xc8;}else{_0x5d69ef=0xce;}_0x4a0142[_0xcbb7('0x24')](_0x5d69ef);return _0x4a0142[_0xcbb7('0x28')]('Content-Range',_0xd059f1+'-'+_0xfc6d3d+'/'+_0x63833)[_0xcbb7('0x25')](_0x4afcd8);}return null;};}function patchUpdates(_0x591efb){return function(_0x3c9f4d){try{jsonpatch[_0xcbb7('0x29')](_0x3c9f4d,_0x591efb,!![]);}catch(_0x54bb65){return BPromise[_0xcbb7('0x2a')](_0x54bb65);}return _0x3c9f4d[_0xcbb7('0x2b')]();};}function saveUpdates(_0x4fdd60,_0x52b689){return function(_0x32a503){if(_0x32a503){return _0x32a503['update'](_0x4fdd60)[_0xcbb7('0x2c')](function(_0xa062a5){return _0xa062a5;});}return null;};}function removeEntity(_0x1e7202,_0x14657c){return function(_0x5b34f9){if(_0x5b34f9){return _0x5b34f9[_0xcbb7('0x2d')]()[_0xcbb7('0x2c')](function(){_0x1e7202[_0xcbb7('0x24')](0xcc)[_0xcbb7('0x23')]();});}};}function handleEntityNotFound(_0x84dfe9,_0x2f986e){return function(_0x5477cb){if(!_0x5477cb){_0x84dfe9[_0xcbb7('0x22')](0x194);}return _0x5477cb;};}function handleError(_0x3b414c,_0x1cb528){_0x1cb528=_0x1cb528||0x1f4;return function(_0x3a5f50){logger[_0xcbb7('0x2e')](_0x3a5f50[_0xcbb7('0x2f')]);if(_0x3a5f50[_0xcbb7('0x30')]){delete _0x3a5f50['name'];}_0x3b414c[_0xcbb7('0x24')](_0x1cb528)[_0xcbb7('0x31')](_0x3a5f50);};}exports[_0xcbb7('0x32')]=function(_0x274479,_0x3a39d3){var _0x156a00={},_0x9e55bd={},_0x3d6459={'count':0x0,'rows':[]};return db['CmContact'][_0xcbb7('0x33')]()[_0xcbb7('0x2c')](function(_0x3e61c6){var _0x5c02bb=[];for(var _0x2c08af=0x0;_0x2c08af0x1){_0x1e5a5b['or'](_0xcbb7('0x70'),qs[_0xcbb7('0x71')](_0x5e745e),null);}else{if(qs['isNumeric'](_0x5e745e)){_0x1e5a5b['or'](_0xcbb7('0x72'),_0x5e745e+'%');_0x1e5a5b['or'](_0xcbb7('0x73'),_0x5e745e+'%');_0x1e5a5b['or'](_0xcbb7('0x74'),_0x5e745e+'%');_0x1e5a5b['or'](_0xcbb7('0x75'),_0x5e745e+'%');}else if(qs['isEmail'](_0x5e745e)){_0x1e5a5b['or']('c.email\x20LIKE\x20?',_0x5e745e+'%');}else{_0x1e5a5b['or'](_0xcbb7('0x76'),'%'+_0x5e745e+'%');_0x1e5a5b['or']('c.lastName\x20LIKE\x20?','%'+_0x5e745e+'%');_0x1e5a5b['or'](_0xcbb7('0x77'),'%'+_0x5e745e+'%');}}}}_0x2f808e[_0xcbb7('0x45')](_0x1e5a5b);_0x2f808e['group'](_0xcbb7('0x78'));var _0x2fb112={'type':db[_0xcbb7('0x79')][_0xcbb7('0x7a')][_0xcbb7('0x7b')],'raw':!![]};var _0x4f5cf8=_0x2f808e[_0xcbb7('0x7c')]()[_0xcbb7('0x48')](_0xcbb7('0x78'));if(_0x156a00['order']){_0x156a00[_0xcbb7('0x43')][_0xcbb7('0x5a')](function(_0x3a34a8){_0x2f808e[_0xcbb7('0x43')]('c.'+_0x3a34a8[0x0],_0x3a34a8[0x1]===_0xcbb7('0x7d')?![]:!![]);});}if(!_['isEmpty'](_0x23aa60)){_0x2f808e[_0xcbb7('0x7e')](_0x468e95);_0x4f5cf8[_0xcbb7('0x45')](_0xcbb7('0x7f'),_0x23aa60);}BPromise['resolve']()[_0xcbb7('0x2c')](function(){if(!_0x47a557)return;if(_0x274479['user'][_0xcbb7('0x80')]!==_0xcbb7('0x81'))return;if(!_[_0xcbb7('0x82')](_0x47a557[_0xcbb7('0x54')],[_0xcbb7('0x48'),_0xcbb7('0x5d')])){return _0x274479[_0xcbb7('0x83')][_0xcbb7('0x84')]({'attributes':['id'],'raw':!![]})[_0xcbb7('0x2c')](function(_0x4f5f62){if(_[_0xcbb7('0x68')](_0x4f5f62)){_0x4f5cf8[_0xcbb7('0x45')](_0xcbb7('0x85'));_0x2f808e['where'](_0xcbb7('0x85'));}else{_0x4f5cf8['where'](_0xcbb7('0x6a'),_[_0xcbb7('0x59')](_0x4f5f62,'id'));_0x2f808e[_0xcbb7('0x45')](_0xcbb7('0x6a'),_[_0xcbb7('0x59')](_0x4f5f62,'id'));}});}})[_0xcbb7('0x2c')](function(){if(_0x274479[_0xcbb7('0x83')][_0xcbb7('0x80')]==='agent'&&!_0x47a557&&!_0x274479[_0xcbb7('0x3c')][_0xcbb7('0x69')])return[];return db['sequelize'][_0xcbb7('0x3c')](_0x4f5cf8[_0xcbb7('0x86')](),_0x2fb112);})['then'](function(_0x143807){_0x3d6459[_0xcbb7('0x87')]=_0x143807[_0xcbb7('0x35')];if(_0x3d6459[_0xcbb7('0x87')]===0x0)return[];return db['sequelize'][_0xcbb7('0x3c')](_0x465d1e[_0xcbb7('0x86')](),_0x2fb112)[_0xcbb7('0x2c')](function(_0x112565){_0x23f625=_[_0xcbb7('0x88')](_0x112565,'id');_0x2fb112=_[_0xcbb7('0x89')](_0x2fb112,{'model':db[_0xcbb7('0x8a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x274479[_0xcbb7('0x3c')][_0xcbb7('0x41')]){_0x156a00[_0xcbb7('0x40')][_0xcbb7('0x5a')](function(_0x888a13){_0x2f808e[_0xcbb7('0x48')]('c.'+_0x888a13);});}else{_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x78'));_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x8b'));_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x8c'));_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x8d'));_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x8e'));_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x8f'));_0x2f808e['field']('c.email');_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x90'));_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x91'));_0x2f808e[_0xcbb7('0x48')]('c.deletedAt');_0x2f808e[_0xcbb7('0x48')](_0xcbb7('0x92'));_0x2f808e['field'](_0xcbb7('0x93'),_0xcbb7('0x94'));}if(_0x156a00[_0xcbb7('0x27')])_0x2f808e['limit'](_0x156a00[_0xcbb7('0x27')]);if(_0x156a00['offset'])_0x2f808e[_0xcbb7('0x26')](_0x156a00['offset']);return db['sequelize'][_0xcbb7('0x3c')](_0x2f808e['toString'](),_0x2fb112);});})[_0xcbb7('0x2c')](function(_0xc77ae3){_0xc77ae3[_0xcbb7('0x5a')](function(_0x14edea){if(_0x14edea['TagIds']){_0x14edea[_0xcbb7('0x95')]=[];_0x14edea['TagIds'][_0xcbb7('0x58')](',')[_0xcbb7('0x5a')](function(_0x5343e2){_0x14edea[_0xcbb7('0x95')][_0xcbb7('0x37')](_0x23f625[_0x5343e2]);});}delete _0x14edea['TagIds'];});_0x3d6459['rows']=_0xc77ae3;return _0x3d6459;})[_0xcbb7('0x2c')](respondWithFilteredResult(_0x3a39d3,_0x156a00));})['catch'](handleError(_0x3a39d3,null));};exports['destroy']=function(_0x1081ad,_0x453bcd){return db[_0xcbb7('0x8a')][_0xcbb7('0x55')]({'where':{'id':_0x1081ad[_0xcbb7('0x96')]['id']}})[_0xcbb7('0x2c')](handleEntityNotFound(_0x453bcd,null))[_0xcbb7('0x2c')](removeEntity(_0x453bcd,null))[_0xcbb7('0x97')](handleError(_0x453bcd,null));};exports[_0xcbb7('0x33')]=function(_0x3ef145,_0x270197){return db[_0xcbb7('0x8a')]['describe']()[_0xcbb7('0x2c')](function(_0xb69bca){delete _0xb69bca[_0xcbb7('0x98')];for(var _0x4d2faf=0x0;_0x4d2faf{}\s\\|]/g,'-');_0x4d1512(null,util[_0x77da('0x20')]('%s-%s%s',path['basename'](_0xd5a809[_0x77da('0x1e')],path['extname'](_0xd5a809[_0x77da('0x1e')])),Date[_0x77da('0x21')](),path[_0x77da('0x22')](_0xd5a809[_0x77da('0x1e')])));}})});router[_0x77da('0x15')](_0x77da('0x23'),upload[_0x77da('0x24')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0x77da('0x1b')]({'destination':function(_0x2d009f,_0x835167,_0xbd06b7){_0xbd06b7(null,path['join'](config[_0x77da('0x1d')],_0x77da('0x25')));},'filename':function(_0x470c9f,_0x36115b,_0x446ae7){_0x36115b['originalname']=_0x36115b[_0x77da('0x1e')][_0x77da('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x446ae7(null,util[_0x77da('0x20')](_0x77da('0x26'),path['basename'](_0x36115b['originalname'],path['extname'](_0x36115b[_0x77da('0x1e')])),Date[_0x77da('0x21')](),path[_0x77da('0x22')](_0x36115b[_0x77da('0x1e')])));}})});router[_0x77da('0x15')]('/upload',upload[_0x77da('0x24')](_0x77da('0x27')),controller[_0x77da('0x28')]);router[_0x77da('0x15')](_0x77da('0x29'),auth[_0x77da('0x7')](),controller['import']);router[_0x77da('0x2a')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0x2b')]);router[_0x77da('0x2c')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0x2d')]);module['exports']=router; \ No newline at end of file +var _0x2eb2=['root','server/files/tmp','originalname','replace','basename','extname','now','/csv','single','file','uploadCsv','format','/upload','upload','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','post','merge','bulkCreate','setTags','diskStorage','join'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x2eb2[_0x55e08b];return _0xd1a7ff;};'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('./cmContact.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x9')](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0x9')](_0x22eb('0xe'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['get']('/:id/hoppers',auth[_0x22eb('0x7')](),controller['getHoppers']);router[_0x22eb('0x9')](_0x22eb('0x10'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x22eb('0x9')](_0x22eb('0x11'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x12')]);router[_0x22eb('0x9')]('/:id/jscripty_sessions',auth[_0x22eb('0x7')](),controller['getJscriptySessions']);router[_0x22eb('0x13')]('/merge',auth[_0x22eb('0x7')](),controller[_0x22eb('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x22eb('0x13')]('/create_many',auth['isAuthenticated'](),controller[_0x22eb('0x15')]);router['post']('/:id/tags',auth[_0x22eb('0x7')](),controller[_0x22eb('0x16')]);var upload=multer({'storage':multer[_0x22eb('0x17')]({'destination':function(_0x1ff041,_0x3b0940,_0x4bc0a2){_0x4bc0a2(null,path[_0x22eb('0x18')](config[_0x22eb('0x19')],_0x22eb('0x1a')));},'filename':function(_0x410c25,_0x36be50,_0x517313){_0x36be50[_0x22eb('0x1b')]=_0x36be50[_0x22eb('0x1b')][_0x22eb('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x517313(null,util['format']('%s-%s%s',path[_0x22eb('0x1d')](_0x36be50[_0x22eb('0x1b')],path[_0x22eb('0x1e')](_0x36be50[_0x22eb('0x1b')])),Date[_0x22eb('0x1f')](),path[_0x22eb('0x1e')](_0x36be50[_0x22eb('0x1b')])));}})});router['post'](_0x22eb('0x20'),upload[_0x22eb('0x21')](_0x22eb('0x22')),controller[_0x22eb('0x23')]);var upload=multer({'storage':multer[_0x22eb('0x17')]({'destination':function(_0x4da252,_0x12c133,_0x6f8ff3){_0x6f8ff3(null,path[_0x22eb('0x18')](config['root'],_0x22eb('0x1a')));},'filename':function(_0x259847,_0x4b409a,_0x32a4b6){_0x4b409a[_0x22eb('0x1b')]=_0x4b409a[_0x22eb('0x1b')][_0x22eb('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x32a4b6(null,util[_0x22eb('0x24')]('%s-%s%s',path['basename'](_0x4b409a[_0x22eb('0x1b')],path[_0x22eb('0x1e')](_0x4b409a[_0x22eb('0x1b')])),Date[_0x22eb('0x1f')](),path[_0x22eb('0x1e')](_0x4b409a[_0x22eb('0x1b')])));}})});router[_0x22eb('0x13')](_0x22eb('0x25'),upload[_0x22eb('0x21')](_0x22eb('0x22')),controller[_0x22eb('0x26')]);router[_0x22eb('0x13')]('/upload/:id',auth[_0x22eb('0x7')](),controller['import']);router[_0x22eb('0x27')](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x28')]);router[_0x22eb('0x29')](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x2a')]);module[_0x22eb('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index d44ede0..81748b4 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 _0x7e02=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7e02,0x71));var _0x27e0=function(_0x38ec19,_0x1ab472){_0x38ec19=_0x38ec19-0x0;var _0x1e0ee3=_0x7e02[_0x38ec19];return _0x1e0ee3;};'use strict';var Sequelize=require(_0x27e0('0x0'));module[_0x27e0('0x1')]={'CmContactId':{'type':Sequelize[_0x27e0('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x27e0('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x27e0('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x27e0('0x3')],'defaultValue':_0x27e0('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x4da5=['STRING','exports','INTEGER'];(function(_0x48adba,_0x5127ae){var _0x51425c=function(_0xd29a46){while(--_0xd29a46){_0x48adba['push'](_0x48adba['shift']());}};_0x51425c(++_0x5127ae);}(_0x4da5,0x1b7));var _0x54da=function(_0x4353e0,_0x2e4516){_0x4353e0=_0x4353e0-0x0;var _0x226e1a=_0x4da5[_0x4353e0];return _0x226e1a;};'use strict';var Sequelize=require('sequelize');module[_0x54da('0x0')]={'CmContactId':{'type':Sequelize[_0x54da('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x54da('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x54da('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x54da('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 32f41a9..33a5343 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 _0x8e61=['attributes','length','nolimit','order','sort','where','pick','merge','CmContactHasItem','count','includeAll','include','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields'];(function(_0xff6c6c,_0x13ea5e){var _0x110a47=function(_0x76c089){while(--_0x76c089){_0xff6c6c['push'](_0xff6c6c['shift']());}};_0x110a47(++_0x13ea5e);}(_0x8e61,0x163));var _0x18e6=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8e61[_0x550d12];return _0x12103d;};'use strict';var pdf=require(_0x18e6('0x0'));var emlformat=require(_0x18e6('0x1'));var rimraf=require(_0x18e6('0x2'));var zipdir=require(_0x18e6('0x3'));var jsonpatch=require(_0x18e6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x18e6('0x5'));var Mustache=require(_0x18e6('0x6'));var util=require(_0x18e6('0x7'));var path=require(_0x18e6('0x8'));var sox=require(_0x18e6('0x9'));var csv=require(_0x18e6('0xa'));var ejs=require(_0x18e6('0xb'));var fs=require('fs');var _=require(_0x18e6('0xc'));var squel=require(_0x18e6('0xd'));var crypto=require(_0x18e6('0xe'));var jsforce=require(_0x18e6('0xf'));var deskjs=require(_0x18e6('0x10'));var toCsv=require(_0x18e6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x18e6('0x11'));var authService=require(_0x18e6('0x12'));var qs=require(_0x18e6('0x13'));var as=require(_0x18e6('0x14'));var hardwareService=require(_0x18e6('0x15'));var logger=require('../../config/logger')(_0x18e6('0x16'));var utils=require('../../config/utils');var config=require(_0x18e6('0x17'));var licenseUtil=require(_0x18e6('0x18'));var db=require(_0x18e6('0x19'))['db'];function respondWithStatusCode(_0x29ac6b,_0x5a75f1){_0x5a75f1=_0x5a75f1||0xcc;return function(_0x770d3b){if(_0x770d3b){return _0x29ac6b[_0x18e6('0x1a')](_0x5a75f1);}return _0x29ac6b[_0x18e6('0x1b')](_0x5a75f1)[_0x18e6('0x1c')]();};}function respondWithResult(_0x2f24f2,_0x46b6a1){_0x46b6a1=_0x46b6a1||0xc8;return function(_0x3a69e4){if(_0x3a69e4){return _0x2f24f2[_0x18e6('0x1b')](_0x46b6a1)[_0x18e6('0x1d')](_0x3a69e4);}};}function respondWithFilteredResult(_0x1ea9e4,_0x1aa03e){return function(_0x730dc9){if(_0x730dc9){var _0x2a7e0d=_0x730dc9['count'],_0x2ba3e6=_0x1aa03e[_0x18e6('0x1e')],_0x253ac7=_0x1aa03e[_0x18e6('0x1e')]+_0x1aa03e[_0x18e6('0x1f')],_0x37f751;if(_0x253ac7>=_0x2a7e0d){_0x253ac7=_0x2a7e0d;_0x37f751=0xc8;}else{_0x37f751=0xce;}_0x1ea9e4[_0x18e6('0x1b')](_0x37f751);return _0x1ea9e4[_0x18e6('0x20')](_0x18e6('0x21'),_0x2ba3e6+'-'+_0x253ac7+'/'+_0x2a7e0d)[_0x18e6('0x1d')](_0x730dc9);}return null;};}function patchUpdates(_0x5e64d8){return function(_0x4cc5b7){try{jsonpatch[_0x18e6('0x22')](_0x4cc5b7,_0x5e64d8,!![]);}catch(_0x5827c5){return BPromise['reject'](_0x5827c5);}return _0x4cc5b7[_0x18e6('0x23')]();};}function saveUpdates(_0x4c756a,_0x3a88ec){return function(_0x408918){if(_0x408918){return _0x408918[_0x18e6('0x24')](_0x4c756a)[_0x18e6('0x25')](function(_0x47ea78){return _0x47ea78;});}return null;};}function removeEntity(_0x5449e3,_0x12ea33){return function(_0x1a012a){if(_0x1a012a){return _0x1a012a[_0x18e6('0x26')]()['then'](function(){var _0x756caa=_0x1a012a['get']({'plain':!![]});var _0x30b225='CmContactHasItems';return db[_0x18e6('0x27')]['destroy']({'where':{'type':_0x30b225,'resourceId':_0x756caa['id']}})[_0x18e6('0x25')](function(){return _0x1a012a;});})[_0x18e6('0x25')](function(){_0x5449e3[_0x18e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18801b,_0x32b1c1){return function(_0x3d06ee){if(!_0x3d06ee){_0x18801b[_0x18e6('0x1a')](0x194);}return _0x3d06ee;};}function handleError(_0x58a24c,_0x5b609d){_0x5b609d=_0x5b609d||0x1f4;return function(_0x1088ec){logger[_0x18e6('0x28')](_0x1088ec[_0x18e6('0x29')]);if(_0x1088ec[_0x18e6('0x2a')]){delete _0x1088ec['name'];}_0x58a24c[_0x18e6('0x1b')](_0x5b609d)[_0x18e6('0x2b')](_0x1088ec);};}exports[_0x18e6('0x2c')]=function(_0x186761,_0x3111f3){var _0x2245c5={},_0x30c07d={},_0x1936b3={'count':0x0,'rows':[]};var _0x2ef630=_['map'](db['CmContactHasItem'][_0x18e6('0x2d')],function(_0x484ea9){return{'name':_0x484ea9[_0x18e6('0x2e')],'type':_0x484ea9[_0x18e6('0x2f')]['key']};});_0x30c07d[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x2ef630,_0x18e6('0x2a'));_0x30c07d['query']=_[_0x18e6('0x32')](_0x186761[_0x18e6('0x33')]);_0x30c07d[_0x18e6('0x34')]=_[_0x18e6('0x35')](_0x30c07d[_0x18e6('0x30')],_0x30c07d[_0x18e6('0x33')]);_0x2245c5['attributes']=_[_0x18e6('0x35')](_0x30c07d[_0x18e6('0x30')],qs['fields'](_0x186761['query'][_0x18e6('0x36')]));_0x2245c5[_0x18e6('0x37')]=_0x2245c5[_0x18e6('0x37')][_0x18e6('0x38')]?_0x2245c5[_0x18e6('0x37')]:_0x30c07d['model'];if(!_0x186761['query']['hasOwnProperty'](_0x18e6('0x39'))){_0x2245c5[_0x18e6('0x1f')]=qs[_0x18e6('0x1f')](_0x186761[_0x18e6('0x33')]['limit']);_0x2245c5[_0x18e6('0x1e')]=qs[_0x18e6('0x1e')](_0x186761[_0x18e6('0x33')]['offset']);}_0x2245c5[_0x18e6('0x3a')]=qs[_0x18e6('0x3b')](_0x186761[_0x18e6('0x33')]['sort']);_0x2245c5[_0x18e6('0x3c')]=qs[_0x18e6('0x34')](_[_0x18e6('0x3d')](_0x186761[_0x18e6('0x33')],_0x30c07d['filters']),_0x2ef630);if(_0x186761[_0x18e6('0x33')]['filter']){_0x2245c5[_0x18e6('0x3c')]=_['merge'](_0x2245c5[_0x18e6('0x3c')],{'$or':_[_0x18e6('0x31')](_0x2ef630,function(_0x147d30){if(_0x147d30['type']!=='VIRTUAL'){var _0x4416e1={};_0x4416e1[_0x147d30[_0x18e6('0x2a')]]={'$like':'%'+_0x186761['query']['filter']+'%'};return _0x4416e1;}})});}_0x2245c5=_[_0x18e6('0x3e')]({},_0x2245c5,_0x186761['options']);var _0x3ef0e0={'where':_0x2245c5[_0x18e6('0x3c')]};return db[_0x18e6('0x3f')][_0x18e6('0x40')](_0x3ef0e0)[_0x18e6('0x25')](function(_0x451d99){_0x1936b3[_0x18e6('0x40')]=_0x451d99;if(_0x186761[_0x18e6('0x33')][_0x18e6('0x41')]){_0x2245c5[_0x18e6('0x42')]=[{'all':!![]}];}return db[_0x18e6('0x3f')]['findAll'](_0x2245c5);})[_0x18e6('0x25')](function(_0x474b77){_0x1936b3[_0x18e6('0x43')]=_0x474b77;return _0x1936b3;})[_0x18e6('0x25')](respondWithFilteredResult(_0x3111f3,_0x2245c5))[_0x18e6('0x44')](handleError(_0x3111f3,null));};exports[_0x18e6('0x45')]=function(_0xedf9b6,_0x150cca){var _0x323cc1={'raw':!![],'where':{'id':_0xedf9b6[_0x18e6('0x46')]['id']}},_0x300f7a={};_0x300f7a[_0x18e6('0x30')]=_[_0x18e6('0x32')](db[_0x18e6('0x3f')][_0x18e6('0x2d')]);_0x300f7a[_0x18e6('0x33')]=_[_0x18e6('0x32')](_0xedf9b6[_0x18e6('0x33')]);_0x300f7a[_0x18e6('0x34')]=_['intersection'](_0x300f7a[_0x18e6('0x30')],_0x300f7a[_0x18e6('0x33')]);_0x323cc1[_0x18e6('0x37')]=_['intersection'](_0x300f7a[_0x18e6('0x30')],qs[_0x18e6('0x36')](_0xedf9b6[_0x18e6('0x33')][_0x18e6('0x36')]));_0x323cc1[_0x18e6('0x37')]=_0x323cc1[_0x18e6('0x37')][_0x18e6('0x38')]?_0x323cc1[_0x18e6('0x37')]:_0x300f7a[_0x18e6('0x30')];if(_0xedf9b6[_0x18e6('0x33')][_0x18e6('0x41')]){_0x323cc1['include']=[{'all':!![]}];}_0x323cc1=_[_0x18e6('0x3e')]({},_0x323cc1,_0xedf9b6['options']);return db[_0x18e6('0x3f')][_0x18e6('0x47')](_0x323cc1)[_0x18e6('0x25')](handleEntityNotFound(_0x150cca,null))['then'](respondWithResult(_0x150cca,null))[_0x18e6('0x44')](handleError(_0x150cca,null));};exports[_0x18e6('0x48')]=function(_0x3becf4,_0x1583ea){return db[_0x18e6('0x3f')]['create'](_0x3becf4['body'],{})[_0x18e6('0x25')](function(_0x733826){var _0x4b6d0a=_0x3becf4['user'][_0x18e6('0x49')]({'plain':!![]});if(!_0x4b6d0a)throw new Error(_0x18e6('0x4a'));if(_0x4b6d0a[_0x18e6('0x4b')]===_0x18e6('0x4c')){var _0x36cc3f=_0x733826[_0x18e6('0x49')]({'plain':!![]});var _0x1ad7af='CmContactHasItems';return db[_0x18e6('0x4d')][_0x18e6('0x47')]({'where':{'name':_0x1ad7af,'userProfileId':_0x4b6d0a[_0x18e6('0x4e')]},'raw':!![]})[_0x18e6('0x25')](function(_0x3a33e7){if(_0x3a33e7&&_0x3a33e7[_0x18e6('0x4f')]===0x0){return db[_0x18e6('0x27')][_0x18e6('0x48')]({'name':_0x36cc3f[_0x18e6('0x2a')],'resourceId':_0x36cc3f['id'],'type':_0x3a33e7['name'],'sectionId':_0x3a33e7['id']},{})[_0x18e6('0x25')](function(){return _0x733826;});}else{return _0x733826;}})[_0x18e6('0x44')](function(_0x2d4f9c){logger[_0x18e6('0x28')](_0x18e6('0x50'),_0x2d4f9c);throw _0x2d4f9c;});}return _0x733826;})[_0x18e6('0x25')](respondWithResult(_0x1583ea,0xc9))[_0x18e6('0x44')](handleError(_0x1583ea,null));};exports['update']=function(_0xd4bc05,_0x4f8e28){if(_0xd4bc05[_0x18e6('0x51')]['id']){delete _0xd4bc05[_0x18e6('0x51')]['id'];}return db[_0x18e6('0x3f')][_0x18e6('0x47')]({'where':{'id':_0xd4bc05[_0x18e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f8e28,null))[_0x18e6('0x25')](saveUpdates(_0xd4bc05[_0x18e6('0x51')],null))[_0x18e6('0x25')](respondWithResult(_0x4f8e28,null))[_0x18e6('0x44')](handleError(_0x4f8e28,null));};exports[_0x18e6('0x26')]=function(_0x3f9557,_0x524037){return db[_0x18e6('0x3f')][_0x18e6('0x47')]({'where':{'id':_0x3f9557[_0x18e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x524037,null))['then'](removeEntity(_0x524037,null))['catch'](handleError(_0x524037,null));}; \ No newline at end of file +var _0x2f5e=['status','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','CmContactHasItem','fieldName','type','key','map','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','merge','find','create','body','user','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x464f5d,_0x163475){var _0x2605a8=function(_0x46be95){while(--_0x46be95){_0x464f5d['push'](_0x464f5d['shift']());}};_0x2605a8(++_0x163475);}(_0x2f5e,0xe0));var _0xe2f5=function(_0x24897a,_0x2c9aa0){_0x24897a=_0x24897a-0x0;var _0x3fb7b0=_0x2f5e[_0x24897a];return _0x3fb7b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe2f5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe2f5('0x1'));var rp=require(_0xe2f5('0x2'));var moment=require(_0xe2f5('0x3'));var BPromise=require(_0xe2f5('0x4'));var Mustache=require(_0xe2f5('0x5'));var util=require('util');var path=require(_0xe2f5('0x6'));var sox=require(_0xe2f5('0x7'));var csv=require('to-csv');var ejs=require(_0xe2f5('0x8'));var fs=require('fs');var _=require(_0xe2f5('0x9'));var squel=require(_0xe2f5('0xa'));var crypto=require('crypto');var jsforce=require(_0xe2f5('0xb'));var deskjs=require(_0xe2f5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe2f5('0xd'));var Papa=require(_0xe2f5('0xe'));var Redis=require(_0xe2f5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe2f5('0x10'));var as=require(_0xe2f5('0x11'));var hardwareService=require(_0xe2f5('0x12'));var logger=require(_0xe2f5('0x13'))('api');var utils=require(_0xe2f5('0x14'));var config=require(_0xe2f5('0x15'));var licenseUtil=require(_0xe2f5('0x16'));var db=require(_0xe2f5('0x17'))['db'];function respondWithStatusCode(_0x24ccca,_0x80ba59){_0x80ba59=_0x80ba59||0xcc;return function(_0x5bf4c1){if(_0x5bf4c1){return _0x24ccca[_0xe2f5('0x18')](_0x80ba59);}return _0x24ccca[_0xe2f5('0x19')](_0x80ba59)['end']();};}function respondWithResult(_0x406662,_0x2a1ecb){_0x2a1ecb=_0x2a1ecb||0xc8;return function(_0x212ac7){if(_0x212ac7){return _0x406662[_0xe2f5('0x19')](_0x2a1ecb)[_0xe2f5('0x1a')](_0x212ac7);}};}function respondWithFilteredResult(_0x21a85a,_0x58d47d){return function(_0x31ccbc){if(_0x31ccbc){var _0x84c4be=_0x31ccbc[_0xe2f5('0x1b')],_0x25100a=_0x58d47d['offset'],_0x52a091=_0x58d47d[_0xe2f5('0x1c')]+_0x58d47d['limit'],_0x4c3824;if(_0x52a091>=_0x84c4be){_0x52a091=_0x84c4be;_0x4c3824=0xc8;}else{_0x4c3824=0xce;}_0x21a85a[_0xe2f5('0x19')](_0x4c3824);return _0x21a85a[_0xe2f5('0x1d')](_0xe2f5('0x1e'),_0x25100a+'-'+_0x52a091+'/'+_0x84c4be)['json'](_0x31ccbc);}return null;};}function patchUpdates(_0x3cbbaa){return function(_0x2bd588){try{jsonpatch[_0xe2f5('0x1f')](_0x2bd588,_0x3cbbaa,!![]);}catch(_0x5e1e92){return BPromise[_0xe2f5('0x20')](_0x5e1e92);}return _0x2bd588['save']();};}function saveUpdates(_0x24f6d8,_0x16ebe7){return function(_0x3a5295){if(_0x3a5295){return _0x3a5295['update'](_0x24f6d8)[_0xe2f5('0x21')](function(_0xc56a88){return _0xc56a88;});}return null;};}function removeEntity(_0xd31609,_0x3d7fdf){return function(_0x16f4d4){if(_0x16f4d4){return _0x16f4d4[_0xe2f5('0x22')]()[_0xe2f5('0x21')](function(){var _0x5b5f22=_0x16f4d4[_0xe2f5('0x23')]({'plain':!![]});var _0x33ea35='CmContactHasItems';return db[_0xe2f5('0x24')]['destroy']({'where':{'type':_0x33ea35,'resourceId':_0x5b5f22['id']}})[_0xe2f5('0x21')](function(){return _0x16f4d4;});})['then'](function(){_0xd31609[_0xe2f5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x474cbe,_0x10ead0){return function(_0x465f4c){if(!_0x465f4c){_0x474cbe[_0xe2f5('0x18')](0x194);}return _0x465f4c;};}function handleError(_0xd8dac4,_0x3b956d){_0x3b956d=_0x3b956d||0x1f4;return function(_0x222e21){logger[_0xe2f5('0x25')](_0x222e21[_0xe2f5('0x26')]);if(_0x222e21[_0xe2f5('0x27')]){delete _0x222e21['name'];}_0xd8dac4['status'](_0x3b956d)[_0xe2f5('0x28')](_0x222e21);};}exports['index']=function(_0x80893f,_0xea1efb){var _0x4bef88={},_0x17113e={},_0x2b1c44={'count':0x0,'rows':[]};var _0x4f4c23=_['map'](db[_0xe2f5('0x29')]['rawAttributes'],function(_0x71cdaf){return{'name':_0x71cdaf[_0xe2f5('0x2a')],'type':_0x71cdaf[_0xe2f5('0x2b')][_0xe2f5('0x2c')]};});_0x17113e['model']=_[_0xe2f5('0x2d')](_0x4f4c23,'name');_0x17113e[_0xe2f5('0x2e')]=_['keys'](_0x80893f['query']);_0x17113e[_0xe2f5('0x2f')]=_[_0xe2f5('0x30')](_0x17113e['model'],_0x17113e[_0xe2f5('0x2e')]);_0x4bef88['attributes']=_[_0xe2f5('0x30')](_0x17113e[_0xe2f5('0x31')],qs[_0xe2f5('0x32')](_0x80893f['query'][_0xe2f5('0x32')]));_0x4bef88['attributes']=_0x4bef88['attributes'][_0xe2f5('0x33')]?_0x4bef88[_0xe2f5('0x34')]:_0x17113e[_0xe2f5('0x31')];if(!_0x80893f[_0xe2f5('0x2e')][_0xe2f5('0x35')](_0xe2f5('0x36'))){_0x4bef88[_0xe2f5('0x37')]=qs[_0xe2f5('0x37')](_0x80893f[_0xe2f5('0x2e')][_0xe2f5('0x37')]);_0x4bef88[_0xe2f5('0x1c')]=qs[_0xe2f5('0x1c')](_0x80893f[_0xe2f5('0x2e')]['offset']);}_0x4bef88[_0xe2f5('0x38')]=qs[_0xe2f5('0x39')](_0x80893f[_0xe2f5('0x2e')]['sort']);_0x4bef88[_0xe2f5('0x3a')]=qs[_0xe2f5('0x2f')](_[_0xe2f5('0x3b')](_0x80893f[_0xe2f5('0x2e')],_0x17113e[_0xe2f5('0x2f')]),_0x4f4c23);if(_0x80893f[_0xe2f5('0x2e')][_0xe2f5('0x3c')]){_0x4bef88[_0xe2f5('0x3a')]=_['merge'](_0x4bef88[_0xe2f5('0x3a')],{'$or':_[_0xe2f5('0x2d')](_0x4f4c23,function(_0x43fbff){if(_0x43fbff[_0xe2f5('0x2b')]!==_0xe2f5('0x3d')){var _0x512afd={};_0x512afd[_0x43fbff[_0xe2f5('0x27')]]={'$like':'%'+_0x80893f[_0xe2f5('0x2e')][_0xe2f5('0x3c')]+'%'};return _0x512afd;}})});}_0x4bef88=_['merge']({},_0x4bef88,_0x80893f[_0xe2f5('0x3e')]);var _0x3d0891={'where':_0x4bef88[_0xe2f5('0x3a')]};return db[_0xe2f5('0x29')]['count'](_0x3d0891)[_0xe2f5('0x21')](function(_0x55d3f3){_0x2b1c44[_0xe2f5('0x1b')]=_0x55d3f3;if(_0x80893f['query']['includeAll']){_0x4bef88[_0xe2f5('0x3f')]=[{'all':!![]}];}return db[_0xe2f5('0x29')][_0xe2f5('0x40')](_0x4bef88);})[_0xe2f5('0x21')](function(_0x3ec91f){_0x2b1c44[_0xe2f5('0x41')]=_0x3ec91f;return _0x2b1c44;})['then'](respondWithFilteredResult(_0xea1efb,_0x4bef88))[_0xe2f5('0x42')](handleError(_0xea1efb,null));};exports[_0xe2f5('0x43')]=function(_0x510ead,_0x1dcaae){var _0x999831={'raw':!![],'where':{'id':_0x510ead[_0xe2f5('0x44')]['id']}},_0x8a4267={};_0x8a4267[_0xe2f5('0x31')]=_['keys'](db[_0xe2f5('0x29')][_0xe2f5('0x45')]);_0x8a4267[_0xe2f5('0x2e')]=_[_0xe2f5('0x46')](_0x510ead[_0xe2f5('0x2e')]);_0x8a4267[_0xe2f5('0x2f')]=_['intersection'](_0x8a4267[_0xe2f5('0x31')],_0x8a4267[_0xe2f5('0x2e')]);_0x999831[_0xe2f5('0x34')]=_['intersection'](_0x8a4267[_0xe2f5('0x31')],qs['fields'](_0x510ead[_0xe2f5('0x2e')]['fields']));_0x999831[_0xe2f5('0x34')]=_0x999831[_0xe2f5('0x34')][_0xe2f5('0x33')]?_0x999831[_0xe2f5('0x34')]:_0x8a4267[_0xe2f5('0x31')];if(_0x510ead['query'][_0xe2f5('0x47')]){_0x999831['include']=[{'all':!![]}];}_0x999831=_[_0xe2f5('0x48')]({},_0x999831,_0x510ead[_0xe2f5('0x3e')]);return db[_0xe2f5('0x29')][_0xe2f5('0x49')](_0x999831)['then'](handleEntityNotFound(_0x1dcaae,null))[_0xe2f5('0x21')](respondWithResult(_0x1dcaae,null))['catch'](handleError(_0x1dcaae,null));};exports[_0xe2f5('0x4a')]=function(_0x18a4eb,_0x48adba){return db[_0xe2f5('0x29')][_0xe2f5('0x4a')](_0x18a4eb[_0xe2f5('0x4b')],{})[_0xe2f5('0x21')](function(_0x452cd7){var _0x507d06=_0x18a4eb[_0xe2f5('0x4c')][_0xe2f5('0x23')]({'plain':!![]});if(!_0x507d06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x507d06['role']===_0xe2f5('0x4c')){var _0x25f023=_0x452cd7[_0xe2f5('0x23')]({'plain':!![]});var _0x3e8ca4=_0xe2f5('0x4d');return db[_0xe2f5('0x4e')][_0xe2f5('0x49')]({'where':{'name':_0x3e8ca4,'userProfileId':_0x507d06[_0xe2f5('0x4f')]},'raw':!![]})[_0xe2f5('0x21')](function(_0x2d5e9f){if(_0x2d5e9f&&_0x2d5e9f[_0xe2f5('0x50')]===0x0){return db[_0xe2f5('0x24')]['create']({'name':_0x25f023[_0xe2f5('0x27')],'resourceId':_0x25f023['id'],'type':_0x2d5e9f[_0xe2f5('0x27')],'sectionId':_0x2d5e9f['id']},{})[_0xe2f5('0x21')](function(){return _0x452cd7;});}else{return _0x452cd7;}})[_0xe2f5('0x42')](function(_0x421447){logger[_0xe2f5('0x25')](_0xe2f5('0x51'),_0x421447);throw _0x421447;});}return _0x452cd7;})[_0xe2f5('0x21')](respondWithResult(_0x48adba,0xc9))[_0xe2f5('0x42')](handleError(_0x48adba,null));};exports[_0xe2f5('0x52')]=function(_0x2d4e89,_0x258390){if(_0x2d4e89['body']['id']){delete _0x2d4e89[_0xe2f5('0x4b')]['id'];}return db[_0xe2f5('0x29')][_0xe2f5('0x49')]({'where':{'id':_0x2d4e89['params']['id']}})['then'](handleEntityNotFound(_0x258390,null))[_0xe2f5('0x21')](saveUpdates(_0x2d4e89[_0xe2f5('0x4b')],null))[_0xe2f5('0x21')](respondWithResult(_0x258390,null))[_0xe2f5('0x42')](handleError(_0x258390,null));};exports[_0xe2f5('0x22')]=function(_0x4144f7,_0x292c35){return db['CmContactHasItem'][_0xe2f5('0x49')]({'where':{'id':_0x4144f7[_0xe2f5('0x44')]['id']}})[_0xe2f5('0x21')](handleEntityNotFound(_0x292c35,null))['then'](removeEntity(_0x292c35,null))[_0xe2f5('0x42')](handleError(_0x292c35,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8c56e2d..204fca1 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 _0x7278=['define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x3b06d9,_0x1be782){var _0x6d3ac8=function(_0x2f0f7e){while(--_0x2f0f7e){_0x3b06d9['push'](_0x3b06d9['shift']());}};_0x6d3ac8(++_0x1be782);}(_0x7278,0x161));var _0x8727=function(_0x306bd8,_0x145cae){_0x306bd8=_0x306bd8-0x0;var _0x47faaa=_0x7278[_0x306bd8];return _0x47faaa;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3831=['define','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmContactHasItem.attributes'];(function(_0xbb007,_0x213797){var _0x1e8a7e=function(_0x30931b){while(--_0x30931b){_0xbb007['push'](_0xbb007['shift']());}};_0x1e8a7e(++_0x213797);}(_0x3831,0x14c));var _0x1383=function(_0x26260c,_0x3a9df0){_0x26260c=_0x26260c-0x0;var _0x21f487=_0x3831[_0x26260c];return _0x21f487;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1383('0x6'));var config=require('../../config/environment');var attributes=require(_0x1383('0x7'));module['exports']=function(_0x5b64b1,_0x5eb4d8){return _0x5b64b1[_0x1383('0x8')]('CmContactHasItem',attributes,{'tableName':_0x1383('0x9'),'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 ee0b153..ce4d382 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 _0x415a=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x50798c,_0x297629){var _0x3e3066=function(_0x4067d8){while(--_0x4067d8){_0x50798c['push'](_0x50798c['shift']());}};_0x3e3066(++_0x297629);}(_0x415a,0x1df));var _0xa415=function(_0x16a25b,_0x210efd){_0x16a25b=_0x16a25b-0x0;var _0x36890a=_0x415a[_0x16a25b];return _0x36890a;};'use strict';var _=require('lodash');var util=require(_0xa415('0x0'));var moment=require(_0xa415('0x1'));var BPromise=require(_0xa415('0x2'));var rs=require(_0xa415('0x3'));var fs=require('fs');var Redis=require(_0xa415('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa415('0x5'))(_0xa415('0x6'));var config=require(_0xa415('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa415('0x8')][_0xa415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2420cc,_0x4c1ea0,_0x115405){return new BPromise(function(_0x9983c8,_0x58c3fc){return client['request'](_0x2420cc,_0x115405)[_0xa415('0xa')](function(_0xb51f2){logger[_0xa415('0xb')](_0xa415('0xc'),_0x4c1ea0,_0xa415('0xd'));logger['debug'](_0xa415('0xe'),_0x4c1ea0,_0xa415('0xd'),JSON[_0xa415('0xf')](_0xb51f2));if(_0xb51f2[_0xa415('0x10')]){if(_0xb51f2['error'][_0xa415('0x11')]===0x1f4){logger['error'](_0xa415('0xc'),_0x4c1ea0,_0xb51f2['error']['message']);return _0x58c3fc(_0xb51f2[_0xa415('0x10')][_0xa415('0x12')]);}logger[_0xa415('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4c1ea0,_0xb51f2['error'][_0xa415('0x12')]);return _0x9983c8(_0xb51f2['error'][_0xa415('0x12')]);}else{logger[_0xa415('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x4c1ea0,_0xa415('0xd'));_0x9983c8(_0xb51f2['result']['message']);}})[_0xa415('0x13')](function(_0x22c054){logger[_0xa415('0x10')](_0xa415('0xc'),_0x4c1ea0,_0x22c054);_0x58c3fc(_0x22c054);});});} \ No newline at end of file +var _0x843b=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x843b,0x91));var _0xb843=function(_0x28ccbc,_0xfd7efa){_0x28ccbc=_0x28ccbc-0x0;var _0x3737a1=_0x843b[_0x28ccbc];return _0x3737a1;};'use strict';var _=require(_0xb843('0x0'));var util=require(_0xb843('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb843('0x2'));var fs=require('fs');var Redis=require(_0xb843('0x3'));var db=require(_0xb843('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb843('0x5'))(_0xb843('0x6'));var config=require(_0xb843('0x7'));var jayson=require(_0xb843('0x8'));var client=jayson['client'][_0xb843('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x330cfc,_0x4bbf7c,_0xf00ead){return new BPromise(function(_0x383f11,_0x3dcc31){return client[_0xb843('0xa')](_0x330cfc,_0xf00ead)[_0xb843('0xb')](function(_0x13dac7){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4bbf7c,_0xb843('0xc'));logger[_0xb843('0xd')](_0xb843('0xe'),_0x4bbf7c,_0xb843('0xc'),JSON[_0xb843('0xf')](_0x13dac7));if(_0x13dac7[_0xb843('0x10')]){if(_0x13dac7[_0xb843('0x10')][_0xb843('0x11')]===0x1f4){logger[_0xb843('0x10')](_0xb843('0x12'),_0x4bbf7c,_0x13dac7[_0xb843('0x10')][_0xb843('0x13')]);return _0x3dcc31(_0x13dac7[_0xb843('0x10')][_0xb843('0x13')]);}logger[_0xb843('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4bbf7c,_0x13dac7['error'][_0xb843('0x13')]);return _0x383f11(_0x13dac7[_0xb843('0x10')]['message']);}else{logger['info'](_0xb843('0x12'),_0x4bbf7c,_0xb843('0xc'));_0x383f11(_0x13dac7['result'][_0xb843('0x13')]);}})[_0xb843('0x14')](function(_0x972d31){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4bbf7c,_0x972d31);_0x3dcc31(_0x972d31);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 2727cd3..9ca17f5 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 _0xc8f4=['./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xc8f4,0x77));var _0x4c8f=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0xc8f4[_0x118afa];return _0x167d76;};'use strict';var multer=require(_0x4c8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4c8f('0x1'));var express=require(_0x4c8f('0x2'));var router=express[_0x4c8f('0x3')]();var auth=require(_0x4c8f('0x4'));var interaction=require(_0x4c8f('0x5'));var config=require(_0x4c8f('0x6'));var controller=require(_0x4c8f('0x7'));router['get']('/',auth[_0x4c8f('0x8')](),controller[_0x4c8f('0x9')]);router[_0x4c8f('0xa')](_0x4c8f('0xb'),auth[_0x4c8f('0x8')](),controller[_0x4c8f('0xc')]);router[_0x4c8f('0xd')]('/',auth[_0x4c8f('0x8')](),controller[_0x4c8f('0xe')]);router[_0x4c8f('0xf')](_0x4c8f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4c8f('0x10')](_0x4c8f('0xb'),auth[_0x4c8f('0x8')](),controller['destroy']);module[_0x4c8f('0x11')]=router; \ No newline at end of file +var _0x8571=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x335883,_0x9d2955){var _0x28e6e2=function(_0x39e802){while(--_0x39e802){_0x335883['push'](_0x335883['shift']());}};_0x28e6e2(++_0x9d2955);}(_0x8571,0x1e1));var _0x1857=function(_0x5287e6,_0x2374de){_0x5287e6=_0x5287e6-0x0;var _0x443027=_0x8571[_0x5287e6];return _0x443027;};'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(_0x1857('0x4'));var router=express['Router']();var auth=require(_0x1857('0x5'));var interaction=require(_0x1857('0x6'));var config=require(_0x1857('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x1857('0x8')]('/',auth[_0x1857('0x9')](),controller[_0x1857('0xa')]);router['get'](_0x1857('0xb'),auth['isAuthenticated'](),controller[_0x1857('0xc')]);router['post']('/',auth[_0x1857('0x9')](),controller[_0x1857('0xd')]);router[_0x1857('0xe')](_0x1857('0xb'),auth['isAuthenticated'](),controller[_0x1857('0xf')]);router[_0x1857('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1857('0x11')]);module[_0x1857('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 1fdee4a..80a1fbe 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 _0xe325=['STRING','sequelize','INTEGER'];(function(_0x5caede,_0x438cca){var _0x259946=function(_0x38cfb9){while(--_0x38cfb9){_0x5caede['push'](_0x5caede['shift']());}};_0x259946(++_0x438cca);}(_0xe325,0xc4));var _0x5e32=function(_0x476b5f,_0x1f9952){_0x476b5f=_0x476b5f-0x0;var _0x5a23d8=_0xe325[_0x476b5f];return _0x5a23d8;};'use strict';var Sequelize=require(_0x5e32('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x5e32('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x5e32('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x663e=['sequelize','INTEGER'];(function(_0x410c4a,_0x2f89fa){var _0x120cea=function(_0x394254){while(--_0x394254){_0x410c4a['push'](_0x410c4a['shift']());}};_0x120cea(++_0x2f89fa);}(_0x663e,0x19e));var _0xe663=function(_0x1abcea,_0x5486f7){_0x1abcea=_0x1abcea-0x0;var _0x29eed3=_0x663e[_0x1abcea];return _0x29eed3;};'use strict';var Sequelize=require(_0xe663('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xe663('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'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 c39fea8..6280824 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 _0xfacb=['limit','status','set','apply','reject','save','update','destroy','then','get','CmContactHasPhones','sendStatus','error','CmContactHasPhone','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','end','json','offset'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xfacb,0x17f));var _0xbfac=function(_0x4c5d74,_0x10d7f1){_0x4c5d74=_0x4c5d74-0x0;var _0x3609cd=_0xfacb[_0x4c5d74];return _0x3609cd;};'use strict';var pdf=require(_0xbfac('0x0'));var emlformat=require(_0xbfac('0x1'));var rimraf=require(_0xbfac('0x2'));var zipdir=require(_0xbfac('0x3'));var jsonpatch=require(_0xbfac('0x4'));var rp=require(_0xbfac('0x5'));var moment=require(_0xbfac('0x6'));var BPromise=require(_0xbfac('0x7'));var Mustache=require(_0xbfac('0x8'));var util=require('util');var path=require(_0xbfac('0x9'));var sox=require(_0xbfac('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbfac('0xb'));var squel=require(_0xbfac('0xc'));var crypto=require(_0xbfac('0xd'));var jsforce=require(_0xbfac('0xe'));var deskjs=require(_0xbfac('0xf'));var toCsv=require(_0xbfac('0x10'));var querystring=require('querystring');var Papa=require(_0xbfac('0x11'));var Redis=require(_0xbfac('0x12'));var authService=require(_0xbfac('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbfac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfac('0x15'))('api');var utils=require(_0xbfac('0x16'));var config=require(_0xbfac('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b364c,_0x55581a){_0x55581a=_0x55581a||0xcc;return function(_0x33b30b){if(_0x33b30b){return _0x2b364c['sendStatus'](_0x55581a);}return _0x2b364c['status'](_0x55581a)[_0xbfac('0x18')]();};}function respondWithResult(_0x46a113,_0x496357){_0x496357=_0x496357||0xc8;return function(_0x4faebb){if(_0x4faebb){return _0x46a113['status'](_0x496357)[_0xbfac('0x19')](_0x4faebb);}};}function respondWithFilteredResult(_0xa13d0b,_0x18295e){return function(_0x147e1){if(_0x147e1){var _0x3b1b61=_0x147e1['count'],_0x138014=_0x18295e['offset'],_0x1cc6a4=_0x18295e[_0xbfac('0x1a')]+_0x18295e[_0xbfac('0x1b')],_0x39753b;if(_0x1cc6a4>=_0x3b1b61){_0x1cc6a4=_0x3b1b61;_0x39753b=0xc8;}else{_0x39753b=0xce;}_0xa13d0b[_0xbfac('0x1c')](_0x39753b);return _0xa13d0b[_0xbfac('0x1d')]('Content-Range',_0x138014+'-'+_0x1cc6a4+'/'+_0x3b1b61)[_0xbfac('0x19')](_0x147e1);}return null;};}function patchUpdates(_0xa4dfdb){return function(_0x53d691){try{jsonpatch[_0xbfac('0x1e')](_0x53d691,_0xa4dfdb,!![]);}catch(_0x5ac16f){return BPromise[_0xbfac('0x1f')](_0x5ac16f);}return _0x53d691[_0xbfac('0x20')]();};}function saveUpdates(_0x3f7556,_0x49918a){return function(_0x79f1df){if(_0x79f1df){return _0x79f1df[_0xbfac('0x21')](_0x3f7556)['then'](function(_0x5137cb){return _0x5137cb;});}return null;};}function removeEntity(_0x37de25,_0x32b2f7){return function(_0x1a13a8){if(_0x1a13a8){return _0x1a13a8[_0xbfac('0x22')]()[_0xbfac('0x23')](function(){var _0x247fb3=_0x1a13a8[_0xbfac('0x24')]({'plain':!![]});var _0x2316d5=_0xbfac('0x25');return db['UserProfileResource'][_0xbfac('0x22')]({'where':{'type':_0x2316d5,'resourceId':_0x247fb3['id']}})['then'](function(){return _0x1a13a8;});})[_0xbfac('0x23')](function(){_0x37de25[_0xbfac('0x1c')](0xcc)[_0xbfac('0x18')]();});}};}function handleEntityNotFound(_0x3eca1e,_0x168a88){return function(_0x429ad1){if(!_0x429ad1){_0x3eca1e[_0xbfac('0x26')](0x194);}return _0x429ad1;};}function handleError(_0x5b4499,_0xcd55b7){_0xcd55b7=_0xcd55b7||0x1f4;return function(_0x6fcfff){logger[_0xbfac('0x27')](_0x6fcfff['stack']);if(_0x6fcfff['name']){delete _0x6fcfff['name'];}_0x5b4499['status'](_0xcd55b7)['send'](_0x6fcfff);};}exports['index']=function(_0x18f89f,_0x3e3cd2){var _0x531711={},_0x5ce93f={},_0x25d570={'count':0x0,'rows':[]};var _0x384ad5=_['map'](db[_0xbfac('0x28')][_0xbfac('0x29')],function(_0x32369d){return{'name':_0x32369d[_0xbfac('0x2a')],'type':_0x32369d[_0xbfac('0x2b')][_0xbfac('0x2c')]};});_0x5ce93f[_0xbfac('0x2d')]=_[_0xbfac('0x2e')](_0x384ad5,_0xbfac('0x2f'));_0x5ce93f[_0xbfac('0x30')]=_[_0xbfac('0x31')](_0x18f89f['query']);_0x5ce93f['filters']=_[_0xbfac('0x32')](_0x5ce93f[_0xbfac('0x2d')],_0x5ce93f[_0xbfac('0x30')]);_0x531711['attributes']=_[_0xbfac('0x32')](_0x5ce93f[_0xbfac('0x2d')],qs[_0xbfac('0x33')](_0x18f89f[_0xbfac('0x30')][_0xbfac('0x33')]));_0x531711['attributes']=_0x531711['attributes'][_0xbfac('0x34')]?_0x531711[_0xbfac('0x35')]:_0x5ce93f['model'];if(!_0x18f89f['query'][_0xbfac('0x36')](_0xbfac('0x37'))){_0x531711['limit']=qs[_0xbfac('0x1b')](_0x18f89f['query'][_0xbfac('0x1b')]);_0x531711[_0xbfac('0x1a')]=qs[_0xbfac('0x1a')](_0x18f89f[_0xbfac('0x30')]['offset']);}_0x531711[_0xbfac('0x38')]=qs[_0xbfac('0x39')](_0x18f89f[_0xbfac('0x30')][_0xbfac('0x39')]);_0x531711[_0xbfac('0x3a')]=qs[_0xbfac('0x3b')](_[_0xbfac('0x3c')](_0x18f89f['query'],_0x5ce93f[_0xbfac('0x3b')]),_0x384ad5);if(_0x18f89f[_0xbfac('0x30')][_0xbfac('0x3d')]){_0x531711['where']=_[_0xbfac('0x3e')](_0x531711[_0xbfac('0x3a')],{'$or':_[_0xbfac('0x2e')](_0x384ad5,function(_0x227c6f){if(_0x227c6f['type']!==_0xbfac('0x3f')){var _0x19cec5={};_0x19cec5[_0x227c6f[_0xbfac('0x2f')]]={'$like':'%'+_0x18f89f[_0xbfac('0x30')]['filter']+'%'};return _0x19cec5;}})});}_0x531711=_[_0xbfac('0x3e')]({},_0x531711,_0x18f89f[_0xbfac('0x40')]);var _0x3c5c4f={'where':_0x531711[_0xbfac('0x3a')]};return db[_0xbfac('0x28')][_0xbfac('0x41')](_0x3c5c4f)[_0xbfac('0x23')](function(_0xc3f6d3){_0x25d570[_0xbfac('0x41')]=_0xc3f6d3;if(_0x18f89f[_0xbfac('0x30')]['includeAll']){_0x531711['include']=[{'all':!![]}];}return db[_0xbfac('0x28')][_0xbfac('0x42')](_0x531711);})[_0xbfac('0x23')](function(_0x2d45ae){_0x25d570[_0xbfac('0x43')]=_0x2d45ae;return _0x25d570;})[_0xbfac('0x23')](respondWithFilteredResult(_0x3e3cd2,_0x531711))[_0xbfac('0x44')](handleError(_0x3e3cd2,null));};exports['show']=function(_0x4fc959,_0x49296a){var _0x105c10={'raw':!![],'where':{'id':_0x4fc959[_0xbfac('0x45')]['id']}},_0x16db94={};_0x16db94[_0xbfac('0x2d')]=_[_0xbfac('0x31')](db['CmContactHasPhone'][_0xbfac('0x29')]);_0x16db94[_0xbfac('0x30')]=_['keys'](_0x4fc959[_0xbfac('0x30')]);_0x16db94['filters']=_['intersection'](_0x16db94[_0xbfac('0x2d')],_0x16db94[_0xbfac('0x30')]);_0x105c10[_0xbfac('0x35')]=_[_0xbfac('0x32')](_0x16db94[_0xbfac('0x2d')],qs[_0xbfac('0x33')](_0x4fc959[_0xbfac('0x30')]['fields']));_0x105c10['attributes']=_0x105c10[_0xbfac('0x35')]['length']?_0x105c10[_0xbfac('0x35')]:_0x16db94['model'];if(_0x4fc959[_0xbfac('0x30')][_0xbfac('0x46')]){_0x105c10[_0xbfac('0x47')]=[{'all':!![]}];}_0x105c10=_['merge']({},_0x105c10,_0x4fc959['options']);return db[_0xbfac('0x28')][_0xbfac('0x48')](_0x105c10)[_0xbfac('0x23')](handleEntityNotFound(_0x49296a,null))['then'](respondWithResult(_0x49296a,null))[_0xbfac('0x44')](handleError(_0x49296a,null));};exports[_0xbfac('0x49')]=function(_0x5f2db6,_0x1ebd0e){return db[_0xbfac('0x28')]['create'](_0x5f2db6['body'],{})[_0xbfac('0x23')](function(_0x687753){var _0x41cb2e=_0x5f2db6[_0xbfac('0x4a')][_0xbfac('0x24')]({'plain':!![]});if(!_0x41cb2e)throw new Error(_0xbfac('0x4b'));if(_0x41cb2e[_0xbfac('0x4c')]===_0xbfac('0x4a')){var _0x297e40=_0x687753['get']({'plain':!![]});var _0x337469=_0xbfac('0x25');return db[_0xbfac('0x4d')][_0xbfac('0x48')]({'where':{'name':_0x337469,'userProfileId':_0x41cb2e[_0xbfac('0x4e')]},'raw':!![]})[_0xbfac('0x23')](function(_0xeaa4e4){if(_0xeaa4e4&&_0xeaa4e4[_0xbfac('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x297e40[_0xbfac('0x2f')],'resourceId':_0x297e40['id'],'type':_0xeaa4e4[_0xbfac('0x2f')],'sectionId':_0xeaa4e4['id']},{})['then'](function(){return _0x687753;});}else{return _0x687753;}})['catch'](function(_0x510dd4){logger[_0xbfac('0x27')](_0xbfac('0x50'),_0x510dd4);throw _0x510dd4;});}return _0x687753;})[_0xbfac('0x23')](respondWithResult(_0x1ebd0e,0xc9))[_0xbfac('0x44')](handleError(_0x1ebd0e,null));};exports[_0xbfac('0x21')]=function(_0x3b29fc,_0x39a690){if(_0x3b29fc['body']['id']){delete _0x3b29fc[_0xbfac('0x51')]['id'];}return db[_0xbfac('0x28')][_0xbfac('0x48')]({'where':{'id':_0x3b29fc[_0xbfac('0x45')]['id']}})[_0xbfac('0x23')](handleEntityNotFound(_0x39a690,null))['then'](saveUpdates(_0x3b29fc[_0xbfac('0x51')],null))[_0xbfac('0x23')](respondWithResult(_0x39a690,null))[_0xbfac('0x44')](handleError(_0x39a690,null));};exports[_0xbfac('0x22')]=function(_0x4cbe42,_0x3ebf9f){return db[_0xbfac('0x28')][_0xbfac('0x48')]({'where':{'id':_0x4cbe42[_0xbfac('0x45')]['id']}})[_0xbfac('0x23')](handleEntityNotFound(_0x3ebf9f,null))[_0xbfac('0x23')](removeEntity(_0x3ebf9f,null))[_0xbfac('0x44')](handleError(_0x3ebf9f,null));}; \ No newline at end of file +var _0x6cef=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','apply','reject','save','update','destroy','then','get','CmContactHasPhones','UserProfileResource','sendStatus','name','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','VIRTUAL','options','CmContactHasPhone','includeAll','rows','show','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','rimraf','zip-dir','request-promise'];(function(_0x466013,_0x3c5dcf){var _0x34a429=function(_0x4b394d){while(--_0x4b394d){_0x466013['push'](_0x466013['shift']());}};_0x34a429(++_0x3c5dcf);}(_0x6cef,0x12c));var _0xf6ce=function(_0x30b845,_0x3f9133){_0x30b845=_0x30b845-0x0;var _0xa791f2=_0x6cef[_0x30b845];return _0xa791f2;};'use strict';var pdf=require(_0xf6ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf6ce('0x1'));var zipdir=require(_0xf6ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6ce('0x3'));var moment=require(_0xf6ce('0x4'));var BPromise=require(_0xf6ce('0x5'));var Mustache=require(_0xf6ce('0x6'));var util=require(_0xf6ce('0x7'));var path=require(_0xf6ce('0x8'));var sox=require(_0xf6ce('0x9'));var csv=require(_0xf6ce('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf6ce('0xb'));var squel=require(_0xf6ce('0xc'));var crypto=require(_0xf6ce('0xd'));var jsforce=require(_0xf6ce('0xe'));var deskjs=require(_0xf6ce('0xf'));var toCsv=require(_0xf6ce('0xa'));var querystring=require(_0xf6ce('0x10'));var Papa=require(_0xf6ce('0x11'));var Redis=require(_0xf6ce('0x12'));var authService=require(_0xf6ce('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6ce('0x14'))(_0xf6ce('0x15'));var utils=require('../../config/utils');var config=require(_0xf6ce('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf6ce('0x17'))['db'];function respondWithStatusCode(_0x58d6c9,_0x105cd0){_0x105cd0=_0x105cd0||0xcc;return function(_0x111eac){if(_0x111eac){return _0x58d6c9['sendStatus'](_0x105cd0);}return _0x58d6c9[_0xf6ce('0x18')](_0x105cd0)[_0xf6ce('0x19')]();};}function respondWithResult(_0x3d5844,_0xc218a4){_0xc218a4=_0xc218a4||0xc8;return function(_0x310181){if(_0x310181){return _0x3d5844['status'](_0xc218a4)['json'](_0x310181);}};}function respondWithFilteredResult(_0x47ce12,_0x50ebd6){return function(_0x41d436){if(_0x41d436){var _0x29d88d=_0x41d436[_0xf6ce('0x1a')],_0x32d164=_0x50ebd6['offset'],_0x175e5d=_0x50ebd6[_0xf6ce('0x1b')]+_0x50ebd6[_0xf6ce('0x1c')],_0x3ef3c3;if(_0x175e5d>=_0x29d88d){_0x175e5d=_0x29d88d;_0x3ef3c3=0xc8;}else{_0x3ef3c3=0xce;}_0x47ce12[_0xf6ce('0x18')](_0x3ef3c3);return _0x47ce12[_0xf6ce('0x1d')]('Content-Range',_0x32d164+'-'+_0x175e5d+'/'+_0x29d88d)['json'](_0x41d436);}return null;};}function patchUpdates(_0x3475c5){return function(_0x64db86){try{jsonpatch[_0xf6ce('0x1e')](_0x64db86,_0x3475c5,!![]);}catch(_0x317bf7){return BPromise[_0xf6ce('0x1f')](_0x317bf7);}return _0x64db86[_0xf6ce('0x20')]();};}function saveUpdates(_0x535d65,_0x19cd70){return function(_0x36879d){if(_0x36879d){return _0x36879d[_0xf6ce('0x21')](_0x535d65)['then'](function(_0x2f4ab2){return _0x2f4ab2;});}return null;};}function removeEntity(_0xfee24d,_0x4bfd28){return function(_0x5921f2){if(_0x5921f2){return _0x5921f2[_0xf6ce('0x22')]()[_0xf6ce('0x23')](function(){var _0x37414b=_0x5921f2[_0xf6ce('0x24')]({'plain':!![]});var _0x598bba=_0xf6ce('0x25');return db[_0xf6ce('0x26')][_0xf6ce('0x22')]({'where':{'type':_0x598bba,'resourceId':_0x37414b['id']}})['then'](function(){return _0x5921f2;});})[_0xf6ce('0x23')](function(){_0xfee24d[_0xf6ce('0x18')](0xcc)[_0xf6ce('0x19')]();});}};}function handleEntityNotFound(_0x479a3c,_0xed1d35){return function(_0x1ac00){if(!_0x1ac00){_0x479a3c[_0xf6ce('0x27')](0x194);}return _0x1ac00;};}function handleError(_0x2cbacc,_0x36765a){_0x36765a=_0x36765a||0x1f4;return function(_0x14e4d9){logger['error'](_0x14e4d9['stack']);if(_0x14e4d9[_0xf6ce('0x28')]){delete _0x14e4d9[_0xf6ce('0x28')];}_0x2cbacc[_0xf6ce('0x18')](_0x36765a)['send'](_0x14e4d9);};}exports['index']=function(_0x3556d5,_0x189650){var _0x291cc1={},_0x3f3eb5={},_0x211ff9={'count':0x0,'rows':[]};var _0x151d4f=_[_0xf6ce('0x29')](db['CmContactHasPhone']['rawAttributes'],function(_0x4839e2){return{'name':_0x4839e2['fieldName'],'type':_0x4839e2[_0xf6ce('0x2a')][_0xf6ce('0x2b')]};});_0x3f3eb5[_0xf6ce('0x2c')]=_[_0xf6ce('0x29')](_0x151d4f,_0xf6ce('0x28'));_0x3f3eb5['query']=_[_0xf6ce('0x2d')](_0x3556d5[_0xf6ce('0x2e')]);_0x3f3eb5[_0xf6ce('0x2f')]=_[_0xf6ce('0x30')](_0x3f3eb5[_0xf6ce('0x2c')],_0x3f3eb5[_0xf6ce('0x2e')]);_0x291cc1[_0xf6ce('0x31')]=_[_0xf6ce('0x30')](_0x3f3eb5['model'],qs[_0xf6ce('0x32')](_0x3556d5[_0xf6ce('0x2e')][_0xf6ce('0x32')]));_0x291cc1['attributes']=_0x291cc1['attributes'][_0xf6ce('0x33')]?_0x291cc1[_0xf6ce('0x31')]:_0x3f3eb5[_0xf6ce('0x2c')];if(!_0x3556d5['query']['hasOwnProperty'](_0xf6ce('0x34'))){_0x291cc1[_0xf6ce('0x1c')]=qs[_0xf6ce('0x1c')](_0x3556d5[_0xf6ce('0x2e')][_0xf6ce('0x1c')]);_0x291cc1['offset']=qs[_0xf6ce('0x1b')](_0x3556d5[_0xf6ce('0x2e')]['offset']);}_0x291cc1[_0xf6ce('0x35')]=qs['sort'](_0x3556d5[_0xf6ce('0x2e')]['sort']);_0x291cc1[_0xf6ce('0x36')]=qs[_0xf6ce('0x2f')](_['pick'](_0x3556d5['query'],_0x3f3eb5['filters']),_0x151d4f);if(_0x3556d5[_0xf6ce('0x2e')][_0xf6ce('0x37')]){_0x291cc1['where']=_[_0xf6ce('0x38')](_0x291cc1['where'],{'$or':_[_0xf6ce('0x29')](_0x151d4f,function(_0x2e7f34){if(_0x2e7f34[_0xf6ce('0x2a')]!==_0xf6ce('0x39')){var _0x2d1376={};_0x2d1376[_0x2e7f34[_0xf6ce('0x28')]]={'$like':'%'+_0x3556d5[_0xf6ce('0x2e')][_0xf6ce('0x37')]+'%'};return _0x2d1376;}})});}_0x291cc1=_['merge']({},_0x291cc1,_0x3556d5[_0xf6ce('0x3a')]);var _0x37ce70={'where':_0x291cc1['where']};return db[_0xf6ce('0x3b')][_0xf6ce('0x1a')](_0x37ce70)[_0xf6ce('0x23')](function(_0x13088f){_0x211ff9['count']=_0x13088f;if(_0x3556d5[_0xf6ce('0x2e')][_0xf6ce('0x3c')]){_0x291cc1['include']=[{'all':!![]}];}return db[_0xf6ce('0x3b')]['findAll'](_0x291cc1);})[_0xf6ce('0x23')](function(_0x577cbd){_0x211ff9[_0xf6ce('0x3d')]=_0x577cbd;return _0x211ff9;})[_0xf6ce('0x23')](respondWithFilteredResult(_0x189650,_0x291cc1))['catch'](handleError(_0x189650,null));};exports[_0xf6ce('0x3e')]=function(_0x3379bd,_0x30d4c6){var _0x46d14c={'raw':!![],'where':{'id':_0x3379bd['params']['id']}},_0x20ac2={};_0x20ac2['model']=_[_0xf6ce('0x2d')](db['CmContactHasPhone'][_0xf6ce('0x3f')]);_0x20ac2['query']=_[_0xf6ce('0x2d')](_0x3379bd[_0xf6ce('0x2e')]);_0x20ac2[_0xf6ce('0x2f')]=_[_0xf6ce('0x30')](_0x20ac2[_0xf6ce('0x2c')],_0x20ac2[_0xf6ce('0x2e')]);_0x46d14c['attributes']=_[_0xf6ce('0x30')](_0x20ac2['model'],qs[_0xf6ce('0x32')](_0x3379bd[_0xf6ce('0x2e')]['fields']));_0x46d14c[_0xf6ce('0x31')]=_0x46d14c[_0xf6ce('0x31')]['length']?_0x46d14c[_0xf6ce('0x31')]:_0x20ac2['model'];if(_0x3379bd[_0xf6ce('0x2e')][_0xf6ce('0x3c')]){_0x46d14c['include']=[{'all':!![]}];}_0x46d14c=_[_0xf6ce('0x38')]({},_0x46d14c,_0x3379bd[_0xf6ce('0x3a')]);return db[_0xf6ce('0x3b')]['find'](_0x46d14c)[_0xf6ce('0x23')](handleEntityNotFound(_0x30d4c6,null))['then'](respondWithResult(_0x30d4c6,null))[_0xf6ce('0x40')](handleError(_0x30d4c6,null));};exports[_0xf6ce('0x41')]=function(_0x2e5885,_0x5b491c){return db[_0xf6ce('0x3b')]['create'](_0x2e5885[_0xf6ce('0x42')],{})[_0xf6ce('0x23')](function(_0x1e5451){var _0x2d1fe5=_0x2e5885[_0xf6ce('0x43')]['get']({'plain':!![]});if(!_0x2d1fe5)throw new Error(_0xf6ce('0x44'));if(_0x2d1fe5[_0xf6ce('0x45')]==='user'){var _0x36a8fc=_0x1e5451[_0xf6ce('0x24')]({'plain':!![]});var _0x4e61cc=_0xf6ce('0x25');return db[_0xf6ce('0x46')]['find']({'where':{'name':_0x4e61cc,'userProfileId':_0x2d1fe5['userProfileId']},'raw':!![]})[_0xf6ce('0x23')](function(_0x772207){if(_0x772207&&_0x772207[_0xf6ce('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x36a8fc[_0xf6ce('0x28')],'resourceId':_0x36a8fc['id'],'type':_0x772207[_0xf6ce('0x28')],'sectionId':_0x772207['id']},{})[_0xf6ce('0x23')](function(){return _0x1e5451;});}else{return _0x1e5451;}})[_0xf6ce('0x40')](function(_0x208765){logger[_0xf6ce('0x48')](_0xf6ce('0x49'),_0x208765);throw _0x208765;});}return _0x1e5451;})[_0xf6ce('0x23')](respondWithResult(_0x5b491c,0xc9))[_0xf6ce('0x40')](handleError(_0x5b491c,null));};exports[_0xf6ce('0x21')]=function(_0x9ccb8,_0x4ed6cc){if(_0x9ccb8[_0xf6ce('0x42')]['id']){delete _0x9ccb8[_0xf6ce('0x42')]['id'];}return db[_0xf6ce('0x3b')][_0xf6ce('0x4a')]({'where':{'id':_0x9ccb8[_0xf6ce('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ed6cc,null))[_0xf6ce('0x23')](saveUpdates(_0x9ccb8[_0xf6ce('0x42')],null))['then'](respondWithResult(_0x4ed6cc,null))[_0xf6ce('0x40')](handleError(_0x4ed6cc,null));};exports[_0xf6ce('0x22')]=function(_0x20b5f7,_0x16a94f){return db['CmContactHasPhone'][_0xf6ce('0x4a')]({'where':{'id':_0x20b5f7[_0xf6ce('0x4b')]['id']}})[_0xf6ce('0x23')](handleEntityNotFound(_0x16a94f,null))['then'](removeEntity(_0x16a94f,null))[_0xf6ce('0x40')](handleError(_0x16a94f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 6659948..576ffcf 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 _0x64b3=['../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','cm_contact_has_phones','lodash','api','moment','bluebird','path','rimraf'];(function(_0x220322,_0x5e7888){var _0xb45500=function(_0x304b81){while(--_0x304b81){_0x220322['push'](_0x220322['shift']());}};_0xb45500(++_0x5e7888);}(_0x64b3,0x1de));var _0x364b=function(_0x1aca3,_0x55a012){_0x1aca3=_0x1aca3-0x0;var _0x42d55f=_0x64b3[_0x1aca3];return _0x42d55f;};'use strict';var _=require(_0x364b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x364b('0x1'));var moment=require(_0x364b('0x2'));var BPromise=require(_0x364b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x364b('0x4'));var rimraf=require(_0x364b('0x5'));var config=require(_0x364b('0x6'));var attributes=require(_0x364b('0x7'));module[_0x364b('0x8')]=function(_0x42092d,_0x53ae27){return _0x42092d['define'](_0x364b('0x9'),attributes,{'tableName':_0x364b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34ab=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmContactHasPhone.attributes','define','CmContactHasPhone','cm_contact_has_phones','lodash'];(function(_0x2029df,_0x3b884c){var _0x1a0c37=function(_0x45175f){while(--_0x45175f){_0x2029df['push'](_0x2029df['shift']());}};_0x1a0c37(++_0x3b884c);}(_0x34ab,0xf1));var _0xb34a=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x34ab[_0x7dbd65];return _0x33d551;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var logger=require(_0xb34a('0x2'))(_0xb34a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb34a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb34a('0x5'));var config=require(_0xb34a('0x6'));var attributes=require(_0xb34a('0x7'));module['exports']=function(_0x6e669,_0x1f6df3){return _0x6e669[_0xb34a('0x8')](_0xb34a('0x9'),attributes,{'tableName':_0xb34a('0xa'),'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 bdc837a..f385ded 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 _0x4c9d=['../../config/environment','jayson/promise','client','request','info','CmContactHasPhone,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4f43d1,_0xf9c6e2){var _0x2454fc=function(_0x34dbbe){while(--_0x34dbbe){_0x4f43d1['push'](_0x4f43d1['shift']());}};_0x2454fc(++_0xf9c6e2);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4c9d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd4c9('0x0'));var util=require(_0xd4c9('0x1'));var moment=require(_0xd4c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4c9('0x3'));var fs=require('fs');var Redis=require(_0xd4c9('0x4'));var db=require(_0xd4c9('0x5'))['db'];var utils=require(_0xd4c9('0x6'));var logger=require(_0xd4c9('0x7'))(_0xd4c9('0x8'));var config=require(_0xd4c9('0x9'));var jayson=require(_0xd4c9('0xa'));var client=jayson[_0xd4c9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b511,_0x13c314,_0x37b94e){return new BPromise(function(_0x3f9d50,_0x8ecc5a){return client[_0xd4c9('0xc')](_0x48b511,_0x37b94e)['then'](function(_0x18419f){logger[_0xd4c9('0xd')](_0xd4c9('0xe'),_0x13c314,'request\x20sent');logger['debug']('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x13c314,'request\x20sent',JSON['stringify'](_0x18419f));if(_0x18419f[_0xd4c9('0xf')]){if(_0x18419f['error'][_0xd4c9('0x10')]===0x1f4){logger[_0xd4c9('0xf')](_0xd4c9('0xe'),_0x13c314,_0x18419f['error'][_0xd4c9('0x11')]);return _0x8ecc5a(_0x18419f[_0xd4c9('0xf')][_0xd4c9('0x11')]);}logger[_0xd4c9('0xf')](_0xd4c9('0xe'),_0x13c314,_0x18419f[_0xd4c9('0xf')][_0xd4c9('0x11')]);return _0x3f9d50(_0x18419f[_0xd4c9('0xf')][_0xd4c9('0x11')]);}else{logger[_0xd4c9('0xd')](_0xd4c9('0xe'),_0x13c314,'request\x20sent');_0x3f9d50(_0x18419f[_0xd4c9('0x12')][_0xd4c9('0x11')]);}})['catch'](function(_0x5cec88){logger[_0xd4c9('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x13c314,_0x5cec88);_0x8ecc5a(_0x5cec88);});});} \ No newline at end of file +var _0x5ceb=['debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent'];(function(_0x1a7cf0,_0xa63e2b){var _0x309115=function(_0x1aef52){while(--_0x1aef52){_0x1a7cf0['push'](_0x1a7cf0['shift']());}};_0x309115(++_0xa63e2b);}(_0x5ceb,0x1d3));var _0xb5ce=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x5ceb[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0xb5ce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb5ce('0x1'));var rs=require(_0xb5ce('0x2'));var fs=require('fs');var Redis=require(_0xb5ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5ce('0x4'));var logger=require(_0xb5ce('0x5'))(_0xb5ce('0x6'));var config=require(_0xb5ce('0x7'));var jayson=require(_0xb5ce('0x8'));var client=jayson[_0xb5ce('0x9')][_0xb5ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31be0a,_0x45a746,_0x1d0654){return new BPromise(function(_0x272126,_0x17ec92){return client[_0xb5ce('0xb')](_0x31be0a,_0x1d0654)[_0xb5ce('0xc')](function(_0x3ffa4b){logger[_0xb5ce('0xd')](_0xb5ce('0xe'),_0x45a746,_0xb5ce('0xf'));logger[_0xb5ce('0x10')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x45a746,_0xb5ce('0xf'),JSON[_0xb5ce('0x11')](_0x3ffa4b));if(_0x3ffa4b[_0xb5ce('0x12')]){if(_0x3ffa4b[_0xb5ce('0x12')][_0xb5ce('0x13')]===0x1f4){logger[_0xb5ce('0x12')]('CmContactHasPhone,\x20%s,\x20%s',_0x45a746,_0x3ffa4b['error'][_0xb5ce('0x14')]);return _0x17ec92(_0x3ffa4b[_0xb5ce('0x12')][_0xb5ce('0x14')]);}logger[_0xb5ce('0x12')](_0xb5ce('0xe'),_0x45a746,_0x3ffa4b[_0xb5ce('0x12')]['message']);return _0x272126(_0x3ffa4b[_0xb5ce('0x12')]['message']);}else{logger[_0xb5ce('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x45a746,'request\x20sent');_0x272126(_0x3ffa4b[_0xb5ce('0x15')]['message']);}})[_0xb5ce('0x16')](function(_0x18ca40){logger[_0xb5ce('0x12')](_0xb5ce('0xe'),_0x45a746,_0x18ca40);_0x17ec92(_0x18ca40);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index a23b83a..7f989ff 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 _0xfe30=['put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','/:id','post','create'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0xfe30,0xc9));var _0x0fe3=function(_0x124728,_0x463dca){_0x124728=_0x124728-0x0;var _0x8eb20f=_0xfe30[_0x124728];return _0x8eb20f;};'use strict';var multer=require(_0x0fe3('0x0'));var util=require(_0x0fe3('0x1'));var path=require(_0x0fe3('0x2'));var timeout=require(_0x0fe3('0x3'));var express=require(_0x0fe3('0x4'));var router=express[_0x0fe3('0x5')]();var auth=require(_0x0fe3('0x6'));var interaction=require(_0x0fe3('0x7'));var config=require(_0x0fe3('0x8'));var controller=require(_0x0fe3('0x9'));router[_0x0fe3('0xa')]('/',auth[_0x0fe3('0xb')](),controller['index']);router[_0x0fe3('0xa')](_0x0fe3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0fe3('0xd')]('/',auth[_0x0fe3('0xb')](),controller[_0x0fe3('0xe')]);router[_0x0fe3('0xf')](_0x0fe3('0xc'),auth[_0x0fe3('0xb')](),controller['update']);router[_0x0fe3('0x10')](_0x0fe3('0xc'),auth[_0x0fe3('0xb')](),controller['destroy']);module[_0x0fe3('0x11')]=router; \ No newline at end of file +var _0x16bc=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','path','express','Router'];(function(_0x29d2f6,_0x4e598e){var _0x5845f5=function(_0x154929){while(--_0x154929){_0x29d2f6['push'](_0x29d2f6['shift']());}};_0x5845f5(++_0x4e598e);}(_0x16bc,0x7c));var _0xc16b=function(_0x4fc870,_0x56c114){_0x4fc870=_0x4fc870-0x0;var _0x20fd76=_0x16bc[_0x4fc870];return _0x20fd76;};'use strict';var multer=require(_0xc16b('0x0'));var util=require('util');var path=require(_0xc16b('0x1'));var timeout=require('connect-timeout');var express=require(_0xc16b('0x2'));var router=express[_0xc16b('0x3')]();var auth=require(_0xc16b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc16b('0x5'));var controller=require('./cmContactHasPhone.controller');router[_0xc16b('0x6')]('/',auth[_0xc16b('0x7')](),controller[_0xc16b('0x8')]);router[_0xc16b('0x6')](_0xc16b('0x9'),auth['isAuthenticated'](),controller[_0xc16b('0xa')]);router[_0xc16b('0xb')]('/',auth[_0xc16b('0x7')](),controller[_0xc16b('0xc')]);router[_0xc16b('0xd')](_0xc16b('0x9'),auth[_0xc16b('0x7')](),controller['update']);router[_0xc16b('0xe')]('/:id',auth[_0xc16b('0x7')](),controller['destroy']);module[_0xc16b('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 2c20a5a..aa16310 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 _0x3148=['stringify','BOOLEAN','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','select','parse','values','isArray'];(function(_0x2cd8d0,_0x5ddefb){var _0x49a221=function(_0x6abeb2){while(--_0x6abeb2){_0x2cd8d0['push'](_0x2cd8d0['shift']());}};_0x49a221(++_0x5ddefb);}(_0x3148,0x1d3));var _0x8314=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0x3148[_0x5b7963];return _0x57f611;};'use strict';var Sequelize=require(_0x8314('0x0'));var _=require(_0x8314('0x1'));module['exports']={'name':{'type':Sequelize[_0x8314('0x2')],'get':function(_0xf80bf9){return this[_0x8314('0x3')](_0x8314('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x35ee55){this[_0x8314('0x5')](_0x8314('0x4'),_0x35ee55?_0x35ee55:this[_0x8314('0x3')](_0x8314('0x6')));}},'type':{'type':Sequelize[_0x8314('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x8314('0x8')]('long'),'get':function(){if(this[_0x8314('0x3')]('type')===_0x8314('0x9')){return JSON[_0x8314('0xa')](this[_0x8314('0x3')](_0x8314('0xb')));}else{return this[_0x8314('0x3')]('values');}},'set':function(_0x5b5459){if(Array[_0x8314('0xc')](_0x5b5459)){this[_0x8314('0x5')](_0x8314('0xb'),JSON[_0x8314('0xd')](_0x5b5459));}else{this['setDataValue'](_0x8314('0xb'),_0x5b5459);}}},'required':{'type':Sequelize[_0x8314('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8314('0xf')]('voice')}}; \ No newline at end of file +var _0x24ca=['alias','STRING','setDataValue','long','type','select','parse','values','stringify','BOOLEAN','sequelize','VIRTUAL','getDataValue'];(function(_0x3261ed,_0x1f06ad){var _0xbea3c3=function(_0x1481ec){while(--_0x1481ec){_0x3261ed['push'](_0x3261ed['shift']());}};_0xbea3c3(++_0x1f06ad);}(_0x24ca,0x8c));var _0xa24c=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x24ca[_0x5e42a7];return _0x36d21b;};'use strict';var Sequelize=require(_0xa24c('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'get':function(_0x4e90b0){return this[_0xa24c('0x2')](_0xa24c('0x3'));}},'alias':{'type':Sequelize[_0xa24c('0x4')],'allowNull':![],'set':function(_0x49f276){this[_0xa24c('0x5')](_0xa24c('0x3'),_0x49f276?_0x49f276:this[_0xa24c('0x2')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xa24c('0x6')),'get':function(){if(this[_0xa24c('0x2')](_0xa24c('0x7'))===_0xa24c('0x8')){return JSON[_0xa24c('0x9')](this[_0xa24c('0x2')]('values'));}else{return this[_0xa24c('0x2')](_0xa24c('0xa'));}},'set':function(_0x355882){if(Array['isArray'](_0x355882)){this['setDataValue'](_0xa24c('0xa'),JSON[_0xa24c('0xb')](_0x355882));}else{this[_0xa24c('0x5')](_0xa24c('0xa'),_0x355882);}}},'required':{'type':Sequelize[_0xa24c('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa24c('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 85eafd8..832c362 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 _0x6f54=['differenceBy','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','catch','show','include','find','body','destroy','params','sequelize','transaction','create','Sequelize','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type'];(function(_0x407b07,_0x525c69){var _0x2c9b12=function(_0x54b368){while(--_0x54b368){_0x407b07['push'](_0x407b07['shift']());}};_0x2c9b12(++_0x525c69);}(_0x6f54,0xc6));var _0x46f5=function(_0x3baac8,_0x251192){_0x3baac8=_0x3baac8-0x0;var _0x20964d=_0x6f54[_0x3baac8];return _0x20964d;};'use strict';var pdf=require(_0x46f5('0x0'));var emlformat=require(_0x46f5('0x1'));var rimraf=require(_0x46f5('0x2'));var zipdir=require(_0x46f5('0x3'));var jsonpatch=require(_0x46f5('0x4'));var rp=require(_0x46f5('0x5'));var moment=require('moment');var BPromise=require(_0x46f5('0x6'));var Mustache=require(_0x46f5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x46f5('0x8'));var ejs=require(_0x46f5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x46f5('0xa'));var crypto=require(_0x46f5('0xb'));var jsforce=require(_0x46f5('0xc'));var deskjs=require(_0x46f5('0xd'));var toCsv=require(_0x46f5('0x8'));var querystring=require('querystring');var Papa=require(_0x46f5('0xe'));var Redis=require(_0x46f5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x46f5('0x10'));var hardwareService=require(_0x46f5('0x11'));var logger=require(_0x46f5('0x12'))(_0x46f5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x46f5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a497e,_0x2cfe79){_0x2cfe79=_0x2cfe79||0xcc;return function(_0x292234){if(_0x292234){return _0x3a497e[_0x46f5('0x15')](_0x2cfe79);}return _0x3a497e[_0x46f5('0x16')](_0x2cfe79)[_0x46f5('0x17')]();};}function respondWithResult(_0x24c7ab,_0x43b847){_0x43b847=_0x43b847||0xc8;return function(_0x2d01f0){if(_0x2d01f0){return _0x24c7ab[_0x46f5('0x16')](_0x43b847)[_0x46f5('0x18')](_0x2d01f0);}};}function respondWithFilteredResult(_0x15507c,_0x33df2e){return function(_0x17134f){if(_0x17134f){var _0xaf3243=_0x17134f[_0x46f5('0x19')],_0x2e5f44=_0x33df2e['offset'],_0x42a92c=_0x33df2e[_0x46f5('0x1a')]+_0x33df2e['limit'],_0x1ee391;if(_0x42a92c>=_0xaf3243){_0x42a92c=_0xaf3243;_0x1ee391=0xc8;}else{_0x1ee391=0xce;}_0x15507c['status'](_0x1ee391);return _0x15507c[_0x46f5('0x1b')]('Content-Range',_0x2e5f44+'-'+_0x42a92c+'/'+_0xaf3243)[_0x46f5('0x18')](_0x17134f);}return null;};}function patchUpdates(_0x92e901){return function(_0x4c4ed0){try{jsonpatch[_0x46f5('0x1c')](_0x4c4ed0,_0x92e901,!![]);}catch(_0x1999a9){return BPromise[_0x46f5('0x1d')](_0x1999a9);}return _0x4c4ed0[_0x46f5('0x1e')]();};}function saveUpdates(_0x4dcf22,_0x5e9c7d){return function(_0x2f2091){if(_0x2f2091){return _0x2f2091[_0x46f5('0x1f')](_0x4dcf22)['then'](function(_0x2915c3){return _0x2915c3;});}return null;};}function removeEntity(_0x107caa,_0x4e0c8a){return function(_0x1638d6){if(_0x1638d6){return _0x1638d6['destroy']()[_0x46f5('0x20')](function(){_0x107caa[_0x46f5('0x16')](0xcc)[_0x46f5('0x17')]();});}};}function handleEntityNotFound(_0x5322f0,_0x4e04e8){return function(_0x1c8b45){if(!_0x1c8b45){_0x5322f0[_0x46f5('0x15')](0x194);}return _0x1c8b45;};}function handleError(_0x247252,_0x38ef0e){_0x38ef0e=_0x38ef0e||0x1f4;return function(_0x104ba3){logger[_0x46f5('0x21')](_0x104ba3[_0x46f5('0x22')]);if(_0x104ba3[_0x46f5('0x23')]){delete _0x104ba3[_0x46f5('0x23')];}_0x247252[_0x46f5('0x16')](_0x38ef0e)[_0x46f5('0x24')](_0x104ba3);};}exports['index']=function(_0x3af38f,_0x140d87){var _0x50b3c0={},_0x1ce46e={},_0x7f52e5={'count':0x0,'rows':[]};var _0x121c11=_[_0x46f5('0x25')](db[_0x46f5('0x26')][_0x46f5('0x27')],function(_0x502294){return{'name':_0x502294[_0x46f5('0x28')],'type':_0x502294[_0x46f5('0x29')]['key']};});_0x1ce46e['model']=_[_0x46f5('0x2a')](_['map'](_0x121c11,_0x46f5('0x23')),[_0x46f5('0x23')]);_0x1ce46e['query']=_[_0x46f5('0x2b')](_0x3af38f[_0x46f5('0x2c')]);_0x1ce46e[_0x46f5('0x2d')]=_[_0x46f5('0x2e')](_0x1ce46e['model'],_0x1ce46e[_0x46f5('0x2c')]);_0x50b3c0['attributes']=_[_0x46f5('0x2e')](_0x1ce46e[_0x46f5('0x2f')],qs[_0x46f5('0x30')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x30')]));_0x50b3c0[_0x46f5('0x31')]=_0x50b3c0[_0x46f5('0x31')]['length']?_0x50b3c0[_0x46f5('0x31')]:_0x1ce46e[_0x46f5('0x2f')];if(!_0x3af38f['query'][_0x46f5('0x32')](_0x46f5('0x33'))){_0x50b3c0['limit']=qs[_0x46f5('0x34')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x34')]);_0x50b3c0['offset']=qs[_0x46f5('0x1a')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x1a')]);}_0x50b3c0[_0x46f5('0x35')]=qs[_0x46f5('0x36')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x36')]);_0x50b3c0['where']=qs[_0x46f5('0x2d')](_[_0x46f5('0x37')](_0x3af38f[_0x46f5('0x2c')],_0x1ce46e['filters']),_0x121c11);if(_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x38')]){_0x50b3c0['where']=_[_0x46f5('0x39')](_0x50b3c0[_0x46f5('0x3a')],{'$or':_[_0x46f5('0x25')](_0x121c11,function(_0x28fd67){if(_0x28fd67[_0x46f5('0x29')]!==_0x46f5('0x3b')){var _0x2143cd={};_0x2143cd[_0x28fd67[_0x46f5('0x23')]]={'$like':'%'+_0x3af38f[_0x46f5('0x2c')]['filter']+'%'};return _0x2143cd;}})});}_0x50b3c0=_[_0x46f5('0x39')]({},_0x50b3c0,_0x3af38f[_0x46f5('0x3c')]);var _0x19824f={'where':_0x50b3c0[_0x46f5('0x3a')]};return db[_0x46f5('0x26')]['count'](_0x19824f)[_0x46f5('0x20')](function(_0x32ffe7){_0x7f52e5[_0x46f5('0x19')]=_0x32ffe7;if(_0x3af38f[_0x46f5('0x2c')]['includeAll']){_0x50b3c0['include']=[{'all':!![]}];}return db[_0x46f5('0x26')][_0x46f5('0x3d')](_0x50b3c0);})[_0x46f5('0x20')](function(_0x3a6f68){_0x7f52e5['rows']=_0x3a6f68;return _0x7f52e5;})[_0x46f5('0x20')](respondWithFilteredResult(_0x140d87,_0x50b3c0))[_0x46f5('0x3e')](handleError(_0x140d87,null));};exports[_0x46f5('0x3f')]=function(_0x1dd63d,_0x35b56c){var _0x3024a7={'raw':!![],'where':{'id':_0x1dd63d['params']['id']}},_0x2dfc6d={};_0x2dfc6d[_0x46f5('0x2f')]=_[_0x46f5('0x2b')](db[_0x46f5('0x26')][_0x46f5('0x27')]);_0x2dfc6d[_0x46f5('0x2c')]=_[_0x46f5('0x2b')](_0x1dd63d[_0x46f5('0x2c')]);_0x2dfc6d[_0x46f5('0x2d')]=_['intersection'](_0x2dfc6d[_0x46f5('0x2f')],_0x2dfc6d[_0x46f5('0x2c')]);_0x3024a7[_0x46f5('0x31')]=_['intersection'](_0x2dfc6d[_0x46f5('0x2f')],qs['fields'](_0x1dd63d[_0x46f5('0x2c')][_0x46f5('0x30')]));_0x3024a7['attributes']=_0x3024a7[_0x46f5('0x31')]['length']?_0x3024a7[_0x46f5('0x31')]:_0x2dfc6d[_0x46f5('0x2f')];if(_0x1dd63d['query']['includeAll']){_0x3024a7[_0x46f5('0x40')]=[{'all':!![]}];}_0x3024a7=_[_0x46f5('0x39')]({},_0x3024a7,_0x1dd63d[_0x46f5('0x3c')]);return db[_0x46f5('0x26')][_0x46f5('0x41')](_0x3024a7)[_0x46f5('0x20')](handleEntityNotFound(_0x35b56c,null))[_0x46f5('0x20')](respondWithResult(_0x35b56c,null))[_0x46f5('0x3e')](handleError(_0x35b56c,null));};exports['update']=function(_0x2db716,_0x404dcd){if(_0x2db716['body']['id']){delete _0x2db716[_0x46f5('0x42')]['id'];}return db[_0x46f5('0x26')]['find']({'where':{'id':_0x2db716['params']['id']}})[_0x46f5('0x20')](handleEntityNotFound(_0x404dcd,null))['then'](saveUpdates(_0x2db716[_0x46f5('0x42')],null))[_0x46f5('0x20')](respondWithResult(_0x404dcd,null))[_0x46f5('0x3e')](handleError(_0x404dcd,null));};exports[_0x46f5('0x43')]=function(_0x4975da,_0x3d2442){return db[_0x46f5('0x26')]['find']({'where':{'id':_0x4975da[_0x46f5('0x44')]['id']}})[_0x46f5('0x20')](handleEntityNotFound(_0x3d2442,null))[_0x46f5('0x20')](removeEntity(_0x3d2442,null))[_0x46f5('0x3e')](handleError(_0x3d2442,null));};exports['create']=function(_0x4ae2fa,_0x4fc4b9){var _0x5d81ca;return db[_0x46f5('0x45')][_0x46f5('0x46')](function(_0x5cac4c){return db[_0x46f5('0x26')][_0x46f5('0x47')](_0x4ae2fa[_0x46f5('0x42')],{'transaction':_0x5cac4c})['then'](function(_0x48b47b){_0x5d81ca=_0x48b47b;var _0x46d36c={'type':db[_0x46f5('0x48')]['TEXT'],'transaction':_0x5cac4c};switch(_0x4ae2fa[_0x46f5('0x42')][_0x46f5('0x29')]){case _0x46f5('0x49'):_0x46d36c[_0x46f5('0x29')]=db[_0x46f5('0x48')]['TEXT'];break;case'number':_0x46d36c[_0x46f5('0x29')]=db[_0x46f5('0x48')]['INTEGER'];break;case _0x46f5('0x4a'):_0x46d36c[_0x46f5('0x29')]=db[_0x46f5('0x48')][_0x46f5('0x4b')];_0x46d36c[_0x46f5('0x4c')]=![];break;default:}return db[_0x46f5('0x45')][_0x46f5('0x4d')][_0x46f5('0x4e')]('cm_contacts',util['format'](_0x46f5('0x4f'),_0x5d81ca['id']),_0x46d36c);})[_0x46f5('0x20')](function(){return _0x5d81ca;});})[_0x46f5('0x20')](respondWithResult(_0x4fc4b9,0xc9))[_0x46f5('0x3e')](handleError(_0x4fc4b9,null));}; \ No newline at end of file +var _0xe14b=['../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','then','includeAll','include','findAll','catch','show','params','body','find','sequelize','transaction','create','text','TEXT','number','Sequelize','INTEGER','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xc1ede1,_0x27c567){var _0x36f293=function(_0x1fe28c){while(--_0x1fe28c){_0xc1ede1['push'](_0xc1ede1['shift']());}};_0x36f293(++_0x27c567);}(_0xe14b,0x93));var _0xbe14=function(_0x41bf63,_0x140d1f){_0x41bf63=_0x41bf63-0x0;var _0x3e2a9a=_0xe14b[_0x41bf63];return _0x3e2a9a;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x505dbd,_0x2da350){return function(_0x4d4190){if(!_0x4d4190){_0x505dbd[_0xbe14('0x16')](0x194);}return _0x4d4190;};}function handleError(_0x4851f8,_0x36a21e){_0x36a21e=_0x36a21e||0x1f4;return function(_0x5fa043){logger[_0xbe14('0x22')](_0x5fa043[_0xbe14('0x23')]);if(_0x5fa043[_0xbe14('0x24')]){delete _0x5fa043[_0xbe14('0x24')];}_0x4851f8['status'](_0x36a21e)[_0xbe14('0x25')](_0x5fa043);};}exports[_0xbe14('0x26')]=function(_0x391556,_0x169369){var _0x5dd475={},_0x16f884={},_0x29fc64={'count':0x0,'rows':[]};var _0x59bf34=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x19252f){return{'name':_0x19252f[_0xbe14('0x2a')],'type':_0x19252f[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x16f884[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x59bf34,_0xbe14('0x24')),[_0xbe14('0x24')]);_0x16f884[_0xbe14('0x2f')]=_[_0xbe14('0x30')](_0x391556[_0xbe14('0x2f')]);_0x16f884[_0xbe14('0x31')]=_[_0xbe14('0x32')](_0x16f884[_0xbe14('0x2d')],_0x16f884[_0xbe14('0x2f')]);_0x5dd475[_0xbe14('0x33')]=_['intersection'](_0x16f884[_0xbe14('0x2d')],qs['fields'](_0x391556['query'][_0xbe14('0x34')]));_0x5dd475['attributes']=_0x5dd475[_0xbe14('0x33')][_0xbe14('0x35')]?_0x5dd475['attributes']:_0x16f884['model'];if(!_0x391556['query'][_0xbe14('0x36')](_0xbe14('0x37'))){_0x5dd475['limit']=qs[_0xbe14('0x1b')](_0x391556[_0xbe14('0x2f')][_0xbe14('0x1b')]);_0x5dd475[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x391556['query']['offset']);}_0x5dd475[_0xbe14('0x38')]=qs['sort'](_0x391556['query']['sort']);_0x5dd475[_0xbe14('0x39')]=qs[_0xbe14('0x31')](_[_0xbe14('0x3a')](_0x391556[_0xbe14('0x2f')],_0x16f884[_0xbe14('0x31')]),_0x59bf34);if(_0x391556[_0xbe14('0x2f')][_0xbe14('0x3b')]){_0x5dd475[_0xbe14('0x39')]=_[_0xbe14('0x3c')](_0x5dd475[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x59bf34,function(_0x32c59d){if(_0x32c59d['type']!=='VIRTUAL'){var _0x43cdaa={};_0x43cdaa[_0x32c59d[_0xbe14('0x24')]]={'$like':'%'+_0x391556[_0xbe14('0x2f')]['filter']+'%'};return _0x43cdaa;}})});}_0x5dd475=_[_0xbe14('0x3c')]({},_0x5dd475,_0x391556[_0xbe14('0x3d')]);var _0xeda70e={'where':_0x5dd475[_0xbe14('0x39')]};return db[_0xbe14('0x28')][_0xbe14('0x19')](_0xeda70e)[_0xbe14('0x3e')](function(_0x128843){_0x29fc64[_0xbe14('0x19')]=_0x128843;if(_0x391556['query'][_0xbe14('0x3f')]){_0x5dd475[_0xbe14('0x40')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x41')](_0x5dd475);})[_0xbe14('0x3e')](function(_0x2dd3e3){_0x29fc64['rows']=_0x2dd3e3;return _0x29fc64;})[_0xbe14('0x3e')](respondWithFilteredResult(_0x169369,_0x5dd475))[_0xbe14('0x42')](handleError(_0x169369,null));};exports[_0xbe14('0x43')]=function(_0x36263c,_0x5cf713){var _0x4bfa96={'raw':!![],'where':{'id':_0x36263c[_0xbe14('0x44')]['id']}},_0x38611d={};_0x38611d[_0xbe14('0x2d')]=_['keys'](db['CmCustomField'][_0xbe14('0x29')]);_0x38611d['query']=_['keys'](_0x36263c[_0xbe14('0x2f')]);_0x38611d[_0xbe14('0x31')]=_[_0xbe14('0x32')](_0x38611d['model'],_0x38611d['query']);_0x4bfa96['attributes']=_[_0xbe14('0x32')](_0x38611d[_0xbe14('0x2d')],qs[_0xbe14('0x34')](_0x36263c['query'][_0xbe14('0x34')]));_0x4bfa96[_0xbe14('0x33')]=_0x4bfa96[_0xbe14('0x33')][_0xbe14('0x35')]?_0x4bfa96['attributes']:_0x38611d['model'];if(_0x36263c[_0xbe14('0x2f')][_0xbe14('0x3f')]){_0x4bfa96[_0xbe14('0x40')]=[{'all':!![]}];}_0x4bfa96=_[_0xbe14('0x3c')]({},_0x4bfa96,_0x36263c[_0xbe14('0x3d')]);return db['CmCustomField']['find'](_0x4bfa96)[_0xbe14('0x3e')](handleEntityNotFound(_0x5cf713,null))[_0xbe14('0x3e')](respondWithResult(_0x5cf713,null))[_0xbe14('0x42')](handleError(_0x5cf713,null));};exports[_0xbe14('0x20')]=function(_0x4e65d2,_0x28b6e3){if(_0x4e65d2[_0xbe14('0x45')]['id']){delete _0x4e65d2['body']['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x4e65d2[_0xbe14('0x44')]['id']}})[_0xbe14('0x3e')](handleEntityNotFound(_0x28b6e3,null))['then'](saveUpdates(_0x4e65d2['body'],null))[_0xbe14('0x3e')](respondWithResult(_0x28b6e3,null))[_0xbe14('0x42')](handleError(_0x28b6e3,null));};exports['destroy']=function(_0x5acf90,_0xca8cdb){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x5acf90[_0xbe14('0x44')]['id']}})[_0xbe14('0x3e')](handleEntityNotFound(_0xca8cdb,null))[_0xbe14('0x3e')](removeEntity(_0xca8cdb,null))[_0xbe14('0x42')](handleError(_0xca8cdb,null));};exports['create']=function(_0xf32e93,_0x5f22b2){var _0x6928f2;return db[_0xbe14('0x47')][_0xbe14('0x48')](function(_0x494c32){return db[_0xbe14('0x28')][_0xbe14('0x49')](_0xf32e93[_0xbe14('0x45')],{'transaction':_0x494c32})[_0xbe14('0x3e')](function(_0x3d3ae1){_0x6928f2=_0x3d3ae1;var _0x2dbeb1={'type':db['Sequelize']['TEXT'],'transaction':_0x494c32};switch(_0xf32e93[_0xbe14('0x45')][_0xbe14('0x2b')]){case _0xbe14('0x4a'):_0x2dbeb1['type']=db['Sequelize'][_0xbe14('0x4b')];break;case _0xbe14('0x4c'):_0x2dbeb1['type']=db[_0xbe14('0x4d')][_0xbe14('0x4e')];break;case'switch':_0x2dbeb1[_0xbe14('0x2b')]=db['Sequelize'][_0xbe14('0x4f')];_0x2dbeb1[_0xbe14('0x50')]=![];break;default:}return db[_0xbe14('0x47')]['queryInterface'][_0xbe14('0x51')](_0xbe14('0x52'),util['format'](_0xbe14('0x53'),_0x6928f2['id']),_0x2dbeb1);})[_0xbe14('0x3e')](function(){return _0x6928f2;});})[_0xbe14('0x3e')](respondWithResult(_0x5f22b2,0xc9))[_0xbe14('0x42')](handleError(_0x5f22b2,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 08c6530..255a1b4 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 _0x78bd=['request-promise','path','rimraf','./cmCustomField.attributes','define','cm_custom_fields','lodash','util','../../config/logger','bluebird'];(function(_0x2dd08f,_0x5ee018){var _0x27967a=function(_0x57b2b0){while(--_0x57b2b0){_0x2dd08f['push'](_0x2dd08f['shift']());}};_0x27967a(++_0x5ee018);}(_0x78bd,0x1f0));var _0xd78b=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x78bd[_0x1d6a82];return _0x5834ac;};'use strict';var _=require(_0xd78b('0x0'));var util=require(_0xd78b('0x1'));var logger=require(_0xd78b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd78b('0x3'));var rp=require(_0xd78b('0x4'));var fs=require('fs');var path=require(_0xd78b('0x5'));var rimraf=require(_0xd78b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd78b('0x7'));module['exports']=function(_0x34c39d,_0x4fbcae){return _0x34c39d[_0xd78b('0x8')]('CmCustomField',attributes,{'tableName':_0xd78b('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3b7=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x35fab0,_0x14eaa4){var _0x4c85ce=function(_0xeee56d){while(--_0xeee56d){_0x35fab0['push'](_0x35fab0['shift']());}};_0x4c85ce(++_0x14eaa4);}(_0xc3b7,0x1b6));var _0x7c3b=function(_0x46bc9f,_0x38f92d){_0x46bc9f=_0x46bc9f-0x0;var _0x4f6b94=_0xc3b7[_0x46bc9f];return _0x4f6b94;};'use strict';var _=require('lodash');var util=require(_0x7c3b('0x0'));var logger=require(_0x7c3b('0x1'))('api');var moment=require(_0x7c3b('0x2'));var BPromise=require(_0x7c3b('0x3'));var rp=require(_0x7c3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c3b('0x5'));var config=require(_0x7c3b('0x6'));var attributes=require(_0x7c3b('0x7'));module[_0x7c3b('0x8')]=function(_0x2335d3,_0x43c6a4){return _0x2335d3[_0x7c3b('0x9')](_0x7c3b('0xa'),attributes,{'tableName':_0x7c3b('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 2d33573..1bb6310 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 _0x303a=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x303a,0x1a0));var _0xa303=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x303a[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('CmCustomField,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('CmCustomField,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('CmCustomField,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});} \ No newline at end of file +var _0x524a=['request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x524a,0xf5));var _0xa524=function(_0x566a66,_0x106103){_0x566a66=_0x566a66-0x0;var _0x5cae54=_0x524a[_0x566a66];return _0x5cae54;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa524('0x4'));var db=require(_0xa524('0x5'))['db'];var utils=require(_0xa524('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa524('0x7'));var jayson=require(_0xa524('0x8'));var client=jayson[_0xa524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460738,_0x56bd0e,_0x3a2dd6){return new BPromise(function(_0x11aa98,_0x56849e){return client[_0xa524('0xa')](_0x460738,_0x3a2dd6)[_0xa524('0xb')](function(_0x228ffe){logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,'request\x20sent');logger[_0xa524('0xe')](_0xa524('0xf'),_0x56bd0e,'request\x20sent',JSON['stringify'](_0x228ffe));if(_0x228ffe[_0xa524('0x10')]){if(_0x228ffe[_0xa524('0x10')][_0xa524('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')]['message']);return _0x56849e(_0x228ffe[_0xa524('0x10')]['message']);}logger[_0xa524('0x10')]('CmCustomField,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')][_0xa524('0x12')]);return _0x11aa98(_0x228ffe['error'][_0xa524('0x12')]);}else{logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,_0xa524('0x13'));_0x11aa98(_0x228ffe[_0xa524('0x14')][_0xa524('0x12')]);}})[_0xa524('0x15')](function(_0x4fc42f){logger[_0xa524('0x10')](_0xa524('0xd'),_0x56bd0e,_0x4fc42f);_0x56849e(_0x4fc42f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a4fcfc9..2f3c034 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 _0xf62d=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xf62d,0x13e));var _0xdf62=function(_0x1492e4,_0x53dbe6){_0x1492e4=_0x1492e4-0x0;var _0x583dbb=_0xf62d[_0x1492e4];return _0x583dbb;};'use strict';var multer=require(_0xdf62('0x0'));var util=require(_0xdf62('0x1'));var path=require(_0xdf62('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf62('0x3'));var router=express[_0xdf62('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf62('0x5'));var config=require(_0xdf62('0x6'));var controller=require(_0xdf62('0x7'));router[_0xdf62('0x8')]('/',auth[_0xdf62('0x9')](),controller['index']);router[_0xdf62('0x8')](_0xdf62('0xa'),auth[_0xdf62('0x9')](),controller[_0xdf62('0xb')]);router[_0xdf62('0xc')]('/',auth[_0xdf62('0x9')](),controller[_0xdf62('0xd')]);router[_0xdf62('0xe')](_0xdf62('0xa'),auth[_0xdf62('0x9')](),controller['update']);router['delete']('/:id',auth[_0xdf62('0x9')](),controller[_0xdf62('0xf')]);module[_0xdf62('0x10')]=router; \ No newline at end of file +var _0xca2f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x532b2a,_0x18bc03){var _0x5cb424=function(_0xf9a797){while(--_0xf9a797){_0x532b2a['push'](_0x532b2a['shift']());}};_0x5cb424(++_0x18bc03);}(_0xca2f,0x1f2));var _0xfca2=function(_0x57ae00,_0x13981d){_0x57ae00=_0x57ae00-0x0;var _0x5dbb95=_0xca2f[_0x57ae00];return _0x5dbb95;};'use strict';var multer=require(_0xfca2('0x0'));var util=require(_0xfca2('0x1'));var path=require(_0xfca2('0x2'));var timeout=require(_0xfca2('0x3'));var express=require(_0xfca2('0x4'));var router=express[_0xfca2('0x5')]();var auth=require(_0xfca2('0x6'));var interaction=require(_0xfca2('0x7'));var config=require(_0xfca2('0x8'));var controller=require(_0xfca2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xfca2('0xa')]);router[_0xfca2('0xb')](_0xfca2('0xc'),auth['isAuthenticated'](),controller[_0xfca2('0xd')]);router[_0xfca2('0xe')]('/',auth['isAuthenticated'](),controller[_0xfca2('0xf')]);router[_0xfca2('0x10')](_0xfca2('0xc'),auth['isAuthenticated'](),controller[_0xfca2('0x11')]);router[_0xfca2('0x12')](_0xfca2('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xfca2('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 6f56fab..31dd5b2 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 _0xc978=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8c97('0x0'));var Sequelize=require(_0x8c97('0x1'));module[_0x8c97('0x2')]={'phone':{'type':Sequelize[_0x8c97('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8c97('0x5')],'defaultValue':moment()['format'](_0x8c97('0x6'))},'countbusyretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8c97('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8c97('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8c97('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8c97('0x7')],'unique':_0x8c97('0x9')},'ListId':{'type':Sequelize[_0x8c97('0x7')],'unique':_0x8c97('0x9')},'UserId':{'type':Sequelize[_0x8c97('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8c97('0x9')},'CampaignId':{'type':Sequelize[_0x8c97('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6334=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x6334,0x119));var _0x4633=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x6334[_0x26d6d9];return _0x1b4875;};'use strict';var moment=require(_0x4633('0x0'));var Sequelize=require(_0x4633('0x1'));module[_0x4633('0x2')]={'phone':{'type':Sequelize[_0x4633('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4633('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4633('0x5')],'defaultValue':moment()['format'](_0x4633('0x6'))},'countbusyretry':{'type':Sequelize[_0x4633('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4633('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4633('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4633('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4633('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4633('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4633('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4633('0x7')],'unique':_0x4633('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4633('0x9')},'UserId':{'type':Sequelize[_0x4633('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4633('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4633('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x4633('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4633('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4633('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4633('0x7')],'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 ec345f9..a17f7b9 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 _0xde6f=['jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','CmHopper','rawAttributes','fieldName','type','model','filters','intersection','query','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','calleridnum','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','preview','sequelize','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','CmCompany','Company','CmList','List','dialActive','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto'];(function(_0x840fbb,_0x4410b5){var _0x5f3229=function(_0x10e600){while(--_0x10e600){_0x840fbb['push'](_0x840fbb['shift']());}};_0x5f3229(++_0x4410b5);}(_0xde6f,0x84));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfde6('0x0'));var zipdir=require(_0xfde6('0x1'));var jsonpatch=require(_0xfde6('0x2'));var rp=require('request-promise');var moment=require(_0xfde6('0x3'));var BPromise=require(_0xfde6('0x4'));var Mustache=require(_0xfde6('0x5'));var util=require(_0xfde6('0x6'));var path=require(_0xfde6('0x7'));var sox=require(_0xfde6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfde6('0x9'));var squel=require(_0xfde6('0xa'));var crypto=require(_0xfde6('0xb'));var jsforce=require(_0xfde6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfde6('0xd'));var querystring=require(_0xfde6('0xe'));var Papa=require(_0xfde6('0xf'));var Redis=require('ioredis');var authService=require(_0xfde6('0x10'));var qs=require(_0xfde6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfde6('0x12'))(_0xfde6('0x13'));var utils=require(_0xfde6('0x14'));var config=require(_0xfde6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfde6('0x16'))['db'];function respondWithStatusCode(_0x9a96cf,_0x3a3776){_0x3a3776=_0x3a3776||0xcc;return function(_0x1c5ade){if(_0x1c5ade){return _0x9a96cf[_0xfde6('0x17')](_0x3a3776);}return _0x9a96cf['status'](_0x3a3776)[_0xfde6('0x18')]();};}function respondWithResult(_0x18de07,_0x5d129c){_0x5d129c=_0x5d129c||0xc8;return function(_0x8237f4){if(_0x8237f4){return _0x18de07[_0xfde6('0x19')](_0x5d129c)[_0xfde6('0x1a')](_0x8237f4);}};}function respondWithFilteredResult(_0x506b96,_0x159254){return function(_0xcd2776){if(_0xcd2776){var _0x101ea8=_0xcd2776[_0xfde6('0x1b')],_0x17d5e6=_0x159254['offset'],_0x5204ae=_0x159254[_0xfde6('0x1c')]+_0x159254[_0xfde6('0x1d')],_0x4c1ea0;if(_0x5204ae>=_0x101ea8){_0x5204ae=_0x101ea8;_0x4c1ea0=0xc8;}else{_0x4c1ea0=0xce;}_0x506b96['status'](_0x4c1ea0);return _0x506b96[_0xfde6('0x1e')]('Content-Range',_0x17d5e6+'-'+_0x5204ae+'/'+_0x101ea8)[_0xfde6('0x1a')](_0xcd2776);}return null;};}function patchUpdates(_0x398d76){return function(_0x44756d){try{jsonpatch[_0xfde6('0x1f')](_0x44756d,_0x398d76,!![]);}catch(_0x1ec215){return BPromise[_0xfde6('0x20')](_0x1ec215);}return _0x44756d[_0xfde6('0x21')]();};}function saveUpdates(_0x1841d8,_0x1a4076){return function(_0x599c33){if(_0x599c33){return _0x599c33[_0xfde6('0x22')](_0x1841d8)[_0xfde6('0x23')](function(_0x58a222){return _0x58a222;});}return null;};}function removeEntity(_0x2577a1,_0x458cfc){return function(_0x4ff8e2){if(_0x4ff8e2){return _0x4ff8e2[_0xfde6('0x24')]()[_0xfde6('0x23')](function(){_0x2577a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c3c4d,_0xc18655){return function(_0x4bc2c2){if(!_0x4bc2c2){_0x2c3c4d[_0xfde6('0x17')](0x194);}return _0x4bc2c2;};}function handleError(_0x492219,_0x51ca17){_0x51ca17=_0x51ca17||0x1f4;return function(_0x2cac84){logger[_0xfde6('0x25')](_0x2cac84[_0xfde6('0x26')]);if(_0x2cac84[_0xfde6('0x27')]){delete _0x2cac84[_0xfde6('0x27')];}_0x492219[_0xfde6('0x19')](_0x51ca17)['send'](_0x2cac84);};}exports[_0xfde6('0x28')]=function(_0x262373,_0x5f2171){var _0x26b355={},_0x58457d={},_0x2e9b86={'count':0x0,'rows':[]};var _0x2eb564=_['map'](db[_0xfde6('0x29')][_0xfde6('0x2a')],function(_0x54e872){return{'name':_0x54e872[_0xfde6('0x2b')],'type':_0x54e872[_0xfde6('0x2c')]['key']};});_0x58457d[_0xfde6('0x2d')]=_['map'](_0x2eb564,_0xfde6('0x27'));_0x58457d['query']=_['keys'](_0x262373['query']);_0x58457d[_0xfde6('0x2e')]=_[_0xfde6('0x2f')](_0x58457d[_0xfde6('0x2d')],_0x58457d[_0xfde6('0x30')]);_0x58457d[_0xfde6('0x2e')]=_['concat'](_0x58457d['filters'],['$and',_0xfde6('0x31'),_0xfde6('0x32'),_0xfde6('0x33'),_0xfde6('0x34'),_0xfde6('0x35'),_0xfde6('0x36'),_0xfde6('0x37'),_0xfde6('0x38'),_0xfde6('0x39'),'$notBetween',_0xfde6('0x3a'),_0xfde6('0x3b'),_0xfde6('0x3c'),_0xfde6('0x3d'),'$iLike',_0xfde6('0x3e'),'$like',_0xfde6('0x3f'),_0xfde6('0x40'),_0xfde6('0x41'),_0xfde6('0x42')]);_0x26b355['attributes']=_[_0xfde6('0x2f')](_0x58457d['model'],qs[_0xfde6('0x43')](_0x262373[_0xfde6('0x30')]['fields']));_0x26b355[_0xfde6('0x44')]=_0x26b355[_0xfde6('0x44')][_0xfde6('0x45')]?_0x26b355[_0xfde6('0x44')]:_0x58457d['model'];if(!_0x262373[_0xfde6('0x30')][_0xfde6('0x46')](_0xfde6('0x47'))){_0x26b355[_0xfde6('0x1d')]=qs[_0xfde6('0x1d')](_0x262373[_0xfde6('0x30')][_0xfde6('0x1d')]);_0x26b355[_0xfde6('0x1c')]=qs[_0xfde6('0x1c')](_0x262373[_0xfde6('0x30')][_0xfde6('0x1c')]);}_0x26b355[_0xfde6('0x48')]=qs[_0xfde6('0x49')](_0x262373[_0xfde6('0x30')][_0xfde6('0x49')]);_0x26b355[_0xfde6('0x4a')]=qs[_0xfde6('0x2e')](_['pick'](_0x262373['query'],_0x58457d['filters']),_0x2eb564);if(_0x262373[_0xfde6('0x30')][_0xfde6('0x4b')]){_0x26b355['where']=_[_0xfde6('0x4c')](_0x26b355[_0xfde6('0x4a')],{'$or':_[_0xfde6('0x4d')](_0x2eb564,function(_0x25a567){if(_0x25a567[_0xfde6('0x2c')]!==_0xfde6('0x4e')){var _0x2b7a24={};_0x2b7a24[_0x25a567[_0xfde6('0x27')]]={'$like':'%'+_0x262373[_0xfde6('0x30')][_0xfde6('0x4b')]+'%'};return _0x2b7a24;}})});}_0x26b355=_[_0xfde6('0x4c')]({},_0x26b355,_0x262373[_0xfde6('0x4f')]);var _0x399213={'where':_0x26b355['where']};return db[_0xfde6('0x29')][_0xfde6('0x1b')](_0x399213)['then'](function(_0xdad23f){_0x2e9b86[_0xfde6('0x1b')]=_0xdad23f;if(_0x262373[_0xfde6('0x30')][_0xfde6('0x50')]){_0x26b355[_0xfde6('0x51')]=[{'all':!![]}];}return db[_0xfde6('0x29')][_0xfde6('0x52')](_0x26b355);})[_0xfde6('0x23')](function(_0x239761){_0x2e9b86[_0xfde6('0x53')]=_0x239761;return _0x2e9b86;})[_0xfde6('0x23')](respondWithFilteredResult(_0x5f2171,_0x26b355))[_0xfde6('0x54')](handleError(_0x5f2171,null));};exports[_0xfde6('0x55')]=function(_0x188797,_0x34ba90){var _0xff02c1={'raw':!![],'where':{'id':_0x188797[_0xfde6('0x56')]['id']}},_0x4f1c9f={};_0x4f1c9f[_0xfde6('0x2d')]=_[_0xfde6('0x57')](db[_0xfde6('0x29')][_0xfde6('0x2a')]);_0x4f1c9f['query']=_[_0xfde6('0x57')](_0x188797[_0xfde6('0x30')]);_0x4f1c9f[_0xfde6('0x2e')]=_['intersection'](_0x4f1c9f['model'],_0x4f1c9f[_0xfde6('0x30')]);_0xff02c1[_0xfde6('0x44')]=_[_0xfde6('0x2f')](_0x4f1c9f[_0xfde6('0x2d')],qs[_0xfde6('0x43')](_0x188797['query'][_0xfde6('0x43')]));_0xff02c1[_0xfde6('0x44')]=_0xff02c1[_0xfde6('0x44')][_0xfde6('0x45')]?_0xff02c1['attributes']:_0x4f1c9f[_0xfde6('0x2d')];if(_0x188797['query'][_0xfde6('0x50')]){_0xff02c1[_0xfde6('0x51')]=[{'all':!![]}];}_0xff02c1=_[_0xfde6('0x4c')]({},_0xff02c1,_0x188797[_0xfde6('0x4f')]);return db[_0xfde6('0x29')][_0xfde6('0x58')](_0xff02c1)[_0xfde6('0x23')](handleEntityNotFound(_0x34ba90,null))[_0xfde6('0x23')](respondWithResult(_0x34ba90,null))[_0xfde6('0x54')](handleError(_0x34ba90,null));};exports[_0xfde6('0x59')]=function(_0x555058,_0x1b39bc){return db[_0xfde6('0x29')]['create'](_0x555058[_0xfde6('0x5a')],{})[_0xfde6('0x23')](respondWithResult(_0x1b39bc,0xc9))['catch'](handleError(_0x1b39bc,null));};exports[_0xfde6('0x22')]=function(_0x340dec,_0x178ff5){if(_0x340dec[_0xfde6('0x5a')]['id']){delete _0x340dec[_0xfde6('0x5a')]['id'];}return db[_0xfde6('0x29')][_0xfde6('0x58')]({'where':{'id':_0x340dec[_0xfde6('0x56')]['id']}})[_0xfde6('0x23')](handleEntityNotFound(_0x178ff5,null))[_0xfde6('0x23')](saveUpdates(_0x340dec[_0xfde6('0x5a')],null))['then'](respondWithResult(_0x178ff5,null))['catch'](handleError(_0x178ff5,null));};exports[_0xfde6('0x5b')]=function(_0x2e027e,_0x196266){return db[_0xfde6('0x29')][_0xfde6('0x5b')]()[_0xfde6('0x23')](respondWithResult(_0x196266,null))[_0xfde6('0x54')](handleError(_0x196266,null));};exports[_0xfde6('0x24')]=function(_0x5d699b,_0x13ab70){var _0x281980;return db[_0xfde6('0x29')][_0xfde6('0x58')]({'where':{'id':_0x5d699b[_0xfde6('0x56')]['id']}})[_0xfde6('0x23')](handleEntityNotFound(_0x13ab70,null))[_0xfde6('0x23')](function(_0x1929f7){if(_0x1929f7){return _0x1929f7['destroy']()['then'](function(_0x523916){return _0x523916;});}})[_0xfde6('0x23')](function(_0x1b6964){_0x281980=_0x1b6964;if(_0x1b6964){if(_0x1b6964[_0xfde6('0x5c')]||_0x1b6964[_0xfde6('0x5d')]){return db[_0x1b6964[_0xfde6('0x5c')]?_0xfde6('0x5e'):'Campaign']['find']({'where':{'id':_0x1b6964[_0xfde6('0x5c')]?_0x1b6964['VoiceQueueId']:_0x1b6964['CampaignId']},'attributes':['id',_0xfde6('0x27')],'raw':!![]});}}})[_0xfde6('0x23')](function(_0x43587f){var _0x1de127={};if(_0x43587f){_[_0xfde6('0x4c')](_0x1de127,_[_0xfde6('0x5f')](_0x281980['dataValues'],['createdAt',_0xfde6('0x60'),'id']));_0x1de127['state']=0x15;_0x1de127[_0xfde6('0x61')]='deleted';_0x1de127[_0xfde6('0x62')]=_0x43587f[_0xfde6('0x27')];_0x1de127[_0xfde6('0x63')]=_0x5d699b[_0xfde6('0x64')][_0xfde6('0x27')];_0x1de127[_0xfde6('0x65')]=_0x5d699b[_0xfde6('0x64')]['id'];_0x1de127[_0xfde6('0x66')]=!![];_0x1de127[_0xfde6('0x67')]=moment()[_0xfde6('0x68')]('YYYY-MM-DD\x20HH:mm:ss');_0x1de127[_0xfde6('0x69')]=_0x281980['phone'];_0x1de127[_0xfde6('0x6a')]=_0x281980[_0xfde6('0x5c')]?_0xfde6('0x6b'):_0xfde6('0x6c');return db['CmContact'][_0xfde6('0x58')]({'where':{'id':_0x1de127['ContactId']},'attributes':[_0xfde6('0x6d'),_0xfde6('0x6e')]})[_0xfde6('0x23')](function(_0x5aa2d6){if(!_[_0xfde6('0x6f')](_0x13ab70)&&!_[_0xfde6('0x6f')](_0x5aa2d6[_0xfde6('0x6d')])){_0x1de127[_0xfde6('0x70')]=_0x5aa2d6[_0xfde6('0x6d')];if(!_[_0xfde6('0x6f')](_0x5aa2d6[_0xfde6('0x6e')])){_0x1de127['calleridname']+='\x20'+_0x5aa2d6[_0xfde6('0x6e')];}}})[_0xfde6('0x71')](function(){return db[_0xfde6('0x72')][_0xfde6('0x59')](_0x1de127);});}})[_0xfde6('0x23')](function(){return _0x13ab70[_0xfde6('0x19')](0xcc)[_0xfde6('0x18')]();})[_0xfde6('0x54')](handleError(_0x13ab70,null));};exports[_0xfde6('0x73')]=function(_0x22565c,_0xfb2181,_0x45b9b1){var _0xa9c471=[];return db[_0xfde6('0x74')][_0xfde6('0x5b')]()['then'](function(_0x3b25f5){_0xa9c471=_['keys'](_0x3b25f5);return _0x22565c['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xfde6('0x75')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x5d0c3f){if(_0x5d0c3f&&_0x5d0c3f[_0xfde6('0x45')]){return db[_0xfde6('0x76')]['transaction'](function(_0x6396de){var _0x3bc7de={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfde6('0x68')](_0xfde6('0x77'))},'VoiceQueueId':{'$in':_['map'](_0x5d0c3f,'id')},'$or':[{'UserId':null},{'UserId':_0x22565c[_0xfde6('0x64')]['id']}]};var _0x42453a=[];if(_0x22565c[_0xfde6('0x5a')][_0xfde6('0x78')]&&_0x22565c[_0xfde6('0x5a')][_0xfde6('0x78')]===_0xfde6('0x79')){if(!_[_0xfde6('0x7a')](_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')])){_0x3bc7de['id']={'$in':_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')]};}_0x42453a=[[_0xfde6('0x7c'),_0xfde6('0x7d')],['scheduledAt',_0x5d0c3f[0x0][_0xfde6('0x7e')]===_0xfde6('0x7d')?_0xfde6('0x7f'):'ASC'],db['sequelize'][_0xfde6('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xfde6('0x7f')]];}else{if(!_[_0xfde6('0x7a')](_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')])){_0x3bc7de['id']={'$notIn':_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')]};}_0x42453a=[[_0xfde6('0x7c'),_0xfde6('0x7f')],[_0xfde6('0x81'),_0x5d0c3f[0x0][_0xfde6('0x7e')]],db[_0xfde6('0x76')][_0xfde6('0x80')](_0xfde6('0x82')),['id',_0xfde6('0x7d')]];}return db[_0xfde6('0x29')][_0xfde6('0x83')]({'attributes':['id','scheduledat'],'where':_0x3bc7de,'order':_0x42453a,'transaction':_0x6396de,'lock':_0x6396de[_0xfde6('0x84')][_0xfde6('0x85')],'include':[{'model':db[_0xfde6('0x74')],'as':'Contact','attributes':_0xa9c471,'include':[{'model':db[_0xfde6('0x86')],'as':_0xfde6('0x87'),'attributes':['id','name']}]},{'model':db[_0xfde6('0x88')],'as':_0xfde6('0x89'),'attributes':['id',_0xfde6('0x27')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xfde6('0x27'),_0xfde6('0x8a')]}]})['then'](function(_0x296098){if(_0x296098){return _0x296098[_0xfde6('0x22')]({'UserId':_0x22565c['user']['id']},{'transaction':_0x6396de});}});});}})['then'](handleEntityNotFound(_0xfb2181,null))['then'](respondWithResult(_0xfb2181,null))['catch'](handleError(_0xfb2181,null));};exports[_0xfde6('0x8b')]=function(_0x351950,_0x1e4d9a,_0x24e9bf){return _0x351950[_0xfde6('0x64')][_0xfde6('0x8c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x2f993d){if(_0x2f993d&&_0x2f993d[_0xfde6('0x45')]){return db[_0xfde6('0x29')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfde6('0x68')](_0xfde6('0x77'))},'VoiceQueueId':{'$in':_[_0xfde6('0x4d')](_0x2f993d,'id')},'$or':[{'UserId':null},{'UserId':_0x351950[_0xfde6('0x64')]['id']}]}});}return 0x0;})[_0xfde6('0x23')](function(_0x44ecb3){if(!_[_0xfde6('0x6f')](_0x44ecb3)&&_[_0xfde6('0x8d')](_0x44ecb3)){return _0x1e4d9a[_0xfde6('0x19')](0xc8)['json']({'contacts':_0x44ecb3});}else{logger[_0xfde6('0x25')](_0xfde6('0x8e'),'getOpenContacts',0x194,_0xfde6('0x8f'));_0x1e4d9a['sendStatus'](0x194);}})[_0xfde6('0x54')](handleError(_0x1e4d9a,null));}; \ No newline at end of file +var _0x85d3=['user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','entity\x20not\x20found','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','update','body','find','describe','VoiceQueueId','CampaignId','Campaign','dataValues','createdAt','updatedAt','state','deleted','campaign','membername'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x85d3,0xc8));var _0x385d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x85d3[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x385d('0x0'));var emlformat=require(_0x385d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x385d('0x2'));var rp=require(_0x385d('0x3'));var moment=require(_0x385d('0x4'));var BPromise=require(_0x385d('0x5'));var Mustache=require(_0x385d('0x6'));var util=require(_0x385d('0x7'));var path=require('path');var sox=require(_0x385d('0x8'));var csv=require('to-csv');var ejs=require(_0x385d('0x9'));var fs=require('fs');var _=require(_0x385d('0xa'));var squel=require(_0x385d('0xb'));var crypto=require(_0x385d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x385d('0xd'));var toCsv=require(_0x385d('0xe'));var querystring=require(_0x385d('0xf'));var Papa=require(_0x385d('0x10'));var Redis=require(_0x385d('0x11'));var authService=require(_0x385d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x385d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x385d('0x14'));var utils=require(_0x385d('0x15'));var config=require(_0x385d('0x16'));var licenseUtil=require(_0x385d('0x17'));var db=require(_0x385d('0x18'))['db'];function respondWithStatusCode(_0x3cf7b3,_0xd6203f){_0xd6203f=_0xd6203f||0xcc;return function(_0x590efb){if(_0x590efb){return _0x3cf7b3['sendStatus'](_0xd6203f);}return _0x3cf7b3[_0x385d('0x19')](_0xd6203f)[_0x385d('0x1a')]();};}function respondWithResult(_0x13a482,_0x4b1693){_0x4b1693=_0x4b1693||0xc8;return function(_0x20c391){if(_0x20c391){return _0x13a482[_0x385d('0x19')](_0x4b1693)[_0x385d('0x1b')](_0x20c391);}};}function respondWithFilteredResult(_0x12c05f,_0x199c63){return function(_0x435c7f){if(_0x435c7f){var _0x411f19=_0x435c7f[_0x385d('0x1c')],_0x57160b=_0x199c63[_0x385d('0x1d')],_0x2e7863=_0x199c63[_0x385d('0x1d')]+_0x199c63[_0x385d('0x1e')],_0x5f47e5;if(_0x2e7863>=_0x411f19){_0x2e7863=_0x411f19;_0x5f47e5=0xc8;}else{_0x5f47e5=0xce;}_0x12c05f['status'](_0x5f47e5);return _0x12c05f[_0x385d('0x1f')](_0x385d('0x20'),_0x57160b+'-'+_0x2e7863+'/'+_0x411f19)[_0x385d('0x1b')](_0x435c7f);}return null;};}function patchUpdates(_0x3e03ad){return function(_0x29f018){try{jsonpatch[_0x385d('0x21')](_0x29f018,_0x3e03ad,!![]);}catch(_0x49b2a7){return BPromise[_0x385d('0x22')](_0x49b2a7);}return _0x29f018[_0x385d('0x23')]();};}function saveUpdates(_0x21d085,_0x2b867c){return function(_0x472212){if(_0x472212){return _0x472212['update'](_0x21d085)[_0x385d('0x24')](function(_0x5e4631){return _0x5e4631;});}return null;};}function removeEntity(_0x55aa55,_0x446152){return function(_0x85afff){if(_0x85afff){return _0x85afff[_0x385d('0x25')]()['then'](function(){_0x55aa55['status'](0xcc)[_0x385d('0x1a')]();});}};}function handleEntityNotFound(_0x438b31,_0x52b031){return function(_0x51eeef){if(!_0x51eeef){_0x438b31[_0x385d('0x26')](0x194);}return _0x51eeef;};}function handleError(_0x4c3209,_0x107933){_0x107933=_0x107933||0x1f4;return function(_0x3a4372){logger[_0x385d('0x27')](_0x3a4372[_0x385d('0x28')]);if(_0x3a4372['name']){delete _0x3a4372[_0x385d('0x29')];}_0x4c3209[_0x385d('0x19')](_0x107933)['send'](_0x3a4372);};}exports[_0x385d('0x2a')]=function(_0x3f3213,_0x260c43){var _0x3ff927={},_0x37b77f={},_0x55eaf3={'count':0x0,'rows':[]};var _0x309471=_['map'](db[_0x385d('0x2b')][_0x385d('0x2c')],function(_0x49d486){return{'name':_0x49d486[_0x385d('0x2d')],'type':_0x49d486[_0x385d('0x2e')][_0x385d('0x2f')]};});_0x37b77f[_0x385d('0x30')]=_['map'](_0x309471,'name');_0x37b77f[_0x385d('0x31')]=_['keys'](_0x3f3213['query']);_0x37b77f[_0x385d('0x32')]=_[_0x385d('0x33')](_0x37b77f[_0x385d('0x30')],_0x37b77f[_0x385d('0x31')]);_0x37b77f['filters']=_[_0x385d('0x34')](_0x37b77f[_0x385d('0x32')],[_0x385d('0x35'),_0x385d('0x36'),_0x385d('0x37'),_0x385d('0x38'),_0x385d('0x39'),_0x385d('0x3a'),_0x385d('0x3b'),_0x385d('0x3c'),_0x385d('0x3d'),_0x385d('0x3e'),'$notBetween',_0x385d('0x3f'),_0x385d('0x40'),_0x385d('0x41'),_0x385d('0x42'),_0x385d('0x43'),_0x385d('0x44'),_0x385d('0x41'),_0x385d('0x45'),'$contains',_0x385d('0x46'),'$any']);_0x3ff927['attributes']=_['intersection'](_0x37b77f[_0x385d('0x30')],qs['fields'](_0x3f3213[_0x385d('0x31')][_0x385d('0x47')]));_0x3ff927[_0x385d('0x48')]=_0x3ff927['attributes'][_0x385d('0x49')]?_0x3ff927[_0x385d('0x48')]:_0x37b77f[_0x385d('0x30')];if(!_0x3f3213['query'][_0x385d('0x4a')](_0x385d('0x4b'))){_0x3ff927['limit']=qs[_0x385d('0x1e')](_0x3f3213[_0x385d('0x31')]['limit']);_0x3ff927[_0x385d('0x1d')]=qs[_0x385d('0x1d')](_0x3f3213[_0x385d('0x31')][_0x385d('0x1d')]);}_0x3ff927[_0x385d('0x4c')]=qs[_0x385d('0x4d')](_0x3f3213[_0x385d('0x31')][_0x385d('0x4d')]);_0x3ff927['where']=qs[_0x385d('0x32')](_[_0x385d('0x4e')](_0x3f3213[_0x385d('0x31')],_0x37b77f[_0x385d('0x32')]),_0x309471);if(_0x3f3213[_0x385d('0x31')][_0x385d('0x4f')]){_0x3ff927[_0x385d('0x50')]=_[_0x385d('0x51')](_0x3ff927['where'],{'$or':_[_0x385d('0x52')](_0x309471,function(_0x1c8f0f){if(_0x1c8f0f[_0x385d('0x2e')]!==_0x385d('0x53')){var _0x1204e3={};_0x1204e3[_0x1c8f0f[_0x385d('0x29')]]={'$like':'%'+_0x3f3213[_0x385d('0x31')][_0x385d('0x4f')]+'%'};return _0x1204e3;}})});}_0x3ff927=_[_0x385d('0x51')]({},_0x3ff927,_0x3f3213['options']);var _0x53d635={'where':_0x3ff927[_0x385d('0x50')]};return db[_0x385d('0x2b')]['count'](_0x53d635)[_0x385d('0x24')](function(_0x21b8bf){_0x55eaf3[_0x385d('0x1c')]=_0x21b8bf;if(_0x3f3213[_0x385d('0x31')][_0x385d('0x54')]){_0x3ff927[_0x385d('0x55')]=[{'all':!![]}];}return db['CmHopper'][_0x385d('0x56')](_0x3ff927);})['then'](function(_0x8e19c0){_0x55eaf3[_0x385d('0x57')]=_0x8e19c0;return _0x55eaf3;})[_0x385d('0x24')](respondWithFilteredResult(_0x260c43,_0x3ff927))[_0x385d('0x58')](handleError(_0x260c43,null));};exports[_0x385d('0x59')]=function(_0x49cae5,_0x1b88d6){var _0x5e373f={'raw':!![],'where':{'id':_0x49cae5[_0x385d('0x5a')]['id']}},_0x23975d={};_0x23975d['model']=_[_0x385d('0x5b')](db[_0x385d('0x2b')][_0x385d('0x2c')]);_0x23975d[_0x385d('0x31')]=_['keys'](_0x49cae5[_0x385d('0x31')]);_0x23975d['filters']=_[_0x385d('0x33')](_0x23975d[_0x385d('0x30')],_0x23975d[_0x385d('0x31')]);_0x5e373f[_0x385d('0x48')]=_[_0x385d('0x33')](_0x23975d['model'],qs[_0x385d('0x47')](_0x49cae5[_0x385d('0x31')]['fields']));_0x5e373f[_0x385d('0x48')]=_0x5e373f[_0x385d('0x48')][_0x385d('0x49')]?_0x5e373f[_0x385d('0x48')]:_0x23975d['model'];if(_0x49cae5[_0x385d('0x31')][_0x385d('0x54')]){_0x5e373f[_0x385d('0x55')]=[{'all':!![]}];}_0x5e373f=_['merge']({},_0x5e373f,_0x49cae5[_0x385d('0x5c')]);return db[_0x385d('0x2b')]['find'](_0x5e373f)[_0x385d('0x24')](handleEntityNotFound(_0x1b88d6,null))[_0x385d('0x24')](respondWithResult(_0x1b88d6,null))[_0x385d('0x58')](handleError(_0x1b88d6,null));};exports[_0x385d('0x5d')]=function(_0x15df34,_0x43ab8c){return db[_0x385d('0x2b')][_0x385d('0x5d')](_0x15df34['body'],{})[_0x385d('0x24')](respondWithResult(_0x43ab8c,0xc9))[_0x385d('0x58')](handleError(_0x43ab8c,null));};exports[_0x385d('0x5e')]=function(_0x467d1f,_0x48f4a5){if(_0x467d1f[_0x385d('0x5f')]['id']){delete _0x467d1f['body']['id'];}return db[_0x385d('0x2b')][_0x385d('0x60')]({'where':{'id':_0x467d1f['params']['id']}})[_0x385d('0x24')](handleEntityNotFound(_0x48f4a5,null))[_0x385d('0x24')](saveUpdates(_0x467d1f[_0x385d('0x5f')],null))[_0x385d('0x24')](respondWithResult(_0x48f4a5,null))[_0x385d('0x58')](handleError(_0x48f4a5,null));};exports[_0x385d('0x61')]=function(_0x3323c0,_0x28d64a){return db['CmHopper']['describe']()[_0x385d('0x24')](respondWithResult(_0x28d64a,null))[_0x385d('0x58')](handleError(_0x28d64a,null));};exports['destroy']=function(_0x2f788c,_0x3061d9){var _0x3318ee;return db[_0x385d('0x2b')][_0x385d('0x60')]({'where':{'id':_0x2f788c[_0x385d('0x5a')]['id']}})[_0x385d('0x24')](handleEntityNotFound(_0x3061d9,null))['then'](function(_0x3cb429){if(_0x3cb429){return _0x3cb429[_0x385d('0x25')]()[_0x385d('0x24')](function(_0x1b1de5){return _0x1b1de5;});}})[_0x385d('0x24')](function(_0x50b1ff){_0x3318ee=_0x50b1ff;if(_0x50b1ff){if(_0x50b1ff[_0x385d('0x62')]||_0x50b1ff[_0x385d('0x63')]){return db[_0x50b1ff[_0x385d('0x62')]?'VoiceQueue':_0x385d('0x64')][_0x385d('0x60')]({'where':{'id':_0x50b1ff[_0x385d('0x62')]?_0x50b1ff[_0x385d('0x62')]:_0x50b1ff['CampaignId']},'attributes':['id',_0x385d('0x29')],'raw':!![]});}}})[_0x385d('0x24')](function(_0x4b1be1){var _0x2e79d4={};if(_0x4b1be1){_['merge'](_0x2e79d4,_['omit'](_0x3318ee[_0x385d('0x65')],[_0x385d('0x66'),_0x385d('0x67'),'id']));_0x2e79d4[_0x385d('0x68')]=0x15;_0x2e79d4['statedesc']=_0x385d('0x69');_0x2e79d4[_0x385d('0x6a')]=_0x4b1be1[_0x385d('0x29')];_0x2e79d4[_0x385d('0x6b')]=_0x2f788c[_0x385d('0x6c')]['name'];_0x2e79d4['UserId']=_0x2f788c[_0x385d('0x6c')]['id'];_0x2e79d4[_0x385d('0x69')]=!![];_0x2e79d4['deletedat']=moment()[_0x385d('0x6d')](_0x385d('0x6e'));_0x2e79d4[_0x385d('0x6f')]=_0x3318ee[_0x385d('0x70')];_0x2e79d4[_0x385d('0x71')]=_0x3318ee[_0x385d('0x62')]?_0x385d('0x72'):_0x385d('0x73');return db[_0x385d('0x74')]['find']({'where':{'id':_0x2e79d4[_0x385d('0x75')]},'attributes':[_0x385d('0x76'),_0x385d('0x77')]})['then'](function(_0x4d9ba1){if(!_[_0x385d('0x78')](_0x3061d9)&&!_['isNil'](_0x4d9ba1[_0x385d('0x76')])){_0x2e79d4[_0x385d('0x79')]=_0x4d9ba1[_0x385d('0x76')];if(!_[_0x385d('0x78')](_0x4d9ba1['lastName'])){_0x2e79d4['calleridname']+='\x20'+_0x4d9ba1[_0x385d('0x77')];}}})[_0x385d('0x7a')](function(){return db[_0x385d('0x7b')][_0x385d('0x5d')](_0x2e79d4);});}})['then'](function(){return _0x3061d9[_0x385d('0x19')](0xcc)[_0x385d('0x1a')]();})[_0x385d('0x58')](handleError(_0x3061d9,null));};exports[_0x385d('0x7c')]=function(_0x5d37a7,_0xb53a50,_0xb79c7a){var _0x4a0d37=[];return db[_0x385d('0x74')][_0x385d('0x61')]()[_0x385d('0x24')](function(_0x3b2f9a){_0x4a0d37=_[_0x385d('0x5b')](_0x3b2f9a);return _0x5d37a7[_0x385d('0x6c')]['getVoiceQueues']({'where':{'type':_0x385d('0x7d'),'dialActive':!![],'dialMethod':_0x385d('0x7e')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x45ade7){if(_0x45ade7&&_0x45ade7['length']){return db[_0x385d('0x7f')][_0x385d('0x80')](function(_0x55c780){var _0x1a1263={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x385d('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x45ade7,'id')},'$or':[{'UserId':null},{'UserId':_0x5d37a7[_0x385d('0x6c')]['id']}]};var _0x1ca161=[];if(_0x5d37a7['body'][_0x385d('0x81')]&&_0x5d37a7['body'][_0x385d('0x81')]==='prev'){if(!_[_0x385d('0x82')](_0x5d37a7[_0x385d('0x5f')][_0x385d('0x83')])){_0x1a1263['id']={'$in':_0x5d37a7[_0x385d('0x5f')][_0x385d('0x83')]};}_0x1ca161=[[_0x385d('0x84'),_0x385d('0x85')],[_0x385d('0x86'),_0x45ade7[0x0][_0x385d('0x87')]===_0x385d('0x85')?_0x385d('0x88'):'ASC'],db['sequelize']['literal'](_0x385d('0x89')),['id',_0x385d('0x88')]];}else{if(!_['isEmpty'](_0x5d37a7['body']['hopperIds'])){_0x1a1263['id']={'$notIn':_0x5d37a7[_0x385d('0x5f')]['hopperIds']};}_0x1ca161=[[_0x385d('0x84'),_0x385d('0x88')],['scheduledAt',_0x45ade7[0x0][_0x385d('0x87')]],db['sequelize'][_0x385d('0x8a')](_0x385d('0x8b')),['id','ASC']];}return db['CmHopper'][_0x385d('0x8c')]({'attributes':['id','scheduledat'],'where':_0x1a1263,'order':_0x1ca161,'transaction':_0x55c780,'lock':_0x55c780['LOCK'][_0x385d('0x8d')],'include':[{'model':db[_0x385d('0x74')],'as':_0x385d('0x8e'),'attributes':_0x4a0d37,'include':[{'model':db[_0x385d('0x8f')],'as':_0x385d('0x90'),'attributes':['id',_0x385d('0x29')]}]},{'model':db[_0x385d('0x91')],'as':_0x385d('0x92'),'attributes':['id',_0x385d('0x29')]},{'model':db[_0x385d('0x93')],'as':_0x385d('0x94'),'attributes':['id',_0x385d('0x29'),_0x385d('0x95')]}]})['then'](function(_0x259842){if(_0x259842){return _0x259842[_0x385d('0x5e')]({'UserId':_0x5d37a7[_0x385d('0x6c')]['id']},{'transaction':_0x55c780});}});});}})[_0x385d('0x24')](handleEntityNotFound(_0xb53a50,null))['then'](respondWithResult(_0xb53a50,null))[_0x385d('0x58')](handleError(_0xb53a50,null));};exports[_0x385d('0x96')]=function(_0x2564f7,_0x1f9e0d,_0x51cb09){return _0x2564f7[_0x385d('0x6c')][_0x385d('0x97')]({'where':{'type':_0x385d('0x7d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x385d('0x24')](function(_0x38ceec){if(_0x38ceec&&_0x38ceec[_0x385d('0x49')]){return db['CmHopper'][_0x385d('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x385d('0x6e'))},'VoiceQueueId':{'$in':_[_0x385d('0x52')](_0x38ceec,'id')},'$or':[{'UserId':null},{'UserId':_0x2564f7['user']['id']}]}});}return 0x0;})[_0x385d('0x24')](function(_0x3cc142){if(!_[_0x385d('0x78')](_0x3cc142)&&_[_0x385d('0x98')](_0x3cc142)){return _0x1f9e0d[_0x385d('0x19')](0xc8)[_0x385d('0x1b')]({'contacts':_0x3cc142});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x385d('0x96'),0x194,_0x385d('0x99'));_0x1f9e0d[_0x385d('0x26')](0x194);}})[_0x385d('0x58')](handleError(_0x1f9e0d,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6dd10a4..245acc3 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 _0xf9a8=['cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x5bf416,_0x4df544){var _0x597006=function(_0x4a1854){while(--_0x4a1854){_0x5bf416['push'](_0x5bf416['shift']());}};_0x597006(++_0x4df544);}(_0xf9a8,0x1a8));var _0x8f9a=function(_0x24f156,_0xf7f7dc){_0x24f156=_0x24f156-0x0;var _0x9401db=_0xf9a8[_0x24f156];return _0x9401db;};'use strict';var _=require('lodash');var util=require(_0x8f9a('0x0'));var logger=require(_0x8f9a('0x1'))(_0x8f9a('0x2'));var moment=require(_0x8f9a('0x3'));var BPromise=require(_0x8f9a('0x4'));var rp=require(_0x8f9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f9a('0x6'));var config=require(_0x8f9a('0x7'));var attributes=require(_0x8f9a('0x8'));module[_0x8f9a('0x9')]=function(_0x555297,_0x5b5aef){return _0x555297[_0x8f9a('0xa')]('CmHopper',attributes,{'tableName':_0x8f9a('0xb'),'paranoid':![],'indexes':[{'name':_0x8f9a('0xc'),'fields':[_0x8f9a('0xc')]},{'name':_0x8f9a('0xd'),'fields':['phone']},{'name':'priority','fields':[_0x8f9a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa31e=['util','api','moment','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0xd7f94,_0x343b5a){var _0x524224=function(_0x3c5918){while(--_0x3c5918){_0xd7f94['push'](_0xd7f94['shift']());}};_0x524224(++_0x343b5a);}(_0xa31e,0x1b1));var _0xea31=function(_0x564bec,_0x4e98e2){_0x564bec=_0x564bec-0x0;var _0x8dc0f7=_0xa31e[_0x564bec];return _0x8dc0f7;};'use strict';var _=require(_0xea31('0x0'));var util=require(_0xea31('0x1'));var logger=require('../../config/logger')(_0xea31('0x2'));var moment=require(_0xea31('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xea31('0x4'));var rimraf=require(_0xea31('0x5'));var config=require(_0xea31('0x6'));var attributes=require(_0xea31('0x7'));module[_0xea31('0x8')]=function(_0x33090f,_0x21e506){return _0x33090f[_0xea31('0x9')]('CmHopper',attributes,{'tableName':_0xea31('0xa'),'paranoid':![],'indexes':[{'name':_0xea31('0xb'),'fields':[_0xea31('0xb')]},{'name':_0xea31('0xc'),'fields':[_0xea31('0xc')]},{'name':_0xea31('0xd'),'fields':[_0xea31('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4a1d415..fbde77f 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 _0x3e96=['Contact','keys','User','voicePause','includes','push','UserId','all','GetContactDialer','MoveContactManagedDialer','transaction','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','CmContact','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','options','raw','where','attributes','limit','include','map','model','then','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','catch','update','UpdateCmHopper','destroy','DestroyCmHopper','describe','sequelize','order','LOCK','UPDATE'];(function(_0x137378,_0x1470ff){var _0x51d94c=function(_0x319734){while(--_0x319734){_0x137378['push'](_0x137378['shift']());}};_0x51d94c(++_0x1470ff);}(_0x3e96,0x12e));var _0x63e9=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x3e96[_0x1559a5];return _0x17a783;};'use strict';var _=require(_0x63e9('0x0'));var util=require(_0x63e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x63e9('0x2'));var fs=require('fs');var Redis=require(_0x63e9('0x3'));var db=require(_0x63e9('0x4'))['db'];var utils=require(_0x63e9('0x5'));var logger=require(_0x63e9('0x6'))(_0x63e9('0x7'));var config=require(_0x63e9('0x8'));var jayson=require(_0x63e9('0x9'));var client=jayson[_0x63e9('0xa')][_0x63e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e7f5,_0x3a5563,_0x238246){return new BPromise(function(_0x5a4a5e,_0x181957){return client['request'](_0x41e7f5,_0x238246)['then'](function(_0x422c4e){logger[_0x63e9('0xc')](_0x63e9('0xd'),_0x3a5563,_0x63e9('0xe'));logger[_0x63e9('0xf')](_0x63e9('0x10'),_0x3a5563,'request\x20sent',JSON[_0x63e9('0x11')](_0x422c4e));if(_0x422c4e[_0x63e9('0x12')]){if(_0x422c4e[_0x63e9('0x12')][_0x63e9('0x13')]===0x1f4){logger[_0x63e9('0x12')](_0x63e9('0xd'),_0x3a5563,_0x422c4e[_0x63e9('0x12')][_0x63e9('0x14')]);return _0x181957(_0x422c4e[_0x63e9('0x12')]['message']);}logger[_0x63e9('0x12')]('CmHopper,\x20%s,\x20%s',_0x3a5563,_0x422c4e['error'][_0x63e9('0x14')]);return _0x5a4a5e(_0x422c4e['error']['message']);}else{logger[_0x63e9('0xc')](_0x63e9('0xd'),_0x3a5563,_0x63e9('0xe'));_0x5a4a5e(_0x422c4e[_0x63e9('0x15')][_0x63e9('0x14')]);}})['catch'](function(_0x1f7abb){logger[_0x63e9('0x12')]('CmHopper,\x20%s,\x20%s',_0x3a5563,_0x1f7abb);_0x181957(_0x1f7abb);});});}exports[_0x63e9('0x16')]=function(_0x188d74){var _0x59e7ec=this;return new Promise(function(_0x55159e,_0x3d84d6){return db['CmHopper']['findAll']({'raw':_0x188d74['options']?_0x188d74[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x188d74[_0x63e9('0x17')]?_0x188d74[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x188d74['options']?_0x188d74[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':_0x188d74[_0x63e9('0x17')]?_0x188d74[_0x63e9('0x17')][_0x63e9('0x1b')]||null:null,'include':_0x188d74[_0x63e9('0x17')]?_0x188d74[_0x63e9('0x17')][_0x63e9('0x1c')]?_['map'](_0x188d74[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x21c294){return{'model':db[_0x21c294['model']],'as':_0x21c294['as'],'attributes':_0x21c294['attributes'],'include':_0x21c294[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x21c294[_0x63e9('0x1c')],function(_0x20d1e2){return{'model':db[_0x20d1e2[_0x63e9('0x1e')]],'as':_0x20d1e2['as'],'attributes':_0x20d1e2[_0x63e9('0x1a')],'include':_0x20d1e2[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x20d1e2[_0x63e9('0x1c')],function(_0x4673d4){return{'model':db[_0x4673d4['model']],'as':_0x4673d4['as'],'attributes':_0x4673d4[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x1f')](function(_0x57cb32){logger[_0x63e9('0xc')](_0x63e9('0x16'),_0x188d74);logger[_0x63e9('0xf')](_0x63e9('0x16'),_0x188d74,JSON[_0x63e9('0x11')](_0x57cb32));_0x55159e(_0x57cb32);})['catch'](function(_0x56846c){logger['error'](_0x63e9('0x16'),_0x56846c['message'],_0x188d74);_0x3d84d6(_0x59e7ec[_0x63e9('0x12')](0x1f4,_0x56846c[_0x63e9('0x14')]));});});};exports[_0x63e9('0x20')]=function(_0x3aca60){var _0x17b449=this;return new Promise(function(_0xfe5554,_0x11fb98){return db[_0x63e9('0x21')][_0x63e9('0x22')]({'raw':_0x3aca60[_0x63e9('0x17')]?_0x3aca60[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x3aca60['options']?_0x3aca60['options'][_0x63e9('0x19')]||null:null,'attributes':_0x3aca60[_0x63e9('0x17')]?_0x3aca60[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'include':_0x3aca60[_0x63e9('0x17')]?_0x3aca60[_0x63e9('0x17')][_0x63e9('0x1c')]?_['map'](_0x3aca60[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x135d74){return{'model':db[_0x135d74['model']],'as':_0x135d74['as'],'attributes':_0x135d74[_0x63e9('0x1a')],'include':_0x135d74[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x135d74[_0x63e9('0x1c')],function(_0x3f696b){return{'model':db[_0x3f696b[_0x63e9('0x1e')]],'as':_0x3f696b['as'],'attributes':_0x3f696b[_0x63e9('0x1a')],'include':_0x3f696b['include']?_[_0x63e9('0x1d')](_0x3f696b[_0x63e9('0x1c')],function(_0x56d937){return{'model':db[_0x56d937[_0x63e9('0x1e')]],'as':_0x56d937['as'],'attributes':_0x56d937[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x1f')](function(_0x588a06){logger[_0x63e9('0xc')](_0x63e9('0x20'),_0x3aca60);logger[_0x63e9('0xf')](_0x63e9('0x20'),_0x3aca60,JSON[_0x63e9('0x11')](_0x588a06));_0xfe5554(_0x588a06);})['catch'](function(_0x21dab7){logger[_0x63e9('0x12')]('ShowCmHopper',_0x21dab7['message'],_0x3aca60);_0x11fb98(_0x17b449['error'](0x1f4,_0x21dab7['message']));});});};exports[_0x63e9('0x23')]=function(_0x14ade2){var _0x33d83e=this;return new Promise(function(_0x49da29,_0xb2614b){return db['CmHopper'][_0x63e9('0x24')](_0x14ade2[_0x63e9('0x25')],{'raw':_0x14ade2[_0x63e9('0x17')]?_0x14ade2['options']['raw']===undefined?!![]:![]:!![]})[_0x63e9('0x1f')](function(_0xee6a0e){logger[_0x63e9('0xc')](_0x63e9('0x23'),_0x14ade2);logger[_0x63e9('0xf')](_0x63e9('0x23'),_0x14ade2,JSON[_0x63e9('0x11')](_0xee6a0e));_0x49da29(_0xee6a0e);})[_0x63e9('0x26')](function(_0x9b03e3){logger['error'](_0x63e9('0x23'),_0x9b03e3[_0x63e9('0x14')],_0x14ade2);_0xb2614b(_0x33d83e[_0x63e9('0x12')](0x1f4,_0x9b03e3[_0x63e9('0x14')]));});});};exports['UpdateCmHopper']=function(_0x578d12){var _0x2c2b55=this;return new Promise(function(_0x167826,_0x488ad7){return db[_0x63e9('0x21')][_0x63e9('0x27')](_0x578d12[_0x63e9('0x25')],{'raw':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')][_0x63e9('0x1b')]||null:null})[_0x63e9('0x1f')](function(_0x2af2ee){logger[_0x63e9('0xc')]('UpdateCmHopper',_0x578d12);logger[_0x63e9('0xf')]('UpdateCmHopper',_0x578d12,JSON['stringify'](_0x2af2ee));_0x167826(_0x2af2ee);})['catch'](function(_0xfd3f2){logger['error'](_0x63e9('0x28'),_0xfd3f2[_0x63e9('0x14')],_0x578d12);_0x488ad7(_0x2c2b55[_0x63e9('0x12')](0x1f4,_0xfd3f2[_0x63e9('0x14')]));});});};exports['DestroyCmHopper']=function(_0x57b598){var _0x3032e7=this;return new Promise(function(_0x5b6e70,_0x401228){return db[_0x63e9('0x21')][_0x63e9('0x29')]({'where':_0x57b598[_0x63e9('0x17')]?_0x57b598['options']['where']||null:null})[_0x63e9('0x1f')](function(_0x5c299a){logger['info'](_0x63e9('0x2a'),_0x57b598);logger[_0x63e9('0xf')](_0x63e9('0x2a'),_0x57b598,JSON[_0x63e9('0x11')](_0x5c299a));_0x5b6e70(_0x5c299a);})[_0x63e9('0x26')](function(_0x13f345){logger[_0x63e9('0x12')](_0x63e9('0x2a'),_0x13f345[_0x63e9('0x14')],_0x57b598);_0x401228(_0x3032e7['error'](0x1f4,_0x13f345[_0x63e9('0x14')]));});});};exports['GetContactDialer']=function(_0x2ff815){var _0x4c78dd=this;return new Promise(function(_0x4ed834,_0x26de03){return db['CmContact'][_0x63e9('0x2b')]()['then'](function(_0x3567c2){return db[_0x63e9('0x2c')]['transaction'](function(_0xe00706){return db[_0x63e9('0x21')]['findAll']({'where':_0x2ff815['options']?_0x2ff815[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x2ff815['options']?_0x2ff815['options'][_0x63e9('0x1a')]||null:null,'limit':_0x2ff815['options']?_0x2ff815['options'][_0x63e9('0x1b')]||null:null,'order':_0x2ff815['options']?_0x2ff815[_0x63e9('0x17')][_0x63e9('0x2d')]||null:null,'transaction':_0xe00706,'lock':_0xe00706[_0x63e9('0x2e')][_0x63e9('0x2f')],'include':[{'model':db['CmContact'],'as':_0x63e9('0x30'),'attributes':_[_0x63e9('0x31')](_0x3567c2)},{'model':db[_0x63e9('0x32')],'as':'Agent','attributes':['id','name',_0x63e9('0x33')]}]})[_0x63e9('0x1f')](function(_0x1464eb){var _0x24bc1d=[];var _0x36a74b=[];for(var _0x320c34=0x0;_0x320c34<_0x1464eb['length'];_0x320c34+=0x1){if(!_0x36a74b[_0x63e9('0x34')](_0x1464eb[_0x320c34]['UserId'])){_0x36a74b[_0x63e9('0x35')](_0x1464eb[_0x320c34][_0x63e9('0x36')]);_0x24bc1d['push'](_0x1464eb[_0x320c34][_0x63e9('0x27')](_0x2ff815[_0x63e9('0x25')],{'transaction':_0xe00706}));}}return BPromise[_0x63e9('0x37')](_0x24bc1d);});})[_0x63e9('0x1f')](function(_0x83e14d){logger[_0x63e9('0xc')](_0x63e9('0x38'),_0x2ff815);logger[_0x63e9('0xf')](_0x63e9('0x38'),_0x2ff815,JSON[_0x63e9('0x11')](_0x83e14d));_0x4ed834(_0x83e14d);})[_0x63e9('0x26')](function(_0x6bf8df){logger[_0x63e9('0x12')](_0x63e9('0x38'),_0x6bf8df[_0x63e9('0x14')],_0x2ff815);_0x26de03(_0x4c78dd[_0x63e9('0x12')](0x1f4,_0x6bf8df[_0x63e9('0x14')]));});});});};exports[_0x63e9('0x39')]=function(_0x294070){var _0x54b454=this;return new Promise(function(_0x2f98c9,_0x40867e){return db[_0x63e9('0x2c')][_0x63e9('0x3a')](function(_0x2b1a27){return db['CmHopperFinal'][_0x63e9('0x24')](_0x294070[_0x63e9('0x25')],{'raw':_0x294070[_0x63e9('0x17')]?_0x294070['options'][_0x63e9('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2b1a27})[_0x63e9('0x1f')](function(){return db[_0x63e9('0x21')][_0x63e9('0x29')]({'where':_0x294070['options']?_0x294070[_0x63e9('0x17')]['where']||null:null,'transaction':_0x2b1a27});});})[_0x63e9('0x1f')](function(_0x544fc3){logger['info'](_0x63e9('0x39'),_0x294070);logger[_0x63e9('0xf')](_0x63e9('0x39'),_0x294070,JSON[_0x63e9('0x11')](_0x544fc3));_0x2f98c9(_0x544fc3);})[_0x63e9('0x26')](function(_0x32f514){logger[_0x63e9('0x12')](_0x63e9('0x39'),_0x32f514['message'],_0x294070);_0x40867e(_0x54b454['error'](0x1f4,_0x32f514[_0x63e9('0x14')]));});});};exports[_0x63e9('0x3b')]=function(_0x51b6d4){var _0xc5d8df=this;return new Promise(function(_0x5edc4e,_0x27efae){return db[_0x63e9('0x21')][_0x63e9('0x3c')]({'raw':_0x51b6d4['options']?_0x51b6d4[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x51b6d4[_0x63e9('0x17')]?_0x51b6d4['options'][_0x63e9('0x19')]||null:null,'attributes':[[db[_0x63e9('0x2c')]['fn'](_0x63e9('0x3d'),db[_0x63e9('0x2c')]['fn']('IF',db['sequelize'][_0x63e9('0x3e')](_0x63e9('0x3f')+util[_0x63e9('0x40')](_0x63e9('0x41'),moment()[_0x63e9('0x40')](_0x63e9('0x42')))+'\x20,\x201,\x20null'))),_0x63e9('0x43')]]})[_0x63e9('0x1f')](function(_0x4dd2cd){logger[_0x63e9('0xc')](_0x63e9('0x3b'),_0x51b6d4);logger['debug'](_0x63e9('0x3b'),_0x51b6d4,JSON['stringify'](_0x4dd2cd));_0x5edc4e(_0x4dd2cd);})[_0x63e9('0x26')](function(_0x3e6fa3){logger[_0x63e9('0x12')](_0x63e9('0x3b'),_0x3e6fa3[_0x63e9('0x14')],_0x51b6d4);_0x27efae(_0xc5d8df[_0x63e9('0x12')](0x1f4,_0x3e6fa3[_0x63e9('0x14')]));});});};exports[_0x63e9('0x44')]=function(_0x234d24){var _0x42ce06=this;return new Promise(function(_0x1e6a68,_0x508945){return db[_0x63e9('0x45')][_0x63e9('0x2b')]()[_0x63e9('0x1f')](function(_0x4bfd11){return db['sequelize']['transaction'](function(_0x56a279){return db[_0x63e9('0x21')][_0x63e9('0x3c')]({'where':_0x234d24[_0x63e9('0x17')]?_0x234d24[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x234d24['options']?_0x234d24[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':0x1,'order':_0x234d24[_0x63e9('0x17')]?_0x234d24[_0x63e9('0x17')]['order']||null:null,'group':db['CmHopper'][_0x63e9('0x36')],'transaction':_0x56a279,'lock':_0x56a279[_0x63e9('0x2e')]['UPDATE'],'include':_0x234d24['options']?_0x234d24[_0x63e9('0x17')][_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x234d24[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x3cf149){return{'model':db[_0x3cf149[_0x63e9('0x1e')]],'as':_0x3cf149['as'],'attributes':_0x3cf149[_0x63e9('0x1a')],'include':_0x3cf149['include']?_['map'](_0x3cf149['include'],function(_0x2125c3){return{'model':db[_0x2125c3['model']],'as':_0x2125c3['as'],'attributes':_0x2125c3[_0x63e9('0x1a')],'include':_0x2125c3[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x2125c3[_0x63e9('0x1c')],function(_0x4b331f){return{'model':db[_0x4b331f[_0x63e9('0x1e')]],'as':_0x4b331f['as'],'attributes':_0x4b331f[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x1f')](function(_0x566ec9){var _0xb836fd=[];for(var _0x52d4da=0x0;_0x52d4da<_0x566ec9['length'];_0x52d4da+=0x1){_0xb836fd[_0x63e9('0x35')](_0x566ec9[_0x52d4da][_0x63e9('0x27')](_0x234d24[_0x63e9('0x25')],{'transaction':_0x56a279}));}return BPromise[_0x63e9('0x37')](_0xb836fd);});})[_0x63e9('0x1f')](function(_0x3d5875){logger[_0x63e9('0xc')](_0x63e9('0x44'),_0x234d24);logger['debug'](_0x63e9('0x44'),_0x234d24,JSON[_0x63e9('0x11')](_0x3d5875));_0x1e6a68(_0x3d5875);})['catch'](function(_0x501e39){logger['error'](_0x63e9('0x44'),_0x501e39[_0x63e9('0x14')],_0x234d24);_0x508945(_0x42ce06['error'](0x1f4,_0x501e39[_0x63e9('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x1a0cb2){var _0x1aa92e=this;return new Promise(function(_0x4fa4e7,_0x2c7add){db[_0x63e9('0x45')]['describe']()[_0x63e9('0x1f')](function(_0x5f3e7c){return db[_0x63e9('0x21')]['findAll']({'raw':_0x1a0cb2[_0x63e9('0x17')]?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x1a0cb2['options']?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x1a0cb2[_0x63e9('0x17')]?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':_0x1a0cb2[_0x63e9('0x17')]?_0x1a0cb2['options'][_0x63e9('0x1b')]||null:null,'include':_0x1a0cb2['options']?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x54472b){return{'model':db[_0x54472b[_0x63e9('0x1e')]],'as':_0x54472b['as'],'attributes':_0x54472b['as']===_0x63e9('0x30')?_[_0x63e9('0x31')](_0x5f3e7c):_0x54472b[_0x63e9('0x1a')],'include':_0x54472b[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x54472b[_0x63e9('0x1c')],function(_0x16cd41){return{'model':db[_0x16cd41[_0x63e9('0x1e')]],'as':_0x16cd41['as'],'attributes':_0x16cd41[_0x63e9('0x1a')],'include':_0x16cd41['include']?_[_0x63e9('0x1d')](_0x16cd41['include'],function(_0x2f07a2){return{'model':db[_0x2f07a2[_0x63e9('0x1e')]],'as':_0x2f07a2['as'],'attributes':_0x2f07a2[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x430684){logger['info'](_0x63e9('0x16'),_0x1a0cb2);logger['debug']('GetCmHopper',_0x1a0cb2,JSON[_0x63e9('0x11')](_0x430684));_0x4fa4e7(_0x430684);})[_0x63e9('0x26')](function(_0x1f0c05){logger[_0x63e9('0x12')](_0x63e9('0x16'),_0x1f0c05['message'],_0x1a0cb2);_0x2c7add(_0x1aa92e[_0x63e9('0x12')](0x1f4,_0x1f0c05[_0x63e9('0x14')]));});});});}; \ No newline at end of file +var _0xebc9=['CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','includes','UserId','push','update','all','GetContactDialer','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','options','raw','where','limit','include','map','attributes','model','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','destroy'];(function(_0x961b28,_0x1fdbaa){var _0x477083=function(_0x36bbee){while(--_0x36bbee){_0x961b28['push'](_0x961b28['shift']());}};_0x477083(++_0x1fdbaa);}(_0xebc9,0x13f));var _0x9ebc=function(_0x3ebf81,_0x6de20b){_0x3ebf81=_0x3ebf81-0x0;var _0x188fd9=_0xebc9[_0x3ebf81];return _0x188fd9;};'use strict';var _=require(_0x9ebc('0x0'));var util=require(_0x9ebc('0x1'));var moment=require(_0x9ebc('0x2'));var BPromise=require(_0x9ebc('0x3'));var rs=require(_0x9ebc('0x4'));var fs=require('fs');var Redis=require(_0x9ebc('0x5'));var db=require(_0x9ebc('0x6'))['db'];var utils=require(_0x9ebc('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9ebc('0x8'));var jayson=require(_0x9ebc('0x9'));var client=jayson['client'][_0x9ebc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f11fa,_0x6ef706,_0x435622){return new BPromise(function(_0x5a1284,_0x16f091){return client[_0x9ebc('0xb')](_0x6f11fa,_0x435622)[_0x9ebc('0xc')](function(_0x2ce535){logger[_0x9ebc('0xd')](_0x9ebc('0xe'),_0x6ef706,_0x9ebc('0xf'));logger[_0x9ebc('0x10')](_0x9ebc('0x11'),_0x6ef706,_0x9ebc('0xf'),JSON[_0x9ebc('0x12')](_0x2ce535));if(_0x2ce535['error']){if(_0x2ce535['error']['code']===0x1f4){logger[_0x9ebc('0x13')](_0x9ebc('0xe'),_0x6ef706,_0x2ce535[_0x9ebc('0x13')][_0x9ebc('0x14')]);return _0x16f091(_0x2ce535[_0x9ebc('0x13')][_0x9ebc('0x14')]);}logger[_0x9ebc('0x13')](_0x9ebc('0xe'),_0x6ef706,_0x2ce535['error']['message']);return _0x5a1284(_0x2ce535[_0x9ebc('0x13')][_0x9ebc('0x14')]);}else{logger[_0x9ebc('0xd')](_0x9ebc('0xe'),_0x6ef706,_0x9ebc('0xf'));_0x5a1284(_0x2ce535[_0x9ebc('0x15')][_0x9ebc('0x14')]);}})[_0x9ebc('0x16')](function(_0x374463){logger['error'](_0x9ebc('0xe'),_0x6ef706,_0x374463);_0x16f091(_0x374463);});});}exports[_0x9ebc('0x17')]=function(_0x5c60ba){var _0x1fa07e=this;return new Promise(function(_0x5de17a,_0x38c4b5){return db[_0x9ebc('0x18')]['findAll']({'raw':_0x5c60ba[_0x9ebc('0x19')]?_0x5c60ba[_0x9ebc('0x19')][_0x9ebc('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c60ba[_0x9ebc('0x19')]?_0x5c60ba['options'][_0x9ebc('0x1b')]||null:null,'attributes':_0x5c60ba[_0x9ebc('0x19')]?_0x5c60ba['options']['attributes']||null:null,'limit':_0x5c60ba[_0x9ebc('0x19')]?_0x5c60ba[_0x9ebc('0x19')][_0x9ebc('0x1c')]||null:null,'include':_0x5c60ba[_0x9ebc('0x19')]?_0x5c60ba[_0x9ebc('0x19')][_0x9ebc('0x1d')]?_[_0x9ebc('0x1e')](_0x5c60ba[_0x9ebc('0x19')][_0x9ebc('0x1d')],function(_0x18301e){return{'model':db[_0x18301e['model']],'as':_0x18301e['as'],'attributes':_0x18301e['attributes'],'include':_0x18301e[_0x9ebc('0x1d')]?_[_0x9ebc('0x1e')](_0x18301e['include'],function(_0x476436){return{'model':db[_0x476436['model']],'as':_0x476436['as'],'attributes':_0x476436[_0x9ebc('0x1f')],'include':_0x476436[_0x9ebc('0x1d')]?_['map'](_0x476436[_0x9ebc('0x1d')],function(_0x57395a){return{'model':db[_0x57395a[_0x9ebc('0x20')]],'as':_0x57395a['as'],'attributes':_0x57395a[_0x9ebc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9ebc('0xc')](function(_0x194a03){logger['info'](_0x9ebc('0x17'),_0x5c60ba);logger[_0x9ebc('0x10')](_0x9ebc('0x17'),_0x5c60ba,JSON[_0x9ebc('0x12')](_0x194a03));_0x5de17a(_0x194a03);})['catch'](function(_0x2d89b3){logger['error'](_0x9ebc('0x17'),_0x2d89b3[_0x9ebc('0x14')],_0x5c60ba);_0x38c4b5(_0x1fa07e['error'](0x1f4,_0x2d89b3['message']));});});};exports[_0x9ebc('0x21')]=function(_0x2f6adc){var _0x5494be=this;return new Promise(function(_0x2698fe,_0x68131b){return db[_0x9ebc('0x18')][_0x9ebc('0x22')]({'raw':_0x2f6adc['options']?_0x2f6adc[_0x9ebc('0x19')][_0x9ebc('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f6adc[_0x9ebc('0x19')]?_0x2f6adc['options'][_0x9ebc('0x1b')]||null:null,'attributes':_0x2f6adc[_0x9ebc('0x19')]?_0x2f6adc[_0x9ebc('0x19')]['attributes']||null:null,'include':_0x2f6adc[_0x9ebc('0x19')]?_0x2f6adc[_0x9ebc('0x19')]['include']?_[_0x9ebc('0x1e')](_0x2f6adc[_0x9ebc('0x19')][_0x9ebc('0x1d')],function(_0x1744e8){return{'model':db[_0x1744e8['model']],'as':_0x1744e8['as'],'attributes':_0x1744e8[_0x9ebc('0x1f')],'include':_0x1744e8[_0x9ebc('0x1d')]?_[_0x9ebc('0x1e')](_0x1744e8[_0x9ebc('0x1d')],function(_0x4a727a){return{'model':db[_0x4a727a[_0x9ebc('0x20')]],'as':_0x4a727a['as'],'attributes':_0x4a727a['attributes'],'include':_0x4a727a[_0x9ebc('0x1d')]?_[_0x9ebc('0x1e')](_0x4a727a['include'],function(_0x5968c4){return{'model':db[_0x5968c4[_0x9ebc('0x20')]],'as':_0x5968c4['as'],'attributes':_0x5968c4[_0x9ebc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18f5e2){logger[_0x9ebc('0xd')](_0x9ebc('0x21'),_0x2f6adc);logger[_0x9ebc('0x10')](_0x9ebc('0x21'),_0x2f6adc,JSON[_0x9ebc('0x12')](_0x18f5e2));_0x2698fe(_0x18f5e2);})[_0x9ebc('0x16')](function(_0x4714c4){logger['error'](_0x9ebc('0x21'),_0x4714c4[_0x9ebc('0x14')],_0x2f6adc);_0x68131b(_0x5494be['error'](0x1f4,_0x4714c4[_0x9ebc('0x14')]));});});};exports[_0x9ebc('0x23')]=function(_0x5a15ff){var _0x43379d=this;return new Promise(function(_0x3c2662,_0x19dee2){return db[_0x9ebc('0x18')][_0x9ebc('0x24')](_0x5a15ff['body'],{'raw':_0x5a15ff[_0x9ebc('0x19')]?_0x5a15ff[_0x9ebc('0x19')][_0x9ebc('0x1a')]===undefined?!![]:![]:!![]})[_0x9ebc('0xc')](function(_0x4c02a9){logger['info']('CreateCmHopper',_0x5a15ff);logger[_0x9ebc('0x10')]('CreateCmHopper',_0x5a15ff,JSON[_0x9ebc('0x12')](_0x4c02a9));_0x3c2662(_0x4c02a9);})[_0x9ebc('0x16')](function(_0x5a9659){logger[_0x9ebc('0x13')](_0x9ebc('0x23'),_0x5a9659[_0x9ebc('0x14')],_0x5a15ff);_0x19dee2(_0x43379d[_0x9ebc('0x13')](0x1f4,_0x5a9659[_0x9ebc('0x14')]));});});};exports['UpdateCmHopper']=function(_0x232989){var _0x514d9e=this;return new Promise(function(_0x255db2,_0xbf1bf0){return db['CmHopper']['update'](_0x232989[_0x9ebc('0x25')],{'raw':_0x232989[_0x9ebc('0x19')]?_0x232989[_0x9ebc('0x19')][_0x9ebc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x232989['options']?_0x232989['options']['where']||null:null,'attributes':_0x232989[_0x9ebc('0x19')]?_0x232989[_0x9ebc('0x19')][_0x9ebc('0x1f')]||null:null,'limit':_0x232989[_0x9ebc('0x19')]?_0x232989[_0x9ebc('0x19')][_0x9ebc('0x1c')]||null:null})[_0x9ebc('0xc')](function(_0x44f1a4){logger[_0x9ebc('0xd')](_0x9ebc('0x26'),_0x232989);logger['debug'](_0x9ebc('0x26'),_0x232989,JSON[_0x9ebc('0x12')](_0x44f1a4));_0x255db2(_0x44f1a4);})[_0x9ebc('0x16')](function(_0x65cab0){logger['error'](_0x9ebc('0x26'),_0x65cab0[_0x9ebc('0x14')],_0x232989);_0xbf1bf0(_0x514d9e[_0x9ebc('0x13')](0x1f4,_0x65cab0[_0x9ebc('0x14')]));});});};exports[_0x9ebc('0x27')]=function(_0x22297b){var _0x3e0f9d=this;return new Promise(function(_0x44bd52,_0x3ad249){return db['CmHopper'][_0x9ebc('0x28')]({'where':_0x22297b[_0x9ebc('0x19')]?_0x22297b['options'][_0x9ebc('0x1b')]||null:null})[_0x9ebc('0xc')](function(_0x155467){logger[_0x9ebc('0xd')](_0x9ebc('0x27'),_0x22297b);logger[_0x9ebc('0x10')](_0x9ebc('0x27'),_0x22297b,JSON[_0x9ebc('0x12')](_0x155467));_0x44bd52(_0x155467);})[_0x9ebc('0x16')](function(_0x13593a){logger[_0x9ebc('0x13')](_0x9ebc('0x27'),_0x13593a[_0x9ebc('0x14')],_0x22297b);_0x3ad249(_0x3e0f9d[_0x9ebc('0x13')](0x1f4,_0x13593a[_0x9ebc('0x14')]));});});};exports['GetContactDialer']=function(_0x260110){var _0x63e0b0=this;return new Promise(function(_0x46a1eb,_0x2fec1f){return db[_0x9ebc('0x29')][_0x9ebc('0x2a')]()[_0x9ebc('0xc')](function(_0x236ce3){return db[_0x9ebc('0x2b')][_0x9ebc('0x2c')](function(_0x4de0e5){return db['CmHopper'][_0x9ebc('0x2d')]({'where':_0x260110[_0x9ebc('0x19')]?_0x260110[_0x9ebc('0x19')][_0x9ebc('0x1b')]||null:null,'attributes':_0x260110[_0x9ebc('0x19')]?_0x260110[_0x9ebc('0x19')][_0x9ebc('0x1f')]||null:null,'limit':_0x260110[_0x9ebc('0x19')]?_0x260110[_0x9ebc('0x19')][_0x9ebc('0x1c')]||null:null,'order':_0x260110[_0x9ebc('0x19')]?_0x260110[_0x9ebc('0x19')][_0x9ebc('0x2e')]||null:null,'transaction':_0x4de0e5,'lock':_0x4de0e5[_0x9ebc('0x2f')][_0x9ebc('0x30')],'include':[{'model':db[_0x9ebc('0x29')],'as':_0x9ebc('0x31'),'attributes':_[_0x9ebc('0x32')](_0x236ce3)},{'model':db[_0x9ebc('0x33')],'as':_0x9ebc('0x34'),'attributes':['id',_0x9ebc('0x35'),_0x9ebc('0x36')]}]})[_0x9ebc('0xc')](function(_0x4219ce){var _0x24517e=[];var _0x403c53=[];for(var _0x1af787=0x0;_0x1af787<_0x4219ce[_0x9ebc('0x37')];_0x1af787+=0x1){if(!_0x403c53[_0x9ebc('0x38')](_0x4219ce[_0x1af787]['UserId'])){_0x403c53['push'](_0x4219ce[_0x1af787][_0x9ebc('0x39')]);_0x24517e[_0x9ebc('0x3a')](_0x4219ce[_0x1af787][_0x9ebc('0x3b')](_0x260110[_0x9ebc('0x25')],{'transaction':_0x4de0e5}));}}return BPromise[_0x9ebc('0x3c')](_0x24517e);});})[_0x9ebc('0xc')](function(_0x5a11ab){logger[_0x9ebc('0xd')]('GetContactDialer',_0x260110);logger[_0x9ebc('0x10')]('GetContactDialer',_0x260110,JSON['stringify'](_0x5a11ab));_0x46a1eb(_0x5a11ab);})['catch'](function(_0x24984f){logger[_0x9ebc('0x13')](_0x9ebc('0x3d'),_0x24984f[_0x9ebc('0x14')],_0x260110);_0x2fec1f(_0x63e0b0[_0x9ebc('0x13')](0x1f4,_0x24984f[_0x9ebc('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x184ef6){var _0x177274=this;return new Promise(function(_0x3b564d,_0x19b3fa){return db[_0x9ebc('0x2b')][_0x9ebc('0x2c')](function(_0xd15fe6){return db['CmHopperFinal']['create'](_0x184ef6['body'],{'raw':_0x184ef6['options']?_0x184ef6['options'][_0x9ebc('0x1a')]===undefined?!![]:![]:!![],'transaction':_0xd15fe6})[_0x9ebc('0xc')](function(){return db['CmHopper']['destroy']({'where':_0x184ef6[_0x9ebc('0x19')]?_0x184ef6[_0x9ebc('0x19')][_0x9ebc('0x1b')]||null:null,'transaction':_0xd15fe6});});})[_0x9ebc('0xc')](function(_0x3d818b){logger[_0x9ebc('0xd')](_0x9ebc('0x3e'),_0x184ef6);logger[_0x9ebc('0x10')](_0x9ebc('0x3e'),_0x184ef6,JSON['stringify'](_0x3d818b));_0x3b564d(_0x3d818b);})['catch'](function(_0x22c29c){logger['error'](_0x9ebc('0x3e'),_0x22c29c[_0x9ebc('0x14')],_0x184ef6);_0x19b3fa(_0x177274[_0x9ebc('0x13')](0x1f4,_0x22c29c[_0x9ebc('0x14')]));});});};exports[_0x9ebc('0x3f')]=function(_0x1c33bb){var _0x336dd9=this;return new Promise(function(_0x161957,_0xe7d318){return db[_0x9ebc('0x18')][_0x9ebc('0x2d')]({'raw':_0x1c33bb[_0x9ebc('0x19')]?_0x1c33bb[_0x9ebc('0x19')][_0x9ebc('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c33bb['options']?_0x1c33bb[_0x9ebc('0x19')]['where']||null:null,'attributes':[[db[_0x9ebc('0x2b')]['fn'](_0x9ebc('0x40'),db[_0x9ebc('0x2b')]['fn']('IF',db[_0x9ebc('0x2b')]['literal'](_0x9ebc('0x41')+util[_0x9ebc('0x42')](_0x9ebc('0x43'),moment()[_0x9ebc('0x42')](_0x9ebc('0x44')))+_0x9ebc('0x45')))),_0x9ebc('0x46')]]})['then'](function(_0x3e05a3){logger[_0x9ebc('0xd')](_0x9ebc('0x3f'),_0x1c33bb);logger[_0x9ebc('0x10')](_0x9ebc('0x3f'),_0x1c33bb,JSON[_0x9ebc('0x12')](_0x3e05a3));_0x161957(_0x3e05a3);})['catch'](function(_0x342896){logger[_0x9ebc('0x13')](_0x9ebc('0x3f'),_0x342896[_0x9ebc('0x14')],_0x1c33bb);_0xe7d318(_0x336dd9[_0x9ebc('0x13')](0x1f4,_0x342896[_0x9ebc('0x14')]));});});};exports[_0x9ebc('0x47')]=function(_0x23c629){var _0x1170b=this;return new Promise(function(_0x5b009d,_0x15ca50){return db[_0x9ebc('0x29')][_0x9ebc('0x2a')]()[_0x9ebc('0xc')](function(_0x2a5515){return db['sequelize'][_0x9ebc('0x2c')](function(_0x5f33f0){return db[_0x9ebc('0x18')]['findAll']({'where':_0x23c629['options']?_0x23c629[_0x9ebc('0x19')][_0x9ebc('0x1b')]||null:null,'attributes':_0x23c629['options']?_0x23c629['options']['attributes']||null:null,'limit':0x1,'order':_0x23c629['options']?_0x23c629[_0x9ebc('0x19')][_0x9ebc('0x2e')]||null:null,'group':db[_0x9ebc('0x18')][_0x9ebc('0x39')],'transaction':_0x5f33f0,'lock':_0x5f33f0[_0x9ebc('0x2f')][_0x9ebc('0x30')],'include':_0x23c629['options']?_0x23c629[_0x9ebc('0x19')]['include']?_['map'](_0x23c629[_0x9ebc('0x19')][_0x9ebc('0x1d')],function(_0x41b743){return{'model':db[_0x41b743['model']],'as':_0x41b743['as'],'attributes':_0x41b743[_0x9ebc('0x1f')],'include':_0x41b743[_0x9ebc('0x1d')]?_['map'](_0x41b743[_0x9ebc('0x1d')],function(_0x3b528d){return{'model':db[_0x3b528d[_0x9ebc('0x20')]],'as':_0x3b528d['as'],'attributes':_0x3b528d[_0x9ebc('0x1f')],'include':_0x3b528d['include']?_[_0x9ebc('0x1e')](_0x3b528d[_0x9ebc('0x1d')],function(_0x4a2575){return{'model':db[_0x4a2575[_0x9ebc('0x20')]],'as':_0x4a2575['as'],'attributes':_0x4a2575[_0x9ebc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f2fb4){var _0x529b37=[];for(var _0x227931=0x0;_0x227931<_0x2f2fb4[_0x9ebc('0x37')];_0x227931+=0x1){_0x529b37[_0x9ebc('0x3a')](_0x2f2fb4[_0x227931][_0x9ebc('0x3b')](_0x23c629['body'],{'transaction':_0x5f33f0}));}return BPromise[_0x9ebc('0x3c')](_0x529b37);});})['then'](function(_0xf71703){logger[_0x9ebc('0xd')](_0x9ebc('0x47'),_0x23c629);logger[_0x9ebc('0x10')](_0x9ebc('0x47'),_0x23c629,JSON[_0x9ebc('0x12')](_0xf71703));_0x5b009d(_0xf71703);})[_0x9ebc('0x16')](function(_0x30edb9){logger['error'](_0x9ebc('0x47'),_0x30edb9[_0x9ebc('0x14')],_0x23c629);_0x15ca50(_0x1170b[_0x9ebc('0x13')](0x1f4,_0x30edb9[_0x9ebc('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x582c45){var _0x293b4d=this;return new Promise(function(_0x50821a,_0x5002db){db[_0x9ebc('0x29')]['describe']()['then'](function(_0x4c9b3a){return db[_0x9ebc('0x18')][_0x9ebc('0x2d')]({'raw':_0x582c45['options']?_0x582c45['options'][_0x9ebc('0x1a')]===undefined?!![]:![]:!![],'where':_0x582c45[_0x9ebc('0x19')]?_0x582c45[_0x9ebc('0x19')]['where']||null:null,'attributes':_0x582c45[_0x9ebc('0x19')]?_0x582c45[_0x9ebc('0x19')][_0x9ebc('0x1f')]||null:null,'limit':_0x582c45[_0x9ebc('0x19')]?_0x582c45['options']['limit']||null:null,'include':_0x582c45[_0x9ebc('0x19')]?_0x582c45['options'][_0x9ebc('0x1d')]?_['map'](_0x582c45[_0x9ebc('0x19')][_0x9ebc('0x1d')],function(_0x2566e0){return{'model':db[_0x2566e0['model']],'as':_0x2566e0['as'],'attributes':_0x2566e0['as']==='Contact'?_['keys'](_0x4c9b3a):_0x2566e0[_0x9ebc('0x1f')],'include':_0x2566e0[_0x9ebc('0x1d')]?_[_0x9ebc('0x1e')](_0x2566e0[_0x9ebc('0x1d')],function(_0xb22dc0){return{'model':db[_0xb22dc0[_0x9ebc('0x20')]],'as':_0xb22dc0['as'],'attributes':_0xb22dc0[_0x9ebc('0x1f')],'include':_0xb22dc0[_0x9ebc('0x1d')]?_[_0x9ebc('0x1e')](_0xb22dc0[_0x9ebc('0x1d')],function(_0x8e7862){return{'model':db[_0x8e7862['model']],'as':_0x8e7862['as'],'attributes':_0x8e7862[_0x9ebc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e529a){logger[_0x9ebc('0xd')](_0x9ebc('0x17'),_0x582c45);logger[_0x9ebc('0x10')](_0x9ebc('0x17'),_0x582c45,JSON[_0x9ebc('0x12')](_0x2e529a));_0x50821a(_0x2e529a);})['catch'](function(_0x591225){logger[_0x9ebc('0x13')]('GetCmHopper',_0x591225[_0x9ebc('0x14')],_0x582c45);_0x5002db(_0x293b4d[_0x9ebc('0x13')](0x1f4,_0x591225[_0x9ebc('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9144519..95ac551 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/opencontacts','/:id','post','/preview','getPreview'];(function(_0x40b3a5,_0x1dac63){var _0x573076=function(_0x28cb05){while(--_0x28cb05){_0x40b3a5['push'](_0x40b3a5['shift']());}};_0x573076(++_0x1dac63);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24c970,_0x1199ef){_0x24c970=_0x24c970-0x0;var _0x48f700=_0x5f2f[_0x24c970];return _0x48f700;};'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('./cmHopper.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['getOpenContacts']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5f2('0xe')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x7fee=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','get','/describe','describe','/opencontacts','post','/preview','put','/:id'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7fee[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var path=require(_0xe7fe('0x2'));var timeout=require(_0xe7fe('0x3'));var express=require(_0xe7fe('0x4'));var router=express[_0xe7fe('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7fe('0x6'));var config=require(_0xe7fe('0x7'));var controller=require(_0xe7fe('0x8'));router['get']('/',auth[_0xe7fe('0x9')](),controller['index']);router[_0xe7fe('0xa')](_0xe7fe('0xb'),auth[_0xe7fe('0x9')](),controller[_0xe7fe('0xc')]);router[_0xe7fe('0xa')](_0xe7fe('0xd'),auth[_0xe7fe('0x9')](),controller['getOpenContacts']);router['get']('/:id',auth[_0xe7fe('0x9')](),controller['show']);router[_0xe7fe('0xe')]('/',auth[_0xe7fe('0x9')](),controller['create']);router['post'](_0xe7fe('0xf'),auth[_0xe7fe('0x9')](),controller['getPreview']);router[_0xe7fe('0x10')](_0xe7fe('0x11'),auth[_0xe7fe('0x9')](),controller['update']);router[_0xe7fe('0x12')](_0xe7fe('0x11'),auth[_0xe7fe('0x9')](),controller['destroy']);module[_0xe7fe('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 75e4608..28200e9 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 _0x9ea6=['exports','INTEGER','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x43a6e0,_0x1de407){var _0x4109f7=function(_0x176b86){while(--_0x176b86){_0x43a6e0['push'](_0x43a6e0['shift']());}};_0x4109f7(++_0x1de407);}(_0x9ea6,0x9b));var _0x69ea=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9ea6[_0x465a0c];return _0x1e202e;};'use strict';var moment=require(_0x69ea('0x0'));var Sequelize=require('sequelize');module[_0x69ea('0x1')]={'CmHopperId':{'type':Sequelize[_0x69ea('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x69ea('0x3'))},'countbusyretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x233a=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','DATE','format'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x233a,0xcc));var _0xa233=function(_0x1f1eb9,_0x57483f){_0x1f1eb9=_0x1f1eb9-0x0;var _0x35d155=_0x233a[_0x1f1eb9];return _0x35d155;};'use strict';var moment=require(_0xa233('0x0'));var Sequelize=require(_0xa233('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xa233('0x2')]},'phone':{'type':Sequelize[_0xa233('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa233('0x4')],'defaultValue':moment()[_0xa233('0x5')](_0xa233('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa233('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index cc0e52a..16456f3 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 _0x5398=['../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5398,0xe2));var _0x8539=function(_0x3aaf82,_0x2982e4){_0x3aaf82=_0x3aaf82-0x0;var _0x2ee54f=_0x5398[_0x3aaf82];return _0x2ee54f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8539('0x0'));var rimraf=require(_0x8539('0x1'));var zipdir=require(_0x8539('0x2'));var jsonpatch=require(_0x8539('0x3'));var rp=require(_0x8539('0x4'));var moment=require(_0x8539('0x5'));var BPromise=require(_0x8539('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8539('0x7'));var sox=require(_0x8539('0x8'));var csv=require(_0x8539('0x9'));var ejs=require(_0x8539('0xa'));var fs=require('fs');var _=require(_0x8539('0xb'));var squel=require(_0x8539('0xc'));var crypto=require('crypto');var jsforce=require(_0x8539('0xd'));var deskjs=require(_0x8539('0xe'));var toCsv=require(_0x8539('0x9'));var querystring=require(_0x8539('0xf'));var Papa=require(_0x8539('0x10'));var Redis=require(_0x8539('0x11'));var authService=require(_0x8539('0x12'));var qs=require(_0x8539('0x13'));var as=require(_0x8539('0x14'));var hardwareService=require(_0x8539('0x15'));var logger=require('../../config/logger')(_0x8539('0x16'));var utils=require(_0x8539('0x17'));var config=require(_0x8539('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8539('0x19'))['db'];function respondWithStatusCode(_0x377b14,_0x4d841){_0x4d841=_0x4d841||0xcc;return function(_0x25462b){if(_0x25462b){return _0x377b14['sendStatus'](_0x4d841);}return _0x377b14['status'](_0x4d841)[_0x8539('0x1a')]();};}function respondWithResult(_0x19ec7e,_0x8d56c9){_0x8d56c9=_0x8d56c9||0xc8;return function(_0x216bce){if(_0x216bce){return _0x19ec7e[_0x8539('0x1b')](_0x8d56c9)['json'](_0x216bce);}};}function respondWithFilteredResult(_0x52b95b,_0x27e479){return function(_0x24aab1){if(_0x24aab1){var _0x334def=_0x24aab1[_0x8539('0x1c')],_0x1d30e2=_0x27e479['offset'],_0x159008=_0x27e479[_0x8539('0x1d')]+_0x27e479['limit'],_0x29bf43;if(_0x159008>=_0x334def){_0x159008=_0x334def;_0x29bf43=0xc8;}else{_0x29bf43=0xce;}_0x52b95b['status'](_0x29bf43);return _0x52b95b['set'](_0x8539('0x1e'),_0x1d30e2+'-'+_0x159008+'/'+_0x334def)[_0x8539('0x1f')](_0x24aab1);}return null;};}function patchUpdates(_0x7b65df){return function(_0x260a2c){try{jsonpatch[_0x8539('0x20')](_0x260a2c,_0x7b65df,!![]);}catch(_0x324850){return BPromise[_0x8539('0x21')](_0x324850);}return _0x260a2c[_0x8539('0x22')]();};}function saveUpdates(_0x1cce5a,_0x3360b1){return function(_0x528839){if(_0x528839){return _0x528839[_0x8539('0x23')](_0x1cce5a)['then'](function(_0x3b0e38){return _0x3b0e38;});}return null;};}function removeEntity(_0x56e1b7,_0x14befc){return function(_0x59a14e){if(_0x59a14e){return _0x59a14e[_0x8539('0x24')]()[_0x8539('0x25')](function(){var _0xa3cf26=_0x59a14e[_0x8539('0x26')]({'plain':!![]});var _0x28e1da=_0x8539('0x27');return db[_0x8539('0x28')]['destroy']({'where':{'type':_0x28e1da,'resourceId':_0xa3cf26['id']}})[_0x8539('0x25')](function(){return _0x59a14e;});})['then'](function(){_0x56e1b7['status'](0xcc)[_0x8539('0x1a')]();});}};}function handleEntityNotFound(_0x28792d,_0x2f52cc){return function(_0x20d902){if(!_0x20d902){_0x28792d['sendStatus'](0x194);}return _0x20d902;};}function handleError(_0x4f04e8,_0x600cb6){_0x600cb6=_0x600cb6||0x1f4;return function(_0x327fc9){logger['error'](_0x327fc9[_0x8539('0x29')]);if(_0x327fc9[_0x8539('0x2a')]){delete _0x327fc9[_0x8539('0x2a')];}_0x4f04e8[_0x8539('0x1b')](_0x600cb6)[_0x8539('0x2b')](_0x327fc9);};}exports[_0x8539('0x2c')]=function(_0x452700,_0x60346c){var _0x2a6fba={},_0xedb079={},_0x438a5b={'count':0x0,'rows':[]};var _0x1ae9b9=_[_0x8539('0x2d')](db[_0x8539('0x2e')]['rawAttributes'],function(_0x7aae36){return{'name':_0x7aae36[_0x8539('0x2f')],'type':_0x7aae36[_0x8539('0x30')]['key']};});_0xedb079[_0x8539('0x31')]=_[_0x8539('0x2d')](_0x1ae9b9,'name');_0xedb079[_0x8539('0x32')]=_['keys'](_0x452700[_0x8539('0x32')]);_0xedb079[_0x8539('0x33')]=_[_0x8539('0x34')](_0xedb079[_0x8539('0x31')],_0xedb079[_0x8539('0x32')]);_0x2a6fba[_0x8539('0x35')]=_[_0x8539('0x34')](_0xedb079[_0x8539('0x31')],qs[_0x8539('0x36')](_0x452700['query'][_0x8539('0x36')]));_0x2a6fba[_0x8539('0x35')]=_0x2a6fba[_0x8539('0x35')][_0x8539('0x37')]?_0x2a6fba[_0x8539('0x35')]:_0xedb079[_0x8539('0x31')];if(!_0x452700[_0x8539('0x32')][_0x8539('0x38')](_0x8539('0x39'))){_0x2a6fba[_0x8539('0x3a')]=qs['limit'](_0x452700[_0x8539('0x32')]['limit']);_0x2a6fba[_0x8539('0x1d')]=qs[_0x8539('0x1d')](_0x452700['query']['offset']);}_0x2a6fba[_0x8539('0x3b')]=qs[_0x8539('0x3c')](_0x452700[_0x8539('0x32')][_0x8539('0x3c')]);_0x2a6fba['where']=qs['filters'](_['pick'](_0x452700[_0x8539('0x32')],_0xedb079[_0x8539('0x33')]),_0x1ae9b9);if(_0x452700[_0x8539('0x32')][_0x8539('0x3d')]){_0x2a6fba[_0x8539('0x3e')]=_[_0x8539('0x3f')](_0x2a6fba[_0x8539('0x3e')],{'$or':_[_0x8539('0x2d')](_0x1ae9b9,function(_0x931bd7){if(_0x931bd7[_0x8539('0x30')]!==_0x8539('0x40')){var _0x1643c8={};_0x1643c8[_0x931bd7[_0x8539('0x2a')]]={'$like':'%'+_0x452700['query'][_0x8539('0x3d')]+'%'};return _0x1643c8;}})});}_0x2a6fba=_[_0x8539('0x3f')]({},_0x2a6fba,_0x452700[_0x8539('0x41')]);var _0x10232b={'where':_0x2a6fba[_0x8539('0x3e')]};return db[_0x8539('0x2e')][_0x8539('0x1c')](_0x10232b)[_0x8539('0x25')](function(_0x3214e8){_0x438a5b[_0x8539('0x1c')]=_0x3214e8;if(_0x452700[_0x8539('0x32')][_0x8539('0x42')]){_0x2a6fba['include']=[{'all':!![]}];}return db[_0x8539('0x2e')][_0x8539('0x43')](_0x2a6fba);})['then'](function(_0x534202){_0x438a5b[_0x8539('0x44')]=_0x534202;return _0x438a5b;})['then'](respondWithFilteredResult(_0x60346c,_0x2a6fba))['catch'](handleError(_0x60346c,null));};exports['show']=function(_0x3c9f47,_0x3a69cc){var _0x24a388={'raw':!![],'where':{'id':_0x3c9f47[_0x8539('0x45')]['id']}},_0x26145b={};_0x26145b['model']=_[_0x8539('0x46')](db['CmHopperAdditionalPhone'][_0x8539('0x47')]);_0x26145b[_0x8539('0x32')]=_[_0x8539('0x46')](_0x3c9f47[_0x8539('0x32')]);_0x26145b['filters']=_[_0x8539('0x34')](_0x26145b[_0x8539('0x31')],_0x26145b[_0x8539('0x32')]);_0x24a388[_0x8539('0x35')]=_[_0x8539('0x34')](_0x26145b[_0x8539('0x31')],qs[_0x8539('0x36')](_0x3c9f47['query']['fields']));_0x24a388[_0x8539('0x35')]=_0x24a388[_0x8539('0x35')][_0x8539('0x37')]?_0x24a388[_0x8539('0x35')]:_0x26145b[_0x8539('0x31')];if(_0x3c9f47['query'][_0x8539('0x42')]){_0x24a388['include']=[{'all':!![]}];}_0x24a388=_[_0x8539('0x3f')]({},_0x24a388,_0x3c9f47[_0x8539('0x41')]);return db[_0x8539('0x2e')]['find'](_0x24a388)[_0x8539('0x25')](handleEntityNotFound(_0x3a69cc,null))['then'](respondWithResult(_0x3a69cc,null))[_0x8539('0x48')](handleError(_0x3a69cc,null));};exports[_0x8539('0x49')]=function(_0x124524,_0xe3e794){return db[_0x8539('0x2e')][_0x8539('0x49')](_0x124524[_0x8539('0x4a')],{})[_0x8539('0x25')](function(_0x5a81be){var _0x2d11b8=_0x124524[_0x8539('0x4b')]['get']({'plain':!![]});if(!_0x2d11b8)throw new Error(_0x8539('0x4c'));if(_0x2d11b8[_0x8539('0x4d')]===_0x8539('0x4b')){var _0x3814de=_0x5a81be[_0x8539('0x26')]({'plain':!![]});var _0x559c9d=_0x8539('0x27');return db[_0x8539('0x4e')]['find']({'where':{'name':_0x559c9d,'userProfileId':_0x2d11b8[_0x8539('0x4f')]},'raw':!![]})[_0x8539('0x25')](function(_0x2f6cef){if(_0x2f6cef&&_0x2f6cef[_0x8539('0x50')]===0x0){return db[_0x8539('0x28')][_0x8539('0x49')]({'name':_0x3814de[_0x8539('0x2a')],'resourceId':_0x3814de['id'],'type':_0x2f6cef[_0x8539('0x2a')],'sectionId':_0x2f6cef['id']},{})[_0x8539('0x25')](function(){return _0x5a81be;});}else{return _0x5a81be;}})[_0x8539('0x48')](function(_0x2e266d){logger[_0x8539('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e266d);throw _0x2e266d;});}return _0x5a81be;})[_0x8539('0x25')](respondWithResult(_0xe3e794,0xc9))[_0x8539('0x48')](handleError(_0xe3e794,null));};exports[_0x8539('0x23')]=function(_0x47d2bc,_0x41ea0b){if(_0x47d2bc['body']['id']){delete _0x47d2bc['body']['id'];}return db[_0x8539('0x2e')][_0x8539('0x52')]({'where':{'id':_0x47d2bc[_0x8539('0x45')]['id']}})['then'](handleEntityNotFound(_0x41ea0b,null))[_0x8539('0x25')](saveUpdates(_0x47d2bc['body'],null))['then'](respondWithResult(_0x41ea0b,null))[_0x8539('0x48')](handleError(_0x41ea0b,null));};exports[_0x8539('0x24')]=function(_0x2310fe,_0x23acaf){return db[_0x8539('0x2e')]['find']({'where':{'id':_0x2310fe[_0x8539('0x45')]['id']}})[_0x8539('0x25')](handleEntityNotFound(_0x23acaf,null))[_0x8539('0x25')](removeEntity(_0x23acaf,null))['catch'](handleError(_0x23acaf,null));}; \ No newline at end of file +var _0xeff8=['api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','UserProfileSection','find','userProfileId','autoAssociation','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x340625,_0x1deb60){var _0x9f220f=function(_0x303e42){while(--_0x303e42){_0x340625['push'](_0x340625['shift']());}};_0x9f220f(++_0x1deb60);}(_0xeff8,0x186));var _0x8eff=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeff8[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x8eff('0x0'));var emlformat=require(_0x8eff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eff('0x2'));var jsonpatch=require(_0x8eff('0x3'));var rp=require(_0x8eff('0x4'));var moment=require('moment');var BPromise=require(_0x8eff('0x5'));var Mustache=require(_0x8eff('0x6'));var util=require(_0x8eff('0x7'));var path=require(_0x8eff('0x8'));var sox=require('sox');var csv=require(_0x8eff('0x9'));var ejs=require(_0x8eff('0xa'));var fs=require('fs');var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0x9'));var querystring=require(_0x8eff('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x10'));var qs=require(_0x8eff('0x11'));var as=require(_0x8eff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x13'))(_0x8eff('0x14'));var utils=require('../../config/utils');var config=require(_0x8eff('0x15'));var licenseUtil=require(_0x8eff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x17')](_0x45f280);}return _0x4a399e[_0x8eff('0x18')](_0x45f280)[_0x8eff('0x19')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x18')](_0x3e7c01)[_0x8eff('0x1a')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=_0x16202e['count'],_0x16a4eb=_0x4cfc91[_0x8eff('0x1b')],_0x427902=_0x4cfc91[_0x8eff('0x1b')]+_0x4cfc91[_0x8eff('0x1c')],_0x137344;if(_0x427902>=_0xdbb753){_0x427902=_0xdbb753;_0x137344=0xc8;}else{_0x137344=0xce;}_0x228eb1[_0x8eff('0x18')](_0x137344);return _0x228eb1[_0x8eff('0x1d')](_0x8eff('0x1e'),_0x16a4eb+'-'+_0x427902+'/'+_0xdbb753)[_0x8eff('0x1a')](_0x16202e);}return null;};}function patchUpdates(_0x399d96){return function(_0x1b003c){try{jsonpatch[_0x8eff('0x1f')](_0x1b003c,_0x399d96,!![]);}catch(_0x453c7a){return BPromise[_0x8eff('0x20')](_0x453c7a);}return _0x1b003c[_0x8eff('0x21')]();};}function saveUpdates(_0x2a7337,_0xdbb7b5){return function(_0x183a53){if(_0x183a53){return _0x183a53['update'](_0x2a7337)[_0x8eff('0x22')](function(_0x4d3e84){return _0x4d3e84;});}return null;};}function removeEntity(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x23')]()[_0x8eff('0x22')](function(){var _0x1ccc79=_0x5ea31f[_0x8eff('0x24')]({'plain':!![]});var _0x1ee09c='CmHopperAdditionalPhones';return db[_0x8eff('0x25')][_0x8eff('0x23')]({'where':{'type':_0x1ee09c,'resourceId':_0x1ccc79['id']}})['then'](function(){return _0x5ea31f;});})[_0x8eff('0x22')](function(){_0x5a2492[_0x8eff('0x18')](0xcc)[_0x8eff('0x19')]();});}};}function handleEntityNotFound(_0x3b698b,_0xd60d94){return function(_0x41324b){if(!_0x41324b){_0x3b698b[_0x8eff('0x17')](0x194);}return _0x41324b;};}function handleError(_0x2e8067,_0x516173){_0x516173=_0x516173||0x1f4;return function(_0x3e1607){logger[_0x8eff('0x26')](_0x3e1607[_0x8eff('0x27')]);if(_0x3e1607[_0x8eff('0x28')]){delete _0x3e1607[_0x8eff('0x28')];}_0x2e8067[_0x8eff('0x18')](_0x516173)['send'](_0x3e1607);};}exports['index']=function(_0x44dcdb,_0x472b19){var _0x17ff3f={},_0x5ce071={},_0x2ebf3a={'count':0x0,'rows':[]};var _0x2f8ad9=_[_0x8eff('0x29')](db[_0x8eff('0x2a')][_0x8eff('0x2b')],function(_0x2c5727){return{'name':_0x2c5727[_0x8eff('0x2c')],'type':_0x2c5727[_0x8eff('0x2d')][_0x8eff('0x2e')]};});_0x5ce071[_0x8eff('0x2f')]=_[_0x8eff('0x29')](_0x2f8ad9,_0x8eff('0x28'));_0x5ce071['query']=_[_0x8eff('0x30')](_0x44dcdb[_0x8eff('0x31')]);_0x5ce071[_0x8eff('0x32')]=_[_0x8eff('0x33')](_0x5ce071['model'],_0x5ce071[_0x8eff('0x31')]);_0x17ff3f[_0x8eff('0x34')]=_['intersection'](_0x5ce071['model'],qs[_0x8eff('0x35')](_0x44dcdb[_0x8eff('0x31')]['fields']));_0x17ff3f['attributes']=_0x17ff3f['attributes'][_0x8eff('0x36')]?_0x17ff3f['attributes']:_0x5ce071[_0x8eff('0x2f')];if(!_0x44dcdb['query'][_0x8eff('0x37')](_0x8eff('0x38'))){_0x17ff3f[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x44dcdb[_0x8eff('0x31')][_0x8eff('0x1c')]);_0x17ff3f['offset']=qs[_0x8eff('0x1b')](_0x44dcdb['query'][_0x8eff('0x1b')]);}_0x17ff3f['order']=qs[_0x8eff('0x39')](_0x44dcdb[_0x8eff('0x31')][_0x8eff('0x39')]);_0x17ff3f[_0x8eff('0x3a')]=qs['filters'](_[_0x8eff('0x3b')](_0x44dcdb[_0x8eff('0x31')],_0x5ce071[_0x8eff('0x32')]),_0x2f8ad9);if(_0x44dcdb['query'][_0x8eff('0x3c')]){_0x17ff3f[_0x8eff('0x3a')]=_[_0x8eff('0x3d')](_0x17ff3f[_0x8eff('0x3a')],{'$or':_[_0x8eff('0x29')](_0x2f8ad9,function(_0xd2a915){if(_0xd2a915[_0x8eff('0x2d')]!==_0x8eff('0x3e')){var _0x661c36={};_0x661c36[_0xd2a915['name']]={'$like':'%'+_0x44dcdb['query'][_0x8eff('0x3c')]+'%'};return _0x661c36;}})});}_0x17ff3f=_[_0x8eff('0x3d')]({},_0x17ff3f,_0x44dcdb[_0x8eff('0x3f')]);var _0x36e93c={'where':_0x17ff3f[_0x8eff('0x3a')]};return db[_0x8eff('0x2a')][_0x8eff('0x40')](_0x36e93c)['then'](function(_0x14cf6e){_0x2ebf3a[_0x8eff('0x40')]=_0x14cf6e;if(_0x44dcdb['query'][_0x8eff('0x41')]){_0x17ff3f[_0x8eff('0x42')]=[{'all':!![]}];}return db[_0x8eff('0x2a')][_0x8eff('0x43')](_0x17ff3f);})[_0x8eff('0x22')](function(_0x43dc74){_0x2ebf3a[_0x8eff('0x44')]=_0x43dc74;return _0x2ebf3a;})[_0x8eff('0x22')](respondWithFilteredResult(_0x472b19,_0x17ff3f))[_0x8eff('0x45')](handleError(_0x472b19,null));};exports['show']=function(_0x37f376,_0x27a8c9){var _0x3f8a85={'raw':!![],'where':{'id':_0x37f376[_0x8eff('0x46')]['id']}},_0x2fa131={};_0x2fa131['model']=_[_0x8eff('0x30')](db['CmHopperAdditionalPhone'][_0x8eff('0x2b')]);_0x2fa131[_0x8eff('0x31')]=_[_0x8eff('0x30')](_0x37f376[_0x8eff('0x31')]);_0x2fa131['filters']=_[_0x8eff('0x33')](_0x2fa131[_0x8eff('0x2f')],_0x2fa131[_0x8eff('0x31')]);_0x3f8a85['attributes']=_['intersection'](_0x2fa131[_0x8eff('0x2f')],qs[_0x8eff('0x35')](_0x37f376[_0x8eff('0x31')][_0x8eff('0x35')]));_0x3f8a85[_0x8eff('0x34')]=_0x3f8a85['attributes'][_0x8eff('0x36')]?_0x3f8a85['attributes']:_0x2fa131[_0x8eff('0x2f')];if(_0x37f376[_0x8eff('0x31')]['includeAll']){_0x3f8a85['include']=[{'all':!![]}];}_0x3f8a85=_['merge']({},_0x3f8a85,_0x37f376['options']);return db['CmHopperAdditionalPhone']['find'](_0x3f8a85)[_0x8eff('0x22')](handleEntityNotFound(_0x27a8c9,null))[_0x8eff('0x22')](respondWithResult(_0x27a8c9,null))[_0x8eff('0x45')](handleError(_0x27a8c9,null));};exports[_0x8eff('0x47')]=function(_0x1aa204,_0x190aec){return db[_0x8eff('0x2a')][_0x8eff('0x47')](_0x1aa204[_0x8eff('0x48')],{})[_0x8eff('0x22')](function(_0x4c7013){var _0x11e53c=_0x1aa204['user'][_0x8eff('0x24')]({'plain':!![]});if(!_0x11e53c)throw new Error(_0x8eff('0x49'));if(_0x11e53c[_0x8eff('0x4a')]===_0x8eff('0x4b')){var _0x5c491b=_0x4c7013[_0x8eff('0x24')]({'plain':!![]});var _0x342bbd=_0x8eff('0x4c');return db[_0x8eff('0x4d')][_0x8eff('0x4e')]({'where':{'name':_0x342bbd,'userProfileId':_0x11e53c[_0x8eff('0x4f')]},'raw':!![]})[_0x8eff('0x22')](function(_0x47b28d){if(_0x47b28d&&_0x47b28d[_0x8eff('0x50')]===0x0){return db[_0x8eff('0x25')][_0x8eff('0x47')]({'name':_0x5c491b[_0x8eff('0x28')],'resourceId':_0x5c491b['id'],'type':_0x47b28d[_0x8eff('0x28')],'sectionId':_0x47b28d['id']},{})[_0x8eff('0x22')](function(){return _0x4c7013;});}else{return _0x4c7013;}})[_0x8eff('0x45')](function(_0x9eb0b9){logger[_0x8eff('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9eb0b9);throw _0x9eb0b9;});}return _0x4c7013;})['then'](respondWithResult(_0x190aec,0xc9))[_0x8eff('0x45')](handleError(_0x190aec,null));};exports[_0x8eff('0x51')]=function(_0x430f5e,_0x203e80){if(_0x430f5e[_0x8eff('0x48')]['id']){delete _0x430f5e[_0x8eff('0x48')]['id'];}return db['CmHopperAdditionalPhone'][_0x8eff('0x4e')]({'where':{'id':_0x430f5e[_0x8eff('0x46')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x203e80,null))['then'](saveUpdates(_0x430f5e[_0x8eff('0x48')],null))[_0x8eff('0x22')](respondWithResult(_0x203e80,null))[_0x8eff('0x45')](handleError(_0x203e80,null));};exports[_0x8eff('0x23')]=function(_0x549e88,_0x40de1d){return db[_0x8eff('0x2a')][_0x8eff('0x4e')]({'where':{'id':_0x549e88[_0x8eff('0x46')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x40de1d,null))[_0x8eff('0x22')](removeEntity(_0x40de1d,null))[_0x8eff('0x45')](handleError(_0x40de1d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 3644548..69351dc 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 _0x2624=['define','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperAdditionalPhone.attributes','exports'];(function(_0xf09650,_0x13afc6){var _0x438aa9=function(_0x429c74){while(--_0x429c74){_0xf09650['push'](_0xf09650['shift']());}};_0x438aa9(++_0x13afc6);}(_0x2624,0x1d0));var _0x4262=function(_0x114bd4,_0x4d6c1e){_0x114bd4=_0x114bd4-0x0;var _0x328766=_0x2624[_0x114bd4];return _0x328766;};'use strict';var _=require(_0x4262('0x0'));var util=require('util');var logger=require(_0x4262('0x1'))(_0x4262('0x2'));var moment=require(_0x4262('0x3'));var BPromise=require(_0x4262('0x4'));var rp=require(_0x4262('0x5'));var fs=require('fs');var path=require(_0x4262('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4262('0x7'));module[_0x4262('0x8')]=function(_0x391aec,_0x4516bd){return _0x391aec[_0x4262('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x4262('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe253=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','lodash','util','../../config/logger','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe253,0x1be));var _0x3e25=function(_0xd637ec,_0x53490e){_0xd637ec=_0xd637ec-0x0;var _0x6bcaeb=_0xe253[_0xd637ec];return _0x6bcaeb;};'use strict';var _=require(_0x3e25('0x0'));var util=require(_0x3e25('0x1'));var logger=require(_0x3e25('0x2'))(_0x3e25('0x3'));var moment=require(_0x3e25('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e25('0x5'));var rimraf=require(_0x3e25('0x6'));var config=require(_0x3e25('0x7'));var attributes=require(_0x3e25('0x8'));module[_0x3e25('0x9')]=function(_0x59eebe,_0x349239){return _0x59eebe['define'](_0x3e25('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 8d0f776..6f49cfd 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 _0x6e03=['ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnoanswerretry','countagentrejectretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','add','minutes','scheduledat','phone','isNil','updatedAt','hopperToAdd','transaction','IncrementPreviewCounters','update','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','findOne','OrderBy'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6e03,0x17d));var _0x36e0=function(_0x29fc9b,_0x3e271b){_0x29fc9b=_0x29fc9b-0x0;var _0x893754=_0x6e03[_0x29fc9b];return _0x893754;};'use strict';var _=require(_0x36e0('0x0'));var util=require(_0x36e0('0x1'));var moment=require(_0x36e0('0x2'));var BPromise=require(_0x36e0('0x3'));var rs=require(_0x36e0('0x4'));var fs=require('fs');var Redis=require(_0x36e0('0x5'));var db=require(_0x36e0('0x6'))['db'];var utils=require(_0x36e0('0x7'));var logger=require(_0x36e0('0x8'))(_0x36e0('0x9'));var config=require(_0x36e0('0xa'));var jayson=require(_0x36e0('0xb'));var client=jayson[_0x36e0('0xc')][_0x36e0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23890e,_0x11b93b,_0x2f47c6){return new BPromise(function(_0x29909f,_0x5280d8){return client['request'](_0x23890e,_0x2f47c6)[_0x36e0('0xe')](function(_0x2e744b){logger[_0x36e0('0xf')](_0x36e0('0x10'),_0x11b93b,_0x36e0('0x11'));logger[_0x36e0('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x11b93b,'request\x20sent',JSON[_0x36e0('0x13')](_0x2e744b));if(_0x2e744b['error']){if(_0x2e744b[_0x36e0('0x14')]['code']===0x1f4){logger['error'](_0x36e0('0x10'),_0x11b93b,_0x2e744b[_0x36e0('0x14')]['message']);return _0x5280d8(_0x2e744b['error'][_0x36e0('0x15')]);}logger[_0x36e0('0x14')](_0x36e0('0x10'),_0x11b93b,_0x2e744b['error'][_0x36e0('0x15')]);return _0x29909f(_0x2e744b[_0x36e0('0x14')][_0x36e0('0x15')]);}else{logger[_0x36e0('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x11b93b,_0x36e0('0x11'));_0x29909f(_0x2e744b[_0x36e0('0x16')][_0x36e0('0x15')]);}})[_0x36e0('0x17')](function(_0x31fc9b){logger[_0x36e0('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x11b93b,_0x31fc9b);_0x5280d8(_0x31fc9b);});});}exports['VerifyAdditionalPhones']=function(_0x59302f){var _0xcfe4bf=this;return new Promise(function(_0x1b945f,_0x48f764){return db[_0x36e0('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1a')],'ListId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1b')],'VoiceQueueId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1c')]===undefined?null:_0x59302f[_0x36e0('0x19')][_0x36e0('0x1c')],'CampaignId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1d')]===undefined?null:_0x59302f[_0x36e0('0x19')][_0x36e0('0x1d')]}})['then'](function(_0x1fbaf0){if(_0x1fbaf0!=null){return db['CmHopperAdditionalPhone'][_0x36e0('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x1fbaf0['id'],'OrderBy':{'$gt':_0x1fbaf0[_0x36e0('0x1f')]}},'order':[[_0x36e0('0x1f'),_0x36e0('0x20')]]})['then'](function(_0x2dac97){var _0x295681=0x0;if(_0x2dac97){if(_0x2dac97[_0x36e0('0x21')]+_0x2dac97[_0x36e0('0x22')]+_0x2dac97['countnoanswerretry']+_0x2dac97[_0x36e0('0x23')]+_0x2dac97[_0x36e0('0x24')]+_0x2dac97[_0x36e0('0x25')]+_0x2dac97[_0x36e0('0x26')]+_0x2dac97['countagentrejectretry']<_0x59302f['entity'][_0x36e0('0x27')])_0x295681=0x1;_0x1b945f({'additional':_0x295681});}else{return db[_0x36e0('0x28')][_0x36e0('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x1fbaf0['id']},'order':[['OrderBy',_0x36e0('0x20')]]})[_0x36e0('0xe')](function(_0x223fb3){var _0xba74c9=0x0;if(_0x223fb3){if(_0x223fb3['countbusyretry']+_0x223fb3[_0x36e0('0x22')]+_0x223fb3[_0x36e0('0x29')]+_0x223fb3[_0x36e0('0x23')]+_0x223fb3[_0x36e0('0x24')]+_0x223fb3[_0x36e0('0x25')]+_0x223fb3['countmachineretry']+_0x223fb3[_0x36e0('0x2a')]<_0x59302f[_0x36e0('0x2b')][_0x36e0('0x27')])_0xba74c9=0x1;_0x1b945f({'additional':_0xba74c9});}else{_0x1b945f({'additional':0x0});}})[_0x36e0('0x17')](function(_0x2b6a50){logger[_0x36e0('0x14')]('VerifyAdditionalPhones',_0x2b6a50['message'],_0x59302f);_0x48f764(_0xcfe4bf[_0x36e0('0x14')](0x1f4,_0x2b6a50['message']));});}})[_0x36e0('0x17')](function(_0x30c673){logger[_0x36e0('0x14')](_0x36e0('0x2c'),_0x30c673[_0x36e0('0x15')],_0x59302f);_0x48f764(_0xcfe4bf[_0x36e0('0x14')](0x1f4,_0x30c673[_0x36e0('0x15')]));});}else _0x1b945f({'additional':0x0});});});};exports[_0x36e0('0x2d')]=function(_0x3b6838){var _0x9fb5d2=this;return new Promise(function(_0x3ad787,_0x23c416){return db['CmHopper'][_0x36e0('0x1e')]({'raw':!![],'where':{'ContactId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1a')],'ListId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1b')],'VoiceQueueId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1c')]===undefined?null:_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1c')],'CampaignId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1d')]===undefined?null:_0x3b6838[_0x36e0('0x19')]['CampaignId']}})[_0x36e0('0xe')](function(_0x29b0d2){if(_0x29b0d2!=null){return db[_0x36e0('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x29b0d2['id'],'OrderBy':{'$gt':_0x29b0d2[_0x36e0('0x1f')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x28a8af){if(_0x28a8af)return activateAdditionalPhone(_0x29b0d2,_0x3b6838[_0x36e0('0x19')],_0x28a8af,_0x3b6838[_0x36e0('0x2e')],_0x3b6838[_0x36e0('0x2f')])[_0x36e0('0xe')](function(_0x515812){_0x3ad787(_0x515812);});else{return db[_0x36e0('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x29b0d2['id']},'order':[['OrderBy',_0x36e0('0x20')]]})[_0x36e0('0xe')](function(_0x477a03){if(_0x477a03)return activateAdditionalPhone(_0x29b0d2,_0x3b6838[_0x36e0('0x19')],_0x477a03,_0x3b6838[_0x36e0('0x2e')],_0x3b6838['waitTime'])['then'](function(_0x47d54d){_0x3ad787(_0x47d54d);});else{_0x3ad787({'id':_0x29b0d2['id'],'phone':''});}})[_0x36e0('0x17')](function(_0x112c48){logger['error'](_0x36e0('0x2c'),_0x112c48[_0x36e0('0x15')],_0x3b6838);_0x23c416(_0x9fb5d2[_0x36e0('0x14')](0x1f4,_0x112c48['message']));});}})[_0x36e0('0x17')](function(_0x42ed6c){logger[_0x36e0('0x14')]('VerifyAdditionalPhones',_0x42ed6c[_0x36e0('0x15')],_0x3b6838);_0x23c416(_0x9fb5d2[_0x36e0('0x14')](0x1f4,_0x42ed6c[_0x36e0('0x15')]));});}else _0x3ad787(0x1);});});};function activateAdditionalPhone(_0x243d93,_0x3715d8,_0x401bc4,_0x29590a,_0x1565cd){return new Promise(function(_0x18c032,_0x50d64c){logger[_0x36e0('0xf')](_0x36e0('0x2c'),_0x401bc4);var _0x11fef5;if(moment()>moment(_0x401bc4['scheduledat'])){_0x11fef5=moment()[_0x36e0('0x30')](_0x1565cd||0x3,_0x36e0('0x31'));}else{if(_0x401bc4['OrderBy']==0x0){_0x11fef5=moment(_0x401bc4[_0x36e0('0x32')]);}else{_0x11fef5=moment()[_0x36e0('0x30')](_0x1565cd||0x3,'minutes');}}var _0x5ba851={'phone':_0x243d93[_0x36e0('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x243d93[_0x36e0('0x1f')])?0x0:_0x243d93['OrderBy'],'scheduledat':moment()[_0x36e0('0x30')](_0x29590a||0x1,_0x36e0('0x31')),'countbusyretry':_0x3715d8[_0x36e0('0x21')],'countcongestionretry':_0x3715d8[_0x36e0('0x22')],'countnoanswerretry':_0x3715d8[_0x36e0('0x29')],'countnosuchnumberretry':_0x3715d8[_0x36e0('0x23')],'countdropretry':_0x3715d8[_0x36e0('0x24')],'countabandonedretry':_0x3715d8[_0x36e0('0x25')],'countmachineretry':_0x3715d8[_0x36e0('0x26')],'countagentrejectretry':_0x3715d8[_0x36e0('0x2a')],'createdAt':_0x3715d8['createdAt'],'updatedAt':_0x3715d8['updatedAt']};var _0x2ff033={'CmHopperId':_0x243d93['id'],'phone':_0x401bc4[_0x36e0('0x33')],'active':0x0,'OrderBy':_[_0x36e0('0x34')](_0x401bc4[_0x36e0('0x1f')])?0x0:_0x401bc4[_0x36e0('0x1f')],'scheduledat':_0x11fef5,'countbusyretry':_0x401bc4[_0x36e0('0x21')],'countcongestionretry':_0x401bc4[_0x36e0('0x22')],'countnoanswerretry':_0x401bc4[_0x36e0('0x29')],'countnosuchnumberretry':_0x3715d8['countnosuchnumberretry'],'countdropretry':_0x3715d8['countdropretry'],'countabandonedretry':_0x3715d8[_0x36e0('0x25')],'countmachineretry':_0x3715d8[_0x36e0('0x26')],'countagentrejectretry':_0x3715d8[_0x36e0('0x2a')],'createdAt':_0x401bc4['createdAt'],'updatedAt':_0x401bc4[_0x36e0('0x35')]};logger[_0x36e0('0xf')](_0x36e0('0x36'),_0x5ba851);logger['info']('additionalToHop',_0x2ff033);return db['sequelize'][_0x36e0('0x37')](function(_0x14d443){return db[_0x36e0('0x28')]['update'](_0x5ba851,{'where':{'id':_0x401bc4['id']}},{'transaction':_0x14d443})[_0x36e0('0xe')](function(){return db['CmHopper']['update'](_0x2ff033,{'where':{'id':_0x243d93['id']}},{'transaction':_0x14d443});});})[_0x36e0('0xe')](function(_0x5a97a7){_0x18c032({'id':_0x243d93['id'],'phone':_0x401bc4['phone']});})['catch'](function(_0x1cccdd){logger[_0x36e0('0x14')](_0x36e0('0x2c'),_0x1cccdd[_0x36e0('0x15')],req);_0x50d64c(_this[_0x36e0('0x14')](0x1f4,_0x1cccdd[_0x36e0('0x15')]));});});}exports[_0x36e0('0x38')]=function(_0x17ab5e){var _0x4cadb0=this;return new Promise(function(_0x4ed433,_0x3948fa){return db[_0x36e0('0x18')][_0x36e0('0x39')](_0x17ab5e[_0x36e0('0x19')][_0x36e0('0x3a')],{'where':{'id':_0x17ab5e[_0x36e0('0x19')]['id']}})['then'](function(_0x2ca5db){_0x4ed433(_0x2ca5db);})[_0x36e0('0x17')](function(_0x362f16){logger['error']('IncrementPreviewCounters',_0x362f16[_0x36e0('0x15')],_0x17ab5e);_0x3948fa(_0x4cadb0[_0x36e0('0x14')](0x1f4,_0x362f16[_0x36e0('0x15')]));});});}; \ No newline at end of file +var _0x69d7=['dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','phone','isNil','countmachineretry','updatedAt','createdAt','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','util','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity'];(function(_0x5bff80,_0x35c63d){var _0x54b465=function(_0x43950f){while(--_0x43950f){_0x5bff80['push'](_0x5bff80['shift']());}};_0x54b465(++_0x35c63d);}(_0x69d7,0x1a8));var _0x769d=function(_0x184d67,_0x6d3507){_0x184d67=_0x184d67-0x0;var _0x554435=_0x69d7[_0x184d67];return _0x554435;};'use strict';var _=require('lodash');var util=require(_0x769d('0x0'));var moment=require('moment');var BPromise=require(_0x769d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x769d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x769d('0x3'))(_0x769d('0x4'));var config=require('../../config/environment');var jayson=require(_0x769d('0x5'));var client=jayson[_0x769d('0x6')][_0x769d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3307f7,_0x2f9cb9,_0x50c572){return new BPromise(function(_0x369ce0,_0x68315d){return client[_0x769d('0x8')](_0x3307f7,_0x50c572)[_0x769d('0x9')](function(_0x3fa75f){logger[_0x769d('0xa')](_0x769d('0xb'),_0x2f9cb9,_0x769d('0xc'));logger[_0x769d('0xd')](_0x769d('0xe'),_0x2f9cb9,_0x769d('0xc'),JSON[_0x769d('0xf')](_0x3fa75f));if(_0x3fa75f[_0x769d('0x10')]){if(_0x3fa75f[_0x769d('0x10')][_0x769d('0x11')]===0x1f4){logger['error'](_0x769d('0xb'),_0x2f9cb9,_0x3fa75f[_0x769d('0x10')][_0x769d('0x12')]);return _0x68315d(_0x3fa75f[_0x769d('0x10')][_0x769d('0x12')]);}logger[_0x769d('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2f9cb9,_0x3fa75f[_0x769d('0x10')][_0x769d('0x12')]);return _0x369ce0(_0x3fa75f['error'][_0x769d('0x12')]);}else{logger[_0x769d('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2f9cb9,_0x769d('0xc'));_0x369ce0(_0x3fa75f[_0x769d('0x13')][_0x769d('0x12')]);}})[_0x769d('0x14')](function(_0x38bf32){logger[_0x769d('0x10')](_0x769d('0xb'),_0x2f9cb9,_0x38bf32);_0x68315d(_0x38bf32);});});}exports[_0x769d('0x15')]=function(_0xf5396b){var _0x4fb369=this;return new Promise(function(_0x31643d,_0x5784a9){return db[_0x769d('0x16')][_0x769d('0x17')]({'raw':!![],'where':{'ContactId':_0xf5396b[_0x769d('0x18')][_0x769d('0x19')],'ListId':_0xf5396b[_0x769d('0x18')][_0x769d('0x1a')],'VoiceQueueId':_0xf5396b[_0x769d('0x18')][_0x769d('0x1b')]===undefined?null:_0xf5396b[_0x769d('0x18')][_0x769d('0x1b')],'CampaignId':_0xf5396b[_0x769d('0x18')][_0x769d('0x1c')]===undefined?null:_0xf5396b[_0x769d('0x18')][_0x769d('0x1c')]}})[_0x769d('0x9')](function(_0x478f0e){if(_0x478f0e!=null){return db[_0x769d('0x1d')][_0x769d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x478f0e['id'],'OrderBy':{'$gt':_0x478f0e[_0x769d('0x1e')]}},'order':[[_0x769d('0x1e'),_0x769d('0x1f')]]})[_0x769d('0x9')](function(_0x3000ae){var _0x2829e9=0x0;if(_0x3000ae){if(_0x3000ae[_0x769d('0x20')]+_0x3000ae[_0x769d('0x21')]+_0x3000ae[_0x769d('0x22')]+_0x3000ae[_0x769d('0x23')]+_0x3000ae[_0x769d('0x24')]+_0x3000ae[_0x769d('0x25')]+_0x3000ae['countmachineretry']+_0x3000ae[_0x769d('0x26')]<_0xf5396b[_0x769d('0x27')][_0x769d('0x28')])_0x2829e9=0x1;_0x31643d({'additional':_0x2829e9});}else{return db[_0x769d('0x1d')][_0x769d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x478f0e['id']},'order':[[_0x769d('0x1e'),_0x769d('0x1f')]]})[_0x769d('0x9')](function(_0x4705e0){var _0x10cdb2=0x0;if(_0x4705e0){if(_0x4705e0['countbusyretry']+_0x4705e0[_0x769d('0x21')]+_0x4705e0[_0x769d('0x22')]+_0x4705e0[_0x769d('0x23')]+_0x4705e0[_0x769d('0x24')]+_0x4705e0[_0x769d('0x25')]+_0x4705e0['countmachineretry']+_0x4705e0[_0x769d('0x26')]<_0xf5396b[_0x769d('0x27')][_0x769d('0x28')])_0x10cdb2=0x1;_0x31643d({'additional':_0x10cdb2});}else{_0x31643d({'additional':0x0});}})[_0x769d('0x14')](function(_0x31e8a5){logger['error'](_0x769d('0x15'),_0x31e8a5[_0x769d('0x12')],_0xf5396b);_0x5784a9(_0x4fb369[_0x769d('0x10')](0x1f4,_0x31e8a5[_0x769d('0x12')]));});}})[_0x769d('0x14')](function(_0x2c08ae){logger['error'](_0x769d('0x15'),_0x2c08ae[_0x769d('0x12')],_0xf5396b);_0x5784a9(_0x4fb369['error'](0x1f4,_0x2c08ae['message']));});}else _0x31643d({'additional':0x0});});});};exports[_0x769d('0x29')]=function(_0x7f39c9){var _0x56a507=this;return new Promise(function(_0x397c51,_0x2e98d6){return db[_0x769d('0x16')][_0x769d('0x17')]({'raw':!![],'where':{'ContactId':_0x7f39c9[_0x769d('0x18')][_0x769d('0x19')],'ListId':_0x7f39c9['body'][_0x769d('0x1a')],'VoiceQueueId':_0x7f39c9[_0x769d('0x18')]['VoiceQueueId']===undefined?null:_0x7f39c9[_0x769d('0x18')][_0x769d('0x1b')],'CampaignId':_0x7f39c9[_0x769d('0x18')][_0x769d('0x1c')]===undefined?null:_0x7f39c9[_0x769d('0x18')][_0x769d('0x1c')]}})[_0x769d('0x9')](function(_0x5b2606){if(_0x5b2606!=null){return db['CmHopperAdditionalPhone'][_0x769d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5b2606['id'],'OrderBy':{'$gt':_0x5b2606[_0x769d('0x1e')]}},'order':[['OrderBy',_0x769d('0x1f')]]})['then'](function(_0x2a193e){if(_0x2a193e)return activateAdditionalPhone(_0x5b2606,_0x7f39c9[_0x769d('0x18')],_0x2a193e,_0x7f39c9[_0x769d('0x2a')],_0x7f39c9['waitTime'])[_0x769d('0x9')](function(_0x4482a8){_0x397c51(_0x4482a8);});else{return db[_0x769d('0x1d')][_0x769d('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5b2606['id']},'order':[['OrderBy',_0x769d('0x1f')]]})[_0x769d('0x9')](function(_0x293d1d){if(_0x293d1d)return activateAdditionalPhone(_0x5b2606,_0x7f39c9[_0x769d('0x18')],_0x293d1d,_0x7f39c9['duration'],_0x7f39c9[_0x769d('0x2b')])[_0x769d('0x9')](function(_0x4ec2b8){_0x397c51(_0x4ec2b8);});else{_0x397c51({'id':_0x5b2606['id'],'phone':''});}})[_0x769d('0x14')](function(_0x2ff2fb){logger['error'](_0x769d('0x15'),_0x2ff2fb[_0x769d('0x12')],_0x7f39c9);_0x2e98d6(_0x56a507['error'](0x1f4,_0x2ff2fb[_0x769d('0x12')]));});}})[_0x769d('0x14')](function(_0x31df0e){logger['error']('VerifyAdditionalPhones',_0x31df0e[_0x769d('0x12')],_0x7f39c9);_0x2e98d6(_0x56a507[_0x769d('0x10')](0x1f4,_0x31df0e[_0x769d('0x12')]));});}else _0x397c51(0x1);});});};function activateAdditionalPhone(_0x924c10,_0x2a5f2f,_0x34f882,_0x5c1aa2,_0x469f05){return new Promise(function(_0x1ba598,_0x59026c){logger[_0x769d('0xa')](_0x769d('0x15'),_0x34f882);var _0x496ce;if(moment()>moment(_0x34f882[_0x769d('0x2c')])){_0x496ce=moment()['add'](_0x469f05||0x3,_0x769d('0x2d'));}else{if(_0x34f882[_0x769d('0x1e')]==0x0){_0x496ce=moment(_0x34f882['scheduledat']);}else{_0x496ce=moment()[_0x769d('0x2e')](_0x469f05||0x3,_0x769d('0x2d'));}}var _0x249013={'phone':_0x924c10[_0x769d('0x2f')],'active':0x0,'OrderBy':_[_0x769d('0x30')](_0x924c10[_0x769d('0x1e')])?0x0:_0x924c10[_0x769d('0x1e')],'scheduledat':moment()[_0x769d('0x2e')](_0x5c1aa2||0x1,_0x769d('0x2d')),'countbusyretry':_0x2a5f2f[_0x769d('0x20')],'countcongestionretry':_0x2a5f2f[_0x769d('0x21')],'countnoanswerretry':_0x2a5f2f['countnoanswerretry'],'countnosuchnumberretry':_0x2a5f2f[_0x769d('0x23')],'countdropretry':_0x2a5f2f[_0x769d('0x24')],'countabandonedretry':_0x2a5f2f[_0x769d('0x25')],'countmachineretry':_0x2a5f2f[_0x769d('0x31')],'countagentrejectretry':_0x2a5f2f[_0x769d('0x26')],'createdAt':_0x2a5f2f['createdAt'],'updatedAt':_0x2a5f2f[_0x769d('0x32')]};var _0x28bb73={'CmHopperId':_0x924c10['id'],'phone':_0x34f882['phone'],'active':0x0,'OrderBy':_[_0x769d('0x30')](_0x34f882[_0x769d('0x1e')])?0x0:_0x34f882['OrderBy'],'scheduledat':_0x496ce,'countbusyretry':_0x34f882['countbusyretry'],'countcongestionretry':_0x34f882[_0x769d('0x21')],'countnoanswerretry':_0x34f882[_0x769d('0x22')],'countnosuchnumberretry':_0x2a5f2f['countnosuchnumberretry'],'countdropretry':_0x2a5f2f[_0x769d('0x24')],'countabandonedretry':_0x2a5f2f['countabandonedretry'],'countmachineretry':_0x2a5f2f['countmachineretry'],'countagentrejectretry':_0x2a5f2f[_0x769d('0x26')],'createdAt':_0x34f882[_0x769d('0x33')],'updatedAt':_0x34f882['updatedAt']};logger[_0x769d('0xa')]('hopperToAdd',_0x249013);logger[_0x769d('0xa')](_0x769d('0x34'),_0x28bb73);return db[_0x769d('0x35')][_0x769d('0x36')](function(_0x985e59){return db[_0x769d('0x1d')][_0x769d('0x37')](_0x249013,{'where':{'id':_0x34f882['id']}},{'transaction':_0x985e59})['then'](function(){return db[_0x769d('0x16')]['update'](_0x28bb73,{'where':{'id':_0x924c10['id']}},{'transaction':_0x985e59});});})[_0x769d('0x9')](function(_0x52359e){_0x1ba598({'id':_0x924c10['id'],'phone':_0x34f882[_0x769d('0x2f')]});})[_0x769d('0x14')](function(_0x16c79b){logger['error'](_0x769d('0x15'),_0x16c79b[_0x769d('0x12')],req);_0x59026c(_this[_0x769d('0x10')](0x1f4,_0x16c79b[_0x769d('0x12')]));});});}exports[_0x769d('0x38')]=function(_0x23abb1){var _0x5b7270=this;return new Promise(function(_0x2df570,_0x21c976){return db[_0x769d('0x16')][_0x769d('0x37')](_0x23abb1[_0x769d('0x18')][_0x769d('0x39')],{'where':{'id':_0x23abb1[_0x769d('0x18')]['id']}})[_0x769d('0x9')](function(_0x41000b){_0x2df570(_0x41000b);})['catch'](function(_0x3f4967){logger['error'](_0x769d('0x38'),_0x3f4967['message'],_0x23abb1);_0x21c976(_0x5b7270[_0x769d('0x10')](0x1f4,_0x3f4967['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index a80805c..c0ce107 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 _0xa9a7=['show','post','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xa9a7,0x197));var _0x7a9a=function(_0x4d20aa,_0x44c204){_0x4d20aa=_0x4d20aa-0x0;var _0x564372=_0xa9a7[_0x4d20aa];return _0x564372;};'use strict';var multer=require('multer');var util=require(_0x7a9a('0x0'));var path=require('path');var timeout=require(_0x7a9a('0x1'));var express=require('express');var router=express[_0x7a9a('0x2')]();var auth=require(_0x7a9a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7a9a('0x4'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x7a9a('0x5')]('/',auth['isAuthenticated'](),controller[_0x7a9a('0x6')]);router[_0x7a9a('0x5')](_0x7a9a('0x7'),auth[_0x7a9a('0x8')](),controller[_0x7a9a('0x9')]);router[_0x7a9a('0xa')]('/',auth[_0x7a9a('0x8')](),controller['create']);router[_0x7a9a('0xb')](_0x7a9a('0x7'),auth[_0x7a9a('0x8')](),controller[_0x7a9a('0xc')]);router[_0x7a9a('0xd')](_0x7a9a('0x7'),auth['isAuthenticated'](),controller[_0x7a9a('0xe')]);module[_0x7a9a('0xf')]=router; \ No newline at end of file +var _0x80d4=['../../config/environment','./cmHopperAdditionalPhone.controller','get','/:id','isAuthenticated','show','create','put','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x80d4,0x1da));var _0x480d=function(_0x37a3ba,_0x1690ec){_0x37a3ba=_0x37a3ba-0x0;var _0x1fa21b=_0x80d4[_0x37a3ba];return _0x1fa21b;};'use strict';var multer=require(_0x480d('0x0'));var util=require(_0x480d('0x1'));var path=require(_0x480d('0x2'));var timeout=require('connect-timeout');var express=require(_0x480d('0x3'));var router=express['Router']();var auth=require(_0x480d('0x4'));var interaction=require(_0x480d('0x5'));var config=require(_0x480d('0x6'));var controller=require(_0x480d('0x7'));router[_0x480d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x480d('0x8')](_0x480d('0x9'),auth[_0x480d('0xa')](),controller[_0x480d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x480d('0xc')]);router[_0x480d('0xd')](_0x480d('0x9'),auth[_0x480d('0xa')](),controller['update']);router['delete'](_0x480d('0x9'),auth[_0x480d('0xa')](),controller['destroy']);module[_0x480d('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3b92eff..aec8bad 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 _0x6b62=['moment','exports','INTEGER','contactListQueue'];(function(_0xff662d,_0xe30c7a){var _0x63e4b0=function(_0x481f4f){while(--_0x481f4f){_0xff662d['push'](_0xff662d['shift']());}};_0x63e4b0(++_0xe30c7a);}(_0x6b62,0x1bc));var _0x26b6=function(_0x38ca61,_0x30345e){_0x38ca61=_0x38ca61-0x0;var _0xb0ba38=_0x6b62[_0x38ca61];return _0xb0ba38;};'use strict';var moment=require(_0x26b6('0x0'));var Sequelize=require('sequelize');module[_0x26b6('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x26b6('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x26b6('0x2')],'unique':_0x26b6('0x3')},'VoiceQueueId':{'type':Sequelize[_0x26b6('0x2')],'unique':_0x26b6('0x3')}}; \ No newline at end of file +var _0x952b=['contactListQueue','STRING','INTEGER'];(function(_0x1bd9a3,_0xef44db){var _0x243ae9=function(_0x388ea3){while(--_0x388ea3){_0x1bd9a3['push'](_0x1bd9a3['shift']());}};_0x243ae9(++_0xef44db);}(_0x952b,0x115));var _0xb952=function(_0x279015,_0x57a7ea){_0x279015=_0x279015-0x0;var _0x146798=_0x952b[_0x279015];return _0x146798;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xb952('0x0')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb952('0x1')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb952('0x1')],'unique':_0xb952('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb952('0x1')],'unique':_0xb952('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1987ba4..59cb22a 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 _0xe156=['mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','set','Content-Range','reject','save','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','body','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x19478b,_0xda6e87){var _0x3004b3=function(_0x26c51a){while(--_0x26c51a){_0x19478b['push'](_0x19478b['shift']());}};_0x3004b3(++_0xda6e87);}(_0xe156,0xd8));var _0x6e15=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0xe156[_0xdefbc3];return _0x367798;};'use strict';var pdf=require(_0x6e15('0x0'));var emlformat=require(_0x6e15('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6e15('0x2'));var jsonpatch=require(_0x6e15('0x3'));var rp=require(_0x6e15('0x4'));var moment=require(_0x6e15('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6e15('0x6'));var util=require(_0x6e15('0x7'));var path=require(_0x6e15('0x8'));var sox=require(_0x6e15('0x9'));var csv=require(_0x6e15('0xa'));var ejs=require(_0x6e15('0xb'));var fs=require('fs');var _=require(_0x6e15('0xc'));var squel=require(_0x6e15('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e15('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6e15('0xf'));var Papa=require(_0x6e15('0x10'));var Redis=require(_0x6e15('0x11'));var authService=require(_0x6e15('0x12'));var qs=require(_0x6e15('0x13'));var as=require(_0x6e15('0x14'));var hardwareService=require(_0x6e15('0x15'));var logger=require(_0x6e15('0x16'))(_0x6e15('0x17'));var utils=require(_0x6e15('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6e15('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e73f8,_0xdcef8a){_0xdcef8a=_0xdcef8a||0xcc;return function(_0x37b146){if(_0x37b146){return _0x1e73f8[_0x6e15('0x1a')](_0xdcef8a);}return _0x1e73f8[_0x6e15('0x1b')](_0xdcef8a)[_0x6e15('0x1c')]();};}function respondWithResult(_0x211ad2,_0x48dc8b){_0x48dc8b=_0x48dc8b||0xc8;return function(_0xbf7cb0){if(_0xbf7cb0){return _0x211ad2[_0x6e15('0x1b')](_0x48dc8b)[_0x6e15('0x1d')](_0xbf7cb0);}};}function respondWithFilteredResult(_0x39148f,_0x547f45){return function(_0x4cdb9d){if(_0x4cdb9d){var _0xf3548d=_0x4cdb9d['count'],_0x478128=_0x547f45['offset'],_0x55516f=_0x547f45['offset']+_0x547f45['limit'],_0x13493d;if(_0x55516f>=_0xf3548d){_0x55516f=_0xf3548d;_0x13493d=0xc8;}else{_0x13493d=0xce;}_0x39148f[_0x6e15('0x1b')](_0x13493d);return _0x39148f[_0x6e15('0x1e')](_0x6e15('0x1f'),_0x478128+'-'+_0x55516f+'/'+_0xf3548d)[_0x6e15('0x1d')](_0x4cdb9d);}return null;};}function patchUpdates(_0x562f5b){return function(_0x59ee7c){try{jsonpatch['apply'](_0x59ee7c,_0x562f5b,!![]);}catch(_0x292621){return BPromise[_0x6e15('0x20')](_0x292621);}return _0x59ee7c[_0x6e15('0x21')]();};}function saveUpdates(_0x58f926,_0x19c371){return function(_0x1899f0){if(_0x1899f0){return _0x1899f0['update'](_0x58f926)[_0x6e15('0x22')](function(_0x5a034e){return _0x5a034e;});}return null;};}function removeEntity(_0x25e16e,_0x3d2d84){return function(_0x462a75){if(_0x462a75){return _0x462a75['destroy']()[_0x6e15('0x22')](function(){_0x25e16e[_0x6e15('0x1b')](0xcc)[_0x6e15('0x1c')]();});}};}function handleEntityNotFound(_0x304370,_0x583323){return function(_0x5b74bb){if(!_0x5b74bb){_0x304370[_0x6e15('0x1a')](0x194);}return _0x5b74bb;};}function handleError(_0x305c8c,_0x2480de){_0x2480de=_0x2480de||0x1f4;return function(_0x38e84b){logger[_0x6e15('0x23')](_0x38e84b[_0x6e15('0x24')]);if(_0x38e84b[_0x6e15('0x25')]){delete _0x38e84b['name'];}_0x305c8c[_0x6e15('0x1b')](_0x2480de)[_0x6e15('0x26')](_0x38e84b);};}exports[_0x6e15('0x27')]=function(_0x3d3a18,_0xab75b7){var _0x49954f={},_0x360387={},_0x4795a3={'count':0x0,'rows':[]};var _0x1ce062=_[_0x6e15('0x28')](db[_0x6e15('0x29')][_0x6e15('0x2a')],function(_0xac3ca3){return{'name':_0xac3ca3[_0x6e15('0x2b')],'type':_0xac3ca3['type'][_0x6e15('0x2c')]};});_0x360387[_0x6e15('0x2d')]=_[_0x6e15('0x28')](_0x1ce062,_0x6e15('0x25'));_0x360387[_0x6e15('0x2e')]=_[_0x6e15('0x2f')](_0x3d3a18['query']);_0x360387[_0x6e15('0x30')]=_[_0x6e15('0x31')](_0x360387['model'],_0x360387[_0x6e15('0x2e')]);_0x49954f[_0x6e15('0x32')]=_[_0x6e15('0x31')](_0x360387['model'],qs[_0x6e15('0x33')](_0x3d3a18['query'][_0x6e15('0x33')]));_0x49954f[_0x6e15('0x32')]=_0x49954f[_0x6e15('0x32')][_0x6e15('0x34')]?_0x49954f['attributes']:_0x360387[_0x6e15('0x2d')];if(!_0x3d3a18['query']['hasOwnProperty'](_0x6e15('0x35'))){_0x49954f['limit']=qs[_0x6e15('0x36')](_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x36')]);_0x49954f[_0x6e15('0x37')]=qs['offset'](_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x37')]);}_0x49954f[_0x6e15('0x38')]=qs[_0x6e15('0x39')](_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x39')]);_0x49954f[_0x6e15('0x3a')]=qs[_0x6e15('0x30')](_[_0x6e15('0x3b')](_0x3d3a18[_0x6e15('0x2e')],_0x360387[_0x6e15('0x30')]),_0x1ce062);if(_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x3c')]){_0x49954f[_0x6e15('0x3a')]=_[_0x6e15('0x3d')](_0x49954f['where'],{'$or':_['map'](_0x1ce062,function(_0x1e4e50){if(_0x1e4e50['type']!=='VIRTUAL'){var _0x2b1c5a={};_0x2b1c5a[_0x1e4e50[_0x6e15('0x25')]]={'$like':'%'+_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x3c')]+'%'};return _0x2b1c5a;}})});}_0x49954f=_[_0x6e15('0x3d')]({},_0x49954f,_0x3d3a18[_0x6e15('0x3e')]);var _0x330a66={'where':_0x49954f[_0x6e15('0x3a')]};return db[_0x6e15('0x29')]['count'](_0x330a66)['then'](function(_0x29c898){_0x4795a3['count']=_0x29c898;if(_0x3d3a18['query']['includeAll']){_0x49954f[_0x6e15('0x3f')]=[{'all':!![]}];}return db[_0x6e15('0x29')][_0x6e15('0x40')](_0x49954f);})[_0x6e15('0x22')](function(_0x391cfa){_0x4795a3[_0x6e15('0x41')]=_0x391cfa;return _0x4795a3;})[_0x6e15('0x22')](respondWithFilteredResult(_0xab75b7,_0x49954f))[_0x6e15('0x42')](handleError(_0xab75b7,null));};exports[_0x6e15('0x43')]=function(_0x4001b0,_0x549375){var _0x510d8f={'raw':!![],'where':{'id':_0x4001b0[_0x6e15('0x44')]['id']}},_0x16549c={};_0x16549c[_0x6e15('0x2d')]=_['keys'](db[_0x6e15('0x29')][_0x6e15('0x2a')]);_0x16549c[_0x6e15('0x2e')]=_[_0x6e15('0x2f')](_0x4001b0[_0x6e15('0x2e')]);_0x16549c[_0x6e15('0x30')]=_['intersection'](_0x16549c['model'],_0x16549c[_0x6e15('0x2e')]);_0x510d8f[_0x6e15('0x32')]=_[_0x6e15('0x31')](_0x16549c[_0x6e15('0x2d')],qs[_0x6e15('0x33')](_0x4001b0[_0x6e15('0x2e')][_0x6e15('0x33')]));_0x510d8f[_0x6e15('0x32')]=_0x510d8f['attributes']['length']?_0x510d8f[_0x6e15('0x32')]:_0x16549c[_0x6e15('0x2d')];if(_0x4001b0[_0x6e15('0x2e')][_0x6e15('0x45')]){_0x510d8f['include']=[{'all':!![]}];}_0x510d8f=_['merge']({},_0x510d8f,_0x4001b0[_0x6e15('0x3e')]);return db['CmHopperBlack']['find'](_0x510d8f)[_0x6e15('0x22')](handleEntityNotFound(_0x549375,null))[_0x6e15('0x22')](respondWithResult(_0x549375,null))[_0x6e15('0x42')](handleError(_0x549375,null));};exports['update']=function(_0xffea4e,_0x90d417){if(_0xffea4e[_0x6e15('0x46')]['id']){delete _0xffea4e[_0x6e15('0x46')]['id'];}return db[_0x6e15('0x29')][_0x6e15('0x47')]({'where':{'id':_0xffea4e[_0x6e15('0x44')]['id']}})['then'](handleEntityNotFound(_0x90d417,null))['then'](saveUpdates(_0xffea4e[_0x6e15('0x46')],null))[_0x6e15('0x22')](respondWithResult(_0x90d417,null))[_0x6e15('0x42')](handleError(_0x90d417,null));};exports[_0x6e15('0x48')]=function(_0x4ccabe,_0x5cc04a){return db[_0x6e15('0x29')][_0x6e15('0x47')]({'where':{'id':_0x4ccabe[_0x6e15('0x44')]['id']}})[_0x6e15('0x22')](handleEntityNotFound(_0x5cc04a,null))[_0x6e15('0x22')](removeEntity(_0x5cc04a,null))[_0x6e15('0x42')](handleError(_0x5cc04a,null));};exports[_0x6e15('0x49')]=function(_0x396d6a,_0x229da9){return db['CmHopperBlack'][_0x6e15('0x49')]()['then'](respondWithResult(_0x229da9,null))['catch'](handleError(_0x229da9,null));}; \ No newline at end of file +var _0xf331=['destroy','then','end','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','find','body','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','reject','save','update'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xf331,0xb7));var _0x1f33=function(_0x191c7d,_0x4a5e45){_0x191c7d=_0x191c7d-0x0;var _0x215c32=_0xf331[_0x191c7d];return _0x215c32;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1f33('0x0'));var zipdir=require(_0x1f33('0x1'));var jsonpatch=require(_0x1f33('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f33('0x3'));var Mustache=require(_0x1f33('0x4'));var util=require(_0x1f33('0x5'));var path=require(_0x1f33('0x6'));var sox=require(_0x1f33('0x7'));var csv=require('to-csv');var ejs=require(_0x1f33('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f33('0x9'));var crypto=require(_0x1f33('0xa'));var jsforce=require(_0x1f33('0xb'));var deskjs=require(_0x1f33('0xc'));var toCsv=require(_0x1f33('0xd'));var querystring=require('querystring');var Papa=require(_0x1f33('0xe'));var Redis=require(_0x1f33('0xf'));var authService=require(_0x1f33('0x10'));var qs=require(_0x1f33('0x11'));var as=require(_0x1f33('0x12'));var hardwareService=require(_0x1f33('0x13'));var logger=require(_0x1f33('0x14'))(_0x1f33('0x15'));var utils=require(_0x1f33('0x16'));var config=require(_0x1f33('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f33('0x18'))['db'];function respondWithStatusCode(_0x290bd3,_0x36d9a0){_0x36d9a0=_0x36d9a0||0xcc;return function(_0x293f33){if(_0x293f33){return _0x290bd3['sendStatus'](_0x36d9a0);}return _0x290bd3[_0x1f33('0x19')](_0x36d9a0)['end']();};}function respondWithResult(_0x4e29c6,_0x46c674){_0x46c674=_0x46c674||0xc8;return function(_0x165f39){if(_0x165f39){return _0x4e29c6[_0x1f33('0x19')](_0x46c674)[_0x1f33('0x1a')](_0x165f39);}};}function respondWithFilteredResult(_0xbfa1f,_0x1e83f7){return function(_0x23b5bf){if(_0x23b5bf){var _0x2a8778=_0x23b5bf['count'],_0x1523b7=_0x1e83f7['offset'],_0x25cbd6=_0x1e83f7[_0x1f33('0x1b')]+_0x1e83f7['limit'],_0x1f9697;if(_0x25cbd6>=_0x2a8778){_0x25cbd6=_0x2a8778;_0x1f9697=0xc8;}else{_0x1f9697=0xce;}_0xbfa1f[_0x1f33('0x19')](_0x1f9697);return _0xbfa1f[_0x1f33('0x1c')](_0x1f33('0x1d'),_0x1523b7+'-'+_0x25cbd6+'/'+_0x2a8778)[_0x1f33('0x1a')](_0x23b5bf);}return null;};}function patchUpdates(_0x472162){return function(_0x45cf4a){try{jsonpatch['apply'](_0x45cf4a,_0x472162,!![]);}catch(_0x4afb87){return BPromise[_0x1f33('0x1e')](_0x4afb87);}return _0x45cf4a[_0x1f33('0x1f')]();};}function saveUpdates(_0x36b682,_0x56ae3e){return function(_0x417e86){if(_0x417e86){return _0x417e86[_0x1f33('0x20')](_0x36b682)['then'](function(_0x49e13e){return _0x49e13e;});}return null;};}function removeEntity(_0x7e6e0e,_0x3b95f6){return function(_0x228946){if(_0x228946){return _0x228946[_0x1f33('0x21')]()[_0x1f33('0x22')](function(){_0x7e6e0e[_0x1f33('0x19')](0xcc)[_0x1f33('0x23')]();});}};}function handleEntityNotFound(_0x5050a5,_0x38ee54){return function(_0x1079d2){if(!_0x1079d2){_0x5050a5[_0x1f33('0x24')](0x194);}return _0x1079d2;};}function handleError(_0x5a680b,_0xf0863a){_0xf0863a=_0xf0863a||0x1f4;return function(_0x3a196a){logger[_0x1f33('0x25')](_0x3a196a[_0x1f33('0x26')]);if(_0x3a196a[_0x1f33('0x27')]){delete _0x3a196a[_0x1f33('0x27')];}_0x5a680b['status'](_0xf0863a)[_0x1f33('0x28')](_0x3a196a);};}exports[_0x1f33('0x29')]=function(_0x52afa3,_0x4b511c){var _0xa4f203={},_0x239057={},_0x26ba63={'count':0x0,'rows':[]};var _0xdb3d5a=_[_0x1f33('0x2a')](db[_0x1f33('0x2b')][_0x1f33('0x2c')],function(_0x3dbf05){return{'name':_0x3dbf05['fieldName'],'type':_0x3dbf05[_0x1f33('0x2d')]['key']};});_0x239057[_0x1f33('0x2e')]=_['map'](_0xdb3d5a,_0x1f33('0x27'));_0x239057[_0x1f33('0x2f')]=_[_0x1f33('0x30')](_0x52afa3[_0x1f33('0x2f')]);_0x239057[_0x1f33('0x31')]=_[_0x1f33('0x32')](_0x239057[_0x1f33('0x2e')],_0x239057[_0x1f33('0x2f')]);_0xa4f203[_0x1f33('0x33')]=_[_0x1f33('0x32')](_0x239057['model'],qs[_0x1f33('0x34')](_0x52afa3[_0x1f33('0x2f')][_0x1f33('0x34')]));_0xa4f203[_0x1f33('0x33')]=_0xa4f203[_0x1f33('0x33')][_0x1f33('0x35')]?_0xa4f203[_0x1f33('0x33')]:_0x239057[_0x1f33('0x2e')];if(!_0x52afa3[_0x1f33('0x2f')]['hasOwnProperty'](_0x1f33('0x36'))){_0xa4f203[_0x1f33('0x37')]=qs['limit'](_0x52afa3[_0x1f33('0x2f')][_0x1f33('0x37')]);_0xa4f203['offset']=qs[_0x1f33('0x1b')](_0x52afa3[_0x1f33('0x2f')][_0x1f33('0x1b')]);}_0xa4f203[_0x1f33('0x38')]=qs['sort'](_0x52afa3['query'][_0x1f33('0x39')]);_0xa4f203[_0x1f33('0x3a')]=qs[_0x1f33('0x31')](_['pick'](_0x52afa3[_0x1f33('0x2f')],_0x239057[_0x1f33('0x31')]),_0xdb3d5a);if(_0x52afa3[_0x1f33('0x2f')][_0x1f33('0x3b')]){_0xa4f203[_0x1f33('0x3a')]=_[_0x1f33('0x3c')](_0xa4f203[_0x1f33('0x3a')],{'$or':_[_0x1f33('0x2a')](_0xdb3d5a,function(_0x370d6f){if(_0x370d6f[_0x1f33('0x2d')]!==_0x1f33('0x3d')){var _0x39f776={};_0x39f776[_0x370d6f['name']]={'$like':'%'+_0x52afa3[_0x1f33('0x2f')][_0x1f33('0x3b')]+'%'};return _0x39f776;}})});}_0xa4f203=_[_0x1f33('0x3c')]({},_0xa4f203,_0x52afa3[_0x1f33('0x3e')]);var _0x20e528={'where':_0xa4f203[_0x1f33('0x3a')]};return db[_0x1f33('0x2b')][_0x1f33('0x3f')](_0x20e528)['then'](function(_0x1f10b5){_0x26ba63['count']=_0x1f10b5;if(_0x52afa3['query'][_0x1f33('0x40')]){_0xa4f203[_0x1f33('0x41')]=[{'all':!![]}];}return db[_0x1f33('0x2b')][_0x1f33('0x42')](_0xa4f203);})[_0x1f33('0x22')](function(_0xff2e22){_0x26ba63['rows']=_0xff2e22;return _0x26ba63;})[_0x1f33('0x22')](respondWithFilteredResult(_0x4b511c,_0xa4f203))[_0x1f33('0x43')](handleError(_0x4b511c,null));};exports['show']=function(_0x2c66b7,_0x1afeed){var _0x1abffc={'raw':!![],'where':{'id':_0x2c66b7['params']['id']}},_0x2e3b21={};_0x2e3b21['model']=_[_0x1f33('0x30')](db[_0x1f33('0x2b')][_0x1f33('0x2c')]);_0x2e3b21[_0x1f33('0x2f')]=_[_0x1f33('0x30')](_0x2c66b7[_0x1f33('0x2f')]);_0x2e3b21[_0x1f33('0x31')]=_[_0x1f33('0x32')](_0x2e3b21[_0x1f33('0x2e')],_0x2e3b21['query']);_0x1abffc[_0x1f33('0x33')]=_[_0x1f33('0x32')](_0x2e3b21['model'],qs[_0x1f33('0x34')](_0x2c66b7[_0x1f33('0x2f')][_0x1f33('0x34')]));_0x1abffc[_0x1f33('0x33')]=_0x1abffc[_0x1f33('0x33')][_0x1f33('0x35')]?_0x1abffc['attributes']:_0x2e3b21[_0x1f33('0x2e')];if(_0x2c66b7[_0x1f33('0x2f')][_0x1f33('0x40')]){_0x1abffc[_0x1f33('0x41')]=[{'all':!![]}];}_0x1abffc=_['merge']({},_0x1abffc,_0x2c66b7[_0x1f33('0x3e')]);return db[_0x1f33('0x2b')][_0x1f33('0x44')](_0x1abffc)['then'](handleEntityNotFound(_0x1afeed,null))['then'](respondWithResult(_0x1afeed,null))[_0x1f33('0x43')](handleError(_0x1afeed,null));};exports['update']=function(_0x4e4b15,_0x4ee131){if(_0x4e4b15[_0x1f33('0x45')]['id']){delete _0x4e4b15['body']['id'];}return db['CmHopperBlack'][_0x1f33('0x44')]({'where':{'id':_0x4e4b15[_0x1f33('0x46')]['id']}})[_0x1f33('0x22')](handleEntityNotFound(_0x4ee131,null))[_0x1f33('0x22')](saveUpdates(_0x4e4b15['body'],null))[_0x1f33('0x22')](respondWithResult(_0x4ee131,null))[_0x1f33('0x43')](handleError(_0x4ee131,null));};exports[_0x1f33('0x21')]=function(_0x348c67,_0x1b9979){return db[_0x1f33('0x2b')][_0x1f33('0x44')]({'where':{'id':_0x348c67[_0x1f33('0x46')]['id']}})[_0x1f33('0x22')](handleEntityNotFound(_0x1b9979,null))['then'](removeEntity(_0x1b9979,null))[_0x1f33('0x43')](handleError(_0x1b9979,null));};exports[_0x1f33('0x47')]=function(_0x3cfa94,_0x20f59f){return db[_0x1f33('0x2b')]['describe']()[_0x1f33('0x22')](respondWithResult(_0x20f59f,null))[_0x1f33('0x43')](handleError(_0x20f59f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5306d3b..93926f9 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 _0x030a=['CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3d85ed,_0x2bc677){var _0xf2d579=function(_0x3f7dae){while(--_0x3f7dae){_0x3d85ed['push'](_0x3d85ed['shift']());}};_0xf2d579(++_0x2bc677);}(_0x030a,0x13d));var _0xa030=function(_0x10b4b8,_0x450fea){_0x10b4b8=_0x10b4b8-0x0;var _0x424293=_0x030a[_0x10b4b8];return _0x424293;};'use strict';var _=require('lodash');var util=require(_0xa030('0x0'));var logger=require(_0xa030('0x1'))(_0xa030('0x2'));var moment=require(_0xa030('0x3'));var BPromise=require(_0xa030('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa030('0x5'));var rimraf=require(_0xa030('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xff93be,_0x54fafa){return _0xff93be['define'](_0xa030('0x7'),attributes,{'tableName':_0xa030('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc13=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14fd85,_0x312dfc){var _0x5da3e9=function(_0x47fa21){while(--_0x47fa21){_0x14fd85['push'](_0x14fd85['shift']());}};_0x5da3e9(++_0x312dfc);}(_0xdc13,0xe9));var _0x3dc1=function(_0x3b507d,_0x54d3a6){_0x3b507d=_0x3b507d-0x0;var _0x4dca9b=_0xdc13[_0x3b507d];return _0x4dca9b;};'use strict';var _=require(_0x3dc1('0x0'));var util=require(_0x3dc1('0x1'));var logger=require(_0x3dc1('0x2'))(_0x3dc1('0x3'));var moment=require(_0x3dc1('0x4'));var BPromise=require(_0x3dc1('0x5'));var rp=require(_0x3dc1('0x6'));var fs=require('fs');var path=require(_0x3dc1('0x7'));var rimraf=require(_0x3dc1('0x8'));var config=require(_0x3dc1('0x9'));var attributes=require(_0x3dc1('0xa'));module[_0x3dc1('0xb')]=function(_0x389845,_0x5e0781){return _0x389845[_0x3dc1('0xc')](_0x3dc1('0xd'),attributes,{'tableName':_0x3dc1('0xe'),'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 a4c0228..75c31e5 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 _0x728a=['GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','info','UpdateCmHopperBlack','body','DestroyCmHopperBlack','CmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopperBlack,\x20%s,\x20%s','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x728a,0xf4));var _0xa728=function(_0x472fa8,_0x546f50){_0x472fa8=_0x472fa8-0x0;var _0x57f2f8=_0x728a[_0x472fa8];return _0x57f2f8;};'use strict';var _=require('lodash');var util=require(_0xa728('0x0'));var moment=require('moment');var BPromise=require(_0xa728('0x1'));var rs=require(_0xa728('0x2'));var fs=require('fs');var Redis=require(_0xa728('0x3'));var db=require(_0xa728('0x4'))['db'];var utils=require(_0xa728('0x5'));var logger=require(_0xa728('0x6'))(_0xa728('0x7'));var config=require(_0xa728('0x8'));var jayson=require(_0xa728('0x9'));var client=jayson[_0xa728('0xa')][_0xa728('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283e16,_0x58f4fb,_0x477ec7){return new BPromise(function(_0x4e9bb4,_0x1d2b33){return client[_0xa728('0xc')](_0x283e16,_0x477ec7)[_0xa728('0xd')](function(_0x39c669){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x58f4fb,_0xa728('0xe'));logger[_0xa728('0xf')](_0xa728('0x10'),_0x58f4fb,_0xa728('0xe'),JSON[_0xa728('0x11')](_0x39c669));if(_0x39c669[_0xa728('0x12')]){if(_0x39c669[_0xa728('0x12')]['code']===0x1f4){logger[_0xa728('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x58f4fb,_0x39c669[_0xa728('0x12')][_0xa728('0x13')]);return _0x1d2b33(_0x39c669['error'][_0xa728('0x13')]);}logger['error'](_0xa728('0x14'),_0x58f4fb,_0x39c669[_0xa728('0x12')]['message']);return _0x4e9bb4(_0x39c669[_0xa728('0x12')]['message']);}else{logger['info'](_0xa728('0x14'),_0x58f4fb,_0xa728('0xe'));_0x4e9bb4(_0x39c669['result'][_0xa728('0x13')]);}})[_0xa728('0x15')](function(_0x278ca9){logger[_0xa728('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x58f4fb,_0x278ca9);_0x1d2b33(_0x278ca9);});});}exports[_0xa728('0x16')]=function(_0x3762ad){var _0xc8d141=this;return new Promise(function(_0xf758a1,_0x3e8b9c){return db['CmHopperBlack'][_0xa728('0x17')]({'raw':_0x3762ad[_0xa728('0x18')]?_0x3762ad[_0xa728('0x18')][_0xa728('0x19')]===undefined?!![]:![]:!![],'where':_0x3762ad[_0xa728('0x18')]?_0x3762ad[_0xa728('0x18')][_0xa728('0x1a')]||null:null,'attributes':_0x3762ad['options']?_0x3762ad[_0xa728('0x18')][_0xa728('0x1b')]||null:null,'limit':_0x3762ad[_0xa728('0x18')]?_0x3762ad['options'][_0xa728('0x1c')]||null:null,'include':_0x3762ad[_0xa728('0x18')]?_0x3762ad[_0xa728('0x18')][_0xa728('0x1d')]?_[_0xa728('0x1e')](_0x3762ad[_0xa728('0x18')][_0xa728('0x1d')],function(_0x4f977e){return{'model':db[_0x4f977e['model']],'as':_0x4f977e['as'],'attributes':_0x4f977e[_0xa728('0x1b')],'include':_0x4f977e['include']?_['map'](_0x4f977e[_0xa728('0x1d')],function(_0x5625d3){return{'model':db[_0x5625d3[_0xa728('0x1f')]],'as':_0x5625d3['as'],'attributes':_0x5625d3['attributes'],'include':_0x5625d3[_0xa728('0x1d')]?_[_0xa728('0x1e')](_0x5625d3['include'],function(_0x3dc5c6){return{'model':db[_0x3dc5c6[_0xa728('0x1f')]],'as':_0x3dc5c6['as'],'attributes':_0x3dc5c6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa728('0xd')](function(_0x14f7e5){logger[_0xa728('0x20')](_0xa728('0x16'),_0x3762ad);logger[_0xa728('0xf')](_0xa728('0x16'),_0x3762ad,JSON[_0xa728('0x11')](_0x14f7e5));_0xf758a1(_0x14f7e5);})[_0xa728('0x15')](function(_0x1fbc56){logger[_0xa728('0x12')]('GetCmHopperBlack',_0x1fbc56['message'],_0x3762ad);_0x3e8b9c(_0xc8d141[_0xa728('0x12')](0x1f4,_0x1fbc56[_0xa728('0x13')]));});});};exports[_0xa728('0x21')]=function(_0x2e286e){var _0x52b9cd=this;return new Promise(function(_0x553785,_0x404d0c){return db['CmHopperBlack']['update'](_0x2e286e[_0xa728('0x22')],{'raw':_0x2e286e[_0xa728('0x18')]?_0x2e286e[_0xa728('0x18')][_0xa728('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e286e[_0xa728('0x18')]?_0x2e286e[_0xa728('0x18')][_0xa728('0x1a')]||null:null,'attributes':_0x2e286e[_0xa728('0x18')]?_0x2e286e[_0xa728('0x18')][_0xa728('0x1b')]||null:null,'limit':_0x2e286e['options']?_0x2e286e[_0xa728('0x18')][_0xa728('0x1c')]||null:null})[_0xa728('0xd')](function(_0x35349e){logger['info'](_0xa728('0x21'),_0x2e286e);logger[_0xa728('0xf')](_0xa728('0x21'),_0x2e286e,JSON[_0xa728('0x11')](_0x35349e));_0x553785(_0x35349e);})[_0xa728('0x15')](function(_0x299660){logger[_0xa728('0x12')](_0xa728('0x21'),_0x299660[_0xa728('0x13')],_0x2e286e);_0x404d0c(_0x52b9cd['error'](0x1f4,_0x299660[_0xa728('0x13')]));});});};exports[_0xa728('0x23')]=function(_0x1112d2){var _0x187278=this;return new Promise(function(_0x48e584,_0x1d1320){return db[_0xa728('0x24')][_0xa728('0x25')]({'where':_0x1112d2[_0xa728('0x18')]?_0x1112d2['options'][_0xa728('0x1a')]||null:null})[_0xa728('0xd')](function(_0x4ed093){logger[_0xa728('0x20')](_0xa728('0x23'),_0x1112d2);logger[_0xa728('0xf')](_0xa728('0x23'),_0x1112d2,JSON[_0xa728('0x11')](_0x4ed093));_0x48e584(_0x4ed093);})[_0xa728('0x15')](function(_0x56f87a){logger[_0xa728('0x12')](_0xa728('0x23'),_0x56f87a[_0xa728('0x13')],_0x1112d2);_0x1d1320(_0x187278[_0xa728('0x12')](0x1f4,_0x56f87a[_0xa728('0x13')]));});});}; \ No newline at end of file +var _0x3021=['../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','attributes','model','debug','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3021,0xae));var _0x1302=function(_0x381d84,_0x5c5350){_0x381d84=_0x381d84-0x0;var _0x29d847=_0x3021[_0x381d84];return _0x29d847;};'use strict';var _=require('lodash');var util=require(_0x1302('0x0'));var moment=require(_0x1302('0x1'));var BPromise=require(_0x1302('0x2'));var rs=require(_0x1302('0x3'));var fs=require('fs');var Redis=require(_0x1302('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1302('0x5'));var logger=require(_0x1302('0x6'))('rpc');var config=require(_0x1302('0x7'));var jayson=require(_0x1302('0x8'));var client=jayson['client'][_0x1302('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46b709,_0x1eda0a,_0x3a1ad0){return new BPromise(function(_0x1acea0,_0x46382d){return client['request'](_0x46b709,_0x3a1ad0)[_0x1302('0xa')](function(_0x216b25){logger[_0x1302('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x1eda0a,_0x1302('0xc'));logger['debug'](_0x1302('0xd'),_0x1eda0a,'request\x20sent',JSON[_0x1302('0xe')](_0x216b25));if(_0x216b25['error']){if(_0x216b25[_0x1302('0xf')][_0x1302('0x10')]===0x1f4){logger[_0x1302('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x1eda0a,_0x216b25[_0x1302('0xf')][_0x1302('0x11')]);return _0x46382d(_0x216b25[_0x1302('0xf')]['message']);}logger[_0x1302('0xf')](_0x1302('0x12'),_0x1eda0a,_0x216b25[_0x1302('0xf')][_0x1302('0x11')]);return _0x1acea0(_0x216b25[_0x1302('0xf')][_0x1302('0x11')]);}else{logger[_0x1302('0xb')](_0x1302('0x12'),_0x1eda0a,_0x1302('0xc'));_0x1acea0(_0x216b25[_0x1302('0x13')][_0x1302('0x11')]);}})[_0x1302('0x14')](function(_0xa525e1){logger[_0x1302('0xf')](_0x1302('0x12'),_0x1eda0a,_0xa525e1);_0x46382d(_0xa525e1);});});}exports[_0x1302('0x15')]=function(_0x388912){var _0x1798e2=this;return new Promise(function(_0x349909,_0x503b13){return db[_0x1302('0x16')][_0x1302('0x17')]({'raw':_0x388912[_0x1302('0x18')]?_0x388912[_0x1302('0x18')][_0x1302('0x19')]===undefined?!![]:![]:!![],'where':_0x388912[_0x1302('0x18')]?_0x388912[_0x1302('0x18')][_0x1302('0x1a')]||null:null,'attributes':_0x388912[_0x1302('0x18')]?_0x388912[_0x1302('0x18')]['attributes']||null:null,'limit':_0x388912[_0x1302('0x18')]?_0x388912[_0x1302('0x18')][_0x1302('0x1b')]||null:null,'include':_0x388912['options']?_0x388912[_0x1302('0x18')][_0x1302('0x1c')]?_[_0x1302('0x1d')](_0x388912[_0x1302('0x18')]['include'],function(_0x154fbe){return{'model':db[_0x154fbe['model']],'as':_0x154fbe['as'],'attributes':_0x154fbe[_0x1302('0x1e')],'include':_0x154fbe[_0x1302('0x1c')]?_[_0x1302('0x1d')](_0x154fbe[_0x1302('0x1c')],function(_0x546f02){return{'model':db[_0x546f02[_0x1302('0x1f')]],'as':_0x546f02['as'],'attributes':_0x546f02['attributes'],'include':_0x546f02[_0x1302('0x1c')]?_[_0x1302('0x1d')](_0x546f02[_0x1302('0x1c')],function(_0x34b9e0){return{'model':db[_0x34b9e0[_0x1302('0x1f')]],'as':_0x34b9e0['as'],'attributes':_0x34b9e0[_0x1302('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1302('0xa')](function(_0x25d874){logger[_0x1302('0xb')](_0x1302('0x15'),_0x388912);logger[_0x1302('0x20')](_0x1302('0x15'),_0x388912,JSON['stringify'](_0x25d874));_0x349909(_0x25d874);})['catch'](function(_0x73847d){logger[_0x1302('0xf')](_0x1302('0x15'),_0x73847d[_0x1302('0x11')],_0x388912);_0x503b13(_0x1798e2[_0x1302('0xf')](0x1f4,_0x73847d[_0x1302('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x56c55c){var _0x32a6f9=this;return new Promise(function(_0x2f4448,_0x404da4){return db[_0x1302('0x16')]['update'](_0x56c55c['body'],{'raw':_0x56c55c[_0x1302('0x18')]?_0x56c55c[_0x1302('0x18')][_0x1302('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c55c[_0x1302('0x18')]?_0x56c55c['options'][_0x1302('0x1a')]||null:null,'attributes':_0x56c55c['options']?_0x56c55c[_0x1302('0x18')]['attributes']||null:null,'limit':_0x56c55c[_0x1302('0x18')]?_0x56c55c['options'][_0x1302('0x1b')]||null:null})[_0x1302('0xa')](function(_0x2f45d8){logger[_0x1302('0xb')](_0x1302('0x21'),_0x56c55c);logger[_0x1302('0x20')](_0x1302('0x21'),_0x56c55c,JSON[_0x1302('0xe')](_0x2f45d8));_0x2f4448(_0x2f45d8);})[_0x1302('0x14')](function(_0x282122){logger[_0x1302('0xf')](_0x1302('0x21'),_0x282122[_0x1302('0x11')],_0x56c55c);_0x404da4(_0x32a6f9[_0x1302('0xf')](0x1f4,_0x282122['message']));});});};exports['DestroyCmHopperBlack']=function(_0x25b9aa){var _0x125f5d=this;return new Promise(function(_0x226761,_0x1fd2ab){return db[_0x1302('0x16')][_0x1302('0x22')]({'where':_0x25b9aa['options']?_0x25b9aa['options'][_0x1302('0x1a')]||null:null})[_0x1302('0xa')](function(_0x27ef97){logger[_0x1302('0xb')](_0x1302('0x23'),_0x25b9aa);logger[_0x1302('0x20')](_0x1302('0x23'),_0x25b9aa,JSON[_0x1302('0xe')](_0x27ef97));_0x226761(_0x27ef97);})[_0x1302('0x14')](function(_0x251839){logger['error']('DestroyCmHopperBlack',_0x251839[_0x1302('0x11')],_0x25b9aa);_0x1fd2ab(_0x125f5d[_0x1302('0xf')](0x1f4,_0x251839[_0x1302('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c5f0bbd..fa06016 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 _0x425d=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5e53ae,_0x24af4f){var _0x27a8a2=function(_0xa6a715){while(--_0xa6a715){_0x5e53ae['push'](_0x5e53ae['shift']());}};_0x27a8a2(++_0x24af4f);}(_0x425d,0x1e0));var _0xd425=function(_0xaa0cb9,_0x28081b){_0xaa0cb9=_0xaa0cb9-0x0;var _0x548207=_0x425d[_0xaa0cb9];return _0x548207;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./cmHopperBlack.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0xe')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);module[_0xd425('0x12')]=router; \ No newline at end of file +var _0x4b84=['./cmHopperBlack.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x40951a,_0x2cbe60){var _0xdb2028=function(_0x134fa6){while(--_0x134fa6){_0x40951a['push'](_0x40951a['shift']());}};_0xdb2028(++_0x2cbe60);}(_0x4b84,0x1cc));var _0x44b8=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x4b84[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x9')](_0x44b8('0xa'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);router[_0x44b8('0xc')](_0x44b8('0xa'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xd')]);module[_0x44b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a91c161..67a1893 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 _0xe780=['moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe780,0x90));var _0x0e78=function(_0x2a8a57,_0x28403f){_0x2a8a57=_0x2a8a57-0x0;var _0x2db821=_0xe780[_0x2a8a57];return _0x2db821;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0e78('0x0'));module[_0x0e78('0x1')]={'state':{'type':Sequelize[_0x0e78('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0e78('0x3')]},'scheduledat':{'type':Sequelize[_0x0e78('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0e78('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0e78('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0e78('0x3')]},'calleridnum':{'type':Sequelize[_0x0e78('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0e78('0x4')]},'responsetime':{'type':Sequelize[_0x0e78('0x4')]},'answertime':{'type':Sequelize[_0x0e78('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0e78('0x3')]},'campaign':{'type':Sequelize[_0x0e78('0x3')]},'campaigntype':{'type':Sequelize[_0x0e78('0x3')]},'membername':{'type':Sequelize[_0x0e78('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0e78('0x3')]},'secondDisposition':{'type':Sequelize[_0x0e78('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0e78('0x3')]},'dispositionat':{'type':Sequelize[_0x0e78('0x4')],'set':function(_0x242e91){var _0x10e1f7=this[_0x0e78('0x5')](_0x0e78('0x6'));if(_0x10e1f7&&_0x242e91){this[_0x0e78('0x7')](_0x0e78('0x8'),moment(_0x242e91)['diff'](moment(_0x10e1f7),_0x0e78('0x9')));}return this[_0x0e78('0x7')](_0x0e78('0xa'),_0x242e91);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0e78('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0e78('0x4')]},'callback':{'type':Sequelize[_0x0e78('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0e78('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0e78('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0e78('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0e78('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdfc5=['seconds','setDataValue','dispositionat','BOOLEAN','exports','STRING','INTEGER','DATE','followuptime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdfc5,0x136));var _0x5dfc=function(_0xbdff5a,_0x18ec2b){_0xbdff5a=_0xbdff5a-0x0;var _0x4049dc=_0xdfc5[_0xbdff5a];return _0x4049dc;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x5dfc('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5dfc('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5dfc('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x5dfc('0x1')]},'originatecalleridname':{'type':Sequelize[_0x5dfc('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dfc('0x1')]},'starttime':{'type':Sequelize[_0x5dfc('0x3')]},'responsetime':{'type':Sequelize[_0x5dfc('0x3')]},'answertime':{'type':Sequelize[_0x5dfc('0x3')]},'droptime':{'type':Sequelize[_0x5dfc('0x3')]},'endtime':{'type':Sequelize[_0x5dfc('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5dfc('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5dfc('0x1')]},'reason':{'type':Sequelize[_0x5dfc('0x1')]},'disposition':{'type':Sequelize[_0x5dfc('0x1')]},'secondDisposition':{'type':Sequelize[_0x5dfc('0x1')]},'thirdDisposition':{'type':Sequelize[_0x5dfc('0x1')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x28233d){var _0x5a3c7f=this['getDataValue']('endtime');if(_0x5a3c7f&&_0x28233d){this['setDataValue'](_0x5dfc('0x4'),moment(_0x28233d)['diff'](moment(_0x5a3c7f),_0x5dfc('0x5')));}return this[_0x5dfc('0x6')](_0x5dfc('0x7'),_0x28233d);}},'amd':{'type':Sequelize[_0x5dfc('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5dfc('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5dfc('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5dfc('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5dfc('0x3')]},'callback':{'type':Sequelize[_0x5dfc('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5dfc('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5dfc('0x3')]},'deleted':{'type':Sequelize[_0x5dfc('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5dfc('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5dfc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5dfc('0x2')],'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 0018c6f..fc14c3b 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 _0xb43b=['includeAll','include','findAll','rows','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','CmHopperFinal'];(function(_0x32e54a,_0x59fc0d){var _0x109af4=function(_0x564be8){while(--_0x564be8){_0x32e54a['push'](_0x32e54a['shift']());}};_0x109af4(++_0x59fc0d);}(_0xb43b,0xbf));var _0xbb43=function(_0x276eaf,_0x541331){_0x276eaf=_0x276eaf-0x0;var _0x161262=_0xb43b[_0x276eaf];return _0x161262;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb43('0x1'));var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require(_0xbb43('0x5'));var BPromise=require(_0xbb43('0x6'));var Mustache=require(_0xbb43('0x7'));var util=require(_0xbb43('0x8'));var path=require(_0xbb43('0x9'));var sox=require(_0xbb43('0xa'));var csv=require(_0xbb43('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xb'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2867fb,_0x5d0ccc){_0x5d0ccc=_0x5d0ccc||0xcc;return function(_0x6be368){if(_0x6be368){return _0x2867fb['sendStatus'](_0x5d0ccc);}return _0x2867fb[_0xbb43('0x17')](_0x5d0ccc)[_0xbb43('0x18')]();};}function respondWithResult(_0x3ce968,_0x3327bc){_0x3327bc=_0x3327bc||0xc8;return function(_0x2e2517){if(_0x2e2517){return _0x3ce968['status'](_0x3327bc)[_0xbb43('0x19')](_0x2e2517);}};}function respondWithFilteredResult(_0x4ac25c,_0x199726){return function(_0x32425c){if(_0x32425c){var _0x15182b=_0x32425c[_0xbb43('0x1a')],_0x10c91b=_0x199726[_0xbb43('0x1b')],_0x3be44b=_0x199726[_0xbb43('0x1b')]+_0x199726[_0xbb43('0x1c')],_0x126f61;if(_0x3be44b>=_0x15182b){_0x3be44b=_0x15182b;_0x126f61=0xc8;}else{_0x126f61=0xce;}_0x4ac25c[_0xbb43('0x17')](_0x126f61);return _0x4ac25c['set'](_0xbb43('0x1d'),_0x10c91b+'-'+_0x3be44b+'/'+_0x15182b)['json'](_0x32425c);}return null;};}function patchUpdates(_0x44fd04){return function(_0x5f4b4f){try{jsonpatch[_0xbb43('0x1e')](_0x5f4b4f,_0x44fd04,!![]);}catch(_0x27579a){return BPromise['reject'](_0x27579a);}return _0x5f4b4f[_0xbb43('0x1f')]();};}function saveUpdates(_0x6cdc26,_0x398ce5){return function(_0x6f34d6){if(_0x6f34d6){return _0x6f34d6[_0xbb43('0x20')](_0x6cdc26)[_0xbb43('0x21')](function(_0xee1084){return _0xee1084;});}return null;};}function removeEntity(_0x1e83cd,_0x3409d0){return function(_0x3cb6d1){if(_0x3cb6d1){return _0x3cb6d1[_0xbb43('0x22')]()[_0xbb43('0x21')](function(){_0x1e83cd[_0xbb43('0x17')](0xcc)[_0xbb43('0x18')]();});}};}function handleEntityNotFound(_0x500af4,_0x28b3e4){return function(_0x326864){if(!_0x326864){_0x500af4['sendStatus'](0x194);}return _0x326864;};}function handleError(_0x464b4a,_0x2b07d8){_0x2b07d8=_0x2b07d8||0x1f4;return function(_0x25279b){logger['error'](_0x25279b['stack']);if(_0x25279b[_0xbb43('0x23')]){delete _0x25279b[_0xbb43('0x23')];}_0x464b4a['status'](_0x2b07d8)['send'](_0x25279b);};}exports[_0xbb43('0x24')]=function(_0xb9fe3b,_0x268fb5){var _0x4bb859={},_0x27bb65={},_0x426cec={'count':0x0,'rows':[]};var _0x2dcc60=_[_0xbb43('0x25')](db['CmHopperFinal'][_0xbb43('0x26')],function(_0x170e7a){return{'name':_0x170e7a[_0xbb43('0x27')],'type':_0x170e7a[_0xbb43('0x28')][_0xbb43('0x29')]};});_0x27bb65[_0xbb43('0x2a')]=_[_0xbb43('0x25')](_0x2dcc60,'name');_0x27bb65[_0xbb43('0x2b')]=_[_0xbb43('0x2c')](_0xb9fe3b[_0xbb43('0x2b')]);_0x27bb65['filters']=_[_0xbb43('0x2d')](_0x27bb65[_0xbb43('0x2a')],_0x27bb65[_0xbb43('0x2b')]);_0x4bb859[_0xbb43('0x2e')]=_[_0xbb43('0x2d')](_0x27bb65[_0xbb43('0x2a')],qs[_0xbb43('0x2f')](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x2f')]));_0x4bb859['attributes']=_0x4bb859['attributes']['length']?_0x4bb859['attributes']:_0x27bb65[_0xbb43('0x2a')];if(!_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x30')](_0xbb43('0x31'))){_0x4bb859[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x1c')]);_0x4bb859['offset']=qs[_0xbb43('0x1b')](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x1b')]);}_0x4bb859[_0xbb43('0x32')]=qs['sort'](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x33')]);_0x4bb859[_0xbb43('0x34')]=qs[_0xbb43('0x35')](_['pick'](_0xb9fe3b[_0xbb43('0x2b')],_0x27bb65['filters']),_0x2dcc60);if(_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x36')]){_0x4bb859[_0xbb43('0x34')]=_[_0xbb43('0x37')](_0x4bb859[_0xbb43('0x34')],{'$or':_[_0xbb43('0x25')](_0x2dcc60,function(_0x316ab1){if(_0x316ab1[_0xbb43('0x28')]!==_0xbb43('0x38')){var _0xa48590={};_0xa48590[_0x316ab1[_0xbb43('0x23')]]={'$like':'%'+_0xb9fe3b[_0xbb43('0x2b')]['filter']+'%'};return _0xa48590;}})});}_0x4bb859=_[_0xbb43('0x37')]({},_0x4bb859,_0xb9fe3b[_0xbb43('0x39')]);var _0x363e1a={'where':_0x4bb859[_0xbb43('0x34')]};return db[_0xbb43('0x3a')][_0xbb43('0x1a')](_0x363e1a)[_0xbb43('0x21')](function(_0x3d7d56){_0x426cec[_0xbb43('0x1a')]=_0x3d7d56;if(_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x3b')]){_0x4bb859[_0xbb43('0x3c')]=[{'all':!![]}];}return db[_0xbb43('0x3a')][_0xbb43('0x3d')](_0x4bb859);})[_0xbb43('0x21')](function(_0x4a76a8){_0x426cec[_0xbb43('0x3e')]=_0x4a76a8;return _0x426cec;})[_0xbb43('0x21')](respondWithFilteredResult(_0x268fb5,_0x4bb859))[_0xbb43('0x3f')](handleError(_0x268fb5,null));};exports[_0xbb43('0x40')]=function(_0x60a465,_0x4b32c9){var _0x5e942e={'raw':!![],'where':{'id':_0x60a465[_0xbb43('0x41')]['id']}},_0x13e9f7={};_0x13e9f7['model']=_['keys'](db[_0xbb43('0x3a')][_0xbb43('0x26')]);_0x13e9f7[_0xbb43('0x2b')]=_[_0xbb43('0x2c')](_0x60a465[_0xbb43('0x2b')]);_0x13e9f7['filters']=_['intersection'](_0x13e9f7[_0xbb43('0x2a')],_0x13e9f7[_0xbb43('0x2b')]);_0x5e942e[_0xbb43('0x2e')]=_[_0xbb43('0x2d')](_0x13e9f7[_0xbb43('0x2a')],qs[_0xbb43('0x2f')](_0x60a465[_0xbb43('0x2b')][_0xbb43('0x2f')]));_0x5e942e[_0xbb43('0x2e')]=_0x5e942e[_0xbb43('0x2e')]['length']?_0x5e942e['attributes']:_0x13e9f7[_0xbb43('0x2a')];if(_0x60a465[_0xbb43('0x2b')]['includeAll']){_0x5e942e[_0xbb43('0x3c')]=[{'all':!![]}];}_0x5e942e=_[_0xbb43('0x37')]({},_0x5e942e,_0x60a465[_0xbb43('0x39')]);return db[_0xbb43('0x3a')][_0xbb43('0x42')](_0x5e942e)[_0xbb43('0x21')](handleEntityNotFound(_0x4b32c9,null))[_0xbb43('0x21')](respondWithResult(_0x4b32c9,null))['catch'](handleError(_0x4b32c9,null));};exports[_0xbb43('0x43')]=function(_0x229928,_0x5970cc){return db[_0xbb43('0x3a')][_0xbb43('0x43')]()['then'](respondWithResult(_0x5970cc,null))[_0xbb43('0x3f')](handleError(_0x5970cc,null));};exports[_0xbb43('0x20')]=function(_0xd1f32b,_0x15fab6){if(_0xd1f32b[_0xbb43('0x44')][_0xbb43('0x45')]){delete _0xd1f32b[_0xbb43('0x44')][_0xbb43('0x45')];}return db[_0xbb43('0x3a')][_0xbb43('0x42')]({'where':{'uniqueid':_0xd1f32b[_0xbb43('0x41')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x15fab6,null))['then'](saveUpdates(_0xd1f32b[_0xbb43('0x44')],null))[_0xbb43('0x21')](respondWithResult(_0x15fab6,null))[_0xbb43('0x3f')](handleError(_0x15fab6,null));};exports[_0xbb43('0x46')]=function(_0x4ab63b,_0x33d21b,_0x4998fb){return db[_0xbb43('0x3a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4ab63b[_0xbb43('0x41')]['id']},'attributes':[[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db['sequelize']['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4a')))),'noSuchContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db['sequelize']['fn']('IF',db[_0xbb43('0x47')]['literal'](_0xbb43('0x4b')))),_0xbb43('0x4c')],[db['sequelize']['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')]['literal'](_0xbb43('0x4d')))),'busyContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x4e')))),'congestionContacts'],[db['sequelize']['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db['sequelize']['literal'](_0xbb43('0x4f')))),'dropContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x50')))),'reCallContacts'],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x51')))),_0xbb43('0x52')]]})[_0xbb43('0x21')](handleEntityNotFound(_0x33d21b,null))['then'](respondWithResult(_0x33d21b,null))[_0xbb43('0x3f')](handleError(_0x33d21b,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3f3292,_0x213747,_0x512619){return db[_0xbb43('0x3a')][_0xbb43('0x3d')]({'raw':![],'where':{'CampaignId':_0x3f3292['params']['id']},'attributes':[[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4a')))),_0xbb43('0x53')],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x4b')))),'noAnswerContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4d')))),_0xbb43('0x54')],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4e')))),'congestionContacts'],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x4f')))),_0xbb43('0x55')],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x56')))),_0xbb43('0x57')],[db['sequelize']['fn'](_0xbb43('0x48'),db['sequelize']['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x50')))),_0xbb43('0x58')],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')]['literal'](_0xbb43('0x51')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x213747,null))[_0xbb43('0x21')](respondWithResult(_0x213747,null))['catch'](handleError(_0x213747,null));};exports[_0xbb43('0x59')]=function(_0x212dc9,_0x4eb58f,_0x221727){return db[_0xbb43('0x5a')]['find']({'where':{'id':_0x212dc9[_0xbb43('0x41')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x4eb58f,null))[_0xbb43('0x21')](function(_0x14678c){var _0x40ac8c;if(_0x14678c){_0x40ac8c=squel[_0xbb43('0x5b')]()[_0xbb43('0x5c')](_0xbb43('0x5d'))[_0xbb43('0x5e')]([_0xbb43('0x5f'),_0xbb43('0x60'),_0xbb43('0x61'),_0xbb43('0x62'),_0xbb43('0x63'),_0xbb43('0x64'),_0xbb43('0x65')],squel[_0xbb43('0x66')]()[_0xbb43('0x67')](_0xbb43('0x68'),_0xbb43('0x5f'))[_0xbb43('0x67')](_0xbb43('0x69'),_0xbb43('0x60'))[_0xbb43('0x67')](_0xbb43('0x6a'),_0xbb43('0x61'))[_0xbb43('0x67')](_0xbb43('0x6b'),_0xbb43('0x62'))[_0xbb43('0x67')]('ANY_VALUE(VoiceQueueId)',_0xbb43('0x63'))[_0xbb43('0x67')](_0xbb43('0x69'),_0xbb43('0x64'))[_0xbb43('0x67')](_0xbb43('0x69'),'updatedAt')[_0xbb43('0x6c')](_0xbb43('0x6d'))['where']('VoiceQueueId\x20=\x20?',_0x212dc9['params']['id'][_0xbb43('0x6e')]())[_0xbb43('0x34')](_0xbb43('0x6f'),_0x212dc9[_0xbb43('0x44')]['state']['toString']())[_0xbb43('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xbb43('0x34')](_0xbb43('0x70'),squel['select']()[_0xbb43('0x67')](_0xbb43('0x5f'))[_0xbb43('0x6c')]('cm_hopper')[_0xbb43('0x34')]('VoiceQueueId\x20=\x20?',_0x212dc9[_0xbb43('0x41')]['id'][_0xbb43('0x6e')]()))['where'](_0xbb43('0x70'),squel[_0xbb43('0x66')]()[_0xbb43('0x67')](_0xbb43('0x71'))[_0xbb43('0x6c')]('cm_hopper_final')['where'](_0xbb43('0x72'),_0x212dc9[_0xbb43('0x41')]['id'][_0xbb43('0x6e')]())[_0xbb43('0x34')](_0xbb43('0x73')))[_0xbb43('0x74')](_0xbb43('0x61')))[_0xbb43('0x6e')]();return db['sequelize'][_0xbb43('0x2b')](_0x40ac8c);}return[];})['then'](respondWithResult(_0x4eb58f,null))[_0xbb43('0x3f')](handleError(_0x4eb58f,null));};exports[_0xbb43('0x75')]=function(_0x4cee24,_0x371a7c,_0x1ba677){return db[_0xbb43('0x76')][_0xbb43('0x42')]({'where':{'id':_0x4cee24[_0xbb43('0x41')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x371a7c,null))['then'](function(_0x3d0182){var _0x2d18e7;if(_0x3d0182){_0x2d18e7=squel['insert']()[_0xbb43('0x5c')]('cm_hopper')[_0xbb43('0x5e')]([_0xbb43('0x5f'),_0xbb43('0x60'),_0xbb43('0x61'),_0xbb43('0x62'),_0xbb43('0x77'),_0xbb43('0x64'),_0xbb43('0x65')],squel[_0xbb43('0x66')]()[_0xbb43('0x67')](_0xbb43('0x68'),'phone')[_0xbb43('0x67')]('NOW()',_0xbb43('0x60'))[_0xbb43('0x67')](_0xbb43('0x6a'),_0xbb43('0x61'))[_0xbb43('0x67')]('ANY_VALUE(ListId)',_0xbb43('0x62'))[_0xbb43('0x67')](_0xbb43('0x78'),_0xbb43('0x77'))[_0xbb43('0x67')]('NOW()',_0xbb43('0x64'))['field'](_0xbb43('0x69'),_0xbb43('0x65'))[_0xbb43('0x6c')](_0xbb43('0x6d'))[_0xbb43('0x34')]('CampaignId\x20=\x20?',_0x4cee24[_0xbb43('0x41')]['id']['toString']())[_0xbb43('0x34')]('state\x20=\x20?',_0x4cee24[_0xbb43('0x44')]['state'][_0xbb43('0x6e')]())[_0xbb43('0x34')](_0xbb43('0x79'))['where'](_0xbb43('0x70'),squel['select']()[_0xbb43('0x67')](_0xbb43('0x5f'))['from'](_0xbb43('0x5d'))[_0xbb43('0x34')](_0xbb43('0x7a'),_0x4cee24[_0xbb43('0x41')]['id']['toString']()))[_0xbb43('0x34')](_0xbb43('0x70'),squel['select']()['field']('calleridnum')[_0xbb43('0x6c')]('cm_hopper_final')[_0xbb43('0x34')](_0xbb43('0x7a'),_0x4cee24[_0xbb43('0x41')]['id']['toString']())['where'](_0xbb43('0x73')))[_0xbb43('0x74')](_0xbb43('0x61')))[_0xbb43('0x6e')]();return db['sequelize'][_0xbb43('0x2b')](_0x2d18e7);}return[];})[_0xbb43('0x21')](respondWithResult(_0x371a7c,null))[_0xbb43('0x3f')](handleError(_0x371a7c,null));};exports['checkContactHopper']=function(_0x202f08,_0xc9623,_0x75999e){return db[_0xbb43('0x7b')][_0xbb43('0x7c')]({'where':{'VoiceQueueId':_0x202f08['body'][_0xbb43('0x63')],'CampaignId':_0x202f08['body'][_0xbb43('0x77')],'ContactId':_0x202f08[_0xbb43('0x44')][_0xbb43('0x61')]}})[_0xbb43('0x21')](handleEntityNotFound(_0xc9623,null))['then'](function(_0x3174ea){if(_0x3174ea){return _0x3174ea;}return null;})['then'](respondWithResult(_0xc9623,null))[_0xbb43('0x3f')](handleError(_0xc9623,null));}; \ No newline at end of file +var _0xd382=['busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','createdAt','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','index','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','rows','show','params','rawAttributes','find','describe','catch','uniqueid','body','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd382,0x1b6));var _0x2d38=function(_0x18d49f,_0x15211e){_0x18d49f=_0x18d49f-0x0;var _0x52086a=_0xd382[_0x18d49f];return _0x52086a;};'use strict';var pdf=require(_0x2d38('0x0'));var emlformat=require(_0x2d38('0x1'));var rimraf=require(_0x2d38('0x2'));var zipdir=require(_0x2d38('0x3'));var jsonpatch=require(_0x2d38('0x4'));var rp=require(_0x2d38('0x5'));var moment=require(_0x2d38('0x6'));var BPromise=require(_0x2d38('0x7'));var Mustache=require(_0x2d38('0x8'));var util=require(_0x2d38('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d38('0xa'));var fs=require('fs');var _=require(_0x2d38('0xb'));var squel=require('squel');var crypto=require(_0x2d38('0xc'));var jsforce=require(_0x2d38('0xd'));var deskjs=require(_0x2d38('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d38('0xf'));var Redis=require(_0x2d38('0x10'));var authService=require(_0x2d38('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2d38('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d38('0x13'))(_0x2d38('0x14'));var utils=require(_0x2d38('0x15'));var config=require(_0x2d38('0x16'));var licenseUtil=require(_0x2d38('0x17'));var db=require(_0x2d38('0x18'))['db'];function respondWithStatusCode(_0x3c068b,_0x4ed69b){_0x4ed69b=_0x4ed69b||0xcc;return function(_0x3dd2c1){if(_0x3dd2c1){return _0x3c068b[_0x2d38('0x19')](_0x4ed69b);}return _0x3c068b[_0x2d38('0x1a')](_0x4ed69b)[_0x2d38('0x1b')]();};}function respondWithResult(_0x149ac2,_0x5cc0a4){_0x5cc0a4=_0x5cc0a4||0xc8;return function(_0x1c7c1d){if(_0x1c7c1d){return _0x149ac2[_0x2d38('0x1a')](_0x5cc0a4)[_0x2d38('0x1c')](_0x1c7c1d);}};}function respondWithFilteredResult(_0x1a2e74,_0x408141){return function(_0xf346b2){if(_0xf346b2){var _0xc6de5a=_0xf346b2[_0x2d38('0x1d')],_0x2d3cb1=_0x408141[_0x2d38('0x1e')],_0xc17f9e=_0x408141[_0x2d38('0x1e')]+_0x408141[_0x2d38('0x1f')],_0x6d2a9a;if(_0xc17f9e>=_0xc6de5a){_0xc17f9e=_0xc6de5a;_0x6d2a9a=0xc8;}else{_0x6d2a9a=0xce;}_0x1a2e74[_0x2d38('0x1a')](_0x6d2a9a);return _0x1a2e74[_0x2d38('0x20')]('Content-Range',_0x2d3cb1+'-'+_0xc17f9e+'/'+_0xc6de5a)[_0x2d38('0x1c')](_0xf346b2);}return null;};}function patchUpdates(_0x235fb6){return function(_0x508b8b){try{jsonpatch[_0x2d38('0x21')](_0x508b8b,_0x235fb6,!![]);}catch(_0x353874){return BPromise[_0x2d38('0x22')](_0x353874);}return _0x508b8b['save']();};}function saveUpdates(_0x46f8be,_0x5ed42e){return function(_0x4bdac6){if(_0x4bdac6){return _0x4bdac6[_0x2d38('0x23')](_0x46f8be)[_0x2d38('0x24')](function(_0x3713ea){return _0x3713ea;});}return null;};}function removeEntity(_0x3892a5,_0x19e658){return function(_0x3138bc){if(_0x3138bc){return _0x3138bc[_0x2d38('0x25')]()[_0x2d38('0x24')](function(){_0x3892a5[_0x2d38('0x1a')](0xcc)[_0x2d38('0x1b')]();});}};}function handleEntityNotFound(_0x584e1f,_0x3283b4){return function(_0x4826d1){if(!_0x4826d1){_0x584e1f[_0x2d38('0x19')](0x194);}return _0x4826d1;};}function handleError(_0x530fd9,_0x1e3d6a){_0x1e3d6a=_0x1e3d6a||0x1f4;return function(_0xfa9bd){logger[_0x2d38('0x26')](_0xfa9bd[_0x2d38('0x27')]);if(_0xfa9bd[_0x2d38('0x28')]){delete _0xfa9bd[_0x2d38('0x28')];}_0x530fd9[_0x2d38('0x1a')](_0x1e3d6a)['send'](_0xfa9bd);};}exports[_0x2d38('0x29')]=function(_0x3f0f7a,_0x34599a){var _0x3d18cd={},_0x346934={},_0xe73710={'count':0x0,'rows':[]};var _0x81299c=_[_0x2d38('0x2a')](db['CmHopperFinal']['rawAttributes'],function(_0x5570c2){return{'name':_0x5570c2[_0x2d38('0x2b')],'type':_0x5570c2[_0x2d38('0x2c')][_0x2d38('0x2d')]};});_0x346934['model']=_[_0x2d38('0x2a')](_0x81299c,'name');_0x346934[_0x2d38('0x2e')]=_[_0x2d38('0x2f')](_0x3f0f7a[_0x2d38('0x2e')]);_0x346934['filters']=_[_0x2d38('0x30')](_0x346934[_0x2d38('0x31')],_0x346934[_0x2d38('0x2e')]);_0x3d18cd['attributes']=_[_0x2d38('0x30')](_0x346934[_0x2d38('0x31')],qs[_0x2d38('0x32')](_0x3f0f7a[_0x2d38('0x2e')][_0x2d38('0x32')]));_0x3d18cd[_0x2d38('0x33')]=_0x3d18cd['attributes'][_0x2d38('0x34')]?_0x3d18cd[_0x2d38('0x33')]:_0x346934[_0x2d38('0x31')];if(!_0x3f0f7a[_0x2d38('0x2e')]['hasOwnProperty'](_0x2d38('0x35'))){_0x3d18cd[_0x2d38('0x1f')]=qs[_0x2d38('0x1f')](_0x3f0f7a[_0x2d38('0x2e')][_0x2d38('0x1f')]);_0x3d18cd[_0x2d38('0x1e')]=qs[_0x2d38('0x1e')](_0x3f0f7a[_0x2d38('0x2e')][_0x2d38('0x1e')]);}_0x3d18cd[_0x2d38('0x36')]=qs['sort'](_0x3f0f7a['query'][_0x2d38('0x37')]);_0x3d18cd[_0x2d38('0x38')]=qs[_0x2d38('0x39')](_[_0x2d38('0x3a')](_0x3f0f7a[_0x2d38('0x2e')],_0x346934[_0x2d38('0x39')]),_0x81299c);if(_0x3f0f7a[_0x2d38('0x2e')][_0x2d38('0x3b')]){_0x3d18cd[_0x2d38('0x38')]=_[_0x2d38('0x3c')](_0x3d18cd[_0x2d38('0x38')],{'$or':_[_0x2d38('0x2a')](_0x81299c,function(_0x11f5b8){if(_0x11f5b8['type']!==_0x2d38('0x3d')){var _0x1161b1={};_0x1161b1[_0x11f5b8[_0x2d38('0x28')]]={'$like':'%'+_0x3f0f7a[_0x2d38('0x2e')]['filter']+'%'};return _0x1161b1;}})});}_0x3d18cd=_[_0x2d38('0x3c')]({},_0x3d18cd,_0x3f0f7a[_0x2d38('0x3e')]);var _0x213b07={'where':_0x3d18cd[_0x2d38('0x38')]};return db[_0x2d38('0x3f')][_0x2d38('0x1d')](_0x213b07)[_0x2d38('0x24')](function(_0x1084a5){_0xe73710[_0x2d38('0x1d')]=_0x1084a5;if(_0x3f0f7a[_0x2d38('0x2e')][_0x2d38('0x40')]){_0x3d18cd[_0x2d38('0x41')]=[{'all':!![]}];}return db[_0x2d38('0x3f')][_0x2d38('0x42')](_0x3d18cd);})['then'](function(_0x234b9e){_0xe73710[_0x2d38('0x43')]=_0x234b9e;return _0xe73710;})['then'](respondWithFilteredResult(_0x34599a,_0x3d18cd))['catch'](handleError(_0x34599a,null));};exports[_0x2d38('0x44')]=function(_0x3e2631,_0x28110c){var _0x5b1469={'raw':!![],'where':{'id':_0x3e2631[_0x2d38('0x45')]['id']}},_0x6108f1={};_0x6108f1[_0x2d38('0x31')]=_['keys'](db['CmHopperFinal'][_0x2d38('0x46')]);_0x6108f1['query']=_[_0x2d38('0x2f')](_0x3e2631[_0x2d38('0x2e')]);_0x6108f1[_0x2d38('0x39')]=_['intersection'](_0x6108f1['model'],_0x6108f1[_0x2d38('0x2e')]);_0x5b1469[_0x2d38('0x33')]=_[_0x2d38('0x30')](_0x6108f1['model'],qs[_0x2d38('0x32')](_0x3e2631[_0x2d38('0x2e')][_0x2d38('0x32')]));_0x5b1469['attributes']=_0x5b1469[_0x2d38('0x33')][_0x2d38('0x34')]?_0x5b1469[_0x2d38('0x33')]:_0x6108f1['model'];if(_0x3e2631['query'][_0x2d38('0x40')]){_0x5b1469[_0x2d38('0x41')]=[{'all':!![]}];}_0x5b1469=_[_0x2d38('0x3c')]({},_0x5b1469,_0x3e2631[_0x2d38('0x3e')]);return db['CmHopperFinal'][_0x2d38('0x47')](_0x5b1469)[_0x2d38('0x24')](handleEntityNotFound(_0x28110c,null))[_0x2d38('0x24')](respondWithResult(_0x28110c,null))['catch'](handleError(_0x28110c,null));};exports[_0x2d38('0x48')]=function(_0x501637,_0x580d04){return db[_0x2d38('0x3f')][_0x2d38('0x48')]()[_0x2d38('0x24')](respondWithResult(_0x580d04,null))[_0x2d38('0x49')](handleError(_0x580d04,null));};exports['update']=function(_0x4c4c95,_0x132000){if(_0x4c4c95['body'][_0x2d38('0x4a')]){delete _0x4c4c95[_0x2d38('0x4b')][_0x2d38('0x4a')];}return db[_0x2d38('0x3f')][_0x2d38('0x47')]({'where':{'uniqueid':_0x4c4c95[_0x2d38('0x45')]['id']}})[_0x2d38('0x24')](handleEntityNotFound(_0x132000,null))[_0x2d38('0x24')](saveUpdates(_0x4c4c95[_0x2d38('0x4b')],null))['then'](respondWithResult(_0x132000,null))[_0x2d38('0x49')](handleError(_0x132000,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x260b6a,_0x14eec5,_0x582679){return db[_0x2d38('0x3f')][_0x2d38('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x260b6a[_0x2d38('0x45')]['id']},'attributes':[[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db[_0x2d38('0x4c')]['fn']('IF',db[_0x2d38('0x4c')][_0x2d38('0x4e')]('`state`\x20=\x200,\x201,\x20null'))),_0x2d38('0x4f')],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db[_0x2d38('0x4c')]['fn']('IF',db[_0x2d38('0x4c')][_0x2d38('0x4e')](_0x2d38('0x50')))),_0x2d38('0x51')],[db[_0x2d38('0x4c')]['fn']('COUNT',db[_0x2d38('0x4c')]['fn']('IF',db[_0x2d38('0x4c')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x2d38('0x52')],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db[_0x2d38('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x2d38('0x53')))),_0x2d38('0x54')],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db[_0x2d38('0x4c')]['fn']('IF',db[_0x2d38('0x4c')][_0x2d38('0x4e')](_0x2d38('0x55')))),_0x2d38('0x56')],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db['sequelize']['fn']('IF',db[_0x2d38('0x4c')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x2d38('0x57')],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0x2d38('0x4e')](_0x2d38('0x58')))),'reCallContacts'],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db[_0x2d38('0x4c')]['fn']('IF',db[_0x2d38('0x4c')][_0x2d38('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x2d38('0x24')](handleEntityNotFound(_0x14eec5,null))['then'](respondWithResult(_0x14eec5,null))[_0x2d38('0x49')](handleError(_0x14eec5,null));};exports[_0x2d38('0x59')]=function(_0x147a37,_0x227a95,_0x4fa858){return db[_0x2d38('0x3f')][_0x2d38('0x42')]({'raw':![],'where':{'CampaignId':_0x147a37['params']['id']},'attributes':[[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db['sequelize']['fn']('IF',db[_0x2d38('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x2d38('0x4f')],[db[_0x2d38('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2d38('0x4c')]['literal'](_0x2d38('0x50')))),_0x2d38('0x51')],[db[_0x2d38('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2d38('0x4c')][_0x2d38('0x4e')]('`state`\x20=\x205,\x201,\x20null'))),_0x2d38('0x52')],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db[_0x2d38('0x4c')]['fn']('IF',db[_0x2d38('0x4c')]['literal'](_0x2d38('0x53')))),'congestionContacts'],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0x2d38('0x4e')](_0x2d38('0x55')))),_0x2d38('0x56')],[db[_0x2d38('0x4c')]['fn']('COUNT',db[_0x2d38('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x2d38('0x5a')))),_0x2d38('0x57')],[db[_0x2d38('0x4c')]['fn'](_0x2d38('0x4d'),db['sequelize']['fn']('IF',db[_0x2d38('0x4c')][_0x2d38('0x4e')](_0x2d38('0x58')))),_0x2d38('0x5b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x2d38('0x5c')]]})[_0x2d38('0x24')](handleEntityNotFound(_0x227a95,null))[_0x2d38('0x24')](respondWithResult(_0x227a95,null))[_0x2d38('0x49')](handleError(_0x227a95,null));};exports[_0x2d38('0x5d')]=function(_0x4c8e78,_0x3781f5,_0x4229d7){return db[_0x2d38('0x5e')][_0x2d38('0x47')]({'where':{'id':_0x4c8e78['params']['id']}})[_0x2d38('0x24')](handleEntityNotFound(_0x3781f5,null))[_0x2d38('0x24')](function(_0x3f1115){var _0x116456;if(_0x3f1115){_0x116456=squel[_0x2d38('0x5f')]()[_0x2d38('0x60')](_0x2d38('0x61'))[_0x2d38('0x62')]([_0x2d38('0x63'),'scheduledAt',_0x2d38('0x64'),_0x2d38('0x65'),_0x2d38('0x66'),'createdAt',_0x2d38('0x67')],squel[_0x2d38('0x68')]()[_0x2d38('0x69')](_0x2d38('0x6a'),_0x2d38('0x63'))[_0x2d38('0x69')]('NOW()',_0x2d38('0x6b'))[_0x2d38('0x69')](_0x2d38('0x6c'),_0x2d38('0x64'))[_0x2d38('0x69')]('ANY_VALUE(ListId)',_0x2d38('0x65'))['field'](_0x2d38('0x6d'),'VoiceQueueId')[_0x2d38('0x69')](_0x2d38('0x6e'),'createdAt')[_0x2d38('0x69')](_0x2d38('0x6e'),_0x2d38('0x67'))[_0x2d38('0x6f')](_0x2d38('0x70'))[_0x2d38('0x38')](_0x2d38('0x71'),_0x4c8e78[_0x2d38('0x45')]['id'][_0x2d38('0x72')]())[_0x2d38('0x38')](_0x2d38('0x73'),_0x4c8e78[_0x2d38('0x4b')][_0x2d38('0x74')][_0x2d38('0x72')]())[_0x2d38('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x2d38('0x38')](_0x2d38('0x75'),squel[_0x2d38('0x68')]()[_0x2d38('0x69')](_0x2d38('0x63'))[_0x2d38('0x6f')](_0x2d38('0x61'))[_0x2d38('0x38')](_0x2d38('0x71'),_0x4c8e78[_0x2d38('0x45')]['id'][_0x2d38('0x72')]()))[_0x2d38('0x38')](_0x2d38('0x75'),squel['select']()[_0x2d38('0x69')](_0x2d38('0x76'))[_0x2d38('0x6f')](_0x2d38('0x70'))[_0x2d38('0x38')](_0x2d38('0x71'),_0x4c8e78[_0x2d38('0x45')]['id'][_0x2d38('0x72')]())[_0x2d38('0x38')](_0x2d38('0x77')))[_0x2d38('0x78')]('ContactId'))['toString']();return db[_0x2d38('0x4c')][_0x2d38('0x2e')](_0x116456);}return[];})[_0x2d38('0x24')](respondWithResult(_0x3781f5,null))[_0x2d38('0x49')](handleError(_0x3781f5,null));};exports[_0x2d38('0x79')]=function(_0x29d723,_0x3e83aa,_0x15d1eb){return db['Campaign']['find']({'where':{'id':_0x29d723['params']['id']}})[_0x2d38('0x24')](handleEntityNotFound(_0x3e83aa,null))[_0x2d38('0x24')](function(_0x106893){var _0x42f42d;if(_0x106893){_0x42f42d=squel[_0x2d38('0x5f')]()[_0x2d38('0x60')](_0x2d38('0x61'))[_0x2d38('0x62')]([_0x2d38('0x63'),_0x2d38('0x6b'),'ContactId',_0x2d38('0x65'),_0x2d38('0x7a'),_0x2d38('0x7b'),'updatedAt'],squel['select']()['field'](_0x2d38('0x6a'),_0x2d38('0x63'))[_0x2d38('0x69')](_0x2d38('0x6e'),_0x2d38('0x6b'))[_0x2d38('0x69')]('ANY_VALUE(ContactId)','ContactId')[_0x2d38('0x69')](_0x2d38('0x7c'),'ListId')[_0x2d38('0x69')](_0x2d38('0x7d'),_0x2d38('0x7a'))[_0x2d38('0x69')](_0x2d38('0x6e'),'createdAt')[_0x2d38('0x69')]('NOW()',_0x2d38('0x67'))[_0x2d38('0x6f')]('cm_hopper_final')[_0x2d38('0x38')](_0x2d38('0x7e'),_0x29d723[_0x2d38('0x45')]['id'][_0x2d38('0x72')]())[_0x2d38('0x38')](_0x2d38('0x73'),_0x29d723[_0x2d38('0x4b')][_0x2d38('0x74')]['toString']())['where'](_0x2d38('0x7f'))[_0x2d38('0x38')](_0x2d38('0x75'),squel[_0x2d38('0x68')]()[_0x2d38('0x69')](_0x2d38('0x63'))[_0x2d38('0x6f')](_0x2d38('0x61'))[_0x2d38('0x38')](_0x2d38('0x7e'),_0x29d723[_0x2d38('0x45')]['id'][_0x2d38('0x72')]()))['where'](_0x2d38('0x75'),squel[_0x2d38('0x68')]()['field'](_0x2d38('0x76'))[_0x2d38('0x6f')](_0x2d38('0x70'))[_0x2d38('0x38')](_0x2d38('0x7e'),_0x29d723[_0x2d38('0x45')]['id'][_0x2d38('0x72')]())[_0x2d38('0x38')]('state\x20=\x204'))[_0x2d38('0x78')](_0x2d38('0x64')))[_0x2d38('0x72')]();return db[_0x2d38('0x4c')]['query'](_0x42f42d);}return[];})[_0x2d38('0x24')](respondWithResult(_0x3e83aa,null))['catch'](handleError(_0x3e83aa,null));};exports['checkContactHopper']=function(_0x3c61b2,_0xa95c76,_0x5eb21e){return db[_0x2d38('0x80')][_0x2d38('0x81')]({'where':{'VoiceQueueId':_0x3c61b2['body'][_0x2d38('0x66')],'CampaignId':_0x3c61b2['body'][_0x2d38('0x7a')],'ContactId':_0x3c61b2[_0x2d38('0x4b')][_0x2d38('0x64')]}})[_0x2d38('0x24')](handleEntityNotFound(_0xa95c76,null))['then'](function(_0x2bc90d){if(_0x2bc90d){return _0x2bc90d;}return null;})[_0x2d38('0x24')](respondWithResult(_0xa95c76,null))[_0x2d38('0x49')](handleError(_0xa95c76,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 36aa481..58bc121 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 _0x6470=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','bluebird','request-promise'];(function(_0x494991,_0x2197ca){var _0x48c2c7=function(_0x29679e){while(--_0x29679e){_0x494991['push'](_0x494991['shift']());}};_0x48c2c7(++_0x2197ca);}(_0x6470,0x171));var _0x0647=function(_0x38474d,_0xdda220){_0x38474d=_0x38474d-0x0;var _0x3a5e8d=_0x6470[_0x38474d];return _0x3a5e8d;};'use strict';var _=require('lodash');var util=require(_0x0647('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0647('0x1'));var rp=require(_0x0647('0x2'));var fs=require('fs');var path=require(_0x0647('0x3'));var rimraf=require(_0x0647('0x4'));var config=require(_0x0647('0x5'));var attributes=require(_0x0647('0x6'));module['exports']=function(_0x20a21b,_0x175880){return _0x20a21b[_0x0647('0x7')](_0x0647('0x8'),attributes,{'tableName':_0x0647('0x9'),'paranoid':![],'indexes':[{'name':_0x0647('0xa'),'fields':[_0x0647('0xa')]},{'name':_0x0647('0xb'),'fields':[_0x0647('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab76=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x25fc4b,_0x2e151a){var _0x33f316=function(_0x53230a){while(--_0x53230a){_0x25fc4b['push'](_0x25fc4b['shift']());}};_0x33f316(++_0x2e151a);}(_0xab76,0x91));var _0x6ab7=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xab76[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x6ab7('0x0'));var util=require(_0x6ab7('0x1'));var logger=require(_0x6ab7('0x2'))('api');var moment=require(_0x6ab7('0x3'));var BPromise=require(_0x6ab7('0x4'));var rp=require(_0x6ab7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ab7('0x6'));var attributes=require(_0x6ab7('0x7'));module[_0x6ab7('0x8')]=function(_0x237c05,_0x231c0f){return _0x237c05[_0x6ab7('0x9')](_0x6ab7('0xa'),attributes,{'tableName':_0x6ab7('0xb'),'paranoid':![],'indexes':[{'name':_0x6ab7('0xc'),'fields':[_0x6ab7('0xc')]},{'name':_0x6ab7('0xd'),'fields':[_0x6ab7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index fde5f17..8218d5e 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 _0x588a=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','util','moment','bluebird'];(function(_0x416c14,_0x8f64df){var _0x13a057=function(_0x4131b2){while(--_0x4131b2){_0x416c14['push'](_0x416c14['shift']());}};_0x13a057(++_0x8f64df);}(_0x588a,0x6d));var _0xa588=function(_0x160fb9,_0x41e921){_0x160fb9=_0x160fb9-0x0;var _0x21317b=_0x588a[_0x160fb9];return _0x21317b;};'use strict';var _=require('lodash');var util=require(_0xa588('0x0'));var moment=require(_0xa588('0x1'));var BPromise=require(_0xa588('0x2'));var rs=require(_0xa588('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa588('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa588('0x5'))(_0xa588('0x6'));var config=require(_0xa588('0x7'));var jayson=require(_0xa588('0x8'));var client=jayson[_0xa588('0x9')][_0xa588('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30fd19,_0x20a6a8,_0x355e15){return new BPromise(function(_0x37c5f7,_0x2719fb){return client[_0xa588('0xb')](_0x30fd19,_0x355e15)[_0xa588('0xc')](function(_0x290381){logger[_0xa588('0xd')](_0xa588('0xe'),_0x20a6a8,_0xa588('0xf'));logger[_0xa588('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x20a6a8,_0xa588('0xf'),JSON[_0xa588('0x11')](_0x290381));if(_0x290381[_0xa588('0x12')]){if(_0x290381[_0xa588('0x12')]['code']===0x1f4){logger[_0xa588('0x12')](_0xa588('0xe'),_0x20a6a8,_0x290381[_0xa588('0x12')][_0xa588('0x13')]);return _0x2719fb(_0x290381['error'][_0xa588('0x13')]);}logger[_0xa588('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x20a6a8,_0x290381[_0xa588('0x12')][_0xa588('0x13')]);return _0x37c5f7(_0x290381[_0xa588('0x12')][_0xa588('0x13')]);}else{logger[_0xa588('0xd')](_0xa588('0xe'),_0x20a6a8,_0xa588('0xf'));_0x37c5f7(_0x290381[_0xa588('0x14')][_0xa588('0x13')]);}})[_0xa588('0x15')](function(_0x4cbd4d){logger[_0xa588('0x12')](_0xa588('0xe'),_0x20a6a8,_0x4cbd4d);_0x2719fb(_0x4cbd4d);});});}exports['CreateCmHopperFinal']=function(_0x137932){var _0xcd622d=this;return new Promise(function(_0x2fa1e1,_0x35e833){return db[_0xa588('0x16')][_0xa588('0x17')](_0x137932[_0xa588('0x18')],{'raw':_0x137932[_0xa588('0x19')]?_0x137932[_0xa588('0x19')][_0xa588('0x1a')]===undefined?!![]:![]:!![]})[_0xa588('0xc')](function(_0x10a66f){logger['info'](_0xa588('0x1b'),_0x137932);logger['debug']('CreateCmHopperFinal',_0x137932,JSON[_0xa588('0x11')](_0x10a66f));_0x2fa1e1(_0x10a66f);})[_0xa588('0x15')](function(_0x2383bf){logger['error'](_0xa588('0x1b'),_0x2383bf[_0xa588('0x13')],_0x137932);_0x35e833(_0xcd622d[_0xa588('0x12')](0x1f4,_0x2383bf['message']));});});}; \ No newline at end of file +var _0x3db9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','body','options','stringify','catch','util','moment','randomstring'];(function(_0x423dd5,_0x2eb979){var _0x206b68=function(_0x683c0a){while(--_0x683c0a){_0x423dd5['push'](_0x423dd5['shift']());}};_0x206b68(++_0x2eb979);}(_0x3db9,0x14f));var _0x93db=function(_0x36283d,_0x351925){_0x36283d=_0x36283d-0x0;var _0xd821b9=_0x3db9[_0x36283d];return _0xd821b9;};'use strict';var _=require('lodash');var util=require(_0x93db('0x0'));var moment=require(_0x93db('0x1'));var BPromise=require('bluebird');var rs=require(_0x93db('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93db('0x3'))['db'];var utils=require(_0x93db('0x4'));var logger=require(_0x93db('0x5'))(_0x93db('0x6'));var config=require(_0x93db('0x7'));var jayson=require(_0x93db('0x8'));var client=jayson[_0x93db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad8e3,_0x5e217e,_0x159d05){return new BPromise(function(_0x3b6690,_0x4ca17a){return client[_0x93db('0xa')](_0x4ad8e3,_0x159d05)['then'](function(_0x1ff3ce){logger[_0x93db('0xb')](_0x93db('0xc'),_0x5e217e,'request\x20sent');logger[_0x93db('0xd')](_0x93db('0xe'),_0x5e217e,_0x93db('0xf'),JSON['stringify'](_0x1ff3ce));if(_0x1ff3ce[_0x93db('0x10')]){if(_0x1ff3ce[_0x93db('0x10')][_0x93db('0x11')]===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x5e217e,_0x1ff3ce[_0x93db('0x10')][_0x93db('0x12')]);return _0x4ca17a(_0x1ff3ce[_0x93db('0x10')][_0x93db('0x12')]);}logger[_0x93db('0x10')](_0x93db('0xc'),_0x5e217e,_0x1ff3ce[_0x93db('0x10')][_0x93db('0x12')]);return _0x3b6690(_0x1ff3ce[_0x93db('0x10')][_0x93db('0x12')]);}else{logger[_0x93db('0xb')](_0x93db('0xc'),_0x5e217e,'request\x20sent');_0x3b6690(_0x1ff3ce[_0x93db('0x13')][_0x93db('0x12')]);}})['catch'](function(_0x6c298f){logger['error'](_0x93db('0xc'),_0x5e217e,_0x6c298f);_0x4ca17a(_0x6c298f);});});}exports[_0x93db('0x14')]=function(_0xef07e7){var _0x1a5086=this;return new Promise(function(_0x1a12ce,_0x2e4d9a){return db[_0x93db('0x15')]['create'](_0xef07e7[_0x93db('0x16')],{'raw':_0xef07e7[_0x93db('0x17')]?_0xef07e7[_0x93db('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x18cb8f){logger[_0x93db('0xb')](_0x93db('0x14'),_0xef07e7);logger['debug'](_0x93db('0x14'),_0xef07e7,JSON[_0x93db('0x18')](_0x18cb8f));_0x1a12ce(_0x18cb8f);})[_0x93db('0x19')](function(_0x1f318f){logger[_0x93db('0x10')](_0x93db('0x14'),_0x1f318f[_0x93db('0x12')],_0xef07e7);_0x2e4d9a(_0x1a5086[_0x93db('0x10')](0x1f4,_0x1f318f[_0x93db('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 4a289a3..fdafec2 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 _0xc295=['../../components/interaction/service','./cmHopperFinal.controller','get','index','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x44a0e9,_0x959f63){var _0x3b8e8c=function(_0x11b3e1){while(--_0x11b3e1){_0x44a0e9['push'](_0x44a0e9['shift']());}};_0x3b8e8c(++_0x959f63);}(_0xc295,0x1b0));var _0x5c29=function(_0x8c59dd,_0x1083a5){_0x8c59dd=_0x8c59dd-0x0;var _0x4b0563=_0xc295[_0x8c59dd];return _0x4b0563;};'use strict';var multer=require('multer');var util=require(_0x5c29('0x0'));var path=require(_0x5c29('0x1'));var timeout=require(_0x5c29('0x2'));var express=require(_0x5c29('0x3'));var router=express['Router']();var auth=require(_0x5c29('0x4'));var interaction=require(_0x5c29('0x5'));var config=require('../../config/environment');var controller=require(_0x5c29('0x6'));router[_0x5c29('0x7')]('/',auth['isAuthenticated'](),controller[_0x5c29('0x8')]);router[_0x5c29('0x7')]('/describe',auth[_0x5c29('0x9')](),controller[_0x5c29('0xa')]);router[_0x5c29('0x7')](_0x5c29('0xb'),auth[_0x5c29('0x9')](),controller[_0x5c29('0xc')]);router[_0x5c29('0x7')](_0x5c29('0xd'),auth[_0x5c29('0x9')](),controller[_0x5c29('0xe')]);router[_0x5c29('0x7')](_0x5c29('0xf'),auth[_0x5c29('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x5c29('0x10')]('/voice/queue/moveContacts/:id',auth[_0x5c29('0x9')](),controller[_0x5c29('0x11')]);router[_0x5c29('0x10')](_0x5c29('0x12'),auth[_0x5c29('0x9')](),controller[_0x5c29('0x13')]);router[_0x5c29('0x10')](_0x5c29('0x14'),auth[_0x5c29('0x9')](),controller[_0x5c29('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x5c29('0x16')]=router; \ No newline at end of file +var _0x3064=['index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated'];(function(_0x47049c,_0x3e7741){var _0x569910=function(_0x4604fd){while(--_0x4604fd){_0x47049c['push'](_0x47049c['shift']());}};_0x569910(++_0x3e7741);}(_0x3064,0x115));var _0x4306=function(_0x5ea157,_0x4e446b){_0x5ea157=_0x5ea157-0x0;var _0x4f5d63=_0x3064[_0x5ea157];return _0x4f5d63;};'use strict';var multer=require(_0x4306('0x0'));var util=require(_0x4306('0x1'));var path=require('path');var timeout=require(_0x4306('0x2'));var express=require(_0x4306('0x3'));var router=express[_0x4306('0x4')]();var auth=require(_0x4306('0x5'));var interaction=require(_0x4306('0x6'));var config=require(_0x4306('0x7'));var controller=require(_0x4306('0x8'));router[_0x4306('0x9')]('/',auth[_0x4306('0xa')](),controller[_0x4306('0xb')]);router[_0x4306('0x9')](_0x4306('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4306('0x9')](_0x4306('0xd'),auth['isAuthenticated'](),controller[_0x4306('0xe')]);router[_0x4306('0x9')](_0x4306('0xf'),auth[_0x4306('0xa')](),controller[_0x4306('0x10')]);router[_0x4306('0x9')](_0x4306('0x11'),auth[_0x4306('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x4306('0x12')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x4306('0x13')]);router[_0x4306('0x12')](_0x4306('0x14'),auth[_0x4306('0xa')](),controller[_0x4306('0x15')]);router[_0x4306('0x12')](_0x4306('0x16'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x4306('0x17')]('/:id',auth[_0x4306('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 62af0ed..82b759f 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 _0x8e06=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x129805,_0x5251b1){var _0x1d3ae9=function(_0x309dff){while(--_0x309dff){_0x129805['push'](_0x129805['shift']());}};_0x1d3ae9(++_0x5251b1);}(_0x8e06,0x119));var _0x68e0=function(_0x14ca07,_0x89c34){_0x14ca07=_0x14ca07-0x0;var _0x98dd0f=_0x8e06[_0x14ca07];return _0x98dd0f;};'use strict';var Sequelize=require(_0x68e0('0x0'));module['exports']={'state':{'type':Sequelize[_0x68e0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x68e0('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x68e0('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x68e0('0x2')]},'calleridnum':{'type':Sequelize[_0x68e0('0x2')]},'calleridname':{'type':Sequelize[_0x68e0('0x2')]},'starttime':{'type':Sequelize[_0x68e0('0x3')]},'responsetime':{'type':Sequelize[_0x68e0('0x3')]},'answertime':{'type':Sequelize[_0x68e0('0x3')]},'droptime':{'type':Sequelize[_0x68e0('0x3')]},'endtime':{'type':Sequelize[_0x68e0('0x3')]},'ringtime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x68e0('0x2')]},'campaign':{'type':Sequelize[_0x68e0('0x2')]},'campaigntype':{'type':Sequelize[_0x68e0('0x2')]},'membername':{'type':Sequelize[_0x68e0('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x68e0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x68e0('0x3')]},'edited':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf90=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xdf90,0x1ee));var _0x0df9=function(_0x1cf870,_0x5f172d){_0x1cf870=_0x1cf870-0x0;var _0x439018=_0xdf90[_0x1cf870];return _0x439018;};'use strict';var Sequelize=require(_0x0df9('0x0'));module[_0x0df9('0x1')]={'state':{'type':Sequelize[_0x0df9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0df9('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0df9('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0df9('0x3')]},'calleridnum':{'type':Sequelize[_0x0df9('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0df9('0x4')]},'answertime':{'type':Sequelize[_0x0df9('0x4')]},'droptime':{'type':Sequelize[_0x0df9('0x4')]},'endtime':{'type':Sequelize[_0x0df9('0x4')]},'ringtime':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0df9('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0df9('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0df9('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0df9('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0df9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0df9('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0df9('0x4')]},'edited':{'type':Sequelize[_0x0df9('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0df9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0df9('0x2')],'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 7a5285f..b7fb91e 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 _0xb847=['name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack'];(function(_0x10418d,_0x5a6967){var _0x20c6d3=function(_0x5b1b91){while(--_0x5b1b91){_0x10418d['push'](_0x10418d['shift']());}};_0x20c6d3(++_0x5a6967);}(_0xb847,0x105));var _0x7b84=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0xb847[_0x10e653];return _0x328dfd;};'use strict';var pdf=require(_0x7b84('0x0'));var emlformat=require(_0x7b84('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7b84('0x2'));var jsonpatch=require(_0x7b84('0x3'));var rp=require(_0x7b84('0x4'));var moment=require(_0x7b84('0x5'));var BPromise=require(_0x7b84('0x6'));var Mustache=require(_0x7b84('0x7'));var util=require(_0x7b84('0x8'));var path=require(_0x7b84('0x9'));var sox=require(_0x7b84('0xa'));var csv=require(_0x7b84('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b84('0xc'));var squel=require(_0x7b84('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b84('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b84('0xf'));var Papa=require(_0x7b84('0x10'));var Redis=require('ioredis');var authService=require(_0x7b84('0x11'));var qs=require(_0x7b84('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b84('0x13'));var logger=require(_0x7b84('0x14'))(_0x7b84('0x15'));var utils=require(_0x7b84('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b84('0x17'))['db'];function respondWithStatusCode(_0x39a0ba,_0x5c60dd){_0x5c60dd=_0x5c60dd||0xcc;return function(_0x395274){if(_0x395274){return _0x39a0ba[_0x7b84('0x18')](_0x5c60dd);}return _0x39a0ba[_0x7b84('0x19')](_0x5c60dd)[_0x7b84('0x1a')]();};}function respondWithResult(_0x310b8e,_0x5501d4){_0x5501d4=_0x5501d4||0xc8;return function(_0x3a4314){if(_0x3a4314){return _0x310b8e['status'](_0x5501d4)[_0x7b84('0x1b')](_0x3a4314);}};}function respondWithFilteredResult(_0xcc65c9,_0x2249db){return function(_0x1e89b8){if(_0x1e89b8){var _0x124738=_0x1e89b8[_0x7b84('0x1c')],_0x3f7bed=_0x2249db[_0x7b84('0x1d')],_0x3b2a0e=_0x2249db[_0x7b84('0x1d')]+_0x2249db[_0x7b84('0x1e')],_0x572e7a;if(_0x3b2a0e>=_0x124738){_0x3b2a0e=_0x124738;_0x572e7a=0xc8;}else{_0x572e7a=0xce;}_0xcc65c9[_0x7b84('0x19')](_0x572e7a);return _0xcc65c9[_0x7b84('0x1f')](_0x7b84('0x20'),_0x3f7bed+'-'+_0x3b2a0e+'/'+_0x124738)[_0x7b84('0x1b')](_0x1e89b8);}return null;};}function patchUpdates(_0x2df3a5){return function(_0x5705e5){try{jsonpatch['apply'](_0x5705e5,_0x2df3a5,!![]);}catch(_0x5a6bc6){return BPromise['reject'](_0x5a6bc6);}return _0x5705e5[_0x7b84('0x21')]();};}function saveUpdates(_0x58e104,_0x20b0e3){return function(_0x2c328f){if(_0x2c328f){return _0x2c328f[_0x7b84('0x22')](_0x58e104)[_0x7b84('0x23')](function(_0x1068ce){return _0x1068ce;});}return null;};}function removeEntity(_0x1caabe,_0x40849e){return function(_0x1debd1){if(_0x1debd1){return _0x1debd1[_0x7b84('0x24')]()['then'](function(){_0x1caabe['status'](0xcc)[_0x7b84('0x1a')]();});}};}function handleEntityNotFound(_0x4f972e,_0x34892f){return function(_0x332b13){if(!_0x332b13){_0x4f972e[_0x7b84('0x18')](0x194);}return _0x332b13;};}function handleError(_0x51ff12,_0x1a1196){_0x1a1196=_0x1a1196||0x1f4;return function(_0x587f94){logger[_0x7b84('0x25')](_0x587f94[_0x7b84('0x26')]);if(_0x587f94[_0x7b84('0x27')]){delete _0x587f94[_0x7b84('0x27')];}_0x51ff12[_0x7b84('0x19')](_0x1a1196)[_0x7b84('0x28')](_0x587f94);};}exports[_0x7b84('0x29')]=function(_0x131f2a,_0x4c800a){var _0x43e0b1={},_0x1a40fe={},_0x59e678={'count':0x0,'rows':[]};var _0x412cdd=_[_0x7b84('0x2a')](db[_0x7b84('0x2b')][_0x7b84('0x2c')],function(_0x3378f7){return{'name':_0x3378f7[_0x7b84('0x2d')],'type':_0x3378f7[_0x7b84('0x2e')][_0x7b84('0x2f')]};});_0x1a40fe[_0x7b84('0x30')]=_[_0x7b84('0x2a')](_0x412cdd,'name');_0x1a40fe[_0x7b84('0x31')]=_[_0x7b84('0x32')](_0x131f2a['query']);_0x1a40fe[_0x7b84('0x33')]=_[_0x7b84('0x34')](_0x1a40fe[_0x7b84('0x30')],_0x1a40fe[_0x7b84('0x31')]);_0x43e0b1['attributes']=_[_0x7b84('0x34')](_0x1a40fe[_0x7b84('0x30')],qs[_0x7b84('0x35')](_0x131f2a['query'][_0x7b84('0x35')]));_0x43e0b1[_0x7b84('0x36')]=_0x43e0b1[_0x7b84('0x36')]['length']?_0x43e0b1['attributes']:_0x1a40fe[_0x7b84('0x30')];if(!_0x131f2a[_0x7b84('0x31')][_0x7b84('0x37')](_0x7b84('0x38'))){_0x43e0b1[_0x7b84('0x1e')]=qs[_0x7b84('0x1e')](_0x131f2a[_0x7b84('0x31')]['limit']);_0x43e0b1[_0x7b84('0x1d')]=qs[_0x7b84('0x1d')](_0x131f2a[_0x7b84('0x31')][_0x7b84('0x1d')]);}_0x43e0b1[_0x7b84('0x39')]=qs[_0x7b84('0x3a')](_0x131f2a['query'][_0x7b84('0x3a')]);_0x43e0b1[_0x7b84('0x3b')]=qs[_0x7b84('0x33')](_['pick'](_0x131f2a[_0x7b84('0x31')],_0x1a40fe[_0x7b84('0x33')]),_0x412cdd);if(_0x131f2a[_0x7b84('0x31')][_0x7b84('0x3c')]){_0x43e0b1['where']=_[_0x7b84('0x3d')](_0x43e0b1[_0x7b84('0x3b')],{'$or':_[_0x7b84('0x2a')](_0x412cdd,function(_0x4447ce){if(_0x4447ce[_0x7b84('0x2e')]!==_0x7b84('0x3e')){var _0x444811={};_0x444811[_0x4447ce['name']]={'$like':'%'+_0x131f2a[_0x7b84('0x31')]['filter']+'%'};return _0x444811;}})});}_0x43e0b1=_[_0x7b84('0x3d')]({},_0x43e0b1,_0x131f2a[_0x7b84('0x3f')]);var _0x430498={'where':_0x43e0b1['where']};return db[_0x7b84('0x2b')][_0x7b84('0x1c')](_0x430498)[_0x7b84('0x23')](function(_0x36aa7b){_0x59e678['count']=_0x36aa7b;if(_0x131f2a[_0x7b84('0x31')][_0x7b84('0x40')]){_0x43e0b1[_0x7b84('0x41')]=[{'all':!![]}];}return db[_0x7b84('0x2b')][_0x7b84('0x42')](_0x43e0b1);})[_0x7b84('0x23')](function(_0x157c73){_0x59e678['rows']=_0x157c73;return _0x59e678;})[_0x7b84('0x23')](respondWithFilteredResult(_0x4c800a,_0x43e0b1))[_0x7b84('0x43')](handleError(_0x4c800a,null));};exports[_0x7b84('0x44')]=function(_0x59d14f,_0x567663){var _0x9da2f9={'raw':!![],'where':{'id':_0x59d14f[_0x7b84('0x45')]['id']}},_0x11b3b0={};_0x11b3b0[_0x7b84('0x30')]=_[_0x7b84('0x32')](db[_0x7b84('0x2b')]['rawAttributes']);_0x11b3b0[_0x7b84('0x31')]=_[_0x7b84('0x32')](_0x59d14f[_0x7b84('0x31')]);_0x11b3b0[_0x7b84('0x33')]=_[_0x7b84('0x34')](_0x11b3b0[_0x7b84('0x30')],_0x11b3b0[_0x7b84('0x31')]);_0x9da2f9[_0x7b84('0x36')]=_['intersection'](_0x11b3b0['model'],qs['fields'](_0x59d14f[_0x7b84('0x31')][_0x7b84('0x35')]));_0x9da2f9[_0x7b84('0x36')]=_0x9da2f9[_0x7b84('0x36')]['length']?_0x9da2f9[_0x7b84('0x36')]:_0x11b3b0[_0x7b84('0x30')];if(_0x59d14f['query']['includeAll']){_0x9da2f9[_0x7b84('0x41')]=[{'all':!![]}];}_0x9da2f9=_[_0x7b84('0x3d')]({},_0x9da2f9,_0x59d14f[_0x7b84('0x3f')]);return db[_0x7b84('0x2b')][_0x7b84('0x46')](_0x9da2f9)['then'](handleEntityNotFound(_0x567663,null))[_0x7b84('0x23')](respondWithResult(_0x567663,null))[_0x7b84('0x43')](handleError(_0x567663,null));};exports[_0x7b84('0x47')]=function(_0xad3d,_0x231c39){return db[_0x7b84('0x2b')][_0x7b84('0x47')](_0xad3d[_0x7b84('0x48')],{})[_0x7b84('0x23')](respondWithResult(_0x231c39,0xc9))[_0x7b84('0x43')](handleError(_0x231c39,null));};exports[_0x7b84('0x49')]=function(_0x34e8a3,_0x1f916c){return db['CmHopperHistory'][_0x7b84('0x49')]()[_0x7b84('0x23')](respondWithResult(_0x1f916c,null))[_0x7b84('0x43')](handleError(_0x1f916c,null));};exports[_0x7b84('0x22')]=function(_0x28f36c,_0x469826){if(_0x28f36c[_0x7b84('0x48')][_0x7b84('0x4a')]){delete _0x28f36c['body'][_0x7b84('0x4a')];}return db[_0x7b84('0x2b')][_0x7b84('0x46')]({'where':{'uniqueid':_0x28f36c[_0x7b84('0x45')]['id']}})[_0x7b84('0x23')](handleEntityNotFound(_0x469826,null))[_0x7b84('0x23')](saveUpdates(_0x28f36c['body'],null))[_0x7b84('0x23')](respondWithResult(_0x469826,null))[_0x7b84('0x43')](handleError(_0x469826,null));}; \ No newline at end of file +var _0xb39f=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','CmHopperHistory','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','describe','uniqueid','body','params','html-pdf','eml-format','moment','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x377193,_0x4b9258){var _0x55dc97=function(_0x33b85e){while(--_0x33b85e){_0x377193['push'](_0x377193['shift']());}};_0x55dc97(++_0x4b9258);}(_0xb39f,0x82));var _0xfb39=function(_0x18cd60,_0x4e1aa1){_0x18cd60=_0x18cd60-0x0;var _0x5a8a84=_0xb39f[_0x18cd60];return _0x5a8a84;};'use strict';var pdf=require(_0xfb39('0x0'));var emlformat=require(_0xfb39('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfb39('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfb39('0x3'));var util=require(_0xfb39('0x4'));var path=require(_0xfb39('0x5'));var sox=require('sox');var csv=require(_0xfb39('0x6'));var ejs=require(_0xfb39('0x7'));var fs=require('fs');var _=require(_0xfb39('0x8'));var squel=require(_0xfb39('0x9'));var crypto=require('crypto');var jsforce=require(_0xfb39('0xa'));var deskjs=require(_0xfb39('0xb'));var toCsv=require(_0xfb39('0x6'));var querystring=require(_0xfb39('0xc'));var Papa=require(_0xfb39('0xd'));var Redis=require(_0xfb39('0xe'));var authService=require(_0xfb39('0xf'));var qs=require(_0xfb39('0x10'));var as=require(_0xfb39('0x11'));var hardwareService=require(_0xfb39('0x12'));var logger=require(_0xfb39('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfb39('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x495913,_0x568757){_0x568757=_0x568757||0xcc;return function(_0x15c991){if(_0x15c991){return _0x495913[_0xfb39('0x15')](_0x568757);}return _0x495913[_0xfb39('0x16')](_0x568757)[_0xfb39('0x17')]();};}function respondWithResult(_0x30ea8a,_0xdbe862){_0xdbe862=_0xdbe862||0xc8;return function(_0x545706){if(_0x545706){return _0x30ea8a['status'](_0xdbe862)['json'](_0x545706);}};}function respondWithFilteredResult(_0x517ce5,_0x262fd2){return function(_0xcd15ea){if(_0xcd15ea){var _0x46df27=_0xcd15ea[_0xfb39('0x18')],_0x33c9d8=_0x262fd2[_0xfb39('0x19')],_0x244fc7=_0x262fd2['offset']+_0x262fd2[_0xfb39('0x1a')],_0x5f1c47;if(_0x244fc7>=_0x46df27){_0x244fc7=_0x46df27;_0x5f1c47=0xc8;}else{_0x5f1c47=0xce;}_0x517ce5['status'](_0x5f1c47);return _0x517ce5['set'](_0xfb39('0x1b'),_0x33c9d8+'-'+_0x244fc7+'/'+_0x46df27)[_0xfb39('0x1c')](_0xcd15ea);}return null;};}function patchUpdates(_0x27e865){return function(_0x15e0f0){try{jsonpatch[_0xfb39('0x1d')](_0x15e0f0,_0x27e865,!![]);}catch(_0x4e22ed){return BPromise[_0xfb39('0x1e')](_0x4e22ed);}return _0x15e0f0[_0xfb39('0x1f')]();};}function saveUpdates(_0x49357b,_0x2c41b1){return function(_0xe06674){if(_0xe06674){return _0xe06674[_0xfb39('0x20')](_0x49357b)[_0xfb39('0x21')](function(_0x294d15){return _0x294d15;});}return null;};}function removeEntity(_0x27dc55,_0x4309c0){return function(_0x247679){if(_0x247679){return _0x247679[_0xfb39('0x22')]()[_0xfb39('0x21')](function(){_0x27dc55[_0xfb39('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126400,_0x220d15){return function(_0x303334){if(!_0x303334){_0x126400['sendStatus'](0x194);}return _0x303334;};}function handleError(_0x465995,_0x5906fe){_0x5906fe=_0x5906fe||0x1f4;return function(_0x56d3bd){logger[_0xfb39('0x23')](_0x56d3bd['stack']);if(_0x56d3bd[_0xfb39('0x24')]){delete _0x56d3bd[_0xfb39('0x24')];}_0x465995[_0xfb39('0x16')](_0x5906fe)['send'](_0x56d3bd);};}exports[_0xfb39('0x25')]=function(_0x5ee22d,_0x11fde7){var _0x4e0fb6={},_0x10fc9c={},_0x214ce8={'count':0x0,'rows':[]};var _0x565d43=_['map'](db[_0xfb39('0x26')]['rawAttributes'],function(_0x1bcd04){return{'name':_0x1bcd04['fieldName'],'type':_0x1bcd04['type'][_0xfb39('0x27')]};});_0x10fc9c[_0xfb39('0x28')]=_[_0xfb39('0x29')](_0x565d43,_0xfb39('0x24'));_0x10fc9c[_0xfb39('0x2a')]=_[_0xfb39('0x2b')](_0x5ee22d[_0xfb39('0x2a')]);_0x10fc9c[_0xfb39('0x2c')]=_[_0xfb39('0x2d')](_0x10fc9c[_0xfb39('0x28')],_0x10fc9c['query']);_0x4e0fb6['attributes']=_[_0xfb39('0x2d')](_0x10fc9c[_0xfb39('0x28')],qs[_0xfb39('0x2e')](_0x5ee22d[_0xfb39('0x2a')]['fields']));_0x4e0fb6[_0xfb39('0x2f')]=_0x4e0fb6[_0xfb39('0x2f')][_0xfb39('0x30')]?_0x4e0fb6['attributes']:_0x10fc9c[_0xfb39('0x28')];if(!_0x5ee22d[_0xfb39('0x2a')][_0xfb39('0x31')]('nolimit')){_0x4e0fb6[_0xfb39('0x1a')]=qs[_0xfb39('0x1a')](_0x5ee22d['query'][_0xfb39('0x1a')]);_0x4e0fb6[_0xfb39('0x19')]=qs['offset'](_0x5ee22d['query']['offset']);}_0x4e0fb6[_0xfb39('0x32')]=qs[_0xfb39('0x33')](_0x5ee22d['query'][_0xfb39('0x33')]);_0x4e0fb6[_0xfb39('0x34')]=qs['filters'](_[_0xfb39('0x35')](_0x5ee22d[_0xfb39('0x2a')],_0x10fc9c[_0xfb39('0x2c')]),_0x565d43);if(_0x5ee22d['query']['filter']){_0x4e0fb6[_0xfb39('0x34')]=_[_0xfb39('0x36')](_0x4e0fb6[_0xfb39('0x34')],{'$or':_['map'](_0x565d43,function(_0x3bb657){if(_0x3bb657['type']!==_0xfb39('0x37')){var _0x341c5c={};_0x341c5c[_0x3bb657[_0xfb39('0x24')]]={'$like':'%'+_0x5ee22d['query'][_0xfb39('0x38')]+'%'};return _0x341c5c;}})});}_0x4e0fb6=_[_0xfb39('0x36')]({},_0x4e0fb6,_0x5ee22d[_0xfb39('0x39')]);var _0x1025ad={'where':_0x4e0fb6['where']};return db[_0xfb39('0x26')][_0xfb39('0x18')](_0x1025ad)['then'](function(_0x1a5700){_0x214ce8[_0xfb39('0x18')]=_0x1a5700;if(_0x5ee22d['query'][_0xfb39('0x3a')]){_0x4e0fb6[_0xfb39('0x3b')]=[{'all':!![]}];}return db[_0xfb39('0x26')][_0xfb39('0x3c')](_0x4e0fb6);})['then'](function(_0x5dd73e){_0x214ce8[_0xfb39('0x3d')]=_0x5dd73e;return _0x214ce8;})[_0xfb39('0x21')](respondWithFilteredResult(_0x11fde7,_0x4e0fb6))[_0xfb39('0x3e')](handleError(_0x11fde7,null));};exports[_0xfb39('0x3f')]=function(_0x387cfe,_0x216dcc){var _0x13153e={'raw':!![],'where':{'id':_0x387cfe['params']['id']}},_0x16bf26={};_0x16bf26[_0xfb39('0x28')]=_['keys'](db[_0xfb39('0x26')]['rawAttributes']);_0x16bf26[_0xfb39('0x2a')]=_[_0xfb39('0x2b')](_0x387cfe[_0xfb39('0x2a')]);_0x16bf26['filters']=_[_0xfb39('0x2d')](_0x16bf26[_0xfb39('0x28')],_0x16bf26[_0xfb39('0x2a')]);_0x13153e[_0xfb39('0x2f')]=_[_0xfb39('0x2d')](_0x16bf26[_0xfb39('0x28')],qs[_0xfb39('0x2e')](_0x387cfe[_0xfb39('0x2a')][_0xfb39('0x2e')]));_0x13153e[_0xfb39('0x2f')]=_0x13153e[_0xfb39('0x2f')][_0xfb39('0x30')]?_0x13153e[_0xfb39('0x2f')]:_0x16bf26['model'];if(_0x387cfe['query'][_0xfb39('0x3a')]){_0x13153e[_0xfb39('0x3b')]=[{'all':!![]}];}_0x13153e=_[_0xfb39('0x36')]({},_0x13153e,_0x387cfe[_0xfb39('0x39')]);return db[_0xfb39('0x26')][_0xfb39('0x40')](_0x13153e)[_0xfb39('0x21')](handleEntityNotFound(_0x216dcc,null))[_0xfb39('0x21')](respondWithResult(_0x216dcc,null))[_0xfb39('0x3e')](handleError(_0x216dcc,null));};exports[_0xfb39('0x41')]=function(_0x125842,_0x3173ca){return db[_0xfb39('0x26')]['create'](_0x125842['body'],{})[_0xfb39('0x21')](respondWithResult(_0x3173ca,0xc9))['catch'](handleError(_0x3173ca,null));};exports[_0xfb39('0x42')]=function(_0x35ca8e,_0x3d29f7){return db['CmHopperHistory'][_0xfb39('0x42')]()[_0xfb39('0x21')](respondWithResult(_0x3d29f7,null))[_0xfb39('0x3e')](handleError(_0x3d29f7,null));};exports['update']=function(_0x3b3a77,_0x29923e){if(_0x3b3a77['body'][_0xfb39('0x43')]){delete _0x3b3a77[_0xfb39('0x44')]['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x3b3a77[_0xfb39('0x45')]['id']}})[_0xfb39('0x21')](handleEntityNotFound(_0x29923e,null))[_0xfb39('0x21')](saveUpdates(_0x3b3a77[_0xfb39('0x44')],null))[_0xfb39('0x21')](respondWithResult(_0x29923e,null))[_0xfb39('0x3e')](handleError(_0x29923e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 1cacac4..66c5845 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 _0x0893=['endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','define','CmHopperHistory'];(function(_0x5c8258,_0x5a0437){var _0x51a263=function(_0x38cadd){while(--_0x38cadd){_0x5c8258['push'](_0x5c8258['shift']());}};_0x51a263(++_0x5a0437);}(_0x0893,0x70));var _0x3089=function(_0x21a040,_0x4eca14){_0x21a040=_0x21a040-0x0;var _0x37bc95=_0x0893[_0x21a040];return _0x37bc95;};'use strict';var _=require(_0x3089('0x0'));var util=require(_0x3089('0x1'));var logger=require(_0x3089('0x2'))(_0x3089('0x3'));var moment=require(_0x3089('0x4'));var BPromise=require('bluebird');var rp=require(_0x3089('0x5'));var fs=require('fs');var path=require(_0x3089('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x271c08,_0x481951){return _0x271c08[_0x3089('0x7')](_0x3089('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x3089('0x9')]},{'name':_0x3089('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd09c=['uniqueid','lodash','../../config/logger','moment','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0xd09c,0x182));var _0xcd09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd09c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcd09('0x0'));var util=require('util');var logger=require(_0xcd09('0x1'))('api');var moment=require(_0xcd09('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcd09('0x3'));var config=require('../../config/environment');var attributes=require(_0xcd09('0x4'));module[_0xcd09('0x5')]=function(_0x19dce4,_0x4ce107){return _0x19dce4[_0xcd09('0x6')](_0xcd09('0x7'),attributes,{'tableName':_0xcd09('0x8'),'paranoid':![],'indexes':[{'name':_0xcd09('0x9'),'fields':[_0xcd09('0x9')]},{'name':_0xcd09('0xa'),'fields':[_0xcd09('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8caf9cd..4e0cdc8 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 _0x3dbb=['outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','stringify','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','where','name','`state`\x20=\x200,\x201,\x20null'];(function(_0x2bea40,_0x15f611){var _0x25fb9c=function(_0x52b98a){while(--_0x52b98a){_0x2bea40['push'](_0x2bea40['shift']());}};_0x25fb9c(++_0x15f611);}(_0x3dbb,0x138));var _0xb3db=function(_0x308a9a,_0xd452bb){_0x308a9a=_0x308a9a-0x0;var _0xf317d1=_0x3dbb[_0x308a9a];return _0xf317d1;};'use strict';var _=require(_0xb3db('0x0'));var util=require(_0xb3db('0x1'));var moment=require(_0xb3db('0x2'));var BPromise=require(_0xb3db('0x3'));var rs=require(_0xb3db('0x4'));var fs=require('fs');var Redis=require(_0xb3db('0x5'));var db=require(_0xb3db('0x6'))['db'];var utils=require(_0xb3db('0x7'));var logger=require(_0xb3db('0x8'))(_0xb3db('0x9'));var config=require(_0xb3db('0xa'));var jayson=require(_0xb3db('0xb'));var client=jayson[_0xb3db('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x539abc,_0x335b45,_0x2ebabc){return new BPromise(function(_0x16591f,_0x37079f){return client[_0xb3db('0xd')](_0x539abc,_0x2ebabc)[_0xb3db('0xe')](function(_0x5a1ab5){logger[_0xb3db('0xf')](_0xb3db('0x10'),_0x335b45,_0xb3db('0x11'));logger[_0xb3db('0x12')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x335b45,_0xb3db('0x11'),JSON['stringify'](_0x5a1ab5));if(_0x5a1ab5['error']){if(_0x5a1ab5[_0xb3db('0x13')]['code']===0x1f4){logger['error'](_0xb3db('0x10'),_0x335b45,_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);return _0x37079f(_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x335b45,_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);return _0x16591f(_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);}else{logger[_0xb3db('0xf')](_0xb3db('0x10'),_0x335b45,_0xb3db('0x11'));_0x16591f(_0x5a1ab5[_0xb3db('0x15')][_0xb3db('0x14')]);}})[_0xb3db('0x16')](function(_0x530e83){logger[_0xb3db('0x13')](_0xb3db('0x10'),_0x335b45,_0x530e83);_0x37079f(_0x530e83);});});}exports['CreateCmHopperHistory']=function(_0x3d2948){var _0x202c27=this;return new Promise(function(_0x591f6d,_0x38b5c6){return db[_0xb3db('0x17')][_0xb3db('0x18')](_0x3d2948[_0xb3db('0x19')],{'raw':_0x3d2948[_0xb3db('0x1a')]?_0x3d2948[_0xb3db('0x1a')][_0xb3db('0x1b')]===undefined?!![]:![]:!![]})[_0xb3db('0xe')](function(_0x5c18c4){logger[_0xb3db('0xf')]('CreateCmHopperHistory',_0x3d2948);logger[_0xb3db('0x12')](_0xb3db('0x1c'),_0x3d2948,JSON[_0xb3db('0x1d')](_0x5c18c4));_0x591f6d(_0x5c18c4);})['catch'](function(_0x19a36b){logger[_0xb3db('0x13')](_0xb3db('0x1c'),_0x19a36b['message'],_0x3d2948);_0x38b5c6(_0x202c27['error'](0x1f4,_0x19a36b[_0xb3db('0x14')]));});});};exports['AvgHandleTime']=function(_0x33b68b){var _0x3bdeca=this;return new Promise(function(_0x17bc00,_0x567771){return db['CmHopperHistory']['findAll']({'raw':_0x33b68b[_0xb3db('0x1a')]?_0x33b68b[_0xb3db('0x1a')][_0xb3db('0x1b')]===undefined?!![]:![]:!![],'where':_0x33b68b['options']?_0x33b68b[_0xb3db('0x1a')]['where']||null:null,'attributes':[[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')][_0xb3db('0x20')]('id')),_0xb3db('0x21')],[db[_0xb3db('0x1e')]['fn']('COUNT',db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')]['literal'](_0xb3db('0x22')))),_0xb3db('0x23')],[db[_0xb3db('0x1e')]['fn']('COUNT',db[_0xb3db('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xb3db('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xb3db('0x1e')]['fn']('AVG',db[_0xb3db('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xb3db('0x27')],[db['sequelize']['fn'](_0xb3db('0x28'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x29')))),_0xb3db('0x2a')]]})[_0xb3db('0xe')](function(_0x2c1ebb){logger[_0xb3db('0xf')](_0xb3db('0x2b'),_0x33b68b);logger[_0xb3db('0x12')](_0xb3db('0x2b'),_0x33b68b,JSON[_0xb3db('0x1d')](_0x2c1ebb));_0x17bc00(_0x2c1ebb);})[_0xb3db('0x16')](function(_0x562b20){logger[_0xb3db('0x13')]('AvgHandleTime',_0x562b20[_0xb3db('0x14')],_0x33b68b);_0x567771(_0x3bdeca[_0xb3db('0x13')](0x1f4,_0x562b20[_0xb3db('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x26e01b){var _0x273093=this;return new Promise(function(_0x21b309,_0x15f5bb){return db[_0xb3db('0x17')][_0xb3db('0x2c')]({'raw':_0x26e01b['options']?_0x26e01b[_0xb3db('0x1a')][_0xb3db('0x1b')]===undefined?!![]:![]:!![],'where':_0x26e01b[_0xb3db('0x1a')]?_0x26e01b[_0xb3db('0x1a')][_0xb3db('0x2d')]||null:null,'attributes':[['campaign',_0xb3db('0x2e')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x2f')))),_0xb3db('0x30')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db['sequelize'][_0xb3db('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0xb3db('0x31')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x22')))),'outboundAnswerCallsDay'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db['sequelize'][_0xb3db('0x25')](_0xb3db('0x32')))),_0xb3db('0x33')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x34')))),_0xb3db('0x35')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db['sequelize'][_0xb3db('0x25')](_0xb3db('0x36')))),_0xb3db('0x37')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')]['literal'](_0xb3db('0x38')))),_0xb3db('0x39')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0xb3db('0x3a')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x3b')))),_0xb3db('0x3c')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x3d')))),_0xb3db('0x3e')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x3f')))),_0xb3db('0x40')],[db['sequelize']['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xb3db('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x41')))),_0xb3db('0x42')]],'group':['campaign']})['then'](function(_0x1bb0c0){logger['info']('GetVoiceQueueHopperHistory',_0x26e01b);logger[_0xb3db('0x12')]('GetVoiceQueueHopperHistory',_0x26e01b,JSON[_0xb3db('0x1d')](_0x1bb0c0));_0x21b309(_0x1bb0c0);})[_0xb3db('0x16')](function(_0x4532d1){logger['error'](_0xb3db('0x43'),_0x4532d1[_0xb3db('0x14')],_0x26e01b);_0x15f5bb(_0x273093[_0xb3db('0x13')](0x1f4,_0x4532d1[_0xb3db('0x14')]));});});};exports[_0xb3db('0x44')]=function(_0x708e81){var _0x5ef49a=this;return new Promise(function(_0x1ff43b,_0x6e2e80){return db['CmHopperHistory']['findAll']({'raw':_0x708e81[_0xb3db('0x1a')]?_0x708e81['options'][_0xb3db('0x1b')]===undefined?!![]:![]:!![],'where':_0x708e81[_0xb3db('0x1a')]?_0x708e81[_0xb3db('0x1a')][_0xb3db('0x2d')]||null:null,'attributes':[[_0xb3db('0x45'),_0xb3db('0x2e')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')][_0xb3db('0x20')]('id')),_0xb3db('0x46')],[db[_0xb3db('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x22')))),_0xb3db('0x47')]],'group':[_0xb3db('0x45')]})[_0xb3db('0xe')](function(_0x1c23f3){logger['info'](_0xb3db('0x44'),_0x708e81);logger['debug'](_0xb3db('0x44'),_0x708e81,JSON[_0xb3db('0x1d')](_0x1c23f3));_0x1ff43b(_0x1c23f3);})[_0xb3db('0x16')](function(_0x2c1d49){logger[_0xb3db('0x13')](_0xb3db('0x44'),_0x2c1d49[_0xb3db('0x14')],_0x708e81);_0x6e2e80(_0x5ef49a[_0xb3db('0x13')](0x1f4,_0x2c1d49[_0xb3db('0x14')]));});});}; \ No newline at end of file +var _0x8080=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','literal','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','campaign','name','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','randomstring'];(function(_0x13799a,_0x3a5ad){var _0x1dcaac=function(_0x2978b0){while(--_0x2978b0){_0x13799a['push'](_0x13799a['shift']());}};_0x1dcaac(++_0x3a5ad);}(_0x8080,0x155));var _0x0808=function(_0x2870a6,_0xd2d6e3){_0x2870a6=_0x2870a6-0x0;var _0x4114ba=_0x8080[_0x2870a6];return _0x4114ba;};'use strict';var _=require(_0x0808('0x0'));var util=require(_0x0808('0x1'));var moment=require('moment');var BPromise=require(_0x0808('0x2'));var rs=require(_0x0808('0x3'));var fs=require('fs');var Redis=require(_0x0808('0x4'));var db=require(_0x0808('0x5'))['db'];var utils=require(_0x0808('0x6'));var logger=require(_0x0808('0x7'))('rpc');var config=require(_0x0808('0x8'));var jayson=require(_0x0808('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf0735e,_0x4b6f32,_0x2a0fd1){return new BPromise(function(_0xda9f0b,_0x40f096){return client[_0x0808('0xa')](_0xf0735e,_0x2a0fd1)[_0x0808('0xb')](function(_0x54e1cb){logger[_0x0808('0xc')](_0x0808('0xd'),_0x4b6f32,'request\x20sent');logger[_0x0808('0xe')](_0x0808('0xf'),_0x4b6f32,_0x0808('0x10'),JSON[_0x0808('0x11')](_0x54e1cb));if(_0x54e1cb[_0x0808('0x12')]){if(_0x54e1cb[_0x0808('0x12')][_0x0808('0x13')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4b6f32,_0x54e1cb[_0x0808('0x12')][_0x0808('0x14')]);return _0x40f096(_0x54e1cb[_0x0808('0x12')]['message']);}logger[_0x0808('0x12')](_0x0808('0xd'),_0x4b6f32,_0x54e1cb['error']['message']);return _0xda9f0b(_0x54e1cb['error'][_0x0808('0x14')]);}else{logger[_0x0808('0xc')](_0x0808('0xd'),_0x4b6f32,'request\x20sent');_0xda9f0b(_0x54e1cb[_0x0808('0x15')][_0x0808('0x14')]);}})[_0x0808('0x16')](function(_0x2a4819){logger[_0x0808('0x12')](_0x0808('0xd'),_0x4b6f32,_0x2a4819);_0x40f096(_0x2a4819);});});}exports['CreateCmHopperHistory']=function(_0x5bb348){var _0x77b87c=this;return new Promise(function(_0x4fc1b,_0x58fc88){return db[_0x0808('0x17')][_0x0808('0x18')](_0x5bb348[_0x0808('0x19')],{'raw':_0x5bb348['options']?_0x5bb348[_0x0808('0x1a')][_0x0808('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x34ec42){logger['info']('CreateCmHopperHistory',_0x5bb348);logger['debug']('CreateCmHopperHistory',_0x5bb348,JSON[_0x0808('0x11')](_0x34ec42));_0x4fc1b(_0x34ec42);})[_0x0808('0x16')](function(_0x47bb88){logger[_0x0808('0x12')](_0x0808('0x1c'),_0x47bb88[_0x0808('0x14')],_0x5bb348);_0x58fc88(_0x77b87c[_0x0808('0x12')](0x1f4,_0x47bb88['message']));});});};exports[_0x0808('0x1d')]=function(_0x30fcda){var _0x3eb442=this;return new Promise(function(_0x1e22e3,_0x5575b2){return db[_0x0808('0x17')]['findAll']({'raw':_0x30fcda['options']?_0x30fcda[_0x0808('0x1a')][_0x0808('0x1b')]===undefined?!![]:![]:!![],'where':_0x30fcda[_0x0808('0x1a')]?_0x30fcda['options'][_0x0808('0x1e')]||null:null,'attributes':[[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db[_0x0808('0x1f')][_0x0808('0x21')]('id')),_0x0808('0x22')],[db['sequelize']['fn'](_0x0808('0x20'),db['sequelize']['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x23')))),'predictiveIntervalAnsweredCalls'],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db['sequelize']['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x24')))),_0x0808('0x25')],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x26')))),_0x0808('0x27')],[db[_0x0808('0x1f')]['fn']('AVG',db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')][_0x0808('0x28')](_0x0808('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x0808('0x1f')]['fn'](_0x0808('0x2a'),db['sequelize']['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x2b')))),_0x0808('0x2c')]]})['then'](function(_0xc1bdda){logger['info']('AvgHandleTime',_0x30fcda);logger[_0x0808('0xe')](_0x0808('0x1d'),_0x30fcda,JSON['stringify'](_0xc1bdda));_0x1e22e3(_0xc1bdda);})[_0x0808('0x16')](function(_0x1f1c02){logger[_0x0808('0x12')](_0x0808('0x1d'),_0x1f1c02[_0x0808('0x14')],_0x30fcda);_0x5575b2(_0x3eb442[_0x0808('0x12')](0x1f4,_0x1f1c02[_0x0808('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x31f1c2){var _0x321a6e=this;return new Promise(function(_0x3edd85,_0x4514c1){return db[_0x0808('0x17')][_0x0808('0x2d')]({'raw':_0x31f1c2[_0x0808('0x1a')]?_0x31f1c2[_0x0808('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x31f1c2[_0x0808('0x1a')]?_0x31f1c2['options'][_0x0808('0x1e')]||null:null,'attributes':[[_0x0808('0x2e'),_0x0808('0x2f')],[db['sequelize']['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')][_0x0808('0x28')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x0808('0x1f')]['fn']('COUNT',db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')][_0x0808('0x28')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0808('0x1f')][_0x0808('0x28')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db['sequelize']['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x30')))),_0x0808('0x31')],[db[_0x0808('0x1f')]['fn']('COUNT',db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')][_0x0808('0x28')](_0x0808('0x32')))),'outboundCongestionCallsDay'],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')][_0x0808('0x28')](_0x0808('0x33')))),_0x0808('0x34')],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x0808('0x35')))),_0x0808('0x36')],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x0808('0x37')))),_0x0808('0x38')],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db['sequelize']['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x39')))),_0x0808('0x3a')],[db[_0x0808('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x0808('0x28')](_0x0808('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x0808('0x3c')],[db['sequelize']['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')][_0x0808('0x28')](_0x0808('0x3d')))),_0x0808('0x3e')],[db['sequelize']['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x0808('0x3f')))),_0x0808('0x3c')],[db['sequelize']['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x40')))),'outboundReCallsDay']],'group':[_0x0808('0x2e')]})[_0x0808('0xb')](function(_0x19b5db){logger['info'](_0x0808('0x41'),_0x31f1c2);logger[_0x0808('0xe')]('GetVoiceQueueHopperHistory',_0x31f1c2,JSON[_0x0808('0x11')](_0x19b5db));_0x3edd85(_0x19b5db);})[_0x0808('0x16')](function(_0xaabfcc){logger[_0x0808('0x12')](_0x0808('0x41'),_0xaabfcc[_0x0808('0x14')],_0x31f1c2);_0x4514c1(_0x321a6e[_0x0808('0x12')](0x1f4,_0xaabfcc[_0x0808('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x5f4c5a){var _0x5459c9=this;return new Promise(function(_0x456f9b,_0x55dbaf){return db[_0x0808('0x17')][_0x0808('0x2d')]({'raw':_0x5f4c5a[_0x0808('0x1a')]?_0x5f4c5a[_0x0808('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5f4c5a[_0x0808('0x1a')]?_0x5f4c5a[_0x0808('0x1a')][_0x0808('0x1e')]||null:null,'attributes':[[_0x0808('0x2e'),_0x0808('0x2f')],[db[_0x0808('0x1f')]['fn']('COUNT',db[_0x0808('0x1f')]['col']('id')),_0x0808('0x42')],[db[_0x0808('0x1f')]['fn'](_0x0808('0x20'),db[_0x0808('0x1f')]['fn']('IF',db[_0x0808('0x1f')]['literal'](_0x0808('0x23')))),_0x0808('0x43')]],'group':[_0x0808('0x2e')]})[_0x0808('0xb')](function(_0x36face){logger[_0x0808('0xc')](_0x0808('0x44'),_0x5f4c5a);logger[_0x0808('0xe')]('GetCampaignHopperHistory',_0x5f4c5a,JSON[_0x0808('0x11')](_0x36face));_0x456f9b(_0x36face);})[_0x0808('0x16')](function(_0x3a64e8){logger[_0x0808('0x12')](_0x0808('0x44'),_0x3a64e8[_0x0808('0x14')],_0x5f4c5a);_0x55dbaf(_0x5459c9[_0x0808('0x12')](0x1f4,_0x3a64e8[_0x0808('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7385326..99024ce 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 _0x1a44=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','exports','multer','path'];(function(_0xda1a47,_0x550df1){var _0x171910=function(_0x235caf){while(--_0x235caf){_0xda1a47['push'](_0xda1a47['shift']());}};_0x171910(++_0x550df1);}(_0x1a44,0xc4));var _0x41a4=function(_0x5540ff,_0x111b0b){_0x5540ff=_0x5540ff-0x0;var _0x3aaa8d=_0x1a44[_0x5540ff];return _0x3aaa8d;};'use strict';var multer=require(_0x41a4('0x0'));var util=require('util');var path=require(_0x41a4('0x1'));var timeout=require(_0x41a4('0x2'));var express=require(_0x41a4('0x3'));var router=express[_0x41a4('0x4')]();var auth=require(_0x41a4('0x5'));var interaction=require(_0x41a4('0x6'));var config=require(_0x41a4('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x41a4('0x8')]('/',auth[_0x41a4('0x9')](),controller[_0x41a4('0xa')]);router[_0x41a4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x41a4('0xb')]);router[_0x41a4('0x8')](_0x41a4('0xc'),auth[_0x41a4('0x9')](),controller[_0x41a4('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x41a4('0xe')]);router[_0x41a4('0xf')](_0x41a4('0xc'),auth[_0x41a4('0x9')](),controller[_0x41a4('0x10')]);module[_0x41a4('0x11')]=router; \ No newline at end of file +var _0x6033=['describe','/:id','show','post','put','update','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x34f300,_0x37177d){var _0x152580=function(_0x3486c7){while(--_0x3486c7){_0x34f300['push'](_0x34f300['shift']());}};_0x152580(++_0x37177d);}(_0x6033,0x177));var _0x3603=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6033[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x3603('0x0'));var path=require('path');var timeout=require(_0x3603('0x1'));var express=require(_0x3603('0x2'));var router=express['Router']();var auth=require(_0x3603('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3603('0x4'));var controller=require(_0x3603('0x5'));router[_0x3603('0x6')]('/',auth[_0x3603('0x7')](),controller[_0x3603('0x8')]);router[_0x3603('0x6')]('/describe',auth[_0x3603('0x7')](),controller[_0x3603('0x9')]);router[_0x3603('0x6')](_0x3603('0xa'),auth[_0x3603('0x7')](),controller[_0x3603('0xb')]);router[_0x3603('0xc')]('/',auth[_0x3603('0x7')](),controller['create']);router[_0x3603('0xd')](_0x3603('0xa'),auth['isAuthenticated'](),controller[_0x3603('0xe')]);module[_0x3603('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index d1c6172..c4e66e1 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 _0x6617=['STRING','sequelize'];(function(_0x1e618c,_0x4712a7){var _0x47299d=function(_0x2357e7){while(--_0x2357e7){_0x1e618c['push'](_0x1e618c['shift']());}};_0x47299d(++_0x4712a7);}(_0x6617,0x11d));var _0x7661=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x6617[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0x7661('0x0'));module['exports']={'name':{'type':Sequelize[_0x7661('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7661('0x1')]},'dialPrefix':{'type':Sequelize[_0x7661('0x1')]}}; \ No newline at end of file +var _0x6bd3=['sequelize','exports','STRING','name'];(function(_0x128f67,_0x552a5e){var _0x101731=function(_0x4681a6){while(--_0x4681a6){_0x128f67['push'](_0x128f67['shift']());}};_0x101731(++_0x552a5e);}(_0x6bd3,0x6c));var _0x36bd=function(_0x44a77e,_0x83d56e){_0x44a77e=_0x44a77e-0x0;var _0x3f9385=_0x6bd3[_0x44a77e];return _0x3f9385;};'use strict';var Sequelize=require(_0x36bd('0x0'));module[_0x36bd('0x1')]={'name':{'type':Sequelize[_0x36bd('0x2')],'unique':_0x36bd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x36bd('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 1cc2e4e..caf5f9b 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 _0xca15=['count','offset','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','map','CmList','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','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','describe','addDisposition','ListId','getDispositions','Disposition','limit','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','nolimit','getContactsCsv','raw','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','addCustomField','findOne','sequelize','Sequelize','text','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json'];(function(_0x39680a,_0x41bae7){var _0x4b9728=function(_0xab23c6){while(--_0xab23c6){_0x39680a['push'](_0x39680a['shift']());}};_0x4b9728(++_0x41bae7);}(_0xca15,0xfc));var _0x5ca1=function(_0x39541d,_0x228c9c){_0x39541d=_0x39541d-0x0;var _0x552696=_0xca15[_0x39541d];return _0x552696;};'use strict';var pdf=require(_0x5ca1('0x0'));var emlformat=require(_0x5ca1('0x1'));var rimraf=require(_0x5ca1('0x2'));var zipdir=require(_0x5ca1('0x3'));var jsonpatch=require(_0x5ca1('0x4'));var rp=require(_0x5ca1('0x5'));var moment=require(_0x5ca1('0x6'));var BPromise=require(_0x5ca1('0x7'));var Mustache=require(_0x5ca1('0x8'));var util=require(_0x5ca1('0x9'));var path=require(_0x5ca1('0xa'));var sox=require(_0x5ca1('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ca1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ca1('0xd'));var toCsv=require(_0x5ca1('0xe'));var querystring=require(_0x5ca1('0xf'));var Papa=require(_0x5ca1('0x10'));var Redis=require(_0x5ca1('0x11'));var authService=require(_0x5ca1('0x12'));var qs=require(_0x5ca1('0x13'));var as=require(_0x5ca1('0x14'));var hardwareService=require(_0x5ca1('0x15'));var logger=require(_0x5ca1('0x16'))(_0x5ca1('0x17'));var utils=require(_0x5ca1('0x18'));var config=require(_0x5ca1('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5ca1('0x1a')]=_[_0x5ca1('0x1b')](config[_0x5ca1('0x1a')],{'host':_0x5ca1('0x1c'),'port':0x18eb});var socket=require(_0x5ca1('0x1d'))(new Redis(config[_0x5ca1('0x1a')]));require(_0x5ca1('0x1e'))['register'](socket);function respondWithStatusCode(_0x489df0,_0xd441f2){_0xd441f2=_0xd441f2||0xcc;return function(_0x28595e){if(_0x28595e){return _0x489df0[_0x5ca1('0x1f')](_0xd441f2);}return _0x489df0[_0x5ca1('0x20')](_0xd441f2)['end']();};}function respondWithResult(_0x3ce37b,_0x27c4d1){_0x27c4d1=_0x27c4d1||0xc8;return function(_0x42d98f){if(_0x42d98f){return _0x3ce37b['status'](_0x27c4d1)[_0x5ca1('0x21')](_0x42d98f);}};}function respondWithFilteredResult(_0x34e5fc,_0xb4b692){return function(_0x234139){if(_0x234139){var _0x13b3b1=_0x234139[_0x5ca1('0x22')],_0x2617ca=_0xb4b692[_0x5ca1('0x23')],_0x2fbf92=_0xb4b692[_0x5ca1('0x23')]+_0xb4b692['limit'],_0x335311;if(_0x2fbf92>=_0x13b3b1){_0x2fbf92=_0x13b3b1;_0x335311=0xc8;}else{_0x335311=0xce;}_0x34e5fc[_0x5ca1('0x20')](_0x335311);return _0x34e5fc['set']('Content-Range',_0x2617ca+'-'+_0x2fbf92+'/'+_0x13b3b1)['json'](_0x234139);}return null;};}function patchUpdates(_0x3a7596){return function(_0x567811){try{jsonpatch[_0x5ca1('0x24')](_0x567811,_0x3a7596,!![]);}catch(_0x272365){return BPromise[_0x5ca1('0x25')](_0x272365);}return _0x567811[_0x5ca1('0x26')]();};}function saveUpdates(_0x11149b,_0x49ac8b){return function(_0x477fb4){if(_0x477fb4){return _0x477fb4[_0x5ca1('0x27')](_0x11149b)[_0x5ca1('0x28')](function(_0xaf9f0e){return _0xaf9f0e;});}return null;};}function removeEntity(_0x2e2690,_0x805ed2){return function(_0x51df69){if(_0x51df69){return _0x51df69[_0x5ca1('0x29')]()[_0x5ca1('0x28')](function(){var _0x1a7e17=_0x51df69[_0x5ca1('0x2a')]({'plain':!![]});var _0x36770f=_0x5ca1('0x2b');return db[_0x5ca1('0x2c')][_0x5ca1('0x29')]({'where':{'type':_0x36770f,'resourceId':_0x1a7e17['id']}})[_0x5ca1('0x28')](function(){return _0x51df69;});})['then'](function(){_0x2e2690[_0x5ca1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265c2c,_0x2dcf64){return function(_0x3d69dc){if(!_0x3d69dc){_0x265c2c['sendStatus'](0x194);}return _0x3d69dc;};}function handleError(_0x1e9e0a,_0x163d6e){_0x163d6e=_0x163d6e||0x1f4;return function(_0x51fa8c){logger[_0x5ca1('0x2d')](_0x51fa8c[_0x5ca1('0x2e')]);if(_0x51fa8c[_0x5ca1('0x2f')]){delete _0x51fa8c[_0x5ca1('0x2f')];}_0x1e9e0a[_0x5ca1('0x20')](_0x163d6e)[_0x5ca1('0x30')](_0x51fa8c);};}exports['index']=function(_0x472c64,_0x50bad4){var _0x5cd0d4={},_0xc628d1={},_0x58463c={'count':0x0,'rows':[]};var _0x392080=_[_0x5ca1('0x31')](db[_0x5ca1('0x32')][_0x5ca1('0x33')],function(_0x57fdc2){return{'name':_0x57fdc2[_0x5ca1('0x34')],'type':_0x57fdc2['type'][_0x5ca1('0x35')]};});_0xc628d1[_0x5ca1('0x36')]=_[_0x5ca1('0x31')](_0x392080,_0x5ca1('0x2f'));_0xc628d1['query']=_[_0x5ca1('0x37')](_0x472c64[_0x5ca1('0x38')]);_0xc628d1[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0xc628d1[_0x5ca1('0x36')],_0xc628d1[_0x5ca1('0x38')]);_0x5cd0d4[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0xc628d1[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x5cd0d4['attributes']=_0x5cd0d4[_0x5ca1('0x3b')]['length']?_0x5cd0d4[_0x5ca1('0x3b')]:_0xc628d1[_0x5ca1('0x36')];if(!_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x3d')]('nolimit')){_0x5cd0d4['limit']=qs['limit'](_0x472c64['query']['limit']);_0x5cd0d4['offset']=qs[_0x5ca1('0x23')](_0x472c64['query'][_0x5ca1('0x23')]);}_0x5cd0d4[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x5cd0d4[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x472c64[_0x5ca1('0x38')],_0xc628d1[_0x5ca1('0x39')]),_0x392080);if(_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x5cd0d4[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x5cd0d4['where'],{'$or':_[_0x5ca1('0x31')](_0x392080,function(_0x4440bc){if(_0x4440bc[_0x5ca1('0x44')]!==_0x5ca1('0x45')){var _0xfabfc0={};_0xfabfc0[_0x4440bc[_0x5ca1('0x2f')]]={'$like':'%'+_0x472c64['query'][_0x5ca1('0x42')]+'%'};return _0xfabfc0;}})});}_0x5cd0d4=_['merge']({},_0x5cd0d4,_0x472c64[_0x5ca1('0x46')]);var _0x3158e9={'where':_0x5cd0d4[_0x5ca1('0x40')]};return db[_0x5ca1('0x32')][_0x5ca1('0x22')](_0x3158e9)[_0x5ca1('0x28')](function(_0x16d804){_0x58463c[_0x5ca1('0x22')]=_0x16d804;if(_0x472c64['query'][_0x5ca1('0x47')]){_0x5cd0d4['include']=[{'all':!![]}];}return db[_0x5ca1('0x32')][_0x5ca1('0x48')](_0x5cd0d4);})['then'](function(_0x5390a4){_0x58463c[_0x5ca1('0x49')]=_0x5390a4;return _0x58463c;})['then'](respondWithFilteredResult(_0x50bad4,_0x5cd0d4))[_0x5ca1('0x4a')](handleError(_0x50bad4,null));};exports[_0x5ca1('0x4b')]=function(_0x116b57,_0x348ebd){var _0x271b9a={'raw':![],'where':{'id':_0x116b57[_0x5ca1('0x4c')]['id']}},_0x280af0={};_0x280af0[_0x5ca1('0x36')]=_[_0x5ca1('0x37')](db['CmList'][_0x5ca1('0x33')]);_0x280af0[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x116b57['query']);_0x280af0[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x280af0['model'],_0x280af0[_0x5ca1('0x38')]);_0x271b9a['attributes']=_[_0x5ca1('0x3a')](_0x280af0[_0x5ca1('0x36')],qs['fields'](_0x116b57[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x271b9a[_0x5ca1('0x3b')]=_0x271b9a[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x271b9a[_0x5ca1('0x3b')]:_0x280af0[_0x5ca1('0x36')];if(_0x116b57[_0x5ca1('0x38')][_0x5ca1('0x47')]){_0x271b9a[_0x5ca1('0x4e')]=[{'all':!![]}];}_0x271b9a=_[_0x5ca1('0x43')]({},_0x271b9a,_0x116b57[_0x5ca1('0x46')]);return db['CmList'][_0x5ca1('0x4f')](_0x271b9a)[_0x5ca1('0x28')](handleEntityNotFound(_0x348ebd,null))[_0x5ca1('0x28')](respondWithResult(_0x348ebd,null))[_0x5ca1('0x4a')](handleError(_0x348ebd,null));};exports[_0x5ca1('0x50')]=function(_0x300a0f,_0x78b519){return db[_0x5ca1('0x32')][_0x5ca1('0x50')](_0x300a0f[_0x5ca1('0x51')],{})[_0x5ca1('0x28')](function(_0x5dec2d){var _0x5c6a0b=_0x300a0f[_0x5ca1('0x52')][_0x5ca1('0x2a')]({'plain':!![]});if(!_0x5c6a0b)throw new Error(_0x5ca1('0x53'));if(_0x5c6a0b[_0x5ca1('0x54')]===_0x5ca1('0x52')){var _0x48c475=_0x5dec2d[_0x5ca1('0x2a')]({'plain':!![]});var _0x3d4830=_0x5ca1('0x2b');return db[_0x5ca1('0x55')][_0x5ca1('0x4f')]({'where':{'name':_0x3d4830,'userProfileId':_0x5c6a0b[_0x5ca1('0x56')]},'raw':!![]})[_0x5ca1('0x28')](function(_0x14ee73){if(_0x14ee73&&_0x14ee73[_0x5ca1('0x57')]===0x0){return db[_0x5ca1('0x2c')][_0x5ca1('0x50')]({'name':_0x48c475['name'],'resourceId':_0x48c475['id'],'type':_0x14ee73[_0x5ca1('0x2f')],'sectionId':_0x14ee73['id']},{})[_0x5ca1('0x28')](function(){return _0x5dec2d;});}else{return _0x5dec2d;}})[_0x5ca1('0x4a')](function(_0x4b9673){logger[_0x5ca1('0x2d')](_0x5ca1('0x58'),_0x4b9673);throw _0x4b9673;});}return _0x5dec2d;})[_0x5ca1('0x28')](respondWithResult(_0x78b519,0xc9))['catch'](handleError(_0x78b519,null));};exports['update']=function(_0x3040b8,_0x21a671){if(_0x3040b8[_0x5ca1('0x51')]['id']){delete _0x3040b8[_0x5ca1('0x51')]['id'];}return db['CmList'][_0x5ca1('0x4f')]({'where':{'id':_0x3040b8[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x21a671,null))['then'](saveUpdates(_0x3040b8['body'],null))['then'](respondWithResult(_0x21a671,null))[_0x5ca1('0x4a')](handleError(_0x21a671,null));};exports['destroy']=function(_0x24acd8,_0x23d72d){return db['CmList'][_0x5ca1('0x4f')]({'where':{'id':_0x24acd8[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x23d72d,null))['then'](removeEntity(_0x23d72d,null))[_0x5ca1('0x4a')](handleError(_0x23d72d,null));};exports[_0x5ca1('0x59')]=function(_0x640ba,_0x26a63e){return db[_0x5ca1('0x32')][_0x5ca1('0x59')]()[_0x5ca1('0x28')](respondWithResult(_0x26a63e,null))[_0x5ca1('0x4a')](handleError(_0x26a63e,null));};exports[_0x5ca1('0x5a')]=function(_0x306916,_0x4ca70e,_0x1d48e1){if(_0x306916[_0x5ca1('0x51')]['id']){delete _0x306916[_0x5ca1('0x51')]['id'];}return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x306916[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x4ca70e,null))['then'](function(_0xbf302e){if(_0xbf302e){_0x306916['body'][_0x5ca1('0x5b')]=_0xbf302e['id'];return db['Disposition'][_0x5ca1('0x50')](_0x306916[_0x5ca1('0x51')]);}})[_0x5ca1('0x28')](respondWithResult(_0x4ca70e,null))[_0x5ca1('0x4a')](handleError(_0x4ca70e,null));};exports[_0x5ca1('0x5c')]=function(_0x3882ab,_0x579707,_0x2b9561){var _0x50c83e={'raw':![],'where':{}};var _0x2ca16e={};var _0x49959e={'count':0x0,'rows':[]};return db[_0x5ca1('0x32')]['findOne']({'where':{'id':_0x3882ab[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x579707,null))[_0x5ca1('0x28')](function(_0x1b05d1){if(_0x1b05d1){_0x2ca16e[_0x5ca1('0x36')]=_[_0x5ca1('0x37')](db[_0x5ca1('0x5d')]['rawAttributes']);_0x2ca16e[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x3882ab[_0x5ca1('0x38')]);_0x2ca16e[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x2ca16e['model'],_0x2ca16e[_0x5ca1('0x38')]);_0x50c83e[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x2ca16e[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x50c83e[_0x5ca1('0x3b')]=_0x50c83e[_0x5ca1('0x3b')]['length']?_0x50c83e[_0x5ca1('0x3b')]:_0x2ca16e['model'];if(!_0x3882ab['query'][_0x5ca1('0x3d')]('nolimit')){_0x50c83e[_0x5ca1('0x5e')]=qs['limit'](_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x5e')]);_0x50c83e[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x3882ab['query'][_0x5ca1('0x23')]);}_0x50c83e[_0x5ca1('0x3e')]=qs['sort'](_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x50c83e[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x3882ab[_0x5ca1('0x38')],_0x2ca16e['filters']));_0x50c83e[_0x5ca1('0x40')][_0x5ca1('0x5b')]=_0x1b05d1['id'];if(_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x50c83e[_0x5ca1('0x40')]=_['merge'](_0x50c83e[_0x5ca1('0x40')],{'$or':_[_0x5ca1('0x31')](_0x50c83e[_0x5ca1('0x3b')],function(_0x4392e9){var _0x20268f={};_0x20268f[_0x4392e9]={'$like':'%'+_0x3882ab['query'][_0x5ca1('0x42')]+'%'};return _0x20268f;})});}_0x50c83e=_['merge']({},_0x50c83e,_0x3882ab[_0x5ca1('0x46')]);return db[_0x5ca1('0x5d')]['count']({'where':_0x50c83e[_0x5ca1('0x40')]})['then'](function(_0x4b7512){_0x49959e['count']=_0x4b7512;if(_0x3882ab[_0x5ca1('0x38')]['includeAll']){_0x50c83e[_0x5ca1('0x4e')]=[{'all':!![]}];}return db[_0x5ca1('0x5d')][_0x5ca1('0x48')](_0x50c83e);})[_0x5ca1('0x28')](function(_0x24545b){_0x49959e['rows']=_0x24545b;return _0x49959e;});}})[_0x5ca1('0x28')](respondWithFilteredResult(_0x579707,_0x50c83e))[_0x5ca1('0x4a')](handleError(_0x579707,null));};exports[_0x5ca1('0x5f')]=function(_0xb9f431,_0x16f3bf,_0x23592d){return db['CmList']['find']({'where':{'id':_0xb9f431[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x16f3bf,null))['then'](function(_0x43e627){if(_0x43e627){return _0x43e627[_0x5ca1('0x5f')](_0xb9f431[_0x5ca1('0x38')][_0x5ca1('0x60')]);}})['then'](respondWithStatusCode(_0x16f3bf,null))[_0x5ca1('0x4a')](handleError(_0x16f3bf,null));};exports['addContacts']=function(_0x50ce81,_0x534c8a,_0x3de825){return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x50ce81[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x534c8a,null))[_0x5ca1('0x28')](function(_0x644a04){if(_0x644a04){var _0xa518c1=[];var _0x1ef28e={'success':[],'errors':[]};return db[_0x5ca1('0x61')]['describe']()['then'](function(_0x56170d){if(_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]&&_[_0x5ca1('0x63')](_0x50ce81[_0x5ca1('0x51')]['tags'])){if(_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')][_0x5ca1('0x4d')]){_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]=_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')][_0x5ca1('0x64')](';')+';';}else{_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]=null;}}else{_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]=null;}if(_0x50ce81['body']&&_[_0x5ca1('0x63')](_0x50ce81[_0x5ca1('0x51')])){for(var _0x2696d8=0x0;_0x2696d8<_0x50ce81['body'][_0x5ca1('0x4d')];_0x2696d8+=0x1){_0x50ce81['body'][_0x2696d8]['ListId']=_0x50ce81[_0x5ca1('0x4c')]['id'];_0xa518c1[_0x5ca1('0x65')](_0x50ce81[_0x5ca1('0x51')][_0x2696d8]);}return BPromise[_0x5ca1('0x66')](_0xa518c1,function(_0x49112e){return db[_0x5ca1('0x61')]['create'](_[_0x5ca1('0x67')](_0x49112e,['ids','id'])||{},{'fields':_[_0x5ca1('0x37')](_0x56170d),'raw':!![]})[_0x5ca1('0x28')](function(_0x48393d){_0x1ef28e['success'][_0x5ca1('0x65')](_0x48393d['dataValues']);})['catch'](function(_0x5a98cc){_0x1ef28e[_0x5ca1('0x68')][_0x5ca1('0x65')]({'data':_0x49112e,'error':_0x5a98cc[_0x5ca1('0x69')]});});})[_0x5ca1('0x28')](function(_0x38b713){return _0x1ef28e;})[_0x5ca1('0x4a')](function(_0x1481a6){return _0x1481a6;});}else{_0x534c8a[_0x5ca1('0x20')](0x190)[_0x5ca1('0x21')]({'message':_0x5ca1('0x6a')});}});}})[_0x5ca1('0x28')](respondWithResult(_0x534c8a,null))[_0x5ca1('0x4a')](handleError(_0x534c8a,null));};exports[_0x5ca1('0x6b')]=function(_0x129c15,_0x4506f0,_0x1e7087){var _0x3d10e2;return db[_0x5ca1('0x32')]['find']({'where':{'id':_0x129c15['params']['id']},'include':[{'model':db[_0x5ca1('0x6c')],'as':_0x5ca1('0x6d')}]})[_0x5ca1('0x28')](handleEntityNotFound(_0x4506f0,null))[_0x5ca1('0x28')](function(_0x50294a){if(_0x50294a){_0x3d10e2=_0x50294a;return db[_0x5ca1('0x61')][_0x5ca1('0x33')];}})[_0x5ca1('0x28')](function(_0x214271){if(_0x214271){var _0x293617={};var _0x5d9a90={};_0x5d9a90[_0x5ca1('0x36')]=_[_0x5ca1('0x6e')](_[_0x5ca1('0x37')](_0x214271),_[_0x5ca1('0x31')](_0x3d10e2[_0x5ca1('0x6d')],function(_0x534809){return util['format'](_0x5ca1('0x6f'),_0x534809['id']);}));_0x5d9a90['query']=_[_0x5ca1('0x37')](_0x129c15[_0x5ca1('0x38')]);_0x5d9a90[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x5d9a90[_0x5ca1('0x36')],_0x5d9a90['query']);_0x293617[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x5d9a90[_0x5ca1('0x36')],qs['fields'](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x293617[_0x5ca1('0x3b')]=_0x293617[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x293617['attributes']:_0x5d9a90[_0x5ca1('0x36')];if(!_0x129c15[_0x5ca1('0x38')]['hasOwnProperty'](_0x5ca1('0x70'))){_0x293617[_0x5ca1('0x5e')]=qs[_0x5ca1('0x5e')](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x5e')]);_0x293617[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x23')]);}_0x293617[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x293617[_0x5ca1('0x40')]=qs['filters'](_[_0x5ca1('0x41')](_0x129c15['query'],_0x5d9a90[_0x5ca1('0x39')]));_0x293617['raw']=!![];if(_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x293617[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x293617['where'],{'$or':_[_0x5ca1('0x31')](_0x293617[_0x5ca1('0x3b')],function(_0x2349cc){var _0x2e9180={};_0x2e9180[_0x2349cc]={'$like':'%'+_0x129c15['query'][_0x5ca1('0x42')]+'%'};return _0x2e9180;})});}_0x293617=_[_0x5ca1('0x43')]({},_0x293617,_0x129c15[_0x5ca1('0x46')]);return _0x3d10e2['getContacts'](_0x293617);}})[_0x5ca1('0x28')](respondWithResult(_0x4506f0,null))['catch'](handleError(_0x4506f0,null));};exports[_0x5ca1('0x71')]=function(_0x5405e5,_0x56e616,_0x535a53){var _0x51affc;return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x5405e5[_0x5ca1('0x4c')]['id']},'include':[{'model':db[_0x5ca1('0x6c')],'as':_0x5ca1('0x6d')}]})[_0x5ca1('0x28')](handleEntityNotFound(_0x56e616,null))['then'](function(_0x2e1acd){if(_0x2e1acd){_0x51affc=_0x2e1acd;return db[_0x5ca1('0x61')][_0x5ca1('0x33')];}})[_0x5ca1('0x28')](function(_0x285afe){if(_0x285afe){var _0x42f05b={};var _0x5adf51={};_0x5adf51[_0x5ca1('0x36')]=_[_0x5ca1('0x6e')](_[_0x5ca1('0x37')](_0x285afe),_[_0x5ca1('0x31')](_0x51affc[_0x5ca1('0x6d')],function(_0x2966dc){return util['format'](_0x5ca1('0x6f'),_0x2966dc['id']);}));_0x5adf51[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x5405e5['query']);_0x5adf51['filters']=_[_0x5ca1('0x3a')](_0x5adf51['model'],_0x5adf51[_0x5ca1('0x38')]);_0x42f05b[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x5adf51[_0x5ca1('0x36')],qs['fields'](_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x42f05b['attributes']=_0x42f05b[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x42f05b[_0x5ca1('0x3b')]:_0x5adf51[_0x5ca1('0x36')];if(!_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x3d')]('nolimit')){_0x42f05b[_0x5ca1('0x5e')]=qs[_0x5ca1('0x5e')](_0x5405e5['query'][_0x5ca1('0x5e')]);_0x42f05b[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x5405e5[_0x5ca1('0x38')]['offset']);}_0x42f05b[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x42f05b[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x5405e5[_0x5ca1('0x38')],_0x5adf51[_0x5ca1('0x39')]));_0x42f05b[_0x5ca1('0x72')]=!![];if(_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x42f05b['where']=_[_0x5ca1('0x43')](_0x42f05b['where'],{'$or':_['map'](_0x42f05b['attributes'],function(_0x316661){var _0x328ffc={};_0x328ffc[_0x316661]={'$like':'%'+_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x42')]+'%'};return _0x328ffc;})});}_0x42f05b=_[_0x5ca1('0x43')]({},_0x42f05b,_0x5405e5[_0x5ca1('0x46')]);return _0x51affc[_0x5ca1('0x6b')](_0x42f05b);}})['then'](function(_0x54eb8b){if(!_['isEmpty'](_0x54eb8b)){var _0x5e1229=toCsv(_0x54eb8b);var _0x1fbfcf=Date[_0x5ca1('0x73')]();fs[_0x5ca1('0x74')](util['format'](_0x5ca1('0x75'),_0x51affc['id'],_0x1fbfcf),_0x5e1229);_0x56e616[_0x5ca1('0x76')](_0x5ca1('0x77'),'attachment;\x20filename='+util['format']('list_%d_%s.csv',_0x51affc['id'],_0x1fbfcf));_0x56e616[_0x5ca1('0x76')](_0x5ca1('0x78'),_0x5ca1('0x79'));return _0x56e616['download'](util['format'](_0x5ca1('0x75'),_0x51affc['id'],_0x1fbfcf));}else{return _0x56e616[_0x5ca1('0x1f')](0xcc);}})[_0x5ca1('0x4a')](handleError(_0x56e616,null));};exports[_0x5ca1('0x7a')]=function(_0x2af88f,_0x5586c2,_0x2b9b4b){var _0x529333;delete _0x2af88f[_0x5ca1('0x51')]['id'];return db[_0x5ca1('0x32')][_0x5ca1('0x7b')]({'where':{'id':_0x2af88f[_0x5ca1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5586c2,null))[_0x5ca1('0x28')](function(_0x1a2b30){if(_0x1a2b30){return db[_0x5ca1('0x7c')]['transaction'](function(_0x2af364){return db[_0x5ca1('0x6c')][_0x5ca1('0x50')](_0x2af88f['body'],{'transaction':_0x2af364})['then'](function(_0x50bdf2){_0x529333=_0x50bdf2;return _0x1a2b30['addCustomFields'](_0x50bdf2,{'transaction':_0x2af364});})[_0x5ca1('0x28')](function(){var _0x158c47={'type':db[_0x5ca1('0x7d')]['TEXT'],'transaction':_0x2af364};switch(_0x2af88f[_0x5ca1('0x51')][_0x5ca1('0x44')]){case _0x5ca1('0x7e'):_0x158c47[_0x5ca1('0x44')]=db['Sequelize']['TEXT'];break;case'number':_0x158c47[_0x5ca1('0x44')]=db[_0x5ca1('0x7d')]['INTEGER'];break;case _0x5ca1('0x7f'):_0x158c47[_0x5ca1('0x44')]=db['Sequelize']['BOOLEAN'];_0x158c47[_0x5ca1('0x80')]=![];break;default:}return db[_0x5ca1('0x7c')][_0x5ca1('0x81')][_0x5ca1('0x82')](_0x5ca1('0x83'),util[_0x5ca1('0x84')](_0x5ca1('0x85'),_0x529333['id']),_0x158c47);})[_0x5ca1('0x28')](function(){return _0x529333;});});}})[_0x5ca1('0x28')](respondWithResult(_0x5586c2,null))[_0x5ca1('0x4a')](handleError(_0x5586c2,null));};exports[_0x5ca1('0x86')]=function(_0x25d9b9,_0x53079f,_0x4b1c7e){var _0x3a5cd4={};var _0x2e73d6={};var _0x24d597;var _0x5bea58;return db[_0x5ca1('0x32')]['findOne']({'where':{'id':_0x25d9b9[_0x5ca1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53079f,null))[_0x5ca1('0x28')](function(_0x4be11e){if(_0x4be11e){_0x24d597=_0x4be11e;_0x2e73d6[_0x5ca1('0x36')]=_['keys'](db[_0x5ca1('0x6c')][_0x5ca1('0x33')]);_0x2e73d6[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x25d9b9[_0x5ca1('0x38')]);_0x2e73d6[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x2e73d6[_0x5ca1('0x36')],_0x2e73d6['query']);_0x3a5cd4['attributes']=_['intersection'](_0x2e73d6[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x25d9b9['query']['fields']));_0x3a5cd4[_0x5ca1('0x3b')]=_0x3a5cd4[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x3a5cd4[_0x5ca1('0x3b')]:_0x2e73d6['model'];_0x3a5cd4['order']=qs[_0x5ca1('0x3f')](_0x25d9b9['query']['sort']);_0x3a5cd4[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x25d9b9['query'],_0x2e73d6[_0x5ca1('0x39')]));_0x3a5cd4[_0x5ca1('0x40')]=_['merge'](_0x3a5cd4[_0x5ca1('0x40')],{'$or':[{'ListId':_0x4be11e['id']},{'ListId':null}]});if(_0x25d9b9[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x3a5cd4[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x3a5cd4[_0x5ca1('0x40')],{'$or':_[_0x5ca1('0x31')](_0x3a5cd4[_0x5ca1('0x3b')],function(_0x4c26e2){var _0x3fa8e2={};_0x3fa8e2[_0x4c26e2]={'$like':'%'+_0x25d9b9[_0x5ca1('0x38')][_0x5ca1('0x42')]+'%'};return _0x3fa8e2;})});}_0x3a5cd4=_['merge']({},_0x3a5cd4,_0x25d9b9[_0x5ca1('0x46')]);return db[_0x5ca1('0x6c')][_0x5ca1('0x87')](_0x3a5cd4);}})[_0x5ca1('0x28')](respondWithResult(_0x53079f,null))[_0x5ca1('0x4a')](handleError(_0x53079f,null));};exports[_0x5ca1('0x88')]=function(_0x4104a2,_0x3ac688,_0x447d19){return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x4104a2[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x3ac688,null))[_0x5ca1('0x28')](function(_0x327140){if(_0x327140){return _0x327140[_0x5ca1('0x88')](_0x4104a2[_0x5ca1('0x51')][_0x5ca1('0x60')],_['omit'](_0x4104a2[_0x5ca1('0x51')],[_0x5ca1('0x60'),'id'])||{})['spread'](function(_0x43b658){for(var _0xb6d35f=0x0;_0xb6d35f<_0x4104a2[_0x5ca1('0x51')][_0x5ca1('0x60')][_0x5ca1('0x4d')];_0xb6d35f+=0x1){socket[_0x5ca1('0x89')](_0x5ca1('0x8a'),{'UserId':_0x4104a2['body']['ids'][_0xb6d35f],'CmListId':_0x4104a2[_0x5ca1('0x4c')]['id']});}return _0x43b658;});}})[_0x5ca1('0x28')](respondWithResult(_0x3ac688,null))[_0x5ca1('0x4a')](handleError(_0x3ac688,null));};exports[_0x5ca1('0x8b')]=function(_0x27fe4a,_0x277661,_0x487f9c){return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x27fe4a[_0x5ca1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x277661,null))[_0x5ca1('0x28')](function(_0x219173){if(_0x219173){return _0x219173[_0x5ca1('0x8b')](_0x27fe4a[_0x5ca1('0x38')][_0x5ca1('0x60')])[_0x5ca1('0x28')](function(){if(_[_0x5ca1('0x63')](_0x27fe4a['query'][_0x5ca1('0x60')])){for(var _0x2df32d=0x0;_0x2df32d<_0x27fe4a[_0x5ca1('0x38')][_0x5ca1('0x60')][_0x5ca1('0x4d')];_0x2df32d+=0x1){socket[_0x5ca1('0x89')](_0x5ca1('0x8c'),{'UserId':Number(_0x27fe4a[_0x5ca1('0x38')][_0x5ca1('0x60')][_0x2df32d]),'CmListId':Number(_0x27fe4a[_0x5ca1('0x4c')]['id'])});}}else{socket[_0x5ca1('0x89')](_0x5ca1('0x8c'),{'UserId':Number(_0x27fe4a['query']['ids']),'CmListId':Number(_0x27fe4a[_0x5ca1('0x4c')]['id'])});}});}})[_0x5ca1('0x28')](respondWithStatusCode(_0x277661,null))[_0x5ca1('0x4a')](handleError(_0x277661,null));};exports[_0x5ca1('0x8d')]=function(_0x3bbcf9,_0x350448,_0x5d2204){var _0x50c643={};var _0x1704eb={};var _0x50f092;var _0x257cc0;return db[_0x5ca1('0x32')]['findOne']({'where':{'id':_0x3bbcf9[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x350448,null))[_0x5ca1('0x28')](function(_0x3406d6){if(_0x3406d6){_0x50f092=_0x3406d6;_0x1704eb['model']=_[_0x5ca1('0x37')](db[_0x5ca1('0x8e')][_0x5ca1('0x33')]);_0x1704eb['query']=_[_0x5ca1('0x37')](_0x3bbcf9['query']);_0x1704eb[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x1704eb[_0x5ca1('0x36')],_0x1704eb[_0x5ca1('0x38')]);_0x50c643[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x1704eb[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x3bbcf9[_0x5ca1('0x38')]['fields']));_0x50c643[_0x5ca1('0x3b')]=_0x50c643[_0x5ca1('0x3b')]['length']?_0x50c643[_0x5ca1('0x3b')]:_0x1704eb[_0x5ca1('0x36')];_0x50c643[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x3bbcf9[_0x5ca1('0x38')]['sort']);_0x50c643[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_['pick'](_0x3bbcf9[_0x5ca1('0x38')],_0x1704eb[_0x5ca1('0x39')]));if(_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x50c643[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x50c643[_0x5ca1('0x40')],{'$or':_['map'](_0x50c643['attributes'],function(_0x49f7da){var _0x43f2e5={};_0x43f2e5[_0x49f7da]={'$like':'%'+_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x42')]+'%'};return _0x43f2e5;})});}_0x50c643=_[_0x5ca1('0x43')]({},_0x50c643,_0x3bbcf9['options']);return _0x50f092[_0x5ca1('0x8d')](_0x50c643);}})['then'](function(_0x3632bd){if(_0x3632bd){_0x257cc0=_0x3632bd['length'];if(!_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x3d')](_0x5ca1('0x70'))){_0x50c643[_0x5ca1('0x5e')]=qs[_0x5ca1('0x5e')](_0x3bbcf9[_0x5ca1('0x38')]['limit']);_0x50c643[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x23')]);}return _0x50f092[_0x5ca1('0x8d')](_0x50c643);}})[_0x5ca1('0x28')](function(_0x2012ec){if(_0x2012ec){return _0x2012ec?{'count':_0x257cc0,'rows':_0x2012ec}:null;}})[_0x5ca1('0x28')](respondWithResult(_0x350448,null))['catch'](handleError(_0x350448,null));}; \ No newline at end of file +var _0x3c0f=['offset','limit','status','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','getContactsCsv','raw','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','text','number','INTEGER','BOOLEAN','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','json'];(function(_0x28abd3,_0x1f2447){var _0x3becda=function(_0x7bbda2){while(--_0x7bbda2){_0x28abd3['push'](_0x28abd3['shift']());}};_0x3becda(++_0x1f2447);}(_0x3c0f,0x102));var _0xf3c0=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x3c0f[_0x43941d];return _0x27b82a;};'use strict';var pdf=require(_0xf3c0('0x0'));var emlformat=require(_0xf3c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf3c0('0x2'));var jsonpatch=require(_0xf3c0('0x3'));var rp=require(_0xf3c0('0x4'));var moment=require(_0xf3c0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf3c0('0x6'));var util=require(_0xf3c0('0x7'));var path=require(_0xf3c0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf3c0('0x9'));var crypto=require(_0xf3c0('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf3c0('0xb'));var querystring=require('querystring');var Papa=require(_0xf3c0('0xc'));var Redis=require(_0xf3c0('0xd'));var authService=require(_0xf3c0('0xe'));var qs=require(_0xf3c0('0xf'));var as=require(_0xf3c0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf3c0('0x11'));var utils=require(_0xf3c0('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf3c0('0x13'));var db=require(_0xf3c0('0x14'))['db'];config[_0xf3c0('0x15')]=_[_0xf3c0('0x16')](config[_0xf3c0('0x15')],{'host':_0xf3c0('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3c0('0x15')]));require(_0xf3c0('0x18'))[_0xf3c0('0x19')](socket);function respondWithStatusCode(_0x283c86,_0x1c75a2){_0x1c75a2=_0x1c75a2||0xcc;return function(_0x592469){if(_0x592469){return _0x283c86[_0xf3c0('0x1a')](_0x1c75a2);}return _0x283c86['status'](_0x1c75a2)['end']();};}function respondWithResult(_0x51f293,_0x5a0cd9){_0x5a0cd9=_0x5a0cd9||0xc8;return function(_0x3985f1){if(_0x3985f1){return _0x51f293['status'](_0x5a0cd9)[_0xf3c0('0x1b')](_0x3985f1);}};}function respondWithFilteredResult(_0x36dcac,_0xe61bac){return function(_0xc9313b){if(_0xc9313b){var _0x3c12ba=_0xc9313b['count'],_0x2ebffa=_0xe61bac[_0xf3c0('0x1c')],_0x3fa65d=_0xe61bac[_0xf3c0('0x1c')]+_0xe61bac[_0xf3c0('0x1d')],_0x4e4bc1;if(_0x3fa65d>=_0x3c12ba){_0x3fa65d=_0x3c12ba;_0x4e4bc1=0xc8;}else{_0x4e4bc1=0xce;}_0x36dcac[_0xf3c0('0x1e')](_0x4e4bc1);return _0x36dcac[_0xf3c0('0x1f')](_0xf3c0('0x20'),_0x2ebffa+'-'+_0x3fa65d+'/'+_0x3c12ba)['json'](_0xc9313b);}return null;};}function patchUpdates(_0x254220){return function(_0x54cb84){try{jsonpatch[_0xf3c0('0x21')](_0x54cb84,_0x254220,!![]);}catch(_0x117eed){return BPromise[_0xf3c0('0x22')](_0x117eed);}return _0x54cb84['save']();};}function saveUpdates(_0xf859e2,_0x3c2b5c){return function(_0x1a698b){if(_0x1a698b){return _0x1a698b[_0xf3c0('0x23')](_0xf859e2)['then'](function(_0x23b9b4){return _0x23b9b4;});}return null;};}function removeEntity(_0x372aab,_0x2b1aba){return function(_0xdbf894){if(_0xdbf894){return _0xdbf894['destroy']()[_0xf3c0('0x24')](function(){var _0x1529fa=_0xdbf894[_0xf3c0('0x25')]({'plain':!![]});var _0x3d0878='Lists';return db[_0xf3c0('0x26')][_0xf3c0('0x27')]({'where':{'type':_0x3d0878,'resourceId':_0x1529fa['id']}})[_0xf3c0('0x24')](function(){return _0xdbf894;});})[_0xf3c0('0x24')](function(){_0x372aab[_0xf3c0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2336f1,_0x5bf0f6){return function(_0xd06c89){if(!_0xd06c89){_0x2336f1['sendStatus'](0x194);}return _0xd06c89;};}function handleError(_0x48f0af,_0x4dd085){_0x4dd085=_0x4dd085||0x1f4;return function(_0x417422){logger['error'](_0x417422['stack']);if(_0x417422['name']){delete _0x417422[_0xf3c0('0x28')];}_0x48f0af[_0xf3c0('0x1e')](_0x4dd085)[_0xf3c0('0x29')](_0x417422);};}exports[_0xf3c0('0x2a')]=function(_0xb595d1,_0x2598e2){var _0x2d5c7e={},_0x4e486b={},_0x33471f={'count':0x0,'rows':[]};var _0xd5c185=_[_0xf3c0('0x2b')](db[_0xf3c0('0x2c')][_0xf3c0('0x2d')],function(_0x429a21){return{'name':_0x429a21[_0xf3c0('0x2e')],'type':_0x429a21[_0xf3c0('0x2f')]['key']};});_0x4e486b[_0xf3c0('0x30')]=_[_0xf3c0('0x2b')](_0xd5c185,_0xf3c0('0x28'));_0x4e486b[_0xf3c0('0x31')]=_[_0xf3c0('0x32')](_0xb595d1['query']);_0x4e486b[_0xf3c0('0x33')]=_[_0xf3c0('0x34')](_0x4e486b[_0xf3c0('0x30')],_0x4e486b['query']);_0x2d5c7e['attributes']=_['intersection'](_0x4e486b[_0xf3c0('0x30')],qs[_0xf3c0('0x35')](_0xb595d1[_0xf3c0('0x31')][_0xf3c0('0x35')]));_0x2d5c7e[_0xf3c0('0x36')]=_0x2d5c7e[_0xf3c0('0x36')][_0xf3c0('0x37')]?_0x2d5c7e[_0xf3c0('0x36')]:_0x4e486b[_0xf3c0('0x30')];if(!_0xb595d1[_0xf3c0('0x31')]['hasOwnProperty']('nolimit')){_0x2d5c7e[_0xf3c0('0x1d')]=qs['limit'](_0xb595d1[_0xf3c0('0x31')][_0xf3c0('0x1d')]);_0x2d5c7e[_0xf3c0('0x1c')]=qs[_0xf3c0('0x1c')](_0xb595d1[_0xf3c0('0x31')][_0xf3c0('0x1c')]);}_0x2d5c7e[_0xf3c0('0x38')]=qs['sort'](_0xb595d1[_0xf3c0('0x31')][_0xf3c0('0x39')]);_0x2d5c7e[_0xf3c0('0x3a')]=qs[_0xf3c0('0x33')](_[_0xf3c0('0x3b')](_0xb595d1[_0xf3c0('0x31')],_0x4e486b[_0xf3c0('0x33')]),_0xd5c185);if(_0xb595d1[_0xf3c0('0x31')][_0xf3c0('0x3c')]){_0x2d5c7e[_0xf3c0('0x3a')]=_[_0xf3c0('0x3d')](_0x2d5c7e['where'],{'$or':_['map'](_0xd5c185,function(_0xab1697){if(_0xab1697[_0xf3c0('0x2f')]!==_0xf3c0('0x3e')){var _0x1ecb06={};_0x1ecb06[_0xab1697[_0xf3c0('0x28')]]={'$like':'%'+_0xb595d1[_0xf3c0('0x31')][_0xf3c0('0x3c')]+'%'};return _0x1ecb06;}})});}_0x2d5c7e=_['merge']({},_0x2d5c7e,_0xb595d1[_0xf3c0('0x3f')]);var _0x21b347={'where':_0x2d5c7e[_0xf3c0('0x3a')]};return db[_0xf3c0('0x2c')][_0xf3c0('0x40')](_0x21b347)[_0xf3c0('0x24')](function(_0x47f4c9){_0x33471f['count']=_0x47f4c9;if(_0xb595d1[_0xf3c0('0x31')][_0xf3c0('0x41')]){_0x2d5c7e[_0xf3c0('0x42')]=[{'all':!![]}];}return db[_0xf3c0('0x2c')][_0xf3c0('0x43')](_0x2d5c7e);})['then'](function(_0x468290){_0x33471f[_0xf3c0('0x44')]=_0x468290;return _0x33471f;})['then'](respondWithFilteredResult(_0x2598e2,_0x2d5c7e))[_0xf3c0('0x45')](handleError(_0x2598e2,null));};exports[_0xf3c0('0x46')]=function(_0x4f095e,_0x6c47c0){var _0x370e00={'raw':![],'where':{'id':_0x4f095e[_0xf3c0('0x47')]['id']}},_0x510f92={};_0x510f92['model']=_[_0xf3c0('0x32')](db['CmList'][_0xf3c0('0x2d')]);_0x510f92['query']=_['keys'](_0x4f095e[_0xf3c0('0x31')]);_0x510f92[_0xf3c0('0x33')]=_[_0xf3c0('0x34')](_0x510f92['model'],_0x510f92[_0xf3c0('0x31')]);_0x370e00['attributes']=_[_0xf3c0('0x34')](_0x510f92[_0xf3c0('0x30')],qs[_0xf3c0('0x35')](_0x4f095e['query']['fields']));_0x370e00[_0xf3c0('0x36')]=_0x370e00[_0xf3c0('0x36')][_0xf3c0('0x37')]?_0x370e00[_0xf3c0('0x36')]:_0x510f92[_0xf3c0('0x30')];if(_0x4f095e['query'][_0xf3c0('0x41')]){_0x370e00[_0xf3c0('0x42')]=[{'all':!![]}];}_0x370e00=_['merge']({},_0x370e00,_0x4f095e[_0xf3c0('0x3f')]);return db[_0xf3c0('0x2c')][_0xf3c0('0x48')](_0x370e00)['then'](handleEntityNotFound(_0x6c47c0,null))['then'](respondWithResult(_0x6c47c0,null))[_0xf3c0('0x45')](handleError(_0x6c47c0,null));};exports[_0xf3c0('0x49')]=function(_0x15d894,_0x4254fe){return db['CmList'][_0xf3c0('0x49')](_0x15d894['body'],{})[_0xf3c0('0x24')](function(_0x928567){var _0x435338=_0x15d894[_0xf3c0('0x4a')]['get']({'plain':!![]});if(!_0x435338)throw new Error(_0xf3c0('0x4b'));if(_0x435338[_0xf3c0('0x4c')]===_0xf3c0('0x4a')){var _0x10347b=_0x928567[_0xf3c0('0x25')]({'plain':!![]});var _0x309bca=_0xf3c0('0x4d');return db[_0xf3c0('0x4e')]['find']({'where':{'name':_0x309bca,'userProfileId':_0x435338[_0xf3c0('0x4f')]},'raw':!![]})[_0xf3c0('0x24')](function(_0xff862f){if(_0xff862f&&_0xff862f[_0xf3c0('0x50')]===0x0){return db[_0xf3c0('0x26')][_0xf3c0('0x49')]({'name':_0x10347b[_0xf3c0('0x28')],'resourceId':_0x10347b['id'],'type':_0xff862f[_0xf3c0('0x28')],'sectionId':_0xff862f['id']},{})[_0xf3c0('0x24')](function(){return _0x928567;});}else{return _0x928567;}})['catch'](function(_0x14390e){logger[_0xf3c0('0x51')](_0xf3c0('0x52'),_0x14390e);throw _0x14390e;});}return _0x928567;})[_0xf3c0('0x24')](respondWithResult(_0x4254fe,0xc9))[_0xf3c0('0x45')](handleError(_0x4254fe,null));};exports['update']=function(_0x38a911,_0x168375){if(_0x38a911['body']['id']){delete _0x38a911[_0xf3c0('0x53')]['id'];}return db['CmList'][_0xf3c0('0x48')]({'where':{'id':_0x38a911[_0xf3c0('0x47')]['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x168375,null))[_0xf3c0('0x24')](saveUpdates(_0x38a911[_0xf3c0('0x53')],null))[_0xf3c0('0x24')](respondWithResult(_0x168375,null))[_0xf3c0('0x45')](handleError(_0x168375,null));};exports[_0xf3c0('0x27')]=function(_0x1a32d0,_0x1d5223){return db[_0xf3c0('0x2c')][_0xf3c0('0x48')]({'where':{'id':_0x1a32d0['params']['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x1d5223,null))[_0xf3c0('0x24')](removeEntity(_0x1d5223,null))[_0xf3c0('0x45')](handleError(_0x1d5223,null));};exports[_0xf3c0('0x54')]=function(_0xba02ca,_0x4eb196){return db[_0xf3c0('0x2c')][_0xf3c0('0x54')]()[_0xf3c0('0x24')](respondWithResult(_0x4eb196,null))[_0xf3c0('0x45')](handleError(_0x4eb196,null));};exports[_0xf3c0('0x55')]=function(_0x2a7607,_0x1b0c78,_0x69357d){if(_0x2a7607[_0xf3c0('0x53')]['id']){delete _0x2a7607[_0xf3c0('0x53')]['id'];}return db['CmList']['find']({'where':{'id':_0x2a7607[_0xf3c0('0x47')]['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x1b0c78,null))[_0xf3c0('0x24')](function(_0x4ba7c3){if(_0x4ba7c3){_0x2a7607['body'][_0xf3c0('0x56')]=_0x4ba7c3['id'];return db[_0xf3c0('0x57')][_0xf3c0('0x49')](_0x2a7607[_0xf3c0('0x53')]);}})[_0xf3c0('0x24')](respondWithResult(_0x1b0c78,null))[_0xf3c0('0x45')](handleError(_0x1b0c78,null));};exports[_0xf3c0('0x58')]=function(_0x37f21f,_0x3b9dc7,_0x462ccd){var _0x5a500e={'raw':![],'where':{}};var _0x33c970={};var _0x3fd9b9={'count':0x0,'rows':[]};return db[_0xf3c0('0x2c')][_0xf3c0('0x59')]({'where':{'id':_0x37f21f[_0xf3c0('0x47')]['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x3b9dc7,null))[_0xf3c0('0x24')](function(_0x44082c){if(_0x44082c){_0x33c970[_0xf3c0('0x30')]=_['keys'](db[_0xf3c0('0x57')][_0xf3c0('0x2d')]);_0x33c970[_0xf3c0('0x31')]=_[_0xf3c0('0x32')](_0x37f21f['query']);_0x33c970[_0xf3c0('0x33')]=_['intersection'](_0x33c970[_0xf3c0('0x30')],_0x33c970[_0xf3c0('0x31')]);_0x5a500e[_0xf3c0('0x36')]=_[_0xf3c0('0x34')](_0x33c970['model'],qs[_0xf3c0('0x35')](_0x37f21f['query'][_0xf3c0('0x35')]));_0x5a500e[_0xf3c0('0x36')]=_0x5a500e[_0xf3c0('0x36')]['length']?_0x5a500e[_0xf3c0('0x36')]:_0x33c970[_0xf3c0('0x30')];if(!_0x37f21f[_0xf3c0('0x31')]['hasOwnProperty'](_0xf3c0('0x5a'))){_0x5a500e[_0xf3c0('0x1d')]=qs[_0xf3c0('0x1d')](_0x37f21f[_0xf3c0('0x31')]['limit']);_0x5a500e[_0xf3c0('0x1c')]=qs[_0xf3c0('0x1c')](_0x37f21f[_0xf3c0('0x31')][_0xf3c0('0x1c')]);}_0x5a500e[_0xf3c0('0x38')]=qs[_0xf3c0('0x39')](_0x37f21f[_0xf3c0('0x31')][_0xf3c0('0x39')]);_0x5a500e['where']=qs[_0xf3c0('0x33')](_[_0xf3c0('0x3b')](_0x37f21f['query'],_0x33c970[_0xf3c0('0x33')]));_0x5a500e['where'][_0xf3c0('0x56')]=_0x44082c['id'];if(_0x37f21f[_0xf3c0('0x31')][_0xf3c0('0x3c')]){_0x5a500e[_0xf3c0('0x3a')]=_[_0xf3c0('0x3d')](_0x5a500e[_0xf3c0('0x3a')],{'$or':_[_0xf3c0('0x2b')](_0x5a500e[_0xf3c0('0x36')],function(_0x59ae91){var _0x428d27={};_0x428d27[_0x59ae91]={'$like':'%'+_0x37f21f[_0xf3c0('0x31')]['filter']+'%'};return _0x428d27;})});}_0x5a500e=_[_0xf3c0('0x3d')]({},_0x5a500e,_0x37f21f['options']);return db[_0xf3c0('0x57')][_0xf3c0('0x40')]({'where':_0x5a500e[_0xf3c0('0x3a')]})[_0xf3c0('0x24')](function(_0x5b2fa0){_0x3fd9b9['count']=_0x5b2fa0;if(_0x37f21f[_0xf3c0('0x31')][_0xf3c0('0x41')]){_0x5a500e[_0xf3c0('0x42')]=[{'all':!![]}];}return db[_0xf3c0('0x57')][_0xf3c0('0x43')](_0x5a500e);})[_0xf3c0('0x24')](function(_0x3649d8){_0x3fd9b9[_0xf3c0('0x44')]=_0x3649d8;return _0x3fd9b9;});}})[_0xf3c0('0x24')](respondWithFilteredResult(_0x3b9dc7,_0x5a500e))[_0xf3c0('0x45')](handleError(_0x3b9dc7,null));};exports[_0xf3c0('0x5b')]=function(_0x189af3,_0x26d3a7,_0x143373){return db['CmList'][_0xf3c0('0x48')]({'where':{'id':_0x189af3[_0xf3c0('0x47')]['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x26d3a7,null))[_0xf3c0('0x24')](function(_0x43978f){if(_0x43978f){return _0x43978f[_0xf3c0('0x5b')](_0x189af3[_0xf3c0('0x31')][_0xf3c0('0x5c')]);}})[_0xf3c0('0x24')](respondWithStatusCode(_0x26d3a7,null))['catch'](handleError(_0x26d3a7,null));};exports[_0xf3c0('0x5d')]=function(_0x1c1c84,_0x22c0cf,_0x54dabd){return db[_0xf3c0('0x2c')][_0xf3c0('0x48')]({'where':{'id':_0x1c1c84[_0xf3c0('0x47')]['id']}})['then'](handleEntityNotFound(_0x22c0cf,null))[_0xf3c0('0x24')](function(_0x4d7127){if(_0x4d7127){var _0x33e06a=[];var _0x2840b9={'success':[],'errors':[]};return db[_0xf3c0('0x5e')][_0xf3c0('0x54')]()['then'](function(_0x1553b4){if(_0x1c1c84[_0xf3c0('0x53')][_0xf3c0('0x5f')]&&_[_0xf3c0('0x60')](_0x1c1c84[_0xf3c0('0x53')]['tags'])){if(_0x1c1c84[_0xf3c0('0x53')]['tags'][_0xf3c0('0x37')]){_0x1c1c84[_0xf3c0('0x53')][_0xf3c0('0x5f')]=_0x1c1c84['body']['tags'][_0xf3c0('0x61')](';')+';';}else{_0x1c1c84[_0xf3c0('0x53')][_0xf3c0('0x5f')]=null;}}else{_0x1c1c84[_0xf3c0('0x53')][_0xf3c0('0x5f')]=null;}if(_0x1c1c84[_0xf3c0('0x53')]&&_[_0xf3c0('0x60')](_0x1c1c84[_0xf3c0('0x53')])){for(var _0x4d2846=0x0;_0x4d2846<_0x1c1c84['body'][_0xf3c0('0x37')];_0x4d2846+=0x1){_0x1c1c84[_0xf3c0('0x53')][_0x4d2846][_0xf3c0('0x56')]=_0x1c1c84[_0xf3c0('0x47')]['id'];_0x33e06a['push'](_0x1c1c84[_0xf3c0('0x53')][_0x4d2846]);}return BPromise[_0xf3c0('0x62')](_0x33e06a,function(_0x2a7ca1){return db[_0xf3c0('0x5e')][_0xf3c0('0x49')](_[_0xf3c0('0x63')](_0x2a7ca1,[_0xf3c0('0x5c'),'id'])||{},{'fields':_[_0xf3c0('0x32')](_0x1553b4),'raw':!![]})[_0xf3c0('0x24')](function(_0xd7aa3c){_0x2840b9[_0xf3c0('0x64')][_0xf3c0('0x65')](_0xd7aa3c[_0xf3c0('0x66')]);})[_0xf3c0('0x45')](function(_0x29d88a){_0x2840b9[_0xf3c0('0x67')]['push']({'data':_0x2a7ca1,'error':_0x29d88a[_0xf3c0('0x68')]});});})['then'](function(_0x31c774){return _0x2840b9;})[_0xf3c0('0x45')](function(_0xd585ce){return _0xd585ce;});}else{_0x22c0cf[_0xf3c0('0x1e')](0x190)[_0xf3c0('0x1b')]({'message':_0xf3c0('0x69')});}});}})['then'](respondWithResult(_0x22c0cf,null))[_0xf3c0('0x45')](handleError(_0x22c0cf,null));};exports[_0xf3c0('0x6a')]=function(_0x244283,_0x527a2a,_0x5e267d){var _0x5c2b71;return db[_0xf3c0('0x2c')][_0xf3c0('0x48')]({'where':{'id':_0x244283[_0xf3c0('0x47')]['id']},'include':[{'model':db[_0xf3c0('0x6b')],'as':_0xf3c0('0x6c')}]})['then'](handleEntityNotFound(_0x527a2a,null))['then'](function(_0x2ac483){if(_0x2ac483){_0x5c2b71=_0x2ac483;return db['CmContact'][_0xf3c0('0x2d')];}})[_0xf3c0('0x24')](function(_0x17c8ae){if(_0x17c8ae){var _0x2b724a={};var _0x48b623={};_0x48b623[_0xf3c0('0x30')]=_[_0xf3c0('0x6d')](_[_0xf3c0('0x32')](_0x17c8ae),_['map'](_0x5c2b71[_0xf3c0('0x6c')],function(_0x575001){return util[_0xf3c0('0x6e')](_0xf3c0('0x6f'),_0x575001['id']);}));_0x48b623['query']=_[_0xf3c0('0x32')](_0x244283[_0xf3c0('0x31')]);_0x48b623['filters']=_[_0xf3c0('0x34')](_0x48b623[_0xf3c0('0x30')],_0x48b623['query']);_0x2b724a['attributes']=_['intersection'](_0x48b623[_0xf3c0('0x30')],qs['fields'](_0x244283['query'][_0xf3c0('0x35')]));_0x2b724a[_0xf3c0('0x36')]=_0x2b724a[_0xf3c0('0x36')][_0xf3c0('0x37')]?_0x2b724a['attributes']:_0x48b623['model'];if(!_0x244283['query'][_0xf3c0('0x70')](_0xf3c0('0x5a'))){_0x2b724a['limit']=qs[_0xf3c0('0x1d')](_0x244283['query'][_0xf3c0('0x1d')]);_0x2b724a[_0xf3c0('0x1c')]=qs[_0xf3c0('0x1c')](_0x244283[_0xf3c0('0x31')]['offset']);}_0x2b724a[_0xf3c0('0x38')]=qs[_0xf3c0('0x39')](_0x244283['query'][_0xf3c0('0x39')]);_0x2b724a[_0xf3c0('0x3a')]=qs['filters'](_[_0xf3c0('0x3b')](_0x244283[_0xf3c0('0x31')],_0x48b623[_0xf3c0('0x33')]));_0x2b724a['raw']=!![];if(_0x244283[_0xf3c0('0x31')]['filter']){_0x2b724a[_0xf3c0('0x3a')]=_['merge'](_0x2b724a[_0xf3c0('0x3a')],{'$or':_[_0xf3c0('0x2b')](_0x2b724a[_0xf3c0('0x36')],function(_0x23d613){var _0x181b07={};_0x181b07[_0x23d613]={'$like':'%'+_0x244283[_0xf3c0('0x31')][_0xf3c0('0x3c')]+'%'};return _0x181b07;})});}_0x2b724a=_[_0xf3c0('0x3d')]({},_0x2b724a,_0x244283[_0xf3c0('0x3f')]);return _0x5c2b71[_0xf3c0('0x6a')](_0x2b724a);}})['then'](respondWithResult(_0x527a2a,null))['catch'](handleError(_0x527a2a,null));};exports[_0xf3c0('0x71')]=function(_0x5cb31c,_0x44544e,_0xb3c000){var _0xd1bd28;return db[_0xf3c0('0x2c')][_0xf3c0('0x48')]({'where':{'id':_0x5cb31c[_0xf3c0('0x47')]['id']},'include':[{'model':db[_0xf3c0('0x6b')],'as':_0xf3c0('0x6c')}]})[_0xf3c0('0x24')](handleEntityNotFound(_0x44544e,null))['then'](function(_0x1cd3ee){if(_0x1cd3ee){_0xd1bd28=_0x1cd3ee;return db[_0xf3c0('0x5e')][_0xf3c0('0x2d')];}})[_0xf3c0('0x24')](function(_0x755801){if(_0x755801){var _0x51a564={};var _0x2c2ebd={};_0x2c2ebd[_0xf3c0('0x30')]=_['concat'](_[_0xf3c0('0x32')](_0x755801),_[_0xf3c0('0x2b')](_0xd1bd28[_0xf3c0('0x6c')],function(_0x219bfc){return util[_0xf3c0('0x6e')](_0xf3c0('0x6f'),_0x219bfc['id']);}));_0x2c2ebd[_0xf3c0('0x31')]=_[_0xf3c0('0x32')](_0x5cb31c[_0xf3c0('0x31')]);_0x2c2ebd[_0xf3c0('0x33')]=_[_0xf3c0('0x34')](_0x2c2ebd[_0xf3c0('0x30')],_0x2c2ebd[_0xf3c0('0x31')]);_0x51a564[_0xf3c0('0x36')]=_[_0xf3c0('0x34')](_0x2c2ebd[_0xf3c0('0x30')],qs[_0xf3c0('0x35')](_0x5cb31c['query'][_0xf3c0('0x35')]));_0x51a564[_0xf3c0('0x36')]=_0x51a564[_0xf3c0('0x36')][_0xf3c0('0x37')]?_0x51a564[_0xf3c0('0x36')]:_0x2c2ebd[_0xf3c0('0x30')];if(!_0x5cb31c[_0xf3c0('0x31')][_0xf3c0('0x70')](_0xf3c0('0x5a'))){_0x51a564[_0xf3c0('0x1d')]=qs[_0xf3c0('0x1d')](_0x5cb31c[_0xf3c0('0x31')][_0xf3c0('0x1d')]);_0x51a564[_0xf3c0('0x1c')]=qs['offset'](_0x5cb31c[_0xf3c0('0x31')]['offset']);}_0x51a564[_0xf3c0('0x38')]=qs[_0xf3c0('0x39')](_0x5cb31c[_0xf3c0('0x31')]['sort']);_0x51a564[_0xf3c0('0x3a')]=qs['filters'](_['pick'](_0x5cb31c[_0xf3c0('0x31')],_0x2c2ebd[_0xf3c0('0x33')]));_0x51a564[_0xf3c0('0x72')]=!![];if(_0x5cb31c[_0xf3c0('0x31')]['filter']){_0x51a564[_0xf3c0('0x3a')]=_[_0xf3c0('0x3d')](_0x51a564['where'],{'$or':_[_0xf3c0('0x2b')](_0x51a564['attributes'],function(_0x3ea625){var _0x4cdfeb={};_0x4cdfeb[_0x3ea625]={'$like':'%'+_0x5cb31c[_0xf3c0('0x31')][_0xf3c0('0x3c')]+'%'};return _0x4cdfeb;})});}_0x51a564=_[_0xf3c0('0x3d')]({},_0x51a564,_0x5cb31c[_0xf3c0('0x3f')]);return _0xd1bd28[_0xf3c0('0x6a')](_0x51a564);}})['then'](function(_0x48845f){if(!_[_0xf3c0('0x73')](_0x48845f)){var _0x4bc69d=toCsv(_0x48845f);var _0x595757=Date['now']();fs[_0xf3c0('0x74')](util[_0xf3c0('0x6e')](_0xf3c0('0x75'),_0xd1bd28['id'],_0x595757),_0x4bc69d);_0x44544e[_0xf3c0('0x76')]('Content-disposition',_0xf3c0('0x77')+util['format']('list_%d_%s.csv',_0xd1bd28['id'],_0x595757));_0x44544e['setHeader'](_0xf3c0('0x78'),_0xf3c0('0x79'));return _0x44544e[_0xf3c0('0x7a')](util[_0xf3c0('0x6e')](_0xf3c0('0x75'),_0xd1bd28['id'],_0x595757));}else{return _0x44544e[_0xf3c0('0x1a')](0xcc);}})[_0xf3c0('0x45')](handleError(_0x44544e,null));};exports[_0xf3c0('0x7b')]=function(_0x3fa7ce,_0x2d7743,_0x13a759){var _0x54c275;delete _0x3fa7ce['body']['id'];return db[_0xf3c0('0x2c')][_0xf3c0('0x59')]({'where':{'id':_0x3fa7ce[_0xf3c0('0x47')]['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x2d7743,null))['then'](function(_0x438559){if(_0x438559){return db['sequelize'][_0xf3c0('0x7c')](function(_0x4a3073){return db[_0xf3c0('0x6b')][_0xf3c0('0x49')](_0x3fa7ce[_0xf3c0('0x53')],{'transaction':_0x4a3073})[_0xf3c0('0x24')](function(_0x469467){_0x54c275=_0x469467;return _0x438559[_0xf3c0('0x7d')](_0x469467,{'transaction':_0x4a3073});})[_0xf3c0('0x24')](function(){var _0x3372df={'type':db[_0xf3c0('0x7e')]['TEXT'],'transaction':_0x4a3073};switch(_0x3fa7ce['body']['type']){case _0xf3c0('0x7f'):_0x3372df[_0xf3c0('0x2f')]=db[_0xf3c0('0x7e')]['TEXT'];break;case _0xf3c0('0x80'):_0x3372df['type']=db[_0xf3c0('0x7e')][_0xf3c0('0x81')];break;case'switch':_0x3372df[_0xf3c0('0x2f')]=db['Sequelize'][_0xf3c0('0x82')];_0x3372df['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0xf3c0('0x83')](_0xf3c0('0x84'),util['format'](_0xf3c0('0x85'),_0x54c275['id']),_0x3372df);})[_0xf3c0('0x24')](function(){return _0x54c275;});});}})[_0xf3c0('0x24')](respondWithResult(_0x2d7743,null))[_0xf3c0('0x45')](handleError(_0x2d7743,null));};exports['getCustomFields']=function(_0x492b1c,_0x39932a,_0x55138d){var _0x34c32c={};var _0x476d94={};var _0x114af1;var _0x546af8;return db['CmList']['findOne']({'where':{'id':_0x492b1c[_0xf3c0('0x47')]['id']}})['then'](handleEntityNotFound(_0x39932a,null))[_0xf3c0('0x24')](function(_0x3db8ac){if(_0x3db8ac){_0x114af1=_0x3db8ac;_0x476d94[_0xf3c0('0x30')]=_[_0xf3c0('0x32')](db[_0xf3c0('0x6b')][_0xf3c0('0x2d')]);_0x476d94[_0xf3c0('0x31')]=_['keys'](_0x492b1c[_0xf3c0('0x31')]);_0x476d94[_0xf3c0('0x33')]=_[_0xf3c0('0x34')](_0x476d94[_0xf3c0('0x30')],_0x476d94[_0xf3c0('0x31')]);_0x34c32c[_0xf3c0('0x36')]=_[_0xf3c0('0x34')](_0x476d94['model'],qs[_0xf3c0('0x35')](_0x492b1c['query']['fields']));_0x34c32c[_0xf3c0('0x36')]=_0x34c32c['attributes'][_0xf3c0('0x37')]?_0x34c32c[_0xf3c0('0x36')]:_0x476d94[_0xf3c0('0x30')];_0x34c32c[_0xf3c0('0x38')]=qs[_0xf3c0('0x39')](_0x492b1c[_0xf3c0('0x31')]['sort']);_0x34c32c[_0xf3c0('0x3a')]=qs['filters'](_[_0xf3c0('0x3b')](_0x492b1c[_0xf3c0('0x31')],_0x476d94['filters']));_0x34c32c[_0xf3c0('0x3a')]=_[_0xf3c0('0x3d')](_0x34c32c['where'],{'$or':[{'ListId':_0x3db8ac['id']},{'ListId':null}]});if(_0x492b1c[_0xf3c0('0x31')][_0xf3c0('0x3c')]){_0x34c32c[_0xf3c0('0x3a')]=_['merge'](_0x34c32c[_0xf3c0('0x3a')],{'$or':_['map'](_0x34c32c[_0xf3c0('0x36')],function(_0x45a10c){var _0x1b504c={};_0x1b504c[_0x45a10c]={'$like':'%'+_0x492b1c[_0xf3c0('0x31')][_0xf3c0('0x3c')]+'%'};return _0x1b504c;})});}_0x34c32c=_['merge']({},_0x34c32c,_0x492b1c['options']);return db[_0xf3c0('0x6b')][_0xf3c0('0x86')](_0x34c32c);}})[_0xf3c0('0x24')](respondWithResult(_0x39932a,null))[_0xf3c0('0x45')](handleError(_0x39932a,null));};exports[_0xf3c0('0x87')]=function(_0x26b5e1,_0x2e9130,_0x1495bb){return db[_0xf3c0('0x2c')]['find']({'where':{'id':_0x26b5e1[_0xf3c0('0x47')]['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x2e9130,null))[_0xf3c0('0x24')](function(_0x1c7046){if(_0x1c7046){return _0x1c7046[_0xf3c0('0x87')](_0x26b5e1['body']['ids'],_[_0xf3c0('0x63')](_0x26b5e1[_0xf3c0('0x53')],[_0xf3c0('0x5c'),'id'])||{})[_0xf3c0('0x88')](function(_0x2960d0){for(var _0x144644=0x0;_0x144644<_0x26b5e1[_0xf3c0('0x53')][_0xf3c0('0x5c')][_0xf3c0('0x37')];_0x144644+=0x1){socket[_0xf3c0('0x89')](_0xf3c0('0x8a'),{'UserId':_0x26b5e1[_0xf3c0('0x53')][_0xf3c0('0x5c')][_0x144644],'CmListId':_0x26b5e1['params']['id']});}return _0x2960d0;});}})[_0xf3c0('0x24')](respondWithResult(_0x2e9130,null))['catch'](handleError(_0x2e9130,null));};exports[_0xf3c0('0x8b')]=function(_0x48023a,_0x4c8f89,_0x2fa501){return db['CmList'][_0xf3c0('0x48')]({'where':{'id':_0x48023a['params']['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x4c8f89,null))['then'](function(_0x8c5df4){if(_0x8c5df4){return _0x8c5df4['removeAgents'](_0x48023a[_0xf3c0('0x31')]['ids'])[_0xf3c0('0x24')](function(){if(_[_0xf3c0('0x60')](_0x48023a['query'][_0xf3c0('0x5c')])){for(var _0x651353=0x0;_0x651353<_0x48023a[_0xf3c0('0x31')]['ids'][_0xf3c0('0x37')];_0x651353+=0x1){socket[_0xf3c0('0x89')]('userCmList:remove',{'UserId':Number(_0x48023a[_0xf3c0('0x31')][_0xf3c0('0x5c')][_0x651353]),'CmListId':Number(_0x48023a[_0xf3c0('0x47')]['id'])});}}else{socket['emit'](_0xf3c0('0x8c'),{'UserId':Number(_0x48023a[_0xf3c0('0x31')][_0xf3c0('0x5c')]),'CmListId':Number(_0x48023a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4c8f89,null))['catch'](handleError(_0x4c8f89,null));};exports['getAgents']=function(_0xaf4fec,_0x365692,_0x58699d){var _0x576d56={};var _0x5eb824={};var _0x4fba10;var _0x181f31;return db['CmList'][_0xf3c0('0x59')]({'where':{'id':_0xaf4fec[_0xf3c0('0x47')]['id']}})[_0xf3c0('0x24')](handleEntityNotFound(_0x365692,null))['then'](function(_0x570c95){if(_0x570c95){_0x4fba10=_0x570c95;_0x5eb824['model']=_['keys'](db[_0xf3c0('0x8d')][_0xf3c0('0x2d')]);_0x5eb824[_0xf3c0('0x31')]=_[_0xf3c0('0x32')](_0xaf4fec['query']);_0x5eb824[_0xf3c0('0x33')]=_[_0xf3c0('0x34')](_0x5eb824[_0xf3c0('0x30')],_0x5eb824[_0xf3c0('0x31')]);_0x576d56['attributes']=_[_0xf3c0('0x34')](_0x5eb824[_0xf3c0('0x30')],qs['fields'](_0xaf4fec['query'][_0xf3c0('0x35')]));_0x576d56[_0xf3c0('0x36')]=_0x576d56[_0xf3c0('0x36')]['length']?_0x576d56[_0xf3c0('0x36')]:_0x5eb824[_0xf3c0('0x30')];_0x576d56[_0xf3c0('0x38')]=qs[_0xf3c0('0x39')](_0xaf4fec[_0xf3c0('0x31')][_0xf3c0('0x39')]);_0x576d56[_0xf3c0('0x3a')]=qs[_0xf3c0('0x33')](_['pick'](_0xaf4fec[_0xf3c0('0x31')],_0x5eb824[_0xf3c0('0x33')]));if(_0xaf4fec['query']['filter']){_0x576d56['where']=_[_0xf3c0('0x3d')](_0x576d56[_0xf3c0('0x3a')],{'$or':_[_0xf3c0('0x2b')](_0x576d56[_0xf3c0('0x36')],function(_0x4bbcf0){var _0x116f5a={};_0x116f5a[_0x4bbcf0]={'$like':'%'+_0xaf4fec['query'][_0xf3c0('0x3c')]+'%'};return _0x116f5a;})});}_0x576d56=_[_0xf3c0('0x3d')]({},_0x576d56,_0xaf4fec[_0xf3c0('0x3f')]);return _0x4fba10[_0xf3c0('0x8e')](_0x576d56);}})[_0xf3c0('0x24')](function(_0x57548d){if(_0x57548d){_0x181f31=_0x57548d['length'];if(!_0xaf4fec['query'][_0xf3c0('0x70')](_0xf3c0('0x5a'))){_0x576d56[_0xf3c0('0x1d')]=qs[_0xf3c0('0x1d')](_0xaf4fec[_0xf3c0('0x31')][_0xf3c0('0x1d')]);_0x576d56[_0xf3c0('0x1c')]=qs[_0xf3c0('0x1c')](_0xaf4fec[_0xf3c0('0x31')][_0xf3c0('0x1c')]);}return _0x4fba10[_0xf3c0('0x8e')](_0x576d56);}})[_0xf3c0('0x24')](function(_0x19de69){if(_0x19de69){return _0x19de69?{'count':_0x181f31,'rows':_0x19de69}:null;}})[_0xf3c0('0x24')](respondWithResult(_0x365692,null))[_0xf3c0('0x45')](handleError(_0x365692,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 78f4844..d3a0095 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 _0x6ce9=['save','update','remove','emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners'];(function(_0x502a5e,_0x487f85){var _0x45e6c0=function(_0x1dd44f){while(--_0x1dd44f){_0x502a5e['push'](_0x502a5e['shift']());}};_0x45e6c0(++_0x487f85);}(_0x6ce9,0x9d));var _0x96ce=function(_0x27fbde,_0x3e5956){_0x27fbde=_0x27fbde-0x0;var _0x884c53=_0x6ce9[_0x27fbde];return _0x884c53;};'use strict';var EventEmitter=require(_0x96ce('0x0'));var CmList=require('../../mysqldb')['db'][_0x96ce('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x96ce('0x2')](0x0);var events={'afterCreate':_0x96ce('0x3'),'afterUpdate':_0x96ce('0x4'),'afterDestroy':_0x96ce('0x5')};function emitEvent(_0x27391e){return function(_0x1d34e1,_0x41d698,_0x451ba1){CmListEvents[_0x96ce('0x6')](_0x27391e+':'+_0x1d34e1['id'],_0x1d34e1);CmListEvents[_0x96ce('0x6')](_0x27391e,_0x1d34e1);_0x451ba1(null);};}for(var e in events){if(events[_0x96ce('0x7')](e)){var event=events[e];CmList[_0x96ce('0x8')](e,emitEvent(event));}}module[_0x96ce('0x9')]=CmListEvents; \ No newline at end of file +var _0x630b=['hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x257c63,_0x3a9a9c){var _0x146ab3=function(_0x6f632f){while(--_0x6f632f){_0x257c63['push'](_0x257c63['shift']());}};_0x146ab3(++_0x3a9a9c);}(_0x630b,0xd3));var _0xb630=function(_0x54dff4,_0x4c771a){_0x54dff4=_0x54dff4-0x0;var _0x503b7f=_0x630b[_0x54dff4];return _0x503b7f;};'use strict';var EventEmitter=require(_0xb630('0x0'));var CmList=require(_0xb630('0x1'))['db'][_0xb630('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb630('0x3')](0x0);var events={'afterCreate':_0xb630('0x4'),'afterUpdate':_0xb630('0x5'),'afterDestroy':_0xb630('0x6')};function emitEvent(_0x6d34c4){return function(_0x37d6c6,_0xb31201,_0x4e6e86){CmListEvents[_0xb630('0x7')](_0x6d34c4+':'+_0x37d6c6['id'],_0x37d6c6);CmListEvents[_0xb630('0x7')](_0x6d34c4,_0x37d6c6);_0x4e6e86(null);};}for(var e in events){if(events[_0xb630('0x8')](e)){var event=events[e];CmList[_0xb630('0x9')](e,emitEvent(event));}}module[_0xb630('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 ed791ea..5738e35 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 _0xf955=['./cmList.attributes','cm_lists','lodash','api','bluebird','rimraf'];(function(_0x1de234,_0x5394e5){var _0x3796a5=function(_0x24294e){while(--_0x24294e){_0x1de234['push'](_0x1de234['shift']());}};_0x3796a5(++_0x5394e5);}(_0xf955,0xec));var _0x5f95=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf955[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x5f95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f95('0x1'));var moment=require('moment');var BPromise=require(_0x5f95('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f95('0x3'));var config=require('../../config/environment');var attributes=require(_0x5f95('0x4'));module['exports']=function(_0x542139,_0x3bebe0){return _0x542139['define']('CmList',attributes,{'tableName':_0x5f95('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2c2=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x26486f,_0x54bd4e){var _0x339f1c=function(_0x54fef8){while(--_0x54fef8){_0x26486f['push'](_0x26486f['shift']());}};_0x339f1c(++_0x54bd4e);}(_0xf2c2,0xc3));var _0x2f2c=function(_0x4375af,_0x1c9918){_0x4375af=_0x4375af-0x0;var _0x138c81=_0xf2c2[_0x4375af];return _0x138c81;};'use strict';var _=require(_0x2f2c('0x0'));var util=require(_0x2f2c('0x1'));var logger=require(_0x2f2c('0x2'))(_0x2f2c('0x3'));var moment=require('moment');var BPromise=require(_0x2f2c('0x4'));var rp=require(_0x2f2c('0x5'));var fs=require('fs');var path=require(_0x2f2c('0x6'));var rimraf=require(_0x2f2c('0x7'));var config=require(_0x2f2c('0x8'));var attributes=require(_0x2f2c('0x9'));module[_0x2f2c('0xa')]=function(_0x216e1c,_0x27d59a){return _0x216e1c[_0x2f2c('0xb')](_0x2f2c('0xc'),attributes,{'tableName':_0x2f2c('0xd'),'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 6806cb5..fbef2c0 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 _0x5b26=['../../config/environment','client','redis','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x412afa,_0x4ca13b){var _0x2db180=function(_0x280f94){while(--_0x280f94){_0x412afa['push'](_0x412afa['shift']());}};_0x2db180(++_0x4ca13b);}(_0x5b26,0x1c6));var _0x65b2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5b26[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x65b2('0x0'));var BPromise=require(_0x65b2('0x1'));var rs=require(_0x65b2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x65b2('0x3'));var logger=require(_0x65b2('0x4'))(_0x65b2('0x5'));var config=require(_0x65b2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65b2('0x7')]['http']({'port':0x232a});config[_0x65b2('0x8')]=_['defaults'](config['redis'],{'host':_0x65b2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65b2('0x8')]));require(_0x65b2('0xa'))[_0x65b2('0xb')](socket);function respondWithRpcPromise(_0x3a334c,_0x22fd41,_0x2a918b){return new BPromise(function(_0x1fa1f9,_0x218765){return client[_0x65b2('0xc')](_0x3a334c,_0x2a918b)[_0x65b2('0xd')](function(_0x483306){logger[_0x65b2('0xe')](_0x65b2('0xf'),_0x22fd41,_0x65b2('0x10'));logger[_0x65b2('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x22fd41,_0x65b2('0x10'),JSON['stringify'](_0x483306));if(_0x483306[_0x65b2('0x12')]){if(_0x483306['error'][_0x65b2('0x13')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x22fd41,_0x483306[_0x65b2('0x12')][_0x65b2('0x14')]);return _0x218765(_0x483306['error']['message']);}logger['error'](_0x65b2('0xf'),_0x22fd41,_0x483306[_0x65b2('0x12')][_0x65b2('0x14')]);return _0x1fa1f9(_0x483306[_0x65b2('0x12')][_0x65b2('0x14')]);}else{logger[_0x65b2('0xe')](_0x65b2('0xf'),_0x22fd41,'request\x20sent');_0x1fa1f9(_0x483306[_0x65b2('0x15')][_0x65b2('0x14')]);}})[_0x65b2('0x16')](function(_0x20fa8f){logger[_0x65b2('0x12')]('CmList,\x20%s,\x20%s',_0x22fd41,_0x20fa8f);_0x218765(_0x20fa8f);});});} \ No newline at end of file +var _0x69c7=['message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x69c7,0x1a4));var _0x769c=function(_0x425bd2,_0x983334){_0x425bd2=_0x425bd2-0x0;var _0x2595b6=_0x69c7[_0x425bd2];return _0x2595b6;};'use strict';var _=require('lodash');var util=require(_0x769c('0x0'));var moment=require('moment');var BPromise=require(_0x769c('0x1'));var rs=require(_0x769c('0x2'));var fs=require('fs');var Redis=require(_0x769c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x769c('0x4'));var logger=require('../../config/logger')(_0x769c('0x5'));var config=require(_0x769c('0x6'));var jayson=require(_0x769c('0x7'));var client=jayson[_0x769c('0x8')][_0x769c('0x9')]({'port':0x232a});config[_0x769c('0xa')]=_[_0x769c('0xb')](config[_0x769c('0xa')],{'host':_0x769c('0xc'),'port':0x18eb});var socket=require(_0x769c('0xd'))(new Redis(config[_0x769c('0xa')]));require(_0x769c('0xe'))['register'](socket);function respondWithRpcPromise(_0x5cdf11,_0x3b4ec3,_0x49ce71){return new BPromise(function(_0x1425ec,_0x3ae11e){return client['request'](_0x5cdf11,_0x49ce71)[_0x769c('0xf')](function(_0x2685d6){logger['info'](_0x769c('0x10'),_0x3b4ec3,_0x769c('0x11'));logger[_0x769c('0x12')](_0x769c('0x13'),_0x3b4ec3,_0x769c('0x11'),JSON['stringify'](_0x2685d6));if(_0x2685d6['error']){if(_0x2685d6[_0x769c('0x14')][_0x769c('0x15')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x3b4ec3,_0x2685d6[_0x769c('0x14')][_0x769c('0x16')]);return _0x3ae11e(_0x2685d6[_0x769c('0x14')][_0x769c('0x16')]);}logger[_0x769c('0x14')](_0x769c('0x10'),_0x3b4ec3,_0x2685d6['error'][_0x769c('0x16')]);return _0x1425ec(_0x2685d6[_0x769c('0x14')][_0x769c('0x16')]);}else{logger[_0x769c('0x17')]('CmList,\x20%s,\x20%s',_0x3b4ec3,_0x769c('0x11'));_0x1425ec(_0x2685d6[_0x769c('0x18')][_0x769c('0x16')]);}})[_0x769c('0x19')](function(_0x3be1b2){logger['error'](_0x769c('0x10'),_0x3b4ec3,_0x3be1b2);_0x3ae11e(_0x3be1b2);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 1b5ed41..c46a911 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 _0xafc4=['register','length','cmList:','./cmList.events','remove','emit'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xafc4,0x69));var _0x4afc=function(_0x47271f,_0x3b8d7e){_0x47271f=_0x47271f-0x0;var _0x3c1658=_0xafc4[_0x47271f];return _0x3c1658;};'use strict';var CmListEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){CmListEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);CmListEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file +var _0x4e83=['update','register','length','cmList:','./cmList.events','remove'];(function(_0x3eb264,_0x3f63ab){var _0x482286=function(_0x598070){while(--_0x598070){_0x3eb264['push'](_0x3eb264['shift']());}};_0x482286(++_0x3f63ab);}(_0x4e83,0x1ae));var _0x34e8=function(_0x5a5011,_0x3778b9){_0x5a5011=_0x5a5011-0x0;var _0x2e6ee1=_0x4e83[_0x5a5011];return _0x2e6ee1;};'use strict';var CmListEvents=require(_0x34e8('0x0'));var events=['save',_0x34e8('0x1'),_0x34e8('0x2')];function createListener(_0x1752b7,_0x585137){return function(_0xfe2697){_0x585137['emit'](_0x1752b7,_0xfe2697);};}function removeListener(_0x5dc841,_0x506eb2){return function(){CmListEvents['removeListener'](_0x5dc841,_0x506eb2);};}exports[_0x34e8('0x3')]=function(_0x3ec7cb){for(var _0x559726=0x0,_0x30a3c4=events[_0x34e8('0x4')];_0x559726<_0x30a3c4;_0x559726++){var _0x28677c=events[_0x559726];var _0x5b5ddc=createListener(_0x34e8('0x5')+_0x28677c,_0x3ec7cb);CmListEvents['on'](_0x28677c,_0x5b5ddc);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index cf086db..106f57d 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_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 b64cc30..1a0559a 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x39c094,_0x4beb7c){var _0x228723=function(_0x18c1ed){while(--_0x18c1ed){_0x39c094['push'](_0x39c094['shift']());}};_0x228723(++_0x4beb7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x4ec6ad,_0x1c0000){var _0x51285f=function(_0x579135){while(--_0x579135){_0x4ec6ad['push'](_0x4ec6ad['shift']());}};_0x51285f(++_0x1c0000);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index be33313..989e1c2 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 _0x5eef=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','send','update','body','Condition','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0xd83d62,_0x30b3c6){var _0xec58f3=function(_0x130c22){while(--_0x130c22){_0xd83d62['push'](_0xd83d62['shift']());}};_0xec58f3(++_0x30b3c6);}(_0x5eef,0xaf));var _0xf5ee=function(_0x28fb61,_0xe93fb6){_0x28fb61=_0x28fb61-0x0;var _0x5478e9=_0x5eef[_0x28fb61];return _0x5478e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf5ee('0x0'));var rimraf=require(_0xf5ee('0x1'));var zipdir=require(_0xf5ee('0x2'));var jsonpatch=require(_0xf5ee('0x3'));var rp=require(_0xf5ee('0x4'));var moment=require(_0xf5ee('0x5'));var BPromise=require(_0xf5ee('0x6'));var Mustache=require('mustache');var util=require(_0xf5ee('0x7'));var path=require(_0xf5ee('0x8'));var sox=require(_0xf5ee('0x9'));var csv=require(_0xf5ee('0xa'));var ejs=require(_0xf5ee('0xb'));var fs=require('fs');var _=require(_0xf5ee('0xc'));var squel=require(_0xf5ee('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5ee('0xe'));var deskjs=require(_0xf5ee('0xf'));var toCsv=require(_0xf5ee('0xa'));var querystring=require(_0xf5ee('0x10'));var Papa=require('papaparse');var Redis=require(_0xf5ee('0x11'));var authService=require(_0xf5ee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5ee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5ee('0x14'))(_0xf5ee('0x15'));var utils=require('../../config/utils');var config=require(_0xf5ee('0x16'));var licenseUtil=require(_0xf5ee('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e4115,_0x769afb){_0x769afb=_0x769afb||0xcc;return function(_0xc2cd14){if(_0xc2cd14){return _0x1e4115[_0xf5ee('0x18')](_0x769afb);}return _0x1e4115[_0xf5ee('0x19')](_0x769afb)[_0xf5ee('0x1a')]();};}function respondWithResult(_0xe9a13c,_0x4ed4d8){_0x4ed4d8=_0x4ed4d8||0xc8;return function(_0x331e1b){if(_0x331e1b){return _0xe9a13c[_0xf5ee('0x19')](_0x4ed4d8)['json'](_0x331e1b);}};}function respondWithFilteredResult(_0x35ed63,_0x317eaf){return function(_0x1bc50a){if(_0x1bc50a){var _0x29a440=_0x1bc50a[_0xf5ee('0x1b')],_0xf3ec8d=_0x317eaf['offset'],_0x45cc62=_0x317eaf[_0xf5ee('0x1c')]+_0x317eaf[_0xf5ee('0x1d')],_0x2b969a;if(_0x45cc62>=_0x29a440){_0x45cc62=_0x29a440;_0x2b969a=0xc8;}else{_0x2b969a=0xce;}_0x35ed63[_0xf5ee('0x19')](_0x2b969a);return _0x35ed63['set'](_0xf5ee('0x1e'),_0xf3ec8d+'-'+_0x45cc62+'/'+_0x29a440)[_0xf5ee('0x1f')](_0x1bc50a);}return null;};}function patchUpdates(_0x47f2bb){return function(_0x388705){try{jsonpatch[_0xf5ee('0x20')](_0x388705,_0x47f2bb,!![]);}catch(_0xc44522){return BPromise[_0xf5ee('0x21')](_0xc44522);}return _0x388705[_0xf5ee('0x22')]();};}function saveUpdates(_0x492582,_0x169fe6){return function(_0x4ca59d){if(_0x4ca59d){return _0x4ca59d['update'](_0x492582)[_0xf5ee('0x23')](function(_0x44474d){return _0x44474d;});}return null;};}function removeEntity(_0x56200c,_0x29d3ee){return function(_0x3e3ef6){if(_0x3e3ef6){return _0x3e3ef6[_0xf5ee('0x24')]()['then'](function(){_0x56200c[_0xf5ee('0x19')](0xcc)[_0xf5ee('0x1a')]();});}};}function handleEntityNotFound(_0x134f75,_0xf4cbf4){return function(_0x498d32){if(!_0x498d32){_0x134f75['sendStatus'](0x194);}return _0x498d32;};}function handleError(_0x4b3675,_0x1a60df){_0x1a60df=_0x1a60df||0x1f4;return function(_0x488423){logger[_0xf5ee('0x25')](_0x488423[_0xf5ee('0x26')]);if(_0x488423['name']){delete _0x488423['name'];}_0x4b3675[_0xf5ee('0x19')](_0x1a60df)[_0xf5ee('0x27')](_0x488423);};}exports[_0xf5ee('0x28')]=function(_0x1f3a31,_0x41a8f0){if(_0x1f3a31[_0xf5ee('0x29')]['id']){delete _0x1f3a31['body']['id'];}return db[_0xf5ee('0x2a')][_0xf5ee('0x2b')]({'where':{'id':_0x1f3a31['params']['id']}})[_0xf5ee('0x23')](handleEntityNotFound(_0x41a8f0,null))['then'](saveUpdates(_0x1f3a31[_0xf5ee('0x29')],null))['then'](respondWithResult(_0x41a8f0,null))['catch'](handleError(_0x41a8f0,null));};exports['destroy']=function(_0x1a07cf,_0xcca798){return db[_0xf5ee('0x2a')][_0xf5ee('0x2b')]({'where':{'id':_0x1a07cf[_0xf5ee('0x2c')]['id']}})['then'](handleEntityNotFound(_0xcca798,null))['then'](removeEntity(_0xcca798,null))[_0xf5ee('0x2d')](handleError(_0xcca798,null));}; \ No newline at end of file +var _0xfc47=['mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','error','stack','name','update','body','Condition','find','then','catch','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3d70ae,_0x6ddb0f){var _0x1ba273=function(_0x10db23){while(--_0x10db23){_0x3d70ae['push'](_0x3d70ae['shift']());}};_0x1ba273(++_0x6ddb0f);}(_0xfc47,0x10b));var _0x7fc4=function(_0x4a2183,_0x53e74d){_0x4a2183=_0x4a2183-0x0;var _0xc7c01d=_0xfc47[_0x4a2183];return _0xc7c01d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7fc4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fc4('0x1'));var jsonpatch=require(_0x7fc4('0x2'));var rp=require(_0x7fc4('0x3'));var moment=require(_0x7fc4('0x4'));var BPromise=require(_0x7fc4('0x5'));var Mustache=require(_0x7fc4('0x6'));var util=require(_0x7fc4('0x7'));var path=require('path');var sox=require(_0x7fc4('0x8'));var csv=require(_0x7fc4('0x9'));var ejs=require(_0x7fc4('0xa'));var fs=require('fs');var _=require(_0x7fc4('0xb'));var squel=require('squel');var crypto=require(_0x7fc4('0xc'));var jsforce=require(_0x7fc4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7fc4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fc4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7fc4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7fc4('0x11'));var licenseUtil=require(_0x7fc4('0x12'));var db=require(_0x7fc4('0x13'))['db'];function respondWithStatusCode(_0x448fd7,_0x5d6610){_0x5d6610=_0x5d6610||0xcc;return function(_0x436d24){if(_0x436d24){return _0x448fd7[_0x7fc4('0x14')](_0x5d6610);}return _0x448fd7[_0x7fc4('0x15')](_0x5d6610)[_0x7fc4('0x16')]();};}function respondWithResult(_0x298109,_0x1dba5d){_0x1dba5d=_0x1dba5d||0xc8;return function(_0xd1714c){if(_0xd1714c){return _0x298109[_0x7fc4('0x15')](_0x1dba5d)[_0x7fc4('0x17')](_0xd1714c);}};}function respondWithFilteredResult(_0x28254f,_0x1e3286){return function(_0x5e658a){if(_0x5e658a){var _0x46c198=_0x5e658a['count'],_0x556ead=_0x1e3286['offset'],_0x369f63=_0x1e3286[_0x7fc4('0x18')]+_0x1e3286['limit'],_0x4d7b3b;if(_0x369f63>=_0x46c198){_0x369f63=_0x46c198;_0x4d7b3b=0xc8;}else{_0x4d7b3b=0xce;}_0x28254f[_0x7fc4('0x15')](_0x4d7b3b);return _0x28254f[_0x7fc4('0x19')](_0x7fc4('0x1a'),_0x556ead+'-'+_0x369f63+'/'+_0x46c198)[_0x7fc4('0x17')](_0x5e658a);}return null;};}function patchUpdates(_0xaf5c6a){return function(_0x554087){try{jsonpatch['apply'](_0x554087,_0xaf5c6a,!![]);}catch(_0x230b59){return BPromise[_0x7fc4('0x1b')](_0x230b59);}return _0x554087['save']();};}function saveUpdates(_0x430547,_0x56cf9e){return function(_0x3c9126){if(_0x3c9126){return _0x3c9126['update'](_0x430547)['then'](function(_0xcd692){return _0xcd692;});}return null;};}function removeEntity(_0x17e459,_0x36d1f9){return function(_0x4612bb){if(_0x4612bb){return _0x4612bb['destroy']()['then'](function(){_0x17e459[_0x7fc4('0x15')](0xcc)[_0x7fc4('0x16')]();});}};}function handleEntityNotFound(_0x481841,_0x3aab4a){return function(_0x3f2ea2){if(!_0x3f2ea2){_0x481841[_0x7fc4('0x14')](0x194);}return _0x3f2ea2;};}function handleError(_0x1c39bb,_0x463775){_0x463775=_0x463775||0x1f4;return function(_0x1f9b01){logger[_0x7fc4('0x1c')](_0x1f9b01[_0x7fc4('0x1d')]);if(_0x1f9b01['name']){delete _0x1f9b01[_0x7fc4('0x1e')];}_0x1c39bb[_0x7fc4('0x15')](_0x463775)['send'](_0x1f9b01);};}exports[_0x7fc4('0x1f')]=function(_0x3371df,_0x19378d){if(_0x3371df[_0x7fc4('0x20')]['id']){delete _0x3371df['body']['id'];}return db[_0x7fc4('0x21')][_0x7fc4('0x22')]({'where':{'id':_0x3371df['params']['id']}})['then'](handleEntityNotFound(_0x19378d,null))[_0x7fc4('0x23')](saveUpdates(_0x3371df['body'],null))[_0x7fc4('0x23')](respondWithResult(_0x19378d,null))[_0x7fc4('0x24')](handleError(_0x19378d,null));};exports[_0x7fc4('0x25')]=function(_0xe9ab27,_0x58b123){return db[_0x7fc4('0x21')][_0x7fc4('0x22')]({'where':{'id':_0xe9ab27[_0x7fc4('0x26')]['id']}})['then'](handleEntityNotFound(_0x58b123,null))[_0x7fc4('0x23')](removeEntity(_0x58b123,null))[_0x7fc4('0x24')](handleError(_0x58b123,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 148e554..339d97e 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 _0x1e35=['request-promise','path','../../config/environment','exports','define','Condition','tools_conditions','util','api','moment','bluebird'];(function(_0x123a8a,_0x26dcc4){var _0x38aceb=function(_0x1e3c8b){while(--_0x1e3c8b){_0x123a8a['push'](_0x123a8a['shift']());}};_0x38aceb(++_0x26dcc4);}(_0x1e35,0x17d));var _0x51e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x51e3('0x0'));var logger=require('../../config/logger')(_0x51e3('0x1'));var moment=require(_0x51e3('0x2'));var BPromise=require(_0x51e3('0x3'));var rp=require(_0x51e3('0x4'));var fs=require('fs');var path=require(_0x51e3('0x5'));var rimraf=require('rimraf');var config=require(_0x51e3('0x6'));var attributes=require('./condition.attributes');module[_0x51e3('0x7')]=function(_0x476512,_0x1c2173){return _0x476512[_0x51e3('0x8')](_0x51e3('0x9'),attributes,{'tableName':_0x51e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7052=['moment','request-promise','../../config/environment','./condition.attributes','Condition','tools_conditions','lodash','util','../../config/logger','api'];(function(_0x2f2858,_0x14d793){var _0x4032fc=function(_0x4cb141){while(--_0x4cb141){_0x2f2858['push'](_0x2f2858['shift']());}};_0x4032fc(++_0x14d793);}(_0x7052,0x18c));var _0x2705=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7052[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x2705('0x0'));var util=require(_0x2705('0x1'));var logger=require(_0x2705('0x2'))(_0x2705('0x3'));var moment=require(_0x2705('0x4'));var BPromise=require('bluebird');var rp=require(_0x2705('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2705('0x6'));var attributes=require(_0x2705('0x7'));module['exports']=function(_0xc2045d,_0x54c38a){return _0xc2045d['define'](_0x2705('0x8'),attributes,{'tableName':_0x2705('0x9'),'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 bc6d4ff..c8bd8be 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 _0xb9ab=['request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0xb9ab,0x110));var _0xbb9a=function(_0x2a1adb,_0x433c94){_0x2a1adb=_0x2a1adb-0x0;var _0x28c238=_0xb9ab[_0x2a1adb];return _0x28c238;};'use strict';var _=require(_0xbb9a('0x0'));var util=require(_0xbb9a('0x1'));var moment=require(_0xbb9a('0x2'));var BPromise=require(_0xbb9a('0x3'));var rs=require(_0xbb9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb9a('0x5'))['db'];var utils=require(_0xbb9a('0x6'));var logger=require(_0xbb9a('0x7'))(_0xbb9a('0x8'));var config=require(_0xbb9a('0x9'));var jayson=require(_0xbb9a('0xa'));var client=jayson[_0xbb9a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ec36e,_0x3edd0b,_0x44eee6){return new BPromise(function(_0x1c3909,_0x455824){return client[_0xbb9a('0xc')](_0x4ec36e,_0x44eee6)[_0xbb9a('0xd')](function(_0x1bbc85){logger[_0xbb9a('0xe')](_0xbb9a('0xf'),_0x3edd0b,_0xbb9a('0x10'));logger['debug'](_0xbb9a('0x11'),_0x3edd0b,_0xbb9a('0x10'),JSON[_0xbb9a('0x12')](_0x1bbc85));if(_0x1bbc85['error']){if(_0x1bbc85[_0xbb9a('0x13')][_0xbb9a('0x14')]===0x1f4){logger[_0xbb9a('0x13')]('Condition,\x20%s,\x20%s',_0x3edd0b,_0x1bbc85[_0xbb9a('0x13')][_0xbb9a('0x15')]);return _0x455824(_0x1bbc85['error'][_0xbb9a('0x15')]);}logger[_0xbb9a('0x13')](_0xbb9a('0xf'),_0x3edd0b,_0x1bbc85[_0xbb9a('0x13')]['message']);return _0x1c3909(_0x1bbc85['error']['message']);}else{logger[_0xbb9a('0xe')](_0xbb9a('0xf'),_0x3edd0b,'request\x20sent');_0x1c3909(_0x1bbc85[_0xbb9a('0x16')][_0xbb9a('0x15')]);}})[_0xbb9a('0x17')](function(_0x764db5){logger[_0xbb9a('0x13')](_0xbb9a('0xf'),_0x3edd0b,_0x764db5);_0x455824(_0x764db5);});});} \ No newline at end of file +var _0x1755=['Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x517aba,_0x4814e5){var _0x246abe=function(_0x36b7a9){while(--_0x36b7a9){_0x517aba['push'](_0x517aba['shift']());}};_0x246abe(++_0x4814e5);}(_0x1755,0x1ae));var _0x5175=function(_0x2d32eb,_0x32401b){_0x2d32eb=_0x2d32eb-0x0;var _0x450522=_0x1755[_0x2d32eb];return _0x450522;};'use strict';var _=require(_0x5175('0x0'));var util=require('util');var moment=require(_0x5175('0x1'));var BPromise=require('bluebird');var rs=require(_0x5175('0x2'));var fs=require('fs');var Redis=require(_0x5175('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5175('0x4'))('rpc');var config=require(_0x5175('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5175('0x6')][_0x5175('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2423b0,_0x2b0015,_0x2ebf6f){return new BPromise(function(_0x19bfcf,_0xa54823){return client[_0x5175('0x8')](_0x2423b0,_0x2ebf6f)[_0x5175('0x9')](function(_0xfbc4fc){logger['info'](_0x5175('0xa'),_0x2b0015,_0x5175('0xb'));logger['debug'](_0x5175('0xc'),_0x2b0015,_0x5175('0xb'),JSON[_0x5175('0xd')](_0xfbc4fc));if(_0xfbc4fc[_0x5175('0xe')]){if(_0xfbc4fc[_0x5175('0xe')][_0x5175('0xf')]===0x1f4){logger[_0x5175('0xe')](_0x5175('0xa'),_0x2b0015,_0xfbc4fc[_0x5175('0xe')][_0x5175('0x10')]);return _0xa54823(_0xfbc4fc[_0x5175('0xe')][_0x5175('0x10')]);}logger[_0x5175('0xe')](_0x5175('0xa'),_0x2b0015,_0xfbc4fc[_0x5175('0xe')][_0x5175('0x10')]);return _0x19bfcf(_0xfbc4fc[_0x5175('0xe')][_0x5175('0x10')]);}else{logger[_0x5175('0x11')]('Condition,\x20%s,\x20%s',_0x2b0015,'request\x20sent');_0x19bfcf(_0xfbc4fc[_0x5175('0x12')]['message']);}})[_0x5175('0x13')](function(_0x1d52d9){logger['error'](_0x5175('0xa'),_0x2b0015,_0x1d52d9);_0xa54823(_0x1d52d9);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index a41b5c0..5f200f8 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 _0xc481=['/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xc481,0x6a));var _0x1c48=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xc481[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0x1c48('0x0'));var util=require(_0x1c48('0x1'));var path=require('path');var timeout=require(_0x1c48('0x2'));var express=require(_0x1c48('0x3'));var router=express[_0x1c48('0x4')]();var auth=require(_0x1c48('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1c48('0x6'));router[_0x1c48('0x7')]('/:id',auth[_0x1c48('0x8')](),controller[_0x1c48('0x9')]);router[_0x1c48('0xa')](_0x1c48('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1c48('0xc')]=router; \ No newline at end of file +var _0xe1c7=['destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xe1c7,0x1f0));var _0x7e1c=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xe1c7[_0x5bb4e8];return _0x2a86f2;};'use strict';var multer=require('multer');var util=require(_0x7e1c('0x0'));var path=require('path');var timeout=require(_0x7e1c('0x1'));var express=require(_0x7e1c('0x2'));var router=express[_0x7e1c('0x3')]();var auth=require(_0x7e1c('0x4'));var interaction=require(_0x7e1c('0x5'));var config=require('../../config/environment');var controller=require(_0x7e1c('0x6'));router[_0x7e1c('0x7')](_0x7e1c('0x8'),auth[_0x7e1c('0x9')](),controller[_0x7e1c('0xa')]);router['delete'](_0x7e1c('0x8'),auth[_0x7e1c('0x9')](),controller[_0x7e1c('0xb')]);module[_0x7e1c('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 7e12809..8111975 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 _0xbd50=['STRING','INTEGER','sequelize','exports'];(function(_0x264aa9,_0xd540f1){var _0x40ef3d=function(_0x2fc355){while(--_0x2fc355){_0x264aa9['push'](_0x264aa9['shift']());}};_0x40ef3d(++_0xd540f1);}(_0xbd50,0x196));var _0x0bd5=function(_0x19e89d,_0x4793ce){_0x19e89d=_0x19e89d-0x0;var _0x48aeed=_0xbd50[_0x19e89d];return _0x48aeed;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x0bd5('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0bd5('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc4a1=['STRING','name','INTEGER','sequelize'];(function(_0x56a2b9,_0x5aa35c){var _0xe46e27=function(_0x89728b){while(--_0x89728b){_0x56a2b9['push'](_0x56a2b9['shift']());}};_0xe46e27(++_0x5aa35c);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x2cc73d,_0x296fe1){_0x2cc73d=_0x2cc73d-0x0;var _0x4c2b7c=_0xc4a1[_0x2cc73d];return _0x4c2b7c;};'use strict';var Sequelize=require(_0x1c4a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1c4a('0x1')],'allowNull':![],'unique':_0x1c4a('0x2')},'OrderBy':{'type':Sequelize[_0x1c4a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index b4465e5..a271805 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 _0x2f2e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','name','send','index','ContactItemType','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f2e,0x146));var _0xe2f2=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0x2f2e[_0x512f81];return _0xa15099;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe2f2('0x0'));var rimraf=require(_0xe2f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2f2('0x2'));var rp=require('request-promise');var moment=require(_0xe2f2('0x3'));var BPromise=require(_0xe2f2('0x4'));var Mustache=require(_0xe2f2('0x5'));var util=require(_0xe2f2('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe2f2('0x7'));var fs=require('fs');var _=require(_0xe2f2('0x8'));var squel=require(_0xe2f2('0x9'));var crypto=require(_0xe2f2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe2f2('0xb'));var Papa=require('papaparse');var Redis=require(_0xe2f2('0xc'));var authService=require(_0xe2f2('0xd'));var qs=require(_0xe2f2('0xe'));var as=require(_0xe2f2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2f2('0x10'))(_0xe2f2('0x11'));var utils=require('../../config/utils');var config=require(_0xe2f2('0x12'));var licenseUtil=require(_0xe2f2('0x13'));var db=require(_0xe2f2('0x14'))['db'];function respondWithStatusCode(_0xec8ce1,_0x46a87e){_0x46a87e=_0x46a87e||0xcc;return function(_0x45c78b){if(_0x45c78b){return _0xec8ce1[_0xe2f2('0x15')](_0x46a87e);}return _0xec8ce1[_0xe2f2('0x16')](_0x46a87e)[_0xe2f2('0x17')]();};}function respondWithResult(_0x3392db,_0x5eb9ef){_0x5eb9ef=_0x5eb9ef||0xc8;return function(_0x3bfa74){if(_0x3bfa74){return _0x3392db[_0xe2f2('0x16')](_0x5eb9ef)[_0xe2f2('0x18')](_0x3bfa74);}};}function respondWithFilteredResult(_0x45cd29,_0x43e4e5){return function(_0x51f710){if(_0x51f710){var _0x5b7f1a=_0x51f710['count'],_0x10cc99=_0x43e4e5[_0xe2f2('0x19')],_0xb11b33=_0x43e4e5[_0xe2f2('0x19')]+_0x43e4e5[_0xe2f2('0x1a')],_0x37f965;if(_0xb11b33>=_0x5b7f1a){_0xb11b33=_0x5b7f1a;_0x37f965=0xc8;}else{_0x37f965=0xce;}_0x45cd29['status'](_0x37f965);return _0x45cd29[_0xe2f2('0x1b')](_0xe2f2('0x1c'),_0x10cc99+'-'+_0xb11b33+'/'+_0x5b7f1a)[_0xe2f2('0x18')](_0x51f710);}return null;};}function patchUpdates(_0x1c5c5a){return function(_0xf6ca03){try{jsonpatch[_0xe2f2('0x1d')](_0xf6ca03,_0x1c5c5a,!![]);}catch(_0x5d664a){return BPromise[_0xe2f2('0x1e')](_0x5d664a);}return _0xf6ca03[_0xe2f2('0x1f')]();};}function saveUpdates(_0x34a57c,_0x596dd9){return function(_0xedba85){if(_0xedba85){return _0xedba85[_0xe2f2('0x20')](_0x34a57c)[_0xe2f2('0x21')](function(_0x27ab02){return _0x27ab02;});}return null;};}function removeEntity(_0x4481b2,_0x3fac5d){return function(_0x1e9829){if(_0x1e9829){return _0x1e9829['destroy']()[_0xe2f2('0x21')](function(){var _0x3be5af=_0x1e9829[_0xe2f2('0x22')]({'plain':!![]});var _0x38c524=_0xe2f2('0x23');return db[_0xe2f2('0x24')][_0xe2f2('0x25')]({'where':{'type':_0x38c524,'resourceId':_0x3be5af['id']}})[_0xe2f2('0x21')](function(){return _0x1e9829;});})[_0xe2f2('0x21')](function(){_0x4481b2['status'](0xcc)[_0xe2f2('0x17')]();});}};}function handleEntityNotFound(_0x56ab92,_0xdf8ce8){return function(_0x3df2da){if(!_0x3df2da){_0x56ab92[_0xe2f2('0x15')](0x194);}return _0x3df2da;};}function handleError(_0x5595b2,_0xc53b25){_0xc53b25=_0xc53b25||0x1f4;return function(_0x58e1fd){logger[_0xe2f2('0x26')](_0x58e1fd['stack']);if(_0x58e1fd[_0xe2f2('0x27')]){delete _0x58e1fd[_0xe2f2('0x27')];}_0x5595b2[_0xe2f2('0x16')](_0xc53b25)[_0xe2f2('0x28')](_0x58e1fd);};}exports[_0xe2f2('0x29')]=function(_0x377e50,_0x542e69){var _0xc9e784={},_0x18c995={},_0x1b0450={'count':0x0,'rows':[]};var _0x4abae7=_['map'](db[_0xe2f2('0x2a')][_0xe2f2('0x2b')],function(_0x1ef6cf){return{'name':_0x1ef6cf[_0xe2f2('0x2c')],'type':_0x1ef6cf['type'][_0xe2f2('0x2d')]};});_0x18c995['model']=_[_0xe2f2('0x2e')](_0x4abae7,_0xe2f2('0x27'));_0x18c995[_0xe2f2('0x2f')]=_[_0xe2f2('0x30')](_0x377e50['query']);_0x18c995[_0xe2f2('0x31')]=_[_0xe2f2('0x32')](_0x18c995[_0xe2f2('0x33')],_0x18c995['query']);_0xc9e784['attributes']=_['intersection'](_0x18c995[_0xe2f2('0x33')],qs[_0xe2f2('0x34')](_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x34')]));_0xc9e784[_0xe2f2('0x35')]=_0xc9e784['attributes'][_0xe2f2('0x36')]?_0xc9e784['attributes']:_0x18c995[_0xe2f2('0x33')];if(!_0x377e50[_0xe2f2('0x2f')]['hasOwnProperty'](_0xe2f2('0x37'))){_0xc9e784[_0xe2f2('0x1a')]=qs[_0xe2f2('0x1a')](_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x1a')]);_0xc9e784[_0xe2f2('0x19')]=qs[_0xe2f2('0x19')](_0x377e50[_0xe2f2('0x2f')]['offset']);}_0xc9e784['order']=qs[_0xe2f2('0x38')](_0x377e50['query'][_0xe2f2('0x38')]);_0xc9e784[_0xe2f2('0x39')]=qs[_0xe2f2('0x31')](_['pick'](_0x377e50[_0xe2f2('0x2f')],_0x18c995['filters']),_0x4abae7);if(_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x3a')]){_0xc9e784[_0xe2f2('0x39')]=_[_0xe2f2('0x3b')](_0xc9e784[_0xe2f2('0x39')],{'$or':_[_0xe2f2('0x2e')](_0x4abae7,function(_0x51c5f1){if(_0x51c5f1[_0xe2f2('0x3c')]!==_0xe2f2('0x3d')){var _0xb39f02={};_0xb39f02[_0x51c5f1[_0xe2f2('0x27')]]={'$like':'%'+_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x3a')]+'%'};return _0xb39f02;}})});}_0xc9e784=_[_0xe2f2('0x3b')]({},_0xc9e784,_0x377e50[_0xe2f2('0x3e')]);var _0x577be0={'where':_0xc9e784['where']};return db[_0xe2f2('0x2a')]['count'](_0x577be0)[_0xe2f2('0x21')](function(_0x4ae957){_0x1b0450[_0xe2f2('0x3f')]=_0x4ae957;if(_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x40')]){_0xc9e784['include']=[{'all':!![]}];}return db[_0xe2f2('0x2a')][_0xe2f2('0x41')](_0xc9e784);})[_0xe2f2('0x21')](function(_0x260f2e){_0x1b0450[_0xe2f2('0x42')]=_0x260f2e;return _0x1b0450;})[_0xe2f2('0x21')](respondWithFilteredResult(_0x542e69,_0xc9e784))[_0xe2f2('0x43')](handleError(_0x542e69,null));};exports[_0xe2f2('0x44')]=function(_0x5a0ab7,_0x1ccd03){var _0x1a73b6={'raw':!![],'where':{'id':_0x5a0ab7[_0xe2f2('0x45')]['id']}},_0x510a6b={};_0x510a6b['model']=_['keys'](db[_0xe2f2('0x2a')][_0xe2f2('0x2b')]);_0x510a6b['query']=_[_0xe2f2('0x30')](_0x5a0ab7[_0xe2f2('0x2f')]);_0x510a6b[_0xe2f2('0x31')]=_[_0xe2f2('0x32')](_0x510a6b['model'],_0x510a6b[_0xe2f2('0x2f')]);_0x1a73b6[_0xe2f2('0x35')]=_[_0xe2f2('0x32')](_0x510a6b[_0xe2f2('0x33')],qs[_0xe2f2('0x34')](_0x5a0ab7['query']['fields']));_0x1a73b6[_0xe2f2('0x35')]=_0x1a73b6[_0xe2f2('0x35')][_0xe2f2('0x36')]?_0x1a73b6[_0xe2f2('0x35')]:_0x510a6b[_0xe2f2('0x33')];if(_0x5a0ab7[_0xe2f2('0x2f')][_0xe2f2('0x40')]){_0x1a73b6[_0xe2f2('0x46')]=[{'all':!![]}];}_0x1a73b6=_[_0xe2f2('0x3b')]({},_0x1a73b6,_0x5a0ab7[_0xe2f2('0x3e')]);return db[_0xe2f2('0x2a')]['find'](_0x1a73b6)[_0xe2f2('0x21')](handleEntityNotFound(_0x1ccd03,null))[_0xe2f2('0x21')](respondWithResult(_0x1ccd03,null))[_0xe2f2('0x43')](handleError(_0x1ccd03,null));};exports['create']=function(_0x42afaa,_0x4ea411){return db['ContactItemType']['create'](_0x42afaa[_0xe2f2('0x47')],{})[_0xe2f2('0x21')](function(_0x6c0195){var _0x34a7fa=_0x42afaa[_0xe2f2('0x48')][_0xe2f2('0x22')]({'plain':!![]});if(!_0x34a7fa)throw new Error(_0xe2f2('0x49'));if(_0x34a7fa[_0xe2f2('0x4a')]===_0xe2f2('0x48')){var _0x246c3c=_0x6c0195[_0xe2f2('0x22')]({'plain':!![]});var _0x1ac9e2=_0xe2f2('0x23');return db[_0xe2f2('0x4b')]['find']({'where':{'name':_0x1ac9e2,'userProfileId':_0x34a7fa[_0xe2f2('0x4c')]},'raw':!![]})[_0xe2f2('0x21')](function(_0x23e1ad){if(_0x23e1ad&&_0x23e1ad[_0xe2f2('0x4d')]===0x0){return db[_0xe2f2('0x24')][_0xe2f2('0x4e')]({'name':_0x246c3c['name'],'resourceId':_0x246c3c['id'],'type':_0x23e1ad[_0xe2f2('0x27')],'sectionId':_0x23e1ad['id']},{})[_0xe2f2('0x21')](function(){return _0x6c0195;});}else{return _0x6c0195;}})[_0xe2f2('0x43')](function(_0x25676f){logger['error'](_0xe2f2('0x4f'),_0x25676f);throw _0x25676f;});}return _0x6c0195;})[_0xe2f2('0x21')](respondWithResult(_0x4ea411,0xc9))[_0xe2f2('0x43')](handleError(_0x4ea411,null));};exports[_0xe2f2('0x20')]=function(_0x1d3e93,_0x13a94b){if(_0x1d3e93[_0xe2f2('0x47')]['id']){delete _0x1d3e93[_0xe2f2('0x47')]['id'];}return db[_0xe2f2('0x2a')][_0xe2f2('0x50')]({'where':{'id':_0x1d3e93[_0xe2f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x13a94b,null))[_0xe2f2('0x21')](saveUpdates(_0x1d3e93['body'],null))[_0xe2f2('0x21')](respondWithResult(_0x13a94b,null))[_0xe2f2('0x43')](handleError(_0x13a94b,null));};exports[_0xe2f2('0x25')]=function(_0x5ccd2a,_0xb8394a){return db[_0xe2f2('0x2a')][_0xe2f2('0x50')]({'where':{'id':_0x5ccd2a[_0xe2f2('0x45')]['id']}})[_0xe2f2('0x21')](handleEntityNotFound(_0xb8394a,null))['then'](removeEntity(_0xb8394a,null))[_0xe2f2('0x43')](handleError(_0xb8394a,null));}; \ No newline at end of file +var _0x0d91=['query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','role','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','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','get','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','ContactItemType','rawAttributes','type','key','model','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0d91,0x76));var _0x10d9=function(_0x10a4bd,_0x1fb723){_0x10a4bd=_0x10a4bd-0x0;var _0x3210f1=_0x0d91[_0x10a4bd];return _0x3210f1;};'use strict';var pdf=require(_0x10d9('0x0'));var emlformat=require(_0x10d9('0x1'));var rimraf=require(_0x10d9('0x2'));var zipdir=require(_0x10d9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10d9('0x4'));var moment=require(_0x10d9('0x5'));var BPromise=require(_0x10d9('0x6'));var Mustache=require('mustache');var util=require(_0x10d9('0x7'));var path=require(_0x10d9('0x8'));var sox=require(_0x10d9('0x9'));var csv=require('to-csv');var ejs=require(_0x10d9('0xa'));var fs=require('fs');var _=require(_0x10d9('0xb'));var squel=require(_0x10d9('0xc'));var crypto=require(_0x10d9('0xd'));var jsforce=require(_0x10d9('0xe'));var deskjs=require(_0x10d9('0xf'));var toCsv=require(_0x10d9('0x10'));var querystring=require(_0x10d9('0x11'));var Papa=require(_0x10d9('0x12'));var Redis=require(_0x10d9('0x13'));var authService=require(_0x10d9('0x14'));var qs=require(_0x10d9('0x15'));var as=require(_0x10d9('0x16'));var hardwareService=require(_0x10d9('0x17'));var logger=require(_0x10d9('0x18'))(_0x10d9('0x19'));var utils=require(_0x10d9('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x10d9('0x1b'));var db=require(_0x10d9('0x1c'))['db'];function respondWithStatusCode(_0x12a2b4,_0x2910ab){_0x2910ab=_0x2910ab||0xcc;return function(_0x316417){if(_0x316417){return _0x12a2b4['sendStatus'](_0x2910ab);}return _0x12a2b4[_0x10d9('0x1d')](_0x2910ab)['end']();};}function respondWithResult(_0x436773,_0x1035b1){_0x1035b1=_0x1035b1||0xc8;return function(_0x1b3cf5){if(_0x1b3cf5){return _0x436773[_0x10d9('0x1d')](_0x1035b1)[_0x10d9('0x1e')](_0x1b3cf5);}};}function respondWithFilteredResult(_0x198778,_0x211df6){return function(_0x2a6587){if(_0x2a6587){var _0x453d22=_0x2a6587[_0x10d9('0x1f')],_0xb5d3ec=_0x211df6[_0x10d9('0x20')],_0x4c6792=_0x211df6[_0x10d9('0x20')]+_0x211df6[_0x10d9('0x21')],_0x5658b5;if(_0x4c6792>=_0x453d22){_0x4c6792=_0x453d22;_0x5658b5=0xc8;}else{_0x5658b5=0xce;}_0x198778['status'](_0x5658b5);return _0x198778[_0x10d9('0x22')](_0x10d9('0x23'),_0xb5d3ec+'-'+_0x4c6792+'/'+_0x453d22)[_0x10d9('0x1e')](_0x2a6587);}return null;};}function patchUpdates(_0x8441a5){return function(_0x5c7014){try{jsonpatch[_0x10d9('0x24')](_0x5c7014,_0x8441a5,!![]);}catch(_0xff164e){return BPromise['reject'](_0xff164e);}return _0x5c7014['save']();};}function saveUpdates(_0x25f950,_0x48940c){return function(_0x11be56){if(_0x11be56){return _0x11be56[_0x10d9('0x25')](_0x25f950)['then'](function(_0x322b57){return _0x322b57;});}return null;};}function removeEntity(_0x2c1346,_0x3e7a25){return function(_0x1bf9fa){if(_0x1bf9fa){return _0x1bf9fa[_0x10d9('0x26')]()[_0x10d9('0x27')](function(){var _0x26ff84=_0x1bf9fa[_0x10d9('0x28')]({'plain':!![]});var _0x13a3e0=_0x10d9('0x29');return db[_0x10d9('0x2a')][_0x10d9('0x26')]({'where':{'type':_0x13a3e0,'resourceId':_0x26ff84['id']}})[_0x10d9('0x27')](function(){return _0x1bf9fa;});})[_0x10d9('0x27')](function(){_0x2c1346[_0x10d9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c4ec,_0x295489){return function(_0xce87ca){if(!_0xce87ca){_0x14c4ec[_0x10d9('0x2b')](0x194);}return _0xce87ca;};}function handleError(_0x4b2619,_0x3ba01f){_0x3ba01f=_0x3ba01f||0x1f4;return function(_0x50971e){logger[_0x10d9('0x2c')](_0x50971e[_0x10d9('0x2d')]);if(_0x50971e[_0x10d9('0x2e')]){delete _0x50971e[_0x10d9('0x2e')];}_0x4b2619['status'](_0x3ba01f)[_0x10d9('0x2f')](_0x50971e);};}exports['index']=function(_0x26850c,_0x3ec714){var _0x1e2c7e={},_0x8066b2={},_0x326b42={'count':0x0,'rows':[]};var _0x4fac0b=_['map'](db[_0x10d9('0x30')][_0x10d9('0x31')],function(_0x4f4359){return{'name':_0x4f4359['fieldName'],'type':_0x4f4359[_0x10d9('0x32')][_0x10d9('0x33')]};});_0x8066b2[_0x10d9('0x34')]=_['map'](_0x4fac0b,_0x10d9('0x2e'));_0x8066b2['query']=_[_0x10d9('0x35')](_0x26850c[_0x10d9('0x36')]);_0x8066b2['filters']=_['intersection'](_0x8066b2[_0x10d9('0x34')],_0x8066b2[_0x10d9('0x36')]);_0x1e2c7e['attributes']=_[_0x10d9('0x37')](_0x8066b2[_0x10d9('0x34')],qs['fields'](_0x26850c[_0x10d9('0x36')][_0x10d9('0x38')]));_0x1e2c7e[_0x10d9('0x39')]=_0x1e2c7e['attributes'][_0x10d9('0x3a')]?_0x1e2c7e[_0x10d9('0x39')]:_0x8066b2[_0x10d9('0x34')];if(!_0x26850c['query'][_0x10d9('0x3b')](_0x10d9('0x3c'))){_0x1e2c7e['limit']=qs[_0x10d9('0x21')](_0x26850c[_0x10d9('0x36')][_0x10d9('0x21')]);_0x1e2c7e[_0x10d9('0x20')]=qs[_0x10d9('0x20')](_0x26850c[_0x10d9('0x36')]['offset']);}_0x1e2c7e['order']=qs['sort'](_0x26850c[_0x10d9('0x36')][_0x10d9('0x3d')]);_0x1e2c7e[_0x10d9('0x3e')]=qs[_0x10d9('0x3f')](_[_0x10d9('0x40')](_0x26850c['query'],_0x8066b2[_0x10d9('0x3f')]),_0x4fac0b);if(_0x26850c[_0x10d9('0x36')][_0x10d9('0x41')]){_0x1e2c7e[_0x10d9('0x3e')]=_['merge'](_0x1e2c7e[_0x10d9('0x3e')],{'$or':_[_0x10d9('0x42')](_0x4fac0b,function(_0xdd2c0d){if(_0xdd2c0d[_0x10d9('0x32')]!==_0x10d9('0x43')){var _0x3d2152={};_0x3d2152[_0xdd2c0d['name']]={'$like':'%'+_0x26850c[_0x10d9('0x36')][_0x10d9('0x41')]+'%'};return _0x3d2152;}})});}_0x1e2c7e=_[_0x10d9('0x44')]({},_0x1e2c7e,_0x26850c[_0x10d9('0x45')]);var _0x3bf629={'where':_0x1e2c7e[_0x10d9('0x3e')]};return db[_0x10d9('0x30')][_0x10d9('0x1f')](_0x3bf629)[_0x10d9('0x27')](function(_0x5cbeb3){_0x326b42[_0x10d9('0x1f')]=_0x5cbeb3;if(_0x26850c[_0x10d9('0x36')][_0x10d9('0x46')]){_0x1e2c7e['include']=[{'all':!![]}];}return db[_0x10d9('0x30')][_0x10d9('0x47')](_0x1e2c7e);})['then'](function(_0x3d6a0d){_0x326b42[_0x10d9('0x48')]=_0x3d6a0d;return _0x326b42;})[_0x10d9('0x27')](respondWithFilteredResult(_0x3ec714,_0x1e2c7e))[_0x10d9('0x49')](handleError(_0x3ec714,null));};exports[_0x10d9('0x4a')]=function(_0x16b4c4,_0x2d36d9){var _0x2c576d={'raw':!![],'where':{'id':_0x16b4c4[_0x10d9('0x4b')]['id']}},_0xd4f5db={};_0xd4f5db['model']=_[_0x10d9('0x35')](db[_0x10d9('0x30')][_0x10d9('0x31')]);_0xd4f5db[_0x10d9('0x36')]=_[_0x10d9('0x35')](_0x16b4c4[_0x10d9('0x36')]);_0xd4f5db[_0x10d9('0x3f')]=_[_0x10d9('0x37')](_0xd4f5db[_0x10d9('0x34')],_0xd4f5db[_0x10d9('0x36')]);_0x2c576d[_0x10d9('0x39')]=_[_0x10d9('0x37')](_0xd4f5db[_0x10d9('0x34')],qs['fields'](_0x16b4c4['query'][_0x10d9('0x38')]));_0x2c576d[_0x10d9('0x39')]=_0x2c576d[_0x10d9('0x39')][_0x10d9('0x3a')]?_0x2c576d[_0x10d9('0x39')]:_0xd4f5db[_0x10d9('0x34')];if(_0x16b4c4['query']['includeAll']){_0x2c576d[_0x10d9('0x4c')]=[{'all':!![]}];}_0x2c576d=_[_0x10d9('0x44')]({},_0x2c576d,_0x16b4c4['options']);return db[_0x10d9('0x30')][_0x10d9('0x4d')](_0x2c576d)[_0x10d9('0x27')](handleEntityNotFound(_0x2d36d9,null))[_0x10d9('0x27')](respondWithResult(_0x2d36d9,null))[_0x10d9('0x49')](handleError(_0x2d36d9,null));};exports['create']=function(_0x33291a,_0x1f8252){return db[_0x10d9('0x30')][_0x10d9('0x4e')](_0x33291a[_0x10d9('0x4f')],{})['then'](function(_0x2ac008){var _0x30d8e2=_0x33291a[_0x10d9('0x50')]['get']({'plain':!![]});if(!_0x30d8e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30d8e2[_0x10d9('0x51')]===_0x10d9('0x50')){var _0x28e9c1=_0x2ac008[_0x10d9('0x28')]({'plain':!![]});var _0x42f357=_0x10d9('0x29');return db[_0x10d9('0x52')][_0x10d9('0x4d')]({'where':{'name':_0x42f357,'userProfileId':_0x30d8e2[_0x10d9('0x53')]},'raw':!![]})['then'](function(_0x3fd80c){if(_0x3fd80c&&_0x3fd80c[_0x10d9('0x54')]===0x0){return db[_0x10d9('0x2a')][_0x10d9('0x4e')]({'name':_0x28e9c1[_0x10d9('0x2e')],'resourceId':_0x28e9c1['id'],'type':_0x3fd80c[_0x10d9('0x2e')],'sectionId':_0x3fd80c['id']},{})[_0x10d9('0x27')](function(){return _0x2ac008;});}else{return _0x2ac008;}})[_0x10d9('0x49')](function(_0x2b9c95){logger[_0x10d9('0x2c')](_0x10d9('0x55'),_0x2b9c95);throw _0x2b9c95;});}return _0x2ac008;})[_0x10d9('0x27')](respondWithResult(_0x1f8252,0xc9))['catch'](handleError(_0x1f8252,null));};exports[_0x10d9('0x25')]=function(_0x3b1f6b,_0x36d2bb){if(_0x3b1f6b['body']['id']){delete _0x3b1f6b[_0x10d9('0x4f')]['id'];}return db[_0x10d9('0x30')][_0x10d9('0x4d')]({'where':{'id':_0x3b1f6b[_0x10d9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36d2bb,null))[_0x10d9('0x27')](saveUpdates(_0x3b1f6b[_0x10d9('0x4f')],null))[_0x10d9('0x27')](respondWithResult(_0x36d2bb,null))[_0x10d9('0x49')](handleError(_0x36d2bb,null));};exports[_0x10d9('0x26')]=function(_0x136b2d,_0x4d8141){return db['ContactItemType']['find']({'where':{'id':_0x136b2d['params']['id']}})[_0x10d9('0x27')](handleEntityNotFound(_0x4d8141,null))[_0x10d9('0x27')](removeEntity(_0x4d8141,null))['catch'](handleError(_0x4d8141,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1197ed0..9545be5 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 _0x88b0=['define','ContactItemType','tools_contact_item_types','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0x88b0,0x1cb));var _0x088b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x88b0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x088b('0x0'));var util=require(_0x088b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x088b('0x2'));var BPromise=require(_0x088b('0x3'));var rp=require(_0x088b('0x4'));var fs=require('fs');var path=require(_0x088b('0x5'));var rimraf=require('rimraf');var config=require(_0x088b('0x6'));var attributes=require(_0x088b('0x7'));module[_0x088b('0x8')]=function(_0x5af8a4,_0x4a9986){return _0x5af8a4[_0x088b('0x9')](_0x088b('0xa'),attributes,{'tableName':_0x088b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e02=['../../config/environment','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52c680,_0x31454a){var _0x195d7e=function(_0x60c2b8){while(--_0x60c2b8){_0x52c680['push'](_0x52c680['shift']());}};_0x195d7e(++_0x31454a);}(_0x7e02,0x71));var _0x27e0=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x7e02[_0x3f00ee];return _0x18a07e;};'use strict';var _=require(_0x27e0('0x0'));var util=require(_0x27e0('0x1'));var logger=require(_0x27e0('0x2'))(_0x27e0('0x3'));var moment=require(_0x27e0('0x4'));var BPromise=require(_0x27e0('0x5'));var rp=require(_0x27e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x27e0('0x7'));var attributes=require('./contactItemType.attributes');module[_0x27e0('0x8')]=function(_0x1f98c5,_0x3ddcd2){return _0x1f98c5[_0x27e0('0x9')](_0x27e0('0xa'),attributes,{'tableName':_0x27e0('0xb'),'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 55d0574..78fa357 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3644b9,_0x5cd3a6){var _0x4d196d=function(_0x2bb4ef){while(--_0x2bb4ef){_0x3644b9['push'](_0x3644b9['shift']());}};_0x4d196d(++_0x5cd3a6);}(_0x99e9,0xb4));var _0x999e=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x99e9[_0x18776a];return _0x484e4a;};'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']('ContactItemType,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('ContactItemType,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x0884=['then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x14cb20,_0x3ef5a6){var _0x285144=function(_0x19b3b1){while(--_0x19b3b1){_0x14cb20['push'](_0x14cb20['shift']());}};_0x285144(++_0x3ef5a6);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var util=require(_0x4088('0x1'));var moment=require(_0x4088('0x2'));var BPromise=require(_0x4088('0x3'));var rs=require(_0x4088('0x4'));var fs=require('fs');var Redis=require(_0x4088('0x5'));var db=require(_0x4088('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4088('0x7'))(_0x4088('0x8'));var config=require(_0x4088('0x9'));var jayson=require(_0x4088('0xa'));var client=jayson[_0x4088('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d68aa,_0x42b2c3,_0x52baff){return new BPromise(function(_0x680227,_0x8f007c){return client[_0x4088('0xc')](_0x4d68aa,_0x52baff)[_0x4088('0xd')](function(_0x32fbb6){logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));logger[_0x4088('0x11')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x42b2c3,_0x4088('0x10'),JSON[_0x4088('0x12')](_0x32fbb6));if(_0x32fbb6[_0x4088('0x13')]){if(_0x32fbb6['error'][_0x4088('0x14')]===0x1f4){logger[_0x4088('0x13')]('ContactItemType,\x20%s,\x20%s',_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x8f007c(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}logger[_0x4088('0x13')](_0x4088('0xf'),_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x680227(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}else{logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));_0x680227(_0x32fbb6[_0x4088('0x16')][_0x4088('0x15')]);}})[_0x4088('0x17')](function(_0x38c6d6){logger[_0x4088('0x13')]('ContactItemType,\x20%s,\x20%s',_0x42b2c3,_0x38c6d6);_0x8f007c(_0x38c6d6);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index fdc5c2e..1012f9f 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 _0x27d3=['../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x5ebd9d,_0x4eec29){var _0x75ced3=function(_0x817717){while(--_0x817717){_0x5ebd9d['push'](_0x5ebd9d['shift']());}};_0x75ced3(++_0x4eec29);}(_0x27d3,0x199));var _0x327d=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x27d3[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0x327d('0x0'));var util=require(_0x327d('0x1'));var path=require(_0x327d('0x2'));var timeout=require(_0x327d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x327d('0x4'));var interaction=require(_0x327d('0x5'));var config=require(_0x327d('0x6'));var controller=require('./contactItemType.controller');router[_0x327d('0x7')]('/',auth['isAuthenticated'](),controller[_0x327d('0x8')]);router[_0x327d('0x7')](_0x327d('0x9'),auth['isAuthenticated'](),controller[_0x327d('0xa')]);router[_0x327d('0xb')]('/',auth[_0x327d('0xc')](),controller[_0x327d('0xd')]);router[_0x327d('0xe')](_0x327d('0x9'),auth[_0x327d('0xc')](),controller[_0x327d('0xf')]);router[_0x327d('0x10')]('/:id',auth[_0x327d('0xc')](),controller['destroy']);module[_0x327d('0x11')]=router; \ No newline at end of file +var _0x34a5=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','post','put','update'];(function(_0x1f1b2d,_0xda4162){var _0x58335b=function(_0x3bf932){while(--_0x3bf932){_0x1f1b2d['push'](_0x1f1b2d['shift']());}};_0x58335b(++_0xda4162);}(_0x34a5,0x198));var _0x534a=function(_0x3e30ca,_0x19bf2d){_0x3e30ca=_0x3e30ca-0x0;var _0x217c47=_0x34a5[_0x3e30ca];return _0x217c47;};'use strict';var multer=require(_0x534a('0x0'));var util=require('util');var path=require(_0x534a('0x1'));var timeout=require(_0x534a('0x2'));var express=require(_0x534a('0x3'));var router=express[_0x534a('0x4')]();var auth=require(_0x534a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x534a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x534a('0x6')](_0x534a('0x7'),auth[_0x534a('0x8')](),controller['show']);router[_0x534a('0x9')]('/',auth[_0x534a('0x8')](),controller['create']);router[_0x534a('0xa')]('/:id',auth[_0x534a('0x8')](),controller[_0x534a('0xb')]);router[_0x534a('0xc')](_0x534a('0x7'),auth['isAuthenticated'](),controller[_0x534a('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5bf2306..34b8d6f 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 _0x4ff6=['exports','STRING','name'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x4ff6,0xd5));var _0x64ff=function(_0x568686,_0x16a88a){_0x568686=_0x568686-0x0;var _0x50a05b=_0x4ff6[_0x568686];return _0x50a05b;};'use strict';var Sequelize=require('sequelize');module[_0x64ff('0x0')]={'name':{'type':Sequelize[_0x64ff('0x1')],'allowNull':![],'unique':_0x64ff('0x2')},'description':{'type':Sequelize[_0x64ff('0x1')]}}; \ No newline at end of file +var _0x40c2=['STRING','name','exports'];(function(_0x2b5edd,_0x5bf41b){var _0x56b8f5=function(_0x28876e){while(--_0x28876e){_0x2b5edd['push'](_0x2b5edd['shift']());}};_0x56b8f5(++_0x5bf41b);}(_0x40c2,0x10d));var _0x240c=function(_0x5311e0,_0x21022c){_0x5311e0=_0x5311e0-0x0;var _0x9a859=_0x40c2[_0x5311e0];return _0x9a859;};'use strict';var Sequelize=require('sequelize');module[_0x240c('0x0')]={'name':{'type':Sequelize[_0x240c('0x1')],'allowNull':![],'unique':_0x240c('0x2')},'description':{'type':Sequelize[_0x240c('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 65925e8..01f6de5 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 _0x3acb=['keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','user','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','pick','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','model','query'];(function(_0x34191a,_0x12368d){var _0x377c39=function(_0x2c7db5){while(--_0x2c7db5){_0x34191a['push'](_0x34191a['shift']());}};_0x377c39(++_0x12368d);}(_0x3acb,0x126));var _0xb3ac=function(_0x511890,_0x100c2a){_0x511890=_0x511890-0x0;var _0x5dfc80=_0x3acb[_0x511890];return _0x5dfc80;};'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(_0xb3ac('0x0'));var moment=require(_0xb3ac('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb3ac('0x2'));var util=require(_0xb3ac('0x3'));var path=require(_0xb3ac('0x4'));var sox=require(_0xb3ac('0x5'));var csv=require(_0xb3ac('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3ac('0x7'));var squel=require('squel');var crypto=require(_0xb3ac('0x8'));var jsforce=require(_0xb3ac('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb3ac('0x6'));var querystring=require(_0xb3ac('0xa'));var Papa=require(_0xb3ac('0xb'));var Redis=require(_0xb3ac('0xc'));var authService=require(_0xb3ac('0xd'));var qs=require(_0xb3ac('0xe'));var as=require(_0xb3ac('0xf'));var hardwareService=require(_0xb3ac('0x10'));var logger=require(_0xb3ac('0x11'))(_0xb3ac('0x12'));var utils=require(_0xb3ac('0x13'));var config=require(_0xb3ac('0x14'));var licenseUtil=require(_0xb3ac('0x15'));var db=require(_0xb3ac('0x16'))['db'];config[_0xb3ac('0x17')]=_[_0xb3ac('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb3ac('0x19'))(new Redis(config[_0xb3ac('0x17')]));require('./dashboard.socket')[_0xb3ac('0x1a')](socket);function respondWithStatusCode(_0x2a099e,_0x3a0ab2){_0x3a0ab2=_0x3a0ab2||0xcc;return function(_0x535b15){if(_0x535b15){return _0x2a099e['sendStatus'](_0x3a0ab2);}return _0x2a099e[_0xb3ac('0x1b')](_0x3a0ab2)[_0xb3ac('0x1c')]();};}function respondWithResult(_0x50add0,_0x16be23){_0x16be23=_0x16be23||0xc8;return function(_0x3e32de){if(_0x3e32de){return _0x50add0[_0xb3ac('0x1b')](_0x16be23)[_0xb3ac('0x1d')](_0x3e32de);}};}function respondWithFilteredResult(_0x2a6b22,_0x5768cc){return function(_0x453f93){if(_0x453f93){var _0x50d425=_0x453f93[_0xb3ac('0x1e')],_0xc179bf=_0x5768cc['offset'],_0x22d0a1=_0x5768cc[_0xb3ac('0x1f')]+_0x5768cc[_0xb3ac('0x20')],_0x4d763c;if(_0x22d0a1>=_0x50d425){_0x22d0a1=_0x50d425;_0x4d763c=0xc8;}else{_0x4d763c=0xce;}_0x2a6b22[_0xb3ac('0x1b')](_0x4d763c);return _0x2a6b22[_0xb3ac('0x21')](_0xb3ac('0x22'),_0xc179bf+'-'+_0x22d0a1+'/'+_0x50d425)[_0xb3ac('0x1d')](_0x453f93);}return null;};}function patchUpdates(_0x4ef64a){return function(_0x23c3d3){try{jsonpatch[_0xb3ac('0x23')](_0x23c3d3,_0x4ef64a,!![]);}catch(_0x3fb97a){return BPromise['reject'](_0x3fb97a);}return _0x23c3d3[_0xb3ac('0x24')]();};}function saveUpdates(_0x80d568,_0x25f95d){return function(_0x3c23d6){if(_0x3c23d6){return _0x3c23d6[_0xb3ac('0x25')](_0x80d568)[_0xb3ac('0x26')](function(_0x20a036){return _0x20a036;});}return null;};}function removeEntity(_0xd9df91,_0x5e86fb){return function(_0x1ba373){if(_0x1ba373){return _0x1ba373[_0xb3ac('0x27')]()[_0xb3ac('0x26')](function(){var _0x5aea3c=_0x1ba373[_0xb3ac('0x28')]({'plain':!![]});var _0x1d0384='CustomDashboards';return db[_0xb3ac('0x29')][_0xb3ac('0x27')]({'where':{'type':_0x1d0384,'resourceId':_0x5aea3c['id']}})['then'](function(){return _0x1ba373;});})['then'](function(){_0xd9df91[_0xb3ac('0x1b')](0xcc)[_0xb3ac('0x1c')]();});}};}function handleEntityNotFound(_0x28222a,_0x3a4cab){return function(_0x407671){if(!_0x407671){_0x28222a[_0xb3ac('0x2a')](0x194);}return _0x407671;};}function handleError(_0x54c9e2,_0x564027){_0x564027=_0x564027||0x1f4;return function(_0xf49982){logger[_0xb3ac('0x2b')](_0xf49982[_0xb3ac('0x2c')]);if(_0xf49982[_0xb3ac('0x2d')]){delete _0xf49982[_0xb3ac('0x2d')];}_0x54c9e2['status'](_0x564027)['send'](_0xf49982);};}exports[_0xb3ac('0x2e')]=function(_0x1c34f2,_0x2574d9){var _0x3adc40={},_0x29f223={},_0x4666c5={'count':0x0,'rows':[]};var _0x551375=_[_0xb3ac('0x2f')](db[_0xb3ac('0x30')][_0xb3ac('0x31')],function(_0x1a2f73){return{'name':_0x1a2f73[_0xb3ac('0x32')],'type':_0x1a2f73[_0xb3ac('0x33')]['key']};});_0x29f223[_0xb3ac('0x34')]=_[_0xb3ac('0x2f')](_0x551375,_0xb3ac('0x2d'));_0x29f223[_0xb3ac('0x35')]=_[_0xb3ac('0x36')](_0x1c34f2['query']);_0x29f223[_0xb3ac('0x37')]=_[_0xb3ac('0x38')](_0x29f223[_0xb3ac('0x34')],_0x29f223[_0xb3ac('0x35')]);_0x3adc40[_0xb3ac('0x39')]=_[_0xb3ac('0x38')](_0x29f223[_0xb3ac('0x34')],qs['fields'](_0x1c34f2[_0xb3ac('0x35')]['fields']));_0x3adc40['attributes']=_0x3adc40[_0xb3ac('0x39')]['length']?_0x3adc40['attributes']:_0x29f223[_0xb3ac('0x34')];if(!_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x3a')](_0xb3ac('0x3b'))){_0x3adc40[_0xb3ac('0x20')]=qs[_0xb3ac('0x20')](_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x20')]);_0x3adc40[_0xb3ac('0x1f')]=qs['offset'](_0x1c34f2[_0xb3ac('0x35')]['offset']);}_0x3adc40[_0xb3ac('0x3c')]=qs[_0xb3ac('0x3d')](_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x3d')]);_0x3adc40[_0xb3ac('0x3e')]=qs[_0xb3ac('0x37')](_['pick'](_0x1c34f2[_0xb3ac('0x35')],_0x29f223['filters']),_0x551375);if(_0x1c34f2['query'][_0xb3ac('0x3f')]){_0x3adc40[_0xb3ac('0x3e')]=_[_0xb3ac('0x40')](_0x3adc40[_0xb3ac('0x3e')],{'$or':_[_0xb3ac('0x2f')](_0x551375,function(_0x564b2f){if(_0x564b2f[_0xb3ac('0x33')]!==_0xb3ac('0x41')){var _0x4629e8={};_0x4629e8[_0x564b2f[_0xb3ac('0x2d')]]={'$like':'%'+_0x1c34f2[_0xb3ac('0x35')]['filter']+'%'};return _0x4629e8;}})});}_0x3adc40=_[_0xb3ac('0x40')]({},_0x3adc40,_0x1c34f2[_0xb3ac('0x42')]);var _0x203527={'where':_0x3adc40['where']};return db['Dashboard']['count'](_0x203527)['then'](function(_0x1f283a){_0x4666c5[_0xb3ac('0x1e')]=_0x1f283a;if(_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x43')]){_0x3adc40[_0xb3ac('0x44')]=[{'all':!![]}];}return db[_0xb3ac('0x30')][_0xb3ac('0x45')](_0x3adc40);})[_0xb3ac('0x26')](function(_0x1d16e5){_0x4666c5[_0xb3ac('0x46')]=_0x1d16e5;return _0x4666c5;})[_0xb3ac('0x26')](respondWithFilteredResult(_0x2574d9,_0x3adc40))['catch'](handleError(_0x2574d9,null));};exports[_0xb3ac('0x47')]=function(_0x430b11,_0x256c65){var _0x3d191a={'raw':![],'where':{'id':_0x430b11[_0xb3ac('0x48')]['id']}},_0x21cfd4={};_0x21cfd4[_0xb3ac('0x34')]=_[_0xb3ac('0x36')](db[_0xb3ac('0x30')][_0xb3ac('0x31')]);_0x21cfd4['query']=_[_0xb3ac('0x36')](_0x430b11['query']);_0x21cfd4[_0xb3ac('0x37')]=_[_0xb3ac('0x38')](_0x21cfd4[_0xb3ac('0x34')],_0x21cfd4[_0xb3ac('0x35')]);_0x3d191a[_0xb3ac('0x39')]=_[_0xb3ac('0x38')](_0x21cfd4[_0xb3ac('0x34')],qs['fields'](_0x430b11['query']['fields']));_0x3d191a['attributes']=_0x3d191a['attributes'][_0xb3ac('0x49')]?_0x3d191a[_0xb3ac('0x39')]:_0x21cfd4[_0xb3ac('0x34')];if(_0x430b11[_0xb3ac('0x35')][_0xb3ac('0x43')]){_0x3d191a[_0xb3ac('0x44')]=[{'all':!![]}];}_0x3d191a=_['merge']({},_0x3d191a,_0x430b11['options']);return db[_0xb3ac('0x30')][_0xb3ac('0x4a')](_0x3d191a)[_0xb3ac('0x26')](handleEntityNotFound(_0x256c65,null))[_0xb3ac('0x26')](respondWithResult(_0x256c65,null))[_0xb3ac('0x4b')](handleError(_0x256c65,null));};exports['create']=function(_0x386e52,_0x5ef450){return db[_0xb3ac('0x30')][_0xb3ac('0x4c')](_0x386e52['body'],{})[_0xb3ac('0x26')](function(_0x119a19){var _0x3b0b83=_0x386e52['user'][_0xb3ac('0x28')]({'plain':!![]});if(!_0x3b0b83)throw new Error(_0xb3ac('0x4d'));if(_0x3b0b83['role']==='user'){var _0x248452=_0x119a19[_0xb3ac('0x28')]({'plain':!![]});var _0x4d9cdd=_0xb3ac('0x4e');return db[_0xb3ac('0x4f')][_0xb3ac('0x4a')]({'where':{'name':_0x4d9cdd,'userProfileId':_0x3b0b83[_0xb3ac('0x50')]},'raw':!![]})[_0xb3ac('0x26')](function(_0x1d5282){if(_0x1d5282&&_0x1d5282[_0xb3ac('0x51')]===0x0){return db[_0xb3ac('0x29')][_0xb3ac('0x4c')]({'name':_0x248452[_0xb3ac('0x2d')],'resourceId':_0x248452['id'],'type':_0x1d5282[_0xb3ac('0x2d')],'sectionId':_0x1d5282['id']},{})['then'](function(){return _0x119a19;});}else{return _0x119a19;}})[_0xb3ac('0x4b')](function(_0x12c4c2){logger[_0xb3ac('0x2b')](_0xb3ac('0x52'),_0x12c4c2);throw _0x12c4c2;});}return _0x119a19;})[_0xb3ac('0x26')](respondWithResult(_0x5ef450,0xc9))[_0xb3ac('0x4b')](handleError(_0x5ef450,null));};exports['clone']=function(_0x261f58,_0x280bc7){var _0x3ebcdb={'where':{'id':_0x261f58['params']['id']}},_0x508244={};_0x508244[_0xb3ac('0x34')]=_['keys'](db['Dashboard']['rawAttributes']);_0x3ebcdb[_0xb3ac('0x39')]=_['intersection'](_0x508244[_0xb3ac('0x34')],qs['fields'](_0x261f58[_0xb3ac('0x35')]['fields']));_0x3ebcdb[_0xb3ac('0x39')]=_0x3ebcdb[_0xb3ac('0x39')][_0xb3ac('0x49')]?_0x3ebcdb[_0xb3ac('0x39')]:_0x508244[_0xb3ac('0x34')];if(_0x261f58[_0xb3ac('0x35')]['includeAll']){_0x3ebcdb[_0xb3ac('0x44')]=[{'all':!![]}];}_0x3ebcdb=_[_0xb3ac('0x40')]({},_0x3ebcdb,_0x261f58[_0xb3ac('0x42')]);return db[_0xb3ac('0x30')][_0xb3ac('0x4a')](_0x3ebcdb)[_0xb3ac('0x26')](handleEntityNotFound(_0x280bc7,null))[_0xb3ac('0x26')](function(_0x4bbe9b){if(_0x4bbe9b){var _0x2b8a9d=_0x4bbe9b[_0xb3ac('0x28')]({'plain':!![]});_0x2b8a9d=qs[_0xb3ac('0x53')](_0x2b8a9d,['id',_0xb3ac('0x54'),_0xb3ac('0x55')]);_0x261f58['body']=_[_0xb3ac('0x53')](_0x261f58['body'],['id',_0xb3ac('0x54'),_0xb3ac('0x55')]);return db[_0xb3ac('0x30')][_0xb3ac('0x4c')](_[_0xb3ac('0x40')](_0x2b8a9d,_0x261f58[_0xb3ac('0x56')]),{'include':_0x261f58[_0xb3ac('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4c871a){var _0x30c334=_0x261f58[_0xb3ac('0x57')][_0xb3ac('0x28')]({'plain':!![]});if(!_0x30c334)throw new Error(_0xb3ac('0x4d'));if(_0x30c334['role']===_0xb3ac('0x57')){var _0x51788a=_0x4c871a[_0xb3ac('0x28')]({'plain':!![]});var _0x15121a='CustomDashboards';return db[_0xb3ac('0x4f')][_0xb3ac('0x4a')]({'where':{'name':_0x15121a,'userProfileId':_0x30c334[_0xb3ac('0x50')]},'raw':!![]})[_0xb3ac('0x26')](function(_0x3fdc24){if(_0x3fdc24&&_0x3fdc24[_0xb3ac('0x51')]===0x0){return db['UserProfileResource'][_0xb3ac('0x4c')]({'name':_0x51788a['name'],'resourceId':_0x51788a['id'],'type':_0x3fdc24['name'],'sectionId':_0x3fdc24['id']},{})[_0xb3ac('0x26')](function(){return _0x4c871a;});}else{return _0x4c871a;}})['catch'](function(_0x297285){logger['error'](_0xb3ac('0x52'),_0x297285);throw _0x297285;});}return _0x4c871a;});}})['then'](respondWithResult(_0x280bc7,0xc9))[_0xb3ac('0x4b')](handleError(_0x280bc7,null));};exports[_0xb3ac('0x25')]=function(_0x9961de,_0x6d25c1){if(_0x9961de[_0xb3ac('0x56')]['id']){delete _0x9961de[_0xb3ac('0x56')]['id'];}return db['Dashboard'][_0xb3ac('0x4a')]({'where':{'id':_0x9961de[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x6d25c1,null))[_0xb3ac('0x26')](saveUpdates(_0x9961de['body'],null))[_0xb3ac('0x26')](respondWithResult(_0x6d25c1,null))['catch'](handleError(_0x6d25c1,null));};exports[_0xb3ac('0x27')]=function(_0x53eca9,_0x5a64f8){return db[_0xb3ac('0x30')][_0xb3ac('0x4a')]({'where':{'id':_0x53eca9[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x5a64f8,null))[_0xb3ac('0x26')](removeEntity(_0x5a64f8,null))[_0xb3ac('0x4b')](handleError(_0x5a64f8,null));};function widgetAttributes(_0x44e666){try{switch(_0x44e666['type']){case _0xb3ac('0x58'):return[{'name':_0xb3ac('0x59'),'value':_0x44e666[_0xb3ac('0x59')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0]['value']:undefined)||_0xb3ac('0x5b')}];case _0xb3ac('0x5c'):return[{'name':_0xb3ac('0x5d'),'value':_0x44e666['attrPath']||(_0x44e666['attrs']&&_0x44e666['attrs'][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0][_0xb3ac('0x5e')]:undefined)||''}];case _0xb3ac('0x5f'):return[{'name':'attrHourFormat','value':_0x44e666[_0xb3ac('0x60')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666['attrs'][0x0][_0xb3ac('0x5e')]:undefined)||_0xb3ac('0x61')},{'name':_0xb3ac('0x62'),'value':_0x44e666['attrTimezone']||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1]['value']:undefined)||_0xb3ac('0x63')},{'name':'attrFontSize','value':_0x44e666[_0xb3ac('0x64')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x2]?_0x44e666[_0xb3ac('0x5a')][0x2]['value']:undefined)||0xc}];case _0xb3ac('0x65'):return[{'name':'attrMetric','value':_0x44e666['attrMetric']||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0][_0xb3ac('0x5e')]:undefined)||_0xb3ac('0x66')},{'name':_0xb3ac('0x67'),'value':_0x44e666[_0xb3ac('0x67')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1][_0xb3ac('0x5e')]:undefined)||[]},{'name':_0xb3ac('0x64'),'value':_0x44e666[_0xb3ac('0x64')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x2]?_0x44e666['attrs'][0x2][_0xb3ac('0x5e')]:undefined)||0x14}];case _0xb3ac('0x68'):case _0xb3ac('0x69'):return[{'name':'attrSerie1','value':_0x44e666['attrSerie1']||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666['attrs'][0x0][_0xb3ac('0x5e')]:undefined)||_0xb3ac('0x66')},{'name':_0xb3ac('0x6a'),'value':_0x44e666[_0xb3ac('0x6a')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1][_0xb3ac('0x5e')]:undefined)||null},{'name':_0xb3ac('0x6b'),'value':_0x44e666[_0xb3ac('0x6b')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x2]?_0x44e666[_0xb3ac('0x5a')][0x2][_0xb3ac('0x5e')]:undefined)||null},{'name':_0xb3ac('0x67'),'value':_0x44e666[_0xb3ac('0x67')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x3]?_0x44e666[_0xb3ac('0x5a')][0x3][_0xb3ac('0x5e')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x44e666['reportType']||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666['attrs'][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0]['type']:undefined)||null,'value':_0x44e666[_0xb3ac('0x6c')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0][_0xb3ac('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x44e666[_0xb3ac('0x6d')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1][_0xb3ac('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x30663a){logger['error']('widgetAttributes:\x20%s',JSON[_0xb3ac('0x6e')](_0x30663a));return[];}}exports[_0xb3ac('0x6f')]=function(_0x525427,_0x457f49,_0x10904a){if(_0x525427[_0xb3ac('0x56')]['id']){delete _0x525427[_0xb3ac('0x56')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x525427[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x457f49,null))[_0xb3ac('0x26')](function(_0x5c56f5){if(_0x5c56f5){_0x525427['body'][_0xb3ac('0x70')]=_0x5c56f5['id'];_0x525427[_0xb3ac('0x56')][_0xb3ac('0x5a')]=widgetAttributes(_0x525427[_0xb3ac('0x56')]);return db[_0xb3ac('0x71')]['create'](_0x525427[_0xb3ac('0x56')]);}})[_0xb3ac('0x26')](respondWithResult(_0x457f49,null))[_0xb3ac('0x4b')](handleError(_0x457f49,null));};exports[_0xb3ac('0x72')]=function(_0x4d39d8,_0x53ecdc,_0x3ff67f){var _0x3ce3c7={};var _0x52e0b0={};var _0x454b6e;var _0x2a9a5a;return db[_0xb3ac('0x30')]['findOne']({'where':{'id':_0x4d39d8[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x53ecdc,null))[_0xb3ac('0x26')](function(_0x491f82){if(_0x491f82){_0x454b6e=_0x491f82;_0x52e0b0[_0xb3ac('0x34')]=_[_0xb3ac('0x36')](db[_0xb3ac('0x71')]['rawAttributes']);_0x52e0b0[_0xb3ac('0x35')]=_['keys'](_0x4d39d8[_0xb3ac('0x35')]);_0x52e0b0[_0xb3ac('0x37')]=_[_0xb3ac('0x38')](_0x52e0b0[_0xb3ac('0x34')],_0x52e0b0[_0xb3ac('0x35')]);_0x3ce3c7[_0xb3ac('0x39')]=_[_0xb3ac('0x38')](_0x52e0b0[_0xb3ac('0x34')],qs['fields'](_0x4d39d8[_0xb3ac('0x35')]['fields']));_0x3ce3c7[_0xb3ac('0x39')]=_0x3ce3c7[_0xb3ac('0x39')][_0xb3ac('0x49')]?_0x3ce3c7[_0xb3ac('0x39')]:_0x52e0b0[_0xb3ac('0x34')];_0x3ce3c7['order']=qs[_0xb3ac('0x3d')](_0x4d39d8[_0xb3ac('0x35')]['sort']);_0x3ce3c7[_0xb3ac('0x3e')]=qs['filters'](_[_0xb3ac('0x73')](_0x4d39d8['query'],_0x52e0b0[_0xb3ac('0x37')]));if(_0x4d39d8['query']['filter']){_0x3ce3c7[_0xb3ac('0x3e')]=_['merge'](_0x3ce3c7[_0xb3ac('0x3e')],{'$or':_['map'](_0x3ce3c7[_0xb3ac('0x39')],function(_0x369814){var _0x2c8e6f={};_0x2c8e6f[_0x369814]={'$like':'%'+_0x4d39d8[_0xb3ac('0x35')]['filter']+'%'};return _0x2c8e6f;})});}_0x3ce3c7=_[_0xb3ac('0x40')]({},_0x3ce3c7,_0x4d39d8[_0xb3ac('0x42')]);return _0x454b6e[_0xb3ac('0x72')](_0x3ce3c7);}})[_0xb3ac('0x26')](function(_0x12fd27){if(_0x12fd27){_0x2a9a5a=_0x12fd27[_0xb3ac('0x49')];if(!_0x4d39d8[_0xb3ac('0x35')][_0xb3ac('0x3a')](_0xb3ac('0x3b'))){_0x3ce3c7['limit']=qs[_0xb3ac('0x20')](_0x4d39d8[_0xb3ac('0x35')]['limit']);_0x3ce3c7['offset']=qs[_0xb3ac('0x1f')](_0x4d39d8[_0xb3ac('0x35')]['offset']);}return _0x454b6e[_0xb3ac('0x72')](_0x3ce3c7);}})['then'](function(_0x524c5a){if(_0x524c5a){return _0x524c5a?{'count':_0x2a9a5a,'rows':_0x524c5a}:null;}})[_0xb3ac('0x26')](respondWithResult(_0x53ecdc,null))[_0xb3ac('0x4b')](handleError(_0x53ecdc,null));}; \ No newline at end of file +var _0xd344=['map','Dashboard','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','count','include','rows','catch','params','length','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','destroy','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrSerie1','total','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','error','stack','name','send'];(function(_0x45913a,_0x30dee6){var _0xa9ad69=function(_0x2751a5){while(--_0x2751a5){_0x45913a['push'](_0x45913a['shift']());}};_0xa9ad69(++_0x30dee6);}(_0xd344,0xbb));var _0x4d34=function(_0x48ef85,_0x21c909){_0x48ef85=_0x48ef85-0x0;var _0x18cf7d=_0xd344[_0x48ef85];return _0x18cf7d;};'use strict';var pdf=require(_0x4d34('0x0'));var emlformat=require(_0x4d34('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d34('0x2'));var jsonpatch=require(_0x4d34('0x3'));var rp=require(_0x4d34('0x4'));var moment=require(_0x4d34('0x5'));var BPromise=require(_0x4d34('0x6'));var Mustache=require(_0x4d34('0x7'));var util=require(_0x4d34('0x8'));var path=require(_0x4d34('0x9'));var sox=require(_0x4d34('0xa'));var csv=require(_0x4d34('0xb'));var ejs=require(_0x4d34('0xc'));var fs=require('fs');var _=require(_0x4d34('0xd'));var squel=require('squel');var crypto=require(_0x4d34('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4d34('0xf'));var toCsv=require(_0x4d34('0xb'));var querystring=require(_0x4d34('0x10'));var Papa=require(_0x4d34('0x11'));var Redis=require(_0x4d34('0x12'));var authService=require(_0x4d34('0x13'));var qs=require(_0x4d34('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d34('0x15'));var logger=require(_0x4d34('0x16'))('api');var utils=require(_0x4d34('0x17'));var config=require(_0x4d34('0x18'));var licenseUtil=require(_0x4d34('0x19'));var db=require(_0x4d34('0x1a'))['db'];config[_0x4d34('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d34('0x1b')]));require('./dashboard.socket')[_0x4d34('0x1c')](socket);function respondWithStatusCode(_0xd02659,_0x244fc){_0x244fc=_0x244fc||0xcc;return function(_0x59f801){if(_0x59f801){return _0xd02659[_0x4d34('0x1d')](_0x244fc);}return _0xd02659[_0x4d34('0x1e')](_0x244fc)[_0x4d34('0x1f')]();};}function respondWithResult(_0x3ae3a9,_0x180ea7){_0x180ea7=_0x180ea7||0xc8;return function(_0x1f3e5e){if(_0x1f3e5e){return _0x3ae3a9[_0x4d34('0x1e')](_0x180ea7)[_0x4d34('0x20')](_0x1f3e5e);}};}function respondWithFilteredResult(_0x194c33,_0x170b68){return function(_0x3d7f0a){if(_0x3d7f0a){var _0x42a20e=_0x3d7f0a['count'],_0x437382=_0x170b68[_0x4d34('0x21')],_0x2fbe1c=_0x170b68[_0x4d34('0x21')]+_0x170b68[_0x4d34('0x22')],_0xc60e1a;if(_0x2fbe1c>=_0x42a20e){_0x2fbe1c=_0x42a20e;_0xc60e1a=0xc8;}else{_0xc60e1a=0xce;}_0x194c33['status'](_0xc60e1a);return _0x194c33[_0x4d34('0x23')](_0x4d34('0x24'),_0x437382+'-'+_0x2fbe1c+'/'+_0x42a20e)[_0x4d34('0x20')](_0x3d7f0a);}return null;};}function patchUpdates(_0x5da691){return function(_0x2c45c3){try{jsonpatch[_0x4d34('0x25')](_0x2c45c3,_0x5da691,!![]);}catch(_0xc685d8){return BPromise[_0x4d34('0x26')](_0xc685d8);}return _0x2c45c3[_0x4d34('0x27')]();};}function saveUpdates(_0x572cc5,_0x2d05ea){return function(_0x2e2e1d){if(_0x2e2e1d){return _0x2e2e1d[_0x4d34('0x28')](_0x572cc5)[_0x4d34('0x29')](function(_0x42c4b1){return _0x42c4b1;});}return null;};}function removeEntity(_0x1ef2d4,_0x2765d4){return function(_0x5c4703){if(_0x5c4703){return _0x5c4703['destroy']()[_0x4d34('0x29')](function(){var _0x59dd1d=_0x5c4703[_0x4d34('0x2a')]({'plain':!![]});var _0x4a388e=_0x4d34('0x2b');return db[_0x4d34('0x2c')]['destroy']({'where':{'type':_0x4a388e,'resourceId':_0x59dd1d['id']}})[_0x4d34('0x29')](function(){return _0x5c4703;});})[_0x4d34('0x29')](function(){_0x1ef2d4['status'](0xcc)[_0x4d34('0x1f')]();});}};}function handleEntityNotFound(_0x25607a,_0x2e1cc1){return function(_0x5a01c0){if(!_0x5a01c0){_0x25607a[_0x4d34('0x1d')](0x194);}return _0x5a01c0;};}function handleError(_0x22a7fd,_0x3a2b67){_0x3a2b67=_0x3a2b67||0x1f4;return function(_0x17b0c0){logger[_0x4d34('0x2d')](_0x17b0c0[_0x4d34('0x2e')]);if(_0x17b0c0[_0x4d34('0x2f')]){delete _0x17b0c0[_0x4d34('0x2f')];}_0x22a7fd[_0x4d34('0x1e')](_0x3a2b67)[_0x4d34('0x30')](_0x17b0c0);};}exports['index']=function(_0x38c786,_0x1becc3){var _0x5a6019={},_0x1111de={},_0x4c1047={'count':0x0,'rows':[]};var _0xa8aac0=_[_0x4d34('0x31')](db[_0x4d34('0x32')][_0x4d34('0x33')],function(_0x3d8a0e){return{'name':_0x3d8a0e[_0x4d34('0x34')],'type':_0x3d8a0e['type'][_0x4d34('0x35')]};});_0x1111de[_0x4d34('0x36')]=_['map'](_0xa8aac0,'name');_0x1111de[_0x4d34('0x37')]=_[_0x4d34('0x38')](_0x38c786[_0x4d34('0x37')]);_0x1111de['filters']=_[_0x4d34('0x39')](_0x1111de['model'],_0x1111de['query']);_0x5a6019['attributes']=_[_0x4d34('0x39')](_0x1111de['model'],qs['fields'](_0x38c786[_0x4d34('0x37')][_0x4d34('0x3a')]));_0x5a6019[_0x4d34('0x3b')]=_0x5a6019[_0x4d34('0x3b')]['length']?_0x5a6019['attributes']:_0x1111de['model'];if(!_0x38c786[_0x4d34('0x37')][_0x4d34('0x3c')](_0x4d34('0x3d'))){_0x5a6019[_0x4d34('0x22')]=qs['limit'](_0x38c786[_0x4d34('0x37')][_0x4d34('0x22')]);_0x5a6019[_0x4d34('0x21')]=qs['offset'](_0x38c786['query'][_0x4d34('0x21')]);}_0x5a6019[_0x4d34('0x3e')]=qs[_0x4d34('0x3f')](_0x38c786[_0x4d34('0x37')][_0x4d34('0x3f')]);_0x5a6019[_0x4d34('0x40')]=qs[_0x4d34('0x41')](_[_0x4d34('0x42')](_0x38c786[_0x4d34('0x37')],_0x1111de[_0x4d34('0x41')]),_0xa8aac0);if(_0x38c786[_0x4d34('0x37')]['filter']){_0x5a6019[_0x4d34('0x40')]=_[_0x4d34('0x43')](_0x5a6019[_0x4d34('0x40')],{'$or':_['map'](_0xa8aac0,function(_0x23e15d){if(_0x23e15d[_0x4d34('0x44')]!==_0x4d34('0x45')){var _0x43c9e3={};_0x43c9e3[_0x23e15d['name']]={'$like':'%'+_0x38c786[_0x4d34('0x37')][_0x4d34('0x46')]+'%'};return _0x43c9e3;}})});}_0x5a6019=_['merge']({},_0x5a6019,_0x38c786[_0x4d34('0x47')]);var _0x3fde4f={'where':_0x5a6019[_0x4d34('0x40')]};return db['Dashboard'][_0x4d34('0x48')](_0x3fde4f)[_0x4d34('0x29')](function(_0x15aa62){_0x4c1047[_0x4d34('0x48')]=_0x15aa62;if(_0x38c786[_0x4d34('0x37')]['includeAll']){_0x5a6019[_0x4d34('0x49')]=[{'all':!![]}];}return db[_0x4d34('0x32')]['findAll'](_0x5a6019);})['then'](function(_0x14b9d4){_0x4c1047[_0x4d34('0x4a')]=_0x14b9d4;return _0x4c1047;})[_0x4d34('0x29')](respondWithFilteredResult(_0x1becc3,_0x5a6019))[_0x4d34('0x4b')](handleError(_0x1becc3,null));};exports['show']=function(_0x1c8b1b,_0x5578ba){var _0x2cbe36={'raw':![],'where':{'id':_0x1c8b1b[_0x4d34('0x4c')]['id']}},_0x2fd7b0={};_0x2fd7b0[_0x4d34('0x36')]=_[_0x4d34('0x38')](db['Dashboard']['rawAttributes']);_0x2fd7b0[_0x4d34('0x37')]=_[_0x4d34('0x38')](_0x1c8b1b[_0x4d34('0x37')]);_0x2fd7b0[_0x4d34('0x41')]=_[_0x4d34('0x39')](_0x2fd7b0[_0x4d34('0x36')],_0x2fd7b0[_0x4d34('0x37')]);_0x2cbe36[_0x4d34('0x3b')]=_[_0x4d34('0x39')](_0x2fd7b0['model'],qs[_0x4d34('0x3a')](_0x1c8b1b['query'][_0x4d34('0x3a')]));_0x2cbe36['attributes']=_0x2cbe36[_0x4d34('0x3b')][_0x4d34('0x4d')]?_0x2cbe36[_0x4d34('0x3b')]:_0x2fd7b0[_0x4d34('0x36')];if(_0x1c8b1b[_0x4d34('0x37')][_0x4d34('0x4e')]){_0x2cbe36['include']=[{'all':!![]}];}_0x2cbe36=_[_0x4d34('0x43')]({},_0x2cbe36,_0x1c8b1b[_0x4d34('0x47')]);return db[_0x4d34('0x32')][_0x4d34('0x4f')](_0x2cbe36)[_0x4d34('0x29')](handleEntityNotFound(_0x5578ba,null))[_0x4d34('0x29')](respondWithResult(_0x5578ba,null))[_0x4d34('0x4b')](handleError(_0x5578ba,null));};exports[_0x4d34('0x50')]=function(_0x3be91b,_0x19bee0){return db['Dashboard']['create'](_0x3be91b[_0x4d34('0x51')],{})[_0x4d34('0x29')](function(_0x347797){var _0x644a94=_0x3be91b[_0x4d34('0x52')][_0x4d34('0x2a')]({'plain':!![]});if(!_0x644a94)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x644a94[_0x4d34('0x53')]==='user'){var _0xf10c5f=_0x347797[_0x4d34('0x2a')]({'plain':!![]});var _0x5b06b6=_0x4d34('0x2b');return db[_0x4d34('0x54')][_0x4d34('0x4f')]({'where':{'name':_0x5b06b6,'userProfileId':_0x644a94['userProfileId']},'raw':!![]})['then'](function(_0x58da25){if(_0x58da25&&_0x58da25[_0x4d34('0x55')]===0x0){return db[_0x4d34('0x2c')]['create']({'name':_0xf10c5f[_0x4d34('0x2f')],'resourceId':_0xf10c5f['id'],'type':_0x58da25[_0x4d34('0x2f')],'sectionId':_0x58da25['id']},{})[_0x4d34('0x29')](function(){return _0x347797;});}else{return _0x347797;}})[_0x4d34('0x4b')](function(_0x5a4f61){logger[_0x4d34('0x2d')](_0x4d34('0x56'),_0x5a4f61);throw _0x5a4f61;});}return _0x347797;})[_0x4d34('0x29')](respondWithResult(_0x19bee0,0xc9))[_0x4d34('0x4b')](handleError(_0x19bee0,null));};exports['clone']=function(_0x48e9f3,_0x3bd140){var _0x443368={'where':{'id':_0x48e9f3[_0x4d34('0x4c')]['id']}},_0x6814b9={};_0x6814b9['model']=_[_0x4d34('0x38')](db['Dashboard'][_0x4d34('0x33')]);_0x443368[_0x4d34('0x3b')]=_[_0x4d34('0x39')](_0x6814b9['model'],qs[_0x4d34('0x3a')](_0x48e9f3[_0x4d34('0x37')][_0x4d34('0x3a')]));_0x443368[_0x4d34('0x3b')]=_0x443368['attributes'][_0x4d34('0x4d')]?_0x443368[_0x4d34('0x3b')]:_0x6814b9[_0x4d34('0x36')];if(_0x48e9f3['query'][_0x4d34('0x4e')]){_0x443368[_0x4d34('0x49')]=[{'all':!![]}];}_0x443368=_[_0x4d34('0x43')]({},_0x443368,_0x48e9f3[_0x4d34('0x47')]);return db['Dashboard'][_0x4d34('0x4f')](_0x443368)[_0x4d34('0x29')](handleEntityNotFound(_0x3bd140,null))[_0x4d34('0x29')](function(_0xbfe4){if(_0xbfe4){var _0x1a4b4f=_0xbfe4['get']({'plain':!![]});_0x1a4b4f=qs[_0x4d34('0x57')](_0x1a4b4f,['id',_0x4d34('0x58'),_0x4d34('0x59')]);_0x48e9f3[_0x4d34('0x51')]=_[_0x4d34('0x57')](_0x48e9f3['body'],['id',_0x4d34('0x58'),_0x4d34('0x59')]);return db[_0x4d34('0x32')]['create'](_[_0x4d34('0x43')](_0x1a4b4f,_0x48e9f3[_0x4d34('0x51')]),{'include':_0x48e9f3[_0x4d34('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x4d34('0x29')](function(_0x5922e7){var _0x328ed1=_0x48e9f3[_0x4d34('0x52')]['get']({'plain':!![]});if(!_0x328ed1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x328ed1[_0x4d34('0x53')]===_0x4d34('0x52')){var _0x1b91dd=_0x5922e7[_0x4d34('0x2a')]({'plain':!![]});var _0x59b466=_0x4d34('0x2b');return db[_0x4d34('0x54')][_0x4d34('0x4f')]({'where':{'name':_0x59b466,'userProfileId':_0x328ed1['userProfileId']},'raw':!![]})[_0x4d34('0x29')](function(_0x3ce757){if(_0x3ce757&&_0x3ce757[_0x4d34('0x55')]===0x0){return db[_0x4d34('0x2c')]['create']({'name':_0x1b91dd[_0x4d34('0x2f')],'resourceId':_0x1b91dd['id'],'type':_0x3ce757[_0x4d34('0x2f')],'sectionId':_0x3ce757['id']},{})[_0x4d34('0x29')](function(){return _0x5922e7;});}else{return _0x5922e7;}})[_0x4d34('0x4b')](function(_0x4bffc9){logger['error'](_0x4d34('0x56'),_0x4bffc9);throw _0x4bffc9;});}return _0x5922e7;});}})[_0x4d34('0x29')](respondWithResult(_0x3bd140,0xc9))[_0x4d34('0x4b')](handleError(_0x3bd140,null));};exports[_0x4d34('0x28')]=function(_0x7bfac2,_0x1d946c){if(_0x7bfac2[_0x4d34('0x51')]['id']){delete _0x7bfac2['body']['id'];}return db[_0x4d34('0x32')][_0x4d34('0x4f')]({'where':{'id':_0x7bfac2[_0x4d34('0x4c')]['id']}})[_0x4d34('0x29')](handleEntityNotFound(_0x1d946c,null))['then'](saveUpdates(_0x7bfac2[_0x4d34('0x51')],null))[_0x4d34('0x29')](respondWithResult(_0x1d946c,null))[_0x4d34('0x4b')](handleError(_0x1d946c,null));};exports[_0x4d34('0x5a')]=function(_0x54e067,_0x372d90){return db['Dashboard'][_0x4d34('0x4f')]({'where':{'id':_0x54e067['params']['id']}})[_0x4d34('0x29')](handleEntityNotFound(_0x372d90,null))[_0x4d34('0x29')](removeEntity(_0x372d90,null))[_0x4d34('0x4b')](handleError(_0x372d90,null));};function widgetAttributes(_0x5b3b43){try{switch(_0x5b3b43[_0x4d34('0x44')]){case _0x4d34('0x5b'):return[{'name':_0x4d34('0x5c'),'value':_0x5b3b43[_0x4d34('0x5c')]||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x0]?_0x5b3b43[_0x4d34('0x5d')][0x0][_0x4d34('0x5e')]:undefined)||'https://'}];case _0x4d34('0x5f'):return[{'name':_0x4d34('0x60'),'value':_0x5b3b43['attrPath']||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x0]?_0x5b3b43[_0x4d34('0x5d')][0x0][_0x4d34('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x4d34('0x61'),'value':_0x5b3b43[_0x4d34('0x61')]||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43['attrs'][0x0]?_0x5b3b43[_0x4d34('0x5d')][0x0][_0x4d34('0x5e')]:undefined)||_0x4d34('0x62')},{'name':'attrTimezone','value':_0x5b3b43[_0x4d34('0x63')]||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x1]?_0x5b3b43[_0x4d34('0x5d')][0x1][_0x4d34('0x5e')]:undefined)||_0x4d34('0x64')},{'name':_0x4d34('0x65'),'value':_0x5b3b43[_0x4d34('0x65')]||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x2]?_0x5b3b43[_0x4d34('0x5d')][0x2][_0x4d34('0x5e')]:undefined)||0xc}];case _0x4d34('0x66'):return[{'name':_0x4d34('0x67'),'value':_0x5b3b43['attrMetric']||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x0]?_0x5b3b43[_0x4d34('0x5d')][0x0][_0x4d34('0x5e')]:undefined)||'total'},{'name':_0x4d34('0x68'),'value':_0x5b3b43['attrVoiceQueues']||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x1]?_0x5b3b43['attrs'][0x1][_0x4d34('0x5e')]:undefined)||[]},{'name':_0x4d34('0x65'),'value':_0x5b3b43['attrFontSize']||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x2]?_0x5b3b43[_0x4d34('0x5d')][0x2][_0x4d34('0x5e')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x4d34('0x69'),'value':_0x5b3b43['attrSerie1']||(_0x5b3b43['attrs']&&_0x5b3b43[_0x4d34('0x5d')][0x0]?_0x5b3b43['attrs'][0x0][_0x4d34('0x5e')]:undefined)||_0x4d34('0x6a')},{'name':'attrSerie2','value':_0x5b3b43['attrSerie2']||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x1]?_0x5b3b43[_0x4d34('0x5d')][0x1][_0x4d34('0x5e')]:undefined)||null},{'name':_0x4d34('0x6b'),'value':_0x5b3b43[_0x4d34('0x6b')]||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x2]?_0x5b3b43[_0x4d34('0x5d')][0x2][_0x4d34('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5b3b43[_0x4d34('0x68')]||(_0x5b3b43['attrs']&&_0x5b3b43[_0x4d34('0x5d')][0x3]?_0x5b3b43['attrs'][0x3]['value']:undefined)||[]}];case _0x4d34('0x6c'):return[{'name':_0x4d34('0x6d'),'type':_0x5b3b43[_0x4d34('0x6e')]||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43[_0x4d34('0x5d')][0x0]?_0x5b3b43[_0x4d34('0x5d')][0x0][_0x4d34('0x44')]:undefined)||null,'value':_0x5b3b43['attrReport']||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43['attrs'][0x0]?_0x5b3b43[_0x4d34('0x5d')][0x0][_0x4d34('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x5b3b43[_0x4d34('0x6f')]||(_0x5b3b43[_0x4d34('0x5d')]&&_0x5b3b43['attrs'][0x1]?_0x5b3b43[_0x4d34('0x5d')][0x1][_0x4d34('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x298324){logger[_0x4d34('0x2d')](_0x4d34('0x70'),JSON[_0x4d34('0x71')](_0x298324));return[];}}exports[_0x4d34('0x72')]=function(_0x4fb230,_0x197024,_0x5a3416){if(_0x4fb230['body']['id']){delete _0x4fb230[_0x4d34('0x51')]['id'];}return db[_0x4d34('0x32')][_0x4d34('0x4f')]({'where':{'id':_0x4fb230[_0x4d34('0x4c')]['id']}})[_0x4d34('0x29')](handleEntityNotFound(_0x197024,null))[_0x4d34('0x29')](function(_0x4acaab){if(_0x4acaab){_0x4fb230[_0x4d34('0x51')][_0x4d34('0x73')]=_0x4acaab['id'];_0x4fb230[_0x4d34('0x51')][_0x4d34('0x5d')]=widgetAttributes(_0x4fb230[_0x4d34('0x51')]);return db[_0x4d34('0x74')][_0x4d34('0x50')](_0x4fb230[_0x4d34('0x51')]);}})[_0x4d34('0x29')](respondWithResult(_0x197024,null))[_0x4d34('0x4b')](handleError(_0x197024,null));};exports[_0x4d34('0x75')]=function(_0x637a,_0x2feb14,_0x3e02d1){var _0xa456f2={};var _0x33e930={};var _0x50e2c2;var _0x3d7d17;return db[_0x4d34('0x32')]['findOne']({'where':{'id':_0x637a[_0x4d34('0x4c')]['id']}})[_0x4d34('0x29')](handleEntityNotFound(_0x2feb14,null))[_0x4d34('0x29')](function(_0x51c012){if(_0x51c012){_0x50e2c2=_0x51c012;_0x33e930[_0x4d34('0x36')]=_[_0x4d34('0x38')](db['DashboardItem'][_0x4d34('0x33')]);_0x33e930[_0x4d34('0x37')]=_[_0x4d34('0x38')](_0x637a[_0x4d34('0x37')]);_0x33e930[_0x4d34('0x41')]=_[_0x4d34('0x39')](_0x33e930['model'],_0x33e930[_0x4d34('0x37')]);_0xa456f2[_0x4d34('0x3b')]=_[_0x4d34('0x39')](_0x33e930[_0x4d34('0x36')],qs[_0x4d34('0x3a')](_0x637a[_0x4d34('0x37')]['fields']));_0xa456f2['attributes']=_0xa456f2[_0x4d34('0x3b')]['length']?_0xa456f2[_0x4d34('0x3b')]:_0x33e930['model'];_0xa456f2[_0x4d34('0x3e')]=qs[_0x4d34('0x3f')](_0x637a[_0x4d34('0x37')][_0x4d34('0x3f')]);_0xa456f2[_0x4d34('0x40')]=qs[_0x4d34('0x41')](_[_0x4d34('0x42')](_0x637a[_0x4d34('0x37')],_0x33e930[_0x4d34('0x41')]));if(_0x637a[_0x4d34('0x37')][_0x4d34('0x46')]){_0xa456f2[_0x4d34('0x40')]=_[_0x4d34('0x43')](_0xa456f2[_0x4d34('0x40')],{'$or':_[_0x4d34('0x31')](_0xa456f2['attributes'],function(_0x1a3964){var _0x4d766d={};_0x4d766d[_0x1a3964]={'$like':'%'+_0x637a['query']['filter']+'%'};return _0x4d766d;})});}_0xa456f2=_[_0x4d34('0x43')]({},_0xa456f2,_0x637a[_0x4d34('0x47')]);return _0x50e2c2[_0x4d34('0x75')](_0xa456f2);}})[_0x4d34('0x29')](function(_0x51009d){if(_0x51009d){_0x3d7d17=_0x51009d[_0x4d34('0x4d')];if(!_0x637a[_0x4d34('0x37')]['hasOwnProperty']('nolimit')){_0xa456f2['limit']=qs[_0x4d34('0x22')](_0x637a[_0x4d34('0x37')][_0x4d34('0x22')]);_0xa456f2[_0x4d34('0x21')]=qs[_0x4d34('0x21')](_0x637a[_0x4d34('0x37')][_0x4d34('0x21')]);}return _0x50e2c2[_0x4d34('0x75')](_0xa456f2);}})[_0x4d34('0x29')](function(_0x4db0a2){if(_0x4db0a2){return _0x4db0a2?{'count':_0x3d7d17,'rows':_0x4db0a2}:null;}})[_0x4d34('0x29')](respondWithResult(_0x2feb14,null))['catch'](handleError(_0x2feb14,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 0497a23..0aba73f 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 _0x93d2=['exports','events','setMaxListeners','update','remove','emit'];(function(_0x262f42,_0x4a6ca0){var _0x2b0712=function(_0x406fb8){while(--_0x406fb8){_0x262f42['push'](_0x262f42['shift']());}};_0x2b0712(++_0x4a6ca0);}(_0x93d2,0x151));var _0x293d=function(_0x57bd1c,_0x23fdcd){_0x57bd1c=_0x57bd1c-0x0;var _0x1be449=_0x93d2[_0x57bd1c];return _0x1be449;};'use strict';var EventEmitter=require(_0x293d('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x293d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x293d('0x2'),'afterDestroy':_0x293d('0x3')};function emitEvent(_0x8e3e3e){return function(_0x592373,_0x1b7fe3,_0x47d84e){DashboardEvents['emit'](_0x8e3e3e+':'+_0x592373['id'],_0x592373);DashboardEvents[_0x293d('0x4')](_0x8e3e3e,_0x592373);_0x47d84e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x293d('0x5')]=DashboardEvents; \ No newline at end of file +var _0x426d=['Dashboard','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x47eb61,_0x2ccd1a){var _0x9ff98=function(_0x59c668){while(--_0x59c668){_0x47eb61['push'](_0x47eb61['shift']());}};_0x9ff98(++_0x2ccd1a);}(_0x426d,0x76));var _0xd426=function(_0x28eaf7,_0x65cfb7){_0x28eaf7=_0x28eaf7-0x0;var _0x3a0661=_0x426d[_0x28eaf7];return _0x3a0661;};'use strict';var EventEmitter=require(_0xd426('0x0'));var Dashboard=require(_0xd426('0x1'))['db'][_0xd426('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd426('0x3')](0x0);var events={'afterCreate':_0xd426('0x4'),'afterUpdate':_0xd426('0x5'),'afterDestroy':_0xd426('0x6')};function emitEvent(_0x26d7cd){return function(_0x4e36c6,_0x3d1a91,_0x46a7f3){DashboardEvents[_0xd426('0x7')](_0x26d7cd+':'+_0x4e36c6['id'],_0x4e36c6);DashboardEvents[_0xd426('0x7')](_0x26d7cd,_0x4e36c6);_0x46a7f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xd426('0x8')](e,emitEvent(event));}}module[_0xd426('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d4883cd..4eadd38 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 _0xe81a=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xe81a,0x93));var _0xae81=function(_0x215797,_0x49d505){_0x215797=_0x215797-0x0;var _0x4a3697=_0xe81a[_0x215797];return _0x4a3697;};'use strict';var _=require('lodash');var util=require(_0xae81('0x0'));var logger=require(_0xae81('0x1'))(_0xae81('0x2'));var moment=require(_0xae81('0x3'));var BPromise=require(_0xae81('0x4'));var rp=require(_0xae81('0x5'));var fs=require('fs');var path=require(_0xae81('0x6'));var rimraf=require(_0xae81('0x7'));var config=require(_0xae81('0x8'));var attributes=require(_0xae81('0x9'));module[_0xae81('0xa')]=function(_0x3714ca,_0x1681c3){return _0x3714ca[_0xae81('0xb')](_0xae81('0xc'),attributes,{'tableName':_0xae81('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe28=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash'];(function(_0x4efd47,_0x48ac7c){var _0x362324=function(_0x1b78eb){while(--_0x1b78eb){_0x4efd47['push'](_0x4efd47['shift']());}};_0x362324(++_0x48ac7c);}(_0xbe28,0x1d8));var _0x8be2=function(_0x44207b,_0x18c47c){_0x44207b=_0x44207b-0x0;var _0x2aea33=_0xbe28[_0x44207b];return _0x2aea33;};'use strict';var _=require(_0x8be2('0x0'));var util=require('util');var logger=require(_0x8be2('0x1'))(_0x8be2('0x2'));var moment=require('moment');var BPromise=require(_0x8be2('0x3'));var rp=require(_0x8be2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8be2('0x5'));var config=require(_0x8be2('0x6'));var attributes=require(_0x8be2('0x7'));module[_0x8be2('0x8')]=function(_0x3ee9d7,_0x2413e1){return _0x3ee9d7[_0x8be2('0x9')](_0x8be2('0xa'),attributes,{'tableName':'dashboards','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 cfce50b..6a28259 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 _0x0e22=['./dashboard.socket','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3720c0,_0x12ddce){var _0x1a44aa=function(_0x1a2f05){while(--_0x1a2f05){_0x3720c0['push'](_0x3720c0['shift']());}};_0x1a44aa(++_0x12ddce);}(_0x0e22,0x9d));var _0x20e2=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x0e22[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x20e2('0x0'));var util=require(_0x20e2('0x1'));var moment=require(_0x20e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x20e2('0x3'));var fs=require('fs');var Redis=require(_0x20e2('0x4'));var db=require(_0x20e2('0x5'))['db'];var utils=require(_0x20e2('0x6'));var logger=require(_0x20e2('0x7'))(_0x20e2('0x8'));var config=require(_0x20e2('0x9'));var jayson=require(_0x20e2('0xa'));var client=jayson[_0x20e2('0xb')][_0x20e2('0xc')]({'port':0x232a});config[_0x20e2('0xd')]=_[_0x20e2('0xe')](config[_0x20e2('0xd')],{'host':_0x20e2('0xf'),'port':0x18eb});var socket=require(_0x20e2('0x10'))(new Redis(config[_0x20e2('0xd')]));require(_0x20e2('0x11'))['register'](socket);function respondWithRpcPromise(_0x38d141,_0x1c79f7,_0x1a770a){return new BPromise(function(_0x38a83b,_0x414992){return client[_0x20e2('0x12')](_0x38d141,_0x1a770a)[_0x20e2('0x13')](function(_0x63dfed){logger[_0x20e2('0x14')]('Dashboard,\x20%s,\x20%s',_0x1c79f7,_0x20e2('0x15'));logger[_0x20e2('0x16')](_0x20e2('0x17'),_0x1c79f7,_0x20e2('0x15'),JSON[_0x20e2('0x18')](_0x63dfed));if(_0x63dfed[_0x20e2('0x19')]){if(_0x63dfed[_0x20e2('0x19')]['code']===0x1f4){logger[_0x20e2('0x19')](_0x20e2('0x1a'),_0x1c79f7,_0x63dfed[_0x20e2('0x19')][_0x20e2('0x1b')]);return _0x414992(_0x63dfed[_0x20e2('0x19')]['message']);}logger[_0x20e2('0x19')](_0x20e2('0x1a'),_0x1c79f7,_0x63dfed['error']['message']);return _0x38a83b(_0x63dfed[_0x20e2('0x19')][_0x20e2('0x1b')]);}else{logger[_0x20e2('0x14')](_0x20e2('0x1a'),_0x1c79f7,'request\x20sent');_0x38a83b(_0x63dfed[_0x20e2('0x1c')][_0x20e2('0x1b')]);}})['catch'](function(_0x300e3c){logger['error'](_0x20e2('0x1a'),_0x1c79f7,_0x300e3c);_0x414992(_0x300e3c);});});} \ No newline at end of file +var _0x4927=['request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register'];(function(_0x3b9083,_0x2d2b2e){var _0x2ac587=function(_0x173826){while(--_0x173826){_0x3b9083['push'](_0x3b9083['shift']());}};_0x2ac587(++_0x2d2b2e);}(_0x4927,0x122));var _0x7492=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4927[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var moment=require(_0x7492('0x2'));var BPromise=require(_0x7492('0x3'));var rs=require(_0x7492('0x4'));var fs=require('fs');var Redis=require(_0x7492('0x5'));var db=require(_0x7492('0x6'))['db'];var utils=require(_0x7492('0x7'));var logger=require(_0x7492('0x8'))(_0x7492('0x9'));var config=require(_0x7492('0xa'));var jayson=require(_0x7492('0xb'));var client=jayson[_0x7492('0xc')][_0x7492('0xd')]({'port':0x232a});config[_0x7492('0xe')]=_[_0x7492('0xf')](config[_0x7492('0xe')],{'host':_0x7492('0x10'),'port':0x18eb});var socket=require(_0x7492('0x11'))(new Redis(config[_0x7492('0xe')]));require(_0x7492('0x12'))[_0x7492('0x13')](socket);function respondWithRpcPromise(_0x5b7ecb,_0x1f17fe,_0x12300b){return new BPromise(function(_0x1aa9f6,_0x368033){return client[_0x7492('0x14')](_0x5b7ecb,_0x12300b)[_0x7492('0x15')](function(_0x533f59){logger[_0x7492('0x16')](_0x7492('0x17'),_0x1f17fe,'request\x20sent');logger[_0x7492('0x18')](_0x7492('0x19'),_0x1f17fe,_0x7492('0x1a'),JSON[_0x7492('0x1b')](_0x533f59));if(_0x533f59[_0x7492('0x1c')]){if(_0x533f59[_0x7492('0x1c')]['code']===0x1f4){logger[_0x7492('0x1c')](_0x7492('0x17'),_0x1f17fe,_0x533f59[_0x7492('0x1c')]['message']);return _0x368033(_0x533f59[_0x7492('0x1c')][_0x7492('0x1d')]);}logger[_0x7492('0x1c')]('Dashboard,\x20%s,\x20%s',_0x1f17fe,_0x533f59['error'][_0x7492('0x1d')]);return _0x1aa9f6(_0x533f59[_0x7492('0x1c')][_0x7492('0x1d')]);}else{logger[_0x7492('0x16')](_0x7492('0x17'),_0x1f17fe,_0x7492('0x1a'));_0x1aa9f6(_0x533f59[_0x7492('0x1e')][_0x7492('0x1d')]);}})['catch'](function(_0x3eafcf){logger[_0x7492('0x1c')](_0x7492('0x17'),_0x1f17fe,_0x3eafcf);_0x368033(_0x3eafcf);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 69dbd05..67c589d 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 _0x1df0=['register','length','dashboard:','save','remove','emit','removeListener'];(function(_0x4f225d,_0x343382){var _0x668c98=function(_0x197dcc){while(--_0x197dcc){_0x4f225d['push'](_0x4f225d['shift']());}};_0x668c98(++_0x343382);}(_0x1df0,0xff));var _0x01df=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x1df0[_0x278e3c];return _0x3e2d9b;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x01df('0x0'),_0x01df('0x1'),'update'];function createListener(_0x2cea75,_0x41457e){return function(_0x2bde56){_0x41457e[_0x01df('0x2')](_0x2cea75,_0x2bde56);};}function removeListener(_0x2f3e7e,_0x3ce13a){return function(){DashboardEvents[_0x01df('0x3')](_0x2f3e7e,_0x3ce13a);};}exports[_0x01df('0x4')]=function(_0x1a3073){for(var _0x27ac63=0x0,_0x4ff049=events[_0x01df('0x5')];_0x27ac63<_0x4ff049;_0x27ac63++){var _0x48b103=events[_0x27ac63];var _0x524b82=createListener(_0x01df('0x6')+_0x48b103,_0x1a3073);DashboardEvents['on'](_0x48b103,_0x524b82);}}; \ No newline at end of file +var _0xf2ae=['update','emit','removeListener','length','dashboard:','./dashboard.events'];(function(_0x4581e7,_0x13f481){var _0xe1f8ad=function(_0x3152b0){while(--_0x3152b0){_0x4581e7['push'](_0x4581e7['shift']());}};_0xe1f8ad(++_0x13f481);}(_0xf2ae,0x65));var _0xef2a=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xf2ae[_0x17406a];return _0x1501ff;};'use strict';var DashboardEvents=require(_0xef2a('0x0'));var events=['save','remove',_0xef2a('0x1')];function createListener(_0x1be1a2,_0x42090d){return function(_0x57c16e){_0x42090d[_0xef2a('0x2')](_0x1be1a2,_0x57c16e);};}function removeListener(_0x3ecc63,_0x1d9aea){return function(){DashboardEvents[_0xef2a('0x3')](_0x3ecc63,_0x1d9aea);};}exports['register']=function(_0x34e007){for(var _0x2e6f20=0x0,_0x49e4d2=events[_0xef2a('0x4')];_0x2e6f20<_0x49e4d2;_0x2e6f20++){var _0x307d22=events[_0x2e6f20];var _0x426818=createListener(_0xef2a('0x5')+_0x307d22,_0x34e007);DashboardEvents['on'](_0x307d22,_0x426818);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 84f8c9a..7a22f82 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 _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0xcb91[_0x21bfab];return _0x4db318;};'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('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x14109e,_0x3aec34){var _0x1b9bf1=function(_0x19fabe){while(--_0x19fabe){_0x14109e['push'](_0x14109e['shift']());}};_0x1b9bf1(++_0x3aec34);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b851323..b143943 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 _0x8d62=['stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue'];(function(_0x10edc1,_0x445617){var _0x66f1a8=function(_0x5ef233){while(--_0x5ef233){_0x10edc1['push'](_0x10edc1['shift']());}};_0x66f1a8(++_0x445617);}(_0x8d62,0x122));var _0x28d6=function(_0x5f5d46,_0x146800){_0x5f5d46=_0x5f5d46-0x0;var _0x33d8d3=_0x8d62[_0x5f5d46];return _0x33d8d3;};'use strict';var Sequelize=require(_0x28d6('0x0'));var squel=require('squel');var _=require(_0x28d6('0x1'));module[_0x28d6('0x2')]={'title':{'type':Sequelize[_0x28d6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x28d6('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x28d6('0x4')]('long'),'get':function(){try{return JSON[_0x28d6('0x5')](this[_0x28d6('0x6')](_0x28d6('0x7')));}catch(_0x6fa307){return[];}},'set':function(_0x53dcf6){try{this[_0x28d6('0x8')](_0x28d6('0x7'),JSON[_0x28d6('0x9')](_0x53dcf6));}catch(_0x1016d8){this[_0x28d6('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x28d6('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x28d6('0xa')]},'col':{'type':Sequelize[_0x28d6('0xa')]},'background':{'type':Sequelize[_0x28d6('0x3')],'allowNull':![],'defaultValue':_0x28d6('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x28d6('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x28d6('0x3')]}}; \ No newline at end of file +var _0x6491=['lodash','exports','long','attrs','setDataValue','stringify','INTEGER','STRING','#ffffff','sequelize','squel'];(function(_0x44784c,_0x4498c1){var _0x4bbfb1=function(_0x5d5ef7){while(--_0x5d5ef7){_0x44784c['push'](_0x44784c['shift']());}};_0x4bbfb1(++_0x4498c1);}(_0x6491,0x195));var _0x1649=function(_0x26b656,_0x1277be){_0x26b656=_0x26b656-0x0;var _0x16e91d=_0x6491[_0x26b656];return _0x16e91d;};'use strict';var Sequelize=require(_0x1649('0x0'));var squel=require(_0x1649('0x1'));var _=require(_0x1649('0x2'));module[_0x1649('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x1649('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1649('0x5')));}catch(_0x1dc9fc){return[];}},'set':function(_0x134e3b){try{this[_0x1649('0x6')](_0x1649('0x5'),JSON[_0x1649('0x7')](_0x134e3b));}catch(_0x53af74){this[_0x1649('0x6')](_0x1649('0x5'),JSON[_0x1649('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x1649('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x1649('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1649('0x8')]},'col':{'type':Sequelize[_0x1649('0x8')]},'background':{'type':Sequelize[_0x1649('0x9')],'allowNull':![],'defaultValue':_0x1649('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x1649('0x9')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8fecd40..c013764 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 _0x765e=['stringify','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','find','catch','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','web-report','reportType','attrReport','attrRefresh','error','widgetAttributes:\x20%s'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x765e,0xa9));var _0xe765=function(_0x53b8c2,_0x26bade){_0x53b8c2=_0x53b8c2-0x0;var _0x21113c=_0x765e[_0x53b8c2];return _0x21113c;};'use strict';var pdf=require(_0xe765('0x0'));var emlformat=require(_0xe765('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe765('0x2'));var rp=require(_0xe765('0x3'));var moment=require(_0xe765('0x4'));var BPromise=require(_0xe765('0x5'));var Mustache=require('mustache');var util=require(_0xe765('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe765('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe765('0x8'));var squel=require(_0xe765('0x9'));var crypto=require(_0xe765('0xa'));var jsforce=require(_0xe765('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe765('0x7'));var querystring=require(_0xe765('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe765('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe765('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xe765('0xf'));var config=require(_0xe765('0x10'));var licenseUtil=require(_0xe765('0x11'));var db=require(_0xe765('0x12'))['db'];config[_0xe765('0x13')]=_[_0xe765('0x14')](config[_0xe765('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xe765('0x15'))(new Redis(config[_0xe765('0x13')]));require(_0xe765('0x16'))[_0xe765('0x17')](socket);function respondWithStatusCode(_0x293640,_0x3c4d25){_0x3c4d25=_0x3c4d25||0xcc;return function(_0x4a0ad4){if(_0x4a0ad4){return _0x293640[_0xe765('0x18')](_0x3c4d25);}return _0x293640[_0xe765('0x19')](_0x3c4d25)[_0xe765('0x1a')]();};}function respondWithResult(_0x9f7ee7,_0xbe650c){_0xbe650c=_0xbe650c||0xc8;return function(_0x38e68f){if(_0x38e68f){return _0x9f7ee7['status'](_0xbe650c)[_0xe765('0x1b')](_0x38e68f);}};}function respondWithFilteredResult(_0x10b319,_0x5f593c){return function(_0x1223e3){if(_0x1223e3){var _0x34a67c=_0x1223e3[_0xe765('0x1c')],_0x5107f8=_0x5f593c[_0xe765('0x1d')],_0x4dde97=_0x5f593c[_0xe765('0x1d')]+_0x5f593c[_0xe765('0x1e')],_0x3d75b5;if(_0x4dde97>=_0x34a67c){_0x4dde97=_0x34a67c;_0x3d75b5=0xc8;}else{_0x3d75b5=0xce;}_0x10b319[_0xe765('0x19')](_0x3d75b5);return _0x10b319['set']('Content-Range',_0x5107f8+'-'+_0x4dde97+'/'+_0x34a67c)[_0xe765('0x1b')](_0x1223e3);}return null;};}function patchUpdates(_0x50c0a6){return function(_0x507dec){try{jsonpatch[_0xe765('0x1f')](_0x507dec,_0x50c0a6,!![]);}catch(_0x114bcb){return BPromise[_0xe765('0x20')](_0x114bcb);}return _0x507dec[_0xe765('0x21')]();};}function saveUpdates(_0xb0157,_0x407fa9){return function(_0x5cc7af){if(_0x5cc7af){return _0x5cc7af[_0xe765('0x22')](_0xb0157)[_0xe765('0x23')](function(_0x586a76){return _0x586a76;});}return null;};}function removeEntity(_0x4657ef,_0x39efe5){return function(_0x2de826){if(_0x2de826){return _0x2de826[_0xe765('0x24')]()[_0xe765('0x23')](function(){_0x4657ef['status'](0xcc)[_0xe765('0x1a')]();});}};}function handleEntityNotFound(_0x184917,_0x1d0968){return function(_0x2c7df8){if(!_0x2c7df8){_0x184917[_0xe765('0x18')](0x194);}return _0x2c7df8;};}function handleError(_0x2e9c9d,_0x3ec9af){_0x3ec9af=_0x3ec9af||0x1f4;return function(_0x155ab8){logger['error'](_0x155ab8[_0xe765('0x25')]);if(_0x155ab8[_0xe765('0x26')]){delete _0x155ab8['name'];}_0x2e9c9d[_0xe765('0x19')](_0x3ec9af)[_0xe765('0x27')](_0x155ab8);};}exports['show']=function(_0x36fe49,_0x3a551f){var _0x55637c={'raw':![],'where':{'id':_0x36fe49[_0xe765('0x28')]['id']}},_0x19b592={};_0x19b592[_0xe765('0x29')]=_[_0xe765('0x2a')](db[_0xe765('0x2b')][_0xe765('0x2c')]);_0x19b592[_0xe765('0x2d')]=_[_0xe765('0x2a')](_0x36fe49['query']);_0x19b592[_0xe765('0x2e')]=_[_0xe765('0x2f')](_0x19b592[_0xe765('0x29')],_0x19b592[_0xe765('0x2d')]);_0x55637c[_0xe765('0x30')]=_[_0xe765('0x2f')](_0x19b592[_0xe765('0x29')],qs[_0xe765('0x31')](_0x36fe49[_0xe765('0x2d')][_0xe765('0x31')]));_0x55637c[_0xe765('0x30')]=_0x55637c[_0xe765('0x30')][_0xe765('0x32')]?_0x55637c[_0xe765('0x30')]:_0x19b592[_0xe765('0x29')];if(_0x36fe49['query'][_0xe765('0x33')]){_0x55637c[_0xe765('0x34')]=[{'all':!![]}];}_0x55637c=_['merge']({},_0x55637c,_0x36fe49['options']);return db['DashboardItem'][_0xe765('0x35')](_0x55637c)[_0xe765('0x23')](handleEntityNotFound(_0x3a551f,null))[_0xe765('0x23')](respondWithResult(_0x3a551f,null))[_0xe765('0x36')](handleError(_0x3a551f,null));};exports['destroy']=function(_0x377703,_0x4fb424){return db[_0xe765('0x2b')]['find']({'where':{'id':_0x377703['params']['id']}})[_0xe765('0x23')](handleEntityNotFound(_0x4fb424,null))['then'](removeEntity(_0x4fb424,null))[_0xe765('0x36')](handleError(_0x4fb424,null));};function widgetAttributes(_0x379f2a){try{switch(_0x379f2a[_0xe765('0x37')]){case'iframe':return[{'name':_0xe765('0x38'),'value':_0x379f2a[_0xe765('0x38')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a['attrs'][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||'https://'}];case _0xe765('0x3b'):return[{'name':_0xe765('0x3c'),'value':_0x379f2a[_0xe765('0x3c')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||''}];case _0xe765('0x3d'):return[{'name':_0xe765('0x3e'),'value':_0x379f2a[_0xe765('0x3e')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||_0xe765('0x3f')},{'name':'attrTimezone','value':_0x379f2a[_0xe765('0x40')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a['attrs'][0x1][_0xe765('0x3a')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x379f2a[_0xe765('0x41')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a['attrs'][0x2]?_0x379f2a['attrs'][0x2][_0xe765('0x3a')]:undefined)||0xc}];case _0xe765('0x42'):return[{'name':_0xe765('0x43'),'value':_0x379f2a[_0xe765('0x43')]||(_0x379f2a['attrs']&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||'total'},{'name':_0xe765('0x44'),'value':_0x379f2a[_0xe765('0x44')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a['attrs'][0x1][_0xe765('0x3a')]:undefined)||[]},{'name':_0xe765('0x41'),'value':_0x379f2a[_0xe765('0x41')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x2]?_0x379f2a[_0xe765('0x39')][0x2][_0xe765('0x3a')]:undefined)||0x14}];case _0xe765('0x45'):case _0xe765('0x46'):return[{'name':_0xe765('0x47'),'value':_0x379f2a[_0xe765('0x47')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a['attrs'][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||_0xe765('0x48')},{'name':_0xe765('0x49'),'value':_0x379f2a[_0xe765('0x49')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a[_0xe765('0x39')][0x1][_0xe765('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x379f2a['attrSerie3']||(_0x379f2a['attrs']&&_0x379f2a[_0xe765('0x39')][0x2]?_0x379f2a[_0xe765('0x39')][0x2][_0xe765('0x3a')]:undefined)||null},{'name':_0xe765('0x44'),'value':_0x379f2a[_0xe765('0x44')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x3]?_0x379f2a['attrs'][0x3][_0xe765('0x3a')]:undefined)||[]}];case _0xe765('0x4a'):return[{'name':'attrReport','type':_0x379f2a[_0xe765('0x4b')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a['attrs'][0x0]['type']:undefined)||null,'value':_0x379f2a[_0xe765('0x4c')]||(_0x379f2a['attrs']&&_0x379f2a['attrs'][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||null},{'name':_0xe765('0x4d'),'value':_0x379f2a['attrRefresh']||(_0x379f2a['attrs']&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a['attrs'][0x1][_0xe765('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x4ceb1e){logger[_0xe765('0x4e')](_0xe765('0x4f'),JSON[_0xe765('0x50')](_0x4ceb1e));return[];}}exports[_0xe765('0x51')]=function(_0x25c024,_0x56304c){if(_0x25c024[_0xe765('0x52')]){_0x25c024['body'][_0xe765('0x39')]=widgetAttributes(_0x25c024[_0xe765('0x52')]);}return db[_0xe765('0x2b')][_0xe765('0x51')](_0x25c024[_0xe765('0x52')],{})['then'](respondWithResult(_0x56304c,0xc9))[_0xe765('0x36')](handleError(_0x56304c,null));};exports[_0xe765('0x22')]=function(_0x3ad177,_0x3764ea){if(_0x3ad177[_0xe765('0x52')]['id']){delete _0x3ad177[_0xe765('0x52')]['id'];}_0x3ad177['body'][_0xe765('0x39')]=widgetAttributes(_0x3ad177[_0xe765('0x52')]);return db[_0xe765('0x2b')][_0xe765('0x35')]({'where':{'id':_0x3ad177[_0xe765('0x28')]['id']}})[_0xe765('0x23')](handleEntityNotFound(_0x3764ea,null))[_0xe765('0x23')](saveUpdates(_0x3ad177[_0xe765('0x52')],null))[_0xe765('0x23')](respondWithResult(_0x3764ea,null))[_0xe765('0x36')](handleError(_0x3764ea,null));}; \ No newline at end of file +var _0x4081=['attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','error','stringify','body','create','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','jsforce','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','./dashboardItem.socket','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','include','merge','options','find','catch','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4081,0x66));var _0x1408=function(_0x2a32ba,_0x5dbe35){_0x2a32ba=_0x2a32ba-0x0;var _0x1ac8d6=_0x4081[_0x2a32ba];return _0x1ac8d6;};'use strict';var pdf=require(_0x1408('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1408('0x1'));var zipdir=require(_0x1408('0x2'));var jsonpatch=require(_0x1408('0x3'));var rp=require(_0x1408('0x4'));var moment=require(_0x1408('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1408('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1408('0x7'));var csv=require(_0x1408('0x8'));var ejs=require(_0x1408('0x9'));var fs=require('fs');var _=require(_0x1408('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1408('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1408('0x8'));var querystring=require('querystring');var Papa=require(_0x1408('0xc'));var Redis=require(_0x1408('0xd'));var authService=require(_0x1408('0xe'));var qs=require(_0x1408('0xf'));var as=require(_0x1408('0x10'));var hardwareService=require(_0x1408('0x11'));var logger=require(_0x1408('0x12'))(_0x1408('0x13'));var utils=require(_0x1408('0x14'));var config=require(_0x1408('0x15'));var licenseUtil=require(_0x1408('0x16'));var db=require(_0x1408('0x17'))['db'];config[_0x1408('0x18')]=_[_0x1408('0x19')](config[_0x1408('0x18')],{'host':_0x1408('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1408('0x18')]));require(_0x1408('0x1b'))['register'](socket);function respondWithStatusCode(_0x2c2969,_0x30a605){_0x30a605=_0x30a605||0xcc;return function(_0x2bbd51){if(_0x2bbd51){return _0x2c2969[_0x1408('0x1c')](_0x30a605);}return _0x2c2969['status'](_0x30a605)['end']();};}function respondWithResult(_0x1f142d,_0x565be9){_0x565be9=_0x565be9||0xc8;return function(_0x414880){if(_0x414880){return _0x1f142d['status'](_0x565be9)[_0x1408('0x1d')](_0x414880);}};}function respondWithFilteredResult(_0x569a15,_0x5d1c99){return function(_0x2d96e0){if(_0x2d96e0){var _0x1117aa=_0x2d96e0['count'],_0x97cb62=_0x5d1c99[_0x1408('0x1e')],_0x20ddca=_0x5d1c99['offset']+_0x5d1c99[_0x1408('0x1f')],_0x16dcdf;if(_0x20ddca>=_0x1117aa){_0x20ddca=_0x1117aa;_0x16dcdf=0xc8;}else{_0x16dcdf=0xce;}_0x569a15[_0x1408('0x20')](_0x16dcdf);return _0x569a15[_0x1408('0x21')](_0x1408('0x22'),_0x97cb62+'-'+_0x20ddca+'/'+_0x1117aa)['json'](_0x2d96e0);}return null;};}function patchUpdates(_0x5cc5a6){return function(_0x1f43f0){try{jsonpatch[_0x1408('0x23')](_0x1f43f0,_0x5cc5a6,!![]);}catch(_0x340fcb){return BPromise[_0x1408('0x24')](_0x340fcb);}return _0x1f43f0[_0x1408('0x25')]();};}function saveUpdates(_0x1dad38,_0x324c3b){return function(_0x2307f0){if(_0x2307f0){return _0x2307f0[_0x1408('0x26')](_0x1dad38)[_0x1408('0x27')](function(_0x4e0cf9){return _0x4e0cf9;});}return null;};}function removeEntity(_0x5ebfc1,_0x2270fa){return function(_0x467171){if(_0x467171){return _0x467171[_0x1408('0x28')]()[_0x1408('0x27')](function(){_0x5ebfc1['status'](0xcc)[_0x1408('0x29')]();});}};}function handleEntityNotFound(_0x11740c,_0x447b91){return function(_0x426d08){if(!_0x426d08){_0x11740c[_0x1408('0x1c')](0x194);}return _0x426d08;};}function handleError(_0x46beae,_0x182534){_0x182534=_0x182534||0x1f4;return function(_0x347153){logger['error'](_0x347153[_0x1408('0x2a')]);if(_0x347153[_0x1408('0x2b')]){delete _0x347153[_0x1408('0x2b')];}_0x46beae[_0x1408('0x20')](_0x182534)[_0x1408('0x2c')](_0x347153);};}exports[_0x1408('0x2d')]=function(_0x4cdd06,_0x3f4743){var _0x3b9bcd={'raw':![],'where':{'id':_0x4cdd06['params']['id']}},_0x595a04={};_0x595a04[_0x1408('0x2e')]=_[_0x1408('0x2f')](db[_0x1408('0x30')][_0x1408('0x31')]);_0x595a04[_0x1408('0x32')]=_['keys'](_0x4cdd06[_0x1408('0x32')]);_0x595a04[_0x1408('0x33')]=_['intersection'](_0x595a04[_0x1408('0x2e')],_0x595a04[_0x1408('0x32')]);_0x3b9bcd[_0x1408('0x34')]=_[_0x1408('0x35')](_0x595a04['model'],qs[_0x1408('0x36')](_0x4cdd06[_0x1408('0x32')]['fields']));_0x3b9bcd[_0x1408('0x34')]=_0x3b9bcd[_0x1408('0x34')]['length']?_0x3b9bcd[_0x1408('0x34')]:_0x595a04['model'];if(_0x4cdd06[_0x1408('0x32')]['includeAll']){_0x3b9bcd[_0x1408('0x37')]=[{'all':!![]}];}_0x3b9bcd=_[_0x1408('0x38')]({},_0x3b9bcd,_0x4cdd06[_0x1408('0x39')]);return db[_0x1408('0x30')][_0x1408('0x3a')](_0x3b9bcd)[_0x1408('0x27')](handleEntityNotFound(_0x3f4743,null))[_0x1408('0x27')](respondWithResult(_0x3f4743,null))[_0x1408('0x3b')](handleError(_0x3f4743,null));};exports[_0x1408('0x28')]=function(_0x1d6727,_0x4d6760){return db[_0x1408('0x30')][_0x1408('0x3a')]({'where':{'id':_0x1d6727['params']['id']}})[_0x1408('0x27')](handleEntityNotFound(_0x4d6760,null))[_0x1408('0x27')](removeEntity(_0x4d6760,null))[_0x1408('0x3b')](handleError(_0x4d6760,null));};function widgetAttributes(_0xf91aed){try{switch(_0xf91aed['type']){case _0x1408('0x3c'):return[{'name':_0x1408('0x3d'),'value':_0xf91aed['attrUrl']||(_0xf91aed['attrs']&&_0xf91aed[_0x1408('0x3e')][0x0]?_0xf91aed[_0x1408('0x3e')][0x0]['value']:undefined)||_0x1408('0x3f')}];case _0x1408('0x40'):return[{'name':_0x1408('0x41'),'value':_0xf91aed['attrPath']||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed['attrs'][0x0]?_0xf91aed[_0x1408('0x3e')][0x0][_0x1408('0x42')]:undefined)||''}];case _0x1408('0x43'):return[{'name':_0x1408('0x44'),'value':_0xf91aed['attrHourFormat']||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed['attrs'][0x0]?_0xf91aed['attrs'][0x0][_0x1408('0x42')]:undefined)||_0x1408('0x45')},{'name':'attrTimezone','value':_0xf91aed['attrTimezone']||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x1]?_0xf91aed[_0x1408('0x3e')][0x1][_0x1408('0x42')]:undefined)||_0x1408('0x46')},{'name':_0x1408('0x47'),'value':_0xf91aed[_0x1408('0x47')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x2]?_0xf91aed['attrs'][0x2][_0x1408('0x42')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0xf91aed[_0x1408('0x48')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x0]?_0xf91aed['attrs'][0x0][_0x1408('0x42')]:undefined)||_0x1408('0x49')},{'name':_0x1408('0x4a'),'value':_0xf91aed[_0x1408('0x4a')]||(_0xf91aed['attrs']&&_0xf91aed['attrs'][0x1]?_0xf91aed[_0x1408('0x3e')][0x1][_0x1408('0x42')]:undefined)||[]},{'name':_0x1408('0x47'),'value':_0xf91aed[_0x1408('0x47')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x2]?_0xf91aed[_0x1408('0x3e')][0x2][_0x1408('0x42')]:undefined)||0x14}];case _0x1408('0x4b'):case _0x1408('0x4c'):return[{'name':_0x1408('0x4d'),'value':_0xf91aed[_0x1408('0x4d')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed['attrs'][0x0]?_0xf91aed['attrs'][0x0][_0x1408('0x42')]:undefined)||_0x1408('0x49')},{'name':_0x1408('0x4e'),'value':_0xf91aed[_0x1408('0x4e')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x1]?_0xf91aed[_0x1408('0x3e')][0x1][_0x1408('0x42')]:undefined)||null},{'name':_0x1408('0x4f'),'value':_0xf91aed[_0x1408('0x4f')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x2]?_0xf91aed[_0x1408('0x3e')][0x2][_0x1408('0x42')]:undefined)||null},{'name':_0x1408('0x4a'),'value':_0xf91aed[_0x1408('0x4a')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x3]?_0xf91aed[_0x1408('0x3e')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x1408('0x50'),'type':_0xf91aed['reportType']||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x0]?_0xf91aed[_0x1408('0x3e')][0x0]['type']:undefined)||null,'value':_0xf91aed[_0x1408('0x50')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x0]?_0xf91aed['attrs'][0x0][_0x1408('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0xf91aed[_0x1408('0x51')]||(_0xf91aed[_0x1408('0x3e')]&&_0xf91aed[_0x1408('0x3e')][0x1]?_0xf91aed[_0x1408('0x3e')][0x1][_0x1408('0x42')]:undefined)||0x0}];default:return[];}}catch(_0xbaeaa3){logger[_0x1408('0x52')]('widgetAttributes:\x20%s',JSON[_0x1408('0x53')](_0xbaeaa3));return[];}}exports['create']=function(_0x9824f,_0x35a740){if(_0x9824f['body']){_0x9824f[_0x1408('0x54')][_0x1408('0x3e')]=widgetAttributes(_0x9824f['body']);}return db[_0x1408('0x30')][_0x1408('0x55')](_0x9824f[_0x1408('0x54')],{})[_0x1408('0x27')](respondWithResult(_0x35a740,0xc9))['catch'](handleError(_0x35a740,null));};exports[_0x1408('0x26')]=function(_0x2bc5cf,_0x4c04fc){if(_0x2bc5cf['body']['id']){delete _0x2bc5cf[_0x1408('0x54')]['id'];}_0x2bc5cf[_0x1408('0x54')][_0x1408('0x3e')]=widgetAttributes(_0x2bc5cf[_0x1408('0x54')]);return db[_0x1408('0x30')][_0x1408('0x3a')]({'where':{'id':_0x2bc5cf[_0x1408('0x56')]['id']}})[_0x1408('0x27')](handleEntityNotFound(_0x4c04fc,null))[_0x1408('0x27')](saveUpdates(_0x2bc5cf[_0x1408('0x54')],null))[_0x1408('0x27')](respondWithResult(_0x4c04fc,null))[_0x1408('0x3b')](handleError(_0x4c04fc,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4d08cc1..a8fc65b 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 _0x6bdc=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x2c807f,_0x1fc04f){_0x2c807f=_0x2c807f-0x0;var _0x3bce9a=_0x6bdc[_0x2c807f];return _0x3bce9a;};'use strict';var EventEmitter=require(_0xc6bd('0x0'));var DashboardItem=require(_0xc6bd('0x1'))['db'][_0xc6bd('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc6bd('0x3')](0x0);var events={'afterCreate':_0xc6bd('0x4'),'afterUpdate':_0xc6bd('0x5'),'afterDestroy':_0xc6bd('0x6')};function emitEvent(_0x529c4b){return function(_0x1bb923,_0xd0f13,_0x580a26){DashboardItemEvents[_0xc6bd('0x7')](_0x529c4b+':'+_0x1bb923['id'],_0x1bb923);DashboardItemEvents[_0xc6bd('0x7')](_0x529c4b,_0x1bb923);_0x580a26(null);};}for(var e in events){if(events[_0xc6bd('0x8')](e)){var event=events[e];DashboardItem[_0xc6bd('0x9')](e,emitEvent(event));}}module[_0xc6bd('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0xf849=['save','update','remove','hasOwnProperty','events','../../mysqldb','DashboardItem'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xf849,0x193));var _0x9f84=function(_0x9fb085,_0x2251a3){_0x9fb085=_0x9fb085-0x0;var _0x400c75=_0xf849[_0x9fb085];return _0x400c75;};'use strict';var EventEmitter=require(_0x9f84('0x0'));var DashboardItem=require(_0x9f84('0x1'))['db'][_0x9f84('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f84('0x3'),'afterUpdate':_0x9f84('0x4'),'afterDestroy':_0x9f84('0x5')};function emitEvent(_0x5038a2){return function(_0x542e6a,_0x5c9430,_0x2996c1){DashboardItemEvents['emit'](_0x5038a2+':'+_0x542e6a['id'],_0x542e6a);DashboardItemEvents['emit'](_0x5038a2,_0x542e6a);_0x2996c1(null);};}for(var e in events){if(events[_0x9f84('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6f47004..5c88857 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 _0x246b=['../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x5a7188,_0x2ec5ad){var _0x805ef=function(_0x2dfeba){while(--_0x2dfeba){_0x5a7188['push'](_0x5a7188['shift']());}};_0x805ef(++_0x2ec5ad);}(_0x246b,0x1d9));var _0xb246=function(_0xe7ae53,_0x15f327){_0xe7ae53=_0xe7ae53-0x0;var _0x586e51=_0x246b[_0xe7ae53];return _0x586e51;};'use strict';var _=require(_0xb246('0x0'));var util=require(_0xb246('0x1'));var logger=require(_0xb246('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb246('0x3'));var rp=require(_0xb246('0x4'));var fs=require('fs');var path=require(_0xb246('0x5'));var rimraf=require(_0xb246('0x6'));var config=require(_0xb246('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xb246('0x8')]=function(_0x288600,_0x4e5710){return _0x288600[_0xb246('0x9')](_0xb246('0xa'),attributes,{'tableName':_0xb246('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac9c=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash'];(function(_0x481f92,_0x3e0910){var _0x1b2ec4=function(_0x5033c4){while(--_0x5033c4){_0x481f92['push'](_0x481f92['shift']());}};_0x1b2ec4(++_0x3e0910);}(_0xac9c,0xb3));var _0xcac9=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xac9c[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xcac9('0x0'));var util=require(_0xcac9('0x1'));var logger=require(_0xcac9('0x2'))(_0xcac9('0x3'));var moment=require(_0xcac9('0x4'));var BPromise=require(_0xcac9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcac9('0x6'));var rimraf=require(_0xcac9('0x7'));var config=require(_0xcac9('0x8'));var attributes=require(_0xcac9('0x9'));module['exports']=function(_0x3754e3,_0x1d9f49){return _0x3754e3[_0xcac9('0xa')](_0xcac9('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index ff55bae..d74b139 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 _0x5370=['../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x56d2c3,_0x507ad0){var _0x4783d9=function(_0x5e9dc0){while(--_0x5e9dc0){_0x56d2c3['push'](_0x56d2c3['shift']());}};_0x4783d9(++_0x507ad0);}(_0x5370,0x1dd));var _0x0537=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5370[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0537('0x0'));var util=require(_0x0537('0x1'));var moment=require(_0x0537('0x2'));var BPromise=require(_0x0537('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0537('0x4'));var db=require(_0x0537('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0537('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0537('0x7'));var client=jayson[_0x0537('0x8')][_0x0537('0x9')]({'port':0x232a});config[_0x0537('0xa')]=_['defaults'](config[_0x0537('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0537('0xb'))(new Redis(config['redis']));require(_0x0537('0xc'))[_0x0537('0xd')](socket);function respondWithRpcPromise(_0x7b9b10,_0x4f2ac2,_0x3ff3df){return new BPromise(function(_0x403054,_0x1f7a03){return client[_0x0537('0xe')](_0x7b9b10,_0x3ff3df)[_0x0537('0xf')](function(_0xe1aeb2){logger[_0x0537('0x10')](_0x0537('0x11'),_0x4f2ac2,_0x0537('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4f2ac2,_0x0537('0x12'),JSON[_0x0537('0x13')](_0xe1aeb2));if(_0xe1aeb2['error']){if(_0xe1aeb2['error'][_0x0537('0x14')]===0x1f4){logger['error'](_0x0537('0x11'),_0x4f2ac2,_0xe1aeb2['error'][_0x0537('0x15')]);return _0x1f7a03(_0xe1aeb2[_0x0537('0x16')]['message']);}logger[_0x0537('0x16')]('DashboardItem,\x20%s,\x20%s',_0x4f2ac2,_0xe1aeb2[_0x0537('0x16')][_0x0537('0x15')]);return _0x403054(_0xe1aeb2[_0x0537('0x16')][_0x0537('0x15')]);}else{logger[_0x0537('0x10')]('DashboardItem,\x20%s,\x20%s',_0x4f2ac2,'request\x20sent');_0x403054(_0xe1aeb2['result'][_0x0537('0x15')]);}})['catch'](function(_0x41fb62){logger[_0x0537('0x16')](_0x0537('0x11'),_0x4f2ac2,_0x41fb62);_0x1f7a03(_0x41fb62);});});} \ No newline at end of file +var _0x1393=['request','then','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x4993d3,_0x4db691){var _0x5caa54=function(_0x111c73){while(--_0x111c73){_0x4993d3['push'](_0x4993d3['shift']());}};_0x5caa54(++_0x4db691);}(_0x1393,0x1d6));var _0x3139=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1393[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3139('0x0'));var util=require(_0x3139('0x1'));var moment=require('moment');var BPromise=require(_0x3139('0x2'));var rs=require(_0x3139('0x3'));var fs=require('fs');var Redis=require(_0x3139('0x4'));var db=require(_0x3139('0x5'))['db'];var utils=require(_0x3139('0x6'));var logger=require(_0x3139('0x7'))(_0x3139('0x8'));var config=require(_0x3139('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3139('0xa')][_0x3139('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3139('0xc')],{'host':_0x3139('0xd'),'port':0x18eb});var socket=require(_0x3139('0xe'))(new Redis(config[_0x3139('0xc')]));require('./dashboardItem.socket')[_0x3139('0xf')](socket);function respondWithRpcPromise(_0x1a6b3f,_0x10da68,_0xffe4e7){return new BPromise(function(_0x3da8e8,_0x252d8f){return client[_0x3139('0x10')](_0x1a6b3f,_0xffe4e7)[_0x3139('0x11')](function(_0x1f8bb6){logger[_0x3139('0x12')]('DashboardItem,\x20%s,\x20%s',_0x10da68,'request\x20sent');logger[_0x3139('0x13')](_0x3139('0x14'),_0x10da68,_0x3139('0x15'),JSON[_0x3139('0x16')](_0x1f8bb6));if(_0x1f8bb6[_0x3139('0x17')]){if(_0x1f8bb6[_0x3139('0x17')]['code']===0x1f4){logger['error'](_0x3139('0x18'),_0x10da68,_0x1f8bb6[_0x3139('0x17')][_0x3139('0x19')]);return _0x252d8f(_0x1f8bb6[_0x3139('0x17')][_0x3139('0x19')]);}logger[_0x3139('0x17')](_0x3139('0x18'),_0x10da68,_0x1f8bb6[_0x3139('0x17')][_0x3139('0x19')]);return _0x3da8e8(_0x1f8bb6[_0x3139('0x17')]['message']);}else{logger[_0x3139('0x12')]('DashboardItem,\x20%s,\x20%s',_0x10da68,_0x3139('0x15'));_0x3da8e8(_0x1f8bb6[_0x3139('0x1a')]['message']);}})['catch'](function(_0x28ad1a){logger[_0x3139('0x17')](_0x3139('0x18'),_0x10da68,_0x28ad1a);_0x252d8f(_0x28ad1a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b5f32b5..84b0a91 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 _0xb228=['./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x12e5db,_0x134ebd){var _0x5153ec=function(_0x34f4cf){while(--_0x34f4cf){_0x12e5db['push'](_0x12e5db['shift']());}};_0x5153ec(++_0x134ebd);}(_0xb228,0x10a));var _0x8b22=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb228[_0x13d07a];return _0x5ee0ee;};'use strict';var DashboardItemEvents=require(_0x8b22('0x0'));var events=[_0x8b22('0x1'),_0x8b22('0x2'),_0x8b22('0x3')];function createListener(_0x4f7f37,_0x47a59c){return function(_0x214cc1){_0x47a59c[_0x8b22('0x4')](_0x4f7f37,_0x214cc1);};}function removeListener(_0x537934,_0x12ffcb){return function(){DashboardItemEvents[_0x8b22('0x5')](_0x537934,_0x12ffcb);};}exports[_0x8b22('0x6')]=function(_0x523ce1){for(var _0x1696bb=0x0,_0x5265ba=events['length'];_0x1696bb<_0x5265ba;_0x1696bb++){var _0x3fca4f=events[_0x1696bb];var _0x26ddf9=createListener('dashboardItem:'+_0x3fca4f,_0x523ce1);DashboardItemEvents['on'](_0x3fca4f,_0x26ddf9);}}; \ No newline at end of file +var _0x0854=['removeListener','length','dashboardItem:','./dashboardItem.events','save','update','emit'];(function(_0x5eaaec,_0x5c79d9){var _0x1b7403=function(_0x719a42){while(--_0x719a42){_0x5eaaec['push'](_0x5eaaec['shift']());}};_0x1b7403(++_0x5c79d9);}(_0x0854,0x168));var _0x4085=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0854[_0x20a584];return _0x4b41a8;};'use strict';var DashboardItemEvents=require(_0x4085('0x0'));var events=[_0x4085('0x1'),'remove',_0x4085('0x2')];function createListener(_0x5f084c,_0xbde6d0){return function(_0x5489e7){_0xbde6d0[_0x4085('0x3')](_0x5f084c,_0x5489e7);};}function removeListener(_0x4f05ab,_0x5d2d1a){return function(){DashboardItemEvents[_0x4085('0x4')](_0x4f05ab,_0x5d2d1a);};}exports['register']=function(_0x4642ce){for(var _0x19270b=0x0,_0x359c8e=events[_0x4085('0x5')];_0x19270b<_0x359c8e;_0x19270b++){var _0x151198=events[_0x19270b];var _0x562629=createListener(_0x4085('0x6')+_0x151198,_0x4642ce);DashboardItemEvents['on'](_0x151198,_0x562629);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 107bbb8..1b7152b 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 _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x1a5407,_0x83ae11){var _0x2427f5=function(_0x45b3b6){while(--_0x45b3b6){_0x1a5407['push'](_0x1a5407['shift']());}};_0x2427f5(++_0x83ae11);}(_0x687b,0x14a));var _0xb687=function(_0x4711fc,_0x31742c){_0x4711fc=_0x4711fc-0x0;var _0x4c1eaf=_0x687b[_0x4711fc];return _0x4c1eaf;};'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')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0xc')]('/',auth[_0xb687('0xa')](),controller['create']);router[_0xb687('0xd')](_0xb687('0x9'),auth['isAuthenticated'](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0x326f=['create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post'];(function(_0x52be05,_0x2627ae){var _0x28b355=function(_0x188ecf){while(--_0x188ecf){_0x52be05['push'](_0x52be05['shift']());}};_0x28b355(++_0x2627ae);}(_0x326f,0xd1));var _0xf326=function(_0x4cfd68,_0x3f9161){_0x4cfd68=_0x4cfd68-0x0;var _0x33fbaa=_0x326f[_0x4cfd68];return _0x33fbaa;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller['show']);router[_0xf326('0xb')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf326('0xe')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);module[_0xf326('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 1da41e9..cdf42ff 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 _0xca2f=['exports','STRING','ENUM','third','first','sequelize'];(function(_0x8e4975,_0x528fe7){var _0x54f9ac=function(_0x1ea111){while(--_0x1ea111){_0x8e4975['push'](_0x8e4975['shift']());}};_0x54f9ac(++_0x528fe7);}(_0xca2f,0xe9));var _0xfca2=function(_0x2db6f4,_0x58be29){_0x2db6f4=_0x2db6f4-0x0;var _0x5bffb2=_0xca2f[_0x2db6f4];return _0x5bffb2;};'use strict';var Sequelize=require(_0xfca2('0x0'));module[_0xfca2('0x1')]={'name':{'type':Sequelize[_0xfca2('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xfca2('0x3')]('first','second',_0xfca2('0x4')),'allowNull':![],'defaultValue':_0xfca2('0x5')},'description':{'type':Sequelize[_0xfca2('0x2')]}}; \ No newline at end of file +var _0x6ce4=['third','first','STRING','ENUM'];(function(_0xb3677,_0x568634){var _0x1399d3=function(_0x40fce2){while(--_0x40fce2){_0xb3677['push'](_0xb3677['shift']());}};_0x1399d3(++_0x568634);}(_0x6ce4,0xe6));var _0x46ce=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6ce4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x46ce('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x46ce('0x1')]('first','second',_0x46ce('0x2')),'allowNull':![],'defaultValue':_0x46ce('0x3')},'description':{'type':Sequelize[_0x46ce('0x0')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 63c57ba..9abe405 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 _0xcb59=['json','apply','reject','destroy','then','get','Dispositions','UserProfileResource','end','error','name','send','index','map','Disposition','fieldName','type','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','model','rawAttributes','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','set'];(function(_0x24e8eb,_0x1a7f22){var _0x1ae3f4=function(_0x55e1e6){while(--_0x55e1e6){_0x24e8eb['push'](_0x24e8eb['shift']());}};_0x1ae3f4(++_0x1a7f22);}(_0xcb59,0xcd));var _0x9cb5=function(_0x32e08,_0x2570f8){_0x32e08=_0x32e08-0x0;var _0x58b9bb=_0xcb59[_0x32e08];return _0x58b9bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9cb5('0x0'));var rimraf=require(_0x9cb5('0x1'));var zipdir=require(_0x9cb5('0x2'));var jsonpatch=require(_0x9cb5('0x3'));var rp=require(_0x9cb5('0x4'));var moment=require(_0x9cb5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cb5('0x6'));var util=require(_0x9cb5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9cb5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cb5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9cb5('0xa'));var deskjs=require(_0x9cb5('0xb'));var toCsv=require(_0x9cb5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cb5('0xc'));var authService=require(_0x9cb5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9cb5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9cb5('0xf'));var config=require(_0x9cb5('0x10'));var licenseUtil=require(_0x9cb5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x328f5d,_0x1c4ac5){_0x1c4ac5=_0x1c4ac5||0xcc;return function(_0x306069){if(_0x306069){return _0x328f5d[_0x9cb5('0x12')](_0x1c4ac5);}return _0x328f5d['status'](_0x1c4ac5)['end']();};}function respondWithResult(_0x594161,_0x421ab0){_0x421ab0=_0x421ab0||0xc8;return function(_0x22e37b){if(_0x22e37b){return _0x594161[_0x9cb5('0x13')](_0x421ab0)['json'](_0x22e37b);}};}function respondWithFilteredResult(_0x13d056,_0x176a2b){return function(_0xdf7b34){if(_0xdf7b34){var _0x4ccd63=_0xdf7b34[_0x9cb5('0x14')],_0x4f8968=_0x176a2b[_0x9cb5('0x15')],_0x242b0e=_0x176a2b[_0x9cb5('0x15')]+_0x176a2b['limit'],_0x3d0efe;if(_0x242b0e>=_0x4ccd63){_0x242b0e=_0x4ccd63;_0x3d0efe=0xc8;}else{_0x3d0efe=0xce;}_0x13d056['status'](_0x3d0efe);return _0x13d056[_0x9cb5('0x16')]('Content-Range',_0x4f8968+'-'+_0x242b0e+'/'+_0x4ccd63)[_0x9cb5('0x17')](_0xdf7b34);}return null;};}function patchUpdates(_0x427bc1){return function(_0x5042ff){try{jsonpatch[_0x9cb5('0x18')](_0x5042ff,_0x427bc1,!![]);}catch(_0x1e3b56){return BPromise[_0x9cb5('0x19')](_0x1e3b56);}return _0x5042ff['save']();};}function saveUpdates(_0x300740,_0x223bb8){return function(_0x3d815c){if(_0x3d815c){return _0x3d815c['update'](_0x300740)['then'](function(_0x537fe9){return _0x537fe9;});}return null;};}function removeEntity(_0x4a01f5,_0x2bb25c){return function(_0x290175){if(_0x290175){return _0x290175[_0x9cb5('0x1a')]()[_0x9cb5('0x1b')](function(){var _0x512702=_0x290175[_0x9cb5('0x1c')]({'plain':!![]});var _0x218c5d=_0x9cb5('0x1d');return db[_0x9cb5('0x1e')]['destroy']({'where':{'type':_0x218c5d,'resourceId':_0x512702['id']}})['then'](function(){return _0x290175;});})[_0x9cb5('0x1b')](function(){_0x4a01f5[_0x9cb5('0x13')](0xcc)[_0x9cb5('0x1f')]();});}};}function handleEntityNotFound(_0x5b3724,_0x1488c8){return function(_0x29e916){if(!_0x29e916){_0x5b3724['sendStatus'](0x194);}return _0x29e916;};}function handleError(_0x3c3f06,_0x47c9b9){_0x47c9b9=_0x47c9b9||0x1f4;return function(_0x2ca614){logger[_0x9cb5('0x20')](_0x2ca614['stack']);if(_0x2ca614[_0x9cb5('0x21')]){delete _0x2ca614[_0x9cb5('0x21')];}_0x3c3f06['status'](_0x47c9b9)[_0x9cb5('0x22')](_0x2ca614);};}exports[_0x9cb5('0x23')]=function(_0x44f699,_0x319cb6){var _0x57ce1b={},_0x2aee83={},_0x5cb264={'count':0x0,'rows':[]};var _0x6df3de=_[_0x9cb5('0x24')](db[_0x9cb5('0x25')]['rawAttributes'],function(_0x13a4f0){return{'name':_0x13a4f0[_0x9cb5('0x26')],'type':_0x13a4f0[_0x9cb5('0x27')]['key']};});_0x2aee83['model']=_['map'](_0x6df3de,_0x9cb5('0x21'));_0x2aee83[_0x9cb5('0x28')]=_[_0x9cb5('0x29')](_0x44f699['query']);_0x2aee83[_0x9cb5('0x2a')]=_['intersection'](_0x2aee83['model'],_0x2aee83[_0x9cb5('0x28')]);_0x57ce1b[_0x9cb5('0x2b')]=_[_0x9cb5('0x2c')](_0x2aee83['model'],qs[_0x9cb5('0x2d')](_0x44f699['query']['fields']));_0x57ce1b[_0x9cb5('0x2b')]=_0x57ce1b[_0x9cb5('0x2b')][_0x9cb5('0x2e')]?_0x57ce1b[_0x9cb5('0x2b')]:_0x2aee83['model'];if(!_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x2f')](_0x9cb5('0x30'))){_0x57ce1b[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x31')]);_0x57ce1b[_0x9cb5('0x15')]=qs[_0x9cb5('0x15')](_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x15')]);}_0x57ce1b[_0x9cb5('0x32')]=qs[_0x9cb5('0x33')](_0x44f699[_0x9cb5('0x28')]['sort']);_0x57ce1b['where']=qs[_0x9cb5('0x2a')](_[_0x9cb5('0x34')](_0x44f699[_0x9cb5('0x28')],_0x2aee83[_0x9cb5('0x2a')]),_0x6df3de);if(_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x35')]){_0x57ce1b[_0x9cb5('0x36')]=_[_0x9cb5('0x37')](_0x57ce1b[_0x9cb5('0x36')],{'$or':_[_0x9cb5('0x24')](_0x6df3de,function(_0x53a052){if(_0x53a052['type']!==_0x9cb5('0x38')){var _0x2ab11a={};_0x2ab11a[_0x53a052[_0x9cb5('0x21')]]={'$like':'%'+_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x35')]+'%'};return _0x2ab11a;}})});}_0x57ce1b=_[_0x9cb5('0x37')]({},_0x57ce1b,_0x44f699[_0x9cb5('0x39')]);var _0x3d3645={'where':_0x57ce1b[_0x9cb5('0x36')]};return db[_0x9cb5('0x25')][_0x9cb5('0x14')](_0x3d3645)[_0x9cb5('0x1b')](function(_0x1d2150){_0x5cb264[_0x9cb5('0x14')]=_0x1d2150;if(_0x44f699['query'][_0x9cb5('0x3a')]){_0x57ce1b[_0x9cb5('0x3b')]=[{'all':!![]}];}return db['Disposition'][_0x9cb5('0x3c')](_0x57ce1b);})[_0x9cb5('0x1b')](function(_0xb4b3f7){_0x5cb264['rows']=_0xb4b3f7;return _0x5cb264;})[_0x9cb5('0x1b')](respondWithFilteredResult(_0x319cb6,_0x57ce1b))['catch'](handleError(_0x319cb6,null));};exports[_0x9cb5('0x3d')]=function(_0x525054,_0x237177){var _0x5aed21={'raw':!![],'where':{'id':_0x525054[_0x9cb5('0x3e')]['id']}},_0x4273e7={};_0x4273e7[_0x9cb5('0x3f')]=_['keys'](db[_0x9cb5('0x25')][_0x9cb5('0x40')]);_0x4273e7[_0x9cb5('0x28')]=_[_0x9cb5('0x29')](_0x525054[_0x9cb5('0x28')]);_0x4273e7['filters']=_[_0x9cb5('0x2c')](_0x4273e7['model'],_0x4273e7[_0x9cb5('0x28')]);_0x5aed21['attributes']=_[_0x9cb5('0x2c')](_0x4273e7[_0x9cb5('0x3f')],qs[_0x9cb5('0x2d')](_0x525054[_0x9cb5('0x28')][_0x9cb5('0x2d')]));_0x5aed21[_0x9cb5('0x2b')]=_0x5aed21[_0x9cb5('0x2b')][_0x9cb5('0x2e')]?_0x5aed21[_0x9cb5('0x2b')]:_0x4273e7['model'];if(_0x525054[_0x9cb5('0x28')][_0x9cb5('0x3a')]){_0x5aed21[_0x9cb5('0x3b')]=[{'all':!![]}];}_0x5aed21=_['merge']({},_0x5aed21,_0x525054[_0x9cb5('0x39')]);return db[_0x9cb5('0x25')][_0x9cb5('0x41')](_0x5aed21)[_0x9cb5('0x1b')](handleEntityNotFound(_0x237177,null))[_0x9cb5('0x1b')](respondWithResult(_0x237177,null))[_0x9cb5('0x42')](handleError(_0x237177,null));};exports['create']=function(_0x425338,_0x5f0bf1){return db['Disposition']['create'](_0x425338['body'],{})[_0x9cb5('0x1b')](function(_0x10352b){var _0x48ffce=_0x425338['user'][_0x9cb5('0x1c')]({'plain':!![]});if(!_0x48ffce)throw new Error(_0x9cb5('0x43'));if(_0x48ffce[_0x9cb5('0x44')]===_0x9cb5('0x45')){var _0x111f21=_0x10352b['get']({'plain':!![]});var _0x32ff10='Dispositions';return db[_0x9cb5('0x46')]['find']({'where':{'name':_0x32ff10,'userProfileId':_0x48ffce[_0x9cb5('0x47')]},'raw':!![]})[_0x9cb5('0x1b')](function(_0x4d8919){if(_0x4d8919&&_0x4d8919[_0x9cb5('0x48')]===0x0){return db[_0x9cb5('0x1e')]['create']({'name':_0x111f21[_0x9cb5('0x21')],'resourceId':_0x111f21['id'],'type':_0x4d8919[_0x9cb5('0x21')],'sectionId':_0x4d8919['id']},{})[_0x9cb5('0x1b')](function(){return _0x10352b;});}else{return _0x10352b;}})[_0x9cb5('0x42')](function(_0x213c43){logger['error'](_0x9cb5('0x49'),_0x213c43);throw _0x213c43;});}return _0x10352b;})[_0x9cb5('0x1b')](respondWithResult(_0x5f0bf1,0xc9))[_0x9cb5('0x42')](handleError(_0x5f0bf1,null));};exports[_0x9cb5('0x4a')]=function(_0x244f83,_0x783c80){if(_0x244f83[_0x9cb5('0x4b')]['id']){delete _0x244f83['body']['id'];}return db[_0x9cb5('0x25')]['find']({'where':{'id':_0x244f83[_0x9cb5('0x3e')]['id']}})[_0x9cb5('0x1b')](handleEntityNotFound(_0x783c80,null))[_0x9cb5('0x1b')](saveUpdates(_0x244f83[_0x9cb5('0x4b')],null))[_0x9cb5('0x1b')](respondWithResult(_0x783c80,null))['catch'](handleError(_0x783c80,null));};exports['destroy']=function(_0x33abf7,_0x1388bb){return db[_0x9cb5('0x25')][_0x9cb5('0x41')]({'where':{'id':_0x33abf7[_0x9cb5('0x3e')]['id']}})[_0x9cb5('0x1b')](handleEntityNotFound(_0x1388bb,null))[_0x9cb5('0x1b')](removeEntity(_0x1388bb,null))[_0x9cb5('0x42')](handleError(_0x1388bb,null));}; \ No newline at end of file +var _0x04bd=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','name','index','Disposition','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','keys','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x04bd,0xf6));var _0xd04b=function(_0x1160e0,_0x1355a4){_0x1160e0=_0x1160e0-0x0;var _0x2962ef=_0x04bd[_0x1160e0];return _0x2962ef;};'use strict';var pdf=require(_0xd04b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd04b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd04b('0x2'));var rp=require(_0xd04b('0x3'));var moment=require(_0xd04b('0x4'));var BPromise=require(_0xd04b('0x5'));var Mustache=require(_0xd04b('0x6'));var util=require(_0xd04b('0x7'));var path=require(_0xd04b('0x8'));var sox=require(_0xd04b('0x9'));var csv=require(_0xd04b('0xa'));var ejs=require(_0xd04b('0xb'));var fs=require('fs');var _=require(_0xd04b('0xc'));var squel=require(_0xd04b('0xd'));var crypto=require(_0xd04b('0xe'));var jsforce=require(_0xd04b('0xf'));var deskjs=require(_0xd04b('0x10'));var toCsv=require(_0xd04b('0xa'));var querystring=require(_0xd04b('0x11'));var Papa=require(_0xd04b('0x12'));var Redis=require('ioredis');var authService=require(_0xd04b('0x13'));var qs=require(_0xd04b('0x14'));var as=require(_0xd04b('0x15'));var hardwareService=require(_0xd04b('0x16'));var logger=require('../../config/logger')(_0xd04b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd04b('0x18'));var db=require(_0xd04b('0x19'))['db'];function respondWithStatusCode(_0x1d5e68,_0x1c5d66){_0x1c5d66=_0x1c5d66||0xcc;return function(_0x1a0204){if(_0x1a0204){return _0x1d5e68[_0xd04b('0x1a')](_0x1c5d66);}return _0x1d5e68['status'](_0x1c5d66)[_0xd04b('0x1b')]();};}function respondWithResult(_0x44e1c2,_0x11423d){_0x11423d=_0x11423d||0xc8;return function(_0x5997d2){if(_0x5997d2){return _0x44e1c2['status'](_0x11423d)['json'](_0x5997d2);}};}function respondWithFilteredResult(_0x8260c,_0x306522){return function(_0x2bebf2){if(_0x2bebf2){var _0x2ae220=_0x2bebf2[_0xd04b('0x1c')],_0x5b60b7=_0x306522[_0xd04b('0x1d')],_0x27757b=_0x306522[_0xd04b('0x1d')]+_0x306522[_0xd04b('0x1e')],_0x4b4c21;if(_0x27757b>=_0x2ae220){_0x27757b=_0x2ae220;_0x4b4c21=0xc8;}else{_0x4b4c21=0xce;}_0x8260c[_0xd04b('0x1f')](_0x4b4c21);return _0x8260c[_0xd04b('0x20')](_0xd04b('0x21'),_0x5b60b7+'-'+_0x27757b+'/'+_0x2ae220)[_0xd04b('0x22')](_0x2bebf2);}return null;};}function patchUpdates(_0x21b0c8){return function(_0x9977d4){try{jsonpatch[_0xd04b('0x23')](_0x9977d4,_0x21b0c8,!![]);}catch(_0x1fe4f6){return BPromise[_0xd04b('0x24')](_0x1fe4f6);}return _0x9977d4[_0xd04b('0x25')]();};}function saveUpdates(_0x3b6f6d,_0x5ba721){return function(_0x2baa68){if(_0x2baa68){return _0x2baa68[_0xd04b('0x26')](_0x3b6f6d)[_0xd04b('0x27')](function(_0x13d0e6){return _0x13d0e6;});}return null;};}function removeEntity(_0x3d853b,_0x3f442b){return function(_0x2d46ed){if(_0x2d46ed){return _0x2d46ed['destroy']()[_0xd04b('0x27')](function(){var _0x134b73=_0x2d46ed[_0xd04b('0x28')]({'plain':!![]});var _0x3d1b9a=_0xd04b('0x29');return db[_0xd04b('0x2a')][_0xd04b('0x2b')]({'where':{'type':_0x3d1b9a,'resourceId':_0x134b73['id']}})['then'](function(){return _0x2d46ed;});})['then'](function(){_0x3d853b[_0xd04b('0x1f')](0xcc)[_0xd04b('0x1b')]();});}};}function handleEntityNotFound(_0xa9080a,_0x4199b2){return function(_0x540387){if(!_0x540387){_0xa9080a[_0xd04b('0x1a')](0x194);}return _0x540387;};}function handleError(_0x3240b7,_0x52aca8){_0x52aca8=_0x52aca8||0x1f4;return function(_0x5804ac){logger[_0xd04b('0x2c')](_0x5804ac['stack']);if(_0x5804ac['name']){delete _0x5804ac[_0xd04b('0x2d')];}_0x3240b7[_0xd04b('0x1f')](_0x52aca8)['send'](_0x5804ac);};}exports[_0xd04b('0x2e')]=function(_0x1a8b99,_0x4ad504){var _0x2d1f1a={},_0x5c50ac={},_0x3c6992={'count':0x0,'rows':[]};var _0x57d9f1=_['map'](db[_0xd04b('0x2f')][_0xd04b('0x30')],function(_0x4115ea){return{'name':_0x4115ea[_0xd04b('0x31')],'type':_0x4115ea[_0xd04b('0x32')][_0xd04b('0x33')]};});_0x5c50ac['model']=_[_0xd04b('0x34')](_0x57d9f1,_0xd04b('0x2d'));_0x5c50ac[_0xd04b('0x35')]=_['keys'](_0x1a8b99[_0xd04b('0x35')]);_0x5c50ac[_0xd04b('0x36')]=_[_0xd04b('0x37')](_0x5c50ac['model'],_0x5c50ac[_0xd04b('0x35')]);_0x2d1f1a[_0xd04b('0x38')]=_[_0xd04b('0x37')](_0x5c50ac['model'],qs[_0xd04b('0x39')](_0x1a8b99[_0xd04b('0x35')]['fields']));_0x2d1f1a[_0xd04b('0x38')]=_0x2d1f1a['attributes'][_0xd04b('0x3a')]?_0x2d1f1a[_0xd04b('0x38')]:_0x5c50ac[_0xd04b('0x3b')];if(!_0x1a8b99[_0xd04b('0x35')][_0xd04b('0x3c')](_0xd04b('0x3d'))){_0x2d1f1a[_0xd04b('0x1e')]=qs[_0xd04b('0x1e')](_0x1a8b99[_0xd04b('0x35')][_0xd04b('0x1e')]);_0x2d1f1a[_0xd04b('0x1d')]=qs[_0xd04b('0x1d')](_0x1a8b99[_0xd04b('0x35')][_0xd04b('0x1d')]);}_0x2d1f1a[_0xd04b('0x3e')]=qs[_0xd04b('0x3f')](_0x1a8b99[_0xd04b('0x35')][_0xd04b('0x3f')]);_0x2d1f1a['where']=qs[_0xd04b('0x36')](_[_0xd04b('0x40')](_0x1a8b99[_0xd04b('0x35')],_0x5c50ac[_0xd04b('0x36')]),_0x57d9f1);if(_0x1a8b99[_0xd04b('0x35')][_0xd04b('0x41')]){_0x2d1f1a[_0xd04b('0x42')]=_[_0xd04b('0x43')](_0x2d1f1a['where'],{'$or':_[_0xd04b('0x34')](_0x57d9f1,function(_0x3aff3c){if(_0x3aff3c[_0xd04b('0x32')]!==_0xd04b('0x44')){var _0x120656={};_0x120656[_0x3aff3c['name']]={'$like':'%'+_0x1a8b99[_0xd04b('0x35')][_0xd04b('0x41')]+'%'};return _0x120656;}})});}_0x2d1f1a=_['merge']({},_0x2d1f1a,_0x1a8b99['options']);var _0x4609bc={'where':_0x2d1f1a[_0xd04b('0x42')]};return db[_0xd04b('0x2f')][_0xd04b('0x1c')](_0x4609bc)[_0xd04b('0x27')](function(_0xe5f4aa){_0x3c6992[_0xd04b('0x1c')]=_0xe5f4aa;if(_0x1a8b99['query']['includeAll']){_0x2d1f1a[_0xd04b('0x45')]=[{'all':!![]}];}return db[_0xd04b('0x2f')]['findAll'](_0x2d1f1a);})['then'](function(_0x15f62a){_0x3c6992[_0xd04b('0x46')]=_0x15f62a;return _0x3c6992;})['then'](respondWithFilteredResult(_0x4ad504,_0x2d1f1a))[_0xd04b('0x47')](handleError(_0x4ad504,null));};exports[_0xd04b('0x48')]=function(_0x55d354,_0x410424){var _0x10c4c4={'raw':!![],'where':{'id':_0x55d354[_0xd04b('0x49')]['id']}},_0x170231={};_0x170231[_0xd04b('0x3b')]=_[_0xd04b('0x4a')](db[_0xd04b('0x2f')][_0xd04b('0x30')]);_0x170231[_0xd04b('0x35')]=_['keys'](_0x55d354[_0xd04b('0x35')]);_0x170231[_0xd04b('0x36')]=_[_0xd04b('0x37')](_0x170231['model'],_0x170231['query']);_0x10c4c4[_0xd04b('0x38')]=_['intersection'](_0x170231['model'],qs[_0xd04b('0x39')](_0x55d354[_0xd04b('0x35')][_0xd04b('0x39')]));_0x10c4c4['attributes']=_0x10c4c4[_0xd04b('0x38')][_0xd04b('0x3a')]?_0x10c4c4[_0xd04b('0x38')]:_0x170231['model'];if(_0x55d354[_0xd04b('0x35')][_0xd04b('0x4b')]){_0x10c4c4['include']=[{'all':!![]}];}_0x10c4c4=_['merge']({},_0x10c4c4,_0x55d354['options']);return db[_0xd04b('0x2f')][_0xd04b('0x4c')](_0x10c4c4)[_0xd04b('0x27')](handleEntityNotFound(_0x410424,null))[_0xd04b('0x27')](respondWithResult(_0x410424,null))[_0xd04b('0x47')](handleError(_0x410424,null));};exports[_0xd04b('0x4d')]=function(_0x1f018c,_0x23d8d0){return db[_0xd04b('0x2f')][_0xd04b('0x4d')](_0x1f018c[_0xd04b('0x4e')],{})['then'](function(_0x20f7f0){var _0x3260e6=_0x1f018c[_0xd04b('0x4f')][_0xd04b('0x28')]({'plain':!![]});if(!_0x3260e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3260e6[_0xd04b('0x50')]==='user'){var _0x330a67=_0x20f7f0[_0xd04b('0x28')]({'plain':!![]});var _0x274906=_0xd04b('0x29');return db[_0xd04b('0x51')]['find']({'where':{'name':_0x274906,'userProfileId':_0x3260e6[_0xd04b('0x52')]},'raw':!![]})[_0xd04b('0x27')](function(_0x824e3c){if(_0x824e3c&&_0x824e3c[_0xd04b('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x330a67[_0xd04b('0x2d')],'resourceId':_0x330a67['id'],'type':_0x824e3c[_0xd04b('0x2d')],'sectionId':_0x824e3c['id']},{})[_0xd04b('0x27')](function(){return _0x20f7f0;});}else{return _0x20f7f0;}})[_0xd04b('0x47')](function(_0x148359){logger[_0xd04b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x148359);throw _0x148359;});}return _0x20f7f0;})[_0xd04b('0x27')](respondWithResult(_0x23d8d0,0xc9))[_0xd04b('0x47')](handleError(_0x23d8d0,null));};exports['update']=function(_0x51c462,_0x361f50){if(_0x51c462[_0xd04b('0x4e')]['id']){delete _0x51c462['body']['id'];}return db[_0xd04b('0x2f')]['find']({'where':{'id':_0x51c462[_0xd04b('0x49')]['id']}})[_0xd04b('0x27')](handleEntityNotFound(_0x361f50,null))['then'](saveUpdates(_0x51c462[_0xd04b('0x4e')],null))[_0xd04b('0x27')](respondWithResult(_0x361f50,null))[_0xd04b('0x47')](handleError(_0x361f50,null));};exports[_0xd04b('0x2b')]=function(_0x422bb2,_0x2dc390){return db[_0xd04b('0x2f')]['find']({'where':{'id':_0x422bb2['params']['id']}})['then'](handleEntityNotFound(_0x2dc390,null))[_0xd04b('0x27')](removeEntity(_0x2dc390,null))[_0xd04b('0x47')](handleError(_0x2dc390,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d6ae6f6..a22d6d0 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 _0x4745=['path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bbebe,_0x2fb445){var _0x33c0ae=function(_0x3730d7){while(--_0x3730d7){_0x3bbebe['push'](_0x3bbebe['shift']());}};_0x33c0ae(++_0x2fb445);}(_0x4745,0x1e7));var _0x5474=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x4745[_0x32d457];return _0x338386;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('Disposition',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5474('0xe'),_0x5474('0xf')]},{'unique':!![],'name':'name_chat','fields':[_0x5474('0xe'),_0x5474('0x10')]},{'unique':!![],'name':_0x5474('0x11'),'fields':[_0x5474('0xe'),_0x5474('0x12')]},{'unique':!![],'name':_0x5474('0x13'),'fields':[_0x5474('0xe'),_0x5474('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x5474('0xe'),_0x5474('0x15')]},{'unique':!![],'name':_0x5474('0x16'),'fields':[_0x5474('0xe'),_0x5474('0x17')]},{'unique':!![],'name':_0x5474('0x18'),'fields':[_0x5474('0xe'),_0x5474('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1c=['ListId','name_chat','ChatWebsiteId','name_sms','name_fax','name_openchannel','name_whatsapp','util','api','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','name_voice','name'];(function(_0xbc5b46,_0x359d75){var _0x36c09e=function(_0x38c456){while(--_0x38c456){_0xbc5b46['push'](_0xbc5b46['shift']());}};_0x36c09e(++_0x359d75);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0xbc1c[_0x3d1996];return _0x550afd;};'use strict';var _=require('lodash');var util=require(_0xcbc1('0x0'));var logger=require('../../config/logger')(_0xcbc1('0x1'));var moment=require('moment');var BPromise=require(_0xcbc1('0x2'));var rp=require(_0xcbc1('0x3'));var fs=require('fs');var path=require(_0xcbc1('0x4'));var rimraf=require(_0xcbc1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module[_0xcbc1('0x7')]=function(_0x54c13c,_0x27da8d){return _0x54c13c[_0xcbc1('0x8')](_0xcbc1('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xcbc1('0xa'),'fields':[_0xcbc1('0xb'),_0xcbc1('0xc')]},{'unique':!![],'name':_0xcbc1('0xd'),'fields':[_0xcbc1('0xb'),_0xcbc1('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0xcbc1('0xb'),'MailAccountId']},{'unique':!![],'name':_0xcbc1('0xf'),'fields':[_0xcbc1('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xcbc1('0x10'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0xcbc1('0x11'),'fields':[_0xcbc1('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0xcbc1('0x12'),'fields':[_0xcbc1('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7d77183..b45296a 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 _0x952f=['request','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x39f510,_0x51e7ad){var _0x1213db=function(_0x31b551){while(--_0x31b551){_0x39f510['push'](_0x39f510['shift']());}};_0x1213db(++_0x51e7ad);}(_0x952f,0xde));var _0xf952=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x952f[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0xf952('0x0'));var util=require(_0xf952('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf952('0x2'));var fs=require('fs');var Redis=require(_0xf952('0x3'));var db=require(_0xf952('0x4'))['db'];var utils=require(_0xf952('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf952('0x6'));var client=jayson[_0xf952('0x7')][_0xf952('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x463c0a,_0x4da60c,_0x5713eb){return new BPromise(function(_0x36d472,_0x851fca){return client[_0xf952('0x9')](_0x463c0a,_0x5713eb)['then'](function(_0x34a227){logger[_0xf952('0xa')](_0xf952('0xb'),_0x4da60c,_0xf952('0xc'));logger[_0xf952('0xd')](_0xf952('0xe'),_0x4da60c,_0xf952('0xc'),JSON[_0xf952('0xf')](_0x34a227));if(_0x34a227[_0xf952('0x10')]){if(_0x34a227['error'][_0xf952('0x11')]===0x1f4){logger[_0xf952('0x10')](_0xf952('0xb'),_0x4da60c,_0x34a227[_0xf952('0x10')][_0xf952('0x12')]);return _0x851fca(_0x34a227['error'][_0xf952('0x12')]);}logger[_0xf952('0x10')](_0xf952('0xb'),_0x4da60c,_0x34a227[_0xf952('0x10')]['message']);return _0x36d472(_0x34a227[_0xf952('0x10')][_0xf952('0x12')]);}else{logger[_0xf952('0xa')]('Disposition,\x20%s,\x20%s',_0x4da60c,_0xf952('0xc'));_0x36d472(_0x34a227[_0xf952('0x13')][_0xf952('0x12')]);}})[_0xf952('0x14')](function(_0x31991a){logger['error'](_0xf952('0xb'),_0x4da60c,_0x31991a);_0x851fca(_0x31991a);});});} \ No newline at end of file +var _0xf8b6=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0xf8b6,0x159));var _0x6f8b=function(_0xf7b66a,_0x486571){_0xf7b66a=_0xf7b66a-0x0;var _0x214032=_0xf8b6[_0xf7b66a];return _0x214032;};'use strict';var _=require(_0x6f8b('0x0'));var util=require(_0x6f8b('0x1'));var moment=require(_0x6f8b('0x2'));var BPromise=require(_0x6f8b('0x3'));var rs=require(_0x6f8b('0x4'));var fs=require('fs');var Redis=require(_0x6f8b('0x5'));var db=require(_0x6f8b('0x6'))['db'];var utils=require(_0x6f8b('0x7'));var logger=require(_0x6f8b('0x8'))(_0x6f8b('0x9'));var config=require(_0x6f8b('0xa'));var jayson=require(_0x6f8b('0xb'));var client=jayson['client'][_0x6f8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x229da6,_0x26bb8a,_0x473353){return new BPromise(function(_0x578813,_0x5ef9d9){return client[_0x6f8b('0xd')](_0x229da6,_0x473353)[_0x6f8b('0xe')](function(_0x213e42){logger['info'](_0x6f8b('0xf'),_0x26bb8a,_0x6f8b('0x10'));logger[_0x6f8b('0x11')](_0x6f8b('0x12'),_0x26bb8a,'request\x20sent',JSON[_0x6f8b('0x13')](_0x213e42));if(_0x213e42[_0x6f8b('0x14')]){if(_0x213e42['error'][_0x6f8b('0x15')]===0x1f4){logger[_0x6f8b('0x14')](_0x6f8b('0xf'),_0x26bb8a,_0x213e42['error'][_0x6f8b('0x16')]);return _0x5ef9d9(_0x213e42[_0x6f8b('0x14')][_0x6f8b('0x16')]);}logger[_0x6f8b('0x14')](_0x6f8b('0xf'),_0x26bb8a,_0x213e42[_0x6f8b('0x14')][_0x6f8b('0x16')]);return _0x578813(_0x213e42[_0x6f8b('0x14')][_0x6f8b('0x16')]);}else{logger[_0x6f8b('0x17')](_0x6f8b('0xf'),_0x26bb8a,'request\x20sent');_0x578813(_0x213e42[_0x6f8b('0x18')]['message']);}})[_0x6f8b('0x19')](function(_0x24ae76){logger[_0x6f8b('0x14')](_0x6f8b('0xf'),_0x26bb8a,_0x24ae76);_0x5ef9d9(_0x24ae76);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 976cc3e..af19738 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 _0xb2f1=['Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','exports','multer','connect-timeout','express'];(function(_0x37c13a,_0x17d2ed){var _0x512b50=function(_0xcce3e5){while(--_0xcce3e5){_0x37c13a['push'](_0x37c13a['shift']());}};_0x512b50(++_0x17d2ed);}(_0xb2f1,0x1ec));var _0x1b2f=function(_0x2cdae5,_0x4b50f6){_0x2cdae5=_0x2cdae5-0x0;var _0xeb17c4=_0xb2f1[_0x2cdae5];return _0xeb17c4;};'use strict';var multer=require(_0x1b2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b2f('0x1'));var express=require(_0x1b2f('0x2'));var router=express[_0x1b2f('0x3')]();var auth=require(_0x1b2f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1b2f('0x5'));var controller=require(_0x1b2f('0x6'));router[_0x1b2f('0x7')]('/',auth[_0x1b2f('0x8')](),controller[_0x1b2f('0x9')]);router[_0x1b2f('0x7')](_0x1b2f('0xa'),auth[_0x1b2f('0x8')](),controller[_0x1b2f('0xb')]);router[_0x1b2f('0xc')]('/',auth[_0x1b2f('0x8')](),controller[_0x1b2f('0xd')]);router['put'](_0x1b2f('0xa'),auth[_0x1b2f('0x8')](),controller['update']);router['delete'](_0x1b2f('0xa'),auth[_0x1b2f('0x8')](),controller['destroy']);module[_0x1b2f('0xe')]=router; \ No newline at end of file +var _0x393a=['show','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x393a,0x1ae));var _0xa393=function(_0x3e750b,_0x2070d9){_0x3e750b=_0x3e750b-0x0;var _0x1e2ac3=_0x393a[_0x3e750b];return _0x1e2ac3;};'use strict';var multer=require(_0xa393('0x0'));var util=require(_0xa393('0x1'));var path=require(_0xa393('0x2'));var timeout=require(_0xa393('0x3'));var express=require(_0xa393('0x4'));var router=express[_0xa393('0x5')]();var auth=require(_0xa393('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa393('0x7'));var controller=require(_0xa393('0x8'));router[_0xa393('0x9')]('/',auth[_0xa393('0xa')](),controller['index']);router[_0xa393('0x9')](_0xa393('0xb'),auth['isAuthenticated'](),controller[_0xa393('0xc')]);router['post']('/',auth[_0xa393('0xa')](),controller[_0xa393('0xd')]);router[_0xa393('0xe')](_0xa393('0xb'),auth[_0xa393('0xa')](),controller[_0xa393('0xf')]);router['delete']('/:id',auth[_0xa393('0xa')](),controller[_0xa393('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 201c709..88c89df 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 _0x5c7f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','2400','7200','9600','12000','14400','4800','ENUM','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0x5c7f,0x130));var _0xf5c7=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x5c7f[_0x32b542];return _0x554d54;};'use strict';var Sequelize=require(_0xf5c7('0x0'));module[_0xf5c7('0x1')]={'name':{'type':Sequelize[_0xf5c7('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5c7('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xf5c7('0x3'),'no'),'defaultValue':_0xf5c7('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xf5c7('0x4')},'localstationid':{'type':Sequelize[_0xf5c7('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xf5c7('0x5'),'4800',_0xf5c7('0x6'),_0xf5c7('0x7'),_0xf5c7('0x8'),_0xf5c7('0x9')),'defaultValue':_0xf5c7('0xa')},'maxrate':{'type':Sequelize[_0xf5c7('0xb')](_0xf5c7('0x5'),'4800','7200',_0xf5c7('0x7'),_0xf5c7('0x8'),'14400'),'defaultValue':_0xf5c7('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xf5c7('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf5c7('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf5c7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf5c7('0xb')]('SIP',_0xf5c7('0xe'),_0xf5c7('0xf'),_0xf5c7('0x10')),'defaultValue':_0xf5c7('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf5c7('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf5c7('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf5c7('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf5c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf5c7('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5c7('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xf5c7('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf5c7('0x15'),'set':function(_0x18fd72){if(!_0x18fd72)this[_0xf5c7('0x16')](_0xf5c7('0x17'),null);this[_0xf5c7('0x16')](_0xf5c7('0x18'),_0x18fd72);}}}; \ No newline at end of file +var _0xee63=['v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','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','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400','4800'];(function(_0x1947c7,_0x524b2c){var _0xbbca75=function(_0x2ebfd3){while(--_0x2ebfd3){_0x1947c7['push'](_0x1947c7['shift']());}};_0xbbca75(++_0x524b2c);}(_0xee63,0xc3));var _0x3ee6=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xee63[_0xd4636c];return _0x5ee17d;};'use strict';var Sequelize=require(_0x3ee6('0x0'));module[_0x3ee6('0x1')]={'name':{'type':Sequelize[_0x3ee6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3ee6('0x2')]},'ecm':{'type':Sequelize[_0x3ee6('0x3')](_0x3ee6('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x3ee6('0x2')],'defaultValue':_0x3ee6('0x5')},'localstationid':{'type':Sequelize[_0x3ee6('0x2')],'unique':_0x3ee6('0x6')},'minrate':{'type':Sequelize[_0x3ee6('0x3')](_0x3ee6('0x7'),'4800',_0x3ee6('0x8'),_0x3ee6('0x9'),_0x3ee6('0xa'),_0x3ee6('0xb')),'defaultValue':_0x3ee6('0xc')},'maxrate':{'type':Sequelize[_0x3ee6('0x3')](_0x3ee6('0x7'),'4800',_0x3ee6('0x8'),_0x3ee6('0x9'),_0x3ee6('0xa'),_0x3ee6('0xb')),'defaultValue':_0x3ee6('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x3ee6('0xd')},'gateway':{'type':Sequelize[_0x3ee6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3ee6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3ee6('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x3ee6('0xf'),_0x3ee6('0x10'),_0x3ee6('0x11')),'defaultValue':_0x3ee6('0x12')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3ee6('0x13')],'defaultValue':function(){return _0x3ee6('0x14');}},'notificationSound':{'type':Sequelize[_0x3ee6('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ee6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3ee6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3ee6('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3ee6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ee6('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x3ee6('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x3ee6('0x15')],'defaultValue':![],'comment':_0x3ee6('0x17'),'set':function(_0x2dcb38){if(!_0x2dcb38)this[_0x3ee6('0x18')](_0x3ee6('0x19'),null);this[_0x3ee6('0x18')]('mandatoryDisposition',_0x2dcb38);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a4bec9a..5e31c08 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 _0x32c0=['key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','pick','where','filter','merge','options','FaxAccount','includeAll','include','findAll','rows','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','bulkCreate','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','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','addAccountApplications','VoiceExtension','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','attachments','join','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../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','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','type'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x32c0,0x1f3));var _0x032c=function(_0x4cd2fd,_0x3ee28a){_0x4cd2fd=_0x4cd2fd-0x0;var _0x4e2318=_0x32c0[_0x4cd2fd];return _0x4e2318;};'use strict';var pdf=require(_0x032c('0x0'));var emlformat=require(_0x032c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x032c('0x2'));var jsonpatch=require(_0x032c('0x3'));var rp=require('request-promise');var moment=require(_0x032c('0x4'));var BPromise=require(_0x032c('0x5'));var Mustache=require(_0x032c('0x6'));var util=require(_0x032c('0x7'));var path=require('path');var sox=require(_0x032c('0x8'));var csv=require(_0x032c('0x9'));var ejs=require(_0x032c('0xa'));var fs=require('fs');var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var licenseUtil=require(_0x032c('0x15'));var db=require('../../mysqldb')['db'];config[_0x032c('0x16')]=_[_0x032c('0x17')](config[_0x032c('0x16')],{'host':_0x032c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x032c('0x16')]));require(_0x032c('0x19'))[_0x032c('0x1a')](socket);var jayson=require(_0x032c('0x1b'));var client=jayson[_0x032c('0x1c')][_0x032c('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x032c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x15ddb8,_0x3ebda8,_0x3f6f4d,_0x3ccbd5){return new BPromise(function(_0x46cbd2,_0x49c770){var _0x1444bb=_0x3ccbd5||client;return _0x1444bb[_0x032c('0x1e')](_0x15ddb8,_0x3f6f4d)[_0x032c('0x1f')](function(_0x433ded){logger[_0x032c('0x20')](_0x032c('0x21'),_0x3ebda8,_0x032c('0x22'));logger[_0x032c('0x23')](_0x032c('0x24'),_0x3ebda8,_0x032c('0x22'),JSON[_0x032c('0x25')](_0x433ded));if(_0x433ded[_0x032c('0x26')]){if(_0x433ded[_0x032c('0x26')]['code']===0x1f4){logger[_0x032c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x3ebda8,_0x433ded['error']['message']);return _0x49c770(_0x433ded['error'][_0x032c('0x27')]);}logger['error'](_0x032c('0x21'),_0x3ebda8,_0x433ded[_0x032c('0x26')][_0x032c('0x27')]);return _0x46cbd2(_0x433ded['error'][_0x032c('0x27')]);}else{logger[_0x032c('0x20')](_0x032c('0x21'),_0x3ebda8,_0x032c('0x22'));_0x46cbd2(_0x433ded[_0x032c('0x28')][_0x032c('0x27')]);}})[_0x032c('0x29')](function(_0x58894b){logger[_0x032c('0x26')](_0x032c('0x21'),_0x3ebda8,_0x58894b);_0x49c770(_0x58894b);});});}function respondWithStatusCode(_0x1d1cd5,_0x56d20d){_0x56d20d=_0x56d20d||0xcc;return function(_0x1350d1){if(_0x1350d1){return _0x1d1cd5[_0x032c('0x2a')](_0x56d20d);}return _0x1d1cd5[_0x032c('0x2b')](_0x56d20d)[_0x032c('0x2c')]();};}function respondWithResult(_0x58de77,_0x37a292){_0x37a292=_0x37a292||0xc8;return function(_0x7150c8){if(_0x7150c8){return _0x58de77[_0x032c('0x2b')](_0x37a292)[_0x032c('0x2d')](_0x7150c8);}};}function respondWithFilteredResult(_0x51d679,_0x119d8f){return function(_0x1de595){if(_0x1de595){var _0x5cdd90=_0x1de595[_0x032c('0x2e')],_0x659bbf=_0x119d8f['offset'],_0x306935=_0x119d8f['offset']+_0x119d8f[_0x032c('0x2f')],_0x4508ab;if(_0x306935>=_0x5cdd90){_0x306935=_0x5cdd90;_0x4508ab=0xc8;}else{_0x4508ab=0xce;}_0x51d679['status'](_0x4508ab);return _0x51d679[_0x032c('0x30')](_0x032c('0x31'),_0x659bbf+'-'+_0x306935+'/'+_0x5cdd90)['json'](_0x1de595);}return null;};}function patchUpdates(_0x3bdb1b){return function(_0x1e8993){try{jsonpatch[_0x032c('0x32')](_0x1e8993,_0x3bdb1b,!![]);}catch(_0x41a78c){return BPromise['reject'](_0x41a78c);}return _0x1e8993[_0x032c('0x33')]();};}function saveUpdates(_0x2b80b3,_0x5e46df){return function(_0x42d518){if(_0x42d518){return _0x42d518[_0x032c('0x34')](_0x2b80b3)[_0x032c('0x1f')](function(_0x420495){return _0x420495;});}return null;};}function removeEntity(_0xb5c919,_0x497a9e){return function(_0x41ca36){if(_0x41ca36){return _0x41ca36['destroy']()[_0x032c('0x1f')](function(){var _0x5aed99=_0x41ca36[_0x032c('0x35')]({'plain':!![]});var _0x1cba58=_0x032c('0x36');return db[_0x032c('0x37')][_0x032c('0x38')]({'where':{'type':_0x1cba58,'resourceId':_0x5aed99['id']}})[_0x032c('0x1f')](function(){return _0x41ca36;});})['then'](function(){_0xb5c919[_0x032c('0x2b')](0xcc)[_0x032c('0x2c')]();});}};}function handleEntityNotFound(_0x4e1aa3,_0x237089){return function(_0x33f8b0){if(!_0x33f8b0){_0x4e1aa3[_0x032c('0x2a')](0x194);}return _0x33f8b0;};}function handleError(_0x482889,_0x3a7fd3){_0x3a7fd3=_0x3a7fd3||0x1f4;return function(_0x1b62bb){logger[_0x032c('0x26')](_0x1b62bb[_0x032c('0x39')]);if(_0x1b62bb[_0x032c('0x3a')]){delete _0x1b62bb[_0x032c('0x3a')];}_0x482889[_0x032c('0x2b')](_0x3a7fd3)['send'](_0x1b62bb);};}exports[_0x032c('0x3b')]=function(_0x15fafc,_0x14174a){var _0x2858f8={'include':[{'model':db[_0x032c('0x3c')],'as':_0x032c('0x3d')}]},_0x36ca21={},_0xf27830={'count':0x0,'rows':[]};var _0x4bba77=_[_0x032c('0x3e')](db['FaxAccount'][_0x032c('0x3f')],function(_0x4e9d6a){return{'name':_0x4e9d6a['fieldName'],'type':_0x4e9d6a[_0x032c('0x40')][_0x032c('0x41')]};});_0x36ca21['model']=_['map'](_0x4bba77,_0x032c('0x3a'));_0x36ca21['query']=_['keys'](_0x15fafc[_0x032c('0x42')]);_0x36ca21[_0x032c('0x43')]=_[_0x032c('0x44')](_0x36ca21[_0x032c('0x45')],_0x36ca21[_0x032c('0x42')]);_0x2858f8[_0x032c('0x46')]=_['intersection'](_0x36ca21[_0x032c('0x45')],qs['fields'](_0x15fafc['query'][_0x032c('0x47')]));_0x2858f8[_0x032c('0x46')]=_0x2858f8[_0x032c('0x46')][_0x032c('0x48')]?_0x2858f8[_0x032c('0x46')]:_0x36ca21['model'];if(!_0x15fafc['query'][_0x032c('0x49')]('nolimit')){_0x2858f8[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x15fafc[_0x032c('0x42')][_0x032c('0x2f')]);_0x2858f8[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x15fafc[_0x032c('0x42')][_0x032c('0x4a')]);}_0x2858f8[_0x032c('0x4b')]=qs['sort'](_0x15fafc[_0x032c('0x42')]['sort']);_0x2858f8['where']=qs[_0x032c('0x43')](_[_0x032c('0x4c')](_0x15fafc[_0x032c('0x42')],_0x36ca21[_0x032c('0x43')]),_0x4bba77);if(_0x15fafc[_0x032c('0x42')]['filter']){_0x2858f8['where']=_['merge'](_0x2858f8[_0x032c('0x4d')],{'$or':_['map'](_0x4bba77,function(_0x52fa05){if(_0x52fa05[_0x032c('0x40')]!=='VIRTUAL'){var _0x33a7c9={};_0x33a7c9[_0x52fa05[_0x032c('0x3a')]]={'$like':'%'+_0x15fafc[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x33a7c9;}})});}_0x2858f8=_[_0x032c('0x4f')]({},_0x2858f8,_0x15fafc[_0x032c('0x50')]);var _0xb4e45={'where':_0x2858f8[_0x032c('0x4d')]};return db[_0x032c('0x51')]['count'](_0xb4e45)[_0x032c('0x1f')](function(_0x486383){_0xf27830[_0x032c('0x2e')]=_0x486383;if(_0x15fafc[_0x032c('0x42')][_0x032c('0x52')]){_0x2858f8[_0x032c('0x53')]=[{'all':!![]}];}return db[_0x032c('0x51')][_0x032c('0x54')](_0x2858f8);})[_0x032c('0x1f')](function(_0x110a5f){_0xf27830[_0x032c('0x55')]=_0x110a5f;return _0xf27830;})['then'](respondWithFilteredResult(_0x14174a,_0x2858f8))[_0x032c('0x29')](handleError(_0x14174a,null));};exports['show']=function(_0x13931a,_0x2f1032){var _0x4e8fd6={'raw':![],'where':{'id':_0x13931a[_0x032c('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x032c('0x3d')}]},_0x3fd7dc={};_0x3fd7dc[_0x032c('0x45')]=_[_0x032c('0x57')](db['FaxAccount'][_0x032c('0x3f')]);_0x3fd7dc[_0x032c('0x42')]=_[_0x032c('0x57')](_0x13931a[_0x032c('0x42')]);_0x3fd7dc[_0x032c('0x43')]=_[_0x032c('0x44')](_0x3fd7dc[_0x032c('0x45')],_0x3fd7dc[_0x032c('0x42')]);_0x4e8fd6[_0x032c('0x46')]=_[_0x032c('0x44')](_0x3fd7dc['model'],qs[_0x032c('0x47')](_0x13931a[_0x032c('0x42')][_0x032c('0x47')]));_0x4e8fd6[_0x032c('0x46')]=_0x4e8fd6[_0x032c('0x46')][_0x032c('0x48')]?_0x4e8fd6[_0x032c('0x46')]:_0x3fd7dc[_0x032c('0x45')];if(_0x13931a['query'][_0x032c('0x52')]){_0x4e8fd6[_0x032c('0x53')]=[{'all':!![]}];}_0x4e8fd6=_[_0x032c('0x4f')]({},_0x4e8fd6,_0x13931a[_0x032c('0x50')]);return db[_0x032c('0x51')]['find'](_0x4e8fd6)[_0x032c('0x1f')](handleEntityNotFound(_0x2f1032,null))[_0x032c('0x1f')](respondWithResult(_0x2f1032,null))[_0x032c('0x29')](handleError(_0x2f1032,null));};exports[_0x032c('0x58')]=function(_0x41312a,_0xf2e968){return db[_0x032c('0x51')][_0x032c('0x58')](_0x41312a[_0x032c('0x59')],{})[_0x032c('0x1f')](function(_0x3fe8c6){var _0x56ef3f=_0x41312a['user'][_0x032c('0x35')]({'plain':!![]});if(!_0x56ef3f)throw new Error(_0x032c('0x5a'));if(_0x56ef3f[_0x032c('0x5b')]===_0x032c('0x5c')){var _0x5bd5c5=_0x3fe8c6[_0x032c('0x35')]({'plain':!![]});var _0x361838=_0x032c('0x36');return db[_0x032c('0x5d')][_0x032c('0x5e')]({'where':{'name':_0x361838,'userProfileId':_0x56ef3f[_0x032c('0x5f')]},'raw':!![]})[_0x032c('0x1f')](function(_0x2b6a1e){if(_0x2b6a1e&&_0x2b6a1e[_0x032c('0x60')]===0x0){return db['UserProfileResource'][_0x032c('0x58')]({'name':_0x5bd5c5[_0x032c('0x3a')],'resourceId':_0x5bd5c5['id'],'type':_0x2b6a1e[_0x032c('0x3a')],'sectionId':_0x2b6a1e['id']},{})[_0x032c('0x1f')](function(){return _0x3fe8c6;});}else{return _0x3fe8c6;}})['catch'](function(_0xdeb7a4){logger[_0x032c('0x26')](_0x032c('0x61'),_0xdeb7a4);throw _0xdeb7a4;});}return _0x3fe8c6;})[_0x032c('0x1f')](respondWithResult(_0xf2e968,0xc9))[_0x032c('0x29')](handleError(_0xf2e968,null));};exports['update']=function(_0x190fdc,_0xd0d761){if(_0x190fdc[_0x032c('0x59')]['id']){delete _0x190fdc[_0x032c('0x59')]['id'];}return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x190fdc[_0x032c('0x56')]['id']},'include':[{'model':db[_0x032c('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xd0d761,null))[_0x032c('0x1f')](saveUpdates(_0x190fdc['body'],null))[_0x032c('0x1f')](respondWithResult(_0xd0d761,null))['catch'](handleError(_0xd0d761,null));};exports[_0x032c('0x38')]=function(_0x364882,_0x3b78db){return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x364882['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x3b78db,null))[_0x032c('0x1f')](removeEntity(_0x3b78db,null))['catch'](handleError(_0x3b78db,null));};exports[_0x032c('0x62')]=function(_0x32efea,_0x224249){return db['FaxAccount'][_0x032c('0x62')]()[_0x032c('0x1f')](respondWithResult(_0x224249,null))['catch'](handleError(_0x224249,null));};exports[_0x032c('0x63')]=function(_0x1915ed,_0x160100,_0x469ab7){if(_0x1915ed[_0x032c('0x59')]['id']){delete _0x1915ed[_0x032c('0x59')]['id'];}return db['FaxAccount'][_0x032c('0x5e')]({'where':{'id':_0x1915ed[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x160100,null))[_0x032c('0x1f')](function(_0x1b4594){if(_0x1b4594){_0x1915ed[_0x032c('0x59')][_0x032c('0x64')]=_0x1b4594['id'];return db[_0x032c('0x65')][_0x032c('0x58')](_0x1915ed['body']);}})[_0x032c('0x1f')](respondWithResult(_0x160100,null))[_0x032c('0x29')](handleError(_0x160100,null));};exports[_0x032c('0x66')]=function(_0x38cbed,_0x2f8b61,_0x1811a2){var _0x1a2cd5={'raw':![],'where':{}};var _0x40ba8f={};var _0x40c464={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x38cbed[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x2f8b61,null))[_0x032c('0x1f')](function(_0x20a67c){if(_0x20a67c){_0x40ba8f[_0x032c('0x45')]=_[_0x032c('0x57')](db[_0x032c('0x65')][_0x032c('0x3f')]);_0x40ba8f['query']=_['keys'](_0x38cbed['query']);_0x40ba8f[_0x032c('0x43')]=_['intersection'](_0x40ba8f[_0x032c('0x45')],_0x40ba8f[_0x032c('0x42')]);_0x1a2cd5[_0x032c('0x46')]=_['intersection'](_0x40ba8f[_0x032c('0x45')],qs[_0x032c('0x47')](_0x38cbed[_0x032c('0x42')][_0x032c('0x47')]));_0x1a2cd5[_0x032c('0x46')]=_0x1a2cd5[_0x032c('0x46')][_0x032c('0x48')]?_0x1a2cd5[_0x032c('0x46')]:_0x40ba8f['model'];if(!_0x38cbed[_0x032c('0x42')]['hasOwnProperty'](_0x032c('0x68'))){_0x1a2cd5[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x38cbed[_0x032c('0x42')][_0x032c('0x2f')]);_0x1a2cd5[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x38cbed['query']['offset']);}_0x1a2cd5[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x38cbed['query'][_0x032c('0x69')]);_0x1a2cd5[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x38cbed[_0x032c('0x42')],_0x40ba8f['filters']));_0x1a2cd5['where'][_0x032c('0x64')]=_0x20a67c['id'];if(_0x38cbed[_0x032c('0x42')][_0x032c('0x4e')]){_0x1a2cd5['where']=_['merge'](_0x1a2cd5['where'],{'$or':_['map'](_0x1a2cd5['attributes'],function(_0x313cd7){var _0x55dbe7={};_0x55dbe7[_0x313cd7]={'$like':'%'+_0x38cbed[_0x032c('0x42')]['filter']+'%'};return _0x55dbe7;})});}_0x1a2cd5=_[_0x032c('0x4f')]({},_0x1a2cd5,_0x38cbed[_0x032c('0x50')]);return db['Disposition']['count']({'where':_0x1a2cd5[_0x032c('0x4d')]})[_0x032c('0x1f')](function(_0x1d61d5){_0x40c464[_0x032c('0x2e')]=_0x1d61d5;if(_0x38cbed['query'][_0x032c('0x52')]){_0x1a2cd5[_0x032c('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x032c('0x54')](_0x1a2cd5);})[_0x032c('0x1f')](function(_0x2b4788){_0x40c464[_0x032c('0x55')]=_0x2b4788;return _0x40c464;});}})[_0x032c('0x1f')](respondWithFilteredResult(_0x2f8b61,_0x1a2cd5))[_0x032c('0x29')](handleError(_0x2f8b61,null));};exports[_0x032c('0x6a')]=function(_0x142ee9,_0x423db7,_0x2577b7){return db[_0x032c('0x51')]['find']({'where':{'id':_0x142ee9[_0x032c('0x56')]['id']}})['then'](handleEntityNotFound(_0x423db7,null))[_0x032c('0x1f')](function(_0x2c81c2){if(_0x2c81c2){return _0x2c81c2[_0x032c('0x6a')](_0x142ee9['query'][_0x032c('0x6b')]);}})['then'](respondWithStatusCode(_0x423db7,null))['catch'](handleError(_0x423db7,null));};exports[_0x032c('0x6c')]=function(_0x396b17,_0x30bf45,_0x3431a1){if(_0x396b17[_0x032c('0x59')]['id']){delete _0x396b17[_0x032c('0x59')]['id'];}return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x396b17['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x30bf45,null))[_0x032c('0x1f')](function(_0x39f680){if(_0x39f680){_0x396b17[_0x032c('0x59')]['FaxAccountId']=_0x39f680['id'];return db[_0x032c('0x6d')][_0x032c('0x58')](_0x396b17[_0x032c('0x59')]);}})[_0x032c('0x1f')](respondWithResult(_0x30bf45,null))[_0x032c('0x29')](handleError(_0x30bf45,null));};exports[_0x032c('0x6e')]=function(_0x3805a4,_0x4dbe01,_0x3a1b0a){var _0x1e15b6={'raw':![],'where':{}};var _0x13fc01={};var _0x29b122={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x3805a4[_0x032c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4dbe01,null))[_0x032c('0x1f')](function(_0xcef421){if(_0xcef421){_0x13fc01[_0x032c('0x45')]=_[_0x032c('0x57')](db[_0x032c('0x6d')]['rawAttributes']);_0x13fc01[_0x032c('0x42')]=_[_0x032c('0x57')](_0x3805a4['query']);_0x13fc01[_0x032c('0x43')]=_['intersection'](_0x13fc01['model'],_0x13fc01[_0x032c('0x42')]);_0x1e15b6['attributes']=_['intersection'](_0x13fc01[_0x032c('0x45')],qs[_0x032c('0x47')](_0x3805a4['query'][_0x032c('0x47')]));_0x1e15b6[_0x032c('0x46')]=_0x1e15b6[_0x032c('0x46')][_0x032c('0x48')]?_0x1e15b6['attributes']:_0x13fc01[_0x032c('0x45')];if(!_0x3805a4[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x1e15b6[_0x032c('0x2f')]=qs['limit'](_0x3805a4[_0x032c('0x42')]['limit']);_0x1e15b6['offset']=qs[_0x032c('0x4a')](_0x3805a4[_0x032c('0x42')][_0x032c('0x4a')]);}_0x1e15b6['order']=qs[_0x032c('0x69')](_0x3805a4[_0x032c('0x42')][_0x032c('0x69')]);_0x1e15b6[_0x032c('0x4d')]=qs[_0x032c('0x43')](_[_0x032c('0x4c')](_0x3805a4[_0x032c('0x42')],_0x13fc01[_0x032c('0x43')]));_0x1e15b6[_0x032c('0x4d')]['FaxAccountId']=_0xcef421['id'];if(_0x3805a4[_0x032c('0x42')][_0x032c('0x4e')]){_0x1e15b6[_0x032c('0x4d')]=_[_0x032c('0x4f')](_0x1e15b6[_0x032c('0x4d')],{'$or':_[_0x032c('0x3e')](_0x1e15b6[_0x032c('0x46')],function(_0x24ba71){var _0x4da382={};_0x4da382[_0x24ba71]={'$like':'%'+_0x3805a4[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x4da382;})});}_0x1e15b6=_[_0x032c('0x4f')]({},_0x1e15b6,_0x3805a4['options']);return db[_0x032c('0x6d')][_0x032c('0x2e')]({'where':_0x1e15b6[_0x032c('0x4d')]})['then'](function(_0x4347ba){_0x29b122[_0x032c('0x2e')]=_0x4347ba;if(_0x3805a4['query']['includeAll']){_0x1e15b6[_0x032c('0x53')]=[{'all':!![]}];}return db[_0x032c('0x6d')][_0x032c('0x54')](_0x1e15b6);})[_0x032c('0x1f')](function(_0x1391b9){_0x29b122[_0x032c('0x55')]=_0x1391b9;return _0x29b122;});}})[_0x032c('0x1f')](respondWithFilteredResult(_0x4dbe01,_0x1e15b6))['catch'](handleError(_0x4dbe01,null));};exports[_0x032c('0x6f')]=function(_0x58dc88,_0x59d8b7,_0x55c4ce){return db['FaxAccount']['find']({'where':{'id':_0x58dc88[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x59d8b7,null))[_0x032c('0x1f')](function(_0x3e81fb){if(_0x3e81fb){return _0x3e81fb[_0x032c('0x6f')](_0x58dc88[_0x032c('0x42')][_0x032c('0x6b')]);}})[_0x032c('0x1f')](respondWithStatusCode(_0x59d8b7,null))['catch'](handleError(_0x59d8b7,null));};exports[_0x032c('0x70')]=function(_0x259458,_0x564804,_0x510eca){return db['FaxInteraction']['find']({'where':{'id':_0x259458['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x564804,null))[_0x032c('0x1f')](function(_0x161ec4){if(_0x161ec4){return _0x161ec4[_0x032c('0x70')](_0x259458[_0x032c('0x59')][_0x032c('0x6b')],_['omit'](_0x259458[_0x032c('0x59')],['ids','id'])||{});}})[_0x032c('0x1f')](respondWithResult(_0x564804,null))[_0x032c('0x29')](handleError(_0x564804,null));};exports[_0x032c('0x71')]=function(_0x3cbaf7,_0x408db5,_0x325884){var _0x370a6e={'raw':![],'where':{}};var _0x59483f={};var _0x4f8bc9={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x3cbaf7['params']['id']}})['then'](handleEntityNotFound(_0x408db5,null))['then'](function(_0x31d301){if(_0x31d301){_0x59483f[_0x032c('0x45')]=_[_0x032c('0x57')](db[_0x032c('0x72')][_0x032c('0x3f')]);_0x59483f[_0x032c('0x42')]=_['keys'](_0x3cbaf7[_0x032c('0x42')]);_0x59483f[_0x032c('0x43')]=_[_0x032c('0x44')](_0x59483f[_0x032c('0x45')],_0x59483f[_0x032c('0x42')]);_0x370a6e[_0x032c('0x46')]=_['intersection'](_0x59483f[_0x032c('0x45')],qs[_0x032c('0x47')](_0x3cbaf7[_0x032c('0x42')][_0x032c('0x47')]));_0x370a6e[_0x032c('0x46')]=_0x370a6e[_0x032c('0x46')]['length']?_0x370a6e[_0x032c('0x46')]:_0x59483f['model'];if(!_0x3cbaf7[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x370a6e[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x3cbaf7[_0x032c('0x42')][_0x032c('0x2f')]);_0x370a6e[_0x032c('0x4a')]=qs['offset'](_0x3cbaf7[_0x032c('0x42')][_0x032c('0x4a')]);}_0x370a6e[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x3cbaf7[_0x032c('0x42')]['sort']);_0x370a6e[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x3cbaf7[_0x032c('0x42')],_0x59483f[_0x032c('0x43')]));_0x370a6e['where'][_0x032c('0x64')]=_0x31d301['id'];if(_0x3cbaf7[_0x032c('0x42')]['filter']){_0x370a6e[_0x032c('0x4d')]=_['merge'](_0x370a6e[_0x032c('0x4d')],{'$or':_[_0x032c('0x3e')](_0x370a6e['attributes'],function(_0x326ee8){var _0x477706={};_0x477706[_0x326ee8]={'$like':'%'+_0x3cbaf7[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x477706;})});}_0x370a6e=_[_0x032c('0x4f')]({},_0x370a6e,_0x3cbaf7[_0x032c('0x50')]);return db[_0x032c('0x72')][_0x032c('0x2e')]({'where':_0x370a6e[_0x032c('0x4d')]})[_0x032c('0x1f')](function(_0x4d64af){_0x4f8bc9[_0x032c('0x2e')]=_0x4d64af;if(_0x3cbaf7[_0x032c('0x42')][_0x032c('0x52')]){_0x370a6e[_0x032c('0x53')]=[{'model':db[_0x032c('0x73')],'as':_0x032c('0x74'),'required':![]},{'model':db[_0x032c('0x75')],'as':_0x032c('0x76'),'attributes':[_0x032c('0x3a'),_0x032c('0x77'),_0x032c('0x78')],'required':![]},{'model':db[_0x032c('0x79')],'as':_0x032c('0x7a'),'attributes':['id',_0x032c('0x3a'),_0x032c('0x7b')],'where':_0x3cbaf7[_0x032c('0x42')][_0x032c('0x7c')]?{'id':_0x3cbaf7[_0x032c('0x42')]['tag']}:undefined,'required':_0x3cbaf7[_0x032c('0x42')][_0x032c('0x7c')]?!![]:![]}];}return db[_0x032c('0x72')][_0x032c('0x54')](_0x370a6e);})['then'](function(_0x11e935){_0x4f8bc9[_0x032c('0x55')]=_0x11e935;return _0x4f8bc9;});}})[_0x032c('0x1f')](respondWithFilteredResult(_0x408db5,_0x370a6e))[_0x032c('0x29')](handleError(_0x408db5,null));};exports[_0x032c('0x7d')]=function(_0x50c242,_0xe78ab5,_0x2eec00){return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x50c242[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0xe78ab5,null))[_0x032c('0x1f')](function(_0x17216c){if(_0x17216c){return db[_0x032c('0x7e')][_0x032c('0x7f')](function(_0x430ee9){return db['FaxApplication'][_0x032c('0x38')]({'where':{'FaxAccountId':_0x50c242[_0x032c('0x56')]['id']},'transaction':_0x430ee9})[_0x032c('0x1f')](function(_0x666c53){var _0x5e43d4=_[_0x032c('0x3e')](_0x50c242[_0x032c('0x59')],function(_0x1ac57a){_0x1ac57a[_0x032c('0x64')]=_0x50c242[_0x032c('0x56')]['id'];return _0x1ac57a;});return db['FaxApplication'][_0x032c('0x80')](_0x5e43d4,{'transaction':_0x430ee9});});})[_0x032c('0x1f')](function(){return db[_0x032c('0x81')][_0x032c('0x82')]({'where':{'FaxAccountId':_0x50c242[_0x032c('0x56')]['id']},'order':_0x032c('0x83')});});}})['then'](respondWithResult(_0xe78ab5,null))[_0x032c('0x29')](handleError(_0xe78ab5,null));};exports[_0x032c('0x84')]=function(_0x33480e,_0x2e0b3d,_0x58fe5d){var _0x45d8ba={};var _0x38e22d={};var _0x5cc469;var _0x373154;return db['FaxAccount'][_0x032c('0x67')]({'where':{'id':_0x33480e[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x2e0b3d,null))[_0x032c('0x1f')](function(_0x430bc5){if(_0x430bc5){_0x5cc469=_0x430bc5;_0x38e22d[_0x032c('0x45')]=_['keys'](db[_0x032c('0x81')][_0x032c('0x3f')]);_0x38e22d[_0x032c('0x42')]=_['keys'](_0x33480e[_0x032c('0x42')]);_0x38e22d[_0x032c('0x43')]=_[_0x032c('0x44')](_0x38e22d['model'],_0x38e22d[_0x032c('0x42')]);_0x45d8ba[_0x032c('0x46')]=_[_0x032c('0x44')](_0x38e22d[_0x032c('0x45')],qs[_0x032c('0x47')](_0x33480e[_0x032c('0x42')][_0x032c('0x47')]));_0x45d8ba['attributes']=_0x45d8ba[_0x032c('0x46')]['length']?_0x45d8ba[_0x032c('0x46')]:_0x38e22d[_0x032c('0x45')];_0x45d8ba[_0x032c('0x4b')]=qs['sort'](_0x33480e[_0x032c('0x42')][_0x032c('0x69')]);_0x45d8ba[_0x032c('0x4d')]=qs[_0x032c('0x43')](_[_0x032c('0x4c')](_0x33480e[_0x032c('0x42')],_0x38e22d['filters']));if(_0x33480e[_0x032c('0x42')][_0x032c('0x4e')]){_0x45d8ba['where']=_[_0x032c('0x4f')](_0x45d8ba['where'],{'$or':_['map'](_0x45d8ba['attributes'],function(_0x5349e5){var _0x5eff1c={};_0x5eff1c[_0x5349e5]={'$like':'%'+_0x33480e[_0x032c('0x42')]['filter']+'%'};return _0x5eff1c;})});}_0x45d8ba=_[_0x032c('0x4f')]({},_0x45d8ba,_0x33480e[_0x032c('0x50')]);return _0x5cc469['getApplications'](_0x45d8ba);}})['then'](function(_0x1a89a9){if(_0x1a89a9){_0x373154=_0x1a89a9[_0x032c('0x48')];if(!_0x33480e[_0x032c('0x42')]['hasOwnProperty'](_0x032c('0x68'))){_0x45d8ba[_0x032c('0x2f')]=qs['limit'](_0x33480e[_0x032c('0x42')][_0x032c('0x2f')]);_0x45d8ba[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x33480e[_0x032c('0x42')]['offset']);}return _0x5cc469[_0x032c('0x84')](_0x45d8ba);}})['then'](function(_0x79d37b){if(_0x79d37b){return _0x79d37b?{'count':_0x373154,'rows':_0x79d37b}:null;}})[_0x032c('0x1f')](respondWithResult(_0x2e0b3d,null))['catch'](handleError(_0x2e0b3d,null));};function Extension(_0x35cb9d,_0x134058,_0xc51767,_0x3e96a4){this[_0x032c('0x85')]=_0x032c('0x86');this[_0x032c('0x87')]=_0x35cb9d['localstationid'];this[_0x032c('0x88')]=_0x3e96a4;this[_0x032c('0x40')]=_0x032c('0x89');this[_0x032c('0x8a')]=_0x032c('0x8b');this['FaxAccountId']=_0x35cb9d['id'];this[_0x032c('0x83')]=_0x134058;this[_0x032c('0x8c')]=_0xc51767;}function createExtensionsReciveFax(_0x435595){var _0x58dc86=0x1;var _0x56301c=[];_0x56301c['push'](new Extension(_0x435595,_0x58dc86,'',_0x032c('0x8d')));_0x58dc86+=0x1;_0x56301c[_0x032c('0x8e')](new Extension(_0x435595,_0x58dc86,_0x032c('0x8f'),'Set'));_0x58dc86+=0x1;for(var _0x10c934 in _0x435595){if(_0x435595[_0x032c('0x49')](_0x10c934)&&(_0x10c934===_0x032c('0x90')||_0x10c934==='localstationid'||_0x10c934===_0x032c('0x91')||_0x10c934===_0x032c('0x92')||_0x10c934===_0x032c('0x93')||_0x10c934==='maxrate'||_0x10c934==='minrate'||_0x10c934==='modem'||_0x10c934==='t38timeout')){_0x56301c['push'](new Extension(_0x435595,_0x58dc86,'FAXOPT('+_0x10c934+')='+_0x435595[_0x10c934],'Set'));_0x58dc86+=0x1;}}_0x56301c[_0x032c('0x8e')](new Extension(_0x435595,_0x58dc86,'6',_0x032c('0x94')));_0x58dc86+=0x1;_0x56301c['push'](new Extension(_0x435595,_0x58dc86,_0x032c('0x95'),'ReceiveFax'));_0x58dc86=0x0;return _0x56301c;}exports[_0x032c('0x96')]=function(_0x1e94d1,_0x4112f8,_0x1a4a9f){var _0x4e919e;return db[_0x032c('0x7e')][_0x032c('0x7f')](function(_0x5c6055){return db['FaxAccount']['create'](_0x1e94d1[_0x032c('0x59')],{'transaction':_0x5c6055})['then'](function(_0x2186a0){_0x4e919e=_0x2186a0[_0x032c('0x35')]({'plain':!![]});return db[_0x032c('0x97')][_0x032c('0x80')](createExtensionsReciveFax(_0x4e919e),{'transaction':_0x5c6055});});})[_0x032c('0x1f')](function(){return _0x4e919e;})[_0x032c('0x1f')](respondWithResult(_0x4112f8,null))[_0x032c('0x29')](handleError(_0x4112f8,null));};exports['updateAccountApplications']=function(_0x37de60,_0x1110d5,_0x44be66){var _0xb4b9fa;return db[_0x032c('0x7e')][_0x032c('0x7f')](function(_0x36d781){return db[_0x032c('0x51')]['update'](_0x37de60[_0x032c('0x59')],{'where':{'id':_0x37de60[_0x032c('0x59')]['id']},'transaction':_0x36d781})[_0x032c('0x1f')](function(_0x411a67){return db[_0x032c('0x97')][_0x032c('0x38')]({'where':{'FaxAccountId':_0x37de60[_0x032c('0x59')]['id']},'transaction':_0x36d781})[_0x032c('0x1f')](function(_0x3dd6ba){return db[_0x032c('0x97')][_0x032c('0x80')](createExtensionsReciveFax(_['omit'](_0x37de60['body'],['tech',_0x032c('0x41'),_0x032c('0x98'),_0x032c('0x99'),_0x032c('0x9a'),_0x032c('0x9b')])),{'transaction':_0x36d781});});});})[_0x032c('0x1f')](function(){return db[_0x032c('0x51')][_0x032c('0x9c')](_0x37de60['body']['id']);})[_0x032c('0x1f')](respondWithResult(_0x1110d5,null))[_0x032c('0x29')](handleError(_0x1110d5,null));};exports[_0x032c('0x9d')]=function(_0x24ae60,_0x91b2e0,_0x49fa10){var _0x3cf647={'raw':!![],'where':{}};var _0x329fa0={};var _0x3a7f48={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x24ae60[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x91b2e0,null))[_0x032c('0x1f')](function(_0x50c07e){if(_0x50c07e){_0x329fa0['model']=_['keys'](db[_0x032c('0x9e')][_0x032c('0x3f')]);_0x329fa0[_0x032c('0x42')]=_[_0x032c('0x57')](_0x24ae60[_0x032c('0x42')]);_0x329fa0[_0x032c('0x43')]=_[_0x032c('0x44')](_0x329fa0[_0x032c('0x45')],_0x329fa0[_0x032c('0x42')]);_0x3cf647[_0x032c('0x46')]=_[_0x032c('0x44')](_0x329fa0[_0x032c('0x45')],qs[_0x032c('0x47')](_0x24ae60[_0x032c('0x42')][_0x032c('0x47')]));_0x3cf647[_0x032c('0x46')]=_0x3cf647['attributes'][_0x032c('0x48')]?_0x3cf647[_0x032c('0x46')]:_0x329fa0[_0x032c('0x45')];if(!_0x24ae60[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x3cf647[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x24ae60[_0x032c('0x42')]['limit']);_0x3cf647['offset']=qs['offset'](_0x24ae60['query'][_0x032c('0x4a')]);}_0x3cf647[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x24ae60[_0x032c('0x42')][_0x032c('0x69')]);_0x3cf647[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x24ae60['query'],_0x329fa0[_0x032c('0x43')]));_0x3cf647[_0x032c('0x4d')][_0x032c('0x64')]=_0x50c07e['id'];if(_0x24ae60[_0x032c('0x42')][_0x032c('0x4e')]){_0x3cf647[_0x032c('0x4d')]=_[_0x032c('0x4f')](_0x3cf647[_0x032c('0x4d')],{'$or':_[_0x032c('0x3e')](_0x3cf647[_0x032c('0x46')],function(_0x5ca8d5){var _0x3c688e={};_0x3c688e[_0x5ca8d5]={'$like':'%'+_0x24ae60[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x3c688e;})});}if(_0x24ae60['query'][_0x032c('0x9f')]){var _0x126265=_0x24ae60[_0x032c('0x42')]['$gte']['split'](',');var _0x39d3bf={};_0x39d3bf[_0x126265[0x0]]={'$gte':moment(_0x126265[0x1])['format'](_0x032c('0xa0'))};_0x3cf647['where']=_['merge'](_0x3cf647[_0x032c('0x4d')],_0x39d3bf);}_0x3cf647=_['merge']({},_0x3cf647,_0x24ae60[_0x032c('0x50')]);return db[_0x032c('0x9e')]['count']({'where':_0x3cf647[_0x032c('0x4d')]})['then'](function(_0x416842){_0x3a7f48[_0x032c('0x2e')]=_0x416842;if(_0x24ae60[_0x032c('0x42')][_0x032c('0x52')]){_0x3cf647[_0x032c('0x53')]=[{'all':!![]}];}return db[_0x032c('0x9e')][_0x032c('0x54')](_0x3cf647);})[_0x032c('0x1f')](function(_0x37c6eb){_0x3a7f48['rows']=_0x37c6eb;return _0x3a7f48;});}})['then'](respondWithFilteredResult(_0x91b2e0,_0x3cf647))['catch'](handleError(_0x91b2e0,null));};exports[_0x032c('0xa1')]=function(_0xfad870,_0x4c3949,_0x5b6307){var _0x33adef,_0x4b0fc0={},_0x2fa101;if(_0xfad870[_0x032c('0x59')]['to']){_0x2fa101=_0xfad870[_0x032c('0x59')]['to'][0x0];}return db['FaxAccount'][_0x032c('0x5e')]({'where':{'id':_0xfad870['params']['id']},'include':[{'model':db[_0x032c('0xa2')],'as':_0x032c('0xa3'),'include':[{'model':db[_0x032c('0x73')],'as':_0x032c('0xa4'),'where':{'fax':_0x2fa101},'limit':0x1,'order':[[_0x032c('0x99'),'DESC']]}]}]})[_0x032c('0x1f')](handleEntityNotFound(_0x4c3949,null))['then'](function(_0x40acfa){_0x33adef=_0x40acfa;if(_0xfad870[_0x032c('0x59')][_0x032c('0xa5')]&&_0xfad870['body']['attachments'][_0x032c('0x48')]){for(var _0x29aa28=0x0;_0x29aa28<_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][_0x032c('0x48')];_0x29aa28+=0x1){_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][_0x29aa28]={'filename':_0xfad870['body']['attachments'][_0x29aa28][_0x032c('0x3a')],'id':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][_0x29aa28]['id'],'path':path[_0x032c('0xa6')](config['root'],'server/files/attachments',_0xfad870[_0x032c('0x59')]['attachments'][_0x29aa28]['basename'])};}}return respondWithRpcPromise(_0x032c('0xa7'),_0x032c('0xa7'),{'FaxAccountId':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x56')]['id'])?undefined:_0xfad870[_0x032c('0x56')]['id'],'path':_['isNil'](_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xa9')])?undefined:_0xfad870[_0x032c('0x59')]['attachments'][0x0][_0x032c('0xa9')],'fax':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')]['to'][0x0])?undefined:_0xfad870[_0x032c('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x33adef){if(_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')][_0x032c('0xaa')])){_0xfad870[_0x032c('0x59')][_0x032c('0xaa')]=util['format'](_0x032c('0xab'),_0x33adef['name'],_0x33adef[_0x032c('0xac')]);}if(_0x33adef[_0x032c('0xa3')]){if(_0x33adef[_0x032c('0xa3')][_0x032c('0xa4')]['length']){return _0x33adef[_0x032c('0xa3')][_0x032c('0xa4')][0x0];}else{return db['CmContact']['create'](_[_0x032c('0x17')](_0xfad870['body'],{'firstName':_0xfad870[_0x032c('0x59')]['to'][0x0],'phone':_0xfad870[_0x032c('0x59')]['to'][0x0],'fax':_0xfad870[_0x032c('0x59')]['to'][0x0],'ListId':_0x33adef[_0x032c('0x9b')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x032c('0x1f')](function(_0x351100){if(_0x351100){return db[_0x032c('0x72')][_0x032c('0x5e')]({'where':{'ContactId':_0x351100['id'],'closed':![],'FaxAccountId':_0x33adef['id']}})[_0x032c('0x1f')](function(_0x911045){if(_0x911045){return[_0x911045,![]];}return db[_0x032c('0x72')][_0x032c('0x58')]({'UserId':_0xfad870[_0x032c('0x5c')]['id'],'ContactId':_0x351100['id'],'FaxAccountId':_0x33adef['id'],'fax':_0xfad870[_0x032c('0x59')]['to'][0x0],'firstMsgDirection':_0x032c('0xad'),'Messages':[_[_0x032c('0x4f')](_0xfad870[_0x032c('0x59')],{'read':![],'body':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xae')],'FaxAccountId':_0x33adef['id'],'UserId':_0xfad870[_0x032c('0x5c')]['id'],'ContactId':_0x351100['id'],'AttachmentId':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x032c('0x9e')],'as':_0x032c('0xaf')}]})[_0x032c('0x1f')](function(_0x3f3e0a){return[_0x3f3e0a,!![]];});});}else{throw new Error(_0x032c('0xb0'));}})[_0x032c('0xb1')](function(_0x438686,_0x3890a8){if(_0x3890a8){return _0x438686;}return db['FaxMessage'][_0x032c('0x58')]({'direction':_0x032c('0xad'),'read':![],'body':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xae')],'FaxAccountId':_0x33adef['id'],'FaxInteractionId':_0x438686['id'],'UserId':_0xfad870[_0x032c('0x5c')]['id'],'ContactId':_0x438686['ContactId'],'AttachmentId':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0]['id']})[_0x032c('0x1f')](function(_0x3a1c4a){_0x438686[_0x032c('0xb2')]['Messages']=[];_0x438686['dataValues']['Messages'][_0x032c('0x8e')](_0x3a1c4a[_0x032c('0xb2')]);return _0x438686;});})[_0x032c('0x1f')](function(_0x3d1809){respondWithRpcPromise(_0x032c('0xb3'),_0x032c('0xb3'),{'FaxAccountId':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x56')]['id'])?undefined:_0xfad870[_0x032c('0x56')]['id'],'path':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xa9')])?undefined:_0xfad870[_0x032c('0x59')]['attachments'][0x0][_0x032c('0xa9')],'fax':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')]['to'][0x0])?undefined:_0xfad870[_0x032c('0x59')]['to'][0x0],'AttachmentId':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0]['id']},client9002)[_0x032c('0x1f')](function(_0x1a4607){logger['info'](_0x032c('0xb4'),_0x1a4607);})[_0x032c('0x29')](function(_0x55587c){logger[_0x032c('0x20')](_0x032c('0xb4'),_0x55587c);});return _0x3d1809;})[_0x032c('0x1f')](respondWithResult(_0x4c3949,null))[_0x032c('0x29')](handleError(_0x4c3949,null));};exports[_0x032c('0xb5')]=function(_0x152d4d,_0x182f2d,_0x1cc481){return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x152d4d[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x182f2d,null))[_0x032c('0x1f')](function(_0x135a8f){if(_0x135a8f){return _0x135a8f[_0x032c('0xb5')](_0x152d4d[_0x032c('0x59')][_0x032c('0x6b')],_['omit'](_0x152d4d[_0x032c('0x59')],['ids','id'])||{})['spread'](function(_0x2841f8){for(var _0x50a520=0x0;_0x50a520<_0x152d4d[_0x032c('0x59')]['ids']['length'];_0x50a520+=0x1){socket[_0x032c('0xb6')](_0x032c('0xb7'),{'UserId':_0x152d4d[_0x032c('0x59')][_0x032c('0x6b')][_0x50a520],'FaxAccountId':_0x152d4d[_0x032c('0x56')]['id']});}return _0x2841f8;});}})[_0x032c('0x1f')](respondWithResult(_0x182f2d,null))[_0x032c('0x29')](handleError(_0x182f2d,null));};exports[_0x032c('0xb8')]=function(_0x2a824a,_0x1e25ef,_0x326033){return db['FaxAccount'][_0x032c('0x5e')]({'where':{'id':_0x2a824a['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x1e25ef,null))['then'](function(_0xdc27c4){if(_0xdc27c4){return _0xdc27c4[_0x032c('0xb8')](_0x2a824a[_0x032c('0x42')]['ids'])['then'](function(){if(_[_0x032c('0xb9')](_0x2a824a[_0x032c('0x42')][_0x032c('0x6b')])){for(var _0x247c4a=0x0;_0x247c4a<_0x2a824a[_0x032c('0x42')]['ids'][_0x032c('0x48')];_0x247c4a+=0x1){socket['emit'](_0x032c('0xba'),{'UserId':Number(_0x2a824a[_0x032c('0x42')][_0x032c('0x6b')][_0x247c4a]),'FaxAccountId':Number(_0x2a824a[_0x032c('0x56')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2a824a[_0x032c('0x42')][_0x032c('0x6b')]),'FaxAccountId':Number(_0x2a824a['params']['id'])});}});}})[_0x032c('0x1f')](respondWithStatusCode(_0x1e25ef,null))[_0x032c('0x29')](handleError(_0x1e25ef,null));};exports[_0x032c('0xbb')]=function(_0x413434,_0x3936f3,_0x162ff2){var _0x1dc95c={};var _0x5dac08={};var _0xd521e5;var _0x9e5fce;return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x413434[_0x032c('0x56')]['id']}})['then'](handleEntityNotFound(_0x3936f3,null))[_0x032c('0x1f')](function(_0x485142){if(_0x485142){_0xd521e5=_0x485142;_0x5dac08['model']=_['keys'](db[_0x032c('0x75')][_0x032c('0x3f')]);_0x5dac08[_0x032c('0x42')]=_['keys'](_0x413434[_0x032c('0x42')]);_0x5dac08['filters']=_['intersection'](_0x5dac08['model'],_0x5dac08['query']);_0x1dc95c[_0x032c('0x46')]=_[_0x032c('0x44')](_0x5dac08[_0x032c('0x45')],qs[_0x032c('0x47')](_0x413434['query']['fields']));_0x1dc95c[_0x032c('0x46')]=_0x1dc95c[_0x032c('0x46')][_0x032c('0x48')]?_0x1dc95c[_0x032c('0x46')]:_0x5dac08['model'];_0x1dc95c[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x413434[_0x032c('0x42')]['sort']);_0x1dc95c[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x413434[_0x032c('0x42')],_0x5dac08[_0x032c('0x43')]));if(_0x413434[_0x032c('0x42')][_0x032c('0x4e')]){_0x1dc95c[_0x032c('0x4d')]=_[_0x032c('0x4f')](_0x1dc95c['where'],{'$or':_[_0x032c('0x3e')](_0x1dc95c[_0x032c('0x46')],function(_0x5633c7){var _0x4e8283={};_0x4e8283[_0x5633c7]={'$like':'%'+_0x413434[_0x032c('0x42')]['filter']+'%'};return _0x4e8283;})});}_0x1dc95c=_[_0x032c('0x4f')]({},_0x1dc95c,_0x413434[_0x032c('0x50')]);return _0xd521e5[_0x032c('0xbb')](_0x1dc95c);}})['then'](function(_0x1cbddf){if(_0x1cbddf){_0x9e5fce=_0x1cbddf[_0x032c('0x48')];if(!_0x413434[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x1dc95c[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x413434['query'][_0x032c('0x2f')]);_0x1dc95c[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x413434['query'][_0x032c('0x4a')]);}return _0xd521e5[_0x032c('0xbb')](_0x1dc95c);}})[_0x032c('0x1f')](function(_0x20fe7b){if(_0x20fe7b){return _0x20fe7b?{'count':_0x9e5fce,'rows':_0x20fe7b}:null;}})[_0x032c('0x1f')](respondWithResult(_0x3936f3,null))[_0x032c('0x29')](handleError(_0x3936f3,null));}; \ No newline at end of file +var _0x34f8=['type','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','findAll','rows','catch','show','params','mandatoryDispositionPause','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','nolimit','options','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','exten','localstationid','system','description','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','ecm','faxdetect','headerinfo','maxrate','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','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','FaxAccount,\x20%s,\x20%s','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName'];(function(_0x3d0fb6,_0x3b0f76){var _0x2d22e5=function(_0x321ea1){while(--_0x321ea1){_0x3d0fb6['push'](_0x3d0fb6['shift']());}};_0x2d22e5(++_0x3b0f76);}(_0x34f8,0x80));var _0x834f=function(_0x97f172,_0xb3f850){_0x97f172=_0x97f172-0x0;var _0x4138df=_0x34f8[_0x97f172];return _0x4138df;};'use strict';var pdf=require(_0x834f('0x0'));var emlformat=require(_0x834f('0x1'));var rimraf=require(_0x834f('0x2'));var zipdir=require(_0x834f('0x3'));var jsonpatch=require(_0x834f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x834f('0x5'));var Mustache=require(_0x834f('0x6'));var util=require('util');var path=require(_0x834f('0x7'));var sox=require(_0x834f('0x8'));var csv=require(_0x834f('0x9'));var ejs=require(_0x834f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x834f('0xb'));var jsforce=require(_0x834f('0xc'));var deskjs=require(_0x834f('0xd'));var toCsv=require(_0x834f('0x9'));var querystring=require('querystring');var Papa=require(_0x834f('0xe'));var Redis=require(_0x834f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x834f('0x10'));var as=require(_0x834f('0x11'));var hardwareService=require(_0x834f('0x12'));var logger=require(_0x834f('0x13'))(_0x834f('0x14'));var utils=require(_0x834f('0x15'));var config=require(_0x834f('0x16'));var licenseUtil=require(_0x834f('0x17'));var db=require('../../mysqldb')['db'];config[_0x834f('0x18')]=_[_0x834f('0x19')](config[_0x834f('0x18')],{'host':_0x834f('0x1a'),'port':0x18eb});var socket=require(_0x834f('0x1b'))(new Redis(config['redis']));require(_0x834f('0x1c'))[_0x834f('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x834f('0x1e')][_0x834f('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x834f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4bb979,_0x342382,_0x438187,_0x2ed75d){return new BPromise(function(_0x248924,_0x4a2b50){var _0x58154d=_0x2ed75d||client;return _0x58154d[_0x834f('0x20')](_0x4bb979,_0x438187)[_0x834f('0x21')](function(_0xe0a86d){logger[_0x834f('0x22')]('FaxAccount,\x20%s,\x20%s',_0x342382,_0x834f('0x23'));logger[_0x834f('0x24')](_0x834f('0x25'),_0x342382,'request\x20sent',JSON['stringify'](_0xe0a86d));if(_0xe0a86d[_0x834f('0x26')]){if(_0xe0a86d['error'][_0x834f('0x27')]===0x1f4){logger[_0x834f('0x26')]('FaxAccount,\x20%s,\x20%s',_0x342382,_0xe0a86d[_0x834f('0x26')]['message']);return _0x4a2b50(_0xe0a86d[_0x834f('0x26')][_0x834f('0x28')]);}logger[_0x834f('0x26')](_0x834f('0x29'),_0x342382,_0xe0a86d['error'][_0x834f('0x28')]);return _0x248924(_0xe0a86d['error'][_0x834f('0x28')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x342382,_0x834f('0x23'));_0x248924(_0xe0a86d['result']['message']);}})['catch'](function(_0x45e1ef){logger[_0x834f('0x26')](_0x834f('0x29'),_0x342382,_0x45e1ef);_0x4a2b50(_0x45e1ef);});});}function respondWithStatusCode(_0x1956fa,_0x44355b){_0x44355b=_0x44355b||0xcc;return function(_0x2d852b){if(_0x2d852b){return _0x1956fa[_0x834f('0x2a')](_0x44355b);}return _0x1956fa[_0x834f('0x2b')](_0x44355b)[_0x834f('0x2c')]();};}function respondWithResult(_0x3bb906,_0x2338de){_0x2338de=_0x2338de||0xc8;return function(_0x4dd2c8){if(_0x4dd2c8){return _0x3bb906[_0x834f('0x2b')](_0x2338de)[_0x834f('0x2d')](_0x4dd2c8);}};}function respondWithFilteredResult(_0xcd12fe,_0x586324){return function(_0x1136b9){if(_0x1136b9){var _0x37e1d8=_0x1136b9[_0x834f('0x2e')],_0x20da2d=_0x586324[_0x834f('0x2f')],_0x2854e4=_0x586324[_0x834f('0x2f')]+_0x586324[_0x834f('0x30')],_0x51cc8f;if(_0x2854e4>=_0x37e1d8){_0x2854e4=_0x37e1d8;_0x51cc8f=0xc8;}else{_0x51cc8f=0xce;}_0xcd12fe['status'](_0x51cc8f);return _0xcd12fe[_0x834f('0x31')](_0x834f('0x32'),_0x20da2d+'-'+_0x2854e4+'/'+_0x37e1d8)[_0x834f('0x2d')](_0x1136b9);}return null;};}function patchUpdates(_0x31b0f1){return function(_0x4ac1fe){try{jsonpatch[_0x834f('0x33')](_0x4ac1fe,_0x31b0f1,!![]);}catch(_0x1ec011){return BPromise['reject'](_0x1ec011);}return _0x4ac1fe[_0x834f('0x34')]();};}function saveUpdates(_0x3847df,_0x4913b7){return function(_0x252bd8){if(_0x252bd8){return _0x252bd8[_0x834f('0x35')](_0x3847df)[_0x834f('0x21')](function(_0x358860){return _0x358860;});}return null;};}function removeEntity(_0x118a15,_0x4d0e44){return function(_0x38fe18){if(_0x38fe18){return _0x38fe18['destroy']()['then'](function(){var _0x212ef2=_0x38fe18['get']({'plain':!![]});var _0xc68c8d=_0x834f('0x36');return db[_0x834f('0x37')][_0x834f('0x38')]({'where':{'type':_0xc68c8d,'resourceId':_0x212ef2['id']}})['then'](function(){return _0x38fe18;});})['then'](function(){_0x118a15['status'](0xcc)[_0x834f('0x2c')]();});}};}function handleEntityNotFound(_0x3a6a0d,_0x1795d5){return function(_0x43df54){if(!_0x43df54){_0x3a6a0d[_0x834f('0x2a')](0x194);}return _0x43df54;};}function handleError(_0x48b0cf,_0xf8cff8){_0xf8cff8=_0xf8cff8||0x1f4;return function(_0x6ec56d){logger[_0x834f('0x26')](_0x6ec56d[_0x834f('0x39')]);if(_0x6ec56d[_0x834f('0x3a')]){delete _0x6ec56d[_0x834f('0x3a')];}_0x48b0cf[_0x834f('0x2b')](_0xf8cff8)[_0x834f('0x3b')](_0x6ec56d);};}exports[_0x834f('0x3c')]=function(_0x31c639,_0x46a9a7){var _0x1346b4={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x465b3a={},_0x4b4709={'count':0x0,'rows':[]};var _0x2cc5f7=_['map'](db['FaxAccount'][_0x834f('0x3d')],function(_0x3775ef){return{'name':_0x3775ef[_0x834f('0x3e')],'type':_0x3775ef[_0x834f('0x3f')][_0x834f('0x40')]};});_0x465b3a['model']=_[_0x834f('0x41')](_0x2cc5f7,_0x834f('0x3a'));_0x465b3a[_0x834f('0x42')]=_[_0x834f('0x43')](_0x31c639[_0x834f('0x42')]);_0x465b3a['filters']=_[_0x834f('0x44')](_0x465b3a[_0x834f('0x45')],_0x465b3a['query']);_0x1346b4[_0x834f('0x46')]=_[_0x834f('0x44')](_0x465b3a[_0x834f('0x45')],qs['fields'](_0x31c639['query'][_0x834f('0x47')]));_0x1346b4['attributes']=_0x1346b4['attributes'][_0x834f('0x48')]?_0x1346b4[_0x834f('0x46')]:_0x465b3a[_0x834f('0x45')];if(!_0x31c639['query']['hasOwnProperty']('nolimit')){_0x1346b4['limit']=qs[_0x834f('0x30')](_0x31c639['query'][_0x834f('0x30')]);_0x1346b4[_0x834f('0x2f')]=qs[_0x834f('0x2f')](_0x31c639['query'][_0x834f('0x2f')]);}_0x1346b4[_0x834f('0x49')]=qs[_0x834f('0x4a')](_0x31c639[_0x834f('0x42')][_0x834f('0x4a')]);_0x1346b4[_0x834f('0x4b')]=qs[_0x834f('0x4c')](_[_0x834f('0x4d')](_0x31c639['query'],_0x465b3a['filters']),_0x2cc5f7);if(_0x31c639[_0x834f('0x42')][_0x834f('0x4e')]){_0x1346b4[_0x834f('0x4b')]=_[_0x834f('0x4f')](_0x1346b4['where'],{'$or':_['map'](_0x2cc5f7,function(_0x529554){if(_0x529554['type']!==_0x834f('0x50')){var _0x49e2d7={};_0x49e2d7[_0x529554[_0x834f('0x3a')]]={'$like':'%'+_0x31c639[_0x834f('0x42')][_0x834f('0x4e')]+'%'};return _0x49e2d7;}})});}_0x1346b4=_[_0x834f('0x4f')]({},_0x1346b4,_0x31c639['options']);var _0x326db5={'where':_0x1346b4[_0x834f('0x4b')]};return db[_0x834f('0x51')][_0x834f('0x2e')](_0x326db5)[_0x834f('0x21')](function(_0x1ba752){_0x4b4709[_0x834f('0x2e')]=_0x1ba752;if(_0x31c639[_0x834f('0x42')][_0x834f('0x52')]){_0x1346b4['include']=[{'all':!![]}];}return db[_0x834f('0x51')][_0x834f('0x53')](_0x1346b4);})[_0x834f('0x21')](function(_0x5cb9f3){_0x4b4709[_0x834f('0x54')]=_0x5cb9f3;return _0x4b4709;})[_0x834f('0x21')](respondWithFilteredResult(_0x46a9a7,_0x1346b4))[_0x834f('0x55')](handleError(_0x46a9a7,null));};exports[_0x834f('0x56')]=function(_0x580b38,_0x3320e3){var _0x1617da={'raw':![],'where':{'id':_0x580b38[_0x834f('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x834f('0x58')}]},_0x15529a={};_0x15529a[_0x834f('0x45')]=_['keys'](db[_0x834f('0x51')]['rawAttributes']);_0x15529a[_0x834f('0x42')]=_['keys'](_0x580b38[_0x834f('0x42')]);_0x15529a['filters']=_[_0x834f('0x44')](_0x15529a[_0x834f('0x45')],_0x15529a[_0x834f('0x42')]);_0x1617da[_0x834f('0x46')]=_[_0x834f('0x44')](_0x15529a['model'],qs[_0x834f('0x47')](_0x580b38[_0x834f('0x42')]['fields']));_0x1617da['attributes']=_0x1617da['attributes'][_0x834f('0x48')]?_0x1617da[_0x834f('0x46')]:_0x15529a[_0x834f('0x45')];if(_0x580b38[_0x834f('0x42')]['includeAll']){_0x1617da[_0x834f('0x59')]=[{'all':!![]}];}_0x1617da=_[_0x834f('0x4f')]({},_0x1617da,_0x580b38['options']);return db[_0x834f('0x51')]['find'](_0x1617da)[_0x834f('0x21')](handleEntityNotFound(_0x3320e3,null))[_0x834f('0x21')](respondWithResult(_0x3320e3,null))[_0x834f('0x55')](handleError(_0x3320e3,null));};exports['create']=function(_0x342661,_0x35da58){return db[_0x834f('0x51')][_0x834f('0x5a')](_0x342661['body'],{})[_0x834f('0x21')](function(_0x34df38){var _0xf48df6=_0x342661['user'][_0x834f('0x5b')]({'plain':!![]});if(!_0xf48df6)throw new Error(_0x834f('0x5c'));if(_0xf48df6[_0x834f('0x5d')]===_0x834f('0x5e')){var _0x215945=_0x34df38[_0x834f('0x5b')]({'plain':!![]});var _0x230fed=_0x834f('0x36');return db[_0x834f('0x5f')][_0x834f('0x60')]({'where':{'name':_0x230fed,'userProfileId':_0xf48df6['userProfileId']},'raw':!![]})[_0x834f('0x21')](function(_0x112cd9){if(_0x112cd9&&_0x112cd9['autoAssociation']===0x0){return db[_0x834f('0x37')]['create']({'name':_0x215945[_0x834f('0x3a')],'resourceId':_0x215945['id'],'type':_0x112cd9[_0x834f('0x3a')],'sectionId':_0x112cd9['id']},{})[_0x834f('0x21')](function(){return _0x34df38;});}else{return _0x34df38;}})['catch'](function(_0x5f54b6){logger[_0x834f('0x26')](_0x834f('0x61'),_0x5f54b6);throw _0x5f54b6;});}return _0x34df38;})[_0x834f('0x21')](respondWithResult(_0x35da58,0xc9))['catch'](handleError(_0x35da58,null));};exports['update']=function(_0x7bd14d,_0x38a448){if(_0x7bd14d[_0x834f('0x62')]['id']){delete _0x7bd14d[_0x834f('0x62')]['id'];}return db[_0x834f('0x51')][_0x834f('0x60')]({'where':{'id':_0x7bd14d[_0x834f('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x834f('0x58')}]})[_0x834f('0x21')](handleEntityNotFound(_0x38a448,null))[_0x834f('0x21')](saveUpdates(_0x7bd14d[_0x834f('0x62')],null))[_0x834f('0x21')](respondWithResult(_0x38a448,null))[_0x834f('0x55')](handleError(_0x38a448,null));};exports[_0x834f('0x38')]=function(_0x14b605,_0x97890c){return db['FaxAccount'][_0x834f('0x60')]({'where':{'id':_0x14b605[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x97890c,null))[_0x834f('0x21')](removeEntity(_0x97890c,null))[_0x834f('0x55')](handleError(_0x97890c,null));};exports[_0x834f('0x63')]=function(_0x2c89e7,_0x50561c){return db[_0x834f('0x51')][_0x834f('0x63')]()[_0x834f('0x21')](respondWithResult(_0x50561c,null))['catch'](handleError(_0x50561c,null));};exports[_0x834f('0x64')]=function(_0x43aeb6,_0xcf251e,_0x5be8d2){if(_0x43aeb6[_0x834f('0x62')]['id']){delete _0x43aeb6[_0x834f('0x62')]['id'];}return db[_0x834f('0x51')][_0x834f('0x60')]({'where':{'id':_0x43aeb6[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0xcf251e,null))['then'](function(_0x82f1b1){if(_0x82f1b1){_0x43aeb6[_0x834f('0x62')][_0x834f('0x65')]=_0x82f1b1['id'];return db['Disposition'][_0x834f('0x5a')](_0x43aeb6[_0x834f('0x62')]);}})[_0x834f('0x21')](respondWithResult(_0xcf251e,null))[_0x834f('0x55')](handleError(_0xcf251e,null));};exports[_0x834f('0x66')]=function(_0x23cd9c,_0x31e503,_0x18a257){var _0x27ce55={'raw':![],'where':{}};var _0x3b7b9c={};var _0x18b402={'count':0x0,'rows':[]};return db[_0x834f('0x51')][_0x834f('0x67')]({'where':{'id':_0x23cd9c[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x31e503,null))[_0x834f('0x21')](function(_0x546a81){if(_0x546a81){_0x3b7b9c[_0x834f('0x45')]=_[_0x834f('0x43')](db[_0x834f('0x68')][_0x834f('0x3d')]);_0x3b7b9c[_0x834f('0x42')]=_[_0x834f('0x43')](_0x23cd9c['query']);_0x3b7b9c[_0x834f('0x4c')]=_[_0x834f('0x44')](_0x3b7b9c['model'],_0x3b7b9c[_0x834f('0x42')]);_0x27ce55[_0x834f('0x46')]=_['intersection'](_0x3b7b9c[_0x834f('0x45')],qs[_0x834f('0x47')](_0x23cd9c[_0x834f('0x42')][_0x834f('0x47')]));_0x27ce55[_0x834f('0x46')]=_0x27ce55['attributes']['length']?_0x27ce55[_0x834f('0x46')]:_0x3b7b9c[_0x834f('0x45')];if(!_0x23cd9c[_0x834f('0x42')][_0x834f('0x69')](_0x834f('0x6a'))){_0x27ce55[_0x834f('0x30')]=qs[_0x834f('0x30')](_0x23cd9c[_0x834f('0x42')][_0x834f('0x30')]);_0x27ce55['offset']=qs[_0x834f('0x2f')](_0x23cd9c[_0x834f('0x42')]['offset']);}_0x27ce55[_0x834f('0x49')]=qs[_0x834f('0x4a')](_0x23cd9c['query'][_0x834f('0x4a')]);_0x27ce55[_0x834f('0x4b')]=qs[_0x834f('0x4c')](_['pick'](_0x23cd9c[_0x834f('0x42')],_0x3b7b9c['filters']));_0x27ce55['where'][_0x834f('0x65')]=_0x546a81['id'];if(_0x23cd9c[_0x834f('0x42')][_0x834f('0x4e')]){_0x27ce55[_0x834f('0x4b')]=_[_0x834f('0x4f')](_0x27ce55[_0x834f('0x4b')],{'$or':_['map'](_0x27ce55[_0x834f('0x46')],function(_0x4637a7){var _0x569293={};_0x569293[_0x4637a7]={'$like':'%'+_0x23cd9c[_0x834f('0x42')][_0x834f('0x4e')]+'%'};return _0x569293;})});}_0x27ce55=_['merge']({},_0x27ce55,_0x23cd9c[_0x834f('0x6b')]);return db[_0x834f('0x68')][_0x834f('0x2e')]({'where':_0x27ce55[_0x834f('0x4b')]})[_0x834f('0x21')](function(_0x4aec9e){_0x18b402[_0x834f('0x2e')]=_0x4aec9e;if(_0x23cd9c[_0x834f('0x42')]['includeAll']){_0x27ce55[_0x834f('0x59')]=[{'all':!![]}];}return db[_0x834f('0x68')][_0x834f('0x53')](_0x27ce55);})['then'](function(_0x113ebf){_0x18b402[_0x834f('0x54')]=_0x113ebf;return _0x18b402;});}})['then'](respondWithFilteredResult(_0x31e503,_0x27ce55))[_0x834f('0x55')](handleError(_0x31e503,null));};exports[_0x834f('0x6c')]=function(_0x4cfd68,_0x5eabbb,_0x4d3613){return db[_0x834f('0x51')][_0x834f('0x60')]({'where':{'id':_0x4cfd68[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x5eabbb,null))[_0x834f('0x21')](function(_0x1754c3){if(_0x1754c3){return _0x1754c3[_0x834f('0x6c')](_0x4cfd68[_0x834f('0x42')][_0x834f('0x6d')]);}})[_0x834f('0x21')](respondWithStatusCode(_0x5eabbb,null))[_0x834f('0x55')](handleError(_0x5eabbb,null));};exports[_0x834f('0x6e')]=function(_0x7f1f65,_0x813a9d,_0x50326b){if(_0x7f1f65['body']['id']){delete _0x7f1f65['body']['id'];}return db[_0x834f('0x51')][_0x834f('0x60')]({'where':{'id':_0x7f1f65[_0x834f('0x57')]['id']}})['then'](handleEntityNotFound(_0x813a9d,null))[_0x834f('0x21')](function(_0x212b65){if(_0x212b65){_0x7f1f65[_0x834f('0x62')][_0x834f('0x65')]=_0x212b65['id'];return db[_0x834f('0x6f')][_0x834f('0x5a')](_0x7f1f65[_0x834f('0x62')]);}})[_0x834f('0x21')](respondWithResult(_0x813a9d,null))[_0x834f('0x55')](handleError(_0x813a9d,null));};exports['getAnswers']=function(_0x5923f5,_0x23f9d2,_0x58ed70){var _0xe9f368={'raw':![],'where':{}};var _0x4098a0={};var _0x3d9e47={'count':0x0,'rows':[]};return db[_0x834f('0x51')]['findOne']({'where':{'id':_0x5923f5['params']['id']}})['then'](handleEntityNotFound(_0x23f9d2,null))[_0x834f('0x21')](function(_0x16f428){if(_0x16f428){_0x4098a0[_0x834f('0x45')]=_[_0x834f('0x43')](db['CannedAnswer'][_0x834f('0x3d')]);_0x4098a0[_0x834f('0x42')]=_[_0x834f('0x43')](_0x5923f5['query']);_0x4098a0[_0x834f('0x4c')]=_[_0x834f('0x44')](_0x4098a0[_0x834f('0x45')],_0x4098a0[_0x834f('0x42')]);_0xe9f368[_0x834f('0x46')]=_[_0x834f('0x44')](_0x4098a0['model'],qs['fields'](_0x5923f5[_0x834f('0x42')][_0x834f('0x47')]));_0xe9f368[_0x834f('0x46')]=_0xe9f368[_0x834f('0x46')][_0x834f('0x48')]?_0xe9f368[_0x834f('0x46')]:_0x4098a0[_0x834f('0x45')];if(!_0x5923f5[_0x834f('0x42')][_0x834f('0x69')](_0x834f('0x6a'))){_0xe9f368[_0x834f('0x30')]=qs[_0x834f('0x30')](_0x5923f5[_0x834f('0x42')][_0x834f('0x30')]);_0xe9f368[_0x834f('0x2f')]=qs[_0x834f('0x2f')](_0x5923f5[_0x834f('0x42')][_0x834f('0x2f')]);}_0xe9f368[_0x834f('0x49')]=qs[_0x834f('0x4a')](_0x5923f5['query']['sort']);_0xe9f368['where']=qs[_0x834f('0x4c')](_[_0x834f('0x4d')](_0x5923f5[_0x834f('0x42')],_0x4098a0['filters']));_0xe9f368['where'][_0x834f('0x65')]=_0x16f428['id'];if(_0x5923f5[_0x834f('0x42')][_0x834f('0x4e')]){_0xe9f368[_0x834f('0x4b')]=_[_0x834f('0x4f')](_0xe9f368[_0x834f('0x4b')],{'$or':_[_0x834f('0x41')](_0xe9f368[_0x834f('0x46')],function(_0x3b9dea){var _0x224a2d={};_0x224a2d[_0x3b9dea]={'$like':'%'+_0x5923f5[_0x834f('0x42')][_0x834f('0x4e')]+'%'};return _0x224a2d;})});}_0xe9f368=_[_0x834f('0x4f')]({},_0xe9f368,_0x5923f5[_0x834f('0x6b')]);return db[_0x834f('0x6f')][_0x834f('0x2e')]({'where':_0xe9f368[_0x834f('0x4b')]})[_0x834f('0x21')](function(_0x9b700e){_0x3d9e47['count']=_0x9b700e;if(_0x5923f5[_0x834f('0x42')][_0x834f('0x52')]){_0xe9f368['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xe9f368);})[_0x834f('0x21')](function(_0x1807b3){_0x3d9e47[_0x834f('0x54')]=_0x1807b3;return _0x3d9e47;});}})[_0x834f('0x21')](respondWithFilteredResult(_0x23f9d2,_0xe9f368))[_0x834f('0x55')](handleError(_0x23f9d2,null));};exports[_0x834f('0x70')]=function(_0x24366b,_0x258878,_0x41463c){return db['FaxAccount'][_0x834f('0x60')]({'where':{'id':_0x24366b['params']['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x258878,null))[_0x834f('0x21')](function(_0x2702a8){if(_0x2702a8){return _0x2702a8[_0x834f('0x70')](_0x24366b[_0x834f('0x42')][_0x834f('0x6d')]);}})[_0x834f('0x21')](respondWithStatusCode(_0x258878,null))[_0x834f('0x55')](handleError(_0x258878,null));};exports['addInteraction']=function(_0x597ae9,_0x56df69,_0x3b6cbb){return db[_0x834f('0x71')][_0x834f('0x60')]({'where':{'id':_0x597ae9[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x56df69,null))[_0x834f('0x21')](function(_0x25f07b){if(_0x25f07b){return _0x25f07b['addInteraction'](_0x597ae9[_0x834f('0x62')][_0x834f('0x6d')],_[_0x834f('0x72')](_0x597ae9[_0x834f('0x62')],['ids','id'])||{});}})[_0x834f('0x21')](respondWithResult(_0x56df69,null))[_0x834f('0x55')](handleError(_0x56df69,null));};exports['getInteractions']=function(_0x3101b9,_0x40db44,_0x14495e){var _0x12f3c9={'raw':![],'where':{}};var _0x5552e4={};var _0x50e80c={'count':0x0,'rows':[]};return db[_0x834f('0x51')]['findOne']({'where':{'id':_0x3101b9[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x40db44,null))[_0x834f('0x21')](function(_0x2d56d8){if(_0x2d56d8){_0x5552e4[_0x834f('0x45')]=_['keys'](db[_0x834f('0x71')][_0x834f('0x3d')]);_0x5552e4[_0x834f('0x42')]=_[_0x834f('0x43')](_0x3101b9['query']);_0x5552e4[_0x834f('0x4c')]=_['intersection'](_0x5552e4[_0x834f('0x45')],_0x5552e4[_0x834f('0x42')]);_0x12f3c9['attributes']=_[_0x834f('0x44')](_0x5552e4[_0x834f('0x45')],qs[_0x834f('0x47')](_0x3101b9[_0x834f('0x42')]['fields']));_0x12f3c9[_0x834f('0x46')]=_0x12f3c9['attributes'][_0x834f('0x48')]?_0x12f3c9[_0x834f('0x46')]:_0x5552e4[_0x834f('0x45')];if(!_0x3101b9[_0x834f('0x42')][_0x834f('0x69')](_0x834f('0x6a'))){_0x12f3c9['limit']=qs['limit'](_0x3101b9[_0x834f('0x42')][_0x834f('0x30')]);_0x12f3c9[_0x834f('0x2f')]=qs[_0x834f('0x2f')](_0x3101b9[_0x834f('0x42')]['offset']);}_0x12f3c9[_0x834f('0x49')]=qs[_0x834f('0x4a')](_0x3101b9[_0x834f('0x42')][_0x834f('0x4a')]);_0x12f3c9[_0x834f('0x4b')]=qs[_0x834f('0x4c')](_[_0x834f('0x4d')](_0x3101b9['query'],_0x5552e4['filters']));_0x12f3c9[_0x834f('0x4b')][_0x834f('0x65')]=_0x2d56d8['id'];if(_0x3101b9['query'][_0x834f('0x4e')]){_0x12f3c9[_0x834f('0x4b')]=_[_0x834f('0x4f')](_0x12f3c9['where'],{'$or':_['map'](_0x12f3c9[_0x834f('0x46')],function(_0x41b55e){var _0x3b1c31={};_0x3b1c31[_0x41b55e]={'$like':'%'+_0x3101b9[_0x834f('0x42')]['filter']+'%'};return _0x3b1c31;})});}_0x12f3c9=_[_0x834f('0x4f')]({},_0x12f3c9,_0x3101b9['options']);return db[_0x834f('0x71')]['count']({'where':_0x12f3c9[_0x834f('0x4b')]})[_0x834f('0x21')](function(_0x4dcc59){_0x50e80c[_0x834f('0x2e')]=_0x4dcc59;if(_0x3101b9['query'][_0x834f('0x52')]){_0x12f3c9['include']=[{'model':db[_0x834f('0x73')],'as':'Contact','required':![]},{'model':db[_0x834f('0x74')],'as':_0x834f('0x75'),'attributes':['name',_0x834f('0x76'),_0x834f('0x77')],'required':![]},{'model':db[_0x834f('0x78')],'as':_0x834f('0x79'),'attributes':['id','name','color'],'where':_0x3101b9[_0x834f('0x42')][_0x834f('0x7a')]?{'id':_0x3101b9[_0x834f('0x42')][_0x834f('0x7a')]}:undefined,'required':_0x3101b9[_0x834f('0x42')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x834f('0x53')](_0x12f3c9);})[_0x834f('0x21')](function(_0x17d915){_0x50e80c[_0x834f('0x54')]=_0x17d915;return _0x50e80c;});}})[_0x834f('0x21')](respondWithFilteredResult(_0x40db44,_0x12f3c9))[_0x834f('0x55')](handleError(_0x40db44,null));};exports[_0x834f('0x7b')]=function(_0x33399f,_0x5b0601,_0x46247e){return db['FaxAccount'][_0x834f('0x67')]({'where':{'id':_0x33399f[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x5b0601,null))[_0x834f('0x21')](function(_0x5cdd68){if(_0x5cdd68){return db[_0x834f('0x7c')][_0x834f('0x7d')](function(_0x5c4f38){return db['FaxApplication'][_0x834f('0x38')]({'where':{'FaxAccountId':_0x33399f[_0x834f('0x57')]['id']},'transaction':_0x5c4f38})[_0x834f('0x21')](function(_0x3b259e){var _0x38f69d=_[_0x834f('0x41')](_0x33399f[_0x834f('0x62')],function(_0x282c7d){_0x282c7d[_0x834f('0x65')]=_0x33399f[_0x834f('0x57')]['id'];return _0x282c7d;});return db[_0x834f('0x7e')][_0x834f('0x7f')](_0x38f69d,{'transaction':_0x5c4f38});});})['then'](function(){return db[_0x834f('0x7e')][_0x834f('0x80')]({'where':{'FaxAccountId':_0x33399f[_0x834f('0x57')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5b0601,null))[_0x834f('0x55')](handleError(_0x5b0601,null));};exports[_0x834f('0x81')]=function(_0x38a1a5,_0x1912c9,_0x29ac6d){var _0x5547b7={};var _0x3ca5a1={};var _0x3688f7;var _0x515f95;return db[_0x834f('0x51')][_0x834f('0x67')]({'where':{'id':_0x38a1a5[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x1912c9,null))['then'](function(_0x485b51){if(_0x485b51){_0x3688f7=_0x485b51;_0x3ca5a1[_0x834f('0x45')]=_[_0x834f('0x43')](db[_0x834f('0x7e')][_0x834f('0x3d')]);_0x3ca5a1[_0x834f('0x42')]=_[_0x834f('0x43')](_0x38a1a5[_0x834f('0x42')]);_0x3ca5a1['filters']=_[_0x834f('0x44')](_0x3ca5a1['model'],_0x3ca5a1['query']);_0x5547b7['attributes']=_[_0x834f('0x44')](_0x3ca5a1[_0x834f('0x45')],qs[_0x834f('0x47')](_0x38a1a5[_0x834f('0x42')][_0x834f('0x47')]));_0x5547b7[_0x834f('0x46')]=_0x5547b7[_0x834f('0x46')]['length']?_0x5547b7[_0x834f('0x46')]:_0x3ca5a1[_0x834f('0x45')];_0x5547b7[_0x834f('0x49')]=qs[_0x834f('0x4a')](_0x38a1a5['query'][_0x834f('0x4a')]);_0x5547b7[_0x834f('0x4b')]=qs['filters'](_['pick'](_0x38a1a5[_0x834f('0x42')],_0x3ca5a1[_0x834f('0x4c')]));if(_0x38a1a5['query']['filter']){_0x5547b7[_0x834f('0x4b')]=_['merge'](_0x5547b7[_0x834f('0x4b')],{'$or':_[_0x834f('0x41')](_0x5547b7['attributes'],function(_0x5e2a5f){var _0x374f75={};_0x374f75[_0x5e2a5f]={'$like':'%'+_0x38a1a5['query']['filter']+'%'};return _0x374f75;})});}_0x5547b7=_[_0x834f('0x4f')]({},_0x5547b7,_0x38a1a5[_0x834f('0x6b')]);return _0x3688f7['getApplications'](_0x5547b7);}})[_0x834f('0x21')](function(_0x52f2fa){if(_0x52f2fa){_0x515f95=_0x52f2fa[_0x834f('0x48')];if(!_0x38a1a5[_0x834f('0x42')][_0x834f('0x69')](_0x834f('0x6a'))){_0x5547b7[_0x834f('0x30')]=qs[_0x834f('0x30')](_0x38a1a5[_0x834f('0x42')][_0x834f('0x30')]);_0x5547b7['offset']=qs[_0x834f('0x2f')](_0x38a1a5[_0x834f('0x42')][_0x834f('0x2f')]);}return _0x3688f7[_0x834f('0x81')](_0x5547b7);}})[_0x834f('0x21')](function(_0x593f37){if(_0x593f37){return _0x593f37?{'count':_0x515f95,'rows':_0x593f37}:null;}})[_0x834f('0x21')](respondWithResult(_0x1912c9,null))[_0x834f('0x55')](handleError(_0x1912c9,null));};function Extension(_0x6484e4,_0xd8a392,_0x4b4b88,_0x645cbe){this['context']='from-voip-provider';this[_0x834f('0x82')]=_0x6484e4[_0x834f('0x83')];this['app']=_0x645cbe;this[_0x834f('0x3f')]=_0x834f('0x84');this[_0x834f('0x85')]=_0x834f('0x86');this[_0x834f('0x65')]=_0x6484e4['id'];this[_0x834f('0x87')]=_0xd8a392;this[_0x834f('0x88')]=_0x4b4b88;}function createExtensionsReciveFax(_0x1e7557){var _0x3874d5=0x1;var _0x22a839=[];_0x22a839['push'](new Extension(_0x1e7557,_0x3874d5,'','Answer'));_0x3874d5+=0x1;_0x22a839[_0x834f('0x89')](new Extension(_0x1e7557,_0x3874d5,_0x834f('0x8a'),'Set'));_0x3874d5+=0x1;for(var _0x9f60cd in _0x1e7557){if(_0x1e7557['hasOwnProperty'](_0x9f60cd)&&(_0x9f60cd===_0x834f('0x8b')||_0x9f60cd==='localstationid'||_0x9f60cd==='gateway'||_0x9f60cd===_0x834f('0x8c')||_0x9f60cd===_0x834f('0x8d')||_0x9f60cd===_0x834f('0x8e')||_0x9f60cd===_0x834f('0x8f')||_0x9f60cd===_0x834f('0x90')||_0x9f60cd===_0x834f('0x91'))){_0x22a839[_0x834f('0x89')](new Extension(_0x1e7557,_0x3874d5,_0x834f('0x92')+_0x9f60cd+')='+_0x1e7557[_0x9f60cd],'Set'));_0x3874d5+=0x1;}}_0x22a839[_0x834f('0x89')](new Extension(_0x1e7557,_0x3874d5,'6',_0x834f('0x93')));_0x3874d5+=0x1;_0x22a839[_0x834f('0x89')](new Extension(_0x1e7557,_0x3874d5,_0x834f('0x94'),_0x834f('0x95')));_0x3874d5=0x0;return _0x22a839;}exports['addAccountApplications']=function(_0x327678,_0xff6f2d,_0x270e5f){var _0x4f414e;return db[_0x834f('0x7c')][_0x834f('0x7d')](function(_0x582ac8){return db[_0x834f('0x51')]['create'](_0x327678[_0x834f('0x62')],{'transaction':_0x582ac8})['then'](function(_0x1971a1){_0x4f414e=_0x1971a1[_0x834f('0x5b')]({'plain':!![]});return db[_0x834f('0x96')][_0x834f('0x7f')](createExtensionsReciveFax(_0x4f414e),{'transaction':_0x582ac8});});})[_0x834f('0x21')](function(){return _0x4f414e;})[_0x834f('0x21')](respondWithResult(_0xff6f2d,null))['catch'](handleError(_0xff6f2d,null));};exports[_0x834f('0x97')]=function(_0xc3d399,_0x166b34,_0x4d61e2){var _0x54afa6;return db[_0x834f('0x7c')]['transaction'](function(_0x33abf0){return db['FaxAccount'][_0x834f('0x35')](_0xc3d399['body'],{'where':{'id':_0xc3d399[_0x834f('0x62')]['id']},'transaction':_0x33abf0})[_0x834f('0x21')](function(_0x194d5b){return db[_0x834f('0x96')][_0x834f('0x38')]({'where':{'FaxAccountId':_0xc3d399[_0x834f('0x62')]['id']},'transaction':_0x33abf0})['then'](function(_0x44639d){return db['VoiceExtension'][_0x834f('0x7f')](createExtensionsReciveFax(_['omit'](_0xc3d399['body'],[_0x834f('0x98'),'key',_0x834f('0x99'),_0x834f('0x9a'),_0x834f('0x9b'),_0x834f('0x9c')])),{'transaction':_0x33abf0});});});})[_0x834f('0x21')](function(){return db['FaxAccount'][_0x834f('0x9d')](_0xc3d399[_0x834f('0x62')]['id']);})['then'](respondWithResult(_0x166b34,null))[_0x834f('0x55')](handleError(_0x166b34,null));};exports[_0x834f('0x9e')]=function(_0x16b06b,_0x386bfa,_0x509a30){var _0x1f0b71={'raw':!![],'where':{}};var _0x1a05e8={};var _0x4d5e4d={'count':0x0,'rows':[]};return db[_0x834f('0x51')]['findOne']({'where':{'id':_0x16b06b[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x386bfa,null))['then'](function(_0x1bffd5){if(_0x1bffd5){_0x1a05e8['model']=_['keys'](db['FaxMessage'][_0x834f('0x3d')]);_0x1a05e8[_0x834f('0x42')]=_[_0x834f('0x43')](_0x16b06b['query']);_0x1a05e8[_0x834f('0x4c')]=_[_0x834f('0x44')](_0x1a05e8[_0x834f('0x45')],_0x1a05e8[_0x834f('0x42')]);_0x1f0b71[_0x834f('0x46')]=_[_0x834f('0x44')](_0x1a05e8[_0x834f('0x45')],qs[_0x834f('0x47')](_0x16b06b['query']['fields']));_0x1f0b71['attributes']=_0x1f0b71[_0x834f('0x46')]['length']?_0x1f0b71[_0x834f('0x46')]:_0x1a05e8[_0x834f('0x45')];if(!_0x16b06b['query'][_0x834f('0x69')](_0x834f('0x6a'))){_0x1f0b71['limit']=qs[_0x834f('0x30')](_0x16b06b[_0x834f('0x42')]['limit']);_0x1f0b71['offset']=qs['offset'](_0x16b06b[_0x834f('0x42')][_0x834f('0x2f')]);}_0x1f0b71['order']=qs[_0x834f('0x4a')](_0x16b06b['query'][_0x834f('0x4a')]);_0x1f0b71['where']=qs[_0x834f('0x4c')](_[_0x834f('0x4d')](_0x16b06b[_0x834f('0x42')],_0x1a05e8[_0x834f('0x4c')]));_0x1f0b71[_0x834f('0x4b')]['FaxAccountId']=_0x1bffd5['id'];if(_0x16b06b[_0x834f('0x42')][_0x834f('0x4e')]){_0x1f0b71[_0x834f('0x4b')]=_[_0x834f('0x4f')](_0x1f0b71[_0x834f('0x4b')],{'$or':_[_0x834f('0x41')](_0x1f0b71[_0x834f('0x46')],function(_0x48227c){var _0x6adb3={};_0x6adb3[_0x48227c]={'$like':'%'+_0x16b06b[_0x834f('0x42')][_0x834f('0x4e')]+'%'};return _0x6adb3;})});}if(_0x16b06b[_0x834f('0x42')][_0x834f('0x9f')]){var _0x172b73=_0x16b06b['query'][_0x834f('0x9f')][_0x834f('0xa0')](',');var _0x1d2614={};_0x1d2614[_0x172b73[0x0]]={'$gte':moment(_0x172b73[0x1])[_0x834f('0xa1')](_0x834f('0xa2'))};_0x1f0b71['where']=_['merge'](_0x1f0b71[_0x834f('0x4b')],_0x1d2614);}_0x1f0b71=_[_0x834f('0x4f')]({},_0x1f0b71,_0x16b06b[_0x834f('0x6b')]);return db[_0x834f('0xa3')][_0x834f('0x2e')]({'where':_0x1f0b71[_0x834f('0x4b')]})[_0x834f('0x21')](function(_0x224b41){_0x4d5e4d[_0x834f('0x2e')]=_0x224b41;if(_0x16b06b[_0x834f('0x42')][_0x834f('0x52')]){_0x1f0b71['include']=[{'all':!![]}];}return db['FaxMessage'][_0x834f('0x53')](_0x1f0b71);})[_0x834f('0x21')](function(_0x8f8c27){_0x4d5e4d[_0x834f('0x54')]=_0x8f8c27;return _0x4d5e4d;});}})[_0x834f('0x21')](respondWithFilteredResult(_0x386bfa,_0x1f0b71))['catch'](handleError(_0x386bfa,null));};exports[_0x834f('0x3b')]=function(_0x18a98b,_0x342f7b,_0x4e143b){var _0x558eb9,_0x179544={},_0x1d46bd;if(_0x18a98b[_0x834f('0x62')]['to']){_0x1d46bd=_0x18a98b[_0x834f('0x62')]['to'][0x0];}return db[_0x834f('0x51')][_0x834f('0x60')]({'where':{'id':_0x18a98b[_0x834f('0x57')]['id']},'include':[{'model':db[_0x834f('0xa4')],'as':_0x834f('0xa5'),'include':[{'model':db[_0x834f('0x73')],'as':_0x834f('0xa6'),'where':{'fax':_0x1d46bd},'limit':0x1,'order':[[_0x834f('0x9a'),_0x834f('0xa7')]]}]}]})[_0x834f('0x21')](handleEntityNotFound(_0x342f7b,null))['then'](function(_0x4a3f89){_0x558eb9=_0x4a3f89;if(_0x18a98b['body']['attachments']&&_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][_0x834f('0x48')]){for(var _0x1c255a=0x0;_0x1c255a<_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')]['length'];_0x1c255a+=0x1){_0x18a98b['body'][_0x834f('0xa8')][_0x1c255a]={'filename':_0x18a98b['body']['attachments'][_0x1c255a][_0x834f('0x3a')],'id':_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][_0x1c255a]['id'],'path':path[_0x834f('0xa9')](config[_0x834f('0xaa')],_0x834f('0xab'),_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][_0x1c255a][_0x834f('0xac')])};}}return respondWithRpcPromise(_0x834f('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0x834f('0xae')](_0x18a98b[_0x834f('0x57')]['id'])?undefined:_0x18a98b[_0x834f('0x57')]['id'],'path':_[_0x834f('0xae')](_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][0x0]['path'])?undefined:_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][0x0][_0x834f('0x7')],'fax':_['isNil'](_0x18a98b[_0x834f('0x62')]['to'][0x0])?undefined:_0x18a98b[_0x834f('0x62')]['to'][0x0]},client9002);})['then'](function(){if(_0x558eb9){if(_[_0x834f('0xae')](_0x18a98b[_0x834f('0x62')][_0x834f('0xaf')])){_0x18a98b[_0x834f('0x62')][_0x834f('0xaf')]=util[_0x834f('0xa1')](_0x834f('0xb0'),_0x558eb9[_0x834f('0x3a')],_0x558eb9['fax']);}if(_0x558eb9['List']){if(_0x558eb9['List'][_0x834f('0xa6')]['length']){return _0x558eb9[_0x834f('0xa5')][_0x834f('0xa6')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x18a98b[_0x834f('0x62')],{'firstName':_0x18a98b[_0x834f('0x62')]['to'][0x0],'phone':_0x18a98b['body']['to'][0x0],'fax':_0x18a98b[_0x834f('0x62')]['to'][0x0],'ListId':_0x558eb9['ListId']}));}}else{throw new Error(_0x834f('0xb1'));}}else{throw new Error(_0x834f('0xb2'));}})[_0x834f('0x21')](function(_0x2d07ac){if(_0x2d07ac){return db[_0x834f('0x71')][_0x834f('0x60')]({'where':{'ContactId':_0x2d07ac['id'],'closed':![],'FaxAccountId':_0x558eb9['id']}})['then'](function(_0x1b28ca){if(_0x1b28ca){return[_0x1b28ca,![]];}return db[_0x834f('0x71')][_0x834f('0x5a')]({'UserId':_0x18a98b['user']['id'],'ContactId':_0x2d07ac['id'],'FaxAccountId':_0x558eb9['id'],'fax':_0x18a98b[_0x834f('0x62')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x18a98b['body'],{'read':![],'body':_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][0x0][_0x834f('0xb3')],'FaxAccountId':_0x558eb9['id'],'UserId':_0x18a98b['user']['id'],'ContactId':_0x2d07ac['id'],'AttachmentId':_0x18a98b[_0x834f('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x834f('0xa3')],'as':'Messages'}]})[_0x834f('0x21')](function(_0x2624fb){return[_0x2624fb,!![]];});});}else{throw new Error(_0x834f('0xb4'));}})[_0x834f('0xb5')](function(_0x453b26,_0x39fd49){if(_0x39fd49){return _0x453b26;}return db[_0x834f('0xa3')][_0x834f('0x5a')]({'direction':'out','read':![],'body':_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][0x0][_0x834f('0xb3')],'FaxAccountId':_0x558eb9['id'],'FaxInteractionId':_0x453b26['id'],'UserId':_0x18a98b[_0x834f('0x5e')]['id'],'ContactId':_0x453b26['ContactId'],'AttachmentId':_0x18a98b['body']['attachments'][0x0]['id']})['then'](function(_0x579689){_0x453b26[_0x834f('0xb6')][_0x834f('0xb7')]=[];_0x453b26[_0x834f('0xb6')][_0x834f('0xb7')][_0x834f('0x89')](_0x579689['dataValues']);return _0x453b26;});})[_0x834f('0x21')](function(_0x4fd9de){respondWithRpcPromise(_0x834f('0xb8'),_0x834f('0xb8'),{'FaxAccountId':_[_0x834f('0xae')](_0x18a98b[_0x834f('0x57')]['id'])?undefined:_0x18a98b[_0x834f('0x57')]['id'],'path':_['isNil'](_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][0x0][_0x834f('0x7')])?undefined:_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][0x0]['path'],'fax':_[_0x834f('0xae')](_0x18a98b[_0x834f('0x62')]['to'][0x0])?undefined:_0x18a98b[_0x834f('0x62')]['to'][0x0],'AttachmentId':_0x18a98b[_0x834f('0x62')][_0x834f('0xa8')][0x0]['id']},client9002)['then'](function(_0x3e1a38){logger['info'](_0x834f('0xb9'),_0x3e1a38);})['catch'](function(_0x564f9d){logger[_0x834f('0x22')](_0x834f('0xb9'),_0x564f9d);});return _0x4fd9de;})[_0x834f('0x21')](respondWithResult(_0x342f7b,null))['catch'](handleError(_0x342f7b,null));};exports[_0x834f('0xba')]=function(_0x37de95,_0x1e8f71,_0x3fae52){return db['FaxAccount'][_0x834f('0x60')]({'where':{'id':_0x37de95['params']['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x1e8f71,null))[_0x834f('0x21')](function(_0x97daa5){if(_0x97daa5){return _0x97daa5[_0x834f('0xba')](_0x37de95[_0x834f('0x62')][_0x834f('0x6d')],_[_0x834f('0x72')](_0x37de95[_0x834f('0x62')],[_0x834f('0x6d'),'id'])||{})['spread'](function(_0xb29ad2){for(var _0x4a2b94=0x0;_0x4a2b94<_0x37de95[_0x834f('0x62')][_0x834f('0x6d')][_0x834f('0x48')];_0x4a2b94+=0x1){socket[_0x834f('0xbb')]('userFaxAccount:save',{'UserId':_0x37de95[_0x834f('0x62')][_0x834f('0x6d')][_0x4a2b94],'FaxAccountId':_0x37de95[_0x834f('0x57')]['id']});}return _0xb29ad2;});}})[_0x834f('0x21')](respondWithResult(_0x1e8f71,null))[_0x834f('0x55')](handleError(_0x1e8f71,null));};exports[_0x834f('0xbc')]=function(_0x594015,_0x5a5a67,_0x3a269e){return db[_0x834f('0x51')][_0x834f('0x60')]({'where':{'id':_0x594015[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x5a5a67,null))[_0x834f('0x21')](function(_0x2ec869){if(_0x2ec869){return _0x2ec869[_0x834f('0xbc')](_0x594015[_0x834f('0x42')][_0x834f('0x6d')])[_0x834f('0x21')](function(){if(_['isArray'](_0x594015[_0x834f('0x42')][_0x834f('0x6d')])){for(var _0x29570c=0x0;_0x29570c<_0x594015['query'][_0x834f('0x6d')]['length'];_0x29570c+=0x1){socket[_0x834f('0xbb')]('userFaxAccount:remove',{'UserId':Number(_0x594015[_0x834f('0x42')]['ids'][_0x29570c]),'FaxAccountId':Number(_0x594015[_0x834f('0x57')]['id'])});}}else{socket['emit'](_0x834f('0xbd'),{'UserId':Number(_0x594015['query']['ids']),'FaxAccountId':Number(_0x594015['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5a5a67,null))[_0x834f('0x55')](handleError(_0x5a5a67,null));};exports[_0x834f('0xbe')]=function(_0x23aedf,_0x116990,_0x260b68){var _0x404e9a={};var _0x259b70={};var _0x4ba76b;var _0xfe7388;return db[_0x834f('0x51')][_0x834f('0x67')]({'where':{'id':_0x23aedf[_0x834f('0x57')]['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x116990,null))[_0x834f('0x21')](function(_0x485515){if(_0x485515){_0x4ba76b=_0x485515;_0x259b70[_0x834f('0x45')]=_[_0x834f('0x43')](db[_0x834f('0x74')][_0x834f('0x3d')]);_0x259b70[_0x834f('0x42')]=_['keys'](_0x23aedf['query']);_0x259b70['filters']=_[_0x834f('0x44')](_0x259b70[_0x834f('0x45')],_0x259b70[_0x834f('0x42')]);_0x404e9a[_0x834f('0x46')]=_[_0x834f('0x44')](_0x259b70['model'],qs[_0x834f('0x47')](_0x23aedf[_0x834f('0x42')][_0x834f('0x47')]));_0x404e9a[_0x834f('0x46')]=_0x404e9a[_0x834f('0x46')][_0x834f('0x48')]?_0x404e9a[_0x834f('0x46')]:_0x259b70['model'];_0x404e9a[_0x834f('0x49')]=qs[_0x834f('0x4a')](_0x23aedf[_0x834f('0x42')][_0x834f('0x4a')]);_0x404e9a[_0x834f('0x4b')]=qs['filters'](_[_0x834f('0x4d')](_0x23aedf[_0x834f('0x42')],_0x259b70[_0x834f('0x4c')]));if(_0x23aedf['query'][_0x834f('0x4e')]){_0x404e9a['where']=_[_0x834f('0x4f')](_0x404e9a[_0x834f('0x4b')],{'$or':_[_0x834f('0x41')](_0x404e9a[_0x834f('0x46')],function(_0x457b28){var _0x40e5d5={};_0x40e5d5[_0x457b28]={'$like':'%'+_0x23aedf[_0x834f('0x42')][_0x834f('0x4e')]+'%'};return _0x40e5d5;})});}_0x404e9a=_[_0x834f('0x4f')]({},_0x404e9a,_0x23aedf[_0x834f('0x6b')]);return _0x4ba76b[_0x834f('0xbe')](_0x404e9a);}})['then'](function(_0x464a76){if(_0x464a76){_0xfe7388=_0x464a76[_0x834f('0x48')];if(!_0x23aedf[_0x834f('0x42')][_0x834f('0x69')](_0x834f('0x6a'))){_0x404e9a[_0x834f('0x30')]=qs[_0x834f('0x30')](_0x23aedf['query']['limit']);_0x404e9a[_0x834f('0x2f')]=qs[_0x834f('0x2f')](_0x23aedf[_0x834f('0x42')][_0x834f('0x2f')]);}return _0x4ba76b[_0x834f('0xbe')](_0x404e9a);}})['then'](function(_0x4e0a24){if(_0x4e0a24){return _0x4e0a24?{'count':_0xfe7388,'rows':_0x4e0a24}:null;}})[_0x834f('0x21')](respondWithResult(_0x116990,null))[_0x834f('0x55')](handleError(_0x116990,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1c6997d..17285b3 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 _0x00e7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','FaxAccount'];(function(_0x59d86b,_0x46c0b1){var _0x45f578=function(_0x55581d){while(--_0x55581d){_0x59d86b['push'](_0x59d86b['shift']());}};_0x45f578(++_0x46c0b1);}(_0x00e7,0x1b7));var _0x700e=function(_0x37b0da,_0x42982f){_0x37b0da=_0x37b0da-0x0;var _0x18c5b6=_0x00e7[_0x37b0da];return _0x18c5b6;};'use strict';var EventEmitter=require(_0x700e('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x700e('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x700e('0x2')](0x0);var events={'afterCreate':_0x700e('0x3'),'afterUpdate':_0x700e('0x4'),'afterDestroy':_0x700e('0x5')};function emitEvent(_0x574dfe){return function(_0xe9db48,_0x6fd331,_0x2c840e){FaxAccountEvents['emit'](_0x574dfe+':'+_0xe9db48['id'],_0xe9db48);FaxAccountEvents[_0x700e('0x6')](_0x574dfe,_0xe9db48);_0x2c840e(null);};}for(var e in events){if(events[_0x700e('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x700e('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xbaae=['../../mysqldb','FaxAccount','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbaae,0x182));var _0xebaa=function(_0xc2b4a7,_0x4ac6d4){_0xc2b4a7=_0xc2b4a7-0x0;var _0x5d67e3=_0xbaae[_0xc2b4a7];return _0x5d67e3;};'use strict';var EventEmitter=require(_0xebaa('0x0'));var FaxAccount=require(_0xebaa('0x1'))['db'][_0xebaa('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xebaa('0x3'),'afterDestroy':_0xebaa('0x4')};function emitEvent(_0xe5b41c){return function(_0x2906b0,_0xeffa24,_0x33af59){FaxAccountEvents['emit'](_0xe5b41c+':'+_0x2906b0['id'],_0x2906b0);FaxAccountEvents[_0xebaa('0x5')](_0xe5b41c,_0x2906b0);_0x33af59(null);};}for(var e in events){if(events[_0xebaa('0x6')](e)){var event=events[e];FaxAccount[_0xebaa('0x7')](e,emitEvent(event));}}module[_0xebaa('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 83889d9..c315f67 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 _0xf9d3=['fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf9d3,0x79));var _0x3f9d=function(_0x5ae8fc,_0x4ebbe4){_0x5ae8fc=_0x5ae8fc-0x0;var _0x55decd=_0xf9d3[_0x5ae8fc];return _0x55decd;};'use strict';var _=require(_0x3f9d('0x0'));var util=require('util');var logger=require(_0x3f9d('0x1'))('api');var moment=require(_0x3f9d('0x2'));var BPromise=require(_0x3f9d('0x3'));var rp=require(_0x3f9d('0x4'));var fs=require('fs');var path=require(_0x3f9d('0x5'));var rimraf=require(_0x3f9d('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f9d('0x7'));module[_0x3f9d('0x8')]=function(_0x36b60c,_0x4e41de){return _0x36b60c[_0x3f9d('0x9')](_0x3f9d('0xa'),attributes,{'tableName':_0x3f9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3370=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','define','FaxAccount'];(function(_0xf1c2f5,_0x45c2a3){var _0x310286=function(_0x3ea914){while(--_0x3ea914){_0xf1c2f5['push'](_0xf1c2f5['shift']());}};_0x310286(++_0x45c2a3);}(_0x3370,0xbb));var _0x0337=function(_0x55aad5,_0x49012d){_0x55aad5=_0x55aad5-0x0;var _0x4f2f92=_0x3370[_0x55aad5];return _0x4f2f92;};'use strict';var _=require(_0x0337('0x0'));var util=require('util');var logger=require(_0x0337('0x1'))(_0x0337('0x2'));var moment=require(_0x0337('0x3'));var BPromise=require(_0x0337('0x4'));var rp=require(_0x0337('0x5'));var fs=require('fs');var path=require(_0x0337('0x6'));var rimraf=require(_0x0337('0x7'));var config=require('../../config/environment');var attributes=require(_0x0337('0x8'));module['exports']=function(_0x102652,_0x2ad040){return _0x102652[_0x0337('0x9')](_0x0337('0xa'),attributes,{'tableName':'fax_accounts','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 5ece0ca..aea6bd6 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 _0x86d8=['asc','create','contact','fax','FaxInteraction','find','Contact\x20not\x20found','spread','get','push','close','created','interaction','FaxMessage','ContactId','UserId','User','unshift','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount','options','raw','limit','map','include','model','attributes','stringify','body','describe','Sequelize','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','Contacts','FaxApplication','Applications','applications','list','orderBy','priority'];(function(_0x25561,_0x561c77){var _0x59a6c0=function(_0x614592){while(--_0x614592){_0x25561['push'](_0x25561['shift']());}};_0x59a6c0(++_0x561c77);}(_0x86d8,0xc9));var _0x886d=function(_0x599b00,_0x3ff97f){_0x599b00=_0x599b00-0x0;var _0x24d5e2=_0x86d8[_0x599b00];return _0x24d5e2;};'use strict';var _=require(_0x886d('0x0'));var util=require(_0x886d('0x1'));var moment=require(_0x886d('0x2'));var BPromise=require(_0x886d('0x3'));var rs=require(_0x886d('0x4'));var fs=require('fs');var Redis=require(_0x886d('0x5'));var db=require(_0x886d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x886d('0x7'));var config=require(_0x886d('0x8'));var jayson=require(_0x886d('0x9'));var client=jayson['client'][_0x886d('0xa')]({'port':0x232c});config[_0x886d('0xb')]=_[_0x886d('0xc')](config[_0x886d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x886d('0xd'))(new Redis(config[_0x886d('0xb')]));require(_0x886d('0xe'))[_0x886d('0xf')](socket);function respondWithRpcPromise(_0x3fd819,_0x4cec2e,_0x15427a){return new BPromise(function(_0x2c56eb,_0x5e89b1){return client[_0x886d('0x10')](_0x3fd819,_0x15427a)[_0x886d('0x11')](function(_0x4858c9){logger[_0x886d('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4cec2e,_0x886d('0x13'));logger[_0x886d('0x14')](_0x886d('0x15'),_0x4cec2e,_0x886d('0x13'),JSON['stringify'](_0x4858c9));if(_0x4858c9['error']){if(_0x4858c9[_0x886d('0x16')][_0x886d('0x17')]===0x1f4){logger[_0x886d('0x16')](_0x886d('0x18'),_0x4cec2e,_0x4858c9[_0x886d('0x16')][_0x886d('0x19')]);return _0x5e89b1(_0x4858c9['error'][_0x886d('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x4cec2e,_0x4858c9[_0x886d('0x16')]['message']);return _0x2c56eb(_0x4858c9[_0x886d('0x16')][_0x886d('0x19')]);}else{logger[_0x886d('0x12')](_0x886d('0x18'),_0x4cec2e,'request\x20sent');_0x2c56eb(_0x4858c9['result'][_0x886d('0x19')]);}})[_0x886d('0x1a')](function(_0x370031){logger[_0x886d('0x16')]('FaxAccount,\x20%s,\x20%s',_0x4cec2e,_0x370031);_0x5e89b1(_0x370031);});});}exports[_0x886d('0x1b')]=function(_0x443d92){var _0x5b6437=this;return new Promise(function(_0x16688c,_0x439583){return db[_0x886d('0x1c')]['findAll']({'raw':_0x443d92[_0x886d('0x1d')]?_0x443d92[_0x886d('0x1d')][_0x886d('0x1e')]===undefined?!![]:![]:!![],'where':_0x443d92[_0x886d('0x1d')]?_0x443d92[_0x886d('0x1d')]['where']||null:null,'attributes':_0x443d92[_0x886d('0x1d')]?_0x443d92[_0x886d('0x1d')]['attributes']||null:null,'limit':_0x443d92[_0x886d('0x1d')]?_0x443d92['options'][_0x886d('0x1f')]||null:null,'include':_0x443d92[_0x886d('0x1d')]?_0x443d92['options']['include']?_[_0x886d('0x20')](_0x443d92[_0x886d('0x1d')][_0x886d('0x21')],function(_0x12519d){return{'model':db[_0x12519d[_0x886d('0x22')]],'as':_0x12519d['as'],'attributes':_0x12519d[_0x886d('0x23')],'include':_0x12519d[_0x886d('0x21')]?_[_0x886d('0x20')](_0x12519d[_0x886d('0x21')],function(_0x8422a2){return{'model':db[_0x8422a2[_0x886d('0x22')]],'as':_0x8422a2['as'],'attributes':_0x8422a2[_0x886d('0x23')],'include':_0x8422a2[_0x886d('0x21')]?_[_0x886d('0x20')](_0x8422a2[_0x886d('0x21')],function(_0x584476){return{'model':db[_0x584476[_0x886d('0x22')]],'as':_0x584476['as'],'attributes':_0x584476[_0x886d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x886d('0x11')](function(_0x561d30){logger['info'](_0x886d('0x1b'),_0x443d92);logger[_0x886d('0x14')](_0x886d('0x1b'),_0x443d92,JSON[_0x886d('0x24')](_0x561d30));_0x16688c(_0x561d30);})['catch'](function(_0x270433){logger['error'](_0x886d('0x1b'),_0x270433[_0x886d('0x19')],_0x443d92);_0x439583(_0x5b6437['error'](0x1f4,_0x270433[_0x886d('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x49e98f,_0x41cbd1,_0x550dd1){var _0x2a91b6=this;return new Promise(function(_0x3c2115,_0x52b38a){var _0x87660c={'body':_0x49e98f[_0x886d('0x25')],'channel':'fax'};var _0x9eab95=[];var _0x2c48a2=[];var _0x50c229={};return db['CmContact'][_0x886d('0x26')]()[_0x886d('0x11')](function(_0x490a7f){if(!_0x490a7f){throw new db[(_0x886d('0x27'))]['ValidationError'](_0x886d('0x28'));}_0x9eab95=_['difference'](_[_0x886d('0x29')](_0x490a7f),[_0x886d('0x2a'),'updatedAt']);_0x2c48a2=_[_0x886d('0x2b')](_[_0x886d('0x29')](_0x490a7f),[_0x886d('0x2a'),_0x886d('0x2c'),_0x886d('0x2d'),_0x886d('0x2e')]);if(_0x49e98f['body']['id']){delete _0x49e98f[_0x886d('0x25')]['id'];}if(_['isNil'](_0x49e98f[_0x886d('0x25')][_0x886d('0x2f')])){throw new db[(_0x886d('0x27'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x886d('0x30')](_0x49e98f[_0x886d('0x25')][_0x886d('0x25')])||_0x49e98f[_0x886d('0x25')][_0x886d('0x25')]===''){throw new db[(_0x886d('0x27'))]['ValidationError'](_0x886d('0x31'));}if(_['isNil'](_0x49e98f['body'][_0x886d('0x32')])){throw new db[(_0x886d('0x27'))][(_0x886d('0x33'))](_0x886d('0x34')+_0x2c48a2);}if(!_[_0x886d('0x35')](_0x2c48a2,_0x49e98f['body'][_0x886d('0x32')])){throw new db[(_0x886d('0x27'))][(_0x886d('0x33'))](_0x886d('0x36')+_0x2c48a2);}_0x50c229[_0x49e98f[_0x886d('0x25')]['mapKey']]=_0x49e98f[_0x886d('0x25')]['from'];})['then'](function(){return db[_0x886d('0x1c')]['find']({'where':{'id':_0x49e98f[_0x886d('0x37')]['id']},'include':[{'model':db[_0x886d('0x38')],'as':_0x886d('0x39'),'include':[{'model':db[_0x886d('0x3a')],'as':_0x886d('0x3b'),'where':_0x50c229,'limit':0x1,'order':[[_0x886d('0x2c'),'DESC']]}]},{'model':db[_0x886d('0x3c')],'as':_0x886d('0x3d')}]});})[_0x886d('0x11')](function(_0x5e9b26){if(_0x5e9b26&&_0x5e9b26[_0x886d('0x39')]){var _0x3d57eb=_0x5e9b26['get']({'plain':!![]});_0x87660c[_0x886d('0x37')]=_0x3d57eb;_0x87660c[_0x886d('0x3e')]=_0x3d57eb[_0x886d('0x3d')];_0x87660c[_0x886d('0x3f')]=_0x3d57eb['List'];_0x87660c[_0x886d('0x3e')]=_[_0x886d('0x40')](_0x87660c['applications'],[_0x886d('0x41')],[_0x886d('0x42')]);if(_0x87660c[_0x886d('0x37')]['Applications']){delete _0x87660c['account'][_0x886d('0x3d')];}if(_0x87660c['account'][_0x886d('0x39')]&&_0x87660c['account']['List'][_0x886d('0x3b')]['length']){return _0x87660c[_0x886d('0x37')][_0x886d('0x39')][_0x886d('0x3b')][0x0];}var _0x5c6e58=_[_0x886d('0xc')](_0x49e98f['body'],{'firstName':_0x49e98f[_0x886d('0x25')]['from'],'ListId':_0x3d57eb[_0x886d('0x2e')]});_0x5c6e58[_0x49e98f[_0x886d('0x25')]['mapKey']]=_0x49e98f[_0x886d('0x25')][_0x886d('0x2f')];return db[_0x886d('0x3a')][_0x886d('0x43')](_0x5c6e58,{'fields':_0x9eab95,'raw':!![]});}})['then'](function(_0x3de25c){_0x87660c[_0x886d('0x44')]=_0x3de25c;if(_0x3de25c){var _0x5c00c5={'ContactId':_0x3de25c['id'],'FaxAccountId':_0x49e98f[_0x886d('0x37')]['id'],'fax':_0x3de25c[_0x886d('0x45')]};return db[_0x886d('0x46')][_0x886d('0x47')]({'where':{'ContactId':_0x3de25c['id'],'closed':![],'FaxAccountId':_0x49e98f[_0x886d('0x37')]['id']}})[_0x886d('0x11')](function(_0x4c363e){if(_0x4c363e){return[_0x4c363e,![]];}return db[_0x886d('0x46')][_0x886d('0x43')](_0x5c00c5)['then'](function(_0x5b24ba){return[_0x5b24ba,!![]];});});}else{throw new Error(_0x886d('0x48'));}})[_0x886d('0x49')](function(_0xaba037,_0x3e8097){var _0x292b08=_0xaba037[_0x886d('0x4a')]({'plain':!![]});if(_0x3e8097){if(_0x87660c['account']['autoclose']){_0x87660c[_0x886d('0x3e')][_0x886d('0x4b')]({'id':0x0,'priority':_0x87660c[_0x886d('0x3e')]['length']+0x1,'app':_0x886d('0x4c'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x292b08[_0x886d('0x4d')]=!![];}else{_0x292b08[_0x886d('0x4d')]=![];}_0x87660c[_0x886d('0x4e')]=_0x292b08;return db[_0x886d('0x4f')][_0x886d('0x43')]({'body':_0x49e98f['body'][_0x886d('0x25')],'FaxAccountId':_0x49e98f[_0x886d('0x37')]['id'],'FaxInteractionId':_0xaba037['id'],'direction':'in','ContactId':_0xaba037[_0x886d('0x50')],'AttachmentId':_0x49e98f[_0x886d('0x25')]['AttachmentId']});})['then'](function(_0x49b832){_0x87660c[_0x886d('0x19')]=_0x49b832;if(_0x87660c['interaction'][_0x886d('0x51')]){return db[_0x886d('0x52')][_0x886d('0x47')]({'attributes':['id','name'],'where':{'id':_0x87660c['interaction'][_0x886d('0x51')]}})[_0x886d('0x11')](function(_0x4004dd){if(_0x4004dd){_0x87660c[_0x886d('0x3e')][_0x886d('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4004dd[_0x886d('0x54')]+','+(_0x87660c['account'][_0x886d('0x55')]||0xa),'interval':_0x886d('0x56')});}return respondWithRpcPromise('Start',_0x886d('0x57'),_0x87660c);});}return respondWithRpcPromise(_0x886d('0x58'),'startRouting',_0x87660c);})[_0x886d('0x11')](function(_0x80875e){_0x3c2115(_0x80875e);})[_0x886d('0x1a')](function(_0x3e3bbe){_0x52b38a(_0x2a91b6[_0x886d('0x16')](0x1f4,_0x3e3bbe['message']));});});}; \ No newline at end of file +var _0x069f=['ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','body','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','created','interaction','FaxMessage','ContactId','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','map','include','model','NotifyFaxAccount','fax','CmContact','then','Sequelize'];(function(_0x19e2fa,_0x2b801e){var _0x3ec1d=function(_0x58be23){while(--_0x58be23){_0x19e2fa['push'](_0x19e2fa['shift']());}};_0x3ec1d(++_0x2b801e);}(_0x069f,0x194));var _0xf069=function(_0x51057a,_0x2c8c27){_0x51057a=_0x51057a-0x0;var _0x3cbdaa=_0x069f[_0x51057a];return _0x3cbdaa;};'use strict';var _=require(_0xf069('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf069('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf069('0x2'));var db=require(_0xf069('0x3'))['db'];var utils=require(_0xf069('0x4'));var logger=require(_0xf069('0x5'))(_0xf069('0x6'));var config=require(_0xf069('0x7'));var jayson=require(_0xf069('0x8'));var client=jayson[_0xf069('0x9')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0xf069('0xa')],{'host':_0xf069('0xb'),'port':0x18eb});var socket=require(_0xf069('0xc'))(new Redis(config[_0xf069('0xa')]));require(_0xf069('0xd'))['register'](socket);function respondWithRpcPromise(_0x39c5ac,_0x2883c2,_0x262a54){return new BPromise(function(_0x41801f,_0x586d9c){return client[_0xf069('0xe')](_0x39c5ac,_0x262a54)['then'](function(_0x58593c){logger[_0xf069('0xf')](_0xf069('0x10'),_0x2883c2,_0xf069('0x11'));logger[_0xf069('0x12')](_0xf069('0x13'),_0x2883c2,'request\x20sent',JSON[_0xf069('0x14')](_0x58593c));if(_0x58593c['error']){if(_0x58593c[_0xf069('0x15')][_0xf069('0x16')]===0x1f4){logger[_0xf069('0x15')](_0xf069('0x10'),_0x2883c2,_0x58593c[_0xf069('0x15')][_0xf069('0x17')]);return _0x586d9c(_0x58593c[_0xf069('0x15')][_0xf069('0x17')]);}logger[_0xf069('0x15')](_0xf069('0x10'),_0x2883c2,_0x58593c[_0xf069('0x15')][_0xf069('0x17')]);return _0x41801f(_0x58593c[_0xf069('0x15')][_0xf069('0x17')]);}else{logger[_0xf069('0xf')](_0xf069('0x10'),_0x2883c2,_0xf069('0x11'));_0x41801f(_0x58593c[_0xf069('0x18')][_0xf069('0x17')]);}})[_0xf069('0x19')](function(_0x59114e){logger[_0xf069('0x15')](_0xf069('0x10'),_0x2883c2,_0x59114e);_0x586d9c(_0x59114e);});});}exports[_0xf069('0x1a')]=function(_0x46d042){var _0x5dd9f4=this;return new Promise(function(_0x20eff1,_0x996fa2){return db[_0xf069('0x1b')][_0xf069('0x1c')]({'raw':_0x46d042[_0xf069('0x1d')]?_0x46d042[_0xf069('0x1d')][_0xf069('0x1e')]===undefined?!![]:![]:!![],'where':_0x46d042[_0xf069('0x1d')]?_0x46d042[_0xf069('0x1d')][_0xf069('0x1f')]||null:null,'attributes':_0x46d042[_0xf069('0x1d')]?_0x46d042['options'][_0xf069('0x20')]||null:null,'limit':_0x46d042['options']?_0x46d042['options']['limit']||null:null,'include':_0x46d042[_0xf069('0x1d')]?_0x46d042['options']['include']?_[_0xf069('0x21')](_0x46d042['options'][_0xf069('0x22')],function(_0x536004){return{'model':db[_0x536004['model']],'as':_0x536004['as'],'attributes':_0x536004[_0xf069('0x20')],'include':_0x536004[_0xf069('0x22')]?_[_0xf069('0x21')](_0x536004[_0xf069('0x22')],function(_0x2f9e7c){return{'model':db[_0x2f9e7c[_0xf069('0x23')]],'as':_0x2f9e7c['as'],'attributes':_0x2f9e7c['attributes'],'include':_0x2f9e7c[_0xf069('0x22')]?_[_0xf069('0x21')](_0x2f9e7c[_0xf069('0x22')],function(_0x944f94){return{'model':db[_0x944f94[_0xf069('0x23')]],'as':_0x944f94['as'],'attributes':_0x944f94[_0xf069('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39ec49){logger['info'](_0xf069('0x1a'),_0x46d042);logger[_0xf069('0x12')](_0xf069('0x1a'),_0x46d042,JSON[_0xf069('0x14')](_0x39ec49));_0x20eff1(_0x39ec49);})[_0xf069('0x19')](function(_0x4bc4c5){logger[_0xf069('0x15')]('GetFaxAccount',_0x4bc4c5[_0xf069('0x17')],_0x46d042);_0x996fa2(_0x5dd9f4[_0xf069('0x15')](0x1f4,_0x4bc4c5[_0xf069('0x17')]));});});};exports[_0xf069('0x24')]=function(_0x54ec8a,_0x25b635,_0x1d0554){var _0x2e48d3=this;return new Promise(function(_0x7f88e6,_0x1253c6){var _0x161ba6={'body':_0x54ec8a['body'],'channel':_0xf069('0x25')};var _0xe29a47=[];var _0x4bea73=[];var _0x3799a4={};return db[_0xf069('0x26')]['describe']()[_0xf069('0x27')](function(_0x1a29dc){if(!_0x1a29dc){throw new db[(_0xf069('0x28'))][(_0xf069('0x29'))](_0xf069('0x2a'));}_0xe29a47=_[_0xf069('0x2b')](_[_0xf069('0x2c')](_0x1a29dc),[_0xf069('0x2d'),_0xf069('0x2e')]);_0x4bea73=_['difference'](_[_0xf069('0x2c')](_0x1a29dc),[_0xf069('0x2d'),'updatedAt',_0xf069('0x2f'),'ListId']);if(_0x54ec8a['body']['id']){delete _0x54ec8a[_0xf069('0x30')]['id'];}if(_['isNil'](_0x54ec8a[_0xf069('0x30')]['from'])){throw new db[(_0xf069('0x28'))][(_0xf069('0x29'))](_0xf069('0x31'));}if(_[_0xf069('0x32')](_0x54ec8a[_0xf069('0x30')]['body'])||_0x54ec8a[_0xf069('0x30')][_0xf069('0x30')]===''){throw new db[(_0xf069('0x28'))][(_0xf069('0x29'))](_0xf069('0x33'));}if(_[_0xf069('0x32')](_0x54ec8a[_0xf069('0x30')][_0xf069('0x34')])){throw new db['Sequelize'][(_0xf069('0x29'))](_0xf069('0x35')+_0x4bea73);}if(!_['includes'](_0x4bea73,_0x54ec8a[_0xf069('0x30')][_0xf069('0x34')])){throw new db[(_0xf069('0x28'))][(_0xf069('0x29'))](_0xf069('0x36')+_0x4bea73);}_0x3799a4[_0x54ec8a[_0xf069('0x30')][_0xf069('0x34')]]=_0x54ec8a[_0xf069('0x30')]['from'];})[_0xf069('0x27')](function(){return db['FaxAccount'][_0xf069('0x37')]({'where':{'id':_0x54ec8a[_0xf069('0x38')]['id']},'include':[{'model':db[_0xf069('0x39')],'as':_0xf069('0x3a'),'include':[{'model':db['CmContact'],'as':_0xf069('0x3b'),'where':_0x3799a4,'limit':0x1,'order':[['updatedAt',_0xf069('0x3c')]]}]},{'model':db[_0xf069('0x3d')],'as':_0xf069('0x3e')}]});})[_0xf069('0x27')](function(_0x3b1829){if(_0x3b1829&&_0x3b1829[_0xf069('0x3a')]){var _0x15a727=_0x3b1829[_0xf069('0x3f')]({'plain':!![]});_0x161ba6[_0xf069('0x38')]=_0x15a727;_0x161ba6['applications']=_0x15a727[_0xf069('0x3e')];_0x161ba6['list']=_0x15a727[_0xf069('0x3a')];_0x161ba6[_0xf069('0x40')]=_['orderBy'](_0x161ba6['applications'],[_0xf069('0x41')],[_0xf069('0x42')]);if(_0x161ba6[_0xf069('0x38')][_0xf069('0x3e')]){delete _0x161ba6[_0xf069('0x38')]['Applications'];}if(_0x161ba6[_0xf069('0x38')]['List']&&_0x161ba6[_0xf069('0x38')]['List'][_0xf069('0x3b')][_0xf069('0x43')]){return _0x161ba6[_0xf069('0x38')][_0xf069('0x3a')][_0xf069('0x3b')][0x0];}var _0x46007e=_['defaults'](_0x54ec8a[_0xf069('0x30')],{'firstName':_0x54ec8a['body']['from'],'ListId':_0x15a727[_0xf069('0x44')]});_0x46007e[_0x54ec8a[_0xf069('0x30')]['mapKey']]=_0x54ec8a[_0xf069('0x30')]['from'];return db[_0xf069('0x26')][_0xf069('0x45')](_0x46007e,{'fields':_0xe29a47,'raw':!![]});}})['then'](function(_0x10847d){_0x161ba6[_0xf069('0x46')]=_0x10847d;if(_0x10847d){var _0x3a4302={'ContactId':_0x10847d['id'],'FaxAccountId':_0x54ec8a['account']['id'],'fax':_0x10847d['fax']};return db[_0xf069('0x47')][_0xf069('0x37')]({'where':{'ContactId':_0x10847d['id'],'closed':![],'FaxAccountId':_0x54ec8a['account']['id']}})[_0xf069('0x27')](function(_0x229e37){if(_0x229e37){return[_0x229e37,![]];}return db[_0xf069('0x47')][_0xf069('0x45')](_0x3a4302)[_0xf069('0x27')](function(_0x23f682){return[_0x23f682,!![]];});});}else{throw new Error(_0xf069('0x48'));}})[_0xf069('0x49')](function(_0x1f4d59,_0x199247){var _0x575b7c=_0x1f4d59[_0xf069('0x3f')]({'plain':!![]});if(_0x199247){if(_0x161ba6['account'][_0xf069('0x4a')]){_0x161ba6['applications'][_0xf069('0x4b')]({'id':0x0,'priority':_0x161ba6[_0xf069('0x40')][_0xf069('0x43')]+0x1,'app':'close','appdata':_0xf069('0x4c'),'interval':'*,*,*,*'});}_0x575b7c[_0xf069('0x4d')]=!![];}else{_0x575b7c[_0xf069('0x4d')]=![];}_0x161ba6[_0xf069('0x4e')]=_0x575b7c;return db[_0xf069('0x4f')][_0xf069('0x45')]({'body':_0x54ec8a[_0xf069('0x30')][_0xf069('0x30')],'FaxAccountId':_0x54ec8a[_0xf069('0x38')]['id'],'FaxInteractionId':_0x1f4d59['id'],'direction':'in','ContactId':_0x1f4d59[_0xf069('0x50')],'AttachmentId':_0x54ec8a[_0xf069('0x30')]['AttachmentId']});})[_0xf069('0x27')](function(_0x3f5c72){_0x161ba6[_0xf069('0x17')]=_0x3f5c72;if(_0x161ba6['interaction'][_0xf069('0x51')]){return db[_0xf069('0x52')][_0xf069('0x37')]({'attributes':['id',_0xf069('0x53')],'where':{'id':_0x161ba6['interaction']['UserId']}})[_0xf069('0x27')](function(_0x36f548){if(_0x36f548){_0x161ba6[_0xf069('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf069('0x54'),'appdata':_0x36f548[_0xf069('0x53')]+','+(_0x161ba6[_0xf069('0x38')][_0xf069('0x55')]||0xa),'interval':_0xf069('0x56')});}return respondWithRpcPromise(_0xf069('0x57'),_0xf069('0x58'),_0x161ba6);});}return respondWithRpcPromise(_0xf069('0x57'),'startRouting',_0x161ba6);})[_0xf069('0x27')](function(_0x51cfbc){_0x7f88e6(_0x51cfbc);})[_0xf069('0x19')](function(_0x4c6b1b){_0x1253c6(_0x2e48d3[_0xf069('0x15')](0x1f4,_0x4c6b1b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 298dc29..10f130e 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 _0x0adf=['emit','removeListener','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x1a5443,_0xefe890){var _0x2d48c6=function(_0x1519fd){while(--_0x1519fd){_0x1a5443['push'](_0x1a5443['shift']());}};_0x2d48c6(++_0xefe890);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x27eeca,_0x1219bf){_0x27eeca=_0x27eeca-0x0;var _0xfc09aa=_0x0adf[_0x27eeca];return _0xfc09aa;};'use strict';var FaxAccountEvents=require(_0xf0ad('0x0'));var events=[_0xf0ad('0x1'),_0xf0ad('0x2'),'update'];function createListener(_0x4a97fd,_0x10cf5b){return function(_0x5d1191){_0x10cf5b[_0xf0ad('0x3')](_0x4a97fd,_0x5d1191);};}function removeListener(_0x27d666,_0x459e70){return function(){FaxAccountEvents[_0xf0ad('0x4')](_0x27d666,_0x459e70);};}exports['register']=function(_0x3bbf85){for(var _0x53221f=0x0,_0x2eca0e=events[_0xf0ad('0x5')];_0x53221f<_0x2eca0e;_0x53221f++){var _0x170574=events[_0x53221f];var _0x41c99d=createListener(_0xf0ad('0x6')+_0x170574,_0x3bbf85);FaxAccountEvents['on'](_0x170574,_0x41c99d);}}; \ No newline at end of file +var _0x5204=['length','./faxAccount.events','save','update','emit','register'];(function(_0x4e62af,_0x3b7fbb){var _0x20f6ad=function(_0x8d61c9){while(--_0x8d61c9){_0x4e62af['push'](_0x4e62af['shift']());}};_0x20f6ad(++_0x3b7fbb);}(_0x5204,0xdf));var _0x4520=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x5204[_0x486f4a];return _0x135d99;};'use strict';var FaxAccountEvents=require(_0x4520('0x0'));var events=[_0x4520('0x1'),'remove',_0x4520('0x2')];function createListener(_0x3bf0b1,_0x10cbc2){return function(_0x36caca){_0x10cbc2[_0x4520('0x3')](_0x3bf0b1,_0x36caca);};}function removeListener(_0x592fe0,_0x41d89c){return function(){FaxAccountEvents['removeListener'](_0x592fe0,_0x41d89c);};}exports[_0x4520('0x4')]=function(_0x209381){for(var _0xe0a256=0x0,_0xe741c2=events[_0x4520('0x5')];_0xe0a256<_0xe741c2;_0xe0a256++){var _0x446dc9=events[_0xe0a256];var _0x27890f=createListener('faxAccount:'+_0x446dc9,_0x209381);FaxAccountEvents['on'](_0x446dc9,_0x27890f);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7af2d85..45a369b 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 _0x1d70=['removeDispositions','removeAgents','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','put','delete'];(function(_0x5f72ad,_0x5eaae9){var _0x21d654=function(_0x383fa5){while(--_0x383fa5){_0x5f72ad['push'](_0x5f72ad['shift']());}};_0x21d654(++_0x5eaae9);}(_0x1d70,0x133));var _0x01d7=function(_0xc2c752,_0x445d30){_0xc2c752=_0xc2c752-0x0;var _0x14aadb=_0x1d70[_0xc2c752];return _0x14aadb;};'use strict';var multer=require(_0x01d7('0x0'));var util=require(_0x01d7('0x1'));var path=require('path');var timeout=require(_0x01d7('0x2'));var express=require('express');var router=express[_0x01d7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x01d7('0x4'));var config=require(_0x01d7('0x5'));var controller=require(_0x01d7('0x6'));router[_0x01d7('0x7')]('/',auth[_0x01d7('0x8')](),controller[_0x01d7('0x9')]);router[_0x01d7('0x7')]('/describe',auth[_0x01d7('0x8')](),controller['describe']);router[_0x01d7('0x7')](_0x01d7('0xa'),auth['isAuthenticated'](),controller[_0x01d7('0xb')]);router[_0x01d7('0x7')](_0x01d7('0xc'),auth[_0x01d7('0x8')](),controller[_0x01d7('0xd')]);router[_0x01d7('0x7')]('/:id/canned_answers',auth[_0x01d7('0x8')](),controller[_0x01d7('0xe')]);router[_0x01d7('0x7')](_0x01d7('0xf'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x10')]);router[_0x01d7('0x7')](_0x01d7('0x11'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x12')]);router['get'](_0x01d7('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0x01d7('0x7')](_0x01d7('0x14'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x15')]);router[_0x01d7('0x16')]('/',auth['isAuthenticated'](),controller[_0x01d7('0x17')]);router[_0x01d7('0x16')](_0x01d7('0xc'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x18')]);router[_0x01d7('0x16')](_0x01d7('0x19'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x1a')]);router['post'](_0x01d7('0xf'),auth['isAuthenticated'](),controller[_0x01d7('0x1b')]);router['post'](_0x01d7('0x11'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x1c')]);router[_0x01d7('0x16')](_0x01d7('0x1d'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x1e')]);router[_0x01d7('0x16')](_0x01d7('0x1f'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post'](_0x01d7('0x20'),auth['isAuthenticated'](),controller['send']);router['post'](_0x01d7('0x14'),auth[_0x01d7('0x8')](),controller['addAgents']);router[_0x01d7('0x21')](_0x01d7('0xa'),auth[_0x01d7('0x8')](),controller['update']);router[_0x01d7('0x22')](_0x01d7('0xa'),auth[_0x01d7('0x8')](),controller['destroy']);router[_0x01d7('0x22')](_0x01d7('0xc'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x23')]);router[_0x01d7('0x22')](_0x01d7('0x19'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x01d7('0x22')]('/:id/users',auth[_0x01d7('0x8')](),controller[_0x01d7('0x24')]);module[_0x01d7('0x25')]=router; \ No newline at end of file +var _0xfca2=['getAnswers','/:id/interactions','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','addInteraction','updateAccountApplications','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers'];(function(_0x8d298e,_0x2daafd){var _0x4b76a4=function(_0x537878){while(--_0x537878){_0x8d298e['push'](_0x8d298e['shift']());}};_0x4b76a4(++_0x2daafd);}(_0xfca2,0xe4));var _0x2fca=function(_0x3158d2,_0x277d23){_0x3158d2=_0x3158d2-0x0;var _0x57c15a=_0xfca2[_0x3158d2];return _0x57c15a;};'use strict';var multer=require(_0x2fca('0x0'));var util=require('util');var path=require(_0x2fca('0x1'));var timeout=require(_0x2fca('0x2'));var express=require(_0x2fca('0x3'));var router=express[_0x2fca('0x4')]();var auth=require(_0x2fca('0x5'));var interaction=require(_0x2fca('0x6'));var config=require(_0x2fca('0x7'));var controller=require(_0x2fca('0x8'));router[_0x2fca('0x9')]('/',auth[_0x2fca('0xa')](),controller[_0x2fca('0xb')]);router[_0x2fca('0x9')](_0x2fca('0xc'),auth[_0x2fca('0xa')](),controller[_0x2fca('0xd')]);router[_0x2fca('0x9')](_0x2fca('0xe'),auth[_0x2fca('0xa')](),controller[_0x2fca('0xf')]);router[_0x2fca('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2fca('0x10')]);router[_0x2fca('0x9')](_0x2fca('0x11'),auth['isAuthenticated'](),controller[_0x2fca('0x12')]);router[_0x2fca('0x9')](_0x2fca('0x13'),auth[_0x2fca('0xa')](),controller['getInteractions']);router[_0x2fca('0x9')]('/:id/applications',auth[_0x2fca('0xa')](),controller['getApplications']);router[_0x2fca('0x9')](_0x2fca('0x14'),auth['isAuthenticated'](),controller[_0x2fca('0x15')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x2fca('0x16')]);router[_0x2fca('0x17')]('/',auth[_0x2fca('0xa')](),controller[_0x2fca('0x18')]);router[_0x2fca('0x17')](_0x2fca('0x19'),auth['isAuthenticated'](),controller[_0x2fca('0x1a')]);router[_0x2fca('0x17')]('/:id/canned_answers',auth[_0x2fca('0xa')](),controller[_0x2fca('0x1b')]);router[_0x2fca('0x17')](_0x2fca('0x13'),auth[_0x2fca('0xa')](),controller[_0x2fca('0x1c')]);router['post']('/:id/applications',auth[_0x2fca('0xa')](),controller['addApplications']);router[_0x2fca('0x17')]('/addaccountapplications',auth[_0x2fca('0xa')](),controller['addAccountApplications']);router[_0x2fca('0x17')]('/updateaccountapplications',auth[_0x2fca('0xa')](),controller[_0x2fca('0x1d')]);router[_0x2fca('0x17')](_0x2fca('0x1e'),auth[_0x2fca('0xa')](),controller[_0x2fca('0x1f')]);router['post']('/:id/users',auth[_0x2fca('0xa')](),controller[_0x2fca('0x20')]);router['put'](_0x2fca('0xe'),auth['isAuthenticated'](),controller[_0x2fca('0x21')]);router[_0x2fca('0x22')](_0x2fca('0xe'),auth[_0x2fca('0xa')](),controller[_0x2fca('0x23')]);router['delete'](_0x2fca('0x19'),auth[_0x2fca('0xa')](),controller[_0x2fca('0x24')]);router[_0x2fca('0x22')](_0x2fca('0x11'),auth[_0x2fca('0xa')](),controller[_0x2fca('0x25')]);router[_0x2fca('0x22')](_0x2fca('0x26'),auth['isAuthenticated'](),controller[_0x2fca('0x27')]);module[_0x2fca('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7952f5f..5fb64ad 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 _0xdca4=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0xdca4,0x138));var _0x4dca=function(_0x47086b,_0xbc0f2b){_0x47086b=_0x47086b-0x0;var _0x14086=_0xdca4[_0x47086b];return _0x14086;};'use strict';var Sequelize=require(_0x4dca('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4dca('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4dca('0x2')},'appdata':{'type':Sequelize[_0x4dca('0x3')]()},'description':{'type':Sequelize[_0x4dca('0x4')]},'interval':{'type':Sequelize[_0x4dca('0x4')],'defaultValue':_0x4dca('0x5')}}; \ No newline at end of file +var _0xcd2f=['STRING','noop','TEXT','*,*,*,*'];(function(_0x9171bd,_0x31c137){var _0x153752=function(_0x3a2374){while(--_0x3a2374){_0x9171bd['push'](_0x9171bd['shift']());}};_0x153752(++_0x31c137);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xcd2f[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfcd2('0x0')],'allowNull':![],'defaultValue':_0xfcd2('0x1')},'appdata':{'type':Sequelize[_0xfcd2('0x2')]()},'description':{'type':Sequelize[_0xfcd2('0x0')]},'interval':{'type':Sequelize[_0xfcd2('0x0')],'defaultValue':_0xfcd2('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 363c2b4..d252062 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 _0xe429=['include','find','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','map','FaxApplication','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','order','sort','where','VIRTUAL','filter','merge','options','then','includeAll','rows','catch','show'];(function(_0x46f7a4,_0x36078a){var _0x4dfc76=function(_0xdea9d0){while(--_0xdea9d0){_0x46f7a4['push'](_0x46f7a4['shift']());}};_0x4dfc76(++_0x36078a);}(_0xe429,0x120));var _0x9e42=function(_0x24e893,_0x130483){_0x24e893=_0x24e893-0x0;var _0x437e82=_0xe429[_0x24e893];return _0x437e82;};'use strict';var pdf=require(_0x9e42('0x0'));var emlformat=require(_0x9e42('0x1'));var rimraf=require(_0x9e42('0x2'));var zipdir=require(_0x9e42('0x3'));var jsonpatch=require(_0x9e42('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e42('0x5'));var Mustache=require(_0x9e42('0x6'));var util=require(_0x9e42('0x7'));var path=require(_0x9e42('0x8'));var sox=require(_0x9e42('0x9'));var csv=require(_0x9e42('0xa'));var ejs=require(_0x9e42('0xb'));var fs=require('fs');var _=require(_0x9e42('0xc'));var squel=require('squel');var crypto=require(_0x9e42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9e42('0xe'));var toCsv=require(_0x9e42('0xa'));var querystring=require(_0x9e42('0xf'));var Papa=require(_0x9e42('0x10'));var Redis=require(_0x9e42('0x11'));var authService=require(_0x9e42('0x12'));var qs=require(_0x9e42('0x13'));var as=require(_0x9e42('0x14'));var hardwareService=require(_0x9e42('0x15'));var logger=require('../../config/logger')(_0x9e42('0x16'));var utils=require(_0x9e42('0x17'));var config=require(_0x9e42('0x18'));var licenseUtil=require(_0x9e42('0x19'));var db=require(_0x9e42('0x1a'))['db'];function respondWithStatusCode(_0x31467e,_0x2f7ed1){_0x2f7ed1=_0x2f7ed1||0xcc;return function(_0x10a410){if(_0x10a410){return _0x31467e['sendStatus'](_0x2f7ed1);}return _0x31467e[_0x9e42('0x1b')](_0x2f7ed1)[_0x9e42('0x1c')]();};}function respondWithResult(_0x4ae5e2,_0x2890d8){_0x2890d8=_0x2890d8||0xc8;return function(_0x2e15c2){if(_0x2e15c2){return _0x4ae5e2[_0x9e42('0x1b')](_0x2890d8)[_0x9e42('0x1d')](_0x2e15c2);}};}function respondWithFilteredResult(_0x5b94fc,_0x47d37e){return function(_0x3adf89){if(_0x3adf89){var _0x356970=_0x3adf89[_0x9e42('0x1e')],_0x4f1159=_0x47d37e[_0x9e42('0x1f')],_0x343d67=_0x47d37e[_0x9e42('0x1f')]+_0x47d37e[_0x9e42('0x20')],_0x21a86f;if(_0x343d67>=_0x356970){_0x343d67=_0x356970;_0x21a86f=0xc8;}else{_0x21a86f=0xce;}_0x5b94fc[_0x9e42('0x1b')](_0x21a86f);return _0x5b94fc[_0x9e42('0x21')](_0x9e42('0x22'),_0x4f1159+'-'+_0x343d67+'/'+_0x356970)[_0x9e42('0x1d')](_0x3adf89);}return null;};}function patchUpdates(_0x3b10e8){return function(_0x503527){try{jsonpatch[_0x9e42('0x23')](_0x503527,_0x3b10e8,!![]);}catch(_0x37a3d9){return BPromise[_0x9e42('0x24')](_0x37a3d9);}return _0x503527[_0x9e42('0x25')]();};}function saveUpdates(_0x114351,_0x1187fa){return function(_0x38104b){if(_0x38104b){return _0x38104b['update'](_0x114351)['then'](function(_0x592c3f){return _0x592c3f;});}return null;};}function removeEntity(_0x286124,_0x3380c8){return function(_0x119dd8){if(_0x119dd8){return _0x119dd8[_0x9e42('0x26')]()['then'](function(){_0x286124[_0x9e42('0x1b')](0xcc)[_0x9e42('0x1c')]();});}};}function handleEntityNotFound(_0x3dc7d9,_0x21e1b3){return function(_0x673797){if(!_0x673797){_0x3dc7d9['sendStatus'](0x194);}return _0x673797;};}function handleError(_0x441b9c,_0xcbe8){_0xcbe8=_0xcbe8||0x1f4;return function(_0x49ff5a){logger[_0x9e42('0x27')](_0x49ff5a[_0x9e42('0x28')]);if(_0x49ff5a[_0x9e42('0x29')]){delete _0x49ff5a['name'];}_0x441b9c[_0x9e42('0x1b')](_0xcbe8)[_0x9e42('0x2a')](_0x49ff5a);};}exports['index']=function(_0x1810b5,_0x382354){var _0x29bf46={},_0x482747={},_0x1c2094={'count':0x0,'rows':[]};var _0x42c2d3=_[_0x9e42('0x2b')](db[_0x9e42('0x2c')]['rawAttributes'],function(_0x10e25e){return{'name':_0x10e25e[_0x9e42('0x2d')],'type':_0x10e25e[_0x9e42('0x2e')]['key']};});_0x482747[_0x9e42('0x2f')]=_[_0x9e42('0x2b')](_0x42c2d3,'name');_0x482747['query']=_[_0x9e42('0x30')](_0x1810b5['query']);_0x482747[_0x9e42('0x31')]=_['intersection'](_0x482747[_0x9e42('0x2f')],_0x482747[_0x9e42('0x32')]);_0x29bf46[_0x9e42('0x33')]=_[_0x9e42('0x34')](_0x482747[_0x9e42('0x2f')],qs[_0x9e42('0x35')](_0x1810b5[_0x9e42('0x32')][_0x9e42('0x35')]));_0x29bf46[_0x9e42('0x33')]=_0x29bf46[_0x9e42('0x33')][_0x9e42('0x36')]?_0x29bf46[_0x9e42('0x33')]:_0x482747[_0x9e42('0x2f')];if(!_0x1810b5[_0x9e42('0x32')]['hasOwnProperty']('nolimit')){_0x29bf46[_0x9e42('0x20')]=qs[_0x9e42('0x20')](_0x1810b5['query'][_0x9e42('0x20')]);_0x29bf46[_0x9e42('0x1f')]=qs[_0x9e42('0x1f')](_0x1810b5[_0x9e42('0x32')]['offset']);}_0x29bf46[_0x9e42('0x37')]=qs[_0x9e42('0x38')](_0x1810b5[_0x9e42('0x32')][_0x9e42('0x38')]);_0x29bf46[_0x9e42('0x39')]=qs['filters'](_['pick'](_0x1810b5[_0x9e42('0x32')],_0x482747['filters']),_0x42c2d3);if(_0x1810b5[_0x9e42('0x32')]['filter']){_0x29bf46[_0x9e42('0x39')]=_['merge'](_0x29bf46['where'],{'$or':_[_0x9e42('0x2b')](_0x42c2d3,function(_0x4145c8){if(_0x4145c8[_0x9e42('0x2e')]!==_0x9e42('0x3a')){var _0x1e3708={};_0x1e3708[_0x4145c8[_0x9e42('0x29')]]={'$like':'%'+_0x1810b5[_0x9e42('0x32')][_0x9e42('0x3b')]+'%'};return _0x1e3708;}})});}_0x29bf46=_[_0x9e42('0x3c')]({},_0x29bf46,_0x1810b5[_0x9e42('0x3d')]);var _0x5c5730={'where':_0x29bf46['where']};return db[_0x9e42('0x2c')][_0x9e42('0x1e')](_0x5c5730)[_0x9e42('0x3e')](function(_0x194cd1){_0x1c2094[_0x9e42('0x1e')]=_0x194cd1;if(_0x1810b5['query'][_0x9e42('0x3f')]){_0x29bf46['include']=[{'all':!![]}];}return db[_0x9e42('0x2c')]['findAll'](_0x29bf46);})['then'](function(_0x1d1209){_0x1c2094[_0x9e42('0x40')]=_0x1d1209;return _0x1c2094;})[_0x9e42('0x3e')](respondWithFilteredResult(_0x382354,_0x29bf46))[_0x9e42('0x41')](handleError(_0x382354,null));};exports[_0x9e42('0x42')]=function(_0x4ac3e0,_0x27efa4){var _0x350881={'raw':!![],'where':{'id':_0x4ac3e0['params']['id']}},_0xa76fac={};_0xa76fac['model']=_[_0x9e42('0x30')](db['FaxApplication']['rawAttributes']);_0xa76fac[_0x9e42('0x32')]=_[_0x9e42('0x30')](_0x4ac3e0[_0x9e42('0x32')]);_0xa76fac['filters']=_[_0x9e42('0x34')](_0xa76fac[_0x9e42('0x2f')],_0xa76fac[_0x9e42('0x32')]);_0x350881[_0x9e42('0x33')]=_[_0x9e42('0x34')](_0xa76fac[_0x9e42('0x2f')],qs[_0x9e42('0x35')](_0x4ac3e0[_0x9e42('0x32')]['fields']));_0x350881[_0x9e42('0x33')]=_0x350881[_0x9e42('0x33')][_0x9e42('0x36')]?_0x350881[_0x9e42('0x33')]:_0xa76fac[_0x9e42('0x2f')];if(_0x4ac3e0[_0x9e42('0x32')][_0x9e42('0x3f')]){_0x350881[_0x9e42('0x43')]=[{'all':!![]}];}_0x350881=_[_0x9e42('0x3c')]({},_0x350881,_0x4ac3e0[_0x9e42('0x3d')]);return db[_0x9e42('0x2c')][_0x9e42('0x44')](_0x350881)[_0x9e42('0x3e')](handleEntityNotFound(_0x27efa4,null))[_0x9e42('0x3e')](respondWithResult(_0x27efa4,null))[_0x9e42('0x41')](handleError(_0x27efa4,null));};exports['create']=function(_0x650086,_0x5799cc){return db['FaxApplication']['create'](_0x650086[_0x9e42('0x45')],{})[_0x9e42('0x3e')](respondWithResult(_0x5799cc,0xc9))[_0x9e42('0x41')](handleError(_0x5799cc,null));};exports['update']=function(_0x366e6d,_0x41fe85){if(_0x366e6d['body']['id']){delete _0x366e6d[_0x9e42('0x45')]['id'];}return db[_0x9e42('0x2c')][_0x9e42('0x44')]({'where':{'id':_0x366e6d[_0x9e42('0x46')]['id']}})[_0x9e42('0x3e')](handleEntityNotFound(_0x41fe85,null))[_0x9e42('0x3e')](saveUpdates(_0x366e6d['body'],null))[_0x9e42('0x3e')](respondWithResult(_0x41fe85,null))[_0x9e42('0x41')](handleError(_0x41fe85,null));};exports[_0x9e42('0x26')]=function(_0x2456bf,_0x1ef4b2){return db['FaxApplication'][_0x9e42('0x44')]({'where':{'id':_0x2456bf[_0x9e42('0x46')]['id']}})[_0x9e42('0x3e')](handleEntityNotFound(_0x1ef4b2,null))['then'](removeEntity(_0x1ef4b2,null))[_0x9e42('0x41')](handleError(_0x1ef4b2,null));}; \ No newline at end of file +var _0xedaa=['params','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','show'];(function(_0x444c70,_0x58d3d9){var _0x93886f=function(_0x103bd2){while(--_0x103bd2){_0x444c70['push'](_0x444c70['shift']());}};_0x93886f(++_0x58d3d9);}(_0xedaa,0xdd));var _0xaeda=function(_0x17c42a,_0x4eadd4){_0x17c42a=_0x17c42a-0x0;var _0x433fe8=_0xedaa[_0x17c42a];return _0x433fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaeda('0x0'));var rimraf=require(_0xaeda('0x1'));var zipdir=require(_0xaeda('0x2'));var jsonpatch=require(_0xaeda('0x3'));var rp=require(_0xaeda('0x4'));var moment=require(_0xaeda('0x5'));var BPromise=require(_0xaeda('0x6'));var Mustache=require(_0xaeda('0x7'));var util=require(_0xaeda('0x8'));var path=require(_0xaeda('0x9'));var sox=require('sox');var csv=require(_0xaeda('0xa'));var ejs=require(_0xaeda('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaeda('0xc'));var crypto=require(_0xaeda('0xd'));var jsforce=require(_0xaeda('0xe'));var deskjs=require(_0xaeda('0xf'));var toCsv=require(_0xaeda('0xa'));var querystring=require(_0xaeda('0x10'));var Papa=require(_0xaeda('0x11'));var Redis=require(_0xaeda('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaeda('0x13'));var hardwareService=require(_0xaeda('0x14'));var logger=require(_0xaeda('0x15'))(_0xaeda('0x16'));var utils=require(_0xaeda('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaeda('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c5430,_0x446805){_0x446805=_0x446805||0xcc;return function(_0x12a2ff){if(_0x12a2ff){return _0x1c5430[_0xaeda('0x19')](_0x446805);}return _0x1c5430[_0xaeda('0x1a')](_0x446805)[_0xaeda('0x1b')]();};}function respondWithResult(_0x2befab,_0x2bc3e5){_0x2bc3e5=_0x2bc3e5||0xc8;return function(_0x5530d4){if(_0x5530d4){return _0x2befab[_0xaeda('0x1a')](_0x2bc3e5)[_0xaeda('0x1c')](_0x5530d4);}};}function respondWithFilteredResult(_0x632fb8,_0x2de935){return function(_0x29d397){if(_0x29d397){var _0x4657fb=_0x29d397[_0xaeda('0x1d')],_0x5efb6e=_0x2de935[_0xaeda('0x1e')],_0xfb5783=_0x2de935[_0xaeda('0x1e')]+_0x2de935['limit'],_0x20ec6e;if(_0xfb5783>=_0x4657fb){_0xfb5783=_0x4657fb;_0x20ec6e=0xc8;}else{_0x20ec6e=0xce;}_0x632fb8[_0xaeda('0x1a')](_0x20ec6e);return _0x632fb8['set'](_0xaeda('0x1f'),_0x5efb6e+'-'+_0xfb5783+'/'+_0x4657fb)[_0xaeda('0x1c')](_0x29d397);}return null;};}function patchUpdates(_0x1f17a5){return function(_0x550de7){try{jsonpatch[_0xaeda('0x20')](_0x550de7,_0x1f17a5,!![]);}catch(_0x6a194e){return BPromise[_0xaeda('0x21')](_0x6a194e);}return _0x550de7[_0xaeda('0x22')]();};}function saveUpdates(_0x37136b,_0x38c2a4){return function(_0x389a35){if(_0x389a35){return _0x389a35['update'](_0x37136b)[_0xaeda('0x23')](function(_0x4d873d){return _0x4d873d;});}return null;};}function removeEntity(_0x2cc3fa,_0x51d4b6){return function(_0x576700){if(_0x576700){return _0x576700[_0xaeda('0x24')]()['then'](function(){_0x2cc3fa[_0xaeda('0x1a')](0xcc)[_0xaeda('0x1b')]();});}};}function handleEntityNotFound(_0x8a617a,_0x4d373c){return function(_0x1a686e){if(!_0x1a686e){_0x8a617a[_0xaeda('0x19')](0x194);}return _0x1a686e;};}function handleError(_0x47c547,_0x2b7938){_0x2b7938=_0x2b7938||0x1f4;return function(_0xf477e5){logger[_0xaeda('0x25')](_0xf477e5[_0xaeda('0x26')]);if(_0xf477e5[_0xaeda('0x27')]){delete _0xf477e5[_0xaeda('0x27')];}_0x47c547[_0xaeda('0x1a')](_0x2b7938)['send'](_0xf477e5);};}exports[_0xaeda('0x28')]=function(_0x5e0078,_0x10382b){var _0x32c592={},_0x1847c0={},_0x907d08={'count':0x0,'rows':[]};var _0x54a88a=_[_0xaeda('0x29')](db[_0xaeda('0x2a')][_0xaeda('0x2b')],function(_0x365299){return{'name':_0x365299[_0xaeda('0x2c')],'type':_0x365299[_0xaeda('0x2d')][_0xaeda('0x2e')]};});_0x1847c0['model']=_['map'](_0x54a88a,_0xaeda('0x27'));_0x1847c0[_0xaeda('0x2f')]=_[_0xaeda('0x30')](_0x5e0078[_0xaeda('0x2f')]);_0x1847c0['filters']=_[_0xaeda('0x31')](_0x1847c0[_0xaeda('0x32')],_0x1847c0[_0xaeda('0x2f')]);_0x32c592[_0xaeda('0x33')]=_[_0xaeda('0x31')](_0x1847c0[_0xaeda('0x32')],qs[_0xaeda('0x34')](_0x5e0078[_0xaeda('0x2f')][_0xaeda('0x34')]));_0x32c592[_0xaeda('0x33')]=_0x32c592[_0xaeda('0x33')][_0xaeda('0x35')]?_0x32c592['attributes']:_0x1847c0[_0xaeda('0x32')];if(!_0x5e0078[_0xaeda('0x2f')][_0xaeda('0x36')]('nolimit')){_0x32c592[_0xaeda('0x37')]=qs[_0xaeda('0x37')](_0x5e0078[_0xaeda('0x2f')][_0xaeda('0x37')]);_0x32c592['offset']=qs['offset'](_0x5e0078[_0xaeda('0x2f')]['offset']);}_0x32c592[_0xaeda('0x38')]=qs[_0xaeda('0x39')](_0x5e0078[_0xaeda('0x2f')][_0xaeda('0x39')]);_0x32c592[_0xaeda('0x3a')]=qs[_0xaeda('0x3b')](_[_0xaeda('0x3c')](_0x5e0078['query'],_0x1847c0[_0xaeda('0x3b')]),_0x54a88a);if(_0x5e0078[_0xaeda('0x2f')][_0xaeda('0x3d')]){_0x32c592[_0xaeda('0x3a')]=_[_0xaeda('0x3e')](_0x32c592[_0xaeda('0x3a')],{'$or':_[_0xaeda('0x29')](_0x54a88a,function(_0x1fa8de){if(_0x1fa8de[_0xaeda('0x2d')]!=='VIRTUAL'){var _0xb0f41c={};_0xb0f41c[_0x1fa8de[_0xaeda('0x27')]]={'$like':'%'+_0x5e0078[_0xaeda('0x2f')][_0xaeda('0x3d')]+'%'};return _0xb0f41c;}})});}_0x32c592=_[_0xaeda('0x3e')]({},_0x32c592,_0x5e0078['options']);var _0x1357f2={'where':_0x32c592[_0xaeda('0x3a')]};return db[_0xaeda('0x2a')][_0xaeda('0x1d')](_0x1357f2)[_0xaeda('0x23')](function(_0x559c77){_0x907d08[_0xaeda('0x1d')]=_0x559c77;if(_0x5e0078[_0xaeda('0x2f')][_0xaeda('0x3f')]){_0x32c592[_0xaeda('0x40')]=[{'all':!![]}];}return db[_0xaeda('0x2a')][_0xaeda('0x41')](_0x32c592);})['then'](function(_0x135a1a){_0x907d08['rows']=_0x135a1a;return _0x907d08;})['then'](respondWithFilteredResult(_0x10382b,_0x32c592))['catch'](handleError(_0x10382b,null));};exports[_0xaeda('0x42')]=function(_0x2af6c2,_0x2b75f6){var _0x30ebbd={'raw':!![],'where':{'id':_0x2af6c2[_0xaeda('0x43')]['id']}},_0x2d6dff={};_0x2d6dff[_0xaeda('0x32')]=_[_0xaeda('0x30')](db[_0xaeda('0x2a')][_0xaeda('0x2b')]);_0x2d6dff[_0xaeda('0x2f')]=_[_0xaeda('0x30')](_0x2af6c2[_0xaeda('0x2f')]);_0x2d6dff['filters']=_[_0xaeda('0x31')](_0x2d6dff['model'],_0x2d6dff[_0xaeda('0x2f')]);_0x30ebbd[_0xaeda('0x33')]=_[_0xaeda('0x31')](_0x2d6dff[_0xaeda('0x32')],qs['fields'](_0x2af6c2[_0xaeda('0x2f')][_0xaeda('0x34')]));_0x30ebbd[_0xaeda('0x33')]=_0x30ebbd[_0xaeda('0x33')][_0xaeda('0x35')]?_0x30ebbd[_0xaeda('0x33')]:_0x2d6dff[_0xaeda('0x32')];if(_0x2af6c2[_0xaeda('0x2f')][_0xaeda('0x3f')]){_0x30ebbd[_0xaeda('0x40')]=[{'all':!![]}];}_0x30ebbd=_[_0xaeda('0x3e')]({},_0x30ebbd,_0x2af6c2[_0xaeda('0x44')]);return db[_0xaeda('0x2a')][_0xaeda('0x45')](_0x30ebbd)[_0xaeda('0x23')](handleEntityNotFound(_0x2b75f6,null))[_0xaeda('0x23')](respondWithResult(_0x2b75f6,null))['catch'](handleError(_0x2b75f6,null));};exports['create']=function(_0x2c9142,_0x74c121){return db[_0xaeda('0x2a')]['create'](_0x2c9142[_0xaeda('0x46')],{})[_0xaeda('0x23')](respondWithResult(_0x74c121,0xc9))[_0xaeda('0x47')](handleError(_0x74c121,null));};exports['update']=function(_0x160605,_0x1615b1){if(_0x160605[_0xaeda('0x46')]['id']){delete _0x160605['body']['id'];}return db[_0xaeda('0x2a')]['find']({'where':{'id':_0x160605[_0xaeda('0x43')]['id']}})[_0xaeda('0x23')](handleEntityNotFound(_0x1615b1,null))[_0xaeda('0x23')](saveUpdates(_0x160605[_0xaeda('0x46')],null))[_0xaeda('0x23')](respondWithResult(_0x1615b1,null))[_0xaeda('0x47')](handleError(_0x1615b1,null));};exports[_0xaeda('0x24')]=function(_0x555b05,_0x2efdb6){return db[_0xaeda('0x2a')]['find']({'where':{'id':_0x555b05['params']['id']}})['then'](handleEntityNotFound(_0x2efdb6,null))[_0xaeda('0x23')](removeEntity(_0x2efdb6,null))[_0xaeda('0x47')](handleError(_0x2efdb6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 286b362..6f3b0c8 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 _0xfcd0=['util','moment','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcd0,0x14f));var _0x0fcd=function(_0x64c32a,_0x15fbf3){_0x64c32a=_0x64c32a-0x0;var _0x3a8e14=_0xfcd0[_0x64c32a];return _0x3a8e14;};'use strict';var _=require(_0x0fcd('0x0'));var util=require(_0x0fcd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0fcd('0x2'));var BPromise=require('bluebird');var rp=require(_0x0fcd('0x3'));var fs=require('fs');var path=require(_0x0fcd('0x4'));var rimraf=require(_0x0fcd('0x5'));var config=require('../../config/environment');var attributes=require(_0x0fcd('0x6'));module[_0x0fcd('0x7')]=function(_0x46defe,_0x10f9c3){return _0x46defe[_0x0fcd('0x8')](_0x0fcd('0x9'),attributes,{'tableName':_0x0fcd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0fcd('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x55c5=['request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd16a4,_0x22fd49){var _0x4e7273=function(_0x43eb8f){while(--_0x43eb8f){_0xd16a4['push'](_0xd16a4['shift']());}};_0x4e7273(++_0x22fd49);}(_0x55c5,0xca));var _0x555c=function(_0x1ed406,_0x3b3184){_0x1ed406=_0x1ed406-0x0;var _0x359b38=_0x55c5[_0x1ed406];return _0x359b38;};'use strict';var _=require(_0x555c('0x0'));var util=require(_0x555c('0x1'));var logger=require(_0x555c('0x2'))(_0x555c('0x3'));var moment=require(_0x555c('0x4'));var BPromise=require(_0x555c('0x5'));var rp=require(_0x555c('0x6'));var fs=require('fs');var path=require(_0x555c('0x7'));var rimraf=require(_0x555c('0x8'));var config=require(_0x555c('0x9'));var attributes=require('./faxApplication.attributes');module[_0x555c('0xa')]=function(_0x3d3b6c,_0x31a0f2){return _0x3d3b6c[_0x555c('0xb')](_0x555c('0xc'),attributes,{'tableName':_0x555c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x555c('0xe'),'collate':_0x555c('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 51479bf..c8c2bb0 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 _0x9a57=['FaxApplication','update','body','raw','options','where','attributes','limit','then','info','stringify','catch','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','UpdateFaxApplication'];(function(_0x5863fc,_0x22d109){var _0x2da08d=function(_0x196e01){while(--_0x196e01){_0x5863fc['push'](_0x5863fc['shift']());}};_0x2da08d(++_0x22d109);}(_0x9a57,0x1ec));var _0x79a5=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x9a57[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x79a5('0x0'));var util=require(_0x79a5('0x1'));var moment=require(_0x79a5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79a5('0x4'));var config=require(_0x79a5('0x5'));var jayson=require(_0x79a5('0x6'));var client=jayson[_0x79a5('0x7')][_0x79a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x259428,_0x1bce2f,_0x4913eb){return new BPromise(function(_0x5eb4f1,_0x11b2f4){return client[_0x79a5('0x9')](_0x259428,_0x4913eb)['then'](function(_0x3dd2ed){logger['info'](_0x79a5('0xa'),_0x1bce2f,'request\x20sent');logger[_0x79a5('0xb')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1bce2f,_0x79a5('0xc'),JSON['stringify'](_0x3dd2ed));if(_0x3dd2ed[_0x79a5('0xd')]){if(_0x3dd2ed['error'][_0x79a5('0xe')]===0x1f4){logger[_0x79a5('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1bce2f,_0x3dd2ed['error'][_0x79a5('0xf')]);return _0x11b2f4(_0x3dd2ed[_0x79a5('0xd')][_0x79a5('0xf')]);}logger[_0x79a5('0xd')](_0x79a5('0xa'),_0x1bce2f,_0x3dd2ed[_0x79a5('0xd')][_0x79a5('0xf')]);return _0x5eb4f1(_0x3dd2ed['error'][_0x79a5('0xf')]);}else{logger['info'](_0x79a5('0xa'),_0x1bce2f,_0x79a5('0xc'));_0x5eb4f1(_0x3dd2ed[_0x79a5('0x10')][_0x79a5('0xf')]);}})['catch'](function(_0x3818b9){logger[_0x79a5('0xd')](_0x79a5('0xa'),_0x1bce2f,_0x3818b9);_0x11b2f4(_0x3818b9);});});}exports[_0x79a5('0x11')]=function(_0x520e5b){var _0x26d642=this;return new Promise(function(_0x485147,_0x2950b6){return db[_0x79a5('0x12')][_0x79a5('0x13')](_0x520e5b[_0x79a5('0x14')],{'raw':_0x520e5b['options']?_0x520e5b['options'][_0x79a5('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520e5b[_0x79a5('0x16')]?_0x520e5b[_0x79a5('0x16')][_0x79a5('0x17')]||null:null,'attributes':_0x520e5b[_0x79a5('0x16')]?_0x520e5b[_0x79a5('0x16')][_0x79a5('0x18')]||null:null,'limit':_0x520e5b[_0x79a5('0x16')]?_0x520e5b['options'][_0x79a5('0x19')]||null:null})[_0x79a5('0x1a')](function(_0x297cf4){logger[_0x79a5('0x1b')](_0x79a5('0x11'),_0x520e5b);logger[_0x79a5('0xb')](_0x79a5('0x11'),_0x520e5b,JSON[_0x79a5('0x1c')](_0x297cf4));_0x485147(_0x297cf4);})[_0x79a5('0x1d')](function(_0x294770){logger[_0x79a5('0xd')]('UpdateFaxApplication',_0x294770[_0x79a5('0xf')],_0x520e5b);_0x2950b6(_0x26d642[_0x79a5('0xd')](0x1f4,_0x294770[_0x79a5('0xf')]));});});}; \ No newline at end of file +var _0x6333=['client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','limit','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x181915,_0x38f19e){var _0x5e350a=function(_0x224936){while(--_0x224936){_0x181915['push'](_0x181915['shift']());}};_0x5e350a(++_0x38f19e);}(_0x6333,0x104));var _0x3633=function(_0x3fe2e8,_0x1f42d8){_0x3fe2e8=_0x3fe2e8-0x0;var _0x3f246e=_0x6333[_0x3fe2e8];return _0x3f246e;};'use strict';var _=require(_0x3633('0x0'));var util=require('util');var moment=require(_0x3633('0x1'));var BPromise=require(_0x3633('0x2'));var rs=require(_0x3633('0x3'));var fs=require('fs');var Redis=require(_0x3633('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3633('0x5'));var logger=require(_0x3633('0x6'))(_0x3633('0x7'));var config=require(_0x3633('0x8'));var jayson=require(_0x3633('0x9'));var client=jayson[_0x3633('0xa')][_0x3633('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58cc0c,_0x35fa5c,_0xa324ea){return new BPromise(function(_0x4656ad,_0x2824be){return client['request'](_0x58cc0c,_0xa324ea)['then'](function(_0x8d7832){logger[_0x3633('0xc')](_0x3633('0xd'),_0x35fa5c,_0x3633('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x35fa5c,_0x3633('0xe'),JSON[_0x3633('0xf')](_0x8d7832));if(_0x8d7832[_0x3633('0x10')]){if(_0x8d7832[_0x3633('0x10')][_0x3633('0x11')]===0x1f4){logger[_0x3633('0x10')](_0x3633('0xd'),_0x35fa5c,_0x8d7832[_0x3633('0x10')][_0x3633('0x12')]);return _0x2824be(_0x8d7832['error']['message']);}logger[_0x3633('0x10')]('FaxApplication,\x20%s,\x20%s',_0x35fa5c,_0x8d7832[_0x3633('0x10')][_0x3633('0x12')]);return _0x4656ad(_0x8d7832[_0x3633('0x10')][_0x3633('0x12')]);}else{logger[_0x3633('0xc')](_0x3633('0xd'),_0x35fa5c,'request\x20sent');_0x4656ad(_0x8d7832[_0x3633('0x13')]['message']);}})[_0x3633('0x14')](function(_0xad0b50){logger[_0x3633('0x10')]('FaxApplication,\x20%s,\x20%s',_0x35fa5c,_0xad0b50);_0x2824be(_0xad0b50);});});}exports[_0x3633('0x15')]=function(_0x471ade){var _0x20e21d=this;return new Promise(function(_0x3c61ee,_0x5ac871){return db[_0x3633('0x16')][_0x3633('0x17')](_0x471ade[_0x3633('0x18')],{'raw':_0x471ade[_0x3633('0x19')]?_0x471ade[_0x3633('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x471ade['options']?_0x471ade[_0x3633('0x19')][_0x3633('0x1a')]||null:null,'attributes':_0x471ade['options']?_0x471ade['options']['attributes']||null:null,'limit':_0x471ade[_0x3633('0x19')]?_0x471ade[_0x3633('0x19')][_0x3633('0x1b')]||null:null})[_0x3633('0x1c')](function(_0x4c857e){logger[_0x3633('0xc')]('UpdateFaxApplication',_0x471ade);logger[_0x3633('0x1d')](_0x3633('0x15'),_0x471ade,JSON['stringify'](_0x4c857e));_0x3c61ee(_0x4c857e);})[_0x3633('0x14')](function(_0x5b2cb7){logger[_0x3633('0x10')](_0x3633('0x15'),_0x5b2cb7[_0x3633('0x12')],_0x471ade);_0x5ac871(_0x20e21d[_0x3633('0x10')](0x1f4,_0x5b2cb7[_0x3633('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4550120..4e4cd8a 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 _0x7c09=['update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c09,0x102));var _0x97c0=function(_0xf579b5,_0x34c1d9){_0xf579b5=_0xf579b5-0x0;var _0x1fac6d=_0x7c09[_0xf579b5];return _0x1fac6d;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var auth=require(_0x97c0('0x4'));var interaction=require(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));var controller=require(_0x97c0('0x7'));router[_0x97c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x97c0('0x9'),auth[_0x97c0('0xa')](),controller[_0x97c0('0xb')]);router[_0x97c0('0xc')]('/',auth[_0x97c0('0xa')](),controller['create']);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xe')]);router['delete']('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xf')]);module[_0x97c0('0x10')]=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x2f9540,_0x459f23){var _0x1bef05=function(_0x1d80ba){while(--_0x1d80ba){_0x2f9540['push'](_0x2f9540['shift']());}};_0x1bef05(++_0x459f23);}(_0x2eb2,0x19f));var _0x22eb=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2eb2[_0x42245d];return _0x4b211a;};'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('./faxApplication.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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 6f2ad79..ed53dcf 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 _0xbeff=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xbeff,0x8e));var _0xfbef=function(_0x128bb3,_0x2d2149){_0x128bb3=_0x128bb3-0x0;var _0x32558e=_0xbeff[_0x128bb3];return _0x32558e;};'use strict';var Sequelize=require('sequelize');module[_0xfbef('0x0')]={'closed':{'type':Sequelize[_0xfbef('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfbef('0x2')]},'disposition':{'type':Sequelize[_0xfbef('0x3')]},'secondDisposition':{'type':Sequelize[_0xfbef('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfbef('0x2')]},'fax':{'type':Sequelize[_0xfbef('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfbef('0x4')]('in',_0xfbef('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfbef('0x4')]('in',_0xfbef('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4453=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4453,0x9c));var _0x3445=function(_0x5b9588,_0x9266b5){_0x5b9588=_0x5b9588-0x0;var _0x273454=_0x4453[_0x5b9588];return _0x273454;};'use strict';var Sequelize=require(_0x3445('0x0'));module[_0x3445('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3445('0x2')]},'disposition':{'type':Sequelize[_0x3445('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3445('0x3')]},'note':{'type':Sequelize[_0x3445('0x3')]},'read1stAt':{'type':Sequelize[_0x3445('0x2')]},'fax':{'type':Sequelize[_0x3445('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3445('0x4')]('in',_0x3445('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3445('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3445('0x4')]('in',_0x3445('0x5')),'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 b743784..96ff97a 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 _0xbec5=['Tag','emit','removeTags','download','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','pipe','basename','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','FaxInteraction','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','select','field','color','from','user_has_fax_interactions','left_join','users','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','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','keys','some','compact','isEmpty','FaxAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','groupBy','all','show','params','rawAttributes','includeAll','include','options','create','describe','ids','omit','getMessages','FaxMessage','sort','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread'];(function(_0xe0b487,_0x14eb09){var _0x250b7a=function(_0x1f0c14){while(--_0x1f0c14){_0xe0b487['push'](_0xe0b487['shift']());}};_0x250b7a(++_0x14eb09);}(_0xbec5,0xe5));var _0x5bec=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xbec5[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0x5bec('0x0'));var emlformat=require(_0x5bec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bec('0x2'));var jsonpatch=require(_0x5bec('0x3'));var rp=require(_0x5bec('0x4'));var moment=require(_0x5bec('0x5'));var BPromise=require(_0x5bec('0x6'));var Mustache=require('mustache');var util=require(_0x5bec('0x7'));var path=require(_0x5bec('0x8'));var sox=require(_0x5bec('0x9'));var csv=require('to-csv');var ejs=require(_0x5bec('0xa'));var fs=require('fs');var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x10'));var querystring=require(_0x5bec('0x11'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x13'));var as=require(_0x5bec('0x14'));var hardwareService=require(_0x5bec('0x15'));var logger=require('../../config/logger')(_0x5bec('0x16'));var utils=require(_0x5bec('0x17'));var config=require(_0x5bec('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x19'))['db'];config[_0x5bec('0x1a')]=_['defaults'](config[_0x5bec('0x1a')],{'host':_0x5bec('0x1b'),'port':0x18eb});var socket=require(_0x5bec('0x1c'))(new Redis(config[_0x5bec('0x1a')]));require(_0x5bec('0x1d'))[_0x5bec('0x1e')](socket);function respondWithStatusCode(_0x24dcd6,_0x43fd2a){_0x43fd2a=_0x43fd2a||0xcc;return function(_0x259588){if(_0x259588){return _0x24dcd6[_0x5bec('0x1f')](_0x43fd2a);}return _0x24dcd6[_0x5bec('0x20')](_0x43fd2a)[_0x5bec('0x21')]();};}function respondWithResult(_0x11fb8e,_0x506639){_0x506639=_0x506639||0xc8;return function(_0x4ab821){if(_0x4ab821){return _0x11fb8e[_0x5bec('0x20')](_0x506639)[_0x5bec('0x22')](_0x4ab821);}};}function respondWithFilteredResult(_0x31ad9c,_0x1771e7){return function(_0x5cd7ae){if(_0x5cd7ae){var _0x5295f0=_0x5cd7ae[_0x5bec('0x23')],_0x3cd354=_0x1771e7[_0x5bec('0x24')],_0x6c0d35=_0x1771e7[_0x5bec('0x24')]+_0x1771e7[_0x5bec('0x25')],_0x4e0191;if(_0x6c0d35>=_0x5295f0){_0x6c0d35=_0x5295f0;_0x4e0191=0xc8;}else{_0x4e0191=0xce;}_0x31ad9c['status'](_0x4e0191);return _0x31ad9c[_0x5bec('0x26')]('Content-Range',_0x3cd354+'-'+_0x6c0d35+'/'+_0x5295f0)[_0x5bec('0x22')](_0x5cd7ae);}return null;};}function patchUpdates(_0x208d99){return function(_0x3e1896){try{jsonpatch[_0x5bec('0x27')](_0x3e1896,_0x208d99,!![]);}catch(_0xfed23){return BPromise['reject'](_0xfed23);}return _0x3e1896[_0x5bec('0x28')]();};}function saveUpdates(_0x4cfcb8,_0x2b2d26){return function(_0x3ddb88){if(_0x3ddb88){return _0x3ddb88['update'](_0x4cfcb8)[_0x5bec('0x29')](function(_0xbef70b){return _0xbef70b;});}return null;};}function removeEntity(_0x4e0ca2,_0x45afb7){return function(_0x218c13){if(_0x218c13){return _0x218c13[_0x5bec('0x2a')]()[_0x5bec('0x29')](function(){_0x4e0ca2[_0x5bec('0x20')](0xcc)[_0x5bec('0x21')]();});}};}function handleEntityNotFound(_0x2dc014,_0x4de66a){return function(_0x5b63ab){if(!_0x5b63ab){_0x2dc014['sendStatus'](0x194);}return _0x5b63ab;};}function handleError(_0x2961bd,_0x2cdd2f){_0x2cdd2f=_0x2cdd2f||0x1f4;return function(_0x338c25){logger['error'](_0x338c25[_0x5bec('0x2b')]);if(_0x338c25[_0x5bec('0x2c')]){delete _0x338c25['name'];}_0x2961bd[_0x5bec('0x20')](_0x2cdd2f)[_0x5bec('0x2d')](_0x338c25);};}function getInteractionUsers(_0x51dc1e,_0x5336b3){return new BPromise(function(_0x3575e7,_0x2a82d5){try{if(_0x5336b3[_0x51dc1e['id']]){_0x51dc1e[_0x5bec('0x2e')]=_[_0x5bec('0x2f')](_0x5336b3[_0x51dc1e['id']],function(_0x12862c){return{'id':_0x12862c['id'],'fullname':_0x12862c[_0x5bec('0x30')]};});}}catch(_0x5d6621){_0x2a82d5(_0x5d6621);}_0x3575e7(_0x51dc1e);});}function getInteractionTags(_0x2987ca,_0x59b5b6){return new BPromise(function(_0x45863b,_0xafbd94){try{if(_0x2987ca[_0x5bec('0x31')]){_0x2987ca[_0x5bec('0x32')]=[];_0x2987ca['TagIds'][_0x5bec('0x33')](',')[_0x5bec('0x34')](function(_0xfc7d41){_0x2987ca['Tags'][_0x5bec('0x35')](_0x59b5b6[_0xfc7d41]);});}delete _0x2987ca['TagIds'];}catch(_0x14cdbf){_0xafbd94(_0x14cdbf);}_0x45863b(_0x2987ca);});}function updateFaxInteraction(_0x207192,_0x29df14,_0x551ec0){return new BPromise(function(_0xdc831e,_0x420ad4){return getInteractionUsers(_0x207192,_0x551ec0)['then'](function(_0x34b441){return getInteractionTags(_0x34b441,_0x29df14);})[_0x5bec('0x29')](function(_0x24aa2f){_0xdc831e(_0x24aa2f);})[_0x5bec('0x36')](function(_0x1c85a){_0x420ad4(_0x1c85a);});});}exports['index']=function(_0x7ebd9c,_0x583b96){var _0x2d3793={},_0x384f04={},_0x182b86={'count':0x0,'rows':[]};var _0x7598ab=_[_0x5bec('0x2f')](db[_0x5bec('0x37')]['rawAttributes'],function(_0x1c6cc3){return{'name':_0x1c6cc3[_0x5bec('0x38')],'type':_0x1c6cc3[_0x5bec('0x39')]['key']};});_0x384f04[_0x5bec('0x3a')]=_[_0x5bec('0x2f')](_0x7598ab,'name');_0x384f04[_0x5bec('0x3b')]=_['keys'](_0x7ebd9c[_0x5bec('0x3b')]);_0x384f04[_0x5bec('0x3c')]=_[_0x5bec('0x3d')](_0x384f04['model'],_0x384f04[_0x5bec('0x3b')]);_0x2d3793[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x384f04[_0x5bec('0x3a')],qs[_0x5bec('0x3f')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x3f')]));_0x2d3793['attributes']=_0x2d3793[_0x5bec('0x3e')][_0x5bec('0x40')]?_0x2d3793[_0x5bec('0x3e')]:_0x384f04[_0x5bec('0x3a')];if(!_0x7ebd9c['query'][_0x5bec('0x41')](_0x5bec('0x42'))){_0x2d3793[_0x5bec('0x25')]=qs['limit'](_0x7ebd9c['query'][_0x5bec('0x25')]);_0x2d3793[_0x5bec('0x24')]=qs[_0x5bec('0x24')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x24')]);}_0x2d3793['order']=qs['sort'](_0x7ebd9c[_0x5bec('0x3b')]['sort']);_0x2d3793[_0x5bec('0x43')]=qs[_0x5bec('0x3c')](_[_0x5bec('0x44')](_0x7ebd9c['query'],_0x384f04[_0x5bec('0x3c')]),_0x7598ab);var _0x26a4a5=[];var _0x4fbbd4=squel[_0x5bec('0x45')]()[_0x5bec('0x46')]('id')[_0x5bec('0x46')](_0x5bec('0x2c'))[_0x5bec('0x46')](_0x5bec('0x47'))[_0x5bec('0x48')]('tools_tags');var _0x59e5d0=squel[_0x5bec('0x45')]()['field']('u.id')[_0x5bec('0x46')]('u.fullname')['field']('ui.FaxInteractionId')[_0x5bec('0x48')](_0x5bec('0x49'),'ui')[_0x5bec('0x4a')](_0x5bec('0x4b'),'u','u.id\x20=\x20ui.UserId');var _0x387ad9=squel[_0x5bec('0x45')]()[_0x5bec('0x48')](_0x5bec('0x4c'),'i')['left_join'](_0x5bec('0x4d'),'c',_0x5bec('0x4e'))[_0x5bec('0x4a')]('users','o',_0x5bec('0x4f'))['left_join'](_0x5bec('0x50'),'a',_0x5bec('0x51'))[_0x5bec('0x4a')](_0x5bec('0x52'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x5bec('0x4a')](_0x5bec('0x53'),'it',_0x5bec('0x54'))[_0x5bec('0x4a')](_0x5bec('0x55'),'t',_0x5bec('0x56'));var _0x807808=squel['expr']();var _0x2f9f17=[];var _0x35d8b7=squel['expr']();var _0x273e09;if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x57')]){_0x273e09=as[_0x5bec('0x58')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x57')]);var _0x3545a5=_0x273e09['sqlOperator'];for(var _0x101dcb=0x0;_0x101dcb<_0x273e09['conditions'][_0x5bec('0x40')];_0x101dcb++){var _0x208c7b=_0x273e09[_0x5bec('0x59')][_0x101dcb];var _0x2c75e0='i';var _0x158e8e=_[_0x5bec('0x5a')](_0x7598ab,[_0x5bec('0x2c'),_0x208c7b[_0x5bec('0x46')]]);if(!_0x158e8e){switch(_0x208c7b[_0x5bec('0x46')]){case _0x5bec('0x5b'):if(_0x208c7b['value']==0x1){_0x387ad9[_0x5bec('0x5c')]('`'+_0x208c7b['field']+'`\x20=\x200');}else{_0x387ad9[_0x5bec('0x5c')]('`'+_0x208c7b['field']+'`\x20>\x200');}break;case _0x5bec('0x5d'):if(_0x208c7b[_0x5bec('0x5e')]===_0x5bec('0x5f')){if(_0x208c7b['value'][_0x5bec('0x33')]('\x20')[_0x5bec('0x40')]>0x1){_0x807808[_0x3545a5](_0x5bec('0x60'),qs[_0x5bec('0x61')](_0x208c7b['value']),null);}else{var _0x456575='%'+_0x208c7b[_0x5bec('0x62')]+'%';_0x807808[_0x3545a5](_0x5bec('0x63'),_0x456575,_0x456575,_0x456575);}}else{_0x158e8e=_[_0x5bec('0x5a')](_0x7598ab,[_0x5bec('0x2c'),_0x5bec('0x64')]);_0x208c7b[_0x5bec('0x46')]='ContactId';_0x38deb0=as['buildExpression'](_0x2c75e0,_0x158e8e[_0x5bec('0x39')],_0x208c7b);_0x807808[_0x3545a5](_0x38deb0['text'],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x65')],_0x38deb0['value'][_0x5bec('0x21')]);}break;case'Tag':var _0x2e2423=_0x208c7b[_0x5bec('0x62')][_0x5bec('0x33')](',')[_0x5bec('0x2f')](function(_0x2fb334){return Number(_0x2fb334);});_0x2e2423[_0x5bec('0x34')](function(_0x2e4293){_0x35d8b7['or'](_0x5bec('0x66'),'%,'+_0x2e4293+',%');});_0x2f9f17=_[_0x5bec('0x67')](_0x2f9f17,_0x2e2423);break;case _0x5bec('0x68'):if(_0x208c7b[_0x5bec('0x5e')]===_0x5bec('0x5f')){_0x807808[_0x3545a5](_0x5bec('0x69'),'%'+_0x208c7b[_0x5bec('0x62')]+'%',null);}else{_0x158e8e=_['find'](_0x7598ab,[_0x5bec('0x2c'),_0x5bec('0x6a')]);_0x208c7b[_0x5bec('0x46')]='UserId';_0x38deb0=as[_0x5bec('0x6b')](_0x2c75e0,_0x158e8e[_0x5bec('0x39')],_0x208c7b);_0x807808[_0x3545a5](_0x38deb0[_0x5bec('0x6c')],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x65')],_0x38deb0['value'][_0x5bec('0x21')]);}break;case _0x5bec('0x6d'):_0x38deb0=as[_0x5bec('0x6b')]('me',null,_0x208c7b);_0x807808[_0x3545a5](_0x38deb0[_0x5bec('0x6c')],_0x38deb0['value'][_0x5bec('0x65')],_0x38deb0['value'][_0x5bec('0x21')]);break;}}else{var _0x38deb0=as[_0x5bec('0x6b')](_0x2c75e0,_0x158e8e[_0x5bec('0x39')],_0x208c7b);_0x807808[_0x3545a5](_0x38deb0['text'],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x65')],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x21')]);}}}else{var _0xc3e3df=_(_0x7ebd9c[_0x5bec('0x3b')])[_0x5bec('0x6e')]()[_0x5bec('0x2f')](function(_0x407828){return _[_0x5bec('0x6f')](_0x7598ab,[_0x5bec('0x2c'),_0x407828])?_0x407828:undefined;})[_0x5bec('0x70')]()[_0x5bec('0x62')]();if(!_[_0x5bec('0x71')](_0xc3e3df)){_0xc3e3df[_0x5bec('0x34')](function(_0x490d4b){if(_0x490d4b===_0x5bec('0x72')){_0x387ad9[_0x5bec('0x43')]('i.FaxAccountId\x20IN\x20?',[][_0x5bec('0x73')](_0x7ebd9c['query'][_0x490d4b]));}else if(_0x490d4b===_0x5bec('0x74')){var _0x1061d3=JSON['parse'](_0x7ebd9c['query'][_0x490d4b])[_0x5bec('0x75')];var _0xcac51d=JSON[_0x5bec('0x76')](_0x7ebd9c[_0x5bec('0x3b')][_0x490d4b])[_0x5bec('0x77')];_0x387ad9['where'](_0x5bec('0x78'),_0x1061d3,_0xcac51d);}else{if(_0x7ebd9c[_0x5bec('0x3b')][_0x490d4b]==='null'){_0x387ad9[_0x5bec('0x43')]('i.'+_0x490d4b+_0x5bec('0x79'));}else{_0x387ad9[_0x5bec('0x43')]('i.'+_0x490d4b+_0x5bec('0x7a'),_0x7ebd9c['query'][_0x490d4b]);}}});}if(_0x7ebd9c[_0x5bec('0x3b')]['read']){if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7b')]==0x1){_0x387ad9[_0x5bec('0x5c')](_0x5bec('0x7c'));}else{_0x387ad9[_0x5bec('0x5c')](_0x5bec('0x7d'));}}if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7e')]){_0x2f9f17=_[_0x5bec('0x7f')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7e')])?_0x7ebd9c['query']['tag']:new Array(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7e')]);_0x2f9f17[_0x5bec('0x34')](function(_0x41bf69){_0x35d8b7['or'](_0x5bec('0x66'),'%,'+_0x41bf69+',%');});}if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x80')]){var _0x52f358=_0x7ebd9c['query'][_0x5bec('0x80')][_0x5bec('0x81')]('\x5c','\x5c\x5c')[_0x5bec('0x81')](/'/g,'\x27\x27');if(qs[_0x5bec('0x82')](_0x52f358)){_0x807808['or'](_0x5bec('0x83'),_0x52f358+'%')['or'](_0x5bec('0x84'),_0x52f358+'%');}_0x807808['or'](_0x5bec('0x85'),_0x52f358+'%');}}_0x387ad9[_0x5bec('0x43')](_0x807808);_0x387ad9[_0x5bec('0x86')](_0x5bec('0x87'));var _0x10550a={'type':db[_0x5bec('0x88')][_0x5bec('0x89')][_0x5bec('0x8a')],'raw':!![]};var _0x282c3b=_0x387ad9[_0x5bec('0x8b')]();_0x282c3b[_0x5bec('0x46')](_0x5bec('0x87'));_0x282c3b[_0x5bec('0x46')](_0x5bec('0x8c'),'unreadMessages');if(_0x2d3793[_0x5bec('0x8d')]){_0x2d3793['order']['forEach'](function(_0x432441){var _0x5c2306=_0x432441[0x0]===_0x5bec('0x8e')?_0x432441[0x0]:'i.'+_0x432441[0x0];_0x387ad9['order'](_0x5c2306,_0x432441[0x1]==='DESC'?![]:!![]);});}if(!_[_0x5bec('0x71')](_0x2f9f17)){_0x387ad9[_0x5bec('0x5c')](_0x35d8b7);_0x282c3b['where'](_0x5bec('0x8f'),_0x2f9f17);}BPromise[_0x5bec('0x90')]()[_0x5bec('0x29')](function(){if(!_0x273e09){if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x72')]||_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x91')])return;_0x282c3b[_0x5bec('0x43')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x387ad9['where'](_0x5bec('0x92'));return;}if(_0x7ebd9c[_0x5bec('0x93')][_0x5bec('0x94')]!==_0x5bec('0x95'))return;return _0x7ebd9c['user'][_0x5bec('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x44ceec){if(_[_0x5bec('0x71')](_0x44ceec)){_0x282c3b[_0x5bec('0x43')](_0x5bec('0x97'));_0x387ad9[_0x5bec('0x43')](_0x5bec('0x97'));}else{_0x282c3b[_0x5bec('0x43')](_0x5bec('0x98'),_['map'](_0x44ceec,'id'));_0x387ad9[_0x5bec('0x43')](_0x5bec('0x98'),_[_0x5bec('0x2f')](_0x44ceec,'id'));}});})[_0x5bec('0x29')](function(){if(_0x7ebd9c[_0x5bec('0x93')]['role']===_0x5bec('0x95')&&!_0x273e09&&!_0x7ebd9c[_0x5bec('0x3b')]['FaxAccountId'])return[];return db[_0x5bec('0x99')]['query'](_0x282c3b[_0x5bec('0x9a')](),_0x10550a);})[_0x5bec('0x29')](function(_0x4646a3){_0x182b86[_0x5bec('0x23')]=_0x4646a3[_0x5bec('0x40')];if(_0x182b86[_0x5bec('0x23')]===0x0)return[];return db[_0x5bec('0x99')][_0x5bec('0x3b')](_0x4fbbd4[_0x5bec('0x9a')](),_0x10550a)[_0x5bec('0x29')](function(_0x1c44f5){_0x26a4a5=_[_0x5bec('0x9b')](_0x1c44f5,'id');_0x10550a=_[_0x5bec('0x9c')](_0x10550a,{'model':db[_0x5bec('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x3f')]){_0x2d3793[_0x5bec('0x3e')][_0x5bec('0x34')](function(_0x4db497){_0x387ad9[_0x5bec('0x46')]('i.'+_0x4db497);});}else{_0x387ad9['field'](_0x5bec('0x8c'),_0x5bec('0x5b'));_0x387ad9['field']('a.key',_0x5bec('0x9d'));_0x387ad9['field'](_0x5bec('0x9e'),'Account.mandatoryDisposition');_0x387ad9[_0x5bec('0x46')](_0x5bec('0x9f'),'contactName');_0x387ad9[_0x5bec('0x46')]('i.*');_0x387ad9[_0x5bec('0x46')]('c.firstName',_0x5bec('0xa0'));_0x387ad9[_0x5bec('0x46')]('c.lastName',_0x5bec('0xa1'));_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa2'),_0x5bec('0xa3'));_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa4'),'Contact.phone');_0x387ad9[_0x5bec('0x46')]('c.mobile',_0x5bec('0xa5'));_0x387ad9['field']('c.fax',_0x5bec('0xa6'));_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa7'),'Owner.fullname');_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa8'),_0x5bec('0xa9'));_0x387ad9[_0x5bec('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5bec('0x31'));}if(_0x2d3793[_0x5bec('0x25')])_0x387ad9[_0x5bec('0x25')](_0x2d3793[_0x5bec('0x25')]);if(_0x2d3793['offset'])_0x387ad9[_0x5bec('0x24')](_0x2d3793[_0x5bec('0x24')]);return db[_0x5bec('0x99')][_0x5bec('0x3b')](_0x387ad9[_0x5bec('0x9a')](),_0x10550a);})[_0x5bec('0x29')](function(_0x13fbfc){_0x59e5d0[_0x5bec('0x43')]('ui.FaxInteractionId\x20IN\x20?',_[_0x5bec('0x2f')](_0x13fbfc,'id'));return db[_0x5bec('0x99')][_0x5bec('0x3b')](_0x59e5d0[_0x5bec('0x9a')](),_0x10550a)[_0x5bec('0x29')](function(_0x48f844){var _0x8af8a2=_[_0x5bec('0xaa')](_0x48f844,'FaxInteractionId');var _0x18f07a=[];_0x13fbfc['forEach'](function(_0x1ed963){_0x18f07a[_0x5bec('0x35')](updateFaxInteraction(_0x1ed963,_0x26a4a5,_0x8af8a2));});return BPromise[_0x5bec('0xab')](_0x18f07a);});});})[_0x5bec('0x29')](function(_0x3cf417){_0x182b86['rows']=_0x3cf417;return _0x182b86;})[_0x5bec('0x29')](respondWithFilteredResult(_0x583b96,_0x2d3793))[_0x5bec('0x36')](handleError(_0x583b96,null));};exports[_0x5bec('0xac')]=function(_0x98b146,_0x652c3a){var _0x3287d6={'raw':![],'where':{'id':_0x98b146[_0x5bec('0xad')]['id']}},_0x377489={};_0x377489[_0x5bec('0x3a')]=_['keys'](db[_0x5bec('0x37')][_0x5bec('0xae')]);_0x377489[_0x5bec('0x3b')]=_['keys'](_0x98b146['query']);_0x377489[_0x5bec('0x3c')]=_[_0x5bec('0x3d')](_0x377489['model'],_0x377489[_0x5bec('0x3b')]);_0x3287d6['attributes']=_[_0x5bec('0x3d')](_0x377489['model'],qs[_0x5bec('0x3f')](_0x98b146['query'][_0x5bec('0x3f')]));_0x3287d6['attributes']=_0x3287d6[_0x5bec('0x3e')]['length']?_0x3287d6[_0x5bec('0x3e')]:_0x377489[_0x5bec('0x3a')];if(_0x98b146['query'][_0x5bec('0xaf')]){_0x3287d6[_0x5bec('0xb0')]=[{'all':!![]}];}_0x3287d6=_['merge']({},_0x3287d6,_0x98b146[_0x5bec('0xb1')]);return db[_0x5bec('0x37')][_0x5bec('0x5a')](_0x3287d6)[_0x5bec('0x29')](handleEntityNotFound(_0x652c3a,null))[_0x5bec('0x29')](respondWithResult(_0x652c3a,null))[_0x5bec('0x36')](handleError(_0x652c3a,null));};exports[_0x5bec('0xb2')]=function(_0x1c9f75,_0x1a6266){return db['FaxInteraction']['create'](_0x1c9f75['body'],{})['then'](respondWithResult(_0x1a6266,0xc9))[_0x5bec('0x36')](handleError(_0x1a6266,null));};exports['update']=function(_0x21e58e,_0x54632b){if(_0x21e58e[_0x5bec('0x6d')]['id']){delete _0x21e58e[_0x5bec('0x6d')]['id'];}return db[_0x5bec('0x37')]['find']({'where':{'id':_0x21e58e[_0x5bec('0xad')]['id']}})['then'](handleEntityNotFound(_0x54632b,null))[_0x5bec('0x29')](saveUpdates(_0x21e58e[_0x5bec('0x6d')],null))[_0x5bec('0x29')](respondWithResult(_0x54632b,null))[_0x5bec('0x36')](handleError(_0x54632b,null));};exports[_0x5bec('0x2a')]=function(_0x2ffee8,_0x18fec4){return db['FaxInteraction'][_0x5bec('0x5a')]({'where':{'id':_0x2ffee8[_0x5bec('0xad')]['id']}})[_0x5bec('0x29')](handleEntityNotFound(_0x18fec4,null))[_0x5bec('0x29')](removeEntity(_0x18fec4,null))['catch'](handleError(_0x18fec4,null));};exports[_0x5bec('0xb3')]=function(_0x91b3eb,_0x2015ec){return db[_0x5bec('0x37')][_0x5bec('0xb3')]()['then'](respondWithResult(_0x2015ec,null))['catch'](handleError(_0x2015ec,null));};exports['addMessage']=function(_0x56f13f,_0x5eb127,_0xd8e688){return db['FaxMessage'][_0x5bec('0x5a')]({'where':{'id':_0x56f13f[_0x5bec('0xad')]['id']}})['then'](handleEntityNotFound(_0x5eb127,null))[_0x5bec('0x29')](function(_0x30c84c){if(_0x30c84c){return _0x30c84c['addMessage'](_0x56f13f[_0x5bec('0x6d')][_0x5bec('0xb4')],_[_0x5bec('0xb5')](_0x56f13f[_0x5bec('0x6d')],[_0x5bec('0xb4'),'id'])||{});}})[_0x5bec('0x29')](respondWithResult(_0x5eb127,null))[_0x5bec('0x36')](handleError(_0x5eb127,null));};exports[_0x5bec('0xb6')]=function(_0x54e6d0,_0x18fb4b,_0x2e94c0){var _0x3ae6b5={'raw':![],'where':{}};var _0x2ddae7={};var _0x17708f={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x54e6d0[_0x5bec('0xad')]['id']}})[_0x5bec('0x29')](handleEntityNotFound(_0x18fb4b,null))[_0x5bec('0x29')](function(_0x9d4c85){if(_0x9d4c85){_0x2ddae7[_0x5bec('0x3a')]=_['keys'](db[_0x5bec('0xb7')][_0x5bec('0xae')]);_0x2ddae7['query']=_[_0x5bec('0x6e')](_0x54e6d0[_0x5bec('0x3b')]);_0x2ddae7['filters']=_[_0x5bec('0x3d')](_0x2ddae7[_0x5bec('0x3a')],_0x2ddae7[_0x5bec('0x3b')]);_0x3ae6b5[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x2ddae7['model'],qs['fields'](_0x54e6d0['query']['fields']));_0x3ae6b5[_0x5bec('0x3e')]=_0x3ae6b5[_0x5bec('0x3e')][_0x5bec('0x40')]?_0x3ae6b5[_0x5bec('0x3e')]:_0x2ddae7[_0x5bec('0x3a')];if(!_0x54e6d0[_0x5bec('0x3b')]['hasOwnProperty']('nolimit')){_0x3ae6b5[_0x5bec('0x25')]=qs[_0x5bec('0x25')](_0x54e6d0['query']['limit']);_0x3ae6b5[_0x5bec('0x24')]=qs[_0x5bec('0x24')](_0x54e6d0['query'][_0x5bec('0x24')]);}_0x3ae6b5[_0x5bec('0x8d')]=qs[_0x5bec('0xb8')](_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0xb8')]);_0x3ae6b5[_0x5bec('0x43')]=qs[_0x5bec('0x3c')](_['pick'](_0x54e6d0[_0x5bec('0x3b')],_0x2ddae7['filters']));_0x3ae6b5['where'][_0x5bec('0xb9')]=_0x9d4c85['id'];if(_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0x80')]){_0x3ae6b5['where']=_['merge'](_0x3ae6b5[_0x5bec('0x43')],{'$or':_[_0x5bec('0x2f')](_0x3ae6b5[_0x5bec('0x3e')],function(_0x41b927){var _0x1cfe3c={};_0x1cfe3c[_0x41b927]={'$like':'%'+_0x54e6d0['query'][_0x5bec('0x80')]+'%'};return _0x1cfe3c;})});}if(_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0x75')]){var _0x56553c=_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0x75')]['split'](',');var _0x11f03e={};_0x11f03e[_0x56553c[0x0]]={'$gte':moment(_0x56553c[0x1])[_0x5bec('0xba')](_0x5bec('0xbb'))};_0x3ae6b5[_0x5bec('0x43')]=_[_0x5bec('0x9c')](_0x3ae6b5[_0x5bec('0x43')],_0x11f03e);}_0x3ae6b5=_[_0x5bec('0x9c')]({},_0x3ae6b5,_0x54e6d0[_0x5bec('0xb1')]);return db[_0x5bec('0xb7')][_0x5bec('0x23')]({'where':_0x3ae6b5['where']})[_0x5bec('0x29')](function(_0x3420e6){_0x17708f[_0x5bec('0x23')]=_0x3420e6;if(_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0xaf')]){_0x3ae6b5['include']=[{'all':!![]}];}return db[_0x5bec('0xb7')][_0x5bec('0xbc')](_0x3ae6b5);})['then'](function(_0x1a2622){_0x17708f[_0x5bec('0xbd')]=_0x1a2622;return _0x17708f;});}})['then'](respondWithFilteredResult(_0x18fb4b,_0x3ae6b5))[_0x5bec('0x36')](handleError(_0x18fb4b,null));};exports[_0x5bec('0xbe')]=function(_0x2b6322,_0x596033,_0x445db9){return db[_0x5bec('0x37')][_0x5bec('0x5a')]({'where':{'id':_0x2b6322[_0x5bec('0xad')]['id']}})['then'](handleEntityNotFound(_0x596033,null))[_0x5bec('0x29')](function(_0x1a66ee){if(_0x1a66ee){return _0x1a66ee[_0x5bec('0xbf')](_0x2b6322[_0x5bec('0x6d')]['ids'],_[_0x5bec('0xb5')](_0x2b6322[_0x5bec('0x6d')],[_0x5bec('0xb4'),'id'])||{})[_0x5bec('0xc0')](function(){return db[_0x5bec('0xc1')][_0x5bec('0xbc')]({'attributes':['id',_0x5bec('0x2c'),_0x5bec('0x47')],'where':{'id':_0x2b6322[_0x5bec('0x6d')][_0x5bec('0xb4')]}});})[_0x5bec('0x29')](function(_0x4521c4){socket[_0x5bec('0xc2')]('faxInteractionTags:save',{'id':Number(_0x2b6322['params']['id']),'tags':_0x4521c4||[]});return{'id':Number(_0x2b6322[_0x5bec('0xad')]['id']),'tags':_0x4521c4||[]};});}})['then'](respondWithResult(_0x596033,null))['catch'](handleError(_0x596033,null));};exports[_0x5bec('0xc3')]=function(_0x102716,_0x15cae6,_0x27dc52){return db[_0x5bec('0x37')][_0x5bec('0x5a')]({'where':{'id':_0x102716['params']['id']}})[_0x5bec('0x29')](handleEntityNotFound(_0x15cae6,null))['then'](function(_0x1d9c5a){if(_0x1d9c5a){return _0x1d9c5a[_0x5bec('0xc3')](_0x102716[_0x5bec('0x3b')]['ids']);}})[_0x5bec('0x29')](respondWithStatusCode(_0x15cae6,null))[_0x5bec('0x36')](handleError(_0x15cae6,null));};exports[_0x5bec('0xc4')]=function(_0x5ca863,_0x337623){var _0x42b0e7=moment()['unix']()[_0x5bec('0x9a')]();var _0x5ccad0=path[_0x5bec('0xc5')](config[_0x5bec('0xc6')],'server',_0x5bec('0xc7'),_0x5bec('0xc8'));var _0x16a7fb=path['join'](config[_0x5bec('0xc6')],_0x5bec('0xc9'),_0x5bec('0xc7'),_0x5bec('0xca'));var _0x35e278=path[_0x5bec('0xc5')](_0x5ccad0,_0x42b0e7);var _0xd5a1b5=util[_0x5bec('0xba')](_0x5bec('0xcb'),_0x5ca863[_0x5bec('0xad')]['id'],_0x42b0e7);var _0xd0a3d0=path['join'](_0x5ccad0,_0xd5a1b5);var _0x4ad61b=[];_0x4ad61b[_0x5bec('0x35')]({'model':db[_0x5bec('0xcc')],'as':'Attachment','raw':!![]});var _0x5e56b5=[{'model':db[_0x5bec('0xb7')],'as':_0x5bec('0xcd'),'attributes':['id',_0x5bec('0x6d'),_0x5bec('0x74')],'include':_0x4ad61b}];return db[_0x5bec('0x37')][_0x5bec('0x5a')]({'where':{'id':_0x5ca863[_0x5bec('0xad')]['id']},'include':_0x5e56b5})['then'](handleEntityNotFound(_0x337623,null))[_0x5bec('0x29')](function(_0x53fed7){if(_0x53fed7&&_0x53fed7[_0x5bec('0xcd')]){var _0x1f7a69=_0x53fed7[_0x5bec('0xce')]({'plain':!![]});fs[_0x5bec('0xcf')](_0x35e278);for(var _0xd008ba=0x0;_0xd008ba<_0x1f7a69[_0x5bec('0xcd')][_0x5bec('0x40')];_0xd008ba++){var _0x509a16=_0x1f7a69[_0x5bec('0xcd')][_0xd008ba]['Attachment'];if(_0x509a16){var _0x236cb8=path[_0x5bec('0xc5')](_0x16a7fb,_0x509a16['basename']);if(fs['existsSync'](_0x236cb8)){fs['createReadStream'](_0x236cb8)[_0x5bec('0xd0')](fs['createWriteStream'](path[_0x5bec('0xc5')](_0x35e278,_0x509a16[_0x5bec('0xd1')])));}}}return BPromise[_0x5bec('0x90')]()[_0x5bec('0x29')](function(){return new BPromise(function(_0x5e70f7,_0x664e77){zipdir(_0x35e278,{'saveTo':_0xd0a3d0},function(_0x1eafc5,_0x5f2f79){if(_0x1eafc5)return _0x664e77(_0x1eafc5);return _0x5e70f7(_0x5f2f79);});})[_0x5bec('0x29')](function(){return new BPromise(function(_0x3b7d81,_0x4a7481){rimraf(_0x35e278,function(_0x5aa675){if(_0x5aa675)_0x4a7481(_0x5aa675);return _0x3b7d81();});});})[_0x5bec('0x29')](function(){return _0x337623[_0x5bec('0xc4')](_0xd0a3d0,_0xd5a1b5,function(_0x43cbe3){if(_0x43cbe3){console['log'](_0x5bec('0xd2'),_0x43cbe3);}else{fs['unlinkSync'](_0xd0a3d0);}});});});}else{return _0x337623[_0x5bec('0x1f')](0xc8);}})['catch'](handleError(_0x337623,null));}; \ No newline at end of file +var _0xaa88=['UserId','type','text','start','body','buildExpression','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','contactName','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','keys','filters','include','options','create','describe','FaxMessage','addMessage','ids','omit','merge','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','findAll','color','emit','removeTags','download','join','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','Users','map','TagIds','split','forEach','Tags','push','catch','FaxInteraction','rawAttributes','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring'];(function(_0x45ff59,_0x49378f){var _0x2c8cd9=function(_0x3024b8){while(--_0x3024b8){_0x45ff59['push'](_0x45ff59['shift']());}};_0x2c8cd9(++_0x49378f);}(_0xaa88,0x137));var _0x8aa8=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0xaa88[_0x33c1b1];return _0x2c2037;};'use strict';var pdf=require(_0x8aa8('0x0'));var emlformat=require(_0x8aa8('0x1'));var rimraf=require(_0x8aa8('0x2'));var zipdir=require(_0x8aa8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8aa8('0x4'));var moment=require(_0x8aa8('0x5'));var BPromise=require(_0x8aa8('0x6'));var Mustache=require(_0x8aa8('0x7'));var util=require(_0x8aa8('0x8'));var path=require(_0x8aa8('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8aa8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];config[_0x8aa8('0x19')]=_[_0x8aa8('0x1a')](config['redis'],{'host':_0x8aa8('0x1b'),'port':0x18eb});var socket=require(_0x8aa8('0x1c'))(new Redis(config[_0x8aa8('0x19')]));require('./faxInteraction.socket')[_0x8aa8('0x1d')](socket);function respondWithStatusCode(_0x4af534,_0x4f3a2e){_0x4f3a2e=_0x4f3a2e||0xcc;return function(_0x433e95){if(_0x433e95){return _0x4af534[_0x8aa8('0x1e')](_0x4f3a2e);}return _0x4af534[_0x8aa8('0x1f')](_0x4f3a2e)[_0x8aa8('0x20')]();};}function respondWithResult(_0x42a6a4,_0x3778f4){_0x3778f4=_0x3778f4||0xc8;return function(_0x1bdd39){if(_0x1bdd39){return _0x42a6a4[_0x8aa8('0x1f')](_0x3778f4)[_0x8aa8('0x21')](_0x1bdd39);}};}function respondWithFilteredResult(_0x4e8ce3,_0x4843f5){return function(_0x2c1b9a){if(_0x2c1b9a){var _0x49d80d=_0x2c1b9a[_0x8aa8('0x22')],_0x557adc=_0x4843f5[_0x8aa8('0x23')],_0xab7af5=_0x4843f5[_0x8aa8('0x23')]+_0x4843f5[_0x8aa8('0x24')],_0x5ac0d9;if(_0xab7af5>=_0x49d80d){_0xab7af5=_0x49d80d;_0x5ac0d9=0xc8;}else{_0x5ac0d9=0xce;}_0x4e8ce3['status'](_0x5ac0d9);return _0x4e8ce3[_0x8aa8('0x25')](_0x8aa8('0x26'),_0x557adc+'-'+_0xab7af5+'/'+_0x49d80d)[_0x8aa8('0x21')](_0x2c1b9a);}return null;};}function patchUpdates(_0x10f11c){return function(_0x4c754e){try{jsonpatch[_0x8aa8('0x27')](_0x4c754e,_0x10f11c,!![]);}catch(_0x5d9b62){return BPromise[_0x8aa8('0x28')](_0x5d9b62);}return _0x4c754e['save']();};}function saveUpdates(_0x1fdadd,_0x47dd5d){return function(_0x2c1828){if(_0x2c1828){return _0x2c1828['update'](_0x1fdadd)[_0x8aa8('0x29')](function(_0x40adb5){return _0x40adb5;});}return null;};}function removeEntity(_0x3ca7dc,_0x5e5d91){return function(_0x24f428){if(_0x24f428){return _0x24f428[_0x8aa8('0x2a')]()[_0x8aa8('0x29')](function(){_0x3ca7dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1508,_0x44e2d8){return function(_0x2f91f3){if(!_0x2f91f3){_0x2d1508[_0x8aa8('0x1e')](0x194);}return _0x2f91f3;};}function handleError(_0x24143e,_0x4a8212){_0x4a8212=_0x4a8212||0x1f4;return function(_0x2bc34a){logger['error'](_0x2bc34a[_0x8aa8('0x2b')]);if(_0x2bc34a[_0x8aa8('0x2c')]){delete _0x2bc34a[_0x8aa8('0x2c')];}_0x24143e['status'](_0x4a8212)['send'](_0x2bc34a);};}function getInteractionUsers(_0x10810d,_0x5e96c9){return new BPromise(function(_0x385208,_0x14be8b){try{if(_0x5e96c9[_0x10810d['id']]){_0x10810d[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x5e96c9[_0x10810d['id']],function(_0xe07a83){return{'id':_0xe07a83['id'],'fullname':_0xe07a83['fullname']};});}}catch(_0x267f4c){_0x14be8b(_0x267f4c);}_0x385208(_0x10810d);});}function getInteractionTags(_0x3003e5,_0x4b67f5){return new BPromise(function(_0x99f74e,_0xee2f61){try{if(_0x3003e5[_0x8aa8('0x2f')]){_0x3003e5['Tags']=[];_0x3003e5[_0x8aa8('0x2f')][_0x8aa8('0x30')](',')[_0x8aa8('0x31')](function(_0x423b02){_0x3003e5[_0x8aa8('0x32')][_0x8aa8('0x33')](_0x4b67f5[_0x423b02]);});}delete _0x3003e5[_0x8aa8('0x2f')];}catch(_0xcad4f8){_0xee2f61(_0xcad4f8);}_0x99f74e(_0x3003e5);});}function updateFaxInteraction(_0x354375,_0x3a257c,_0x3e069a){return new BPromise(function(_0x5bf1a7,_0x5e8a5e){return getInteractionUsers(_0x354375,_0x3e069a)[_0x8aa8('0x29')](function(_0x1270ff){return getInteractionTags(_0x1270ff,_0x3a257c);})[_0x8aa8('0x29')](function(_0x106ccb){_0x5bf1a7(_0x106ccb);})[_0x8aa8('0x34')](function(_0x2f27cd){_0x5e8a5e(_0x2f27cd);});});}exports['index']=function(_0x4b8118,_0x19ed76){var _0x5755b5={},_0x24997c={},_0x2c5c84={'count':0x0,'rows':[]};var _0x25066c=_['map'](db[_0x8aa8('0x35')][_0x8aa8('0x36')],function(_0x231e29){return{'name':_0x231e29['fieldName'],'type':_0x231e29['type'][_0x8aa8('0x37')]};});_0x24997c[_0x8aa8('0x38')]=_['map'](_0x25066c,_0x8aa8('0x2c'));_0x24997c[_0x8aa8('0x39')]=_['keys'](_0x4b8118[_0x8aa8('0x39')]);_0x24997c['filters']=_['intersection'](_0x24997c[_0x8aa8('0x38')],_0x24997c['query']);_0x5755b5[_0x8aa8('0x3a')]=_[_0x8aa8('0x3b')](_0x24997c[_0x8aa8('0x38')],qs[_0x8aa8('0x3c')](_0x4b8118['query'][_0x8aa8('0x3c')]));_0x5755b5[_0x8aa8('0x3a')]=_0x5755b5['attributes'][_0x8aa8('0x3d')]?_0x5755b5[_0x8aa8('0x3a')]:_0x24997c['model'];if(!_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x3e')](_0x8aa8('0x3f'))){_0x5755b5[_0x8aa8('0x24')]=qs[_0x8aa8('0x24')](_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x24')]);_0x5755b5[_0x8aa8('0x23')]=qs[_0x8aa8('0x23')](_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x23')]);}_0x5755b5[_0x8aa8('0x40')]=qs[_0x8aa8('0x41')](_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x41')]);_0x5755b5[_0x8aa8('0x42')]=qs['filters'](_[_0x8aa8('0x43')](_0x4b8118['query'],_0x24997c['filters']),_0x25066c);var _0x572132=[];var _0x46eea7=squel['select']()['field']('id')[_0x8aa8('0x44')]('name')[_0x8aa8('0x44')]('color')['from'](_0x8aa8('0x45'));var _0x6f3728=squel[_0x8aa8('0x46')]()[_0x8aa8('0x44')](_0x8aa8('0x47'))[_0x8aa8('0x44')](_0x8aa8('0x48'))['field'](_0x8aa8('0x49'))['from'](_0x8aa8('0x4a'),'ui')[_0x8aa8('0x4b')](_0x8aa8('0x4c'),'u',_0x8aa8('0x4d'));var _0x2a0a14=squel[_0x8aa8('0x46')]()['from']('fax_interactions','i')[_0x8aa8('0x4b')](_0x8aa8('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8aa8('0x4b')](_0x8aa8('0x4c'),'o',_0x8aa8('0x4f'))['left_join']('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x8aa8('0x50'),'me',_0x8aa8('0x51'))['left_join'](_0x8aa8('0x52'),'it',_0x8aa8('0x53'))[_0x8aa8('0x4b')](_0x8aa8('0x45'),'t',_0x8aa8('0x54'));var _0x6a6f93=squel['expr']();var _0x4da826=[];var _0x1ef57a=squel['expr']();var _0x20c368;if(_0x4b8118['query'][_0x8aa8('0x55')]){_0x20c368=as[_0x8aa8('0x56')](_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x55')]);var _0x36de37=_0x20c368[_0x8aa8('0x57')];for(var _0x997597=0x0;_0x997597<_0x20c368[_0x8aa8('0x58')][_0x8aa8('0x3d')];_0x997597++){var _0x850854=_0x20c368[_0x8aa8('0x58')][_0x997597];var _0x344c42='i';var _0x4fc51d=_[_0x8aa8('0x59')](_0x25066c,['name',_0x850854['field']]);if(!_0x4fc51d){switch(_0x850854['field']){case _0x8aa8('0x5a'):if(_0x850854['value']==0x1){_0x2a0a14[_0x8aa8('0x5b')]('`'+_0x850854[_0x8aa8('0x44')]+_0x8aa8('0x5c'));}else{_0x2a0a14['having']('`'+_0x850854[_0x8aa8('0x44')]+_0x8aa8('0x5d'));}break;case _0x8aa8('0x5e'):if(_0x850854[_0x8aa8('0x5f')]==='$substring'){if(_0x850854['value'][_0x8aa8('0x30')]('\x20')[_0x8aa8('0x3d')]>0x1){_0x6a6f93[_0x36de37](_0x8aa8('0x60'),qs[_0x8aa8('0x61')](_0x850854['value']),null);}else{var _0x5d3985='%'+_0x850854[_0x8aa8('0x62')]+'%';_0x6a6f93[_0x36de37](_0x8aa8('0x63'),_0x5d3985,_0x5d3985,_0x5d3985);}}else{_0x4fc51d=_[_0x8aa8('0x59')](_0x25066c,['name',_0x8aa8('0x64')]);_0x850854[_0x8aa8('0x44')]='ContactId';_0x5b160d=as['buildExpression'](_0x344c42,_0x4fc51d['type'],_0x850854);_0x6a6f93[_0x36de37](_0x5b160d['text'],_0x5b160d[_0x8aa8('0x62')]['start'],_0x5b160d[_0x8aa8('0x62')][_0x8aa8('0x20')]);}break;case'Tag':var _0x581baa=_0x850854[_0x8aa8('0x62')][_0x8aa8('0x30')](',')['map'](function(_0x58830e){return Number(_0x58830e);});_0x581baa['forEach'](function(_0x3d2076){_0x1ef57a['or'](_0x8aa8('0x65'),'%,'+_0x3d2076+',%');});_0x4da826=_['union'](_0x4da826,_0x581baa);break;case'User':if(_0x850854[_0x8aa8('0x5f')]===_0x8aa8('0x66')){_0x6a6f93[_0x36de37]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x850854[_0x8aa8('0x62')]+'%',null);}else{_0x4fc51d=_[_0x8aa8('0x59')](_0x25066c,['name',_0x8aa8('0x67')]);_0x850854['field']=_0x8aa8('0x67');_0x5b160d=as['buildExpression'](_0x344c42,_0x4fc51d[_0x8aa8('0x68')],_0x850854);_0x6a6f93[_0x36de37](_0x5b160d[_0x8aa8('0x69')],_0x5b160d[_0x8aa8('0x62')][_0x8aa8('0x6a')],_0x5b160d[_0x8aa8('0x62')]['end']);}break;case _0x8aa8('0x6b'):_0x5b160d=as[_0x8aa8('0x6c')]('me',null,_0x850854);_0x6a6f93[_0x36de37](_0x5b160d[_0x8aa8('0x69')],_0x5b160d[_0x8aa8('0x62')]['start'],_0x5b160d[_0x8aa8('0x62')][_0x8aa8('0x20')]);break;}}else{var _0x5b160d=as[_0x8aa8('0x6c')](_0x344c42,_0x4fc51d[_0x8aa8('0x68')],_0x850854);_0x6a6f93[_0x36de37](_0x5b160d[_0x8aa8('0x69')],_0x5b160d[_0x8aa8('0x62')][_0x8aa8('0x6a')],_0x5b160d[_0x8aa8('0x62')][_0x8aa8('0x20')]);}}}else{var _0x5eef74=_(_0x4b8118['query'])['keys']()[_0x8aa8('0x2e')](function(_0x3396fe){return _[_0x8aa8('0x6d')](_0x25066c,[_0x8aa8('0x2c'),_0x3396fe])?_0x3396fe:undefined;})[_0x8aa8('0x6e')]()[_0x8aa8('0x62')]();if(!_[_0x8aa8('0x6f')](_0x5eef74)){_0x5eef74[_0x8aa8('0x31')](function(_0x1a6bf2){if(_0x1a6bf2===_0x8aa8('0x70')){_0x2a0a14[_0x8aa8('0x42')](_0x8aa8('0x71'),[][_0x8aa8('0x72')](_0x4b8118[_0x8aa8('0x39')][_0x1a6bf2]));}else if(_0x1a6bf2===_0x8aa8('0x73')){var _0x36523a=JSON[_0x8aa8('0x74')](_0x4b8118[_0x8aa8('0x39')][_0x1a6bf2])[_0x8aa8('0x75')];var _0x57c6f5=JSON[_0x8aa8('0x74')](_0x4b8118[_0x8aa8('0x39')][_0x1a6bf2])[_0x8aa8('0x76')];_0x2a0a14[_0x8aa8('0x42')](_0x8aa8('0x77'),_0x36523a,_0x57c6f5);}else{if(_0x4b8118[_0x8aa8('0x39')][_0x1a6bf2]===_0x8aa8('0x78')){_0x2a0a14[_0x8aa8('0x42')]('i.'+_0x1a6bf2+_0x8aa8('0x79'));}else{_0x2a0a14['where']('i.'+_0x1a6bf2+_0x8aa8('0x7a'),_0x4b8118[_0x8aa8('0x39')][_0x1a6bf2]);}}});}if(_0x4b8118['query'][_0x8aa8('0x7b')]){if(_0x4b8118['query'][_0x8aa8('0x7b')]==0x1){_0x2a0a14[_0x8aa8('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x2a0a14[_0x8aa8('0x5b')](_0x8aa8('0x7c'));}}if(_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x7d')]){_0x4da826=_[_0x8aa8('0x7e')](_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x7d')])?_0x4b8118['query'][_0x8aa8('0x7d')]:new Array(_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x7d')]);_0x4da826[_0x8aa8('0x31')](function(_0x4f72a4){_0x1ef57a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f72a4+',%');});}if(_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x7f')]){var _0x430fc9=_0x4b8118[_0x8aa8('0x39')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8aa8('0x80')](_0x430fc9)){_0x6a6f93['or'](_0x8aa8('0x81'),_0x430fc9+'%')['or'](_0x8aa8('0x82'),_0x430fc9+'%');}_0x6a6f93['or'](_0x8aa8('0x83'),_0x430fc9+'%');}}_0x2a0a14[_0x8aa8('0x42')](_0x6a6f93);_0x2a0a14[_0x8aa8('0x84')](_0x8aa8('0x85'));var _0x14b347={'type':db[_0x8aa8('0x86')]['QueryTypes'][_0x8aa8('0x87')],'raw':!![]};var _0x5c90b3=_0x2a0a14['clone']();_0x5c90b3[_0x8aa8('0x44')](_0x8aa8('0x85'));_0x5c90b3[_0x8aa8('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8aa8('0x5a'));if(_0x5755b5['order']){_0x5755b5[_0x8aa8('0x40')][_0x8aa8('0x31')](function(_0x46a637){var _0xdb62e7=_0x46a637[0x0]===_0x8aa8('0x88')?_0x46a637[0x0]:'i.'+_0x46a637[0x0];_0x2a0a14['order'](_0xdb62e7,_0x46a637[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8aa8('0x6f')](_0x4da826)){_0x2a0a14[_0x8aa8('0x5b')](_0x1ef57a);_0x5c90b3[_0x8aa8('0x42')](_0x8aa8('0x89'),_0x4da826);}BPromise[_0x8aa8('0x8a')]()[_0x8aa8('0x29')](function(){if(!_0x20c368){if(_0x4b8118[_0x8aa8('0x39')][_0x8aa8('0x70')]||_0x4b8118['query'][_0x8aa8('0x8b')])return;_0x5c90b3[_0x8aa8('0x42')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2a0a14['where'](_0x8aa8('0x8c'));return;}if(_0x4b8118[_0x8aa8('0x8d')]['role']!==_0x8aa8('0x8e'))return;return _0x4b8118[_0x8aa8('0x8d')][_0x8aa8('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d213b){if(_['isEmpty'](_0x4d213b)){_0x5c90b3[_0x8aa8('0x42')](_0x8aa8('0x90'));_0x2a0a14[_0x8aa8('0x42')](_0x8aa8('0x90'));}else{_0x5c90b3['where'](_0x8aa8('0x71'),_[_0x8aa8('0x2e')](_0x4d213b,'id'));_0x2a0a14[_0x8aa8('0x42')](_0x8aa8('0x71'),_['map'](_0x4d213b,'id'));}});})[_0x8aa8('0x29')](function(){if(_0x4b8118['user']['role']===_0x8aa8('0x8e')&&!_0x20c368&&!_0x4b8118['query'][_0x8aa8('0x70')])return[];return db[_0x8aa8('0x91')][_0x8aa8('0x39')](_0x5c90b3['toString'](),_0x14b347);})[_0x8aa8('0x29')](function(_0x3d30b7){_0x2c5c84[_0x8aa8('0x22')]=_0x3d30b7[_0x8aa8('0x3d')];if(_0x2c5c84[_0x8aa8('0x22')]===0x0)return[];return db[_0x8aa8('0x91')]['query'](_0x46eea7['toString'](),_0x14b347)[_0x8aa8('0x29')](function(_0x4bd4ff){_0x572132=_['keyBy'](_0x4bd4ff,'id');_0x14b347=_['merge'](_0x14b347,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b8118['query'][_0x8aa8('0x3c')]){_0x5755b5[_0x8aa8('0x3a')][_0x8aa8('0x31')](function(_0x1ab514){_0x2a0a14[_0x8aa8('0x44')]('i.'+_0x1ab514);});}else{_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x92'),_0x8aa8('0x5a'));_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x93'),'Account.key');_0x2a0a14['field'](_0x8aa8('0x94'),_0x8aa8('0x95'));_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x96'),_0x8aa8('0x88'));_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x97'));_0x2a0a14[_0x8aa8('0x44')]('c.firstName',_0x8aa8('0x98'));_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x99'),'Contact.lastName');_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x9a'),'Contact.email');_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x9b'),_0x8aa8('0x9c'));_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x9d'),'Contact.mobile');_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0x9e'),_0x8aa8('0x9f'));_0x2a0a14['field'](_0x8aa8('0xa0'),_0x8aa8('0xa1'));_0x2a0a14[_0x8aa8('0x44')](_0x8aa8('0xa2'),_0x8aa8('0xa3'));_0x2a0a14[_0x8aa8('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8aa8('0x2f'));}if(_0x5755b5['limit'])_0x2a0a14[_0x8aa8('0x24')](_0x5755b5[_0x8aa8('0x24')]);if(_0x5755b5[_0x8aa8('0x23')])_0x2a0a14[_0x8aa8('0x23')](_0x5755b5[_0x8aa8('0x23')]);return db['sequelize'][_0x8aa8('0x39')](_0x2a0a14[_0x8aa8('0xa4')](),_0x14b347);})[_0x8aa8('0x29')](function(_0x37c311){_0x6f3728[_0x8aa8('0x42')](_0x8aa8('0xa5'),_[_0x8aa8('0x2e')](_0x37c311,'id'));return db['sequelize']['query'](_0x6f3728[_0x8aa8('0xa4')](),_0x14b347)[_0x8aa8('0x29')](function(_0x267b69){var _0x3622e3=_[_0x8aa8('0xa6')](_0x267b69,_0x8aa8('0xa7'));var _0x351d4e=[];_0x37c311[_0x8aa8('0x31')](function(_0x5cdb27){_0x351d4e[_0x8aa8('0x33')](updateFaxInteraction(_0x5cdb27,_0x572132,_0x3622e3));});return BPromise[_0x8aa8('0xa8')](_0x351d4e);});});})['then'](function(_0x2b7855){_0x2c5c84['rows']=_0x2b7855;return _0x2c5c84;})[_0x8aa8('0x29')](respondWithFilteredResult(_0x19ed76,_0x5755b5))[_0x8aa8('0x34')](handleError(_0x19ed76,null));};exports[_0x8aa8('0xa9')]=function(_0x3fd7e7,_0xd804da){var _0x18e04c={'raw':![],'where':{'id':_0x3fd7e7[_0x8aa8('0xaa')]['id']}},_0x593021={};_0x593021[_0x8aa8('0x38')]=_[_0x8aa8('0xab')](db[_0x8aa8('0x35')][_0x8aa8('0x36')]);_0x593021['query']=_[_0x8aa8('0xab')](_0x3fd7e7[_0x8aa8('0x39')]);_0x593021[_0x8aa8('0xac')]=_[_0x8aa8('0x3b')](_0x593021[_0x8aa8('0x38')],_0x593021[_0x8aa8('0x39')]);_0x18e04c[_0x8aa8('0x3a')]=_[_0x8aa8('0x3b')](_0x593021[_0x8aa8('0x38')],qs[_0x8aa8('0x3c')](_0x3fd7e7['query']['fields']));_0x18e04c[_0x8aa8('0x3a')]=_0x18e04c[_0x8aa8('0x3a')][_0x8aa8('0x3d')]?_0x18e04c[_0x8aa8('0x3a')]:_0x593021[_0x8aa8('0x38')];if(_0x3fd7e7[_0x8aa8('0x39')]['includeAll']){_0x18e04c[_0x8aa8('0xad')]=[{'all':!![]}];}_0x18e04c=_['merge']({},_0x18e04c,_0x3fd7e7[_0x8aa8('0xae')]);return db[_0x8aa8('0x35')][_0x8aa8('0x59')](_0x18e04c)[_0x8aa8('0x29')](handleEntityNotFound(_0xd804da,null))['then'](respondWithResult(_0xd804da,null))[_0x8aa8('0x34')](handleError(_0xd804da,null));};exports[_0x8aa8('0xaf')]=function(_0x481a72,_0x53b25d){return db[_0x8aa8('0x35')]['create'](_0x481a72['body'],{})[_0x8aa8('0x29')](respondWithResult(_0x53b25d,0xc9))[_0x8aa8('0x34')](handleError(_0x53b25d,null));};exports['update']=function(_0x1fe9e7,_0x27f02f){if(_0x1fe9e7[_0x8aa8('0x6b')]['id']){delete _0x1fe9e7[_0x8aa8('0x6b')]['id'];}return db['FaxInteraction'][_0x8aa8('0x59')]({'where':{'id':_0x1fe9e7[_0x8aa8('0xaa')]['id']}})[_0x8aa8('0x29')](handleEntityNotFound(_0x27f02f,null))[_0x8aa8('0x29')](saveUpdates(_0x1fe9e7[_0x8aa8('0x6b')],null))[_0x8aa8('0x29')](respondWithResult(_0x27f02f,null))[_0x8aa8('0x34')](handleError(_0x27f02f,null));};exports[_0x8aa8('0x2a')]=function(_0xbd2e6a,_0x11f060){return db['FaxInteraction'][_0x8aa8('0x59')]({'where':{'id':_0xbd2e6a[_0x8aa8('0xaa')]['id']}})[_0x8aa8('0x29')](handleEntityNotFound(_0x11f060,null))[_0x8aa8('0x29')](removeEntity(_0x11f060,null))['catch'](handleError(_0x11f060,null));};exports[_0x8aa8('0xb0')]=function(_0x107226,_0x45e894){return db[_0x8aa8('0x35')]['describe']()[_0x8aa8('0x29')](respondWithResult(_0x45e894,null))[_0x8aa8('0x34')](handleError(_0x45e894,null));};exports['addMessage']=function(_0x521d25,_0xf028c6,_0x4e1c38){return db[_0x8aa8('0xb1')]['find']({'where':{'id':_0x521d25['params']['id']}})[_0x8aa8('0x29')](handleEntityNotFound(_0xf028c6,null))[_0x8aa8('0x29')](function(_0x35439a){if(_0x35439a){return _0x35439a[_0x8aa8('0xb2')](_0x521d25['body'][_0x8aa8('0xb3')],_[_0x8aa8('0xb4')](_0x521d25[_0x8aa8('0x6b')],[_0x8aa8('0xb3'),'id'])||{});}})[_0x8aa8('0x29')](respondWithResult(_0xf028c6,null))[_0x8aa8('0x34')](handleError(_0xf028c6,null));};exports['getMessages']=function(_0x52095b,_0x1dc515,_0x1075cb){var _0x33d1b9={'raw':![],'where':{}};var _0x322f92={};var _0x268da3={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x52095b['params']['id']}})['then'](handleEntityNotFound(_0x1dc515,null))[_0x8aa8('0x29')](function(_0x12a9bf){if(_0x12a9bf){_0x322f92['model']=_[_0x8aa8('0xab')](db[_0x8aa8('0xb1')][_0x8aa8('0x36')]);_0x322f92['query']=_['keys'](_0x52095b[_0x8aa8('0x39')]);_0x322f92[_0x8aa8('0xac')]=_[_0x8aa8('0x3b')](_0x322f92['model'],_0x322f92[_0x8aa8('0x39')]);_0x33d1b9['attributes']=_[_0x8aa8('0x3b')](_0x322f92[_0x8aa8('0x38')],qs['fields'](_0x52095b[_0x8aa8('0x39')][_0x8aa8('0x3c')]));_0x33d1b9[_0x8aa8('0x3a')]=_0x33d1b9[_0x8aa8('0x3a')]['length']?_0x33d1b9[_0x8aa8('0x3a')]:_0x322f92['model'];if(!_0x52095b[_0x8aa8('0x39')][_0x8aa8('0x3e')](_0x8aa8('0x3f'))){_0x33d1b9['limit']=qs['limit'](_0x52095b[_0x8aa8('0x39')][_0x8aa8('0x24')]);_0x33d1b9[_0x8aa8('0x23')]=qs[_0x8aa8('0x23')](_0x52095b[_0x8aa8('0x39')]['offset']);}_0x33d1b9[_0x8aa8('0x40')]=qs[_0x8aa8('0x41')](_0x52095b[_0x8aa8('0x39')][_0x8aa8('0x41')]);_0x33d1b9[_0x8aa8('0x42')]=qs[_0x8aa8('0xac')](_[_0x8aa8('0x43')](_0x52095b[_0x8aa8('0x39')],_0x322f92[_0x8aa8('0xac')]));_0x33d1b9[_0x8aa8('0x42')][_0x8aa8('0xa7')]=_0x12a9bf['id'];if(_0x52095b['query'][_0x8aa8('0x7f')]){_0x33d1b9['where']=_[_0x8aa8('0xb5')](_0x33d1b9[_0x8aa8('0x42')],{'$or':_[_0x8aa8('0x2e')](_0x33d1b9[_0x8aa8('0x3a')],function(_0x262d3a){var _0x2435d6={};_0x2435d6[_0x262d3a]={'$like':'%'+_0x52095b['query']['filter']+'%'};return _0x2435d6;})});}if(_0x52095b['query'][_0x8aa8('0x75')]){var _0x1ff580=_0x52095b[_0x8aa8('0x39')][_0x8aa8('0x75')]['split'](',');var _0x11cc3f={};_0x11cc3f[_0x1ff580[0x0]]={'$gte':moment(_0x1ff580[0x1])[_0x8aa8('0xb6')](_0x8aa8('0xb7'))};_0x33d1b9[_0x8aa8('0x42')]=_[_0x8aa8('0xb5')](_0x33d1b9['where'],_0x11cc3f);}_0x33d1b9=_[_0x8aa8('0xb5')]({},_0x33d1b9,_0x52095b[_0x8aa8('0xae')]);return db[_0x8aa8('0xb1')][_0x8aa8('0x22')]({'where':_0x33d1b9[_0x8aa8('0x42')]})[_0x8aa8('0x29')](function(_0x549aac){_0x268da3[_0x8aa8('0x22')]=_0x549aac;if(_0x52095b[_0x8aa8('0x39')]['includeAll']){_0x33d1b9['include']=[{'all':!![]}];}return db[_0x8aa8('0xb1')]['findAll'](_0x33d1b9);})['then'](function(_0x59647c){_0x268da3[_0x8aa8('0xb8')]=_0x59647c;return _0x268da3;});}})['then'](respondWithFilteredResult(_0x1dc515,_0x33d1b9))['catch'](handleError(_0x1dc515,null));};exports[_0x8aa8('0xb9')]=function(_0x2aabbc,_0x11ab19,_0x295391){return db[_0x8aa8('0x35')][_0x8aa8('0x59')]({'where':{'id':_0x2aabbc[_0x8aa8('0xaa')]['id']}})[_0x8aa8('0x29')](handleEntityNotFound(_0x11ab19,null))['then'](function(_0x2e2627){if(_0x2e2627){return _0x2e2627[_0x8aa8('0xba')](_0x2aabbc[_0x8aa8('0x6b')]['ids'],_[_0x8aa8('0xb4')](_0x2aabbc[_0x8aa8('0x6b')],[_0x8aa8('0xb3'),'id'])||{})['spread'](function(){return db[_0x8aa8('0xbb')][_0x8aa8('0xbc')]({'attributes':['id',_0x8aa8('0x2c'),_0x8aa8('0xbd')],'where':{'id':_0x2aabbc[_0x8aa8('0x6b')]['ids']}});})['then'](function(_0x32dbb6){socket[_0x8aa8('0xbe')]('faxInteractionTags:save',{'id':Number(_0x2aabbc[_0x8aa8('0xaa')]['id']),'tags':_0x32dbb6||[]});return{'id':Number(_0x2aabbc[_0x8aa8('0xaa')]['id']),'tags':_0x32dbb6||[]};});}})[_0x8aa8('0x29')](respondWithResult(_0x11ab19,null))[_0x8aa8('0x34')](handleError(_0x11ab19,null));};exports[_0x8aa8('0xbf')]=function(_0x388331,_0x5266f2,_0x2655c7){return db[_0x8aa8('0x35')]['find']({'where':{'id':_0x388331[_0x8aa8('0xaa')]['id']}})['then'](handleEntityNotFound(_0x5266f2,null))[_0x8aa8('0x29')](function(_0x1c05f4){if(_0x1c05f4){return _0x1c05f4[_0x8aa8('0xbf')](_0x388331['query']['ids']);}})['then'](respondWithStatusCode(_0x5266f2,null))['catch'](handleError(_0x5266f2,null));};exports[_0x8aa8('0xc0')]=function(_0x1c3135,_0x4ead9f){var _0x2f22a3=moment()['unix']()[_0x8aa8('0xa4')]();var _0x2544f3=path[_0x8aa8('0xc1')](config[_0x8aa8('0xc2')],'server',_0x8aa8('0xc3'),'tmp');var _0x1b0a6e=path['join'](config[_0x8aa8('0xc2')],'server',_0x8aa8('0xc3'),_0x8aa8('0xc4'));var _0x53fbd8=path['join'](_0x2544f3,_0x2f22a3);var _0x5e94c8=util[_0x8aa8('0xb6')](_0x8aa8('0xc5'),_0x1c3135[_0x8aa8('0xaa')]['id'],_0x2f22a3);var _0x4251e0=path[_0x8aa8('0xc1')](_0x2544f3,_0x5e94c8);var _0x20206e=[];_0x20206e[_0x8aa8('0x33')]({'model':db['Attachment'],'as':_0x8aa8('0xc6'),'raw':!![]});var _0x23b848=[{'model':db[_0x8aa8('0xb1')],'as':_0x8aa8('0xc7'),'attributes':['id',_0x8aa8('0x6b'),_0x8aa8('0x73')],'include':_0x20206e}];return db[_0x8aa8('0x35')][_0x8aa8('0x59')]({'where':{'id':_0x1c3135[_0x8aa8('0xaa')]['id']},'include':_0x23b848})[_0x8aa8('0x29')](handleEntityNotFound(_0x4ead9f,null))[_0x8aa8('0x29')](function(_0xb7e50f){if(_0xb7e50f&&_0xb7e50f[_0x8aa8('0xc7')]){var _0x2e067d=_0xb7e50f['get']({'plain':!![]});fs[_0x8aa8('0xc8')](_0x53fbd8);for(var _0x3e7b18=0x0;_0x3e7b18<_0x2e067d['Messages']['length'];_0x3e7b18++){var _0x5bc2b4=_0x2e067d[_0x8aa8('0xc7')][_0x3e7b18][_0x8aa8('0xc6')];if(_0x5bc2b4){var _0x249899=path['join'](_0x1b0a6e,_0x5bc2b4[_0x8aa8('0xc9')]);if(fs[_0x8aa8('0xca')](_0x249899)){fs[_0x8aa8('0xcb')](_0x249899)[_0x8aa8('0xcc')](fs[_0x8aa8('0xcd')](path[_0x8aa8('0xc1')](_0x53fbd8,_0x5bc2b4[_0x8aa8('0xc9')])));}}}return BPromise[_0x8aa8('0x8a')]()[_0x8aa8('0x29')](function(){return new BPromise(function(_0x17e2da,_0x4776ee){zipdir(_0x53fbd8,{'saveTo':_0x4251e0},function(_0xa97a4,_0x370a0c){if(_0xa97a4)return _0x4776ee(_0xa97a4);return _0x17e2da(_0x370a0c);});})[_0x8aa8('0x29')](function(){return new BPromise(function(_0x21d7f1,_0x4da956){rimraf(_0x53fbd8,function(_0x42cd38){if(_0x42cd38)_0x4da956(_0x42cd38);return _0x21d7f1();});});})['then'](function(){return _0x4ead9f[_0x8aa8('0xc0')](_0x4251e0,_0x5e94c8,function(_0x260a23){if(_0x260a23){console['log'](_0x8aa8('0xce'),_0x260a23);}else{fs['unlinkSync'](_0x4251e0);}});});});}else{return _0x4ead9f[_0x8aa8('0x1e')](0xc8);}})[_0x8aa8('0x34')](handleError(_0x4ead9f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bc7733d..7c040a1 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(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'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 _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x16b6d7,_0x560d2f){_0x16b6d7=_0x16b6d7-0x0;var _0xa1967d=_0x2ef3[_0x16b6d7];return _0xa1967d;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 673581b..66da718 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 _0x48e6=['rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x48e6,0x170));var _0x648e=function(_0x1a5a53,_0x4fbf03){_0x1a5a53=_0x1a5a53-0x0;var _0x565c2d=_0x48e6[_0x1a5a53];return _0x565c2d;};'use strict';var _=require(_0x648e('0x0'));var util=require('util');var logger=require(_0x648e('0x1'))(_0x648e('0x2'));var moment=require(_0x648e('0x3'));var BPromise=require('bluebird');var rp=require(_0x648e('0x4'));var fs=require('fs');var path=require(_0x648e('0x5'));var rimraf=require(_0x648e('0x6'));var config=require(_0x648e('0x7'));var attributes=require(_0x648e('0x8'));module[_0x648e('0x9')]=function(_0x2c878f,_0x340bfa){return _0x2c878f['define'](_0x648e('0xa'),attributes,{'tableName':_0x648e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x243cf0,_0x1c91b2,_0x27f1a6){if(_0x243cf0[_0x648e('0xc')](_0x648e('0xd'))){_0x243cf0[_0x648e('0xe')]=moment()[_0x648e('0xf')](_0x648e('0x10'));}_0x27f1a6(null,_0x243cf0);}}});}; \ No newline at end of file +var _0x442b=['changed','format','lodash','../../config/logger','moment','bluebird','request-promise','exports','define','FaxInteraction'];(function(_0x1451de,_0x347d48){var _0x2fefb4=function(_0x1efe1d){while(--_0x1efe1d){_0x1451de['push'](_0x1451de['shift']());}};_0x2fefb4(++_0x347d48);}(_0x442b,0x11a));var _0xb442=function(_0x33add4,_0x4a5513){_0x33add4=_0x33add4-0x0;var _0x250caa=_0x442b[_0x33add4];return _0x250caa;};'use strict';var _=require(_0xb442('0x0'));var util=require('util');var logger=require(_0xb442('0x1'))('api');var moment=require(_0xb442('0x2'));var BPromise=require(_0xb442('0x3'));var rp=require(_0xb442('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xb442('0x5')]=function(_0x407748,_0xaff837){return _0x407748[_0xb442('0x6')](_0xb442('0x7'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18c18c,_0x2c05cd,_0x4b33b5){if(_0x18c18c[_0xb442('0x8')]('closed')){_0x18c18c['closedAt']=moment()[_0xb442('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b33b5(null,_0x18c18c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 5a88548..4768385 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 _0x45fc=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','AddTagsToFaxInteraction','find'];(function(_0x11cd30,_0x58b742){var _0x1954c0=function(_0x14ea67){while(--_0x14ea67){_0x11cd30['push'](_0x11cd30['shift']());}};_0x1954c0(++_0x58b742);}(_0x45fc,0x1a8));var _0xc45f=function(_0x25e619,_0x35927b){_0x25e619=_0x25e619-0x0;var _0x32ada2=_0x45fc[_0x25e619];return _0x32ada2;};'use strict';var _=require(_0xc45f('0x0'));var util=require(_0xc45f('0x1'));var moment=require(_0xc45f('0x2'));var BPromise=require(_0xc45f('0x3'));var rs=require(_0xc45f('0x4'));var fs=require('fs');var Redis=require(_0xc45f('0x5'));var db=require(_0xc45f('0x6'))['db'];var utils=require(_0xc45f('0x7'));var logger=require(_0xc45f('0x8'))(_0xc45f('0x9'));var config=require(_0xc45f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc45f('0xb')][_0xc45f('0xc')]({'port':0x232a});config[_0xc45f('0xd')]=_[_0xc45f('0xe')](config[_0xc45f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc45f('0xf'))(new Redis(config[_0xc45f('0xd')]));require(_0xc45f('0x10'))[_0xc45f('0x11')](socket);function respondWithRpcPromise(_0x5450ca,_0x53f3e9,_0x363f31){return new BPromise(function(_0x2ca440,_0x5276f4){return client[_0xc45f('0x12')](_0x5450ca,_0x363f31)[_0xc45f('0x13')](function(_0x543683){logger[_0xc45f('0x14')](_0xc45f('0x15'),_0x53f3e9,_0xc45f('0x16'));logger[_0xc45f('0x17')](_0xc45f('0x18'),_0x53f3e9,_0xc45f('0x16'),JSON[_0xc45f('0x19')](_0x543683));if(_0x543683[_0xc45f('0x1a')]){if(_0x543683[_0xc45f('0x1a')][_0xc45f('0x1b')]===0x1f4){logger[_0xc45f('0x1a')](_0xc45f('0x15'),_0x53f3e9,_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);return _0x5276f4(_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);}logger[_0xc45f('0x1a')](_0xc45f('0x15'),_0x53f3e9,_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);return _0x2ca440(_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);}else{logger[_0xc45f('0x14')](_0xc45f('0x15'),_0x53f3e9,_0xc45f('0x16'));_0x2ca440(_0x543683[_0xc45f('0x1d')]['message']);}})[_0xc45f('0x1e')](function(_0x31f1d8){logger['error'](_0xc45f('0x15'),_0x53f3e9,_0x31f1d8);_0x5276f4(_0x31f1d8);});});}exports[_0xc45f('0x1f')]=function(_0x42d9d8){var _0x4137ff=this;return new Promise(function(_0x56f7d3,_0x2e873b){return db[_0xc45f('0x20')]['update'](_0x42d9d8[_0xc45f('0x21')],{'raw':_0x42d9d8['options']?_0x42d9d8[_0xc45f('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d9d8['options']?_0x42d9d8[_0xc45f('0x22')][_0xc45f('0x23')]||null:null,'attributes':_0x42d9d8[_0xc45f('0x22')]?_0x42d9d8['options']['attributes']||null:null,'limit':_0x42d9d8['options']?_0x42d9d8[_0xc45f('0x22')]['limit']||null:null})[_0xc45f('0x13')](function(_0x1c692f){logger[_0xc45f('0x14')](_0xc45f('0x1f'),_0x42d9d8);logger['debug'](_0xc45f('0x1f'),_0x42d9d8,JSON[_0xc45f('0x19')](_0x1c692f));_0x56f7d3(_0x1c692f);})[_0xc45f('0x1e')](function(_0x146630){logger[_0xc45f('0x1a')](_0xc45f('0x1f'),_0x146630[_0xc45f('0x1c')],_0x42d9d8);_0x2e873b(_0x4137ff['error'](0x1f4,_0x146630['message']));});});};exports[_0xc45f('0x24')]=function(_0xa3f8a0){return new Promise(function(_0x22f3a0,_0x10ce68){return db[_0xc45f('0x20')][_0xc45f('0x25')]({'where':_0xa3f8a0[_0xc45f('0x22')]?_0xa3f8a0[_0xc45f('0x22')][_0xc45f('0x23')]||null:null})[_0xc45f('0x13')](function(_0x113787){if(_0x113787){return _0x113787['addTags'](_0xa3f8a0['body'][_0xc45f('0x26')],_[_0xc45f('0x27')](_0xa3f8a0['body'],[_0xc45f('0x26'),'id'])||{});}})[_0xc45f('0x28')](function(_0x1f4f7c){logger[_0xc45f('0x14')]('AddTags',_0xa3f8a0);logger[_0xc45f('0x17')](_0xc45f('0x29'),_0xa3f8a0,JSON['stringify'](_0x1f4f7c));_0x22f3a0(_0x1f4f7c);})['catch'](function(_0xa9d976){logger['error'](_0xc45f('0x29'),_0xa9d976[_0xc45f('0x1c')],_0xa3f8a0);_0x10ce68(_this[_0xc45f('0x1a')](0x1f4,_0xa9d976[_0xc45f('0x1c')]));});});}; \ No newline at end of file +var _0x8d66=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','error','code','message','result','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','debug','stringify','AddTagsToFaxInteraction','find','ids','omit','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3e7268,_0x1890e4){var _0x41f278=function(_0x53eae5){while(--_0x53eae5){_0x3e7268['push'](_0x3e7268['shift']());}};_0x41f278(++_0x1890e4);}(_0x8d66,0x9c));var _0x68d6=function(_0x29f624,_0x3fd821){_0x29f624=_0x29f624-0x0;var _0x1020cc=_0x8d66[_0x29f624];return _0x1020cc;};'use strict';var _=require('lodash');var util=require(_0x68d6('0x0'));var moment=require(_0x68d6('0x1'));var BPromise=require('bluebird');var rs=require(_0x68d6('0x2'));var fs=require('fs');var Redis=require(_0x68d6('0x3'));var db=require(_0x68d6('0x4'))['db'];var utils=require(_0x68d6('0x5'));var logger=require('../../config/logger')(_0x68d6('0x6'));var config=require(_0x68d6('0x7'));var jayson=require(_0x68d6('0x8'));var client=jayson[_0x68d6('0x9')][_0x68d6('0xa')]({'port':0x232a});config[_0x68d6('0xb')]=_[_0x68d6('0xc')](config[_0x68d6('0xb')],{'host':_0x68d6('0xd'),'port':0x18eb});var socket=require(_0x68d6('0xe'))(new Redis(config['redis']));require(_0x68d6('0xf'))[_0x68d6('0x10')](socket);function respondWithRpcPromise(_0x43516a,_0x4171ce,_0x11b1da){return new BPromise(function(_0x1f35a7,_0x54807f){return client['request'](_0x43516a,_0x11b1da)[_0x68d6('0x11')](function(_0x9746b2){logger[_0x68d6('0x12')](_0x68d6('0x13'),_0x4171ce,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4171ce,'request\x20sent',JSON['stringify'](_0x9746b2));if(_0x9746b2[_0x68d6('0x14')]){if(_0x9746b2[_0x68d6('0x14')][_0x68d6('0x15')]===0x1f4){logger[_0x68d6('0x14')](_0x68d6('0x13'),_0x4171ce,_0x9746b2['error']['message']);return _0x54807f(_0x9746b2[_0x68d6('0x14')][_0x68d6('0x16')]);}logger[_0x68d6('0x14')](_0x68d6('0x13'),_0x4171ce,_0x9746b2[_0x68d6('0x14')]['message']);return _0x1f35a7(_0x9746b2['error'][_0x68d6('0x16')]);}else{logger['info'](_0x68d6('0x13'),_0x4171ce,'request\x20sent');_0x1f35a7(_0x9746b2[_0x68d6('0x17')]['message']);}})[_0x68d6('0x18')](function(_0x336fc3){logger['error'](_0x68d6('0x13'),_0x4171ce,_0x336fc3);_0x54807f(_0x336fc3);});});}exports['UpdateFaxInteraction']=function(_0x175b14){var _0x5c2960=this;return new Promise(function(_0x33b125,_0x598dc2){return db[_0x68d6('0x19')][_0x68d6('0x1a')](_0x175b14[_0x68d6('0x1b')],{'raw':_0x175b14[_0x68d6('0x1c')]?_0x175b14[_0x68d6('0x1c')][_0x68d6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175b14['options']?_0x175b14[_0x68d6('0x1c')][_0x68d6('0x1e')]||null:null,'attributes':_0x175b14[_0x68d6('0x1c')]?_0x175b14[_0x68d6('0x1c')][_0x68d6('0x1f')]||null:null,'limit':_0x175b14['options']?_0x175b14[_0x68d6('0x1c')][_0x68d6('0x20')]||null:null})[_0x68d6('0x11')](function(_0x50286f){logger[_0x68d6('0x12')](_0x68d6('0x21'),_0x175b14);logger[_0x68d6('0x22')]('UpdateFaxInteraction',_0x175b14,JSON[_0x68d6('0x23')](_0x50286f));_0x33b125(_0x50286f);})[_0x68d6('0x18')](function(_0x375d3b){logger['error'](_0x68d6('0x21'),_0x375d3b[_0x68d6('0x16')],_0x175b14);_0x598dc2(_0x5c2960[_0x68d6('0x14')](0x1f4,_0x375d3b[_0x68d6('0x16')]));});});};exports[_0x68d6('0x24')]=function(_0x18adeb){return new Promise(function(_0x38335a,_0x4a9bc3){return db[_0x68d6('0x19')][_0x68d6('0x25')]({'where':_0x18adeb['options']?_0x18adeb[_0x68d6('0x1c')][_0x68d6('0x1e')]||null:null})[_0x68d6('0x11')](function(_0xa91d44){if(_0xa91d44){return _0xa91d44['addTags'](_0x18adeb['body'][_0x68d6('0x26')],_[_0x68d6('0x27')](_0x18adeb[_0x68d6('0x1b')],['ids','id'])||{});}})['spread'](function(_0x4822ff){logger[_0x68d6('0x12')](_0x68d6('0x28'),_0x18adeb);logger[_0x68d6('0x22')](_0x68d6('0x28'),_0x18adeb,JSON[_0x68d6('0x23')](_0x4822ff));_0x38335a(_0x4822ff);})['catch'](function(_0x57698e){logger[_0x68d6('0x14')](_0x68d6('0x28'),_0x57698e['message'],_0x18adeb);_0x4a9bc3(_this['error'](0x1f4,_0x57698e[_0x68d6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f9e2b43..853dc05 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 _0x5b07=['length','faxInteraction:','./faxInteraction.events','save','update','removeListener','register'];(function(_0x27a5c1,_0x33b6de){var _0x458564=function(_0x1c5fc9){while(--_0x1c5fc9){_0x27a5c1['push'](_0x27a5c1['shift']());}};_0x458564(++_0x33b6de);}(_0x5b07,0x198));var _0x75b0=function(_0x3ef04c,_0x3df3cd){_0x3ef04c=_0x3ef04c-0x0;var _0x231aa9=_0x5b07[_0x3ef04c];return _0x231aa9;};'use strict';var FaxInteractionEvents=require(_0x75b0('0x0'));var events=[_0x75b0('0x1'),'remove',_0x75b0('0x2')];function createListener(_0x6e3504,_0x22fb20){return function(_0x28c4fb){_0x22fb20['emit'](_0x6e3504,_0x28c4fb);};}function removeListener(_0x275a60,_0x967da3){return function(){FaxInteractionEvents[_0x75b0('0x3')](_0x275a60,_0x967da3);};}exports[_0x75b0('0x4')]=function(_0x1c9ad7){for(var _0x2b24b9=0x0,_0x5e13be=events[_0x75b0('0x5')];_0x2b24b9<_0x5e13be;_0x2b24b9++){var _0x38c024=events[_0x2b24b9];var _0x321a88=createListener(_0x75b0('0x6')+_0x38c024,_0x1c9ad7);FaxInteractionEvents['on'](_0x38c024,_0x321a88);}}; \ No newline at end of file +var _0x724d=['update','emit','removeListener','length','faxInteraction:','remove'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x724d,0x13d));var _0xd724=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x724d[_0xc67528];return _0x38e26d;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xd724('0x0'),_0xd724('0x1')];function createListener(_0x42eacb,_0x1031f8){return function(_0x31e1bb){_0x1031f8[_0xd724('0x2')](_0x42eacb,_0x31e1bb);};}function removeListener(_0x954bed,_0x5dddb4){return function(){FaxInteractionEvents[_0xd724('0x3')](_0x954bed,_0x5dddb4);};}exports['register']=function(_0x4d4688){for(var _0x22dcd3=0x0,_0x2bd67d=events[_0xd724('0x4')];_0x22dcd3<_0x2bd67d;_0x22dcd3++){var _0x570e31=events[_0x22dcd3];var _0x530b42=createListener(_0xd724('0x5')+_0x570e31,_0x4d4688);FaxInteractionEvents['on'](_0x570e31,_0x530b42);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ed48665..5e3576c 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 _0xbdb7=['post','addMessage','tracked','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0xbdb7[_0x568496];return _0x26c5c1;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./faxInteraction.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7bdb('0x9')](_0x7bdb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0x9')](_0x7bdb('0xc'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0x9')](_0x7bdb('0xf'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7bdb('0x11')](_0x7bdb('0xc'),auth['isAuthenticated'](),controller[_0x7bdb('0x12')]);router['post']('/:id/tags',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x7bdb('0x14')](_0x7bdb('0xb'),auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x16')),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')]('/:id',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x19')),controller['destroy']);router[_0x7bdb('0x18')](_0x7bdb('0x1a'),auth['isAuthenticated'](),controller[_0x7bdb('0x1b')]);module[_0x7bdb('0x1c')]=router; \ No newline at end of file +var _0xd8b0=['delete','removeTags','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/describe','describe','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','/:id','faxinteraction:destroy','destroy'];(function(_0x2ca90c,_0x3a3344){var _0x162568=function(_0x580a88){while(--_0x580a88){_0x2ca90c['push'](_0x2ca90c['shift']());}};_0x162568(++_0x3a3344);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id',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('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x12')](_0x0d8b('0x14'),auth[_0x0d8b('0xb')](),interaction[_0x0d8b('0x15')](_0x0d8b('0x16'),_0x0d8b('0x17')),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')]('/:id',auth[_0x0d8b('0xb')](),interaction[_0x0d8b('0x15')](_0x0d8b('0x16'),_0x0d8b('0x1a')),controller[_0x0d8b('0x1b')]);router['delete'](_0x0d8b('0x1c'),auth[_0x0d8b('0xb')](),interaction[_0x0d8b('0x15')](_0x0d8b('0x16'),_0x0d8b('0x1d')),controller[_0x0d8b('0x1e')]);router[_0x0d8b('0x1f')](_0x0d8b('0x14'),auth['isAuthenticated'](),controller[_0x0d8b('0x20')]);module[_0x0d8b('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index e36e018..da5a795 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 _0x3b60=['out','TEXT','DATE','exports','medium','BOOLEAN','ENUM'];(function(_0x402c9d,_0x34f0d1){var _0x4a7679=function(_0x1802a0){while(--_0x1802a0){_0x402c9d['push'](_0x402c9d['shift']());}};_0x4a7679(++_0x34f0d1);}(_0x3b60,0x106));var _0x03b6=function(_0xac89c4,_0x567718){_0xac89c4=_0xac89c4-0x0;var _0xb02136=_0x3b60[_0xac89c4];return _0xb02136;};'use strict';var Sequelize=require('sequelize');module[_0x03b6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x03b6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x03b6('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x03b6('0x3')]('in',_0x03b6('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x03b6('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x03b6('0x6')]}}; \ No newline at end of file +var _0x3d9f=['medium','BOOLEAN','ENUM','out','TEXT','DATE','sequelize'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0x3d9f,0x102));var _0xf3d9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x3d9f[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xf3d9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xf3d9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xf3d9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf3d9('0x3')]('in',_0xf3d9('0x4')),'defaultValue':_0xf3d9('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf3d9('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf3d9('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3ac6833..f132bee 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 _0xfda2=['user','CmContact','Contact','get','FaxInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','null','RejectMessage','rejectMessage','event','create','findOne','ContactId','Attachment','SendFax','FaxAccountId','isNil','basename','AttachmentId','download','join','root','server','files','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','end','status','json','count','limit','reject','destroy','sendStatus','stack','name','send','index','FaxMessage','model','map','query','intersection','fields','attributes','length','offset','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','keys','include','find','update','body','fax-interactions','accept','fax','readAt','format','UserId'];(function(_0x53e4fd,_0xe40fa8){var _0x4df112=function(_0x31a4f5){while(--_0x31a4f5){_0x53e4fd['push'](_0x53e4fd['shift']());}};_0x4df112(++_0xe40fa8);}(_0xfda2,0x122));var _0x2fda=function(_0x47b1ff,_0x12f3c4){_0x47b1ff=_0x47b1ff-0x0;var _0x4505a8=_0xfda2[_0x47b1ff];return _0x4505a8;};'use strict';var pdf=require(_0x2fda('0x0'));var emlformat=require(_0x2fda('0x1'));var rimraf=require(_0x2fda('0x2'));var zipdir=require(_0x2fda('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fda('0x4'));var moment=require(_0x2fda('0x5'));var BPromise=require(_0x2fda('0x6'));var Mustache=require(_0x2fda('0x7'));var util=require(_0x2fda('0x8'));var path=require(_0x2fda('0x9'));var sox=require(_0x2fda('0xa'));var csv=require(_0x2fda('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2fda('0xc'));var squel=require('squel');var crypto=require(_0x2fda('0xd'));var jsforce=require(_0x2fda('0xe'));var deskjs=require(_0x2fda('0xf'));var toCsv=require(_0x2fda('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fda('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fda('0x11'));var as=require(_0x2fda('0x12'));var hardwareService=require(_0x2fda('0x13'));var logger=require(_0x2fda('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2fda('0x15'));var db=require(_0x2fda('0x16'))['db'];config[_0x2fda('0x17')]=_[_0x2fda('0x18')](config['redis'],{'host':_0x2fda('0x19'),'port':0x18eb});var socket=require(_0x2fda('0x1a'))(new Redis(config[_0x2fda('0x17')]));require(_0x2fda('0x1b'))[_0x2fda('0x1c')](socket);var jayson=require(_0x2fda('0x1d'));var client=jayson[_0x2fda('0x1e')][_0x2fda('0x1f')]({'port':0x232c});var client9002=jayson[_0x2fda('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x148cea,_0xecdfad,_0x15b474,_0x2e5eb7){return new BPromise(function(_0x3b1e9c,_0x3f3f2f){var _0x2073fb=_0x2e5eb7||client;return _0x2073fb['request'](_0x148cea,_0x15b474)[_0x2fda('0x20')](function(_0x33946c){logger[_0x2fda('0x21')](_0x2fda('0x22'),_0xecdfad,'request\x20sent');logger[_0x2fda('0x23')](_0x2fda('0x24'),_0xecdfad,_0x2fda('0x25'),JSON[_0x2fda('0x26')](_0x33946c));if(_0x33946c['error']){if(_0x33946c[_0x2fda('0x27')][_0x2fda('0x28')]===0x1f4){logger['error'](_0x2fda('0x22'),_0xecdfad,_0x33946c['error']['message']);return _0x3f3f2f(_0x33946c[_0x2fda('0x27')][_0x2fda('0x29')]);}logger[_0x2fda('0x27')](_0x2fda('0x22'),_0xecdfad,_0x33946c[_0x2fda('0x27')][_0x2fda('0x29')]);return _0x3b1e9c(_0x33946c['error']['message']);}else{logger['info'](_0x2fda('0x22'),_0xecdfad,_0x2fda('0x25'));_0x3b1e9c(_0x33946c['result'][_0x2fda('0x29')]);}})[_0x2fda('0x2a')](function(_0x374c83){logger[_0x2fda('0x27')](_0x2fda('0x22'),_0xecdfad,_0x374c83);_0x3f3f2f(_0x374c83);});});}function respondWithStatusCode(_0x1a7d76,_0x2cace4){_0x2cace4=_0x2cace4||0xcc;return function(_0x4b94e5){if(_0x4b94e5){return _0x1a7d76['sendStatus'](_0x2cace4);}return _0x1a7d76['status'](_0x2cace4)[_0x2fda('0x2b')]();};}function respondWithResult(_0x47a954,_0x4fc297){_0x4fc297=_0x4fc297||0xc8;return function(_0x35e246){if(_0x35e246){return _0x47a954[_0x2fda('0x2c')](_0x4fc297)[_0x2fda('0x2d')](_0x35e246);}};}function respondWithFilteredResult(_0x30611b,_0x1f5666){return function(_0x4c9770){if(_0x4c9770){var _0x4592dd=_0x4c9770[_0x2fda('0x2e')],_0x4098f8=_0x1f5666['offset'],_0xad31b2=_0x1f5666['offset']+_0x1f5666[_0x2fda('0x2f')],_0x5d5da;if(_0xad31b2>=_0x4592dd){_0xad31b2=_0x4592dd;_0x5d5da=0xc8;}else{_0x5d5da=0xce;}_0x30611b['status'](_0x5d5da);return _0x30611b['set']('Content-Range',_0x4098f8+'-'+_0xad31b2+'/'+_0x4592dd)[_0x2fda('0x2d')](_0x4c9770);}return null;};}function patchUpdates(_0x334f27){return function(_0x1f5f10){try{jsonpatch['apply'](_0x1f5f10,_0x334f27,!![]);}catch(_0x3260fc){return BPromise[_0x2fda('0x30')](_0x3260fc);}return _0x1f5f10['save']();};}function saveUpdates(_0x250e39,_0x4a1506){return function(_0x358549){if(_0x358549){return _0x358549['update'](_0x250e39)[_0x2fda('0x20')](function(_0x549da6){return _0x549da6;});}return null;};}function removeEntity(_0x2c5bc9,_0x28af91){return function(_0x169ed9){if(_0x169ed9){return _0x169ed9[_0x2fda('0x31')]()[_0x2fda('0x20')](function(){_0x2c5bc9[_0x2fda('0x2c')](0xcc)[_0x2fda('0x2b')]();});}};}function handleEntityNotFound(_0x145ab8,_0x550cad){return function(_0x18b7eb){if(!_0x18b7eb){_0x145ab8[_0x2fda('0x32')](0x194);}return _0x18b7eb;};}function handleError(_0xb9b8c5,_0x585b64){_0x585b64=_0x585b64||0x1f4;return function(_0x2866db){logger[_0x2fda('0x27')](_0x2866db[_0x2fda('0x33')]);if(_0x2866db[_0x2fda('0x34')]){delete _0x2866db[_0x2fda('0x34')];}_0xb9b8c5['status'](_0x585b64)[_0x2fda('0x35')](_0x2866db);};}exports[_0x2fda('0x36')]=function(_0x47faf8,_0x3d3199){var _0x36ed6a={},_0x49f789={},_0x58c750={'count':0x0,'rows':[]};var _0x5b5fd5=_['map'](db[_0x2fda('0x37')]['rawAttributes'],function(_0x187f2c){return{'name':_0x187f2c['fieldName'],'type':_0x187f2c['type']['key']};});_0x49f789[_0x2fda('0x38')]=_[_0x2fda('0x39')](_0x5b5fd5,_0x2fda('0x34'));_0x49f789['query']=_['keys'](_0x47faf8[_0x2fda('0x3a')]);_0x49f789['filters']=_[_0x2fda('0x3b')](_0x49f789[_0x2fda('0x38')],_0x49f789['query']);_0x36ed6a['attributes']=_[_0x2fda('0x3b')](_0x49f789['model'],qs['fields'](_0x47faf8['query'][_0x2fda('0x3c')]));_0x36ed6a[_0x2fda('0x3d')]=_0x36ed6a[_0x2fda('0x3d')][_0x2fda('0x3e')]?_0x36ed6a[_0x2fda('0x3d')]:_0x49f789['model'];if(!_0x47faf8[_0x2fda('0x3a')]['hasOwnProperty']('nolimit')){_0x36ed6a['limit']=qs[_0x2fda('0x2f')](_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x2f')]);_0x36ed6a['offset']=qs['offset'](_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x3f')]);}_0x36ed6a[_0x2fda('0x40')]=qs[_0x2fda('0x41')](_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x41')]);_0x36ed6a['where']=qs[_0x2fda('0x42')](_[_0x2fda('0x43')](_0x47faf8[_0x2fda('0x3a')],_0x49f789[_0x2fda('0x42')]),_0x5b5fd5);if(_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x44')]){_0x36ed6a[_0x2fda('0x45')]=_[_0x2fda('0x46')](_0x36ed6a[_0x2fda('0x45')],{'$or':_['map'](_0x5b5fd5,function(_0x45e99f){if(_0x45e99f[_0x2fda('0x47')]!==_0x2fda('0x48')){var _0x59f620={};_0x59f620[_0x45e99f[_0x2fda('0x34')]]={'$like':'%'+_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x44')]+'%'};return _0x59f620;}})});}_0x36ed6a=_[_0x2fda('0x46')]({},_0x36ed6a,_0x47faf8[_0x2fda('0x49')]);var _0x349c19={'where':_0x36ed6a[_0x2fda('0x45')]};return db[_0x2fda('0x37')][_0x2fda('0x2e')](_0x349c19)['then'](function(_0x34fdbd){_0x58c750[_0x2fda('0x2e')]=_0x34fdbd;if(_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x4a')]){_0x36ed6a['include']=[{'all':!![]}];}return db[_0x2fda('0x37')][_0x2fda('0x4b')](_0x36ed6a);})[_0x2fda('0x20')](function(_0x1196b1){_0x58c750[_0x2fda('0x4c')]=_0x1196b1;return _0x58c750;})[_0x2fda('0x20')](respondWithFilteredResult(_0x3d3199,_0x36ed6a))[_0x2fda('0x2a')](handleError(_0x3d3199,null));};exports[_0x2fda('0x4d')]=function(_0x58c6e4,_0x383603){var _0x5a5fa6={'raw':!![],'where':{'id':_0x58c6e4[_0x2fda('0x4e')]['id']}},_0x33a6bc={};_0x33a6bc[_0x2fda('0x38')]=_['keys'](db[_0x2fda('0x37')][_0x2fda('0x4f')]);_0x33a6bc['query']=_[_0x2fda('0x50')](_0x58c6e4['query']);_0x33a6bc[_0x2fda('0x42')]=_[_0x2fda('0x3b')](_0x33a6bc[_0x2fda('0x38')],_0x33a6bc[_0x2fda('0x3a')]);_0x5a5fa6['attributes']=_[_0x2fda('0x3b')](_0x33a6bc['model'],qs['fields'](_0x58c6e4[_0x2fda('0x3a')][_0x2fda('0x3c')]));_0x5a5fa6['attributes']=_0x5a5fa6[_0x2fda('0x3d')][_0x2fda('0x3e')]?_0x5a5fa6[_0x2fda('0x3d')]:_0x33a6bc[_0x2fda('0x38')];if(_0x58c6e4[_0x2fda('0x3a')][_0x2fda('0x4a')]){_0x5a5fa6[_0x2fda('0x51')]=[{'all':!![]}];}_0x5a5fa6=_['merge']({},_0x5a5fa6,_0x58c6e4[_0x2fda('0x49')]);return db[_0x2fda('0x37')][_0x2fda('0x52')](_0x5a5fa6)['then'](handleEntityNotFound(_0x383603,null))['then'](respondWithResult(_0x383603,null))['catch'](handleError(_0x383603,null));};exports[_0x2fda('0x53')]=function(_0xa85e76,_0x4cca1e){if(_0xa85e76[_0x2fda('0x54')]['id']){delete _0xa85e76[_0x2fda('0x54')]['id'];}return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0xa85e76['params']['id']}})[_0x2fda('0x20')](handleEntityNotFound(_0x4cca1e,null))[_0x2fda('0x20')](saveUpdates(_0xa85e76[_0x2fda('0x54')],null))['then'](respondWithResult(_0x4cca1e,null))[_0x2fda('0x2a')](handleError(_0x4cca1e,null));};exports[_0x2fda('0x31')]=function(_0x4953f1,_0x312eca){return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0x4953f1[_0x2fda('0x4e')]['id']}})[_0x2fda('0x20')](handleEntityNotFound(_0x312eca,null))[_0x2fda('0x20')](removeEntity(_0x312eca,null))[_0x2fda('0x2a')](handleError(_0x312eca,null));};exports['describe']=function(_0x1346b9,_0x4113d5){return db[_0x2fda('0x37')]['describe']()['then'](respondWithResult(_0x4113d5,null))[_0x2fda('0x2a')](handleError(_0x4113d5,null));};var interaction_log=require('../../config/logger')(_0x2fda('0x55'));exports[_0x2fda('0x56')]=function(_0x212cef,_0x3a7b93,_0xd59bf5){var _0x506551={'channel':_0x2fda('0x57')};if(_0x212cef['body']['id']){delete _0x212cef[_0x2fda('0x54')]['id'];}_0x212cef[_0x2fda('0x54')]['read']=!![];_0x212cef[_0x2fda('0x54')][_0x2fda('0x58')]=moment()[_0x2fda('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x212cef[_0x2fda('0x54')][_0x2fda('0x5a')]=_0x212cef[_0x2fda('0x54')]['UserId']||_0x212cef[_0x2fda('0x5b')]['id'];return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0x212cef[_0x2fda('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0x2fda('0x5c')],'as':_0x2fda('0x5d')}]})[_0x2fda('0x20')](handleEntityNotFound(_0x3a7b93,null))[_0x2fda('0x20')](saveUpdates(_0x212cef[_0x2fda('0x54')],null))[_0x2fda('0x20')](function(_0xc2703d){if(_0xc2703d){_0x506551['message']=_0xc2703d[_0x2fda('0x5e')]({'plain':!![]});return db[_0x2fda('0x5f')]['find']({'where':{'id':_0xc2703d['FaxInteractionId']}});}return null;})[_0x2fda('0x20')](handleEntityNotFound(_0x3a7b93,null))[_0x2fda('0x20')](function(_0x51e546){if(_0x51e546){return _0x51e546['update']({'UserId':_0x212cef['body'][_0x2fda('0x5a')],'read1stAt':_['isNil'](_0x51e546[_0x2fda('0x60')])?moment()['format'](_0x2fda('0x61')):undefined});}return null;})[_0x2fda('0x20')](function(_0x2ec1ac){if(_0x2ec1ac){_0x506551[_0x2fda('0x62')]=_0x2ec1ac['get']({'plain':!![]});interaction_log['info'](_0x2fda('0x63'),_0x212cef[_0x2fda('0x5b')]['id'],_0x212cef['user'][_0x2fda('0x34')],_0x212cef[_0x2fda('0x5b')][_0x2fda('0x64')],_0x506551[_0x2fda('0x62')]['id'],_0x212cef[_0x2fda('0x54')]?JSON[_0x2fda('0x26')](_0x212cef[_0x2fda('0x54')]):'null');return respondWithRpcPromise(_0x2fda('0x65'),_0x2fda('0x66'),_0x506551);}return null;})[_0x2fda('0x20')](function(_0x1f6c4a){if(_0x1f6c4a){if(_0x212cef['body'][_0x2fda('0x67')]){_0x506551[_0x2fda('0x29')][_0x2fda('0x68')]=util[_0x2fda('0x59')](_0x2fda('0x69'),_0x212cef[_0x2fda('0x5b')]['name']);_0x506551['message']['channel']=_0x506551[_0x2fda('0x6a')];_0x506551[_0x2fda('0x29')]['event']=_0x2fda('0x56');return respondWithRpcPromise('EventManager',_0x2fda('0x6b'),{'event':_0x2fda('0x6c'),'message':_0x506551['message']},client9002)[_0x2fda('0x20')](function(){return _0x506551;});}return _0x506551;}return null;})[_0x2fda('0x20')](respondWithResult(_0x3a7b93,null))[_0x2fda('0x2a')](handleError(_0x3a7b93,null));};var interaction_log=require(_0x2fda('0x14'))(_0x2fda('0x55'));exports['reject']=function(_0x4cf796,_0x576c00,_0x1810de){var _0x490fe9={'agent':{},'channel':_0x2fda('0x57')};if(_0x4cf796[_0x2fda('0x54')]['id']){delete _0x4cf796[_0x2fda('0x54')]['id'];}_0x4cf796[_0x2fda('0x54')][_0x2fda('0x5a')]=_0x4cf796['body'][_0x2fda('0x5a')]||_0x4cf796[_0x2fda('0x5b')]['id'];_0x490fe9['agent']['id']=_0x4cf796[_0x2fda('0x54')][_0x2fda('0x5a')];return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0x4cf796['params']['id'],'UserId':null}})[_0x2fda('0x20')](handleEntityNotFound(_0x576c00,null))[_0x2fda('0x20')](function(_0x29578f){if(_0x29578f){_0x490fe9[_0x2fda('0x29')]=_0x29578f['get']({'plain':!![]});return db[_0x2fda('0x5f')][_0x2fda('0x52')]({'where':{'id':_0x29578f['FaxInteractionId']}});}return null;})[_0x2fda('0x20')](handleEntityNotFound(_0x576c00,null))[_0x2fda('0x20')](function(_0x3e73b8){if(_0x3e73b8){_0x490fe9[_0x2fda('0x62')]=_0x3e73b8[_0x2fda('0x5e')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4cf796['user']['id'],_0x4cf796[_0x2fda('0x5b')][_0x2fda('0x34')],_0x4cf796[_0x2fda('0x5b')][_0x2fda('0x64')],_0x490fe9[_0x2fda('0x62')]['id'],_0x4cf796[_0x2fda('0x54')]?JSON[_0x2fda('0x26')](_0x4cf796[_0x2fda('0x54')]):_0x2fda('0x6d'));return respondWithRpcPromise(_0x2fda('0x6e'),_0x2fda('0x6f'),_0x490fe9);}return null;})[_0x2fda('0x20')](function(_0x54c59e){if(_0x54c59e){_0x54c59e['message'][_0x2fda('0x68')]=util[_0x2fda('0x59')](_0x2fda('0x69'),_0x4cf796[_0x2fda('0x5b')][_0x2fda('0x34')]);_0x54c59e['message'][_0x2fda('0x6a')]=_0x490fe9['channel'];_0x54c59e[_0x2fda('0x29')][_0x2fda('0x70')]=_0x2fda('0x30');respondWithRpcPromise(_0x2fda('0x6b'),_0x2fda('0x6b'),{'event':'rejectmessage','message':_0x54c59e[_0x2fda('0x29')]},client9002);return _0x490fe9;}return null;})['then'](respondWithResult(_0x576c00,null))[_0x2fda('0x2a')](handleError(_0x576c00,null));};exports[_0x2fda('0x71')]=function(_0x403b26,_0x436576){var _0x9a59b;return db[_0x2fda('0x37')]['create'](_0x403b26[_0x2fda('0x54')],{})[_0x2fda('0x20')](function(_0x1f3bdf){_0x9a59b=_0x1f3bdf;return db['CmContact'][_0x2fda('0x72')]({'where':{'id':_0x9a59b[_0x2fda('0x73')]}});})['then'](function(_0x28e61f){if(_['isNil'](_0x28e61f)){return;}else{_0x9a59b[_0x2fda('0x57')]=_0x28e61f['fax'];return db[_0x2fda('0x74')][_0x2fda('0x72')]({'where':{'id':_0x9a59b['AttachmentId']}});}})[_0x2fda('0x20')](function(_0x2b4156){return respondWithRpcPromise(_0x2fda('0x75'),'SendFax',{'FaxAccountId':_['isNil'](_0x403b26[_0x2fda('0x54')])?undefined:_0x403b26['body'][_0x2fda('0x76')],'path':_[_0x2fda('0x77')](_0x2b4156)?undefined:util[_0x2fda('0x59')]('/var/opt/motion2/server/files/attachments/%s',_0x2b4156[_0x2fda('0x78')]),'fax':_[_0x2fda('0x77')](_0x9a59b[_0x2fda('0x57')])?undefined:_0x9a59b['fax'],'AttachmentId':_0x9a59b[_0x2fda('0x79')]},client9002);})[_0x2fda('0x20')](respondWithResult(_0x436576,0xc9))[_0x2fda('0x2a')](handleError(_0x436576,null));};exports[_0x2fda('0x7a')]=function(_0x320aaa,_0xf2e201){var _0x4b8874=path[_0x2fda('0x7b')](config[_0x2fda('0x7c')],_0x2fda('0x7d'),_0x2fda('0x7e'),'attachments');return db['FaxMessage'][_0x2fda('0x52')]({'where':{'id':_0x320aaa[_0x2fda('0x4e')]['id']},'include':[{'model':db[_0x2fda('0x74')],'as':_0x2fda('0x74')}]})[_0x2fda('0x20')](handleEntityNotFound(_0xf2e201,null))[_0x2fda('0x20')](function(_0x8af18){if(_0x8af18){return _0xf2e201['download'](path[_0x2fda('0x7b')](_0x4b8874,_0x8af18[_0x2fda('0x74')]['basename']));}})[_0x2fda('0x2a')](handleError(_0xf2e201,null));}; \ No newline at end of file +var _0xec1c=['describe','../../config/logger','fax-interactions','accept','fax','readAt','format','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','AcceptMessage','acceptMessage','manual','SIP/%s','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','interface','channel','rejectmessage','create','findOne','ContactId','Attachment','SendFax','FaxAccountId','basename','AttachmentId','join','root','server','files','attachments','download','eml-format','rimraf','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','end','count','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','body','find','destroy'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xec1c,0x1c3));var _0xcec1=function(_0x1c6b61,_0x5d0fe0){_0x1c6b61=_0x1c6b61-0x0;var _0xb6c7e2=_0xec1c[_0x1c6b61];return _0xb6c7e2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcec1('0x0'));var rimraf=require(_0xcec1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcec1('0x2'));var moment=require(_0xcec1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcec1('0x4'));var util=require('util');var path=require(_0xcec1('0x5'));var sox=require(_0xcec1('0x6'));var csv=require('to-csv');var ejs=require(_0xcec1('0x7'));var fs=require('fs');var _=require(_0xcec1('0x8'));var squel=require(_0xcec1('0x9'));var crypto=require(_0xcec1('0xa'));var jsforce=require(_0xcec1('0xb'));var deskjs=require(_0xcec1('0xc'));var toCsv=require(_0xcec1('0xd'));var querystring=require(_0xcec1('0xe'));var Papa=require('papaparse');var Redis=require(_0xcec1('0xf'));var authService=require(_0xcec1('0x10'));var qs=require(_0xcec1('0x11'));var as=require(_0xcec1('0x12'));var hardwareService=require(_0xcec1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcec1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcec1('0x15'));var db=require('../../mysqldb')['db'];config[_0xcec1('0x16')]=_[_0xcec1('0x17')](config[_0xcec1('0x16')],{'host':_0xcec1('0x18'),'port':0x18eb});var socket=require(_0xcec1('0x19'))(new Redis(config[_0xcec1('0x16')]));require(_0xcec1('0x1a'))[_0xcec1('0x1b')](socket);var jayson=require(_0xcec1('0x1c'));var client=jayson['client'][_0xcec1('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xcec1('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2d9f52,_0x4c733b,_0x5a16ab,_0x37c243){return new BPromise(function(_0x24ce7d,_0x47517a){var _0x4a2759=_0x37c243||client;return _0x4a2759['request'](_0x2d9f52,_0x5a16ab)[_0xcec1('0x1e')](function(_0x436fb9){logger[_0xcec1('0x1f')](_0xcec1('0x20'),_0x4c733b,_0xcec1('0x21'));logger[_0xcec1('0x22')](_0xcec1('0x23'),_0x4c733b,_0xcec1('0x21'),JSON['stringify'](_0x436fb9));if(_0x436fb9['error']){if(_0x436fb9[_0xcec1('0x24')][_0xcec1('0x25')]===0x1f4){logger[_0xcec1('0x24')](_0xcec1('0x20'),_0x4c733b,_0x436fb9[_0xcec1('0x24')][_0xcec1('0x26')]);return _0x47517a(_0x436fb9[_0xcec1('0x24')]['message']);}logger['error'](_0xcec1('0x20'),_0x4c733b,_0x436fb9[_0xcec1('0x24')][_0xcec1('0x26')]);return _0x24ce7d(_0x436fb9['error'][_0xcec1('0x26')]);}else{logger[_0xcec1('0x1f')](_0xcec1('0x20'),_0x4c733b,_0xcec1('0x21'));_0x24ce7d(_0x436fb9['result'][_0xcec1('0x26')]);}})['catch'](function(_0x21d6fb){logger['error'](_0xcec1('0x20'),_0x4c733b,_0x21d6fb);_0x47517a(_0x21d6fb);});});}function respondWithStatusCode(_0x2b6a1c,_0x4d6610){_0x4d6610=_0x4d6610||0xcc;return function(_0x1f1711){if(_0x1f1711){return _0x2b6a1c['sendStatus'](_0x4d6610);}return _0x2b6a1c[_0xcec1('0x27')](_0x4d6610)[_0xcec1('0x28')]();};}function respondWithResult(_0x32a3f2,_0x48717a){_0x48717a=_0x48717a||0xc8;return function(_0x4442e7){if(_0x4442e7){return _0x32a3f2[_0xcec1('0x27')](_0x48717a)['json'](_0x4442e7);}};}function respondWithFilteredResult(_0x73f83f,_0x26634d){return function(_0x58517a){if(_0x58517a){var _0x171c05=_0x58517a[_0xcec1('0x29')],_0xac1b34=_0x26634d['offset'],_0xc35c70=_0x26634d['offset']+_0x26634d['limit'],_0x5bcd33;if(_0xc35c70>=_0x171c05){_0xc35c70=_0x171c05;_0x5bcd33=0xc8;}else{_0x5bcd33=0xce;}_0x73f83f[_0xcec1('0x27')](_0x5bcd33);return _0x73f83f[_0xcec1('0x2a')](_0xcec1('0x2b'),_0xac1b34+'-'+_0xc35c70+'/'+_0x171c05)['json'](_0x58517a);}return null;};}function patchUpdates(_0x59f801){return function(_0xdb1306){try{jsonpatch[_0xcec1('0x2c')](_0xdb1306,_0x59f801,!![]);}catch(_0x1645ee){return BPromise[_0xcec1('0x2d')](_0x1645ee);}return _0xdb1306[_0xcec1('0x2e')]();};}function saveUpdates(_0x1b302e,_0x4cd700){return function(_0x2648da){if(_0x2648da){return _0x2648da[_0xcec1('0x2f')](_0x1b302e)[_0xcec1('0x1e')](function(_0x1d83c5){return _0x1d83c5;});}return null;};}function removeEntity(_0x1e9486,_0x47d27b){return function(_0x7ba6bb){if(_0x7ba6bb){return _0x7ba6bb['destroy']()['then'](function(){_0x1e9486['status'](0xcc)[_0xcec1('0x28')]();});}};}function handleEntityNotFound(_0x56e5dc,_0x4dffdb){return function(_0x58edac){if(!_0x58edac){_0x56e5dc[_0xcec1('0x30')](0x194);}return _0x58edac;};}function handleError(_0x5cb47e,_0x284665){_0x284665=_0x284665||0x1f4;return function(_0x5273d0){logger[_0xcec1('0x24')](_0x5273d0[_0xcec1('0x31')]);if(_0x5273d0[_0xcec1('0x32')]){delete _0x5273d0['name'];}_0x5cb47e['status'](_0x284665)[_0xcec1('0x33')](_0x5273d0);};}exports[_0xcec1('0x34')]=function(_0x1c827f,_0x1e0110){var _0x1f0403={},_0x5375e2={},_0x46fe47={'count':0x0,'rows':[]};var _0xc5f2d8=_[_0xcec1('0x35')](db[_0xcec1('0x36')][_0xcec1('0x37')],function(_0x269f60){return{'name':_0x269f60[_0xcec1('0x38')],'type':_0x269f60[_0xcec1('0x39')][_0xcec1('0x3a')]};});_0x5375e2[_0xcec1('0x3b')]=_[_0xcec1('0x35')](_0xc5f2d8,_0xcec1('0x32'));_0x5375e2[_0xcec1('0x3c')]=_[_0xcec1('0x3d')](_0x1c827f[_0xcec1('0x3c')]);_0x5375e2[_0xcec1('0x3e')]=_[_0xcec1('0x3f')](_0x5375e2['model'],_0x5375e2[_0xcec1('0x3c')]);_0x1f0403['attributes']=_[_0xcec1('0x3f')](_0x5375e2[_0xcec1('0x3b')],qs['fields'](_0x1c827f[_0xcec1('0x3c')][_0xcec1('0x40')]));_0x1f0403[_0xcec1('0x41')]=_0x1f0403[_0xcec1('0x41')][_0xcec1('0x42')]?_0x1f0403['attributes']:_0x5375e2[_0xcec1('0x3b')];if(!_0x1c827f['query'][_0xcec1('0x43')](_0xcec1('0x44'))){_0x1f0403['limit']=qs[_0xcec1('0x45')](_0x1c827f[_0xcec1('0x3c')][_0xcec1('0x45')]);_0x1f0403[_0xcec1('0x46')]=qs[_0xcec1('0x46')](_0x1c827f[_0xcec1('0x3c')][_0xcec1('0x46')]);}_0x1f0403[_0xcec1('0x47')]=qs[_0xcec1('0x48')](_0x1c827f['query']['sort']);_0x1f0403[_0xcec1('0x49')]=qs[_0xcec1('0x3e')](_[_0xcec1('0x4a')](_0x1c827f[_0xcec1('0x3c')],_0x5375e2[_0xcec1('0x3e')]),_0xc5f2d8);if(_0x1c827f[_0xcec1('0x3c')]['filter']){_0x1f0403[_0xcec1('0x49')]=_['merge'](_0x1f0403[_0xcec1('0x49')],{'$or':_[_0xcec1('0x35')](_0xc5f2d8,function(_0x2980d0){if(_0x2980d0[_0xcec1('0x39')]!==_0xcec1('0x4b')){var _0x38713d={};_0x38713d[_0x2980d0[_0xcec1('0x32')]]={'$like':'%'+_0x1c827f['query'][_0xcec1('0x4c')]+'%'};return _0x38713d;}})});}_0x1f0403=_[_0xcec1('0x4d')]({},_0x1f0403,_0x1c827f[_0xcec1('0x4e')]);var _0xb7d70={'where':_0x1f0403[_0xcec1('0x49')]};return db['FaxMessage'][_0xcec1('0x29')](_0xb7d70)[_0xcec1('0x1e')](function(_0xe2162f){_0x46fe47[_0xcec1('0x29')]=_0xe2162f;if(_0x1c827f[_0xcec1('0x3c')][_0xcec1('0x4f')]){_0x1f0403['include']=[{'all':!![]}];}return db[_0xcec1('0x36')][_0xcec1('0x50')](_0x1f0403);})[_0xcec1('0x1e')](function(_0x3fef7c){_0x46fe47[_0xcec1('0x51')]=_0x3fef7c;return _0x46fe47;})[_0xcec1('0x1e')](respondWithFilteredResult(_0x1e0110,_0x1f0403))[_0xcec1('0x52')](handleError(_0x1e0110,null));};exports[_0xcec1('0x53')]=function(_0x148af3,_0x263ed3){var _0x1d8cae={'raw':!![],'where':{'id':_0x148af3[_0xcec1('0x54')]['id']}},_0x989f6a={};_0x989f6a['model']=_['keys'](db[_0xcec1('0x36')][_0xcec1('0x37')]);_0x989f6a[_0xcec1('0x3c')]=_[_0xcec1('0x3d')](_0x148af3[_0xcec1('0x3c')]);_0x989f6a[_0xcec1('0x3e')]=_[_0xcec1('0x3f')](_0x989f6a['model'],_0x989f6a['query']);_0x1d8cae[_0xcec1('0x41')]=_[_0xcec1('0x3f')](_0x989f6a[_0xcec1('0x3b')],qs[_0xcec1('0x40')](_0x148af3[_0xcec1('0x3c')]['fields']));_0x1d8cae['attributes']=_0x1d8cae['attributes']['length']?_0x1d8cae['attributes']:_0x989f6a[_0xcec1('0x3b')];if(_0x148af3[_0xcec1('0x3c')][_0xcec1('0x4f')]){_0x1d8cae[_0xcec1('0x55')]=[{'all':!![]}];}_0x1d8cae=_[_0xcec1('0x4d')]({},_0x1d8cae,_0x148af3[_0xcec1('0x4e')]);return db[_0xcec1('0x36')]['find'](_0x1d8cae)[_0xcec1('0x1e')](handleEntityNotFound(_0x263ed3,null))[_0xcec1('0x1e')](respondWithResult(_0x263ed3,null))[_0xcec1('0x52')](handleError(_0x263ed3,null));};exports[_0xcec1('0x2f')]=function(_0x3f5ff2,_0x37e34a){if(_0x3f5ff2[_0xcec1('0x56')]['id']){delete _0x3f5ff2['body']['id'];}return db['FaxMessage'][_0xcec1('0x57')]({'where':{'id':_0x3f5ff2[_0xcec1('0x54')]['id']}})[_0xcec1('0x1e')](handleEntityNotFound(_0x37e34a,null))['then'](saveUpdates(_0x3f5ff2['body'],null))[_0xcec1('0x1e')](respondWithResult(_0x37e34a,null))['catch'](handleError(_0x37e34a,null));};exports[_0xcec1('0x58')]=function(_0x171210,_0x2642d4){return db[_0xcec1('0x36')][_0xcec1('0x57')]({'where':{'id':_0x171210[_0xcec1('0x54')]['id']}})['then'](handleEntityNotFound(_0x2642d4,null))[_0xcec1('0x1e')](removeEntity(_0x2642d4,null))[_0xcec1('0x52')](handleError(_0x2642d4,null));};exports['describe']=function(_0x18035d,_0x10f0bc){return db[_0xcec1('0x36')][_0xcec1('0x59')]()[_0xcec1('0x1e')](respondWithResult(_0x10f0bc,null))[_0xcec1('0x52')](handleError(_0x10f0bc,null));};var interaction_log=require(_0xcec1('0x5a'))(_0xcec1('0x5b'));exports[_0xcec1('0x5c')]=function(_0xf30ca3,_0x954e80,_0x574357){var _0x521967={'channel':_0xcec1('0x5d')};if(_0xf30ca3[_0xcec1('0x56')]['id']){delete _0xf30ca3[_0xcec1('0x56')]['id'];}_0xf30ca3['body']['read']=!![];_0xf30ca3[_0xcec1('0x56')][_0xcec1('0x5e')]=moment()[_0xcec1('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xf30ca3[_0xcec1('0x56')]['UserId']=_0xf30ca3[_0xcec1('0x56')][_0xcec1('0x60')]||_0xf30ca3[_0xcec1('0x61')]['id'];return db[_0xcec1('0x36')][_0xcec1('0x57')]({'where':{'id':_0xf30ca3[_0xcec1('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xcec1('0x62')],'as':_0xcec1('0x63')}]})[_0xcec1('0x1e')](handleEntityNotFound(_0x954e80,null))[_0xcec1('0x1e')](saveUpdates(_0xf30ca3[_0xcec1('0x56')],null))[_0xcec1('0x1e')](function(_0x326747){if(_0x326747){_0x521967['message']=_0x326747[_0xcec1('0x64')]({'plain':!![]});return db[_0xcec1('0x65')][_0xcec1('0x57')]({'where':{'id':_0x326747[_0xcec1('0x66')]}});}return null;})[_0xcec1('0x1e')](handleEntityNotFound(_0x954e80,null))['then'](function(_0x27b655){if(_0x27b655){return _0x27b655[_0xcec1('0x2f')]({'UserId':_0xf30ca3[_0xcec1('0x56')][_0xcec1('0x60')],'read1stAt':_[_0xcec1('0x67')](_0x27b655[_0xcec1('0x68')])?moment()[_0xcec1('0x5f')](_0xcec1('0x69')):undefined});}return null;})[_0xcec1('0x1e')](function(_0x4e8ba5){if(_0x4e8ba5){_0x521967[_0xcec1('0x6a')]=_0x4e8ba5['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf30ca3[_0xcec1('0x61')]['id'],_0xf30ca3[_0xcec1('0x61')][_0xcec1('0x32')],_0xf30ca3[_0xcec1('0x61')]['role'],_0x521967[_0xcec1('0x6a')]['id'],_0xf30ca3['body']?JSON['stringify'](_0xf30ca3[_0xcec1('0x56')]):'null');return respondWithRpcPromise(_0xcec1('0x6b'),_0xcec1('0x6c'),_0x521967);}return null;})[_0xcec1('0x1e')](function(_0x12f0ee){if(_0x12f0ee){if(_0xf30ca3[_0xcec1('0x56')][_0xcec1('0x6d')]){_0x521967[_0xcec1('0x26')]['interface']=util['format'](_0xcec1('0x6e'),_0xf30ca3[_0xcec1('0x61')][_0xcec1('0x32')]);_0x521967[_0xcec1('0x26')]['channel']=_0x521967['channel'];_0x521967[_0xcec1('0x26')][_0xcec1('0x6f')]=_0xcec1('0x5c');return respondWithRpcPromise(_0xcec1('0x70'),_0xcec1('0x70'),{'event':'acceptmessage','message':_0x521967[_0xcec1('0x26')]},client9002)[_0xcec1('0x1e')](function(){return _0x521967;});}return _0x521967;}return null;})['then'](respondWithResult(_0x954e80,null))['catch'](handleError(_0x954e80,null));};var interaction_log=require(_0xcec1('0x5a'))(_0xcec1('0x5b'));exports[_0xcec1('0x2d')]=function(_0x23419,_0x51720f,_0x1ecc71){var _0x50b307={'agent':{},'channel':_0xcec1('0x5d')};if(_0x23419['body']['id']){delete _0x23419['body']['id'];}_0x23419[_0xcec1('0x56')][_0xcec1('0x60')]=_0x23419[_0xcec1('0x56')][_0xcec1('0x60')]||_0x23419[_0xcec1('0x61')]['id'];_0x50b307['agent']['id']=_0x23419[_0xcec1('0x56')][_0xcec1('0x60')];return db[_0xcec1('0x36')][_0xcec1('0x57')]({'where':{'id':_0x23419['params']['id'],'UserId':null}})[_0xcec1('0x1e')](handleEntityNotFound(_0x51720f,null))[_0xcec1('0x1e')](function(_0x45895b){if(_0x45895b){_0x50b307['message']=_0x45895b['get']({'plain':!![]});return db[_0xcec1('0x65')][_0xcec1('0x57')]({'where':{'id':_0x45895b[_0xcec1('0x66')]}});}return null;})[_0xcec1('0x1e')](handleEntityNotFound(_0x51720f,null))[_0xcec1('0x1e')](function(_0x2ebb3b){if(_0x2ebb3b){_0x50b307[_0xcec1('0x6a')]=_0x2ebb3b[_0xcec1('0x64')]({'plain':!![]});interaction_log['info'](_0xcec1('0x71'),_0x23419[_0xcec1('0x61')]['id'],_0x23419[_0xcec1('0x61')][_0xcec1('0x32')],_0x23419[_0xcec1('0x61')][_0xcec1('0x72')],_0x50b307[_0xcec1('0x6a')]['id'],_0x23419[_0xcec1('0x56')]?JSON[_0xcec1('0x73')](_0x23419[_0xcec1('0x56')]):'null');return respondWithRpcPromise(_0xcec1('0x74'),_0xcec1('0x75'),_0x50b307);}return null;})[_0xcec1('0x1e')](function(_0x44dca2){if(_0x44dca2){_0x44dca2[_0xcec1('0x26')][_0xcec1('0x76')]=util[_0xcec1('0x5f')](_0xcec1('0x6e'),_0x23419[_0xcec1('0x61')][_0xcec1('0x32')]);_0x44dca2[_0xcec1('0x26')][_0xcec1('0x77')]=_0x50b307['channel'];_0x44dca2[_0xcec1('0x26')][_0xcec1('0x6f')]=_0xcec1('0x2d');respondWithRpcPromise(_0xcec1('0x70'),'EventManager',{'event':_0xcec1('0x78'),'message':_0x44dca2[_0xcec1('0x26')]},client9002);return _0x50b307;}return null;})[_0xcec1('0x1e')](respondWithResult(_0x51720f,null))[_0xcec1('0x52')](handleError(_0x51720f,null));};exports['create']=function(_0x4067f7,_0x302f87){var _0x26c6e4;return db[_0xcec1('0x36')][_0xcec1('0x79')](_0x4067f7[_0xcec1('0x56')],{})[_0xcec1('0x1e')](function(_0x1a8bca){_0x26c6e4=_0x1a8bca;return db[_0xcec1('0x62')][_0xcec1('0x7a')]({'where':{'id':_0x26c6e4[_0xcec1('0x7b')]}});})['then'](function(_0x4b949d){if(_[_0xcec1('0x67')](_0x4b949d)){return;}else{_0x26c6e4[_0xcec1('0x5d')]=_0x4b949d['fax'];return db[_0xcec1('0x7c')][_0xcec1('0x7a')]({'where':{'id':_0x26c6e4['AttachmentId']}});}})[_0xcec1('0x1e')](function(_0x3e4993){return respondWithRpcPromise(_0xcec1('0x7d'),'SendFax',{'FaxAccountId':_[_0xcec1('0x67')](_0x4067f7[_0xcec1('0x56')])?undefined:_0x4067f7[_0xcec1('0x56')][_0xcec1('0x7e')],'path':_[_0xcec1('0x67')](_0x3e4993)?undefined:util[_0xcec1('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x3e4993[_0xcec1('0x7f')]),'fax':_['isNil'](_0x26c6e4[_0xcec1('0x5d')])?undefined:_0x26c6e4[_0xcec1('0x5d')],'AttachmentId':_0x26c6e4[_0xcec1('0x80')]},client9002);})[_0xcec1('0x1e')](respondWithResult(_0x302f87,0xc9))[_0xcec1('0x52')](handleError(_0x302f87,null));};exports['download']=function(_0x712fc,_0x426d71){var _0x897153=path[_0xcec1('0x81')](config[_0xcec1('0x82')],_0xcec1('0x83'),_0xcec1('0x84'),_0xcec1('0x85'));return db[_0xcec1('0x36')][_0xcec1('0x57')]({'where':{'id':_0x712fc[_0xcec1('0x54')]['id']},'include':[{'model':db['Attachment'],'as':_0xcec1('0x7c')}]})[_0xcec1('0x1e')](handleEntityNotFound(_0x426d71,null))[_0xcec1('0x1e')](function(_0x1650ae){if(_0x1650ae){return _0x426d71[_0xcec1('0x86')](path[_0xcec1('0x81')](_0x897153,_0x1650ae[_0xcec1('0x7c')][_0xcec1('0x7f')]));}})['catch'](handleError(_0x426d71,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index cbaf617..e0cad80 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x6b4fe4,_0x4f2c29){_0x6b4fe4=_0x6b4fe4-0x0;var _0x46b758=_0xe14b[_0x6b4fe4];return _0x46b758;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0xa7831,_0x113c1f){_0xa7831=_0xa7831-0x0;var _0x20657f=_0x3e74[_0xa7831];return _0x20657f;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e29d503..dce6de4 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 _0x6e77=['path','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird'];(function(_0x3177cc,_0xd023b2){var _0x1e9c8e=function(_0x2abb41){while(--_0x2abb41){_0x3177cc['push'](_0x3177cc['shift']());}};_0x1e9c8e(++_0xd023b2);}(_0x6e77,0x158));var _0x76e7=function(_0x51bc84,_0x519320){_0x51bc84=_0x51bc84-0x0;var _0x3a953e=_0x6e77[_0x51bc84];return _0x3a953e;};'use strict';var _=require('lodash');var util=require(_0x76e7('0x0'));var logger=require('../../config/logger')(_0x76e7('0x1'));var moment=require(_0x76e7('0x2'));var BPromise=require(_0x76e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76e7('0x4'));var rimraf=require(_0x76e7('0x5'));var config=require(_0x76e7('0x6'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x1c4f3d,_0x2c6516){return _0x1c4f3d[_0x76e7('0x7')](_0x76e7('0x8'),attributes,{'tableName':_0x76e7('0x9'),'paranoid':![],'indexes':[{'name':_0x76e7('0xa'),'fields':[_0x76e7('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x153380,_0x3fc60a,_0x362576){var _0x1212b6=_0x1c4f3d[_0x76e7('0xc')];var _0x45273b=_0x153380[_0x76e7('0xd')]({'plain':!![]});if(_0x45273b[_0x76e7('0xe')][_0x76e7('0xf')]()==='in'||_0x45273b['direction'][_0x76e7('0xf')]()==='out'&&!_0x45273b[_0x76e7('0x10')]&&!_[_0x76e7('0x11')](_0x45273b[_0x76e7('0x12')])){_0x1212b6[_0x76e7('0x13')][_0x76e7('0x14')]({'where':{'id':_0x45273b[_0x76e7('0x15')]}})[_0x76e7('0x16')](function(_0x26e02e){if(_0x26e02e){_0x26e02e[_0x76e7('0x17')]({'lastMsgAt':_0x45273b[_0x76e7('0x18')],'lastMsgDirection':_0x45273b[_0x76e7('0xe')]['toLowerCase']()});}})[_0x76e7('0x19')](function(_0x41073e){console[_0x76e7('0x1a')](_0x41073e);});}_0x362576();}},'charset':_0x76e7('0x1b'),'collate':_0x76e7('0x1c')});}; \ No newline at end of file +var _0x90d6=['models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x123623,_0x9694e2){var _0x3b00d1=function(_0x7e48e0){while(--_0x7e48e0){_0x123623['push'](_0x123623['shift']());}};_0x3b00d1(++_0x9694e2);}(_0x90d6,0xb8));var _0x690d=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x90d6[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x690d('0x0'));var util=require(_0x690d('0x1'));var logger=require(_0x690d('0x2'))(_0x690d('0x3'));var moment=require('moment');var BPromise=require(_0x690d('0x4'));var rp=require(_0x690d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x690d('0x6'));var attributes=require(_0x690d('0x7'));module[_0x690d('0x8')]=function(_0x5d1ece,_0x2f8fbb){return _0x5d1ece[_0x690d('0x9')](_0x690d('0xa'),attributes,{'tableName':_0x690d('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a1a34,_0x3ebf41,_0x3c5efb){var _0x6607e2=_0x5d1ece[_0x690d('0xc')];var _0x379468=_0x2a1a34[_0x690d('0xd')]({'plain':!![]});if(_0x379468[_0x690d('0xe')][_0x690d('0xf')]()==='in'||_0x379468[_0x690d('0xe')][_0x690d('0xf')]()===_0x690d('0x10')&&!_0x379468[_0x690d('0x11')]&&!_['isNil'](_0x379468[_0x690d('0x12')])){_0x6607e2[_0x690d('0x13')][_0x690d('0x14')]({'where':{'id':_0x379468[_0x690d('0x15')]}})[_0x690d('0x16')](function(_0x539884){if(_0x539884){_0x539884[_0x690d('0x17')]({'lastMsgAt':_0x379468[_0x690d('0x18')],'lastMsgDirection':_0x379468[_0x690d('0xe')][_0x690d('0xf')]()});}})[_0x690d('0x19')](function(_0x4f4896){console[_0x690d('0x1a')](_0x4f4896);});}_0x3c5efb();}},'charset':'utf8mb4','collate':_0x690d('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2860cfc..ad1ae29 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 _0x7390=['update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','FaxMessage','create','options','CreateFaxMessage','UpdateFaxMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7390,0x1f1));var _0x0739=function(_0x52e0b5,_0x3481cb){_0x52e0b5=_0x52e0b5-0x0;var _0x3e0064=_0x7390[_0x52e0b5];return _0x3e0064;};'use strict';var _=require(_0x0739('0x0'));var util=require(_0x0739('0x1'));var moment=require(_0x0739('0x2'));var BPromise=require(_0x0739('0x3'));var rs=require(_0x0739('0x4'));var fs=require('fs');var Redis=require(_0x0739('0x5'));var db=require(_0x0739('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0739('0x7'))(_0x0739('0x8'));var config=require(_0x0739('0x9'));var jayson=require(_0x0739('0xa'));var client=jayson['client'][_0x0739('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0739('0xc')],{'host':_0x0739('0xd'),'port':0x18eb});var socket=require(_0x0739('0xe'))(new Redis(config['redis']));require(_0x0739('0xf'))[_0x0739('0x10')](socket);function respondWithRpcPromise(_0xe2a103,_0xeb9868,_0x3d7824){return new BPromise(function(_0x11f25a,_0x324a35){return client[_0x0739('0x11')](_0xe2a103,_0x3d7824)[_0x0739('0x12')](function(_0x283742){logger['info']('FaxMessage,\x20%s,\x20%s',_0xeb9868,'request\x20sent');logger[_0x0739('0x13')](_0x0739('0x14'),_0xeb9868,_0x0739('0x15'),JSON[_0x0739('0x16')](_0x283742));if(_0x283742['error']){if(_0x283742[_0x0739('0x17')][_0x0739('0x18')]===0x1f4){logger['error'](_0x0739('0x19'),_0xeb9868,_0x283742[_0x0739('0x17')][_0x0739('0x1a')]);return _0x324a35(_0x283742['error']['message']);}logger[_0x0739('0x17')](_0x0739('0x19'),_0xeb9868,_0x283742[_0x0739('0x17')][_0x0739('0x1a')]);return _0x11f25a(_0x283742[_0x0739('0x17')][_0x0739('0x1a')]);}else{logger[_0x0739('0x1b')]('FaxMessage,\x20%s,\x20%s',_0xeb9868,_0x0739('0x15'));_0x11f25a(_0x283742[_0x0739('0x1c')]['message']);}})[_0x0739('0x1d')](function(_0x2e2a3d){logger[_0x0739('0x17')](_0x0739('0x19'),_0xeb9868,_0x2e2a3d);_0x324a35(_0x2e2a3d);});});}exports['CreateFaxMessage']=function(_0xea4e43){var _0x2e8eb5=this;return new Promise(function(_0xbfccaa,_0xda8dde){return db[_0x0739('0x1e')][_0x0739('0x1f')](_0xea4e43['body'],{'raw':_0xea4e43[_0x0739('0x20')]?_0xea4e43[_0x0739('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x22d71e){logger[_0x0739('0x1b')](_0x0739('0x21'),_0xea4e43);logger[_0x0739('0x13')](_0x0739('0x21'),_0xea4e43,JSON[_0x0739('0x16')](_0x22d71e));_0xbfccaa(_0x22d71e);})[_0x0739('0x1d')](function(_0x334455){logger[_0x0739('0x17')](_0x0739('0x21'),_0x334455[_0x0739('0x1a')],_0xea4e43);_0xda8dde(_0x2e8eb5[_0x0739('0x17')](0x1f4,_0x334455['message']));});});};exports[_0x0739('0x22')]=function(_0x3d444c){var _0x334fdf=this;return new Promise(function(_0x4f1442,_0x3471b5){return db['FaxMessage'][_0x0739('0x23')](_0x3d444c['body'],{'raw':_0x3d444c[_0x0739('0x20')]?_0x3d444c[_0x0739('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d444c['options']?_0x3d444c['options'][_0x0739('0x24')]||null:null,'attributes':_0x3d444c[_0x0739('0x20')]?_0x3d444c[_0x0739('0x20')][_0x0739('0x25')]||null:null,'limit':_0x3d444c[_0x0739('0x20')]?_0x3d444c[_0x0739('0x20')]['limit']||null:null})[_0x0739('0x12')](function(_0x23c270){logger['info'](_0x0739('0x22'),_0x3d444c);logger[_0x0739('0x13')](_0x0739('0x22'),_0x3d444c,JSON[_0x0739('0x16')](_0x23c270));_0x4f1442(_0x23c270);})[_0x0739('0x1d')](function(_0x326567){logger[_0x0739('0x17')](_0x0739('0x22'),_0x326567[_0x0739('0x1a')],_0x3d444c);_0x3471b5(_0x334fdf[_0x0739('0x17')](0x1f4,_0x326567['message']));});});}; \ No newline at end of file +var _0xeb5f=['CreateFaxMessage','create','body','options','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2ac530,_0x257e5e){var _0x1ca639=function(_0xa0eda1){while(--_0xa0eda1){_0x2ac530['push'](_0x2ac530['shift']());}};_0x1ca639(++_0x257e5e);}(_0xeb5f,0x1ac));var _0xfeb5=function(_0x4cc65f,_0x5ac376){_0x4cc65f=_0x4cc65f-0x0;var _0x314adf=_0xeb5f[_0x4cc65f];return _0x314adf;};'use strict';var _=require(_0xfeb5('0x0'));var util=require(_0xfeb5('0x1'));var moment=require(_0xfeb5('0x2'));var BPromise=require(_0xfeb5('0x3'));var rs=require(_0xfeb5('0x4'));var fs=require('fs');var Redis=require(_0xfeb5('0x5'));var db=require(_0xfeb5('0x6'))['db'];var utils=require(_0xfeb5('0x7'));var logger=require(_0xfeb5('0x8'))(_0xfeb5('0x9'));var config=require(_0xfeb5('0xa'));var jayson=require(_0xfeb5('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xfeb5('0xc')]=_['defaults'](config['redis'],{'host':_0xfeb5('0xd'),'port':0x18eb});var socket=require(_0xfeb5('0xe'))(new Redis(config['redis']));require(_0xfeb5('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b51f8,_0x27656c,_0x51fbda){return new BPromise(function(_0x22c517,_0x588987){return client['request'](_0x5b51f8,_0x51fbda)[_0xfeb5('0x10')](function(_0x59c9b3){logger[_0xfeb5('0x11')](_0xfeb5('0x12'),_0x27656c,_0xfeb5('0x13'));logger[_0xfeb5('0x14')](_0xfeb5('0x15'),_0x27656c,_0xfeb5('0x13'),JSON[_0xfeb5('0x16')](_0x59c9b3));if(_0x59c9b3[_0xfeb5('0x17')]){if(_0x59c9b3[_0xfeb5('0x17')][_0xfeb5('0x18')]===0x1f4){logger['error'](_0xfeb5('0x12'),_0x27656c,_0x59c9b3['error'][_0xfeb5('0x19')]);return _0x588987(_0x59c9b3[_0xfeb5('0x17')][_0xfeb5('0x19')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x27656c,_0x59c9b3[_0xfeb5('0x17')]['message']);return _0x22c517(_0x59c9b3[_0xfeb5('0x17')][_0xfeb5('0x19')]);}else{logger[_0xfeb5('0x11')](_0xfeb5('0x12'),_0x27656c,_0xfeb5('0x13'));_0x22c517(_0x59c9b3[_0xfeb5('0x1a')]['message']);}})[_0xfeb5('0x1b')](function(_0x303efe){logger[_0xfeb5('0x17')]('FaxMessage,\x20%s,\x20%s',_0x27656c,_0x303efe);_0x588987(_0x303efe);});});}exports[_0xfeb5('0x1c')]=function(_0x36bc9a){var _0x3e10cc=this;return new Promise(function(_0x1097c0,_0xed25e4){return db['FaxMessage'][_0xfeb5('0x1d')](_0x36bc9a[_0xfeb5('0x1e')],{'raw':_0x36bc9a['options']?_0x36bc9a[_0xfeb5('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x261476){logger[_0xfeb5('0x11')]('CreateFaxMessage',_0x36bc9a);logger['debug'](_0xfeb5('0x1c'),_0x36bc9a,JSON[_0xfeb5('0x16')](_0x261476));_0x1097c0(_0x261476);})['catch'](function(_0x2cb8fc){logger[_0xfeb5('0x17')]('CreateFaxMessage',_0x2cb8fc['message'],_0x36bc9a);_0xed25e4(_0x3e10cc[_0xfeb5('0x17')](0x1f4,_0x2cb8fc[_0xfeb5('0x19')]));});});};exports[_0xfeb5('0x20')]=function(_0x56fd75){var _0x479962=this;return new Promise(function(_0x21300d,_0x44a2c5){return db[_0xfeb5('0x21')][_0xfeb5('0x22')](_0x56fd75[_0xfeb5('0x1e')],{'raw':_0x56fd75[_0xfeb5('0x1f')]?_0x56fd75[_0xfeb5('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56fd75[_0xfeb5('0x1f')]?_0x56fd75[_0xfeb5('0x1f')][_0xfeb5('0x23')]||null:null,'attributes':_0x56fd75[_0xfeb5('0x1f')]?_0x56fd75['options'][_0xfeb5('0x24')]||null:null,'limit':_0x56fd75[_0xfeb5('0x1f')]?_0x56fd75['options'][_0xfeb5('0x25')]||null:null})[_0xfeb5('0x10')](function(_0x26c924){logger[_0xfeb5('0x11')](_0xfeb5('0x20'),_0x56fd75);logger['debug'](_0xfeb5('0x20'),_0x56fd75,JSON[_0xfeb5('0x16')](_0x26c924));_0x21300d(_0x26c924);})[_0xfeb5('0x1b')](function(_0x56c5a0){logger[_0xfeb5('0x17')](_0xfeb5('0x20'),_0x56c5a0[_0xfeb5('0x19')],_0x56fd75);_0x44a2c5(_0x479962['error'](0x1f4,_0x56c5a0[_0xfeb5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 43c9ef9..d6c0da8 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 a79b2b9..4d9737b 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 _0x0aae=['./faxMessage.controller','get','isAuthenticated','index','/describe','show','/:id/download','download','tracked','fax','put','/:id','update','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x0aae,0x1dd));var _0xe0aa=function(_0x4a9900,_0x3e0400){_0x4a9900=_0x4a9900-0x0;var _0x2d7418=_0x0aae[_0x4a9900];return _0x2d7418;};'use strict';var multer=require(_0xe0aa('0x0'));var util=require(_0xe0aa('0x1'));var path=require(_0xe0aa('0x2'));var timeout=require(_0xe0aa('0x3'));var express=require(_0xe0aa('0x4'));var router=express[_0xe0aa('0x5')]();var auth=require(_0xe0aa('0x6'));var interaction=require(_0xe0aa('0x7'));var config=require(_0xe0aa('0x8'));var controller=require(_0xe0aa('0x9'));router[_0xe0aa('0xa')]('/',auth[_0xe0aa('0xb')](),controller[_0xe0aa('0xc')]);router['get'](_0xe0aa('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xe0aa('0xa')]('/:id',auth[_0xe0aa('0xb')](),controller[_0xe0aa('0xe')]);router[_0xe0aa('0xa')](_0xe0aa('0xf'),auth[_0xe0aa('0xb')](),controller[_0xe0aa('0x10')]);router['post']('/',auth[_0xe0aa('0xb')](),interaction[_0xe0aa('0x11')](_0xe0aa('0x12'),'faxmessage:create'),controller['create']);router[_0xe0aa('0x13')](_0xe0aa('0x14'),auth[_0xe0aa('0xb')](),controller[_0xe0aa('0x15')]);router[_0xe0aa('0x13')](_0xe0aa('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xe0aa('0x13')]('/:id/reject',auth[_0xe0aa('0xb')](),controller[_0xe0aa('0x17')]);router[_0xe0aa('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xe0aa('0x19')]);module[_0xe0aa('0x1a')]=router; \ No newline at end of file +var _0xf875=['post','tracked','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','/:id/download','download'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xf875,0x138));var _0x5f87=function(_0x8ff795,_0x4ea32d){_0x8ff795=_0x8ff795-0x0;var _0x418b21=_0xf875[_0x8ff795];return _0x418b21;};'use strict';var multer=require(_0x5f87('0x0'));var util=require('util');var path=require(_0x5f87('0x1'));var timeout=require(_0x5f87('0x2'));var express=require(_0x5f87('0x3'));var router=express['Router']();var auth=require(_0x5f87('0x4'));var interaction=require(_0x5f87('0x5'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0x5f87('0x6')]('/',auth[_0x5f87('0x7')](),controller[_0x5f87('0x8')]);router[_0x5f87('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x5f87('0x9')]);router['get']('/:id',auth[_0x5f87('0x7')](),controller[_0x5f87('0xa')]);router[_0x5f87('0x6')](_0x5f87('0xb'),auth['isAuthenticated'](),controller[_0x5f87('0xc')]);router[_0x5f87('0xd')]('/',auth[_0x5f87('0x7')](),interaction[_0x5f87('0xe')]('fax','faxmessage:create'),controller[_0x5f87('0xf')]);router[_0x5f87('0x10')]('/:id',auth[_0x5f87('0x7')](),controller[_0x5f87('0x11')]);router[_0x5f87('0x10')](_0x5f87('0x12'),auth[_0x5f87('0x7')](),controller[_0x5f87('0x13')]);router[_0x5f87('0x10')](_0x5f87('0x14'),auth[_0x5f87('0x7')](),controller[_0x5f87('0x15')]);router[_0x5f87('0x16')]('/:id',auth[_0x5f87('0x7')](),controller[_0x5f87('0x17')]);module[_0x5f87('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 51018a9..82ebbd1 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 _0xbada=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x24ccb6,_0x20bcb2){var _0x492535=function(_0x2b1f7f){while(--_0x2b1f7f){_0x24ccb6['push'](_0x24ccb6['shift']());}};_0x492535(++_0x20bcb2);}(_0xbada,0x190));var _0xabad=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbada[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module[_0xabad('0x0')]={'name':{'type':Sequelize[_0xabad('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xabad('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabad('0x3')](_0xabad('0x4'),_0xabad('0x5'),_0xabad('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xabad('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb1d=['STRING','INTEGER','ENUM','beepall','name'];(function(_0x3c27ea,_0x553f41){var _0x2bd84b=function(_0x249ece){while(--_0x249ece){_0x3c27ea['push'](_0x3c27ea['shift']());}};_0x2bd84b(++_0x553f41);}(_0xfb1d,0x135));var _0xdfb1=function(_0x1d26be,_0x5a1c85){_0x1d26be=_0x1d26be-0x0;var _0x3db62d=_0xfb1d[_0x1d26be];return _0x3db62d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdfb1('0x0'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdfb1('0x1')]},'timeout':{'type':Sequelize[_0xdfb1('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdfb1('0x3')]('rrmemory',_0xdfb1('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdfb1('0x2')],'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 b5787eb..15a7fe3 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 _0xeddd=['offset','limit','set','Content-Range','apply','update','then','destroy','get','FaxQueues','UserProfileResource','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','options','FaxQueue','includeAll','include','rows','catch','show','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','params','describe','findOne','UserFaxQueue','rawAttributes','length','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','hasOwnProperty','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','tq.TeamId','team_has_fax_queues','join','user_has_teams','clone','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count'];(function(_0x3c9def,_0x5384ea){var _0x591e39=function(_0x38a6ba){while(--_0x38a6ba){_0x3c9def['push'](_0x3c9def['shift']());}};_0x591e39(++_0x5384ea);}(_0xeddd,0x69));var _0xdedd=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xeddd[_0x3511d3];return _0x5d6321;};'use strict';var pdf=require(_0xdedd('0x0'));var emlformat=require(_0xdedd('0x1'));var rimraf=require(_0xdedd('0x2'));var zipdir=require(_0xdedd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdedd('0x4'));var moment=require('moment');var BPromise=require(_0xdedd('0x5'));var Mustache=require(_0xdedd('0x6'));var util=require('util');var path=require(_0xdedd('0x7'));var sox=require(_0xdedd('0x8'));var csv=require(_0xdedd('0x9'));var ejs=require(_0xdedd('0xa'));var fs=require('fs');var _=require(_0xdedd('0xb'));var squel=require(_0xdedd('0xc'));var crypto=require(_0xdedd('0xd'));var jsforce=require(_0xdedd('0xe'));var deskjs=require(_0xdedd('0xf'));var toCsv=require(_0xdedd('0x9'));var querystring=require(_0xdedd('0x10'));var Papa=require(_0xdedd('0x11'));var Redis=require('ioredis');var authService=require(_0xdedd('0x12'));var qs=require(_0xdedd('0x13'));var as=require(_0xdedd('0x14'));var hardwareService=require(_0xdedd('0x15'));var logger=require('../../config/logger')(_0xdedd('0x16'));var utils=require(_0xdedd('0x17'));var config=require(_0xdedd('0x18'));var licenseUtil=require(_0xdedd('0x19'));var db=require(_0xdedd('0x1a'))['db'];config[_0xdedd('0x1b')]=_[_0xdedd('0x1c')](config[_0xdedd('0x1b')],{'host':_0xdedd('0x1d'),'port':0x18eb});var socket=require(_0xdedd('0x1e'))(new Redis(config[_0xdedd('0x1b')]));require(_0xdedd('0x1f'))[_0xdedd('0x20')](socket);function respondWithStatusCode(_0x27b609,_0x477101){_0x477101=_0x477101||0xcc;return function(_0x298148){if(_0x298148){return _0x27b609[_0xdedd('0x21')](_0x477101);}return _0x27b609[_0xdedd('0x22')](_0x477101)[_0xdedd('0x23')]();};}function respondWithResult(_0x487a8a,_0x3cf7b6){_0x3cf7b6=_0x3cf7b6||0xc8;return function(_0x2beaec){if(_0x2beaec){return _0x487a8a['status'](_0x3cf7b6)[_0xdedd('0x24')](_0x2beaec);}};}function respondWithFilteredResult(_0x114694,_0x3c7ec9){return function(_0x4b16bb){if(_0x4b16bb){var _0x43611b=_0x4b16bb[_0xdedd('0x25')],_0x24e331=_0x3c7ec9['offset'],_0x4054b0=_0x3c7ec9[_0xdedd('0x26')]+_0x3c7ec9[_0xdedd('0x27')],_0x3bf0fc;if(_0x4054b0>=_0x43611b){_0x4054b0=_0x43611b;_0x3bf0fc=0xc8;}else{_0x3bf0fc=0xce;}_0x114694[_0xdedd('0x22')](_0x3bf0fc);return _0x114694[_0xdedd('0x28')](_0xdedd('0x29'),_0x24e331+'-'+_0x4054b0+'/'+_0x43611b)[_0xdedd('0x24')](_0x4b16bb);}return null;};}function patchUpdates(_0x20a655){return function(_0x187487){try{jsonpatch[_0xdedd('0x2a')](_0x187487,_0x20a655,!![]);}catch(_0x5b5855){return BPromise['reject'](_0x5b5855);}return _0x187487['save']();};}function saveUpdates(_0x53b2b2,_0x33b1a7){return function(_0x215e73){if(_0x215e73){return _0x215e73[_0xdedd('0x2b')](_0x53b2b2)[_0xdedd('0x2c')](function(_0x84639d){return _0x84639d;});}return null;};}function removeEntity(_0x4e0483,_0xce1515){return function(_0x2f5e4e){if(_0x2f5e4e){return _0x2f5e4e[_0xdedd('0x2d')]()[_0xdedd('0x2c')](function(){var _0x4e8396=_0x2f5e4e[_0xdedd('0x2e')]({'plain':!![]});var _0x39738a=_0xdedd('0x2f');return db[_0xdedd('0x30')][_0xdedd('0x2d')]({'where':{'type':_0x39738a,'resourceId':_0x4e8396['id']}})[_0xdedd('0x2c')](function(){return _0x2f5e4e;});})[_0xdedd('0x2c')](function(){_0x4e0483[_0xdedd('0x22')](0xcc)[_0xdedd('0x23')]();});}};}function handleEntityNotFound(_0x32d3eb,_0x269ded){return function(_0x10b7d3){if(!_0x10b7d3){_0x32d3eb[_0xdedd('0x21')](0x194);}return _0x10b7d3;};}function handleError(_0xa9b7ea,_0x6e4c22){_0x6e4c22=_0x6e4c22||0x1f4;return function(_0x59015a){logger['error'](_0x59015a['stack']);if(_0x59015a[_0xdedd('0x31')]){delete _0x59015a[_0xdedd('0x31')];}_0xa9b7ea[_0xdedd('0x22')](_0x6e4c22)[_0xdedd('0x32')](_0x59015a);};}exports[_0xdedd('0x33')]=function(_0x228594,_0x228307){var _0x1419b5={},_0x2ddda6={},_0x58fb39={'count':0x0,'rows':[]};var _0x68850e=_[_0xdedd('0x34')](db['FaxQueue']['rawAttributes'],function(_0x5eb164){return{'name':_0x5eb164[_0xdedd('0x35')],'type':_0x5eb164[_0xdedd('0x36')][_0xdedd('0x37')]};});_0x2ddda6[_0xdedd('0x38')]=_[_0xdedd('0x34')](_0x68850e,'name');_0x2ddda6[_0xdedd('0x39')]=_[_0xdedd('0x3a')](_0x228594[_0xdedd('0x39')]);_0x2ddda6[_0xdedd('0x3b')]=_[_0xdedd('0x3c')](_0x2ddda6[_0xdedd('0x38')],_0x2ddda6[_0xdedd('0x39')]);_0x1419b5['attributes']=_['intersection'](_0x2ddda6[_0xdedd('0x38')],qs['fields'](_0x228594[_0xdedd('0x39')][_0xdedd('0x3d')]));_0x1419b5[_0xdedd('0x3e')]=_0x1419b5[_0xdedd('0x3e')]['length']?_0x1419b5['attributes']:_0x2ddda6[_0xdedd('0x38')];if(!_0x228594['query']['hasOwnProperty'](_0xdedd('0x3f'))){_0x1419b5[_0xdedd('0x27')]=qs[_0xdedd('0x27')](_0x228594[_0xdedd('0x39')][_0xdedd('0x27')]);_0x1419b5[_0xdedd('0x26')]=qs[_0xdedd('0x26')](_0x228594['query'][_0xdedd('0x26')]);}_0x1419b5[_0xdedd('0x40')]=qs[_0xdedd('0x41')](_0x228594[_0xdedd('0x39')][_0xdedd('0x41')]);_0x1419b5['where']=qs[_0xdedd('0x3b')](_[_0xdedd('0x42')](_0x228594[_0xdedd('0x39')],_0x2ddda6[_0xdedd('0x3b')]),_0x68850e);if(_0x228594[_0xdedd('0x39')][_0xdedd('0x43')]){_0x1419b5[_0xdedd('0x44')]=_[_0xdedd('0x45')](_0x1419b5[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x68850e,function(_0x40eb06){if(_0x40eb06[_0xdedd('0x36')]!=='VIRTUAL'){var _0x20c30c={};_0x20c30c[_0x40eb06[_0xdedd('0x31')]]={'$like':'%'+_0x228594[_0xdedd('0x39')]['filter']+'%'};return _0x20c30c;}})});}_0x1419b5=_[_0xdedd('0x45')]({},_0x1419b5,_0x228594[_0xdedd('0x46')]);var _0x16de7d={'where':_0x1419b5[_0xdedd('0x44')]};return db[_0xdedd('0x47')]['count'](_0x16de7d)[_0xdedd('0x2c')](function(_0x5e75ec){_0x58fb39[_0xdedd('0x25')]=_0x5e75ec;if(_0x228594[_0xdedd('0x39')][_0xdedd('0x48')]){_0x1419b5[_0xdedd('0x49')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x1419b5);})[_0xdedd('0x2c')](function(_0x509de4){_0x58fb39[_0xdedd('0x4a')]=_0x509de4;return _0x58fb39;})[_0xdedd('0x2c')](respondWithFilteredResult(_0x228307,_0x1419b5))[_0xdedd('0x4b')](handleError(_0x228307,null));};exports[_0xdedd('0x4c')]=function(_0x192973,_0xcd0208){var _0x1a42a5={'raw':!![],'where':{'id':_0x192973['params']['id']}},_0x46336c={};_0x46336c[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db[_0xdedd('0x47')]['rawAttributes']);_0x46336c['query']=_[_0xdedd('0x3a')](_0x192973['query']);_0x46336c[_0xdedd('0x3b')]=_[_0xdedd('0x3c')](_0x46336c[_0xdedd('0x38')],_0x46336c[_0xdedd('0x39')]);_0x1a42a5[_0xdedd('0x3e')]=_[_0xdedd('0x3c')](_0x46336c[_0xdedd('0x38')],qs[_0xdedd('0x3d')](_0x192973[_0xdedd('0x39')][_0xdedd('0x3d')]));_0x1a42a5['attributes']=_0x1a42a5['attributes']['length']?_0x1a42a5[_0xdedd('0x3e')]:_0x46336c[_0xdedd('0x38')];if(_0x192973[_0xdedd('0x39')][_0xdedd('0x48')]){_0x1a42a5[_0xdedd('0x49')]=[{'all':!![]}];}_0x1a42a5=_[_0xdedd('0x45')]({},_0x1a42a5,_0x192973[_0xdedd('0x46')]);return db[_0xdedd('0x47')][_0xdedd('0x4d')](_0x1a42a5)[_0xdedd('0x2c')](handleEntityNotFound(_0xcd0208,null))[_0xdedd('0x2c')](respondWithResult(_0xcd0208,null))[_0xdedd('0x4b')](handleError(_0xcd0208,null));};exports['create']=function(_0x1d0ec6,_0x3a53a3){return db['FaxQueue'][_0xdedd('0x4e')](_0x1d0ec6[_0xdedd('0x4f')],{})[_0xdedd('0x2c')](function(_0x53541a){var _0x5dedcf=_0x1d0ec6[_0xdedd('0x50')][_0xdedd('0x2e')]({'plain':!![]});if(!_0x5dedcf)throw new Error(_0xdedd('0x51'));if(_0x5dedcf['role']===_0xdedd('0x50')){var _0x25dbd8=_0x53541a['get']({'plain':!![]});var _0x139445=_0xdedd('0x2f');return db[_0xdedd('0x52')][_0xdedd('0x4d')]({'where':{'name':_0x139445,'userProfileId':_0x5dedcf[_0xdedd('0x53')]},'raw':!![]})['then'](function(_0x3a0f5d){if(_0x3a0f5d&&_0x3a0f5d[_0xdedd('0x54')]===0x0){return db[_0xdedd('0x30')][_0xdedd('0x4e')]({'name':_0x25dbd8['name'],'resourceId':_0x25dbd8['id'],'type':_0x3a0f5d[_0xdedd('0x31')],'sectionId':_0x3a0f5d['id']},{})[_0xdedd('0x2c')](function(){return _0x53541a;});}else{return _0x53541a;}})['catch'](function(_0xe73e8b){logger[_0xdedd('0x55')](_0xdedd('0x56'),_0xe73e8b);throw _0xe73e8b;});}return _0x53541a;})[_0xdedd('0x2c')](respondWithResult(_0x3a53a3,0xc9))[_0xdedd('0x4b')](handleError(_0x3a53a3,null));};exports[_0xdedd('0x2b')]=function(_0x247bab,_0x264f3f){if(_0x247bab[_0xdedd('0x4f')]['id']){delete _0x247bab['body']['id'];}return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x247bab['params']['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x264f3f,null))[_0xdedd('0x2c')](saveUpdates(_0x247bab[_0xdedd('0x4f')],null))[_0xdedd('0x2c')](respondWithResult(_0x264f3f,null))[_0xdedd('0x4b')](handleError(_0x264f3f,null));};exports['destroy']=function(_0x5075db,_0x357289){return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x5075db[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x357289,null))[_0xdedd('0x2c')](removeEntity(_0x357289,null))['catch'](handleError(_0x357289,null));};exports['describe']=function(_0x3a96bf,_0x5ada74){return db[_0xdedd('0x47')][_0xdedd('0x58')]()[_0xdedd('0x2c')](respondWithResult(_0x5ada74,null))['catch'](handleError(_0x5ada74,null));};exports['getMembers']=function(_0x2b6b6d,_0x16ef8a,_0x59f6b5){var _0x2cb64f={'raw':!![],'where':{}},_0x14199c={},_0x15f095;return db[_0xdedd('0x47')][_0xdedd('0x59')]({'where':{'id':_0x2b6b6d[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x16ef8a,null))[_0xdedd('0x2c')](function(_0x52b1a2){if(_0x52b1a2){_0x15f095=_0x52b1a2[_0xdedd('0x2e')]({'plain':!![]});_0x14199c[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db[_0xdedd('0x5a')][_0xdedd('0x5b')]);_0x14199c['query']=_[_0xdedd('0x3a')](_0x2b6b6d[_0xdedd('0x39')]);_0x14199c['filters']=_[_0xdedd('0x3c')](_0x14199c[_0xdedd('0x38')],_0x14199c[_0xdedd('0x39')]);_0x2cb64f['attributes']=_[_0xdedd('0x3c')](_0x14199c[_0xdedd('0x38')],qs[_0xdedd('0x3d')](_0x2b6b6d[_0xdedd('0x39')]['fields']));_0x2cb64f[_0xdedd('0x3e')]=_0x2cb64f[_0xdedd('0x3e')][_0xdedd('0x5c')]?_0x2cb64f['attributes']:_0x14199c[_0xdedd('0x38')];if(!_0x2b6b6d[_0xdedd('0x39')]['hasOwnProperty']('nolimit')){_0x2cb64f[_0xdedd('0x27')]=qs['limit'](_0x2b6b6d[_0xdedd('0x39')][_0xdedd('0x27')]);_0x2cb64f[_0xdedd('0x26')]=qs[_0xdedd('0x26')](_0x2b6b6d[_0xdedd('0x39')][_0xdedd('0x26')]);}_0x2cb64f[_0xdedd('0x40')]=qs[_0xdedd('0x41')](_0x2b6b6d['query']['sort']);_0x2cb64f[_0xdedd('0x44')]=qs[_0xdedd('0x3b')](_[_0xdedd('0x42')](_0x2b6b6d[_0xdedd('0x39')],_0x14199c[_0xdedd('0x3b')]));_0x2cb64f['where'][_0xdedd('0x5d')]=_0x52b1a2['id'];if(_0x2b6b6d['query'][_0xdedd('0x43')]){_0x2cb64f[_0xdedd('0x44')]=_[_0xdedd('0x45')](_0x2cb64f[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x2cb64f[_0xdedd('0x3e')],function(_0x4da8cb){var _0x2a96de={};_0x2a96de[_0x4da8cb]={'$like':'%'+_0x2b6b6d[_0xdedd('0x39')]['filter']+'%'};return _0x2a96de;})});}_0x2cb64f=_[_0xdedd('0x45')]({},_0x2cb64f,_0x2b6b6d['options']);return db[_0xdedd('0x5a')][_0xdedd('0x5e')](_0x2cb64f);}})[_0xdedd('0x2c')](function(_0x3c80e4){if(_0x3c80e4){return db[_0xdedd('0x5f')][_0xdedd('0x60')]({'where':{'id':_[_0xdedd('0x34')](_0x3c80e4,_0xdedd('0x61')),'role':_0xdedd('0x62')},'attributes':['id',_0xdedd('0x31'),_0xdedd('0x63'),_0xdedd('0x64'),_0xdedd('0x65')]});}})[_0xdedd('0x2c')](function(_0x6e252e){if(_0x6e252e){return{'count':_0x6e252e['count'],'rows':_[_0xdedd('0x34')](_0x6e252e['rows'],function(_0x32baef){return{'membername':_0x32baef[_0xdedd('0x31')],'UserId':_0x32baef['id'],'queue_name':_0x15f095['name'],'FaxQueueId':_0x15f095['id'],'interface':util[_0xdedd('0x66')]('%s/%s',_0xdedd('0x67'),_0x32baef[_0xdedd('0x31')]),'penalty':0x0,'paused':_0x32baef[_0xdedd('0x63')],'createdAt':_0x32baef['createdAt'],'updatedAt':_0x32baef[_0xdedd('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdedd('0x2c')](respondWithFilteredResult(_0x16ef8a,_0x2cb64f))[_0xdedd('0x4b')](handleError(_0x16ef8a,null));};exports[_0xdedd('0x68')]=function(_0x31a94c,_0x312a32,_0x3044a2){var _0x1294b5={};var _0x5778b6={};var _0x4d748d;var _0x4882eb;return db['FaxQueue']['findOne']({'where':{'id':_0x31a94c[_0xdedd('0x57')]['id']}})['then'](handleEntityNotFound(_0x312a32,null))[_0xdedd('0x2c')](function(_0x2ca657){if(_0x2ca657){_0x4d748d=_0x2ca657;_0x5778b6[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db[_0xdedd('0x69')][_0xdedd('0x5b')]);_0x5778b6[_0xdedd('0x39')]=_[_0xdedd('0x3a')](_0x31a94c[_0xdedd('0x39')]);_0x5778b6[_0xdedd('0x3b')]=_[_0xdedd('0x3c')](_0x5778b6['model'],_0x5778b6[_0xdedd('0x39')]);_0x1294b5['attributes']=_[_0xdedd('0x3c')](_0x5778b6[_0xdedd('0x38')],qs['fields'](_0x31a94c[_0xdedd('0x39')][_0xdedd('0x3d')]));_0x1294b5[_0xdedd('0x3e')]=_0x1294b5[_0xdedd('0x3e')][_0xdedd('0x5c')]?_0x1294b5[_0xdedd('0x3e')]:_0x5778b6[_0xdedd('0x38')];_0x1294b5['order']=qs[_0xdedd('0x41')](_0x31a94c['query'][_0xdedd('0x41')]);_0x1294b5[_0xdedd('0x44')]=qs[_0xdedd('0x3b')](_[_0xdedd('0x42')](_0x31a94c[_0xdedd('0x39')],_0x5778b6[_0xdedd('0x3b')]));if(_0x31a94c['query'][_0xdedd('0x43')]){_0x1294b5[_0xdedd('0x44')]=_['merge'](_0x1294b5[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x1294b5[_0xdedd('0x3e')],function(_0x8733c4){var _0x2dd4e8={};_0x2dd4e8[_0x8733c4]={'$like':'%'+_0x31a94c[_0xdedd('0x39')][_0xdedd('0x43')]+'%'};return _0x2dd4e8;})});}_0x1294b5=_[_0xdedd('0x45')]({},_0x1294b5,_0x31a94c['options']);return _0x4d748d[_0xdedd('0x68')](_0x1294b5);}})[_0xdedd('0x2c')](function(_0x33f6ed){if(_0x33f6ed){_0x4882eb=_0x33f6ed[_0xdedd('0x5c')];if(!_0x31a94c[_0xdedd('0x39')][_0xdedd('0x6a')](_0xdedd('0x3f'))){_0x1294b5['limit']=qs[_0xdedd('0x27')](_0x31a94c[_0xdedd('0x39')][_0xdedd('0x27')]);_0x1294b5['offset']=qs['offset'](_0x31a94c[_0xdedd('0x39')][_0xdedd('0x26')]);}return _0x4d748d[_0xdedd('0x68')](_0x1294b5);}})['then'](function(_0x97246){if(_0x97246){return _0x97246?{'count':_0x4882eb,'rows':_0x97246}:null;}})[_0xdedd('0x2c')](respondWithResult(_0x312a32,null))[_0xdedd('0x4b')](handleError(_0x312a32,null));};exports['addTeams']=function(_0x22e961,_0x10e07f,_0x259221){var _0xc293b=_0x22e961['body'][_0xdedd('0x6b')];return db[_0xdedd('0x69')][_0xdedd('0x5e')]({'where':{'id':_0xc293b},'attributes':['id'],'include':[{'model':db[_0xdedd('0x5f')],'as':_0xdedd('0x6c'),'attributes':['id','name',_0xdedd('0x6d'),_0xdedd('0x6e'),'interface'],'raw':!![]}]})[_0xdedd('0x2c')](function(_0x54f2f4){if(_0x54f2f4){var _0x7013a6=_[_0xdedd('0x6f')](_0x54f2f4,function(_0x246c57){var _0x4da4ad=_0x246c57[_0xdedd('0x2e')]({'plain':!![]});return _0x4da4ad['Agents'];});return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x22e961['params']['id']}})[_0xdedd('0x2c')](function(_0x3ea47e){return db[_0xdedd('0x70')][_0xdedd('0x71')](function(_0x52e364){return _0x3ea47e['addTeams'](_0xc293b,{'transaction':_0x52e364})[_0xdedd('0x2c')](function(){return BPromise[_0xdedd('0x72')](_0x7013a6,function(_0x1e1c17){return db[_0xdedd('0x5a')][_0xdedd('0x73')]({'where':{'UserId':_0x1e1c17['id'],'FaxQueueId':_0x22e961[_0xdedd('0x57')]['id']},'transaction':_0x52e364});});})[_0xdedd('0x2c')](function(){_0x7013a6[_0xdedd('0x74')](function(_0x209e54){socket['emit'](_0xdedd('0x75'),{'UserId':_0x209e54['id'],'FaxQueueId':_0x3ea47e['id']});});});});});}})[_0xdedd('0x2c')](respondWithStatusCode(_0x10e07f,null))['catch'](handleError(_0x10e07f,null));};exports[_0xdedd('0x76')]=function(_0x3a403f,_0x18ec85,_0x573d10){return db[_0xdedd('0x69')][_0xdedd('0x5e')]({'where':{'id':_0x3a403f[_0xdedd('0x39')][_0xdedd('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdedd('0x2c')](handleEntityNotFound(_0x18ec85,null))[_0xdedd('0x2c')](function(_0x44355b){var _0x39da24=_['map'](_0x44355b,'id');var _0x3e38b9=[];var _0x5a527c=[];var _0x34bb88=squel[_0xdedd('0x77')]();_0x34bb88['field'](_0xdedd('0x78'))['from'](_0xdedd('0x79'),'tq')[_0xdedd('0x7a')](_0xdedd('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdedd('0x44')]('FaxQueueId\x20=\x20?',_0x3a403f[_0xdedd('0x57')]['id']);for(var _0x3b5bbb=0x0;_0x3b5bbb<_0x44355b[_0xdedd('0x5c')];_0x3b5bbb+=0x1){let _0x16e08e=_0x44355b[_0x3b5bbb];for(var _0x56f6fd=0x0;_0x56f6fd<_0x16e08e[_0xdedd('0x6c')][_0xdedd('0x5c')];_0x56f6fd+=0x1){let _0x1c1bff=_0x16e08e[_0xdedd('0x6c')][_0x56f6fd];var _0x1fd1ed=_0x34bb88[_0xdedd('0x7c')]();_0x1fd1ed['where']('ut.UserId\x20=\x20?',_0x1c1bff['id']);_0x5a527c[_0xdedd('0x7d')](db[_0xdedd('0x70')][_0xdedd('0x39')](_0x1fd1ed[_0xdedd('0x7e')](),{'type':db[_0xdedd('0x70')][_0xdedd('0x7f')]['SELECT']})[_0xdedd('0x2c')](function(_0x37d8d8){if(_0x37d8d8[_0xdedd('0x5c')]===0x1){return _0x1c1bff['id'];}else{var _0x149b47=_[_0xdedd('0x80')](_[_0xdedd('0x34')](_0x37d8d8,_0xdedd('0x81')),function(_0x442da6){return _[_0xdedd('0x82')](_0x39da24,_0x442da6);});if(_0x149b47){return _0x1c1bff['id'];}}}));}}return BPromise[_0xdedd('0x83')](_0x5a527c)[_0xdedd('0x2c')](function(_0x3fe50b){_0x3e38b9=_(_0x3e38b9)['union'](_0x3fe50b)[_0xdedd('0x84')]()[_0xdedd('0x85')]();return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x3a403f[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](function(_0x59ea70){return db[_0xdedd('0x70')][_0xdedd('0x71')](function(_0x156435){return _0x59ea70['removeTeams'](_0x3a403f['query']['ids'],{'transaction':_0x156435})[_0xdedd('0x2c')](function(){if(!_[_0xdedd('0x86')](_0x3e38b9)){return _0x59ea70[_0xdedd('0x87')](_0x3e38b9,{'transaction':_0x156435});}})[_0xdedd('0x2c')](function(){_0x3e38b9[_0xdedd('0x74')](function(_0x4b8d28){socket[_0xdedd('0x88')](_0xdedd('0x89'),{'UserId':_0x4b8d28,'FaxQueueId':_0x59ea70['id']});});});});});});})[_0xdedd('0x2c')](respondWithStatusCode(_0x18ec85,null))[_0xdedd('0x4b')](handleError(_0x18ec85,null));};exports[_0xdedd('0x8a')]=function(_0x29b24f,_0x33a697,_0x3213bc){return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x29b24f[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x33a697,null))[_0xdedd('0x2c')](function(_0x21c201){if(_0x21c201){return _0x21c201[_0xdedd('0x8a')](_0x29b24f[_0xdedd('0x4f')][_0xdedd('0x6b')],_[_0xdedd('0x8b')](_0x29b24f[_0xdedd('0x4f')],['ids','id'])||{})[_0xdedd('0x8c')](function(_0x4b4a02){for(var _0x1821bc=0x0;_0x1821bc<_0x29b24f[_0xdedd('0x4f')]['ids'][_0xdedd('0x5c')];_0x1821bc+=0x1){socket[_0xdedd('0x88')](_0xdedd('0x75'),{'UserId':_0x29b24f['body']['ids'][_0x1821bc],'FaxQueueId':_0x29b24f['params']['id']});}return _0x4b4a02;});}})[_0xdedd('0x2c')](respondWithResult(_0x33a697,null))['catch'](handleError(_0x33a697,null));};exports[_0xdedd('0x87')]=function(_0x118fdd,_0x4fc1f5,_0x5b6022){return db['FaxQueue'][_0xdedd('0x4d')]({'where':{'id':_0x118fdd[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x4fc1f5,null))[_0xdedd('0x2c')](function(_0x145992){if(_0x145992){return _0x145992[_0xdedd('0x87')](_0x118fdd['query'][_0xdedd('0x6b')])[_0xdedd('0x2c')](function(){if(_[_0xdedd('0x8d')](_0x118fdd[_0xdedd('0x39')][_0xdedd('0x6b')])){for(var _0x33f5cf=0x0;_0x33f5cf<_0x118fdd[_0xdedd('0x39')][_0xdedd('0x6b')][_0xdedd('0x5c')];_0x33f5cf+=0x1){socket[_0xdedd('0x88')]('userFaxQueue:remove',{'UserId':Number(_0x118fdd[_0xdedd('0x39')][_0xdedd('0x6b')][_0x33f5cf]),'FaxQueueId':Number(_0x118fdd[_0xdedd('0x57')]['id'])});}}else{socket[_0xdedd('0x88')](_0xdedd('0x89'),{'UserId':Number(_0x118fdd[_0xdedd('0x39')]['ids']),'FaxQueueId':Number(_0x118fdd['params']['id'])});}});}})[_0xdedd('0x2c')](respondWithStatusCode(_0x4fc1f5,null))[_0xdedd('0x4b')](handleError(_0x4fc1f5,null));};exports['getAgents']=function(_0xfa9fa9,_0x5e9430,_0x5b33c6){var _0x42da40={};var _0x4b4e20={};var _0xc3e88a;var _0x1c2823;return db[_0xdedd('0x47')][_0xdedd('0x59')]({'where':{'id':_0xfa9fa9[_0xdedd('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e9430,null))[_0xdedd('0x2c')](function(_0x3fc1ed){if(_0x3fc1ed){_0xc3e88a=_0x3fc1ed;_0x4b4e20[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db['User'][_0xdedd('0x5b')]);_0x4b4e20[_0xdedd('0x39')]=_['keys'](_0xfa9fa9[_0xdedd('0x39')]);_0x4b4e20[_0xdedd('0x3b')]=_['intersection'](_0x4b4e20['model'],_0x4b4e20[_0xdedd('0x39')]);_0x42da40['attributes']=_[_0xdedd('0x3c')](_0x4b4e20['model'],qs[_0xdedd('0x3d')](_0xfa9fa9[_0xdedd('0x39')]['fields']));_0x42da40[_0xdedd('0x3e')]=_0x42da40[_0xdedd('0x3e')]['length']?_0x42da40[_0xdedd('0x3e')]:_0x4b4e20[_0xdedd('0x38')];_0x42da40[_0xdedd('0x40')]=qs[_0xdedd('0x41')](_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x41')]);_0x42da40[_0xdedd('0x44')]=qs['filters'](_['pick'](_0xfa9fa9[_0xdedd('0x39')],_0x4b4e20[_0xdedd('0x3b')]));if(_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x43')]){_0x42da40[_0xdedd('0x44')]=_['merge'](_0x42da40[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x42da40['attributes'],function(_0x3a808d){var _0xecd21d={};_0xecd21d[_0x3a808d]={'$like':'%'+_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x43')]+'%'};return _0xecd21d;})});}_0x42da40=_['merge']({},_0x42da40,_0xfa9fa9[_0xdedd('0x46')]);return _0xc3e88a[_0xdedd('0x8e')](_0x42da40);}})[_0xdedd('0x2c')](function(_0x638b08){if(_0x638b08){_0x1c2823=_0x638b08['length'];if(!_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x6a')](_0xdedd('0x3f'))){_0x42da40[_0xdedd('0x27')]=qs[_0xdedd('0x27')](_0xfa9fa9['query'][_0xdedd('0x27')]);_0x42da40[_0xdedd('0x26')]=qs[_0xdedd('0x26')](_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x26')]);}return _0xc3e88a[_0xdedd('0x8e')](_0x42da40);}})[_0xdedd('0x2c')](function(_0x58db5a){if(_0x58db5a){return _0x58db5a?{'count':_0x1c2823,'rows':_0x58db5a}:null;}})['then'](respondWithResult(_0x5e9430,null))['catch'](handleError(_0x5e9430,null));}; \ No newline at end of file +var _0x702d=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','forEach','emit','addAgents','omit','spread','userFaxQueue:save','removeAgents','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','count','offset','limit','save','update','then','destroy','get','FaxQueues','UserProfileResource','end','sendStatus','error','name','send','map','FaxQueue','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation'];(function(_0x2375f2,_0x4ca4e5){var _0x448a6f=function(_0x3d5ad8){while(--_0x3d5ad8){_0x2375f2['push'](_0x2375f2['shift']());}};_0x448a6f(++_0x4ca4e5);}(_0x702d,0x147));var _0xd702=function(_0x39bd4b,_0x3e4a96){_0x39bd4b=_0x39bd4b-0x0;var _0x472c73=_0x702d[_0x39bd4b];return _0x472c73;};'use strict';var pdf=require(_0xd702('0x0'));var emlformat=require(_0xd702('0x1'));var rimraf=require(_0xd702('0x2'));var zipdir=require(_0xd702('0x3'));var jsonpatch=require(_0xd702('0x4'));var rp=require('request-promise');var moment=require(_0xd702('0x5'));var BPromise=require(_0xd702('0x6'));var Mustache=require(_0xd702('0x7'));var util=require(_0xd702('0x8'));var path=require('path');var sox=require(_0xd702('0x9'));var csv=require('to-csv');var ejs=require(_0xd702('0xa'));var fs=require('fs');var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0xe'));var querystring=require(_0xd702('0xf'));var Papa=require(_0xd702('0x10'));var Redis=require(_0xd702('0x11'));var authService=require(_0xd702('0x12'));var qs=require(_0xd702('0x13'));var as=require(_0xd702('0x14'));var hardwareService=require(_0xd702('0x15'));var logger=require(_0xd702('0x16'))(_0xd702('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd702('0x18'));var db=require(_0xd702('0x19'))['db'];config[_0xd702('0x1a')]=_['defaults'](config[_0xd702('0x1a')],{'host':_0xd702('0x1b'),'port':0x18eb});var socket=require(_0xd702('0x1c'))(new Redis(config[_0xd702('0x1a')]));require(_0xd702('0x1d'))[_0xd702('0x1e')](socket);function respondWithStatusCode(_0x59dd33,_0x2f26b9){_0x2f26b9=_0x2f26b9||0xcc;return function(_0x3ea0ab){if(_0x3ea0ab){return _0x59dd33['sendStatus'](_0x2f26b9);}return _0x59dd33[_0xd702('0x1f')](_0x2f26b9)['end']();};}function respondWithResult(_0x268c66,_0x210c32){_0x210c32=_0x210c32||0xc8;return function(_0x55b93e){if(_0x55b93e){return _0x268c66[_0xd702('0x1f')](_0x210c32)[_0xd702('0x20')](_0x55b93e);}};}function respondWithFilteredResult(_0x2a87f2,_0x4fdbbd){return function(_0x5b3b1d){if(_0x5b3b1d){var _0x2205de=_0x5b3b1d[_0xd702('0x21')],_0x5a296e=_0x4fdbbd[_0xd702('0x22')],_0x3fbcec=_0x4fdbbd[_0xd702('0x22')]+_0x4fdbbd[_0xd702('0x23')],_0x2a871e;if(_0x3fbcec>=_0x2205de){_0x3fbcec=_0x2205de;_0x2a871e=0xc8;}else{_0x2a871e=0xce;}_0x2a87f2[_0xd702('0x1f')](_0x2a871e);return _0x2a87f2['set']('Content-Range',_0x5a296e+'-'+_0x3fbcec+'/'+_0x2205de)['json'](_0x5b3b1d);}return null;};}function patchUpdates(_0x55516e){return function(_0x109284){try{jsonpatch['apply'](_0x109284,_0x55516e,!![]);}catch(_0x211200){return BPromise['reject'](_0x211200);}return _0x109284[_0xd702('0x24')]();};}function saveUpdates(_0x5824ec,_0x5e8d61){return function(_0x51899c){if(_0x51899c){return _0x51899c[_0xd702('0x25')](_0x5824ec)[_0xd702('0x26')](function(_0x459184){return _0x459184;});}return null;};}function removeEntity(_0x49761c,_0x1f0c44){return function(_0x17cd14){if(_0x17cd14){return _0x17cd14[_0xd702('0x27')]()[_0xd702('0x26')](function(){var _0x1200ed=_0x17cd14[_0xd702('0x28')]({'plain':!![]});var _0x94c58d=_0xd702('0x29');return db[_0xd702('0x2a')]['destroy']({'where':{'type':_0x94c58d,'resourceId':_0x1200ed['id']}})[_0xd702('0x26')](function(){return _0x17cd14;});})[_0xd702('0x26')](function(){_0x49761c[_0xd702('0x1f')](0xcc)[_0xd702('0x2b')]();});}};}function handleEntityNotFound(_0xbe4518,_0x38505d){return function(_0x797156){if(!_0x797156){_0xbe4518[_0xd702('0x2c')](0x194);}return _0x797156;};}function handleError(_0x5f1084,_0x47c9a2){_0x47c9a2=_0x47c9a2||0x1f4;return function(_0x1870b7){logger[_0xd702('0x2d')](_0x1870b7['stack']);if(_0x1870b7[_0xd702('0x2e')]){delete _0x1870b7[_0xd702('0x2e')];}_0x5f1084[_0xd702('0x1f')](_0x47c9a2)[_0xd702('0x2f')](_0x1870b7);};}exports['index']=function(_0x213c31,_0x313281){var _0x1630ed={},_0x43fe18={},_0x3baedf={'count':0x0,'rows':[]};var _0x4c7ca2=_[_0xd702('0x30')](db[_0xd702('0x31')][_0xd702('0x32')],function(_0x5abfea){return{'name':_0x5abfea[_0xd702('0x33')],'type':_0x5abfea['type']['key']};});_0x43fe18[_0xd702('0x34')]=_[_0xd702('0x30')](_0x4c7ca2,_0xd702('0x2e'));_0x43fe18['query']=_[_0xd702('0x35')](_0x213c31[_0xd702('0x36')]);_0x43fe18['filters']=_[_0xd702('0x37')](_0x43fe18[_0xd702('0x34')],_0x43fe18[_0xd702('0x36')]);_0x1630ed[_0xd702('0x38')]=_[_0xd702('0x37')](_0x43fe18[_0xd702('0x34')],qs[_0xd702('0x39')](_0x213c31[_0xd702('0x36')][_0xd702('0x39')]));_0x1630ed[_0xd702('0x38')]=_0x1630ed[_0xd702('0x38')][_0xd702('0x3a')]?_0x1630ed[_0xd702('0x38')]:_0x43fe18['model'];if(!_0x213c31[_0xd702('0x36')][_0xd702('0x3b')](_0xd702('0x3c'))){_0x1630ed[_0xd702('0x23')]=qs[_0xd702('0x23')](_0x213c31[_0xd702('0x36')][_0xd702('0x23')]);_0x1630ed['offset']=qs['offset'](_0x213c31[_0xd702('0x36')][_0xd702('0x22')]);}_0x1630ed['order']=qs['sort'](_0x213c31[_0xd702('0x36')][_0xd702('0x3d')]);_0x1630ed['where']=qs[_0xd702('0x3e')](_[_0xd702('0x3f')](_0x213c31[_0xd702('0x36')],_0x43fe18['filters']),_0x4c7ca2);if(_0x213c31[_0xd702('0x36')][_0xd702('0x40')]){_0x1630ed[_0xd702('0x41')]=_['merge'](_0x1630ed[_0xd702('0x41')],{'$or':_['map'](_0x4c7ca2,function(_0x359bbd){if(_0x359bbd[_0xd702('0x42')]!==_0xd702('0x43')){var _0x108822={};_0x108822[_0x359bbd[_0xd702('0x2e')]]={'$like':'%'+_0x213c31[_0xd702('0x36')][_0xd702('0x40')]+'%'};return _0x108822;}})});}_0x1630ed=_[_0xd702('0x44')]({},_0x1630ed,_0x213c31['options']);var _0x3b9d43={'where':_0x1630ed[_0xd702('0x41')]};return db[_0xd702('0x31')][_0xd702('0x21')](_0x3b9d43)[_0xd702('0x26')](function(_0x5ecb10){_0x3baedf[_0xd702('0x21')]=_0x5ecb10;if(_0x213c31[_0xd702('0x36')][_0xd702('0x45')]){_0x1630ed['include']=[{'all':!![]}];}return db[_0xd702('0x31')][_0xd702('0x46')](_0x1630ed);})[_0xd702('0x26')](function(_0x30f2dd){_0x3baedf['rows']=_0x30f2dd;return _0x3baedf;})[_0xd702('0x26')](respondWithFilteredResult(_0x313281,_0x1630ed))[_0xd702('0x47')](handleError(_0x313281,null));};exports[_0xd702('0x48')]=function(_0x3579ea,_0x185e4a){var _0x564974={'raw':!![],'where':{'id':_0x3579ea[_0xd702('0x49')]['id']}},_0x168b59={};_0x168b59['model']=_['keys'](db[_0xd702('0x31')][_0xd702('0x32')]);_0x168b59[_0xd702('0x36')]=_[_0xd702('0x35')](_0x3579ea[_0xd702('0x36')]);_0x168b59[_0xd702('0x3e')]=_[_0xd702('0x37')](_0x168b59[_0xd702('0x34')],_0x168b59[_0xd702('0x36')]);_0x564974['attributes']=_['intersection'](_0x168b59[_0xd702('0x34')],qs['fields'](_0x3579ea[_0xd702('0x36')]['fields']));_0x564974[_0xd702('0x38')]=_0x564974['attributes'][_0xd702('0x3a')]?_0x564974['attributes']:_0x168b59[_0xd702('0x34')];if(_0x3579ea[_0xd702('0x36')]['includeAll']){_0x564974[_0xd702('0x4a')]=[{'all':!![]}];}_0x564974=_[_0xd702('0x44')]({},_0x564974,_0x3579ea[_0xd702('0x4b')]);return db[_0xd702('0x31')][_0xd702('0x4c')](_0x564974)['then'](handleEntityNotFound(_0x185e4a,null))[_0xd702('0x26')](respondWithResult(_0x185e4a,null))[_0xd702('0x47')](handleError(_0x185e4a,null));};exports[_0xd702('0x4d')]=function(_0x59bc33,_0x1082ef){return db['FaxQueue'][_0xd702('0x4d')](_0x59bc33[_0xd702('0x4e')],{})[_0xd702('0x26')](function(_0x55282d){var _0x5a900d=_0x59bc33[_0xd702('0x4f')][_0xd702('0x28')]({'plain':!![]});if(!_0x5a900d)throw new Error(_0xd702('0x50'));if(_0x5a900d[_0xd702('0x51')]===_0xd702('0x4f')){var _0x2274bd=_0x55282d[_0xd702('0x28')]({'plain':!![]});var _0xbd8515=_0xd702('0x29');return db[_0xd702('0x52')]['find']({'where':{'name':_0xbd8515,'userProfileId':_0x5a900d['userProfileId']},'raw':!![]})[_0xd702('0x26')](function(_0x11260a){if(_0x11260a&&_0x11260a[_0xd702('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x2274bd[_0xd702('0x2e')],'resourceId':_0x2274bd['id'],'type':_0x11260a['name'],'sectionId':_0x11260a['id']},{})[_0xd702('0x26')](function(){return _0x55282d;});}else{return _0x55282d;}})[_0xd702('0x47')](function(_0x18ef24){logger[_0xd702('0x2d')](_0xd702('0x54'),_0x18ef24);throw _0x18ef24;});}return _0x55282d;})[_0xd702('0x26')](respondWithResult(_0x1082ef,0xc9))[_0xd702('0x47')](handleError(_0x1082ef,null));};exports[_0xd702('0x25')]=function(_0x3ae4ab,_0x51cc74){if(_0x3ae4ab[_0xd702('0x4e')]['id']){delete _0x3ae4ab[_0xd702('0x4e')]['id'];}return db[_0xd702('0x31')][_0xd702('0x4c')]({'where':{'id':_0x3ae4ab['params']['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x51cc74,null))['then'](saveUpdates(_0x3ae4ab[_0xd702('0x4e')],null))['then'](respondWithResult(_0x51cc74,null))['catch'](handleError(_0x51cc74,null));};exports[_0xd702('0x27')]=function(_0x2351af,_0x158754){return db[_0xd702('0x31')][_0xd702('0x4c')]({'where':{'id':_0x2351af[_0xd702('0x49')]['id']}})['then'](handleEntityNotFound(_0x158754,null))[_0xd702('0x26')](removeEntity(_0x158754,null))[_0xd702('0x47')](handleError(_0x158754,null));};exports['describe']=function(_0x3a6012,_0x316520){return db[_0xd702('0x31')][_0xd702('0x55')]()[_0xd702('0x26')](respondWithResult(_0x316520,null))[_0xd702('0x47')](handleError(_0x316520,null));};exports['getMembers']=function(_0x2186e7,_0x61553b,_0x21b31e){var _0x2e536a={'raw':!![],'where':{}},_0xd35a05={},_0x4ee57b;return db['FaxQueue'][_0xd702('0x56')]({'where':{'id':_0x2186e7['params']['id']}})['then'](handleEntityNotFound(_0x61553b,null))[_0xd702('0x26')](function(_0x48e348){if(_0x48e348){_0x4ee57b=_0x48e348[_0xd702('0x28')]({'plain':!![]});_0xd35a05[_0xd702('0x34')]=_[_0xd702('0x35')](db[_0xd702('0x57')]['rawAttributes']);_0xd35a05[_0xd702('0x36')]=_['keys'](_0x2186e7[_0xd702('0x36')]);_0xd35a05['filters']=_[_0xd702('0x37')](_0xd35a05[_0xd702('0x34')],_0xd35a05[_0xd702('0x36')]);_0x2e536a[_0xd702('0x38')]=_[_0xd702('0x37')](_0xd35a05[_0xd702('0x34')],qs[_0xd702('0x39')](_0x2186e7['query']['fields']));_0x2e536a[_0xd702('0x38')]=_0x2e536a['attributes'][_0xd702('0x3a')]?_0x2e536a[_0xd702('0x38')]:_0xd35a05['model'];if(!_0x2186e7[_0xd702('0x36')][_0xd702('0x3b')]('nolimit')){_0x2e536a[_0xd702('0x23')]=qs['limit'](_0x2186e7[_0xd702('0x36')][_0xd702('0x23')]);_0x2e536a[_0xd702('0x22')]=qs[_0xd702('0x22')](_0x2186e7['query'][_0xd702('0x22')]);}_0x2e536a[_0xd702('0x58')]=qs[_0xd702('0x3d')](_0x2186e7[_0xd702('0x36')][_0xd702('0x3d')]);_0x2e536a['where']=qs[_0xd702('0x3e')](_[_0xd702('0x3f')](_0x2186e7[_0xd702('0x36')],_0xd35a05[_0xd702('0x3e')]));_0x2e536a[_0xd702('0x41')][_0xd702('0x59')]=_0x48e348['id'];if(_0x2186e7['query'][_0xd702('0x40')]){_0x2e536a['where']=_[_0xd702('0x44')](_0x2e536a[_0xd702('0x41')],{'$or':_[_0xd702('0x30')](_0x2e536a[_0xd702('0x38')],function(_0x539294){var _0x3e99ff={};_0x3e99ff[_0x539294]={'$like':'%'+_0x2186e7[_0xd702('0x36')][_0xd702('0x40')]+'%'};return _0x3e99ff;})});}_0x2e536a=_[_0xd702('0x44')]({},_0x2e536a,_0x2186e7[_0xd702('0x4b')]);return db['UserFaxQueue']['findAll'](_0x2e536a);}})[_0xd702('0x26')](function(_0x156de0){if(_0x156de0){return db[_0xd702('0x5a')][_0xd702('0x5b')]({'where':{'id':_[_0xd702('0x30')](_0x156de0,_0xd702('0x5c')),'role':_0xd702('0x5d')},'attributes':['id',_0xd702('0x2e'),_0xd702('0x5e'),_0xd702('0x5f'),_0xd702('0x60')]});}})[_0xd702('0x26')](function(_0x3e8219){if(_0x3e8219){return{'count':_0x3e8219[_0xd702('0x21')],'rows':_[_0xd702('0x30')](_0x3e8219[_0xd702('0x61')],function(_0x51f47b){return{'membername':_0x51f47b[_0xd702('0x2e')],'UserId':_0x51f47b['id'],'queue_name':_0x4ee57b['name'],'FaxQueueId':_0x4ee57b['id'],'interface':util['format'](_0xd702('0x62'),'SIP',_0x51f47b[_0xd702('0x2e')]),'penalty':0x0,'paused':_0x51f47b[_0xd702('0x5e')],'createdAt':_0x51f47b[_0xd702('0x60')],'updatedAt':_0x51f47b[_0xd702('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd702('0x26')](respondWithFilteredResult(_0x61553b,_0x2e536a))[_0xd702('0x47')](handleError(_0x61553b,null));};exports[_0xd702('0x63')]=function(_0x429acf,_0x408f2d,_0x111703){var _0x4644c3={};var _0x180b67={};var _0x2f750d;var _0x1093b6;return db[_0xd702('0x31')][_0xd702('0x56')]({'where':{'id':_0x429acf[_0xd702('0x49')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x408f2d,null))[_0xd702('0x26')](function(_0x5834e8){if(_0x5834e8){_0x2f750d=_0x5834e8;_0x180b67[_0xd702('0x34')]=_[_0xd702('0x35')](db[_0xd702('0x64')][_0xd702('0x32')]);_0x180b67[_0xd702('0x36')]=_['keys'](_0x429acf[_0xd702('0x36')]);_0x180b67[_0xd702('0x3e')]=_['intersection'](_0x180b67[_0xd702('0x34')],_0x180b67[_0xd702('0x36')]);_0x4644c3[_0xd702('0x38')]=_['intersection'](_0x180b67[_0xd702('0x34')],qs[_0xd702('0x39')](_0x429acf['query'][_0xd702('0x39')]));_0x4644c3[_0xd702('0x38')]=_0x4644c3[_0xd702('0x38')][_0xd702('0x3a')]?_0x4644c3[_0xd702('0x38')]:_0x180b67[_0xd702('0x34')];_0x4644c3[_0xd702('0x58')]=qs[_0xd702('0x3d')](_0x429acf[_0xd702('0x36')][_0xd702('0x3d')]);_0x4644c3[_0xd702('0x41')]=qs['filters'](_[_0xd702('0x3f')](_0x429acf[_0xd702('0x36')],_0x180b67['filters']));if(_0x429acf[_0xd702('0x36')][_0xd702('0x40')]){_0x4644c3[_0xd702('0x41')]=_[_0xd702('0x44')](_0x4644c3[_0xd702('0x41')],{'$or':_['map'](_0x4644c3['attributes'],function(_0x239117){var _0x4907d8={};_0x4907d8[_0x239117]={'$like':'%'+_0x429acf[_0xd702('0x36')][_0xd702('0x40')]+'%'};return _0x4907d8;})});}_0x4644c3=_[_0xd702('0x44')]({},_0x4644c3,_0x429acf[_0xd702('0x4b')]);return _0x2f750d[_0xd702('0x63')](_0x4644c3);}})['then'](function(_0x38591b){if(_0x38591b){_0x1093b6=_0x38591b['length'];if(!_0x429acf[_0xd702('0x36')][_0xd702('0x3b')](_0xd702('0x3c'))){_0x4644c3[_0xd702('0x23')]=qs[_0xd702('0x23')](_0x429acf[_0xd702('0x36')]['limit']);_0x4644c3['offset']=qs[_0xd702('0x22')](_0x429acf[_0xd702('0x36')]['offset']);}return _0x2f750d[_0xd702('0x63')](_0x4644c3);}})[_0xd702('0x26')](function(_0x589425){if(_0x589425){return _0x589425?{'count':_0x1093b6,'rows':_0x589425}:null;}})['then'](respondWithResult(_0x408f2d,null))[_0xd702('0x47')](handleError(_0x408f2d,null));};exports[_0xd702('0x65')]=function(_0x303ed9,_0x5e3aef,_0x3b6bfe){var _0x13c970=_0x303ed9[_0xd702('0x4e')][_0xd702('0x66')];return db[_0xd702('0x64')][_0xd702('0x46')]({'where':{'id':_0x13c970},'attributes':['id'],'include':[{'model':db[_0xd702('0x5a')],'as':_0xd702('0x67'),'attributes':['id',_0xd702('0x2e'),_0xd702('0x68'),'voicePause',_0xd702('0x69')],'raw':!![]}]})[_0xd702('0x26')](function(_0xf3cf50){if(_0xf3cf50){var _0x46de96=_['flatMap'](_0xf3cf50,function(_0x3c40d7){var _0x2248fa=_0x3c40d7[_0xd702('0x28')]({'plain':!![]});return _0x2248fa[_0xd702('0x67')];});return db[_0xd702('0x31')]['find']({'where':{'id':_0x303ed9['params']['id']}})['then'](function(_0x296119){return db[_0xd702('0x6a')][_0xd702('0x6b')](function(_0xad73d3){return _0x296119[_0xd702('0x65')](_0x13c970,{'transaction':_0xad73d3})[_0xd702('0x26')](function(){return BPromise[_0xd702('0x6c')](_0x46de96,function(_0x49515a){return db[_0xd702('0x57')][_0xd702('0x6d')]({'where':{'UserId':_0x49515a['id'],'FaxQueueId':_0x303ed9[_0xd702('0x49')]['id']},'transaction':_0xad73d3});});})['then'](function(){_0x46de96['forEach'](function(_0x238f44){socket['emit']('userFaxQueue:save',{'UserId':_0x238f44['id'],'FaxQueueId':_0x296119['id']});});});});});}})[_0xd702('0x26')](respondWithStatusCode(_0x5e3aef,null))['catch'](handleError(_0x5e3aef,null));};exports['removeTeams']=function(_0x584b3b,_0x1641ad,_0x1ebab0){return db['Team'][_0xd702('0x46')]({'where':{'id':_0x584b3b['query'][_0xd702('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd702('0x5a')],'as':_0xd702('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1641ad,null))['then'](function(_0x42c307){var _0x43c8cd=_[_0xd702('0x30')](_0x42c307,'id');var _0x57f934=[];var _0x20b18f=[];var _0x3b9f40=squel['select']();_0x3b9f40['field'](_0xd702('0x6e'))[_0xd702('0x6f')](_0xd702('0x70'),'tq')[_0xd702('0x71')]('user_has_teams','ut',_0xd702('0x72'))[_0xd702('0x41')]('FaxQueueId\x20=\x20?',_0x584b3b[_0xd702('0x49')]['id']);for(var _0x1a4f4c=0x0;_0x1a4f4c<_0x42c307[_0xd702('0x3a')];_0x1a4f4c+=0x1){let _0x5e0b9e=_0x42c307[_0x1a4f4c];for(var _0x53c974=0x0;_0x53c974<_0x5e0b9e[_0xd702('0x67')][_0xd702('0x3a')];_0x53c974+=0x1){let _0x5cf7ca=_0x5e0b9e[_0xd702('0x67')][_0x53c974];var _0x218dc8=_0x3b9f40[_0xd702('0x73')]();_0x218dc8[_0xd702('0x41')](_0xd702('0x74'),_0x5cf7ca['id']);_0x20b18f[_0xd702('0x75')](db['sequelize'][_0xd702('0x36')](_0x218dc8['toString'](),{'type':db['sequelize'][_0xd702('0x76')][_0xd702('0x77')]})['then'](function(_0x2d7de7){if(_0x2d7de7[_0xd702('0x3a')]===0x1){return _0x5cf7ca['id'];}else{var _0x217930=_[_0xd702('0x78')](_[_0xd702('0x30')](_0x2d7de7,_0xd702('0x79')),function(_0x541f10){return _[_0xd702('0x7a')](_0x43c8cd,_0x541f10);});if(_0x217930){return _0x5cf7ca['id'];}}}));}}return BPromise[_0xd702('0x7b')](_0x20b18f)[_0xd702('0x26')](function(_0x404240){_0x57f934=_(_0x57f934)[_0xd702('0x7c')](_0x404240)['compact']()[_0xd702('0x7d')]();return db[_0xd702('0x31')][_0xd702('0x4c')]({'where':{'id':_0x584b3b[_0xd702('0x49')]['id']}})['then'](function(_0x276aab){return db[_0xd702('0x6a')][_0xd702('0x6b')](function(_0x3a47bc){return _0x276aab[_0xd702('0x7e')](_0x584b3b['query'][_0xd702('0x66')],{'transaction':_0x3a47bc})['then'](function(){if(!_[_0xd702('0x7f')](_0x57f934)){return _0x276aab['removeAgents'](_0x57f934,{'transaction':_0x3a47bc});}})[_0xd702('0x26')](function(){_0x57f934[_0xd702('0x80')](function(_0x4777f5){socket[_0xd702('0x81')]('userFaxQueue:remove',{'UserId':_0x4777f5,'FaxQueueId':_0x276aab['id']});});});});});});})[_0xd702('0x26')](respondWithStatusCode(_0x1641ad,null))[_0xd702('0x47')](handleError(_0x1641ad,null));};exports[_0xd702('0x82')]=function(_0x14e5d7,_0x596d21,_0x1d6973){return db[_0xd702('0x31')][_0xd702('0x4c')]({'where':{'id':_0x14e5d7[_0xd702('0x49')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x596d21,null))[_0xd702('0x26')](function(_0x42ebb8){if(_0x42ebb8){return _0x42ebb8[_0xd702('0x82')](_0x14e5d7[_0xd702('0x4e')][_0xd702('0x66')],_[_0xd702('0x83')](_0x14e5d7[_0xd702('0x4e')],['ids','id'])||{})[_0xd702('0x84')](function(_0x19b3b1){for(var _0x398f9c=0x0;_0x398f9c<_0x14e5d7[_0xd702('0x4e')]['ids'][_0xd702('0x3a')];_0x398f9c+=0x1){socket[_0xd702('0x81')](_0xd702('0x85'),{'UserId':_0x14e5d7['body'][_0xd702('0x66')][_0x398f9c],'FaxQueueId':_0x14e5d7[_0xd702('0x49')]['id']});}return _0x19b3b1;});}})[_0xd702('0x26')](respondWithResult(_0x596d21,null))['catch'](handleError(_0x596d21,null));};exports['removeAgents']=function(_0x1e9093,_0x5af6a5,_0x51032c){return db[_0xd702('0x31')][_0xd702('0x4c')]({'where':{'id':_0x1e9093[_0xd702('0x49')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x5af6a5,null))[_0xd702('0x26')](function(_0x395596){if(_0x395596){return _0x395596[_0xd702('0x86')](_0x1e9093[_0xd702('0x36')][_0xd702('0x66')])[_0xd702('0x26')](function(){if(_['isArray'](_0x1e9093[_0xd702('0x36')][_0xd702('0x66')])){for(var _0x40f20f=0x0;_0x40f20f<_0x1e9093['query'][_0xd702('0x66')][_0xd702('0x3a')];_0x40f20f+=0x1){socket[_0xd702('0x81')]('userFaxQueue:remove',{'UserId':Number(_0x1e9093['query']['ids'][_0x40f20f]),'FaxQueueId':Number(_0x1e9093['params']['id'])});}}else{socket[_0xd702('0x81')](_0xd702('0x87'),{'UserId':Number(_0x1e9093[_0xd702('0x36')][_0xd702('0x66')]),'FaxQueueId':Number(_0x1e9093[_0xd702('0x49')]['id'])});}});}})[_0xd702('0x26')](respondWithStatusCode(_0x5af6a5,null))['catch'](handleError(_0x5af6a5,null));};exports[_0xd702('0x88')]=function(_0x370a76,_0x18498d,_0x31c0d){var _0x15c43e={};var _0x882043={};var _0x591791;var _0x47eb1d;return db[_0xd702('0x31')][_0xd702('0x56')]({'where':{'id':_0x370a76[_0xd702('0x49')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x18498d,null))[_0xd702('0x26')](function(_0x2152b7){if(_0x2152b7){_0x591791=_0x2152b7;_0x882043[_0xd702('0x34')]=_['keys'](db[_0xd702('0x5a')][_0xd702('0x32')]);_0x882043['query']=_[_0xd702('0x35')](_0x370a76['query']);_0x882043[_0xd702('0x3e')]=_[_0xd702('0x37')](_0x882043['model'],_0x882043[_0xd702('0x36')]);_0x15c43e[_0xd702('0x38')]=_[_0xd702('0x37')](_0x882043[_0xd702('0x34')],qs[_0xd702('0x39')](_0x370a76[_0xd702('0x36')][_0xd702('0x39')]));_0x15c43e[_0xd702('0x38')]=_0x15c43e[_0xd702('0x38')]['length']?_0x15c43e[_0xd702('0x38')]:_0x882043[_0xd702('0x34')];_0x15c43e['order']=qs['sort'](_0x370a76[_0xd702('0x36')][_0xd702('0x3d')]);_0x15c43e[_0xd702('0x41')]=qs['filters'](_[_0xd702('0x3f')](_0x370a76[_0xd702('0x36')],_0x882043[_0xd702('0x3e')]));if(_0x370a76[_0xd702('0x36')][_0xd702('0x40')]){_0x15c43e[_0xd702('0x41')]=_[_0xd702('0x44')](_0x15c43e[_0xd702('0x41')],{'$or':_[_0xd702('0x30')](_0x15c43e['attributes'],function(_0xffe412){var _0x13ae9a={};_0x13ae9a[_0xffe412]={'$like':'%'+_0x370a76['query']['filter']+'%'};return _0x13ae9a;})});}_0x15c43e=_[_0xd702('0x44')]({},_0x15c43e,_0x370a76[_0xd702('0x4b')]);return _0x591791['getAgents'](_0x15c43e);}})[_0xd702('0x26')](function(_0x4e2107){if(_0x4e2107){_0x47eb1d=_0x4e2107['length'];if(!_0x370a76['query'][_0xd702('0x3b')]('nolimit')){_0x15c43e['limit']=qs[_0xd702('0x23')](_0x370a76['query'][_0xd702('0x23')]);_0x15c43e[_0xd702('0x22')]=qs[_0xd702('0x22')](_0x370a76[_0xd702('0x36')]['offset']);}return _0x591791['getAgents'](_0x15c43e);}})[_0xd702('0x26')](function(_0x417943){if(_0x417943){return _0x417943?{'count':_0x47eb1d,'rows':_0x417943}:null;}})[_0xd702('0x26')](respondWithResult(_0x18498d,null))['catch'](handleError(_0x18498d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 175254e..d824686 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 _0x0cbd=['exports','events','../../mysqldb','FaxQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x54d4b1,_0x51fceb){var _0x1e7cfe=function(_0x51216c){while(--_0x51216c){_0x54d4b1['push'](_0x54d4b1['shift']());}};_0x1e7cfe(++_0x51fceb);}(_0x0cbd,0x1af));var _0xd0cb=function(_0x241572,_0x3b7fe0){_0x241572=_0x241572-0x0;var _0x2e1273=_0x0cbd[_0x241572];return _0x2e1273;};'use strict';var EventEmitter=require(_0xd0cb('0x0'));var FaxQueue=require(_0xd0cb('0x1'))['db'][_0xd0cb('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd0cb('0x3'),'afterUpdate':_0xd0cb('0x4'),'afterDestroy':_0xd0cb('0x5')};function emitEvent(_0x46f552){return function(_0x42cf15,_0x576f9b,_0x2b1338){FaxQueueEvents[_0xd0cb('0x6')](_0x46f552+':'+_0x42cf15['id'],_0x42cf15);FaxQueueEvents['emit'](_0x46f552,_0x42cf15);_0x2b1338(null);};}for(var e in events){if(events[_0xd0cb('0x7')](e)){var event=events[e];FaxQueue[_0xd0cb('0x8')](e,emitEvent(event));}}module[_0xd0cb('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x4dda=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x175a8d,_0x832757){var _0x5b53c4=function(_0x55e232){while(--_0x55e232){_0x175a8d['push'](_0x175a8d['shift']());}};_0x5b53c4(++_0x832757);}(_0x4dda,0xfa));var _0xa4dd=function(_0x21c130,_0x225833){_0x21c130=_0x21c130-0x0;var _0x58f574=_0x4dda[_0x21c130];return _0x58f574;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xa4dd('0x0'))['db'][_0xa4dd('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa4dd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa4dd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x263360){return function(_0x268037,_0x56d843,_0x4f0846){FaxQueueEvents[_0xa4dd('0x4')](_0x263360+':'+_0x268037['id'],_0x268037);FaxQueueEvents['emit'](_0x263360,_0x268037);_0x4f0846(null);};}for(var e in events){if(events[_0xa4dd('0x5')](e)){var event=events[e];FaxQueue[_0xa4dd('0x6')](e,emitEvent(event));}}module[_0xa4dd('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 021fd3e..fd85c1d 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 _0x718a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','FaxQueue','lodash'];(function(_0x1011dd,_0xa51bac){var _0x57e2a8=function(_0x39c2e6){while(--_0x39c2e6){_0x1011dd['push'](_0x1011dd['shift']());}};_0x57e2a8(++_0xa51bac);}(_0x718a,0x149));var _0xa718=function(_0x47fbda,_0x3b52d2){_0x47fbda=_0x47fbda-0x0;var _0x5c1b36=_0x718a[_0x47fbda];return _0x5c1b36;};'use strict';var _=require(_0xa718('0x0'));var util=require('util');var logger=require(_0xa718('0x1'))(_0xa718('0x2'));var moment=require(_0xa718('0x3'));var BPromise=require(_0xa718('0x4'));var rp=require(_0xa718('0x5'));var fs=require('fs');var path=require(_0xa718('0x6'));var rimraf=require(_0xa718('0x7'));var config=require(_0xa718('0x8'));var attributes=require(_0xa718('0x9'));module['exports']=function(_0x53fb4a,_0x3ef119){return _0x53fb4a['define'](_0xa718('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7933=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x7933,0x106));var _0x3793=function(_0x40cd41,_0x5b5354){_0x40cd41=_0x40cd41-0x0;var _0x45cdde=_0x7933[_0x40cd41];return _0x45cdde;};'use strict';var _=require(_0x3793('0x0'));var util=require(_0x3793('0x1'));var logger=require(_0x3793('0x2'))(_0x3793('0x3'));var moment=require('moment');var BPromise=require(_0x3793('0x4'));var rp=require(_0x3793('0x5'));var fs=require('fs');var path=require(_0x3793('0x6'));var rimraf=require(_0x3793('0x7'));var config=require(_0x3793('0x8'));var attributes=require(_0x3793('0x9'));module[_0x3793('0xa')]=function(_0x5b5e8b,_0x4a1f47){return _0x5b5e8b[_0x3793('0xb')](_0x3793('0xc'),attributes,{'tableName':_0x3793('0xd'),'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 2f365ab..ff87cc6 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 _0x139a=['map','model','then','GetFaxQueue','ShowFaxQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','include'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x139a,0x1b3));var _0xa139=function(_0x466a1e,_0x32729c){_0x466a1e=_0x466a1e-0x0;var _0x3f4654=_0x139a[_0x466a1e];return _0x3f4654;};'use strict';var _=require(_0xa139('0x0'));var util=require('util');var moment=require(_0xa139('0x1'));var BPromise=require('bluebird');var rs=require(_0xa139('0x2'));var fs=require('fs');var Redis=require(_0xa139('0x3'));var db=require(_0xa139('0x4'))['db'];var utils=require(_0xa139('0x5'));var logger=require('../../config/logger')(_0xa139('0x6'));var config=require(_0xa139('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa139('0x8')]['http']({'port':0x232a});config[_0xa139('0x9')]=_[_0xa139('0xa')](config[_0xa139('0x9')],{'host':_0xa139('0xb'),'port':0x18eb});var socket=require(_0xa139('0xc'))(new Redis(config[_0xa139('0x9')]));require(_0xa139('0xd'))[_0xa139('0xe')](socket);function respondWithRpcPromise(_0x181261,_0x50ea1d,_0x50fd89){return new BPromise(function(_0x53fdc,_0x47d20b){return client[_0xa139('0xf')](_0x181261,_0x50fd89)['then'](function(_0x520c96){logger[_0xa139('0x10')](_0xa139('0x11'),_0x50ea1d,_0xa139('0x12'));logger[_0xa139('0x13')](_0xa139('0x14'),_0x50ea1d,'request\x20sent',JSON[_0xa139('0x15')](_0x520c96));if(_0x520c96[_0xa139('0x16')]){if(_0x520c96[_0xa139('0x16')]['code']===0x1f4){logger[_0xa139('0x16')](_0xa139('0x11'),_0x50ea1d,_0x520c96[_0xa139('0x16')][_0xa139('0x17')]);return _0x47d20b(_0x520c96[_0xa139('0x16')][_0xa139('0x17')]);}logger['error'](_0xa139('0x11'),_0x50ea1d,_0x520c96[_0xa139('0x16')]['message']);return _0x53fdc(_0x520c96[_0xa139('0x16')]['message']);}else{logger['info'](_0xa139('0x11'),_0x50ea1d,'request\x20sent');_0x53fdc(_0x520c96[_0xa139('0x18')][_0xa139('0x17')]);}})[_0xa139('0x19')](function(_0x4ff489){logger['error']('FaxQueue,\x20%s,\x20%s',_0x50ea1d,_0x4ff489);_0x47d20b(_0x4ff489);});});}exports['GetFaxQueue']=function(_0x148a5b){var _0x50057f=this;return new Promise(function(_0x3cd57b,_0x165478){return db[_0xa139('0x1a')][_0xa139('0x1b')]({'raw':_0x148a5b[_0xa139('0x1c')]?_0x148a5b[_0xa139('0x1c')][_0xa139('0x1d')]===undefined?!![]:![]:!![],'where':_0x148a5b[_0xa139('0x1c')]?_0x148a5b[_0xa139('0x1c')][_0xa139('0x1e')]||null:null,'attributes':_0x148a5b[_0xa139('0x1c')]?_0x148a5b['options'][_0xa139('0x1f')]||null:null,'limit':_0x148a5b['options']?_0x148a5b[_0xa139('0x1c')]['limit']||null:null,'include':_0x148a5b[_0xa139('0x1c')]?_0x148a5b[_0xa139('0x1c')][_0xa139('0x20')]?_[_0xa139('0x21')](_0x148a5b[_0xa139('0x1c')][_0xa139('0x20')],function(_0x38cfe4){return{'model':db[_0x38cfe4[_0xa139('0x22')]],'as':_0x38cfe4['as'],'attributes':_0x38cfe4[_0xa139('0x1f')],'include':_0x38cfe4[_0xa139('0x20')]?_[_0xa139('0x21')](_0x38cfe4[_0xa139('0x20')],function(_0x3888e1){return{'model':db[_0x3888e1['model']],'as':_0x3888e1['as'],'attributes':_0x3888e1[_0xa139('0x1f')],'include':_0x3888e1[_0xa139('0x20')]?_['map'](_0x3888e1['include'],function(_0x221efe){return{'model':db[_0x221efe[_0xa139('0x22')]],'as':_0x221efe['as'],'attributes':_0x221efe[_0xa139('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa139('0x23')](function(_0x12a249){logger[_0xa139('0x10')](_0xa139('0x24'),_0x148a5b);logger[_0xa139('0x13')](_0xa139('0x24'),_0x148a5b,JSON[_0xa139('0x15')](_0x12a249));_0x3cd57b(_0x12a249);})['catch'](function(_0x1dbb34){logger[_0xa139('0x16')](_0xa139('0x24'),_0x1dbb34[_0xa139('0x17')],_0x148a5b);_0x165478(_0x50057f[_0xa139('0x16')](0x1f4,_0x1dbb34[_0xa139('0x17')]));});});};exports[_0xa139('0x25')]=function(_0x17f2e2){var _0x3d8ad0=this;return new Promise(function(_0x55829a,_0x8de622){return db['FaxQueue'][_0xa139('0x26')]({'raw':_0x17f2e2[_0xa139('0x1c')]?_0x17f2e2[_0xa139('0x1c')][_0xa139('0x1d')]===undefined?!![]:![]:!![],'where':_0x17f2e2[_0xa139('0x1c')]?_0x17f2e2[_0xa139('0x1c')][_0xa139('0x1e')]||null:null,'attributes':_0x17f2e2['options']?_0x17f2e2['options'][_0xa139('0x1f')]||null:null,'include':_0x17f2e2[_0xa139('0x1c')]?_0x17f2e2[_0xa139('0x1c')][_0xa139('0x20')]?_[_0xa139('0x21')](_0x17f2e2[_0xa139('0x1c')][_0xa139('0x20')],function(_0x1505ab){return{'model':db[_0x1505ab[_0xa139('0x22')]],'as':_0x1505ab['as'],'attributes':_0x1505ab[_0xa139('0x1f')],'include':_0x1505ab['include']?_[_0xa139('0x21')](_0x1505ab[_0xa139('0x20')],function(_0x5c397e){return{'model':db[_0x5c397e[_0xa139('0x22')]],'as':_0x5c397e['as'],'attributes':_0x5c397e[_0xa139('0x1f')],'include':_0x5c397e[_0xa139('0x20')]?_['map'](_0x5c397e[_0xa139('0x20')],function(_0x1855e0){return{'model':db[_0x1855e0['model']],'as':_0x1855e0['as'],'attributes':_0x1855e0[_0xa139('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa139('0x23')](function(_0x3082e4){logger[_0xa139('0x10')](_0xa139('0x25'),_0x17f2e2);logger[_0xa139('0x13')](_0xa139('0x25'),_0x17f2e2,JSON['stringify'](_0x3082e4));_0x55829a(_0x3082e4);})[_0xa139('0x19')](function(_0x3aee1){logger[_0xa139('0x16')](_0xa139('0x25'),_0x3aee1[_0xa139('0x17')],_0x17f2e2);_0x8de622(_0x3d8ad0[_0xa139('0x16')](0x1f4,_0x3aee1[_0xa139('0x17')]));});});}; \ No newline at end of file +var _0x63ba=['message','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','debug','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x44770b,_0x292817){var _0x156812=function(_0x10a8d3){while(--_0x10a8d3){_0x44770b['push'](_0x44770b['shift']());}};_0x156812(++_0x292817);}(_0x63ba,0xff));var _0xa63b=function(_0x5eb550,_0x17a0aa){_0x5eb550=_0x5eb550-0x0;var _0x42b74a=_0x63ba[_0x5eb550];return _0x42b74a;};'use strict';var _=require(_0xa63b('0x0'));var util=require(_0xa63b('0x1'));var moment=require(_0xa63b('0x2'));var BPromise=require(_0xa63b('0x3'));var rs=require(_0xa63b('0x4'));var fs=require('fs');var Redis=require(_0xa63b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa63b('0x6'));var logger=require(_0xa63b('0x7'))(_0xa63b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa63b('0x9')][_0xa63b('0xa')]({'port':0x232a});config[_0xa63b('0xb')]=_[_0xa63b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa63b('0xd'))(new Redis(config['redis']));require(_0xa63b('0xe'))[_0xa63b('0xf')](socket);function respondWithRpcPromise(_0x32a7ee,_0x58458b,_0x2dd64c){return new BPromise(function(_0x37435c,_0x51d426){return client[_0xa63b('0x10')](_0x32a7ee,_0x2dd64c)[_0xa63b('0x11')](function(_0x6152f7){logger[_0xa63b('0x12')](_0xa63b('0x13'),_0x58458b,'request\x20sent');logger['debug'](_0xa63b('0x14'),_0x58458b,_0xa63b('0x15'),JSON[_0xa63b('0x16')](_0x6152f7));if(_0x6152f7[_0xa63b('0x17')]){if(_0x6152f7[_0xa63b('0x17')][_0xa63b('0x18')]===0x1f4){logger[_0xa63b('0x17')](_0xa63b('0x13'),_0x58458b,_0x6152f7['error'][_0xa63b('0x19')]);return _0x51d426(_0x6152f7[_0xa63b('0x17')][_0xa63b('0x19')]);}logger[_0xa63b('0x17')](_0xa63b('0x13'),_0x58458b,_0x6152f7[_0xa63b('0x17')]['message']);return _0x37435c(_0x6152f7[_0xa63b('0x17')][_0xa63b('0x19')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x58458b,_0xa63b('0x15'));_0x37435c(_0x6152f7['result']['message']);}})[_0xa63b('0x1a')](function(_0x31affd){logger[_0xa63b('0x17')](_0xa63b('0x13'),_0x58458b,_0x31affd);_0x51d426(_0x31affd);});});}exports['GetFaxQueue']=function(_0x4c006b){var _0x5f204b=this;return new Promise(function(_0x347aef,_0xdddfa2){return db[_0xa63b('0x1b')][_0xa63b('0x1c')]({'raw':_0x4c006b['options']?_0x4c006b[_0xa63b('0x1d')][_0xa63b('0x1e')]===undefined?!![]:![]:!![],'where':_0x4c006b[_0xa63b('0x1d')]?_0x4c006b[_0xa63b('0x1d')][_0xa63b('0x1f')]||null:null,'attributes':_0x4c006b[_0xa63b('0x1d')]?_0x4c006b[_0xa63b('0x1d')][_0xa63b('0x20')]||null:null,'limit':_0x4c006b[_0xa63b('0x1d')]?_0x4c006b[_0xa63b('0x1d')]['limit']||null:null,'include':_0x4c006b[_0xa63b('0x1d')]?_0x4c006b[_0xa63b('0x1d')][_0xa63b('0x21')]?_[_0xa63b('0x22')](_0x4c006b[_0xa63b('0x1d')]['include'],function(_0x5e3b69){return{'model':db[_0x5e3b69['model']],'as':_0x5e3b69['as'],'attributes':_0x5e3b69[_0xa63b('0x20')],'include':_0x5e3b69[_0xa63b('0x21')]?_[_0xa63b('0x22')](_0x5e3b69[_0xa63b('0x21')],function(_0x2f93c6){return{'model':db[_0x2f93c6['model']],'as':_0x2f93c6['as'],'attributes':_0x2f93c6[_0xa63b('0x20')],'include':_0x2f93c6[_0xa63b('0x21')]?_['map'](_0x2f93c6['include'],function(_0x283650){return{'model':db[_0x283650[_0xa63b('0x23')]],'as':_0x283650['as'],'attributes':_0x283650[_0xa63b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x568eef){logger[_0xa63b('0x12')]('GetFaxQueue',_0x4c006b);logger[_0xa63b('0x24')](_0xa63b('0x25'),_0x4c006b,JSON[_0xa63b('0x16')](_0x568eef));_0x347aef(_0x568eef);})['catch'](function(_0x48e8c4){logger[_0xa63b('0x17')](_0xa63b('0x25'),_0x48e8c4[_0xa63b('0x19')],_0x4c006b);_0xdddfa2(_0x5f204b[_0xa63b('0x17')](0x1f4,_0x48e8c4[_0xa63b('0x19')]));});});};exports[_0xa63b('0x26')]=function(_0x49f518){var _0x58bf6e=this;return new Promise(function(_0x258441,_0x4fcd9c){return db['FaxQueue'][_0xa63b('0x27')]({'raw':_0x49f518[_0xa63b('0x1d')]?_0x49f518[_0xa63b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x49f518[_0xa63b('0x1d')]?_0x49f518[_0xa63b('0x1d')][_0xa63b('0x1f')]||null:null,'attributes':_0x49f518[_0xa63b('0x1d')]?_0x49f518[_0xa63b('0x1d')]['attributes']||null:null,'include':_0x49f518[_0xa63b('0x1d')]?_0x49f518['options'][_0xa63b('0x21')]?_[_0xa63b('0x22')](_0x49f518[_0xa63b('0x1d')][_0xa63b('0x21')],function(_0x3917fb){return{'model':db[_0x3917fb[_0xa63b('0x23')]],'as':_0x3917fb['as'],'attributes':_0x3917fb[_0xa63b('0x20')],'include':_0x3917fb[_0xa63b('0x21')]?_[_0xa63b('0x22')](_0x3917fb[_0xa63b('0x21')],function(_0x5c2a4b){return{'model':db[_0x5c2a4b[_0xa63b('0x23')]],'as':_0x5c2a4b['as'],'attributes':_0x5c2a4b[_0xa63b('0x20')],'include':_0x5c2a4b[_0xa63b('0x21')]?_[_0xa63b('0x22')](_0x5c2a4b[_0xa63b('0x21')],function(_0x3c9c9b){return{'model':db[_0x3c9c9b[_0xa63b('0x23')]],'as':_0x3c9c9b['as'],'attributes':_0x3c9c9b[_0xa63b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa63b('0x11')](function(_0x5f4e98){logger[_0xa63b('0x12')](_0xa63b('0x26'),_0x49f518);logger[_0xa63b('0x24')]('ShowFaxQueue',_0x49f518,JSON['stringify'](_0x5f4e98));_0x258441(_0x5f4e98);})[_0xa63b('0x1a')](function(_0x5c31a7){logger[_0xa63b('0x17')](_0xa63b('0x26'),_0x5c31a7[_0xa63b('0x19')],_0x49f518);_0x4fcd9c(_0x58bf6e[_0xa63b('0x17')](0x1f4,_0x5c31a7[_0xa63b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index bde6101..31ebdfd 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 _0xc1cf=['register','faxQueue:','save','removeListener'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc1cf,0x12e));var _0xfc1c=function(_0x36cce1,_0x5f1623){_0x36cce1=_0x36cce1-0x0;var _0x458308=_0xc1cf[_0x36cce1];return _0x458308;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xfc1c('0x0'),'remove','update'];function createListener(_0x1f0b4a,_0x98c287){return function(_0x48f988){_0x98c287['emit'](_0x1f0b4a,_0x48f988);};}function removeListener(_0x1c2466,_0x511453){return function(){FaxQueueEvents[_0xfc1c('0x1')](_0x1c2466,_0x511453);};}exports[_0xfc1c('0x2')]=function(_0x23b8e9){for(var _0x4a5a37=0x0,_0x2b8cd2=events['length'];_0x4a5a37<_0x2b8cd2;_0x4a5a37++){var _0x1f286f=events[_0x4a5a37];var _0x1a49d7=createListener(_0xfc1c('0x3')+_0x1f286f,_0x23b8e9);FaxQueueEvents['on'](_0x1f286f,_0x1a49d7);}}; \ No newline at end of file +var _0xea6c=['length','faxQueue:','save','removeListener','register'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xea6c,0x106));var _0xcea6=function(_0x47aef8,_0x1acbea){_0x47aef8=_0x47aef8-0x0;var _0x43d389=_0xea6c[_0x47aef8];return _0x43d389;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xcea6('0x0'),'remove','update'];function createListener(_0x751fb5,_0x5251f7){return function(_0x246ead){_0x5251f7['emit'](_0x751fb5,_0x246ead);};}function removeListener(_0x7cd23d,_0x1a3fac){return function(){FaxQueueEvents[_0xcea6('0x1')](_0x7cd23d,_0x1a3fac);};}exports[_0xcea6('0x2')]=function(_0x224213){for(var _0x156920=0x0,_0xa21703=events[_0xcea6('0x3')];_0x156920<_0xa21703;_0x156920++){var _0x17d88e=events[_0x156920];var _0x12af67=createListener(_0xcea6('0x4')+_0x17d88e,_0x224213);FaxQueueEvents['on'](_0x17d88e,_0x12af67);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 85202d5..ba78ffc 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x25c797,_0x3eef5d){var _0x1f1ed3=function(_0x35213c){while(--_0x35213c){_0x25c797['push'](_0x25c797['shift']());}};_0x1f1ed3(++_0x3eef5d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x0b0e,0x187));var _0xe0b0=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x0b0e[_0x19ef2b];return _0x4df537;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);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 b1232ac..463e595 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 _0xcd80=['DATE','moment','sequelize','exports','STRING'];(function(_0x3841a5,_0x53a0f7){var _0x27747f=function(_0x46dba1){while(--_0x46dba1){_0x3841a5['push'](_0x3841a5['shift']());}};_0x27747f(++_0x53a0f7);}(_0xcd80,0x100));var _0x0cd8=function(_0x3dc55d,_0xd07e93){_0x3dc55d=_0x3dc55d-0x0;var _0x3aa7f3=_0xcd80[_0x3dc55d];return _0x3aa7f3;};'use strict';var moment=require(_0x0cd8('0x0'));var Sequelize=require(_0x0cd8('0x1'));module[_0x0cd8('0x2')]={'uniqueid':{'type':Sequelize[_0x0cd8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0cd8('0x3')]},'joinAt':{'type':Sequelize[_0x0cd8('0x4')]},'leaveAt':{'type':Sequelize[_0x0cd8('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0cd8('0x4')]},'reason':{'type':Sequelize[_0x0cd8('0x3')]}}; \ No newline at end of file +var _0x76c4=['STRING','DATE','moment','sequelize','exports'];(function(_0x578b4a,_0x11f7ad){var _0x1609a4=function(_0xa37496){while(--_0xa37496){_0x578b4a['push'](_0x578b4a['shift']());}};_0x1609a4(++_0x11f7ad);}(_0x76c4,0x1d3));var _0x476c=function(_0x58641e,_0x21e3f0){_0x58641e=_0x58641e-0x0;var _0x3394e7=_0x76c4[_0x58641e];return _0x3394e7;};'use strict';var moment=require(_0x476c('0x0'));var Sequelize=require(_0x476c('0x1'));module[_0x476c('0x2')]={'uniqueid':{'type':Sequelize[_0x476c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x476c('0x3')]},'joinAt':{'type':Sequelize[_0x476c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x476c('0x4')]},'exitAt':{'type':Sequelize[_0x476c('0x4')]},'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 866efed..dcf2e2b 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 _0xa373=['stack','send','index','map','FaxQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','name','options','count','include','rows','catch','params','includeAll','find','create','update','body','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','error'];(function(_0x59957c,_0x2d7873){var _0x2617fb=function(_0x45bfb6){while(--_0x45bfb6){_0x59957c['push'](_0x59957c['shift']());}};_0x2617fb(++_0x2d7873);}(_0xa373,0x145));var _0x3a37=function(_0x1824e6,_0x28c755){_0x1824e6=_0x1824e6-0x0;var _0xa21c7e=_0xa373[_0x1824e6];return _0xa21c7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3a37('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a37('0x1'));var rp=require('request-promise');var moment=require(_0x3a37('0x2'));var BPromise=require(_0x3a37('0x3'));var Mustache=require(_0x3a37('0x4'));var util=require(_0x3a37('0x5'));var path=require(_0x3a37('0x6'));var sox=require(_0x3a37('0x7'));var csv=require(_0x3a37('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a37('0x9'));var squel=require(_0x3a37('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3a37('0xb'));var toCsv=require(_0x3a37('0x8'));var querystring=require(_0x3a37('0xc'));var Papa=require(_0x3a37('0xd'));var Redis=require('ioredis');var authService=require(_0x3a37('0xe'));var qs=require(_0x3a37('0xf'));var as=require(_0x3a37('0x10'));var hardwareService=require(_0x3a37('0x11'));var logger=require(_0x3a37('0x12'))(_0x3a37('0x13'));var utils=require(_0x3a37('0x14'));var config=require(_0x3a37('0x15'));var licenseUtil=require(_0x3a37('0x16'));var db=require(_0x3a37('0x17'))['db'];function respondWithStatusCode(_0x2c76bc,_0x29cf29){_0x29cf29=_0x29cf29||0xcc;return function(_0x366d1f){if(_0x366d1f){return _0x2c76bc[_0x3a37('0x18')](_0x29cf29);}return _0x2c76bc[_0x3a37('0x19')](_0x29cf29)[_0x3a37('0x1a')]();};}function respondWithResult(_0x5c9af4,_0x32176f){_0x32176f=_0x32176f||0xc8;return function(_0x3f196e){if(_0x3f196e){return _0x5c9af4[_0x3a37('0x19')](_0x32176f)[_0x3a37('0x1b')](_0x3f196e);}};}function respondWithFilteredResult(_0x227ab3,_0x5aeb75){return function(_0x193005){if(_0x193005){var _0x59dd82=_0x193005['count'],_0x1be19b=_0x5aeb75['offset'],_0x49a813=_0x5aeb75[_0x3a37('0x1c')]+_0x5aeb75[_0x3a37('0x1d')],_0xa98b0e;if(_0x49a813>=_0x59dd82){_0x49a813=_0x59dd82;_0xa98b0e=0xc8;}else{_0xa98b0e=0xce;}_0x227ab3[_0x3a37('0x19')](_0xa98b0e);return _0x227ab3[_0x3a37('0x1e')](_0x3a37('0x1f'),_0x1be19b+'-'+_0x49a813+'/'+_0x59dd82)[_0x3a37('0x1b')](_0x193005);}return null;};}function patchUpdates(_0x2cd70b){return function(_0x119eda){try{jsonpatch[_0x3a37('0x20')](_0x119eda,_0x2cd70b,!![]);}catch(_0x45e142){return BPromise['reject'](_0x45e142);}return _0x119eda['save']();};}function saveUpdates(_0x214a24,_0x499a7a){return function(_0x118840){if(_0x118840){return _0x118840['update'](_0x214a24)[_0x3a37('0x21')](function(_0x19777b){return _0x19777b;});}return null;};}function removeEntity(_0x4c86f7,_0x44a3b4){return function(_0x42f034){if(_0x42f034){return _0x42f034['destroy']()['then'](function(){_0x4c86f7[_0x3a37('0x19')](0xcc)[_0x3a37('0x1a')]();});}};}function handleEntityNotFound(_0x43dd43,_0x344ee8){return function(_0x575eed){if(!_0x575eed){_0x43dd43[_0x3a37('0x18')](0x194);}return _0x575eed;};}function handleError(_0x2f1599,_0x30df5b){_0x30df5b=_0x30df5b||0x1f4;return function(_0x4d7e8f){logger[_0x3a37('0x22')](_0x4d7e8f[_0x3a37('0x23')]);if(_0x4d7e8f['name']){delete _0x4d7e8f['name'];}_0x2f1599['status'](_0x30df5b)[_0x3a37('0x24')](_0x4d7e8f);};}exports[_0x3a37('0x25')]=function(_0x5aa64c,_0x201395){var _0x1224da={},_0x43d0ab={},_0xa0c164={'count':0x0,'rows':[]};var _0x3e1c5c=_[_0x3a37('0x26')](db[_0x3a37('0x27')][_0x3a37('0x28')],function(_0x1bf1af){return{'name':_0x1bf1af[_0x3a37('0x29')],'type':_0x1bf1af['type']['key']};});_0x43d0ab[_0x3a37('0x2a')]=_[_0x3a37('0x26')](_0x3e1c5c,'name');_0x43d0ab[_0x3a37('0x2b')]=_[_0x3a37('0x2c')](_0x5aa64c[_0x3a37('0x2b')]);_0x43d0ab[_0x3a37('0x2d')]=_[_0x3a37('0x2e')](_0x43d0ab[_0x3a37('0x2a')],_0x43d0ab['query']);_0x1224da[_0x3a37('0x2f')]=_[_0x3a37('0x2e')](_0x43d0ab['model'],qs[_0x3a37('0x30')](_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x30')]));_0x1224da['attributes']=_0x1224da[_0x3a37('0x2f')][_0x3a37('0x31')]?_0x1224da[_0x3a37('0x2f')]:_0x43d0ab[_0x3a37('0x2a')];if(!_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x32')]('nolimit')){_0x1224da[_0x3a37('0x1d')]=qs[_0x3a37('0x1d')](_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x1d')]);_0x1224da[_0x3a37('0x1c')]=qs['offset'](_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x1c')]);}_0x1224da['order']=qs[_0x3a37('0x33')](_0x5aa64c['query']['sort']);_0x1224da[_0x3a37('0x34')]=qs[_0x3a37('0x2d')](_[_0x3a37('0x35')](_0x5aa64c['query'],_0x43d0ab['filters']),_0x3e1c5c);if(_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x36')]){_0x1224da['where']=_[_0x3a37('0x37')](_0x1224da[_0x3a37('0x34')],{'$or':_[_0x3a37('0x26')](_0x3e1c5c,function(_0x2cc186){if(_0x2cc186[_0x3a37('0x38')]!==_0x3a37('0x39')){var _0x502876={};_0x502876[_0x2cc186[_0x3a37('0x3a')]]={'$like':'%'+_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x36')]+'%'};return _0x502876;}})});}_0x1224da=_['merge']({},_0x1224da,_0x5aa64c[_0x3a37('0x3b')]);var _0x973be0={'where':_0x1224da[_0x3a37('0x34')]};return db['FaxQueueReport'][_0x3a37('0x3c')](_0x973be0)['then'](function(_0x52a0be){_0xa0c164[_0x3a37('0x3c')]=_0x52a0be;if(_0x5aa64c[_0x3a37('0x2b')]['includeAll']){_0x1224da[_0x3a37('0x3d')]=[{'all':!![]}];}return db[_0x3a37('0x27')]['findAll'](_0x1224da);})['then'](function(_0x20fc57){_0xa0c164[_0x3a37('0x3e')]=_0x20fc57;return _0xa0c164;})['then'](respondWithFilteredResult(_0x201395,_0x1224da))[_0x3a37('0x3f')](handleError(_0x201395,null));};exports['show']=function(_0x19ea94,_0x1547fa){var _0x48d4ba={'raw':!![],'where':{'id':_0x19ea94[_0x3a37('0x40')]['id']}},_0xefd5d8={};_0xefd5d8[_0x3a37('0x2a')]=_[_0x3a37('0x2c')](db[_0x3a37('0x27')][_0x3a37('0x28')]);_0xefd5d8[_0x3a37('0x2b')]=_[_0x3a37('0x2c')](_0x19ea94[_0x3a37('0x2b')]);_0xefd5d8[_0x3a37('0x2d')]=_[_0x3a37('0x2e')](_0xefd5d8[_0x3a37('0x2a')],_0xefd5d8[_0x3a37('0x2b')]);_0x48d4ba['attributes']=_[_0x3a37('0x2e')](_0xefd5d8['model'],qs[_0x3a37('0x30')](_0x19ea94[_0x3a37('0x2b')][_0x3a37('0x30')]));_0x48d4ba[_0x3a37('0x2f')]=_0x48d4ba[_0x3a37('0x2f')]['length']?_0x48d4ba[_0x3a37('0x2f')]:_0xefd5d8[_0x3a37('0x2a')];if(_0x19ea94['query'][_0x3a37('0x41')]){_0x48d4ba[_0x3a37('0x3d')]=[{'all':!![]}];}_0x48d4ba=_[_0x3a37('0x37')]({},_0x48d4ba,_0x19ea94['options']);return db[_0x3a37('0x27')][_0x3a37('0x42')](_0x48d4ba)['then'](handleEntityNotFound(_0x1547fa,null))[_0x3a37('0x21')](respondWithResult(_0x1547fa,null))[_0x3a37('0x3f')](handleError(_0x1547fa,null));};exports['create']=function(_0x26e5de,_0xa7021f){return db[_0x3a37('0x27')][_0x3a37('0x43')](_0x26e5de['body'],{})[_0x3a37('0x21')](respondWithResult(_0xa7021f,0xc9))[_0x3a37('0x3f')](handleError(_0xa7021f,null));};exports[_0x3a37('0x44')]=function(_0xf13a03,_0x468ef4){if(_0xf13a03['body']['id']){delete _0xf13a03[_0x3a37('0x45')]['id'];}return db[_0x3a37('0x27')][_0x3a37('0x42')]({'where':{'id':_0xf13a03[_0x3a37('0x40')]['id']}})[_0x3a37('0x21')](handleEntityNotFound(_0x468ef4,null))[_0x3a37('0x21')](saveUpdates(_0xf13a03[_0x3a37('0x45')],null))[_0x3a37('0x21')](respondWithResult(_0x468ef4,null))['catch'](handleError(_0x468ef4,null));};exports[_0x3a37('0x46')]=function(_0x4762bf,_0x5a1455){return db['FaxQueueReport'][_0x3a37('0x42')]({'where':{'id':_0x4762bf['params']['id']}})[_0x3a37('0x21')](handleEntityNotFound(_0x5a1455,null))['then'](removeEntity(_0x5a1455,null))['catch'](handleError(_0x5a1455,null));};exports[_0x3a37('0x47')]=function(_0x438a1c,_0xcf5b62){return db[_0x3a37('0x27')]['describe']()['then'](respondWithResult(_0xcf5b62,null))[_0x3a37('0x3f')](handleError(_0xcf5b62,null));}; \ No newline at end of file +var _0x7d60=['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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','name','send','index','map','FaxQueueReport','rawAttributes','type','key','model','keys','attributes','intersection','query','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','update','describe','html-pdf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d60,0xe9));var _0x07d6=function(_0xdaa934,_0x5908ac){_0xdaa934=_0xdaa934-0x0;var _0x5c4cab=_0x7d60[_0xdaa934];return _0x5c4cab;};'use strict';var pdf=require(_0x07d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x07d6('0x1'));var zipdir=require(_0x07d6('0x2'));var jsonpatch=require(_0x07d6('0x3'));var rp=require(_0x07d6('0x4'));var moment=require(_0x07d6('0x5'));var BPromise=require(_0x07d6('0x6'));var Mustache=require('mustache');var util=require(_0x07d6('0x7'));var path=require(_0x07d6('0x8'));var sox=require(_0x07d6('0x9'));var csv=require(_0x07d6('0xa'));var ejs=require(_0x07d6('0xb'));var fs=require('fs');var _=require(_0x07d6('0xc'));var squel=require(_0x07d6('0xd'));var crypto=require(_0x07d6('0xe'));var jsforce=require(_0x07d6('0xf'));var deskjs=require(_0x07d6('0x10'));var toCsv=require(_0x07d6('0xa'));var querystring=require(_0x07d6('0x11'));var Papa=require(_0x07d6('0x12'));var Redis=require(_0x07d6('0x13'));var authService=require(_0x07d6('0x14'));var qs=require(_0x07d6('0x15'));var as=require(_0x07d6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x07d6('0x17'));var utils=require(_0x07d6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x07d6('0x19'));var db=require(_0x07d6('0x1a'))['db'];function respondWithStatusCode(_0x46eea6,_0x3c5f69){_0x3c5f69=_0x3c5f69||0xcc;return function(_0x1d241b){if(_0x1d241b){return _0x46eea6[_0x07d6('0x1b')](_0x3c5f69);}return _0x46eea6[_0x07d6('0x1c')](_0x3c5f69)['end']();};}function respondWithResult(_0x2e5527,_0x1d4c0b){_0x1d4c0b=_0x1d4c0b||0xc8;return function(_0x4fd183){if(_0x4fd183){return _0x2e5527[_0x07d6('0x1c')](_0x1d4c0b)[_0x07d6('0x1d')](_0x4fd183);}};}function respondWithFilteredResult(_0x5dd4b6,_0x99f215){return function(_0x2fb6b5){if(_0x2fb6b5){var _0x5a22ab=_0x2fb6b5[_0x07d6('0x1e')],_0x4ddb26=_0x99f215[_0x07d6('0x1f')],_0x3ac834=_0x99f215['offset']+_0x99f215[_0x07d6('0x20')],_0xe4982a;if(_0x3ac834>=_0x5a22ab){_0x3ac834=_0x5a22ab;_0xe4982a=0xc8;}else{_0xe4982a=0xce;}_0x5dd4b6[_0x07d6('0x1c')](_0xe4982a);return _0x5dd4b6[_0x07d6('0x21')](_0x07d6('0x22'),_0x4ddb26+'-'+_0x3ac834+'/'+_0x5a22ab)[_0x07d6('0x1d')](_0x2fb6b5);}return null;};}function patchUpdates(_0x2ddae9){return function(_0x1719a3){try{jsonpatch[_0x07d6('0x23')](_0x1719a3,_0x2ddae9,!![]);}catch(_0x2c57b5){return BPromise[_0x07d6('0x24')](_0x2c57b5);}return _0x1719a3[_0x07d6('0x25')]();};}function saveUpdates(_0x358ea0,_0x54af80){return function(_0x1c7c3e){if(_0x1c7c3e){return _0x1c7c3e['update'](_0x358ea0)['then'](function(_0x22bcdf){return _0x22bcdf;});}return null;};}function removeEntity(_0x2d9158,_0x3315a7){return function(_0x46bdab){if(_0x46bdab){return _0x46bdab[_0x07d6('0x26')]()[_0x07d6('0x27')](function(){_0x2d9158['status'](0xcc)[_0x07d6('0x28')]();});}};}function handleEntityNotFound(_0x4c9f1e,_0x55ea30){return function(_0x4a64f0){if(!_0x4a64f0){_0x4c9f1e['sendStatus'](0x194);}return _0x4a64f0;};}function handleError(_0x5156c5,_0x46877d){_0x46877d=_0x46877d||0x1f4;return function(_0x18f96d){logger[_0x07d6('0x29')](_0x18f96d['stack']);if(_0x18f96d['name']){delete _0x18f96d[_0x07d6('0x2a')];}_0x5156c5[_0x07d6('0x1c')](_0x46877d)[_0x07d6('0x2b')](_0x18f96d);};}exports[_0x07d6('0x2c')]=function(_0x48f74d,_0x505599){var _0x4946d4={},_0x3a0054={},_0x1c3b70={'count':0x0,'rows':[]};var _0x3df7ef=_[_0x07d6('0x2d')](db[_0x07d6('0x2e')][_0x07d6('0x2f')],function(_0x6bd67b){return{'name':_0x6bd67b['fieldName'],'type':_0x6bd67b[_0x07d6('0x30')][_0x07d6('0x31')]};});_0x3a0054[_0x07d6('0x32')]=_[_0x07d6('0x2d')](_0x3df7ef,_0x07d6('0x2a'));_0x3a0054['query']=_[_0x07d6('0x33')](_0x48f74d['query']);_0x3a0054['filters']=_['intersection'](_0x3a0054[_0x07d6('0x32')],_0x3a0054['query']);_0x4946d4[_0x07d6('0x34')]=_[_0x07d6('0x35')](_0x3a0054[_0x07d6('0x32')],qs['fields'](_0x48f74d[_0x07d6('0x36')]['fields']));_0x4946d4[_0x07d6('0x34')]=_0x4946d4['attributes'][_0x07d6('0x37')]?_0x4946d4[_0x07d6('0x34')]:_0x3a0054['model'];if(!_0x48f74d[_0x07d6('0x36')][_0x07d6('0x38')](_0x07d6('0x39'))){_0x4946d4[_0x07d6('0x20')]=qs[_0x07d6('0x20')](_0x48f74d[_0x07d6('0x36')]['limit']);_0x4946d4[_0x07d6('0x1f')]=qs[_0x07d6('0x1f')](_0x48f74d['query'][_0x07d6('0x1f')]);}_0x4946d4['order']=qs[_0x07d6('0x3a')](_0x48f74d[_0x07d6('0x36')][_0x07d6('0x3a')]);_0x4946d4[_0x07d6('0x3b')]=qs[_0x07d6('0x3c')](_[_0x07d6('0x3d')](_0x48f74d[_0x07d6('0x36')],_0x3a0054[_0x07d6('0x3c')]),_0x3df7ef);if(_0x48f74d[_0x07d6('0x36')]['filter']){_0x4946d4[_0x07d6('0x3b')]=_['merge'](_0x4946d4[_0x07d6('0x3b')],{'$or':_[_0x07d6('0x2d')](_0x3df7ef,function(_0x5c1d45){if(_0x5c1d45['type']!==_0x07d6('0x3e')){var _0x1ea9db={};_0x1ea9db[_0x5c1d45[_0x07d6('0x2a')]]={'$like':'%'+_0x48f74d[_0x07d6('0x36')][_0x07d6('0x3f')]+'%'};return _0x1ea9db;}})});}_0x4946d4=_[_0x07d6('0x40')]({},_0x4946d4,_0x48f74d[_0x07d6('0x41')]);var _0xc04461={'where':_0x4946d4[_0x07d6('0x3b')]};return db[_0x07d6('0x2e')]['count'](_0xc04461)[_0x07d6('0x27')](function(_0x4d6a72){_0x1c3b70[_0x07d6('0x1e')]=_0x4d6a72;if(_0x48f74d[_0x07d6('0x36')][_0x07d6('0x42')]){_0x4946d4[_0x07d6('0x43')]=[{'all':!![]}];}return db[_0x07d6('0x2e')][_0x07d6('0x44')](_0x4946d4);})['then'](function(_0x2742f4){_0x1c3b70[_0x07d6('0x45')]=_0x2742f4;return _0x1c3b70;})[_0x07d6('0x27')](respondWithFilteredResult(_0x505599,_0x4946d4))[_0x07d6('0x46')](handleError(_0x505599,null));};exports['show']=function(_0x204305,_0x5a5d9a){var _0x135cf5={'raw':!![],'where':{'id':_0x204305[_0x07d6('0x47')]['id']}},_0x3c5bd4={};_0x3c5bd4['model']=_[_0x07d6('0x33')](db[_0x07d6('0x2e')]['rawAttributes']);_0x3c5bd4[_0x07d6('0x36')]=_[_0x07d6('0x33')](_0x204305['query']);_0x3c5bd4['filters']=_[_0x07d6('0x35')](_0x3c5bd4['model'],_0x3c5bd4['query']);_0x135cf5[_0x07d6('0x34')]=_['intersection'](_0x3c5bd4[_0x07d6('0x32')],qs['fields'](_0x204305[_0x07d6('0x36')][_0x07d6('0x48')]));_0x135cf5[_0x07d6('0x34')]=_0x135cf5['attributes']['length']?_0x135cf5['attributes']:_0x3c5bd4['model'];if(_0x204305[_0x07d6('0x36')]['includeAll']){_0x135cf5[_0x07d6('0x43')]=[{'all':!![]}];}_0x135cf5=_[_0x07d6('0x40')]({},_0x135cf5,_0x204305[_0x07d6('0x41')]);return db[_0x07d6('0x2e')][_0x07d6('0x49')](_0x135cf5)[_0x07d6('0x27')](handleEntityNotFound(_0x5a5d9a,null))[_0x07d6('0x27')](respondWithResult(_0x5a5d9a,null))[_0x07d6('0x46')](handleError(_0x5a5d9a,null));};exports[_0x07d6('0x4a')]=function(_0x49032e,_0x174530){return db[_0x07d6('0x2e')][_0x07d6('0x4a')](_0x49032e[_0x07d6('0x4b')],{})['then'](respondWithResult(_0x174530,0xc9))[_0x07d6('0x46')](handleError(_0x174530,null));};exports[_0x07d6('0x4c')]=function(_0x3ae769,_0x1cd26e){if(_0x3ae769[_0x07d6('0x4b')]['id']){delete _0x3ae769['body']['id'];}return db['FaxQueueReport'][_0x07d6('0x49')]({'where':{'id':_0x3ae769[_0x07d6('0x47')]['id']}})[_0x07d6('0x27')](handleEntityNotFound(_0x1cd26e,null))[_0x07d6('0x27')](saveUpdates(_0x3ae769[_0x07d6('0x4b')],null))[_0x07d6('0x27')](respondWithResult(_0x1cd26e,null))[_0x07d6('0x46')](handleError(_0x1cd26e,null));};exports[_0x07d6('0x26')]=function(_0x5a6fed,_0x2a72da){return db[_0x07d6('0x2e')][_0x07d6('0x49')]({'where':{'id':_0x5a6fed[_0x07d6('0x47')]['id']}})[_0x07d6('0x27')](handleEntityNotFound(_0x2a72da,null))['then'](removeEntity(_0x2a72da,null))[_0x07d6('0x46')](handleError(_0x2a72da,null));};exports[_0x07d6('0x4d')]=function(_0x4694e4,_0x34938d){return db['FaxQueueReport'][_0x07d6('0x4d')]()[_0x07d6('0x27')](respondWithResult(_0x34938d,null))['catch'](handleError(_0x34938d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a8402f5..6152a9d 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 _0xc5f7=['exports','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./faxQueueReport.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc5f7,0xf4));var _0x7c5f=function(_0x11e7f3,_0x4e24d8){_0x11e7f3=_0x11e7f3-0x0;var _0x48e726=_0xc5f7[_0x11e7f3];return _0x48e726;};'use strict';var _=require(_0x7c5f('0x0'));var util=require(_0x7c5f('0x1'));var logger=require(_0x7c5f('0x2'))(_0x7c5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c5f('0x4'));var rimraf=require(_0x7c5f('0x5'));var config=require(_0x7c5f('0x6'));var attributes=require(_0x7c5f('0x7'));module[_0x7c5f('0x8')]=function(_0x3b1fca,_0x4e5be5){return _0x3b1fca[_0x7c5f('0x9')]('FaxQueueReport',attributes,{'tableName':_0x7c5f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7c5f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x993d=['uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x993d,0x1bd));var _0xd993=function(_0x551ce9,_0x11cfcf){_0x551ce9=_0x551ce9-0x0;var _0x4ca985=_0x993d[_0x551ce9];return _0x4ca985;};'use strict';var _=require('lodash');var util=require(_0xd993('0x0'));var logger=require(_0xd993('0x1'))(_0xd993('0x2'));var moment=require(_0xd993('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd993('0x4'));var rimraf=require(_0xd993('0x5'));var config=require(_0xd993('0x6'));var attributes=require(_0xd993('0x7'));module[_0xd993('0x8')]=function(_0x2c2465,_0x41560a){return _0x2c2465['define'](_0xd993('0x9'),attributes,{'tableName':_0xd993('0xa'),'paranoid':![],'indexes':[{'name':_0xd993('0xb'),'fields':[_0xd993('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 007a3bc..3d1f087 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 _0xe648=['stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0xe648,0xbb));var _0x8e64=function(_0x4b3363,_0x276279){_0x4b3363=_0x4b3363-0x0;var _0x466f6f=_0xe648[_0x4b3363];return _0x466f6f;};'use strict';var _=require(_0x8e64('0x0'));var util=require(_0x8e64('0x1'));var moment=require(_0x8e64('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e64('0x3'));var fs=require('fs');var Redis=require(_0x8e64('0x4'));var db=require(_0x8e64('0x5'))['db'];var utils=require(_0x8e64('0x6'));var logger=require(_0x8e64('0x7'))(_0x8e64('0x8'));var config=require(_0x8e64('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e64('0xa')][_0x8e64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5576ff,_0x5a3d86,_0x3e0379){return new BPromise(function(_0x5888c5,_0x19b7e0){return client[_0x8e64('0xc')](_0x5576ff,_0x3e0379)[_0x8e64('0xd')](function(_0x53ce6d){logger[_0x8e64('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x5a3d86,'request\x20sent');logger['debug'](_0x8e64('0xf'),_0x5a3d86,_0x8e64('0x10'),JSON[_0x8e64('0x11')](_0x53ce6d));if(_0x53ce6d[_0x8e64('0x12')]){if(_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x13')]===0x1f4){logger[_0x8e64('0x12')](_0x8e64('0x14'),_0x5a3d86,_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x15')]);return _0x19b7e0(_0x53ce6d['error']['message']);}logger['error'](_0x8e64('0x14'),_0x5a3d86,_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x15')]);return _0x5888c5(_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x15')]);}else{logger['info'](_0x8e64('0x14'),_0x5a3d86,_0x8e64('0x10'));_0x5888c5(_0x53ce6d[_0x8e64('0x16')][_0x8e64('0x15')]);}})[_0x8e64('0x17')](function(_0x192a80){logger[_0x8e64('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x5a3d86,_0x192a80);_0x19b7e0(_0x192a80);});});}exports[_0x8e64('0x18')]=function(_0x5989fe){var _0x4979ce=this;return new Promise(function(_0x265cd4,_0x37424a){return db[_0x8e64('0x19')][_0x8e64('0x1a')](_0x5989fe[_0x8e64('0x1b')],{'raw':_0x5989fe[_0x8e64('0x1c')]?_0x5989fe['options'][_0x8e64('0x1d')]===undefined?!![]:![]:!![]})[_0x8e64('0xd')](function(_0x20b88){logger[_0x8e64('0xe')](_0x8e64('0x18'),_0x5989fe);logger['debug'](_0x8e64('0x18'),_0x5989fe,JSON['stringify'](_0x20b88));_0x265cd4(_0x20b88);})['catch'](function(_0x48d0e1){logger[_0x8e64('0x12')](_0x8e64('0x18'),_0x48d0e1[_0x8e64('0x15')],_0x5989fe);_0x37424a(_0x4979ce[_0x8e64('0x12')](0x1f4,_0x48d0e1[_0x8e64('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x27145c){var _0x1e9a64=this;return new Promise(function(_0x508392,_0x3e87ba){return db['FaxQueueReport'][_0x8e64('0x1e')](_0x27145c[_0x8e64('0x1b')],{'raw':_0x27145c[_0x8e64('0x1c')]?_0x27145c[_0x8e64('0x1c')][_0x8e64('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27145c[_0x8e64('0x1c')]?_0x27145c[_0x8e64('0x1c')][_0x8e64('0x1f')]||null:null,'attributes':_0x27145c[_0x8e64('0x1c')]?_0x27145c['options']['attributes']||null:null,'limit':_0x27145c[_0x8e64('0x1c')]?_0x27145c[_0x8e64('0x1c')][_0x8e64('0x20')]||null:null})[_0x8e64('0xd')](function(_0x4aabb9){logger[_0x8e64('0xe')]('UpdateFaxQueueReport',_0x27145c);logger['debug'](_0x8e64('0x21'),_0x27145c,JSON[_0x8e64('0x11')](_0x4aabb9));_0x508392(_0x4aabb9);})[_0x8e64('0x17')](function(_0x38d9a8){logger[_0x8e64('0x12')](_0x8e64('0x21'),_0x38d9a8['message'],_0x27145c);_0x3e87ba(_0x1e9a64[_0x8e64('0x12')](0x1f4,_0x38d9a8[_0x8e64('0x15')]));});});}; \ No newline at end of file +var _0x19d1=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','options','raw','catch','update','body','where','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info'];(function(_0x4b99a4,_0x55ccc9){var _0x56b62a=function(_0x5a852e){while(--_0x5a852e){_0x4b99a4['push'](_0x4b99a4['shift']());}};_0x56b62a(++_0x55ccc9);}(_0x19d1,0x166));var _0x119d=function(_0x5725b6,_0x2bb4f3){_0x5725b6=_0x5725b6-0x0;var _0x374642=_0x19d1[_0x5725b6];return _0x374642;};'use strict';var _=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var moment=require(_0x119d('0x2'));var BPromise=require(_0x119d('0x3'));var rs=require(_0x119d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119d('0x5'))['db'];var utils=require(_0x119d('0x6'));var logger=require(_0x119d('0x7'))(_0x119d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x119d('0x9')][_0x119d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x247d00,_0x2cd72e,_0x3c98b2){return new BPromise(function(_0x2995ea,_0x3c98e7){return client[_0x119d('0xb')](_0x247d00,_0x3c98b2)[_0x119d('0xc')](function(_0xc8b78f){logger[_0x119d('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x2cd72e,'request\x20sent');logger[_0x119d('0xe')](_0x119d('0xf'),_0x2cd72e,_0x119d('0x10'),JSON[_0x119d('0x11')](_0xc8b78f));if(_0xc8b78f[_0x119d('0x12')]){if(_0xc8b78f[_0x119d('0x12')][_0x119d('0x13')]===0x1f4){logger[_0x119d('0x12')](_0x119d('0x14'),_0x2cd72e,_0xc8b78f[_0x119d('0x12')][_0x119d('0x15')]);return _0x3c98e7(_0xc8b78f[_0x119d('0x12')][_0x119d('0x15')]);}logger[_0x119d('0x12')](_0x119d('0x14'),_0x2cd72e,_0xc8b78f['error'][_0x119d('0x15')]);return _0x2995ea(_0xc8b78f['error'][_0x119d('0x15')]);}else{logger[_0x119d('0xd')](_0x119d('0x14'),_0x2cd72e,'request\x20sent');_0x2995ea(_0xc8b78f['result']['message']);}})['catch'](function(_0x40ee58){logger[_0x119d('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2cd72e,_0x40ee58);_0x3c98e7(_0x40ee58);});});}exports[_0x119d('0x16')]=function(_0x3a4148){var _0x4883ae=this;return new Promise(function(_0x1eeae5,_0x53fdca){return db['FaxQueueReport']['create'](_0x3a4148['body'],{'raw':_0x3a4148[_0x119d('0x17')]?_0x3a4148[_0x119d('0x17')][_0x119d('0x18')]===undefined?!![]:![]:!![]})[_0x119d('0xc')](function(_0x73fb9){logger[_0x119d('0xd')](_0x119d('0x16'),_0x3a4148);logger[_0x119d('0xe')](_0x119d('0x16'),_0x3a4148,JSON[_0x119d('0x11')](_0x73fb9));_0x1eeae5(_0x73fb9);})[_0x119d('0x19')](function(_0x597fc4){logger[_0x119d('0x12')](_0x119d('0x16'),_0x597fc4[_0x119d('0x15')],_0x3a4148);_0x53fdca(_0x4883ae[_0x119d('0x12')](0x1f4,_0x597fc4[_0x119d('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x4ad41b){var _0x2dc37b=this;return new Promise(function(_0x53f31a,_0x4402fd){return db['FaxQueueReport'][_0x119d('0x1a')](_0x4ad41b[_0x119d('0x1b')],{'raw':_0x4ad41b[_0x119d('0x17')]?_0x4ad41b[_0x119d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad41b[_0x119d('0x17')]?_0x4ad41b['options'][_0x119d('0x1c')]||null:null,'attributes':_0x4ad41b[_0x119d('0x17')]?_0x4ad41b[_0x119d('0x17')]['attributes']||null:null,'limit':_0x4ad41b['options']?_0x4ad41b[_0x119d('0x17')][_0x119d('0x1d')]||null:null})[_0x119d('0xc')](function(_0x5664de){logger[_0x119d('0xd')](_0x119d('0x1e'),_0x4ad41b);logger['debug'](_0x119d('0x1e'),_0x4ad41b,JSON['stringify'](_0x5664de));_0x53f31a(_0x5664de);})[_0x119d('0x19')](function(_0x30a3b6){logger[_0x119d('0x12')]('UpdateFaxQueueReport',_0x30a3b6[_0x119d('0x15')],_0x4ad41b);_0x4402fd(_0x2dc37b[_0x119d('0x12')](0x1f4,_0x30a3b6[_0x119d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 24a96cd..eff0958 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 _0x59a7=['index','get','/:id','post','create','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x22584d,_0x210fea){var _0x215b7b=function(_0x5d655f){while(--_0x5d655f){_0x22584d['push'](_0x22584d['shift']());}};_0x215b7b(++_0x210fea);}(_0x59a7,0xcb));var _0x759a=function(_0x4c39a0,_0xdcf1dd){_0x4c39a0=_0x4c39a0-0x0;var _0x310903=_0x59a7[_0x4c39a0];return _0x310903;};'use strict';var multer=require(_0x759a('0x0'));var util=require(_0x759a('0x1'));var path=require(_0x759a('0x2'));var timeout=require('connect-timeout');var express=require(_0x759a('0x3'));var router=express['Router']();var auth=require(_0x759a('0x4'));var interaction=require(_0x759a('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x759a('0x6')](),controller[_0x759a('0x7')]);router[_0x759a('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x759a('0x8')](_0x759a('0x9'),auth[_0x759a('0x6')](),controller['show']);router[_0x759a('0xa')]('/',auth[_0x759a('0x6')](),controller[_0x759a('0xb')]);router['put'](_0x759a('0x9'),auth[_0x759a('0x6')](),controller['update']);router['delete'](_0x759a('0x9'),auth[_0x759a('0x6')](),controller[_0x759a('0xc')]);module[_0x759a('0xd')]=router; \ No newline at end of file +var _0x0bed=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','destroy','multer'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x0bed,0xbf));var _0xd0be=function(_0x1c8b39,_0x2a9469){_0x1c8b39=_0x1c8b39-0x0;var _0x16da45=_0x0bed[_0x1c8b39];return _0x16da45;};'use strict';var multer=require(_0xd0be('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd0be('0x1'));var express=require(_0xd0be('0x2'));var router=express[_0xd0be('0x3')]();var auth=require(_0xd0be('0x4'));var interaction=require(_0xd0be('0x5'));var config=require(_0xd0be('0x6'));var controller=require(_0xd0be('0x7'));router[_0xd0be('0x8')]('/',auth[_0xd0be('0x9')](),controller['index']);router['get'](_0xd0be('0xa'),auth[_0xd0be('0x9')](),controller[_0xd0be('0xb')]);router[_0xd0be('0x8')](_0xd0be('0xc'),auth[_0xd0be('0x9')](),controller['show']);router['post']('/',auth[_0xd0be('0x9')](),controller[_0xd0be('0xd')]);router[_0xd0be('0xe')](_0xd0be('0xc'),auth[_0xd0be('0x9')](),controller['update']);router['delete'](_0xd0be('0xc'),auth[_0xd0be('0x9')](),controller[_0xd0be('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index dfa83cd..6b80652 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 _0x5d8e=['moment','exports','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d8e,0x188));var _0xe5d8=function(_0x53cd0b,_0x175df1){_0x53cd0b=_0x53cd0b-0x0;var _0x5a6ed6=_0x5d8e[_0x53cd0b];return _0x5a6ed6;};'use strict';var moment=require(_0xe5d8('0x0'));var Sequelize=require('sequelize');module[_0xe5d8('0x1')]={'uniqueid':{'type':Sequelize[_0xe5d8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe5d8('0x3')]('account',_0xe5d8('0x4'),'queue'),'allowNull':![],'defaultValue':_0xe5d8('0x5')},'transferredAt':{'type':Sequelize[_0xe5d8('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xe5d8('0x7')]}}; \ No newline at end of file +var _0xd064=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd064,0xa9));var _0x4d06=function(_0x6a4fe7,_0x40a337){_0x6a4fe7=_0x6a4fe7-0x0;var _0x5e467d=_0xd064[_0x6a4fe7];return _0x5e467d;};'use strict';var moment=require(_0x4d06('0x0'));var Sequelize=require(_0x4d06('0x1'));module[_0x4d06('0x2')]={'uniqueid':{'type':Sequelize[_0x4d06('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4d06('0x4')](_0x4d06('0x5'),_0x4d06('0x6'),_0x4d06('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x4d06('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x4d06('0x9')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7464361..05e764e 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 _0x2087=['FaxTransferReport','includeAll','include','findAll','show','length','find','create','body','params','catch','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options'];(function(_0x188c2c,_0x1f95d9){var _0x3075c2=function(_0x10b7d0){while(--_0x10b7d0){_0x188c2c['push'](_0x188c2c['shift']());}};_0x3075c2(++_0x1f95d9);}(_0x2087,0xf3));var _0x7208=function(_0x3d32d6,_0x25c147){_0x3d32d6=_0x3d32d6-0x0;var _0x3db593=_0x2087[_0x3d32d6];return _0x3db593;};'use strict';var pdf=require(_0x7208('0x0'));var emlformat=require(_0x7208('0x1'));var rimraf=require(_0x7208('0x2'));var zipdir=require(_0x7208('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7208('0x4'));var moment=require(_0x7208('0x5'));var BPromise=require(_0x7208('0x6'));var Mustache=require(_0x7208('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7208('0x8'));var csv=require('to-csv');var ejs=require(_0x7208('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7208('0xa'));var crypto=require(_0x7208('0xb'));var jsforce=require(_0x7208('0xc'));var deskjs=require(_0x7208('0xd'));var toCsv=require(_0x7208('0xe'));var querystring=require(_0x7208('0xf'));var Papa=require(_0x7208('0x10'));var Redis=require('ioredis');var authService=require(_0x7208('0x11'));var qs=require(_0x7208('0x12'));var as=require(_0x7208('0x13'));var hardwareService=require(_0x7208('0x14'));var logger=require(_0x7208('0x15'))(_0x7208('0x16'));var utils=require('../../config/utils');var config=require(_0x7208('0x17'));var licenseUtil=require(_0x7208('0x18'));var db=require(_0x7208('0x19'))['db'];function respondWithStatusCode(_0x86a763,_0x207595){_0x207595=_0x207595||0xcc;return function(_0x22ee6c){if(_0x22ee6c){return _0x86a763['sendStatus'](_0x207595);}return _0x86a763[_0x7208('0x1a')](_0x207595)[_0x7208('0x1b')]();};}function respondWithResult(_0x234927,_0x26515b){_0x26515b=_0x26515b||0xc8;return function(_0xfe87de){if(_0xfe87de){return _0x234927[_0x7208('0x1a')](_0x26515b)[_0x7208('0x1c')](_0xfe87de);}};}function respondWithFilteredResult(_0x3254d1,_0x238ada){return function(_0x320a12){if(_0x320a12){var _0x340a10=_0x320a12[_0x7208('0x1d')],_0x4de869=_0x238ada['offset'],_0x4cd685=_0x238ada[_0x7208('0x1e')]+_0x238ada[_0x7208('0x1f')],_0x5a7b8d;if(_0x4cd685>=_0x340a10){_0x4cd685=_0x340a10;_0x5a7b8d=0xc8;}else{_0x5a7b8d=0xce;}_0x3254d1['status'](_0x5a7b8d);return _0x3254d1[_0x7208('0x20')](_0x7208('0x21'),_0x4de869+'-'+_0x4cd685+'/'+_0x340a10)[_0x7208('0x1c')](_0x320a12);}return null;};}function patchUpdates(_0x447835){return function(_0x1d0551){try{jsonpatch[_0x7208('0x22')](_0x1d0551,_0x447835,!![]);}catch(_0x15aade){return BPromise[_0x7208('0x23')](_0x15aade);}return _0x1d0551[_0x7208('0x24')]();};}function saveUpdates(_0x41cd3a,_0x3c17db){return function(_0x3124c9){if(_0x3124c9){return _0x3124c9[_0x7208('0x25')](_0x41cd3a)[_0x7208('0x26')](function(_0x2a7613){return _0x2a7613;});}return null;};}function removeEntity(_0x47da91,_0x52bce8){return function(_0x11bae6){if(_0x11bae6){return _0x11bae6[_0x7208('0x27')]()[_0x7208('0x26')](function(){_0x47da91['status'](0xcc)[_0x7208('0x1b')]();});}};}function handleEntityNotFound(_0x216167,_0x328128){return function(_0x88850c){if(!_0x88850c){_0x216167[_0x7208('0x28')](0x194);}return _0x88850c;};}function handleError(_0x245ee8,_0x35f60f){_0x35f60f=_0x35f60f||0x1f4;return function(_0x126dae){logger[_0x7208('0x29')](_0x126dae[_0x7208('0x2a')]);if(_0x126dae[_0x7208('0x2b')]){delete _0x126dae[_0x7208('0x2b')];}_0x245ee8[_0x7208('0x1a')](_0x35f60f)[_0x7208('0x2c')](_0x126dae);};}exports[_0x7208('0x2d')]=function(_0x3c15f6,_0x304f5c){var _0x16fc0f={},_0x1416a4={},_0x51bec2={'count':0x0,'rows':[]};var _0x1c8c3f=_['map'](db['FaxTransferReport'][_0x7208('0x2e')],function(_0x2cc481){return{'name':_0x2cc481['fieldName'],'type':_0x2cc481[_0x7208('0x2f')][_0x7208('0x30')]};});_0x1416a4[_0x7208('0x31')]=_[_0x7208('0x32')](_0x1c8c3f,_0x7208('0x2b'));_0x1416a4[_0x7208('0x33')]=_[_0x7208('0x34')](_0x3c15f6['query']);_0x1416a4[_0x7208('0x35')]=_[_0x7208('0x36')](_0x1416a4[_0x7208('0x31')],_0x1416a4['query']);_0x16fc0f['attributes']=_[_0x7208('0x36')](_0x1416a4[_0x7208('0x31')],qs[_0x7208('0x37')](_0x3c15f6[_0x7208('0x33')][_0x7208('0x37')]));_0x16fc0f[_0x7208('0x38')]=_0x16fc0f[_0x7208('0x38')]['length']?_0x16fc0f['attributes']:_0x1416a4['model'];if(!_0x3c15f6[_0x7208('0x33')][_0x7208('0x39')](_0x7208('0x3a'))){_0x16fc0f[_0x7208('0x1f')]=qs[_0x7208('0x1f')](_0x3c15f6[_0x7208('0x33')]['limit']);_0x16fc0f[_0x7208('0x1e')]=qs['offset'](_0x3c15f6['query'][_0x7208('0x1e')]);}_0x16fc0f['order']=qs[_0x7208('0x3b')](_0x3c15f6[_0x7208('0x33')][_0x7208('0x3b')]);_0x16fc0f['where']=qs[_0x7208('0x35')](_['pick'](_0x3c15f6[_0x7208('0x33')],_0x1416a4['filters']),_0x1c8c3f);if(_0x3c15f6[_0x7208('0x33')]['filter']){_0x16fc0f[_0x7208('0x3c')]=_[_0x7208('0x3d')](_0x16fc0f[_0x7208('0x3c')],{'$or':_[_0x7208('0x32')](_0x1c8c3f,function(_0x3f68af){if(_0x3f68af[_0x7208('0x2f')]!==_0x7208('0x3e')){var _0x5dc891={};_0x5dc891[_0x3f68af[_0x7208('0x2b')]]={'$like':'%'+_0x3c15f6[_0x7208('0x33')][_0x7208('0x3f')]+'%'};return _0x5dc891;}})});}_0x16fc0f=_['merge']({},_0x16fc0f,_0x3c15f6[_0x7208('0x40')]);var _0x9e59f7={'where':_0x16fc0f[_0x7208('0x3c')]};return db[_0x7208('0x41')]['count'](_0x9e59f7)[_0x7208('0x26')](function(_0x18b04b){_0x51bec2[_0x7208('0x1d')]=_0x18b04b;if(_0x3c15f6[_0x7208('0x33')][_0x7208('0x42')]){_0x16fc0f[_0x7208('0x43')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x7208('0x44')](_0x16fc0f);})['then'](function(_0x33983c){_0x51bec2['rows']=_0x33983c;return _0x51bec2;})[_0x7208('0x26')](respondWithFilteredResult(_0x304f5c,_0x16fc0f))['catch'](handleError(_0x304f5c,null));};exports[_0x7208('0x45')]=function(_0x4fcd86,_0x52efef){var _0x3e76ef={'raw':!![],'where':{'id':_0x4fcd86['params']['id']}},_0x313c24={};_0x313c24[_0x7208('0x31')]=_[_0x7208('0x34')](db[_0x7208('0x41')][_0x7208('0x2e')]);_0x313c24['query']=_['keys'](_0x4fcd86[_0x7208('0x33')]);_0x313c24['filters']=_[_0x7208('0x36')](_0x313c24[_0x7208('0x31')],_0x313c24[_0x7208('0x33')]);_0x3e76ef[_0x7208('0x38')]=_[_0x7208('0x36')](_0x313c24['model'],qs[_0x7208('0x37')](_0x4fcd86[_0x7208('0x33')][_0x7208('0x37')]));_0x3e76ef[_0x7208('0x38')]=_0x3e76ef[_0x7208('0x38')][_0x7208('0x46')]?_0x3e76ef['attributes']:_0x313c24[_0x7208('0x31')];if(_0x4fcd86['query'][_0x7208('0x42')]){_0x3e76ef['include']=[{'all':!![]}];}_0x3e76ef=_['merge']({},_0x3e76ef,_0x4fcd86['options']);return db[_0x7208('0x41')][_0x7208('0x47')](_0x3e76ef)[_0x7208('0x26')](handleEntityNotFound(_0x52efef,null))[_0x7208('0x26')](respondWithResult(_0x52efef,null))['catch'](handleError(_0x52efef,null));};exports[_0x7208('0x48')]=function(_0x6498a9,_0x1575b3){return db[_0x7208('0x41')][_0x7208('0x48')](_0x6498a9[_0x7208('0x49')],{})[_0x7208('0x26')](respondWithResult(_0x1575b3,0xc9))['catch'](handleError(_0x1575b3,null));};exports[_0x7208('0x25')]=function(_0x3d03a6,_0x38a75f){if(_0x3d03a6[_0x7208('0x49')]['id']){delete _0x3d03a6['body']['id'];}return db['FaxTransferReport'][_0x7208('0x47')]({'where':{'id':_0x3d03a6[_0x7208('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38a75f,null))[_0x7208('0x26')](saveUpdates(_0x3d03a6[_0x7208('0x49')],null))[_0x7208('0x26')](respondWithResult(_0x38a75f,null))[_0x7208('0x4b')](handleError(_0x38a75f,null));};exports[_0x7208('0x27')]=function(_0xb6844a,_0x2f454a){return db[_0x7208('0x41')]['find']({'where':{'id':_0xb6844a['params']['id']}})['then'](handleEntityNotFound(_0x2f454a,null))[_0x7208('0x26')](removeEntity(_0x2f454a,null))[_0x7208('0x4b')](handleError(_0x2f454a,null));};exports[_0x7208('0x4c')]=function(_0x39fc53,_0x1d4249){return db[_0x7208('0x41')][_0x7208('0x4c')]()['then'](respondWithResult(_0x1d4249,null))[_0x7208('0x4b')](handleError(_0x1d4249,null));}; \ No newline at end of file +var _0x79a8=['where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x475be2,_0xf0639){var _0x4ff8b1=function(_0x4bccc9){while(--_0x4bccc9){_0x475be2['push'](_0x475be2['shift']());}};_0x4ff8b1(++_0xf0639);}(_0x79a8,0x1d0));var _0x879a=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x79a8[_0x1a595a];return _0x33f008;};'use strict';var pdf=require(_0x879a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x879a('0x1'));var zipdir=require(_0x879a('0x2'));var jsonpatch=require(_0x879a('0x3'));var rp=require('request-promise');var moment=require(_0x879a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x879a('0x5'));var util=require(_0x879a('0x6'));var path=require(_0x879a('0x7'));var sox=require(_0x879a('0x8'));var csv=require(_0x879a('0x9'));var ejs=require(_0x879a('0xa'));var fs=require('fs');var _=require(_0x879a('0xb'));var squel=require(_0x879a('0xc'));var crypto=require('crypto');var jsforce=require(_0x879a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x879a('0x9'));var querystring=require(_0x879a('0xe'));var Papa=require('papaparse');var Redis=require(_0x879a('0xf'));var authService=require(_0x879a('0x10'));var qs=require(_0x879a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x879a('0x12'));var logger=require(_0x879a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x879a('0x14'));var licenseUtil=require(_0x879a('0x15'));var db=require(_0x879a('0x16'))['db'];function respondWithStatusCode(_0x320115,_0x54a9b6){_0x54a9b6=_0x54a9b6||0xcc;return function(_0x4738b4){if(_0x4738b4){return _0x320115[_0x879a('0x17')](_0x54a9b6);}return _0x320115[_0x879a('0x18')](_0x54a9b6)[_0x879a('0x19')]();};}function respondWithResult(_0x1a20c5,_0x1c2853){_0x1c2853=_0x1c2853||0xc8;return function(_0x461f1e){if(_0x461f1e){return _0x1a20c5[_0x879a('0x18')](_0x1c2853)[_0x879a('0x1a')](_0x461f1e);}};}function respondWithFilteredResult(_0x16b649,_0x5b4dbe){return function(_0x4a1e0e){if(_0x4a1e0e){var _0x3b8680=_0x4a1e0e[_0x879a('0x1b')],_0x1c1f08=_0x5b4dbe[_0x879a('0x1c')],_0x4b1f67=_0x5b4dbe[_0x879a('0x1c')]+_0x5b4dbe[_0x879a('0x1d')],_0x119260;if(_0x4b1f67>=_0x3b8680){_0x4b1f67=_0x3b8680;_0x119260=0xc8;}else{_0x119260=0xce;}_0x16b649[_0x879a('0x18')](_0x119260);return _0x16b649[_0x879a('0x1e')](_0x879a('0x1f'),_0x1c1f08+'-'+_0x4b1f67+'/'+_0x3b8680)[_0x879a('0x1a')](_0x4a1e0e);}return null;};}function patchUpdates(_0x12b1f9){return function(_0x14241a){try{jsonpatch[_0x879a('0x20')](_0x14241a,_0x12b1f9,!![]);}catch(_0x18b3d2){return BPromise[_0x879a('0x21')](_0x18b3d2);}return _0x14241a['save']();};}function saveUpdates(_0x830b36,_0x326e6a){return function(_0x4a8adf){if(_0x4a8adf){return _0x4a8adf[_0x879a('0x22')](_0x830b36)[_0x879a('0x23')](function(_0x4dd092){return _0x4dd092;});}return null;};}function removeEntity(_0x56e394,_0x4ed0d6){return function(_0x28c401){if(_0x28c401){return _0x28c401[_0x879a('0x24')]()[_0x879a('0x23')](function(){_0x56e394[_0x879a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c21e2,_0x3674f9){return function(_0x1be65f){if(!_0x1be65f){_0x5c21e2[_0x879a('0x17')](0x194);}return _0x1be65f;};}function handleError(_0x259ad3,_0x88e92f){_0x88e92f=_0x88e92f||0x1f4;return function(_0x1dd818){logger[_0x879a('0x25')](_0x1dd818[_0x879a('0x26')]);if(_0x1dd818[_0x879a('0x27')]){delete _0x1dd818[_0x879a('0x27')];}_0x259ad3[_0x879a('0x18')](_0x88e92f)[_0x879a('0x28')](_0x1dd818);};}exports[_0x879a('0x29')]=function(_0x583b5c,_0x51a665){var _0x2cd769={},_0x92c805={},_0x39d0c9={'count':0x0,'rows':[]};var _0x20b1d5=_[_0x879a('0x2a')](db[_0x879a('0x2b')][_0x879a('0x2c')],function(_0x3ca5cd){return{'name':_0x3ca5cd[_0x879a('0x2d')],'type':_0x3ca5cd[_0x879a('0x2e')][_0x879a('0x2f')]};});_0x92c805[_0x879a('0x30')]=_[_0x879a('0x2a')](_0x20b1d5,_0x879a('0x27'));_0x92c805[_0x879a('0x31')]=_[_0x879a('0x32')](_0x583b5c[_0x879a('0x31')]);_0x92c805['filters']=_[_0x879a('0x33')](_0x92c805['model'],_0x92c805[_0x879a('0x31')]);_0x2cd769[_0x879a('0x34')]=_[_0x879a('0x33')](_0x92c805['model'],qs[_0x879a('0x35')](_0x583b5c['query']['fields']));_0x2cd769['attributes']=_0x2cd769['attributes'][_0x879a('0x36')]?_0x2cd769[_0x879a('0x34')]:_0x92c805['model'];if(!_0x583b5c[_0x879a('0x31')][_0x879a('0x37')](_0x879a('0x38'))){_0x2cd769['limit']=qs[_0x879a('0x1d')](_0x583b5c[_0x879a('0x31')][_0x879a('0x1d')]);_0x2cd769[_0x879a('0x1c')]=qs['offset'](_0x583b5c[_0x879a('0x31')][_0x879a('0x1c')]);}_0x2cd769[_0x879a('0x39')]=qs[_0x879a('0x3a')](_0x583b5c['query'][_0x879a('0x3a')]);_0x2cd769['where']=qs[_0x879a('0x3b')](_['pick'](_0x583b5c[_0x879a('0x31')],_0x92c805[_0x879a('0x3b')]),_0x20b1d5);if(_0x583b5c['query'][_0x879a('0x3c')]){_0x2cd769[_0x879a('0x3d')]=_[_0x879a('0x3e')](_0x2cd769[_0x879a('0x3d')],{'$or':_['map'](_0x20b1d5,function(_0x26d0ee){if(_0x26d0ee[_0x879a('0x2e')]!==_0x879a('0x3f')){var _0x50734c={};_0x50734c[_0x26d0ee['name']]={'$like':'%'+_0x583b5c['query']['filter']+'%'};return _0x50734c;}})});}_0x2cd769=_['merge']({},_0x2cd769,_0x583b5c[_0x879a('0x40')]);var _0x142bdc={'where':_0x2cd769[_0x879a('0x3d')]};return db['FaxTransferReport']['count'](_0x142bdc)['then'](function(_0x44cff6){_0x39d0c9['count']=_0x44cff6;if(_0x583b5c[_0x879a('0x31')][_0x879a('0x41')]){_0x2cd769[_0x879a('0x42')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x2cd769);})[_0x879a('0x23')](function(_0x5252ae){_0x39d0c9[_0x879a('0x43')]=_0x5252ae;return _0x39d0c9;})[_0x879a('0x23')](respondWithFilteredResult(_0x51a665,_0x2cd769))['catch'](handleError(_0x51a665,null));};exports[_0x879a('0x44')]=function(_0x4197a9,_0x2cc43c){var _0x56d802={'raw':!![],'where':{'id':_0x4197a9[_0x879a('0x45')]['id']}},_0x18c13b={};_0x18c13b['model']=_[_0x879a('0x32')](db[_0x879a('0x2b')]['rawAttributes']);_0x18c13b[_0x879a('0x31')]=_[_0x879a('0x32')](_0x4197a9[_0x879a('0x31')]);_0x18c13b[_0x879a('0x3b')]=_['intersection'](_0x18c13b[_0x879a('0x30')],_0x18c13b['query']);_0x56d802[_0x879a('0x34')]=_['intersection'](_0x18c13b[_0x879a('0x30')],qs['fields'](_0x4197a9[_0x879a('0x31')][_0x879a('0x35')]));_0x56d802[_0x879a('0x34')]=_0x56d802[_0x879a('0x34')][_0x879a('0x36')]?_0x56d802[_0x879a('0x34')]:_0x18c13b['model'];if(_0x4197a9[_0x879a('0x31')][_0x879a('0x41')]){_0x56d802[_0x879a('0x42')]=[{'all':!![]}];}_0x56d802=_['merge']({},_0x56d802,_0x4197a9[_0x879a('0x40')]);return db[_0x879a('0x2b')][_0x879a('0x46')](_0x56d802)['then'](handleEntityNotFound(_0x2cc43c,null))[_0x879a('0x23')](respondWithResult(_0x2cc43c,null))[_0x879a('0x47')](handleError(_0x2cc43c,null));};exports[_0x879a('0x48')]=function(_0x85bd60,_0x500f98){return db['FaxTransferReport'][_0x879a('0x48')](_0x85bd60[_0x879a('0x49')],{})['then'](respondWithResult(_0x500f98,0xc9))[_0x879a('0x47')](handleError(_0x500f98,null));};exports[_0x879a('0x22')]=function(_0x48f92a,_0x1278b3){if(_0x48f92a[_0x879a('0x49')]['id']){delete _0x48f92a[_0x879a('0x49')]['id'];}return db[_0x879a('0x2b')]['find']({'where':{'id':_0x48f92a[_0x879a('0x45')]['id']}})[_0x879a('0x23')](handleEntityNotFound(_0x1278b3,null))[_0x879a('0x23')](saveUpdates(_0x48f92a['body'],null))['then'](respondWithResult(_0x1278b3,null))[_0x879a('0x47')](handleError(_0x1278b3,null));};exports[_0x879a('0x24')]=function(_0x524f1c,_0x1797f2){return db[_0x879a('0x2b')][_0x879a('0x46')]({'where':{'id':_0x524f1c['params']['id']}})[_0x879a('0x23')](handleEntityNotFound(_0x1797f2,null))[_0x879a('0x23')](removeEntity(_0x1797f2,null))[_0x879a('0x47')](handleError(_0x1797f2,null));};exports[_0x879a('0x4a')]=function(_0x4b1796,_0x3ca83c){return db[_0x879a('0x2b')]['describe']()[_0x879a('0x23')](respondWithResult(_0x3ca83c,null))[_0x879a('0x47')](handleError(_0x3ca83c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index b3440b9..96d6ce0 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 _0x4ff2=['api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x1807b3,_0x18cd2f){var _0x9dd87=function(_0x2605a0){while(--_0x2605a0){_0x1807b3['push'](_0x1807b3['shift']());}};_0x9dd87(++_0x18cd2f);}(_0x4ff2,0x177));var _0x24ff=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0x4ff2[_0x4b1665];return _0x5850c0;};'use strict';var _=require(_0x24ff('0x0'));var util=require(_0x24ff('0x1'));var logger=require('../../config/logger')(_0x24ff('0x2'));var moment=require('moment');var BPromise=require(_0x24ff('0x3'));var rp=require(_0x24ff('0x4'));var fs=require('fs');var path=require(_0x24ff('0x5'));var rimraf=require(_0x24ff('0x6'));var config=require(_0x24ff('0x7'));var attributes=require(_0x24ff('0x8'));module['exports']=function(_0x526bd7,_0x43eede){return _0x526bd7[_0x24ff('0x9')](_0x24ff('0xa'),attributes,{'tableName':_0x24ff('0xb'),'paranoid':![],'indexes':[{'name':_0x24ff('0xc'),'fields':[_0x24ff('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22ea=['./faxTransferReport.attributes','exports','define','FaxTransferReport','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0x22ea,0x117));var _0xa22e=function(_0x385a20,_0x5848d4){_0x385a20=_0x385a20-0x0;var _0x1dd11a=_0x22ea[_0x385a20];return _0x1dd11a;};'use strict';var _=require('lodash');var util=require(_0xa22e('0x0'));var logger=require(_0xa22e('0x1'))(_0xa22e('0x2'));var moment=require(_0xa22e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa22e('0x4'));var fs=require('fs');var path=require(_0xa22e('0x5'));var rimraf=require(_0xa22e('0x6'));var config=require('../../config/environment');var attributes=require(_0xa22e('0x7'));module[_0xa22e('0x8')]=function(_0x353005,_0x211b56){return _0x353005[_0xa22e('0x9')](_0xa22e('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f1cc6d3..f3fbeaf 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 _0xeb0d=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xeb0d,0x1ac));var _0xdeb0=function(_0xfc3140,_0x136d1f){_0xfc3140=_0xfc3140-0x0;var _0x17c6a1=_0xeb0d[_0xfc3140];return _0x17c6a1;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rs=require(_0xdeb0('0x3'));var fs=require('fs');var Redis=require(_0xdeb0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb0('0x5'));var logger=require(_0xdeb0('0x6'))('rpc');var config=require(_0xdeb0('0x7'));var jayson=require(_0xdeb0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb10051,_0x484cf6,_0x129e75){return new BPromise(function(_0x5d9a2c,_0x3fbe6e){return client[_0xdeb0('0x9')](_0xb10051,_0x129e75)[_0xdeb0('0xa')](function(_0x1262ee){logger[_0xdeb0('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x484cf6,_0xdeb0('0xc'));logger[_0xdeb0('0xd')](_0xdeb0('0xe'),_0x484cf6,_0xdeb0('0xc'),JSON[_0xdeb0('0xf')](_0x1262ee));if(_0x1262ee[_0xdeb0('0x10')]){if(_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x11')]===0x1f4){logger[_0xdeb0('0x10')](_0xdeb0('0x12'),_0x484cf6,_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);return _0x3fbe6e(_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);}logger[_0xdeb0('0x10')](_0xdeb0('0x12'),_0x484cf6,_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);return _0x5d9a2c(_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);}else{logger[_0xdeb0('0xb')](_0xdeb0('0x12'),_0x484cf6,_0xdeb0('0xc'));_0x5d9a2c(_0x1262ee[_0xdeb0('0x14')][_0xdeb0('0x13')]);}})[_0xdeb0('0x15')](function(_0x3e1b00){logger['error'](_0xdeb0('0x12'),_0x484cf6,_0x3e1b00);_0x3fbe6e(_0x3e1b00);});});} \ No newline at end of file +var _0x140b=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x2a0c9c,_0x3cb18d){var _0x20148c=function(_0x11a449){while(--_0x11a449){_0x2a0c9c['push'](_0x2a0c9c['shift']());}};_0x20148c(++_0x3cb18d);}(_0x140b,0x194));var _0xb140=function(_0x19f309,_0x5b1672){_0x19f309=_0x19f309-0x0;var _0x53a156=_0x140b[_0x19f309];return _0x53a156;};'use strict';var _=require('lodash');var util=require(_0xb140('0x0'));var moment=require(_0xb140('0x1'));var BPromise=require(_0xb140('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb140('0x3'));var db=require(_0xb140('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb140('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb140('0x6'));var client=jayson[_0xb140('0x7')][_0xb140('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c549b,_0x3ff41d,_0x78c4ab){return new BPromise(function(_0x135f48,_0x1ea761){return client[_0xb140('0x9')](_0x2c549b,_0x78c4ab)['then'](function(_0x582cd7){logger[_0xb140('0xa')](_0xb140('0xb'),_0x3ff41d,_0xb140('0xc'));logger[_0xb140('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3ff41d,'request\x20sent',JSON[_0xb140('0xe')](_0x582cd7));if(_0x582cd7[_0xb140('0xf')]){if(_0x582cd7['error']['code']===0x1f4){logger['error'](_0xb140('0xb'),_0x3ff41d,_0x582cd7[_0xb140('0xf')][_0xb140('0x10')]);return _0x1ea761(_0x582cd7['error'][_0xb140('0x10')]);}logger['error'](_0xb140('0xb'),_0x3ff41d,_0x582cd7[_0xb140('0xf')][_0xb140('0x10')]);return _0x135f48(_0x582cd7[_0xb140('0xf')]['message']);}else{logger[_0xb140('0xa')](_0xb140('0xb'),_0x3ff41d,_0xb140('0xc'));_0x135f48(_0x582cd7[_0xb140('0x11')][_0xb140('0x10')]);}})['catch'](function(_0x1e8f09){logger[_0xb140('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3ff41d,_0x1e8f09);_0x1ea761(_0x1e8f09);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index dcca4ce..a955c2e 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 _0x3fe8=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x38badf,_0x4776b8){var _0x20f1f9=function(_0x55edda){while(--_0x55edda){_0x38badf['push'](_0x38badf['shift']());}};_0x20f1f9(++_0x4776b8);}(_0x3fe8,0xaf));var _0x83fe=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x3fe8[_0x4bfade];return _0x272465;};'use strict';var multer=require('multer');var util=require(_0x83fe('0x0'));var path=require(_0x83fe('0x1'));var timeout=require(_0x83fe('0x2'));var express=require('express');var router=express[_0x83fe('0x3')]();var auth=require(_0x83fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x83fe('0x5'));var controller=require(_0x83fe('0x6'));router[_0x83fe('0x7')]('/',auth[_0x83fe('0x8')](),controller[_0x83fe('0x9')]);router['get'](_0x83fe('0xa'),auth[_0x83fe('0x8')](),controller['describe']);router[_0x83fe('0x7')]('/:id',auth[_0x83fe('0x8')](),controller['show']);router[_0x83fe('0xb')]('/',auth[_0x83fe('0x8')](),controller[_0x83fe('0xc')]);router[_0x83fe('0xd')](_0x83fe('0xe'),auth['isAuthenticated'](),controller[_0x83fe('0xf')]);router['delete'](_0x83fe('0xe'),auth[_0x83fe('0x8')](),controller[_0x83fe('0x10')]);module[_0x83fe('0x11')]=router; \ No newline at end of file +var _0x9378=['multer','util','path','connect-timeout','Router','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0xdad447,_0x5c617f){var _0x3cd2b8=function(_0x2d0576){while(--_0x2d0576){_0xdad447['push'](_0xdad447['shift']());}};_0x3cd2b8(++_0x5c617f);}(_0x9378,0x104));var _0x8937=function(_0x1d1faa,_0x2c73da){_0x1d1faa=_0x1d1faa-0x0;var _0x5f1ca=_0x9378[_0x1d1faa];return _0x5f1ca;};'use strict';var multer=require(_0x8937('0x0'));var util=require(_0x8937('0x1'));var path=require(_0x8937('0x2'));var timeout=require(_0x8937('0x3'));var express=require('express');var router=express[_0x8937('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8937('0x5'));var controller=require(_0x8937('0x6'));router[_0x8937('0x7')]('/',auth['isAuthenticated'](),controller[_0x8937('0x8')]);router[_0x8937('0x7')](_0x8937('0x9'),auth[_0x8937('0xa')](),controller[_0x8937('0xb')]);router['get'](_0x8937('0xc'),auth[_0x8937('0xa')](),controller[_0x8937('0xd')]);router[_0x8937('0xe')]('/',auth[_0x8937('0xa')](),controller[_0x8937('0xf')]);router['put'](_0x8937('0xc'),auth[_0x8937('0xa')](),controller[_0x8937('0x10')]);router[_0x8937('0x11')](_0x8937('0xc'),auth[_0x8937('0xa')](),controller[_0x8937('0x12')]);module[_0x8937('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 67e32b5..562eb5a 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 _0xd9bf=['addConfiguration','delete','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations'];(function(_0x36cba4,_0x53a452){var _0xcc6047=function(_0x20b2a5){while(--_0x20b2a5){_0x36cba4['push'](_0x36cba4['shift']());}};_0xcc6047(++_0x53a452);}(_0xd9bf,0x159));var _0xfd9b=function(_0x4c394e,_0x2892cb){_0x4c394e=_0x4c394e-0x0;var _0x1866ce=_0xd9bf[_0x4c394e];return _0x1866ce;};'use strict';var multer=require('multer');var util=require(_0xfd9b('0x0'));var path=require('path');var timeout=require(_0xfd9b('0x1'));var express=require(_0xfd9b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfd9b('0x3'));var config=require(_0xfd9b('0x4'));var controller=require(_0xfd9b('0x5'));router['get']('/',auth[_0xfd9b('0x6')](),controller[_0xfd9b('0x7')]);router[_0xfd9b('0x8')](_0xfd9b('0x9'),auth[_0xfd9b('0x6')](),controller[_0xfd9b('0xa')]);router[_0xfd9b('0x8')]('/:id/configurations',auth[_0xfd9b('0x6')](),controller[_0xfd9b('0xb')]);router['get'](_0xfd9b('0xc'),auth[_0xfd9b('0x6')](),controller[_0xfd9b('0xd')]);router[_0xfd9b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfd9b('0xe')](_0xfd9b('0xf'),auth['isAuthenticated'](),controller[_0xfd9b('0x10')]);router['put'](_0xfd9b('0x9'),auth[_0xfd9b('0x6')](),controller['update']);router[_0xfd9b('0x11')](_0xfd9b('0x9'),auth[_0xfd9b('0x6')](),controller['destroy']);module[_0xfd9b('0x12')]=router; \ No newline at end of file +var _0x2030=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0x64707d,_0x33521a){var _0x379100=function(_0x53a450){while(--_0x53a450){_0x64707d['push'](_0x64707d['shift']());}};_0x379100(++_0x33521a);}(_0x2030,0xdf));var _0x0203=function(_0x3efa55,_0x3afadb){_0x3efa55=_0x3efa55-0x0;var _0x547f89=_0x2030[_0x3efa55];return _0x547f89;};'use strict';var multer=require(_0x0203('0x0'));var util=require(_0x0203('0x1'));var path=require(_0x0203('0x2'));var timeout=require(_0x0203('0x3'));var express=require(_0x0203('0x4'));var router=express[_0x0203('0x5')]();var auth=require(_0x0203('0x6'));var interaction=require(_0x0203('0x7'));var config=require(_0x0203('0x8'));var controller=require(_0x0203('0x9'));router[_0x0203('0xa')]('/',auth[_0x0203('0xb')](),controller[_0x0203('0xc')]);router[_0x0203('0xa')](_0x0203('0xd'),auth[_0x0203('0xb')](),controller[_0x0203('0xe')]);router[_0x0203('0xa')](_0x0203('0xf'),auth[_0x0203('0xb')](),controller[_0x0203('0x10')]);router[_0x0203('0xa')](_0x0203('0x11'),auth[_0x0203('0xb')](),controller[_0x0203('0x12')]);router[_0x0203('0x13')]('/',auth['isAuthenticated'](),controller[_0x0203('0x14')]);router[_0x0203('0x13')](_0x0203('0xf'),auth[_0x0203('0xb')](),controller[_0x0203('0x15')]);router[_0x0203('0x16')](_0x0203('0xd'),auth[_0x0203('0xb')](),controller[_0x0203('0x17')]);router[_0x0203('0x18')](_0x0203('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0203('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7a40030..ba37db0 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 _0xccde=['newTab','sequelize','STRING','basic','ENUM','integrationTab'];(function(_0x4c03ea,_0x3465be){var _0x7a6922=function(_0xd50354){while(--_0xd50354){_0x4c03ea['push'](_0x4c03ea['shift']());}};_0x7a6922(++_0x3465be);}(_0xccde,0x1e1));var _0xeccd=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0xccde[_0x188a93];return _0x23b40d;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'name':{'type':Sequelize[_0xeccd('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeccd('0x1')]},'remoteUri':{'type':Sequelize[_0xeccd('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xeccd('0x2')},'password':{'type':Sequelize[_0xeccd('0x1')]},'consumerKey':{'type':Sequelize[_0xeccd('0x1')]},'consumerSecret':{'type':Sequelize[_0xeccd('0x1')]},'token':{'type':Sequelize[_0xeccd('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xeccd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeccd('0x3')](_0xeccd('0x4'),_0xeccd('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x1775=['newTab','exports','STRING','ENUM','basic','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'name':{'type':Sequelize[_0x5177('0x1')]},'description':{'type':Sequelize[_0x5177('0x1')]},'username':{'type':Sequelize[_0x5177('0x1')]},'remoteUri':{'type':Sequelize[_0x5177('0x1')]},'authType':{'type':Sequelize[_0x5177('0x2')](_0x5177('0x3')),'defaultValue':_0x5177('0x3')},'password':{'type':Sequelize[_0x5177('0x1')]},'consumerKey':{'type':Sequelize[_0x5177('0x1')]},'consumerSecret':{'type':Sequelize[_0x5177('0x1')]},'token':{'type':Sequelize[_0x5177('0x1')]},'tokenSecret':{'type':Sequelize[_0x5177('0x1')]},'serverUrl':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5177('0x2')](_0x5177('0x4'),_0x5177('0x5')),'defaultValue':_0x5177('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index e1b67d1..fd68403 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 _0x4168=['keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','options','count','includeAll','findAll','rows','params','length','find','create','body','findOne','DeskConfiguration','order','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','consumerSecret','token','tokenSecret','remoteUri','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','username','password','toString','base64','concat','entries','active','label','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','set','Content-Range','apply','save','update','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query'];(function(_0x1b9cd5,_0x103dc4){var _0x4c74ca=function(_0x460b5e){while(--_0x460b5e){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x4c74ca(++_0x103dc4);}(_0x4168,0xb0));var _0x8416=function(_0x4ea95f,_0x505ead){_0x4ea95f=_0x4ea95f-0x0;var _0x1addb1=_0x4168[_0x4ea95f];return _0x1addb1;};'use strict';var pdf=require(_0x8416('0x0'));var emlformat=require(_0x8416('0x1'));var rimraf=require(_0x8416('0x2'));var zipdir=require(_0x8416('0x3'));var jsonpatch=require(_0x8416('0x4'));var rp=require(_0x8416('0x5'));var moment=require(_0x8416('0x6'));var BPromise=require(_0x8416('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8416('0x8'));var sox=require(_0x8416('0x9'));var csv=require('to-csv');var ejs=require(_0x8416('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8416('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8416('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8416('0xd'));var authService=require(_0x8416('0xe'));var qs=require(_0x8416('0xf'));var as=require(_0x8416('0x10'));var hardwareService=require(_0x8416('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8416('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8416('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8416('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x8416('0x15')][_0x8416('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xa7f9b4,_0x4e9563,_0x49eb4e,_0x32da5f){return new BPromise(function(_0x4d35a2,_0x389093){var _0xf8ca7a=_0x32da5f||client;return _0xf8ca7a[_0x8416('0x17')](_0xa7f9b4,_0x49eb4e)[_0x8416('0x18')](function(_0x2b7cd3){logger[_0x8416('0x19')]('DeskAccount,\x20%s,\x20%s',_0x4e9563,_0x8416('0x1a'));logger[_0x8416('0x1b')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4e9563,_0x8416('0x1a'),JSON[_0x8416('0x1c')](_0x2b7cd3));if(_0x2b7cd3[_0x8416('0x1d')]){if(_0x2b7cd3[_0x8416('0x1d')][_0x8416('0x1e')]===0x1f4){logger[_0x8416('0x1d')](_0x8416('0x1f'),_0x4e9563,_0x2b7cd3['error'][_0x8416('0x20')]);return _0x389093(_0x2b7cd3[_0x8416('0x1d')][_0x8416('0x20')]);}logger[_0x8416('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x4e9563,_0x2b7cd3[_0x8416('0x1d')][_0x8416('0x20')]);return _0x4d35a2(_0x2b7cd3[_0x8416('0x1d')]['message']);}else{logger[_0x8416('0x19')](_0x8416('0x1f'),_0x4e9563,_0x8416('0x1a'));_0x4d35a2(_0x2b7cd3['result'][_0x8416('0x20')]);}})[_0x8416('0x21')](function(_0x2d565d){logger[_0x8416('0x1d')](_0x8416('0x1f'),_0x4e9563,_0x2d565d);_0x389093(_0x2d565d);});});}function respondWithStatusCode(_0x2aab53,_0x35af82){_0x35af82=_0x35af82||0xcc;return function(_0x83b23c){if(_0x83b23c){return _0x2aab53[_0x8416('0x22')](_0x35af82);}return _0x2aab53['status'](_0x35af82)[_0x8416('0x23')]();};}function respondWithResult(_0x15b7bd,_0x415a94){_0x415a94=_0x415a94||0xc8;return function(_0x29794d){if(_0x29794d){return _0x15b7bd[_0x8416('0x24')](_0x415a94)[_0x8416('0x25')](_0x29794d);}};}function respondWithFilteredResult(_0x52ec68,_0x40974f){return function(_0xdab763){if(_0xdab763){var _0x23fd8b=_0xdab763['count'],_0x25dd28=_0x40974f['offset'],_0x557a6c=_0x40974f['offset']+_0x40974f['limit'],_0x253b08;if(_0x557a6c>=_0x23fd8b){_0x557a6c=_0x23fd8b;_0x253b08=0xc8;}else{_0x253b08=0xce;}_0x52ec68[_0x8416('0x24')](_0x253b08);return _0x52ec68[_0x8416('0x26')](_0x8416('0x27'),_0x25dd28+'-'+_0x557a6c+'/'+_0x23fd8b)['json'](_0xdab763);}return null;};}function patchUpdates(_0x3bbde6){return function(_0x4ee305){try{jsonpatch[_0x8416('0x28')](_0x4ee305,_0x3bbde6,!![]);}catch(_0x4e4005){return BPromise['reject'](_0x4e4005);}return _0x4ee305[_0x8416('0x29')]();};}function saveUpdates(_0x55e657,_0x289dc8){return function(_0x5de4f7){if(_0x5de4f7){return _0x5de4f7[_0x8416('0x2a')](_0x55e657)[_0x8416('0x18')](function(_0x51eed9){return _0x51eed9;});}return null;};}function removeEntity(_0x55a5fe,_0xa9f0ef){return function(_0x532278){if(_0x532278){return _0x532278[_0x8416('0x2b')]()[_0x8416('0x18')](function(){_0x55a5fe[_0x8416('0x24')](0xcc)[_0x8416('0x23')]();});}};}function handleEntityNotFound(_0xa90969,_0x24445f){return function(_0x2bfc6a){if(!_0x2bfc6a){_0xa90969[_0x8416('0x22')](0x194);}return _0x2bfc6a;};}function handleError(_0x5ca601,_0x6619c6){_0x6619c6=_0x6619c6||0x1f4;return function(_0x147247){logger[_0x8416('0x1d')](_0x147247['stack']);if(_0x147247[_0x8416('0x2c')]){delete _0x147247[_0x8416('0x2c')];}_0x5ca601[_0x8416('0x24')](_0x6619c6)[_0x8416('0x2d')](_0x147247);};}exports[_0x8416('0x2e')]=function(_0x4ffa2f,_0x1d8b87){var _0x5a0f15={},_0x129d8a={},_0xdc513c={'count':0x0,'rows':[]};var _0x4f4170=_[_0x8416('0x2f')](db[_0x8416('0x30')][_0x8416('0x31')],function(_0x46ea79){return{'name':_0x46ea79[_0x8416('0x32')],'type':_0x46ea79[_0x8416('0x33')][_0x8416('0x34')]};});_0x129d8a['model']=_[_0x8416('0x2f')](_0x4f4170,_0x8416('0x2c'));_0x129d8a[_0x8416('0x35')]=_[_0x8416('0x36')](_0x4ffa2f[_0x8416('0x35')]);_0x129d8a[_0x8416('0x37')]=_[_0x8416('0x38')](_0x129d8a[_0x8416('0x39')],_0x129d8a[_0x8416('0x35')]);_0x5a0f15['attributes']=_['intersection'](_0x129d8a[_0x8416('0x39')],qs[_0x8416('0x3a')](_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3a')]));_0x5a0f15[_0x8416('0x3b')]=_0x5a0f15[_0x8416('0x3b')]['length']?_0x5a0f15[_0x8416('0x3b')]:_0x129d8a[_0x8416('0x39')];if(!_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3c')](_0x8416('0x3d'))){_0x5a0f15[_0x8416('0x3e')]=qs[_0x8416('0x3e')](_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3e')]);_0x5a0f15[_0x8416('0x3f')]=qs[_0x8416('0x3f')](_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3f')]);}_0x5a0f15['order']=qs[_0x8416('0x40')](_0x4ffa2f['query'][_0x8416('0x40')]);_0x5a0f15[_0x8416('0x41')]=qs['filters'](_[_0x8416('0x42')](_0x4ffa2f['query'],_0x129d8a[_0x8416('0x37')]),_0x4f4170);if(_0x4ffa2f['query']['filter']){_0x5a0f15[_0x8416('0x41')]=_[_0x8416('0x43')](_0x5a0f15['where'],{'$or':_[_0x8416('0x2f')](_0x4f4170,function(_0x3e8e8c){if(_0x3e8e8c[_0x8416('0x33')]!=='VIRTUAL'){var _0x592e7d={};_0x592e7d[_0x3e8e8c[_0x8416('0x2c')]]={'$like':'%'+_0x4ffa2f[_0x8416('0x35')]['filter']+'%'};return _0x592e7d;}})});}_0x5a0f15=_[_0x8416('0x43')]({},_0x5a0f15,_0x4ffa2f[_0x8416('0x44')]);var _0x17d585={'where':_0x5a0f15[_0x8416('0x41')]};return db[_0x8416('0x30')][_0x8416('0x45')](_0x17d585)[_0x8416('0x18')](function(_0x2b0a7e){_0xdc513c[_0x8416('0x45')]=_0x2b0a7e;if(_0x4ffa2f[_0x8416('0x35')][_0x8416('0x46')]){_0x5a0f15['include']=[{'all':!![]}];}return db[_0x8416('0x30')][_0x8416('0x47')](_0x5a0f15);})[_0x8416('0x18')](function(_0x3196a2){_0xdc513c[_0x8416('0x48')]=_0x3196a2;return _0xdc513c;})[_0x8416('0x18')](respondWithFilteredResult(_0x1d8b87,_0x5a0f15))[_0x8416('0x21')](handleError(_0x1d8b87,null));};exports['show']=function(_0x501cde,_0x38c148){var _0x16ca3c={'raw':![],'where':{'id':_0x501cde[_0x8416('0x49')]['id']}},_0x2200cf={};_0x2200cf[_0x8416('0x39')]=_['keys'](db[_0x8416('0x30')]['rawAttributes']);_0x2200cf[_0x8416('0x35')]=_['keys'](_0x501cde[_0x8416('0x35')]);_0x2200cf[_0x8416('0x37')]=_[_0x8416('0x38')](_0x2200cf[_0x8416('0x39')],_0x2200cf['query']);_0x16ca3c[_0x8416('0x3b')]=_['intersection'](_0x2200cf[_0x8416('0x39')],qs[_0x8416('0x3a')](_0x501cde[_0x8416('0x35')][_0x8416('0x3a')]));_0x16ca3c[_0x8416('0x3b')]=_0x16ca3c[_0x8416('0x3b')][_0x8416('0x4a')]?_0x16ca3c[_0x8416('0x3b')]:_0x2200cf[_0x8416('0x39')];if(_0x501cde[_0x8416('0x35')][_0x8416('0x46')]){_0x16ca3c['include']=[{'all':!![]}];}_0x16ca3c=_[_0x8416('0x43')]({},_0x16ca3c,_0x501cde['options']);return db[_0x8416('0x30')][_0x8416('0x4b')](_0x16ca3c)[_0x8416('0x18')](handleEntityNotFound(_0x38c148,null))['then'](respondWithResult(_0x38c148,null))[_0x8416('0x21')](handleError(_0x38c148,null));};exports[_0x8416('0x4c')]=function(_0x2861fa,_0x41ca42){return db[_0x8416('0x30')][_0x8416('0x4c')](_0x2861fa[_0x8416('0x4d')],{})[_0x8416('0x18')](respondWithResult(_0x41ca42,0xc9))[_0x8416('0x21')](handleError(_0x41ca42,null));};exports[_0x8416('0x2a')]=function(_0x26d9f2,_0x1d9a02){if(_0x26d9f2['body']['id']){delete _0x26d9f2[_0x8416('0x4d')]['id'];}return db[_0x8416('0x30')][_0x8416('0x4b')]({'where':{'id':_0x26d9f2['params']['id']}})[_0x8416('0x18')](handleEntityNotFound(_0x1d9a02,null))[_0x8416('0x18')](saveUpdates(_0x26d9f2['body'],null))[_0x8416('0x18')](respondWithResult(_0x1d9a02,null))[_0x8416('0x21')](handleError(_0x1d9a02,null));};exports[_0x8416('0x2b')]=function(_0x5cb14a,_0x2ea87a){return db[_0x8416('0x30')]['find']({'where':{'id':_0x5cb14a[_0x8416('0x49')]['id']}})[_0x8416('0x18')](handleEntityNotFound(_0x2ea87a,null))[_0x8416('0x18')](removeEntity(_0x2ea87a,null))[_0x8416('0x21')](handleError(_0x2ea87a,null));};exports['getConfigurations']=function(_0x188240,_0x14ff1a,_0x38901e){var _0x5c9fa7={};var _0x384c25={};var _0x1eea45;var _0x978251;return db[_0x8416('0x30')][_0x8416('0x4e')]({'where':{'id':_0x188240[_0x8416('0x49')]['id']}})[_0x8416('0x18')](handleEntityNotFound(_0x14ff1a,null))['then'](function(_0x56b0ad){if(_0x56b0ad){_0x1eea45=_0x56b0ad;_0x384c25[_0x8416('0x39')]=_[_0x8416('0x36')](db[_0x8416('0x4f')][_0x8416('0x31')]);_0x384c25['query']=_[_0x8416('0x36')](_0x188240[_0x8416('0x35')]);_0x384c25[_0x8416('0x37')]=_[_0x8416('0x38')](_0x384c25[_0x8416('0x39')],_0x384c25[_0x8416('0x35')]);_0x5c9fa7[_0x8416('0x3b')]=_['intersection'](_0x384c25['model'],qs[_0x8416('0x3a')](_0x188240[_0x8416('0x35')][_0x8416('0x3a')]));_0x5c9fa7['attributes']=_0x5c9fa7[_0x8416('0x3b')][_0x8416('0x4a')]?_0x5c9fa7['attributes']:_0x384c25[_0x8416('0x39')];_0x5c9fa7[_0x8416('0x50')]=qs[_0x8416('0x40')](_0x188240['query'][_0x8416('0x40')]);_0x5c9fa7[_0x8416('0x41')]=qs[_0x8416('0x37')](_[_0x8416('0x42')](_0x188240['query'],_0x384c25[_0x8416('0x37')]));if(_0x188240[_0x8416('0x35')]['filter']){_0x5c9fa7['where']=_[_0x8416('0x43')](_0x5c9fa7['where'],{'$or':_['map'](_0x5c9fa7[_0x8416('0x3b')],function(_0x21d24c){var _0x563746={};_0x563746[_0x21d24c]={'$like':'%'+_0x188240[_0x8416('0x35')]['filter']+'%'};return _0x563746;})});}_0x5c9fa7=_[_0x8416('0x43')]({},_0x5c9fa7,_0x188240[_0x8416('0x44')]);return _0x1eea45[_0x8416('0x51')](_0x5c9fa7);}})[_0x8416('0x18')](function(_0x4ac7c6){if(_0x4ac7c6){_0x978251=_0x4ac7c6['length'];if(!_0x188240[_0x8416('0x35')][_0x8416('0x3c')](_0x8416('0x3d'))){_0x5c9fa7['limit']=qs[_0x8416('0x3e')](_0x188240[_0x8416('0x35')][_0x8416('0x3e')]);_0x5c9fa7[_0x8416('0x3f')]=qs['offset'](_0x188240['query']['offset']);}return _0x1eea45[_0x8416('0x51')](_0x5c9fa7);}})['then'](function(_0x4f8d67){if(_0x4f8d67){return _0x4f8d67?{'count':_0x978251,'rows':_0x4f8d67}:null;}})[_0x8416('0x18')](respondWithResult(_0x14ff1a,null))[_0x8416('0x21')](handleError(_0x14ff1a,null));};exports[_0x8416('0x52')]=function(_0x517423,_0x2dd703,_0x1e57c3){if(_0x517423[_0x8416('0x4d')]['id']){delete _0x517423[_0x8416('0x4d')]['id'];}return db[_0x8416('0x30')][_0x8416('0x4e')]({'where':{'id':_0x517423[_0x8416('0x49')]['id']}})['then'](handleEntityNotFound(_0x2dd703,null))[_0x8416('0x18')](function(_0x2e0523){if(_0x2e0523){_0x517423[_0x8416('0x4d')][_0x8416('0x53')]=_0x2e0523['id'];_0x517423[_0x8416('0x4d')]['Subjects']=integrations[_0x8416('0x54')](_0x517423['body']['channel'],_0x517423[_0x8416('0x4d')][_0x8416('0x33')]);_0x517423['body'][_0x8416('0x55')]=integrations[_0x8416('0x56')](_0x517423['body'][_0x8416('0x57')],_0x517423[_0x8416('0x4d')]['type']);return db[_0x8416('0x4f')][_0x8416('0x4c')](_0x517423[_0x8416('0x4d')],{'include':[{'model':db[_0x8416('0x58')],'as':'Subjects'},{'model':db[_0x8416('0x58')],'as':_0x8416('0x55')}]});}return null;})['then'](respondWithResult(_0x2dd703,null))[_0x8416('0x21')](handleError(_0x2dd703,null));};exports[_0x8416('0x59')]=function(_0x5ac190,_0x5ec75f,_0x1a1aea){var _0x4eded8=[{'name':'priority','label':_0x8416('0x5a'),'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 _0x46ea68='';return db[_0x8416('0x30')][_0x8416('0x4e')]({'where':{'id':_0x5ac190[_0x8416('0x49')]['id']},'attributes':['id','remoteUri','authType','username','password','consumerKey',_0x8416('0x5b'),_0x8416('0x5c'),_0x8416('0x5d')]})['then'](handleEntityNotFound(_0x5ec75f,null))[_0x8416('0x18')](function(_0x367126){if(_0x367126){_0x46ea68=_0x367126[_0x8416('0x5e')];var _0x588ee4=_0x46ea68['slice'](-0x1);if(_0x588ee4==='/'){_0x46ea68=_0x46ea68['substring'](0x0,_0x46ea68[_0x8416('0x5f')](_0x588ee4));}var _0x3f79b9={'method':_0x8416('0x60'),'uri':util[_0x8416('0x61')](_0x8416('0x62'),_0x46ea68),'headers':{'Content-Type':_0x8416('0x63'),'Accept':_0x8416('0x63')},'json':!![]};if(_0x367126[_0x8416('0x64')]===_0x8416('0x65')){_0x3f79b9[_0x8416('0x66')][_0x8416('0x67')]=util[_0x8416('0x61')]('Basic\x20%s',new Buffer(util[_0x8416('0x61')]('%s:%s',_0x367126[_0x8416('0x68')],_0x367126[_0x8416('0x69')]))[_0x8416('0x6a')](_0x8416('0x6b')));}return rp(_0x3f79b9)[_0x8416('0x18')](function(_0x42f902){return _0x4eded8[_0x8416('0x6c')](_[_0x8416('0x2f')](_0x42f902['_embedded'][_0x8416('0x6d')],function(_0x4f4039){return{'id':_0x4f4039[_0x8416('0x2c')],'name':_0x4f4039[_0x8416('0x2c')],'type':_0x4f4039['type'],'active':_0x4f4039[_0x8416('0x6e')],'label':_0x4f4039[_0x8416('0x6f')],'custom':!![]};}));});}})[_0x8416('0x18')](function(_0x210e5e){return{'count':_0x210e5e[_0x8416('0x4a')],'rows':_0x210e5e};})[_0x8416('0x18')](respondWithResult(_0x5ec75f,null))[_0x8416('0x21')](function(_0x862d95){var _0xe051e8=_0x5ac190[_0x8416('0x35')]['test']?0x1f4:_0x862d95[_0x8416('0x70')]||0x1f4;logger[_0x8416('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x8416('0x59'),_0xe051e8,JSON[_0x8416('0x1c')](_0x862d95));delete _0x862d95[_0x8416('0x2c')];if(_0xe051e8===0x191){_0xe051e8=0x190;}_0x5ec75f['status'](_0xe051e8)[_0x8416('0x2d')](_0x5ac190[_0x8416('0x35')][_0x8416('0x71')]?{'message':_0x8416('0x72'),'statusCode':_0x862d95[_0x8416('0x70')]}:_0x862d95);});}; \ No newline at end of file +var _0x9509=['channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','GET','%s/custom_fields','application/json','basic','headers','format','%s:%s','toString','base64','concat','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','then','info','request\x20sent','debug','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','stack','name','index','DeskAccount','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','count','includeAll','findAll','show','params','rawAttributes','length','find','create','body','findOne','DeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x573653,_0x104710){var _0x125f2f=function(_0x375956){while(--_0x375956){_0x573653['push'](_0x573653['shift']());}};_0x125f2f(++_0x104710);}(_0x9509,0x98));var _0x9950=function(_0xa9196f,_0xbce1db){_0xa9196f=_0xa9196f-0x0;var _0x2631e6=_0x9509[_0xa9196f];return _0x2631e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9950('0x0'));var rimraf=require(_0x9950('0x1'));var zipdir=require(_0x9950('0x2'));var jsonpatch=require(_0x9950('0x3'));var rp=require(_0x9950('0x4'));var moment=require(_0x9950('0x5'));var BPromise=require(_0x9950('0x6'));var Mustache=require(_0x9950('0x7'));var util=require(_0x9950('0x8'));var path=require('path');var sox=require(_0x9950('0x9'));var csv=require(_0x9950('0xa'));var ejs=require(_0x9950('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9950('0xc'));var crypto=require(_0x9950('0xd'));var jsforce=require(_0x9950('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9950('0xa'));var querystring=require(_0x9950('0xf'));var Papa=require(_0x9950('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9950('0x11'));var as=require(_0x9950('0x12'));var hardwareService=require(_0x9950('0x13'));var logger=require(_0x9950('0x14'))(_0x9950('0x15'));var utils=require(_0x9950('0x16'));var config=require(_0x9950('0x17'));var licenseUtil=require(_0x9950('0x18'));var db=require(_0x9950('0x19'))['db'];var integrations=require(_0x9950('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x9950('0x1b')][_0x9950('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xab9c1f,_0x2c03c9,_0x5f3d53,_0x4e4058){return new BPromise(function(_0x45b123,_0x1a75e5){var _0x1875a6=_0x4e4058||client;return _0x1875a6['request'](_0xab9c1f,_0x5f3d53)[_0x9950('0x1d')](function(_0x2b465d){logger[_0x9950('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x2c03c9,_0x9950('0x1f'));logger[_0x9950('0x20')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2c03c9,_0x9950('0x1f'),JSON[_0x9950('0x21')](_0x2b465d));if(_0x2b465d[_0x9950('0x22')]){if(_0x2b465d[_0x9950('0x22')][_0x9950('0x23')]===0x1f4){logger[_0x9950('0x22')]('DeskAccount,\x20%s,\x20%s',_0x2c03c9,_0x2b465d[_0x9950('0x22')][_0x9950('0x24')]);return _0x1a75e5(_0x2b465d[_0x9950('0x22')][_0x9950('0x24')]);}logger['error'](_0x9950('0x25'),_0x2c03c9,_0x2b465d[_0x9950('0x22')][_0x9950('0x24')]);return _0x45b123(_0x2b465d[_0x9950('0x22')]['message']);}else{logger['info'](_0x9950('0x25'),_0x2c03c9,_0x9950('0x1f'));_0x45b123(_0x2b465d[_0x9950('0x26')][_0x9950('0x24')]);}})[_0x9950('0x27')](function(_0x3e52eb){logger[_0x9950('0x22')](_0x9950('0x25'),_0x2c03c9,_0x3e52eb);_0x1a75e5(_0x3e52eb);});});}function respondWithStatusCode(_0x4a4b53,_0x314ec9){_0x314ec9=_0x314ec9||0xcc;return function(_0x3eb7e9){if(_0x3eb7e9){return _0x4a4b53[_0x9950('0x28')](_0x314ec9);}return _0x4a4b53[_0x9950('0x29')](_0x314ec9)[_0x9950('0x2a')]();};}function respondWithResult(_0x3fc76f,_0x500652){_0x500652=_0x500652||0xc8;return function(_0x46e882){if(_0x46e882){return _0x3fc76f['status'](_0x500652)[_0x9950('0x2b')](_0x46e882);}};}function respondWithFilteredResult(_0x1dee97,_0x2d3ce9){return function(_0xc5ecf0){if(_0xc5ecf0){var _0x23b22c=_0xc5ecf0['count'],_0x23e99f=_0x2d3ce9[_0x9950('0x2c')],_0xd8ef1=_0x2d3ce9[_0x9950('0x2c')]+_0x2d3ce9[_0x9950('0x2d')],_0x572d50;if(_0xd8ef1>=_0x23b22c){_0xd8ef1=_0x23b22c;_0x572d50=0xc8;}else{_0x572d50=0xce;}_0x1dee97[_0x9950('0x29')](_0x572d50);return _0x1dee97[_0x9950('0x2e')]('Content-Range',_0x23e99f+'-'+_0xd8ef1+'/'+_0x23b22c)['json'](_0xc5ecf0);}return null;};}function patchUpdates(_0x41d065){return function(_0x3eace7){try{jsonpatch[_0x9950('0x2f')](_0x3eace7,_0x41d065,!![]);}catch(_0x141e3c){return BPromise[_0x9950('0x30')](_0x141e3c);}return _0x3eace7['save']();};}function saveUpdates(_0x16f773,_0x2f21cb){return function(_0x262a20){if(_0x262a20){return _0x262a20[_0x9950('0x31')](_0x16f773)['then'](function(_0x1c2edf){return _0x1c2edf;});}return null;};}function removeEntity(_0xafe420,_0x459f5d){return function(_0x16dd47){if(_0x16dd47){return _0x16dd47[_0x9950('0x32')]()[_0x9950('0x1d')](function(){_0xafe420[_0x9950('0x29')](0xcc)[_0x9950('0x2a')]();});}};}function handleEntityNotFound(_0x23e117,_0x4d6e68){return function(_0x2e8395){if(!_0x2e8395){_0x23e117[_0x9950('0x28')](0x194);}return _0x2e8395;};}function handleError(_0xb88682,_0x15a831){_0x15a831=_0x15a831||0x1f4;return function(_0x48cadf){logger['error'](_0x48cadf[_0x9950('0x33')]);if(_0x48cadf['name']){delete _0x48cadf[_0x9950('0x34')];}_0xb88682[_0x9950('0x29')](_0x15a831)['send'](_0x48cadf);};}exports[_0x9950('0x35')]=function(_0x2327fc,_0x11e665){var _0x52d3b2={},_0xbceceb={},_0x225e0e={'count':0x0,'rows':[]};var _0x2044f6=_['map'](db[_0x9950('0x36')]['rawAttributes'],function(_0x451ddc){return{'name':_0x451ddc[_0x9950('0x37')],'type':_0x451ddc[_0x9950('0x38')][_0x9950('0x39')]};});_0xbceceb['model']=_['map'](_0x2044f6,_0x9950('0x34'));_0xbceceb[_0x9950('0x3a')]=_[_0x9950('0x3b')](_0x2327fc[_0x9950('0x3a')]);_0xbceceb['filters']=_[_0x9950('0x3c')](_0xbceceb['model'],_0xbceceb['query']);_0x52d3b2['attributes']=_['intersection'](_0xbceceb[_0x9950('0x3d')],qs[_0x9950('0x3e')](_0x2327fc['query'][_0x9950('0x3e')]));_0x52d3b2[_0x9950('0x3f')]=_0x52d3b2[_0x9950('0x3f')]['length']?_0x52d3b2[_0x9950('0x3f')]:_0xbceceb['model'];if(!_0x2327fc[_0x9950('0x3a')][_0x9950('0x40')]('nolimit')){_0x52d3b2[_0x9950('0x2d')]=qs[_0x9950('0x2d')](_0x2327fc['query'][_0x9950('0x2d')]);_0x52d3b2[_0x9950('0x2c')]=qs[_0x9950('0x2c')](_0x2327fc[_0x9950('0x3a')][_0x9950('0x2c')]);}_0x52d3b2[_0x9950('0x41')]=qs[_0x9950('0x42')](_0x2327fc[_0x9950('0x3a')][_0x9950('0x42')]);_0x52d3b2[_0x9950('0x43')]=qs[_0x9950('0x44')](_[_0x9950('0x45')](_0x2327fc[_0x9950('0x3a')],_0xbceceb[_0x9950('0x44')]),_0x2044f6);if(_0x2327fc[_0x9950('0x3a')][_0x9950('0x46')]){_0x52d3b2[_0x9950('0x43')]=_[_0x9950('0x47')](_0x52d3b2[_0x9950('0x43')],{'$or':_[_0x9950('0x48')](_0x2044f6,function(_0x1e1245){if(_0x1e1245[_0x9950('0x38')]!=='VIRTUAL'){var _0x4c4b90={};_0x4c4b90[_0x1e1245[_0x9950('0x34')]]={'$like':'%'+_0x2327fc[_0x9950('0x3a')][_0x9950('0x46')]+'%'};return _0x4c4b90;}})});}_0x52d3b2=_[_0x9950('0x47')]({},_0x52d3b2,_0x2327fc[_0x9950('0x49')]);var _0x4be070={'where':_0x52d3b2['where']};return db['DeskAccount'][_0x9950('0x4a')](_0x4be070)[_0x9950('0x1d')](function(_0x5435fb){_0x225e0e[_0x9950('0x4a')]=_0x5435fb;if(_0x2327fc[_0x9950('0x3a')][_0x9950('0x4b')]){_0x52d3b2['include']=[{'all':!![]}];}return db[_0x9950('0x36')][_0x9950('0x4c')](_0x52d3b2);})['then'](function(_0x7aa995){_0x225e0e['rows']=_0x7aa995;return _0x225e0e;})['then'](respondWithFilteredResult(_0x11e665,_0x52d3b2))['catch'](handleError(_0x11e665,null));};exports[_0x9950('0x4d')]=function(_0x1de58f,_0x3b7159){var _0x377893={'raw':![],'where':{'id':_0x1de58f[_0x9950('0x4e')]['id']}},_0x56cb4c={};_0x56cb4c[_0x9950('0x3d')]=_[_0x9950('0x3b')](db[_0x9950('0x36')][_0x9950('0x4f')]);_0x56cb4c[_0x9950('0x3a')]=_['keys'](_0x1de58f[_0x9950('0x3a')]);_0x56cb4c['filters']=_[_0x9950('0x3c')](_0x56cb4c['model'],_0x56cb4c[_0x9950('0x3a')]);_0x377893['attributes']=_[_0x9950('0x3c')](_0x56cb4c[_0x9950('0x3d')],qs[_0x9950('0x3e')](_0x1de58f[_0x9950('0x3a')]['fields']));_0x377893[_0x9950('0x3f')]=_0x377893[_0x9950('0x3f')][_0x9950('0x50')]?_0x377893[_0x9950('0x3f')]:_0x56cb4c['model'];if(_0x1de58f[_0x9950('0x3a')][_0x9950('0x4b')]){_0x377893['include']=[{'all':!![]}];}_0x377893=_[_0x9950('0x47')]({},_0x377893,_0x1de58f[_0x9950('0x49')]);return db[_0x9950('0x36')][_0x9950('0x51')](_0x377893)[_0x9950('0x1d')](handleEntityNotFound(_0x3b7159,null))[_0x9950('0x1d')](respondWithResult(_0x3b7159,null))[_0x9950('0x27')](handleError(_0x3b7159,null));};exports['create']=function(_0x11ae57,_0x5626c1){return db[_0x9950('0x36')][_0x9950('0x52')](_0x11ae57[_0x9950('0x53')],{})['then'](respondWithResult(_0x5626c1,0xc9))[_0x9950('0x27')](handleError(_0x5626c1,null));};exports[_0x9950('0x31')]=function(_0x585f6,_0x37b4d0){if(_0x585f6[_0x9950('0x53')]['id']){delete _0x585f6['body']['id'];}return db[_0x9950('0x36')]['find']({'where':{'id':_0x585f6['params']['id']}})['then'](handleEntityNotFound(_0x37b4d0,null))['then'](saveUpdates(_0x585f6[_0x9950('0x53')],null))['then'](respondWithResult(_0x37b4d0,null))[_0x9950('0x27')](handleError(_0x37b4d0,null));};exports[_0x9950('0x32')]=function(_0xb0b9cf,_0x53a2bd){return db[_0x9950('0x36')][_0x9950('0x51')]({'where':{'id':_0xb0b9cf[_0x9950('0x4e')]['id']}})['then'](handleEntityNotFound(_0x53a2bd,null))[_0x9950('0x1d')](removeEntity(_0x53a2bd,null))[_0x9950('0x27')](handleError(_0x53a2bd,null));};exports['getConfigurations']=function(_0x3798d2,_0x8558f5,_0x7a6807){var _0x551580={};var _0x33aced={};var _0xb98b98;var _0x3e6659;return db[_0x9950('0x36')][_0x9950('0x54')]({'where':{'id':_0x3798d2[_0x9950('0x4e')]['id']}})[_0x9950('0x1d')](handleEntityNotFound(_0x8558f5,null))['then'](function(_0x230655){if(_0x230655){_0xb98b98=_0x230655;_0x33aced[_0x9950('0x3d')]=_[_0x9950('0x3b')](db[_0x9950('0x55')][_0x9950('0x4f')]);_0x33aced[_0x9950('0x3a')]=_['keys'](_0x3798d2['query']);_0x33aced[_0x9950('0x44')]=_['intersection'](_0x33aced[_0x9950('0x3d')],_0x33aced[_0x9950('0x3a')]);_0x551580['attributes']=_[_0x9950('0x3c')](_0x33aced[_0x9950('0x3d')],qs['fields'](_0x3798d2[_0x9950('0x3a')]['fields']));_0x551580[_0x9950('0x3f')]=_0x551580['attributes']['length']?_0x551580['attributes']:_0x33aced[_0x9950('0x3d')];_0x551580[_0x9950('0x41')]=qs['sort'](_0x3798d2[_0x9950('0x3a')][_0x9950('0x42')]);_0x551580[_0x9950('0x43')]=qs['filters'](_['pick'](_0x3798d2[_0x9950('0x3a')],_0x33aced[_0x9950('0x44')]));if(_0x3798d2[_0x9950('0x3a')]['filter']){_0x551580['where']=_[_0x9950('0x47')](_0x551580[_0x9950('0x43')],{'$or':_['map'](_0x551580[_0x9950('0x3f')],function(_0x403fc9){var _0x423836={};_0x423836[_0x403fc9]={'$like':'%'+_0x3798d2[_0x9950('0x3a')][_0x9950('0x46')]+'%'};return _0x423836;})});}_0x551580=_[_0x9950('0x47')]({},_0x551580,_0x3798d2[_0x9950('0x49')]);return _0xb98b98[_0x9950('0x56')](_0x551580);}})[_0x9950('0x1d')](function(_0x255366){if(_0x255366){_0x3e6659=_0x255366[_0x9950('0x50')];if(!_0x3798d2['query'][_0x9950('0x40')](_0x9950('0x57'))){_0x551580[_0x9950('0x2d')]=qs[_0x9950('0x2d')](_0x3798d2[_0x9950('0x3a')][_0x9950('0x2d')]);_0x551580[_0x9950('0x2c')]=qs[_0x9950('0x2c')](_0x3798d2[_0x9950('0x3a')][_0x9950('0x2c')]);}return _0xb98b98[_0x9950('0x56')](_0x551580);}})[_0x9950('0x1d')](function(_0x30298d){if(_0x30298d){return _0x30298d?{'count':_0x3e6659,'rows':_0x30298d}:null;}})['then'](respondWithResult(_0x8558f5,null))[_0x9950('0x27')](handleError(_0x8558f5,null));};exports[_0x9950('0x58')]=function(_0xfae6d8,_0x53efa6,_0x2a7821){if(_0xfae6d8[_0x9950('0x53')]['id']){delete _0xfae6d8[_0x9950('0x53')]['id'];}return db[_0x9950('0x36')][_0x9950('0x54')]({'where':{'id':_0xfae6d8[_0x9950('0x4e')]['id']}})[_0x9950('0x1d')](handleEntityNotFound(_0x53efa6,null))[_0x9950('0x1d')](function(_0x32f9e7){if(_0x32f9e7){_0xfae6d8[_0x9950('0x53')][_0x9950('0x59')]=_0x32f9e7['id'];_0xfae6d8['body'][_0x9950('0x5a')]=integrations[_0x9950('0x5b')](_0xfae6d8[_0x9950('0x53')]['channel'],_0xfae6d8[_0x9950('0x53')][_0x9950('0x38')]);_0xfae6d8['body']['Descriptions']=integrations['getDescriptions'](_0xfae6d8[_0x9950('0x53')][_0x9950('0x5c')],_0xfae6d8[_0x9950('0x53')][_0x9950('0x38')]);return db[_0x9950('0x55')]['create'](_0xfae6d8['body'],{'include':[{'model':db[_0x9950('0x5d')],'as':_0x9950('0x5a')},{'model':db[_0x9950('0x5d')],'as':_0x9950('0x5e')}]});}return null;})['then'](respondWithResult(_0x53efa6,null))['catch'](handleError(_0x53efa6,null));};exports[_0x9950('0x5f')]=function(_0x1142cb,_0x1d6451,_0x2364cc){var _0x2ef2a0=[{'name':_0x9950('0x60'),'label':_0x9950('0x60'),'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 _0x2063c5='';return db[_0x9950('0x36')][_0x9950('0x54')]({'where':{'id':_0x1142cb['params']['id']},'attributes':['id',_0x9950('0x61'),_0x9950('0x62'),_0x9950('0x63'),_0x9950('0x64'),'consumerKey',_0x9950('0x65'),_0x9950('0x66'),_0x9950('0x67')]})['then'](handleEntityNotFound(_0x1d6451,null))[_0x9950('0x1d')](function(_0x314cc7){if(_0x314cc7){_0x2063c5=_0x314cc7['remoteUri'];var _0x26a0e6=_0x2063c5[_0x9950('0x68')](-0x1);if(_0x26a0e6==='/'){_0x2063c5=_0x2063c5['substring'](0x0,_0x2063c5['lastIndexOf'](_0x26a0e6));}var _0x344609={'method':_0x9950('0x69'),'uri':util['format'](_0x9950('0x6a'),_0x2063c5),'headers':{'Content-Type':_0x9950('0x6b'),'Accept':_0x9950('0x6b')},'json':!![]};if(_0x314cc7[_0x9950('0x62')]===_0x9950('0x6c')){_0x344609[_0x9950('0x6d')]['Authorization']=util[_0x9950('0x6e')]('Basic\x20%s',new Buffer(util[_0x9950('0x6e')](_0x9950('0x6f'),_0x314cc7[_0x9950('0x63')],_0x314cc7[_0x9950('0x64')]))[_0x9950('0x70')](_0x9950('0x71')));}return rp(_0x344609)[_0x9950('0x1d')](function(_0x4c342f){return _0x2ef2a0[_0x9950('0x72')](_[_0x9950('0x48')](_0x4c342f['_embedded'][_0x9950('0x73')],function(_0x1b4b07){return{'id':_0x1b4b07[_0x9950('0x34')],'name':_0x1b4b07['name'],'type':_0x1b4b07['type'],'active':_0x1b4b07[_0x9950('0x74')],'label':_0x1b4b07[_0x9950('0x75')],'custom':!![]};}));});}})[_0x9950('0x1d')](function(_0x17589f){return{'count':_0x17589f[_0x9950('0x50')],'rows':_0x17589f};})[_0x9950('0x1d')](respondWithResult(_0x1d6451,null))[_0x9950('0x27')](function(_0x287a1b){var _0xea9034=_0x1142cb[_0x9950('0x3a')][_0x9950('0x76')]?0x1f4:_0x287a1b['statusCode']||0x1f4;logger[_0x9950('0x22')](_0x9950('0x77'),_0x9950('0x5f'),_0xea9034,JSON[_0x9950('0x21')](_0x287a1b));delete _0x287a1b['name'];if(_0xea9034===0x191){_0xea9034=0x190;}_0x1d6451[_0x9950('0x29')](_0xea9034)[_0x9950('0x78')](_0x1142cb['query'][_0x9950('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x287a1b[_0x9950('0x79')]}:_0x287a1b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c8ea3d2..ecf2308 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 _0xb96f=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5a7f66,_0x4c82b3){var _0x3e5205=function(_0x1a38a4){while(--_0x1a38a4){_0x5a7f66['push'](_0x5a7f66['shift']());}};_0x3e5205(++_0x4c82b3);}(_0xb96f,0xf0));var _0xfb96=function(_0x625357,_0x302e0c){_0x625357=_0x625357-0x0;var _0x229340=_0xb96f[_0x625357];return _0x229340;};'use strict';var _=require(_0xfb96('0x0'));var util=require(_0xfb96('0x1'));var logger=require(_0xfb96('0x2'))('api');var moment=require(_0xfb96('0x3'));var BPromise=require(_0xfb96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb96('0x5'));var rimraf=require('rimraf');var config=require(_0xfb96('0x6'));var attributes=require(_0xfb96('0x7'));var integrations=require(_0xfb96('0x8'));module[_0xfb96('0x9')]=function(_0xfece4d,_0x3e8938){return _0xfece4d['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdce5=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x37fbbc,_0xb7338a){var _0x48e4fe=function(_0x14a128){while(--_0x14a128){_0x37fbbc['push'](_0x37fbbc['shift']());}};_0x48e4fe(++_0xb7338a);}(_0xdce5,0x19a));var _0x5dce=function(_0x32ac76,_0x528069){_0x32ac76=_0x32ac76-0x0;var _0x2b5a02=_0xdce5[_0x32ac76];return _0x2b5a02;};'use strict';var _=require(_0x5dce('0x0'));var util=require('util');var logger=require(_0x5dce('0x1'))('api');var moment=require(_0x5dce('0x2'));var BPromise=require(_0x5dce('0x3'));var rp=require(_0x5dce('0x4'));var fs=require('fs');var path=require(_0x5dce('0x5'));var rimraf=require('rimraf');var config=require(_0x5dce('0x6'));var attributes=require(_0x5dce('0x7'));var integrations=require(_0x5dce('0x8'));module[_0x5dce('0x9')]=function(_0x546e51,_0x4e071d){return _0x546e51[_0x5dce('0xa')](_0x5dce('0xb'),attributes,{'tableName':_0x5dce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 64a4ffe..2ac93b4 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 _0xfc6d=['raw','attributes','limit','include','model','map','catch','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetDeskAccount','DeskAccount','options'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0xfc6d,0xee));var _0xdfc6=function(_0x5e9bfd,_0x235485){_0x5e9bfd=_0x5e9bfd-0x0;var _0x3b34d2=_0xfc6d[_0x5e9bfd];return _0x3b34d2;};'use strict';var _=require(_0xdfc6('0x0'));var util=require(_0xdfc6('0x1'));var moment=require(_0xdfc6('0x2'));var BPromise=require(_0xdfc6('0x3'));var rs=require(_0xdfc6('0x4'));var fs=require('fs');var Redis=require(_0xdfc6('0x5'));var db=require(_0xdfc6('0x6'))['db'];var utils=require(_0xdfc6('0x7'));var logger=require(_0xdfc6('0x8'))(_0xdfc6('0x9'));var config=require(_0xdfc6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdfc6('0xb')][_0xdfc6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ec2,_0x2f0b41,_0x2cd9a1){return new BPromise(function(_0x574f80,_0x5e302e){return client[_0xdfc6('0xd')](_0x4a6ec2,_0x2cd9a1)[_0xdfc6('0xe')](function(_0x555500){logger[_0xdfc6('0xf')](_0xdfc6('0x10'),_0x2f0b41,'request\x20sent');logger[_0xdfc6('0x11')](_0xdfc6('0x12'),_0x2f0b41,'request\x20sent',JSON[_0xdfc6('0x13')](_0x555500));if(_0x555500[_0xdfc6('0x14')]){if(_0x555500['error'][_0xdfc6('0x15')]===0x1f4){logger[_0xdfc6('0x14')](_0xdfc6('0x10'),_0x2f0b41,_0x555500[_0xdfc6('0x14')][_0xdfc6('0x16')]);return _0x5e302e(_0x555500[_0xdfc6('0x14')][_0xdfc6('0x16')]);}logger[_0xdfc6('0x14')]('DeskAccount,\x20%s,\x20%s',_0x2f0b41,_0x555500[_0xdfc6('0x14')]['message']);return _0x574f80(_0x555500['error'][_0xdfc6('0x16')]);}else{logger[_0xdfc6('0xf')](_0xdfc6('0x10'),_0x2f0b41,_0xdfc6('0x17'));_0x574f80(_0x555500[_0xdfc6('0x18')][_0xdfc6('0x16')]);}})['catch'](function(_0x5e51ff){logger[_0xdfc6('0x14')](_0xdfc6('0x10'),_0x2f0b41,_0x5e51ff);_0x5e302e(_0x5e51ff);});});}exports[_0xdfc6('0x19')]=function(_0x395530){var _0x491750=this;return new Promise(function(_0x50fcb4,_0x423496){return db[_0xdfc6('0x1a')]['findAll']({'raw':_0x395530['options']?_0x395530[_0xdfc6('0x1b')][_0xdfc6('0x1c')]===undefined?!![]:![]:!![],'where':_0x395530[_0xdfc6('0x1b')]?_0x395530[_0xdfc6('0x1b')]['where']||null:null,'attributes':_0x395530[_0xdfc6('0x1b')]?_0x395530[_0xdfc6('0x1b')][_0xdfc6('0x1d')]||null:null,'limit':_0x395530[_0xdfc6('0x1b')]?_0x395530['options'][_0xdfc6('0x1e')]||null:null,'include':_0x395530[_0xdfc6('0x1b')]?_0x395530['options'][_0xdfc6('0x1f')]?_['map'](_0x395530[_0xdfc6('0x1b')][_0xdfc6('0x1f')],function(_0x1f81b3){return{'model':db[_0x1f81b3[_0xdfc6('0x20')]],'as':_0x1f81b3['as'],'attributes':_0x1f81b3['attributes'],'include':_0x1f81b3[_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0x1f81b3[_0xdfc6('0x1f')],function(_0x4ece58){return{'model':db[_0x4ece58[_0xdfc6('0x20')]],'as':_0x4ece58['as'],'attributes':_0x4ece58[_0xdfc6('0x1d')],'include':_0x4ece58[_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0x4ece58[_0xdfc6('0x1f')],function(_0x4415d1){return{'model':db[_0x4415d1[_0xdfc6('0x20')]],'as':_0x4415d1['as'],'attributes':_0x4415d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfc6('0xe')](function(_0x342ba8){logger[_0xdfc6('0xf')](_0xdfc6('0x19'),_0x395530);logger['debug'](_0xdfc6('0x19'),_0x395530,JSON[_0xdfc6('0x13')](_0x342ba8));_0x50fcb4(_0x342ba8);})[_0xdfc6('0x22')](function(_0x21ff8b){logger[_0xdfc6('0x14')](_0xdfc6('0x19'),_0x21ff8b[_0xdfc6('0x16')],_0x395530);_0x423496(_0x491750['error'](0x1f4,_0x21ff8b[_0xdfc6('0x16')]));});});};exports[_0xdfc6('0x23')]=function(_0x4f9b00){var _0x63b73a=this;return new Promise(function(_0xeebf89,_0x3e4f8d){return db[_0xdfc6('0x1a')][_0xdfc6('0x24')]({'raw':_0x4f9b00[_0xdfc6('0x1b')]?_0x4f9b00[_0xdfc6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4f9b00[_0xdfc6('0x1b')]?_0x4f9b00[_0xdfc6('0x1b')][_0xdfc6('0x25')]||null:null,'attributes':_0x4f9b00['options']?_0x4f9b00[_0xdfc6('0x1b')]['attributes']||null:null,'include':_0x4f9b00[_0xdfc6('0x1b')]?_0x4f9b00[_0xdfc6('0x1b')][_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0x4f9b00[_0xdfc6('0x1b')][_0xdfc6('0x1f')],function(_0x27922c){return{'model':db[_0x27922c[_0xdfc6('0x20')]],'as':_0x27922c['as'],'attributes':_0x27922c[_0xdfc6('0x1d')],'include':_0x27922c[_0xdfc6('0x1f')]?_['map'](_0x27922c[_0xdfc6('0x1f')],function(_0xa0b95f){return{'model':db[_0xa0b95f[_0xdfc6('0x20')]],'as':_0xa0b95f['as'],'attributes':_0xa0b95f['attributes'],'include':_0xa0b95f[_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0xa0b95f[_0xdfc6('0x1f')],function(_0x314f60){return{'model':db[_0x314f60[_0xdfc6('0x20')]],'as':_0x314f60['as'],'attributes':_0x314f60[_0xdfc6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdfc6('0xe')](function(_0x1c0954){logger[_0xdfc6('0xf')](_0xdfc6('0x23'),_0x4f9b00);logger[_0xdfc6('0x11')](_0xdfc6('0x23'),_0x4f9b00,JSON[_0xdfc6('0x13')](_0x1c0954));_0xeebf89(_0x1c0954);})['catch'](function(_0x594133){logger[_0xdfc6('0x14')](_0xdfc6('0x23'),_0x594133[_0xdfc6('0x16')],_0x4f9b00);_0x3e4f8d(_0x63b73a[_0xdfc6('0x14')](0x1f4,_0x594133[_0xdfc6('0x16')]));});});}; \ No newline at end of file +var _0xc698=['message','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','model','ShowDeskAccount','find','raw','where','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xc698,0x113));var _0x8c69=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xc698[_0x38fb0d];return _0x30a5d6;};'use strict';var _=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var moment=require(_0x8c69('0x2'));var BPromise=require(_0x8c69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c69('0x4'));var db=require(_0x8c69('0x5'))['db'];var utils=require(_0x8c69('0x6'));var logger=require(_0x8c69('0x7'))(_0x8c69('0x8'));var config=require(_0x8c69('0x9'));var jayson=require(_0x8c69('0xa'));var client=jayson['client'][_0x8c69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4511,_0x119e97,_0xf6be47){return new BPromise(function(_0x4749b5,_0x1d768c){return client[_0x8c69('0xc')](_0x5f4511,_0xf6be47)[_0x8c69('0xd')](function(_0x4df09e){logger[_0x8c69('0xe')]('DeskAccount,\x20%s,\x20%s',_0x119e97,_0x8c69('0xf'));logger[_0x8c69('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x119e97,_0x8c69('0xf'),JSON[_0x8c69('0x11')](_0x4df09e));if(_0x4df09e[_0x8c69('0x12')]){if(_0x4df09e['error'][_0x8c69('0x13')]===0x1f4){logger[_0x8c69('0x12')](_0x8c69('0x14'),_0x119e97,_0x4df09e[_0x8c69('0x12')][_0x8c69('0x15')]);return _0x1d768c(_0x4df09e[_0x8c69('0x12')][_0x8c69('0x15')]);}logger[_0x8c69('0x12')](_0x8c69('0x14'),_0x119e97,_0x4df09e[_0x8c69('0x12')][_0x8c69('0x15')]);return _0x4749b5(_0x4df09e[_0x8c69('0x12')][_0x8c69('0x15')]);}else{logger[_0x8c69('0xe')]('DeskAccount,\x20%s,\x20%s',_0x119e97,_0x8c69('0xf'));_0x4749b5(_0x4df09e[_0x8c69('0x16')][_0x8c69('0x15')]);}})[_0x8c69('0x17')](function(_0x493d80){logger[_0x8c69('0x12')](_0x8c69('0x14'),_0x119e97,_0x493d80);_0x1d768c(_0x493d80);});});}exports[_0x8c69('0x18')]=function(_0x533fb3){var _0x406f7e=this;return new Promise(function(_0x5146b8,_0x4e4044){return db[_0x8c69('0x19')][_0x8c69('0x1a')]({'raw':_0x533fb3['options']?_0x533fb3['options']['raw']===undefined?!![]:![]:!![],'where':_0x533fb3[_0x8c69('0x1b')]?_0x533fb3[_0x8c69('0x1b')]['where']||null:null,'attributes':_0x533fb3['options']?_0x533fb3['options'][_0x8c69('0x1c')]||null:null,'limit':_0x533fb3[_0x8c69('0x1b')]?_0x533fb3[_0x8c69('0x1b')][_0x8c69('0x1d')]||null:null,'include':_0x533fb3[_0x8c69('0x1b')]?_0x533fb3['options'][_0x8c69('0x1e')]?_['map'](_0x533fb3[_0x8c69('0x1b')][_0x8c69('0x1e')],function(_0x1c4b36){return{'model':db[_0x1c4b36[_0x8c69('0x1f')]],'as':_0x1c4b36['as'],'attributes':_0x1c4b36[_0x8c69('0x1c')],'include':_0x1c4b36['include']?_['map'](_0x1c4b36['include'],function(_0x5c2863){return{'model':db[_0x5c2863['model']],'as':_0x5c2863['as'],'attributes':_0x5c2863[_0x8c69('0x1c')],'include':_0x5c2863[_0x8c69('0x1e')]?_['map'](_0x5c2863['include'],function(_0xa1e647){return{'model':db[_0xa1e647[_0x8c69('0x1f')]],'as':_0xa1e647['as'],'attributes':_0xa1e647[_0x8c69('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e40a0){logger[_0x8c69('0xe')](_0x8c69('0x18'),_0x533fb3);logger[_0x8c69('0x10')](_0x8c69('0x18'),_0x533fb3,JSON[_0x8c69('0x11')](_0x2e40a0));_0x5146b8(_0x2e40a0);})[_0x8c69('0x17')](function(_0x11c9fe){logger['error'](_0x8c69('0x18'),_0x11c9fe[_0x8c69('0x15')],_0x533fb3);_0x4e4044(_0x406f7e[_0x8c69('0x12')](0x1f4,_0x11c9fe[_0x8c69('0x15')]));});});};exports[_0x8c69('0x20')]=function(_0x58c4fc){var _0x4fe697=this;return new Promise(function(_0x4ce765,_0x467b9e){return db[_0x8c69('0x19')][_0x8c69('0x21')]({'raw':_0x58c4fc[_0x8c69('0x1b')]?_0x58c4fc['options'][_0x8c69('0x22')]===undefined?!![]:![]:!![],'where':_0x58c4fc[_0x8c69('0x1b')]?_0x58c4fc['options'][_0x8c69('0x23')]||null:null,'attributes':_0x58c4fc[_0x8c69('0x1b')]?_0x58c4fc[_0x8c69('0x1b')]['attributes']||null:null,'include':_0x58c4fc[_0x8c69('0x1b')]?_0x58c4fc[_0x8c69('0x1b')][_0x8c69('0x1e')]?_[_0x8c69('0x24')](_0x58c4fc['options'][_0x8c69('0x1e')],function(_0x24154a){return{'model':db[_0x24154a[_0x8c69('0x1f')]],'as':_0x24154a['as'],'attributes':_0x24154a['attributes'],'include':_0x24154a['include']?_[_0x8c69('0x24')](_0x24154a['include'],function(_0x1a6c48){return{'model':db[_0x1a6c48['model']],'as':_0x1a6c48['as'],'attributes':_0x1a6c48[_0x8c69('0x1c')],'include':_0x1a6c48[_0x8c69('0x1e')]?_[_0x8c69('0x24')](_0x1a6c48['include'],function(_0x5eed29){return{'model':db[_0x5eed29['model']],'as':_0x5eed29['as'],'attributes':_0x5eed29[_0x8c69('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c69('0xd')](function(_0x21ea19){logger[_0x8c69('0xe')](_0x8c69('0x20'),_0x58c4fc);logger['debug'](_0x8c69('0x20'),_0x58c4fc,JSON[_0x8c69('0x11')](_0x21ea19));_0x4ce765(_0x21ea19);})[_0x8c69('0x17')](function(_0x2f0d3a){logger['error'](_0x8c69('0x20'),_0x2f0d3a['message'],_0x58c4fc);_0x467b9e(_0x4fe697[_0x8c69('0x12')](0x1f4,_0x2f0d3a['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 53a1b8e..a688517 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 _0x8506=['/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x1df328,_0x32ddd1){var _0x41c8b0=function(_0x5b2e2d){while(--_0x5b2e2d){_0x1df328['push'](_0x1df328['shift']());}};_0x41c8b0(++_0x32ddd1);}(_0x8506,0xe8));var _0x6850=function(_0x2f5016,_0x46633b){_0x2f5016=_0x2f5016-0x0;var _0x246b40=_0x8506[_0x2f5016];return _0x246b40;};'use strict';var multer=require('multer');var util=require(_0x6850('0x0'));var path=require('path');var timeout=require(_0x6850('0x1'));var express=require('express');var router=express[_0x6850('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x6850('0x3'));var config=require(_0x6850('0x4'));var controller=require(_0x6850('0x5'));router['get']('/',auth[_0x6850('0x6')](),controller[_0x6850('0x7')]);router[_0x6850('0x8')](_0x6850('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6850('0xa'),auth[_0x6850('0x6')](),controller[_0x6850('0xb')]);router['get']('/:id/subjects',auth[_0x6850('0x6')](),controller[_0x6850('0xc')]);router[_0x6850('0x8')](_0x6850('0xd'),auth[_0x6850('0x6')](),controller['getDescriptions']);router[_0x6850('0x8')](_0x6850('0xe'),auth[_0x6850('0x6')](),controller[_0x6850('0xf')]);router[_0x6850('0x10')]('/',auth[_0x6850('0x6')](),controller['create']);router[_0x6850('0x10')](_0x6850('0xe'),auth[_0x6850('0x6')](),controller[_0x6850('0x11')]);router[_0x6850('0x12')](_0x6850('0x9'),auth['isAuthenticated'](),controller[_0x6850('0x13')]);router['delete'](_0x6850('0x9'),auth[_0x6850('0x6')](),controller[_0x6850('0x14')]);module[_0x6850('0x15')]=router; \ No newline at end of file +var _0x8ace=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3ffb1c,_0xeb0964){var _0x208ec2=function(_0x2ac4c8){while(--_0x2ac4c8){_0x3ffb1c['push'](_0x3ffb1c['shift']());}};_0x208ec2(++_0xeb0964);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x3a4236,_0x1488df){_0x3a4236=_0x3a4236-0x0;var _0x52d615=_0x8ace[_0x3a4236];return _0x52d615;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var auth=require(_0xe8ac('0x6'));var interaction=require(_0xe8ac('0x7'));var config=require(_0xe8ac('0x8'));var controller=require(_0xe8ac('0x9'));router[_0xe8ac('0xa')]('/',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xc')]);router[_0xe8ac('0xa')]('/:id',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xd')]);router['get']('/:id/fields',auth[_0xe8ac('0xb')](),controller['getFields']);router[_0xe8ac('0xa')](_0xe8ac('0xe'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xf')]);router[_0xe8ac('0xa')](_0xe8ac('0x10'),auth['isAuthenticated'](),controller[_0xe8ac('0x11')]);router[_0xe8ac('0xa')](_0xe8ac('0x12'),auth['isAuthenticated'](),controller[_0xe8ac('0x13')]);router[_0xe8ac('0x14')]('/',auth['isAuthenticated'](),controller[_0xe8ac('0x15')]);router[_0xe8ac('0x14')](_0xe8ac('0x12'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x16')]);router[_0xe8ac('0x17')](_0xe8ac('0x18'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x19')]);router[_0xe8ac('0x1a')]('/:id',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 441f3c1..cb22c77 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 _0xa68b=['exports','STRING','sequelize'];(function(_0x3d808a,_0xe871d0){var _0x4c10f9=function(_0x491930){while(--_0x491930){_0x3d808a['push'](_0x3d808a['shift']());}};_0x4c10f9(++_0xe871d0);}(_0xa68b,0x182));var _0xba68=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xa68b[_0x236d24];return _0x1574cf;};'use strict';var Sequelize=require(_0xba68('0x0'));module[_0xba68('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba68('0x2')]}}; \ No newline at end of file +var _0x278a=['STRING','sequelize'];(function(_0x239013,_0x4b6af3){var _0x1f80af=function(_0x4b9517){while(--_0x4b9517){_0x239013['push'](_0x239013['shift']());}};_0x1f80af(++_0x4b6af3);}(_0x278a,0xe7));var _0xa278=function(_0x6a9d33,_0x5dc2f3){_0x6a9d33=_0x6a9d33-0x0;var _0x29f212=_0x278a[_0x6a9d33];return _0x29f212;};'use strict';var Sequelize=require(_0xa278('0x0'));module['exports']={'name':{'type':Sequelize[_0xa278('0x1')]},'description':{'type':Sequelize[_0xa278('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 15ccba6..e07731d 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 _0x77d7=['getFields','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','stack','name','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy'];(function(_0x11abf9,_0x1ff7e5){var _0x547878=function(_0x2ac98c){while(--_0x2ac98c){_0x11abf9['push'](_0x11abf9['shift']());}};_0x547878(++_0x1ff7e5);}(_0x77d7,0x1d0));var _0x777d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x77d7[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x777d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x777d('0x1'));var zipdir=require(_0x777d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x777d('0x3'));var moment=require('moment');var BPromise=require(_0x777d('0x4'));var Mustache=require('mustache');var util=require(_0x777d('0x5'));var path=require(_0x777d('0x6'));var sox=require(_0x777d('0x7'));var csv=require(_0x777d('0x8'));var ejs=require(_0x777d('0x9'));var fs=require('fs');var _=require(_0x777d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x777d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x777d('0x8'));var querystring=require(_0x777d('0xc'));var Papa=require(_0x777d('0xd'));var Redis=require('ioredis');var authService=require(_0x777d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x777d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x777d('0x10'))(_0x777d('0x11'));var utils=require(_0x777d('0x12'));var config=require(_0x777d('0x13'));var licenseUtil=require(_0x777d('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x777d('0x15'));var client=jayson[_0x777d('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4427f3,_0xbf9048,_0xf5dbad,_0x2a68b7){return new BPromise(function(_0x2c3567,_0x58721b){var _0x41c00a=_0x2a68b7||client;return _0x41c00a[_0x777d('0x17')](_0x4427f3,_0xf5dbad)[_0x777d('0x18')](function(_0x1d999e){logger['info'](_0x777d('0x19'),_0xbf9048,_0x777d('0x1a'));logger[_0x777d('0x1b')](_0x777d('0x1c'),_0xbf9048,'request\x20sent',JSON['stringify'](_0x1d999e));if(_0x1d999e[_0x777d('0x1d')]){if(_0x1d999e[_0x777d('0x1d')][_0x777d('0x1e')]===0x1f4){logger[_0x777d('0x1d')](_0x777d('0x19'),_0xbf9048,_0x1d999e[_0x777d('0x1d')]['message']);return _0x58721b(_0x1d999e[_0x777d('0x1d')][_0x777d('0x1f')]);}logger[_0x777d('0x1d')](_0x777d('0x19'),_0xbf9048,_0x1d999e[_0x777d('0x1d')]['message']);return _0x2c3567(_0x1d999e['error'][_0x777d('0x1f')]);}else{logger[_0x777d('0x20')](_0x777d('0x19'),_0xbf9048,'request\x20sent');_0x2c3567(_0x1d999e['result']['message']);}})[_0x777d('0x21')](function(_0x44b5ab){logger[_0x777d('0x1d')](_0x777d('0x19'),_0xbf9048,_0x44b5ab);_0x58721b(_0x44b5ab);});});}function respondWithStatusCode(_0x41289f,_0x173e18){_0x173e18=_0x173e18||0xcc;return function(_0x1f3e26){if(_0x1f3e26){return _0x41289f[_0x777d('0x22')](_0x173e18);}return _0x41289f[_0x777d('0x23')](_0x173e18)[_0x777d('0x24')]();};}function respondWithResult(_0x9cc436,_0x4a61cd){_0x4a61cd=_0x4a61cd||0xc8;return function(_0x4023bf){if(_0x4023bf){return _0x9cc436[_0x777d('0x23')](_0x4a61cd)[_0x777d('0x25')](_0x4023bf);}};}function respondWithFilteredResult(_0x350eb0,_0x3d12e9){return function(_0x3238df){if(_0x3238df){var _0x13b369=_0x3238df[_0x777d('0x26')],_0x24b5d2=_0x3d12e9['offset'],_0x4d140e=_0x3d12e9[_0x777d('0x27')]+_0x3d12e9['limit'],_0x5458ca;if(_0x4d140e>=_0x13b369){_0x4d140e=_0x13b369;_0x5458ca=0xc8;}else{_0x5458ca=0xce;}_0x350eb0[_0x777d('0x23')](_0x5458ca);return _0x350eb0[_0x777d('0x28')]('Content-Range',_0x24b5d2+'-'+_0x4d140e+'/'+_0x13b369)[_0x777d('0x25')](_0x3238df);}return null;};}function patchUpdates(_0x1e000f){return function(_0x25a1e5){try{jsonpatch[_0x777d('0x29')](_0x25a1e5,_0x1e000f,!![]);}catch(_0x2c60f0){return BPromise[_0x777d('0x2a')](_0x2c60f0);}return _0x25a1e5[_0x777d('0x2b')]();};}function saveUpdates(_0x407b32,_0x22d395){return function(_0x113719){if(_0x113719){return _0x113719[_0x777d('0x2c')](_0x407b32)[_0x777d('0x18')](function(_0x5a74aa){return _0x5a74aa;});}return null;};}function removeEntity(_0x324ad3,_0x5657a8){return function(_0x1c1185){if(_0x1c1185){return _0x1c1185['destroy']()['then'](function(){_0x324ad3[_0x777d('0x23')](0xcc)[_0x777d('0x24')]();});}};}function handleEntityNotFound(_0x31d012,_0x5e704f){return function(_0x43d5a0){if(!_0x43d5a0){_0x31d012[_0x777d('0x22')](0x194);}return _0x43d5a0;};}function handleError(_0x4e5b58,_0x587ae5){_0x587ae5=_0x587ae5||0x1f4;return function(_0x5d5d78){logger['error'](_0x5d5d78[_0x777d('0x2d')]);if(_0x5d5d78['name']){delete _0x5d5d78[_0x777d('0x2e')];}_0x4e5b58[_0x777d('0x23')](_0x587ae5)['send'](_0x5d5d78);};}exports['index']=function(_0x1d27c3,_0x95c32b){var _0x1c7895={},_0x164cf0={},_0x81c879={'count':0x0,'rows':[]};var _0x20acc1=_[_0x777d('0x2f')](db[_0x777d('0x30')]['rawAttributes'],function(_0x570fc0){return{'name':_0x570fc0[_0x777d('0x31')],'type':_0x570fc0[_0x777d('0x32')][_0x777d('0x33')]};});_0x164cf0[_0x777d('0x34')]=_['map'](_0x20acc1,_0x777d('0x2e'));_0x164cf0[_0x777d('0x35')]=_[_0x777d('0x36')](_0x1d27c3[_0x777d('0x35')]);_0x164cf0[_0x777d('0x37')]=_['intersection'](_0x164cf0['model'],_0x164cf0[_0x777d('0x35')]);_0x1c7895['attributes']=_[_0x777d('0x38')](_0x164cf0['model'],qs[_0x777d('0x39')](_0x1d27c3[_0x777d('0x35')][_0x777d('0x39')]));_0x1c7895['attributes']=_0x1c7895[_0x777d('0x3a')][_0x777d('0x3b')]?_0x1c7895[_0x777d('0x3a')]:_0x164cf0['model'];if(!_0x1d27c3[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x1c7895[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x1d27c3[_0x777d('0x35')][_0x777d('0x3e')]);_0x1c7895[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x1d27c3[_0x777d('0x35')][_0x777d('0x27')]);}_0x1c7895[_0x777d('0x3f')]=qs['sort'](_0x1d27c3['query'][_0x777d('0x40')]);_0x1c7895['where']=qs[_0x777d('0x37')](_[_0x777d('0x41')](_0x1d27c3['query'],_0x164cf0[_0x777d('0x37')]),_0x20acc1);if(_0x1d27c3[_0x777d('0x35')][_0x777d('0x42')]){_0x1c7895['where']=_[_0x777d('0x43')](_0x1c7895['where'],{'$or':_[_0x777d('0x2f')](_0x20acc1,function(_0x530528){if(_0x530528['type']!==_0x777d('0x44')){var _0x1a52c7={};_0x1a52c7[_0x530528[_0x777d('0x2e')]]={'$like':'%'+_0x1d27c3[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x1a52c7;}})});}_0x1c7895=_[_0x777d('0x43')]({},_0x1c7895,_0x1d27c3[_0x777d('0x45')]);var _0x5c8edb={'where':_0x1c7895[_0x777d('0x46')]};return db[_0x777d('0x30')][_0x777d('0x26')](_0x5c8edb)[_0x777d('0x18')](function(_0x20b919){_0x81c879[_0x777d('0x26')]=_0x20b919;if(_0x1d27c3['query'][_0x777d('0x47')]){_0x1c7895[_0x777d('0x48')]=[{'all':!![]}];}return db[_0x777d('0x30')][_0x777d('0x49')](_0x1c7895);})[_0x777d('0x18')](function(_0x304498){_0x81c879[_0x777d('0x4a')]=_0x304498;return _0x81c879;})['then'](respondWithFilteredResult(_0x95c32b,_0x1c7895))[_0x777d('0x21')](handleError(_0x95c32b,null));};exports[_0x777d('0x4b')]=function(_0x1dd2ba,_0x37d518){var _0xc0e8bc={'raw':![],'where':{'id':_0x1dd2ba[_0x777d('0x4c')]['id']}},_0x3f32d8={};_0x3f32d8[_0x777d('0x34')]=_['keys'](db[_0x777d('0x30')][_0x777d('0x4d')]);_0x3f32d8[_0x777d('0x35')]=_[_0x777d('0x36')](_0x1dd2ba[_0x777d('0x35')]);_0x3f32d8[_0x777d('0x37')]=_[_0x777d('0x38')](_0x3f32d8['model'],_0x3f32d8[_0x777d('0x35')]);_0xc0e8bc['attributes']=_[_0x777d('0x38')](_0x3f32d8[_0x777d('0x34')],qs[_0x777d('0x39')](_0x1dd2ba['query'][_0x777d('0x39')]));_0xc0e8bc['attributes']=_0xc0e8bc[_0x777d('0x3a')][_0x777d('0x3b')]?_0xc0e8bc['attributes']:_0x3f32d8[_0x777d('0x34')];if(_0x1dd2ba[_0x777d('0x35')]['includeAll']){_0xc0e8bc[_0x777d('0x48')]=[{'all':!![]}];}_0xc0e8bc=_[_0x777d('0x43')]({},_0xc0e8bc,_0x1dd2ba[_0x777d('0x45')]);return db[_0x777d('0x30')][_0x777d('0x4e')](_0xc0e8bc)[_0x777d('0x18')](handleEntityNotFound(_0x37d518,null))[_0x777d('0x18')](respondWithResult(_0x37d518,null))[_0x777d('0x21')](handleError(_0x37d518,null));};exports[_0x777d('0x4f')]=function(_0x18b94b,_0x2ca1c4){return db[_0x777d('0x30')][_0x777d('0x4f')](_0x18b94b[_0x777d('0x50')],{})[_0x777d('0x18')](respondWithResult(_0x2ca1c4,0xc9))[_0x777d('0x21')](handleError(_0x2ca1c4,null));};exports[_0x777d('0x2c')]=function(_0x5805c8,_0x514fdd){if(_0x5805c8['body']['id']){delete _0x5805c8[_0x777d('0x50')]['id'];}return db[_0x777d('0x30')][_0x777d('0x4e')]({'where':{'id':_0x5805c8[_0x777d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x514fdd,null))[_0x777d('0x18')](saveUpdates(_0x5805c8[_0x777d('0x50')],null))[_0x777d('0x18')](respondWithResult(_0x514fdd,null))[_0x777d('0x21')](handleError(_0x514fdd,null));};exports[_0x777d('0x51')]=function(_0x190457,_0x23386e){return db['DeskConfiguration'][_0x777d('0x4e')]({'where':{'id':_0x190457[_0x777d('0x4c')]['id']}})[_0x777d('0x18')](handleEntityNotFound(_0x23386e,null))[_0x777d('0x18')](removeEntity(_0x23386e,null))[_0x777d('0x21')](handleError(_0x23386e,null));};exports[_0x777d('0x52')]=function(_0x12ffc7,_0x427ed1,_0x1f0ed7){var _0x524a6d={};var _0x10ec97={};var _0x2683d1;var _0x35406e;return db[_0x777d('0x30')][_0x777d('0x53')]({'where':{'id':_0x12ffc7[_0x777d('0x4c')]['id']}})[_0x777d('0x18')](handleEntityNotFound(_0x427ed1,null))[_0x777d('0x18')](function(_0x1b8b9b){if(_0x1b8b9b){_0x2683d1=_0x1b8b9b;_0x10ec97[_0x777d('0x34')]=_[_0x777d('0x36')](db[_0x777d('0x54')][_0x777d('0x4d')]);_0x10ec97[_0x777d('0x35')]=_[_0x777d('0x36')](_0x12ffc7['query']);_0x10ec97['filters']=_[_0x777d('0x38')](_0x10ec97[_0x777d('0x34')],_0x10ec97[_0x777d('0x35')]);_0x524a6d[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x10ec97[_0x777d('0x34')],qs[_0x777d('0x39')](_0x12ffc7['query']['fields']));_0x524a6d['attributes']=_0x524a6d[_0x777d('0x3a')][_0x777d('0x3b')]?_0x524a6d[_0x777d('0x3a')]:_0x10ec97[_0x777d('0x34')];_0x524a6d[_0x777d('0x3f')]=qs['sort'](_0x12ffc7['query'][_0x777d('0x40')]);_0x524a6d['where']=qs['filters'](_[_0x777d('0x41')](_0x12ffc7[_0x777d('0x35')],_0x10ec97['filters']));if(_0x12ffc7[_0x777d('0x35')][_0x777d('0x42')]){_0x524a6d['where']=_[_0x777d('0x43')](_0x524a6d['where'],{'$or':_[_0x777d('0x2f')](_0x524a6d[_0x777d('0x3a')],function(_0x41b049){var _0xaa8036={};_0xaa8036[_0x41b049]={'$like':'%'+_0x12ffc7['query']['filter']+'%'};return _0xaa8036;})});}_0x524a6d=_[_0x777d('0x43')]({},_0x524a6d,_0x12ffc7[_0x777d('0x45')]);return _0x2683d1[_0x777d('0x52')](_0x524a6d);}})['then'](function(_0x3b26b0){if(_0x3b26b0){_0x35406e=_0x3b26b0[_0x777d('0x3b')];if(!_0x12ffc7[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x524a6d[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x12ffc7['query']['limit']);_0x524a6d[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x12ffc7['query']['offset']);}return _0x2683d1[_0x777d('0x52')](_0x524a6d);}})[_0x777d('0x18')](function(_0x536205){if(_0x536205){return _0x536205?{'count':_0x35406e,'rows':_0x536205}:null;}})[_0x777d('0x18')](respondWithResult(_0x427ed1,null))[_0x777d('0x21')](handleError(_0x427ed1,null));};exports[_0x777d('0x55')]=function(_0x68efbb,_0x23fec3,_0x366b82){var _0x5ad706={};var _0x2c4b80={};var _0x4b3e11;var _0x53a514;return db['DeskConfiguration'][_0x777d('0x53')]({'where':{'id':_0x68efbb['params']['id']}})['then'](handleEntityNotFound(_0x23fec3,null))[_0x777d('0x18')](function(_0x26c7bb){if(_0x26c7bb){_0x4b3e11=_0x26c7bb;_0x2c4b80[_0x777d('0x34')]=_[_0x777d('0x36')](db['DeskField']['rawAttributes']);_0x2c4b80[_0x777d('0x35')]=_['keys'](_0x68efbb['query']);_0x2c4b80['filters']=_[_0x777d('0x38')](_0x2c4b80[_0x777d('0x34')],_0x2c4b80[_0x777d('0x35')]);_0x5ad706[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x2c4b80['model'],qs[_0x777d('0x39')](_0x68efbb['query'][_0x777d('0x39')]));_0x5ad706[_0x777d('0x3a')]=_0x5ad706[_0x777d('0x3a')][_0x777d('0x3b')]?_0x5ad706[_0x777d('0x3a')]:_0x2c4b80[_0x777d('0x34')];_0x5ad706[_0x777d('0x3f')]=qs[_0x777d('0x40')](_0x68efbb[_0x777d('0x35')][_0x777d('0x40')]);_0x5ad706[_0x777d('0x46')]=qs['filters'](_[_0x777d('0x41')](_0x68efbb['query'],_0x2c4b80[_0x777d('0x37')]));if(_0x68efbb[_0x777d('0x35')][_0x777d('0x42')]){_0x5ad706[_0x777d('0x46')]=_[_0x777d('0x43')](_0x5ad706[_0x777d('0x46')],{'$or':_['map'](_0x5ad706['attributes'],function(_0x934749){var _0x154a71={};_0x154a71[_0x934749]={'$like':'%'+_0x68efbb[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x154a71;})});}_0x5ad706=_[_0x777d('0x43')]({},_0x5ad706,_0x68efbb[_0x777d('0x45')]);return _0x4b3e11['getSubjects'](_0x5ad706);}})[_0x777d('0x18')](function(_0xf14fc3){if(_0xf14fc3){_0x53a514=_0xf14fc3[_0x777d('0x3b')];if(!_0x68efbb[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x5ad706[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x68efbb[_0x777d('0x35')][_0x777d('0x3e')]);_0x5ad706[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x68efbb['query'][_0x777d('0x27')]);}return _0x4b3e11['getSubjects'](_0x5ad706);}})[_0x777d('0x18')](function(_0x39bccc){if(_0x39bccc){return _0x39bccc?{'count':_0x53a514,'rows':_0x39bccc}:null;}})['then'](respondWithResult(_0x23fec3,null))[_0x777d('0x21')](handleError(_0x23fec3,null));};exports[_0x777d('0x56')]=function(_0x22ca15,_0x1efb12,_0x13adfd){var _0x5dad29={};var _0x1dab92={};var _0x59a658;var _0xc919d1;return db['DeskConfiguration'][_0x777d('0x53')]({'where':{'id':_0x22ca15['params']['id']}})['then'](handleEntityNotFound(_0x1efb12,null))[_0x777d('0x18')](function(_0x1476bd){if(_0x1476bd){_0x59a658=_0x1476bd;_0x1dab92[_0x777d('0x34')]=_[_0x777d('0x36')](db[_0x777d('0x54')][_0x777d('0x4d')]);_0x1dab92[_0x777d('0x35')]=_[_0x777d('0x36')](_0x22ca15[_0x777d('0x35')]);_0x1dab92[_0x777d('0x37')]=_[_0x777d('0x38')](_0x1dab92[_0x777d('0x34')],_0x1dab92[_0x777d('0x35')]);_0x5dad29[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x1dab92[_0x777d('0x34')],qs[_0x777d('0x39')](_0x22ca15[_0x777d('0x35')][_0x777d('0x39')]));_0x5dad29[_0x777d('0x3a')]=_0x5dad29[_0x777d('0x3a')][_0x777d('0x3b')]?_0x5dad29[_0x777d('0x3a')]:_0x1dab92['model'];_0x5dad29[_0x777d('0x3f')]=qs[_0x777d('0x40')](_0x22ca15[_0x777d('0x35')]['sort']);_0x5dad29[_0x777d('0x46')]=qs[_0x777d('0x37')](_[_0x777d('0x41')](_0x22ca15[_0x777d('0x35')],_0x1dab92['filters']));if(_0x22ca15[_0x777d('0x35')][_0x777d('0x42')]){_0x5dad29[_0x777d('0x46')]=_[_0x777d('0x43')](_0x5dad29[_0x777d('0x46')],{'$or':_[_0x777d('0x2f')](_0x5dad29[_0x777d('0x3a')],function(_0x277236){var _0x492e7a={};_0x492e7a[_0x277236]={'$like':'%'+_0x22ca15[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x492e7a;})});}_0x5dad29=_[_0x777d('0x43')]({},_0x5dad29,_0x22ca15[_0x777d('0x45')]);return _0x59a658['getDescriptions'](_0x5dad29);}})[_0x777d('0x18')](function(_0x31298c){if(_0x31298c){_0xc919d1=_0x31298c[_0x777d('0x3b')];if(!_0x22ca15[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x5dad29[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x22ca15[_0x777d('0x35')]['limit']);_0x5dad29[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x22ca15[_0x777d('0x35')][_0x777d('0x27')]);}return _0x59a658[_0x777d('0x56')](_0x5dad29);}})['then'](function(_0x500d79){if(_0x500d79){return _0x500d79?{'count':_0xc919d1,'rows':_0x500d79}:null;}})[_0x777d('0x18')](respondWithResult(_0x1efb12,null))['catch'](handleError(_0x1efb12,null));};exports['getTags']=function(_0x10ef6c,_0xe6d9bb,_0x166f21){var _0x30d6b1={};var _0x49c9f9={};var _0x91eea6;var _0x52ebd3;return db[_0x777d('0x30')]['findOne']({'where':{'id':_0x10ef6c[_0x777d('0x4c')]['id']}})[_0x777d('0x18')](handleEntityNotFound(_0xe6d9bb,null))[_0x777d('0x18')](function(_0x5e2373){if(_0x5e2373){_0x91eea6=_0x5e2373;_0x49c9f9[_0x777d('0x34')]=_[_0x777d('0x36')](db[_0x777d('0x57')][_0x777d('0x4d')]);_0x49c9f9[_0x777d('0x35')]=_['keys'](_0x10ef6c[_0x777d('0x35')]);_0x49c9f9['filters']=_[_0x777d('0x38')](_0x49c9f9[_0x777d('0x34')],_0x49c9f9[_0x777d('0x35')]);_0x30d6b1[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x49c9f9[_0x777d('0x34')],qs[_0x777d('0x39')](_0x10ef6c['query']['fields']));_0x30d6b1[_0x777d('0x3a')]=_0x30d6b1['attributes']['length']?_0x30d6b1['attributes']:_0x49c9f9[_0x777d('0x34')];_0x30d6b1['order']=qs[_0x777d('0x40')](_0x10ef6c[_0x777d('0x35')]['sort']);_0x30d6b1[_0x777d('0x46')]=qs[_0x777d('0x37')](_[_0x777d('0x41')](_0x10ef6c[_0x777d('0x35')],_0x49c9f9['filters']));if(_0x10ef6c[_0x777d('0x35')][_0x777d('0x42')]){_0x30d6b1['where']=_['merge'](_0x30d6b1['where'],{'$or':_[_0x777d('0x2f')](_0x30d6b1[_0x777d('0x3a')],function(_0xfd34df){var _0x2bdfcc={};_0x2bdfcc[_0xfd34df]={'$like':'%'+_0x10ef6c[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x2bdfcc;})});}_0x30d6b1=_['merge']({},_0x30d6b1,_0x10ef6c['options']);return _0x91eea6[_0x777d('0x58')](_0x30d6b1);}})[_0x777d('0x18')](function(_0x1019f9){if(_0x1019f9){_0x52ebd3=_0x1019f9[_0x777d('0x3b')];if(!_0x10ef6c[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x30d6b1[_0x777d('0x3e')]=qs['limit'](_0x10ef6c[_0x777d('0x35')][_0x777d('0x3e')]);_0x30d6b1[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x10ef6c[_0x777d('0x35')][_0x777d('0x27')]);}return _0x91eea6[_0x777d('0x58')](_0x30d6b1);}})[_0x777d('0x18')](function(_0xb9ee98){if(_0xb9ee98){return _0xb9ee98?{'count':_0x52ebd3,'rows':_0xb9ee98}:null;}})[_0x777d('0x18')](respondWithResult(_0xe6d9bb,null))[_0x777d('0x21')](handleError(_0xe6d9bb,null));};exports[_0x777d('0x59')]=function(_0x1c7dc3,_0x3584b8,_0x2262ca){if(_0x1c7dc3[_0x777d('0x50')]['id']){delete _0x1c7dc3[_0x777d('0x50')]['id'];}return db[_0x777d('0x30')][_0x777d('0x53')]({'where':{'id':_0x1c7dc3['params']['id']}})['then'](handleEntityNotFound(_0x3584b8,null))[_0x777d('0x18')](function(_0x253c1e){if(_0x253c1e){return _0x253c1e[_0x777d('0x59')](_0x1c7dc3['body'][_0x777d('0x5a')]||[]);}return null;})[_0x777d('0x18')](respondWithResult(_0x3584b8,null))['catch'](handleError(_0x3584b8,null));}; \ No newline at end of file +var _0xb3de=['index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','DeskConfiguration','count','includeAll','findAll','rows','params','include','find','create','body','getFields','getSubjects','findOne','DeskField','pick','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','offset','limit','set','save','update','then','destroy','end','name','send'];(function(_0x13c44b,_0x16c205){var _0x5b392f=function(_0x52e680){while(--_0x52e680){_0x13c44b['push'](_0x13c44b['shift']());}};_0x5b392f(++_0x16c205);}(_0xb3de,0x81));var _0xeb3d=function(_0x24441e,_0x2e9b50){_0x24441e=_0x24441e-0x0;var _0x27d564=_0xb3de[_0x24441e];return _0x27d564;};'use strict';var pdf=require(_0xeb3d('0x0'));var emlformat=require(_0xeb3d('0x1'));var rimraf=require(_0xeb3d('0x2'));var zipdir=require(_0xeb3d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb3d('0x4'));var BPromise=require(_0xeb3d('0x5'));var Mustache=require(_0xeb3d('0x6'));var util=require(_0xeb3d('0x7'));var path=require('path');var sox=require(_0xeb3d('0x8'));var csv=require('to-csv');var ejs=require(_0xeb3d('0x9'));var fs=require('fs');var _=require(_0xeb3d('0xa'));var squel=require(_0xeb3d('0xb'));var crypto=require(_0xeb3d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeb3d('0xd'));var toCsv=require(_0xeb3d('0xe'));var querystring=require(_0xeb3d('0xf'));var Papa=require('papaparse');var Redis=require(_0xeb3d('0x10'));var authService=require(_0xeb3d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeb3d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb3d('0x13'))(_0xeb3d('0x14'));var utils=require(_0xeb3d('0x15'));var config=require(_0xeb3d('0x16'));var licenseUtil=require(_0xeb3d('0x17'));var db=require(_0xeb3d('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39aa1f,_0xdec74d,_0x1c83dc,_0x4fa2ca){return new BPromise(function(_0x11d798,_0x2fffa7){var _0x322a66=_0x4fa2ca||client;return _0x322a66['request'](_0x39aa1f,_0x1c83dc)['then'](function(_0x332765){logger[_0xeb3d('0x19')](_0xeb3d('0x1a'),_0xdec74d,'request\x20sent');logger[_0xeb3d('0x1b')](_0xeb3d('0x1c'),_0xdec74d,_0xeb3d('0x1d'),JSON[_0xeb3d('0x1e')](_0x332765));if(_0x332765[_0xeb3d('0x1f')]){if(_0x332765['error'][_0xeb3d('0x20')]===0x1f4){logger[_0xeb3d('0x1f')](_0xeb3d('0x1a'),_0xdec74d,_0x332765[_0xeb3d('0x1f')][_0xeb3d('0x21')]);return _0x2fffa7(_0x332765[_0xeb3d('0x1f')][_0xeb3d('0x21')]);}logger[_0xeb3d('0x1f')](_0xeb3d('0x1a'),_0xdec74d,_0x332765[_0xeb3d('0x1f')][_0xeb3d('0x21')]);return _0x11d798(_0x332765[_0xeb3d('0x1f')][_0xeb3d('0x21')]);}else{logger['info'](_0xeb3d('0x1a'),_0xdec74d,_0xeb3d('0x1d'));_0x11d798(_0x332765['result']['message']);}})[_0xeb3d('0x22')](function(_0x26927e){logger[_0xeb3d('0x1f')](_0xeb3d('0x1a'),_0xdec74d,_0x26927e);_0x2fffa7(_0x26927e);});});}function respondWithStatusCode(_0x5d73b0,_0x2d6e09){_0x2d6e09=_0x2d6e09||0xcc;return function(_0x403140){if(_0x403140){return _0x5d73b0[_0xeb3d('0x23')](_0x2d6e09);}return _0x5d73b0[_0xeb3d('0x24')](_0x2d6e09)['end']();};}function respondWithResult(_0x1b506c,_0x584af6){_0x584af6=_0x584af6||0xc8;return function(_0x4010a6){if(_0x4010a6){return _0x1b506c['status'](_0x584af6)['json'](_0x4010a6);}};}function respondWithFilteredResult(_0x295fda,_0x296875){return function(_0x323f18){if(_0x323f18){var _0x1b230f=_0x323f18['count'],_0x58474a=_0x296875['offset'],_0x3d19b3=_0x296875[_0xeb3d('0x25')]+_0x296875[_0xeb3d('0x26')],_0x9e5393;if(_0x3d19b3>=_0x1b230f){_0x3d19b3=_0x1b230f;_0x9e5393=0xc8;}else{_0x9e5393=0xce;}_0x295fda[_0xeb3d('0x24')](_0x9e5393);return _0x295fda[_0xeb3d('0x27')]('Content-Range',_0x58474a+'-'+_0x3d19b3+'/'+_0x1b230f)['json'](_0x323f18);}return null;};}function patchUpdates(_0x3f9eac){return function(_0x467429){try{jsonpatch['apply'](_0x467429,_0x3f9eac,!![]);}catch(_0x2e2929){return BPromise['reject'](_0x2e2929);}return _0x467429[_0xeb3d('0x28')]();};}function saveUpdates(_0x45c4a9,_0xd541a9){return function(_0xf713ef){if(_0xf713ef){return _0xf713ef[_0xeb3d('0x29')](_0x45c4a9)[_0xeb3d('0x2a')](function(_0x398b73){return _0x398b73;});}return null;};}function removeEntity(_0x49ac5b,_0x4f3e25){return function(_0x34e651){if(_0x34e651){return _0x34e651[_0xeb3d('0x2b')]()[_0xeb3d('0x2a')](function(){_0x49ac5b[_0xeb3d('0x24')](0xcc)[_0xeb3d('0x2c')]();});}};}function handleEntityNotFound(_0x83e2c8,_0x587a1d){return function(_0x15ebf7){if(!_0x15ebf7){_0x83e2c8['sendStatus'](0x194);}return _0x15ebf7;};}function handleError(_0x23566a,_0x60e776){_0x60e776=_0x60e776||0x1f4;return function(_0x15fa6e){logger[_0xeb3d('0x1f')](_0x15fa6e['stack']);if(_0x15fa6e[_0xeb3d('0x2d')]){delete _0x15fa6e['name'];}_0x23566a['status'](_0x60e776)[_0xeb3d('0x2e')](_0x15fa6e);};}exports[_0xeb3d('0x2f')]=function(_0x65de5f,_0x27f60f){var _0x218f34={},_0x199450={},_0x33d714={'count':0x0,'rows':[]};var _0x2ac17e=_[_0xeb3d('0x30')](db['DeskConfiguration'][_0xeb3d('0x31')],function(_0x5b2558){return{'name':_0x5b2558[_0xeb3d('0x32')],'type':_0x5b2558[_0xeb3d('0x33')][_0xeb3d('0x34')]};});_0x199450[_0xeb3d('0x35')]=_['map'](_0x2ac17e,'name');_0x199450['query']=_[_0xeb3d('0x36')](_0x65de5f[_0xeb3d('0x37')]);_0x199450[_0xeb3d('0x38')]=_[_0xeb3d('0x39')](_0x199450[_0xeb3d('0x35')],_0x199450[_0xeb3d('0x37')]);_0x218f34[_0xeb3d('0x3a')]=_['intersection'](_0x199450[_0xeb3d('0x35')],qs[_0xeb3d('0x3b')](_0x65de5f[_0xeb3d('0x37')][_0xeb3d('0x3b')]));_0x218f34[_0xeb3d('0x3a')]=_0x218f34['attributes'][_0xeb3d('0x3c')]?_0x218f34['attributes']:_0x199450[_0xeb3d('0x35')];if(!_0x65de5f[_0xeb3d('0x37')][_0xeb3d('0x3d')](_0xeb3d('0x3e'))){_0x218f34[_0xeb3d('0x26')]=qs['limit'](_0x65de5f['query']['limit']);_0x218f34[_0xeb3d('0x25')]=qs[_0xeb3d('0x25')](_0x65de5f[_0xeb3d('0x37')][_0xeb3d('0x25')]);}_0x218f34[_0xeb3d('0x3f')]=qs[_0xeb3d('0x40')](_0x65de5f[_0xeb3d('0x37')]['sort']);_0x218f34[_0xeb3d('0x41')]=qs['filters'](_['pick'](_0x65de5f[_0xeb3d('0x37')],_0x199450['filters']),_0x2ac17e);if(_0x65de5f['query'][_0xeb3d('0x42')]){_0x218f34['where']=_['merge'](_0x218f34[_0xeb3d('0x41')],{'$or':_['map'](_0x2ac17e,function(_0x1b04fc){if(_0x1b04fc[_0xeb3d('0x33')]!=='VIRTUAL'){var _0x5665d0={};_0x5665d0[_0x1b04fc[_0xeb3d('0x2d')]]={'$like':'%'+_0x65de5f[_0xeb3d('0x37')]['filter']+'%'};return _0x5665d0;}})});}_0x218f34=_[_0xeb3d('0x43')]({},_0x218f34,_0x65de5f[_0xeb3d('0x44')]);var _0x163a28={'where':_0x218f34[_0xeb3d('0x41')]};return db[_0xeb3d('0x45')][_0xeb3d('0x46')](_0x163a28)[_0xeb3d('0x2a')](function(_0x1c2ffb){_0x33d714['count']=_0x1c2ffb;if(_0x65de5f[_0xeb3d('0x37')][_0xeb3d('0x47')]){_0x218f34['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0xeb3d('0x48')](_0x218f34);})['then'](function(_0x5848b8){_0x33d714[_0xeb3d('0x49')]=_0x5848b8;return _0x33d714;})[_0xeb3d('0x2a')](respondWithFilteredResult(_0x27f60f,_0x218f34))[_0xeb3d('0x22')](handleError(_0x27f60f,null));};exports['show']=function(_0x121e19,_0x504d82){var _0xaf4ef6={'raw':![],'where':{'id':_0x121e19[_0xeb3d('0x4a')]['id']}},_0x345489={};_0x345489[_0xeb3d('0x35')]=_[_0xeb3d('0x36')](db[_0xeb3d('0x45')]['rawAttributes']);_0x345489[_0xeb3d('0x37')]=_['keys'](_0x121e19[_0xeb3d('0x37')]);_0x345489['filters']=_[_0xeb3d('0x39')](_0x345489[_0xeb3d('0x35')],_0x345489[_0xeb3d('0x37')]);_0xaf4ef6[_0xeb3d('0x3a')]=_[_0xeb3d('0x39')](_0x345489[_0xeb3d('0x35')],qs[_0xeb3d('0x3b')](_0x121e19[_0xeb3d('0x37')][_0xeb3d('0x3b')]));_0xaf4ef6[_0xeb3d('0x3a')]=_0xaf4ef6[_0xeb3d('0x3a')][_0xeb3d('0x3c')]?_0xaf4ef6[_0xeb3d('0x3a')]:_0x345489[_0xeb3d('0x35')];if(_0x121e19[_0xeb3d('0x37')]['includeAll']){_0xaf4ef6[_0xeb3d('0x4b')]=[{'all':!![]}];}_0xaf4ef6=_['merge']({},_0xaf4ef6,_0x121e19[_0xeb3d('0x44')]);return db[_0xeb3d('0x45')][_0xeb3d('0x4c')](_0xaf4ef6)['then'](handleEntityNotFound(_0x504d82,null))[_0xeb3d('0x2a')](respondWithResult(_0x504d82,null))[_0xeb3d('0x22')](handleError(_0x504d82,null));};exports[_0xeb3d('0x4d')]=function(_0x201642,_0x1425e6){return db[_0xeb3d('0x45')][_0xeb3d('0x4d')](_0x201642[_0xeb3d('0x4e')],{})[_0xeb3d('0x2a')](respondWithResult(_0x1425e6,0xc9))[_0xeb3d('0x22')](handleError(_0x1425e6,null));};exports[_0xeb3d('0x29')]=function(_0xcd7eed,_0x24e5db){if(_0xcd7eed[_0xeb3d('0x4e')]['id']){delete _0xcd7eed[_0xeb3d('0x4e')]['id'];}return db[_0xeb3d('0x45')][_0xeb3d('0x4c')]({'where':{'id':_0xcd7eed[_0xeb3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24e5db,null))['then'](saveUpdates(_0xcd7eed['body'],null))[_0xeb3d('0x2a')](respondWithResult(_0x24e5db,null))[_0xeb3d('0x22')](handleError(_0x24e5db,null));};exports[_0xeb3d('0x2b')]=function(_0x286aa8,_0x5684c6){return db[_0xeb3d('0x45')][_0xeb3d('0x4c')]({'where':{'id':_0x286aa8[_0xeb3d('0x4a')]['id']}})[_0xeb3d('0x2a')](handleEntityNotFound(_0x5684c6,null))[_0xeb3d('0x2a')](removeEntity(_0x5684c6,null))[_0xeb3d('0x22')](handleError(_0x5684c6,null));};exports[_0xeb3d('0x4f')]=function(_0x11fade,_0x213e86,_0x3c1b9c){var _0x1b811e={};var _0x159a3c={};var _0x5ad111;var _0x20ab73;return db[_0xeb3d('0x45')]['findOne']({'where':{'id':_0x11fade[_0xeb3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x213e86,null))[_0xeb3d('0x2a')](function(_0xf4d5ed){if(_0xf4d5ed){_0x5ad111=_0xf4d5ed;_0x159a3c[_0xeb3d('0x35')]=_[_0xeb3d('0x36')](db['DeskField'][_0xeb3d('0x31')]);_0x159a3c[_0xeb3d('0x37')]=_['keys'](_0x11fade[_0xeb3d('0x37')]);_0x159a3c[_0xeb3d('0x38')]=_[_0xeb3d('0x39')](_0x159a3c[_0xeb3d('0x35')],_0x159a3c[_0xeb3d('0x37')]);_0x1b811e[_0xeb3d('0x3a')]=_['intersection'](_0x159a3c[_0xeb3d('0x35')],qs[_0xeb3d('0x3b')](_0x11fade['query'][_0xeb3d('0x3b')]));_0x1b811e[_0xeb3d('0x3a')]=_0x1b811e[_0xeb3d('0x3a')][_0xeb3d('0x3c')]?_0x1b811e[_0xeb3d('0x3a')]:_0x159a3c[_0xeb3d('0x35')];_0x1b811e['order']=qs[_0xeb3d('0x40')](_0x11fade[_0xeb3d('0x37')][_0xeb3d('0x40')]);_0x1b811e[_0xeb3d('0x41')]=qs[_0xeb3d('0x38')](_['pick'](_0x11fade[_0xeb3d('0x37')],_0x159a3c[_0xeb3d('0x38')]));if(_0x11fade[_0xeb3d('0x37')]['filter']){_0x1b811e[_0xeb3d('0x41')]=_['merge'](_0x1b811e['where'],{'$or':_['map'](_0x1b811e['attributes'],function(_0x519c3c){var _0x1a0e5c={};_0x1a0e5c[_0x519c3c]={'$like':'%'+_0x11fade[_0xeb3d('0x37')]['filter']+'%'};return _0x1a0e5c;})});}_0x1b811e=_['merge']({},_0x1b811e,_0x11fade['options']);return _0x5ad111[_0xeb3d('0x4f')](_0x1b811e);}})['then'](function(_0x4b8931){if(_0x4b8931){_0x20ab73=_0x4b8931['length'];if(!_0x11fade['query'][_0xeb3d('0x3d')](_0xeb3d('0x3e'))){_0x1b811e[_0xeb3d('0x26')]=qs[_0xeb3d('0x26')](_0x11fade[_0xeb3d('0x37')]['limit']);_0x1b811e[_0xeb3d('0x25')]=qs[_0xeb3d('0x25')](_0x11fade[_0xeb3d('0x37')][_0xeb3d('0x25')]);}return _0x5ad111[_0xeb3d('0x4f')](_0x1b811e);}})[_0xeb3d('0x2a')](function(_0x2b292d){if(_0x2b292d){return _0x2b292d?{'count':_0x20ab73,'rows':_0x2b292d}:null;}})['then'](respondWithResult(_0x213e86,null))[_0xeb3d('0x22')](handleError(_0x213e86,null));};exports[_0xeb3d('0x50')]=function(_0xbffcc3,_0x16a3e0,_0x313b80){var _0x5b652e={};var _0x761a18={};var _0x1b029e;var _0x1f58b1;return db[_0xeb3d('0x45')][_0xeb3d('0x51')]({'where':{'id':_0xbffcc3['params']['id']}})[_0xeb3d('0x2a')](handleEntityNotFound(_0x16a3e0,null))[_0xeb3d('0x2a')](function(_0x516f42){if(_0x516f42){_0x1b029e=_0x516f42;_0x761a18['model']=_[_0xeb3d('0x36')](db[_0xeb3d('0x52')]['rawAttributes']);_0x761a18[_0xeb3d('0x37')]=_[_0xeb3d('0x36')](_0xbffcc3[_0xeb3d('0x37')]);_0x761a18[_0xeb3d('0x38')]=_[_0xeb3d('0x39')](_0x761a18['model'],_0x761a18[_0xeb3d('0x37')]);_0x5b652e[_0xeb3d('0x3a')]=_[_0xeb3d('0x39')](_0x761a18[_0xeb3d('0x35')],qs[_0xeb3d('0x3b')](_0xbffcc3[_0xeb3d('0x37')][_0xeb3d('0x3b')]));_0x5b652e[_0xeb3d('0x3a')]=_0x5b652e[_0xeb3d('0x3a')][_0xeb3d('0x3c')]?_0x5b652e['attributes']:_0x761a18[_0xeb3d('0x35')];_0x5b652e[_0xeb3d('0x3f')]=qs[_0xeb3d('0x40')](_0xbffcc3[_0xeb3d('0x37')][_0xeb3d('0x40')]);_0x5b652e[_0xeb3d('0x41')]=qs['filters'](_[_0xeb3d('0x53')](_0xbffcc3['query'],_0x761a18[_0xeb3d('0x38')]));if(_0xbffcc3[_0xeb3d('0x37')][_0xeb3d('0x42')]){_0x5b652e[_0xeb3d('0x41')]=_[_0xeb3d('0x43')](_0x5b652e[_0xeb3d('0x41')],{'$or':_[_0xeb3d('0x30')](_0x5b652e[_0xeb3d('0x3a')],function(_0x3d36b6){var _0x196e06={};_0x196e06[_0x3d36b6]={'$like':'%'+_0xbffcc3[_0xeb3d('0x37')][_0xeb3d('0x42')]+'%'};return _0x196e06;})});}_0x5b652e=_['merge']({},_0x5b652e,_0xbffcc3[_0xeb3d('0x44')]);return _0x1b029e['getSubjects'](_0x5b652e);}})[_0xeb3d('0x2a')](function(_0x1d1754){if(_0x1d1754){_0x1f58b1=_0x1d1754[_0xeb3d('0x3c')];if(!_0xbffcc3['query'][_0xeb3d('0x3d')]('nolimit')){_0x5b652e['limit']=qs[_0xeb3d('0x26')](_0xbffcc3[_0xeb3d('0x37')][_0xeb3d('0x26')]);_0x5b652e[_0xeb3d('0x25')]=qs[_0xeb3d('0x25')](_0xbffcc3[_0xeb3d('0x37')][_0xeb3d('0x25')]);}return _0x1b029e[_0xeb3d('0x50')](_0x5b652e);}})[_0xeb3d('0x2a')](function(_0x133c8a){if(_0x133c8a){return _0x133c8a?{'count':_0x1f58b1,'rows':_0x133c8a}:null;}})[_0xeb3d('0x2a')](respondWithResult(_0x16a3e0,null))[_0xeb3d('0x22')](handleError(_0x16a3e0,null));};exports[_0xeb3d('0x54')]=function(_0x4c3d6f,_0x1c6aba,_0x302baf){var _0x3539bb={};var _0x3631bf={};var _0x3fd4ee;var _0x805799;return db[_0xeb3d('0x45')]['findOne']({'where':{'id':_0x4c3d6f[_0xeb3d('0x4a')]['id']}})[_0xeb3d('0x2a')](handleEntityNotFound(_0x1c6aba,null))[_0xeb3d('0x2a')](function(_0x2e7a01){if(_0x2e7a01){_0x3fd4ee=_0x2e7a01;_0x3631bf['model']=_['keys'](db[_0xeb3d('0x52')][_0xeb3d('0x31')]);_0x3631bf[_0xeb3d('0x37')]=_[_0xeb3d('0x36')](_0x4c3d6f[_0xeb3d('0x37')]);_0x3631bf[_0xeb3d('0x38')]=_['intersection'](_0x3631bf[_0xeb3d('0x35')],_0x3631bf[_0xeb3d('0x37')]);_0x3539bb[_0xeb3d('0x3a')]=_[_0xeb3d('0x39')](_0x3631bf[_0xeb3d('0x35')],qs[_0xeb3d('0x3b')](_0x4c3d6f[_0xeb3d('0x37')]['fields']));_0x3539bb[_0xeb3d('0x3a')]=_0x3539bb[_0xeb3d('0x3a')]['length']?_0x3539bb[_0xeb3d('0x3a')]:_0x3631bf[_0xeb3d('0x35')];_0x3539bb[_0xeb3d('0x3f')]=qs[_0xeb3d('0x40')](_0x4c3d6f[_0xeb3d('0x37')]['sort']);_0x3539bb[_0xeb3d('0x41')]=qs[_0xeb3d('0x38')](_['pick'](_0x4c3d6f[_0xeb3d('0x37')],_0x3631bf[_0xeb3d('0x38')]));if(_0x4c3d6f[_0xeb3d('0x37')][_0xeb3d('0x42')]){_0x3539bb[_0xeb3d('0x41')]=_[_0xeb3d('0x43')](_0x3539bb[_0xeb3d('0x41')],{'$or':_[_0xeb3d('0x30')](_0x3539bb[_0xeb3d('0x3a')],function(_0x158453){var _0x46570c={};_0x46570c[_0x158453]={'$like':'%'+_0x4c3d6f['query'][_0xeb3d('0x42')]+'%'};return _0x46570c;})});}_0x3539bb=_['merge']({},_0x3539bb,_0x4c3d6f[_0xeb3d('0x44')]);return _0x3fd4ee[_0xeb3d('0x54')](_0x3539bb);}})['then'](function(_0x2e43f0){if(_0x2e43f0){_0x805799=_0x2e43f0['length'];if(!_0x4c3d6f['query'][_0xeb3d('0x3d')](_0xeb3d('0x3e'))){_0x3539bb[_0xeb3d('0x26')]=qs['limit'](_0x4c3d6f['query'][_0xeb3d('0x26')]);_0x3539bb[_0xeb3d('0x25')]=qs['offset'](_0x4c3d6f[_0xeb3d('0x37')][_0xeb3d('0x25')]);}return _0x3fd4ee['getDescriptions'](_0x3539bb);}})[_0xeb3d('0x2a')](function(_0x1e6918){if(_0x1e6918){return _0x1e6918?{'count':_0x805799,'rows':_0x1e6918}:null;}})[_0xeb3d('0x2a')](respondWithResult(_0x1c6aba,null))['catch'](handleError(_0x1c6aba,null));};exports['getTags']=function(_0x5517c4,_0x5428cd,_0x315244){var _0xfe40d9={};var _0x26d8b9={};var _0xe8ff7c;var _0x33cec9;return db[_0xeb3d('0x45')][_0xeb3d('0x51')]({'where':{'id':_0x5517c4['params']['id']}})['then'](handleEntityNotFound(_0x5428cd,null))[_0xeb3d('0x2a')](function(_0x41a5dc){if(_0x41a5dc){_0xe8ff7c=_0x41a5dc;_0x26d8b9[_0xeb3d('0x35')]=_['keys'](db[_0xeb3d('0x55')][_0xeb3d('0x31')]);_0x26d8b9[_0xeb3d('0x37')]=_[_0xeb3d('0x36')](_0x5517c4['query']);_0x26d8b9[_0xeb3d('0x38')]=_['intersection'](_0x26d8b9[_0xeb3d('0x35')],_0x26d8b9['query']);_0xfe40d9[_0xeb3d('0x3a')]=_[_0xeb3d('0x39')](_0x26d8b9['model'],qs[_0xeb3d('0x3b')](_0x5517c4[_0xeb3d('0x37')]['fields']));_0xfe40d9[_0xeb3d('0x3a')]=_0xfe40d9[_0xeb3d('0x3a')][_0xeb3d('0x3c')]?_0xfe40d9[_0xeb3d('0x3a')]:_0x26d8b9[_0xeb3d('0x35')];_0xfe40d9[_0xeb3d('0x3f')]=qs['sort'](_0x5517c4[_0xeb3d('0x37')]['sort']);_0xfe40d9['where']=qs[_0xeb3d('0x38')](_[_0xeb3d('0x53')](_0x5517c4[_0xeb3d('0x37')],_0x26d8b9[_0xeb3d('0x38')]));if(_0x5517c4[_0xeb3d('0x37')][_0xeb3d('0x42')]){_0xfe40d9[_0xeb3d('0x41')]=_[_0xeb3d('0x43')](_0xfe40d9[_0xeb3d('0x41')],{'$or':_[_0xeb3d('0x30')](_0xfe40d9[_0xeb3d('0x3a')],function(_0xdb96f4){var _0x384a5c={};_0x384a5c[_0xdb96f4]={'$like':'%'+_0x5517c4['query'][_0xeb3d('0x42')]+'%'};return _0x384a5c;})});}_0xfe40d9=_[_0xeb3d('0x43')]({},_0xfe40d9,_0x5517c4[_0xeb3d('0x44')]);return _0xe8ff7c['getTags'](_0xfe40d9);}})[_0xeb3d('0x2a')](function(_0x3e7931){if(_0x3e7931){_0x33cec9=_0x3e7931[_0xeb3d('0x3c')];if(!_0x5517c4[_0xeb3d('0x37')][_0xeb3d('0x3d')](_0xeb3d('0x3e'))){_0xfe40d9[_0xeb3d('0x26')]=qs[_0xeb3d('0x26')](_0x5517c4[_0xeb3d('0x37')][_0xeb3d('0x26')]);_0xfe40d9[_0xeb3d('0x25')]=qs[_0xeb3d('0x25')](_0x5517c4[_0xeb3d('0x37')][_0xeb3d('0x25')]);}return _0xe8ff7c[_0xeb3d('0x56')](_0xfe40d9);}})[_0xeb3d('0x2a')](function(_0x11712b){if(_0x11712b){return _0x11712b?{'count':_0x33cec9,'rows':_0x11712b}:null;}})[_0xeb3d('0x2a')](respondWithResult(_0x5428cd,null))['catch'](handleError(_0x5428cd,null));};exports[_0xeb3d('0x57')]=function(_0x3fb80a,_0x56b754,_0x3cafbd){if(_0x3fb80a['body']['id']){delete _0x3fb80a[_0xeb3d('0x4e')]['id'];}return db[_0xeb3d('0x45')][_0xeb3d('0x51')]({'where':{'id':_0x3fb80a[_0xeb3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56b754,null))[_0xeb3d('0x2a')](function(_0x2da569){if(_0x2da569){return _0x2da569[_0xeb3d('0x57')](_0x3fb80a[_0xeb3d('0x4e')]['ids']||[]);}return null;})['then'](respondWithResult(_0x56b754,null))['catch'](handleError(_0x56b754,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 48ec9c8..c8914e8 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 _0x7d24=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x1a1afe,_0x991cf5){var _0x34a9af=function(_0xd9d40e){while(--_0xd9d40e){_0x1a1afe['push'](_0x1a1afe['shift']());}};_0x34a9af(++_0x991cf5);}(_0x7d24,0x17a));var _0x47d2=function(_0x56d845,_0x167122){_0x56d845=_0x56d845-0x0;var _0x194ee3=_0x7d24[_0x56d845];return _0x194ee3;};'use strict';var _=require(_0x47d2('0x0'));var util=require(_0x47d2('0x1'));var logger=require(_0x47d2('0x2'))(_0x47d2('0x3'));var moment=require(_0x47d2('0x4'));var BPromise=require(_0x47d2('0x5'));var rp=require(_0x47d2('0x6'));var fs=require('fs');var path=require(_0x47d2('0x7'));var rimraf=require(_0x47d2('0x8'));var config=require(_0x47d2('0x9'));var attributes=require(_0x47d2('0xa'));module[_0x47d2('0xb')]=function(_0x1a4ca5,_0x79400f){return _0x1a4ca5[_0x47d2('0xc')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0791=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x1a9b4f,_0x3b71b4){var _0x3dee13=function(_0x2543fa){while(--_0x2543fa){_0x1a9b4f['push'](_0x1a9b4f['shift']());}};_0x3dee13(++_0x3b71b4);}(_0x0791,0x170));var _0x1079=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x0791[_0x3c487b];return _0x1d65f6;};'use strict';var _=require(_0x1079('0x0'));var util=require(_0x1079('0x1'));var logger=require('../../config/logger')(_0x1079('0x2'));var moment=require(_0x1079('0x3'));var BPromise=require(_0x1079('0x4'));var rp=require(_0x1079('0x5'));var fs=require('fs');var path=require(_0x1079('0x6'));var rimraf=require('rimraf');var config=require(_0x1079('0x7'));var attributes=require(_0x1079('0x8'));module[_0x1079('0x9')]=function(_0x480096,_0x1537a3){return _0x480096[_0x1079('0xa')](_0x1079('0xb'),attributes,{'tableName':_0x1079('0xc'),'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 239e6b9..9851d47 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 _0x7dc2=['jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x7a9452,_0xba8a16){var _0x3d5c38=function(_0x520303){while(--_0x520303){_0x7a9452['push'](_0x7a9452['shift']());}};_0x3d5c38(++_0xba8a16);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27dc('0x0'));var BPromise=require(_0x27dc('0x1'));var rs=require(_0x27dc('0x2'));var fs=require('fs');var Redis=require(_0x27dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27dc('0x4'));var logger=require(_0x27dc('0x5'))('rpc');var config=require(_0x27dc('0x6'));var jayson=require(_0x27dc('0x7'));var client=jayson['client'][_0x27dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2e10,_0x95bbb6,_0x3b3eee){return new BPromise(function(_0x5181ab,_0x45aa07){return client[_0x27dc('0x9')](_0x4d2e10,_0x3b3eee)[_0x27dc('0xa')](function(_0x242997){logger['info'](_0x27dc('0xb'),_0x95bbb6,'request\x20sent');logger[_0x27dc('0xc')](_0x27dc('0xd'),_0x95bbb6,_0x27dc('0xe'),JSON['stringify'](_0x242997));if(_0x242997['error']){if(_0x242997[_0x27dc('0xf')][_0x27dc('0x10')]===0x1f4){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x242997['error'][_0x27dc('0x11')]);return _0x45aa07(_0x242997['error'][_0x27dc('0x11')]);}logger['error'](_0x27dc('0xb'),_0x95bbb6,_0x242997[_0x27dc('0xf')][_0x27dc('0x11')]);return _0x5181ab(_0x242997[_0x27dc('0xf')]['message']);}else{logger[_0x27dc('0x12')](_0x27dc('0xb'),_0x95bbb6,_0x27dc('0xe'));_0x5181ab(_0x242997[_0x27dc('0x13')][_0x27dc('0x11')]);}})['catch'](function(_0x3ff8f8){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x3ff8f8);_0x45aa07(_0x3ff8f8);});});} \ No newline at end of file +var _0x894f=['jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x12ffd0,_0x262382){var _0x380ead=function(_0x2fa25c){while(--_0x2fa25c){_0x12ffd0['push'](_0x12ffd0['shift']());}};_0x380ead(++_0x262382);}(_0x894f,0x14d));var _0xf894=function(_0x357af1,_0x3d41aa){_0x357af1=_0x357af1-0x0;var _0x5b498a=_0x894f[_0x357af1];return _0x5b498a;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var moment=require(_0xf894('0x2'));var BPromise=require(_0xf894('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf894('0x4'))['db'];var utils=require(_0xf894('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf894('0x6'));var jayson=require(_0xf894('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a9fc,_0x371f86,_0x56d9d6){return new BPromise(function(_0x190cb1,_0x3d8f21){return client[_0xf894('0x8')](_0x23a9fc,_0x56d9d6)[_0xf894('0x9')](function(_0x10bb84){logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));logger[_0xf894('0xd')](_0xf894('0xe'),_0x371f86,_0xf894('0xc'),JSON[_0xf894('0xf')](_0x10bb84));if(_0x10bb84[_0xf894('0x10')]){if(_0x10bb84[_0xf894('0x10')][_0xf894('0x11')]===0x1f4){logger[_0xf894('0x10')](_0xf894('0xb'),_0x371f86,_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);return _0x3d8f21(_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);}logger[_0xf894('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x371f86,_0x10bb84[_0xf894('0x10')]['message']);return _0x190cb1(_0x10bb84['error'][_0xf894('0x12')]);}else{logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));_0x190cb1(_0x10bb84[_0xf894('0x13')]['message']);}})['catch'](function(_0x1865be){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x371f86,_0x1865be);_0x3d8f21(_0x1865be);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 937ecab..bc5fb60 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 _0xd096=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x55ba72,_0x5ae964){var _0x51c228=function(_0x8295f){while(--_0x8295f){_0x55ba72['push'](_0x55ba72['shift']());}};_0x51c228(++_0x5ae964);}(_0xd096,0x84));var _0x6d09=function(_0x190906,_0x221642){_0x190906=_0x190906-0x0;var _0x338512=_0xd096[_0x190906];return _0x338512;};'use strict';var multer=require(_0x6d09('0x0'));var util=require(_0x6d09('0x1'));var path=require(_0x6d09('0x2'));var timeout=require(_0x6d09('0x3'));var express=require('express');var router=express[_0x6d09('0x4')]();var auth=require(_0x6d09('0x5'));var interaction=require(_0x6d09('0x6'));var config=require(_0x6d09('0x7'));var controller=require(_0x6d09('0x8'));router[_0x6d09('0x9')]('/',auth[_0x6d09('0xa')](),controller['index']);router[_0x6d09('0x9')](_0x6d09('0xb'),auth[_0x6d09('0xa')](),controller['show']);router[_0x6d09('0xc')]('/',auth[_0x6d09('0xa')](),controller[_0x6d09('0xd')]);router[_0x6d09('0xe')](_0x6d09('0xb'),auth['isAuthenticated'](),controller[_0x6d09('0xf')]);router[_0x6d09('0x10')]('/:id',auth[_0x6d09('0xa')](),controller[_0x6d09('0x11')]);module[_0x6d09('0x12')]=router; \ No newline at end of file +var _0xff4a=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','delete'];(function(_0x322ecf,_0x5d89be){var _0x5603ac=function(_0x54943c){while(--_0x54943c){_0x322ecf['push'](_0x322ecf['shift']());}};_0x5603ac(++_0x5d89be);}(_0xff4a,0x122));var _0xaff4=function(_0x2a0a87,_0xc2c98c){_0x2a0a87=_0x2a0a87-0x0;var _0x592ad2=_0xff4a[_0x2a0a87];return _0x592ad2;};'use strict';var multer=require(_0xaff4('0x0'));var util=require('util');var path=require(_0xaff4('0x1'));var timeout=require(_0xaff4('0x2'));var express=require(_0xaff4('0x3'));var router=express[_0xaff4('0x4')]();var auth=require(_0xaff4('0x5'));var interaction=require(_0xaff4('0x6'));var config=require(_0xaff4('0x7'));var controller=require('./intDeskField.controller');router[_0xaff4('0x8')]('/',auth['isAuthenticated'](),controller[_0xaff4('0x9')]);router[_0xaff4('0x8')](_0xaff4('0xa'),auth['isAuthenticated'](),controller[_0xaff4('0xb')]);router[_0xaff4('0xc')]('/',auth[_0xaff4('0xd')](),controller[_0xaff4('0xe')]);router['put'](_0xaff4('0xa'),auth[_0xaff4('0xd')](),controller['update']);router[_0xaff4('0xf')](_0xaff4('0xa'),auth[_0xaff4('0xd')](),controller['destroy']);module[_0xaff4('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 62a6fcc..12e22be 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 _0xcc23=['string','STRING','customVariable','BOOLEAN','ENUM','variable','keyValue'];(function(_0x34afc6,_0x45ae89){var _0x520925=function(_0x2d862f){while(--_0x2d862f){_0x34afc6['push'](_0x34afc6['shift']());}};_0x520925(++_0x45ae89);}(_0xcc23,0x10e));var _0x3cc2=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xcc23[_0x45346d];return _0x5ce7ca;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3cc2('0x0')]('string',_0x3cc2('0x1'),'customVariable',_0x3cc2('0x2')),'defaultValue':_0x3cc2('0x3')},'content':{'type':Sequelize[_0x3cc2('0x4')]},'key':{'type':Sequelize[_0x3cc2('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3cc2('0x3'),_0x3cc2('0x1'),_0x3cc2('0x5'))},'keyContent':{'type':Sequelize[_0x3cc2('0x4')]},'idField':{'type':Sequelize[_0x3cc2('0x4')]},'nameField':{'type':Sequelize[_0x3cc2('0x4')]},'customField':{'type':Sequelize[_0x3cc2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c5c=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x37658a,_0x515ec1){var _0x4ef3b6=function(_0x153d6b){while(--_0x153d6b){_0x37658a['push'](_0x37658a['shift']());}};_0x4ef3b6(++_0x515ec1);}(_0x7c5c,0x187));var _0xc7c5=function(_0x5694bb,_0x2c948d){_0x5694bb=_0x5694bb-0x0;var _0xce4bf2=_0x7c5c[_0x5694bb];return _0xce4bf2;};'use strict';var Sequelize=require(_0xc7c5('0x0'));module['exports']={'type':{'type':Sequelize[_0xc7c5('0x1')](_0xc7c5('0x2'),_0xc7c5('0x3'),_0xc7c5('0x4'),_0xc7c5('0x5')),'defaultValue':_0xc7c5('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc7c5('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc7c5('0x2'),_0xc7c5('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc7c5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc7c5('0x6')]},'customField':{'type':Sequelize[_0xc7c5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc7c5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7458e01..f38bfd2 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 _0x09f5=['set','Content-Range','apply','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','map','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','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','sendStatus','status','end','json','count','offset','limit'];(function(_0x56ee7e,_0x5264e7){var _0x41d6e6=function(_0x542daf){while(--_0x542daf){_0x56ee7e['push'](_0x56ee7e['shift']());}};_0x41d6e6(++_0x5264e7);}(_0x09f5,0x1ee));var _0x509f=function(_0x100528,_0x352759){_0x100528=_0x100528-0x0;var _0x2fb6a0=_0x09f5[_0x100528];return _0x2fb6a0;};'use strict';var pdf=require(_0x509f('0x0'));var emlformat=require(_0x509f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x509f('0x2'));var jsonpatch=require(_0x509f('0x3'));var rp=require(_0x509f('0x4'));var moment=require(_0x509f('0x5'));var BPromise=require(_0x509f('0x6'));var Mustache=require(_0x509f('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x509f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x509f('0x9'));var squel=require('squel');var crypto=require(_0x509f('0xa'));var jsforce=require(_0x509f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x509f('0x8'));var querystring=require(_0x509f('0xc'));var Papa=require(_0x509f('0xd'));var Redis=require(_0x509f('0xe'));var authService=require(_0x509f('0xf'));var qs=require(_0x509f('0x10'));var as=require(_0x509f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x509f('0x12'))(_0x509f('0x13'));var utils=require(_0x509f('0x14'));var config=require(_0x509f('0x15'));var licenseUtil=require(_0x509f('0x16'));var db=require(_0x509f('0x17'))['db'];function respondWithStatusCode(_0x5022a5,_0xebb969){_0xebb969=_0xebb969||0xcc;return function(_0x4feb11){if(_0x4feb11){return _0x5022a5[_0x509f('0x18')](_0xebb969);}return _0x5022a5[_0x509f('0x19')](_0xebb969)[_0x509f('0x1a')]();};}function respondWithResult(_0x21a7b4,_0x6980fe){_0x6980fe=_0x6980fe||0xc8;return function(_0x4fa0a6){if(_0x4fa0a6){return _0x21a7b4[_0x509f('0x19')](_0x6980fe)[_0x509f('0x1b')](_0x4fa0a6);}};}function respondWithFilteredResult(_0xbb9639,_0x47a498){return function(_0xeecddb){if(_0xeecddb){var _0x40253f=_0xeecddb[_0x509f('0x1c')],_0x2f33c4=_0x47a498[_0x509f('0x1d')],_0x1dc339=_0x47a498[_0x509f('0x1d')]+_0x47a498[_0x509f('0x1e')],_0x5adc2c;if(_0x1dc339>=_0x40253f){_0x1dc339=_0x40253f;_0x5adc2c=0xc8;}else{_0x5adc2c=0xce;}_0xbb9639[_0x509f('0x19')](_0x5adc2c);return _0xbb9639[_0x509f('0x1f')](_0x509f('0x20'),_0x2f33c4+'-'+_0x1dc339+'/'+_0x40253f)['json'](_0xeecddb);}return null;};}function patchUpdates(_0xca4ceb){return function(_0x2ea22d){try{jsonpatch[_0x509f('0x21')](_0x2ea22d,_0xca4ceb,!![]);}catch(_0x469ef6){return BPromise['reject'](_0x469ef6);}return _0x2ea22d['save']();};}function saveUpdates(_0x1928cc,_0x39b501){return function(_0x8f2332){if(_0x8f2332){return _0x8f2332['update'](_0x1928cc)[_0x509f('0x22')](function(_0x4eb301){return _0x4eb301;});}return null;};}function removeEntity(_0x4ca6e6,_0x4f78ba){return function(_0xad2e13){if(_0xad2e13){return _0xad2e13[_0x509f('0x23')]()['then'](function(){_0x4ca6e6['status'](0xcc)[_0x509f('0x1a')]();});}};}function handleEntityNotFound(_0x12f83d,_0x3f3a48){return function(_0x48140c){if(!_0x48140c){_0x12f83d[_0x509f('0x18')](0x194);}return _0x48140c;};}function handleError(_0x43ce37,_0x27dd6e){_0x27dd6e=_0x27dd6e||0x1f4;return function(_0x476d3e){logger[_0x509f('0x24')](_0x476d3e[_0x509f('0x25')]);if(_0x476d3e[_0x509f('0x26')]){delete _0x476d3e[_0x509f('0x26')];}_0x43ce37['status'](_0x27dd6e)[_0x509f('0x27')](_0x476d3e);};}exports[_0x509f('0x28')]=function(_0x2c89e4,_0x5deab7){var _0x3039cf={},_0x59a486={},_0x447ec5={'count':0x0,'rows':[]};var _0x97c439=_['map'](db[_0x509f('0x29')][_0x509f('0x2a')],function(_0x401e5d){return{'name':_0x401e5d[_0x509f('0x2b')],'type':_0x401e5d[_0x509f('0x2c')][_0x509f('0x2d')]};});_0x59a486['model']=_[_0x509f('0x2e')](_0x97c439,_0x509f('0x26'));_0x59a486[_0x509f('0x2f')]=_['keys'](_0x2c89e4[_0x509f('0x2f')]);_0x59a486['filters']=_['intersection'](_0x59a486[_0x509f('0x30')],_0x59a486['query']);_0x3039cf[_0x509f('0x31')]=_['intersection'](_0x59a486[_0x509f('0x30')],qs[_0x509f('0x32')](_0x2c89e4[_0x509f('0x2f')][_0x509f('0x32')]));_0x3039cf['attributes']=_0x3039cf[_0x509f('0x31')][_0x509f('0x33')]?_0x3039cf[_0x509f('0x31')]:_0x59a486[_0x509f('0x30')];if(!_0x2c89e4[_0x509f('0x2f')][_0x509f('0x34')](_0x509f('0x35'))){_0x3039cf[_0x509f('0x1e')]=qs[_0x509f('0x1e')](_0x2c89e4['query']['limit']);_0x3039cf[_0x509f('0x1d')]=qs[_0x509f('0x1d')](_0x2c89e4[_0x509f('0x2f')][_0x509f('0x1d')]);}_0x3039cf[_0x509f('0x36')]=qs[_0x509f('0x37')](_0x2c89e4[_0x509f('0x2f')][_0x509f('0x37')]);_0x3039cf[_0x509f('0x38')]=qs['filters'](_[_0x509f('0x39')](_0x2c89e4[_0x509f('0x2f')],_0x59a486[_0x509f('0x3a')]),_0x97c439);if(_0x2c89e4[_0x509f('0x2f')][_0x509f('0x3b')]){_0x3039cf['where']=_[_0x509f('0x3c')](_0x3039cf[_0x509f('0x38')],{'$or':_[_0x509f('0x2e')](_0x97c439,function(_0x4fe4fd){if(_0x4fe4fd[_0x509f('0x2c')]!==_0x509f('0x3d')){var _0x53a63f={};_0x53a63f[_0x4fe4fd[_0x509f('0x26')]]={'$like':'%'+_0x2c89e4['query'][_0x509f('0x3b')]+'%'};return _0x53a63f;}})});}_0x3039cf=_[_0x509f('0x3c')]({},_0x3039cf,_0x2c89e4[_0x509f('0x3e')]);var _0x2f350f={'where':_0x3039cf[_0x509f('0x38')]};return db[_0x509f('0x29')][_0x509f('0x1c')](_0x2f350f)[_0x509f('0x22')](function(_0x6f6a30){_0x447ec5[_0x509f('0x1c')]=_0x6f6a30;if(_0x2c89e4[_0x509f('0x2f')][_0x509f('0x3f')]){_0x3039cf[_0x509f('0x40')]=[{'all':!![]}];}return db[_0x509f('0x29')][_0x509f('0x41')](_0x3039cf);})['then'](function(_0x2a8d3e){_0x447ec5['rows']=_0x2a8d3e;return _0x447ec5;})['then'](respondWithFilteredResult(_0x5deab7,_0x3039cf))[_0x509f('0x42')](handleError(_0x5deab7,null));};exports[_0x509f('0x43')]=function(_0x190a0a,_0x41f8bd){var _0x15f3c9={'raw':!![],'where':{'id':_0x190a0a[_0x509f('0x44')]['id']}},_0x31fe0a={};_0x31fe0a[_0x509f('0x30')]=_[_0x509f('0x45')](db['DeskField'][_0x509f('0x2a')]);_0x31fe0a[_0x509f('0x2f')]=_[_0x509f('0x45')](_0x190a0a['query']);_0x31fe0a['filters']=_[_0x509f('0x46')](_0x31fe0a[_0x509f('0x30')],_0x31fe0a[_0x509f('0x2f')]);_0x15f3c9[_0x509f('0x31')]=_[_0x509f('0x46')](_0x31fe0a[_0x509f('0x30')],qs[_0x509f('0x32')](_0x190a0a['query'][_0x509f('0x32')]));_0x15f3c9['attributes']=_0x15f3c9['attributes'][_0x509f('0x33')]?_0x15f3c9[_0x509f('0x31')]:_0x31fe0a[_0x509f('0x30')];if(_0x190a0a['query'][_0x509f('0x3f')]){_0x15f3c9[_0x509f('0x40')]=[{'all':!![]}];}_0x15f3c9=_[_0x509f('0x3c')]({},_0x15f3c9,_0x190a0a['options']);return db['DeskField'][_0x509f('0x47')](_0x15f3c9)[_0x509f('0x22')](handleEntityNotFound(_0x41f8bd,null))['then'](respondWithResult(_0x41f8bd,null))[_0x509f('0x42')](handleError(_0x41f8bd,null));};exports[_0x509f('0x48')]=function(_0x23a686,_0x3bc81e){return db[_0x509f('0x29')]['create'](_0x23a686['body'],{})['then'](respondWithResult(_0x3bc81e,0xc9))[_0x509f('0x42')](handleError(_0x3bc81e,null));};exports[_0x509f('0x49')]=function(_0x46ebe6,_0x247a4d){if(_0x46ebe6[_0x509f('0x4a')]['id']){delete _0x46ebe6['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x46ebe6[_0x509f('0x44')]['id']}})['then'](handleEntityNotFound(_0x247a4d,null))['then'](saveUpdates(_0x46ebe6['body'],null))[_0x509f('0x22')](respondWithResult(_0x247a4d,null))[_0x509f('0x42')](handleError(_0x247a4d,null));};exports[_0x509f('0x23')]=function(_0x1d3248,_0x1151ce){return db['DeskField']['find']({'where':{'id':_0x1d3248[_0x509f('0x44')]['id']}})[_0x509f('0x22')](handleEntityNotFound(_0x1151ce,null))[_0x509f('0x22')](removeEntity(_0x1151ce,null))[_0x509f('0x42')](handleError(_0x1151ce,null));}; \ No newline at end of file +var _0xcc56=['../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','DeskField','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2f6af,_0x49cbba){var _0x10865d=function(_0x161a49){while(--_0x161a49){_0x2f6af['push'](_0x2f6af['shift']());}};_0x10865d(++_0x49cbba);}(_0xcc56,0x1af));var _0x6cc5=function(_0x3f6368,_0x9ba37f){_0x3f6368=_0x3f6368-0x0;var _0x75cea4=_0xcc56[_0x3f6368];return _0x75cea4;};'use strict';var pdf=require(_0x6cc5('0x0'));var emlformat=require(_0x6cc5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6cc5('0x2'));var jsonpatch=require(_0x6cc5('0x3'));var rp=require(_0x6cc5('0x4'));var moment=require(_0x6cc5('0x5'));var BPromise=require(_0x6cc5('0x6'));var Mustache=require(_0x6cc5('0x7'));var util=require(_0x6cc5('0x8'));var path=require(_0x6cc5('0x9'));var sox=require(_0x6cc5('0xa'));var csv=require('to-csv');var ejs=require(_0x6cc5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6cc5('0xc'));var crypto=require(_0x6cc5('0xd'));var jsforce=require(_0x6cc5('0xe'));var deskjs=require(_0x6cc5('0xf'));var toCsv=require(_0x6cc5('0x10'));var querystring=require(_0x6cc5('0x11'));var Papa=require(_0x6cc5('0x12'));var Redis=require(_0x6cc5('0x13'));var authService=require(_0x6cc5('0x14'));var qs=require(_0x6cc5('0x15'));var as=require(_0x6cc5('0x16'));var hardwareService=require(_0x6cc5('0x17'));var logger=require(_0x6cc5('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x6cc5('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551edf,_0x420a60){_0x420a60=_0x420a60||0xcc;return function(_0x2d0da5){if(_0x2d0da5){return _0x551edf[_0x6cc5('0x1a')](_0x420a60);}return _0x551edf['status'](_0x420a60)[_0x6cc5('0x1b')]();};}function respondWithResult(_0x83eda6,_0x244e8c){_0x244e8c=_0x244e8c||0xc8;return function(_0x4f0544){if(_0x4f0544){return _0x83eda6[_0x6cc5('0x1c')](_0x244e8c)[_0x6cc5('0x1d')](_0x4f0544);}};}function respondWithFilteredResult(_0x47bebd,_0x2534cd){return function(_0xc9709c){if(_0xc9709c){var _0x563e67=_0xc9709c[_0x6cc5('0x1e')],_0x4da514=_0x2534cd[_0x6cc5('0x1f')],_0x5c2557=_0x2534cd[_0x6cc5('0x1f')]+_0x2534cd[_0x6cc5('0x20')],_0x4c6d0e;if(_0x5c2557>=_0x563e67){_0x5c2557=_0x563e67;_0x4c6d0e=0xc8;}else{_0x4c6d0e=0xce;}_0x47bebd['status'](_0x4c6d0e);return _0x47bebd[_0x6cc5('0x21')](_0x6cc5('0x22'),_0x4da514+'-'+_0x5c2557+'/'+_0x563e67)['json'](_0xc9709c);}return null;};}function patchUpdates(_0x12b0f3){return function(_0x6af6c){try{jsonpatch[_0x6cc5('0x23')](_0x6af6c,_0x12b0f3,!![]);}catch(_0x461285){return BPromise[_0x6cc5('0x24')](_0x461285);}return _0x6af6c[_0x6cc5('0x25')]();};}function saveUpdates(_0x2d29d4,_0xc963bc){return function(_0x30df4d){if(_0x30df4d){return _0x30df4d[_0x6cc5('0x26')](_0x2d29d4)[_0x6cc5('0x27')](function(_0x13ded9){return _0x13ded9;});}return null;};}function removeEntity(_0x5bde0d,_0x14269f){return function(_0x125ff2){if(_0x125ff2){return _0x125ff2[_0x6cc5('0x28')]()[_0x6cc5('0x27')](function(){_0x5bde0d[_0x6cc5('0x1c')](0xcc)[_0x6cc5('0x1b')]();});}};}function handleEntityNotFound(_0x2d9c3c,_0x11d354){return function(_0x166fb6){if(!_0x166fb6){_0x2d9c3c[_0x6cc5('0x1a')](0x194);}return _0x166fb6;};}function handleError(_0xb72e6,_0x1a0e11){_0x1a0e11=_0x1a0e11||0x1f4;return function(_0x4f85d4){logger[_0x6cc5('0x29')](_0x4f85d4['stack']);if(_0x4f85d4[_0x6cc5('0x2a')]){delete _0x4f85d4[_0x6cc5('0x2a')];}_0xb72e6[_0x6cc5('0x1c')](_0x1a0e11)[_0x6cc5('0x2b')](_0x4f85d4);};}exports[_0x6cc5('0x2c')]=function(_0x382695,_0x3b5d7d){var _0x337ec3={},_0x24c826={},_0x35070a={'count':0x0,'rows':[]};var _0x4a67e6=_[_0x6cc5('0x2d')](db['DeskField'][_0x6cc5('0x2e')],function(_0x4b6580){return{'name':_0x4b6580['fieldName'],'type':_0x4b6580[_0x6cc5('0x2f')][_0x6cc5('0x30')]};});_0x24c826['model']=_['map'](_0x4a67e6,_0x6cc5('0x2a'));_0x24c826[_0x6cc5('0x31')]=_['keys'](_0x382695[_0x6cc5('0x31')]);_0x24c826[_0x6cc5('0x32')]=_[_0x6cc5('0x33')](_0x24c826[_0x6cc5('0x34')],_0x24c826['query']);_0x337ec3[_0x6cc5('0x35')]=_['intersection'](_0x24c826[_0x6cc5('0x34')],qs[_0x6cc5('0x36')](_0x382695['query']['fields']));_0x337ec3[_0x6cc5('0x35')]=_0x337ec3[_0x6cc5('0x35')][_0x6cc5('0x37')]?_0x337ec3['attributes']:_0x24c826[_0x6cc5('0x34')];if(!_0x382695[_0x6cc5('0x31')][_0x6cc5('0x38')](_0x6cc5('0x39'))){_0x337ec3[_0x6cc5('0x20')]=qs[_0x6cc5('0x20')](_0x382695[_0x6cc5('0x31')][_0x6cc5('0x20')]);_0x337ec3[_0x6cc5('0x1f')]=qs[_0x6cc5('0x1f')](_0x382695['query']['offset']);}_0x337ec3['order']=qs[_0x6cc5('0x3a')](_0x382695[_0x6cc5('0x31')][_0x6cc5('0x3a')]);_0x337ec3['where']=qs['filters'](_[_0x6cc5('0x3b')](_0x382695['query'],_0x24c826[_0x6cc5('0x32')]),_0x4a67e6);if(_0x382695[_0x6cc5('0x31')][_0x6cc5('0x3c')]){_0x337ec3[_0x6cc5('0x3d')]=_['merge'](_0x337ec3['where'],{'$or':_[_0x6cc5('0x2d')](_0x4a67e6,function(_0x2d07f0){if(_0x2d07f0[_0x6cc5('0x2f')]!==_0x6cc5('0x3e')){var _0x3f3b16={};_0x3f3b16[_0x2d07f0['name']]={'$like':'%'+_0x382695[_0x6cc5('0x31')]['filter']+'%'};return _0x3f3b16;}})});}_0x337ec3=_[_0x6cc5('0x3f')]({},_0x337ec3,_0x382695['options']);var _0x285dfb={'where':_0x337ec3[_0x6cc5('0x3d')]};return db[_0x6cc5('0x40')][_0x6cc5('0x1e')](_0x285dfb)[_0x6cc5('0x27')](function(_0x36591c){_0x35070a['count']=_0x36591c;if(_0x382695[_0x6cc5('0x31')][_0x6cc5('0x41')]){_0x337ec3[_0x6cc5('0x42')]=[{'all':!![]}];}return db[_0x6cc5('0x40')][_0x6cc5('0x43')](_0x337ec3);})[_0x6cc5('0x27')](function(_0x1d38e6){_0x35070a[_0x6cc5('0x44')]=_0x1d38e6;return _0x35070a;})[_0x6cc5('0x27')](respondWithFilteredResult(_0x3b5d7d,_0x337ec3))[_0x6cc5('0x45')](handleError(_0x3b5d7d,null));};exports[_0x6cc5('0x46')]=function(_0x5e2835,_0x262943){var _0x32cdf6={'raw':!![],'where':{'id':_0x5e2835[_0x6cc5('0x47')]['id']}},_0x2320b5={};_0x2320b5['model']=_[_0x6cc5('0x48')](db[_0x6cc5('0x40')][_0x6cc5('0x2e')]);_0x2320b5[_0x6cc5('0x31')]=_['keys'](_0x5e2835[_0x6cc5('0x31')]);_0x2320b5['filters']=_[_0x6cc5('0x33')](_0x2320b5[_0x6cc5('0x34')],_0x2320b5[_0x6cc5('0x31')]);_0x32cdf6[_0x6cc5('0x35')]=_[_0x6cc5('0x33')](_0x2320b5[_0x6cc5('0x34')],qs[_0x6cc5('0x36')](_0x5e2835[_0x6cc5('0x31')][_0x6cc5('0x36')]));_0x32cdf6[_0x6cc5('0x35')]=_0x32cdf6[_0x6cc5('0x35')][_0x6cc5('0x37')]?_0x32cdf6[_0x6cc5('0x35')]:_0x2320b5['model'];if(_0x5e2835['query']['includeAll']){_0x32cdf6[_0x6cc5('0x42')]=[{'all':!![]}];}_0x32cdf6=_[_0x6cc5('0x3f')]({},_0x32cdf6,_0x5e2835['options']);return db[_0x6cc5('0x40')]['find'](_0x32cdf6)[_0x6cc5('0x27')](handleEntityNotFound(_0x262943,null))[_0x6cc5('0x27')](respondWithResult(_0x262943,null))[_0x6cc5('0x45')](handleError(_0x262943,null));};exports[_0x6cc5('0x49')]=function(_0x48331f,_0x465d76){return db[_0x6cc5('0x40')]['create'](_0x48331f[_0x6cc5('0x4a')],{})['then'](respondWithResult(_0x465d76,0xc9))[_0x6cc5('0x45')](handleError(_0x465d76,null));};exports[_0x6cc5('0x26')]=function(_0x4745d3,_0x286ac5){if(_0x4745d3['body']['id']){delete _0x4745d3[_0x6cc5('0x4a')]['id'];}return db['DeskField'][_0x6cc5('0x4b')]({'where':{'id':_0x4745d3[_0x6cc5('0x47')]['id']}})[_0x6cc5('0x27')](handleEntityNotFound(_0x286ac5,null))[_0x6cc5('0x27')](saveUpdates(_0x4745d3[_0x6cc5('0x4a')],null))[_0x6cc5('0x27')](respondWithResult(_0x286ac5,null))[_0x6cc5('0x45')](handleError(_0x286ac5,null));};exports[_0x6cc5('0x28')]=function(_0x31efb2,_0x5932a8){return db[_0x6cc5('0x40')][_0x6cc5('0x4b')]({'where':{'id':_0x31efb2['params']['id']}})[_0x6cc5('0x27')](handleEntityNotFound(_0x5932a8,null))[_0x6cc5('0x27')](removeEntity(_0x5932a8,null))['catch'](handleError(_0x5932a8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 2711178..aa15e9e 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 _0xb83c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb83c,0x10e));var _0xcb83=function(_0x8743ed,_0x1fab22){_0x8743ed=_0x8743ed-0x0;var _0x28c95f=_0xb83c[_0x8743ed];return _0x28c95f;};'use strict';var _=require(_0xcb83('0x0'));var util=require(_0xcb83('0x1'));var logger=require(_0xcb83('0x2'))(_0xcb83('0x3'));var moment=require(_0xcb83('0x4'));var BPromise=require(_0xcb83('0x5'));var rp=require(_0xcb83('0x6'));var fs=require('fs');var path=require(_0xcb83('0x7'));var rimraf=require(_0xcb83('0x8'));var config=require(_0xcb83('0x9'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x1019fd,_0x2b0695){return _0x1019fd[_0xcb83('0xa')](_0xcb83('0xb'),attributes,{'tableName':_0xcb83('0xc'),'paranoid':![],'indexes':[{'name':_0xcb83('0xd'),'fields':[_0xcb83('0xe'),_0xcb83('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb63d=['request-promise','path','rimraf','int_desk_fields','idField','FieldId','lodash','api','bluebird'];(function(_0x155413,_0x1c89b4){var _0x434c71=function(_0x5b74a0){while(--_0x5b74a0){_0x155413['push'](_0x155413['shift']());}};_0x434c71(++_0x1c89b4);}(_0xb63d,0x96));var _0xdb63=function(_0x4e19d9,_0x31427f){_0x4e19d9=_0x4e19d9-0x0;var _0x5d43f2=_0xb63d[_0x4e19d9];return _0x5d43f2;};'use strict';var _=require(_0xdb63('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb63('0x1'));var moment=require('moment');var BPromise=require(_0xdb63('0x2'));var rp=require(_0xdb63('0x3'));var fs=require('fs');var path=require(_0xdb63('0x4'));var rimraf=require(_0xdb63('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x2d2761,_0x6ee0a2){return _0x2d2761['define']('DeskField',attributes,{'tableName':_0xdb63('0x6'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xdb63('0x7'),_0xdb63('0x8')],'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 c829475..a1d25b5 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 _0xe320=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4da137,_0x42e65a){var _0x236468=function(_0x4320ea){while(--_0x4320ea){_0x4da137['push'](_0x4da137['shift']());}};_0x236468(++_0x42e65a);}(_0xe320,0x7a));var _0x0e32=function(_0x360189,_0x40a134){_0x360189=_0x360189-0x0;var _0x5c148b=_0xe320[_0x360189];return _0x5c148b;};'use strict';var _=require(_0x0e32('0x0'));var util=require(_0x0e32('0x1'));var moment=require(_0x0e32('0x2'));var BPromise=require(_0x0e32('0x3'));var rs=require(_0x0e32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e32('0x5'));var logger=require(_0x0e32('0x6'))(_0x0e32('0x7'));var config=require(_0x0e32('0x8'));var jayson=require(_0x0e32('0x9'));var client=jayson['client'][_0x0e32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xffd464,_0x160ed8,_0x17ea58){return new BPromise(function(_0x3671bb,_0x111239){return client[_0x0e32('0xb')](_0xffd464,_0x17ea58)[_0x0e32('0xc')](function(_0x5d692a){logger[_0x0e32('0xd')](_0x0e32('0xe'),_0x160ed8,_0x0e32('0xf'));logger['debug'](_0x0e32('0x10'),_0x160ed8,'request\x20sent',JSON[_0x0e32('0x11')](_0x5d692a));if(_0x5d692a[_0x0e32('0x12')]){if(_0x5d692a[_0x0e32('0x12')][_0x0e32('0x13')]===0x1f4){logger[_0x0e32('0x12')](_0x0e32('0xe'),_0x160ed8,_0x5d692a['error'][_0x0e32('0x14')]);return _0x111239(_0x5d692a['error'][_0x0e32('0x14')]);}logger['error'](_0x0e32('0xe'),_0x160ed8,_0x5d692a['error'][_0x0e32('0x14')]);return _0x3671bb(_0x5d692a['error']['message']);}else{logger[_0x0e32('0xd')](_0x0e32('0xe'),_0x160ed8,'request\x20sent');_0x3671bb(_0x5d692a['result']['message']);}})[_0x0e32('0x15')](function(_0x29396c){logger[_0x0e32('0x12')](_0x0e32('0xe'),_0x160ed8,_0x29396c);_0x111239(_0x29396c);});});} \ No newline at end of file +var _0xf9d8=['jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf9d8,0x158));var _0x8f9d=function(_0x161286,_0x11cd30){_0x161286=_0x161286-0x0;var _0x3a0dc0=_0xf9d8[_0x161286];return _0x3a0dc0;};'use strict';var _=require(_0x8f9d('0x0'));var util=require(_0x8f9d('0x1'));var moment=require(_0x8f9d('0x2'));var BPromise=require(_0x8f9d('0x3'));var rs=require(_0x8f9d('0x4'));var fs=require('fs');var Redis=require(_0x8f9d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f9d('0x6'));var logger=require(_0x8f9d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f9d('0x8'));var client=jayson[_0x8f9d('0x9')][_0x8f9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45d493,_0x248dd1,_0x40d0c1){return new BPromise(function(_0x97ce41,_0x5f11a2){return client[_0x8f9d('0xb')](_0x45d493,_0x40d0c1)[_0x8f9d('0xc')](function(_0xcb020f){logger[_0x8f9d('0xd')](_0x8f9d('0xe'),_0x248dd1,_0x8f9d('0xf'));logger[_0x8f9d('0x10')](_0x8f9d('0x11'),_0x248dd1,'request\x20sent',JSON['stringify'](_0xcb020f));if(_0xcb020f[_0x8f9d('0x12')]){if(_0xcb020f[_0x8f9d('0x12')]['code']===0x1f4){logger['error'](_0x8f9d('0xe'),_0x248dd1,_0xcb020f[_0x8f9d('0x12')][_0x8f9d('0x13')]);return _0x5f11a2(_0xcb020f['error'][_0x8f9d('0x13')]);}logger[_0x8f9d('0x12')](_0x8f9d('0xe'),_0x248dd1,_0xcb020f[_0x8f9d('0x12')][_0x8f9d('0x13')]);return _0x97ce41(_0xcb020f[_0x8f9d('0x12')][_0x8f9d('0x13')]);}else{logger[_0x8f9d('0xd')](_0x8f9d('0xe'),_0x248dd1,_0x8f9d('0xf'));_0x97ce41(_0xcb020f[_0x8f9d('0x14')][_0x8f9d('0x13')]);}})[_0x8f9d('0x15')](function(_0x223f24){logger[_0x8f9d('0x12')](_0x8f9d('0xe'),_0x248dd1,_0x223f24);_0x5f11a2(_0x223f24);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 2d89c7b..652fbc2 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 _0xdb28=['getConfigurations','getFields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','show','get','/:id/configurations'];(function(_0x5beea3,_0x3db119){var _0x330983=function(_0x3e4ea4){while(--_0x3e4ea4){_0x5beea3['push'](_0x5beea3['shift']());}};_0x330983(++_0x3db119);}(_0xdb28,0x106));var _0x8db2=function(_0x2f3022,_0x2c471e){_0x2f3022=_0x2f3022-0x0;var _0x44cc9f=_0xdb28[_0x2f3022];return _0x44cc9f;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var auth=require(_0x8db2('0x5'));var interaction=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var controller=require(_0x8db2('0x8'));router['get']('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xa')]);router['get']('/:id',auth[_0x8db2('0x9')](),controller[_0x8db2('0xb')]);router[_0x8db2('0xc')](_0x8db2('0xd'),auth[_0x8db2('0x9')](),controller[_0x8db2('0xe')]);router[_0x8db2('0xc')]('/:id/fields',auth[_0x8db2('0x9')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/',auth['isAuthenticated'](),controller[_0x8db2('0x11')]);router[_0x8db2('0x10')]('/:id/configurations',auth[_0x8db2('0x9')](),controller[_0x8db2('0x12')]);router[_0x8db2('0x13')](_0x8db2('0x14'),auth[_0x8db2('0x9')](),controller['update']);router['delete'](_0x8db2('0x14'),auth[_0x8db2('0x9')](),controller[_0x8db2('0x15')]);module[_0x8db2('0x16')]=router; \ No newline at end of file +var _0xda2d=['connect-timeout','express','Router','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','update','delete','destroy','exports','util','path'];(function(_0x197257,_0x5ee58a){var _0x4ad056=function(_0x36dcdd){while(--_0x36dcdd){_0x197257['push'](_0x197257['shift']());}};_0x4ad056(++_0x5ee58a);}(_0xda2d,0x102));var _0xdda2=function(_0x3ce1ee,_0x333421){_0x3ce1ee=_0x3ce1ee-0x0;var _0x7a2579=_0xda2d[_0x3ce1ee];return _0x7a2579;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdda2('0x5'));router[_0xdda2('0x6')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0x8')]);router[_0xdda2('0x6')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0xa')]);router[_0xdda2('0x6')](_0xdda2('0xb'),auth['isAuthenticated'](),controller[_0xdda2('0xc')]);router[_0xdda2('0x6')]('/:id/fields',auth[_0xdda2('0x7')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0xf')]);router[_0xdda2('0xe')](_0xdda2('0xb'),auth[_0xdda2('0x7')](),controller['addConfiguration']);router['put']('/:id',auth[_0xdda2('0x7')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0x12')]);module[_0xdda2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index bafeb84..6fca674 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 _0xd733=['sequelize','STRING'];(function(_0x498500,_0x40f5f9){var _0x96d67d=function(_0x524e64){while(--_0x524e64){_0x498500['push'](_0x498500['shift']());}};_0x96d67d(++_0x40f5f9);}(_0xd733,0x1f2));var _0x3d73=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0xd733[_0x1c289a];return _0x28d68e;};'use strict';var Sequelize=require(_0x3d73('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d73('0x1')]},'username':{'type':Sequelize[_0x3d73('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3d73('0x1')]},'tenantId':{'type':Sequelize[_0x3d73('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3d73('0x1')]},'serverUrl':{'type':Sequelize[_0x3d73('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd14c=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd14c,0xd5));var _0xcd14=function(_0x404d3d,_0x5035cc){_0x404d3d=_0x404d3d-0x0;var _0x9fe6fe=_0xd14c[_0x404d3d];return _0x9fe6fe;};'use strict';var Sequelize=require(_0xcd14('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcd14('0x1')]},'tenantId':{'type':Sequelize[_0xcd14('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xcd14('0x1')]},'serverUrl':{'type':Sequelize[_0xcd14('0x1')],'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 c109807..411a230 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 _0xfdbd=['substring','isNil','push','all','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','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','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','PhoneCall','title','description','customerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','tenantId','clientId','clientSecret','remoteUri','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','Bearer\x20','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type'];(function(_0x551f89,_0x44dd9d){var _0x2b63c1=function(_0x2b0300){while(--_0x2b0300){_0x551f89['push'](_0x551f89['shift']());}};_0x2b63c1(++_0x44dd9d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x323c60,_0x219b72){_0x323c60=_0x323c60-0x0;var _0x103f23=_0xfdbd[_0x323c60];return _0x103f23;};'use strict';var pdf=require(_0xdfdb('0x0'));var emlformat=require(_0xdfdb('0x1'));var rimraf=require(_0xdfdb('0x2'));var zipdir=require(_0xdfdb('0x3'));var jsonpatch=require(_0xdfdb('0x4'));var rp=require(_0xdfdb('0x5'));var moment=require(_0xdfdb('0x6'));var BPromise=require(_0xdfdb('0x7'));var Mustache=require(_0xdfdb('0x8'));var util=require('util');var path=require(_0xdfdb('0x9'));var sox=require('sox');var csv=require(_0xdfdb('0xa'));var ejs=require(_0xdfdb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];var integrations=require(_0xdfdb('0x19'));var jayson=require(_0xdfdb('0x1a'));var client=jayson[_0xdfdb('0x1b')][_0xdfdb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xf5d903,_0x16017d,_0x51162f,_0x48a66a){return new BPromise(function(_0x2c44dc,_0x4b1ff7){var _0x471ddc=_0x48a66a||client;return _0x471ddc[_0xdfdb('0x1d')](_0xf5d903,_0x51162f)[_0xdfdb('0x1e')](function(_0x40bc8a){logger[_0xdfdb('0x1f')](_0xdfdb('0x20'),_0x16017d,'request\x20sent');logger['debug'](_0xdfdb('0x21'),_0x16017d,_0xdfdb('0x22'),JSON[_0xdfdb('0x23')](_0x40bc8a));if(_0x40bc8a['error']){if(_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x25')]===0x1f4){logger[_0xdfdb('0x24')](_0xdfdb('0x20'),_0x16017d,_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x26')]);return _0x4b1ff7(_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x26')]);}logger['error'](_0xdfdb('0x20'),_0x16017d,_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x26')]);return _0x2c44dc(_0x40bc8a['error'][_0xdfdb('0x26')]);}else{logger[_0xdfdb('0x1f')](_0xdfdb('0x20'),_0x16017d,'request\x20sent');_0x2c44dc(_0x40bc8a[_0xdfdb('0x27')][_0xdfdb('0x26')]);}})[_0xdfdb('0x28')](function(_0x489fd4){logger[_0xdfdb('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x16017d,_0x489fd4);_0x4b1ff7(_0x489fd4);});});}function respondWithStatusCode(_0x2db1c1,_0x145350){_0x145350=_0x145350||0xcc;return function(_0x1fa2f3){if(_0x1fa2f3){return _0x2db1c1[_0xdfdb('0x29')](_0x145350);}return _0x2db1c1['status'](_0x145350)[_0xdfdb('0x2a')]();};}function respondWithResult(_0x4363d8,_0x956843){_0x956843=_0x956843||0xc8;return function(_0x400663){if(_0x400663){return _0x4363d8[_0xdfdb('0x2b')](_0x956843)[_0xdfdb('0x2c')](_0x400663);}};}function respondWithFilteredResult(_0x57d24f,_0xec4d22){return function(_0x2d5fe2){if(_0x2d5fe2){var _0xdf3a5c=_0x2d5fe2[_0xdfdb('0x2d')],_0x4f8057=_0xec4d22[_0xdfdb('0x2e')],_0x466932=_0xec4d22[_0xdfdb('0x2e')]+_0xec4d22['limit'],_0x5df454;if(_0x466932>=_0xdf3a5c){_0x466932=_0xdf3a5c;_0x5df454=0xc8;}else{_0x5df454=0xce;}_0x57d24f['status'](_0x5df454);return _0x57d24f[_0xdfdb('0x2f')](_0xdfdb('0x30'),_0x4f8057+'-'+_0x466932+'/'+_0xdf3a5c)[_0xdfdb('0x2c')](_0x2d5fe2);}return null;};}function patchUpdates(_0x3a2ec3){return function(_0x371b69){try{jsonpatch[_0xdfdb('0x31')](_0x371b69,_0x3a2ec3,!![]);}catch(_0x5a9fc4){return BPromise[_0xdfdb('0x32')](_0x5a9fc4);}return _0x371b69[_0xdfdb('0x33')]();};}function saveUpdates(_0x36b555,_0x13ec6e){return function(_0x10f4f6){if(_0x10f4f6){return _0x10f4f6[_0xdfdb('0x34')](_0x36b555)[_0xdfdb('0x1e')](function(_0x1ce036){return _0x1ce036;});}return null;};}function removeEntity(_0x68398d,_0x1b7bce){return function(_0x379e6a){if(_0x379e6a){return _0x379e6a['destroy']()['then'](function(){_0x68398d[_0xdfdb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x196dfa,_0x14e83e){return function(_0x3ba5f5){if(!_0x3ba5f5){_0x196dfa[_0xdfdb('0x29')](0x194);}return _0x3ba5f5;};}function handleError(_0x514232,_0x40cf5b){_0x40cf5b=_0x40cf5b||0x1f4;return function(_0x53cf40){logger[_0xdfdb('0x24')](_0x53cf40[_0xdfdb('0x35')]);if(_0x53cf40[_0xdfdb('0x36')]){delete _0x53cf40[_0xdfdb('0x36')];}_0x514232[_0xdfdb('0x2b')](_0x40cf5b)[_0xdfdb('0x37')](_0x53cf40);};}exports['index']=function(_0x34daa1,_0xd8528d){var _0x5beec7={},_0x1c1484={},_0x4377d6={'count':0x0,'rows':[]};var _0x45b7bb=_[_0xdfdb('0x38')](db[_0xdfdb('0x39')][_0xdfdb('0x3a')],function(_0x16d5b8){return{'name':_0x16d5b8[_0xdfdb('0x3b')],'type':_0x16d5b8[_0xdfdb('0x3c')][_0xdfdb('0x3d')]};});_0x1c1484[_0xdfdb('0x3e')]=_['map'](_0x45b7bb,_0xdfdb('0x36'));_0x1c1484[_0xdfdb('0x3f')]=_[_0xdfdb('0x40')](_0x34daa1[_0xdfdb('0x3f')]);_0x1c1484[_0xdfdb('0x41')]=_[_0xdfdb('0x42')](_0x1c1484[_0xdfdb('0x3e')],_0x1c1484[_0xdfdb('0x3f')]);_0x5beec7['attributes']=_['intersection'](_0x1c1484[_0xdfdb('0x3e')],qs[_0xdfdb('0x43')](_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x43')]));_0x5beec7[_0xdfdb('0x44')]=_0x5beec7[_0xdfdb('0x44')][_0xdfdb('0x45')]?_0x5beec7[_0xdfdb('0x44')]:_0x1c1484[_0xdfdb('0x3e')];if(!_0x34daa1['query'][_0xdfdb('0x46')](_0xdfdb('0x47'))){_0x5beec7[_0xdfdb('0x48')]=qs[_0xdfdb('0x48')](_0x34daa1[_0xdfdb('0x3f')]['limit']);_0x5beec7[_0xdfdb('0x2e')]=qs[_0xdfdb('0x2e')](_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x2e')]);}_0x5beec7[_0xdfdb('0x49')]=qs['sort'](_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x4a')]);_0x5beec7[_0xdfdb('0x4b')]=qs['filters'](_[_0xdfdb('0x4c')](_0x34daa1['query'],_0x1c1484[_0xdfdb('0x41')]),_0x45b7bb);if(_0x34daa1['query'][_0xdfdb('0x4d')]){_0x5beec7[_0xdfdb('0x4b')]=_['merge'](_0x5beec7[_0xdfdb('0x4b')],{'$or':_['map'](_0x45b7bb,function(_0xfea790){if(_0xfea790[_0xdfdb('0x3c')]!==_0xdfdb('0x4e')){var _0x2566f8={};_0x2566f8[_0xfea790[_0xdfdb('0x36')]]={'$like':'%'+_0x34daa1['query']['filter']+'%'};return _0x2566f8;}})});}_0x5beec7=_[_0xdfdb('0x4f')]({},_0x5beec7,_0x34daa1[_0xdfdb('0x50')]);var _0x4b70b3={'where':_0x5beec7[_0xdfdb('0x4b')]};return db['Dynamics365Account'][_0xdfdb('0x2d')](_0x4b70b3)[_0xdfdb('0x1e')](function(_0x8b1db1){_0x4377d6[_0xdfdb('0x2d')]=_0x8b1db1;if(_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x51')]){_0x5beec7[_0xdfdb('0x52')]=[{'all':!![]}];}return db[_0xdfdb('0x39')][_0xdfdb('0x53')](_0x5beec7);})[_0xdfdb('0x1e')](function(_0x24f88a){_0x4377d6[_0xdfdb('0x54')]=_0x24f88a;return _0x4377d6;})[_0xdfdb('0x1e')](respondWithFilteredResult(_0xd8528d,_0x5beec7))[_0xdfdb('0x28')](handleError(_0xd8528d,null));};exports[_0xdfdb('0x55')]=function(_0x273477,_0x5ae070){var _0x4834a9={'raw':![],'where':{'id':_0x273477[_0xdfdb('0x56')]['id']}},_0x6b03a3={};_0x6b03a3[_0xdfdb('0x3e')]=_['keys'](db[_0xdfdb('0x39')][_0xdfdb('0x3a')]);_0x6b03a3[_0xdfdb('0x3f')]=_[_0xdfdb('0x40')](_0x273477['query']);_0x6b03a3[_0xdfdb('0x41')]=_[_0xdfdb('0x42')](_0x6b03a3['model'],_0x6b03a3[_0xdfdb('0x3f')]);_0x4834a9[_0xdfdb('0x44')]=_[_0xdfdb('0x42')](_0x6b03a3[_0xdfdb('0x3e')],qs[_0xdfdb('0x43')](_0x273477[_0xdfdb('0x3f')][_0xdfdb('0x43')]));_0x4834a9[_0xdfdb('0x44')]=_0x4834a9[_0xdfdb('0x44')]['length']?_0x4834a9[_0xdfdb('0x44')]:_0x6b03a3['model'];if(_0x273477[_0xdfdb('0x3f')][_0xdfdb('0x51')]){_0x4834a9[_0xdfdb('0x52')]=[{'all':!![]}];}_0x4834a9=_[_0xdfdb('0x4f')]({},_0x4834a9,_0x273477[_0xdfdb('0x50')]);return db[_0xdfdb('0x39')][_0xdfdb('0x57')](_0x4834a9)['then'](handleEntityNotFound(_0x5ae070,null))[_0xdfdb('0x1e')](respondWithResult(_0x5ae070,null))[_0xdfdb('0x28')](handleError(_0x5ae070,null));};exports[_0xdfdb('0x58')]=function(_0x8ea076,_0xd2b334){return db['Dynamics365Account'][_0xdfdb('0x58')](_0x8ea076['body'],{})[_0xdfdb('0x1e')](respondWithResult(_0xd2b334,0xc9))[_0xdfdb('0x28')](handleError(_0xd2b334,null));};exports[_0xdfdb('0x34')]=function(_0x6d7407,_0x3f10fe){if(_0x6d7407['body']['id']){delete _0x6d7407[_0xdfdb('0x59')]['id'];}return db[_0xdfdb('0x39')]['find']({'where':{'id':_0x6d7407[_0xdfdb('0x56')]['id']}})[_0xdfdb('0x1e')](handleEntityNotFound(_0x3f10fe,null))[_0xdfdb('0x1e')](saveUpdates(_0x6d7407['body'],null))[_0xdfdb('0x1e')](respondWithResult(_0x3f10fe,null))[_0xdfdb('0x28')](handleError(_0x3f10fe,null));};exports[_0xdfdb('0x5a')]=function(_0x1cce58,_0x421782){return db[_0xdfdb('0x39')]['find']({'where':{'id':_0x1cce58['params']['id']}})[_0xdfdb('0x1e')](handleEntityNotFound(_0x421782,null))['then'](removeEntity(_0x421782,null))['catch'](handleError(_0x421782,null));};exports['getConfigurations']=function(_0x2f86c9,_0x273afa,_0x1a9541){var _0x1b5f17={};var _0x8bd5c0={};var _0x17834e;var _0xa1d520;return db[_0xdfdb('0x39')][_0xdfdb('0x5b')]({'where':{'id':_0x2f86c9['params']['id']}})['then'](handleEntityNotFound(_0x273afa,null))[_0xdfdb('0x1e')](function(_0x4a9654){if(_0x4a9654){_0x17834e=_0x4a9654;_0x8bd5c0[_0xdfdb('0x3e')]=_[_0xdfdb('0x40')](db[_0xdfdb('0x5c')]['rawAttributes']);_0x8bd5c0[_0xdfdb('0x3f')]=_[_0xdfdb('0x40')](_0x2f86c9[_0xdfdb('0x3f')]);_0x8bd5c0[_0xdfdb('0x41')]=_[_0xdfdb('0x42')](_0x8bd5c0[_0xdfdb('0x3e')],_0x8bd5c0[_0xdfdb('0x3f')]);_0x1b5f17[_0xdfdb('0x44')]=_['intersection'](_0x8bd5c0[_0xdfdb('0x3e')],qs[_0xdfdb('0x43')](_0x2f86c9['query'][_0xdfdb('0x43')]));_0x1b5f17[_0xdfdb('0x44')]=_0x1b5f17[_0xdfdb('0x44')][_0xdfdb('0x45')]?_0x1b5f17['attributes']:_0x8bd5c0['model'];_0x1b5f17[_0xdfdb('0x49')]=qs[_0xdfdb('0x4a')](_0x2f86c9['query'][_0xdfdb('0x4a')]);_0x1b5f17[_0xdfdb('0x4b')]=qs[_0xdfdb('0x41')](_['pick'](_0x2f86c9['query'],_0x8bd5c0[_0xdfdb('0x41')]));if(_0x2f86c9[_0xdfdb('0x3f')]['filter']){_0x1b5f17['where']=_[_0xdfdb('0x4f')](_0x1b5f17['where'],{'$or':_['map'](_0x1b5f17[_0xdfdb('0x44')],function(_0x4a3002){var _0x5fbf48={};_0x5fbf48[_0x4a3002]={'$like':'%'+_0x2f86c9[_0xdfdb('0x3f')]['filter']+'%'};return _0x5fbf48;})});}_0x1b5f17=_['merge']({},_0x1b5f17,_0x2f86c9[_0xdfdb('0x50')]);return _0x17834e[_0xdfdb('0x5d')](_0x1b5f17);}})['then'](function(_0x28fdbf){if(_0x28fdbf){_0xa1d520=_0x28fdbf[_0xdfdb('0x45')];if(!_0x2f86c9[_0xdfdb('0x3f')][_0xdfdb('0x46')](_0xdfdb('0x47'))){_0x1b5f17['limit']=qs['limit'](_0x2f86c9[_0xdfdb('0x3f')][_0xdfdb('0x48')]);_0x1b5f17[_0xdfdb('0x2e')]=qs[_0xdfdb('0x2e')](_0x2f86c9[_0xdfdb('0x3f')][_0xdfdb('0x2e')]);}return _0x17834e['getConfigurations'](_0x1b5f17);}})[_0xdfdb('0x1e')](function(_0x3c3228){if(_0x3c3228){return _0x3c3228?{'count':_0xa1d520,'rows':_0x3c3228}:null;}})[_0xdfdb('0x1e')](respondWithResult(_0x273afa,null))[_0xdfdb('0x28')](handleError(_0x273afa,null));};exports[_0xdfdb('0x5e')]=function(_0x1bcfdd,_0x2037b1,_0x4cdcdc){if(_0x1bcfdd[_0xdfdb('0x59')]['id']){delete _0x1bcfdd[_0xdfdb('0x59')]['id'];}return db['Dynamics365Account'][_0xdfdb('0x5b')]({'where':{'id':_0x1bcfdd[_0xdfdb('0x56')]['id']}})[_0xdfdb('0x1e')](handleEntityNotFound(_0x2037b1,null))[_0xdfdb('0x1e')](function(_0x2c9405){if(_0x2c9405){_0x1bcfdd['body'][_0xdfdb('0x5f')]=_0x2c9405['id'];_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x60')]=integrations[_0xdfdb('0x61')](_0x1bcfdd['body'][_0xdfdb('0x62')],_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x3c')]);_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x63')]=integrations[_0xdfdb('0x64')](_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x62')],_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x3c')]);return db[_0xdfdb('0x5c')]['create'](_0x1bcfdd[_0xdfdb('0x59')],{'include':[{'model':db[_0xdfdb('0x65')],'as':'Subjects'},{'model':db[_0xdfdb('0x65')],'as':_0xdfdb('0x63')}]});}return null;})[_0xdfdb('0x1e')](respondWithResult(_0x2037b1,null))['catch'](handleError(_0x2037b1,null));};exports['getFields']=function(_0x4c4d3a,_0x9f2170,_0x465565){var _0x1c7964=_0x4c4d3a[_0xdfdb('0x3f')][_0xdfdb('0x66')];var _0x394536=_0x1c7964===_0xdfdb('0x67')?'Incident':_0xdfdb('0x68');var _0xcda070='';var _0x1d69fb='';var _0x2269e3='';var _0x5b6e35='';var _0x1c90e9='';var _0x37de3d='';var _0x5d3923='';var _0x2ced3d='';var _0x117cd7=[_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),'ownerid',_0xdfdb('0x6c'),'subject',_0xdfdb('0x6d'),_0xdfdb('0x6e'),_0xdfdb('0x6f'),_0xdfdb('0x70')];var _0x110097=['accountidname',_0xdfdb('0x71'),_0xdfdb('0x72'),'billedserviceunits','contactidname',_0xdfdb('0x73'),'contractdetailidname','contractidname',_0xdfdb('0x74'),_0xdfdb('0x75'),_0xdfdb('0x76'),_0xdfdb('0x77'),_0xdfdb('0x78'),_0xdfdb('0x79'),_0xdfdb('0x7a'),_0xdfdb('0x7b'),'customeridtype',_0xdfdb('0x7c'),'emailaddress',_0xdfdb('0x7d'),_0xdfdb('0x7e'),_0xdfdb('0x7f'),_0xdfdb('0x80'),_0xdfdb('0x81'),'firstresponsebykpiidname',_0xdfdb('0x82'),_0xdfdb('0x83'),_0xdfdb('0x84'),_0xdfdb('0x85'),_0xdfdb('0x86'),'masteridname','modifiedbyexternalpartyname',_0xdfdb('0x87'),_0xdfdb('0x88'),'modifiedbyyominame',_0xdfdb('0x89'),'modifiedonbehalfbyname',_0xdfdb('0x8a'),_0xdfdb('0x8b'),_0xdfdb('0x8c'),'numberofchildincidents',_0xdfdb('0x8d'),'overriddencreatedon','owneridname',_0xdfdb('0x8e'),'owneridyominame',_0xdfdb('0x8f'),_0xdfdb('0x90'),_0xdfdb('0x91'),_0xdfdb('0x92'),_0xdfdb('0x93'),_0xdfdb('0x94'),_0xdfdb('0x95'),_0xdfdb('0x96'),_0xdfdb('0x97'),_0xdfdb('0x98'),'responsiblecontactidyominame','sentimentvalue',_0xdfdb('0x99'),'slaname','socialprofileidname','statecode','statuscode',_0xdfdb('0x9a'),_0xdfdb('0x9b'),_0xdfdb('0x9c'),_0xdfdb('0x9d'),_0xdfdb('0x9e'),_0xdfdb('0x9f'),_0xdfdb('0xa0')];var _0x114373=_0x117cd7[_0xdfdb('0xa1')](_0x110097);return db[_0xdfdb('0x39')][_0xdfdb('0x5b')]({'where':{'id':_0x4c4d3a[_0xdfdb('0x56')]['id']},'attributes':['id',_0xdfdb('0xa2'),'password','remoteUri',_0xdfdb('0xa3'),_0xdfdb('0xa4'),_0xdfdb('0xa5')]})[_0xdfdb('0x1e')](handleEntityNotFound(_0x9f2170,null))[_0xdfdb('0x1e')](function(_0x18505c){if(_0x18505c){_0x2ced3d=_0x18505c[_0xdfdb('0xa6')];var _0x421578=_0x2ced3d[_0xdfdb('0xa7')](-0x1);if(_0x421578==='/'){_0x2ced3d=_0x2ced3d['substring'](0x0,_0x2ced3d[_0xdfdb('0xa8')](_0x421578));}_0x5d3923=util[_0xdfdb('0xa9')](_0xdfdb('0xaa'),_0x2ced3d);var _0x2cbe58={'method':_0xdfdb('0xab'),'uri':_0xdfdb('0xac')+_0x18505c['tenantId']+_0xdfdb('0xad'),'form':{'client_id':_0x18505c[_0xdfdb('0xa4')],'resource':_0x2ced3d,'username':_0x18505c[_0xdfdb('0xa2')],'password':_0x18505c[_0xdfdb('0xae')],'grant_type':_0xdfdb('0xae'),'client_secret':_0x18505c[_0xdfdb('0xa5')]},'json':!![]};return rp(_0x2cbe58);}})['then'](function(_0x2a3e79){_0x37de3d=_0x2a3e79[_0xdfdb('0xaf')];var _0x457257={'method':'GET','uri':encodeURI(_0x5d3923+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x394536+'\x27'),'headers':{'Authorization':_0xdfdb('0xb0')+_0x37de3d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x457257);})['then'](function(_0x276efc){var _0x27c72c=_0x276efc['value'][0x0];var _0x4bdb41=_0x27c72c[_0xdfdb('0xb1')];var _0x2f8d34={'method':_0xdfdb('0xb2'),'uri':_0x5d3923+_0xdfdb('0xb3')+_0x4bdb41+_0xdfdb('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x37de3d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f8d34);})[_0xdfdb('0x1e')](function(_0x576570){_0xcda070=_0x576570;_0x1d69fb=_0xcda070[_0xdfdb('0xb5')];_0x1d69fb=_[_0xdfdb('0xb6')](_0x1d69fb,function(_0x3c9465){return!_0x114373['includes'](_0x3c9465[_0xdfdb('0xb7')]);});var _0x38a439=[];var _0x3e0208=[];_0x1d69fb[_0xdfdb('0xb8')](function(_0x4c08d0){if(_0x4c08d0[_0xdfdb('0xb9')]){var _0xd00056=_0x4c08d0[_0xdfdb('0xb9')][_0xdfdb('0xba')](_0x4c08d0['@odata.type'][_0xdfdb('0xa8')]('.')+0x1);if(_0xd00056==='PicklistAttributeMetadata'){_0x38a439['push'](getSelectList(_0x5d3923,_0x1c7964,_0x3e0208,_0xcda070['MetadataId'],_0x4c08d0['MetadataId'],_0x37de3d));}}});return Promise['all'](_0x38a439);})[_0xdfdb('0x1e')](function(_0xe8ac6c){_0x2269e3=_0xe8ac6c[0x0];var _0x266246=[];var _0x17445a=[];_0x1d69fb[_0xdfdb('0xb8')](function(_0x1d5eca){if(!_[_0xdfdb('0xbb')](_0x1d5eca[_0xdfdb('0xb9')])){var _0x5cf997=_0x1d5eca[_0xdfdb('0xb9')][_0xdfdb('0xba')](_0x1d5eca[_0xdfdb('0xb9')][_0xdfdb('0xa8')]('.')+0x1);if(_0x5cf997==='BooleanAttributeMetadata'){_0x266246[_0xdfdb('0xbc')](getBooleanList(_0x5d3923,_0x1c7964,_0x17445a,_0xcda070[_0xdfdb('0xb1')],_0x1d5eca['MetadataId'],_0x37de3d));}}});return Promise[_0xdfdb('0xbd')](_0x266246);})[_0xdfdb('0x1e')](function(_0x330515){_0x5b6e35=_0x330515[0x0];var _0x31eed0=[];var _0x4c8f21=[];_0x1d69fb[_0xdfdb('0xb8')](function(_0x99ac1c){if(_0x99ac1c[_0xdfdb('0xb9')]){var _0x1028c3=_0x99ac1c[_0xdfdb('0xb9')]['substring'](_0x99ac1c['@odata.type'][_0xdfdb('0xa8')]('.')+0x1);if(_0x1028c3===_0xdfdb('0xbe')||_0x1028c3==='DoubleAttributeMetadata'||_0x1028c3===_0xdfdb('0xbf')||_0x1028c3==='IntegerAttributeMetadata'||_0x1028c3===_0xdfdb('0xc0')||_0x1028c3===_0xdfdb('0xc1')||_0x1028c3===_0xdfdb('0xc2')||_0x1028c3===_0xdfdb('0xc3')||_0x1028c3===_0xdfdb('0xc4')||_0x1028c3==='DecimalAttributeMetadata'){_0x31eed0[_0xdfdb('0xbc')](getInputList(_0x5d3923,_0x1c7964,_0x1028c3,_0x4c8f21,_0xcda070[_0xdfdb('0xb1')],_0x99ac1c[_0xdfdb('0xb1')],_0x37de3d));}}});return Promise[_0xdfdb('0xbd')](_0x31eed0);})[_0xdfdb('0x1e')](function(_0x3cff64){_0x1c90e9=_0x3cff64[0x0];var _0x26d6d8=_0x2269e3[_0xdfdb('0xa1')](_0x5b6e35)[_0xdfdb('0xa1')](_0x1c90e9);var _0x41e162={'count':_0x26d6d8[_0xdfdb('0x45')],'rows':_0x26d6d8};return _0x41e162;})[_0xdfdb('0x1e')](respondWithResult(_0x9f2170,null))[_0xdfdb('0x28')](function(_0x4e612a){var _0x3e98f9=_0x4c4d3a[_0xdfdb('0x3f')]['test']?0x1f4:_0x4e612a['statusCode']||0x1f4;logger[_0xdfdb('0x24')](_0x4e612a[_0xdfdb('0x35')]);delete _0x4e612a[_0xdfdb('0x36')];if(_0x3e98f9===0x191){_0x3e98f9=0x190;}_0x9f2170['status'](_0x3e98f9)[_0xdfdb('0x37')](_0x4c4d3a[_0xdfdb('0x3f')]['test']?{'message':_0xdfdb('0xc5'),'statusCode':_0x4e612a[_0xdfdb('0xc6')]}:_0x4e612a);});};function getSelectList(_0x582875,_0x55281f,_0x18645f,_0x361838,_0x149084,_0x1bd0d0){var _0x15627d={'method':_0xdfdb('0xb2'),'uri':_0x582875+_0xdfdb('0xb3')+_0x361838+')/Attributes('+_0x149084+_0xdfdb('0xc7')+_0xdfdb('0xc8'),'headers':{'Authorization':_0xdfdb('0xb0')+_0x1bd0d0,'If-None-Match':null,'OData-Version':_0xdfdb('0xc9')},'json':!![]};return rp(_0x15627d)['then'](function(_0x4e02ec){var _0x32b9e5=[];var _0x2b8e5e=_0x4e02ec[_0xdfdb('0xca')][_0xdfdb('0xcb')];_0x2b8e5e[_0xdfdb('0xb8')](function(_0xb9e711){_0x32b9e5[_0xdfdb('0xbc')]({'name':_0xb9e711['Label'][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'value':String(_0xb9e711[_0xdfdb('0xce')])});});var _0x4a7bf3={'id':_0x55281f+'_'+_0x4e02ec[_0xdfdb('0xb7')],'name':_0x4e02ec[_0xdfdb('0xcf')][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'custom':![],'options':_0x32b9e5};_0x18645f[_0xdfdb('0xbc')](_0x4a7bf3);return _0x18645f;});}function getBooleanList(_0x3267d1,_0xe05520,_0x5bd682,_0x5ea5c6,_0x270d69,_0x25ee4f){var _0x5eaba9={'method':'GET','uri':_0x3267d1+_0xdfdb('0xb3')+_0x5ea5c6+_0xdfdb('0xd0')+_0x270d69+_0xdfdb('0xd1'),'headers':{'Authorization':_0xdfdb('0xb0')+_0x25ee4f,'If-None-Match':null,'OData-Version':_0xdfdb('0xc9')},'json':!![]};return rp(_0x5eaba9)['then'](function(_0x144d59){var _0x34d985=[];_0x34d985[_0xdfdb('0xbc')]({'name':_0x144d59['OptionSet'][_0xdfdb('0xd2')][_0xdfdb('0xcd')][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'value':'true'},{'name':_0x144d59['OptionSet']['FalseOption']['Label'][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'value':_0xdfdb('0xd3')});var _0x31bc32={'id':_0xe05520+'_'+_0x144d59[_0xdfdb('0xb7')],'name':_0x144d59[_0xdfdb('0xcf')][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'custom':![],'options':_0x34d985};_0x5bd682['push'](_0x31bc32);return _0x5bd682;});}function getInputList(_0x1a0be4,_0x321533,_0x1825f0,_0x1fbd45,_0x17d1b0,_0x6ffd30,_0x51ba54){var _0x5afc3f={'method':_0xdfdb('0xb2'),'uri':_0x1a0be4+_0xdfdb('0xb3')+_0x17d1b0+')/Attributes('+_0x6ffd30+_0xdfdb('0xd4')+_0x1825f0+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x51ba54,'If-None-Match':null,'OData-Version':_0xdfdb('0xc9')},'json':!![]};return rp(_0x5afc3f)[_0xdfdb('0x1e')](function(_0x4cb5d5){var _0x805066={'id':_0x321533+'_'+_0x4cb5d5['LogicalName'],'name':_0x4cb5d5[_0xdfdb('0xcf')]['UserLocalizedLabel']?_0x4cb5d5['DisplayName']['UserLocalizedLabel'][_0xdfdb('0xcd')]:_0x4cb5d5['LogicalName'],'custom':![],'options':[]};_0x1fbd45[_0xdfdb('0xbc')](_0x805066);return _0x1fbd45;});} \ No newline at end of file +var _0x8958=['keys','filters','intersection','attributes','model','fields','length','nolimit','limit','pick','filter','merge','where','options','includeAll','include','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','sort','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','username','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','query'];(function(_0x4dd0d1,_0xe03c95){var _0x13fb64=function(_0x2cf949){while(--_0x2cf949){_0x4dd0d1['push'](_0x4dd0d1['shift']());}};_0x13fb64(++_0xe03c95);}(_0x8958,0x93));var _0x8895=function(_0x2d2e36,_0x4dc847){_0x2d2e36=_0x2d2e36-0x0;var _0x195c04=_0x8958[_0x2d2e36];return _0x195c04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8895('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8895('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8895('0x2'));var util=require(_0x8895('0x3'));var path=require(_0x8895('0x4'));var sox=require('sox');var csv=require(_0x8895('0x5'));var ejs=require(_0x8895('0x6'));var fs=require('fs');var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0x5'));var querystring=require(_0x8895('0xb'));var Papa=require(_0x8895('0xc'));var Redis=require(_0x8895('0xd'));var authService=require(_0x8895('0xe'));var qs=require(_0x8895('0xf'));var as=require(_0x8895('0x10'));var hardwareService=require(_0x8895('0x11'));var logger=require(_0x8895('0x12'))('api');var utils=require(_0x8895('0x13'));var config=require(_0x8895('0x14'));var licenseUtil=require(_0x8895('0x15'));var db=require(_0x8895('0x16'))['db'];var integrations=require(_0x8895('0x17'));var jayson=require(_0x8895('0x18'));var client=jayson['client'][_0x8895('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x34e856,_0x56c18e,_0x57d40a,_0x47b9fe){return new BPromise(function(_0x9191b8,_0x4e8f53){var _0x4156f5=_0x47b9fe||client;return _0x4156f5[_0x8895('0x1a')](_0x34e856,_0x57d40a)[_0x8895('0x1b')](function(_0x3d7b59){logger[_0x8895('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x56c18e,_0x8895('0x1d'));logger[_0x8895('0x1e')](_0x8895('0x1f'),_0x56c18e,_0x8895('0x1d'),JSON[_0x8895('0x20')](_0x3d7b59));if(_0x3d7b59[_0x8895('0x21')]){if(_0x3d7b59[_0x8895('0x21')][_0x8895('0x22')]===0x1f4){logger[_0x8895('0x21')](_0x8895('0x23'),_0x56c18e,_0x3d7b59[_0x8895('0x21')][_0x8895('0x24')]);return _0x4e8f53(_0x3d7b59[_0x8895('0x21')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x56c18e,_0x3d7b59[_0x8895('0x21')][_0x8895('0x24')]);return _0x9191b8(_0x3d7b59[_0x8895('0x21')][_0x8895('0x24')]);}else{logger[_0x8895('0x1c')](_0x8895('0x23'),_0x56c18e,_0x8895('0x1d'));_0x9191b8(_0x3d7b59[_0x8895('0x25')]['message']);}})[_0x8895('0x26')](function(_0x5db3a0){logger[_0x8895('0x21')](_0x8895('0x23'),_0x56c18e,_0x5db3a0);_0x4e8f53(_0x5db3a0);});});}function respondWithStatusCode(_0x29223d,_0x4d092d){_0x4d092d=_0x4d092d||0xcc;return function(_0x5d354a){if(_0x5d354a){return _0x29223d[_0x8895('0x27')](_0x4d092d);}return _0x29223d[_0x8895('0x28')](_0x4d092d)[_0x8895('0x29')]();};}function respondWithResult(_0x24a376,_0x4fc150){_0x4fc150=_0x4fc150||0xc8;return function(_0x25da11){if(_0x25da11){return _0x24a376[_0x8895('0x28')](_0x4fc150)[_0x8895('0x2a')](_0x25da11);}};}function respondWithFilteredResult(_0x5486a6,_0x4aee03){return function(_0x78b57){if(_0x78b57){var _0x555e60=_0x78b57[_0x8895('0x2b')],_0x3d51b0=_0x4aee03[_0x8895('0x2c')],_0x3e3b48=_0x4aee03['offset']+_0x4aee03['limit'],_0x10b48f;if(_0x3e3b48>=_0x555e60){_0x3e3b48=_0x555e60;_0x10b48f=0xc8;}else{_0x10b48f=0xce;}_0x5486a6[_0x8895('0x28')](_0x10b48f);return _0x5486a6[_0x8895('0x2d')](_0x8895('0x2e'),_0x3d51b0+'-'+_0x3e3b48+'/'+_0x555e60)[_0x8895('0x2a')](_0x78b57);}return null;};}function patchUpdates(_0x19b6dd){return function(_0x560b93){try{jsonpatch['apply'](_0x560b93,_0x19b6dd,!![]);}catch(_0x46ae32){return BPromise[_0x8895('0x2f')](_0x46ae32);}return _0x560b93[_0x8895('0x30')]();};}function saveUpdates(_0x29f565,_0x1eabb6){return function(_0x52f2ac){if(_0x52f2ac){return _0x52f2ac[_0x8895('0x31')](_0x29f565)['then'](function(_0x3f055a){return _0x3f055a;});}return null;};}function removeEntity(_0x5b2b19,_0x40ba14){return function(_0x1a3fe5){if(_0x1a3fe5){return _0x1a3fe5[_0x8895('0x32')]()[_0x8895('0x1b')](function(){_0x5b2b19[_0x8895('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c54a0,_0xcba076){return function(_0x1b5359){if(!_0x1b5359){_0x2c54a0[_0x8895('0x27')](0x194);}return _0x1b5359;};}function handleError(_0x330692,_0x574f0e){_0x574f0e=_0x574f0e||0x1f4;return function(_0x2880a6){logger['error'](_0x2880a6[_0x8895('0x33')]);if(_0x2880a6['name']){delete _0x2880a6[_0x8895('0x34')];}_0x330692[_0x8895('0x28')](_0x574f0e)[_0x8895('0x35')](_0x2880a6);};}exports[_0x8895('0x36')]=function(_0xd08bf3,_0x4ee352){var _0x1cff8e={},_0x484606={},_0x57f58a={'count':0x0,'rows':[]};var _0xcc735f=_[_0x8895('0x37')](db[_0x8895('0x38')][_0x8895('0x39')],function(_0x16e110){return{'name':_0x16e110['fieldName'],'type':_0x16e110[_0x8895('0x3a')][_0x8895('0x3b')]};});_0x484606['model']=_[_0x8895('0x37')](_0xcc735f,'name');_0x484606[_0x8895('0x3c')]=_[_0x8895('0x3d')](_0xd08bf3['query']);_0x484606[_0x8895('0x3e')]=_[_0x8895('0x3f')](_0x484606['model'],_0x484606['query']);_0x1cff8e[_0x8895('0x40')]=_[_0x8895('0x3f')](_0x484606[_0x8895('0x41')],qs[_0x8895('0x42')](_0xd08bf3[_0x8895('0x3c')]['fields']));_0x1cff8e[_0x8895('0x40')]=_0x1cff8e[_0x8895('0x40')][_0x8895('0x43')]?_0x1cff8e[_0x8895('0x40')]:_0x484606[_0x8895('0x41')];if(!_0xd08bf3[_0x8895('0x3c')]['hasOwnProperty'](_0x8895('0x44'))){_0x1cff8e['limit']=qs[_0x8895('0x45')](_0xd08bf3[_0x8895('0x3c')]['limit']);_0x1cff8e[_0x8895('0x2c')]=qs['offset'](_0xd08bf3[_0x8895('0x3c')]['offset']);}_0x1cff8e['order']=qs['sort'](_0xd08bf3['query']['sort']);_0x1cff8e['where']=qs[_0x8895('0x3e')](_[_0x8895('0x46')](_0xd08bf3['query'],_0x484606['filters']),_0xcc735f);if(_0xd08bf3[_0x8895('0x3c')][_0x8895('0x47')]){_0x1cff8e['where']=_[_0x8895('0x48')](_0x1cff8e[_0x8895('0x49')],{'$or':_[_0x8895('0x37')](_0xcc735f,function(_0x3b873b){if(_0x3b873b[_0x8895('0x3a')]!=='VIRTUAL'){var _0x549080={};_0x549080[_0x3b873b['name']]={'$like':'%'+_0xd08bf3[_0x8895('0x3c')]['filter']+'%'};return _0x549080;}})});}_0x1cff8e=_[_0x8895('0x48')]({},_0x1cff8e,_0xd08bf3[_0x8895('0x4a')]);var _0x2bfd7c={'where':_0x1cff8e[_0x8895('0x49')]};return db['Dynamics365Account'][_0x8895('0x2b')](_0x2bfd7c)[_0x8895('0x1b')](function(_0x3413cd){_0x57f58a[_0x8895('0x2b')]=_0x3413cd;if(_0xd08bf3[_0x8895('0x3c')][_0x8895('0x4b')]){_0x1cff8e[_0x8895('0x4c')]=[{'all':!![]}];}return db[_0x8895('0x38')]['findAll'](_0x1cff8e);})[_0x8895('0x1b')](function(_0x3bf0e3){_0x57f58a['rows']=_0x3bf0e3;return _0x57f58a;})[_0x8895('0x1b')](respondWithFilteredResult(_0x4ee352,_0x1cff8e))['catch'](handleError(_0x4ee352,null));};exports['show']=function(_0x13546d,_0x337a9f){var _0x130018={'raw':![],'where':{'id':_0x13546d[_0x8895('0x4d')]['id']}},_0x53c4a2={};_0x53c4a2['model']=_[_0x8895('0x3d')](db[_0x8895('0x38')][_0x8895('0x39')]);_0x53c4a2[_0x8895('0x3c')]=_[_0x8895('0x3d')](_0x13546d[_0x8895('0x3c')]);_0x53c4a2[_0x8895('0x3e')]=_['intersection'](_0x53c4a2['model'],_0x53c4a2[_0x8895('0x3c')]);_0x130018[_0x8895('0x40')]=_['intersection'](_0x53c4a2[_0x8895('0x41')],qs['fields'](_0x13546d['query'][_0x8895('0x42')]));_0x130018['attributes']=_0x130018[_0x8895('0x40')][_0x8895('0x43')]?_0x130018[_0x8895('0x40')]:_0x53c4a2[_0x8895('0x41')];if(_0x13546d[_0x8895('0x3c')][_0x8895('0x4b')]){_0x130018[_0x8895('0x4c')]=[{'all':!![]}];}_0x130018=_[_0x8895('0x48')]({},_0x130018,_0x13546d['options']);return db[_0x8895('0x38')][_0x8895('0x4e')](_0x130018)[_0x8895('0x1b')](handleEntityNotFound(_0x337a9f,null))['then'](respondWithResult(_0x337a9f,null))[_0x8895('0x26')](handleError(_0x337a9f,null));};exports[_0x8895('0x4f')]=function(_0xd7ffeb,_0x14e769){return db[_0x8895('0x38')][_0x8895('0x4f')](_0xd7ffeb[_0x8895('0x50')],{})[_0x8895('0x1b')](respondWithResult(_0x14e769,0xc9))[_0x8895('0x26')](handleError(_0x14e769,null));};exports[_0x8895('0x31')]=function(_0x4fe2c4,_0x2fe39c){if(_0x4fe2c4[_0x8895('0x50')]['id']){delete _0x4fe2c4[_0x8895('0x50')]['id'];}return db[_0x8895('0x38')][_0x8895('0x4e')]({'where':{'id':_0x4fe2c4['params']['id']}})[_0x8895('0x1b')](handleEntityNotFound(_0x2fe39c,null))[_0x8895('0x1b')](saveUpdates(_0x4fe2c4[_0x8895('0x50')],null))[_0x8895('0x1b')](respondWithResult(_0x2fe39c,null))[_0x8895('0x26')](handleError(_0x2fe39c,null));};exports['destroy']=function(_0x46389f,_0x1e12de){return db[_0x8895('0x38')]['find']({'where':{'id':_0x46389f[_0x8895('0x4d')]['id']}})[_0x8895('0x1b')](handleEntityNotFound(_0x1e12de,null))[_0x8895('0x1b')](removeEntity(_0x1e12de,null))['catch'](handleError(_0x1e12de,null));};exports[_0x8895('0x51')]=function(_0x207548,_0x564284,_0x2b6ceb){var _0x26f68c={};var _0x5198f8={};var _0x2f990a;var _0x2794c1;return db[_0x8895('0x38')][_0x8895('0x52')]({'where':{'id':_0x207548['params']['id']}})['then'](handleEntityNotFound(_0x564284,null))[_0x8895('0x1b')](function(_0x32f704){if(_0x32f704){_0x2f990a=_0x32f704;_0x5198f8[_0x8895('0x41')]=_['keys'](db[_0x8895('0x53')][_0x8895('0x39')]);_0x5198f8['query']=_[_0x8895('0x3d')](_0x207548['query']);_0x5198f8[_0x8895('0x3e')]=_[_0x8895('0x3f')](_0x5198f8[_0x8895('0x41')],_0x5198f8[_0x8895('0x3c')]);_0x26f68c[_0x8895('0x40')]=_['intersection'](_0x5198f8['model'],qs[_0x8895('0x42')](_0x207548[_0x8895('0x3c')]['fields']));_0x26f68c[_0x8895('0x40')]=_0x26f68c[_0x8895('0x40')][_0x8895('0x43')]?_0x26f68c[_0x8895('0x40')]:_0x5198f8['model'];_0x26f68c[_0x8895('0x54')]=qs[_0x8895('0x55')](_0x207548[_0x8895('0x3c')][_0x8895('0x55')]);_0x26f68c[_0x8895('0x49')]=qs[_0x8895('0x3e')](_[_0x8895('0x46')](_0x207548[_0x8895('0x3c')],_0x5198f8[_0x8895('0x3e')]));if(_0x207548[_0x8895('0x3c')][_0x8895('0x47')]){_0x26f68c[_0x8895('0x49')]=_[_0x8895('0x48')](_0x26f68c[_0x8895('0x49')],{'$or':_[_0x8895('0x37')](_0x26f68c['attributes'],function(_0x5a60ee){var _0x5b96fe={};_0x5b96fe[_0x5a60ee]={'$like':'%'+_0x207548[_0x8895('0x3c')][_0x8895('0x47')]+'%'};return _0x5b96fe;})});}_0x26f68c=_[_0x8895('0x48')]({},_0x26f68c,_0x207548[_0x8895('0x4a')]);return _0x2f990a[_0x8895('0x51')](_0x26f68c);}})['then'](function(_0x816803){if(_0x816803){_0x2794c1=_0x816803[_0x8895('0x43')];if(!_0x207548['query'][_0x8895('0x56')](_0x8895('0x44'))){_0x26f68c[_0x8895('0x45')]=qs[_0x8895('0x45')](_0x207548[_0x8895('0x3c')]['limit']);_0x26f68c[_0x8895('0x2c')]=qs[_0x8895('0x2c')](_0x207548[_0x8895('0x3c')][_0x8895('0x2c')]);}return _0x2f990a[_0x8895('0x51')](_0x26f68c);}})[_0x8895('0x1b')](function(_0x22f220){if(_0x22f220){return _0x22f220?{'count':_0x2794c1,'rows':_0x22f220}:null;}})['then'](respondWithResult(_0x564284,null))[_0x8895('0x26')](handleError(_0x564284,null));};exports[_0x8895('0x57')]=function(_0x49dcab,_0x1ffefd,_0x1f404e){if(_0x49dcab[_0x8895('0x50')]['id']){delete _0x49dcab[_0x8895('0x50')]['id'];}return db[_0x8895('0x38')]['findOne']({'where':{'id':_0x49dcab[_0x8895('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ffefd,null))[_0x8895('0x1b')](function(_0x2440cb){if(_0x2440cb){_0x49dcab['body'][_0x8895('0x58')]=_0x2440cb['id'];_0x49dcab[_0x8895('0x50')][_0x8895('0x59')]=integrations[_0x8895('0x5a')](_0x49dcab['body'][_0x8895('0x5b')],_0x49dcab['body']['type']);_0x49dcab[_0x8895('0x50')][_0x8895('0x5c')]=integrations[_0x8895('0x5d')](_0x49dcab['body'][_0x8895('0x5b')],_0x49dcab['body'][_0x8895('0x3a')]);return db[_0x8895('0x53')][_0x8895('0x4f')](_0x49dcab[_0x8895('0x50')],{'include':[{'model':db[_0x8895('0x5e')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x8895('0x5c')}]});}return null;})['then'](respondWithResult(_0x1ffefd,null))[_0x8895('0x26')](handleError(_0x1ffefd,null));};exports[_0x8895('0x5f')]=function(_0x4925c4,_0xd1fd50,_0xd9637a){var _0x3ace6f=_0x4925c4[_0x8895('0x3c')][_0x8895('0x60')];var _0x4f80a3=_0x3ace6f===_0x8895('0x61')?'Incident':'PhoneCall';var _0x35b354='';var _0x5276f3='';var _0x39a9f7='';var _0x35646f='';var _0x64eca7='';var _0x39f5e5='';var _0x53591d='';var _0x4d802e='';var _0x571731=[_0x8895('0x62'),_0x8895('0x63'),_0x8895('0x64'),_0x8895('0x65'),_0x8895('0x66'),_0x8895('0x67'),'phonenumber',_0x8895('0x68'),_0x8895('0x69'),_0x8895('0x6a')];var _0x584a1f=[_0x8895('0x6b'),'accountidyominame',_0x8895('0x6c'),'billedserviceunits',_0x8895('0x6d'),_0x8895('0x6e'),'contractdetailidname',_0x8895('0x6f'),_0x8895('0x70'),'createdbyexternalpartyyominame',_0x8895('0x71'),_0x8895('0x72'),_0x8895('0x73'),_0x8895('0x74'),_0x8895('0x75'),_0x8895('0x76'),_0x8895('0x77'),'customeridyominame',_0x8895('0x78'),'entitlementidname',_0x8895('0x79'),_0x8895('0x7a'),_0x8895('0x7b'),_0x8895('0x7c'),'firstresponsebykpiidname',_0x8895('0x7d'),_0x8895('0x7e'),_0x8895('0x7f'),_0x8895('0x80'),_0x8895('0x81'),_0x8895('0x82'),_0x8895('0x83'),_0x8895('0x84'),'modifiedbyname',_0x8895('0x85'),_0x8895('0x86'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x8895('0x87'),_0x8895('0x88'),_0x8895('0x89'),_0x8895('0x8a'),'overriddencreatedon','owneridname',_0x8895('0x8b'),_0x8895('0x8c'),_0x8895('0x8d'),_0x8895('0x8e'),_0x8895('0x8f'),'prioritycodename',_0x8895('0x90'),_0x8895('0x91'),'resolveby',_0x8895('0x92'),_0x8895('0x93'),_0x8895('0x94'),_0x8895('0x95'),_0x8895('0x96'),_0x8895('0x97'),'slaname',_0x8895('0x98'),_0x8895('0x99'),'statuscode','subjectidname','ticketnumber',_0x8895('0x9a'),_0x8895('0x9b'),'traversedpath',_0x8895('0x9c'),'versionnumber'];var _0x5b6861=_0x571731['concat'](_0x584a1f);return db[_0x8895('0x38')][_0x8895('0x52')]({'where':{'id':_0x4925c4[_0x8895('0x4d')]['id']},'attributes':['id',_0x8895('0x9d'),_0x8895('0x9e'),'remoteUri',_0x8895('0x9f'),_0x8895('0xa0'),_0x8895('0xa1')]})['then'](handleEntityNotFound(_0xd1fd50,null))['then'](function(_0x484cd8){if(_0x484cd8){_0x4d802e=_0x484cd8[_0x8895('0xa2')];var _0x1d796a=_0x4d802e[_0x8895('0xa3')](-0x1);if(_0x1d796a==='/'){_0x4d802e=_0x4d802e[_0x8895('0xa4')](0x0,_0x4d802e[_0x8895('0xa5')](_0x1d796a));}_0x53591d=util[_0x8895('0xa6')](_0x8895('0xa7'),_0x4d802e);var _0x524873={'method':_0x8895('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x484cd8[_0x8895('0x9f')]+'/oauth2/token','form':{'client_id':_0x484cd8[_0x8895('0xa0')],'resource':_0x4d802e,'username':_0x484cd8[_0x8895('0x9d')],'password':_0x484cd8[_0x8895('0x9e')],'grant_type':_0x8895('0x9e'),'client_secret':_0x484cd8[_0x8895('0xa1')]},'json':!![]};return rp(_0x524873);}})[_0x8895('0x1b')](function(_0x208a36){_0x39f5e5=_0x208a36['access_token'];var _0x3edc41={'method':_0x8895('0xa9'),'uri':encodeURI(_0x53591d+_0x8895('0xaa')+_0x4f80a3+'\x27'),'headers':{'Authorization':_0x8895('0xab')+_0x39f5e5,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x3edc41);})['then'](function(_0x464d1c){var _0x554477=_0x464d1c[_0x8895('0xad')][0x0];var _0x278605=_0x554477[_0x8895('0xae')];var _0x92d99b={'method':_0x8895('0xa9'),'uri':_0x53591d+_0x8895('0xaf')+_0x278605+_0x8895('0xb0'),'headers':{'Authorization':_0x8895('0xab')+_0x39f5e5,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x92d99b);})['then'](function(_0x18d225){_0x35b354=_0x18d225;_0x5276f3=_0x35b354['Attributes'];_0x5276f3=_[_0x8895('0xb1')](_0x5276f3,function(_0xa4ecd9){return!_0x5b6861[_0x8895('0xb2')](_0xa4ecd9['LogicalName']);});var _0x13b48d=[];var _0x4b7dff=[];_0x5276f3[_0x8895('0xb3')](function(_0x3d422a){if(_0x3d422a[_0x8895('0xb4')]){var _0x3745e=_0x3d422a['@odata.type']['substring'](_0x3d422a[_0x8895('0xb4')]['lastIndexOf']('.')+0x1);if(_0x3745e==='PicklistAttributeMetadata'){_0x13b48d[_0x8895('0xb5')](getSelectList(_0x53591d,_0x3ace6f,_0x4b7dff,_0x35b354['MetadataId'],_0x3d422a[_0x8895('0xae')],_0x39f5e5));}}});return Promise[_0x8895('0xb6')](_0x13b48d);})[_0x8895('0x1b')](function(_0xcb467c){_0x39a9f7=_0xcb467c[0x0];var _0x457d37=[];var _0x1ef755=[];_0x5276f3[_0x8895('0xb3')](function(_0x11d283){if(!_[_0x8895('0xb7')](_0x11d283['@odata.type'])){var _0x33deba=_0x11d283[_0x8895('0xb4')][_0x8895('0xa4')](_0x11d283['@odata.type'][_0x8895('0xa5')]('.')+0x1);if(_0x33deba===_0x8895('0xb8')){_0x457d37[_0x8895('0xb5')](getBooleanList(_0x53591d,_0x3ace6f,_0x1ef755,_0x35b354['MetadataId'],_0x11d283[_0x8895('0xae')],_0x39f5e5));}}});return Promise[_0x8895('0xb6')](_0x457d37);})[_0x8895('0x1b')](function(_0x4f8c62){_0x35646f=_0x4f8c62[0x0];var _0x340126=[];var _0x134b9d=[];_0x5276f3[_0x8895('0xb3')](function(_0x510d69){if(_0x510d69[_0x8895('0xb4')]){var _0x2a2a52=_0x510d69[_0x8895('0xb4')][_0x8895('0xa4')](_0x510d69[_0x8895('0xb4')][_0x8895('0xa5')]('.')+0x1);if(_0x2a2a52==='StringAttributeMetadata'||_0x2a2a52===_0x8895('0xb9')||_0x2a2a52===_0x8895('0xba')||_0x2a2a52==='IntegerAttributeMetadata'||_0x2a2a52==='MemoAttributeMetadata'||_0x2a2a52===_0x8895('0xbb')||_0x2a2a52===_0x8895('0xbc')||_0x2a2a52==='EntityNameAttributeMetadata'||_0x2a2a52===_0x8895('0xbd')||_0x2a2a52===_0x8895('0xbe')){_0x340126[_0x8895('0xb5')](getInputList(_0x53591d,_0x3ace6f,_0x2a2a52,_0x134b9d,_0x35b354[_0x8895('0xae')],_0x510d69[_0x8895('0xae')],_0x39f5e5));}}});return Promise['all'](_0x340126);})[_0x8895('0x1b')](function(_0x35f345){_0x64eca7=_0x35f345[0x0];var _0x4691f2=_0x39a9f7[_0x8895('0xbf')](_0x35646f)[_0x8895('0xbf')](_0x64eca7);var _0x2317cc={'count':_0x4691f2[_0x8895('0x43')],'rows':_0x4691f2};return _0x2317cc;})[_0x8895('0x1b')](respondWithResult(_0xd1fd50,null))[_0x8895('0x26')](function(_0x208bb4){var _0x2165fe=_0x4925c4[_0x8895('0x3c')]['test']?0x1f4:_0x208bb4[_0x8895('0xc0')]||0x1f4;logger[_0x8895('0x21')](_0x208bb4[_0x8895('0x33')]);delete _0x208bb4[_0x8895('0x34')];if(_0x2165fe===0x191){_0x2165fe=0x190;}_0xd1fd50['status'](_0x2165fe)[_0x8895('0x35')](_0x4925c4[_0x8895('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x208bb4[_0x8895('0xc0')]}:_0x208bb4);});};function getSelectList(_0x4cc76f,_0x20a58c,_0x52439f,_0x4e0a0e,_0x215358,_0x4f81ef){var _0x1b9266={'method':'GET','uri':_0x4cc76f+_0x8895('0xaf')+_0x4e0a0e+_0x8895('0xc1')+_0x215358+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x8895('0xc2'),'headers':{'Authorization':_0x8895('0xab')+_0x4f81ef,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x1b9266)['then'](function(_0x47f014){var _0x380598=[];var _0x1af2b7=_0x47f014[_0x8895('0xc3')][_0x8895('0xc4')];_0x1af2b7[_0x8895('0xb3')](function(_0x252ef8){_0x380598[_0x8895('0xb5')]({'name':_0x252ef8[_0x8895('0xc5')][_0x8895('0xc6')][_0x8895('0xc5')],'value':String(_0x252ef8[_0x8895('0xc7')])});});var _0x275caf={'id':_0x20a58c+'_'+_0x47f014[_0x8895('0xc8')],'name':_0x47f014[_0x8895('0xc9')]['UserLocalizedLabel'][_0x8895('0xc5')],'custom':![],'options':_0x380598};_0x52439f[_0x8895('0xb5')](_0x275caf);return _0x52439f;});}function getBooleanList(_0x3c548d,_0x616fd,_0x54e061,_0x342a11,_0x32eb27,_0xf3b3e5){var _0x20752d={'method':_0x8895('0xa9'),'uri':_0x3c548d+_0x8895('0xaf')+_0x342a11+_0x8895('0xc1')+_0x32eb27+_0x8895('0xca'),'headers':{'Authorization':_0x8895('0xab')+_0xf3b3e5,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x20752d)[_0x8895('0x1b')](function(_0xc9bdfd){var _0x2eb831=[];_0x2eb831[_0x8895('0xb5')]({'name':_0xc9bdfd[_0x8895('0xc3')][_0x8895('0xcb')]['Label'][_0x8895('0xc6')]['Label'],'value':_0x8895('0xcc')},{'name':_0xc9bdfd[_0x8895('0xc3')][_0x8895('0xcd')]['Label'][_0x8895('0xc6')][_0x8895('0xc5')],'value':'false'});var _0x3dfcce={'id':_0x616fd+'_'+_0xc9bdfd['LogicalName'],'name':_0xc9bdfd[_0x8895('0xc9')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x2eb831};_0x54e061[_0x8895('0xb5')](_0x3dfcce);return _0x54e061;});}function getInputList(_0x19f83e,_0x2c87ff,_0x81c9e4,_0x7d07fe,_0x524c23,_0x2feadb,_0x5a88e2){var _0x4c7424={'method':_0x8895('0xa9'),'uri':_0x19f83e+_0x8895('0xaf')+_0x524c23+')/Attributes('+_0x2feadb+_0x8895('0xce')+_0x81c9e4+_0x8895('0xcf'),'headers':{'Authorization':_0x8895('0xab')+_0x5a88e2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c7424)[_0x8895('0x1b')](function(_0x431b18){var _0x114200={'id':_0x2c87ff+'_'+_0x431b18['LogicalName'],'name':_0x431b18[_0x8895('0xc9')][_0x8895('0xc6')]?_0x431b18[_0x8895('0xc9')][_0x8895('0xc6')][_0x8895('0xc5')]:_0x431b18[_0x8895('0xc8')],'custom':![],'options':[]};_0x7d07fe[_0x8895('0xb5')](_0x114200);return _0x7d07fe;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a02de82..2da9e32 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 _0x4b3c=['rimraf','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5be32a,_0xa32143){var _0x21e1bb=function(_0xbde840){while(--_0xbde840){_0x5be32a['push'](_0x5be32a['shift']());}};_0x21e1bb(++_0xa32143);}(_0x4b3c,0x9b));var _0xc4b3=function(_0x24b00f,_0x5cb40c){_0x24b00f=_0x24b00f-0x0;var _0x2d816d=_0x4b3c[_0x24b00f];return _0x2d816d;};'use strict';var _=require(_0xc4b3('0x0'));var util=require('util');var logger=require(_0xc4b3('0x1'))(_0xc4b3('0x2'));var moment=require(_0xc4b3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4b3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4b3('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xc4b3('0x6'));module[_0xc4b3('0x7')]=function(_0x840e2c,_0x5beecd){return _0x840e2c[_0xc4b3('0x8')](_0xc4b3('0x9'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50cd=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x50239c,_0x416c10){var _0x32151e=function(_0x50c002){while(--_0x50c002){_0x50239c['push'](_0x50239c['shift']());}};_0x32151e(++_0x416c10);}(_0x50cd,0x19f));var _0xd50c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x50cd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xd50c('0x0'));var logger=require(_0xd50c('0x1'))(_0xd50c('0x2'));var moment=require(_0xd50c('0x3'));var BPromise=require(_0xd50c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd50c('0x5'));var integrations=require(_0xd50c('0x6'));module[_0xd50c('0x7')]=function(_0x5c8cbd,_0x3ce11c){return _0x5c8cbd[_0xd50c('0x8')]('Dynamics365Account',attributes,{'tableName':_0xd50c('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 582f387..8da56a8 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 _0xdded=['error','code','message','info','GetDynamics365Account','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x32fb31,_0x56f8c8){var _0x489262=function(_0x3dadf1){while(--_0x3dadf1){_0x32fb31['push'](_0x32fb31['shift']());}};_0x489262(++_0x56f8c8);}(_0xdded,0x17a));var _0xddde=function(_0x5ced85,_0x31f067){_0x5ced85=_0x5ced85-0x0;var _0x20fde0=_0xdded[_0x5ced85];return _0x20fde0;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var moment=require(_0xddde('0x2'));var BPromise=require(_0xddde('0x3'));var rs=require(_0xddde('0x4'));var fs=require('fs');var Redis=require(_0xddde('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xddde('0x6'));var logger=require(_0xddde('0x7'))(_0xddde('0x8'));var config=require(_0xddde('0x9'));var jayson=require(_0xddde('0xa'));var client=jayson[_0xddde('0xb')][_0xddde('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cea18,_0x516eb5,_0x18d8b8){return new BPromise(function(_0x3a5e8a,_0x5f1a34){return client[_0xddde('0xd')](_0x3cea18,_0x18d8b8)['then'](function(_0x48dd55){logger['info'](_0xddde('0xe'),_0x516eb5,'request\x20sent');logger[_0xddde('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x516eb5,_0xddde('0x10'),JSON[_0xddde('0x11')](_0x48dd55));if(_0x48dd55[_0xddde('0x12')]){if(_0x48dd55[_0xddde('0x12')][_0xddde('0x13')]===0x1f4){logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x48dd55[_0xddde('0x12')]['message']);return _0x5f1a34(_0x48dd55[_0xddde('0x12')][_0xddde('0x14')]);}logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x48dd55[_0xddde('0x12')][_0xddde('0x14')]);return _0x3a5e8a(_0x48dd55['error'][_0xddde('0x14')]);}else{logger[_0xddde('0x15')](_0xddde('0xe'),_0x516eb5,'request\x20sent');_0x3a5e8a(_0x48dd55['result'][_0xddde('0x14')]);}})['catch'](function(_0x30a9da){logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x30a9da);_0x5f1a34(_0x30a9da);});});}exports[_0xddde('0x16')]=function(_0x2f0e58){var _0x55349b=this;return new Promise(function(_0x249f19,_0x129e3e){return db['Dynamics365Account'][_0xddde('0x17')]({'raw':_0x2f0e58[_0xddde('0x18')]?_0x2f0e58['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f0e58[_0xddde('0x18')]?_0x2f0e58['options'][_0xddde('0x19')]||null:null,'attributes':_0x2f0e58['options']?_0x2f0e58[_0xddde('0x18')][_0xddde('0x1a')]||null:null,'limit':_0x2f0e58['options']?_0x2f0e58['options'][_0xddde('0x1b')]||null:null,'include':_0x2f0e58[_0xddde('0x18')]?_0x2f0e58[_0xddde('0x18')][_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x2f0e58[_0xddde('0x18')][_0xddde('0x1c')],function(_0x56a33a){return{'model':db[_0x56a33a['model']],'as':_0x56a33a['as'],'attributes':_0x56a33a[_0xddde('0x1a')],'include':_0x56a33a[_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x56a33a[_0xddde('0x1c')],function(_0xdb57ef){return{'model':db[_0xdb57ef['model']],'as':_0xdb57ef['as'],'attributes':_0xdb57ef[_0xddde('0x1a')],'include':_0xdb57ef[_0xddde('0x1c')]?_['map'](_0xdb57ef['include'],function(_0xa60e85){return{'model':db[_0xa60e85[_0xddde('0x1e')]],'as':_0xa60e85['as'],'attributes':_0xa60e85['attributes']};}):[]};}):[]};}):[]:[]})[_0xddde('0x1f')](function(_0x45941e){logger['info'](_0xddde('0x16'),_0x2f0e58);logger[_0xddde('0xf')](_0xddde('0x16'),_0x2f0e58,JSON[_0xddde('0x11')](_0x45941e));_0x249f19(_0x45941e);})[_0xddde('0x20')](function(_0xb5d4b6){logger[_0xddde('0x12')](_0xddde('0x16'),_0xb5d4b6[_0xddde('0x14')],_0x2f0e58);_0x129e3e(_0x55349b[_0xddde('0x12')](0x1f4,_0xb5d4b6[_0xddde('0x14')]));});});};exports[_0xddde('0x21')]=function(_0xe3d006){var _0x718921=this;return new Promise(function(_0x5e04d6,_0x380acb){return db[_0xddde('0x22')][_0xddde('0x23')]({'raw':_0xe3d006[_0xddde('0x18')]?_0xe3d006[_0xddde('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xe3d006['options']?_0xe3d006[_0xddde('0x18')][_0xddde('0x19')]||null:null,'attributes':_0xe3d006[_0xddde('0x18')]?_0xe3d006['options']['attributes']||null:null,'include':_0xe3d006[_0xddde('0x18')]?_0xe3d006[_0xddde('0x18')][_0xddde('0x1c')]?_[_0xddde('0x1d')](_0xe3d006['options'][_0xddde('0x1c')],function(_0x5d64cb){return{'model':db[_0x5d64cb[_0xddde('0x1e')]],'as':_0x5d64cb['as'],'attributes':_0x5d64cb[_0xddde('0x1a')],'include':_0x5d64cb[_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x5d64cb[_0xddde('0x1c')],function(_0x2b2661){return{'model':db[_0x2b2661[_0xddde('0x1e')]],'as':_0x2b2661['as'],'attributes':_0x2b2661[_0xddde('0x1a')],'include':_0x2b2661[_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x2b2661[_0xddde('0x1c')],function(_0x872116){return{'model':db[_0x872116['model']],'as':_0x872116['as'],'attributes':_0x872116[_0xddde('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xddde('0x1f')](function(_0x4c68ab){logger['info']('ShowDynamics365Account',_0xe3d006);logger[_0xddde('0xf')](_0xddde('0x21'),_0xe3d006,JSON[_0xddde('0x11')](_0x4c68ab));_0x5e04d6(_0x4c68ab);})[_0xddde('0x20')](function(_0x2825c6){logger[_0xddde('0x12')](_0xddde('0x21'),_0x2825c6['message'],_0xe3d006);_0x380acb(_0x718921['error'](0x1f4,_0x2825c6[_0xddde('0x14')]));});});}; \ No newline at end of file +var _0x2678=['attributes','limit','include','map','model','GetDynamics365Account','stringify','catch','ShowDynamics365Account','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','findAll','options','raw','where'];(function(_0x340a34,_0x1fe485){var _0x3dd990=function(_0x5262b0){while(--_0x5262b0){_0x340a34['push'](_0x340a34['shift']());}};_0x3dd990(++_0x1fe485);}(_0x2678,0x1bb));var _0x8267=function(_0x12cbdd,_0x4ee21b){_0x12cbdd=_0x12cbdd-0x0;var _0x3bde34=_0x2678[_0x12cbdd];return _0x3bde34;};'use strict';var _=require('lodash');var util=require(_0x8267('0x0'));var moment=require(_0x8267('0x1'));var BPromise=require(_0x8267('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8267('0x3'));var logger=require(_0x8267('0x4'))(_0x8267('0x5'));var config=require('../../config/environment');var jayson=require(_0x8267('0x6'));var client=jayson[_0x8267('0x7')][_0x8267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e6635,_0x264d94,_0x3f30c2){return new BPromise(function(_0x2ac4ad,_0x2bbb0d){return client['request'](_0x3e6635,_0x3f30c2)[_0x8267('0x9')](function(_0x2f7832){logger['info'](_0x8267('0xa'),_0x264d94,_0x8267('0xb'));logger[_0x8267('0xc')](_0x8267('0xd'),_0x264d94,_0x8267('0xb'),JSON['stringify'](_0x2f7832));if(_0x2f7832[_0x8267('0xe')]){if(_0x2f7832[_0x8267('0xe')][_0x8267('0xf')]===0x1f4){logger[_0x8267('0xe')](_0x8267('0xa'),_0x264d94,_0x2f7832[_0x8267('0xe')][_0x8267('0x10')]);return _0x2bbb0d(_0x2f7832[_0x8267('0xe')][_0x8267('0x10')]);}logger[_0x8267('0xe')](_0x8267('0xa'),_0x264d94,_0x2f7832['error'][_0x8267('0x10')]);return _0x2ac4ad(_0x2f7832['error'][_0x8267('0x10')]);}else{logger[_0x8267('0x11')](_0x8267('0xa'),_0x264d94,_0x8267('0xb'));_0x2ac4ad(_0x2f7832['result'][_0x8267('0x10')]);}})['catch'](function(_0x3d2c1e){logger[_0x8267('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x264d94,_0x3d2c1e);_0x2bbb0d(_0x3d2c1e);});});}exports['GetDynamics365Account']=function(_0x2577a5){var _0x39f8c8=this;return new Promise(function(_0x1bce2d,_0x312166){return db['Dynamics365Account'][_0x8267('0x12')]({'raw':_0x2577a5['options']?_0x2577a5[_0x8267('0x13')][_0x8267('0x14')]===undefined?!![]:![]:!![],'where':_0x2577a5[_0x8267('0x13')]?_0x2577a5['options'][_0x8267('0x15')]||null:null,'attributes':_0x2577a5[_0x8267('0x13')]?_0x2577a5[_0x8267('0x13')][_0x8267('0x16')]||null:null,'limit':_0x2577a5[_0x8267('0x13')]?_0x2577a5[_0x8267('0x13')][_0x8267('0x17')]||null:null,'include':_0x2577a5['options']?_0x2577a5['options'][_0x8267('0x18')]?_[_0x8267('0x19')](_0x2577a5[_0x8267('0x13')][_0x8267('0x18')],function(_0x4426ca){return{'model':db[_0x4426ca[_0x8267('0x1a')]],'as':_0x4426ca['as'],'attributes':_0x4426ca['attributes'],'include':_0x4426ca[_0x8267('0x18')]?_[_0x8267('0x19')](_0x4426ca[_0x8267('0x18')],function(_0x2903bb){return{'model':db[_0x2903bb[_0x8267('0x1a')]],'as':_0x2903bb['as'],'attributes':_0x2903bb['attributes'],'include':_0x2903bb[_0x8267('0x18')]?_[_0x8267('0x19')](_0x2903bb[_0x8267('0x18')],function(_0xb55ec0){return{'model':db[_0xb55ec0[_0x8267('0x1a')]],'as':_0xb55ec0['as'],'attributes':_0xb55ec0[_0x8267('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8267('0x9')](function(_0x59cee3){logger[_0x8267('0x11')](_0x8267('0x1b'),_0x2577a5);logger[_0x8267('0xc')](_0x8267('0x1b'),_0x2577a5,JSON[_0x8267('0x1c')](_0x59cee3));_0x1bce2d(_0x59cee3);})[_0x8267('0x1d')](function(_0x2d75e1){logger[_0x8267('0xe')](_0x8267('0x1b'),_0x2d75e1[_0x8267('0x10')],_0x2577a5);_0x312166(_0x39f8c8[_0x8267('0xe')](0x1f4,_0x2d75e1['message']));});});};exports[_0x8267('0x1e')]=function(_0x4f7377){var _0x1e976d=this;return new Promise(function(_0x4f4501,_0x5001d0){return db['Dynamics365Account']['find']({'raw':_0x4f7377['options']?_0x4f7377[_0x8267('0x13')][_0x8267('0x14')]===undefined?!![]:![]:!![],'where':_0x4f7377['options']?_0x4f7377[_0x8267('0x13')][_0x8267('0x15')]||null:null,'attributes':_0x4f7377['options']?_0x4f7377[_0x8267('0x13')][_0x8267('0x16')]||null:null,'include':_0x4f7377[_0x8267('0x13')]?_0x4f7377[_0x8267('0x13')]['include']?_[_0x8267('0x19')](_0x4f7377[_0x8267('0x13')][_0x8267('0x18')],function(_0x54dabe){return{'model':db[_0x54dabe[_0x8267('0x1a')]],'as':_0x54dabe['as'],'attributes':_0x54dabe[_0x8267('0x16')],'include':_0x54dabe[_0x8267('0x18')]?_[_0x8267('0x19')](_0x54dabe[_0x8267('0x18')],function(_0x26955b){return{'model':db[_0x26955b['model']],'as':_0x26955b['as'],'attributes':_0x26955b[_0x8267('0x16')],'include':_0x26955b[_0x8267('0x18')]?_[_0x8267('0x19')](_0x26955b[_0x8267('0x18')],function(_0x4b975f){return{'model':db[_0x4b975f[_0x8267('0x1a')]],'as':_0x4b975f['as'],'attributes':_0x4b975f[_0x8267('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8267('0x9')](function(_0x39d957){logger[_0x8267('0x11')](_0x8267('0x1e'),_0x4f7377);logger[_0x8267('0xc')]('ShowDynamics365Account',_0x4f7377,JSON[_0x8267('0x1c')](_0x39d957));_0x4f4501(_0x39d957);})[_0x8267('0x1d')](function(_0xa87476){logger['error'](_0x8267('0x1e'),_0xa87476[_0x8267('0x10')],_0x4f7377);_0x5001d0(_0x1e976d[_0x8267('0xe')](0x1f4,_0xa87476[_0x8267('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f32162e..2b07ca5 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 _0x042e=['create','put','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x499f5a,_0x29fa70){var _0xc40a38=function(_0x443c62){while(--_0x443c62){_0x499f5a['push'](_0x499f5a['shift']());}};_0xc40a38(++_0x29fa70);}(_0x042e,0xf8));var _0xe042=function(_0x4c866d,_0x404b6b){_0x4c866d=_0x4c866d-0x0;var _0x214982=_0x042e[_0x4c866d];return _0x214982;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe042('0x0'));var timeout=require('connect-timeout');var express=require(_0xe042('0x1'));var router=express[_0xe042('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe042('0x3'));var config=require('../../config/environment');var controller=require(_0xe042('0x4'));router[_0xe042('0x5')]('/',auth[_0xe042('0x6')](),controller[_0xe042('0x7')]);router['get'](_0xe042('0x8'),auth[_0xe042('0x6')](),controller[_0xe042('0x9')]);router[_0xe042('0x5')](_0xe042('0xa'),auth[_0xe042('0x6')](),controller[_0xe042('0xb')]);router[_0xe042('0x5')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xe042('0xc')]);router['get'](_0xe042('0xd'),auth[_0xe042('0x6')](),controller[_0xe042('0xe')]);router[_0xe042('0xf')]('/',auth[_0xe042('0x6')](),controller[_0xe042('0x10')]);router[_0xe042('0x11')]('/:id',auth[_0xe042('0x6')](),controller[_0xe042('0x12')]);router[_0xe042('0x13')]('/:id',auth[_0xe042('0x6')](),controller[_0xe042('0x14')]);module[_0xe042('0x15')]=router; \ No newline at end of file +var _0xc193=['get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xc28d2d,_0x2e831e){var _0x591a46=function(_0x2985b5){while(--_0x2985b5){_0xc28d2d['push'](_0xc28d2d['shift']());}};_0x591a46(++_0x2e831e);}(_0xc193,0x1a8));var _0x3c19=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc193[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x3c19('0x0'));var util=require(_0x3c19('0x1'));var path=require(_0x3c19('0x2'));var timeout=require(_0x3c19('0x3'));var express=require(_0x3c19('0x4'));var router=express[_0x3c19('0x5')]();var auth=require(_0x3c19('0x6'));var interaction=require(_0x3c19('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x3c19('0x8')]('/',auth[_0x3c19('0x9')](),controller['index']);router[_0x3c19('0x8')](_0x3c19('0xa'),auth['isAuthenticated'](),controller[_0x3c19('0xb')]);router[_0x3c19('0x8')](_0x3c19('0xc'),auth['isAuthenticated'](),controller[_0x3c19('0xd')]);router[_0x3c19('0x8')](_0x3c19('0xe'),auth[_0x3c19('0x9')](),controller[_0x3c19('0xf')]);router['get'](_0x3c19('0x10'),auth[_0x3c19('0x9')](),controller[_0x3c19('0x11')]);router[_0x3c19('0x12')]('/',auth[_0x3c19('0x9')](),controller[_0x3c19('0x13')]);router[_0x3c19('0x14')](_0x3c19('0xa'),auth[_0x3c19('0x9')](),controller[_0x3c19('0x15')]);router['delete'](_0x3c19('0xa'),auth[_0x3c19('0x9')](),controller[_0x3c19('0x16')]);module[_0x3c19('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 723be9e..e932b82 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 _0x9e34=['exports','STRING','ENUM','phonecall','sequelize'];(function(_0x2f0831,_0x198815){var _0x4388fe=function(_0x12671c){while(--_0x12671c){_0x2f0831['push'](_0x2f0831['shift']());}};_0x4388fe(++_0x198815);}(_0x9e34,0x12b));var _0x49e3=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9e34[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x49e3('0x0'));module[_0x49e3('0x1')]={'name':{'type':Sequelize[_0x49e3('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x49e3('0x3')]('incident',_0x49e3('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xae1f=['exports','STRING','ENUM','incident','phonecall'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0xae1f,0x14f));var _0xfae1=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0xae1f[_0x4b2251];return _0x5d22fb;};'use strict';var Sequelize=require('sequelize');module[_0xfae1('0x0')]={'name':{'type':Sequelize[_0xfae1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xfae1('0x2')](_0xfae1('0x3'),_0xfae1('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 963a523..cfaae8a 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 _0xbd4b=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','then','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','keys','intersection','find','create','body','update','destroy','getFields','findOne','Dynamics365Field','filters','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x3802f7,_0x4bfacc){var _0x1606fa=function(_0x54e624){while(--_0x54e624){_0x3802f7['push'](_0x3802f7['shift']());}};_0x1606fa(++_0x4bfacc);}(_0xbd4b,0x153));var _0xbbd4=function(_0x1ea4eb,_0x226650){_0x1ea4eb=_0x1ea4eb-0x0;var _0x402045=_0xbd4b[_0x1ea4eb];return _0x402045;};'use strict';var pdf=require(_0xbbd4('0x0'));var emlformat=require(_0xbbd4('0x1'));var rimraf=require(_0xbbd4('0x2'));var zipdir=require(_0xbbd4('0x3'));var jsonpatch=require(_0xbbd4('0x4'));var rp=require(_0xbbd4('0x5'));var moment=require('moment');var BPromise=require(_0xbbd4('0x6'));var Mustache=require(_0xbbd4('0x7'));var util=require(_0xbbd4('0x8'));var path=require(_0xbbd4('0x9'));var sox=require(_0xbbd4('0xa'));var csv=require(_0xbbd4('0xb'));var ejs=require(_0xbbd4('0xc'));var fs=require('fs');var _=require(_0xbbd4('0xd'));var squel=require(_0xbbd4('0xe'));var crypto=require(_0xbbd4('0xf'));var jsforce=require(_0xbbd4('0x10'));var deskjs=require(_0xbbd4('0x11'));var toCsv=require(_0xbbd4('0xb'));var querystring=require(_0xbbd4('0x12'));var Papa=require(_0xbbd4('0x13'));var Redis=require(_0xbbd4('0x14'));var authService=require(_0xbbd4('0x15'));var qs=require(_0xbbd4('0x16'));var as=require(_0xbbd4('0x17'));var hardwareService=require(_0xbbd4('0x18'));var logger=require('../../config/logger')(_0xbbd4('0x19'));var utils=require(_0xbbd4('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xbbd4('0x1b'));var db=require(_0xbbd4('0x1c'))['db'];var jayson=require(_0xbbd4('0x1d'));var client=jayson[_0xbbd4('0x1e')][_0xbbd4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x552791,_0x1a6e5f,_0x15fc42,_0x43c610){return new BPromise(function(_0x29c64f,_0x2ae37e){var _0x1230c4=_0x43c610||client;return _0x1230c4[_0xbbd4('0x20')](_0x552791,_0x15fc42)['then'](function(_0x3bddbf){logger['info'](_0xbbd4('0x21'),_0x1a6e5f,_0xbbd4('0x22'));logger[_0xbbd4('0x23')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1a6e5f,'request\x20sent',JSON[_0xbbd4('0x24')](_0x3bddbf));if(_0x3bddbf['error']){if(_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x26')]===0x1f4){logger[_0xbbd4('0x25')](_0xbbd4('0x21'),_0x1a6e5f,_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x27')]);return _0x2ae37e(_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x27')]);}logger[_0xbbd4('0x25')](_0xbbd4('0x21'),_0x1a6e5f,_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x27')]);return _0x29c64f(_0x3bddbf['error'][_0xbbd4('0x27')]);}else{logger[_0xbbd4('0x28')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a6e5f,_0xbbd4('0x22'));_0x29c64f(_0x3bddbf[_0xbbd4('0x29')][_0xbbd4('0x27')]);}})[_0xbbd4('0x2a')](function(_0x542781){logger[_0xbbd4('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a6e5f,_0x542781);_0x2ae37e(_0x542781);});});}function respondWithStatusCode(_0x29e093,_0x25fc97){_0x25fc97=_0x25fc97||0xcc;return function(_0xddf48b){if(_0xddf48b){return _0x29e093['sendStatus'](_0x25fc97);}return _0x29e093[_0xbbd4('0x2b')](_0x25fc97)[_0xbbd4('0x2c')]();};}function respondWithResult(_0x503b6a,_0x1b63ed){_0x1b63ed=_0x1b63ed||0xc8;return function(_0x430378){if(_0x430378){return _0x503b6a[_0xbbd4('0x2b')](_0x1b63ed)[_0xbbd4('0x2d')](_0x430378);}};}function respondWithFilteredResult(_0x8d4d5f,_0x224be7){return function(_0x266a21){if(_0x266a21){var _0x354a2e=_0x266a21[_0xbbd4('0x2e')],_0x1e7643=_0x224be7[_0xbbd4('0x2f')],_0x57ad8f=_0x224be7[_0xbbd4('0x2f')]+_0x224be7[_0xbbd4('0x30')],_0x487096;if(_0x57ad8f>=_0x354a2e){_0x57ad8f=_0x354a2e;_0x487096=0xc8;}else{_0x487096=0xce;}_0x8d4d5f[_0xbbd4('0x2b')](_0x487096);return _0x8d4d5f[_0xbbd4('0x31')](_0xbbd4('0x32'),_0x1e7643+'-'+_0x57ad8f+'/'+_0x354a2e)['json'](_0x266a21);}return null;};}function patchUpdates(_0x4e1929){return function(_0x496c56){try{jsonpatch['apply'](_0x496c56,_0x4e1929,!![]);}catch(_0x4d97ed){return BPromise[_0xbbd4('0x33')](_0x4d97ed);}return _0x496c56['save']();};}function saveUpdates(_0x45df57,_0x51ac65){return function(_0xa3e042){if(_0xa3e042){return _0xa3e042['update'](_0x45df57)['then'](function(_0x1e536d){return _0x1e536d;});}return null;};}function removeEntity(_0x236688,_0x2d3d09){return function(_0x1c47c6){if(_0x1c47c6){return _0x1c47c6['destroy']()[_0xbbd4('0x34')](function(){_0x236688[_0xbbd4('0x2b')](0xcc)[_0xbbd4('0x2c')]();});}};}function handleEntityNotFound(_0x1e5da4,_0x518882){return function(_0x2f269f){if(!_0x2f269f){_0x1e5da4['sendStatus'](0x194);}return _0x2f269f;};}function handleError(_0x167d87,_0x70bf1e){_0x70bf1e=_0x70bf1e||0x1f4;return function(_0x112b82){logger['error'](_0x112b82['stack']);if(_0x112b82[_0xbbd4('0x35')]){delete _0x112b82[_0xbbd4('0x35')];}_0x167d87[_0xbbd4('0x2b')](_0x70bf1e)[_0xbbd4('0x36')](_0x112b82);};}exports[_0xbbd4('0x37')]=function(_0x215b07,_0x31aeb0){var _0x48d4d0={},_0x5883ee={},_0x5ac78a={'count':0x0,'rows':[]};var _0x176936=_[_0xbbd4('0x38')](db[_0xbbd4('0x39')][_0xbbd4('0x3a')],function(_0x23405d){return{'name':_0x23405d['fieldName'],'type':_0x23405d[_0xbbd4('0x3b')][_0xbbd4('0x3c')]};});_0x5883ee[_0xbbd4('0x3d')]=_[_0xbbd4('0x38')](_0x176936,_0xbbd4('0x35'));_0x5883ee[_0xbbd4('0x3e')]=_['keys'](_0x215b07[_0xbbd4('0x3e')]);_0x5883ee['filters']=_['intersection'](_0x5883ee[_0xbbd4('0x3d')],_0x5883ee['query']);_0x48d4d0['attributes']=_['intersection'](_0x5883ee['model'],qs[_0xbbd4('0x3f')](_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x3f')]));_0x48d4d0[_0xbbd4('0x40')]=_0x48d4d0[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0x48d4d0[_0xbbd4('0x40')]:_0x5883ee[_0xbbd4('0x3d')];if(!_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x42')](_0xbbd4('0x43'))){_0x48d4d0[_0xbbd4('0x30')]=qs[_0xbbd4('0x30')](_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x30')]);_0x48d4d0[_0xbbd4('0x2f')]=qs[_0xbbd4('0x2f')](_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x2f')]);}_0x48d4d0[_0xbbd4('0x44')]=qs[_0xbbd4('0x45')](_0x215b07['query'][_0xbbd4('0x45')]);_0x48d4d0['where']=qs['filters'](_[_0xbbd4('0x46')](_0x215b07[_0xbbd4('0x3e')],_0x5883ee['filters']),_0x176936);if(_0x215b07['query'][_0xbbd4('0x47')]){_0x48d4d0[_0xbbd4('0x48')]=_['merge'](_0x48d4d0[_0xbbd4('0x48')],{'$or':_['map'](_0x176936,function(_0x3e0dd5){if(_0x3e0dd5[_0xbbd4('0x3b')]!==_0xbbd4('0x49')){var _0x1f0b0a={};_0x1f0b0a[_0x3e0dd5[_0xbbd4('0x35')]]={'$like':'%'+_0x215b07[_0xbbd4('0x3e')]['filter']+'%'};return _0x1f0b0a;}})});}_0x48d4d0=_[_0xbbd4('0x4a')]({},_0x48d4d0,_0x215b07[_0xbbd4('0x4b')]);var _0x488c36={'where':_0x48d4d0['where']};return db['Dynamics365Configuration'][_0xbbd4('0x2e')](_0x488c36)[_0xbbd4('0x34')](function(_0x6d45c3){_0x5ac78a[_0xbbd4('0x2e')]=_0x6d45c3;if(_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x4c')]){_0x48d4d0[_0xbbd4('0x4d')]=[{'all':!![]}];}return db[_0xbbd4('0x39')]['findAll'](_0x48d4d0);})[_0xbbd4('0x34')](function(_0xbbef11){_0x5ac78a['rows']=_0xbbef11;return _0x5ac78a;})[_0xbbd4('0x34')](respondWithFilteredResult(_0x31aeb0,_0x48d4d0))[_0xbbd4('0x2a')](handleError(_0x31aeb0,null));};exports[_0xbbd4('0x4e')]=function(_0x2a8cac,_0x95f9b1){var _0x18f50f={'raw':![],'where':{'id':_0x2a8cac[_0xbbd4('0x4f')]['id']}},_0x1e6254={};_0x1e6254[_0xbbd4('0x3d')]=_[_0xbbd4('0x50')](db['Dynamics365Configuration'][_0xbbd4('0x3a')]);_0x1e6254[_0xbbd4('0x3e')]=_[_0xbbd4('0x50')](_0x2a8cac[_0xbbd4('0x3e')]);_0x1e6254['filters']=_[_0xbbd4('0x51')](_0x1e6254[_0xbbd4('0x3d')],_0x1e6254[_0xbbd4('0x3e')]);_0x18f50f[_0xbbd4('0x40')]=_[_0xbbd4('0x51')](_0x1e6254['model'],qs[_0xbbd4('0x3f')](_0x2a8cac[_0xbbd4('0x3e')]['fields']));_0x18f50f[_0xbbd4('0x40')]=_0x18f50f[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0x18f50f[_0xbbd4('0x40')]:_0x1e6254['model'];if(_0x2a8cac['query'][_0xbbd4('0x4c')]){_0x18f50f[_0xbbd4('0x4d')]=[{'all':!![]}];}_0x18f50f=_[_0xbbd4('0x4a')]({},_0x18f50f,_0x2a8cac['options']);return db[_0xbbd4('0x39')][_0xbbd4('0x52')](_0x18f50f)[_0xbbd4('0x34')](handleEntityNotFound(_0x95f9b1,null))['then'](respondWithResult(_0x95f9b1,null))[_0xbbd4('0x2a')](handleError(_0x95f9b1,null));};exports[_0xbbd4('0x53')]=function(_0x493e91,_0x26834e){return db[_0xbbd4('0x39')][_0xbbd4('0x53')](_0x493e91[_0xbbd4('0x54')],{})[_0xbbd4('0x34')](respondWithResult(_0x26834e,0xc9))[_0xbbd4('0x2a')](handleError(_0x26834e,null));};exports[_0xbbd4('0x55')]=function(_0x23560d,_0x3c25f0){if(_0x23560d['body']['id']){delete _0x23560d[_0xbbd4('0x54')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x23560d[_0xbbd4('0x4f')]['id']}})[_0xbbd4('0x34')](handleEntityNotFound(_0x3c25f0,null))[_0xbbd4('0x34')](saveUpdates(_0x23560d['body'],null))[_0xbbd4('0x34')](respondWithResult(_0x3c25f0,null))[_0xbbd4('0x2a')](handleError(_0x3c25f0,null));};exports[_0xbbd4('0x56')]=function(_0x4beec7,_0x74e18a){return db[_0xbbd4('0x39')][_0xbbd4('0x52')]({'where':{'id':_0x4beec7['params']['id']}})[_0xbbd4('0x34')](handleEntityNotFound(_0x74e18a,null))['then'](removeEntity(_0x74e18a,null))[_0xbbd4('0x2a')](handleError(_0x74e18a,null));};exports[_0xbbd4('0x57')]=function(_0xb36c67,_0x198c08,_0x18a32f){var _0xbf4e5b={};var _0x1225dd={};var _0x5450a9;var _0x41f71e;return db[_0xbbd4('0x39')][_0xbbd4('0x58')]({'where':{'id':_0xb36c67[_0xbbd4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x198c08,null))['then'](function(_0x489797){if(_0x489797){_0x5450a9=_0x489797;_0x1225dd['model']=_['keys'](db[_0xbbd4('0x59')][_0xbbd4('0x3a')]);_0x1225dd['query']=_[_0xbbd4('0x50')](_0xb36c67[_0xbbd4('0x3e')]);_0x1225dd[_0xbbd4('0x5a')]=_[_0xbbd4('0x51')](_0x1225dd['model'],_0x1225dd[_0xbbd4('0x3e')]);_0xbf4e5b['attributes']=_[_0xbbd4('0x51')](_0x1225dd[_0xbbd4('0x3d')],qs[_0xbbd4('0x3f')](_0xb36c67['query'][_0xbbd4('0x3f')]));_0xbf4e5b['attributes']=_0xbf4e5b[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0xbf4e5b[_0xbbd4('0x40')]:_0x1225dd[_0xbbd4('0x3d')];_0xbf4e5b[_0xbbd4('0x44')]=qs['sort'](_0xb36c67['query']['sort']);_0xbf4e5b[_0xbbd4('0x48')]=qs[_0xbbd4('0x5a')](_[_0xbbd4('0x46')](_0xb36c67[_0xbbd4('0x3e')],_0x1225dd['filters']));if(_0xb36c67[_0xbbd4('0x3e')][_0xbbd4('0x47')]){_0xbf4e5b[_0xbbd4('0x48')]=_[_0xbbd4('0x4a')](_0xbf4e5b[_0xbbd4('0x48')],{'$or':_[_0xbbd4('0x38')](_0xbf4e5b[_0xbbd4('0x40')],function(_0x1ef733){var _0x6eb9f2={};_0x6eb9f2[_0x1ef733]={'$like':'%'+_0xb36c67[_0xbbd4('0x3e')][_0xbbd4('0x47')]+'%'};return _0x6eb9f2;})});}_0xbf4e5b=_['merge']({},_0xbf4e5b,_0xb36c67[_0xbbd4('0x4b')]);return _0x5450a9[_0xbbd4('0x57')](_0xbf4e5b);}})['then'](function(_0x56c882){if(_0x56c882){_0x41f71e=_0x56c882[_0xbbd4('0x41')];if(!_0xb36c67[_0xbbd4('0x3e')]['hasOwnProperty'](_0xbbd4('0x43'))){_0xbf4e5b[_0xbbd4('0x30')]=qs[_0xbbd4('0x30')](_0xb36c67[_0xbbd4('0x3e')][_0xbbd4('0x30')]);_0xbf4e5b[_0xbbd4('0x2f')]=qs[_0xbbd4('0x2f')](_0xb36c67['query'][_0xbbd4('0x2f')]);}return _0x5450a9['getFields'](_0xbf4e5b);}})[_0xbbd4('0x34')](function(_0x1f3b23){if(_0x1f3b23){return _0x1f3b23?{'count':_0x41f71e,'rows':_0x1f3b23}:null;}})[_0xbbd4('0x34')](respondWithResult(_0x198c08,null))[_0xbbd4('0x2a')](handleError(_0x198c08,null));};exports[_0xbbd4('0x5b')]=function(_0x431582,_0x27d3d5,_0x4581d4){var _0x3489cc={};var _0x143787={};var _0x309ab5;var _0x58fe70;return db[_0xbbd4('0x39')][_0xbbd4('0x58')]({'where':{'id':_0x431582['params']['id']}})['then'](handleEntityNotFound(_0x27d3d5,null))[_0xbbd4('0x34')](function(_0x13ead0){if(_0x13ead0){_0x309ab5=_0x13ead0;_0x143787['model']=_[_0xbbd4('0x50')](db[_0xbbd4('0x59')][_0xbbd4('0x3a')]);_0x143787[_0xbbd4('0x3e')]=_[_0xbbd4('0x50')](_0x431582[_0xbbd4('0x3e')]);_0x143787[_0xbbd4('0x5a')]=_[_0xbbd4('0x51')](_0x143787[_0xbbd4('0x3d')],_0x143787['query']);_0x3489cc[_0xbbd4('0x40')]=_[_0xbbd4('0x51')](_0x143787['model'],qs[_0xbbd4('0x3f')](_0x431582['query']['fields']));_0x3489cc[_0xbbd4('0x40')]=_0x3489cc[_0xbbd4('0x40')]['length']?_0x3489cc[_0xbbd4('0x40')]:_0x143787[_0xbbd4('0x3d')];_0x3489cc[_0xbbd4('0x44')]=qs[_0xbbd4('0x45')](_0x431582[_0xbbd4('0x3e')]['sort']);_0x3489cc[_0xbbd4('0x48')]=qs[_0xbbd4('0x5a')](_['pick'](_0x431582['query'],_0x143787[_0xbbd4('0x5a')]));if(_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x47')]){_0x3489cc[_0xbbd4('0x48')]=_[_0xbbd4('0x4a')](_0x3489cc[_0xbbd4('0x48')],{'$or':_[_0xbbd4('0x38')](_0x3489cc['attributes'],function(_0x14137f){var _0x91ac07={};_0x91ac07[_0x14137f]={'$like':'%'+_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x47')]+'%'};return _0x91ac07;})});}_0x3489cc=_[_0xbbd4('0x4a')]({},_0x3489cc,_0x431582['options']);return _0x309ab5[_0xbbd4('0x5b')](_0x3489cc);}})['then'](function(_0x280159){if(_0x280159){_0x58fe70=_0x280159[_0xbbd4('0x41')];if(!_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x42')](_0xbbd4('0x43'))){_0x3489cc['limit']=qs['limit'](_0x431582['query'][_0xbbd4('0x30')]);_0x3489cc[_0xbbd4('0x2f')]=qs['offset'](_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x2f')]);}return _0x309ab5['getSubjects'](_0x3489cc);}})[_0xbbd4('0x34')](function(_0x5c9e24){if(_0x5c9e24){return _0x5c9e24?{'count':_0x58fe70,'rows':_0x5c9e24}:null;}})[_0xbbd4('0x34')](respondWithResult(_0x27d3d5,null))[_0xbbd4('0x2a')](handleError(_0x27d3d5,null));};exports[_0xbbd4('0x5c')]=function(_0x7a49cc,_0x4cc0c1,_0x4388a8){var _0x1bd4e2={};var _0x5cca0f={};var _0x47d4;var _0x247d8f;return db[_0xbbd4('0x39')][_0xbbd4('0x58')]({'where':{'id':_0x7a49cc[_0xbbd4('0x4f')]['id']}})[_0xbbd4('0x34')](handleEntityNotFound(_0x4cc0c1,null))[_0xbbd4('0x34')](function(_0x3aef2c){if(_0x3aef2c){_0x47d4=_0x3aef2c;_0x5cca0f[_0xbbd4('0x3d')]=_[_0xbbd4('0x50')](db['Dynamics365Field']['rawAttributes']);_0x5cca0f[_0xbbd4('0x3e')]=_[_0xbbd4('0x50')](_0x7a49cc['query']);_0x5cca0f[_0xbbd4('0x5a')]=_[_0xbbd4('0x51')](_0x5cca0f['model'],_0x5cca0f[_0xbbd4('0x3e')]);_0x1bd4e2[_0xbbd4('0x40')]=_[_0xbbd4('0x51')](_0x5cca0f['model'],qs[_0xbbd4('0x3f')](_0x7a49cc[_0xbbd4('0x3e')]['fields']));_0x1bd4e2['attributes']=_0x1bd4e2[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0x1bd4e2[_0xbbd4('0x40')]:_0x5cca0f['model'];_0x1bd4e2[_0xbbd4('0x44')]=qs['sort'](_0x7a49cc[_0xbbd4('0x3e')]['sort']);_0x1bd4e2[_0xbbd4('0x48')]=qs[_0xbbd4('0x5a')](_['pick'](_0x7a49cc[_0xbbd4('0x3e')],_0x5cca0f[_0xbbd4('0x5a')]));if(_0x7a49cc[_0xbbd4('0x3e')][_0xbbd4('0x47')]){_0x1bd4e2[_0xbbd4('0x48')]=_[_0xbbd4('0x4a')](_0x1bd4e2[_0xbbd4('0x48')],{'$or':_['map'](_0x1bd4e2[_0xbbd4('0x40')],function(_0x329c4b){var _0xbf69db={};_0xbf69db[_0x329c4b]={'$like':'%'+_0x7a49cc[_0xbbd4('0x3e')]['filter']+'%'};return _0xbf69db;})});}_0x1bd4e2=_[_0xbbd4('0x4a')]({},_0x1bd4e2,_0x7a49cc['options']);return _0x47d4['getDescriptions'](_0x1bd4e2);}})['then'](function(_0x4fb860){if(_0x4fb860){_0x247d8f=_0x4fb860[_0xbbd4('0x41')];if(!_0x7a49cc[_0xbbd4('0x3e')][_0xbbd4('0x42')](_0xbbd4('0x43'))){_0x1bd4e2['limit']=qs[_0xbbd4('0x30')](_0x7a49cc['query'][_0xbbd4('0x30')]);_0x1bd4e2[_0xbbd4('0x2f')]=qs[_0xbbd4('0x2f')](_0x7a49cc[_0xbbd4('0x3e')][_0xbbd4('0x2f')]);}return _0x47d4[_0xbbd4('0x5c')](_0x1bd4e2);}})[_0xbbd4('0x34')](function(_0xb6bb3c){if(_0xb6bb3c){return _0xb6bb3c?{'count':_0x247d8f,'rows':_0xb6bb3c}:null;}})[_0xbbd4('0x34')](respondWithResult(_0x4cc0c1,null))[_0xbbd4('0x2a')](handleError(_0x4cc0c1,null));}; \ No newline at end of file +var _0xe402=['sendStatus','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','include','findAll','rows','show','params','length','find','create','body','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy'];(function(_0x44c3d5,_0x503173){var _0x554542=function(_0x260a21){while(--_0x260a21){_0x44c3d5['push'](_0x44c3d5['shift']());}};_0x554542(++_0x503173);}(_0xe402,0x85));var _0x2e40=function(_0x4aaed1,_0x348a38){_0x4aaed1=_0x4aaed1-0x0;var _0x3e0566=_0xe402[_0x4aaed1];return _0x3e0566;};'use strict';var pdf=require(_0x2e40('0x0'));var emlformat=require(_0x2e40('0x1'));var rimraf=require(_0x2e40('0x2'));var zipdir=require(_0x2e40('0x3'));var jsonpatch=require(_0x2e40('0x4'));var rp=require(_0x2e40('0x5'));var moment=require('moment');var BPromise=require(_0x2e40('0x6'));var Mustache=require(_0x2e40('0x7'));var util=require(_0x2e40('0x8'));var path=require(_0x2e40('0x9'));var sox=require(_0x2e40('0xa'));var csv=require(_0x2e40('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2e40('0xc'));var squel=require(_0x2e40('0xd'));var crypto=require(_0x2e40('0xe'));var jsforce=require(_0x2e40('0xf'));var deskjs=require(_0x2e40('0x10'));var toCsv=require(_0x2e40('0xb'));var querystring=require(_0x2e40('0x11'));var Papa=require(_0x2e40('0x12'));var Redis=require(_0x2e40('0x13'));var authService=require(_0x2e40('0x14'));var qs=require(_0x2e40('0x15'));var as=require(_0x2e40('0x16'));var hardwareService=require(_0x2e40('0x17'));var logger=require(_0x2e40('0x18'))(_0x2e40('0x19'));var utils=require('../../config/utils');var config=require(_0x2e40('0x1a'));var licenseUtil=require(_0x2e40('0x1b'));var db=require(_0x2e40('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2e40('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x44cac6,_0x5b57ce,_0x32b81b,_0x49263f){return new BPromise(function(_0x5ed173,_0x11e813){var _0xae48bc=_0x49263f||client;return _0xae48bc[_0x2e40('0x1e')](_0x44cac6,_0x32b81b)['then'](function(_0x119a2d){logger[_0x2e40('0x1f')](_0x2e40('0x20'),_0x5b57ce,_0x2e40('0x21'));logger[_0x2e40('0x22')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5b57ce,_0x2e40('0x21'),JSON[_0x2e40('0x23')](_0x119a2d));if(_0x119a2d[_0x2e40('0x24')]){if(_0x119a2d[_0x2e40('0x24')][_0x2e40('0x25')]===0x1f4){logger[_0x2e40('0x24')](_0x2e40('0x20'),_0x5b57ce,_0x119a2d[_0x2e40('0x24')]['message']);return _0x11e813(_0x119a2d['error'][_0x2e40('0x26')]);}logger[_0x2e40('0x24')](_0x2e40('0x20'),_0x5b57ce,_0x119a2d[_0x2e40('0x24')]['message']);return _0x5ed173(_0x119a2d[_0x2e40('0x24')][_0x2e40('0x26')]);}else{logger[_0x2e40('0x1f')](_0x2e40('0x20'),_0x5b57ce,'request\x20sent');_0x5ed173(_0x119a2d[_0x2e40('0x27')][_0x2e40('0x26')]);}})[_0x2e40('0x28')](function(_0x5d09fe){logger[_0x2e40('0x24')](_0x2e40('0x20'),_0x5b57ce,_0x5d09fe);_0x11e813(_0x5d09fe);});});}function respondWithStatusCode(_0x49a45c,_0x5f0047){_0x5f0047=_0x5f0047||0xcc;return function(_0x4f119e){if(_0x4f119e){return _0x49a45c['sendStatus'](_0x5f0047);}return _0x49a45c[_0x2e40('0x29')](_0x5f0047)['end']();};}function respondWithResult(_0x4eb128,_0x1f7145){_0x1f7145=_0x1f7145||0xc8;return function(_0xe6a734){if(_0xe6a734){return _0x4eb128['status'](_0x1f7145)[_0x2e40('0x2a')](_0xe6a734);}};}function respondWithFilteredResult(_0x3731ff,_0x304674){return function(_0x2baf48){if(_0x2baf48){var _0x488237=_0x2baf48[_0x2e40('0x2b')],_0x19f011=_0x304674[_0x2e40('0x2c')],_0x4067d6=_0x304674[_0x2e40('0x2c')]+_0x304674[_0x2e40('0x2d')],_0x1f4dcd;if(_0x4067d6>=_0x488237){_0x4067d6=_0x488237;_0x1f4dcd=0xc8;}else{_0x1f4dcd=0xce;}_0x3731ff['status'](_0x1f4dcd);return _0x3731ff[_0x2e40('0x2e')](_0x2e40('0x2f'),_0x19f011+'-'+_0x4067d6+'/'+_0x488237)[_0x2e40('0x2a')](_0x2baf48);}return null;};}function patchUpdates(_0x33a04e){return function(_0x5e0005){try{jsonpatch['apply'](_0x5e0005,_0x33a04e,!![]);}catch(_0x2a280a){return BPromise[_0x2e40('0x30')](_0x2a280a);}return _0x5e0005[_0x2e40('0x31')]();};}function saveUpdates(_0x6ffd02,_0x12e3d7){return function(_0x2998a5){if(_0x2998a5){return _0x2998a5[_0x2e40('0x32')](_0x6ffd02)[_0x2e40('0x33')](function(_0x1314dc){return _0x1314dc;});}return null;};}function removeEntity(_0x36a54d,_0x13b4e9){return function(_0x330be8){if(_0x330be8){return _0x330be8[_0x2e40('0x34')]()[_0x2e40('0x33')](function(){_0x36a54d[_0x2e40('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb8d0,_0x52b166){return function(_0x65ee5c){if(!_0x65ee5c){_0x5eb8d0[_0x2e40('0x35')](0x194);}return _0x65ee5c;};}function handleError(_0x2c615c,_0x130cf0){_0x130cf0=_0x130cf0||0x1f4;return function(_0x5f273f){logger['error'](_0x5f273f[_0x2e40('0x36')]);if(_0x5f273f[_0x2e40('0x37')]){delete _0x5f273f['name'];}_0x2c615c['status'](_0x130cf0)['send'](_0x5f273f);};}exports[_0x2e40('0x38')]=function(_0x18c154,_0x37bb08){var _0x38a078={},_0x23023b={},_0x3ff057={'count':0x0,'rows':[]};var _0x487a90=_[_0x2e40('0x39')](db[_0x2e40('0x3a')][_0x2e40('0x3b')],function(_0x183430){return{'name':_0x183430[_0x2e40('0x3c')],'type':_0x183430['type'][_0x2e40('0x3d')]};});_0x23023b['model']=_[_0x2e40('0x39')](_0x487a90,_0x2e40('0x37'));_0x23023b[_0x2e40('0x3e')]=_[_0x2e40('0x3f')](_0x18c154[_0x2e40('0x3e')]);_0x23023b[_0x2e40('0x40')]=_[_0x2e40('0x41')](_0x23023b['model'],_0x23023b[_0x2e40('0x3e')]);_0x38a078[_0x2e40('0x42')]=_[_0x2e40('0x41')](_0x23023b[_0x2e40('0x43')],qs[_0x2e40('0x44')](_0x18c154[_0x2e40('0x3e')][_0x2e40('0x44')]));_0x38a078[_0x2e40('0x42')]=_0x38a078['attributes']['length']?_0x38a078['attributes']:_0x23023b[_0x2e40('0x43')];if(!_0x18c154[_0x2e40('0x3e')][_0x2e40('0x45')](_0x2e40('0x46'))){_0x38a078[_0x2e40('0x2d')]=qs[_0x2e40('0x2d')](_0x18c154['query'][_0x2e40('0x2d')]);_0x38a078[_0x2e40('0x2c')]=qs[_0x2e40('0x2c')](_0x18c154['query'][_0x2e40('0x2c')]);}_0x38a078[_0x2e40('0x47')]=qs['sort'](_0x18c154[_0x2e40('0x3e')][_0x2e40('0x48')]);_0x38a078['where']=qs['filters'](_['pick'](_0x18c154[_0x2e40('0x3e')],_0x23023b['filters']),_0x487a90);if(_0x18c154[_0x2e40('0x3e')][_0x2e40('0x49')]){_0x38a078['where']=_[_0x2e40('0x4a')](_0x38a078[_0x2e40('0x4b')],{'$or':_['map'](_0x487a90,function(_0x3c859){if(_0x3c859['type']!=='VIRTUAL'){var _0x2b0b62={};_0x2b0b62[_0x3c859[_0x2e40('0x37')]]={'$like':'%'+_0x18c154[_0x2e40('0x3e')][_0x2e40('0x49')]+'%'};return _0x2b0b62;}})});}_0x38a078=_[_0x2e40('0x4a')]({},_0x38a078,_0x18c154[_0x2e40('0x4c')]);var _0x41897b={'where':_0x38a078[_0x2e40('0x4b')]};return db[_0x2e40('0x3a')]['count'](_0x41897b)['then'](function(_0x4f668b){_0x3ff057[_0x2e40('0x2b')]=_0x4f668b;if(_0x18c154['query'][_0x2e40('0x4d')]){_0x38a078[_0x2e40('0x4e')]=[{'all':!![]}];}return db[_0x2e40('0x3a')][_0x2e40('0x4f')](_0x38a078);})[_0x2e40('0x33')](function(_0x402377){_0x3ff057[_0x2e40('0x50')]=_0x402377;return _0x3ff057;})[_0x2e40('0x33')](respondWithFilteredResult(_0x37bb08,_0x38a078))[_0x2e40('0x28')](handleError(_0x37bb08,null));};exports[_0x2e40('0x51')]=function(_0x5f1457,_0x1fce7e){var _0x14bd86={'raw':![],'where':{'id':_0x5f1457[_0x2e40('0x52')]['id']}},_0x283aa4={};_0x283aa4[_0x2e40('0x43')]=_[_0x2e40('0x3f')](db[_0x2e40('0x3a')][_0x2e40('0x3b')]);_0x283aa4[_0x2e40('0x3e')]=_['keys'](_0x5f1457[_0x2e40('0x3e')]);_0x283aa4[_0x2e40('0x40')]=_[_0x2e40('0x41')](_0x283aa4['model'],_0x283aa4[_0x2e40('0x3e')]);_0x14bd86[_0x2e40('0x42')]=_[_0x2e40('0x41')](_0x283aa4['model'],qs[_0x2e40('0x44')](_0x5f1457[_0x2e40('0x3e')]['fields']));_0x14bd86[_0x2e40('0x42')]=_0x14bd86['attributes'][_0x2e40('0x53')]?_0x14bd86[_0x2e40('0x42')]:_0x283aa4[_0x2e40('0x43')];if(_0x5f1457[_0x2e40('0x3e')][_0x2e40('0x4d')]){_0x14bd86[_0x2e40('0x4e')]=[{'all':!![]}];}_0x14bd86=_[_0x2e40('0x4a')]({},_0x14bd86,_0x5f1457[_0x2e40('0x4c')]);return db['Dynamics365Configuration'][_0x2e40('0x54')](_0x14bd86)[_0x2e40('0x33')](handleEntityNotFound(_0x1fce7e,null))['then'](respondWithResult(_0x1fce7e,null))[_0x2e40('0x28')](handleError(_0x1fce7e,null));};exports['create']=function(_0x3b5b7a,_0x439683){return db['Dynamics365Configuration'][_0x2e40('0x55')](_0x3b5b7a[_0x2e40('0x56')],{})[_0x2e40('0x33')](respondWithResult(_0x439683,0xc9))[_0x2e40('0x28')](handleError(_0x439683,null));};exports[_0x2e40('0x32')]=function(_0x5d9a72,_0x25906a){if(_0x5d9a72['body']['id']){delete _0x5d9a72[_0x2e40('0x56')]['id'];}return db[_0x2e40('0x3a')]['find']({'where':{'id':_0x5d9a72[_0x2e40('0x52')]['id']}})['then'](handleEntityNotFound(_0x25906a,null))[_0x2e40('0x33')](saveUpdates(_0x5d9a72['body'],null))[_0x2e40('0x33')](respondWithResult(_0x25906a,null))[_0x2e40('0x28')](handleError(_0x25906a,null));};exports['destroy']=function(_0xbbdda6,_0x5b068f){return db[_0x2e40('0x3a')]['find']({'where':{'id':_0xbbdda6[_0x2e40('0x52')]['id']}})[_0x2e40('0x33')](handleEntityNotFound(_0x5b068f,null))[_0x2e40('0x33')](removeEntity(_0x5b068f,null))['catch'](handleError(_0x5b068f,null));};exports[_0x2e40('0x57')]=function(_0x4c4e6b,_0x1341b0,_0x317f2c){var _0x1e4820={};var _0x263d9a={};var _0x4785dd;var _0x9dee19;return db[_0x2e40('0x3a')][_0x2e40('0x58')]({'where':{'id':_0x4c4e6b[_0x2e40('0x52')]['id']}})['then'](handleEntityNotFound(_0x1341b0,null))[_0x2e40('0x33')](function(_0x421ab9){if(_0x421ab9){_0x4785dd=_0x421ab9;_0x263d9a[_0x2e40('0x43')]=_[_0x2e40('0x3f')](db[_0x2e40('0x59')][_0x2e40('0x3b')]);_0x263d9a[_0x2e40('0x3e')]=_[_0x2e40('0x3f')](_0x4c4e6b[_0x2e40('0x3e')]);_0x263d9a[_0x2e40('0x40')]=_['intersection'](_0x263d9a['model'],_0x263d9a[_0x2e40('0x3e')]);_0x1e4820['attributes']=_[_0x2e40('0x41')](_0x263d9a[_0x2e40('0x43')],qs['fields'](_0x4c4e6b['query'][_0x2e40('0x44')]));_0x1e4820[_0x2e40('0x42')]=_0x1e4820['attributes'][_0x2e40('0x53')]?_0x1e4820[_0x2e40('0x42')]:_0x263d9a[_0x2e40('0x43')];_0x1e4820[_0x2e40('0x47')]=qs['sort'](_0x4c4e6b[_0x2e40('0x3e')]['sort']);_0x1e4820[_0x2e40('0x4b')]=qs[_0x2e40('0x40')](_[_0x2e40('0x5a')](_0x4c4e6b[_0x2e40('0x3e')],_0x263d9a[_0x2e40('0x40')]));if(_0x4c4e6b[_0x2e40('0x3e')][_0x2e40('0x49')]){_0x1e4820[_0x2e40('0x4b')]=_['merge'](_0x1e4820[_0x2e40('0x4b')],{'$or':_['map'](_0x1e4820[_0x2e40('0x42')],function(_0x4d8947){var _0x8fe90={};_0x8fe90[_0x4d8947]={'$like':'%'+_0x4c4e6b[_0x2e40('0x3e')]['filter']+'%'};return _0x8fe90;})});}_0x1e4820=_[_0x2e40('0x4a')]({},_0x1e4820,_0x4c4e6b[_0x2e40('0x4c')]);return _0x4785dd[_0x2e40('0x57')](_0x1e4820);}})['then'](function(_0x3576c2){if(_0x3576c2){_0x9dee19=_0x3576c2[_0x2e40('0x53')];if(!_0x4c4e6b[_0x2e40('0x3e')][_0x2e40('0x45')](_0x2e40('0x46'))){_0x1e4820[_0x2e40('0x2d')]=qs[_0x2e40('0x2d')](_0x4c4e6b[_0x2e40('0x3e')][_0x2e40('0x2d')]);_0x1e4820[_0x2e40('0x2c')]=qs[_0x2e40('0x2c')](_0x4c4e6b[_0x2e40('0x3e')][_0x2e40('0x2c')]);}return _0x4785dd[_0x2e40('0x57')](_0x1e4820);}})[_0x2e40('0x33')](function(_0x39435b){if(_0x39435b){return _0x39435b?{'count':_0x9dee19,'rows':_0x39435b}:null;}})['then'](respondWithResult(_0x1341b0,null))[_0x2e40('0x28')](handleError(_0x1341b0,null));};exports[_0x2e40('0x5b')]=function(_0x5e24f4,_0x2314e2,_0x3d5e54){var _0x21036e={};var _0x3cee35={};var _0x1cac8b;var _0x332c5b;return db['Dynamics365Configuration'][_0x2e40('0x58')]({'where':{'id':_0x5e24f4[_0x2e40('0x52')]['id']}})[_0x2e40('0x33')](handleEntityNotFound(_0x2314e2,null))[_0x2e40('0x33')](function(_0x51edc8){if(_0x51edc8){_0x1cac8b=_0x51edc8;_0x3cee35[_0x2e40('0x43')]=_[_0x2e40('0x3f')](db['Dynamics365Field'][_0x2e40('0x3b')]);_0x3cee35['query']=_[_0x2e40('0x3f')](_0x5e24f4[_0x2e40('0x3e')]);_0x3cee35['filters']=_[_0x2e40('0x41')](_0x3cee35[_0x2e40('0x43')],_0x3cee35['query']);_0x21036e['attributes']=_[_0x2e40('0x41')](_0x3cee35[_0x2e40('0x43')],qs[_0x2e40('0x44')](_0x5e24f4[_0x2e40('0x3e')]['fields']));_0x21036e['attributes']=_0x21036e[_0x2e40('0x42')]['length']?_0x21036e['attributes']:_0x3cee35[_0x2e40('0x43')];_0x21036e[_0x2e40('0x47')]=qs['sort'](_0x5e24f4['query'][_0x2e40('0x48')]);_0x21036e[_0x2e40('0x4b')]=qs[_0x2e40('0x40')](_[_0x2e40('0x5a')](_0x5e24f4[_0x2e40('0x3e')],_0x3cee35[_0x2e40('0x40')]));if(_0x5e24f4[_0x2e40('0x3e')][_0x2e40('0x49')]){_0x21036e[_0x2e40('0x4b')]=_['merge'](_0x21036e[_0x2e40('0x4b')],{'$or':_['map'](_0x21036e[_0x2e40('0x42')],function(_0x316b3e){var _0x162486={};_0x162486[_0x316b3e]={'$like':'%'+_0x5e24f4['query'][_0x2e40('0x49')]+'%'};return _0x162486;})});}_0x21036e=_['merge']({},_0x21036e,_0x5e24f4[_0x2e40('0x4c')]);return _0x1cac8b[_0x2e40('0x5b')](_0x21036e);}})[_0x2e40('0x33')](function(_0x35072b){if(_0x35072b){_0x332c5b=_0x35072b[_0x2e40('0x53')];if(!_0x5e24f4[_0x2e40('0x3e')]['hasOwnProperty'](_0x2e40('0x46'))){_0x21036e[_0x2e40('0x2d')]=qs['limit'](_0x5e24f4[_0x2e40('0x3e')][_0x2e40('0x2d')]);_0x21036e[_0x2e40('0x2c')]=qs[_0x2e40('0x2c')](_0x5e24f4[_0x2e40('0x3e')]['offset']);}return _0x1cac8b[_0x2e40('0x5b')](_0x21036e);}})[_0x2e40('0x33')](function(_0x4910fe){if(_0x4910fe){return _0x4910fe?{'count':_0x332c5b,'rows':_0x4910fe}:null;}})[_0x2e40('0x33')](respondWithResult(_0x2314e2,null))[_0x2e40('0x28')](handleError(_0x2314e2,null));};exports[_0x2e40('0x5c')]=function(_0x269dde,_0x24d456,_0x5b3d12){var _0x40e804={};var _0x10df50={};var _0x12736c;var _0xf1dc48;return db[_0x2e40('0x3a')]['findOne']({'where':{'id':_0x269dde[_0x2e40('0x52')]['id']}})['then'](handleEntityNotFound(_0x24d456,null))[_0x2e40('0x33')](function(_0x38b7fd){if(_0x38b7fd){_0x12736c=_0x38b7fd;_0x10df50[_0x2e40('0x43')]=_[_0x2e40('0x3f')](db[_0x2e40('0x59')][_0x2e40('0x3b')]);_0x10df50[_0x2e40('0x3e')]=_[_0x2e40('0x3f')](_0x269dde['query']);_0x10df50[_0x2e40('0x40')]=_[_0x2e40('0x41')](_0x10df50[_0x2e40('0x43')],_0x10df50[_0x2e40('0x3e')]);_0x40e804[_0x2e40('0x42')]=_[_0x2e40('0x41')](_0x10df50[_0x2e40('0x43')],qs[_0x2e40('0x44')](_0x269dde[_0x2e40('0x3e')]['fields']));_0x40e804['attributes']=_0x40e804[_0x2e40('0x42')][_0x2e40('0x53')]?_0x40e804['attributes']:_0x10df50[_0x2e40('0x43')];_0x40e804['order']=qs[_0x2e40('0x48')](_0x269dde[_0x2e40('0x3e')][_0x2e40('0x48')]);_0x40e804[_0x2e40('0x4b')]=qs[_0x2e40('0x40')](_['pick'](_0x269dde[_0x2e40('0x3e')],_0x10df50[_0x2e40('0x40')]));if(_0x269dde[_0x2e40('0x3e')][_0x2e40('0x49')]){_0x40e804[_0x2e40('0x4b')]=_[_0x2e40('0x4a')](_0x40e804['where'],{'$or':_[_0x2e40('0x39')](_0x40e804[_0x2e40('0x42')],function(_0x465b53){var _0x57e996={};_0x57e996[_0x465b53]={'$like':'%'+_0x269dde[_0x2e40('0x3e')][_0x2e40('0x49')]+'%'};return _0x57e996;})});}_0x40e804=_['merge']({},_0x40e804,_0x269dde[_0x2e40('0x4c')]);return _0x12736c[_0x2e40('0x5c')](_0x40e804);}})['then'](function(_0x5ea269){if(_0x5ea269){_0xf1dc48=_0x5ea269[_0x2e40('0x53')];if(!_0x269dde[_0x2e40('0x3e')][_0x2e40('0x45')](_0x2e40('0x46'))){_0x40e804[_0x2e40('0x2d')]=qs[_0x2e40('0x2d')](_0x269dde['query'][_0x2e40('0x2d')]);_0x40e804[_0x2e40('0x2c')]=qs[_0x2e40('0x2c')](_0x269dde[_0x2e40('0x3e')][_0x2e40('0x2c')]);}return _0x12736c[_0x2e40('0x5c')](_0x40e804);}})[_0x2e40('0x33')](function(_0x3e122c){if(_0x3e122c){return _0x3e122c?{'count':_0xf1dc48,'rows':_0x3e122c}:null;}})[_0x2e40('0x33')](respondWithResult(_0x24d456,null))['catch'](handleError(_0x24d456,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ee915b4..2f91eff 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 _0x98f8=['define','Dynamics365Configuration','int_dynamics365_configurations','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5d622d,_0x238f23){var _0xf75eb8=function(_0x1b01f7){while(--_0x1b01f7){_0x5d622d['push'](_0x5d622d['shift']());}};_0xf75eb8(++_0x238f23);}(_0x98f8,0xe4));var _0x898f=function(_0x5138f5,_0x1aa460){_0x5138f5=_0x5138f5-0x0;var _0x2cc6bd=_0x98f8[_0x5138f5];return _0x2cc6bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x898f('0x0'));var moment=require(_0x898f('0x1'));var BPromise=require('bluebird');var rp=require(_0x898f('0x2'));var fs=require('fs');var path=require(_0x898f('0x3'));var rimraf=require(_0x898f('0x4'));var config=require(_0x898f('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x36880e,_0x33075d){return _0x36880e[_0x898f('0x6')](_0x898f('0x7'),attributes,{'tableName':_0x898f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c45=['rimraf','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3fc0af,_0x3397a3){var _0x13a433=function(_0x4b37cd){while(--_0x4b37cd){_0x3fc0af['push'](_0x3fc0af['shift']());}};_0x13a433(++_0x3397a3);}(_0x7c45,0x68));var _0x57c4=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x7c45[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x57c4('0x0'));var util=require(_0x57c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x57c4('0x2'));var BPromise=require(_0x57c4('0x3'));var rp=require(_0x57c4('0x4'));var fs=require('fs');var path=require(_0x57c4('0x5'));var rimraf=require(_0x57c4('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0x57c4('0x7')]=function(_0x2165a4,_0x1c0fe1){return _0x2165a4[_0x57c4('0x8')](_0x57c4('0x9'),attributes,{'tableName':_0x57c4('0xa'),'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 22c4cef..6b3caf4 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 _0x9e70=['error','code','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x23d2d2,_0xc460e){var _0x4a665e=function(_0x3edb20){while(--_0x3edb20){_0x23d2d2['push'](_0x23d2d2['shift']());}};_0x4a665e(++_0xc460e);}(_0x9e70,0x121));var _0x09e7=function(_0x436a19,_0x4970a5){_0x436a19=_0x436a19-0x0;var _0x2c2252=_0x9e70[_0x436a19];return _0x2c2252;};'use strict';var _=require(_0x09e7('0x0'));var util=require('util');var moment=require(_0x09e7('0x1'));var BPromise=require(_0x09e7('0x2'));var rs=require(_0x09e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x09e7('0x4'));var logger=require(_0x09e7('0x5'))('rpc');var config=require(_0x09e7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x09e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x561501,_0x1a8a84,_0x1665f0){return new BPromise(function(_0x11815b,_0x5eb576){return client[_0x09e7('0x8')](_0x561501,_0x1665f0)[_0x09e7('0x9')](function(_0x26e7e8){logger[_0x09e7('0xa')](_0x09e7('0xb'),_0x1a8a84,_0x09e7('0xc'));logger[_0x09e7('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1a8a84,_0x09e7('0xc'),JSON[_0x09e7('0xe')](_0x26e7e8));if(_0x26e7e8[_0x09e7('0xf')]){if(_0x26e7e8[_0x09e7('0xf')][_0x09e7('0x10')]===0x1f4){logger[_0x09e7('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a8a84,_0x26e7e8[_0x09e7('0xf')][_0x09e7('0x11')]);return _0x5eb576(_0x26e7e8[_0x09e7('0xf')][_0x09e7('0x11')]);}logger['error'](_0x09e7('0xb'),_0x1a8a84,_0x26e7e8['error']['message']);return _0x11815b(_0x26e7e8[_0x09e7('0xf')]['message']);}else{logger[_0x09e7('0xa')](_0x09e7('0xb'),_0x1a8a84,_0x09e7('0xc'));_0x11815b(_0x26e7e8[_0x09e7('0x12')]['message']);}})['catch'](function(_0x2b40ed){logger['error'](_0x09e7('0xb'),_0x1a8a84,_0x2b40ed);_0x5eb576(_0x2b40ed);});});} \ No newline at end of file +var _0x5da5=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x3b6269,_0x2bd418){var _0x45125c=function(_0x1c0542){while(--_0x1c0542){_0x3b6269['push'](_0x3b6269['shift']());}};_0x45125c(++_0x2bd418);}(_0x5da5,0x196));var _0x55da=function(_0x124ce5,_0x4e9ecb){_0x124ce5=_0x124ce5-0x0;var _0x2b0076=_0x5da5[_0x124ce5];return _0x2b0076;};'use strict';var _=require('lodash');var util=require(_0x55da('0x0'));var moment=require(_0x55da('0x1'));var BPromise=require('bluebird');var rs=require(_0x55da('0x2'));var fs=require('fs');var Redis=require(_0x55da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x55da('0x4'));var logger=require(_0x55da('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x55da('0x6')][_0x55da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23e177,_0x554b59,_0x4190e5){return new BPromise(function(_0x4a3e54,_0x982c59){return client[_0x55da('0x8')](_0x23e177,_0x4190e5)['then'](function(_0x1af94e){logger[_0x55da('0x9')](_0x55da('0xa'),_0x554b59,_0x55da('0xb'));logger[_0x55da('0xc')](_0x55da('0xd'),_0x554b59,_0x55da('0xb'),JSON[_0x55da('0xe')](_0x1af94e));if(_0x1af94e[_0x55da('0xf')]){if(_0x1af94e['error'][_0x55da('0x10')]===0x1f4){logger[_0x55da('0xf')](_0x55da('0xa'),_0x554b59,_0x1af94e[_0x55da('0xf')][_0x55da('0x11')]);return _0x982c59(_0x1af94e[_0x55da('0xf')]['message']);}logger[_0x55da('0xf')](_0x55da('0xa'),_0x554b59,_0x1af94e[_0x55da('0xf')][_0x55da('0x11')]);return _0x4a3e54(_0x1af94e[_0x55da('0xf')][_0x55da('0x11')]);}else{logger['info'](_0x55da('0xa'),_0x554b59,_0x55da('0xb'));_0x4a3e54(_0x1af94e[_0x55da('0x12')][_0x55da('0x11')]);}})['catch'](function(_0x5ceba4){logger[_0x55da('0xf')](_0x55da('0xa'),_0x554b59,_0x5ceba4);_0x982c59(_0x5ceba4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c1c1dc7..ddc09df 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 _0x8ce3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x2b561d,_0x41cd0e){var _0x3ddca4=function(_0xe18bb3){while(--_0xe18bb3){_0x2b561d['push'](_0x2b561d['shift']());}};_0x3ddca4(++_0x41cd0e);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3f0b15,_0xb88473){_0x3f0b15=_0x3f0b15-0x0;var _0x38f95f=_0x8ce3[_0x3f0b15];return _0x38f95f;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var auth=require(_0x38ce('0x5'));var interaction=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var controller=require(_0x38ce('0x8'));router[_0x38ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xa')]);router[_0x38ce('0x9')]('/:id',auth[_0x38ce('0xb')](),controller[_0x38ce('0xc')]);router[_0x38ce('0xd')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xe')]);router['put'](_0x38ce('0xf'),auth['isAuthenticated'](),controller[_0x38ce('0x10')]);router[_0x38ce('0x11')](_0x38ce('0xf'),auth[_0x38ce('0xb')](),controller[_0x38ce('0x12')]);module[_0x38ce('0x13')]=router; \ No newline at end of file +var _0x80df=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x24827b,_0x39fa32){var _0x4a6f3f=function(_0x5a634f){while(--_0x5a634f){_0x24827b['push'](_0x24827b['shift']());}};_0x4a6f3f(++_0x39fa32);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var path=require(_0xf80d('0x2'));var timeout=require(_0xf80d('0x3'));var express=require('express');var router=express[_0xf80d('0x4')]();var auth=require(_0xf80d('0x5'));var interaction=require(_0xf80d('0x6'));var config=require(_0xf80d('0x7'));var controller=require(_0xf80d('0x8'));router[_0xf80d('0x9')]('/',auth[_0xf80d('0xa')](),controller[_0xf80d('0xb')]);router[_0xf80d('0x9')](_0xf80d('0xc'),auth['isAuthenticated'](),controller[_0xf80d('0xd')]);router[_0xf80d('0xe')]('/',auth[_0xf80d('0xa')](),controller[_0xf80d('0xf')]);router[_0xf80d('0x10')](_0xf80d('0xc'),auth[_0xf80d('0xa')](),controller[_0xf80d('0x11')]);router[_0xf80d('0x12')](_0xf80d('0xc'),auth[_0xf80d('0xa')](),controller[_0xf80d('0x13')]);module[_0xf80d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7dcb5b0..ae3729b 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 _0x2645=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x2be0ed,_0x291f60){var _0x330eb4=function(_0x2517dc){while(--_0x2517dc){_0x2be0ed['push'](_0x2be0ed['shift']());}};_0x330eb4(++_0x291f60);}(_0x2645,0x1c1));var _0x5264=function(_0x21b0a7,_0x52d936){_0x21b0a7=_0x21b0a7-0x0;var _0x416ce3=_0x2645[_0x21b0a7];return _0x416ce3;};'use strict';var Sequelize=require('sequelize');module[_0x5264('0x0')]={'type':{'type':Sequelize[_0x5264('0x1')](_0x5264('0x2'),_0x5264('0x3'),_0x5264('0x4'),_0x5264('0x5')),'defaultValue':_0x5264('0x2')},'content':{'type':Sequelize[_0x5264('0x6')]},'key':{'type':Sequelize[_0x5264('0x6')]},'keyType':{'type':Sequelize[_0x5264('0x1')]('string',_0x5264('0x3'),_0x5264('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5264('0x6')]},'customField':{'type':Sequelize[_0x5264('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5264('0x6')]}}; \ No newline at end of file +var _0x2cca=['customVariable','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x1b7cb6,_0x16892f){var _0x39b3d0=function(_0x2b8367){while(--_0x2b8367){_0x1b7cb6['push'](_0x1b7cb6['shift']());}};_0x39b3d0(++_0x16892f);}(_0x2cca,0xa4));var _0xa2cc=function(_0x37cfee,_0x1ddc2e){_0x37cfee=_0x37cfee-0x0;var _0x1de0a1=_0x2cca[_0x37cfee];return _0x1de0a1;};'use strict';var Sequelize=require(_0xa2cc('0x0'));module['exports']={'type':{'type':Sequelize[_0xa2cc('0x1')](_0xa2cc('0x2'),_0xa2cc('0x3'),_0xa2cc('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa2cc('0x5')]},'key':{'type':Sequelize[_0xa2cc('0x5')]},'keyType':{'type':Sequelize[_0xa2cc('0x1')](_0xa2cc('0x2'),_0xa2cc('0x3'),_0xa2cc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa2cc('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa2cc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1e483b7..ebab0ff 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 _0x1c8c=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','Dynamics365Field','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1c8c,0xea));var _0xc1c8=function(_0x517e05,_0x322ae3){_0x517e05=_0x517e05-0x0;var _0x1e37a7=_0x1c8c[_0x517e05];return _0x1e37a7;};'use strict';var pdf=require(_0xc1c8('0x0'));var emlformat=require(_0xc1c8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc1c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c8('0x3'));var moment=require('moment');var BPromise=require(_0xc1c8('0x4'));var Mustache=require(_0xc1c8('0x5'));var util=require(_0xc1c8('0x6'));var path=require(_0xc1c8('0x7'));var sox=require(_0xc1c8('0x8'));var csv=require(_0xc1c8('0x9'));var ejs=require(_0xc1c8('0xa'));var fs=require('fs');var _=require(_0xc1c8('0xb'));var squel=require(_0xc1c8('0xc'));var crypto=require(_0xc1c8('0xd'));var jsforce=require(_0xc1c8('0xe'));var deskjs=require(_0xc1c8('0xf'));var toCsv=require(_0xc1c8('0x9'));var querystring=require('querystring');var Papa=require(_0xc1c8('0x10'));var Redis=require(_0xc1c8('0x11'));var authService=require(_0xc1c8('0x12'));var qs=require(_0xc1c8('0x13'));var as=require(_0xc1c8('0x14'));var hardwareService=require(_0xc1c8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc1c8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1c8('0x17'))['db'];function respondWithStatusCode(_0x4e5b28,_0x588e80){_0x588e80=_0x588e80||0xcc;return function(_0x55b6bc){if(_0x55b6bc){return _0x4e5b28[_0xc1c8('0x18')](_0x588e80);}return _0x4e5b28[_0xc1c8('0x19')](_0x588e80)[_0xc1c8('0x1a')]();};}function respondWithResult(_0x588b47,_0x3d05a3){_0x3d05a3=_0x3d05a3||0xc8;return function(_0x583dfa){if(_0x583dfa){return _0x588b47['status'](_0x3d05a3)['json'](_0x583dfa);}};}function respondWithFilteredResult(_0x2d0e85,_0x42d24d){return function(_0x4fb08a){if(_0x4fb08a){var _0x12bb84=_0x4fb08a[_0xc1c8('0x1b')],_0x5c039d=_0x42d24d[_0xc1c8('0x1c')],_0x1ab407=_0x42d24d['offset']+_0x42d24d[_0xc1c8('0x1d')],_0x47707d;if(_0x1ab407>=_0x12bb84){_0x1ab407=_0x12bb84;_0x47707d=0xc8;}else{_0x47707d=0xce;}_0x2d0e85['status'](_0x47707d);return _0x2d0e85[_0xc1c8('0x1e')](_0xc1c8('0x1f'),_0x5c039d+'-'+_0x1ab407+'/'+_0x12bb84)['json'](_0x4fb08a);}return null;};}function patchUpdates(_0x5d5c85){return function(_0x30f7f2){try{jsonpatch['apply'](_0x30f7f2,_0x5d5c85,!![]);}catch(_0x51e146){return BPromise[_0xc1c8('0x20')](_0x51e146);}return _0x30f7f2['save']();};}function saveUpdates(_0x45b639,_0xbe9c15){return function(_0x85e9c8){if(_0x85e9c8){return _0x85e9c8[_0xc1c8('0x21')](_0x45b639)[_0xc1c8('0x22')](function(_0x66c395){return _0x66c395;});}return null;};}function removeEntity(_0x2773e9,_0x51347b){return function(_0x396ffa){if(_0x396ffa){return _0x396ffa[_0xc1c8('0x23')]()[_0xc1c8('0x22')](function(){_0x2773e9[_0xc1c8('0x19')](0xcc)[_0xc1c8('0x1a')]();});}};}function handleEntityNotFound(_0x532203,_0x6ef663){return function(_0x23239f){if(!_0x23239f){_0x532203[_0xc1c8('0x18')](0x194);}return _0x23239f;};}function handleError(_0x200e71,_0x284c46){_0x284c46=_0x284c46||0x1f4;return function(_0x52ac45){logger[_0xc1c8('0x24')](_0x52ac45[_0xc1c8('0x25')]);if(_0x52ac45[_0xc1c8('0x26')]){delete _0x52ac45[_0xc1c8('0x26')];}_0x200e71[_0xc1c8('0x19')](_0x284c46)[_0xc1c8('0x27')](_0x52ac45);};}exports['index']=function(_0x4b6062,_0x179796){var _0x40ea92={},_0x2e90bd={},_0xc8f137={'count':0x0,'rows':[]};var _0x120ee2=_[_0xc1c8('0x28')](db[_0xc1c8('0x29')]['rawAttributes'],function(_0x1f87e1){return{'name':_0x1f87e1[_0xc1c8('0x2a')],'type':_0x1f87e1['type'][_0xc1c8('0x2b')]};});_0x2e90bd[_0xc1c8('0x2c')]=_[_0xc1c8('0x28')](_0x120ee2,'name');_0x2e90bd[_0xc1c8('0x2d')]=_[_0xc1c8('0x2e')](_0x4b6062['query']);_0x2e90bd[_0xc1c8('0x2f')]=_[_0xc1c8('0x30')](_0x2e90bd[_0xc1c8('0x2c')],_0x2e90bd[_0xc1c8('0x2d')]);_0x40ea92[_0xc1c8('0x31')]=_['intersection'](_0x2e90bd[_0xc1c8('0x2c')],qs[_0xc1c8('0x32')](_0x4b6062[_0xc1c8('0x2d')][_0xc1c8('0x32')]));_0x40ea92['attributes']=_0x40ea92[_0xc1c8('0x31')][_0xc1c8('0x33')]?_0x40ea92[_0xc1c8('0x31')]:_0x2e90bd[_0xc1c8('0x2c')];if(!_0x4b6062['query'][_0xc1c8('0x34')](_0xc1c8('0x35'))){_0x40ea92[_0xc1c8('0x1d')]=qs[_0xc1c8('0x1d')](_0x4b6062[_0xc1c8('0x2d')][_0xc1c8('0x1d')]);_0x40ea92[_0xc1c8('0x1c')]=qs[_0xc1c8('0x1c')](_0x4b6062['query'][_0xc1c8('0x1c')]);}_0x40ea92[_0xc1c8('0x36')]=qs[_0xc1c8('0x37')](_0x4b6062[_0xc1c8('0x2d')]['sort']);_0x40ea92[_0xc1c8('0x38')]=qs[_0xc1c8('0x2f')](_['pick'](_0x4b6062[_0xc1c8('0x2d')],_0x2e90bd[_0xc1c8('0x2f')]),_0x120ee2);if(_0x4b6062[_0xc1c8('0x2d')]['filter']){_0x40ea92[_0xc1c8('0x38')]=_[_0xc1c8('0x39')](_0x40ea92[_0xc1c8('0x38')],{'$or':_['map'](_0x120ee2,function(_0x18b234){if(_0x18b234['type']!==_0xc1c8('0x3a')){var _0x5d8e3d={};_0x5d8e3d[_0x18b234[_0xc1c8('0x26')]]={'$like':'%'+_0x4b6062['query']['filter']+'%'};return _0x5d8e3d;}})});}_0x40ea92=_['merge']({},_0x40ea92,_0x4b6062[_0xc1c8('0x3b')]);var _0x1a6b7a={'where':_0x40ea92[_0xc1c8('0x38')]};return db[_0xc1c8('0x29')][_0xc1c8('0x1b')](_0x1a6b7a)[_0xc1c8('0x22')](function(_0x3005bf){_0xc8f137[_0xc1c8('0x1b')]=_0x3005bf;if(_0x4b6062[_0xc1c8('0x2d')]['includeAll']){_0x40ea92['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xc1c8('0x3c')](_0x40ea92);})[_0xc1c8('0x22')](function(_0x3a3b7a){_0xc8f137[_0xc1c8('0x3d')]=_0x3a3b7a;return _0xc8f137;})[_0xc1c8('0x22')](respondWithFilteredResult(_0x179796,_0x40ea92))['catch'](handleError(_0x179796,null));};exports[_0xc1c8('0x3e')]=function(_0x104495,_0x32a7ed){var _0x2ca279={'raw':!![],'where':{'id':_0x104495[_0xc1c8('0x3f')]['id']}},_0x2f7eeb={};_0x2f7eeb[_0xc1c8('0x2c')]=_['keys'](db['Dynamics365Field'][_0xc1c8('0x40')]);_0x2f7eeb['query']=_[_0xc1c8('0x2e')](_0x104495[_0xc1c8('0x2d')]);_0x2f7eeb[_0xc1c8('0x2f')]=_['intersection'](_0x2f7eeb[_0xc1c8('0x2c')],_0x2f7eeb[_0xc1c8('0x2d')]);_0x2ca279[_0xc1c8('0x31')]=_['intersection'](_0x2f7eeb[_0xc1c8('0x2c')],qs[_0xc1c8('0x32')](_0x104495['query']['fields']));_0x2ca279[_0xc1c8('0x31')]=_0x2ca279[_0xc1c8('0x31')][_0xc1c8('0x33')]?_0x2ca279['attributes']:_0x2f7eeb[_0xc1c8('0x2c')];if(_0x104495[_0xc1c8('0x2d')][_0xc1c8('0x41')]){_0x2ca279[_0xc1c8('0x42')]=[{'all':!![]}];}_0x2ca279=_['merge']({},_0x2ca279,_0x104495['options']);return db['Dynamics365Field'][_0xc1c8('0x43')](_0x2ca279)[_0xc1c8('0x22')](handleEntityNotFound(_0x32a7ed,null))[_0xc1c8('0x22')](respondWithResult(_0x32a7ed,null))[_0xc1c8('0x44')](handleError(_0x32a7ed,null));};exports['create']=function(_0x290db0,_0x4d62c7){return db['Dynamics365Field'][_0xc1c8('0x45')](_0x290db0['body'],{})[_0xc1c8('0x22')](respondWithResult(_0x4d62c7,0xc9))[_0xc1c8('0x44')](handleError(_0x4d62c7,null));};exports[_0xc1c8('0x21')]=function(_0x310e88,_0x3923c0){if(_0x310e88[_0xc1c8('0x46')]['id']){delete _0x310e88['body']['id'];}return db[_0xc1c8('0x29')][_0xc1c8('0x43')]({'where':{'id':_0x310e88[_0xc1c8('0x3f')]['id']}})[_0xc1c8('0x22')](handleEntityNotFound(_0x3923c0,null))[_0xc1c8('0x22')](saveUpdates(_0x310e88['body'],null))['then'](respondWithResult(_0x3923c0,null))['catch'](handleError(_0x3923c0,null));};exports[_0xc1c8('0x23')]=function(_0x2ffd8e,_0x4eed3e){return db[_0xc1c8('0x29')][_0xc1c8('0x43')]({'where':{'id':_0x2ffd8e[_0xc1c8('0x3f')]['id']}})[_0xc1c8('0x22')](handleEntityNotFound(_0x4eed3e,null))[_0xc1c8('0x22')](removeEntity(_0x4eed3e,null))[_0xc1c8('0x44')](handleError(_0x4eed3e,null));}; \ No newline at end of file +var _0xdab6=['update','destroy','then','error','stack','name','send','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x1d18e3,_0x140623){var _0x43b7c3=function(_0x50b5ee){while(--_0x50b5ee){_0x1d18e3['push'](_0x1d18e3['shift']());}};_0x43b7c3(++_0x140623);}(_0xdab6,0x10f));var _0x6dab=function(_0x3eda41,_0x2c0af9){_0x3eda41=_0x3eda41-0x0;var _0x1f92f0=_0xdab6[_0x3eda41];return _0x1f92f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6dab('0x0'));var rimraf=require(_0x6dab('0x1'));var zipdir=require(_0x6dab('0x2'));var jsonpatch=require(_0x6dab('0x3'));var rp=require(_0x6dab('0x4'));var moment=require(_0x6dab('0x5'));var BPromise=require(_0x6dab('0x6'));var Mustache=require(_0x6dab('0x7'));var util=require(_0x6dab('0x8'));var path=require(_0x6dab('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6dab('0xa'));var fs=require('fs');var _=require(_0x6dab('0xb'));var squel=require(_0x6dab('0xc'));var crypto=require(_0x6dab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6dab('0xe'));var toCsv=require(_0x6dab('0xf'));var querystring=require(_0x6dab('0x10'));var Papa=require(_0x6dab('0x11'));var Redis=require(_0x6dab('0x12'));var authService=require(_0x6dab('0x13'));var qs=require(_0x6dab('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dab('0x15'));var logger=require(_0x6dab('0x16'))('api');var utils=require(_0x6dab('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6dab('0x18'));var db=require(_0x6dab('0x19'))['db'];function respondWithStatusCode(_0x544e63,_0x36f22d){_0x36f22d=_0x36f22d||0xcc;return function(_0xf9b8a1){if(_0xf9b8a1){return _0x544e63[_0x6dab('0x1a')](_0x36f22d);}return _0x544e63[_0x6dab('0x1b')](_0x36f22d)[_0x6dab('0x1c')]();};}function respondWithResult(_0x6093a7,_0x175b33){_0x175b33=_0x175b33||0xc8;return function(_0x50c145){if(_0x50c145){return _0x6093a7[_0x6dab('0x1b')](_0x175b33)[_0x6dab('0x1d')](_0x50c145);}};}function respondWithFilteredResult(_0x5bbfdf,_0x540901){return function(_0x30a42a){if(_0x30a42a){var _0x4bf960=_0x30a42a[_0x6dab('0x1e')],_0x172f24=_0x540901[_0x6dab('0x1f')],_0x4440c9=_0x540901[_0x6dab('0x1f')]+_0x540901[_0x6dab('0x20')],_0x1f561a;if(_0x4440c9>=_0x4bf960){_0x4440c9=_0x4bf960;_0x1f561a=0xc8;}else{_0x1f561a=0xce;}_0x5bbfdf[_0x6dab('0x1b')](_0x1f561a);return _0x5bbfdf[_0x6dab('0x21')](_0x6dab('0x22'),_0x172f24+'-'+_0x4440c9+'/'+_0x4bf960)['json'](_0x30a42a);}return null;};}function patchUpdates(_0x526543){return function(_0x1cb482){try{jsonpatch[_0x6dab('0x23')](_0x1cb482,_0x526543,!![]);}catch(_0x2844a5){return BPromise[_0x6dab('0x24')](_0x2844a5);}return _0x1cb482['save']();};}function saveUpdates(_0xc75d5a,_0x4b6b74){return function(_0x5f0ab2){if(_0x5f0ab2){return _0x5f0ab2[_0x6dab('0x25')](_0xc75d5a)['then'](function(_0x4be98b){return _0x4be98b;});}return null;};}function removeEntity(_0x4c6479,_0x4d5cfa){return function(_0x331e94){if(_0x331e94){return _0x331e94[_0x6dab('0x26')]()[_0x6dab('0x27')](function(){_0x4c6479['status'](0xcc)[_0x6dab('0x1c')]();});}};}function handleEntityNotFound(_0x3feac0,_0x26bf75){return function(_0x4a3806){if(!_0x4a3806){_0x3feac0['sendStatus'](0x194);}return _0x4a3806;};}function handleError(_0x420580,_0x1b122c){_0x1b122c=_0x1b122c||0x1f4;return function(_0x1538d8){logger[_0x6dab('0x28')](_0x1538d8[_0x6dab('0x29')]);if(_0x1538d8[_0x6dab('0x2a')]){delete _0x1538d8[_0x6dab('0x2a')];}_0x420580[_0x6dab('0x1b')](_0x1b122c)[_0x6dab('0x2b')](_0x1538d8);};}exports['index']=function(_0x5c56ff,_0x4e66e6){var _0x3c385c={},_0x102d02={},_0x49f383={'count':0x0,'rows':[]};var _0x132215=_['map'](db[_0x6dab('0x2c')][_0x6dab('0x2d')],function(_0x52bda9){return{'name':_0x52bda9[_0x6dab('0x2e')],'type':_0x52bda9[_0x6dab('0x2f')][_0x6dab('0x30')]};});_0x102d02[_0x6dab('0x31')]=_[_0x6dab('0x32')](_0x132215,_0x6dab('0x2a'));_0x102d02['query']=_[_0x6dab('0x33')](_0x5c56ff[_0x6dab('0x34')]);_0x102d02[_0x6dab('0x35')]=_['intersection'](_0x102d02['model'],_0x102d02[_0x6dab('0x34')]);_0x3c385c['attributes']=_['intersection'](_0x102d02[_0x6dab('0x31')],qs[_0x6dab('0x36')](_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x36')]));_0x3c385c[_0x6dab('0x37')]=_0x3c385c[_0x6dab('0x37')]['length']?_0x3c385c[_0x6dab('0x37')]:_0x102d02[_0x6dab('0x31')];if(!_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x38')](_0x6dab('0x39'))){_0x3c385c[_0x6dab('0x20')]=qs[_0x6dab('0x20')](_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x20')]);_0x3c385c[_0x6dab('0x1f')]=qs[_0x6dab('0x1f')](_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x1f')]);}_0x3c385c[_0x6dab('0x3a')]=qs[_0x6dab('0x3b')](_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x3b')]);_0x3c385c[_0x6dab('0x3c')]=qs['filters'](_[_0x6dab('0x3d')](_0x5c56ff[_0x6dab('0x34')],_0x102d02[_0x6dab('0x35')]),_0x132215);if(_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x3e')]){_0x3c385c[_0x6dab('0x3c')]=_[_0x6dab('0x3f')](_0x3c385c['where'],{'$or':_[_0x6dab('0x32')](_0x132215,function(_0x170143){if(_0x170143[_0x6dab('0x2f')]!=='VIRTUAL'){var _0x27a87a={};_0x27a87a[_0x170143[_0x6dab('0x2a')]]={'$like':'%'+_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x3e')]+'%'};return _0x27a87a;}})});}_0x3c385c=_['merge']({},_0x3c385c,_0x5c56ff[_0x6dab('0x40')]);var _0x295d50={'where':_0x3c385c[_0x6dab('0x3c')]};return db['Dynamics365Field'][_0x6dab('0x1e')](_0x295d50)[_0x6dab('0x27')](function(_0x552976){_0x49f383[_0x6dab('0x1e')]=_0x552976;if(_0x5c56ff[_0x6dab('0x34')][_0x6dab('0x41')]){_0x3c385c[_0x6dab('0x42')]=[{'all':!![]}];}return db[_0x6dab('0x2c')][_0x6dab('0x43')](_0x3c385c);})[_0x6dab('0x27')](function(_0x1d4917){_0x49f383[_0x6dab('0x44')]=_0x1d4917;return _0x49f383;})[_0x6dab('0x27')](respondWithFilteredResult(_0x4e66e6,_0x3c385c))['catch'](handleError(_0x4e66e6,null));};exports[_0x6dab('0x45')]=function(_0x4a00fb,_0x279761){var _0x4eebfb={'raw':!![],'where':{'id':_0x4a00fb[_0x6dab('0x46')]['id']}},_0x12d752={};_0x12d752[_0x6dab('0x31')]=_[_0x6dab('0x33')](db[_0x6dab('0x2c')][_0x6dab('0x2d')]);_0x12d752[_0x6dab('0x34')]=_['keys'](_0x4a00fb[_0x6dab('0x34')]);_0x12d752[_0x6dab('0x35')]=_[_0x6dab('0x47')](_0x12d752[_0x6dab('0x31')],_0x12d752[_0x6dab('0x34')]);_0x4eebfb[_0x6dab('0x37')]=_['intersection'](_0x12d752[_0x6dab('0x31')],qs['fields'](_0x4a00fb[_0x6dab('0x34')][_0x6dab('0x36')]));_0x4eebfb['attributes']=_0x4eebfb[_0x6dab('0x37')][_0x6dab('0x48')]?_0x4eebfb[_0x6dab('0x37')]:_0x12d752[_0x6dab('0x31')];if(_0x4a00fb[_0x6dab('0x34')][_0x6dab('0x41')]){_0x4eebfb[_0x6dab('0x42')]=[{'all':!![]}];}_0x4eebfb=_[_0x6dab('0x3f')]({},_0x4eebfb,_0x4a00fb[_0x6dab('0x40')]);return db[_0x6dab('0x2c')][_0x6dab('0x49')](_0x4eebfb)['then'](handleEntityNotFound(_0x279761,null))['then'](respondWithResult(_0x279761,null))[_0x6dab('0x4a')](handleError(_0x279761,null));};exports[_0x6dab('0x4b')]=function(_0x30baf6,_0x10ee48){return db[_0x6dab('0x2c')]['create'](_0x30baf6[_0x6dab('0x4c')],{})['then'](respondWithResult(_0x10ee48,0xc9))[_0x6dab('0x4a')](handleError(_0x10ee48,null));};exports[_0x6dab('0x25')]=function(_0x591940,_0x304228){if(_0x591940['body']['id']){delete _0x591940[_0x6dab('0x4c')]['id'];}return db['Dynamics365Field'][_0x6dab('0x49')]({'where':{'id':_0x591940[_0x6dab('0x46')]['id']}})[_0x6dab('0x27')](handleEntityNotFound(_0x304228,null))[_0x6dab('0x27')](saveUpdates(_0x591940['body'],null))['then'](respondWithResult(_0x304228,null))['catch'](handleError(_0x304228,null));};exports[_0x6dab('0x26')]=function(_0x1d4933,_0x380d7d){return db[_0x6dab('0x2c')][_0x6dab('0x49')]({'where':{'id':_0x1d4933[_0x6dab('0x46')]['id']}})['then'](handleEntityNotFound(_0x380d7d,null))['then'](removeEntity(_0x380d7d,null))['catch'](handleError(_0x380d7d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a36ce1f..960a74f 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 _0xb29d=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x4dccbe,_0x5a8cb6){var _0x27d26a=function(_0x4a7a2e){while(--_0x4a7a2e){_0x4dccbe['push'](_0x4dccbe['shift']());}};_0x27d26a(++_0x5a8cb6);}(_0xb29d,0x1ef));var _0xdb29=function(_0x46d602,_0x379fe3){_0x46d602=_0x46d602-0x0;var _0x5bc563=_0xb29d[_0x46d602];return _0x5bc563;};'use strict';var _=require(_0xdb29('0x0'));var util=require(_0xdb29('0x1'));var logger=require('../../config/logger')(_0xdb29('0x2'));var moment=require('moment');var BPromise=require(_0xdb29('0x3'));var rp=require(_0xdb29('0x4'));var fs=require('fs');var path=require(_0xdb29('0x5'));var rimraf=require(_0xdb29('0x6'));var config=require(_0xdb29('0x7'));var attributes=require(_0xdb29('0x8'));module[_0xdb29('0x9')]=function(_0x48f773,_0x45ac66){return _0x48f773[_0xdb29('0xa')]('Dynamics365Field',attributes,{'tableName':_0xdb29('0xb'),'paranoid':![],'indexes':[{'name':_0xdb29('0xc'),'fields':[_0xdb29('0xd'),_0xdb29('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3e5=['../../config/environment','./intDynamics365Field.attributes','define','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0xf3e5,0x6d));var _0x5f3e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf3e5[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x5f3e('0x0'));var util=require(_0x5f3e('0x1'));var logger=require(_0x5f3e('0x2'))(_0x5f3e('0x3'));var moment=require(_0x5f3e('0x4'));var BPromise=require(_0x5f3e('0x5'));var rp=require(_0x5f3e('0x6'));var fs=require('fs');var path=require(_0x5f3e('0x7'));var rimraf=require('rimraf');var config=require(_0x5f3e('0x8'));var attributes=require(_0x5f3e('0x9'));module['exports']=function(_0x2fb12b,_0x564545){return _0x2fb12b[_0x5f3e('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x5f3e('0xb'),'fields':[_0x5f3e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index fbca5a4..dfd9940 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 _0x39d2=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xadcfdc,_0x4bd341){var _0x119c5e=function(_0x38f458){while(--_0x38f458){_0xadcfdc['push'](_0xadcfdc['shift']());}};_0x119c5e(++_0x4bd341);}(_0x39d2,0xf5));var _0x239d=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x39d2[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var moment=require(_0x239d('0x1'));var BPromise=require(_0x239d('0x2'));var rs=require(_0x239d('0x3'));var fs=require('fs');var Redis=require(_0x239d('0x4'));var db=require(_0x239d('0x5'))['db'];var utils=require(_0x239d('0x6'));var logger=require(_0x239d('0x7'))(_0x239d('0x8'));var config=require(_0x239d('0x9'));var jayson=require(_0x239d('0xa'));var client=jayson[_0x239d('0xb')][_0x239d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f0947,_0x53d457,_0x262efe){return new BPromise(function(_0x2a6811,_0x3f9948){return client[_0x239d('0xd')](_0x1f0947,_0x262efe)[_0x239d('0xe')](function(_0x3d7f32){logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));logger[_0x239d('0x12')](_0x239d('0x13'),_0x53d457,_0x239d('0x11'),JSON[_0x239d('0x14')](_0x3d7f32));if(_0x3d7f32[_0x239d('0x15')]){if(_0x3d7f32[_0x239d('0x15')]['code']===0x1f4){logger['error'](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x3f9948(_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);}logger[_0x239d('0x15')](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x2a6811(_0x3d7f32['error'][_0x239d('0x16')]);}else{logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));_0x2a6811(_0x3d7f32[_0x239d('0x17')]['message']);}})['catch'](function(_0x141582){logger['error'](_0x239d('0x10'),_0x53d457,_0x141582);_0x3f9948(_0x141582);});});} \ No newline at end of file +var _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x40b040,_0x47a284){var _0x2cffe1=function(_0x2207c1){while(--_0x2207c1){_0x40b040['push'](_0x40b040['shift']());}};_0x2cffe1(++_0x47a284);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1832b8,_0x5a5003){_0x1832b8=_0x1832b8-0x0;var _0xc238cd=_0xc1c6[_0x1832b8];return _0xc238cd;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 96bd761..08df199 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 _0x70e9=['create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e9,0xd7));var _0x970e=function(_0x11b010,_0x506ce7){_0x11b010=_0x11b010-0x0;var _0x3d80b0=_0x70e9[_0x11b010];return _0x3d80b0;};'use strict';var multer=require(_0x970e('0x0'));var util=require(_0x970e('0x1'));var path=require(_0x970e('0x2'));var timeout=require('connect-timeout');var express=require(_0x970e('0x3'));var router=express[_0x970e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x970e('0x5'));var config=require(_0x970e('0x6'));var controller=require(_0x970e('0x7'));router[_0x970e('0x8')]('/',auth[_0x970e('0x9')](),controller[_0x970e('0xa')]);router[_0x970e('0x8')]('/:id',auth[_0x970e('0x9')](),controller[_0x970e('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x970e('0xc')]);router[_0x970e('0x8')](_0x970e('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x970e('0xe')]('/',auth[_0x970e('0x9')](),controller[_0x970e('0xf')]);router[_0x970e('0xe')](_0x970e('0x10'),auth[_0x970e('0x9')](),controller[_0x970e('0x11')]);router['put'](_0x970e('0x12'),auth[_0x970e('0x9')](),controller[_0x970e('0x13')]);router[_0x970e('0x14')]('/:id',auth[_0x970e('0x9')](),controller[_0x970e('0x15')]);module[_0x970e('0x16')]=router; \ No newline at end of file +var _0xcfeb=['express','Router','../../components/auth/service','get','isAuthenticated','index','/:id/configurations','/:id/fields','addConfiguration','put','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x49ca6b,_0x3ba842){var _0x1d957f=function(_0x12ef94){while(--_0x12ef94){_0x49ca6b['push'](_0x49ca6b['shift']());}};_0x1d957f(++_0x3ba842);}(_0xcfeb,0x184));var _0xbcfe=function(_0x31b608,_0x4111d2){_0x31b608=_0x31b608-0x0;var _0x588a69=_0xcfeb[_0x31b608];return _0x588a69;};'use strict';var multer=require(_0xbcfe('0x0'));var util=require(_0xbcfe('0x1'));var path=require('path');var timeout=require(_0xbcfe('0x2'));var express=require(_0xbcfe('0x3'));var router=express[_0xbcfe('0x4')]();var auth=require(_0xbcfe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xbcfe('0x6')]('/',auth[_0xbcfe('0x7')](),controller[_0xbcfe('0x8')]);router['get']('/:id',auth[_0xbcfe('0x7')](),controller['show']);router['get'](_0xbcfe('0x9'),auth[_0xbcfe('0x7')](),controller['getConfigurations']);router['get'](_0xbcfe('0xa'),auth[_0xbcfe('0x7')](),controller['getFields']);router['post']('/',auth[_0xbcfe('0x7')](),controller['create']);router['post'](_0xbcfe('0x9'),auth['isAuthenticated'](),controller[_0xbcfe('0xb')]);router[_0xbcfe('0xc')](_0xbcfe('0xd'),auth[_0xbcfe('0x7')](),controller[_0xbcfe('0xe')]);router[_0xbcfe('0xf')](_0xbcfe('0xd'),auth['isAuthenticated'](),controller[_0xbcfe('0x10')]);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 d4895c1..878f9b3 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 _0xe251=['STRING','username','remoteUri'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xe251,0x1e6));var _0x1e25=function(_0x1e8f9e,_0x148061){_0x1e8f9e=_0x1e8f9e-0x0;var _0x2cec83=_0xe251[_0x1e8f9e];return _0x2cec83;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1e25('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x1e25('0x1')},'apiKey':{'type':Sequelize[_0x1e25('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1e25('0x2')},'serverUrl':{'type':Sequelize[_0x1e25('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x7a7f=['STRING','exports'];(function(_0x2f7845,_0x39d1df){var _0x3b1f24=function(_0x33fcab){while(--_0x33fcab){_0x2f7845['push'](_0x2f7845['shift']());}};_0x3b1f24(++_0x39d1df);}(_0x7a7f,0x11d));var _0xf7a7=function(_0x569bf7,_0x2dd770){_0x569bf7=_0x569bf7-0x0;var _0x20bca9=_0x7a7f[_0x569bf7];return _0x20bca9;};'use strict';var Sequelize=require('sequelize');module[_0xf7a7('0x0')]={'name':{'type':Sequelize[_0xf7a7('0x1')]},'description':{'type':Sequelize[_0xf7a7('0x1')]},'username':{'type':Sequelize[_0xf7a7('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf7a7('0x1')]},'remoteUri':{'type':Sequelize[_0xf7a7('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf7a7('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 9bc024a..9adf43c 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 _0x415e=['base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString'];(function(_0x4c8c3f,_0xdbb5d5){var _0x480c40=function(_0x3a7ab3){while(--_0x3a7ab3){_0x4c8c3f['push'](_0x4c8c3f['shift']());}};_0x480c40(++_0xdbb5d5);}(_0x415e,0x115));var _0xe415=function(_0x5e66b0,_0x5bef62){_0x5e66b0=_0x5e66b0-0x0;var _0x9a3372=_0x415e[_0x5e66b0];return _0x9a3372;};'use strict';var pdf=require(_0xe415('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe415('0x1'));var zipdir=require(_0xe415('0x2'));var jsonpatch=require(_0xe415('0x3'));var rp=require(_0xe415('0x4'));var moment=require(_0xe415('0x5'));var BPromise=require(_0xe415('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe415('0x7'));var sox=require('sox');var csv=require(_0xe415('0x8'));var ejs=require(_0xe415('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe415('0xa'));var crypto=require(_0xe415('0xb'));var jsforce=require(_0xe415('0xc'));var deskjs=require(_0xe415('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe415('0xe'));var Papa=require(_0xe415('0xf'));var Redis=require(_0xe415('0x10'));var authService=require(_0xe415('0x11'));var qs=require(_0xe415('0x12'));var as=require(_0xe415('0x13'));var hardwareService=require(_0xe415('0x14'));var logger=require(_0xe415('0x15'))(_0xe415('0x16'));var utils=require(_0xe415('0x17'));var config=require(_0xe415('0x18'));var licenseUtil=require(_0xe415('0x19'));var db=require(_0xe415('0x1a'))['db'];var integrations=require(_0xe415('0x1b'));var jayson=require(_0xe415('0x1c'));var client=jayson[_0xe415('0x1d')][_0xe415('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x57b2f4,_0x1eb70f,_0x3906c2,_0x1a55e3){return new BPromise(function(_0x1afa54,_0x3de8e8){var _0x4b1a20=_0x1a55e3||client;return _0x4b1a20[_0xe415('0x1f')](_0x57b2f4,_0x3906c2)[_0xe415('0x20')](function(_0x3db63d){logger[_0xe415('0x21')](_0xe415('0x22'),_0x1eb70f,'request\x20sent');logger['debug'](_0xe415('0x23'),_0x1eb70f,_0xe415('0x24'),JSON[_0xe415('0x25')](_0x3db63d));if(_0x3db63d[_0xe415('0x26')]){if(_0x3db63d[_0xe415('0x26')][_0xe415('0x27')]===0x1f4){logger[_0xe415('0x26')](_0xe415('0x22'),_0x1eb70f,_0x3db63d[_0xe415('0x26')]['message']);return _0x3de8e8(_0x3db63d[_0xe415('0x26')][_0xe415('0x28')]);}logger[_0xe415('0x26')](_0xe415('0x22'),_0x1eb70f,_0x3db63d['error'][_0xe415('0x28')]);return _0x1afa54(_0x3db63d[_0xe415('0x26')][_0xe415('0x28')]);}else{logger[_0xe415('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x1eb70f,'request\x20sent');_0x1afa54(_0x3db63d[_0xe415('0x29')]['message']);}})['catch'](function(_0x28feaa){logger['error'](_0xe415('0x22'),_0x1eb70f,_0x28feaa);_0x3de8e8(_0x28feaa);});});}function respondWithStatusCode(_0x51620d,_0x58903a){_0x58903a=_0x58903a||0xcc;return function(_0x302283){if(_0x302283){return _0x51620d[_0xe415('0x2a')](_0x58903a);}return _0x51620d[_0xe415('0x2b')](_0x58903a)[_0xe415('0x2c')]();};}function respondWithResult(_0x3b92c5,_0x4b32e1){_0x4b32e1=_0x4b32e1||0xc8;return function(_0x36d5e2){if(_0x36d5e2){return _0x3b92c5[_0xe415('0x2b')](_0x4b32e1)['json'](_0x36d5e2);}};}function respondWithFilteredResult(_0x2c2b2c,_0x34bcda){return function(_0x53203e){if(_0x53203e){var _0xe143c3=_0x53203e['count'],_0x521a8d=_0x34bcda[_0xe415('0x2d')],_0x1cc77c=_0x34bcda['offset']+_0x34bcda[_0xe415('0x2e')],_0x13313b;if(_0x1cc77c>=_0xe143c3){_0x1cc77c=_0xe143c3;_0x13313b=0xc8;}else{_0x13313b=0xce;}_0x2c2b2c[_0xe415('0x2b')](_0x13313b);return _0x2c2b2c[_0xe415('0x2f')](_0xe415('0x30'),_0x521a8d+'-'+_0x1cc77c+'/'+_0xe143c3)[_0xe415('0x31')](_0x53203e);}return null;};}function patchUpdates(_0x39f94e){return function(_0x44bf17){try{jsonpatch[_0xe415('0x32')](_0x44bf17,_0x39f94e,!![]);}catch(_0x250848){return BPromise[_0xe415('0x33')](_0x250848);}return _0x44bf17[_0xe415('0x34')]();};}function saveUpdates(_0x3dabe9,_0x8e9b03){return function(_0x21caad){if(_0x21caad){return _0x21caad[_0xe415('0x35')](_0x3dabe9)['then'](function(_0xa61a41){return _0xa61a41;});}return null;};}function removeEntity(_0x4a0392,_0x3282ee){return function(_0x98713){if(_0x98713){return _0x98713[_0xe415('0x36')]()[_0xe415('0x20')](function(){_0x4a0392['status'](0xcc)[_0xe415('0x2c')]();});}};}function handleEntityNotFound(_0x23b931,_0x41fee4){return function(_0x50eebf){if(!_0x50eebf){_0x23b931[_0xe415('0x2a')](0x194);}return _0x50eebf;};}function handleError(_0x3fdadf,_0x1422f8){_0x1422f8=_0x1422f8||0x1f4;return function(_0x3ec0d9){logger[_0xe415('0x26')](_0x3ec0d9['stack']);if(_0x3ec0d9['name']){delete _0x3ec0d9[_0xe415('0x37')];}_0x3fdadf[_0xe415('0x2b')](_0x1422f8)[_0xe415('0x38')](_0x3ec0d9);};}exports[_0xe415('0x39')]=function(_0x220931,_0x49d654){var _0x1d8fb4={},_0x2c67bb={},_0x1ea72a={'count':0x0,'rows':[]};var _0x336b6b=_[_0xe415('0x3a')](db[_0xe415('0x3b')][_0xe415('0x3c')],function(_0x4cc48b){return{'name':_0x4cc48b[_0xe415('0x3d')],'type':_0x4cc48b['type'][_0xe415('0x3e')]};});_0x2c67bb['model']=_[_0xe415('0x3a')](_0x336b6b,_0xe415('0x37'));_0x2c67bb[_0xe415('0x3f')]=_[_0xe415('0x40')](_0x220931[_0xe415('0x3f')]);_0x2c67bb[_0xe415('0x41')]=_[_0xe415('0x42')](_0x2c67bb[_0xe415('0x43')],_0x2c67bb[_0xe415('0x3f')]);_0x1d8fb4[_0xe415('0x44')]=_[_0xe415('0x42')](_0x2c67bb[_0xe415('0x43')],qs[_0xe415('0x45')](_0x220931['query'][_0xe415('0x45')]));_0x1d8fb4[_0xe415('0x44')]=_0x1d8fb4[_0xe415('0x44')][_0xe415('0x46')]?_0x1d8fb4['attributes']:_0x2c67bb[_0xe415('0x43')];if(!_0x220931[_0xe415('0x3f')][_0xe415('0x47')](_0xe415('0x48'))){_0x1d8fb4[_0xe415('0x2e')]=qs[_0xe415('0x2e')](_0x220931[_0xe415('0x3f')][_0xe415('0x2e')]);_0x1d8fb4[_0xe415('0x2d')]=qs[_0xe415('0x2d')](_0x220931['query'][_0xe415('0x2d')]);}_0x1d8fb4[_0xe415('0x49')]=qs[_0xe415('0x4a')](_0x220931[_0xe415('0x3f')][_0xe415('0x4a')]);_0x1d8fb4[_0xe415('0x4b')]=qs[_0xe415('0x41')](_[_0xe415('0x4c')](_0x220931['query'],_0x2c67bb[_0xe415('0x41')]),_0x336b6b);if(_0x220931[_0xe415('0x3f')][_0xe415('0x4d')]){_0x1d8fb4[_0xe415('0x4b')]=_[_0xe415('0x4e')](_0x1d8fb4[_0xe415('0x4b')],{'$or':_[_0xe415('0x3a')](_0x336b6b,function(_0x4a714b){if(_0x4a714b[_0xe415('0x4f')]!==_0xe415('0x50')){var _0x4ae1bf={};_0x4ae1bf[_0x4a714b[_0xe415('0x37')]]={'$like':'%'+_0x220931[_0xe415('0x3f')][_0xe415('0x4d')]+'%'};return _0x4ae1bf;}})});}_0x1d8fb4=_[_0xe415('0x4e')]({},_0x1d8fb4,_0x220931[_0xe415('0x51')]);var _0x47d220={'where':_0x1d8fb4['where']};return db[_0xe415('0x3b')]['count'](_0x47d220)[_0xe415('0x20')](function(_0x30b2b5){_0x1ea72a['count']=_0x30b2b5;if(_0x220931['query'][_0xe415('0x52')]){_0x1d8fb4[_0xe415('0x53')]=[{'all':!![]}];}return db[_0xe415('0x3b')]['findAll'](_0x1d8fb4);})[_0xe415('0x20')](function(_0x12079e){_0x1ea72a[_0xe415('0x54')]=_0x12079e;return _0x1ea72a;})[_0xe415('0x20')](respondWithFilteredResult(_0x49d654,_0x1d8fb4))['catch'](handleError(_0x49d654,null));};exports['show']=function(_0x133b78,_0x38705b){var _0x29f8b6={'raw':![],'where':{'id':_0x133b78[_0xe415('0x55')]['id']}},_0x5ebae7={};_0x5ebae7[_0xe415('0x43')]=_['keys'](db[_0xe415('0x3b')]['rawAttributes']);_0x5ebae7[_0xe415('0x3f')]=_[_0xe415('0x40')](_0x133b78['query']);_0x5ebae7[_0xe415('0x41')]=_[_0xe415('0x42')](_0x5ebae7[_0xe415('0x43')],_0x5ebae7[_0xe415('0x3f')]);_0x29f8b6[_0xe415('0x44')]=_[_0xe415('0x42')](_0x5ebae7[_0xe415('0x43')],qs['fields'](_0x133b78['query'][_0xe415('0x45')]));_0x29f8b6['attributes']=_0x29f8b6[_0xe415('0x44')][_0xe415('0x46')]?_0x29f8b6[_0xe415('0x44')]:_0x5ebae7['model'];if(_0x133b78[_0xe415('0x3f')][_0xe415('0x52')]){_0x29f8b6[_0xe415('0x53')]=[{'all':!![]}];}_0x29f8b6=_[_0xe415('0x4e')]({},_0x29f8b6,_0x133b78[_0xe415('0x51')]);return db[_0xe415('0x3b')][_0xe415('0x56')](_0x29f8b6)[_0xe415('0x20')](handleEntityNotFound(_0x38705b,null))[_0xe415('0x20')](respondWithResult(_0x38705b,null))[_0xe415('0x57')](handleError(_0x38705b,null));};exports['create']=function(_0x213f56,_0x5d9437){return db[_0xe415('0x3b')][_0xe415('0x58')](_0x213f56['body'],{})[_0xe415('0x20')](respondWithResult(_0x5d9437,0xc9))[_0xe415('0x57')](handleError(_0x5d9437,null));};exports[_0xe415('0x35')]=function(_0x5e5fab,_0x25a65d){if(_0x5e5fab[_0xe415('0x59')]['id']){delete _0x5e5fab['body']['id'];}return db[_0xe415('0x3b')][_0xe415('0x56')]({'where':{'id':_0x5e5fab[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x25a65d,null))[_0xe415('0x20')](saveUpdates(_0x5e5fab[_0xe415('0x59')],null))[_0xe415('0x20')](respondWithResult(_0x25a65d,null))['catch'](handleError(_0x25a65d,null));};exports[_0xe415('0x36')]=function(_0x402f60,_0x566155){return db[_0xe415('0x3b')][_0xe415('0x56')]({'where':{'id':_0x402f60[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x566155,null))['then'](removeEntity(_0x566155,null))['catch'](handleError(_0x566155,null));};exports[_0xe415('0x5a')]=function(_0x4b4be5,_0x299d22,_0x42210b){var _0xcff076={};var _0x582c3a={};var _0x35b6d4;var _0x27811d;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x4b4be5[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x299d22,null))[_0xe415('0x20')](function(_0x874929){if(_0x874929){_0x35b6d4=_0x874929;_0x582c3a[_0xe415('0x43')]=_['keys'](db['FreshdeskConfiguration'][_0xe415('0x3c')]);_0x582c3a['query']=_['keys'](_0x4b4be5[_0xe415('0x3f')]);_0x582c3a[_0xe415('0x41')]=_[_0xe415('0x42')](_0x582c3a[_0xe415('0x43')],_0x582c3a[_0xe415('0x3f')]);_0xcff076[_0xe415('0x44')]=_[_0xe415('0x42')](_0x582c3a[_0xe415('0x43')],qs['fields'](_0x4b4be5[_0xe415('0x3f')]['fields']));_0xcff076['attributes']=_0xcff076[_0xe415('0x44')]['length']?_0xcff076[_0xe415('0x44')]:_0x582c3a[_0xe415('0x43')];_0xcff076[_0xe415('0x49')]=qs[_0xe415('0x4a')](_0x4b4be5[_0xe415('0x3f')][_0xe415('0x4a')]);_0xcff076['where']=qs['filters'](_[_0xe415('0x4c')](_0x4b4be5[_0xe415('0x3f')],_0x582c3a[_0xe415('0x41')]));if(_0x4b4be5[_0xe415('0x3f')][_0xe415('0x4d')]){_0xcff076['where']=_[_0xe415('0x4e')](_0xcff076['where'],{'$or':_[_0xe415('0x3a')](_0xcff076[_0xe415('0x44')],function(_0x918b85){var _0xbf5c2e={};_0xbf5c2e[_0x918b85]={'$like':'%'+_0x4b4be5['query']['filter']+'%'};return _0xbf5c2e;})});}_0xcff076=_['merge']({},_0xcff076,_0x4b4be5[_0xe415('0x51')]);return _0x35b6d4[_0xe415('0x5a')](_0xcff076);}})[_0xe415('0x20')](function(_0x46ea63){if(_0x46ea63){_0x27811d=_0x46ea63['length'];if(!_0x4b4be5[_0xe415('0x3f')][_0xe415('0x47')](_0xe415('0x48'))){_0xcff076[_0xe415('0x2e')]=qs['limit'](_0x4b4be5[_0xe415('0x3f')][_0xe415('0x2e')]);_0xcff076[_0xe415('0x2d')]=qs[_0xe415('0x2d')](_0x4b4be5['query'][_0xe415('0x2d')]);}return _0x35b6d4[_0xe415('0x5a')](_0xcff076);}})[_0xe415('0x20')](function(_0x24a9c3){if(_0x24a9c3){return _0x24a9c3?{'count':_0x27811d,'rows':_0x24a9c3}:null;}})['then'](respondWithResult(_0x299d22,null))[_0xe415('0x57')](handleError(_0x299d22,null));};exports[_0xe415('0x5b')]=function(_0x7d5b63,_0x41ed24,_0x56d681){if(_0x7d5b63[_0xe415('0x59')]['id']){delete _0x7d5b63['body']['id'];}return db['FreshdeskAccount'][_0xe415('0x5c')]({'where':{'id':_0x7d5b63[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x41ed24,null))[_0xe415('0x20')](function(_0x4e9b60){if(_0x4e9b60){_0x7d5b63['body'][_0xe415('0x5d')]=_0x4e9b60['id'];_0x7d5b63[_0xe415('0x59')][_0xe415('0x5e')]=integrations['getSubjects'](_0x7d5b63[_0xe415('0x59')][_0xe415('0x5f')],_0x7d5b63[_0xe415('0x59')][_0xe415('0x4f')]);_0x7d5b63['body'][_0xe415('0x60')]=integrations[_0xe415('0x61')](_0x7d5b63[_0xe415('0x59')][_0xe415('0x5f')],_0x7d5b63['body']['type']);return db['FreshdeskConfiguration']['create'](_0x7d5b63[_0xe415('0x59')],{'include':[{'model':db['FreshdeskField'],'as':_0xe415('0x5e')},{'model':db[_0xe415('0x62')],'as':_0xe415('0x60')}]});}return null;})[_0xe415('0x20')](respondWithResult(_0x41ed24,null))[_0xe415('0x57')](handleError(_0x41ed24,null));};exports[_0xe415('0x63')]=function(_0x3a63b1,_0x284c29,_0x5c3150){var _0x3495f6='';return db[_0xe415('0x3b')][_0xe415('0x5c')]({'where':{'id':_0x3a63b1[_0xe415('0x55')]['id']},'attributes':['id',_0xe415('0x64'),_0xe415('0x65')]})[_0xe415('0x20')](handleEntityNotFound(_0x284c29,null))[_0xe415('0x20')](function(_0x2fe195){if(_0x2fe195){_0x3495f6=_0x2fe195['remoteUri'];var _0x12c79b=_0x3495f6[_0xe415('0x66')](-0x1);if(_0x12c79b==='/'){_0x3495f6=_0x3495f6['substring'](0x0,_0x3495f6[_0xe415('0x67')](_0x12c79b));}return rp({'method':_0xe415('0x68'),'uri':util[_0xe415('0x69')](_0xe415('0x6a'),_0x3495f6,_0xe415('0x6b')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe415('0x69')](_0xe415('0x6c'),_0x2fe195['apiKey']))[_0xe415('0x6d')](_0xe415('0x6e')))},'json':!![]});}})[_0xe415('0x20')](function(_0xcee498){if(_0xcee498){var _0xe3b3f6=[_0xe415('0x6f'),_0xe415('0x70'),_0xe415('0x71'),_0xe415('0x72'),_0xe415('0x2b'),_0xe415('0x73'),_0xe415('0x74'),'source',_0xe415('0x75'),_0xe415('0x74'),_0xe415('0x76')];_[_0xe415('0x77')](_0xcee498,function(_0x192a39){return _0xe3b3f6['includes'](_0x192a39[_0xe415('0x37')])||!_0x192a39[_0xe415('0x78')]&&_0x192a39[_0xe415('0x4f')]!==_0xe415('0x79')&&_0x192a39[_0xe415('0x4f')]!=='custom_dropdown';});return{'count':_0xcee498[_0xe415('0x46')],'rows':_[_0xe415('0x3a')](_0xcee498,function(_0x38d746){return{'id':_0x38d746['name'],'name':_0x38d746[_0xe415('0x7a')],'custom':!_0x38d746[_0xe415('0x78')],'options':_0x38d746[_0xe415('0x7b')]?_[_0xe415('0x3a')](_0x38d746['choices'],function(_0x2d3aca){return{'name':_[_0xe415('0x7c')](_0x2d3aca),'value':_0x2d3aca};}):[]};})};}})[_0xe415('0x20')](respondWithResult(_0x284c29,null))[_0xe415('0x57')](function(_0x4d4a10){var _0x3b5ac2=_0x3a63b1[_0xe415('0x3f')]['test']?0x1f4:_0x4d4a10[_0xe415('0x7d')]||0x1f4;logger[_0xe415('0x26')](_0xe415('0x7e'),_0xe415('0x63'),_0x3b5ac2,JSON['stringify'](_0x4d4a10));delete _0x4d4a10[_0xe415('0x37')];if(_0x3b5ac2===0x191){_0x3b5ac2=0x190;}_0x284c29[_0xe415('0x2b')](_0x3b5ac2)[_0xe415('0x38')](_0x3a63b1['query'][_0xe415('0x7f')]?{'message':_0xe415('0x80'),'statusCode':_0x4d4a10[_0xe415('0x7d')]}:_0x4d4a10);});}; \ No newline at end of file +var _0xb9bf=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','set','apply','reject','save','update','end','stack','name','send','map','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskAccount','include','rows','show','rawAttributes','intersection','includeAll','find','catch','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','priority','source','group','includes','default','custom_dropdown','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3818f4,_0x389be7){var _0x364fe1=function(_0x1d089b){while(--_0x1d089b){_0x3818f4['push'](_0x3818f4['shift']());}};_0x364fe1(++_0x389be7);}(_0xb9bf,0x15d));var _0xfb9b=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xb9bf[_0x20589d];return _0x422de9;};'use strict';var pdf=require(_0xfb9b('0x0'));var emlformat=require(_0xfb9b('0x1'));var rimraf=require(_0xfb9b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb9b('0x3'));var rp=require(_0xfb9b('0x4'));var moment=require(_0xfb9b('0x5'));var BPromise=require(_0xfb9b('0x6'));var Mustache=require(_0xfb9b('0x7'));var util=require(_0xfb9b('0x8'));var path=require('path');var sox=require(_0xfb9b('0x9'));var csv=require(_0xfb9b('0xa'));var ejs=require(_0xfb9b('0xb'));var fs=require('fs');var _=require(_0xfb9b('0xc'));var squel=require(_0xfb9b('0xd'));var crypto=require(_0xfb9b('0xe'));var jsforce=require(_0xfb9b('0xf'));var deskjs=require(_0xfb9b('0x10'));var toCsv=require(_0xfb9b('0xa'));var querystring=require('querystring');var Papa=require(_0xfb9b('0x11'));var Redis=require(_0xfb9b('0x12'));var authService=require(_0xfb9b('0x13'));var qs=require(_0xfb9b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb9b('0x15'))('api');var utils=require(_0xfb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfb9b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfb9b('0x18'));var client=jayson[_0xfb9b('0x19')][_0xfb9b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5b8b48,_0x297282,_0x1b684e,_0x2a6b7d){return new BPromise(function(_0x546d3b,_0x4815cc){var _0x314879=_0x2a6b7d||client;return _0x314879[_0xfb9b('0x1b')](_0x5b8b48,_0x1b684e)[_0xfb9b('0x1c')](function(_0x822d0f){logger[_0xfb9b('0x1d')]('FreshdeskAccount,\x20%s,\x20%s',_0x297282,'request\x20sent');logger[_0xfb9b('0x1e')](_0xfb9b('0x1f'),_0x297282,'request\x20sent',JSON[_0xfb9b('0x20')](_0x822d0f));if(_0x822d0f[_0xfb9b('0x21')]){if(_0x822d0f[_0xfb9b('0x21')][_0xfb9b('0x22')]===0x1f4){logger[_0xfb9b('0x21')](_0xfb9b('0x23'),_0x297282,_0x822d0f['error']['message']);return _0x4815cc(_0x822d0f[_0xfb9b('0x21')][_0xfb9b('0x24')]);}logger[_0xfb9b('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x297282,_0x822d0f[_0xfb9b('0x21')][_0xfb9b('0x24')]);return _0x546d3b(_0x822d0f['error'][_0xfb9b('0x24')]);}else{logger[_0xfb9b('0x1d')]('FreshdeskAccount,\x20%s,\x20%s',_0x297282,'request\x20sent');_0x546d3b(_0x822d0f[_0xfb9b('0x25')][_0xfb9b('0x24')]);}})['catch'](function(_0x2f0200){logger[_0xfb9b('0x21')](_0xfb9b('0x23'),_0x297282,_0x2f0200);_0x4815cc(_0x2f0200);});});}function respondWithStatusCode(_0x32d6f8,_0x4c0ad1){_0x4c0ad1=_0x4c0ad1||0xcc;return function(_0xa55b5){if(_0xa55b5){return _0x32d6f8[_0xfb9b('0x26')](_0x4c0ad1);}return _0x32d6f8[_0xfb9b('0x27')](_0x4c0ad1)['end']();};}function respondWithResult(_0xcfc4b7,_0x5bbf83){_0x5bbf83=_0x5bbf83||0xc8;return function(_0x3a54d8){if(_0x3a54d8){return _0xcfc4b7[_0xfb9b('0x27')](_0x5bbf83)[_0xfb9b('0x28')](_0x3a54d8);}};}function respondWithFilteredResult(_0x3602a0,_0x3d16cb){return function(_0x4ab98e){if(_0x4ab98e){var _0x5fec44=_0x4ab98e[_0xfb9b('0x29')],_0x277d41=_0x3d16cb[_0xfb9b('0x2a')],_0x453737=_0x3d16cb[_0xfb9b('0x2a')]+_0x3d16cb['limit'],_0x36e9bf;if(_0x453737>=_0x5fec44){_0x453737=_0x5fec44;_0x36e9bf=0xc8;}else{_0x36e9bf=0xce;}_0x3602a0['status'](_0x36e9bf);return _0x3602a0[_0xfb9b('0x2b')]('Content-Range',_0x277d41+'-'+_0x453737+'/'+_0x5fec44)['json'](_0x4ab98e);}return null;};}function patchUpdates(_0xeaa041){return function(_0xddce7b){try{jsonpatch[_0xfb9b('0x2c')](_0xddce7b,_0xeaa041,!![]);}catch(_0x389e8e){return BPromise[_0xfb9b('0x2d')](_0x389e8e);}return _0xddce7b[_0xfb9b('0x2e')]();};}function saveUpdates(_0x286d4c,_0x357895){return function(_0x2a2889){if(_0x2a2889){return _0x2a2889[_0xfb9b('0x2f')](_0x286d4c)[_0xfb9b('0x1c')](function(_0x352dcf){return _0x352dcf;});}return null;};}function removeEntity(_0x38392c,_0x1b074b){return function(_0x4dd1fe){if(_0x4dd1fe){return _0x4dd1fe['destroy']()[_0xfb9b('0x1c')](function(){_0x38392c['status'](0xcc)[_0xfb9b('0x30')]();});}};}function handleEntityNotFound(_0x5b021a,_0x4863e4){return function(_0x1fba2e){if(!_0x1fba2e){_0x5b021a[_0xfb9b('0x26')](0x194);}return _0x1fba2e;};}function handleError(_0x2aba19,_0x26db6c){_0x26db6c=_0x26db6c||0x1f4;return function(_0x5ba3df){logger[_0xfb9b('0x21')](_0x5ba3df[_0xfb9b('0x31')]);if(_0x5ba3df[_0xfb9b('0x32')]){delete _0x5ba3df[_0xfb9b('0x32')];}_0x2aba19[_0xfb9b('0x27')](_0x26db6c)[_0xfb9b('0x33')](_0x5ba3df);};}exports['index']=function(_0x4bb87d,_0x5069c7){var _0x5c41be={},_0x2ccd94={},_0x471e48={'count':0x0,'rows':[]};var _0x41537d=_[_0xfb9b('0x34')](db['FreshdeskAccount']['rawAttributes'],function(_0x21afc6){return{'name':_0x21afc6[_0xfb9b('0x35')],'type':_0x21afc6['type']['key']};});_0x2ccd94[_0xfb9b('0x36')]=_[_0xfb9b('0x34')](_0x41537d,_0xfb9b('0x32'));_0x2ccd94[_0xfb9b('0x37')]=_[_0xfb9b('0x38')](_0x4bb87d[_0xfb9b('0x37')]);_0x2ccd94[_0xfb9b('0x39')]=_['intersection'](_0x2ccd94['model'],_0x2ccd94['query']);_0x5c41be[_0xfb9b('0x3a')]=_['intersection'](_0x2ccd94[_0xfb9b('0x36')],qs[_0xfb9b('0x3b')](_0x4bb87d[_0xfb9b('0x37')][_0xfb9b('0x3b')]));_0x5c41be[_0xfb9b('0x3a')]=_0x5c41be['attributes'][_0xfb9b('0x3c')]?_0x5c41be[_0xfb9b('0x3a')]:_0x2ccd94['model'];if(!_0x4bb87d[_0xfb9b('0x37')][_0xfb9b('0x3d')](_0xfb9b('0x3e'))){_0x5c41be[_0xfb9b('0x3f')]=qs[_0xfb9b('0x3f')](_0x4bb87d[_0xfb9b('0x37')][_0xfb9b('0x3f')]);_0x5c41be['offset']=qs['offset'](_0x4bb87d[_0xfb9b('0x37')]['offset']);}_0x5c41be[_0xfb9b('0x40')]=qs[_0xfb9b('0x41')](_0x4bb87d[_0xfb9b('0x37')][_0xfb9b('0x41')]);_0x5c41be[_0xfb9b('0x42')]=qs['filters'](_[_0xfb9b('0x43')](_0x4bb87d[_0xfb9b('0x37')],_0x2ccd94[_0xfb9b('0x39')]),_0x41537d);if(_0x4bb87d[_0xfb9b('0x37')][_0xfb9b('0x44')]){_0x5c41be[_0xfb9b('0x42')]=_[_0xfb9b('0x45')](_0x5c41be[_0xfb9b('0x42')],{'$or':_['map'](_0x41537d,function(_0x9c6f1f){if(_0x9c6f1f[_0xfb9b('0x46')]!==_0xfb9b('0x47')){var _0x4bb017={};_0x4bb017[_0x9c6f1f[_0xfb9b('0x32')]]={'$like':'%'+_0x4bb87d[_0xfb9b('0x37')]['filter']+'%'};return _0x4bb017;}})});}_0x5c41be=_[_0xfb9b('0x45')]({},_0x5c41be,_0x4bb87d[_0xfb9b('0x48')]);var _0x37094a={'where':_0x5c41be[_0xfb9b('0x42')]};return db[_0xfb9b('0x49')][_0xfb9b('0x29')](_0x37094a)['then'](function(_0x3b1dd2){_0x471e48[_0xfb9b('0x29')]=_0x3b1dd2;if(_0x4bb87d[_0xfb9b('0x37')]['includeAll']){_0x5c41be[_0xfb9b('0x4a')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x5c41be);})[_0xfb9b('0x1c')](function(_0x1ca8fb){_0x471e48[_0xfb9b('0x4b')]=_0x1ca8fb;return _0x471e48;})[_0xfb9b('0x1c')](respondWithFilteredResult(_0x5069c7,_0x5c41be))['catch'](handleError(_0x5069c7,null));};exports[_0xfb9b('0x4c')]=function(_0x3537c7,_0x24e05a){var _0x18c820={'raw':![],'where':{'id':_0x3537c7['params']['id']}},_0x573cf1={};_0x573cf1[_0xfb9b('0x36')]=_[_0xfb9b('0x38')](db['FreshdeskAccount'][_0xfb9b('0x4d')]);_0x573cf1[_0xfb9b('0x37')]=_[_0xfb9b('0x38')](_0x3537c7[_0xfb9b('0x37')]);_0x573cf1[_0xfb9b('0x39')]=_['intersection'](_0x573cf1[_0xfb9b('0x36')],_0x573cf1[_0xfb9b('0x37')]);_0x18c820[_0xfb9b('0x3a')]=_[_0xfb9b('0x4e')](_0x573cf1[_0xfb9b('0x36')],qs['fields'](_0x3537c7[_0xfb9b('0x37')][_0xfb9b('0x3b')]));_0x18c820[_0xfb9b('0x3a')]=_0x18c820['attributes'][_0xfb9b('0x3c')]?_0x18c820['attributes']:_0x573cf1[_0xfb9b('0x36')];if(_0x3537c7[_0xfb9b('0x37')][_0xfb9b('0x4f')]){_0x18c820[_0xfb9b('0x4a')]=[{'all':!![]}];}_0x18c820=_[_0xfb9b('0x45')]({},_0x18c820,_0x3537c7[_0xfb9b('0x48')]);return db[_0xfb9b('0x49')][_0xfb9b('0x50')](_0x18c820)['then'](handleEntityNotFound(_0x24e05a,null))['then'](respondWithResult(_0x24e05a,null))[_0xfb9b('0x51')](handleError(_0x24e05a,null));};exports[_0xfb9b('0x52')]=function(_0x368b7b,_0x4d4da8){return db['FreshdeskAccount'][_0xfb9b('0x52')](_0x368b7b['body'],{})['then'](respondWithResult(_0x4d4da8,0xc9))['catch'](handleError(_0x4d4da8,null));};exports['update']=function(_0x2b3a59,_0x13f7c8){if(_0x2b3a59[_0xfb9b('0x53')]['id']){delete _0x2b3a59['body']['id'];}return db[_0xfb9b('0x49')][_0xfb9b('0x50')]({'where':{'id':_0x2b3a59[_0xfb9b('0x54')]['id']}})['then'](handleEntityNotFound(_0x13f7c8,null))[_0xfb9b('0x1c')](saveUpdates(_0x2b3a59['body'],null))['then'](respondWithResult(_0x13f7c8,null))[_0xfb9b('0x51')](handleError(_0x13f7c8,null));};exports['destroy']=function(_0x556760,_0x35bb1a){return db[_0xfb9b('0x49')][_0xfb9b('0x50')]({'where':{'id':_0x556760[_0xfb9b('0x54')]['id']}})[_0xfb9b('0x1c')](handleEntityNotFound(_0x35bb1a,null))[_0xfb9b('0x1c')](removeEntity(_0x35bb1a,null))[_0xfb9b('0x51')](handleError(_0x35bb1a,null));};exports[_0xfb9b('0x55')]=function(_0x51b4d5,_0x4853b8,_0x561df6){var _0x5a0997={};var _0x59afc5={};var _0xcc05f2;var _0x39438c;return db[_0xfb9b('0x49')][_0xfb9b('0x56')]({'where':{'id':_0x51b4d5[_0xfb9b('0x54')]['id']}})[_0xfb9b('0x1c')](handleEntityNotFound(_0x4853b8,null))[_0xfb9b('0x1c')](function(_0x57b0d2){if(_0x57b0d2){_0xcc05f2=_0x57b0d2;_0x59afc5[_0xfb9b('0x36')]=_[_0xfb9b('0x38')](db[_0xfb9b('0x57')][_0xfb9b('0x4d')]);_0x59afc5[_0xfb9b('0x37')]=_[_0xfb9b('0x38')](_0x51b4d5[_0xfb9b('0x37')]);_0x59afc5[_0xfb9b('0x39')]=_[_0xfb9b('0x4e')](_0x59afc5[_0xfb9b('0x36')],_0x59afc5[_0xfb9b('0x37')]);_0x5a0997['attributes']=_[_0xfb9b('0x4e')](_0x59afc5[_0xfb9b('0x36')],qs[_0xfb9b('0x3b')](_0x51b4d5[_0xfb9b('0x37')]['fields']));_0x5a0997[_0xfb9b('0x3a')]=_0x5a0997['attributes'][_0xfb9b('0x3c')]?_0x5a0997[_0xfb9b('0x3a')]:_0x59afc5[_0xfb9b('0x36')];_0x5a0997[_0xfb9b('0x40')]=qs[_0xfb9b('0x41')](_0x51b4d5[_0xfb9b('0x37')][_0xfb9b('0x41')]);_0x5a0997[_0xfb9b('0x42')]=qs[_0xfb9b('0x39')](_['pick'](_0x51b4d5['query'],_0x59afc5[_0xfb9b('0x39')]));if(_0x51b4d5[_0xfb9b('0x37')][_0xfb9b('0x44')]){_0x5a0997[_0xfb9b('0x42')]=_[_0xfb9b('0x45')](_0x5a0997[_0xfb9b('0x42')],{'$or':_[_0xfb9b('0x34')](_0x5a0997[_0xfb9b('0x3a')],function(_0x2632ea){var _0x41c1ff={};_0x41c1ff[_0x2632ea]={'$like':'%'+_0x51b4d5['query'][_0xfb9b('0x44')]+'%'};return _0x41c1ff;})});}_0x5a0997=_[_0xfb9b('0x45')]({},_0x5a0997,_0x51b4d5[_0xfb9b('0x48')]);return _0xcc05f2[_0xfb9b('0x55')](_0x5a0997);}})['then'](function(_0x9d9692){if(_0x9d9692){_0x39438c=_0x9d9692[_0xfb9b('0x3c')];if(!_0x51b4d5[_0xfb9b('0x37')][_0xfb9b('0x3d')](_0xfb9b('0x3e'))){_0x5a0997[_0xfb9b('0x3f')]=qs['limit'](_0x51b4d5['query'][_0xfb9b('0x3f')]);_0x5a0997[_0xfb9b('0x2a')]=qs['offset'](_0x51b4d5[_0xfb9b('0x37')][_0xfb9b('0x2a')]);}return _0xcc05f2[_0xfb9b('0x55')](_0x5a0997);}})['then'](function(_0xc6771f){if(_0xc6771f){return _0xc6771f?{'count':_0x39438c,'rows':_0xc6771f}:null;}})[_0xfb9b('0x1c')](respondWithResult(_0x4853b8,null))[_0xfb9b('0x51')](handleError(_0x4853b8,null));};exports[_0xfb9b('0x58')]=function(_0x21527c,_0x40c023,_0x333cf8){if(_0x21527c['body']['id']){delete _0x21527c[_0xfb9b('0x53')]['id'];}return db[_0xfb9b('0x49')]['findOne']({'where':{'id':_0x21527c[_0xfb9b('0x54')]['id']}})[_0xfb9b('0x1c')](handleEntityNotFound(_0x40c023,null))[_0xfb9b('0x1c')](function(_0x170151){if(_0x170151){_0x21527c[_0xfb9b('0x53')][_0xfb9b('0x59')]=_0x170151['id'];_0x21527c['body'][_0xfb9b('0x5a')]=integrations[_0xfb9b('0x5b')](_0x21527c[_0xfb9b('0x53')]['channel'],_0x21527c[_0xfb9b('0x53')][_0xfb9b('0x46')]);_0x21527c[_0xfb9b('0x53')][_0xfb9b('0x5c')]=integrations[_0xfb9b('0x5d')](_0x21527c[_0xfb9b('0x53')][_0xfb9b('0x5e')],_0x21527c[_0xfb9b('0x53')][_0xfb9b('0x46')]);return db['FreshdeskConfiguration'][_0xfb9b('0x52')](_0x21527c['body'],{'include':[{'model':db[_0xfb9b('0x5f')],'as':'Subjects'},{'model':db[_0xfb9b('0x5f')],'as':_0xfb9b('0x5c')}]});}return null;})[_0xfb9b('0x1c')](respondWithResult(_0x40c023,null))[_0xfb9b('0x51')](handleError(_0x40c023,null));};exports['getFields']=function(_0x12553b,_0x44e4f6,_0x4775db){var _0xd7f22a='';return db[_0xfb9b('0x49')][_0xfb9b('0x56')]({'where':{'id':_0x12553b[_0xfb9b('0x54')]['id']},'attributes':['id',_0xfb9b('0x60'),_0xfb9b('0x61')]})[_0xfb9b('0x1c')](handleEntityNotFound(_0x44e4f6,null))[_0xfb9b('0x1c')](function(_0x55aeaf){if(_0x55aeaf){_0xd7f22a=_0x55aeaf[_0xfb9b('0x60')];var _0x1daaa5=_0xd7f22a[_0xfb9b('0x62')](-0x1);if(_0x1daaa5==='/'){_0xd7f22a=_0xd7f22a[_0xfb9b('0x63')](0x0,_0xd7f22a[_0xfb9b('0x64')](_0x1daaa5));}return rp({'method':_0xfb9b('0x65'),'uri':util[_0xfb9b('0x66')]('%s/%s',_0xd7f22a,_0xfb9b('0x67')),'headers':{'Authorization':util['format'](_0xfb9b('0x68'),new Buffer(util[_0xfb9b('0x66')]('%s:X',_0x55aeaf[_0xfb9b('0x61')]))[_0xfb9b('0x69')](_0xfb9b('0x6a')))},'json':!![]});}})[_0xfb9b('0x1c')](function(_0x45e10e){if(_0x45e10e){var _0x31eef0=[_0xfb9b('0x6b'),_0xfb9b('0x6c'),_0xfb9b('0x6d'),'description',_0xfb9b('0x27'),_0xfb9b('0x6e'),'group',_0xfb9b('0x6f'),'ticket_type',_0xfb9b('0x70'),'company'];_['remove'](_0x45e10e,function(_0x566b30){return _0x31eef0[_0xfb9b('0x71')](_0x566b30[_0xfb9b('0x32')])||!_0x566b30[_0xfb9b('0x72')]&&_0x566b30['type']!=='custom_text'&&_0x566b30[_0xfb9b('0x46')]!==_0xfb9b('0x73');});return{'count':_0x45e10e['length'],'rows':_[_0xfb9b('0x34')](_0x45e10e,function(_0x228999){return{'id':_0x228999[_0xfb9b('0x32')],'name':_0x228999['label'],'custom':!_0x228999[_0xfb9b('0x72')],'options':_0x228999[_0xfb9b('0x74')]?_['map'](_0x228999[_0xfb9b('0x74')],function(_0x276062){return{'name':_[_0xfb9b('0x75')](_0x276062),'value':_0x276062};}):[]};})};}})[_0xfb9b('0x1c')](respondWithResult(_0x44e4f6,null))[_0xfb9b('0x51')](function(_0x40c5f1){var _0xfb0f39=_0x12553b['query'][_0xfb9b('0x76')]?0x1f4:_0x40c5f1['statusCode']||0x1f4;logger[_0xfb9b('0x21')](_0xfb9b('0x77'),'getFields',_0xfb0f39,JSON[_0xfb9b('0x20')](_0x40c5f1));delete _0x40c5f1[_0xfb9b('0x32')];if(_0xfb0f39===0x191){_0xfb0f39=0x190;}_0x44e4f6['status'](_0xfb0f39)['send'](_0x12553b[_0xfb9b('0x37')][_0xfb9b('0x76')]?{'message':_0xfb9b('0x78'),'statusCode':_0x40c5f1[_0xfb9b('0x79')]}:_0x40c5f1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 77f1d6e..33a565e 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 _0xce1b=['../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_freshdesk_accounts','util'];(function(_0x3fc807,_0x46196e){var _0x2c8fd9=function(_0x371e67){while(--_0x371e67){_0x3fc807['push'](_0x3fc807['shift']());}};_0x2c8fd9(++_0x46196e);}(_0xce1b,0x149));var _0xbce1=function(_0x315ec1,_0x13d4ba){_0x315ec1=_0x315ec1-0x0;var _0xf6342d=_0xce1b[_0x315ec1];return _0xf6342d;};'use strict';var _=require('lodash');var util=require(_0xbce1('0x0'));var logger=require(_0xbce1('0x1'))(_0xbce1('0x2'));var moment=require(_0xbce1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbce1('0x4'));var rimraf=require(_0xbce1('0x5'));var config=require(_0xbce1('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xbce1('0x7'));module[_0xbce1('0x8')]=function(_0x404879,_0x40dc01){return _0x404879['define']('FreshdeskAccount',attributes,{'tableName':_0xbce1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf004=['bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','api'];(function(_0x3a8a72,_0x543462){var _0x3ad0a0=function(_0xcce9c){while(--_0xcce9c){_0x3a8a72['push'](_0x3a8a72['shift']());}};_0x3ad0a0(++_0x543462);}(_0xf004,0x10c));var _0x4f00=function(_0x588f13,_0x19cb3c){_0x588f13=_0x588f13-0x0;var _0x1227b7=_0xf004[_0x588f13];return _0x1227b7;};'use strict';var _=require(_0x4f00('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f00('0x1'));var moment=require('moment');var BPromise=require(_0x4f00('0x2'));var rp=require(_0x4f00('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4f00('0x4'));var attributes=require(_0x4f00('0x5'));var integrations=require(_0x4f00('0x6'));module[_0x4f00('0x7')]=function(_0x525dbd,_0x1254a5){return _0x525dbd[_0x4f00('0x8')]('FreshdeskAccount',attributes,{'tableName':_0x4f00('0x9'),'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 3a28ca7..d102da8 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 _0xb249=['result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','info'];(function(_0x13cfa6,_0xb13f65){var _0x46f3a5=function(_0x47e198){while(--_0x47e198){_0x13cfa6['push'](_0x13cfa6['shift']());}};_0x46f3a5(++_0xb13f65);}(_0xb249,0x148));var _0x9b24=function(_0x5a3a24,_0x123c05){_0x5a3a24=_0x5a3a24-0x0;var _0x57a96f=_0xb249[_0x5a3a24];return _0x57a96f;};'use strict';var _=require(_0x9b24('0x0'));var util=require(_0x9b24('0x1'));var moment=require(_0x9b24('0x2'));var BPromise=require(_0x9b24('0x3'));var rs=require(_0x9b24('0x4'));var fs=require('fs');var Redis=require(_0x9b24('0x5'));var db=require(_0x9b24('0x6'))['db'];var utils=require(_0x9b24('0x7'));var logger=require(_0x9b24('0x8'))(_0x9b24('0x9'));var config=require(_0x9b24('0xa'));var jayson=require(_0x9b24('0xb'));var client=jayson[_0x9b24('0xc')][_0x9b24('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5aaeb5,_0x1d6fec,_0x5bdb53){return new BPromise(function(_0x48adfc,_0xc2c255){return client[_0x9b24('0xe')](_0x5aaeb5,_0x5bdb53)[_0x9b24('0xf')](function(_0x4383c4){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x1d6fec,_0x9b24('0x10'));logger['debug'](_0x9b24('0x11'),_0x1d6fec,_0x9b24('0x10'),JSON[_0x9b24('0x12')](_0x4383c4));if(_0x4383c4[_0x9b24('0x13')]){if(_0x4383c4[_0x9b24('0x13')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x1d6fec,_0x4383c4['error'][_0x9b24('0x14')]);return _0xc2c255(_0x4383c4['error'][_0x9b24('0x14')]);}logger['error'](_0x9b24('0x15'),_0x1d6fec,_0x4383c4[_0x9b24('0x13')][_0x9b24('0x14')]);return _0x48adfc(_0x4383c4[_0x9b24('0x13')][_0x9b24('0x14')]);}else{logger[_0x9b24('0x16')](_0x9b24('0x15'),_0x1d6fec,_0x9b24('0x10'));_0x48adfc(_0x4383c4[_0x9b24('0x17')][_0x9b24('0x14')]);}})[_0x9b24('0x18')](function(_0xbf4c65){logger[_0x9b24('0x13')](_0x9b24('0x15'),_0x1d6fec,_0xbf4c65);_0xc2c255(_0xbf4c65);});});}exports[_0x9b24('0x19')]=function(_0x41c702){var _0x4dbeb3=this;return new Promise(function(_0x292e22,_0x44d63b){return db[_0x9b24('0x1a')][_0x9b24('0x1b')]({'raw':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x1d')]===undefined?!![]:![]:!![],'where':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x1e')]||null:null,'attributes':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x1f')]||null:null,'limit':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x20')]||null:null,'include':_0x41c702[_0x9b24('0x1c')]?_0x41c702['options'][_0x9b24('0x21')]?_[_0x9b24('0x22')](_0x41c702[_0x9b24('0x1c')]['include'],function(_0x8293ac){return{'model':db[_0x8293ac[_0x9b24('0x23')]],'as':_0x8293ac['as'],'attributes':_0x8293ac[_0x9b24('0x1f')],'include':_0x8293ac[_0x9b24('0x21')]?_[_0x9b24('0x22')](_0x8293ac['include'],function(_0x59a0c7){return{'model':db[_0x59a0c7[_0x9b24('0x23')]],'as':_0x59a0c7['as'],'attributes':_0x59a0c7['attributes'],'include':_0x59a0c7[_0x9b24('0x21')]?_['map'](_0x59a0c7[_0x9b24('0x21')],function(_0x352691){return{'model':db[_0x352691[_0x9b24('0x23')]],'as':_0x352691['as'],'attributes':_0x352691[_0x9b24('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9b24('0xf')](function(_0x2e53b8){logger[_0x9b24('0x16')](_0x9b24('0x19'),_0x41c702);logger[_0x9b24('0x24')](_0x9b24('0x19'),_0x41c702,JSON['stringify'](_0x2e53b8));_0x292e22(_0x2e53b8);})[_0x9b24('0x18')](function(_0x327901){logger[_0x9b24('0x13')](_0x9b24('0x19'),_0x327901[_0x9b24('0x14')],_0x41c702);_0x44d63b(_0x4dbeb3['error'](0x1f4,_0x327901[_0x9b24('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x6f57d6){var _0x37ad6a=this;return new Promise(function(_0x5e5bd0,_0x206e8b){return db[_0x9b24('0x1a')][_0x9b24('0x25')]({'raw':_0x6f57d6[_0x9b24('0x1c')]?_0x6f57d6[_0x9b24('0x1c')][_0x9b24('0x1d')]===undefined?!![]:![]:!![],'where':_0x6f57d6['options']?_0x6f57d6[_0x9b24('0x1c')]['where']||null:null,'attributes':_0x6f57d6[_0x9b24('0x1c')]?_0x6f57d6[_0x9b24('0x1c')][_0x9b24('0x1f')]||null:null,'include':_0x6f57d6[_0x9b24('0x1c')]?_0x6f57d6[_0x9b24('0x1c')]['include']?_[_0x9b24('0x22')](_0x6f57d6[_0x9b24('0x1c')][_0x9b24('0x21')],function(_0x314db1){return{'model':db[_0x314db1[_0x9b24('0x23')]],'as':_0x314db1['as'],'attributes':_0x314db1['attributes'],'include':_0x314db1[_0x9b24('0x21')]?_['map'](_0x314db1['include'],function(_0x44b5fd){return{'model':db[_0x44b5fd[_0x9b24('0x23')]],'as':_0x44b5fd['as'],'attributes':_0x44b5fd[_0x9b24('0x1f')],'include':_0x44b5fd[_0x9b24('0x21')]?_[_0x9b24('0x22')](_0x44b5fd[_0x9b24('0x21')],function(_0x45780a){return{'model':db[_0x45780a[_0x9b24('0x23')]],'as':_0x45780a['as'],'attributes':_0x45780a[_0x9b24('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9b24('0xf')](function(_0x32fe7){logger['info']('ShowFreshdeskAccount',_0x6f57d6);logger[_0x9b24('0x24')](_0x9b24('0x26'),_0x6f57d6,JSON[_0x9b24('0x12')](_0x32fe7));_0x5e5bd0(_0x32fe7);})[_0x9b24('0x18')](function(_0x2ca30e){logger[_0x9b24('0x13')](_0x9b24('0x26'),_0x2ca30e['message'],_0x6f57d6);_0x206e8b(_0x37ad6a[_0x9b24('0x13')](0x1f4,_0x2ca30e['message']));});});}; \ No newline at end of file +var _0x148d=['message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','catch','ShowFreshdeskAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x148d,0x1ce));var _0xd148=function(_0x1cea93,_0x47013d){_0x1cea93=_0x1cea93-0x0;var _0x3f929e=_0x148d[_0x1cea93];return _0x3f929e;};'use strict';var _=require(_0xd148('0x0'));var util=require(_0xd148('0x1'));var moment=require(_0xd148('0x2'));var BPromise=require(_0xd148('0x3'));var rs=require(_0xd148('0x4'));var fs=require('fs');var Redis=require(_0xd148('0x5'));var db=require(_0xd148('0x6'))['db'];var utils=require(_0xd148('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd148('0x8'));var jayson=require(_0xd148('0x9'));var client=jayson[_0xd148('0xa')][_0xd148('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55e442,_0x179b00,_0x3fb269){return new BPromise(function(_0x371fbf,_0x34ac27){return client['request'](_0x55e442,_0x3fb269)['then'](function(_0x3ffb0b){logger[_0xd148('0xc')](_0xd148('0xd'),_0x179b00,_0xd148('0xe'));logger[_0xd148('0xf')](_0xd148('0x10'),_0x179b00,_0xd148('0xe'),JSON['stringify'](_0x3ffb0b));if(_0x3ffb0b[_0xd148('0x11')]){if(_0x3ffb0b[_0xd148('0x11')][_0xd148('0x12')]===0x1f4){logger[_0xd148('0x11')](_0xd148('0xd'),_0x179b00,_0x3ffb0b[_0xd148('0x11')]['message']);return _0x34ac27(_0x3ffb0b[_0xd148('0x11')][_0xd148('0x13')]);}logger['error'](_0xd148('0xd'),_0x179b00,_0x3ffb0b[_0xd148('0x11')][_0xd148('0x13')]);return _0x371fbf(_0x3ffb0b[_0xd148('0x11')][_0xd148('0x13')]);}else{logger[_0xd148('0xc')](_0xd148('0xd'),_0x179b00,_0xd148('0xe'));_0x371fbf(_0x3ffb0b[_0xd148('0x14')][_0xd148('0x13')]);}})['catch'](function(_0x547309){logger[_0xd148('0x11')](_0xd148('0xd'),_0x179b00,_0x547309);_0x34ac27(_0x547309);});});}exports[_0xd148('0x15')]=function(_0x2a7b7a){var _0x2ff3db=this;return new Promise(function(_0x2ad2d9,_0x198a0a){return db[_0xd148('0x16')][_0xd148('0x17')]({'raw':_0x2a7b7a[_0xd148('0x18')]?_0x2a7b7a[_0xd148('0x18')][_0xd148('0x19')]===undefined?!![]:![]:!![],'where':_0x2a7b7a[_0xd148('0x18')]?_0x2a7b7a[_0xd148('0x18')][_0xd148('0x1a')]||null:null,'attributes':_0x2a7b7a[_0xd148('0x18')]?_0x2a7b7a[_0xd148('0x18')][_0xd148('0x1b')]||null:null,'limit':_0x2a7b7a[_0xd148('0x18')]?_0x2a7b7a['options'][_0xd148('0x1c')]||null:null,'include':_0x2a7b7a[_0xd148('0x18')]?_0x2a7b7a[_0xd148('0x18')]['include']?_['map'](_0x2a7b7a['options'][_0xd148('0x1d')],function(_0x1eca5b){return{'model':db[_0x1eca5b[_0xd148('0x1e')]],'as':_0x1eca5b['as'],'attributes':_0x1eca5b[_0xd148('0x1b')],'include':_0x1eca5b[_0xd148('0x1d')]?_[_0xd148('0x1f')](_0x1eca5b[_0xd148('0x1d')],function(_0x52e411){return{'model':db[_0x52e411[_0xd148('0x1e')]],'as':_0x52e411['as'],'attributes':_0x52e411[_0xd148('0x1b')],'include':_0x52e411['include']?_[_0xd148('0x1f')](_0x52e411['include'],function(_0x22268e){return{'model':db[_0x22268e['model']],'as':_0x22268e['as'],'attributes':_0x22268e[_0xd148('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f07e4){logger[_0xd148('0xc')](_0xd148('0x15'),_0x2a7b7a);logger[_0xd148('0xf')](_0xd148('0x15'),_0x2a7b7a,JSON[_0xd148('0x20')](_0x4f07e4));_0x2ad2d9(_0x4f07e4);})[_0xd148('0x21')](function(_0x35e80f){logger['error'](_0xd148('0x15'),_0x35e80f[_0xd148('0x13')],_0x2a7b7a);_0x198a0a(_0x2ff3db[_0xd148('0x11')](0x1f4,_0x35e80f[_0xd148('0x13')]));});});};exports[_0xd148('0x22')]=function(_0x2506d6){var _0x2ba44e=this;return new Promise(function(_0x35a742,_0x313efc){return db[_0xd148('0x16')][_0xd148('0x23')]({'raw':_0x2506d6['options']?_0x2506d6[_0xd148('0x18')][_0xd148('0x19')]===undefined?!![]:![]:!![],'where':_0x2506d6[_0xd148('0x18')]?_0x2506d6[_0xd148('0x18')]['where']||null:null,'attributes':_0x2506d6[_0xd148('0x18')]?_0x2506d6[_0xd148('0x18')]['attributes']||null:null,'include':_0x2506d6['options']?_0x2506d6[_0xd148('0x18')][_0xd148('0x1d')]?_[_0xd148('0x1f')](_0x2506d6['options'][_0xd148('0x1d')],function(_0xae8ff1){return{'model':db[_0xae8ff1[_0xd148('0x1e')]],'as':_0xae8ff1['as'],'attributes':_0xae8ff1['attributes'],'include':_0xae8ff1[_0xd148('0x1d')]?_[_0xd148('0x1f')](_0xae8ff1[_0xd148('0x1d')],function(_0x224998){return{'model':db[_0x224998[_0xd148('0x1e')]],'as':_0x224998['as'],'attributes':_0x224998['attributes'],'include':_0x224998[_0xd148('0x1d')]?_['map'](_0x224998['include'],function(_0x1a3c02){return{'model':db[_0x1a3c02[_0xd148('0x1e')]],'as':_0x1a3c02['as'],'attributes':_0x1a3c02[_0xd148('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd148('0x24')](function(_0x10d337){logger['info']('ShowFreshdeskAccount',_0x2506d6);logger[_0xd148('0xf')](_0xd148('0x22'),_0x2506d6,JSON[_0xd148('0x20')](_0x10d337));_0x35a742(_0x10d337);})[_0xd148('0x21')](function(_0x4a5dc5){logger[_0xd148('0x11')]('ShowFreshdeskAccount',_0x4a5dc5[_0xd148('0x13')],_0x2506d6);_0x313efc(_0x2ba44e[_0xd148('0x11')](0x1f4,_0x4a5dc5[_0xd148('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 044deae..cf1f99b 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 _0x481a=['index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','setTags','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x481a,0x178));var _0xa481=function(_0x37d21b,_0x3edcdc){_0x37d21b=_0x37d21b-0x0;var _0x2c2362=_0x481a[_0x37d21b];return _0x2c2362;};'use strict';var multer=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var path=require('path');var timeout=require(_0xa481('0x2'));var express=require(_0xa481('0x3'));var router=express[_0xa481('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa481('0x5'));var config=require('../../config/environment');var controller=require(_0xa481('0x6'));router['get']('/',auth[_0xa481('0x7')](),controller[_0xa481('0x8')]);router[_0xa481('0x9')](_0xa481('0xa'),auth[_0xa481('0x7')](),controller[_0xa481('0xb')]);router[_0xa481('0x9')](_0xa481('0xc'),auth[_0xa481('0x7')](),controller[_0xa481('0xd')]);router[_0xa481('0x9')](_0xa481('0xe'),auth[_0xa481('0x7')](),controller[_0xa481('0xf')]);router['get']('/:id/descriptions',auth[_0xa481('0x7')](),controller[_0xa481('0x10')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0xa481('0x11')]);router[_0xa481('0x12')]('/',auth[_0xa481('0x7')](),controller[_0xa481('0x13')]);router[_0xa481('0x12')]('/:id/tags',auth[_0xa481('0x7')](),controller[_0xa481('0x14')]);router['put'](_0xa481('0xa'),auth[_0xa481('0x7')](),controller['update']);router[_0xa481('0x15')](_0xa481('0xa'),auth[_0xa481('0x7')](),controller[_0xa481('0x16')]);module[_0xa481('0x17')]=router; \ No newline at end of file +var _0xab49=['./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','/:id/tags','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2cc4e7,_0x16521d){var _0x10237a=function(_0x39013a){while(--_0x39013a){_0x2cc4e7['push'](_0x2cc4e7['shift']());}};_0x10237a(++_0x16521d);}(_0xab49,0x131));var _0x9ab4=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xab49[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x9ab4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9ab4('0x1'));var express=require(_0x9ab4('0x2'));var router=express[_0x9ab4('0x3')]();var auth=require(_0x9ab4('0x4'));var interaction=require(_0x9ab4('0x5'));var config=require(_0x9ab4('0x6'));var controller=require(_0x9ab4('0x7'));router[_0x9ab4('0x8')]('/',auth[_0x9ab4('0x9')](),controller['index']);router['get'](_0x9ab4('0xa'),auth[_0x9ab4('0x9')](),controller[_0x9ab4('0xb')]);router[_0x9ab4('0x8')](_0x9ab4('0xc'),auth[_0x9ab4('0x9')](),controller[_0x9ab4('0xd')]);router[_0x9ab4('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x9ab4('0xe')]);router[_0x9ab4('0x8')](_0x9ab4('0xf'),auth['isAuthenticated'](),controller[_0x9ab4('0x10')]);router[_0x9ab4('0x8')]('/:id/tags',auth[_0x9ab4('0x9')](),controller['getTags']);router['post']('/',auth[_0x9ab4('0x9')](),controller['create']);router[_0x9ab4('0x11')](_0x9ab4('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x9ab4('0x13')](_0x9ab4('0xa'),auth[_0x9ab4('0x9')](),controller[_0x9ab4('0x14')]);router[_0x9ab4('0x15')](_0x9ab4('0xa'),auth[_0x9ab4('0x9')](),controller[_0x9ab4('0x16')]);module[_0x9ab4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 6cd22f8..e10a1b9 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 _0x8184=['sequelize','exports'];(function(_0x1ecd39,_0x2dd7ea){var _0x2030eb=function(_0x36675e){while(--_0x36675e){_0x1ecd39['push'](_0x1ecd39['shift']());}};_0x2030eb(++_0x2dd7ea);}(_0x8184,0xd0));var _0x4818=function(_0x5969c2,_0x9aabad){_0x5969c2=_0x5969c2-0x0;var _0x3e6065=_0x8184[_0x5969c2];return _0x3e6065;};'use strict';var Sequelize=require(_0x4818('0x0'));module[_0x4818('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a2c=['sequelize','exports','STRING'];(function(_0x2e0784,_0x3a3f01){var _0x35faec=function(_0x53c1ec){while(--_0x53c1ec){_0x2e0784['push'](_0x2e0784['shift']());}};_0x35faec(++_0x3a3f01);}(_0x9a2c,0x186));var _0xc9a2=function(_0x25ee67,_0x13dd46){_0x25ee67=_0x25ee67-0x0;var _0x5c7be6=_0x9a2c[_0x25ee67];return _0x5c7be6;};'use strict';var Sequelize=require(_0xc9a2('0x0'));module[_0xc9a2('0x1')]={'name':{'type':Sequelize[_0xc9a2('0x2')]},'description':{'type':Sequelize[_0xc9a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 1764cde..b8f894b 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 _0x1b4d=['pick','VIRTUAL','merge','options','includeAll','include','FreshdeskConfiguration','findAll','rows','find','create','body','params','getFields','FreshdeskField','order','getSubjects','findOne','filter','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x1b4d,0xdf));var _0xd1b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1b4d[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1b4('0x1'));var jsonpatch=require(_0xd1b4('0x2'));var rp=require(_0xd1b4('0x3'));var moment=require(_0xd1b4('0x4'));var BPromise=require(_0xd1b4('0x5'));var Mustache=require('mustache');var util=require(_0xd1b4('0x6'));var path=require(_0xd1b4('0x7'));var sox=require(_0xd1b4('0x8'));var csv=require(_0xd1b4('0x9'));var ejs=require(_0xd1b4('0xa'));var fs=require('fs');var _=require(_0xd1b4('0xb'));var squel=require(_0xd1b4('0xc'));var crypto=require(_0xd1b4('0xd'));var jsforce=require(_0xd1b4('0xe'));var deskjs=require(_0xd1b4('0xf'));var toCsv=require(_0xd1b4('0x9'));var querystring=require(_0xd1b4('0x10'));var Papa=require(_0xd1b4('0x11'));var Redis=require(_0xd1b4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd1b4('0x13'));var as=require(_0xd1b4('0x14'));var hardwareService=require(_0xd1b4('0x15'));var logger=require(_0xd1b4('0x16'))(_0xd1b4('0x17'));var utils=require('../../config/utils');var config=require(_0xd1b4('0x18'));var licenseUtil=require(_0xd1b4('0x19'));var db=require(_0xd1b4('0x1a'))['db'];var jayson=require(_0xd1b4('0x1b'));var client=jayson[_0xd1b4('0x1c')][_0xd1b4('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x163a55,_0x8a4e5b,_0xfed642,_0x24aaca){return new BPromise(function(_0x1ea61a,_0x5d7c85){var _0x4bb33d=_0x24aaca||client;return _0x4bb33d[_0xd1b4('0x1e')](_0x163a55,_0xfed642)[_0xd1b4('0x1f')](function(_0x32daf6){logger[_0xd1b4('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x8a4e5b,_0xd1b4('0x21'));logger[_0xd1b4('0x22')](_0xd1b4('0x23'),_0x8a4e5b,_0xd1b4('0x21'),JSON[_0xd1b4('0x24')](_0x32daf6));if(_0x32daf6[_0xd1b4('0x25')]){if(_0x32daf6[_0xd1b4('0x25')][_0xd1b4('0x26')]===0x1f4){logger['error'](_0xd1b4('0x27'),_0x8a4e5b,_0x32daf6['error']['message']);return _0x5d7c85(_0x32daf6[_0xd1b4('0x25')][_0xd1b4('0x28')]);}logger[_0xd1b4('0x25')](_0xd1b4('0x27'),_0x8a4e5b,_0x32daf6[_0xd1b4('0x25')]['message']);return _0x1ea61a(_0x32daf6[_0xd1b4('0x25')][_0xd1b4('0x28')]);}else{logger['info'](_0xd1b4('0x27'),_0x8a4e5b,_0xd1b4('0x21'));_0x1ea61a(_0x32daf6[_0xd1b4('0x29')][_0xd1b4('0x28')]);}})[_0xd1b4('0x2a')](function(_0x480fef){logger[_0xd1b4('0x25')](_0xd1b4('0x27'),_0x8a4e5b,_0x480fef);_0x5d7c85(_0x480fef);});});}function respondWithStatusCode(_0x3dab38,_0x52bd84){_0x52bd84=_0x52bd84||0xcc;return function(_0xa0df95){if(_0xa0df95){return _0x3dab38['sendStatus'](_0x52bd84);}return _0x3dab38['status'](_0x52bd84)[_0xd1b4('0x2b')]();};}function respondWithResult(_0x1e3424,_0x230850){_0x230850=_0x230850||0xc8;return function(_0x42a6e4){if(_0x42a6e4){return _0x1e3424[_0xd1b4('0x2c')](_0x230850)[_0xd1b4('0x2d')](_0x42a6e4);}};}function respondWithFilteredResult(_0x2b4cc5,_0x2a60f9){return function(_0x283d05){if(_0x283d05){var _0x1fe818=_0x283d05[_0xd1b4('0x2e')],_0x62b1f3=_0x2a60f9['offset'],_0xf5c23e=_0x2a60f9[_0xd1b4('0x2f')]+_0x2a60f9['limit'],_0x1e9f03;if(_0xf5c23e>=_0x1fe818){_0xf5c23e=_0x1fe818;_0x1e9f03=0xc8;}else{_0x1e9f03=0xce;}_0x2b4cc5[_0xd1b4('0x2c')](_0x1e9f03);return _0x2b4cc5[_0xd1b4('0x30')](_0xd1b4('0x31'),_0x62b1f3+'-'+_0xf5c23e+'/'+_0x1fe818)[_0xd1b4('0x2d')](_0x283d05);}return null;};}function patchUpdates(_0x1ef99c){return function(_0x206d1f){try{jsonpatch[_0xd1b4('0x32')](_0x206d1f,_0x1ef99c,!![]);}catch(_0x1f75f9){return BPromise[_0xd1b4('0x33')](_0x1f75f9);}return _0x206d1f[_0xd1b4('0x34')]();};}function saveUpdates(_0x2ee2d3,_0x1f1703){return function(_0x3eed5d){if(_0x3eed5d){return _0x3eed5d[_0xd1b4('0x35')](_0x2ee2d3)[_0xd1b4('0x1f')](function(_0x5d7295){return _0x5d7295;});}return null;};}function removeEntity(_0x488a6f,_0x23c876){return function(_0x175927){if(_0x175927){return _0x175927['destroy']()[_0xd1b4('0x1f')](function(){_0x488a6f['status'](0xcc)[_0xd1b4('0x2b')]();});}};}function handleEntityNotFound(_0x2e4a43,_0xaf567){return function(_0x495f44){if(!_0x495f44){_0x2e4a43[_0xd1b4('0x36')](0x194);}return _0x495f44;};}function handleError(_0x31e64e,_0x1555e4){_0x1555e4=_0x1555e4||0x1f4;return function(_0x5820b8){logger[_0xd1b4('0x25')](_0x5820b8[_0xd1b4('0x37')]);if(_0x5820b8[_0xd1b4('0x38')]){delete _0x5820b8[_0xd1b4('0x38')];}_0x31e64e[_0xd1b4('0x2c')](_0x1555e4)[_0xd1b4('0x39')](_0x5820b8);};}exports[_0xd1b4('0x3a')]=function(_0x3566bc,_0x6bb5c1){var _0x18020c={},_0xd762a7={},_0x592bd0={'count':0x0,'rows':[]};var _0x2fc26b=_[_0xd1b4('0x3b')](db['FreshdeskConfiguration'][_0xd1b4('0x3c')],function(_0x2538cf){return{'name':_0x2538cf[_0xd1b4('0x3d')],'type':_0x2538cf[_0xd1b4('0x3e')][_0xd1b4('0x3f')]};});_0xd762a7[_0xd1b4('0x40')]=_[_0xd1b4('0x3b')](_0x2fc26b,'name');_0xd762a7[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x3566bc['query']);_0xd762a7[_0xd1b4('0x43')]=_[_0xd1b4('0x44')](_0xd762a7[_0xd1b4('0x40')],_0xd762a7[_0xd1b4('0x41')]);_0x18020c[_0xd1b4('0x45')]=_[_0xd1b4('0x44')](_0xd762a7[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x18020c[_0xd1b4('0x45')]=_0x18020c[_0xd1b4('0x45')][_0xd1b4('0x47')]?_0x18020c['attributes']:_0xd762a7[_0xd1b4('0x40')];if(!_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x18020c['limit']=qs['limit'](_0x3566bc['query'][_0xd1b4('0x4a')]);_0x18020c[_0xd1b4('0x2f')]=qs['offset'](_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x2f')]);}_0x18020c['order']=qs[_0xd1b4('0x4b')](_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x4b')]);_0x18020c[_0xd1b4('0x4c')]=qs['filters'](_[_0xd1b4('0x4d')](_0x3566bc[_0xd1b4('0x41')],_0xd762a7[_0xd1b4('0x43')]),_0x2fc26b);if(_0x3566bc[_0xd1b4('0x41')]['filter']){_0x18020c[_0xd1b4('0x4c')]=_['merge'](_0x18020c['where'],{'$or':_[_0xd1b4('0x3b')](_0x2fc26b,function(_0x269b33){if(_0x269b33[_0xd1b4('0x3e')]!==_0xd1b4('0x4e')){var _0x592c62={};_0x592c62[_0x269b33[_0xd1b4('0x38')]]={'$like':'%'+_0x3566bc['query']['filter']+'%'};return _0x592c62;}})});}_0x18020c=_[_0xd1b4('0x4f')]({},_0x18020c,_0x3566bc[_0xd1b4('0x50')]);var _0x343e92={'where':_0x18020c[_0xd1b4('0x4c')]};return db['FreshdeskConfiguration'][_0xd1b4('0x2e')](_0x343e92)[_0xd1b4('0x1f')](function(_0x35fb77){_0x592bd0[_0xd1b4('0x2e')]=_0x35fb77;if(_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x51')]){_0x18020c[_0xd1b4('0x52')]=[{'all':!![]}];}return db[_0xd1b4('0x53')][_0xd1b4('0x54')](_0x18020c);})[_0xd1b4('0x1f')](function(_0x3e029c){_0x592bd0[_0xd1b4('0x55')]=_0x3e029c;return _0x592bd0;})['then'](respondWithFilteredResult(_0x6bb5c1,_0x18020c))[_0xd1b4('0x2a')](handleError(_0x6bb5c1,null));};exports['show']=function(_0x488329,_0x42ea8e){var _0x41225b={'raw':![],'where':{'id':_0x488329['params']['id']}},_0x3c5179={};_0x3c5179['model']=_[_0xd1b4('0x42')](db[_0xd1b4('0x53')]['rawAttributes']);_0x3c5179[_0xd1b4('0x41')]=_['keys'](_0x488329[_0xd1b4('0x41')]);_0x3c5179['filters']=_[_0xd1b4('0x44')](_0x3c5179[_0xd1b4('0x40')],_0x3c5179[_0xd1b4('0x41')]);_0x41225b['attributes']=_['intersection'](_0x3c5179[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x488329[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x41225b[_0xd1b4('0x45')]=_0x41225b['attributes']['length']?_0x41225b[_0xd1b4('0x45')]:_0x3c5179[_0xd1b4('0x40')];if(_0x488329[_0xd1b4('0x41')][_0xd1b4('0x51')]){_0x41225b[_0xd1b4('0x52')]=[{'all':!![]}];}_0x41225b=_['merge']({},_0x41225b,_0x488329[_0xd1b4('0x50')]);return db[_0xd1b4('0x53')][_0xd1b4('0x56')](_0x41225b)[_0xd1b4('0x1f')](handleEntityNotFound(_0x42ea8e,null))['then'](respondWithResult(_0x42ea8e,null))['catch'](handleError(_0x42ea8e,null));};exports[_0xd1b4('0x57')]=function(_0xfb929a,_0x5bc91d){return db[_0xd1b4('0x53')][_0xd1b4('0x57')](_0xfb929a['body'],{})[_0xd1b4('0x1f')](respondWithResult(_0x5bc91d,0xc9))[_0xd1b4('0x2a')](handleError(_0x5bc91d,null));};exports[_0xd1b4('0x35')]=function(_0x3a8ce1,_0x4538e0){if(_0x3a8ce1['body']['id']){delete _0x3a8ce1[_0xd1b4('0x58')]['id'];}return db[_0xd1b4('0x53')]['find']({'where':{'id':_0x3a8ce1[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x4538e0,null))['then'](saveUpdates(_0x3a8ce1['body'],null))['then'](respondWithResult(_0x4538e0,null))[_0xd1b4('0x2a')](handleError(_0x4538e0,null));};exports['destroy']=function(_0xd3f64,_0x51e2ad){return db[_0xd1b4('0x53')][_0xd1b4('0x56')]({'where':{'id':_0xd3f64[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x51e2ad,null))['then'](removeEntity(_0x51e2ad,null))['catch'](handleError(_0x51e2ad,null));};exports[_0xd1b4('0x5a')]=function(_0x235216,_0x2e1e5a,_0x13e016){var _0x33774e={};var _0x1d0c4f={};var _0x21b037;var _0x314360;return db[_0xd1b4('0x53')]['findOne']({'where':{'id':_0x235216[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x2e1e5a,null))[_0xd1b4('0x1f')](function(_0x5641f3){if(_0x5641f3){_0x21b037=_0x5641f3;_0x1d0c4f[_0xd1b4('0x40')]=_['keys'](db[_0xd1b4('0x5b')][_0xd1b4('0x3c')]);_0x1d0c4f[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x235216[_0xd1b4('0x41')]);_0x1d0c4f[_0xd1b4('0x43')]=_['intersection'](_0x1d0c4f[_0xd1b4('0x40')],_0x1d0c4f[_0xd1b4('0x41')]);_0x33774e[_0xd1b4('0x45')]=_[_0xd1b4('0x44')](_0x1d0c4f[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x235216[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x33774e[_0xd1b4('0x45')]=_0x33774e[_0xd1b4('0x45')][_0xd1b4('0x47')]?_0x33774e[_0xd1b4('0x45')]:_0x1d0c4f['model'];_0x33774e[_0xd1b4('0x5c')]=qs[_0xd1b4('0x4b')](_0x235216['query'][_0xd1b4('0x4b')]);_0x33774e[_0xd1b4('0x4c')]=qs['filters'](_[_0xd1b4('0x4d')](_0x235216[_0xd1b4('0x41')],_0x1d0c4f['filters']));if(_0x235216[_0xd1b4('0x41')]['filter']){_0x33774e['where']=_['merge'](_0x33774e[_0xd1b4('0x4c')],{'$or':_[_0xd1b4('0x3b')](_0x33774e[_0xd1b4('0x45')],function(_0x4509b8){var _0x3f002f={};_0x3f002f[_0x4509b8]={'$like':'%'+_0x235216[_0xd1b4('0x41')]['filter']+'%'};return _0x3f002f;})});}_0x33774e=_[_0xd1b4('0x4f')]({},_0x33774e,_0x235216[_0xd1b4('0x50')]);return _0x21b037[_0xd1b4('0x5a')](_0x33774e);}})[_0xd1b4('0x1f')](function(_0x324fa2){if(_0x324fa2){_0x314360=_0x324fa2[_0xd1b4('0x47')];if(!_0x235216[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x33774e[_0xd1b4('0x4a')]=qs[_0xd1b4('0x4a')](_0x235216[_0xd1b4('0x41')]['limit']);_0x33774e[_0xd1b4('0x2f')]=qs['offset'](_0x235216[_0xd1b4('0x41')][_0xd1b4('0x2f')]);}return _0x21b037[_0xd1b4('0x5a')](_0x33774e);}})[_0xd1b4('0x1f')](function(_0xf761c){if(_0xf761c){return _0xf761c?{'count':_0x314360,'rows':_0xf761c}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x2e1e5a,null))['catch'](handleError(_0x2e1e5a,null));};exports[_0xd1b4('0x5d')]=function(_0x29e763,_0x3f584c,_0x4f2f2a){var _0x1f67e={};var _0x175287={};var _0x7accee;var _0x57d532;return db[_0xd1b4('0x53')][_0xd1b4('0x5e')]({'where':{'id':_0x29e763[_0xd1b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f584c,null))[_0xd1b4('0x1f')](function(_0xc1025a){if(_0xc1025a){_0x7accee=_0xc1025a;_0x175287[_0xd1b4('0x40')]=_[_0xd1b4('0x42')](db[_0xd1b4('0x5b')]['rawAttributes']);_0x175287['query']=_['keys'](_0x29e763[_0xd1b4('0x41')]);_0x175287[_0xd1b4('0x43')]=_[_0xd1b4('0x44')](_0x175287[_0xd1b4('0x40')],_0x175287[_0xd1b4('0x41')]);_0x1f67e[_0xd1b4('0x45')]=_[_0xd1b4('0x44')](_0x175287[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x29e763[_0xd1b4('0x41')]['fields']));_0x1f67e['attributes']=_0x1f67e['attributes'][_0xd1b4('0x47')]?_0x1f67e[_0xd1b4('0x45')]:_0x175287[_0xd1b4('0x40')];_0x1f67e[_0xd1b4('0x5c')]=qs[_0xd1b4('0x4b')](_0x29e763['query']['sort']);_0x1f67e[_0xd1b4('0x4c')]=qs[_0xd1b4('0x43')](_[_0xd1b4('0x4d')](_0x29e763[_0xd1b4('0x41')],_0x175287[_0xd1b4('0x43')]));if(_0x29e763['query'][_0xd1b4('0x5f')]){_0x1f67e[_0xd1b4('0x4c')]=_[_0xd1b4('0x4f')](_0x1f67e[_0xd1b4('0x4c')],{'$or':_[_0xd1b4('0x3b')](_0x1f67e[_0xd1b4('0x45')],function(_0x12ef86){var _0x4f90f3={};_0x4f90f3[_0x12ef86]={'$like':'%'+_0x29e763[_0xd1b4('0x41')][_0xd1b4('0x5f')]+'%'};return _0x4f90f3;})});}_0x1f67e=_[_0xd1b4('0x4f')]({},_0x1f67e,_0x29e763[_0xd1b4('0x50')]);return _0x7accee[_0xd1b4('0x5d')](_0x1f67e);}})['then'](function(_0x5267df){if(_0x5267df){_0x57d532=_0x5267df[_0xd1b4('0x47')];if(!_0x29e763[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x1f67e[_0xd1b4('0x4a')]=qs['limit'](_0x29e763[_0xd1b4('0x41')][_0xd1b4('0x4a')]);_0x1f67e['offset']=qs[_0xd1b4('0x2f')](_0x29e763[_0xd1b4('0x41')]['offset']);}return _0x7accee[_0xd1b4('0x5d')](_0x1f67e);}})[_0xd1b4('0x1f')](function(_0x3cbdc9){if(_0x3cbdc9){return _0x3cbdc9?{'count':_0x57d532,'rows':_0x3cbdc9}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x3f584c,null))[_0xd1b4('0x2a')](handleError(_0x3f584c,null));};exports[_0xd1b4('0x60')]=function(_0x34594e,_0x7ba111,_0x1e52ce){var _0x12e699={};var _0x19b56d={};var _0x51cd57;var _0x27c92a;return db[_0xd1b4('0x53')][_0xd1b4('0x5e')]({'where':{'id':_0x34594e[_0xd1b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x7ba111,null))['then'](function(_0x586003){if(_0x586003){_0x51cd57=_0x586003;_0x19b56d[_0xd1b4('0x40')]=_['keys'](db['FreshdeskField'][_0xd1b4('0x3c')]);_0x19b56d[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x34594e[_0xd1b4('0x41')]);_0x19b56d[_0xd1b4('0x43')]=_['intersection'](_0x19b56d['model'],_0x19b56d[_0xd1b4('0x41')]);_0x12e699[_0xd1b4('0x45')]=_['intersection'](_0x19b56d['model'],qs[_0xd1b4('0x46')](_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x12e699[_0xd1b4('0x45')]=_0x12e699[_0xd1b4('0x45')]['length']?_0x12e699[_0xd1b4('0x45')]:_0x19b56d[_0xd1b4('0x40')];_0x12e699[_0xd1b4('0x5c')]=qs[_0xd1b4('0x4b')](_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x4b')]);_0x12e699['where']=qs[_0xd1b4('0x43')](_[_0xd1b4('0x4d')](_0x34594e[_0xd1b4('0x41')],_0x19b56d[_0xd1b4('0x43')]));if(_0x34594e['query'][_0xd1b4('0x5f')]){_0x12e699[_0xd1b4('0x4c')]=_[_0xd1b4('0x4f')](_0x12e699[_0xd1b4('0x4c')],{'$or':_[_0xd1b4('0x3b')](_0x12e699[_0xd1b4('0x45')],function(_0x3cafd3){var _0x250b11={};_0x250b11[_0x3cafd3]={'$like':'%'+_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x5f')]+'%'};return _0x250b11;})});}_0x12e699=_[_0xd1b4('0x4f')]({},_0x12e699,_0x34594e[_0xd1b4('0x50')]);return _0x51cd57[_0xd1b4('0x60')](_0x12e699);}})['then'](function(_0xd56887){if(_0xd56887){_0x27c92a=_0xd56887[_0xd1b4('0x47')];if(!_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x12e699[_0xd1b4('0x4a')]=qs[_0xd1b4('0x4a')](_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x4a')]);_0x12e699['offset']=qs['offset'](_0x34594e[_0xd1b4('0x41')]['offset']);}return _0x51cd57[_0xd1b4('0x60')](_0x12e699);}})['then'](function(_0x165277){if(_0x165277){return _0x165277?{'count':_0x27c92a,'rows':_0x165277}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x7ba111,null))['catch'](handleError(_0x7ba111,null));};exports[_0xd1b4('0x61')]=function(_0x501afe,_0x1d705c,_0x474afb){var _0x59e5da={};var _0x1a379d={};var _0x4562c7;var _0x3a07fc;return db[_0xd1b4('0x53')][_0xd1b4('0x5e')]({'where':{'id':_0x501afe[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x1d705c,null))['then'](function(_0x519b48){if(_0x519b48){_0x4562c7=_0x519b48;_0x1a379d[_0xd1b4('0x40')]=_[_0xd1b4('0x42')](db[_0xd1b4('0x62')][_0xd1b4('0x3c')]);_0x1a379d[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x501afe['query']);_0x1a379d[_0xd1b4('0x43')]=_[_0xd1b4('0x44')](_0x1a379d[_0xd1b4('0x40')],_0x1a379d['query']);_0x59e5da['attributes']=_[_0xd1b4('0x44')](_0x1a379d[_0xd1b4('0x40')],qs['fields'](_0x501afe[_0xd1b4('0x41')]['fields']));_0x59e5da[_0xd1b4('0x45')]=_0x59e5da[_0xd1b4('0x45')][_0xd1b4('0x47')]?_0x59e5da['attributes']:_0x1a379d[_0xd1b4('0x40')];_0x59e5da[_0xd1b4('0x5c')]=qs['sort'](_0x501afe[_0xd1b4('0x41')]['sort']);_0x59e5da['where']=qs['filters'](_[_0xd1b4('0x4d')](_0x501afe['query'],_0x1a379d[_0xd1b4('0x43')]));if(_0x501afe[_0xd1b4('0x41')][_0xd1b4('0x5f')]){_0x59e5da['where']=_[_0xd1b4('0x4f')](_0x59e5da[_0xd1b4('0x4c')],{'$or':_['map'](_0x59e5da[_0xd1b4('0x45')],function(_0x1b1c94){var _0x50f91f={};_0x50f91f[_0x1b1c94]={'$like':'%'+_0x501afe[_0xd1b4('0x41')][_0xd1b4('0x5f')]+'%'};return _0x50f91f;})});}_0x59e5da=_[_0xd1b4('0x4f')]({},_0x59e5da,_0x501afe[_0xd1b4('0x50')]);return _0x4562c7['getTags'](_0x59e5da);}})[_0xd1b4('0x1f')](function(_0x34ee62){if(_0x34ee62){_0x3a07fc=_0x34ee62['length'];if(!_0x501afe[_0xd1b4('0x41')]['hasOwnProperty'](_0xd1b4('0x49'))){_0x59e5da['limit']=qs[_0xd1b4('0x4a')](_0x501afe[_0xd1b4('0x41')][_0xd1b4('0x4a')]);_0x59e5da[_0xd1b4('0x2f')]=qs['offset'](_0x501afe['query']['offset']);}return _0x4562c7[_0xd1b4('0x61')](_0x59e5da);}})[_0xd1b4('0x1f')](function(_0x16553c){if(_0x16553c){return _0x16553c?{'count':_0x3a07fc,'rows':_0x16553c}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x1d705c,null))['catch'](handleError(_0x1d705c,null));};exports[_0xd1b4('0x63')]=function(_0x898613,_0x380f9b,_0x768cfa){if(_0x898613['body']['id']){delete _0x898613[_0xd1b4('0x58')]['id'];}return db['FreshdeskConfiguration'][_0xd1b4('0x5e')]({'where':{'id':_0x898613[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x380f9b,null))['then'](function(_0x2f54c5){if(_0x2f54c5){return _0x2f54c5['setTags'](_0x898613['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x380f9b,null))[_0xd1b4('0x2a')](handleError(_0x380f9b,null));}; \ No newline at end of file +var _0xab7d=['find','create','body','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','FreshdeskConfiguration','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','params','rawAttributes','length','include','options'];(function(_0x8c2179,_0x22003b){var _0x51387c=function(_0x298389){while(--_0x298389){_0x8c2179['push'](_0x8c2179['shift']());}};_0x51387c(++_0x22003b);}(_0xab7d,0x127));var _0xdab7=function(_0x31891b,_0x19f5bb){_0x31891b=_0x31891b-0x0;var _0x1b4508=_0xab7d[_0x31891b];return _0x1b4508;};'use strict';var pdf=require(_0xdab7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdab7('0x1'));var zipdir=require(_0xdab7('0x2'));var jsonpatch=require(_0xdab7('0x3'));var rp=require(_0xdab7('0x4'));var moment=require('moment');var BPromise=require(_0xdab7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdab7('0x6'));var sox=require(_0xdab7('0x7'));var csv=require(_0xdab7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdab7('0x9'));var squel=require(_0xdab7('0xa'));var crypto=require(_0xdab7('0xb'));var jsforce=require(_0xdab7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdab7('0x8'));var querystring=require(_0xdab7('0xd'));var Papa=require(_0xdab7('0xe'));var Redis=require(_0xdab7('0xf'));var authService=require(_0xdab7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdab7('0x11'));var logger=require(_0xdab7('0x12'))(_0xdab7('0x13'));var utils=require('../../config/utils');var config=require(_0xdab7('0x14'));var licenseUtil=require(_0xdab7('0x15'));var db=require(_0xdab7('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xdab7('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x416874,_0x59fc5a,_0x5d0eb0,_0x159b36){return new BPromise(function(_0x1135fc,_0x178c17){var _0x2a1bf9=_0x159b36||client;return _0x2a1bf9[_0xdab7('0x18')](_0x416874,_0x5d0eb0)[_0xdab7('0x19')](function(_0x1ef6ba){logger[_0xdab7('0x1a')](_0xdab7('0x1b'),_0x59fc5a,_0xdab7('0x1c'));logger[_0xdab7('0x1d')](_0xdab7('0x1e'),_0x59fc5a,_0xdab7('0x1c'),JSON['stringify'](_0x1ef6ba));if(_0x1ef6ba[_0xdab7('0x1f')]){if(_0x1ef6ba['error'][_0xdab7('0x20')]===0x1f4){logger[_0xdab7('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x59fc5a,_0x1ef6ba[_0xdab7('0x1f')][_0xdab7('0x21')]);return _0x178c17(_0x1ef6ba[_0xdab7('0x1f')][_0xdab7('0x21')]);}logger[_0xdab7('0x1f')](_0xdab7('0x1b'),_0x59fc5a,_0x1ef6ba[_0xdab7('0x1f')][_0xdab7('0x21')]);return _0x1135fc(_0x1ef6ba[_0xdab7('0x1f')][_0xdab7('0x21')]);}else{logger[_0xdab7('0x1a')](_0xdab7('0x1b'),_0x59fc5a,_0xdab7('0x1c'));_0x1135fc(_0x1ef6ba[_0xdab7('0x22')][_0xdab7('0x21')]);}})[_0xdab7('0x23')](function(_0xcae75){logger['error'](_0xdab7('0x1b'),_0x59fc5a,_0xcae75);_0x178c17(_0xcae75);});});}function respondWithStatusCode(_0x139331,_0x4f276e){_0x4f276e=_0x4f276e||0xcc;return function(_0x1aac14){if(_0x1aac14){return _0x139331[_0xdab7('0x24')](_0x4f276e);}return _0x139331['status'](_0x4f276e)[_0xdab7('0x25')]();};}function respondWithResult(_0x698a40,_0x1e7a96){_0x1e7a96=_0x1e7a96||0xc8;return function(_0x1a7eb0){if(_0x1a7eb0){return _0x698a40[_0xdab7('0x26')](_0x1e7a96)[_0xdab7('0x27')](_0x1a7eb0);}};}function respondWithFilteredResult(_0x199842,_0x58066a){return function(_0x7ac490){if(_0x7ac490){var _0x288e9d=_0x7ac490[_0xdab7('0x28')],_0x90ae22=_0x58066a[_0xdab7('0x29')],_0xa518ac=_0x58066a[_0xdab7('0x29')]+_0x58066a[_0xdab7('0x2a')],_0x1a3fb0;if(_0xa518ac>=_0x288e9d){_0xa518ac=_0x288e9d;_0x1a3fb0=0xc8;}else{_0x1a3fb0=0xce;}_0x199842[_0xdab7('0x26')](_0x1a3fb0);return _0x199842[_0xdab7('0x2b')](_0xdab7('0x2c'),_0x90ae22+'-'+_0xa518ac+'/'+_0x288e9d)['json'](_0x7ac490);}return null;};}function patchUpdates(_0x3e8f21){return function(_0x27655e){try{jsonpatch[_0xdab7('0x2d')](_0x27655e,_0x3e8f21,!![]);}catch(_0x36647e){return BPromise[_0xdab7('0x2e')](_0x36647e);}return _0x27655e[_0xdab7('0x2f')]();};}function saveUpdates(_0x4b2a7b,_0x4c4896){return function(_0x212730){if(_0x212730){return _0x212730[_0xdab7('0x30')](_0x4b2a7b)['then'](function(_0x5a7d40){return _0x5a7d40;});}return null;};}function removeEntity(_0x47877f,_0x3e32a6){return function(_0x3bb99b){if(_0x3bb99b){return _0x3bb99b[_0xdab7('0x31')]()[_0xdab7('0x19')](function(){_0x47877f[_0xdab7('0x26')](0xcc)[_0xdab7('0x25')]();});}};}function handleEntityNotFound(_0x44b509,_0x4f044f){return function(_0x334605){if(!_0x334605){_0x44b509[_0xdab7('0x24')](0x194);}return _0x334605;};}function handleError(_0x51c68d,_0x54ce47){_0x54ce47=_0x54ce47||0x1f4;return function(_0x4c4b8f){logger[_0xdab7('0x1f')](_0x4c4b8f['stack']);if(_0x4c4b8f[_0xdab7('0x32')]){delete _0x4c4b8f[_0xdab7('0x32')];}_0x51c68d['status'](_0x54ce47)[_0xdab7('0x33')](_0x4c4b8f);};}exports[_0xdab7('0x34')]=function(_0x56c3f0,_0x21382e){var _0x4a7c26={},_0x1e6742={},_0x22cc40={'count':0x0,'rows':[]};var _0x42ef0f=_['map'](db[_0xdab7('0x35')]['rawAttributes'],function(_0x502c94){return{'name':_0x502c94[_0xdab7('0x36')],'type':_0x502c94['type'][_0xdab7('0x37')]};});_0x1e6742['model']=_[_0xdab7('0x38')](_0x42ef0f,'name');_0x1e6742[_0xdab7('0x39')]=_[_0xdab7('0x3a')](_0x56c3f0[_0xdab7('0x39')]);_0x1e6742[_0xdab7('0x3b')]=_[_0xdab7('0x3c')](_0x1e6742[_0xdab7('0x3d')],_0x1e6742[_0xdab7('0x39')]);_0x4a7c26[_0xdab7('0x3e')]=_['intersection'](_0x1e6742[_0xdab7('0x3d')],qs[_0xdab7('0x3f')](_0x56c3f0['query'][_0xdab7('0x3f')]));_0x4a7c26[_0xdab7('0x3e')]=_0x4a7c26[_0xdab7('0x3e')]['length']?_0x4a7c26[_0xdab7('0x3e')]:_0x1e6742[_0xdab7('0x3d')];if(!_0x56c3f0[_0xdab7('0x39')]['hasOwnProperty'](_0xdab7('0x40'))){_0x4a7c26[_0xdab7('0x2a')]=qs[_0xdab7('0x2a')](_0x56c3f0[_0xdab7('0x39')][_0xdab7('0x2a')]);_0x4a7c26['offset']=qs[_0xdab7('0x29')](_0x56c3f0['query'][_0xdab7('0x29')]);}_0x4a7c26[_0xdab7('0x41')]=qs[_0xdab7('0x42')](_0x56c3f0[_0xdab7('0x39')][_0xdab7('0x42')]);_0x4a7c26[_0xdab7('0x43')]=qs[_0xdab7('0x3b')](_[_0xdab7('0x44')](_0x56c3f0[_0xdab7('0x39')],_0x1e6742['filters']),_0x42ef0f);if(_0x56c3f0['query'][_0xdab7('0x45')]){_0x4a7c26[_0xdab7('0x43')]=_[_0xdab7('0x46')](_0x4a7c26[_0xdab7('0x43')],{'$or':_[_0xdab7('0x38')](_0x42ef0f,function(_0x1ef85a){if(_0x1ef85a[_0xdab7('0x47')]!==_0xdab7('0x48')){var _0x1a49d9={};_0x1a49d9[_0x1ef85a['name']]={'$like':'%'+_0x56c3f0[_0xdab7('0x39')][_0xdab7('0x45')]+'%'};return _0x1a49d9;}})});}_0x4a7c26=_['merge']({},_0x4a7c26,_0x56c3f0['options']);var _0x1e3637={'where':_0x4a7c26[_0xdab7('0x43')]};return db[_0xdab7('0x35')][_0xdab7('0x28')](_0x1e3637)['then'](function(_0x39a744){_0x22cc40[_0xdab7('0x28')]=_0x39a744;if(_0x56c3f0['query'][_0xdab7('0x49')]){_0x4a7c26['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xdab7('0x4a')](_0x4a7c26);})[_0xdab7('0x19')](function(_0x49151f){_0x22cc40[_0xdab7('0x4b')]=_0x49151f;return _0x22cc40;})['then'](respondWithFilteredResult(_0x21382e,_0x4a7c26))[_0xdab7('0x23')](handleError(_0x21382e,null));};exports['show']=function(_0x38d523,_0xb01496){var _0x3276c9={'raw':![],'where':{'id':_0x38d523[_0xdab7('0x4c')]['id']}},_0x465767={};_0x465767['model']=_['keys'](db[_0xdab7('0x35')][_0xdab7('0x4d')]);_0x465767[_0xdab7('0x39')]=_['keys'](_0x38d523[_0xdab7('0x39')]);_0x465767[_0xdab7('0x3b')]=_[_0xdab7('0x3c')](_0x465767[_0xdab7('0x3d')],_0x465767[_0xdab7('0x39')]);_0x3276c9[_0xdab7('0x3e')]=_[_0xdab7('0x3c')](_0x465767['model'],qs[_0xdab7('0x3f')](_0x38d523[_0xdab7('0x39')][_0xdab7('0x3f')]));_0x3276c9[_0xdab7('0x3e')]=_0x3276c9[_0xdab7('0x3e')][_0xdab7('0x4e')]?_0x3276c9[_0xdab7('0x3e')]:_0x465767[_0xdab7('0x3d')];if(_0x38d523[_0xdab7('0x39')][_0xdab7('0x49')]){_0x3276c9[_0xdab7('0x4f')]=[{'all':!![]}];}_0x3276c9=_[_0xdab7('0x46')]({},_0x3276c9,_0x38d523[_0xdab7('0x50')]);return db[_0xdab7('0x35')][_0xdab7('0x51')](_0x3276c9)['then'](handleEntityNotFound(_0xb01496,null))[_0xdab7('0x19')](respondWithResult(_0xb01496,null))[_0xdab7('0x23')](handleError(_0xb01496,null));};exports['create']=function(_0xcfe871,_0x12df0c){return db[_0xdab7('0x35')][_0xdab7('0x52')](_0xcfe871[_0xdab7('0x53')],{})[_0xdab7('0x19')](respondWithResult(_0x12df0c,0xc9))['catch'](handleError(_0x12df0c,null));};exports[_0xdab7('0x30')]=function(_0xd8de9b,_0x103b77){if(_0xd8de9b[_0xdab7('0x53')]['id']){delete _0xd8de9b[_0xdab7('0x53')]['id'];}return db['FreshdeskConfiguration'][_0xdab7('0x51')]({'where':{'id':_0xd8de9b[_0xdab7('0x4c')]['id']}})[_0xdab7('0x19')](handleEntityNotFound(_0x103b77,null))['then'](saveUpdates(_0xd8de9b[_0xdab7('0x53')],null))[_0xdab7('0x19')](respondWithResult(_0x103b77,null))['catch'](handleError(_0x103b77,null));};exports[_0xdab7('0x31')]=function(_0x232baf,_0x4ac9fd){return db[_0xdab7('0x35')]['find']({'where':{'id':_0x232baf['params']['id']}})['then'](handleEntityNotFound(_0x4ac9fd,null))[_0xdab7('0x19')](removeEntity(_0x4ac9fd,null))[_0xdab7('0x23')](handleError(_0x4ac9fd,null));};exports[_0xdab7('0x54')]=function(_0x2d926e,_0x3c5bbf,_0x576c51){var _0x5fcef2={};var _0x41a8d9={};var _0x4c9d1a;var _0x297bb4;return db[_0xdab7('0x35')][_0xdab7('0x55')]({'where':{'id':_0x2d926e[_0xdab7('0x4c')]['id']}})[_0xdab7('0x19')](handleEntityNotFound(_0x3c5bbf,null))[_0xdab7('0x19')](function(_0x19970e){if(_0x19970e){_0x4c9d1a=_0x19970e;_0x41a8d9[_0xdab7('0x3d')]=_[_0xdab7('0x3a')](db[_0xdab7('0x56')][_0xdab7('0x4d')]);_0x41a8d9[_0xdab7('0x39')]=_[_0xdab7('0x3a')](_0x2d926e[_0xdab7('0x39')]);_0x41a8d9[_0xdab7('0x3b')]=_['intersection'](_0x41a8d9[_0xdab7('0x3d')],_0x41a8d9[_0xdab7('0x39')]);_0x5fcef2[_0xdab7('0x3e')]=_['intersection'](_0x41a8d9[_0xdab7('0x3d')],qs['fields'](_0x2d926e[_0xdab7('0x39')][_0xdab7('0x3f')]));_0x5fcef2[_0xdab7('0x3e')]=_0x5fcef2[_0xdab7('0x3e')][_0xdab7('0x4e')]?_0x5fcef2[_0xdab7('0x3e')]:_0x41a8d9[_0xdab7('0x3d')];_0x5fcef2[_0xdab7('0x41')]=qs[_0xdab7('0x42')](_0x2d926e[_0xdab7('0x39')][_0xdab7('0x42')]);_0x5fcef2[_0xdab7('0x43')]=qs['filters'](_[_0xdab7('0x44')](_0x2d926e[_0xdab7('0x39')],_0x41a8d9[_0xdab7('0x3b')]));if(_0x2d926e[_0xdab7('0x39')][_0xdab7('0x45')]){_0x5fcef2[_0xdab7('0x43')]=_['merge'](_0x5fcef2[_0xdab7('0x43')],{'$or':_[_0xdab7('0x38')](_0x5fcef2[_0xdab7('0x3e')],function(_0x48010b){var _0x18696b={};_0x18696b[_0x48010b]={'$like':'%'+_0x2d926e[_0xdab7('0x39')]['filter']+'%'};return _0x18696b;})});}_0x5fcef2=_[_0xdab7('0x46')]({},_0x5fcef2,_0x2d926e[_0xdab7('0x50')]);return _0x4c9d1a[_0xdab7('0x54')](_0x5fcef2);}})[_0xdab7('0x19')](function(_0x1e8cc5){if(_0x1e8cc5){_0x297bb4=_0x1e8cc5[_0xdab7('0x4e')];if(!_0x2d926e[_0xdab7('0x39')][_0xdab7('0x57')](_0xdab7('0x40'))){_0x5fcef2[_0xdab7('0x2a')]=qs[_0xdab7('0x2a')](_0x2d926e[_0xdab7('0x39')][_0xdab7('0x2a')]);_0x5fcef2[_0xdab7('0x29')]=qs[_0xdab7('0x29')](_0x2d926e[_0xdab7('0x39')][_0xdab7('0x29')]);}return _0x4c9d1a[_0xdab7('0x54')](_0x5fcef2);}})['then'](function(_0x3cf217){if(_0x3cf217){return _0x3cf217?{'count':_0x297bb4,'rows':_0x3cf217}:null;}})[_0xdab7('0x19')](respondWithResult(_0x3c5bbf,null))[_0xdab7('0x23')](handleError(_0x3c5bbf,null));};exports['getSubjects']=function(_0x5bdbdc,_0x37aebf,_0x4d6749){var _0x234a72={};var _0x4b85a0={};var _0xf42cf9;var _0x295a51;return db[_0xdab7('0x35')][_0xdab7('0x55')]({'where':{'id':_0x5bdbdc[_0xdab7('0x4c')]['id']}})[_0xdab7('0x19')](handleEntityNotFound(_0x37aebf,null))['then'](function(_0x53bf49){if(_0x53bf49){_0xf42cf9=_0x53bf49;_0x4b85a0['model']=_[_0xdab7('0x3a')](db['FreshdeskField'][_0xdab7('0x4d')]);_0x4b85a0['query']=_['keys'](_0x5bdbdc[_0xdab7('0x39')]);_0x4b85a0[_0xdab7('0x3b')]=_[_0xdab7('0x3c')](_0x4b85a0['model'],_0x4b85a0['query']);_0x234a72[_0xdab7('0x3e')]=_[_0xdab7('0x3c')](_0x4b85a0[_0xdab7('0x3d')],qs[_0xdab7('0x3f')](_0x5bdbdc[_0xdab7('0x39')]['fields']));_0x234a72['attributes']=_0x234a72[_0xdab7('0x3e')]['length']?_0x234a72[_0xdab7('0x3e')]:_0x4b85a0[_0xdab7('0x3d')];_0x234a72[_0xdab7('0x41')]=qs[_0xdab7('0x42')](_0x5bdbdc[_0xdab7('0x39')]['sort']);_0x234a72[_0xdab7('0x43')]=qs[_0xdab7('0x3b')](_['pick'](_0x5bdbdc[_0xdab7('0x39')],_0x4b85a0[_0xdab7('0x3b')]));if(_0x5bdbdc[_0xdab7('0x39')][_0xdab7('0x45')]){_0x234a72[_0xdab7('0x43')]=_['merge'](_0x234a72[_0xdab7('0x43')],{'$or':_['map'](_0x234a72['attributes'],function(_0x5c068a){var _0x2ec08c={};_0x2ec08c[_0x5c068a]={'$like':'%'+_0x5bdbdc['query'][_0xdab7('0x45')]+'%'};return _0x2ec08c;})});}_0x234a72=_['merge']({},_0x234a72,_0x5bdbdc[_0xdab7('0x50')]);return _0xf42cf9[_0xdab7('0x58')](_0x234a72);}})[_0xdab7('0x19')](function(_0x44b1c3){if(_0x44b1c3){_0x295a51=_0x44b1c3[_0xdab7('0x4e')];if(!_0x5bdbdc[_0xdab7('0x39')]['hasOwnProperty'](_0xdab7('0x40'))){_0x234a72[_0xdab7('0x2a')]=qs[_0xdab7('0x2a')](_0x5bdbdc[_0xdab7('0x39')]['limit']);_0x234a72[_0xdab7('0x29')]=qs[_0xdab7('0x29')](_0x5bdbdc[_0xdab7('0x39')]['offset']);}return _0xf42cf9[_0xdab7('0x58')](_0x234a72);}})[_0xdab7('0x19')](function(_0x289dfa){if(_0x289dfa){return _0x289dfa?{'count':_0x295a51,'rows':_0x289dfa}:null;}})[_0xdab7('0x19')](respondWithResult(_0x37aebf,null))[_0xdab7('0x23')](handleError(_0x37aebf,null));};exports[_0xdab7('0x59')]=function(_0x3eac14,_0x226ccc,_0x569d74){var _0x5c5bce={};var _0x26ffe1={};var _0x19ed87;var _0x1317bf;return db[_0xdab7('0x35')][_0xdab7('0x55')]({'where':{'id':_0x3eac14[_0xdab7('0x4c')]['id']}})[_0xdab7('0x19')](handleEntityNotFound(_0x226ccc,null))[_0xdab7('0x19')](function(_0x3bdbfb){if(_0x3bdbfb){_0x19ed87=_0x3bdbfb;_0x26ffe1['model']=_[_0xdab7('0x3a')](db[_0xdab7('0x56')][_0xdab7('0x4d')]);_0x26ffe1[_0xdab7('0x39')]=_[_0xdab7('0x3a')](_0x3eac14[_0xdab7('0x39')]);_0x26ffe1['filters']=_[_0xdab7('0x3c')](_0x26ffe1[_0xdab7('0x3d')],_0x26ffe1['query']);_0x5c5bce[_0xdab7('0x3e')]=_['intersection'](_0x26ffe1[_0xdab7('0x3d')],qs[_0xdab7('0x3f')](_0x3eac14[_0xdab7('0x39')][_0xdab7('0x3f')]));_0x5c5bce[_0xdab7('0x3e')]=_0x5c5bce['attributes'][_0xdab7('0x4e')]?_0x5c5bce[_0xdab7('0x3e')]:_0x26ffe1[_0xdab7('0x3d')];_0x5c5bce[_0xdab7('0x41')]=qs['sort'](_0x3eac14[_0xdab7('0x39')][_0xdab7('0x42')]);_0x5c5bce['where']=qs[_0xdab7('0x3b')](_['pick'](_0x3eac14[_0xdab7('0x39')],_0x26ffe1[_0xdab7('0x3b')]));if(_0x3eac14[_0xdab7('0x39')][_0xdab7('0x45')]){_0x5c5bce[_0xdab7('0x43')]=_[_0xdab7('0x46')](_0x5c5bce['where'],{'$or':_[_0xdab7('0x38')](_0x5c5bce['attributes'],function(_0x465b44){var _0x584516={};_0x584516[_0x465b44]={'$like':'%'+_0x3eac14['query']['filter']+'%'};return _0x584516;})});}_0x5c5bce=_['merge']({},_0x5c5bce,_0x3eac14[_0xdab7('0x50')]);return _0x19ed87['getDescriptions'](_0x5c5bce);}})[_0xdab7('0x19')](function(_0x16c1cf){if(_0x16c1cf){_0x1317bf=_0x16c1cf[_0xdab7('0x4e')];if(!_0x3eac14['query'][_0xdab7('0x57')](_0xdab7('0x40'))){_0x5c5bce['limit']=qs[_0xdab7('0x2a')](_0x3eac14[_0xdab7('0x39')]['limit']);_0x5c5bce['offset']=qs['offset'](_0x3eac14[_0xdab7('0x39')][_0xdab7('0x29')]);}return _0x19ed87[_0xdab7('0x59')](_0x5c5bce);}})['then'](function(_0x3b66a8){if(_0x3b66a8){return _0x3b66a8?{'count':_0x1317bf,'rows':_0x3b66a8}:null;}})[_0xdab7('0x19')](respondWithResult(_0x226ccc,null))[_0xdab7('0x23')](handleError(_0x226ccc,null));};exports[_0xdab7('0x5a')]=function(_0x5a7472,_0x190874,_0x344562){var _0x5d0b41={};var _0x41add9={};var _0x14dda8;var _0x549805;return db[_0xdab7('0x35')][_0xdab7('0x55')]({'where':{'id':_0x5a7472[_0xdab7('0x4c')]['id']}})[_0xdab7('0x19')](handleEntityNotFound(_0x190874,null))[_0xdab7('0x19')](function(_0x367ee2){if(_0x367ee2){_0x14dda8=_0x367ee2;_0x41add9[_0xdab7('0x3d')]=_['keys'](db[_0xdab7('0x5b')][_0xdab7('0x4d')]);_0x41add9[_0xdab7('0x39')]=_[_0xdab7('0x3a')](_0x5a7472[_0xdab7('0x39')]);_0x41add9[_0xdab7('0x3b')]=_[_0xdab7('0x3c')](_0x41add9[_0xdab7('0x3d')],_0x41add9[_0xdab7('0x39')]);_0x5d0b41[_0xdab7('0x3e')]=_[_0xdab7('0x3c')](_0x41add9[_0xdab7('0x3d')],qs[_0xdab7('0x3f')](_0x5a7472[_0xdab7('0x39')][_0xdab7('0x3f')]));_0x5d0b41[_0xdab7('0x3e')]=_0x5d0b41[_0xdab7('0x3e')][_0xdab7('0x4e')]?_0x5d0b41['attributes']:_0x41add9['model'];_0x5d0b41['order']=qs['sort'](_0x5a7472[_0xdab7('0x39')][_0xdab7('0x42')]);_0x5d0b41[_0xdab7('0x43')]=qs['filters'](_[_0xdab7('0x44')](_0x5a7472[_0xdab7('0x39')],_0x41add9['filters']));if(_0x5a7472[_0xdab7('0x39')]['filter']){_0x5d0b41[_0xdab7('0x43')]=_[_0xdab7('0x46')](_0x5d0b41['where'],{'$or':_[_0xdab7('0x38')](_0x5d0b41[_0xdab7('0x3e')],function(_0x5402e3){var _0x26b9e0={};_0x26b9e0[_0x5402e3]={'$like':'%'+_0x5a7472[_0xdab7('0x39')][_0xdab7('0x45')]+'%'};return _0x26b9e0;})});}_0x5d0b41=_[_0xdab7('0x46')]({},_0x5d0b41,_0x5a7472[_0xdab7('0x50')]);return _0x14dda8[_0xdab7('0x5a')](_0x5d0b41);}})[_0xdab7('0x19')](function(_0x132a81){if(_0x132a81){_0x549805=_0x132a81[_0xdab7('0x4e')];if(!_0x5a7472[_0xdab7('0x39')][_0xdab7('0x57')](_0xdab7('0x40'))){_0x5d0b41[_0xdab7('0x2a')]=qs[_0xdab7('0x2a')](_0x5a7472['query'][_0xdab7('0x2a')]);_0x5d0b41[_0xdab7('0x29')]=qs[_0xdab7('0x29')](_0x5a7472[_0xdab7('0x39')]['offset']);}return _0x14dda8['getTags'](_0x5d0b41);}})[_0xdab7('0x19')](function(_0x817c00){if(_0x817c00){return _0x817c00?{'count':_0x549805,'rows':_0x817c00}:null;}})[_0xdab7('0x19')](respondWithResult(_0x190874,null))['catch'](handleError(_0x190874,null));};exports[_0xdab7('0x5c')]=function(_0x13d9a2,_0x130382,_0x4c533e){if(_0x13d9a2[_0xdab7('0x53')]['id']){delete _0x13d9a2[_0xdab7('0x53')]['id'];}return db['FreshdeskConfiguration'][_0xdab7('0x55')]({'where':{'id':_0x13d9a2[_0xdab7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x130382,null))[_0xdab7('0x19')](function(_0x52747d){if(_0x52747d){return _0x52747d[_0xdab7('0x5c')](_0x13d9a2[_0xdab7('0x53')][_0xdab7('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x130382,null))[_0xdab7('0x23')](handleError(_0x130382,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 4d60a22..d34cfe3 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 _0xa6d0=['moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger'];(function(_0x53c9ee,_0x57b41a){var _0x466c12=function(_0x3f9eec){while(--_0x3f9eec){_0x53c9ee['push'](_0x53c9ee['shift']());}};_0x466c12(++_0x57b41a);}(_0xa6d0,0x18a));var _0x0a6d=function(_0x580785,_0x48200a){_0x580785=_0x580785-0x0;var _0xad9853=_0xa6d0[_0x580785];return _0xad9853;};'use strict';var _=require('lodash');var util=require(_0x0a6d('0x0'));var logger=require(_0x0a6d('0x1'))('api');var moment=require(_0x0a6d('0x2'));var BPromise=require(_0x0a6d('0x3'));var rp=require(_0x0a6d('0x4'));var fs=require('fs');var path=require(_0x0a6d('0x5'));var rimraf=require(_0x0a6d('0x6'));var config=require('../../config/environment');var attributes=require(_0x0a6d('0x7'));module[_0x0a6d('0x8')]=function(_0x328495,_0x37e13f){return _0x328495['define'](_0x0a6d('0x9'),attributes,{'tableName':_0x0a6d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e52=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x14db85,_0x2a912a){var _0x342c5c=function(_0x12a837){while(--_0x12a837){_0x14db85['push'](_0x14db85['shift']());}};_0x342c5c(++_0x2a912a);}(_0x8e52,0x118));var _0x28e5=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x8e52[_0x112fe3];return _0x1ec903;};'use strict';var _=require(_0x28e5('0x0'));var util=require(_0x28e5('0x1'));var logger=require(_0x28e5('0x2'))(_0x28e5('0x3'));var moment=require(_0x28e5('0x4'));var BPromise=require(_0x28e5('0x5'));var rp=require(_0x28e5('0x6'));var fs=require('fs');var path=require(_0x28e5('0x7'));var rimraf=require(_0x28e5('0x8'));var config=require(_0x28e5('0x9'));var attributes=require(_0x28e5('0xa'));module[_0x28e5('0xb')]=function(_0x2abdda,_0x14aec2){return _0x2abdda[_0x28e5('0xc')](_0x28e5('0xd'),attributes,{'tableName':_0x28e5('0xe'),'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 bdae738..3cd49ee 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 _0x3c41=['client','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x3c41,0x70));var _0x13c4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3c41[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x13c4('0x0'));var util=require(_0x13c4('0x1'));var moment=require(_0x13c4('0x2'));var BPromise=require(_0x13c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x13c4('0x5'))(_0x13c4('0x6'));var config=require(_0x13c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220545,_0x4454a2,_0x1b59d0){return new BPromise(function(_0x4b0905,_0x2d4642){return client[_0x13c4('0x9')](_0x220545,_0x1b59d0)[_0x13c4('0xa')](function(_0x53b488){logger['info'](_0x13c4('0xb'),_0x4454a2,_0x13c4('0xc'));logger['debug'](_0x13c4('0xd'),_0x4454a2,_0x13c4('0xc'),JSON[_0x13c4('0xe')](_0x53b488));if(_0x53b488[_0x13c4('0xf')]){if(_0x53b488[_0x13c4('0xf')]['code']===0x1f4){logger[_0x13c4('0xf')](_0x13c4('0xb'),_0x4454a2,_0x53b488['error'][_0x13c4('0x10')]);return _0x2d4642(_0x53b488['error'][_0x13c4('0x10')]);}logger[_0x13c4('0xf')](_0x13c4('0xb'),_0x4454a2,_0x53b488[_0x13c4('0xf')][_0x13c4('0x10')]);return _0x4b0905(_0x53b488[_0x13c4('0xf')]['message']);}else{logger[_0x13c4('0x11')](_0x13c4('0xb'),_0x4454a2,'request\x20sent');_0x4b0905(_0x53b488[_0x13c4('0x12')]['message']);}})[_0x13c4('0x13')](function(_0x51ca51){logger[_0x13c4('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4454a2,_0x51ca51);_0x2d4642(_0x51ca51);});});} \ No newline at end of file +var _0x4033=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3a7118,_0x5072b8){var _0x2b64b4=function(_0x5255d7){while(--_0x5255d7){_0x3a7118['push'](_0x3a7118['shift']());}};_0x2b64b4(++_0x5072b8);}(_0x4033,0x1c1));var _0x3403=function(_0xbc4659,_0x578fba){_0xbc4659=_0xbc4659-0x0;var _0x5831f9=_0x4033[_0xbc4659];return _0x5831f9;};'use strict';var _=require(_0x3403('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3403('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3403('0x2'))['db'];var utils=require(_0x3403('0x3'));var logger=require(_0x3403('0x4'))(_0x3403('0x5'));var config=require(_0x3403('0x6'));var jayson=require(_0x3403('0x7'));var client=jayson[_0x3403('0x8')][_0x3403('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x884ec0,_0x55f13a,_0x54b238){return new BPromise(function(_0x40d1f5,_0x497530){return client[_0x3403('0xa')](_0x884ec0,_0x54b238)[_0x3403('0xb')](function(_0x2431dc){logger[_0x3403('0xc')](_0x3403('0xd'),_0x55f13a,_0x3403('0xe'));logger[_0x3403('0xf')](_0x3403('0x10'),_0x55f13a,'request\x20sent',JSON[_0x3403('0x11')](_0x2431dc));if(_0x2431dc[_0x3403('0x12')]){if(_0x2431dc['error'][_0x3403('0x13')]===0x1f4){logger[_0x3403('0x12')](_0x3403('0xd'),_0x55f13a,_0x2431dc[_0x3403('0x12')]['message']);return _0x497530(_0x2431dc[_0x3403('0x12')]['message']);}logger[_0x3403('0x12')](_0x3403('0xd'),_0x55f13a,_0x2431dc['error'][_0x3403('0x14')]);return _0x40d1f5(_0x2431dc[_0x3403('0x12')][_0x3403('0x14')]);}else{logger[_0x3403('0xc')](_0x3403('0xd'),_0x55f13a,_0x3403('0xe'));_0x40d1f5(_0x2431dc[_0x3403('0x15')][_0x3403('0x14')]);}})[_0x3403('0x16')](function(_0x29b905){logger[_0x3403('0x12')](_0x3403('0xd'),_0x55f13a,_0x29b905);_0x497530(_0x29b905);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9fa7e7d..9a924e7 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 _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x370bb4,_0x1e46a2){var _0x2ca68b=function(_0x18823a){while(--_0x18823a){_0x370bb4['push'](_0x370bb4['shift']());}};_0x2ca68b(++_0x1e46a2);}(_0x008c,0x188));var _0xc008=function(_0x57ec1a,_0x2b7624){_0x57ec1a=_0x57ec1a-0x0;var _0x2159ad=_0x008c[_0x57ec1a];return _0x2159ad;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x42ad21,_0x12e262){var _0x46a5ab=function(_0x1f3aab){while(--_0x1f3aab){_0x42ad21['push'](_0x42ad21['shift']());}};_0x46a5ab(++_0x12e262);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 32c6c91..8f5ac25 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 _0xf131=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x4cdcb9,_0x39b0e8){var _0x2a5445=function(_0x4f10af){while(--_0x4f10af){_0x4cdcb9['push'](_0x4cdcb9['shift']());}};_0x2a5445(++_0x39b0e8);}(_0xf131,0x1a1));var _0x1f13=function(_0xfb5eb3,_0x40fb6b){_0xfb5eb3=_0xfb5eb3-0x0;var _0xa0add2=_0xf131[_0xfb5eb3];return _0xa0add2;};'use strict';var Sequelize=require(_0x1f13('0x0'));module[_0x1f13('0x1')]={'type':{'type':Sequelize[_0x1f13('0x2')](_0x1f13('0x3'),_0x1f13('0x4'),_0x1f13('0x5'),_0x1f13('0x6')),'defaultValue':_0x1f13('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1f13('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1f13('0x3'),_0x1f13('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1f13('0x7')]},'idField':{'type':Sequelize[_0x1f13('0x7')]},'nameField':{'type':Sequelize[_0x1f13('0x7')]},'customField':{'type':Sequelize[_0x1f13('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f13('0x7')]}}; \ No newline at end of file +var _0xb91a=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xb91a,0xf4));var _0xab91=function(_0x44e3c5,_0x3ba112){_0x44e3c5=_0x44e3c5-0x0;var _0x50f515=_0xb91a[_0x44e3c5];return _0x50f515;};'use strict';var Sequelize=require(_0xab91('0x0'));module[_0xab91('0x1')]={'type':{'type':Sequelize[_0xab91('0x2')]('string','variable',_0xab91('0x3'),_0xab91('0x4')),'defaultValue':_0xab91('0x5')},'content':{'type':Sequelize[_0xab91('0x6')]},'key':{'type':Sequelize[_0xab91('0x6')]},'keyType':{'type':Sequelize[_0xab91('0x2')](_0xab91('0x5'),_0xab91('0x7'),_0xab91('0x3'))},'keyContent':{'type':Sequelize[_0xab91('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xab91('0x6')]},'customField':{'type':Sequelize[_0xab91('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 021f174..9e93cc5 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 _0xdcf2=['path','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x24256d,_0x2b97c5){var _0x38fde8=function(_0x5c851e){while(--_0x5c851e){_0x24256d['push'](_0x24256d['shift']());}};_0x38fde8(++_0x2b97c5);}(_0xdcf2,0x115));var _0x2dcf=function(_0x41c7ee,_0x4a3022){_0x41c7ee=_0x41c7ee-0x0;var _0x1768a8=_0xdcf2[_0x41c7ee];return _0x1768a8;};'use strict';var pdf=require(_0x2dcf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2dcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2dcf('0x2'));var moment=require(_0x2dcf('0x3'));var BPromise=require(_0x2dcf('0x4'));var Mustache=require(_0x2dcf('0x5'));var util=require(_0x2dcf('0x6'));var path=require(_0x2dcf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2dcf('0x8'));var fs=require('fs');var _=require(_0x2dcf('0x9'));var squel=require(_0x2dcf('0xa'));var crypto=require('crypto');var jsforce=require(_0x2dcf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dcf('0xc'));var Papa=require(_0x2dcf('0xd'));var Redis=require(_0x2dcf('0xe'));var authService=require(_0x2dcf('0xf'));var qs=require(_0x2dcf('0x10'));var as=require(_0x2dcf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2dcf('0x12'));var licenseUtil=require(_0x2dcf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ef07,_0x3f78b4){_0x3f78b4=_0x3f78b4||0xcc;return function(_0x157a7e){if(_0x157a7e){return _0x35ef07['sendStatus'](_0x3f78b4);}return _0x35ef07[_0x2dcf('0x14')](_0x3f78b4)[_0x2dcf('0x15')]();};}function respondWithResult(_0x13f03d,_0x447c01){_0x447c01=_0x447c01||0xc8;return function(_0x53833c){if(_0x53833c){return _0x13f03d['status'](_0x447c01)[_0x2dcf('0x16')](_0x53833c);}};}function respondWithFilteredResult(_0x36835b,_0x33a3c6){return function(_0xa01830){if(_0xa01830){var _0x527e41=_0xa01830[_0x2dcf('0x17')],_0x51b683=_0x33a3c6[_0x2dcf('0x18')],_0x5dac7f=_0x33a3c6[_0x2dcf('0x18')]+_0x33a3c6[_0x2dcf('0x19')],_0x4594dd;if(_0x5dac7f>=_0x527e41){_0x5dac7f=_0x527e41;_0x4594dd=0xc8;}else{_0x4594dd=0xce;}_0x36835b[_0x2dcf('0x14')](_0x4594dd);return _0x36835b[_0x2dcf('0x1a')](_0x2dcf('0x1b'),_0x51b683+'-'+_0x5dac7f+'/'+_0x527e41)[_0x2dcf('0x16')](_0xa01830);}return null;};}function patchUpdates(_0x4b55da){return function(_0x5c48c0){try{jsonpatch[_0x2dcf('0x1c')](_0x5c48c0,_0x4b55da,!![]);}catch(_0x1c1f58){return BPromise[_0x2dcf('0x1d')](_0x1c1f58);}return _0x5c48c0[_0x2dcf('0x1e')]();};}function saveUpdates(_0x2e5fa6,_0x266763){return function(_0x590f69){if(_0x590f69){return _0x590f69[_0x2dcf('0x1f')](_0x2e5fa6)[_0x2dcf('0x20')](function(_0x421cb1){return _0x421cb1;});}return null;};}function removeEntity(_0x40e1a0,_0x2acaa9){return function(_0x3d52d9){if(_0x3d52d9){return _0x3d52d9[_0x2dcf('0x21')]()[_0x2dcf('0x20')](function(){_0x40e1a0['status'](0xcc)[_0x2dcf('0x15')]();});}};}function handleEntityNotFound(_0x1f4ffd,_0x2c71c2){return function(_0x322e96){if(!_0x322e96){_0x1f4ffd[_0x2dcf('0x22')](0x194);}return _0x322e96;};}function handleError(_0x5d8024,_0x5f2cd3){_0x5f2cd3=_0x5f2cd3||0x1f4;return function(_0xa259dd){logger[_0x2dcf('0x23')](_0xa259dd[_0x2dcf('0x24')]);if(_0xa259dd['name']){delete _0xa259dd[_0x2dcf('0x25')];}_0x5d8024[_0x2dcf('0x14')](_0x5f2cd3)[_0x2dcf('0x26')](_0xa259dd);};}exports['index']=function(_0x265178,_0x151daa){var _0x3f1f8a={},_0x34c854={},_0x4153a8={'count':0x0,'rows':[]};var _0x2c29d1=_[_0x2dcf('0x27')](db[_0x2dcf('0x28')][_0x2dcf('0x29')],function(_0x3ae779){return{'name':_0x3ae779[_0x2dcf('0x2a')],'type':_0x3ae779[_0x2dcf('0x2b')][_0x2dcf('0x2c')]};});_0x34c854['model']=_[_0x2dcf('0x27')](_0x2c29d1,_0x2dcf('0x25'));_0x34c854['query']=_[_0x2dcf('0x2d')](_0x265178[_0x2dcf('0x2e')]);_0x34c854['filters']=_['intersection'](_0x34c854[_0x2dcf('0x2f')],_0x34c854[_0x2dcf('0x2e')]);_0x3f1f8a['attributes']=_[_0x2dcf('0x30')](_0x34c854[_0x2dcf('0x2f')],qs['fields'](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x31')]));_0x3f1f8a[_0x2dcf('0x32')]=_0x3f1f8a[_0x2dcf('0x32')][_0x2dcf('0x33')]?_0x3f1f8a[_0x2dcf('0x32')]:_0x34c854[_0x2dcf('0x2f')];if(!_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x34')](_0x2dcf('0x35'))){_0x3f1f8a[_0x2dcf('0x19')]=qs[_0x2dcf('0x19')](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x19')]);_0x3f1f8a[_0x2dcf('0x18')]=qs[_0x2dcf('0x18')](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x18')]);}_0x3f1f8a['order']=qs[_0x2dcf('0x36')](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x36')]);_0x3f1f8a['where']=qs[_0x2dcf('0x37')](_[_0x2dcf('0x38')](_0x265178[_0x2dcf('0x2e')],_0x34c854[_0x2dcf('0x37')]),_0x2c29d1);if(_0x265178[_0x2dcf('0x2e')]['filter']){_0x3f1f8a['where']=_[_0x2dcf('0x39')](_0x3f1f8a[_0x2dcf('0x3a')],{'$or':_[_0x2dcf('0x27')](_0x2c29d1,function(_0x53354f){if(_0x53354f[_0x2dcf('0x2b')]!==_0x2dcf('0x3b')){var _0x50d6dd={};_0x50d6dd[_0x53354f['name']]={'$like':'%'+_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x3c')]+'%'};return _0x50d6dd;}})});}_0x3f1f8a=_['merge']({},_0x3f1f8a,_0x265178[_0x2dcf('0x3d')]);var _0x3e437c={'where':_0x3f1f8a['where']};return db[_0x2dcf('0x28')][_0x2dcf('0x17')](_0x3e437c)[_0x2dcf('0x20')](function(_0x11ac5d){_0x4153a8[_0x2dcf('0x17')]=_0x11ac5d;if(_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x3e')]){_0x3f1f8a[_0x2dcf('0x3f')]=[{'all':!![]}];}return db[_0x2dcf('0x28')][_0x2dcf('0x40')](_0x3f1f8a);})[_0x2dcf('0x20')](function(_0x5e613b){_0x4153a8[_0x2dcf('0x41')]=_0x5e613b;return _0x4153a8;})['then'](respondWithFilteredResult(_0x151daa,_0x3f1f8a))[_0x2dcf('0x42')](handleError(_0x151daa,null));};exports['show']=function(_0x2cc589,_0x35e708){var _0x1fbd59={'raw':!![],'where':{'id':_0x2cc589[_0x2dcf('0x43')]['id']}},_0x31a62f={};_0x31a62f[_0x2dcf('0x2f')]=_[_0x2dcf('0x2d')](db[_0x2dcf('0x28')][_0x2dcf('0x29')]);_0x31a62f[_0x2dcf('0x2e')]=_[_0x2dcf('0x2d')](_0x2cc589[_0x2dcf('0x2e')]);_0x31a62f[_0x2dcf('0x37')]=_[_0x2dcf('0x30')](_0x31a62f[_0x2dcf('0x2f')],_0x31a62f[_0x2dcf('0x2e')]);_0x1fbd59[_0x2dcf('0x32')]=_[_0x2dcf('0x30')](_0x31a62f['model'],qs['fields'](_0x2cc589[_0x2dcf('0x2e')][_0x2dcf('0x31')]));_0x1fbd59[_0x2dcf('0x32')]=_0x1fbd59[_0x2dcf('0x32')][_0x2dcf('0x33')]?_0x1fbd59[_0x2dcf('0x32')]:_0x31a62f['model'];if(_0x2cc589['query']['includeAll']){_0x1fbd59[_0x2dcf('0x3f')]=[{'all':!![]}];}_0x1fbd59=_['merge']({},_0x1fbd59,_0x2cc589['options']);return db['FreshdeskField'][_0x2dcf('0x44')](_0x1fbd59)[_0x2dcf('0x20')](handleEntityNotFound(_0x35e708,null))[_0x2dcf('0x20')](respondWithResult(_0x35e708,null))['catch'](handleError(_0x35e708,null));};exports[_0x2dcf('0x45')]=function(_0x145374,_0x711daa){return db[_0x2dcf('0x28')][_0x2dcf('0x45')](_0x145374['body'],{})['then'](respondWithResult(_0x711daa,0xc9))[_0x2dcf('0x42')](handleError(_0x711daa,null));};exports[_0x2dcf('0x1f')]=function(_0x170265,_0x17a93b){if(_0x170265[_0x2dcf('0x46')]['id']){delete _0x170265[_0x2dcf('0x46')]['id'];}return db[_0x2dcf('0x28')]['find']({'where':{'id':_0x170265[_0x2dcf('0x43')]['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x17a93b,null))[_0x2dcf('0x20')](saveUpdates(_0x170265[_0x2dcf('0x46')],null))['then'](respondWithResult(_0x17a93b,null))['catch'](handleError(_0x17a93b,null));};exports[_0x2dcf('0x21')]=function(_0x33951f,_0x18da28){return db[_0x2dcf('0x28')]['find']({'where':{'id':_0x33951f[_0x2dcf('0x43')]['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x18da28,null))[_0x2dcf('0x20')](removeEntity(_0x18da28,null))[_0x2dcf('0x42')](handleError(_0x18da28,null));}; \ No newline at end of file +var _0x57d4=['status','json','offset','set','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskField','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x57d4,0x78));var _0x457d=function(_0x536d78,_0x3ee5c3){_0x536d78=_0x536d78-0x0;var _0x140881=_0x57d4[_0x536d78];return _0x140881;};'use strict';var pdf=require(_0x457d('0x0'));var emlformat=require(_0x457d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x457d('0x2'));var jsonpatch=require(_0x457d('0x3'));var rp=require(_0x457d('0x4'));var moment=require(_0x457d('0x5'));var BPromise=require(_0x457d('0x6'));var Mustache=require(_0x457d('0x7'));var util=require(_0x457d('0x8'));var path=require(_0x457d('0x9'));var sox=require(_0x457d('0xa'));var csv=require(_0x457d('0xb'));var ejs=require(_0x457d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x457d('0xd'));var crypto=require(_0x457d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x457d('0xb'));var querystring=require(_0x457d('0xf'));var Papa=require(_0x457d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x457d('0x11'));var hardwareService=require(_0x457d('0x12'));var logger=require(_0x457d('0x13'))(_0x457d('0x14'));var utils=require(_0x457d('0x15'));var config=require(_0x457d('0x16'));var licenseUtil=require(_0x457d('0x17'));var db=require(_0x457d('0x18'))['db'];function respondWithStatusCode(_0xe7d200,_0x5abf49){_0x5abf49=_0x5abf49||0xcc;return function(_0x239a20){if(_0x239a20){return _0xe7d200[_0x457d('0x19')](_0x5abf49);}return _0xe7d200['status'](_0x5abf49)['end']();};}function respondWithResult(_0x44740f,_0x19ac04){_0x19ac04=_0x19ac04||0xc8;return function(_0x3e59d9){if(_0x3e59d9){return _0x44740f[_0x457d('0x1a')](_0x19ac04)[_0x457d('0x1b')](_0x3e59d9);}};}function respondWithFilteredResult(_0x3e62f8,_0xeac953){return function(_0x38cce1){if(_0x38cce1){var _0x55c6e4=_0x38cce1['count'],_0xc9b3f8=_0xeac953['offset'],_0x1ebc33=_0xeac953[_0x457d('0x1c')]+_0xeac953['limit'],_0x2c05ca;if(_0x1ebc33>=_0x55c6e4){_0x1ebc33=_0x55c6e4;_0x2c05ca=0xc8;}else{_0x2c05ca=0xce;}_0x3e62f8[_0x457d('0x1a')](_0x2c05ca);return _0x3e62f8[_0x457d('0x1d')]('Content-Range',_0xc9b3f8+'-'+_0x1ebc33+'/'+_0x55c6e4)[_0x457d('0x1b')](_0x38cce1);}return null;};}function patchUpdates(_0x553dce){return function(_0x5e6400){try{jsonpatch[_0x457d('0x1e')](_0x5e6400,_0x553dce,!![]);}catch(_0xe6cfcc){return BPromise[_0x457d('0x1f')](_0xe6cfcc);}return _0x5e6400[_0x457d('0x20')]();};}function saveUpdates(_0xc47d13,_0x59c1b1){return function(_0x1cc0ba){if(_0x1cc0ba){return _0x1cc0ba[_0x457d('0x21')](_0xc47d13)[_0x457d('0x22')](function(_0x46fe6a){return _0x46fe6a;});}return null;};}function removeEntity(_0x57f229,_0x4bf90d){return function(_0x4e2dff){if(_0x4e2dff){return _0x4e2dff[_0x457d('0x23')]()['then'](function(){_0x57f229['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x206fdc,_0x1eedc5){return function(_0x5bf818){if(!_0x5bf818){_0x206fdc[_0x457d('0x19')](0x194);}return _0x5bf818;};}function handleError(_0x115b1b,_0x12bfca){_0x12bfca=_0x12bfca||0x1f4;return function(_0x152cfc){logger['error'](_0x152cfc['stack']);if(_0x152cfc[_0x457d('0x24')]){delete _0x152cfc['name'];}_0x115b1b[_0x457d('0x1a')](_0x12bfca)[_0x457d('0x25')](_0x152cfc);};}exports[_0x457d('0x26')]=function(_0x1bc311,_0x54de66){var _0x298dd4={},_0x57a47f={},_0x4eb5ca={'count':0x0,'rows':[]};var _0x1945f5=_[_0x457d('0x27')](db['FreshdeskField'][_0x457d('0x28')],function(_0x2d69d2){return{'name':_0x2d69d2['fieldName'],'type':_0x2d69d2[_0x457d('0x29')][_0x457d('0x2a')]};});_0x57a47f[_0x457d('0x2b')]=_[_0x457d('0x27')](_0x1945f5,_0x457d('0x24'));_0x57a47f[_0x457d('0x2c')]=_[_0x457d('0x2d')](_0x1bc311[_0x457d('0x2c')]);_0x57a47f[_0x457d('0x2e')]=_[_0x457d('0x2f')](_0x57a47f[_0x457d('0x2b')],_0x57a47f[_0x457d('0x2c')]);_0x298dd4[_0x457d('0x30')]=_[_0x457d('0x2f')](_0x57a47f[_0x457d('0x2b')],qs[_0x457d('0x31')](_0x1bc311[_0x457d('0x2c')][_0x457d('0x31')]));_0x298dd4['attributes']=_0x298dd4[_0x457d('0x30')][_0x457d('0x32')]?_0x298dd4['attributes']:_0x57a47f['model'];if(!_0x1bc311[_0x457d('0x2c')][_0x457d('0x33')]('nolimit')){_0x298dd4[_0x457d('0x34')]=qs[_0x457d('0x34')](_0x1bc311[_0x457d('0x2c')][_0x457d('0x34')]);_0x298dd4[_0x457d('0x1c')]=qs[_0x457d('0x1c')](_0x1bc311[_0x457d('0x2c')][_0x457d('0x1c')]);}_0x298dd4[_0x457d('0x35')]=qs[_0x457d('0x36')](_0x1bc311[_0x457d('0x2c')][_0x457d('0x36')]);_0x298dd4[_0x457d('0x37')]=qs[_0x457d('0x2e')](_[_0x457d('0x38')](_0x1bc311['query'],_0x57a47f[_0x457d('0x2e')]),_0x1945f5);if(_0x1bc311['query']['filter']){_0x298dd4['where']=_[_0x457d('0x39')](_0x298dd4['where'],{'$or':_[_0x457d('0x27')](_0x1945f5,function(_0x55e580){if(_0x55e580['type']!==_0x457d('0x3a')){var _0x41fe65={};_0x41fe65[_0x55e580[_0x457d('0x24')]]={'$like':'%'+_0x1bc311[_0x457d('0x2c')][_0x457d('0x3b')]+'%'};return _0x41fe65;}})});}_0x298dd4=_[_0x457d('0x39')]({},_0x298dd4,_0x1bc311[_0x457d('0x3c')]);var _0x818fa3={'where':_0x298dd4[_0x457d('0x37')]};return db[_0x457d('0x3d')][_0x457d('0x3e')](_0x818fa3)[_0x457d('0x22')](function(_0x1cad8c){_0x4eb5ca[_0x457d('0x3e')]=_0x1cad8c;if(_0x1bc311[_0x457d('0x2c')][_0x457d('0x3f')]){_0x298dd4[_0x457d('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0x457d('0x41')](_0x298dd4);})['then'](function(_0xaa8ded){_0x4eb5ca[_0x457d('0x42')]=_0xaa8ded;return _0x4eb5ca;})[_0x457d('0x22')](respondWithFilteredResult(_0x54de66,_0x298dd4))[_0x457d('0x43')](handleError(_0x54de66,null));};exports[_0x457d('0x44')]=function(_0x5bdaf3,_0x4fcb31){var _0x3054f8={'raw':!![],'where':{'id':_0x5bdaf3[_0x457d('0x45')]['id']}},_0x4f7bad={};_0x4f7bad[_0x457d('0x2b')]=_[_0x457d('0x2d')](db['FreshdeskField'][_0x457d('0x28')]);_0x4f7bad[_0x457d('0x2c')]=_[_0x457d('0x2d')](_0x5bdaf3[_0x457d('0x2c')]);_0x4f7bad[_0x457d('0x2e')]=_[_0x457d('0x2f')](_0x4f7bad[_0x457d('0x2b')],_0x4f7bad[_0x457d('0x2c')]);_0x3054f8[_0x457d('0x30')]=_['intersection'](_0x4f7bad['model'],qs[_0x457d('0x31')](_0x5bdaf3[_0x457d('0x2c')][_0x457d('0x31')]));_0x3054f8[_0x457d('0x30')]=_0x3054f8[_0x457d('0x30')][_0x457d('0x32')]?_0x3054f8['attributes']:_0x4f7bad[_0x457d('0x2b')];if(_0x5bdaf3[_0x457d('0x2c')][_0x457d('0x3f')]){_0x3054f8['include']=[{'all':!![]}];}_0x3054f8=_[_0x457d('0x39')]({},_0x3054f8,_0x5bdaf3[_0x457d('0x3c')]);return db[_0x457d('0x3d')]['find'](_0x3054f8)[_0x457d('0x22')](handleEntityNotFound(_0x4fcb31,null))[_0x457d('0x22')](respondWithResult(_0x4fcb31,null))[_0x457d('0x43')](handleError(_0x4fcb31,null));};exports[_0x457d('0x46')]=function(_0x5934a0,_0xdc984c){return db[_0x457d('0x3d')][_0x457d('0x46')](_0x5934a0[_0x457d('0x47')],{})[_0x457d('0x22')](respondWithResult(_0xdc984c,0xc9))[_0x457d('0x43')](handleError(_0xdc984c,null));};exports[_0x457d('0x21')]=function(_0x3f7efa,_0x1faacc){if(_0x3f7efa[_0x457d('0x47')]['id']){delete _0x3f7efa['body']['id'];}return db[_0x457d('0x3d')][_0x457d('0x48')]({'where':{'id':_0x3f7efa[_0x457d('0x45')]['id']}})[_0x457d('0x22')](handleEntityNotFound(_0x1faacc,null))['then'](saveUpdates(_0x3f7efa[_0x457d('0x47')],null))[_0x457d('0x22')](respondWithResult(_0x1faacc,null))[_0x457d('0x43')](handleError(_0x1faacc,null));};exports[_0x457d('0x23')]=function(_0x3f10a8,_0x217a45){return db[_0x457d('0x3d')][_0x457d('0x48')]({'where':{'id':_0x3f10a8['params']['id']}})['then'](handleEntityNotFound(_0x217a45,null))[_0x457d('0x22')](removeEntity(_0x217a45,null))[_0x457d('0x43')](handleError(_0x217a45,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index ddfb5b7..49af4dd 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 _0x90bb=['freshdesk_unique_index','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x3d71d3,_0x11caf1){var _0x30ec87=function(_0x308f30){while(--_0x308f30){_0x3d71d3['push'](_0x3d71d3['shift']());}};_0x30ec87(++_0x11caf1);}(_0x90bb,0xc4));var _0xb90b=function(_0x211fe4,_0x35479b){_0x211fe4=_0x211fe4-0x0;var _0xc6d980=_0x90bb[_0x211fe4];return _0xc6d980;};'use strict';var _=require(_0xb90b('0x0'));var util=require(_0xb90b('0x1'));var logger=require(_0xb90b('0x2'))(_0xb90b('0x3'));var moment=require(_0xb90b('0x4'));var BPromise=require(_0xb90b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb90b('0x6'));var rimraf=require(_0xb90b('0x7'));var config=require(_0xb90b('0x8'));var attributes=require(_0xb90b('0x9'));module[_0xb90b('0xa')]=function(_0x55dce9,_0x19a7a5){return _0x55dce9[_0xb90b('0xb')](_0xb90b('0xc'),attributes,{'tableName':_0xb90b('0xd'),'paranoid':![],'indexes':[{'name':_0xb90b('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf6be=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0xb6c999,_0x3328ae){var _0x2d8851=function(_0x4b59bd){while(--_0x4b59bd){_0xb6c999['push'](_0xb6c999['shift']());}};_0x2d8851(++_0x3328ae);}(_0xf6be,0xb9));var _0xef6b=function(_0x4da3b6,_0x233aff){_0x4da3b6=_0x4da3b6-0x0;var _0x574d38=_0xf6be[_0x4da3b6];return _0x574d38;};'use strict';var _=require(_0xef6b('0x0'));var util=require(_0xef6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xef6b('0x2'));var BPromise=require(_0xef6b('0x3'));var rp=require(_0xef6b('0x4'));var fs=require('fs');var path=require(_0xef6b('0x5'));var rimraf=require(_0xef6b('0x6'));var config=require(_0xef6b('0x7'));var attributes=require(_0xef6b('0x8'));module[_0xef6b('0x9')]=function(_0x4bdadb,_0x49e6d7){return _0x4bdadb['define'](_0xef6b('0xa'),attributes,{'tableName':_0xef6b('0xb'),'paranoid':![],'indexes':[{'name':_0xef6b('0xc'),'fields':[_0xef6b('0xd'),_0xef6b('0xe')],'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 9ef37c2..6b04718 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd6ba,_0x2effd0){var _0x2cf761=function(_0x17d89c){while(--_0x17d89c){_0x3dd6ba['push'](_0x3dd6ba['shift']());}};_0x2cf761(++_0x2effd0);}(_0xb10b,0x12a));var _0xbb10=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0xb10b[_0x251d43];return _0x3d7759;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x499f8d,_0x5bbc69){var _0x347884=function(_0x40eed3){while(--_0x40eed3){_0x499f8d['push'](_0x499f8d['shift']());}};_0x347884(++_0x5bbc69);}(_0xb10b,0x12a));var _0xbb10=function(_0x47195e,_0x347734){_0x47195e=_0x47195e-0x0;var _0x571abb=_0xb10b[_0x47195e];return _0x571abb;};'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 9379732..6f321f1 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 _0x3aaa=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x47fd45,_0x40dd67){var _0x363313=function(_0xb92163){while(--_0xb92163){_0x47fd45['push'](_0x47fd45['shift']());}};_0x363313(++_0x40dd67);}(_0x3aaa,0x8d));var _0xa3aa=function(_0x4e773d,_0x22571a){_0x4e773d=_0x4e773d-0x0;var _0x42363c=_0x3aaa[_0x4e773d];return _0x42363c;};'use strict';var multer=require(_0xa3aa('0x0'));var util=require(_0xa3aa('0x1'));var path=require(_0xa3aa('0x2'));var timeout=require(_0xa3aa('0x3'));var express=require(_0xa3aa('0x4'));var router=express[_0xa3aa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa3aa('0x6'));var config=require(_0xa3aa('0x7'));var controller=require(_0xa3aa('0x8'));router[_0xa3aa('0x9')]('/',auth[_0xa3aa('0xa')](),controller[_0xa3aa('0xb')]);router[_0xa3aa('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa3aa('0x9')](_0xa3aa('0xc'),auth['isAuthenticated'](),controller[_0xa3aa('0xd')]);router['get'](_0xa3aa('0xe'),auth[_0xa3aa('0xa')](),controller[_0xa3aa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa3aa('0x10')]);router[_0xa3aa('0x11')](_0xa3aa('0xc'),auth[_0xa3aa('0xa')](),controller[_0xa3aa('0x12')]);router[_0xa3aa('0x13')](_0xa3aa('0x14'),auth[_0xa3aa('0xa')](),controller['update']);router[_0xa3aa('0x15')](_0xa3aa('0x14'),auth[_0xa3aa('0xa')](),controller[_0xa3aa('0x16')]);module[_0xa3aa('0x17')]=router; \ No newline at end of file +var _0xd4c4=['../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xcbce9b,_0x527316){var _0x1c4cf3=function(_0x5f0eab){while(--_0x5f0eab){_0xcbce9b['push'](_0xcbce9b['shift']());}};_0x1c4cf3(++_0x527316);}(_0xd4c4,0x1c9));var _0x4d4c=function(_0x305a6e,_0x1f4a40){_0x305a6e=_0x305a6e-0x0;var _0xd23128=_0xd4c4[_0x305a6e];return _0xd23128;};'use strict';var multer=require(_0x4d4c('0x0'));var util=require(_0x4d4c('0x1'));var path=require(_0x4d4c('0x2'));var timeout=require(_0x4d4c('0x3'));var express=require(_0x4d4c('0x4'));var router=express['Router']();var auth=require(_0x4d4c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d4c('0x6'));var controller=require(_0x4d4c('0x7'));router['get']('/',auth[_0x4d4c('0x8')](),controller[_0x4d4c('0x9')]);router[_0x4d4c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4d4c('0xa')](_0x4d4c('0xb'),auth['isAuthenticated'](),controller[_0x4d4c('0xc')]);router['get']('/:id/fields',auth[_0x4d4c('0x8')](),controller[_0x4d4c('0xd')]);router[_0x4d4c('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d4c('0xf')]);router[_0x4d4c('0xe')](_0x4d4c('0xb'),auth[_0x4d4c('0x8')](),controller[_0x4d4c('0x10')]);router[_0x4d4c('0x11')](_0x4d4c('0x12'),auth['isAuthenticated'](),controller[_0x4d4c('0x13')]);router[_0x4d4c('0x14')]('/:id',auth[_0x4d4c('0x8')](),controller['destroy']);module[_0x4d4c('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 c220d80..6ad2730 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 _0x5e7d=['exports','STRING','username','remoteUri','sequelize'];(function(_0x3fb150,_0x5e32ed){var _0x56f4a8=function(_0x57924c){while(--_0x57924c){_0x3fb150['push'](_0x3fb150['shift']());}};_0x56f4a8(++_0x5e32ed);}(_0x5e7d,0xb8));var _0xd5e7=function(_0x525847,_0x240458){_0x525847=_0x525847-0x0;var _0x4b8fb9=_0x5e7d[_0x525847];return _0x4b8fb9;};'use strict';var Sequelize=require(_0xd5e7('0x0'));module[_0xd5e7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd5e7('0x2')],'unique':_0xd5e7('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd5e7('0x2')],'unique':_0xd5e7('0x4')},'serverUrl':{'type':Sequelize[_0xd5e7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x44d1=['STRING','username','sequelize'];(function(_0xfa92dc,_0x32ce0f){var _0x5d7e9c=function(_0x1b2024){while(--_0x1b2024){_0xfa92dc['push'](_0xfa92dc['shift']());}};_0x5d7e9c(++_0x32ce0f);}(_0x44d1,0x9b));var _0x144d=function(_0x46cd0d,_0x6d5e6){_0x46cd0d=_0x46cd0d-0x0;var _0x40a641=_0x44d1[_0x46cd0d];return _0x40a641;};'use strict';var Sequelize=require(_0x144d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x144d('0x1')]},'username':{'type':Sequelize[_0x144d('0x1')],'unique':_0x144d('0x2')},'apiKey':{'type':Sequelize[_0x144d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x144d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index c228f04..4a9033f 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 _0xb332=['users','email','Requested\x20Resource\x20not\x20Found','statusCode','test','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','length','options','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','nolimit','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','Token\x20token='];(function(_0x2c2acf,_0x107f43){var _0x582332=function(_0x3a130f){while(--_0x3a130f){_0x2c2acf['push'](_0x2c2acf['shift']());}};_0x582332(++_0x107f43);}(_0xb332,0xd9));var _0x2b33=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xb332[_0x25bca6];return _0x3f8d02;};'use strict';var pdf=require(_0x2b33('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b33('0x1'));var zipdir=require(_0x2b33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b33('0x3'));var moment=require('moment');var BPromise=require(_0x2b33('0x4'));var Mustache=require('mustache');var util=require(_0x2b33('0x5'));var path=require('path');var sox=require(_0x2b33('0x6'));var csv=require(_0x2b33('0x7'));var ejs=require(_0x2b33('0x8'));var fs=require('fs');var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x7'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];var integrations=require(_0x2b33('0x17'));var jayson=require(_0x2b33('0x18'));var client=jayson['client'][_0x2b33('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xa44d45,_0x2d4faa,_0x4ef886,_0x173c75){return new BPromise(function(_0x4d39db,_0x3fcf4e){var _0x17292f=_0x173c75||client;return _0x17292f[_0x2b33('0x1a')](_0xa44d45,_0x4ef886)['then'](function(_0x52693f){logger[_0x2b33('0x1b')](_0x2b33('0x1c'),_0x2d4faa,_0x2b33('0x1d'));logger[_0x2b33('0x1e')](_0x2b33('0x1f'),_0x2d4faa,'request\x20sent',JSON['stringify'](_0x52693f));if(_0x52693f['error']){if(_0x52693f[_0x2b33('0x20')]['code']===0x1f4){logger['error'](_0x2b33('0x1c'),_0x2d4faa,_0x52693f[_0x2b33('0x20')][_0x2b33('0x21')]);return _0x3fcf4e(_0x52693f['error'][_0x2b33('0x21')]);}logger['error'](_0x2b33('0x1c'),_0x2d4faa,_0x52693f[_0x2b33('0x20')][_0x2b33('0x21')]);return _0x4d39db(_0x52693f[_0x2b33('0x20')][_0x2b33('0x21')]);}else{logger[_0x2b33('0x1b')](_0x2b33('0x1c'),_0x2d4faa,'request\x20sent');_0x4d39db(_0x52693f[_0x2b33('0x22')][_0x2b33('0x21')]);}})[_0x2b33('0x23')](function(_0x196f3a){logger[_0x2b33('0x20')](_0x2b33('0x1c'),_0x2d4faa,_0x196f3a);_0x3fcf4e(_0x196f3a);});});}function respondWithStatusCode(_0x27f1b8,_0x2605e6){_0x2605e6=_0x2605e6||0xcc;return function(_0x5e1cba){if(_0x5e1cba){return _0x27f1b8[_0x2b33('0x24')](_0x2605e6);}return _0x27f1b8[_0x2b33('0x25')](_0x2605e6)[_0x2b33('0x26')]();};}function respondWithResult(_0x32b835,_0x4df3d4){_0x4df3d4=_0x4df3d4||0xc8;return function(_0x2ec9db){if(_0x2ec9db){return _0x32b835['status'](_0x4df3d4)[_0x2b33('0x27')](_0x2ec9db);}};}function respondWithFilteredResult(_0x483cf4,_0x2e74d0){return function(_0x341e0e){if(_0x341e0e){var _0x5d8d05=_0x341e0e['count'],_0x195aa2=_0x2e74d0[_0x2b33('0x28')],_0x53c2ad=_0x2e74d0[_0x2b33('0x28')]+_0x2e74d0[_0x2b33('0x29')],_0x267969;if(_0x53c2ad>=_0x5d8d05){_0x53c2ad=_0x5d8d05;_0x267969=0xc8;}else{_0x267969=0xce;}_0x483cf4[_0x2b33('0x25')](_0x267969);return _0x483cf4[_0x2b33('0x2a')](_0x2b33('0x2b'),_0x195aa2+'-'+_0x53c2ad+'/'+_0x5d8d05)[_0x2b33('0x27')](_0x341e0e);}return null;};}function patchUpdates(_0x1fadc5){return function(_0x316188){try{jsonpatch[_0x2b33('0x2c')](_0x316188,_0x1fadc5,!![]);}catch(_0x4cf72f){return BPromise['reject'](_0x4cf72f);}return _0x316188[_0x2b33('0x2d')]();};}function saveUpdates(_0x2a081c,_0x3282bf){return function(_0x119e9b){if(_0x119e9b){return _0x119e9b[_0x2b33('0x2e')](_0x2a081c)['then'](function(_0x570765){return _0x570765;});}return null;};}function removeEntity(_0x311ddd,_0x3d2aaa){return function(_0x476965){if(_0x476965){return _0x476965[_0x2b33('0x2f')]()[_0x2b33('0x30')](function(){_0x311ddd[_0x2b33('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275df9,_0x4da2dd){return function(_0x370faf){if(!_0x370faf){_0x275df9[_0x2b33('0x24')](0x194);}return _0x370faf;};}function handleError(_0x38c020,_0x23ba3e){_0x23ba3e=_0x23ba3e||0x1f4;return function(_0x594d66){logger[_0x2b33('0x20')](_0x594d66[_0x2b33('0x31')]);if(_0x594d66[_0x2b33('0x32')]){delete _0x594d66[_0x2b33('0x32')];}_0x38c020[_0x2b33('0x25')](_0x23ba3e)[_0x2b33('0x33')](_0x594d66);};}exports[_0x2b33('0x34')]=function(_0xe415f4,_0x19e351){var _0xb06e25={},_0xa54962={},_0x565c14={'count':0x0,'rows':[]};var _0x52a229=_['map'](db[_0x2b33('0x35')][_0x2b33('0x36')],function(_0x359075){return{'name':_0x359075[_0x2b33('0x37')],'type':_0x359075[_0x2b33('0x38')]['key']};});_0xa54962['model']=_[_0x2b33('0x39')](_0x52a229,'name');_0xa54962[_0x2b33('0x3a')]=_[_0x2b33('0x3b')](_0xe415f4[_0x2b33('0x3a')]);_0xa54962[_0x2b33('0x3c')]=_[_0x2b33('0x3d')](_0xa54962[_0x2b33('0x3e')],_0xa54962[_0x2b33('0x3a')]);_0xb06e25[_0x2b33('0x3f')]=_[_0x2b33('0x3d')](_0xa54962[_0x2b33('0x3e')],qs['fields'](_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x40')]));_0xb06e25[_0x2b33('0x3f')]=_0xb06e25['attributes']['length']?_0xb06e25[_0x2b33('0x3f')]:_0xa54962['model'];if(!_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x41')]('nolimit')){_0xb06e25[_0x2b33('0x29')]=qs[_0x2b33('0x29')](_0xe415f4['query'][_0x2b33('0x29')]);_0xb06e25[_0x2b33('0x28')]=qs['offset'](_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x28')]);}_0xb06e25[_0x2b33('0x42')]=qs['sort'](_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x43')]);_0xb06e25[_0x2b33('0x44')]=qs[_0x2b33('0x3c')](_[_0x2b33('0x45')](_0xe415f4['query'],_0xa54962[_0x2b33('0x3c')]),_0x52a229);if(_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x46')]){_0xb06e25['where']=_[_0x2b33('0x47')](_0xb06e25[_0x2b33('0x44')],{'$or':_[_0x2b33('0x39')](_0x52a229,function(_0xac1dad){if(_0xac1dad['type']!==_0x2b33('0x48')){var _0x416f3e={};_0x416f3e[_0xac1dad['name']]={'$like':'%'+_0xe415f4['query']['filter']+'%'};return _0x416f3e;}})});}_0xb06e25=_[_0x2b33('0x47')]({},_0xb06e25,_0xe415f4['options']);var _0x35df3c={'where':_0xb06e25[_0x2b33('0x44')]};return db[_0x2b33('0x35')][_0x2b33('0x49')](_0x35df3c)[_0x2b33('0x30')](function(_0xd68bbd){_0x565c14[_0x2b33('0x49')]=_0xd68bbd;if(_0xe415f4[_0x2b33('0x3a')]['includeAll']){_0xb06e25[_0x2b33('0x4a')]=[{'all':!![]}];}return db[_0x2b33('0x35')][_0x2b33('0x4b')](_0xb06e25);})[_0x2b33('0x30')](function(_0x41c3c1){_0x565c14[_0x2b33('0x4c')]=_0x41c3c1;return _0x565c14;})['then'](respondWithFilteredResult(_0x19e351,_0xb06e25))['catch'](handleError(_0x19e351,null));};exports['show']=function(_0x493123,_0x13a5d4){var _0x5cdf5d={'raw':![],'where':{'id':_0x493123['params']['id']}},_0x1c5019={};_0x1c5019['model']=_[_0x2b33('0x3b')](db[_0x2b33('0x35')][_0x2b33('0x36')]);_0x1c5019['query']=_[_0x2b33('0x3b')](_0x493123['query']);_0x1c5019[_0x2b33('0x3c')]=_[_0x2b33('0x3d')](_0x1c5019[_0x2b33('0x3e')],_0x1c5019[_0x2b33('0x3a')]);_0x5cdf5d[_0x2b33('0x3f')]=_[_0x2b33('0x3d')](_0x1c5019['model'],qs[_0x2b33('0x40')](_0x493123[_0x2b33('0x3a')][_0x2b33('0x40')]));_0x5cdf5d['attributes']=_0x5cdf5d[_0x2b33('0x3f')][_0x2b33('0x4d')]?_0x5cdf5d[_0x2b33('0x3f')]:_0x1c5019['model'];if(_0x493123[_0x2b33('0x3a')]['includeAll']){_0x5cdf5d['include']=[{'all':!![]}];}_0x5cdf5d=_[_0x2b33('0x47')]({},_0x5cdf5d,_0x493123[_0x2b33('0x4e')]);return db[_0x2b33('0x35')][_0x2b33('0x4f')](_0x5cdf5d)[_0x2b33('0x30')](handleEntityNotFound(_0x13a5d4,null))[_0x2b33('0x30')](respondWithResult(_0x13a5d4,null))[_0x2b33('0x23')](handleError(_0x13a5d4,null));};exports[_0x2b33('0x50')]=function(_0x486f74,_0x275e5e){return db[_0x2b33('0x35')]['create'](_0x486f74[_0x2b33('0x51')],{})[_0x2b33('0x30')](respondWithResult(_0x275e5e,0xc9))['catch'](handleError(_0x275e5e,null));};exports[_0x2b33('0x2e')]=function(_0x433584,_0x20f473){if(_0x433584[_0x2b33('0x51')]['id']){delete _0x433584['body']['id'];}return db[_0x2b33('0x35')][_0x2b33('0x4f')]({'where':{'id':_0x433584['params']['id']}})[_0x2b33('0x30')](handleEntityNotFound(_0x20f473,null))[_0x2b33('0x30')](saveUpdates(_0x433584[_0x2b33('0x51')],null))[_0x2b33('0x30')](respondWithResult(_0x20f473,null))[_0x2b33('0x23')](handleError(_0x20f473,null));};exports[_0x2b33('0x2f')]=function(_0x1bbb5f,_0x5609f6){return db['FreshsalesAccount'][_0x2b33('0x4f')]({'where':{'id':_0x1bbb5f[_0x2b33('0x52')]['id']}})['then'](handleEntityNotFound(_0x5609f6,null))[_0x2b33('0x30')](removeEntity(_0x5609f6,null))[_0x2b33('0x23')](handleError(_0x5609f6,null));};exports[_0x2b33('0x53')]=function(_0x4e3777,_0x185c3e,_0x134c48){var _0x59aca5={};var _0x1af9a3={};var _0x464ac8;var _0x3e503e;return db[_0x2b33('0x35')][_0x2b33('0x54')]({'where':{'id':_0x4e3777['params']['id']}})['then'](handleEntityNotFound(_0x185c3e,null))[_0x2b33('0x30')](function(_0x138d2f){if(_0x138d2f){_0x464ac8=_0x138d2f;_0x1af9a3[_0x2b33('0x3e')]=_[_0x2b33('0x3b')](db[_0x2b33('0x55')][_0x2b33('0x36')]);_0x1af9a3['query']=_[_0x2b33('0x3b')](_0x4e3777[_0x2b33('0x3a')]);_0x1af9a3[_0x2b33('0x3c')]=_[_0x2b33('0x3d')](_0x1af9a3[_0x2b33('0x3e')],_0x1af9a3[_0x2b33('0x3a')]);_0x59aca5['attributes']=_[_0x2b33('0x3d')](_0x1af9a3[_0x2b33('0x3e')],qs[_0x2b33('0x40')](_0x4e3777[_0x2b33('0x3a')][_0x2b33('0x40')]));_0x59aca5['attributes']=_0x59aca5[_0x2b33('0x3f')][_0x2b33('0x4d')]?_0x59aca5[_0x2b33('0x3f')]:_0x1af9a3[_0x2b33('0x3e')];_0x59aca5['order']=qs[_0x2b33('0x43')](_0x4e3777['query'][_0x2b33('0x43')]);_0x59aca5[_0x2b33('0x44')]=qs[_0x2b33('0x3c')](_[_0x2b33('0x45')](_0x4e3777[_0x2b33('0x3a')],_0x1af9a3[_0x2b33('0x3c')]));if(_0x4e3777[_0x2b33('0x3a')][_0x2b33('0x46')]){_0x59aca5['where']=_[_0x2b33('0x47')](_0x59aca5[_0x2b33('0x44')],{'$or':_[_0x2b33('0x39')](_0x59aca5[_0x2b33('0x3f')],function(_0x311c62){var _0x693c68={};_0x693c68[_0x311c62]={'$like':'%'+_0x4e3777[_0x2b33('0x3a')][_0x2b33('0x46')]+'%'};return _0x693c68;})});}_0x59aca5=_[_0x2b33('0x47')]({},_0x59aca5,_0x4e3777[_0x2b33('0x4e')]);return _0x464ac8[_0x2b33('0x53')](_0x59aca5);}})[_0x2b33('0x30')](function(_0x47acb1){if(_0x47acb1){_0x3e503e=_0x47acb1[_0x2b33('0x4d')];if(!_0x4e3777['query']['hasOwnProperty'](_0x2b33('0x56'))){_0x59aca5[_0x2b33('0x29')]=qs[_0x2b33('0x29')](_0x4e3777['query'][_0x2b33('0x29')]);_0x59aca5[_0x2b33('0x28')]=qs[_0x2b33('0x28')](_0x4e3777[_0x2b33('0x3a')]['offset']);}return _0x464ac8['getConfigurations'](_0x59aca5);}})['then'](function(_0x592fec){if(_0x592fec){return _0x592fec?{'count':_0x3e503e,'rows':_0x592fec}:null;}})['then'](respondWithResult(_0x185c3e,null))['catch'](handleError(_0x185c3e,null));};exports['addConfiguration']=function(_0x25ca35,_0x4338e2,_0x653187){if(_0x25ca35['body']['id']){delete _0x25ca35[_0x2b33('0x51')]['id'];}return db[_0x2b33('0x35')][_0x2b33('0x54')]({'where':{'id':_0x25ca35[_0x2b33('0x52')]['id']}})[_0x2b33('0x30')](handleEntityNotFound(_0x4338e2,null))[_0x2b33('0x30')](function(_0x5e60b4){if(_0x5e60b4){_0x25ca35['body']['AccountId']=_0x5e60b4['id'];_0x25ca35['body']['Subjects']=integrations['getSubjects'](_0x25ca35[_0x2b33('0x51')][_0x2b33('0x57')],_0x25ca35['body'][_0x2b33('0x38')]);_0x25ca35[_0x2b33('0x51')][_0x2b33('0x58')]=integrations[_0x2b33('0x59')](_0x25ca35[_0x2b33('0x51')][_0x2b33('0x57')],_0x25ca35[_0x2b33('0x51')]['type']);return db['FreshsalesConfiguration'][_0x2b33('0x50')](_0x25ca35[_0x2b33('0x51')],{'include':[{'model':db[_0x2b33('0x5a')],'as':_0x2b33('0x5b')},{'model':db[_0x2b33('0x5a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4338e2,null))['catch'](handleError(_0x4338e2,null));};exports[_0x2b33('0x5c')]=function(_0x18cc51,_0x2452e4,_0x5b2363){var _0x5b9df0='';var _0x31d155='';return db[_0x2b33('0x35')]['findOne']({'where':{'id':_0x18cc51[_0x2b33('0x52')]['id']},'attributes':['id',_0x2b33('0x5d'),_0x2b33('0x5e'),'apiKey']})[_0x2b33('0x30')](handleEntityNotFound(_0x2452e4,null))[_0x2b33('0x30')](function(_0x32c3c0){if(_0x32c3c0){_0x31d155=_0x32c3c0[_0x2b33('0x5d')];_0x5b9df0=_0x32c3c0['remoteUri'];var _0x3e0900=_0x32c3c0['remoteUri'][_0x2b33('0x5f')](-0x1);if(_0x3e0900==='/'){_0x5b9df0=_0x5b9df0[_0x2b33('0x60')](0x0,_0x5b9df0[_0x2b33('0x61')](_0x3e0900));}return rp({'method':_0x2b33('0x62'),'uri':util[_0x2b33('0x63')]('%s%s',_0x5b9df0,'/api/selector/owners'),'headers':{'Authorization':_0x2b33('0x64')+_0x32c3c0['apiKey']},'json':!![]});}})['then'](function(_0xf026d0){if(_0xf026d0){var _0x342b8f=_0xf026d0[_0x2b33('0x65')];var _0x36ef6f=![];var _0x1e681a=null;for(_0x1e681a=0x0;_0x1e681a<_0x342b8f[_0x2b33('0x4d')];_0x1e681a++){if(_0x342b8f[_0x1e681a][_0x2b33('0x66')]===_0x31d155){_0x36ef6f=!![];}}if(_0x36ef6f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2b33('0x67')});}}})['then'](respondWithResult(_0x2452e4,null))['catch'](function(_0x4fd85a){var _0x301464=_0x18cc51[_0x2b33('0x3a')]['test']?0x1f4:_0x4fd85a[_0x2b33('0x68')]||0x1f4;logger[_0x2b33('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x2b33('0x5c'),_0x301464,JSON['stringify'](_0x4fd85a));delete _0x4fd85a[_0x2b33('0x32')];if(_0x301464===0x191){_0x301464=0x190;}_0x2452e4[_0x2b33('0x25')](_0x301464)['send'](_0x18cc51[_0x2b33('0x3a')][_0x2b33('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x4fd85a[_0x2b33('0x68')]}:_0x4fd85a);});}; \ No newline at end of file +var _0x55e0=['mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','includeAll','findAll','rows','params','length','include','find','create','body','update','FreshsalesConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','FreshsalesField','username','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x55e0,0xdc));var _0x055e=function(_0x6e971b,_0x46e8d3){_0x6e971b=_0x6e971b-0x0;var _0x5c5945=_0x55e0[_0x6e971b];return _0x5c5945;};'use strict';var pdf=require(_0x055e('0x0'));var emlformat=require(_0x055e('0x1'));var rimraf=require(_0x055e('0x2'));var zipdir=require(_0x055e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x055e('0x4'));var BPromise=require(_0x055e('0x5'));var Mustache=require(_0x055e('0x6'));var util=require(_0x055e('0x7'));var path=require(_0x055e('0x8'));var sox=require(_0x055e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x055e('0xa'));var squel=require('squel');var crypto=require(_0x055e('0xb'));var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0xe'));var querystring=require(_0x055e('0xf'));var Papa=require('papaparse');var Redis=require(_0x055e('0x10'));var authService=require(_0x055e('0x11'));var qs=require(_0x055e('0x12'));var as=require(_0x055e('0x13'));var hardwareService=require(_0x055e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x055e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x055e('0x16'));var db=require(_0x055e('0x17'))['db'];var integrations=require(_0x055e('0x18'));var jayson=require(_0x055e('0x19'));var client=jayson[_0x055e('0x1a')][_0x055e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x236a2b,_0x4bca5d,_0x14064d,_0xb80d83){return new BPromise(function(_0x3cfd14,_0xe41bae){var _0x222817=_0xb80d83||client;return _0x222817['request'](_0x236a2b,_0x14064d)[_0x055e('0x1c')](function(_0x2fe55f){logger[_0x055e('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x4bca5d,_0x055e('0x1e'));logger[_0x055e('0x1f')](_0x055e('0x20'),_0x4bca5d,_0x055e('0x1e'),JSON[_0x055e('0x21')](_0x2fe55f));if(_0x2fe55f['error']){if(_0x2fe55f[_0x055e('0x22')][_0x055e('0x23')]===0x1f4){logger[_0x055e('0x22')](_0x055e('0x24'),_0x4bca5d,_0x2fe55f['error'][_0x055e('0x25')]);return _0xe41bae(_0x2fe55f[_0x055e('0x22')]['message']);}logger[_0x055e('0x22')](_0x055e('0x24'),_0x4bca5d,_0x2fe55f[_0x055e('0x22')][_0x055e('0x25')]);return _0x3cfd14(_0x2fe55f[_0x055e('0x22')][_0x055e('0x25')]);}else{logger['info'](_0x055e('0x24'),_0x4bca5d,_0x055e('0x1e'));_0x3cfd14(_0x2fe55f[_0x055e('0x26')]['message']);}})[_0x055e('0x27')](function(_0x2da6b){logger[_0x055e('0x22')](_0x055e('0x24'),_0x4bca5d,_0x2da6b);_0xe41bae(_0x2da6b);});});}function respondWithStatusCode(_0x51df23,_0x71a6e1){_0x71a6e1=_0x71a6e1||0xcc;return function(_0x56c372){if(_0x56c372){return _0x51df23[_0x055e('0x28')](_0x71a6e1);}return _0x51df23[_0x055e('0x29')](_0x71a6e1)[_0x055e('0x2a')]();};}function respondWithResult(_0x1a76c6,_0x40c62a){_0x40c62a=_0x40c62a||0xc8;return function(_0x4c653c){if(_0x4c653c){return _0x1a76c6['status'](_0x40c62a)[_0x055e('0x2b')](_0x4c653c);}};}function respondWithFilteredResult(_0x1f90a9,_0x2a82f8){return function(_0x4b5891){if(_0x4b5891){var _0x408e38=_0x4b5891['count'],_0x29078a=_0x2a82f8[_0x055e('0x2c')],_0x42f2df=_0x2a82f8['offset']+_0x2a82f8[_0x055e('0x2d')],_0x2ef064;if(_0x42f2df>=_0x408e38){_0x42f2df=_0x408e38;_0x2ef064=0xc8;}else{_0x2ef064=0xce;}_0x1f90a9[_0x055e('0x29')](_0x2ef064);return _0x1f90a9[_0x055e('0x2e')](_0x055e('0x2f'),_0x29078a+'-'+_0x42f2df+'/'+_0x408e38)[_0x055e('0x2b')](_0x4b5891);}return null;};}function patchUpdates(_0x5c0e76){return function(_0x99a372){try{jsonpatch[_0x055e('0x30')](_0x99a372,_0x5c0e76,!![]);}catch(_0x293062){return BPromise[_0x055e('0x31')](_0x293062);}return _0x99a372[_0x055e('0x32')]();};}function saveUpdates(_0x225c88,_0x59f8c4){return function(_0x167322){if(_0x167322){return _0x167322['update'](_0x225c88)[_0x055e('0x1c')](function(_0x43ec84){return _0x43ec84;});}return null;};}function removeEntity(_0x5cfeea,_0xd9298d){return function(_0x1319bd){if(_0x1319bd){return _0x1319bd[_0x055e('0x33')]()[_0x055e('0x1c')](function(){_0x5cfeea[_0x055e('0x29')](0xcc)[_0x055e('0x2a')]();});}};}function handleEntityNotFound(_0x5e1a92,_0x5ddf59){return function(_0x25d19d){if(!_0x25d19d){_0x5e1a92['sendStatus'](0x194);}return _0x25d19d;};}function handleError(_0x49b64c,_0x55a1ee){_0x55a1ee=_0x55a1ee||0x1f4;return function(_0x31ee60){logger[_0x055e('0x22')](_0x31ee60[_0x055e('0x34')]);if(_0x31ee60[_0x055e('0x35')]){delete _0x31ee60[_0x055e('0x35')];}_0x49b64c[_0x055e('0x29')](_0x55a1ee)[_0x055e('0x36')](_0x31ee60);};}exports[_0x055e('0x37')]=function(_0x42a33e,_0x2f60fa){var _0x2f839c={},_0x263a81={},_0x54539e={'count':0x0,'rows':[]};var _0x571b75=_[_0x055e('0x38')](db[_0x055e('0x39')][_0x055e('0x3a')],function(_0xf3abf6){return{'name':_0xf3abf6[_0x055e('0x3b')],'type':_0xf3abf6[_0x055e('0x3c')][_0x055e('0x3d')]};});_0x263a81['model']=_[_0x055e('0x38')](_0x571b75,_0x055e('0x35'));_0x263a81[_0x055e('0x3e')]=_[_0x055e('0x3f')](_0x42a33e[_0x055e('0x3e')]);_0x263a81['filters']=_[_0x055e('0x40')](_0x263a81[_0x055e('0x41')],_0x263a81['query']);_0x2f839c[_0x055e('0x42')]=_[_0x055e('0x40')](_0x263a81['model'],qs[_0x055e('0x43')](_0x42a33e[_0x055e('0x3e')]['fields']));_0x2f839c[_0x055e('0x42')]=_0x2f839c[_0x055e('0x42')]['length']?_0x2f839c[_0x055e('0x42')]:_0x263a81[_0x055e('0x41')];if(!_0x42a33e[_0x055e('0x3e')]['hasOwnProperty'](_0x055e('0x44'))){_0x2f839c[_0x055e('0x2d')]=qs['limit'](_0x42a33e[_0x055e('0x3e')][_0x055e('0x2d')]);_0x2f839c[_0x055e('0x2c')]=qs['offset'](_0x42a33e[_0x055e('0x3e')][_0x055e('0x2c')]);}_0x2f839c[_0x055e('0x45')]=qs['sort'](_0x42a33e['query'][_0x055e('0x46')]);_0x2f839c[_0x055e('0x47')]=qs['filters'](_[_0x055e('0x48')](_0x42a33e['query'],_0x263a81[_0x055e('0x49')]),_0x571b75);if(_0x42a33e['query'][_0x055e('0x4a')]){_0x2f839c[_0x055e('0x47')]=_[_0x055e('0x4b')](_0x2f839c['where'],{'$or':_['map'](_0x571b75,function(_0x20b951){if(_0x20b951[_0x055e('0x3c')]!==_0x055e('0x4c')){var _0x445d74={};_0x445d74[_0x20b951['name']]={'$like':'%'+_0x42a33e['query'][_0x055e('0x4a')]+'%'};return _0x445d74;}})});}_0x2f839c=_[_0x055e('0x4b')]({},_0x2f839c,_0x42a33e['options']);var _0x42dde3={'where':_0x2f839c[_0x055e('0x47')]};return db[_0x055e('0x39')][_0x055e('0x4d')](_0x42dde3)[_0x055e('0x1c')](function(_0x1f3c73){_0x54539e['count']=_0x1f3c73;if(_0x42a33e[_0x055e('0x3e')][_0x055e('0x4e')]){_0x2f839c['include']=[{'all':!![]}];}return db[_0x055e('0x39')][_0x055e('0x4f')](_0x2f839c);})[_0x055e('0x1c')](function(_0x11e860){_0x54539e[_0x055e('0x50')]=_0x11e860;return _0x54539e;})[_0x055e('0x1c')](respondWithFilteredResult(_0x2f60fa,_0x2f839c))[_0x055e('0x27')](handleError(_0x2f60fa,null));};exports['show']=function(_0x35b2c6,_0x48fb8f){var _0xc08c9b={'raw':![],'where':{'id':_0x35b2c6[_0x055e('0x51')]['id']}},_0xed7611={};_0xed7611['model']=_['keys'](db[_0x055e('0x39')][_0x055e('0x3a')]);_0xed7611[_0x055e('0x3e')]=_[_0x055e('0x3f')](_0x35b2c6[_0x055e('0x3e')]);_0xed7611[_0x055e('0x49')]=_[_0x055e('0x40')](_0xed7611[_0x055e('0x41')],_0xed7611[_0x055e('0x3e')]);_0xc08c9b['attributes']=_[_0x055e('0x40')](_0xed7611[_0x055e('0x41')],qs[_0x055e('0x43')](_0x35b2c6[_0x055e('0x3e')][_0x055e('0x43')]));_0xc08c9b['attributes']=_0xc08c9b[_0x055e('0x42')][_0x055e('0x52')]?_0xc08c9b[_0x055e('0x42')]:_0xed7611['model'];if(_0x35b2c6[_0x055e('0x3e')]['includeAll']){_0xc08c9b[_0x055e('0x53')]=[{'all':!![]}];}_0xc08c9b=_[_0x055e('0x4b')]({},_0xc08c9b,_0x35b2c6['options']);return db[_0x055e('0x39')][_0x055e('0x54')](_0xc08c9b)[_0x055e('0x1c')](handleEntityNotFound(_0x48fb8f,null))['then'](respondWithResult(_0x48fb8f,null))['catch'](handleError(_0x48fb8f,null));};exports[_0x055e('0x55')]=function(_0x413778,_0x393717){return db[_0x055e('0x39')][_0x055e('0x55')](_0x413778[_0x055e('0x56')],{})[_0x055e('0x1c')](respondWithResult(_0x393717,0xc9))[_0x055e('0x27')](handleError(_0x393717,null));};exports[_0x055e('0x57')]=function(_0x1a7113,_0x4d8698){if(_0x1a7113[_0x055e('0x56')]['id']){delete _0x1a7113[_0x055e('0x56')]['id'];}return db[_0x055e('0x39')][_0x055e('0x54')]({'where':{'id':_0x1a7113['params']['id']}})[_0x055e('0x1c')](handleEntityNotFound(_0x4d8698,null))[_0x055e('0x1c')](saveUpdates(_0x1a7113[_0x055e('0x56')],null))[_0x055e('0x1c')](respondWithResult(_0x4d8698,null))['catch'](handleError(_0x4d8698,null));};exports['destroy']=function(_0x22bf74,_0xd3a451){return db[_0x055e('0x39')][_0x055e('0x54')]({'where':{'id':_0x22bf74[_0x055e('0x51')]['id']}})[_0x055e('0x1c')](handleEntityNotFound(_0xd3a451,null))[_0x055e('0x1c')](removeEntity(_0xd3a451,null))[_0x055e('0x27')](handleError(_0xd3a451,null));};exports['getConfigurations']=function(_0x51b5a9,_0x1df839,_0x33592d){var _0x5240d5={};var _0x143e8c={};var _0x16dd1e;var _0x334a72;return db[_0x055e('0x39')]['findOne']({'where':{'id':_0x51b5a9[_0x055e('0x51')]['id']}})[_0x055e('0x1c')](handleEntityNotFound(_0x1df839,null))[_0x055e('0x1c')](function(_0x1ec58d){if(_0x1ec58d){_0x16dd1e=_0x1ec58d;_0x143e8c[_0x055e('0x41')]=_[_0x055e('0x3f')](db[_0x055e('0x58')][_0x055e('0x3a')]);_0x143e8c['query']=_[_0x055e('0x3f')](_0x51b5a9[_0x055e('0x3e')]);_0x143e8c['filters']=_[_0x055e('0x40')](_0x143e8c[_0x055e('0x41')],_0x143e8c[_0x055e('0x3e')]);_0x5240d5[_0x055e('0x42')]=_['intersection'](_0x143e8c[_0x055e('0x41')],qs[_0x055e('0x43')](_0x51b5a9[_0x055e('0x3e')]['fields']));_0x5240d5[_0x055e('0x42')]=_0x5240d5[_0x055e('0x42')][_0x055e('0x52')]?_0x5240d5[_0x055e('0x42')]:_0x143e8c[_0x055e('0x41')];_0x5240d5['order']=qs[_0x055e('0x46')](_0x51b5a9[_0x055e('0x3e')][_0x055e('0x46')]);_0x5240d5[_0x055e('0x47')]=qs[_0x055e('0x49')](_['pick'](_0x51b5a9[_0x055e('0x3e')],_0x143e8c[_0x055e('0x49')]));if(_0x51b5a9[_0x055e('0x3e')]['filter']){_0x5240d5[_0x055e('0x47')]=_[_0x055e('0x4b')](_0x5240d5[_0x055e('0x47')],{'$or':_[_0x055e('0x38')](_0x5240d5[_0x055e('0x42')],function(_0x553e16){var _0x301d72={};_0x301d72[_0x553e16]={'$like':'%'+_0x51b5a9['query'][_0x055e('0x4a')]+'%'};return _0x301d72;})});}_0x5240d5=_[_0x055e('0x4b')]({},_0x5240d5,_0x51b5a9['options']);return _0x16dd1e[_0x055e('0x59')](_0x5240d5);}})[_0x055e('0x1c')](function(_0x30602f){if(_0x30602f){_0x334a72=_0x30602f[_0x055e('0x52')];if(!_0x51b5a9['query']['hasOwnProperty'](_0x055e('0x44'))){_0x5240d5['limit']=qs[_0x055e('0x2d')](_0x51b5a9[_0x055e('0x3e')][_0x055e('0x2d')]);_0x5240d5[_0x055e('0x2c')]=qs[_0x055e('0x2c')](_0x51b5a9[_0x055e('0x3e')][_0x055e('0x2c')]);}return _0x16dd1e[_0x055e('0x59')](_0x5240d5);}})[_0x055e('0x1c')](function(_0x14eb53){if(_0x14eb53){return _0x14eb53?{'count':_0x334a72,'rows':_0x14eb53}:null;}})['then'](respondWithResult(_0x1df839,null))['catch'](handleError(_0x1df839,null));};exports[_0x055e('0x5a')]=function(_0x1f276f,_0x52a6e9,_0x2a4df8){if(_0x1f276f['body']['id']){delete _0x1f276f[_0x055e('0x56')]['id'];}return db[_0x055e('0x39')][_0x055e('0x5b')]({'where':{'id':_0x1f276f[_0x055e('0x51')]['id']}})[_0x055e('0x1c')](handleEntityNotFound(_0x52a6e9,null))[_0x055e('0x1c')](function(_0x992681){if(_0x992681){_0x1f276f[_0x055e('0x56')]['AccountId']=_0x992681['id'];_0x1f276f[_0x055e('0x56')][_0x055e('0x5c')]=integrations[_0x055e('0x5d')](_0x1f276f[_0x055e('0x56')][_0x055e('0x5e')],_0x1f276f[_0x055e('0x56')][_0x055e('0x3c')]);_0x1f276f[_0x055e('0x56')][_0x055e('0x5f')]=integrations['getDescriptions'](_0x1f276f[_0x055e('0x56')][_0x055e('0x5e')],_0x1f276f['body'][_0x055e('0x3c')]);return db[_0x055e('0x58')][_0x055e('0x55')](_0x1f276f[_0x055e('0x56')],{'include':[{'model':db['FreshsalesField'],'as':_0x055e('0x5c')},{'model':db[_0x055e('0x60')],'as':_0x055e('0x5f')}]});}return null;})[_0x055e('0x1c')](respondWithResult(_0x52a6e9,null))[_0x055e('0x27')](handleError(_0x52a6e9,null));};exports['getFields']=function(_0x256c65,_0x93b842,_0x99ef23){var _0xe21a0e='';var _0x51c538='';return db[_0x055e('0x39')][_0x055e('0x5b')]({'where':{'id':_0x256c65[_0x055e('0x51')]['id']},'attributes':['id',_0x055e('0x61'),_0x055e('0x62'),'apiKey']})[_0x055e('0x1c')](handleEntityNotFound(_0x93b842,null))[_0x055e('0x1c')](function(_0x16835c){if(_0x16835c){_0x51c538=_0x16835c[_0x055e('0x61')];_0xe21a0e=_0x16835c['remoteUri'];var _0x20daf0=_0x16835c[_0x055e('0x62')][_0x055e('0x63')](-0x1);if(_0x20daf0==='/'){_0xe21a0e=_0xe21a0e[_0x055e('0x64')](0x0,_0xe21a0e['lastIndexOf'](_0x20daf0));}return rp({'method':_0x055e('0x65'),'uri':util[_0x055e('0x66')](_0x055e('0x67'),_0xe21a0e,_0x055e('0x68')),'headers':{'Authorization':_0x055e('0x69')+_0x16835c['apiKey']},'json':!![]});}})[_0x055e('0x1c')](function(_0x158b87){if(_0x158b87){var _0x2e5122=_0x158b87['users'];var _0x588aea=![];var _0x1d1f36=null;for(_0x1d1f36=0x0;_0x1d1f36<_0x2e5122['length'];_0x1d1f36++){if(_0x2e5122[_0x1d1f36][_0x055e('0x6a')]===_0x51c538){_0x588aea=!![];}}if(_0x588aea){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x055e('0x6b')});}}})['then'](respondWithResult(_0x93b842,null))[_0x055e('0x27')](function(_0x45bf5d){var _0x827270=_0x256c65[_0x055e('0x3e')][_0x055e('0x6c')]?0x1f4:_0x45bf5d[_0x055e('0x6d')]||0x1f4;logger[_0x055e('0x22')](_0x055e('0x6e'),_0x055e('0x6f'),_0x827270,JSON[_0x055e('0x21')](_0x45bf5d));delete _0x45bf5d[_0x055e('0x35')];if(_0x827270===0x191){_0x827270=0x190;}_0x93b842[_0x055e('0x29')](_0x827270)[_0x055e('0x36')](_0x256c65[_0x055e('0x3e')][_0x055e('0x6c')]?{'message':_0x055e('0x70'),'statusCode':_0x45bf5d['statusCode']}:_0x45bf5d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 051d4a8..6542c6e 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 _0x664b=['moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x471292,_0x22aa3d){var _0x1c7dbe=function(_0x478697){while(--_0x478697){_0x471292['push'](_0x471292['shift']());}};_0x1c7dbe(++_0x22aa3d);}(_0x664b,0xc0));var _0xb664=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x664b[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb664('0x0'));var util=require(_0xb664('0x1'));var logger=require(_0xb664('0x2'))(_0xb664('0x3'));var moment=require(_0xb664('0x4'));var BPromise=require(_0xb664('0x5'));var rp=require(_0xb664('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb664('0x7'));var config=require('../../config/environment');var attributes=require(_0xb664('0x8'));var integrations=require(_0xb664('0x9'));module[_0xb664('0xa')]=function(_0x55cff2,_0xacf606){return _0x55cff2[_0xb664('0xb')](_0xb664('0xc'),attributes,{'tableName':_0xb664('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad04=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad04,0x96));var _0x4ad0=function(_0x26060f,_0xab8a73){_0x26060f=_0x26060f-0x0;var _0x38c8bd=_0xad04[_0x26060f];return _0x38c8bd;};'use strict';var _=require(_0x4ad0('0x0'));var util=require(_0x4ad0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ad0('0x2'));var fs=require('fs');var path=require(_0x4ad0('0x3'));var rimraf=require(_0x4ad0('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ad0('0x5'));var integrations=require(_0x4ad0('0x6'));module[_0x4ad0('0x7')]=function(_0x25ce58,_0x1f17e7){return _0x25ce58[_0x4ad0('0x8')](_0x4ad0('0x9'),attributes,{'tableName':_0x4ad0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 345b5f9..a410e85 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 _0x6209=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','limit','include','map','model','attributes','where','ShowFreshsalesAccount','catch','lodash','util'];(function(_0x3e7bb8,_0x11f26c){var _0x160bf4=function(_0xbc65a5){while(--_0xbc65a5){_0x3e7bb8['push'](_0x3e7bb8['shift']());}};_0x160bf4(++_0x11f26c);}(_0x6209,0x1e8));var _0x9620=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6209[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb4e,_0x339bdc,_0x488d59){return new BPromise(function(_0x4e9082,_0x11af3d){return client['request'](_0x2bdb4e,_0x488d59)[_0x9620('0xc')](function(_0x345acb){logger[_0x9620('0xd')](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));logger[_0x9620('0x10')](_0x9620('0x11'),_0x339bdc,'request\x20sent',JSON[_0x9620('0x12')](_0x345acb));if(_0x345acb['error']){if(_0x345acb[_0x9620('0x13')][_0x9620('0x14')]===0x1f4){logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);return _0x11af3d(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb['error']['message']);return _0x4e9082(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}else{logger['info'](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));_0x4e9082(_0x345acb[_0x9620('0x16')][_0x9620('0x15')]);}})['catch'](function(_0x2cb40e){logger[_0x9620('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x339bdc,_0x2cb40e);_0x11af3d(_0x2cb40e);});});}exports[_0x9620('0x17')]=function(_0x4b81ea){var _0x10a166=this;return new Promise(function(_0x16514e,_0x2c8975){return db[_0x9620('0x18')][_0x9620('0x19')]({'raw':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b81ea['options']?_0x4b81ea['options']['where']||null:null,'attributes':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['attributes']||null:null,'limit':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1b')]||null:null,'include':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x4b81ea['options']['include'],function(_0x1d8665){return{'model':db[_0x1d8665[_0x9620('0x1e')]],'as':_0x1d8665['as'],'attributes':_0x1d8665['attributes'],'include':_0x1d8665[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x1d8665[_0x9620('0x1c')],function(_0x156298){return{'model':db[_0x156298[_0x9620('0x1e')]],'as':_0x156298['as'],'attributes':_0x156298[_0x9620('0x1f')],'include':_0x156298[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x156298[_0x9620('0x1c')],function(_0x30c0cf){return{'model':db[_0x30c0cf[_0x9620('0x1e')]],'as':_0x30c0cf['as'],'attributes':_0x30c0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9620('0xc')](function(_0x3e40aa){logger[_0x9620('0xd')](_0x9620('0x17'),_0x4b81ea);logger['debug']('GetFreshsalesAccount',_0x4b81ea,JSON[_0x9620('0x12')](_0x3e40aa));_0x16514e(_0x3e40aa);})['catch'](function(_0xf2cb11){logger['error']('GetFreshsalesAccount',_0xf2cb11[_0x9620('0x15')],_0x4b81ea);_0x2c8975(_0x10a166[_0x9620('0x13')](0x1f4,_0xf2cb11[_0x9620('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x19ddaf){var _0x186b4f=this;return new Promise(function(_0x42bfe6,_0x4cc78e){return db[_0x9620('0x18')]['find']({'raw':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')][_0x9620('0x20')]||null:null,'attributes':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf['options']['attributes']||null:null,'include':_0x19ddaf['options']?_0x19ddaf['options'][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x19ddaf['options'][_0x9620('0x1c')],function(_0x3d80f9){return{'model':db[_0x3d80f9['model']],'as':_0x3d80f9['as'],'attributes':_0x3d80f9[_0x9620('0x1f')],'include':_0x3d80f9[_0x9620('0x1c')]?_['map'](_0x3d80f9[_0x9620('0x1c')],function(_0x360c64){return{'model':db[_0x360c64[_0x9620('0x1e')]],'as':_0x360c64['as'],'attributes':_0x360c64[_0x9620('0x1f')],'include':_0x360c64['include']?_[_0x9620('0x1d')](_0x360c64['include'],function(_0x908b02){return{'model':db[_0x908b02[_0x9620('0x1e')]],'as':_0x908b02['as'],'attributes':_0x908b02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b213f){logger[_0x9620('0xd')](_0x9620('0x21'),_0x19ddaf);logger[_0x9620('0x10')](_0x9620('0x21'),_0x19ddaf,JSON['stringify'](_0x2b213f));_0x42bfe6(_0x2b213f);})[_0x9620('0x22')](function(_0x2d87fa){logger[_0x9620('0x13')](_0x9620('0x21'),_0x2d87fa[_0x9620('0x15')],_0x19ddaf);_0x4cc78e(_0x186b4f['error'](0x1f4,_0x2d87fa[_0x9620('0x15')]));});});}; \ No newline at end of file +var _0x7b77=['FreshsalesAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshsalesAccount','findAll','options','attributes','include','map','model','ShowFreshsalesAccount'];(function(_0x4d1ef9,_0x5690fb){var _0x716f4f=function(_0xd649b0){while(--_0xd649b0){_0x4d1ef9['push'](_0x4d1ef9['shift']());}};_0x716f4f(++_0x5690fb);}(_0x7b77,0x179));var _0x77b7=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x7b77[_0x173f10];return _0x53142d;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var moment=require(_0x77b7('0x2'));var BPromise=require(_0x77b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77b7('0x4'));var db=require(_0x77b7('0x5'))['db'];var utils=require(_0x77b7('0x6'));var logger=require('../../config/logger')(_0x77b7('0x7'));var config=require(_0x77b7('0x8'));var jayson=require(_0x77b7('0x9'));var client=jayson[_0x77b7('0xa')][_0x77b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe3c16b,_0x5c9387,_0x39d8e4){return new BPromise(function(_0x32b8ab,_0x33d439){return client['request'](_0xe3c16b,_0x39d8e4)[_0x77b7('0xc')](function(_0x4cfd3f){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'));logger[_0x77b7('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'),JSON[_0x77b7('0xf')](_0x4cfd3f));if(_0x4cfd3f[_0x77b7('0x10')]){if(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x11')]===0x1f4){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x4cfd3f['error'][_0x77b7('0x13')]);return _0x33d439(_0x4cfd3f[_0x77b7('0x10')]['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c9387,_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);return _0x32b8ab(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);}else{logger[_0x77b7('0x14')](_0x77b7('0x12'),_0x5c9387,'request\x20sent');_0x32b8ab(_0x4cfd3f[_0x77b7('0x15')][_0x77b7('0x13')]);}})[_0x77b7('0x16')](function(_0x2060df){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x2060df);_0x33d439(_0x2060df);});});}exports[_0x77b7('0x17')]=function(_0x12caf0){var _0x286046=this;return new Promise(function(_0x4a0005,_0x511d88){return db['FreshsalesAccount'][_0x77b7('0x18')]({'raw':_0x12caf0['options']?_0x12caf0['options']['raw']===undefined?!![]:![]:!![],'where':_0x12caf0['options']?_0x12caf0[_0x77b7('0x19')]['where']||null:null,'attributes':_0x12caf0[_0x77b7('0x19')]?_0x12caf0['options'][_0x77b7('0x1a')]||null:null,'limit':_0x12caf0['options']?_0x12caf0[_0x77b7('0x19')]['limit']||null:null,'include':_0x12caf0[_0x77b7('0x19')]?_0x12caf0[_0x77b7('0x19')][_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x12caf0[_0x77b7('0x19')][_0x77b7('0x1b')],function(_0x29a892){return{'model':db[_0x29a892[_0x77b7('0x1d')]],'as':_0x29a892['as'],'attributes':_0x29a892[_0x77b7('0x1a')],'include':_0x29a892[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x29a892[_0x77b7('0x1b')],function(_0x29c2aa){return{'model':db[_0x29c2aa[_0x77b7('0x1d')]],'as':_0x29c2aa['as'],'attributes':_0x29c2aa[_0x77b7('0x1a')],'include':_0x29c2aa[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x29c2aa[_0x77b7('0x1b')],function(_0x47971f){return{'model':db[_0x47971f['model']],'as':_0x47971f['as'],'attributes':_0x47971f[_0x77b7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x77b7('0xc')](function(_0x3cae5a){logger['info'](_0x77b7('0x17'),_0x12caf0);logger[_0x77b7('0xe')](_0x77b7('0x17'),_0x12caf0,JSON[_0x77b7('0xf')](_0x3cae5a));_0x4a0005(_0x3cae5a);})[_0x77b7('0x16')](function(_0x323363){logger[_0x77b7('0x10')](_0x77b7('0x17'),_0x323363[_0x77b7('0x13')],_0x12caf0);_0x511d88(_0x286046['error'](0x1f4,_0x323363[_0x77b7('0x13')]));});});};exports[_0x77b7('0x1e')]=function(_0x23aa7e){var _0x3f21dd=this;return new Promise(function(_0x2e87e6,_0x3f63a){return db[_0x77b7('0x1f')][_0x77b7('0x20')]({'raw':_0x23aa7e[_0x77b7('0x19')]?_0x23aa7e[_0x77b7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x23aa7e[_0x77b7('0x19')]?_0x23aa7e[_0x77b7('0x19')][_0x77b7('0x21')]||null:null,'attributes':_0x23aa7e['options']?_0x23aa7e[_0x77b7('0x19')]['attributes']||null:null,'include':_0x23aa7e[_0x77b7('0x19')]?_0x23aa7e[_0x77b7('0x19')]['include']?_[_0x77b7('0x1c')](_0x23aa7e['options'][_0x77b7('0x1b')],function(_0x27b835){return{'model':db[_0x27b835[_0x77b7('0x1d')]],'as':_0x27b835['as'],'attributes':_0x27b835['attributes'],'include':_0x27b835[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x27b835[_0x77b7('0x1b')],function(_0x31a1b0){return{'model':db[_0x31a1b0[_0x77b7('0x1d')]],'as':_0x31a1b0['as'],'attributes':_0x31a1b0[_0x77b7('0x1a')],'include':_0x31a1b0[_0x77b7('0x1b')]?_[_0x77b7('0x1c')](_0x31a1b0[_0x77b7('0x1b')],function(_0x2e23fb){return{'model':db[_0x2e23fb[_0x77b7('0x1d')]],'as':_0x2e23fb['as'],'attributes':_0x2e23fb[_0x77b7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x77b7('0xc')](function(_0x4f157c){logger[_0x77b7('0x14')](_0x77b7('0x1e'),_0x23aa7e);logger[_0x77b7('0xe')]('ShowFreshsalesAccount',_0x23aa7e,JSON['stringify'](_0x4f157c));_0x2e87e6(_0x4f157c);})[_0x77b7('0x16')](function(_0x2c5c77){logger[_0x77b7('0x10')](_0x77b7('0x1e'),_0x2c5c77[_0x77b7('0x13')],_0x23aa7e);_0x3f63a(_0x3f21dd[_0x77b7('0x10')](0x1f4,_0x2c5c77[_0x77b7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index fa4548d..32820f8 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 _0xdff4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getDescriptions','/:id/fields','post','create','/:id','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x515398,_0x21bf63){var _0x43a65a=function(_0x4ba9f5){while(--_0x4ba9f5){_0x515398['push'](_0x515398['shift']());}};_0x43a65a(++_0x21bf63);}(_0xdff4,0xe2));var _0x4dff=function(_0x18b27e,_0x45810b){_0x18b27e=_0x18b27e-0x0;var _0x558ea2=_0xdff4[_0x18b27e];return _0x558ea2;};'use strict';var multer=require(_0x4dff('0x0'));var util=require(_0x4dff('0x1'));var path=require(_0x4dff('0x2'));var timeout=require(_0x4dff('0x3'));var express=require('express');var router=express[_0x4dff('0x4')]();var auth=require(_0x4dff('0x5'));var interaction=require(_0x4dff('0x6'));var config=require(_0x4dff('0x7'));var controller=require(_0x4dff('0x8'));router[_0x4dff('0x9')]('/',auth[_0x4dff('0xa')](),controller[_0x4dff('0xb')]);router[_0x4dff('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4dff('0xc')]);router['get'](_0x4dff('0xd'),auth[_0x4dff('0xa')](),controller['getSubjects']);router[_0x4dff('0x9')]('/:id/descriptions',auth[_0x4dff('0xa')](),controller[_0x4dff('0xe')]);router[_0x4dff('0x9')](_0x4dff('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x4dff('0x10')]('/',auth[_0x4dff('0xa')](),controller[_0x4dff('0x11')]);router['put'](_0x4dff('0x12'),auth[_0x4dff('0xa')](),controller['update']);router[_0x4dff('0x13')](_0x4dff('0x12'),auth['isAuthenticated'](),controller[_0x4dff('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa333=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x30227e,_0x5853f4){var _0x62fdc2=function(_0x21b1c5){while(--_0x21b1c5){_0x30227e['push'](_0x30227e['shift']());}};_0x62fdc2(++_0x5853f4);}(_0xa333,0x19f));var _0x3a33=function(_0x165ae0,_0x24dc48){_0x165ae0=_0x165ae0-0x0;var _0x23db42=_0xa333[_0x165ae0];return _0x23db42;};'use strict';var multer=require(_0x3a33('0x0'));var util=require(_0x3a33('0x1'));var path=require(_0x3a33('0x2'));var timeout=require(_0x3a33('0x3'));var express=require('express');var router=express[_0x3a33('0x4')]();var auth=require(_0x3a33('0x5'));var interaction=require(_0x3a33('0x6'));var config=require(_0x3a33('0x7'));var controller=require(_0x3a33('0x8'));router[_0x3a33('0x9')]('/',auth['isAuthenticated'](),controller[_0x3a33('0xa')]);router[_0x3a33('0x9')]('/:id',auth[_0x3a33('0xb')](),controller['show']);router[_0x3a33('0x9')]('/:id/subjects',auth[_0x3a33('0xb')](),controller[_0x3a33('0xc')]);router[_0x3a33('0x9')](_0x3a33('0xd'),auth['isAuthenticated'](),controller[_0x3a33('0xe')]);router[_0x3a33('0x9')](_0x3a33('0xf'),auth['isAuthenticated'](),controller[_0x3a33('0x10')]);router[_0x3a33('0x11')]('/',auth[_0x3a33('0xb')](),controller[_0x3a33('0x12')]);router[_0x3a33('0x13')](_0x3a33('0x14'),auth[_0x3a33('0xb')](),controller[_0x3a33('0x15')]);router[_0x3a33('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3a33('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0ef55b5..2728cac 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 _0xc111=['STRING','exports'];(function(_0x5d939a,_0x3ee040){var _0x28eba4=function(_0x3a5072){while(--_0x3a5072){_0x5d939a['push'](_0x5d939a['shift']());}};_0x28eba4(++_0x3ee040);}(_0xc111,0x189));var _0x1c11=function(_0x202556,_0x37f5ea){_0x202556=_0x202556-0x0;var _0x18da49=_0xc111[_0x202556];return _0x18da49;};'use strict';var Sequelize=require('sequelize');module[_0x1c11('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c11('0x1')]}}; \ No newline at end of file +var _0xf594=['STRING','sequelize','exports'];(function(_0x4f8831,_0x1160a2){var _0x35b97a=function(_0x2b9072){while(--_0x2b9072){_0x4f8831['push'](_0x4f8831['shift']());}};_0x35b97a(++_0x1160a2);}(_0xf594,0x14e));var _0x4f59=function(_0x4cfa6b,_0x4ea876){_0x4cfa6b=_0x4cfa6b-0x0;var _0x4b698e=_0xf594[_0x4cfa6b];return _0x4b698e;};'use strict';var Sequelize=require(_0x4f59('0x0'));module[_0x4f59('0x1')]={'name':{'type':Sequelize[_0x4f59('0x2')]},'description':{'type':Sequelize[_0x4f59('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f83b708..5606ee7 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 _0x5fc3=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','client','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshsalesConfiguration','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','catch','create','body','getSubjects','findOne','FreshsalesField','merge','getDescriptions','getFields','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto'];(function(_0x3609c9,_0x3104a5){var _0x5a1a2b=function(_0x58fe13){while(--_0x58fe13){_0x3609c9['push'](_0x3609c9['shift']());}};_0x5a1a2b(++_0x3104a5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0x5fc3[_0x54ea7a];return _0x65a10d;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x35fc('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397738,_0x22055e,_0x2a6ad2,_0x29730f){return new BPromise(function(_0x38d9f2,_0x5cfe94){var _0x59507a=_0x29730f||client;return _0x59507a['request'](_0x397738,_0x2a6ad2)['then'](function(_0x398b67){logger[_0x35fc('0x19')](_0x35fc('0x1a'),_0x22055e,_0x35fc('0x1b'));logger[_0x35fc('0x1c')](_0x35fc('0x1d'),_0x22055e,'request\x20sent',JSON[_0x35fc('0x1e')](_0x398b67));if(_0x398b67[_0x35fc('0x1f')]){if(_0x398b67['error'][_0x35fc('0x20')]===0x1f4){logger[_0x35fc('0x1f')](_0x35fc('0x1a'),_0x22055e,_0x398b67['error'][_0x35fc('0x21')]);return _0x5cfe94(_0x398b67[_0x35fc('0x1f')][_0x35fc('0x21')]);}logger['error'](_0x35fc('0x1a'),_0x22055e,_0x398b67[_0x35fc('0x1f')][_0x35fc('0x21')]);return _0x38d9f2(_0x398b67[_0x35fc('0x1f')][_0x35fc('0x21')]);}else{logger[_0x35fc('0x19')](_0x35fc('0x1a'),_0x22055e,_0x35fc('0x1b'));_0x38d9f2(_0x398b67[_0x35fc('0x22')][_0x35fc('0x21')]);}})['catch'](function(_0x323aee){logger[_0x35fc('0x1f')](_0x35fc('0x1a'),_0x22055e,_0x323aee);_0x5cfe94(_0x323aee);});});}function respondWithStatusCode(_0x2d8183,_0x3b4743){_0x3b4743=_0x3b4743||0xcc;return function(_0x55e9e7){if(_0x55e9e7){return _0x2d8183[_0x35fc('0x23')](_0x3b4743);}return _0x2d8183[_0x35fc('0x24')](_0x3b4743)['end']();};}function respondWithResult(_0x265324,_0x5a93df){_0x5a93df=_0x5a93df||0xc8;return function(_0x3d4a98){if(_0x3d4a98){return _0x265324['status'](_0x5a93df)[_0x35fc('0x25')](_0x3d4a98);}};}function respondWithFilteredResult(_0x598d7a,_0x1bf180){return function(_0xdfab9f){if(_0xdfab9f){var _0x5cb986=_0xdfab9f[_0x35fc('0x26')],_0x519264=_0x1bf180[_0x35fc('0x27')],_0x47774c=_0x1bf180['offset']+_0x1bf180[_0x35fc('0x28')],_0x58edb6;if(_0x47774c>=_0x5cb986){_0x47774c=_0x5cb986;_0x58edb6=0xc8;}else{_0x58edb6=0xce;}_0x598d7a[_0x35fc('0x24')](_0x58edb6);return _0x598d7a[_0x35fc('0x29')](_0x35fc('0x2a'),_0x519264+'-'+_0x47774c+'/'+_0x5cb986)[_0x35fc('0x25')](_0xdfab9f);}return null;};}function patchUpdates(_0x134dfa){return function(_0x11ccdb){try{jsonpatch[_0x35fc('0x2b')](_0x11ccdb,_0x134dfa,!![]);}catch(_0x54aedc){return BPromise[_0x35fc('0x2c')](_0x54aedc);}return _0x11ccdb[_0x35fc('0x2d')]();};}function saveUpdates(_0x22af18,_0x52acc5){return function(_0xe79f52){if(_0xe79f52){return _0xe79f52[_0x35fc('0x2e')](_0x22af18)[_0x35fc('0x2f')](function(_0xe6e4ba){return _0xe6e4ba;});}return null;};}function removeEntity(_0xd8a4ca,_0x103181){return function(_0x222ddb){if(_0x222ddb){return _0x222ddb[_0x35fc('0x30')]()[_0x35fc('0x2f')](function(){_0xd8a4ca[_0x35fc('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0313,_0x114bc1){return function(_0x4af5fe){if(!_0x4af5fe){_0x5e0313[_0x35fc('0x23')](0x194);}return _0x4af5fe;};}function handleError(_0x39454e,_0x1c4b8b){_0x1c4b8b=_0x1c4b8b||0x1f4;return function(_0x227471){logger[_0x35fc('0x1f')](_0x227471[_0x35fc('0x31')]);if(_0x227471['name']){delete _0x227471[_0x35fc('0x32')];}_0x39454e[_0x35fc('0x24')](_0x1c4b8b)[_0x35fc('0x33')](_0x227471);};}exports[_0x35fc('0x34')]=function(_0x2bbd36,_0x2f823b){var _0x553597={},_0x2483be={},_0x38193d={'count':0x0,'rows':[]};var _0x1fecdf=_['map'](db[_0x35fc('0x35')]['rawAttributes'],function(_0x2ecb2e){return{'name':_0x2ecb2e[_0x35fc('0x36')],'type':_0x2ecb2e[_0x35fc('0x37')][_0x35fc('0x38')]};});_0x2483be['model']=_['map'](_0x1fecdf,'name');_0x2483be[_0x35fc('0x39')]=_['keys'](_0x2bbd36[_0x35fc('0x39')]);_0x2483be['filters']=_[_0x35fc('0x3a')](_0x2483be[_0x35fc('0x3b')],_0x2483be[_0x35fc('0x39')]);_0x553597[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x2483be[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x2bbd36['query'][_0x35fc('0x3d')]));_0x553597[_0x35fc('0x3c')]=_0x553597['attributes'][_0x35fc('0x3e')]?_0x553597[_0x35fc('0x3c')]:_0x2483be[_0x35fc('0x3b')];if(!_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x3f')](_0x35fc('0x40'))){_0x553597['limit']=qs[_0x35fc('0x28')](_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x28')]);_0x553597['offset']=qs[_0x35fc('0x27')](_0x2bbd36[_0x35fc('0x39')]['offset']);}_0x553597[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x42')]);_0x553597[_0x35fc('0x43')]=qs[_0x35fc('0x44')](_[_0x35fc('0x45')](_0x2bbd36[_0x35fc('0x39')],_0x2483be['filters']),_0x1fecdf);if(_0x2bbd36['query'][_0x35fc('0x46')]){_0x553597[_0x35fc('0x43')]=_['merge'](_0x553597['where'],{'$or':_['map'](_0x1fecdf,function(_0x79677d){if(_0x79677d[_0x35fc('0x37')]!=='VIRTUAL'){var _0x1f3605={};_0x1f3605[_0x79677d[_0x35fc('0x32')]]={'$like':'%'+_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x46')]+'%'};return _0x1f3605;}})});}_0x553597=_['merge']({},_0x553597,_0x2bbd36['options']);var _0x5bf2f4={'where':_0x553597['where']};return db['FreshsalesConfiguration'][_0x35fc('0x26')](_0x5bf2f4)[_0x35fc('0x2f')](function(_0x4fc5bc){_0x38193d[_0x35fc('0x26')]=_0x4fc5bc;if(_0x2bbd36['query'][_0x35fc('0x47')]){_0x553597[_0x35fc('0x48')]=[{'all':!![]}];}return db[_0x35fc('0x35')][_0x35fc('0x49')](_0x553597);})[_0x35fc('0x2f')](function(_0x5d3d0f){_0x38193d[_0x35fc('0x4a')]=_0x5d3d0f;return _0x38193d;})[_0x35fc('0x2f')](respondWithFilteredResult(_0x2f823b,_0x553597))['catch'](handleError(_0x2f823b,null));};exports[_0x35fc('0x4b')]=function(_0x298b7b,_0x2a8a09){var _0x211746={'raw':![],'where':{'id':_0x298b7b[_0x35fc('0x4c')]['id']}},_0x5bc8c3={};_0x5bc8c3['model']=_['keys'](db[_0x35fc('0x35')][_0x35fc('0x4d')]);_0x5bc8c3[_0x35fc('0x39')]=_[_0x35fc('0x4e')](_0x298b7b[_0x35fc('0x39')]);_0x5bc8c3[_0x35fc('0x44')]=_[_0x35fc('0x3a')](_0x5bc8c3[_0x35fc('0x3b')],_0x5bc8c3['query']);_0x211746[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x5bc8c3[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x298b7b[_0x35fc('0x39')][_0x35fc('0x3d')]));_0x211746[_0x35fc('0x3c')]=_0x211746[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x211746[_0x35fc('0x3c')]:_0x5bc8c3[_0x35fc('0x3b')];if(_0x298b7b[_0x35fc('0x39')][_0x35fc('0x47')]){_0x211746[_0x35fc('0x48')]=[{'all':!![]}];}_0x211746=_['merge']({},_0x211746,_0x298b7b['options']);return db[_0x35fc('0x35')][_0x35fc('0x4f')](_0x211746)[_0x35fc('0x2f')](handleEntityNotFound(_0x2a8a09,null))[_0x35fc('0x2f')](respondWithResult(_0x2a8a09,null))[_0x35fc('0x50')](handleError(_0x2a8a09,null));};exports[_0x35fc('0x51')]=function(_0x4a4798,_0x4f024c){return db[_0x35fc('0x35')][_0x35fc('0x51')](_0x4a4798[_0x35fc('0x52')],{})[_0x35fc('0x2f')](respondWithResult(_0x4f024c,0xc9))['catch'](handleError(_0x4f024c,null));};exports[_0x35fc('0x2e')]=function(_0x13281f,_0x4965d2){if(_0x13281f[_0x35fc('0x52')]['id']){delete _0x13281f[_0x35fc('0x52')]['id'];}return db['FreshsalesConfiguration'][_0x35fc('0x4f')]({'where':{'id':_0x13281f[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x4965d2,null))[_0x35fc('0x2f')](saveUpdates(_0x13281f['body'],null))['then'](respondWithResult(_0x4965d2,null))['catch'](handleError(_0x4965d2,null));};exports[_0x35fc('0x30')]=function(_0x2ea8d6,_0x5ce231){return db[_0x35fc('0x35')][_0x35fc('0x4f')]({'where':{'id':_0x2ea8d6[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x5ce231,null))[_0x35fc('0x2f')](removeEntity(_0x5ce231,null))['catch'](handleError(_0x5ce231,null));};exports[_0x35fc('0x53')]=function(_0x757aa6,_0x39d470,_0x509e77){var _0x304dba={};var _0x1dbf5a={};var _0x47fb1a;var _0x35a676;return db[_0x35fc('0x35')][_0x35fc('0x54')]({'where':{'id':_0x757aa6[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x39d470,null))[_0x35fc('0x2f')](function(_0x8501d1){if(_0x8501d1){_0x47fb1a=_0x8501d1;_0x1dbf5a[_0x35fc('0x3b')]=_['keys'](db[_0x35fc('0x55')][_0x35fc('0x4d')]);_0x1dbf5a[_0x35fc('0x39')]=_['keys'](_0x757aa6[_0x35fc('0x39')]);_0x1dbf5a['filters']=_['intersection'](_0x1dbf5a['model'],_0x1dbf5a[_0x35fc('0x39')]);_0x304dba[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x1dbf5a[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x757aa6['query']['fields']));_0x304dba['attributes']=_0x304dba['attributes']['length']?_0x304dba[_0x35fc('0x3c')]:_0x1dbf5a[_0x35fc('0x3b')];_0x304dba[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x757aa6['query'][_0x35fc('0x42')]);_0x304dba[_0x35fc('0x43')]=qs[_0x35fc('0x44')](_[_0x35fc('0x45')](_0x757aa6[_0x35fc('0x39')],_0x1dbf5a[_0x35fc('0x44')]));if(_0x757aa6[_0x35fc('0x39')][_0x35fc('0x46')]){_0x304dba[_0x35fc('0x43')]=_['merge'](_0x304dba[_0x35fc('0x43')],{'$or':_['map'](_0x304dba[_0x35fc('0x3c')],function(_0x9029e3){var _0x2ac8e1={};_0x2ac8e1[_0x9029e3]={'$like':'%'+_0x757aa6[_0x35fc('0x39')]['filter']+'%'};return _0x2ac8e1;})});}_0x304dba=_[_0x35fc('0x56')]({},_0x304dba,_0x757aa6['options']);return _0x47fb1a['getSubjects'](_0x304dba);}})['then'](function(_0x10dd1a){if(_0x10dd1a){_0x35a676=_0x10dd1a['length'];if(!_0x757aa6[_0x35fc('0x39')]['hasOwnProperty'](_0x35fc('0x40'))){_0x304dba['limit']=qs[_0x35fc('0x28')](_0x757aa6[_0x35fc('0x39')][_0x35fc('0x28')]);_0x304dba[_0x35fc('0x27')]=qs['offset'](_0x757aa6[_0x35fc('0x39')][_0x35fc('0x27')]);}return _0x47fb1a[_0x35fc('0x53')](_0x304dba);}})['then'](function(_0x3aa7fa){if(_0x3aa7fa){return _0x3aa7fa?{'count':_0x35a676,'rows':_0x3aa7fa}:null;}})[_0x35fc('0x2f')](respondWithResult(_0x39d470,null))[_0x35fc('0x50')](handleError(_0x39d470,null));};exports[_0x35fc('0x57')]=function(_0x1e4e15,_0x2c4309,_0x2ee98b){var _0x4464d5={};var _0x5159a0={};var _0x28a44b;var _0x2008b3;return db[_0x35fc('0x35')]['findOne']({'where':{'id':_0x1e4e15[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x2c4309,null))['then'](function(_0x4d09d4){if(_0x4d09d4){_0x28a44b=_0x4d09d4;_0x5159a0[_0x35fc('0x3b')]=_['keys'](db[_0x35fc('0x55')][_0x35fc('0x4d')]);_0x5159a0[_0x35fc('0x39')]=_[_0x35fc('0x4e')](_0x1e4e15[_0x35fc('0x39')]);_0x5159a0[_0x35fc('0x44')]=_[_0x35fc('0x3a')](_0x5159a0[_0x35fc('0x3b')],_0x5159a0[_0x35fc('0x39')]);_0x4464d5[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x5159a0[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x3d')]));_0x4464d5[_0x35fc('0x3c')]=_0x4464d5[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x4464d5[_0x35fc('0x3c')]:_0x5159a0[_0x35fc('0x3b')];_0x4464d5['order']=qs[_0x35fc('0x42')](_0x1e4e15['query'][_0x35fc('0x42')]);_0x4464d5[_0x35fc('0x43')]=qs[_0x35fc('0x44')](_[_0x35fc('0x45')](_0x1e4e15[_0x35fc('0x39')],_0x5159a0[_0x35fc('0x44')]));if(_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x46')]){_0x4464d5[_0x35fc('0x43')]=_[_0x35fc('0x56')](_0x4464d5[_0x35fc('0x43')],{'$or':_['map'](_0x4464d5[_0x35fc('0x3c')],function(_0x4657de){var _0x2c1bd2={};_0x2c1bd2[_0x4657de]={'$like':'%'+_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x46')]+'%'};return _0x2c1bd2;})});}_0x4464d5=_[_0x35fc('0x56')]({},_0x4464d5,_0x1e4e15['options']);return _0x28a44b[_0x35fc('0x57')](_0x4464d5);}})[_0x35fc('0x2f')](function(_0x277514){if(_0x277514){_0x2008b3=_0x277514[_0x35fc('0x3e')];if(!_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x3f')](_0x35fc('0x40'))){_0x4464d5[_0x35fc('0x28')]=qs[_0x35fc('0x28')](_0x1e4e15['query'][_0x35fc('0x28')]);_0x4464d5['offset']=qs[_0x35fc('0x27')](_0x1e4e15[_0x35fc('0x39')]['offset']);}return _0x28a44b[_0x35fc('0x57')](_0x4464d5);}})[_0x35fc('0x2f')](function(_0xcaa49){if(_0xcaa49){return _0xcaa49?{'count':_0x2008b3,'rows':_0xcaa49}:null;}})[_0x35fc('0x2f')](respondWithResult(_0x2c4309,null))[_0x35fc('0x50')](handleError(_0x2c4309,null));};exports[_0x35fc('0x58')]=function(_0x42f87e,_0x452c10,_0x25ee61){var _0x5806bf={};var _0x4c70e2={};var _0x4e7c7b;var _0x531117;return db[_0x35fc('0x35')][_0x35fc('0x54')]({'where':{'id':_0x42f87e[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x452c10,null))[_0x35fc('0x2f')](function(_0x4f535a){if(_0x4f535a){_0x4e7c7b=_0x4f535a;_0x4c70e2[_0x35fc('0x3b')]=_[_0x35fc('0x4e')](db[_0x35fc('0x55')][_0x35fc('0x4d')]);_0x4c70e2['query']=_[_0x35fc('0x4e')](_0x42f87e[_0x35fc('0x39')]);_0x4c70e2[_0x35fc('0x44')]=_['intersection'](_0x4c70e2[_0x35fc('0x3b')],_0x4c70e2[_0x35fc('0x39')]);_0x5806bf[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x4c70e2[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x42f87e[_0x35fc('0x39')][_0x35fc('0x3d')]));_0x5806bf['attributes']=_0x5806bf[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x5806bf[_0x35fc('0x3c')]:_0x4c70e2[_0x35fc('0x3b')];_0x5806bf[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x42f87e['query'][_0x35fc('0x42')]);_0x5806bf['where']=qs['filters'](_[_0x35fc('0x45')](_0x42f87e['query'],_0x4c70e2[_0x35fc('0x44')]));if(_0x42f87e[_0x35fc('0x39')][_0x35fc('0x46')]){_0x5806bf['where']=_[_0x35fc('0x56')](_0x5806bf[_0x35fc('0x43')],{'$or':_[_0x35fc('0x59')](_0x5806bf[_0x35fc('0x3c')],function(_0x21f7e6){var _0x5abdf9={};_0x5abdf9[_0x21f7e6]={'$like':'%'+_0x42f87e['query']['filter']+'%'};return _0x5abdf9;})});}_0x5806bf=_[_0x35fc('0x56')]({},_0x5806bf,_0x42f87e['options']);return _0x4e7c7b[_0x35fc('0x58')](_0x5806bf);}})[_0x35fc('0x2f')](function(_0x391321){if(_0x391321){_0x531117=_0x391321[_0x35fc('0x3e')];if(!_0x42f87e['query'][_0x35fc('0x3f')](_0x35fc('0x40'))){_0x5806bf[_0x35fc('0x28')]=qs['limit'](_0x42f87e[_0x35fc('0x39')][_0x35fc('0x28')]);_0x5806bf[_0x35fc('0x27')]=qs['offset'](_0x42f87e['query']['offset']);}return _0x4e7c7b[_0x35fc('0x58')](_0x5806bf);}})[_0x35fc('0x2f')](function(_0x163b04){if(_0x163b04){return _0x163b04?{'count':_0x531117,'rows':_0x163b04}:null;}})[_0x35fc('0x2f')](respondWithResult(_0x452c10,null))['catch'](handleError(_0x452c10,null));}; \ No newline at end of file +var _0x5fab=['FreshsalesField','length','hasOwnProperty','getSubjects','getDescriptions','nolimit','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','FreshsalesConfiguration','rawAttributes','type','key','model','map','attributes','intersection','fields','query','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x5fab[_0x5c846d];return _0xd064e4;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb5fa('0x1a')][_0xb5fa('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56e8b0,_0x116849,_0x577af0,_0x265992){return new BPromise(function(_0x3fc372,_0x40c914){var _0xca8d82=_0x265992||client;return _0xca8d82[_0xb5fa('0x1c')](_0x56e8b0,_0x577af0)['then'](function(_0x567f31){logger[_0xb5fa('0x1d')](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));logger[_0xb5fa('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x116849,'request\x20sent',JSON[_0xb5fa('0x21')](_0x567f31));if(_0x567f31[_0xb5fa('0x22')]){if(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x23')]===0x1f4){logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);return _0x40c914(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);}logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31['error'][_0xb5fa('0x24')]);return _0x3fc372(_0x567f31['error'][_0xb5fa('0x24')]);}else{logger['info'](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));_0x3fc372(_0x567f31['result'][_0xb5fa('0x24')]);}})[_0xb5fa('0x25')](function(_0x283a56){logger['error'](_0xb5fa('0x1e'),_0x116849,_0x283a56);_0x40c914(_0x283a56);});});}function respondWithStatusCode(_0xec108f,_0x444237){_0x444237=_0x444237||0xcc;return function(_0x542348){if(_0x542348){return _0xec108f[_0xb5fa('0x26')](_0x444237);}return _0xec108f['status'](_0x444237)[_0xb5fa('0x27')]();};}function respondWithResult(_0x264591,_0x11053a){_0x11053a=_0x11053a||0xc8;return function(_0x543edf){if(_0x543edf){return _0x264591[_0xb5fa('0x28')](_0x11053a)[_0xb5fa('0x29')](_0x543edf);}};}function respondWithFilteredResult(_0x6a455c,_0x20d649){return function(_0x568870){if(_0x568870){var _0x4ec294=_0x568870[_0xb5fa('0x2a')],_0x5bdf11=_0x20d649[_0xb5fa('0x2b')],_0x5a1c39=_0x20d649[_0xb5fa('0x2b')]+_0x20d649[_0xb5fa('0x2c')],_0x28a350;if(_0x5a1c39>=_0x4ec294){_0x5a1c39=_0x4ec294;_0x28a350=0xc8;}else{_0x28a350=0xce;}_0x6a455c[_0xb5fa('0x28')](_0x28a350);return _0x6a455c[_0xb5fa('0x2d')](_0xb5fa('0x2e'),_0x5bdf11+'-'+_0x5a1c39+'/'+_0x4ec294)[_0xb5fa('0x29')](_0x568870);}return null;};}function patchUpdates(_0x2a5690){return function(_0x142bfa){try{jsonpatch[_0xb5fa('0x2f')](_0x142bfa,_0x2a5690,!![]);}catch(_0xab5427){return BPromise[_0xb5fa('0x30')](_0xab5427);}return _0x142bfa[_0xb5fa('0x31')]();};}function saveUpdates(_0x116773,_0x5a0152){return function(_0x3fd1fb){if(_0x3fd1fb){return _0x3fd1fb[_0xb5fa('0x32')](_0x116773)[_0xb5fa('0x33')](function(_0x291938){return _0x291938;});}return null;};}function removeEntity(_0x370d95,_0x10fb43){return function(_0x25fc7c){if(_0x25fc7c){return _0x25fc7c['destroy']()[_0xb5fa('0x33')](function(){_0x370d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558708,_0x1e6ba0){return function(_0x502d57){if(!_0x502d57){_0x558708[_0xb5fa('0x26')](0x194);}return _0x502d57;};}function handleError(_0x5876f1,_0x5518b1){_0x5518b1=_0x5518b1||0x1f4;return function(_0x1847bc){logger[_0xb5fa('0x22')](_0x1847bc['stack']);if(_0x1847bc['name']){delete _0x1847bc[_0xb5fa('0x34')];}_0x5876f1[_0xb5fa('0x28')](_0x5518b1)[_0xb5fa('0x35')](_0x1847bc);};}exports['index']=function(_0xc9adee,_0xc28a80){var _0x4a7137={},_0x18398f={},_0x2056de={'count':0x0,'rows':[]};var _0x204d6b=_['map'](db[_0xb5fa('0x36')][_0xb5fa('0x37')],function(_0x24ef11){return{'name':_0x24ef11['fieldName'],'type':_0x24ef11[_0xb5fa('0x38')][_0xb5fa('0x39')]};});_0x18398f[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x204d6b,'name');_0x18398f['query']=_['keys'](_0xc9adee['query']);_0x18398f['filters']=_['intersection'](_0x18398f[_0xb5fa('0x3a')],_0x18398f['query']);_0x4a7137[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x18398f[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x4a7137['attributes']=_0x4a7137['attributes']['length']?_0x4a7137[_0xb5fa('0x3c')]:_0x18398f['model'];if(!_0xc9adee[_0xb5fa('0x3f')]['hasOwnProperty']('nolimit')){_0x4a7137[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x4a7137[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}_0x4a7137[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0xc9adee['query'][_0xb5fa('0x41')]);_0x4a7137['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0xc9adee[_0xb5fa('0x3f')],_0x18398f[_0xb5fa('0x42')]),_0x204d6b);if(_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x4a7137[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x4a7137['where'],{'$or':_[_0xb5fa('0x3b')](_0x204d6b,function(_0xc03e44){if(_0xc03e44['type']!==_0xb5fa('0x47')){var _0x5a6ae3={};_0x5a6ae3[_0xc03e44[_0xb5fa('0x34')]]={'$like':'%'+_0xc9adee[_0xb5fa('0x3f')]['filter']+'%'};return _0x5a6ae3;}})});}_0x4a7137=_['merge']({},_0x4a7137,_0xc9adee[_0xb5fa('0x48')]);var _0xe86e11={'where':_0x4a7137[_0xb5fa('0x45')]};return db[_0xb5fa('0x36')][_0xb5fa('0x2a')](_0xe86e11)[_0xb5fa('0x33')](function(_0x10f354){_0x2056de[_0xb5fa('0x2a')]=_0x10f354;if(_0xc9adee['query'][_0xb5fa('0x49')]){_0x4a7137[_0xb5fa('0x4a')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xb5fa('0x4b')](_0x4a7137);})[_0xb5fa('0x33')](function(_0x247999){_0x2056de[_0xb5fa('0x4c')]=_0x247999;return _0x2056de;})[_0xb5fa('0x33')](respondWithFilteredResult(_0xc28a80,_0x4a7137))[_0xb5fa('0x25')](handleError(_0xc28a80,null));};exports[_0xb5fa('0x4d')]=function(_0x33eb2c,_0x20f5f5){var _0x464e36={'raw':![],'where':{'id':_0x33eb2c[_0xb5fa('0x4e')]['id']}},_0xfe091={};_0xfe091[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x36')][_0xb5fa('0x37')]);_0xfe091['query']=_['keys'](_0x33eb2c[_0xb5fa('0x3f')]);_0xfe091['filters']=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],_0xfe091['query']);_0x464e36[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x33eb2c[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x464e36['attributes']=_0x464e36[_0xb5fa('0x3c')]['length']?_0x464e36[_0xb5fa('0x3c')]:_0xfe091[_0xb5fa('0x3a')];if(_0x33eb2c[_0xb5fa('0x3f')]['includeAll']){_0x464e36[_0xb5fa('0x4a')]=[{'all':!![]}];}_0x464e36=_[_0xb5fa('0x46')]({},_0x464e36,_0x33eb2c['options']);return db['FreshsalesConfiguration'][_0xb5fa('0x50')](_0x464e36)[_0xb5fa('0x33')](handleEntityNotFound(_0x20f5f5,null))[_0xb5fa('0x33')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x25')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x51')]=function(_0x7775b4,_0x31c91f){return db[_0xb5fa('0x36')][_0xb5fa('0x51')](_0x7775b4[_0xb5fa('0x52')],{})[_0xb5fa('0x33')](respondWithResult(_0x31c91f,0xc9))[_0xb5fa('0x25')](handleError(_0x31c91f,null));};exports[_0xb5fa('0x32')]=function(_0x2799e7,_0x23f235){if(_0x2799e7[_0xb5fa('0x52')]['id']){delete _0x2799e7[_0xb5fa('0x52')]['id'];}return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x2799e7[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x23f235,null))[_0xb5fa('0x33')](saveUpdates(_0x2799e7[_0xb5fa('0x52')],null))[_0xb5fa('0x33')](respondWithResult(_0x23f235,null))[_0xb5fa('0x25')](handleError(_0x23f235,null));};exports[_0xb5fa('0x53')]=function(_0x24117e,_0x1cb39e){return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x24117e['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1cb39e,null))[_0xb5fa('0x33')](removeEntity(_0x1cb39e,null))[_0xb5fa('0x25')](handleError(_0x1cb39e,null));};exports['getSubjects']=function(_0x441c41,_0x367f7a,_0x1572fb){var _0x2e855c={};var _0x31ab22={};var _0x9d12f1;var _0x2e7286;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x441c41[_0xb5fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x367f7a,null))[_0xb5fa('0x33')](function(_0x26bc03){if(_0x26bc03){_0x9d12f1=_0x26bc03;_0x31ab22['model']=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x31ab22[_0xb5fa('0x3f')]=_[_0xb5fa('0x4f')](_0x441c41[_0xb5fa('0x3f')]);_0x31ab22[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],_0x31ab22[_0xb5fa('0x3f')]);_0x2e855c[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x2e855c[_0xb5fa('0x3c')]=_0x2e855c[_0xb5fa('0x3c')][_0xb5fa('0x56')]?_0x2e855c[_0xb5fa('0x3c')]:_0x31ab22[_0xb5fa('0x3a')];_0x2e855c[_0xb5fa('0x40')]=qs['sort'](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x41')]);_0x2e855c[_0xb5fa('0x45')]=qs['filters'](_[_0xb5fa('0x43')](_0x441c41[_0xb5fa('0x3f')],_0x31ab22['filters']));if(_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x2e855c[_0xb5fa('0x45')]=_['merge'](_0x2e855c['where'],{'$or':_[_0xb5fa('0x3b')](_0x2e855c[_0xb5fa('0x3c')],function(_0x432f04){var _0x57d8b7={};_0x57d8b7[_0x432f04]={'$like':'%'+_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x57d8b7;})});}_0x2e855c=_[_0xb5fa('0x46')]({},_0x2e855c,_0x441c41[_0xb5fa('0x48')]);return _0x9d12f1['getSubjects'](_0x2e855c);}})['then'](function(_0x5cec07){if(_0x5cec07){_0x2e7286=_0x5cec07[_0xb5fa('0x56')];if(!_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x57')]('nolimit')){_0x2e855c[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x2e855c[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x9d12f1[_0xb5fa('0x58')](_0x2e855c);}})[_0xb5fa('0x33')](function(_0x3a1db9){if(_0x3a1db9){return _0x3a1db9?{'count':_0x2e7286,'rows':_0x3a1db9}:null;}})[_0xb5fa('0x33')](respondWithResult(_0x367f7a,null))[_0xb5fa('0x25')](handleError(_0x367f7a,null));};exports[_0xb5fa('0x59')]=function(_0x41127a,_0x5eeaa1,_0xf173e4){var _0x5a6f74={};var _0x47193c={};var _0x209213;var _0x37975d;return db[_0xb5fa('0x36')][_0xb5fa('0x54')]({'where':{'id':_0x41127a['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x5eeaa1,null))['then'](function(_0x77a831){if(_0x77a831){_0x209213=_0x77a831;_0x47193c[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')]['rawAttributes']);_0x47193c['query']=_['keys'](_0x41127a[_0xb5fa('0x3f')]);_0x47193c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x47193c[_0xb5fa('0x3a')],_0x47193c[_0xb5fa('0x3f')]);_0x5a6f74[_0xb5fa('0x3c')]=_['intersection'](_0x47193c[_0xb5fa('0x3a')],qs['fields'](_0x41127a['query'][_0xb5fa('0x3e')]));_0x5a6f74['attributes']=_0x5a6f74['attributes']['length']?_0x5a6f74[_0xb5fa('0x3c')]:_0x47193c['model'];_0x5a6f74[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0x41127a[_0xb5fa('0x3f')]['sort']);_0x5a6f74['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0x41127a['query'],_0x47193c[_0xb5fa('0x42')]));if(_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x5a6f74[_0xb5fa('0x45')]=_['merge'](_0x5a6f74[_0xb5fa('0x45')],{'$or':_[_0xb5fa('0x3b')](_0x5a6f74[_0xb5fa('0x3c')],function(_0x180e63){var _0x1c0f49={};_0x1c0f49[_0x180e63]={'$like':'%'+_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x1c0f49;})});}_0x5a6f74=_['merge']({},_0x5a6f74,_0x41127a[_0xb5fa('0x48')]);return _0x209213['getDescriptions'](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x45790c){if(_0x45790c){_0x37975d=_0x45790c['length'];if(!_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x5a6f74[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x5a6f74[_0xb5fa('0x2b')]=qs['offset'](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x209213[_0xb5fa('0x59')](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x53095e){if(_0x53095e){return _0x53095e?{'count':_0x37975d,'rows':_0x53095e}:null;}})['then'](respondWithResult(_0x5eeaa1,null))['catch'](handleError(_0x5eeaa1,null));};exports['getFields']=function(_0x1c60bd,_0x1e607b,_0xff504d){var _0x188e66={};var _0x599a7c={};var _0x551822;var _0x148cb4;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x1c60bd[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1e607b,null))[_0xb5fa('0x33')](function(_0x577aef){if(_0x577aef){_0x551822=_0x577aef;_0x599a7c[_0xb5fa('0x3a')]=_['keys'](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x599a7c['query']=_['keys'](_0x1c60bd[_0xb5fa('0x3f')]);_0x599a7c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],_0x599a7c[_0xb5fa('0x3f')]);_0x188e66[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x188e66[_0xb5fa('0x3c')]=_0x188e66[_0xb5fa('0x3c')]['length']?_0x188e66['attributes']:_0x599a7c[_0xb5fa('0x3a')];_0x188e66['order']=qs[_0xb5fa('0x41')](_0x1c60bd[_0xb5fa('0x3f')]['sort']);_0x188e66[_0xb5fa('0x45')]=qs[_0xb5fa('0x42')](_['pick'](_0x1c60bd[_0xb5fa('0x3f')],_0x599a7c[_0xb5fa('0x42')]));if(_0x1c60bd['query'][_0xb5fa('0x44')]){_0x188e66[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x188e66['where'],{'$or':_['map'](_0x188e66[_0xb5fa('0x3c')],function(_0x1a24a2){var _0x3b5e1d={};_0x3b5e1d[_0x1a24a2]={'$like':'%'+_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x3b5e1d;})});}_0x188e66=_[_0xb5fa('0x46')]({},_0x188e66,_0x1c60bd[_0xb5fa('0x48')]);return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x1a4465){if(_0x1a4465){_0x148cb4=_0x1a4465['length'];if(!_0x1c60bd['query'][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x188e66[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x1c60bd['query'][_0xb5fa('0x2c')]);_0x188e66[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x1c60bd['query'][_0xb5fa('0x2b')]);}return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x301d14){if(_0x301d14){return _0x301d14?{'count':_0x148cb4,'rows':_0x301d14}:null;}})['then'](respondWithResult(_0x1e607b,null))[_0xb5fa('0x25')](handleError(_0x1e607b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b660412..18429b9 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 _0xff30=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5664ea,_0x4cb50b){var _0x23152c=function(_0x5625a9){while(--_0x5625a9){_0x5664ea['push'](_0x5664ea['shift']());}};_0x23152c(++_0x4cb50b);}(_0xff30,0x104));var _0x0ff3=function(_0x2f9247,_0x52d8ad){_0x2f9247=_0x2f9247-0x0;var _0x290822=_0xff30[_0x2f9247];return _0x290822;};'use strict';var _=require(_0x0ff3('0x0'));var util=require(_0x0ff3('0x1'));var logger=require(_0x0ff3('0x2'))(_0x0ff3('0x3'));var moment=require(_0x0ff3('0x4'));var BPromise=require(_0x0ff3('0x5'));var rp=require(_0x0ff3('0x6'));var fs=require('fs');var path=require(_0x0ff3('0x7'));var rimraf=require(_0x0ff3('0x8'));var config=require(_0x0ff3('0x9'));var attributes=require(_0x0ff3('0xa'));module[_0x0ff3('0xb')]=function(_0x32e864,_0x2696ba){return _0x32e864[_0x0ff3('0xc')](_0x0ff3('0xd'),attributes,{'tableName':_0x0ff3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3bd=['../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4b0742,_0x18295a){var _0x8209e5=function(_0x10880e){while(--_0x10880e){_0x4b0742['push'](_0x4b0742['shift']());}};_0x8209e5(++_0x18295a);}(_0xe3bd,0x126));var _0xde3b=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0xe3bd[_0x289842];return _0x16155a;};'use strict';var _=require('lodash');var util=require(_0xde3b('0x0'));var logger=require(_0xde3b('0x1'))(_0xde3b('0x2'));var moment=require('moment');var BPromise=require(_0xde3b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde3b('0x4'));var rimraf=require(_0xde3b('0x5'));var config=require(_0xde3b('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xde3b('0x7')]=function(_0x5e8ba1,_0xcf0dc5){return _0x5e8ba1['define'](_0xde3b('0x8'),attributes,{'tableName':_0xde3b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 357777d..0ef3816 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 _0xf12a=['info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf12a,0x8e));var _0xaf12=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xf12a[_0x79ebc5];return _0x3813b6;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var moment=require(_0xaf12('0x2'));var BPromise=require(_0xaf12('0x3'));var rs=require(_0xaf12('0x4'));var fs=require('fs');var Redis=require(_0xaf12('0x5'));var db=require(_0xaf12('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf12('0x8'));var client=jayson['client'][_0xaf12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x581819,_0x38389d,_0x418c64){return new BPromise(function(_0x3b6626,_0xff1952){return client[_0xaf12('0xa')](_0x581819,_0x418c64)[_0xaf12('0xb')](function(_0x3d733d){logger[_0xaf12('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x38389d,_0xaf12('0xd'));logger['debug'](_0xaf12('0xe'),_0x38389d,'request\x20sent',JSON[_0xaf12('0xf')](_0x3d733d));if(_0x3d733d['error']){if(_0x3d733d['error'][_0xaf12('0x10')]===0x1f4){logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0xff1952(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0x3b6626(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}else{logger[_0xaf12('0xc')](_0xaf12('0x12'),_0x38389d,_0xaf12('0xd'));_0x3b6626(_0x3d733d[_0xaf12('0x14')]['message']);}})[_0xaf12('0x15')](function(_0x31a420){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x38389d,_0x31a420);_0xff1952(_0x31a420);});});} \ No newline at end of file +var _0x2136=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x3e8eec,_0x2d5f75){var _0x11b418=function(_0x1b4e57){while(--_0x1b4e57){_0x3e8eec['push'](_0x3e8eec['shift']());}};_0x11b418(++_0x2d5f75);}(_0x2136,0x1eb));var _0x6213=function(_0x300a26,_0x1ad864){_0x300a26=_0x300a26-0x0;var _0x43bccd=_0x2136[_0x300a26];return _0x43bccd;};'use strict';var _=require(_0x6213('0x0'));var util=require(_0x6213('0x1'));var moment=require(_0x6213('0x2'));var BPromise=require(_0x6213('0x3'));var rs=require(_0x6213('0x4'));var fs=require('fs');var Redis=require(_0x6213('0x5'));var db=require(_0x6213('0x6'))['db'];var utils=require(_0x6213('0x7'));var logger=require(_0x6213('0x8'))(_0x6213('0x9'));var config=require('../../config/environment');var jayson=require(_0x6213('0xa'));var client=jayson[_0x6213('0xb')][_0x6213('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49db78,_0x2b05fe,_0x555c17){return new BPromise(function(_0x3604f1,_0x88e8a0){return client['request'](_0x49db78,_0x555c17)['then'](function(_0x275ba8){logger[_0x6213('0xd')](_0x6213('0xe'),_0x2b05fe,_0x6213('0xf'));logger[_0x6213('0x10')](_0x6213('0x11'),_0x2b05fe,_0x6213('0xf'),JSON['stringify'](_0x275ba8));if(_0x275ba8[_0x6213('0x12')]){if(_0x275ba8[_0x6213('0x12')][_0x6213('0x13')]===0x1f4){logger['error'](_0x6213('0xe'),_0x2b05fe,_0x275ba8[_0x6213('0x12')][_0x6213('0x14')]);return _0x88e8a0(_0x275ba8[_0x6213('0x12')][_0x6213('0x14')]);}logger['error'](_0x6213('0xe'),_0x2b05fe,_0x275ba8['error'][_0x6213('0x14')]);return _0x3604f1(_0x275ba8[_0x6213('0x12')][_0x6213('0x14')]);}else{logger['info'](_0x6213('0xe'),_0x2b05fe,_0x6213('0xf'));_0x3604f1(_0x275ba8['result']['message']);}})[_0x6213('0x15')](function(_0x208557){logger['error'](_0x6213('0xe'),_0x2b05fe,_0x208557);_0x88e8a0(_0x208557);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c25aeda..18680f7 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 _0xacf2=['../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x4afc2c,_0x336a88){var _0x164084=function(_0x14b783){while(--_0x14b783){_0x4afc2c['push'](_0x4afc2c['shift']());}};_0x164084(++_0x336a88);}(_0xacf2,0x147));var _0x2acf=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0xacf2[_0x4322c6];return _0x4e7537;};'use strict';var multer=require(_0x2acf('0x0'));var util=require('util');var path=require(_0x2acf('0x1'));var timeout=require(_0x2acf('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2acf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2acf('0x4'));var controller=require(_0x2acf('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x2acf('0x6')]);router['get'](_0x2acf('0x7'),auth[_0x2acf('0x8')](),controller['show']);router[_0x2acf('0x9')]('/',auth[_0x2acf('0x8')](),controller[_0x2acf('0xa')]);router[_0x2acf('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2acf('0xc')]);router['delete'](_0x2acf('0x7'),auth[_0x2acf('0x8')](),controller[_0x2acf('0xd')]);module[_0x2acf('0xe')]=router; \ No newline at end of file +var _0x695d=['destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','./intFreshsalesField.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x587daa,_0x4cbba1){var _0x1bd460=function(_0xf48ff7){while(--_0xf48ff7){_0x587daa['push'](_0x587daa['shift']());}};_0x1bd460(++_0x4cbba1);}(_0x695d,0x134));var _0xd695=function(_0x4d05f8,_0x3efc70){_0x4d05f8=_0x4d05f8-0x0;var _0x220513=_0x695d[_0x4d05f8];return _0x220513;};'use strict';var multer=require('multer');var util=require(_0xd695('0x0'));var path=require(_0xd695('0x1'));var timeout=require(_0xd695('0x2'));var express=require(_0xd695('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd695('0x4'));var config=require('../../config/environment');var controller=require(_0xd695('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd695('0x6')]);router[_0xd695('0x7')](_0xd695('0x8'),auth['isAuthenticated'](),controller[_0xd695('0x9')]);router[_0xd695('0xa')]('/',auth[_0xd695('0xb')](),controller[_0xd695('0xc')]);router[_0xd695('0xd')](_0xd695('0x8'),auth[_0xd695('0xb')](),controller[_0xd695('0xe')]);router[_0xd695('0xf')](_0xd695('0x8'),auth[_0xd695('0xb')](),controller[_0xd695('0x10')]);module[_0xd695('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 921349b..19827c4 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 _0xae4a=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x5e2a54,_0x424ad7){var _0x1c8b6b=function(_0x718a9b){while(--_0x718a9b){_0x5e2a54['push'](_0x5e2a54['shift']());}};_0x1c8b6b(++_0x424ad7);}(_0xae4a,0x68));var _0xaae4=function(_0xf2f354,_0xdc4fdb){_0xf2f354=_0xf2f354-0x0;var _0x4485b8=_0xae4a[_0xf2f354];return _0x4485b8;};'use strict';var Sequelize=require(_0xaae4('0x0'));module[_0xaae4('0x1')]={'type':{'type':Sequelize['ENUM'](_0xaae4('0x2'),_0xaae4('0x3'),'customVariable',_0xaae4('0x4')),'defaultValue':_0xaae4('0x2')},'content':{'type':Sequelize[_0xaae4('0x5')]},'key':{'type':Sequelize[_0xaae4('0x5')]},'keyType':{'type':Sequelize[_0xaae4('0x6')](_0xaae4('0x2'),_0xaae4('0x3'),_0xaae4('0x7'))},'keyContent':{'type':Sequelize[_0xaae4('0x5')]},'idField':{'type':Sequelize[_0xaae4('0x5')]},'nameField':{'type':Sequelize[_0xaae4('0x5')]},'customField':{'type':Sequelize[_0xaae4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaae4('0x5')]}}; \ No newline at end of file +var _0xeacb=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x320fbb,_0x489b1b){var _0x3aa5f0=function(_0x2b5237){while(--_0x2b5237){_0x320fbb['push'](_0x320fbb['shift']());}};_0x3aa5f0(++_0x489b1b);}(_0xeacb,0x199));var _0xbeac=function(_0x4b54ab,_0x1c8260){_0x4b54ab=_0x4b54ab-0x0;var _0x41d95d=_0xeacb[_0x4b54ab];return _0x41d95d;};'use strict';var Sequelize=require(_0xbeac('0x0'));module['exports']={'type':{'type':Sequelize[_0xbeac('0x1')](_0xbeac('0x2'),_0xbeac('0x3'),_0xbeac('0x4'),_0xbeac('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbeac('0x6')]},'key':{'type':Sequelize[_0xbeac('0x6')]},'keyType':{'type':Sequelize[_0xbeac('0x1')](_0xbeac('0x2'),_0xbeac('0x3'),_0xbeac('0x4'))},'keyContent':{'type':Sequelize[_0xbeac('0x6')]},'idField':{'type':Sequelize[_0xbeac('0x6')]},'nameField':{'type':Sequelize[_0xbeac('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 81555af..97bba8a 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 _0xcb80=['count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','update','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x455835,_0x131dae){var _0x33c408=function(_0x27d806){while(--_0x27d806){_0x455835['push'](_0x455835['shift']());}};_0x33c408(++_0x131dae);}(_0xcb80,0xc3));var _0x0cb8=function(_0xccca7,_0x41b2ea){_0xccca7=_0xccca7-0x0;var _0x320bcc=_0xcb80[_0xccca7];return _0x320bcc;};'use strict';var pdf=require(_0x0cb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0cb8('0x1'));var zipdir=require(_0x0cb8('0x2'));var jsonpatch=require(_0x0cb8('0x3'));var rp=require(_0x0cb8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0cb8('0x5'));var util=require(_0x0cb8('0x6'));var path=require(_0x0cb8('0x7'));var sox=require(_0x0cb8('0x8'));var csv=require('to-csv');var ejs=require(_0x0cb8('0x9'));var fs=require('fs');var _=require(_0x0cb8('0xa'));var squel=require('squel');var crypto=require(_0x0cb8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0cb8('0xc'));var toCsv=require(_0x0cb8('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0cb8('0xe'));var authService=require(_0x0cb8('0xf'));var qs=require(_0x0cb8('0x10'));var as=require(_0x0cb8('0x11'));var hardwareService=require(_0x0cb8('0x12'));var logger=require(_0x0cb8('0x13'))(_0x0cb8('0x14'));var utils=require(_0x0cb8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0cb8('0x16'));var db=require(_0x0cb8('0x17'))['db'];function respondWithStatusCode(_0x41de9c,_0x58ac2f){_0x58ac2f=_0x58ac2f||0xcc;return function(_0x1f3e74){if(_0x1f3e74){return _0x41de9c[_0x0cb8('0x18')](_0x58ac2f);}return _0x41de9c['status'](_0x58ac2f)[_0x0cb8('0x19')]();};}function respondWithResult(_0x5698d6,_0x47884e){_0x47884e=_0x47884e||0xc8;return function(_0x18790b){if(_0x18790b){return _0x5698d6[_0x0cb8('0x1a')](_0x47884e)['json'](_0x18790b);}};}function respondWithFilteredResult(_0x37468d,_0x5cc545){return function(_0x53cb46){if(_0x53cb46){var _0x361204=_0x53cb46[_0x0cb8('0x1b')],_0x89433d=_0x5cc545[_0x0cb8('0x1c')],_0x52812e=_0x5cc545[_0x0cb8('0x1c')]+_0x5cc545[_0x0cb8('0x1d')],_0x51be98;if(_0x52812e>=_0x361204){_0x52812e=_0x361204;_0x51be98=0xc8;}else{_0x51be98=0xce;}_0x37468d[_0x0cb8('0x1a')](_0x51be98);return _0x37468d[_0x0cb8('0x1e')](_0x0cb8('0x1f'),_0x89433d+'-'+_0x52812e+'/'+_0x361204)[_0x0cb8('0x20')](_0x53cb46);}return null;};}function patchUpdates(_0x86c533){return function(_0x55adb5){try{jsonpatch[_0x0cb8('0x21')](_0x55adb5,_0x86c533,!![]);}catch(_0x44e0ad){return BPromise[_0x0cb8('0x22')](_0x44e0ad);}return _0x55adb5[_0x0cb8('0x23')]();};}function saveUpdates(_0xd8f3a8,_0x2e4604){return function(_0x182bb0){if(_0x182bb0){return _0x182bb0['update'](_0xd8f3a8)[_0x0cb8('0x24')](function(_0x15cbfe){return _0x15cbfe;});}return null;};}function removeEntity(_0x236a82,_0x52d4c7){return function(_0xc525fb){if(_0xc525fb){return _0xc525fb[_0x0cb8('0x25')]()[_0x0cb8('0x24')](function(){_0x236a82[_0x0cb8('0x1a')](0xcc)[_0x0cb8('0x19')]();});}};}function handleEntityNotFound(_0x36df8c,_0x430831){return function(_0xa3b498){if(!_0xa3b498){_0x36df8c['sendStatus'](0x194);}return _0xa3b498;};}function handleError(_0x1cbe9e,_0x5c8f76){_0x5c8f76=_0x5c8f76||0x1f4;return function(_0xc19780){logger['error'](_0xc19780[_0x0cb8('0x26')]);if(_0xc19780['name']){delete _0xc19780[_0x0cb8('0x27')];}_0x1cbe9e[_0x0cb8('0x1a')](_0x5c8f76)[_0x0cb8('0x28')](_0xc19780);};}exports[_0x0cb8('0x29')]=function(_0x348ac1,_0x43535d){var _0x27012d={},_0xd35f43={},_0x4ae0e9={'count':0x0,'rows':[]};var _0x1a9771=_[_0x0cb8('0x2a')](db[_0x0cb8('0x2b')][_0x0cb8('0x2c')],function(_0x50be18){return{'name':_0x50be18[_0x0cb8('0x2d')],'type':_0x50be18[_0x0cb8('0x2e')][_0x0cb8('0x2f')]};});_0xd35f43[_0x0cb8('0x30')]=_['map'](_0x1a9771,_0x0cb8('0x27'));_0xd35f43[_0x0cb8('0x31')]=_['keys'](_0x348ac1['query']);_0xd35f43['filters']=_['intersection'](_0xd35f43['model'],_0xd35f43[_0x0cb8('0x31')]);_0x27012d['attributes']=_[_0x0cb8('0x32')](_0xd35f43[_0x0cb8('0x30')],qs['fields'](_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x33')]));_0x27012d[_0x0cb8('0x34')]=_0x27012d[_0x0cb8('0x34')][_0x0cb8('0x35')]?_0x27012d[_0x0cb8('0x34')]:_0xd35f43[_0x0cb8('0x30')];if(!_0x348ac1['query']['hasOwnProperty']('nolimit')){_0x27012d[_0x0cb8('0x1d')]=qs[_0x0cb8('0x1d')](_0x348ac1['query'][_0x0cb8('0x1d')]);_0x27012d[_0x0cb8('0x1c')]=qs[_0x0cb8('0x1c')](_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x1c')]);}_0x27012d[_0x0cb8('0x36')]=qs[_0x0cb8('0x37')](_0x348ac1[_0x0cb8('0x31')]['sort']);_0x27012d[_0x0cb8('0x38')]=qs[_0x0cb8('0x39')](_[_0x0cb8('0x3a')](_0x348ac1['query'],_0xd35f43[_0x0cb8('0x39')]),_0x1a9771);if(_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x3b')]){_0x27012d[_0x0cb8('0x38')]=_['merge'](_0x27012d[_0x0cb8('0x38')],{'$or':_[_0x0cb8('0x2a')](_0x1a9771,function(_0x7e3e0){if(_0x7e3e0[_0x0cb8('0x2e')]!==_0x0cb8('0x3c')){var _0x5813eb={};_0x5813eb[_0x7e3e0[_0x0cb8('0x27')]]={'$like':'%'+_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x3b')]+'%'};return _0x5813eb;}})});}_0x27012d=_[_0x0cb8('0x3d')]({},_0x27012d,_0x348ac1[_0x0cb8('0x3e')]);var _0x4eea4a={'where':_0x27012d[_0x0cb8('0x38')]};return db[_0x0cb8('0x2b')][_0x0cb8('0x1b')](_0x4eea4a)[_0x0cb8('0x24')](function(_0x170e94){_0x4ae0e9[_0x0cb8('0x1b')]=_0x170e94;if(_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x3f')]){_0x27012d[_0x0cb8('0x40')]=[{'all':!![]}];}return db[_0x0cb8('0x2b')]['findAll'](_0x27012d);})['then'](function(_0x80937d){_0x4ae0e9[_0x0cb8('0x41')]=_0x80937d;return _0x4ae0e9;})[_0x0cb8('0x24')](respondWithFilteredResult(_0x43535d,_0x27012d))[_0x0cb8('0x42')](handleError(_0x43535d,null));};exports[_0x0cb8('0x43')]=function(_0x516308,_0x12bb37){var _0x17f619={'raw':!![],'where':{'id':_0x516308[_0x0cb8('0x44')]['id']}},_0x1c7014={};_0x1c7014[_0x0cb8('0x30')]=_[_0x0cb8('0x45')](db[_0x0cb8('0x2b')][_0x0cb8('0x2c')]);_0x1c7014[_0x0cb8('0x31')]=_['keys'](_0x516308['query']);_0x1c7014[_0x0cb8('0x39')]=_[_0x0cb8('0x32')](_0x1c7014[_0x0cb8('0x30')],_0x1c7014[_0x0cb8('0x31')]);_0x17f619[_0x0cb8('0x34')]=_[_0x0cb8('0x32')](_0x1c7014[_0x0cb8('0x30')],qs[_0x0cb8('0x33')](_0x516308[_0x0cb8('0x31')][_0x0cb8('0x33')]));_0x17f619[_0x0cb8('0x34')]=_0x17f619['attributes'][_0x0cb8('0x35')]?_0x17f619[_0x0cb8('0x34')]:_0x1c7014[_0x0cb8('0x30')];if(_0x516308[_0x0cb8('0x31')][_0x0cb8('0x3f')]){_0x17f619[_0x0cb8('0x40')]=[{'all':!![]}];}_0x17f619=_[_0x0cb8('0x3d')]({},_0x17f619,_0x516308[_0x0cb8('0x3e')]);return db[_0x0cb8('0x2b')]['find'](_0x17f619)[_0x0cb8('0x24')](handleEntityNotFound(_0x12bb37,null))[_0x0cb8('0x24')](respondWithResult(_0x12bb37,null))[_0x0cb8('0x42')](handleError(_0x12bb37,null));};exports[_0x0cb8('0x46')]=function(_0x2a3937,_0x462413){return db['FreshsalesField'][_0x0cb8('0x46')](_0x2a3937[_0x0cb8('0x47')],{})[_0x0cb8('0x24')](respondWithResult(_0x462413,0xc9))[_0x0cb8('0x42')](handleError(_0x462413,null));};exports[_0x0cb8('0x48')]=function(_0x4a1e90,_0x28fa24){if(_0x4a1e90['body']['id']){delete _0x4a1e90[_0x0cb8('0x47')]['id'];}return db[_0x0cb8('0x2b')][_0x0cb8('0x49')]({'where':{'id':_0x4a1e90[_0x0cb8('0x44')]['id']}})['then'](handleEntityNotFound(_0x28fa24,null))[_0x0cb8('0x24')](saveUpdates(_0x4a1e90['body'],null))[_0x0cb8('0x24')](respondWithResult(_0x28fa24,null))[_0x0cb8('0x42')](handleError(_0x28fa24,null));};exports[_0x0cb8('0x25')]=function(_0x269c7c,_0x1fd999){return db['FreshsalesField'][_0x0cb8('0x49')]({'where':{'id':_0x269c7c[_0x0cb8('0x44')]['id']}})[_0x0cb8('0x24')](handleEntityNotFound(_0x1fd999,null))[_0x0cb8('0x24')](removeEntity(_0x1fd999,null))['catch'](handleError(_0x1fd999,null));}; \ No newline at end of file +var _0xe298=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','FreshsalesField','includeAll','include','findAll','catch','show','params','keys','options','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x2ba1d4,_0x531b52){var _0x870274=function(_0x5c1c07){while(--_0x5c1c07){_0x2ba1d4['push'](_0x2ba1d4['shift']());}};_0x870274(++_0x531b52);}(_0xe298,0x128));var _0x8e29=function(_0x41a96e,_0x132b4d){_0x41a96e=_0x41a96e-0x0;var _0x20af96=_0xe298[_0x41a96e];return _0x20af96;};'use strict';var pdf=require(_0x8e29('0x0'));var emlformat=require(_0x8e29('0x1'));var rimraf=require(_0x8e29('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e29('0x3'));var rp=require(_0x8e29('0x4'));var moment=require(_0x8e29('0x5'));var BPromise=require(_0x8e29('0x6'));var Mustache=require(_0x8e29('0x7'));var util=require(_0x8e29('0x8'));var path=require(_0x8e29('0x9'));var sox=require(_0x8e29('0xa'));var csv=require(_0x8e29('0xb'));var ejs=require(_0x8e29('0xc'));var fs=require('fs');var _=require(_0x8e29('0xd'));var squel=require(_0x8e29('0xe'));var crypto=require(_0x8e29('0xf'));var jsforce=require(_0x8e29('0x10'));var deskjs=require(_0x8e29('0x11'));var toCsv=require(_0x8e29('0xb'));var querystring=require(_0x8e29('0x12'));var Papa=require(_0x8e29('0x13'));var Redis=require('ioredis');var authService=require(_0x8e29('0x14'));var qs=require(_0x8e29('0x15'));var as=require(_0x8e29('0x16'));var hardwareService=require(_0x8e29('0x17'));var logger=require(_0x8e29('0x18'))(_0x8e29('0x19'));var utils=require(_0x8e29('0x1a'));var config=require(_0x8e29('0x1b'));var licenseUtil=require(_0x8e29('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x140c39,_0x5203c3){_0x5203c3=_0x5203c3||0xcc;return function(_0x225f8a){if(_0x225f8a){return _0x140c39[_0x8e29('0x1d')](_0x5203c3);}return _0x140c39['status'](_0x5203c3)['end']();};}function respondWithResult(_0x435aa8,_0xdde1a4){_0xdde1a4=_0xdde1a4||0xc8;return function(_0x4d0211){if(_0x4d0211){return _0x435aa8['status'](_0xdde1a4)[_0x8e29('0x1e')](_0x4d0211);}};}function respondWithFilteredResult(_0x1e052e,_0x34a0fc){return function(_0x2b1542){if(_0x2b1542){var _0x58326d=_0x2b1542[_0x8e29('0x1f')],_0x4c906b=_0x34a0fc['offset'],_0x3382ed=_0x34a0fc[_0x8e29('0x20')]+_0x34a0fc[_0x8e29('0x21')],_0x34a3ce;if(_0x3382ed>=_0x58326d){_0x3382ed=_0x58326d;_0x34a3ce=0xc8;}else{_0x34a3ce=0xce;}_0x1e052e[_0x8e29('0x22')](_0x34a3ce);return _0x1e052e[_0x8e29('0x23')](_0x8e29('0x24'),_0x4c906b+'-'+_0x3382ed+'/'+_0x58326d)[_0x8e29('0x1e')](_0x2b1542);}return null;};}function patchUpdates(_0x151038){return function(_0x2fd4d9){try{jsonpatch['apply'](_0x2fd4d9,_0x151038,!![]);}catch(_0x4a4117){return BPromise[_0x8e29('0x25')](_0x4a4117);}return _0x2fd4d9[_0x8e29('0x26')]();};}function saveUpdates(_0x58d550,_0x8dc3ad){return function(_0x522b6c){if(_0x522b6c){return _0x522b6c[_0x8e29('0x27')](_0x58d550)[_0x8e29('0x28')](function(_0x1d192b){return _0x1d192b;});}return null;};}function removeEntity(_0x3f8e02,_0x10da2f){return function(_0x5753ad){if(_0x5753ad){return _0x5753ad[_0x8e29('0x29')]()[_0x8e29('0x28')](function(){_0x3f8e02[_0x8e29('0x22')](0xcc)[_0x8e29('0x2a')]();});}};}function handleEntityNotFound(_0x359128,_0x164544){return function(_0x320f03){if(!_0x320f03){_0x359128['sendStatus'](0x194);}return _0x320f03;};}function handleError(_0x35fc70,_0x494d45){_0x494d45=_0x494d45||0x1f4;return function(_0x2aa701){logger['error'](_0x2aa701[_0x8e29('0x2b')]);if(_0x2aa701[_0x8e29('0x2c')]){delete _0x2aa701['name'];}_0x35fc70[_0x8e29('0x22')](_0x494d45)[_0x8e29('0x2d')](_0x2aa701);};}exports[_0x8e29('0x2e')]=function(_0xc64bc2,_0x5850be){var _0x52dccb={},_0x30b01f={},_0x22f733={'count':0x0,'rows':[]};var _0x390bd5=_[_0x8e29('0x2f')](db['FreshsalesField'][_0x8e29('0x30')],function(_0x18469d){return{'name':_0x18469d['fieldName'],'type':_0x18469d['type']['key']};});_0x30b01f[_0x8e29('0x31')]=_[_0x8e29('0x2f')](_0x390bd5,_0x8e29('0x2c'));_0x30b01f[_0x8e29('0x32')]=_['keys'](_0xc64bc2['query']);_0x30b01f[_0x8e29('0x33')]=_['intersection'](_0x30b01f['model'],_0x30b01f[_0x8e29('0x32')]);_0x52dccb['attributes']=_[_0x8e29('0x34')](_0x30b01f['model'],qs[_0x8e29('0x35')](_0xc64bc2[_0x8e29('0x32')][_0x8e29('0x35')]));_0x52dccb[_0x8e29('0x36')]=_0x52dccb[_0x8e29('0x36')][_0x8e29('0x37')]?_0x52dccb[_0x8e29('0x36')]:_0x30b01f['model'];if(!_0xc64bc2[_0x8e29('0x32')][_0x8e29('0x38')]('nolimit')){_0x52dccb[_0x8e29('0x21')]=qs['limit'](_0xc64bc2[_0x8e29('0x32')]['limit']);_0x52dccb[_0x8e29('0x20')]=qs['offset'](_0xc64bc2['query'][_0x8e29('0x20')]);}_0x52dccb['order']=qs[_0x8e29('0x39')](_0xc64bc2['query']['sort']);_0x52dccb[_0x8e29('0x3a')]=qs[_0x8e29('0x33')](_[_0x8e29('0x3b')](_0xc64bc2[_0x8e29('0x32')],_0x30b01f['filters']),_0x390bd5);if(_0xc64bc2['query'][_0x8e29('0x3c')]){_0x52dccb['where']=_[_0x8e29('0x3d')](_0x52dccb[_0x8e29('0x3a')],{'$or':_[_0x8e29('0x2f')](_0x390bd5,function(_0xd64c28){if(_0xd64c28['type']!==_0x8e29('0x3e')){var _0x27c898={};_0x27c898[_0xd64c28['name']]={'$like':'%'+_0xc64bc2[_0x8e29('0x32')]['filter']+'%'};return _0x27c898;}})});}_0x52dccb=_[_0x8e29('0x3d')]({},_0x52dccb,_0xc64bc2['options']);var _0x36af5d={'where':_0x52dccb['where']};return db[_0x8e29('0x3f')][_0x8e29('0x1f')](_0x36af5d)[_0x8e29('0x28')](function(_0x149223){_0x22f733[_0x8e29('0x1f')]=_0x149223;if(_0xc64bc2[_0x8e29('0x32')][_0x8e29('0x40')]){_0x52dccb[_0x8e29('0x41')]=[{'all':!![]}];}return db['FreshsalesField'][_0x8e29('0x42')](_0x52dccb);})[_0x8e29('0x28')](function(_0x49924c){_0x22f733['rows']=_0x49924c;return _0x22f733;})[_0x8e29('0x28')](respondWithFilteredResult(_0x5850be,_0x52dccb))[_0x8e29('0x43')](handleError(_0x5850be,null));};exports[_0x8e29('0x44')]=function(_0x57e1e7,_0x47ed96){var _0xe51e13={'raw':!![],'where':{'id':_0x57e1e7[_0x8e29('0x45')]['id']}},_0x419863={};_0x419863['model']=_[_0x8e29('0x46')](db['FreshsalesField']['rawAttributes']);_0x419863[_0x8e29('0x32')]=_[_0x8e29('0x46')](_0x57e1e7['query']);_0x419863[_0x8e29('0x33')]=_['intersection'](_0x419863[_0x8e29('0x31')],_0x419863[_0x8e29('0x32')]);_0xe51e13[_0x8e29('0x36')]=_[_0x8e29('0x34')](_0x419863[_0x8e29('0x31')],qs[_0x8e29('0x35')](_0x57e1e7[_0x8e29('0x32')][_0x8e29('0x35')]));_0xe51e13[_0x8e29('0x36')]=_0xe51e13[_0x8e29('0x36')][_0x8e29('0x37')]?_0xe51e13['attributes']:_0x419863[_0x8e29('0x31')];if(_0x57e1e7[_0x8e29('0x32')][_0x8e29('0x40')]){_0xe51e13[_0x8e29('0x41')]=[{'all':!![]}];}_0xe51e13=_[_0x8e29('0x3d')]({},_0xe51e13,_0x57e1e7[_0x8e29('0x47')]);return db[_0x8e29('0x3f')]['find'](_0xe51e13)['then'](handleEntityNotFound(_0x47ed96,null))[_0x8e29('0x28')](respondWithResult(_0x47ed96,null))[_0x8e29('0x43')](handleError(_0x47ed96,null));};exports['create']=function(_0x328dc0,_0xe41bc1){return db[_0x8e29('0x3f')][_0x8e29('0x48')](_0x328dc0[_0x8e29('0x49')],{})['then'](respondWithResult(_0xe41bc1,0xc9))[_0x8e29('0x43')](handleError(_0xe41bc1,null));};exports['update']=function(_0x50f360,_0xbe41b2){if(_0x50f360[_0x8e29('0x49')]['id']){delete _0x50f360['body']['id'];}return db['FreshsalesField'][_0x8e29('0x4a')]({'where':{'id':_0x50f360[_0x8e29('0x45')]['id']}})[_0x8e29('0x28')](handleEntityNotFound(_0xbe41b2,null))[_0x8e29('0x28')](saveUpdates(_0x50f360[_0x8e29('0x49')],null))['then'](respondWithResult(_0xbe41b2,null))[_0x8e29('0x43')](handleError(_0xbe41b2,null));};exports[_0x8e29('0x29')]=function(_0x93632a,_0x1be665){return db[_0x8e29('0x3f')][_0x8e29('0x4a')]({'where':{'id':_0x93632a[_0x8e29('0x45')]['id']}})['then'](handleEntityNotFound(_0x1be665,null))[_0x8e29('0x28')](removeEntity(_0x1be665,null))[_0x8e29('0x43')](handleError(_0x1be665,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7f25155..471c2dc 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 _0x633c=['moment','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','api'];(function(_0x3e10d1,_0x186a52){var _0x5e3b74=function(_0x93e919){while(--_0x93e919){_0x3e10d1['push'](_0x3e10d1['shift']());}};_0x5e3b74(++_0x186a52);}(_0x633c,0x1c5));var _0xc633=function(_0x2eeb90,_0xd84a19){_0x2eeb90=_0x2eeb90-0x0;var _0x274e4f=_0x633c[_0x2eeb90];return _0x274e4f;};'use strict';var _=require(_0xc633('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc633('0x1'));var moment=require(_0xc633('0x2'));var BPromise=require('bluebird');var rp=require(_0xc633('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc633('0x4'));var config=require(_0xc633('0x5'));var attributes=require(_0xc633('0x6'));module[_0xc633('0x7')]=function(_0x22fc71,_0x230aea){return _0x22fc71[_0xc633('0x8')](_0xc633('0x9'),attributes,{'tableName':_0xc633('0xa'),'paranoid':![],'indexes':[{'name':_0xc633('0xb'),'fields':[_0xc633('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd742=['path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x507fcf,_0x59264c){var _0x43c80c=function(_0x5767d6){while(--_0x5767d6){_0x507fcf['push'](_0x507fcf['shift']());}};_0x43c80c(++_0x59264c);}(_0xd742,0x1ca));var _0x2d74=function(_0xf358fb,_0x24eb2d){_0xf358fb=_0xf358fb-0x0;var _0x16926b=_0xd742[_0xf358fb];return _0x16926b;};'use strict';var _=require(_0x2d74('0x0'));var util=require(_0x2d74('0x1'));var logger=require('../../config/logger')(_0x2d74('0x2'));var moment=require(_0x2d74('0x3'));var BPromise=require(_0x2d74('0x4'));var rp=require(_0x2d74('0x5'));var fs=require('fs');var path=require(_0x2d74('0x6'));var rimraf=require(_0x2d74('0x7'));var config=require(_0x2d74('0x8'));var attributes=require(_0x2d74('0x9'));module[_0x2d74('0xa')]=function(_0x328d93,_0x114896){return _0x328d93['define'](_0x2d74('0xb'),attributes,{'tableName':_0x2d74('0xc'),'paranoid':![],'indexes':[{'name':_0x2d74('0xd'),'fields':[_0x2d74('0xe'),_0x2d74('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 08622a8..9f4e127 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 _0xca41=['request','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xca41,0x130));var _0x1ca4=function(_0x3e81b4,_0x342258){_0x3e81b4=_0x3e81b4-0x0;var _0x28db70=_0xca41[_0x3e81b4];return _0x28db70;};'use strict';var _=require(_0x1ca4('0x0'));var util=require('util');var moment=require(_0x1ca4('0x1'));var BPromise=require(_0x1ca4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ca4('0x3'));var db=require(_0x1ca4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ca4('0x5'))(_0x1ca4('0x6'));var config=require(_0x1ca4('0x7'));var jayson=require(_0x1ca4('0x8'));var client=jayson[_0x1ca4('0x9')][_0x1ca4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41612a,_0x262d26,_0x30c5b5){return new BPromise(function(_0x1ad8eb,_0x1eba37){return client[_0x1ca4('0xb')](_0x41612a,_0x30c5b5)['then'](function(_0x914858){logger[_0x1ca4('0xc')](_0x1ca4('0xd'),_0x262d26,'request\x20sent');logger['debug'](_0x1ca4('0xe'),_0x262d26,_0x1ca4('0xf'),JSON[_0x1ca4('0x10')](_0x914858));if(_0x914858[_0x1ca4('0x11')]){if(_0x914858[_0x1ca4('0x11')][_0x1ca4('0x12')]===0x1f4){logger[_0x1ca4('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x262d26,_0x914858[_0x1ca4('0x11')]['message']);return _0x1eba37(_0x914858[_0x1ca4('0x11')][_0x1ca4('0x13')]);}logger['error'](_0x1ca4('0xd'),_0x262d26,_0x914858[_0x1ca4('0x11')][_0x1ca4('0x13')]);return _0x1ad8eb(_0x914858[_0x1ca4('0x11')][_0x1ca4('0x13')]);}else{logger[_0x1ca4('0xc')](_0x1ca4('0xd'),_0x262d26,_0x1ca4('0xf'));_0x1ad8eb(_0x914858[_0x1ca4('0x14')][_0x1ca4('0x13')]);}})['catch'](function(_0x42d8cc){logger[_0x1ca4('0x11')](_0x1ca4('0xd'),_0x262d26,_0x42d8cc);_0x1eba37(_0x42d8cc);});});} \ No newline at end of file +var _0x8270=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis'];(function(_0x2a5f24,_0x462b60){var _0x3ed66c=function(_0x1063df){while(--_0x1063df){_0x2a5f24['push'](_0x2a5f24['shift']());}};_0x3ed66c(++_0x462b60);}(_0x8270,0xe3));var _0x0827=function(_0x220a6b,_0x417ec3){_0x220a6b=_0x220a6b-0x0;var _0x55d1d2=_0x8270[_0x220a6b];return _0x55d1d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0827('0x0'));var BPromise=require(_0x0827('0x1'));var rs=require(_0x0827('0x2'));var fs=require('fs');var Redis=require(_0x0827('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0827('0x4'));var config=require(_0x0827('0x5'));var jayson=require(_0x0827('0x6'));var client=jayson[_0x0827('0x7')][_0x0827('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bdf2f,_0x4ce989,_0x5c5982){return new BPromise(function(_0x320e9d,_0x257d8d){return client[_0x0827('0x9')](_0x5bdf2f,_0x5c5982)[_0x0827('0xa')](function(_0x895d38){logger[_0x0827('0xb')](_0x0827('0xc'),_0x4ce989,_0x0827('0xd'));logger[_0x0827('0xe')](_0x0827('0xf'),_0x4ce989,_0x0827('0xd'),JSON[_0x0827('0x10')](_0x895d38));if(_0x895d38[_0x0827('0x11')]){if(_0x895d38[_0x0827('0x11')][_0x0827('0x12')]===0x1f4){logger[_0x0827('0x11')](_0x0827('0xc'),_0x4ce989,_0x895d38['error'][_0x0827('0x13')]);return _0x257d8d(_0x895d38['error'][_0x0827('0x13')]);}logger[_0x0827('0x11')](_0x0827('0xc'),_0x4ce989,_0x895d38[_0x0827('0x11')]['message']);return _0x320e9d(_0x895d38[_0x0827('0x11')][_0x0827('0x13')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4ce989,_0x0827('0xd'));_0x320e9d(_0x895d38['result'][_0x0827('0x13')]);}})[_0x0827('0x14')](function(_0x21c81b){logger[_0x0827('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4ce989,_0x21c81b);_0x257d8d(_0x21c81b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 32a4deb..f8050ab 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 _0xae20=['/:id/configurations','getConfigurations','/:id/fields','create','post','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4fac37,_0x574258){var _0x40fe0f=function(_0x2514de){while(--_0x2514de){_0x4fac37['push'](_0x4fac37['shift']());}};_0x40fe0f(++_0x574258);}(_0xae20,0x12f));var _0x0ae2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xae20[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0ae2('0x0'));var util=require(_0x0ae2('0x1'));var path=require(_0x0ae2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0ae2('0x3'));var interaction=require(_0x0ae2('0x4'));var config=require(_0x0ae2('0x5'));var controller=require(_0x0ae2('0x6'));router[_0x0ae2('0x7')]('/',auth[_0x0ae2('0x8')](),controller[_0x0ae2('0x9')]);router[_0x0ae2('0x7')](_0x0ae2('0xa'),auth[_0x0ae2('0x8')](),controller[_0x0ae2('0xb')]);router['get'](_0x0ae2('0xc'),auth['isAuthenticated'](),controller[_0x0ae2('0xd')]);router[_0x0ae2('0x7')](_0x0ae2('0xe'),auth[_0x0ae2('0x8')](),controller['getFields']);router['post']('/',auth[_0x0ae2('0x8')](),controller[_0x0ae2('0xf')]);router[_0x0ae2('0x10')](_0x0ae2('0xc'),auth[_0x0ae2('0x8')](),controller['addConfiguration']);router['put'](_0x0ae2('0xa'),auth[_0x0ae2('0x8')](),controller[_0x0ae2('0x11')]);router[_0x0ae2('0x12')]('/:id',auth[_0x0ae2('0x8')](),controller[_0x0ae2('0x13')]);module[_0x0ae2('0x14')]=router; \ No newline at end of file +var _0x2f7a=['../../components/interaction/service','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0xa28f46,_0x42e5ea){var _0x42c386=function(_0x3744ba){while(--_0x3744ba){_0xa28f46['push'](_0xa28f46['shift']());}};_0x42c386(++_0x42e5ea);}(_0x2f7a,0x1f2));var _0xa2f7=function(_0x394cdd,_0x2dbc7a){_0x394cdd=_0x394cdd-0x0;var _0x1c74e4=_0x2f7a[_0x394cdd];return _0x1c74e4;};'use strict';var multer=require(_0xa2f7('0x0'));var util=require(_0xa2f7('0x1'));var path=require(_0xa2f7('0x2'));var timeout=require(_0xa2f7('0x3'));var express=require(_0xa2f7('0x4'));var router=express[_0xa2f7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa2f7('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router[_0xa2f7('0x7')]('/',auth['isAuthenticated'](),controller[_0xa2f7('0x8')]);router[_0xa2f7('0x7')]('/:id',auth[_0xa2f7('0x9')](),controller[_0xa2f7('0xa')]);router[_0xa2f7('0x7')](_0xa2f7('0xb'),auth['isAuthenticated'](),controller[_0xa2f7('0xc')]);router['get'](_0xa2f7('0xd'),auth[_0xa2f7('0x9')](),controller[_0xa2f7('0xe')]);router['post']('/',auth[_0xa2f7('0x9')](),controller['create']);router[_0xa2f7('0xf')](_0xa2f7('0xb'),auth[_0xa2f7('0x9')](),controller[_0xa2f7('0x10')]);router[_0xa2f7('0x11')](_0xa2f7('0x12'),auth[_0xa2f7('0x9')](),controller['update']);router[_0xa2f7('0x13')](_0xa2f7('0x12'),auth[_0xa2f7('0x9')](),controller[_0xa2f7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8cf755a..acfd6d6 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 _0x2acc=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x9d1180,_0x2f71fb){var _0x155274=function(_0x1867c1){while(--_0x1867c1){_0x9d1180['push'](_0x9d1180['shift']());}};_0x155274(++_0x2f71fb);}(_0x2acc,0x181));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc2ac('0x0'));module[_0xc2ac('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc2ac('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc2ac('0x3')},'remoteUri':{'type':Sequelize[_0xc2ac('0x2')]},'password':{'type':Sequelize[_0xc2ac('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xc2ac('0x2')]},'serverUrl':{'type':Sequelize[_0xc2ac('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc2ac('0x4')](_0xc2ac('0x5'),_0xc2ac('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x7b83=['ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x39647a,_0x513178){var _0x5d94ac=function(_0x16c807){while(--_0x16c807){_0x39647a['push'](_0x39647a['shift']());}};_0x5d94ac(++_0x513178);}(_0x7b83,0x12e));var _0x37b8=function(_0x444b29,_0x127582){_0x444b29=_0x444b29-0x0;var _0x428314=_0x7b83[_0x444b29];return _0x428314;};'use strict';var Sequelize=require(_0x37b8('0x0'));module[_0x37b8('0x1')]={'name':{'type':Sequelize[_0x37b8('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x37b8('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x37b8('0x2')]},'password':{'type':Sequelize[_0x37b8('0x2')]},'clientId':{'type':Sequelize[_0x37b8('0x2')]},'clientSecret':{'type':Sequelize[_0x37b8('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x37b8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x37b8('0x3')](_0x37b8('0x4'),'newTab'),'defaultValue':_0x37b8('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d9458c4..8d9dea2 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 _0x4fc2=['Case','Origin','Reason','SuppliedCompany','includes','label','custom','picklistValues','value','boolean','True','False','false','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','destroy','stack','name','send','SalesforceAccount','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','then','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','SalesforceConfiguration','length','pick','findOne','channel','Descriptions','SalesforceField','Subjects','remoteUri','clientId','clientSecret','username','password','securityToken','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','Priority','Status','Type','isNil'];(function(_0x56e22b,_0x4f79b0){var _0x3cf6d4=function(_0x7a687c){while(--_0x7a687c){_0x56e22b['push'](_0x56e22b['shift']());}};_0x3cf6d4(++_0x4f79b0);}(_0x4fc2,0x111));var _0x24fc=function(_0x1a1ba8,_0x52a437){_0x1a1ba8=_0x1a1ba8-0x0;var _0x3c5118=_0x4fc2[_0x1a1ba8];return _0x3c5118;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x10'));var authService=require(_0x24fc('0x11'));var qs=require(_0x24fc('0x12'));var as=require(_0x24fc('0x13'));var hardwareService=require(_0x24fc('0x14'));var logger=require(_0x24fc('0x15'))(_0x24fc('0x16'));var utils=require(_0x24fc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x18'));var db=require(_0x24fc('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x24fc('0x1a'));var client=jayson[_0x24fc('0x1b')][_0x24fc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3bc30b,_0x30f19b,_0x326276,_0x537b5c){return new BPromise(function(_0x2a0971,_0x18c0a7){var _0x2ffed3=_0x537b5c||client;return _0x2ffed3[_0x24fc('0x1d')](_0x3bc30b,_0x326276)['then'](function(_0x2ac989){logger['info'](_0x24fc('0x1e'),_0x30f19b,_0x24fc('0x1f'));logger[_0x24fc('0x20')](_0x24fc('0x21'),_0x30f19b,_0x24fc('0x1f'),JSON['stringify'](_0x2ac989));if(_0x2ac989[_0x24fc('0x22')]){if(_0x2ac989[_0x24fc('0x22')][_0x24fc('0x23')]===0x1f4){logger[_0x24fc('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x30f19b,_0x2ac989[_0x24fc('0x22')][_0x24fc('0x24')]);return _0x18c0a7(_0x2ac989[_0x24fc('0x22')]['message']);}logger[_0x24fc('0x22')](_0x24fc('0x1e'),_0x30f19b,_0x2ac989[_0x24fc('0x22')][_0x24fc('0x24')]);return _0x2a0971(_0x2ac989['error'][_0x24fc('0x24')]);}else{logger['info'](_0x24fc('0x1e'),_0x30f19b,'request\x20sent');_0x2a0971(_0x2ac989[_0x24fc('0x25')][_0x24fc('0x24')]);}})[_0x24fc('0x26')](function(_0x595475){logger[_0x24fc('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x30f19b,_0x595475);_0x18c0a7(_0x595475);});});}function respondWithStatusCode(_0x35a9c7,_0x2bb93a){_0x2bb93a=_0x2bb93a||0xcc;return function(_0x36a9b4){if(_0x36a9b4){return _0x35a9c7[_0x24fc('0x27')](_0x2bb93a);}return _0x35a9c7[_0x24fc('0x28')](_0x2bb93a)[_0x24fc('0x29')]();};}function respondWithResult(_0x3f0875,_0x20192b){_0x20192b=_0x20192b||0xc8;return function(_0x168d98){if(_0x168d98){return _0x3f0875[_0x24fc('0x28')](_0x20192b)['json'](_0x168d98);}};}function respondWithFilteredResult(_0x11c913,_0x16f27f){return function(_0x3ee302){if(_0x3ee302){var _0x5bb4c8=_0x3ee302[_0x24fc('0x2a')],_0xf2f77d=_0x16f27f[_0x24fc('0x2b')],_0x3d1ec8=_0x16f27f[_0x24fc('0x2b')]+_0x16f27f['limit'],_0x35f9f9;if(_0x3d1ec8>=_0x5bb4c8){_0x3d1ec8=_0x5bb4c8;_0x35f9f9=0xc8;}else{_0x35f9f9=0xce;}_0x11c913[_0x24fc('0x28')](_0x35f9f9);return _0x11c913[_0x24fc('0x2c')](_0x24fc('0x2d'),_0xf2f77d+'-'+_0x3d1ec8+'/'+_0x5bb4c8)[_0x24fc('0x2e')](_0x3ee302);}return null;};}function patchUpdates(_0x9f7bbc){return function(_0x490aa5){try{jsonpatch['apply'](_0x490aa5,_0x9f7bbc,!![]);}catch(_0x4e6f73){return BPromise[_0x24fc('0x2f')](_0x4e6f73);}return _0x490aa5['save']();};}function saveUpdates(_0x3f2464,_0x3e6389){return function(_0xae4f22){if(_0xae4f22){return _0xae4f22[_0x24fc('0x30')](_0x3f2464)['then'](function(_0x66eec0){return _0x66eec0;});}return null;};}function removeEntity(_0x33f368,_0x523c1f){return function(_0xf46cd5){if(_0xf46cd5){return _0xf46cd5[_0x24fc('0x31')]()['then'](function(){_0x33f368['status'](0xcc)[_0x24fc('0x29')]();});}};}function handleEntityNotFound(_0x56eae7,_0x3c20a7){return function(_0x98e81b){if(!_0x98e81b){_0x56eae7['sendStatus'](0x194);}return _0x98e81b;};}function handleError(_0x2ae896,_0x33bbf2){_0x33bbf2=_0x33bbf2||0x1f4;return function(_0x3b2862){logger[_0x24fc('0x22')](_0x3b2862[_0x24fc('0x32')]);if(_0x3b2862[_0x24fc('0x33')]){delete _0x3b2862[_0x24fc('0x33')];}_0x2ae896[_0x24fc('0x28')](_0x33bbf2)[_0x24fc('0x34')](_0x3b2862);};}exports['index']=function(_0x320d2e,_0x4224f4){var _0x2fbe30={},_0x316aa2={},_0x242bd5={'count':0x0,'rows':[]};var _0x5781d2=_['map'](db[_0x24fc('0x35')]['rawAttributes'],function(_0x22ef18){return{'name':_0x22ef18[_0x24fc('0x36')],'type':_0x22ef18[_0x24fc('0x37')][_0x24fc('0x38')]};});_0x316aa2['model']=_[_0x24fc('0x39')](_0x5781d2,'name');_0x316aa2[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x320d2e[_0x24fc('0x3a')]);_0x316aa2[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x316aa2['model'],_0x316aa2[_0x24fc('0x3a')]);_0x2fbe30[_0x24fc('0x3e')]=_[_0x24fc('0x3d')](_0x316aa2[_0x24fc('0x3f')],qs['fields'](_0x320d2e[_0x24fc('0x3a')][_0x24fc('0x40')]));_0x2fbe30['attributes']=_0x2fbe30[_0x24fc('0x3e')]['length']?_0x2fbe30[_0x24fc('0x3e')]:_0x316aa2[_0x24fc('0x3f')];if(!_0x320d2e[_0x24fc('0x3a')][_0x24fc('0x41')](_0x24fc('0x42'))){_0x2fbe30[_0x24fc('0x43')]=qs[_0x24fc('0x43')](_0x320d2e[_0x24fc('0x3a')]['limit']);_0x2fbe30[_0x24fc('0x2b')]=qs[_0x24fc('0x2b')](_0x320d2e[_0x24fc('0x3a')]['offset']);}_0x2fbe30[_0x24fc('0x44')]=qs[_0x24fc('0x45')](_0x320d2e['query'][_0x24fc('0x45')]);_0x2fbe30[_0x24fc('0x46')]=qs[_0x24fc('0x3c')](_['pick'](_0x320d2e[_0x24fc('0x3a')],_0x316aa2[_0x24fc('0x3c')]),_0x5781d2);if(_0x320d2e['query'][_0x24fc('0x47')]){_0x2fbe30[_0x24fc('0x46')]=_[_0x24fc('0x48')](_0x2fbe30[_0x24fc('0x46')],{'$or':_['map'](_0x5781d2,function(_0x2eecaf){if(_0x2eecaf[_0x24fc('0x37')]!==_0x24fc('0x49')){var _0x7b38fa={};_0x7b38fa[_0x2eecaf[_0x24fc('0x33')]]={'$like':'%'+_0x320d2e['query'][_0x24fc('0x47')]+'%'};return _0x7b38fa;}})});}_0x2fbe30=_[_0x24fc('0x48')]({},_0x2fbe30,_0x320d2e[_0x24fc('0x4a')]);var _0x3c6ffb={'where':_0x2fbe30['where']};return db[_0x24fc('0x35')][_0x24fc('0x2a')](_0x3c6ffb)['then'](function(_0x5bbb6c){_0x242bd5[_0x24fc('0x2a')]=_0x5bbb6c;if(_0x320d2e['query']['includeAll']){_0x2fbe30[_0x24fc('0x4b')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x24fc('0x4c')](_0x2fbe30);})[_0x24fc('0x4d')](function(_0x5052c8){_0x242bd5['rows']=_0x5052c8;return _0x242bd5;})[_0x24fc('0x4d')](respondWithFilteredResult(_0x4224f4,_0x2fbe30))[_0x24fc('0x26')](handleError(_0x4224f4,null));};exports[_0x24fc('0x4e')]=function(_0x1ad8d6,_0x39873d){var _0x6c6754={'raw':![],'where':{'id':_0x1ad8d6[_0x24fc('0x4f')]['id']}},_0x166f6c={};_0x166f6c['model']=_['keys'](db[_0x24fc('0x35')][_0x24fc('0x50')]);_0x166f6c[_0x24fc('0x3a')]=_['keys'](_0x1ad8d6['query']);_0x166f6c[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x166f6c[_0x24fc('0x3f')],_0x166f6c[_0x24fc('0x3a')]);_0x6c6754[_0x24fc('0x3e')]=_[_0x24fc('0x3d')](_0x166f6c[_0x24fc('0x3f')],qs[_0x24fc('0x40')](_0x1ad8d6[_0x24fc('0x3a')][_0x24fc('0x40')]));_0x6c6754[_0x24fc('0x3e')]=_0x6c6754[_0x24fc('0x3e')]['length']?_0x6c6754[_0x24fc('0x3e')]:_0x166f6c[_0x24fc('0x3f')];if(_0x1ad8d6[_0x24fc('0x3a')][_0x24fc('0x51')]){_0x6c6754[_0x24fc('0x4b')]=[{'all':!![]}];}_0x6c6754=_['merge']({},_0x6c6754,_0x1ad8d6[_0x24fc('0x4a')]);return db['SalesforceAccount'][_0x24fc('0x52')](_0x6c6754)[_0x24fc('0x4d')](handleEntityNotFound(_0x39873d,null))[_0x24fc('0x4d')](respondWithResult(_0x39873d,null))[_0x24fc('0x26')](handleError(_0x39873d,null));};exports[_0x24fc('0x53')]=function(_0x3dd8e0,_0x4c9216){return db[_0x24fc('0x35')][_0x24fc('0x53')](_0x3dd8e0[_0x24fc('0x54')],{})[_0x24fc('0x4d')](respondWithResult(_0x4c9216,0xc9))[_0x24fc('0x26')](handleError(_0x4c9216,null));};exports[_0x24fc('0x30')]=function(_0x540b22,_0x36d500){if(_0x540b22[_0x24fc('0x54')]['id']){delete _0x540b22[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x35')][_0x24fc('0x52')]({'where':{'id':_0x540b22[_0x24fc('0x4f')]['id']}})[_0x24fc('0x4d')](handleEntityNotFound(_0x36d500,null))['then'](saveUpdates(_0x540b22[_0x24fc('0x54')],null))[_0x24fc('0x4d')](respondWithResult(_0x36d500,null))['catch'](handleError(_0x36d500,null));};exports[_0x24fc('0x31')]=function(_0x192aa8,_0x276f11){return db[_0x24fc('0x35')][_0x24fc('0x52')]({'where':{'id':_0x192aa8[_0x24fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x276f11,null))[_0x24fc('0x4d')](removeEntity(_0x276f11,null))['catch'](handleError(_0x276f11,null));};exports[_0x24fc('0x55')]=function(_0x8c9649,_0x50e5b0,_0x435442){var _0x5c1a92={};var _0x1c1f74={};var _0x595c47;var _0xdff811;return db[_0x24fc('0x35')]['findOne']({'where':{'id':_0x8c9649[_0x24fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x50e5b0,null))[_0x24fc('0x4d')](function(_0x16dc59){if(_0x16dc59){_0x595c47=_0x16dc59;_0x1c1f74['model']=_[_0x24fc('0x3b')](db[_0x24fc('0x56')][_0x24fc('0x50')]);_0x1c1f74[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x8c9649['query']);_0x1c1f74[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x1c1f74[_0x24fc('0x3f')],_0x1c1f74[_0x24fc('0x3a')]);_0x5c1a92[_0x24fc('0x3e')]=_['intersection'](_0x1c1f74['model'],qs[_0x24fc('0x40')](_0x8c9649[_0x24fc('0x3a')]['fields']));_0x5c1a92['attributes']=_0x5c1a92[_0x24fc('0x3e')][_0x24fc('0x57')]?_0x5c1a92[_0x24fc('0x3e')]:_0x1c1f74[_0x24fc('0x3f')];_0x5c1a92['order']=qs[_0x24fc('0x45')](_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x45')]);_0x5c1a92[_0x24fc('0x46')]=qs[_0x24fc('0x3c')](_[_0x24fc('0x58')](_0x8c9649[_0x24fc('0x3a')],_0x1c1f74[_0x24fc('0x3c')]));if(_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x47')]){_0x5c1a92[_0x24fc('0x46')]=_[_0x24fc('0x48')](_0x5c1a92[_0x24fc('0x46')],{'$or':_[_0x24fc('0x39')](_0x5c1a92[_0x24fc('0x3e')],function(_0x54ead5){var _0xd53778={};_0xd53778[_0x54ead5]={'$like':'%'+_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x47')]+'%'};return _0xd53778;})});}_0x5c1a92=_[_0x24fc('0x48')]({},_0x5c1a92,_0x8c9649[_0x24fc('0x4a')]);return _0x595c47[_0x24fc('0x55')](_0x5c1a92);}})[_0x24fc('0x4d')](function(_0x4659f9){if(_0x4659f9){_0xdff811=_0x4659f9['length'];if(!_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x41')](_0x24fc('0x42'))){_0x5c1a92[_0x24fc('0x43')]=qs['limit'](_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x43')]);_0x5c1a92['offset']=qs['offset'](_0x8c9649['query'][_0x24fc('0x2b')]);}return _0x595c47[_0x24fc('0x55')](_0x5c1a92);}})[_0x24fc('0x4d')](function(_0x2c6a97){if(_0x2c6a97){return _0x2c6a97?{'count':_0xdff811,'rows':_0x2c6a97}:null;}})[_0x24fc('0x4d')](respondWithResult(_0x50e5b0,null))[_0x24fc('0x26')](handleError(_0x50e5b0,null));};exports['addConfiguration']=function(_0x11bafd,_0x15e8a3,_0x5a2c09){if(_0x11bafd['body']['id']){delete _0x11bafd[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x35')][_0x24fc('0x59')]({'where':{'id':_0x11bafd['params']['id']}})[_0x24fc('0x4d')](handleEntityNotFound(_0x15e8a3,null))[_0x24fc('0x4d')](function(_0x33f04e){if(_0x33f04e){_0x11bafd['body']['AccountId']=_0x33f04e['id'];_0x11bafd['body']['Subjects']=integrations['getSubjects'](_0x11bafd[_0x24fc('0x54')][_0x24fc('0x5a')],_0x11bafd[_0x24fc('0x54')][_0x24fc('0x37')]);_0x11bafd['body'][_0x24fc('0x5b')]=integrations['getDescriptions'](_0x11bafd[_0x24fc('0x54')]['channel'],_0x11bafd[_0x24fc('0x54')][_0x24fc('0x37')]);return db[_0x24fc('0x56')][_0x24fc('0x53')](_0x11bafd[_0x24fc('0x54')],{'include':[{'model':db[_0x24fc('0x5c')],'as':_0x24fc('0x5d')},{'model':db['SalesforceField'],'as':_0x24fc('0x5b')}]});}return null;})[_0x24fc('0x4d')](respondWithResult(_0x15e8a3,null))[_0x24fc('0x26')](handleError(_0x15e8a3,null));};exports['getFields']=function(_0x5201e7,_0x13d4ba,_0x1d80db){var _0x4d4291;var _0x42b972='';var _0x1a2e6d='Task';return db[_0x24fc('0x35')][_0x24fc('0x59')]({'where':{'id':_0x5201e7['params']['id']},'attributes':['id',_0x24fc('0x5e'),_0x24fc('0x5f'),_0x24fc('0x60'),_0x24fc('0x61'),_0x24fc('0x62'),_0x24fc('0x63')]})['then'](handleEntityNotFound(_0x13d4ba,null))['then'](function(_0x35c3ae){if(_0x35c3ae){_0x42b972=_0x35c3ae['remoteUri'];var _0x29bd9f=_0x42b972['slice'](-0x1);if(_0x29bd9f==='/'){_0x42b972=_0x42b972['substring'](0x0,_0x42b972[_0x24fc('0x64')](_0x29bd9f));}_0x4d4291=new jsforce[(_0x24fc('0x65'))]({'oauth2':{'loginUrl':_0x42b972,'clientId':_0x35c3ae[_0x24fc('0x5f')],'clientSecret':_0x35c3ae[_0x24fc('0x60')]}});return _0x4d4291[_0x24fc('0x66')](_0x35c3ae[_0x24fc('0x61')],_0x35c3ae[_0x24fc('0x62')][_0x24fc('0x67')](_0x35c3ae['securityToken']));}})[_0x24fc('0x4d')](function(_0x83cdd1){if(_0x83cdd1){if(!_['isNil'](_0x5201e7['query'][_0x24fc('0x68')])){_0x1a2e6d=_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x68')];}return _0x4d4291[_0x24fc('0x69')](_0x1a2e6d)[_0x24fc('0x6a')]();}})['then'](function(_0x216781){var _0xcb7986=['CallDisposition',_0x24fc('0x6b'),_0x24fc('0x6c'),_0x24fc('0x6d'),'IsArchived',_0x24fc('0x6e'),_0x24fc('0x6f'),_0x24fc('0x70')];if(!_[_0x24fc('0x71')](_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x68')])&&_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x68')]===_0x24fc('0x72')){_0xcb7986=['Type',_0x24fc('0x73'),_0x24fc('0x74'),_0x24fc('0x6f'),'Priority','IsEscalated','SuppliedName',_0x24fc('0x75')];}if(_0x216781){_['remove'](_0x216781[_0x24fc('0x40')],function(_0x44132e){return _0x44132e['custom']===![]&&!_0xcb7986[_0x24fc('0x76')](_0x44132e['name']);});return{'count':_0x216781[_0x24fc('0x40')]['length'],'rows':_[_0x24fc('0x39')](_0x216781[_0x24fc('0x40')],function(_0x1ef6f3){return{'id':_0x1ef6f3[_0x24fc('0x33')],'name':_0x1ef6f3[_0x24fc('0x77')],'custom':_0x1ef6f3[_0x24fc('0x78')],'options':_0x1ef6f3['picklistValues'][_0x24fc('0x57')]>0x0?_[_0x24fc('0x39')](_0x1ef6f3[_0x24fc('0x79')],function(_0x462f38){return{'name':_0x462f38[_0x24fc('0x77')],'value':_0x462f38[_0x24fc('0x7a')]};}):_0x1ef6f3[_0x24fc('0x37')]==_0x24fc('0x7b')?[{'name':_0x24fc('0x7c'),'value':'true'},{'name':_0x24fc('0x7d'),'value':_0x24fc('0x7e')}]:[]};})};}})[_0x24fc('0x4d')](respondWithResult(_0x13d4ba,null))[_0x24fc('0x26')](function(_0x54dc67){var _0xf321e4=_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x7f')]?0x1f4:_0x54dc67['statusCode']||0x1f4;logger[_0x24fc('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xf321e4,JSON['stringify'](_0x54dc67));delete _0x54dc67[_0x24fc('0x33')];if(_0xf321e4===0x191){_0xf321e4=0x190;}_0x13d4ba['status'](_0xf321e4)[_0x24fc('0x34')](_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x7f')]?{'message':_0x24fc('0x80'),'statusCode':_0x54dc67['statusCode']}:_0x54dc67);});}; \ No newline at end of file +var _0x3de3=['VIRTUAL','includeAll','include','show','params','keys','options','find','create','body','destroy','SalesforceConfiguration','filter','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','username','sobject','describe','CallDurationInSeconds','CallObject','IsArchived','Priority','Type','ticketType','Case','Reason','Status','IsEscalated','SuppliedName','SuppliedCompany','custom','includes','label','picklistValues','value','boolean','true','False','false','test','statusCode','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','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','../../mysqldb','../../components/integrations/configuration','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3de3,0x1ce));var _0x33de=function(_0x4bef38,_0x5630e4){_0x4bef38=_0x4bef38-0x0;var _0x20f85d=_0x3de3[_0x4bef38];return _0x20f85d;};'use strict';var pdf=require(_0x33de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x33de('0x1'));var zipdir=require(_0x33de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33de('0x3'));var moment=require(_0x33de('0x4'));var BPromise=require(_0x33de('0x5'));var Mustache=require(_0x33de('0x6'));var util=require('util');var path=require(_0x33de('0x7'));var sox=require(_0x33de('0x8'));var csv=require('to-csv');var ejs=require(_0x33de('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0xd'));var querystring=require(_0x33de('0xe'));var Papa=require(_0x33de('0xf'));var Redis=require('ioredis');var authService=require(_0x33de('0x10'));var qs=require(_0x33de('0x11'));var as=require(_0x33de('0x12'));var hardwareService=require(_0x33de('0x13'));var logger=require(_0x33de('0x14'))(_0x33de('0x15'));var utils=require(_0x33de('0x16'));var config=require(_0x33de('0x17'));var licenseUtil=require(_0x33de('0x18'));var db=require(_0x33de('0x19'))['db'];var integrations=require(_0x33de('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x33de('0x1b')][_0x33de('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5179b7,_0x5392c0,_0x4164ab,_0x22bda8){return new BPromise(function(_0x2b3748,_0x57a2a1){var _0x57aa73=_0x22bda8||client;return _0x57aa73[_0x33de('0x1d')](_0x5179b7,_0x4164ab)[_0x33de('0x1e')](function(_0x522ba0){logger['info'](_0x33de('0x1f'),_0x5392c0,_0x33de('0x20'));logger[_0x33de('0x21')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5392c0,_0x33de('0x20'),JSON[_0x33de('0x22')](_0x522ba0));if(_0x522ba0['error']){if(_0x522ba0[_0x33de('0x23')][_0x33de('0x24')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5392c0,_0x522ba0[_0x33de('0x23')]['message']);return _0x57a2a1(_0x522ba0[_0x33de('0x23')][_0x33de('0x25')]);}logger[_0x33de('0x23')](_0x33de('0x1f'),_0x5392c0,_0x522ba0[_0x33de('0x23')][_0x33de('0x25')]);return _0x2b3748(_0x522ba0[_0x33de('0x23')]['message']);}else{logger['info'](_0x33de('0x1f'),_0x5392c0,'request\x20sent');_0x2b3748(_0x522ba0[_0x33de('0x26')]['message']);}})[_0x33de('0x27')](function(_0x194a83){logger['error'](_0x33de('0x1f'),_0x5392c0,_0x194a83);_0x57a2a1(_0x194a83);});});}function respondWithStatusCode(_0x5cd77e,_0x67d040){_0x67d040=_0x67d040||0xcc;return function(_0x5c602d){if(_0x5c602d){return _0x5cd77e[_0x33de('0x28')](_0x67d040);}return _0x5cd77e[_0x33de('0x29')](_0x67d040)[_0x33de('0x2a')]();};}function respondWithResult(_0x5b79d7,_0x3bdba4){_0x3bdba4=_0x3bdba4||0xc8;return function(_0x2d206b){if(_0x2d206b){return _0x5b79d7[_0x33de('0x29')](_0x3bdba4)['json'](_0x2d206b);}};}function respondWithFilteredResult(_0x34fba3,_0x5585a2){return function(_0x566373){if(_0x566373){var _0x1c8de9=_0x566373[_0x33de('0x2b')],_0x17c760=_0x5585a2[_0x33de('0x2c')],_0x1a870a=_0x5585a2[_0x33de('0x2c')]+_0x5585a2[_0x33de('0x2d')],_0x208d0d;if(_0x1a870a>=_0x1c8de9){_0x1a870a=_0x1c8de9;_0x208d0d=0xc8;}else{_0x208d0d=0xce;}_0x34fba3['status'](_0x208d0d);return _0x34fba3['set'](_0x33de('0x2e'),_0x17c760+'-'+_0x1a870a+'/'+_0x1c8de9)[_0x33de('0x2f')](_0x566373);}return null;};}function patchUpdates(_0xaeaec5){return function(_0x451ff5){try{jsonpatch[_0x33de('0x30')](_0x451ff5,_0xaeaec5,!![]);}catch(_0x20f393){return BPromise[_0x33de('0x31')](_0x20f393);}return _0x451ff5['save']();};}function saveUpdates(_0x282158,_0x1cee91){return function(_0x27c753){if(_0x27c753){return _0x27c753[_0x33de('0x32')](_0x282158)['then'](function(_0xe5dc68){return _0xe5dc68;});}return null;};}function removeEntity(_0xf5d78a,_0x5a9c43){return function(_0x5d2da4){if(_0x5d2da4){return _0x5d2da4['destroy']()[_0x33de('0x1e')](function(){_0xf5d78a[_0x33de('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0194,_0x4855e5){return function(_0x532575){if(!_0x532575){_0x1d0194[_0x33de('0x28')](0x194);}return _0x532575;};}function handleError(_0x2c8656,_0x42c57e){_0x42c57e=_0x42c57e||0x1f4;return function(_0x335794){logger[_0x33de('0x23')](_0x335794[_0x33de('0x33')]);if(_0x335794[_0x33de('0x34')]){delete _0x335794[_0x33de('0x34')];}_0x2c8656['status'](_0x42c57e)[_0x33de('0x35')](_0x335794);};}exports['index']=function(_0x12defc,_0x57355b){var _0x52817d={},_0x1ecf08={},_0x3614e0={'count':0x0,'rows':[]};var _0x42e12f=_[_0x33de('0x36')](db[_0x33de('0x37')][_0x33de('0x38')],function(_0x5cdc06){return{'name':_0x5cdc06[_0x33de('0x39')],'type':_0x5cdc06[_0x33de('0x3a')][_0x33de('0x3b')]};});_0x1ecf08[_0x33de('0x3c')]=_[_0x33de('0x36')](_0x42e12f,_0x33de('0x34'));_0x1ecf08[_0x33de('0x3d')]=_['keys'](_0x12defc[_0x33de('0x3d')]);_0x1ecf08[_0x33de('0x3e')]=_[_0x33de('0x3f')](_0x1ecf08[_0x33de('0x3c')],_0x1ecf08[_0x33de('0x3d')]);_0x52817d[_0x33de('0x40')]=_[_0x33de('0x3f')](_0x1ecf08['model'],qs[_0x33de('0x41')](_0x12defc[_0x33de('0x3d')][_0x33de('0x41')]));_0x52817d[_0x33de('0x40')]=_0x52817d[_0x33de('0x40')][_0x33de('0x42')]?_0x52817d['attributes']:_0x1ecf08[_0x33de('0x3c')];if(!_0x12defc['query'][_0x33de('0x43')](_0x33de('0x44'))){_0x52817d['limit']=qs[_0x33de('0x2d')](_0x12defc[_0x33de('0x3d')][_0x33de('0x2d')]);_0x52817d[_0x33de('0x2c')]=qs[_0x33de('0x2c')](_0x12defc[_0x33de('0x3d')][_0x33de('0x2c')]);}_0x52817d[_0x33de('0x45')]=qs[_0x33de('0x46')](_0x12defc['query']['sort']);_0x52817d[_0x33de('0x47')]=qs[_0x33de('0x3e')](_[_0x33de('0x48')](_0x12defc[_0x33de('0x3d')],_0x1ecf08['filters']),_0x42e12f);if(_0x12defc[_0x33de('0x3d')]['filter']){_0x52817d['where']=_[_0x33de('0x49')](_0x52817d[_0x33de('0x47')],{'$or':_[_0x33de('0x36')](_0x42e12f,function(_0x129e37){if(_0x129e37[_0x33de('0x3a')]!==_0x33de('0x4a')){var _0x105e10={};_0x105e10[_0x129e37['name']]={'$like':'%'+_0x12defc[_0x33de('0x3d')]['filter']+'%'};return _0x105e10;}})});}_0x52817d=_[_0x33de('0x49')]({},_0x52817d,_0x12defc['options']);var _0x43f816={'where':_0x52817d[_0x33de('0x47')]};return db['SalesforceAccount'][_0x33de('0x2b')](_0x43f816)[_0x33de('0x1e')](function(_0x2a64ef){_0x3614e0['count']=_0x2a64ef;if(_0x12defc['query'][_0x33de('0x4b')]){_0x52817d[_0x33de('0x4c')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x52817d);})[_0x33de('0x1e')](function(_0x5a161f){_0x3614e0['rows']=_0x5a161f;return _0x3614e0;})['then'](respondWithFilteredResult(_0x57355b,_0x52817d))[_0x33de('0x27')](handleError(_0x57355b,null));};exports[_0x33de('0x4d')]=function(_0x9a816c,_0xce6079){var _0x51730a={'raw':![],'where':{'id':_0x9a816c[_0x33de('0x4e')]['id']}},_0x4a0ad8={};_0x4a0ad8[_0x33de('0x3c')]=_['keys'](db[_0x33de('0x37')][_0x33de('0x38')]);_0x4a0ad8[_0x33de('0x3d')]=_[_0x33de('0x4f')](_0x9a816c[_0x33de('0x3d')]);_0x4a0ad8['filters']=_[_0x33de('0x3f')](_0x4a0ad8[_0x33de('0x3c')],_0x4a0ad8['query']);_0x51730a[_0x33de('0x40')]=_[_0x33de('0x3f')](_0x4a0ad8[_0x33de('0x3c')],qs[_0x33de('0x41')](_0x9a816c[_0x33de('0x3d')][_0x33de('0x41')]));_0x51730a[_0x33de('0x40')]=_0x51730a[_0x33de('0x40')][_0x33de('0x42')]?_0x51730a[_0x33de('0x40')]:_0x4a0ad8['model'];if(_0x9a816c[_0x33de('0x3d')][_0x33de('0x4b')]){_0x51730a[_0x33de('0x4c')]=[{'all':!![]}];}_0x51730a=_[_0x33de('0x49')]({},_0x51730a,_0x9a816c[_0x33de('0x50')]);return db[_0x33de('0x37')][_0x33de('0x51')](_0x51730a)['then'](handleEntityNotFound(_0xce6079,null))[_0x33de('0x1e')](respondWithResult(_0xce6079,null))[_0x33de('0x27')](handleError(_0xce6079,null));};exports[_0x33de('0x52')]=function(_0x4f0e9f,_0x9ffde7){return db[_0x33de('0x37')][_0x33de('0x52')](_0x4f0e9f[_0x33de('0x53')],{})['then'](respondWithResult(_0x9ffde7,0xc9))['catch'](handleError(_0x9ffde7,null));};exports[_0x33de('0x32')]=function(_0xf388f3,_0x232da5){if(_0xf388f3[_0x33de('0x53')]['id']){delete _0xf388f3[_0x33de('0x53')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0xf388f3[_0x33de('0x4e')]['id']}})[_0x33de('0x1e')](handleEntityNotFound(_0x232da5,null))[_0x33de('0x1e')](saveUpdates(_0xf388f3[_0x33de('0x53')],null))[_0x33de('0x1e')](respondWithResult(_0x232da5,null))[_0x33de('0x27')](handleError(_0x232da5,null));};exports[_0x33de('0x54')]=function(_0x18a14b,_0x35f529){return db['SalesforceAccount'][_0x33de('0x51')]({'where':{'id':_0x18a14b[_0x33de('0x4e')]['id']}})[_0x33de('0x1e')](handleEntityNotFound(_0x35f529,null))['then'](removeEntity(_0x35f529,null))[_0x33de('0x27')](handleError(_0x35f529,null));};exports['getConfigurations']=function(_0x4b07cf,_0x4dae6d,_0x5a3e3d){var _0x21d302={};var _0x36c4a2={};var _0x4d3a85;var _0x397179;return db[_0x33de('0x37')]['findOne']({'where':{'id':_0x4b07cf[_0x33de('0x4e')]['id']}})[_0x33de('0x1e')](handleEntityNotFound(_0x4dae6d,null))['then'](function(_0x32e7a1){if(_0x32e7a1){_0x4d3a85=_0x32e7a1;_0x36c4a2[_0x33de('0x3c')]=_[_0x33de('0x4f')](db[_0x33de('0x55')][_0x33de('0x38')]);_0x36c4a2[_0x33de('0x3d')]=_[_0x33de('0x4f')](_0x4b07cf['query']);_0x36c4a2['filters']=_[_0x33de('0x3f')](_0x36c4a2['model'],_0x36c4a2[_0x33de('0x3d')]);_0x21d302[_0x33de('0x40')]=_['intersection'](_0x36c4a2[_0x33de('0x3c')],qs['fields'](_0x4b07cf[_0x33de('0x3d')][_0x33de('0x41')]));_0x21d302['attributes']=_0x21d302['attributes'][_0x33de('0x42')]?_0x21d302[_0x33de('0x40')]:_0x36c4a2[_0x33de('0x3c')];_0x21d302[_0x33de('0x45')]=qs[_0x33de('0x46')](_0x4b07cf['query'][_0x33de('0x46')]);_0x21d302[_0x33de('0x47')]=qs['filters'](_[_0x33de('0x48')](_0x4b07cf[_0x33de('0x3d')],_0x36c4a2['filters']));if(_0x4b07cf[_0x33de('0x3d')][_0x33de('0x56')]){_0x21d302['where']=_['merge'](_0x21d302[_0x33de('0x47')],{'$or':_['map'](_0x21d302[_0x33de('0x40')],function(_0x4803b8){var _0x39fa8e={};_0x39fa8e[_0x4803b8]={'$like':'%'+_0x4b07cf['query']['filter']+'%'};return _0x39fa8e;})});}_0x21d302=_['merge']({},_0x21d302,_0x4b07cf['options']);return _0x4d3a85['getConfigurations'](_0x21d302);}})['then'](function(_0x295c19){if(_0x295c19){_0x397179=_0x295c19['length'];if(!_0x4b07cf[_0x33de('0x3d')]['hasOwnProperty']('nolimit')){_0x21d302[_0x33de('0x2d')]=qs[_0x33de('0x2d')](_0x4b07cf[_0x33de('0x3d')][_0x33de('0x2d')]);_0x21d302[_0x33de('0x2c')]=qs[_0x33de('0x2c')](_0x4b07cf[_0x33de('0x3d')][_0x33de('0x2c')]);}return _0x4d3a85['getConfigurations'](_0x21d302);}})[_0x33de('0x1e')](function(_0x5b779c){if(_0x5b779c){return _0x5b779c?{'count':_0x397179,'rows':_0x5b779c}:null;}})[_0x33de('0x1e')](respondWithResult(_0x4dae6d,null))[_0x33de('0x27')](handleError(_0x4dae6d,null));};exports[_0x33de('0x57')]=function(_0x3a8d6b,_0x8a9729,_0x3f5d52){if(_0x3a8d6b[_0x33de('0x53')]['id']){delete _0x3a8d6b[_0x33de('0x53')]['id'];}return db[_0x33de('0x37')][_0x33de('0x58')]({'where':{'id':_0x3a8d6b[_0x33de('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8a9729,null))['then'](function(_0x516a33){if(_0x516a33){_0x3a8d6b[_0x33de('0x53')][_0x33de('0x59')]=_0x516a33['id'];_0x3a8d6b[_0x33de('0x53')][_0x33de('0x5a')]=integrations[_0x33de('0x5b')](_0x3a8d6b[_0x33de('0x53')][_0x33de('0x5c')],_0x3a8d6b[_0x33de('0x53')][_0x33de('0x3a')]);_0x3a8d6b['body'][_0x33de('0x5d')]=integrations[_0x33de('0x5e')](_0x3a8d6b[_0x33de('0x53')][_0x33de('0x5c')],_0x3a8d6b[_0x33de('0x53')][_0x33de('0x3a')]);return db['SalesforceConfiguration']['create'](_0x3a8d6b['body'],{'include':[{'model':db[_0x33de('0x5f')],'as':_0x33de('0x5a')},{'model':db[_0x33de('0x5f')],'as':_0x33de('0x5d')}]});}return null;})['then'](respondWithResult(_0x8a9729,null))[_0x33de('0x27')](handleError(_0x8a9729,null));};exports[_0x33de('0x60')]=function(_0x484827,_0x595629,_0x5d55c5){var _0x23aa74;var _0x4630be='';var _0x38d3dd=_0x33de('0x61');return db[_0x33de('0x37')]['findOne']({'where':{'id':_0x484827[_0x33de('0x4e')]['id']},'attributes':['id','remoteUri',_0x33de('0x62'),_0x33de('0x63'),'username',_0x33de('0x64'),_0x33de('0x65')]})['then'](handleEntityNotFound(_0x595629,null))[_0x33de('0x1e')](function(_0x4a2dfe){if(_0x4a2dfe){_0x4630be=_0x4a2dfe['remoteUri'];var _0x2b6729=_0x4630be[_0x33de('0x66')](-0x1);if(_0x2b6729==='/'){_0x4630be=_0x4630be[_0x33de('0x67')](0x0,_0x4630be[_0x33de('0x68')](_0x2b6729));}_0x23aa74=new jsforce[(_0x33de('0x69'))]({'oauth2':{'loginUrl':_0x4630be,'clientId':_0x4a2dfe['clientId'],'clientSecret':_0x4a2dfe[_0x33de('0x63')]}});return _0x23aa74[_0x33de('0x6a')](_0x4a2dfe[_0x33de('0x6b')],_0x4a2dfe[_0x33de('0x64')]['concat'](_0x4a2dfe[_0x33de('0x65')]));}})[_0x33de('0x1e')](function(_0x132127){if(_0x132127){if(!_['isNil'](_0x484827['query']['ticketType'])){_0x38d3dd=_0x484827['query']['ticketType'];}return _0x23aa74[_0x33de('0x6c')](_0x38d3dd)[_0x33de('0x6d')]();}})['then'](function(_0x2cdaa1){var _0x50baf4=['CallDisposition',_0x33de('0x6e'),_0x33de('0x6f'),'CallType',_0x33de('0x70'),_0x33de('0x71'),'Status',_0x33de('0x72')];if(!_['isNil'](_0x484827[_0x33de('0x3d')][_0x33de('0x73')])&&_0x484827['query'][_0x33de('0x73')]===_0x33de('0x74')){_0x50baf4=['Type','Origin',_0x33de('0x75'),_0x33de('0x76'),_0x33de('0x71'),_0x33de('0x77'),_0x33de('0x78'),_0x33de('0x79')];}if(_0x2cdaa1){_['remove'](_0x2cdaa1[_0x33de('0x41')],function(_0x3b3ca2){return _0x3b3ca2[_0x33de('0x7a')]===![]&&!_0x50baf4[_0x33de('0x7b')](_0x3b3ca2[_0x33de('0x34')]);});return{'count':_0x2cdaa1[_0x33de('0x41')][_0x33de('0x42')],'rows':_[_0x33de('0x36')](_0x2cdaa1[_0x33de('0x41')],function(_0x34d0ad){return{'id':_0x34d0ad[_0x33de('0x34')],'name':_0x34d0ad[_0x33de('0x7c')],'custom':_0x34d0ad[_0x33de('0x7a')],'options':_0x34d0ad[_0x33de('0x7d')][_0x33de('0x42')]>0x0?_[_0x33de('0x36')](_0x34d0ad['picklistValues'],function(_0x1196fb){return{'name':_0x1196fb[_0x33de('0x7c')],'value':_0x1196fb[_0x33de('0x7e')]};}):_0x34d0ad[_0x33de('0x3a')]==_0x33de('0x7f')?[{'name':'True','value':_0x33de('0x80')},{'name':_0x33de('0x81'),'value':_0x33de('0x82')}]:[]};})};}})[_0x33de('0x1e')](respondWithResult(_0x595629,null))[_0x33de('0x27')](function(_0x442df5){var _0x36b1a3=_0x484827[_0x33de('0x3d')][_0x33de('0x83')]?0x1f4:_0x442df5[_0x33de('0x84')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x33de('0x60'),_0x36b1a3,JSON[_0x33de('0x22')](_0x442df5));delete _0x442df5[_0x33de('0x34')];if(_0x36b1a3===0x191){_0x36b1a3=0x190;}_0x595629[_0x33de('0x29')](_0x36b1a3)['send'](_0x484827[_0x33de('0x3d')][_0x33de('0x83')]?{'message':_0x33de('0x85'),'statusCode':_0x442df5['statusCode']}:_0x442df5);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 08a6f6b..ddbe5fe 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 _0x6e87=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','lodash','../../config/logger','api','moment'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0x6e87,0x6a));var _0x76e8=function(_0x119659,_0x30d2d2){_0x119659=_0x119659-0x0;var _0x209c38=_0x6e87[_0x119659];return _0x209c38;};'use strict';var _=require(_0x76e8('0x0'));var util=require('util');var logger=require(_0x76e8('0x1'))(_0x76e8('0x2'));var moment=require(_0x76e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x76e8('0x4'));var rimraf=require(_0x76e8('0x5'));var config=require(_0x76e8('0x6'));var attributes=require(_0x76e8('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x76e8('0x8')]=function(_0x701587,_0xc481e8){return _0x701587[_0x76e8('0x9')](_0x76e8('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d1b=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','path'];(function(_0x549443,_0x2e04c8){var _0x372ed3=function(_0x214a87){while(--_0x214a87){_0x549443['push'](_0x549443['shift']());}};_0x372ed3(++_0x2e04c8);}(_0x4d1b,0x1ca));var _0xb4d1=function(_0x20e5c3,_0x41470c){_0x20e5c3=_0x20e5c3-0x0;var _0x401520=_0x4d1b[_0x20e5c3];return _0x401520;};'use strict';var _=require(_0xb4d1('0x0'));var util=require(_0xb4d1('0x1'));var logger=require(_0xb4d1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4d1('0x3'));var rimraf=require(_0xb4d1('0x4'));var config=require(_0xb4d1('0x5'));var attributes=require(_0xb4d1('0x6'));var integrations=require(_0xb4d1('0x7'));module[_0xb4d1('0x8')]=function(_0x55e1be,_0x39bcc4){return _0x55e1be[_0xb4d1('0x9')](_0xb4d1('0xa'),attributes,{'tableName':'int_salesforce_accounts','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 63ea352..76abed2 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 _0x579c=['error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4d02bd,_0x4c2dc8){var _0x3e1707=function(_0x21b5e9){while(--_0x21b5e9){_0x4d02bd['push'](_0x4d02bd['shift']());}};_0x3e1707(++_0x4c2dc8);}(_0x579c,0xda));var _0xc579=function(_0x3a161f,_0x43c062){_0x3a161f=_0x3a161f-0x0;var _0x587201=_0x579c[_0x3a161f];return _0x587201;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});}exports[_0xc579('0x18')]=function(_0x33d341){var _0xbbbe3e=this;return new Promise(function(_0x3da8a1,_0xa41248){return db[_0xc579('0x19')]['findAll']({'raw':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1b')]||null:null,'attributes':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'limit':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['limit']||null:null,'include':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x33d341[_0xc579('0x1a')]['include'],function(_0x3634f2){return{'model':db[_0x3634f2[_0xc579('0x1f')]],'as':_0x3634f2['as'],'attributes':_0x3634f2[_0xc579('0x1c')],'include':_0x3634f2['include']?_[_0xc579('0x1e')](_0x3634f2['include'],function(_0x4610c2){return{'model':db[_0x4610c2[_0xc579('0x1f')]],'as':_0x4610c2['as'],'attributes':_0x4610c2[_0xc579('0x1c')],'include':_0x4610c2['include']?_[_0xc579('0x1e')](_0x4610c2['include'],function(_0x532b33){return{'model':db[_0x532b33['model']],'as':_0x532b33['as'],'attributes':_0x532b33[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0xfdbb73){logger[_0xc579('0xe')](_0xc579('0x18'),_0x33d341);logger[_0xc579('0x10')](_0xc579('0x18'),_0x33d341,JSON['stringify'](_0xfdbb73));_0x3da8a1(_0xfdbb73);})['catch'](function(_0x4a5f6){logger['error'](_0xc579('0x18'),_0x4a5f6[_0xc579('0x16')],_0x33d341);_0xa41248(_0xbbbe3e[_0xc579('0x14')](0x1f4,_0x4a5f6[_0xc579('0x16')]));});});};exports[_0xc579('0x20')]=function(_0x156bf5){var _0x45e6a3=this;return new Promise(function(_0x133d08,_0x49b48f){return db[_0xc579('0x19')][_0xc579('0x21')]({'raw':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x156bf5['options']?_0x156bf5[_0xc579('0x1a')]['where']||null:null,'attributes':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'include':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['include']?_[_0xc579('0x1e')](_0x156bf5['options'][_0xc579('0x1d')],function(_0x473000){return{'model':db[_0x473000['model']],'as':_0x473000['as'],'attributes':_0x473000[_0xc579('0x1c')],'include':_0x473000[_0xc579('0x1d')]?_['map'](_0x473000['include'],function(_0x37bce9){return{'model':db[_0x37bce9[_0xc579('0x1f')]],'as':_0x37bce9['as'],'attributes':_0x37bce9['attributes'],'include':_0x37bce9[_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x37bce9['include'],function(_0x32589a){return{'model':db[_0x32589a['model']],'as':_0x32589a['as'],'attributes':_0x32589a[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0x5c6f38){logger[_0xc579('0xe')](_0xc579('0x20'),_0x156bf5);logger[_0xc579('0x10')](_0xc579('0x20'),_0x156bf5,JSON[_0xc579('0x13')](_0x5c6f38));_0x133d08(_0x5c6f38);})[_0xc579('0x17')](function(_0x59ae89){logger[_0xc579('0x14')](_0xc579('0x20'),_0x59ae89['message'],_0x156bf5);_0x49b48f(_0x45e6a3[_0xc579('0x14')](0x1f4,_0x59ae89[_0xc579('0x16')]));});});}; \ No newline at end of file +var _0x70e0=['code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','include','map','model','find','ShowSalesforceAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x535806,_0x41a636){var _0xbd13d7=function(_0x22ce5e){while(--_0x22ce5e){_0x535806['push'](_0x535806['shift']());}};_0xbd13d7(++_0x41a636);}(_0x70e0,0x17b));var _0x070e=function(_0x335a21,_0x2e22c6){_0x335a21=_0x335a21-0x0;var _0x270242=_0x70e0[_0x335a21];return _0x270242;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}exports[_0x070e('0x16')]=function(_0x38f6e6){var _0x2060cc=this;return new Promise(function(_0x364b3f,_0x5037eb){return db[_0x070e('0x17')][_0x070e('0x18')]({'raw':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1a')]===undefined?!![]:![]:!![],'where':_0x38f6e6['options']?_0x38f6e6['options']['where']||null:null,'attributes':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1b')]||null:null,'limit':_0x38f6e6['options']?_0x38f6e6[_0x070e('0x19')]['limit']||null:null,'include':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1c')]?_[_0x070e('0x1d')](_0x38f6e6[_0x070e('0x19')][_0x070e('0x1c')],function(_0xe405e){return{'model':db[_0xe405e[_0x070e('0x1e')]],'as':_0xe405e['as'],'attributes':_0xe405e['attributes'],'include':_0xe405e[_0x070e('0x1c')]?_[_0x070e('0x1d')](_0xe405e[_0x070e('0x1c')],function(_0x503f4d){return{'model':db[_0x503f4d[_0x070e('0x1e')]],'as':_0x503f4d['as'],'attributes':_0x503f4d['attributes'],'include':_0x503f4d['include']?_[_0x070e('0x1d')](_0x503f4d[_0x070e('0x1c')],function(_0x41deb1){return{'model':db[_0x41deb1[_0x070e('0x1e')]],'as':_0x41deb1['as'],'attributes':_0x41deb1[_0x070e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x374c54){logger[_0x070e('0xb')](_0x070e('0x16'),_0x38f6e6);logger[_0x070e('0xc')](_0x070e('0x16'),_0x38f6e6,JSON[_0x070e('0xf')](_0x374c54));_0x364b3f(_0x374c54);})[_0x070e('0x15')](function(_0x26373b){logger['error'](_0x070e('0x16'),_0x26373b[_0x070e('0x13')],_0x38f6e6);_0x5037eb(_0x2060cc[_0x070e('0x10')](0x1f4,_0x26373b['message']));});});};exports['ShowSalesforceAccount']=function(_0x13097f){var _0x46065c=this;return new Promise(function(_0xa6c0ab,_0x51402c){return db[_0x070e('0x17')][_0x070e('0x1f')]({'raw':_0x13097f[_0x070e('0x19')]?_0x13097f[_0x070e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x13097f['options']?_0x13097f['options']['where']||null:null,'attributes':_0x13097f[_0x070e('0x19')]?_0x13097f['options'][_0x070e('0x1b')]||null:null,'include':_0x13097f[_0x070e('0x19')]?_0x13097f['options']['include']?_[_0x070e('0x1d')](_0x13097f[_0x070e('0x19')]['include'],function(_0x546a16){return{'model':db[_0x546a16[_0x070e('0x1e')]],'as':_0x546a16['as'],'attributes':_0x546a16[_0x070e('0x1b')],'include':_0x546a16[_0x070e('0x1c')]?_[_0x070e('0x1d')](_0x546a16[_0x070e('0x1c')],function(_0x5f530d){return{'model':db[_0x5f530d['model']],'as':_0x5f530d['as'],'attributes':_0x5f530d[_0x070e('0x1b')],'include':_0x5f530d[_0x070e('0x1c')]?_[_0x070e('0x1d')](_0x5f530d[_0x070e('0x1c')],function(_0xf11439){return{'model':db[_0xf11439['model']],'as':_0xf11439['as'],'attributes':_0xf11439[_0x070e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x070e('0xa')](function(_0x534150){logger[_0x070e('0xb')](_0x070e('0x20'),_0x13097f);logger['debug']('ShowSalesforceAccount',_0x13097f,JSON['stringify'](_0x534150));_0xa6c0ab(_0x534150);})[_0x070e('0x15')](function(_0x3dfbf7){logger[_0x070e('0x10')](_0x070e('0x20'),_0x3dfbf7[_0x070e('0x13')],_0x13097f);_0x51402c(_0x46065c['error'](0x1f4,_0x3dfbf7[_0x070e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 24f9845..8f58bbf 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 _0xce2a=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x313dc6,_0x1b0c7b){var _0x4fb745=function(_0x2c77a6){while(--_0x2c77a6){_0x313dc6['push'](_0x313dc6['shift']());}};_0x4fb745(++_0x1b0c7b);}(_0xce2a,0xd5));var _0xace2=function(_0xabebb3,_0x12813a){_0xabebb3=_0xabebb3-0x0;var _0x4cbd35=_0xce2a[_0xabebb3];return _0x4cbd35;};'use strict';var multer=require(_0xace2('0x0'));var util=require('util');var path=require(_0xace2('0x1'));var timeout=require(_0xace2('0x2'));var express=require(_0xace2('0x3'));var router=express[_0xace2('0x4')]();var auth=require(_0xace2('0x5'));var interaction=require(_0xace2('0x6'));var config=require('../../config/environment');var controller=require(_0xace2('0x7'));router[_0xace2('0x8')]('/',auth['isAuthenticated'](),controller[_0xace2('0x9')]);router[_0xace2('0x8')](_0xace2('0xa'),auth[_0xace2('0xb')](),controller['show']);router[_0xace2('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xace2('0x8')]('/:id/subjects',auth[_0xace2('0xb')](),controller[_0xace2('0xc')]);router[_0xace2('0x8')](_0xace2('0xd'),auth[_0xace2('0xb')](),controller[_0xace2('0xe')]);router[_0xace2('0xf')]('/',auth['isAuthenticated'](),controller[_0xace2('0x10')]);router[_0xace2('0x11')]('/:id',auth[_0xace2('0xb')](),controller[_0xace2('0x12')]);router['delete'](_0xace2('0xa'),auth[_0xace2('0xb')](),controller[_0xace2('0x13')]);module[_0xace2('0x14')]=router; \ No newline at end of file +var _0xd866=['/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x210d83,_0x57dff8){var _0x8ffab3=function(_0x4fe4ec){while(--_0x4fe4ec){_0x210d83['push'](_0x210d83['shift']());}};_0x8ffab3(++_0x57dff8);}(_0xd866,0x15e));var _0x6d86=function(_0x4b52a0,_0x51164b){_0x4b52a0=_0x4b52a0-0x0;var _0x5355e1=_0xd866[_0x4b52a0];return _0x5355e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d86('0x0'));var timeout=require(_0x6d86('0x1'));var express=require(_0x6d86('0x2'));var router=express[_0x6d86('0x3')]();var auth=require(_0x6d86('0x4'));var interaction=require(_0x6d86('0x5'));var config=require(_0x6d86('0x6'));var controller=require(_0x6d86('0x7'));router[_0x6d86('0x8')]('/',auth[_0x6d86('0x9')](),controller[_0x6d86('0xa')]);router[_0x6d86('0x8')]('/:id',auth[_0x6d86('0x9')](),controller[_0x6d86('0xb')]);router['get']('/:id/fields',auth[_0x6d86('0x9')](),controller[_0x6d86('0xc')]);router[_0x6d86('0x8')]('/:id/subjects',auth[_0x6d86('0x9')](),controller['getSubjects']);router[_0x6d86('0x8')](_0x6d86('0xd'),auth['isAuthenticated'](),controller[_0x6d86('0xe')]);router[_0x6d86('0xf')]('/',auth[_0x6d86('0x9')](),controller[_0x6d86('0x10')]);router[_0x6d86('0x11')](_0x6d86('0x12'),auth[_0x6d86('0x9')](),controller[_0x6d86('0x13')]);router[_0x6d86('0x14')](_0x6d86('0x12'),auth[_0x6d86('0x9')](),controller[_0x6d86('0x15')]);module[_0x6d86('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 0891122..afc6ee0 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 _0x3b03=['STRING','ENUM','Case','Task','contact_lead','contact','lead','nothing','exports'];(function(_0x2073ed,_0x4e8b08){var _0xf8a323=function(_0x5e4228){while(--_0x5e4228){_0x2073ed['push'](_0x2073ed['shift']());}};_0xf8a323(++_0x4e8b08);}(_0x3b03,0x11f));var _0x33b0=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x3b03[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require('sequelize');module[_0x33b0('0x0')]={'name':{'type':Sequelize[_0x33b0('0x1')]},'description':{'type':Sequelize[_0x33b0('0x1')]},'ticketType':{'type':Sequelize[_0x33b0('0x2')]('Task',_0x33b0('0x3')),'defaultValue':_0x33b0('0x4')},'moduleSearch':{'type':Sequelize[_0x33b0('0x2')](_0x33b0('0x5'),_0x33b0('0x6'),_0x33b0('0x7')),'defaultValue':_0x33b0('0x5')},'moduleCreate':{'type':Sequelize[_0x33b0('0x2')](_0x33b0('0x8'),_0x33b0('0x6'),_0x33b0('0x7')),'defaultValue':_0x33b0('0x7')}}; \ No newline at end of file +var _0x1b34=['nothing','lead','STRING','ENUM','Task','Case','contact_lead'];(function(_0x5096df,_0x2375ce){var _0x122a3f=function(_0x19ea86){while(--_0x19ea86){_0x5096df['push'](_0x5096df['shift']());}};_0x122a3f(++_0x2375ce);}(_0x1b34,0x183));var _0x41b3=function(_0x2421e1,_0x2ef188){_0x2421e1=_0x2421e1-0x0;var _0x4a9018=_0x1b34[_0x2421e1];return _0x4a9018;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x41b3('0x0')]},'description':{'type':Sequelize[_0x41b3('0x0')]},'ticketType':{'type':Sequelize[_0x41b3('0x1')](_0x41b3('0x2'),_0x41b3('0x3')),'defaultValue':_0x41b3('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x41b3('0x4'),'contact','lead'),'defaultValue':_0x41b3('0x4')},'moduleCreate':{'type':Sequelize[_0x41b3('0x1')](_0x41b3('0x5'),'contact',_0x41b3('0x6')),'defaultValue':_0x41b3('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8c52f44..6b13dfc 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 _0x2a97=['crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','http','request','then','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','squel'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x2a97,0x165));var _0x72a9=function(_0x79d030,_0x3aa6dc){_0x79d030=_0x79d030-0x0;var _0x8b2bdd=_0x2a97[_0x79d030];return _0x8b2bdd;};'use strict';var pdf=require(_0x72a9('0x0'));var emlformat=require(_0x72a9('0x1'));var rimraf=require(_0x72a9('0x2'));var zipdir=require(_0x72a9('0x3'));var jsonpatch=require(_0x72a9('0x4'));var rp=require(_0x72a9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x72a9('0x6'));var path=require(_0x72a9('0x7'));var sox=require(_0x72a9('0x8'));var csv=require('to-csv');var ejs=require(_0x72a9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72a9('0xa'));var crypto=require(_0x72a9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x72a9('0xc'));var toCsv=require(_0x72a9('0xd'));var querystring=require('querystring');var Papa=require(_0x72a9('0xe'));var Redis=require(_0x72a9('0xf'));var authService=require(_0x72a9('0x10'));var qs=require(_0x72a9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a9('0x12'));var logger=require('../../config/logger')(_0x72a9('0x13'));var utils=require(_0x72a9('0x14'));var config=require(_0x72a9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a9('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x72a9('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x137d2c,_0x46feb8,_0x2e120e,_0x24a363){return new BPromise(function(_0x16d7c1,_0x50ff86){var _0x1ded9e=_0x24a363||client;return _0x1ded9e[_0x72a9('0x18')](_0x137d2c,_0x2e120e)[_0x72a9('0x19')](function(_0x3f6446){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x46feb8,'request\x20sent');logger['debug'](_0x72a9('0x1a'),_0x46feb8,_0x72a9('0x1b'),JSON[_0x72a9('0x1c')](_0x3f6446));if(_0x3f6446[_0x72a9('0x1d')]){if(_0x3f6446[_0x72a9('0x1d')][_0x72a9('0x1e')]===0x1f4){logger[_0x72a9('0x1d')](_0x72a9('0x1f'),_0x46feb8,_0x3f6446['error'][_0x72a9('0x20')]);return _0x50ff86(_0x3f6446[_0x72a9('0x1d')][_0x72a9('0x20')]);}logger[_0x72a9('0x1d')](_0x72a9('0x1f'),_0x46feb8,_0x3f6446[_0x72a9('0x1d')][_0x72a9('0x20')]);return _0x16d7c1(_0x3f6446['error'][_0x72a9('0x20')]);}else{logger[_0x72a9('0x21')](_0x72a9('0x1f'),_0x46feb8,_0x72a9('0x1b'));_0x16d7c1(_0x3f6446[_0x72a9('0x22')][_0x72a9('0x20')]);}})['catch'](function(_0x3b8894){logger[_0x72a9('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x46feb8,_0x3b8894);_0x50ff86(_0x3b8894);});});}function respondWithStatusCode(_0x36afca,_0x4990fb){_0x4990fb=_0x4990fb||0xcc;return function(_0x16e192){if(_0x16e192){return _0x36afca[_0x72a9('0x23')](_0x4990fb);}return _0x36afca[_0x72a9('0x24')](_0x4990fb)[_0x72a9('0x25')]();};}function respondWithResult(_0x2c6ec,_0x437f4e){_0x437f4e=_0x437f4e||0xc8;return function(_0x489129){if(_0x489129){return _0x2c6ec[_0x72a9('0x24')](_0x437f4e)['json'](_0x489129);}};}function respondWithFilteredResult(_0x438857,_0x577d9a){return function(_0x2d4b3b){if(_0x2d4b3b){var _0x36e703=_0x2d4b3b[_0x72a9('0x26')],_0x5d0519=_0x577d9a['offset'],_0x262944=_0x577d9a[_0x72a9('0x27')]+_0x577d9a[_0x72a9('0x28')],_0x176fab;if(_0x262944>=_0x36e703){_0x262944=_0x36e703;_0x176fab=0xc8;}else{_0x176fab=0xce;}_0x438857[_0x72a9('0x24')](_0x176fab);return _0x438857[_0x72a9('0x29')](_0x72a9('0x2a'),_0x5d0519+'-'+_0x262944+'/'+_0x36e703)[_0x72a9('0x2b')](_0x2d4b3b);}return null;};}function patchUpdates(_0x32d1ea){return function(_0x321db3){try{jsonpatch[_0x72a9('0x2c')](_0x321db3,_0x32d1ea,!![]);}catch(_0x4b3b37){return BPromise[_0x72a9('0x2d')](_0x4b3b37);}return _0x321db3[_0x72a9('0x2e')]();};}function saveUpdates(_0x3ef085,_0x2129ee){return function(_0x35238e){if(_0x35238e){return _0x35238e[_0x72a9('0x2f')](_0x3ef085)[_0x72a9('0x19')](function(_0xe0d125){return _0xe0d125;});}return null;};}function removeEntity(_0x437217,_0x2121d3){return function(_0x4dbf0e){if(_0x4dbf0e){return _0x4dbf0e[_0x72a9('0x30')]()[_0x72a9('0x19')](function(){_0x437217[_0x72a9('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x924a95,_0xcfb80b){return function(_0x4bcdf6){if(!_0x4bcdf6){_0x924a95[_0x72a9('0x23')](0x194);}return _0x4bcdf6;};}function handleError(_0x52f6f9,_0x3556ed){_0x3556ed=_0x3556ed||0x1f4;return function(_0x3f72ea){logger[_0x72a9('0x1d')](_0x3f72ea[_0x72a9('0x31')]);if(_0x3f72ea[_0x72a9('0x32')]){delete _0x3f72ea[_0x72a9('0x32')];}_0x52f6f9['status'](_0x3556ed)[_0x72a9('0x33')](_0x3f72ea);};}exports[_0x72a9('0x34')]=function(_0x51449f,_0x11b2d0){var _0x523508={},_0x8cf841={},_0x57934e={'count':0x0,'rows':[]};var _0x56627e=_[_0x72a9('0x35')](db[_0x72a9('0x36')]['rawAttributes'],function(_0x2ff44c){return{'name':_0x2ff44c[_0x72a9('0x37')],'type':_0x2ff44c[_0x72a9('0x38')][_0x72a9('0x39')]};});_0x8cf841[_0x72a9('0x3a')]=_[_0x72a9('0x35')](_0x56627e,_0x72a9('0x32'));_0x8cf841[_0x72a9('0x3b')]=_[_0x72a9('0x3c')](_0x51449f[_0x72a9('0x3b')]);_0x8cf841[_0x72a9('0x3d')]=_[_0x72a9('0x3e')](_0x8cf841['model'],_0x8cf841['query']);_0x523508[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0x8cf841['model'],qs[_0x72a9('0x40')](_0x51449f['query'][_0x72a9('0x40')]));_0x523508[_0x72a9('0x3f')]=_0x523508[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x523508['attributes']:_0x8cf841[_0x72a9('0x3a')];if(!_0x51449f[_0x72a9('0x3b')][_0x72a9('0x42')](_0x72a9('0x43'))){_0x523508['limit']=qs[_0x72a9('0x28')](_0x51449f['query'][_0x72a9('0x28')]);_0x523508[_0x72a9('0x27')]=qs[_0x72a9('0x27')](_0x51449f[_0x72a9('0x3b')][_0x72a9('0x27')]);}_0x523508[_0x72a9('0x44')]=qs[_0x72a9('0x45')](_0x51449f[_0x72a9('0x3b')][_0x72a9('0x45')]);_0x523508[_0x72a9('0x46')]=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x51449f[_0x72a9('0x3b')],_0x8cf841[_0x72a9('0x3d')]),_0x56627e);if(_0x51449f[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x523508[_0x72a9('0x46')]=_[_0x72a9('0x49')](_0x523508[_0x72a9('0x46')],{'$or':_[_0x72a9('0x35')](_0x56627e,function(_0x10af27){if(_0x10af27['type']!==_0x72a9('0x4a')){var _0x2803b1={};_0x2803b1[_0x10af27['name']]={'$like':'%'+_0x51449f[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x2803b1;}})});}_0x523508=_[_0x72a9('0x49')]({},_0x523508,_0x51449f['options']);var _0x2e9800={'where':_0x523508[_0x72a9('0x46')]};return db['SalesforceConfiguration']['count'](_0x2e9800)['then'](function(_0x33e324){_0x57934e[_0x72a9('0x26')]=_0x33e324;if(_0x51449f['query'][_0x72a9('0x4b')]){_0x523508[_0x72a9('0x4c')]=[{'all':!![]}];}return db[_0x72a9('0x36')][_0x72a9('0x4d')](_0x523508);})['then'](function(_0x457c57){_0x57934e[_0x72a9('0x4e')]=_0x457c57;return _0x57934e;})[_0x72a9('0x19')](respondWithFilteredResult(_0x11b2d0,_0x523508))[_0x72a9('0x4f')](handleError(_0x11b2d0,null));};exports[_0x72a9('0x50')]=function(_0x4cb68f,_0x571ea1){var _0x75b3b={'raw':![],'where':{'id':_0x4cb68f[_0x72a9('0x51')]['id']}},_0xe071d4={};_0xe071d4[_0x72a9('0x3a')]=_[_0x72a9('0x3c')](db[_0x72a9('0x36')][_0x72a9('0x52')]);_0xe071d4[_0x72a9('0x3b')]=_['keys'](_0x4cb68f[_0x72a9('0x3b')]);_0xe071d4[_0x72a9('0x3d')]=_[_0x72a9('0x3e')](_0xe071d4[_0x72a9('0x3a')],_0xe071d4[_0x72a9('0x3b')]);_0x75b3b[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0xe071d4[_0x72a9('0x3a')],qs[_0x72a9('0x40')](_0x4cb68f[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x75b3b['attributes']=_0x75b3b[_0x72a9('0x3f')]['length']?_0x75b3b['attributes']:_0xe071d4['model'];if(_0x4cb68f[_0x72a9('0x3b')]['includeAll']){_0x75b3b[_0x72a9('0x4c')]=[{'all':!![]}];}_0x75b3b=_[_0x72a9('0x49')]({},_0x75b3b,_0x4cb68f[_0x72a9('0x53')]);return db[_0x72a9('0x36')][_0x72a9('0x54')](_0x75b3b)[_0x72a9('0x19')](handleEntityNotFound(_0x571ea1,null))['then'](respondWithResult(_0x571ea1,null))[_0x72a9('0x4f')](handleError(_0x571ea1,null));};exports['create']=function(_0x2d7b16,_0x549556){return db[_0x72a9('0x36')][_0x72a9('0x55')](_0x2d7b16[_0x72a9('0x56')],{})[_0x72a9('0x19')](respondWithResult(_0x549556,0xc9))['catch'](handleError(_0x549556,null));};exports['update']=function(_0x378d47,_0x12362c){if(_0x378d47[_0x72a9('0x56')]['id']){delete _0x378d47[_0x72a9('0x56')]['id'];}return db[_0x72a9('0x36')][_0x72a9('0x54')]({'where':{'id':_0x378d47[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x12362c,null))[_0x72a9('0x19')](saveUpdates(_0x378d47[_0x72a9('0x56')],null))['then'](respondWithResult(_0x12362c,null))['catch'](handleError(_0x12362c,null));};exports[_0x72a9('0x30')]=function(_0x9bb433,_0x3eb339){return db[_0x72a9('0x36')]['find']({'where':{'id':_0x9bb433[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x3eb339,null))[_0x72a9('0x19')](removeEntity(_0x3eb339,null))['catch'](handleError(_0x3eb339,null));};exports[_0x72a9('0x57')]=function(_0x2e519e,_0x55f60c,_0xe958a4){var _0x1b36ee={};var _0x503f0c={};var _0x24668a;var _0x5aaf1a;return db[_0x72a9('0x36')][_0x72a9('0x58')]({'where':{'id':_0x2e519e['params']['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x55f60c,null))['then'](function(_0x576f2f){if(_0x576f2f){_0x24668a=_0x576f2f;_0x503f0c[_0x72a9('0x3a')]=_['keys'](db[_0x72a9('0x59')]['rawAttributes']);_0x503f0c['query']=_[_0x72a9('0x3c')](_0x2e519e[_0x72a9('0x3b')]);_0x503f0c[_0x72a9('0x3d')]=_['intersection'](_0x503f0c[_0x72a9('0x3a')],_0x503f0c['query']);_0x1b36ee[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0x503f0c[_0x72a9('0x3a')],qs['fields'](_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x1b36ee['attributes']=_0x1b36ee[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x1b36ee['attributes']:_0x503f0c[_0x72a9('0x3a')];_0x1b36ee[_0x72a9('0x44')]=qs[_0x72a9('0x45')](_0x2e519e['query'][_0x72a9('0x45')]);_0x1b36ee[_0x72a9('0x46')]=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x2e519e[_0x72a9('0x3b')],_0x503f0c[_0x72a9('0x3d')]));if(_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x1b36ee[_0x72a9('0x46')]=_[_0x72a9('0x49')](_0x1b36ee['where'],{'$or':_['map'](_0x1b36ee['attributes'],function(_0x54ac2e){var _0x624287={};_0x624287[_0x54ac2e]={'$like':'%'+_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x624287;})});}_0x1b36ee=_[_0x72a9('0x49')]({},_0x1b36ee,_0x2e519e[_0x72a9('0x53')]);return _0x24668a[_0x72a9('0x57')](_0x1b36ee);}})[_0x72a9('0x19')](function(_0x4274a4){if(_0x4274a4){_0x5aaf1a=_0x4274a4[_0x72a9('0x41')];if(!_0x2e519e[_0x72a9('0x3b')]['hasOwnProperty'](_0x72a9('0x43'))){_0x1b36ee[_0x72a9('0x28')]=qs[_0x72a9('0x28')](_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x28')]);_0x1b36ee['offset']=qs['offset'](_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x27')]);}return _0x24668a[_0x72a9('0x57')](_0x1b36ee);}})[_0x72a9('0x19')](function(_0xbe813){if(_0xbe813){return _0xbe813?{'count':_0x5aaf1a,'rows':_0xbe813}:null;}})[_0x72a9('0x19')](respondWithResult(_0x55f60c,null))[_0x72a9('0x4f')](handleError(_0x55f60c,null));};exports[_0x72a9('0x5a')]=function(_0x45d678,_0x2e4b70,_0x41fea1){var _0x24fc30={};var _0x5d2712={};var _0x144479;var _0x4108db;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x45d678[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x2e4b70,null))[_0x72a9('0x19')](function(_0x1470fa){if(_0x1470fa){_0x144479=_0x1470fa;_0x5d2712[_0x72a9('0x3a')]=_[_0x72a9('0x3c')](db['SalesforceField'][_0x72a9('0x52')]);_0x5d2712['query']=_[_0x72a9('0x3c')](_0x45d678[_0x72a9('0x3b')]);_0x5d2712['filters']=_['intersection'](_0x5d2712[_0x72a9('0x3a')],_0x5d2712[_0x72a9('0x3b')]);_0x24fc30[_0x72a9('0x3f')]=_['intersection'](_0x5d2712[_0x72a9('0x3a')],qs[_0x72a9('0x40')](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x24fc30[_0x72a9('0x3f')]=_0x24fc30[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x24fc30['attributes']:_0x5d2712['model'];_0x24fc30[_0x72a9('0x44')]=qs[_0x72a9('0x45')](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x45')]);_0x24fc30['where']=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x45d678[_0x72a9('0x3b')],_0x5d2712['filters']));if(_0x45d678[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x24fc30[_0x72a9('0x46')]=_[_0x72a9('0x49')](_0x24fc30[_0x72a9('0x46')],{'$or':_[_0x72a9('0x35')](_0x24fc30[_0x72a9('0x3f')],function(_0x1d71dd){var _0x4b3eaf={};_0x4b3eaf[_0x1d71dd]={'$like':'%'+_0x45d678[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x4b3eaf;})});}_0x24fc30=_[_0x72a9('0x49')]({},_0x24fc30,_0x45d678[_0x72a9('0x53')]);return _0x144479['getSubjects'](_0x24fc30);}})[_0x72a9('0x19')](function(_0x58fa47){if(_0x58fa47){_0x4108db=_0x58fa47[_0x72a9('0x41')];if(!_0x45d678[_0x72a9('0x3b')][_0x72a9('0x42')]('nolimit')){_0x24fc30[_0x72a9('0x28')]=qs[_0x72a9('0x28')](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x28')]);_0x24fc30[_0x72a9('0x27')]=qs['offset'](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x27')]);}return _0x144479[_0x72a9('0x5a')](_0x24fc30);}})[_0x72a9('0x19')](function(_0x1e4d64){if(_0x1e4d64){return _0x1e4d64?{'count':_0x4108db,'rows':_0x1e4d64}:null;}})[_0x72a9('0x19')](respondWithResult(_0x2e4b70,null))['catch'](handleError(_0x2e4b70,null));};exports[_0x72a9('0x5b')]=function(_0x2343f3,_0x4b762f,_0x436fb8){var _0x89d15f={};var _0x626c89={};var _0x13d459;var _0x418b45;return db[_0x72a9('0x36')]['findOne']({'where':{'id':_0x2343f3[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x4b762f,null))[_0x72a9('0x19')](function(_0x5bc904){if(_0x5bc904){_0x13d459=_0x5bc904;_0x626c89[_0x72a9('0x3a')]=_[_0x72a9('0x3c')](db['SalesforceField']['rawAttributes']);_0x626c89[_0x72a9('0x3b')]=_[_0x72a9('0x3c')](_0x2343f3[_0x72a9('0x3b')]);_0x626c89[_0x72a9('0x3d')]=_[_0x72a9('0x3e')](_0x626c89['model'],_0x626c89[_0x72a9('0x3b')]);_0x89d15f[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0x626c89[_0x72a9('0x3a')],qs[_0x72a9('0x40')](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x89d15f[_0x72a9('0x3f')]=_0x89d15f[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x89d15f[_0x72a9('0x3f')]:_0x626c89[_0x72a9('0x3a')];_0x89d15f['order']=qs['sort'](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x45')]);_0x89d15f[_0x72a9('0x46')]=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x2343f3[_0x72a9('0x3b')],_0x626c89[_0x72a9('0x3d')]));if(_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x89d15f['where']=_[_0x72a9('0x49')](_0x89d15f[_0x72a9('0x46')],{'$or':_[_0x72a9('0x35')](_0x89d15f['attributes'],function(_0x69a44d){var _0x466a43={};_0x466a43[_0x69a44d]={'$like':'%'+_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x466a43;})});}_0x89d15f=_[_0x72a9('0x49')]({},_0x89d15f,_0x2343f3['options']);return _0x13d459[_0x72a9('0x5b')](_0x89d15f);}})[_0x72a9('0x19')](function(_0xf839f4){if(_0xf839f4){_0x418b45=_0xf839f4[_0x72a9('0x41')];if(!_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x42')]('nolimit')){_0x89d15f['limit']=qs[_0x72a9('0x28')](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x28')]);_0x89d15f['offset']=qs['offset'](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x27')]);}return _0x13d459[_0x72a9('0x5b')](_0x89d15f);}})[_0x72a9('0x19')](function(_0x26cae5){if(_0x26cae5){return _0x26cae5?{'count':_0x418b45,'rows':_0x26cae5}:null;}})[_0x72a9('0x19')](respondWithResult(_0x4b762f,null))['catch'](handleError(_0x4b762f,null));}; \ No newline at end of file +var _0x232d=['client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','index','SalesforceConfiguration','rawAttributes','fieldName','type','model','name','keys','filters','attributes','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','fields','length','find','create','body','getFields','findOne','getSubjects','SalesforceField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise'];(function(_0x5ce489,_0x335604){var _0x2164cf=function(_0x5f0818){while(--_0x5f0818){_0x5ce489['push'](_0x5ce489['shift']());}};_0x2164cf(++_0x335604);}(_0x232d,0x9f));var _0xd232=function(_0x428ae3,_0x264954){_0x428ae3=_0x428ae3-0x0;var _0x181465=_0x232d[_0x428ae3];return _0x181465;};'use strict';var pdf=require(_0xd232('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd232('0x1'));var zipdir=require(_0xd232('0x2'));var jsonpatch=require(_0xd232('0x3'));var rp=require(_0xd232('0x4'));var moment=require('moment');var BPromise=require(_0xd232('0x5'));var Mustache=require(_0xd232('0x6'));var util=require(_0xd232('0x7'));var path=require(_0xd232('0x8'));var sox=require(_0xd232('0x9'));var csv=require(_0xd232('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd232('0xb'));var squel=require(_0xd232('0xc'));var crypto=require('crypto');var jsforce=require(_0xd232('0xd'));var deskjs=require(_0xd232('0xe'));var toCsv=require(_0xd232('0xa'));var querystring=require(_0xd232('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd232('0x10'));var logger=require(_0xd232('0x11'))(_0xd232('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd232('0x13'))['db'];var jayson=require(_0xd232('0x14'));var client=jayson[_0xd232('0x15')][_0xd232('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1a39cc,_0x545df0,_0x1ec9e6,_0x2ce6ae){return new BPromise(function(_0x479e0d,_0x5cc44d){var _0x4cb60e=_0x2ce6ae||client;return _0x4cb60e[_0xd232('0x17')](_0x1a39cc,_0x1ec9e6)[_0xd232('0x18')](function(_0x5d45a2){logger[_0xd232('0x19')](_0xd232('0x1a'),_0x545df0,_0xd232('0x1b'));logger[_0xd232('0x1c')](_0xd232('0x1d'),_0x545df0,_0xd232('0x1b'),JSON[_0xd232('0x1e')](_0x5d45a2));if(_0x5d45a2[_0xd232('0x1f')]){if(_0x5d45a2['error'][_0xd232('0x20')]===0x1f4){logger[_0xd232('0x1f')](_0xd232('0x1a'),_0x545df0,_0x5d45a2[_0xd232('0x1f')]['message']);return _0x5cc44d(_0x5d45a2[_0xd232('0x1f')][_0xd232('0x21')]);}logger[_0xd232('0x1f')](_0xd232('0x1a'),_0x545df0,_0x5d45a2[_0xd232('0x1f')][_0xd232('0x21')]);return _0x479e0d(_0x5d45a2['error']['message']);}else{logger['info'](_0xd232('0x1a'),_0x545df0,'request\x20sent');_0x479e0d(_0x5d45a2[_0xd232('0x22')]['message']);}})[_0xd232('0x23')](function(_0x1749b8){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x545df0,_0x1749b8);_0x5cc44d(_0x1749b8);});});}function respondWithStatusCode(_0x180510,_0x35fc0b){_0x35fc0b=_0x35fc0b||0xcc;return function(_0x2f9593){if(_0x2f9593){return _0x180510[_0xd232('0x24')](_0x35fc0b);}return _0x180510['status'](_0x35fc0b)[_0xd232('0x25')]();};}function respondWithResult(_0xd8ca80,_0x1cd0fa){_0x1cd0fa=_0x1cd0fa||0xc8;return function(_0x1b80de){if(_0x1b80de){return _0xd8ca80[_0xd232('0x26')](_0x1cd0fa)[_0xd232('0x27')](_0x1b80de);}};}function respondWithFilteredResult(_0x24fa29,_0x470d79){return function(_0x4d6399){if(_0x4d6399){var _0x50f0f9=_0x4d6399[_0xd232('0x28')],_0x5c8f42=_0x470d79[_0xd232('0x29')],_0x4b4b64=_0x470d79[_0xd232('0x29')]+_0x470d79[_0xd232('0x2a')],_0x26ffc2;if(_0x4b4b64>=_0x50f0f9){_0x4b4b64=_0x50f0f9;_0x26ffc2=0xc8;}else{_0x26ffc2=0xce;}_0x24fa29[_0xd232('0x26')](_0x26ffc2);return _0x24fa29[_0xd232('0x2b')](_0xd232('0x2c'),_0x5c8f42+'-'+_0x4b4b64+'/'+_0x50f0f9)[_0xd232('0x27')](_0x4d6399);}return null;};}function patchUpdates(_0x4c5343){return function(_0x4331a8){try{jsonpatch[_0xd232('0x2d')](_0x4331a8,_0x4c5343,!![]);}catch(_0x47b91f){return BPromise[_0xd232('0x2e')](_0x47b91f);}return _0x4331a8[_0xd232('0x2f')]();};}function saveUpdates(_0xef7cfc,_0x1f5334){return function(_0x5a34b0){if(_0x5a34b0){return _0x5a34b0[_0xd232('0x30')](_0xef7cfc)['then'](function(_0x113504){return _0x113504;});}return null;};}function removeEntity(_0x159d4e,_0x1a5fe4){return function(_0x1c5a03){if(_0x1c5a03){return _0x1c5a03[_0xd232('0x31')]()[_0xd232('0x18')](function(){_0x159d4e[_0xd232('0x26')](0xcc)[_0xd232('0x25')]();});}};}function handleEntityNotFound(_0x2da1ca,_0x20484f){return function(_0x2ab307){if(!_0x2ab307){_0x2da1ca['sendStatus'](0x194);}return _0x2ab307;};}function handleError(_0x513239,_0x38578a){_0x38578a=_0x38578a||0x1f4;return function(_0x50c634){logger['error'](_0x50c634[_0xd232('0x32')]);if(_0x50c634['name']){delete _0x50c634['name'];}_0x513239[_0xd232('0x26')](_0x38578a)['send'](_0x50c634);};}exports[_0xd232('0x33')]=function(_0x1f2dc8,_0x371b11){var _0x5de558={},_0x6bea17={},_0x159ad1={'count':0x0,'rows':[]};var _0x5f6038=_['map'](db[_0xd232('0x34')][_0xd232('0x35')],function(_0x2091e){return{'name':_0x2091e[_0xd232('0x36')],'type':_0x2091e[_0xd232('0x37')]['key']};});_0x6bea17[_0xd232('0x38')]=_['map'](_0x5f6038,_0xd232('0x39'));_0x6bea17['query']=_[_0xd232('0x3a')](_0x1f2dc8['query']);_0x6bea17[_0xd232('0x3b')]=_['intersection'](_0x6bea17[_0xd232('0x38')],_0x6bea17['query']);_0x5de558[_0xd232('0x3c')]=_['intersection'](_0x6bea17['model'],qs['fields'](_0x1f2dc8[_0xd232('0x3d')]['fields']));_0x5de558[_0xd232('0x3c')]=_0x5de558['attributes']['length']?_0x5de558[_0xd232('0x3c')]:_0x6bea17[_0xd232('0x38')];if(!_0x1f2dc8['query'][_0xd232('0x3e')](_0xd232('0x3f'))){_0x5de558[_0xd232('0x2a')]=qs[_0xd232('0x2a')](_0x1f2dc8[_0xd232('0x3d')][_0xd232('0x2a')]);_0x5de558[_0xd232('0x29')]=qs[_0xd232('0x29')](_0x1f2dc8[_0xd232('0x3d')][_0xd232('0x29')]);}_0x5de558[_0xd232('0x40')]=qs[_0xd232('0x41')](_0x1f2dc8[_0xd232('0x3d')][_0xd232('0x41')]);_0x5de558[_0xd232('0x42')]=qs[_0xd232('0x3b')](_[_0xd232('0x43')](_0x1f2dc8[_0xd232('0x3d')],_0x6bea17[_0xd232('0x3b')]),_0x5f6038);if(_0x1f2dc8['query']['filter']){_0x5de558[_0xd232('0x42')]=_[_0xd232('0x44')](_0x5de558[_0xd232('0x42')],{'$or':_[_0xd232('0x45')](_0x5f6038,function(_0x578be1){if(_0x578be1[_0xd232('0x37')]!==_0xd232('0x46')){var _0x196dba={};_0x196dba[_0x578be1[_0xd232('0x39')]]={'$like':'%'+_0x1f2dc8[_0xd232('0x3d')][_0xd232('0x47')]+'%'};return _0x196dba;}})});}_0x5de558=_[_0xd232('0x44')]({},_0x5de558,_0x1f2dc8[_0xd232('0x48')]);var _0x1c9c00={'where':_0x5de558[_0xd232('0x42')]};return db[_0xd232('0x34')][_0xd232('0x28')](_0x1c9c00)[_0xd232('0x18')](function(_0x4e9f2d){_0x159ad1[_0xd232('0x28')]=_0x4e9f2d;if(_0x1f2dc8[_0xd232('0x3d')][_0xd232('0x49')]){_0x5de558[_0xd232('0x4a')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xd232('0x4b')](_0x5de558);})[_0xd232('0x18')](function(_0x322364){_0x159ad1[_0xd232('0x4c')]=_0x322364;return _0x159ad1;})[_0xd232('0x18')](respondWithFilteredResult(_0x371b11,_0x5de558))['catch'](handleError(_0x371b11,null));};exports[_0xd232('0x4d')]=function(_0x586cd3,_0x5149a4){var _0x4fca31={'raw':![],'where':{'id':_0x586cd3[_0xd232('0x4e')]['id']}},_0xb395dc={};_0xb395dc[_0xd232('0x38')]=_[_0xd232('0x3a')](db[_0xd232('0x34')]['rawAttributes']);_0xb395dc['query']=_[_0xd232('0x3a')](_0x586cd3[_0xd232('0x3d')]);_0xb395dc[_0xd232('0x3b')]=_[_0xd232('0x4f')](_0xb395dc['model'],_0xb395dc['query']);_0x4fca31[_0xd232('0x3c')]=_[_0xd232('0x4f')](_0xb395dc['model'],qs['fields'](_0x586cd3[_0xd232('0x3d')][_0xd232('0x50')]));_0x4fca31[_0xd232('0x3c')]=_0x4fca31[_0xd232('0x3c')][_0xd232('0x51')]?_0x4fca31[_0xd232('0x3c')]:_0xb395dc[_0xd232('0x38')];if(_0x586cd3[_0xd232('0x3d')][_0xd232('0x49')]){_0x4fca31['include']=[{'all':!![]}];}_0x4fca31=_[_0xd232('0x44')]({},_0x4fca31,_0x586cd3[_0xd232('0x48')]);return db[_0xd232('0x34')][_0xd232('0x52')](_0x4fca31)[_0xd232('0x18')](handleEntityNotFound(_0x5149a4,null))[_0xd232('0x18')](respondWithResult(_0x5149a4,null))[_0xd232('0x23')](handleError(_0x5149a4,null));};exports[_0xd232('0x53')]=function(_0xfcce4c,_0x40b4c8){return db[_0xd232('0x34')][_0xd232('0x53')](_0xfcce4c[_0xd232('0x54')],{})[_0xd232('0x18')](respondWithResult(_0x40b4c8,0xc9))['catch'](handleError(_0x40b4c8,null));};exports[_0xd232('0x30')]=function(_0x4abe87,_0x5ef04a){if(_0x4abe87[_0xd232('0x54')]['id']){delete _0x4abe87[_0xd232('0x54')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x4abe87['params']['id']}})[_0xd232('0x18')](handleEntityNotFound(_0x5ef04a,null))['then'](saveUpdates(_0x4abe87[_0xd232('0x54')],null))[_0xd232('0x18')](respondWithResult(_0x5ef04a,null))[_0xd232('0x23')](handleError(_0x5ef04a,null));};exports[_0xd232('0x31')]=function(_0x4d7d3e,_0x153454){return db['SalesforceConfiguration'][_0xd232('0x52')]({'where':{'id':_0x4d7d3e['params']['id']}})[_0xd232('0x18')](handleEntityNotFound(_0x153454,null))[_0xd232('0x18')](removeEntity(_0x153454,null))['catch'](handleError(_0x153454,null));};exports[_0xd232('0x55')]=function(_0x4f3f44,_0x262869,_0x5c2008){var _0x2d484b={};var _0x389df9={};var _0x20b26a;var _0x3cee50;return db['SalesforceConfiguration'][_0xd232('0x56')]({'where':{'id':_0x4f3f44['params']['id']}})[_0xd232('0x18')](handleEntityNotFound(_0x262869,null))[_0xd232('0x18')](function(_0x2dd512){if(_0x2dd512){_0x20b26a=_0x2dd512;_0x389df9[_0xd232('0x38')]=_['keys'](db['SalesforceField'][_0xd232('0x35')]);_0x389df9[_0xd232('0x3d')]=_['keys'](_0x4f3f44[_0xd232('0x3d')]);_0x389df9[_0xd232('0x3b')]=_[_0xd232('0x4f')](_0x389df9['model'],_0x389df9['query']);_0x2d484b[_0xd232('0x3c')]=_[_0xd232('0x4f')](_0x389df9['model'],qs[_0xd232('0x50')](_0x4f3f44[_0xd232('0x3d')][_0xd232('0x50')]));_0x2d484b[_0xd232('0x3c')]=_0x2d484b[_0xd232('0x3c')][_0xd232('0x51')]?_0x2d484b[_0xd232('0x3c')]:_0x389df9['model'];_0x2d484b[_0xd232('0x40')]=qs['sort'](_0x4f3f44[_0xd232('0x3d')][_0xd232('0x41')]);_0x2d484b[_0xd232('0x42')]=qs[_0xd232('0x3b')](_[_0xd232('0x43')](_0x4f3f44[_0xd232('0x3d')],_0x389df9['filters']));if(_0x4f3f44[_0xd232('0x3d')]['filter']){_0x2d484b[_0xd232('0x42')]=_[_0xd232('0x44')](_0x2d484b[_0xd232('0x42')],{'$or':_[_0xd232('0x45')](_0x2d484b['attributes'],function(_0x368de3){var _0x2d0765={};_0x2d0765[_0x368de3]={'$like':'%'+_0x4f3f44['query'][_0xd232('0x47')]+'%'};return _0x2d0765;})});}_0x2d484b=_[_0xd232('0x44')]({},_0x2d484b,_0x4f3f44[_0xd232('0x48')]);return _0x20b26a[_0xd232('0x55')](_0x2d484b);}})[_0xd232('0x18')](function(_0x466ef6){if(_0x466ef6){_0x3cee50=_0x466ef6[_0xd232('0x51')];if(!_0x4f3f44[_0xd232('0x3d')][_0xd232('0x3e')](_0xd232('0x3f'))){_0x2d484b[_0xd232('0x2a')]=qs[_0xd232('0x2a')](_0x4f3f44[_0xd232('0x3d')][_0xd232('0x2a')]);_0x2d484b['offset']=qs[_0xd232('0x29')](_0x4f3f44[_0xd232('0x3d')][_0xd232('0x29')]);}return _0x20b26a[_0xd232('0x55')](_0x2d484b);}})[_0xd232('0x18')](function(_0x446564){if(_0x446564){return _0x446564?{'count':_0x3cee50,'rows':_0x446564}:null;}})[_0xd232('0x18')](respondWithResult(_0x262869,null))[_0xd232('0x23')](handleError(_0x262869,null));};exports[_0xd232('0x57')]=function(_0x53bfb5,_0x42d0b9,_0x308171){var _0x35841e={};var _0x35e3b5={};var _0x5ee164;var _0x4a6299;return db[_0xd232('0x34')]['findOne']({'where':{'id':_0x53bfb5[_0xd232('0x4e')]['id']}})[_0xd232('0x18')](handleEntityNotFound(_0x42d0b9,null))[_0xd232('0x18')](function(_0x2fe168){if(_0x2fe168){_0x5ee164=_0x2fe168;_0x35e3b5[_0xd232('0x38')]=_[_0xd232('0x3a')](db[_0xd232('0x58')]['rawAttributes']);_0x35e3b5[_0xd232('0x3d')]=_[_0xd232('0x3a')](_0x53bfb5[_0xd232('0x3d')]);_0x35e3b5[_0xd232('0x3b')]=_[_0xd232('0x4f')](_0x35e3b5[_0xd232('0x38')],_0x35e3b5[_0xd232('0x3d')]);_0x35841e['attributes']=_[_0xd232('0x4f')](_0x35e3b5[_0xd232('0x38')],qs[_0xd232('0x50')](_0x53bfb5[_0xd232('0x3d')]['fields']));_0x35841e[_0xd232('0x3c')]=_0x35841e[_0xd232('0x3c')][_0xd232('0x51')]?_0x35841e['attributes']:_0x35e3b5[_0xd232('0x38')];_0x35841e[_0xd232('0x40')]=qs['sort'](_0x53bfb5['query'][_0xd232('0x41')]);_0x35841e['where']=qs[_0xd232('0x3b')](_[_0xd232('0x43')](_0x53bfb5[_0xd232('0x3d')],_0x35e3b5['filters']));if(_0x53bfb5[_0xd232('0x3d')][_0xd232('0x47')]){_0x35841e['where']=_[_0xd232('0x44')](_0x35841e['where'],{'$or':_[_0xd232('0x45')](_0x35841e[_0xd232('0x3c')],function(_0x4fa074){var _0xe66a4={};_0xe66a4[_0x4fa074]={'$like':'%'+_0x53bfb5[_0xd232('0x3d')]['filter']+'%'};return _0xe66a4;})});}_0x35841e=_[_0xd232('0x44')]({},_0x35841e,_0x53bfb5['options']);return _0x5ee164[_0xd232('0x57')](_0x35841e);}})[_0xd232('0x18')](function(_0x3c2810){if(_0x3c2810){_0x4a6299=_0x3c2810[_0xd232('0x51')];if(!_0x53bfb5[_0xd232('0x3d')][_0xd232('0x3e')]('nolimit')){_0x35841e[_0xd232('0x2a')]=qs[_0xd232('0x2a')](_0x53bfb5[_0xd232('0x3d')][_0xd232('0x2a')]);_0x35841e[_0xd232('0x29')]=qs[_0xd232('0x29')](_0x53bfb5[_0xd232('0x3d')][_0xd232('0x29')]);}return _0x5ee164[_0xd232('0x57')](_0x35841e);}})[_0xd232('0x18')](function(_0x5db2f9){if(_0x5db2f9){return _0x5db2f9?{'count':_0x4a6299,'rows':_0x5db2f9}:null;}})[_0xd232('0x18')](respondWithResult(_0x42d0b9,null))['catch'](handleError(_0x42d0b9,null));};exports[_0xd232('0x59')]=function(_0x30a3d6,_0x89e104,_0x461810){var _0x403519={};var _0x2a3a6b={};var _0x253ff7;var _0x2326ea;return db[_0xd232('0x34')][_0xd232('0x56')]({'where':{'id':_0x30a3d6[_0xd232('0x4e')]['id']}})[_0xd232('0x18')](handleEntityNotFound(_0x89e104,null))[_0xd232('0x18')](function(_0xd075ab){if(_0xd075ab){_0x253ff7=_0xd075ab;_0x2a3a6b['model']=_[_0xd232('0x3a')](db[_0xd232('0x58')]['rawAttributes']);_0x2a3a6b[_0xd232('0x3d')]=_[_0xd232('0x3a')](_0x30a3d6[_0xd232('0x3d')]);_0x2a3a6b[_0xd232('0x3b')]=_['intersection'](_0x2a3a6b['model'],_0x2a3a6b[_0xd232('0x3d')]);_0x403519['attributes']=_[_0xd232('0x4f')](_0x2a3a6b[_0xd232('0x38')],qs[_0xd232('0x50')](_0x30a3d6[_0xd232('0x3d')][_0xd232('0x50')]));_0x403519['attributes']=_0x403519['attributes'][_0xd232('0x51')]?_0x403519[_0xd232('0x3c')]:_0x2a3a6b['model'];_0x403519['order']=qs[_0xd232('0x41')](_0x30a3d6[_0xd232('0x3d')][_0xd232('0x41')]);_0x403519[_0xd232('0x42')]=qs[_0xd232('0x3b')](_[_0xd232('0x43')](_0x30a3d6[_0xd232('0x3d')],_0x2a3a6b[_0xd232('0x3b')]));if(_0x30a3d6[_0xd232('0x3d')]['filter']){_0x403519[_0xd232('0x42')]=_[_0xd232('0x44')](_0x403519[_0xd232('0x42')],{'$or':_[_0xd232('0x45')](_0x403519['attributes'],function(_0x5a5723){var _0xfbe33a={};_0xfbe33a[_0x5a5723]={'$like':'%'+_0x30a3d6[_0xd232('0x3d')]['filter']+'%'};return _0xfbe33a;})});}_0x403519=_[_0xd232('0x44')]({},_0x403519,_0x30a3d6['options']);return _0x253ff7[_0xd232('0x59')](_0x403519);}})[_0xd232('0x18')](function(_0x5ae9da){if(_0x5ae9da){_0x2326ea=_0x5ae9da[_0xd232('0x51')];if(!_0x30a3d6['query']['hasOwnProperty'](_0xd232('0x3f'))){_0x403519[_0xd232('0x2a')]=qs[_0xd232('0x2a')](_0x30a3d6['query'][_0xd232('0x2a')]);_0x403519[_0xd232('0x29')]=qs[_0xd232('0x29')](_0x30a3d6[_0xd232('0x3d')]['offset']);}return _0x253ff7[_0xd232('0x59')](_0x403519);}})[_0xd232('0x18')](function(_0x4b2d0c){if(_0x4b2d0c){return _0x4b2d0c?{'count':_0x2326ea,'rows':_0x4b2d0c}:null;}})[_0xd232('0x18')](respondWithResult(_0x89e104,null))[_0xd232('0x23')](handleError(_0x89e104,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 105d0e3..c303900 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 _0x3073=['util','../../config/logger','api','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','SalesforceConfiguration'];(function(_0xcb537a,_0x15ca9b){var _0x5dcba0=function(_0x155cfb){while(--_0x155cfb){_0xcb537a['push'](_0xcb537a['shift']());}};_0x5dcba0(++_0x15ca9b);}(_0x3073,0x70));var _0x3307=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x3073[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require('lodash');var util=require(_0x3307('0x0'));var logger=require(_0x3307('0x1'))(_0x3307('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3307('0x3'));var fs=require('fs');var path=require(_0x3307('0x4'));var rimraf=require(_0x3307('0x5'));var config=require('../../config/environment');var attributes=require(_0x3307('0x6'));module['exports']=function(_0x2c195d,_0x2a7cd1){return _0x2c195d['define'](_0x3307('0x7'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a80=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0xbdfe75,_0x37863c){var _0x5600d2=function(_0x3d7051){while(--_0x3d7051){_0xbdfe75['push'](_0xbdfe75['shift']());}};_0x5600d2(++_0x37863c);}(_0x2a80,0x1d2));var _0x02a8=function(_0x4cb52a,_0xc864bd){_0x4cb52a=_0x4cb52a-0x0;var _0x328bf3=_0x2a80[_0x4cb52a];return _0x328bf3;};'use strict';var _=require(_0x02a8('0x0'));var util=require(_0x02a8('0x1'));var logger=require(_0x02a8('0x2'))(_0x02a8('0x3'));var moment=require(_0x02a8('0x4'));var BPromise=require(_0x02a8('0x5'));var rp=require(_0x02a8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02a8('0x7'));var config=require('../../config/environment');var attributes=require(_0x02a8('0x8'));module[_0x02a8('0x9')]=function(_0x4fe7ed,_0x5b2c2b){return _0x4fe7ed[_0x02a8('0xa')](_0x02a8('0xb'),attributes,{'tableName':_0x02a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 6e024cb..5a53a37 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 _0x1407=['../../config/logger','rpc','jayson/promise','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x18f52c,_0x1c84e6){var _0x506962=function(_0x25c7dc){while(--_0x25c7dc){_0x18f52c['push'](_0x18f52c['shift']());}};_0x506962(++_0x1c84e6);}(_0x1407,0x150));var _0x7140=function(_0x4ddea3,_0x2e161f){_0x4ddea3=_0x4ddea3-0x0;var _0x51ebb0=_0x1407[_0x4ddea3];return _0x51ebb0;};'use strict';var _=require(_0x7140('0x0'));var util=require(_0x7140('0x1'));var moment=require(_0x7140('0x2'));var BPromise=require(_0x7140('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7140('0x4'))(_0x7140('0x5'));var config=require('../../config/environment');var jayson=require(_0x7140('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25823f,_0x18e55f,_0x40ead6){return new BPromise(function(_0x157054,_0x29bf07){return client['request'](_0x25823f,_0x40ead6)[_0x7140('0x7')](function(_0x165a05){logger[_0x7140('0x8')](_0x7140('0x9'),_0x18e55f,_0x7140('0xa'));logger[_0x7140('0xb')](_0x7140('0xc'),_0x18e55f,'request\x20sent',JSON['stringify'](_0x165a05));if(_0x165a05[_0x7140('0xd')]){if(_0x165a05['error']['code']===0x1f4){logger[_0x7140('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18e55f,_0x165a05[_0x7140('0xd')][_0x7140('0xe')]);return _0x29bf07(_0x165a05['error'][_0x7140('0xe')]);}logger[_0x7140('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18e55f,_0x165a05[_0x7140('0xd')][_0x7140('0xe')]);return _0x157054(_0x165a05['error']['message']);}else{logger[_0x7140('0x8')](_0x7140('0x9'),_0x18e55f,'request\x20sent');_0x157054(_0x165a05[_0x7140('0xf')][_0x7140('0xe')]);}})[_0x7140('0x10')](function(_0x1b2827){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x18e55f,_0x1b2827);_0x29bf07(_0x1b2827);});});} \ No newline at end of file +var _0x5284=['../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x5284,0x133));var _0x4528=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5284[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x4528('0x0'));var util=require(_0x4528('0x1'));var moment=require(_0x4528('0x2'));var BPromise=require('bluebird');var rs=require(_0x4528('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4528('0x4'))['db'];var utils=require(_0x4528('0x5'));var logger=require(_0x4528('0x6'))(_0x4528('0x7'));var config=require(_0x4528('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4528('0x9')][_0x4528('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c184d,_0x422f0c,_0x3aa414){return new BPromise(function(_0x14f28c,_0x305b77){return client[_0x4528('0xb')](_0x2c184d,_0x3aa414)[_0x4528('0xc')](function(_0x51e24c){logger[_0x4528('0xd')](_0x4528('0xe'),_0x422f0c,_0x4528('0xf'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x422f0c,_0x4528('0xf'),JSON['stringify'](_0x51e24c));if(_0x51e24c['error']){if(_0x51e24c['error'][_0x4528('0x10')]===0x1f4){logger[_0x4528('0x11')](_0x4528('0xe'),_0x422f0c,_0x51e24c[_0x4528('0x11')]['message']);return _0x305b77(_0x51e24c[_0x4528('0x11')]['message']);}logger['error'](_0x4528('0xe'),_0x422f0c,_0x51e24c[_0x4528('0x11')]['message']);return _0x14f28c(_0x51e24c[_0x4528('0x11')][_0x4528('0x12')]);}else{logger[_0x4528('0xd')](_0x4528('0xe'),_0x422f0c,_0x4528('0xf'));_0x14f28c(_0x51e24c[_0x4528('0x13')][_0x4528('0x12')]);}})[_0x4528('0x14')](function(_0x46988f){logger[_0x4528('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x422f0c,_0x46988f);_0x305b77(_0x46988f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 5d3d970..55a6c5f 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 _0x7046=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7046,0x144));var _0x6704=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7046[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var auth=require(_0x6704('0x5'));var interaction=require(_0x6704('0x6'));var config=require('../../config/environment');var controller=require(_0x6704('0x7'));router[_0x6704('0x8')]('/',auth[_0x6704('0x9')](),controller[_0x6704('0xa')]);router[_0x6704('0x8')]('/:id',auth[_0x6704('0x9')](),controller['show']);router['post']('/',auth[_0x6704('0x9')](),controller['create']);router['put'](_0x6704('0xb'),auth[_0x6704('0x9')](),controller[_0x6704('0xc')]);router[_0x6704('0xd')](_0x6704('0xb'),auth[_0x6704('0x9')](),controller[_0x6704('0xe')]);module[_0x6704('0xf')]=router; \ No newline at end of file +var _0xe14b=['show','put','update','destroy','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x3e21e6,_0x5338f1){var _0x58d628=function(_0x51dcbc){while(--_0x51dcbc){_0x3e21e6['push'](_0x3e21e6['shift']());}};_0x58d628(++_0x5338f1);}(_0xe14b,0x93));var _0xbe14=function(_0x248292,_0x515026){_0x248292=_0x248292-0x0;var _0x3e4cf4=_0xe14b[_0x248292];return _0x3e4cf4;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xb')]);router['delete']('/:id',auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 550c99a..df4f75e 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 _0x24a3=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x388a79,_0x7ba77c){var _0x2abb28=function(_0x41b511){while(--_0x41b511){_0x388a79['push'](_0x388a79['shift']());}};_0x2abb28(++_0x7ba77c);}(_0x24a3,0xf0));var _0x324a=function(_0x3f58d9,_0x3a770d){_0x3f58d9=_0x3f58d9-0x0;var _0x5d18bb=_0x24a3[_0x3f58d9];return _0x5d18bb;};'use strict';var Sequelize=require(_0x324a('0x0'));module[_0x324a('0x1')]={'type':{'type':Sequelize[_0x324a('0x2')](_0x324a('0x3'),'variable',_0x324a('0x4'),_0x324a('0x5')),'defaultValue':_0x324a('0x3')},'content':{'type':Sequelize[_0x324a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x324a('0x3'),_0x324a('0x7'),_0x324a('0x4'))},'keyContent':{'type':Sequelize[_0x324a('0x6')]},'idField':{'type':Sequelize[_0x324a('0x6')]},'variableName':{'type':Sequelize[_0x324a('0x6')]}}; \ No newline at end of file +var _0x1730=['sequelize','ENUM','variable','keyValue','string','STRING','customVariable'];(function(_0x49c629,_0x3adf87){var _0x471e88=function(_0x1e24ba){while(--_0x1e24ba){_0x49c629['push'](_0x49c629['shift']());}};_0x471e88(++_0x3adf87);}(_0x1730,0x19d));var _0x0173=function(_0x2296c3,_0xaf7a1e){_0x2296c3=_0x2296c3-0x0;var _0x203d43=_0x1730[_0x2296c3];return _0x203d43;};'use strict';var Sequelize=require(_0x0173('0x0'));module['exports']={'type':{'type':Sequelize[_0x0173('0x1')]('string',_0x0173('0x2'),'customVariable',_0x0173('0x3')),'defaultValue':_0x0173('0x4')},'content':{'type':Sequelize[_0x0173('0x5')]},'key':{'type':Sequelize[_0x0173('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x0173('0x4'),'variable',_0x0173('0x6'))},'keyContent':{'type':Sequelize[_0x0173('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x0173('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b9e1e13..2c05727 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 _0x1f28=['update','then','destroy','sendStatus','error','name','send','index','map','SalesforceField','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','pick','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','end','status','json','count','offset','limit','set','Content-Range','save'];(function(_0xf0f95d,_0x3c8d2b){var _0x2443ab=function(_0xa4fb0b){while(--_0xa4fb0b){_0xf0f95d['push'](_0xf0f95d['shift']());}};_0x2443ab(++_0x3c8d2b);}(_0x1f28,0x1d5));var _0x81f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f28[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x81f2('0x0'));var emlformat=require(_0x81f2('0x1'));var rimraf=require(_0x81f2('0x2'));var zipdir=require(_0x81f2('0x3'));var jsonpatch=require(_0x81f2('0x4'));var rp=require(_0x81f2('0x5'));var moment=require(_0x81f2('0x6'));var BPromise=require(_0x81f2('0x7'));var Mustache=require(_0x81f2('0x8'));var util=require('util');var path=require(_0x81f2('0x9'));var sox=require(_0x81f2('0xa'));var csv=require(_0x81f2('0xb'));var ejs=require(_0x81f2('0xc'));var fs=require('fs');var _=require(_0x81f2('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x81f2('0xe'));var deskjs=require(_0x81f2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x81f2('0x10'));var Papa=require(_0x81f2('0x11'));var Redis=require(_0x81f2('0x12'));var authService=require(_0x81f2('0x13'));var qs=require(_0x81f2('0x14'));var as=require(_0x81f2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81f2('0x16'))(_0x81f2('0x17'));var utils=require(_0x81f2('0x18'));var config=require(_0x81f2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1031b4,_0x503f36){_0x503f36=_0x503f36||0xcc;return function(_0xf67e7f){if(_0xf67e7f){return _0x1031b4['sendStatus'](_0x503f36);}return _0x1031b4['status'](_0x503f36)[_0x81f2('0x1a')]();};}function respondWithResult(_0x3ffc56,_0x489c8a){_0x489c8a=_0x489c8a||0xc8;return function(_0x3aefb2){if(_0x3aefb2){return _0x3ffc56[_0x81f2('0x1b')](_0x489c8a)[_0x81f2('0x1c')](_0x3aefb2);}};}function respondWithFilteredResult(_0x5d7299,_0xc4caa8){return function(_0x538968){if(_0x538968){var _0x3525c0=_0x538968[_0x81f2('0x1d')],_0x393e2e=_0xc4caa8[_0x81f2('0x1e')],_0x398adf=_0xc4caa8[_0x81f2('0x1e')]+_0xc4caa8[_0x81f2('0x1f')],_0x23f353;if(_0x398adf>=_0x3525c0){_0x398adf=_0x3525c0;_0x23f353=0xc8;}else{_0x23f353=0xce;}_0x5d7299[_0x81f2('0x1b')](_0x23f353);return _0x5d7299[_0x81f2('0x20')](_0x81f2('0x21'),_0x393e2e+'-'+_0x398adf+'/'+_0x3525c0)[_0x81f2('0x1c')](_0x538968);}return null;};}function patchUpdates(_0x55afc1){return function(_0x442df3){try{jsonpatch['apply'](_0x442df3,_0x55afc1,!![]);}catch(_0x983290){return BPromise['reject'](_0x983290);}return _0x442df3[_0x81f2('0x22')]();};}function saveUpdates(_0x200e2f,_0x5acec3){return function(_0x17e09c){if(_0x17e09c){return _0x17e09c[_0x81f2('0x23')](_0x200e2f)[_0x81f2('0x24')](function(_0x28485e){return _0x28485e;});}return null;};}function removeEntity(_0x1755c5,_0x5c28c5){return function(_0x2bfd0d){if(_0x2bfd0d){return _0x2bfd0d[_0x81f2('0x25')]()[_0x81f2('0x24')](function(){_0x1755c5[_0x81f2('0x1b')](0xcc)[_0x81f2('0x1a')]();});}};}function handleEntityNotFound(_0x126c53,_0x35088b){return function(_0x387796){if(!_0x387796){_0x126c53[_0x81f2('0x26')](0x194);}return _0x387796;};}function handleError(_0x598baf,_0x3a0a7e){_0x3a0a7e=_0x3a0a7e||0x1f4;return function(_0xa34bb0){logger[_0x81f2('0x27')](_0xa34bb0['stack']);if(_0xa34bb0[_0x81f2('0x28')]){delete _0xa34bb0[_0x81f2('0x28')];}_0x598baf['status'](_0x3a0a7e)[_0x81f2('0x29')](_0xa34bb0);};}exports[_0x81f2('0x2a')]=function(_0x10b333,_0x5b57c0){var _0x234380={},_0x2009be={},_0x295842={'count':0x0,'rows':[]};var _0x22ae5c=_[_0x81f2('0x2b')](db[_0x81f2('0x2c')]['rawAttributes'],function(_0x556275){return{'name':_0x556275[_0x81f2('0x2d')],'type':_0x556275[_0x81f2('0x2e')][_0x81f2('0x2f')]};});_0x2009be['model']=_[_0x81f2('0x2b')](_0x22ae5c,_0x81f2('0x28'));_0x2009be['query']=_[_0x81f2('0x30')](_0x10b333['query']);_0x2009be[_0x81f2('0x31')]=_[_0x81f2('0x32')](_0x2009be[_0x81f2('0x33')],_0x2009be[_0x81f2('0x34')]);_0x234380[_0x81f2('0x35')]=_[_0x81f2('0x32')](_0x2009be[_0x81f2('0x33')],qs[_0x81f2('0x36')](_0x10b333['query'][_0x81f2('0x36')]));_0x234380['attributes']=_0x234380[_0x81f2('0x35')]['length']?_0x234380['attributes']:_0x2009be[_0x81f2('0x33')];if(!_0x10b333[_0x81f2('0x34')]['hasOwnProperty'](_0x81f2('0x37'))){_0x234380[_0x81f2('0x1f')]=qs['limit'](_0x10b333[_0x81f2('0x34')][_0x81f2('0x1f')]);_0x234380[_0x81f2('0x1e')]=qs['offset'](_0x10b333['query'][_0x81f2('0x1e')]);}_0x234380[_0x81f2('0x38')]=qs[_0x81f2('0x39')](_0x10b333[_0x81f2('0x34')][_0x81f2('0x39')]);_0x234380['where']=qs[_0x81f2('0x31')](_[_0x81f2('0x3a')](_0x10b333[_0x81f2('0x34')],_0x2009be[_0x81f2('0x31')]),_0x22ae5c);if(_0x10b333[_0x81f2('0x34')]['filter']){_0x234380[_0x81f2('0x3b')]=_['merge'](_0x234380[_0x81f2('0x3b')],{'$or':_[_0x81f2('0x2b')](_0x22ae5c,function(_0x35aa2c){if(_0x35aa2c[_0x81f2('0x2e')]!=='VIRTUAL'){var _0x50f5a2={};_0x50f5a2[_0x35aa2c[_0x81f2('0x28')]]={'$like':'%'+_0x10b333['query'][_0x81f2('0x3c')]+'%'};return _0x50f5a2;}})});}_0x234380=_[_0x81f2('0x3d')]({},_0x234380,_0x10b333[_0x81f2('0x3e')]);var _0x24e4f9={'where':_0x234380['where']};return db['SalesforceField']['count'](_0x24e4f9)[_0x81f2('0x24')](function(_0x4ee944){_0x295842[_0x81f2('0x1d')]=_0x4ee944;if(_0x10b333[_0x81f2('0x34')][_0x81f2('0x3f')]){_0x234380['include']=[{'all':!![]}];}return db['SalesforceField'][_0x81f2('0x40')](_0x234380);})[_0x81f2('0x24')](function(_0x330e33){_0x295842[_0x81f2('0x41')]=_0x330e33;return _0x295842;})['then'](respondWithFilteredResult(_0x5b57c0,_0x234380))[_0x81f2('0x42')](handleError(_0x5b57c0,null));};exports[_0x81f2('0x43')]=function(_0x8f7351,_0x8a6007){var _0x1f3176={'raw':!![],'where':{'id':_0x8f7351[_0x81f2('0x44')]['id']}},_0x145759={};_0x145759[_0x81f2('0x33')]=_[_0x81f2('0x30')](db[_0x81f2('0x2c')][_0x81f2('0x45')]);_0x145759[_0x81f2('0x34')]=_[_0x81f2('0x30')](_0x8f7351[_0x81f2('0x34')]);_0x145759[_0x81f2('0x31')]=_['intersection'](_0x145759['model'],_0x145759[_0x81f2('0x34')]);_0x1f3176[_0x81f2('0x35')]=_['intersection'](_0x145759['model'],qs[_0x81f2('0x36')](_0x8f7351[_0x81f2('0x34')][_0x81f2('0x36')]));_0x1f3176['attributes']=_0x1f3176[_0x81f2('0x35')]['length']?_0x1f3176[_0x81f2('0x35')]:_0x145759[_0x81f2('0x33')];if(_0x8f7351[_0x81f2('0x34')][_0x81f2('0x3f')]){_0x1f3176['include']=[{'all':!![]}];}_0x1f3176=_[_0x81f2('0x3d')]({},_0x1f3176,_0x8f7351[_0x81f2('0x3e')]);return db[_0x81f2('0x2c')][_0x81f2('0x46')](_0x1f3176)[_0x81f2('0x24')](handleEntityNotFound(_0x8a6007,null))[_0x81f2('0x24')](respondWithResult(_0x8a6007,null))[_0x81f2('0x42')](handleError(_0x8a6007,null));};exports['create']=function(_0x1af9a4,_0x1269a6){return db['SalesforceField']['create'](_0x1af9a4[_0x81f2('0x47')],{})['then'](respondWithResult(_0x1269a6,0xc9))['catch'](handleError(_0x1269a6,null));};exports[_0x81f2('0x23')]=function(_0x416755,_0x37b5db){if(_0x416755[_0x81f2('0x47')]['id']){delete _0x416755[_0x81f2('0x47')]['id'];}return db[_0x81f2('0x2c')][_0x81f2('0x46')]({'where':{'id':_0x416755[_0x81f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x37b5db,null))[_0x81f2('0x24')](saveUpdates(_0x416755[_0x81f2('0x47')],null))[_0x81f2('0x24')](respondWithResult(_0x37b5db,null))[_0x81f2('0x42')](handleError(_0x37b5db,null));};exports[_0x81f2('0x25')]=function(_0x1d5302,_0x47b015){return db[_0x81f2('0x2c')]['find']({'where':{'id':_0x1d5302[_0x81f2('0x44')]['id']}})[_0x81f2('0x24')](handleEntityNotFound(_0x47b015,null))[_0x81f2('0x24')](removeEntity(_0x47b015,null))[_0x81f2('0x42')](handleError(_0x47b015,null));}; \ No newline at end of file +var _0x5043=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceField','findAll','rows','show','params','length','include','catch','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','json','reject','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model'];(function(_0x56d38f,_0x198e0a){var _0x4d60a8=function(_0x1607f){while(--_0x1607f){_0x56d38f['push'](_0x56d38f['shift']());}};_0x4d60a8(++_0x198e0a);}(_0x5043,0x1e4));var _0x3504=function(_0x238455,_0x1d46be){_0x238455=_0x238455-0x0;var _0x2529f1=_0x5043[_0x238455];return _0x2529f1;};'use strict';var pdf=require(_0x3504('0x0'));var emlformat=require(_0x3504('0x1'));var rimraf=require(_0x3504('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3504('0x3'));var rp=require(_0x3504('0x4'));var moment=require(_0x3504('0x5'));var BPromise=require(_0x3504('0x6'));var Mustache=require(_0x3504('0x7'));var util=require(_0x3504('0x8'));var path=require(_0x3504('0x9'));var sox=require(_0x3504('0xa'));var csv=require(_0x3504('0xb'));var ejs=require(_0x3504('0xc'));var fs=require('fs');var _=require(_0x3504('0xd'));var squel=require(_0x3504('0xe'));var crypto=require(_0x3504('0xf'));var jsforce=require(_0x3504('0x10'));var deskjs=require(_0x3504('0x11'));var toCsv=require(_0x3504('0xb'));var querystring=require(_0x3504('0x12'));var Papa=require(_0x3504('0x13'));var Redis=require('ioredis');var authService=require(_0x3504('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3504('0x15'));var hardwareService=require(_0x3504('0x16'));var logger=require(_0x3504('0x17'))(_0x3504('0x18'));var utils=require(_0x3504('0x19'));var config=require(_0x3504('0x1a'));var licenseUtil=require(_0x3504('0x1b'));var db=require(_0x3504('0x1c'))['db'];function respondWithStatusCode(_0x2dbace,_0x5d25ce){_0x5d25ce=_0x5d25ce||0xcc;return function(_0x4866fc){if(_0x4866fc){return _0x2dbace['sendStatus'](_0x5d25ce);}return _0x2dbace[_0x3504('0x1d')](_0x5d25ce)[_0x3504('0x1e')]();};}function respondWithResult(_0xe8ce74,_0x37bafe){_0x37bafe=_0x37bafe||0xc8;return function(_0xdce80){if(_0xdce80){return _0xe8ce74[_0x3504('0x1d')](_0x37bafe)['json'](_0xdce80);}};}function respondWithFilteredResult(_0x18c7f2,_0x445207){return function(_0x478b54){if(_0x478b54){var _0x1ff815=_0x478b54[_0x3504('0x1f')],_0x2fc4bc=_0x445207[_0x3504('0x20')],_0xfd3c6c=_0x445207['offset']+_0x445207['limit'],_0x3b13fd;if(_0xfd3c6c>=_0x1ff815){_0xfd3c6c=_0x1ff815;_0x3b13fd=0xc8;}else{_0x3b13fd=0xce;}_0x18c7f2[_0x3504('0x1d')](_0x3b13fd);return _0x18c7f2[_0x3504('0x21')]('Content-Range',_0x2fc4bc+'-'+_0xfd3c6c+'/'+_0x1ff815)[_0x3504('0x22')](_0x478b54);}return null;};}function patchUpdates(_0xf84d01){return function(_0x28c482){try{jsonpatch['apply'](_0x28c482,_0xf84d01,!![]);}catch(_0x44d24a){return BPromise[_0x3504('0x23')](_0x44d24a);}return _0x28c482['save']();};}function saveUpdates(_0xad3fc6,_0x25ab73){return function(_0x306e28){if(_0x306e28){return _0x306e28['update'](_0xad3fc6)[_0x3504('0x24')](function(_0x4a536c){return _0x4a536c;});}return null;};}function removeEntity(_0x579f77,_0x699359){return function(_0xe6988e){if(_0xe6988e){return _0xe6988e[_0x3504('0x25')]()[_0x3504('0x24')](function(){_0x579f77['status'](0xcc)[_0x3504('0x1e')]();});}};}function handleEntityNotFound(_0x3d5b51,_0x486ad7){return function(_0x2517c5){if(!_0x2517c5){_0x3d5b51[_0x3504('0x26')](0x194);}return _0x2517c5;};}function handleError(_0x4d1487,_0x3da421){_0x3da421=_0x3da421||0x1f4;return function(_0x64e245){logger[_0x3504('0x27')](_0x64e245[_0x3504('0x28')]);if(_0x64e245[_0x3504('0x29')]){delete _0x64e245[_0x3504('0x29')];}_0x4d1487[_0x3504('0x1d')](_0x3da421)[_0x3504('0x2a')](_0x64e245);};}exports['index']=function(_0x5638d2,_0x1eae84){var _0x5bc1cb={},_0x143f39={},_0x2ba038={'count':0x0,'rows':[]};var _0x1d9736=_[_0x3504('0x2b')](db['SalesforceField'][_0x3504('0x2c')],function(_0x2a0efd){return{'name':_0x2a0efd['fieldName'],'type':_0x2a0efd[_0x3504('0x2d')][_0x3504('0x2e')]};});_0x143f39[_0x3504('0x2f')]=_[_0x3504('0x2b')](_0x1d9736,'name');_0x143f39[_0x3504('0x30')]=_[_0x3504('0x31')](_0x5638d2[_0x3504('0x30')]);_0x143f39[_0x3504('0x32')]=_[_0x3504('0x33')](_0x143f39['model'],_0x143f39[_0x3504('0x30')]);_0x5bc1cb[_0x3504('0x34')]=_[_0x3504('0x33')](_0x143f39['model'],qs[_0x3504('0x35')](_0x5638d2['query'][_0x3504('0x35')]));_0x5bc1cb['attributes']=_0x5bc1cb[_0x3504('0x34')]['length']?_0x5bc1cb[_0x3504('0x34')]:_0x143f39[_0x3504('0x2f')];if(!_0x5638d2[_0x3504('0x30')][_0x3504('0x36')]('nolimit')){_0x5bc1cb['limit']=qs[_0x3504('0x37')](_0x5638d2['query'][_0x3504('0x37')]);_0x5bc1cb[_0x3504('0x20')]=qs[_0x3504('0x20')](_0x5638d2['query'][_0x3504('0x20')]);}_0x5bc1cb[_0x3504('0x38')]=qs[_0x3504('0x39')](_0x5638d2[_0x3504('0x30')]['sort']);_0x5bc1cb[_0x3504('0x3a')]=qs['filters'](_[_0x3504('0x3b')](_0x5638d2[_0x3504('0x30')],_0x143f39[_0x3504('0x32')]),_0x1d9736);if(_0x5638d2[_0x3504('0x30')][_0x3504('0x3c')]){_0x5bc1cb[_0x3504('0x3a')]=_[_0x3504('0x3d')](_0x5bc1cb[_0x3504('0x3a')],{'$or':_[_0x3504('0x2b')](_0x1d9736,function(_0xd0a63){if(_0xd0a63[_0x3504('0x2d')]!==_0x3504('0x3e')){var _0x5e2958={};_0x5e2958[_0xd0a63[_0x3504('0x29')]]={'$like':'%'+_0x5638d2['query'][_0x3504('0x3c')]+'%'};return _0x5e2958;}})});}_0x5bc1cb=_[_0x3504('0x3d')]({},_0x5bc1cb,_0x5638d2[_0x3504('0x3f')]);var _0x36e79b={'where':_0x5bc1cb[_0x3504('0x3a')]};return db['SalesforceField'][_0x3504('0x1f')](_0x36e79b)[_0x3504('0x24')](function(_0x36a43a){_0x2ba038['count']=_0x36a43a;if(_0x5638d2[_0x3504('0x30')]['includeAll']){_0x5bc1cb['include']=[{'all':!![]}];}return db[_0x3504('0x40')][_0x3504('0x41')](_0x5bc1cb);})[_0x3504('0x24')](function(_0x5adb80){_0x2ba038[_0x3504('0x42')]=_0x5adb80;return _0x2ba038;})['then'](respondWithFilteredResult(_0x1eae84,_0x5bc1cb))['catch'](handleError(_0x1eae84,null));};exports[_0x3504('0x43')]=function(_0x400d17,_0x4349ee){var _0x2046df={'raw':!![],'where':{'id':_0x400d17[_0x3504('0x44')]['id']}},_0x1eaa7b={};_0x1eaa7b[_0x3504('0x2f')]=_[_0x3504('0x31')](db[_0x3504('0x40')]['rawAttributes']);_0x1eaa7b[_0x3504('0x30')]=_[_0x3504('0x31')](_0x400d17['query']);_0x1eaa7b[_0x3504('0x32')]=_[_0x3504('0x33')](_0x1eaa7b[_0x3504('0x2f')],_0x1eaa7b[_0x3504('0x30')]);_0x2046df[_0x3504('0x34')]=_[_0x3504('0x33')](_0x1eaa7b[_0x3504('0x2f')],qs[_0x3504('0x35')](_0x400d17[_0x3504('0x30')][_0x3504('0x35')]));_0x2046df[_0x3504('0x34')]=_0x2046df[_0x3504('0x34')][_0x3504('0x45')]?_0x2046df[_0x3504('0x34')]:_0x1eaa7b[_0x3504('0x2f')];if(_0x400d17['query']['includeAll']){_0x2046df[_0x3504('0x46')]=[{'all':!![]}];}_0x2046df=_[_0x3504('0x3d')]({},_0x2046df,_0x400d17[_0x3504('0x3f')]);return db[_0x3504('0x40')]['find'](_0x2046df)[_0x3504('0x24')](handleEntityNotFound(_0x4349ee,null))['then'](respondWithResult(_0x4349ee,null))[_0x3504('0x47')](handleError(_0x4349ee,null));};exports[_0x3504('0x48')]=function(_0x4dee9f,_0x44009a){return db['SalesforceField'][_0x3504('0x48')](_0x4dee9f[_0x3504('0x49')],{})['then'](respondWithResult(_0x44009a,0xc9))[_0x3504('0x47')](handleError(_0x44009a,null));};exports[_0x3504('0x4a')]=function(_0x16968f,_0x54929e){if(_0x16968f['body']['id']){delete _0x16968f[_0x3504('0x49')]['id'];}return db[_0x3504('0x40')][_0x3504('0x4b')]({'where':{'id':_0x16968f[_0x3504('0x44')]['id']}})[_0x3504('0x24')](handleEntityNotFound(_0x54929e,null))['then'](saveUpdates(_0x16968f['body'],null))['then'](respondWithResult(_0x54929e,null))['catch'](handleError(_0x54929e,null));};exports[_0x3504('0x25')]=function(_0x4fa0b0,_0x4fef3c){return db[_0x3504('0x40')][_0x3504('0x4b')]({'where':{'id':_0x4fa0b0[_0x3504('0x44')]['id']}})[_0x3504('0x24')](handleEntityNotFound(_0x4fef3c,null))[_0x3504('0x24')](removeEntity(_0x4fef3c,null))[_0x3504('0x47')](handleError(_0x4fef3c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6501822..68c303a 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 _0xc57c=['./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc57c,0x9f));var _0xcc57=function(_0x36007e,_0x702816){_0x36007e=_0x36007e-0x0;var _0x397ed6=_0xc57c[_0x36007e];return _0x397ed6;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var logger=require(_0xcc57('0x1'))(_0xcc57('0x2'));var moment=require(_0xcc57('0x3'));var BPromise=require(_0xcc57('0x4'));var rp=require(_0xcc57('0x5'));var fs=require('fs');var path=require(_0xcc57('0x6'));var rimraf=require(_0xcc57('0x7'));var config=require(_0xcc57('0x8'));var attributes=require(_0xcc57('0x9'));module['exports']=function(_0x1d77dd,_0x243766){return _0x1d77dd['define'](_0xcc57('0xa'),attributes,{'tableName':_0xcc57('0xb'),'paranoid':![],'indexes':[{'name':_0xcc57('0xc'),'fields':['idField',_0xcc57('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2318=['util','moment','bluebird','request-promise','../../config/environment','define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash'];(function(_0x5e8141,_0x55a9e1){var _0x2d8395=function(_0x554679){while(--_0x554679){_0x5e8141['push'](_0x5e8141['shift']());}};_0x2d8395(++_0x55a9e1);}(_0x2318,0x149));var _0x8231=function(_0x2a82ad,_0x56d6b0){_0x2a82ad=_0x2a82ad-0x0;var _0x5802ce=_0x2318[_0x2a82ad];return _0x5802ce;};'use strict';var _=require(_0x8231('0x0'));var util=require(_0x8231('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8231('0x2'));var BPromise=require(_0x8231('0x3'));var rp=require(_0x8231('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8231('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x62da24,_0x20535f){return _0x62da24[_0x8231('0x6')](_0x8231('0x7'),attributes,{'tableName':_0x8231('0x8'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x8231('0x9'),_0x8231('0xa')],'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 f1d6245..c910283 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 _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x48cc06,_0x513ec2){var _0x49991a=function(_0x44c99d){while(--_0x44c99d){_0x48cc06['push'](_0x48cc06['shift']());}};_0x49991a(++_0x513ec2);}(_0x4483,0x1a3));var _0x3448=function(_0x3956a2,_0x4a8d1c){_0x3956a2=_0x3956a2-0x0;var _0xae6aae=_0x4483[_0x3956a2];return _0xae6aae;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file +var _0x5b02=['client','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x90e575,_0x48c2ec){var _0x1aae60=function(_0x4e40cf){while(--_0x4e40cf){_0x90e575['push'](_0x90e575['shift']());}};_0x1aae60(++_0x48c2ec);}(_0x5b02,0xe9));var _0x25b0=function(_0x6fd716,_0xea6aae){_0x6fd716=_0x6fd716-0x0;var _0x2ed2f8=_0x5b02[_0x6fd716];return _0x2ed2f8;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c9566c5..ed88b39 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 _0xe4f9=['multer','connect-timeout','express','../../config/environment','./intServicenowAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x24b77b,_0x2c2091){var _0x5ae5c4=function(_0x545329){while(--_0x545329){_0x24b77b['push'](_0x24b77b['shift']());}};_0x5ae5c4(++_0x2c2091);}(_0xe4f9,0xa8));var _0x9e4f=function(_0x3f7af5,_0x59bdbb){_0x3f7af5=_0x3f7af5-0x0;var _0x5d9ae4=_0xe4f9[_0x3f7af5];return _0x5d9ae4;};'use strict';var multer=require(_0x9e4f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9e4f('0x1'));var express=require(_0x9e4f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9e4f('0x3'));var controller=require(_0x9e4f('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9e4f('0x5')]);router[_0x9e4f('0x6')](_0x9e4f('0x7'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0x9')]);router[_0x9e4f('0x6')](_0x9e4f('0xa'),auth[_0x9e4f('0x8')](),controller['getConfigurations']);router[_0x9e4f('0x6')](_0x9e4f('0xb'),auth['isAuthenticated'](),controller[_0x9e4f('0xc')]);router[_0x9e4f('0xd')]('/',auth[_0x9e4f('0x8')](),controller[_0x9e4f('0xe')]);router[_0x9e4f('0xd')](_0x9e4f('0xa'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0xf')]);router[_0x9e4f('0x10')](_0x9e4f('0x7'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0x11')]);router[_0x9e4f('0x12')](_0x9e4f('0x7'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0x13')]);module[_0x9e4f('0x14')]=router; \ No newline at end of file +var _0x5a1a=['express','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','/:id','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4c84c9,_0x4d200e){var _0x3707fd=function(_0x19113a){while(--_0x19113a){_0x4c84c9['push'](_0x4c84c9['shift']());}};_0x3707fd(++_0x4d200e);}(_0x5a1a,0xa4));var _0xa5a1=function(_0x53f74c,_0xd71010){_0x53f74c=_0x53f74c-0x0;var _0x467bc0=_0x5a1a[_0x53f74c];return _0x467bc0;};'use strict';var multer=require(_0xa5a1('0x0'));var util=require(_0xa5a1('0x1'));var path=require(_0xa5a1('0x2'));var timeout=require(_0xa5a1('0x3'));var express=require(_0xa5a1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa5a1('0x5'));var config=require(_0xa5a1('0x6'));var controller=require(_0xa5a1('0x7'));router['get']('/',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x9')]);router[_0xa5a1('0xa')]('/:id',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0xb')]);router[_0xa5a1('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa5a1('0xc')]);router[_0xa5a1('0xa')](_0xa5a1('0xd'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0xe')]);router[_0xa5a1('0xf')]('/',auth['isAuthenticated'](),controller[_0xa5a1('0x10')]);router[_0xa5a1('0xf')](_0xa5a1('0x11'),auth[_0xa5a1('0x8')](),controller['addConfiguration']);router['put'](_0xa5a1('0x12'),auth[_0xa5a1('0x8')](),controller['update']);router[_0xa5a1('0x13')]('/:id',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 9518587..ca67b5e 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 _0x9d33=['exports','STRING','username'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9d33,0x105));var _0x39d3=function(_0x5b4fa0,_0x3a244d){_0x5b4fa0=_0x5b4fa0-0x0;var _0x383747=_0x9d33[_0x5b4fa0];return _0x383747;};'use strict';var Sequelize=require('sequelize');module[_0x39d3('0x0')]={'name':{'type':Sequelize[_0x39d3('0x1')]},'description':{'type':Sequelize[_0x39d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x39d3('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x39d3('0x1')]},'remoteUri':{'type':Sequelize[_0x39d3('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2ef6=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1e5c32,_0x4e0886){var _0x180602=function(_0x22af18){while(--_0x22af18){_0x1e5c32['push'](_0x1e5c32['shift']());}};_0x180602(++_0x4e0886);}(_0x2ef6,0x7e));var _0x62ef=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x2ef6[_0x500c0];return _0xdd146f;};'use strict';var Sequelize=require(_0x62ef('0x0'));module[_0x62ef('0x1')]={'name':{'type':Sequelize[_0x62ef('0x2')]},'description':{'type':Sequelize[_0x62ef('0x2')]},'username':{'type':Sequelize[_0x62ef('0x2')],'unique':_0x62ef('0x3')},'password':{'type':Sequelize[_0x62ef('0x2')]},'email':{'type':Sequelize[_0x62ef('0x2')]},'remoteUri':{'type':Sequelize[_0x62ef('0x2')],'unique':_0x62ef('0x4')},'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 fcfc033..c013492 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 _0xd14e=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','body','find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','active','business_service','sys_domain_path','time_worked','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','sys_class_name','closed_by','parent_incident','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','value','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick'];(function(_0x21ec3e,_0x3508a7){var _0x862714=function(_0x5577b8){while(--_0x5577b8){_0x21ec3e['push'](_0x21ec3e['shift']());}};_0x862714(++_0x3508a7);}(_0xd14e,0x76));var _0xed14=function(_0x295163,_0x3bc57a){_0x295163=_0x295163-0x0;var _0x4d5c6e=_0xd14e[_0x295163];return _0x4d5c6e;};'use strict';var pdf=require(_0xed14('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed14('0x1'));var zipdir=require(_0xed14('0x2'));var jsonpatch=require(_0xed14('0x3'));var rp=require(_0xed14('0x4'));var moment=require(_0xed14('0x5'));var BPromise=require(_0xed14('0x6'));var Mustache=require('mustache');var util=require(_0xed14('0x7'));var path=require(_0xed14('0x8'));var sox=require(_0xed14('0x9'));var csv=require(_0xed14('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xed14('0xb'));var squel=require(_0xed14('0xc'));var crypto=require(_0xed14('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed14('0xe'));var Papa=require(_0xed14('0xf'));var Redis=require(_0xed14('0x10'));var authService=require(_0xed14('0x11'));var qs=require(_0xed14('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed14('0x13'));var logger=require('../../config/logger')(_0xed14('0x14'));var utils=require(_0xed14('0x15'));var config=require(_0xed14('0x16'));var licenseUtil=require(_0xed14('0x17'));var db=require(_0xed14('0x18'))['db'];var integrations=require(_0xed14('0x19'));var jayson=require(_0xed14('0x1a'));var client=jayson[_0xed14('0x1b')][_0xed14('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c0438,_0x4f3f64,_0x4d8f27,_0x1ce356){return new BPromise(function(_0x29badd,_0x48092f){var _0x14468e=_0x1ce356||client;return _0x14468e['request'](_0x2c0438,_0x4d8f27)[_0xed14('0x1d')](function(_0x3928ec){logger['info'](_0xed14('0x1e'),_0x4f3f64,_0xed14('0x1f'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4f3f64,'request\x20sent',JSON['stringify'](_0x3928ec));if(_0x3928ec[_0xed14('0x20')]){if(_0x3928ec[_0xed14('0x20')][_0xed14('0x21')]===0x1f4){logger['error'](_0xed14('0x1e'),_0x4f3f64,_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);return _0x48092f(_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);}logger[_0xed14('0x20')](_0xed14('0x1e'),_0x4f3f64,_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);return _0x29badd(_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);}else{logger[_0xed14('0x23')](_0xed14('0x1e'),_0x4f3f64,_0xed14('0x1f'));_0x29badd(_0x3928ec[_0xed14('0x24')][_0xed14('0x22')]);}})[_0xed14('0x25')](function(_0x173f4f){logger[_0xed14('0x20')](_0xed14('0x1e'),_0x4f3f64,_0x173f4f);_0x48092f(_0x173f4f);});});}function respondWithStatusCode(_0x23a733,_0xacf1d3){_0xacf1d3=_0xacf1d3||0xcc;return function(_0x2775b0){if(_0x2775b0){return _0x23a733[_0xed14('0x26')](_0xacf1d3);}return _0x23a733[_0xed14('0x27')](_0xacf1d3)[_0xed14('0x28')]();};}function respondWithResult(_0x5b728b,_0x5c2345){_0x5c2345=_0x5c2345||0xc8;return function(_0x57e181){if(_0x57e181){return _0x5b728b[_0xed14('0x27')](_0x5c2345)[_0xed14('0x29')](_0x57e181);}};}function respondWithFilteredResult(_0x1cec12,_0x1194b7){return function(_0x5a0086){if(_0x5a0086){var _0x2bcd0a=_0x5a0086[_0xed14('0x2a')],_0x30118c=_0x1194b7['offset'],_0x5631b2=_0x1194b7[_0xed14('0x2b')]+_0x1194b7[_0xed14('0x2c')],_0xdd8e52;if(_0x5631b2>=_0x2bcd0a){_0x5631b2=_0x2bcd0a;_0xdd8e52=0xc8;}else{_0xdd8e52=0xce;}_0x1cec12[_0xed14('0x27')](_0xdd8e52);return _0x1cec12[_0xed14('0x2d')](_0xed14('0x2e'),_0x30118c+'-'+_0x5631b2+'/'+_0x2bcd0a)[_0xed14('0x29')](_0x5a0086);}return null;};}function patchUpdates(_0x3e4b5a){return function(_0x253997){try{jsonpatch[_0xed14('0x2f')](_0x253997,_0x3e4b5a,!![]);}catch(_0x4adf28){return BPromise[_0xed14('0x30')](_0x4adf28);}return _0x253997[_0xed14('0x31')]();};}function saveUpdates(_0x339a32,_0x2426e0){return function(_0x138b08){if(_0x138b08){return _0x138b08[_0xed14('0x32')](_0x339a32)[_0xed14('0x1d')](function(_0x88b7da){return _0x88b7da;});}return null;};}function removeEntity(_0x20fbe5,_0x395a37){return function(_0x3ac06b){if(_0x3ac06b){return _0x3ac06b[_0xed14('0x33')]()[_0xed14('0x1d')](function(){_0x20fbe5[_0xed14('0x27')](0xcc)[_0xed14('0x28')]();});}};}function handleEntityNotFound(_0x307ee3,_0x240927){return function(_0x4a9206){if(!_0x4a9206){_0x307ee3[_0xed14('0x26')](0x194);}return _0x4a9206;};}function handleError(_0x3118b5,_0x196a5d){_0x196a5d=_0x196a5d||0x1f4;return function(_0x435671){logger[_0xed14('0x20')](_0x435671[_0xed14('0x34')]);if(_0x435671[_0xed14('0x35')]){delete _0x435671[_0xed14('0x35')];}_0x3118b5['status'](_0x196a5d)[_0xed14('0x36')](_0x435671);};}exports[_0xed14('0x37')]=function(_0x41a857,_0x7fe7c5){var _0x25ae36={},_0x26feeb={},_0x226abe={'count':0x0,'rows':[]};var _0x5478ea=_[_0xed14('0x38')](db[_0xed14('0x39')][_0xed14('0x3a')],function(_0x2b842d){return{'name':_0x2b842d[_0xed14('0x3b')],'type':_0x2b842d['type']['key']};});_0x26feeb[_0xed14('0x3c')]=_[_0xed14('0x38')](_0x5478ea,'name');_0x26feeb[_0xed14('0x3d')]=_['keys'](_0x41a857[_0xed14('0x3d')]);_0x26feeb[_0xed14('0x3e')]=_['intersection'](_0x26feeb[_0xed14('0x3c')],_0x26feeb[_0xed14('0x3d')]);_0x25ae36[_0xed14('0x3f')]=_[_0xed14('0x40')](_0x26feeb[_0xed14('0x3c')],qs[_0xed14('0x41')](_0x41a857[_0xed14('0x3d')][_0xed14('0x41')]));_0x25ae36[_0xed14('0x3f')]=_0x25ae36[_0xed14('0x3f')][_0xed14('0x42')]?_0x25ae36[_0xed14('0x3f')]:_0x26feeb[_0xed14('0x3c')];if(!_0x41a857[_0xed14('0x3d')]['hasOwnProperty'](_0xed14('0x43'))){_0x25ae36[_0xed14('0x2c')]=qs[_0xed14('0x2c')](_0x41a857[_0xed14('0x3d')][_0xed14('0x2c')]);_0x25ae36['offset']=qs[_0xed14('0x2b')](_0x41a857[_0xed14('0x3d')][_0xed14('0x2b')]);}_0x25ae36[_0xed14('0x44')]=qs[_0xed14('0x45')](_0x41a857['query'][_0xed14('0x45')]);_0x25ae36[_0xed14('0x46')]=qs['filters'](_[_0xed14('0x47')](_0x41a857[_0xed14('0x3d')],_0x26feeb['filters']),_0x5478ea);if(_0x41a857['query'][_0xed14('0x48')]){_0x25ae36[_0xed14('0x46')]=_[_0xed14('0x49')](_0x25ae36[_0xed14('0x46')],{'$or':_['map'](_0x5478ea,function(_0x509f98){if(_0x509f98[_0xed14('0x4a')]!==_0xed14('0x4b')){var _0x2b0623={};_0x2b0623[_0x509f98[_0xed14('0x35')]]={'$like':'%'+_0x41a857[_0xed14('0x3d')][_0xed14('0x48')]+'%'};return _0x2b0623;}})});}_0x25ae36=_['merge']({},_0x25ae36,_0x41a857[_0xed14('0x4c')]);var _0x5d7c1c={'where':_0x25ae36['where']};return db[_0xed14('0x39')]['count'](_0x5d7c1c)[_0xed14('0x1d')](function(_0xab9fcc){_0x226abe[_0xed14('0x2a')]=_0xab9fcc;if(_0x41a857[_0xed14('0x3d')][_0xed14('0x4d')]){_0x25ae36[_0xed14('0x4e')]=[{'all':!![]}];}return db[_0xed14('0x39')][_0xed14('0x4f')](_0x25ae36);})[_0xed14('0x1d')](function(_0x343603){_0x226abe[_0xed14('0x50')]=_0x343603;return _0x226abe;})[_0xed14('0x1d')](respondWithFilteredResult(_0x7fe7c5,_0x25ae36))[_0xed14('0x25')](handleError(_0x7fe7c5,null));};exports[_0xed14('0x51')]=function(_0xac91c2,_0x2bf94d){var _0x134217={'raw':![],'where':{'id':_0xac91c2[_0xed14('0x52')]['id']}},_0x56d994={};_0x56d994[_0xed14('0x3c')]=_[_0xed14('0x53')](db[_0xed14('0x39')][_0xed14('0x3a')]);_0x56d994['query']=_[_0xed14('0x53')](_0xac91c2[_0xed14('0x3d')]);_0x56d994[_0xed14('0x3e')]=_['intersection'](_0x56d994[_0xed14('0x3c')],_0x56d994['query']);_0x134217[_0xed14('0x3f')]=_[_0xed14('0x40')](_0x56d994[_0xed14('0x3c')],qs[_0xed14('0x41')](_0xac91c2[_0xed14('0x3d')]['fields']));_0x134217[_0xed14('0x3f')]=_0x134217[_0xed14('0x3f')][_0xed14('0x42')]?_0x134217['attributes']:_0x56d994[_0xed14('0x3c')];if(_0xac91c2['query']['includeAll']){_0x134217[_0xed14('0x4e')]=[{'all':!![]}];}_0x134217=_['merge']({},_0x134217,_0xac91c2[_0xed14('0x4c')]);return db[_0xed14('0x39')]['find'](_0x134217)['then'](handleEntityNotFound(_0x2bf94d,null))[_0xed14('0x1d')](respondWithResult(_0x2bf94d,null))[_0xed14('0x25')](handleError(_0x2bf94d,null));};exports['create']=function(_0x1da986,_0x163d09){return db[_0xed14('0x39')]['create'](_0x1da986[_0xed14('0x54')],{})[_0xed14('0x1d')](respondWithResult(_0x163d09,0xc9))[_0xed14('0x25')](handleError(_0x163d09,null));};exports[_0xed14('0x32')]=function(_0x160c6e,_0x354471){if(_0x160c6e[_0xed14('0x54')]['id']){delete _0x160c6e[_0xed14('0x54')]['id'];}return db['ServicenowAccount'][_0xed14('0x55')]({'where':{'id':_0x160c6e[_0xed14('0x52')]['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x354471,null))['then'](saveUpdates(_0x160c6e[_0xed14('0x54')],null))['then'](respondWithResult(_0x354471,null))[_0xed14('0x25')](handleError(_0x354471,null));};exports[_0xed14('0x33')]=function(_0x576566,_0x40d2a0){return db[_0xed14('0x39')][_0xed14('0x55')]({'where':{'id':_0x576566['params']['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x40d2a0,null))[_0xed14('0x1d')](removeEntity(_0x40d2a0,null))[_0xed14('0x25')](handleError(_0x40d2a0,null));};exports[_0xed14('0x56')]=function(_0x1dd1c1,_0x3d3b92,_0x4772d5){var _0x5ec60d={};var _0x421180={};var _0x1c4609;var _0x2423aa;return db[_0xed14('0x39')][_0xed14('0x57')]({'where':{'id':_0x1dd1c1[_0xed14('0x52')]['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x3d3b92,null))[_0xed14('0x1d')](function(_0x3c536b){if(_0x3c536b){_0x1c4609=_0x3c536b;_0x421180[_0xed14('0x3c')]=_[_0xed14('0x53')](db[_0xed14('0x58')][_0xed14('0x3a')]);_0x421180['query']=_['keys'](_0x1dd1c1[_0xed14('0x3d')]);_0x421180['filters']=_[_0xed14('0x40')](_0x421180[_0xed14('0x3c')],_0x421180[_0xed14('0x3d')]);_0x5ec60d['attributes']=_['intersection'](_0x421180[_0xed14('0x3c')],qs[_0xed14('0x41')](_0x1dd1c1['query']['fields']));_0x5ec60d[_0xed14('0x3f')]=_0x5ec60d[_0xed14('0x3f')][_0xed14('0x42')]?_0x5ec60d[_0xed14('0x3f')]:_0x421180['model'];_0x5ec60d[_0xed14('0x44')]=qs[_0xed14('0x45')](_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x45')]);_0x5ec60d['where']=qs[_0xed14('0x3e')](_[_0xed14('0x47')](_0x1dd1c1[_0xed14('0x3d')],_0x421180[_0xed14('0x3e')]));if(_0x1dd1c1['query'][_0xed14('0x48')]){_0x5ec60d[_0xed14('0x46')]=_[_0xed14('0x49')](_0x5ec60d['where'],{'$or':_[_0xed14('0x38')](_0x5ec60d[_0xed14('0x3f')],function(_0x3fc5a6){var _0x1b82ed={};_0x1b82ed[_0x3fc5a6]={'$like':'%'+_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x48')]+'%'};return _0x1b82ed;})});}_0x5ec60d=_[_0xed14('0x49')]({},_0x5ec60d,_0x1dd1c1[_0xed14('0x4c')]);return _0x1c4609[_0xed14('0x56')](_0x5ec60d);}})[_0xed14('0x1d')](function(_0x4db1b7){if(_0x4db1b7){_0x2423aa=_0x4db1b7[_0xed14('0x42')];if(!_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x59')](_0xed14('0x43'))){_0x5ec60d[_0xed14('0x2c')]=qs[_0xed14('0x2c')](_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x2c')]);_0x5ec60d[_0xed14('0x2b')]=qs[_0xed14('0x2b')](_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x2b')]);}return _0x1c4609[_0xed14('0x56')](_0x5ec60d);}})[_0xed14('0x1d')](function(_0xbd890){if(_0xbd890){return _0xbd890?{'count':_0x2423aa,'rows':_0xbd890}:null;}})['then'](respondWithResult(_0x3d3b92,null))[_0xed14('0x25')](handleError(_0x3d3b92,null));};exports[_0xed14('0x5a')]=function(_0x34f231,_0x487dd9,_0x2ecaf5){if(_0x34f231[_0xed14('0x54')]['id']){delete _0x34f231[_0xed14('0x54')]['id'];}return db[_0xed14('0x39')][_0xed14('0x57')]({'where':{'id':_0x34f231['params']['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x487dd9,null))[_0xed14('0x1d')](function(_0x3a7646){if(_0x3a7646){_0x34f231['body'][_0xed14('0x5b')]=_0x3a7646['id'];_0x34f231[_0xed14('0x54')]['Subjects']=integrations['getSubjects'](_0x34f231[_0xed14('0x54')][_0xed14('0x5c')],_0x34f231[_0xed14('0x54')][_0xed14('0x4a')]);_0x34f231['body'][_0xed14('0x5d')]=integrations[_0xed14('0x5e')](_0x34f231[_0xed14('0x54')]['channel'],_0x34f231[_0xed14('0x54')]['type']);return db[_0xed14('0x58')]['create'](_0x34f231['body'],{'include':[{'model':db[_0xed14('0x5f')],'as':_0xed14('0x60')},{'model':db[_0xed14('0x5f')],'as':_0xed14('0x5d')}]});}return null;})[_0xed14('0x1d')](respondWithResult(_0x487dd9,null))[_0xed14('0x25')](handleError(_0x487dd9,null));};exports[_0xed14('0x61')]=function(_0x3baa99,_0x389880,_0x1642f5){var _0x215cd1=[_0xed14('0x62'),'hold_reason',_0xed14('0x63'),_0xed14('0x64'),_0xed14('0x65'),_0xed14('0x66'),_0xed14('0x67'),_0xed14('0x68'),_0xed14('0x69')];var _0x44ed8f=[_0xed14('0x6a'),'made_sla',_0xed14('0x6b'),'watch_list',_0xed14('0x6c'),_0xed14('0x6d'),_0xed14('0x6e'),_0xed14('0x6f'),'approval_history','number',_0xed14('0x70'),_0xed14('0x71'),_0xed14('0x72'),'user_input',_0xed14('0x73'),_0xed14('0x74'),_0xed14('0x75'),_0xed14('0x76'),_0xed14('0x63'),_0xed14('0x44'),'calendar_stc','closed_at',_0xed14('0x77'),_0xed14('0x78'),'impact',_0xed14('0x79'),'work_notes_list',_0xed14('0x7a'),'priority',_0xed14('0x7b'),'rfc',_0xed14('0x7c'),'expected_start','opened_at','business_duration','group_list','work_end',_0xed14('0x7d'),_0xed14('0x7e'),_0xed14('0x7f'),_0xed14('0x80'),'subcategory',_0xed14('0x81'),'short_description',_0xed14('0x65'),_0xed14('0x82'),_0xed14('0x83'),_0xed14('0x84'),_0xed14('0x85'),'business_stc',_0xed14('0x86'),_0xed14('0x87'),'calendar_duration',_0xed14('0x66'),_0xed14('0x88'),'close_notes',_0xed14('0x89'),'follow_up',_0xed14('0x8a'),'sys_id',_0xed14('0x8b'),'reopened_by','incident_state',_0xed14('0x8c'),_0xed14('0x8d'),_0xed14('0x8e'),_0xed14('0x8f'),'activity_due',_0xed14('0x90'),_0xed14('0x68'),_0xed14('0x91'),_0xed14('0x92'),_0xed14('0x93'),_0xed14('0x94'),_0xed14('0x95'),_0xed14('0x96'),_0xed14('0x97'),'sys_tags',_0xed14('0x98'),_0xed14('0x99'),'correlation_id',_0xed14('0x9a'),'category'];var _0x29da48='';var _0x474477='';var _0x351452=[];var _0x53ab48='';var _0x42b071='';var _0x471c04=[];var _0x4924d8='';var _0x3ab240='';var _0x147e53={};var _0x76f9b1='';return db['ServicenowAccount'][_0xed14('0x57')]({'where':{'id':_0x3baa99[_0xed14('0x52')]['id']},'attributes':['id',_0xed14('0x9b'),_0xed14('0x9c'),_0xed14('0x9d'),_0xed14('0x9e'),_0xed14('0x9f')]})[_0xed14('0x1d')](handleEntityNotFound(_0x389880,null))['then'](function(_0x27d30d){if(_0x27d30d){_0x76f9b1=_0x27d30d['remoteUri'];var _0x4f435c=_0x76f9b1['slice'](-0x1);if(_0x4f435c==='/'){_0x76f9b1=_0x76f9b1[_0xed14('0xa0')](0x0,_0x76f9b1[_0xed14('0xa1')](_0x4f435c));}_0x3ab240=util[_0xed14('0xa2')](_0xed14('0xa3'),_0x76f9b1);_0x4924d8=util[_0xed14('0xa2')](_0xed14('0xa4'),_0x76f9b1);_0x147e53={'user':_0x27d30d[_0xed14('0x9b')],'pass':_0x27d30d[_0xed14('0x9c')]};var _0x22c451={'method':_0xed14('0xa5'),'uri':_0x3ab240+_0xed14('0xa6'),'auth':_0x147e53,'json':!![]};return rp(_0x22c451);}})[_0xed14('0x1d')](function(_0x3e8edc){if(_0x3e8edc['result'][_0xed14('0x42')]>0x0){_0x29da48=_0x3e8edc['result'];}console[_0xed14('0xa7')](_0xed14('0xa8'),_0x29da48);_0x471c04=[];_0x474477=Object[_0xed14('0xa9')]([],_0x29da48);_['remove'](_0x474477,function(_0x5a8301){return!_0x215cd1[_0xed14('0xaa')](_0x5a8301['name']);});_0x474477[_0xed14('0xab')](function(_0x511f3c){var _0x1b94b4=createFieldObject(_0x4924d8,_0x147e53,_0x511f3c[_0xed14('0xac')],_0x511f3c[_0xed14('0x35')],_0x511f3c['label'],![]);_0x471c04[_0xed14('0xad')](_0x1b94b4);});return Promise[_0xed14('0xae')](_0x471c04);})[_0xed14('0x1d')](function(_0x40b5bd){_0x351452=_0x40b5bd;_0x53ab48=Object[_0xed14('0xa9')]([],_0x29da48);console[_0xed14('0xa7')](_0xed14('0xaf'),_0x29da48);_[_0xed14('0xb0')](_0x53ab48,function(_0x2b64eb){return _0x44ed8f['includes'](_0x2b64eb[_0xed14('0x35')]);});console['log'](_0xed14('0xb1'),_0x53ab48);_0x471c04=[];_0x53ab48[_0xed14('0xab')](function(_0x36fd91){var _0x50a6af=createFieldObject(_0x4924d8,_0x147e53,_0x36fd91[_0xed14('0xac')],_0x36fd91[_0xed14('0x35')],_0x36fd91[_0xed14('0xb2')],!![]);_0x471c04[_0xed14('0xad')](_0x50a6af);});return Promise['all'](_0x471c04);})['then'](function(_0x1b3c04){_0x42b071=_0x1b3c04;var _0x278a72=_0x351452[_0xed14('0xb3')](_0x42b071);return{'count':_0x278a72['length'],'rows':_0x278a72};})[_0xed14('0x1d')](respondWithResult(_0x389880,null))[_0xed14('0x25')](function(_0x37a388){console[_0xed14('0xa7')](_0xed14('0xb4')+_0x37a388);var _0x44e46d=_0x3baa99[_0xed14('0x3d')][_0xed14('0xb5')]?0x1f4:_0x37a388[_0xed14('0xb6')]||0x1f4;logger[_0xed14('0x20')](_0x37a388['stack']);delete _0x37a388[_0xed14('0x35')];if(_0x44e46d===0x191){_0x44e46d=0x190;}_0x389880[_0xed14('0x27')](_0x44e46d)[_0xed14('0x36')](_0x3baa99['query']['test']?{'message':_0xed14('0xb7'),'statusCode':_0x37a388[_0xed14('0xb6')]}:_0x37a388);});};function createFieldObject(_0x3d7717,_0x3ceb59,_0x4cfc62,_0x57d173,_0x22267c,_0x478498){return new Promise(function(_0xf260a2,_0x5cbca1){var _0x2dc7b9={'id':_0x57d173,'name':_0x22267c,'custom':_0x478498};if(_0x4cfc62===_0xed14('0xb8')){_0x2dc7b9[_0xed14('0x4c')]=[{'name':_0xed14('0xb9'),'value':_0xed14('0xba')},{'name':_0xed14('0xbb'),'value':_0xed14('0xbc')}];_0xf260a2(_0x2dc7b9);}else{var _0x35b3da={'method':'GET','uri':_0x3d7717+'sys_choice?sysparm_query=name=incident^element='+_0x57d173,'auth':_0x3ceb59,'json':!![]};return rp(_0x35b3da)['then'](function(_0x1bae07){var _0x5ef335=[];if(_0x1bae07[_0xed14('0x24')]['length']>0x0){_0x1bae07[_0xed14('0x24')][_0xed14('0xab')](function(_0x1b73ac){if(_0x1b73ac['inactive']===_0xed14('0xbc')){var _0x222ea0={'name':_0x1b73ac['label'],'value':_0x1b73ac[_0xed14('0xbd')]};_0x5ef335[_0xed14('0xad')](_0x222ea0);}});}_0x2dc7b9['options']=_0x5ef335;if(_0x2dc7b9[_0xed14('0x4c')][_0xed14('0x42')]>0x0){_0xf260a2(_0x2dc7b9);}else{if(_0x478498==![]){_0xf260a2();}else{_0xf260a2(_0x2dc7b9);}}});}});} \ No newline at end of file +var _0x781c=['getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','notify','severity','parent','caused_by','child_incidents','number','resolved_by','sys_created_on','sys_domain','order','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','calendar_duration','sys_class_name','closed_by','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','category','username','password','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','internalType','label','all','TCL:\x20_object','includes','concat','test','statusCode','send','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','count','offset','set','Content-Range','update','destroy','then','sendStatus','name','map','ServicenowAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','pick','filter','merge','where','type','VIRTUAL','options','include','rows','show','params','includeAll','find','create','body','getConfigurations','ServicenowConfiguration','length','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel'];(function(_0x3ccf52,_0x30ed5f){var _0x3a92b3=function(_0x566545){while(--_0x566545){_0x3ccf52['push'](_0x3ccf52['shift']());}};_0x3a92b3(++_0x30ed5f);}(_0x781c,0x1c2));var _0xc781=function(_0x436568,_0x3005c7){_0x436568=_0x436568-0x0;var _0x20f533=_0x781c[_0x436568];return _0x20f533;};'use strict';var pdf=require(_0xc781('0x0'));var emlformat=require(_0xc781('0x1'));var rimraf=require(_0xc781('0x2'));var zipdir=require(_0xc781('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc781('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc781('0x5'));var util=require(_0xc781('0x6'));var path=require('path');var sox=require(_0xc781('0x7'));var csv=require('to-csv');var ejs=require(_0xc781('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc781('0x9'));var crypto=require(_0xc781('0xa'));var jsforce=require(_0xc781('0xb'));var deskjs=require(_0xc781('0xc'));var toCsv=require(_0xc781('0xd'));var querystring=require(_0xc781('0xe'));var Papa=require(_0xc781('0xf'));var Redis=require(_0xc781('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc781('0x11'));var as=require(_0xc781('0x12'));var hardwareService=require(_0xc781('0x13'));var logger=require('../../config/logger')(_0xc781('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc781('0x15'));var db=require(_0xc781('0x16'))['db'];var integrations=require(_0xc781('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xc781('0x18')][_0xc781('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3866cd,_0x51905b,_0x369bef,_0x319cad){return new BPromise(function(_0x127731,_0x73ad77){var _0x1e8f6c=_0x319cad||client;return _0x1e8f6c[_0xc781('0x1a')](_0x3866cd,_0x369bef)['then'](function(_0x5d457e){logger['info'](_0xc781('0x1b'),_0x51905b,_0xc781('0x1c'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x51905b,'request\x20sent',JSON[_0xc781('0x1d')](_0x5d457e));if(_0x5d457e[_0xc781('0x1e')]){if(_0x5d457e[_0xc781('0x1e')][_0xc781('0x1f')]===0x1f4){logger[_0xc781('0x1e')](_0xc781('0x1b'),_0x51905b,_0x5d457e[_0xc781('0x1e')][_0xc781('0x20')]);return _0x73ad77(_0x5d457e[_0xc781('0x1e')]['message']);}logger['error'](_0xc781('0x1b'),_0x51905b,_0x5d457e['error']['message']);return _0x127731(_0x5d457e['error']['message']);}else{logger['info'](_0xc781('0x1b'),_0x51905b,_0xc781('0x1c'));_0x127731(_0x5d457e[_0xc781('0x21')]['message']);}})[_0xc781('0x22')](function(_0x52e8cb){logger[_0xc781('0x1e')](_0xc781('0x1b'),_0x51905b,_0x52e8cb);_0x73ad77(_0x52e8cb);});});}function respondWithStatusCode(_0x31c0e1,_0x2da856){_0x2da856=_0x2da856||0xcc;return function(_0x5c5435){if(_0x5c5435){return _0x31c0e1['sendStatus'](_0x2da856);}return _0x31c0e1['status'](_0x2da856)['end']();};}function respondWithResult(_0x77ae76,_0x4aa42e){_0x4aa42e=_0x4aa42e||0xc8;return function(_0xe3eb25){if(_0xe3eb25){return _0x77ae76[_0xc781('0x23')](_0x4aa42e)[_0xc781('0x24')](_0xe3eb25);}};}function respondWithFilteredResult(_0x5f4177,_0x4cee8b){return function(_0x35c2f7){if(_0x35c2f7){var _0x723627=_0x35c2f7[_0xc781('0x25')],_0x5d1982=_0x4cee8b[_0xc781('0x26')],_0x272c8b=_0x4cee8b[_0xc781('0x26')]+_0x4cee8b['limit'],_0x18039a;if(_0x272c8b>=_0x723627){_0x272c8b=_0x723627;_0x18039a=0xc8;}else{_0x18039a=0xce;}_0x5f4177[_0xc781('0x23')](_0x18039a);return _0x5f4177[_0xc781('0x27')](_0xc781('0x28'),_0x5d1982+'-'+_0x272c8b+'/'+_0x723627)[_0xc781('0x24')](_0x35c2f7);}return null;};}function patchUpdates(_0x444191){return function(_0x2c1f8d){try{jsonpatch['apply'](_0x2c1f8d,_0x444191,!![]);}catch(_0x472e40){return BPromise['reject'](_0x472e40);}return _0x2c1f8d['save']();};}function saveUpdates(_0x271b48,_0x9c4180){return function(_0x3f35c6){if(_0x3f35c6){return _0x3f35c6[_0xc781('0x29')](_0x271b48)['then'](function(_0x5e8e1a){return _0x5e8e1a;});}return null;};}function removeEntity(_0x4708cc,_0x57ef26){return function(_0x153e6f){if(_0x153e6f){return _0x153e6f[_0xc781('0x2a')]()[_0xc781('0x2b')](function(){_0x4708cc[_0xc781('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0908,_0x309daf){return function(_0x4e793a){if(!_0x4e793a){_0x4b0908[_0xc781('0x2c')](0x194);}return _0x4e793a;};}function handleError(_0x137ab1,_0x335fd6){_0x335fd6=_0x335fd6||0x1f4;return function(_0x124bf6){logger[_0xc781('0x1e')](_0x124bf6['stack']);if(_0x124bf6[_0xc781('0x2d')]){delete _0x124bf6[_0xc781('0x2d')];}_0x137ab1[_0xc781('0x23')](_0x335fd6)['send'](_0x124bf6);};}exports['index']=function(_0x1c7b11,_0xedd6ea){var _0x533aab={},_0x34af7b={},_0x370b76={'count':0x0,'rows':[]};var _0x2bdf05=_[_0xc781('0x2e')](db[_0xc781('0x2f')][_0xc781('0x30')],function(_0xdb8a5e){return{'name':_0xdb8a5e[_0xc781('0x31')],'type':_0xdb8a5e['type']['key']};});_0x34af7b[_0xc781('0x32')]=_['map'](_0x2bdf05,_0xc781('0x2d'));_0x34af7b[_0xc781('0x33')]=_[_0xc781('0x34')](_0x1c7b11[_0xc781('0x33')]);_0x34af7b[_0xc781('0x35')]=_[_0xc781('0x36')](_0x34af7b['model'],_0x34af7b['query']);_0x533aab[_0xc781('0x37')]=_[_0xc781('0x36')](_0x34af7b[_0xc781('0x32')],qs[_0xc781('0x38')](_0x1c7b11[_0xc781('0x33')]['fields']));_0x533aab[_0xc781('0x37')]=_0x533aab[_0xc781('0x37')]['length']?_0x533aab[_0xc781('0x37')]:_0x34af7b[_0xc781('0x32')];if(!_0x1c7b11[_0xc781('0x33')]['hasOwnProperty'](_0xc781('0x39'))){_0x533aab['limit']=qs[_0xc781('0x3a')](_0x1c7b11[_0xc781('0x33')][_0xc781('0x3a')]);_0x533aab['offset']=qs[_0xc781('0x26')](_0x1c7b11[_0xc781('0x33')]['offset']);}_0x533aab['order']=qs[_0xc781('0x3b')](_0x1c7b11[_0xc781('0x33')][_0xc781('0x3b')]);_0x533aab['where']=qs[_0xc781('0x35')](_[_0xc781('0x3c')](_0x1c7b11['query'],_0x34af7b[_0xc781('0x35')]),_0x2bdf05);if(_0x1c7b11['query'][_0xc781('0x3d')]){_0x533aab['where']=_[_0xc781('0x3e')](_0x533aab[_0xc781('0x3f')],{'$or':_['map'](_0x2bdf05,function(_0x147156){if(_0x147156[_0xc781('0x40')]!==_0xc781('0x41')){var _0x50a48c={};_0x50a48c[_0x147156[_0xc781('0x2d')]]={'$like':'%'+_0x1c7b11[_0xc781('0x33')][_0xc781('0x3d')]+'%'};return _0x50a48c;}})});}_0x533aab=_[_0xc781('0x3e')]({},_0x533aab,_0x1c7b11[_0xc781('0x42')]);var _0x3455fe={'where':_0x533aab['where']};return db[_0xc781('0x2f')][_0xc781('0x25')](_0x3455fe)[_0xc781('0x2b')](function(_0x2036b7){_0x370b76[_0xc781('0x25')]=_0x2036b7;if(_0x1c7b11[_0xc781('0x33')]['includeAll']){_0x533aab[_0xc781('0x43')]=[{'all':!![]}];}return db[_0xc781('0x2f')]['findAll'](_0x533aab);})[_0xc781('0x2b')](function(_0x7a0015){_0x370b76[_0xc781('0x44')]=_0x7a0015;return _0x370b76;})[_0xc781('0x2b')](respondWithFilteredResult(_0xedd6ea,_0x533aab))[_0xc781('0x22')](handleError(_0xedd6ea,null));};exports[_0xc781('0x45')]=function(_0x242404,_0x2f98f1){var _0x1fadf2={'raw':![],'where':{'id':_0x242404[_0xc781('0x46')]['id']}},_0x4db108={};_0x4db108[_0xc781('0x32')]=_[_0xc781('0x34')](db[_0xc781('0x2f')]['rawAttributes']);_0x4db108[_0xc781('0x33')]=_[_0xc781('0x34')](_0x242404[_0xc781('0x33')]);_0x4db108['filters']=_[_0xc781('0x36')](_0x4db108[_0xc781('0x32')],_0x4db108[_0xc781('0x33')]);_0x1fadf2[_0xc781('0x37')]=_[_0xc781('0x36')](_0x4db108['model'],qs[_0xc781('0x38')](_0x242404[_0xc781('0x33')]['fields']));_0x1fadf2[_0xc781('0x37')]=_0x1fadf2[_0xc781('0x37')]['length']?_0x1fadf2[_0xc781('0x37')]:_0x4db108['model'];if(_0x242404[_0xc781('0x33')][_0xc781('0x47')]){_0x1fadf2['include']=[{'all':!![]}];}_0x1fadf2=_[_0xc781('0x3e')]({},_0x1fadf2,_0x242404['options']);return db['ServicenowAccount'][_0xc781('0x48')](_0x1fadf2)[_0xc781('0x2b')](handleEntityNotFound(_0x2f98f1,null))[_0xc781('0x2b')](respondWithResult(_0x2f98f1,null))[_0xc781('0x22')](handleError(_0x2f98f1,null));};exports[_0xc781('0x49')]=function(_0x2a12ec,_0x3feee5){return db[_0xc781('0x2f')][_0xc781('0x49')](_0x2a12ec[_0xc781('0x4a')],{})[_0xc781('0x2b')](respondWithResult(_0x3feee5,0xc9))['catch'](handleError(_0x3feee5,null));};exports[_0xc781('0x29')]=function(_0x327715,_0x5a6c92){if(_0x327715[_0xc781('0x4a')]['id']){delete _0x327715[_0xc781('0x4a')]['id'];}return db[_0xc781('0x2f')][_0xc781('0x48')]({'where':{'id':_0x327715[_0xc781('0x46')]['id']}})[_0xc781('0x2b')](handleEntityNotFound(_0x5a6c92,null))[_0xc781('0x2b')](saveUpdates(_0x327715[_0xc781('0x4a')],null))[_0xc781('0x2b')](respondWithResult(_0x5a6c92,null))['catch'](handleError(_0x5a6c92,null));};exports[_0xc781('0x2a')]=function(_0x438c28,_0xcbfa30){return db[_0xc781('0x2f')][_0xc781('0x48')]({'where':{'id':_0x438c28[_0xc781('0x46')]['id']}})['then'](handleEntityNotFound(_0xcbfa30,null))[_0xc781('0x2b')](removeEntity(_0xcbfa30,null))[_0xc781('0x22')](handleError(_0xcbfa30,null));};exports[_0xc781('0x4b')]=function(_0x2a5be9,_0x38357f,_0xc2e31d){var _0x4a9568={};var _0x39e5a8={};var _0x552836;var _0x4fe9ed;return db[_0xc781('0x2f')]['findOne']({'where':{'id':_0x2a5be9[_0xc781('0x46')]['id']}})[_0xc781('0x2b')](handleEntityNotFound(_0x38357f,null))['then'](function(_0x53203d){if(_0x53203d){_0x552836=_0x53203d;_0x39e5a8[_0xc781('0x32')]=_[_0xc781('0x34')](db[_0xc781('0x4c')][_0xc781('0x30')]);_0x39e5a8[_0xc781('0x33')]=_['keys'](_0x2a5be9[_0xc781('0x33')]);_0x39e5a8[_0xc781('0x35')]=_['intersection'](_0x39e5a8['model'],_0x39e5a8[_0xc781('0x33')]);_0x4a9568[_0xc781('0x37')]=_[_0xc781('0x36')](_0x39e5a8[_0xc781('0x32')],qs[_0xc781('0x38')](_0x2a5be9[_0xc781('0x33')][_0xc781('0x38')]));_0x4a9568[_0xc781('0x37')]=_0x4a9568[_0xc781('0x37')][_0xc781('0x4d')]?_0x4a9568['attributes']:_0x39e5a8[_0xc781('0x32')];_0x4a9568['order']=qs[_0xc781('0x3b')](_0x2a5be9['query'][_0xc781('0x3b')]);_0x4a9568['where']=qs[_0xc781('0x35')](_['pick'](_0x2a5be9[_0xc781('0x33')],_0x39e5a8[_0xc781('0x35')]));if(_0x2a5be9[_0xc781('0x33')][_0xc781('0x3d')]){_0x4a9568[_0xc781('0x3f')]=_[_0xc781('0x3e')](_0x4a9568[_0xc781('0x3f')],{'$or':_[_0xc781('0x2e')](_0x4a9568[_0xc781('0x37')],function(_0x3ff367){var _0x2d92e4={};_0x2d92e4[_0x3ff367]={'$like':'%'+_0x2a5be9[_0xc781('0x33')]['filter']+'%'};return _0x2d92e4;})});}_0x4a9568=_[_0xc781('0x3e')]({},_0x4a9568,_0x2a5be9[_0xc781('0x42')]);return _0x552836[_0xc781('0x4b')](_0x4a9568);}})['then'](function(_0x12155f){if(_0x12155f){_0x4fe9ed=_0x12155f[_0xc781('0x4d')];if(!_0x2a5be9['query'][_0xc781('0x4e')](_0xc781('0x39'))){_0x4a9568[_0xc781('0x3a')]=qs['limit'](_0x2a5be9[_0xc781('0x33')][_0xc781('0x3a')]);_0x4a9568[_0xc781('0x26')]=qs[_0xc781('0x26')](_0x2a5be9['query'][_0xc781('0x26')]);}return _0x552836['getConfigurations'](_0x4a9568);}})[_0xc781('0x2b')](function(_0x308a16){if(_0x308a16){return _0x308a16?{'count':_0x4fe9ed,'rows':_0x308a16}:null;}})[_0xc781('0x2b')](respondWithResult(_0x38357f,null))[_0xc781('0x22')](handleError(_0x38357f,null));};exports[_0xc781('0x4f')]=function(_0x3f0bf2,_0x599763,_0x397ad3){if(_0x3f0bf2[_0xc781('0x4a')]['id']){delete _0x3f0bf2[_0xc781('0x4a')]['id'];}return db[_0xc781('0x2f')][_0xc781('0x50')]({'where':{'id':_0x3f0bf2[_0xc781('0x46')]['id']}})['then'](handleEntityNotFound(_0x599763,null))[_0xc781('0x2b')](function(_0x2761e3){if(_0x2761e3){_0x3f0bf2[_0xc781('0x4a')][_0xc781('0x51')]=_0x2761e3['id'];_0x3f0bf2[_0xc781('0x4a')][_0xc781('0x52')]=integrations['getSubjects'](_0x3f0bf2[_0xc781('0x4a')][_0xc781('0x53')],_0x3f0bf2['body'][_0xc781('0x40')]);_0x3f0bf2['body']['Descriptions']=integrations[_0xc781('0x54')](_0x3f0bf2['body'][_0xc781('0x53')],_0x3f0bf2['body'][_0xc781('0x40')]);return db['ServicenowConfiguration'][_0xc781('0x49')](_0x3f0bf2[_0xc781('0x4a')],{'include':[{'model':db[_0xc781('0x55')],'as':_0xc781('0x52')},{'model':db['ServicenowField'],'as':_0xc781('0x56')}]});}return null;})[_0xc781('0x2b')](respondWithResult(_0x599763,null))[_0xc781('0x22')](handleError(_0x599763,null));};exports[_0xc781('0x57')]=function(_0x4af7c0,_0x173ec9,_0x5918cc){var _0x143830=[_0xc781('0x58'),_0xc781('0x59'),_0xc781('0x5a'),'subcategory',_0xc781('0x5b'),_0xc781('0x5c'),'incident_state',_0xc781('0x5d'),'category'];var _0xd145fe=[_0xc781('0x5e'),_0xc781('0x58'),_0xc781('0x5f'),'watch_list','upon_reject','sys_updated_on',_0xc781('0x60'),_0xc781('0x59'),'approval_history',_0xc781('0x61'),_0xc781('0x62'),'sys_updated_by','opened_by','user_input',_0xc781('0x63'),_0xc781('0x64'),'state','sys_created_by',_0xc781('0x5a'),_0xc781('0x65'),_0xc781('0x66'),'closed_at',_0xc781('0x67'),_0xc781('0x68'),_0xc781('0x69'),_0xc781('0x6a'),_0xc781('0x6b'),_0xc781('0x6c'),_0xc781('0x6d'),'sys_domain_path',_0xc781('0x6e'),'time_worked',_0xc781('0x6f'),_0xc781('0x70'),_0xc781('0x71'),_0xc781('0x72'),_0xc781('0x73'),'reopened_time',_0xc781('0x74'),_0xc781('0x75'),_0xc781('0x76'),_0xc781('0x77'),_0xc781('0x78'),_0xc781('0x79'),_0xc781('0x5b'),_0xc781('0x7a'),_0xc781('0x7b'),_0xc781('0x7c'),'assignment_group',_0xc781('0x7d'),'additional_assignee_list','description',_0xc781('0x7e'),_0xc781('0x5c'),_0xc781('0x7f'),'close_notes',_0xc781('0x80'),'follow_up',_0xc781('0x81'),_0xc781('0x82'),_0xc781('0x83'),_0xc781('0x84'),_0xc781('0x85'),_0xc781('0x86'),_0xc781('0x87'),'company',_0xc781('0x88'),_0xc781('0x89'),'assigned_to',_0xc781('0x5d'),_0xc781('0x8a'),_0xc781('0x8b'),_0xc781('0x8c'),_0xc781('0x8d'),'due_date',_0xc781('0x8e'),_0xc781('0x8f'),_0xc781('0x90'),_0xc781('0x91'),_0xc781('0x92'),_0xc781('0x93'),'location',_0xc781('0x94')];var _0x38439f='';var _0x5c0315='';var _0xe42fbe=[];var _0xe3cd56='';var _0x574882='';var _0xec7c75=[];var _0x4cb94e='';var _0x4fe97e='';var _0x2b4995={};var _0x3fca72='';return db[_0xc781('0x2f')][_0xc781('0x50')]({'where':{'id':_0x4af7c0[_0xc781('0x46')]['id']},'attributes':['id',_0xc781('0x95'),_0xc781('0x96'),'email','remoteUri',_0xc781('0x97')]})[_0xc781('0x2b')](handleEntityNotFound(_0x173ec9,null))['then'](function(_0x363ff1){if(_0x363ff1){_0x3fca72=_0x363ff1[_0xc781('0x98')];var _0x515385=_0x3fca72[_0xc781('0x99')](-0x1);if(_0x515385==='/'){_0x3fca72=_0x3fca72[_0xc781('0x9a')](0x0,_0x3fca72[_0xc781('0x9b')](_0x515385));}_0x4fe97e=util['format']('%s/api/now/doc/table/schema/',_0x3fca72);_0x4cb94e=util[_0xc781('0x9c')](_0xc781('0x9d'),_0x3fca72);_0x2b4995={'user':_0x363ff1[_0xc781('0x95')],'pass':_0x363ff1[_0xc781('0x96')]};var _0x7a2acb={'method':_0xc781('0x9e'),'uri':_0x4fe97e+_0xc781('0x9f'),'auth':_0x2b4995,'json':!![]};return rp(_0x7a2acb);}})['then'](function(_0x3bc49d){if(_0x3bc49d[_0xc781('0x21')][_0xc781('0x4d')]>0x0){_0x38439f=_0x3bc49d[_0xc781('0x21')];}console[_0xc781('0xa0')](_0xc781('0xa1'),_0x38439f);_0xec7c75=[];_0x5c0315=Object[_0xc781('0xa2')]([],_0x38439f);_[_0xc781('0xa3')](_0x5c0315,function(_0x2eba45){return!_0x143830['includes'](_0x2eba45[_0xc781('0x2d')]);});_0x5c0315['forEach'](function(_0x1f9209){var _0x2922c2=createFieldObject(_0x4cb94e,_0x2b4995,_0x1f9209[_0xc781('0xa4')],_0x1f9209[_0xc781('0x2d')],_0x1f9209[_0xc781('0xa5')],![]);_0xec7c75['push'](_0x2922c2);});return Promise[_0xc781('0xa6')](_0xec7c75);})[_0xc781('0x2b')](function(_0x15c0bd){_0xe42fbe=_0x15c0bd;_0xe3cd56=Object[_0xc781('0xa2')]([],_0x38439f);console['log'](_0xc781('0xa7'),_0x38439f);_['remove'](_0xe3cd56,function(_0x3ff2d2){return _0xd145fe[_0xc781('0xa8')](_0x3ff2d2[_0xc781('0x2d')]);});console[_0xc781('0xa0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xe3cd56);_0xec7c75=[];_0xe3cd56['forEach'](function(_0x133b75){var _0x54a535=createFieldObject(_0x4cb94e,_0x2b4995,_0x133b75[_0xc781('0xa4')],_0x133b75[_0xc781('0x2d')],_0x133b75[_0xc781('0xa5')],!![]);_0xec7c75['push'](_0x54a535);});return Promise[_0xc781('0xa6')](_0xec7c75);})['then'](function(_0x588556){_0x574882=_0x588556;var _0x9ed78b=_0xe42fbe[_0xc781('0xa9')](_0x574882);return{'count':_0x9ed78b[_0xc781('0x4d')],'rows':_0x9ed78b};})[_0xc781('0x2b')](respondWithResult(_0x173ec9,null))[_0xc781('0x22')](function(_0x41f7d0){console[_0xc781('0xa0')]('ServiceNow\x20error:\x20'+_0x41f7d0);var _0x1b746f=_0x4af7c0[_0xc781('0x33')][_0xc781('0xaa')]?0x1f4:_0x41f7d0[_0xc781('0xab')]||0x1f4;logger['error'](_0x41f7d0['stack']);delete _0x41f7d0[_0xc781('0x2d')];if(_0x1b746f===0x191){_0x1b746f=0x190;}_0x173ec9[_0xc781('0x23')](_0x1b746f)[_0xc781('0xac')](_0x4af7c0[_0xc781('0x33')][_0xc781('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x41f7d0[_0xc781('0xab')]}:_0x41f7d0);});};function createFieldObject(_0x336b17,_0x5a6697,_0x3295ab,_0x178410,_0x2366e0,_0x540c75){return new Promise(function(_0x33f1eb,_0x418764){var _0x898d15={'id':_0x178410,'name':_0x2366e0,'custom':_0x540c75};if(_0x3295ab===_0xc781('0xad')){_0x898d15['options']=[{'name':'True','value':'true'},{'name':_0xc781('0xae'),'value':_0xc781('0xaf')}];_0x33f1eb(_0x898d15);}else{var _0x297f9c={'method':_0xc781('0x9e'),'uri':_0x336b17+_0xc781('0xb0')+_0x178410,'auth':_0x5a6697,'json':!![]};return rp(_0x297f9c)[_0xc781('0x2b')](function(_0x4c02a4){var _0x4025f4=[];if(_0x4c02a4['result'][_0xc781('0x4d')]>0x0){_0x4c02a4['result']['forEach'](function(_0x1d53a4){if(_0x1d53a4[_0xc781('0xb1')]==='false'){var _0x3c1de1={'name':_0x1d53a4[_0xc781('0xa5')],'value':_0x1d53a4['value']};_0x4025f4['push'](_0x3c1de1);}});}_0x898d15[_0xc781('0x42')]=_0x4025f4;if(_0x898d15[_0xc781('0x42')][_0xc781('0x4d')]>0x0){_0x33f1eb(_0x898d15);}else{if(_0x540c75==![]){_0x33f1eb();}else{_0x33f1eb(_0x898d15);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f91c8eb..fc94f9a 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 _0x5ad3=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x28107d,_0x2ec8b3){var _0x2b1cbe=function(_0x5b06ad){while(--_0x5b06ad){_0x28107d['push'](_0x28107d['shift']());}};_0x2b1cbe(++_0x2ec8b3);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x5ad3[_0x141e03];return _0x2074e3;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));var integrations=require(_0x35ad('0xa'));module[_0x35ad('0xb')]=function(_0x36c606,_0x31cc6a){return _0x36c606['define'](_0x35ad('0xc'),attributes,{'tableName':_0x35ad('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad3=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x5ad3[_0x1ca4c3];return _0x4426a6;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));var integrations=require(_0x35ad('0xa'));module[_0x35ad('0xb')]=function(_0x36c606,_0x31cc6a){return _0x36c606['define'](_0x35ad('0xc'),attributes,{'tableName':_0x35ad('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 01a71c4..1bf2e40 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 _0x8b64=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowServicenowAccount','debug'];(function(_0x34c4a5,_0x9ac284){var _0x1b8996=function(_0x426e60){while(--_0x426e60){_0x34c4a5['push'](_0x34c4a5['shift']());}};_0x1b8996(++_0x9ac284);}(_0x8b64,0xc6));var _0x48b6=function(_0x28318f,_0x5cd1a2){_0x28318f=_0x28318f-0x0;var _0x4cab17=_0x8b64[_0x28318f];return _0x4cab17;};'use strict';var _=require(_0x48b6('0x0'));var util=require(_0x48b6('0x1'));var moment=require(_0x48b6('0x2'));var BPromise=require('bluebird');var rs=require(_0x48b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x48b6('0x4'));var logger=require(_0x48b6('0x5'))(_0x48b6('0x6'));var config=require(_0x48b6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x48b6('0x8')][_0x48b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x152e4e,_0x1f89a9,_0x24643d){return new BPromise(function(_0x290e9a,_0x36d99e){return client[_0x48b6('0xa')](_0x152e4e,_0x24643d)[_0x48b6('0xb')](function(_0x4d244b){logger[_0x48b6('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x1f89a9,'request\x20sent');logger['debug'](_0x48b6('0xd'),_0x1f89a9,'request\x20sent',JSON[_0x48b6('0xe')](_0x4d244b));if(_0x4d244b['error']){if(_0x4d244b[_0x48b6('0xf')]['code']===0x1f4){logger[_0x48b6('0xf')](_0x48b6('0x10'),_0x1f89a9,_0x4d244b[_0x48b6('0xf')]['message']);return _0x36d99e(_0x4d244b[_0x48b6('0xf')][_0x48b6('0x11')]);}logger[_0x48b6('0xf')](_0x48b6('0x10'),_0x1f89a9,_0x4d244b['error']['message']);return _0x290e9a(_0x4d244b[_0x48b6('0xf')]['message']);}else{logger[_0x48b6('0xc')](_0x48b6('0x10'),_0x1f89a9,'request\x20sent');_0x290e9a(_0x4d244b[_0x48b6('0x12')][_0x48b6('0x11')]);}})[_0x48b6('0x13')](function(_0x59a009){logger['error'](_0x48b6('0x10'),_0x1f89a9,_0x59a009);_0x36d99e(_0x59a009);});});}exports[_0x48b6('0x14')]=function(_0x45a171){var _0xb3cc57=this;return new Promise(function(_0x516a3f,_0x2ad831){return db['ServicenowAccount'][_0x48b6('0x15')]({'raw':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x17')]===undefined?!![]:![]:!![],'where':_0x45a171[_0x48b6('0x16')]?_0x45a171['options'][_0x48b6('0x18')]||null:null,'attributes':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x19')]||null:null,'limit':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x1a')]||null:null,'include':_0x45a171['options']?_0x45a171[_0x48b6('0x16')]['include']?_[_0x48b6('0x1b')](_0x45a171['options'][_0x48b6('0x1c')],function(_0x1f0d30){return{'model':db[_0x1f0d30['model']],'as':_0x1f0d30['as'],'attributes':_0x1f0d30['attributes'],'include':_0x1f0d30[_0x48b6('0x1c')]?_['map'](_0x1f0d30['include'],function(_0x6c70e4){return{'model':db[_0x6c70e4[_0x48b6('0x1d')]],'as':_0x6c70e4['as'],'attributes':_0x6c70e4[_0x48b6('0x19')],'include':_0x6c70e4['include']?_['map'](_0x6c70e4[_0x48b6('0x1c')],function(_0x29c9da){return{'model':db[_0x29c9da[_0x48b6('0x1d')]],'as':_0x29c9da['as'],'attributes':_0x29c9da['attributes']};}):[]};}):[]};}):[]:[]})[_0x48b6('0xb')](function(_0x35470e){logger['info']('GetServicenowAccount',_0x45a171);logger['debug'](_0x48b6('0x14'),_0x45a171,JSON[_0x48b6('0xe')](_0x35470e));_0x516a3f(_0x35470e);})[_0x48b6('0x13')](function(_0x131473){logger[_0x48b6('0xf')](_0x48b6('0x14'),_0x131473[_0x48b6('0x11')],_0x45a171);_0x2ad831(_0xb3cc57[_0x48b6('0xf')](0x1f4,_0x131473[_0x48b6('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x49b08c){var _0x19f001=this;return new Promise(function(_0x48cef3,_0x3fabae){return db['ServicenowAccount'][_0x48b6('0x1e')]({'raw':_0x49b08c['options']?_0x49b08c[_0x48b6('0x16')][_0x48b6('0x17')]===undefined?!![]:![]:!![],'where':_0x49b08c[_0x48b6('0x16')]?_0x49b08c[_0x48b6('0x16')]['where']||null:null,'attributes':_0x49b08c[_0x48b6('0x16')]?_0x49b08c['options'][_0x48b6('0x19')]||null:null,'include':_0x49b08c[_0x48b6('0x16')]?_0x49b08c[_0x48b6('0x16')]['include']?_['map'](_0x49b08c[_0x48b6('0x16')][_0x48b6('0x1c')],function(_0x530d46){return{'model':db[_0x530d46['model']],'as':_0x530d46['as'],'attributes':_0x530d46[_0x48b6('0x19')],'include':_0x530d46[_0x48b6('0x1c')]?_['map'](_0x530d46['include'],function(_0x10bad5){return{'model':db[_0x10bad5[_0x48b6('0x1d')]],'as':_0x10bad5['as'],'attributes':_0x10bad5[_0x48b6('0x19')],'include':_0x10bad5['include']?_[_0x48b6('0x1b')](_0x10bad5[_0x48b6('0x1c')],function(_0x581f23){return{'model':db[_0x581f23[_0x48b6('0x1d')]],'as':_0x581f23['as'],'attributes':_0x581f23[_0x48b6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x48b6('0xb')](function(_0x5c2395){logger[_0x48b6('0xc')](_0x48b6('0x1f'),_0x49b08c);logger[_0x48b6('0x20')](_0x48b6('0x1f'),_0x49b08c,JSON[_0x48b6('0xe')](_0x5c2395));_0x48cef3(_0x5c2395);})[_0x48b6('0x13')](function(_0x1dafc2){logger[_0x48b6('0xf')](_0x48b6('0x1f'),_0x1dafc2[_0x48b6('0x11')],_0x49b08c);_0x3fabae(_0x19f001[_0x48b6('0xf')](0x1f4,_0x1dafc2['message']));});});}; \ No newline at end of file +var _0x244d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','ShowServicenowAccount','lodash'];(function(_0x2d21af,_0x3bcd20){var _0x3767fe=function(_0xa99f41){while(--_0xa99f41){_0x2d21af['push'](_0x2d21af['shift']());}};_0x3767fe(++_0x3bcd20);}(_0x244d,0x83));var _0xd244=function(_0x4ad8d8,_0x3576b0){_0x4ad8d8=_0x4ad8d8-0x0;var _0x32f7f5=_0x244d[_0x4ad8d8];return _0x32f7f5;};'use strict';var _=require(_0xd244('0x0'));var util=require('util');var moment=require(_0xd244('0x1'));var BPromise=require(_0xd244('0x2'));var rs=require(_0xd244('0x3'));var fs=require('fs');var Redis=require(_0xd244('0x4'));var db=require(_0xd244('0x5'))['db'];var utils=require(_0xd244('0x6'));var logger=require('../../config/logger')(_0xd244('0x7'));var config=require(_0xd244('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd244('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48020e,_0x50f04a,_0xca7155){return new BPromise(function(_0x190517,_0x57a3a9){return client['request'](_0x48020e,_0xca7155)['then'](function(_0x116e2b){logger[_0xd244('0xa')](_0xd244('0xb'),_0x50f04a,'request\x20sent');logger[_0xd244('0xc')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x50f04a,_0xd244('0xd'),JSON[_0xd244('0xe')](_0x116e2b));if(_0x116e2b[_0xd244('0xf')]){if(_0x116e2b[_0xd244('0xf')][_0xd244('0x10')]===0x1f4){logger[_0xd244('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x50f04a,_0x116e2b[_0xd244('0xf')]['message']);return _0x57a3a9(_0x116e2b[_0xd244('0xf')][_0xd244('0x11')]);}logger[_0xd244('0xf')](_0xd244('0xb'),_0x50f04a,_0x116e2b[_0xd244('0xf')][_0xd244('0x11')]);return _0x190517(_0x116e2b[_0xd244('0xf')][_0xd244('0x11')]);}else{logger['info'](_0xd244('0xb'),_0x50f04a,_0xd244('0xd'));_0x190517(_0x116e2b[_0xd244('0x12')][_0xd244('0x11')]);}})[_0xd244('0x13')](function(_0x22f4e5){logger[_0xd244('0xf')](_0xd244('0xb'),_0x50f04a,_0x22f4e5);_0x57a3a9(_0x22f4e5);});});}exports[_0xd244('0x14')]=function(_0x532223){var _0x43be35=this;return new Promise(function(_0x2a12b4,_0x197917){return db[_0xd244('0x15')][_0xd244('0x16')]({'raw':_0x532223['options']?_0x532223['options'][_0xd244('0x17')]===undefined?!![]:![]:!![],'where':_0x532223[_0xd244('0x18')]?_0x532223[_0xd244('0x18')][_0xd244('0x19')]||null:null,'attributes':_0x532223[_0xd244('0x18')]?_0x532223[_0xd244('0x18')][_0xd244('0x1a')]||null:null,'limit':_0x532223[_0xd244('0x18')]?_0x532223['options'][_0xd244('0x1b')]||null:null,'include':_0x532223[_0xd244('0x18')]?_0x532223[_0xd244('0x18')][_0xd244('0x1c')]?_[_0xd244('0x1d')](_0x532223[_0xd244('0x18')][_0xd244('0x1c')],function(_0x1d2dcb){return{'model':db[_0x1d2dcb[_0xd244('0x1e')]],'as':_0x1d2dcb['as'],'attributes':_0x1d2dcb[_0xd244('0x1a')],'include':_0x1d2dcb[_0xd244('0x1c')]?_['map'](_0x1d2dcb[_0xd244('0x1c')],function(_0x5ac165){return{'model':db[_0x5ac165[_0xd244('0x1e')]],'as':_0x5ac165['as'],'attributes':_0x5ac165[_0xd244('0x1a')],'include':_0x5ac165['include']?_[_0xd244('0x1d')](_0x5ac165[_0xd244('0x1c')],function(_0x53b0a4){return{'model':db[_0x53b0a4[_0xd244('0x1e')]],'as':_0x53b0a4['as'],'attributes':_0x53b0a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd244('0x1f')](function(_0x17ce58){logger[_0xd244('0xa')](_0xd244('0x14'),_0x532223);logger[_0xd244('0xc')](_0xd244('0x14'),_0x532223,JSON['stringify'](_0x17ce58));_0x2a12b4(_0x17ce58);})[_0xd244('0x13')](function(_0x28d4e3){logger[_0xd244('0xf')](_0xd244('0x14'),_0x28d4e3[_0xd244('0x11')],_0x532223);_0x197917(_0x43be35[_0xd244('0xf')](0x1f4,_0x28d4e3[_0xd244('0x11')]));});});};exports[_0xd244('0x20')]=function(_0x14dc33){var _0x3f47cd=this;return new Promise(function(_0x44552b,_0x59d716){return db['ServicenowAccount']['find']({'raw':_0x14dc33[_0xd244('0x18')]?_0x14dc33[_0xd244('0x18')][_0xd244('0x17')]===undefined?!![]:![]:!![],'where':_0x14dc33['options']?_0x14dc33[_0xd244('0x18')]['where']||null:null,'attributes':_0x14dc33[_0xd244('0x18')]?_0x14dc33[_0xd244('0x18')]['attributes']||null:null,'include':_0x14dc33['options']?_0x14dc33[_0xd244('0x18')][_0xd244('0x1c')]?_[_0xd244('0x1d')](_0x14dc33[_0xd244('0x18')][_0xd244('0x1c')],function(_0x517c5f){return{'model':db[_0x517c5f['model']],'as':_0x517c5f['as'],'attributes':_0x517c5f[_0xd244('0x1a')],'include':_0x517c5f['include']?_['map'](_0x517c5f[_0xd244('0x1c')],function(_0x2188a4){return{'model':db[_0x2188a4[_0xd244('0x1e')]],'as':_0x2188a4['as'],'attributes':_0x2188a4[_0xd244('0x1a')],'include':_0x2188a4['include']?_['map'](_0x2188a4[_0xd244('0x1c')],function(_0x5a9c95){return{'model':db[_0x5a9c95[_0xd244('0x1e')]],'as':_0x5a9c95['as'],'attributes':_0x5a9c95[_0xd244('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd244('0x1f')](function(_0x4d7011){logger[_0xd244('0xa')](_0xd244('0x20'),_0x14dc33);logger[_0xd244('0xc')](_0xd244('0x20'),_0x14dc33,JSON[_0xd244('0xe')](_0x4d7011));_0x44552b(_0x4d7011);})[_0xd244('0x13')](function(_0x3c49ea){logger[_0xd244('0xf')](_0xd244('0x20'),_0x3c49ea[_0xd244('0x11')],_0x14dc33);_0x59d716(_0x3f47cd[_0xd244('0xf')](0x1f4,_0x3c49ea[_0xd244('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 992bb6c..4ab0db1 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 _0xfec6=['getDescriptions','post','create','update','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions'];(function(_0x591672,_0x4427a9){var _0x17706e=function(_0x4c8c19){while(--_0x4c8c19){_0x591672['push'](_0x591672['shift']());}};_0x17706e(++_0x4427a9);}(_0xfec6,0x83));var _0x6fec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfec6[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x6fec('0x0'));var util=require(_0x6fec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x6fec('0x2'));var interaction=require(_0x6fec('0x3'));var config=require(_0x6fec('0x4'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x6fec('0x5')](),controller[_0x6fec('0x6')]);router[_0x6fec('0x7')](_0x6fec('0x8'),auth[_0x6fec('0x5')](),controller[_0x6fec('0x9')]);router[_0x6fec('0x7')](_0x6fec('0xa'),auth[_0x6fec('0x5')](),controller[_0x6fec('0xb')]);router[_0x6fec('0x7')]('/:id/subjects',auth[_0x6fec('0x5')](),controller['getSubjects']);router['get'](_0x6fec('0xc'),auth[_0x6fec('0x5')](),controller[_0x6fec('0xd')]);router[_0x6fec('0xe')]('/',auth['isAuthenticated'](),controller[_0x6fec('0xf')]);router['put'](_0x6fec('0x8'),auth[_0x6fec('0x5')](),controller[_0x6fec('0x10')]);router['delete'](_0x6fec('0x8'),auth[_0x6fec('0x5')](),controller['destroy']);module[_0x6fec('0x11')]=router; \ No newline at end of file +var _0x344d=['delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0x344d,0xab));var _0xd344=function(_0x1e20f5,_0x2f2e0d){_0x1e20f5=_0x1e20f5-0x0;var _0x581060=_0x344d[_0x1e20f5];return _0x581060;};'use strict';var multer=require(_0xd344('0x0'));var util=require(_0xd344('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd344('0x2')]();var auth=require(_0xd344('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd344('0x4'));var controller=require(_0xd344('0x5'));router[_0xd344('0x6')]('/',auth[_0xd344('0x7')](),controller[_0xd344('0x8')]);router[_0xd344('0x6')](_0xd344('0x9'),auth[_0xd344('0x7')](),controller[_0xd344('0xa')]);router['get']('/:id/fields',auth[_0xd344('0x7')](),controller[_0xd344('0xb')]);router[_0xd344('0x6')](_0xd344('0xc'),auth[_0xd344('0x7')](),controller[_0xd344('0xd')]);router[_0xd344('0x6')]('/:id/descriptions',auth[_0xd344('0x7')](),controller[_0xd344('0xe')]);router[_0xd344('0xf')]('/',auth[_0xd344('0x7')](),controller[_0xd344('0x10')]);router[_0xd344('0x11')](_0xd344('0x9'),auth[_0xd344('0x7')](),controller['update']);router[_0xd344('0x12')](_0xd344('0x9'),auth[_0xd344('0x7')](),controller[_0xd344('0x13')]);module[_0xd344('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 03cabf0..567d119 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 _0xeb06=['sequelize','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeb06,0x1c5));var _0x6eb0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeb06[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x6eb0('0x0'));module[_0x6eb0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6eb0('0x2')]}}; \ No newline at end of file +var _0xca74=['STRING','sequelize'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xca74,0x10d));var _0x4ca7=function(_0x5d386b,_0x352e3f){_0x5d386b=_0x5d386b-0x0;var _0xdfc622=_0xca74[_0x5d386b];return _0xdfc622;};'use strict';var Sequelize=require(_0x4ca7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4ca7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 29ab8d3..4ecf11c 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 _0x1b8a=['intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','model','include','find','create','body','params','findOne','pick','getFields','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','count','limit','set','apply','reject','save','update','then','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','attributes'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x1b8a,0x1e0));var _0xa1b8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b8a[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xa1b8('0x0'));var emlformat=require(_0xa1b8('0x1'));var rimraf=require(_0xa1b8('0x2'));var zipdir=require(_0xa1b8('0x3'));var jsonpatch=require(_0xa1b8('0x4'));var rp=require('request-promise');var moment=require(_0xa1b8('0x5'));var BPromise=require(_0xa1b8('0x6'));var Mustache=require(_0xa1b8('0x7'));var util=require('util');var path=require(_0xa1b8('0x8'));var sox=require('sox');var csv=require(_0xa1b8('0x9'));var ejs=require(_0xa1b8('0xa'));var fs=require('fs');var _=require(_0xa1b8('0xb'));var squel=require(_0xa1b8('0xc'));var crypto=require(_0xa1b8('0xd'));var jsforce=require(_0xa1b8('0xe'));var deskjs=require(_0xa1b8('0xf'));var toCsv=require(_0xa1b8('0x9'));var querystring=require('querystring');var Papa=require(_0xa1b8('0x10'));var Redis=require('ioredis');var authService=require(_0xa1b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa1b8('0x12'));var hardwareService=require(_0xa1b8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa1b8('0x14'));var config=require(_0xa1b8('0x15'));var licenseUtil=require(_0xa1b8('0x16'));var db=require(_0xa1b8('0x17'))['db'];var jayson=require(_0xa1b8('0x18'));var client=jayson[_0xa1b8('0x19')][_0xa1b8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1fc4b0,_0x3cd79b,_0x3da46f,_0x22785d){return new BPromise(function(_0x3f5db2,_0x45995f){var _0x4d5766=_0x22785d||client;return _0x4d5766['request'](_0x1fc4b0,_0x3da46f)['then'](function(_0x3b7467){logger[_0xa1b8('0x1b')](_0xa1b8('0x1c'),_0x3cd79b,_0xa1b8('0x1d'));logger[_0xa1b8('0x1e')](_0xa1b8('0x1f'),_0x3cd79b,_0xa1b8('0x1d'),JSON['stringify'](_0x3b7467));if(_0x3b7467[_0xa1b8('0x20')]){if(_0x3b7467['error']['code']===0x1f4){logger[_0xa1b8('0x20')](_0xa1b8('0x1c'),_0x3cd79b,_0x3b7467[_0xa1b8('0x20')][_0xa1b8('0x21')]);return _0x45995f(_0x3b7467[_0xa1b8('0x20')][_0xa1b8('0x21')]);}logger['error'](_0xa1b8('0x1c'),_0x3cd79b,_0x3b7467[_0xa1b8('0x20')]['message']);return _0x3f5db2(_0x3b7467[_0xa1b8('0x20')][_0xa1b8('0x21')]);}else{logger[_0xa1b8('0x1b')](_0xa1b8('0x1c'),_0x3cd79b,_0xa1b8('0x1d'));_0x3f5db2(_0x3b7467['result']['message']);}})['catch'](function(_0x29f133){logger[_0xa1b8('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3cd79b,_0x29f133);_0x45995f(_0x29f133);});});}function respondWithStatusCode(_0x395bce,_0x5b36cc){_0x5b36cc=_0x5b36cc||0xcc;return function(_0x3d9314){if(_0x3d9314){return _0x395bce[_0xa1b8('0x22')](_0x5b36cc);}return _0x395bce[_0xa1b8('0x23')](_0x5b36cc)[_0xa1b8('0x24')]();};}function respondWithResult(_0x3987ea,_0x49f5ed){_0x49f5ed=_0x49f5ed||0xc8;return function(_0x582436){if(_0x582436){return _0x3987ea[_0xa1b8('0x23')](_0x49f5ed)[_0xa1b8('0x25')](_0x582436);}};}function respondWithFilteredResult(_0x1da198,_0x5ec6fd){return function(_0x1b05d0){if(_0x1b05d0){var _0x432464=_0x1b05d0[_0xa1b8('0x26')],_0x2faadb=_0x5ec6fd['offset'],_0x116757=_0x5ec6fd['offset']+_0x5ec6fd[_0xa1b8('0x27')],_0xffb0c9;if(_0x116757>=_0x432464){_0x116757=_0x432464;_0xffb0c9=0xc8;}else{_0xffb0c9=0xce;}_0x1da198['status'](_0xffb0c9);return _0x1da198[_0xa1b8('0x28')]('Content-Range',_0x2faadb+'-'+_0x116757+'/'+_0x432464)['json'](_0x1b05d0);}return null;};}function patchUpdates(_0x332fd6){return function(_0x19db3b){try{jsonpatch[_0xa1b8('0x29')](_0x19db3b,_0x332fd6,!![]);}catch(_0x2b9f75){return BPromise[_0xa1b8('0x2a')](_0x2b9f75);}return _0x19db3b[_0xa1b8('0x2b')]();};}function saveUpdates(_0x5a46e5,_0xa460b4){return function(_0xd22794){if(_0xd22794){return _0xd22794[_0xa1b8('0x2c')](_0x5a46e5)[_0xa1b8('0x2d')](function(_0x1166f9){return _0x1166f9;});}return null;};}function removeEntity(_0x5f5547,_0x4e915e){return function(_0x4d1f18){if(_0x4d1f18){return _0x4d1f18[_0xa1b8('0x2e')]()[_0xa1b8('0x2d')](function(){_0x5f5547['status'](0xcc)[_0xa1b8('0x24')]();});}};}function handleEntityNotFound(_0x46488d,_0x59b720){return function(_0x51ab1e){if(!_0x51ab1e){_0x46488d[_0xa1b8('0x22')](0x194);}return _0x51ab1e;};}function handleError(_0x4ab231,_0x2c1116){_0x2c1116=_0x2c1116||0x1f4;return function(_0x430945){logger[_0xa1b8('0x20')](_0x430945[_0xa1b8('0x2f')]);if(_0x430945[_0xa1b8('0x30')]){delete _0x430945[_0xa1b8('0x30')];}_0x4ab231['status'](_0x2c1116)['send'](_0x430945);};}exports[_0xa1b8('0x31')]=function(_0x94165,_0x9d6571){var _0x1e1be5={},_0x68221={},_0xe0f037={'count':0x0,'rows':[]};var _0x2374a6=_[_0xa1b8('0x32')](db[_0xa1b8('0x33')][_0xa1b8('0x34')],function(_0x5cc9da){return{'name':_0x5cc9da[_0xa1b8('0x35')],'type':_0x5cc9da[_0xa1b8('0x36')][_0xa1b8('0x37')]};});_0x68221['model']=_['map'](_0x2374a6,_0xa1b8('0x30'));_0x68221[_0xa1b8('0x38')]=_[_0xa1b8('0x39')](_0x94165[_0xa1b8('0x38')]);_0x68221[_0xa1b8('0x3a')]=_['intersection'](_0x68221['model'],_0x68221[_0xa1b8('0x38')]);_0x1e1be5[_0xa1b8('0x3b')]=_[_0xa1b8('0x3c')](_0x68221['model'],qs[_0xa1b8('0x3d')](_0x94165[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x1e1be5[_0xa1b8('0x3b')]=_0x1e1be5['attributes'][_0xa1b8('0x3e')]?_0x1e1be5[_0xa1b8('0x3b')]:_0x68221['model'];if(!_0x94165[_0xa1b8('0x38')][_0xa1b8('0x3f')](_0xa1b8('0x40'))){_0x1e1be5[_0xa1b8('0x27')]=qs['limit'](_0x94165['query'][_0xa1b8('0x27')]);_0x1e1be5[_0xa1b8('0x41')]=qs[_0xa1b8('0x41')](_0x94165[_0xa1b8('0x38')]['offset']);}_0x1e1be5[_0xa1b8('0x42')]=qs['sort'](_0x94165['query'][_0xa1b8('0x43')]);_0x1e1be5[_0xa1b8('0x44')]=qs['filters'](_['pick'](_0x94165[_0xa1b8('0x38')],_0x68221[_0xa1b8('0x3a')]),_0x2374a6);if(_0x94165['query'][_0xa1b8('0x45')]){_0x1e1be5[_0xa1b8('0x44')]=_['merge'](_0x1e1be5[_0xa1b8('0x44')],{'$or':_[_0xa1b8('0x32')](_0x2374a6,function(_0x5e3fdb){if(_0x5e3fdb[_0xa1b8('0x36')]!==_0xa1b8('0x46')){var _0x41eeb9={};_0x41eeb9[_0x5e3fdb['name']]={'$like':'%'+_0x94165[_0xa1b8('0x38')][_0xa1b8('0x45')]+'%'};return _0x41eeb9;}})});}_0x1e1be5=_[_0xa1b8('0x47')]({},_0x1e1be5,_0x94165[_0xa1b8('0x48')]);var _0x4b2a34={'where':_0x1e1be5['where']};return db[_0xa1b8('0x33')][_0xa1b8('0x26')](_0x4b2a34)[_0xa1b8('0x2d')](function(_0x4b441e){_0xe0f037['count']=_0x4b441e;if(_0x94165[_0xa1b8('0x38')][_0xa1b8('0x49')]){_0x1e1be5['include']=[{'all':!![]}];}return db[_0xa1b8('0x33')][_0xa1b8('0x4a')](_0x1e1be5);})['then'](function(_0x2a845e){_0xe0f037[_0xa1b8('0x4b')]=_0x2a845e;return _0xe0f037;})[_0xa1b8('0x2d')](respondWithFilteredResult(_0x9d6571,_0x1e1be5))[_0xa1b8('0x4c')](handleError(_0x9d6571,null));};exports[_0xa1b8('0x4d')]=function(_0x29950a,_0x208c18){var _0x2590a6={'raw':![],'where':{'id':_0x29950a['params']['id']}},_0x4418c4={};_0x4418c4[_0xa1b8('0x4e')]=_['keys'](db[_0xa1b8('0x33')][_0xa1b8('0x34')]);_0x4418c4['query']=_[_0xa1b8('0x39')](_0x29950a[_0xa1b8('0x38')]);_0x4418c4[_0xa1b8('0x3a')]=_[_0xa1b8('0x3c')](_0x4418c4[_0xa1b8('0x4e')],_0x4418c4['query']);_0x2590a6[_0xa1b8('0x3b')]=_['intersection'](_0x4418c4[_0xa1b8('0x4e')],qs['fields'](_0x29950a[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x2590a6['attributes']=_0x2590a6[_0xa1b8('0x3b')][_0xa1b8('0x3e')]?_0x2590a6['attributes']:_0x4418c4['model'];if(_0x29950a[_0xa1b8('0x38')][_0xa1b8('0x49')]){_0x2590a6[_0xa1b8('0x4f')]=[{'all':!![]}];}_0x2590a6=_[_0xa1b8('0x47')]({},_0x2590a6,_0x29950a[_0xa1b8('0x48')]);return db[_0xa1b8('0x33')][_0xa1b8('0x50')](_0x2590a6)[_0xa1b8('0x2d')](handleEntityNotFound(_0x208c18,null))[_0xa1b8('0x2d')](respondWithResult(_0x208c18,null))['catch'](handleError(_0x208c18,null));};exports[_0xa1b8('0x51')]=function(_0x4f9a67,_0x2f88e0){return db['ServicenowConfiguration'][_0xa1b8('0x51')](_0x4f9a67[_0xa1b8('0x52')],{})[_0xa1b8('0x2d')](respondWithResult(_0x2f88e0,0xc9))[_0xa1b8('0x4c')](handleError(_0x2f88e0,null));};exports['update']=function(_0x49b31e,_0x47812c){if(_0x49b31e[_0xa1b8('0x52')]['id']){delete _0x49b31e[_0xa1b8('0x52')]['id'];}return db[_0xa1b8('0x33')]['find']({'where':{'id':_0x49b31e[_0xa1b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x47812c,null))[_0xa1b8('0x2d')](saveUpdates(_0x49b31e[_0xa1b8('0x52')],null))[_0xa1b8('0x2d')](respondWithResult(_0x47812c,null))['catch'](handleError(_0x47812c,null));};exports[_0xa1b8('0x2e')]=function(_0x538605,_0x3839de){return db[_0xa1b8('0x33')][_0xa1b8('0x50')]({'where':{'id':_0x538605[_0xa1b8('0x53')]['id']}})[_0xa1b8('0x2d')](handleEntityNotFound(_0x3839de,null))[_0xa1b8('0x2d')](removeEntity(_0x3839de,null))[_0xa1b8('0x4c')](handleError(_0x3839de,null));};exports['getFields']=function(_0x282ff4,_0x1e4326,_0x27f08a){var _0x2b08ab={};var _0x3f6ee0={};var _0x3ea37d;var _0x3052cc;return db[_0xa1b8('0x33')][_0xa1b8('0x54')]({'where':{'id':_0x282ff4[_0xa1b8('0x53')]['id']}})[_0xa1b8('0x2d')](handleEntityNotFound(_0x1e4326,null))[_0xa1b8('0x2d')](function(_0x1fb8f7){if(_0x1fb8f7){_0x3ea37d=_0x1fb8f7;_0x3f6ee0[_0xa1b8('0x4e')]=_[_0xa1b8('0x39')](db['ServicenowField'][_0xa1b8('0x34')]);_0x3f6ee0[_0xa1b8('0x38')]=_[_0xa1b8('0x39')](_0x282ff4[_0xa1b8('0x38')]);_0x3f6ee0[_0xa1b8('0x3a')]=_[_0xa1b8('0x3c')](_0x3f6ee0[_0xa1b8('0x4e')],_0x3f6ee0[_0xa1b8('0x38')]);_0x2b08ab['attributes']=_[_0xa1b8('0x3c')](_0x3f6ee0['model'],qs[_0xa1b8('0x3d')](_0x282ff4[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x2b08ab[_0xa1b8('0x3b')]=_0x2b08ab[_0xa1b8('0x3b')][_0xa1b8('0x3e')]?_0x2b08ab['attributes']:_0x3f6ee0[_0xa1b8('0x4e')];_0x2b08ab['order']=qs['sort'](_0x282ff4[_0xa1b8('0x38')][_0xa1b8('0x43')]);_0x2b08ab[_0xa1b8('0x44')]=qs['filters'](_[_0xa1b8('0x55')](_0x282ff4['query'],_0x3f6ee0[_0xa1b8('0x3a')]));if(_0x282ff4[_0xa1b8('0x38')]['filter']){_0x2b08ab[_0xa1b8('0x44')]=_[_0xa1b8('0x47')](_0x2b08ab['where'],{'$or':_[_0xa1b8('0x32')](_0x2b08ab['attributes'],function(_0xe5e76c){var _0x135e00={};_0x135e00[_0xe5e76c]={'$like':'%'+_0x282ff4[_0xa1b8('0x38')][_0xa1b8('0x45')]+'%'};return _0x135e00;})});}_0x2b08ab=_[_0xa1b8('0x47')]({},_0x2b08ab,_0x282ff4[_0xa1b8('0x48')]);return _0x3ea37d[_0xa1b8('0x56')](_0x2b08ab);}})['then'](function(_0x2fad0b){if(_0x2fad0b){_0x3052cc=_0x2fad0b[_0xa1b8('0x3e')];if(!_0x282ff4[_0xa1b8('0x38')]['hasOwnProperty'](_0xa1b8('0x40'))){_0x2b08ab['limit']=qs['limit'](_0x282ff4['query']['limit']);_0x2b08ab[_0xa1b8('0x41')]=qs[_0xa1b8('0x41')](_0x282ff4['query'][_0xa1b8('0x41')]);}return _0x3ea37d[_0xa1b8('0x56')](_0x2b08ab);}})[_0xa1b8('0x2d')](function(_0x2b3da2){if(_0x2b3da2){return _0x2b3da2?{'count':_0x3052cc,'rows':_0x2b3da2}:null;}})[_0xa1b8('0x2d')](respondWithResult(_0x1e4326,null))['catch'](handleError(_0x1e4326,null));};exports[_0xa1b8('0x57')]=function(_0x121a7c,_0x246722,_0x18dd8d){var _0x2f089c={};var _0x42c388={};var _0x1b9da7;var _0x5a95c3;return db[_0xa1b8('0x33')][_0xa1b8('0x54')]({'where':{'id':_0x121a7c[_0xa1b8('0x53')]['id']}})[_0xa1b8('0x2d')](handleEntityNotFound(_0x246722,null))[_0xa1b8('0x2d')](function(_0x1dc026){if(_0x1dc026){_0x1b9da7=_0x1dc026;_0x42c388['model']=_[_0xa1b8('0x39')](db['ServicenowField'][_0xa1b8('0x34')]);_0x42c388[_0xa1b8('0x38')]=_[_0xa1b8('0x39')](_0x121a7c[_0xa1b8('0x38')]);_0x42c388[_0xa1b8('0x3a')]=_['intersection'](_0x42c388[_0xa1b8('0x4e')],_0x42c388[_0xa1b8('0x38')]);_0x2f089c[_0xa1b8('0x3b')]=_[_0xa1b8('0x3c')](_0x42c388['model'],qs[_0xa1b8('0x3d')](_0x121a7c['query'][_0xa1b8('0x3d')]));_0x2f089c[_0xa1b8('0x3b')]=_0x2f089c['attributes'][_0xa1b8('0x3e')]?_0x2f089c[_0xa1b8('0x3b')]:_0x42c388[_0xa1b8('0x4e')];_0x2f089c[_0xa1b8('0x42')]=qs[_0xa1b8('0x43')](_0x121a7c[_0xa1b8('0x38')][_0xa1b8('0x43')]);_0x2f089c[_0xa1b8('0x44')]=qs[_0xa1b8('0x3a')](_[_0xa1b8('0x55')](_0x121a7c[_0xa1b8('0x38')],_0x42c388[_0xa1b8('0x3a')]));if(_0x121a7c['query']['filter']){_0x2f089c['where']=_[_0xa1b8('0x47')](_0x2f089c[_0xa1b8('0x44')],{'$or':_[_0xa1b8('0x32')](_0x2f089c[_0xa1b8('0x3b')],function(_0x5b2329){var _0x3ae645={};_0x3ae645[_0x5b2329]={'$like':'%'+_0x121a7c[_0xa1b8('0x38')]['filter']+'%'};return _0x3ae645;})});}_0x2f089c=_[_0xa1b8('0x47')]({},_0x2f089c,_0x121a7c['options']);return _0x1b9da7[_0xa1b8('0x57')](_0x2f089c);}})[_0xa1b8('0x2d')](function(_0x457f73){if(_0x457f73){_0x5a95c3=_0x457f73[_0xa1b8('0x3e')];if(!_0x121a7c['query'][_0xa1b8('0x3f')]('nolimit')){_0x2f089c['limit']=qs[_0xa1b8('0x27')](_0x121a7c[_0xa1b8('0x38')][_0xa1b8('0x27')]);_0x2f089c[_0xa1b8('0x41')]=qs['offset'](_0x121a7c[_0xa1b8('0x38')][_0xa1b8('0x41')]);}return _0x1b9da7[_0xa1b8('0x57')](_0x2f089c);}})[_0xa1b8('0x2d')](function(_0x6fae65){if(_0x6fae65){return _0x6fae65?{'count':_0x5a95c3,'rows':_0x6fae65}:null;}})[_0xa1b8('0x2d')](respondWithResult(_0x246722,null))[_0xa1b8('0x4c')](handleError(_0x246722,null));};exports['getDescriptions']=function(_0x5e8fa7,_0x38e579,_0xd5d459){var _0x408c16={};var _0x4d5379={};var _0x3c8fe0;var _0x43bfca;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x5e8fa7[_0xa1b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x38e579,null))[_0xa1b8('0x2d')](function(_0xd13cd3){if(_0xd13cd3){_0x3c8fe0=_0xd13cd3;_0x4d5379[_0xa1b8('0x4e')]=_[_0xa1b8('0x39')](db[_0xa1b8('0x58')]['rawAttributes']);_0x4d5379['query']=_[_0xa1b8('0x39')](_0x5e8fa7['query']);_0x4d5379[_0xa1b8('0x3a')]=_[_0xa1b8('0x3c')](_0x4d5379[_0xa1b8('0x4e')],_0x4d5379[_0xa1b8('0x38')]);_0x408c16[_0xa1b8('0x3b')]=_['intersection'](_0x4d5379[_0xa1b8('0x4e')],qs[_0xa1b8('0x3d')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x408c16[_0xa1b8('0x3b')]=_0x408c16[_0xa1b8('0x3b')]['length']?_0x408c16[_0xa1b8('0x3b')]:_0x4d5379[_0xa1b8('0x4e')];_0x408c16[_0xa1b8('0x42')]=qs[_0xa1b8('0x43')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x43')]);_0x408c16[_0xa1b8('0x44')]=qs['filters'](_[_0xa1b8('0x55')](_0x5e8fa7[_0xa1b8('0x38')],_0x4d5379[_0xa1b8('0x3a')]));if(_0x5e8fa7[_0xa1b8('0x38')]['filter']){_0x408c16['where']=_['merge'](_0x408c16[_0xa1b8('0x44')],{'$or':_[_0xa1b8('0x32')](_0x408c16[_0xa1b8('0x3b')],function(_0xd0c48c){var _0x3657fb={};_0x3657fb[_0xd0c48c]={'$like':'%'+_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x45')]+'%'};return _0x3657fb;})});}_0x408c16=_[_0xa1b8('0x47')]({},_0x408c16,_0x5e8fa7[_0xa1b8('0x48')]);return _0x3c8fe0[_0xa1b8('0x59')](_0x408c16);}})[_0xa1b8('0x2d')](function(_0x335da6){if(_0x335da6){_0x43bfca=_0x335da6[_0xa1b8('0x3e')];if(!_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x3f')](_0xa1b8('0x40'))){_0x408c16['limit']=qs[_0xa1b8('0x27')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x27')]);_0x408c16[_0xa1b8('0x41')]=qs[_0xa1b8('0x41')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x41')]);}return _0x3c8fe0[_0xa1b8('0x59')](_0x408c16);}})['then'](function(_0x3b6735){if(_0x3b6735){return _0x3b6735?{'count':_0x43bfca,'rows':_0x3b6735}:null;}})[_0xa1b8('0x2d')](respondWithResult(_0x38e579,null))[_0xa1b8('0x4c')](handleError(_0x38e579,null));}; \ No newline at end of file +var _0xe3a6=['order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','show','params','options','find','create','body','update','getFields','findOne','ServicenowField','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','apply','save','destroy','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xe3a6,0x17d));var _0x6e3a=function(_0x383cec,_0x149512){_0x383cec=_0x383cec-0x0;var _0x4bb2ca=_0xe3a6[_0x383cec];return _0x4bb2ca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e3a('0x0'));var rimraf=require(_0x6e3a('0x1'));var zipdir=require(_0x6e3a('0x2'));var jsonpatch=require(_0x6e3a('0x3'));var rp=require(_0x6e3a('0x4'));var moment=require(_0x6e3a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6e3a('0x6'));var util=require(_0x6e3a('0x7'));var path=require(_0x6e3a('0x8'));var sox=require(_0x6e3a('0x9'));var csv=require(_0x6e3a('0xa'));var ejs=require(_0x6e3a('0xb'));var fs=require('fs');var _=require(_0x6e3a('0xc'));var squel=require('squel');var crypto=require(_0x6e3a('0xd'));var jsforce=require(_0x6e3a('0xe'));var deskjs=require(_0x6e3a('0xf'));var toCsv=require(_0x6e3a('0xa'));var querystring=require(_0x6e3a('0x10'));var Papa=require(_0x6e3a('0x11'));var Redis=require(_0x6e3a('0x12'));var authService=require(_0x6e3a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6e3a('0x14'));var hardwareService=require(_0x6e3a('0x15'));var logger=require(_0x6e3a('0x16'))(_0x6e3a('0x17'));var utils=require(_0x6e3a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6e3a('0x19'));var db=require(_0x6e3a('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x70bc5c,_0x231ee7,_0x46e76d,_0x4feb12){return new BPromise(function(_0x111ec9,_0xb4ec1d){var _0x2f4e9d=_0x4feb12||client;return _0x2f4e9d['request'](_0x70bc5c,_0x46e76d)[_0x6e3a('0x1b')](function(_0x494d31){logger[_0x6e3a('0x1c')](_0x6e3a('0x1d'),_0x231ee7,_0x6e3a('0x1e'));logger[_0x6e3a('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x231ee7,'request\x20sent',JSON[_0x6e3a('0x20')](_0x494d31));if(_0x494d31['error']){if(_0x494d31['error'][_0x6e3a('0x21')]===0x1f4){logger[_0x6e3a('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x231ee7,_0x494d31[_0x6e3a('0x22')][_0x6e3a('0x23')]);return _0xb4ec1d(_0x494d31[_0x6e3a('0x22')][_0x6e3a('0x23')]);}logger[_0x6e3a('0x22')](_0x6e3a('0x1d'),_0x231ee7,_0x494d31[_0x6e3a('0x22')][_0x6e3a('0x23')]);return _0x111ec9(_0x494d31[_0x6e3a('0x22')][_0x6e3a('0x23')]);}else{logger[_0x6e3a('0x1c')](_0x6e3a('0x1d'),_0x231ee7,_0x6e3a('0x1e'));_0x111ec9(_0x494d31[_0x6e3a('0x24')][_0x6e3a('0x23')]);}})[_0x6e3a('0x25')](function(_0xc7d8a4){logger[_0x6e3a('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x231ee7,_0xc7d8a4);_0xb4ec1d(_0xc7d8a4);});});}function respondWithStatusCode(_0xdd8e48,_0x538dbd){_0x538dbd=_0x538dbd||0xcc;return function(_0xb93ac3){if(_0xb93ac3){return _0xdd8e48[_0x6e3a('0x26')](_0x538dbd);}return _0xdd8e48[_0x6e3a('0x27')](_0x538dbd)[_0x6e3a('0x28')]();};}function respondWithResult(_0x416e14,_0x5ed7d6){_0x5ed7d6=_0x5ed7d6||0xc8;return function(_0xe7c6d0){if(_0xe7c6d0){return _0x416e14[_0x6e3a('0x27')](_0x5ed7d6)[_0x6e3a('0x29')](_0xe7c6d0);}};}function respondWithFilteredResult(_0x47a9a6,_0x531048){return function(_0x3abd09){if(_0x3abd09){var _0x4e744c=_0x3abd09['count'],_0x2795bb=_0x531048[_0x6e3a('0x2a')],_0x131d68=_0x531048['offset']+_0x531048[_0x6e3a('0x2b')],_0x5a6311;if(_0x131d68>=_0x4e744c){_0x131d68=_0x4e744c;_0x5a6311=0xc8;}else{_0x5a6311=0xce;}_0x47a9a6[_0x6e3a('0x27')](_0x5a6311);return _0x47a9a6['set']('Content-Range',_0x2795bb+'-'+_0x131d68+'/'+_0x4e744c)[_0x6e3a('0x29')](_0x3abd09);}return null;};}function patchUpdates(_0x38384d){return function(_0x2e50e2){try{jsonpatch[_0x6e3a('0x2c')](_0x2e50e2,_0x38384d,!![]);}catch(_0x2017d4){return BPromise['reject'](_0x2017d4);}return _0x2e50e2[_0x6e3a('0x2d')]();};}function saveUpdates(_0x2eb449,_0x30b455){return function(_0x22e07b){if(_0x22e07b){return _0x22e07b['update'](_0x2eb449)[_0x6e3a('0x1b')](function(_0x3629a4){return _0x3629a4;});}return null;};}function removeEntity(_0x1bc56a,_0x5b7102){return function(_0x428a01){if(_0x428a01){return _0x428a01[_0x6e3a('0x2e')]()[_0x6e3a('0x1b')](function(){_0x1bc56a['status'](0xcc)[_0x6e3a('0x28')]();});}};}function handleEntityNotFound(_0x4c3e1a,_0x1578a7){return function(_0x5d5d0e){if(!_0x5d5d0e){_0x4c3e1a[_0x6e3a('0x26')](0x194);}return _0x5d5d0e;};}function handleError(_0x1f2397,_0x8ea674){_0x8ea674=_0x8ea674||0x1f4;return function(_0x395dc4){logger[_0x6e3a('0x22')](_0x395dc4['stack']);if(_0x395dc4[_0x6e3a('0x2f')]){delete _0x395dc4[_0x6e3a('0x2f')];}_0x1f2397[_0x6e3a('0x27')](_0x8ea674)[_0x6e3a('0x30')](_0x395dc4);};}exports[_0x6e3a('0x31')]=function(_0x139ce8,_0x4468aa){var _0x1838b3={},_0x1ab227={},_0x4e7e4b={'count':0x0,'rows':[]};var _0x2fffb2=_[_0x6e3a('0x32')](db[_0x6e3a('0x33')][_0x6e3a('0x34')],function(_0x59b84b){return{'name':_0x59b84b[_0x6e3a('0x35')],'type':_0x59b84b[_0x6e3a('0x36')][_0x6e3a('0x37')]};});_0x1ab227[_0x6e3a('0x38')]=_[_0x6e3a('0x32')](_0x2fffb2,_0x6e3a('0x2f'));_0x1ab227[_0x6e3a('0x39')]=_[_0x6e3a('0x3a')](_0x139ce8[_0x6e3a('0x39')]);_0x1ab227['filters']=_[_0x6e3a('0x3b')](_0x1ab227['model'],_0x1ab227[_0x6e3a('0x39')]);_0x1838b3[_0x6e3a('0x3c')]=_['intersection'](_0x1ab227[_0x6e3a('0x38')],qs[_0x6e3a('0x3d')](_0x139ce8[_0x6e3a('0x39')][_0x6e3a('0x3d')]));_0x1838b3[_0x6e3a('0x3c')]=_0x1838b3['attributes']['length']?_0x1838b3[_0x6e3a('0x3c')]:_0x1ab227['model'];if(!_0x139ce8[_0x6e3a('0x39')][_0x6e3a('0x3e')](_0x6e3a('0x3f'))){_0x1838b3['limit']=qs[_0x6e3a('0x2b')](_0x139ce8[_0x6e3a('0x39')][_0x6e3a('0x2b')]);_0x1838b3[_0x6e3a('0x2a')]=qs[_0x6e3a('0x2a')](_0x139ce8[_0x6e3a('0x39')][_0x6e3a('0x2a')]);}_0x1838b3[_0x6e3a('0x40')]=qs['sort'](_0x139ce8['query'][_0x6e3a('0x41')]);_0x1838b3[_0x6e3a('0x42')]=qs[_0x6e3a('0x43')](_[_0x6e3a('0x44')](_0x139ce8[_0x6e3a('0x39')],_0x1ab227[_0x6e3a('0x43')]),_0x2fffb2);if(_0x139ce8[_0x6e3a('0x39')][_0x6e3a('0x45')]){_0x1838b3['where']=_[_0x6e3a('0x46')](_0x1838b3['where'],{'$or':_[_0x6e3a('0x32')](_0x2fffb2,function(_0x40c2e4){if(_0x40c2e4[_0x6e3a('0x36')]!==_0x6e3a('0x47')){var _0x593f90={};_0x593f90[_0x40c2e4[_0x6e3a('0x2f')]]={'$like':'%'+_0x139ce8[_0x6e3a('0x39')]['filter']+'%'};return _0x593f90;}})});}_0x1838b3=_[_0x6e3a('0x46')]({},_0x1838b3,_0x139ce8['options']);var _0x278cd9={'where':_0x1838b3[_0x6e3a('0x42')]};return db['ServicenowConfiguration'][_0x6e3a('0x48')](_0x278cd9)[_0x6e3a('0x1b')](function(_0x179ab4){_0x4e7e4b['count']=_0x179ab4;if(_0x139ce8[_0x6e3a('0x39')][_0x6e3a('0x49')]){_0x1838b3[_0x6e3a('0x4a')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x1838b3);})[_0x6e3a('0x1b')](function(_0x31f54d){_0x4e7e4b[_0x6e3a('0x4b')]=_0x31f54d;return _0x4e7e4b;})['then'](respondWithFilteredResult(_0x4468aa,_0x1838b3))[_0x6e3a('0x25')](handleError(_0x4468aa,null));};exports[_0x6e3a('0x4c')]=function(_0x47b8c1,_0x2afbda){var _0x239175={'raw':![],'where':{'id':_0x47b8c1[_0x6e3a('0x4d')]['id']}},_0x3327b1={};_0x3327b1['model']=_['keys'](db[_0x6e3a('0x33')][_0x6e3a('0x34')]);_0x3327b1[_0x6e3a('0x39')]=_['keys'](_0x47b8c1[_0x6e3a('0x39')]);_0x3327b1[_0x6e3a('0x43')]=_[_0x6e3a('0x3b')](_0x3327b1[_0x6e3a('0x38')],_0x3327b1['query']);_0x239175[_0x6e3a('0x3c')]=_[_0x6e3a('0x3b')](_0x3327b1[_0x6e3a('0x38')],qs[_0x6e3a('0x3d')](_0x47b8c1['query'][_0x6e3a('0x3d')]));_0x239175[_0x6e3a('0x3c')]=_0x239175[_0x6e3a('0x3c')]['length']?_0x239175[_0x6e3a('0x3c')]:_0x3327b1['model'];if(_0x47b8c1['query']['includeAll']){_0x239175[_0x6e3a('0x4a')]=[{'all':!![]}];}_0x239175=_[_0x6e3a('0x46')]({},_0x239175,_0x47b8c1[_0x6e3a('0x4e')]);return db[_0x6e3a('0x33')][_0x6e3a('0x4f')](_0x239175)[_0x6e3a('0x1b')](handleEntityNotFound(_0x2afbda,null))[_0x6e3a('0x1b')](respondWithResult(_0x2afbda,null))[_0x6e3a('0x25')](handleError(_0x2afbda,null));};exports[_0x6e3a('0x50')]=function(_0x490d07,_0x6af5ad){return db[_0x6e3a('0x33')][_0x6e3a('0x50')](_0x490d07[_0x6e3a('0x51')],{})['then'](respondWithResult(_0x6af5ad,0xc9))['catch'](handleError(_0x6af5ad,null));};exports[_0x6e3a('0x52')]=function(_0x148fef,_0x3823d1){if(_0x148fef[_0x6e3a('0x51')]['id']){delete _0x148fef[_0x6e3a('0x51')]['id'];}return db['ServicenowConfiguration'][_0x6e3a('0x4f')]({'where':{'id':_0x148fef[_0x6e3a('0x4d')]['id']}})[_0x6e3a('0x1b')](handleEntityNotFound(_0x3823d1,null))[_0x6e3a('0x1b')](saveUpdates(_0x148fef[_0x6e3a('0x51')],null))[_0x6e3a('0x1b')](respondWithResult(_0x3823d1,null))[_0x6e3a('0x25')](handleError(_0x3823d1,null));};exports[_0x6e3a('0x2e')]=function(_0x45afd2,_0x2b8897){return db[_0x6e3a('0x33')]['find']({'where':{'id':_0x45afd2[_0x6e3a('0x4d')]['id']}})[_0x6e3a('0x1b')](handleEntityNotFound(_0x2b8897,null))[_0x6e3a('0x1b')](removeEntity(_0x2b8897,null))['catch'](handleError(_0x2b8897,null));};exports[_0x6e3a('0x53')]=function(_0x1a5e99,_0xb65ccd,_0x294a65){var _0x43b03b={};var _0x1f1bc7={};var _0x5dfb53;var _0x30a64e;return db[_0x6e3a('0x33')][_0x6e3a('0x54')]({'where':{'id':_0x1a5e99[_0x6e3a('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb65ccd,null))[_0x6e3a('0x1b')](function(_0x1b82ff){if(_0x1b82ff){_0x5dfb53=_0x1b82ff;_0x1f1bc7[_0x6e3a('0x38')]=_[_0x6e3a('0x3a')](db[_0x6e3a('0x55')][_0x6e3a('0x34')]);_0x1f1bc7[_0x6e3a('0x39')]=_['keys'](_0x1a5e99[_0x6e3a('0x39')]);_0x1f1bc7['filters']=_[_0x6e3a('0x3b')](_0x1f1bc7['model'],_0x1f1bc7[_0x6e3a('0x39')]);_0x43b03b['attributes']=_[_0x6e3a('0x3b')](_0x1f1bc7[_0x6e3a('0x38')],qs['fields'](_0x1a5e99[_0x6e3a('0x39')][_0x6e3a('0x3d')]));_0x43b03b['attributes']=_0x43b03b[_0x6e3a('0x3c')][_0x6e3a('0x56')]?_0x43b03b[_0x6e3a('0x3c')]:_0x1f1bc7['model'];_0x43b03b[_0x6e3a('0x40')]=qs['sort'](_0x1a5e99[_0x6e3a('0x39')]['sort']);_0x43b03b[_0x6e3a('0x42')]=qs[_0x6e3a('0x43')](_[_0x6e3a('0x44')](_0x1a5e99[_0x6e3a('0x39')],_0x1f1bc7[_0x6e3a('0x43')]));if(_0x1a5e99[_0x6e3a('0x39')][_0x6e3a('0x45')]){_0x43b03b[_0x6e3a('0x42')]=_[_0x6e3a('0x46')](_0x43b03b[_0x6e3a('0x42')],{'$or':_[_0x6e3a('0x32')](_0x43b03b[_0x6e3a('0x3c')],function(_0x45b037){var _0x2db97d={};_0x2db97d[_0x45b037]={'$like':'%'+_0x1a5e99[_0x6e3a('0x39')][_0x6e3a('0x45')]+'%'};return _0x2db97d;})});}_0x43b03b=_[_0x6e3a('0x46')]({},_0x43b03b,_0x1a5e99[_0x6e3a('0x4e')]);return _0x5dfb53[_0x6e3a('0x53')](_0x43b03b);}})[_0x6e3a('0x1b')](function(_0x2b7ae0){if(_0x2b7ae0){_0x30a64e=_0x2b7ae0[_0x6e3a('0x56')];if(!_0x1a5e99[_0x6e3a('0x39')][_0x6e3a('0x3e')](_0x6e3a('0x3f'))){_0x43b03b[_0x6e3a('0x2b')]=qs['limit'](_0x1a5e99[_0x6e3a('0x39')][_0x6e3a('0x2b')]);_0x43b03b[_0x6e3a('0x2a')]=qs[_0x6e3a('0x2a')](_0x1a5e99[_0x6e3a('0x39')]['offset']);}return _0x5dfb53[_0x6e3a('0x53')](_0x43b03b);}})[_0x6e3a('0x1b')](function(_0x3e0b30){if(_0x3e0b30){return _0x3e0b30?{'count':_0x30a64e,'rows':_0x3e0b30}:null;}})['then'](respondWithResult(_0xb65ccd,null))['catch'](handleError(_0xb65ccd,null));};exports[_0x6e3a('0x57')]=function(_0x3f4d3d,_0x5d7929,_0x32eb92){var _0x34b174={};var _0x4e087a={};var _0x2f6dfe;var _0x50f37c;return db[_0x6e3a('0x33')][_0x6e3a('0x54')]({'where':{'id':_0x3f4d3d[_0x6e3a('0x4d')]['id']}})[_0x6e3a('0x1b')](handleEntityNotFound(_0x5d7929,null))[_0x6e3a('0x1b')](function(_0x56e708){if(_0x56e708){_0x2f6dfe=_0x56e708;_0x4e087a[_0x6e3a('0x38')]=_[_0x6e3a('0x3a')](db[_0x6e3a('0x55')][_0x6e3a('0x34')]);_0x4e087a['query']=_[_0x6e3a('0x3a')](_0x3f4d3d[_0x6e3a('0x39')]);_0x4e087a['filters']=_['intersection'](_0x4e087a[_0x6e3a('0x38')],_0x4e087a[_0x6e3a('0x39')]);_0x34b174['attributes']=_[_0x6e3a('0x3b')](_0x4e087a[_0x6e3a('0x38')],qs[_0x6e3a('0x3d')](_0x3f4d3d[_0x6e3a('0x39')][_0x6e3a('0x3d')]));_0x34b174[_0x6e3a('0x3c')]=_0x34b174[_0x6e3a('0x3c')][_0x6e3a('0x56')]?_0x34b174[_0x6e3a('0x3c')]:_0x4e087a[_0x6e3a('0x38')];_0x34b174[_0x6e3a('0x40')]=qs[_0x6e3a('0x41')](_0x3f4d3d[_0x6e3a('0x39')][_0x6e3a('0x41')]);_0x34b174[_0x6e3a('0x42')]=qs[_0x6e3a('0x43')](_[_0x6e3a('0x44')](_0x3f4d3d[_0x6e3a('0x39')],_0x4e087a[_0x6e3a('0x43')]));if(_0x3f4d3d[_0x6e3a('0x39')][_0x6e3a('0x45')]){_0x34b174['where']=_[_0x6e3a('0x46')](_0x34b174[_0x6e3a('0x42')],{'$or':_[_0x6e3a('0x32')](_0x34b174[_0x6e3a('0x3c')],function(_0x20f6b3){var _0x36d522={};_0x36d522[_0x20f6b3]={'$like':'%'+_0x3f4d3d[_0x6e3a('0x39')][_0x6e3a('0x45')]+'%'};return _0x36d522;})});}_0x34b174=_['merge']({},_0x34b174,_0x3f4d3d[_0x6e3a('0x4e')]);return _0x2f6dfe[_0x6e3a('0x57')](_0x34b174);}})[_0x6e3a('0x1b')](function(_0x3e740c){if(_0x3e740c){_0x50f37c=_0x3e740c['length'];if(!_0x3f4d3d[_0x6e3a('0x39')][_0x6e3a('0x3e')](_0x6e3a('0x3f'))){_0x34b174[_0x6e3a('0x2b')]=qs[_0x6e3a('0x2b')](_0x3f4d3d[_0x6e3a('0x39')]['limit']);_0x34b174[_0x6e3a('0x2a')]=qs['offset'](_0x3f4d3d['query'][_0x6e3a('0x2a')]);}return _0x2f6dfe[_0x6e3a('0x57')](_0x34b174);}})[_0x6e3a('0x1b')](function(_0x208e65){if(_0x208e65){return _0x208e65?{'count':_0x50f37c,'rows':_0x208e65}:null;}})[_0x6e3a('0x1b')](respondWithResult(_0x5d7929,null))[_0x6e3a('0x25')](handleError(_0x5d7929,null));};exports[_0x6e3a('0x58')]=function(_0x45f83b,_0x5728ce,_0xfd2fe8){var _0x4ce629={};var _0x1f63d2={};var _0x2c2573;var _0x1c0e28;return db['ServicenowConfiguration'][_0x6e3a('0x54')]({'where':{'id':_0x45f83b[_0x6e3a('0x4d')]['id']}})[_0x6e3a('0x1b')](handleEntityNotFound(_0x5728ce,null))[_0x6e3a('0x1b')](function(_0x111740){if(_0x111740){_0x2c2573=_0x111740;_0x1f63d2[_0x6e3a('0x38')]=_[_0x6e3a('0x3a')](db['ServicenowField'][_0x6e3a('0x34')]);_0x1f63d2[_0x6e3a('0x39')]=_[_0x6e3a('0x3a')](_0x45f83b[_0x6e3a('0x39')]);_0x1f63d2[_0x6e3a('0x43')]=_[_0x6e3a('0x3b')](_0x1f63d2[_0x6e3a('0x38')],_0x1f63d2['query']);_0x4ce629[_0x6e3a('0x3c')]=_[_0x6e3a('0x3b')](_0x1f63d2[_0x6e3a('0x38')],qs[_0x6e3a('0x3d')](_0x45f83b[_0x6e3a('0x39')][_0x6e3a('0x3d')]));_0x4ce629[_0x6e3a('0x3c')]=_0x4ce629[_0x6e3a('0x3c')][_0x6e3a('0x56')]?_0x4ce629[_0x6e3a('0x3c')]:_0x1f63d2[_0x6e3a('0x38')];_0x4ce629[_0x6e3a('0x40')]=qs[_0x6e3a('0x41')](_0x45f83b[_0x6e3a('0x39')][_0x6e3a('0x41')]);_0x4ce629[_0x6e3a('0x42')]=qs[_0x6e3a('0x43')](_[_0x6e3a('0x44')](_0x45f83b[_0x6e3a('0x39')],_0x1f63d2[_0x6e3a('0x43')]));if(_0x45f83b[_0x6e3a('0x39')]['filter']){_0x4ce629[_0x6e3a('0x42')]=_[_0x6e3a('0x46')](_0x4ce629[_0x6e3a('0x42')],{'$or':_[_0x6e3a('0x32')](_0x4ce629['attributes'],function(_0x3fc666){var _0xc20d02={};_0xc20d02[_0x3fc666]={'$like':'%'+_0x45f83b[_0x6e3a('0x39')]['filter']+'%'};return _0xc20d02;})});}_0x4ce629=_[_0x6e3a('0x46')]({},_0x4ce629,_0x45f83b[_0x6e3a('0x4e')]);return _0x2c2573[_0x6e3a('0x58')](_0x4ce629);}})[_0x6e3a('0x1b')](function(_0x5f1efe){if(_0x5f1efe){_0x1c0e28=_0x5f1efe[_0x6e3a('0x56')];if(!_0x45f83b[_0x6e3a('0x39')][_0x6e3a('0x3e')](_0x6e3a('0x3f'))){_0x4ce629['limit']=qs[_0x6e3a('0x2b')](_0x45f83b[_0x6e3a('0x39')]['limit']);_0x4ce629[_0x6e3a('0x2a')]=qs[_0x6e3a('0x2a')](_0x45f83b[_0x6e3a('0x39')][_0x6e3a('0x2a')]);}return _0x2c2573[_0x6e3a('0x58')](_0x4ce629);}})[_0x6e3a('0x1b')](function(_0xe3d0cb){if(_0xe3d0cb){return _0xe3d0cb?{'count':_0x1c0e28,'rows':_0xe3d0cb}:null;}})[_0x6e3a('0x1b')](respondWithResult(_0x5728ce,null))[_0x6e3a('0x25')](handleError(_0x5728ce,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 36ad74e..18e393e 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 _0xba49=['api','moment','bluebird','rimraf','../../config/environment','exports','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x1aaf72,_0x4f223a){var _0x3ecad0=function(_0x553981){while(--_0x553981){_0x1aaf72['push'](_0x1aaf72['shift']());}};_0x3ecad0(++_0x4f223a);}(_0xba49,0xad));var _0x9ba4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xba49[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x9ba4('0x0'));var util=require(_0x9ba4('0x1'));var logger=require(_0x9ba4('0x2'))(_0x9ba4('0x3'));var moment=require(_0x9ba4('0x4'));var BPromise=require(_0x9ba4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba4('0x6'));var config=require(_0x9ba4('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x9ba4('0x8')]=function(_0x3bd007,_0x4fe9a0){return _0x3bd007[_0x9ba4('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x9ba4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd7=['bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','moment'];(function(_0x2b9d5c,_0x173518){var _0x37bb93=function(_0x5515cd){while(--_0x5515cd){_0x2b9d5c['push'](_0x2b9d5c['shift']());}};_0x37bb93(++_0x173518);}(_0x9dd7,0xa4));var _0x79dd=function(_0x588f8c,_0x36d0f6){_0x588f8c=_0x588f8c-0x0;var _0x53fe9e=_0x9dd7[_0x588f8c];return _0x53fe9e;};'use strict';var _=require(_0x79dd('0x0'));var util=require(_0x79dd('0x1'));var logger=require(_0x79dd('0x2'))('api');var moment=require(_0x79dd('0x3'));var BPromise=require(_0x79dd('0x4'));var rp=require(_0x79dd('0x5'));var fs=require('fs');var path=require(_0x79dd('0x6'));var rimraf=require('rimraf');var config=require(_0x79dd('0x7'));var attributes=require(_0x79dd('0x8'));module[_0x79dd('0x9')]=function(_0x59ee53,_0x16f681){return _0x59ee53[_0x79dd('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x79dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 6164b90..76b2dff 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 _0x4481=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4481,0x160));var _0x1448=function(_0x564308,_0x5bb087){_0x564308=_0x564308-0x0;var _0x3df3b1=_0x4481[_0x564308];return _0x3df3b1;};'use strict';var _=require(_0x1448('0x0'));var util=require(_0x1448('0x1'));var moment=require(_0x1448('0x2'));var BPromise=require(_0x1448('0x3'));var rs=require(_0x1448('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1448('0x5'))['db'];var utils=require(_0x1448('0x6'));var logger=require(_0x1448('0x7'))(_0x1448('0x8'));var config=require(_0x1448('0x9'));var jayson=require(_0x1448('0xa'));var client=jayson[_0x1448('0xb')][_0x1448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d5707,_0x7b640b,_0x24b1a9){return new BPromise(function(_0x4d6665,_0x59c372){return client['request'](_0x2d5707,_0x24b1a9)[_0x1448('0xd')](function(_0x5451ae){logger['info'](_0x1448('0xe'),_0x7b640b,_0x1448('0xf'));logger[_0x1448('0x10')](_0x1448('0x11'),_0x7b640b,'request\x20sent',JSON[_0x1448('0x12')](_0x5451ae));if(_0x5451ae[_0x1448('0x13')]){if(_0x5451ae['error']['code']===0x1f4){logger[_0x1448('0x13')](_0x1448('0xe'),_0x7b640b,_0x5451ae[_0x1448('0x13')][_0x1448('0x14')]);return _0x59c372(_0x5451ae[_0x1448('0x13')][_0x1448('0x14')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x7b640b,_0x5451ae['error']['message']);return _0x4d6665(_0x5451ae[_0x1448('0x13')][_0x1448('0x14')]);}else{logger[_0x1448('0x15')](_0x1448('0xe'),_0x7b640b,_0x1448('0xf'));_0x4d6665(_0x5451ae['result'][_0x1448('0x14')]);}})[_0x1448('0x16')](function(_0x19324){logger['error'](_0x1448('0xe'),_0x7b640b,_0x19324);_0x59c372(_0x19324);});});} \ No newline at end of file +var _0x1773=['jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x374b3e,_0x348f32){var _0xdd8284=function(_0x5632e8){while(--_0x5632e8){_0x374b3e['push'](_0x374b3e['shift']());}};_0xdd8284(++_0x348f32);}(_0x1773,0x1c5));var _0x3177=function(_0x204a5c,_0x49dc68){_0x204a5c=_0x204a5c-0x0;var _0x232aeb=_0x1773[_0x204a5c];return _0x232aeb;};'use strict';var _=require(_0x3177('0x0'));var util=require(_0x3177('0x1'));var moment=require('moment');var BPromise=require(_0x3177('0x2'));var rs=require(_0x3177('0x3'));var fs=require('fs');var Redis=require(_0x3177('0x4'));var db=require(_0x3177('0x5'))['db'];var utils=require(_0x3177('0x6'));var logger=require(_0x3177('0x7'))('rpc');var config=require(_0x3177('0x8'));var jayson=require(_0x3177('0x9'));var client=jayson[_0x3177('0xa')][_0x3177('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55a729,_0x95b8d7,_0x4828bc){return new BPromise(function(_0x29b44c,_0x14feb4){return client['request'](_0x55a729,_0x4828bc)[_0x3177('0xc')](function(_0x2e0350){logger[_0x3177('0xd')](_0x3177('0xe'),_0x95b8d7,'request\x20sent');logger['debug'](_0x3177('0xf'),_0x95b8d7,_0x3177('0x10'),JSON[_0x3177('0x11')](_0x2e0350));if(_0x2e0350[_0x3177('0x12')]){if(_0x2e0350[_0x3177('0x12')]['code']===0x1f4){logger['error'](_0x3177('0xe'),_0x95b8d7,_0x2e0350['error'][_0x3177('0x13')]);return _0x14feb4(_0x2e0350[_0x3177('0x12')][_0x3177('0x13')]);}logger[_0x3177('0x12')](_0x3177('0xe'),_0x95b8d7,_0x2e0350[_0x3177('0x12')][_0x3177('0x13')]);return _0x29b44c(_0x2e0350[_0x3177('0x12')][_0x3177('0x13')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x95b8d7,_0x3177('0x10'));_0x29b44c(_0x2e0350[_0x3177('0x14')][_0x3177('0x13')]);}})[_0x3177('0x15')](function(_0x42e560){logger[_0x3177('0x12')](_0x3177('0xe'),_0x95b8d7,_0x42e560);_0x14feb4(_0x42e560);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 645f345..6ef3a29 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 _0x0ac6=['create','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x0ac6,0x16d));var _0x60ac=function(_0x3e078a,_0x115745){_0x3e078a=_0x3e078a-0x0;var _0x333e5c=_0x0ac6[_0x3e078a];return _0x333e5c;};'use strict';var multer=require(_0x60ac('0x0'));var util=require('util');var path=require(_0x60ac('0x1'));var timeout=require(_0x60ac('0x2'));var express=require(_0x60ac('0x3'));var router=express['Router']();var auth=require(_0x60ac('0x4'));var interaction=require(_0x60ac('0x5'));var config=require(_0x60ac('0x6'));var controller=require(_0x60ac('0x7'));router[_0x60ac('0x8')]('/',auth[_0x60ac('0x9')](),controller[_0x60ac('0xa')]);router[_0x60ac('0x8')](_0x60ac('0xb'),auth[_0x60ac('0x9')](),controller['show']);router[_0x60ac('0xc')]('/',auth[_0x60ac('0x9')](),controller[_0x60ac('0xd')]);router[_0x60ac('0xe')](_0x60ac('0xb'),auth[_0x60ac('0x9')](),controller[_0x60ac('0xf')]);router[_0x60ac('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x60ac('0x11')]=router; \ No newline at end of file +var _0xd6ef=['connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','show','create','put','delete','destroy','exports','multer','util','path'];(function(_0x3b39c7,_0x3ef767){var _0x1a3a18=function(_0x277fb6){while(--_0x277fb6){_0x3b39c7['push'](_0x3b39c7['shift']());}};_0x1a3a18(++_0x3ef767);}(_0xd6ef,0x1dd));var _0xfd6e=function(_0x5a04ac,_0x17bd68){_0x5a04ac=_0x5a04ac-0x0;var _0x3d15bd=_0xd6ef[_0x5a04ac];return _0x3d15bd;};'use strict';var multer=require(_0xfd6e('0x0'));var util=require(_0xfd6e('0x1'));var path=require(_0xfd6e('0x2'));var timeout=require(_0xfd6e('0x3'));var express=require(_0xfd6e('0x4'));var router=express[_0xfd6e('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd6e('0x6'));var controller=require('./intServicenowField.controller');router[_0xfd6e('0x7')]('/',auth[_0xfd6e('0x8')](),controller[_0xfd6e('0x9')]);router[_0xfd6e('0x7')]('/:id',auth[_0xfd6e('0x8')](),controller[_0xfd6e('0xa')]);router['post']('/',auth[_0xfd6e('0x8')](),controller[_0xfd6e('0xb')]);router[_0xfd6e('0xc')]('/:id',auth[_0xfd6e('0x8')](),controller['update']);router[_0xfd6e('0xd')]('/:id',auth[_0xfd6e('0x8')](),controller[_0xfd6e('0xe')]);module[_0xfd6e('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a0fc33b..cec456d 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 _0x6e2a=['variable','customVariable','keyValue','string','STRING','sequelize','ENUM'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x6e2a,0x140));var _0xa6e2=function(_0x5dbc8d,_0x10d22f){_0x5dbc8d=_0x5dbc8d-0x0;var _0x2bc6c0=_0x6e2a[_0x5dbc8d];return _0x2bc6c0;};'use strict';var Sequelize=require(_0xa6e2('0x0'));module['exports']={'type':{'type':Sequelize[_0xa6e2('0x1')]('string',_0xa6e2('0x2'),_0xa6e2('0x3'),_0xa6e2('0x4')),'defaultValue':_0xa6e2('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa6e2('0x1')]('string','variable',_0xa6e2('0x3'))},'keyContent':{'type':Sequelize[_0xa6e2('0x6')]},'idField':{'type':Sequelize[_0xa6e2('0x6')]},'nameField':{'type':Sequelize[_0xa6e2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6e2('0x6')]}}; \ No newline at end of file +var _0x76e0=['ENUM','BOOLEAN','string','customVariable','keyValue','STRING'];(function(_0x3d88ef,_0x4ca180){var _0x21ee9e=function(_0x18fee0){while(--_0x18fee0){_0x3d88ef['push'](_0x3d88ef['shift']());}};_0x21ee9e(++_0x4ca180);}(_0x76e0,0x18e));var _0x076e=function(_0x252972,_0xccc696){_0x252972=_0x252972-0x0;var _0x2bf54d=_0x76e0[_0x252972];return _0x2bf54d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x076e('0x0'),'variable',_0x076e('0x1'),_0x076e('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x076e('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x076e('0x4')](_0x076e('0x0'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x076e('0x3')]},'nameField':{'type':Sequelize[_0x076e('0x3')]},'customField':{'type':Sequelize[_0x076e('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x076e('0x3')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 943405a..f1645ef 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 _0x9bc7=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','fieldName','type','model','map','keys','filters','intersection','attributes','fields','query','length','nolimit','order','filter','where','merge','VIRTUAL','options','ServicenowField','include','rows','catch','params','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9bc7[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x79bc('0x0'));var emlformat=require(_0x79bc('0x1'));var rimraf=require(_0x79bc('0x2'));var zipdir=require(_0x79bc('0x3'));var jsonpatch=require(_0x79bc('0x4'));var rp=require(_0x79bc('0x5'));var moment=require(_0x79bc('0x6'));var BPromise=require(_0x79bc('0x7'));var Mustache=require(_0x79bc('0x8'));var util=require(_0x79bc('0x9'));var path=require('path');var sox=require(_0x79bc('0xa'));var csv=require(_0x79bc('0xb'));var ejs=require(_0x79bc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x79bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x79bc('0xe'));var deskjs=require(_0x79bc('0xf'));var toCsv=require(_0x79bc('0xb'));var querystring=require(_0x79bc('0x10'));var Papa=require(_0x79bc('0x11'));var Redis=require('ioredis');var authService=require(_0x79bc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x79bc('0x13'));var hardwareService=require(_0x79bc('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x79bc('0x15'));var config=require(_0x79bc('0x16'));var licenseUtil=require(_0x79bc('0x17'));var db=require(_0x79bc('0x18'))['db'];function respondWithStatusCode(_0x174eff,_0x401de9){_0x401de9=_0x401de9||0xcc;return function(_0x29e987){if(_0x29e987){return _0x174eff[_0x79bc('0x19')](_0x401de9);}return _0x174eff['status'](_0x401de9)[_0x79bc('0x1a')]();};}function respondWithResult(_0x57530f,_0x404adf){_0x404adf=_0x404adf||0xc8;return function(_0x2ee065){if(_0x2ee065){return _0x57530f[_0x79bc('0x1b')](_0x404adf)[_0x79bc('0x1c')](_0x2ee065);}};}function respondWithFilteredResult(_0x564d68,_0x21cb53){return function(_0x3e4244){if(_0x3e4244){var _0x510906=_0x3e4244[_0x79bc('0x1d')],_0x1b3b2c=_0x21cb53['offset'],_0x561e9a=_0x21cb53[_0x79bc('0x1e')]+_0x21cb53[_0x79bc('0x1f')],_0x403ebe;if(_0x561e9a>=_0x510906){_0x561e9a=_0x510906;_0x403ebe=0xc8;}else{_0x403ebe=0xce;}_0x564d68[_0x79bc('0x1b')](_0x403ebe);return _0x564d68[_0x79bc('0x20')](_0x79bc('0x21'),_0x1b3b2c+'-'+_0x561e9a+'/'+_0x510906)['json'](_0x3e4244);}return null;};}function patchUpdates(_0x30e0fb){return function(_0x2f3b0c){try{jsonpatch[_0x79bc('0x22')](_0x2f3b0c,_0x30e0fb,!![]);}catch(_0x269d07){return BPromise['reject'](_0x269d07);}return _0x2f3b0c[_0x79bc('0x23')]();};}function saveUpdates(_0x52a423,_0x51282d){return function(_0xb7ab74){if(_0xb7ab74){return _0xb7ab74[_0x79bc('0x24')](_0x52a423)[_0x79bc('0x25')](function(_0x533720){return _0x533720;});}return null;};}function removeEntity(_0xc9c88a,_0x3cbe59){return function(_0x1a62fa){if(_0x1a62fa){return _0x1a62fa[_0x79bc('0x26')]()[_0x79bc('0x25')](function(){_0xc9c88a[_0x79bc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc690,_0x307147){return function(_0x36da6f){if(!_0x36da6f){_0x5bc690[_0x79bc('0x19')](0x194);}return _0x36da6f;};}function handleError(_0x3a2467,_0x27b266){_0x27b266=_0x27b266||0x1f4;return function(_0x121a28){logger[_0x79bc('0x27')](_0x121a28[_0x79bc('0x28')]);if(_0x121a28[_0x79bc('0x29')]){delete _0x121a28[_0x79bc('0x29')];}_0x3a2467[_0x79bc('0x1b')](_0x27b266)[_0x79bc('0x2a')](_0x121a28);};}exports['index']=function(_0x4b3eb9,_0x32a531){var _0x18f21e={},_0x5bee88={},_0x1d6141={'count':0x0,'rows':[]};var _0x2aa24d=_['map'](db['ServicenowField']['rawAttributes'],function(_0x143bb3){return{'name':_0x143bb3[_0x79bc('0x2b')],'type':_0x143bb3[_0x79bc('0x2c')]['key']};});_0x5bee88[_0x79bc('0x2d')]=_[_0x79bc('0x2e')](_0x2aa24d,'name');_0x5bee88['query']=_[_0x79bc('0x2f')](_0x4b3eb9['query']);_0x5bee88[_0x79bc('0x30')]=_[_0x79bc('0x31')](_0x5bee88[_0x79bc('0x2d')],_0x5bee88['query']);_0x18f21e[_0x79bc('0x32')]=_['intersection'](_0x5bee88[_0x79bc('0x2d')],qs[_0x79bc('0x33')](_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x33')]));_0x18f21e[_0x79bc('0x32')]=_0x18f21e['attributes'][_0x79bc('0x35')]?_0x18f21e[_0x79bc('0x32')]:_0x5bee88[_0x79bc('0x2d')];if(!_0x4b3eb9[_0x79bc('0x34')]['hasOwnProperty'](_0x79bc('0x36'))){_0x18f21e[_0x79bc('0x1f')]=qs['limit'](_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x1f')]);_0x18f21e[_0x79bc('0x1e')]=qs['offset'](_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x1e')]);}_0x18f21e[_0x79bc('0x37')]=qs['sort'](_0x4b3eb9[_0x79bc('0x34')]['sort']);_0x18f21e['where']=qs[_0x79bc('0x30')](_['pick'](_0x4b3eb9[_0x79bc('0x34')],_0x5bee88[_0x79bc('0x30')]),_0x2aa24d);if(_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x38')]){_0x18f21e[_0x79bc('0x39')]=_[_0x79bc('0x3a')](_0x18f21e['where'],{'$or':_['map'](_0x2aa24d,function(_0x1dafbb){if(_0x1dafbb[_0x79bc('0x2c')]!==_0x79bc('0x3b')){var _0x510aae={};_0x510aae[_0x1dafbb[_0x79bc('0x29')]]={'$like':'%'+_0x4b3eb9['query']['filter']+'%'};return _0x510aae;}})});}_0x18f21e=_[_0x79bc('0x3a')]({},_0x18f21e,_0x4b3eb9[_0x79bc('0x3c')]);var _0xbb2ede={'where':_0x18f21e[_0x79bc('0x39')]};return db[_0x79bc('0x3d')][_0x79bc('0x1d')](_0xbb2ede)[_0x79bc('0x25')](function(_0x2f1141){_0x1d6141[_0x79bc('0x1d')]=_0x2f1141;if(_0x4b3eb9[_0x79bc('0x34')]['includeAll']){_0x18f21e[_0x79bc('0x3e')]=[{'all':!![]}];}return db[_0x79bc('0x3d')]['findAll'](_0x18f21e);})[_0x79bc('0x25')](function(_0x2576ac){_0x1d6141[_0x79bc('0x3f')]=_0x2576ac;return _0x1d6141;})[_0x79bc('0x25')](respondWithFilteredResult(_0x32a531,_0x18f21e))[_0x79bc('0x40')](handleError(_0x32a531,null));};exports['show']=function(_0x3da2d9,_0x3ea23c){var _0x3d96a4={'raw':!![],'where':{'id':_0x3da2d9[_0x79bc('0x41')]['id']}},_0x3b9494={};_0x3b9494[_0x79bc('0x2d')]=_[_0x79bc('0x2f')](db[_0x79bc('0x3d')][_0x79bc('0x42')]);_0x3b9494[_0x79bc('0x34')]=_[_0x79bc('0x2f')](_0x3da2d9['query']);_0x3b9494[_0x79bc('0x30')]=_[_0x79bc('0x31')](_0x3b9494[_0x79bc('0x2d')],_0x3b9494[_0x79bc('0x34')]);_0x3d96a4[_0x79bc('0x32')]=_[_0x79bc('0x31')](_0x3b9494[_0x79bc('0x2d')],qs[_0x79bc('0x33')](_0x3da2d9[_0x79bc('0x34')][_0x79bc('0x33')]));_0x3d96a4[_0x79bc('0x32')]=_0x3d96a4[_0x79bc('0x32')]['length']?_0x3d96a4[_0x79bc('0x32')]:_0x3b9494[_0x79bc('0x2d')];if(_0x3da2d9[_0x79bc('0x34')]['includeAll']){_0x3d96a4['include']=[{'all':!![]}];}_0x3d96a4=_[_0x79bc('0x3a')]({},_0x3d96a4,_0x3da2d9[_0x79bc('0x3c')]);return db[_0x79bc('0x3d')][_0x79bc('0x43')](_0x3d96a4)['then'](handleEntityNotFound(_0x3ea23c,null))[_0x79bc('0x25')](respondWithResult(_0x3ea23c,null))[_0x79bc('0x40')](handleError(_0x3ea23c,null));};exports['create']=function(_0x560ccf,_0x984270){return db[_0x79bc('0x3d')][_0x79bc('0x44')](_0x560ccf[_0x79bc('0x45')],{})[_0x79bc('0x25')](respondWithResult(_0x984270,0xc9))[_0x79bc('0x40')](handleError(_0x984270,null));};exports['update']=function(_0x519be4,_0x1e86cd){if(_0x519be4[_0x79bc('0x45')]['id']){delete _0x519be4[_0x79bc('0x45')]['id'];}return db[_0x79bc('0x3d')]['find']({'where':{'id':_0x519be4[_0x79bc('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e86cd,null))[_0x79bc('0x25')](saveUpdates(_0x519be4[_0x79bc('0x45')],null))[_0x79bc('0x25')](respondWithResult(_0x1e86cd,null))['catch'](handleError(_0x1e86cd,null));};exports[_0x79bc('0x26')]=function(_0x43388d,_0x4c7d28){return db[_0x79bc('0x3d')][_0x79bc('0x43')]({'where':{'id':_0x43388d[_0x79bc('0x41')]['id']}})[_0x79bc('0x25')](handleEntityNotFound(_0x4c7d28,null))[_0x79bc('0x25')](removeEntity(_0x4c7d28,null))[_0x79bc('0x40')](handleError(_0x4c7d28,null));}; \ No newline at end of file +var _0xb19a=['update','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','save','then','destroy','error','name','send','index','ServicenowField','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0x179da7,_0x5d1e55){var _0x7d4a8f=function(_0x541de9){while(--_0x541de9){_0x179da7['push'](_0x179da7['shift']());}};_0x7d4a8f(++_0x5d1e55);}(_0xb19a,0xd0));var _0xab19=function(_0x1645b2,_0x144abb){_0x1645b2=_0x1645b2-0x0;var _0x143814=_0xb19a[_0x1645b2];return _0x143814;};'use strict';var pdf=require(_0xab19('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab19('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab19('0x2'));var BPromise=require(_0xab19('0x3'));var Mustache=require(_0xab19('0x4'));var util=require(_0xab19('0x5'));var path=require(_0xab19('0x6'));var sox=require(_0xab19('0x7'));var csv=require(_0xab19('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xab19('0x9'));var squel=require(_0xab19('0xa'));var crypto=require('crypto');var jsforce=require(_0xab19('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xab19('0x8'));var querystring=require(_0xab19('0xc'));var Papa=require(_0xab19('0xd'));var Redis=require(_0xab19('0xe'));var authService=require(_0xab19('0xf'));var qs=require(_0xab19('0x10'));var as=require(_0xab19('0x11'));var hardwareService=require(_0xab19('0x12'));var logger=require(_0xab19('0x13'))(_0xab19('0x14'));var utils=require(_0xab19('0x15'));var config=require(_0xab19('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cec9e,_0x55c2ed){_0x55c2ed=_0x55c2ed||0xcc;return function(_0x391721){if(_0x391721){return _0x2cec9e[_0xab19('0x17')](_0x55c2ed);}return _0x2cec9e[_0xab19('0x18')](_0x55c2ed)[_0xab19('0x19')]();};}function respondWithResult(_0x336470,_0x475596){_0x475596=_0x475596||0xc8;return function(_0x10fc99){if(_0x10fc99){return _0x336470['status'](_0x475596)[_0xab19('0x1a')](_0x10fc99);}};}function respondWithFilteredResult(_0x43aece,_0x581c6d){return function(_0x4257d7){if(_0x4257d7){var _0x30d3f1=_0x4257d7[_0xab19('0x1b')],_0x496473=_0x581c6d[_0xab19('0x1c')],_0x4d2927=_0x581c6d[_0xab19('0x1c')]+_0x581c6d['limit'],_0x2284b8;if(_0x4d2927>=_0x30d3f1){_0x4d2927=_0x30d3f1;_0x2284b8=0xc8;}else{_0x2284b8=0xce;}_0x43aece[_0xab19('0x18')](_0x2284b8);return _0x43aece[_0xab19('0x1d')]('Content-Range',_0x496473+'-'+_0x4d2927+'/'+_0x30d3f1)[_0xab19('0x1a')](_0x4257d7);}return null;};}function patchUpdates(_0x1ace23){return function(_0x1232cd){try{jsonpatch['apply'](_0x1232cd,_0x1ace23,!![]);}catch(_0x576381){return BPromise['reject'](_0x576381);}return _0x1232cd[_0xab19('0x1e')]();};}function saveUpdates(_0x4279e7,_0x4d6f8c){return function(_0x17615b){if(_0x17615b){return _0x17615b['update'](_0x4279e7)[_0xab19('0x1f')](function(_0x568f4f){return _0x568f4f;});}return null;};}function removeEntity(_0x57814e,_0x5e1d7a){return function(_0x27635c){if(_0x27635c){return _0x27635c[_0xab19('0x20')]()[_0xab19('0x1f')](function(){_0x57814e[_0xab19('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x278948,_0x1685eb){return function(_0x3c681f){if(!_0x3c681f){_0x278948[_0xab19('0x17')](0x194);}return _0x3c681f;};}function handleError(_0x1c1ff4,_0xed742b){_0xed742b=_0xed742b||0x1f4;return function(_0x3743c7){logger[_0xab19('0x21')](_0x3743c7['stack']);if(_0x3743c7[_0xab19('0x22')]){delete _0x3743c7[_0xab19('0x22')];}_0x1c1ff4[_0xab19('0x18')](_0xed742b)[_0xab19('0x23')](_0x3743c7);};}exports[_0xab19('0x24')]=function(_0x168fa5,_0x3f4d5e){var _0x1538e5={},_0x5946ee={},_0x2452c8={'count':0x0,'rows':[]};var _0x233da0=_['map'](db[_0xab19('0x25')]['rawAttributes'],function(_0x227cb4){return{'name':_0x227cb4[_0xab19('0x26')],'type':_0x227cb4['type'][_0xab19('0x27')]};});_0x5946ee['model']=_[_0xab19('0x28')](_0x233da0,'name');_0x5946ee[_0xab19('0x29')]=_[_0xab19('0x2a')](_0x168fa5['query']);_0x5946ee[_0xab19('0x2b')]=_[_0xab19('0x2c')](_0x5946ee[_0xab19('0x2d')],_0x5946ee['query']);_0x1538e5[_0xab19('0x2e')]=_[_0xab19('0x2c')](_0x5946ee['model'],qs[_0xab19('0x2f')](_0x168fa5[_0xab19('0x29')][_0xab19('0x2f')]));_0x1538e5[_0xab19('0x2e')]=_0x1538e5['attributes'][_0xab19('0x30')]?_0x1538e5[_0xab19('0x2e')]:_0x5946ee[_0xab19('0x2d')];if(!_0x168fa5['query']['hasOwnProperty'](_0xab19('0x31'))){_0x1538e5[_0xab19('0x32')]=qs[_0xab19('0x32')](_0x168fa5['query'][_0xab19('0x32')]);_0x1538e5['offset']=qs[_0xab19('0x1c')](_0x168fa5[_0xab19('0x29')][_0xab19('0x1c')]);}_0x1538e5['order']=qs[_0xab19('0x33')](_0x168fa5[_0xab19('0x29')][_0xab19('0x33')]);_0x1538e5['where']=qs['filters'](_[_0xab19('0x34')](_0x168fa5[_0xab19('0x29')],_0x5946ee[_0xab19('0x2b')]),_0x233da0);if(_0x168fa5[_0xab19('0x29')][_0xab19('0x35')]){_0x1538e5[_0xab19('0x36')]=_[_0xab19('0x37')](_0x1538e5[_0xab19('0x36')],{'$or':_['map'](_0x233da0,function(_0x4cc407){if(_0x4cc407[_0xab19('0x38')]!==_0xab19('0x39')){var _0x98ccde={};_0x98ccde[_0x4cc407[_0xab19('0x22')]]={'$like':'%'+_0x168fa5[_0xab19('0x29')][_0xab19('0x35')]+'%'};return _0x98ccde;}})});}_0x1538e5=_[_0xab19('0x37')]({},_0x1538e5,_0x168fa5[_0xab19('0x3a')]);var _0x3ff5ae={'where':_0x1538e5[_0xab19('0x36')]};return db[_0xab19('0x25')]['count'](_0x3ff5ae)[_0xab19('0x1f')](function(_0x5140e8){_0x2452c8[_0xab19('0x1b')]=_0x5140e8;if(_0x168fa5[_0xab19('0x29')][_0xab19('0x3b')]){_0x1538e5['include']=[{'all':!![]}];}return db[_0xab19('0x25')][_0xab19('0x3c')](_0x1538e5);})[_0xab19('0x1f')](function(_0x1528e8){_0x2452c8['rows']=_0x1528e8;return _0x2452c8;})['then'](respondWithFilteredResult(_0x3f4d5e,_0x1538e5))[_0xab19('0x3d')](handleError(_0x3f4d5e,null));};exports[_0xab19('0x3e')]=function(_0x13ec3e,_0x445025){var _0x317d0e={'raw':!![],'where':{'id':_0x13ec3e[_0xab19('0x3f')]['id']}},_0x21f892={};_0x21f892[_0xab19('0x2d')]=_[_0xab19('0x2a')](db[_0xab19('0x25')][_0xab19('0x40')]);_0x21f892[_0xab19('0x29')]=_[_0xab19('0x2a')](_0x13ec3e[_0xab19('0x29')]);_0x21f892['filters']=_[_0xab19('0x2c')](_0x21f892[_0xab19('0x2d')],_0x21f892[_0xab19('0x29')]);_0x317d0e[_0xab19('0x2e')]=_[_0xab19('0x2c')](_0x21f892['model'],qs[_0xab19('0x2f')](_0x13ec3e[_0xab19('0x29')][_0xab19('0x2f')]));_0x317d0e[_0xab19('0x2e')]=_0x317d0e['attributes'][_0xab19('0x30')]?_0x317d0e[_0xab19('0x2e')]:_0x21f892[_0xab19('0x2d')];if(_0x13ec3e[_0xab19('0x29')][_0xab19('0x3b')]){_0x317d0e['include']=[{'all':!![]}];}_0x317d0e=_['merge']({},_0x317d0e,_0x13ec3e['options']);return db[_0xab19('0x25')][_0xab19('0x41')](_0x317d0e)[_0xab19('0x1f')](handleEntityNotFound(_0x445025,null))[_0xab19('0x1f')](respondWithResult(_0x445025,null))[_0xab19('0x3d')](handleError(_0x445025,null));};exports['create']=function(_0x4ecb0a,_0x5ab649){return db[_0xab19('0x25')][_0xab19('0x42')](_0x4ecb0a[_0xab19('0x43')],{})[_0xab19('0x1f')](respondWithResult(_0x5ab649,0xc9))[_0xab19('0x3d')](handleError(_0x5ab649,null));};exports[_0xab19('0x44')]=function(_0x4ea437,_0x330dc0){if(_0x4ea437[_0xab19('0x43')]['id']){delete _0x4ea437[_0xab19('0x43')]['id'];}return db[_0xab19('0x25')][_0xab19('0x41')]({'where':{'id':_0x4ea437['params']['id']}})[_0xab19('0x1f')](handleEntityNotFound(_0x330dc0,null))[_0xab19('0x1f')](saveUpdates(_0x4ea437[_0xab19('0x43')],null))[_0xab19('0x1f')](respondWithResult(_0x330dc0,null))[_0xab19('0x3d')](handleError(_0x330dc0,null));};exports[_0xab19('0x20')]=function(_0x2d243a,_0x3f6bbd){return db[_0xab19('0x25')][_0xab19('0x41')]({'where':{'id':_0x2d243a[_0xab19('0x3f')]['id']}})[_0xab19('0x1f')](handleEntityNotFound(_0x3f6bbd,null))[_0xab19('0x1f')](removeEntity(_0x3f6bbd,null))[_0xab19('0x3d')](handleError(_0x3f6bbd,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5e429a8..a4b0c5d 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 _0x45bb=['FieldId','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField'];(function(_0x3dda0f,_0x5b9902){var _0x1b0488=function(_0x267031){while(--_0x267031){_0x3dda0f['push'](_0x3dda0f['shift']());}};_0x1b0488(++_0x5b9902);}(_0x45bb,0xaa));var _0xb45b=function(_0x562396,_0x20689e){_0x562396=_0x562396-0x0;var _0xb7f76=_0x45bb[_0x562396];return _0xb7f76;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb45b('0x0'))(_0xb45b('0x1'));var moment=require(_0xb45b('0x2'));var BPromise=require(_0xb45b('0x3'));var rp=require(_0xb45b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb45b('0x5'));var config=require(_0xb45b('0x6'));var attributes=require(_0xb45b('0x7'));module[_0xb45b('0x8')]=function(_0x3cb979,_0x246b87){return _0x3cb979[_0xb45b('0x9')]('ServicenowField',attributes,{'tableName':_0xb45b('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xb45b('0xb'),_0xb45b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf956=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xf956,0xd7));var _0x6f95=function(_0x5f2df5,_0x52025f){_0x5f2df5=_0x5f2df5-0x0;var _0x1466a0=_0xf956[_0x5f2df5];return _0x1466a0;};'use strict';var _=require(_0x6f95('0x0'));var util=require(_0x6f95('0x1'));var logger=require('../../config/logger')(_0x6f95('0x2'));var moment=require(_0x6f95('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f95('0x4'));var fs=require('fs');var path=require(_0x6f95('0x5'));var rimraf=require(_0x6f95('0x6'));var config=require(_0x6f95('0x7'));var attributes=require(_0x6f95('0x8'));module[_0x6f95('0x9')]=function(_0x293cee,_0xb692c9){return _0x293cee[_0x6f95('0xa')](_0x6f95('0xb'),attributes,{'tableName':_0x6f95('0xc'),'paranoid':![],'indexes':[{'name':_0x6f95('0xd'),'fields':[_0x6f95('0xe'),_0x6f95('0xf')],'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 e27311a..1d50e22 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 _0x5615=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x48d565,_0x3dad07){var _0x510c68=function(_0x1adef5){while(--_0x1adef5){_0x48d565['push'](_0x48d565['shift']());}};_0x510c68(++_0x3dad07);}(_0x5615,0x153));var _0x5561=function(_0x21347d,_0x36188c){_0x21347d=_0x21347d-0x0;var _0x836949=_0x5615[_0x21347d];return _0x836949;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5561('0x0'));var rs=require(_0x5561('0x1'));var fs=require('fs');var Redis=require(_0x5561('0x2'));var db=require(_0x5561('0x3'))['db'];var utils=require(_0x5561('0x4'));var logger=require(_0x5561('0x5'))(_0x5561('0x6'));var config=require(_0x5561('0x7'));var jayson=require(_0x5561('0x8'));var client=jayson[_0x5561('0x9')][_0x5561('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a5352,_0x2b6ea7,_0x3152c1){return new BPromise(function(_0x560954,_0x57d755){return client[_0x5561('0xb')](_0x3a5352,_0x3152c1)['then'](function(_0x41ae3f){logger[_0x5561('0xc')](_0x5561('0xd'),_0x2b6ea7,'request\x20sent');logger[_0x5561('0xe')](_0x5561('0xf'),_0x2b6ea7,_0x5561('0x10'),JSON[_0x5561('0x11')](_0x41ae3f));if(_0x41ae3f[_0x5561('0x12')]){if(_0x41ae3f['error']['code']===0x1f4){logger[_0x5561('0x12')]('ServicenowField,\x20%s,\x20%s',_0x2b6ea7,_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);return _0x57d755(_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);}logger[_0x5561('0x12')](_0x5561('0xd'),_0x2b6ea7,_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);return _0x560954(_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);}else{logger[_0x5561('0xc')]('ServicenowField,\x20%s,\x20%s',_0x2b6ea7,_0x5561('0x10'));_0x560954(_0x41ae3f[_0x5561('0x14')][_0x5561('0x13')]);}})[_0x5561('0x15')](function(_0xc140ef){logger[_0x5561('0x12')](_0x5561('0xd'),_0x2b6ea7,_0xc140ef);_0x57d755(_0xc140ef);});});} \ No newline at end of file +var _0x6423=['../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xc12b88,_0x5b914e){var _0x11c016=function(_0x41a9e3){while(--_0x41a9e3){_0xc12b88['push'](_0xc12b88['shift']());}};_0x11c016(++_0x5b914e);}(_0x6423,0x149));var _0x3642=function(_0x336868,_0x1d36f5){_0x336868=_0x336868-0x0;var _0x25d8f6=_0x6423[_0x336868];return _0x25d8f6;};'use strict';var _=require('lodash');var util=require(_0x3642('0x0'));var moment=require(_0x3642('0x1'));var BPromise=require(_0x3642('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3642('0x3'));var db=require(_0x3642('0x4'))['db'];var utils=require(_0x3642('0x5'));var logger=require('../../config/logger')(_0x3642('0x6'));var config=require(_0x3642('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3642('0x8')][_0x3642('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20f10f,_0x18f55f,_0x606508){return new BPromise(function(_0x1e305b,_0xcba16e){return client[_0x3642('0xa')](_0x20f10f,_0x606508)['then'](function(_0x322344){logger[_0x3642('0xb')]('ServicenowField,\x20%s,\x20%s',_0x18f55f,_0x3642('0xc'));logger[_0x3642('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x18f55f,_0x3642('0xc'),JSON[_0x3642('0xe')](_0x322344));if(_0x322344['error']){if(_0x322344[_0x3642('0xf')][_0x3642('0x10')]===0x1f4){logger[_0x3642('0xf')]('ServicenowField,\x20%s,\x20%s',_0x18f55f,_0x322344['error'][_0x3642('0x11')]);return _0xcba16e(_0x322344[_0x3642('0xf')][_0x3642('0x11')]);}logger['error'](_0x3642('0x12'),_0x18f55f,_0x322344[_0x3642('0xf')][_0x3642('0x11')]);return _0x1e305b(_0x322344[_0x3642('0xf')][_0x3642('0x11')]);}else{logger['info'](_0x3642('0x12'),_0x18f55f,_0x3642('0xc'));_0x1e305b(_0x322344[_0x3642('0x13')][_0x3642('0x11')]);}})[_0x3642('0x14')](function(_0x51b7f3){logger[_0x3642('0xf')](_0x3642('0x12'),_0x18f55f,_0x51b7f3);_0xcba16e(_0x51b7f3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9387b09..d93d61e 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 _0x117d=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x22af3e,_0x4b606b){var _0x48c847=function(_0x515665){while(--_0x515665){_0x22af3e['push'](_0x22af3e['shift']());}};_0x48c847(++_0x4b606b);}(_0x117d,0xac));var _0xd117=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0x117d[_0x54fbff];return _0x5cf619;};'use strict';var multer=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var path=require(_0xd117('0x2'));var timeout=require('connect-timeout');var express=require(_0xd117('0x3'));var router=express[_0xd117('0x4')]();var auth=require(_0xd117('0x5'));var interaction=require(_0xd117('0x6'));var config=require(_0xd117('0x7'));var controller=require('./intSugarcrmAccount.controller');router[_0xd117('0x8')]('/',auth[_0xd117('0x9')](),controller[_0xd117('0xa')]);router[_0xd117('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd117('0xb')]);router[_0xd117('0x8')](_0xd117('0xc'),auth[_0xd117('0x9')](),controller[_0xd117('0xd')]);router[_0xd117('0x8')](_0xd117('0xe'),auth[_0xd117('0x9')](),controller[_0xd117('0xf')]);router[_0xd117('0x10')]('/',auth[_0xd117('0x9')](),controller[_0xd117('0x11')]);router[_0xd117('0x10')]('/:id/configurations',auth[_0xd117('0x9')](),controller[_0xd117('0x12')]);router[_0xd117('0x13')](_0xd117('0x14'),auth[_0xd117('0x9')](),controller['update']);router['delete'](_0xd117('0x14'),auth['isAuthenticated'](),controller[_0xd117('0x15')]);module[_0xd117('0x16')]=router; \ No newline at end of file +var _0x69d5=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','/:id','update','delete'];(function(_0x30d3a7,_0x4cf41d){var _0x2fe0d6=function(_0x37ffc7){while(--_0x37ffc7){_0x30d3a7['push'](_0x30d3a7['shift']());}};_0x2fe0d6(++_0x4cf41d);}(_0x69d5,0x18e));var _0x569d=function(_0x308652,_0x5e8c90){_0x308652=_0x308652-0x0;var _0x404a19=_0x69d5[_0x308652];return _0x404a19;};'use strict';var multer=require(_0x569d('0x0'));var util=require(_0x569d('0x1'));var path=require('path');var timeout=require(_0x569d('0x2'));var express=require(_0x569d('0x3'));var router=express['Router']();var auth=require(_0x569d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x569d('0x5'));var controller=require(_0x569d('0x6'));router[_0x569d('0x7')]('/',auth[_0x569d('0x8')](),controller[_0x569d('0x9')]);router[_0x569d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x569d('0xa')]);router[_0x569d('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x569d('0xb')]);router[_0x569d('0x7')](_0x569d('0xc'),auth[_0x569d('0x8')](),controller[_0x569d('0xd')]);router[_0x569d('0xe')]('/',auth['isAuthenticated'](),controller[_0x569d('0xf')]);router[_0x569d('0xe')](_0x569d('0x10'),auth[_0x569d('0x8')](),controller['addConfiguration']);router['put'](_0x569d('0x11'),auth[_0x569d('0x8')](),controller[_0x569d('0x12')]);router[_0x569d('0x13')](_0x569d('0x11'),auth[_0x569d('0x8')](),controller[_0x569d('0x14')]);module[_0x569d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 234460f..13b8443 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 _0x8fd3=['remoteUri','STRING'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x8fd3,0x1b3));var _0x38fd=function(_0x4505c3,_0x1f761f){_0x4505c3=_0x4505c3-0x0;var _0x5bc552=_0x8fd3[_0x4505c3];return _0x5bc552;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x38fd('0x0')]},'description':{'type':Sequelize[_0x38fd('0x0')]},'username':{'type':Sequelize[_0x38fd('0x0')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x38fd('0x0')],'unique':_0x38fd('0x1')},'serverUrl':{'type':Sequelize[_0x38fd('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x31b5=['exports','STRING','username','remoteUri'];(function(_0x493abe,_0x2aa255){var _0x10e098=function(_0x329d73){while(--_0x329d73){_0x493abe['push'](_0x493abe['shift']());}};_0x10e098(++_0x2aa255);}(_0x31b5,0xb8));var _0x531b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x31b5[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x531b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x531b('0x1')]},'username':{'type':Sequelize[_0x531b('0x1')],'unique':_0x531b('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x531b('0x1')],'unique':_0x531b('0x3')},'serverUrl':{'type':Sequelize[_0x531b('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 fc62b12..9ff630a 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 _0x0718=['destroy','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','SugarcrmConfiguration','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','then'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x0718,0xd2));var _0x8071=function(_0xf9fa79,_0xcb6d65){_0xf9fa79=_0xf9fa79-0x0;var _0xb868a6=_0x0718[_0xf9fa79];return _0xb868a6;};'use strict';var pdf=require(_0x8071('0x0'));var emlformat=require(_0x8071('0x1'));var rimraf=require(_0x8071('0x2'));var zipdir=require(_0x8071('0x3'));var jsonpatch=require(_0x8071('0x4'));var rp=require('request-promise');var moment=require(_0x8071('0x5'));var BPromise=require(_0x8071('0x6'));var Mustache=require(_0x8071('0x7'));var util=require(_0x8071('0x8'));var path=require(_0x8071('0x9'));var sox=require(_0x8071('0xa'));var csv=require(_0x8071('0xb'));var ejs=require(_0x8071('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8071('0xd'));var deskjs=require(_0x8071('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8071('0xf'));var Redis=require(_0x8071('0x10'));var authService=require(_0x8071('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8071('0x12'));var logger=require(_0x8071('0x13'))(_0x8071('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8071('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8071('0x16'));var client=jayson[_0x8071('0x17')][_0x8071('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3cf79e,_0x3cbd9b,_0x54c043,_0x36edf2){return new BPromise(function(_0x4feac0,_0x3aca2d){var _0x539abc=_0x36edf2||client;return _0x539abc[_0x8071('0x19')](_0x3cf79e,_0x54c043)['then'](function(_0x324187){logger[_0x8071('0x1a')](_0x8071('0x1b'),_0x3cbd9b,_0x8071('0x1c'));logger[_0x8071('0x1d')](_0x8071('0x1e'),_0x3cbd9b,_0x8071('0x1c'),JSON[_0x8071('0x1f')](_0x324187));if(_0x324187[_0x8071('0x20')]){if(_0x324187[_0x8071('0x20')][_0x8071('0x21')]===0x1f4){logger[_0x8071('0x20')](_0x8071('0x1b'),_0x3cbd9b,_0x324187[_0x8071('0x20')]['message']);return _0x3aca2d(_0x324187[_0x8071('0x20')][_0x8071('0x22')]);}logger[_0x8071('0x20')](_0x8071('0x1b'),_0x3cbd9b,_0x324187[_0x8071('0x20')]['message']);return _0x4feac0(_0x324187[_0x8071('0x20')][_0x8071('0x22')]);}else{logger['info'](_0x8071('0x1b'),_0x3cbd9b,'request\x20sent');_0x4feac0(_0x324187['result'][_0x8071('0x22')]);}})['catch'](function(_0x4562ff){logger[_0x8071('0x20')](_0x8071('0x1b'),_0x3cbd9b,_0x4562ff);_0x3aca2d(_0x4562ff);});});}function respondWithStatusCode(_0x36e1b4,_0x159ea4){_0x159ea4=_0x159ea4||0xcc;return function(_0x700f4d){if(_0x700f4d){return _0x36e1b4[_0x8071('0x23')](_0x159ea4);}return _0x36e1b4['status'](_0x159ea4)[_0x8071('0x24')]();};}function respondWithResult(_0x4fa01c,_0x73d7b4){_0x73d7b4=_0x73d7b4||0xc8;return function(_0x7ef682){if(_0x7ef682){return _0x4fa01c['status'](_0x73d7b4)[_0x8071('0x25')](_0x7ef682);}};}function respondWithFilteredResult(_0x263994,_0x206664){return function(_0x5cdfef){if(_0x5cdfef){var _0x40dc50=_0x5cdfef[_0x8071('0x26')],_0x31b8ee=_0x206664[_0x8071('0x27')],_0x42f08d=_0x206664[_0x8071('0x27')]+_0x206664[_0x8071('0x28')],_0x82de0b;if(_0x42f08d>=_0x40dc50){_0x42f08d=_0x40dc50;_0x82de0b=0xc8;}else{_0x82de0b=0xce;}_0x263994[_0x8071('0x29')](_0x82de0b);return _0x263994[_0x8071('0x2a')](_0x8071('0x2b'),_0x31b8ee+'-'+_0x42f08d+'/'+_0x40dc50)[_0x8071('0x25')](_0x5cdfef);}return null;};}function patchUpdates(_0x22253f){return function(_0x4823c7){try{jsonpatch[_0x8071('0x2c')](_0x4823c7,_0x22253f,!![]);}catch(_0x5aed28){return BPromise['reject'](_0x5aed28);}return _0x4823c7['save']();};}function saveUpdates(_0x540144,_0x2fc659){return function(_0x5e77d6){if(_0x5e77d6){return _0x5e77d6['update'](_0x540144)[_0x8071('0x2d')](function(_0x41d252){return _0x41d252;});}return null;};}function removeEntity(_0xfe89c4,_0x31565d){return function(_0x37ba50){if(_0x37ba50){return _0x37ba50[_0x8071('0x2e')]()[_0x8071('0x2d')](function(){_0xfe89c4[_0x8071('0x29')](0xcc)[_0x8071('0x24')]();});}};}function handleEntityNotFound(_0x30be0e,_0x2808e0){return function(_0x131d9a){if(!_0x131d9a){_0x30be0e[_0x8071('0x23')](0x194);}return _0x131d9a;};}function handleError(_0x12d7eb,_0x348683){_0x348683=_0x348683||0x1f4;return function(_0xba5066){logger[_0x8071('0x20')](_0xba5066['stack']);if(_0xba5066[_0x8071('0x2f')]){delete _0xba5066[_0x8071('0x2f')];}_0x12d7eb[_0x8071('0x29')](_0x348683)[_0x8071('0x30')](_0xba5066);};}exports[_0x8071('0x31')]=function(_0x23c499,_0x2c6e6a){var _0x303bc3={},_0x17e06e={},_0xf8c933={'count':0x0,'rows':[]};var _0x2ca06f=_[_0x8071('0x32')](db[_0x8071('0x33')][_0x8071('0x34')],function(_0x1cab33){return{'name':_0x1cab33['fieldName'],'type':_0x1cab33[_0x8071('0x35')][_0x8071('0x36')]};});_0x17e06e[_0x8071('0x37')]=_[_0x8071('0x32')](_0x2ca06f,_0x8071('0x2f'));_0x17e06e['query']=_[_0x8071('0x38')](_0x23c499['query']);_0x17e06e[_0x8071('0x39')]=_['intersection'](_0x17e06e['model'],_0x17e06e['query']);_0x303bc3['attributes']=_[_0x8071('0x3a')](_0x17e06e[_0x8071('0x37')],qs['fields'](_0x23c499[_0x8071('0x3b')][_0x8071('0x3c')]));_0x303bc3[_0x8071('0x3d')]=_0x303bc3['attributes'][_0x8071('0x3e')]?_0x303bc3[_0x8071('0x3d')]:_0x17e06e[_0x8071('0x37')];if(!_0x23c499[_0x8071('0x3b')][_0x8071('0x3f')]('nolimit')){_0x303bc3[_0x8071('0x28')]=qs[_0x8071('0x28')](_0x23c499[_0x8071('0x3b')][_0x8071('0x28')]);_0x303bc3[_0x8071('0x27')]=qs[_0x8071('0x27')](_0x23c499[_0x8071('0x3b')][_0x8071('0x27')]);}_0x303bc3['order']=qs[_0x8071('0x40')](_0x23c499[_0x8071('0x3b')]['sort']);_0x303bc3['where']=qs[_0x8071('0x39')](_[_0x8071('0x41')](_0x23c499['query'],_0x17e06e['filters']),_0x2ca06f);if(_0x23c499[_0x8071('0x3b')][_0x8071('0x42')]){_0x303bc3['where']=_['merge'](_0x303bc3[_0x8071('0x43')],{'$or':_[_0x8071('0x32')](_0x2ca06f,function(_0x282de7){if(_0x282de7[_0x8071('0x35')]!==_0x8071('0x44')){var _0x447adc={};_0x447adc[_0x282de7['name']]={'$like':'%'+_0x23c499[_0x8071('0x3b')][_0x8071('0x42')]+'%'};return _0x447adc;}})});}_0x303bc3=_[_0x8071('0x45')]({},_0x303bc3,_0x23c499[_0x8071('0x46')]);var _0x219cf1={'where':_0x303bc3[_0x8071('0x43')]};return db['SugarcrmAccount'][_0x8071('0x26')](_0x219cf1)[_0x8071('0x2d')](function(_0x366f63){_0xf8c933['count']=_0x366f63;if(_0x23c499[_0x8071('0x3b')][_0x8071('0x47')]){_0x303bc3[_0x8071('0x48')]=[{'all':!![]}];}return db[_0x8071('0x33')][_0x8071('0x49')](_0x303bc3);})[_0x8071('0x2d')](function(_0xcc923b){_0xf8c933[_0x8071('0x4a')]=_0xcc923b;return _0xf8c933;})[_0x8071('0x2d')](respondWithFilteredResult(_0x2c6e6a,_0x303bc3))[_0x8071('0x4b')](handleError(_0x2c6e6a,null));};exports[_0x8071('0x4c')]=function(_0x46fbdc,_0x33f6be){var _0x539b7f={'raw':![],'where':{'id':_0x46fbdc[_0x8071('0x4d')]['id']}},_0x202788={};_0x202788[_0x8071('0x37')]=_[_0x8071('0x38')](db[_0x8071('0x33')]['rawAttributes']);_0x202788[_0x8071('0x3b')]=_[_0x8071('0x38')](_0x46fbdc[_0x8071('0x3b')]);_0x202788['filters']=_['intersection'](_0x202788['model'],_0x202788[_0x8071('0x3b')]);_0x539b7f[_0x8071('0x3d')]=_[_0x8071('0x3a')](_0x202788['model'],qs[_0x8071('0x3c')](_0x46fbdc[_0x8071('0x3b')][_0x8071('0x3c')]));_0x539b7f[_0x8071('0x3d')]=_0x539b7f[_0x8071('0x3d')][_0x8071('0x3e')]?_0x539b7f['attributes']:_0x202788['model'];if(_0x46fbdc[_0x8071('0x3b')]['includeAll']){_0x539b7f[_0x8071('0x48')]=[{'all':!![]}];}_0x539b7f=_['merge']({},_0x539b7f,_0x46fbdc['options']);return db[_0x8071('0x33')][_0x8071('0x4e')](_0x539b7f)[_0x8071('0x2d')](handleEntityNotFound(_0x33f6be,null))['then'](respondWithResult(_0x33f6be,null))[_0x8071('0x4b')](handleError(_0x33f6be,null));};exports[_0x8071('0x4f')]=function(_0x278cd0,_0x4398f5){return db[_0x8071('0x33')]['create'](_0x278cd0[_0x8071('0x50')],{})[_0x8071('0x2d')](respondWithResult(_0x4398f5,0xc9))[_0x8071('0x4b')](handleError(_0x4398f5,null));};exports[_0x8071('0x51')]=function(_0x40b260,_0x5a885c){if(_0x40b260['body']['id']){delete _0x40b260[_0x8071('0x50')]['id'];}return db[_0x8071('0x33')][_0x8071('0x4e')]({'where':{'id':_0x40b260[_0x8071('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a885c,null))[_0x8071('0x2d')](saveUpdates(_0x40b260[_0x8071('0x50')],null))[_0x8071('0x2d')](respondWithResult(_0x5a885c,null))[_0x8071('0x4b')](handleError(_0x5a885c,null));};exports['destroy']=function(_0x399344,_0x4067ed){return db[_0x8071('0x33')][_0x8071('0x4e')]({'where':{'id':_0x399344[_0x8071('0x4d')]['id']}})[_0x8071('0x2d')](handleEntityNotFound(_0x4067ed,null))[_0x8071('0x2d')](removeEntity(_0x4067ed,null))[_0x8071('0x4b')](handleError(_0x4067ed,null));};exports['getConfigurations']=function(_0x37e588,_0x3c3851,_0x5af669){var _0x36baf1={};var _0x40452e={};var _0x13ab2e;var _0x25fe0f;return db[_0x8071('0x33')]['findOne']({'where':{'id':_0x37e588[_0x8071('0x4d')]['id']}})[_0x8071('0x2d')](handleEntityNotFound(_0x3c3851,null))[_0x8071('0x2d')](function(_0x27dfc6){if(_0x27dfc6){_0x13ab2e=_0x27dfc6;_0x40452e[_0x8071('0x37')]=_['keys'](db[_0x8071('0x52')][_0x8071('0x34')]);_0x40452e[_0x8071('0x3b')]=_[_0x8071('0x38')](_0x37e588['query']);_0x40452e['filters']=_[_0x8071('0x3a')](_0x40452e['model'],_0x40452e[_0x8071('0x3b')]);_0x36baf1['attributes']=_['intersection'](_0x40452e['model'],qs[_0x8071('0x3c')](_0x37e588[_0x8071('0x3b')]['fields']));_0x36baf1[_0x8071('0x3d')]=_0x36baf1['attributes'][_0x8071('0x3e')]?_0x36baf1[_0x8071('0x3d')]:_0x40452e[_0x8071('0x37')];_0x36baf1['order']=qs[_0x8071('0x40')](_0x37e588[_0x8071('0x3b')]['sort']);_0x36baf1[_0x8071('0x43')]=qs['filters'](_['pick'](_0x37e588[_0x8071('0x3b')],_0x40452e['filters']));if(_0x37e588[_0x8071('0x3b')]['filter']){_0x36baf1[_0x8071('0x43')]=_[_0x8071('0x45')](_0x36baf1[_0x8071('0x43')],{'$or':_[_0x8071('0x32')](_0x36baf1[_0x8071('0x3d')],function(_0x4b3c40){var _0xf99efb={};_0xf99efb[_0x4b3c40]={'$like':'%'+_0x37e588[_0x8071('0x3b')][_0x8071('0x42')]+'%'};return _0xf99efb;})});}_0x36baf1=_[_0x8071('0x45')]({},_0x36baf1,_0x37e588['options']);return _0x13ab2e[_0x8071('0x53')](_0x36baf1);}})[_0x8071('0x2d')](function(_0x36faf1){if(_0x36faf1){_0x25fe0f=_0x36faf1['length'];if(!_0x37e588[_0x8071('0x3b')]['hasOwnProperty'](_0x8071('0x54'))){_0x36baf1[_0x8071('0x28')]=qs['limit'](_0x37e588['query']['limit']);_0x36baf1['offset']=qs[_0x8071('0x27')](_0x37e588['query'][_0x8071('0x27')]);}return _0x13ab2e[_0x8071('0x53')](_0x36baf1);}})[_0x8071('0x2d')](function(_0x37f80e){if(_0x37f80e){return _0x37f80e?{'count':_0x25fe0f,'rows':_0x37f80e}:null;}})[_0x8071('0x2d')](respondWithResult(_0x3c3851,null))[_0x8071('0x4b')](handleError(_0x3c3851,null));};exports[_0x8071('0x55')]=function(_0x21c663,_0x4a8fa7,_0x4e684e){if(_0x21c663['body']['id']){delete _0x21c663['body']['id'];}return db[_0x8071('0x33')][_0x8071('0x56')]({'where':{'id':_0x21c663[_0x8071('0x4d')]['id']}})[_0x8071('0x2d')](handleEntityNotFound(_0x4a8fa7,null))['then'](function(_0x45a784){if(_0x45a784){_0x21c663['body'][_0x8071('0x57')]=_0x45a784['id'];_0x21c663[_0x8071('0x50')][_0x8071('0x58')]=integrations[_0x8071('0x59')](_0x21c663[_0x8071('0x50')]['channel'],_0x21c663[_0x8071('0x50')][_0x8071('0x35')]);_0x21c663[_0x8071('0x50')][_0x8071('0x5a')]=integrations[_0x8071('0x5b')](_0x21c663[_0x8071('0x50')][_0x8071('0x5c')],_0x21c663['body'][_0x8071('0x35')]);return db[_0x8071('0x52')][_0x8071('0x4f')](_0x21c663[_0x8071('0x50')],{'include':[{'model':db[_0x8071('0x5d')],'as':_0x8071('0x58')},{'model':db[_0x8071('0x5d')],'as':'Descriptions'}]});}return null;})[_0x8071('0x2d')](respondWithResult(_0x4a8fa7,null))[_0x8071('0x4b')](handleError(_0x4a8fa7,null));};exports[_0x8071('0x5e')]=function(_0x1509e9,_0x34ba23,_0x3f1d04){var _0x4f16c8='';var _0x550e23=['id',_0x8071('0x2f'),'assigned_user_id','created_by',_0x8071('0x5f'),'date_start',_0x8071('0x60'),_0x8071('0x61'),_0x8071('0x62'),_0x8071('0x63'),_0x8071('0x64'),_0x8071('0x65')];return db[_0x8071('0x33')]['findOne']({'where':{'id':_0x1509e9['params']['id']},'attributes':['id',_0x8071('0x66'),_0x8071('0x67'),_0x8071('0x68')]})[_0x8071('0x2d')](handleEntityNotFound(_0x34ba23,null))[_0x8071('0x2d')](function(_0x341624){if(_0x341624){_0x4f16c8=_0x341624['remoteUri'];var _0x5b2d66=_0x4f16c8[_0x8071('0x69')](-0x1);if(_0x5b2d66==='/'){_0x4f16c8=_0x4f16c8[_0x8071('0x6a')](0x0,_0x4f16c8[_0x8071('0x6b')](_0x5b2d66));}return rp({'method':_0x8071('0x6c'),'uri':util[_0x8071('0x6d')](_0x8071('0x6e'),_0x4f16c8,_0x8071('0x6f')),'json':!![],'form':{'method':_0x8071('0x70'),'input_type':_0x8071('0x71'),'response_type':_0x8071('0x71'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x341624[_0x8071('0x66')],'password':_0x341624[_0x8071('0x67')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x8071('0x2d')](function(_0x12b310){if(_0x12b310&&_0x12b310[_0x8071('0x2f')]!==_0x8071('0x72')&&_0x12b310[_0x8071('0x2f')]!==_0x8071('0x73')){return rp({'method':_0x8071('0x6c'),'uri':util[_0x8071('0x6d')](_0x8071('0x6e'),_0x4f16c8,_0x8071('0x6f')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x8071('0x71'),'response_type':_0x8071('0x71'),'rest_data':JSON[_0x8071('0x1f')]({'session':_0x12b310['id'],'module_name':_0x8071('0x74')})}})[_0x8071('0x2d')](function(_0x5e3534){if(_0x5e3534){var _0xe6a2e7=_[_0x8071('0x75')](_0x5e3534[_0x8071('0x76')]);_[_0x8071('0x77')](_0xe6a2e7,function(_0x207d9a){return _0x550e23[_0x8071('0x78')](_0x207d9a[_0x8071('0x2f')]);});return{'count':_0xe6a2e7[_0x8071('0x3e')],'rows':_[_0x8071('0x32')](_0xe6a2e7,function(_0xfc3d79){return{'id':_0xfc3d79[_0x8071('0x2f')],'name':_0xfc3d79[_0x8071('0x79')],'custom':_[_0x8071('0x7a')](_0xfc3d79['name'],'_c')?!![]:![],'options':_0xfc3d79['options']?_[_0x8071('0x32')](_[_0x8071('0x75')](_0xfc3d79[_0x8071('0x46')]),function(_0x2854e0){return{'name':_0x2854e0[_0x8071('0x7b')],'value':_0x2854e0[_0x8071('0x2f')]};}):[]};})};}})[_0x8071('0x2d')](respondWithResult(_0x34ba23,null))[_0x8071('0x4b')](function(_0x2c4956){var _0x223507=_0x1509e9[_0x8071('0x3b')]['test']?0x1f4:_0x2c4956[_0x8071('0x7c')]||0x1f4;logger['error'](_0x8071('0x7d'),_0x8071('0x5e'),_0x223507,JSON[_0x8071('0x1f')](_0x2c4956));delete _0x2c4956[_0x8071('0x2f')];if(_0x223507===0x191){_0x223507=0x190;}_0x34ba23['status'](_0x223507)['send'](_0x1509e9[_0x8071('0x3b')][_0x8071('0x7e')]?{'message':_0x8071('0x7f'),'statusCode':_0x2c4956['statusCode']}:_0x2c4956);});}else{var _0x30a453=0x1f4;_0x34ba23['status'](_0x30a453)['send']({'message':_0x8071('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x0ff1=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','set','Content-Range','save','update','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','AccountId','channel','SugarcrmField','Subjects','Descriptions','description','date_start','duration_minutes','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','includes','label','endsWith'];(function(_0xe406e8,_0x2dbfd8){var _0x3f8fbe=function(_0x967a30){while(--_0x967a30){_0xe406e8['push'](_0xe406e8['shift']());}};_0x3f8fbe(++_0x2dbfd8);}(_0x0ff1,0x105));var _0x10ff=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x0ff1[_0x2ca616];return _0x53155f;};'use strict';var pdf=require(_0x10ff('0x0'));var emlformat=require(_0x10ff('0x1'));var rimraf=require(_0x10ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10ff('0x3'));var rp=require(_0x10ff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x10ff('0x5'));var util=require(_0x10ff('0x6'));var path=require(_0x10ff('0x7'));var sox=require(_0x10ff('0x8'));var csv=require('to-csv');var ejs=require(_0x10ff('0x9'));var fs=require('fs');var _=require(_0x10ff('0xa'));var squel=require('squel');var crypto=require(_0x10ff('0xb'));var jsforce=require(_0x10ff('0xc'));var deskjs=require(_0x10ff('0xd'));var toCsv=require(_0x10ff('0xe'));var querystring=require(_0x10ff('0xf'));var Papa=require(_0x10ff('0x10'));var Redis=require(_0x10ff('0x11'));var authService=require(_0x10ff('0x12'));var qs=require(_0x10ff('0x13'));var as=require(_0x10ff('0x14'));var hardwareService=require(_0x10ff('0x15'));var logger=require(_0x10ff('0x16'))('api');var utils=require(_0x10ff('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x10ff('0x18'));var db=require(_0x10ff('0x19'))['db'];var integrations=require(_0x10ff('0x1a'));var jayson=require(_0x10ff('0x1b'));var client=jayson['client'][_0x10ff('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3ebf1c,_0x2a2d81,_0x41dadb,_0x2dcd4c){return new BPromise(function(_0x36d0d5,_0x110b90){var _0x1f85a8=_0x2dcd4c||client;return _0x1f85a8[_0x10ff('0x1d')](_0x3ebf1c,_0x41dadb)[_0x10ff('0x1e')](function(_0x112f71){logger[_0x10ff('0x1f')](_0x10ff('0x20'),_0x2a2d81,_0x10ff('0x21'));logger['debug'](_0x10ff('0x22'),_0x2a2d81,_0x10ff('0x21'),JSON[_0x10ff('0x23')](_0x112f71));if(_0x112f71[_0x10ff('0x24')]){if(_0x112f71[_0x10ff('0x24')][_0x10ff('0x25')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2a2d81,_0x112f71['error'][_0x10ff('0x26')]);return _0x110b90(_0x112f71[_0x10ff('0x24')]['message']);}logger[_0x10ff('0x24')](_0x10ff('0x20'),_0x2a2d81,_0x112f71['error']['message']);return _0x36d0d5(_0x112f71[_0x10ff('0x24')]['message']);}else{logger[_0x10ff('0x1f')](_0x10ff('0x20'),_0x2a2d81,_0x10ff('0x21'));_0x36d0d5(_0x112f71['result'][_0x10ff('0x26')]);}})[_0x10ff('0x27')](function(_0x38e86b){logger[_0x10ff('0x24')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a2d81,_0x38e86b);_0x110b90(_0x38e86b);});});}function respondWithStatusCode(_0x34f368,_0x1c885f){_0x1c885f=_0x1c885f||0xcc;return function(_0x54b8e3){if(_0x54b8e3){return _0x34f368['sendStatus'](_0x1c885f);}return _0x34f368[_0x10ff('0x28')](_0x1c885f)[_0x10ff('0x29')]();};}function respondWithResult(_0x4d19f5,_0x19dd00){_0x19dd00=_0x19dd00||0xc8;return function(_0x24751b){if(_0x24751b){return _0x4d19f5['status'](_0x19dd00)[_0x10ff('0x2a')](_0x24751b);}};}function respondWithFilteredResult(_0x3df34f,_0x34d775){return function(_0x1fb7d6){if(_0x1fb7d6){var _0xf0b352=_0x1fb7d6[_0x10ff('0x2b')],_0x3cfcad=_0x34d775[_0x10ff('0x2c')],_0x5299e1=_0x34d775[_0x10ff('0x2c')]+_0x34d775['limit'],_0x57ee05;if(_0x5299e1>=_0xf0b352){_0x5299e1=_0xf0b352;_0x57ee05=0xc8;}else{_0x57ee05=0xce;}_0x3df34f[_0x10ff('0x28')](_0x57ee05);return _0x3df34f[_0x10ff('0x2d')](_0x10ff('0x2e'),_0x3cfcad+'-'+_0x5299e1+'/'+_0xf0b352)[_0x10ff('0x2a')](_0x1fb7d6);}return null;};}function patchUpdates(_0xb17666){return function(_0x4c1e10){try{jsonpatch['apply'](_0x4c1e10,_0xb17666,!![]);}catch(_0x2ee739){return BPromise['reject'](_0x2ee739);}return _0x4c1e10[_0x10ff('0x2f')]();};}function saveUpdates(_0x1e392f,_0x262eb0){return function(_0x4af686){if(_0x4af686){return _0x4af686[_0x10ff('0x30')](_0x1e392f)[_0x10ff('0x1e')](function(_0x2cad06){return _0x2cad06;});}return null;};}function removeEntity(_0x56658f,_0x3afd78){return function(_0x22bf4a){if(_0x22bf4a){return _0x22bf4a[_0x10ff('0x31')]()[_0x10ff('0x1e')](function(){_0x56658f['status'](0xcc)[_0x10ff('0x29')]();});}};}function handleEntityNotFound(_0xb8ab08,_0x10368d){return function(_0x5991ef){if(!_0x5991ef){_0xb8ab08[_0x10ff('0x32')](0x194);}return _0x5991ef;};}function handleError(_0x38400a,_0x1923df){_0x1923df=_0x1923df||0x1f4;return function(_0x1a0a46){logger['error'](_0x1a0a46[_0x10ff('0x33')]);if(_0x1a0a46[_0x10ff('0x34')]){delete _0x1a0a46['name'];}_0x38400a['status'](_0x1923df)[_0x10ff('0x35')](_0x1a0a46);};}exports[_0x10ff('0x36')]=function(_0xff24c8,_0x33793c){var _0x536ded={},_0x3bb195={},_0x488a68={'count':0x0,'rows':[]};var _0x201e5c=_[_0x10ff('0x37')](db[_0x10ff('0x38')][_0x10ff('0x39')],function(_0x460b52){return{'name':_0x460b52[_0x10ff('0x3a')],'type':_0x460b52[_0x10ff('0x3b')][_0x10ff('0x3c')]};});_0x3bb195[_0x10ff('0x3d')]=_[_0x10ff('0x37')](_0x201e5c,_0x10ff('0x34'));_0x3bb195['query']=_[_0x10ff('0x3e')](_0xff24c8['query']);_0x3bb195[_0x10ff('0x3f')]=_[_0x10ff('0x40')](_0x3bb195['model'],_0x3bb195[_0x10ff('0x41')]);_0x536ded[_0x10ff('0x42')]=_['intersection'](_0x3bb195['model'],qs[_0x10ff('0x43')](_0xff24c8[_0x10ff('0x41')][_0x10ff('0x43')]));_0x536ded[_0x10ff('0x42')]=_0x536ded[_0x10ff('0x42')][_0x10ff('0x44')]?_0x536ded[_0x10ff('0x42')]:_0x3bb195[_0x10ff('0x3d')];if(!_0xff24c8[_0x10ff('0x41')][_0x10ff('0x45')](_0x10ff('0x46'))){_0x536ded[_0x10ff('0x47')]=qs[_0x10ff('0x47')](_0xff24c8[_0x10ff('0x41')][_0x10ff('0x47')]);_0x536ded[_0x10ff('0x2c')]=qs[_0x10ff('0x2c')](_0xff24c8[_0x10ff('0x41')][_0x10ff('0x2c')]);}_0x536ded[_0x10ff('0x48')]=qs[_0x10ff('0x49')](_0xff24c8['query'][_0x10ff('0x49')]);_0x536ded['where']=qs[_0x10ff('0x3f')](_[_0x10ff('0x4a')](_0xff24c8[_0x10ff('0x41')],_0x3bb195[_0x10ff('0x3f')]),_0x201e5c);if(_0xff24c8[_0x10ff('0x41')][_0x10ff('0x4b')]){_0x536ded[_0x10ff('0x4c')]=_[_0x10ff('0x4d')](_0x536ded[_0x10ff('0x4c')],{'$or':_['map'](_0x201e5c,function(_0xf3a7f3){if(_0xf3a7f3['type']!==_0x10ff('0x4e')){var _0x1e7e10={};_0x1e7e10[_0xf3a7f3['name']]={'$like':'%'+_0xff24c8[_0x10ff('0x41')][_0x10ff('0x4b')]+'%'};return _0x1e7e10;}})});}_0x536ded=_['merge']({},_0x536ded,_0xff24c8[_0x10ff('0x4f')]);var _0xba5d29={'where':_0x536ded[_0x10ff('0x4c')]};return db[_0x10ff('0x38')][_0x10ff('0x2b')](_0xba5d29)[_0x10ff('0x1e')](function(_0x3f5ddd){_0x488a68[_0x10ff('0x2b')]=_0x3f5ddd;if(_0xff24c8['query'][_0x10ff('0x50')]){_0x536ded[_0x10ff('0x51')]=[{'all':!![]}];}return db[_0x10ff('0x38')][_0x10ff('0x52')](_0x536ded);})[_0x10ff('0x1e')](function(_0x4e6109){_0x488a68[_0x10ff('0x53')]=_0x4e6109;return _0x488a68;})['then'](respondWithFilteredResult(_0x33793c,_0x536ded))[_0x10ff('0x27')](handleError(_0x33793c,null));};exports[_0x10ff('0x54')]=function(_0x2df3e7,_0x4c3af5){var _0x9fe731={'raw':![],'where':{'id':_0x2df3e7['params']['id']}},_0xc25a3d={};_0xc25a3d[_0x10ff('0x3d')]=_[_0x10ff('0x3e')](db['SugarcrmAccount']['rawAttributes']);_0xc25a3d[_0x10ff('0x41')]=_[_0x10ff('0x3e')](_0x2df3e7[_0x10ff('0x41')]);_0xc25a3d['filters']=_[_0x10ff('0x40')](_0xc25a3d[_0x10ff('0x3d')],_0xc25a3d[_0x10ff('0x41')]);_0x9fe731[_0x10ff('0x42')]=_['intersection'](_0xc25a3d[_0x10ff('0x3d')],qs[_0x10ff('0x43')](_0x2df3e7[_0x10ff('0x41')]['fields']));_0x9fe731[_0x10ff('0x42')]=_0x9fe731['attributes'][_0x10ff('0x44')]?_0x9fe731['attributes']:_0xc25a3d[_0x10ff('0x3d')];if(_0x2df3e7[_0x10ff('0x41')][_0x10ff('0x50')]){_0x9fe731[_0x10ff('0x51')]=[{'all':!![]}];}_0x9fe731=_[_0x10ff('0x4d')]({},_0x9fe731,_0x2df3e7[_0x10ff('0x4f')]);return db[_0x10ff('0x38')][_0x10ff('0x55')](_0x9fe731)[_0x10ff('0x1e')](handleEntityNotFound(_0x4c3af5,null))['then'](respondWithResult(_0x4c3af5,null))[_0x10ff('0x27')](handleError(_0x4c3af5,null));};exports[_0x10ff('0x56')]=function(_0x2bfcf1,_0x5ec83c){return db['SugarcrmAccount']['create'](_0x2bfcf1[_0x10ff('0x57')],{})[_0x10ff('0x1e')](respondWithResult(_0x5ec83c,0xc9))[_0x10ff('0x27')](handleError(_0x5ec83c,null));};exports[_0x10ff('0x30')]=function(_0x345abc,_0x29fe61){if(_0x345abc[_0x10ff('0x57')]['id']){delete _0x345abc['body']['id'];}return db[_0x10ff('0x38')]['find']({'where':{'id':_0x345abc[_0x10ff('0x58')]['id']}})[_0x10ff('0x1e')](handleEntityNotFound(_0x29fe61,null))[_0x10ff('0x1e')](saveUpdates(_0x345abc['body'],null))[_0x10ff('0x1e')](respondWithResult(_0x29fe61,null))['catch'](handleError(_0x29fe61,null));};exports[_0x10ff('0x31')]=function(_0x3d4cb3,_0x5cace2){return db[_0x10ff('0x38')][_0x10ff('0x55')]({'where':{'id':_0x3d4cb3[_0x10ff('0x58')]['id']}})['then'](handleEntityNotFound(_0x5cace2,null))['then'](removeEntity(_0x5cace2,null))[_0x10ff('0x27')](handleError(_0x5cace2,null));};exports[_0x10ff('0x59')]=function(_0x434fdb,_0x1eced8,_0x4a2939){var _0x231efb={};var _0x326227={};var _0x4a2cb9;var _0x2e3d23;return db['SugarcrmAccount'][_0x10ff('0x5a')]({'where':{'id':_0x434fdb[_0x10ff('0x58')]['id']}})[_0x10ff('0x1e')](handleEntityNotFound(_0x1eced8,null))['then'](function(_0x318cf2){if(_0x318cf2){_0x4a2cb9=_0x318cf2;_0x326227[_0x10ff('0x3d')]=_[_0x10ff('0x3e')](db[_0x10ff('0x5b')][_0x10ff('0x39')]);_0x326227[_0x10ff('0x41')]=_['keys'](_0x434fdb[_0x10ff('0x41')]);_0x326227[_0x10ff('0x3f')]=_[_0x10ff('0x40')](_0x326227[_0x10ff('0x3d')],_0x326227['query']);_0x231efb[_0x10ff('0x42')]=_[_0x10ff('0x40')](_0x326227[_0x10ff('0x3d')],qs[_0x10ff('0x43')](_0x434fdb[_0x10ff('0x41')]['fields']));_0x231efb[_0x10ff('0x42')]=_0x231efb[_0x10ff('0x42')][_0x10ff('0x44')]?_0x231efb[_0x10ff('0x42')]:_0x326227[_0x10ff('0x3d')];_0x231efb[_0x10ff('0x48')]=qs[_0x10ff('0x49')](_0x434fdb[_0x10ff('0x41')][_0x10ff('0x49')]);_0x231efb[_0x10ff('0x4c')]=qs[_0x10ff('0x3f')](_['pick'](_0x434fdb['query'],_0x326227['filters']));if(_0x434fdb[_0x10ff('0x41')]['filter']){_0x231efb['where']=_['merge'](_0x231efb[_0x10ff('0x4c')],{'$or':_['map'](_0x231efb[_0x10ff('0x42')],function(_0xd437a4){var _0x732265={};_0x732265[_0xd437a4]={'$like':'%'+_0x434fdb[_0x10ff('0x41')][_0x10ff('0x4b')]+'%'};return _0x732265;})});}_0x231efb=_['merge']({},_0x231efb,_0x434fdb[_0x10ff('0x4f')]);return _0x4a2cb9[_0x10ff('0x59')](_0x231efb);}})[_0x10ff('0x1e')](function(_0x283b08){if(_0x283b08){_0x2e3d23=_0x283b08['length'];if(!_0x434fdb[_0x10ff('0x41')]['hasOwnProperty']('nolimit')){_0x231efb[_0x10ff('0x47')]=qs[_0x10ff('0x47')](_0x434fdb[_0x10ff('0x41')][_0x10ff('0x47')]);_0x231efb[_0x10ff('0x2c')]=qs[_0x10ff('0x2c')](_0x434fdb['query']['offset']);}return _0x4a2cb9[_0x10ff('0x59')](_0x231efb);}})['then'](function(_0x16d8a3){if(_0x16d8a3){return _0x16d8a3?{'count':_0x2e3d23,'rows':_0x16d8a3}:null;}})[_0x10ff('0x1e')](respondWithResult(_0x1eced8,null))[_0x10ff('0x27')](handleError(_0x1eced8,null));};exports['addConfiguration']=function(_0x3c1b73,_0x2fd026,_0x4d7557){if(_0x3c1b73['body']['id']){delete _0x3c1b73[_0x10ff('0x57')]['id'];}return db[_0x10ff('0x38')]['findOne']({'where':{'id':_0x3c1b73[_0x10ff('0x58')]['id']}})[_0x10ff('0x1e')](handleEntityNotFound(_0x2fd026,null))[_0x10ff('0x1e')](function(_0x8bbfc8){if(_0x8bbfc8){_0x3c1b73[_0x10ff('0x57')][_0x10ff('0x5c')]=_0x8bbfc8['id'];_0x3c1b73[_0x10ff('0x57')]['Subjects']=integrations['getSubjects'](_0x3c1b73[_0x10ff('0x57')][_0x10ff('0x5d')],_0x3c1b73[_0x10ff('0x57')][_0x10ff('0x3b')]);_0x3c1b73[_0x10ff('0x57')]['Descriptions']=integrations['getDescriptions'](_0x3c1b73[_0x10ff('0x57')][_0x10ff('0x5d')],_0x3c1b73[_0x10ff('0x57')]['type']);return db[_0x10ff('0x5b')][_0x10ff('0x56')](_0x3c1b73[_0x10ff('0x57')],{'include':[{'model':db[_0x10ff('0x5e')],'as':_0x10ff('0x5f')},{'model':db[_0x10ff('0x5e')],'as':_0x10ff('0x60')}]});}return null;})['then'](respondWithResult(_0x2fd026,null))[_0x10ff('0x27')](handleError(_0x2fd026,null));};exports['getFields']=function(_0x2a8890,_0x52d9c3,_0x597237){var _0x183b43='';var _0x362bc9=['id',_0x10ff('0x34'),'assigned_user_id','created_by',_0x10ff('0x61'),_0x10ff('0x62'),'duration_hours',_0x10ff('0x63'),'parent_id','parent_type',_0x10ff('0x64'),_0x10ff('0x65')];return db[_0x10ff('0x38')][_0x10ff('0x5a')]({'where':{'id':_0x2a8890[_0x10ff('0x58')]['id']},'attributes':['id',_0x10ff('0x66'),_0x10ff('0x67'),_0x10ff('0x68')]})[_0x10ff('0x1e')](handleEntityNotFound(_0x52d9c3,null))[_0x10ff('0x1e')](function(_0x1fcc28){if(_0x1fcc28){_0x183b43=_0x1fcc28[_0x10ff('0x68')];var _0x466cb2=_0x183b43[_0x10ff('0x69')](-0x1);if(_0x466cb2==='/'){_0x183b43=_0x183b43[_0x10ff('0x6a')](0x0,_0x183b43[_0x10ff('0x6b')](_0x466cb2));}return rp({'method':_0x10ff('0x6c'),'uri':util[_0x10ff('0x6d')](_0x10ff('0x6e'),_0x183b43,_0x10ff('0x6f')),'json':!![],'form':{'method':_0x10ff('0x70'),'input_type':_0x10ff('0x71'),'response_type':_0x10ff('0x71'),'rest_data':JSON[_0x10ff('0x23')]({'user_auth':{'user_name':_0x1fcc28[_0x10ff('0x66')],'password':_0x1fcc28[_0x10ff('0x67')],'encryption':'PLAIN'},'application':_0x10ff('0x72')})}});}})[_0x10ff('0x1e')](function(_0x435435){if(_0x435435&&_0x435435[_0x10ff('0x34')]!==_0x10ff('0x73')&&_0x435435[_0x10ff('0x34')]!==_0x10ff('0x74')){return rp({'method':'POST','uri':util[_0x10ff('0x6d')]('%s%s',_0x183b43,_0x10ff('0x6f')),'json':!![],'form':{'method':_0x10ff('0x75'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x435435['id'],'module_name':_0x10ff('0x76')})}})[_0x10ff('0x1e')](function(_0x1dc20d){if(_0x1dc20d){var _0x72d121=_[_0x10ff('0x77')](_0x1dc20d['module_fields']);_['remove'](_0x72d121,function(_0x1fb7e8){return _0x362bc9[_0x10ff('0x78')](_0x1fb7e8['name']);});return{'count':_0x72d121['length'],'rows':_[_0x10ff('0x37')](_0x72d121,function(_0x227e75){return{'id':_0x227e75[_0x10ff('0x34')],'name':_0x227e75[_0x10ff('0x79')],'custom':_[_0x10ff('0x7a')](_0x227e75[_0x10ff('0x34')],'_c')?!![]:![],'options':_0x227e75[_0x10ff('0x4f')]?_['map'](_[_0x10ff('0x77')](_0x227e75[_0x10ff('0x4f')]),function(_0x152e0d){return{'name':_0x152e0d['value'],'value':_0x152e0d[_0x10ff('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x52d9c3,null))[_0x10ff('0x27')](function(_0x4f5082){var _0xd7c0ea=_0x2a8890['query']['test']?0x1f4:_0x4f5082[_0x10ff('0x7b')]||0x1f4;logger[_0x10ff('0x24')](_0x10ff('0x7c'),_0x10ff('0x7d'),_0xd7c0ea,JSON[_0x10ff('0x23')](_0x4f5082));delete _0x4f5082['name'];if(_0xd7c0ea===0x191){_0xd7c0ea=0x190;}_0x52d9c3['status'](_0xd7c0ea)['send'](_0x2a8890[_0x10ff('0x41')][_0x10ff('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x4f5082[_0x10ff('0x7b')]}:_0x4f5082);});}else{var _0x1c16d0=0x1f4;_0x52d9c3[_0x10ff('0x28')](_0x1c16d0)['send']({'message':_0x10ff('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index e8eaec4..bf3234b 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 _0x046f=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x046f,0x1b4));var _0xf046=function(_0x41b0d5,_0x2f7baa){_0x41b0d5=_0x41b0d5-0x0;var _0xb9c58b=_0x046f[_0x41b0d5];return _0xb9c58b;};'use strict';var _=require(_0xf046('0x0'));var util=require(_0xf046('0x1'));var logger=require(_0xf046('0x2'))(_0xf046('0x3'));var moment=require(_0xf046('0x4'));var BPromise=require(_0xf046('0x5'));var rp=require(_0xf046('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf046('0x7'));var config=require(_0xf046('0x8'));var attributes=require(_0xf046('0x9'));var integrations=require(_0xf046('0xa'));module[_0xf046('0xb')]=function(_0xdafbd4,_0x310429){return _0xdafbd4[_0xf046('0xc')](_0xf046('0xd'),attributes,{'tableName':_0xf046('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5df=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','request-promise','path'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xc5df,0x80));var _0xfc5d=function(_0x2c3923,_0x4a06b0){_0x2c3923=_0x2c3923-0x0;var _0x570b29=_0xc5df[_0x2c3923];return _0x570b29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc5d('0x0'))(_0xfc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc5d('0x2'));var fs=require('fs');var path=require(_0xfc5d('0x3'));var rimraf=require(_0xfc5d('0x4'));var config=require(_0xfc5d('0x5'));var attributes=require(_0xfc5d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xfc5d('0x7')]=function(_0x2df24e,_0x1b8b10){return _0x2df24e[_0xfc5d('0x8')](_0xfc5d('0x9'),attributes,{'tableName':_0xfc5d('0xa'),'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 7d83fae..9ad2b3e 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 _0x00f5=['attributes','catch','ShowSugarcrmAccount','find','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','options','where','limit','include','map','model'];(function(_0x2deb3e,_0xc298b7){var _0x491f81=function(_0x2abbcd){while(--_0x2abbcd){_0x2deb3e['push'](_0x2deb3e['shift']());}};_0x491f81(++_0xc298b7);}(_0x00f5,0x7d));var _0x500f=function(_0x25a33b,_0x15d1ff){_0x25a33b=_0x25a33b-0x0;var _0x15346c=_0x00f5[_0x25a33b];return _0x15346c;};'use strict';var _=require(_0x500f('0x0'));var util=require('util');var moment=require(_0x500f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x500f('0x2'));var db=require(_0x500f('0x3'))['db'];var utils=require(_0x500f('0x4'));var logger=require('../../config/logger')(_0x500f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x500f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a33b1,_0x37e7d3,_0xa5e112){return new BPromise(function(_0x5ac97c,_0x1a8a49){return client['request'](_0x8a33b1,_0xa5e112)[_0x500f('0x7')](function(_0xd14580){logger[_0x500f('0x8')](_0x500f('0x9'),_0x37e7d3,_0x500f('0xa'));logger[_0x500f('0xb')](_0x500f('0xc'),_0x37e7d3,'request\x20sent',JSON[_0x500f('0xd')](_0xd14580));if(_0xd14580[_0x500f('0xe')]){if(_0xd14580[_0x500f('0xe')][_0x500f('0xf')]===0x1f4){logger[_0x500f('0xe')](_0x500f('0x9'),_0x37e7d3,_0xd14580[_0x500f('0xe')]['message']);return _0x1a8a49(_0xd14580[_0x500f('0xe')][_0x500f('0x10')]);}logger[_0x500f('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x37e7d3,_0xd14580[_0x500f('0xe')][_0x500f('0x10')]);return _0x5ac97c(_0xd14580[_0x500f('0xe')][_0x500f('0x10')]);}else{logger[_0x500f('0x8')](_0x500f('0x9'),_0x37e7d3,_0x500f('0xa'));_0x5ac97c(_0xd14580[_0x500f('0x11')][_0x500f('0x10')]);}})['catch'](function(_0x39c877){logger[_0x500f('0xe')](_0x500f('0x9'),_0x37e7d3,_0x39c877);_0x1a8a49(_0x39c877);});});}exports[_0x500f('0x12')]=function(_0x1ff267){var _0x219eed=this;return new Promise(function(_0x2dd28b,_0x477e77){return db['SugarcrmAccount']['findAll']({'raw':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')][_0x500f('0x14')]||null:null,'attributes':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')]['attributes']||null:null,'limit':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')][_0x500f('0x15')]||null:null,'include':_0x1ff267[_0x500f('0x13')]?_0x1ff267['options'][_0x500f('0x16')]?_[_0x500f('0x17')](_0x1ff267[_0x500f('0x13')][_0x500f('0x16')],function(_0x3f4100){return{'model':db[_0x3f4100[_0x500f('0x18')]],'as':_0x3f4100['as'],'attributes':_0x3f4100['attributes'],'include':_0x3f4100['include']?_[_0x500f('0x17')](_0x3f4100[_0x500f('0x16')],function(_0x2a0183){return{'model':db[_0x2a0183[_0x500f('0x18')]],'as':_0x2a0183['as'],'attributes':_0x2a0183[_0x500f('0x19')],'include':_0x2a0183[_0x500f('0x16')]?_[_0x500f('0x17')](_0x2a0183[_0x500f('0x16')],function(_0x59964b){return{'model':db[_0x59964b['model']],'as':_0x59964b['as'],'attributes':_0x59964b[_0x500f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x500f('0x7')](function(_0x145c12){logger[_0x500f('0x8')](_0x500f('0x12'),_0x1ff267);logger['debug']('GetSugarcrmAccount',_0x1ff267,JSON['stringify'](_0x145c12));_0x2dd28b(_0x145c12);})[_0x500f('0x1a')](function(_0x328610){logger[_0x500f('0xe')](_0x500f('0x12'),_0x328610[_0x500f('0x10')],_0x1ff267);_0x477e77(_0x219eed[_0x500f('0xe')](0x1f4,_0x328610[_0x500f('0x10')]));});});};exports[_0x500f('0x1b')]=function(_0x100cfd){var _0x12df27=this;return new Promise(function(_0x37b09f,_0x35e743){return db['SugarcrmAccount'][_0x500f('0x1c')]({'raw':_0x100cfd[_0x500f('0x13')]?_0x100cfd['options'][_0x500f('0x1d')]===undefined?!![]:![]:!![],'where':_0x100cfd[_0x500f('0x13')]?_0x100cfd[_0x500f('0x13')][_0x500f('0x14')]||null:null,'attributes':_0x100cfd['options']?_0x100cfd[_0x500f('0x13')][_0x500f('0x19')]||null:null,'include':_0x100cfd[_0x500f('0x13')]?_0x100cfd[_0x500f('0x13')][_0x500f('0x16')]?_[_0x500f('0x17')](_0x100cfd[_0x500f('0x13')][_0x500f('0x16')],function(_0x49eac0){return{'model':db[_0x49eac0[_0x500f('0x18')]],'as':_0x49eac0['as'],'attributes':_0x49eac0['attributes'],'include':_0x49eac0[_0x500f('0x16')]?_[_0x500f('0x17')](_0x49eac0[_0x500f('0x16')],function(_0x3e9e17){return{'model':db[_0x3e9e17[_0x500f('0x18')]],'as':_0x3e9e17['as'],'attributes':_0x3e9e17[_0x500f('0x19')],'include':_0x3e9e17[_0x500f('0x16')]?_[_0x500f('0x17')](_0x3e9e17[_0x500f('0x16')],function(_0x41b950){return{'model':db[_0x41b950[_0x500f('0x18')]],'as':_0x41b950['as'],'attributes':_0x41b950[_0x500f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x500f('0x7')](function(_0x457662){logger[_0x500f('0x8')](_0x500f('0x1b'),_0x100cfd);logger[_0x500f('0xb')](_0x500f('0x1b'),_0x100cfd,JSON[_0x500f('0xd')](_0x457662));_0x37b09f(_0x457662);})[_0x500f('0x1a')](function(_0x1a757b){logger['error'](_0x500f('0x1b'),_0x1a757b[_0x500f('0x10')],_0x100cfd);_0x35e743(_0x12df27[_0x500f('0xe')](0x1f4,_0x1a757b[_0x500f('0x10')]));});});}; \ No newline at end of file +var _0x36b7=['ShowSugarcrmAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36b7,0xb6));var _0x736b=function(_0x338f23,_0x4baf56){_0x338f23=_0x338f23-0x0;var _0x11a457=_0x36b7[_0x338f23];return _0x11a457;};'use strict';var _=require(_0x736b('0x0'));var util=require(_0x736b('0x1'));var moment=require('moment');var BPromise=require(_0x736b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x736b('0x3'));var db=require(_0x736b('0x4'))['db'];var utils=require(_0x736b('0x5'));var logger=require(_0x736b('0x6'))('rpc');var config=require(_0x736b('0x7'));var jayson=require(_0x736b('0x8'));var client=jayson[_0x736b('0x9')][_0x736b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1afb2a,_0x4b3467,_0x215efb){return new BPromise(function(_0x2552b3,_0x5127c1){return client[_0x736b('0xb')](_0x1afb2a,_0x215efb)[_0x736b('0xc')](function(_0x4a0d4c){logger[_0x736b('0xd')](_0x736b('0xe'),_0x4b3467,_0x736b('0xf'));logger[_0x736b('0x10')](_0x736b('0x11'),_0x4b3467,_0x736b('0xf'),JSON[_0x736b('0x12')](_0x4a0d4c));if(_0x4a0d4c['error']){if(_0x4a0d4c[_0x736b('0x13')][_0x736b('0x14')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4b3467,_0x4a0d4c[_0x736b('0x13')]['message']);return _0x5127c1(_0x4a0d4c['error']['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4b3467,_0x4a0d4c['error'][_0x736b('0x15')]);return _0x2552b3(_0x4a0d4c[_0x736b('0x13')][_0x736b('0x15')]);}else{logger[_0x736b('0xd')](_0x736b('0xe'),_0x4b3467,_0x736b('0xf'));_0x2552b3(_0x4a0d4c[_0x736b('0x16')][_0x736b('0x15')]);}})[_0x736b('0x17')](function(_0x31a964){logger['error'](_0x736b('0xe'),_0x4b3467,_0x31a964);_0x5127c1(_0x31a964);});});}exports['GetSugarcrmAccount']=function(_0x2b2869){var _0xcba0b=this;return new Promise(function(_0x5d9816,_0x284a0a){return db[_0x736b('0x18')]['findAll']({'raw':_0x2b2869[_0x736b('0x19')]?_0x2b2869[_0x736b('0x19')][_0x736b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b2869[_0x736b('0x19')]?_0x2b2869['options'][_0x736b('0x1b')]||null:null,'attributes':_0x2b2869[_0x736b('0x19')]?_0x2b2869[_0x736b('0x19')][_0x736b('0x1c')]||null:null,'limit':_0x2b2869['options']?_0x2b2869[_0x736b('0x19')][_0x736b('0x1d')]||null:null,'include':_0x2b2869[_0x736b('0x19')]?_0x2b2869[_0x736b('0x19')][_0x736b('0x1e')]?_[_0x736b('0x1f')](_0x2b2869['options'][_0x736b('0x1e')],function(_0x33c1f9){return{'model':db[_0x33c1f9[_0x736b('0x20')]],'as':_0x33c1f9['as'],'attributes':_0x33c1f9[_0x736b('0x1c')],'include':_0x33c1f9['include']?_['map'](_0x33c1f9[_0x736b('0x1e')],function(_0x41506b){return{'model':db[_0x41506b[_0x736b('0x20')]],'as':_0x41506b['as'],'attributes':_0x41506b[_0x736b('0x1c')],'include':_0x41506b[_0x736b('0x1e')]?_[_0x736b('0x1f')](_0x41506b[_0x736b('0x1e')],function(_0x10fad8){return{'model':db[_0x10fad8[_0x736b('0x20')]],'as':_0x10fad8['as'],'attributes':_0x10fad8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2758cc){logger[_0x736b('0xd')](_0x736b('0x21'),_0x2b2869);logger[_0x736b('0x10')]('GetSugarcrmAccount',_0x2b2869,JSON[_0x736b('0x12')](_0x2758cc));_0x5d9816(_0x2758cc);})['catch'](function(_0x2a02e0){logger['error']('GetSugarcrmAccount',_0x2a02e0[_0x736b('0x15')],_0x2b2869);_0x284a0a(_0xcba0b[_0x736b('0x13')](0x1f4,_0x2a02e0[_0x736b('0x15')]));});});};exports[_0x736b('0x22')]=function(_0x12532a){var _0x4e46ba=this;return new Promise(function(_0x9ba6fd,_0x171e7d){return db[_0x736b('0x18')][_0x736b('0x23')]({'raw':_0x12532a[_0x736b('0x19')]?_0x12532a[_0x736b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x12532a[_0x736b('0x19')]?_0x12532a['options'][_0x736b('0x1b')]||null:null,'attributes':_0x12532a[_0x736b('0x19')]?_0x12532a[_0x736b('0x19')][_0x736b('0x1c')]||null:null,'include':_0x12532a[_0x736b('0x19')]?_0x12532a[_0x736b('0x19')]['include']?_[_0x736b('0x1f')](_0x12532a[_0x736b('0x19')]['include'],function(_0x25f917){return{'model':db[_0x25f917[_0x736b('0x20')]],'as':_0x25f917['as'],'attributes':_0x25f917[_0x736b('0x1c')],'include':_0x25f917[_0x736b('0x1e')]?_['map'](_0x25f917[_0x736b('0x1e')],function(_0x1b3a9e){return{'model':db[_0x1b3a9e[_0x736b('0x20')]],'as':_0x1b3a9e['as'],'attributes':_0x1b3a9e[_0x736b('0x1c')],'include':_0x1b3a9e[_0x736b('0x1e')]?_[_0x736b('0x1f')](_0x1b3a9e[_0x736b('0x1e')],function(_0x26e600){return{'model':db[_0x26e600['model']],'as':_0x26e600['as'],'attributes':_0x26e600[_0x736b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x461292){logger[_0x736b('0xd')](_0x736b('0x22'),_0x12532a);logger[_0x736b('0x10')]('ShowSugarcrmAccount',_0x12532a,JSON[_0x736b('0x12')](_0x461292));_0x9ba6fd(_0x461292);})['catch'](function(_0xba7cfc){logger[_0x736b('0x13')](_0x736b('0x22'),_0xba7cfc[_0x736b('0x15')],_0x12532a);_0x171e7d(_0x4e46ba['error'](0x1f4,_0xba7cfc[_0x736b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1cf0aa9..521d659 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 _0xa227=['exports','multer','path','express','get','index','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','update','delete','/:id','destroy'];(function(_0x3ae147,_0x4ca19b){var _0x235663=function(_0x1a9a99){while(--_0x1a9a99){_0x3ae147['push'](_0x3ae147['shift']());}};_0x235663(++_0x4ca19b);}(_0xa227,0xab));var _0x7a22=function(_0x9bb625,_0x6b2114){_0x9bb625=_0x9bb625-0x0;var _0x3b4b82=_0xa227[_0x9bb625];return _0x3b4b82;};'use strict';var multer=require(_0x7a22('0x0'));var util=require('util');var path=require(_0x7a22('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a22('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x7a22('0x3')]('/',auth['isAuthenticated'](),controller[_0x7a22('0x4')]);router[_0x7a22('0x3')]('/:id',auth[_0x7a22('0x5')](),controller['show']);router[_0x7a22('0x3')](_0x7a22('0x6'),auth[_0x7a22('0x5')](),controller[_0x7a22('0x7')]);router['get']('/:id/subjects',auth[_0x7a22('0x5')](),controller[_0x7a22('0x8')]);router[_0x7a22('0x3')](_0x7a22('0x9'),auth[_0x7a22('0x5')](),controller['getDescriptions']);router[_0x7a22('0xa')]('/',auth[_0x7a22('0x5')](),controller[_0x7a22('0xb')]);router['put']('/:id',auth[_0x7a22('0x5')](),controller[_0x7a22('0xc')]);router[_0x7a22('0xd')](_0x7a22('0xe'),auth[_0x7a22('0x5')](),controller[_0x7a22('0xf')]);module[_0x7a22('0x10')]=router; \ No newline at end of file +var _0x55c6=['get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index'];(function(_0xa89c3e,_0x144268){var _0x48072f=function(_0x4a1fe2){while(--_0x4a1fe2){_0xa89c3e['push'](_0xa89c3e['shift']());}};_0x48072f(++_0x144268);}(_0x55c6,0x1d7));var _0x655c=function(_0x4dc805,_0x25db7a){_0x4dc805=_0x4dc805-0x0;var _0x50a907=_0x55c6[_0x4dc805];return _0x50a907;};'use strict';var multer=require(_0x655c('0x0'));var util=require(_0x655c('0x1'));var path=require(_0x655c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x655c('0x3')]();var auth=require(_0x655c('0x4'));var interaction=require(_0x655c('0x5'));var config=require(_0x655c('0x6'));var controller=require(_0x655c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x655c('0x8')]);router[_0x655c('0x9')](_0x655c('0xa'),auth[_0x655c('0xb')](),controller[_0x655c('0xc')]);router[_0x655c('0x9')](_0x655c('0xd'),auth[_0x655c('0xb')](),controller['getFields']);router[_0x655c('0x9')](_0x655c('0xe'),auth['isAuthenticated'](),controller[_0x655c('0xf')]);router[_0x655c('0x9')](_0x655c('0x10'),auth[_0x655c('0xb')](),controller[_0x655c('0x11')]);router[_0x655c('0x12')]('/',auth[_0x655c('0xb')](),controller[_0x655c('0x13')]);router[_0x655c('0x14')](_0x655c('0xa'),auth[_0x655c('0xb')](),controller[_0x655c('0x15')]);router[_0x655c('0x16')](_0x655c('0xa'),auth[_0x655c('0xb')](),controller[_0x655c('0x17')]);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 05ff0e5..57cc425 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 _0x039b=['exports','STRING'];(function(_0x4f7fe0,_0x18201f){var _0x1e2851=function(_0x448ddc){while(--_0x448ddc){_0x4f7fe0['push'](_0x4f7fe0['shift']());}};_0x1e2851(++_0x18201f);}(_0x039b,0x1ba));var _0xb039=function(_0x41b44a,_0x41dbec){_0x41b44a=_0x41b44a-0x0;var _0x13fc4d=_0x039b[_0x41b44a];return _0x13fc4d;};'use strict';var Sequelize=require('sequelize');module[_0xb039('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb039('0x1')]}}; \ No newline at end of file +var _0x5894=['STRING','exports'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x5894,0xfd));var _0x4589=function(_0x26478d,_0x120071){_0x26478d=_0x26478d-0x0;var _0xcfd771=_0x5894[_0x26478d];return _0xcfd771;};'use strict';var Sequelize=require('sequelize');module[_0x4589('0x0')]={'name':{'type':Sequelize[_0x4589('0x1')]},'description':{'type':Sequelize[_0x4589('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d6b16fc..0f7fc67 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 _0x7cbc=['params','include','create','body','update','find','findOne','SugarcrmField','getFields','getSubjects','order','pick','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','findAll','rows'];(function(_0x569da2,_0x26aa52){var _0x211bcf=function(_0x1fa0c2){while(--_0x1fa0c2){_0x569da2['push'](_0x569da2['shift']());}};_0x211bcf(++_0x26aa52);}(_0x7cbc,0x171));var _0xc7cb=function(_0x3c12ed,_0x55bc55){_0x3c12ed=_0x3c12ed-0x0;var _0x43320e=_0x7cbc[_0x3c12ed];return _0x43320e;};'use strict';var pdf=require(_0xc7cb('0x0'));var emlformat=require(_0xc7cb('0x1'));var rimraf=require(_0xc7cb('0x2'));var zipdir=require(_0xc7cb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7cb('0x4'));var moment=require('moment');var BPromise=require(_0xc7cb('0x5'));var Mustache=require(_0xc7cb('0x6'));var util=require('util');var path=require(_0xc7cb('0x7'));var sox=require(_0xc7cb('0x8'));var csv=require(_0xc7cb('0x9'));var ejs=require(_0xc7cb('0xa'));var fs=require('fs');var _=require(_0xc7cb('0xb'));var squel=require('squel');var crypto=require(_0xc7cb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc7cb('0xd'));var Papa=require(_0xc7cb('0xe'));var Redis=require(_0xc7cb('0xf'));var authService=require(_0xc7cb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc7cb('0x11'));var hardwareService=require(_0xc7cb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc7cb('0x13'));var config=require(_0xc7cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc7cb('0x15'))['db'];var jayson=require(_0xc7cb('0x16'));var client=jayson[_0xc7cb('0x17')][_0xc7cb('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2e9266,_0x458887,_0x4e9ffd,_0x973f7d){return new BPromise(function(_0xe6aa78,_0x2c844f){var _0x3af4bb=_0x973f7d||client;return _0x3af4bb[_0xc7cb('0x19')](_0x2e9266,_0x4e9ffd)[_0xc7cb('0x1a')](function(_0x114153){logger[_0xc7cb('0x1b')](_0xc7cb('0x1c'),_0x458887,_0xc7cb('0x1d'));logger[_0xc7cb('0x1e')](_0xc7cb('0x1f'),_0x458887,_0xc7cb('0x1d'),JSON[_0xc7cb('0x20')](_0x114153));if(_0x114153[_0xc7cb('0x21')]){if(_0x114153[_0xc7cb('0x21')][_0xc7cb('0x22')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x458887,_0x114153[_0xc7cb('0x21')][_0xc7cb('0x23')]);return _0x2c844f(_0x114153[_0xc7cb('0x21')][_0xc7cb('0x23')]);}logger[_0xc7cb('0x21')](_0xc7cb('0x1c'),_0x458887,_0x114153['error'][_0xc7cb('0x23')]);return _0xe6aa78(_0x114153[_0xc7cb('0x21')][_0xc7cb('0x23')]);}else{logger[_0xc7cb('0x1b')](_0xc7cb('0x1c'),_0x458887,_0xc7cb('0x1d'));_0xe6aa78(_0x114153[_0xc7cb('0x24')]['message']);}})[_0xc7cb('0x25')](function(_0x59ed96){logger[_0xc7cb('0x21')](_0xc7cb('0x1c'),_0x458887,_0x59ed96);_0x2c844f(_0x59ed96);});});}function respondWithStatusCode(_0x3ef390,_0x4aaf48){_0x4aaf48=_0x4aaf48||0xcc;return function(_0x27e22c){if(_0x27e22c){return _0x3ef390[_0xc7cb('0x26')](_0x4aaf48);}return _0x3ef390['status'](_0x4aaf48)[_0xc7cb('0x27')]();};}function respondWithResult(_0x488f52,_0x354e1a){_0x354e1a=_0x354e1a||0xc8;return function(_0x541992){if(_0x541992){return _0x488f52[_0xc7cb('0x28')](_0x354e1a)[_0xc7cb('0x29')](_0x541992);}};}function respondWithFilteredResult(_0x308ac3,_0x5ab5bf){return function(_0x22a115){if(_0x22a115){var _0x1ee377=_0x22a115[_0xc7cb('0x2a')],_0x1f2297=_0x5ab5bf[_0xc7cb('0x2b')],_0x100084=_0x5ab5bf[_0xc7cb('0x2b')]+_0x5ab5bf['limit'],_0x5096e5;if(_0x100084>=_0x1ee377){_0x100084=_0x1ee377;_0x5096e5=0xc8;}else{_0x5096e5=0xce;}_0x308ac3[_0xc7cb('0x28')](_0x5096e5);return _0x308ac3[_0xc7cb('0x2c')]('Content-Range',_0x1f2297+'-'+_0x100084+'/'+_0x1ee377)[_0xc7cb('0x29')](_0x22a115);}return null;};}function patchUpdates(_0x36e6c5){return function(_0x1048bb){try{jsonpatch[_0xc7cb('0x2d')](_0x1048bb,_0x36e6c5,!![]);}catch(_0x293253){return BPromise['reject'](_0x293253);}return _0x1048bb['save']();};}function saveUpdates(_0x4df643,_0x46b3eb){return function(_0x2b7d4f){if(_0x2b7d4f){return _0x2b7d4f['update'](_0x4df643)[_0xc7cb('0x1a')](function(_0x55f3c3){return _0x55f3c3;});}return null;};}function removeEntity(_0x515de1,_0x748d85){return function(_0x387e23){if(_0x387e23){return _0x387e23[_0xc7cb('0x2e')]()[_0xc7cb('0x1a')](function(){_0x515de1[_0xc7cb('0x28')](0xcc)[_0xc7cb('0x27')]();});}};}function handleEntityNotFound(_0x548f3d,_0x1c32db){return function(_0x458d6c){if(!_0x458d6c){_0x548f3d[_0xc7cb('0x26')](0x194);}return _0x458d6c;};}function handleError(_0x4b6e49,_0x2b311){_0x2b311=_0x2b311||0x1f4;return function(_0x5866f0){logger[_0xc7cb('0x21')](_0x5866f0['stack']);if(_0x5866f0[_0xc7cb('0x2f')]){delete _0x5866f0[_0xc7cb('0x2f')];}_0x4b6e49[_0xc7cb('0x28')](_0x2b311)[_0xc7cb('0x30')](_0x5866f0);};}exports[_0xc7cb('0x31')]=function(_0x1a9ee3,_0x4dab19){var _0x4e430b={},_0x3e86d0={},_0x32015f={'count':0x0,'rows':[]};var _0x4c3929=_[_0xc7cb('0x32')](db['SugarcrmConfiguration'][_0xc7cb('0x33')],function(_0xe4cb48){return{'name':_0xe4cb48[_0xc7cb('0x34')],'type':_0xe4cb48[_0xc7cb('0x35')][_0xc7cb('0x36')]};});_0x3e86d0['model']=_[_0xc7cb('0x32')](_0x4c3929,_0xc7cb('0x2f'));_0x3e86d0[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x1a9ee3[_0xc7cb('0x37')]);_0x3e86d0[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0x3e86d0['model'],_0x3e86d0[_0xc7cb('0x37')]);_0x4e430b[_0xc7cb('0x3b')]=_[_0xc7cb('0x3a')](_0x3e86d0[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x3d')]));_0x4e430b[_0xc7cb('0x3b')]=_0x4e430b[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x4e430b['attributes']:_0x3e86d0[_0xc7cb('0x3c')];if(!_0x1a9ee3['query'][_0xc7cb('0x3f')](_0xc7cb('0x40'))){_0x4e430b['limit']=qs[_0xc7cb('0x41')](_0x1a9ee3[_0xc7cb('0x37')]['limit']);_0x4e430b['offset']=qs['offset'](_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x2b')]);}_0x4e430b['order']=qs[_0xc7cb('0x42')](_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x42')]);_0x4e430b[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_['pick'](_0x1a9ee3['query'],_0x3e86d0[_0xc7cb('0x39')]),_0x4c3929);if(_0x1a9ee3['query'][_0xc7cb('0x44')]){_0x4e430b[_0xc7cb('0x43')]=_[_0xc7cb('0x45')](_0x4e430b[_0xc7cb('0x43')],{'$or':_[_0xc7cb('0x32')](_0x4c3929,function(_0x29d4e5){if(_0x29d4e5[_0xc7cb('0x35')]!==_0xc7cb('0x46')){var _0xd3dd3e={};_0xd3dd3e[_0x29d4e5[_0xc7cb('0x2f')]]={'$like':'%'+_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x44')]+'%'};return _0xd3dd3e;}})});}_0x4e430b=_['merge']({},_0x4e430b,_0x1a9ee3[_0xc7cb('0x47')]);var _0x2a2c10={'where':_0x4e430b[_0xc7cb('0x43')]};return db[_0xc7cb('0x48')]['count'](_0x2a2c10)[_0xc7cb('0x1a')](function(_0x350450){_0x32015f['count']=_0x350450;if(_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x49')]){_0x4e430b['include']=[{'all':!![]}];}return db[_0xc7cb('0x48')][_0xc7cb('0x4a')](_0x4e430b);})[_0xc7cb('0x1a')](function(_0x6b3d60){_0x32015f[_0xc7cb('0x4b')]=_0x6b3d60;return _0x32015f;})[_0xc7cb('0x1a')](respondWithFilteredResult(_0x4dab19,_0x4e430b))[_0xc7cb('0x25')](handleError(_0x4dab19,null));};exports['show']=function(_0x24b36e,_0x4b88c2){var _0x197b44={'raw':![],'where':{'id':_0x24b36e[_0xc7cb('0x4c')]['id']}},_0x5bd024={};_0x5bd024[_0xc7cb('0x3c')]=_[_0xc7cb('0x38')](db[_0xc7cb('0x48')][_0xc7cb('0x33')]);_0x5bd024[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x24b36e['query']);_0x5bd024[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0x5bd024[_0xc7cb('0x3c')],_0x5bd024[_0xc7cb('0x37')]);_0x197b44[_0xc7cb('0x3b')]=_['intersection'](_0x5bd024[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0x24b36e[_0xc7cb('0x37')][_0xc7cb('0x3d')]));_0x197b44[_0xc7cb('0x3b')]=_0x197b44[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x197b44[_0xc7cb('0x3b')]:_0x5bd024[_0xc7cb('0x3c')];if(_0x24b36e[_0xc7cb('0x37')][_0xc7cb('0x49')]){_0x197b44[_0xc7cb('0x4d')]=[{'all':!![]}];}_0x197b44=_[_0xc7cb('0x45')]({},_0x197b44,_0x24b36e['options']);return db[_0xc7cb('0x48')]['find'](_0x197b44)[_0xc7cb('0x1a')](handleEntityNotFound(_0x4b88c2,null))[_0xc7cb('0x1a')](respondWithResult(_0x4b88c2,null))[_0xc7cb('0x25')](handleError(_0x4b88c2,null));};exports[_0xc7cb('0x4e')]=function(_0x5191af,_0x4b98de){return db[_0xc7cb('0x48')]['create'](_0x5191af[_0xc7cb('0x4f')],{})[_0xc7cb('0x1a')](respondWithResult(_0x4b98de,0xc9))['catch'](handleError(_0x4b98de,null));};exports[_0xc7cb('0x50')]=function(_0x46c7f6,_0x63e1c){if(_0x46c7f6[_0xc7cb('0x4f')]['id']){delete _0x46c7f6['body']['id'];}return db[_0xc7cb('0x48')][_0xc7cb('0x51')]({'where':{'id':_0x46c7f6[_0xc7cb('0x4c')]['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x63e1c,null))[_0xc7cb('0x1a')](saveUpdates(_0x46c7f6[_0xc7cb('0x4f')],null))[_0xc7cb('0x1a')](respondWithResult(_0x63e1c,null))[_0xc7cb('0x25')](handleError(_0x63e1c,null));};exports['destroy']=function(_0xd7a478,_0x49b3fe){return db[_0xc7cb('0x48')][_0xc7cb('0x51')]({'where':{'id':_0xd7a478[_0xc7cb('0x4c')]['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x49b3fe,null))[_0xc7cb('0x1a')](removeEntity(_0x49b3fe,null))[_0xc7cb('0x25')](handleError(_0x49b3fe,null));};exports['getFields']=function(_0xa2a021,_0x5c367c,_0x210888){var _0x323f7c={};var _0x5258ea={};var _0x444446;var _0x120832;return db[_0xc7cb('0x48')][_0xc7cb('0x52')]({'where':{'id':_0xa2a021[_0xc7cb('0x4c')]['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x5c367c,null))[_0xc7cb('0x1a')](function(_0xdb64a0){if(_0xdb64a0){_0x444446=_0xdb64a0;_0x5258ea[_0xc7cb('0x3c')]=_['keys'](db[_0xc7cb('0x53')][_0xc7cb('0x33')]);_0x5258ea[_0xc7cb('0x37')]=_['keys'](_0xa2a021[_0xc7cb('0x37')]);_0x5258ea[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0x5258ea['model'],_0x5258ea[_0xc7cb('0x37')]);_0x323f7c['attributes']=_[_0xc7cb('0x3a')](_0x5258ea[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0xa2a021[_0xc7cb('0x37')]['fields']));_0x323f7c[_0xc7cb('0x3b')]=_0x323f7c[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x323f7c['attributes']:_0x5258ea[_0xc7cb('0x3c')];_0x323f7c['order']=qs[_0xc7cb('0x42')](_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x42')]);_0x323f7c[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_['pick'](_0xa2a021[_0xc7cb('0x37')],_0x5258ea[_0xc7cb('0x39')]));if(_0xa2a021['query']['filter']){_0x323f7c[_0xc7cb('0x43')]=_[_0xc7cb('0x45')](_0x323f7c[_0xc7cb('0x43')],{'$or':_[_0xc7cb('0x32')](_0x323f7c[_0xc7cb('0x3b')],function(_0x2308ea){var _0xd97787={};_0xd97787[_0x2308ea]={'$like':'%'+_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x44')]+'%'};return _0xd97787;})});}_0x323f7c=_[_0xc7cb('0x45')]({},_0x323f7c,_0xa2a021['options']);return _0x444446[_0xc7cb('0x54')](_0x323f7c);}})[_0xc7cb('0x1a')](function(_0x382394){if(_0x382394){_0x120832=_0x382394[_0xc7cb('0x3e')];if(!_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x3f')](_0xc7cb('0x40'))){_0x323f7c['limit']=qs[_0xc7cb('0x41')](_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x41')]);_0x323f7c[_0xc7cb('0x2b')]=qs['offset'](_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x2b')]);}return _0x444446['getFields'](_0x323f7c);}})['then'](function(_0x3d82d0){if(_0x3d82d0){return _0x3d82d0?{'count':_0x120832,'rows':_0x3d82d0}:null;}})[_0xc7cb('0x1a')](respondWithResult(_0x5c367c,null))['catch'](handleError(_0x5c367c,null));};exports[_0xc7cb('0x55')]=function(_0x5c889c,_0xeef3c5,_0x235689){var _0x98e4d2={};var _0x581674={};var _0x3ef183;var _0x3d14e3;return db[_0xc7cb('0x48')][_0xc7cb('0x52')]({'where':{'id':_0x5c889c[_0xc7cb('0x4c')]['id']}})['then'](handleEntityNotFound(_0xeef3c5,null))[_0xc7cb('0x1a')](function(_0x306b97){if(_0x306b97){_0x3ef183=_0x306b97;_0x581674[_0xc7cb('0x3c')]=_[_0xc7cb('0x38')](db[_0xc7cb('0x53')]['rawAttributes']);_0x581674[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x5c889c[_0xc7cb('0x37')]);_0x581674[_0xc7cb('0x39')]=_['intersection'](_0x581674[_0xc7cb('0x3c')],_0x581674[_0xc7cb('0x37')]);_0x98e4d2[_0xc7cb('0x3b')]=_['intersection'](_0x581674[_0xc7cb('0x3c')],qs['fields'](_0x5c889c['query'][_0xc7cb('0x3d')]));_0x98e4d2[_0xc7cb('0x3b')]=_0x98e4d2[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x98e4d2['attributes']:_0x581674['model'];_0x98e4d2[_0xc7cb('0x56')]=qs[_0xc7cb('0x42')](_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x42')]);_0x98e4d2[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_[_0xc7cb('0x57')](_0x5c889c['query'],_0x581674[_0xc7cb('0x39')]));if(_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x44')]){_0x98e4d2[_0xc7cb('0x43')]=_['merge'](_0x98e4d2['where'],{'$or':_[_0xc7cb('0x32')](_0x98e4d2['attributes'],function(_0x2dbc73){var _0x4a45df={};_0x4a45df[_0x2dbc73]={'$like':'%'+_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x44')]+'%'};return _0x4a45df;})});}_0x98e4d2=_['merge']({},_0x98e4d2,_0x5c889c[_0xc7cb('0x47')]);return _0x3ef183[_0xc7cb('0x55')](_0x98e4d2);}})['then'](function(_0x3199b2){if(_0x3199b2){_0x3d14e3=_0x3199b2[_0xc7cb('0x3e')];if(!_0x5c889c[_0xc7cb('0x37')]['hasOwnProperty'](_0xc7cb('0x40'))){_0x98e4d2[_0xc7cb('0x41')]=qs[_0xc7cb('0x41')](_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x41')]);_0x98e4d2[_0xc7cb('0x2b')]=qs['offset'](_0x5c889c[_0xc7cb('0x37')]['offset']);}return _0x3ef183[_0xc7cb('0x55')](_0x98e4d2);}})[_0xc7cb('0x1a')](function(_0x41c53b){if(_0x41c53b){return _0x41c53b?{'count':_0x3d14e3,'rows':_0x41c53b}:null;}})['then'](respondWithResult(_0xeef3c5,null))[_0xc7cb('0x25')](handleError(_0xeef3c5,null));};exports[_0xc7cb('0x58')]=function(_0x1dff6d,_0x4f8d24,_0x3b8b4a){var _0x2069e6={};var _0xd31f19={};var _0x46c2b8;var _0x135f62;return db[_0xc7cb('0x48')][_0xc7cb('0x52')]({'where':{'id':_0x1dff6d['params']['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x4f8d24,null))[_0xc7cb('0x1a')](function(_0x242d2e){if(_0x242d2e){_0x46c2b8=_0x242d2e;_0xd31f19[_0xc7cb('0x3c')]=_[_0xc7cb('0x38')](db[_0xc7cb('0x53')][_0xc7cb('0x33')]);_0xd31f19[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x1dff6d['query']);_0xd31f19[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0xd31f19[_0xc7cb('0x3c')],_0xd31f19['query']);_0x2069e6[_0xc7cb('0x3b')]=_[_0xc7cb('0x3a')](_0xd31f19[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0x1dff6d['query'][_0xc7cb('0x3d')]));_0x2069e6[_0xc7cb('0x3b')]=_0x2069e6[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x2069e6[_0xc7cb('0x3b')]:_0xd31f19[_0xc7cb('0x3c')];_0x2069e6[_0xc7cb('0x56')]=qs[_0xc7cb('0x42')](_0x1dff6d['query']['sort']);_0x2069e6[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_[_0xc7cb('0x57')](_0x1dff6d[_0xc7cb('0x37')],_0xd31f19['filters']));if(_0x1dff6d[_0xc7cb('0x37')][_0xc7cb('0x44')]){_0x2069e6[_0xc7cb('0x43')]=_['merge'](_0x2069e6['where'],{'$or':_[_0xc7cb('0x32')](_0x2069e6[_0xc7cb('0x3b')],function(_0x575c11){var _0x27bc46={};_0x27bc46[_0x575c11]={'$like':'%'+_0x1dff6d['query']['filter']+'%'};return _0x27bc46;})});}_0x2069e6=_['merge']({},_0x2069e6,_0x1dff6d[_0xc7cb('0x47')]);return _0x46c2b8['getDescriptions'](_0x2069e6);}})['then'](function(_0x5ec0a2){if(_0x5ec0a2){_0x135f62=_0x5ec0a2[_0xc7cb('0x3e')];if(!_0x1dff6d['query'][_0xc7cb('0x3f')](_0xc7cb('0x40'))){_0x2069e6[_0xc7cb('0x41')]=qs[_0xc7cb('0x41')](_0x1dff6d[_0xc7cb('0x37')][_0xc7cb('0x41')]);_0x2069e6['offset']=qs[_0xc7cb('0x2b')](_0x1dff6d['query']['offset']);}return _0x46c2b8[_0xc7cb('0x58')](_0x2069e6);}})[_0xc7cb('0x1a')](function(_0x1caf72){if(_0x1caf72){return _0x1caf72?{'count':_0x135f62,'rows':_0x1caf72}:null;}})['then'](respondWithResult(_0x4f8d24,null))['catch'](handleError(_0x4f8d24,null));}; \ No newline at end of file +var _0x57c1=['api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','create','update','body','getFields','findOne','hasOwnProperty','SugarcrmField','pick','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x57c1,0x165));var _0x157c=function(_0x5b94bd,_0x41daad){_0x5b94bd=_0x5b94bd-0x0;var _0x280f53=_0x57c1[_0x5b94bd];return _0x280f53;};'use strict';var pdf=require(_0x157c('0x0'));var emlformat=require(_0x157c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x157c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x157c('0x3'));var BPromise=require(_0x157c('0x4'));var Mustache=require(_0x157c('0x5'));var util=require('util');var path=require(_0x157c('0x6'));var sox=require('sox');var csv=require(_0x157c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x157c('0x8'));var squel=require('squel');var crypto=require(_0x157c('0x9'));var jsforce=require(_0x157c('0xa'));var deskjs=require(_0x157c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x157c('0xc'));var Papa=require(_0x157c('0xd'));var Redis=require(_0x157c('0xe'));var authService=require(_0x157c('0xf'));var qs=require(_0x157c('0x10'));var as=require(_0x157c('0x11'));var hardwareService=require(_0x157c('0x12'));var logger=require('../../config/logger')(_0x157c('0x13'));var utils=require('../../config/utils');var config=require(_0x157c('0x14'));var licenseUtil=require(_0x157c('0x15'));var db=require(_0x157c('0x16'))['db'];var jayson=require(_0x157c('0x17'));var client=jayson[_0x157c('0x18')][_0x157c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4814c7,_0x1f8a8b,_0x426fa3,_0x39c777){return new BPromise(function(_0x434fcd,_0x31bc36){var _0x10d139=_0x39c777||client;return _0x10d139['request'](_0x4814c7,_0x426fa3)[_0x157c('0x1a')](function(_0x28afbf){logger[_0x157c('0x1b')](_0x157c('0x1c'),_0x1f8a8b,_0x157c('0x1d'));logger[_0x157c('0x1e')](_0x157c('0x1f'),_0x1f8a8b,_0x157c('0x1d'),JSON[_0x157c('0x20')](_0x28afbf));if(_0x28afbf[_0x157c('0x21')]){if(_0x28afbf[_0x157c('0x21')][_0x157c('0x22')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1f8a8b,_0x28afbf[_0x157c('0x21')][_0x157c('0x23')]);return _0x31bc36(_0x28afbf['error'][_0x157c('0x23')]);}logger['error'](_0x157c('0x1c'),_0x1f8a8b,_0x28afbf[_0x157c('0x21')][_0x157c('0x23')]);return _0x434fcd(_0x28afbf[_0x157c('0x21')][_0x157c('0x23')]);}else{logger[_0x157c('0x1b')](_0x157c('0x1c'),_0x1f8a8b,'request\x20sent');_0x434fcd(_0x28afbf[_0x157c('0x24')][_0x157c('0x23')]);}})[_0x157c('0x25')](function(_0xbbb283){logger[_0x157c('0x21')](_0x157c('0x1c'),_0x1f8a8b,_0xbbb283);_0x31bc36(_0xbbb283);});});}function respondWithStatusCode(_0x593356,_0x44828c){_0x44828c=_0x44828c||0xcc;return function(_0x534283){if(_0x534283){return _0x593356['sendStatus'](_0x44828c);}return _0x593356['status'](_0x44828c)['end']();};}function respondWithResult(_0x224ab0,_0x42f86b){_0x42f86b=_0x42f86b||0xc8;return function(_0x334012){if(_0x334012){return _0x224ab0[_0x157c('0x26')](_0x42f86b)[_0x157c('0x27')](_0x334012);}};}function respondWithFilteredResult(_0x14cfd1,_0x81bd9a){return function(_0x582e2e){if(_0x582e2e){var _0x5d71f3=_0x582e2e[_0x157c('0x28')],_0x5b70be=_0x81bd9a[_0x157c('0x29')],_0x358d5b=_0x81bd9a[_0x157c('0x29')]+_0x81bd9a[_0x157c('0x2a')],_0x334332;if(_0x358d5b>=_0x5d71f3){_0x358d5b=_0x5d71f3;_0x334332=0xc8;}else{_0x334332=0xce;}_0x14cfd1[_0x157c('0x26')](_0x334332);return _0x14cfd1[_0x157c('0x2b')](_0x157c('0x2c'),_0x5b70be+'-'+_0x358d5b+'/'+_0x5d71f3)[_0x157c('0x27')](_0x582e2e);}return null;};}function patchUpdates(_0x339c64){return function(_0x3a9347){try{jsonpatch[_0x157c('0x2d')](_0x3a9347,_0x339c64,!![]);}catch(_0x3304fb){return BPromise[_0x157c('0x2e')](_0x3304fb);}return _0x3a9347[_0x157c('0x2f')]();};}function saveUpdates(_0x2a039c,_0x5125f6){return function(_0x2a6645){if(_0x2a6645){return _0x2a6645['update'](_0x2a039c)[_0x157c('0x1a')](function(_0x204097){return _0x204097;});}return null;};}function removeEntity(_0x205293,_0x213f59){return function(_0x5a5509){if(_0x5a5509){return _0x5a5509[_0x157c('0x30')]()[_0x157c('0x1a')](function(){_0x205293[_0x157c('0x26')](0xcc)[_0x157c('0x31')]();});}};}function handleEntityNotFound(_0x1571c0,_0x4ec2b1){return function(_0x13fbe9){if(!_0x13fbe9){_0x1571c0[_0x157c('0x32')](0x194);}return _0x13fbe9;};}function handleError(_0x4b5ef6,_0x5ff4da){_0x5ff4da=_0x5ff4da||0x1f4;return function(_0x29ea6e){logger[_0x157c('0x21')](_0x29ea6e[_0x157c('0x33')]);if(_0x29ea6e['name']){delete _0x29ea6e[_0x157c('0x34')];}_0x4b5ef6['status'](_0x5ff4da)[_0x157c('0x35')](_0x29ea6e);};}exports[_0x157c('0x36')]=function(_0x4763c7,_0x4bb70e){var _0xd2f7bf={},_0xe2ea51={},_0x76ee18={'count':0x0,'rows':[]};var _0x1540fc=_[_0x157c('0x37')](db[_0x157c('0x38')][_0x157c('0x39')],function(_0x2a5016){return{'name':_0x2a5016[_0x157c('0x3a')],'type':_0x2a5016['type'][_0x157c('0x3b')]};});_0xe2ea51[_0x157c('0x3c')]=_['map'](_0x1540fc,_0x157c('0x34'));_0xe2ea51[_0x157c('0x3d')]=_[_0x157c('0x3e')](_0x4763c7['query']);_0xe2ea51[_0x157c('0x3f')]=_[_0x157c('0x40')](_0xe2ea51[_0x157c('0x3c')],_0xe2ea51[_0x157c('0x3d')]);_0xd2f7bf['attributes']=_['intersection'](_0xe2ea51[_0x157c('0x3c')],qs[_0x157c('0x41')](_0x4763c7[_0x157c('0x3d')][_0x157c('0x41')]));_0xd2f7bf['attributes']=_0xd2f7bf[_0x157c('0x42')][_0x157c('0x43')]?_0xd2f7bf['attributes']:_0xe2ea51[_0x157c('0x3c')];if(!_0x4763c7[_0x157c('0x3d')]['hasOwnProperty'](_0x157c('0x44'))){_0xd2f7bf[_0x157c('0x2a')]=qs[_0x157c('0x2a')](_0x4763c7[_0x157c('0x3d')][_0x157c('0x2a')]);_0xd2f7bf[_0x157c('0x29')]=qs[_0x157c('0x29')](_0x4763c7['query'][_0x157c('0x29')]);}_0xd2f7bf[_0x157c('0x45')]=qs[_0x157c('0x46')](_0x4763c7[_0x157c('0x3d')][_0x157c('0x46')]);_0xd2f7bf[_0x157c('0x47')]=qs[_0x157c('0x3f')](_['pick'](_0x4763c7[_0x157c('0x3d')],_0xe2ea51['filters']),_0x1540fc);if(_0x4763c7['query']['filter']){_0xd2f7bf['where']=_[_0x157c('0x48')](_0xd2f7bf[_0x157c('0x47')],{'$or':_[_0x157c('0x37')](_0x1540fc,function(_0xb06643){if(_0xb06643[_0x157c('0x49')]!==_0x157c('0x4a')){var _0x355b6e={};_0x355b6e[_0xb06643[_0x157c('0x34')]]={'$like':'%'+_0x4763c7[_0x157c('0x3d')][_0x157c('0x4b')]+'%'};return _0x355b6e;}})});}_0xd2f7bf=_[_0x157c('0x48')]({},_0xd2f7bf,_0x4763c7['options']);var _0x1d5098={'where':_0xd2f7bf[_0x157c('0x47')]};return db[_0x157c('0x38')][_0x157c('0x28')](_0x1d5098)[_0x157c('0x1a')](function(_0x242a69){_0x76ee18[_0x157c('0x28')]=_0x242a69;if(_0x4763c7[_0x157c('0x3d')][_0x157c('0x4c')]){_0xd2f7bf[_0x157c('0x4d')]=[{'all':!![]}];}return db[_0x157c('0x38')][_0x157c('0x4e')](_0xd2f7bf);})[_0x157c('0x1a')](function(_0x26b54a){_0x76ee18[_0x157c('0x4f')]=_0x26b54a;return _0x76ee18;})[_0x157c('0x1a')](respondWithFilteredResult(_0x4bb70e,_0xd2f7bf))[_0x157c('0x25')](handleError(_0x4bb70e,null));};exports[_0x157c('0x50')]=function(_0x19f3c7,_0x51f685){var _0x20e3f8={'raw':![],'where':{'id':_0x19f3c7[_0x157c('0x51')]['id']}},_0x43f090={};_0x43f090[_0x157c('0x3c')]=_['keys'](db[_0x157c('0x38')][_0x157c('0x39')]);_0x43f090[_0x157c('0x3d')]=_[_0x157c('0x3e')](_0x19f3c7['query']);_0x43f090[_0x157c('0x3f')]=_[_0x157c('0x40')](_0x43f090['model'],_0x43f090[_0x157c('0x3d')]);_0x20e3f8[_0x157c('0x42')]=_[_0x157c('0x40')](_0x43f090[_0x157c('0x3c')],qs[_0x157c('0x41')](_0x19f3c7['query'][_0x157c('0x41')]));_0x20e3f8[_0x157c('0x42')]=_0x20e3f8[_0x157c('0x42')][_0x157c('0x43')]?_0x20e3f8[_0x157c('0x42')]:_0x43f090[_0x157c('0x3c')];if(_0x19f3c7[_0x157c('0x3d')]['includeAll']){_0x20e3f8[_0x157c('0x4d')]=[{'all':!![]}];}_0x20e3f8=_['merge']({},_0x20e3f8,_0x19f3c7[_0x157c('0x52')]);return db[_0x157c('0x38')][_0x157c('0x53')](_0x20e3f8)[_0x157c('0x1a')](handleEntityNotFound(_0x51f685,null))['then'](respondWithResult(_0x51f685,null))['catch'](handleError(_0x51f685,null));};exports[_0x157c('0x54')]=function(_0x5a99f7,_0x326b22){return db[_0x157c('0x38')][_0x157c('0x54')](_0x5a99f7['body'],{})['then'](respondWithResult(_0x326b22,0xc9))['catch'](handleError(_0x326b22,null));};exports[_0x157c('0x55')]=function(_0x3cd525,_0x197100){if(_0x3cd525['body']['id']){delete _0x3cd525[_0x157c('0x56')]['id'];}return db[_0x157c('0x38')]['find']({'where':{'id':_0x3cd525[_0x157c('0x51')]['id']}})['then'](handleEntityNotFound(_0x197100,null))[_0x157c('0x1a')](saveUpdates(_0x3cd525['body'],null))[_0x157c('0x1a')](respondWithResult(_0x197100,null))[_0x157c('0x25')](handleError(_0x197100,null));};exports['destroy']=function(_0x51bb47,_0x1bbad8){return db[_0x157c('0x38')][_0x157c('0x53')]({'where':{'id':_0x51bb47[_0x157c('0x51')]['id']}})[_0x157c('0x1a')](handleEntityNotFound(_0x1bbad8,null))[_0x157c('0x1a')](removeEntity(_0x1bbad8,null))[_0x157c('0x25')](handleError(_0x1bbad8,null));};exports[_0x157c('0x57')]=function(_0x2462d5,_0x3b6304,_0x137098){var _0x1a51cf={};var _0xfc6c1d={};var _0x197993;var _0x368143;return db[_0x157c('0x38')][_0x157c('0x58')]({'where':{'id':_0x2462d5[_0x157c('0x51')]['id']}})[_0x157c('0x1a')](handleEntityNotFound(_0x3b6304,null))[_0x157c('0x1a')](function(_0x4f2f42){if(_0x4f2f42){_0x197993=_0x4f2f42;_0xfc6c1d[_0x157c('0x3c')]=_['keys'](db['SugarcrmField'][_0x157c('0x39')]);_0xfc6c1d['query']=_[_0x157c('0x3e')](_0x2462d5[_0x157c('0x3d')]);_0xfc6c1d[_0x157c('0x3f')]=_[_0x157c('0x40')](_0xfc6c1d['model'],_0xfc6c1d['query']);_0x1a51cf[_0x157c('0x42')]=_[_0x157c('0x40')](_0xfc6c1d[_0x157c('0x3c')],qs['fields'](_0x2462d5['query'][_0x157c('0x41')]));_0x1a51cf['attributes']=_0x1a51cf[_0x157c('0x42')][_0x157c('0x43')]?_0x1a51cf[_0x157c('0x42')]:_0xfc6c1d[_0x157c('0x3c')];_0x1a51cf[_0x157c('0x45')]=qs[_0x157c('0x46')](_0x2462d5[_0x157c('0x3d')][_0x157c('0x46')]);_0x1a51cf['where']=qs['filters'](_['pick'](_0x2462d5['query'],_0xfc6c1d[_0x157c('0x3f')]));if(_0x2462d5[_0x157c('0x3d')][_0x157c('0x4b')]){_0x1a51cf['where']=_[_0x157c('0x48')](_0x1a51cf['where'],{'$or':_[_0x157c('0x37')](_0x1a51cf['attributes'],function(_0x510c43){var _0x15e197={};_0x15e197[_0x510c43]={'$like':'%'+_0x2462d5[_0x157c('0x3d')]['filter']+'%'};return _0x15e197;})});}_0x1a51cf=_['merge']({},_0x1a51cf,_0x2462d5[_0x157c('0x52')]);return _0x197993['getFields'](_0x1a51cf);}})[_0x157c('0x1a')](function(_0x1daf23){if(_0x1daf23){_0x368143=_0x1daf23[_0x157c('0x43')];if(!_0x2462d5[_0x157c('0x3d')][_0x157c('0x59')](_0x157c('0x44'))){_0x1a51cf['limit']=qs[_0x157c('0x2a')](_0x2462d5[_0x157c('0x3d')][_0x157c('0x2a')]);_0x1a51cf[_0x157c('0x29')]=qs['offset'](_0x2462d5['query'][_0x157c('0x29')]);}return _0x197993[_0x157c('0x57')](_0x1a51cf);}})[_0x157c('0x1a')](function(_0x38eac4){if(_0x38eac4){return _0x38eac4?{'count':_0x368143,'rows':_0x38eac4}:null;}})[_0x157c('0x1a')](respondWithResult(_0x3b6304,null))[_0x157c('0x25')](handleError(_0x3b6304,null));};exports['getSubjects']=function(_0x4a5064,_0x893fec,_0x2922fe){var _0x36d256={};var _0x201453={};var _0x2df345;var _0x31573b;return db[_0x157c('0x38')][_0x157c('0x58')]({'where':{'id':_0x4a5064['params']['id']}})[_0x157c('0x1a')](handleEntityNotFound(_0x893fec,null))[_0x157c('0x1a')](function(_0x20ab1f){if(_0x20ab1f){_0x2df345=_0x20ab1f;_0x201453[_0x157c('0x3c')]=_['keys'](db[_0x157c('0x5a')][_0x157c('0x39')]);_0x201453['query']=_[_0x157c('0x3e')](_0x4a5064['query']);_0x201453['filters']=_[_0x157c('0x40')](_0x201453[_0x157c('0x3c')],_0x201453[_0x157c('0x3d')]);_0x36d256['attributes']=_[_0x157c('0x40')](_0x201453[_0x157c('0x3c')],qs[_0x157c('0x41')](_0x4a5064[_0x157c('0x3d')][_0x157c('0x41')]));_0x36d256[_0x157c('0x42')]=_0x36d256['attributes'][_0x157c('0x43')]?_0x36d256['attributes']:_0x201453[_0x157c('0x3c')];_0x36d256[_0x157c('0x45')]=qs['sort'](_0x4a5064[_0x157c('0x3d')][_0x157c('0x46')]);_0x36d256[_0x157c('0x47')]=qs[_0x157c('0x3f')](_[_0x157c('0x5b')](_0x4a5064['query'],_0x201453['filters']));if(_0x4a5064[_0x157c('0x3d')][_0x157c('0x4b')]){_0x36d256[_0x157c('0x47')]=_['merge'](_0x36d256[_0x157c('0x47')],{'$or':_[_0x157c('0x37')](_0x36d256[_0x157c('0x42')],function(_0x3873e3){var _0x2a3272={};_0x2a3272[_0x3873e3]={'$like':'%'+_0x4a5064['query'][_0x157c('0x4b')]+'%'};return _0x2a3272;})});}_0x36d256=_[_0x157c('0x48')]({},_0x36d256,_0x4a5064[_0x157c('0x52')]);return _0x2df345['getSubjects'](_0x36d256);}})[_0x157c('0x1a')](function(_0x301188){if(_0x301188){_0x31573b=_0x301188[_0x157c('0x43')];if(!_0x4a5064[_0x157c('0x3d')][_0x157c('0x59')](_0x157c('0x44'))){_0x36d256[_0x157c('0x2a')]=qs[_0x157c('0x2a')](_0x4a5064['query']['limit']);_0x36d256[_0x157c('0x29')]=qs[_0x157c('0x29')](_0x4a5064['query'][_0x157c('0x29')]);}return _0x2df345[_0x157c('0x5c')](_0x36d256);}})[_0x157c('0x1a')](function(_0x2a398c){if(_0x2a398c){return _0x2a398c?{'count':_0x31573b,'rows':_0x2a398c}:null;}})[_0x157c('0x1a')](respondWithResult(_0x893fec,null))['catch'](handleError(_0x893fec,null));};exports['getDescriptions']=function(_0x51ecd7,_0x5a704d,_0x57910a){var _0x587615={};var _0x22d3dd={};var _0x5182d1;var _0x1bc909;return db[_0x157c('0x38')]['findOne']({'where':{'id':_0x51ecd7[_0x157c('0x51')]['id']}})[_0x157c('0x1a')](handleEntityNotFound(_0x5a704d,null))[_0x157c('0x1a')](function(_0x320edd){if(_0x320edd){_0x5182d1=_0x320edd;_0x22d3dd['model']=_['keys'](db[_0x157c('0x5a')][_0x157c('0x39')]);_0x22d3dd['query']=_[_0x157c('0x3e')](_0x51ecd7[_0x157c('0x3d')]);_0x22d3dd[_0x157c('0x3f')]=_[_0x157c('0x40')](_0x22d3dd[_0x157c('0x3c')],_0x22d3dd[_0x157c('0x3d')]);_0x587615[_0x157c('0x42')]=_[_0x157c('0x40')](_0x22d3dd[_0x157c('0x3c')],qs[_0x157c('0x41')](_0x51ecd7['query'][_0x157c('0x41')]));_0x587615[_0x157c('0x42')]=_0x587615[_0x157c('0x42')][_0x157c('0x43')]?_0x587615[_0x157c('0x42')]:_0x22d3dd[_0x157c('0x3c')];_0x587615[_0x157c('0x45')]=qs[_0x157c('0x46')](_0x51ecd7[_0x157c('0x3d')][_0x157c('0x46')]);_0x587615['where']=qs[_0x157c('0x3f')](_[_0x157c('0x5b')](_0x51ecd7[_0x157c('0x3d')],_0x22d3dd['filters']));if(_0x51ecd7[_0x157c('0x3d')]['filter']){_0x587615[_0x157c('0x47')]=_[_0x157c('0x48')](_0x587615['where'],{'$or':_[_0x157c('0x37')](_0x587615['attributes'],function(_0x3a9f6e){var _0x2a76c9={};_0x2a76c9[_0x3a9f6e]={'$like':'%'+_0x51ecd7[_0x157c('0x3d')][_0x157c('0x4b')]+'%'};return _0x2a76c9;})});}_0x587615=_[_0x157c('0x48')]({},_0x587615,_0x51ecd7[_0x157c('0x52')]);return _0x5182d1[_0x157c('0x5d')](_0x587615);}})[_0x157c('0x1a')](function(_0x3bf954){if(_0x3bf954){_0x1bc909=_0x3bf954[_0x157c('0x43')];if(!_0x51ecd7[_0x157c('0x3d')][_0x157c('0x59')]('nolimit')){_0x587615[_0x157c('0x2a')]=qs[_0x157c('0x2a')](_0x51ecd7['query']['limit']);_0x587615[_0x157c('0x29')]=qs[_0x157c('0x29')](_0x51ecd7['query']['offset']);}return _0x5182d1[_0x157c('0x5d')](_0x587615);}})[_0x157c('0x1a')](function(_0x1d278d){if(_0x1d278d){return _0x1d278d?{'count':_0x1bc909,'rows':_0x1d278d}:null;}})[_0x157c('0x1a')](respondWithResult(_0x5a704d,null))[_0x157c('0x25')](handleError(_0x5a704d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2b46dd6..169339b 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 _0x52d1=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','api','moment'];(function(_0x337651,_0x2af690){var _0x20893c=function(_0x545dcd){while(--_0x545dcd){_0x337651['push'](_0x337651['shift']());}};_0x20893c(++_0x2af690);}(_0x52d1,0x17f));var _0x152d=function(_0x385a9e,_0x4069be){_0x385a9e=_0x385a9e-0x0;var _0x2b1168=_0x52d1[_0x385a9e];return _0x2b1168;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x152d('0x0'));var moment=require(_0x152d('0x1'));var BPromise=require(_0x152d('0x2'));var rp=require(_0x152d('0x3'));var fs=require('fs');var path=require(_0x152d('0x4'));var rimraf=require(_0x152d('0x5'));var config=require(_0x152d('0x6'));var attributes=require(_0x152d('0x7'));module[_0x152d('0x8')]=function(_0x3e2d35,_0xda68c2){return _0x3e2d35[_0x152d('0x9')](_0x152d('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x359d=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration'];(function(_0x4285d8,_0x9ffc7a){var _0x2555f2=function(_0x48d769){while(--_0x48d769){_0x4285d8['push'](_0x4285d8['shift']());}};_0x2555f2(++_0x9ffc7a);}(_0x359d,0x129));var _0xd359=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x359d[_0x120376];return _0x28c529;};'use strict';var _=require(_0xd359('0x0'));var util=require(_0xd359('0x1'));var logger=require('../../config/logger')(_0xd359('0x2'));var moment=require('moment');var BPromise=require(_0xd359('0x3'));var rp=require(_0xd359('0x4'));var fs=require('fs');var path=require(_0xd359('0x5'));var rimraf=require(_0xd359('0x6'));var config=require(_0xd359('0x7'));var attributes=require(_0xd359('0x8'));module['exports']=function(_0xd02473,_0x4636c5){return _0xd02473[_0xd359('0x9')](_0xd359('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index e0c6fa2..c6fdf0d 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 _0xd4b0=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a9029,_0x35f9d8){var _0x5742fc=function(_0x3519e8){while(--_0x3519e8){_0x2a9029['push'](_0x2a9029['shift']());}};_0x5742fc(++_0x35f9d8);}(_0xd4b0,0x1d0));var _0x0d4b=function(_0x6ff837,_0x49d852){_0x6ff837=_0x6ff837-0x0;var _0x20e8ec=_0xd4b0[_0x6ff837];return _0x20e8ec;};'use strict';var _=require(_0x0d4b('0x0'));var util=require(_0x0d4b('0x1'));var moment=require(_0x0d4b('0x2'));var BPromise=require(_0x0d4b('0x3'));var rs=require(_0x0d4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d4b('0x5'))['db'];var utils=require(_0x0d4b('0x6'));var logger=require(_0x0d4b('0x7'))(_0x0d4b('0x8'));var config=require(_0x0d4b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0d4b('0xa')][_0x0d4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf788ed,_0x328b7c,_0x37c2a6){return new BPromise(function(_0x381373,_0x1a3de2){return client[_0x0d4b('0xc')](_0xf788ed,_0x37c2a6)['then'](function(_0x13e759){logger['info'](_0x0d4b('0xd'),_0x328b7c,_0x0d4b('0xe'));logger['debug'](_0x0d4b('0xf'),_0x328b7c,_0x0d4b('0xe'),JSON[_0x0d4b('0x10')](_0x13e759));if(_0x13e759[_0x0d4b('0x11')]){if(_0x13e759[_0x0d4b('0x11')][_0x0d4b('0x12')]===0x1f4){logger[_0x0d4b('0x11')](_0x0d4b('0xd'),_0x328b7c,_0x13e759[_0x0d4b('0x11')][_0x0d4b('0x13')]);return _0x1a3de2(_0x13e759['error'][_0x0d4b('0x13')]);}logger[_0x0d4b('0x11')](_0x0d4b('0xd'),_0x328b7c,_0x13e759[_0x0d4b('0x11')][_0x0d4b('0x13')]);return _0x381373(_0x13e759['error'][_0x0d4b('0x13')]);}else{logger[_0x0d4b('0x14')](_0x0d4b('0xd'),_0x328b7c,_0x0d4b('0xe'));_0x381373(_0x13e759[_0x0d4b('0x15')]['message']);}})[_0x0d4b('0x16')](function(_0x5abf93){logger[_0x0d4b('0x11')](_0x0d4b('0xd'),_0x328b7c,_0x5abf93);_0x1a3de2(_0x5abf93);});});} \ No newline at end of file +var _0x3b47=['SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','request','then'];(function(_0x4a5c75,_0x4aabda){var _0x34a06d=function(_0x29e022){while(--_0x29e022){_0x4a5c75['push'](_0x4a5c75['shift']());}};_0x34a06d(++_0x4aabda);}(_0x3b47,0x199));var _0x73b4=function(_0x4dbd3f,_0x30025f){_0x4dbd3f=_0x4dbd3f-0x0;var _0x107823=_0x3b47[_0x4dbd3f];return _0x107823;};'use strict';var _=require(_0x73b4('0x0'));var util=require(_0x73b4('0x1'));var moment=require('moment');var BPromise=require(_0x73b4('0x2'));var rs=require(_0x73b4('0x3'));var fs=require('fs');var Redis=require(_0x73b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x73b4('0x5'));var jayson=require(_0x73b4('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45932f,_0x21f8b3,_0x57f966){return new BPromise(function(_0x428861,_0x4d37a5){return client[_0x73b4('0x7')](_0x45932f,_0x57f966)[_0x73b4('0x8')](function(_0x195a17){logger['info'](_0x73b4('0x9'),_0x21f8b3,'request\x20sent');logger[_0x73b4('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x21f8b3,_0x73b4('0xb'),JSON[_0x73b4('0xc')](_0x195a17));if(_0x195a17[_0x73b4('0xd')]){if(_0x195a17[_0x73b4('0xd')][_0x73b4('0xe')]===0x1f4){logger['error'](_0x73b4('0x9'),_0x21f8b3,_0x195a17[_0x73b4('0xd')][_0x73b4('0xf')]);return _0x4d37a5(_0x195a17[_0x73b4('0xd')][_0x73b4('0xf')]);}logger[_0x73b4('0xd')](_0x73b4('0x9'),_0x21f8b3,_0x195a17['error']['message']);return _0x428861(_0x195a17[_0x73b4('0xd')]['message']);}else{logger[_0x73b4('0x10')](_0x73b4('0x9'),_0x21f8b3,_0x73b4('0xb'));_0x428861(_0x195a17[_0x73b4('0x11')][_0x73b4('0xf')]);}})[_0x73b4('0x12')](function(_0x109810){logger[_0x73b4('0xd')](_0x73b4('0x9'),_0x21f8b3,_0x109810);_0x4d37a5(_0x109810);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 33a8bd2..fa31aea 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 _0xece2=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0xece2,0x13e));var _0x2ece=function(_0x3d8e8d,_0x329780){_0x3d8e8d=_0x3d8e8d-0x0;var _0x4eca1=_0xece2[_0x3d8e8d];return _0x4eca1;};'use strict';var multer=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var path=require(_0x2ece('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2ece('0x3'));var interaction=require(_0x2ece('0x4'));var config=require('../../config/environment');var controller=require(_0x2ece('0x5'));router[_0x2ece('0x6')]('/',auth[_0x2ece('0x7')](),controller[_0x2ece('0x8')]);router[_0x2ece('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2ece('0x9')]);router[_0x2ece('0xa')]('/',auth[_0x2ece('0x7')](),controller[_0x2ece('0xb')]);router[_0x2ece('0xc')](_0x2ece('0xd'),auth[_0x2ece('0x7')](),controller[_0x2ece('0xe')]);router[_0x2ece('0xf')]('/:id',auth[_0x2ece('0x7')](),controller[_0x2ece('0x10')]);module[_0x2ece('0x11')]=router; \ No newline at end of file +var _0x9889=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x25902f,_0x4e80ba){var _0x2926f8=function(_0x368fd8){while(--_0x368fd8){_0x25902f['push'](_0x25902f['shift']());}};_0x2926f8(++_0x4e80ba);}(_0x9889,0x154));var _0x9988=function(_0x25f776,_0x5ac48f){_0x25f776=_0x25f776-0x0;var _0x52f6a7=_0x9889[_0x25f776];return _0x52f6a7;};'use strict';var multer=require(_0x9988('0x0'));var util=require(_0x9988('0x1'));var path=require(_0x9988('0x2'));var timeout=require(_0x9988('0x3'));var express=require(_0x9988('0x4'));var router=express[_0x9988('0x5')]();var auth=require(_0x9988('0x6'));var interaction=require(_0x9988('0x7'));var config=require(_0x9988('0x8'));var controller=require(_0x9988('0x9'));router['get']('/',auth[_0x9988('0xa')](),controller[_0x9988('0xb')]);router[_0x9988('0xc')](_0x9988('0xd'),auth[_0x9988('0xa')](),controller[_0x9988('0xe')]);router[_0x9988('0xf')]('/',auth[_0x9988('0xa')](),controller[_0x9988('0x10')]);router[_0x9988('0x11')]('/:id',auth[_0x9988('0xa')](),controller[_0x9988('0x12')]);router[_0x9988('0x13')]('/:id',auth[_0x9988('0xa')](),controller['destroy']);module[_0x9988('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 835c1bf..61a45fd 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 _0xcf95=['BOOLEAN','sequelize','exports','customVariable','keyValue','string','STRING','ENUM'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5cf9('0x0'));module[_0x5cf9('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x5cf9('0x2'),_0x5cf9('0x3')),'defaultValue':_0x5cf9('0x4')},'content':{'type':Sequelize[_0x5cf9('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5cf9('0x6')](_0x5cf9('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x5cf9('0x5')]},'idField':{'type':Sequelize[_0x5cf9('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5cf9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cf9('0x5')]}}; \ No newline at end of file +var _0xf350=['STRING','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x6f3ad7,_0x36ce68){var _0x5227eb=function(_0x25c170){while(--_0x25c170){_0x6f3ad7['push'](_0x6f3ad7['shift']());}};_0x5227eb(++_0x36ce68);}(_0xf350,0x105));var _0x0f35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf350[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0f35('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x0f35('0x1'),_0x0f35('0x2'),_0x0f35('0x3'),_0x0f35('0x4')),'defaultValue':_0x0f35('0x1')},'content':{'type':Sequelize[_0x0f35('0x5')]},'key':{'type':Sequelize[_0x0f35('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x0f35('0x3'))},'keyContent':{'type':Sequelize[_0x0f35('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0f35('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 966c0b0..106a0da 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 _0x2d17=['destroy','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x2d17,0x17e));var _0x72d1=function(_0x2a7bd1,_0x364224){_0x2a7bd1=_0x2a7bd1-0x0;var _0x2a2fb8=_0x2d17[_0x2a7bd1];return _0x2a2fb8;};'use strict';var pdf=require(_0x72d1('0x0'));var emlformat=require(_0x72d1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x72d1('0x2'));var jsonpatch=require(_0x72d1('0x3'));var rp=require('request-promise');var moment=require(_0x72d1('0x4'));var BPromise=require(_0x72d1('0x5'));var Mustache=require('mustache');var util=require(_0x72d1('0x6'));var path=require('path');var sox=require(_0x72d1('0x7'));var csv=require('to-csv');var ejs=require(_0x72d1('0x8'));var fs=require('fs');var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var licenseUtil=require(_0x72d1('0x17'));var db=require(_0x72d1('0x18'))['db'];function respondWithStatusCode(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xcc;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0x19')](_0x5ad4df);}return _0x2f5a78[_0x72d1('0x1a')](_0x5ad4df)[_0x72d1('0x1b')]();};}function respondWithResult(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0xc8;return function(_0x143718){if(_0x143718){return _0x22ac6f[_0x72d1('0x1a')](_0x685a27)[_0x72d1('0x1c')](_0x143718);}};}function respondWithFilteredResult(_0x3f190f,_0x21c85e){return function(_0x23a238){if(_0x23a238){var _0x8d458=_0x23a238[_0x72d1('0x1d')],_0x491af4=_0x21c85e[_0x72d1('0x1e')],_0x46fa3d=_0x21c85e['offset']+_0x21c85e[_0x72d1('0x1f')],_0x5262b0;if(_0x46fa3d>=_0x8d458){_0x46fa3d=_0x8d458;_0x5262b0=0xc8;}else{_0x5262b0=0xce;}_0x3f190f[_0x72d1('0x1a')](_0x5262b0);return _0x3f190f[_0x72d1('0x20')]('Content-Range',_0x491af4+'-'+_0x46fa3d+'/'+_0x8d458)['json'](_0x23a238);}return null;};}function patchUpdates(_0x313d7b){return function(_0x10d464){try{jsonpatch[_0x72d1('0x21')](_0x10d464,_0x313d7b,!![]);}catch(_0x1865c1){return BPromise[_0x72d1('0x22')](_0x1865c1);}return _0x10d464[_0x72d1('0x23')]();};}function saveUpdates(_0x1e2411,_0x5c7982){return function(_0x1c695c){if(_0x1c695c){return _0x1c695c['update'](_0x1e2411)['then'](function(_0x5b85cc){return _0x5b85cc;});}return null;};}function removeEntity(_0x585243,_0x445985){return function(_0x374602){if(_0x374602){return _0x374602['destroy']()[_0x72d1('0x24')](function(){_0x585243[_0x72d1('0x1a')](0xcc)[_0x72d1('0x1b')]();});}};}function handleEntityNotFound(_0x1431ee,_0x26fa35){return function(_0x4e6acd){if(!_0x4e6acd){_0x1431ee['sendStatus'](0x194);}return _0x4e6acd;};}function handleError(_0x188eca,_0x36bc65){_0x36bc65=_0x36bc65||0x1f4;return function(_0x2f661){logger[_0x72d1('0x25')](_0x2f661[_0x72d1('0x26')]);if(_0x2f661[_0x72d1('0x27')]){delete _0x2f661[_0x72d1('0x27')];}_0x188eca['status'](_0x36bc65)['send'](_0x2f661);};}exports[_0x72d1('0x28')]=function(_0x482cb8,_0x18ca85){var _0x3454fc={},_0x2c113d={},_0x4da489={'count':0x0,'rows':[]};var _0x1c4b21=_['map'](db[_0x72d1('0x29')][_0x72d1('0x2a')],function(_0x32588f){return{'name':_0x32588f[_0x72d1('0x2b')],'type':_0x32588f['type'][_0x72d1('0x2c')]};});_0x2c113d['model']=_[_0x72d1('0x2d')](_0x1c4b21,_0x72d1('0x27'));_0x2c113d['query']=_[_0x72d1('0x2e')](_0x482cb8[_0x72d1('0x2f')]);_0x2c113d[_0x72d1('0x30')]=_[_0x72d1('0x31')](_0x2c113d[_0x72d1('0x32')],_0x2c113d['query']);_0x3454fc[_0x72d1('0x33')]=_[_0x72d1('0x31')](_0x2c113d[_0x72d1('0x32')],qs['fields'](_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x34')]));_0x3454fc['attributes']=_0x3454fc[_0x72d1('0x33')][_0x72d1('0x35')]?_0x3454fc[_0x72d1('0x33')]:_0x2c113d['model'];if(!_0x482cb8[_0x72d1('0x2f')]['hasOwnProperty'](_0x72d1('0x36'))){_0x3454fc[_0x72d1('0x1f')]=qs[_0x72d1('0x1f')](_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x1f')]);_0x3454fc[_0x72d1('0x1e')]=qs[_0x72d1('0x1e')](_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x1e')]);}_0x3454fc[_0x72d1('0x37')]=qs[_0x72d1('0x38')](_0x482cb8['query'][_0x72d1('0x38')]);_0x3454fc[_0x72d1('0x39')]=qs[_0x72d1('0x30')](_[_0x72d1('0x3a')](_0x482cb8['query'],_0x2c113d[_0x72d1('0x30')]),_0x1c4b21);if(_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x3b')]){_0x3454fc['where']=_[_0x72d1('0x3c')](_0x3454fc[_0x72d1('0x39')],{'$or':_[_0x72d1('0x2d')](_0x1c4b21,function(_0x5b897f){if(_0x5b897f[_0x72d1('0x3d')]!==_0x72d1('0x3e')){var _0x34f159={};_0x34f159[_0x5b897f['name']]={'$like':'%'+_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x3b')]+'%'};return _0x34f159;}})});}_0x3454fc=_[_0x72d1('0x3c')]({},_0x3454fc,_0x482cb8[_0x72d1('0x3f')]);var _0x44c4f5={'where':_0x3454fc[_0x72d1('0x39')]};return db[_0x72d1('0x29')]['count'](_0x44c4f5)[_0x72d1('0x24')](function(_0x3ae4b5){_0x4da489[_0x72d1('0x1d')]=_0x3ae4b5;if(_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x40')]){_0x3454fc[_0x72d1('0x41')]=[{'all':!![]}];}return db[_0x72d1('0x29')][_0x72d1('0x42')](_0x3454fc);})['then'](function(_0x44d5b2){_0x4da489[_0x72d1('0x43')]=_0x44d5b2;return _0x4da489;})[_0x72d1('0x24')](respondWithFilteredResult(_0x18ca85,_0x3454fc))[_0x72d1('0x44')](handleError(_0x18ca85,null));};exports[_0x72d1('0x45')]=function(_0x88b9b9,_0xb911fa){var _0x3620df={'raw':!![],'where':{'id':_0x88b9b9['params']['id']}},_0x5620f0={};_0x5620f0[_0x72d1('0x32')]=_[_0x72d1('0x2e')](db[_0x72d1('0x29')][_0x72d1('0x2a')]);_0x5620f0['query']=_[_0x72d1('0x2e')](_0x88b9b9[_0x72d1('0x2f')]);_0x5620f0['filters']=_[_0x72d1('0x31')](_0x5620f0['model'],_0x5620f0[_0x72d1('0x2f')]);_0x3620df[_0x72d1('0x33')]=_['intersection'](_0x5620f0[_0x72d1('0x32')],qs['fields'](_0x88b9b9['query']['fields']));_0x3620df[_0x72d1('0x33')]=_0x3620df['attributes'][_0x72d1('0x35')]?_0x3620df[_0x72d1('0x33')]:_0x5620f0[_0x72d1('0x32')];if(_0x88b9b9['query']['includeAll']){_0x3620df[_0x72d1('0x41')]=[{'all':!![]}];}_0x3620df=_['merge']({},_0x3620df,_0x88b9b9['options']);return db[_0x72d1('0x29')][_0x72d1('0x46')](_0x3620df)[_0x72d1('0x24')](handleEntityNotFound(_0xb911fa,null))['then'](respondWithResult(_0xb911fa,null))['catch'](handleError(_0xb911fa,null));};exports['create']=function(_0x5f39f1,_0x9b7951){return db[_0x72d1('0x29')][_0x72d1('0x47')](_0x5f39f1[_0x72d1('0x48')],{})[_0x72d1('0x24')](respondWithResult(_0x9b7951,0xc9))[_0x72d1('0x44')](handleError(_0x9b7951,null));};exports[_0x72d1('0x49')]=function(_0x5924c,_0x1e2c11){if(_0x5924c['body']['id']){delete _0x5924c[_0x72d1('0x48')]['id'];}return db[_0x72d1('0x29')][_0x72d1('0x46')]({'where':{'id':_0x5924c['params']['id']}})[_0x72d1('0x24')](handleEntityNotFound(_0x1e2c11,null))[_0x72d1('0x24')](saveUpdates(_0x5924c[_0x72d1('0x48')],null))['then'](respondWithResult(_0x1e2c11,null))[_0x72d1('0x44')](handleError(_0x1e2c11,null));};exports[_0x72d1('0x4a')]=function(_0x343da3,_0x1bf626){return db['SugarcrmField']['find']({'where':{'id':_0x343da3[_0x72d1('0x4b')]['id']}})[_0x72d1('0x24')](handleEntityNotFound(_0x1bf626,null))[_0x72d1('0x24')](removeEntity(_0x1bf626,null))['catch'](handleError(_0x1bf626,null));}; \ No newline at end of file +var _0x0a6b=['json','apply','reject','update','then','destroy','error','stack','send','index','map','SugarcrmField','rawAttributes','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','html-pdf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set'];(function(_0x2e4635,_0x544e4a){var _0x22b316=function(_0x2757c7){while(--_0x2757c7){_0x2e4635['push'](_0x2e4635['shift']());}};_0x22b316(++_0x544e4a);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x7fa0ac,_0x597774){_0x7fa0ac=_0x7fa0ac-0x0;var _0x36fac8=_0x0a6b[_0x7fa0ac];return _0x36fac8;};'use strict';var pdf=require(_0xb0a6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0a6('0x1'));var rp=require('request-promise');var moment=require(_0xb0a6('0x2'));var BPromise=require(_0xb0a6('0x3'));var Mustache=require(_0xb0a6('0x4'));var util=require('util');var path=require(_0xb0a6('0x5'));var sox=require('sox');var csv=require(_0xb0a6('0x6'));var ejs=require(_0xb0a6('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb0a6('0x8'));var crypto=require(_0xb0a6('0x9'));var jsforce=require(_0xb0a6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0a6('0xb'));var Redis=require(_0xb0a6('0xc'));var authService=require(_0xb0a6('0xd'));var qs=require(_0xb0a6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0a6('0xf'));var logger=require(_0xb0a6('0x10'))('api');var utils=require(_0xb0a6('0x11'));var config=require(_0xb0a6('0x12'));var licenseUtil=require(_0xb0a6('0x13'));var db=require(_0xb0a6('0x14'))['db'];function respondWithStatusCode(_0x471d0f,_0x3e06df){_0x3e06df=_0x3e06df||0xcc;return function(_0x3d607f){if(_0x3d607f){return _0x471d0f[_0xb0a6('0x15')](_0x3e06df);}return _0x471d0f[_0xb0a6('0x16')](_0x3e06df)[_0xb0a6('0x17')]();};}function respondWithResult(_0x513853,_0x2b801a){_0x2b801a=_0x2b801a||0xc8;return function(_0x54016c){if(_0x54016c){return _0x513853[_0xb0a6('0x16')](_0x2b801a)['json'](_0x54016c);}};}function respondWithFilteredResult(_0x25582f,_0x59730e){return function(_0x1d837f){if(_0x1d837f){var _0x382c2f=_0x1d837f[_0xb0a6('0x18')],_0x93243e=_0x59730e[_0xb0a6('0x19')],_0x5673ad=_0x59730e[_0xb0a6('0x19')]+_0x59730e[_0xb0a6('0x1a')],_0x56b594;if(_0x5673ad>=_0x382c2f){_0x5673ad=_0x382c2f;_0x56b594=0xc8;}else{_0x56b594=0xce;}_0x25582f[_0xb0a6('0x16')](_0x56b594);return _0x25582f[_0xb0a6('0x1b')]('Content-Range',_0x93243e+'-'+_0x5673ad+'/'+_0x382c2f)[_0xb0a6('0x1c')](_0x1d837f);}return null;};}function patchUpdates(_0x883503){return function(_0x372457){try{jsonpatch[_0xb0a6('0x1d')](_0x372457,_0x883503,!![]);}catch(_0x4406d0){return BPromise[_0xb0a6('0x1e')](_0x4406d0);}return _0x372457['save']();};}function saveUpdates(_0x2fb60a,_0x6d2003){return function(_0x2d0fca){if(_0x2d0fca){return _0x2d0fca[_0xb0a6('0x1f')](_0x2fb60a)[_0xb0a6('0x20')](function(_0x10e56b){return _0x10e56b;});}return null;};}function removeEntity(_0x27db00,_0x16e053){return function(_0x4b9a6c){if(_0x4b9a6c){return _0x4b9a6c[_0xb0a6('0x21')]()['then'](function(){_0x27db00[_0xb0a6('0x16')](0xcc)[_0xb0a6('0x17')]();});}};}function handleEntityNotFound(_0x4997df,_0x4aa68d){return function(_0x10d753){if(!_0x10d753){_0x4997df[_0xb0a6('0x15')](0x194);}return _0x10d753;};}function handleError(_0x5eb0ed,_0x3ea787){_0x3ea787=_0x3ea787||0x1f4;return function(_0x24574a){logger[_0xb0a6('0x22')](_0x24574a[_0xb0a6('0x23')]);if(_0x24574a['name']){delete _0x24574a['name'];}_0x5eb0ed[_0xb0a6('0x16')](_0x3ea787)[_0xb0a6('0x24')](_0x24574a);};}exports[_0xb0a6('0x25')]=function(_0x58d923,_0x23bec3){var _0x3347ac={},_0x3edd9a={},_0xc1c647={'count':0x0,'rows':[]};var _0x10cf86=_[_0xb0a6('0x26')](db[_0xb0a6('0x27')][_0xb0a6('0x28')],function(_0x4255b9){return{'name':_0x4255b9['fieldName'],'type':_0x4255b9[_0xb0a6('0x29')][_0xb0a6('0x2a')]};});_0x3edd9a[_0xb0a6('0x2b')]=_['map'](_0x10cf86,_0xb0a6('0x2c'));_0x3edd9a['query']=_[_0xb0a6('0x2d')](_0x58d923[_0xb0a6('0x2e')]);_0x3edd9a[_0xb0a6('0x2f')]=_[_0xb0a6('0x30')](_0x3edd9a[_0xb0a6('0x2b')],_0x3edd9a[_0xb0a6('0x2e')]);_0x3347ac[_0xb0a6('0x31')]=_[_0xb0a6('0x30')](_0x3edd9a[_0xb0a6('0x2b')],qs[_0xb0a6('0x32')](_0x58d923['query']['fields']));_0x3347ac[_0xb0a6('0x31')]=_0x3347ac[_0xb0a6('0x31')][_0xb0a6('0x33')]?_0x3347ac[_0xb0a6('0x31')]:_0x3edd9a[_0xb0a6('0x2b')];if(!_0x58d923[_0xb0a6('0x2e')][_0xb0a6('0x34')](_0xb0a6('0x35'))){_0x3347ac['limit']=qs[_0xb0a6('0x1a')](_0x58d923[_0xb0a6('0x2e')]['limit']);_0x3347ac[_0xb0a6('0x19')]=qs[_0xb0a6('0x19')](_0x58d923['query']['offset']);}_0x3347ac[_0xb0a6('0x36')]=qs[_0xb0a6('0x37')](_0x58d923[_0xb0a6('0x2e')][_0xb0a6('0x37')]);_0x3347ac[_0xb0a6('0x38')]=qs[_0xb0a6('0x2f')](_['pick'](_0x58d923[_0xb0a6('0x2e')],_0x3edd9a['filters']),_0x10cf86);if(_0x58d923[_0xb0a6('0x2e')][_0xb0a6('0x39')]){_0x3347ac['where']=_['merge'](_0x3347ac['where'],{'$or':_[_0xb0a6('0x26')](_0x10cf86,function(_0xd484f){if(_0xd484f[_0xb0a6('0x29')]!==_0xb0a6('0x3a')){var _0x1d09f7={};_0x1d09f7[_0xd484f['name']]={'$like':'%'+_0x58d923[_0xb0a6('0x2e')][_0xb0a6('0x39')]+'%'};return _0x1d09f7;}})});}_0x3347ac=_[_0xb0a6('0x3b')]({},_0x3347ac,_0x58d923[_0xb0a6('0x3c')]);var _0x4ab405={'where':_0x3347ac[_0xb0a6('0x38')]};return db[_0xb0a6('0x27')][_0xb0a6('0x18')](_0x4ab405)[_0xb0a6('0x20')](function(_0x1366fd){_0xc1c647['count']=_0x1366fd;if(_0x58d923['query'][_0xb0a6('0x3d')]){_0x3347ac[_0xb0a6('0x3e')]=[{'all':!![]}];}return db[_0xb0a6('0x27')][_0xb0a6('0x3f')](_0x3347ac);})[_0xb0a6('0x20')](function(_0x5f4cef){_0xc1c647[_0xb0a6('0x40')]=_0x5f4cef;return _0xc1c647;})[_0xb0a6('0x20')](respondWithFilteredResult(_0x23bec3,_0x3347ac))['catch'](handleError(_0x23bec3,null));};exports[_0xb0a6('0x41')]=function(_0x2c3785,_0x381067){var _0x3014df={'raw':!![],'where':{'id':_0x2c3785['params']['id']}},_0x27f208={};_0x27f208[_0xb0a6('0x2b')]=_['keys'](db[_0xb0a6('0x27')]['rawAttributes']);_0x27f208[_0xb0a6('0x2e')]=_['keys'](_0x2c3785[_0xb0a6('0x2e')]);_0x27f208[_0xb0a6('0x2f')]=_[_0xb0a6('0x30')](_0x27f208[_0xb0a6('0x2b')],_0x27f208[_0xb0a6('0x2e')]);_0x3014df[_0xb0a6('0x31')]=_[_0xb0a6('0x30')](_0x27f208[_0xb0a6('0x2b')],qs[_0xb0a6('0x32')](_0x2c3785[_0xb0a6('0x2e')][_0xb0a6('0x32')]));_0x3014df[_0xb0a6('0x31')]=_0x3014df['attributes'][_0xb0a6('0x33')]?_0x3014df[_0xb0a6('0x31')]:_0x27f208['model'];if(_0x2c3785[_0xb0a6('0x2e')]['includeAll']){_0x3014df[_0xb0a6('0x3e')]=[{'all':!![]}];}_0x3014df=_[_0xb0a6('0x3b')]({},_0x3014df,_0x2c3785[_0xb0a6('0x3c')]);return db['SugarcrmField'][_0xb0a6('0x42')](_0x3014df)[_0xb0a6('0x20')](handleEntityNotFound(_0x381067,null))[_0xb0a6('0x20')](respondWithResult(_0x381067,null))[_0xb0a6('0x43')](handleError(_0x381067,null));};exports[_0xb0a6('0x44')]=function(_0x2cb5f6,_0x86881){return db[_0xb0a6('0x27')]['create'](_0x2cb5f6[_0xb0a6('0x45')],{})[_0xb0a6('0x20')](respondWithResult(_0x86881,0xc9))[_0xb0a6('0x43')](handleError(_0x86881,null));};exports[_0xb0a6('0x1f')]=function(_0x504f0f,_0x5b162d){if(_0x504f0f['body']['id']){delete _0x504f0f['body']['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x504f0f['params']['id']}})[_0xb0a6('0x20')](handleEntityNotFound(_0x5b162d,null))[_0xb0a6('0x20')](saveUpdates(_0x504f0f[_0xb0a6('0x45')],null))[_0xb0a6('0x20')](respondWithResult(_0x5b162d,null))[_0xb0a6('0x43')](handleError(_0x5b162d,null));};exports[_0xb0a6('0x21')]=function(_0x13e34c,_0x31d98a){return db[_0xb0a6('0x27')][_0xb0a6('0x42')]({'where':{'id':_0x13e34c[_0xb0a6('0x46')]['id']}})[_0xb0a6('0x20')](handleEntityNotFound(_0x31d98a,null))[_0xb0a6('0x20')](removeEntity(_0x31d98a,null))[_0xb0a6('0x43')](handleError(_0x31d98a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c6792af..15b541e 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 _0x1450=['path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise'];(function(_0x2808d0,_0x221a9f){var _0x3aef7c=function(_0x331dc1){while(--_0x331dc1){_0x2808d0['push'](_0x2808d0['shift']());}};_0x3aef7c(++_0x221a9f);}(_0x1450,0x1ea));var _0x0145=function(_0x3985b8,_0x26271c){_0x3985b8=_0x3985b8-0x0;var _0x42f0ff=_0x1450[_0x3985b8];return _0x42f0ff;};'use strict';var _=require(_0x0145('0x0'));var util=require(_0x0145('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0145('0x2'));var BPromise=require(_0x0145('0x3'));var rp=require(_0x0145('0x4'));var fs=require('fs');var path=require(_0x0145('0x5'));var rimraf=require(_0x0145('0x6'));var config=require(_0x0145('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x0145('0x8')]=function(_0x2b1056,_0x3c23b9){return _0x2b1056[_0x0145('0x9')](_0x0145('0xa'),attributes,{'tableName':_0x0145('0xb'),'paranoid':![],'indexes':[{'name':_0x0145('0xc'),'fields':[_0x0145('0xd'),_0x0145('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a01=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x2689c4,_0x4dc61f){var _0x42ba95=function(_0x2fb456){while(--_0x2fb456){_0x2689c4['push'](_0x2689c4['shift']());}};_0x42ba95(++_0x4dc61f);}(_0x5a01,0x194));var _0x15a0=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x5a01[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x15a0('0x0'));var util=require('util');var logger=require(_0x15a0('0x1'))('api');var moment=require(_0x15a0('0x2'));var BPromise=require(_0x15a0('0x3'));var rp=require(_0x15a0('0x4'));var fs=require('fs');var path=require(_0x15a0('0x5'));var rimraf=require(_0x15a0('0x6'));var config=require(_0x15a0('0x7'));var attributes=require(_0x15a0('0x8'));module[_0x15a0('0x9')]=function(_0x548357,_0x2b748f){return _0x548357[_0x15a0('0xa')](_0x15a0('0xb'),attributes,{'tableName':_0x15a0('0xc'),'paranoid':![],'indexes':[{'name':_0x15a0('0xd'),'fields':[_0x15a0('0xe'),_0x15a0('0xf')],'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 59edc98..58abe04 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5b85ee,_0x131418){var _0x4cd016=function(_0x4de21c){while(--_0x4de21c){_0x5b85ee['push'](_0x5b85ee['shift']());}};_0x4cd016(++_0x131418);}(_0x5eb8,0xb0));var _0x85eb=function(_0x32c9b9,_0x21a0cf){_0x32c9b9=_0x32c9b9-0x0;var _0x239eab=_0x5eb8[_0x32c9b9];return _0x239eab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8603,0x190));var _0x3860=function(_0x3c7c34,_0xe2e86){_0x3c7c34=_0x3c7c34-0x0;var _0x344b87=_0x8603[_0x3c7c34];return _0x344b87;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4877dda..00469cd 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 _0xb4d0=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x5f27f5,_0x3874d2){var _0x13aa51=function(_0x3770b4){while(--_0x3770b4){_0x5f27f5['push'](_0x5f27f5['shift']());}};_0x13aa51(++_0x3874d2);}(_0xb4d0,0x1ac));var _0x0b4d=function(_0x38d8e2,_0x48603c){_0x38d8e2=_0x38d8e2-0x0;var _0x5afbee=_0xb4d0[_0x38d8e2];return _0x5afbee;};'use strict';var multer=require(_0x0b4d('0x0'));var util=require(_0x0b4d('0x1'));var path=require('path');var timeout=require(_0x0b4d('0x2'));var express=require(_0x0b4d('0x3'));var router=express[_0x0b4d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b4d('0x5'));var config=require(_0x0b4d('0x6'));var controller=require(_0x0b4d('0x7'));router[_0x0b4d('0x8')]('/',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0xa')]);router[_0x0b4d('0x8')](_0x0b4d('0xb'),auth[_0x0b4d('0x9')](),controller[_0x0b4d('0xc')]);router['get'](_0x0b4d('0xd'),auth['isAuthenticated'](),controller[_0x0b4d('0xe')]);router[_0x0b4d('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0b4d('0xf')]);router[_0x0b4d('0x10')]('/',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0x11')]);router[_0x0b4d('0x10')](_0x0b4d('0xd'),auth['isAuthenticated'](),controller[_0x0b4d('0x12')]);router[_0x0b4d('0x13')](_0x0b4d('0xb'),auth[_0x0b4d('0x9')](),controller[_0x0b4d('0x14')]);router['delete'](_0x0b4d('0xb'),auth[_0x0b4d('0x9')](),controller['destroy']);module[_0x0b4d('0x15')]=router; \ No newline at end of file +var _0x4157=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer'];(function(_0x98283c,_0x1a6c5b){var _0x3ba03f=function(_0x4fee61){while(--_0x4fee61){_0x98283c['push'](_0x98283c['shift']());}};_0x3ba03f(++_0x1a6c5b);}(_0x4157,0x18e));var _0x7415=function(_0x361491,_0x244c90){_0x361491=_0x361491-0x0;var _0x2219e6=_0x4157[_0x361491];return _0x2219e6;};'use strict';var multer=require(_0x7415('0x0'));var util=require(_0x7415('0x1'));var path=require(_0x7415('0x2'));var timeout=require(_0x7415('0x3'));var express=require(_0x7415('0x4'));var router=express['Router']();var auth=require(_0x7415('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7415('0x6'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x7415('0x7')](),controller[_0x7415('0x8')]);router['get'](_0x7415('0x9'),auth[_0x7415('0x7')](),controller[_0x7415('0xa')]);router[_0x7415('0xb')](_0x7415('0xc'),auth[_0x7415('0x7')](),controller['getConfigurations']);router[_0x7415('0xb')](_0x7415('0xd'),auth[_0x7415('0x7')](),controller[_0x7415('0xe')]);router[_0x7415('0xf')]('/',auth[_0x7415('0x7')](),controller['create']);router['post'](_0x7415('0xc'),auth[_0x7415('0x7')](),controller['addConfiguration']);router[_0x7415('0x10')](_0x7415('0x9'),auth[_0x7415('0x7')](),controller[_0x7415('0x11')]);router[_0x7415('0x12')](_0x7415('0x9'),auth[_0x7415('0x7')](),controller[_0x7415('0x13')]);module[_0x7415('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e62708d..3edfc71 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 _0xbf3e=['exports','STRING'];(function(_0x4a971c,_0x15f668){var _0x3884ba=function(_0xe6be64){while(--_0xe6be64){_0x4a971c['push'](_0x4a971c['shift']());}};_0x3884ba(++_0x15f668);}(_0xbf3e,0xee));var _0xebf3=function(_0x85e12c,_0x2a9e25){_0x85e12c=_0x85e12c-0x0;var _0x368e66=_0xbf3e[_0x85e12c];return _0x368e66;};'use strict';var Sequelize=require('sequelize');module[_0xebf3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xebf3('0x1')]},'username':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe0a3=['STRING','HelpDesk','sequelize','exports'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0xe0a3,0xba));var _0x3e0a=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xe0a3[_0x5ce8b9];return _0xe34be0;};'use strict';var Sequelize=require(_0x3e0a('0x0'));module[_0x3e0a('0x1')]={'name':{'type':Sequelize[_0x3e0a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3e0a('0x2')]},'username':{'type':Sequelize[_0x3e0a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3e0a('0x2')],'allowNull':![],'defaultValue':_0x3e0a('0x3')},'remoteUri':{'type':Sequelize[_0x3e0a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3e0a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1e3b1f2..35bbc92 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 _0x5665=['sendStatus','status','json','count','offset','limit','set','reject','save','update','destroy','end','stack','name','map','VtigerAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','include','catch','show','fields','find','create','body','params','getConfigurations','findOne','keys','VtigerConfiguration','merge','hasOwnProperty','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','GET','getchallenge','POST','login','token','describe','sessionName','success','autogenerated','reference','owner','includes','remove','editable','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x5f7578,_0x18fcdb){var _0x3b9f1c=function(_0xfc9b9a){while(--_0xfc9b9a){_0x5f7578['push'](_0x5f7578['shift']());}};_0x3b9f1c(++_0x18fcdb);}(_0x5665,0xd8));var _0x5566=function(_0x4a3669,_0xdd5280){_0x4a3669=_0x4a3669-0x0;var _0x41b7bb=_0x5665[_0x4a3669];return _0x41b7bb;};'use strict';var pdf=require(_0x5566('0x0'));var emlformat=require(_0x5566('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5566('0x2'));var jsonpatch=require(_0x5566('0x3'));var rp=require(_0x5566('0x4'));var moment=require(_0x5566('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5566('0x6'));var util=require('util');var path=require(_0x5566('0x7'));var sox=require('sox');var csv=require(_0x5566('0x8'));var ejs=require(_0x5566('0x9'));var fs=require('fs');var _=require(_0x5566('0xa'));var squel=require(_0x5566('0xb'));var crypto=require('crypto');var jsforce=require(_0x5566('0xc'));var deskjs=require(_0x5566('0xd'));var toCsv=require(_0x5566('0x8'));var querystring=require(_0x5566('0xe'));var Papa=require(_0x5566('0xf'));var Redis=require(_0x5566('0x10'));var authService=require(_0x5566('0x11'));var qs=require(_0x5566('0x12'));var as=require(_0x5566('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5566('0x14'))(_0x5566('0x15'));var utils=require(_0x5566('0x16'));var config=require(_0x5566('0x17'));var licenseUtil=require(_0x5566('0x18'));var db=require(_0x5566('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5566('0x1a'));var client=jayson[_0x5566('0x1b')][_0x5566('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x327aab,_0x308790,_0x4ec931,_0x4555e6){return new BPromise(function(_0x1d0ce5,_0x423036){var _0x1463eb=_0x4555e6||client;return _0x1463eb[_0x5566('0x1d')](_0x327aab,_0x4ec931)[_0x5566('0x1e')](function(_0x31f869){logger[_0x5566('0x1f')](_0x5566('0x20'),_0x308790,_0x5566('0x21'));logger['debug'](_0x5566('0x22'),_0x308790,_0x5566('0x21'),JSON['stringify'](_0x31f869));if(_0x31f869[_0x5566('0x23')]){if(_0x31f869[_0x5566('0x23')]['code']===0x1f4){logger['error'](_0x5566('0x20'),_0x308790,_0x31f869['error'][_0x5566('0x24')]);return _0x423036(_0x31f869[_0x5566('0x23')][_0x5566('0x24')]);}logger['error'](_0x5566('0x20'),_0x308790,_0x31f869[_0x5566('0x23')]['message']);return _0x1d0ce5(_0x31f869[_0x5566('0x23')][_0x5566('0x24')]);}else{logger[_0x5566('0x1f')](_0x5566('0x20'),_0x308790,'request\x20sent');_0x1d0ce5(_0x31f869[_0x5566('0x25')][_0x5566('0x24')]);}})['catch'](function(_0x1b55b9){logger[_0x5566('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x308790,_0x1b55b9);_0x423036(_0x1b55b9);});});}function respondWithStatusCode(_0x316b9e,_0x5fe900){_0x5fe900=_0x5fe900||0xcc;return function(_0x666f2e){if(_0x666f2e){return _0x316b9e[_0x5566('0x26')](_0x5fe900);}return _0x316b9e[_0x5566('0x27')](_0x5fe900)['end']();};}function respondWithResult(_0x20c167,_0x48314e){_0x48314e=_0x48314e||0xc8;return function(_0x320889){if(_0x320889){return _0x20c167[_0x5566('0x27')](_0x48314e)[_0x5566('0x28')](_0x320889);}};}function respondWithFilteredResult(_0x441b3b,_0x3eae11){return function(_0x332890){if(_0x332890){var _0x1c8523=_0x332890[_0x5566('0x29')],_0x55a93f=_0x3eae11[_0x5566('0x2a')],_0x8f1c22=_0x3eae11['offset']+_0x3eae11[_0x5566('0x2b')],_0x1f7877;if(_0x8f1c22>=_0x1c8523){_0x8f1c22=_0x1c8523;_0x1f7877=0xc8;}else{_0x1f7877=0xce;}_0x441b3b[_0x5566('0x27')](_0x1f7877);return _0x441b3b[_0x5566('0x2c')]('Content-Range',_0x55a93f+'-'+_0x8f1c22+'/'+_0x1c8523)[_0x5566('0x28')](_0x332890);}return null;};}function patchUpdates(_0x2583ef){return function(_0x625fd7){try{jsonpatch['apply'](_0x625fd7,_0x2583ef,!![]);}catch(_0x5de71a){return BPromise[_0x5566('0x2d')](_0x5de71a);}return _0x625fd7[_0x5566('0x2e')]();};}function saveUpdates(_0x50332d,_0x407a08){return function(_0x2edda4){if(_0x2edda4){return _0x2edda4[_0x5566('0x2f')](_0x50332d)['then'](function(_0x419595){return _0x419595;});}return null;};}function removeEntity(_0x1c4d9d,_0x2bc574){return function(_0x11d6ba){if(_0x11d6ba){return _0x11d6ba[_0x5566('0x30')]()[_0x5566('0x1e')](function(){_0x1c4d9d['status'](0xcc)[_0x5566('0x31')]();});}};}function handleEntityNotFound(_0x33ef6d,_0x1004ab){return function(_0x509e7f){if(!_0x509e7f){_0x33ef6d[_0x5566('0x26')](0x194);}return _0x509e7f;};}function handleError(_0x303ffb,_0x324bd0){_0x324bd0=_0x324bd0||0x1f4;return function(_0x3d3d59){logger['error'](_0x3d3d59[_0x5566('0x32')]);if(_0x3d3d59[_0x5566('0x33')]){delete _0x3d3d59[_0x5566('0x33')];}_0x303ffb[_0x5566('0x27')](_0x324bd0)['send'](_0x3d3d59);};}exports['index']=function(_0x46e78c,_0x4ece26){var _0x466f98={},_0xaed5b2={},_0x5e62cc={'count':0x0,'rows':[]};var _0x4afe41=_[_0x5566('0x34')](db[_0x5566('0x35')][_0x5566('0x36')],function(_0x52edc6){return{'name':_0x52edc6[_0x5566('0x37')],'type':_0x52edc6['type'][_0x5566('0x38')]};});_0xaed5b2['model']=_[_0x5566('0x34')](_0x4afe41,'name');_0xaed5b2[_0x5566('0x39')]=_['keys'](_0x46e78c['query']);_0xaed5b2[_0x5566('0x3a')]=_[_0x5566('0x3b')](_0xaed5b2[_0x5566('0x3c')],_0xaed5b2[_0x5566('0x39')]);_0x466f98[_0x5566('0x3d')]=_[_0x5566('0x3b')](_0xaed5b2[_0x5566('0x3c')],qs['fields'](_0x46e78c[_0x5566('0x39')]['fields']));_0x466f98[_0x5566('0x3d')]=_0x466f98[_0x5566('0x3d')][_0x5566('0x3e')]?_0x466f98[_0x5566('0x3d')]:_0xaed5b2[_0x5566('0x3c')];if(!_0x46e78c['query']['hasOwnProperty'](_0x5566('0x3f'))){_0x466f98[_0x5566('0x2b')]=qs['limit'](_0x46e78c[_0x5566('0x39')]['limit']);_0x466f98[_0x5566('0x2a')]=qs[_0x5566('0x2a')](_0x46e78c[_0x5566('0x39')][_0x5566('0x2a')]);}_0x466f98[_0x5566('0x40')]=qs[_0x5566('0x41')](_0x46e78c[_0x5566('0x39')][_0x5566('0x41')]);_0x466f98[_0x5566('0x42')]=qs[_0x5566('0x3a')](_[_0x5566('0x43')](_0x46e78c['query'],_0xaed5b2[_0x5566('0x3a')]),_0x4afe41);if(_0x46e78c[_0x5566('0x39')]['filter']){_0x466f98[_0x5566('0x42')]=_['merge'](_0x466f98['where'],{'$or':_[_0x5566('0x34')](_0x4afe41,function(_0x22b6c1){if(_0x22b6c1[_0x5566('0x44')]!==_0x5566('0x45')){var _0x1a79f6={};_0x1a79f6[_0x22b6c1[_0x5566('0x33')]]={'$like':'%'+_0x46e78c['query'][_0x5566('0x46')]+'%'};return _0x1a79f6;}})});}_0x466f98=_['merge']({},_0x466f98,_0x46e78c[_0x5566('0x47')]);var _0x1e3847={'where':_0x466f98[_0x5566('0x42')]};return db[_0x5566('0x35')][_0x5566('0x29')](_0x1e3847)[_0x5566('0x1e')](function(_0x423ecd){_0x5e62cc[_0x5566('0x29')]=_0x423ecd;if(_0x46e78c['query']['includeAll']){_0x466f98[_0x5566('0x48')]=[{'all':!![]}];}return db[_0x5566('0x35')]['findAll'](_0x466f98);})[_0x5566('0x1e')](function(_0x4bac01){_0x5e62cc['rows']=_0x4bac01;return _0x5e62cc;})[_0x5566('0x1e')](respondWithFilteredResult(_0x4ece26,_0x466f98))[_0x5566('0x49')](handleError(_0x4ece26,null));};exports[_0x5566('0x4a')]=function(_0x206d61,_0x33ada8){var _0x6579e0={'raw':![],'where':{'id':_0x206d61['params']['id']}},_0x8f189c={};_0x8f189c[_0x5566('0x3c')]=_['keys'](db[_0x5566('0x35')][_0x5566('0x36')]);_0x8f189c[_0x5566('0x39')]=_['keys'](_0x206d61['query']);_0x8f189c[_0x5566('0x3a')]=_['intersection'](_0x8f189c['model'],_0x8f189c['query']);_0x6579e0['attributes']=_[_0x5566('0x3b')](_0x8f189c['model'],qs[_0x5566('0x4b')](_0x206d61[_0x5566('0x39')][_0x5566('0x4b')]));_0x6579e0['attributes']=_0x6579e0[_0x5566('0x3d')][_0x5566('0x3e')]?_0x6579e0[_0x5566('0x3d')]:_0x8f189c['model'];if(_0x206d61[_0x5566('0x39')]['includeAll']){_0x6579e0['include']=[{'all':!![]}];}_0x6579e0=_['merge']({},_0x6579e0,_0x206d61[_0x5566('0x47')]);return db['VtigerAccount'][_0x5566('0x4c')](_0x6579e0)['then'](handleEntityNotFound(_0x33ada8,null))[_0x5566('0x1e')](respondWithResult(_0x33ada8,null))[_0x5566('0x49')](handleError(_0x33ada8,null));};exports[_0x5566('0x4d')]=function(_0x18fc67,_0x5bb950){return db['VtigerAccount']['create'](_0x18fc67[_0x5566('0x4e')],{})['then'](respondWithResult(_0x5bb950,0xc9))[_0x5566('0x49')](handleError(_0x5bb950,null));};exports[_0x5566('0x2f')]=function(_0x58b6ea,_0x4fede7){if(_0x58b6ea[_0x5566('0x4e')]['id']){delete _0x58b6ea[_0x5566('0x4e')]['id'];}return db[_0x5566('0x35')]['find']({'where':{'id':_0x58b6ea['params']['id']}})[_0x5566('0x1e')](handleEntityNotFound(_0x4fede7,null))[_0x5566('0x1e')](saveUpdates(_0x58b6ea[_0x5566('0x4e')],null))[_0x5566('0x1e')](respondWithResult(_0x4fede7,null))[_0x5566('0x49')](handleError(_0x4fede7,null));};exports[_0x5566('0x30')]=function(_0x54f8ad,_0x3fd4f5){return db[_0x5566('0x35')][_0x5566('0x4c')]({'where':{'id':_0x54f8ad[_0x5566('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3fd4f5,null))[_0x5566('0x1e')](removeEntity(_0x3fd4f5,null))[_0x5566('0x49')](handleError(_0x3fd4f5,null));};exports[_0x5566('0x50')]=function(_0x2821ba,_0x8ce6ea,_0x5a4965){var _0x4e0a02={};var _0x368bd9={};var _0x3976fc;var _0x4c797f;return db[_0x5566('0x35')][_0x5566('0x51')]({'where':{'id':_0x2821ba['params']['id']}})[_0x5566('0x1e')](handleEntityNotFound(_0x8ce6ea,null))[_0x5566('0x1e')](function(_0x4c3bab){if(_0x4c3bab){_0x3976fc=_0x4c3bab;_0x368bd9[_0x5566('0x3c')]=_[_0x5566('0x52')](db[_0x5566('0x53')]['rawAttributes']);_0x368bd9[_0x5566('0x39')]=_[_0x5566('0x52')](_0x2821ba[_0x5566('0x39')]);_0x368bd9[_0x5566('0x3a')]=_['intersection'](_0x368bd9[_0x5566('0x3c')],_0x368bd9[_0x5566('0x39')]);_0x4e0a02[_0x5566('0x3d')]=_['intersection'](_0x368bd9[_0x5566('0x3c')],qs[_0x5566('0x4b')](_0x2821ba['query'][_0x5566('0x4b')]));_0x4e0a02['attributes']=_0x4e0a02[_0x5566('0x3d')][_0x5566('0x3e')]?_0x4e0a02[_0x5566('0x3d')]:_0x368bd9[_0x5566('0x3c')];_0x4e0a02[_0x5566('0x40')]=qs[_0x5566('0x41')](_0x2821ba[_0x5566('0x39')]['sort']);_0x4e0a02[_0x5566('0x42')]=qs[_0x5566('0x3a')](_[_0x5566('0x43')](_0x2821ba[_0x5566('0x39')],_0x368bd9[_0x5566('0x3a')]));if(_0x2821ba[_0x5566('0x39')][_0x5566('0x46')]){_0x4e0a02[_0x5566('0x42')]=_[_0x5566('0x54')](_0x4e0a02[_0x5566('0x42')],{'$or':_[_0x5566('0x34')](_0x4e0a02[_0x5566('0x3d')],function(_0x1cc4c1){var _0x313781={};_0x313781[_0x1cc4c1]={'$like':'%'+_0x2821ba['query']['filter']+'%'};return _0x313781;})});}_0x4e0a02=_[_0x5566('0x54')]({},_0x4e0a02,_0x2821ba['options']);return _0x3976fc[_0x5566('0x50')](_0x4e0a02);}})[_0x5566('0x1e')](function(_0x29c09a){if(_0x29c09a){_0x4c797f=_0x29c09a['length'];if(!_0x2821ba[_0x5566('0x39')][_0x5566('0x55')]('nolimit')){_0x4e0a02[_0x5566('0x2b')]=qs['limit'](_0x2821ba['query']['limit']);_0x4e0a02[_0x5566('0x2a')]=qs['offset'](_0x2821ba['query'][_0x5566('0x2a')]);}return _0x3976fc[_0x5566('0x50')](_0x4e0a02);}})[_0x5566('0x1e')](function(_0x111be7){if(_0x111be7){return _0x111be7?{'count':_0x4c797f,'rows':_0x111be7}:null;}})['then'](respondWithResult(_0x8ce6ea,null))[_0x5566('0x49')](handleError(_0x8ce6ea,null));};exports['addConfiguration']=function(_0x286d89,_0xc54694,_0x3e4cfd){if(_0x286d89[_0x5566('0x4e')]['id']){delete _0x286d89[_0x5566('0x4e')]['id'];}return db[_0x5566('0x35')]['findOne']({'where':{'id':_0x286d89['params']['id']}})['then'](handleEntityNotFound(_0xc54694,null))['then'](function(_0x3d796b){if(_0x3d796b){_0x286d89['body']['AccountId']=_0x3d796b['id'];_0x286d89[_0x5566('0x4e')]['Subjects']=integrations[_0x5566('0x56')](_0x286d89[_0x5566('0x4e')][_0x5566('0x57')],_0x286d89['body'][_0x5566('0x44')]);_0x286d89['body'][_0x5566('0x58')]=integrations[_0x5566('0x59')](_0x286d89[_0x5566('0x4e')][_0x5566('0x57')],_0x286d89[_0x5566('0x4e')][_0x5566('0x44')]);return db[_0x5566('0x53')][_0x5566('0x4d')](_0x286d89[_0x5566('0x4e')],{'include':[{'model':db[_0x5566('0x5a')],'as':_0x5566('0x5b')},{'model':db[_0x5566('0x5a')],'as':_0x5566('0x58')}]});}return null;})[_0x5566('0x1e')](respondWithResult(_0xc54694,null))[_0x5566('0x49')](handleError(_0xc54694,null));};var md5=require(_0x5566('0x5c'));exports[_0x5566('0x5d')]=function(_0x110325,_0x563205,_0x5866fd){var _0x25d14a=null;var _0x27fead=null;var _0x41453f=null;var _0x516207=null;var _0x437d10='';return db[_0x5566('0x35')]['findOne']({'where':{'id':_0x110325[_0x5566('0x4f')]['id']},'attributes':['id',_0x5566('0x33'),_0x5566('0x5e'),'description',_0x5566('0x5f'),_0x5566('0x60'),_0x5566('0x61'),_0x5566('0x62')]})[_0x5566('0x1e')](handleEntityNotFound(_0x563205,null))[_0x5566('0x1e')](function(_0x1340bc){if(_0x1340bc){_0x25d14a=_0x1340bc[_0x5566('0x5e')];_0x27fead=_0x1340bc['accessKey'];_0x41453f=_0x1340bc[_0x5566('0x5f')];_0x437d10=_0x1340bc['remoteUri'];var _0x5f194d=_0x437d10[_0x5566('0x63')](-0x1);if(_0x5f194d==='/'){_0x437d10=_0x437d10[_0x5566('0x64')](0x0,_0x437d10['lastIndexOf'](_0x5f194d));}_0x516207=util['format']('%s/webservice.php',_0x437d10);var _0x431508={'method':_0x5566('0x65'),'uri':_0x516207,'qs':{'operation':_0x5566('0x66'),'username':_0x1340bc[_0x5566('0x5e')]},'json':!![]};return rp(_0x431508);}})[_0x5566('0x1e')](function(_0x3c6ef5){if(_0x3c6ef5['success']){var _0x8f2f60={'method':_0x5566('0x67'),'uri':_0x516207,'form':{'operation':_0x5566('0x68'),'username':_0x25d14a,'accessKey':md5(_0x3c6ef5[_0x5566('0x25')][_0x5566('0x69')]+_0x27fead)},'json':!![]};return rp(_0x8f2f60);}})['then'](function(_0x129621){if(_0x129621['success']){var _0x4a3889={'method':'GET','uri':_0x516207,'qs':{'operation':_0x5566('0x6a'),'username':_0x25d14a,'sessionName':_0x129621[_0x5566('0x25')][_0x5566('0x6b')],'elementType':_0x41453f},'json':!![]};return rp(_0x4a3889);}})['then'](function(_0x38efc4){if(_0x38efc4[_0x5566('0x6c')]){var _0x5e1c4f=[_0x5566('0x6d'),_0x5566('0x6e'),_0x5566('0x6f')];_['remove'](_0x38efc4[_0x5566('0x25')][_0x5566('0x4b')],function(_0x3b2c6c){return _0x5e1c4f[_0x5566('0x70')](_0x3b2c6c[_0x5566('0x44')]['name']);});_[_0x5566('0x71')](_0x38efc4[_0x5566('0x25')]['fields'],function(_0x351c44){return _0x351c44[_0x5566('0x72')]==='false';});return{'count':_0x38efc4[_0x5566('0x25')][_0x5566('0x4b')][_0x5566('0x3e')],'rows':_[_0x5566('0x34')](_0x38efc4['result'][_0x5566('0x4b')],function(_0x1447ba){return{'id':_0x1447ba['name'],'name':_0x1447ba[_0x5566('0x73')],'custom':_[_0x5566('0x74')](_0x1447ba['name'],'cf_')?!![]:![],'options':_0x1447ba[_0x5566('0x44')][_0x5566('0x33')]==='picklist'&&_0x1447ba['type'][_0x5566('0x75')]['length']>0x0?_[_0x5566('0x34')](_0x1447ba['type'][_0x5566('0x75')],function(_0x24b0f9){return{'name':_0x24b0f9['label'],'value':_0x24b0f9[_0x5566('0x76')]};}):[]};})};}})[_0x5566('0x1e')](respondWithResult(_0x563205,null))['catch'](function(_0x37c30a){console[_0x5566('0x77')](_0x5566('0x78')+_0x37c30a);var _0x5a99af=_0x110325['query'][_0x5566('0x79')]?0x1f4:_0x37c30a[_0x5566('0x7a')]||0x1f4;logger[_0x5566('0x23')](_0x5566('0x7b'),'getFields',_0x5a99af,JSON[_0x5566('0x7c')](_0x37c30a));delete _0x37c30a[_0x5566('0x33')];if(_0x5a99af===0x191){_0x5a99af=0x190;}_0x563205[_0x5566('0x27')](_0x5a99af)[_0x5566('0x7d')](_0x110325[_0x5566('0x39')]['test']?{'message':_0x5566('0x7e'),'statusCode':_0x37c30a[_0x5566('0x7a')]}:_0x37c30a);});}; \ No newline at end of file +var _0x9402=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','destroy','stack','name','send','index','map','VtigerAccount','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','login','success','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20'];(function(_0x501b13,_0x3a6f68){var _0x189f39=function(_0x3a38ba){while(--_0x3a38ba){_0x501b13['push'](_0x501b13['shift']());}};_0x189f39(++_0x3a6f68);}(_0x9402,0x85));var _0x2940=function(_0x21571d,_0x4286b7){_0x21571d=_0x21571d-0x0;var _0x2d6c2e=_0x9402[_0x21571d];return _0x2d6c2e;};'use strict';var pdf=require(_0x2940('0x0'));var emlformat=require(_0x2940('0x1'));var rimraf=require(_0x2940('0x2'));var zipdir=require(_0x2940('0x3'));var jsonpatch=require(_0x2940('0x4'));var rp=require('request-promise');var moment=require(_0x2940('0x5'));var BPromise=require(_0x2940('0x6'));var Mustache=require(_0x2940('0x7'));var util=require(_0x2940('0x8'));var path=require('path');var sox=require(_0x2940('0x9'));var csv=require(_0x2940('0xa'));var ejs=require(_0x2940('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2940('0xc'));var crypto=require(_0x2940('0xd'));var jsforce=require(_0x2940('0xe'));var deskjs=require(_0x2940('0xf'));var toCsv=require(_0x2940('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2940('0x10'));var as=require(_0x2940('0x11'));var hardwareService=require(_0x2940('0x12'));var logger=require(_0x2940('0x13'))(_0x2940('0x14'));var utils=require(_0x2940('0x15'));var config=require(_0x2940('0x16'));var licenseUtil=require(_0x2940('0x17'));var db=require(_0x2940('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x2940('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x179b3f,_0x5dc251,_0x285880,_0x564163){return new BPromise(function(_0x2da5a5,_0xc26a0c){var _0x53088f=_0x564163||client;return _0x53088f[_0x2940('0x1a')](_0x179b3f,_0x285880)[_0x2940('0x1b')](function(_0x1d50c5){logger[_0x2940('0x1c')](_0x2940('0x1d'),_0x5dc251,_0x2940('0x1e'));logger['debug'](_0x2940('0x1f'),_0x5dc251,'request\x20sent',JSON['stringify'](_0x1d50c5));if(_0x1d50c5[_0x2940('0x20')]){if(_0x1d50c5[_0x2940('0x20')][_0x2940('0x21')]===0x1f4){logger[_0x2940('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x5dc251,_0x1d50c5[_0x2940('0x20')]['message']);return _0xc26a0c(_0x1d50c5[_0x2940('0x20')][_0x2940('0x22')]);}logger[_0x2940('0x20')](_0x2940('0x1d'),_0x5dc251,_0x1d50c5[_0x2940('0x20')][_0x2940('0x22')]);return _0x2da5a5(_0x1d50c5['error'][_0x2940('0x22')]);}else{logger[_0x2940('0x1c')](_0x2940('0x1d'),_0x5dc251,'request\x20sent');_0x2da5a5(_0x1d50c5[_0x2940('0x23')][_0x2940('0x22')]);}})['catch'](function(_0x25f0d1){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5dc251,_0x25f0d1);_0xc26a0c(_0x25f0d1);});});}function respondWithStatusCode(_0x5fdbae,_0x3b9703){_0x3b9703=_0x3b9703||0xcc;return function(_0x85be79){if(_0x85be79){return _0x5fdbae[_0x2940('0x24')](_0x3b9703);}return _0x5fdbae[_0x2940('0x25')](_0x3b9703)[_0x2940('0x26')]();};}function respondWithResult(_0x4a5b4e,_0xece18f){_0xece18f=_0xece18f||0xc8;return function(_0x3a7e32){if(_0x3a7e32){return _0x4a5b4e[_0x2940('0x25')](_0xece18f)[_0x2940('0x27')](_0x3a7e32);}};}function respondWithFilteredResult(_0x2fe4ba,_0x208367){return function(_0x44a6cb){if(_0x44a6cb){var _0x4b227f=_0x44a6cb[_0x2940('0x28')],_0x36faca=_0x208367[_0x2940('0x29')],_0x38653a=_0x208367[_0x2940('0x29')]+_0x208367['limit'],_0x56c304;if(_0x38653a>=_0x4b227f){_0x38653a=_0x4b227f;_0x56c304=0xc8;}else{_0x56c304=0xce;}_0x2fe4ba[_0x2940('0x25')](_0x56c304);return _0x2fe4ba[_0x2940('0x2a')](_0x2940('0x2b'),_0x36faca+'-'+_0x38653a+'/'+_0x4b227f)[_0x2940('0x27')](_0x44a6cb);}return null;};}function patchUpdates(_0x4f16b8){return function(_0x7213e9){try{jsonpatch['apply'](_0x7213e9,_0x4f16b8,!![]);}catch(_0x3edb5c){return BPromise[_0x2940('0x2c')](_0x3edb5c);}return _0x7213e9[_0x2940('0x2d')]();};}function saveUpdates(_0x43dac7,_0x47ac54){return function(_0x21d4b0){if(_0x21d4b0){return _0x21d4b0['update'](_0x43dac7)[_0x2940('0x1b')](function(_0x50e446){return _0x50e446;});}return null;};}function removeEntity(_0x1328a7,_0x56cc2e){return function(_0xcb943e){if(_0xcb943e){return _0xcb943e[_0x2940('0x2e')]()[_0x2940('0x1b')](function(){_0x1328a7['status'](0xcc)[_0x2940('0x26')]();});}};}function handleEntityNotFound(_0xf0efc5,_0x508130){return function(_0x24345d){if(!_0x24345d){_0xf0efc5[_0x2940('0x24')](0x194);}return _0x24345d;};}function handleError(_0xa2ead3,_0x22bed5){_0x22bed5=_0x22bed5||0x1f4;return function(_0x1acc77){logger['error'](_0x1acc77[_0x2940('0x2f')]);if(_0x1acc77[_0x2940('0x30')]){delete _0x1acc77[_0x2940('0x30')];}_0xa2ead3[_0x2940('0x25')](_0x22bed5)[_0x2940('0x31')](_0x1acc77);};}exports[_0x2940('0x32')]=function(_0x434862,_0x49e470){var _0x48b99c={},_0x11e83e={},_0x235cb4={'count':0x0,'rows':[]};var _0x3487e1=_[_0x2940('0x33')](db[_0x2940('0x34')]['rawAttributes'],function(_0x3058c6){return{'name':_0x3058c6['fieldName'],'type':_0x3058c6[_0x2940('0x35')][_0x2940('0x36')]};});_0x11e83e[_0x2940('0x37')]=_['map'](_0x3487e1,'name');_0x11e83e['query']=_[_0x2940('0x38')](_0x434862[_0x2940('0x39')]);_0x11e83e['filters']=_[_0x2940('0x3a')](_0x11e83e[_0x2940('0x37')],_0x11e83e['query']);_0x48b99c['attributes']=_[_0x2940('0x3a')](_0x11e83e['model'],qs[_0x2940('0x3b')](_0x434862[_0x2940('0x39')][_0x2940('0x3b')]));_0x48b99c[_0x2940('0x3c')]=_0x48b99c[_0x2940('0x3c')][_0x2940('0x3d')]?_0x48b99c['attributes']:_0x11e83e[_0x2940('0x37')];if(!_0x434862[_0x2940('0x39')]['hasOwnProperty'](_0x2940('0x3e'))){_0x48b99c[_0x2940('0x3f')]=qs[_0x2940('0x3f')](_0x434862[_0x2940('0x39')]['limit']);_0x48b99c[_0x2940('0x29')]=qs[_0x2940('0x29')](_0x434862[_0x2940('0x39')][_0x2940('0x29')]);}_0x48b99c[_0x2940('0x40')]=qs[_0x2940('0x41')](_0x434862[_0x2940('0x39')][_0x2940('0x41')]);_0x48b99c[_0x2940('0x42')]=qs[_0x2940('0x43')](_['pick'](_0x434862[_0x2940('0x39')],_0x11e83e['filters']),_0x3487e1);if(_0x434862[_0x2940('0x39')]['filter']){_0x48b99c[_0x2940('0x42')]=_[_0x2940('0x44')](_0x48b99c[_0x2940('0x42')],{'$or':_['map'](_0x3487e1,function(_0x2b6caf){if(_0x2b6caf[_0x2940('0x35')]!==_0x2940('0x45')){var _0xe798b5={};_0xe798b5[_0x2b6caf[_0x2940('0x30')]]={'$like':'%'+_0x434862['query'][_0x2940('0x46')]+'%'};return _0xe798b5;}})});}_0x48b99c=_['merge']({},_0x48b99c,_0x434862[_0x2940('0x47')]);var _0xf3a75={'where':_0x48b99c[_0x2940('0x42')]};return db[_0x2940('0x34')][_0x2940('0x28')](_0xf3a75)['then'](function(_0x222375){_0x235cb4['count']=_0x222375;if(_0x434862[_0x2940('0x39')][_0x2940('0x48')]){_0x48b99c[_0x2940('0x49')]=[{'all':!![]}];}return db[_0x2940('0x34')][_0x2940('0x4a')](_0x48b99c);})[_0x2940('0x1b')](function(_0x4a45af){_0x235cb4['rows']=_0x4a45af;return _0x235cb4;})[_0x2940('0x1b')](respondWithFilteredResult(_0x49e470,_0x48b99c))[_0x2940('0x4b')](handleError(_0x49e470,null));};exports[_0x2940('0x4c')]=function(_0x592e73,_0x313229){var _0xc1090c={'raw':![],'where':{'id':_0x592e73[_0x2940('0x4d')]['id']}},_0x2326d1={};_0x2326d1['model']=_[_0x2940('0x38')](db[_0x2940('0x34')]['rawAttributes']);_0x2326d1['query']=_['keys'](_0x592e73[_0x2940('0x39')]);_0x2326d1[_0x2940('0x43')]=_[_0x2940('0x3a')](_0x2326d1[_0x2940('0x37')],_0x2326d1[_0x2940('0x39')]);_0xc1090c[_0x2940('0x3c')]=_['intersection'](_0x2326d1[_0x2940('0x37')],qs[_0x2940('0x3b')](_0x592e73[_0x2940('0x39')][_0x2940('0x3b')]));_0xc1090c[_0x2940('0x3c')]=_0xc1090c[_0x2940('0x3c')]['length']?_0xc1090c[_0x2940('0x3c')]:_0x2326d1['model'];if(_0x592e73[_0x2940('0x39')][_0x2940('0x48')]){_0xc1090c[_0x2940('0x49')]=[{'all':!![]}];}_0xc1090c=_['merge']({},_0xc1090c,_0x592e73['options']);return db['VtigerAccount'][_0x2940('0x4e')](_0xc1090c)[_0x2940('0x1b')](handleEntityNotFound(_0x313229,null))[_0x2940('0x1b')](respondWithResult(_0x313229,null))[_0x2940('0x4b')](handleError(_0x313229,null));};exports[_0x2940('0x4f')]=function(_0xbec163,_0x5e902d){return db['VtigerAccount'][_0x2940('0x4f')](_0xbec163[_0x2940('0x50')],{})['then'](respondWithResult(_0x5e902d,0xc9))[_0x2940('0x4b')](handleError(_0x5e902d,null));};exports['update']=function(_0x4b953c,_0x26170c){if(_0x4b953c[_0x2940('0x50')]['id']){delete _0x4b953c[_0x2940('0x50')]['id'];}return db[_0x2940('0x34')][_0x2940('0x4e')]({'where':{'id':_0x4b953c[_0x2940('0x4d')]['id']}})['then'](handleEntityNotFound(_0x26170c,null))[_0x2940('0x1b')](saveUpdates(_0x4b953c['body'],null))['then'](respondWithResult(_0x26170c,null))['catch'](handleError(_0x26170c,null));};exports[_0x2940('0x2e')]=function(_0x4e93d9,_0x153c74){return db['VtigerAccount'][_0x2940('0x4e')]({'where':{'id':_0x4e93d9['params']['id']}})[_0x2940('0x1b')](handleEntityNotFound(_0x153c74,null))[_0x2940('0x1b')](removeEntity(_0x153c74,null))[_0x2940('0x4b')](handleError(_0x153c74,null));};exports[_0x2940('0x51')]=function(_0x21874b,_0x103eb1,_0x1ac682){var _0x3a110a={};var _0x3ef0da={};var _0x47d47b;var _0x42dbf7;return db[_0x2940('0x34')][_0x2940('0x52')]({'where':{'id':_0x21874b[_0x2940('0x4d')]['id']}})[_0x2940('0x1b')](handleEntityNotFound(_0x103eb1,null))[_0x2940('0x1b')](function(_0x2e174d){if(_0x2e174d){_0x47d47b=_0x2e174d;_0x3ef0da['model']=_[_0x2940('0x38')](db[_0x2940('0x53')]['rawAttributes']);_0x3ef0da['query']=_['keys'](_0x21874b[_0x2940('0x39')]);_0x3ef0da[_0x2940('0x43')]=_[_0x2940('0x3a')](_0x3ef0da[_0x2940('0x37')],_0x3ef0da[_0x2940('0x39')]);_0x3a110a[_0x2940('0x3c')]=_['intersection'](_0x3ef0da[_0x2940('0x37')],qs[_0x2940('0x3b')](_0x21874b[_0x2940('0x39')]['fields']));_0x3a110a['attributes']=_0x3a110a[_0x2940('0x3c')][_0x2940('0x3d')]?_0x3a110a['attributes']:_0x3ef0da[_0x2940('0x37')];_0x3a110a['order']=qs[_0x2940('0x41')](_0x21874b['query']['sort']);_0x3a110a[_0x2940('0x42')]=qs[_0x2940('0x43')](_['pick'](_0x21874b['query'],_0x3ef0da['filters']));if(_0x21874b['query']['filter']){_0x3a110a[_0x2940('0x42')]=_[_0x2940('0x44')](_0x3a110a[_0x2940('0x42')],{'$or':_[_0x2940('0x33')](_0x3a110a[_0x2940('0x3c')],function(_0x877eaa){var _0x479e16={};_0x479e16[_0x877eaa]={'$like':'%'+_0x21874b['query'][_0x2940('0x46')]+'%'};return _0x479e16;})});}_0x3a110a=_[_0x2940('0x44')]({},_0x3a110a,_0x21874b[_0x2940('0x47')]);return _0x47d47b['getConfigurations'](_0x3a110a);}})[_0x2940('0x1b')](function(_0x167f9c){if(_0x167f9c){_0x42dbf7=_0x167f9c[_0x2940('0x3d')];if(!_0x21874b[_0x2940('0x39')]['hasOwnProperty'](_0x2940('0x3e'))){_0x3a110a[_0x2940('0x3f')]=qs['limit'](_0x21874b[_0x2940('0x39')]['limit']);_0x3a110a[_0x2940('0x29')]=qs['offset'](_0x21874b[_0x2940('0x39')]['offset']);}return _0x47d47b[_0x2940('0x51')](_0x3a110a);}})[_0x2940('0x1b')](function(_0x317526){if(_0x317526){return _0x317526?{'count':_0x42dbf7,'rows':_0x317526}:null;}})[_0x2940('0x1b')](respondWithResult(_0x103eb1,null))[_0x2940('0x4b')](handleError(_0x103eb1,null));};exports[_0x2940('0x54')]=function(_0x44df3b,_0x47d735,_0x4489eb){if(_0x44df3b[_0x2940('0x50')]['id']){delete _0x44df3b[_0x2940('0x50')]['id'];}return db[_0x2940('0x34')][_0x2940('0x52')]({'where':{'id':_0x44df3b[_0x2940('0x4d')]['id']}})['then'](handleEntityNotFound(_0x47d735,null))[_0x2940('0x1b')](function(_0x42275c){if(_0x42275c){_0x44df3b[_0x2940('0x50')][_0x2940('0x55')]=_0x42275c['id'];_0x44df3b[_0x2940('0x50')][_0x2940('0x56')]=integrations[_0x2940('0x57')](_0x44df3b[_0x2940('0x50')]['channel'],_0x44df3b[_0x2940('0x50')][_0x2940('0x35')]);_0x44df3b[_0x2940('0x50')][_0x2940('0x58')]=integrations[_0x2940('0x59')](_0x44df3b[_0x2940('0x50')][_0x2940('0x5a')],_0x44df3b[_0x2940('0x50')][_0x2940('0x35')]);return db['VtigerConfiguration']['create'](_0x44df3b[_0x2940('0x50')],{'include':[{'model':db['VtigerField'],'as':_0x2940('0x56')},{'model':db[_0x2940('0x5b')],'as':_0x2940('0x58')}]});}return null;})[_0x2940('0x1b')](respondWithResult(_0x47d735,null))['catch'](handleError(_0x47d735,null));};var md5=require(_0x2940('0x5c'));exports[_0x2940('0x5d')]=function(_0x128aa9,_0x5d4cfe,_0x49676e){var _0x45dc73=null;var _0x2ed8cc=null;var _0x2b72ea=null;var _0x34caa6=null;var _0xbf1d0c='';return db[_0x2940('0x34')][_0x2940('0x52')]({'where':{'id':_0x128aa9[_0x2940('0x4d')]['id']},'attributes':['id',_0x2940('0x30'),_0x2940('0x5e'),_0x2940('0x5f'),_0x2940('0x60'),_0x2940('0x61'),_0x2940('0x62'),_0x2940('0x63')]})[_0x2940('0x1b')](handleEntityNotFound(_0x5d4cfe,null))[_0x2940('0x1b')](function(_0x28f6a1){if(_0x28f6a1){_0x45dc73=_0x28f6a1['username'];_0x2ed8cc=_0x28f6a1['accessKey'];_0x2b72ea=_0x28f6a1[_0x2940('0x60')];_0xbf1d0c=_0x28f6a1[_0x2940('0x61')];var _0x33b630=_0xbf1d0c[_0x2940('0x64')](-0x1);if(_0x33b630==='/'){_0xbf1d0c=_0xbf1d0c['substring'](0x0,_0xbf1d0c[_0x2940('0x65')](_0x33b630));}_0x34caa6=util[_0x2940('0x66')](_0x2940('0x67'),_0xbf1d0c);var _0x448293={'method':_0x2940('0x68'),'uri':_0x34caa6,'qs':{'operation':_0x2940('0x69'),'username':_0x28f6a1['username']},'json':!![]};return rp(_0x448293);}})['then'](function(_0x4a5eb3){if(_0x4a5eb3['success']){var _0x4f3def={'method':'POST','uri':_0x34caa6,'form':{'operation':_0x2940('0x6a'),'username':_0x45dc73,'accessKey':md5(_0x4a5eb3[_0x2940('0x23')]['token']+_0x2ed8cc)},'json':!![]};return rp(_0x4f3def);}})[_0x2940('0x1b')](function(_0x2156d0){if(_0x2156d0[_0x2940('0x6b')]){var _0x3582b2={'method':_0x2940('0x68'),'uri':_0x34caa6,'qs':{'operation':_0x2940('0x6c'),'username':_0x45dc73,'sessionName':_0x2156d0[_0x2940('0x23')][_0x2940('0x6d')],'elementType':_0x2b72ea},'json':!![]};return rp(_0x3582b2);}})['then'](function(_0x15de66){if(_0x15de66[_0x2940('0x6b')]){var _0x14bd40=[_0x2940('0x6e'),_0x2940('0x6f'),_0x2940('0x70')];_[_0x2940('0x71')](_0x15de66[_0x2940('0x23')][_0x2940('0x3b')],function(_0x5162b2){return _0x14bd40[_0x2940('0x72')](_0x5162b2['type'][_0x2940('0x30')]);});_['remove'](_0x15de66[_0x2940('0x23')]['fields'],function(_0x1aeacf){return _0x1aeacf[_0x2940('0x73')]===_0x2940('0x74');});return{'count':_0x15de66['result']['fields'][_0x2940('0x3d')],'rows':_['map'](_0x15de66[_0x2940('0x23')][_0x2940('0x3b')],function(_0x2d1450){return{'id':_0x2d1450[_0x2940('0x30')],'name':_0x2d1450[_0x2940('0x75')],'custom':_[_0x2940('0x76')](_0x2d1450[_0x2940('0x30')],'cf_')?!![]:![],'options':_0x2d1450[_0x2940('0x35')][_0x2940('0x30')]==='picklist'&&_0x2d1450[_0x2940('0x35')][_0x2940('0x77')]['length']>0x0?_[_0x2940('0x33')](_0x2d1450[_0x2940('0x35')][_0x2940('0x77')],function(_0x2fe295){return{'name':_0x2fe295['label'],'value':_0x2fe295[_0x2940('0x78')]};}):[]};})};}})[_0x2940('0x1b')](respondWithResult(_0x5d4cfe,null))[_0x2940('0x4b')](function(_0x3ee6f1){console[_0x2940('0x79')](_0x2940('0x7a')+_0x3ee6f1);var _0x3ab2f1=_0x128aa9[_0x2940('0x39')][_0x2940('0x7b')]?0x1f4:_0x3ee6f1[_0x2940('0x7c')]||0x1f4;logger[_0x2940('0x20')](_0x2940('0x7d'),_0x2940('0x5d'),_0x3ab2f1,JSON[_0x2940('0x7e')](_0x3ee6f1));delete _0x3ee6f1[_0x2940('0x30')];if(_0x3ab2f1===0x191){_0x3ab2f1=0x190;}_0x5d4cfe['status'](_0x3ab2f1)[_0x2940('0x31')](_0x128aa9[_0x2940('0x39')]['test']?{'message':_0x2940('0x7f'),'statusCode':_0x3ee6f1['statusCode']}:_0x3ee6f1);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e58104d..1b904a1 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 _0x3626=['request-promise','path','rimraf','../../components/integrations/configuration','exports','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x454cbd,_0x436d19){var _0x45b4bf=function(_0x52241d){while(--_0x52241d){_0x454cbd['push'](_0x454cbd['shift']());}};_0x45b4bf(++_0x436d19);}(_0x3626,0x1c9));var _0x6362=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3626[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6362('0x0'));var util=require(_0x6362('0x1'));var logger=require(_0x6362('0x2'))('api');var moment=require(_0x6362('0x3'));var BPromise=require(_0x6362('0x4'));var rp=require(_0x6362('0x5'));var fs=require('fs');var path=require(_0x6362('0x6'));var rimraf=require(_0x6362('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x6362('0x8'));module[_0x6362('0x9')]=function(_0xfcc2f2,_0x509b5f){return _0xfcc2f2['define']('VtigerAccount',attributes,{'tableName':_0x6362('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb36e=['../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x12d099,_0x52bcaf){var _0x25b611=function(_0x5c3be8){while(--_0x5c3be8){_0x12d099['push'](_0x12d099['shift']());}};_0x25b611(++_0x52bcaf);}(_0xb36e,0x148));var _0xeb36=function(_0x29c7f3,_0x3a35c8){_0x29c7f3=_0x29c7f3-0x0;var _0x30eade=_0xb36e[_0x29c7f3];return _0x30eade;};'use strict';var _=require(_0xeb36('0x0'));var util=require(_0xeb36('0x1'));var logger=require(_0xeb36('0x2'))(_0xeb36('0x3'));var moment=require(_0xeb36('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb36('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb36('0x6'));var config=require(_0xeb36('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xeb36('0x8'));module[_0xeb36('0x9')]=function(_0x58e519,_0x4b0f67){return _0x58e519[_0xeb36('0xa')](_0xeb36('0xb'),attributes,{'tableName':'int_vtiger_accounts','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 67bc449..f1231ac 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 _0xf787=['find','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','VtigerAccount'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xf787,0x134));var _0x7f78=function(_0x564208,_0xc63d5a){_0x564208=_0x564208-0x0;var _0x4e379d=_0xf787[_0x564208];return _0x4e379d;};'use strict';var _=require(_0x7f78('0x0'));var util=require(_0x7f78('0x1'));var moment=require('moment');var BPromise=require(_0x7f78('0x2'));var rs=require(_0x7f78('0x3'));var fs=require('fs');var Redis=require(_0x7f78('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f78('0x5'));var logger=require(_0x7f78('0x6'))(_0x7f78('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7f78('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50f988,_0x483e5b,_0x1295d2){return new BPromise(function(_0x40000b,_0x5bd400){return client[_0x7f78('0x9')](_0x50f988,_0x1295d2)['then'](function(_0x205a9f){logger[_0x7f78('0xa')](_0x7f78('0xb'),_0x483e5b,_0x7f78('0xc'));logger[_0x7f78('0xd')](_0x7f78('0xe'),_0x483e5b,_0x7f78('0xc'),JSON['stringify'](_0x205a9f));if(_0x205a9f['error']){if(_0x205a9f[_0x7f78('0xf')][_0x7f78('0x10')]===0x1f4){logger[_0x7f78('0xf')](_0x7f78('0xb'),_0x483e5b,_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);return _0x5bd400(_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);}logger[_0x7f78('0xf')](_0x7f78('0xb'),_0x483e5b,_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);return _0x40000b(_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);}else{logger[_0x7f78('0xa')](_0x7f78('0xb'),_0x483e5b,_0x7f78('0xc'));_0x40000b(_0x205a9f[_0x7f78('0x12')]['message']);}})[_0x7f78('0x13')](function(_0x26deaf){logger[_0x7f78('0xf')](_0x7f78('0xb'),_0x483e5b,_0x26deaf);_0x5bd400(_0x26deaf);});});}exports[_0x7f78('0x14')]=function(_0x223bc1){var _0x3f6ea5=this;return new Promise(function(_0x3f9edd,_0x9d9d8d){return db['VtigerAccount']['findAll']({'raw':_0x223bc1[_0x7f78('0x15')]?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x16')]===undefined?!![]:![]:!![],'where':_0x223bc1['options']?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x17')]||null:null,'attributes':_0x223bc1[_0x7f78('0x15')]?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x18')]||null:null,'limit':_0x223bc1[_0x7f78('0x15')]?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x19')]||null:null,'include':_0x223bc1['options']?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x223bc1[_0x7f78('0x15')][_0x7f78('0x1a')],function(_0x1d4c56){return{'model':db[_0x1d4c56[_0x7f78('0x1c')]],'as':_0x1d4c56['as'],'attributes':_0x1d4c56[_0x7f78('0x18')],'include':_0x1d4c56[_0x7f78('0x1a')]?_['map'](_0x1d4c56['include'],function(_0x4d7a8e){return{'model':db[_0x4d7a8e[_0x7f78('0x1c')]],'as':_0x4d7a8e['as'],'attributes':_0x4d7a8e['attributes'],'include':_0x4d7a8e[_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x4d7a8e[_0x7f78('0x1a')],function(_0x922a1b){return{'model':db[_0x922a1b[_0x7f78('0x1c')]],'as':_0x922a1b['as'],'attributes':_0x922a1b[_0x7f78('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f78('0x1d')](function(_0x1981e1){logger[_0x7f78('0xa')](_0x7f78('0x14'),_0x223bc1);logger['debug']('GetVtigerAccount',_0x223bc1,JSON['stringify'](_0x1981e1));_0x3f9edd(_0x1981e1);})[_0x7f78('0x13')](function(_0x45f82e){logger[_0x7f78('0xf')]('GetVtigerAccount',_0x45f82e[_0x7f78('0x11')],_0x223bc1);_0x9d9d8d(_0x3f6ea5['error'](0x1f4,_0x45f82e[_0x7f78('0x11')]));});});};exports[_0x7f78('0x1e')]=function(_0x2f05cf){var _0x23a71e=this;return new Promise(function(_0x162070,_0x59ded4){return db[_0x7f78('0x1f')][_0x7f78('0x20')]({'raw':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf[_0x7f78('0x15')][_0x7f78('0x16')]===undefined?!![]:![]:!![],'where':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf[_0x7f78('0x15')][_0x7f78('0x17')]||null:null,'attributes':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf['options'][_0x7f78('0x18')]||null:null,'include':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf[_0x7f78('0x15')][_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x2f05cf[_0x7f78('0x15')]['include'],function(_0xe59a1e){return{'model':db[_0xe59a1e[_0x7f78('0x1c')]],'as':_0xe59a1e['as'],'attributes':_0xe59a1e['attributes'],'include':_0xe59a1e['include']?_[_0x7f78('0x1b')](_0xe59a1e[_0x7f78('0x1a')],function(_0x4a3837){return{'model':db[_0x4a3837[_0x7f78('0x1c')]],'as':_0x4a3837['as'],'attributes':_0x4a3837[_0x7f78('0x18')],'include':_0x4a3837[_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x4a3837[_0x7f78('0x1a')],function(_0x3278d0){return{'model':db[_0x3278d0['model']],'as':_0x3278d0['as'],'attributes':_0x3278d0[_0x7f78('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f78('0x1d')](function(_0x6dbc39){logger[_0x7f78('0xa')](_0x7f78('0x1e'),_0x2f05cf);logger[_0x7f78('0xd')]('ShowVtigerAccount',_0x2f05cf,JSON[_0x7f78('0x21')](_0x6dbc39));_0x162070(_0x6dbc39);})[_0x7f78('0x13')](function(_0x4d99d5){logger[_0x7f78('0xf')](_0x7f78('0x1e'),_0x4d99d5[_0x7f78('0x11')],_0x2f05cf);_0x59ded4(_0x23a71e[_0x7f78('0xf')](0x1f4,_0x4d99d5[_0x7f78('0x11')]));});});}; \ No newline at end of file +var _0x0e95=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','limit','map','include','model','attributes','catch','ShowVtigerAccount','raw','where'];(function(_0x4c4393,_0x39ab0e){var _0x1f5123=function(_0x3682bc){while(--_0x3682bc){_0x4c4393['push'](_0x4c4393['shift']());}};_0x1f5123(++_0x39ab0e);}(_0x0e95,0x88));var _0x50e9=function(_0x219367,_0x16c4a6){_0x219367=_0x219367-0x0;var _0x59682=_0x0e95[_0x219367];return _0x59682;};'use strict';var _=require(_0x50e9('0x0'));var util=require(_0x50e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50e9('0x2'));var db=require(_0x50e9('0x3'))['db'];var utils=require(_0x50e9('0x4'));var logger=require(_0x50e9('0x5'))(_0x50e9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x50e9('0x7')][_0x50e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f81e2,_0x1f6190,_0x445878){return new BPromise(function(_0x4da5c9,_0x43e8ad){return client[_0x50e9('0x9')](_0x4f81e2,_0x445878)[_0x50e9('0xa')](function(_0x343a02){logger[_0x50e9('0xb')](_0x50e9('0xc'),_0x1f6190,_0x50e9('0xd'));logger[_0x50e9('0xe')](_0x50e9('0xf'),_0x1f6190,'request\x20sent',JSON[_0x50e9('0x10')](_0x343a02));if(_0x343a02[_0x50e9('0x11')]){if(_0x343a02[_0x50e9('0x11')][_0x50e9('0x12')]===0x1f4){logger[_0x50e9('0x11')](_0x50e9('0xc'),_0x1f6190,_0x343a02['error'][_0x50e9('0x13')]);return _0x43e8ad(_0x343a02['error']['message']);}logger[_0x50e9('0x11')](_0x50e9('0xc'),_0x1f6190,_0x343a02['error'][_0x50e9('0x13')]);return _0x4da5c9(_0x343a02[_0x50e9('0x11')][_0x50e9('0x13')]);}else{logger[_0x50e9('0xb')](_0x50e9('0xc'),_0x1f6190,'request\x20sent');_0x4da5c9(_0x343a02[_0x50e9('0x14')]['message']);}})['catch'](function(_0x5a7031){logger[_0x50e9('0x11')](_0x50e9('0xc'),_0x1f6190,_0x5a7031);_0x43e8ad(_0x5a7031);});});}exports[_0x50e9('0x15')]=function(_0x2f3b1c){var _0x9a2cca=this;return new Promise(function(_0x4e600f,_0x2d009e){return db[_0x50e9('0x16')][_0x50e9('0x17')]({'raw':_0x2f3b1c[_0x50e9('0x18')]?_0x2f3b1c[_0x50e9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2f3b1c[_0x50e9('0x18')]?_0x2f3b1c[_0x50e9('0x18')]['where']||null:null,'attributes':_0x2f3b1c[_0x50e9('0x18')]?_0x2f3b1c[_0x50e9('0x18')]['attributes']||null:null,'limit':_0x2f3b1c[_0x50e9('0x18')]?_0x2f3b1c[_0x50e9('0x18')][_0x50e9('0x19')]||null:null,'include':_0x2f3b1c[_0x50e9('0x18')]?_0x2f3b1c[_0x50e9('0x18')]['include']?_[_0x50e9('0x1a')](_0x2f3b1c[_0x50e9('0x18')][_0x50e9('0x1b')],function(_0x196602){return{'model':db[_0x196602[_0x50e9('0x1c')]],'as':_0x196602['as'],'attributes':_0x196602['attributes'],'include':_0x196602[_0x50e9('0x1b')]?_['map'](_0x196602[_0x50e9('0x1b')],function(_0x4f4b5e){return{'model':db[_0x4f4b5e[_0x50e9('0x1c')]],'as':_0x4f4b5e['as'],'attributes':_0x4f4b5e[_0x50e9('0x1d')],'include':_0x4f4b5e[_0x50e9('0x1b')]?_[_0x50e9('0x1a')](_0x4f4b5e[_0x50e9('0x1b')],function(_0x2952dd){return{'model':db[_0x2952dd[_0x50e9('0x1c')]],'as':_0x2952dd['as'],'attributes':_0x2952dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x50e9('0xa')](function(_0x14adff){logger[_0x50e9('0xb')](_0x50e9('0x15'),_0x2f3b1c);logger['debug'](_0x50e9('0x15'),_0x2f3b1c,JSON['stringify'](_0x14adff));_0x4e600f(_0x14adff);})[_0x50e9('0x1e')](function(_0x383cfc){logger[_0x50e9('0x11')](_0x50e9('0x15'),_0x383cfc[_0x50e9('0x13')],_0x2f3b1c);_0x2d009e(_0x9a2cca['error'](0x1f4,_0x383cfc[_0x50e9('0x13')]));});});};exports[_0x50e9('0x1f')]=function(_0x31157f){var _0x53eb01=this;return new Promise(function(_0x4ed246,_0x3423db){return db[_0x50e9('0x16')]['find']({'raw':_0x31157f[_0x50e9('0x18')]?_0x31157f['options'][_0x50e9('0x20')]===undefined?!![]:![]:!![],'where':_0x31157f[_0x50e9('0x18')]?_0x31157f[_0x50e9('0x18')][_0x50e9('0x21')]||null:null,'attributes':_0x31157f[_0x50e9('0x18')]?_0x31157f[_0x50e9('0x18')]['attributes']||null:null,'include':_0x31157f['options']?_0x31157f[_0x50e9('0x18')]['include']?_[_0x50e9('0x1a')](_0x31157f[_0x50e9('0x18')][_0x50e9('0x1b')],function(_0x196d52){return{'model':db[_0x196d52['model']],'as':_0x196d52['as'],'attributes':_0x196d52['attributes'],'include':_0x196d52['include']?_[_0x50e9('0x1a')](_0x196d52['include'],function(_0x26b3ac){return{'model':db[_0x26b3ac[_0x50e9('0x1c')]],'as':_0x26b3ac['as'],'attributes':_0x26b3ac[_0x50e9('0x1d')],'include':_0x26b3ac[_0x50e9('0x1b')]?_[_0x50e9('0x1a')](_0x26b3ac[_0x50e9('0x1b')],function(_0x5e3bc3){return{'model':db[_0x5e3bc3[_0x50e9('0x1c')]],'as':_0x5e3bc3['as'],'attributes':_0x5e3bc3[_0x50e9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50e9('0xa')](function(_0x3d46c4){logger[_0x50e9('0xb')](_0x50e9('0x1f'),_0x31157f);logger[_0x50e9('0xe')](_0x50e9('0x1f'),_0x31157f,JSON['stringify'](_0x3d46c4));_0x4ed246(_0x3d46c4);})[_0x50e9('0x1e')](function(_0x40aa18){logger[_0x50e9('0x11')](_0x50e9('0x1f'),_0x40aa18[_0x50e9('0x13')],_0x31157f);_0x3423db(_0x53eb01[_0x50e9('0x11')](0x1f4,_0x40aa18[_0x50e9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 9409d02..59788e3 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x527016,_0xa80812){var _0x5210bc=function(_0x3f1289){while(--_0x3f1289){_0x527016['push'](_0x527016['shift']());}};_0x5210bc(++_0xa80812);}(_0x5f2f,0x73));var _0xf5f2=function(_0x440d2a,_0x23070a){_0x440d2a=_0x440d2a-0x0;var _0x2bbe8c=_0x5f2f[_0x440d2a];return _0x2bbe8c;};'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('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('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(_0x1af8d3,_0x544d86){var _0x3a50c5=function(_0x4179aa){while(--_0x4179aa){_0x1af8d3['push'](_0x1af8d3['shift']());}};_0x3a50c5(++_0x544d86);}(_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 71491d9..e8f06f5 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 _0x036a=['sequelize','exports','STRING'];(function(_0x1de0b9,_0xc6f046){var _0x18edae=function(_0x2d3ad1){while(--_0x2d3ad1){_0x1de0b9['push'](_0x1de0b9['shift']());}};_0x18edae(++_0xc6f046);}(_0x036a,0x17d));var _0xa036=function(_0x12118a,_0x111eae){_0x12118a=_0x12118a-0x0;var _0x36d11e=_0x036a[_0x12118a];return _0x36d11e;};'use strict';var Sequelize=require(_0xa036('0x0'));module[_0xa036('0x1')]={'name':{'type':Sequelize[_0xa036('0x2')]},'description':{'type':Sequelize[_0xa036('0x2')]}}; \ No newline at end of file +var _0xa5b5=['STRING'];(function(_0xde5894,_0x49b5fc){var _0x11ddb7=function(_0x52d097){while(--_0x52d097){_0xde5894['push'](_0xde5894['shift']());}};_0x11ddb7(++_0x49b5fc);}(_0xa5b5,0x195));var _0x5a5b=function(_0x2e7661,_0x957689){_0x2e7661=_0x2e7661-0x0;var _0x5ece3e=_0xa5b5[_0x2e7661];return _0x5ece3e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5a5b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2022491..8944b9f 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 _0x1dc2=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','VtigerConfiguration','includeAll','include','rows','params','keys','find','create','body','getFields','findOne','pick','hasOwnProperty','getSubjects','VtigerField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x2346c7,_0x35bbcc){var _0x20a6e4=function(_0x4476cf){while(--_0x4476cf){_0x2346c7['push'](_0x2346c7['shift']());}};_0x20a6e4(++_0x35bbcc);}(_0x1dc2,0xb0));var _0x21dc=function(_0x46ed0f,_0xab0142){_0x46ed0f=_0x46ed0f-0x0;var _0x4fcd95=_0x1dc2[_0x46ed0f];return _0x4fcd95;};'use strict';var pdf=require(_0x21dc('0x0'));var emlformat=require(_0x21dc('0x1'));var rimraf=require(_0x21dc('0x2'));var zipdir=require(_0x21dc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21dc('0x4'));var moment=require(_0x21dc('0x5'));var BPromise=require(_0x21dc('0x6'));var Mustache=require(_0x21dc('0x7'));var util=require(_0x21dc('0x8'));var path=require(_0x21dc('0x9'));var sox=require(_0x21dc('0xa'));var csv=require(_0x21dc('0xb'));var ejs=require(_0x21dc('0xc'));var fs=require('fs');var _=require(_0x21dc('0xd'));var squel=require('squel');var crypto=require(_0x21dc('0xe'));var jsforce=require(_0x21dc('0xf'));var deskjs=require(_0x21dc('0x10'));var toCsv=require(_0x21dc('0xb'));var querystring=require(_0x21dc('0x11'));var Papa=require(_0x21dc('0x12'));var Redis=require(_0x21dc('0x13'));var authService=require(_0x21dc('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x21dc('0x15'));var hardwareService=require(_0x21dc('0x16'));var logger=require(_0x21dc('0x17'))(_0x21dc('0x18'));var utils=require(_0x21dc('0x19'));var config=require(_0x21dc('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x21dc('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x21dc('0x1c')][_0x21dc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4e7e25,_0xf43d7f,_0x21ab65,_0x26b1b2){return new BPromise(function(_0x24574c,_0x15ff38){var _0x5c26d3=_0x26b1b2||client;return _0x5c26d3[_0x21dc('0x1e')](_0x4e7e25,_0x21ab65)[_0x21dc('0x1f')](function(_0x32d7c1){logger[_0x21dc('0x20')](_0x21dc('0x21'),_0xf43d7f,_0x21dc('0x22'));logger[_0x21dc('0x23')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xf43d7f,_0x21dc('0x22'),JSON[_0x21dc('0x24')](_0x32d7c1));if(_0x32d7c1[_0x21dc('0x25')]){if(_0x32d7c1[_0x21dc('0x25')]['code']===0x1f4){logger[_0x21dc('0x25')](_0x21dc('0x21'),_0xf43d7f,_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);return _0x15ff38(_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);}logger[_0x21dc('0x25')](_0x21dc('0x21'),_0xf43d7f,_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);return _0x24574c(_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);}else{logger[_0x21dc('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0xf43d7f,_0x21dc('0x22'));_0x24574c(_0x32d7c1['result'][_0x21dc('0x26')]);}})[_0x21dc('0x27')](function(_0x1868cf){logger[_0x21dc('0x25')]('VtigerConfiguration,\x20%s,\x20%s',_0xf43d7f,_0x1868cf);_0x15ff38(_0x1868cf);});});}function respondWithStatusCode(_0x4b41bc,_0x42126d){_0x42126d=_0x42126d||0xcc;return function(_0x8350f4){if(_0x8350f4){return _0x4b41bc['sendStatus'](_0x42126d);}return _0x4b41bc[_0x21dc('0x28')](_0x42126d)['end']();};}function respondWithResult(_0x49cdb1,_0x44b656){_0x44b656=_0x44b656||0xc8;return function(_0x211d87){if(_0x211d87){return _0x49cdb1[_0x21dc('0x28')](_0x44b656)[_0x21dc('0x29')](_0x211d87);}};}function respondWithFilteredResult(_0x45075f,_0x474ee0){return function(_0x2b0cb2){if(_0x2b0cb2){var _0x22f676=_0x2b0cb2[_0x21dc('0x2a')],_0x552239=_0x474ee0[_0x21dc('0x2b')],_0x17e98c=_0x474ee0[_0x21dc('0x2b')]+_0x474ee0[_0x21dc('0x2c')],_0x3ed251;if(_0x17e98c>=_0x22f676){_0x17e98c=_0x22f676;_0x3ed251=0xc8;}else{_0x3ed251=0xce;}_0x45075f[_0x21dc('0x28')](_0x3ed251);return _0x45075f[_0x21dc('0x2d')](_0x21dc('0x2e'),_0x552239+'-'+_0x17e98c+'/'+_0x22f676)[_0x21dc('0x29')](_0x2b0cb2);}return null;};}function patchUpdates(_0x490678){return function(_0x96e227){try{jsonpatch[_0x21dc('0x2f')](_0x96e227,_0x490678,!![]);}catch(_0x3ce0d5){return BPromise[_0x21dc('0x30')](_0x3ce0d5);}return _0x96e227[_0x21dc('0x31')]();};}function saveUpdates(_0x33652d,_0x4c21e6){return function(_0x43f74){if(_0x43f74){return _0x43f74[_0x21dc('0x32')](_0x33652d)[_0x21dc('0x1f')](function(_0x199d68){return _0x199d68;});}return null;};}function removeEntity(_0x119af3,_0x4d12d1){return function(_0x5b379f){if(_0x5b379f){return _0x5b379f[_0x21dc('0x33')]()['then'](function(){_0x119af3[_0x21dc('0x28')](0xcc)[_0x21dc('0x34')]();});}};}function handleEntityNotFound(_0x34aaf5,_0x52c1e9){return function(_0x18dd8c){if(!_0x18dd8c){_0x34aaf5['sendStatus'](0x194);}return _0x18dd8c;};}function handleError(_0x16b1b8,_0x201ecd){_0x201ecd=_0x201ecd||0x1f4;return function(_0x60fc6){logger[_0x21dc('0x25')](_0x60fc6[_0x21dc('0x35')]);if(_0x60fc6[_0x21dc('0x36')]){delete _0x60fc6[_0x21dc('0x36')];}_0x16b1b8[_0x21dc('0x28')](_0x201ecd)[_0x21dc('0x37')](_0x60fc6);};}exports[_0x21dc('0x38')]=function(_0x1fcc8b,_0x5388a0){var _0x16259f={},_0x490986={},_0x2ddbca={'count':0x0,'rows':[]};var _0x139ad6=_[_0x21dc('0x39')](db['VtigerConfiguration'][_0x21dc('0x3a')],function(_0x1f1bb2){return{'name':_0x1f1bb2[_0x21dc('0x3b')],'type':_0x1f1bb2['type']['key']};});_0x490986[_0x21dc('0x3c')]=_[_0x21dc('0x39')](_0x139ad6,_0x21dc('0x36'));_0x490986['query']=_['keys'](_0x1fcc8b[_0x21dc('0x3d')]);_0x490986[_0x21dc('0x3e')]=_[_0x21dc('0x3f')](_0x490986['model'],_0x490986['query']);_0x16259f['attributes']=_['intersection'](_0x490986[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x40')]));_0x16259f['attributes']=_0x16259f[_0x21dc('0x41')][_0x21dc('0x42')]?_0x16259f['attributes']:_0x490986[_0x21dc('0x3c')];if(!_0x1fcc8b[_0x21dc('0x3d')]['hasOwnProperty'](_0x21dc('0x43'))){_0x16259f[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x2c')]);_0x16259f['offset']=qs[_0x21dc('0x2b')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x2b')]);}_0x16259f[_0x21dc('0x44')]=qs[_0x21dc('0x45')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x45')]);_0x16259f['where']=qs[_0x21dc('0x3e')](_['pick'](_0x1fcc8b[_0x21dc('0x3d')],_0x490986[_0x21dc('0x3e')]),_0x139ad6);if(_0x1fcc8b[_0x21dc('0x3d')]['filter']){_0x16259f[_0x21dc('0x46')]=_[_0x21dc('0x47')](_0x16259f[_0x21dc('0x46')],{'$or':_[_0x21dc('0x39')](_0x139ad6,function(_0x35f077){if(_0x35f077[_0x21dc('0x48')]!==_0x21dc('0x49')){var _0x1cc951={};_0x1cc951[_0x35f077[_0x21dc('0x36')]]={'$like':'%'+_0x1fcc8b['query'][_0x21dc('0x4a')]+'%'};return _0x1cc951;}})});}_0x16259f=_[_0x21dc('0x47')]({},_0x16259f,_0x1fcc8b[_0x21dc('0x4b')]);var _0x102754={'where':_0x16259f[_0x21dc('0x46')]};return db[_0x21dc('0x4c')]['count'](_0x102754)[_0x21dc('0x1f')](function(_0x49add3){_0x2ddbca[_0x21dc('0x2a')]=_0x49add3;if(_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x4d')]){_0x16259f[_0x21dc('0x4e')]=[{'all':!![]}];}return db[_0x21dc('0x4c')]['findAll'](_0x16259f);})[_0x21dc('0x1f')](function(_0x5f59c){_0x2ddbca[_0x21dc('0x4f')]=_0x5f59c;return _0x2ddbca;})[_0x21dc('0x1f')](respondWithFilteredResult(_0x5388a0,_0x16259f))['catch'](handleError(_0x5388a0,null));};exports['show']=function(_0x22a846,_0x2dd0f7){var _0x24c50={'raw':![],'where':{'id':_0x22a846[_0x21dc('0x50')]['id']}},_0x36f3f5={};_0x36f3f5[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db[_0x21dc('0x4c')][_0x21dc('0x3a')]);_0x36f3f5[_0x21dc('0x3d')]=_[_0x21dc('0x51')](_0x22a846[_0x21dc('0x3d')]);_0x36f3f5[_0x21dc('0x3e')]=_[_0x21dc('0x3f')](_0x36f3f5[_0x21dc('0x3c')],_0x36f3f5[_0x21dc('0x3d')]);_0x24c50[_0x21dc('0x41')]=_[_0x21dc('0x3f')](_0x36f3f5[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0x22a846['query'][_0x21dc('0x40')]));_0x24c50[_0x21dc('0x41')]=_0x24c50[_0x21dc('0x41')][_0x21dc('0x42')]?_0x24c50[_0x21dc('0x41')]:_0x36f3f5[_0x21dc('0x3c')];if(_0x22a846[_0x21dc('0x3d')][_0x21dc('0x4d')]){_0x24c50[_0x21dc('0x4e')]=[{'all':!![]}];}_0x24c50=_[_0x21dc('0x47')]({},_0x24c50,_0x22a846['options']);return db[_0x21dc('0x4c')][_0x21dc('0x52')](_0x24c50)[_0x21dc('0x1f')](handleEntityNotFound(_0x2dd0f7,null))[_0x21dc('0x1f')](respondWithResult(_0x2dd0f7,null))['catch'](handleError(_0x2dd0f7,null));};exports[_0x21dc('0x53')]=function(_0x8c393,_0x5495d1){return db[_0x21dc('0x4c')]['create'](_0x8c393[_0x21dc('0x54')],{})['then'](respondWithResult(_0x5495d1,0xc9))['catch'](handleError(_0x5495d1,null));};exports['update']=function(_0x1219c6,_0x5127c8){if(_0x1219c6[_0x21dc('0x54')]['id']){delete _0x1219c6[_0x21dc('0x54')]['id'];}return db[_0x21dc('0x4c')][_0x21dc('0x52')]({'where':{'id':_0x1219c6[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x5127c8,null))[_0x21dc('0x1f')](saveUpdates(_0x1219c6['body'],null))[_0x21dc('0x1f')](respondWithResult(_0x5127c8,null))['catch'](handleError(_0x5127c8,null));};exports[_0x21dc('0x33')]=function(_0x2550e8,_0x5b581f){return db['VtigerConfiguration'][_0x21dc('0x52')]({'where':{'id':_0x2550e8[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x5b581f,null))[_0x21dc('0x1f')](removeEntity(_0x5b581f,null))[_0x21dc('0x27')](handleError(_0x5b581f,null));};exports[_0x21dc('0x55')]=function(_0xc81fdf,_0x4b8c63,_0x464315){var _0x393bfc={};var _0x39e24e={};var _0x4480cf;var _0x3d34f8;return db['VtigerConfiguration'][_0x21dc('0x56')]({'where':{'id':_0xc81fdf[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x4b8c63,null))['then'](function(_0x4cba21){if(_0x4cba21){_0x4480cf=_0x4cba21;_0x39e24e[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db['VtigerField'][_0x21dc('0x3a')]);_0x39e24e[_0x21dc('0x3d')]=_[_0x21dc('0x51')](_0xc81fdf[_0x21dc('0x3d')]);_0x39e24e[_0x21dc('0x3e')]=_[_0x21dc('0x3f')](_0x39e24e[_0x21dc('0x3c')],_0x39e24e[_0x21dc('0x3d')]);_0x393bfc[_0x21dc('0x41')]=_[_0x21dc('0x3f')](_0x39e24e[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0xc81fdf['query'][_0x21dc('0x40')]));_0x393bfc[_0x21dc('0x41')]=_0x393bfc[_0x21dc('0x41')][_0x21dc('0x42')]?_0x393bfc[_0x21dc('0x41')]:_0x39e24e[_0x21dc('0x3c')];_0x393bfc[_0x21dc('0x44')]=qs[_0x21dc('0x45')](_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x45')]);_0x393bfc[_0x21dc('0x46')]=qs[_0x21dc('0x3e')](_[_0x21dc('0x57')](_0xc81fdf[_0x21dc('0x3d')],_0x39e24e[_0x21dc('0x3e')]));if(_0xc81fdf['query']['filter']){_0x393bfc[_0x21dc('0x46')]=_['merge'](_0x393bfc[_0x21dc('0x46')],{'$or':_['map'](_0x393bfc[_0x21dc('0x41')],function(_0x22bed8){var _0x88ac4c={};_0x88ac4c[_0x22bed8]={'$like':'%'+_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x4a')]+'%'};return _0x88ac4c;})});}_0x393bfc=_[_0x21dc('0x47')]({},_0x393bfc,_0xc81fdf[_0x21dc('0x4b')]);return _0x4480cf['getFields'](_0x393bfc);}})['then'](function(_0x31f935){if(_0x31f935){_0x3d34f8=_0x31f935[_0x21dc('0x42')];if(!_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x58')]('nolimit')){_0x393bfc[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x2c')]);_0x393bfc[_0x21dc('0x2b')]=qs[_0x21dc('0x2b')](_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x2b')]);}return _0x4480cf[_0x21dc('0x55')](_0x393bfc);}})[_0x21dc('0x1f')](function(_0x24b785){if(_0x24b785){return _0x24b785?{'count':_0x3d34f8,'rows':_0x24b785}:null;}})['then'](respondWithResult(_0x4b8c63,null))[_0x21dc('0x27')](handleError(_0x4b8c63,null));};exports[_0x21dc('0x59')]=function(_0x37de58,_0x531734,_0x4ae123){var _0x14c5f0={};var _0x19084a={};var _0x4dc4c1;var _0x627480;return db['VtigerConfiguration'][_0x21dc('0x56')]({'where':{'id':_0x37de58[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x531734,null))[_0x21dc('0x1f')](function(_0x5f39bd){if(_0x5f39bd){_0x4dc4c1=_0x5f39bd;_0x19084a[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db[_0x21dc('0x5a')][_0x21dc('0x3a')]);_0x19084a['query']=_[_0x21dc('0x51')](_0x37de58[_0x21dc('0x3d')]);_0x19084a[_0x21dc('0x3e')]=_['intersection'](_0x19084a['model'],_0x19084a[_0x21dc('0x3d')]);_0x14c5f0[_0x21dc('0x41')]=_[_0x21dc('0x3f')](_0x19084a[_0x21dc('0x3c')],qs['fields'](_0x37de58[_0x21dc('0x3d')]['fields']));_0x14c5f0['attributes']=_0x14c5f0[_0x21dc('0x41')]['length']?_0x14c5f0[_0x21dc('0x41')]:_0x19084a[_0x21dc('0x3c')];_0x14c5f0[_0x21dc('0x44')]=qs['sort'](_0x37de58['query'][_0x21dc('0x45')]);_0x14c5f0['where']=qs[_0x21dc('0x3e')](_[_0x21dc('0x57')](_0x37de58[_0x21dc('0x3d')],_0x19084a['filters']));if(_0x37de58[_0x21dc('0x3d')][_0x21dc('0x4a')]){_0x14c5f0[_0x21dc('0x46')]=_[_0x21dc('0x47')](_0x14c5f0[_0x21dc('0x46')],{'$or':_[_0x21dc('0x39')](_0x14c5f0['attributes'],function(_0x201d57){var _0x31700f={};_0x31700f[_0x201d57]={'$like':'%'+_0x37de58['query'][_0x21dc('0x4a')]+'%'};return _0x31700f;})});}_0x14c5f0=_[_0x21dc('0x47')]({},_0x14c5f0,_0x37de58['options']);return _0x4dc4c1[_0x21dc('0x59')](_0x14c5f0);}})[_0x21dc('0x1f')](function(_0x5329dd){if(_0x5329dd){_0x627480=_0x5329dd[_0x21dc('0x42')];if(!_0x37de58[_0x21dc('0x3d')][_0x21dc('0x58')](_0x21dc('0x43'))){_0x14c5f0[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0x37de58[_0x21dc('0x3d')][_0x21dc('0x2c')]);_0x14c5f0[_0x21dc('0x2b')]=qs['offset'](_0x37de58[_0x21dc('0x3d')]['offset']);}return _0x4dc4c1[_0x21dc('0x59')](_0x14c5f0);}})['then'](function(_0x26edbb){if(_0x26edbb){return _0x26edbb?{'count':_0x627480,'rows':_0x26edbb}:null;}})[_0x21dc('0x1f')](respondWithResult(_0x531734,null))[_0x21dc('0x27')](handleError(_0x531734,null));};exports[_0x21dc('0x5b')]=function(_0x2e9113,_0x1e51f1,_0x139fad){var _0x1a903c={};var _0x41c59d={};var _0x2f200a;var _0x18ae64;return db[_0x21dc('0x4c')][_0x21dc('0x56')]({'where':{'id':_0x2e9113[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x1e51f1,null))['then'](function(_0x4189f9){if(_0x4189f9){_0x2f200a=_0x4189f9;_0x41c59d[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db[_0x21dc('0x5a')][_0x21dc('0x3a')]);_0x41c59d[_0x21dc('0x3d')]=_[_0x21dc('0x51')](_0x2e9113[_0x21dc('0x3d')]);_0x41c59d['filters']=_[_0x21dc('0x3f')](_0x41c59d[_0x21dc('0x3c')],_0x41c59d[_0x21dc('0x3d')]);_0x1a903c['attributes']=_[_0x21dc('0x3f')](_0x41c59d[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0x2e9113[_0x21dc('0x3d')][_0x21dc('0x40')]));_0x1a903c[_0x21dc('0x41')]=_0x1a903c[_0x21dc('0x41')]['length']?_0x1a903c['attributes']:_0x41c59d[_0x21dc('0x3c')];_0x1a903c['order']=qs[_0x21dc('0x45')](_0x2e9113[_0x21dc('0x3d')][_0x21dc('0x45')]);_0x1a903c['where']=qs[_0x21dc('0x3e')](_[_0x21dc('0x57')](_0x2e9113['query'],_0x41c59d[_0x21dc('0x3e')]));if(_0x2e9113[_0x21dc('0x3d')][_0x21dc('0x4a')]){_0x1a903c['where']=_[_0x21dc('0x47')](_0x1a903c[_0x21dc('0x46')],{'$or':_[_0x21dc('0x39')](_0x1a903c[_0x21dc('0x41')],function(_0x26d096){var _0x30c697={};_0x30c697[_0x26d096]={'$like':'%'+_0x2e9113['query'][_0x21dc('0x4a')]+'%'};return _0x30c697;})});}_0x1a903c=_[_0x21dc('0x47')]({},_0x1a903c,_0x2e9113[_0x21dc('0x4b')]);return _0x2f200a[_0x21dc('0x5b')](_0x1a903c);}})[_0x21dc('0x1f')](function(_0x4cf66b){if(_0x4cf66b){_0x18ae64=_0x4cf66b['length'];if(!_0x2e9113['query'][_0x21dc('0x58')]('nolimit')){_0x1a903c[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0x2e9113[_0x21dc('0x3d')]['limit']);_0x1a903c[_0x21dc('0x2b')]=qs[_0x21dc('0x2b')](_0x2e9113['query']['offset']);}return _0x2f200a['getDescriptions'](_0x1a903c);}})[_0x21dc('0x1f')](function(_0x20474a){if(_0x20474a){return _0x20474a?{'count':_0x18ae64,'rows':_0x20474a}:null;}})[_0x21dc('0x1f')](respondWithResult(_0x1e51f1,null))[_0x21dc('0x27')](handleError(_0x1e51f1,null));}; \ No newline at end of file +var _0xbfd9=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','name','send','index','VtigerConfiguration','rawAttributes','fieldName','key','model','map','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','intersection','create','body','find','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xbfd9,0x110));var _0x9bfd=function(_0x549449,_0x322df5){_0x549449=_0x549449-0x0;var _0x437444=_0xbfd9[_0x549449];return _0x437444;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9bfd('0x0'));var rimraf=require(_0x9bfd('0x1'));var zipdir=require(_0x9bfd('0x2'));var jsonpatch=require(_0x9bfd('0x3'));var rp=require(_0x9bfd('0x4'));var moment=require(_0x9bfd('0x5'));var BPromise=require(_0x9bfd('0x6'));var Mustache=require(_0x9bfd('0x7'));var util=require(_0x9bfd('0x8'));var path=require(_0x9bfd('0x9'));var sox=require(_0x9bfd('0xa'));var csv=require('to-csv');var ejs=require(_0x9bfd('0xb'));var fs=require('fs');var _=require(_0x9bfd('0xc'));var squel=require(_0x9bfd('0xd'));var crypto=require(_0x9bfd('0xe'));var jsforce=require(_0x9bfd('0xf'));var deskjs=require(_0x9bfd('0x10'));var toCsv=require(_0x9bfd('0x11'));var querystring=require(_0x9bfd('0x12'));var Papa=require(_0x9bfd('0x13'));var Redis=require(_0x9bfd('0x14'));var authService=require(_0x9bfd('0x15'));var qs=require(_0x9bfd('0x16'));var as=require(_0x9bfd('0x17'));var hardwareService=require(_0x9bfd('0x18'));var logger=require(_0x9bfd('0x19'))('api');var utils=require(_0x9bfd('0x1a'));var config=require(_0x9bfd('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9bfd('0x1c'))['db'];var jayson=require(_0x9bfd('0x1d'));var client=jayson[_0x9bfd('0x1e')][_0x9bfd('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2ec1a8,_0x3efc96,_0x52c4c5,_0x553b2f){return new BPromise(function(_0x52c2b1,_0x54bab1){var _0x13841a=_0x553b2f||client;return _0x13841a['request'](_0x2ec1a8,_0x52c4c5)[_0x9bfd('0x20')](function(_0x5cebb6){logger[_0x9bfd('0x21')](_0x9bfd('0x22'),_0x3efc96,_0x9bfd('0x23'));logger[_0x9bfd('0x24')](_0x9bfd('0x25'),_0x3efc96,_0x9bfd('0x23'),JSON[_0x9bfd('0x26')](_0x5cebb6));if(_0x5cebb6[_0x9bfd('0x27')]){if(_0x5cebb6['error'][_0x9bfd('0x28')]===0x1f4){logger['error'](_0x9bfd('0x22'),_0x3efc96,_0x5cebb6[_0x9bfd('0x27')][_0x9bfd('0x29')]);return _0x54bab1(_0x5cebb6[_0x9bfd('0x27')][_0x9bfd('0x29')]);}logger[_0x9bfd('0x27')](_0x9bfd('0x22'),_0x3efc96,_0x5cebb6[_0x9bfd('0x27')][_0x9bfd('0x29')]);return _0x52c2b1(_0x5cebb6['error']['message']);}else{logger[_0x9bfd('0x21')](_0x9bfd('0x22'),_0x3efc96,'request\x20sent');_0x52c2b1(_0x5cebb6['result'][_0x9bfd('0x29')]);}})[_0x9bfd('0x2a')](function(_0x5bb489){logger[_0x9bfd('0x27')](_0x9bfd('0x22'),_0x3efc96,_0x5bb489);_0x54bab1(_0x5bb489);});});}function respondWithStatusCode(_0xe3ad2e,_0x3da0fe){_0x3da0fe=_0x3da0fe||0xcc;return function(_0x27272c){if(_0x27272c){return _0xe3ad2e[_0x9bfd('0x2b')](_0x3da0fe);}return _0xe3ad2e[_0x9bfd('0x2c')](_0x3da0fe)[_0x9bfd('0x2d')]();};}function respondWithResult(_0x51dbf0,_0x26278c){_0x26278c=_0x26278c||0xc8;return function(_0x5304a6){if(_0x5304a6){return _0x51dbf0[_0x9bfd('0x2c')](_0x26278c)[_0x9bfd('0x2e')](_0x5304a6);}};}function respondWithFilteredResult(_0x5cb9ab,_0x4391e0){return function(_0x25b7b1){if(_0x25b7b1){var _0x4e64cf=_0x25b7b1[_0x9bfd('0x2f')],_0x560156=_0x4391e0[_0x9bfd('0x30')],_0x352bed=_0x4391e0[_0x9bfd('0x30')]+_0x4391e0[_0x9bfd('0x31')],_0x10c55c;if(_0x352bed>=_0x4e64cf){_0x352bed=_0x4e64cf;_0x10c55c=0xc8;}else{_0x10c55c=0xce;}_0x5cb9ab[_0x9bfd('0x2c')](_0x10c55c);return _0x5cb9ab['set'](_0x9bfd('0x32'),_0x560156+'-'+_0x352bed+'/'+_0x4e64cf)['json'](_0x25b7b1);}return null;};}function patchUpdates(_0x390a9c){return function(_0x2ff4aa){try{jsonpatch['apply'](_0x2ff4aa,_0x390a9c,!![]);}catch(_0x48a255){return BPromise[_0x9bfd('0x33')](_0x48a255);}return _0x2ff4aa[_0x9bfd('0x34')]();};}function saveUpdates(_0x553cbf,_0x2aff04){return function(_0x44b27f){if(_0x44b27f){return _0x44b27f[_0x9bfd('0x35')](_0x553cbf)['then'](function(_0x211cad){return _0x211cad;});}return null;};}function removeEntity(_0x3d6d50,_0x3dac29){return function(_0x5c386e){if(_0x5c386e){return _0x5c386e['destroy']()['then'](function(){_0x3d6d50[_0x9bfd('0x2c')](0xcc)[_0x9bfd('0x2d')]();});}};}function handleEntityNotFound(_0x3cecae,_0x22a73f){return function(_0xc12fdd){if(!_0xc12fdd){_0x3cecae[_0x9bfd('0x2b')](0x194);}return _0xc12fdd;};}function handleError(_0x2f762f,_0x159a33){_0x159a33=_0x159a33||0x1f4;return function(_0x58ba70){logger['error'](_0x58ba70['stack']);if(_0x58ba70[_0x9bfd('0x36')]){delete _0x58ba70['name'];}_0x2f762f[_0x9bfd('0x2c')](_0x159a33)[_0x9bfd('0x37')](_0x58ba70);};}exports[_0x9bfd('0x38')]=function(_0x43313f,_0x2a235d){var _0x20453a={},_0x5b0fb9={},_0x43f140={'count':0x0,'rows':[]};var _0x15dbcf=_['map'](db[_0x9bfd('0x39')][_0x9bfd('0x3a')],function(_0x18d998){return{'name':_0x18d998[_0x9bfd('0x3b')],'type':_0x18d998['type'][_0x9bfd('0x3c')]};});_0x5b0fb9[_0x9bfd('0x3d')]=_[_0x9bfd('0x3e')](_0x15dbcf,'name');_0x5b0fb9['query']=_[_0x9bfd('0x3f')](_0x43313f[_0x9bfd('0x40')]);_0x5b0fb9['filters']=_['intersection'](_0x5b0fb9[_0x9bfd('0x3d')],_0x5b0fb9['query']);_0x20453a[_0x9bfd('0x41')]=_['intersection'](_0x5b0fb9[_0x9bfd('0x3d')],qs[_0x9bfd('0x42')](_0x43313f[_0x9bfd('0x40')][_0x9bfd('0x42')]));_0x20453a['attributes']=_0x20453a[_0x9bfd('0x41')][_0x9bfd('0x43')]?_0x20453a[_0x9bfd('0x41')]:_0x5b0fb9[_0x9bfd('0x3d')];if(!_0x43313f['query'][_0x9bfd('0x44')](_0x9bfd('0x45'))){_0x20453a[_0x9bfd('0x31')]=qs[_0x9bfd('0x31')](_0x43313f[_0x9bfd('0x40')][_0x9bfd('0x31')]);_0x20453a[_0x9bfd('0x30')]=qs['offset'](_0x43313f[_0x9bfd('0x40')]['offset']);}_0x20453a[_0x9bfd('0x46')]=qs[_0x9bfd('0x47')](_0x43313f['query']['sort']);_0x20453a[_0x9bfd('0x48')]=qs['filters'](_[_0x9bfd('0x49')](_0x43313f[_0x9bfd('0x40')],_0x5b0fb9[_0x9bfd('0x4a')]),_0x15dbcf);if(_0x43313f['query'][_0x9bfd('0x4b')]){_0x20453a['where']=_['merge'](_0x20453a[_0x9bfd('0x48')],{'$or':_[_0x9bfd('0x3e')](_0x15dbcf,function(_0x194811){if(_0x194811['type']!==_0x9bfd('0x4c')){var _0x573566={};_0x573566[_0x194811['name']]={'$like':'%'+_0x43313f[_0x9bfd('0x40')][_0x9bfd('0x4b')]+'%'};return _0x573566;}})});}_0x20453a=_[_0x9bfd('0x4d')]({},_0x20453a,_0x43313f[_0x9bfd('0x4e')]);var _0x30f066={'where':_0x20453a[_0x9bfd('0x48')]};return db[_0x9bfd('0x39')]['count'](_0x30f066)[_0x9bfd('0x20')](function(_0x4a9075){_0x43f140['count']=_0x4a9075;if(_0x43313f['query'][_0x9bfd('0x4f')]){_0x20453a[_0x9bfd('0x50')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x9bfd('0x51')](_0x20453a);})[_0x9bfd('0x20')](function(_0x26e846){_0x43f140['rows']=_0x26e846;return _0x43f140;})[_0x9bfd('0x20')](respondWithFilteredResult(_0x2a235d,_0x20453a))['catch'](handleError(_0x2a235d,null));};exports[_0x9bfd('0x52')]=function(_0x220749,_0x689fdc){var _0x1e83d6={'raw':![],'where':{'id':_0x220749[_0x9bfd('0x53')]['id']}},_0x3811e8={};_0x3811e8[_0x9bfd('0x3d')]=_[_0x9bfd('0x3f')](db[_0x9bfd('0x39')]['rawAttributes']);_0x3811e8[_0x9bfd('0x40')]=_[_0x9bfd('0x3f')](_0x220749[_0x9bfd('0x40')]);_0x3811e8[_0x9bfd('0x4a')]=_[_0x9bfd('0x54')](_0x3811e8['model'],_0x3811e8[_0x9bfd('0x40')]);_0x1e83d6[_0x9bfd('0x41')]=_[_0x9bfd('0x54')](_0x3811e8[_0x9bfd('0x3d')],qs[_0x9bfd('0x42')](_0x220749['query'][_0x9bfd('0x42')]));_0x1e83d6[_0x9bfd('0x41')]=_0x1e83d6[_0x9bfd('0x41')]['length']?_0x1e83d6[_0x9bfd('0x41')]:_0x3811e8[_0x9bfd('0x3d')];if(_0x220749[_0x9bfd('0x40')][_0x9bfd('0x4f')]){_0x1e83d6[_0x9bfd('0x50')]=[{'all':!![]}];}_0x1e83d6=_[_0x9bfd('0x4d')]({},_0x1e83d6,_0x220749[_0x9bfd('0x4e')]);return db[_0x9bfd('0x39')]['find'](_0x1e83d6)['then'](handleEntityNotFound(_0x689fdc,null))[_0x9bfd('0x20')](respondWithResult(_0x689fdc,null))[_0x9bfd('0x2a')](handleError(_0x689fdc,null));};exports[_0x9bfd('0x55')]=function(_0x2f69bd,_0xc40b8f){return db[_0x9bfd('0x39')][_0x9bfd('0x55')](_0x2f69bd['body'],{})['then'](respondWithResult(_0xc40b8f,0xc9))[_0x9bfd('0x2a')](handleError(_0xc40b8f,null));};exports['update']=function(_0x3a6fb3,_0x3281be){if(_0x3a6fb3[_0x9bfd('0x56')]['id']){delete _0x3a6fb3[_0x9bfd('0x56')]['id'];}return db[_0x9bfd('0x39')][_0x9bfd('0x57')]({'where':{'id':_0x3a6fb3[_0x9bfd('0x53')]['id']}})[_0x9bfd('0x20')](handleEntityNotFound(_0x3281be,null))[_0x9bfd('0x20')](saveUpdates(_0x3a6fb3[_0x9bfd('0x56')],null))[_0x9bfd('0x20')](respondWithResult(_0x3281be,null))[_0x9bfd('0x2a')](handleError(_0x3281be,null));};exports[_0x9bfd('0x58')]=function(_0x573b52,_0x556b6f){return db['VtigerConfiguration'][_0x9bfd('0x57')]({'where':{'id':_0x573b52[_0x9bfd('0x53')]['id']}})[_0x9bfd('0x20')](handleEntityNotFound(_0x556b6f,null))[_0x9bfd('0x20')](removeEntity(_0x556b6f,null))[_0x9bfd('0x2a')](handleError(_0x556b6f,null));};exports[_0x9bfd('0x59')]=function(_0x52899a,_0x206168,_0x571d07){var _0x21b66d={};var _0x44c71c={};var _0x406f85;var _0x298103;return db[_0x9bfd('0x39')][_0x9bfd('0x5a')]({'where':{'id':_0x52899a[_0x9bfd('0x53')]['id']}})[_0x9bfd('0x20')](handleEntityNotFound(_0x206168,null))['then'](function(_0x4cbbf3){if(_0x4cbbf3){_0x406f85=_0x4cbbf3;_0x44c71c[_0x9bfd('0x3d')]=_['keys'](db['VtigerField'][_0x9bfd('0x3a')]);_0x44c71c['query']=_[_0x9bfd('0x3f')](_0x52899a[_0x9bfd('0x40')]);_0x44c71c[_0x9bfd('0x4a')]=_[_0x9bfd('0x54')](_0x44c71c[_0x9bfd('0x3d')],_0x44c71c['query']);_0x21b66d[_0x9bfd('0x41')]=_['intersection'](_0x44c71c[_0x9bfd('0x3d')],qs[_0x9bfd('0x42')](_0x52899a[_0x9bfd('0x40')][_0x9bfd('0x42')]));_0x21b66d[_0x9bfd('0x41')]=_0x21b66d['attributes'][_0x9bfd('0x43')]?_0x21b66d[_0x9bfd('0x41')]:_0x44c71c[_0x9bfd('0x3d')];_0x21b66d[_0x9bfd('0x46')]=qs[_0x9bfd('0x47')](_0x52899a[_0x9bfd('0x40')][_0x9bfd('0x47')]);_0x21b66d[_0x9bfd('0x48')]=qs['filters'](_[_0x9bfd('0x49')](_0x52899a[_0x9bfd('0x40')],_0x44c71c[_0x9bfd('0x4a')]));if(_0x52899a[_0x9bfd('0x40')][_0x9bfd('0x4b')]){_0x21b66d[_0x9bfd('0x48')]=_[_0x9bfd('0x4d')](_0x21b66d[_0x9bfd('0x48')],{'$or':_[_0x9bfd('0x3e')](_0x21b66d['attributes'],function(_0x13bb1f){var _0x2b8dc0={};_0x2b8dc0[_0x13bb1f]={'$like':'%'+_0x52899a['query'][_0x9bfd('0x4b')]+'%'};return _0x2b8dc0;})});}_0x21b66d=_[_0x9bfd('0x4d')]({},_0x21b66d,_0x52899a[_0x9bfd('0x4e')]);return _0x406f85[_0x9bfd('0x59')](_0x21b66d);}})[_0x9bfd('0x20')](function(_0x539cbd){if(_0x539cbd){_0x298103=_0x539cbd[_0x9bfd('0x43')];if(!_0x52899a[_0x9bfd('0x40')]['hasOwnProperty'](_0x9bfd('0x45'))){_0x21b66d['limit']=qs[_0x9bfd('0x31')](_0x52899a[_0x9bfd('0x40')]['limit']);_0x21b66d[_0x9bfd('0x30')]=qs['offset'](_0x52899a['query'][_0x9bfd('0x30')]);}return _0x406f85[_0x9bfd('0x59')](_0x21b66d);}})[_0x9bfd('0x20')](function(_0x498062){if(_0x498062){return _0x498062?{'count':_0x298103,'rows':_0x498062}:null;}})[_0x9bfd('0x20')](respondWithResult(_0x206168,null))['catch'](handleError(_0x206168,null));};exports['getSubjects']=function(_0x152b8f,_0x3d82e7,_0x20a36e){var _0x292ca2={};var _0x37b4af={};var _0x19b887;var _0x5dcfce;return db[_0x9bfd('0x39')][_0x9bfd('0x5a')]({'where':{'id':_0x152b8f[_0x9bfd('0x53')]['id']}})[_0x9bfd('0x20')](handleEntityNotFound(_0x3d82e7,null))[_0x9bfd('0x20')](function(_0x363d62){if(_0x363d62){_0x19b887=_0x363d62;_0x37b4af[_0x9bfd('0x3d')]=_[_0x9bfd('0x3f')](db[_0x9bfd('0x5b')]['rawAttributes']);_0x37b4af['query']=_[_0x9bfd('0x3f')](_0x152b8f[_0x9bfd('0x40')]);_0x37b4af[_0x9bfd('0x4a')]=_[_0x9bfd('0x54')](_0x37b4af[_0x9bfd('0x3d')],_0x37b4af['query']);_0x292ca2['attributes']=_[_0x9bfd('0x54')](_0x37b4af[_0x9bfd('0x3d')],qs[_0x9bfd('0x42')](_0x152b8f[_0x9bfd('0x40')][_0x9bfd('0x42')]));_0x292ca2[_0x9bfd('0x41')]=_0x292ca2[_0x9bfd('0x41')]['length']?_0x292ca2[_0x9bfd('0x41')]:_0x37b4af[_0x9bfd('0x3d')];_0x292ca2[_0x9bfd('0x46')]=qs[_0x9bfd('0x47')](_0x152b8f[_0x9bfd('0x40')][_0x9bfd('0x47')]);_0x292ca2['where']=qs['filters'](_[_0x9bfd('0x49')](_0x152b8f[_0x9bfd('0x40')],_0x37b4af[_0x9bfd('0x4a')]));if(_0x152b8f[_0x9bfd('0x40')][_0x9bfd('0x4b')]){_0x292ca2[_0x9bfd('0x48')]=_[_0x9bfd('0x4d')](_0x292ca2[_0x9bfd('0x48')],{'$or':_[_0x9bfd('0x3e')](_0x292ca2[_0x9bfd('0x41')],function(_0x50116d){var _0x1e7a63={};_0x1e7a63[_0x50116d]={'$like':'%'+_0x152b8f[_0x9bfd('0x40')]['filter']+'%'};return _0x1e7a63;})});}_0x292ca2=_[_0x9bfd('0x4d')]({},_0x292ca2,_0x152b8f['options']);return _0x19b887[_0x9bfd('0x5c')](_0x292ca2);}})['then'](function(_0x1d5519){if(_0x1d5519){_0x5dcfce=_0x1d5519[_0x9bfd('0x43')];if(!_0x152b8f[_0x9bfd('0x40')][_0x9bfd('0x44')](_0x9bfd('0x45'))){_0x292ca2[_0x9bfd('0x31')]=qs['limit'](_0x152b8f[_0x9bfd('0x40')][_0x9bfd('0x31')]);_0x292ca2['offset']=qs[_0x9bfd('0x30')](_0x152b8f[_0x9bfd('0x40')][_0x9bfd('0x30')]);}return _0x19b887['getSubjects'](_0x292ca2);}})[_0x9bfd('0x20')](function(_0x29291f){if(_0x29291f){return _0x29291f?{'count':_0x5dcfce,'rows':_0x29291f}:null;}})['then'](respondWithResult(_0x3d82e7,null))[_0x9bfd('0x2a')](handleError(_0x3d82e7,null));};exports['getDescriptions']=function(_0x285557,_0x40319f,_0x45bc69){var _0xe5c4bf={};var _0x4e66cb={};var _0xa34dca;var _0x5104f0;return db['VtigerConfiguration'][_0x9bfd('0x5a')]({'where':{'id':_0x285557['params']['id']}})[_0x9bfd('0x20')](handleEntityNotFound(_0x40319f,null))[_0x9bfd('0x20')](function(_0x148857){if(_0x148857){_0xa34dca=_0x148857;_0x4e66cb[_0x9bfd('0x3d')]=_['keys'](db[_0x9bfd('0x5b')]['rawAttributes']);_0x4e66cb[_0x9bfd('0x40')]=_[_0x9bfd('0x3f')](_0x285557[_0x9bfd('0x40')]);_0x4e66cb[_0x9bfd('0x4a')]=_[_0x9bfd('0x54')](_0x4e66cb['model'],_0x4e66cb['query']);_0xe5c4bf[_0x9bfd('0x41')]=_[_0x9bfd('0x54')](_0x4e66cb[_0x9bfd('0x3d')],qs['fields'](_0x285557[_0x9bfd('0x40')][_0x9bfd('0x42')]));_0xe5c4bf['attributes']=_0xe5c4bf['attributes'][_0x9bfd('0x43')]?_0xe5c4bf[_0x9bfd('0x41')]:_0x4e66cb[_0x9bfd('0x3d')];_0xe5c4bf[_0x9bfd('0x46')]=qs[_0x9bfd('0x47')](_0x285557[_0x9bfd('0x40')][_0x9bfd('0x47')]);_0xe5c4bf[_0x9bfd('0x48')]=qs[_0x9bfd('0x4a')](_['pick'](_0x285557[_0x9bfd('0x40')],_0x4e66cb[_0x9bfd('0x4a')]));if(_0x285557['query']['filter']){_0xe5c4bf['where']=_[_0x9bfd('0x4d')](_0xe5c4bf[_0x9bfd('0x48')],{'$or':_[_0x9bfd('0x3e')](_0xe5c4bf['attributes'],function(_0x3ac220){var _0x51add1={};_0x51add1[_0x3ac220]={'$like':'%'+_0x285557['query'][_0x9bfd('0x4b')]+'%'};return _0x51add1;})});}_0xe5c4bf=_[_0x9bfd('0x4d')]({},_0xe5c4bf,_0x285557[_0x9bfd('0x4e')]);return _0xa34dca[_0x9bfd('0x5d')](_0xe5c4bf);}})[_0x9bfd('0x20')](function(_0x42ad7b){if(_0x42ad7b){_0x5104f0=_0x42ad7b[_0x9bfd('0x43')];if(!_0x285557[_0x9bfd('0x40')][_0x9bfd('0x44')]('nolimit')){_0xe5c4bf[_0x9bfd('0x31')]=qs[_0x9bfd('0x31')](_0x285557['query'][_0x9bfd('0x31')]);_0xe5c4bf[_0x9bfd('0x30')]=qs['offset'](_0x285557[_0x9bfd('0x40')]['offset']);}return _0xa34dca['getDescriptions'](_0xe5c4bf);}})['then'](function(_0x2b51f6){if(_0x2b51f6){return _0x2b51f6?{'count':_0x5104f0,'rows':_0x2b51f6}:null;}})[_0x9bfd('0x20')](respondWithResult(_0x40319f,null))[_0x9bfd('0x2a')](handleError(_0x40319f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7d432c6..b3b8707 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 _0x307a=['exports','define','VtigerConfiguration','int_vtiger_configurations','util','api','moment','rimraf','./intVtigerConfiguration.attributes'];(function(_0x3f4b71,_0x57a093){var _0x24ecde=function(_0x5dde6f){while(--_0x5dde6f){_0x3f4b71['push'](_0x3f4b71['shift']());}};_0x24ecde(++_0x57a093);}(_0x307a,0xb8));var _0xa307=function(_0x40d5d8,_0x4dc52f){_0x40d5d8=_0x40d5d8-0x0;var _0x1c24de=_0x307a[_0x40d5d8];return _0x1c24de;};'use strict';var _=require('lodash');var util=require(_0xa307('0x0'));var logger=require('../../config/logger')(_0xa307('0x1'));var moment=require(_0xa307('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa307('0x3'));var config=require('../../config/environment');var attributes=require(_0xa307('0x4'));module[_0xa307('0x5')]=function(_0x29fd40,_0x4361f2){return _0x29fd40[_0xa307('0x6')](_0xa307('0x7'),attributes,{'tableName':_0xa307('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4218=['moment','bluebird','request-promise','path','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x1c95ab,_0x2584ae){var _0x52c34d=function(_0x5d4605){while(--_0x5d4605){_0x1c95ab['push'](_0x1c95ab['shift']());}};_0x52c34d(++_0x2584ae);}(_0x4218,0x170));var _0x8421=function(_0x26bee6,_0x353d7e){_0x26bee6=_0x26bee6-0x0;var _0x3e6024=_0x4218[_0x26bee6];return _0x3e6024;};'use strict';var _=require('lodash');var util=require(_0x8421('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8421('0x1'));var BPromise=require(_0x8421('0x2'));var rp=require(_0x8421('0x3'));var fs=require('fs');var path=require(_0x8421('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8421('0x5'));module['exports']=function(_0x52b395,_0x588229){return _0x52b395[_0x8421('0x6')](_0x8421('0x7'),attributes,{'tableName':_0x8421('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 8ad2029..a6fb08f 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 _0x2ed5=['../../config/utils','rpc','../../config/environment','jayson/promise','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x216235,_0xc47fca){var _0x55efad=function(_0x3eb5cf){while(--_0x3eb5cf){_0x216235['push'](_0x216235['shift']());}};_0x55efad(++_0xc47fca);}(_0x2ed5,0x109));var _0x52ed=function(_0x5ba35a,_0x5e5113){_0x5ba35a=_0x5ba35a-0x0;var _0x5900dc=_0x2ed5[_0x5ba35a];return _0x5900dc;};'use strict';var _=require(_0x52ed('0x0'));var util=require(_0x52ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52ed('0x2'));var fs=require('fs');var Redis=require(_0x52ed('0x3'));var db=require(_0x52ed('0x4'))['db'];var utils=require(_0x52ed('0x5'));var logger=require('../../config/logger')(_0x52ed('0x6'));var config=require(_0x52ed('0x7'));var jayson=require(_0x52ed('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2659c2,_0x4208b3,_0x14f8fb){return new BPromise(function(_0x2e80ca,_0x1a43c1){return client[_0x52ed('0x9')](_0x2659c2,_0x14f8fb)['then'](function(_0x1a8a5e){logger['info'](_0x52ed('0xa'),_0x4208b3,_0x52ed('0xb'));logger['debug'](_0x52ed('0xc'),_0x4208b3,_0x52ed('0xb'),JSON['stringify'](_0x1a8a5e));if(_0x1a8a5e['error']){if(_0x1a8a5e[_0x52ed('0xd')]['code']===0x1f4){logger[_0x52ed('0xd')](_0x52ed('0xa'),_0x4208b3,_0x1a8a5e['error']['message']);return _0x1a43c1(_0x1a8a5e[_0x52ed('0xd')][_0x52ed('0xe')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4208b3,_0x1a8a5e[_0x52ed('0xd')]['message']);return _0x2e80ca(_0x1a8a5e['error'][_0x52ed('0xe')]);}else{logger[_0x52ed('0xf')](_0x52ed('0xa'),_0x4208b3,_0x52ed('0xb'));_0x2e80ca(_0x1a8a5e[_0x52ed('0x10')][_0x52ed('0xe')]);}})[_0x52ed('0x11')](function(_0x4a2dff){logger['error'](_0x52ed('0xa'),_0x4208b3,_0x4a2dff);_0x1a43c1(_0x4a2dff);});});} \ No newline at end of file +var _0x3364=['then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x11766f,_0x2bfcb4){var _0x2a7dd0=function(_0x4dc799){while(--_0x4dc799){_0x11766f['push'](_0x11766f['shift']());}};_0x2a7dd0(++_0x2bfcb4);}(_0x3364,0xd0));var _0x4336=function(_0x2bb0ee,_0x4aaeed){_0x2bb0ee=_0x2bb0ee-0x0;var _0xafdab6=_0x3364[_0x2bb0ee];return _0xafdab6;};'use strict';var _=require(_0x4336('0x0'));var util=require(_0x4336('0x1'));var moment=require(_0x4336('0x2'));var BPromise=require('bluebird');var rs=require(_0x4336('0x3'));var fs=require('fs');var Redis=require(_0x4336('0x4'));var db=require(_0x4336('0x5'))['db'];var utils=require(_0x4336('0x6'));var logger=require('../../config/logger')(_0x4336('0x7'));var config=require(_0x4336('0x8'));var jayson=require(_0x4336('0x9'));var client=jayson[_0x4336('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33442a,_0x44d8ba,_0x3f2201){return new BPromise(function(_0x205c0f,_0x541d2b){return client[_0x4336('0xb')](_0x33442a,_0x3f2201)[_0x4336('0xc')](function(_0x399330){logger['info'](_0x4336('0xd'),_0x44d8ba,_0x4336('0xe'));logger[_0x4336('0xf')](_0x4336('0x10'),_0x44d8ba,_0x4336('0xe'),JSON[_0x4336('0x11')](_0x399330));if(_0x399330['error']){if(_0x399330['error'][_0x4336('0x12')]===0x1f4){logger[_0x4336('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x44d8ba,_0x399330[_0x4336('0x13')]['message']);return _0x541d2b(_0x399330['error'][_0x4336('0x14')]);}logger[_0x4336('0x13')](_0x4336('0xd'),_0x44d8ba,_0x399330[_0x4336('0x13')][_0x4336('0x14')]);return _0x205c0f(_0x399330[_0x4336('0x13')][_0x4336('0x14')]);}else{logger[_0x4336('0x15')](_0x4336('0xd'),_0x44d8ba,_0x4336('0xe'));_0x205c0f(_0x399330['result'][_0x4336('0x14')]);}})['catch'](function(_0x395cf1){logger[_0x4336('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x44d8ba,_0x395cf1);_0x541d2b(_0x395cf1);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index df4319b..af2893f 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 _0x1d90=['isAuthenticated','/:id','post','put','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get'];(function(_0x22da40,_0x161ae2){var _0x4f062f=function(_0x39a577){while(--_0x39a577){_0x22da40['push'](_0x22da40['shift']());}};_0x4f062f(++_0x161ae2);}(_0x1d90,0x13e));var _0x01d9=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x1d90[_0x4dae00];return _0x16bf42;};'use strict';var multer=require(_0x01d9('0x0'));var util=require('util');var path=require(_0x01d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x01d9('0x2'));var router=express['Router']();var auth=require(_0x01d9('0x3'));var interaction=require(_0x01d9('0x4'));var config=require('../../config/environment');var controller=require(_0x01d9('0x5'));router[_0x01d9('0x6')]('/',auth[_0x01d9('0x7')](),controller['index']);router[_0x01d9('0x6')](_0x01d9('0x8'),auth[_0x01d9('0x7')](),controller['show']);router[_0x01d9('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x01d9('0xa')](_0x01d9('0x8'),auth[_0x01d9('0x7')](),controller['update']);router[_0x01d9('0xb')](_0x01d9('0x8'),auth[_0x01d9('0x7')](),controller['destroy']);module[_0x01d9('0xc')]=router; \ No newline at end of file +var _0x7bdd=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post'];(function(_0x427301,_0x7224d){var _0x533a52=function(_0x10e8c0){while(--_0x10e8c0){_0x427301['push'](_0x427301['shift']());}};_0x533a52(++_0x7224d);}(_0x7bdd,0xef));var _0xd7bd=function(_0x3ca49f,_0x4503f5){_0x3ca49f=_0x3ca49f-0x0;var _0x455796=_0x7bdd[_0x3ca49f];return _0x455796;};'use strict';var multer=require(_0xd7bd('0x0'));var util=require(_0xd7bd('0x1'));var path=require(_0xd7bd('0x2'));var timeout=require(_0xd7bd('0x3'));var express=require('express');var router=express[_0xd7bd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7bd('0x5'));var config=require(_0xd7bd('0x6'));var controller=require(_0xd7bd('0x7'));router[_0xd7bd('0x8')]('/',auth[_0xd7bd('0x9')](),controller[_0xd7bd('0xa')]);router[_0xd7bd('0x8')]('/:id',auth[_0xd7bd('0x9')](),controller[_0xd7bd('0xb')]);router[_0xd7bd('0xc')]('/',auth[_0xd7bd('0x9')](),controller['create']);router[_0xd7bd('0xd')](_0xd7bd('0xe'),auth['isAuthenticated'](),controller[_0xd7bd('0xf')]);router[_0xd7bd('0x10')](_0xd7bd('0xe'),auth[_0xd7bd('0x9')](),controller[_0xd7bd('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3edf8a5..9f2bfdd 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 _0x795a=['STRING','BOOLEAN','exports','ENUM','variable','keyValue','string','customVariable'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x795a,0xa2));var _0xa795=function(_0xbd911d,_0x186344){_0xbd911d=_0xbd911d-0x0;var _0x397b52=_0x795a[_0xbd911d];return _0x397b52;};'use strict';var Sequelize=require('sequelize');module[_0xa795('0x0')]={'type':{'type':Sequelize[_0xa795('0x1')]('string',_0xa795('0x2'),'customVariable',_0xa795('0x3')),'defaultValue':_0xa795('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa795('0x1')](_0xa795('0x4'),_0xa795('0x2'),_0xa795('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa795('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa795('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9901=['exports','string','variable','customVariable','STRING','ENUM','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9901,0x15e));var _0x1990=function(_0x1352f0,_0x4cd565){_0x1352f0=_0x1352f0-0x0;var _0x1c2a82=_0x9901[_0x1352f0];return _0x1c2a82;};'use strict';var Sequelize=require('sequelize');module[_0x1990('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1990('0x1'),_0x1990('0x2'),_0x1990('0x3'),'keyValue'),'defaultValue':_0x1990('0x1')},'content':{'type':Sequelize[_0x1990('0x4')]},'key':{'type':Sequelize[_0x1990('0x4')]},'keyType':{'type':Sequelize[_0x1990('0x5')](_0x1990('0x1'),_0x1990('0x2'),_0x1990('0x3'))},'keyContent':{'type':Sequelize[_0x1990('0x4')]},'idField':{'type':Sequelize[_0x1990('0x4')]},'nameField':{'type':Sequelize[_0x1990('0x4')]},'customField':{'type':Sequelize[_0x1990('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 98da479..4c6d5bf 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 _0x7278=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1bbc16,_0x3f3430){var _0xc3f106=function(_0x5383bd){while(--_0x5383bd){_0x1bbc16['push'](_0x1bbc16['shift']());}};_0xc3f106(++_0x3f3430);}(_0x7278,0x161));var _0x8727=function(_0x2c31bf,_0x3b33b6){_0x2c31bf=_0x2c31bf-0x0;var _0x505147=_0x7278[_0x2c31bf];return _0x505147;};'use strict';var pdf=require(_0x8727('0x0'));var emlformat=require(_0x8727('0x1'));var rimraf=require(_0x8727('0x2'));var zipdir=require(_0x8727('0x3'));var jsonpatch=require(_0x8727('0x4'));var rp=require('request-promise');var moment=require(_0x8727('0x5'));var BPromise=require(_0x8727('0x6'));var Mustache=require(_0x8727('0x7'));var util=require(_0x8727('0x8'));var path=require(_0x8727('0x9'));var sox=require(_0x8727('0xa'));var csv=require(_0x8727('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8727('0x19'));var db=require(_0x8727('0x1a'))['db'];function respondWithStatusCode(_0x176389,_0x518e56){_0x518e56=_0x518e56||0xcc;return function(_0x22d03d){if(_0x22d03d){return _0x176389[_0x8727('0x1b')](_0x518e56);}return _0x176389['status'](_0x518e56)[_0x8727('0x1c')]();};}function respondWithResult(_0x3aa1b,_0x47c29d){_0x47c29d=_0x47c29d||0xc8;return function(_0x2185e5){if(_0x2185e5){return _0x3aa1b[_0x8727('0x1d')](_0x47c29d)[_0x8727('0x1e')](_0x2185e5);}};}function respondWithFilteredResult(_0x3865e9,_0x1916f7){return function(_0x11c828){if(_0x11c828){var _0x88857c=_0x11c828[_0x8727('0x1f')],_0x4842a0=_0x1916f7[_0x8727('0x20')],_0x17baba=_0x1916f7[_0x8727('0x20')]+_0x1916f7[_0x8727('0x21')],_0x1f9538;if(_0x17baba>=_0x88857c){_0x17baba=_0x88857c;_0x1f9538=0xc8;}else{_0x1f9538=0xce;}_0x3865e9['status'](_0x1f9538);return _0x3865e9['set'](_0x8727('0x22'),_0x4842a0+'-'+_0x17baba+'/'+_0x88857c)['json'](_0x11c828);}return null;};}function patchUpdates(_0x28b10f){return function(_0xfd266f){try{jsonpatch[_0x8727('0x23')](_0xfd266f,_0x28b10f,!![]);}catch(_0x22e6c9){return BPromise[_0x8727('0x24')](_0x22e6c9);}return _0xfd266f['save']();};}function saveUpdates(_0x6e552f,_0x286856){return function(_0x8cde82){if(_0x8cde82){return _0x8cde82[_0x8727('0x25')](_0x6e552f)[_0x8727('0x26')](function(_0x3140e8){return _0x3140e8;});}return null;};}function removeEntity(_0x46d43e,_0x441cc0){return function(_0x117f58){if(_0x117f58){return _0x117f58[_0x8727('0x27')]()[_0x8727('0x26')](function(){_0x46d43e[_0x8727('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464a32,_0x3d3592){return function(_0x4c468d){if(!_0x4c468d){_0x464a32['sendStatus'](0x194);}return _0x4c468d;};}function handleError(_0x3df7f2,_0x318684){_0x318684=_0x318684||0x1f4;return function(_0x15e8bf){logger['error'](_0x15e8bf[_0x8727('0x28')]);if(_0x15e8bf[_0x8727('0x29')]){delete _0x15e8bf[_0x8727('0x29')];}_0x3df7f2[_0x8727('0x1d')](_0x318684)[_0x8727('0x2a')](_0x15e8bf);};}exports[_0x8727('0x2b')]=function(_0x262f36,_0xd92f77){var _0x5d03f2={},_0x243f15={},_0x307055={'count':0x0,'rows':[]};var _0x54034d=_[_0x8727('0x2c')](db[_0x8727('0x2d')][_0x8727('0x2e')],function(_0x228ca9){return{'name':_0x228ca9[_0x8727('0x2f')],'type':_0x228ca9[_0x8727('0x30')]['key']};});_0x243f15[_0x8727('0x31')]=_['map'](_0x54034d,_0x8727('0x29'));_0x243f15['query']=_[_0x8727('0x32')](_0x262f36[_0x8727('0x33')]);_0x243f15[_0x8727('0x34')]=_[_0x8727('0x35')](_0x243f15[_0x8727('0x31')],_0x243f15[_0x8727('0x33')]);_0x5d03f2[_0x8727('0x36')]=_['intersection'](_0x243f15[_0x8727('0x31')],qs[_0x8727('0x37')](_0x262f36[_0x8727('0x33')][_0x8727('0x37')]));_0x5d03f2[_0x8727('0x36')]=_0x5d03f2[_0x8727('0x36')][_0x8727('0x38')]?_0x5d03f2[_0x8727('0x36')]:_0x243f15[_0x8727('0x31')];if(!_0x262f36[_0x8727('0x33')][_0x8727('0x39')](_0x8727('0x3a'))){_0x5d03f2['limit']=qs['limit'](_0x262f36[_0x8727('0x33')][_0x8727('0x21')]);_0x5d03f2[_0x8727('0x20')]=qs[_0x8727('0x20')](_0x262f36['query'][_0x8727('0x20')]);}_0x5d03f2[_0x8727('0x3b')]=qs[_0x8727('0x3c')](_0x262f36[_0x8727('0x33')][_0x8727('0x3c')]);_0x5d03f2['where']=qs[_0x8727('0x34')](_[_0x8727('0x3d')](_0x262f36[_0x8727('0x33')],_0x243f15[_0x8727('0x34')]),_0x54034d);if(_0x262f36[_0x8727('0x33')][_0x8727('0x3e')]){_0x5d03f2[_0x8727('0x3f')]=_[_0x8727('0x40')](_0x5d03f2[_0x8727('0x3f')],{'$or':_[_0x8727('0x2c')](_0x54034d,function(_0x396f12){if(_0x396f12[_0x8727('0x30')]!=='VIRTUAL'){var _0x51c66d={};_0x51c66d[_0x396f12[_0x8727('0x29')]]={'$like':'%'+_0x262f36[_0x8727('0x33')][_0x8727('0x3e')]+'%'};return _0x51c66d;}})});}_0x5d03f2=_[_0x8727('0x40')]({},_0x5d03f2,_0x262f36[_0x8727('0x41')]);var _0x308035={'where':_0x5d03f2[_0x8727('0x3f')]};return db[_0x8727('0x2d')][_0x8727('0x1f')](_0x308035)[_0x8727('0x26')](function(_0x1f719e){_0x307055[_0x8727('0x1f')]=_0x1f719e;if(_0x262f36[_0x8727('0x33')]['includeAll']){_0x5d03f2[_0x8727('0x42')]=[{'all':!![]}];}return db[_0x8727('0x2d')][_0x8727('0x43')](_0x5d03f2);})['then'](function(_0x2a506f){_0x307055[_0x8727('0x44')]=_0x2a506f;return _0x307055;})[_0x8727('0x26')](respondWithFilteredResult(_0xd92f77,_0x5d03f2))[_0x8727('0x45')](handleError(_0xd92f77,null));};exports['show']=function(_0x3a2683,_0x37e87c){var _0x1b90e3={'raw':!![],'where':{'id':_0x3a2683[_0x8727('0x46')]['id']}},_0x191fe7={};_0x191fe7[_0x8727('0x31')]=_[_0x8727('0x32')](db[_0x8727('0x2d')][_0x8727('0x2e')]);_0x191fe7[_0x8727('0x33')]=_['keys'](_0x3a2683[_0x8727('0x33')]);_0x191fe7[_0x8727('0x34')]=_[_0x8727('0x35')](_0x191fe7[_0x8727('0x31')],_0x191fe7[_0x8727('0x33')]);_0x1b90e3['attributes']=_[_0x8727('0x35')](_0x191fe7[_0x8727('0x31')],qs[_0x8727('0x37')](_0x3a2683['query'][_0x8727('0x37')]));_0x1b90e3[_0x8727('0x36')]=_0x1b90e3[_0x8727('0x36')][_0x8727('0x38')]?_0x1b90e3[_0x8727('0x36')]:_0x191fe7[_0x8727('0x31')];if(_0x3a2683['query'][_0x8727('0x47')]){_0x1b90e3[_0x8727('0x42')]=[{'all':!![]}];}_0x1b90e3=_[_0x8727('0x40')]({},_0x1b90e3,_0x3a2683['options']);return db[_0x8727('0x2d')][_0x8727('0x48')](_0x1b90e3)[_0x8727('0x26')](handleEntityNotFound(_0x37e87c,null))[_0x8727('0x26')](respondWithResult(_0x37e87c,null))[_0x8727('0x45')](handleError(_0x37e87c,null));};exports[_0x8727('0x49')]=function(_0x39e342,_0x5c875a){return db[_0x8727('0x2d')][_0x8727('0x49')](_0x39e342[_0x8727('0x4a')],{})[_0x8727('0x26')](respondWithResult(_0x5c875a,0xc9))[_0x8727('0x45')](handleError(_0x5c875a,null));};exports[_0x8727('0x25')]=function(_0x34fe5b,_0x5b4388){if(_0x34fe5b[_0x8727('0x4a')]['id']){delete _0x34fe5b[_0x8727('0x4a')]['id'];}return db[_0x8727('0x2d')]['find']({'where':{'id':_0x34fe5b[_0x8727('0x46')]['id']}})[_0x8727('0x26')](handleEntityNotFound(_0x5b4388,null))[_0x8727('0x26')](saveUpdates(_0x34fe5b[_0x8727('0x4a')],null))[_0x8727('0x26')](respondWithResult(_0x5b4388,null))[_0x8727('0x45')](handleError(_0x5b4388,null));};exports[_0x8727('0x27')]=function(_0x53f6c2,_0x23c2e8){return db['VtigerField'][_0x8727('0x48')]({'where':{'id':_0x53f6c2[_0x8727('0x46')]['id']}})['then'](handleEntityNotFound(_0x23c2e8,null))[_0x8727('0x26')](removeEntity(_0x23c2e8,null))[_0x8727('0x45')](handleError(_0x23c2e8,null));}; \ No newline at end of file +var _0xe2fe=['nolimit','limit','order','where','filters','pick','filter','merge','options','rows','params','rawAttributes','find','create','catch','body','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','set','json','reject','save','then','destroy','end','error','stack','name','send','map','VtigerField','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x39b034,_0x2ca84b){var _0x25c570=function(_0x3dea96){while(--_0x3dea96){_0x39b034['push'](_0x39b034['shift']());}};_0x25c570(++_0x2ca84b);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=_0x28b614['count'],_0x390c2c=_0x145241[_0xee2f('0x13')],_0x58f42a=_0x145241[_0xee2f('0x13')]+_0x145241['limit'],_0x3f6372;if(_0x58f42a>=_0x1bbf7d){_0x58f42a=_0x1bbf7d;_0x3f6372=0xc8;}else{_0x3f6372=0xce;}_0x445ba8['status'](_0x3f6372);return _0x445ba8[_0xee2f('0x14')]('Content-Range',_0x390c2c+'-'+_0x58f42a+'/'+_0x1bbf7d)[_0xee2f('0x15')](_0x28b614);}return null;};}function patchUpdates(_0x3e0b31){return function(_0x28549d){try{jsonpatch['apply'](_0x28549d,_0x3e0b31,!![]);}catch(_0x35e1a4){return BPromise[_0xee2f('0x16')](_0x35e1a4);}return _0x28549d[_0xee2f('0x17')]();};}function saveUpdates(_0x21fdf4,_0x3d892d){return function(_0x5d36d4){if(_0x5d36d4){return _0x5d36d4['update'](_0x21fdf4)[_0xee2f('0x18')](function(_0x3a1852){return _0x3a1852;});}return null;};}function removeEntity(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x19')]()[_0xee2f('0x18')](function(){_0x1ea808['status'](0xcc)[_0xee2f('0x1a')]();});}};}function handleEntityNotFound(_0x2c47c5,_0x15ceda){return function(_0x70e308){if(!_0x70e308){_0x2c47c5[_0xee2f('0x11')](0x194);}return _0x70e308;};}function handleError(_0xf77cf5,_0x15a1b1){_0x15a1b1=_0x15a1b1||0x1f4;return function(_0x13013f){logger[_0xee2f('0x1b')](_0x13013f[_0xee2f('0x1c')]);if(_0x13013f[_0xee2f('0x1d')]){delete _0x13013f[_0xee2f('0x1d')];}_0xf77cf5[_0xee2f('0x12')](_0x15a1b1)[_0xee2f('0x1e')](_0x13013f);};}exports['index']=function(_0x4ef690,_0x58ba65){var _0x18bdbb={},_0x18ff19={},_0x2cb0cb={'count':0x0,'rows':[]};var _0xc7f004=_[_0xee2f('0x1f')](db[_0xee2f('0x20')]['rawAttributes'],function(_0x3d3806){return{'name':_0x3d3806['fieldName'],'type':_0x3d3806[_0xee2f('0x21')][_0xee2f('0x22')]};});_0x18ff19[_0xee2f('0x23')]=_[_0xee2f('0x1f')](_0xc7f004,_0xee2f('0x1d'));_0x18ff19['query']=_[_0xee2f('0x24')](_0x4ef690[_0xee2f('0x25')]);_0x18ff19['filters']=_['intersection'](_0x18ff19[_0xee2f('0x23')],_0x18ff19['query']);_0x18bdbb[_0xee2f('0x26')]=_[_0xee2f('0x27')](_0x18ff19['model'],qs[_0xee2f('0x28')](_0x4ef690['query']['fields']));_0x18bdbb['attributes']=_0x18bdbb[_0xee2f('0x26')][_0xee2f('0x29')]?_0x18bdbb['attributes']:_0x18ff19[_0xee2f('0x23')];if(!_0x4ef690[_0xee2f('0x25')][_0xee2f('0x2a')](_0xee2f('0x2b'))){_0x18bdbb[_0xee2f('0x2c')]=qs['limit'](_0x4ef690[_0xee2f('0x25')]['limit']);_0x18bdbb[_0xee2f('0x13')]=qs[_0xee2f('0x13')](_0x4ef690[_0xee2f('0x25')]['offset']);}_0x18bdbb[_0xee2f('0x2d')]=qs['sort'](_0x4ef690[_0xee2f('0x25')]['sort']);_0x18bdbb[_0xee2f('0x2e')]=qs[_0xee2f('0x2f')](_[_0xee2f('0x30')](_0x4ef690[_0xee2f('0x25')],_0x18ff19[_0xee2f('0x2f')]),_0xc7f004);if(_0x4ef690[_0xee2f('0x25')][_0xee2f('0x31')]){_0x18bdbb[_0xee2f('0x2e')]=_[_0xee2f('0x32')](_0x18bdbb[_0xee2f('0x2e')],{'$or':_[_0xee2f('0x1f')](_0xc7f004,function(_0x5ad0a7){if(_0x5ad0a7[_0xee2f('0x21')]!=='VIRTUAL'){var _0x46166f={};_0x46166f[_0x5ad0a7[_0xee2f('0x1d')]]={'$like':'%'+_0x4ef690[_0xee2f('0x25')][_0xee2f('0x31')]+'%'};return _0x46166f;}})});}_0x18bdbb=_[_0xee2f('0x32')]({},_0x18bdbb,_0x4ef690[_0xee2f('0x33')]);var _0x694950={'where':_0x18bdbb[_0xee2f('0x2e')]};return db['VtigerField']['count'](_0x694950)['then'](function(_0x46d9a2){_0x2cb0cb['count']=_0x46d9a2;if(_0x4ef690[_0xee2f('0x25')]['includeAll']){_0x18bdbb['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x18bdbb);})[_0xee2f('0x18')](function(_0x692686){_0x2cb0cb[_0xee2f('0x34')]=_0x692686;return _0x2cb0cb;})[_0xee2f('0x18')](respondWithFilteredResult(_0x58ba65,_0x18bdbb))['catch'](handleError(_0x58ba65,null));};exports['show']=function(_0x3f2194,_0x5e12b7){var _0x5a7825={'raw':!![],'where':{'id':_0x3f2194[_0xee2f('0x35')]['id']}},_0x8204dc={};_0x8204dc[_0xee2f('0x23')]=_['keys'](db[_0xee2f('0x20')][_0xee2f('0x36')]);_0x8204dc[_0xee2f('0x25')]=_['keys'](_0x3f2194['query']);_0x8204dc[_0xee2f('0x2f')]=_[_0xee2f('0x27')](_0x8204dc[_0xee2f('0x23')],_0x8204dc[_0xee2f('0x25')]);_0x5a7825['attributes']=_[_0xee2f('0x27')](_0x8204dc[_0xee2f('0x23')],qs[_0xee2f('0x28')](_0x3f2194[_0xee2f('0x25')][_0xee2f('0x28')]));_0x5a7825[_0xee2f('0x26')]=_0x5a7825[_0xee2f('0x26')][_0xee2f('0x29')]?_0x5a7825[_0xee2f('0x26')]:_0x8204dc[_0xee2f('0x23')];if(_0x3f2194['query']['includeAll']){_0x5a7825['include']=[{'all':!![]}];}_0x5a7825=_['merge']({},_0x5a7825,_0x3f2194[_0xee2f('0x33')]);return db[_0xee2f('0x20')][_0xee2f('0x37')](_0x5a7825)[_0xee2f('0x18')](handleEntityNotFound(_0x5e12b7,null))[_0xee2f('0x18')](respondWithResult(_0x5e12b7,null))['catch'](handleError(_0x5e12b7,null));};exports[_0xee2f('0x38')]=function(_0x36c5cc,_0x9aef4b){return db[_0xee2f('0x20')]['create'](_0x36c5cc['body'],{})['then'](respondWithResult(_0x9aef4b,0xc9))[_0xee2f('0x39')](handleError(_0x9aef4b,null));};exports['update']=function(_0x4bb7c8,_0x57ce3c){if(_0x4bb7c8['body']['id']){delete _0x4bb7c8[_0xee2f('0x3a')]['id'];}return db[_0xee2f('0x20')][_0xee2f('0x37')]({'where':{'id':_0x4bb7c8['params']['id']}})[_0xee2f('0x18')](handleEntityNotFound(_0x57ce3c,null))['then'](saveUpdates(_0x4bb7c8[_0xee2f('0x3a')],null))[_0xee2f('0x18')](respondWithResult(_0x57ce3c,null))[_0xee2f('0x39')](handleError(_0x57ce3c,null));};exports[_0xee2f('0x19')]=function(_0x3d86b4,_0x4978eb){return db['VtigerField'][_0xee2f('0x37')]({'where':{'id':_0x3d86b4['params']['id']}})[_0xee2f('0x18')](handleEntityNotFound(_0x4978eb,null))[_0xee2f('0x18')](removeEntity(_0x4978eb,null))[_0xee2f('0x39')](handleError(_0x4978eb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9ec7453..c30e1a8 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(_0xec2967,_0x21e203){var _0x201a6f=function(_0x12a6de){while(--_0x12a6de){_0xec2967['push'](_0xec2967['shift']());}};_0x201a6f(++_0x21e203);}(_0x7a54,0x106));var _0x47a5=function(_0x10e1a7,_0x2b86b0){_0x10e1a7=_0x10e1a7-0x0;var _0x27e10d=_0x7a54[_0x10e1a7];return _0x27e10d;};'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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x37cf7a,_0xd32c19){var _0x122f71=function(_0x4d8f46){while(--_0x4d8f46){_0x37cf7a['push'](_0x37cf7a['shift']());}};_0x122f71(++_0xd32c19);}(_0x7a54,0x106));var _0x47a5=function(_0x4a5bca,_0x1ab8a7){_0x4a5bca=_0x4a5bca-0x0;var _0x411997=_0x7a54[_0x4a5bca];return _0x411997;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 5e9eb84..d14b01d 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 _0x215d=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x215d,0x187));var _0xd215=function(_0x42b829,_0xb15243){_0x42b829=_0x42b829-0x0;var _0x32759d=_0x215d[_0x42b829];return _0x32759d;};'use strict';var _=require(_0xd215('0x0'));var util=require('util');var moment=require(_0xd215('0x1'));var BPromise=require(_0xd215('0x2'));var rs=require(_0xd215('0x3'));var fs=require('fs');var Redis=require(_0xd215('0x4'));var db=require(_0xd215('0x5'))['db'];var utils=require(_0xd215('0x6'));var logger=require('../../config/logger')(_0xd215('0x7'));var config=require('../../config/environment');var jayson=require(_0xd215('0x8'));var client=jayson[_0xd215('0x9')][_0xd215('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6d12,_0xc5d7fe,_0x4e2c85){return new BPromise(function(_0x1ab6c8,_0x28885f){return client[_0xd215('0xb')](_0x5a6d12,_0x4e2c85)['then'](function(_0x184b3f){logger[_0xd215('0xc')](_0xd215('0xd'),_0xc5d7fe,_0xd215('0xe'));logger[_0xd215('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0xc5d7fe,_0xd215('0xe'),JSON[_0xd215('0x10')](_0x184b3f));if(_0x184b3f[_0xd215('0x11')]){if(_0x184b3f['error'][_0xd215('0x12')]===0x1f4){logger[_0xd215('0x11')](_0xd215('0xd'),_0xc5d7fe,_0x184b3f[_0xd215('0x11')][_0xd215('0x13')]);return _0x28885f(_0x184b3f['error'][_0xd215('0x13')]);}logger[_0xd215('0x11')](_0xd215('0xd'),_0xc5d7fe,_0x184b3f[_0xd215('0x11')][_0xd215('0x13')]);return _0x1ab6c8(_0x184b3f[_0xd215('0x11')][_0xd215('0x13')]);}else{logger[_0xd215('0xc')]('VtigerField,\x20%s,\x20%s',_0xc5d7fe,_0xd215('0xe'));_0x1ab6c8(_0x184b3f[_0xd215('0x14')][_0xd215('0x13')]);}})[_0xd215('0x15')](function(_0x6587f1){logger[_0xd215('0x11')](_0xd215('0xd'),_0xc5d7fe,_0x6587f1);_0x28885f(_0x6587f1);});});} \ No newline at end of file +var _0x37e9=['debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x970107,_0x3928ec){var _0x263c75=function(_0x228892){while(--_0x228892){_0x970107['push'](_0x970107['shift']());}};_0x263c75(++_0x3928ec);}(_0x37e9,0x1e7));var _0x937e=function(_0x26d519,_0x1ee5c6){_0x26d519=_0x26d519-0x0;var _0x127fdf=_0x37e9[_0x26d519];return _0x127fdf;};'use strict';var _=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var moment=require(_0x937e('0x2'));var BPromise=require(_0x937e('0x3'));var rs=require(_0x937e('0x4'));var fs=require('fs');var Redis=require(_0x937e('0x5'));var db=require(_0x937e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x937e('0x7'))(_0x937e('0x8'));var config=require(_0x937e('0x9'));var jayson=require(_0x937e('0xa'));var client=jayson[_0x937e('0xb')][_0x937e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dae1c,_0x18940b,_0x647ec8){return new BPromise(function(_0x16d2d7,_0x21d9ad){return client[_0x937e('0xd')](_0x4dae1c,_0x647ec8)[_0x937e('0xe')](function(_0x541b17){logger['info'](_0x937e('0xf'),_0x18940b,_0x937e('0x10'));logger[_0x937e('0x11')](_0x937e('0x12'),_0x18940b,_0x937e('0x10'),JSON[_0x937e('0x13')](_0x541b17));if(_0x541b17['error']){if(_0x541b17['error']['code']===0x1f4){logger[_0x937e('0x14')](_0x937e('0xf'),_0x18940b,_0x541b17['error'][_0x937e('0x15')]);return _0x21d9ad(_0x541b17[_0x937e('0x14')][_0x937e('0x15')]);}logger[_0x937e('0x14')]('VtigerField,\x20%s,\x20%s',_0x18940b,_0x541b17[_0x937e('0x14')][_0x937e('0x15')]);return _0x16d2d7(_0x541b17[_0x937e('0x14')][_0x937e('0x15')]);}else{logger['info'](_0x937e('0xf'),_0x18940b,_0x937e('0x10'));_0x16d2d7(_0x541b17[_0x937e('0x16')][_0x937e('0x15')]);}})[_0x937e('0x17')](function(_0x6637df){logger[_0x937e('0x14')](_0x937e('0xf'),_0x18940b,_0x6637df);_0x21d9ad(_0x6637df);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a945e98..8090ce4 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 _0x8bf7=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy'];(function(_0x357342,_0x2d2e1b){var _0x43e89e=function(_0x5c06e9){while(--_0x5c06e9){_0x357342['push'](_0x357342['shift']());}};_0x43e89e(++_0x2d2e1b);}(_0x8bf7,0x139));var _0x78bf=function(_0x20ac5f,_0x2a961a){_0x20ac5f=_0x20ac5f-0x0;var _0x4c91e1=_0x8bf7[_0x20ac5f];return _0x4c91e1;};'use strict';var multer=require(_0x78bf('0x0'));var util=require(_0x78bf('0x1'));var path=require(_0x78bf('0x2'));var timeout=require('connect-timeout');var express=require(_0x78bf('0x3'));var router=express[_0x78bf('0x4')]();var auth=require(_0x78bf('0x5'));var interaction=require(_0x78bf('0x6'));var config=require(_0x78bf('0x7'));var controller=require(_0x78bf('0x8'));router[_0x78bf('0x9')]('/',auth[_0x78bf('0xa')](),controller[_0x78bf('0xb')]);router[_0x78bf('0x9')](_0x78bf('0xc'),auth[_0x78bf('0xa')](),controller[_0x78bf('0xd')]);router[_0x78bf('0x9')](_0x78bf('0xe'),auth[_0x78bf('0xa')](),controller[_0x78bf('0xf')]);router[_0x78bf('0x9')](_0x78bf('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x78bf('0xa')](),controller[_0x78bf('0x11')]);router[_0x78bf('0x12')](_0x78bf('0xe'),auth[_0x78bf('0xa')](),controller['addConfiguration']);router[_0x78bf('0x13')]('/:id',auth[_0x78bf('0xa')](),controller[_0x78bf('0x14')]);router[_0x78bf('0x15')](_0x78bf('0xc'),auth[_0x78bf('0xa')](),controller[_0x78bf('0x16')]);module[_0x78bf('0x17')]=router; \ No newline at end of file +var _0x2e35=['/:id/configurations','addConfiguration','put','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create'];(function(_0x5a0551,_0x3a1005){var _0xb34ff5=function(_0x1189ba){while(--_0x1189ba){_0x5a0551['push'](_0x5a0551['shift']());}};_0xb34ff5(++_0x3a1005);}(_0x2e35,0x1d0));var _0x52e3=function(_0x31995c,_0x1a8869){_0x31995c=_0x31995c-0x0;var _0x640286=_0x2e35[_0x31995c];return _0x640286;};'use strict';var multer=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var path=require(_0x52e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52e3('0x3'));var router=express[_0x52e3('0x4')]();var auth=require(_0x52e3('0x5'));var interaction=require(_0x52e3('0x6'));var config=require('../../config/environment');var controller=require(_0x52e3('0x7'));router[_0x52e3('0x8')]('/',auth[_0x52e3('0x9')](),controller[_0x52e3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x52e3('0xb')]);router['get']('/:id/configurations',auth[_0x52e3('0x9')](),controller[_0x52e3('0xc')]);router['get'](_0x52e3('0xd'),auth[_0x52e3('0x9')](),controller['getFields']);router[_0x52e3('0xe')]('/',auth['isAuthenticated'](),controller[_0x52e3('0xf')]);router[_0x52e3('0xe')](_0x52e3('0x10'),auth['isAuthenticated'](),controller[_0x52e3('0x11')]);router[_0x52e3('0x12')]('/:id',auth[_0x52e3('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x52e3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index bf0da4a..12d8a90 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 _0x42d1=['token','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x5dcd66,_0x2bb299){var _0x3d45d0=function(_0x1509b5){while(--_0x1509b5){_0x5dcd66['push'](_0x5dcd66['shift']());}};_0x3d45d0(++_0x2bb299);}(_0x42d1,0xd2));var _0x142d=function(_0x157527,_0x41f908){_0x157527=_0x157527-0x0;var _0x2d56a1=_0x42d1[_0x157527];return _0x2d56a1;};'use strict';var Sequelize=require(_0x142d('0x0'));module['exports']={'name':{'type':Sequelize[_0x142d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x142d('0x1')],'unique':_0x142d('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x142d('0x1')],'unique':_0x142d('0x3')},'authType':{'type':Sequelize[_0x142d('0x4')](_0x142d('0x5'),_0x142d('0x6')),'defaultValue':_0x142d('0x5')},'serverUrl':{'type':Sequelize[_0x142d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x142d('0x7'),_0x142d('0x8')),'defaultValue':_0x142d('0x7')}}; \ No newline at end of file +var _0xb11b=['remoteUri','token','password','ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x22852e,_0x2f3f5c){var _0x5e95e8=function(_0x551e4){while(--_0x551e4){_0x22852e['push'](_0x22852e['shift']());}};_0x5e95e8(++_0x2f3f5c);}(_0xb11b,0x10a));var _0xbb11=function(_0x564f09,_0xf51478){_0x564f09=_0x564f09-0x0;var _0x46d07d=_0xb11b[_0x564f09];return _0x46d07d;};'use strict';var Sequelize=require(_0xbb11('0x0'));module[_0xbb11('0x1')]={'name':{'type':Sequelize[_0xbb11('0x2')]},'description':{'type':Sequelize[_0xbb11('0x2')]},'username':{'type':Sequelize[_0xbb11('0x2')],'unique':_0xbb11('0x3')},'password':{'type':Sequelize[_0xbb11('0x2')]},'token':{'type':Sequelize[_0xbb11('0x2')]},'remoteUri':{'type':Sequelize[_0xbb11('0x2')],'unique':_0xbb11('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xbb11('0x5')),'defaultValue':_0xbb11('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbb11('0x7')](_0xbb11('0x8'),_0xbb11('0x9')),'defaultValue':_0xbb11('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index fb90ff0..7acc227 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 _0xd110=['end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','ZendeskAccount','include','options','find','create','body','params','findOne','ZendeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','title','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus'];(function(_0x4b3230,_0x1afbb1){var _0x3dde7e=function(_0x251f50){while(--_0x251f50){_0x4b3230['push'](_0x4b3230['shift']());}};_0x3dde7e(++_0x1afbb1);}(_0xd110,0x1e8));var _0x0d11=function(_0x3deeba,_0x5d0e86){_0x3deeba=_0x3deeba-0x0;var _0x252849=_0xd110[_0x3deeba];return _0x252849;};'use strict';var pdf=require(_0x0d11('0x0'));var emlformat=require(_0x0d11('0x1'));var rimraf=require(_0x0d11('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d11('0x3'));var rp=require(_0x0d11('0x4'));var moment=require(_0x0d11('0x5'));var BPromise=require(_0x0d11('0x6'));var Mustache=require(_0x0d11('0x7'));var util=require(_0x0d11('0x8'));var path=require(_0x0d11('0x9'));var sox=require(_0x0d11('0xa'));var csv=require('to-csv');var ejs=require(_0x0d11('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d11('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0d11('0xd'));var toCsv=require(_0x0d11('0xe'));var querystring=require(_0x0d11('0xf'));var Papa=require('papaparse');var Redis=require(_0x0d11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0d11('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d11('0x12'));var logger=require(_0x0d11('0x13'))(_0x0d11('0x14'));var utils=require(_0x0d11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0d11('0x16'));var db=require(_0x0d11('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0d11('0x18'));var client=jayson[_0x0d11('0x19')][_0x0d11('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x53e0c1,_0x45414a,_0x157483,_0x5bea18){return new BPromise(function(_0x119ce7,_0x3c88e6){var _0x266f0f=_0x5bea18||client;return _0x266f0f[_0x0d11('0x1b')](_0x53e0c1,_0x157483)[_0x0d11('0x1c')](function(_0x5b85a7){logger['info'](_0x0d11('0x1d'),_0x45414a,'request\x20sent');logger[_0x0d11('0x1e')](_0x0d11('0x1f'),_0x45414a,'request\x20sent',JSON[_0x0d11('0x20')](_0x5b85a7));if(_0x5b85a7['error']){if(_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x22')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x45414a,_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x23')]);return _0x3c88e6(_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x23')]);}logger[_0x0d11('0x21')](_0x0d11('0x1d'),_0x45414a,_0x5b85a7['error'][_0x0d11('0x23')]);return _0x119ce7(_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x23')]);}else{logger[_0x0d11('0x24')](_0x0d11('0x1d'),_0x45414a,'request\x20sent');_0x119ce7(_0x5b85a7[_0x0d11('0x25')]['message']);}})[_0x0d11('0x26')](function(_0x424255){logger[_0x0d11('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x45414a,_0x424255);_0x3c88e6(_0x424255);});});}function respondWithStatusCode(_0x304f7f,_0xc4c278){_0xc4c278=_0xc4c278||0xcc;return function(_0x4a6839){if(_0x4a6839){return _0x304f7f[_0x0d11('0x27')](_0xc4c278);}return _0x304f7f['status'](_0xc4c278)[_0x0d11('0x28')]();};}function respondWithResult(_0x510bf5,_0x52cb79){_0x52cb79=_0x52cb79||0xc8;return function(_0x1dba11){if(_0x1dba11){return _0x510bf5[_0x0d11('0x29')](_0x52cb79)[_0x0d11('0x2a')](_0x1dba11);}};}function respondWithFilteredResult(_0x2138a0,_0x7be5a3){return function(_0x4cd228){if(_0x4cd228){var _0x21fac5=_0x4cd228[_0x0d11('0x2b')],_0x5c1de3=_0x7be5a3[_0x0d11('0x2c')],_0x25e7fc=_0x7be5a3[_0x0d11('0x2c')]+_0x7be5a3[_0x0d11('0x2d')],_0x5ab7d4;if(_0x25e7fc>=_0x21fac5){_0x25e7fc=_0x21fac5;_0x5ab7d4=0xc8;}else{_0x5ab7d4=0xce;}_0x2138a0[_0x0d11('0x29')](_0x5ab7d4);return _0x2138a0[_0x0d11('0x2e')](_0x0d11('0x2f'),_0x5c1de3+'-'+_0x25e7fc+'/'+_0x21fac5)[_0x0d11('0x2a')](_0x4cd228);}return null;};}function patchUpdates(_0x25abc5){return function(_0x249a7e){try{jsonpatch[_0x0d11('0x30')](_0x249a7e,_0x25abc5,!![]);}catch(_0x26cca8){return BPromise['reject'](_0x26cca8);}return _0x249a7e[_0x0d11('0x31')]();};}function saveUpdates(_0x2b9c83,_0x59b125){return function(_0x44bdf1){if(_0x44bdf1){return _0x44bdf1[_0x0d11('0x32')](_0x2b9c83)[_0x0d11('0x1c')](function(_0x3873ce){return _0x3873ce;});}return null;};}function removeEntity(_0x41ba77,_0x3e3c16){return function(_0x288967){if(_0x288967){return _0x288967[_0x0d11('0x33')]()[_0x0d11('0x1c')](function(){_0x41ba77[_0x0d11('0x29')](0xcc)[_0x0d11('0x28')]();});}};}function handleEntityNotFound(_0x5af801,_0x874c63){return function(_0xfd259c){if(!_0xfd259c){_0x5af801[_0x0d11('0x27')](0x194);}return _0xfd259c;};}function handleError(_0x174bf0,_0x33ad5d){_0x33ad5d=_0x33ad5d||0x1f4;return function(_0x147df5){logger[_0x0d11('0x21')](_0x147df5[_0x0d11('0x34')]);if(_0x147df5[_0x0d11('0x35')]){delete _0x147df5[_0x0d11('0x35')];}_0x174bf0[_0x0d11('0x29')](_0x33ad5d)['send'](_0x147df5);};}exports['index']=function(_0x31ac3d,_0x18c268){var _0x219e80={},_0x1ab49a={},_0x49e90b={'count':0x0,'rows':[]};var _0x360e92=_[_0x0d11('0x36')](db['ZendeskAccount'][_0x0d11('0x37')],function(_0x15e36a){return{'name':_0x15e36a[_0x0d11('0x38')],'type':_0x15e36a[_0x0d11('0x39')][_0x0d11('0x3a')]};});_0x1ab49a[_0x0d11('0x3b')]=_[_0x0d11('0x36')](_0x360e92,_0x0d11('0x35'));_0x1ab49a[_0x0d11('0x3c')]=_[_0x0d11('0x3d')](_0x31ac3d[_0x0d11('0x3c')]);_0x1ab49a[_0x0d11('0x3e')]=_[_0x0d11('0x3f')](_0x1ab49a[_0x0d11('0x3b')],_0x1ab49a[_0x0d11('0x3c')]);_0x219e80['attributes']=_[_0x0d11('0x3f')](_0x1ab49a['model'],qs[_0x0d11('0x40')](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x40')]));_0x219e80[_0x0d11('0x41')]=_0x219e80['attributes'][_0x0d11('0x42')]?_0x219e80[_0x0d11('0x41')]:_0x1ab49a[_0x0d11('0x3b')];if(!_0x31ac3d[_0x0d11('0x3c')]['hasOwnProperty'](_0x0d11('0x43'))){_0x219e80['limit']=qs[_0x0d11('0x2d')](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x2d')]);_0x219e80[_0x0d11('0x2c')]=qs['offset'](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x2c')]);}_0x219e80[_0x0d11('0x44')]=qs['sort'](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x45')]);_0x219e80[_0x0d11('0x46')]=qs[_0x0d11('0x3e')](_[_0x0d11('0x47')](_0x31ac3d[_0x0d11('0x3c')],_0x1ab49a['filters']),_0x360e92);if(_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x48')]){_0x219e80[_0x0d11('0x46')]=_[_0x0d11('0x49')](_0x219e80[_0x0d11('0x46')],{'$or':_[_0x0d11('0x36')](_0x360e92,function(_0x12d9b6){if(_0x12d9b6[_0x0d11('0x39')]!==_0x0d11('0x4a')){var _0x32a03e={};_0x32a03e[_0x12d9b6[_0x0d11('0x35')]]={'$like':'%'+_0x31ac3d['query'][_0x0d11('0x48')]+'%'};return _0x32a03e;}})});}_0x219e80=_['merge']({},_0x219e80,_0x31ac3d['options']);var _0x35d77e={'where':_0x219e80['where']};return db['ZendeskAccount'][_0x0d11('0x2b')](_0x35d77e)[_0x0d11('0x1c')](function(_0x1c41f9){_0x49e90b[_0x0d11('0x2b')]=_0x1c41f9;if(_0x31ac3d['query'][_0x0d11('0x4b')]){_0x219e80['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x0d11('0x4c')](_0x219e80);})[_0x0d11('0x1c')](function(_0x26a8c5){_0x49e90b[_0x0d11('0x4d')]=_0x26a8c5;return _0x49e90b;})[_0x0d11('0x1c')](respondWithFilteredResult(_0x18c268,_0x219e80))['catch'](handleError(_0x18c268,null));};exports[_0x0d11('0x4e')]=function(_0x43e69d,_0x4aa73a){var _0x5befcb={'raw':![],'where':{'id':_0x43e69d['params']['id']}},_0x50f941={};_0x50f941[_0x0d11('0x3b')]=_[_0x0d11('0x3d')](db[_0x0d11('0x4f')]['rawAttributes']);_0x50f941['query']=_[_0x0d11('0x3d')](_0x43e69d[_0x0d11('0x3c')]);_0x50f941[_0x0d11('0x3e')]=_[_0x0d11('0x3f')](_0x50f941[_0x0d11('0x3b')],_0x50f941['query']);_0x5befcb[_0x0d11('0x41')]=_[_0x0d11('0x3f')](_0x50f941[_0x0d11('0x3b')],qs[_0x0d11('0x40')](_0x43e69d[_0x0d11('0x3c')][_0x0d11('0x40')]));_0x5befcb[_0x0d11('0x41')]=_0x5befcb[_0x0d11('0x41')][_0x0d11('0x42')]?_0x5befcb[_0x0d11('0x41')]:_0x50f941[_0x0d11('0x3b')];if(_0x43e69d[_0x0d11('0x3c')][_0x0d11('0x4b')]){_0x5befcb[_0x0d11('0x50')]=[{'all':!![]}];}_0x5befcb=_[_0x0d11('0x49')]({},_0x5befcb,_0x43e69d[_0x0d11('0x51')]);return db[_0x0d11('0x4f')][_0x0d11('0x52')](_0x5befcb)[_0x0d11('0x1c')](handleEntityNotFound(_0x4aa73a,null))[_0x0d11('0x1c')](respondWithResult(_0x4aa73a,null))['catch'](handleError(_0x4aa73a,null));};exports[_0x0d11('0x53')]=function(_0x58b457,_0x183fb5){return db['ZendeskAccount']['create'](_0x58b457[_0x0d11('0x54')],{})[_0x0d11('0x1c')](respondWithResult(_0x183fb5,0xc9))[_0x0d11('0x26')](handleError(_0x183fb5,null));};exports[_0x0d11('0x32')]=function(_0x2c1556,_0x1e5510){if(_0x2c1556[_0x0d11('0x54')]['id']){delete _0x2c1556[_0x0d11('0x54')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x2c1556['params']['id']}})[_0x0d11('0x1c')](handleEntityNotFound(_0x1e5510,null))[_0x0d11('0x1c')](saveUpdates(_0x2c1556[_0x0d11('0x54')],null))[_0x0d11('0x1c')](respondWithResult(_0x1e5510,null))[_0x0d11('0x26')](handleError(_0x1e5510,null));};exports[_0x0d11('0x33')]=function(_0x33cd8a,_0x56feb2){return db[_0x0d11('0x4f')][_0x0d11('0x52')]({'where':{'id':_0x33cd8a[_0x0d11('0x55')]['id']}})['then'](handleEntityNotFound(_0x56feb2,null))['then'](removeEntity(_0x56feb2,null))[_0x0d11('0x26')](handleError(_0x56feb2,null));};exports['getConfigurations']=function(_0x3cdc8b,_0x115024,_0x36e80d){var _0x1a245d={};var _0xce2e39={};var _0xe580e0;var _0xec39e3;return db[_0x0d11('0x4f')][_0x0d11('0x56')]({'where':{'id':_0x3cdc8b[_0x0d11('0x55')]['id']}})[_0x0d11('0x1c')](handleEntityNotFound(_0x115024,null))[_0x0d11('0x1c')](function(_0x546b98){if(_0x546b98){_0xe580e0=_0x546b98;_0xce2e39[_0x0d11('0x3b')]=_[_0x0d11('0x3d')](db[_0x0d11('0x57')][_0x0d11('0x37')]);_0xce2e39[_0x0d11('0x3c')]=_[_0x0d11('0x3d')](_0x3cdc8b[_0x0d11('0x3c')]);_0xce2e39[_0x0d11('0x3e')]=_[_0x0d11('0x3f')](_0xce2e39[_0x0d11('0x3b')],_0xce2e39[_0x0d11('0x3c')]);_0x1a245d[_0x0d11('0x41')]=_[_0x0d11('0x3f')](_0xce2e39[_0x0d11('0x3b')],qs['fields'](_0x3cdc8b[_0x0d11('0x3c')]['fields']));_0x1a245d[_0x0d11('0x41')]=_0x1a245d[_0x0d11('0x41')][_0x0d11('0x42')]?_0x1a245d[_0x0d11('0x41')]:_0xce2e39[_0x0d11('0x3b')];_0x1a245d['order']=qs[_0x0d11('0x45')](_0x3cdc8b[_0x0d11('0x3c')][_0x0d11('0x45')]);_0x1a245d[_0x0d11('0x46')]=qs[_0x0d11('0x3e')](_[_0x0d11('0x47')](_0x3cdc8b[_0x0d11('0x3c')],_0xce2e39[_0x0d11('0x3e')]));if(_0x3cdc8b[_0x0d11('0x3c')]['filter']){_0x1a245d[_0x0d11('0x46')]=_[_0x0d11('0x49')](_0x1a245d[_0x0d11('0x46')],{'$or':_[_0x0d11('0x36')](_0x1a245d[_0x0d11('0x41')],function(_0x1d2493){var _0x204a1c={};_0x204a1c[_0x1d2493]={'$like':'%'+_0x3cdc8b[_0x0d11('0x3c')][_0x0d11('0x48')]+'%'};return _0x204a1c;})});}_0x1a245d=_[_0x0d11('0x49')]({},_0x1a245d,_0x3cdc8b[_0x0d11('0x51')]);return _0xe580e0[_0x0d11('0x58')](_0x1a245d);}})[_0x0d11('0x1c')](function(_0x312e5a){if(_0x312e5a){_0xec39e3=_0x312e5a[_0x0d11('0x42')];if(!_0x3cdc8b['query'][_0x0d11('0x59')](_0x0d11('0x43'))){_0x1a245d[_0x0d11('0x2d')]=qs['limit'](_0x3cdc8b['query']['limit']);_0x1a245d[_0x0d11('0x2c')]=qs[_0x0d11('0x2c')](_0x3cdc8b['query'][_0x0d11('0x2c')]);}return _0xe580e0['getConfigurations'](_0x1a245d);}})[_0x0d11('0x1c')](function(_0x3db791){if(_0x3db791){return _0x3db791?{'count':_0xec39e3,'rows':_0x3db791}:null;}})[_0x0d11('0x1c')](respondWithResult(_0x115024,null))[_0x0d11('0x26')](handleError(_0x115024,null));};exports[_0x0d11('0x5a')]=function(_0x42b607,_0x2c1405,_0xae4f5e){if(_0x42b607[_0x0d11('0x54')]['id']){delete _0x42b607[_0x0d11('0x54')]['id'];}return db[_0x0d11('0x4f')][_0x0d11('0x56')]({'where':{'id':_0x42b607[_0x0d11('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c1405,null))[_0x0d11('0x1c')](function(_0x80bf7f){if(_0x80bf7f){_0x42b607[_0x0d11('0x54')][_0x0d11('0x5b')]=_0x80bf7f['id'];_0x42b607[_0x0d11('0x54')][_0x0d11('0x5c')]=integrations[_0x0d11('0x5d')](_0x42b607['body'][_0x0d11('0x5e')],_0x42b607[_0x0d11('0x54')][_0x0d11('0x39')]);_0x42b607[_0x0d11('0x54')][_0x0d11('0x5f')]=integrations['getDescriptions'](_0x42b607[_0x0d11('0x54')]['channel'],_0x42b607[_0x0d11('0x54')][_0x0d11('0x39')]);return db['ZendeskConfiguration'][_0x0d11('0x53')](_0x42b607[_0x0d11('0x54')],{'include':[{'model':db[_0x0d11('0x60')],'as':_0x0d11('0x5c')},{'model':db[_0x0d11('0x60')],'as':_0x0d11('0x5f')}]});}return null;})['then'](respondWithResult(_0x2c1405,null))[_0x0d11('0x26')](handleError(_0x2c1405,null));};exports[_0x0d11('0x61')]=function(_0x2b0208,_0x919193,_0x4cb584){var _0x472429='';return db[_0x0d11('0x4f')][_0x0d11('0x56')]({'where':{'id':_0x2b0208[_0x0d11('0x55')]['id']},'attributes':['id',_0x0d11('0x62'),_0x0d11('0x63'),_0x0d11('0x64'),_0x0d11('0x65'),_0x0d11('0x66')]})[_0x0d11('0x1c')](handleEntityNotFound(_0x919193,null))[_0x0d11('0x1c')](function(_0xc1c5fc){if(_0xc1c5fc){_0x472429=_0xc1c5fc[_0x0d11('0x66')];var _0x365604=_0x472429[_0x0d11('0x67')](-0x1);if(_0x365604==='/'){_0x472429=_0x472429[_0x0d11('0x68')](0x0,_0x472429[_0x0d11('0x69')](_0x365604));}var _0x29c416={'method':_0x0d11('0x6a'),'uri':util['format'](_0x0d11('0x6b'),_0x472429,_0x0d11('0x6c')),'json':!![]};switch(_0xc1c5fc[_0x0d11('0x65')]){case _0x0d11('0x63'):_0x29c416[_0x0d11('0x6d')]={'Authorization':util['format'](_0x0d11('0x6e'),new Buffer(util[_0x0d11('0x6f')](_0x0d11('0x70'),_0xc1c5fc[_0x0d11('0x62')],_0xc1c5fc[_0x0d11('0x63')]))['toString'](_0x0d11('0x71')))};break;case _0x0d11('0x64'):_0x29c416[_0x0d11('0x6d')]={'Authorization':util[_0x0d11('0x6f')](_0x0d11('0x6e'),new Buffer(util['format'](_0x0d11('0x72'),_0xc1c5fc['username'],_0xc1c5fc[_0x0d11('0x64')]))[_0x0d11('0x73')](_0x0d11('0x71')))};break;default:throw new db['Sequelize'][(_0x0d11('0x74'))](_0x0d11('0x75'));}return rp(_0x29c416);}})[_0x0d11('0x1c')](function(_0x297d47){if(_0x297d47){var _0x56c1e0=[_0x0d11('0x76'),_0x0d11('0x77'),_0x0d11('0x78'),_0x0d11('0x79')];_[_0x0d11('0x7a')](_0x297d47[_0x0d11('0x6c')],function(_0x228e77){return _0x56c1e0[_0x0d11('0x7b')](_0x228e77[_0x0d11('0x39')]);});return{'count':_0x297d47[_0x0d11('0x6c')][_0x0d11('0x42')],'rows':_[_0x0d11('0x36')](_0x297d47[_0x0d11('0x6c')],function(_0x3e0c83){return{'id':_0x3e0c83['id'],'name':_0x3e0c83['position']>0x7?_0x3e0c83[_0x0d11('0x7c')]:_0x3e0c83[_0x0d11('0x39')],'custom':_0x3e0c83[_0x0d11('0x7d')]>0x7?!![]:![],'options':_0x3e0c83[_0x0d11('0x7e')]?_0x3e0c83[_0x0d11('0x7e')]:_0x3e0c83['custom_field_options']?_0x3e0c83[_0x0d11('0x7f')]:[]};})};}})[_0x0d11('0x1c')](respondWithResult(_0x919193,null))[_0x0d11('0x26')](function(_0xa42355){var _0x3f8903=_0x2b0208[_0x0d11('0x3c')][_0x0d11('0x80')]?0x1f4:_0xa42355['statusCode']||0x1f4;logger[_0x0d11('0x21')](_0x0d11('0x81'),_0x0d11('0x61'),_0x3f8903,JSON[_0x0d11('0x20')](_0xa42355));delete _0xa42355['name'];if(_0x3f8903===0x191){_0x3f8903=0x190;}_0x919193[_0x0d11('0x29')](_0x3f8903)[_0x0d11('0x82')](_0x2b0208['query'][_0x0d11('0x80')]?{'message':_0x0d11('0x83'),'statusCode':_0xa42355['statusCode']}:_0xa42355);});}; \ No newline at end of file +var _0x2504=['ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','destroy','name','send','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','rows','catch','show','keys','intersection','include','options','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','sort','addConfiguration','AccountId','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','username','password','remoteUri','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','%s:%s','toString','token','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','subject','description','group','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3d1260,_0x1277bb){var _0x18c14b=function(_0x2be496){while(--_0x2be496){_0x3d1260['push'](_0x3d1260['shift']());}};_0x18c14b(++_0x1277bb);}(_0x2504,0xee));var _0x4250=function(_0x24d5f3,_0x972142){_0x24d5f3=_0x24d5f3-0x0;var _0x427daf=_0x2504[_0x24d5f3];return _0x427daf;};'use strict';var pdf=require(_0x4250('0x0'));var emlformat=require(_0x4250('0x1'));var rimraf=require(_0x4250('0x2'));var zipdir=require(_0x4250('0x3'));var jsonpatch=require(_0x4250('0x4'));var rp=require(_0x4250('0x5'));var moment=require(_0x4250('0x6'));var BPromise=require(_0x4250('0x7'));var Mustache=require(_0x4250('0x8'));var util=require(_0x4250('0x9'));var path=require(_0x4250('0xa'));var sox=require(_0x4250('0xb'));var csv=require('to-csv');var ejs=require(_0x4250('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0x10'));var querystring=require(_0x4250('0x11'));var Papa=require('papaparse');var Redis=require(_0x4250('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x13'));var as=require(_0x4250('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x16'));var licenseUtil=require(_0x4250('0x17'));var db=require(_0x4250('0x18'))['db'];var integrations=require(_0x4250('0x19'));var jayson=require(_0x4250('0x1a'));var client=jayson['client'][_0x4250('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x19fd3e,_0x25b79b,_0x2c8a75,_0xfa4d8a){return new BPromise(function(_0x33f317,_0x513687){var _0x9aa450=_0xfa4d8a||client;return _0x9aa450[_0x4250('0x1c')](_0x19fd3e,_0x2c8a75)[_0x4250('0x1d')](function(_0x3cff02){logger[_0x4250('0x1e')](_0x4250('0x1f'),_0x25b79b,_0x4250('0x20'));logger['debug'](_0x4250('0x21'),_0x25b79b,_0x4250('0x20'),JSON[_0x4250('0x22')](_0x3cff02));if(_0x3cff02[_0x4250('0x23')]){if(_0x3cff02[_0x4250('0x23')][_0x4250('0x24')]===0x1f4){logger[_0x4250('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x25b79b,_0x3cff02[_0x4250('0x23')]['message']);return _0x513687(_0x3cff02['error'][_0x4250('0x25')]);}logger[_0x4250('0x23')](_0x4250('0x1f'),_0x25b79b,_0x3cff02[_0x4250('0x23')][_0x4250('0x25')]);return _0x33f317(_0x3cff02[_0x4250('0x23')][_0x4250('0x25')]);}else{logger[_0x4250('0x1e')](_0x4250('0x1f'),_0x25b79b,_0x4250('0x20'));_0x33f317(_0x3cff02[_0x4250('0x26')][_0x4250('0x25')]);}})['catch'](function(_0x1fb26e){logger[_0x4250('0x23')](_0x4250('0x1f'),_0x25b79b,_0x1fb26e);_0x513687(_0x1fb26e);});});}function respondWithStatusCode(_0x523053,_0x5d1a74){_0x5d1a74=_0x5d1a74||0xcc;return function(_0x42b18f){if(_0x42b18f){return _0x523053[_0x4250('0x27')](_0x5d1a74);}return _0x523053[_0x4250('0x28')](_0x5d1a74)[_0x4250('0x29')]();};}function respondWithResult(_0x328ffb,_0x5cb4fe){_0x5cb4fe=_0x5cb4fe||0xc8;return function(_0x431d01){if(_0x431d01){return _0x328ffb[_0x4250('0x28')](_0x5cb4fe)[_0x4250('0x2a')](_0x431d01);}};}function respondWithFilteredResult(_0x559d06,_0x5b155e){return function(_0x2dcd72){if(_0x2dcd72){var _0x5d0fa2=_0x2dcd72[_0x4250('0x2b')],_0x3e8b4d=_0x5b155e[_0x4250('0x2c')],_0x1c4fa5=_0x5b155e['offset']+_0x5b155e[_0x4250('0x2d')],_0x105206;if(_0x1c4fa5>=_0x5d0fa2){_0x1c4fa5=_0x5d0fa2;_0x105206=0xc8;}else{_0x105206=0xce;}_0x559d06[_0x4250('0x28')](_0x105206);return _0x559d06['set'](_0x4250('0x2e'),_0x3e8b4d+'-'+_0x1c4fa5+'/'+_0x5d0fa2)['json'](_0x2dcd72);}return null;};}function patchUpdates(_0x231cf0){return function(_0x4d26f0){try{jsonpatch['apply'](_0x4d26f0,_0x231cf0,!![]);}catch(_0xea7ccc){return BPromise['reject'](_0xea7ccc);}return _0x4d26f0[_0x4250('0x2f')]();};}function saveUpdates(_0x281be9,_0x4bed2b){return function(_0x38e0b6){if(_0x38e0b6){return _0x38e0b6[_0x4250('0x30')](_0x281be9)['then'](function(_0x217188){return _0x217188;});}return null;};}function removeEntity(_0x34d17c,_0x4a346e){return function(_0x18d41d){if(_0x18d41d){return _0x18d41d[_0x4250('0x31')]()[_0x4250('0x1d')](function(){_0x34d17c[_0x4250('0x28')](0xcc)[_0x4250('0x29')]();});}};}function handleEntityNotFound(_0x1e5b15,_0x2b68bb){return function(_0x99ac9e){if(!_0x99ac9e){_0x1e5b15[_0x4250('0x27')](0x194);}return _0x99ac9e;};}function handleError(_0x2d1e7b,_0x2bf994){_0x2bf994=_0x2bf994||0x1f4;return function(_0x2b4d08){logger[_0x4250('0x23')](_0x2b4d08['stack']);if(_0x2b4d08[_0x4250('0x32')]){delete _0x2b4d08['name'];}_0x2d1e7b[_0x4250('0x28')](_0x2bf994)[_0x4250('0x33')](_0x2b4d08);};}exports['index']=function(_0xf14c4e,_0xd4add5){var _0x3e85ba={},_0x2cd4fc={},_0x4bf894={'count':0x0,'rows':[]};var _0x4c08c7=_['map'](db[_0x4250('0x34')][_0x4250('0x35')],function(_0x56d2d5){return{'name':_0x56d2d5[_0x4250('0x36')],'type':_0x56d2d5[_0x4250('0x37')][_0x4250('0x38')]};});_0x2cd4fc[_0x4250('0x39')]=_[_0x4250('0x3a')](_0x4c08c7,'name');_0x2cd4fc[_0x4250('0x3b')]=_['keys'](_0xf14c4e['query']);_0x2cd4fc[_0x4250('0x3c')]=_['intersection'](_0x2cd4fc[_0x4250('0x39')],_0x2cd4fc[_0x4250('0x3b')]);_0x3e85ba[_0x4250('0x3d')]=_['intersection'](_0x2cd4fc[_0x4250('0x39')],qs[_0x4250('0x3e')](_0xf14c4e[_0x4250('0x3b')][_0x4250('0x3e')]));_0x3e85ba[_0x4250('0x3d')]=_0x3e85ba['attributes'][_0x4250('0x3f')]?_0x3e85ba[_0x4250('0x3d')]:_0x2cd4fc[_0x4250('0x39')];if(!_0xf14c4e[_0x4250('0x3b')][_0x4250('0x40')](_0x4250('0x41'))){_0x3e85ba['limit']=qs[_0x4250('0x2d')](_0xf14c4e['query'][_0x4250('0x2d')]);_0x3e85ba[_0x4250('0x2c')]=qs[_0x4250('0x2c')](_0xf14c4e[_0x4250('0x3b')][_0x4250('0x2c')]);}_0x3e85ba[_0x4250('0x42')]=qs['sort'](_0xf14c4e['query']['sort']);_0x3e85ba[_0x4250('0x43')]=qs[_0x4250('0x3c')](_[_0x4250('0x44')](_0xf14c4e['query'],_0x2cd4fc[_0x4250('0x3c')]),_0x4c08c7);if(_0xf14c4e[_0x4250('0x3b')][_0x4250('0x45')]){_0x3e85ba['where']=_[_0x4250('0x46')](_0x3e85ba[_0x4250('0x43')],{'$or':_[_0x4250('0x3a')](_0x4c08c7,function(_0x3707ed){if(_0x3707ed['type']!=='VIRTUAL'){var _0xbaad3f={};_0xbaad3f[_0x3707ed[_0x4250('0x32')]]={'$like':'%'+_0xf14c4e[_0x4250('0x3b')][_0x4250('0x45')]+'%'};return _0xbaad3f;}})});}_0x3e85ba=_[_0x4250('0x46')]({},_0x3e85ba,_0xf14c4e['options']);var _0x207a53={'where':_0x3e85ba['where']};return db[_0x4250('0x34')][_0x4250('0x2b')](_0x207a53)[_0x4250('0x1d')](function(_0x527381){_0x4bf894[_0x4250('0x2b')]=_0x527381;if(_0xf14c4e[_0x4250('0x3b')][_0x4250('0x47')]){_0x3e85ba['include']=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x3e85ba);})[_0x4250('0x1d')](function(_0x2edff0){_0x4bf894[_0x4250('0x48')]=_0x2edff0;return _0x4bf894;})[_0x4250('0x1d')](respondWithFilteredResult(_0xd4add5,_0x3e85ba))[_0x4250('0x49')](handleError(_0xd4add5,null));};exports[_0x4250('0x4a')]=function(_0x47b5aa,_0xbbc091){var _0x3bfe2e={'raw':![],'where':{'id':_0x47b5aa['params']['id']}},_0x462b99={};_0x462b99[_0x4250('0x39')]=_['keys'](db['ZendeskAccount'][_0x4250('0x35')]);_0x462b99[_0x4250('0x3b')]=_[_0x4250('0x4b')](_0x47b5aa[_0x4250('0x3b')]);_0x462b99[_0x4250('0x3c')]=_[_0x4250('0x4c')](_0x462b99['model'],_0x462b99[_0x4250('0x3b')]);_0x3bfe2e['attributes']=_[_0x4250('0x4c')](_0x462b99[_0x4250('0x39')],qs[_0x4250('0x3e')](_0x47b5aa['query'][_0x4250('0x3e')]));_0x3bfe2e[_0x4250('0x3d')]=_0x3bfe2e['attributes']['length']?_0x3bfe2e['attributes']:_0x462b99[_0x4250('0x39')];if(_0x47b5aa['query']['includeAll']){_0x3bfe2e[_0x4250('0x4d')]=[{'all':!![]}];}_0x3bfe2e=_[_0x4250('0x46')]({},_0x3bfe2e,_0x47b5aa[_0x4250('0x4e')]);return db[_0x4250('0x34')][_0x4250('0x4f')](_0x3bfe2e)['then'](handleEntityNotFound(_0xbbc091,null))[_0x4250('0x1d')](respondWithResult(_0xbbc091,null))[_0x4250('0x49')](handleError(_0xbbc091,null));};exports[_0x4250('0x50')]=function(_0x47607c,_0x5cd88c){return db[_0x4250('0x34')][_0x4250('0x50')](_0x47607c['body'],{})[_0x4250('0x1d')](respondWithResult(_0x5cd88c,0xc9))[_0x4250('0x49')](handleError(_0x5cd88c,null));};exports['update']=function(_0x28dcf5,_0x1076ea){if(_0x28dcf5[_0x4250('0x51')]['id']){delete _0x28dcf5[_0x4250('0x51')]['id'];}return db[_0x4250('0x34')][_0x4250('0x4f')]({'where':{'id':_0x28dcf5[_0x4250('0x52')]['id']}})['then'](handleEntityNotFound(_0x1076ea,null))[_0x4250('0x1d')](saveUpdates(_0x28dcf5[_0x4250('0x51')],null))[_0x4250('0x1d')](respondWithResult(_0x1076ea,null))['catch'](handleError(_0x1076ea,null));};exports['destroy']=function(_0x27fe0f,_0x4199a4){return db['ZendeskAccount'][_0x4250('0x4f')]({'where':{'id':_0x27fe0f[_0x4250('0x52')]['id']}})[_0x4250('0x1d')](handleEntityNotFound(_0x4199a4,null))['then'](removeEntity(_0x4199a4,null))[_0x4250('0x49')](handleError(_0x4199a4,null));};exports[_0x4250('0x53')]=function(_0x4efe0a,_0x455466,_0x243f5c){var _0x432a6a={};var _0x4b6de1={};var _0x525865;var _0x5cccc4;return db['ZendeskAccount'][_0x4250('0x54')]({'where':{'id':_0x4efe0a['params']['id']}})[_0x4250('0x1d')](handleEntityNotFound(_0x455466,null))[_0x4250('0x1d')](function(_0x4617e1){if(_0x4617e1){_0x525865=_0x4617e1;_0x4b6de1['model']=_[_0x4250('0x4b')](db[_0x4250('0x55')][_0x4250('0x35')]);_0x4b6de1[_0x4250('0x3b')]=_['keys'](_0x4efe0a[_0x4250('0x3b')]);_0x4b6de1[_0x4250('0x3c')]=_[_0x4250('0x4c')](_0x4b6de1[_0x4250('0x39')],_0x4b6de1['query']);_0x432a6a[_0x4250('0x3d')]=_['intersection'](_0x4b6de1[_0x4250('0x39')],qs[_0x4250('0x3e')](_0x4efe0a[_0x4250('0x3b')]['fields']));_0x432a6a[_0x4250('0x3d')]=_0x432a6a[_0x4250('0x3d')][_0x4250('0x3f')]?_0x432a6a[_0x4250('0x3d')]:_0x4b6de1[_0x4250('0x39')];_0x432a6a[_0x4250('0x42')]=qs[_0x4250('0x56')](_0x4efe0a[_0x4250('0x3b')][_0x4250('0x56')]);_0x432a6a[_0x4250('0x43')]=qs[_0x4250('0x3c')](_[_0x4250('0x44')](_0x4efe0a['query'],_0x4b6de1[_0x4250('0x3c')]));if(_0x4efe0a[_0x4250('0x3b')][_0x4250('0x45')]){_0x432a6a[_0x4250('0x43')]=_[_0x4250('0x46')](_0x432a6a['where'],{'$or':_[_0x4250('0x3a')](_0x432a6a['attributes'],function(_0x11fa9e){var _0x15bc14={};_0x15bc14[_0x11fa9e]={'$like':'%'+_0x4efe0a[_0x4250('0x3b')][_0x4250('0x45')]+'%'};return _0x15bc14;})});}_0x432a6a=_[_0x4250('0x46')]({},_0x432a6a,_0x4efe0a['options']);return _0x525865[_0x4250('0x53')](_0x432a6a);}})[_0x4250('0x1d')](function(_0x2979fc){if(_0x2979fc){_0x5cccc4=_0x2979fc[_0x4250('0x3f')];if(!_0x4efe0a[_0x4250('0x3b')][_0x4250('0x40')]('nolimit')){_0x432a6a[_0x4250('0x2d')]=qs[_0x4250('0x2d')](_0x4efe0a[_0x4250('0x3b')][_0x4250('0x2d')]);_0x432a6a['offset']=qs[_0x4250('0x2c')](_0x4efe0a[_0x4250('0x3b')][_0x4250('0x2c')]);}return _0x525865['getConfigurations'](_0x432a6a);}})[_0x4250('0x1d')](function(_0x33ee8f){if(_0x33ee8f){return _0x33ee8f?{'count':_0x5cccc4,'rows':_0x33ee8f}:null;}})[_0x4250('0x1d')](respondWithResult(_0x455466,null))[_0x4250('0x49')](handleError(_0x455466,null));};exports[_0x4250('0x57')]=function(_0x183641,_0x54dc95,_0x474502){if(_0x183641[_0x4250('0x51')]['id']){delete _0x183641[_0x4250('0x51')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x183641['params']['id']}})['then'](handleEntityNotFound(_0x54dc95,null))['then'](function(_0x194dd2){if(_0x194dd2){_0x183641[_0x4250('0x51')][_0x4250('0x58')]=_0x194dd2['id'];_0x183641[_0x4250('0x51')]['Subjects']=integrations['getSubjects'](_0x183641[_0x4250('0x51')][_0x4250('0x59')],_0x183641[_0x4250('0x51')][_0x4250('0x37')]);_0x183641['body']['Descriptions']=integrations[_0x4250('0x5a')](_0x183641[_0x4250('0x51')][_0x4250('0x59')],_0x183641['body'][_0x4250('0x37')]);return db[_0x4250('0x55')][_0x4250('0x50')](_0x183641[_0x4250('0x51')],{'include':[{'model':db[_0x4250('0x5b')],'as':_0x4250('0x5c')},{'model':db['ZendeskField'],'as':_0x4250('0x5d')}]});}return null;})[_0x4250('0x1d')](respondWithResult(_0x54dc95,null))['catch'](handleError(_0x54dc95,null));};exports[_0x4250('0x5e')]=function(_0x24ea35,_0x267b76,_0x5cba81){var _0x145a21='';return db['ZendeskAccount'][_0x4250('0x54')]({'where':{'id':_0x24ea35[_0x4250('0x52')]['id']},'attributes':['id',_0x4250('0x5f'),_0x4250('0x60'),'token','authType',_0x4250('0x61')]})[_0x4250('0x1d')](handleEntityNotFound(_0x267b76,null))[_0x4250('0x1d')](function(_0x4f8a17){if(_0x4f8a17){_0x145a21=_0x4f8a17['remoteUri'];var _0x14d516=_0x145a21['slice'](-0x1);if(_0x14d516==='/'){_0x145a21=_0x145a21['substring'](0x0,_0x145a21[_0x4250('0x62')](_0x14d516));}var _0x38aee2={'method':_0x4250('0x63'),'uri':util['format'](_0x4250('0x64'),_0x145a21,_0x4250('0x65')),'json':!![]};switch(_0x4f8a17[_0x4250('0x66')]){case _0x4250('0x60'):_0x38aee2[_0x4250('0x67')]={'Authorization':util[_0x4250('0x68')]('Basic\x20%s',new Buffer(util[_0x4250('0x68')](_0x4250('0x69'),_0x4f8a17[_0x4250('0x5f')],_0x4f8a17[_0x4250('0x60')]))[_0x4250('0x6a')]('base64'))};break;case _0x4250('0x6b'):_0x38aee2[_0x4250('0x67')]={'Authorization':util[_0x4250('0x68')](_0x4250('0x6c'),new Buffer(util[_0x4250('0x68')](_0x4250('0x6d'),_0x4f8a17[_0x4250('0x5f')],_0x4f8a17['token']))[_0x4250('0x6a')](_0x4250('0x6e')))};break;default:throw new db[(_0x4250('0x6f'))][(_0x4250('0x70'))]('Unknown\x20authentication\x20type');}return rp(_0x38aee2);}})[_0x4250('0x1d')](function(_0x55138d){if(_0x55138d){var _0x20de34=[_0x4250('0x71'),_0x4250('0x72'),_0x4250('0x73'),'assignee'];_[_0x4250('0x74')](_0x55138d[_0x4250('0x65')],function(_0x18e735){return _0x20de34['includes'](_0x18e735[_0x4250('0x37')]);});return{'count':_0x55138d[_0x4250('0x65')][_0x4250('0x3f')],'rows':_[_0x4250('0x3a')](_0x55138d[_0x4250('0x65')],function(_0x4c9abf){return{'id':_0x4c9abf['id'],'name':_0x4c9abf[_0x4250('0x75')]>0x7?_0x4c9abf[_0x4250('0x76')]:_0x4c9abf[_0x4250('0x37')],'custom':_0x4c9abf[_0x4250('0x75')]>0x7?!![]:![],'options':_0x4c9abf[_0x4250('0x77')]?_0x4c9abf[_0x4250('0x77')]:_0x4c9abf[_0x4250('0x78')]?_0x4c9abf[_0x4250('0x78')]:[]};})};}})[_0x4250('0x1d')](respondWithResult(_0x267b76,null))[_0x4250('0x49')](function(_0x15b36a){var _0x4e0c85=_0x24ea35['query']['test']?0x1f4:_0x15b36a[_0x4250('0x79')]||0x1f4;logger[_0x4250('0x23')](_0x4250('0x7a'),_0x4250('0x5e'),_0x4e0c85,JSON['stringify'](_0x15b36a));delete _0x15b36a[_0x4250('0x32')];if(_0x4e0c85===0x191){_0x4e0c85=0x190;}_0x267b76[_0x4250('0x28')](_0x4e0c85)['send'](_0x24ea35[_0x4250('0x3b')][_0x4250('0x7b')]?{'message':_0x4250('0x7c'),'statusCode':_0x15b36a[_0x4250('0x79')]}:_0x15b36a);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1c7ade9..c2179b6 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 _0x49f0=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ef3c1,_0x25d5b8){var _0x496f2d=function(_0x41f383){while(--_0x41f383){_0x5ef3c1['push'](_0x5ef3c1['shift']());}};_0x496f2d(++_0x25d5b8);}(_0x49f0,0xf2));var _0x049f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x49f0[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x049f('0x0'));var util=require(_0x049f('0x1'));var logger=require(_0x049f('0x2'))(_0x049f('0x3'));var moment=require(_0x049f('0x4'));var BPromise=require(_0x049f('0x5'));var rp=require(_0x049f('0x6'));var fs=require('fs');var path=require(_0x049f('0x7'));var rimraf=require(_0x049f('0x8'));var config=require(_0x049f('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x049f('0xa')]=function(_0x229d29,_0x1db1f0){return _0x229d29[_0x049f('0xb')](_0x049f('0xc'),attributes,{'tableName':_0x049f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x495f=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3d08cc,_0x4efacd){var _0x2474f0=function(_0x409a03){while(--_0x409a03){_0x3d08cc['push'](_0x3d08cc['shift']());}};_0x2474f0(++_0x4efacd);}(_0x495f,0x159));var _0xf495=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x495f[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xf495('0x0'));var util=require(_0xf495('0x1'));var logger=require(_0xf495('0x2'))('api');var moment=require(_0xf495('0x3'));var BPromise=require(_0xf495('0x4'));var rp=require(_0xf495('0x5'));var fs=require('fs');var path=require(_0xf495('0x6'));var rimraf=require(_0xf495('0x7'));var config=require(_0xf495('0x8'));var attributes=require(_0xf495('0x9'));var integrations=require(_0xf495('0xa'));module[_0xf495('0xb')]=function(_0x5e5b8b,_0x2d5a60){return _0x5e5b8b[_0xf495('0xc')](_0xf495('0xd'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 06300ef..fe3b577 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 _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xb9081d,_0x450ac5){var _0x291b10=function(_0x5e2926){while(--_0x5e2926){_0xb9081d['push'](_0xb9081d['shift']());}};_0x291b10(++_0x450ac5);}(_0x757a,0xde));var _0xa757=function(_0x152396,_0x470a8b){_0x152396=_0x152396-0x0;var _0x238f4d=_0x757a[_0x152396];return _0x238f4d;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7fd68c9..9018eab 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 _0x3668=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create'];(function(_0x30c225,_0x10f56c){var _0x57d446=function(_0x3d452f){while(--_0x3d452f){_0x30c225['push'](_0x30c225['shift']());}};_0x57d446(++_0x10f56c);}(_0x3668,0x1a0));var _0x8366=function(_0x5d45c5,_0x489231){_0x5d45c5=_0x5d45c5-0x0;var _0x571892=_0x3668[_0x5d45c5];return _0x571892;};'use strict';var multer=require(_0x8366('0x0'));var util=require(_0x8366('0x1'));var path=require('path');var timeout=require(_0x8366('0x2'));var express=require(_0x8366('0x3'));var router=express[_0x8366('0x4')]();var auth=require(_0x8366('0x5'));var interaction=require(_0x8366('0x6'));var config=require(_0x8366('0x7'));var controller=require(_0x8366('0x8'));router[_0x8366('0x9')]('/',auth[_0x8366('0xa')](),controller[_0x8366('0xb')]);router[_0x8366('0x9')](_0x8366('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8366('0x9')](_0x8366('0xd'),auth[_0x8366('0xa')](),controller['getFields']);router[_0x8366('0x9')](_0x8366('0xe'),auth[_0x8366('0xa')](),controller[_0x8366('0xf')]);router['get'](_0x8366('0x10'),auth[_0x8366('0xa')](),controller[_0x8366('0x11')]);router['get'](_0x8366('0x12'),auth[_0x8366('0xa')](),controller['getTags']);router[_0x8366('0x13')]('/',auth[_0x8366('0xa')](),controller[_0x8366('0x14')]);router[_0x8366('0x13')](_0x8366('0x12'),auth[_0x8366('0xa')](),controller['setTags']);router['put'](_0x8366('0xc'),auth[_0x8366('0xa')](),controller['update']);router['delete'](_0x8366('0xc'),auth[_0x8366('0xa')](),controller[_0x8366('0x15')]);module[_0x8366('0x16')]=router; \ No newline at end of file +var _0xe70d=['create','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post'];(function(_0x14ca10,_0x3bb82b){var _0x414720=function(_0x2ec4b0){while(--_0x2ec4b0){_0x14ca10['push'](_0x14ca10['shift']());}};_0x414720(++_0x3bb82b);}(_0xe70d,0x1de));var _0xde70=function(_0x3fd31e,_0x3721fb){_0x3fd31e=_0x3fd31e-0x0;var _0x215072=_0xe70d[_0x3fd31e];return _0x215072;};'use strict';var multer=require(_0xde70('0x0'));var util=require(_0xde70('0x1'));var path=require(_0xde70('0x2'));var timeout=require(_0xde70('0x3'));var express=require(_0xde70('0x4'));var router=express['Router']();var auth=require(_0xde70('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde70('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0xde70('0x7')](),controller['index']);router[_0xde70('0x8')](_0xde70('0x9'),auth['isAuthenticated'](),controller[_0xde70('0xa')]);router[_0xde70('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xde70('0x8')](_0xde70('0xb'),auth[_0xde70('0x7')](),controller[_0xde70('0xc')]);router[_0xde70('0x8')]('/:id/descriptions',auth[_0xde70('0x7')](),controller[_0xde70('0xd')]);router[_0xde70('0x8')](_0xde70('0xe'),auth[_0xde70('0x7')](),controller['getTags']);router[_0xde70('0xf')]('/',auth['isAuthenticated'](),controller[_0xde70('0x10')]);router['post'](_0xde70('0xe'),auth['isAuthenticated'](),controller['setTags']);router['put'](_0xde70('0x9'),auth[_0xde70('0x7')](),controller[_0xde70('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xde70('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d099f97..f61f785 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 _0x34ea=['sequelize'];(function(_0x3ac4a2,_0x2d0c1f){var _0x2640a8=function(_0x4b539a){while(--_0x4b539a){_0x3ac4a2['push'](_0x3ac4a2['shift']());}};_0x2640a8(++_0x2d0c1f);}(_0x34ea,0xb5));var _0xa34e=function(_0x12f68d,_0x42e9c9){_0x12f68d=_0x12f68d-0x0;var _0xb983cc=_0x34ea[_0x12f68d];return _0xb983cc;};'use strict';var Sequelize=require(_0xa34e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x12dd=['STRING','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x12dd,0x142));var _0xd12d=function(_0x46e3ff,_0x50ca39){_0x46e3ff=_0x46e3ff-0x0;var _0x4bf847=_0x12dd[_0x46e3ff];return _0x4bf847;};'use strict';var Sequelize=require(_0xd12d('0x0'));module[_0xd12d('0x1')]={'name':{'type':Sequelize[_0xd12d('0x2')]},'description':{'type':Sequelize[_0xd12d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 47051d5..c6f7c91 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 _0xff4e=['api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','apply','save','update','destroy','sendStatus','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','body','getFields','ZendeskField','order','pick','getSubjects','findOne','nolimit','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x515562,_0x25f1ec){var _0x196305=function(_0x1da7c1){while(--_0x1da7c1){_0x515562['push'](_0x515562['shift']());}};_0x196305(++_0x25f1ec);}(_0xff4e,0x102));var _0xeff4=function(_0x3d3a25,_0x3496d8){_0x3d3a25=_0x3d3a25-0x0;var _0x13aa47=_0xff4e[_0x3d3a25];return _0x13aa47;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeff4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeff4('0x1'));var jsonpatch=require(_0xeff4('0x2'));var rp=require(_0xeff4('0x3'));var moment=require(_0xeff4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeff4('0x5'));var util=require(_0xeff4('0x6'));var path=require('path');var sox=require(_0xeff4('0x7'));var csv=require('to-csv');var ejs=require(_0xeff4('0x8'));var fs=require('fs');var _=require(_0xeff4('0x9'));var squel=require(_0xeff4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeff4('0xb'));var toCsv=require(_0xeff4('0xc'));var querystring=require(_0xeff4('0xd'));var Papa=require(_0xeff4('0xe'));var Redis=require('ioredis');var authService=require(_0xeff4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeff4('0x10'));var hardwareService=require(_0xeff4('0x11'));var logger=require('../../config/logger')(_0xeff4('0x12'));var utils=require(_0xeff4('0x13'));var config=require(_0xeff4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xeff4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xeff4('0x16')][_0xeff4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x38647f,_0x1a489d,_0x304437,_0x2e25b4){return new BPromise(function(_0x548da9,_0x2ff117){var _0x372f2e=_0x2e25b4||client;return _0x372f2e[_0xeff4('0x18')](_0x38647f,_0x304437)[_0xeff4('0x19')](function(_0x3a2aae){logger[_0xeff4('0x1a')](_0xeff4('0x1b'),_0x1a489d,'request\x20sent');logger[_0xeff4('0x1c')](_0xeff4('0x1d'),_0x1a489d,_0xeff4('0x1e'),JSON[_0xeff4('0x1f')](_0x3a2aae));if(_0x3a2aae[_0xeff4('0x20')]){if(_0x3a2aae[_0xeff4('0x20')][_0xeff4('0x21')]===0x1f4){logger[_0xeff4('0x20')](_0xeff4('0x1b'),_0x1a489d,_0x3a2aae['error']['message']);return _0x2ff117(_0x3a2aae[_0xeff4('0x20')]['message']);}logger[_0xeff4('0x20')](_0xeff4('0x1b'),_0x1a489d,_0x3a2aae['error'][_0xeff4('0x22')]);return _0x548da9(_0x3a2aae[_0xeff4('0x20')]['message']);}else{logger[_0xeff4('0x1a')](_0xeff4('0x1b'),_0x1a489d,_0xeff4('0x1e'));_0x548da9(_0x3a2aae[_0xeff4('0x23')][_0xeff4('0x22')]);}})[_0xeff4('0x24')](function(_0x63a54c){logger[_0xeff4('0x20')](_0xeff4('0x1b'),_0x1a489d,_0x63a54c);_0x2ff117(_0x63a54c);});});}function respondWithStatusCode(_0x56344b,_0xe2f0c8){_0xe2f0c8=_0xe2f0c8||0xcc;return function(_0x5218f9){if(_0x5218f9){return _0x56344b['sendStatus'](_0xe2f0c8);}return _0x56344b[_0xeff4('0x25')](_0xe2f0c8)[_0xeff4('0x26')]();};}function respondWithResult(_0x97cf59,_0x488b10){_0x488b10=_0x488b10||0xc8;return function(_0x379981){if(_0x379981){return _0x97cf59['status'](_0x488b10)[_0xeff4('0x27')](_0x379981);}};}function respondWithFilteredResult(_0x52e696,_0x26839d){return function(_0x4947d4){if(_0x4947d4){var _0x4b60eb=_0x4947d4[_0xeff4('0x28')],_0x54dac9=_0x26839d[_0xeff4('0x29')],_0xd20478=_0x26839d[_0xeff4('0x29')]+_0x26839d[_0xeff4('0x2a')],_0x48bce6;if(_0xd20478>=_0x4b60eb){_0xd20478=_0x4b60eb;_0x48bce6=0xc8;}else{_0x48bce6=0xce;}_0x52e696['status'](_0x48bce6);return _0x52e696[_0xeff4('0x2b')]('Content-Range',_0x54dac9+'-'+_0xd20478+'/'+_0x4b60eb)[_0xeff4('0x27')](_0x4947d4);}return null;};}function patchUpdates(_0x51d05f){return function(_0x26b28a){try{jsonpatch[_0xeff4('0x2c')](_0x26b28a,_0x51d05f,!![]);}catch(_0x1d02bc){return BPromise['reject'](_0x1d02bc);}return _0x26b28a[_0xeff4('0x2d')]();};}function saveUpdates(_0x38242e,_0x4e64ac){return function(_0x4cf48e){if(_0x4cf48e){return _0x4cf48e[_0xeff4('0x2e')](_0x38242e)[_0xeff4('0x19')](function(_0x412e15){return _0x412e15;});}return null;};}function removeEntity(_0xa38e16,_0x1d5839){return function(_0x1be6c9){if(_0x1be6c9){return _0x1be6c9[_0xeff4('0x2f')]()[_0xeff4('0x19')](function(){_0xa38e16[_0xeff4('0x25')](0xcc)[_0xeff4('0x26')]();});}};}function handleEntityNotFound(_0x478645,_0x2e59ab){return function(_0x57566c){if(!_0x57566c){_0x478645[_0xeff4('0x30')](0x194);}return _0x57566c;};}function handleError(_0x1d0512,_0x1134a9){_0x1134a9=_0x1134a9||0x1f4;return function(_0x10c16b){logger[_0xeff4('0x20')](_0x10c16b[_0xeff4('0x31')]);if(_0x10c16b[_0xeff4('0x32')]){delete _0x10c16b[_0xeff4('0x32')];}_0x1d0512[_0xeff4('0x25')](_0x1134a9)['send'](_0x10c16b);};}exports[_0xeff4('0x33')]=function(_0x6616cd,_0x3df6c5){var _0x440780={},_0x411716={},_0xb3bba7={'count':0x0,'rows':[]};var _0x50172e=_[_0xeff4('0x34')](db[_0xeff4('0x35')][_0xeff4('0x36')],function(_0x1b33c8){return{'name':_0x1b33c8[_0xeff4('0x37')],'type':_0x1b33c8[_0xeff4('0x38')][_0xeff4('0x39')]};});_0x411716[_0xeff4('0x3a')]=_['map'](_0x50172e,_0xeff4('0x32'));_0x411716[_0xeff4('0x3b')]=_['keys'](_0x6616cd[_0xeff4('0x3b')]);_0x411716[_0xeff4('0x3c')]=_[_0xeff4('0x3d')](_0x411716['model'],_0x411716[_0xeff4('0x3b')]);_0x440780[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x411716[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x440780[_0xeff4('0x3e')]=_0x440780['attributes'][_0xeff4('0x40')]?_0x440780['attributes']:_0x411716[_0xeff4('0x3a')];if(!_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x41')]('nolimit')){_0x440780[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x2a')]);_0x440780[_0xeff4('0x29')]=qs[_0xeff4('0x29')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x29')]);}_0x440780['order']=qs[_0xeff4('0x42')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x42')]);_0x440780[_0xeff4('0x43')]=qs['filters'](_['pick'](_0x6616cd[_0xeff4('0x3b')],_0x411716[_0xeff4('0x3c')]),_0x50172e);if(_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x44')]){_0x440780[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0x440780[_0xeff4('0x43')],{'$or':_['map'](_0x50172e,function(_0x4afa47){if(_0x4afa47[_0xeff4('0x38')]!==_0xeff4('0x46')){var _0x2112d7={};_0x2112d7[_0x4afa47[_0xeff4('0x32')]]={'$like':'%'+_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x44')]+'%'};return _0x2112d7;}})});}_0x440780=_[_0xeff4('0x45')]({},_0x440780,_0x6616cd[_0xeff4('0x47')]);var _0x348f9d={'where':_0x440780['where']};return db['ZendeskConfiguration'][_0xeff4('0x28')](_0x348f9d)[_0xeff4('0x19')](function(_0x4ba1f0){_0xb3bba7[_0xeff4('0x28')]=_0x4ba1f0;if(_0x6616cd['query'][_0xeff4('0x48')]){_0x440780[_0xeff4('0x49')]=[{'all':!![]}];}return db[_0xeff4('0x35')]['findAll'](_0x440780);})[_0xeff4('0x19')](function(_0x1b549f){_0xb3bba7[_0xeff4('0x4a')]=_0x1b549f;return _0xb3bba7;})['then'](respondWithFilteredResult(_0x3df6c5,_0x440780))['catch'](handleError(_0x3df6c5,null));};exports[_0xeff4('0x4b')]=function(_0x20b595,_0x31c486){var _0x274d09={'raw':![],'where':{'id':_0x20b595[_0xeff4('0x4c')]['id']}},_0x211aaa={};_0x211aaa[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db[_0xeff4('0x35')][_0xeff4('0x36')]);_0x211aaa[_0xeff4('0x3b')]=_['keys'](_0x20b595[_0xeff4('0x3b')]);_0x211aaa['filters']=_[_0xeff4('0x3d')](_0x211aaa['model'],_0x211aaa[_0xeff4('0x3b')]);_0x274d09[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x211aaa[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x20b595[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x274d09[_0xeff4('0x3e')]=_0x274d09['attributes'][_0xeff4('0x40')]?_0x274d09['attributes']:_0x211aaa['model'];if(_0x20b595[_0xeff4('0x3b')]['includeAll']){_0x274d09[_0xeff4('0x49')]=[{'all':!![]}];}_0x274d09=_[_0xeff4('0x45')]({},_0x274d09,_0x20b595[_0xeff4('0x47')]);return db[_0xeff4('0x35')][_0xeff4('0x4e')](_0x274d09)[_0xeff4('0x19')](handleEntityNotFound(_0x31c486,null))[_0xeff4('0x19')](respondWithResult(_0x31c486,null))[_0xeff4('0x24')](handleError(_0x31c486,null));};exports[_0xeff4('0x4f')]=function(_0x5f0668,_0x6ed8b9){return db[_0xeff4('0x35')][_0xeff4('0x4f')](_0x5f0668[_0xeff4('0x50')],{})[_0xeff4('0x19')](respondWithResult(_0x6ed8b9,0xc9))[_0xeff4('0x24')](handleError(_0x6ed8b9,null));};exports[_0xeff4('0x2e')]=function(_0x15a832,_0x5e8809){if(_0x15a832[_0xeff4('0x50')]['id']){delete _0x15a832[_0xeff4('0x50')]['id'];}return db[_0xeff4('0x35')]['find']({'where':{'id':_0x15a832[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x5e8809,null))[_0xeff4('0x19')](saveUpdates(_0x15a832[_0xeff4('0x50')],null))['then'](respondWithResult(_0x5e8809,null))[_0xeff4('0x24')](handleError(_0x5e8809,null));};exports['destroy']=function(_0x28e4a8,_0x5d0e20){return db[_0xeff4('0x35')]['find']({'where':{'id':_0x28e4a8[_0xeff4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d0e20,null))[_0xeff4('0x19')](removeEntity(_0x5d0e20,null))[_0xeff4('0x24')](handleError(_0x5d0e20,null));};exports[_0xeff4('0x51')]=function(_0x35b3d5,_0x289cc4,_0x20b144){var _0xda99b1={};var _0x6383a1={};var _0x1f0224;var _0x22378e;return db[_0xeff4('0x35')]['findOne']({'where':{'id':_0x35b3d5['params']['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x289cc4,null))[_0xeff4('0x19')](function(_0x5b4326){if(_0x5b4326){_0x1f0224=_0x5b4326;_0x6383a1[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db[_0xeff4('0x52')][_0xeff4('0x36')]);_0x6383a1[_0xeff4('0x3b')]=_['keys'](_0x35b3d5[_0xeff4('0x3b')]);_0x6383a1[_0xeff4('0x3c')]=_[_0xeff4('0x3d')](_0x6383a1[_0xeff4('0x3a')],_0x6383a1['query']);_0xda99b1['attributes']=_[_0xeff4('0x3d')](_0x6383a1[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x35b3d5['query']['fields']));_0xda99b1[_0xeff4('0x3e')]=_0xda99b1[_0xeff4('0x3e')][_0xeff4('0x40')]?_0xda99b1[_0xeff4('0x3e')]:_0x6383a1[_0xeff4('0x3a')];_0xda99b1[_0xeff4('0x53')]=qs[_0xeff4('0x42')](_0x35b3d5[_0xeff4('0x3b')]['sort']);_0xda99b1[_0xeff4('0x43')]=qs[_0xeff4('0x3c')](_[_0xeff4('0x54')](_0x35b3d5[_0xeff4('0x3b')],_0x6383a1['filters']));if(_0x35b3d5['query'][_0xeff4('0x44')]){_0xda99b1[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0xda99b1[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0xda99b1[_0xeff4('0x3e')],function(_0x1a4a3f){var _0x22fc40={};_0x22fc40[_0x1a4a3f]={'$like':'%'+_0x35b3d5['query'][_0xeff4('0x44')]+'%'};return _0x22fc40;})});}_0xda99b1=_[_0xeff4('0x45')]({},_0xda99b1,_0x35b3d5[_0xeff4('0x47')]);return _0x1f0224[_0xeff4('0x51')](_0xda99b1);}})['then'](function(_0x3e60f8){if(_0x3e60f8){_0x22378e=_0x3e60f8[_0xeff4('0x40')];if(!_0x35b3d5['query'][_0xeff4('0x41')]('nolimit')){_0xda99b1['limit']=qs['limit'](_0x35b3d5['query'][_0xeff4('0x2a')]);_0xda99b1['offset']=qs[_0xeff4('0x29')](_0x35b3d5[_0xeff4('0x3b')][_0xeff4('0x29')]);}return _0x1f0224[_0xeff4('0x51')](_0xda99b1);}})[_0xeff4('0x19')](function(_0x1314f8){if(_0x1314f8){return _0x1314f8?{'count':_0x22378e,'rows':_0x1314f8}:null;}})['then'](respondWithResult(_0x289cc4,null))['catch'](handleError(_0x289cc4,null));};exports[_0xeff4('0x55')]=function(_0x4737f6,_0x37f2a0,_0x3cedd0){var _0x16abe5={};var _0x4f841a={};var _0x5c7e71;var _0x4a1823;return db[_0xeff4('0x35')][_0xeff4('0x56')]({'where':{'id':_0x4737f6[_0xeff4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37f2a0,null))['then'](function(_0x3212a2){if(_0x3212a2){_0x5c7e71=_0x3212a2;_0x4f841a['model']=_[_0xeff4('0x4d')](db[_0xeff4('0x52')][_0xeff4('0x36')]);_0x4f841a[_0xeff4('0x3b')]=_[_0xeff4('0x4d')](_0x4737f6['query']);_0x4f841a['filters']=_[_0xeff4('0x3d')](_0x4f841a[_0xeff4('0x3a')],_0x4f841a[_0xeff4('0x3b')]);_0x16abe5[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x4f841a['model'],qs[_0xeff4('0x3f')](_0x4737f6[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x16abe5['attributes']=_0x16abe5[_0xeff4('0x3e')][_0xeff4('0x40')]?_0x16abe5[_0xeff4('0x3e')]:_0x4f841a[_0xeff4('0x3a')];_0x16abe5[_0xeff4('0x53')]=qs[_0xeff4('0x42')](_0x4737f6[_0xeff4('0x3b')]['sort']);_0x16abe5[_0xeff4('0x43')]=qs[_0xeff4('0x3c')](_[_0xeff4('0x54')](_0x4737f6[_0xeff4('0x3b')],_0x4f841a[_0xeff4('0x3c')]));if(_0x4737f6[_0xeff4('0x3b')]['filter']){_0x16abe5[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0x16abe5[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0x16abe5[_0xeff4('0x3e')],function(_0x420ca7){var _0x11140e={};_0x11140e[_0x420ca7]={'$like':'%'+_0x4737f6['query']['filter']+'%'};return _0x11140e;})});}_0x16abe5=_[_0xeff4('0x45')]({},_0x16abe5,_0x4737f6[_0xeff4('0x47')]);return _0x5c7e71[_0xeff4('0x55')](_0x16abe5);}})['then'](function(_0x4ce3c9){if(_0x4ce3c9){_0x4a1823=_0x4ce3c9[_0xeff4('0x40')];if(!_0x4737f6[_0xeff4('0x3b')][_0xeff4('0x41')](_0xeff4('0x57'))){_0x16abe5[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x4737f6['query'][_0xeff4('0x2a')]);_0x16abe5['offset']=qs[_0xeff4('0x29')](_0x4737f6['query']['offset']);}return _0x5c7e71[_0xeff4('0x55')](_0x16abe5);}})[_0xeff4('0x19')](function(_0x46d8bd){if(_0x46d8bd){return _0x46d8bd?{'count':_0x4a1823,'rows':_0x46d8bd}:null;}})[_0xeff4('0x19')](respondWithResult(_0x37f2a0,null))[_0xeff4('0x24')](handleError(_0x37f2a0,null));};exports[_0xeff4('0x58')]=function(_0x3c5c1e,_0x4fee37,_0x125cfe){var _0x54559b={};var _0x552e6e={};var _0x3a3c31;var _0x1b7d2c;return db[_0xeff4('0x35')][_0xeff4('0x56')]({'where':{'id':_0x3c5c1e[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x4fee37,null))[_0xeff4('0x19')](function(_0x2fc9e6){if(_0x2fc9e6){_0x3a3c31=_0x2fc9e6;_0x552e6e[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db[_0xeff4('0x52')][_0xeff4('0x36')]);_0x552e6e[_0xeff4('0x3b')]=_[_0xeff4('0x4d')](_0x3c5c1e[_0xeff4('0x3b')]);_0x552e6e['filters']=_[_0xeff4('0x3d')](_0x552e6e[_0xeff4('0x3a')],_0x552e6e['query']);_0x54559b[_0xeff4('0x3e')]=_['intersection'](_0x552e6e[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x3c5c1e[_0xeff4('0x3b')]['fields']));_0x54559b[_0xeff4('0x3e')]=_0x54559b[_0xeff4('0x3e')][_0xeff4('0x40')]?_0x54559b[_0xeff4('0x3e')]:_0x552e6e['model'];_0x54559b[_0xeff4('0x53')]=qs['sort'](_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x42')]);_0x54559b['where']=qs[_0xeff4('0x3c')](_[_0xeff4('0x54')](_0x3c5c1e[_0xeff4('0x3b')],_0x552e6e[_0xeff4('0x3c')]));if(_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x44')]){_0x54559b[_0xeff4('0x43')]=_['merge'](_0x54559b[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0x54559b[_0xeff4('0x3e')],function(_0x32b30d){var _0x4531cf={};_0x4531cf[_0x32b30d]={'$like':'%'+_0x3c5c1e[_0xeff4('0x3b')]['filter']+'%'};return _0x4531cf;})});}_0x54559b=_[_0xeff4('0x45')]({},_0x54559b,_0x3c5c1e[_0xeff4('0x47')]);return _0x3a3c31[_0xeff4('0x58')](_0x54559b);}})['then'](function(_0x1d5f45){if(_0x1d5f45){_0x1b7d2c=_0x1d5f45[_0xeff4('0x40')];if(!_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x41')](_0xeff4('0x57'))){_0x54559b[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x2a')]);_0x54559b[_0xeff4('0x29')]=qs[_0xeff4('0x29')](_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x29')]);}return _0x3a3c31[_0xeff4('0x58')](_0x54559b);}})[_0xeff4('0x19')](function(_0x3bb1f6){if(_0x3bb1f6){return _0x3bb1f6?{'count':_0x1b7d2c,'rows':_0x3bb1f6}:null;}})['then'](respondWithResult(_0x4fee37,null))[_0xeff4('0x24')](handleError(_0x4fee37,null));};exports[_0xeff4('0x59')]=function(_0x14e05b,_0x1d0f0e,_0x40b996){var _0x1df03e={};var _0x1da333={};var _0x441834;var _0x3f3f1d;return db[_0xeff4('0x35')][_0xeff4('0x56')]({'where':{'id':_0x14e05b[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x1d0f0e,null))[_0xeff4('0x19')](function(_0x41610c){if(_0x41610c){_0x441834=_0x41610c;_0x1da333[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db['Tag']['rawAttributes']);_0x1da333['query']=_[_0xeff4('0x4d')](_0x14e05b[_0xeff4('0x3b')]);_0x1da333[_0xeff4('0x3c')]=_[_0xeff4('0x3d')](_0x1da333[_0xeff4('0x3a')],_0x1da333[_0xeff4('0x3b')]);_0x1df03e[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x1da333[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x1df03e['attributes']=_0x1df03e['attributes'][_0xeff4('0x40')]?_0x1df03e[_0xeff4('0x3e')]:_0x1da333['model'];_0x1df03e[_0xeff4('0x53')]=qs[_0xeff4('0x42')](_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x42')]);_0x1df03e[_0xeff4('0x43')]=qs['filters'](_['pick'](_0x14e05b[_0xeff4('0x3b')],_0x1da333[_0xeff4('0x3c')]));if(_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x44')]){_0x1df03e[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0x1df03e[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0x1df03e[_0xeff4('0x3e')],function(_0x122af5){var _0x46e82a={};_0x46e82a[_0x122af5]={'$like':'%'+_0x14e05b['query'][_0xeff4('0x44')]+'%'};return _0x46e82a;})});}_0x1df03e=_[_0xeff4('0x45')]({},_0x1df03e,_0x14e05b[_0xeff4('0x47')]);return _0x441834['getTags'](_0x1df03e);}})['then'](function(_0x4278a9){if(_0x4278a9){_0x3f3f1d=_0x4278a9[_0xeff4('0x40')];if(!_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x41')](_0xeff4('0x57'))){_0x1df03e[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x2a')]);_0x1df03e['offset']=qs[_0xeff4('0x29')](_0x14e05b['query'][_0xeff4('0x29')]);}return _0x441834['getTags'](_0x1df03e);}})['then'](function(_0x232f30){if(_0x232f30){return _0x232f30?{'count':_0x3f3f1d,'rows':_0x232f30}:null;}})[_0xeff4('0x19')](respondWithResult(_0x1d0f0e,null))[_0xeff4('0x24')](handleError(_0x1d0f0e,null));};exports[_0xeff4('0x5a')]=function(_0x34ba8d,_0x56b2b0,_0x30df0a){if(_0x34ba8d[_0xeff4('0x50')]['id']){delete _0x34ba8d[_0xeff4('0x50')]['id'];}return db['ZendeskConfiguration'][_0xeff4('0x56')]({'where':{'id':_0x34ba8d[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x56b2b0,null))[_0xeff4('0x19')](function(_0x2360fe){if(_0x2360fe){return _0x2360fe[_0xeff4('0x5a')](_0x34ba8d[_0xeff4('0x50')][_0xeff4('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x56b2b0,null))[_0xeff4('0x24')](handleError(_0x56b2b0,null));}; \ No newline at end of file +var _0x80ae=['getSubjects','Tag','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','set','reject','save','update','destroy','stack','name','send','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','filter','options','count','includeAll','include','findAll','rows','show','body','find','params','getFields','findOne','ZendeskField'];(function(_0x4f71f6,_0x30e9cb){var _0x141a07=function(_0x4ce574){while(--_0x4ce574){_0x4f71f6['push'](_0x4f71f6['shift']());}};_0x141a07(++_0x30e9cb);}(_0x80ae,0x112));var _0xe80a=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x80ae[_0x470e67];return _0x28bbde;};'use strict';var pdf=require(_0xe80a('0x0'));var emlformat=require(_0xe80a('0x1'));var rimraf=require(_0xe80a('0x2'));var zipdir=require(_0xe80a('0x3'));var jsonpatch=require(_0xe80a('0x4'));var rp=require('request-promise');var moment=require(_0xe80a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe80a('0x6'));var util=require(_0xe80a('0x7'));var path=require(_0xe80a('0x8'));var sox=require(_0xe80a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe80a('0xa'));var squel=require(_0xe80a('0xb'));var crypto=require(_0xe80a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe80a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe80a('0xe'));var Papa=require(_0xe80a('0xf'));var Redis=require(_0xe80a('0x10'));var authService=require(_0xe80a('0x11'));var qs=require(_0xe80a('0x12'));var as=require(_0xe80a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe80a('0x14'))(_0xe80a('0x15'));var utils=require('../../config/utils');var config=require(_0xe80a('0x16'));var licenseUtil=require(_0xe80a('0x17'));var db=require(_0xe80a('0x18'))['db'];var jayson=require(_0xe80a('0x19'));var client=jayson[_0xe80a('0x1a')][_0xe80a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x501c11,_0x236a26,_0x1a51ca,_0x16497c){return new BPromise(function(_0x11e127,_0x418ea0){var _0x4af976=_0x16497c||client;return _0x4af976['request'](_0x501c11,_0x1a51ca)[_0xe80a('0x1c')](function(_0x5c0e97){logger[_0xe80a('0x1d')](_0xe80a('0x1e'),_0x236a26,'request\x20sent');logger[_0xe80a('0x1f')](_0xe80a('0x20'),_0x236a26,_0xe80a('0x21'),JSON['stringify'](_0x5c0e97));if(_0x5c0e97['error']){if(_0x5c0e97[_0xe80a('0x22')][_0xe80a('0x23')]===0x1f4){logger[_0xe80a('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x236a26,_0x5c0e97['error'][_0xe80a('0x24')]);return _0x418ea0(_0x5c0e97[_0xe80a('0x22')]['message']);}logger['error'](_0xe80a('0x1e'),_0x236a26,_0x5c0e97[_0xe80a('0x22')][_0xe80a('0x24')]);return _0x11e127(_0x5c0e97['error'][_0xe80a('0x24')]);}else{logger[_0xe80a('0x1d')](_0xe80a('0x1e'),_0x236a26,_0xe80a('0x21'));_0x11e127(_0x5c0e97['result'][_0xe80a('0x24')]);}})[_0xe80a('0x25')](function(_0x3455de){logger[_0xe80a('0x22')](_0xe80a('0x1e'),_0x236a26,_0x3455de);_0x418ea0(_0x3455de);});});}function respondWithStatusCode(_0xeed396,_0x2046e8){_0x2046e8=_0x2046e8||0xcc;return function(_0x3036ea){if(_0x3036ea){return _0xeed396[_0xe80a('0x26')](_0x2046e8);}return _0xeed396[_0xe80a('0x27')](_0x2046e8)[_0xe80a('0x28')]();};}function respondWithResult(_0x12e23d,_0xf884dd){_0xf884dd=_0xf884dd||0xc8;return function(_0x2c5728){if(_0x2c5728){return _0x12e23d['status'](_0xf884dd)[_0xe80a('0x29')](_0x2c5728);}};}function respondWithFilteredResult(_0x4a49a6,_0x32e113){return function(_0x695f75){if(_0x695f75){var _0x59137f=_0x695f75['count'],_0x10f9c3=_0x32e113[_0xe80a('0x2a')],_0x42984a=_0x32e113[_0xe80a('0x2a')]+_0x32e113['limit'],_0x508fcb;if(_0x42984a>=_0x59137f){_0x42984a=_0x59137f;_0x508fcb=0xc8;}else{_0x508fcb=0xce;}_0x4a49a6['status'](_0x508fcb);return _0x4a49a6[_0xe80a('0x2b')]('Content-Range',_0x10f9c3+'-'+_0x42984a+'/'+_0x59137f)[_0xe80a('0x29')](_0x695f75);}return null;};}function patchUpdates(_0x372dac){return function(_0x97890e){try{jsonpatch['apply'](_0x97890e,_0x372dac,!![]);}catch(_0x15a526){return BPromise[_0xe80a('0x2c')](_0x15a526);}return _0x97890e[_0xe80a('0x2d')]();};}function saveUpdates(_0x5d35f8,_0x484613){return function(_0x473c94){if(_0x473c94){return _0x473c94[_0xe80a('0x2e')](_0x5d35f8)[_0xe80a('0x1c')](function(_0x5f3435){return _0x5f3435;});}return null;};}function removeEntity(_0x414148,_0x422d5d){return function(_0xabc1ec){if(_0xabc1ec){return _0xabc1ec[_0xe80a('0x2f')]()['then'](function(){_0x414148[_0xe80a('0x27')](0xcc)[_0xe80a('0x28')]();});}};}function handleEntityNotFound(_0x2ee3fd,_0x1b2a3a){return function(_0x50dcc8){if(!_0x50dcc8){_0x2ee3fd[_0xe80a('0x26')](0x194);}return _0x50dcc8;};}function handleError(_0x5183e2,_0xdd6488){_0xdd6488=_0xdd6488||0x1f4;return function(_0x2f4a6f){logger[_0xe80a('0x22')](_0x2f4a6f[_0xe80a('0x30')]);if(_0x2f4a6f[_0xe80a('0x31')]){delete _0x2f4a6f[_0xe80a('0x31')];}_0x5183e2['status'](_0xdd6488)[_0xe80a('0x32')](_0x2f4a6f);};}exports['index']=function(_0x40c7c2,_0x14dda2){var _0x46b945={},_0x2c4992={},_0x4ebb40={'count':0x0,'rows':[]};var _0x491e39=_[_0xe80a('0x33')](db[_0xe80a('0x34')][_0xe80a('0x35')],function(_0x4c71c0){return{'name':_0x4c71c0['fieldName'],'type':_0x4c71c0[_0xe80a('0x36')][_0xe80a('0x37')]};});_0x2c4992[_0xe80a('0x38')]=_[_0xe80a('0x33')](_0x491e39,_0xe80a('0x31'));_0x2c4992[_0xe80a('0x39')]=_[_0xe80a('0x3a')](_0x40c7c2[_0xe80a('0x39')]);_0x2c4992[_0xe80a('0x3b')]=_[_0xe80a('0x3c')](_0x2c4992['model'],_0x2c4992[_0xe80a('0x39')]);_0x46b945[_0xe80a('0x3d')]=_[_0xe80a('0x3c')](_0x2c4992[_0xe80a('0x38')],qs[_0xe80a('0x3e')](_0x40c7c2[_0xe80a('0x39')][_0xe80a('0x3e')]));_0x46b945[_0xe80a('0x3d')]=_0x46b945[_0xe80a('0x3d')][_0xe80a('0x3f')]?_0x46b945[_0xe80a('0x3d')]:_0x2c4992[_0xe80a('0x38')];if(!_0x40c7c2[_0xe80a('0x39')][_0xe80a('0x40')](_0xe80a('0x41'))){_0x46b945[_0xe80a('0x42')]=qs[_0xe80a('0x42')](_0x40c7c2[_0xe80a('0x39')][_0xe80a('0x42')]);_0x46b945[_0xe80a('0x2a')]=qs[_0xe80a('0x2a')](_0x40c7c2[_0xe80a('0x39')][_0xe80a('0x2a')]);}_0x46b945[_0xe80a('0x43')]=qs[_0xe80a('0x44')](_0x40c7c2[_0xe80a('0x39')][_0xe80a('0x44')]);_0x46b945['where']=qs[_0xe80a('0x3b')](_[_0xe80a('0x45')](_0x40c7c2[_0xe80a('0x39')],_0x2c4992['filters']),_0x491e39);if(_0x40c7c2['query']['filter']){_0x46b945[_0xe80a('0x46')]=_[_0xe80a('0x47')](_0x46b945[_0xe80a('0x46')],{'$or':_[_0xe80a('0x33')](_0x491e39,function(_0x578a14){if(_0x578a14[_0xe80a('0x36')]!=='VIRTUAL'){var _0x470af7={};_0x470af7[_0x578a14['name']]={'$like':'%'+_0x40c7c2[_0xe80a('0x39')][_0xe80a('0x48')]+'%'};return _0x470af7;}})});}_0x46b945=_['merge']({},_0x46b945,_0x40c7c2[_0xe80a('0x49')]);var _0x529de1={'where':_0x46b945[_0xe80a('0x46')]};return db['ZendeskConfiguration'][_0xe80a('0x4a')](_0x529de1)[_0xe80a('0x1c')](function(_0x1abb32){_0x4ebb40[_0xe80a('0x4a')]=_0x1abb32;if(_0x40c7c2[_0xe80a('0x39')][_0xe80a('0x4b')]){_0x46b945[_0xe80a('0x4c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xe80a('0x4d')](_0x46b945);})[_0xe80a('0x1c')](function(_0x85cf0c){_0x4ebb40[_0xe80a('0x4e')]=_0x85cf0c;return _0x4ebb40;})['then'](respondWithFilteredResult(_0x14dda2,_0x46b945))[_0xe80a('0x25')](handleError(_0x14dda2,null));};exports[_0xe80a('0x4f')]=function(_0x219bf3,_0x3e29a2){var _0x1028d9={'raw':![],'where':{'id':_0x219bf3['params']['id']}},_0x140f15={};_0x140f15[_0xe80a('0x38')]=_[_0xe80a('0x3a')](db[_0xe80a('0x34')][_0xe80a('0x35')]);_0x140f15[_0xe80a('0x39')]=_['keys'](_0x219bf3[_0xe80a('0x39')]);_0x140f15[_0xe80a('0x3b')]=_[_0xe80a('0x3c')](_0x140f15['model'],_0x140f15['query']);_0x1028d9[_0xe80a('0x3d')]=_[_0xe80a('0x3c')](_0x140f15[_0xe80a('0x38')],qs[_0xe80a('0x3e')](_0x219bf3['query']['fields']));_0x1028d9['attributes']=_0x1028d9[_0xe80a('0x3d')]['length']?_0x1028d9['attributes']:_0x140f15[_0xe80a('0x38')];if(_0x219bf3[_0xe80a('0x39')][_0xe80a('0x4b')]){_0x1028d9[_0xe80a('0x4c')]=[{'all':!![]}];}_0x1028d9=_[_0xe80a('0x47')]({},_0x1028d9,_0x219bf3[_0xe80a('0x49')]);return db[_0xe80a('0x34')]['find'](_0x1028d9)['then'](handleEntityNotFound(_0x3e29a2,null))[_0xe80a('0x1c')](respondWithResult(_0x3e29a2,null))[_0xe80a('0x25')](handleError(_0x3e29a2,null));};exports['create']=function(_0x457a40,_0x381c3b){return db[_0xe80a('0x34')]['create'](_0x457a40['body'],{})[_0xe80a('0x1c')](respondWithResult(_0x381c3b,0xc9))[_0xe80a('0x25')](handleError(_0x381c3b,null));};exports[_0xe80a('0x2e')]=function(_0x497b31,_0x8c5da1){if(_0x497b31[_0xe80a('0x50')]['id']){delete _0x497b31[_0xe80a('0x50')]['id'];}return db[_0xe80a('0x34')][_0xe80a('0x51')]({'where':{'id':_0x497b31[_0xe80a('0x52')]['id']}})[_0xe80a('0x1c')](handleEntityNotFound(_0x8c5da1,null))[_0xe80a('0x1c')](saveUpdates(_0x497b31[_0xe80a('0x50')],null))[_0xe80a('0x1c')](respondWithResult(_0x8c5da1,null))[_0xe80a('0x25')](handleError(_0x8c5da1,null));};exports[_0xe80a('0x2f')]=function(_0x47ec5a,_0x3c579b){return db[_0xe80a('0x34')][_0xe80a('0x51')]({'where':{'id':_0x47ec5a[_0xe80a('0x52')]['id']}})[_0xe80a('0x1c')](handleEntityNotFound(_0x3c579b,null))[_0xe80a('0x1c')](removeEntity(_0x3c579b,null))[_0xe80a('0x25')](handleError(_0x3c579b,null));};exports[_0xe80a('0x53')]=function(_0x2036c8,_0x3c7683,_0x2eea20){var _0x59d3f3={};var _0x4b4b8b={};var _0x126b5c;var _0x171fcb;return db['ZendeskConfiguration'][_0xe80a('0x54')]({'where':{'id':_0x2036c8[_0xe80a('0x52')]['id']}})['then'](handleEntityNotFound(_0x3c7683,null))[_0xe80a('0x1c')](function(_0x13a8ec){if(_0x13a8ec){_0x126b5c=_0x13a8ec;_0x4b4b8b['model']=_[_0xe80a('0x3a')](db[_0xe80a('0x55')][_0xe80a('0x35')]);_0x4b4b8b[_0xe80a('0x39')]=_['keys'](_0x2036c8[_0xe80a('0x39')]);_0x4b4b8b[_0xe80a('0x3b')]=_[_0xe80a('0x3c')](_0x4b4b8b[_0xe80a('0x38')],_0x4b4b8b['query']);_0x59d3f3[_0xe80a('0x3d')]=_[_0xe80a('0x3c')](_0x4b4b8b[_0xe80a('0x38')],qs[_0xe80a('0x3e')](_0x2036c8[_0xe80a('0x39')][_0xe80a('0x3e')]));_0x59d3f3[_0xe80a('0x3d')]=_0x59d3f3['attributes'][_0xe80a('0x3f')]?_0x59d3f3[_0xe80a('0x3d')]:_0x4b4b8b['model'];_0x59d3f3[_0xe80a('0x43')]=qs[_0xe80a('0x44')](_0x2036c8['query'][_0xe80a('0x44')]);_0x59d3f3[_0xe80a('0x46')]=qs['filters'](_[_0xe80a('0x45')](_0x2036c8[_0xe80a('0x39')],_0x4b4b8b['filters']));if(_0x2036c8['query'][_0xe80a('0x48')]){_0x59d3f3[_0xe80a('0x46')]=_[_0xe80a('0x47')](_0x59d3f3[_0xe80a('0x46')],{'$or':_[_0xe80a('0x33')](_0x59d3f3[_0xe80a('0x3d')],function(_0x5509be){var _0x4a6eee={};_0x4a6eee[_0x5509be]={'$like':'%'+_0x2036c8['query'][_0xe80a('0x48')]+'%'};return _0x4a6eee;})});}_0x59d3f3=_['merge']({},_0x59d3f3,_0x2036c8[_0xe80a('0x49')]);return _0x126b5c[_0xe80a('0x53')](_0x59d3f3);}})[_0xe80a('0x1c')](function(_0x3a5865){if(_0x3a5865){_0x171fcb=_0x3a5865['length'];if(!_0x2036c8['query'][_0xe80a('0x40')](_0xe80a('0x41'))){_0x59d3f3['limit']=qs[_0xe80a('0x42')](_0x2036c8['query']['limit']);_0x59d3f3[_0xe80a('0x2a')]=qs[_0xe80a('0x2a')](_0x2036c8['query'][_0xe80a('0x2a')]);}return _0x126b5c[_0xe80a('0x53')](_0x59d3f3);}})[_0xe80a('0x1c')](function(_0x23f81d){if(_0x23f81d){return _0x23f81d?{'count':_0x171fcb,'rows':_0x23f81d}:null;}})[_0xe80a('0x1c')](respondWithResult(_0x3c7683,null))[_0xe80a('0x25')](handleError(_0x3c7683,null));};exports['getSubjects']=function(_0xfbd768,_0x3c6780,_0x35c70e){var _0x4324be={};var _0x1ca9cb={};var _0x240321;var _0x2dd842;return db['ZendeskConfiguration'][_0xe80a('0x54')]({'where':{'id':_0xfbd768[_0xe80a('0x52')]['id']}})[_0xe80a('0x1c')](handleEntityNotFound(_0x3c6780,null))[_0xe80a('0x1c')](function(_0x321cb2){if(_0x321cb2){_0x240321=_0x321cb2;_0x1ca9cb['model']=_[_0xe80a('0x3a')](db[_0xe80a('0x55')][_0xe80a('0x35')]);_0x1ca9cb['query']=_['keys'](_0xfbd768['query']);_0x1ca9cb[_0xe80a('0x3b')]=_[_0xe80a('0x3c')](_0x1ca9cb[_0xe80a('0x38')],_0x1ca9cb[_0xe80a('0x39')]);_0x4324be[_0xe80a('0x3d')]=_[_0xe80a('0x3c')](_0x1ca9cb[_0xe80a('0x38')],qs[_0xe80a('0x3e')](_0xfbd768[_0xe80a('0x39')][_0xe80a('0x3e')]));_0x4324be[_0xe80a('0x3d')]=_0x4324be[_0xe80a('0x3d')][_0xe80a('0x3f')]?_0x4324be[_0xe80a('0x3d')]:_0x1ca9cb[_0xe80a('0x38')];_0x4324be[_0xe80a('0x43')]=qs['sort'](_0xfbd768[_0xe80a('0x39')][_0xe80a('0x44')]);_0x4324be[_0xe80a('0x46')]=qs[_0xe80a('0x3b')](_[_0xe80a('0x45')](_0xfbd768[_0xe80a('0x39')],_0x1ca9cb[_0xe80a('0x3b')]));if(_0xfbd768[_0xe80a('0x39')]['filter']){_0x4324be[_0xe80a('0x46')]=_[_0xe80a('0x47')](_0x4324be[_0xe80a('0x46')],{'$or':_[_0xe80a('0x33')](_0x4324be['attributes'],function(_0x2e04e4){var _0x43913c={};_0x43913c[_0x2e04e4]={'$like':'%'+_0xfbd768[_0xe80a('0x39')][_0xe80a('0x48')]+'%'};return _0x43913c;})});}_0x4324be=_['merge']({},_0x4324be,_0xfbd768[_0xe80a('0x49')]);return _0x240321[_0xe80a('0x56')](_0x4324be);}})[_0xe80a('0x1c')](function(_0x5039d8){if(_0x5039d8){_0x2dd842=_0x5039d8[_0xe80a('0x3f')];if(!_0xfbd768[_0xe80a('0x39')]['hasOwnProperty']('nolimit')){_0x4324be[_0xe80a('0x42')]=qs[_0xe80a('0x42')](_0xfbd768[_0xe80a('0x39')][_0xe80a('0x42')]);_0x4324be[_0xe80a('0x2a')]=qs[_0xe80a('0x2a')](_0xfbd768['query']['offset']);}return _0x240321[_0xe80a('0x56')](_0x4324be);}})['then'](function(_0x2061e5){if(_0x2061e5){return _0x2061e5?{'count':_0x2dd842,'rows':_0x2061e5}:null;}})['then'](respondWithResult(_0x3c6780,null))[_0xe80a('0x25')](handleError(_0x3c6780,null));};exports['getDescriptions']=function(_0x16576f,_0x5c14e9,_0x128592){var _0x1de619={};var _0xea60d={};var _0x42965c;var _0xd9ef7d;return db[_0xe80a('0x34')]['findOne']({'where':{'id':_0x16576f[_0xe80a('0x52')]['id']}})[_0xe80a('0x1c')](handleEntityNotFound(_0x5c14e9,null))[_0xe80a('0x1c')](function(_0x2daef1){if(_0x2daef1){_0x42965c=_0x2daef1;_0xea60d[_0xe80a('0x38')]=_[_0xe80a('0x3a')](db[_0xe80a('0x55')][_0xe80a('0x35')]);_0xea60d['query']=_[_0xe80a('0x3a')](_0x16576f[_0xe80a('0x39')]);_0xea60d[_0xe80a('0x3b')]=_[_0xe80a('0x3c')](_0xea60d[_0xe80a('0x38')],_0xea60d[_0xe80a('0x39')]);_0x1de619[_0xe80a('0x3d')]=_[_0xe80a('0x3c')](_0xea60d[_0xe80a('0x38')],qs[_0xe80a('0x3e')](_0x16576f[_0xe80a('0x39')]['fields']));_0x1de619['attributes']=_0x1de619[_0xe80a('0x3d')][_0xe80a('0x3f')]?_0x1de619[_0xe80a('0x3d')]:_0xea60d[_0xe80a('0x38')];_0x1de619['order']=qs[_0xe80a('0x44')](_0x16576f['query'][_0xe80a('0x44')]);_0x1de619['where']=qs['filters'](_[_0xe80a('0x45')](_0x16576f['query'],_0xea60d[_0xe80a('0x3b')]));if(_0x16576f[_0xe80a('0x39')][_0xe80a('0x48')]){_0x1de619[_0xe80a('0x46')]=_['merge'](_0x1de619[_0xe80a('0x46')],{'$or':_['map'](_0x1de619[_0xe80a('0x3d')],function(_0x23ea8f){var _0x134c44={};_0x134c44[_0x23ea8f]={'$like':'%'+_0x16576f['query'][_0xe80a('0x48')]+'%'};return _0x134c44;})});}_0x1de619=_[_0xe80a('0x47')]({},_0x1de619,_0x16576f[_0xe80a('0x49')]);return _0x42965c['getDescriptions'](_0x1de619);}})['then'](function(_0x91d543){if(_0x91d543){_0xd9ef7d=_0x91d543[_0xe80a('0x3f')];if(!_0x16576f[_0xe80a('0x39')][_0xe80a('0x40')]('nolimit')){_0x1de619['limit']=qs['limit'](_0x16576f[_0xe80a('0x39')]['limit']);_0x1de619['offset']=qs['offset'](_0x16576f[_0xe80a('0x39')][_0xe80a('0x2a')]);}return _0x42965c['getDescriptions'](_0x1de619);}})[_0xe80a('0x1c')](function(_0x48f9bd){if(_0x48f9bd){return _0x48f9bd?{'count':_0xd9ef7d,'rows':_0x48f9bd}:null;}})[_0xe80a('0x1c')](respondWithResult(_0x5c14e9,null))[_0xe80a('0x25')](handleError(_0x5c14e9,null));};exports['getTags']=function(_0x1f180b,_0x400e7f,_0x2c8cca){var _0x37927b={};var _0x25ccbc={};var _0x4dc086;var _0x49c7af;return db[_0xe80a('0x34')][_0xe80a('0x54')]({'where':{'id':_0x1f180b[_0xe80a('0x52')]['id']}})['then'](handleEntityNotFound(_0x400e7f,null))[_0xe80a('0x1c')](function(_0x11dccd){if(_0x11dccd){_0x4dc086=_0x11dccd;_0x25ccbc['model']=_['keys'](db[_0xe80a('0x57')][_0xe80a('0x35')]);_0x25ccbc[_0xe80a('0x39')]=_[_0xe80a('0x3a')](_0x1f180b[_0xe80a('0x39')]);_0x25ccbc[_0xe80a('0x3b')]=_['intersection'](_0x25ccbc[_0xe80a('0x38')],_0x25ccbc['query']);_0x37927b[_0xe80a('0x3d')]=_[_0xe80a('0x3c')](_0x25ccbc[_0xe80a('0x38')],qs[_0xe80a('0x3e')](_0x1f180b[_0xe80a('0x39')][_0xe80a('0x3e')]));_0x37927b['attributes']=_0x37927b[_0xe80a('0x3d')][_0xe80a('0x3f')]?_0x37927b[_0xe80a('0x3d')]:_0x25ccbc['model'];_0x37927b[_0xe80a('0x43')]=qs['sort'](_0x1f180b['query'][_0xe80a('0x44')]);_0x37927b[_0xe80a('0x46')]=qs[_0xe80a('0x3b')](_[_0xe80a('0x45')](_0x1f180b['query'],_0x25ccbc[_0xe80a('0x3b')]));if(_0x1f180b[_0xe80a('0x39')][_0xe80a('0x48')]){_0x37927b['where']=_[_0xe80a('0x47')](_0x37927b['where'],{'$or':_[_0xe80a('0x33')](_0x37927b[_0xe80a('0x3d')],function(_0xac12ff){var _0x36f914={};_0x36f914[_0xac12ff]={'$like':'%'+_0x1f180b[_0xe80a('0x39')][_0xe80a('0x48')]+'%'};return _0x36f914;})});}_0x37927b=_['merge']({},_0x37927b,_0x1f180b[_0xe80a('0x49')]);return _0x4dc086[_0xe80a('0x58')](_0x37927b);}})['then'](function(_0x5268dc){if(_0x5268dc){_0x49c7af=_0x5268dc[_0xe80a('0x3f')];if(!_0x1f180b[_0xe80a('0x39')][_0xe80a('0x40')]('nolimit')){_0x37927b[_0xe80a('0x42')]=qs[_0xe80a('0x42')](_0x1f180b[_0xe80a('0x39')][_0xe80a('0x42')]);_0x37927b[_0xe80a('0x2a')]=qs['offset'](_0x1f180b[_0xe80a('0x39')][_0xe80a('0x2a')]);}return _0x4dc086[_0xe80a('0x58')](_0x37927b);}})[_0xe80a('0x1c')](function(_0x284c6e){if(_0x284c6e){return _0x284c6e?{'count':_0x49c7af,'rows':_0x284c6e}:null;}})[_0xe80a('0x1c')](respondWithResult(_0x400e7f,null))[_0xe80a('0x25')](handleError(_0x400e7f,null));};exports[_0xe80a('0x59')]=function(_0x4bcf25,_0x978669,_0x4a2df9){if(_0x4bcf25[_0xe80a('0x50')]['id']){delete _0x4bcf25[_0xe80a('0x50')]['id'];}return db[_0xe80a('0x34')][_0xe80a('0x54')]({'where':{'id':_0x4bcf25[_0xe80a('0x52')]['id']}})[_0xe80a('0x1c')](handleEntityNotFound(_0x978669,null))[_0xe80a('0x1c')](function(_0x2e514b){if(_0x2e514b){return _0x2e514b[_0xe80a('0x59')](_0x4bcf25['body']['ids']||[]);}return null;})[_0xe80a('0x1c')](respondWithResult(_0x978669,null))[_0xe80a('0x25')](handleError(_0x978669,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6589abf..6aa69e6 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 _0xc1c3=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash'];(function(_0x570ae4,_0x2e34d9){var _0x3d920c=function(_0x5d52cf){while(--_0x5d52cf){_0x570ae4['push'](_0x570ae4['shift']());}};_0x3d920c(++_0x2e34d9);}(_0xc1c3,0xe3));var _0x3c1c=function(_0xf50fb9,_0x1a0fc9){_0xf50fb9=_0xf50fb9-0x0;var _0x2d287e=_0xc1c3[_0xf50fb9];return _0x2d287e;};'use strict';var _=require(_0x3c1c('0x0'));var util=require(_0x3c1c('0x1'));var logger=require(_0x3c1c('0x2'))(_0x3c1c('0x3'));var moment=require(_0x3c1c('0x4'));var BPromise=require(_0x3c1c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c1c('0x6'));var config=require(_0x3c1c('0x7'));var attributes=require(_0x3c1c('0x8'));module[_0x3c1c('0x9')]=function(_0x559287,_0x62e098){return _0x559287[_0x3c1c('0xa')](_0x3c1c('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffcf=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger'];(function(_0x11fdb7,_0x53003b){var _0x22faf4=function(_0x321c37){while(--_0x321c37){_0x11fdb7['push'](_0x11fdb7['shift']());}};_0x22faf4(++_0x53003b);}(_0xffcf,0x1ed));var _0xfffc=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xffcf[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require('lodash');var util=require(_0xfffc('0x0'));var logger=require(_0xfffc('0x1'))(_0xfffc('0x2'));var moment=require(_0xfffc('0x3'));var BPromise=require('bluebird');var rp=require(_0xfffc('0x4'));var fs=require('fs');var path=require(_0xfffc('0x5'));var rimraf=require(_0xfffc('0x6'));var config=require(_0xfffc('0x7'));var attributes=require(_0xfffc('0x8'));module['exports']=function(_0x3c4222,_0x317a0c){return _0x3c4222['define'](_0xfffc('0x9'),attributes,{'tableName':_0xfffc('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 c4645c0..412d9cc 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 _0x8156=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8156,0x7c));var _0x6815=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8156[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6815('0x0'));var util=require('util');var moment=require(_0x6815('0x1'));var BPromise=require(_0x6815('0x2'));var rs=require(_0x6815('0x3'));var fs=require('fs');var Redis=require(_0x6815('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6815('0x5'));var logger=require(_0x6815('0x6'))(_0x6815('0x7'));var config=require(_0x6815('0x8'));var jayson=require(_0x6815('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xccf76,_0x4021b6,_0x466ba2){return new BPromise(function(_0xaaa308,_0x5c3d9b){return client[_0x6815('0xa')](_0xccf76,_0x466ba2)[_0x6815('0xb')](function(_0x14da6d){logger['info'](_0x6815('0xc'),_0x4021b6,_0x6815('0xd'));logger[_0x6815('0xe')](_0x6815('0xf'),_0x4021b6,_0x6815('0xd'),JSON['stringify'](_0x14da6d));if(_0x14da6d[_0x6815('0x10')]){if(_0x14da6d[_0x6815('0x10')][_0x6815('0x11')]===0x1f4){logger['error'](_0x6815('0xc'),_0x4021b6,_0x14da6d[_0x6815('0x10')][_0x6815('0x12')]);return _0x5c3d9b(_0x14da6d[_0x6815('0x10')][_0x6815('0x12')]);}logger[_0x6815('0x10')](_0x6815('0xc'),_0x4021b6,_0x14da6d[_0x6815('0x10')]['message']);return _0xaaa308(_0x14da6d[_0x6815('0x10')]['message']);}else{logger[_0x6815('0x13')](_0x6815('0xc'),_0x4021b6,_0x6815('0xd'));_0xaaa308(_0x14da6d[_0x6815('0x14')][_0x6815('0x12')]);}})['catch'](function(_0x3fcd8d){logger[_0x6815('0x10')](_0x6815('0xc'),_0x4021b6,_0x3fcd8d);_0x5c3d9b(_0x3fcd8d);});});} \ No newline at end of file +var _0x76a6=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5b9d15,_0x10b589){var _0x31fd41=function(_0x10a649){while(--_0x10a649){_0x5b9d15['push'](_0x5b9d15['shift']());}};_0x31fd41(++_0x10b589);}(_0x76a6,0x17e));var _0x676a=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0x76a6[_0x4c8232];return _0x3cc8e5;};'use strict';var _=require(_0x676a('0x0'));var util=require(_0x676a('0x1'));var moment=require(_0x676a('0x2'));var BPromise=require(_0x676a('0x3'));var rs=require(_0x676a('0x4'));var fs=require('fs');var Redis=require(_0x676a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x676a('0x6'))(_0x676a('0x7'));var config=require('../../config/environment');var jayson=require(_0x676a('0x8'));var client=jayson[_0x676a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cc134,_0xe8553c,_0x3f2ea1){return new BPromise(function(_0x4b759d,_0x354d48){return client[_0x676a('0xa')](_0x4cc134,_0x3f2ea1)['then'](function(_0xc89419){logger[_0x676a('0xb')](_0x676a('0xc'),_0xe8553c,_0x676a('0xd'));logger[_0x676a('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xe8553c,_0x676a('0xd'),JSON[_0x676a('0xf')](_0xc89419));if(_0xc89419[_0x676a('0x10')]){if(_0xc89419[_0x676a('0x10')][_0x676a('0x11')]===0x1f4){logger[_0x676a('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe8553c,_0xc89419['error']['message']);return _0x354d48(_0xc89419[_0x676a('0x10')]['message']);}logger['error'](_0x676a('0xc'),_0xe8553c,_0xc89419['error'][_0x676a('0x12')]);return _0x4b759d(_0xc89419[_0x676a('0x10')]['message']);}else{logger[_0x676a('0xb')](_0x676a('0xc'),_0xe8553c,_0x676a('0xd'));_0x4b759d(_0xc89419[_0x676a('0x13')]['message']);}})[_0x676a('0x14')](function(_0xf0ffd8){logger[_0x676a('0x10')](_0x676a('0xc'),_0xe8553c,_0xf0ffd8);_0x354d48(_0xf0ffd8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 17d8ae1..acb2b38 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 _0xbb94=['exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbb94,0xde));var _0x4bb9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbb94[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4bb9('0x0'));var timeout=require('connect-timeout');var express=require(_0x4bb9('0x1'));var router=express[_0x4bb9('0x2')]();var auth=require(_0x4bb9('0x3'));var interaction=require(_0x4bb9('0x4'));var config=require(_0x4bb9('0x5'));var controller=require(_0x4bb9('0x6'));router[_0x4bb9('0x7')]('/',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0x9')]);router['get'](_0x4bb9('0xa'),auth[_0x4bb9('0x8')](),controller[_0x4bb9('0xb')]);router['post']('/',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0xc')]);router['put'](_0x4bb9('0xa'),auth['isAuthenticated'](),controller[_0x4bb9('0xd')]);router[_0x4bb9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4bb9('0xf')]);module[_0x4bb9('0x10')]=router; \ No newline at end of file +var _0x41a0=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x41a0,0xd5));var _0x041a=function(_0x704111,_0x5b9436){_0x704111=_0x704111-0x0;var _0x2af47a=_0x41a0[_0x704111];return _0x2af47a;};'use strict';var multer=require(_0x041a('0x0'));var util=require('util');var path=require(_0x041a('0x1'));var timeout=require(_0x041a('0x2'));var express=require(_0x041a('0x3'));var router=express['Router']();var auth=require(_0x041a('0x4'));var interaction=require(_0x041a('0x5'));var config=require(_0x041a('0x6'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x041a('0x7')](),controller[_0x041a('0x8')]);router[_0x041a('0x9')]('/:id',auth[_0x041a('0x7')](),controller[_0x041a('0xa')]);router[_0x041a('0xb')]('/',auth[_0x041a('0x7')](),controller[_0x041a('0xc')]);router[_0x041a('0xd')](_0x041a('0xe'),auth[_0x041a('0x7')](),controller[_0x041a('0xf')]);router[_0x041a('0x10')](_0x041a('0xe'),auth[_0x041a('0x7')](),controller[_0x041a('0x11')]);module[_0x041a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 152ff2a..7ca3302 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 _0xe233=['variable','customVariable','BOOLEAN','sequelize','string','keyValue','STRING','ENUM'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xe233,0x15b));var _0x3e23=function(_0x3c0232,_0x4ad683){_0x3c0232=_0x3c0232-0x0;var _0x48aecf=_0xe233[_0x3c0232];return _0x48aecf;};'use strict';var Sequelize=require(_0x3e23('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3e23('0x1'),'variable','customVariable',_0x3e23('0x2')),'defaultValue':_0x3e23('0x1')},'content':{'type':Sequelize[_0x3e23('0x3')]},'key':{'type':Sequelize[_0x3e23('0x3')]},'keyType':{'type':Sequelize[_0x3e23('0x4')]('string',_0x3e23('0x5'),_0x3e23('0x6'))},'keyContent':{'type':Sequelize[_0x3e23('0x3')]},'idField':{'type':Sequelize[_0x3e23('0x3')]},'nameField':{'type':Sequelize[_0x3e23('0x3')]},'customField':{'type':Sequelize[_0x3e23('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e23('0x3')]}}; \ No newline at end of file +var _0xc18a=['keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xc18a,0x1cf));var _0xac18=function(_0xd10c,_0x1c027c){_0xd10c=_0xd10c-0x0;var _0x1d84af=_0xc18a[_0xd10c];return _0x1d84af;};'use strict';var Sequelize=require(_0xac18('0x0'));module[_0xac18('0x1')]={'type':{'type':Sequelize[_0xac18('0x2')](_0xac18('0x3'),'variable',_0xac18('0x4'),_0xac18('0x5')),'defaultValue':_0xac18('0x3')},'content':{'type':Sequelize[_0xac18('0x6')]},'key':{'type':Sequelize[_0xac18('0x6')]},'keyType':{'type':Sequelize[_0xac18('0x2')](_0xac18('0x3'),_0xac18('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xac18('0x6')]},'idField':{'type':Sequelize[_0xac18('0x6')]},'nameField':{'type':Sequelize[_0xac18('0x6')]},'customField':{'type':Sequelize[_0xac18('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xac18('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 892989e..2a1fa79 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 _0x524e=['rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','ZendeskField','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','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'];(function(_0x2cffb9,_0x523e9f){var _0x597d66=function(_0x47dab7){while(--_0x47dab7){_0x2cffb9['push'](_0x2cffb9['shift']());}};_0x597d66(++_0x523e9f);}(_0x524e,0x15e));var _0xe524=function(_0x2a89d7,_0x4a10cc){_0x2a89d7=_0x2a89d7-0x0;var _0x4a3078=_0x524e[_0x2a89d7];return _0x4a3078;};'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['ZendeskField'][_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['ZendeskField'][_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));}; \ No newline at end of file +var _0xed1c=['catch','create','body','html-pdf','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ZendeskField','include','findAll','rows','show','params','includeAll','find'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0xed1c,0xe4));var _0xced1=function(_0x4afbd7,_0x5c5bd9){_0x4afbd7=_0x4afbd7-0x0;var _0x379c40=_0xed1c[_0x4afbd7];return _0x379c40;};'use strict';var pdf=require(_0xced1('0x0'));var emlformat=require(_0xced1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xced1('0x2'));var BPromise=require(_0xced1('0x3'));var Mustache=require(_0xced1('0x4'));var util=require('util');var path=require(_0xced1('0x5'));var sox=require(_0xced1('0x6'));var csv=require(_0xced1('0x7'));var ejs=require(_0xced1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xced1('0x9'));var crypto=require(_0xced1('0xa'));var jsforce=require(_0xced1('0xb'));var deskjs=require(_0xced1('0xc'));var toCsv=require(_0xced1('0x7'));var querystring=require(_0xced1('0xd'));var Papa=require(_0xced1('0xe'));var Redis=require(_0xced1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xced1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xced1('0x11'));var logger=require(_0xced1('0x12'))(_0xced1('0x13'));var utils=require(_0xced1('0x14'));var config=require(_0xced1('0x15'));var licenseUtil=require(_0xced1('0x16'));var db=require(_0xced1('0x17'))['db'];function respondWithStatusCode(_0x5e5637,_0x118f69){_0x118f69=_0x118f69||0xcc;return function(_0x2a5cd6){if(_0x2a5cd6){return _0x5e5637[_0xced1('0x18')](_0x118f69);}return _0x5e5637[_0xced1('0x19')](_0x118f69)['end']();};}function respondWithResult(_0xdaaea7,_0x31a32c){_0x31a32c=_0x31a32c||0xc8;return function(_0x54cba9){if(_0x54cba9){return _0xdaaea7[_0xced1('0x19')](_0x31a32c)[_0xced1('0x1a')](_0x54cba9);}};}function respondWithFilteredResult(_0x3708b1,_0x32100b){return function(_0x47baec){if(_0x47baec){var _0x5560af=_0x47baec[_0xced1('0x1b')],_0x3eb3ac=_0x32100b[_0xced1('0x1c')],_0x4178d8=_0x32100b[_0xced1('0x1c')]+_0x32100b['limit'],_0x236473;if(_0x4178d8>=_0x5560af){_0x4178d8=_0x5560af;_0x236473=0xc8;}else{_0x236473=0xce;}_0x3708b1['status'](_0x236473);return _0x3708b1[_0xced1('0x1d')](_0xced1('0x1e'),_0x3eb3ac+'-'+_0x4178d8+'/'+_0x5560af)[_0xced1('0x1a')](_0x47baec);}return null;};}function patchUpdates(_0x5257e7){return function(_0x1eac14){try{jsonpatch[_0xced1('0x1f')](_0x1eac14,_0x5257e7,!![]);}catch(_0x3e51e4){return BPromise['reject'](_0x3e51e4);}return _0x1eac14[_0xced1('0x20')]();};}function saveUpdates(_0x42b146,_0x23ded4){return function(_0x4819fd){if(_0x4819fd){return _0x4819fd[_0xced1('0x21')](_0x42b146)[_0xced1('0x22')](function(_0xc1bd39){return _0xc1bd39;});}return null;};}function removeEntity(_0x5f1474,_0x4dab56){return function(_0x1d3884){if(_0x1d3884){return _0x1d3884[_0xced1('0x23')]()[_0xced1('0x22')](function(){_0x5f1474[_0xced1('0x19')](0xcc)[_0xced1('0x24')]();});}};}function handleEntityNotFound(_0x49c8b9,_0x14f47e){return function(_0xdd5a47){if(!_0xdd5a47){_0x49c8b9['sendStatus'](0x194);}return _0xdd5a47;};}function handleError(_0x5f2018,_0x38f738){_0x38f738=_0x38f738||0x1f4;return function(_0x258c9a){logger[_0xced1('0x25')](_0x258c9a[_0xced1('0x26')]);if(_0x258c9a[_0xced1('0x27')]){delete _0x258c9a[_0xced1('0x27')];}_0x5f2018['status'](_0x38f738)[_0xced1('0x28')](_0x258c9a);};}exports[_0xced1('0x29')]=function(_0x43cdec,_0x351afc){var _0x34dd2e={},_0x8b3ffb={},_0xaa36d6={'count':0x0,'rows':[]};var _0x4e9a37=_[_0xced1('0x2a')](db['ZendeskField'][_0xced1('0x2b')],function(_0x2c2269){return{'name':_0x2c2269[_0xced1('0x2c')],'type':_0x2c2269[_0xced1('0x2d')]['key']};});_0x8b3ffb['model']=_[_0xced1('0x2a')](_0x4e9a37,_0xced1('0x27'));_0x8b3ffb[_0xced1('0x2e')]=_['keys'](_0x43cdec['query']);_0x8b3ffb['filters']=_[_0xced1('0x2f')](_0x8b3ffb[_0xced1('0x30')],_0x8b3ffb[_0xced1('0x2e')]);_0x34dd2e[_0xced1('0x31')]=_['intersection'](_0x8b3ffb[_0xced1('0x30')],qs[_0xced1('0x32')](_0x43cdec[_0xced1('0x2e')][_0xced1('0x32')]));_0x34dd2e[_0xced1('0x31')]=_0x34dd2e[_0xced1('0x31')][_0xced1('0x33')]?_0x34dd2e['attributes']:_0x8b3ffb['model'];if(!_0x43cdec[_0xced1('0x2e')][_0xced1('0x34')](_0xced1('0x35'))){_0x34dd2e[_0xced1('0x36')]=qs[_0xced1('0x36')](_0x43cdec[_0xced1('0x2e')]['limit']);_0x34dd2e['offset']=qs['offset'](_0x43cdec['query'][_0xced1('0x1c')]);}_0x34dd2e[_0xced1('0x37')]=qs[_0xced1('0x38')](_0x43cdec[_0xced1('0x2e')][_0xced1('0x38')]);_0x34dd2e[_0xced1('0x39')]=qs[_0xced1('0x3a')](_[_0xced1('0x3b')](_0x43cdec[_0xced1('0x2e')],_0x8b3ffb[_0xced1('0x3a')]),_0x4e9a37);if(_0x43cdec[_0xced1('0x2e')][_0xced1('0x3c')]){_0x34dd2e[_0xced1('0x39')]=_['merge'](_0x34dd2e[_0xced1('0x39')],{'$or':_[_0xced1('0x2a')](_0x4e9a37,function(_0x1116de){if(_0x1116de[_0xced1('0x2d')]!==_0xced1('0x3d')){var _0x1bfd61={};_0x1bfd61[_0x1116de['name']]={'$like':'%'+_0x43cdec[_0xced1('0x2e')][_0xced1('0x3c')]+'%'};return _0x1bfd61;}})});}_0x34dd2e=_[_0xced1('0x3e')]({},_0x34dd2e,_0x43cdec[_0xced1('0x3f')]);var _0x282361={'where':_0x34dd2e[_0xced1('0x39')]};return db[_0xced1('0x40')][_0xced1('0x1b')](_0x282361)[_0xced1('0x22')](function(_0x359a10){_0xaa36d6[_0xced1('0x1b')]=_0x359a10;if(_0x43cdec['query']['includeAll']){_0x34dd2e[_0xced1('0x41')]=[{'all':!![]}];}return db[_0xced1('0x40')][_0xced1('0x42')](_0x34dd2e);})['then'](function(_0x393a3a){_0xaa36d6[_0xced1('0x43')]=_0x393a3a;return _0xaa36d6;})[_0xced1('0x22')](respondWithFilteredResult(_0x351afc,_0x34dd2e))['catch'](handleError(_0x351afc,null));};exports[_0xced1('0x44')]=function(_0x972ef5,_0x5a01f6){var _0x20ab72={'raw':!![],'where':{'id':_0x972ef5[_0xced1('0x45')]['id']}},_0x550276={};_0x550276[_0xced1('0x30')]=_['keys'](db[_0xced1('0x40')][_0xced1('0x2b')]);_0x550276[_0xced1('0x2e')]=_['keys'](_0x972ef5[_0xced1('0x2e')]);_0x550276[_0xced1('0x3a')]=_['intersection'](_0x550276[_0xced1('0x30')],_0x550276['query']);_0x20ab72['attributes']=_[_0xced1('0x2f')](_0x550276['model'],qs[_0xced1('0x32')](_0x972ef5[_0xced1('0x2e')][_0xced1('0x32')]));_0x20ab72['attributes']=_0x20ab72[_0xced1('0x31')]['length']?_0x20ab72[_0xced1('0x31')]:_0x550276[_0xced1('0x30')];if(_0x972ef5[_0xced1('0x2e')][_0xced1('0x46')]){_0x20ab72['include']=[{'all':!![]}];}_0x20ab72=_[_0xced1('0x3e')]({},_0x20ab72,_0x972ef5[_0xced1('0x3f')]);return db['ZendeskField'][_0xced1('0x47')](_0x20ab72)[_0xced1('0x22')](handleEntityNotFound(_0x5a01f6,null))['then'](respondWithResult(_0x5a01f6,null))[_0xced1('0x48')](handleError(_0x5a01f6,null));};exports[_0xced1('0x49')]=function(_0x1646df,_0x59f1ba){return db[_0xced1('0x40')][_0xced1('0x49')](_0x1646df[_0xced1('0x4a')],{})[_0xced1('0x22')](respondWithResult(_0x59f1ba,0xc9))[_0xced1('0x48')](handleError(_0x59f1ba,null));};exports['update']=function(_0x1482cc,_0x5e6669){if(_0x1482cc[_0xced1('0x4a')]['id']){delete _0x1482cc[_0xced1('0x4a')]['id'];}return db[_0xced1('0x40')][_0xced1('0x47')]({'where':{'id':_0x1482cc[_0xced1('0x45')]['id']}})[_0xced1('0x22')](handleEntityNotFound(_0x5e6669,null))['then'](saveUpdates(_0x1482cc[_0xced1('0x4a')],null))[_0xced1('0x22')](respondWithResult(_0x5e6669,null))['catch'](handleError(_0x5e6669,null));};exports[_0xced1('0x23')]=function(_0x5a717a,_0x5153a6){return db[_0xced1('0x40')][_0xced1('0x47')]({'where':{'id':_0x5a717a[_0xced1('0x45')]['id']}})[_0xced1('0x22')](handleEntityNotFound(_0x5153a6,null))['then'](removeEntity(_0x5153a6,null))[_0xced1('0x48')](handleError(_0x5153a6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7d74934..8c93c14 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 _0x4b6c=['rimraf','../../config/environment','exports','define','int_zendesk_fields','FieldId','lodash','util','api','moment','bluebird','path'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b6('0x0'));var util=require(_0xc4b6('0x1'));var logger=require('../../config/logger')(_0xc4b6('0x2'));var moment=require(_0xc4b6('0x3'));var BPromise=require(_0xc4b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4b6('0x5'));var rimraf=require(_0xc4b6('0x6'));var config=require(_0xc4b6('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xc4b6('0x8')]=function(_0x1d5e09,_0x21f368){return _0x1d5e09[_0xc4b6('0x9')]('ZendeskField',attributes,{'tableName':_0xc4b6('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xc4b6('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['FieldId','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x46695d,_0x2d610b){var _0x24d16d=function(_0x43d52d){while(--_0x43d52d){_0x46695d['push'](_0x46695d['shift']());}};_0x24d16d(++_0x2d610b);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x101a1f,_0x5c913c){_0x101a1f=_0x101a1f-0x0;var _0x582017=_0xe1e3[_0x101a1f];return _0x582017;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[{'name':_0x3e1e('0xa'),'fields':[_0x3e1e('0xb'),_0x3e1e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index da0f653..e283241 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 _0x0a2c=['request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s'];(function(_0x5295a9,_0x2881d6){var _0x455975=function(_0x478fca){while(--_0x478fca){_0x5295a9['push'](_0x5295a9['shift']());}};_0x455975(++_0x2881d6);}(_0x0a2c,0x1ea));var _0xc0a2=function(_0x2210b9,_0x3dcd57){_0x2210b9=_0x2210b9-0x0;var _0x4081fe=_0x0a2c[_0x2210b9];return _0x4081fe;};'use strict';var _=require(_0xc0a2('0x0'));var util=require(_0xc0a2('0x1'));var moment=require('moment');var BPromise=require(_0xc0a2('0x2'));var rs=require(_0xc0a2('0x3'));var fs=require('fs');var Redis=require(_0xc0a2('0x4'));var db=require(_0xc0a2('0x5'))['db'];var utils=require(_0xc0a2('0x6'));var logger=require('../../config/logger')(_0xc0a2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0a2('0x8'));var client=jayson[_0xc0a2('0x9')][_0xc0a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219afb,_0x49f24a,_0x3b7f9f){return new BPromise(function(_0x536b8d,_0x3fe55c){return client[_0xc0a2('0xb')](_0x219afb,_0x3b7f9f)['then'](function(_0x5f26c2){logger[_0xc0a2('0xc')](_0xc0a2('0xd'),_0x49f24a,_0xc0a2('0xe'));logger['debug'](_0xc0a2('0xf'),_0x49f24a,'request\x20sent',JSON[_0xc0a2('0x10')](_0x5f26c2));if(_0x5f26c2[_0xc0a2('0x11')]){if(_0x5f26c2['error'][_0xc0a2('0x12')]===0x1f4){logger[_0xc0a2('0x11')](_0xc0a2('0xd'),_0x49f24a,_0x5f26c2[_0xc0a2('0x11')][_0xc0a2('0x13')]);return _0x3fe55c(_0x5f26c2[_0xc0a2('0x11')]['message']);}logger[_0xc0a2('0x11')](_0xc0a2('0xd'),_0x49f24a,_0x5f26c2['error'][_0xc0a2('0x13')]);return _0x536b8d(_0x5f26c2[_0xc0a2('0x11')][_0xc0a2('0x13')]);}else{logger[_0xc0a2('0xc')]('ZendeskField,\x20%s,\x20%s',_0x49f24a,'request\x20sent');_0x536b8d(_0x5f26c2['result']['message']);}})[_0xc0a2('0x14')](function(_0x277647){logger[_0xc0a2('0x11')]('ZendeskField,\x20%s,\x20%s',_0x49f24a,_0x277647);_0x3fe55c(_0x277647);});});} \ No newline at end of file +var _0x6e49=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird','randomstring'];(function(_0x9503f2,_0x5f3eac){var _0x153921=function(_0x4b35df){while(--_0x4b35df){_0x9503f2['push'](_0x9503f2['shift']());}};_0x153921(++_0x5f3eac);}(_0x6e49,0xb5));var _0x96e4=function(_0x562adf,_0x4df415){_0x562adf=_0x562adf-0x0;var _0x34264e=_0x6e49[_0x562adf];return _0x34264e;};'use strict';var _=require('lodash');var util=require(_0x96e4('0x0'));var moment=require('moment');var BPromise=require(_0x96e4('0x1'));var rs=require(_0x96e4('0x2'));var fs=require('fs');var Redis=require(_0x96e4('0x3'));var db=require(_0x96e4('0x4'))['db'];var utils=require(_0x96e4('0x5'));var logger=require(_0x96e4('0x6'))(_0x96e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x96e4('0x8'));var client=jayson[_0x96e4('0x9')][_0x96e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c156c,_0x56d0de,_0x53f1bc){return new BPromise(function(_0x50eae7,_0x5df400){return client[_0x96e4('0xb')](_0x3c156c,_0x53f1bc)['then'](function(_0x3cf3fb){logger[_0x96e4('0xc')](_0x96e4('0xd'),_0x56d0de,'request\x20sent');logger[_0x96e4('0xe')](_0x96e4('0xf'),_0x56d0de,'request\x20sent',JSON[_0x96e4('0x10')](_0x3cf3fb));if(_0x3cf3fb[_0x96e4('0x11')]){if(_0x3cf3fb[_0x96e4('0x11')][_0x96e4('0x12')]===0x1f4){logger['error'](_0x96e4('0xd'),_0x56d0de,_0x3cf3fb[_0x96e4('0x11')][_0x96e4('0x13')]);return _0x5df400(_0x3cf3fb[_0x96e4('0x11')][_0x96e4('0x13')]);}logger['error'](_0x96e4('0xd'),_0x56d0de,_0x3cf3fb[_0x96e4('0x11')][_0x96e4('0x13')]);return _0x50eae7(_0x3cf3fb[_0x96e4('0x11')]['message']);}else{logger[_0x96e4('0xc')](_0x96e4('0xd'),_0x56d0de,_0x96e4('0x14'));_0x50eae7(_0x3cf3fb[_0x96e4('0x15')][_0x96e4('0x13')]);}})[_0x96e4('0x16')](function(_0x53680b){logger[_0x96e4('0x11')](_0x96e4('0xd'),_0x56d0de,_0x53680b);_0x5df400(_0x53680b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f77b996..395e3b0 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(_0x4fc675,_0x184e51){var _0x11d333=function(_0x3fce63){while(--_0x3fce63){_0x4fc675['push'](_0x4fc675['shift']());}};_0x11d333(++_0x184e51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x54d13e,_0x50bfc8){var _0xb528a2=function(_0x5b5d89){while(--_0x5b5d89){_0x54d13e['push'](_0x54d13e['shift']());}};_0xb528a2(++_0x50bfc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['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 eb824fd..47d1da7 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 _0x2938=['STRING','exports'];(function(_0x17365a,_0x5d3831){var _0x14db7d=function(_0x2f5905){while(--_0x2f5905){_0x17365a['push'](_0x17365a['shift']());}};_0x14db7d(++_0x5d3831);}(_0x2938,0x101));var _0x8293=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2938[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x8293('0x0')]={'name':{'type':Sequelize[_0x8293('0x1')]},'description':{'type':Sequelize[_0x8293('0x1')]},'host':{'type':Sequelize[_0x8293('0x1')]},'zone':{'type':Sequelize[_0x8293('0x1')]},'clientId':{'type':Sequelize[_0x8293('0x1')]},'clientSecret':{'type':Sequelize[_0x8293('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x8293('0x1')]}}; \ No newline at end of file +var _0x58fd=['STRING','sequelize','exports'];(function(_0x17f025,_0x9f54a9){var _0x47ae5=function(_0x579e60){while(--_0x579e60){_0x17f025['push'](_0x17f025['shift']());}};_0x47ae5(++_0x9f54a9);}(_0x58fd,0xc1));var _0xd58f=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x58fd[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0xd58f('0x0'));module[_0xd58f('0x1')]={'name':{'type':Sequelize[_0xd58f('0x2')]},'description':{'type':Sequelize[_0xd58f('0x2')]},'host':{'type':Sequelize[_0xd58f('0x2')]},'zone':{'type':Sequelize[_0xd58f('0x2')]},'clientId':{'type':Sequelize[_0xd58f('0x2')]},'clientSecret':{'type':Sequelize[_0xd58f('0x2')]},'serverUrl':{'type':Sequelize[_0xd58f('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd58f('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 264eb84..6c72033 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 _0x7177=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','Content-Range','apply','destroy','end','name','send','index','map','ZohoAccount','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','params','include','merge','find','create','body','update','getConfigurations','findOne','length','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','zoho.eu','com','serverUrl','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x560b33,_0x54a69c){var _0x15c35e=function(_0x58d087){while(--_0x58d087){_0x560b33['push'](_0x560b33['shift']());}};_0x15c35e(++_0x54a69c);}(_0x7177,0x101));var _0x7717=function(_0x5eb6e6,_0x17f551){_0x5eb6e6=_0x5eb6e6-0x0;var _0x35c38b=_0x7177[_0x5eb6e6];return _0x35c38b;};'use strict';var pdf=require(_0x7717('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7717('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7717('0x2'));var rp=require(_0x7717('0x3'));var moment=require('moment');var BPromise=require(_0x7717('0x4'));var Mustache=require(_0x7717('0x5'));var util=require('util');var path=require(_0x7717('0x6'));var sox=require(_0x7717('0x7'));var csv=require(_0x7717('0x8'));var ejs=require(_0x7717('0x9'));var fs=require('fs');var _=require(_0x7717('0xa'));var squel=require(_0x7717('0xb'));var crypto=require(_0x7717('0xc'));var jsforce=require(_0x7717('0xd'));var deskjs=require(_0x7717('0xe'));var toCsv=require(_0x7717('0x8'));var querystring=require(_0x7717('0xf'));var Papa=require('papaparse');var Redis=require(_0x7717('0x10'));var authService=require(_0x7717('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7717('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7717('0x13'))(_0x7717('0x14'));var utils=require(_0x7717('0x15'));var config=require(_0x7717('0x16'));var licenseUtil=require(_0x7717('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7717('0x18'));var jayson=require(_0x7717('0x19'));var client=jayson[_0x7717('0x1a')][_0x7717('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x196ed2,_0x439e10,_0x3490f9,_0x55c30b){return new BPromise(function(_0xcb6d5c,_0x2cbe7b){var _0x445bfd=_0x55c30b||client;return _0x445bfd[_0x7717('0x1c')](_0x196ed2,_0x3490f9)[_0x7717('0x1d')](function(_0x782bd0){logger[_0x7717('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x439e10,'request\x20sent');logger[_0x7717('0x1f')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x439e10,_0x7717('0x20'),JSON['stringify'](_0x782bd0));if(_0x782bd0[_0x7717('0x21')]){if(_0x782bd0[_0x7717('0x21')][_0x7717('0x22')]===0x1f4){logger['error'](_0x7717('0x23'),_0x439e10,_0x782bd0[_0x7717('0x21')][_0x7717('0x24')]);return _0x2cbe7b(_0x782bd0[_0x7717('0x21')][_0x7717('0x24')]);}logger['error'](_0x7717('0x23'),_0x439e10,_0x782bd0[_0x7717('0x21')][_0x7717('0x24')]);return _0xcb6d5c(_0x782bd0[_0x7717('0x21')]['message']);}else{logger[_0x7717('0x1e')](_0x7717('0x23'),_0x439e10,_0x7717('0x20'));_0xcb6d5c(_0x782bd0['result'][_0x7717('0x24')]);}})[_0x7717('0x25')](function(_0x73eda0){logger['error'](_0x7717('0x23'),_0x439e10,_0x73eda0);_0x2cbe7b(_0x73eda0);});});}function respondWithStatusCode(_0x11f0bc,_0x2e9001){_0x2e9001=_0x2e9001||0xcc;return function(_0x32ee21){if(_0x32ee21){return _0x11f0bc[_0x7717('0x26')](_0x2e9001);}return _0x11f0bc[_0x7717('0x27')](_0x2e9001)['end']();};}function respondWithResult(_0x33e592,_0x584fa6){_0x584fa6=_0x584fa6||0xc8;return function(_0x431d91){if(_0x431d91){return _0x33e592[_0x7717('0x27')](_0x584fa6)[_0x7717('0x28')](_0x431d91);}};}function respondWithFilteredResult(_0x1ec800,_0xa4428b){return function(_0x2f3de2){if(_0x2f3de2){var _0x7fa7a7=_0x2f3de2[_0x7717('0x29')],_0x59e312=_0xa4428b[_0x7717('0x2a')],_0x7eab8=_0xa4428b['offset']+_0xa4428b['limit'],_0x117309;if(_0x7eab8>=_0x7fa7a7){_0x7eab8=_0x7fa7a7;_0x117309=0xc8;}else{_0x117309=0xce;}_0x1ec800['status'](_0x117309);return _0x1ec800['set'](_0x7717('0x2b'),_0x59e312+'-'+_0x7eab8+'/'+_0x7fa7a7)['json'](_0x2f3de2);}return null;};}function patchUpdates(_0x2090eb){return function(_0x29330e){try{jsonpatch[_0x7717('0x2c')](_0x29330e,_0x2090eb,!![]);}catch(_0x20e1cb){return BPromise['reject'](_0x20e1cb);}return _0x29330e['save']();};}function saveUpdates(_0x5b1ee3,_0x103f08){return function(_0x4c1f6a){if(_0x4c1f6a){return _0x4c1f6a['update'](_0x5b1ee3)['then'](function(_0x18bf7a){return _0x18bf7a;});}return null;};}function removeEntity(_0x2bf307,_0x110c82){return function(_0x4b667d){if(_0x4b667d){return _0x4b667d[_0x7717('0x2d')]()[_0x7717('0x1d')](function(){_0x2bf307['status'](0xcc)[_0x7717('0x2e')]();});}};}function handleEntityNotFound(_0x5d631b,_0xb28550){return function(_0x47b7ec){if(!_0x47b7ec){_0x5d631b['sendStatus'](0x194);}return _0x47b7ec;};}function handleError(_0x320e02,_0x144a9b){_0x144a9b=_0x144a9b||0x1f4;return function(_0x5040df){logger[_0x7717('0x21')](_0x5040df['stack']);if(_0x5040df[_0x7717('0x2f')]){delete _0x5040df[_0x7717('0x2f')];}_0x320e02['status'](_0x144a9b)[_0x7717('0x30')](_0x5040df);};}exports[_0x7717('0x31')]=function(_0x59e70a,_0x4368a8){var _0x59a7c6={},_0x2d6bb2={},_0xafe32d={'count':0x0,'rows':[]};var _0x3f9e48=_[_0x7717('0x32')](db[_0x7717('0x33')][_0x7717('0x34')],function(_0x2f6b15){return{'name':_0x2f6b15['fieldName'],'type':_0x2f6b15['type'][_0x7717('0x35')]};});_0x2d6bb2['model']=_[_0x7717('0x32')](_0x3f9e48,'name');_0x2d6bb2[_0x7717('0x36')]=_[_0x7717('0x37')](_0x59e70a[_0x7717('0x36')]);_0x2d6bb2[_0x7717('0x38')]=_[_0x7717('0x39')](_0x2d6bb2['model'],_0x2d6bb2[_0x7717('0x36')]);_0x59a7c6[_0x7717('0x3a')]=_[_0x7717('0x39')](_0x2d6bb2[_0x7717('0x3b')],qs[_0x7717('0x3c')](_0x59e70a[_0x7717('0x36')][_0x7717('0x3c')]));_0x59a7c6[_0x7717('0x3a')]=_0x59a7c6[_0x7717('0x3a')]['length']?_0x59a7c6[_0x7717('0x3a')]:_0x2d6bb2['model'];if(!_0x59e70a[_0x7717('0x36')][_0x7717('0x3d')](_0x7717('0x3e'))){_0x59a7c6[_0x7717('0x3f')]=qs[_0x7717('0x3f')](_0x59e70a[_0x7717('0x36')][_0x7717('0x3f')]);_0x59a7c6[_0x7717('0x2a')]=qs[_0x7717('0x2a')](_0x59e70a['query'][_0x7717('0x2a')]);}_0x59a7c6[_0x7717('0x40')]=qs['sort'](_0x59e70a[_0x7717('0x36')][_0x7717('0x41')]);_0x59a7c6[_0x7717('0x42')]=qs['filters'](_[_0x7717('0x43')](_0x59e70a[_0x7717('0x36')],_0x2d6bb2[_0x7717('0x38')]),_0x3f9e48);if(_0x59e70a[_0x7717('0x36')][_0x7717('0x44')]){_0x59a7c6[_0x7717('0x42')]=_['merge'](_0x59a7c6[_0x7717('0x42')],{'$or':_[_0x7717('0x32')](_0x3f9e48,function(_0x32f6a1){if(_0x32f6a1['type']!==_0x7717('0x45')){var _0x5ad751={};_0x5ad751[_0x32f6a1[_0x7717('0x2f')]]={'$like':'%'+_0x59e70a[_0x7717('0x36')][_0x7717('0x44')]+'%'};return _0x5ad751;}})});}_0x59a7c6=_['merge']({},_0x59a7c6,_0x59e70a[_0x7717('0x46')]);var _0x444a25={'where':_0x59a7c6['where']};return db[_0x7717('0x33')][_0x7717('0x29')](_0x444a25)[_0x7717('0x1d')](function(_0x2f9c8a){_0xafe32d[_0x7717('0x29')]=_0x2f9c8a;if(_0x59e70a[_0x7717('0x36')][_0x7717('0x47')]){_0x59a7c6['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x7717('0x48')](_0x59a7c6);})[_0x7717('0x1d')](function(_0x1db3ad){_0xafe32d[_0x7717('0x49')]=_0x1db3ad;return _0xafe32d;})[_0x7717('0x1d')](respondWithFilteredResult(_0x4368a8,_0x59a7c6))[_0x7717('0x25')](handleError(_0x4368a8,null));};exports['show']=function(_0xcd57ab,_0x2385ad){var _0xbe83c4={'raw':![],'where':{'id':_0xcd57ab[_0x7717('0x4a')]['id']}},_0x54f197={};_0x54f197[_0x7717('0x3b')]=_[_0x7717('0x37')](db[_0x7717('0x33')][_0x7717('0x34')]);_0x54f197['query']=_[_0x7717('0x37')](_0xcd57ab['query']);_0x54f197[_0x7717('0x38')]=_[_0x7717('0x39')](_0x54f197['model'],_0x54f197['query']);_0xbe83c4[_0x7717('0x3a')]=_['intersection'](_0x54f197['model'],qs[_0x7717('0x3c')](_0xcd57ab[_0x7717('0x36')][_0x7717('0x3c')]));_0xbe83c4['attributes']=_0xbe83c4[_0x7717('0x3a')]['length']?_0xbe83c4['attributes']:_0x54f197[_0x7717('0x3b')];if(_0xcd57ab[_0x7717('0x36')][_0x7717('0x47')]){_0xbe83c4[_0x7717('0x4b')]=[{'all':!![]}];}_0xbe83c4=_[_0x7717('0x4c')]({},_0xbe83c4,_0xcd57ab['options']);return db[_0x7717('0x33')][_0x7717('0x4d')](_0xbe83c4)['then'](handleEntityNotFound(_0x2385ad,null))[_0x7717('0x1d')](respondWithResult(_0x2385ad,null))[_0x7717('0x25')](handleError(_0x2385ad,null));};exports[_0x7717('0x4e')]=function(_0x378929,_0x2e1bb3){return db[_0x7717('0x33')]['create'](_0x378929[_0x7717('0x4f')],{})[_0x7717('0x1d')](respondWithResult(_0x2e1bb3,0xc9))[_0x7717('0x25')](handleError(_0x2e1bb3,null));};exports[_0x7717('0x50')]=function(_0x5015be,_0x12c57a){if(_0x5015be['body']['id']){delete _0x5015be[_0x7717('0x4f')]['id'];}return db['ZohoAccount'][_0x7717('0x4d')]({'where':{'id':_0x5015be['params']['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x12c57a,null))[_0x7717('0x1d')](saveUpdates(_0x5015be[_0x7717('0x4f')],null))['then'](respondWithResult(_0x12c57a,null))[_0x7717('0x25')](handleError(_0x12c57a,null));};exports['destroy']=function(_0x4ff30d,_0x28a5e6){return db[_0x7717('0x33')]['find']({'where':{'id':_0x4ff30d['params']['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x28a5e6,null))[_0x7717('0x1d')](removeEntity(_0x28a5e6,null))[_0x7717('0x25')](handleError(_0x28a5e6,null));};exports[_0x7717('0x51')]=function(_0x5e9992,_0x1053aa,_0x38e365){var _0x1d3477={};var _0x1e146={};var _0x192469;var _0x307f7e;return db[_0x7717('0x33')][_0x7717('0x52')]({'where':{'id':_0x5e9992[_0x7717('0x4a')]['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x1053aa,null))[_0x7717('0x1d')](function(_0x939d4a){if(_0x939d4a){_0x192469=_0x939d4a;_0x1e146[_0x7717('0x3b')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x1e146[_0x7717('0x36')]=_[_0x7717('0x37')](_0x5e9992[_0x7717('0x36')]);_0x1e146[_0x7717('0x38')]=_[_0x7717('0x39')](_0x1e146[_0x7717('0x3b')],_0x1e146[_0x7717('0x36')]);_0x1d3477[_0x7717('0x3a')]=_[_0x7717('0x39')](_0x1e146[_0x7717('0x3b')],qs['fields'](_0x5e9992[_0x7717('0x36')]['fields']));_0x1d3477[_0x7717('0x3a')]=_0x1d3477[_0x7717('0x3a')][_0x7717('0x53')]?_0x1d3477['attributes']:_0x1e146[_0x7717('0x3b')];_0x1d3477[_0x7717('0x40')]=qs[_0x7717('0x41')](_0x5e9992['query']['sort']);_0x1d3477[_0x7717('0x42')]=qs['filters'](_[_0x7717('0x43')](_0x5e9992[_0x7717('0x36')],_0x1e146[_0x7717('0x38')]));if(_0x5e9992['query']['filter']){_0x1d3477[_0x7717('0x42')]=_[_0x7717('0x4c')](_0x1d3477[_0x7717('0x42')],{'$or':_[_0x7717('0x32')](_0x1d3477[_0x7717('0x3a')],function(_0x126ca4){var _0x410c4e={};_0x410c4e[_0x126ca4]={'$like':'%'+_0x5e9992[_0x7717('0x36')][_0x7717('0x44')]+'%'};return _0x410c4e;})});}_0x1d3477=_['merge']({},_0x1d3477,_0x5e9992[_0x7717('0x46')]);return _0x192469['getConfigurations'](_0x1d3477);}})['then'](function(_0x476fb8){if(_0x476fb8){_0x307f7e=_0x476fb8[_0x7717('0x53')];if(!_0x5e9992[_0x7717('0x36')][_0x7717('0x3d')](_0x7717('0x3e'))){_0x1d3477[_0x7717('0x3f')]=qs['limit'](_0x5e9992[_0x7717('0x36')][_0x7717('0x3f')]);_0x1d3477[_0x7717('0x2a')]=qs[_0x7717('0x2a')](_0x5e9992['query'][_0x7717('0x2a')]);}return _0x192469[_0x7717('0x51')](_0x1d3477);}})[_0x7717('0x1d')](function(_0x1f4d73){if(_0x1f4d73){return _0x1f4d73?{'count':_0x307f7e,'rows':_0x1f4d73}:null;}})[_0x7717('0x1d')](respondWithResult(_0x1053aa,null))[_0x7717('0x25')](handleError(_0x1053aa,null));};exports[_0x7717('0x54')]=function(_0x18acb8,_0x22c6ed,_0x5c2ca4){if(_0x18acb8[_0x7717('0x4f')]['id']){delete _0x18acb8[_0x7717('0x4f')]['id'];}return db[_0x7717('0x33')][_0x7717('0x52')]({'where':{'id':_0x18acb8['params']['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x22c6ed,null))[_0x7717('0x1d')](function(_0x8185af){if(_0x8185af){_0x18acb8[_0x7717('0x4f')]['AccountId']=_0x8185af['id'];_0x18acb8[_0x7717('0x4f')][_0x7717('0x55')]=integrations['getSubjects'](_0x18acb8[_0x7717('0x4f')][_0x7717('0x56')],_0x18acb8[_0x7717('0x4f')][_0x7717('0x57')]);_0x18acb8['body'][_0x7717('0x58')]=integrations[_0x7717('0x59')](_0x18acb8[_0x7717('0x4f')][_0x7717('0x56')],_0x18acb8['body'][_0x7717('0x57')]);return db['ZohoConfiguration'][_0x7717('0x4e')](_0x18acb8[_0x7717('0x4f')],{'include':[{'model':db[_0x7717('0x5a')],'as':_0x7717('0x55')},{'model':db[_0x7717('0x5a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x22c6ed,null))[_0x7717('0x25')](handleError(_0x22c6ed,null));};function getAccessToken(_0x4066e0){return new Promise(function(_0x4914d4,_0x3f221d){var _0x1475ee;switch(_0x4066e0[_0x7717('0x5b')]){case'US':_0x1475ee='https://accounts.zoho.com';break;case'AU':_0x1475ee=_0x7717('0x5c');break;case'EU':_0x1475ee=_0x7717('0x5d');break;case'IN':_0x1475ee='https://accounts.zoho.in';break;case'CN':_0x1475ee=_0x7717('0x5e');break;default:_0x1475ee=_0x7717('0x5d');break;}var _0x1f5dae={'method':_0x7717('0x5f'),'uri':_0x1475ee+_0x7717('0x60'),'qs':{'refresh_token':_0x4066e0[_0x7717('0x61')],'client_id':_0x4066e0['clientId'],'client_secret':_0x4066e0[_0x7717('0x62')],'grant_type':_0x7717('0x63')},'json':!![]};return rp(_0x1f5dae)[_0x7717('0x1d')](function(_0xe3cf9a){if(_0xe3cf9a[_0x7717('0x64')]){_0x4914d4(_0xe3cf9a[_0x7717('0x64')]);}else{_0x3f221d(_0x7717('0x65'));}})[_0x7717('0x25')](function(_0x3d7edb){_0x3f221d(_0x3d7edb);});});}exports['getFields']=function(_0x820e20,_0x300aa7,_0x585587){var _0x13eb0e,_0x1938f0,_0x51a6d1,_0x1a1652,_0x390128;return db[_0x7717('0x33')][_0x7717('0x52')]({'where':{'id':_0x820e20[_0x7717('0x4a')]['id']},'attributes':['id',_0x7717('0x66'),_0x7717('0x5b'),_0x7717('0x67'),'clientSecret','serverUrl','code',_0x7717('0x61')]})[_0x7717('0x1d')](handleEntityNotFound(_0x300aa7,null))['then'](function(_0x50cb15){_0x390128=_0x50cb15;_0x13eb0e=_0x390128[_0x7717('0x66')];_0x1938f0=_0x13eb0e===_0x7717('0x68')?'eu':_0x7717('0x69');_0x51a6d1=_0x390128[_0x7717('0x6a')];var _0x31f2de=_0x51a6d1['slice'](-0x1);if(_0x31f2de==='/'||_0x31f2de==='\x5c'||_0x31f2de===':'){_0x51a6d1=_0x51a6d1['substring'](0x0,_0x51a6d1[_0x7717('0x6b')](_0x31f2de));}if(!_0x390128[_0x7717('0x61')]){throw new Error(_0x7717('0x6c'));}return getAccessToken(_0x390128);})['then'](function(_0x22990d){if(_0x22990d){return rp({'method':_0x7717('0x6d'),'uri':util[_0x7717('0x6e')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1938f0),'qs':{'module':_0x7717('0x6f')},'headers':{'Authorization':_0x7717('0x70')+_0x22990d},'json':!![]});}})[_0x7717('0x1d')](function(_0xb95373){if(_0xb95373){if(_0xb95373[_0x7717('0x71')]&&_0xb95373[_0x7717('0x71')][_0x7717('0x21')]){throw new Error(_0xb95373[_0x7717('0x71')][_0x7717('0x21')][_0x7717('0x24')]);}var _0x583911=[];var _0x75f62f=[];var _0x4c022b=['Owner',_0x7717('0x72'),_0x7717('0x73'),'WhoId',_0x7717('0x74'),_0x7717('0x75'),'Call_Start_Time',_0x7717('0x76')];_0x75f62f=_[_0x7717('0x77')](_0xb95373[_0x7717('0x3c')],function(_0x101352){return _0x4c022b[_0x7717('0x78')](_0x101352[_0x7717('0x79')]);});for(var _0x156515=0x0;_0x156515<_0x75f62f[_0x7717('0x53')];_0x156515++){if(_0x75f62f[_0x156515][_0x7717('0x7a')]===![]){_0x583911[_0x7717('0x7b')]({'id':_0x75f62f[_0x156515]['id'],'name':_0x75f62f[_0x156515][_0x7717('0x7c')],'custom':_0x75f62f[_0x156515][_0x7717('0x7d')],'options':_0x75f62f[_0x156515][_0x7717('0x7e')]===_0x7717('0x7f')&&_0x75f62f[_0x156515][_0x7717('0x80')][_0x7717('0x53')]>-0x1?_[_0x7717('0x32')](_0x75f62f[_0x156515][_0x7717('0x80')],function(_0x3bb931){return{'name':_0x3bb931,'value':_0x3bb931};}):[]});}}return{'count':_0x583911['length'],'rows':_0x583911};}else{return{'count':0x0,'rows':[]};}})[_0x7717('0x1d')](respondWithResult(_0x300aa7,null))['catch'](function(_0x479ed6){var _0x5421a9=_0x820e20[_0x7717('0x36')]['test']?0x1f4:_0x479ed6[_0x7717('0x81')]||0x1f4;logger[_0x7717('0x21')](_0x7717('0x82'),'getFields',_0x5421a9,JSON[_0x7717('0x83')](_0x479ed6));delete _0x479ed6[_0x7717('0x2f')];if(_0x5421a9===0x191){_0x5421a9=0x190;}_0x300aa7[_0x7717('0x27')](_0x5421a9)[_0x7717('0x30')](_0x820e20['query'][_0x7717('0x84')]?{'message':_0x7717('0x85'),'statusCode':_0x479ed6['statusCode']}:_0x479ed6);});}; \ No newline at end of file +var _0xb10b=['Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','statusCode','getFields','send','test','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','map','filters','intersection','model','attributes','query','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','show','params','keys','length','includeAll','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','pick','AccountId','channel','Descriptions','ZohoField','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','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration'];(function(_0x5b925a,_0x195869){var _0x42ba00=function(_0x491b0a){while(--_0x491b0a){_0x5b925a['push'](_0x5b925a['shift']());}};_0x42ba00(++_0x195869);}(_0xb10b,0x12a));var _0xbb10=function(_0x34f470,_0x464db5){_0x34f470=_0x34f470-0x0;var _0x3ac6cd=_0xb10b[_0x34f470];return _0x3ac6cd;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x18'))['db'];var integrations=require(_0xbb10('0x19'));var jayson=require(_0xbb10('0x1a'));var client=jayson[_0xbb10('0x1b')][_0xbb10('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x147230,_0x58a612,_0x26e021,_0x42d7e4){return new BPromise(function(_0x45b9d6,_0x17fd46){var _0x3df17b=_0x42d7e4||client;return _0x3df17b[_0xbb10('0x1d')](_0x147230,_0x26e021)[_0xbb10('0x1e')](function(_0x36b5e8){logger[_0xbb10('0x1f')](_0xbb10('0x20'),_0x58a612,'request\x20sent');logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x58a612,_0xbb10('0x23'),JSON[_0xbb10('0x24')](_0x36b5e8));if(_0x36b5e8[_0xbb10('0x25')]){if(_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x26')]===0x1f4){logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x36b5e8[_0xbb10('0x25')]['message']);return _0x17fd46(_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x27')]);}logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x27')]);return _0x45b9d6(_0x36b5e8['error'][_0xbb10('0x27')]);}else{logger[_0xbb10('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x58a612,'request\x20sent');_0x45b9d6(_0x36b5e8[_0xbb10('0x28')][_0xbb10('0x27')]);}})[_0xbb10('0x29')](function(_0x317da4){logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x317da4);_0x17fd46(_0x317da4);});});}function respondWithStatusCode(_0x407cb4,_0x436104){_0x436104=_0x436104||0xcc;return function(_0x7f2377){if(_0x7f2377){return _0x407cb4[_0xbb10('0x2a')](_0x436104);}return _0x407cb4[_0xbb10('0x2b')](_0x436104)[_0xbb10('0x2c')]();};}function respondWithResult(_0x537898,_0x4fedac){_0x4fedac=_0x4fedac||0xc8;return function(_0x4fb5e0){if(_0x4fb5e0){return _0x537898[_0xbb10('0x2b')](_0x4fedac)[_0xbb10('0x2d')](_0x4fb5e0);}};}function respondWithFilteredResult(_0x2c89b9,_0x4e25ff){return function(_0x2fdde9){if(_0x2fdde9){var _0x24d586=_0x2fdde9[_0xbb10('0x2e')],_0x6ed43b=_0x4e25ff[_0xbb10('0x2f')],_0x1d5e95=_0x4e25ff['offset']+_0x4e25ff[_0xbb10('0x30')],_0x1acce9;if(_0x1d5e95>=_0x24d586){_0x1d5e95=_0x24d586;_0x1acce9=0xc8;}else{_0x1acce9=0xce;}_0x2c89b9[_0xbb10('0x2b')](_0x1acce9);return _0x2c89b9[_0xbb10('0x31')](_0xbb10('0x32'),_0x6ed43b+'-'+_0x1d5e95+'/'+_0x24d586)[_0xbb10('0x2d')](_0x2fdde9);}return null;};}function patchUpdates(_0x2ff4c1){return function(_0x5d5c80){try{jsonpatch[_0xbb10('0x33')](_0x5d5c80,_0x2ff4c1,!![]);}catch(_0x4ee02e){return BPromise[_0xbb10('0x34')](_0x4ee02e);}return _0x5d5c80['save']();};}function saveUpdates(_0x16ad2a,_0x1dcc9c){return function(_0x1b59f9){if(_0x1b59f9){return _0x1b59f9['update'](_0x16ad2a)['then'](function(_0x4c3744){return _0x4c3744;});}return null;};}function removeEntity(_0x34f65e,_0x4f590d){return function(_0x359ad4){if(_0x359ad4){return _0x359ad4[_0xbb10('0x35')]()[_0xbb10('0x1e')](function(){_0x34f65e[_0xbb10('0x2b')](0xcc)[_0xbb10('0x2c')]();});}};}function handleEntityNotFound(_0x138bc6,_0xf85197){return function(_0x4975f5){if(!_0x4975f5){_0x138bc6[_0xbb10('0x2a')](0x194);}return _0x4975f5;};}function handleError(_0x1da9c9,_0x441d15){_0x441d15=_0x441d15||0x1f4;return function(_0x8c1ce6){logger[_0xbb10('0x25')](_0x8c1ce6[_0xbb10('0x36')]);if(_0x8c1ce6[_0xbb10('0x37')]){delete _0x8c1ce6[_0xbb10('0x37')];}_0x1da9c9[_0xbb10('0x2b')](_0x441d15)['send'](_0x8c1ce6);};}exports[_0xbb10('0x38')]=function(_0x150107,_0x1ddd9e){var _0x3c3c45={},_0x570f5a={},_0x111762={'count':0x0,'rows':[]};var _0x5de37b=_['map'](db[_0xbb10('0x39')][_0xbb10('0x3a')],function(_0x26e76a){return{'name':_0x26e76a[_0xbb10('0x3b')],'type':_0x26e76a[_0xbb10('0x3c')][_0xbb10('0x3d')]};});_0x570f5a['model']=_[_0xbb10('0x3e')](_0x5de37b,_0xbb10('0x37'));_0x570f5a['query']=_['keys'](_0x150107['query']);_0x570f5a[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x570f5a[_0xbb10('0x41')],_0x570f5a['query']);_0x3c3c45[_0xbb10('0x42')]=_[_0xbb10('0x40')](_0x570f5a[_0xbb10('0x41')],qs['fields'](_0x150107[_0xbb10('0x43')][_0xbb10('0x44')]));_0x3c3c45[_0xbb10('0x42')]=_0x3c3c45[_0xbb10('0x42')]['length']?_0x3c3c45[_0xbb10('0x42')]:_0x570f5a[_0xbb10('0x41')];if(!_0x150107['query'][_0xbb10('0x45')](_0xbb10('0x46'))){_0x3c3c45[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x150107[_0xbb10('0x43')][_0xbb10('0x30')]);_0x3c3c45['offset']=qs[_0xbb10('0x2f')](_0x150107[_0xbb10('0x43')][_0xbb10('0x2f')]);}_0x3c3c45[_0xbb10('0x47')]=qs['sort'](_0x150107[_0xbb10('0x43')][_0xbb10('0x48')]);_0x3c3c45[_0xbb10('0x49')]=qs[_0xbb10('0x3f')](_['pick'](_0x150107[_0xbb10('0x43')],_0x570f5a[_0xbb10('0x3f')]),_0x5de37b);if(_0x150107['query']['filter']){_0x3c3c45[_0xbb10('0x49')]=_['merge'](_0x3c3c45[_0xbb10('0x49')],{'$or':_[_0xbb10('0x3e')](_0x5de37b,function(_0x4c66d8){if(_0x4c66d8[_0xbb10('0x3c')]!==_0xbb10('0x4a')){var _0x474e99={};_0x474e99[_0x4c66d8['name']]={'$like':'%'+_0x150107[_0xbb10('0x43')][_0xbb10('0x4b')]+'%'};return _0x474e99;}})});}_0x3c3c45=_[_0xbb10('0x4c')]({},_0x3c3c45,_0x150107[_0xbb10('0x4d')]);var _0x36e1fa={'where':_0x3c3c45[_0xbb10('0x49')]};return db[_0xbb10('0x39')][_0xbb10('0x2e')](_0x36e1fa)[_0xbb10('0x1e')](function(_0x43b948){_0x111762[_0xbb10('0x2e')]=_0x43b948;if(_0x150107[_0xbb10('0x43')]['includeAll']){_0x3c3c45[_0xbb10('0x4e')]=[{'all':!![]}];}return db[_0xbb10('0x39')]['findAll'](_0x3c3c45);})[_0xbb10('0x1e')](function(_0x2f5027){_0x111762[_0xbb10('0x4f')]=_0x2f5027;return _0x111762;})[_0xbb10('0x1e')](respondWithFilteredResult(_0x1ddd9e,_0x3c3c45))[_0xbb10('0x29')](handleError(_0x1ddd9e,null));};exports[_0xbb10('0x50')]=function(_0x3e06b0,_0x5be85e){var _0x4a9793={'raw':![],'where':{'id':_0x3e06b0[_0xbb10('0x51')]['id']}},_0xcb3354={};_0xcb3354[_0xbb10('0x41')]=_['keys'](db['ZohoAccount'][_0xbb10('0x3a')]);_0xcb3354[_0xbb10('0x43')]=_[_0xbb10('0x52')](_0x3e06b0[_0xbb10('0x43')]);_0xcb3354[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0xcb3354[_0xbb10('0x41')],_0xcb3354[_0xbb10('0x43')]);_0x4a9793[_0xbb10('0x42')]=_[_0xbb10('0x40')](_0xcb3354['model'],qs['fields'](_0x3e06b0[_0xbb10('0x43')][_0xbb10('0x44')]));_0x4a9793[_0xbb10('0x42')]=_0x4a9793[_0xbb10('0x42')][_0xbb10('0x53')]?_0x4a9793[_0xbb10('0x42')]:_0xcb3354[_0xbb10('0x41')];if(_0x3e06b0[_0xbb10('0x43')][_0xbb10('0x54')]){_0x4a9793[_0xbb10('0x4e')]=[{'all':!![]}];}_0x4a9793=_[_0xbb10('0x4c')]({},_0x4a9793,_0x3e06b0[_0xbb10('0x4d')]);return db[_0xbb10('0x39')][_0xbb10('0x55')](_0x4a9793)[_0xbb10('0x1e')](handleEntityNotFound(_0x5be85e,null))['then'](respondWithResult(_0x5be85e,null))[_0xbb10('0x29')](handleError(_0x5be85e,null));};exports['create']=function(_0x33d60a,_0x2e21a0){return db[_0xbb10('0x39')][_0xbb10('0x56')](_0x33d60a[_0xbb10('0x57')],{})[_0xbb10('0x1e')](respondWithResult(_0x2e21a0,0xc9))[_0xbb10('0x29')](handleError(_0x2e21a0,null));};exports[_0xbb10('0x58')]=function(_0x180400,_0x3d71e){if(_0x180400[_0xbb10('0x57')]['id']){delete _0x180400[_0xbb10('0x57')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x55')]({'where':{'id':_0x180400[_0xbb10('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d71e,null))[_0xbb10('0x1e')](saveUpdates(_0x180400[_0xbb10('0x57')],null))[_0xbb10('0x1e')](respondWithResult(_0x3d71e,null))[_0xbb10('0x29')](handleError(_0x3d71e,null));};exports[_0xbb10('0x35')]=function(_0x379d8c,_0x4bedd0){return db[_0xbb10('0x39')][_0xbb10('0x55')]({'where':{'id':_0x379d8c[_0xbb10('0x51')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x4bedd0,null))[_0xbb10('0x1e')](removeEntity(_0x4bedd0,null))[_0xbb10('0x29')](handleError(_0x4bedd0,null));};exports[_0xbb10('0x59')]=function(_0x12ec18,_0x205e01,_0x40c4fb){var _0x2eb05a={};var _0x2a1ce1={};var _0x16932f;var _0x4e7fac;return db['ZohoAccount'][_0xbb10('0x5a')]({'where':{'id':_0x12ec18[_0xbb10('0x51')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x205e01,null))[_0xbb10('0x1e')](function(_0x5573bb){if(_0x5573bb){_0x16932f=_0x5573bb;_0x2a1ce1['model']=_[_0xbb10('0x52')](db[_0xbb10('0x5b')][_0xbb10('0x3a')]);_0x2a1ce1[_0xbb10('0x43')]=_[_0xbb10('0x52')](_0x12ec18[_0xbb10('0x43')]);_0x2a1ce1[_0xbb10('0x3f')]=_['intersection'](_0x2a1ce1[_0xbb10('0x41')],_0x2a1ce1[_0xbb10('0x43')]);_0x2eb05a['attributes']=_['intersection'](_0x2a1ce1['model'],qs[_0xbb10('0x44')](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x44')]));_0x2eb05a['attributes']=_0x2eb05a['attributes']['length']?_0x2eb05a[_0xbb10('0x42')]:_0x2a1ce1[_0xbb10('0x41')];_0x2eb05a[_0xbb10('0x47')]=qs['sort'](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x48')]);_0x2eb05a['where']=qs['filters'](_[_0xbb10('0x5c')](_0x12ec18[_0xbb10('0x43')],_0x2a1ce1[_0xbb10('0x3f')]));if(_0x12ec18[_0xbb10('0x43')]['filter']){_0x2eb05a[_0xbb10('0x49')]=_[_0xbb10('0x4c')](_0x2eb05a[_0xbb10('0x49')],{'$or':_['map'](_0x2eb05a[_0xbb10('0x42')],function(_0x2f05bc){var _0x3e3617={};_0x3e3617[_0x2f05bc]={'$like':'%'+_0x12ec18['query'][_0xbb10('0x4b')]+'%'};return _0x3e3617;})});}_0x2eb05a=_[_0xbb10('0x4c')]({},_0x2eb05a,_0x12ec18[_0xbb10('0x4d')]);return _0x16932f[_0xbb10('0x59')](_0x2eb05a);}})['then'](function(_0x251417){if(_0x251417){_0x4e7fac=_0x251417[_0xbb10('0x53')];if(!_0x12ec18[_0xbb10('0x43')][_0xbb10('0x45')]('nolimit')){_0x2eb05a[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x30')]);_0x2eb05a[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x12ec18[_0xbb10('0x43')]['offset']);}return _0x16932f['getConfigurations'](_0x2eb05a);}})['then'](function(_0xdfbc0b){if(_0xdfbc0b){return _0xdfbc0b?{'count':_0x4e7fac,'rows':_0xdfbc0b}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x205e01,null))[_0xbb10('0x29')](handleError(_0x205e01,null));};exports['addConfiguration']=function(_0x5cd089,_0x46f462,_0x1b11c0){if(_0x5cd089[_0xbb10('0x57')]['id']){delete _0x5cd089[_0xbb10('0x57')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x5a')]({'where':{'id':_0x5cd089['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x46f462,null))[_0xbb10('0x1e')](function(_0x270fdb){if(_0x270fdb){_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5d')]=_0x270fdb['id'];_0x5cd089['body']['Subjects']=integrations['getSubjects'](_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5e')],_0x5cd089[_0xbb10('0x57')][_0xbb10('0x3c')]);_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5f')]=integrations['getDescriptions'](_0x5cd089[_0xbb10('0x57')]['channel'],_0x5cd089['body']['type']);return db[_0xbb10('0x5b')][_0xbb10('0x56')](_0x5cd089[_0xbb10('0x57')],{'include':[{'model':db[_0xbb10('0x60')],'as':'Subjects'},{'model':db[_0xbb10('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x46f462,null))[_0xbb10('0x29')](handleError(_0x46f462,null));};function getAccessToken(_0xfe3db0){return new Promise(function(_0x29529c,_0x2bd2ab){var _0xfa3c7c;switch(_0xfe3db0['zone']){case'US':_0xfa3c7c=_0xbb10('0x61');break;case'AU':_0xfa3c7c=_0xbb10('0x62');break;case'EU':_0xfa3c7c=_0xbb10('0x63');break;case'IN':_0xfa3c7c=_0xbb10('0x64');break;case'CN':_0xfa3c7c=_0xbb10('0x65');break;default:_0xfa3c7c=_0xbb10('0x63');break;}var _0x174395={'method':'POST','uri':_0xfa3c7c+_0xbb10('0x66'),'qs':{'refresh_token':_0xfe3db0[_0xbb10('0x67')],'client_id':_0xfe3db0[_0xbb10('0x68')],'client_secret':_0xfe3db0[_0xbb10('0x69')],'grant_type':_0xbb10('0x6a')},'json':!![]};return rp(_0x174395)[_0xbb10('0x1e')](function(_0xa3b23){if(_0xa3b23[_0xbb10('0x6b')]){_0x29529c(_0xa3b23['access_token']);}else{_0x2bd2ab(_0xbb10('0x6c'));}})[_0xbb10('0x29')](function(_0x145baf){_0x2bd2ab(_0x145baf);});});}exports['getFields']=function(_0x4ee101,_0x4b923a,_0x23286d){var _0x5a3c44,_0x4e3d6a,_0x1701c5,_0x3ee56b,_0x33ff06;return db[_0xbb10('0x39')][_0xbb10('0x5a')]({'where':{'id':_0x4ee101[_0xbb10('0x51')]['id']},'attributes':['id',_0xbb10('0x6d'),_0xbb10('0x6e'),_0xbb10('0x68'),'clientSecret',_0xbb10('0x6f'),_0xbb10('0x26'),_0xbb10('0x67')]})[_0xbb10('0x1e')](handleEntityNotFound(_0x4b923a,null))['then'](function(_0x4c0795){_0x33ff06=_0x4c0795;_0x5a3c44=_0x33ff06[_0xbb10('0x6d')];_0x4e3d6a=_0x5a3c44===_0xbb10('0x70')?'eu':_0xbb10('0x71');_0x1701c5=_0x33ff06[_0xbb10('0x6f')];var _0x5ee705=_0x1701c5[_0xbb10('0x72')](-0x1);if(_0x5ee705==='/'||_0x5ee705==='\x5c'||_0x5ee705===':'){_0x1701c5=_0x1701c5[_0xbb10('0x73')](0x0,_0x1701c5[_0xbb10('0x74')](_0x5ee705));}if(!_0x33ff06[_0xbb10('0x67')]){throw new Error(_0xbb10('0x75'));}return getAccessToken(_0x33ff06);})['then'](function(_0x5f0691){if(_0x5f0691){return rp({'method':_0xbb10('0x76'),'uri':util[_0xbb10('0x77')](_0xbb10('0x78'),_0x4e3d6a),'qs':{'module':'Calls'},'headers':{'Authorization':_0xbb10('0x79')+_0x5f0691},'json':!![]});}})[_0xbb10('0x1e')](function(_0x50bcc9){if(_0x50bcc9){if(_0x50bcc9['response']&&_0x50bcc9[_0xbb10('0x7a')][_0xbb10('0x25')]){throw new Error(_0x50bcc9[_0xbb10('0x7a')]['error'][_0xbb10('0x27')]);}var _0x3a17fc=[];var _0xfbb365=[];var _0x2d1805=[_0xbb10('0x7b'),_0xbb10('0x7c'),_0xbb10('0x7d'),_0xbb10('0x7e'),_0xbb10('0x7f'),'Call_Result',_0xbb10('0x80'),_0xbb10('0x81')];_0xfbb365=_[_0xbb10('0x82')](_0x50bcc9[_0xbb10('0x44')],function(_0x3e3083){return _0x2d1805[_0xbb10('0x83')](_0x3e3083[_0xbb10('0x84')]);});for(var _0x305d52=0x0;_0x305d52<_0xfbb365[_0xbb10('0x53')];_0x305d52++){if(_0xfbb365[_0x305d52][_0xbb10('0x85')]===![]){_0x3a17fc[_0xbb10('0x86')]({'id':_0xfbb365[_0x305d52]['id'],'name':_0xfbb365[_0x305d52][_0xbb10('0x87')],'custom':_0xfbb365[_0x305d52]['custom_field'],'options':_0xfbb365[_0x305d52]['data_type']===_0xbb10('0x88')&&_0xfbb365[_0x305d52][_0xbb10('0x89')][_0xbb10('0x53')]>-0x1?_[_0xbb10('0x3e')](_0xfbb365[_0x305d52][_0xbb10('0x89')],function(_0x4a717a){return{'name':_0x4a717a,'value':_0x4a717a};}):[]});}}return{'count':_0x3a17fc[_0xbb10('0x53')],'rows':_0x3a17fc};}else{return{'count':0x0,'rows':[]};}})[_0xbb10('0x1e')](respondWithResult(_0x4b923a,null))[_0xbb10('0x29')](function(_0x1a51d3){var _0x19694d=_0x4ee101[_0xbb10('0x43')]['test']?0x1f4:_0x1a51d3[_0xbb10('0x8a')]||0x1f4;logger[_0xbb10('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xbb10('0x8b'),_0x19694d,JSON['stringify'](_0x1a51d3));delete _0x1a51d3[_0xbb10('0x37')];if(_0x19694d===0x191){_0x19694d=0x190;}_0x4b923a[_0xbb10('0x2b')](_0x19694d)[_0xbb10('0x8c')](_0x4ee101[_0xbb10('0x43')][_0xbb10('0x8d')]?{'message':'Wrong\x20credentials','statusCode':_0x1a51d3[_0xbb10('0x8a')]}:_0x1a51d3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2af22a2..868630a 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 _0xab3c=['https://accounts.zoho.com.au','POST','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_zoho_accounts','changed','zone','serverUrl','clientId','code','host','slice','lastIndexOf','https://accounts.zoho.com'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab3c,0x94));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcab3('0x0'));var logger=require(_0xcab3('0x1'))(_0xcab3('0x2'));var moment=require(_0xcab3('0x3'));var BPromise=require(_0xcab3('0x4'));var rp=require(_0xcab3('0x5'));var fs=require('fs');var path=require(_0xcab3('0x6'));var rimraf=require(_0xcab3('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xcab3('0x8'));module[_0xcab3('0x9')]=function(_0x461765,_0x5358b1){return _0x461765['define']('ZohoAccount',attributes,{'tableName':_0xcab3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x556426,_0x3d62e5,_0x38ade4){if(_0x556426[_0xcab3('0xb')](_0xcab3('0xc'))||_0x556426[_0xcab3('0xb')](_0xcab3('0xd'))||_0x556426[_0xcab3('0xb')](_0xcab3('0xe'))||_0x556426[_0xcab3('0xb')]('clientSecret')||_0x556426[_0xcab3('0xb')](_0xcab3('0xf'))||_0x556426[_0xcab3('0xb')](_0xcab3('0x10'))){var _0x2bd963,_0x16dc97;_0x2bd963=_0x556426[_0xcab3('0xd')];var _0x39df48=_0x2bd963[_0xcab3('0x11')](-0x1);if(_0x39df48==='/'||_0x39df48==='\x5c'||_0x39df48===':'){_0x2bd963=_0x2bd963['substring'](0x0,_0x2bd963[_0xcab3('0x12')](_0x39df48));}switch(_0x556426['zone']){case'US':_0x16dc97=_0xcab3('0x13');break;case'AU':_0x16dc97=_0xcab3('0x14');break;case'IN':_0x16dc97='https://accounts.zoho.in';break;case'CN':_0x16dc97='https://accounts.zoho.com.cn';break;default:_0x16dc97='https://accounts.zoho.eu';break;}var _0x16efac={'method':_0xcab3('0x15'),'uri':_0x16dc97+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x556426['clientId'],'client_secret':_0x556426[_0xcab3('0x16')],'redirect_uri':_0x556426[_0xcab3('0xd')],'code':_0x556426[_0xcab3('0xf')]},'headers':{'Content-Type':_0xcab3('0x17')}};return rp(_0x16efac)[_0xcab3('0x18')](function(_0x229b10){var _0x1468d9=JSON[_0xcab3('0x19')](_0x229b10);if(_0x1468d9[_0xcab3('0x1a')]){_0x556426[_0xcab3('0x1b')]=_0x1468d9['refresh_token'];logger[_0xcab3('0x1c')](util[_0xcab3('0x1d')](_0xcab3('0x1e'),_0x556426[_0xcab3('0x1f')],_0x556426['id']));}else{logger[_0xcab3('0x20')](util['format'](_0xcab3('0x21'),_0x556426[_0xcab3('0x1f')],_0x556426['id']),util[_0xcab3('0x22')](_0x1468d9,{'showHidden':![],'depth':null}));}return _0x38ade4(null,_0x3d62e5);})['catch'](function(_0x38aea9){logger[_0xcab3('0x20')](util[_0xcab3('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x556426[_0xcab3('0x1f')],_0x556426['id']),util[_0xcab3('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x38ade4(_0x38aea9);});}else{return _0x38ade4(null,_0x3d62e5);}},'beforeUpdate':function(_0x40341d,_0x85ebaf,_0x5e824e){if(_0x40341d['changed'](_0xcab3('0xc'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0xd'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0xe'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0x16'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0xf'))||_0x40341d['changed'](_0xcab3('0x10'))){var _0x92b70b,_0x7ced90;_0x92b70b=_0x40341d[_0xcab3('0xd')];var _0x42c8db=_0x92b70b[_0xcab3('0x11')](-0x1);if(_0x42c8db==='/'||_0x42c8db==='\x5c'||_0x42c8db===':'){_0x92b70b=_0x92b70b[_0xcab3('0x23')](0x0,_0x92b70b['lastIndexOf'](_0x42c8db));}switch(_0x40341d[_0xcab3('0xc')]){case'US':_0x7ced90=_0xcab3('0x13');break;case'AU':_0x7ced90='https://accounts.zoho.com.au';break;case'IN':_0x7ced90=_0xcab3('0x24');break;case'CN':_0x7ced90=_0xcab3('0x25');break;default:_0x7ced90=_0xcab3('0x26');break;}var _0x2ca996={'method':_0xcab3('0x15'),'uri':_0x7ced90+_0xcab3('0x27'),'form':{'grant_type':_0xcab3('0x28'),'client_id':_0x40341d[_0xcab3('0xe')],'client_secret':_0x40341d[_0xcab3('0x16')],'redirect_uri':_0x40341d[_0xcab3('0xd')],'code':_0x40341d[_0xcab3('0xf')]},'headers':{'Content-Type':_0xcab3('0x17')}};return rp(_0x2ca996)[_0xcab3('0x18')](function(_0x2c2e62){var _0x482e81=JSON[_0xcab3('0x19')](_0x2c2e62);if(_0x482e81[_0xcab3('0x1a')]){_0x40341d[_0xcab3('0x1b')]=_0x482e81[_0xcab3('0x1a')];logger[_0xcab3('0x1c')](util[_0xcab3('0x1d')](_0xcab3('0x1e'),_0x40341d[_0xcab3('0x1f')],_0x40341d['id']));}else{logger[_0xcab3('0x20')](util[_0xcab3('0x1d')](_0xcab3('0x21'),_0x40341d[_0xcab3('0x1f')],_0x40341d['id']),util[_0xcab3('0x22')](_0x482e81,{'showHidden':![],'depth':null}));}return _0x5e824e(null,_0x85ebaf);})[_0xcab3('0x29')](function(_0x5cc97e){logger[_0xcab3('0x20')](util[_0xcab3('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x40341d['name'],_0x40341d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5e824e(_0x5cc97e);});}else{return _0x5e824e(null,_0x85ebaf);}}}});}; \ No newline at end of file +var _0x86e5=['changed','zone','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','substring','https://accounts.zoho.com.au','/oauth/v2/token','format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts'];(function(_0x236c13,_0x50cc9f){var _0x35aa66=function(_0x251e3c){while(--_0x251e3c){_0x236c13['push'](_0x236c13['shift']());}};_0x35aa66(++_0x50cc9f);}(_0x86e5,0x1a2));var _0x586e=function(_0x1ab1be,_0x3ff0dc){_0x1ab1be=_0x1ab1be-0x0;var _0x29a657=_0x86e5[_0x1ab1be];return _0x29a657;};'use strict';var _=require('lodash');var util=require(_0x586e('0x0'));var logger=require(_0x586e('0x1'))(_0x586e('0x2'));var moment=require(_0x586e('0x3'));var BPromise=require(_0x586e('0x4'));var rp=require(_0x586e('0x5'));var fs=require('fs');var path=require(_0x586e('0x6'));var rimraf=require(_0x586e('0x7'));var config=require(_0x586e('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x586e('0x9'));module['exports']=function(_0x262579,_0x1f95c3){return _0x262579['define'](_0x586e('0xa'),attributes,{'tableName':_0x586e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe4f1b4,_0x1abfae,_0x4768a1){if(_0xe4f1b4[_0x586e('0xc')](_0x586e('0xd'))||_0xe4f1b4['changed'](_0x586e('0xe'))||_0xe4f1b4['changed'](_0x586e('0xf'))||_0xe4f1b4['changed'](_0x586e('0x10'))||_0xe4f1b4[_0x586e('0xc')](_0x586e('0x11'))||_0xe4f1b4[_0x586e('0xc')](_0x586e('0x12'))){var _0x130aba,_0x1a40c7;_0x130aba=_0xe4f1b4[_0x586e('0xe')];var _0x405563=_0x130aba[_0x586e('0x13')](-0x1);if(_0x405563==='/'||_0x405563==='\x5c'||_0x405563===':'){_0x130aba=_0x130aba['substring'](0x0,_0x130aba[_0x586e('0x14')](_0x405563));}switch(_0xe4f1b4[_0x586e('0xd')]){case'US':_0x1a40c7=_0x586e('0x15');break;case'AU':_0x1a40c7='https://accounts.zoho.com.au';break;case'IN':_0x1a40c7=_0x586e('0x16');break;case'CN':_0x1a40c7=_0x586e('0x17');break;default:_0x1a40c7=_0x586e('0x18');break;}var _0xe628b1={'method':_0x586e('0x19'),'uri':_0x1a40c7+'/oauth/v2/token','form':{'grant_type':_0x586e('0x1a'),'client_id':_0xe4f1b4[_0x586e('0xf')],'client_secret':_0xe4f1b4[_0x586e('0x10')],'redirect_uri':_0xe4f1b4[_0x586e('0xe')],'code':_0xe4f1b4['code']},'headers':{'Content-Type':_0x586e('0x1b')}};return rp(_0xe628b1)[_0x586e('0x1c')](function(_0xdf44d4){var _0x4bfcb5=JSON[_0x586e('0x1d')](_0xdf44d4);if(_0x4bfcb5[_0x586e('0x1e')]){_0xe4f1b4[_0x586e('0x1f')]=_0x4bfcb5['refresh_token'];logger[_0x586e('0x20')](util['format'](_0x586e('0x21'),_0xe4f1b4['name'],_0xe4f1b4['id']));}else{logger[_0x586e('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe4f1b4['name'],_0xe4f1b4['id']),util[_0x586e('0x23')](_0x4bfcb5,{'showHidden':![],'depth':null}));}return _0x4768a1(null,_0x1abfae);})[_0x586e('0x24')](function(_0x30b0fd){logger['error'](util['format'](_0x586e('0x25'),_0xe4f1b4[_0x586e('0x26')],_0xe4f1b4['id']),util[_0x586e('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4768a1(_0x30b0fd);});}else{return _0x4768a1(null,_0x1abfae);}},'beforeUpdate':function(_0x75774b,_0x6a3a5f,_0x4db03a){if(_0x75774b[_0x586e('0xc')]('zone')||_0x75774b[_0x586e('0xc')](_0x586e('0xe'))||_0x75774b[_0x586e('0xc')](_0x586e('0xf'))||_0x75774b['changed'](_0x586e('0x10'))||_0x75774b['changed']('code')||_0x75774b[_0x586e('0xc')](_0x586e('0x12'))){var _0x11fb70,_0xff272;_0x11fb70=_0x75774b[_0x586e('0xe')];var _0x183fef=_0x11fb70[_0x586e('0x13')](-0x1);if(_0x183fef==='/'||_0x183fef==='\x5c'||_0x183fef===':'){_0x11fb70=_0x11fb70[_0x586e('0x27')](0x0,_0x11fb70['lastIndexOf'](_0x183fef));}switch(_0x75774b['zone']){case'US':_0xff272=_0x586e('0x15');break;case'AU':_0xff272=_0x586e('0x28');break;case'IN':_0xff272='https://accounts.zoho.in';break;case'CN':_0xff272=_0x586e('0x17');break;default:_0xff272='https://accounts.zoho.eu';break;}var _0x5c9771={'method':_0x586e('0x19'),'uri':_0xff272+_0x586e('0x29'),'form':{'grant_type':_0x586e('0x1a'),'client_id':_0x75774b[_0x586e('0xf')],'client_secret':_0x75774b[_0x586e('0x10')],'redirect_uri':_0x75774b[_0x586e('0xe')],'code':_0x75774b[_0x586e('0x11')]},'headers':{'Content-Type':_0x586e('0x1b')}};return rp(_0x5c9771)['then'](function(_0x1b82a){var _0xf5059e=JSON[_0x586e('0x1d')](_0x1b82a);if(_0xf5059e[_0x586e('0x1e')]){_0x75774b['refreshToken']=_0xf5059e[_0x586e('0x1e')];logger['info'](util['format'](_0x586e('0x21'),_0x75774b[_0x586e('0x26')],_0x75774b['id']));}else{logger['error'](util[_0x586e('0x2a')](_0x586e('0x25'),_0x75774b[_0x586e('0x26')],_0x75774b['id']),util[_0x586e('0x23')](_0xf5059e,{'showHidden':![],'depth':null}));}return _0x4db03a(null,_0x6a3a5f);})[_0x586e('0x24')](function(_0xfe58ca){logger[_0x586e('0x22')](util[_0x586e('0x2a')](_0x586e('0x25'),_0x75774b[_0x586e('0x26')],_0x75774b['id']),util[_0x586e('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4db03a(_0xfe58ca);});}else{return _0x4db03a(null,_0x6a3a5f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ff0489d..8ee0076 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 _0x7b66=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','options','raw','limit','include','attributes','map','model','debug','ShowZohoAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x16644e,_0x1fb3b3){var _0x3f39d0=function(_0x3f6f5e){while(--_0x3f6f5e){_0x16644e['push'](_0x16644e['shift']());}};_0x3f39d0(++_0x1fb3b3);}(_0x7b66,0xe8));var _0x67b6=function(_0x474e1a,_0x52e117){_0x474e1a=_0x474e1a-0x0;var _0x4bb52b=_0x7b66[_0x474e1a];return _0x4bb52b;};'use strict';var _=require(_0x67b6('0x0'));var util=require('util');var moment=require(_0x67b6('0x1'));var BPromise=require(_0x67b6('0x2'));var rs=require(_0x67b6('0x3'));var fs=require('fs');var Redis=require(_0x67b6('0x4'));var db=require(_0x67b6('0x5'))['db'];var utils=require(_0x67b6('0x6'));var logger=require('../../config/logger')(_0x67b6('0x7'));var config=require('../../config/environment');var jayson=require(_0x67b6('0x8'));var client=jayson[_0x67b6('0x9')][_0x67b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24a3cf,_0x52218c,_0x24e6c0){return new BPromise(function(_0x930507,_0x432fe5){return client[_0x67b6('0xb')](_0x24a3cf,_0x24e6c0)[_0x67b6('0xc')](function(_0x878231){logger[_0x67b6('0xd')](_0x67b6('0xe'),_0x52218c,_0x67b6('0xf'));logger['debug'](_0x67b6('0x10'),_0x52218c,'request\x20sent',JSON[_0x67b6('0x11')](_0x878231));if(_0x878231[_0x67b6('0x12')]){if(_0x878231[_0x67b6('0x12')]['code']===0x1f4){logger[_0x67b6('0x12')](_0x67b6('0xe'),_0x52218c,_0x878231[_0x67b6('0x12')][_0x67b6('0x13')]);return _0x432fe5(_0x878231[_0x67b6('0x12')][_0x67b6('0x13')]);}logger[_0x67b6('0x12')](_0x67b6('0xe'),_0x52218c,_0x878231['error'][_0x67b6('0x13')]);return _0x930507(_0x878231['error'][_0x67b6('0x13')]);}else{logger['info'](_0x67b6('0xe'),_0x52218c,_0x67b6('0xf'));_0x930507(_0x878231[_0x67b6('0x14')]['message']);}})[_0x67b6('0x15')](function(_0x1082f1){logger[_0x67b6('0x12')](_0x67b6('0xe'),_0x52218c,_0x1082f1);_0x432fe5(_0x1082f1);});});}exports[_0x67b6('0x16')]=function(_0x2f4512){var _0x581507=this;return new Promise(function(_0x48164c,_0x3efcf6){return db['ZohoAccount']['findAll']({'raw':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')][_0x67b6('0x18')]===undefined?!![]:![]:!![],'where':_0x2f4512['options']?_0x2f4512[_0x67b6('0x17')]['where']||null:null,'attributes':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')]['attributes']||null:null,'limit':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')][_0x67b6('0x19')]||null:null,'include':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')]['include']?_['map'](_0x2f4512[_0x67b6('0x17')][_0x67b6('0x1a')],function(_0x27c229){return{'model':db[_0x27c229['model']],'as':_0x27c229['as'],'attributes':_0x27c229[_0x67b6('0x1b')],'include':_0x27c229[_0x67b6('0x1a')]?_[_0x67b6('0x1c')](_0x27c229['include'],function(_0xf1f776){return{'model':db[_0xf1f776[_0x67b6('0x1d')]],'as':_0xf1f776['as'],'attributes':_0xf1f776[_0x67b6('0x1b')],'include':_0xf1f776['include']?_[_0x67b6('0x1c')](_0xf1f776[_0x67b6('0x1a')],function(_0x28d28b){return{'model':db[_0x28d28b[_0x67b6('0x1d')]],'as':_0x28d28b['as'],'attributes':_0x28d28b['attributes']};}):[]};}):[]};}):[]:[]})[_0x67b6('0xc')](function(_0x2fbd1d){logger[_0x67b6('0xd')](_0x67b6('0x16'),_0x2f4512);logger[_0x67b6('0x1e')]('GetZohoAccount',_0x2f4512,JSON[_0x67b6('0x11')](_0x2fbd1d));_0x48164c(_0x2fbd1d);})[_0x67b6('0x15')](function(_0x12e96b){logger[_0x67b6('0x12')]('GetZohoAccount',_0x12e96b[_0x67b6('0x13')],_0x2f4512);_0x3efcf6(_0x581507[_0x67b6('0x12')](0x1f4,_0x12e96b[_0x67b6('0x13')]));});});};exports[_0x67b6('0x1f')]=function(_0x197f75){var _0xf1adcd=this;return new Promise(function(_0x28671a,_0x3b0e64){return db['ZohoAccount'][_0x67b6('0x20')]({'raw':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')][_0x67b6('0x21')]||null:null,'attributes':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')][_0x67b6('0x1b')]||null:null,'include':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')]['include']?_[_0x67b6('0x1c')](_0x197f75['options']['include'],function(_0x362c11){return{'model':db[_0x362c11[_0x67b6('0x1d')]],'as':_0x362c11['as'],'attributes':_0x362c11[_0x67b6('0x1b')],'include':_0x362c11[_0x67b6('0x1a')]?_[_0x67b6('0x1c')](_0x362c11['include'],function(_0x394581){return{'model':db[_0x394581[_0x67b6('0x1d')]],'as':_0x394581['as'],'attributes':_0x394581[_0x67b6('0x1b')],'include':_0x394581['include']?_[_0x67b6('0x1c')](_0x394581[_0x67b6('0x1a')],function(_0x2c7aa5){return{'model':db[_0x2c7aa5[_0x67b6('0x1d')]],'as':_0x2c7aa5['as'],'attributes':_0x2c7aa5[_0x67b6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x67b6('0xc')](function(_0x37e38b){logger['info'](_0x67b6('0x1f'),_0x197f75);logger['debug'](_0x67b6('0x1f'),_0x197f75,JSON[_0x67b6('0x11')](_0x37e38b));_0x28671a(_0x37e38b);})[_0x67b6('0x15')](function(_0xffc4c6){logger[_0x67b6('0x12')](_0x67b6('0x1f'),_0xffc4c6[_0x67b6('0x13')],_0x197f75);_0x3b0e64(_0xf1adcd[_0x67b6('0x12')](0x1f4,_0xffc4c6[_0x67b6('0x13')]));});});}; \ No newline at end of file +var _0x1932=['attributes','model','then','ShowZohoAccount','ZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZohoAccount','findAll','options','where','include','map'];(function(_0x237194,_0x4dbb8c){var _0x4f90da=function(_0x31e60d){while(--_0x31e60d){_0x237194['push'](_0x237194['shift']());}};_0x4f90da(++_0x4dbb8c);}(_0x1932,0xbb));var _0x2193=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x1932[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x2193('0x0'));var util=require(_0x2193('0x1'));var moment=require(_0x2193('0x2'));var BPromise=require(_0x2193('0x3'));var rs=require(_0x2193('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2193('0x5'))['db'];var utils=require(_0x2193('0x6'));var logger=require(_0x2193('0x7'))(_0x2193('0x8'));var config=require(_0x2193('0x9'));var jayson=require(_0x2193('0xa'));var client=jayson[_0x2193('0xb')][_0x2193('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3479ff,_0x1f9cb2,_0xe886ff){return new BPromise(function(_0x436b26,_0x3f4e40){return client[_0x2193('0xd')](_0x3479ff,_0xe886ff)['then'](function(_0x2b53d5){logger[_0x2193('0xe')](_0x2193('0xf'),_0x1f9cb2,_0x2193('0x10'));logger[_0x2193('0x11')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1f9cb2,_0x2193('0x10'),JSON[_0x2193('0x12')](_0x2b53d5));if(_0x2b53d5[_0x2193('0x13')]){if(_0x2b53d5[_0x2193('0x13')][_0x2193('0x14')]===0x1f4){logger[_0x2193('0x13')](_0x2193('0xf'),_0x1f9cb2,_0x2b53d5[_0x2193('0x13')][_0x2193('0x15')]);return _0x3f4e40(_0x2b53d5['error'][_0x2193('0x15')]);}logger['error'](_0x2193('0xf'),_0x1f9cb2,_0x2b53d5[_0x2193('0x13')][_0x2193('0x15')]);return _0x436b26(_0x2b53d5[_0x2193('0x13')]['message']);}else{logger[_0x2193('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1f9cb2,_0x2193('0x10'));_0x436b26(_0x2b53d5['result'][_0x2193('0x15')]);}})[_0x2193('0x16')](function(_0x28de88){logger[_0x2193('0x13')](_0x2193('0xf'),_0x1f9cb2,_0x28de88);_0x3f4e40(_0x28de88);});});}exports[_0x2193('0x17')]=function(_0x2feed3){var _0xb3dd0c=this;return new Promise(function(_0x17a9b3,_0x4aee56){return db['ZohoAccount'][_0x2193('0x18')]({'raw':_0x2feed3[_0x2193('0x19')]?_0x2feed3['options']['raw']===undefined?!![]:![]:!![],'where':_0x2feed3['options']?_0x2feed3[_0x2193('0x19')][_0x2193('0x1a')]||null:null,'attributes':_0x2feed3[_0x2193('0x19')]?_0x2feed3[_0x2193('0x19')]['attributes']||null:null,'limit':_0x2feed3['options']?_0x2feed3[_0x2193('0x19')]['limit']||null:null,'include':_0x2feed3[_0x2193('0x19')]?_0x2feed3[_0x2193('0x19')][_0x2193('0x1b')]?_[_0x2193('0x1c')](_0x2feed3['options'][_0x2193('0x1b')],function(_0x5c1138){return{'model':db[_0x5c1138['model']],'as':_0x5c1138['as'],'attributes':_0x5c1138[_0x2193('0x1d')],'include':_0x5c1138[_0x2193('0x1b')]?_['map'](_0x5c1138['include'],function(_0x1833d7){return{'model':db[_0x1833d7[_0x2193('0x1e')]],'as':_0x1833d7['as'],'attributes':_0x1833d7['attributes'],'include':_0x1833d7[_0x2193('0x1b')]?_[_0x2193('0x1c')](_0x1833d7[_0x2193('0x1b')],function(_0xbb0387){return{'model':db[_0xbb0387[_0x2193('0x1e')]],'as':_0xbb0387['as'],'attributes':_0xbb0387[_0x2193('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2193('0x1f')](function(_0x4da6bc){logger['info'](_0x2193('0x17'),_0x2feed3);logger[_0x2193('0x11')](_0x2193('0x17'),_0x2feed3,JSON[_0x2193('0x12')](_0x4da6bc));_0x17a9b3(_0x4da6bc);})[_0x2193('0x16')](function(_0x40045d){logger[_0x2193('0x13')](_0x2193('0x17'),_0x40045d[_0x2193('0x15')],_0x2feed3);_0x4aee56(_0xb3dd0c['error'](0x1f4,_0x40045d[_0x2193('0x15')]));});});};exports[_0x2193('0x20')]=function(_0x1af6c9){var _0x28c533=this;return new Promise(function(_0x4bd8c1,_0x3a02e2){return db[_0x2193('0x21')][_0x2193('0x22')]({'raw':_0x1af6c9[_0x2193('0x19')]?_0x1af6c9['options'][_0x2193('0x23')]===undefined?!![]:![]:!![],'where':_0x1af6c9['options']?_0x1af6c9[_0x2193('0x19')][_0x2193('0x1a')]||null:null,'attributes':_0x1af6c9['options']?_0x1af6c9[_0x2193('0x19')]['attributes']||null:null,'include':_0x1af6c9[_0x2193('0x19')]?_0x1af6c9[_0x2193('0x19')][_0x2193('0x1b')]?_[_0x2193('0x1c')](_0x1af6c9[_0x2193('0x19')][_0x2193('0x1b')],function(_0x464b43){return{'model':db[_0x464b43[_0x2193('0x1e')]],'as':_0x464b43['as'],'attributes':_0x464b43[_0x2193('0x1d')],'include':_0x464b43['include']?_[_0x2193('0x1c')](_0x464b43[_0x2193('0x1b')],function(_0x39a915){return{'model':db[_0x39a915[_0x2193('0x1e')]],'as':_0x39a915['as'],'attributes':_0x39a915[_0x2193('0x1d')],'include':_0x39a915['include']?_[_0x2193('0x1c')](_0x39a915[_0x2193('0x1b')],function(_0x99d84a){return{'model':db[_0x99d84a[_0x2193('0x1e')]],'as':_0x99d84a['as'],'attributes':_0x99d84a[_0x2193('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2193('0x1f')](function(_0x25aa2f){logger['info'](_0x2193('0x20'),_0x1af6c9);logger[_0x2193('0x11')]('ShowZohoAccount',_0x1af6c9,JSON[_0x2193('0x12')](_0x25aa2f));_0x4bd8c1(_0x25aa2f);})[_0x2193('0x16')](function(_0x49039b){logger[_0x2193('0x13')](_0x2193('0x20'),_0x49039b[_0x2193('0x15')],_0x1af6c9);_0x3a02e2(_0x28c533[_0x2193('0x13')](0x1f4,_0x49039b[_0x2193('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d5c657a..8171a46 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 _0x92d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x1c5b9e,_0x46d588){var _0x30dcf3=function(_0x1096da){while(--_0x1096da){_0x1c5b9e['push'](_0x1c5b9e['shift']());}};_0x30dcf3(++_0x46d588);}(_0x92d7,0x17b));var _0x792d=function(_0x31e57f,_0x2a70ce){_0x31e57f=_0x31e57f-0x0;var _0x44fb7c=_0x92d7[_0x31e57f];return _0x44fb7c;};'use strict';var multer=require(_0x792d('0x0'));var util=require('util');var path=require(_0x792d('0x1'));var timeout=require(_0x792d('0x2'));var express=require(_0x792d('0x3'));var router=express[_0x792d('0x4')]();var auth=require(_0x792d('0x5'));var interaction=require(_0x792d('0x6'));var config=require(_0x792d('0x7'));var controller=require(_0x792d('0x8'));router[_0x792d('0x9')]('/',auth[_0x792d('0xa')](),controller['index']);router[_0x792d('0x9')](_0x792d('0xb'),auth[_0x792d('0xa')](),controller[_0x792d('0xc')]);router['get'](_0x792d('0xd'),auth[_0x792d('0xa')](),controller[_0x792d('0xe')]);router[_0x792d('0x9')](_0x792d('0xf'),auth[_0x792d('0xa')](),controller[_0x792d('0x10')]);router['get'](_0x792d('0x11'),auth['isAuthenticated'](),controller[_0x792d('0x12')]);router[_0x792d('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x792d('0x14')](_0x792d('0xb'),auth[_0x792d('0xa')](),controller['update']);router[_0x792d('0x15')](_0x792d('0xb'),auth[_0x792d('0xa')](),controller[_0x792d('0x16')]);module[_0x792d('0x17')]=router; \ No newline at end of file +var _0x4e61=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','put','update','delete'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4e61,0x8c));var _0x14e6=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x4e61[_0x2eea9a];return _0x1ec61e;};'use strict';var multer=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));var path=require(_0x14e6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14e6('0x3')]();var auth=require(_0x14e6('0x4'));var interaction=require(_0x14e6('0x5'));var config=require(_0x14e6('0x6'));var controller=require(_0x14e6('0x7'));router[_0x14e6('0x8')]('/',auth[_0x14e6('0x9')](),controller[_0x14e6('0xa')]);router[_0x14e6('0x8')](_0x14e6('0xb'),auth[_0x14e6('0x9')](),controller[_0x14e6('0xc')]);router[_0x14e6('0x8')](_0x14e6('0xd'),auth[_0x14e6('0x9')](),controller[_0x14e6('0xe')]);router[_0x14e6('0x8')](_0x14e6('0xf'),auth['isAuthenticated'](),controller[_0x14e6('0x10')]);router[_0x14e6('0x8')](_0x14e6('0x11'),auth[_0x14e6('0x9')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x14e6('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x14e6('0x13')]);router[_0x14e6('0x14')](_0x14e6('0xb'),auth['isAuthenticated'](),controller[_0x14e6('0x15')]);module[_0x14e6('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 cdd1802..5f4b797 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 _0x2312=['ENUM','lead','contact_lead','contact','STRING','sequelize'];(function(_0x4291ae,_0x32c6b4){var _0x8e8364=function(_0x45171d){while(--_0x45171d){_0x4291ae['push'](_0x4291ae['shift']());}};_0x8e8364(++_0x32c6b4);}(_0x2312,0x1af));var _0x2231=function(_0x990698,_0x3d54aa){_0x990698=_0x990698-0x0;var _0x52e882=_0x2312[_0x990698];return _0x52e882;};'use strict';var Sequelize=require(_0x2231('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x2231('0x1')](_0x2231('0x2'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x2231('0x3'),_0x2231('0x4'),_0x2231('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x2231('0x5')]}}; \ No newline at end of file +var _0x58c6=['lead','contact','nothing','contact_lead','STRING','exports','ENUM'];(function(_0x24a207,_0x3f99ad){var _0x4c6844=function(_0xee8e5c){while(--_0xee8e5c){_0x24a207['push'](_0x24a207['shift']());}};_0x4c6844(++_0x3f99ad);}(_0x58c6,0x1a9));var _0x658c=function(_0x2ce6c4,_0x1493e0){_0x2ce6c4=_0x2ce6c4-0x0;var _0x3fa5ef=_0x58c6[_0x2ce6c4];return _0x3fa5ef;};'use strict';var Sequelize=require('sequelize');module[_0x658c('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x658c('0x1')](_0x658c('0x2'),_0x658c('0x3'),_0x658c('0x4')),'defaultValue':_0x658c('0x2')},'moduleSearch':{'type':Sequelize[_0x658c('0x1')](_0x658c('0x5'),_0x658c('0x3'),'lead'),'defaultValue':_0x658c('0x5')},'description':{'type':Sequelize[_0x658c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 06b7a58..8792f6f 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(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 e530645..0dd92d7 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 _0x7964=['request-promise','exports','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','moment','bluebird'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0x7964,0x14c));var _0x4796=function(_0x5ee684,_0x470889){_0x5ee684=_0x5ee684-0x0;var _0x9916ba=_0x7964[_0x5ee684];return _0x9916ba;};'use strict';var _=require(_0x4796('0x0'));var util=require('util');var logger=require(_0x4796('0x1'))('api');var moment=require(_0x4796('0x2'));var BPromise=require(_0x4796('0x3'));var rp=require(_0x4796('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x4796('0x5')]=function(_0x17bc55,_0x3bf0ce){return _0x17bc55['define'](_0x4796('0x6'),attributes,{'tableName':_0x4796('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3de=['moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe3de,0x188));var _0xee3d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe3de[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xee3d('0x0'));var util=require(_0xee3d('0x1'));var logger=require(_0xee3d('0x2'))(_0xee3d('0x3'));var moment=require(_0xee3d('0x4'));var BPromise=require(_0xee3d('0x5'));var rp=require(_0xee3d('0x6'));var fs=require('fs');var path=require(_0xee3d('0x7'));var rimraf=require(_0xee3d('0x8'));var config=require('../../config/environment');var attributes=require(_0xee3d('0x9'));module[_0xee3d('0xa')]=function(_0x2f9b68,_0x25e10f){return _0x2f9b68['define']('ZohoConfiguration',attributes,{'tableName':_0xee3d('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 6a9fee5..ea0e787 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 _0xd3c0=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x21c7d8,_0x32acc5){var _0x277d59=function(_0x1f5ca9){while(--_0x1f5ca9){_0x21c7d8['push'](_0x21c7d8['shift']());}};_0x277d59(++_0x32acc5);}(_0xd3c0,0xb0));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d3c('0x0'));var util=require('util');var moment=require(_0x0d3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d3c('0x2'));var fs=require('fs');var Redis=require(_0x0d3c('0x3'));var db=require(_0x0d3c('0x4'))['db'];var utils=require(_0x0d3c('0x5'));var logger=require('../../config/logger')(_0x0d3c('0x6'));var config=require(_0x0d3c('0x7'));var jayson=require(_0x0d3c('0x8'));var client=jayson[_0x0d3c('0x9')][_0x0d3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x124dbf,_0x237d80,_0x3e938e){return new BPromise(function(_0x5e84db,_0x1dda9d){return client['request'](_0x124dbf,_0x3e938e)[_0x0d3c('0xb')](function(_0x2ed6c5){logger[_0x0d3c('0xc')](_0x0d3c('0xd'),_0x237d80,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x237d80,_0x0d3c('0xe'),JSON[_0x0d3c('0xf')](_0x2ed6c5));if(_0x2ed6c5[_0x0d3c('0x10')]){if(_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x11')]===0x1f4){logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);return _0x1dda9d(_0x2ed6c5['error'][_0x0d3c('0x12')]);}logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);return _0x5e84db(_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);}else{logger[_0x0d3c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x237d80,'request\x20sent');_0x5e84db(_0x2ed6c5['result'][_0x0d3c('0x12')]);}})[_0x0d3c('0x13')](function(_0x43891e){logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x43891e);_0x1dda9d(_0x43891e);});});} \ No newline at end of file +var _0x9cc2=['debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x9cc2,0x75));var _0x29cc=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x9cc2[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x29cc('0x0'));var util=require('util');var moment=require(_0x29cc('0x1'));var BPromise=require(_0x29cc('0x2'));var rs=require(_0x29cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29cc('0x4'))['db'];var utils=require(_0x29cc('0x5'));var logger=require(_0x29cc('0x6'))(_0x29cc('0x7'));var config=require(_0x29cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x29cc('0x9')][_0x29cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x83f502,_0x467772,_0x14c9f8){return new BPromise(function(_0x26bc6e,_0x1b6735){return client['request'](_0x83f502,_0x14c9f8)[_0x29cc('0xb')](function(_0x277d56){logger[_0x29cc('0xc')](_0x29cc('0xd'),_0x467772,_0x29cc('0xe'));logger[_0x29cc('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x467772,'request\x20sent',JSON[_0x29cc('0x10')](_0x277d56));if(_0x277d56[_0x29cc('0x11')]){if(_0x277d56[_0x29cc('0x11')][_0x29cc('0x12')]===0x1f4){logger[_0x29cc('0x11')](_0x29cc('0xd'),_0x467772,_0x277d56['error'][_0x29cc('0x13')]);return _0x1b6735(_0x277d56[_0x29cc('0x11')][_0x29cc('0x13')]);}logger[_0x29cc('0x11')](_0x29cc('0xd'),_0x467772,_0x277d56['error']['message']);return _0x26bc6e(_0x277d56[_0x29cc('0x11')][_0x29cc('0x13')]);}else{logger[_0x29cc('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x467772,'request\x20sent');_0x26bc6e(_0x277d56[_0x29cc('0x14')][_0x29cc('0x13')]);}})[_0x29cc('0x15')](function(_0x55aa7a){logger[_0x29cc('0x11')](_0x29cc('0xd'),_0x467772,_0x55aa7a);_0x1b6735(_0x55aa7a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index db971eb..464d7c2 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 _0x896e=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x449bb1,_0x1a28eb){var _0x1cb230=function(_0x58234e){while(--_0x58234e){_0x449bb1['push'](_0x449bb1['shift']());}};_0x1cb230(++_0x1a28eb);}(_0x896e,0x1e9));var _0xe896=function(_0x5485f8,_0xf8ab61){_0x5485f8=_0x5485f8-0x0;var _0x15852d=_0x896e[_0x5485f8];return _0x15852d;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var auth=require(_0xe896('0x6'));var interaction=require(_0xe896('0x7'));var config=require(_0xe896('0x8'));var controller=require(_0xe896('0x9'));router[_0xe896('0xa')]('/',auth[_0xe896('0xb')](),controller['index']);router[_0xe896('0xa')](_0xe896('0xc'),auth[_0xe896('0xb')](),controller[_0xe896('0xd')]);router[_0xe896('0xe')]('/',auth['isAuthenticated'](),controller[_0xe896('0xf')]);router[_0xe896('0x10')](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x11')]);router['delete'](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x12')]);module[_0xe896('0x13')]=router; \ No newline at end of file +var _0x57ca=['isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x188f08,_0x4bc925){var _0x311a0c=function(_0x290c0b){while(--_0x290c0b){_0x188f08['push'](_0x188f08['shift']());}};_0x311a0c(++_0x4bc925);}(_0x57ca,0x108));var _0xa57c=function(_0x124316,_0x2dea51){_0x124316=_0x124316-0x0;var _0xa1477d=_0x57ca[_0x124316];return _0xa1477d;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./intZohoField.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['put'](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller['update']);router[_0xa57c('0xe')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 57d2725..1ba7076 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 _0xd6d2=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x4b7ae6,_0x39b213){var _0x59e767=function(_0x36664d){while(--_0x36664d){_0x4b7ae6['push'](_0x4b7ae6['shift']());}};_0x59e767(++_0x39b213);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x17faec,_0x4503dd){_0x17faec=_0x17faec-0x0;var _0x1280da=_0xd6d2[_0x17faec];return _0x1280da;};'use strict';var Sequelize=require(_0x2d6d('0x0'));module[_0x2d6d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2d6d('0x2'),_0x2d6d('0x3'),'customVariable',_0x2d6d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2d6d('0x5')]},'key':{'type':Sequelize[_0x2d6d('0x5')]},'keyType':{'type':Sequelize[_0x2d6d('0x6')]('string',_0x2d6d('0x3'),_0x2d6d('0x7'))},'keyContent':{'type':Sequelize[_0x2d6d('0x5')]},'idField':{'type':Sequelize[_0x2d6d('0x5')]},'nameField':{'type':Sequelize[_0x2d6d('0x5')]},'customField':{'type':Sequelize[_0x2d6d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d6d('0x5')]}}; \ No newline at end of file +var _0x33c5=['variable','customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x26cc16,_0x4c174f){var _0x345e3e=function(_0x14b4f8){while(--_0x14b4f8){_0x26cc16['push'](_0x26cc16['shift']());}};_0x345e3e(++_0x4c174f);}(_0x33c5,0xe6));var _0x533c=function(_0x570c8a,_0x4a11cc){_0x570c8a=_0x570c8a-0x0;var _0x25dc12=_0x33c5[_0x570c8a];return _0x25dc12;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'type':{'type':Sequelize[_0x533c('0x1')]('string',_0x533c('0x2'),_0x533c('0x3'),_0x533c('0x4')),'defaultValue':_0x533c('0x5')},'content':{'type':Sequelize[_0x533c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x533c('0x1')](_0x533c('0x5'),_0x533c('0x2'),_0x533c('0x3'))},'keyContent':{'type':Sequelize[_0x533c('0x6')]},'idField':{'type':Sequelize[_0x533c('0x6')]},'nameField':{'type':Sequelize[_0x533c('0x6')]},'customField':{'type':Sequelize[_0x533c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x533c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6359a2f..8a2ba1a 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 _0x73f3=['hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','destroy','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x73f3,0x1eb));var _0x373f=function(_0x3267e7,_0x3398e5){_0x3267e7=_0x3267e7-0x0;var _0x16b65e=_0x73f3[_0x3267e7];return _0x16b65e;};'use strict';var pdf=require(_0x373f('0x0'));var emlformat=require(_0x373f('0x1'));var rimraf=require(_0x373f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x373f('0x3'));var rp=require(_0x373f('0x4'));var moment=require(_0x373f('0x5'));var BPromise=require(_0x373f('0x6'));var Mustache=require(_0x373f('0x7'));var util=require(_0x373f('0x8'));var path=require('path');var sox=require(_0x373f('0x9'));var csv=require(_0x373f('0xa'));var ejs=require(_0x373f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x373f('0xc'));var crypto=require(_0x373f('0xd'));var jsforce=require(_0x373f('0xe'));var deskjs=require(_0x373f('0xf'));var toCsv=require(_0x373f('0xa'));var querystring=require(_0x373f('0x10'));var Papa=require(_0x373f('0x11'));var Redis=require(_0x373f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x373f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x373f('0x14'));var utils=require(_0x373f('0x15'));var config=require(_0x373f('0x16'));var licenseUtil=require(_0x373f('0x17'));var db=require(_0x373f('0x18'))['db'];function respondWithStatusCode(_0x4205af,_0x4b5490){_0x4b5490=_0x4b5490||0xcc;return function(_0x571c4b){if(_0x571c4b){return _0x4205af[_0x373f('0x19')](_0x4b5490);}return _0x4205af['status'](_0x4b5490)[_0x373f('0x1a')]();};}function respondWithResult(_0x7103ff,_0xfbed91){_0xfbed91=_0xfbed91||0xc8;return function(_0x46d6d2){if(_0x46d6d2){return _0x7103ff[_0x373f('0x1b')](_0xfbed91)[_0x373f('0x1c')](_0x46d6d2);}};}function respondWithFilteredResult(_0x476787,_0xb635d7){return function(_0x5301d7){if(_0x5301d7){var _0x3472d0=_0x5301d7['count'],_0x3a587c=_0xb635d7['offset'],_0x42adf2=_0xb635d7['offset']+_0xb635d7[_0x373f('0x1d')],_0x16e4b8;if(_0x42adf2>=_0x3472d0){_0x42adf2=_0x3472d0;_0x16e4b8=0xc8;}else{_0x16e4b8=0xce;}_0x476787['status'](_0x16e4b8);return _0x476787['set'](_0x373f('0x1e'),_0x3a587c+'-'+_0x42adf2+'/'+_0x3472d0)[_0x373f('0x1c')](_0x5301d7);}return null;};}function patchUpdates(_0x31c9b0){return function(_0x18cb6f){try{jsonpatch[_0x373f('0x1f')](_0x18cb6f,_0x31c9b0,!![]);}catch(_0x3ef911){return BPromise[_0x373f('0x20')](_0x3ef911);}return _0x18cb6f[_0x373f('0x21')]();};}function saveUpdates(_0x3f7b8b,_0x425c66){return function(_0x37402a){if(_0x37402a){return _0x37402a[_0x373f('0x22')](_0x3f7b8b)[_0x373f('0x23')](function(_0x3e0df9){return _0x3e0df9;});}return null;};}function removeEntity(_0xe7a6fc,_0x359fb3){return function(_0xc90f23){if(_0xc90f23){return _0xc90f23['destroy']()[_0x373f('0x23')](function(){_0xe7a6fc[_0x373f('0x1b')](0xcc)[_0x373f('0x1a')]();});}};}function handleEntityNotFound(_0x564953,_0x2c5e5c){return function(_0x384e7e){if(!_0x384e7e){_0x564953[_0x373f('0x19')](0x194);}return _0x384e7e;};}function handleError(_0x495a8d,_0x12aca5){_0x12aca5=_0x12aca5||0x1f4;return function(_0x38b140){logger[_0x373f('0x24')](_0x38b140[_0x373f('0x25')]);if(_0x38b140[_0x373f('0x26')]){delete _0x38b140['name'];}_0x495a8d[_0x373f('0x1b')](_0x12aca5)[_0x373f('0x27')](_0x38b140);};}exports[_0x373f('0x28')]=function(_0xd9ab67,_0x235403){var _0x29933={},_0x5dd9c8={},_0x2f9cc1={'count':0x0,'rows':[]};var _0x9b708e=_[_0x373f('0x29')](db[_0x373f('0x2a')][_0x373f('0x2b')],function(_0x4c20fd){return{'name':_0x4c20fd[_0x373f('0x2c')],'type':_0x4c20fd[_0x373f('0x2d')][_0x373f('0x2e')]};});_0x5dd9c8['model']=_[_0x373f('0x29')](_0x9b708e,_0x373f('0x26'));_0x5dd9c8[_0x373f('0x2f')]=_[_0x373f('0x30')](_0xd9ab67['query']);_0x5dd9c8[_0x373f('0x31')]=_[_0x373f('0x32')](_0x5dd9c8['model'],_0x5dd9c8[_0x373f('0x2f')]);_0x29933['attributes']=_[_0x373f('0x32')](_0x5dd9c8[_0x373f('0x33')],qs[_0x373f('0x34')](_0xd9ab67[_0x373f('0x2f')]['fields']));_0x29933[_0x373f('0x35')]=_0x29933['attributes'][_0x373f('0x36')]?_0x29933[_0x373f('0x35')]:_0x5dd9c8[_0x373f('0x33')];if(!_0xd9ab67[_0x373f('0x2f')][_0x373f('0x37')](_0x373f('0x38'))){_0x29933[_0x373f('0x1d')]=qs[_0x373f('0x1d')](_0xd9ab67['query'][_0x373f('0x1d')]);_0x29933[_0x373f('0x39')]=qs[_0x373f('0x39')](_0xd9ab67['query'][_0x373f('0x39')]);}_0x29933[_0x373f('0x3a')]=qs[_0x373f('0x3b')](_0xd9ab67[_0x373f('0x2f')]['sort']);_0x29933[_0x373f('0x3c')]=qs[_0x373f('0x31')](_[_0x373f('0x3d')](_0xd9ab67[_0x373f('0x2f')],_0x5dd9c8['filters']),_0x9b708e);if(_0xd9ab67['query'][_0x373f('0x3e')]){_0x29933[_0x373f('0x3c')]=_[_0x373f('0x3f')](_0x29933[_0x373f('0x3c')],{'$or':_['map'](_0x9b708e,function(_0x58ae38){if(_0x58ae38[_0x373f('0x2d')]!==_0x373f('0x40')){var _0x114ad={};_0x114ad[_0x58ae38['name']]={'$like':'%'+_0xd9ab67['query'][_0x373f('0x3e')]+'%'};return _0x114ad;}})});}_0x29933=_[_0x373f('0x3f')]({},_0x29933,_0xd9ab67['options']);var _0x1dad06={'where':_0x29933[_0x373f('0x3c')]};return db[_0x373f('0x2a')]['count'](_0x1dad06)[_0x373f('0x23')](function(_0x3c5418){_0x2f9cc1[_0x373f('0x41')]=_0x3c5418;if(_0xd9ab67[_0x373f('0x2f')][_0x373f('0x42')]){_0x29933[_0x373f('0x43')]=[{'all':!![]}];}return db[_0x373f('0x2a')][_0x373f('0x44')](_0x29933);})[_0x373f('0x23')](function(_0x2e2724){_0x2f9cc1[_0x373f('0x45')]=_0x2e2724;return _0x2f9cc1;})[_0x373f('0x23')](respondWithFilteredResult(_0x235403,_0x29933))[_0x373f('0x46')](handleError(_0x235403,null));};exports[_0x373f('0x47')]=function(_0x874689,_0x29d56e){var _0x23c358={'raw':!![],'where':{'id':_0x874689['params']['id']}},_0x44bc97={};_0x44bc97['model']=_[_0x373f('0x30')](db[_0x373f('0x2a')][_0x373f('0x2b')]);_0x44bc97[_0x373f('0x2f')]=_[_0x373f('0x30')](_0x874689[_0x373f('0x2f')]);_0x44bc97[_0x373f('0x31')]=_['intersection'](_0x44bc97[_0x373f('0x33')],_0x44bc97['query']);_0x23c358[_0x373f('0x35')]=_[_0x373f('0x32')](_0x44bc97[_0x373f('0x33')],qs[_0x373f('0x34')](_0x874689[_0x373f('0x2f')]['fields']));_0x23c358['attributes']=_0x23c358[_0x373f('0x35')]['length']?_0x23c358[_0x373f('0x35')]:_0x44bc97[_0x373f('0x33')];if(_0x874689['query'][_0x373f('0x42')]){_0x23c358[_0x373f('0x43')]=[{'all':!![]}];}_0x23c358=_[_0x373f('0x3f')]({},_0x23c358,_0x874689[_0x373f('0x48')]);return db[_0x373f('0x2a')][_0x373f('0x49')](_0x23c358)[_0x373f('0x23')](handleEntityNotFound(_0x29d56e,null))[_0x373f('0x23')](respondWithResult(_0x29d56e,null))[_0x373f('0x46')](handleError(_0x29d56e,null));};exports['create']=function(_0x435ce1,_0xdbeef2){return db[_0x373f('0x2a')][_0x373f('0x4a')](_0x435ce1[_0x373f('0x4b')],{})[_0x373f('0x23')](respondWithResult(_0xdbeef2,0xc9))[_0x373f('0x46')](handleError(_0xdbeef2,null));};exports[_0x373f('0x22')]=function(_0xdc9809,_0xb45af1){if(_0xdc9809[_0x373f('0x4b')]['id']){delete _0xdc9809['body']['id'];}return db[_0x373f('0x2a')][_0x373f('0x49')]({'where':{'id':_0xdc9809['params']['id']}})[_0x373f('0x23')](handleEntityNotFound(_0xb45af1,null))['then'](saveUpdates(_0xdc9809[_0x373f('0x4b')],null))[_0x373f('0x23')](respondWithResult(_0xb45af1,null))['catch'](handleError(_0xb45af1,null));};exports[_0x373f('0x4c')]=function(_0x57aee2,_0x53dc09){return db[_0x373f('0x2a')][_0x373f('0x49')]({'where':{'id':_0x57aee2[_0x373f('0x4d')]['id']}})[_0x373f('0x23')](handleEntityNotFound(_0x53dc09,null))[_0x373f('0x23')](removeEntity(_0x53dc09,null))[_0x373f('0x46')](handleError(_0x53dc09,null));}; \ No newline at end of file +var _0x90bb=['update','then','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x90bb,0x18e));var _0xb90b=function(_0x270ab8,_0x4bb33c){_0x270ab8=_0x270ab8-0x0;var _0x582880=_0x90bb[_0x270ab8];return _0x582880;};'use strict';var pdf=require(_0xb90b('0x0'));var emlformat=require(_0xb90b('0x1'));var rimraf=require(_0xb90b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb90b('0x3'));var rp=require(_0xb90b('0x4'));var moment=require(_0xb90b('0x5'));var BPromise=require(_0xb90b('0x6'));var Mustache=require('mustache');var util=require(_0xb90b('0x7'));var path=require(_0xb90b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb90b('0x9'));var fs=require('fs');var _=require(_0xb90b('0xa'));var squel=require(_0xb90b('0xb'));var crypto=require('crypto');var jsforce=require(_0xb90b('0xc'));var deskjs=require(_0xb90b('0xd'));var toCsv=require(_0xb90b('0xe'));var querystring=require(_0xb90b('0xf'));var Papa=require('papaparse');var Redis=require(_0xb90b('0x10'));var authService=require(_0xb90b('0x11'));var qs=require(_0xb90b('0x12'));var as=require(_0xb90b('0x13'));var hardwareService=require(_0xb90b('0x14'));var logger=require(_0xb90b('0x15'))(_0xb90b('0x16'));var utils=require(_0xb90b('0x17'));var config=require(_0xb90b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb90b('0x19'))['db'];function respondWithStatusCode(_0x446fde,_0xd784af){_0xd784af=_0xd784af||0xcc;return function(_0x1836e9){if(_0x1836e9){return _0x446fde[_0xb90b('0x1a')](_0xd784af);}return _0x446fde['status'](_0xd784af)['end']();};}function respondWithResult(_0x1b5bb0,_0x5309a){_0x5309a=_0x5309a||0xc8;return function(_0x380eb0){if(_0x380eb0){return _0x1b5bb0[_0xb90b('0x1b')](_0x5309a)[_0xb90b('0x1c')](_0x380eb0);}};}function respondWithFilteredResult(_0x445043,_0x153607){return function(_0x508997){if(_0x508997){var _0x45b176=_0x508997[_0xb90b('0x1d')],_0x7f8f9d=_0x153607[_0xb90b('0x1e')],_0x2f1527=_0x153607['offset']+_0x153607['limit'],_0x4000d7;if(_0x2f1527>=_0x45b176){_0x2f1527=_0x45b176;_0x4000d7=0xc8;}else{_0x4000d7=0xce;}_0x445043['status'](_0x4000d7);return _0x445043[_0xb90b('0x1f')](_0xb90b('0x20'),_0x7f8f9d+'-'+_0x2f1527+'/'+_0x45b176)[_0xb90b('0x1c')](_0x508997);}return null;};}function patchUpdates(_0x280da6){return function(_0xca0f26){try{jsonpatch['apply'](_0xca0f26,_0x280da6,!![]);}catch(_0x47be11){return BPromise[_0xb90b('0x21')](_0x47be11);}return _0xca0f26['save']();};}function saveUpdates(_0x588eea,_0x44f22f){return function(_0xcc379b){if(_0xcc379b){return _0xcc379b[_0xb90b('0x22')](_0x588eea)[_0xb90b('0x23')](function(_0x202308){return _0x202308;});}return null;};}function removeEntity(_0x38ce6d,_0x73b916){return function(_0xfc876e){if(_0xfc876e){return _0xfc876e['destroy']()['then'](function(){_0x38ce6d[_0xb90b('0x1b')](0xcc)[_0xb90b('0x24')]();});}};}function handleEntityNotFound(_0x14164e,_0x1d0793){return function(_0xcef7a2){if(!_0xcef7a2){_0x14164e[_0xb90b('0x1a')](0x194);}return _0xcef7a2;};}function handleError(_0x22f99b,_0x4937ba){_0x4937ba=_0x4937ba||0x1f4;return function(_0x147527){logger[_0xb90b('0x25')](_0x147527['stack']);if(_0x147527[_0xb90b('0x26')]){delete _0x147527[_0xb90b('0x26')];}_0x22f99b['status'](_0x4937ba)[_0xb90b('0x27')](_0x147527);};}exports[_0xb90b('0x28')]=function(_0x5e52a0,_0x4a53f6){var _0x4623d6={},_0x2124ef={},_0x383bc2={'count':0x0,'rows':[]};var _0x2c2627=_[_0xb90b('0x29')](db[_0xb90b('0x2a')][_0xb90b('0x2b')],function(_0x2f7e61){return{'name':_0x2f7e61[_0xb90b('0x2c')],'type':_0x2f7e61['type']['key']};});_0x2124ef[_0xb90b('0x2d')]=_[_0xb90b('0x29')](_0x2c2627,'name');_0x2124ef[_0xb90b('0x2e')]=_[_0xb90b('0x2f')](_0x5e52a0['query']);_0x2124ef[_0xb90b('0x30')]=_[_0xb90b('0x31')](_0x2124ef[_0xb90b('0x2d')],_0x2124ef['query']);_0x4623d6[_0xb90b('0x32')]=_[_0xb90b('0x31')](_0x2124ef[_0xb90b('0x2d')],qs[_0xb90b('0x33')](_0x5e52a0['query'][_0xb90b('0x33')]));_0x4623d6[_0xb90b('0x32')]=_0x4623d6[_0xb90b('0x32')]['length']?_0x4623d6[_0xb90b('0x32')]:_0x2124ef[_0xb90b('0x2d')];if(!_0x5e52a0[_0xb90b('0x2e')][_0xb90b('0x34')]('nolimit')){_0x4623d6['limit']=qs[_0xb90b('0x35')](_0x5e52a0['query'][_0xb90b('0x35')]);_0x4623d6[_0xb90b('0x1e')]=qs[_0xb90b('0x1e')](_0x5e52a0[_0xb90b('0x2e')][_0xb90b('0x1e')]);}_0x4623d6[_0xb90b('0x36')]=qs[_0xb90b('0x37')](_0x5e52a0[_0xb90b('0x2e')][_0xb90b('0x37')]);_0x4623d6[_0xb90b('0x38')]=qs[_0xb90b('0x30')](_[_0xb90b('0x39')](_0x5e52a0['query'],_0x2124ef['filters']),_0x2c2627);if(_0x5e52a0[_0xb90b('0x2e')][_0xb90b('0x3a')]){_0x4623d6[_0xb90b('0x38')]=_[_0xb90b('0x3b')](_0x4623d6[_0xb90b('0x38')],{'$or':_[_0xb90b('0x29')](_0x2c2627,function(_0x4463d3){if(_0x4463d3[_0xb90b('0x3c')]!=='VIRTUAL'){var _0x3d8f28={};_0x3d8f28[_0x4463d3['name']]={'$like':'%'+_0x5e52a0[_0xb90b('0x2e')]['filter']+'%'};return _0x3d8f28;}})});}_0x4623d6=_[_0xb90b('0x3b')]({},_0x4623d6,_0x5e52a0['options']);var _0x4ca0e6={'where':_0x4623d6[_0xb90b('0x38')]};return db[_0xb90b('0x2a')][_0xb90b('0x1d')](_0x4ca0e6)[_0xb90b('0x23')](function(_0x26eb80){_0x383bc2[_0xb90b('0x1d')]=_0x26eb80;if(_0x5e52a0[_0xb90b('0x2e')]['includeAll']){_0x4623d6[_0xb90b('0x3d')]=[{'all':!![]}];}return db[_0xb90b('0x2a')][_0xb90b('0x3e')](_0x4623d6);})[_0xb90b('0x23')](function(_0x1b65fa){_0x383bc2[_0xb90b('0x3f')]=_0x1b65fa;return _0x383bc2;})[_0xb90b('0x23')](respondWithFilteredResult(_0x4a53f6,_0x4623d6))[_0xb90b('0x40')](handleError(_0x4a53f6,null));};exports[_0xb90b('0x41')]=function(_0x6a9386,_0x58db84){var _0x2920c6={'raw':!![],'where':{'id':_0x6a9386['params']['id']}},_0x56dc95={};_0x56dc95[_0xb90b('0x2d')]=_[_0xb90b('0x2f')](db[_0xb90b('0x2a')][_0xb90b('0x2b')]);_0x56dc95['query']=_[_0xb90b('0x2f')](_0x6a9386[_0xb90b('0x2e')]);_0x56dc95[_0xb90b('0x30')]=_[_0xb90b('0x31')](_0x56dc95['model'],_0x56dc95['query']);_0x2920c6[_0xb90b('0x32')]=_['intersection'](_0x56dc95[_0xb90b('0x2d')],qs[_0xb90b('0x33')](_0x6a9386[_0xb90b('0x2e')]['fields']));_0x2920c6[_0xb90b('0x32')]=_0x2920c6[_0xb90b('0x32')]['length']?_0x2920c6[_0xb90b('0x32')]:_0x56dc95[_0xb90b('0x2d')];if(_0x6a9386[_0xb90b('0x2e')][_0xb90b('0x42')]){_0x2920c6['include']=[{'all':!![]}];}_0x2920c6=_[_0xb90b('0x3b')]({},_0x2920c6,_0x6a9386[_0xb90b('0x43')]);return db[_0xb90b('0x2a')][_0xb90b('0x44')](_0x2920c6)[_0xb90b('0x23')](handleEntityNotFound(_0x58db84,null))[_0xb90b('0x23')](respondWithResult(_0x58db84,null))[_0xb90b('0x40')](handleError(_0x58db84,null));};exports[_0xb90b('0x45')]=function(_0x2c1ae4,_0x726a96){return db[_0xb90b('0x2a')][_0xb90b('0x45')](_0x2c1ae4[_0xb90b('0x46')],{})['then'](respondWithResult(_0x726a96,0xc9))[_0xb90b('0x40')](handleError(_0x726a96,null));};exports[_0xb90b('0x22')]=function(_0x125ee7,_0x23ba21){if(_0x125ee7[_0xb90b('0x46')]['id']){delete _0x125ee7[_0xb90b('0x46')]['id'];}return db[_0xb90b('0x2a')][_0xb90b('0x44')]({'where':{'id':_0x125ee7[_0xb90b('0x47')]['id']}})[_0xb90b('0x23')](handleEntityNotFound(_0x23ba21,null))[_0xb90b('0x23')](saveUpdates(_0x125ee7[_0xb90b('0x46')],null))[_0xb90b('0x23')](respondWithResult(_0x23ba21,null))[_0xb90b('0x40')](handleError(_0x23ba21,null));};exports['destroy']=function(_0x241a22,_0x2222c2){return db['ZohoField'][_0xb90b('0x44')]({'where':{'id':_0x241a22[_0xb90b('0x47')]['id']}})[_0xb90b('0x23')](handleEntityNotFound(_0x2222c2,null))[_0xb90b('0x23')](removeEntity(_0x2222c2,null))[_0xb90b('0x40')](handleError(_0x2222c2,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0f3e8f5..87f8761 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 _0x95fe=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields'];(function(_0x30f0ac,_0x5c4ee1){var _0x3132c5=function(_0x6d621e){while(--_0x6d621e){_0x30f0ac['push'](_0x30f0ac['shift']());}};_0x3132c5(++_0x5c4ee1);}(_0x95fe,0x7f));var _0xe95f=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x95fe[_0x2932cf];return _0x1711dd;};'use strict';var _=require(_0xe95f('0x0'));var util=require(_0xe95f('0x1'));var logger=require(_0xe95f('0x2'))(_0xe95f('0x3'));var moment=require(_0xe95f('0x4'));var BPromise=require(_0xe95f('0x5'));var rp=require(_0xe95f('0x6'));var fs=require('fs');var path=require(_0xe95f('0x7'));var rimraf=require(_0xe95f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe95f('0x9'));module[_0xe95f('0xa')]=function(_0x2a2ef1,_0x410ca7){return _0x2a2ef1['define'](_0xe95f('0xb'),attributes,{'tableName':_0xe95f('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xe95f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bcd=['rimraf','../../config/environment','./intZohoField.attributes','define','zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','path'];(function(_0x361bd6,_0x3c03ee){var _0x56956f=function(_0xe37e03){while(--_0xe37e03){_0x361bd6['push'](_0x361bd6['shift']());}};_0x56956f(++_0x3c03ee);}(_0x2bcd,0x163));var _0xd2bc=function(_0x301795,_0x148e19){_0x301795=_0x301795-0x0;var _0x30e83a=_0x2bcd[_0x301795];return _0x30e83a;};'use strict';var _=require('lodash');var util=require(_0xd2bc('0x0'));var logger=require(_0xd2bc('0x1'))(_0xd2bc('0x2'));var moment=require(_0xd2bc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2bc('0x4'));var rimraf=require(_0xd2bc('0x5'));var config=require(_0xd2bc('0x6'));var attributes=require(_0xd2bc('0x7'));module['exports']=function(_0x55970d,_0x436f58){return _0x55970d[_0xd2bc('0x8')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xd2bc('0x9'),'fields':[_0xd2bc('0xa'),_0xd2bc('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index dc5f2de..65d5fd2 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 _0xa630=['client','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x383450,_0xefcb3b){var _0x49aa15=function(_0xb308b8){while(--_0xb308b8){_0x383450['push'](_0x383450['shift']());}};_0x49aa15(++_0xefcb3b);}(_0xa630,0xbe));var _0x0a63=function(_0x490541,_0x5e23a8){_0x490541=_0x490541-0x0;var _0x42e33c=_0xa630[_0x490541];return _0x42e33c;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a63('0x4'))(_0x0a63('0x5'));var config=require(_0x0a63('0x6'));var jayson=require(_0x0a63('0x7'));var client=jayson[_0x0a63('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2760b0,_0x3d5f0b,_0xc2dcd7){return new BPromise(function(_0x41d21d,_0x12a7df){return client[_0x0a63('0x9')](_0x2760b0,_0xc2dcd7)['then'](function(_0x688acd){logger[_0x0a63('0xa')](_0x0a63('0xb'),_0x3d5f0b,_0x0a63('0xc'));logger[_0x0a63('0xd')](_0x0a63('0xe'),_0x3d5f0b,_0x0a63('0xc'),JSON[_0x0a63('0xf')](_0x688acd));if(_0x688acd[_0x0a63('0x10')]){if(_0x688acd[_0x0a63('0x10')]['code']===0x1f4){logger[_0x0a63('0x10')](_0x0a63('0xb'),_0x3d5f0b,_0x688acd[_0x0a63('0x10')][_0x0a63('0x11')]);return _0x12a7df(_0x688acd['error'][_0x0a63('0x11')]);}logger['error'](_0x0a63('0xb'),_0x3d5f0b,_0x688acd[_0x0a63('0x10')][_0x0a63('0x11')]);return _0x41d21d(_0x688acd[_0x0a63('0x10')][_0x0a63('0x11')]);}else{logger[_0x0a63('0xa')](_0x0a63('0xb'),_0x3d5f0b,_0x0a63('0xc'));_0x41d21d(_0x688acd['result'][_0x0a63('0x11')]);}})['catch'](function(_0x282856){logger[_0x0a63('0x10')](_0x0a63('0xb'),_0x3d5f0b,_0x282856);_0x12a7df(_0x282856);});});} \ No newline at end of file +var _0x3eea=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x41ac29,_0x5e147b){var _0x27e59a=function(_0x55fba7){while(--_0x55fba7){_0x41ac29['push'](_0x41ac29['shift']());}};_0x27e59a(++_0x5e147b);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x19f014,_0x4edea3){_0x19f014=_0x19f014-0x0;var _0x2297cc=_0x3eea[_0x19f014];return _0x2297cc;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){return client[_0xa3ee('0xc')](_0x538bf9,_0x4e4588)['then'](function(_0xb1b96d){logger['info'](_0xa3ee('0xd'),_0x4183ee,_0xa3ee('0xe'));logger[_0xa3ee('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4183ee,_0xa3ee('0xe'),JSON[_0xa3ee('0x10')](_0xb1b96d));if(_0xb1b96d['error']){if(_0xb1b96d['error'][_0xa3ee('0x11')]===0x1f4){logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')]['message']);return _0x56f37b(_0xb1b96d[_0xa3ee('0x12')]['message']);}logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')][_0xa3ee('0x13')]);return _0x37a3f0(_0xb1b96d['error'][_0xa3ee('0x13')]);}else{logger[_0xa3ee('0x14')]('ZohoField,\x20%s,\x20%s',_0x4183ee,'request\x20sent');_0x37a3f0(_0xb1b96d['result'][_0xa3ee('0x13')]);}})[_0xa3ee('0x15')](function(_0x354dd5){logger[_0xa3ee('0x12')]('ZohoField,\x20%s,\x20%s',_0x4183ee,_0x354dd5);_0x56f37b(_0x354dd5);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b25ba37..6638919 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 _0x1566=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xe6e7fe,_0x2ca13d){var _0xb70453=function(_0x1db6cf){while(--_0x1db6cf){_0xe6e7fe['push'](_0xe6e7fe['shift']());}};_0xb70453(++_0x2ca13d);}(_0x1566,0x1a1));var _0x6156=function(_0x2baa5d,_0x42a1cb){_0x2baa5d=_0x2baa5d-0x0;var _0x88bf18=_0x1566[_0x2baa5d];return _0x88bf18;};'use strict';var multer=require(_0x6156('0x0'));var util=require(_0x6156('0x1'));var path=require(_0x6156('0x2'));var timeout=require(_0x6156('0x3'));var express=require(_0x6156('0x4'));var router=express['Router']();var auth=require(_0x6156('0x5'));var interaction=require(_0x6156('0x6'));var config=require(_0x6156('0x7'));module[_0x6156('0x8')]=router; \ No newline at end of file +var _0x30cc=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2c607e,_0x20c938){var _0x5de712=function(_0x4b3b4b){while(--_0x4b3b4b){_0x2c607e['push'](_0x2c607e['shift']());}};_0x5de712(++_0x20c938);}(_0x30cc,0x68));var _0xc30c=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x30cc[_0x3b96cf];return _0x2e315a;};'use strict';var multer=require(_0xc30c('0x0'));var util=require(_0xc30c('0x1'));var path=require(_0xc30c('0x2'));var timeout=require(_0xc30c('0x3'));var express=require(_0xc30c('0x4'));var router=express[_0xc30c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc30c('0x6'));var config=require(_0xc30c('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index fc5d31a..48c80a7 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 _0xc11c=['state','sequelize','STRING','BOOLEAN'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0xc11c,0x85));var _0xcc11=function(_0x3c3cfb,_0x3744e4){_0x3c3cfb=_0x3c3cfb-0x0;var _0x3fe9dd=_0xc11c[_0x3c3cfb];return _0x3fe9dd;};'use strict';var Sequelize=require(_0xcc11('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc11('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xcc11('0x1')]},'path':{'type':Sequelize[_0xcc11('0x1')]},'type':{'type':Sequelize[_0xcc11('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xcc11('0x2')],'defaultValue':![]},'author':{'type':Sequelize[_0xcc11('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xcc11('0x3')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xcc11('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x51be=['exports','unique_name_and_version','STRING','app.js','INTEGER','state'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0x51be,0x6c));var _0xe51b=function(_0x8fb092,_0x883290){_0x8fb092=_0x8fb092-0x0;var _0xd63883=_0x51be[_0x8fb092];return _0xd63883;};'use strict';var Sequelize=require('sequelize');module[_0xe51b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe51b('0x1')},'version':{'type':Sequelize[_0xe51b('0x2')],'allowNull':![],'unique':_0xe51b('0x1')},'main':{'type':Sequelize[_0xe51b('0x2')],'defaultValue':_0xe51b('0x3')},'filename':{'type':Sequelize[_0xe51b('0x2')]},'path':{'type':Sequelize[_0xe51b('0x2')]},'type':{'type':Sequelize[_0xe51b('0x2')]},'size':{'type':Sequelize[_0xe51b('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe51b('0x2')]},'state':{'type':Sequelize[_0xe51b('0x2')],'unique':_0xe51b('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xe51b('0x2')]},'remoteUri':{'type':Sequelize[_0xe51b('0x2')]},'link':{'type':Sequelize[_0xe51b('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 cdc2504..d10551f 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 _0x1264=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters'];(function(_0x4eab4d,_0x1fbd49){var _0x3bffce=function(_0x1e4c66){while(--_0x1e4c66){_0x4eab4d['push'](_0x4eab4d['shift']());}};_0x3bffce(++_0x1fbd49);}(_0x1264,0x1af));var _0x4126=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x1264[_0x4d2993];return _0x427374;};'use strict';var pdf=require(_0x4126('0x0'));var emlformat=require(_0x4126('0x1'));var rimraf=require(_0x4126('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4126('0x3'));var moment=require(_0x4126('0x4'));var BPromise=require(_0x4126('0x5'));var Mustache=require(_0x4126('0x6'));var util=require(_0x4126('0x7'));var path=require(_0x4126('0x8'));var sox=require(_0x4126('0x9'));var csv=require(_0x4126('0xa'));var ejs=require(_0x4126('0xb'));var fs=require('fs');var _=require(_0x4126('0xc'));var squel=require(_0x4126('0xd'));var crypto=require(_0x4126('0xe'));var jsforce=require(_0x4126('0xf'));var deskjs=require(_0x4126('0x10'));var toCsv=require(_0x4126('0xa'));var querystring=require(_0x4126('0x11'));var Papa=require(_0x4126('0x12'));var Redis=require(_0x4126('0x13'));var authService=require(_0x4126('0x14'));var qs=require(_0x4126('0x15'));var as=require(_0x4126('0x16'));var hardwareService=require(_0x4126('0x17'));var logger=require('../../config/logger')(_0x4126('0x18'));var utils=require(_0x4126('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4126('0x1a'));var db=require(_0x4126('0x1b'))['db'];function respondWithStatusCode(_0x19fc1a,_0x37979d){_0x37979d=_0x37979d||0xcc;return function(_0x41fba8){if(_0x41fba8){return _0x19fc1a[_0x4126('0x1c')](_0x37979d);}return _0x19fc1a[_0x4126('0x1d')](_0x37979d)[_0x4126('0x1e')]();};}function respondWithResult(_0x4dc462,_0x50e750){_0x50e750=_0x50e750||0xc8;return function(_0x214cc7){if(_0x214cc7){return _0x4dc462[_0x4126('0x1d')](_0x50e750)['json'](_0x214cc7);}};}function respondWithFilteredResult(_0x4915cd,_0x5e37ed){return function(_0x52d751){if(_0x52d751){var _0x4980eb=_0x52d751[_0x4126('0x1f')],_0x62de4a=_0x5e37ed[_0x4126('0x20')],_0x1235f1=_0x5e37ed[_0x4126('0x20')]+_0x5e37ed[_0x4126('0x21')],_0x3ab245;if(_0x1235f1>=_0x4980eb){_0x1235f1=_0x4980eb;_0x3ab245=0xc8;}else{_0x3ab245=0xce;}_0x4915cd[_0x4126('0x1d')](_0x3ab245);return _0x4915cd[_0x4126('0x22')](_0x4126('0x23'),_0x62de4a+'-'+_0x1235f1+'/'+_0x4980eb)[_0x4126('0x24')](_0x52d751);}return null;};}function patchUpdates(_0x3c0158){return function(_0x8f17bc){try{jsonpatch[_0x4126('0x25')](_0x8f17bc,_0x3c0158,!![]);}catch(_0x5c9bcd){return BPromise[_0x4126('0x26')](_0x5c9bcd);}return _0x8f17bc[_0x4126('0x27')]();};}function saveUpdates(_0x5b2c7c,_0x230e68){return function(_0x328504){if(_0x328504){return _0x328504[_0x4126('0x28')](_0x5b2c7c)['then'](function(_0x559bd2){return _0x559bd2;});}return null;};}function removeEntity(_0x52446e,_0x30193b){return function(_0x2ebe24){if(_0x2ebe24){return _0x2ebe24[_0x4126('0x29')]()[_0x4126('0x2a')](function(){_0x52446e[_0x4126('0x1d')](0xcc)[_0x4126('0x1e')]();});}};}function handleEntityNotFound(_0x1885d2,_0x4d129b){return function(_0x136172){if(!_0x136172){_0x1885d2[_0x4126('0x1c')](0x194);}return _0x136172;};}function handleError(_0x31ec0b,_0x4d289b){_0x4d289b=_0x4d289b||0x1f4;return function(_0x29b07d){logger[_0x4126('0x2b')](_0x29b07d[_0x4126('0x2c')]);if(_0x29b07d[_0x4126('0x2d')]){delete _0x29b07d[_0x4126('0x2d')];}_0x31ec0b[_0x4126('0x1d')](_0x4d289b)[_0x4126('0x2e')](_0x29b07d);};}exports['index']=function(_0x54ec11,_0xff72f4){var _0x4b719f={},_0x1696eb={},_0x28173c={'count':0x0,'rows':[]};var _0x252549=_[_0x4126('0x2f')](db['Integration']['rawAttributes'],function(_0x2b72a6){return{'name':_0x2b72a6[_0x4126('0x30')],'type':_0x2b72a6[_0x4126('0x31')][_0x4126('0x32')]};});_0x1696eb[_0x4126('0x33')]=_[_0x4126('0x2f')](_0x252549,_0x4126('0x2d'));_0x1696eb[_0x4126('0x34')]=_[_0x4126('0x35')](_0x54ec11[_0x4126('0x34')]);_0x1696eb[_0x4126('0x36')]=_['intersection'](_0x1696eb['model'],_0x1696eb['query']);_0x4b719f['attributes']=_[_0x4126('0x37')](_0x1696eb[_0x4126('0x33')],qs[_0x4126('0x38')](_0x54ec11[_0x4126('0x34')][_0x4126('0x38')]));_0x4b719f[_0x4126('0x39')]=_0x4b719f[_0x4126('0x39')][_0x4126('0x3a')]?_0x4b719f[_0x4126('0x39')]:_0x1696eb[_0x4126('0x33')];if(!_0x54ec11[_0x4126('0x34')][_0x4126('0x3b')](_0x4126('0x3c'))){_0x4b719f['limit']=qs['limit'](_0x54ec11[_0x4126('0x34')]['limit']);_0x4b719f['offset']=qs[_0x4126('0x20')](_0x54ec11[_0x4126('0x34')][_0x4126('0x20')]);}_0x4b719f[_0x4126('0x3d')]=qs[_0x4126('0x3e')](_0x54ec11[_0x4126('0x34')][_0x4126('0x3e')]);_0x4b719f[_0x4126('0x3f')]=qs[_0x4126('0x36')](_[_0x4126('0x40')](_0x54ec11[_0x4126('0x34')],_0x1696eb[_0x4126('0x36')]),_0x252549);if(_0x54ec11[_0x4126('0x34')][_0x4126('0x41')]){_0x4b719f[_0x4126('0x3f')]=_[_0x4126('0x42')](_0x4b719f[_0x4126('0x3f')],{'$or':_[_0x4126('0x2f')](_0x252549,function(_0x49e89d){if(_0x49e89d[_0x4126('0x31')]!==_0x4126('0x43')){var _0x4c0131={};_0x4c0131[_0x49e89d['name']]={'$like':'%'+_0x54ec11[_0x4126('0x34')][_0x4126('0x41')]+'%'};return _0x4c0131;}})});}_0x4b719f=_[_0x4126('0x42')]({},_0x4b719f,_0x54ec11[_0x4126('0x44')]);var _0x217427={'where':_0x4b719f[_0x4126('0x3f')]};return db[_0x4126('0x45')][_0x4126('0x1f')](_0x217427)[_0x4126('0x2a')](function(_0x7fe64a){_0x28173c['count']=_0x7fe64a;if(_0x54ec11[_0x4126('0x34')][_0x4126('0x46')]){_0x4b719f[_0x4126('0x47')]=[{'all':!![]}];}return db[_0x4126('0x45')][_0x4126('0x48')](_0x4b719f);})[_0x4126('0x2a')](function(_0x550650){_0x28173c[_0x4126('0x49')]=_0x550650;return _0x28173c;})[_0x4126('0x2a')](respondWithFilteredResult(_0xff72f4,_0x4b719f))[_0x4126('0x4a')](handleError(_0xff72f4,null));};exports[_0x4126('0x4b')]=function(_0x3893a9,_0xbd69ae){var _0x5c570e={'raw':![],'where':{'id':_0x3893a9[_0x4126('0x4c')]['id']}},_0x4679e1={};_0x4679e1[_0x4126('0x33')]=_[_0x4126('0x35')](db[_0x4126('0x45')][_0x4126('0x4d')]);_0x4679e1[_0x4126('0x34')]=_[_0x4126('0x35')](_0x3893a9['query']);_0x4679e1[_0x4126('0x36')]=_[_0x4126('0x37')](_0x4679e1[_0x4126('0x33')],_0x4679e1[_0x4126('0x34')]);_0x5c570e[_0x4126('0x39')]=_[_0x4126('0x37')](_0x4679e1['model'],qs['fields'](_0x3893a9[_0x4126('0x34')]['fields']));_0x5c570e[_0x4126('0x39')]=_0x5c570e[_0x4126('0x39')][_0x4126('0x3a')]?_0x5c570e[_0x4126('0x39')]:_0x4679e1[_0x4126('0x33')];if(_0x3893a9['query']['includeAll']){_0x5c570e[_0x4126('0x47')]=[{'all':!![]}];}_0x5c570e=_[_0x4126('0x42')]({},_0x5c570e,_0x3893a9[_0x4126('0x44')]);return db[_0x4126('0x45')]['find'](_0x5c570e)[_0x4126('0x2a')](handleEntityNotFound(_0xbd69ae,null))['then'](respondWithResult(_0xbd69ae,null))[_0x4126('0x4a')](handleError(_0xbd69ae,null));};exports[_0x4126('0x4e')]=function(_0x5ae6f7,_0x562d4b){return db[_0x4126('0x45')][_0x4126('0x4e')](_0x5ae6f7[_0x4126('0x4f')],{})[_0x4126('0x2a')](respondWithResult(_0x562d4b,0xc9))['catch'](handleError(_0x562d4b,null));};exports[_0x4126('0x28')]=function(_0x81e7d4,_0x23ff3f){if(_0x81e7d4[_0x4126('0x4f')]['id']){delete _0x81e7d4[_0x4126('0x4f')]['id'];}return db[_0x4126('0x45')][_0x4126('0x50')]({'where':{'id':_0x81e7d4[_0x4126('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ff3f,null))[_0x4126('0x2a')](saveUpdates(_0x81e7d4['body'],null))[_0x4126('0x2a')](respondWithResult(_0x23ff3f,null))[_0x4126('0x4a')](handleError(_0x23ff3f,null));};exports[_0x4126('0x29')]=function(_0x15c9fd,_0x5da3cf){return db[_0x4126('0x45')][_0x4126('0x50')]({'where':{'id':_0x15c9fd[_0x4126('0x4c')]['id']}})[_0x4126('0x2a')](handleEntityNotFound(_0x5da3cf,null))[_0x4126('0x2a')](removeEntity(_0x5da3cf,null))[_0x4126('0x4a')](handleError(_0x5da3cf,null));}; \ No newline at end of file +var _0x281e=['hasOwnProperty','nolimit','limit','sort','filters','pick','where','VIRTUAL','filter','merge','Integration','then','includeAll','findAll','rows','show','params','length','include','options','find','catch','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x4a7e43,_0x2aead5){var _0x1547e6=function(_0x3a12bd){while(--_0x3a12bd){_0x4a7e43['push'](_0x4a7e43['shift']());}};_0x1547e6(++_0x2aead5);}(_0x281e,0x68));var _0xe281=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x281e[_0x231e16];return _0x570a7c;};'use strict';var pdf=require(_0xe281('0x0'));var emlformat=require(_0xe281('0x1'));var rimraf=require(_0xe281('0x2'));var zipdir=require(_0xe281('0x3'));var jsonpatch=require(_0xe281('0x4'));var rp=require(_0xe281('0x5'));var moment=require(_0xe281('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe281('0x7'));var util=require(_0xe281('0x8'));var path=require(_0xe281('0x9'));var sox=require(_0xe281('0xa'));var csv=require(_0xe281('0xb'));var ejs=require(_0xe281('0xc'));var fs=require('fs');var _=require(_0xe281('0xd'));var squel=require(_0xe281('0xe'));var crypto=require(_0xe281('0xf'));var jsforce=require(_0xe281('0x10'));var deskjs=require(_0xe281('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe281('0x12'));var Papa=require(_0xe281('0x13'));var Redis=require(_0xe281('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe281('0x15'));var as=require(_0xe281('0x16'));var hardwareService=require(_0xe281('0x17'));var logger=require(_0xe281('0x18'))(_0xe281('0x19'));var utils=require(_0xe281('0x1a'));var config=require(_0xe281('0x1b'));var licenseUtil=require(_0xe281('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39e013,_0x13b7f2){_0x13b7f2=_0x13b7f2||0xcc;return function(_0x3e52d7){if(_0x3e52d7){return _0x39e013[_0xe281('0x1d')](_0x13b7f2);}return _0x39e013[_0xe281('0x1e')](_0x13b7f2)[_0xe281('0x1f')]();};}function respondWithResult(_0x1833e9,_0x41be4c){_0x41be4c=_0x41be4c||0xc8;return function(_0x1f0fa3){if(_0x1f0fa3){return _0x1833e9['status'](_0x41be4c)['json'](_0x1f0fa3);}};}function respondWithFilteredResult(_0x262a14,_0x2a474f){return function(_0x6527bc){if(_0x6527bc){var _0x362543=_0x6527bc[_0xe281('0x20')],_0x9c3bac=_0x2a474f['offset'],_0xe9e488=_0x2a474f[_0xe281('0x21')]+_0x2a474f['limit'],_0x5ed3f2;if(_0xe9e488>=_0x362543){_0xe9e488=_0x362543;_0x5ed3f2=0xc8;}else{_0x5ed3f2=0xce;}_0x262a14[_0xe281('0x1e')](_0x5ed3f2);return _0x262a14[_0xe281('0x22')](_0xe281('0x23'),_0x9c3bac+'-'+_0xe9e488+'/'+_0x362543)[_0xe281('0x24')](_0x6527bc);}return null;};}function patchUpdates(_0x52f083){return function(_0xc8a20){try{jsonpatch[_0xe281('0x25')](_0xc8a20,_0x52f083,!![]);}catch(_0x35bc4c){return BPromise[_0xe281('0x26')](_0x35bc4c);}return _0xc8a20['save']();};}function saveUpdates(_0x5f41e3,_0x208977){return function(_0x765863){if(_0x765863){return _0x765863[_0xe281('0x27')](_0x5f41e3)['then'](function(_0x14f649){return _0x14f649;});}return null;};}function removeEntity(_0x588b32,_0x3326f7){return function(_0xa2626f){if(_0xa2626f){return _0xa2626f['destroy']()['then'](function(){_0x588b32[_0xe281('0x1e')](0xcc)[_0xe281('0x1f')]();});}};}function handleEntityNotFound(_0x6befdb,_0x20ed9b){return function(_0x55b672){if(!_0x55b672){_0x6befdb[_0xe281('0x1d')](0x194);}return _0x55b672;};}function handleError(_0x2319a3,_0x121570){_0x121570=_0x121570||0x1f4;return function(_0x1f5612){logger[_0xe281('0x28')](_0x1f5612[_0xe281('0x29')]);if(_0x1f5612[_0xe281('0x2a')]){delete _0x1f5612[_0xe281('0x2a')];}_0x2319a3[_0xe281('0x1e')](_0x121570)[_0xe281('0x2b')](_0x1f5612);};}exports[_0xe281('0x2c')]=function(_0x21b108,_0x270026){var _0x20dbd8={},_0xd2f078={},_0x58b847={'count':0x0,'rows':[]};var _0x576b5a=_[_0xe281('0x2d')](db['Integration'][_0xe281('0x2e')],function(_0x3fcb61){return{'name':_0x3fcb61[_0xe281('0x2f')],'type':_0x3fcb61[_0xe281('0x30')][_0xe281('0x31')]};});_0xd2f078[_0xe281('0x32')]=_['map'](_0x576b5a,_0xe281('0x2a'));_0xd2f078[_0xe281('0x33')]=_[_0xe281('0x34')](_0x21b108[_0xe281('0x33')]);_0xd2f078['filters']=_[_0xe281('0x35')](_0xd2f078[_0xe281('0x32')],_0xd2f078[_0xe281('0x33')]);_0x20dbd8['attributes']=_['intersection'](_0xd2f078['model'],qs[_0xe281('0x36')](_0x21b108['query']['fields']));_0x20dbd8[_0xe281('0x37')]=_0x20dbd8['attributes']['length']?_0x20dbd8[_0xe281('0x37')]:_0xd2f078[_0xe281('0x32')];if(!_0x21b108[_0xe281('0x33')][_0xe281('0x38')](_0xe281('0x39'))){_0x20dbd8[_0xe281('0x3a')]=qs[_0xe281('0x3a')](_0x21b108[_0xe281('0x33')]['limit']);_0x20dbd8[_0xe281('0x21')]=qs['offset'](_0x21b108[_0xe281('0x33')]['offset']);}_0x20dbd8['order']=qs['sort'](_0x21b108[_0xe281('0x33')][_0xe281('0x3b')]);_0x20dbd8['where']=qs[_0xe281('0x3c')](_[_0xe281('0x3d')](_0x21b108[_0xe281('0x33')],_0xd2f078[_0xe281('0x3c')]),_0x576b5a);if(_0x21b108[_0xe281('0x33')]['filter']){_0x20dbd8[_0xe281('0x3e')]=_['merge'](_0x20dbd8[_0xe281('0x3e')],{'$or':_[_0xe281('0x2d')](_0x576b5a,function(_0x56bd52){if(_0x56bd52[_0xe281('0x30')]!==_0xe281('0x3f')){var _0x490b56={};_0x490b56[_0x56bd52[_0xe281('0x2a')]]={'$like':'%'+_0x21b108[_0xe281('0x33')][_0xe281('0x40')]+'%'};return _0x490b56;}})});}_0x20dbd8=_[_0xe281('0x41')]({},_0x20dbd8,_0x21b108['options']);var _0x3593a1={'where':_0x20dbd8[_0xe281('0x3e')]};return db[_0xe281('0x42')][_0xe281('0x20')](_0x3593a1)[_0xe281('0x43')](function(_0x16b2f2){_0x58b847['count']=_0x16b2f2;if(_0x21b108['query'][_0xe281('0x44')]){_0x20dbd8['include']=[{'all':!![]}];}return db[_0xe281('0x42')][_0xe281('0x45')](_0x20dbd8);})[_0xe281('0x43')](function(_0x402d2b){_0x58b847[_0xe281('0x46')]=_0x402d2b;return _0x58b847;})[_0xe281('0x43')](respondWithFilteredResult(_0x270026,_0x20dbd8))['catch'](handleError(_0x270026,null));};exports[_0xe281('0x47')]=function(_0x1f91fe,_0x4c7179){var _0x231a54={'raw':![],'where':{'id':_0x1f91fe[_0xe281('0x48')]['id']}},_0x13bf51={};_0x13bf51['model']=_[_0xe281('0x34')](db[_0xe281('0x42')][_0xe281('0x2e')]);_0x13bf51[_0xe281('0x33')]=_['keys'](_0x1f91fe[_0xe281('0x33')]);_0x13bf51['filters']=_['intersection'](_0x13bf51[_0xe281('0x32')],_0x13bf51[_0xe281('0x33')]);_0x231a54['attributes']=_['intersection'](_0x13bf51[_0xe281('0x32')],qs[_0xe281('0x36')](_0x1f91fe[_0xe281('0x33')][_0xe281('0x36')]));_0x231a54['attributes']=_0x231a54['attributes'][_0xe281('0x49')]?_0x231a54[_0xe281('0x37')]:_0x13bf51['model'];if(_0x1f91fe[_0xe281('0x33')][_0xe281('0x44')]){_0x231a54[_0xe281('0x4a')]=[{'all':!![]}];}_0x231a54=_[_0xe281('0x41')]({},_0x231a54,_0x1f91fe[_0xe281('0x4b')]);return db[_0xe281('0x42')][_0xe281('0x4c')](_0x231a54)[_0xe281('0x43')](handleEntityNotFound(_0x4c7179,null))[_0xe281('0x43')](respondWithResult(_0x4c7179,null))[_0xe281('0x4d')](handleError(_0x4c7179,null));};exports['create']=function(_0x5cf9cc,_0x54cf24){return db[_0xe281('0x42')]['create'](_0x5cf9cc[_0xe281('0x4e')],{})[_0xe281('0x43')](respondWithResult(_0x54cf24,0xc9))[_0xe281('0x4d')](handleError(_0x54cf24,null));};exports['update']=function(_0x44086a,_0x5cfc9c){if(_0x44086a[_0xe281('0x4e')]['id']){delete _0x44086a[_0xe281('0x4e')]['id'];}return db[_0xe281('0x42')][_0xe281('0x4c')]({'where':{'id':_0x44086a[_0xe281('0x48')]['id']}})['then'](handleEntityNotFound(_0x5cfc9c,null))[_0xe281('0x43')](saveUpdates(_0x44086a[_0xe281('0x4e')],null))[_0xe281('0x43')](respondWithResult(_0x5cfc9c,null))[_0xe281('0x4d')](handleError(_0x5cfc9c,null));};exports[_0xe281('0x4f')]=function(_0x452493,_0x107be0){return db[_0xe281('0x42')][_0xe281('0x4c')]({'where':{'id':_0x452493['params']['id']}})[_0xe281('0x43')](handleEntityNotFound(_0x107be0,null))[_0xe281('0x43')](removeEntity(_0x107be0,null))['catch'](handleError(_0x107be0,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d273a2d..aef02f8 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 _0xcda6=['exports','define','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes'];(function(_0x4bee17,_0x530e95){var _0x2d95b7=function(_0x529254){while(--_0x529254){_0x4bee17['push'](_0x4bee17['shift']());}};_0x2d95b7(++_0x530e95);}(_0xcda6,0x66));var _0x6cda=function(_0x374ad5,_0x2f28a2){_0x374ad5=_0x374ad5-0x0;var _0x55c401=_0xcda6[_0x374ad5];return _0x55c401;};'use strict';var _=require(_0x6cda('0x0'));var util=require('util');var logger=require(_0x6cda('0x1'))(_0x6cda('0x2'));var moment=require('moment');var BPromise=require(_0x6cda('0x3'));var rp=require(_0x6cda('0x4'));var fs=require('fs');var path=require(_0x6cda('0x5'));var rimraf=require('rimraf');var config=require(_0x6cda('0x6'));var attributes=require(_0x6cda('0x7'));module[_0x6cda('0x8')]=function(_0x20e142,_0x25d56f){return _0x20e142[_0x6cda('0x9')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f37=['./integration.attributes','define','Integration','integrations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d5915,_0x49467c){var _0x5dfbd9=function(_0x22d30c){while(--_0x22d30c){_0x5d5915['push'](_0x5d5915['shift']());}};_0x5dfbd9(++_0x49467c);}(_0x8f37,0x1a8));var _0x78f3=function(_0x64f47b,_0xc8c0ea){_0x64f47b=_0x64f47b-0x0;var _0x3d5c39=_0x8f37[_0x64f47b];return _0x3d5c39;};'use strict';var _=require(_0x78f3('0x0'));var util=require('util');var logger=require(_0x78f3('0x1'))(_0x78f3('0x2'));var moment=require('moment');var BPromise=require(_0x78f3('0x3'));var rp=require(_0x78f3('0x4'));var fs=require('fs');var path=require(_0x78f3('0x5'));var rimraf=require(_0x78f3('0x6'));var config=require(_0x78f3('0x7'));var attributes=require(_0x78f3('0x8'));module['exports']=function(_0x2baca5,_0x1e39c0){return _0x2baca5[_0x78f3('0x9')](_0x78f3('0xa'),attributes,{'tableName':_0x78f3('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 e7145cc..47a82c6 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 _0x4eea=['jayson/promise','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4deeb3,_0x33fce2){var _0xe851=function(_0x52aed7){while(--_0x52aed7){_0x4deeb3['push'](_0x4deeb3['shift']());}};_0xe851(++_0x33fce2);}(_0x4eea,0x149));var _0xa4ee=function(_0x5447ec,_0x3d44cb){_0x5447ec=_0x5447ec-0x0;var _0x3fab94=_0x4eea[_0x5447ec];return _0x3fab94;};'use strict';var _=require('lodash');var util=require(_0xa4ee('0x0'));var moment=require(_0xa4ee('0x1'));var BPromise=require('bluebird');var rs=require(_0xa4ee('0x2'));var fs=require('fs');var Redis=require(_0xa4ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4ee('0x4'));var logger=require(_0xa4ee('0x5'))('rpc');var config=require(_0xa4ee('0x6'));var jayson=require(_0xa4ee('0x7'));var client=jayson[_0xa4ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57708a,_0x571944,_0x24be23){return new BPromise(function(_0x1fb3c4,_0x5e1f4e){return client[_0xa4ee('0x9')](_0x57708a,_0x24be23)[_0xa4ee('0xa')](function(_0x410f6c){logger[_0xa4ee('0xb')](_0xa4ee('0xc'),_0x571944,_0xa4ee('0xd'));logger[_0xa4ee('0xe')](_0xa4ee('0xf'),_0x571944,'request\x20sent',JSON[_0xa4ee('0x10')](_0x410f6c));if(_0x410f6c[_0xa4ee('0x11')]){if(_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x12')]===0x1f4){logger[_0xa4ee('0x11')]('Integration,\x20%s,\x20%s',_0x571944,_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x13')]);return _0x5e1f4e(_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x13')]);}logger[_0xa4ee('0x11')](_0xa4ee('0xc'),_0x571944,_0x410f6c[_0xa4ee('0x11')]['message']);return _0x1fb3c4(_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x13')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x571944,'request\x20sent');_0x1fb3c4(_0x410f6c[_0xa4ee('0x14')][_0xa4ee('0x13')]);}})['catch'](function(_0x5a9d88){logger[_0xa4ee('0x11')](_0xa4ee('0xc'),_0x571944,_0x5a9d88);_0x5e1f4e(_0x5a9d88);});});} \ No newline at end of file +var _0xfa12=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f32c4,_0x2597ba){var _0x95b5dc=function(_0x4ee89e){while(--_0x4ee89e){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x95b5dc(++_0x2597ba);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x3acd57,_0x2d17fe){_0x3acd57=_0x3acd57-0x0;var _0x1c7407=_0xfa12[_0x3acd57];return _0x1c7407;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var moment=require(_0x2fa1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fa1('0x3'));var db=require(_0x2fa1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2fa1('0x5'));var config=require(_0x2fa1('0x6'));var jayson=require(_0x2fa1('0x7'));var client=jayson['client'][_0x2fa1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d5fb4,_0xfa25d9,_0x1adece){return new BPromise(function(_0x3ee801,_0x370571){return client[_0x2fa1('0x9')](_0x5d5fb4,_0x1adece)[_0x2fa1('0xa')](function(_0x4e3028){logger[_0x2fa1('0xb')](_0x2fa1('0xc'),_0xfa25d9,_0x2fa1('0xd'));logger[_0x2fa1('0xe')](_0x2fa1('0xf'),_0xfa25d9,_0x2fa1('0xd'),JSON[_0x2fa1('0x10')](_0x4e3028));if(_0x4e3028[_0x2fa1('0x11')]){if(_0x4e3028['error'][_0x2fa1('0x12')]===0x1f4){logger['error'](_0x2fa1('0xc'),_0xfa25d9,_0x4e3028['error'][_0x2fa1('0x13')]);return _0x370571(_0x4e3028[_0x2fa1('0x11')][_0x2fa1('0x13')]);}logger[_0x2fa1('0x11')](_0x2fa1('0xc'),_0xfa25d9,_0x4e3028[_0x2fa1('0x11')]['message']);return _0x3ee801(_0x4e3028[_0x2fa1('0x11')]['message']);}else{logger[_0x2fa1('0xb')](_0x2fa1('0xc'),_0xfa25d9,'request\x20sent');_0x3ee801(_0x4e3028[_0x2fa1('0x14')][_0x2fa1('0x13')]);}})[_0x2fa1('0x15')](function(_0x4584b3){logger[_0x2fa1('0x11')]('Integration,\x20%s,\x20%s',_0xfa25d9,_0x4584b3);_0x370571(_0x4584b3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b919cc7..efeb8e3 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 _0xe5fc=['path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5c1930,_0x1b15e7){var _0x163a34=function(_0x52b4b5){while(--_0x52b4b5){_0x5c1930['push'](_0x5c1930['shift']());}};_0x163a34(++_0x1b15e7);}(_0xe5fc,0x109));var _0xce5f=function(_0x1297b8,_0x4e4608){_0x1297b8=_0x1297b8-0x0;var _0x23e3a8=_0xe5fc[_0x1297b8];return _0x23e3a8;};'use strict';var multer=require(_0xce5f('0x0'));var util=require('util');var path=require(_0xce5f('0x1'));var timeout=require(_0xce5f('0x2'));var express=require(_0xce5f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xce5f('0x4'));var controller=require('./integrationReport.controller');router[_0xce5f('0x5')]('/',auth[_0xce5f('0x6')](),controller[_0xce5f('0x7')]);router[_0xce5f('0x5')](_0xce5f('0x8'),auth[_0xce5f('0x6')](),controller[_0xce5f('0x9')]);router[_0xce5f('0x5')]('/:id',auth[_0xce5f('0x6')](),controller[_0xce5f('0xa')]);router[_0xce5f('0xb')]('/',auth[_0xce5f('0x6')](),controller[_0xce5f('0xc')]);router[_0xce5f('0xd')](_0xce5f('0xe'),auth['isAuthenticated'](),controller[_0xce5f('0xf')]);router[_0xce5f('0x10')](_0xce5f('0xe'),auth[_0xce5f('0x6')](),controller[_0xce5f('0x11')]);module[_0xce5f('0x12')]=router; \ No newline at end of file +var _0x1707=['create','update','delete','multer','express','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x1707,0x1df));var _0x7170=function(_0x2ed41e,_0xb83ec8){_0x2ed41e=_0x2ed41e-0x0;var _0xf254cf=_0x1707[_0x2ed41e];return _0xf254cf;};'use strict';var multer=require(_0x7170('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7170('0x1'));var router=express[_0x7170('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7170('0x3'));var config=require(_0x7170('0x4'));var controller=require(_0x7170('0x5'));router[_0x7170('0x6')]('/',auth[_0x7170('0x7')](),controller[_0x7170('0x8')]);router[_0x7170('0x6')](_0x7170('0x9'),auth[_0x7170('0x7')](),controller[_0x7170('0xa')]);router[_0x7170('0x6')](_0x7170('0xb'),auth[_0x7170('0x7')](),controller[_0x7170('0xc')]);router[_0x7170('0xd')]('/',auth[_0x7170('0x7')](),controller[_0x7170('0xe')]);router['put'](_0x7170('0xb'),auth['isAuthenticated'](),controller[_0x7170('0xf')]);router[_0x7170('0x10')](_0x7170('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f3a7afb..935325a 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 _0xde42=['ENUM','SENT','SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x3e626f,_0x2a5998){var _0x5351c6=function(_0x14afb4){while(--_0x14afb4){_0x3e626f['push'](_0x3e626f['shift']());}};_0x5351c6(++_0x2a5998);}(_0xde42,0x1d9));var _0x2de4=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0xde42[_0x5f42f1];return _0x5534ee;};'use strict';var Sequelize=require(_0x2de4('0x0'));module[_0x2de4('0x1')]={'integration':{'type':Sequelize[_0x2de4('0x2')]},'eventChannel':{'type':Sequelize[_0x2de4('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2de4('0x2')]},'integrationId':{'type':Sequelize[_0x2de4('0x3')]},'contacts':{'type':Sequelize[_0x2de4('0x2')]},'uniqueid':{'type':Sequelize[_0x2de4('0x2')]},'calleridnum':{'type':Sequelize[_0x2de4('0x2')]},'calleridname':{'type':Sequelize[_0x2de4('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2de4('0x2')]},'membername':{'type':Sequelize[_0x2de4('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2de4('0x4')]},'agentconnectAt':{'type':Sequelize[_0x2de4('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x2de4('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2de4('0x4')]},'talktime':{'type':Sequelize[_0x2de4('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2de4('0x3')]},'reason':{'type':Sequelize[_0x2de4('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x2de4('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2de4('0x4')]},'agentdump':{'type':Sequelize[_0x2de4('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x2de4('0x2')]},'channel':{'type':Sequelize[_0x2de4('0x2')]},'channelstate':{'type':Sequelize[_0x2de4('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2de4('0x2')]},'language':{'type':Sequelize[_0x2de4('0x2')]},'accountcode':{'type':Sequelize[_0x2de4('0x2')]},'context':{'type':Sequelize[_0x2de4('0x2')]},'exten':{'type':Sequelize[_0x2de4('0x2')]},'priority':{'type':Sequelize[_0x2de4('0x2')]},'destchannel':{'type':Sequelize[_0x2de4('0x2')]},'destchannelstate':{'type':Sequelize[_0x2de4('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2de4('0x2')]},'destcalleridname':{'type':Sequelize[_0x2de4('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2de4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x2de4('0x2')]},'destlanguage':{'type':Sequelize[_0x2de4('0x2')]},'destaccountcode':{'type':Sequelize[_0x2de4('0x2')]},'destcontext':{'type':Sequelize[_0x2de4('0x2')]},'destexten':{'type':Sequelize[_0x2de4('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2de4('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2de4('0x2')]},'subject':{'type':Sequelize[_0x2de4('0x2')]},'from':{'type':Sequelize[_0x2de4('0x2')]},'to':{'type':Sequelize[_0x2de4('0x2')]},'cc':{'type':Sequelize[_0x2de4('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x2de4('0x6')]},'text':{'type':Sequelize[_0x2de4('0x6')]},'status':{'type':Sequelize[_0x2de4('0x7')](_0x2de4('0x8'),_0x2de4('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x2de4('0x2')]},'app':{'type':Sequelize[_0x2de4('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xec59=['RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENT'];(function(_0x31052d,_0x247bca){var _0x372413=function(_0x5a95d0){while(--_0x5a95d0){_0x31052d['push'](_0x31052d['shift']());}};_0x372413(++_0x247bca);}(_0xec59,0x14f));var _0x9ec5=function(_0x11b849,_0x433d21){_0x11b849=_0x11b849-0x0;var _0x3d9cdc=_0xec59[_0x11b849];return _0x3d9cdc;};'use strict';var Sequelize=require(_0x9ec5('0x0'));module['exports']={'integration':{'type':Sequelize[_0x9ec5('0x1')]},'eventChannel':{'type':Sequelize[_0x9ec5('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x9ec5('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x9ec5('0x1')]},'uniqueid':{'type':Sequelize[_0x9ec5('0x1')]},'calleridnum':{'type':Sequelize[_0x9ec5('0x1')]},'calleridname':{'type':Sequelize[_0x9ec5('0x1')]},'queue':{'type':Sequelize[_0x9ec5('0x1')]},'interface':{'type':Sequelize[_0x9ec5('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x9ec5('0x2')]},'agentconnectAt':{'type':Sequelize[_0x9ec5('0x2')]},'holdtime':{'type':Sequelize[_0x9ec5('0x3')]},'agentcomplete':{'type':Sequelize[_0x9ec5('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9ec5('0x2')]},'talktime':{'type':Sequelize[_0x9ec5('0x3')]},'agentacw':{'type':Sequelize[_0x9ec5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9ec5('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9ec5('0x2')]},'agentdump':{'type':Sequelize[_0x9ec5('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x9ec5('0x1')]},'channel':{'type':Sequelize[_0x9ec5('0x1')]},'channelstate':{'type':Sequelize[_0x9ec5('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9ec5('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9ec5('0x1')]},'context':{'type':Sequelize[_0x9ec5('0x1')]},'exten':{'type':Sequelize[_0x9ec5('0x1')]},'priority':{'type':Sequelize[_0x9ec5('0x1')]},'destchannel':{'type':Sequelize[_0x9ec5('0x1')]},'destchannelstate':{'type':Sequelize[_0x9ec5('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9ec5('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9ec5('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9ec5('0x1')]},'destaccountcode':{'type':Sequelize[_0x9ec5('0x1')]},'destcontext':{'type':Sequelize[_0x9ec5('0x1')]},'destexten':{'type':Sequelize[_0x9ec5('0x1')]},'destpriority':{'type':Sequelize[_0x9ec5('0x1')]},'destuniqueid':{'type':Sequelize[_0x9ec5('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x9ec5('0x1')]},'subject':{'type':Sequelize[_0x9ec5('0x1')]},'from':{'type':Sequelize[_0x9ec5('0x1')]},'to':{'type':Sequelize[_0x9ec5('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x9ec5('0x5')]},'text':{'type':Sequelize[_0x9ec5('0x5')]},'status':{'type':Sequelize['ENUM'](_0x9ec5('0x6'),'SENDING',_0x9ec5('0x7'),_0x9ec5('0x8'))},'url':{'type':Sequelize[_0x9ec5('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x9ec5('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 3b28427..710ab50 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 _0x0fab=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','keys','includeAll','find','catch','create','params','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x4dbb63,_0x2b5569){var _0x344d75=function(_0xd5fb97){while(--_0xd5fb97){_0x4dbb63['push'](_0x4dbb63['shift']());}};_0x344d75(++_0x2b5569);}(_0x0fab,0x1ce));var _0xb0fa=function(_0x1b91b1,_0x200f8f){_0x1b91b1=_0x1b91b1-0x0;var _0x553aac=_0x0fab[_0x1b91b1];return _0x553aac;};'use strict';var pdf=require(_0xb0fa('0x0'));var emlformat=require(_0xb0fa('0x1'));var rimraf=require(_0xb0fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0fa('0x3'));var rp=require(_0xb0fa('0x4'));var moment=require('moment');var BPromise=require(_0xb0fa('0x5'));var Mustache=require(_0xb0fa('0x6'));var util=require(_0xb0fa('0x7'));var path=require(_0xb0fa('0x8'));var sox=require(_0xb0fa('0x9'));var csv=require(_0xb0fa('0xa'));var ejs=require(_0xb0fa('0xb'));var fs=require('fs');var _=require(_0xb0fa('0xc'));var squel=require(_0xb0fa('0xd'));var crypto=require(_0xb0fa('0xe'));var jsforce=require(_0xb0fa('0xf'));var deskjs=require(_0xb0fa('0x10'));var toCsv=require(_0xb0fa('0xa'));var querystring=require('querystring');var Papa=require(_0xb0fa('0x11'));var Redis=require(_0xb0fa('0x12'));var authService=require(_0xb0fa('0x13'));var qs=require(_0xb0fa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0fa('0x15'));var logger=require(_0xb0fa('0x16'))(_0xb0fa('0x17'));var utils=require('../../config/utils');var config=require(_0xb0fa('0x18'));var licenseUtil=require(_0xb0fa('0x19'));var db=require(_0xb0fa('0x1a'))['db'];function respondWithStatusCode(_0x1fb5f0,_0x4dd2a0){_0x4dd2a0=_0x4dd2a0||0xcc;return function(_0x1f331e){if(_0x1f331e){return _0x1fb5f0[_0xb0fa('0x1b')](_0x4dd2a0);}return _0x1fb5f0[_0xb0fa('0x1c')](_0x4dd2a0)[_0xb0fa('0x1d')]();};}function respondWithResult(_0x2d8db6,_0x28c690){_0x28c690=_0x28c690||0xc8;return function(_0xc80615){if(_0xc80615){return _0x2d8db6[_0xb0fa('0x1c')](_0x28c690)[_0xb0fa('0x1e')](_0xc80615);}};}function respondWithFilteredResult(_0x18964a,_0x44de55){return function(_0x54f071){if(_0x54f071){var _0x1228ca=_0x54f071['count'],_0x33a99e=_0x44de55[_0xb0fa('0x1f')],_0x53cb71=_0x44de55[_0xb0fa('0x1f')]+_0x44de55['limit'],_0x461308;if(_0x53cb71>=_0x1228ca){_0x53cb71=_0x1228ca;_0x461308=0xc8;}else{_0x461308=0xce;}_0x18964a[_0xb0fa('0x1c')](_0x461308);return _0x18964a[_0xb0fa('0x20')]('Content-Range',_0x33a99e+'-'+_0x53cb71+'/'+_0x1228ca)['json'](_0x54f071);}return null;};}function patchUpdates(_0x32d539){return function(_0x44b6d5){try{jsonpatch[_0xb0fa('0x21')](_0x44b6d5,_0x32d539,!![]);}catch(_0x28cf9f){return BPromise[_0xb0fa('0x22')](_0x28cf9f);}return _0x44b6d5[_0xb0fa('0x23')]();};}function saveUpdates(_0x5bc4f6,_0x5e42db){return function(_0x3dfd4f){if(_0x3dfd4f){return _0x3dfd4f['update'](_0x5bc4f6)[_0xb0fa('0x24')](function(_0xb666f3){return _0xb666f3;});}return null;};}function removeEntity(_0x29986a,_0x4f4eb1){return function(_0x2c47ad){if(_0x2c47ad){return _0x2c47ad[_0xb0fa('0x25')]()['then'](function(){_0x29986a[_0xb0fa('0x1c')](0xcc)[_0xb0fa('0x1d')]();});}};}function handleEntityNotFound(_0x3c76ff,_0x23265a){return function(_0x553177){if(!_0x553177){_0x3c76ff[_0xb0fa('0x1b')](0x194);}return _0x553177;};}function handleError(_0x4fb054,_0x3fbd64){_0x3fbd64=_0x3fbd64||0x1f4;return function(_0x2f0a33){logger[_0xb0fa('0x26')](_0x2f0a33[_0xb0fa('0x27')]);if(_0x2f0a33[_0xb0fa('0x28')]){delete _0x2f0a33['name'];}_0x4fb054[_0xb0fa('0x1c')](_0x3fbd64)[_0xb0fa('0x29')](_0x2f0a33);};}exports[_0xb0fa('0x2a')]=function(_0x40348d,_0x40ef2f){var _0x3d7b88={},_0x47b705={},_0x5b9010={'count':0x0,'rows':[]};var _0x9fc412=_[_0xb0fa('0x2b')](db[_0xb0fa('0x2c')][_0xb0fa('0x2d')],function(_0x1fb2ec){return{'name':_0x1fb2ec[_0xb0fa('0x2e')],'type':_0x1fb2ec[_0xb0fa('0x2f')][_0xb0fa('0x30')]};});_0x47b705[_0xb0fa('0x31')]=_['map'](_0x9fc412,'name');_0x47b705['query']=_['keys'](_0x40348d[_0xb0fa('0x32')]);_0x47b705[_0xb0fa('0x33')]=_[_0xb0fa('0x34')](_0x47b705[_0xb0fa('0x31')],_0x47b705[_0xb0fa('0x32')]);_0x3d7b88[_0xb0fa('0x35')]=_['intersection'](_0x47b705[_0xb0fa('0x31')],qs[_0xb0fa('0x36')](_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x36')]));_0x3d7b88[_0xb0fa('0x35')]=_0x3d7b88[_0xb0fa('0x35')][_0xb0fa('0x37')]?_0x3d7b88[_0xb0fa('0x35')]:_0x47b705['model'];if(!_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x38')](_0xb0fa('0x39'))){_0x3d7b88['limit']=qs[_0xb0fa('0x3a')](_0x40348d[_0xb0fa('0x32')]['limit']);_0x3d7b88['offset']=qs['offset'](_0x40348d[_0xb0fa('0x32')]['offset']);}_0x3d7b88[_0xb0fa('0x3b')]=qs[_0xb0fa('0x3c')](_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x3c')]);_0x3d7b88[_0xb0fa('0x3d')]=qs['filters'](_[_0xb0fa('0x3e')](_0x40348d[_0xb0fa('0x32')],_0x47b705[_0xb0fa('0x33')]),_0x9fc412);if(_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x3f')]){_0x3d7b88[_0xb0fa('0x3d')]=_[_0xb0fa('0x40')](_0x3d7b88[_0xb0fa('0x3d')],{'$or':_[_0xb0fa('0x2b')](_0x9fc412,function(_0x2ca434){if(_0x2ca434[_0xb0fa('0x2f')]!==_0xb0fa('0x41')){var _0x53dde1={};_0x53dde1[_0x2ca434['name']]={'$like':'%'+_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x3f')]+'%'};return _0x53dde1;}})});}_0x3d7b88=_[_0xb0fa('0x40')]({},_0x3d7b88,_0x40348d[_0xb0fa('0x42')]);var _0x40faa7={'where':_0x3d7b88[_0xb0fa('0x3d')]};return db[_0xb0fa('0x2c')][_0xb0fa('0x43')](_0x40faa7)[_0xb0fa('0x24')](function(_0x5f0da8){_0x5b9010['count']=_0x5f0da8;if(_0x40348d[_0xb0fa('0x32')]['includeAll']){_0x3d7b88[_0xb0fa('0x44')]=[{'all':!![]}];}return db[_0xb0fa('0x2c')][_0xb0fa('0x45')](_0x3d7b88);})[_0xb0fa('0x24')](function(_0x57f446){_0x5b9010[_0xb0fa('0x46')]=_0x57f446;return _0x5b9010;})[_0xb0fa('0x24')](respondWithFilteredResult(_0x40ef2f,_0x3d7b88))['catch'](handleError(_0x40ef2f,null));};exports[_0xb0fa('0x47')]=function(_0x1f7d54,_0x1b9ff9){var _0x19e72d={'raw':![],'where':{'id':_0x1f7d54['params']['id']}},_0x283494={};_0x283494['model']=_['keys'](db['IntegrationReport'][_0xb0fa('0x2d')]);_0x283494[_0xb0fa('0x32')]=_[_0xb0fa('0x48')](_0x1f7d54[_0xb0fa('0x32')]);_0x283494[_0xb0fa('0x33')]=_[_0xb0fa('0x34')](_0x283494[_0xb0fa('0x31')],_0x283494['query']);_0x19e72d['attributes']=_[_0xb0fa('0x34')](_0x283494['model'],qs['fields'](_0x1f7d54[_0xb0fa('0x32')][_0xb0fa('0x36')]));_0x19e72d[_0xb0fa('0x35')]=_0x19e72d[_0xb0fa('0x35')][_0xb0fa('0x37')]?_0x19e72d[_0xb0fa('0x35')]:_0x283494[_0xb0fa('0x31')];if(_0x1f7d54[_0xb0fa('0x32')][_0xb0fa('0x49')]){_0x19e72d['include']=[{'all':!![]}];}_0x19e72d=_[_0xb0fa('0x40')]({},_0x19e72d,_0x1f7d54[_0xb0fa('0x42')]);return db['IntegrationReport'][_0xb0fa('0x4a')](_0x19e72d)[_0xb0fa('0x24')](handleEntityNotFound(_0x1b9ff9,null))[_0xb0fa('0x24')](respondWithResult(_0x1b9ff9,null))[_0xb0fa('0x4b')](handleError(_0x1b9ff9,null));};exports[_0xb0fa('0x4c')]=function(_0x5f4de2,_0x3ef8fe){return db[_0xb0fa('0x2c')][_0xb0fa('0x4c')](_0x5f4de2['body'],{})[_0xb0fa('0x24')](respondWithResult(_0x3ef8fe,0xc9))['catch'](handleError(_0x3ef8fe,null));};exports['update']=function(_0x5ddb74,_0x435ad0){if(_0x5ddb74['body']['id']){delete _0x5ddb74['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x5ddb74[_0xb0fa('0x4d')]['id']}})[_0xb0fa('0x24')](handleEntityNotFound(_0x435ad0,null))[_0xb0fa('0x24')](saveUpdates(_0x5ddb74[_0xb0fa('0x4e')],null))[_0xb0fa('0x24')](respondWithResult(_0x435ad0,null))[_0xb0fa('0x4b')](handleError(_0x435ad0,null));};exports[_0xb0fa('0x25')]=function(_0x4fa364,_0x2457de){return db['IntegrationReport'][_0xb0fa('0x4a')]({'where':{'id':_0x4fa364[_0xb0fa('0x4d')]['id']}})[_0xb0fa('0x24')](handleEntityNotFound(_0x2457de,null))[_0xb0fa('0x24')](removeEntity(_0x2457de,null))[_0xb0fa('0x4b')](handleError(_0x2457de,null));};exports[_0xb0fa('0x4f')]=function(_0x3c2f2d,_0x52d436){return db[_0xb0fa('0x2c')]['describe']()[_0xb0fa('0x24')](respondWithResult(_0x52d436,null))[_0xb0fa('0x4b')](handleError(_0x52d436,null));}; \ No newline at end of file +var _0x2dc6=['to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','includeAll','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x2dc6,0x1a0));var _0x62dc=function(_0x3a47ef,_0xd9dc5f){_0x3a47ef=_0x3a47ef-0x0;var _0xe71027=_0x2dc6[_0x3a47ef];return _0xe71027;};'use strict';var pdf=require(_0x62dc('0x0'));var emlformat=require(_0x62dc('0x1'));var rimraf=require(_0x62dc('0x2'));var zipdir=require(_0x62dc('0x3'));var jsonpatch=require(_0x62dc('0x4'));var rp=require(_0x62dc('0x5'));var moment=require('moment');var BPromise=require(_0x62dc('0x6'));var Mustache=require(_0x62dc('0x7'));var util=require('util');var path=require(_0x62dc('0x8'));var sox=require(_0x62dc('0x9'));var csv=require(_0x62dc('0xa'));var ejs=require(_0x62dc('0xb'));var fs=require('fs');var _=require(_0x62dc('0xc'));var squel=require('squel');var crypto=require(_0x62dc('0xd'));var jsforce=require(_0x62dc('0xe'));var deskjs=require(_0x62dc('0xf'));var toCsv=require(_0x62dc('0xa'));var querystring=require(_0x62dc('0x10'));var Papa=require(_0x62dc('0x11'));var Redis=require(_0x62dc('0x12'));var authService=require(_0x62dc('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62dc('0x14'));var logger=require(_0x62dc('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x308205,_0x102236){_0x102236=_0x102236||0xcc;return function(_0x491f53){if(_0x491f53){return _0x308205[_0x62dc('0x17')](_0x102236);}return _0x308205['status'](_0x102236)[_0x62dc('0x18')]();};}function respondWithResult(_0x1f91e8,_0xbc86a0){_0xbc86a0=_0xbc86a0||0xc8;return function(_0x34671c){if(_0x34671c){return _0x1f91e8[_0x62dc('0x19')](_0xbc86a0)[_0x62dc('0x1a')](_0x34671c);}};}function respondWithFilteredResult(_0x2db096,_0x1472d2){return function(_0x574ffb){if(_0x574ffb){var _0x2de69c=_0x574ffb['count'],_0x215347=_0x1472d2[_0x62dc('0x1b')],_0xd550df=_0x1472d2['offset']+_0x1472d2['limit'],_0x39a4da;if(_0xd550df>=_0x2de69c){_0xd550df=_0x2de69c;_0x39a4da=0xc8;}else{_0x39a4da=0xce;}_0x2db096[_0x62dc('0x19')](_0x39a4da);return _0x2db096[_0x62dc('0x1c')](_0x62dc('0x1d'),_0x215347+'-'+_0xd550df+'/'+_0x2de69c)[_0x62dc('0x1a')](_0x574ffb);}return null;};}function patchUpdates(_0x5e3fca){return function(_0x3b98aa){try{jsonpatch[_0x62dc('0x1e')](_0x3b98aa,_0x5e3fca,!![]);}catch(_0x37a51c){return BPromise[_0x62dc('0x1f')](_0x37a51c);}return _0x3b98aa['save']();};}function saveUpdates(_0x218c44,_0x389014){return function(_0x210799){if(_0x210799){return _0x210799[_0x62dc('0x20')](_0x218c44)[_0x62dc('0x21')](function(_0x2a78e8){return _0x2a78e8;});}return null;};}function removeEntity(_0x719401,_0x43250c){return function(_0x1d046b){if(_0x1d046b){return _0x1d046b['destroy']()['then'](function(){_0x719401[_0x62dc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336771,_0x3e665b){return function(_0x29a1b6){if(!_0x29a1b6){_0x336771['sendStatus'](0x194);}return _0x29a1b6;};}function handleError(_0x1b9b98,_0x12fcbd){_0x12fcbd=_0x12fcbd||0x1f4;return function(_0x50753c){logger[_0x62dc('0x22')](_0x50753c[_0x62dc('0x23')]);if(_0x50753c[_0x62dc('0x24')]){delete _0x50753c['name'];}_0x1b9b98[_0x62dc('0x19')](_0x12fcbd)[_0x62dc('0x25')](_0x50753c);};}exports[_0x62dc('0x26')]=function(_0x86a455,_0x38e1fb){var _0x2c1a87={},_0xfc0fab={},_0x4fd602={'count':0x0,'rows':[]};var _0x11cdbb=_[_0x62dc('0x27')](db[_0x62dc('0x28')][_0x62dc('0x29')],function(_0x2e9c46){return{'name':_0x2e9c46[_0x62dc('0x2a')],'type':_0x2e9c46[_0x62dc('0x2b')]['key']};});_0xfc0fab['model']=_[_0x62dc('0x27')](_0x11cdbb,'name');_0xfc0fab[_0x62dc('0x2c')]=_[_0x62dc('0x2d')](_0x86a455[_0x62dc('0x2c')]);_0xfc0fab[_0x62dc('0x2e')]=_[_0x62dc('0x2f')](_0xfc0fab[_0x62dc('0x30')],_0xfc0fab['query']);_0x2c1a87[_0x62dc('0x31')]=_[_0x62dc('0x2f')](_0xfc0fab[_0x62dc('0x30')],qs[_0x62dc('0x32')](_0x86a455[_0x62dc('0x2c')][_0x62dc('0x32')]));_0x2c1a87[_0x62dc('0x31')]=_0x2c1a87[_0x62dc('0x31')][_0x62dc('0x33')]?_0x2c1a87[_0x62dc('0x31')]:_0xfc0fab[_0x62dc('0x30')];if(!_0x86a455['query']['hasOwnProperty'](_0x62dc('0x34'))){_0x2c1a87['limit']=qs[_0x62dc('0x35')](_0x86a455[_0x62dc('0x2c')][_0x62dc('0x35')]);_0x2c1a87['offset']=qs[_0x62dc('0x1b')](_0x86a455[_0x62dc('0x2c')]['offset']);}_0x2c1a87['order']=qs['sort'](_0x86a455['query'][_0x62dc('0x36')]);_0x2c1a87[_0x62dc('0x37')]=qs['filters'](_[_0x62dc('0x38')](_0x86a455[_0x62dc('0x2c')],_0xfc0fab[_0x62dc('0x2e')]),_0x11cdbb);if(_0x86a455[_0x62dc('0x2c')][_0x62dc('0x39')]){_0x2c1a87[_0x62dc('0x37')]=_[_0x62dc('0x3a')](_0x2c1a87[_0x62dc('0x37')],{'$or':_[_0x62dc('0x27')](_0x11cdbb,function(_0x2b81b4){if(_0x2b81b4['type']!==_0x62dc('0x3b')){var _0x3d55ec={};_0x3d55ec[_0x2b81b4[_0x62dc('0x24')]]={'$like':'%'+_0x86a455[_0x62dc('0x2c')]['filter']+'%'};return _0x3d55ec;}})});}_0x2c1a87=_['merge']({},_0x2c1a87,_0x86a455[_0x62dc('0x3c')]);var _0x1c3690={'where':_0x2c1a87[_0x62dc('0x37')]};return db['IntegrationReport']['count'](_0x1c3690)[_0x62dc('0x21')](function(_0x1087d3){_0x4fd602['count']=_0x1087d3;if(_0x86a455[_0x62dc('0x2c')]['includeAll']){_0x2c1a87['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x62dc('0x3d')](_0x2c1a87);})[_0x62dc('0x21')](function(_0x35f57f){_0x4fd602['rows']=_0x35f57f;return _0x4fd602;})[_0x62dc('0x21')](respondWithFilteredResult(_0x38e1fb,_0x2c1a87))[_0x62dc('0x3e')](handleError(_0x38e1fb,null));};exports[_0x62dc('0x3f')]=function(_0x404480,_0x5e9ec7){var _0x2b6b56={'raw':![],'where':{'id':_0x404480['params']['id']}},_0xbc7d65={};_0xbc7d65[_0x62dc('0x30')]=_[_0x62dc('0x2d')](db[_0x62dc('0x28')][_0x62dc('0x29')]);_0xbc7d65[_0x62dc('0x2c')]=_['keys'](_0x404480[_0x62dc('0x2c')]);_0xbc7d65[_0x62dc('0x2e')]=_[_0x62dc('0x2f')](_0xbc7d65[_0x62dc('0x30')],_0xbc7d65['query']);_0x2b6b56[_0x62dc('0x31')]=_[_0x62dc('0x2f')](_0xbc7d65[_0x62dc('0x30')],qs[_0x62dc('0x32')](_0x404480[_0x62dc('0x2c')][_0x62dc('0x32')]));_0x2b6b56[_0x62dc('0x31')]=_0x2b6b56[_0x62dc('0x31')][_0x62dc('0x33')]?_0x2b6b56[_0x62dc('0x31')]:_0xbc7d65['model'];if(_0x404480[_0x62dc('0x2c')][_0x62dc('0x40')]){_0x2b6b56['include']=[{'all':!![]}];}_0x2b6b56=_[_0x62dc('0x3a')]({},_0x2b6b56,_0x404480['options']);return db['IntegrationReport'][_0x62dc('0x41')](_0x2b6b56)[_0x62dc('0x21')](handleEntityNotFound(_0x5e9ec7,null))[_0x62dc('0x21')](respondWithResult(_0x5e9ec7,null))[_0x62dc('0x3e')](handleError(_0x5e9ec7,null));};exports[_0x62dc('0x42')]=function(_0x55ab25,_0xc92ae1){return db[_0x62dc('0x28')][_0x62dc('0x42')](_0x55ab25[_0x62dc('0x43')],{})[_0x62dc('0x21')](respondWithResult(_0xc92ae1,0xc9))[_0x62dc('0x3e')](handleError(_0xc92ae1,null));};exports[_0x62dc('0x20')]=function(_0x7062a,_0x3b066c){if(_0x7062a[_0x62dc('0x43')]['id']){delete _0x7062a[_0x62dc('0x43')]['id'];}return db['IntegrationReport'][_0x62dc('0x41')]({'where':{'id':_0x7062a[_0x62dc('0x44')]['id']}})[_0x62dc('0x21')](handleEntityNotFound(_0x3b066c,null))['then'](saveUpdates(_0x7062a[_0x62dc('0x43')],null))['then'](respondWithResult(_0x3b066c,null))[_0x62dc('0x3e')](handleError(_0x3b066c,null));};exports[_0x62dc('0x45')]=function(_0x59f59e,_0x2e6483){return db[_0x62dc('0x28')]['find']({'where':{'id':_0x59f59e['params']['id']}})[_0x62dc('0x21')](handleEntityNotFound(_0x2e6483,null))[_0x62dc('0x21')](removeEntity(_0x2e6483,null))['catch'](handleError(_0x2e6483,null));};exports[_0x62dc('0x46')]=function(_0x1256a6,_0x5dc520){return db[_0x62dc('0x28')][_0x62dc('0x46')]()[_0x62dc('0x21')](respondWithResult(_0x5dc520,null))[_0x62dc('0x3e')](handleError(_0x5dc520,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index e86739a..34af8e8 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 _0x3e03=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash'];(function(_0x129ddf,_0x573f73){var _0x518dc3=function(_0x58cbbf){while(--_0x58cbbf){_0x129ddf['push'](_0x129ddf['shift']());}};_0x518dc3(++_0x573f73);}(_0x3e03,0x6b));var _0x33e0=function(_0x35e06d,_0xad434c){_0x35e06d=_0x35e06d-0x0;var _0x1b7a39=_0x3e03[_0x35e06d];return _0x1b7a39;};'use strict';var _=require(_0x33e0('0x0'));var util=require(_0x33e0('0x1'));var logger=require(_0x33e0('0x2'))(_0x33e0('0x3'));var moment=require(_0x33e0('0x4'));var BPromise=require('bluebird');var rp=require(_0x33e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33e0('0x6'));var config=require(_0x33e0('0x7'));var attributes=require(_0x33e0('0x8'));module[_0x33e0('0x9')]=function(_0x164d16,_0x12ca60){return _0x164d16['define'](_0x33e0('0xa'),attributes,{'tableName':_0x33e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5dc=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb5dc,0xf7));var _0xcb5d=function(_0x5326dc,_0x526083){_0x5326dc=_0x5326dc-0x0;var _0x27da77=_0xb5dc[_0x5326dc];return _0x27da77;};'use strict';var _=require(_0xcb5d('0x0'));var util=require(_0xcb5d('0x1'));var logger=require(_0xcb5d('0x2'))(_0xcb5d('0x3'));var moment=require('moment');var BPromise=require(_0xcb5d('0x4'));var rp=require(_0xcb5d('0x5'));var fs=require('fs');var path=require(_0xcb5d('0x6'));var rimraf=require(_0xcb5d('0x7'));var config=require(_0xcb5d('0x8'));var attributes=require(_0xcb5d('0x9'));module[_0xcb5d('0xa')]=function(_0x4367ef,_0x1600ae){return _0x4367ef[_0xcb5d('0xb')]('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 343a4fa..fc52ee9 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xac4a,0x13f));var _0xaac4=function(_0x4fb7e6,_0xe6d30c){_0x4fb7e6=_0x4fb7e6-0x0;var _0x19baae=_0xac4a[_0x4fb7e6];return _0x19baae;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xdb9ccc,_0x48a96c){var _0x2398d9=function(_0x52e6f4){while(--_0x52e6f4){_0xdb9ccc['push'](_0xdb9ccc['shift']());}};_0x2398d9(++_0x48a96c);}(_0x757a,0xde));var _0xa757=function(_0xeb8a59,_0x3090df){_0xeb8a59=_0xeb8a59-0x0;var _0x1d8240=_0x757a[_0xeb8a59];return _0x1d8240;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 85e3943..faf01c4 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x1fa4ca,_0xf56e82){var _0x4eca14=function(_0x3408d8){while(--_0x3408d8){_0x1fa4ca['push'](_0x1fa4ca['shift']());}};_0x4eca14(++_0xf56e82);}(_0xedd9,0xfc));var _0x9edd=function(_0x2b6fa6,_0x39c76f){_0x2b6fa6=_0x2b6fa6-0x0;var _0x4e9ab8=_0xedd9[_0x2b6fa6];return _0x4e9ab8;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x481302,_0x11d85d){var _0x23fd89=function(_0x4d6b15){while(--_0x4d6b15){_0x481302['push'](_0x481302['shift']());}};_0x23fd89(++_0x11d85d);}(_0x3e74,0x175));var _0x43e7=function(_0x1e17c1,_0x2e2ab0){_0x1e17c1=_0x1e17c1-0x0;var _0x489e07=_0x3e74[_0x1e17c1];return _0x489e07;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cc99e23..67755d5 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 _0x167e=['sequelize','STRING'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x167e,0x1ae));var _0xe167=function(_0x353acf,_0x5a0fa6){_0x353acf=_0x353acf-0x0;var _0x2dee9c=_0x167e[_0x353acf];return _0x2dee9c;};'use strict';var Sequelize=require(_0xe167('0x0'));module['exports']={'name':{'type':Sequelize[_0xe167('0x1')]},'description':{'type':Sequelize[_0xe167('0x1')]},'interval':{'type':Sequelize[_0xe167('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x3f42=['STRING','exports'];(function(_0x279f8d,_0x1d44f5){var _0x291e2b=function(_0x168f61){while(--_0x168f61){_0x279f8d['push'](_0x279f8d['shift']());}};_0x291e2b(++_0x1d44f5);}(_0x3f42,0x193));var _0x23f4=function(_0x4e0f53,_0x5d355a){_0x4e0f53=_0x4e0f53-0x0;var _0x588434=_0x3f42[_0x4e0f53];return _0x588434;};'use strict';var Sequelize=require('sequelize');module[_0x23f4('0x0')]={'name':{'type':Sequelize[_0x23f4('0x1')]},'description':{'type':Sequelize[_0x23f4('0x1')]},'interval':{'type':Sequelize[_0x23f4('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c69a5cc..ea07592 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 _0x2014=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Interval','includeAll','include','findAll','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','update','destroy','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x2014,0xa9));var _0x4201=function(_0x27a257,_0x58cadf){_0x27a257=_0x27a257-0x0;var _0x506050=_0x2014[_0x27a257];return _0x506050;};'use strict';var pdf=require(_0x4201('0x0'));var emlformat=require(_0x4201('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4201('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4201('0x3'));var moment=require(_0x4201('0x4'));var BPromise=require(_0x4201('0x5'));var Mustache=require(_0x4201('0x6'));var util=require(_0x4201('0x7'));var path=require('path');var sox=require(_0x4201('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4201('0x9'));var squel=require('squel');var crypto=require(_0x4201('0xa'));var jsforce=require(_0x4201('0xb'));var deskjs=require(_0x4201('0xc'));var toCsv=require(_0x4201('0xd'));var querystring=require(_0x4201('0xe'));var Papa=require(_0x4201('0xf'));var Redis=require(_0x4201('0x10'));var authService=require(_0x4201('0x11'));var qs=require(_0x4201('0x12'));var as=require(_0x4201('0x13'));var hardwareService=require(_0x4201('0x14'));var logger=require(_0x4201('0x15'))(_0x4201('0x16'));var utils=require(_0x4201('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4201('0x18'))['db'];var extensions=require(_0x4201('0x19'));function respondWithStatusCode(_0x324d76,_0x1082d8){_0x1082d8=_0x1082d8||0xcc;return function(_0x223221){if(_0x223221){return _0x324d76['sendStatus'](_0x1082d8);}return _0x324d76[_0x4201('0x1a')](_0x1082d8)[_0x4201('0x1b')]();};}function respondWithResult(_0x496a74,_0x38b25e){_0x38b25e=_0x38b25e||0xc8;return function(_0x4a797e){if(_0x4a797e){return _0x496a74[_0x4201('0x1a')](_0x38b25e)[_0x4201('0x1c')](_0x4a797e);}};}function respondWithFilteredResult(_0x59386e,_0x1b61e3){return function(_0x1fe9a2){if(_0x1fe9a2){var _0x61bc08=_0x1fe9a2[_0x4201('0x1d')],_0x38aac1=_0x1b61e3['offset'],_0x4a705f=_0x1b61e3[_0x4201('0x1e')]+_0x1b61e3[_0x4201('0x1f')],_0x32253f;if(_0x4a705f>=_0x61bc08){_0x4a705f=_0x61bc08;_0x32253f=0xc8;}else{_0x32253f=0xce;}_0x59386e['status'](_0x32253f);return _0x59386e[_0x4201('0x20')](_0x4201('0x21'),_0x38aac1+'-'+_0x4a705f+'/'+_0x61bc08)[_0x4201('0x1c')](_0x1fe9a2);}return null;};}function patchUpdates(_0x52d65a){return function(_0x102298){try{jsonpatch[_0x4201('0x22')](_0x102298,_0x52d65a,!![]);}catch(_0x3ef6f0){return BPromise[_0x4201('0x23')](_0x3ef6f0);}return _0x102298[_0x4201('0x24')]();};}function saveUpdates(_0x2ec575,_0x692674){return function(_0x35d2b7){if(_0x35d2b7){return _0x35d2b7['update'](_0x2ec575)[_0x4201('0x25')](function(_0x579454){return _0x579454;});}return null;};}function removeEntity(_0x27c744,_0x1c4ce1){return function(_0x28e49d){if(_0x28e49d){return _0x28e49d['destroy']()[_0x4201('0x25')](function(){var _0x3e48de=_0x28e49d[_0x4201('0x26')]({'plain':!![]});var _0x55173d=_0x4201('0x27');return db[_0x4201('0x28')]['destroy']({'where':{'type':_0x55173d,'resourceId':_0x3e48de['id']}})[_0x4201('0x25')](function(){return _0x28e49d;});})[_0x4201('0x25')](function(){_0x27c744['status'](0xcc)[_0x4201('0x1b')]();});}};}function handleEntityNotFound(_0xcaf66d,_0x50e1c3){return function(_0x48fa61){if(!_0x48fa61){_0xcaf66d[_0x4201('0x29')](0x194);}return _0x48fa61;};}function handleError(_0x33fe00,_0x570bb0){_0x570bb0=_0x570bb0||0x1f4;return function(_0x3a3a27){logger[_0x4201('0x2a')](_0x3a3a27[_0x4201('0x2b')]);if(_0x3a3a27[_0x4201('0x2c')]){delete _0x3a3a27[_0x4201('0x2c')];}_0x33fe00['status'](_0x570bb0)[_0x4201('0x2d')](_0x3a3a27);};}exports['index']=function(_0x398cd1,_0x8061d5){var _0x5eb623={},_0x281221={},_0xace779={'count':0x0,'rows':[]};var _0x18ec27=_[_0x4201('0x2e')](db['Interval'][_0x4201('0x2f')],function(_0x43c456){return{'name':_0x43c456[_0x4201('0x30')],'type':_0x43c456[_0x4201('0x31')][_0x4201('0x32')]};});_0x281221['model']=_[_0x4201('0x2e')](_0x18ec27,_0x4201('0x2c'));_0x281221[_0x4201('0x33')]=_[_0x4201('0x34')](_0x398cd1[_0x4201('0x33')]);_0x281221[_0x4201('0x35')]=_[_0x4201('0x36')](_0x281221[_0x4201('0x37')],_0x281221[_0x4201('0x33')]);_0x5eb623['attributes']=_[_0x4201('0x36')](_0x281221['model'],qs[_0x4201('0x38')](_0x398cd1[_0x4201('0x33')][_0x4201('0x38')]));_0x5eb623[_0x4201('0x39')]=_0x5eb623[_0x4201('0x39')][_0x4201('0x3a')]?_0x5eb623[_0x4201('0x39')]:_0x281221[_0x4201('0x37')];if(!_0x398cd1[_0x4201('0x33')][_0x4201('0x3b')](_0x4201('0x3c'))){_0x5eb623['limit']=qs[_0x4201('0x1f')](_0x398cd1['query'][_0x4201('0x1f')]);_0x5eb623['offset']=qs['offset'](_0x398cd1[_0x4201('0x33')][_0x4201('0x1e')]);}_0x5eb623[_0x4201('0x3d')]=qs[_0x4201('0x3e')](_0x398cd1[_0x4201('0x33')][_0x4201('0x3e')]);_0x5eb623[_0x4201('0x3f')]=qs[_0x4201('0x35')](_[_0x4201('0x40')](_0x398cd1['query'],_0x281221[_0x4201('0x35')]),_0x18ec27);if(_0x398cd1[_0x4201('0x33')][_0x4201('0x41')]){_0x5eb623['where']=_[_0x4201('0x42')](_0x5eb623[_0x4201('0x3f')],{'$or':_[_0x4201('0x2e')](_0x18ec27,function(_0x1b6478){if(_0x1b6478[_0x4201('0x31')]!=='VIRTUAL'){var _0x43066b={};_0x43066b[_0x1b6478[_0x4201('0x2c')]]={'$like':'%'+_0x398cd1[_0x4201('0x33')][_0x4201('0x41')]+'%'};return _0x43066b;}})});}_0x5eb623=_[_0x4201('0x42')]({},_0x5eb623,_0x398cd1[_0x4201('0x43')]);var _0x2ef9bc={'where':_0x5eb623[_0x4201('0x3f')]};return db[_0x4201('0x44')][_0x4201('0x1d')](_0x2ef9bc)[_0x4201('0x25')](function(_0x455224){_0xace779['count']=_0x455224;if(_0x398cd1[_0x4201('0x33')][_0x4201('0x45')]){_0x5eb623[_0x4201('0x46')]=[{'all':!![]}];}return db['Interval'][_0x4201('0x47')](_0x5eb623);})[_0x4201('0x25')](function(_0xfa3a98){_0xace779[_0x4201('0x48')]=_0xfa3a98;return _0xace779;})['then'](respondWithFilteredResult(_0x8061d5,_0x5eb623))['catch'](handleError(_0x8061d5,null));};exports[_0x4201('0x49')]=function(_0x17a299,_0x54f5a5){var _0xa60ff4={'raw':!![],'where':{'id':_0x17a299[_0x4201('0x4a')]['id']}},_0x513368={};_0x513368[_0x4201('0x37')]=_[_0x4201('0x34')](db[_0x4201('0x44')][_0x4201('0x2f')]);_0x513368[_0x4201('0x33')]=_[_0x4201('0x34')](_0x17a299[_0x4201('0x33')]);_0x513368[_0x4201('0x35')]=_[_0x4201('0x36')](_0x513368[_0x4201('0x37')],_0x513368['query']);_0xa60ff4[_0x4201('0x39')]=_[_0x4201('0x36')](_0x513368['model'],qs[_0x4201('0x38')](_0x17a299['query']['fields']));_0xa60ff4[_0x4201('0x39')]=_0xa60ff4[_0x4201('0x39')][_0x4201('0x3a')]?_0xa60ff4[_0x4201('0x39')]:_0x513368[_0x4201('0x37')];if(_0x17a299[_0x4201('0x33')]['includeAll']){_0xa60ff4['include']=[{'all':!![]}];}_0xa60ff4=_[_0x4201('0x42')]({},_0xa60ff4,_0x17a299[_0x4201('0x43')]);return db[_0x4201('0x44')]['find'](_0xa60ff4)[_0x4201('0x25')](handleEntityNotFound(_0x54f5a5,null))[_0x4201('0x25')](respondWithResult(_0x54f5a5,null))['catch'](handleError(_0x54f5a5,null));};exports['create']=function(_0x1cd29e,_0x1d1dce){return db[_0x4201('0x44')][_0x4201('0x4b')](_0x1cd29e[_0x4201('0x4c')],{})[_0x4201('0x25')](function(_0x93a46f){var _0x19bb85=_0x1cd29e[_0x4201('0x4d')][_0x4201('0x26')]({'plain':!![]});if(!_0x19bb85)throw new Error(_0x4201('0x4e'));if(_0x19bb85[_0x4201('0x4f')]===_0x4201('0x4d')){var _0x2e7cd4=_0x93a46f[_0x4201('0x26')]({'plain':!![]});var _0x4d6c83=_0x4201('0x27');return db[_0x4201('0x50')][_0x4201('0x51')]({'where':{'name':_0x4d6c83,'userProfileId':_0x19bb85[_0x4201('0x52')]},'raw':!![]})['then'](function(_0x3b928a){if(_0x3b928a&&_0x3b928a['autoAssociation']===0x0){return db[_0x4201('0x28')][_0x4201('0x4b')]({'name':_0x2e7cd4[_0x4201('0x2c')],'resourceId':_0x2e7cd4['id'],'type':_0x3b928a[_0x4201('0x2c')],'sectionId':_0x3b928a['id']},{})['then'](function(){return _0x93a46f;});}else{return _0x93a46f;}})['catch'](function(_0x4b60c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b60c0);throw _0x4b60c0;});}return _0x93a46f;})[_0x4201('0x25')](respondWithResult(_0x1d1dce,0xc9))[_0x4201('0x53')](handleError(_0x1d1dce,null));};exports[_0x4201('0x54')]=function(_0x76e6cf,_0x4bf244){if(_0x76e6cf[_0x4201('0x4c')]['id']){delete _0x76e6cf[_0x4201('0x4c')]['id'];}return db[_0x4201('0x44')][_0x4201('0x51')]({'where':{'id':_0x76e6cf['params']['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x4bf244,null))[_0x4201('0x25')](saveUpdates(_0x76e6cf[_0x4201('0x4c')],null))['then'](respondWithResult(_0x4bf244,null))[_0x4201('0x53')](handleError(_0x4bf244,null));};exports[_0x4201('0x55')]=function(_0x43a8a7,_0x2461c9){return db[_0x4201('0x44')]['find']({'where':{'id':_0x43a8a7['params']['id']}})['then'](handleEntityNotFound(_0x2461c9,null))[_0x4201('0x25')](removeEntity(_0x2461c9,null))[_0x4201('0x53')](handleError(_0x2461c9,null));};exports[_0x4201('0x56')]=function(_0x3d12de,_0x5b3da5,_0x439172){if(_0x3d12de[_0x4201('0x4c')]['id']){delete _0x3d12de[_0x4201('0x4c')]['id'];}return db[_0x4201('0x44')][_0x4201('0x51')]({'where':{'id':_0x3d12de[_0x4201('0x4a')]['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x5b3da5,null))['then'](function(_0x4e957c){if(_0x4e957c){_0x3d12de[_0x4201('0x4c')][_0x4201('0x57')]=_0x4e957c['id'];return db[_0x4201('0x44')][_0x4201('0x4b')](_0x3d12de['body']);}})[_0x4201('0x25')](respondWithResult(_0x5b3da5,null))[_0x4201('0x53')](handleError(_0x5b3da5,null));};exports[_0x4201('0x58')]=function(_0x42cb4f,_0x1e6bfe,_0x273486){var _0x1294a2={};var _0x27747f={};var _0x3f4e5b;var _0x14e68a;return db['Interval']['findOne']({'where':{'id':_0x42cb4f['params']['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x1e6bfe,null))['then'](function(_0xda4694){if(_0xda4694){_0x3f4e5b=_0xda4694;_0x27747f[_0x4201('0x37')]=_[_0x4201('0x34')](db[_0x4201('0x44')][_0x4201('0x2f')]);_0x27747f[_0x4201('0x33')]=_[_0x4201('0x34')](_0x42cb4f[_0x4201('0x33')]);_0x27747f['filters']=_['intersection'](_0x27747f[_0x4201('0x37')],_0x27747f[_0x4201('0x33')]);_0x1294a2['attributes']=_['intersection'](_0x27747f[_0x4201('0x37')],qs[_0x4201('0x38')](_0x42cb4f[_0x4201('0x33')][_0x4201('0x38')]));_0x1294a2['attributes']=_0x1294a2['attributes'][_0x4201('0x3a')]?_0x1294a2['attributes']:_0x27747f[_0x4201('0x37')];_0x1294a2[_0x4201('0x3d')]=qs[_0x4201('0x3e')](_0x42cb4f[_0x4201('0x33')]['sort']);_0x1294a2['where']=qs[_0x4201('0x35')](_[_0x4201('0x40')](_0x42cb4f[_0x4201('0x33')],_0x27747f[_0x4201('0x35')]));if(_0x42cb4f[_0x4201('0x33')]['filter']){_0x1294a2[_0x4201('0x3f')]=_['merge'](_0x1294a2['where'],{'$or':_[_0x4201('0x2e')](_0x1294a2['attributes'],function(_0x598868){var _0x84e941={};_0x84e941[_0x598868]={'$like':'%'+_0x42cb4f['query'][_0x4201('0x41')]+'%'};return _0x84e941;})});}_0x1294a2=_[_0x4201('0x42')]({},_0x1294a2,_0x42cb4f[_0x4201('0x43')]);return _0x3f4e5b[_0x4201('0x58')](_0x1294a2);}})['then'](function(_0x36f5e6){if(_0x36f5e6){_0x14e68a=_0x36f5e6[_0x4201('0x3a')];if(!_0x42cb4f[_0x4201('0x33')]['hasOwnProperty'](_0x4201('0x3c'))){_0x1294a2[_0x4201('0x1f')]=qs['limit'](_0x42cb4f[_0x4201('0x33')][_0x4201('0x1f')]);_0x1294a2[_0x4201('0x1e')]=qs['offset'](_0x42cb4f[_0x4201('0x33')]['offset']);}return _0x3f4e5b['getIntervals'](_0x1294a2);}})[_0x4201('0x25')](function(_0xcb9fcd){if(_0xcb9fcd){return _0xcb9fcd?{'count':_0x14e68a,'rows':_0xcb9fcd}:null;}})[_0x4201('0x25')](respondWithResult(_0x1e6bfe,null))[_0x4201('0x53')](handleError(_0x1e6bfe,null));};exports[_0x4201('0x59')]=function(_0x2a08d8,_0x416a39,_0xbbac56){return db[_0x4201('0x44')][_0x4201('0x5a')]({'where':{'id':_0x2a08d8[_0x4201('0x4a')]['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x416a39,null))[_0x4201('0x25')](function(_0x5c7f7a){if(_0x5c7f7a){return db[_0x4201('0x5b')][_0x4201('0x5c')](function(_0x4a96a5){return db[_0x4201('0x44')][_0x4201('0x55')]({'where':{'IntervalId':_0x2a08d8[_0x4201('0x4a')]['id']},'transaction':_0x4a96a5})[_0x4201('0x25')](function(_0x377cbd){var _0x5f4f71=_[_0x4201('0x2e')](_0x2a08d8[_0x4201('0x4c')],function(_0x4a9afd){delete _0x4a9afd['id'];_0x4a9afd[_0x4201('0x57')]=_0x2a08d8[_0x4201('0x4a')]['id'];return _0x4a9afd;});return db[_0x4201('0x44')][_0x4201('0x5d')](_0x5f4f71,{'transaction':_0x4a96a5});});})[_0x4201('0x25')](function(){return db[_0x4201('0x44')]['findAll']({'where':{'IntervalId':_0x2a08d8[_0x4201('0x4a')]['id']}});});}})[_0x4201('0x25')](respondWithResult(_0x416a39,null))[_0x4201('0x53')](handleError(_0x416a39,null));}; \ No newline at end of file +var _0x0d40=['then','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','Interval','findAll','rows','catch','show','params','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x17a29e,_0x242d8c){var _0x26f32e=function(_0x504e74){while(--_0x504e74){_0x17a29e['push'](_0x17a29e['shift']());}};_0x26f32e(++_0x242d8c);}(_0x0d40,0x155));var _0x00d4=function(_0x36ee10,_0x3e4e4b){_0x36ee10=_0x36ee10-0x0;var _0x1ae7e8=_0x0d40[_0x36ee10];return _0x1ae7e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x00d4('0x0'));var rimraf=require(_0x00d4('0x1'));var zipdir=require(_0x00d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00d4('0x3'));var moment=require(_0x00d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x00d4('0x5'));var util=require(_0x00d4('0x6'));var path=require('path');var sox=require(_0x00d4('0x7'));var csv=require('to-csv');var ejs=require(_0x00d4('0x8'));var fs=require('fs');var _=require(_0x00d4('0x9'));var squel=require(_0x00d4('0xa'));var crypto=require('crypto');var jsforce=require(_0x00d4('0xb'));var deskjs=require(_0x00d4('0xc'));var toCsv=require(_0x00d4('0xd'));var querystring=require(_0x00d4('0xe'));var Papa=require(_0x00d4('0xf'));var Redis=require(_0x00d4('0x10'));var authService=require(_0x00d4('0x11'));var qs=require(_0x00d4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00d4('0x13'));var logger=require(_0x00d4('0x14'))(_0x00d4('0x15'));var utils=require(_0x00d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x00d4('0x17'));var db=require(_0x00d4('0x18'))['db'];var extensions=require(_0x00d4('0x19'));function respondWithStatusCode(_0x3c49e7,_0x4176bd){_0x4176bd=_0x4176bd||0xcc;return function(_0x328f5b){if(_0x328f5b){return _0x3c49e7[_0x00d4('0x1a')](_0x4176bd);}return _0x3c49e7[_0x00d4('0x1b')](_0x4176bd)['end']();};}function respondWithResult(_0x447e26,_0x48486e){_0x48486e=_0x48486e||0xc8;return function(_0x33856d){if(_0x33856d){return _0x447e26['status'](_0x48486e)[_0x00d4('0x1c')](_0x33856d);}};}function respondWithFilteredResult(_0x453b09,_0x2286af){return function(_0x304b3d){if(_0x304b3d){var _0x50642b=_0x304b3d[_0x00d4('0x1d')],_0x1d4f97=_0x2286af[_0x00d4('0x1e')],_0x422124=_0x2286af[_0x00d4('0x1e')]+_0x2286af[_0x00d4('0x1f')],_0x1dab71;if(_0x422124>=_0x50642b){_0x422124=_0x50642b;_0x1dab71=0xc8;}else{_0x1dab71=0xce;}_0x453b09[_0x00d4('0x1b')](_0x1dab71);return _0x453b09[_0x00d4('0x20')](_0x00d4('0x21'),_0x1d4f97+'-'+_0x422124+'/'+_0x50642b)[_0x00d4('0x1c')](_0x304b3d);}return null;};}function patchUpdates(_0x5a7f97){return function(_0x3b84bb){try{jsonpatch[_0x00d4('0x22')](_0x3b84bb,_0x5a7f97,!![]);}catch(_0x4227fb){return BPromise[_0x00d4('0x23')](_0x4227fb);}return _0x3b84bb[_0x00d4('0x24')]();};}function saveUpdates(_0x2d8756,_0x29ba9d){return function(_0x298815){if(_0x298815){return _0x298815[_0x00d4('0x25')](_0x2d8756)['then'](function(_0xcd8f44){return _0xcd8f44;});}return null;};}function removeEntity(_0x72329e,_0x269eff){return function(_0x2051fc){if(_0x2051fc){return _0x2051fc[_0x00d4('0x26')]()[_0x00d4('0x27')](function(){var _0x385c63=_0x2051fc[_0x00d4('0x28')]({'plain':!![]});var _0xac3723='Intervals';return db[_0x00d4('0x29')][_0x00d4('0x26')]({'where':{'type':_0xac3723,'resourceId':_0x385c63['id']}})[_0x00d4('0x27')](function(){return _0x2051fc;});})['then'](function(){_0x72329e['status'](0xcc)[_0x00d4('0x2a')]();});}};}function handleEntityNotFound(_0x35ba75,_0x467ece){return function(_0x1460e3){if(!_0x1460e3){_0x35ba75[_0x00d4('0x1a')](0x194);}return _0x1460e3;};}function handleError(_0x550f2c,_0x4a4363){_0x4a4363=_0x4a4363||0x1f4;return function(_0x3f5d24){logger[_0x00d4('0x2b')](_0x3f5d24[_0x00d4('0x2c')]);if(_0x3f5d24[_0x00d4('0x2d')]){delete _0x3f5d24[_0x00d4('0x2d')];}_0x550f2c[_0x00d4('0x1b')](_0x4a4363)[_0x00d4('0x2e')](_0x3f5d24);};}exports[_0x00d4('0x2f')]=function(_0x1f87a8,_0x4f0c92){var _0x4c27fc={},_0x1870f9={},_0x19a3aa={'count':0x0,'rows':[]};var _0x1b45bb=_[_0x00d4('0x30')](db['Interval'][_0x00d4('0x31')],function(_0x408bd7){return{'name':_0x408bd7[_0x00d4('0x32')],'type':_0x408bd7[_0x00d4('0x33')]['key']};});_0x1870f9[_0x00d4('0x34')]=_[_0x00d4('0x30')](_0x1b45bb,_0x00d4('0x2d'));_0x1870f9['query']=_[_0x00d4('0x35')](_0x1f87a8['query']);_0x1870f9[_0x00d4('0x36')]=_[_0x00d4('0x37')](_0x1870f9[_0x00d4('0x34')],_0x1870f9[_0x00d4('0x38')]);_0x4c27fc['attributes']=_[_0x00d4('0x37')](_0x1870f9[_0x00d4('0x34')],qs['fields'](_0x1f87a8[_0x00d4('0x38')]['fields']));_0x4c27fc[_0x00d4('0x39')]=_0x4c27fc[_0x00d4('0x39')][_0x00d4('0x3a')]?_0x4c27fc[_0x00d4('0x39')]:_0x1870f9['model'];if(!_0x1f87a8[_0x00d4('0x38')][_0x00d4('0x3b')]('nolimit')){_0x4c27fc[_0x00d4('0x1f')]=qs[_0x00d4('0x1f')](_0x1f87a8[_0x00d4('0x38')][_0x00d4('0x1f')]);_0x4c27fc[_0x00d4('0x1e')]=qs[_0x00d4('0x1e')](_0x1f87a8[_0x00d4('0x38')]['offset']);}_0x4c27fc[_0x00d4('0x3c')]=qs[_0x00d4('0x3d')](_0x1f87a8[_0x00d4('0x38')][_0x00d4('0x3d')]);_0x4c27fc[_0x00d4('0x3e')]=qs['filters'](_[_0x00d4('0x3f')](_0x1f87a8[_0x00d4('0x38')],_0x1870f9['filters']),_0x1b45bb);if(_0x1f87a8[_0x00d4('0x38')]['filter']){_0x4c27fc[_0x00d4('0x3e')]=_[_0x00d4('0x40')](_0x4c27fc[_0x00d4('0x3e')],{'$or':_[_0x00d4('0x30')](_0x1b45bb,function(_0x13d73b){if(_0x13d73b[_0x00d4('0x33')]!=='VIRTUAL'){var _0x1ff380={};_0x1ff380[_0x13d73b[_0x00d4('0x2d')]]={'$like':'%'+_0x1f87a8[_0x00d4('0x38')][_0x00d4('0x41')]+'%'};return _0x1ff380;}})});}_0x4c27fc=_['merge']({},_0x4c27fc,_0x1f87a8['options']);var _0xe25c9d={'where':_0x4c27fc[_0x00d4('0x3e')]};return db['Interval'][_0x00d4('0x1d')](_0xe25c9d)[_0x00d4('0x27')](function(_0x1ebb31){_0x19a3aa['count']=_0x1ebb31;if(_0x1f87a8[_0x00d4('0x38')][_0x00d4('0x42')]){_0x4c27fc[_0x00d4('0x43')]=[{'all':!![]}];}return db[_0x00d4('0x44')][_0x00d4('0x45')](_0x4c27fc);})['then'](function(_0x4257ce){_0x19a3aa[_0x00d4('0x46')]=_0x4257ce;return _0x19a3aa;})['then'](respondWithFilteredResult(_0x4f0c92,_0x4c27fc))[_0x00d4('0x47')](handleError(_0x4f0c92,null));};exports[_0x00d4('0x48')]=function(_0x9276f,_0x517c37){var _0x352a82={'raw':!![],'where':{'id':_0x9276f[_0x00d4('0x49')]['id']}},_0x3e6a45={};_0x3e6a45[_0x00d4('0x34')]=_[_0x00d4('0x35')](db[_0x00d4('0x44')]['rawAttributes']);_0x3e6a45[_0x00d4('0x38')]=_['keys'](_0x9276f[_0x00d4('0x38')]);_0x3e6a45[_0x00d4('0x36')]=_[_0x00d4('0x37')](_0x3e6a45[_0x00d4('0x34')],_0x3e6a45[_0x00d4('0x38')]);_0x352a82[_0x00d4('0x39')]=_[_0x00d4('0x37')](_0x3e6a45['model'],qs[_0x00d4('0x4a')](_0x9276f[_0x00d4('0x38')][_0x00d4('0x4a')]));_0x352a82['attributes']=_0x352a82[_0x00d4('0x39')]['length']?_0x352a82[_0x00d4('0x39')]:_0x3e6a45[_0x00d4('0x34')];if(_0x9276f['query'][_0x00d4('0x42')]){_0x352a82[_0x00d4('0x43')]=[{'all':!![]}];}_0x352a82=_['merge']({},_0x352a82,_0x9276f[_0x00d4('0x4b')]);return db['Interval'][_0x00d4('0x4c')](_0x352a82)[_0x00d4('0x27')](handleEntityNotFound(_0x517c37,null))[_0x00d4('0x27')](respondWithResult(_0x517c37,null))[_0x00d4('0x47')](handleError(_0x517c37,null));};exports[_0x00d4('0x4d')]=function(_0x3be073,_0x1c3a43){return db[_0x00d4('0x44')][_0x00d4('0x4d')](_0x3be073[_0x00d4('0x4e')],{})[_0x00d4('0x27')](function(_0x387ac6){var _0xd2d98=_0x3be073[_0x00d4('0x4f')][_0x00d4('0x28')]({'plain':!![]});if(!_0xd2d98)throw new Error(_0x00d4('0x50'));if(_0xd2d98[_0x00d4('0x51')]===_0x00d4('0x4f')){var _0x2834f1=_0x387ac6[_0x00d4('0x28')]({'plain':!![]});var _0x480595=_0x00d4('0x52');return db['UserProfileSection'][_0x00d4('0x4c')]({'where':{'name':_0x480595,'userProfileId':_0xd2d98[_0x00d4('0x53')]},'raw':!![]})[_0x00d4('0x27')](function(_0x34e245){if(_0x34e245&&_0x34e245[_0x00d4('0x54')]===0x0){return db[_0x00d4('0x29')][_0x00d4('0x4d')]({'name':_0x2834f1[_0x00d4('0x2d')],'resourceId':_0x2834f1['id'],'type':_0x34e245['name'],'sectionId':_0x34e245['id']},{})[_0x00d4('0x27')](function(){return _0x387ac6;});}else{return _0x387ac6;}})[_0x00d4('0x47')](function(_0x58b522){logger[_0x00d4('0x2b')](_0x00d4('0x55'),_0x58b522);throw _0x58b522;});}return _0x387ac6;})['then'](respondWithResult(_0x1c3a43,0xc9))[_0x00d4('0x47')](handleError(_0x1c3a43,null));};exports['update']=function(_0x4d4900,_0xa00d8e){if(_0x4d4900[_0x00d4('0x4e')]['id']){delete _0x4d4900['body']['id'];}return db[_0x00d4('0x44')][_0x00d4('0x4c')]({'where':{'id':_0x4d4900[_0x00d4('0x49')]['id']}})[_0x00d4('0x27')](handleEntityNotFound(_0xa00d8e,null))[_0x00d4('0x27')](saveUpdates(_0x4d4900['body'],null))[_0x00d4('0x27')](respondWithResult(_0xa00d8e,null))[_0x00d4('0x47')](handleError(_0xa00d8e,null));};exports[_0x00d4('0x26')]=function(_0x409c38,_0x1eda62){return db[_0x00d4('0x44')]['find']({'where':{'id':_0x409c38[_0x00d4('0x49')]['id']}})[_0x00d4('0x27')](handleEntityNotFound(_0x1eda62,null))['then'](removeEntity(_0x1eda62,null))[_0x00d4('0x47')](handleError(_0x1eda62,null));};exports[_0x00d4('0x56')]=function(_0x27cb03,_0x386821,_0x199f1c){if(_0x27cb03[_0x00d4('0x4e')]['id']){delete _0x27cb03[_0x00d4('0x4e')]['id'];}return db[_0x00d4('0x44')][_0x00d4('0x4c')]({'where':{'id':_0x27cb03['params']['id']}})['then'](handleEntityNotFound(_0x386821,null))['then'](function(_0x1d18b6){if(_0x1d18b6){_0x27cb03[_0x00d4('0x4e')][_0x00d4('0x57')]=_0x1d18b6['id'];return db[_0x00d4('0x44')][_0x00d4('0x4d')](_0x27cb03[_0x00d4('0x4e')]);}})[_0x00d4('0x27')](respondWithResult(_0x386821,null))['catch'](handleError(_0x386821,null));};exports[_0x00d4('0x58')]=function(_0x49f7a7,_0x270e3b,_0x15a8fc){var _0x5bedfb={};var _0x24ec58={};var _0xee424e;var _0x2a87a0;return db[_0x00d4('0x44')][_0x00d4('0x59')]({'where':{'id':_0x49f7a7[_0x00d4('0x49')]['id']}})[_0x00d4('0x27')](handleEntityNotFound(_0x270e3b,null))[_0x00d4('0x27')](function(_0x3f6cbb){if(_0x3f6cbb){_0xee424e=_0x3f6cbb;_0x24ec58['model']=_['keys'](db[_0x00d4('0x44')][_0x00d4('0x31')]);_0x24ec58[_0x00d4('0x38')]=_[_0x00d4('0x35')](_0x49f7a7[_0x00d4('0x38')]);_0x24ec58['filters']=_['intersection'](_0x24ec58['model'],_0x24ec58[_0x00d4('0x38')]);_0x5bedfb[_0x00d4('0x39')]=_['intersection'](_0x24ec58[_0x00d4('0x34')],qs[_0x00d4('0x4a')](_0x49f7a7['query']['fields']));_0x5bedfb[_0x00d4('0x39')]=_0x5bedfb['attributes'][_0x00d4('0x3a')]?_0x5bedfb[_0x00d4('0x39')]:_0x24ec58[_0x00d4('0x34')];_0x5bedfb['order']=qs[_0x00d4('0x3d')](_0x49f7a7[_0x00d4('0x38')][_0x00d4('0x3d')]);_0x5bedfb[_0x00d4('0x3e')]=qs['filters'](_[_0x00d4('0x3f')](_0x49f7a7[_0x00d4('0x38')],_0x24ec58[_0x00d4('0x36')]));if(_0x49f7a7[_0x00d4('0x38')][_0x00d4('0x41')]){_0x5bedfb['where']=_[_0x00d4('0x40')](_0x5bedfb[_0x00d4('0x3e')],{'$or':_['map'](_0x5bedfb[_0x00d4('0x39')],function(_0x15827b){var _0xd0a456={};_0xd0a456[_0x15827b]={'$like':'%'+_0x49f7a7[_0x00d4('0x38')][_0x00d4('0x41')]+'%'};return _0xd0a456;})});}_0x5bedfb=_[_0x00d4('0x40')]({},_0x5bedfb,_0x49f7a7[_0x00d4('0x4b')]);return _0xee424e[_0x00d4('0x58')](_0x5bedfb);}})['then'](function(_0x292d78){if(_0x292d78){_0x2a87a0=_0x292d78[_0x00d4('0x3a')];if(!_0x49f7a7[_0x00d4('0x38')][_0x00d4('0x3b')](_0x00d4('0x5a'))){_0x5bedfb[_0x00d4('0x1f')]=qs[_0x00d4('0x1f')](_0x49f7a7[_0x00d4('0x38')][_0x00d4('0x1f')]);_0x5bedfb[_0x00d4('0x1e')]=qs[_0x00d4('0x1e')](_0x49f7a7[_0x00d4('0x38')][_0x00d4('0x1e')]);}return _0xee424e[_0x00d4('0x58')](_0x5bedfb);}})['then'](function(_0x1ea99e){if(_0x1ea99e){return _0x1ea99e?{'count':_0x2a87a0,'rows':_0x1ea99e}:null;}})[_0x00d4('0x27')](respondWithResult(_0x270e3b,null))[_0x00d4('0x47')](handleError(_0x270e3b,null));};exports[_0x00d4('0x5b')]=function(_0x618fe8,_0x3e19c4,_0x20bb1a){return db['Interval']['findOne']({'where':{'id':_0x618fe8[_0x00d4('0x49')]['id']}})[_0x00d4('0x27')](handleEntityNotFound(_0x3e19c4,null))[_0x00d4('0x27')](function(_0x36b2ef){if(_0x36b2ef){return db[_0x00d4('0x5c')][_0x00d4('0x5d')](function(_0x4def59){return db['Interval'][_0x00d4('0x26')]({'where':{'IntervalId':_0x618fe8['params']['id']},'transaction':_0x4def59})[_0x00d4('0x27')](function(_0x35ef1c){var _0x117775=_[_0x00d4('0x30')](_0x618fe8[_0x00d4('0x4e')],function(_0x3162ef){delete _0x3162ef['id'];_0x3162ef['IntervalId']=_0x618fe8[_0x00d4('0x49')]['id'];return _0x3162ef;});return db[_0x00d4('0x44')][_0x00d4('0x5e')](_0x117775,{'transaction':_0x4def59});});})[_0x00d4('0x27')](function(){return db[_0x00d4('0x44')][_0x00d4('0x45')]({'where':{'IntervalId':_0x618fe8[_0x00d4('0x49')]['id']}});});}})[_0x00d4('0x27')](respondWithResult(_0x3e19c4,null))[_0x00d4('0x47')](handleError(_0x3e19c4,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 130c2f8..5be426b 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 _0x6484=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x6484,0x64));var _0x4648=function(_0xbbcdf6,_0x4ee2d8){_0xbbcdf6=_0xbbcdf6-0x0;var _0x1abc46=_0x6484[_0xbbcdf6];return _0x1abc46;};'use strict';var _=require(_0x4648('0x0'));var util=require(_0x4648('0x1'));var logger=require(_0x4648('0x2'))(_0x4648('0x3'));var moment=require(_0x4648('0x4'));var BPromise=require(_0x4648('0x5'));var rp=require(_0x4648('0x6'));var fs=require('fs');var path=require(_0x4648('0x7'));var rimraf=require(_0x4648('0x8'));var config=require(_0x4648('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0x4648('0xa'));module[_0x4648('0xb')]=function(_0x5f385a,_0x37efab){return _0x5f385a[_0x4648('0xc')](_0x4648('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xdd8612,_0x1d110e){extensions[_0x4648('0xe')](_0x5f385a,_0xdd8612);},'afterBulkCreate':function(_0x5ea0e2,_0x3e2d17,_0x551778){_0x551778();extensions[_0x4648('0xe')](_0x5f385a,_0x5ea0e2[0x0]);},'afterUpdate':function(_0x1442ef,_0x1ce292){extensions[_0x4648('0xe')](_0x5f385a,_0x1442ef);},'afterDestroy':function(_0x44c800,_0x139a17){extensions[_0x4648('0xe')](_0x5f385a,_0x44c800);}}});}; \ No newline at end of file +var _0x0884=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash'];(function(_0x3a5a82,_0x4c7b4f){var _0x329fc3=function(_0x77d03a){while(--_0x77d03a){_0x3a5a82['push'](_0x3a5a82['shift']());}};_0x329fc3(++_0x4c7b4f);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var util=require(_0x4088('0x1'));var logger=require(_0x4088('0x2'))(_0x4088('0x3'));var moment=require(_0x4088('0x4'));var BPromise=require(_0x4088('0x5'));var rp=require(_0x4088('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4088('0x7'));var config=require(_0x4088('0x8'));var attributes=require(_0x4088('0x9'));var extensions=require(_0x4088('0xa'));module[_0x4088('0xb')]=function(_0x4da2f7,_0x4d68aa){return _0x4da2f7[_0x4088('0xc')]('Interval',attributes,{'tableName':_0x4088('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x8f007c,_0x38e9d9){extensions[_0x4088('0xe')](_0x4da2f7,_0x8f007c);},'afterBulkCreate':function(_0x32fbb6,_0x29c7ec,_0x1cc7fa){_0x1cc7fa();extensions[_0x4088('0xe')](_0x4da2f7,_0x32fbb6[0x0]);},'afterUpdate':function(_0x295777,_0x5bd635){extensions[_0x4088('0xe')](_0x4da2f7,_0x295777);},'afterDestroy':function(_0x25194b,_0xb449a9){extensions['rewrite'](_0x4da2f7,_0x25194b);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a0f730f..b3996a6 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 _0x405d=['message','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetInterval','debug','stringify','ShowInterval','Interval','find','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error'];(function(_0x298819,_0x4ba67d){var _0x526ef7=function(_0x4a15f1){while(--_0x4a15f1){_0x298819['push'](_0x298819['shift']());}};_0x526ef7(++_0x4ba67d);}(_0x405d,0xdd));var _0xd405=function(_0x1d044d,_0x1037e8){_0x1d044d=_0x1d044d-0x0;var _0x197e02=_0x405d[_0x1d044d];return _0x197e02;};'use strict';var _=require(_0xd405('0x0'));var util=require('util');var moment=require(_0xd405('0x1'));var BPromise=require(_0xd405('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd405('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd405('0x4'));var logger=require(_0xd405('0x5'))(_0xd405('0x6'));var config=require(_0xd405('0x7'));var jayson=require(_0xd405('0x8'));var client=jayson['client'][_0xd405('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x579380,_0x2375ff,_0x29601c){return new BPromise(function(_0x360314,_0x50b0dc){return client[_0xd405('0xa')](_0x579380,_0x29601c)[_0xd405('0xb')](function(_0x502707){logger[_0xd405('0xc')](_0xd405('0xd'),_0x2375ff,_0xd405('0xe'));logger['debug'](_0xd405('0xf'),_0x2375ff,_0xd405('0xe'),JSON['stringify'](_0x502707));if(_0x502707[_0xd405('0x10')]){if(_0x502707[_0xd405('0x10')]['code']===0x1f4){logger[_0xd405('0x10')]('Interval,\x20%s,\x20%s',_0x2375ff,_0x502707[_0xd405('0x10')][_0xd405('0x11')]);return _0x50b0dc(_0x502707[_0xd405('0x10')][_0xd405('0x11')]);}logger[_0xd405('0x10')](_0xd405('0xd'),_0x2375ff,_0x502707[_0xd405('0x10')][_0xd405('0x11')]);return _0x360314(_0x502707[_0xd405('0x10')][_0xd405('0x11')]);}else{logger[_0xd405('0xc')](_0xd405('0xd'),_0x2375ff,_0xd405('0xe'));_0x360314(_0x502707['result'][_0xd405('0x11')]);}})[_0xd405('0x12')](function(_0x37ae3e){logger[_0xd405('0x10')]('Interval,\x20%s,\x20%s',_0x2375ff,_0x37ae3e);_0x50b0dc(_0x37ae3e);});});}exports['GetInterval']=function(_0x29938c){var _0x51f160=this;return new Promise(function(_0x4d30d7,_0x21fdea){return db['Interval'][_0xd405('0x13')]({'raw':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x15')]===undefined?!![]:![]:!![],'where':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x16')]||null:null,'attributes':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')]['attributes']||null:null,'limit':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x17')]||null:null,'include':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x18')]?_[_0xd405('0x19')](_0x29938c[_0xd405('0x14')][_0xd405('0x18')],function(_0x2cd001){return{'model':db[_0x2cd001[_0xd405('0x1a')]],'as':_0x2cd001['as'],'attributes':_0x2cd001[_0xd405('0x1b')],'include':_0x2cd001[_0xd405('0x18')]?_[_0xd405('0x19')](_0x2cd001['include'],function(_0x1161d0){return{'model':db[_0x1161d0[_0xd405('0x1a')]],'as':_0x1161d0['as'],'attributes':_0x1161d0[_0xd405('0x1b')],'include':_0x1161d0[_0xd405('0x18')]?_['map'](_0x1161d0[_0xd405('0x18')],function(_0x4b6ccc){return{'model':db[_0x4b6ccc['model']],'as':_0x4b6ccc['as'],'attributes':_0x4b6ccc[_0xd405('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd405('0xb')](function(_0x359d0e){logger[_0xd405('0xc')](_0xd405('0x1c'),_0x29938c);logger[_0xd405('0x1d')](_0xd405('0x1c'),_0x29938c,JSON[_0xd405('0x1e')](_0x359d0e));_0x4d30d7(_0x359d0e);})['catch'](function(_0x241b03){logger['error']('GetInterval',_0x241b03[_0xd405('0x11')],_0x29938c);_0x21fdea(_0x51f160[_0xd405('0x10')](0x1f4,_0x241b03[_0xd405('0x11')]));});});};exports[_0xd405('0x1f')]=function(_0x41421e){var _0x5e776c=this;return new Promise(function(_0x7fe0e9,_0x2d5a16){return db[_0xd405('0x20')][_0xd405('0x21')]({'raw':_0x41421e[_0xd405('0x14')]?_0x41421e[_0xd405('0x14')][_0xd405('0x15')]===undefined?!![]:![]:!![],'where':_0x41421e['options']?_0x41421e[_0xd405('0x14')][_0xd405('0x16')]||null:null,'attributes':_0x41421e[_0xd405('0x14')]?_0x41421e[_0xd405('0x14')]['attributes']||null:null,'include':_0x41421e[_0xd405('0x14')]?_0x41421e[_0xd405('0x14')][_0xd405('0x18')]?_[_0xd405('0x19')](_0x41421e[_0xd405('0x14')]['include'],function(_0x39e885){return{'model':db[_0x39e885[_0xd405('0x1a')]],'as':_0x39e885['as'],'attributes':_0x39e885[_0xd405('0x1b')],'include':_0x39e885[_0xd405('0x18')]?_[_0xd405('0x19')](_0x39e885[_0xd405('0x18')],function(_0x41e548){return{'model':db[_0x41e548[_0xd405('0x1a')]],'as':_0x41e548['as'],'attributes':_0x41e548[_0xd405('0x1b')],'include':_0x41e548[_0xd405('0x18')]?_[_0xd405('0x19')](_0x41e548[_0xd405('0x18')],function(_0x286278){return{'model':db[_0x286278[_0xd405('0x1a')]],'as':_0x286278['as'],'attributes':_0x286278[_0xd405('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd405('0xb')](function(_0x5c92c4){logger[_0xd405('0xc')](_0xd405('0x1f'),_0x41421e);logger[_0xd405('0x1d')]('ShowInterval',_0x41421e,JSON[_0xd405('0x1e')](_0x5c92c4));_0x7fe0e9(_0x5c92c4);})[_0xd405('0x12')](function(_0x2d18a1){logger['error']('ShowInterval',_0x2d18a1['message'],_0x41421e);_0x2d5a16(_0x5e776c['error'](0x1f4,_0x2d18a1['message']));});});}; \ No newline at end of file +var _0x9991=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Interval,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','include','model','map','debug','ShowInterval','find'];(function(_0x421f3e,_0x276236){var _0xfb8342=function(_0x78a5cb){while(--_0x78a5cb){_0x421f3e['push'](_0x421f3e['shift']());}};_0xfb8342(++_0x276236);}(_0x9991,0x1ad));var _0x1999=function(_0x446642,_0xbd2122){_0x446642=_0x446642-0x0;var _0x426c8c=_0x9991[_0x446642];return _0x426c8c;};'use strict';var _=require(_0x1999('0x0'));var util=require('util');var moment=require(_0x1999('0x1'));var BPromise=require(_0x1999('0x2'));var rs=require(_0x1999('0x3'));var fs=require('fs');var Redis=require(_0x1999('0x4'));var db=require(_0x1999('0x5'))['db'];var utils=require(_0x1999('0x6'));var logger=require(_0x1999('0x7'))('rpc');var config=require(_0x1999('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1999('0x9')][_0x1999('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4da46d,_0x44407d,_0x30763f){return new BPromise(function(_0x565031,_0x245d25){return client[_0x1999('0xb')](_0x4da46d,_0x30763f)[_0x1999('0xc')](function(_0x459103){logger['info'](_0x1999('0xd'),_0x44407d,_0x1999('0xe'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x44407d,_0x1999('0xe'),JSON['stringify'](_0x459103));if(_0x459103['error']){if(_0x459103[_0x1999('0xf')]['code']===0x1f4){logger[_0x1999('0xf')](_0x1999('0xd'),_0x44407d,_0x459103[_0x1999('0xf')][_0x1999('0x10')]);return _0x245d25(_0x459103['error'][_0x1999('0x10')]);}logger[_0x1999('0xf')](_0x1999('0xd'),_0x44407d,_0x459103[_0x1999('0xf')][_0x1999('0x10')]);return _0x565031(_0x459103[_0x1999('0xf')][_0x1999('0x10')]);}else{logger[_0x1999('0x11')](_0x1999('0xd'),_0x44407d,'request\x20sent');_0x565031(_0x459103[_0x1999('0x12')]['message']);}})[_0x1999('0x13')](function(_0x395161){logger[_0x1999('0xf')]('Interval,\x20%s,\x20%s',_0x44407d,_0x395161);_0x245d25(_0x395161);});});}exports[_0x1999('0x14')]=function(_0x976503){var _0x299b41=this;return new Promise(function(_0x481851,_0x498548){return db[_0x1999('0x15')][_0x1999('0x16')]({'raw':_0x976503[_0x1999('0x17')]?_0x976503[_0x1999('0x17')][_0x1999('0x18')]===undefined?!![]:![]:!![],'where':_0x976503[_0x1999('0x17')]?_0x976503['options'][_0x1999('0x19')]||null:null,'attributes':_0x976503[_0x1999('0x17')]?_0x976503[_0x1999('0x17')][_0x1999('0x1a')]||null:null,'limit':_0x976503[_0x1999('0x17')]?_0x976503[_0x1999('0x17')]['limit']||null:null,'include':_0x976503['options']?_0x976503[_0x1999('0x17')]['include']?_['map'](_0x976503[_0x1999('0x17')][_0x1999('0x1b')],function(_0x5e9d9a){return{'model':db[_0x5e9d9a[_0x1999('0x1c')]],'as':_0x5e9d9a['as'],'attributes':_0x5e9d9a[_0x1999('0x1a')],'include':_0x5e9d9a[_0x1999('0x1b')]?_[_0x1999('0x1d')](_0x5e9d9a[_0x1999('0x1b')],function(_0x55855b){return{'model':db[_0x55855b['model']],'as':_0x55855b['as'],'attributes':_0x55855b['attributes'],'include':_0x55855b[_0x1999('0x1b')]?_['map'](_0x55855b['include'],function(_0x47e9a1){return{'model':db[_0x47e9a1[_0x1999('0x1c')]],'as':_0x47e9a1['as'],'attributes':_0x47e9a1[_0x1999('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1999('0xc')](function(_0x250161){logger[_0x1999('0x11')]('GetInterval',_0x976503);logger[_0x1999('0x1e')]('GetInterval',_0x976503,JSON['stringify'](_0x250161));_0x481851(_0x250161);})[_0x1999('0x13')](function(_0x18b798){logger[_0x1999('0xf')](_0x1999('0x14'),_0x18b798[_0x1999('0x10')],_0x976503);_0x498548(_0x299b41['error'](0x1f4,_0x18b798[_0x1999('0x10')]));});});};exports[_0x1999('0x1f')]=function(_0x1c52c9){var _0x2a592d=this;return new Promise(function(_0x16deb0,_0x496a9a){return db['Interval'][_0x1999('0x20')]({'raw':_0x1c52c9[_0x1999('0x17')]?_0x1c52c9[_0x1999('0x17')][_0x1999('0x18')]===undefined?!![]:![]:!![],'where':_0x1c52c9[_0x1999('0x17')]?_0x1c52c9[_0x1999('0x17')][_0x1999('0x19')]||null:null,'attributes':_0x1c52c9[_0x1999('0x17')]?_0x1c52c9[_0x1999('0x17')][_0x1999('0x1a')]||null:null,'include':_0x1c52c9[_0x1999('0x17')]?_0x1c52c9[_0x1999('0x17')][_0x1999('0x1b')]?_[_0x1999('0x1d')](_0x1c52c9[_0x1999('0x17')]['include'],function(_0x48bb78){return{'model':db[_0x48bb78[_0x1999('0x1c')]],'as':_0x48bb78['as'],'attributes':_0x48bb78[_0x1999('0x1a')],'include':_0x48bb78[_0x1999('0x1b')]?_[_0x1999('0x1d')](_0x48bb78['include'],function(_0xb12b00){return{'model':db[_0xb12b00[_0x1999('0x1c')]],'as':_0xb12b00['as'],'attributes':_0xb12b00[_0x1999('0x1a')],'include':_0xb12b00[_0x1999('0x1b')]?_[_0x1999('0x1d')](_0xb12b00['include'],function(_0x13424a){return{'model':db[_0x13424a[_0x1999('0x1c')]],'as':_0x13424a['as'],'attributes':_0x13424a[_0x1999('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1999('0xc')](function(_0x20c235){logger[_0x1999('0x11')](_0x1999('0x1f'),_0x1c52c9);logger[_0x1999('0x1e')](_0x1999('0x1f'),_0x1c52c9,JSON['stringify'](_0x20c235));_0x16deb0(_0x20c235);})[_0x1999('0x13')](function(_0x467b71){logger['error'](_0x1999('0x1f'),_0x467b71['message'],_0x1c52c9);_0x496a9a(_0x2a592d['error'](0x1f4,_0x467b71[_0x1999('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 9f80898..14280ca 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 _0x437c=['isAuthenticated','express','Router','../../components/auth/service','./jira.controller'];(function(_0x2b25d5,_0x4ed28e){var _0x29df08=function(_0x1437ad){while(--_0x1437ad){_0x2b25d5['push'](_0x2b25d5['shift']());}};_0x29df08(++_0x4ed28e);}(_0x437c,0xd8));var _0xc437=function(_0xc31154,_0x293e74){_0xc31154=_0xc31154-0x0;var _0x484de2=_0x437c[_0xc31154];return _0x484de2;};'use strict';var express=require(_0xc437('0x0'));var router=express[_0xc437('0x1')]();var auth=require(_0xc437('0x2'));var controller=require(_0xc437('0x3'));router['post']('/',auth[_0xc437('0x4')](),controller['send']);module['exports']=router; \ No newline at end of file +var _0xc180=['Router','../../components/auth/service','isAuthenticated','exports','express'];(function(_0x22f9c0,_0x35410c){var _0x1883fe=function(_0x5a5601){while(--_0x5a5601){_0x22f9c0['push'](_0x22f9c0['shift']());}};_0x1883fe(++_0x35410c);}(_0xc180,0x185));var _0x0c18=function(_0x2eb477,_0x14d9d3){_0x2eb477=_0x2eb477-0x0;var _0x20e985=_0xc180[_0x2eb477];return _0x20e985;};'use strict';var express=require(_0x0c18('0x0'));var router=express[_0x0c18('0x1')]();var auth=require(_0x0c18('0x2'));var controller=require('./jira.controller');router['post']('/',auth[_0x0c18('0x3')](),controller['send']);module[_0x0c18('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8a18059..91bbae1 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 _0xf565=['customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields'];(function(_0x46757,_0x455333){var _0x35dee6=function(_0x487c1d){while(--_0x487c1d){_0x46757['push'](_0x46757['shift']());}};_0x35dee6(++_0x455333);}(_0xf565,0x189));var _0x5f56=function(_0x456f07,_0x3db21d){_0x456f07=_0x456f07-0x0;var _0x6dab3f=_0xf565[_0x456f07];return _0x6dab3f;};'use strict';var BPromise=require(_0x5f56('0x0'));var https=require(_0x5f56('0x1'));var logger=require(_0x5f56('0x2'))('api');var USERNAME='support';var PASSWORD=_0x5f56('0x3');function openIssue(_0x48b0a3,_0x516815){var _0x1deee7={'fields':{'project':{'key':_0x48b0a3[_0x5f56('0x4')]||'MOTGUI'},'summary':(_0x48b0a3[_0x5f56('0x5')]||_0x5f56('0x6'))+_0x5f56('0x7')+_0x48b0a3['ip'],'description':_0x48b0a3[_0x5f56('0x8')]||JSON[_0x5f56('0x9')](_0x48b0a3),'issuetype':{'name':_0x48b0a3['issuetype']||_0x5f56('0xa')}}};_0x1deee7[_0x5f56('0xb')][_0x5f56('0xc')]=_0x48b0a3[_0x5f56('0xd')];_0x1deee7['fields'][_0x5f56('0xe')]=_0x48b0a3['oldToken'];_0x1deee7[_0x5f56('0xb')][_0x5f56('0xf')]=_0x48b0a3[_0x5f56('0x10')];_0x1deee7['fields'][_0x5f56('0x11')]=_0x48b0a3[_0x5f56('0x12')];_0x1deee7[_0x5f56('0xb')][_0x5f56('0x13')]=_0x48b0a3['reason'];_0x1deee7[_0x5f56('0xb')]['customfield_10102']=_0x48b0a3['ip'];var _0x4564a2={'host':_0x5f56('0x14'),'port':0x1bb,'path':_0x5f56('0x15'),'method':_0x5f56('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x5f56('0x17'),'Authorization':_0x5f56('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x5f56('0x19')](_0x5f56('0x1a'))}};var _0x3bd3d7=JSON['stringify'](_0x1deee7);var _0x3f86e8=https[_0x5f56('0x1b')](_0x4564a2,function(_0x2fb6ab){_0x2fb6ab[_0x5f56('0x1c')]('utf8');var _0x296582='';_0x2fb6ab['on'](_0x5f56('0x1d'),function(_0x2b6ec9){_0x296582+=_0x2b6ec9;});_0x2fb6ab['on'](_0x5f56('0x1e'),function(){if(_0x516815){return _0x516815[_0x5f56('0x1f')](_0x2fb6ab[_0x5f56('0x20')])[_0x5f56('0x21')](JSON['parse'](_0x296582));}});});_0x3f86e8['on'](_0x5f56('0x22'),function(_0x57c02d){if(_0x516815){return _0x516815[_0x5f56('0x1f')](0x1f4)[_0x5f56('0x21')]({'errors':[{'message':_0x5f56('0x23'),'type':_0x5f56('0x24')}]});}});_0x3f86e8[_0x5f56('0x25')](_0x3bd3d7);_0x3f86e8[_0x5f56('0x1e')]();}exports[_0x5f56('0x26')]=openIssue;exports['send']=function(_0x5b081e,_0x2825a9){_0x5b081e[_0x5f56('0x27')]['ip']=_0x5b081e[_0x5f56('0x28')][_0x5f56('0x29')]||_0x5b081e[_0x5f56('0x2a')][_0x5f56('0x2b')]||_0x5b081e[_0x5f56('0x2c')][_0x5f56('0x2b')]||_0x5b081e[_0x5f56('0x2a')]['socket'][_0x5f56('0x2b')];return openIssue(_0x5b081e[_0x5f56('0x27')],_0x2825a9);}; \ No newline at end of file +var _0x7688=['parse','error','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json'];(function(_0x27d5b1,_0x4e33a9){var _0xc33abd=function(_0x24e1ed){while(--_0x24e1ed){_0x27d5b1['push'](_0x27d5b1['shift']());}};_0xc33abd(++_0x4e33a9);}(_0x7688,0xbb));var _0x8768=function(_0x32908e,_0x41176b){_0x32908e=_0x32908e-0x0;var _0xcbc3f0=_0x7688[_0x32908e];return _0xcbc3f0;};'use strict';var BPromise=require('bluebird');var https=require(_0x8768('0x0'));var logger=require(_0x8768('0x1'))(_0x8768('0x2'));var USERNAME=_0x8768('0x3');var PASSWORD=_0x8768('0x4');function openIssue(_0x93e26a,_0x144c66){var _0x1a1298={'fields':{'project':{'key':_0x93e26a['key']||_0x8768('0x5')},'summary':(_0x93e26a[_0x8768('0x6')]||_0x8768('0x7'))+_0x8768('0x8')+_0x93e26a['ip'],'description':_0x93e26a['description']||JSON['stringify'](_0x93e26a),'issuetype':{'name':_0x93e26a['issuetype']||'Bug'}}};_0x1a1298[_0x8768('0x9')][_0x8768('0xa')]=_0x93e26a[_0x8768('0xb')];_0x1a1298[_0x8768('0x9')]['customfield_11501']=_0x93e26a[_0x8768('0xc')];_0x1a1298[_0x8768('0x9')][_0x8768('0xd')]=_0x93e26a[_0x8768('0xe')];_0x1a1298[_0x8768('0x9')][_0x8768('0xf')]=_0x93e26a['name'];_0x1a1298[_0x8768('0x9')][_0x8768('0x10')]=_0x93e26a[_0x8768('0x11')];_0x1a1298[_0x8768('0x9')][_0x8768('0x12')]=_0x93e26a['ip'];var _0x1055ef={'host':_0x8768('0x13'),'port':0x1bb,'path':_0x8768('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x8768('0x15'),'Authorization':_0x8768('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x8768('0x17')](_0x8768('0x18'))}};var _0x142c2d=JSON['stringify'](_0x1a1298);var _0x14f208=https[_0x8768('0x19')](_0x1055ef,function(_0x208307){_0x208307[_0x8768('0x1a')](_0x8768('0x1b'));var _0x375d3c='';_0x208307['on'](_0x8768('0x1c'),function(_0x3de303){_0x375d3c+=_0x3de303;});_0x208307['on'](_0x8768('0x1d'),function(){if(_0x144c66){return _0x144c66[_0x8768('0x1e')](_0x208307[_0x8768('0x1f')])[_0x8768('0x20')](JSON[_0x8768('0x21')](_0x375d3c));}});});_0x14f208['on'](_0x8768('0x22'),function(_0x4d3a01){if(_0x144c66){return _0x144c66[_0x8768('0x1e')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x8768('0x23')}]});}});_0x14f208[_0x8768('0x24')](_0x142c2d);_0x14f208['end']();}exports[_0x8768('0x25')]=openIssue;exports[_0x8768('0x26')]=function(_0x10daae,_0x4f0422){_0x10daae[_0x8768('0x27')]['ip']=_0x10daae['headers'][_0x8768('0x28')]||_0x10daae[_0x8768('0x29')][_0x8768('0x2a')]||_0x10daae[_0x8768('0x2b')][_0x8768('0x2a')]||_0x10daae[_0x8768('0x29')][_0x8768('0x2b')][_0x8768('0x2a')];return openIssue(_0x10daae[_0x8768('0x27')],_0x4f0422);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c7d0a68..5741364 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 _0xf28d=['update','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','put'];(function(_0x184a63,_0x47d607){var _0x269a2f=function(_0x475578){while(--_0x475578){_0x184a63['push'](_0x184a63['shift']());}};_0x269a2f(++_0x47d607);}(_0xf28d,0xd2));var _0xdf28=function(_0x239c07,_0x135a6f){_0x239c07=_0x239c07-0x0;var _0x3e1d6c=_0xf28d[_0x239c07];return _0x3e1d6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf28('0x0'));var timeout=require('connect-timeout');var express=require(_0xdf28('0x1'));var router=express[_0xdf28('0x2')]();var auth=require(_0xdf28('0x3'));var interaction=require(_0xdf28('0x4'));var config=require(_0xdf28('0x5'));var controller=require(_0xdf28('0x6'));router[_0xdf28('0x7')]('/',auth[_0xdf28('0x8')](),controller[_0xdf28('0x9')]);router[_0xdf28('0x7')]('/describe',auth[_0xdf28('0x8')](),controller[_0xdf28('0xa')]);router[_0xdf28('0x7')](_0xdf28('0xb'),auth[_0xdf28('0x8')](),controller[_0xdf28('0xc')]);router['post']('/',auth[_0xdf28('0x8')](),controller['create']);router[_0xdf28('0xd')](_0xdf28('0xb'),auth['isAuthenticated'](),controller[_0xdf28('0xe')]);router['delete'](_0xdf28('0xb'),auth['isAuthenticated'](),controller[_0xdf28('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7d6c=['/describe','show','post','put','/:id','delete','exports','multer','path','express','Router','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x7d6c,0x167));var _0xc7d6=function(_0x353053,_0xfac861){_0x353053=_0x353053-0x0;var _0x51b91e=_0x7d6c[_0x353053];return _0x51b91e;};'use strict';var multer=require(_0xc7d6('0x0'));var util=require('util');var path=require(_0xc7d6('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7d6('0x2'));var router=express[_0xc7d6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc7d6('0x4'));var config=require('../../config/environment');var controller=require(_0xc7d6('0x5'));router[_0xc7d6('0x6')]('/',auth[_0xc7d6('0x7')](),controller[_0xc7d6('0x8')]);router[_0xc7d6('0x6')](_0xc7d6('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xc7d6('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xc7d6('0xa')]);router[_0xc7d6('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc7d6('0xc')](_0xc7d6('0xd'),auth[_0xc7d6('0x7')](),controller['update']);router[_0xc7d6('0xe')](_0xc7d6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc7d6('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2263535..a51ba61 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 _0xbeb8=['STRING','long','sequelize','exports'];(function(_0x25fe2d,_0x4ab2c2){var _0x5c3217=function(_0x40c89a){while(--_0x40c89a){_0x25fe2d['push'](_0x25fe2d['shift']());}};_0x5c3217(++_0x4ab2c2);}(_0xbeb8,0xe2));var _0x8beb=function(_0x3af40a,_0x44d266){_0x3af40a=_0x3af40a-0x0;var _0x3d6f6a=_0xbeb8[_0x3af40a];return _0x3d6f6a;};'use strict';var Sequelize=require(_0x8beb('0x0'));module[_0x8beb('0x1')]={'question':{'type':Sequelize[_0x8beb('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x8beb('0x3'))},'membername':{'type':Sequelize[_0x8beb('0x2')]},'projectname':{'type':Sequelize[_0x8beb('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x8beb('0x2')]}}; \ No newline at end of file +var _0x28e9=['long','sequelize','STRING','TEXT'];(function(_0x3a1d96,_0x332929){var _0x368803=function(_0x5302d8){while(--_0x5302d8){_0x3a1d96['push'](_0x3a1d96['shift']());}};_0x368803(++_0x332929);}(_0x28e9,0xb5));var _0x928e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x28e9[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x928e('0x0'));module['exports']={'question':{'type':Sequelize[_0x928e('0x1')]},'answer':{'type':Sequelize[_0x928e('0x2')](_0x928e('0x3'))},'membername':{'type':Sequelize[_0x928e('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x928e('0x1')]},'calleridname':{'type':Sequelize[_0x928e('0x1')]},'calleridnum':{'type':Sequelize[_0x928e('0x1')]},'questionId':{'type':Sequelize[_0x928e('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 1541238..8afeea4 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 _0x15c6=['offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','JscriptyAnswerReport','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x517586,_0xc97d01){var _0x4d7494=function(_0x1383d8){while(--_0x1383d8){_0x517586['push'](_0x517586['shift']());}};_0x4d7494(++_0xc97d01);}(_0x15c6,0xbb));var _0x615c=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x15c6[_0x57d13b];return _0x467696;};'use strict';var pdf=require(_0x615c('0x0'));var emlformat=require(_0x615c('0x1'));var rimraf=require(_0x615c('0x2'));var zipdir=require(_0x615c('0x3'));var jsonpatch=require(_0x615c('0x4'));var rp=require(_0x615c('0x5'));var moment=require(_0x615c('0x6'));var BPromise=require(_0x615c('0x7'));var Mustache=require(_0x615c('0x8'));var util=require(_0x615c('0x9'));var path=require('path');var sox=require(_0x615c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x615c('0xb'));var squel=require('squel');var crypto=require(_0x615c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x615c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x615c('0xe'));var authService=require(_0x615c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x615c('0x10'));var logger=require('../../config/logger')(_0x615c('0x11'));var utils=require(_0x615c('0x12'));var config=require(_0x615c('0x13'));var licenseUtil=require(_0x615c('0x14'));var db=require(_0x615c('0x15'))['db'];function respondWithStatusCode(_0x40a7fb,_0x12b4df){_0x12b4df=_0x12b4df||0xcc;return function(_0x4501f6){if(_0x4501f6){return _0x40a7fb[_0x615c('0x16')](_0x12b4df);}return _0x40a7fb[_0x615c('0x17')](_0x12b4df)[_0x615c('0x18')]();};}function respondWithResult(_0x14eea3,_0x15520b){_0x15520b=_0x15520b||0xc8;return function(_0x27e3b9){if(_0x27e3b9){return _0x14eea3[_0x615c('0x17')](_0x15520b)[_0x615c('0x19')](_0x27e3b9);}};}function respondWithFilteredResult(_0x4cbe9c,_0x149b72){return function(_0x5a2dee){if(_0x5a2dee){var _0x17b480=_0x5a2dee['count'],_0x302426=_0x149b72['offset'],_0xa68c31=_0x149b72[_0x615c('0x1a')]+_0x149b72['limit'],_0x5694d1;if(_0xa68c31>=_0x17b480){_0xa68c31=_0x17b480;_0x5694d1=0xc8;}else{_0x5694d1=0xce;}_0x4cbe9c[_0x615c('0x17')](_0x5694d1);return _0x4cbe9c['set'](_0x615c('0x1b'),_0x302426+'-'+_0xa68c31+'/'+_0x17b480)[_0x615c('0x19')](_0x5a2dee);}return null;};}function patchUpdates(_0x39f61c){return function(_0x202ad0){try{jsonpatch[_0x615c('0x1c')](_0x202ad0,_0x39f61c,!![]);}catch(_0x4f823f){return BPromise[_0x615c('0x1d')](_0x4f823f);}return _0x202ad0[_0x615c('0x1e')]();};}function saveUpdates(_0x49d0e9,_0x206032){return function(_0x4242c7){if(_0x4242c7){return _0x4242c7['update'](_0x49d0e9)['then'](function(_0x413e9b){return _0x413e9b;});}return null;};}function removeEntity(_0x79bc53,_0x43e54b){return function(_0x5fe8c2){if(_0x5fe8c2){return _0x5fe8c2[_0x615c('0x1f')]()[_0x615c('0x20')](function(){_0x79bc53['status'](0xcc)[_0x615c('0x18')]();});}};}function handleEntityNotFound(_0x5587e0,_0xa7f160){return function(_0xb6d424){if(!_0xb6d424){_0x5587e0[_0x615c('0x16')](0x194);}return _0xb6d424;};}function handleError(_0x267193,_0x3ef7ca){_0x3ef7ca=_0x3ef7ca||0x1f4;return function(_0x46267b){logger[_0x615c('0x21')](_0x46267b['stack']);if(_0x46267b[_0x615c('0x22')]){delete _0x46267b[_0x615c('0x22')];}_0x267193[_0x615c('0x17')](_0x3ef7ca)[_0x615c('0x23')](_0x46267b);};}exports[_0x615c('0x24')]=function(_0x3eb483,_0x49f6d0){var _0x1d4906={},_0x919b43={},_0x96087d={'count':0x0,'rows':[]};var _0x38b232=_[_0x615c('0x25')](db[_0x615c('0x26')]['rawAttributes'],function(_0xc1151b){return{'name':_0xc1151b['fieldName'],'type':_0xc1151b[_0x615c('0x27')]['key']};});_0x919b43[_0x615c('0x28')]=_['map'](_0x38b232,_0x615c('0x22'));_0x919b43['query']=_['keys'](_0x3eb483[_0x615c('0x29')]);_0x919b43[_0x615c('0x2a')]=_['intersection'](_0x919b43['model'],_0x919b43[_0x615c('0x29')]);_0x1d4906[_0x615c('0x2b')]=_[_0x615c('0x2c')](_0x919b43[_0x615c('0x28')],qs[_0x615c('0x2d')](_0x3eb483[_0x615c('0x29')][_0x615c('0x2d')]));_0x1d4906[_0x615c('0x2b')]=_0x1d4906['attributes'][_0x615c('0x2e')]?_0x1d4906[_0x615c('0x2b')]:_0x919b43[_0x615c('0x28')];if(!_0x3eb483[_0x615c('0x29')][_0x615c('0x2f')]('nolimit')){_0x1d4906['limit']=qs[_0x615c('0x30')](_0x3eb483[_0x615c('0x29')][_0x615c('0x30')]);_0x1d4906[_0x615c('0x1a')]=qs[_0x615c('0x1a')](_0x3eb483[_0x615c('0x29')][_0x615c('0x1a')]);}_0x1d4906[_0x615c('0x31')]=qs['sort'](_0x3eb483[_0x615c('0x29')][_0x615c('0x32')]);_0x1d4906[_0x615c('0x33')]=qs['filters'](_[_0x615c('0x34')](_0x3eb483[_0x615c('0x29')],_0x919b43['filters']),_0x38b232);if(_0x3eb483[_0x615c('0x29')][_0x615c('0x35')]){_0x1d4906[_0x615c('0x33')]=_[_0x615c('0x36')](_0x1d4906[_0x615c('0x33')],{'$or':_[_0x615c('0x25')](_0x38b232,function(_0x3c99f3){if(_0x3c99f3[_0x615c('0x27')]!=='VIRTUAL'){var _0x34623a={};_0x34623a[_0x3c99f3[_0x615c('0x22')]]={'$like':'%'+_0x3eb483[_0x615c('0x29')]['filter']+'%'};return _0x34623a;}})});}_0x1d4906=_[_0x615c('0x36')]({},_0x1d4906,_0x3eb483[_0x615c('0x37')]);var _0x478f5c={'where':_0x1d4906[_0x615c('0x33')]};return db[_0x615c('0x26')][_0x615c('0x38')](_0x478f5c)[_0x615c('0x20')](function(_0x290ff9){_0x96087d[_0x615c('0x38')]=_0x290ff9;if(_0x3eb483['query'][_0x615c('0x39')]){_0x1d4906[_0x615c('0x3a')]=[{'all':!![]}];}return db[_0x615c('0x26')][_0x615c('0x3b')](_0x1d4906);})['then'](function(_0x99f6b4){_0x96087d[_0x615c('0x3c')]=_0x99f6b4;return _0x96087d;})[_0x615c('0x20')](respondWithFilteredResult(_0x49f6d0,_0x1d4906))[_0x615c('0x3d')](handleError(_0x49f6d0,null));};exports[_0x615c('0x3e')]=function(_0x2241a9,_0x5e3c8f){var _0x426d91={'raw':!![],'where':{'id':_0x2241a9['params']['id']}},_0x49a063={};_0x49a063[_0x615c('0x28')]=_[_0x615c('0x3f')](db['JscriptyAnswerReport'][_0x615c('0x40')]);_0x49a063[_0x615c('0x29')]=_[_0x615c('0x3f')](_0x2241a9[_0x615c('0x29')]);_0x49a063[_0x615c('0x2a')]=_[_0x615c('0x2c')](_0x49a063[_0x615c('0x28')],_0x49a063['query']);_0x426d91[_0x615c('0x2b')]=_[_0x615c('0x2c')](_0x49a063[_0x615c('0x28')],qs[_0x615c('0x2d')](_0x2241a9[_0x615c('0x29')][_0x615c('0x2d')]));_0x426d91['attributes']=_0x426d91[_0x615c('0x2b')][_0x615c('0x2e')]?_0x426d91['attributes']:_0x49a063[_0x615c('0x28')];if(_0x2241a9[_0x615c('0x29')][_0x615c('0x39')]){_0x426d91[_0x615c('0x3a')]=[{'all':!![]}];}_0x426d91=_[_0x615c('0x36')]({},_0x426d91,_0x2241a9[_0x615c('0x37')]);return db['JscriptyAnswerReport'][_0x615c('0x41')](_0x426d91)[_0x615c('0x20')](handleEntityNotFound(_0x5e3c8f,null))[_0x615c('0x20')](respondWithResult(_0x5e3c8f,null))[_0x615c('0x3d')](handleError(_0x5e3c8f,null));};exports[_0x615c('0x42')]=function(_0x47ee77,_0x4e85fe){return db[_0x615c('0x26')][_0x615c('0x42')](_0x47ee77[_0x615c('0x43')],{})[_0x615c('0x20')](respondWithResult(_0x4e85fe,0xc9))[_0x615c('0x3d')](handleError(_0x4e85fe,null));};exports[_0x615c('0x44')]=function(_0x5523a8,_0x326e79){if(_0x5523a8[_0x615c('0x43')]['id']){delete _0x5523a8[_0x615c('0x43')]['id'];}return db['JscriptyAnswerReport'][_0x615c('0x41')]({'where':{'id':_0x5523a8[_0x615c('0x45')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x326e79,null))[_0x615c('0x20')](saveUpdates(_0x5523a8[_0x615c('0x43')],null))[_0x615c('0x20')](respondWithResult(_0x326e79,null))[_0x615c('0x3d')](handleError(_0x326e79,null));};exports[_0x615c('0x1f')]=function(_0x4bc115,_0x1f0f03){return db[_0x615c('0x26')][_0x615c('0x41')]({'where':{'id':_0x4bc115['params']['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x1f0f03,null))[_0x615c('0x20')](removeEntity(_0x1f0f03,null))['catch'](handleError(_0x1f0f03,null));};exports[_0x615c('0x46')]=function(_0x168fd5,_0x5e2184){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x5e2184,null))[_0x615c('0x3d')](handleError(_0x5e2184,null));}; \ No newline at end of file +var _0x3ca8=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','update','then','destroy','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','keys','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3ca8,0x11d));var _0x83ca=function(_0x479556,_0xa06931){_0x479556=_0x479556-0x0;var _0x5d6267=_0x3ca8[_0x479556];return _0x5d6267;};'use strict';var pdf=require(_0x83ca('0x0'));var emlformat=require(_0x83ca('0x1'));var rimraf=require(_0x83ca('0x2'));var zipdir=require(_0x83ca('0x3'));var jsonpatch=require(_0x83ca('0x4'));var rp=require('request-promise');var moment=require(_0x83ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x83ca('0x6'));var util=require(_0x83ca('0x7'));var path=require(_0x83ca('0x8'));var sox=require(_0x83ca('0x9'));var csv=require(_0x83ca('0xa'));var ejs=require(_0x83ca('0xb'));var fs=require('fs');var _=require(_0x83ca('0xc'));var squel=require(_0x83ca('0xd'));var crypto=require(_0x83ca('0xe'));var jsforce=require(_0x83ca('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x83ca('0xa'));var querystring=require(_0x83ca('0x10'));var Papa=require('papaparse');var Redis=require(_0x83ca('0x11'));var authService=require(_0x83ca('0x12'));var qs=require(_0x83ca('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83ca('0x14'));var logger=require(_0x83ca('0x15'))(_0x83ca('0x16'));var utils=require(_0x83ca('0x17'));var config=require(_0x83ca('0x18'));var licenseUtil=require(_0x83ca('0x19'));var db=require(_0x83ca('0x1a'))['db'];function respondWithStatusCode(_0x48e52e,_0x3ec754){_0x3ec754=_0x3ec754||0xcc;return function(_0xe95706){if(_0xe95706){return _0x48e52e[_0x83ca('0x1b')](_0x3ec754);}return _0x48e52e[_0x83ca('0x1c')](_0x3ec754)[_0x83ca('0x1d')]();};}function respondWithResult(_0x1e8c8b,_0x51b7c5){_0x51b7c5=_0x51b7c5||0xc8;return function(_0x56ab25){if(_0x56ab25){return _0x1e8c8b['status'](_0x51b7c5)[_0x83ca('0x1e')](_0x56ab25);}};}function respondWithFilteredResult(_0x527d42,_0x298299){return function(_0x45cea8){if(_0x45cea8){var _0x11c0c8=_0x45cea8[_0x83ca('0x1f')],_0x518c25=_0x298299[_0x83ca('0x20')],_0x127042=_0x298299[_0x83ca('0x20')]+_0x298299['limit'],_0xba8fe8;if(_0x127042>=_0x11c0c8){_0x127042=_0x11c0c8;_0xba8fe8=0xc8;}else{_0xba8fe8=0xce;}_0x527d42[_0x83ca('0x1c')](_0xba8fe8);return _0x527d42[_0x83ca('0x21')](_0x83ca('0x22'),_0x518c25+'-'+_0x127042+'/'+_0x11c0c8)[_0x83ca('0x1e')](_0x45cea8);}return null;};}function patchUpdates(_0x2afd78){return function(_0x4fcdae){try{jsonpatch['apply'](_0x4fcdae,_0x2afd78,!![]);}catch(_0x5523de){return BPromise['reject'](_0x5523de);}return _0x4fcdae['save']();};}function saveUpdates(_0x4eab6b,_0x1b8b54){return function(_0x406279){if(_0x406279){return _0x406279[_0x83ca('0x23')](_0x4eab6b)[_0x83ca('0x24')](function(_0x27b63d){return _0x27b63d;});}return null;};}function removeEntity(_0x36ada1,_0x194bd6){return function(_0x4e69e9){if(_0x4e69e9){return _0x4e69e9[_0x83ca('0x25')]()[_0x83ca('0x24')](function(){_0x36ada1[_0x83ca('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eed0b,_0x4a96cf){return function(_0x397cee){if(!_0x397cee){_0x5eed0b[_0x83ca('0x1b')](0x194);}return _0x397cee;};}function handleError(_0x15a2cf,_0x4a01ac){_0x4a01ac=_0x4a01ac||0x1f4;return function(_0xd7ee80){logger[_0x83ca('0x26')](_0xd7ee80['stack']);if(_0xd7ee80[_0x83ca('0x27')]){delete _0xd7ee80[_0x83ca('0x27')];}_0x15a2cf['status'](_0x4a01ac)['send'](_0xd7ee80);};}exports[_0x83ca('0x28')]=function(_0x5e0a04,_0x2beaba){var _0x24e77a={},_0x269442={},_0x5a73b9={'count':0x0,'rows':[]};var _0x23a5bf=_[_0x83ca('0x29')](db[_0x83ca('0x2a')][_0x83ca('0x2b')],function(_0x273d90){return{'name':_0x273d90[_0x83ca('0x2c')],'type':_0x273d90[_0x83ca('0x2d')][_0x83ca('0x2e')]};});_0x269442[_0x83ca('0x2f')]=_['map'](_0x23a5bf,_0x83ca('0x27'));_0x269442[_0x83ca('0x30')]=_['keys'](_0x5e0a04[_0x83ca('0x30')]);_0x269442[_0x83ca('0x31')]=_[_0x83ca('0x32')](_0x269442[_0x83ca('0x2f')],_0x269442['query']);_0x24e77a[_0x83ca('0x33')]=_[_0x83ca('0x32')](_0x269442['model'],qs[_0x83ca('0x34')](_0x5e0a04['query'][_0x83ca('0x34')]));_0x24e77a[_0x83ca('0x33')]=_0x24e77a['attributes']['length']?_0x24e77a[_0x83ca('0x33')]:_0x269442[_0x83ca('0x2f')];if(!_0x5e0a04['query']['hasOwnProperty'](_0x83ca('0x35'))){_0x24e77a['limit']=qs[_0x83ca('0x36')](_0x5e0a04['query'][_0x83ca('0x36')]);_0x24e77a[_0x83ca('0x20')]=qs[_0x83ca('0x20')](_0x5e0a04[_0x83ca('0x30')]['offset']);}_0x24e77a['order']=qs[_0x83ca('0x37')](_0x5e0a04[_0x83ca('0x30')][_0x83ca('0x37')]);_0x24e77a[_0x83ca('0x38')]=qs[_0x83ca('0x31')](_[_0x83ca('0x39')](_0x5e0a04[_0x83ca('0x30')],_0x269442[_0x83ca('0x31')]),_0x23a5bf);if(_0x5e0a04[_0x83ca('0x30')][_0x83ca('0x3a')]){_0x24e77a['where']=_['merge'](_0x24e77a[_0x83ca('0x38')],{'$or':_[_0x83ca('0x29')](_0x23a5bf,function(_0x1dde1e){if(_0x1dde1e[_0x83ca('0x2d')]!=='VIRTUAL'){var _0x49c7ce={};_0x49c7ce[_0x1dde1e['name']]={'$like':'%'+_0x5e0a04[_0x83ca('0x30')][_0x83ca('0x3a')]+'%'};return _0x49c7ce;}})});}_0x24e77a=_[_0x83ca('0x3b')]({},_0x24e77a,_0x5e0a04[_0x83ca('0x3c')]);var _0x4e3a06={'where':_0x24e77a[_0x83ca('0x38')]};return db['JscriptyAnswerReport'][_0x83ca('0x1f')](_0x4e3a06)[_0x83ca('0x24')](function(_0x4126db){_0x5a73b9[_0x83ca('0x1f')]=_0x4126db;if(_0x5e0a04[_0x83ca('0x30')][_0x83ca('0x3d')]){_0x24e77a['include']=[{'all':!![]}];}return db[_0x83ca('0x2a')][_0x83ca('0x3e')](_0x24e77a);})['then'](function(_0x127c46){_0x5a73b9[_0x83ca('0x3f')]=_0x127c46;return _0x5a73b9;})[_0x83ca('0x24')](respondWithFilteredResult(_0x2beaba,_0x24e77a))[_0x83ca('0x40')](handleError(_0x2beaba,null));};exports['show']=function(_0x4b91cf,_0x3eecf7){var _0x54f89c={'raw':!![],'where':{'id':_0x4b91cf['params']['id']}},_0x203cea={};_0x203cea[_0x83ca('0x2f')]=_['keys'](db[_0x83ca('0x2a')][_0x83ca('0x2b')]);_0x203cea[_0x83ca('0x30')]=_[_0x83ca('0x41')](_0x4b91cf[_0x83ca('0x30')]);_0x203cea[_0x83ca('0x31')]=_[_0x83ca('0x32')](_0x203cea[_0x83ca('0x2f')],_0x203cea[_0x83ca('0x30')]);_0x54f89c[_0x83ca('0x33')]=_[_0x83ca('0x32')](_0x203cea[_0x83ca('0x2f')],qs[_0x83ca('0x34')](_0x4b91cf[_0x83ca('0x30')][_0x83ca('0x34')]));_0x54f89c[_0x83ca('0x33')]=_0x54f89c[_0x83ca('0x33')][_0x83ca('0x42')]?_0x54f89c[_0x83ca('0x33')]:_0x203cea['model'];if(_0x4b91cf[_0x83ca('0x30')]['includeAll']){_0x54f89c[_0x83ca('0x43')]=[{'all':!![]}];}_0x54f89c=_[_0x83ca('0x3b')]({},_0x54f89c,_0x4b91cf['options']);return db[_0x83ca('0x2a')][_0x83ca('0x44')](_0x54f89c)['then'](handleEntityNotFound(_0x3eecf7,null))[_0x83ca('0x24')](respondWithResult(_0x3eecf7,null))[_0x83ca('0x40')](handleError(_0x3eecf7,null));};exports[_0x83ca('0x45')]=function(_0x5228d9,_0x74dfe3){return db[_0x83ca('0x2a')][_0x83ca('0x45')](_0x5228d9[_0x83ca('0x46')],{})[_0x83ca('0x24')](respondWithResult(_0x74dfe3,0xc9))[_0x83ca('0x40')](handleError(_0x74dfe3,null));};exports[_0x83ca('0x23')]=function(_0x2cbe69,_0x23a9d0){if(_0x2cbe69[_0x83ca('0x46')]['id']){delete _0x2cbe69['body']['id'];}return db[_0x83ca('0x2a')]['find']({'where':{'id':_0x2cbe69['params']['id']}})['then'](handleEntityNotFound(_0x23a9d0,null))['then'](saveUpdates(_0x2cbe69[_0x83ca('0x46')],null))[_0x83ca('0x24')](respondWithResult(_0x23a9d0,null))[_0x83ca('0x40')](handleError(_0x23a9d0,null));};exports[_0x83ca('0x25')]=function(_0x270d36,_0x4bc6b2){return db[_0x83ca('0x2a')][_0x83ca('0x44')]({'where':{'id':_0x270d36[_0x83ca('0x47')]['id']}})[_0x83ca('0x24')](handleEntityNotFound(_0x4bc6b2,null))[_0x83ca('0x24')](removeEntity(_0x4bc6b2,null))['catch'](handleError(_0x4bc6b2,null));};exports['describe']=function(_0x6904da,_0x5b9858){return db[_0x83ca('0x2a')][_0x83ca('0x48')]()[_0x83ca('0x24')](respondWithResult(_0x5b9858,null))[_0x83ca('0x40')](handleError(_0x5b9858,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fa68006..1f4604d 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 _0x1ab3=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x3a5e46,_0x4e3a77){var _0x2bbf34=function(_0x4e4d38){while(--_0x4e4d38){_0x3a5e46['push'](_0x3a5e46['shift']());}};_0x2bbf34(++_0x4e3a77);}(_0x1ab3,0x147));var _0x31ab=function(_0x27a591,_0x5258c4){_0x27a591=_0x27a591-0x0;var _0x20f1c6=_0x1ab3[_0x27a591];return _0x20f1c6;};'use strict';var _=require(_0x31ab('0x0'));var util=require(_0x31ab('0x1'));var logger=require(_0x31ab('0x2'))(_0x31ab('0x3'));var moment=require('moment');var BPromise=require(_0x31ab('0x4'));var rp=require(_0x31ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31ab('0x6'));var config=require(_0x31ab('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x31ab('0x8')]=function(_0xc5bc9b,_0x51fb90){return _0xc5bc9b[_0x31ab('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0x31ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fe2=['exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x484a36,_0x154467){var _0x3cf65e=function(_0x57695f){while(--_0x57695f){_0x484a36['push'](_0x484a36['shift']());}};_0x3cf65e(++_0x154467);}(_0x4fe2,0x179));var _0x24fe=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4fe2[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x24fe('0x0'));var util=require(_0x24fe('0x1'));var logger=require('../../config/logger')(_0x24fe('0x2'));var moment=require(_0x24fe('0x3'));var BPromise=require(_0x24fe('0x4'));var rp=require(_0x24fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x24fe('0x6'));var config=require(_0x24fe('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x24fe('0x8')]=function(_0xf2d0b5,_0x176bd4){return _0xf2d0b5['define'](_0x24fe('0x9'),attributes,{'tableName':_0x24fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index d4e7a56..8362f64 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 _0xb19d=['stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x29d38c,_0x434e6c){var _0x1c585b=function(_0x20e264){while(--_0x20e264){_0x29d38c['push'](_0x29d38c['shift']());}};_0x1c585b(++_0x434e6c);}(_0xb19d,0x18d));var _0xdb19=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0xb19d[_0x2d982d];return _0x4f36b0;};'use strict';var _=require(_0xdb19('0x0'));var util=require(_0xdb19('0x1'));var moment=require('moment');var BPromise=require(_0xdb19('0x2'));var rs=require(_0xdb19('0x3'));var fs=require('fs');var Redis=require(_0xdb19('0x4'));var db=require(_0xdb19('0x5'))['db'];var utils=require(_0xdb19('0x6'));var logger=require(_0xdb19('0x7'))(_0xdb19('0x8'));var config=require(_0xdb19('0x9'));var jayson=require(_0xdb19('0xa'));var client=jayson['client'][_0xdb19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a987c,_0x437e58,_0x3e48d6){return new BPromise(function(_0xbbf44e,_0x46b31b){return client['request'](_0x4a987c,_0x3e48d6)[_0xdb19('0xc')](function(_0x45f60a){logger['info'](_0xdb19('0xd'),_0x437e58,_0xdb19('0xe'));logger[_0xdb19('0xf')](_0xdb19('0x10'),_0x437e58,'request\x20sent',JSON[_0xdb19('0x11')](_0x45f60a));if(_0x45f60a[_0xdb19('0x12')]){if(_0x45f60a[_0xdb19('0x12')]['code']===0x1f4){logger[_0xdb19('0x12')](_0xdb19('0xd'),_0x437e58,_0x45f60a['error'][_0xdb19('0x13')]);return _0x46b31b(_0x45f60a[_0xdb19('0x12')][_0xdb19('0x13')]);}logger[_0xdb19('0x12')](_0xdb19('0xd'),_0x437e58,_0x45f60a['error']['message']);return _0xbbf44e(_0x45f60a['error']['message']);}else{logger[_0xdb19('0x14')](_0xdb19('0xd'),_0x437e58,'request\x20sent');_0xbbf44e(_0x45f60a[_0xdb19('0x15')][_0xdb19('0x13')]);}})[_0xdb19('0x16')](function(_0x38e0ec){logger[_0xdb19('0x12')](_0xdb19('0xd'),_0x437e58,_0x38e0ec);_0x46b31b(_0x38e0ec);});});} \ No newline at end of file +var _0x6ab7=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x39578c,_0x23635b){var _0x15ee51=function(_0x1fb117){while(--_0x1fb117){_0x39578c['push'](_0x39578c['shift']());}};_0x15ee51(++_0x23635b);}(_0x6ab7,0x147));var _0x76ab=function(_0x2a075b,_0x1a121c){_0x2a075b=_0x2a075b-0x0;var _0x20bd00=_0x6ab7[_0x2a075b];return _0x20bd00;};'use strict';var _=require(_0x76ab('0x0'));var util=require(_0x76ab('0x1'));var moment=require('moment');var BPromise=require(_0x76ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76ab('0x3'));var db=require(_0x76ab('0x4'))['db'];var utils=require(_0x76ab('0x5'));var logger=require('../../config/logger')(_0x76ab('0x6'));var config=require(_0x76ab('0x7'));var jayson=require(_0x76ab('0x8'));var client=jayson[_0x76ab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b2577,_0x5deb09,_0x20621){return new BPromise(function(_0x5d9692,_0x13b927){return client['request'](_0x3b2577,_0x20621)[_0x76ab('0xa')](function(_0x4c5ea1){logger[_0x76ab('0xb')](_0x76ab('0xc'),_0x5deb09,_0x76ab('0xd'));logger[_0x76ab('0xe')](_0x76ab('0xf'),_0x5deb09,_0x76ab('0xd'),JSON['stringify'](_0x4c5ea1));if(_0x4c5ea1[_0x76ab('0x10')]){if(_0x4c5ea1['error']['code']===0x1f4){logger[_0x76ab('0x10')](_0x76ab('0xc'),_0x5deb09,_0x4c5ea1[_0x76ab('0x10')][_0x76ab('0x11')]);return _0x13b927(_0x4c5ea1[_0x76ab('0x10')][_0x76ab('0x11')]);}logger[_0x76ab('0x10')](_0x76ab('0xc'),_0x5deb09,_0x4c5ea1[_0x76ab('0x10')]['message']);return _0x5d9692(_0x4c5ea1[_0x76ab('0x10')][_0x76ab('0x11')]);}else{logger[_0x76ab('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5deb09,'request\x20sent');_0x5d9692(_0x4c5ea1['result']['message']);}})[_0x76ab('0x12')](function(_0x166e0f){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5deb09,_0x166e0f);_0x13b927(_0x166e0f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 2c288c8..8847820 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 _0x0355=['Router','../../components/interaction/service','isAuthenticated','show','get','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4f47ac,_0x5b7fad){var _0x4edbce=function(_0x1d20d7){while(--_0x1d20d7){_0x4f47ac['push'](_0x4f47ac['shift']());}};_0x4edbce(++_0x5b7fad);}(_0x0355,0xca));var _0x5035=function(_0x196320,_0x3f9ac2){_0x196320=_0x196320-0x0;var _0xa975ad=_0x0355[_0x196320];return _0xa975ad;};'use strict';var multer=require(_0x5035('0x0'));var util=require(_0x5035('0x1'));var path=require(_0x5035('0x2'));var timeout=require(_0x5035('0x3'));var express=require(_0x5035('0x4'));var router=express[_0x5035('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5035('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x5035('0x7')](),controller['index']);router['get']('/:id',auth[_0x5035('0x7')](),controller[_0x5035('0x8')]);router[_0x5035('0x9')]('/:id/sessions',auth[_0x5035('0x7')](),controller[_0x5035('0xa')]);router['get'](_0x5035('0xb'),auth[_0x5035('0x7')](),controller[_0x5035('0xc')]);router[_0x5035('0x9')](_0x5035('0xd'),auth[_0x5035('0x7')](),timeout(_0x5035('0xe')),controller['getSummary']);router[_0x5035('0xf')]('/',auth[_0x5035('0x7')](),controller[_0x5035('0x10')]);router[_0x5035('0xf')](_0x5035('0x11'),auth[_0x5035('0x7')](),controller[_0x5035('0x12')]);router[_0x5035('0x13')]('/:id',auth[_0x5035('0x7')](),controller['update']);router['delete'](_0x5035('0x14'),auth[_0x5035('0x7')](),controller[_0x5035('0x15')]);module[_0x5035('0x16')]=router; \ No newline at end of file +var _0x9366=['post','create','clone','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','isAuthenticated','show','/:id/sessions','getAnswers','/:id/summary','getSummary'];(function(_0x398645,_0xe9487e){var _0x54e5a2=function(_0x20c170){while(--_0x20c170){_0x398645['push'](_0x398645['shift']());}};_0x54e5a2(++_0xe9487e);}(_0x9366,0xf8));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6936('0x0'));var util=require(_0x6936('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6936('0x2'));var router=express[_0x6936('0x3')]();var auth=require(_0x6936('0x4'));var interaction=require(_0x6936('0x5'));var config=require(_0x6936('0x6'));var controller=require(_0x6936('0x7'));router[_0x6936('0x8')]('/',auth['isAuthenticated'](),controller[_0x6936('0x9')]);router[_0x6936('0x8')]('/:id',auth[_0x6936('0xa')](),controller[_0x6936('0xb')]);router[_0x6936('0x8')](_0x6936('0xc'),auth['isAuthenticated'](),controller['getSessions']);router[_0x6936('0x8')]('/:id/answers',auth['isAuthenticated'](),controller[_0x6936('0xd')]);router[_0x6936('0x8')](_0x6936('0xe'),auth[_0x6936('0xa')](),timeout('30s'),controller[_0x6936('0xf')]);router[_0x6936('0x10')]('/',auth[_0x6936('0xa')](),controller[_0x6936('0x11')]);router[_0x6936('0x10')]('/:id/clone',auth[_0x6936('0xa')](),controller[_0x6936('0x12')]);router['put'](_0x6936('0x13'),auth[_0x6936('0xa')](),controller[_0x6936('0x14')]);router[_0x6936('0x15')](_0x6936('0x13'),auth['isAuthenticated'](),controller[_0x6936('0x16')]);module[_0x6936('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1fc1a94..399a85c 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 _0x588d=['util','exports','STRING','name','TEXT','long','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x3b3a6c,_0x1ff238){var _0x57ae86=function(_0x66a502){while(--_0x66a502){_0x3b3a6c['push'](_0x3b3a6c['shift']());}};_0x57ae86(++_0x1ff238);}(_0x588d,0xca));var _0xd588=function(_0x228b0d,_0x21723b){_0x228b0d=_0x228b0d-0x0;var _0x1dd11c=_0x588d[_0x228b0d];return _0x1dd11c;};'use strict';var Sequelize=require(_0xd588('0x0'));var _=require(_0xd588('0x1'));var util=require(_0xd588('0x2'));module[_0xd588('0x3')]={'name':{'type':Sequelize[_0xd588('0x4')],'unique':_0xd588('0x5')},'description':{'type':Sequelize[_0xd588('0x4')]},'formData':{'type':Sequelize[_0xd588('0x6')](_0xd588('0x7')),'set':function(_0x400042){if(_['isObjectLike'](_0x400042)){this[_0xd588('0x8')]('formData',JSON[_0xd588('0x9')](_0x400042));}else if(_[_0xd588('0xa')](_0x400042)){this[_0xd588('0x8')](_0xd588('0xb'),_0x400042);}else{this[_0xd588('0x8')](_0xd588('0xb'),util[_0xd588('0xc')](_0xd588('0xd'),this[_0xd588('0xe')](_0xd588('0x5'))||'',this['getDataValue'](_0xd588('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd588('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd588('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x8b35=['stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x138f7f,_0x466edd){var _0x69eec8=function(_0xb7d810){while(--_0xb7d810){_0x138f7f['push'](_0x138f7f['shift']());}};_0x69eec8(++_0x466edd);}(_0x8b35,0xaa));var _0x58b3=function(_0x55b470,_0x2d055c){_0x55b470=_0x55b470-0x0;var _0x511bd5=_0x8b35[_0x55b470];return _0x511bd5;};'use strict';var Sequelize=require(_0x58b3('0x0'));var _=require(_0x58b3('0x1'));var util=require(_0x58b3('0x2'));module[_0x58b3('0x3')]={'name':{'type':Sequelize[_0x58b3('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x58b3('0x4')]},'formData':{'type':Sequelize[_0x58b3('0x5')](_0x58b3('0x6')),'set':function(_0x4c93cf){if(_[_0x58b3('0x7')](_0x4c93cf)){this[_0x58b3('0x8')](_0x58b3('0x9'),JSON[_0x58b3('0xa')](_0x4c93cf));}else if(_[_0x58b3('0xb')](_0x4c93cf)){this[_0x58b3('0x8')](_0x58b3('0x9'),_0x4c93cf);}else{this[_0x58b3('0x8')](_0x58b3('0x9'),util[_0x58b3('0xc')](_0x58b3('0xd'),this[_0x58b3('0xe')](_0x58b3('0xf'))||'',this[_0x58b3('0xe')](_0x58b3('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x58b3('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x58b3('0x11')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f0dd95d..f7b7d06 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 _0xdcec=['question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','UserProfileResource','error','name','index','JscriptyProject','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','clone','get','omit','updatedAt','role','Projects','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','ProjectId','nolimit','JscriptyAnswerReport','number','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId'];(function(_0x313125,_0x5126c5){var _0x586825=function(_0x383685){while(--_0x383685){_0x313125['push'](_0x313125['shift']());}};_0x586825(++_0x5126c5);}(_0xdcec,0x87));var _0xcdce=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xdcec[_0x2f4c1c];return _0x25e0f2;};'use strict';var pdf=require(_0xcdce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcdce('0x1'));var zipdir=require(_0xcdce('0x2'));var jsonpatch=require(_0xcdce('0x3'));var rp=require(_0xcdce('0x4'));var moment=require(_0xcdce('0x5'));var BPromise=require(_0xcdce('0x6'));var Mustache=require(_0xcdce('0x7'));var util=require(_0xcdce('0x8'));var path=require(_0xcdce('0x9'));var sox=require(_0xcdce('0xa'));var csv=require('to-csv');var ejs=require(_0xcdce('0xb'));var fs=require('fs');var _=require(_0xcdce('0xc'));var squel=require('squel');var crypto=require(_0xcdce('0xd'));var jsforce=require(_0xcdce('0xe'));var deskjs=require(_0xcdce('0xf'));var toCsv=require(_0xcdce('0x10'));var querystring=require(_0xcdce('0x11'));var Papa=require('papaparse');var Redis=require(_0xcdce('0x12'));var authService=require(_0xcdce('0x13'));var qs=require(_0xcdce('0x14'));var as=require(_0xcdce('0x15'));var hardwareService=require(_0xcdce('0x16'));var logger=require(_0xcdce('0x17'))(_0xcdce('0x18'));var utils=require(_0xcdce('0x19'));var config=require(_0xcdce('0x1a'));var licenseUtil=require(_0xcdce('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559ee7,_0xda6e42){_0xda6e42=_0xda6e42||0xcc;return function(_0x18adb1){if(_0x18adb1){return _0x559ee7[_0xcdce('0x1c')](_0xda6e42);}return _0x559ee7[_0xcdce('0x1d')](_0xda6e42)['end']();};}function respondWithResult(_0x20f68b,_0x2c5cbf){_0x2c5cbf=_0x2c5cbf||0xc8;return function(_0x590cd0){if(_0x590cd0){return _0x20f68b[_0xcdce('0x1d')](_0x2c5cbf)['json'](_0x590cd0);}};}function respondWithFilteredResult(_0x4f0dd6,_0x52504c){return function(_0x39bfb9){if(_0x39bfb9){var _0x28faf5=_0x39bfb9[_0xcdce('0x1e')],_0x13f5de=_0x52504c[_0xcdce('0x1f')],_0x1e9a88=_0x52504c[_0xcdce('0x1f')]+_0x52504c[_0xcdce('0x20')],_0x3888b9;if(_0x1e9a88>=_0x28faf5){_0x1e9a88=_0x28faf5;_0x3888b9=0xc8;}else{_0x3888b9=0xce;}_0x4f0dd6[_0xcdce('0x1d')](_0x3888b9);return _0x4f0dd6[_0xcdce('0x21')](_0xcdce('0x22'),_0x13f5de+'-'+_0x1e9a88+'/'+_0x28faf5)[_0xcdce('0x23')](_0x39bfb9);}return null;};}function patchUpdates(_0x5f59bc){return function(_0x58e373){try{jsonpatch['apply'](_0x58e373,_0x5f59bc,!![]);}catch(_0x439458){return BPromise[_0xcdce('0x24')](_0x439458);}return _0x58e373[_0xcdce('0x25')]();};}function saveUpdates(_0x5f4377,_0x4d095f){return function(_0x1775ef){if(_0x1775ef){return _0x1775ef['update'](_0x5f4377)[_0xcdce('0x26')](function(_0x57753e){return _0x57753e;});}return null;};}function removeEntity(_0x3c5af8,_0x39e2bd){return function(_0xa75014){if(_0xa75014){return _0xa75014[_0xcdce('0x27')]()[_0xcdce('0x26')](function(){var _0x38842d=_0xa75014['get']({'plain':!![]});var _0x2a6103='Projects';return db[_0xcdce('0x28')][_0xcdce('0x27')]({'where':{'type':_0x2a6103,'resourceId':_0x38842d['id']}})[_0xcdce('0x26')](function(){return _0xa75014;});})[_0xcdce('0x26')](function(){_0x3c5af8[_0xcdce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cdcf0,_0x29b490){return function(_0x7d003f){if(!_0x7d003f){_0x4cdcf0['sendStatus'](0x194);}return _0x7d003f;};}function handleError(_0x5b2220,_0x31f14d){_0x31f14d=_0x31f14d||0x1f4;return function(_0x3b4f99){logger[_0xcdce('0x29')](_0x3b4f99['stack']);if(_0x3b4f99[_0xcdce('0x2a')]){delete _0x3b4f99[_0xcdce('0x2a')];}_0x5b2220[_0xcdce('0x1d')](_0x31f14d)['send'](_0x3b4f99);};}exports[_0xcdce('0x2b')]=function(_0x291dff,_0x2db6d3){var _0x126642={},_0x329172={},_0x5d7589={'count':0x0,'rows':[]};var _0x29c7d3=_['map'](db[_0xcdce('0x2c')][_0xcdce('0x2d')],function(_0x3a1375){return{'name':_0x3a1375[_0xcdce('0x2e')],'type':_0x3a1375['type'][_0xcdce('0x2f')]};});_0x329172[_0xcdce('0x30')]=_[_0xcdce('0x31')](_0x29c7d3,_0xcdce('0x2a'));_0x329172['query']=_[_0xcdce('0x32')](_0x291dff[_0xcdce('0x33')]);_0x329172[_0xcdce('0x34')]=_[_0xcdce('0x35')](_0x329172[_0xcdce('0x30')],_0x329172[_0xcdce('0x33')]);_0x126642[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x329172[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x291dff[_0xcdce('0x33')][_0xcdce('0x37')]));_0x126642[_0xcdce('0x36')]=_0x126642[_0xcdce('0x36')]['length']?_0x126642[_0xcdce('0x36')]:_0x329172['model'];if(!_0x291dff[_0xcdce('0x33')][_0xcdce('0x38')]('nolimit')){_0x126642[_0xcdce('0x20')]=qs[_0xcdce('0x20')](_0x291dff[_0xcdce('0x33')][_0xcdce('0x20')]);_0x126642[_0xcdce('0x1f')]=qs[_0xcdce('0x1f')](_0x291dff[_0xcdce('0x33')]['offset']);}_0x126642[_0xcdce('0x39')]=qs['sort'](_0x291dff[_0xcdce('0x33')][_0xcdce('0x3a')]);_0x126642[_0xcdce('0x3b')]=qs['filters'](_[_0xcdce('0x3c')](_0x291dff[_0xcdce('0x33')],_0x329172[_0xcdce('0x34')]),_0x29c7d3);if(_0x291dff['query'][_0xcdce('0x3d')]){_0x126642['where']=_['merge'](_0x126642[_0xcdce('0x3b')],{'$or':_[_0xcdce('0x31')](_0x29c7d3,function(_0x52c49c){if(_0x52c49c[_0xcdce('0x3e')]!==_0xcdce('0x3f')){var _0x165cdb={};_0x165cdb[_0x52c49c[_0xcdce('0x2a')]]={'$like':'%'+_0x291dff['query'][_0xcdce('0x3d')]+'%'};return _0x165cdb;}})});}_0x126642=_[_0xcdce('0x40')]({},_0x126642,_0x291dff[_0xcdce('0x41')]);var _0x48b72c={'where':_0x126642[_0xcdce('0x3b')]};return db[_0xcdce('0x2c')][_0xcdce('0x1e')](_0x48b72c)[_0xcdce('0x26')](function(_0x45068a){_0x5d7589[_0xcdce('0x1e')]=_0x45068a;if(_0x291dff[_0xcdce('0x33')]['includeAll']){_0x126642[_0xcdce('0x42')]=[{'all':!![]}];}return db[_0xcdce('0x2c')][_0xcdce('0x43')](_0x126642);})['then'](function(_0x36e4f1){_0x5d7589[_0xcdce('0x44')]=_0x36e4f1;return _0x5d7589;})[_0xcdce('0x26')](respondWithFilteredResult(_0x2db6d3,_0x126642))[_0xcdce('0x45')](handleError(_0x2db6d3,null));};exports[_0xcdce('0x46')]=function(_0x59b618,_0x3bbd09){var _0x421aee={'raw':![],'where':{'id':_0x59b618[_0xcdce('0x47')]['id']}},_0x3f20bb={};_0x3f20bb['model']=_[_0xcdce('0x32')](db[_0xcdce('0x2c')][_0xcdce('0x2d')]);_0x3f20bb[_0xcdce('0x33')]=_[_0xcdce('0x32')](_0x59b618[_0xcdce('0x33')]);_0x3f20bb['filters']=_['intersection'](_0x3f20bb[_0xcdce('0x30')],_0x3f20bb['query']);_0x421aee[_0xcdce('0x36')]=_['intersection'](_0x3f20bb[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x59b618[_0xcdce('0x33')][_0xcdce('0x37')]));_0x421aee[_0xcdce('0x36')]=_0x421aee[_0xcdce('0x36')][_0xcdce('0x48')]?_0x421aee[_0xcdce('0x36')]:_0x3f20bb[_0xcdce('0x30')];if(_0x59b618['query'][_0xcdce('0x49')]){_0x421aee[_0xcdce('0x42')]=[{'all':!![]}];}_0x421aee=_[_0xcdce('0x40')]({},_0x421aee,_0x59b618[_0xcdce('0x41')]);return db[_0xcdce('0x2c')][_0xcdce('0x4a')](_0x421aee)[_0xcdce('0x26')](handleEntityNotFound(_0x3bbd09,null))[_0xcdce('0x26')](respondWithResult(_0x3bbd09,null))['catch'](handleError(_0x3bbd09,null));};exports[_0xcdce('0x4b')]=function(_0x3d07dc,_0x3a418e){return db[_0xcdce('0x2c')][_0xcdce('0x4b')](_0x3d07dc[_0xcdce('0x4c')],{})[_0xcdce('0x26')](function(_0x2574ea){var _0x56550f=_0x3d07dc[_0xcdce('0x4d')]['get']({'plain':!![]});if(!_0x56550f)throw new Error(_0xcdce('0x4e'));if(_0x56550f['role']===_0xcdce('0x4d')){var _0x18e6c8=_0x2574ea['get']({'plain':!![]});var _0x539308='Projects';return db[_0xcdce('0x4f')]['find']({'where':{'name':_0x539308,'userProfileId':_0x56550f[_0xcdce('0x50')]},'raw':!![]})['then'](function(_0x226377){if(_0x226377&&_0x226377['autoAssociation']===0x0){return db[_0xcdce('0x28')][_0xcdce('0x4b')]({'name':_0x18e6c8[_0xcdce('0x2a')],'resourceId':_0x18e6c8['id'],'type':_0x226377[_0xcdce('0x2a')],'sectionId':_0x226377['id']},{})[_0xcdce('0x26')](function(){return _0x2574ea;});}else{return _0x2574ea;}})['catch'](function(_0x5ca243){logger[_0xcdce('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ca243);throw _0x5ca243;});}return _0x2574ea;})[_0xcdce('0x26')](respondWithResult(_0x3a418e,0xc9))[_0xcdce('0x45')](handleError(_0x3a418e,null));};exports[_0xcdce('0x51')]=function(_0x36cda8,_0x3f630e){var _0x5e2bf4={'where':{'id':_0x36cda8[_0xcdce('0x47')]['id']}},_0x3a5924={};_0x3a5924['model']=_[_0xcdce('0x32')](db[_0xcdce('0x2c')][_0xcdce('0x2d')]);_0x5e2bf4[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x3a5924[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x36cda8[_0xcdce('0x33')]['fields']));_0x5e2bf4[_0xcdce('0x36')]=_0x5e2bf4[_0xcdce('0x36')][_0xcdce('0x48')]?_0x5e2bf4[_0xcdce('0x36')]:_0x3a5924['model'];if(_0x36cda8[_0xcdce('0x33')][_0xcdce('0x49')]){_0x5e2bf4['include']=[{'all':!![]}];}_0x5e2bf4=_[_0xcdce('0x40')]({},_0x5e2bf4,_0x36cda8[_0xcdce('0x41')]);return db[_0xcdce('0x2c')][_0xcdce('0x4a')](_0x5e2bf4)[_0xcdce('0x26')](handleEntityNotFound(_0x3f630e,null))['then'](function(_0x2cf89a){if(_0x2cf89a){var _0x2a9a78=_0x2cf89a[_0xcdce('0x52')]({'plain':!![]});_0x2a9a78=qs[_0xcdce('0x53')](_0x2a9a78,['id','createdAt','updatedAt']);_0x36cda8[_0xcdce('0x4c')]=_[_0xcdce('0x53')](_0x36cda8[_0xcdce('0x4c')],['id','createdAt',_0xcdce('0x54')]);return db['JscriptyProject'][_0xcdce('0x4b')](_[_0xcdce('0x40')](_0x2a9a78,_0x36cda8[_0xcdce('0x4c')]),{'include':_0x36cda8[_0xcdce('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xcdce('0x26')](function(_0x241f33){var _0x3f8932=_0x36cda8[_0xcdce('0x4d')][_0xcdce('0x52')]({'plain':!![]});if(!_0x3f8932)throw new Error(_0xcdce('0x4e'));if(_0x3f8932[_0xcdce('0x55')]===_0xcdce('0x4d')){var _0x6fd841=_0x241f33[_0xcdce('0x52')]({'plain':!![]});var _0x262dfa=_0xcdce('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x262dfa,'userProfileId':_0x3f8932[_0xcdce('0x50')]},'raw':!![]})[_0xcdce('0x26')](function(_0x13ff48){if(_0x13ff48&&_0x13ff48[_0xcdce('0x57')]===0x0){return db[_0xcdce('0x28')]['create']({'name':_0x6fd841[_0xcdce('0x2a')],'resourceId':_0x6fd841['id'],'type':_0x13ff48[_0xcdce('0x2a')],'sectionId':_0x13ff48['id']},{})[_0xcdce('0x26')](function(){return _0x241f33;});}else{return _0x241f33;}})['catch'](function(_0x454ed2){logger[_0xcdce('0x29')](_0xcdce('0x58'),_0x454ed2);throw _0x454ed2;});}return _0x241f33;});}})['then'](respondWithResult(_0x3f630e,0xc9))[_0xcdce('0x45')](handleError(_0x3f630e,null));};exports[_0xcdce('0x59')]=function(_0x26c8c7,_0x24bbd8){if(_0x26c8c7['body']['id']){delete _0x26c8c7['body']['id'];}return db[_0xcdce('0x2c')][_0xcdce('0x4a')]({'where':{'id':_0x26c8c7[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x24bbd8,null))[_0xcdce('0x26')](saveUpdates(_0x26c8c7['body'],null))[_0xcdce('0x26')](respondWithResult(_0x24bbd8,null))[_0xcdce('0x45')](handleError(_0x24bbd8,null));};exports[_0xcdce('0x27')]=function(_0x52eda2,_0x55535a){return db['JscriptyProject']['find']({'where':{'id':_0x52eda2[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x55535a,null))['then'](removeEntity(_0x55535a,null))[_0xcdce('0x45')](handleError(_0x55535a,null));};exports[_0xcdce('0x5a')]=function(_0x22442a,_0x3ec7af,_0x2e9c46){var _0x26e086={'raw':!![],'where':{}};var _0x117e60={};var _0x3e6fdc={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xcdce('0x5b')]({'where':{'id':_0x22442a[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x3ec7af,null))[_0xcdce('0x26')](function(_0x238fb2){if(_0x238fb2){_0x117e60[_0xcdce('0x30')]=_[_0xcdce('0x32')](db[_0xcdce('0x5c')][_0xcdce('0x2d')]);_0x117e60[_0xcdce('0x33')]=_[_0xcdce('0x32')](_0x22442a[_0xcdce('0x33')]);_0x117e60['filters']=_['intersection'](_0x117e60[_0xcdce('0x30')],_0x117e60['query']);_0x26e086[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x117e60[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x22442a[_0xcdce('0x33')][_0xcdce('0x37')]));_0x26e086[_0xcdce('0x36')]=_0x26e086[_0xcdce('0x36')][_0xcdce('0x48')]?_0x26e086['attributes']:_0x117e60[_0xcdce('0x30')];if(!_0x22442a[_0xcdce('0x33')][_0xcdce('0x38')]('nolimit')){_0x26e086[_0xcdce('0x20')]=qs[_0xcdce('0x20')](_0x22442a[_0xcdce('0x33')]['limit']);_0x26e086[_0xcdce('0x1f')]=qs[_0xcdce('0x1f')](_0x22442a['query'][_0xcdce('0x1f')]);}_0x26e086[_0xcdce('0x39')]=qs[_0xcdce('0x3a')](_0x22442a[_0xcdce('0x33')][_0xcdce('0x3a')]);_0x26e086[_0xcdce('0x3b')]=qs['filters'](_[_0xcdce('0x3c')](_0x22442a[_0xcdce('0x33')],_0x117e60[_0xcdce('0x34')]));_0x26e086[_0xcdce('0x3b')][_0xcdce('0x5d')]=_0x238fb2['id'];if(_0x22442a['query'][_0xcdce('0x3d')]){_0x26e086[_0xcdce('0x3b')]=_[_0xcdce('0x40')](_0x26e086['where'],{'$or':_[_0xcdce('0x31')](_0x26e086[_0xcdce('0x36')],function(_0x1fb64d){var _0x3f5c72={};_0x3f5c72[_0x1fb64d]={'$like':'%'+_0x22442a[_0xcdce('0x33')][_0xcdce('0x3d')]+'%'};return _0x3f5c72;})});}_0x26e086=_['merge']({},_0x26e086,_0x22442a[_0xcdce('0x41')]);return db[_0xcdce('0x5c')]['count']({'where':_0x26e086[_0xcdce('0x3b')]})[_0xcdce('0x26')](function(_0x566f8b){_0x3e6fdc[_0xcdce('0x1e')]=_0x566f8b;if(_0x22442a[_0xcdce('0x33')]['includeAll']){_0x26e086['include']=[{'all':!![]}];}return db[_0xcdce('0x5c')][_0xcdce('0x43')](_0x26e086);})[_0xcdce('0x26')](function(_0x3a1484){_0x3e6fdc['rows']=_0x3a1484;return _0x3e6fdc;});}})[_0xcdce('0x26')](respondWithFilteredResult(_0x3ec7af,_0x26e086))[_0xcdce('0x45')](handleError(_0x3ec7af,null));};exports['getAnswers']=function(_0x3d96b1,_0x1cc476,_0x23d1b6){var _0x25b92a={'raw':!![],'where':{}};var _0x57475b={};var _0x4350d9={'count':0x0,'rows':[]};return db[_0xcdce('0x2c')][_0xcdce('0x5b')]({'where':{'id':_0x3d96b1[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x1cc476,null))[_0xcdce('0x26')](function(_0x238d2f){if(_0x238d2f){_0x57475b[_0xcdce('0x30')]=_[_0xcdce('0x32')](db['JscriptyAnswerReport']['rawAttributes']);_0x57475b[_0xcdce('0x33')]=_[_0xcdce('0x32')](_0x3d96b1['query']);_0x57475b[_0xcdce('0x34')]=_[_0xcdce('0x35')](_0x57475b[_0xcdce('0x30')],_0x57475b['query']);_0x25b92a[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x57475b[_0xcdce('0x30')],qs['fields'](_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x37')]));_0x25b92a['attributes']=_0x25b92a[_0xcdce('0x36')]['length']?_0x25b92a[_0xcdce('0x36')]:_0x57475b[_0xcdce('0x30')];if(!_0x3d96b1[_0xcdce('0x33')]['hasOwnProperty'](_0xcdce('0x5e'))){_0x25b92a[_0xcdce('0x20')]=qs['limit'](_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x20')]);_0x25b92a[_0xcdce('0x1f')]=qs['offset'](_0x3d96b1['query'][_0xcdce('0x1f')]);}_0x25b92a[_0xcdce('0x39')]=qs['sort'](_0x3d96b1['query']['sort']);_0x25b92a[_0xcdce('0x3b')]=qs[_0xcdce('0x34')](_[_0xcdce('0x3c')](_0x3d96b1[_0xcdce('0x33')],_0x57475b[_0xcdce('0x34')]));_0x25b92a[_0xcdce('0x3b')][_0xcdce('0x5d')]=_0x238d2f['id'];if(_0x3d96b1[_0xcdce('0x33')]['filter']){_0x25b92a['where']=_['merge'](_0x25b92a[_0xcdce('0x3b')],{'$or':_[_0xcdce('0x31')](_0x25b92a[_0xcdce('0x36')],function(_0x598b76){var _0x1f983f={};_0x1f983f[_0x598b76]={'$like':'%'+_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x3d')]+'%'};return _0x1f983f;})});}_0x25b92a=_['merge']({},_0x25b92a,_0x3d96b1[_0xcdce('0x41')]);return db[_0xcdce('0x5f')][_0xcdce('0x1e')]({'where':_0x25b92a[_0xcdce('0x3b')]})[_0xcdce('0x26')](function(_0x3bdb3e){_0x4350d9[_0xcdce('0x1e')]=_0x3bdb3e;if(_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x49')]){_0x25b92a[_0xcdce('0x42')]=[{'all':!![]}];}return db[_0xcdce('0x5f')][_0xcdce('0x43')](_0x25b92a);})[_0xcdce('0x26')](function(_0x13a9c4){_0x4350d9[_0xcdce('0x44')]=_0x13a9c4;return _0x4350d9;});}})[_0xcdce('0x26')](respondWithFilteredResult(_0x1cc476,_0x25b92a))[_0xcdce('0x45')](handleError(_0x1cc476,null));};function char(_0x1f69c2){return _0xcdce('0x60')===typeof _0x1f69c2?String['fromCharCode'][_0xcdce('0x61')](null,arguments):_0x1f69c2;}function needsEncapsulation(_0x31c356){return!!_0x31c356&&(_0x31c356[_0xcdce('0x62')]()['indexOf'](char(0xd))>=0x0||_0x31c356[_0xcdce('0x62')]()[_0xcdce('0x63')](char(0xa))>=0x0||_0x31c356[_0xcdce('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x31c356[_0xcdce('0x62')]()[_0xcdce('0x63')](char(0x22))>=0x0);}function encapsulate(_0x30f137){var _0x3920f2=char(0x22),_0x3f58d5='\x5c'+char(0x22),_0xabe520=_0x30f137[_0xcdce('0x62')]()[_0xcdce('0x64')](new RegExp(_0x3920f2,'g'),_0x3f58d5);return _0x3920f2+_0xabe520+_0x3920f2;}exports[_0xcdce('0x65')]=function(_0x1849e6,_0x2a1ab5,_0xd24a36){var _0x13b9b8,_0x4edc94;var _0x52d945={'where':{'ProjectId':_0x1849e6[_0xcdce('0x47')]['id']}};if(_0x1849e6[_0xcdce('0x33')][_0xcdce('0x66')]){_0x52d945[_0xcdce('0x3b')][_0xcdce('0x67')]=JSON[_0xcdce('0x68')](_0x1849e6[_0xcdce('0x33')][_0xcdce('0x66')]);}return db[_0xcdce('0x5c')][_0xcdce('0x43')](_0x52d945)['then'](handleEntityNotFound(_0x2a1ab5,null))[_0xcdce('0x26')](function(_0x145937){if(_0x145937){_0x13b9b8=_0x145937;return db[_0xcdce('0x69')][_0xcdce('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x13b9b8,'id')},'ProjectId':_0x1849e6['params']['id']},'order':'-createdAt'});}})[_0xcdce('0x26')](handleEntityNotFound(_0x2a1ab5,null))[_0xcdce('0x26')](function(_0x1608c4){if(_0x1608c4){_0x4edc94=_0x1608c4;var _0x2b6883={};for(var _0x20f1aa=0x0,_0x532562=_0x4edc94[_0xcdce('0x48')];_0x20f1aa<_0x532562;_0x20f1aa++){if(!_0x2b6883['hasOwnProperty'](_0x4edc94[_0x20f1aa][_0xcdce('0x6a')])){_0x2b6883[_0x4edc94[_0x20f1aa][_0xcdce('0x6a')]]=needsEncapsulation(_0x4edc94[_0x20f1aa][_0xcdce('0x6b')])?encapsulate(_0x4edc94[_0x20f1aa][_0xcdce('0x6b')]):_0x4edc94[_0x20f1aa]['question'];}}var _0x595a12=[],_0x5363d4={};for(var _0x34f066=0x0,_0x16514d=_0x13b9b8[_0xcdce('0x48')];_0x34f066<_0x16514d;_0x34f066++){_0x5363d4={'ProjectId':_0x1849e6['params']['id'],'SessionId':_0x13b9b8[_0x34f066]['id'],'StartTime':moment(_0x13b9b8[_0x34f066]['starttime'])['format'](_0xcdce('0x6c'))};for(var _0x370d2a=0x0,_0x580943=_0x4edc94[_0xcdce('0x48')];_0x370d2a<_0x580943;_0x370d2a++){if(_0x4edc94[_0x370d2a]['SessionId']==_0x13b9b8[_0x34f066]['id']&&_0x2b6883[_0xcdce('0x38')](_0x4edc94[_0x370d2a][_0xcdce('0x6a')])){_0x5363d4[_0x2b6883[_0x4edc94[_0x370d2a][_0xcdce('0x6a')]]]=_0x4edc94[_0x370d2a][_0xcdce('0x6d')];}}for(var _0x11bd1c in _0x2b6883){if(!_0x5363d4[_0xcdce('0x38')](_0x2b6883[_0x11bd1c])){_0x5363d4[_0x2b6883[_0x11bd1c]]=null;}}_0x595a12[_0xcdce('0x6e')](_0x5363d4);}return _0x595a12;}})[_0xcdce('0x26')](function(_0x251b91){if(!_[_0xcdce('0x6f')](_0x251b91)){var _0x196a95=toCsv(_0x251b91);var _0x580ba1=Date[_0xcdce('0x70')]();fs['writeFileSync'](util[_0xcdce('0x71')](_0xcdce('0x72'),_0x1849e6[_0xcdce('0x47')]['id'],_0x580ba1),_0x196a95);_0x2a1ab5[_0xcdce('0x73')](_0xcdce('0x74'),_0xcdce('0x75')+util[_0xcdce('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x1849e6[_0xcdce('0x47')]['id'],_0x580ba1));_0x2a1ab5['setHeader'](_0xcdce('0x76'),_0xcdce('0x77'));return _0x2a1ab5[_0xcdce('0x78')](util['format'](_0xcdce('0x72'),_0x1849e6[_0xcdce('0x47')]['id'],_0x580ba1));}else{return _0x2a1ab5[_0xcdce('0x1c')](0xcc);}})[_0xcdce('0x45')](handleError(_0x2a1ab5,null));}; \ No newline at end of file +var _0xf2f0=['key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','JscriptyProject','includeAll','include','findAll','rows','catch','show','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','length','options','omit','createdAt','updatedAt','body','role','findOne','nolimit','order','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','format','setHeader','Content-type','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','fieldName','type'];(function(_0x3f4070,_0x3ff2a6){var _0x1063be=function(_0x13aa61){while(--_0x13aa61){_0x3f4070['push'](_0x3f4070['shift']());}};_0x1063be(++_0x3ff2a6);}(_0xf2f0,0x130));var _0x0f2f=function(_0x51ac7c,_0x8696f2){_0x51ac7c=_0x51ac7c-0x0;var _0x380ee7=_0xf2f0[_0x51ac7c];return _0x380ee7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0f2f('0x0'));var zipdir=require(_0x0f2f('0x1'));var jsonpatch=require(_0x0f2f('0x2'));var rp=require(_0x0f2f('0x3'));var moment=require(_0x0f2f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f2f('0x5'));var util=require(_0x0f2f('0x6'));var path=require(_0x0f2f('0x7'));var sox=require(_0x0f2f('0x8'));var csv=require(_0x0f2f('0x9'));var ejs=require(_0x0f2f('0xa'));var fs=require('fs');var _=require(_0x0f2f('0xb'));var squel=require(_0x0f2f('0xc'));var crypto=require(_0x0f2f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f2f('0xe'));var toCsv=require(_0x0f2f('0x9'));var querystring=require(_0x0f2f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0f2f('0x10'));var as=require(_0x0f2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f2f('0x12'))(_0x0f2f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f2f('0x14'));var db=require(_0x0f2f('0x15'))['db'];function respondWithStatusCode(_0x565e28,_0x21ce5e){_0x21ce5e=_0x21ce5e||0xcc;return function(_0x2b7a09){if(_0x2b7a09){return _0x565e28[_0x0f2f('0x16')](_0x21ce5e);}return _0x565e28[_0x0f2f('0x17')](_0x21ce5e)['end']();};}function respondWithResult(_0x563715,_0x4e70d3){_0x4e70d3=_0x4e70d3||0xc8;return function(_0x73443){if(_0x73443){return _0x563715['status'](_0x4e70d3)[_0x0f2f('0x18')](_0x73443);}};}function respondWithFilteredResult(_0x2ec07d,_0x3ef4b6){return function(_0x3140db){if(_0x3140db){var _0x11ca6d=_0x3140db[_0x0f2f('0x19')],_0x132201=_0x3ef4b6[_0x0f2f('0x1a')],_0xe56e3=_0x3ef4b6['offset']+_0x3ef4b6[_0x0f2f('0x1b')],_0x5dd608;if(_0xe56e3>=_0x11ca6d){_0xe56e3=_0x11ca6d;_0x5dd608=0xc8;}else{_0x5dd608=0xce;}_0x2ec07d[_0x0f2f('0x17')](_0x5dd608);return _0x2ec07d['set'](_0x0f2f('0x1c'),_0x132201+'-'+_0xe56e3+'/'+_0x11ca6d)[_0x0f2f('0x18')](_0x3140db);}return null;};}function patchUpdates(_0x4762f4){return function(_0x3338cc){try{jsonpatch[_0x0f2f('0x1d')](_0x3338cc,_0x4762f4,!![]);}catch(_0xef5f03){return BPromise[_0x0f2f('0x1e')](_0xef5f03);}return _0x3338cc['save']();};}function saveUpdates(_0x3dece6,_0x292d21){return function(_0x14341a){if(_0x14341a){return _0x14341a[_0x0f2f('0x1f')](_0x3dece6)[_0x0f2f('0x20')](function(_0x30d7e1){return _0x30d7e1;});}return null;};}function removeEntity(_0x28ed21,_0x10e083){return function(_0x3875cd){if(_0x3875cd){return _0x3875cd[_0x0f2f('0x21')]()[_0x0f2f('0x20')](function(){var _0x476810=_0x3875cd[_0x0f2f('0x22')]({'plain':!![]});var _0xfd5681=_0x0f2f('0x23');return db[_0x0f2f('0x24')][_0x0f2f('0x21')]({'where':{'type':_0xfd5681,'resourceId':_0x476810['id']}})['then'](function(){return _0x3875cd;});})['then'](function(){_0x28ed21[_0x0f2f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c410b,_0x1625d2){return function(_0x1ce8c5){if(!_0x1ce8c5){_0x5c410b[_0x0f2f('0x16')](0x194);}return _0x1ce8c5;};}function handleError(_0x36af52,_0x5a74a4){_0x5a74a4=_0x5a74a4||0x1f4;return function(_0x4874c1){logger[_0x0f2f('0x25')](_0x4874c1[_0x0f2f('0x26')]);if(_0x4874c1[_0x0f2f('0x27')]){delete _0x4874c1['name'];}_0x36af52[_0x0f2f('0x17')](_0x5a74a4)[_0x0f2f('0x28')](_0x4874c1);};}exports[_0x0f2f('0x29')]=function(_0x185ebb,_0x56ec6){var _0x4eaaaa={},_0x4fe680={},_0x370b1a={'count':0x0,'rows':[]};var _0x18fd10=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x449dd3){return{'name':_0x449dd3[_0x0f2f('0x2a')],'type':_0x449dd3[_0x0f2f('0x2b')][_0x0f2f('0x2c')]};});_0x4fe680[_0x0f2f('0x2d')]=_[_0x0f2f('0x2e')](_0x18fd10,_0x0f2f('0x27'));_0x4fe680[_0x0f2f('0x2f')]=_[_0x0f2f('0x30')](_0x185ebb[_0x0f2f('0x2f')]);_0x4fe680['filters']=_[_0x0f2f('0x31')](_0x4fe680[_0x0f2f('0x2d')],_0x4fe680[_0x0f2f('0x2f')]);_0x4eaaaa[_0x0f2f('0x32')]=_[_0x0f2f('0x31')](_0x4fe680[_0x0f2f('0x2d')],qs['fields'](_0x185ebb[_0x0f2f('0x2f')][_0x0f2f('0x33')]));_0x4eaaaa['attributes']=_0x4eaaaa[_0x0f2f('0x32')]['length']?_0x4eaaaa[_0x0f2f('0x32')]:_0x4fe680['model'];if(!_0x185ebb['query'][_0x0f2f('0x34')]('nolimit')){_0x4eaaaa[_0x0f2f('0x1b')]=qs[_0x0f2f('0x1b')](_0x185ebb['query'][_0x0f2f('0x1b')]);_0x4eaaaa[_0x0f2f('0x1a')]=qs['offset'](_0x185ebb['query'][_0x0f2f('0x1a')]);}_0x4eaaaa['order']=qs[_0x0f2f('0x35')](_0x185ebb[_0x0f2f('0x2f')]['sort']);_0x4eaaaa[_0x0f2f('0x36')]=qs[_0x0f2f('0x37')](_[_0x0f2f('0x38')](_0x185ebb['query'],_0x4fe680['filters']),_0x18fd10);if(_0x185ebb['query'][_0x0f2f('0x39')]){_0x4eaaaa[_0x0f2f('0x36')]=_[_0x0f2f('0x3a')](_0x4eaaaa['where'],{'$or':_['map'](_0x18fd10,function(_0x1c22a4){if(_0x1c22a4[_0x0f2f('0x2b')]!=='VIRTUAL'){var _0x116cee={};_0x116cee[_0x1c22a4[_0x0f2f('0x27')]]={'$like':'%'+_0x185ebb[_0x0f2f('0x2f')][_0x0f2f('0x39')]+'%'};return _0x116cee;}})});}_0x4eaaaa=_[_0x0f2f('0x3a')]({},_0x4eaaaa,_0x185ebb['options']);var _0x15c960={'where':_0x4eaaaa[_0x0f2f('0x36')]};return db[_0x0f2f('0x3b')][_0x0f2f('0x19')](_0x15c960)['then'](function(_0x3ccaec){_0x370b1a['count']=_0x3ccaec;if(_0x185ebb[_0x0f2f('0x2f')][_0x0f2f('0x3c')]){_0x4eaaaa[_0x0f2f('0x3d')]=[{'all':!![]}];}return db['JscriptyProject'][_0x0f2f('0x3e')](_0x4eaaaa);})['then'](function(_0x54c521){_0x370b1a[_0x0f2f('0x3f')]=_0x54c521;return _0x370b1a;})[_0x0f2f('0x20')](respondWithFilteredResult(_0x56ec6,_0x4eaaaa))[_0x0f2f('0x40')](handleError(_0x56ec6,null));};exports[_0x0f2f('0x41')]=function(_0x3ac41f,_0x379c1d){var _0xf135bb={'raw':![],'where':{'id':_0x3ac41f['params']['id']}},_0x156600={};_0x156600[_0x0f2f('0x2d')]=_['keys'](db[_0x0f2f('0x3b')][_0x0f2f('0x42')]);_0x156600[_0x0f2f('0x2f')]=_[_0x0f2f('0x30')](_0x3ac41f[_0x0f2f('0x2f')]);_0x156600[_0x0f2f('0x37')]=_[_0x0f2f('0x31')](_0x156600[_0x0f2f('0x2d')],_0x156600[_0x0f2f('0x2f')]);_0xf135bb[_0x0f2f('0x32')]=_[_0x0f2f('0x31')](_0x156600[_0x0f2f('0x2d')],qs[_0x0f2f('0x33')](_0x3ac41f[_0x0f2f('0x2f')][_0x0f2f('0x33')]));_0xf135bb[_0x0f2f('0x32')]=_0xf135bb['attributes']['length']?_0xf135bb[_0x0f2f('0x32')]:_0x156600[_0x0f2f('0x2d')];if(_0x3ac41f[_0x0f2f('0x2f')]['includeAll']){_0xf135bb[_0x0f2f('0x3d')]=[{'all':!![]}];}_0xf135bb=_['merge']({},_0xf135bb,_0x3ac41f['options']);return db[_0x0f2f('0x3b')]['find'](_0xf135bb)[_0x0f2f('0x20')](handleEntityNotFound(_0x379c1d,null))['then'](respondWithResult(_0x379c1d,null))[_0x0f2f('0x40')](handleError(_0x379c1d,null));};exports[_0x0f2f('0x43')]=function(_0x207e82,_0x3dfaa9){return db['JscriptyProject'][_0x0f2f('0x43')](_0x207e82['body'],{})[_0x0f2f('0x20')](function(_0x557915){var _0x1f4aac=_0x207e82[_0x0f2f('0x44')][_0x0f2f('0x22')]({'plain':!![]});if(!_0x1f4aac)throw new Error(_0x0f2f('0x45'));if(_0x1f4aac['role']===_0x0f2f('0x44')){var _0xcb4feb=_0x557915[_0x0f2f('0x22')]({'plain':!![]});var _0x28b2e6=_0x0f2f('0x23');return db[_0x0f2f('0x46')][_0x0f2f('0x47')]({'where':{'name':_0x28b2e6,'userProfileId':_0x1f4aac[_0x0f2f('0x48')]},'raw':!![]})[_0x0f2f('0x20')](function(_0xc24479){if(_0xc24479&&_0xc24479[_0x0f2f('0x49')]===0x0){return db[_0x0f2f('0x24')][_0x0f2f('0x43')]({'name':_0xcb4feb[_0x0f2f('0x27')],'resourceId':_0xcb4feb['id'],'type':_0xc24479['name'],'sectionId':_0xc24479['id']},{})[_0x0f2f('0x20')](function(){return _0x557915;});}else{return _0x557915;}})[_0x0f2f('0x40')](function(_0x30bede){logger['error'](_0x0f2f('0x4a'),_0x30bede);throw _0x30bede;});}return _0x557915;})[_0x0f2f('0x20')](respondWithResult(_0x3dfaa9,0xc9))['catch'](handleError(_0x3dfaa9,null));};exports[_0x0f2f('0x4b')]=function(_0x25f2de,_0x30b463){var _0x39cc8e={'where':{'id':_0x25f2de[_0x0f2f('0x4c')]['id']}},_0x93f616={};_0x93f616[_0x0f2f('0x2d')]=_[_0x0f2f('0x30')](db[_0x0f2f('0x3b')][_0x0f2f('0x42')]);_0x39cc8e[_0x0f2f('0x32')]=_[_0x0f2f('0x31')](_0x93f616[_0x0f2f('0x2d')],qs['fields'](_0x25f2de[_0x0f2f('0x2f')][_0x0f2f('0x33')]));_0x39cc8e[_0x0f2f('0x32')]=_0x39cc8e[_0x0f2f('0x32')][_0x0f2f('0x4d')]?_0x39cc8e[_0x0f2f('0x32')]:_0x93f616[_0x0f2f('0x2d')];if(_0x25f2de[_0x0f2f('0x2f')][_0x0f2f('0x3c')]){_0x39cc8e['include']=[{'all':!![]}];}_0x39cc8e=_[_0x0f2f('0x3a')]({},_0x39cc8e,_0x25f2de[_0x0f2f('0x4e')]);return db[_0x0f2f('0x3b')]['find'](_0x39cc8e)[_0x0f2f('0x20')](handleEntityNotFound(_0x30b463,null))[_0x0f2f('0x20')](function(_0x1b7647){if(_0x1b7647){var _0x16bc9c=_0x1b7647[_0x0f2f('0x22')]({'plain':!![]});_0x16bc9c=qs[_0x0f2f('0x4f')](_0x16bc9c,['id',_0x0f2f('0x50'),_0x0f2f('0x51')]);_0x25f2de['body']=_[_0x0f2f('0x4f')](_0x25f2de['body'],['id',_0x0f2f('0x50'),_0x0f2f('0x51')]);return db[_0x0f2f('0x3b')][_0x0f2f('0x43')](_[_0x0f2f('0x3a')](_0x16bc9c,_0x25f2de[_0x0f2f('0x52')]),{'include':_0x25f2de[_0x0f2f('0x2f')][_0x0f2f('0x3c')]?[{'all':!![]}]:undefined})[_0x0f2f('0x20')](function(_0x30dbc4){var _0x2d4081=_0x25f2de[_0x0f2f('0x44')][_0x0f2f('0x22')]({'plain':!![]});if(!_0x2d4081)throw new Error(_0x0f2f('0x45'));if(_0x2d4081[_0x0f2f('0x53')]===_0x0f2f('0x44')){var _0x5d7ae1=_0x30dbc4[_0x0f2f('0x22')]({'plain':!![]});var _0x127bca=_0x0f2f('0x23');return db[_0x0f2f('0x46')][_0x0f2f('0x47')]({'where':{'name':_0x127bca,'userProfileId':_0x2d4081[_0x0f2f('0x48')]},'raw':!![]})['then'](function(_0x3030aa){if(_0x3030aa&&_0x3030aa[_0x0f2f('0x49')]===0x0){return db[_0x0f2f('0x24')][_0x0f2f('0x43')]({'name':_0x5d7ae1['name'],'resourceId':_0x5d7ae1['id'],'type':_0x3030aa[_0x0f2f('0x27')],'sectionId':_0x3030aa['id']},{})[_0x0f2f('0x20')](function(){return _0x30dbc4;});}else{return _0x30dbc4;}})[_0x0f2f('0x40')](function(_0x41512b){logger[_0x0f2f('0x25')](_0x0f2f('0x4a'),_0x41512b);throw _0x41512b;});}return _0x30dbc4;});}})['then'](respondWithResult(_0x30b463,0xc9))[_0x0f2f('0x40')](handleError(_0x30b463,null));};exports[_0x0f2f('0x1f')]=function(_0x673c72,_0x319d4b){if(_0x673c72[_0x0f2f('0x52')]['id']){delete _0x673c72[_0x0f2f('0x52')]['id'];}return db[_0x0f2f('0x3b')][_0x0f2f('0x47')]({'where':{'id':_0x673c72[_0x0f2f('0x4c')]['id']}})[_0x0f2f('0x20')](handleEntityNotFound(_0x319d4b,null))[_0x0f2f('0x20')](saveUpdates(_0x673c72[_0x0f2f('0x52')],null))[_0x0f2f('0x20')](respondWithResult(_0x319d4b,null))['catch'](handleError(_0x319d4b,null));};exports[_0x0f2f('0x21')]=function(_0x3e19d2,_0xad0c8d){return db['JscriptyProject'][_0x0f2f('0x47')]({'where':{'id':_0x3e19d2[_0x0f2f('0x4c')]['id']}})[_0x0f2f('0x20')](handleEntityNotFound(_0xad0c8d,null))[_0x0f2f('0x20')](removeEntity(_0xad0c8d,null))[_0x0f2f('0x40')](handleError(_0xad0c8d,null));};exports['getSessions']=function(_0x3b4d0c,_0x5125b1,_0x16ef8f){var _0x3d1700={'raw':!![],'where':{}};var _0x311b4d={};var _0x37b508={'count':0x0,'rows':[]};return db[_0x0f2f('0x3b')][_0x0f2f('0x54')]({'where':{'id':_0x3b4d0c[_0x0f2f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5125b1,null))[_0x0f2f('0x20')](function(_0x59a194){if(_0x59a194){_0x311b4d[_0x0f2f('0x2d')]=_['keys'](db['JscriptySessionReport'][_0x0f2f('0x42')]);_0x311b4d[_0x0f2f('0x2f')]=_['keys'](_0x3b4d0c[_0x0f2f('0x2f')]);_0x311b4d[_0x0f2f('0x37')]=_[_0x0f2f('0x31')](_0x311b4d[_0x0f2f('0x2d')],_0x311b4d['query']);_0x3d1700[_0x0f2f('0x32')]=_['intersection'](_0x311b4d['model'],qs[_0x0f2f('0x33')](_0x3b4d0c['query'][_0x0f2f('0x33')]));_0x3d1700[_0x0f2f('0x32')]=_0x3d1700[_0x0f2f('0x32')][_0x0f2f('0x4d')]?_0x3d1700[_0x0f2f('0x32')]:_0x311b4d[_0x0f2f('0x2d')];if(!_0x3b4d0c[_0x0f2f('0x2f')][_0x0f2f('0x34')](_0x0f2f('0x55'))){_0x3d1700[_0x0f2f('0x1b')]=qs[_0x0f2f('0x1b')](_0x3b4d0c[_0x0f2f('0x2f')][_0x0f2f('0x1b')]);_0x3d1700[_0x0f2f('0x1a')]=qs[_0x0f2f('0x1a')](_0x3b4d0c['query'][_0x0f2f('0x1a')]);}_0x3d1700[_0x0f2f('0x56')]=qs[_0x0f2f('0x35')](_0x3b4d0c[_0x0f2f('0x2f')][_0x0f2f('0x35')]);_0x3d1700[_0x0f2f('0x36')]=qs[_0x0f2f('0x37')](_['pick'](_0x3b4d0c[_0x0f2f('0x2f')],_0x311b4d['filters']));_0x3d1700[_0x0f2f('0x36')]['ProjectId']=_0x59a194['id'];if(_0x3b4d0c[_0x0f2f('0x2f')][_0x0f2f('0x39')]){_0x3d1700[_0x0f2f('0x36')]=_[_0x0f2f('0x3a')](_0x3d1700[_0x0f2f('0x36')],{'$or':_['map'](_0x3d1700[_0x0f2f('0x32')],function(_0x38abca){var _0x5ae85c={};_0x5ae85c[_0x38abca]={'$like':'%'+_0x3b4d0c['query'][_0x0f2f('0x39')]+'%'};return _0x5ae85c;})});}_0x3d1700=_[_0x0f2f('0x3a')]({},_0x3d1700,_0x3b4d0c[_0x0f2f('0x4e')]);return db[_0x0f2f('0x57')][_0x0f2f('0x19')]({'where':_0x3d1700['where']})[_0x0f2f('0x20')](function(_0x19e1e2){_0x37b508[_0x0f2f('0x19')]=_0x19e1e2;if(_0x3b4d0c[_0x0f2f('0x2f')][_0x0f2f('0x3c')]){_0x3d1700[_0x0f2f('0x3d')]=[{'all':!![]}];}return db[_0x0f2f('0x57')][_0x0f2f('0x3e')](_0x3d1700);})['then'](function(_0x301369){_0x37b508[_0x0f2f('0x3f')]=_0x301369;return _0x37b508;});}})[_0x0f2f('0x20')](respondWithFilteredResult(_0x5125b1,_0x3d1700))[_0x0f2f('0x40')](handleError(_0x5125b1,null));};exports[_0x0f2f('0x58')]=function(_0x124d4b,_0xc80752,_0x3c5ec1){var _0xac04b3={'raw':!![],'where':{}};var _0xc06f8c={};var _0x2469bc={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x124d4b[_0x0f2f('0x4c')]['id']}})[_0x0f2f('0x20')](handleEntityNotFound(_0xc80752,null))[_0x0f2f('0x20')](function(_0x2e4cea){if(_0x2e4cea){_0xc06f8c['model']=_[_0x0f2f('0x30')](db[_0x0f2f('0x59')][_0x0f2f('0x42')]);_0xc06f8c[_0x0f2f('0x2f')]=_[_0x0f2f('0x30')](_0x124d4b[_0x0f2f('0x2f')]);_0xc06f8c['filters']=_[_0x0f2f('0x31')](_0xc06f8c[_0x0f2f('0x2d')],_0xc06f8c[_0x0f2f('0x2f')]);_0xac04b3[_0x0f2f('0x32')]=_[_0x0f2f('0x31')](_0xc06f8c[_0x0f2f('0x2d')],qs[_0x0f2f('0x33')](_0x124d4b[_0x0f2f('0x2f')][_0x0f2f('0x33')]));_0xac04b3[_0x0f2f('0x32')]=_0xac04b3[_0x0f2f('0x32')][_0x0f2f('0x4d')]?_0xac04b3[_0x0f2f('0x32')]:_0xc06f8c[_0x0f2f('0x2d')];if(!_0x124d4b[_0x0f2f('0x2f')][_0x0f2f('0x34')](_0x0f2f('0x55'))){_0xac04b3[_0x0f2f('0x1b')]=qs[_0x0f2f('0x1b')](_0x124d4b[_0x0f2f('0x2f')]['limit']);_0xac04b3[_0x0f2f('0x1a')]=qs['offset'](_0x124d4b[_0x0f2f('0x2f')][_0x0f2f('0x1a')]);}_0xac04b3[_0x0f2f('0x56')]=qs['sort'](_0x124d4b[_0x0f2f('0x2f')][_0x0f2f('0x35')]);_0xac04b3[_0x0f2f('0x36')]=qs[_0x0f2f('0x37')](_[_0x0f2f('0x38')](_0x124d4b[_0x0f2f('0x2f')],_0xc06f8c['filters']));_0xac04b3['where'][_0x0f2f('0x5a')]=_0x2e4cea['id'];if(_0x124d4b[_0x0f2f('0x2f')][_0x0f2f('0x39')]){_0xac04b3[_0x0f2f('0x36')]=_[_0x0f2f('0x3a')](_0xac04b3[_0x0f2f('0x36')],{'$or':_[_0x0f2f('0x2e')](_0xac04b3[_0x0f2f('0x32')],function(_0x58a2be){var _0x1ad3e6={};_0x1ad3e6[_0x58a2be]={'$like':'%'+_0x124d4b[_0x0f2f('0x2f')]['filter']+'%'};return _0x1ad3e6;})});}_0xac04b3=_['merge']({},_0xac04b3,_0x124d4b[_0x0f2f('0x4e')]);return db['JscriptyAnswerReport'][_0x0f2f('0x19')]({'where':_0xac04b3['where']})[_0x0f2f('0x20')](function(_0x4ada04){_0x2469bc['count']=_0x4ada04;if(_0x124d4b[_0x0f2f('0x2f')][_0x0f2f('0x3c')]){_0xac04b3[_0x0f2f('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x0f2f('0x3e')](_0xac04b3);})['then'](function(_0x269e2f){_0x2469bc[_0x0f2f('0x3f')]=_0x269e2f;return _0x2469bc;});}})['then'](respondWithFilteredResult(_0xc80752,_0xac04b3))[_0x0f2f('0x40')](handleError(_0xc80752,null));};function char(_0x242204){return _0x0f2f('0x5b')===typeof _0x242204?String[_0x0f2f('0x5c')][_0x0f2f('0x1d')](null,arguments):_0x242204;}function needsEncapsulation(_0x33fd16){return!!_0x33fd16&&(_0x33fd16['toString']()[_0x0f2f('0x5d')](char(0xd))>=0x0||_0x33fd16['toString']()[_0x0f2f('0x5d')](char(0xa))>=0x0||_0x33fd16[_0x0f2f('0x5e')]()[_0x0f2f('0x5d')](char(0x2c))>=0x0||_0x33fd16[_0x0f2f('0x5e')]()[_0x0f2f('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x2c05fd){var _0x522cc6=char(0x22),_0x1e605f='\x5c'+char(0x22),_0x51f373=_0x2c05fd[_0x0f2f('0x5e')]()[_0x0f2f('0x5f')](new RegExp(_0x522cc6,'g'),_0x1e605f);return _0x522cc6+_0x51f373+_0x522cc6;}exports[_0x0f2f('0x60')]=function(_0x142f81,_0xe20c30,_0x21f3a4){var _0x38d879,_0x3f3538;var _0x25ab10={'where':{'ProjectId':_0x142f81[_0x0f2f('0x4c')]['id']}};if(_0x142f81['query'][_0x0f2f('0x61')]){_0x25ab10[_0x0f2f('0x36')][_0x0f2f('0x62')]=JSON[_0x0f2f('0x63')](_0x142f81[_0x0f2f('0x2f')]['startTime']);}return db[_0x0f2f('0x57')]['findAll'](_0x25ab10)[_0x0f2f('0x20')](handleEntityNotFound(_0xe20c30,null))[_0x0f2f('0x20')](function(_0x4fdf6e){if(_0x4fdf6e){_0x38d879=_0x4fdf6e;return db[_0x0f2f('0x64')][_0x0f2f('0x3e')]({'where':{'SessionId':{'$in':_[_0x0f2f('0x2e')](_0x38d879,'id')},'ProjectId':_0x142f81[_0x0f2f('0x4c')]['id']},'order':_0x0f2f('0x65')});}})[_0x0f2f('0x20')](handleEntityNotFound(_0xe20c30,null))['then'](function(_0x11c0d){if(_0x11c0d){_0x3f3538=_0x11c0d;var _0x4f8786={};for(var _0x466f1f=0x0,_0x46d832=_0x3f3538[_0x0f2f('0x4d')];_0x466f1f<_0x46d832;_0x466f1f++){if(!_0x4f8786[_0x0f2f('0x34')](_0x3f3538[_0x466f1f][_0x0f2f('0x66')])){_0x4f8786[_0x3f3538[_0x466f1f][_0x0f2f('0x66')]]=needsEncapsulation(_0x3f3538[_0x466f1f][_0x0f2f('0x67')])?encapsulate(_0x3f3538[_0x466f1f][_0x0f2f('0x67')]):_0x3f3538[_0x466f1f][_0x0f2f('0x67')];}}var _0x34e275=[],_0x38cd3b={};for(var _0x5b11b4=0x0,_0x13f1ea=_0x38d879[_0x0f2f('0x4d')];_0x5b11b4<_0x13f1ea;_0x5b11b4++){_0x38cd3b={'ProjectId':_0x142f81[_0x0f2f('0x4c')]['id'],'SessionId':_0x38d879[_0x5b11b4]['id'],'StartTime':moment(_0x38d879[_0x5b11b4][_0x0f2f('0x62')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x55e55a=0x0,_0x419205=_0x3f3538[_0x0f2f('0x4d')];_0x55e55a<_0x419205;_0x55e55a++){if(_0x3f3538[_0x55e55a][_0x0f2f('0x68')]==_0x38d879[_0x5b11b4]['id']&&_0x4f8786[_0x0f2f('0x34')](_0x3f3538[_0x55e55a]['questionId'])){_0x38cd3b[_0x4f8786[_0x3f3538[_0x55e55a][_0x0f2f('0x66')]]]=_0x3f3538[_0x55e55a][_0x0f2f('0x69')];}}for(var _0x3d9dc2 in _0x4f8786){if(!_0x38cd3b[_0x0f2f('0x34')](_0x4f8786[_0x3d9dc2])){_0x38cd3b[_0x4f8786[_0x3d9dc2]]=null;}}_0x34e275[_0x0f2f('0x6a')](_0x38cd3b);}return _0x34e275;}})['then'](function(_0x1d4292){if(!_[_0x0f2f('0x6b')](_0x1d4292)){var _0x55b4b9=toCsv(_0x1d4292);var _0x3dfc85=Date[_0x0f2f('0x6c')]();fs['writeFileSync'](util['format'](_0x0f2f('0x6d'),_0x142f81[_0x0f2f('0x4c')]['id'],_0x3dfc85),_0x55b4b9);_0xe20c30['setHeader'](_0x0f2f('0x6e'),_0x0f2f('0x6f')+util[_0x0f2f('0x70')]('Jscripty_Project_%d_Summary_%s.csv',_0x142f81[_0x0f2f('0x4c')]['id'],_0x3dfc85));_0xe20c30[_0x0f2f('0x71')](_0x0f2f('0x72'),'text/csv');return _0xe20c30[_0x0f2f('0x73')](util['format'](_0x0f2f('0x6d'),_0x142f81[_0x0f2f('0x4c')]['id'],_0x3dfc85));}else{return _0xe20c30[_0x0f2f('0x16')](0xcc);}})[_0x0f2f('0x40')](handleError(_0xe20c30,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 67ec68b..52a2349 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 _0x8e3c=['exports','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x5a58db,_0x2d7f41){var _0x42dd9a=function(_0x52d814){while(--_0x52d814){_0x5a58db['push'](_0x5a58db['shift']());}};_0x42dd9a(++_0x2d7f41);}(_0x8e3c,0x18d));var _0xc8e3=function(_0xf71d98,_0x51e619){_0xf71d98=_0xf71d98-0x0;var _0x3fec71=_0x8e3c[_0xf71d98];return _0x3fec71;};'use strict';var _=require(_0xc8e3('0x0'));var util=require(_0xc8e3('0x1'));var logger=require(_0xc8e3('0x2'))(_0xc8e3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc8e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8e3('0x5'));var config=require(_0xc8e3('0x6'));var attributes=require(_0xc8e3('0x7'));module[_0xc8e3('0x8')]=function(_0x5bbdf9,_0x6a92c1){return _0x5bbdf9['define']('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8b3=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','moment'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa8b3,0x6a));var _0x3a8b=function(_0x13696a,_0x533911){_0x13696a=_0x13696a-0x0;var _0x985801=_0xa8b3[_0x13696a];return _0x985801;};'use strict';var _=require(_0x3a8b('0x0'));var util=require(_0x3a8b('0x1'));var logger=require(_0x3a8b('0x2'))('api');var moment=require(_0x3a8b('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a8b('0x4'));var fs=require('fs');var path=require(_0x3a8b('0x5'));var rimraf=require(_0x3a8b('0x6'));var config=require(_0x3a8b('0x7'));var attributes=require(_0x3a8b('0x8'));module['exports']=function(_0x535a6e,_0x113731){return _0x535a6e['define'](_0x3a8b('0x9'),attributes,{'tableName':_0x3a8b('0xa'),'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 4bd732e..f609dc8 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 _0x4583=['error','code','JscriptyProject,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x16b992,_0x43d74c){var _0x385c78=function(_0x5c904){while(--_0x5c904){_0x16b992['push'](_0x16b992['shift']());}};_0x385c78(++_0x43d74c);}(_0x4583,0xfc));var _0x3458=function(_0x3c1ed2,_0x1fd108){_0x3c1ed2=_0x3c1ed2-0x0;var _0x56926c=_0x4583[_0x3c1ed2];return _0x56926c;};'use strict';var _=require('lodash');var util=require(_0x3458('0x0'));var moment=require('moment');var BPromise=require(_0x3458('0x1'));var rs=require(_0x3458('0x2'));var fs=require('fs');var Redis=require(_0x3458('0x3'));var db=require(_0x3458('0x4'))['db'];var utils=require(_0x3458('0x5'));var logger=require(_0x3458('0x6'))('rpc');var config=require(_0x3458('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29efbf,_0x503a1f,_0x3cd243){return new BPromise(function(_0x38c225,_0x5dd445){return client['request'](_0x29efbf,_0x3cd243)[_0x3458('0x8')](function(_0x30b221){logger[_0x3458('0x9')]('JscriptyProject,\x20%s,\x20%s',_0x503a1f,_0x3458('0xa'));logger[_0x3458('0xb')](_0x3458('0xc'),_0x503a1f,_0x3458('0xa'),JSON[_0x3458('0xd')](_0x30b221));if(_0x30b221['error']){if(_0x30b221[_0x3458('0xe')][_0x3458('0xf')]===0x1f4){logger['error'](_0x3458('0x10'),_0x503a1f,_0x30b221[_0x3458('0xe')][_0x3458('0x11')]);return _0x5dd445(_0x30b221[_0x3458('0xe')]['message']);}logger[_0x3458('0xe')](_0x3458('0x10'),_0x503a1f,_0x30b221[_0x3458('0xe')][_0x3458('0x11')]);return _0x38c225(_0x30b221[_0x3458('0xe')]['message']);}else{logger[_0x3458('0x9')]('JscriptyProject,\x20%s,\x20%s',_0x503a1f,_0x3458('0xa'));_0x38c225(_0x30b221[_0x3458('0x12')][_0x3458('0x11')]);}})['catch'](function(_0x2dadff){logger[_0x3458('0xe')](_0x3458('0x10'),_0x503a1f,_0x2dadff);_0x5dd445(_0x2dadff);});});} \ No newline at end of file +var _0xf355=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xf355,0x132));var _0x5f35=function(_0x37ee74,_0x36230d){_0x37ee74=_0x37ee74-0x0;var _0x3b1140=_0xf355[_0x37ee74];return _0x3b1140;};'use strict';var _=require(_0x5f35('0x0'));var util=require(_0x5f35('0x1'));var moment=require(_0x5f35('0x2'));var BPromise=require(_0x5f35('0x3'));var rs=require(_0x5f35('0x4'));var fs=require('fs');var Redis=require(_0x5f35('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f35('0x6'));var logger=require(_0x5f35('0x7'))(_0x5f35('0x8'));var config=require(_0x5f35('0x9'));var jayson=require(_0x5f35('0xa'));var client=jayson[_0x5f35('0xb')][_0x5f35('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c0810,_0x278e08,_0x532316){return new BPromise(function(_0xe3b845,_0x2c4ab5){return client[_0x5f35('0xd')](_0x4c0810,_0x532316)[_0x5f35('0xe')](function(_0x48a5cb){logger[_0x5f35('0xf')](_0x5f35('0x10'),_0x278e08,'request\x20sent');logger[_0x5f35('0x11')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x278e08,_0x5f35('0x12'),JSON[_0x5f35('0x13')](_0x48a5cb));if(_0x48a5cb['error']){if(_0x48a5cb[_0x5f35('0x14')][_0x5f35('0x15')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x278e08,_0x48a5cb[_0x5f35('0x14')][_0x5f35('0x16')]);return _0x2c4ab5(_0x48a5cb['error'][_0x5f35('0x16')]);}logger[_0x5f35('0x14')]('JscriptyProject,\x20%s,\x20%s',_0x278e08,_0x48a5cb[_0x5f35('0x14')]['message']);return _0xe3b845(_0x48a5cb['error'][_0x5f35('0x16')]);}else{logger['info'](_0x5f35('0x10'),_0x278e08,_0x5f35('0x12'));_0xe3b845(_0x48a5cb[_0x5f35('0x17')][_0x5f35('0x16')]);}})[_0x5f35('0x18')](function(_0x3d80f6){logger[_0x5f35('0x14')](_0x5f35('0x10'),_0x278e08,_0x3d80f6);_0x2c4ab5(_0x3d80f6);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 68e991e..5367bcb 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 _0x3947=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','/:id','show','create','update','delete','multer','path'];(function(_0x612e38,_0x5437ba){var _0x47f912=function(_0x2829be){while(--_0x2829be){_0x612e38['push'](_0x612e38['shift']());}};_0x47f912(++_0x5437ba);}(_0x3947,0xb2));var _0x7394=function(_0x1e8b1b,_0x2acd26){_0x1e8b1b=_0x1e8b1b-0x0;var _0x395ee4=_0x3947[_0x1e8b1b];return _0x395ee4;};'use strict';var multer=require(_0x7394('0x0'));var util=require('util');var path=require(_0x7394('0x1'));var timeout=require(_0x7394('0x2'));var express=require(_0x7394('0x3'));var router=express[_0x7394('0x4')]();var auth=require(_0x7394('0x5'));var interaction=require(_0x7394('0x6'));var config=require(_0x7394('0x7'));var controller=require(_0x7394('0x8'));router[_0x7394('0x9')]('/',auth['isAuthenticated'](),controller[_0x7394('0xa')]);router[_0x7394('0x9')](_0x7394('0xb'),auth[_0x7394('0xc')](),controller['describe']);router[_0x7394('0x9')](_0x7394('0xd'),auth['isAuthenticated'](),controller[_0x7394('0xe')]);router['post']('/',auth[_0x7394('0xc')](),controller[_0x7394('0xf')]);router['put'](_0x7394('0xd'),auth[_0x7394('0xc')](),controller[_0x7394('0x10')]);router[_0x7394('0x11')](_0x7394('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe0d2=['create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','/:id','show','post'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe0d2,0x1d9));var _0x2e0d=function(_0xa23275,_0x418480){_0xa23275=_0xa23275-0x0;var _0x10a845=_0xe0d2[_0xa23275];return _0x10a845;};'use strict';var multer=require('multer');var util=require(_0x2e0d('0x0'));var path=require(_0x2e0d('0x1'));var timeout=require(_0x2e0d('0x2'));var express=require(_0x2e0d('0x3'));var router=express[_0x2e0d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e0d('0x5'));var controller=require(_0x2e0d('0x6'));router['get']('/',auth[_0x2e0d('0x7')](),controller['index']);router[_0x2e0d('0x8')](_0x2e0d('0x9'),auth[_0x2e0d('0x7')](),controller['describe']);router[_0x2e0d('0x8')](_0x2e0d('0xa'),auth[_0x2e0d('0x7')](),controller[_0x2e0d('0xb')]);router[_0x2e0d('0xc')]('/',auth['isAuthenticated'](),controller[_0x2e0d('0xd')]);router[_0x2e0d('0xe')](_0x2e0d('0xa'),auth[_0x2e0d('0x7')](),controller[_0x2e0d('0xf')]);router['delete'](_0x2e0d('0xa'),auth[_0x2e0d('0x7')](),controller[_0x2e0d('0x10')]);module[_0x2e0d('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9868f45..5a6acc0 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 _0x0d68=['long','sequelize','STRING','TEXT'];(function(_0x13af46,_0x50a3c3){var _0x168201=function(_0x5be290){while(--_0x5be290){_0x13af46['push'](_0x13af46['shift']());}};_0x168201(++_0x50a3c3);}(_0x0d68,0x17d));var _0x80d6=function(_0x22235f,_0x5bfe79){_0x22235f=_0x22235f-0x0;var _0x51f451=_0x0d68[_0x22235f];return _0x51f451;};'use strict';var Sequelize=require(_0x80d6('0x0'));module['exports']={'question':{'type':Sequelize[_0x80d6('0x1')]},'answer':{'type':Sequelize[_0x80d6('0x2')](_0x80d6('0x3'))},'membername':{'type':Sequelize[_0x80d6('0x1')]},'projectname':{'type':Sequelize[_0x80d6('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x80d6('0x1')]},'calleridnum':{'type':Sequelize[_0x80d6('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbc82=['STRING','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbc82,0x1e1));var _0x2bc8=function(_0x4a8a18,_0x556b72){_0x4a8a18=_0x4a8a18-0x0;var _0x3f8316=_0xbc82[_0x4a8a18];return _0x3f8316;};'use strict';var Sequelize=require(_0x2bc8('0x0'));module['exports']={'question':{'type':Sequelize[_0x2bc8('0x1')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2bc8('0x1')]},'queue':{'type':Sequelize[_0x2bc8('0x1')]},'uniqueid':{'type':Sequelize[_0x2bc8('0x1')]},'calleridname':{'type':Sequelize[_0x2bc8('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x2bc8('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index cb98fd0..58938bf 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 _0xe9e1=['filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','type','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','key','model','query','keys'];(function(_0x452e83,_0x52e169){var _0x65b907=function(_0x1e75b7){while(--_0x1e75b7){_0x452e83['push'](_0x452e83['shift']());}};_0x65b907(++_0x52e169);}(_0xe9e1,0x196));var _0x1e9e=function(_0x570b4d,_0x1208a4){_0x570b4d=_0x570b4d-0x0;var _0x10a67b=_0xe9e1[_0x570b4d];return _0x10a67b;};'use strict';var pdf=require(_0x1e9e('0x0'));var emlformat=require(_0x1e9e('0x1'));var rimraf=require(_0x1e9e('0x2'));var zipdir=require(_0x1e9e('0x3'));var jsonpatch=require(_0x1e9e('0x4'));var rp=require(_0x1e9e('0x5'));var moment=require(_0x1e9e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1e9e('0x7'));var util=require(_0x1e9e('0x8'));var path=require(_0x1e9e('0x9'));var sox=require(_0x1e9e('0xa'));var csv=require(_0x1e9e('0xb'));var ejs=require(_0x1e9e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e9e('0xd'));var crypto=require(_0x1e9e('0xe'));var jsforce=require(_0x1e9e('0xf'));var deskjs=require(_0x1e9e('0x10'));var toCsv=require(_0x1e9e('0xb'));var querystring=require('querystring');var Papa=require(_0x1e9e('0x11'));var Redis=require(_0x1e9e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1e9e('0x13'));var as=require(_0x1e9e('0x14'));var hardwareService=require(_0x1e9e('0x15'));var logger=require(_0x1e9e('0x16'))(_0x1e9e('0x17'));var utils=require(_0x1e9e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1e9e('0x19'));var db=require(_0x1e9e('0x1a'))['db'];function respondWithStatusCode(_0x106f06,_0x21fcd3){_0x21fcd3=_0x21fcd3||0xcc;return function(_0x3d1c4e){if(_0x3d1c4e){return _0x106f06['sendStatus'](_0x21fcd3);}return _0x106f06[_0x1e9e('0x1b')](_0x21fcd3)[_0x1e9e('0x1c')]();};}function respondWithResult(_0x28f8e4,_0x54ab52){_0x54ab52=_0x54ab52||0xc8;return function(_0x423099){if(_0x423099){return _0x28f8e4['status'](_0x54ab52)[_0x1e9e('0x1d')](_0x423099);}};}function respondWithFilteredResult(_0xbecc2f,_0x2fa075){return function(_0x49bf9f){if(_0x49bf9f){var _0x49fb82=_0x49bf9f[_0x1e9e('0x1e')],_0x3e715e=_0x2fa075[_0x1e9e('0x1f')],_0x476f78=_0x2fa075[_0x1e9e('0x1f')]+_0x2fa075[_0x1e9e('0x20')],_0x790530;if(_0x476f78>=_0x49fb82){_0x476f78=_0x49fb82;_0x790530=0xc8;}else{_0x790530=0xce;}_0xbecc2f[_0x1e9e('0x1b')](_0x790530);return _0xbecc2f[_0x1e9e('0x21')](_0x1e9e('0x22'),_0x3e715e+'-'+_0x476f78+'/'+_0x49fb82)['json'](_0x49bf9f);}return null;};}function patchUpdates(_0x4c078d){return function(_0x35e7e1){try{jsonpatch[_0x1e9e('0x23')](_0x35e7e1,_0x4c078d,!![]);}catch(_0x5522af){return BPromise['reject'](_0x5522af);}return _0x35e7e1[_0x1e9e('0x24')]();};}function saveUpdates(_0x5e5991,_0x5f98a){return function(_0x436882){if(_0x436882){return _0x436882[_0x1e9e('0x25')](_0x5e5991)[_0x1e9e('0x26')](function(_0x5c84f9){return _0x5c84f9;});}return null;};}function removeEntity(_0x17fbc0,_0x443bb2){return function(_0x4a62b0){if(_0x4a62b0){return _0x4a62b0['destroy']()[_0x1e9e('0x26')](function(){_0x17fbc0[_0x1e9e('0x1b')](0xcc)[_0x1e9e('0x1c')]();});}};}function handleEntityNotFound(_0x2f59b0,_0x1df133){return function(_0x14f3b6){if(!_0x14f3b6){_0x2f59b0[_0x1e9e('0x27')](0x194);}return _0x14f3b6;};}function handleError(_0x2e2c69,_0x53660d){_0x53660d=_0x53660d||0x1f4;return function(_0x24bcae){logger[_0x1e9e('0x28')](_0x24bcae[_0x1e9e('0x29')]);if(_0x24bcae[_0x1e9e('0x2a')]){delete _0x24bcae[_0x1e9e('0x2a')];}_0x2e2c69[_0x1e9e('0x1b')](_0x53660d)['send'](_0x24bcae);};}exports[_0x1e9e('0x2b')]=function(_0x1dd822,_0x3fd8b5){var _0x33f492={},_0x3c0590={},_0x4616c7={'count':0x0,'rows':[]};var _0x29093f=_[_0x1e9e('0x2c')](db['JscriptyQuestionReport'][_0x1e9e('0x2d')],function(_0x31dcd8){return{'name':_0x31dcd8['fieldName'],'type':_0x31dcd8['type'][_0x1e9e('0x2e')]};});_0x3c0590[_0x1e9e('0x2f')]=_[_0x1e9e('0x2c')](_0x29093f,_0x1e9e('0x2a'));_0x3c0590[_0x1e9e('0x30')]=_[_0x1e9e('0x31')](_0x1dd822['query']);_0x3c0590[_0x1e9e('0x32')]=_[_0x1e9e('0x33')](_0x3c0590[_0x1e9e('0x2f')],_0x3c0590[_0x1e9e('0x30')]);_0x33f492[_0x1e9e('0x34')]=_[_0x1e9e('0x33')](_0x3c0590[_0x1e9e('0x2f')],qs[_0x1e9e('0x35')](_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x35')]));_0x33f492[_0x1e9e('0x34')]=_0x33f492['attributes']['length']?_0x33f492[_0x1e9e('0x34')]:_0x3c0590[_0x1e9e('0x2f')];if(!_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x36')]('nolimit')){_0x33f492[_0x1e9e('0x20')]=qs['limit'](_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x20')]);_0x33f492[_0x1e9e('0x1f')]=qs[_0x1e9e('0x1f')](_0x1dd822['query'][_0x1e9e('0x1f')]);}_0x33f492['order']=qs[_0x1e9e('0x37')](_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x37')]);_0x33f492['where']=qs['filters'](_[_0x1e9e('0x38')](_0x1dd822['query'],_0x3c0590[_0x1e9e('0x32')]),_0x29093f);if(_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x39')]){_0x33f492[_0x1e9e('0x3a')]=_[_0x1e9e('0x3b')](_0x33f492[_0x1e9e('0x3a')],{'$or':_[_0x1e9e('0x2c')](_0x29093f,function(_0x1c7293){if(_0x1c7293[_0x1e9e('0x3c')]!=='VIRTUAL'){var _0x5d8482={};_0x5d8482[_0x1c7293[_0x1e9e('0x2a')]]={'$like':'%'+_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x39')]+'%'};return _0x5d8482;}})});}_0x33f492=_[_0x1e9e('0x3b')]({},_0x33f492,_0x1dd822[_0x1e9e('0x3d')]);var _0xfe7e73={'where':_0x33f492[_0x1e9e('0x3a')]};return db[_0x1e9e('0x3e')][_0x1e9e('0x1e')](_0xfe7e73)[_0x1e9e('0x26')](function(_0x4653f8){_0x4616c7[_0x1e9e('0x1e')]=_0x4653f8;if(_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x3f')]){_0x33f492[_0x1e9e('0x40')]=[{'all':!![]}];}return db[_0x1e9e('0x3e')][_0x1e9e('0x41')](_0x33f492);})[_0x1e9e('0x26')](function(_0x18da0f){_0x4616c7[_0x1e9e('0x42')]=_0x18da0f;return _0x4616c7;})['then'](respondWithFilteredResult(_0x3fd8b5,_0x33f492))[_0x1e9e('0x43')](handleError(_0x3fd8b5,null));};exports[_0x1e9e('0x44')]=function(_0x4c2433,_0x493a1f){var _0x2d6516={'raw':!![],'where':{'id':_0x4c2433[_0x1e9e('0x45')]['id']}},_0x127cb7={};_0x127cb7['model']=_[_0x1e9e('0x31')](db[_0x1e9e('0x3e')][_0x1e9e('0x2d')]);_0x127cb7[_0x1e9e('0x30')]=_[_0x1e9e('0x31')](_0x4c2433[_0x1e9e('0x30')]);_0x127cb7['filters']=_[_0x1e9e('0x33')](_0x127cb7[_0x1e9e('0x2f')],_0x127cb7[_0x1e9e('0x30')]);_0x2d6516[_0x1e9e('0x34')]=_[_0x1e9e('0x33')](_0x127cb7[_0x1e9e('0x2f')],qs[_0x1e9e('0x35')](_0x4c2433[_0x1e9e('0x30')][_0x1e9e('0x35')]));_0x2d6516['attributes']=_0x2d6516[_0x1e9e('0x34')][_0x1e9e('0x46')]?_0x2d6516['attributes']:_0x127cb7[_0x1e9e('0x2f')];if(_0x4c2433[_0x1e9e('0x30')]['includeAll']){_0x2d6516[_0x1e9e('0x40')]=[{'all':!![]}];}_0x2d6516=_[_0x1e9e('0x3b')]({},_0x2d6516,_0x4c2433[_0x1e9e('0x3d')]);return db[_0x1e9e('0x3e')][_0x1e9e('0x47')](_0x2d6516)[_0x1e9e('0x26')](handleEntityNotFound(_0x493a1f,null))[_0x1e9e('0x26')](respondWithResult(_0x493a1f,null))[_0x1e9e('0x43')](handleError(_0x493a1f,null));};exports[_0x1e9e('0x48')]=function(_0x360db6,_0x5d2707){return db[_0x1e9e('0x3e')][_0x1e9e('0x48')](_0x360db6[_0x1e9e('0x49')],{})[_0x1e9e('0x26')](respondWithResult(_0x5d2707,0xc9))[_0x1e9e('0x43')](handleError(_0x5d2707,null));};exports[_0x1e9e('0x25')]=function(_0x1268b0,_0x434229){if(_0x1268b0[_0x1e9e('0x49')]['id']){delete _0x1268b0['body']['id'];}return db['JscriptyQuestionReport'][_0x1e9e('0x47')]({'where':{'id':_0x1268b0['params']['id']}})[_0x1e9e('0x26')](handleEntityNotFound(_0x434229,null))['then'](saveUpdates(_0x1268b0['body'],null))[_0x1e9e('0x26')](respondWithResult(_0x434229,null))[_0x1e9e('0x43')](handleError(_0x434229,null));};exports[_0x1e9e('0x4a')]=function(_0x3b090b,_0xff21a){return db[_0x1e9e('0x3e')]['find']({'where':{'id':_0x3b090b[_0x1e9e('0x45')]['id']}})[_0x1e9e('0x26')](handleEntityNotFound(_0xff21a,null))[_0x1e9e('0x26')](removeEntity(_0xff21a,null))[_0x1e9e('0x43')](handleError(_0xff21a,null));};exports[_0x1e9e('0x4b')]=function(_0x5775f1,_0x5698d7){return db[_0x1e9e('0x3e')][_0x1e9e('0x4b')]()[_0x1e9e('0x26')](respondWithResult(_0x5698d7,null))['catch'](handleError(_0x5698d7,null));}; \ No newline at end of file +var _0xf83b=['describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','includeAll','create','body','params','find'];(function(_0x11fd4e,_0x1a32ec){var _0x324371=function(_0x3f90a1){while(--_0x3f90a1){_0x11fd4e['push'](_0x11fd4e['shift']());}};_0x324371(++_0x1a32ec);}(_0xf83b,0x12d));var _0xbf83=function(_0x107028,_0x37b29c){_0x107028=_0x107028-0x0;var _0x22b328=_0xf83b[_0x107028];return _0x22b328;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbf83('0x0'));var zipdir=require(_0xbf83('0x1'));var jsonpatch=require(_0xbf83('0x2'));var rp=require(_0xbf83('0x3'));var moment=require(_0xbf83('0x4'));var BPromise=require(_0xbf83('0x5'));var Mustache=require(_0xbf83('0x6'));var util=require(_0xbf83('0x7'));var path=require(_0xbf83('0x8'));var sox=require(_0xbf83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf83('0xa'));var squel=require(_0xbf83('0xb'));var crypto=require(_0xbf83('0xc'));var jsforce=require(_0xbf83('0xd'));var deskjs=require(_0xbf83('0xe'));var toCsv=require(_0xbf83('0xf'));var querystring=require(_0xbf83('0x10'));var Papa=require(_0xbf83('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf83('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf83('0x13'))(_0xbf83('0x14'));var utils=require('../../config/utils');var config=require(_0xbf83('0x15'));var licenseUtil=require(_0xbf83('0x16'));var db=require(_0xbf83('0x17'))['db'];function respondWithStatusCode(_0x2a8ec8,_0x225abf){_0x225abf=_0x225abf||0xcc;return function(_0x20c875){if(_0x20c875){return _0x2a8ec8[_0xbf83('0x18')](_0x225abf);}return _0x2a8ec8['status'](_0x225abf)[_0xbf83('0x19')]();};}function respondWithResult(_0x2b27b9,_0x5964b4){_0x5964b4=_0x5964b4||0xc8;return function(_0x230a26){if(_0x230a26){return _0x2b27b9[_0xbf83('0x1a')](_0x5964b4)['json'](_0x230a26);}};}function respondWithFilteredResult(_0x15540d,_0x54fa3b){return function(_0x23e2c8){if(_0x23e2c8){var _0x3198c0=_0x23e2c8[_0xbf83('0x1b')],_0x4a4395=_0x54fa3b[_0xbf83('0x1c')],_0x3c4999=_0x54fa3b[_0xbf83('0x1c')]+_0x54fa3b[_0xbf83('0x1d')],_0x3db4a1;if(_0x3c4999>=_0x3198c0){_0x3c4999=_0x3198c0;_0x3db4a1=0xc8;}else{_0x3db4a1=0xce;}_0x15540d['status'](_0x3db4a1);return _0x15540d[_0xbf83('0x1e')]('Content-Range',_0x4a4395+'-'+_0x3c4999+'/'+_0x3198c0)[_0xbf83('0x1f')](_0x23e2c8);}return null;};}function patchUpdates(_0x23e0b5){return function(_0x586d03){try{jsonpatch[_0xbf83('0x20')](_0x586d03,_0x23e0b5,!![]);}catch(_0xae86e){return BPromise['reject'](_0xae86e);}return _0x586d03['save']();};}function saveUpdates(_0x4a933f,_0x9212b7){return function(_0x149f82){if(_0x149f82){return _0x149f82[_0xbf83('0x21')](_0x4a933f)[_0xbf83('0x22')](function(_0x56efe0){return _0x56efe0;});}return null;};}function removeEntity(_0x5021cd,_0x429194){return function(_0x426c2c){if(_0x426c2c){return _0x426c2c[_0xbf83('0x23')]()[_0xbf83('0x22')](function(){_0x5021cd[_0xbf83('0x1a')](0xcc)[_0xbf83('0x19')]();});}};}function handleEntityNotFound(_0xc062b7,_0x8a5fa3){return function(_0x2ae46a){if(!_0x2ae46a){_0xc062b7[_0xbf83('0x18')](0x194);}return _0x2ae46a;};}function handleError(_0x5db0dd,_0x332513){_0x332513=_0x332513||0x1f4;return function(_0x6a670){logger[_0xbf83('0x24')](_0x6a670[_0xbf83('0x25')]);if(_0x6a670[_0xbf83('0x26')]){delete _0x6a670[_0xbf83('0x26')];}_0x5db0dd['status'](_0x332513)[_0xbf83('0x27')](_0x6a670);};}exports[_0xbf83('0x28')]=function(_0x30b1b2,_0x2727a6){var _0x29ab9f={},_0x192e3a={},_0x4156df={'count':0x0,'rows':[]};var _0x2694f7=_[_0xbf83('0x29')](db[_0xbf83('0x2a')][_0xbf83('0x2b')],function(_0x5c197){return{'name':_0x5c197[_0xbf83('0x2c')],'type':_0x5c197[_0xbf83('0x2d')][_0xbf83('0x2e')]};});_0x192e3a['model']=_['map'](_0x2694f7,_0xbf83('0x26'));_0x192e3a[_0xbf83('0x2f')]=_[_0xbf83('0x30')](_0x30b1b2[_0xbf83('0x2f')]);_0x192e3a[_0xbf83('0x31')]=_[_0xbf83('0x32')](_0x192e3a[_0xbf83('0x33')],_0x192e3a[_0xbf83('0x2f')]);_0x29ab9f[_0xbf83('0x34')]=_['intersection'](_0x192e3a[_0xbf83('0x33')],qs[_0xbf83('0x35')](_0x30b1b2[_0xbf83('0x2f')][_0xbf83('0x35')]));_0x29ab9f[_0xbf83('0x34')]=_0x29ab9f[_0xbf83('0x34')][_0xbf83('0x36')]?_0x29ab9f[_0xbf83('0x34')]:_0x192e3a[_0xbf83('0x33')];if(!_0x30b1b2[_0xbf83('0x2f')][_0xbf83('0x37')](_0xbf83('0x38'))){_0x29ab9f[_0xbf83('0x1d')]=qs[_0xbf83('0x1d')](_0x30b1b2[_0xbf83('0x2f')]['limit']);_0x29ab9f[_0xbf83('0x1c')]=qs['offset'](_0x30b1b2[_0xbf83('0x2f')][_0xbf83('0x1c')]);}_0x29ab9f[_0xbf83('0x39')]=qs[_0xbf83('0x3a')](_0x30b1b2['query'][_0xbf83('0x3a')]);_0x29ab9f[_0xbf83('0x3b')]=qs[_0xbf83('0x31')](_[_0xbf83('0x3c')](_0x30b1b2[_0xbf83('0x2f')],_0x192e3a[_0xbf83('0x31')]),_0x2694f7);if(_0x30b1b2[_0xbf83('0x2f')]['filter']){_0x29ab9f['where']=_[_0xbf83('0x3d')](_0x29ab9f[_0xbf83('0x3b')],{'$or':_[_0xbf83('0x29')](_0x2694f7,function(_0xe6848b){if(_0xe6848b[_0xbf83('0x2d')]!==_0xbf83('0x3e')){var _0xb4fbf3={};_0xb4fbf3[_0xe6848b[_0xbf83('0x26')]]={'$like':'%'+_0x30b1b2[_0xbf83('0x2f')][_0xbf83('0x3f')]+'%'};return _0xb4fbf3;}})});}_0x29ab9f=_[_0xbf83('0x3d')]({},_0x29ab9f,_0x30b1b2[_0xbf83('0x40')]);var _0x5ead55={'where':_0x29ab9f['where']};return db[_0xbf83('0x2a')][_0xbf83('0x1b')](_0x5ead55)[_0xbf83('0x22')](function(_0x3e37c2){_0x4156df[_0xbf83('0x1b')]=_0x3e37c2;if(_0x30b1b2[_0xbf83('0x2f')]['includeAll']){_0x29ab9f['include']=[{'all':!![]}];}return db[_0xbf83('0x2a')][_0xbf83('0x41')](_0x29ab9f);})[_0xbf83('0x22')](function(_0x538977){_0x4156df[_0xbf83('0x42')]=_0x538977;return _0x4156df;})['then'](respondWithFilteredResult(_0x2727a6,_0x29ab9f))[_0xbf83('0x43')](handleError(_0x2727a6,null));};exports[_0xbf83('0x44')]=function(_0x457ac2,_0x15525d){var _0x1713a8={'raw':!![],'where':{'id':_0x457ac2['params']['id']}},_0x2ec3f9={};_0x2ec3f9[_0xbf83('0x33')]=_[_0xbf83('0x30')](db['JscriptyQuestionReport'][_0xbf83('0x2b')]);_0x2ec3f9[_0xbf83('0x2f')]=_[_0xbf83('0x30')](_0x457ac2[_0xbf83('0x2f')]);_0x2ec3f9[_0xbf83('0x31')]=_[_0xbf83('0x32')](_0x2ec3f9[_0xbf83('0x33')],_0x2ec3f9[_0xbf83('0x2f')]);_0x1713a8[_0xbf83('0x34')]=_[_0xbf83('0x32')](_0x2ec3f9[_0xbf83('0x33')],qs['fields'](_0x457ac2[_0xbf83('0x2f')][_0xbf83('0x35')]));_0x1713a8[_0xbf83('0x34')]=_0x1713a8[_0xbf83('0x34')][_0xbf83('0x36')]?_0x1713a8[_0xbf83('0x34')]:_0x2ec3f9[_0xbf83('0x33')];if(_0x457ac2[_0xbf83('0x2f')][_0xbf83('0x45')]){_0x1713a8['include']=[{'all':!![]}];}_0x1713a8=_[_0xbf83('0x3d')]({},_0x1713a8,_0x457ac2['options']);return db['JscriptyQuestionReport']['find'](_0x1713a8)['then'](handleEntityNotFound(_0x15525d,null))[_0xbf83('0x22')](respondWithResult(_0x15525d,null))[_0xbf83('0x43')](handleError(_0x15525d,null));};exports['create']=function(_0x5d4ab6,_0x484d04){return db[_0xbf83('0x2a')][_0xbf83('0x46')](_0x5d4ab6[_0xbf83('0x47')],{})[_0xbf83('0x22')](respondWithResult(_0x484d04,0xc9))[_0xbf83('0x43')](handleError(_0x484d04,null));};exports[_0xbf83('0x21')]=function(_0x4dd06d,_0x192f8d){if(_0x4dd06d['body']['id']){delete _0x4dd06d[_0xbf83('0x47')]['id'];}return db[_0xbf83('0x2a')]['find']({'where':{'id':_0x4dd06d[_0xbf83('0x48')]['id']}})[_0xbf83('0x22')](handleEntityNotFound(_0x192f8d,null))[_0xbf83('0x22')](saveUpdates(_0x4dd06d['body'],null))['then'](respondWithResult(_0x192f8d,null))['catch'](handleError(_0x192f8d,null));};exports[_0xbf83('0x23')]=function(_0x3877f6,_0x531fde){return db[_0xbf83('0x2a')][_0xbf83('0x49')]({'where':{'id':_0x3877f6[_0xbf83('0x48')]['id']}})[_0xbf83('0x22')](handleEntityNotFound(_0x531fde,null))[_0xbf83('0x22')](removeEntity(_0x531fde,null))[_0xbf83('0x43')](handleError(_0x531fde,null));};exports[_0xbf83('0x4a')]=function(_0x21c77a,_0x36efe3){return db[_0xbf83('0x2a')][_0xbf83('0x4a')]()[_0xbf83('0x22')](respondWithResult(_0x36efe3,null))[_0xbf83('0x43')](handleError(_0x36efe3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 1c9f6da..4566fc3 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 _0xb380=['report_jscripty_questions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x1d0b20,_0x15898a){var _0x563b0d=function(_0x51ccde){while(--_0x51ccde){_0x1d0b20['push'](_0x1d0b20['shift']());}};_0x563b0d(++_0x15898a);}(_0xb380,0x153));var _0x0b38=function(_0x4b8b94,_0x577c07){_0x4b8b94=_0x4b8b94-0x0;var _0x28dce7=_0xb380[_0x4b8b94];return _0x28dce7;};'use strict';var _=require(_0x0b38('0x0'));var util=require(_0x0b38('0x1'));var logger=require(_0x0b38('0x2'))('api');var moment=require(_0x0b38('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b38('0x4'));var fs=require('fs');var path=require(_0x0b38('0x5'));var rimraf=require(_0x0b38('0x6'));var config=require(_0x0b38('0x7'));var attributes=require(_0x0b38('0x8'));module[_0x0b38('0x9')]=function(_0x3d713f,_0x33cd85){return _0x3d713f[_0x0b38('0xa')](_0x0b38('0xb'),attributes,{'tableName':_0x0b38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4440=['moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0xf8a926,_0x2a3a58){var _0x30738a=function(_0x39976c){while(--_0x39976c){_0xf8a926['push'](_0xf8a926['shift']());}};_0x30738a(++_0x2a3a58);}(_0x4440,0xd9));var _0x0444=function(_0x5af7fa,_0x37605a){_0x5af7fa=_0x5af7fa-0x0;var _0x15ce10=_0x4440[_0x5af7fa];return _0x15ce10;};'use strict';var _=require(_0x0444('0x0'));var util=require(_0x0444('0x1'));var logger=require(_0x0444('0x2'))('api');var moment=require(_0x0444('0x3'));var BPromise=require(_0x0444('0x4'));var rp=require(_0x0444('0x5'));var fs=require('fs');var path=require(_0x0444('0x6'));var rimraf=require('rimraf');var config=require(_0x0444('0x7'));var attributes=require(_0x0444('0x8'));module['exports']=function(_0x407d8a,_0xac8756){return _0x407d8a['define'](_0x0444('0x9'),attributes,{'tableName':_0x0444('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 08c9fce..649b82e 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 _0x1b05=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x41ee3d,_0x147f4b){var _0x1818e1=function(_0x1fafe4){while(--_0x1fafe4){_0x41ee3d['push'](_0x41ee3d['shift']());}};_0x1818e1(++_0x147f4b);}(_0x1b05,0x1be));var _0x51b0=function(_0x4d1948,_0x81134b){_0x4d1948=_0x4d1948-0x0;var _0x1bb073=_0x1b05[_0x4d1948];return _0x1bb073;};'use strict';var _=require(_0x51b0('0x0'));var util=require(_0x51b0('0x1'));var moment=require('moment');var BPromise=require(_0x51b0('0x2'));var rs=require(_0x51b0('0x3'));var fs=require('fs');var Redis=require(_0x51b0('0x4'));var db=require(_0x51b0('0x5'))['db'];var utils=require(_0x51b0('0x6'));var logger=require(_0x51b0('0x7'))(_0x51b0('0x8'));var config=require(_0x51b0('0x9'));var jayson=require(_0x51b0('0xa'));var client=jayson[_0x51b0('0xb')][_0x51b0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a0f70,_0x5640dd,_0x1c3319){return new BPromise(function(_0x4ce070,_0x23bbf8){return client['request'](_0x2a0f70,_0x1c3319)[_0x51b0('0xd')](function(_0x3f781a){logger[_0x51b0('0xe')](_0x51b0('0xf'),_0x5640dd,_0x51b0('0x10'));logger['debug'](_0x51b0('0x11'),_0x5640dd,_0x51b0('0x10'),JSON['stringify'](_0x3f781a));if(_0x3f781a['error']){if(_0x3f781a[_0x51b0('0x12')][_0x51b0('0x13')]===0x1f4){logger[_0x51b0('0x12')](_0x51b0('0xf'),_0x5640dd,_0x3f781a[_0x51b0('0x12')]['message']);return _0x23bbf8(_0x3f781a[_0x51b0('0x12')][_0x51b0('0x14')]);}logger[_0x51b0('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5640dd,_0x3f781a[_0x51b0('0x12')]['message']);return _0x4ce070(_0x3f781a[_0x51b0('0x12')][_0x51b0('0x14')]);}else{logger[_0x51b0('0xe')](_0x51b0('0xf'),_0x5640dd,'request\x20sent');_0x4ce070(_0x3f781a[_0x51b0('0x15')][_0x51b0('0x14')]);}})[_0x51b0('0x16')](function(_0x5db9b2){logger[_0x51b0('0x12')](_0x51b0('0xf'),_0x5640dd,_0x5db9b2);_0x23bbf8(_0x5db9b2);});});} \ No newline at end of file +var _0x30e9=['error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x408758,_0x548c1f){var _0x2e25ae=function(_0x48ae5d){while(--_0x48ae5d){_0x408758['push'](_0x408758['shift']());}};_0x2e25ae(++_0x548c1f);}(_0x30e9,0x135));var _0x930e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x30e9[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var moment=require(_0x930e('0x2'));var BPromise=require(_0x930e('0x3'));var rs=require(_0x930e('0x4'));var fs=require('fs');var Redis=require(_0x930e('0x5'));var db=require(_0x930e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x930e('0x7'));var config=require(_0x930e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa0faad,_0x1f69a3,_0x591fa2){return new BPromise(function(_0x17cf31,_0x4a89ab){return client[_0x930e('0x9')](_0xa0faad,_0x591fa2)['then'](function(_0x5ac9ed){logger[_0x930e('0xa')](_0x930e('0xb'),_0x1f69a3,'request\x20sent');logger[_0x930e('0xc')](_0x930e('0xd'),_0x1f69a3,'request\x20sent',JSON['stringify'](_0x5ac9ed));if(_0x5ac9ed[_0x930e('0xe')]){if(_0x5ac9ed['error'][_0x930e('0xf')]===0x1f4){logger[_0x930e('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f69a3,_0x5ac9ed[_0x930e('0xe')][_0x930e('0x10')]);return _0x4a89ab(_0x5ac9ed[_0x930e('0xe')][_0x930e('0x10')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f69a3,_0x5ac9ed[_0x930e('0xe')]['message']);return _0x17cf31(_0x5ac9ed[_0x930e('0xe')][_0x930e('0x10')]);}else{logger[_0x930e('0xa')](_0x930e('0xb'),_0x1f69a3,_0x930e('0x11'));_0x17cf31(_0x5ac9ed[_0x930e('0x12')][_0x930e('0x10')]);}})['catch'](function(_0x13ad00){logger[_0x930e('0xe')](_0x930e('0xb'),_0x1f69a3,_0x13ad00);_0x4a89ab(_0x13ad00);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index bade980..a4ac9d5 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 _0xafdd=['isAuthenticated','index','/describe','/:id','/:id/questions','getQuestions','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0xafdd,0x19a));var _0xdafd=function(_0x1c152b,_0x532dfb){_0x1c152b=_0x1c152b-0x0;var _0x1038ec=_0xafdd[_0x1c152b];return _0x1038ec;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var auth=require(_0xdafd('0x6'));var interaction=require(_0xdafd('0x7'));var config=require('../../config/environment');var controller=require(_0xdafd('0x8'));router[_0xdafd('0x9')]('/',auth[_0xdafd('0xa')](),controller[_0xdafd('0xb')]);router[_0xdafd('0x9')](_0xdafd('0xc'),auth[_0xdafd('0xa')](),controller['describe']);router[_0xdafd('0x9')](_0xdafd('0xd'),auth[_0xdafd('0xa')](),controller['show']);router[_0xdafd('0x9')](_0xdafd('0xe'),auth[_0xdafd('0xa')](),controller[_0xdafd('0xf')]);router['post']('/',auth[_0xdafd('0xa')](),controller[_0xdafd('0x10')]);router[_0xdafd('0x11')](_0xdafd('0xd'),auth[_0xdafd('0xa')](),controller[_0xdafd('0x12')]);router['delete'](_0xdafd('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xdafd('0x13')]=router; \ No newline at end of file +var _0x28a2=['isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var path=require(_0x228a('0x2'));var timeout=require(_0x228a('0x3'));var express=require(_0x228a('0x4'));var router=express[_0x228a('0x5')]();var auth=require(_0x228a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x228a('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x228a('0x8')]('/',auth[_0x228a('0x9')](),controller[_0x228a('0xa')]);router[_0x228a('0x8')](_0x228a('0xb'),auth['isAuthenticated'](),controller[_0x228a('0xc')]);router[_0x228a('0x8')](_0x228a('0xd'),auth[_0x228a('0x9')](),controller['show']);router[_0x228a('0x8')](_0x228a('0xe'),auth[_0x228a('0x9')](),controller[_0x228a('0xf')]);router[_0x228a('0x10')]('/',auth[_0x228a('0x9')](),controller[_0x228a('0x11')]);router[_0x228a('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x228a('0x13')](_0x228a('0xd'),auth[_0x228a('0x9')](),controller[_0x228a('0x14')]);module[_0x228a('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 a3ac42e..b2e3352 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 _0xd973=['sequelize','exports','DATE','starttime','setDataValue','endtime','STRING','BOOLEAN','moment'];(function(_0x5dbf50,_0x393b72){var _0x48bea7=function(_0x8d357e){while(--_0x8d357e){_0x5dbf50['push'](_0x5dbf50['shift']());}};_0x48bea7(++_0x393b72);}(_0xd973,0x179));var _0x3d97=function(_0x57f2e9,_0x2a30ae){_0x57f2e9=_0x57f2e9-0x0;var _0x38860b=_0xd973[_0x57f2e9];return _0x38860b;};'use strict';var moment=require(_0x3d97('0x0'));var Sequelize=require(_0x3d97('0x1'));module[_0x3d97('0x2')]={'starttime':{'type':Sequelize[_0x3d97('0x3')],'set':function(_0xc99f82){this['setDataValue'](_0x3d97('0x4'),_0xc99f82);this[_0x3d97('0x5')](_0x3d97('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x3d97('0x7')]},'projectname':{'type':Sequelize[_0x3d97('0x7')]},'queue':{'type':Sequelize[_0x3d97('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3d97('0x7')]},'calleridnum':{'type':Sequelize[_0x3d97('0x7')]},'completed':{'type':Sequelize[_0x3d97('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xd3b8=['BOOLEAN','moment','setDataValue','starttime','endtime','DATE','STRING'];(function(_0x5cdae9,_0x5e30a9){var _0x417701=function(_0x3e0142){while(--_0x3e0142){_0x5cdae9['push'](_0x5cdae9['shift']());}};_0x417701(++_0x5e30a9);}(_0xd3b8,0x13c));var _0x8d3b=function(_0x53ff3b,_0x58f396){_0x53ff3b=_0x53ff3b-0x0;var _0x4d7ac2=_0xd3b8[_0x53ff3b];return _0x4d7ac2;};'use strict';var moment=require(_0x8d3b('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3eaca5){this[_0x8d3b('0x1')](_0x8d3b('0x2'),_0x3eaca5);this[_0x8d3b('0x1')](_0x8d3b('0x3'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x8d3b('0x4')]},'membername':{'type':Sequelize[_0x8d3b('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8d3b('0x5')]},'uniqueid':{'type':Sequelize[_0x8d3b('0x5')]},'calleridname':{'type':Sequelize[_0x8d3b('0x5')]},'calleridnum':{'type':Sequelize[_0x8d3b('0x5')]},'completed':{'type':Sequelize[_0x8d3b('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1c61466..ab2c468 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 _0xb7e7=['limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','JscriptySessionReport','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','length','include','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','filter','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x2d59bc,_0x48025f){var _0x2879f8=function(_0x4de2a8){while(--_0x4de2a8){_0x2d59bc['push'](_0x2d59bc['shift']());}};_0x2879f8(++_0x48025f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb7e7[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=_0x5703fd[_0x7b7e('0x1d')],_0xc7f087=_0x3d2fb2[_0x7b7e('0x1e')],_0x36444d=_0x3d2fb2[_0x7b7e('0x1e')]+_0x3d2fb2[_0x7b7e('0x1f')],_0x27f999;if(_0x36444d>=_0x51baf6){_0x36444d=_0x51baf6;_0x27f999=0xc8;}else{_0x27f999=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x27f999);return _0x457ec5[_0x7b7e('0x20')](_0x7b7e('0x21'),_0xc7f087+'-'+_0x36444d+'/'+_0x51baf6)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x14f4fe){return function(_0x448980){try{jsonpatch[_0x7b7e('0x22')](_0x448980,_0x14f4fe,!![]);}catch(_0x9776c3){return BPromise[_0x7b7e('0x23')](_0x9776c3);}return _0x448980[_0x7b7e('0x24')]();};}function saveUpdates(_0x49eddb,_0x69262b){return function(_0x43db4f){if(_0x43db4f){return _0x43db4f[_0x7b7e('0x25')](_0x49eddb)['then'](function(_0x313122){return _0x313122;});}return null;};}function removeEntity(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x26')]()[_0x7b7e('0x27')](function(){_0xbf0cb3[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x53bbb3,_0x5d6215){return function(_0x4a836a){if(!_0x4a836a){_0x53bbb3[_0x7b7e('0x19')](0x194);}return _0x4a836a;};}function handleError(_0x22598e,_0x23bfa3){_0x23bfa3=_0x23bfa3||0x1f4;return function(_0x483c6f){logger['error'](_0x483c6f['stack']);if(_0x483c6f[_0x7b7e('0x28')]){delete _0x483c6f[_0x7b7e('0x28')];}_0x22598e[_0x7b7e('0x1b')](_0x23bfa3)[_0x7b7e('0x29')](_0x483c6f);};}exports[_0x7b7e('0x2a')]=function(_0x48fad1,_0x6a1e71){var _0x21a15={},_0x4c46b8={},_0x57b9da={'count':0x0,'rows':[]};var _0x4e5de7=_[_0x7b7e('0x2b')](db[_0x7b7e('0x2c')]['rawAttributes'],function(_0x3db8c4){return{'name':_0x3db8c4['fieldName'],'type':_0x3db8c4[_0x7b7e('0x2d')][_0x7b7e('0x2e')]};});_0x4c46b8[_0x7b7e('0x2f')]=_['map'](_0x4e5de7,_0x7b7e('0x28'));_0x4c46b8[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x48fad1[_0x7b7e('0x30')]);_0x4c46b8[_0x7b7e('0x32')]=_['intersection'](_0x4c46b8[_0x7b7e('0x2f')],_0x4c46b8['query']);_0x21a15[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x4c46b8[_0x7b7e('0x2f')],qs[_0x7b7e('0x35')](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x35')]));_0x21a15[_0x7b7e('0x33')]=_0x21a15['attributes']['length']?_0x21a15[_0x7b7e('0x33')]:_0x4c46b8[_0x7b7e('0x2f')];if(!_0x48fad1['query'][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0x21a15[_0x7b7e('0x1f')]=qs['limit'](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0x21a15[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x1e')]);}_0x21a15[_0x7b7e('0x38')]=qs[_0x7b7e('0x39')](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x39')]);_0x21a15[_0x7b7e('0x3a')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3b')](_0x48fad1[_0x7b7e('0x30')],_0x4c46b8[_0x7b7e('0x32')]),_0x4e5de7);if(_0x48fad1[_0x7b7e('0x30')]['filter']){_0x21a15[_0x7b7e('0x3a')]=_[_0x7b7e('0x3c')](_0x21a15[_0x7b7e('0x3a')],{'$or':_[_0x7b7e('0x2b')](_0x4e5de7,function(_0x36abfc){if(_0x36abfc[_0x7b7e('0x2d')]!==_0x7b7e('0x3d')){var _0x1e6280={};_0x1e6280[_0x36abfc[_0x7b7e('0x28')]]={'$like':'%'+_0x48fad1[_0x7b7e('0x30')]['filter']+'%'};return _0x1e6280;}})});}_0x21a15=_[_0x7b7e('0x3c')]({},_0x21a15,_0x48fad1[_0x7b7e('0x3e')]);var _0x213a8c={'where':_0x21a15[_0x7b7e('0x3a')]};return db['JscriptySessionReport'][_0x7b7e('0x1d')](_0x213a8c)[_0x7b7e('0x27')](function(_0x3d5280){_0x57b9da['count']=_0x3d5280;if(_0x48fad1['query'][_0x7b7e('0x3f')]){_0x21a15['include']=[{'all':!![]}];}return db[_0x7b7e('0x2c')][_0x7b7e('0x40')](_0x21a15);})['then'](function(_0xa5daaa){_0x57b9da[_0x7b7e('0x41')]=_0xa5daaa;return _0x57b9da;})[_0x7b7e('0x27')](respondWithFilteredResult(_0x6a1e71,_0x21a15))[_0x7b7e('0x42')](handleError(_0x6a1e71,null));};exports[_0x7b7e('0x43')]=function(_0x435de5,_0xc888e4){var _0x1d9bb9={'raw':!![],'where':{'id':_0x435de5['params']['id']}},_0x157871={};_0x157871['model']=_[_0x7b7e('0x31')](db['JscriptySessionReport'][_0x7b7e('0x44')]);_0x157871['query']=_['keys'](_0x435de5[_0x7b7e('0x30')]);_0x157871['filters']=_[_0x7b7e('0x34')](_0x157871['model'],_0x157871[_0x7b7e('0x30')]);_0x1d9bb9[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x157871[_0x7b7e('0x2f')],qs['fields'](_0x435de5[_0x7b7e('0x30')][_0x7b7e('0x35')]));_0x1d9bb9[_0x7b7e('0x33')]=_0x1d9bb9[_0x7b7e('0x33')][_0x7b7e('0x45')]?_0x1d9bb9[_0x7b7e('0x33')]:_0x157871['model'];if(_0x435de5['query']['includeAll']){_0x1d9bb9[_0x7b7e('0x46')]=[{'all':!![]}];}_0x1d9bb9=_[_0x7b7e('0x3c')]({},_0x1d9bb9,_0x435de5[_0x7b7e('0x3e')]);return db[_0x7b7e('0x2c')][_0x7b7e('0x47')](_0x1d9bb9)[_0x7b7e('0x27')](handleEntityNotFound(_0xc888e4,null))['then'](respondWithResult(_0xc888e4,null))[_0x7b7e('0x42')](handleError(_0xc888e4,null));};exports[_0x7b7e('0x48')]=function(_0x5a0832,_0x5efcb8){return db[_0x7b7e('0x2c')][_0x7b7e('0x48')](_0x5a0832[_0x7b7e('0x49')],{})[_0x7b7e('0x27')](respondWithResult(_0x5efcb8,0xc9))[_0x7b7e('0x42')](handleError(_0x5efcb8,null));};exports[_0x7b7e('0x25')]=function(_0x590154,_0x2673eb){if(_0x590154['body']['id']){delete _0x590154[_0x7b7e('0x49')]['id'];}return db[_0x7b7e('0x2c')][_0x7b7e('0x47')]({'where':{'id':_0x590154[_0x7b7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2673eb,null))[_0x7b7e('0x27')](saveUpdates(_0x590154[_0x7b7e('0x49')],null))[_0x7b7e('0x27')](respondWithResult(_0x2673eb,null))[_0x7b7e('0x42')](handleError(_0x2673eb,null));};exports[_0x7b7e('0x26')]=function(_0x5cce7c,_0x14001c){return db[_0x7b7e('0x2c')][_0x7b7e('0x47')]({'where':{'id':_0x5cce7c[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x27')](handleEntityNotFound(_0x14001c,null))['then'](removeEntity(_0x14001c,null))[_0x7b7e('0x42')](handleError(_0x14001c,null));};exports[_0x7b7e('0x4b')]=function(_0x46d4ee,_0x3280fa){return db[_0x7b7e('0x2c')][_0x7b7e('0x4b')]()[_0x7b7e('0x27')](respondWithResult(_0x3280fa,null))['catch'](handleError(_0x3280fa,null));};exports[_0x7b7e('0x4c')]=function(_0x5d7c89,_0x16730c,_0x766a54){var _0x570303={'raw':!![],'where':{}};var _0x36f1be={};var _0x44e3a0={'count':0x0,'rows':[]};return db[_0x7b7e('0x2c')][_0x7b7e('0x4d')]({'where':{'id':_0x5d7c89[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x27')](handleEntityNotFound(_0x16730c,null))[_0x7b7e('0x27')](function(_0x5f15ce){if(_0x5f15ce){_0x36f1be[_0x7b7e('0x2f')]=_[_0x7b7e('0x31')](db[_0x7b7e('0x4e')][_0x7b7e('0x44')]);_0x36f1be['query']=_['keys'](_0x5d7c89['query']);_0x36f1be[_0x7b7e('0x32')]=_[_0x7b7e('0x34')](_0x36f1be[_0x7b7e('0x2f')],_0x36f1be['query']);_0x570303['attributes']=_[_0x7b7e('0x34')](_0x36f1be[_0x7b7e('0x2f')],qs['fields'](_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x35')]));_0x570303[_0x7b7e('0x33')]=_0x570303['attributes'][_0x7b7e('0x45')]?_0x570303[_0x7b7e('0x33')]:_0x36f1be['model'];if(!_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0x570303[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0x570303[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d7c89['query'][_0x7b7e('0x1e')]);}_0x570303[_0x7b7e('0x38')]=qs['sort'](_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x39')]);_0x570303[_0x7b7e('0x3a')]=qs['filters'](_[_0x7b7e('0x3b')](_0x5d7c89['query'],_0x36f1be[_0x7b7e('0x32')]));_0x570303[_0x7b7e('0x3a')]['SessionId']=_0x5f15ce['id'];if(_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x4f')]){_0x570303['where']=_[_0x7b7e('0x3c')](_0x570303[_0x7b7e('0x3a')],{'$or':_[_0x7b7e('0x2b')](_0x570303[_0x7b7e('0x33')],function(_0x5eb32c){var _0x101896={};_0x101896[_0x5eb32c]={'$like':'%'+_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x4f')]+'%'};return _0x101896;})});}_0x570303=_[_0x7b7e('0x3c')]({},_0x570303,_0x5d7c89[_0x7b7e('0x3e')]);return db[_0x7b7e('0x4e')][_0x7b7e('0x1d')]({'where':_0x570303[_0x7b7e('0x3a')]})[_0x7b7e('0x27')](function(_0x13c676){_0x44e3a0['count']=_0x13c676;if(_0x5d7c89[_0x7b7e('0x30')]['includeAll']){_0x570303['include']=[{'all':!![]}];}return db[_0x7b7e('0x4e')][_0x7b7e('0x40')](_0x570303);})[_0x7b7e('0x27')](function(_0x3dfd33){_0x44e3a0['rows']=_0x3dfd33;return _0x44e3a0;});}})[_0x7b7e('0x27')](respondWithFilteredResult(_0x16730c,_0x570303))[_0x7b7e('0x42')](handleError(_0x16730c,null));}; \ No newline at end of file +var _0xe706=['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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','length','catch','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','html-pdf','eml-format','rimraf'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xe706,0xa3));var _0x6e70=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xe706[_0x5317b5];return _0x3b7ce2;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=_0x5d9263['count'],_0x5c3fe7=_0x22c50c['offset'],_0x2efc0f=_0x22c50c[_0x6e70('0x1f')]+_0x22c50c['limit'],_0x161f23;if(_0x2efc0f>=_0x24f3ac){_0x2efc0f=_0x24f3ac;_0x161f23=0xc8;}else{_0x161f23=0xce;}_0x304716[_0x6e70('0x1e')](_0x161f23);return _0x304716[_0x6e70('0x20')]('Content-Range',_0x5c3fe7+'-'+_0x2efc0f+'/'+_0x24f3ac)['json'](_0x5d9263);}return null;};}function patchUpdates(_0xc238ba){return function(_0x208e21){try{jsonpatch[_0x6e70('0x21')](_0x208e21,_0xc238ba,!![]);}catch(_0x3a9978){return BPromise[_0x6e70('0x22')](_0x3a9978);}return _0x208e21[_0x6e70('0x23')]();};}function saveUpdates(_0x1b2453,_0x44a49f){return function(_0x29326f){if(_0x29326f){return _0x29326f[_0x6e70('0x24')](_0x1b2453)['then'](function(_0x228350){return _0x228350;});}return null;};}function removeEntity(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x25')]()[_0x6e70('0x26')](function(){_0x344b65[_0x6e70('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(!_0x50aec2){_0x10fc91['sendStatus'](0x194);}return _0x50aec2;};}function handleError(_0x41e352,_0x19c5ae){_0x19c5ae=_0x19c5ae||0x1f4;return function(_0x51d292){logger[_0x6e70('0x27')](_0x51d292[_0x6e70('0x28')]);if(_0x51d292['name']){delete _0x51d292[_0x6e70('0x29')];}_0x41e352[_0x6e70('0x1e')](_0x19c5ae)[_0x6e70('0x2a')](_0x51d292);};}exports['index']=function(_0x54a5fe,_0x2c4d37){var _0x3af17f={},_0x83c836={},_0x114344={'count':0x0,'rows':[]};var _0x43fee0=_['map'](db[_0x6e70('0x2b')][_0x6e70('0x2c')],function(_0xecf336){return{'name':_0xecf336[_0x6e70('0x2d')],'type':_0xecf336[_0x6e70('0x2e')][_0x6e70('0x2f')]};});_0x83c836[_0x6e70('0x30')]=_[_0x6e70('0x31')](_0x43fee0,_0x6e70('0x29'));_0x83c836[_0x6e70('0x32')]=_['keys'](_0x54a5fe[_0x6e70('0x32')]);_0x83c836['filters']=_[_0x6e70('0x33')](_0x83c836['model'],_0x83c836[_0x6e70('0x32')]);_0x3af17f[_0x6e70('0x34')]=_[_0x6e70('0x33')](_0x83c836['model'],qs[_0x6e70('0x35')](_0x54a5fe[_0x6e70('0x32')]['fields']));_0x3af17f[_0x6e70('0x34')]=_0x3af17f[_0x6e70('0x34')]['length']?_0x3af17f[_0x6e70('0x34')]:_0x83c836[_0x6e70('0x30')];if(!_0x54a5fe[_0x6e70('0x32')][_0x6e70('0x36')](_0x6e70('0x37'))){_0x3af17f[_0x6e70('0x38')]=qs[_0x6e70('0x38')](_0x54a5fe[_0x6e70('0x32')][_0x6e70('0x38')]);_0x3af17f[_0x6e70('0x1f')]=qs['offset'](_0x54a5fe[_0x6e70('0x32')]['offset']);}_0x3af17f[_0x6e70('0x39')]=qs[_0x6e70('0x3a')](_0x54a5fe[_0x6e70('0x32')][_0x6e70('0x3a')]);_0x3af17f[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_[_0x6e70('0x3d')](_0x54a5fe[_0x6e70('0x32')],_0x83c836[_0x6e70('0x3c')]),_0x43fee0);if(_0x54a5fe[_0x6e70('0x32')][_0x6e70('0x3e')]){_0x3af17f[_0x6e70('0x3b')]=_[_0x6e70('0x3f')](_0x3af17f['where'],{'$or':_['map'](_0x43fee0,function(_0x5424eb){if(_0x5424eb[_0x6e70('0x2e')]!==_0x6e70('0x40')){var _0x2cb5b0={};_0x2cb5b0[_0x5424eb[_0x6e70('0x29')]]={'$like':'%'+_0x54a5fe[_0x6e70('0x32')][_0x6e70('0x3e')]+'%'};return _0x2cb5b0;}})});}_0x3af17f=_['merge']({},_0x3af17f,_0x54a5fe[_0x6e70('0x41')]);var _0x9e7ad2={'where':_0x3af17f[_0x6e70('0x3b')]};return db[_0x6e70('0x2b')][_0x6e70('0x42')](_0x9e7ad2)[_0x6e70('0x26')](function(_0x246e61){_0x114344[_0x6e70('0x42')]=_0x246e61;if(_0x54a5fe['query'][_0x6e70('0x43')]){_0x3af17f[_0x6e70('0x44')]=[{'all':!![]}];}return db[_0x6e70('0x2b')][_0x6e70('0x45')](_0x3af17f);})[_0x6e70('0x26')](function(_0x1de947){_0x114344[_0x6e70('0x46')]=_0x1de947;return _0x114344;})['then'](respondWithFilteredResult(_0x2c4d37,_0x3af17f))['catch'](handleError(_0x2c4d37,null));};exports['show']=function(_0x154e0c,_0x2b63cc){var _0x83847b={'raw':!![],'where':{'id':_0x154e0c[_0x6e70('0x47')]['id']}},_0x64ff8e={};_0x64ff8e['model']=_[_0x6e70('0x48')](db[_0x6e70('0x2b')][_0x6e70('0x2c')]);_0x64ff8e['query']=_['keys'](_0x154e0c['query']);_0x64ff8e[_0x6e70('0x3c')]=_['intersection'](_0x64ff8e[_0x6e70('0x30')],_0x64ff8e[_0x6e70('0x32')]);_0x83847b[_0x6e70('0x34')]=_[_0x6e70('0x33')](_0x64ff8e['model'],qs[_0x6e70('0x35')](_0x154e0c['query'][_0x6e70('0x35')]));_0x83847b[_0x6e70('0x34')]=_0x83847b[_0x6e70('0x34')][_0x6e70('0x49')]?_0x83847b['attributes']:_0x64ff8e[_0x6e70('0x30')];if(_0x154e0c[_0x6e70('0x32')][_0x6e70('0x43')]){_0x83847b[_0x6e70('0x44')]=[{'all':!![]}];}_0x83847b=_[_0x6e70('0x3f')]({},_0x83847b,_0x154e0c[_0x6e70('0x41')]);return db[_0x6e70('0x2b')]['find'](_0x83847b)[_0x6e70('0x26')](handleEntityNotFound(_0x2b63cc,null))[_0x6e70('0x26')](respondWithResult(_0x2b63cc,null))[_0x6e70('0x4a')](handleError(_0x2b63cc,null));};exports[_0x6e70('0x4b')]=function(_0x3f86cf,_0x172e8a){return db[_0x6e70('0x2b')]['create'](_0x3f86cf[_0x6e70('0x4c')],{})['then'](respondWithResult(_0x172e8a,0xc9))[_0x6e70('0x4a')](handleError(_0x172e8a,null));};exports[_0x6e70('0x24')]=function(_0x4b351e,_0x53efc3){if(_0x4b351e[_0x6e70('0x4c')]['id']){delete _0x4b351e[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x2b')]['find']({'where':{'id':_0x4b351e['params']['id']}})[_0x6e70('0x26')](handleEntityNotFound(_0x53efc3,null))[_0x6e70('0x26')](saveUpdates(_0x4b351e[_0x6e70('0x4c')],null))[_0x6e70('0x26')](respondWithResult(_0x53efc3,null))[_0x6e70('0x4a')](handleError(_0x53efc3,null));};exports[_0x6e70('0x25')]=function(_0x4ad5a9,_0x756a5b){return db[_0x6e70('0x2b')][_0x6e70('0x4d')]({'where':{'id':_0x4ad5a9[_0x6e70('0x47')]['id']}})[_0x6e70('0x26')](handleEntityNotFound(_0x756a5b,null))['then'](removeEntity(_0x756a5b,null))['catch'](handleError(_0x756a5b,null));};exports[_0x6e70('0x4e')]=function(_0x2e3ea6,_0x34fdba){return db[_0x6e70('0x2b')][_0x6e70('0x4e')]()['then'](respondWithResult(_0x34fdba,null))[_0x6e70('0x4a')](handleError(_0x34fdba,null));};exports[_0x6e70('0x4f')]=function(_0x1fa320,_0x23ebfb,_0x3aba34){var _0x4a111a={'raw':!![],'where':{}};var _0x1142cd={};var _0x1dd242={'count':0x0,'rows':[]};return db[_0x6e70('0x2b')][_0x6e70('0x50')]({'where':{'id':_0x1fa320[_0x6e70('0x47')]['id']}})[_0x6e70('0x26')](handleEntityNotFound(_0x23ebfb,null))['then'](function(_0x40e7c6){if(_0x40e7c6){_0x1142cd[_0x6e70('0x30')]=_['keys'](db[_0x6e70('0x51')][_0x6e70('0x2c')]);_0x1142cd['query']=_[_0x6e70('0x48')](_0x1fa320[_0x6e70('0x32')]);_0x1142cd[_0x6e70('0x3c')]=_[_0x6e70('0x33')](_0x1142cd[_0x6e70('0x30')],_0x1142cd['query']);_0x4a111a[_0x6e70('0x34')]=_[_0x6e70('0x33')](_0x1142cd[_0x6e70('0x30')],qs[_0x6e70('0x35')](_0x1fa320[_0x6e70('0x32')][_0x6e70('0x35')]));_0x4a111a[_0x6e70('0x34')]=_0x4a111a[_0x6e70('0x34')][_0x6e70('0x49')]?_0x4a111a[_0x6e70('0x34')]:_0x1142cd[_0x6e70('0x30')];if(!_0x1fa320[_0x6e70('0x32')][_0x6e70('0x36')](_0x6e70('0x37'))){_0x4a111a[_0x6e70('0x38')]=qs[_0x6e70('0x38')](_0x1fa320[_0x6e70('0x32')][_0x6e70('0x38')]);_0x4a111a[_0x6e70('0x1f')]=qs[_0x6e70('0x1f')](_0x1fa320['query'][_0x6e70('0x1f')]);}_0x4a111a[_0x6e70('0x39')]=qs[_0x6e70('0x3a')](_0x1fa320[_0x6e70('0x32')][_0x6e70('0x3a')]);_0x4a111a[_0x6e70('0x3b')]=qs['filters'](_[_0x6e70('0x3d')](_0x1fa320[_0x6e70('0x32')],_0x1142cd['filters']));_0x4a111a[_0x6e70('0x3b')][_0x6e70('0x52')]=_0x40e7c6['id'];if(_0x1fa320[_0x6e70('0x32')]['filter']){_0x4a111a['where']=_[_0x6e70('0x3f')](_0x4a111a[_0x6e70('0x3b')],{'$or':_[_0x6e70('0x31')](_0x4a111a[_0x6e70('0x34')],function(_0x10d299){var _0x739946={};_0x739946[_0x10d299]={'$like':'%'+_0x1fa320[_0x6e70('0x32')]['filter']+'%'};return _0x739946;})});}_0x4a111a=_['merge']({},_0x4a111a,_0x1fa320[_0x6e70('0x41')]);return db[_0x6e70('0x51')][_0x6e70('0x42')]({'where':_0x4a111a[_0x6e70('0x3b')]})['then'](function(_0x517c8b){_0x1dd242[_0x6e70('0x42')]=_0x517c8b;if(_0x1fa320[_0x6e70('0x32')]['includeAll']){_0x4a111a['include']=[{'all':!![]}];}return db[_0x6e70('0x51')]['findAll'](_0x4a111a);})[_0x6e70('0x26')](function(_0x23900b){_0x1dd242[_0x6e70('0x46')]=_0x23900b;return _0x1dd242;});}})[_0x6e70('0x26')](respondWithFilteredResult(_0x23ebfb,_0x4a111a))[_0x6e70('0x4a')](handleError(_0x23ebfb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a5425e8..7cc95be 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 _0x4612=['util','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x5dbb3e,_0x4b494d){var _0x138d23=function(_0x414fb4){while(--_0x414fb4){_0x5dbb3e['push'](_0x5dbb3e['shift']());}};_0x138d23(++_0x4b494d);}(_0x4612,0xe6));var _0x2461=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4612[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2461('0x0'));var util=require(_0x2461('0x1'));var logger=require('../../config/logger')(_0x2461('0x2'));var moment=require(_0x2461('0x3'));var BPromise=require(_0x2461('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2461('0x5'));var rimraf=require(_0x2461('0x6'));var config=require('../../config/environment');var attributes=require(_0x2461('0x7'));module['exports']=function(_0x573126,_0x20cc6d){return _0x573126[_0x2461('0x8')](_0x2461('0x9'),attributes,{'tableName':_0x2461('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cc5=['api','moment','bluebird','rimraf','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x28e46b,_0x2a1017){var _0x5e8da0=function(_0x4eaaa7){while(--_0x4eaaa7){_0x28e46b['push'](_0x28e46b['shift']());}};_0x5e8da0(++_0x2a1017);}(_0x4cc5,0x17a));var _0x54cc=function(_0xc91d20,_0x5712f6){_0xc91d20=_0xc91d20-0x0;var _0x46d8ca=_0x4cc5[_0xc91d20];return _0x46d8ca;};'use strict';var _=require(_0x54cc('0x0'));var util=require('util');var logger=require(_0x54cc('0x1'))(_0x54cc('0x2'));var moment=require(_0x54cc('0x3'));var BPromise=require(_0x54cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54cc('0x5'));var config=require('../../config/environment');var attributes=require(_0x54cc('0x6'));module['exports']=function(_0xc7c9ed,_0x4014e2){return _0xc7c9ed[_0x54cc('0x7')](_0x54cc('0x8'),attributes,{'tableName':_0x54cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 285b68e..8e16146 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 _0x4c6b=['http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1c63a4,_0x250c56){var _0x1185f5=function(_0x4a39f1){while(--_0x4a39f1){_0x1c63a4['push'](_0x1c63a4['shift']());}};_0x1185f5(++_0x250c56);}(_0x4c6b,0xe4));var _0xb4c6=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x4c6b[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xb4c6('0x0'));var util=require(_0xb4c6('0x1'));var moment=require(_0xb4c6('0x2'));var BPromise=require(_0xb4c6('0x3'));var rs=require(_0xb4c6('0x4'));var fs=require('fs');var Redis=require(_0xb4c6('0x5'));var db=require(_0xb4c6('0x6'))['db'];var utils=require(_0xb4c6('0x7'));var logger=require(_0xb4c6('0x8'))('rpc');var config=require(_0xb4c6('0x9'));var jayson=require(_0xb4c6('0xa'));var client=jayson[_0xb4c6('0xb')][_0xb4c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31b3f3,_0x19a7e2,_0x56a8bf){return new BPromise(function(_0x3b64ba,_0x5a9952){return client[_0xb4c6('0xd')](_0x31b3f3,_0x56a8bf)[_0xb4c6('0xe')](function(_0xd9ce5f){logger[_0xb4c6('0xf')](_0xb4c6('0x10'),_0x19a7e2,_0xb4c6('0x11'));logger[_0xb4c6('0x12')](_0xb4c6('0x13'),_0x19a7e2,_0xb4c6('0x11'),JSON[_0xb4c6('0x14')](_0xd9ce5f));if(_0xd9ce5f[_0xb4c6('0x15')]){if(_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x16')]===0x1f4){logger[_0xb4c6('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x19a7e2,_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x17')]);return _0x5a9952(_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x17')]);}logger[_0xb4c6('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x19a7e2,_0xd9ce5f[_0xb4c6('0x15')]['message']);return _0x3b64ba(_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x17')]);}else{logger['info'](_0xb4c6('0x10'),_0x19a7e2,_0xb4c6('0x11'));_0x3b64ba(_0xd9ce5f['result'][_0xb4c6('0x17')]);}})['catch'](function(_0x643bc){logger[_0xb4c6('0x15')](_0xb4c6('0x10'),_0x19a7e2,_0x643bc);_0x5a9952(_0x643bc);});});} \ No newline at end of file +var _0x05cc=['request\x20sent','debug','JscriptySessionReport,\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','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x5b9422,_0x4c7b79){var _0x5b0763=function(_0x5ce1e7){while(--_0x5ce1e7){_0x5b9422['push'](_0x5b9422['shift']());}};_0x5b0763(++_0x4c7b79);}(_0x05cc,0xd9));var _0xc05c=function(_0x445d5f,_0x5a0522){_0x445d5f=_0x445d5f-0x0;var _0x39da87=_0x05cc[_0x445d5f];return _0x39da87;};'use strict';var _=require(_0xc05c('0x0'));var util=require(_0xc05c('0x1'));var moment=require(_0xc05c('0x2'));var BPromise=require(_0xc05c('0x3'));var rs=require(_0xc05c('0x4'));var fs=require('fs');var Redis=require(_0xc05c('0x5'));var db=require(_0xc05c('0x6'))['db'];var utils=require(_0xc05c('0x7'));var logger=require(_0xc05c('0x8'))(_0xc05c('0x9'));var config=require(_0xc05c('0xa'));var jayson=require(_0xc05c('0xb'));var client=jayson[_0xc05c('0xc')][_0xc05c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x590308,_0x5943be,_0x4578c7){return new BPromise(function(_0x36450,_0x31134a){return client[_0xc05c('0xe')](_0x590308,_0x4578c7)['then'](function(_0x1ca4d9){logger[_0xc05c('0xf')](_0xc05c('0x10'),_0x5943be,_0xc05c('0x11'));logger[_0xc05c('0x12')](_0xc05c('0x13'),_0x5943be,_0xc05c('0x11'),JSON[_0xc05c('0x14')](_0x1ca4d9));if(_0x1ca4d9[_0xc05c('0x15')]){if(_0x1ca4d9[_0xc05c('0x15')][_0xc05c('0x16')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5943be,_0x1ca4d9['error'][_0xc05c('0x17')]);return _0x31134a(_0x1ca4d9[_0xc05c('0x15')][_0xc05c('0x17')]);}logger['error'](_0xc05c('0x10'),_0x5943be,_0x1ca4d9['error'][_0xc05c('0x17')]);return _0x36450(_0x1ca4d9[_0xc05c('0x15')][_0xc05c('0x17')]);}else{logger[_0xc05c('0xf')](_0xc05c('0x10'),_0x5943be,'request\x20sent');_0x36450(_0x1ca4d9[_0xc05c('0x18')][_0xc05c('0x17')]);}})[_0xc05c('0x19')](function(_0x496fb0){logger['error'](_0xc05c('0x10'),_0x5943be,_0x496fb0);_0x31134a(_0x496fb0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d5afa44..113acdd 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 _0x931f=['get','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x444389,_0x3f91ea){var _0x29a308=function(_0x50b058){while(--_0x50b058){_0x444389['push'](_0x444389['shift']());}};_0x29a308(++_0x3f91ea);}(_0x931f,0x18d));var _0xf931=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x931f[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var path=require('path');var timeout=require(_0xf931('0x2'));var express=require(_0xf931('0x3'));var router=express[_0xf931('0x4')]();var auth=require(_0xf931('0x5'));var interaction=require(_0xf931('0x6'));var config=require(_0xf931('0x7'));var controller=require(_0xf931('0x8'));router[_0xf931('0x9')]('/',controller['index']);router[_0xf931('0xa')]('/:id',auth[_0xf931('0xb')](),controller[_0xf931('0xc')]);module[_0xf931('0xd')]=router; \ No newline at end of file +var _0xc0df=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','isAuthenticated','update','exports'];(function(_0x4f768a,_0x413685){var _0x4ab541=function(_0x213c3a){while(--_0x213c3a){_0x4f768a['push'](_0x4f768a['shift']());}};_0x4ab541(++_0x413685);}(_0xc0df,0x12b));var _0xfc0d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc0df[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xfc0d('0x0'));var util=require(_0xfc0d('0x1'));var path=require(_0xfc0d('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc0d('0x3'));var router=express['Router']();var auth=require(_0xfc0d('0x4'));var interaction=require(_0xfc0d('0x5'));var config=require(_0xfc0d('0x6'));var controller=require(_0xfc0d('0x7'));router[_0xfc0d('0x8')]('/',controller[_0xfc0d('0x9')]);router['put']('/:id',auth[_0xfc0d('0xa')](),controller[_0xfc0d('0xb')]);module[_0xfc0d('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 663bbfc..c463315 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 _0xdbf5=['exports','STRING','INTEGER'];(function(_0x182baf,_0x1375fb){var _0x4d10f1=function(_0x1e0dde){while(--_0x1e0dde){_0x182baf['push'](_0x182baf['shift']());}};_0x4d10f1(++_0x1375fb);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1421fd,_0x22f5a1){_0x1421fd=_0x1421fd-0x0;var _0x14a7d4=_0xdbf5[_0x1421fd];return _0x14a7d4;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ef3=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0xe55fe5,_0x506113){var _0x3e3e0a=function(_0x4a2a6d){while(--_0x4a2a6d){_0xe55fe5['push'](_0xe55fe5['shift']());}};_0x3e3e0a(++_0x506113);}(_0x2ef3,0xba));var _0x32ef=function(_0x1fe16c,_0x2c07db){_0x1fe16c=_0x1fe16c-0x0;var _0x3b2e4a=_0x2ef3[_0x1fe16c];return _0x3b2e4a;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'license':{'type':Sequelize[_0x32ef('0x2')]},'data1':{'type':Sequelize[_0x32ef('0x3')]},'data2':{'type':Sequelize[_0x32ef('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 3aa88b3..901ecd3 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 _0x4a9c=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','../../config/license/util','model','keys','query','intersection','attributes','fields','options','getLicense','catch','update','body','License','find','checkLicense','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x5df760,_0x1fa2d6){_0x5df760=_0x5df760-0x0;var _0x3b9406=_0x4a9c[_0x5df760];return _0x3b9406;};'use strict';var pdf=require(_0xc4a9('0x0'));var emlformat=require(_0xc4a9('0x1'));var rimraf=require(_0xc4a9('0x2'));var zipdir=require(_0xc4a9('0x3'));var jsonpatch=require(_0xc4a9('0x4'));var rp=require(_0xc4a9('0x5'));var moment=require('moment');var BPromise=require(_0xc4a9('0x6'));var Mustache=require(_0xc4a9('0x7'));var util=require(_0xc4a9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc4a9('0x9'));var ejs=require(_0xc4a9('0xa'));var fs=require('fs');var _=require(_0xc4a9('0xb'));var squel=require(_0xc4a9('0xc'));var crypto=require('crypto');var jsforce=require(_0xc4a9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc4a9('0xe'));var Papa=require(_0xc4a9('0xf'));var Redis=require(_0xc4a9('0x10'));var authService=require(_0xc4a9('0x11'));var qs=require(_0xc4a9('0x12'));var as=require(_0xc4a9('0x13'));var hardwareService=require(_0xc4a9('0x14'));var logger=require(_0xc4a9('0x15'))(_0xc4a9('0x16'));var utils=require(_0xc4a9('0x17'));var config=require(_0xc4a9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4a9('0x19'))['db'];function respondWithStatusCode(_0x3ac5f1,_0x30e778){_0x30e778=_0x30e778||0xcc;return function(_0x508d89){if(_0x508d89){return _0x3ac5f1[_0xc4a9('0x1a')](_0x30e778);}return _0x3ac5f1[_0xc4a9('0x1b')](_0x30e778)['end']();};}function respondWithResult(_0x57262c,_0x805c71){_0x805c71=_0x805c71||0xc8;return function(_0x573459){if(_0x573459){return _0x57262c[_0xc4a9('0x1b')](_0x805c71)[_0xc4a9('0x1c')](_0x573459);}};}function respondWithFilteredResult(_0x3a955e,_0x2a48e6){return function(_0x5b16d3){if(_0x5b16d3){var _0x51d842=_0x5b16d3['count'],_0xaaecf0=_0x2a48e6[_0xc4a9('0x1d')],_0x585f41=_0x2a48e6[_0xc4a9('0x1d')]+_0x2a48e6['limit'],_0x5e83dc;if(_0x585f41>=_0x51d842){_0x585f41=_0x51d842;_0x5e83dc=0xc8;}else{_0x5e83dc=0xce;}_0x3a955e[_0xc4a9('0x1b')](_0x5e83dc);return _0x3a955e['set'](_0xc4a9('0x1e'),_0xaaecf0+'-'+_0x585f41+'/'+_0x51d842)[_0xc4a9('0x1c')](_0x5b16d3);}return null;};}function patchUpdates(_0x3c0327){return function(_0x4eec0e){try{jsonpatch[_0xc4a9('0x1f')](_0x4eec0e,_0x3c0327,!![]);}catch(_0x21698c){return BPromise[_0xc4a9('0x20')](_0x21698c);}return _0x4eec0e[_0xc4a9('0x21')]();};}function saveUpdates(_0xedb6f0,_0x5707f6){return function(_0x17d723){if(_0x17d723){return _0x17d723['update'](_0xedb6f0)[_0xc4a9('0x22')](function(_0x1e2840){return _0x1e2840;});}return null;};}function removeEntity(_0x1ff265,_0x2dadf1){return function(_0x56dc6b){if(_0x56dc6b){return _0x56dc6b[_0xc4a9('0x23')]()[_0xc4a9('0x22')](function(){_0x1ff265['status'](0xcc)[_0xc4a9('0x24')]();});}};}function handleEntityNotFound(_0x29cbc6,_0x5f017a){return function(_0x127e17){if(!_0x127e17){_0x29cbc6[_0xc4a9('0x1a')](0x194);}return _0x127e17;};}function handleError(_0x4b7c94,_0x56a436){_0x56a436=_0x56a436||0x1f4;return function(_0x10f05f){logger[_0xc4a9('0x25')](_0x10f05f[_0xc4a9('0x26')]);if(_0x10f05f[_0xc4a9('0x27')]){delete _0x10f05f[_0xc4a9('0x27')];}_0x4b7c94[_0xc4a9('0x1b')](_0x56a436)[_0xc4a9('0x28')](_0x10f05f);};}var utilLicense=require(_0xc4a9('0x29'));exports['index']=function(_0x56cd22,_0x2fc199){var _0xa31b6f={'raw':!![],'where':{'id':0x1}},_0x48bb2c={};_0x48bb2c[_0xc4a9('0x2a')]=_[_0xc4a9('0x2b')](db['License']['rawAttributes']);_0x48bb2c[_0xc4a9('0x2c')]=_[_0xc4a9('0x2b')](_0x56cd22[_0xc4a9('0x2c')]);_0x48bb2c['filters']=_[_0xc4a9('0x2d')](_0x48bb2c[_0xc4a9('0x2a')],_0x48bb2c['query']);_0xa31b6f[_0xc4a9('0x2e')]=_[_0xc4a9('0x2d')](_0x48bb2c[_0xc4a9('0x2a')],qs[_0xc4a9('0x2f')](_0x56cd22['query']['fields']));_0xa31b6f[_0xc4a9('0x2e')]=_0xa31b6f['attributes']['length']?_0xa31b6f[_0xc4a9('0x2e')]:_0x48bb2c[_0xc4a9('0x2a')];_0xa31b6f=_['merge']({},_0xa31b6f,_0x56cd22[_0xc4a9('0x30')]);return utilLicense[_0xc4a9('0x31')](_0xa31b6f)['then'](respondWithResult(_0x2fc199,null))[_0xc4a9('0x32')](handleError(_0x2fc199,null));};exports[_0xc4a9('0x33')]=function(_0x1e96e7,_0x3152a5){if(_0x1e96e7[_0xc4a9('0x34')]['id']){delete _0x1e96e7['body']['id'];}return db[_0xc4a9('0x35')][_0xc4a9('0x36')]({'where':{'id':_0x1e96e7['params']['id']}})['then'](handleEntityNotFound(_0x3152a5,null))[_0xc4a9('0x22')](function(_0x48e8bd){var _0x119996=_0x48e8bd['get']({'plain':!![]});return utilLicense[_0xc4a9('0x37')](_0x119996,_0x1e96e7['body']['key']);})[_0xc4a9('0x22')](function(_0x8ec037){if(!_0x8ec037[_0xc4a9('0x38')]){return saveUpdates(_0x1e96e7[_0xc4a9('0x34')],null);}return _0x8ec037;})[_0xc4a9('0x22')](respondWithResult(_0x3152a5,null))[_0xc4a9('0x32')](handleError(_0x3152a5,null));}; \ No newline at end of file +var _0x3dd6=['save','update','destroy','then','error','stack','name','index','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','body','License','params','get','checkLicense','key','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x1b62b8,_0x3e78d9){var _0x47a5a0=function(_0x479a5b){while(--_0x479a5b){_0x1b62b8['push'](_0x1b62b8['shift']());}};_0x47a5a0(++_0x3e78d9);}(_0x3dd6,0xcf));var _0x63dd=function(_0xa9c870,_0x111b20){_0xa9c870=_0xa9c870-0x0;var _0x2d13a3=_0x3dd6[_0xa9c870];return _0x2d13a3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63dd('0x0'));var jsonpatch=require(_0x63dd('0x1'));var rp=require(_0x63dd('0x2'));var moment=require(_0x63dd('0x3'));var BPromise=require(_0x63dd('0x4'));var Mustache=require(_0x63dd('0x5'));var util=require('util');var path=require(_0x63dd('0x6'));var sox=require('sox');var csv=require(_0x63dd('0x7'));var ejs=require(_0x63dd('0x8'));var fs=require('fs');var _=require(_0x63dd('0x9'));var squel=require(_0x63dd('0xa'));var crypto=require(_0x63dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x63dd('0xc'));var toCsv=require(_0x63dd('0x7'));var querystring=require(_0x63dd('0xd'));var Papa=require(_0x63dd('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x63dd('0xf'));var as=require(_0x63dd('0x10'));var hardwareService=require(_0x63dd('0x11'));var logger=require(_0x63dd('0x12'))(_0x63dd('0x13'));var utils=require('../../config/utils');var config=require(_0x63dd('0x14'));var licenseUtil=require(_0x63dd('0x15'));var db=require(_0x63dd('0x16'))['db'];function respondWithStatusCode(_0x35ba9e,_0x5a75b1){_0x5a75b1=_0x5a75b1||0xcc;return function(_0x4a842d){if(_0x4a842d){return _0x35ba9e[_0x63dd('0x17')](_0x5a75b1);}return _0x35ba9e[_0x63dd('0x18')](_0x5a75b1)[_0x63dd('0x19')]();};}function respondWithResult(_0x313f45,_0x3a0981){_0x3a0981=_0x3a0981||0xc8;return function(_0x56c030){if(_0x56c030){return _0x313f45['status'](_0x3a0981)[_0x63dd('0x1a')](_0x56c030);}};}function respondWithFilteredResult(_0xa6ffcf,_0x2bb9f6){return function(_0x4d6623){if(_0x4d6623){var _0x4144eb=_0x4d6623[_0x63dd('0x1b')],_0x3c9b5e=_0x2bb9f6[_0x63dd('0x1c')],_0x1af946=_0x2bb9f6[_0x63dd('0x1c')]+_0x2bb9f6[_0x63dd('0x1d')],_0x586c2b;if(_0x1af946>=_0x4144eb){_0x1af946=_0x4144eb;_0x586c2b=0xc8;}else{_0x586c2b=0xce;}_0xa6ffcf[_0x63dd('0x18')](_0x586c2b);return _0xa6ffcf[_0x63dd('0x1e')](_0x63dd('0x1f'),_0x3c9b5e+'-'+_0x1af946+'/'+_0x4144eb)[_0x63dd('0x1a')](_0x4d6623);}return null;};}function patchUpdates(_0x40cd07){return function(_0x8f2691){try{jsonpatch[_0x63dd('0x20')](_0x8f2691,_0x40cd07,!![]);}catch(_0x1e09a5){return BPromise['reject'](_0x1e09a5);}return _0x8f2691[_0x63dd('0x21')]();};}function saveUpdates(_0x596046,_0x466dac){return function(_0x1d4920){if(_0x1d4920){return _0x1d4920[_0x63dd('0x22')](_0x596046)['then'](function(_0x3dbdf1){return _0x3dbdf1;});}return null;};}function removeEntity(_0x38bd01,_0x4a1622){return function(_0x887c58){if(_0x887c58){return _0x887c58[_0x63dd('0x23')]()[_0x63dd('0x24')](function(){_0x38bd01[_0x63dd('0x18')](0xcc)[_0x63dd('0x19')]();});}};}function handleEntityNotFound(_0x379338,_0x4b2451){return function(_0x52cec7){if(!_0x52cec7){_0x379338['sendStatus'](0x194);}return _0x52cec7;};}function handleError(_0x340725,_0x462812){_0x462812=_0x462812||0x1f4;return function(_0x540a9f){logger[_0x63dd('0x25')](_0x540a9f[_0x63dd('0x26')]);if(_0x540a9f['name']){delete _0x540a9f[_0x63dd('0x27')];}_0x340725[_0x63dd('0x18')](_0x462812)['send'](_0x540a9f);};}var utilLicense=require('../../config/license/util');exports[_0x63dd('0x28')]=function(_0x474f3e,_0x105618){var _0x138a0c={'raw':!![],'where':{'id':0x1}},_0x15a13d={};_0x15a13d['model']=_[_0x63dd('0x29')](db['License'][_0x63dd('0x2a')]);_0x15a13d['query']=_['keys'](_0x474f3e[_0x63dd('0x2b')]);_0x15a13d[_0x63dd('0x2c')]=_[_0x63dd('0x2d')](_0x15a13d[_0x63dd('0x2e')],_0x15a13d[_0x63dd('0x2b')]);_0x138a0c[_0x63dd('0x2f')]=_['intersection'](_0x15a13d[_0x63dd('0x2e')],qs[_0x63dd('0x30')](_0x474f3e[_0x63dd('0x2b')][_0x63dd('0x30')]));_0x138a0c['attributes']=_0x138a0c[_0x63dd('0x2f')][_0x63dd('0x31')]?_0x138a0c[_0x63dd('0x2f')]:_0x15a13d['model'];_0x138a0c=_[_0x63dd('0x32')]({},_0x138a0c,_0x474f3e[_0x63dd('0x33')]);return utilLicense[_0x63dd('0x34')](_0x138a0c)[_0x63dd('0x24')](respondWithResult(_0x105618,null))['catch'](handleError(_0x105618,null));};exports['update']=function(_0x199235,_0x5f5191){if(_0x199235[_0x63dd('0x35')]['id']){delete _0x199235[_0x63dd('0x35')]['id'];}return db[_0x63dd('0x36')]['find']({'where':{'id':_0x199235[_0x63dd('0x37')]['id']}})[_0x63dd('0x24')](handleEntityNotFound(_0x5f5191,null))[_0x63dd('0x24')](function(_0x4c32e0){var _0x3f7ecd=_0x4c32e0[_0x63dd('0x38')]({'plain':!![]});return utilLicense[_0x63dd('0x39')](_0x3f7ecd,_0x199235[_0x63dd('0x35')][_0x63dd('0x3a')]);})[_0x63dd('0x24')](function(_0x52bf08){if(!_0x52bf08['demo']){return saveUpdates(_0x199235[_0x63dd('0x35')],null);}return _0x52bf08;})[_0x63dd('0x24')](respondWithResult(_0x5f5191,null))[_0x63dd('0x3b')](handleError(_0x5f5191,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 088a10b..41227d9 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 _0xfb8e=['../../config/logger','moment','request-promise','../../config/environment','./license.attributes','define','License','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb8e,0xd6));var _0xefb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb8e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xefb8('0x0'));var util=require(_0xefb8('0x1'));var logger=require(_0xefb8('0x2'))('api');var moment=require(_0xefb8('0x3'));var BPromise=require('bluebird');var rp=require(_0xefb8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xefb8('0x5'));var attributes=require(_0xefb8('0x6'));module['exports']=function(_0x69e33a,_0x2f053d){return _0x69e33a[_0xefb8('0x7')](_0xefb8('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6bd=['request-promise','rimraf','./license.attributes','exports','define','License','license','lodash','../../config/logger','api','moment'];(function(_0x2a61b8,_0x4e0bf8){var _0x2e378a=function(_0x253731){while(--_0x253731){_0x2a61b8['push'](_0x2a61b8['shift']());}};_0x2e378a(++_0x4e0bf8);}(_0xc6bd,0x130));var _0xdc6b=function(_0x353f52,_0xe40124){_0x353f52=_0x353f52-0x0;var _0x44e3ec=_0xc6bd[_0x353f52];return _0x44e3ec;};'use strict';var _=require(_0xdc6b('0x0'));var util=require('util');var logger=require(_0xdc6b('0x1'))(_0xdc6b('0x2'));var moment=require(_0xdc6b('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc6b('0x5'));var config=require('../../config/environment');var attributes=require(_0xdc6b('0x6'));module[_0xdc6b('0x7')]=function(_0x1616b4,_0x2670e2){return _0x1616b4[_0xdc6b('0x8')](_0xdc6b('0x9'),attributes,{'tableName':_0xdc6b('0xa'),'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 fdb911f..de704ad 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 _0xd52d=['jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1408ec,_0x5adec8){var _0x5f40c9=function(_0x4444fd){while(--_0x4444fd){_0x1408ec['push'](_0x1408ec['shift']());}};_0x5f40c9(++_0x5adec8);}(_0xd52d,0x1c7));var _0xdd52=function(_0x1a9e06,_0x3086ce){_0x1a9e06=_0x1a9e06-0x0;var _0xe772b0=_0xd52d[_0x1a9e06];return _0xe772b0;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});} \ No newline at end of file +var _0x1a83=['License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x518fed,_0x1e50af){var _0xbd5aad=function(_0x43e9a1){while(--_0x43e9a1){_0x518fed['push'](_0x518fed['shift']());}};_0xbd5aad(++_0x1e50af);}(_0x1a83,0x1c0));var _0x31a8=function(_0x348a95,_0x1d2bf7){_0x348a95=_0x348a95-0x0;var _0x4071dd=_0x1a83[_0x348a95];return _0x4071dd;};'use strict';var _=require(_0x31a8('0x0'));var util=require(_0x31a8('0x1'));var moment=require(_0x31a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x31a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31a8('0x4'))['db'];var utils=require(_0x31a8('0x5'));var logger=require(_0x31a8('0x6'))(_0x31a8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x31a8('0x8')][_0x31a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bf3c7,_0x2c4b45,_0x471ae1){return new BPromise(function(_0x21f054,_0x1159a9){return client[_0x31a8('0xa')](_0x2bf3c7,_0x471ae1)[_0x31a8('0xb')](function(_0x2d4e94){logger['info'](_0x31a8('0xc'),_0x2c4b45,'request\x20sent');logger['debug'](_0x31a8('0xd'),_0x2c4b45,_0x31a8('0xe'),JSON['stringify'](_0x2d4e94));if(_0x2d4e94[_0x31a8('0xf')]){if(_0x2d4e94[_0x31a8('0xf')][_0x31a8('0x10')]===0x1f4){logger[_0x31a8('0xf')]('License,\x20%s,\x20%s',_0x2c4b45,_0x2d4e94['error'][_0x31a8('0x11')]);return _0x1159a9(_0x2d4e94['error'][_0x31a8('0x11')]);}logger['error'](_0x31a8('0xc'),_0x2c4b45,_0x2d4e94[_0x31a8('0xf')][_0x31a8('0x11')]);return _0x21f054(_0x2d4e94['error'][_0x31a8('0x11')]);}else{logger[_0x31a8('0x12')]('License,\x20%s,\x20%s',_0x2c4b45,_0x31a8('0xe'));_0x21f054(_0x2d4e94['result'][_0x31a8('0x11')]);}})[_0x31a8('0x13')](function(_0x507797){logger[_0x31a8('0xf')](_0x31a8('0xc'),_0x2c4b45,_0x507797);_0x1159a9(_0x507797);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index b57df6a..2211e68 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 _0xa5aa=['show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x37ea26,_0xd036c1){var _0xb93595=function(_0x248b47){while(--_0x248b47){_0x37ea26['push'](_0x37ea26['shift']());}};_0xb93595(++_0xd036c1);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0xb3b44e,_0x1503cf){_0xb3b44e=_0xb3b44e-0x0;var _0x44f43c=_0xa5aa[_0xb3b44e];return _0x44f43c;};'use strict';var multer=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var path=require('path');var timeout=require(_0xaa5a('0x2'));var express=require(_0xaa5a('0x3'));var router=express[_0xaa5a('0x4')]();var auth=require(_0xaa5a('0x5'));var interaction=require(_0xaa5a('0x6'));var config=require(_0xaa5a('0x7'));var controller=require('./mailAccount.controller');router[_0xaa5a('0x8')]('/',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xa')]);router['get']('/describe',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xb')]);router['get'](_0xaa5a('0xc'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xd')]);router['get'](_0xaa5a('0xe'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xf')]);router[_0xaa5a('0x8')](_0xaa5a('0x10'),auth[_0xaa5a('0x9')](),controller['getAnswers']);router[_0xaa5a('0x8')](_0xaa5a('0x11'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x12')]);router[_0xaa5a('0x8')](_0xaa5a('0x13'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x14')]);router[_0xaa5a('0x8')](_0xaa5a('0x15'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x16')]);router['get'](_0xaa5a('0x17'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x18')]);router['get'](_0xaa5a('0x19'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x1a')]);router[_0xaa5a('0x8')](_0xaa5a('0x1b'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x1c')]);router[_0xaa5a('0x8')](_0xaa5a('0x1d'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x1e')]);router[_0xaa5a('0x1f')](_0xaa5a('0xe'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x20')]);router[_0xaa5a('0x1f')](_0xaa5a('0x10'),auth['isAuthenticated'](),controller[_0xaa5a('0x21')]);router[_0xaa5a('0x1f')]('/',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x22')]);router['post'](_0xaa5a('0x11'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x23')]);router[_0xaa5a('0x1f')](_0xaa5a('0x13'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x24')]);router[_0xaa5a('0x1f')](_0xaa5a('0x15'),auth['isAuthenticated'](),controller[_0xaa5a('0x25')]);router['post'](_0xaa5a('0x17'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x26')]);router[_0xaa5a('0x1f')](_0xaa5a('0x27'),auth['isAuthenticated'](),controller[_0xaa5a('0x28')]);router[_0xaa5a('0x1f')]('/:id/users',auth[_0xaa5a('0x9')](),controller['addAgents']);router[_0xaa5a('0x29')](_0xaa5a('0xc'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2a')]);router[_0xaa5a('0x2b')](_0xaa5a('0xe'),auth['isAuthenticated'](),controller[_0xaa5a('0x2c')]);router[_0xaa5a('0x2b')]('/:id/canned_answers',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2d')]);router['delete'](_0xaa5a('0x11'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2e')]);router[_0xaa5a('0x2b')](_0xaa5a('0x13'),auth[_0xaa5a('0x9')](),controller['removeSmtp']);router[_0xaa5a('0x2b')](_0xaa5a('0xc'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2f')]);router['delete']('/:id/users',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x30')]);module['exports']=router; \ No newline at end of file +var _0xba18=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','addImap','addSmtp','addInteraction','/:id/applications','addApplications','send','/:id/users','addAgents','put','/:id','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports'];(function(_0x5458b3,_0x4e12ac){var _0x29c00f=function(_0x47c046){while(--_0x47c046){_0x5458b3['push'](_0x5458b3['shift']());}};_0x29c00f(++_0x4e12ac);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var path=require(_0x8ba1('0x2'));var timeout=require(_0x8ba1('0x3'));var express=require(_0x8ba1('0x4'));var router=express[_0x8ba1('0x5')]();var auth=require(_0x8ba1('0x6'));var interaction=require(_0x8ba1('0x7'));var config=require('../../config/environment');var controller=require(_0x8ba1('0x8'));router[_0x8ba1('0x9')]('/',auth[_0x8ba1('0xa')](),controller[_0x8ba1('0xb')]);router[_0x8ba1('0x9')](_0x8ba1('0xc'),auth['isAuthenticated'](),controller[_0x8ba1('0xd')]);router[_0x8ba1('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8ba1('0x9')](_0x8ba1('0xe'),auth['isAuthenticated'](),controller[_0x8ba1('0xf')]);router[_0x8ba1('0x9')](_0x8ba1('0x10'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x11')]);router['get'](_0x8ba1('0x12'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x13')]);router[_0x8ba1('0x9')](_0x8ba1('0x14'),auth[_0x8ba1('0xa')](),controller['getSmtp']);router[_0x8ba1('0x9')](_0x8ba1('0x15'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x16')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x8ba1('0x17')]);router[_0x8ba1('0x9')](_0x8ba1('0x18'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x19')]);router[_0x8ba1('0x9')](_0x8ba1('0x1a'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x1b')]);router[_0x8ba1('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x8ba1('0x1c')]);router[_0x8ba1('0x1d')]('/:id/dispositions',auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x1e')]);router[_0x8ba1('0x1d')](_0x8ba1('0x10'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x1f')]);router['post']('/',auth[_0x8ba1('0xa')](),controller['create']);router[_0x8ba1('0x1d')](_0x8ba1('0x12'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x20')]);router['post'](_0x8ba1('0x14'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x21')]);router[_0x8ba1('0x1d')](_0x8ba1('0x15'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x22')]);router[_0x8ba1('0x1d')](_0x8ba1('0x23'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x24')]);router['post']('/:id/send',auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x25')]);router['post'](_0x8ba1('0x26'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x27')]);router[_0x8ba1('0x28')](_0x8ba1('0x29'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x2a')]);router[_0x8ba1('0x2b')](_0x8ba1('0xe'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x2c')]);router[_0x8ba1('0x2b')](_0x8ba1('0x10'),auth[_0x8ba1('0xa')](),controller['removeAnswers']);router[_0x8ba1('0x2b')](_0x8ba1('0x12'),auth[_0x8ba1('0xa')](),controller[_0x8ba1('0x2d')]);router[_0x8ba1('0x2b')](_0x8ba1('0x14'),auth['isAuthenticated'](),controller[_0x8ba1('0x2e')]);router[_0x8ba1('0x2b')]('/:id',auth[_0x8ba1('0xa')](),controller['destroy']);router[_0x8ba1('0x2b')](_0x8ba1('0x26'),auth['isAuthenticated'](),controller[_0x8ba1('0x2f')]);module[_0x8ba1('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 938544b..e61400b 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 _0xfb9a=['BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x40b6db,_0x2a1fbb){var _0x3eaa81=function(_0x203e91){while(--_0x203e91){_0x40b6db['push'](_0x40b6db['shift']());}};_0x3eaa81(++_0x2a1fbb);}(_0xfb9a,0xc6));var _0xafb9=function(_0x31b907,_0x52f3db){_0x31b907=_0x31b907-0x0;var _0x3c66fb=_0xfb9a[_0x31b907];return _0x3c66fb;};'use strict';var Sequelize=require(_0xafb9('0x0'));module['exports']={'description':{'type':Sequelize[_0xafb9('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xafb9('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xafb9('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xafb9('0x3')]},'markAsUnread':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xafb9('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xafb9('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xafb9('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xafb9('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xafb9('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xafb9('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xafb9('0x5'),'set':function(_0x2f2a92){if(!_0x2f2a92)this[_0xafb9('0x6')]('mandatoryDispositionPauseId',null);this[_0xafb9('0x6')](_0xafb9('0x7'),_0x2f2a92);}}}; \ No newline at end of file +var _0x8fa0=['mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x4fcbc4,_0x566dd7){var _0x1b2e17=function(_0x3d3ab7){while(--_0x3d3ab7){_0x4fcbc4['push'](_0x4fcbc4['shift']());}};_0x1b2e17(++_0x566dd7);}(_0x8fa0,0x1d6));var _0x08fa=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8fa0[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module[_0x08fa('0x0')]={'description':{'type':Sequelize[_0x08fa('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x08fa('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x08fa('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x08fa('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x08fa('0x4')},'fontSize':{'type':Sequelize[_0x08fa('0x5')](0x2)[_0x08fa('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x08fa('0x3')],'defaultValue':function(){return _0x08fa('0x7');}},'notificationSound':{'type':Sequelize[_0x08fa('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x08fa('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08fa('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x08fa('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x08fa('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x08fa('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x08fa('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x08fa('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x08fa('0x2')],'defaultValue':![],'comment':_0x08fa('0x9'),'set':function(_0x4cafbd){if(!_0x4cafbd)this[_0x08fa('0xa')](_0x08fa('0xb'),null);this[_0x08fa('0xa')](_0x08fa('0xc'),_0x4cafbd);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 879db86..d4124ff 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 _0x6a43=['MailApplication','bulkCreate','getApplications','MailMessage','split','format','send','List','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','secure','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','removeAgents','isArray','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','crypto','jsforce','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','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','apply','reject','save','update','destroy','MailAccounts','UserProfileResource','stack','name','index','MailServerIn','Imap','Smtp','Pause','map','MailAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','params','MailServerOut','mandatoryDispositionPause','rawAttributes','includeAll','merge','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','length','count','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','authentication','host','port','service','password','pass','cpassword','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','color','tag','addApplications','transaction'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x6a43,0xde));var _0x36a4=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x6a43[_0x487b0c];return _0x1adbdc;};'use strict';var pdf=require(_0x36a4('0x0'));var emlformat=require(_0x36a4('0x1'));var rimraf=require(_0x36a4('0x2'));var zipdir=require(_0x36a4('0x3'));var jsonpatch=require(_0x36a4('0x4'));var rp=require(_0x36a4('0x5'));var moment=require(_0x36a4('0x6'));var BPromise=require(_0x36a4('0x7'));var Mustache=require(_0x36a4('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x36a4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x36a4('0xa'));var jsforce=require(_0x36a4('0xb'));var deskjs=require(_0x36a4('0xc'));var toCsv=require(_0x36a4('0x9'));var querystring=require(_0x36a4('0xd'));var Papa=require(_0x36a4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x36a4('0xf'));var as=require(_0x36a4('0x10'));var hardwareService=require(_0x36a4('0x11'));var logger=require(_0x36a4('0x12'))(_0x36a4('0x13'));var utils=require(_0x36a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x36a4('0x15'));var db=require(_0x36a4('0x16'))['db'];config[_0x36a4('0x17')]=_[_0x36a4('0x18')](config[_0x36a4('0x17')],{'host':_0x36a4('0x19'),'port':0x18eb});var socket=require(_0x36a4('0x1a'))(new Redis(config[_0x36a4('0x17')]));require(_0x36a4('0x1b'))[_0x36a4('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x36a4('0x1d')][_0x36a4('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x26b9c6,_0x325cb6,_0x3865f2,_0x33cdd9){return new BPromise(function(_0x528a1a,_0x1ac50b){var _0x5b6347=_0x33cdd9||client;return _0x5b6347[_0x36a4('0x1f')](_0x26b9c6,_0x3865f2)[_0x36a4('0x20')](function(_0x56622d){logger[_0x36a4('0x21')](_0x36a4('0x22'),_0x325cb6,_0x36a4('0x23'));logger[_0x36a4('0x24')](_0x36a4('0x25'),_0x325cb6,'request\x20sent',JSON['stringify'](_0x56622d));if(_0x56622d[_0x36a4('0x26')]){if(_0x56622d[_0x36a4('0x26')][_0x36a4('0x27')]===0x1f4){logger[_0x36a4('0x26')](_0x36a4('0x22'),_0x325cb6,_0x56622d[_0x36a4('0x26')][_0x36a4('0x28')]);return _0x1ac50b(_0x56622d[_0x36a4('0x26')]['message']);}logger['error'](_0x36a4('0x22'),_0x325cb6,_0x56622d['error']['message']);return _0x528a1a(_0x56622d[_0x36a4('0x26')][_0x36a4('0x28')]);}else{logger['info'](_0x36a4('0x22'),_0x325cb6,_0x36a4('0x23'));_0x528a1a(_0x56622d[_0x36a4('0x29')][_0x36a4('0x28')]);}})[_0x36a4('0x2a')](function(_0x3f200d){logger[_0x36a4('0x26')](_0x36a4('0x22'),_0x325cb6,_0x3f200d);_0x1ac50b(_0x3f200d);});});}function respondWithStatusCode(_0x43262d,_0xd43c78){_0xd43c78=_0xd43c78||0xcc;return function(_0x5819d6){if(_0x5819d6){return _0x43262d[_0x36a4('0x2b')](_0xd43c78);}return _0x43262d['status'](_0xd43c78)[_0x36a4('0x2c')]();};}function respondWithResult(_0x4614d2,_0x2cdd75){_0x2cdd75=_0x2cdd75||0xc8;return function(_0x2fb3f9){if(_0x2fb3f9){return _0x4614d2[_0x36a4('0x2d')](_0x2cdd75)[_0x36a4('0x2e')](_0x2fb3f9);}};}function respondWithFilteredResult(_0x41433e,_0x5d6661){return function(_0x3e6148){if(_0x3e6148){var _0x568c1c=_0x3e6148['count'],_0xe0e5d5=_0x5d6661[_0x36a4('0x2f')],_0x265d98=_0x5d6661[_0x36a4('0x2f')]+_0x5d6661[_0x36a4('0x30')],_0x10e98e;if(_0x265d98>=_0x568c1c){_0x265d98=_0x568c1c;_0x10e98e=0xc8;}else{_0x10e98e=0xce;}_0x41433e[_0x36a4('0x2d')](_0x10e98e);return _0x41433e['set']('Content-Range',_0xe0e5d5+'-'+_0x265d98+'/'+_0x568c1c)[_0x36a4('0x2e')](_0x3e6148);}return null;};}function patchUpdates(_0x546944){return function(_0x2cf1fd){try{jsonpatch[_0x36a4('0x31')](_0x2cf1fd,_0x546944,!![]);}catch(_0xe432eb){return BPromise[_0x36a4('0x32')](_0xe432eb);}return _0x2cf1fd[_0x36a4('0x33')]();};}function saveUpdates(_0x2ef25e,_0x44681e){return function(_0x11ddc2){if(_0x11ddc2){return _0x11ddc2[_0x36a4('0x34')](_0x2ef25e)[_0x36a4('0x20')](function(_0xccbf44){return _0xccbf44;});}return null;};}function removeEntity(_0x34635d,_0x5ad72a){return function(_0x2bd5fb){if(_0x2bd5fb){return _0x2bd5fb[_0x36a4('0x35')]()[_0x36a4('0x20')](function(){var _0x228381=_0x2bd5fb['get']({'plain':!![]});var _0xba83a2=_0x36a4('0x36');return db[_0x36a4('0x37')][_0x36a4('0x35')]({'where':{'type':_0xba83a2,'resourceId':_0x228381['id']}})[_0x36a4('0x20')](function(){return _0x2bd5fb;});})[_0x36a4('0x20')](function(){_0x34635d[_0x36a4('0x2d')](0xcc)[_0x36a4('0x2c')]();});}};}function handleEntityNotFound(_0x2ee1d7,_0x34e306){return function(_0x3a8994){if(!_0x3a8994){_0x2ee1d7[_0x36a4('0x2b')](0x194);}return _0x3a8994;};}function handleError(_0x23bb3c,_0x28f8db){_0x28f8db=_0x28f8db||0x1f4;return function(_0x51f03c){logger['error'](_0x51f03c[_0x36a4('0x38')]);if(_0x51f03c[_0x36a4('0x39')]){delete _0x51f03c[_0x36a4('0x39')];}_0x23bb3c[_0x36a4('0x2d')](_0x28f8db)['send'](_0x51f03c);};}exports[_0x36a4('0x3a')]=function(_0x47c8e2,_0x5bd9e0){var _0x426915={'include':[{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')},{'model':db['MailServerOut'],'as':_0x36a4('0x3d')},{'model':db[_0x36a4('0x3e')],'as':'mandatoryDispositionPause'}]},_0x26d019={},_0x568a04={'count':0x0,'rows':[]};var _0x34b1db=_[_0x36a4('0x3f')](db[_0x36a4('0x40')]['rawAttributes'],function(_0x53e5d0){return{'name':_0x53e5d0[_0x36a4('0x41')],'type':_0x53e5d0['type'][_0x36a4('0x42')]};});_0x26d019[_0x36a4('0x43')]=_[_0x36a4('0x3f')](_0x34b1db,_0x36a4('0x39'));_0x26d019[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x47c8e2[_0x36a4('0x44')]);_0x26d019[_0x36a4('0x46')]=_['intersection'](_0x26d019[_0x36a4('0x43')],_0x26d019[_0x36a4('0x44')]);_0x426915[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x26d019[_0x36a4('0x43')],qs[_0x36a4('0x49')](_0x47c8e2[_0x36a4('0x44')]['fields']));_0x426915[_0x36a4('0x47')]=_0x426915[_0x36a4('0x47')]['length']?_0x426915[_0x36a4('0x47')]:_0x26d019['model'];if(!_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x426915['limit']=qs[_0x36a4('0x30')](_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x30')]);_0x426915[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x2f')]);}_0x426915[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x47c8e2['query'][_0x36a4('0x4d')]);_0x426915[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x47c8e2[_0x36a4('0x44')],_0x26d019[_0x36a4('0x46')]),_0x34b1db);if(_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x50')]){_0x426915['where']=_['merge'](_0x426915[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x34b1db,function(_0x27fb97){if(_0x27fb97['type']!=='VIRTUAL'){var _0x3dd42f={};_0x3dd42f[_0x27fb97[_0x36a4('0x39')]]={'$like':'%'+_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x3dd42f;}})});}_0x426915=_['merge']({},_0x426915,_0x47c8e2[_0x36a4('0x51')]);var _0x41376e={'where':_0x426915['where']};return db[_0x36a4('0x40')]['count'](_0x41376e)[_0x36a4('0x20')](function(_0x1804e0){_0x568a04['count']=_0x1804e0;if(_0x47c8e2[_0x36a4('0x44')]['includeAll']){_0x426915[_0x36a4('0x52')]=[{'all':!![]}];}return db[_0x36a4('0x40')][_0x36a4('0x53')](_0x426915);})[_0x36a4('0x20')](function(_0x4764e9){_0x568a04['rows']=_0x4764e9;return _0x568a04;})[_0x36a4('0x20')](respondWithFilteredResult(_0x5bd9e0,_0x426915))['catch'](handleError(_0x5bd9e0,null));};exports['show']=function(_0x23bdf9,_0x224280){var _0x3fddf2={'raw':![],'where':{'id':_0x23bdf9[_0x36a4('0x54')]['id']},'include':[{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')},{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d')},{'model':db[_0x36a4('0x3e')],'as':_0x36a4('0x56')}]},_0x5a2975={};_0x5a2975[_0x36a4('0x43')]=_[_0x36a4('0x45')](db['MailAccount'][_0x36a4('0x57')]);_0x5a2975['query']=_[_0x36a4('0x45')](_0x23bdf9[_0x36a4('0x44')]);_0x5a2975[_0x36a4('0x46')]=_[_0x36a4('0x48')](_0x5a2975['model'],_0x5a2975[_0x36a4('0x44')]);_0x3fddf2[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x5a2975[_0x36a4('0x43')],qs['fields'](_0x23bdf9[_0x36a4('0x44')][_0x36a4('0x49')]));_0x3fddf2[_0x36a4('0x47')]=_0x3fddf2[_0x36a4('0x47')]['length']?_0x3fddf2[_0x36a4('0x47')]:_0x5a2975[_0x36a4('0x43')];if(_0x23bdf9[_0x36a4('0x44')][_0x36a4('0x58')]){_0x3fddf2[_0x36a4('0x52')]=[{'all':!![]}];}_0x3fddf2=_[_0x36a4('0x59')]({},_0x3fddf2,_0x23bdf9['options']);return db[_0x36a4('0x40')][_0x36a4('0x5a')](_0x3fddf2)[_0x36a4('0x20')](handleEntityNotFound(_0x224280,null))['then'](respondWithResult(_0x224280,null))['catch'](handleError(_0x224280,null));};exports[_0x36a4('0x34')]=function(_0x2f62cb,_0xe986ba){if(_0x2f62cb[_0x36a4('0x5b')]['id']){delete _0x2f62cb[_0x36a4('0x5b')]['id'];}return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x2f62cb[_0x36a4('0x54')]['id']},'include':[{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')},{'model':db[_0x36a4('0x55')],'as':'Smtp'},{'model':db[_0x36a4('0x3e')],'as':_0x36a4('0x56')}]})[_0x36a4('0x20')](handleEntityNotFound(_0xe986ba,null))[_0x36a4('0x20')](saveUpdates(_0x2f62cb[_0x36a4('0x5b')],null))['then'](function(_0x196f9d){if(_0x196f9d&&_0x2f62cb[_0x36a4('0x5b')][_0x36a4('0x3c')]){return db['MailServerIn'][_0x36a4('0x34')](_0x2f62cb[_0x36a4('0x5b')][_0x36a4('0x3c')],{'where':{'MailAccountId':_0x196f9d['id']}})['then'](function(){return _0x196f9d;});}return _0x196f9d;})[_0x36a4('0x20')](function(_0x366351){if(_0x366351&&_0x2f62cb[_0x36a4('0x5b')]['Smtp']){return db[_0x36a4('0x55')][_0x36a4('0x34')](_0x2f62cb['body']['Smtp'],{'where':{'MailAccountId':_0x366351['id']}})[_0x36a4('0x20')](function(){return _0x366351;});}return _0x366351;})[_0x36a4('0x20')](respondWithResult(_0xe986ba,null))[_0x36a4('0x2a')](handleError(_0xe986ba,null));};exports[_0x36a4('0x5c')]=function(_0x349f02,_0x168e1f){return db[_0x36a4('0x40')][_0x36a4('0x5c')]()[_0x36a4('0x20')](respondWithResult(_0x168e1f,null))[_0x36a4('0x2a')](handleError(_0x168e1f,null));};exports[_0x36a4('0x5d')]=function(_0x75fa09,_0x42a0a0,_0x4707b3){if(_0x75fa09[_0x36a4('0x5b')]['id']){delete _0x75fa09[_0x36a4('0x5b')]['id'];}return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x75fa09[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x42a0a0,null))[_0x36a4('0x20')](function(_0x5179a1){if(_0x5179a1){_0x75fa09[_0x36a4('0x5b')][_0x36a4('0x5e')]=_0x5179a1['id'];return db[_0x36a4('0x5f')][_0x36a4('0x60')](_0x75fa09[_0x36a4('0x5b')]);}})[_0x36a4('0x20')](respondWithResult(_0x42a0a0,null))[_0x36a4('0x2a')](handleError(_0x42a0a0,null));};exports[_0x36a4('0x61')]=function(_0x2157b0,_0x151679,_0x19c530){var _0x11aaeb={'raw':![],'where':{}};var _0x442678={};var _0x3d85eb={'count':0x0,'rows':[]};return db['MailAccount'][_0x36a4('0x62')]({'where':{'id':_0x2157b0[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x151679,null))[_0x36a4('0x20')](function(_0x4a72f5){if(_0x4a72f5){_0x442678[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x5f')][_0x36a4('0x57')]);_0x442678[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x2157b0[_0x36a4('0x44')]);_0x442678['filters']=_[_0x36a4('0x48')](_0x442678[_0x36a4('0x43')],_0x442678['query']);_0x11aaeb[_0x36a4('0x47')]=_['intersection'](_0x442678[_0x36a4('0x43')],qs['fields'](_0x2157b0[_0x36a4('0x44')][_0x36a4('0x49')]));_0x11aaeb[_0x36a4('0x47')]=_0x11aaeb[_0x36a4('0x47')][_0x36a4('0x63')]?_0x11aaeb['attributes']:_0x442678[_0x36a4('0x43')];if(!_0x2157b0['query']['hasOwnProperty'](_0x36a4('0x4b'))){_0x11aaeb[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x2157b0[_0x36a4('0x44')]['limit']);_0x11aaeb[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x2157b0[_0x36a4('0x44')]['offset']);}_0x11aaeb[_0x36a4('0x4c')]=qs['sort'](_0x2157b0[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x11aaeb[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x2157b0[_0x36a4('0x44')],_0x442678[_0x36a4('0x46')]));_0x11aaeb[_0x36a4('0x4e')][_0x36a4('0x5e')]=_0x4a72f5['id'];if(_0x2157b0[_0x36a4('0x44')][_0x36a4('0x50')]){_0x11aaeb[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x11aaeb['where'],{'$or':_[_0x36a4('0x3f')](_0x11aaeb[_0x36a4('0x47')],function(_0x5dd882){var _0x1138a2={};_0x1138a2[_0x5dd882]={'$like':'%'+_0x2157b0['query'][_0x36a4('0x50')]+'%'};return _0x1138a2;})});}_0x11aaeb=_['merge']({},_0x11aaeb,_0x2157b0[_0x36a4('0x51')]);return db[_0x36a4('0x5f')][_0x36a4('0x64')]({'where':_0x11aaeb[_0x36a4('0x4e')]})['then'](function(_0x272da0){_0x3d85eb[_0x36a4('0x64')]=_0x272da0;if(_0x2157b0[_0x36a4('0x44')][_0x36a4('0x58')]){_0x11aaeb[_0x36a4('0x52')]=[{'all':!![]}];}return db[_0x36a4('0x5f')][_0x36a4('0x53')](_0x11aaeb);})[_0x36a4('0x20')](function(_0x41c50e){_0x3d85eb[_0x36a4('0x65')]=_0x41c50e;return _0x3d85eb;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x151679,_0x11aaeb))['catch'](handleError(_0x151679,null));};exports[_0x36a4('0x66')]=function(_0x2c646b,_0x399a58,_0x2413c6){return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x2c646b[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x399a58,null))[_0x36a4('0x20')](function(_0x792859){if(_0x792859){return _0x792859[_0x36a4('0x66')](_0x2c646b[_0x36a4('0x44')][_0x36a4('0x67')]);}})[_0x36a4('0x20')](respondWithStatusCode(_0x399a58,null))[_0x36a4('0x2a')](handleError(_0x399a58,null));};exports[_0x36a4('0x68')]=function(_0x2984a3,_0x2fef6e,_0x3b2d0a){if(_0x2984a3[_0x36a4('0x5b')]['id']){delete _0x2984a3['body']['id'];}return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x2984a3['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x2fef6e,null))[_0x36a4('0x20')](function(_0x333288){if(_0x333288){_0x2984a3[_0x36a4('0x5b')]['MailAccountId']=_0x333288['id'];return db[_0x36a4('0x69')][_0x36a4('0x60')](_0x2984a3[_0x36a4('0x5b')]);}})[_0x36a4('0x20')](respondWithResult(_0x2fef6e,null))[_0x36a4('0x2a')](handleError(_0x2fef6e,null));};exports[_0x36a4('0x6a')]=function(_0x2318d5,_0x1aa879,_0x473b12){var _0x2a9c96={'raw':![],'where':{}};var _0xcf1d8c={};var _0x129267={'count':0x0,'rows':[]};return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x2318d5[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x1aa879,null))[_0x36a4('0x20')](function(_0x5954ac){if(_0x5954ac){_0xcf1d8c[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x69')]['rawAttributes']);_0xcf1d8c[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x2318d5[_0x36a4('0x44')]);_0xcf1d8c['filters']=_[_0x36a4('0x48')](_0xcf1d8c[_0x36a4('0x43')],_0xcf1d8c[_0x36a4('0x44')]);_0x2a9c96[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0xcf1d8c['model'],qs[_0x36a4('0x49')](_0x2318d5[_0x36a4('0x44')][_0x36a4('0x49')]));_0x2a9c96[_0x36a4('0x47')]=_0x2a9c96['attributes'][_0x36a4('0x63')]?_0x2a9c96[_0x36a4('0x47')]:_0xcf1d8c[_0x36a4('0x43')];if(!_0x2318d5['query'][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x2a9c96[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x2318d5[_0x36a4('0x44')]['limit']);_0x2a9c96[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x2318d5[_0x36a4('0x44')][_0x36a4('0x2f')]);}_0x2a9c96[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x2318d5[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x2a9c96[_0x36a4('0x4e')]=qs['filters'](_[_0x36a4('0x4f')](_0x2318d5['query'],_0xcf1d8c[_0x36a4('0x46')]));_0x2a9c96[_0x36a4('0x4e')]['MailAccountId']=_0x5954ac['id'];if(_0x2318d5['query']['filter']){_0x2a9c96[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x2a9c96[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x2a9c96['attributes'],function(_0xfd7faa){var _0x42b97c={};_0x42b97c[_0xfd7faa]={'$like':'%'+_0x2318d5[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x42b97c;})});}_0x2a9c96=_['merge']({},_0x2a9c96,_0x2318d5[_0x36a4('0x51')]);return db[_0x36a4('0x69')][_0x36a4('0x64')]({'where':_0x2a9c96[_0x36a4('0x4e')]})[_0x36a4('0x20')](function(_0x518c16){_0x129267['count']=_0x518c16;if(_0x2318d5[_0x36a4('0x44')][_0x36a4('0x58')]){_0x2a9c96[_0x36a4('0x52')]=[{'all':!![]}];}return db[_0x36a4('0x69')][_0x36a4('0x53')](_0x2a9c96);})[_0x36a4('0x20')](function(_0xbcf9b2){_0x129267[_0x36a4('0x65')]=_0xbcf9b2;return _0x129267;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x1aa879,_0x2a9c96))['catch'](handleError(_0x1aa879,null));};exports[_0x36a4('0x6b')]=function(_0x11e6bc,_0x1208da,_0xb529f2){return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x11e6bc[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x1208da,null))[_0x36a4('0x20')](function(_0x8a669f){if(_0x8a669f){return _0x8a669f[_0x36a4('0x6b')](_0x11e6bc['query'][_0x36a4('0x67')]);}})[_0x36a4('0x20')](respondWithStatusCode(_0x1208da,null))[_0x36a4('0x2a')](handleError(_0x1208da,null));};exports[_0x36a4('0x60')]=function(_0x4bb59c,_0xe196d1){var _0x20c187={'name':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x39')],'key':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x42')],'email':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x6c')],'ListId':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x6d')],'active':!_[_0x36a4('0x6e')](_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x6f')])?_0x4bb59c['body'][_0x36a4('0x6f')]:!![],'description':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x36a4('0x6e')](_0x4bb59c['body'][_0x36a4('0x71')])){if(_0x4bb59c[_0x36a4('0x5b')]['cauthentication']){_0x20c187[_0x36a4('0x3c')][_0x36a4('0x72')]=_0x20c187[_0x36a4('0x3d')][_0x36a4('0x72')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x73')];_0x20c187[_0x36a4('0x3c')]['password']=_0x20c187['Smtp']['pass']=_0x4bb59c[_0x36a4('0x5b')]['cpassword'];}else{_0x20c187[_0x36a4('0x3c')][_0x36a4('0x74')]=_0x20c187[_0x36a4('0x3d')]['authentication']=![];}_0x20c187['Imap']['host']=_0x4bb59c['body']['Imap'][_0x36a4('0x75')];_0x20c187[_0x36a4('0x3c')]['port']=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x3c')]['port'];_0x20c187[_0x36a4('0x3d')][_0x36a4('0x75')]=_0x4bb59c['body']['Smtp'][_0x36a4('0x75')];_0x20c187[_0x36a4('0x3d')][_0x36a4('0x76')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x3d')][_0x36a4('0x76')];}else{_0x20c187[_0x36a4('0x3c')]['service']=_0x20c187[_0x36a4('0x3d')][_0x36a4('0x77')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x71')];_0x20c187[_0x36a4('0x3c')][_0x36a4('0x72')]=_0x20c187[_0x36a4('0x3d')]['user']=_0x4bb59c['body'][_0x36a4('0x73')];_0x20c187['Imap'][_0x36a4('0x78')]=_0x20c187['Smtp'][_0x36a4('0x79')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x7a')];}return db[_0x36a4('0x40')][_0x36a4('0x60')](_0x20c187,{'include':[{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d')},{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')}]})[_0x36a4('0x20')](function(_0x1bdbbb){var _0x1d5a09=_0x4bb59c[_0x36a4('0x72')][_0x36a4('0x7b')]({'plain':!![]});if(!_0x1d5a09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d5a09[_0x36a4('0x7c')]==='user'){var _0x483035=_0x1bdbbb[_0x36a4('0x7b')]({'plain':!![]});return db[_0x36a4('0x7d')][_0x36a4('0x5a')]({'where':{'name':_0x36a4('0x36'),'userProfileId':_0x1d5a09[_0x36a4('0x7e')]},'raw':!![]})[_0x36a4('0x20')](function(_0x22a7c3){if(_0x22a7c3&&_0x22a7c3[_0x36a4('0x7f')]===0x0){return db[_0x36a4('0x37')][_0x36a4('0x60')]({'name':_0x483035[_0x36a4('0x39')],'resourceId':_0x483035['id'],'type':_0x22a7c3[_0x36a4('0x39')],'sectionId':_0x22a7c3['id']},{})[_0x36a4('0x20')](function(){return _0x1bdbbb;});}else{return _0x1bdbbb;}})[_0x36a4('0x2a')](function(_0x1d6ae5){logger[_0x36a4('0x26')](_0x36a4('0x80'),_0x1d6ae5);throw _0x1d6ae5;});}return _0x1bdbbb;})[_0x36a4('0x20')](respondWithResult(_0xe196d1,0xc9))[_0x36a4('0x2a')](handleError(_0xe196d1,null));};exports[_0x36a4('0x81')]=function(_0x167eec,_0x25490c,_0x5b9cb2){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0x167eec[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x25490c,null))[_0x36a4('0x20')](function(_0x54a5b7){if(_0x54a5b7){return _0x54a5b7[_0x36a4('0x81')]();}return null;})[_0x36a4('0x20')](respondWithResult(_0x25490c,null))[_0x36a4('0x2a')](handleError(_0x25490c,null));};exports[_0x36a4('0x82')]=function(_0x222171,_0x1a427e,_0x42b132){if(_0x222171[_0x36a4('0x5b')]['id']){delete _0x222171['body']['id'];}return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x222171[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a427e,null))[_0x36a4('0x20')](function(_0x2b27e7){if(_0x2b27e7){_0x222171[_0x36a4('0x5b')]['MailAccountId']=_0x2b27e7['id'];return db['MailServerIn'][_0x36a4('0x60')](_0x222171[_0x36a4('0x5b')]);}})[_0x36a4('0x20')](respondWithResult(_0x1a427e,null))[_0x36a4('0x2a')](handleError(_0x1a427e,null));};exports[_0x36a4('0x83')]=function(_0xff3eca,_0xa6e8ee,_0x2e4835){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0xff3eca[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0xa6e8ee,null))['then'](function(_0x259a56){if(_0x259a56){return _0x259a56[_0x36a4('0x84')](null);}return null;})['then'](respondWithStatusCode(_0xa6e8ee,null))[_0x36a4('0x2a')](handleError(_0xa6e8ee,null));};exports[_0x36a4('0x85')]=function(_0x339f93,_0x552b47,_0x2eed54){return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x339f93[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x552b47,null))[_0x36a4('0x20')](function(_0x1aed39){if(_0x1aed39){return _0x1aed39[_0x36a4('0x85')]();}return null;})['then'](respondWithResult(_0x552b47,null))['catch'](handleError(_0x552b47,null));};exports['addSmtp']=function(_0xe702e2,_0x2bb8d6,_0xc2c4e8){if(_0xe702e2[_0x36a4('0x5b')]['id']){delete _0xe702e2[_0x36a4('0x5b')]['id'];}return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0xe702e2['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x2bb8d6,null))['then'](function(_0x3e57f9){if(_0x3e57f9){_0xe702e2[_0x36a4('0x5b')][_0x36a4('0x5e')]=_0x3e57f9['id'];return db[_0x36a4('0x55')][_0x36a4('0x60')](_0xe702e2['body']);}})['then'](respondWithResult(_0x2bb8d6,null))[_0x36a4('0x2a')](handleError(_0x2bb8d6,null));};exports[_0x36a4('0x86')]=function(_0x4b1a3d,_0x302a82,_0x2e7876){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0x4b1a3d['params']['id']}})['then'](handleEntityNotFound(_0x302a82,null))[_0x36a4('0x20')](function(_0x4c69fa){if(_0x4c69fa){return _0x4c69fa[_0x36a4('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x302a82,null))[_0x36a4('0x2a')](handleError(_0x302a82,null));};exports[_0x36a4('0x88')]=function(_0x571d6d,_0x2d4c10,_0x1f156c){return db[_0x36a4('0x89')][_0x36a4('0x5a')]({'where':{'id':_0x571d6d[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x2d4c10,null))[_0x36a4('0x20')](function(_0x306aae){if(_0x306aae){return _0x306aae['addInteraction'](_0x571d6d[_0x36a4('0x5b')][_0x36a4('0x67')],_['omit'](_0x571d6d[_0x36a4('0x5b')],[_0x36a4('0x67'),'id'])||{});}})[_0x36a4('0x20')](respondWithResult(_0x2d4c10,null))[_0x36a4('0x2a')](handleError(_0x2d4c10,null));};exports[_0x36a4('0x8a')]=function(_0x5d860d,_0x10ed8f,_0x2527d6){var _0x593a72={'raw':![],'where':{}};var _0x20c70f={};var _0x4cf8ed={'count':0x0,'rows':[]};return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x5d860d['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x10ed8f,null))[_0x36a4('0x20')](function(_0x124e21){if(_0x124e21){_0x20c70f[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x89')]['rawAttributes']);_0x20c70f[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x5d860d[_0x36a4('0x44')]);_0x20c70f[_0x36a4('0x46')]=_[_0x36a4('0x48')](_0x20c70f[_0x36a4('0x43')],_0x20c70f['query']);_0x593a72[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x20c70f[_0x36a4('0x43')],qs[_0x36a4('0x49')](_0x5d860d['query'][_0x36a4('0x49')]));_0x593a72[_0x36a4('0x47')]=_0x593a72[_0x36a4('0x47')][_0x36a4('0x63')]?_0x593a72['attributes']:_0x20c70f[_0x36a4('0x43')];if(!_0x5d860d[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x593a72[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x5d860d['query'][_0x36a4('0x30')]);_0x593a72[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x5d860d[_0x36a4('0x44')]['offset']);}_0x593a72[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x5d860d['query'][_0x36a4('0x4d')]);_0x593a72[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x5d860d[_0x36a4('0x44')],_0x20c70f[_0x36a4('0x46')]));_0x593a72[_0x36a4('0x4e')][_0x36a4('0x5e')]=_0x124e21['id'];if(_0x5d860d[_0x36a4('0x44')][_0x36a4('0x50')]){_0x593a72[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x593a72[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x593a72[_0x36a4('0x47')],function(_0x482b55){var _0x1b90e4={};_0x1b90e4[_0x482b55]={'$like':'%'+_0x5d860d['query'][_0x36a4('0x50')]+'%'};return _0x1b90e4;})});}_0x593a72=_['merge']({},_0x593a72,_0x5d860d[_0x36a4('0x51')]);return db['MailInteraction'][_0x36a4('0x64')]({'where':_0x593a72['where']})['then'](function(_0x221802){_0x4cf8ed[_0x36a4('0x64')]=_0x221802;if(_0x5d860d[_0x36a4('0x44')]['includeAll']){_0x593a72[_0x36a4('0x52')]=[{'model':db[_0x36a4('0x8b')],'as':_0x36a4('0x8c'),'required':![]},{'model':db[_0x36a4('0x8d')],'as':_0x36a4('0x8e'),'attributes':['name',_0x36a4('0x8f'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x36a4('0x39'),_0x36a4('0x90')],'where':_0x5d860d[_0x36a4('0x44')][_0x36a4('0x91')]?{'id':_0x5d860d[_0x36a4('0x44')][_0x36a4('0x91')]}:undefined,'required':_0x5d860d[_0x36a4('0x44')]['tag']?!![]:![]}];}return db[_0x36a4('0x89')][_0x36a4('0x53')](_0x593a72);})[_0x36a4('0x20')](function(_0x4c7527){_0x4cf8ed[_0x36a4('0x65')]=_0x4c7527;return _0x4cf8ed;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x10ed8f,_0x593a72))[_0x36a4('0x2a')](handleError(_0x10ed8f,null));};exports[_0x36a4('0x92')]=function(_0x28381d,_0x4de2a7,_0x25ac33){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0x28381d[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x4de2a7,null))['then'](function(_0x4f6c50){if(_0x4f6c50){return db['sequelize'][_0x36a4('0x93')](function(_0x5ce6c0){return db[_0x36a4('0x94')]['destroy']({'where':{'MailAccountId':_0x28381d[_0x36a4('0x54')]['id']},'transaction':_0x5ce6c0})[_0x36a4('0x20')](function(_0x26d0d4){var _0x4e9d66=_['map'](_0x28381d[_0x36a4('0x5b')],function(_0xba0db0){_0xba0db0[_0x36a4('0x5e')]=_0x28381d[_0x36a4('0x54')]['id'];return _0xba0db0;});return db[_0x36a4('0x94')][_0x36a4('0x95')](_0x4e9d66,{'transaction':_0x5ce6c0});});})[_0x36a4('0x20')](function(){return db[_0x36a4('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x28381d[_0x36a4('0x54')]['id']},'order':'priority'});});}})[_0x36a4('0x20')](respondWithResult(_0x4de2a7,null))[_0x36a4('0x2a')](handleError(_0x4de2a7,null));};exports[_0x36a4('0x96')]=function(_0xfc82ed,_0x523b60,_0x283798){var _0x2875d3={};var _0x676a0d={};var _0x1050ee;var _0x2ba5e8;return db['MailAccount']['findOne']({'where':{'id':_0xfc82ed[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x523b60,null))[_0x36a4('0x20')](function(_0x81dbf){if(_0x81dbf){_0x1050ee=_0x81dbf;_0x676a0d[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x94')][_0x36a4('0x57')]);_0x676a0d[_0x36a4('0x44')]=_['keys'](_0xfc82ed['query']);_0x676a0d[_0x36a4('0x46')]=_['intersection'](_0x676a0d['model'],_0x676a0d['query']);_0x2875d3[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x676a0d[_0x36a4('0x43')],qs['fields'](_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x49')]));_0x2875d3[_0x36a4('0x47')]=_0x2875d3[_0x36a4('0x47')][_0x36a4('0x63')]?_0x2875d3[_0x36a4('0x47')]:_0x676a0d['model'];_0x2875d3[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0xfc82ed[_0x36a4('0x44')]['sort']);_0x2875d3[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0xfc82ed[_0x36a4('0x44')],_0x676a0d[_0x36a4('0x46')]));if(_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x50')]){_0x2875d3[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x2875d3[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x2875d3[_0x36a4('0x47')],function(_0x22ee75){var _0x236cd5={};_0x236cd5[_0x22ee75]={'$like':'%'+_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x236cd5;})});}_0x2875d3=_[_0x36a4('0x59')]({},_0x2875d3,_0xfc82ed[_0x36a4('0x51')]);return _0x1050ee[_0x36a4('0x96')](_0x2875d3);}})[_0x36a4('0x20')](function(_0x443e04){if(_0x443e04){_0x2ba5e8=_0x443e04[_0x36a4('0x63')];if(!_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x2875d3[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0xfc82ed['query'][_0x36a4('0x30')]);_0x2875d3[_0x36a4('0x2f')]=qs['offset'](_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x2f')]);}return _0x1050ee['getApplications'](_0x2875d3);}})[_0x36a4('0x20')](function(_0x178e64){if(_0x178e64){return _0x178e64?{'count':_0x2ba5e8,'rows':_0x178e64}:null;}})['then'](respondWithResult(_0x523b60,null))['catch'](handleError(_0x523b60,null));};exports['getMessages']=function(_0x4a256d,_0x5a2c79,_0xaaed69){var _0x5b0d94={'raw':!![],'where':{}};var _0x2c46e5={};var _0x2fd8e1={'count':0x0,'rows':[]};return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x4a256d['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x5a2c79,null))[_0x36a4('0x20')](function(_0x4f6feb){if(_0x4f6feb){_0x2c46e5['model']=_[_0x36a4('0x45')](db[_0x36a4('0x97')][_0x36a4('0x57')]);_0x2c46e5[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x4a256d[_0x36a4('0x44')]);_0x2c46e5['filters']=_[_0x36a4('0x48')](_0x2c46e5[_0x36a4('0x43')],_0x2c46e5['query']);_0x5b0d94[_0x36a4('0x47')]=_['intersection'](_0x2c46e5[_0x36a4('0x43')],qs['fields'](_0x4a256d['query']['fields']));_0x5b0d94['attributes']=_0x5b0d94[_0x36a4('0x47')]['length']?_0x5b0d94[_0x36a4('0x47')]:_0x2c46e5[_0x36a4('0x43')];if(!_0x4a256d[_0x36a4('0x44')][_0x36a4('0x4a')]('nolimit')){_0x5b0d94[_0x36a4('0x30')]=qs['limit'](_0x4a256d[_0x36a4('0x44')][_0x36a4('0x30')]);_0x5b0d94[_0x36a4('0x2f')]=qs['offset'](_0x4a256d[_0x36a4('0x44')]['offset']);}_0x5b0d94[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x4a256d[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x5b0d94['where']=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x4a256d[_0x36a4('0x44')],_0x2c46e5[_0x36a4('0x46')]));_0x5b0d94[_0x36a4('0x4e')][_0x36a4('0x5e')]=_0x4f6feb['id'];if(_0x4a256d['query']['filter']){_0x5b0d94['where']=_['merge'](_0x5b0d94[_0x36a4('0x4e')],{'$or':_['map'](_0x5b0d94['attributes'],function(_0x50c88a){var _0x34a9b0={};_0x34a9b0[_0x50c88a]={'$like':'%'+_0x4a256d[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x34a9b0;})});}if(_0x4a256d[_0x36a4('0x44')]['$gte']){var _0x381254=_0x4a256d[_0x36a4('0x44')]['$gte'][_0x36a4('0x98')](',');var _0x5d0109={};_0x5d0109[_0x381254[0x0]]={'$gte':moment(_0x381254[0x1])[_0x36a4('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b0d94[_0x36a4('0x4e')]=_['merge'](_0x5b0d94[_0x36a4('0x4e')],_0x5d0109);}_0x5b0d94=_[_0x36a4('0x59')]({},_0x5b0d94,_0x4a256d[_0x36a4('0x51')]);return db[_0x36a4('0x97')][_0x36a4('0x64')]({'where':_0x5b0d94[_0x36a4('0x4e')]})[_0x36a4('0x20')](function(_0x5eae3b){_0x2fd8e1[_0x36a4('0x64')]=_0x5eae3b;if(_0x4a256d['query']['includeAll']){_0x5b0d94[_0x36a4('0x52')]=[{'all':!![]}];}return db['MailMessage'][_0x36a4('0x53')](_0x5b0d94);})[_0x36a4('0x20')](function(_0x27dc88){_0x2fd8e1[_0x36a4('0x65')]=_0x27dc88;return _0x2fd8e1;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x5a2c79,_0x5b0d94))[_0x36a4('0x2a')](handleError(_0x5a2c79,null));};exports[_0x36a4('0x9a')]=function(_0x52cf43,_0x38dd08,_0x3a5294){var _0xda1425,_0x2c7232={},_0x18d732;if(_0x52cf43[_0x36a4('0x5b')]['to']){_0x18d732=_0x52cf43[_0x36a4('0x5b')]['to'][_0x36a4('0x98')](',')[0x0];}return db[_0x36a4('0x40')]['find']({'where':{'id':_0x52cf43[_0x36a4('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x36a4('0x9b'),'include':[{'model':db[_0x36a4('0x8b')],'as':_0x36a4('0x9c'),'where':{'email':_0x18d732},'limit':0x1,'order':[['updatedAt',_0x36a4('0x9d')]]}]},{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d'),'raw':!![]}]})[_0x36a4('0x20')](handleEntityNotFound(_0x38dd08,null))[_0x36a4('0x20')](function(_0x26d4c3){if(_0x26d4c3){_0xda1425=_0x26d4c3;if(_0x26d4c3[_0x36a4('0x3d')]){if(_[_0x36a4('0x6e')](_0x52cf43[_0x36a4('0x5b')][_0x36a4('0x9e')])){_0x52cf43['body'][_0x36a4('0x9e')]=util[_0x36a4('0x99')](_0x36a4('0x9f'),_0x26d4c3[_0x36a4('0x39')],_0x26d4c3[_0x36a4('0x6c')]||_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x72')]);}if(_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')]&&_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')]['length']){for(var _0xe59de3=0x0;_0xe59de3<_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')][_0x36a4('0x63')];_0xe59de3+=0x1){_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')][_0xe59de3]={'filename':_0x52cf43['body'][_0x36a4('0xa0')][_0xe59de3][_0x36a4('0x39')],'path':path[_0x36a4('0xa1')](config[_0x36a4('0xa2')],_0x36a4('0xa3'),_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')][_0xe59de3][_0x36a4('0xa4')])};}}var _0x113057={'tls':{'rejectUnauthorized':![]}};if(_[_0x36a4('0x6e')](_0x26d4c3['Smtp'][_0x36a4('0x77')])){if(_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x74')]){_0x113057[_0x36a4('0xa5')]={'user':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x72')],'pass':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x79')]};}_0x113057['host']=_0x26d4c3[_0x36a4('0x3d')]['host'];_0x113057['port']=_0x26d4c3['Smtp'][_0x36a4('0x76')];_0x113057['secure']=_0x26d4c3[_0x36a4('0x3d')]['secure'];}else{_0x113057[_0x36a4('0x77')]=_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x77')];_0x113057[_0x36a4('0xa5')]={'user':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x72')],'pass':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x79')]};}return respondWithRpcPromise('SendMail',_0x36a4('0xa6'),{'account':_0x113057,'message':_0x52cf43['body']});}else{throw new Error(_0x36a4('0xa7'));}}})[_0x36a4('0x20')](function(_0x53a66f){if(_0x53a66f){_0x2c7232=_0x53a66f;if(_0xda1425[_0x36a4('0x9b')]){if(_0xda1425['List']['Contacts'][_0x36a4('0x63')]){return _0xda1425[_0x36a4('0x9b')][_0x36a4('0x9c')][0x0];}else{return db[_0x36a4('0x8b')][_0x36a4('0x60')](_['defaults'](_0x52cf43[_0x36a4('0x5b')],{'firstName':_0x52cf43['body']['to'],'email':_0x52cf43[_0x36a4('0x5b')]['to'],'phone':_0x52cf43['body']['to'],'ListId':_0xda1425[_0x36a4('0x6d')]}));}}else{throw new Error(_0x36a4('0xa7'));}}})['then'](function(_0x353930){if(_0x353930){var _0x188da5={'UserId':_0x52cf43[_0x36a4('0x72')]['id'],'ContactId':_0x353930['id'],'MailAccountId':_0xda1425['id'],'inReplyTo':_0x2c7232[_0x36a4('0xa8')],'to':_0x52cf43['body'][_0x36a4('0x9e')],'cc':_0x52cf43[_0x36a4('0x5b')]['cc'],'subject':_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa9')],'attach':_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xaa')],'firstMsgDirection':_0x36a4('0xab'),'lastMsgAt':moment()[_0x36a4('0x99')](_0x36a4('0xac')),'lastMsgDirection':_0x36a4('0xab'),'lastMsgBody':_0x52cf43['body'][_0x36a4('0x5b')],'Messages':[_[_0x36a4('0x59')](_0x52cf43[_0x36a4('0x5b')],{'messageId':_0x2c7232['messageId'],'sentAt':moment()[_0x36a4('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xda1425['id'],'UserId':_0x52cf43[_0x36a4('0x72')]['id'],'ContactId':_0x353930['id']})]};if(_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xad')]){_0x188da5=_[_0x36a4('0x59')](_0x188da5,_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xad')]);}return db[_0x36a4('0x89')][_0x36a4('0x60')](_0x188da5,{'include':[{'model':db[_0x36a4('0x97')],'as':_0x36a4('0xae')}]});}})['then'](respondWithResult(_0x38dd08,null))[_0x36a4('0x2a')](handleError(_0x38dd08,null));};exports['verifySmtp']=function(_0x568e62,_0x363b37,_0x22bda6){return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x568e62['params']['id']},'include':[{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d'),'raw':!![]}]})[_0x36a4('0x20')](handleEntityNotFound(_0x363b37,null))[_0x36a4('0x20')](function(_0xd5244){if(_0xd5244&&_0xd5244['Smtp']){var _0x9aff9d={'id':_0xd5244['id'],'tls':{'rejectUnauthorized':![]}};if(_0xd5244[_0x36a4('0x3d')][_0x36a4('0x77')]){_0x9aff9d['service']=_0xd5244['Smtp'][_0x36a4('0x77')];}else{_0x9aff9d[_0x36a4('0x75')]=_0xd5244[_0x36a4('0x3d')][_0x36a4('0x75')];_0x9aff9d['port']=_0xd5244[_0x36a4('0x3d')][_0x36a4('0x76')];_0x9aff9d[_0x36a4('0xaf')]=_0xd5244['Smtp']['secure'];}if(_0xd5244['Smtp'][_0x36a4('0x74')]){_0x9aff9d[_0x36a4('0xa5')]={'user':_0xd5244['Smtp'][_0x36a4('0x72')],'pass':_0xd5244[_0x36a4('0x3d')][_0x36a4('0x79')]};}return respondWithRpcPromise(_0x36a4('0xb0'),_0x36a4('0xb1'),{'account':_0x9aff9d});}})[_0x36a4('0x20')](respondWithResult(_0x363b37,null))[_0x36a4('0x2a')](handleError(_0x363b37,null));};exports[_0x36a4('0x35')]=function(_0x40c139,_0x41bad7){return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x40c139[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x41bad7,null))[_0x36a4('0x20')](function(_0x413f93){if(_0x413f93&&_0x413f93[_0x36a4('0x77')]){throw new db['Sequelize'][(_0x36a4('0xb2'))](_0x36a4('0xb3'));}return _0x413f93;})[_0x36a4('0x20')](removeEntity(_0x41bad7,null))['catch'](handleError(_0x41bad7,null));};exports['addAgents']=function(_0x4f22c5,_0x3cd54a,_0x4fabf6){return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x4f22c5['params']['id']}})['then'](handleEntityNotFound(_0x3cd54a,null))[_0x36a4('0x20')](function(_0x32b315){if(_0x32b315){return _0x32b315['addAgents'](_0x4f22c5[_0x36a4('0x5b')][_0x36a4('0x67')],_['omit'](_0x4f22c5[_0x36a4('0x5b')],[_0x36a4('0x67'),'id'])||{})[_0x36a4('0xb4')](function(_0x5068c8){for(var _0x45ac7b=0x0;_0x45ac7b<_0x4f22c5[_0x36a4('0x5b')]['ids']['length'];_0x45ac7b+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x4f22c5[_0x36a4('0x5b')]['ids'][_0x45ac7b],'MailAccountId':_0x4f22c5['params']['id']});}return _0x5068c8;});}})[_0x36a4('0x20')](respondWithResult(_0x3cd54a,null))[_0x36a4('0x2a')](handleError(_0x3cd54a,null));};exports[_0x36a4('0xb5')]=function(_0x33ff96,_0x3389a2,_0x2d8442){return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x33ff96[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x3389a2,null))[_0x36a4('0x20')](function(_0x83d8e3){if(_0x83d8e3){return _0x83d8e3[_0x36a4('0xb5')](_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')])['then'](function(){if(_[_0x36a4('0xb6')](_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')])){for(var _0x459f97=0x0;_0x459f97<_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')][_0x36a4('0x63')];_0x459f97+=0x1){socket[_0x36a4('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')][_0x459f97]),'MailAccountId':Number(_0x33ff96[_0x36a4('0x54')]['id'])});}}else{socket[_0x36a4('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')]),'MailAccountId':Number(_0x33ff96['params']['id'])});}});}})[_0x36a4('0x20')](respondWithStatusCode(_0x3389a2,null))[_0x36a4('0x2a')](handleError(_0x3389a2,null));};exports[_0x36a4('0xb8')]=function(_0x496759,_0x7d8d12,_0x2ea8cc){var _0x270d88={};var _0x52fc2a={};var _0xcdaa8f;var _0xb05df0;return db['MailAccount']['findOne']({'where':{'id':_0x496759['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x7d8d12,null))[_0x36a4('0x20')](function(_0x344bf2){if(_0x344bf2){_0xcdaa8f=_0x344bf2;_0x52fc2a[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x8d')][_0x36a4('0x57')]);_0x52fc2a[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x496759['query']);_0x52fc2a[_0x36a4('0x46')]=_[_0x36a4('0x48')](_0x52fc2a['model'],_0x52fc2a[_0x36a4('0x44')]);_0x270d88['attributes']=_[_0x36a4('0x48')](_0x52fc2a[_0x36a4('0x43')],qs['fields'](_0x496759[_0x36a4('0x44')][_0x36a4('0x49')]));_0x270d88[_0x36a4('0x47')]=_0x270d88[_0x36a4('0x47')][_0x36a4('0x63')]?_0x270d88[_0x36a4('0x47')]:_0x52fc2a[_0x36a4('0x43')];_0x270d88[_0x36a4('0x4c')]=qs['sort'](_0x496759[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x270d88[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x496759['query'],_0x52fc2a['filters']));if(_0x496759['query'][_0x36a4('0x50')]){_0x270d88[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x270d88['where'],{'$or':_['map'](_0x270d88[_0x36a4('0x47')],function(_0x4545df){var _0x299518={};_0x299518[_0x4545df]={'$like':'%'+_0x496759[_0x36a4('0x44')]['filter']+'%'};return _0x299518;})});}_0x270d88=_[_0x36a4('0x59')]({},_0x270d88,_0x496759['options']);return _0xcdaa8f['getAgents'](_0x270d88);}})[_0x36a4('0x20')](function(_0x525340){if(_0x525340){_0xb05df0=_0x525340[_0x36a4('0x63')];if(!_0x496759[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x270d88[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x496759['query'][_0x36a4('0x30')]);_0x270d88['offset']=qs[_0x36a4('0x2f')](_0x496759[_0x36a4('0x44')]['offset']);}return _0xcdaa8f[_0x36a4('0xb8')](_0x270d88);}})['then'](function(_0x51e282){if(_0x51e282){return _0x51e282?{'count':_0xb05df0,'rows':_0x51e282}:null;}})['then'](respondWithResult(_0x7d8d12,null))[_0x36a4('0x2a')](handleError(_0x7d8d12,null));}; \ No newline at end of file +var _0x7494=['MailAccountId','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getImap','removeImap','setImap','addSmtp','addInteraction','MailInteraction','ids','getInteractions','CmContact','Contact','User','fullname','internal','Tags','color','tag','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','CmList','List','Contacts','DESC','from','format','%s\x20<%s>','attachments','join','server/files/attachments','auth','secure','sendMail','List\x20not\x20found','ListId','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','VerifySmtp','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','params','includeAll','find','body','describe','addDisposition','Disposition','create','findOne','nolimit','pick'];(function(_0xc29cc2,_0x3a99eb){var _0xf6f7fc=function(_0x18b0b1){while(--_0x18b0b1){_0xc29cc2['push'](_0xc29cc2['shift']());}};_0xf6f7fc(++_0x3a99eb);}(_0x7494,0x1b1));var _0x4749=function(_0x50652e,_0x2a341c){_0x50652e=_0x50652e-0x0;var _0x50ce08=_0x7494[_0x50652e];return _0x50ce08;};'use strict';var pdf=require(_0x4749('0x0'));var emlformat=require(_0x4749('0x1'));var rimraf=require(_0x4749('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4749('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4749('0x4'));var Mustache=require('mustache');var util=require(_0x4749('0x5'));var path=require(_0x4749('0x6'));var sox=require('sox');var csv=require(_0x4749('0x7'));var ejs=require(_0x4749('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4749('0x9'));var crypto=require(_0x4749('0xa'));var jsforce=require(_0x4749('0xb'));var deskjs=require(_0x4749('0xc'));var toCsv=require(_0x4749('0x7'));var querystring=require(_0x4749('0xd'));var Papa=require(_0x4749('0xe'));var Redis=require(_0x4749('0xf'));var authService=require(_0x4749('0x10'));var qs=require(_0x4749('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4749('0x12'));var logger=require('../../config/logger')(_0x4749('0x13'));var utils=require(_0x4749('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4749('0x15'));var db=require(_0x4749('0x16'))['db'];config[_0x4749('0x17')]=_[_0x4749('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4749('0x17')]));require(_0x4749('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x3977f5,_0x17ca83,_0x2d4d73,_0x12dbd5){return new BPromise(function(_0x45335c,_0x5d6fce){var _0x2be00b=_0x12dbd5||client;return _0x2be00b[_0x4749('0x1a')](_0x3977f5,_0x2d4d73)[_0x4749('0x1b')](function(_0x60411c){logger['info'](_0x4749('0x1c'),_0x17ca83,'request\x20sent');logger['debug'](_0x4749('0x1d'),_0x17ca83,'request\x20sent',JSON[_0x4749('0x1e')](_0x60411c));if(_0x60411c[_0x4749('0x1f')]){if(_0x60411c[_0x4749('0x1f')]['code']===0x1f4){logger[_0x4749('0x1f')](_0x4749('0x1c'),_0x17ca83,_0x60411c['error'][_0x4749('0x20')]);return _0x5d6fce(_0x60411c[_0x4749('0x1f')]['message']);}logger[_0x4749('0x1f')](_0x4749('0x1c'),_0x17ca83,_0x60411c[_0x4749('0x1f')][_0x4749('0x20')]);return _0x45335c(_0x60411c[_0x4749('0x1f')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x17ca83,_0x4749('0x21'));_0x45335c(_0x60411c[_0x4749('0x22')][_0x4749('0x20')]);}})[_0x4749('0x23')](function(_0x57dc15){logger[_0x4749('0x1f')](_0x4749('0x1c'),_0x17ca83,_0x57dc15);_0x5d6fce(_0x57dc15);});});}function respondWithStatusCode(_0x205a81,_0x4ed824){_0x4ed824=_0x4ed824||0xcc;return function(_0x310c9c){if(_0x310c9c){return _0x205a81['sendStatus'](_0x4ed824);}return _0x205a81[_0x4749('0x24')](_0x4ed824)[_0x4749('0x25')]();};}function respondWithResult(_0x2684ec,_0x409721){_0x409721=_0x409721||0xc8;return function(_0x3f2a10){if(_0x3f2a10){return _0x2684ec['status'](_0x409721)[_0x4749('0x26')](_0x3f2a10);}};}function respondWithFilteredResult(_0xbdc16b,_0x5759a7){return function(_0x323b3f){if(_0x323b3f){var _0x2e14fc=_0x323b3f[_0x4749('0x27')],_0x13aeee=_0x5759a7[_0x4749('0x28')],_0x1d1059=_0x5759a7[_0x4749('0x28')]+_0x5759a7[_0x4749('0x29')],_0x2a8046;if(_0x1d1059>=_0x2e14fc){_0x1d1059=_0x2e14fc;_0x2a8046=0xc8;}else{_0x2a8046=0xce;}_0xbdc16b['status'](_0x2a8046);return _0xbdc16b[_0x4749('0x2a')](_0x4749('0x2b'),_0x13aeee+'-'+_0x1d1059+'/'+_0x2e14fc)[_0x4749('0x26')](_0x323b3f);}return null;};}function patchUpdates(_0x11b228){return function(_0xc8cc7d){try{jsonpatch[_0x4749('0x2c')](_0xc8cc7d,_0x11b228,!![]);}catch(_0xb14ca3){return BPromise['reject'](_0xb14ca3);}return _0xc8cc7d[_0x4749('0x2d')]();};}function saveUpdates(_0x2800cc,_0x3a7513){return function(_0x2992ae){if(_0x2992ae){return _0x2992ae[_0x4749('0x2e')](_0x2800cc)[_0x4749('0x1b')](function(_0x29cdaa){return _0x29cdaa;});}return null;};}function removeEntity(_0x948b57,_0x23b81a){return function(_0xc190a3){if(_0xc190a3){return _0xc190a3[_0x4749('0x2f')]()[_0x4749('0x1b')](function(){var _0x52e6ff=_0xc190a3[_0x4749('0x30')]({'plain':!![]});var _0x5a70e2=_0x4749('0x31');return db[_0x4749('0x32')][_0x4749('0x2f')]({'where':{'type':_0x5a70e2,'resourceId':_0x52e6ff['id']}})[_0x4749('0x1b')](function(){return _0xc190a3;});})[_0x4749('0x1b')](function(){_0x948b57['status'](0xcc)[_0x4749('0x25')]();});}};}function handleEntityNotFound(_0x5a097d,_0x42847d){return function(_0x341532){if(!_0x341532){_0x5a097d['sendStatus'](0x194);}return _0x341532;};}function handleError(_0x1ecf31,_0x559e4c){_0x559e4c=_0x559e4c||0x1f4;return function(_0x356729){logger[_0x4749('0x1f')](_0x356729[_0x4749('0x33')]);if(_0x356729['name']){delete _0x356729[_0x4749('0x34')];}_0x1ecf31['status'](_0x559e4c)[_0x4749('0x35')](_0x356729);};}exports['index']=function(_0x58b527,_0x3f75ec){var _0x45a5ab={'include':[{'model':db[_0x4749('0x36')],'as':_0x4749('0x37')},{'model':db[_0x4749('0x38')],'as':_0x4749('0x39')},{'model':db[_0x4749('0x3a')],'as':_0x4749('0x3b')}]},_0x557f6e={},_0x377639={'count':0x0,'rows':[]};var _0x34ff0e=_[_0x4749('0x3c')](db[_0x4749('0x3d')][_0x4749('0x3e')],function(_0x6ac0eb){return{'name':_0x6ac0eb[_0x4749('0x3f')],'type':_0x6ac0eb[_0x4749('0x40')]['key']};});_0x557f6e['model']=_[_0x4749('0x3c')](_0x34ff0e,'name');_0x557f6e['query']=_[_0x4749('0x41')](_0x58b527[_0x4749('0x42')]);_0x557f6e[_0x4749('0x43')]=_[_0x4749('0x44')](_0x557f6e['model'],_0x557f6e['query']);_0x45a5ab[_0x4749('0x45')]=_[_0x4749('0x44')](_0x557f6e[_0x4749('0x46')],qs[_0x4749('0x47')](_0x58b527['query'][_0x4749('0x47')]));_0x45a5ab[_0x4749('0x45')]=_0x45a5ab['attributes'][_0x4749('0x48')]?_0x45a5ab[_0x4749('0x45')]:_0x557f6e[_0x4749('0x46')];if(!_0x58b527[_0x4749('0x42')][_0x4749('0x49')]('nolimit')){_0x45a5ab[_0x4749('0x29')]=qs['limit'](_0x58b527[_0x4749('0x42')][_0x4749('0x29')]);_0x45a5ab[_0x4749('0x28')]=qs[_0x4749('0x28')](_0x58b527[_0x4749('0x42')][_0x4749('0x28')]);}_0x45a5ab[_0x4749('0x4a')]=qs[_0x4749('0x4b')](_0x58b527[_0x4749('0x42')]['sort']);_0x45a5ab[_0x4749('0x4c')]=qs[_0x4749('0x43')](_['pick'](_0x58b527['query'],_0x557f6e[_0x4749('0x43')]),_0x34ff0e);if(_0x58b527[_0x4749('0x42')]['filter']){_0x45a5ab[_0x4749('0x4c')]=_[_0x4749('0x4d')](_0x45a5ab[_0x4749('0x4c')],{'$or':_[_0x4749('0x3c')](_0x34ff0e,function(_0x2c1460){if(_0x2c1460[_0x4749('0x40')]!==_0x4749('0x4e')){var _0xbed8d2={};_0xbed8d2[_0x2c1460[_0x4749('0x34')]]={'$like':'%'+_0x58b527[_0x4749('0x42')][_0x4749('0x4f')]+'%'};return _0xbed8d2;}})});}_0x45a5ab=_[_0x4749('0x4d')]({},_0x45a5ab,_0x58b527[_0x4749('0x50')]);var _0x5063a6={'where':_0x45a5ab['where']};return db['MailAccount'][_0x4749('0x27')](_0x5063a6)[_0x4749('0x1b')](function(_0x1e1b22){_0x377639[_0x4749('0x27')]=_0x1e1b22;if(_0x58b527[_0x4749('0x42')]['includeAll']){_0x45a5ab[_0x4749('0x51')]=[{'all':!![]}];}return db[_0x4749('0x3d')][_0x4749('0x52')](_0x45a5ab);})[_0x4749('0x1b')](function(_0x2a4fdd){_0x377639[_0x4749('0x53')]=_0x2a4fdd;return _0x377639;})[_0x4749('0x1b')](respondWithFilteredResult(_0x3f75ec,_0x45a5ab))[_0x4749('0x23')](handleError(_0x3f75ec,null));};exports['show']=function(_0xb43225,_0x35864f){var _0x4ad206={'raw':![],'where':{'id':_0xb43225[_0x4749('0x54')]['id']},'include':[{'model':db[_0x4749('0x36')],'as':_0x4749('0x37')},{'model':db[_0x4749('0x38')],'as':_0x4749('0x39')},{'model':db[_0x4749('0x3a')],'as':_0x4749('0x3b')}]},_0x45eb03={};_0x45eb03['model']=_[_0x4749('0x41')](db[_0x4749('0x3d')][_0x4749('0x3e')]);_0x45eb03[_0x4749('0x42')]=_[_0x4749('0x41')](_0xb43225['query']);_0x45eb03[_0x4749('0x43')]=_['intersection'](_0x45eb03['model'],_0x45eb03[_0x4749('0x42')]);_0x4ad206[_0x4749('0x45')]=_['intersection'](_0x45eb03[_0x4749('0x46')],qs[_0x4749('0x47')](_0xb43225[_0x4749('0x42')][_0x4749('0x47')]));_0x4ad206[_0x4749('0x45')]=_0x4ad206[_0x4749('0x45')][_0x4749('0x48')]?_0x4ad206[_0x4749('0x45')]:_0x45eb03[_0x4749('0x46')];if(_0xb43225[_0x4749('0x42')][_0x4749('0x55')]){_0x4ad206['include']=[{'all':!![]}];}_0x4ad206=_['merge']({},_0x4ad206,_0xb43225[_0x4749('0x50')]);return db[_0x4749('0x3d')][_0x4749('0x56')](_0x4ad206)[_0x4749('0x1b')](handleEntityNotFound(_0x35864f,null))[_0x4749('0x1b')](respondWithResult(_0x35864f,null))[_0x4749('0x23')](handleError(_0x35864f,null));};exports[_0x4749('0x2e')]=function(_0x124f23,_0x220069){if(_0x124f23[_0x4749('0x57')]['id']){delete _0x124f23[_0x4749('0x57')]['id'];}return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x124f23[_0x4749('0x54')]['id']},'include':[{'model':db[_0x4749('0x36')],'as':'Imap'},{'model':db[_0x4749('0x38')],'as':_0x4749('0x39')},{'model':db[_0x4749('0x3a')],'as':_0x4749('0x3b')}]})['then'](handleEntityNotFound(_0x220069,null))[_0x4749('0x1b')](saveUpdates(_0x124f23[_0x4749('0x57')],null))[_0x4749('0x1b')](function(_0x50f49d){if(_0x50f49d&&_0x124f23[_0x4749('0x57')][_0x4749('0x37')]){return db[_0x4749('0x36')]['update'](_0x124f23[_0x4749('0x57')][_0x4749('0x37')],{'where':{'MailAccountId':_0x50f49d['id']}})[_0x4749('0x1b')](function(){return _0x50f49d;});}return _0x50f49d;})[_0x4749('0x1b')](function(_0x21be40){if(_0x21be40&&_0x124f23['body'][_0x4749('0x39')]){return db[_0x4749('0x38')][_0x4749('0x2e')](_0x124f23['body'][_0x4749('0x39')],{'where':{'MailAccountId':_0x21be40['id']}})[_0x4749('0x1b')](function(){return _0x21be40;});}return _0x21be40;})[_0x4749('0x1b')](respondWithResult(_0x220069,null))['catch'](handleError(_0x220069,null));};exports[_0x4749('0x58')]=function(_0x242bd0,_0x457a4c){return db[_0x4749('0x3d')]['describe']()[_0x4749('0x1b')](respondWithResult(_0x457a4c,null))['catch'](handleError(_0x457a4c,null));};exports[_0x4749('0x59')]=function(_0x21d78a,_0x48511a,_0xc9ba62){if(_0x21d78a['body']['id']){delete _0x21d78a[_0x4749('0x57')]['id'];}return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x21d78a[_0x4749('0x54')]['id']}})['then'](handleEntityNotFound(_0x48511a,null))[_0x4749('0x1b')](function(_0x38be2d){if(_0x38be2d){_0x21d78a[_0x4749('0x57')]['MailAccountId']=_0x38be2d['id'];return db[_0x4749('0x5a')][_0x4749('0x5b')](_0x21d78a[_0x4749('0x57')]);}})['then'](respondWithResult(_0x48511a,null))['catch'](handleError(_0x48511a,null));};exports['getDispositions']=function(_0x3d094f,_0x42a775,_0x57e69f){var _0x4bec3b={'raw':![],'where':{}};var _0x36f689={};var _0x5bb833={'count':0x0,'rows':[]};return db[_0x4749('0x3d')][_0x4749('0x5c')]({'where':{'id':_0x3d094f['params']['id']}})['then'](handleEntityNotFound(_0x42a775,null))[_0x4749('0x1b')](function(_0x2b8d1b){if(_0x2b8d1b){_0x36f689[_0x4749('0x46')]=_['keys'](db[_0x4749('0x5a')][_0x4749('0x3e')]);_0x36f689['query']=_[_0x4749('0x41')](_0x3d094f['query']);_0x36f689[_0x4749('0x43')]=_[_0x4749('0x44')](_0x36f689[_0x4749('0x46')],_0x36f689[_0x4749('0x42')]);_0x4bec3b['attributes']=_[_0x4749('0x44')](_0x36f689['model'],qs[_0x4749('0x47')](_0x3d094f[_0x4749('0x42')][_0x4749('0x47')]));_0x4bec3b[_0x4749('0x45')]=_0x4bec3b[_0x4749('0x45')][_0x4749('0x48')]?_0x4bec3b['attributes']:_0x36f689[_0x4749('0x46')];if(!_0x3d094f[_0x4749('0x42')][_0x4749('0x49')](_0x4749('0x5d'))){_0x4bec3b[_0x4749('0x29')]=qs[_0x4749('0x29')](_0x3d094f[_0x4749('0x42')][_0x4749('0x29')]);_0x4bec3b[_0x4749('0x28')]=qs['offset'](_0x3d094f['query'][_0x4749('0x28')]);}_0x4bec3b[_0x4749('0x4a')]=qs[_0x4749('0x4b')](_0x3d094f[_0x4749('0x42')][_0x4749('0x4b')]);_0x4bec3b[_0x4749('0x4c')]=qs['filters'](_[_0x4749('0x5e')](_0x3d094f[_0x4749('0x42')],_0x36f689[_0x4749('0x43')]));_0x4bec3b[_0x4749('0x4c')][_0x4749('0x5f')]=_0x2b8d1b['id'];if(_0x3d094f[_0x4749('0x42')][_0x4749('0x4f')]){_0x4bec3b[_0x4749('0x4c')]=_[_0x4749('0x4d')](_0x4bec3b['where'],{'$or':_[_0x4749('0x3c')](_0x4bec3b[_0x4749('0x45')],function(_0x24be90){var _0x5f3b3e={};_0x5f3b3e[_0x24be90]={'$like':'%'+_0x3d094f['query'][_0x4749('0x4f')]+'%'};return _0x5f3b3e;})});}_0x4bec3b=_[_0x4749('0x4d')]({},_0x4bec3b,_0x3d094f[_0x4749('0x50')]);return db[_0x4749('0x5a')][_0x4749('0x27')]({'where':_0x4bec3b[_0x4749('0x4c')]})[_0x4749('0x1b')](function(_0x3b623e){_0x5bb833['count']=_0x3b623e;if(_0x3d094f['query'][_0x4749('0x55')]){_0x4bec3b[_0x4749('0x51')]=[{'all':!![]}];}return db[_0x4749('0x5a')][_0x4749('0x52')](_0x4bec3b);})[_0x4749('0x1b')](function(_0x337928){_0x5bb833[_0x4749('0x53')]=_0x337928;return _0x5bb833;});}})[_0x4749('0x1b')](respondWithFilteredResult(_0x42a775,_0x4bec3b))[_0x4749('0x23')](handleError(_0x42a775,null));};exports[_0x4749('0x60')]=function(_0x54b2d0,_0x1af2cb,_0x18bed9){return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x54b2d0[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x1af2cb,null))[_0x4749('0x1b')](function(_0x483907){if(_0x483907){return _0x483907['removeDispositions'](_0x54b2d0[_0x4749('0x42')]['ids']);}})[_0x4749('0x1b')](respondWithStatusCode(_0x1af2cb,null))[_0x4749('0x23')](handleError(_0x1af2cb,null));};exports[_0x4749('0x61')]=function(_0x3776b7,_0x5e5033,_0x4e2989){if(_0x3776b7[_0x4749('0x57')]['id']){delete _0x3776b7['body']['id'];}return db[_0x4749('0x3d')]['find']({'where':{'id':_0x3776b7[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x5e5033,null))[_0x4749('0x1b')](function(_0x2dd3e4){if(_0x2dd3e4){_0x3776b7[_0x4749('0x57')][_0x4749('0x5f')]=_0x2dd3e4['id'];return db['CannedAnswer'][_0x4749('0x5b')](_0x3776b7[_0x4749('0x57')]);}})['then'](respondWithResult(_0x5e5033,null))[_0x4749('0x23')](handleError(_0x5e5033,null));};exports[_0x4749('0x62')]=function(_0x12c42d,_0x2798e0,_0x514e2c){var _0x1ab42e={'raw':![],'where':{}};var _0x31967e={};var _0x5b0fb3={'count':0x0,'rows':[]};return db[_0x4749('0x3d')]['findOne']({'where':{'id':_0x12c42d[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x2798e0,null))[_0x4749('0x1b')](function(_0x4eaf17){if(_0x4eaf17){_0x31967e[_0x4749('0x46')]=_[_0x4749('0x41')](db[_0x4749('0x63')][_0x4749('0x3e')]);_0x31967e['query']=_['keys'](_0x12c42d[_0x4749('0x42')]);_0x31967e[_0x4749('0x43')]=_[_0x4749('0x44')](_0x31967e[_0x4749('0x46')],_0x31967e[_0x4749('0x42')]);_0x1ab42e[_0x4749('0x45')]=_['intersection'](_0x31967e[_0x4749('0x46')],qs[_0x4749('0x47')](_0x12c42d['query']['fields']));_0x1ab42e[_0x4749('0x45')]=_0x1ab42e[_0x4749('0x45')][_0x4749('0x48')]?_0x1ab42e[_0x4749('0x45')]:_0x31967e[_0x4749('0x46')];if(!_0x12c42d[_0x4749('0x42')][_0x4749('0x49')](_0x4749('0x5d'))){_0x1ab42e[_0x4749('0x29')]=qs[_0x4749('0x29')](_0x12c42d['query'][_0x4749('0x29')]);_0x1ab42e['offset']=qs[_0x4749('0x28')](_0x12c42d[_0x4749('0x42')]['offset']);}_0x1ab42e['order']=qs[_0x4749('0x4b')](_0x12c42d['query'][_0x4749('0x4b')]);_0x1ab42e['where']=qs[_0x4749('0x43')](_['pick'](_0x12c42d['query'],_0x31967e['filters']));_0x1ab42e[_0x4749('0x4c')][_0x4749('0x5f')]=_0x4eaf17['id'];if(_0x12c42d[_0x4749('0x42')]['filter']){_0x1ab42e[_0x4749('0x4c')]=_[_0x4749('0x4d')](_0x1ab42e[_0x4749('0x4c')],{'$or':_[_0x4749('0x3c')](_0x1ab42e[_0x4749('0x45')],function(_0x5bc274){var _0x4768b8={};_0x4768b8[_0x5bc274]={'$like':'%'+_0x12c42d['query']['filter']+'%'};return _0x4768b8;})});}_0x1ab42e=_[_0x4749('0x4d')]({},_0x1ab42e,_0x12c42d[_0x4749('0x50')]);return db[_0x4749('0x63')][_0x4749('0x27')]({'where':_0x1ab42e['where']})[_0x4749('0x1b')](function(_0xbc9aa6){_0x5b0fb3[_0x4749('0x27')]=_0xbc9aa6;if(_0x12c42d[_0x4749('0x42')]['includeAll']){_0x1ab42e[_0x4749('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4749('0x52')](_0x1ab42e);})[_0x4749('0x1b')](function(_0x15acbd){_0x5b0fb3['rows']=_0x15acbd;return _0x5b0fb3;});}})[_0x4749('0x1b')](respondWithFilteredResult(_0x2798e0,_0x1ab42e))[_0x4749('0x23')](handleError(_0x2798e0,null));};exports[_0x4749('0x64')]=function(_0x215926,_0x59b5a9,_0xc9acf4){return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x215926[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x59b5a9,null))[_0x4749('0x1b')](function(_0x14733e){if(_0x14733e){return _0x14733e[_0x4749('0x64')](_0x215926[_0x4749('0x42')]['ids']);}})[_0x4749('0x1b')](respondWithStatusCode(_0x59b5a9,null))[_0x4749('0x23')](handleError(_0x59b5a9,null));};exports[_0x4749('0x5b')]=function(_0x31abf3,_0x292bed){var _0x3d7f9f={'name':_0x31abf3[_0x4749('0x57')][_0x4749('0x34')],'key':_0x31abf3[_0x4749('0x57')]['key'],'email':_0x31abf3['body'][_0x4749('0x65')],'ListId':_0x31abf3[_0x4749('0x57')]['ListId'],'active':!_[_0x4749('0x66')](_0x31abf3['body'][_0x4749('0x67')])?_0x31abf3[_0x4749('0x57')]['active']:!![],'description':_0x31abf3[_0x4749('0x57')][_0x4749('0x68')]||null,'Imap':{},'Smtp':{}};if(_[_0x4749('0x66')](_0x31abf3[_0x4749('0x57')][_0x4749('0x69')])){if(_0x31abf3['body'][_0x4749('0x6a')]){_0x3d7f9f[_0x4749('0x37')][_0x4749('0x6b')]=_0x3d7f9f['Smtp'][_0x4749('0x6b')]=_0x31abf3[_0x4749('0x57')][_0x4749('0x6c')];_0x3d7f9f[_0x4749('0x37')][_0x4749('0x6d')]=_0x3d7f9f[_0x4749('0x39')][_0x4749('0x6e')]=_0x31abf3[_0x4749('0x57')]['cpassword'];}else{_0x3d7f9f[_0x4749('0x37')][_0x4749('0x6f')]=_0x3d7f9f[_0x4749('0x39')][_0x4749('0x6f')]=![];}_0x3d7f9f['Imap'][_0x4749('0x70')]=_0x31abf3['body'][_0x4749('0x37')][_0x4749('0x70')];_0x3d7f9f[_0x4749('0x37')]['port']=_0x31abf3['body'][_0x4749('0x37')][_0x4749('0x71')];_0x3d7f9f['Smtp'][_0x4749('0x70')]=_0x31abf3[_0x4749('0x57')][_0x4749('0x39')][_0x4749('0x70')];_0x3d7f9f['Smtp'][_0x4749('0x71')]=_0x31abf3[_0x4749('0x57')][_0x4749('0x39')][_0x4749('0x71')];}else{_0x3d7f9f[_0x4749('0x37')]['service']=_0x3d7f9f[_0x4749('0x39')][_0x4749('0x72')]=_0x31abf3[_0x4749('0x57')]['cservice'];_0x3d7f9f['Imap'][_0x4749('0x6b')]=_0x3d7f9f[_0x4749('0x39')]['user']=_0x31abf3['body']['cuser'];_0x3d7f9f['Imap'][_0x4749('0x6d')]=_0x3d7f9f[_0x4749('0x39')][_0x4749('0x6e')]=_0x31abf3[_0x4749('0x57')][_0x4749('0x73')];}return db[_0x4749('0x3d')][_0x4749('0x5b')](_0x3d7f9f,{'include':[{'model':db[_0x4749('0x38')],'as':_0x4749('0x39')},{'model':db[_0x4749('0x36')],'as':_0x4749('0x37')}]})['then'](function(_0x3d1958){var _0xbf2883=_0x31abf3[_0x4749('0x6b')][_0x4749('0x30')]({'plain':!![]});if(!_0xbf2883)throw new Error(_0x4749('0x74'));if(_0xbf2883[_0x4749('0x75')]===_0x4749('0x6b')){var _0x57cc0e=_0x3d1958[_0x4749('0x30')]({'plain':!![]});return db[_0x4749('0x76')]['find']({'where':{'name':'MailAccounts','userProfileId':_0xbf2883['userProfileId']},'raw':!![]})[_0x4749('0x1b')](function(_0x377409){if(_0x377409&&_0x377409[_0x4749('0x77')]===0x0){return db[_0x4749('0x32')][_0x4749('0x5b')]({'name':_0x57cc0e['name'],'resourceId':_0x57cc0e['id'],'type':_0x377409[_0x4749('0x34')],'sectionId':_0x377409['id']},{})[_0x4749('0x1b')](function(){return _0x3d1958;});}else{return _0x3d1958;}})[_0x4749('0x23')](function(_0x3ec734){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ec734);throw _0x3ec734;});}return _0x3d1958;})[_0x4749('0x1b')](respondWithResult(_0x292bed,0xc9))['catch'](handleError(_0x292bed,null));};exports[_0x4749('0x78')]=function(_0x3c13ab,_0x231242,_0x143c29){return db[_0x4749('0x3d')][_0x4749('0x5c')]({'where':{'id':_0x3c13ab[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x231242,null))['then'](function(_0x3ffbcb){if(_0x3ffbcb){return _0x3ffbcb[_0x4749('0x78')]();}return null;})['then'](respondWithResult(_0x231242,null))[_0x4749('0x23')](handleError(_0x231242,null));};exports['addImap']=function(_0x20ab59,_0x4171a2,_0x166881){if(_0x20ab59['body']['id']){delete _0x20ab59['body']['id'];}return db[_0x4749('0x3d')]['find']({'where':{'id':_0x20ab59[_0x4749('0x54')]['id']}})['then'](handleEntityNotFound(_0x4171a2,null))[_0x4749('0x1b')](function(_0x4046c1){if(_0x4046c1){_0x20ab59['body'][_0x4749('0x5f')]=_0x4046c1['id'];return db[_0x4749('0x36')][_0x4749('0x5b')](_0x20ab59[_0x4749('0x57')]);}})[_0x4749('0x1b')](respondWithResult(_0x4171a2,null))['catch'](handleError(_0x4171a2,null));};exports[_0x4749('0x79')]=function(_0x3f2767,_0x2c021d,_0x54492a){return db[_0x4749('0x3d')][_0x4749('0x5c')]({'where':{'id':_0x3f2767['params']['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x2c021d,null))[_0x4749('0x1b')](function(_0x2844ae){if(_0x2844ae){return _0x2844ae[_0x4749('0x7a')](null);}return null;})['then'](respondWithStatusCode(_0x2c021d,null))[_0x4749('0x23')](handleError(_0x2c021d,null));};exports['getSmtp']=function(_0x18f594,_0x2267f0,_0x21bc85){return db[_0x4749('0x3d')][_0x4749('0x5c')]({'where':{'id':_0x18f594[_0x4749('0x54')]['id']}})['then'](handleEntityNotFound(_0x2267f0,null))[_0x4749('0x1b')](function(_0x11c3c5){if(_0x11c3c5){return _0x11c3c5['getSmtp']();}return null;})[_0x4749('0x1b')](respondWithResult(_0x2267f0,null))[_0x4749('0x23')](handleError(_0x2267f0,null));};exports[_0x4749('0x7b')]=function(_0x348dc5,_0x11030a,_0x5bab3e){if(_0x348dc5[_0x4749('0x57')]['id']){delete _0x348dc5[_0x4749('0x57')]['id'];}return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x348dc5[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x11030a,null))['then'](function(_0x346dac){if(_0x346dac){_0x348dc5['body']['MailAccountId']=_0x346dac['id'];return db['MailServerOut'][_0x4749('0x5b')](_0x348dc5['body']);}})['then'](respondWithResult(_0x11030a,null))[_0x4749('0x23')](handleError(_0x11030a,null));};exports['removeSmtp']=function(_0x1c1637,_0x1baef2,_0x23dcee){return db['MailAccount'][_0x4749('0x5c')]({'where':{'id':_0x1c1637[_0x4749('0x54')]['id']}})['then'](handleEntityNotFound(_0x1baef2,null))[_0x4749('0x1b')](function(_0x4b0f43){if(_0x4b0f43){return _0x4b0f43['setSmtp'](null);}return null;})[_0x4749('0x1b')](respondWithStatusCode(_0x1baef2,null))[_0x4749('0x23')](handleError(_0x1baef2,null));};exports[_0x4749('0x7c')]=function(_0xfd73a0,_0x5e8cb9,_0x174ed3){return db[_0x4749('0x7d')][_0x4749('0x56')]({'where':{'id':_0xfd73a0[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x5e8cb9,null))['then'](function(_0x4575fd){if(_0x4575fd){return _0x4575fd[_0x4749('0x7c')](_0xfd73a0[_0x4749('0x57')][_0x4749('0x7e')],_['omit'](_0xfd73a0['body'],[_0x4749('0x7e'),'id'])||{});}})[_0x4749('0x1b')](respondWithResult(_0x5e8cb9,null))[_0x4749('0x23')](handleError(_0x5e8cb9,null));};exports[_0x4749('0x7f')]=function(_0x103477,_0x487f2b,_0x36c8d4){var _0x1fdb4f={'raw':![],'where':{}};var _0x36ffe6={};var _0x79905={'count':0x0,'rows':[]};return db[_0x4749('0x3d')][_0x4749('0x5c')]({'where':{'id':_0x103477['params']['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x487f2b,null))['then'](function(_0x2cb572){if(_0x2cb572){_0x36ffe6[_0x4749('0x46')]=_[_0x4749('0x41')](db[_0x4749('0x7d')][_0x4749('0x3e')]);_0x36ffe6[_0x4749('0x42')]=_[_0x4749('0x41')](_0x103477[_0x4749('0x42')]);_0x36ffe6[_0x4749('0x43')]=_[_0x4749('0x44')](_0x36ffe6[_0x4749('0x46')],_0x36ffe6[_0x4749('0x42')]);_0x1fdb4f[_0x4749('0x45')]=_[_0x4749('0x44')](_0x36ffe6[_0x4749('0x46')],qs[_0x4749('0x47')](_0x103477['query'][_0x4749('0x47')]));_0x1fdb4f[_0x4749('0x45')]=_0x1fdb4f[_0x4749('0x45')][_0x4749('0x48')]?_0x1fdb4f['attributes']:_0x36ffe6[_0x4749('0x46')];if(!_0x103477[_0x4749('0x42')][_0x4749('0x49')](_0x4749('0x5d'))){_0x1fdb4f[_0x4749('0x29')]=qs[_0x4749('0x29')](_0x103477[_0x4749('0x42')][_0x4749('0x29')]);_0x1fdb4f['offset']=qs[_0x4749('0x28')](_0x103477[_0x4749('0x42')]['offset']);}_0x1fdb4f['order']=qs[_0x4749('0x4b')](_0x103477['query'][_0x4749('0x4b')]);_0x1fdb4f['where']=qs[_0x4749('0x43')](_[_0x4749('0x5e')](_0x103477[_0x4749('0x42')],_0x36ffe6[_0x4749('0x43')]));_0x1fdb4f[_0x4749('0x4c')]['MailAccountId']=_0x2cb572['id'];if(_0x103477[_0x4749('0x42')][_0x4749('0x4f')]){_0x1fdb4f[_0x4749('0x4c')]=_[_0x4749('0x4d')](_0x1fdb4f[_0x4749('0x4c')],{'$or':_[_0x4749('0x3c')](_0x1fdb4f[_0x4749('0x45')],function(_0x24de59){var _0x1e9586={};_0x1e9586[_0x24de59]={'$like':'%'+_0x103477['query'][_0x4749('0x4f')]+'%'};return _0x1e9586;})});}_0x1fdb4f=_[_0x4749('0x4d')]({},_0x1fdb4f,_0x103477[_0x4749('0x50')]);return db[_0x4749('0x7d')]['count']({'where':_0x1fdb4f['where']})[_0x4749('0x1b')](function(_0x2f1c56){_0x79905[_0x4749('0x27')]=_0x2f1c56;if(_0x103477[_0x4749('0x42')]['includeAll']){_0x1fdb4f['include']=[{'model':db[_0x4749('0x80')],'as':_0x4749('0x81'),'required':![]},{'model':db[_0x4749('0x82')],'as':'Owner','attributes':[_0x4749('0x34'),_0x4749('0x83'),_0x4749('0x84')],'required':![]},{'model':db['Tag'],'as':_0x4749('0x85'),'attributes':['id',_0x4749('0x34'),_0x4749('0x86')],'where':_0x103477[_0x4749('0x42')][_0x4749('0x87')]?{'id':_0x103477[_0x4749('0x42')][_0x4749('0x87')]}:undefined,'required':_0x103477[_0x4749('0x42')][_0x4749('0x87')]?!![]:![]}];}return db[_0x4749('0x7d')][_0x4749('0x52')](_0x1fdb4f);})[_0x4749('0x1b')](function(_0x5910b0){_0x79905[_0x4749('0x53')]=_0x5910b0;return _0x79905;});}})[_0x4749('0x1b')](respondWithFilteredResult(_0x487f2b,_0x1fdb4f))[_0x4749('0x23')](handleError(_0x487f2b,null));};exports['addApplications']=function(_0x258e9f,_0x1e5a6f,_0x259e2a){return db['MailAccount'][_0x4749('0x5c')]({'where':{'id':_0x258e9f[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x1e5a6f,null))[_0x4749('0x1b')](function(_0x254223){if(_0x254223){return db['sequelize'][_0x4749('0x88')](function(_0x42c728){return db[_0x4749('0x89')][_0x4749('0x2f')]({'where':{'MailAccountId':_0x258e9f['params']['id']},'transaction':_0x42c728})[_0x4749('0x1b')](function(_0x5bfb0d){var _0x2ab1f6=_[_0x4749('0x3c')](_0x258e9f[_0x4749('0x57')],function(_0xc6762a){_0xc6762a[_0x4749('0x5f')]=_0x258e9f[_0x4749('0x54')]['id'];return _0xc6762a;});return db['MailApplication'][_0x4749('0x8a')](_0x2ab1f6,{'transaction':_0x42c728});});})[_0x4749('0x1b')](function(){return db[_0x4749('0x89')][_0x4749('0x8b')]({'where':{'MailAccountId':_0x258e9f[_0x4749('0x54')]['id']},'order':'priority'});});}})[_0x4749('0x1b')](respondWithResult(_0x1e5a6f,null))[_0x4749('0x23')](handleError(_0x1e5a6f,null));};exports[_0x4749('0x8c')]=function(_0x3e99c9,_0x17ff46,_0x576e20){var _0x19d18b={};var _0x551de3={};var _0x178d67;var _0x2dff68;return db[_0x4749('0x3d')]['findOne']({'where':{'id':_0x3e99c9['params']['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x17ff46,null))[_0x4749('0x1b')](function(_0x3055ba){if(_0x3055ba){_0x178d67=_0x3055ba;_0x551de3['model']=_['keys'](db[_0x4749('0x89')][_0x4749('0x3e')]);_0x551de3['query']=_['keys'](_0x3e99c9['query']);_0x551de3['filters']=_['intersection'](_0x551de3[_0x4749('0x46')],_0x551de3[_0x4749('0x42')]);_0x19d18b[_0x4749('0x45')]=_[_0x4749('0x44')](_0x551de3[_0x4749('0x46')],qs['fields'](_0x3e99c9['query'][_0x4749('0x47')]));_0x19d18b[_0x4749('0x45')]=_0x19d18b[_0x4749('0x45')][_0x4749('0x48')]?_0x19d18b[_0x4749('0x45')]:_0x551de3[_0x4749('0x46')];_0x19d18b['order']=qs[_0x4749('0x4b')](_0x3e99c9['query'][_0x4749('0x4b')]);_0x19d18b['where']=qs[_0x4749('0x43')](_['pick'](_0x3e99c9[_0x4749('0x42')],_0x551de3[_0x4749('0x43')]));if(_0x3e99c9[_0x4749('0x42')][_0x4749('0x4f')]){_0x19d18b[_0x4749('0x4c')]=_[_0x4749('0x4d')](_0x19d18b['where'],{'$or':_[_0x4749('0x3c')](_0x19d18b[_0x4749('0x45')],function(_0x4a65ce){var _0x5b8fde={};_0x5b8fde[_0x4a65ce]={'$like':'%'+_0x3e99c9[_0x4749('0x42')][_0x4749('0x4f')]+'%'};return _0x5b8fde;})});}_0x19d18b=_[_0x4749('0x4d')]({},_0x19d18b,_0x3e99c9[_0x4749('0x50')]);return _0x178d67[_0x4749('0x8c')](_0x19d18b);}})[_0x4749('0x1b')](function(_0x2dc9d9){if(_0x2dc9d9){_0x2dff68=_0x2dc9d9['length'];if(!_0x3e99c9['query'][_0x4749('0x49')]('nolimit')){_0x19d18b['limit']=qs[_0x4749('0x29')](_0x3e99c9[_0x4749('0x42')][_0x4749('0x29')]);_0x19d18b[_0x4749('0x28')]=qs[_0x4749('0x28')](_0x3e99c9['query'][_0x4749('0x28')]);}return _0x178d67[_0x4749('0x8c')](_0x19d18b);}})['then'](function(_0x44b8da){if(_0x44b8da){return _0x44b8da?{'count':_0x2dff68,'rows':_0x44b8da}:null;}})[_0x4749('0x1b')](respondWithResult(_0x17ff46,null))[_0x4749('0x23')](handleError(_0x17ff46,null));};exports[_0x4749('0x8d')]=function(_0x131988,_0x3fcc8a,_0xe8219a){var _0x20c925={'raw':!![],'where':{}};var _0x1d59ae={};var _0xd76570={'count':0x0,'rows':[]};return db[_0x4749('0x3d')][_0x4749('0x5c')]({'where':{'id':_0x131988[_0x4749('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fcc8a,null))['then'](function(_0x2e34d8){if(_0x2e34d8){_0x1d59ae['model']=_[_0x4749('0x41')](db[_0x4749('0x8e')][_0x4749('0x3e')]);_0x1d59ae[_0x4749('0x42')]=_[_0x4749('0x41')](_0x131988['query']);_0x1d59ae[_0x4749('0x43')]=_[_0x4749('0x44')](_0x1d59ae[_0x4749('0x46')],_0x1d59ae[_0x4749('0x42')]);_0x20c925[_0x4749('0x45')]=_[_0x4749('0x44')](_0x1d59ae[_0x4749('0x46')],qs[_0x4749('0x47')](_0x131988[_0x4749('0x42')][_0x4749('0x47')]));_0x20c925['attributes']=_0x20c925[_0x4749('0x45')][_0x4749('0x48')]?_0x20c925['attributes']:_0x1d59ae[_0x4749('0x46')];if(!_0x131988[_0x4749('0x42')]['hasOwnProperty'](_0x4749('0x5d'))){_0x20c925['limit']=qs[_0x4749('0x29')](_0x131988[_0x4749('0x42')][_0x4749('0x29')]);_0x20c925[_0x4749('0x28')]=qs['offset'](_0x131988[_0x4749('0x42')]['offset']);}_0x20c925[_0x4749('0x4a')]=qs[_0x4749('0x4b')](_0x131988[_0x4749('0x42')][_0x4749('0x4b')]);_0x20c925[_0x4749('0x4c')]=qs[_0x4749('0x43')](_[_0x4749('0x5e')](_0x131988[_0x4749('0x42')],_0x1d59ae[_0x4749('0x43')]));_0x20c925['where'][_0x4749('0x5f')]=_0x2e34d8['id'];if(_0x131988['query'][_0x4749('0x4f')]){_0x20c925[_0x4749('0x4c')]=_['merge'](_0x20c925['where'],{'$or':_[_0x4749('0x3c')](_0x20c925[_0x4749('0x45')],function(_0x502fe3){var _0x2c9187={};_0x2c9187[_0x502fe3]={'$like':'%'+_0x131988[_0x4749('0x42')][_0x4749('0x4f')]+'%'};return _0x2c9187;})});}if(_0x131988['query'][_0x4749('0x8f')]){var _0x565c11=_0x131988[_0x4749('0x42')][_0x4749('0x8f')][_0x4749('0x90')](',');var _0x51cd10={};_0x51cd10[_0x565c11[0x0]]={'$gte':moment(_0x565c11[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x20c925[_0x4749('0x4c')]=_[_0x4749('0x4d')](_0x20c925[_0x4749('0x4c')],_0x51cd10);}_0x20c925=_[_0x4749('0x4d')]({},_0x20c925,_0x131988[_0x4749('0x50')]);return db['MailMessage'][_0x4749('0x27')]({'where':_0x20c925[_0x4749('0x4c')]})[_0x4749('0x1b')](function(_0xef95e5){_0xd76570['count']=_0xef95e5;if(_0x131988[_0x4749('0x42')]['includeAll']){_0x20c925[_0x4749('0x51')]=[{'all':!![]}];}return db[_0x4749('0x8e')][_0x4749('0x52')](_0x20c925);})[_0x4749('0x1b')](function(_0x77a0e){_0xd76570['rows']=_0x77a0e;return _0xd76570;});}})[_0x4749('0x1b')](respondWithFilteredResult(_0x3fcc8a,_0x20c925))[_0x4749('0x23')](handleError(_0x3fcc8a,null));};exports['send']=function(_0x45930d,_0x46d426,_0x5b6e01){var _0x344ce9,_0x31c9a8={},_0x427a1a;if(_0x45930d[_0x4749('0x57')]['to']){_0x427a1a=_0x45930d['body']['to']['split'](',')[0x0];}return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x45930d[_0x4749('0x54')]['id']},'include':[{'model':db[_0x4749('0x91')],'as':_0x4749('0x92'),'include':[{'model':db[_0x4749('0x80')],'as':_0x4749('0x93'),'where':{'email':_0x427a1a},'limit':0x1,'order':[['updatedAt',_0x4749('0x94')]]}]},{'model':db[_0x4749('0x38')],'as':_0x4749('0x39'),'raw':!![]}]})[_0x4749('0x1b')](handleEntityNotFound(_0x46d426,null))[_0x4749('0x1b')](function(_0x419ffe){if(_0x419ffe){_0x344ce9=_0x419ffe;if(_0x419ffe['Smtp']){if(_['isNil'](_0x45930d['body'][_0x4749('0x95')])){_0x45930d[_0x4749('0x57')][_0x4749('0x95')]=util[_0x4749('0x96')](_0x4749('0x97'),_0x419ffe['name'],_0x419ffe['email']||_0x419ffe[_0x4749('0x39')][_0x4749('0x6b')]);}if(_0x45930d['body'][_0x4749('0x98')]&&_0x45930d['body'][_0x4749('0x98')][_0x4749('0x48')]){for(var _0x3fde74=0x0;_0x3fde74<_0x45930d[_0x4749('0x57')][_0x4749('0x98')][_0x4749('0x48')];_0x3fde74+=0x1){_0x45930d['body']['attachments'][_0x3fde74]={'filename':_0x45930d[_0x4749('0x57')]['attachments'][_0x3fde74][_0x4749('0x34')],'path':path[_0x4749('0x99')](config['root'],_0x4749('0x9a'),_0x45930d['body'][_0x4749('0x98')][_0x3fde74]['basename'])};}}var _0x179e59={'tls':{'rejectUnauthorized':![]}};if(_[_0x4749('0x66')](_0x419ffe[_0x4749('0x39')][_0x4749('0x72')])){if(_0x419ffe[_0x4749('0x39')]['authentication']){_0x179e59[_0x4749('0x9b')]={'user':_0x419ffe['Smtp'][_0x4749('0x6b')],'pass':_0x419ffe['Smtp'][_0x4749('0x6e')]};}_0x179e59[_0x4749('0x70')]=_0x419ffe[_0x4749('0x39')]['host'];_0x179e59[_0x4749('0x71')]=_0x419ffe['Smtp'][_0x4749('0x71')];_0x179e59[_0x4749('0x9c')]=_0x419ffe[_0x4749('0x39')][_0x4749('0x9c')];}else{_0x179e59[_0x4749('0x72')]=_0x419ffe[_0x4749('0x39')][_0x4749('0x72')];_0x179e59[_0x4749('0x9b')]={'user':_0x419ffe[_0x4749('0x39')][_0x4749('0x6b')],'pass':_0x419ffe[_0x4749('0x39')][_0x4749('0x6e')]};}return respondWithRpcPromise('SendMail',_0x4749('0x9d'),{'account':_0x179e59,'message':_0x45930d[_0x4749('0x57')]});}else{throw new Error(_0x4749('0x9e'));}}})[_0x4749('0x1b')](function(_0x326763){if(_0x326763){_0x31c9a8=_0x326763;if(_0x344ce9[_0x4749('0x92')]){if(_0x344ce9[_0x4749('0x92')][_0x4749('0x93')][_0x4749('0x48')]){return _0x344ce9['List'][_0x4749('0x93')][0x0];}else{return db[_0x4749('0x80')][_0x4749('0x5b')](_[_0x4749('0x18')](_0x45930d[_0x4749('0x57')],{'firstName':_0x45930d[_0x4749('0x57')]['to'],'email':_0x45930d['body']['to'],'phone':_0x45930d['body']['to'],'ListId':_0x344ce9[_0x4749('0x9f')]}));}}else{throw new Error(_0x4749('0x9e'));}}})[_0x4749('0x1b')](function(_0x1e0025){if(_0x1e0025){var _0x22fc1a={'UserId':_0x45930d[_0x4749('0x6b')]['id'],'ContactId':_0x1e0025['id'],'MailAccountId':_0x344ce9['id'],'inReplyTo':_0x31c9a8['messageId'],'to':_0x45930d['body'][_0x4749('0x95')],'cc':_0x45930d[_0x4749('0x57')]['cc'],'subject':_0x45930d[_0x4749('0x57')][_0x4749('0xa0')],'attach':_0x45930d[_0x4749('0x57')]['attach'],'firstMsgDirection':_0x4749('0xa1'),'lastMsgAt':moment()['format'](_0x4749('0xa2')),'lastMsgDirection':_0x4749('0xa1'),'lastMsgBody':_0x45930d['body'][_0x4749('0x57')],'Messages':[_[_0x4749('0x4d')](_0x45930d['body'],{'messageId':_0x31c9a8[_0x4749('0xa3')],'sentAt':moment()[_0x4749('0x96')](_0x4749('0xa2')),'read':!![],'MailAccountId':_0x344ce9['id'],'UserId':_0x45930d['user']['id'],'ContactId':_0x1e0025['id']})]};if(_0x45930d[_0x4749('0x57')]['Interaction']){_0x22fc1a=_[_0x4749('0x4d')](_0x22fc1a,_0x45930d[_0x4749('0x57')][_0x4749('0xa4')]);}return db['MailInteraction'][_0x4749('0x5b')](_0x22fc1a,{'include':[{'model':db[_0x4749('0x8e')],'as':_0x4749('0xa5')}]});}})[_0x4749('0x1b')](respondWithResult(_0x46d426,null))[_0x4749('0x23')](handleError(_0x46d426,null));};exports['verifySmtp']=function(_0x471a91,_0x2018a4,_0x224e87){return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x471a91['params']['id']},'include':[{'model':db[_0x4749('0x38')],'as':_0x4749('0x39'),'raw':!![]}]})['then'](handleEntityNotFound(_0x2018a4,null))[_0x4749('0x1b')](function(_0x4738b3){if(_0x4738b3&&_0x4738b3['Smtp']){var _0x3b0938={'id':_0x4738b3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4738b3[_0x4749('0x39')][_0x4749('0x72')]){_0x3b0938[_0x4749('0x72')]=_0x4738b3[_0x4749('0x39')]['service'];}else{_0x3b0938[_0x4749('0x70')]=_0x4738b3[_0x4749('0x39')][_0x4749('0x70')];_0x3b0938[_0x4749('0x71')]=_0x4738b3[_0x4749('0x39')][_0x4749('0x71')];_0x3b0938[_0x4749('0x9c')]=_0x4738b3[_0x4749('0x39')]['secure'];}if(_0x4738b3[_0x4749('0x39')]['authentication']){_0x3b0938[_0x4749('0x9b')]={'user':_0x4738b3[_0x4749('0x39')][_0x4749('0x6b')],'pass':_0x4738b3['Smtp']['pass']};}return respondWithRpcPromise(_0x4749('0xa6'),_0x4749('0xa7'),{'account':_0x3b0938});}})[_0x4749('0x1b')](respondWithResult(_0x2018a4,null))['catch'](handleError(_0x2018a4,null));};exports['destroy']=function(_0x3d8f83,_0x35fbcc){return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x3d8f83['params']['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x35fbcc,null))['then'](function(_0x39e994){if(_0x39e994&&_0x39e994[_0x4749('0x72')]){throw new db['Sequelize']['ValidationError'](_0x4749('0xa8'));}return _0x39e994;})[_0x4749('0x1b')](removeEntity(_0x35fbcc,null))[_0x4749('0x23')](handleError(_0x35fbcc,null));};exports['addAgents']=function(_0x505b01,_0x52cb2d,_0x36ae3f){return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x505b01[_0x4749('0x54')]['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x52cb2d,null))[_0x4749('0x1b')](function(_0xc31271){if(_0xc31271){return _0xc31271[_0x4749('0xa9')](_0x505b01[_0x4749('0x57')]['ids'],_['omit'](_0x505b01[_0x4749('0x57')],[_0x4749('0x7e'),'id'])||{})[_0x4749('0xaa')](function(_0x533bc0){for(var _0x3586a4=0x0;_0x3586a4<_0x505b01[_0x4749('0x57')][_0x4749('0x7e')]['length'];_0x3586a4+=0x1){socket[_0x4749('0xab')](_0x4749('0xac'),{'UserId':_0x505b01[_0x4749('0x57')][_0x4749('0x7e')][_0x3586a4],'MailAccountId':_0x505b01[_0x4749('0x54')]['id']});}return _0x533bc0;});}})['then'](respondWithResult(_0x52cb2d,null))['catch'](handleError(_0x52cb2d,null));};exports[_0x4749('0xad')]=function(_0x5c057c,_0x9aa9ca,_0x2da863){return db[_0x4749('0x3d')][_0x4749('0x56')]({'where':{'id':_0x5c057c[_0x4749('0x54')]['id']}})['then'](handleEntityNotFound(_0x9aa9ca,null))[_0x4749('0x1b')](function(_0x2869f8){if(_0x2869f8){return _0x2869f8[_0x4749('0xad')](_0x5c057c['query']['ids'])[_0x4749('0x1b')](function(){if(_[_0x4749('0xae')](_0x5c057c[_0x4749('0x42')]['ids'])){for(var _0x305cb8=0x0;_0x305cb8<_0x5c057c[_0x4749('0x42')]['ids'][_0x4749('0x48')];_0x305cb8+=0x1){socket[_0x4749('0xab')]('userMailAccount:remove',{'UserId':Number(_0x5c057c[_0x4749('0x42')][_0x4749('0x7e')][_0x305cb8]),'MailAccountId':Number(_0x5c057c['params']['id'])});}}else{socket[_0x4749('0xab')]('userMailAccount:remove',{'UserId':Number(_0x5c057c[_0x4749('0x42')][_0x4749('0x7e')]),'MailAccountId':Number(_0x5c057c[_0x4749('0x54')]['id'])});}});}})[_0x4749('0x1b')](respondWithStatusCode(_0x9aa9ca,null))[_0x4749('0x23')](handleError(_0x9aa9ca,null));};exports[_0x4749('0xaf')]=function(_0x3f0512,_0x52051b,_0x3e8d1c){var _0x238a33={};var _0x462c30={};var _0x3d6993;var _0x57149b;return db[_0x4749('0x3d')][_0x4749('0x5c')]({'where':{'id':_0x3f0512['params']['id']}})[_0x4749('0x1b')](handleEntityNotFound(_0x52051b,null))[_0x4749('0x1b')](function(_0x52b850){if(_0x52b850){_0x3d6993=_0x52b850;_0x462c30[_0x4749('0x46')]=_[_0x4749('0x41')](db['User'][_0x4749('0x3e')]);_0x462c30[_0x4749('0x42')]=_[_0x4749('0x41')](_0x3f0512[_0x4749('0x42')]);_0x462c30['filters']=_[_0x4749('0x44')](_0x462c30[_0x4749('0x46')],_0x462c30['query']);_0x238a33[_0x4749('0x45')]=_[_0x4749('0x44')](_0x462c30[_0x4749('0x46')],qs['fields'](_0x3f0512[_0x4749('0x42')][_0x4749('0x47')]));_0x238a33[_0x4749('0x45')]=_0x238a33[_0x4749('0x45')][_0x4749('0x48')]?_0x238a33[_0x4749('0x45')]:_0x462c30[_0x4749('0x46')];_0x238a33['order']=qs[_0x4749('0x4b')](_0x3f0512['query']['sort']);_0x238a33['where']=qs[_0x4749('0x43')](_[_0x4749('0x5e')](_0x3f0512['query'],_0x462c30[_0x4749('0x43')]));if(_0x3f0512[_0x4749('0x42')]['filter']){_0x238a33['where']=_[_0x4749('0x4d')](_0x238a33['where'],{'$or':_[_0x4749('0x3c')](_0x238a33[_0x4749('0x45')],function(_0x37ddbf){var _0x56edb2={};_0x56edb2[_0x37ddbf]={'$like':'%'+_0x3f0512['query'][_0x4749('0x4f')]+'%'};return _0x56edb2;})});}_0x238a33=_[_0x4749('0x4d')]({},_0x238a33,_0x3f0512['options']);return _0x3d6993[_0x4749('0xaf')](_0x238a33);}})[_0x4749('0x1b')](function(_0x5b0d80){if(_0x5b0d80){_0x57149b=_0x5b0d80[_0x4749('0x48')];if(!_0x3f0512[_0x4749('0x42')][_0x4749('0x49')](_0x4749('0x5d'))){_0x238a33[_0x4749('0x29')]=qs[_0x4749('0x29')](_0x3f0512[_0x4749('0x42')][_0x4749('0x29')]);_0x238a33[_0x4749('0x28')]=qs[_0x4749('0x28')](_0x3f0512[_0x4749('0x42')][_0x4749('0x28')]);}return _0x3d6993['getAgents'](_0x238a33);}})[_0x4749('0x1b')](function(_0x4f9fd8){if(_0x4f9fd8){return _0x4f9fd8?{'count':_0x57149b,'rows':_0x4f9fd8}:null;}})[_0x4749('0x1b')](respondWithResult(_0x52051b,null))[_0x4749('0x23')](handleError(_0x52051b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e643f33..41471fd 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 _0xaa97=['events','MailAccount','setMaxListeners','save','update','remove','emit','exports'];(function(_0xbe19f7,_0x4243cc){var _0x1a7e66=function(_0x1515dd){while(--_0x1515dd){_0xbe19f7['push'](_0xbe19f7['shift']());}};_0x1a7e66(++_0x4243cc);}(_0xaa97,0x130));var _0x7aa9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xaa97[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x7aa9('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x7aa9('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7aa9('0x2')](0x0);var events={'afterCreate':_0x7aa9('0x3'),'afterUpdate':_0x7aa9('0x4'),'afterDestroy':_0x7aa9('0x5')};function emitEvent(_0x5980fd){return function(_0x642f89,_0x2dc893,_0x4a0618){MailAccountEvents[_0x7aa9('0x6')](_0x5980fd+':'+_0x642f89['id'],_0x642f89);MailAccountEvents[_0x7aa9('0x6')](_0x5980fd,_0x642f89);_0x4a0618(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x7aa9('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x8acb=['exports','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x6cd50b,_0x340db9){var _0x4c44b5=function(_0x558a76){while(--_0x558a76){_0x6cd50b['push'](_0x6cd50b['shift']());}};_0x4c44b5(++_0x340db9);}(_0x8acb,0xe9));var _0xb8ac=function(_0x2deff6,_0xf8c48c){_0x2deff6=_0x2deff6-0x0;var _0x24e316=_0x8acb[_0x2deff6];return _0x24e316;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb8ac('0x0')](0x0);var events={'afterCreate':_0xb8ac('0x1'),'afterUpdate':_0xb8ac('0x2'),'afterDestroy':_0xb8ac('0x3')};function emitEvent(_0x5e30da){return function(_0x5465b6,_0x1abb04,_0x4cc663){MailAccountEvents['emit'](_0x5e30da+':'+_0x5465b6['id'],_0x5465b6);MailAccountEvents[_0xb8ac('0x4')](_0x5e30da,_0x5465b6);_0x4cc663(null);};}for(var e in events){if(events[_0xb8ac('0x5')](e)){var event=events[e];MailAccount[_0xb8ac('0x6')](e,emitEvent(event));}}module[_0xb8ac('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 690f1ef..b84fed5 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 _0xc863=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','mail_accounts','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc863,0x1ea));var _0x3c86=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xc863[_0x47e549];return _0x251374;};'use strict';var _=require(_0x3c86('0x0'));var util=require(_0x3c86('0x1'));var logger=require(_0x3c86('0x2'))('api');var moment=require(_0x3c86('0x3'));var BPromise=require(_0x3c86('0x4'));var rp=require(_0x3c86('0x5'));var fs=require('fs');var path=require(_0x3c86('0x6'));var rimraf=require(_0x3c86('0x7'));var config=require(_0x3c86('0x8'));var attributes=require('./mailAccount.attributes');module[_0x3c86('0x9')]=function(_0x4f861e,_0x2ba3c8){return _0x4f861e[_0x3c86('0xa')]('MailAccount',attributes,{'tableName':_0x3c86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5be=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','MailAccount'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xa5be,0x10e));var _0xea5b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa5be[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea5b('0x0'))(_0xea5b('0x1'));var moment=require(_0xea5b('0x2'));var BPromise=require(_0xea5b('0x3'));var rp=require(_0xea5b('0x4'));var fs=require('fs');var path=require(_0xea5b('0x5'));var rimraf=require('rimraf');var config=require(_0xea5b('0x6'));var attributes=require('./mailAccount.attributes');module[_0xea5b('0x7')]=function(_0x22a064,_0xd0240d){return _0x22a064['define'](_0xea5b('0x8'),attributes,{'tableName':'mail_accounts','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 c6e4da1..632d269 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 _0xde9d=['close','*,*,*,*','create','List\x20not\x20found','contact','messageId','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','attributes','model','then','debug','find','ShowMailAccount','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','MailApplication','MailServerOut','get','omit','Applications','applications','list','orderBy','asc','autoclose','push','length'];(function(_0x12d4d3,_0x6b42e6){var _0x32fdca=function(_0x437223){while(--_0x437223){_0x12d4d3['push'](_0x12d4d3['shift']());}};_0x32fdca(++_0x6b42e6);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var moment=require(_0xdde9('0x2'));var BPromise=require(_0xdde9('0x3'));var rs=require(_0xdde9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdde9('0x5'))['db'];var utils=require(_0xdde9('0x6'));var logger=require(_0xdde9('0x7'))('rpc');var config=require(_0xdde9('0x8'));var jayson=require(_0xdde9('0x9'));var client=jayson[_0xdde9('0xa')]['http']({'port':0x232c});config[_0xdde9('0xb')]=_[_0xdde9('0xc')](config[_0xdde9('0xb')],{'host':_0xdde9('0xd'),'port':0x18eb});var socket=require(_0xdde9('0xe'))(new Redis(config['redis']));require(_0xdde9('0xf'))['register'](socket);function respondWithRpcPromise(_0x494899,_0x259849,_0x29c882){return new BPromise(function(_0x2b7e77,_0x4ebfe3){return client[_0xdde9('0x10')](_0x494899,_0x29c882)['then'](function(_0x478bec){logger[_0xdde9('0x11')](_0xdde9('0x12'),_0x259849,_0xdde9('0x13'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x259849,_0xdde9('0x13'),JSON[_0xdde9('0x14')](_0x478bec));if(_0x478bec['error']){if(_0x478bec['error'][_0xdde9('0x15')]===0x1f4){logger[_0xdde9('0x16')]('MailAccount,\x20%s,\x20%s',_0x259849,_0x478bec[_0xdde9('0x16')][_0xdde9('0x17')]);return _0x4ebfe3(_0x478bec[_0xdde9('0x16')]['message']);}logger[_0xdde9('0x16')]('MailAccount,\x20%s,\x20%s',_0x259849,_0x478bec['error'][_0xdde9('0x17')]);return _0x2b7e77(_0x478bec['error']['message']);}else{logger['info'](_0xdde9('0x12'),_0x259849,_0xdde9('0x13'));_0x2b7e77(_0x478bec[_0xdde9('0x18')][_0xdde9('0x17')]);}})[_0xdde9('0x19')](function(_0xcaf743){logger[_0xdde9('0x16')](_0xdde9('0x12'),_0x259849,_0xcaf743);_0x4ebfe3(_0xcaf743);});});}exports[_0xdde9('0x1a')]=function(_0x5ef451){var _0x5219c7=this;return new Promise(function(_0x71a5bf,_0x26204d){return db[_0xdde9('0x1b')][_0xdde9('0x1c')]({'raw':_0x5ef451[_0xdde9('0x1d')]?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ef451['options']?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x1f')]||null:null,'attributes':_0x5ef451[_0xdde9('0x1d')]?_0x5ef451['options']['attributes']||null:null,'limit':_0x5ef451[_0xdde9('0x1d')]?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x20')]||null:null,'include':_0x5ef451['options']?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x21')]?_[_0xdde9('0x22')](_0x5ef451[_0xdde9('0x1d')]['include'],function(_0x5e5ffd){return{'model':db[_0x5e5ffd['model']],'as':_0x5e5ffd['as'],'attributes':_0x5e5ffd[_0xdde9('0x23')],'include':_0x5e5ffd['include']?_[_0xdde9('0x22')](_0x5e5ffd[_0xdde9('0x21')],function(_0x4ea896){return{'model':db[_0x4ea896['model']],'as':_0x4ea896['as'],'attributes':_0x4ea896[_0xdde9('0x23')],'include':_0x4ea896[_0xdde9('0x21')]?_[_0xdde9('0x22')](_0x4ea896['include'],function(_0x4461db){return{'model':db[_0x4461db[_0xdde9('0x24')]],'as':_0x4461db['as'],'attributes':_0x4461db[_0xdde9('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdde9('0x25')](function(_0x306575){logger[_0xdde9('0x11')](_0xdde9('0x1a'),_0x5ef451);logger[_0xdde9('0x26')](_0xdde9('0x1a'),_0x5ef451,JSON['stringify'](_0x306575));_0x71a5bf(_0x306575);})[_0xdde9('0x19')](function(_0x4a631c){logger[_0xdde9('0x16')](_0xdde9('0x1a'),_0x4a631c[_0xdde9('0x17')],_0x5ef451);_0x26204d(_0x5219c7['error'](0x1f4,_0x4a631c['message']));});});};exports['ShowMailAccount']=function(_0xbe4b9c){var _0xb369a8=this;return new Promise(function(_0x35af5b,_0x1b252e){return db[_0xdde9('0x1b')][_0xdde9('0x27')]({'raw':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')][_0xdde9('0x1f')]||null:null,'attributes':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')][_0xdde9('0x23')]||null:null,'include':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')]['include']?_[_0xdde9('0x22')](_0xbe4b9c[_0xdde9('0x1d')][_0xdde9('0x21')],function(_0x1c32cf){return{'model':db[_0x1c32cf[_0xdde9('0x24')]],'as':_0x1c32cf['as'],'attributes':_0x1c32cf[_0xdde9('0x23')],'include':_0x1c32cf['include']?_[_0xdde9('0x22')](_0x1c32cf[_0xdde9('0x21')],function(_0xa9ca1a){return{'model':db[_0xa9ca1a[_0xdde9('0x24')]],'as':_0xa9ca1a['as'],'attributes':_0xa9ca1a[_0xdde9('0x23')],'include':_0xa9ca1a[_0xdde9('0x21')]?_['map'](_0xa9ca1a['include'],function(_0x234d88){return{'model':db[_0x234d88[_0xdde9('0x24')]],'as':_0x234d88['as'],'attributes':_0x234d88[_0xdde9('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdde9('0x25')](function(_0x1aa10e){logger[_0xdde9('0x11')](_0xdde9('0x28'),_0xbe4b9c);logger['debug'](_0xdde9('0x28'),_0xbe4b9c,JSON['stringify'](_0x1aa10e));_0x35af5b(_0x1aa10e);})['catch'](function(_0x33e742){logger['error'](_0xdde9('0x28'),_0x33e742['message'],_0xbe4b9c);_0x1b252e(_0xb369a8['error'](0x1f4,_0x33e742[_0xdde9('0x17')]));});});};exports['NotifyMailAccount']=function(_0x1bc20a){var _0x5038ac=this;return new Promise(function(_0x369565,_0x5ae971){var _0x3b1d55={'body':_0x1bc20a['body'],'channel':_0xdde9('0x29')};var _0x541570=_[_0xdde9('0x2a')](_[_0xdde9('0x2b')](db[_0xdde9('0x2c')]['rawAttributes']),[_0xdde9('0x2d'),_0xdde9('0x2e'),_0xdde9('0x2f'),_0xdde9('0x30')]);var _0x1d5762=![];if(_0x1bc20a[_0xdde9('0x31')]['id']){delete _0x1bc20a[_0xdde9('0x31')]['id'];}if(_[_0xdde9('0x32')](_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x33')])){return _0x5ae971(_0x5038ac['error'](0x1f4,_0xdde9('0x34')));}if(_[_0xdde9('0x32')](_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x31')])||_0x1bc20a['body'][_0xdde9('0x31')]===''){return _0x5ae971(_0x5038ac['error'](0x1f4,_0xdde9('0x35')));}if(_['isNil'](_0x1bc20a[_0xdde9('0x31')]['mapKey'])){return _0x5ae971(_0x5038ac['error'](0x1f4,_0xdde9('0x36')+_0x541570));}if(!_[_0xdde9('0x37')](_0x541570,_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x38')])){return _0x5ae971(_0x5038ac[_0xdde9('0x16')](0x1f4,_0xdde9('0x39')+_0x541570));}var _0x4f5431={};_0x4f5431[_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x38')]]=_0x1bc20a['body']['from'];return db[_0xdde9('0x1b')][_0xdde9('0x27')]({'where':{'id':_0x1bc20a[_0xdde9('0x3a')]['id']},'include':[{'model':db[_0xdde9('0x3b')],'as':_0xdde9('0x3c'),'include':[{'model':db['CmContact'],'as':_0xdde9('0x3d'),'where':_0x4f5431,'limit':0x1,'order':[[_0xdde9('0x2e'),'DESC']]}]},{'model':db[_0xdde9('0x3e')],'as':'Applications'},{'model':db[_0xdde9('0x3f')],'as':'Smtp'}]})[_0xdde9('0x25')](function(_0x509fc2){if(_0x509fc2&&_0x509fc2[_0xdde9('0x3c')]){var _0x4dd10a=_0x509fc2[_0xdde9('0x40')]({'plain':!![]});_0x3b1d55[_0xdde9('0x3a')]=_[_0xdde9('0x41')](_0x4dd10a,[_0xdde9('0x42'),_0xdde9('0x3c')]);_0x3b1d55[_0xdde9('0x43')]=_0x4dd10a[_0xdde9('0x42')];_0x3b1d55[_0xdde9('0x44')]=_0x4dd10a['List'];_0x3b1d55['applications']=_[_0xdde9('0x45')](_0x3b1d55[_0xdde9('0x43')],['priority'],[_0xdde9('0x46')]);if(_0x3b1d55['account']&&_0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x47')]){_0x3b1d55[_0xdde9('0x43')][_0xdde9('0x48')]({'id':0x0,'priority':_0x3b1d55[_0xdde9('0x43')][_0xdde9('0x49')]+0x1,'app':_0xdde9('0x4a'),'appdata':_0xdde9('0x47'),'interval':_0xdde9('0x4b')});}if(_0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x42')]){delete _0x3b1d55['account'][_0xdde9('0x42')];}if(_0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x3c')]){delete _0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x3c')];}if(_0x4dd10a[_0xdde9('0x3c')][_0xdde9('0x3d')]['length']){return _0x4dd10a[_0xdde9('0x3c')][_0xdde9('0x3d')][0x0];}var _0x3d9995=_[_0xdde9('0xc')](_0x1bc20a[_0xdde9('0x31')],{'firstName':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x33')],'ListId':_0x4dd10a[_0xdde9('0x30')]});_0x3d9995[_0x1bc20a['body'][_0xdde9('0x38')]]=_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x33')];return db['CmContact'][_0xdde9('0x4c')](_0x3d9995);}else{throw new Error(_0xdde9('0x4d'));}})['then'](function(_0x567478){_0x3b1d55[_0xdde9('0x4e')]=_0x567478;if(_0x567478){if(!_0x1bc20a['body'][_0xdde9('0x17')]['messageId']){_0x1bc20a[_0xdde9('0x31')]['message']['messageId']=rs['generate']()+'\x20'+_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['from'];}var _0x5d2a30={'ContactId':_0x567478['id'],'MailAccountId':_0x1bc20a[_0xdde9('0x3a')]['id'],'inReplyTo':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x4f')],'to':_0x1bc20a[_0xdde9('0x31')]['message'][_0xdde9('0x33')],'cc':_0x1bc20a[_0xdde9('0x31')]['message']['cc'],'subject':_0x1bc20a['body']['message'][_0xdde9('0x50')],'attach':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x51')],'lastMsgAt':moment()[_0xdde9('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x31')]};return db[_0xdde9('0x53')][_0xdde9('0x27')]({'where':{'closed':![],'MailAccountId':_0x1bc20a[_0xdde9('0x3a')]['id']},'include':[{'model':db[_0xdde9('0x54')],'as':_0xdde9('0x55'),'attributes':[_0xdde9('0x4f')],'where':{'messageId':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x56')]}}]})[_0xdde9('0x25')](function(_0x302763){if(_0x302763){return[_0x302763,![]];}return db[_0xdde9('0x53')][_0xdde9('0x4c')](_0x5d2a30)[_0xdde9('0x25')](function(_0x4fbd85){return[_0x4fbd85,!![]];});});}else{throw new Error(_0xdde9('0x57'));}})[_0xdde9('0x58')](function(_0x56c154,_0x41e127){if(_0x56c154){_0x1d5762=_0x41e127;if(!_0x41e127){return _0x56c154[_0xdde9('0x59')]({'inReplyTo':_0x1bc20a['body']['message'][_0xdde9('0x4f')],'to':_0x1bc20a['body'][_0xdde9('0x17')][_0xdde9('0x33')],'cc':_0x1bc20a['body'][_0xdde9('0x17')]['cc'],'subject':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['subject'],'attach':_0x56c154['attach']?_0x56c154[_0xdde9('0x51')]:_0x1bc20a['body']['message'][_0xdde9('0x51')],'substatus':null,'substatusAt':moment()[_0xdde9('0x52')](_0xdde9('0x5a')),'lastMsgAt':moment()[_0xdde9('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x31')]});}else{return _0x56c154;}}})[_0xdde9('0x25')](function(_0x1c1aef){_0x3b1d55['interaction']=_0x1c1aef[_0xdde9('0x40')]({'plain':!![]});_0x3b1d55[_0xdde9('0x5b')]['created']=_0x1d5762;return db[_0xdde9('0x54')][_0xdde9('0x4c')]({'body':_0x1bc20a[_0xdde9('0x31')]['body'],'MailAccountId':_0x1bc20a['account']['id'],'MailInteractionId':_0x1c1aef['id'],'direction':'in','ContactId':_0x3b1d55[_0xdde9('0x4e')]['id'],'messageId':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x4f')],'from':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['from'],'to':_0x1bc20a[_0xdde9('0x31')]['message']['to'],'cc':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['cc'],'subject':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x50')],'attach':_0x1bc20a['body'][_0xdde9('0x17')]['attach'],'Attachments':_0x1bc20a['body']['message'][_0xdde9('0x5c')],'originTo':_0x1bc20a['body'][_0xdde9('0x17')][_0xdde9('0x5d')],'originCc':_0x1bc20a[_0xdde9('0x31')]['message'][_0xdde9('0x5e')],'bcc':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x5f')]},{'include':[{'model':db[_0xdde9('0x60')],'as':_0xdde9('0x61')}]});})[_0xdde9('0x25')](function(_0x1a0e9a){_0x3b1d55[_0xdde9('0x17')]=_0x1a0e9a;if(_0x3b1d55[_0xdde9('0x5b')][_0xdde9('0x62')]){return db['User'][_0xdde9('0x27')]({'attributes':['id',_0xdde9('0x63')],'where':{'id':_0x3b1d55['interaction'][_0xdde9('0x62')]}})[_0xdde9('0x25')](function(_0x322edd){if(_0x322edd){_0x3b1d55['applications'][_0xdde9('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x322edd[_0xdde9('0x63')]+','+(_0x3b1d55['account'][_0xdde9('0x65')]||0xa),'interval':_0xdde9('0x4b')});}return respondWithRpcPromise(_0xdde9('0x66'),_0xdde9('0x67'),_0x3b1d55);});}return respondWithRpcPromise(_0xdde9('0x66'),_0xdde9('0x67'),_0x3b1d55);})[_0xdde9('0x25')](function(_0x5388e5){_0x369565(_0x5388e5);})['catch'](function(_0x14dfe2){_0x5ae971(_0x5038ac['error'](0x1f4,_0x14dfe2[_0xdde9('0x17')]));});});}; \ No newline at end of file +var _0x5620=['agent','waitForTheAssignedAgent','startRouting','lodash','moment','bluebird','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','register','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','map','model','debug','GetMailAccount','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','find','account','CmList','List','CmContact','Contacts','DESC','get','applications','Applications','list','orderBy','priority','autoclose','*,*,*,*','length','from','create','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','created','originTo','originCc','bcc','Attachment','Attachments','UserId','name','interaction','unshift'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5620,0xbf));var _0x0562=function(_0x1de641,_0x44d464){_0x1de641=_0x1de641-0x0;var _0xccacbc=_0x5620[_0x1de641];return _0xccacbc;};'use strict';var _=require(_0x0562('0x0'));var util=require('util');var moment=require(_0x0562('0x1'));var BPromise=require(_0x0562('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0562('0x3'));var logger=require('../../config/logger')(_0x0562('0x4'));var config=require('../../config/environment');var jayson=require(_0x0562('0x5'));var client=jayson[_0x0562('0x6')][_0x0562('0x7')]({'port':0x232c});config[_0x0562('0x8')]=_[_0x0562('0x9')](config[_0x0562('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0562('0x8')]));require('./mailAccount.socket')[_0x0562('0xa')](socket);function respondWithRpcPromise(_0x390245,_0x26efd1,_0x1a9aaa){return new BPromise(function(_0x259b6f,_0x538cb8){return client[_0x0562('0xb')](_0x390245,_0x1a9aaa)[_0x0562('0xc')](function(_0x2e5740){logger[_0x0562('0xd')](_0x0562('0xe'),_0x26efd1,'request\x20sent');logger['debug'](_0x0562('0xf'),_0x26efd1,_0x0562('0x10'),JSON[_0x0562('0x11')](_0x2e5740));if(_0x2e5740[_0x0562('0x12')]){if(_0x2e5740['error'][_0x0562('0x13')]===0x1f4){logger[_0x0562('0x12')](_0x0562('0xe'),_0x26efd1,_0x2e5740[_0x0562('0x12')]['message']);return _0x538cb8(_0x2e5740[_0x0562('0x12')]['message']);}logger[_0x0562('0x12')](_0x0562('0xe'),_0x26efd1,_0x2e5740['error'][_0x0562('0x14')]);return _0x259b6f(_0x2e5740['error'][_0x0562('0x14')]);}else{logger[_0x0562('0xd')](_0x0562('0xe'),_0x26efd1,'request\x20sent');_0x259b6f(_0x2e5740[_0x0562('0x15')]['message']);}})[_0x0562('0x16')](function(_0x535aa7){logger[_0x0562('0x12')](_0x0562('0xe'),_0x26efd1,_0x535aa7);_0x538cb8(_0x535aa7);});});}exports['GetMailAccount']=function(_0x25d8eb){var _0x2f6771=this;return new Promise(function(_0x33fc61,_0x90626d){return db['MailAccount'][_0x0562('0x17')]({'raw':_0x25d8eb['options']?_0x25d8eb['options']['raw']===undefined?!![]:![]:!![],'where':_0x25d8eb['options']?_0x25d8eb[_0x0562('0x18')][_0x0562('0x19')]||null:null,'attributes':_0x25d8eb[_0x0562('0x18')]?_0x25d8eb[_0x0562('0x18')][_0x0562('0x1a')]||null:null,'limit':_0x25d8eb['options']?_0x25d8eb['options'][_0x0562('0x1b')]||null:null,'include':_0x25d8eb[_0x0562('0x18')]?_0x25d8eb[_0x0562('0x18')][_0x0562('0x1c')]?_[_0x0562('0x1d')](_0x25d8eb['options'][_0x0562('0x1c')],function(_0x98ee54){return{'model':db[_0x98ee54[_0x0562('0x1e')]],'as':_0x98ee54['as'],'attributes':_0x98ee54[_0x0562('0x1a')],'include':_0x98ee54[_0x0562('0x1c')]?_[_0x0562('0x1d')](_0x98ee54[_0x0562('0x1c')],function(_0x15f1e7){return{'model':db[_0x15f1e7[_0x0562('0x1e')]],'as':_0x15f1e7['as'],'attributes':_0x15f1e7[_0x0562('0x1a')],'include':_0x15f1e7[_0x0562('0x1c')]?_['map'](_0x15f1e7[_0x0562('0x1c')],function(_0x4ea641){return{'model':db[_0x4ea641[_0x0562('0x1e')]],'as':_0x4ea641['as'],'attributes':_0x4ea641[_0x0562('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49f584){logger['info']('GetMailAccount',_0x25d8eb);logger[_0x0562('0x1f')]('GetMailAccount',_0x25d8eb,JSON[_0x0562('0x11')](_0x49f584));_0x33fc61(_0x49f584);})[_0x0562('0x16')](function(_0x2d3772){logger[_0x0562('0x12')](_0x0562('0x20'),_0x2d3772[_0x0562('0x14')],_0x25d8eb);_0x90626d(_0x2f6771[_0x0562('0x12')](0x1f4,_0x2d3772[_0x0562('0x14')]));});});};exports[_0x0562('0x21')]=function(_0x280d79){var _0x5151fb=this;return new Promise(function(_0x473024,_0x2cd07a){return db['MailAccount']['find']({'raw':_0x280d79[_0x0562('0x18')]?_0x280d79['options']['raw']===undefined?!![]:![]:!![],'where':_0x280d79[_0x0562('0x18')]?_0x280d79[_0x0562('0x18')]['where']||null:null,'attributes':_0x280d79[_0x0562('0x18')]?_0x280d79[_0x0562('0x18')][_0x0562('0x1a')]||null:null,'include':_0x280d79['options']?_0x280d79[_0x0562('0x18')][_0x0562('0x1c')]?_[_0x0562('0x1d')](_0x280d79[_0x0562('0x18')][_0x0562('0x1c')],function(_0xb88a5f){return{'model':db[_0xb88a5f['model']],'as':_0xb88a5f['as'],'attributes':_0xb88a5f[_0x0562('0x1a')],'include':_0xb88a5f[_0x0562('0x1c')]?_[_0x0562('0x1d')](_0xb88a5f[_0x0562('0x1c')],function(_0x5e2ece){return{'model':db[_0x5e2ece[_0x0562('0x1e')]],'as':_0x5e2ece['as'],'attributes':_0x5e2ece['attributes'],'include':_0x5e2ece[_0x0562('0x1c')]?_[_0x0562('0x1d')](_0x5e2ece[_0x0562('0x1c')],function(_0xa32075){return{'model':db[_0xa32075[_0x0562('0x1e')]],'as':_0xa32075['as'],'attributes':_0xa32075[_0x0562('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0562('0xc')](function(_0x568f9e){logger['info'](_0x0562('0x21'),_0x280d79);logger[_0x0562('0x1f')](_0x0562('0x21'),_0x280d79,JSON['stringify'](_0x568f9e));_0x473024(_0x568f9e);})[_0x0562('0x16')](function(_0x579da8){logger[_0x0562('0x12')]('ShowMailAccount',_0x579da8['message'],_0x280d79);_0x2cd07a(_0x5151fb['error'](0x1f4,_0x579da8[_0x0562('0x14')]));});});};exports[_0x0562('0x22')]=function(_0x46e0a3){var _0x2633b5=this;return new Promise(function(_0x12437c,_0x541126){var _0x1b7fdf={'body':_0x46e0a3[_0x0562('0x23')],'channel':_0x0562('0x24')};var _0x17dda3=_[_0x0562('0x25')](_[_0x0562('0x26')](db['CmContact'][_0x0562('0x27')]),['createdAt',_0x0562('0x28'),_0x0562('0x29'),_0x0562('0x2a')]);var _0x5ccd2e=![];if(_0x46e0a3['body']['id']){delete _0x46e0a3[_0x0562('0x23')]['id'];}if(_[_0x0562('0x2b')](_0x46e0a3[_0x0562('0x23')]['from'])){return _0x541126(_0x2633b5[_0x0562('0x12')](0x1f4,_0x0562('0x2c')));}if(_[_0x0562('0x2b')](_0x46e0a3[_0x0562('0x23')][_0x0562('0x23')])||_0x46e0a3[_0x0562('0x23')][_0x0562('0x23')]===''){return _0x541126(_0x2633b5['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x46e0a3[_0x0562('0x23')][_0x0562('0x2d')])){return _0x541126(_0x2633b5[_0x0562('0x12')](0x1f4,_0x0562('0x2e')+_0x17dda3));}if(!_['includes'](_0x17dda3,_0x46e0a3['body'][_0x0562('0x2d')])){return _0x541126(_0x2633b5[_0x0562('0x12')](0x1f4,_0x0562('0x2f')+_0x17dda3));}var _0x5a3e84={};_0x5a3e84[_0x46e0a3[_0x0562('0x23')]['mapKey']]=_0x46e0a3[_0x0562('0x23')]['from'];return db[_0x0562('0x30')][_0x0562('0x31')]({'where':{'id':_0x46e0a3[_0x0562('0x32')]['id']},'include':[{'model':db[_0x0562('0x33')],'as':_0x0562('0x34'),'include':[{'model':db[_0x0562('0x35')],'as':_0x0562('0x36'),'where':_0x5a3e84,'limit':0x1,'order':[['updatedAt',_0x0562('0x37')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x0562('0xc')](function(_0x3b18cb){if(_0x3b18cb&&_0x3b18cb[_0x0562('0x34')]){var _0x1778ea=_0x3b18cb[_0x0562('0x38')]({'plain':!![]});_0x1b7fdf['account']=_['omit'](_0x1778ea,['Applications',_0x0562('0x34')]);_0x1b7fdf[_0x0562('0x39')]=_0x1778ea[_0x0562('0x3a')];_0x1b7fdf[_0x0562('0x3b')]=_0x1778ea['List'];_0x1b7fdf[_0x0562('0x39')]=_[_0x0562('0x3c')](_0x1b7fdf[_0x0562('0x39')],[_0x0562('0x3d')],['asc']);if(_0x1b7fdf[_0x0562('0x32')]&&_0x1b7fdf[_0x0562('0x32')][_0x0562('0x3e')]){_0x1b7fdf[_0x0562('0x39')]['push']({'id':0x0,'priority':_0x1b7fdf[_0x0562('0x39')]['length']+0x1,'app':'close','appdata':_0x0562('0x3e'),'interval':_0x0562('0x3f')});}if(_0x1b7fdf[_0x0562('0x32')]['Applications']){delete _0x1b7fdf[_0x0562('0x32')]['Applications'];}if(_0x1b7fdf[_0x0562('0x32')][_0x0562('0x34')]){delete _0x1b7fdf[_0x0562('0x32')][_0x0562('0x34')];}if(_0x1778ea['List'][_0x0562('0x36')][_0x0562('0x40')]){return _0x1778ea[_0x0562('0x34')]['Contacts'][0x0];}var _0x3f6941=_[_0x0562('0x9')](_0x46e0a3[_0x0562('0x23')],{'firstName':_0x46e0a3[_0x0562('0x23')][_0x0562('0x41')],'ListId':_0x1778ea[_0x0562('0x2a')]});_0x3f6941[_0x46e0a3[_0x0562('0x23')][_0x0562('0x2d')]]=_0x46e0a3['body'][_0x0562('0x41')];return db[_0x0562('0x35')][_0x0562('0x42')](_0x3f6941);}else{throw new Error('List\x20not\x20found');}})[_0x0562('0xc')](function(_0xf24e91){_0x1b7fdf[_0x0562('0x43')]=_0xf24e91;if(_0xf24e91){if(!_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x44')]){_0x46e0a3[_0x0562('0x23')]['message'][_0x0562('0x44')]=rs[_0x0562('0x45')]()+'\x20'+_0x46e0a3['body'][_0x0562('0x14')][_0x0562('0x41')];}var _0x542528={'ContactId':_0xf24e91['id'],'MailAccountId':_0x46e0a3[_0x0562('0x32')]['id'],'inReplyTo':_0x46e0a3['body'][_0x0562('0x14')][_0x0562('0x44')],'to':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x41')],'cc':_0x46e0a3[_0x0562('0x23')]['message']['cc'],'subject':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')]['subject'],'attach':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x46')],'lastMsgAt':moment()['format'](_0x0562('0x47')),'lastMsgDirection':'in','lastMsgBody':_0x46e0a3['body'][_0x0562('0x23')]};return db[_0x0562('0x48')][_0x0562('0x31')]({'where':{'closed':![],'MailAccountId':_0x46e0a3['account']['id']},'include':[{'model':db[_0x0562('0x49')],'as':_0x0562('0x4a'),'attributes':[_0x0562('0x44')],'where':{'messageId':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x4b')]}}]})[_0x0562('0xc')](function(_0x2a5e58){if(_0x2a5e58){return[_0x2a5e58,![]];}return db[_0x0562('0x48')]['create'](_0x542528)['then'](function(_0x433715){return[_0x433715,!![]];});});}else{throw new Error(_0x0562('0x4c'));}})[_0x0562('0x4d')](function(_0xa4e81a,_0x360775){if(_0xa4e81a){_0x5ccd2e=_0x360775;if(!_0x360775){return _0xa4e81a[_0x0562('0x4e')]({'inReplyTo':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x44')],'to':_0x46e0a3[_0x0562('0x23')]['message'][_0x0562('0x41')],'cc':_0x46e0a3[_0x0562('0x23')]['message']['cc'],'subject':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x4f')],'attach':_0xa4e81a[_0x0562('0x46')]?_0xa4e81a[_0x0562('0x46')]:_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')]['attach'],'substatus':null,'substatusAt':moment()[_0x0562('0x50')](_0x0562('0x47')),'lastMsgAt':moment()[_0x0562('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x46e0a3[_0x0562('0x23')]['body']});}else{return _0xa4e81a;}}})[_0x0562('0xc')](function(_0x3b1909){_0x1b7fdf['interaction']=_0x3b1909[_0x0562('0x38')]({'plain':!![]});_0x1b7fdf['interaction'][_0x0562('0x51')]=_0x5ccd2e;return db[_0x0562('0x49')][_0x0562('0x42')]({'body':_0x46e0a3[_0x0562('0x23')][_0x0562('0x23')],'MailAccountId':_0x46e0a3[_0x0562('0x32')]['id'],'MailInteractionId':_0x3b1909['id'],'direction':'in','ContactId':_0x1b7fdf[_0x0562('0x43')]['id'],'messageId':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')]['messageId'],'from':_0x46e0a3['body'][_0x0562('0x14')][_0x0562('0x41')],'to':_0x46e0a3['body'][_0x0562('0x14')]['to'],'cc':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')]['cc'],'subject':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x4f')],'attach':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x46')],'Attachments':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')]['attachments'],'originTo':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x52')],'originCc':_0x46e0a3[_0x0562('0x23')][_0x0562('0x14')][_0x0562('0x53')],'bcc':_0x46e0a3[_0x0562('0x23')]['message'][_0x0562('0x54')]},{'include':[{'model':db[_0x0562('0x55')],'as':_0x0562('0x56')}]});})['then'](function(_0x84daf9){_0x1b7fdf['message']=_0x84daf9;if(_0x1b7fdf['interaction'][_0x0562('0x57')]){return db['User']['find']({'attributes':['id',_0x0562('0x58')],'where':{'id':_0x1b7fdf[_0x0562('0x59')][_0x0562('0x57')]}})[_0x0562('0xc')](function(_0x2cfc81){if(_0x2cfc81){_0x1b7fdf['applications'][_0x0562('0x5a')]({'id':0x0,'priority':0x0,'app':_0x0562('0x5b'),'appdata':_0x2cfc81['name']+','+(_0x1b7fdf[_0x0562('0x32')][_0x0562('0x5c')]||0xa),'interval':_0x0562('0x3f')});}return respondWithRpcPromise('Start',_0x0562('0x5d'),_0x1b7fdf);});}return respondWithRpcPromise('Start',_0x0562('0x5d'),_0x1b7fdf);})[_0x0562('0xc')](function(_0x7f0a3a){_0x12437c(_0x7f0a3a);})['catch'](function(_0x34e217){_0x541126(_0x2633b5[_0x0562('0x12')](0x1f4,_0x34e217[_0x0562('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f682de5..e29aaae 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 _0x0170=['mailAccount:','./mailAccount.events','save','update','removeListener','register','length'];(function(_0x24a03e,_0x69f19d){var _0x13f38f=function(_0x183407){while(--_0x183407){_0x24a03e['push'](_0x24a03e['shift']());}};_0x13f38f(++_0x69f19d);}(_0x0170,0x1d6));var _0x0017=function(_0x5b7181,_0x498246){_0x5b7181=_0x5b7181-0x0;var _0x37d9ea=_0x0170[_0x5b7181];return _0x37d9ea;};'use strict';var MailAccountEvents=require(_0x0017('0x0'));var events=[_0x0017('0x1'),'remove',_0x0017('0x2')];function createListener(_0x2f0da5,_0x215a99){return function(_0xe275a5){_0x215a99['emit'](_0x2f0da5,_0xe275a5);};}function removeListener(_0x20a045,_0x255938){return function(){MailAccountEvents[_0x0017('0x3')](_0x20a045,_0x255938);};}exports[_0x0017('0x4')]=function(_0x2eaf66){for(var _0x321f6e=0x0,_0x52402=events[_0x0017('0x5')];_0x321f6e<_0x52402;_0x321f6e++){var _0xea0574=events[_0x321f6e];var _0x121f63=createListener(_0x0017('0x6')+_0xea0574,_0x2eaf66);MailAccountEvents['on'](_0xea0574,_0x121f63);}}; \ No newline at end of file +var _0xeda8=['mailAccount:','./mailAccount.events','save','update','emit','removeListener','register'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0xeda8,0x104));var _0x8eda=function(_0x13a3dc,_0x33e390){_0x13a3dc=_0x13a3dc-0x0;var _0x18a31e=_0xeda8[_0x13a3dc];return _0x18a31e;};'use strict';var MailAccountEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){MailAccountEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);MailAccountEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e486f8f..02128fd 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 _0xab40=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','put','/:id','update','destroy','exports','multer','util','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab40,0xcd));var _0x0ab4=function(_0x5b9e85,_0x364d0d){_0x5b9e85=_0x5b9e85-0x0;var _0xaf7e93=_0xab40[_0x5b9e85];return _0xaf7e93;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var auth=require(_0x0ab4('0x3'));var interaction=require(_0x0ab4('0x4'));var config=require(_0x0ab4('0x5'));var controller=require(_0x0ab4('0x6'));router['get']('/:id',auth[_0x0ab4('0x7')](),controller['show']);router[_0x0ab4('0x8')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ab4('0xb')]);module[_0x0ab4('0xc')]=router; \ No newline at end of file +var _0xd3d1=['delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x3469a6,_0x5017d0){var _0x386fe8=function(_0x220093){while(--_0x220093){_0x3469a6['push'](_0x3469a6['shift']());}};_0x386fe8(++_0x5017d0);}(_0xd3d1,0x172));var _0x1d3d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd3d1[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var auth=require(_0x1d3d('0x4'));var interaction=require(_0x1d3d('0x5'));var config=require(_0x1d3d('0x6'));var controller=require(_0x1d3d('0x7'));router[_0x1d3d('0x8')](_0x1d3d('0x9'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0xc')](_0x1d3d('0x9'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0xe')](_0x1d3d('0x9'),auth[_0x1d3d('0xa')](),controller['destroy']);module[_0x1d3d('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 3098581..5b7c666 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 _0x398d=['TEXT','*,*,*,*','exports','STRING'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x398d,0xb6));var _0xd398=function(_0x1d1797,_0x29fd69){_0x1d1797=_0x1d1797-0x0;var _0x307670=_0x398d[_0x1d1797];return _0x307670;};'use strict';var Sequelize=require('sequelize');module[_0xd398('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd398('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd398('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd398('0x1')],'defaultValue':_0xd398('0x3')}}; \ No newline at end of file +var _0x759b=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x1c9dcf,_0x12fce0){var _0x388fb3=function(_0x226e52){while(--_0x226e52){_0x1c9dcf['push'](_0x1c9dcf['shift']());}};_0x388fb3(++_0x12fce0);}(_0x759b,0x147));var _0xb759=function(_0x133804,_0x46eafb){_0x133804=_0x133804-0x0;var _0x45b070=_0x759b[_0x133804];return _0x45b070;};'use strict';var Sequelize=require(_0xb759('0x0'));module[_0xb759('0x1')]={'priority':{'type':Sequelize[_0xb759('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb759('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb759('0x3')]},'interval':{'type':Sequelize[_0xb759('0x3')],'defaultValue':_0xb759('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 9ff07f3..d57dedb 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 _0x55b7=['attributes','fields','length','includeAll','include','merge','options','catch','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model'];(function(_0x158448,_0x2a3253){var _0x1717a9=function(_0x56652d){while(--_0x56652d){_0x158448['push'](_0x158448['shift']());}};_0x1717a9(++_0x2a3253);}(_0x55b7,0x7e));var _0x755b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x55b7[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x755b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x755b('0x1'));var zipdir=require(_0x755b('0x2'));var jsonpatch=require(_0x755b('0x3'));var rp=require('request-promise');var moment=require(_0x755b('0x4'));var BPromise=require(_0x755b('0x5'));var Mustache=require(_0x755b('0x6'));var util=require(_0x755b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x755b('0x8'));var fs=require('fs');var _=require(_0x755b('0x9'));var squel=require(_0x755b('0xa'));var crypto=require(_0x755b('0xb'));var jsforce=require(_0x755b('0xc'));var deskjs=require(_0x755b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x755b('0xe'));var Papa=require(_0x755b('0xf'));var Redis=require(_0x755b('0x10'));var authService=require(_0x755b('0x11'));var qs=require(_0x755b('0x12'));var as=require(_0x755b('0x13'));var hardwareService=require(_0x755b('0x14'));var logger=require('../../config/logger')(_0x755b('0x15'));var utils=require(_0x755b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x755b('0x17'))['db'];function respondWithStatusCode(_0xe858eb,_0x251800){_0x251800=_0x251800||0xcc;return function(_0x372623){if(_0x372623){return _0xe858eb[_0x755b('0x18')](_0x251800);}return _0xe858eb[_0x755b('0x19')](_0x251800)[_0x755b('0x1a')]();};}function respondWithResult(_0x44257b,_0x32f1db){_0x32f1db=_0x32f1db||0xc8;return function(_0x473072){if(_0x473072){return _0x44257b['status'](_0x32f1db)[_0x755b('0x1b')](_0x473072);}};}function respondWithFilteredResult(_0x5cb22b,_0x3846e3){return function(_0x2a3026){if(_0x2a3026){var _0x4e481d=_0x2a3026[_0x755b('0x1c')],_0x1b3dec=_0x3846e3[_0x755b('0x1d')],_0x1170df=_0x3846e3[_0x755b('0x1d')]+_0x3846e3['limit'],_0x372b7a;if(_0x1170df>=_0x4e481d){_0x1170df=_0x4e481d;_0x372b7a=0xc8;}else{_0x372b7a=0xce;}_0x5cb22b['status'](_0x372b7a);return _0x5cb22b[_0x755b('0x1e')](_0x755b('0x1f'),_0x1b3dec+'-'+_0x1170df+'/'+_0x4e481d)['json'](_0x2a3026);}return null;};}function patchUpdates(_0x538f9e){return function(_0x4091de){try{jsonpatch[_0x755b('0x20')](_0x4091de,_0x538f9e,!![]);}catch(_0xa51c4){return BPromise[_0x755b('0x21')](_0xa51c4);}return _0x4091de['save']();};}function saveUpdates(_0x2d8c91,_0x5af029){return function(_0x4d326f){if(_0x4d326f){return _0x4d326f[_0x755b('0x22')](_0x2d8c91)[_0x755b('0x23')](function(_0x2409f0){return _0x2409f0;});}return null;};}function removeEntity(_0x4aafed,_0x3a2d17){return function(_0x38ee41){if(_0x38ee41){return _0x38ee41['destroy']()[_0x755b('0x23')](function(){_0x4aafed['status'](0xcc)[_0x755b('0x1a')]();});}};}function handleEntityNotFound(_0x28a3d8,_0x3029f5){return function(_0x9c3e54){if(!_0x9c3e54){_0x28a3d8[_0x755b('0x18')](0x194);}return _0x9c3e54;};}function handleError(_0x399683,_0x4e3db8){_0x4e3db8=_0x4e3db8||0x1f4;return function(_0x7b175f){logger[_0x755b('0x24')](_0x7b175f[_0x755b('0x25')]);if(_0x7b175f[_0x755b('0x26')]){delete _0x7b175f['name'];}_0x399683[_0x755b('0x19')](_0x4e3db8)[_0x755b('0x27')](_0x7b175f);};}exports['show']=function(_0x32c0ee,_0x507c1f){var _0x1eb8a5={'raw':!![],'where':{'id':_0x32c0ee[_0x755b('0x28')]['id']}},_0x5b058b={};_0x5b058b['model']=_[_0x755b('0x29')](db[_0x755b('0x2a')][_0x755b('0x2b')]);_0x5b058b[_0x755b('0x2c')]=_[_0x755b('0x29')](_0x32c0ee[_0x755b('0x2c')]);_0x5b058b[_0x755b('0x2d')]=_[_0x755b('0x2e')](_0x5b058b[_0x755b('0x2f')],_0x5b058b[_0x755b('0x2c')]);_0x1eb8a5[_0x755b('0x30')]=_[_0x755b('0x2e')](_0x5b058b[_0x755b('0x2f')],qs[_0x755b('0x31')](_0x32c0ee[_0x755b('0x2c')]['fields']));_0x1eb8a5[_0x755b('0x30')]=_0x1eb8a5[_0x755b('0x30')][_0x755b('0x32')]?_0x1eb8a5[_0x755b('0x30')]:_0x5b058b[_0x755b('0x2f')];if(_0x32c0ee[_0x755b('0x2c')][_0x755b('0x33')]){_0x1eb8a5[_0x755b('0x34')]=[{'all':!![]}];}_0x1eb8a5=_[_0x755b('0x35')]({},_0x1eb8a5,_0x32c0ee[_0x755b('0x36')]);return db[_0x755b('0x2a')]['find'](_0x1eb8a5)[_0x755b('0x23')](handleEntityNotFound(_0x507c1f,null))[_0x755b('0x23')](respondWithResult(_0x507c1f,null))[_0x755b('0x37')](handleError(_0x507c1f,null));};exports[_0x755b('0x22')]=function(_0xeed4ec,_0x38701f){if(_0xeed4ec['body']['id']){delete _0xeed4ec[_0x755b('0x38')]['id'];}return db[_0x755b('0x2a')][_0x755b('0x39')]({'where':{'id':_0xeed4ec[_0x755b('0x28')]['id']}})['then'](handleEntityNotFound(_0x38701f,null))[_0x755b('0x23')](saveUpdates(_0xeed4ec[_0x755b('0x38')],null))[_0x755b('0x23')](respondWithResult(_0x38701f,null))[_0x755b('0x37')](handleError(_0x38701f,null));};exports['destroy']=function(_0x13bcd7,_0x478c0f){return db[_0x755b('0x2a')]['find']({'where':{'id':_0x13bcd7[_0x755b('0x28')]['id']}})[_0x755b('0x23')](handleEntityNotFound(_0x478c0f,null))['then'](removeEntity(_0x478c0f,null))['catch'](handleError(_0x478c0f,null));}; \ No newline at end of file +var _0x13e5=['include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x13e5,0x82));var _0x513e=function(_0x1c79a,_0x4a3a8e){_0x1c79a=_0x1c79a-0x0;var _0x41774c=_0x13e5[_0x1c79a];return _0x41774c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x513e('0x0'));var rimraf=require(_0x513e('0x1'));var zipdir=require(_0x513e('0x2'));var jsonpatch=require(_0x513e('0x3'));var rp=require('request-promise');var moment=require(_0x513e('0x4'));var BPromise=require(_0x513e('0x5'));var Mustache=require(_0x513e('0x6'));var util=require(_0x513e('0x7'));var path=require(_0x513e('0x8'));var sox=require(_0x513e('0x9'));var csv=require(_0x513e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x513e('0xb'));var squel=require(_0x513e('0xc'));var crypto=require(_0x513e('0xd'));var jsforce=require(_0x513e('0xe'));var deskjs=require(_0x513e('0xf'));var toCsv=require(_0x513e('0xa'));var querystring=require(_0x513e('0x10'));var Papa=require('papaparse');var Redis=require(_0x513e('0x11'));var authService=require(_0x513e('0x12'));var qs=require(_0x513e('0x13'));var as=require(_0x513e('0x14'));var hardwareService=require(_0x513e('0x15'));var logger=require(_0x513e('0x16'))(_0x513e('0x17'));var utils=require(_0x513e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x513e('0x19'));var db=require(_0x513e('0x1a'))['db'];function respondWithStatusCode(_0x1d92e8,_0x35dd1a){_0x35dd1a=_0x35dd1a||0xcc;return function(_0xe87947){if(_0xe87947){return _0x1d92e8[_0x513e('0x1b')](_0x35dd1a);}return _0x1d92e8[_0x513e('0x1c')](_0x35dd1a)[_0x513e('0x1d')]();};}function respondWithResult(_0x209dfd,_0x81f8ac){_0x81f8ac=_0x81f8ac||0xc8;return function(_0x46d119){if(_0x46d119){return _0x209dfd[_0x513e('0x1c')](_0x81f8ac)[_0x513e('0x1e')](_0x46d119);}};}function respondWithFilteredResult(_0x4afd05,_0x5cd869){return function(_0x2684e){if(_0x2684e){var _0x3c55a0=_0x2684e[_0x513e('0x1f')],_0x358e89=_0x5cd869[_0x513e('0x20')],_0x4556ba=_0x5cd869[_0x513e('0x20')]+_0x5cd869[_0x513e('0x21')],_0x1b6e93;if(_0x4556ba>=_0x3c55a0){_0x4556ba=_0x3c55a0;_0x1b6e93=0xc8;}else{_0x1b6e93=0xce;}_0x4afd05[_0x513e('0x1c')](_0x1b6e93);return _0x4afd05[_0x513e('0x22')]('Content-Range',_0x358e89+'-'+_0x4556ba+'/'+_0x3c55a0)[_0x513e('0x1e')](_0x2684e);}return null;};}function patchUpdates(_0xf2e957){return function(_0xbbba4c){try{jsonpatch[_0x513e('0x23')](_0xbbba4c,_0xf2e957,!![]);}catch(_0x23a8c8){return BPromise[_0x513e('0x24')](_0x23a8c8);}return _0xbbba4c[_0x513e('0x25')]();};}function saveUpdates(_0x552a40,_0x6e1390){return function(_0x356648){if(_0x356648){return _0x356648['update'](_0x552a40)[_0x513e('0x26')](function(_0x223ac7){return _0x223ac7;});}return null;};}function removeEntity(_0xb9afcf,_0x582ffc){return function(_0xdf86cc){if(_0xdf86cc){return _0xdf86cc[_0x513e('0x27')]()[_0x513e('0x26')](function(){_0xb9afcf['status'](0xcc)[_0x513e('0x1d')]();});}};}function handleEntityNotFound(_0x3cbfc5,_0x35f834){return function(_0x4d264b){if(!_0x4d264b){_0x3cbfc5[_0x513e('0x1b')](0x194);}return _0x4d264b;};}function handleError(_0x3fb8e6,_0x286ec7){_0x286ec7=_0x286ec7||0x1f4;return function(_0x1c8b68){logger[_0x513e('0x28')](_0x1c8b68['stack']);if(_0x1c8b68[_0x513e('0x29')]){delete _0x1c8b68[_0x513e('0x29')];}_0x3fb8e6['status'](_0x286ec7)[_0x513e('0x2a')](_0x1c8b68);};}exports[_0x513e('0x2b')]=function(_0x3b4256,_0x16662b){var _0x4a88dd={'raw':!![],'where':{'id':_0x3b4256[_0x513e('0x2c')]['id']}},_0x541589={};_0x541589[_0x513e('0x2d')]=_[_0x513e('0x2e')](db[_0x513e('0x2f')][_0x513e('0x30')]);_0x541589[_0x513e('0x31')]=_[_0x513e('0x2e')](_0x3b4256[_0x513e('0x31')]);_0x541589[_0x513e('0x32')]=_[_0x513e('0x33')](_0x541589[_0x513e('0x2d')],_0x541589[_0x513e('0x31')]);_0x4a88dd[_0x513e('0x34')]=_['intersection'](_0x541589[_0x513e('0x2d')],qs[_0x513e('0x35')](_0x3b4256[_0x513e('0x31')][_0x513e('0x35')]));_0x4a88dd[_0x513e('0x34')]=_0x4a88dd[_0x513e('0x34')][_0x513e('0x36')]?_0x4a88dd['attributes']:_0x541589[_0x513e('0x2d')];if(_0x3b4256[_0x513e('0x31')][_0x513e('0x37')]){_0x4a88dd[_0x513e('0x38')]=[{'all':!![]}];}_0x4a88dd=_[_0x513e('0x39')]({},_0x4a88dd,_0x3b4256[_0x513e('0x3a')]);return db[_0x513e('0x2f')][_0x513e('0x3b')](_0x4a88dd)['then'](handleEntityNotFound(_0x16662b,null))[_0x513e('0x26')](respondWithResult(_0x16662b,null))[_0x513e('0x3c')](handleError(_0x16662b,null));};exports['update']=function(_0x2bcffb,_0x566c47){if(_0x2bcffb['body']['id']){delete _0x2bcffb[_0x513e('0x3d')]['id'];}return db[_0x513e('0x2f')][_0x513e('0x3b')]({'where':{'id':_0x2bcffb[_0x513e('0x2c')]['id']}})[_0x513e('0x26')](handleEntityNotFound(_0x566c47,null))['then'](saveUpdates(_0x2bcffb['body'],null))[_0x513e('0x26')](respondWithResult(_0x566c47,null))[_0x513e('0x3c')](handleError(_0x566c47,null));};exports[_0x513e('0x27')]=function(_0x54faf4,_0x18f36e){return db['MailApplication']['find']({'where':{'id':_0x54faf4[_0x513e('0x2c')]['id']}})[_0x513e('0x26')](handleEntityNotFound(_0x18f36e,null))[_0x513e('0x26')](removeEntity(_0x18f36e,null))['catch'](handleError(_0x18f36e,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ca24b54..561a04e 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 _0x6faf=['moment','bluebird','request-promise','rimraf','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0xd42ae9,_0x562ea2){var _0x581cff=function(_0x54ec26){while(--_0x54ec26){_0xd42ae9['push'](_0xd42ae9['shift']());}};_0x581cff(++_0x562ea2);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var logger=require(_0xf6fa('0x1'))(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require(_0xf6fa('0x4'));var rp=require(_0xf6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6fa('0x7'));module['exports']=function(_0xe883dd,_0x3c91fc){return _0xe883dd[_0xf6fa('0x8')](_0xf6fa('0x9'),attributes,{'tableName':_0xf6fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf6fa('0xb')});}; \ No newline at end of file +var _0xbb35=['exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0xcd1ea1,_0x40f90e){var _0x18e257=function(_0x4f754a){while(--_0x4f754a){_0xcd1ea1['push'](_0xcd1ea1['shift']());}};_0x18e257(++_0x40f90e);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x4d142f,_0x2dbdc1){_0x4d142f=_0x4d142f-0x0;var _0x5eb5d5=_0xbb35[_0x4d142f];return _0x5eb5d5;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bb3('0xc'),'collate':_0x5bb3('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3588661..269d853 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 _0x9b51=['update','options','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication'];(function(_0x142cdb,_0x4fd7e6){var _0x5be46a=function(_0x2a9c40){while(--_0x2a9c40){_0x142cdb['push'](_0x142cdb['shift']());}};_0x5be46a(++_0x4fd7e6);}(_0x9b51,0xc6));var _0x19b5=function(_0x32a2c9,_0x27c01c){_0x32a2c9=_0x32a2c9-0x0;var _0x10d835=_0x9b51[_0x32a2c9];return _0x10d835;};'use strict';var _=require(_0x19b5('0x0'));var util=require(_0x19b5('0x1'));var moment=require('moment');var BPromise=require(_0x19b5('0x2'));var rs=require(_0x19b5('0x3'));var fs=require('fs');var Redis=require(_0x19b5('0x4'));var db=require(_0x19b5('0x5'))['db'];var utils=require(_0x19b5('0x6'));var logger=require(_0x19b5('0x7'))(_0x19b5('0x8'));var config=require(_0x19b5('0x9'));var jayson=require(_0x19b5('0xa'));var client=jayson['client'][_0x19b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x309f15,_0x1a8376,_0x2eac5b){return new BPromise(function(_0x3bd84f,_0x2b93c9){return client[_0x19b5('0xc')](_0x309f15,_0x2eac5b)[_0x19b5('0xd')](function(_0x41aad0){logger['info'](_0x19b5('0xe'),_0x1a8376,_0x19b5('0xf'));logger[_0x19b5('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1a8376,_0x19b5('0xf'),JSON[_0x19b5('0x11')](_0x41aad0));if(_0x41aad0[_0x19b5('0x12')]){if(_0x41aad0[_0x19b5('0x12')][_0x19b5('0x13')]===0x1f4){logger[_0x19b5('0x12')](_0x19b5('0xe'),_0x1a8376,_0x41aad0[_0x19b5('0x12')]['message']);return _0x2b93c9(_0x41aad0[_0x19b5('0x12')][_0x19b5('0x14')]);}logger[_0x19b5('0x12')](_0x19b5('0xe'),_0x1a8376,_0x41aad0['error'][_0x19b5('0x14')]);return _0x3bd84f(_0x41aad0[_0x19b5('0x12')]['message']);}else{logger[_0x19b5('0x15')]('MailApplication,\x20%s,\x20%s',_0x1a8376,_0x19b5('0xf'));_0x3bd84f(_0x41aad0[_0x19b5('0x16')][_0x19b5('0x14')]);}})[_0x19b5('0x17')](function(_0x23492f){logger['error'](_0x19b5('0xe'),_0x1a8376,_0x23492f);_0x2b93c9(_0x23492f);});});}exports[_0x19b5('0x18')]=function(_0x1f8741){var _0x2cc9c5=this;return new Promise(function(_0x450190,_0x1d6798){return db[_0x19b5('0x19')][_0x19b5('0x1a')](_0x1f8741['body'],{'raw':_0x1f8741[_0x19b5('0x1b')]?_0x1f8741['options'][_0x19b5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f8741[_0x19b5('0x1b')]?_0x1f8741['options'][_0x19b5('0x1d')]||null:null,'attributes':_0x1f8741[_0x19b5('0x1b')]?_0x1f8741[_0x19b5('0x1b')][_0x19b5('0x1e')]||null:null,'limit':_0x1f8741['options']?_0x1f8741[_0x19b5('0x1b')][_0x19b5('0x1f')]||null:null})[_0x19b5('0xd')](function(_0x28e93c){logger[_0x19b5('0x15')](_0x19b5('0x18'),_0x1f8741);logger[_0x19b5('0x10')]('UpdateMailApplication',_0x1f8741,JSON[_0x19b5('0x11')](_0x28e93c));_0x450190(_0x28e93c);})[_0x19b5('0x17')](function(_0x34e257){logger[_0x19b5('0x12')](_0x19b5('0x18'),_0x34e257['message'],_0x1f8741);_0x1d6798(_0x2cc9c5['error'](0x1f4,_0x34e257['message']));});});}; \ No newline at end of file +var _0x7c98=['../../config/environment','client','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','limit','then','info','lodash','util','randomstring','ioredis'];(function(_0x2110a6,_0xd7d81d){var _0xfc7905=function(_0x2afe8c){while(--_0x2afe8c){_0x2110a6['push'](_0x2110a6['shift']());}};_0xfc7905(++_0xd7d81d);}(_0x7c98,0x1ea));var _0x87c9=function(_0x11c331,_0x523ccf){_0x11c331=_0x11c331-0x0;var _0x1b89e1=_0x7c98[_0x11c331];return _0x1b89e1;};'use strict';var _=require(_0x87c9('0x0'));var util=require(_0x87c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x87c9('0x2'));var fs=require('fs');var Redis=require(_0x87c9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x87c9('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x87c9('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14179c,_0x45aa50,_0xa1d6c8){return new BPromise(function(_0x5c5147,_0xda3e52){return client[_0x87c9('0x6')](_0x14179c,_0xa1d6c8)['then'](function(_0x2f99a6){logger['info'](_0x87c9('0x7'),_0x45aa50,_0x87c9('0x8'));logger[_0x87c9('0x9')](_0x87c9('0xa'),_0x45aa50,_0x87c9('0x8'),JSON[_0x87c9('0xb')](_0x2f99a6));if(_0x2f99a6[_0x87c9('0xc')]){if(_0x2f99a6[_0x87c9('0xc')][_0x87c9('0xd')]===0x1f4){logger['error'](_0x87c9('0x7'),_0x45aa50,_0x2f99a6[_0x87c9('0xc')]['message']);return _0xda3e52(_0x2f99a6[_0x87c9('0xc')][_0x87c9('0xe')]);}logger[_0x87c9('0xc')](_0x87c9('0x7'),_0x45aa50,_0x2f99a6['error'][_0x87c9('0xe')]);return _0x5c5147(_0x2f99a6['error'][_0x87c9('0xe')]);}else{logger['info'](_0x87c9('0x7'),_0x45aa50,_0x87c9('0x8'));_0x5c5147(_0x2f99a6[_0x87c9('0xf')][_0x87c9('0xe')]);}})[_0x87c9('0x10')](function(_0x10265d){logger[_0x87c9('0xc')](_0x87c9('0x7'),_0x45aa50,_0x10265d);_0xda3e52(_0x10265d);});});}exports[_0x87c9('0x11')]=function(_0x2f8b31){var _0x47e402=this;return new Promise(function(_0x3eb361,_0x3d5a01){return db[_0x87c9('0x12')]['update'](_0x2f8b31[_0x87c9('0x13')],{'raw':_0x2f8b31[_0x87c9('0x14')]?_0x2f8b31[_0x87c9('0x14')][_0x87c9('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f8b31['options']?_0x2f8b31['options'][_0x87c9('0x16')]||null:null,'attributes':_0x2f8b31[_0x87c9('0x14')]?_0x2f8b31['options']['attributes']||null:null,'limit':_0x2f8b31[_0x87c9('0x14')]?_0x2f8b31[_0x87c9('0x14')][_0x87c9('0x17')]||null:null})[_0x87c9('0x18')](function(_0x4a7f80){logger[_0x87c9('0x19')](_0x87c9('0x11'),_0x2f8b31);logger[_0x87c9('0x9')](_0x87c9('0x11'),_0x2f8b31,JSON[_0x87c9('0xb')](_0x4a7f80));_0x3eb361(_0x4a7f80);})[_0x87c9('0x10')](function(_0xbc4270){logger['error'](_0x87c9('0x11'),_0xbc4270[_0x87c9('0xe')],_0x2f8b31);_0x3d5a01(_0x47e402[_0x87c9('0xc')](0x1f4,_0xbc4270['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 27afd0f..3247d07 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 _0x0f9f=['../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','download','post','create','/:id/messages','/:id/tags','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x359a94,_0xc6279f){var _0x28e9fe=function(_0x20dc1d){while(--_0x20dc1d){_0x359a94['push'](_0x359a94['shift']());}};_0x28e9fe(++_0xc6279f);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x7e3f06,_0x426f70){_0x7e3f06=_0x7e3f06-0x0;var _0x12b8ff=_0x0f9f[_0x7e3f06];return _0x12b8ff;};'use strict';var multer=require('multer');var util=require(_0xf0f9('0x0'));var path=require(_0xf0f9('0x1'));var timeout=require(_0xf0f9('0x2'));var express=require('express');var router=express[_0xf0f9('0x3')]();var auth=require(_0xf0f9('0x4'));var interaction=require(_0xf0f9('0x5'));var config=require(_0xf0f9('0x6'));var controller=require(_0xf0f9('0x7'));router[_0xf0f9('0x8')]('/',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xa')]);router[_0xf0f9('0x8')](_0xf0f9('0xb'),auth['isAuthenticated'](),controller[_0xf0f9('0xc')]);router[_0xf0f9('0x8')]('/:id',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xd')]);router[_0xf0f9('0x8')]('/:id/messages',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xe')]);router[_0xf0f9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xf0f9('0xf')]);router[_0xf0f9('0x10')]('/',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0x11')]);router[_0xf0f9('0x10')](_0xf0f9('0x12'),auth[_0xf0f9('0x9')](),controller['addMessage']);router[_0xf0f9('0x10')](_0xf0f9('0x13'),auth[_0xf0f9('0x9')](),interaction[_0xf0f9('0x14')](_0xf0f9('0x15'),'mailinteraction:addtags'),controller[_0xf0f9('0x16')]);router[_0xf0f9('0x17')](_0xf0f9('0x18'),auth[_0xf0f9('0x9')](),interaction[_0xf0f9('0x14')](_0xf0f9('0x15'),_0xf0f9('0x19')),controller[_0xf0f9('0x1a')]);router[_0xf0f9('0x1b')](_0xf0f9('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0xf0f9('0x15'),_0xf0f9('0x1c')),controller['destroy']);router[_0xf0f9('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xf0f9('0x1d')]);module[_0xf0f9('0x1e')]=router; \ No newline at end of file +var _0xd04b=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','tracked','mail','mailinteraction:addtags','mailinteraction:destroy','destroy','removeTags'];(function(_0xcf0d77,_0x2195aa){var _0x13b05f=function(_0x2e798b){while(--_0x2e798b){_0xcf0d77['push'](_0xcf0d77['shift']());}};_0x13b05f(++_0x2195aa);}(_0xd04b,0x145));var _0xbd04=function(_0x1c8a3a,_0x4d07aa){_0x1c8a3a=_0x1c8a3a-0x0;var _0x36f2bf=_0xd04b[_0x1c8a3a];return _0x36f2bf;};'use strict';var multer=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var path=require(_0xbd04('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd04('0x3'));var router=express['Router']();var auth=require(_0xbd04('0x4'));var interaction=require(_0xbd04('0x5'));var config=require(_0xbd04('0x6'));var controller=require(_0xbd04('0x7'));router[_0xbd04('0x8')]('/',auth[_0xbd04('0x9')](),controller[_0xbd04('0xa')]);router[_0xbd04('0x8')](_0xbd04('0xb'),auth[_0xbd04('0x9')](),controller[_0xbd04('0xc')]);router['get'](_0xbd04('0xd'),auth[_0xbd04('0x9')](),controller[_0xbd04('0xe')]);router[_0xbd04('0x8')](_0xbd04('0xf'),auth[_0xbd04('0x9')](),controller[_0xbd04('0x10')]);router[_0xbd04('0x8')]('/:id/download',auth[_0xbd04('0x9')](),controller[_0xbd04('0x11')]);router[_0xbd04('0x12')]('/',auth[_0xbd04('0x9')](),controller['create']);router[_0xbd04('0x12')](_0xbd04('0xf'),auth[_0xbd04('0x9')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0xbd04('0x13')](_0xbd04('0x14'),_0xbd04('0x15')),controller['addTags']);router['put'](_0xbd04('0xd'),auth['isAuthenticated'](),interaction[_0xbd04('0x13')](_0xbd04('0x14'),'mailinteraction:update'),controller['update']);router['delete'](_0xbd04('0xd'),auth[_0xbd04('0x9')](),interaction[_0xbd04('0x13')](_0xbd04('0x14'),_0xbd04('0x16')),controller[_0xbd04('0x17')]);router['delete']('/:id/tags',auth[_0xbd04('0x9')](),controller[_0xbd04('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 62837cb..995e30a 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 _0x8c32=['TEXT','BOOLEAN','out','ENUM','long','sequelize','iconv','exports','DATE','STRING'];(function(_0xd4f3b,_0x248a75){var _0x6860d8=function(_0x5ca3ba){while(--_0x5ca3ba){_0xd4f3b['push'](_0xd4f3b['shift']());}};_0x6860d8(++_0x248a75);}(_0x8c32,0x1e5));var _0x28c3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8c32[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0x28c3('0x0'));var iconv=require(_0x28c3('0x1'));module[_0x28c3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x28c3('0x3')]},'disposition':{'type':Sequelize[_0x28c3('0x4')]},'secondDisposition':{'type':Sequelize[_0x28c3('0x4')]},'thirdDisposition':{'type':Sequelize[_0x28c3('0x4')]},'note':{'type':Sequelize[_0x28c3('0x4')]},'inReplyTo':{'type':Sequelize[_0x28c3('0x4')](0x1fe)},'to':{'type':Sequelize[_0x28c3('0x4')]},'cc':{'type':Sequelize[_0x28c3('0x5')]('long')},'subject':{'type':Sequelize[_0x28c3('0x5')]()},'attach':{'type':Sequelize[_0x28c3('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x28c3('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x28c3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x28c3('0x8')]('in',_0x28c3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x28c3('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0x28c3('0x5')](_0x28c3('0x9'))}}; \ No newline at end of file +var _0x54cd=['long','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0x4e4413,_0x1116a6){var _0x4c449a=function(_0x2ff65c){while(--_0x2ff65c){_0x4e4413['push'](_0x4e4413['shift']());}};_0x4c449a(++_0x1116a6);}(_0x54cd,0x91));var _0xd54c=function(_0x154fac,_0x16058b){_0x154fac=_0x154fac-0x0;var _0x4087ad=_0x54cd[_0x154fac];return _0x4087ad;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xd54c('0x0'));module[_0xd54c('0x1')]={'closed':{'type':Sequelize[_0xd54c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd54c('0x3')]},'disposition':{'type':Sequelize[_0xd54c('0x4')]},'secondDisposition':{'type':Sequelize[_0xd54c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd54c('0x4')]},'note':{'type':Sequelize[_0xd54c('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd54c('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd54c('0x3')]},'substatus':{'type':Sequelize[_0xd54c('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xd54c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd54c('0x6')]('in',_0xd54c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd54c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd54c('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd54c('0x5')](_0xd54c('0x8'))},'lastMsgText':{'type':Sequelize[_0xd54c('0x5')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ce86147..c765437 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 _0x9454=['cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','union','UserId','plainBody','some','compact','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','MailInteraction','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.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','includeAll','include','options','body','params','describe','MailMessage','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','root','server','files','tmp','join','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','attachments','readFileSync','build','message%d.eml','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./mailInteraction.socket','register','end','status','json','count','offset','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','findOne','lastMsgBody','lastMsgText','trimStart','catch','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','left_join'];(function(_0x578c60,_0x1cd4f6){var _0x1524a6=function(_0x348ae3){while(--_0x348ae3){_0x578c60['push'](_0x578c60['shift']());}};_0x1524a6(++_0x1cd4f6);}(_0x9454,0x8d));var _0x4945=function(_0x19be82,_0x376f70){_0x19be82=_0x19be82-0x0;var _0x115d09=_0x9454[_0x19be82];return _0x115d09;};'use strict';var pdf=require(_0x4945('0x0'));var emlformat=require(_0x4945('0x1'));var rimraf=require(_0x4945('0x2'));var zipdir=require(_0x4945('0x3'));var jsonpatch=require(_0x4945('0x4'));var rp=require(_0x4945('0x5'));var moment=require(_0x4945('0x6'));var BPromise=require(_0x4945('0x7'));var Mustache=require(_0x4945('0x8'));var util=require('util');var path=require(_0x4945('0x9'));var sox=require(_0x4945('0xa'));var csv=require(_0x4945('0xb'));var ejs=require(_0x4945('0xc'));var fs=require('fs');var _=require(_0x4945('0xd'));var squel=require(_0x4945('0xe'));var crypto=require('crypto');var jsforce=require(_0x4945('0xf'));var deskjs=require(_0x4945('0x10'));var toCsv=require(_0x4945('0xb'));var querystring=require('querystring');var Papa=require(_0x4945('0x11'));var htmlToText=require(_0x4945('0x12'));var Redis=require(_0x4945('0x13'));var authService=require(_0x4945('0x14'));var qs=require(_0x4945('0x15'));var as=require(_0x4945('0x16'));var hardwareService=require(_0x4945('0x17'));var logger=require(_0x4945('0x18'))(_0x4945('0x19'));var utils=require('../../config/utils');var config=require(_0x4945('0x1a'));var licenseUtil=require(_0x4945('0x1b'));var db=require(_0x4945('0x1c'))['db'];config['redis']=_[_0x4945('0x1d')](config['redis'],{'host':_0x4945('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4945('0x1f')]));require(_0x4945('0x20'))[_0x4945('0x21')](socket);function respondWithStatusCode(_0x39ce27,_0x43ea59){_0x43ea59=_0x43ea59||0xcc;return function(_0x606b32){if(_0x606b32){return _0x39ce27['sendStatus'](_0x43ea59);}return _0x39ce27['status'](_0x43ea59)[_0x4945('0x22')]();};}function respondWithResult(_0x14a7f2,_0xa164cd){_0xa164cd=_0xa164cd||0xc8;return function(_0x336ef8){if(_0x336ef8){return _0x14a7f2[_0x4945('0x23')](_0xa164cd)[_0x4945('0x24')](_0x336ef8);}};}function respondWithFilteredResult(_0x27ef9b,_0x5579b0){return function(_0x26712a){if(_0x26712a){var _0x649a43=_0x26712a[_0x4945('0x25')],_0x9c1f27=_0x5579b0[_0x4945('0x26')],_0x223683=_0x5579b0['offset']+_0x5579b0['limit'],_0x59f05b;if(_0x223683>=_0x649a43){_0x223683=_0x649a43;_0x59f05b=0xc8;}else{_0x59f05b=0xce;}_0x27ef9b[_0x4945('0x23')](_0x59f05b);return _0x27ef9b[_0x4945('0x27')]('Content-Range',_0x9c1f27+'-'+_0x223683+'/'+_0x649a43)[_0x4945('0x24')](_0x26712a);}return null;};}function patchUpdates(_0x2284ae){return function(_0x3d3e2e){try{jsonpatch[_0x4945('0x28')](_0x3d3e2e,_0x2284ae,!![]);}catch(_0x333c2e){return BPromise['reject'](_0x333c2e);}return _0x3d3e2e[_0x4945('0x29')]();};}function saveUpdates(_0x1365d3,_0x12c602){return function(_0x491a30){if(_0x491a30){return _0x491a30[_0x4945('0x2a')](_0x1365d3)['then'](function(_0x9fdede){return _0x9fdede;});}return null;};}function removeEntity(_0x3e9f15,_0x227447){return function(_0x4f2b85){if(_0x4f2b85){return _0x4f2b85[_0x4945('0x2b')]()[_0x4945('0x2c')](function(){_0x3e9f15[_0x4945('0x23')](0xcc)[_0x4945('0x22')]();});}};}function handleEntityNotFound(_0x3e7146,_0xff0380){return function(_0x4369bd){if(!_0x4369bd){_0x3e7146[_0x4945('0x2d')](0x194);}return _0x4369bd;};}function handleError(_0x3c16a8,_0x22b7c9){_0x22b7c9=_0x22b7c9||0x1f4;return function(_0x5f0c3f){logger[_0x4945('0x2e')](_0x5f0c3f[_0x4945('0x2f')]);if(_0x5f0c3f['name']){delete _0x5f0c3f[_0x4945('0x30')];}_0x3c16a8[_0x4945('0x23')](_0x22b7c9)[_0x4945('0x31')](_0x5f0c3f);};}function getInteractionUsers(_0x1721df,_0x5763b5){return new BPromise(function(_0x3b41a4,_0x343f20){try{if(_0x5763b5[_0x1721df['id']]){_0x1721df[_0x4945('0x32')]=_[_0x4945('0x33')](_0x5763b5[_0x1721df['id']],function(_0x5bed5b){return{'id':_0x5bed5b['id'],'fullname':_0x5bed5b[_0x4945('0x34')]};});}}catch(_0x45994c){_0x343f20(_0x45994c);}_0x3b41a4(_0x1721df);});}function getInteractionTags(_0x26b95a,_0x5909bf){return new BPromise(function(_0x1ea943,_0x1fca2d){try{if(_0x26b95a[_0x4945('0x35')]){_0x26b95a[_0x4945('0x36')]=[];_0x26b95a['TagIds'][_0x4945('0x37')](',')[_0x4945('0x38')](function(_0x42fbf6){_0x26b95a['Tags'][_0x4945('0x39')](_0x5909bf[_0x42fbf6]);});}delete _0x26b95a[_0x4945('0x35')];}catch(_0x7d9f5c){_0x1fca2d(_0x7d9f5c);}_0x1ea943(_0x26b95a);});}function getLastMessageText(_0x37596b){return new BPromise(function(_0x136460,_0x3c85f6){return db['MailInteraction'][_0x4945('0x3a')]({'where':{'id':_0x37596b['id']},'attributes':[_0x4945('0x3b'),_0x4945('0x3c')],'raw':!![]})[_0x4945('0x2c')](function(_0x490b48){if(!_0x490b48[_0x4945('0x3c')]){_0x37596b[_0x4945('0x3c')]=_[_0x4945('0x3d')](htmlToText['fromString'](_0x490b48[_0x4945('0x3b')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x37596b[_0x4945('0x3c')]=_0x490b48[_0x4945('0x3c')];}_0x136460(_0x37596b);})[_0x4945('0x3e')](function(_0x3b80d0){_0x3c85f6(_0x3b80d0);});});}function updateMailInteraction(_0xc067,_0x3d9e6e,_0x436b14,_0xfcb4a5){return new BPromise(function(_0x5d88c9,_0x1c458c){return getInteractionUsers(_0xc067,_0x436b14)['then'](function(_0x13d9ed){return getInteractionTags(_0x13d9ed,_0x3d9e6e);})['then'](function(_0x1bf41f){if(_0xfcb4a5){_0x5d88c9(getLastMessageText(_0x1bf41f));}else{_0x5d88c9(_0x1bf41f);}})[_0x4945('0x3e')](function(_0x21a631){_0x1c458c(_0x21a631);});});}exports['index']=function(_0x1f9de9,_0x37a251){var _0x103f21={},_0x1bc7ed={},_0x4b0571={'count':0x0,'rows':[]};var _0x97f7ae=_[_0x4945('0x33')](db['MailInteraction'][_0x4945('0x3f')],function(_0x1eb6e9){return{'name':_0x1eb6e9[_0x4945('0x40')],'type':_0x1eb6e9[_0x4945('0x41')][_0x4945('0x42')]};});_0x1bc7ed[_0x4945('0x43')]=_[_0x4945('0x33')](_0x97f7ae,'name');_0x1bc7ed['query']=_[_0x4945('0x44')](_0x1f9de9[_0x4945('0x45')]);_0x1bc7ed[_0x4945('0x46')]=_[_0x4945('0x47')](_0x1bc7ed[_0x4945('0x43')],_0x1bc7ed[_0x4945('0x45')]);_0x103f21['attributes']=_['intersection'](_0x1bc7ed[_0x4945('0x43')],qs[_0x4945('0x48')](_0x1f9de9[_0x4945('0x45')][_0x4945('0x48')]));_0x103f21['attributes']=_0x103f21[_0x4945('0x49')][_0x4945('0x4a')]?_0x103f21[_0x4945('0x49')]:_0x1bc7ed['model'];if(!_0x1f9de9[_0x4945('0x45')][_0x4945('0x4b')](_0x4945('0x4c'))){_0x103f21['limit']=qs[_0x4945('0x4d')](_0x1f9de9['query']['limit']);_0x103f21[_0x4945('0x26')]=qs['offset'](_0x1f9de9['query'][_0x4945('0x26')]);}_0x103f21[_0x4945('0x4e')]=qs[_0x4945('0x4f')](_0x1f9de9[_0x4945('0x45')][_0x4945('0x4f')]);_0x103f21['where']=qs[_0x4945('0x46')](_[_0x4945('0x50')](_0x1f9de9['query'],_0x1bc7ed[_0x4945('0x46')]),_0x97f7ae);var _0xefc4fc=[];var _0x14d463=squel[_0x4945('0x51')]()['field']('id')[_0x4945('0x52')](_0x4945('0x30'))[_0x4945('0x52')](_0x4945('0x53'))[_0x4945('0x54')](_0x4945('0x55'));var _0x5c8031=squel['select']()[_0x4945('0x52')]('u.id')[_0x4945('0x52')](_0x4945('0x56'))[_0x4945('0x52')](_0x4945('0x57'))[_0x4945('0x54')](_0x4945('0x58'),'ui')['left_join'](_0x4945('0x59'),'u',_0x4945('0x5a'));var _0x4bcd7a=squel[_0x4945('0x51')]()[_0x4945('0x54')]('mail_interactions','i')[_0x4945('0x5b')](_0x4945('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4945('0x5b')]('users','o',_0x4945('0x5d'))['left_join'](_0x4945('0x5e'),'a',_0x4945('0x5f'))[_0x4945('0x5b')](_0x4945('0x60'),'me','me.MailInteractionId\x20=\x20i.id')[_0x4945('0x5b')](_0x4945('0x61'),'it',_0x4945('0x62'))[_0x4945('0x5b')](_0x4945('0x55'),'t',_0x4945('0x63'));var _0x3d8795=squel[_0x4945('0x64')]();var _0x449ab4=[];var _0x23b78e=squel[_0x4945('0x64')]();var _0x2d9a80;if(_0x1f9de9['query'][_0x4945('0x65')]){_0x2d9a80=as['parseSearch'](_0x1f9de9[_0x4945('0x45')][_0x4945('0x65')]);var _0x431a95=_0x2d9a80['sqlOperator'];for(var _0x5c8bd1=0x0;_0x5c8bd1<_0x2d9a80['conditions'][_0x4945('0x4a')];_0x5c8bd1++){var _0x334eb0=_0x2d9a80[_0x4945('0x66')][_0x5c8bd1];var _0xa6ed98='i';var _0x377001=_['find'](_0x97f7ae,[_0x4945('0x30'),_0x334eb0[_0x4945('0x52')]]);if(!_0x377001){switch(_0x334eb0[_0x4945('0x52')]){case'unreadMessages':if(_0x334eb0[_0x4945('0x67')]==0x1){_0x4bcd7a[_0x4945('0x68')]('`'+_0x334eb0['field']+_0x4945('0x69'));}else{_0x4bcd7a[_0x4945('0x68')]('`'+_0x334eb0[_0x4945('0x52')]+_0x4945('0x6a'));}break;case _0x4945('0x6b'):if(_0x334eb0[_0x4945('0x6c')]===_0x4945('0x6d')){if(_0x334eb0[_0x4945('0x67')]['split']('\x20')['length']>0x1){_0x3d8795[_0x431a95](_0x4945('0x6e'),qs['getFullTextValue'](_0x334eb0[_0x4945('0x67')]),null);}else{var _0x1eefc4='%'+_0x334eb0['value']+'%';_0x3d8795[_0x431a95](_0x4945('0x6f'),_0x1eefc4,_0x1eefc4,_0x1eefc4);}}else{_0x377001=_[_0x4945('0x70')](_0x97f7ae,['name',_0x4945('0x71')]);_0x334eb0['field']='ContactId';_0xcbf6c7=as[_0x4945('0x72')](_0xa6ed98,_0x377001[_0x4945('0x41')],_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7[_0x4945('0x73')],_0xcbf6c7['value'][_0x4945('0x74')],_0xcbf6c7[_0x4945('0x67')]['end']);}break;case _0x4945('0x75'):var _0x2ff526=_0x334eb0[_0x4945('0x67')][_0x4945('0x37')](',')['map'](function(_0x317880){return Number(_0x317880);});_0x2ff526['forEach'](function(_0x517f10){_0x23b78e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x517f10+',%');});_0x449ab4=_[_0x4945('0x76')](_0x449ab4,_0x2ff526);break;case'User':if(_0x334eb0[_0x4945('0x6c')]==='$substring'){_0x3d8795[_0x431a95]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x334eb0[_0x4945('0x67')]+'%',null);}else{_0x377001=_[_0x4945('0x70')](_0x97f7ae,[_0x4945('0x30'),_0x4945('0x77')]);_0x334eb0[_0x4945('0x52')]=_0x4945('0x77');_0xcbf6c7=as[_0x4945('0x72')](_0xa6ed98,_0x377001[_0x4945('0x41')],_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7['text'],_0xcbf6c7[_0x4945('0x67')][_0x4945('0x74')],_0xcbf6c7[_0x4945('0x67')][_0x4945('0x22')]);}break;case _0x4945('0x78'):_0xcbf6c7=as[_0x4945('0x72')]('me',null,_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7[_0x4945('0x73')],_0xcbf6c7[_0x4945('0x67')][_0x4945('0x74')],_0xcbf6c7[_0x4945('0x67')]['end']);break;}}else{var _0xcbf6c7=as[_0x4945('0x72')](_0xa6ed98,_0x377001[_0x4945('0x41')],_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7[_0x4945('0x73')],_0xcbf6c7['value']['start'],_0xcbf6c7['value']['end']);}}}else{var _0x3827dd=_(_0x1f9de9['query'])['keys']()[_0x4945('0x33')](function(_0x1da91b){return _[_0x4945('0x79')](_0x97f7ae,[_0x4945('0x30'),_0x1da91b])?_0x1da91b:undefined;})[_0x4945('0x7a')]()['value']();if(!_['isEmpty'](_0x3827dd)){_0x3827dd[_0x4945('0x38')](function(_0x2cae80){if(_0x2cae80===_0x4945('0x7b')){_0x4bcd7a[_0x4945('0x7c')](_0x4945('0x7d'),[][_0x4945('0x7e')](_0x1f9de9[_0x4945('0x45')][_0x2cae80]));}else if(_0x2cae80===_0x4945('0x7f')){var _0x2f7480=JSON[_0x4945('0x80')](_0x1f9de9[_0x4945('0x45')][_0x2cae80])[_0x4945('0x81')];var _0x4103d1=JSON[_0x4945('0x80')](_0x1f9de9[_0x4945('0x45')][_0x2cae80])[_0x4945('0x82')];_0x4bcd7a[_0x4945('0x7c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f7480,_0x4103d1);}else{if(_0x1f9de9[_0x4945('0x45')][_0x2cae80]==='null'){_0x4bcd7a[_0x4945('0x7c')]('i.'+_0x2cae80+_0x4945('0x83'));}else{_0x4bcd7a[_0x4945('0x7c')]('i.'+_0x2cae80+'\x20=\x20?',_0x1f9de9[_0x4945('0x45')][_0x2cae80]);}}});}if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x84')]){if(_0x1f9de9['query'][_0x4945('0x84')]==0x1){_0x4bcd7a['having']('`unreadMessages`\x20=\x200');}else{_0x4bcd7a[_0x4945('0x68')](_0x4945('0x85'));}}if(_0x1f9de9['query'][_0x4945('0x86')]){_0x449ab4=_['isArray'](_0x1f9de9[_0x4945('0x45')][_0x4945('0x86')])?_0x1f9de9[_0x4945('0x45')][_0x4945('0x86')]:new Array(_0x1f9de9[_0x4945('0x45')][_0x4945('0x86')]);_0x449ab4[_0x4945('0x38')](function(_0xc97e21){_0x23b78e['or'](_0x4945('0x87'),'%,'+_0xc97e21+',%');});}if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x88')]){var _0x2767bb=_0x1f9de9['query'][_0x4945('0x88')]['replace']('\x5c','\x5c\x5c')[_0x4945('0x89')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2767bb)){_0x3d8795['or'](_0x4945('0x8a'),_0x2767bb+'%');}else if(qs['isEmail'](_0x2767bb)){_0x3d8795['or'](_0x4945('0x8b'),_0x2767bb+'%');}else{_0x3d8795['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4945('0x8c')](_0x2767bb))['or'](_0x4945('0x8d'),qs['getFullTextValue'](_0x2767bb));}}}_0x4bcd7a[_0x4945('0x7c')](_0x3d8795);_0x4bcd7a[_0x4945('0x8e')](_0x4945('0x8f'));var _0x214cd4={'type':db[_0x4945('0x90')]['QueryTypes'][_0x4945('0x91')],'raw':!![]};var _0x27802c=_0x4bcd7a['clone']();_0x27802c[_0x4945('0x52')]('i.id');_0x27802c[_0x4945('0x52')](_0x4945('0x92'),_0x4945('0x93'));if(_0x103f21[_0x4945('0x4e')]){_0x103f21[_0x4945('0x4e')][_0x4945('0x38')](function(_0x48af62){var _0x57f298=_0x48af62[0x0]===_0x4945('0x94')?_0x48af62[0x0]:'i.'+_0x48af62[0x0];_0x4bcd7a['order'](_0x57f298,_0x48af62[0x1]===_0x4945('0x95')?![]:!![]);});}if(!_[_0x4945('0x96')](_0x449ab4)){_0x4bcd7a[_0x4945('0x68')](_0x23b78e);_0x27802c[_0x4945('0x7c')](_0x4945('0x97'),_0x449ab4);}BPromise['resolve']()[_0x4945('0x2c')](function(){if(!_0x2d9a80){if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x7b')]||_0x1f9de9['query'][_0x4945('0x98')])return;_0x27802c[_0x4945('0x7c')](_0x4945('0x99'));_0x4bcd7a[_0x4945('0x7c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1f9de9[_0x4945('0x9a')][_0x4945('0x9b')]!==_0x4945('0x9c'))return;return _0x1f9de9[_0x4945('0x9a')][_0x4945('0x9d')]({'attributes':['id'],'raw':!![]})[_0x4945('0x2c')](function(_0x17fd00){if(_[_0x4945('0x96')](_0x17fd00)){_0x27802c['where'](_0x4945('0x9e'));_0x4bcd7a['where'](_0x4945('0x9e'));}else{_0x27802c[_0x4945('0x7c')](_0x4945('0x7d'),_['map'](_0x17fd00,'id'));_0x4bcd7a[_0x4945('0x7c')]('i.MailAccountId\x20IN\x20?',_[_0x4945('0x33')](_0x17fd00,'id'));}});})['then'](function(){if(_0x1f9de9[_0x4945('0x9a')]['role']===_0x4945('0x9c')&&!_0x2d9a80&&!_0x1f9de9[_0x4945('0x45')][_0x4945('0x7b')])return[];return db[_0x4945('0x9f')][_0x4945('0x45')](_0x27802c['toString'](),_0x214cd4);})[_0x4945('0x2c')](function(_0x51afc1){_0x4b0571['count']=_0x51afc1[_0x4945('0x4a')];if(_0x4b0571[_0x4945('0x25')]===0x0)return[];return db[_0x4945('0x9f')][_0x4945('0x45')](_0x14d463[_0x4945('0xa0')](),_0x214cd4)[_0x4945('0x2c')](function(_0x1c6940){_0xefc4fc=_[_0x4945('0xa1')](_0x1c6940,'id');_0x214cd4=_[_0x4945('0xa2')](_0x214cd4,{'model':db[_0x4945('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x48')]){_0x103f21['attributes'][_0x4945('0x38')](function(_0xd9109c){_0x4bcd7a[_0x4945('0x52')]('i.'+_0xd9109c);});}else{_0x4bcd7a[_0x4945('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4945('0x93'));_0x4bcd7a[_0x4945('0x52')]('a.key','Account.key');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa4'),_0x4945('0xa5'));_0x4bcd7a['field'](_0x4945('0xa6'),'contactName');_0x4bcd7a[_0x4945('0x52')]('i.id');_0x4bcd7a[_0x4945('0x52')]('i.createdAt');_0x4bcd7a['field']('i.updatedAt');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa7'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa8'));_0x4bcd7a['field']('i.attach');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa9'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xaa'));_0x4bcd7a['field']('i.subject');_0x4bcd7a['field'](_0x4945('0xab'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xac'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xad'));_0x4bcd7a[_0x4945('0x52')]('i.substatus');_0x4bcd7a['field']('i.to');_0x4bcd7a['field'](_0x4945('0xae'));_0x4bcd7a[_0x4945('0x52')]('i.MailAccountId');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xaf'));_0x4bcd7a['field']('c.firstName',_0x4945('0xb0'));_0x4bcd7a['field'](_0x4945('0xb1'),_0x4945('0xb2'));_0x4bcd7a['field']('c.email',_0x4945('0xb3'));_0x4bcd7a['field']('c.phone',_0x4945('0xb4'));_0x4bcd7a['field'](_0x4945('0xb5'),'Contact.mobile');_0x4bcd7a[_0x4945('0x52')]('c.fax',_0x4945('0xb6'));_0x4bcd7a[_0x4945('0x52')]('o.fullname',_0x4945('0xb7'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xb8'),'Owner.internal');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xb9'),'TagIds');}if(_0x103f21[_0x4945('0x4d')])_0x4bcd7a[_0x4945('0x4d')](_0x103f21[_0x4945('0x4d')]);if(_0x103f21['offset'])_0x4bcd7a[_0x4945('0x26')](_0x103f21[_0x4945('0x26')]);return db[_0x4945('0x9f')][_0x4945('0x45')](_0x4bcd7a[_0x4945('0xa0')](),_0x214cd4);})[_0x4945('0x2c')](function(_0x406faa){_0x5c8031[_0x4945('0x7c')](_0x4945('0xba'),_['map'](_0x406faa,'id'));return db[_0x4945('0x9f')][_0x4945('0x45')](_0x5c8031['toString'](),_0x214cd4)[_0x4945('0x2c')](function(_0x9b637a){var _0x3f74e2=_['groupBy'](_0x9b637a,_0x4945('0xbb'));var _0x1d50d2=[];return db[_0x4945('0xbc')][_0x4945('0x3a')]({'attributes':[_0x4945('0xbd')],'raw':!![]})[_0x4945('0x2c')](function(_0xa48c72){var _0x8d8cb1=_0xa48c72[_0x4945('0xbd')];_0x406faa[_0x4945('0x38')](function(_0x1ef7a1){_0x1d50d2[_0x4945('0x39')](updateMailInteraction(_0x1ef7a1,_0xefc4fc,_0x3f74e2,_0x8d8cb1));});return BPromise[_0x4945('0xbe')](_0x1d50d2);});});});})[_0x4945('0x2c')](function(_0x44ac4e){_0x4b0571[_0x4945('0xbf')]=_0x44ac4e;return _0x4b0571;})[_0x4945('0x2c')](respondWithFilteredResult(_0x37a251,_0x103f21))[_0x4945('0x3e')](handleError(_0x37a251,null));};exports['show']=function(_0x7deae9,_0x2b9efd){var _0x41b1a2={'raw':![],'where':{'id':_0x7deae9['params']['id']}},_0x466397={};_0x466397[_0x4945('0x43')]=_[_0x4945('0x44')](db[_0x4945('0xa3')][_0x4945('0x3f')]);_0x466397[_0x4945('0x45')]=_[_0x4945('0x44')](_0x7deae9['query']);_0x466397['filters']=_['intersection'](_0x466397['model'],_0x466397[_0x4945('0x45')]);_0x41b1a2[_0x4945('0x49')]=_[_0x4945('0x47')](_0x466397[_0x4945('0x43')],qs[_0x4945('0x48')](_0x7deae9[_0x4945('0x45')][_0x4945('0x48')]));_0x41b1a2[_0x4945('0x49')]=_0x41b1a2['attributes']['length']?_0x41b1a2[_0x4945('0x49')]:_0x466397[_0x4945('0x43')];if(_0x7deae9['query'][_0x4945('0xc0')]){_0x41b1a2[_0x4945('0xc1')]=[{'all':!![]}];}_0x41b1a2=_[_0x4945('0xa2')]({},_0x41b1a2,_0x7deae9[_0x4945('0xc2')]);return db[_0x4945('0xa3')]['find'](_0x41b1a2)[_0x4945('0x2c')](handleEntityNotFound(_0x2b9efd,null))[_0x4945('0x2c')](respondWithResult(_0x2b9efd,null))[_0x4945('0x3e')](handleError(_0x2b9efd,null));};exports['create']=function(_0xb77ff4,_0x529988){return db[_0x4945('0xa3')]['create'](_0xb77ff4['body'],{})['then'](respondWithResult(_0x529988,0xc9))[_0x4945('0x3e')](handleError(_0x529988,null));};exports['update']=function(_0x340bd0,_0x2cbf09){if(_0x340bd0[_0x4945('0xc3')]['id']){delete _0x340bd0[_0x4945('0xc3')]['id'];}return db[_0x4945('0xa3')]['find']({'where':{'id':_0x340bd0[_0x4945('0xc4')]['id']}})[_0x4945('0x2c')](handleEntityNotFound(_0x2cbf09,null))['then'](saveUpdates(_0x340bd0[_0x4945('0xc3')],null))[_0x4945('0x2c')](respondWithResult(_0x2cbf09,null))[_0x4945('0x3e')](handleError(_0x2cbf09,null));};exports[_0x4945('0x2b')]=function(_0x1641ef,_0x3f30bc){return db['MailInteraction']['find']({'where':{'id':_0x1641ef['params']['id']}})['then'](handleEntityNotFound(_0x3f30bc,null))[_0x4945('0x2c')](removeEntity(_0x3f30bc,null))['catch'](handleError(_0x3f30bc,null));};exports[_0x4945('0xc5')]=function(_0x8a59ff,_0x2cd271){return db[_0x4945('0xa3')][_0x4945('0xc5')]()[_0x4945('0x2c')](respondWithResult(_0x2cd271,null))[_0x4945('0x3e')](handleError(_0x2cd271,null));};exports['addMessage']=function(_0x5d76ea,_0x4896aa,_0x55c25a){return db[_0x4945('0xc6')][_0x4945('0x70')]({'where':{'id':_0x5d76ea[_0x4945('0xc4')]['id']}})['then'](handleEntityNotFound(_0x4896aa,null))[_0x4945('0x2c')](function(_0x1ce59f){if(_0x1ce59f){return _0x1ce59f[_0x4945('0xc7')](_0x5d76ea[_0x4945('0xc3')]['ids'],_['omit'](_0x5d76ea[_0x4945('0xc3')],[_0x4945('0xc8'),'id'])||{});}})[_0x4945('0x2c')](respondWithResult(_0x4896aa,null))[_0x4945('0x3e')](handleError(_0x4896aa,null));};exports[_0x4945('0xc9')]=function(_0x3e0b6d,_0xd18389,_0x492f5b){var _0x16210b={'raw':![],'where':{}};var _0x252309={};var _0x2a632c={'count':0x0,'rows':[]};return db[_0x4945('0xa3')][_0x4945('0x3a')]({'where':{'id':_0x3e0b6d[_0x4945('0xc4')]['id']}})['then'](handleEntityNotFound(_0xd18389,null))['then'](function(_0x420af4){if(_0x420af4){_0x252309[_0x4945('0x43')]=_['keys'](db[_0x4945('0xc6')][_0x4945('0x3f')]);_0x252309[_0x4945('0x45')]=_[_0x4945('0x44')](_0x3e0b6d['query']);_0x252309[_0x4945('0x46')]=_[_0x4945('0x47')](_0x252309[_0x4945('0x43')],_0x252309['query']);_0x16210b[_0x4945('0x49')]=_['intersection'](_0x252309['model'],qs[_0x4945('0x48')](_0x3e0b6d[_0x4945('0x45')][_0x4945('0x48')]));_0x16210b['attributes']=_0x16210b[_0x4945('0x49')][_0x4945('0x4a')]?_0x16210b[_0x4945('0x49')]:_0x252309['model'];if(!_0x3e0b6d[_0x4945('0x45')]['hasOwnProperty'](_0x4945('0x4c'))){_0x16210b['limit']=qs['limit'](_0x3e0b6d[_0x4945('0x45')]['limit']);_0x16210b[_0x4945('0x26')]=qs[_0x4945('0x26')](_0x3e0b6d[_0x4945('0x45')][_0x4945('0x26')]);}_0x16210b['order']=qs[_0x4945('0x4f')](_0x3e0b6d['query'][_0x4945('0x4f')]);_0x16210b[_0x4945('0x7c')]=qs[_0x4945('0x46')](_[_0x4945('0x50')](_0x3e0b6d[_0x4945('0x45')],_0x252309['filters']));_0x16210b[_0x4945('0x7c')]['MailInteractionId']=_0x420af4['id'];if(_0x3e0b6d[_0x4945('0x45')][_0x4945('0x88')]){_0x16210b[_0x4945('0x7c')]=_[_0x4945('0xa2')](_0x16210b['where'],{'$or':_[_0x4945('0x33')](_0x16210b['attributes'],function(_0x2108ba){var _0x32aa63={};_0x32aa63[_0x2108ba]={'$like':'%'+_0x3e0b6d[_0x4945('0x45')][_0x4945('0x88')]+'%'};return _0x32aa63;})});}if(_0x3e0b6d['query'][_0x4945('0x81')]){var _0x3b90db=_0x3e0b6d['query']['$gte'][_0x4945('0x37')](',');var _0x15451f={};_0x15451f[_0x3b90db[0x0]]={'$gte':moment(_0x3b90db[0x1])['format'](_0x4945('0xca'))};_0x16210b[_0x4945('0x7c')]=_['merge'](_0x16210b[_0x4945('0x7c')],_0x15451f);}_0x16210b=_[_0x4945('0xa2')]({},_0x16210b,_0x3e0b6d[_0x4945('0xc2')]);return db[_0x4945('0xc6')][_0x4945('0x25')]({'where':_0x16210b[_0x4945('0x7c')]})[_0x4945('0x2c')](function(_0x29b32a){_0x2a632c[_0x4945('0x25')]=_0x29b32a;if(_0x3e0b6d['query'][_0x4945('0xc0')]){_0x16210b[_0x4945('0xc1')]=[{'all':!![]}];}return db[_0x4945('0xc6')]['findAll'](_0x16210b);})[_0x4945('0x2c')](function(_0xf51250){_0x2a632c[_0x4945('0xbf')]=_0xf51250;return _0x2a632c;});}})['then'](respondWithFilteredResult(_0xd18389,_0x16210b))['catch'](handleError(_0xd18389,null));};exports[_0x4945('0xcb')]=function(_0x2d1be9,_0x4ba85c,_0x3d9e6a){return db['MailInteraction']['find']({'where':{'id':_0x2d1be9[_0x4945('0xc4')]['id']}})[_0x4945('0x2c')](handleEntityNotFound(_0x4ba85c,null))[_0x4945('0x2c')](function(_0x337eb1){if(_0x337eb1){return _0x337eb1[_0x4945('0xcc')](_0x2d1be9[_0x4945('0xc3')][_0x4945('0xc8')],_[_0x4945('0xcd')](_0x2d1be9[_0x4945('0xc3')],[_0x4945('0xc8'),'id'])||{})[_0x4945('0xce')](function(){return db[_0x4945('0x75')]['findAll']({'attributes':['id',_0x4945('0x30'),_0x4945('0x53')],'where':{'id':_0x2d1be9['body'][_0x4945('0xc8')]}});})[_0x4945('0x2c')](function(_0x17eaba){socket[_0x4945('0xcf')](_0x4945('0xd0'),{'id':Number(_0x2d1be9['params']['id']),'tags':_0x17eaba||[]});return{'id':Number(_0x2d1be9[_0x4945('0xc4')]['id']),'tags':_0x17eaba||[]};});}})['then'](respondWithResult(_0x4ba85c,null))['catch'](handleError(_0x4ba85c,null));};exports[_0x4945('0xd1')]=function(_0x2da6d5,_0x5213d8,_0x514178){return db[_0x4945('0xa3')][_0x4945('0x70')]({'where':{'id':_0x2da6d5[_0x4945('0xc4')]['id']}})[_0x4945('0x2c')](handleEntityNotFound(_0x5213d8,null))[_0x4945('0x2c')](function(_0x2d32f7){if(_0x2d32f7){return _0x2d32f7[_0x4945('0xd1')](_0x2da6d5['query'][_0x4945('0xc8')]);}})[_0x4945('0x2c')](respondWithStatusCode(_0x5213d8,null))[_0x4945('0x3e')](handleError(_0x5213d8,null));};exports[_0x4945('0xd2')]=function(_0x3516d3,_0x477224){var _0x56ccc5=moment()['unix']()[_0x4945('0xa0')]();var _0x1d9116=path['join'](config[_0x4945('0xd3')],_0x4945('0xd4'),_0x4945('0xd5'),_0x4945('0xd6'));var _0xf38402=path[_0x4945('0xd7')](config[_0x4945('0xd3')],_0x4945('0xd4'),_0x4945('0xd5'),'attachments');var _0x10af40=path[_0x4945('0xd7')](_0x1d9116,_0x56ccc5);var _0x435455=util[_0x4945('0xd8')](_0x4945('0xd9'),_0x3516d3[_0x4945('0xc4')]['id'],_0x56ccc5);var _0x1a512d=path[_0x4945('0xd7')](_0x1d9116,_0x435455);var _0x3c2c03=[];if(_0x3516d3[_0x4945('0x45')]['attachments']){_0x3c2c03[_0x4945('0x39')]({'model':db[_0x4945('0xda')],'as':_0x4945('0xdb'),'raw':!![]});}var _0x4cb272=[{'model':db[_0x4945('0xc6')],'as':_0x4945('0xdc'),'attributes':['id',_0x4945('0xc3'),_0x4945('0x54'),'to','cc',_0x4945('0xdd'),_0x4945('0xde'),_0x4945('0x7f')],'where':{'secret':![]},'order':qs[_0x4945('0x4f')]('id'),'include':_0x3c2c03}];return db[_0x4945('0xa3')]['find']({'where':{'id':_0x3516d3['params']['id']},'include':_0x4cb272})[_0x4945('0x2c')](handleEntityNotFound(_0x477224,null))[_0x4945('0x2c')](function(_0xcda305){if(_0xcda305&&_0xcda305['Messages']){var _0x39b9c5=_0xcda305[_0x4945('0xdf')]({'plain':!![]});fs[_0x4945('0xe0')](_0x10af40);return BPromise['each'](_0x39b9c5[_0x4945('0xdc')],function(_0x45cc52,_0x121308){var _0xb916cb={'from':_0x45cc52[_0x4945('0x54')],'to':_0x45cc52['to'],'subject':_0x45cc52[_0x4945('0xde')],'html':_0x45cc52[_0x4945('0xc3')],'headers':{'Date':moment(_0x45cc52[_0x4945('0x7f')])[_0x4945('0xd8')](_0x4945('0xe1'))},'attachments':[]};if(_0x45cc52['cc']){_0xb916cb['headers']['Cc']=_0x45cc52['cc'];}if(_0x45cc52['bcc']){_0xb916cb['headers'][_0x4945('0xe2')]=_0x45cc52[_0x4945('0xdd')];}return new BPromise(function(_0x3e75a1,_0x76abe1){if(_0x45cc52[_0x4945('0xdb')]){for(var _0x1b9bcd=0x0;_0x1b9bcd<_0x45cc52[_0x4945('0xdb')][_0x4945('0x4a')];_0x1b9bcd++){var _0x29820b=_0x45cc52[_0x4945('0xdb')][_0x1b9bcd];var _0x58b668=path[_0x4945('0xd7')](_0xf38402,_0x29820b['basename']);if(fs['existsSync'](_0x58b668)){_0xb916cb[_0x4945('0xe3')][_0x4945('0x39')]({'name':_0x29820b[_0x4945('0x30')],'contentType':_0x29820b[_0x4945('0x41')],'data':fs[_0x4945('0xe4')](_0x58b668)});}}}emlformat[_0x4945('0xe5')](_0xb916cb,function(_0x6b40e4,_0x4d13e0){if(_0x6b40e4)return _0x76abe1(_0x6b40e4);fs['writeFileSync'](path['join'](_0x10af40,util[_0x4945('0xd8')](_0x4945('0xe6'),_0x121308)),_0x4d13e0);return _0x3e75a1(_0x4d13e0);});});})[_0x4945('0x2c')](function(){return new BPromise(function(_0x46a86a,_0x534253){zipdir(_0x10af40,{'saveTo':_0x1a512d},function(_0x343305,_0x52a453){if(_0x343305)return _0x534253(_0x343305);return _0x46a86a(_0x52a453);});})['then'](function(){return new BPromise(function(_0x33c30e,_0x1d6301){rimraf(_0x10af40,function(_0x171361){if(_0x171361)_0x1d6301(_0x171361);return _0x33c30e();});});})[_0x4945('0x2c')](function(){return _0x477224[_0x4945('0xd2')](_0x1a512d,_0x435455,function(_0x238310){if(_0x238310){console[_0x4945('0xe7')]('err',_0x238310);}else{fs[_0x4945('0xe8')](_0x1a512d);}});});});}else{return _0x477224[_0x4945('0x2d')](0xc8);}})['catch'](handleError(_0x477224,null));}; \ No newline at end of file +var _0x1608=['error','stack','name','Users','fullname','TagIds','Tags','forEach','push','MailInteraction','findOne','lastMsgText','trimStart','lastMsgBody','catch','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','text','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','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','QueryTypes','SELECT','clone','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','MailAccountId','toString','count','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.UserId','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','show','includeAll','include','options','create','params','describe','addMessage','body','omit','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','findAll','rows','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','get','mkdirSync','each','subject','headers','Bcc','basename','readFileSync','writeFileSync','message%d.eml','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x13ce0f,_0x354d4c){var _0x1beae8=function(_0x25a40b){while(--_0x25a40b){_0x13ce0f['push'](_0x13ce0f['shift']());}};_0x1beae8(++_0x354d4c);}(_0x1608,0xcb));var _0x8160=function(_0x18b954,_0x8f2ea4){_0x18b954=_0x18b954-0x0;var _0x27eb0b=_0x1608[_0x18b954];return _0x27eb0b;};'use strict';var pdf=require(_0x8160('0x0'));var emlformat=require(_0x8160('0x1'));var rimraf=require(_0x8160('0x2'));var zipdir=require(_0x8160('0x3'));var jsonpatch=require(_0x8160('0x4'));var rp=require('request-promise');var moment=require(_0x8160('0x5'));var BPromise=require(_0x8160('0x6'));var Mustache=require(_0x8160('0x7'));var util=require('util');var path=require(_0x8160('0x8'));var sox=require(_0x8160('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8160('0xa'));var squel=require(_0x8160('0xb'));var crypto=require(_0x8160('0xc'));var jsforce=require(_0x8160('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8160('0xe'));var querystring=require(_0x8160('0xf'));var Papa=require(_0x8160('0x10'));var htmlToText=require(_0x8160('0x11'));var Redis=require(_0x8160('0x12'));var authService=require(_0x8160('0x13'));var qs=require(_0x8160('0x14'));var as=require(_0x8160('0x15'));var hardwareService=require(_0x8160('0x16'));var logger=require(_0x8160('0x17'))(_0x8160('0x18'));var utils=require(_0x8160('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8160('0x1a'))['db'];config[_0x8160('0x1b')]=_[_0x8160('0x1c')](config['redis'],{'host':_0x8160('0x1d'),'port':0x18eb});var socket=require(_0x8160('0x1e'))(new Redis(config['redis']));require(_0x8160('0x1f'))[_0x8160('0x20')](socket);function respondWithStatusCode(_0x2ad9b0,_0x4d13cd){_0x4d13cd=_0x4d13cd||0xcc;return function(_0x4bbf79){if(_0x4bbf79){return _0x2ad9b0[_0x8160('0x21')](_0x4d13cd);}return _0x2ad9b0[_0x8160('0x22')](_0x4d13cd)[_0x8160('0x23')]();};}function respondWithResult(_0x3c9ea2,_0x4fdba8){_0x4fdba8=_0x4fdba8||0xc8;return function(_0x30a72b){if(_0x30a72b){return _0x3c9ea2[_0x8160('0x22')](_0x4fdba8)[_0x8160('0x24')](_0x30a72b);}};}function respondWithFilteredResult(_0x273c35,_0x283038){return function(_0xaca4ea){if(_0xaca4ea){var _0x330f62=_0xaca4ea['count'],_0x2e3ac7=_0x283038[_0x8160('0x25')],_0x52bcef=_0x283038[_0x8160('0x25')]+_0x283038[_0x8160('0x26')],_0x20688e;if(_0x52bcef>=_0x330f62){_0x52bcef=_0x330f62;_0x20688e=0xc8;}else{_0x20688e=0xce;}_0x273c35[_0x8160('0x22')](_0x20688e);return _0x273c35['set'](_0x8160('0x27'),_0x2e3ac7+'-'+_0x52bcef+'/'+_0x330f62)['json'](_0xaca4ea);}return null;};}function patchUpdates(_0x4c56dd){return function(_0x254bbf){try{jsonpatch[_0x8160('0x28')](_0x254bbf,_0x4c56dd,!![]);}catch(_0xa5c9af){return BPromise[_0x8160('0x29')](_0xa5c9af);}return _0x254bbf[_0x8160('0x2a')]();};}function saveUpdates(_0x355d64,_0x132ccd){return function(_0x419184){if(_0x419184){return _0x419184[_0x8160('0x2b')](_0x355d64)[_0x8160('0x2c')](function(_0x28ef80){return _0x28ef80;});}return null;};}function removeEntity(_0x41c87c,_0x34f423){return function(_0x24ee06){if(_0x24ee06){return _0x24ee06[_0x8160('0x2d')]()[_0x8160('0x2c')](function(){_0x41c87c['status'](0xcc)[_0x8160('0x23')]();});}};}function handleEntityNotFound(_0x4bc0c9,_0x4890a4){return function(_0x3cacd1){if(!_0x3cacd1){_0x4bc0c9[_0x8160('0x21')](0x194);}return _0x3cacd1;};}function handleError(_0x2cb406,_0x8117c2){_0x8117c2=_0x8117c2||0x1f4;return function(_0x381df8){logger[_0x8160('0x2e')](_0x381df8[_0x8160('0x2f')]);if(_0x381df8[_0x8160('0x30')]){delete _0x381df8[_0x8160('0x30')];}_0x2cb406[_0x8160('0x22')](_0x8117c2)['send'](_0x381df8);};}function getInteractionUsers(_0x3c01af,_0x5bbad9){return new BPromise(function(_0x7e5795,_0x27f724){try{if(_0x5bbad9[_0x3c01af['id']]){_0x3c01af[_0x8160('0x31')]=_['map'](_0x5bbad9[_0x3c01af['id']],function(_0x52a334){return{'id':_0x52a334['id'],'fullname':_0x52a334[_0x8160('0x32')]};});}}catch(_0x1ca54c){_0x27f724(_0x1ca54c);}_0x7e5795(_0x3c01af);});}function getInteractionTags(_0xa5c537,_0x2c050c){return new BPromise(function(_0x404999,_0x85d28d){try{if(_0xa5c537[_0x8160('0x33')]){_0xa5c537[_0x8160('0x34')]=[];_0xa5c537['TagIds']['split'](',')[_0x8160('0x35')](function(_0xcaac8a){_0xa5c537[_0x8160('0x34')][_0x8160('0x36')](_0x2c050c[_0xcaac8a]);});}delete _0xa5c537[_0x8160('0x33')];}catch(_0x2acab1){_0x85d28d(_0x2acab1);}_0x404999(_0xa5c537);});}function getLastMessageText(_0x166d32){return new BPromise(function(_0x4291e6,_0x1dd682){return db[_0x8160('0x37')][_0x8160('0x38')]({'where':{'id':_0x166d32['id']},'attributes':['lastMsgBody','lastMsgText'],'raw':!![]})[_0x8160('0x2c')](function(_0x469f8d){if(!_0x469f8d[_0x8160('0x39')]){_0x166d32['lastMsgText']=_[_0x8160('0x3a')](htmlToText['fromString'](_0x469f8d[_0x8160('0x3b')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x166d32[_0x8160('0x39')]=_0x469f8d[_0x8160('0x39')];}_0x4291e6(_0x166d32);})[_0x8160('0x3c')](function(_0x88135d){_0x1dd682(_0x88135d);});});}function updateMailInteraction(_0x436709,_0x2953a0,_0x1eba3e,_0x1a4122){return new BPromise(function(_0x1ebaae,_0x16ab7a){return getInteractionUsers(_0x436709,_0x1eba3e)['then'](function(_0x4d8eea){return getInteractionTags(_0x4d8eea,_0x2953a0);})[_0x8160('0x2c')](function(_0x3de65c){if(_0x1a4122){_0x1ebaae(getLastMessageText(_0x3de65c));}else{_0x1ebaae(_0x3de65c);}})[_0x8160('0x3c')](function(_0x1a4cac){_0x16ab7a(_0x1a4cac);});});}exports['index']=function(_0x582524,_0x1d9e2b){var _0x50fb8a={},_0x19aefc={},_0x4e5a4b={'count':0x0,'rows':[]};var _0x20fd8d=_[_0x8160('0x3d')](db[_0x8160('0x37')][_0x8160('0x3e')],function(_0x9c1547){return{'name':_0x9c1547[_0x8160('0x3f')],'type':_0x9c1547[_0x8160('0x40')][_0x8160('0x41')]};});_0x19aefc[_0x8160('0x42')]=_[_0x8160('0x3d')](_0x20fd8d,_0x8160('0x30'));_0x19aefc['query']=_['keys'](_0x582524[_0x8160('0x43')]);_0x19aefc[_0x8160('0x44')]=_[_0x8160('0x45')](_0x19aefc[_0x8160('0x42')],_0x19aefc[_0x8160('0x43')]);_0x50fb8a[_0x8160('0x46')]=_['intersection'](_0x19aefc['model'],qs[_0x8160('0x47')](_0x582524[_0x8160('0x43')][_0x8160('0x47')]));_0x50fb8a[_0x8160('0x46')]=_0x50fb8a[_0x8160('0x46')][_0x8160('0x48')]?_0x50fb8a['attributes']:_0x19aefc[_0x8160('0x42')];if(!_0x582524['query'][_0x8160('0x49')](_0x8160('0x4a'))){_0x50fb8a[_0x8160('0x26')]=qs[_0x8160('0x26')](_0x582524[_0x8160('0x43')]['limit']);_0x50fb8a[_0x8160('0x25')]=qs[_0x8160('0x25')](_0x582524[_0x8160('0x43')][_0x8160('0x25')]);}_0x50fb8a['order']=qs[_0x8160('0x4b')](_0x582524[_0x8160('0x43')][_0x8160('0x4b')]);_0x50fb8a[_0x8160('0x4c')]=qs[_0x8160('0x44')](_[_0x8160('0x4d')](_0x582524[_0x8160('0x43')],_0x19aefc[_0x8160('0x44')]),_0x20fd8d);var _0x111938=[];var _0x487454=squel[_0x8160('0x4e')]()['field']('id')[_0x8160('0x4f')](_0x8160('0x30'))[_0x8160('0x4f')](_0x8160('0x50'))['from'](_0x8160('0x51'));var _0x52d021=squel[_0x8160('0x4e')]()[_0x8160('0x4f')](_0x8160('0x52'))[_0x8160('0x4f')](_0x8160('0x53'))[_0x8160('0x4f')]('ui.MailInteractionId')['from'](_0x8160('0x54'),'ui')[_0x8160('0x55')]('users','u',_0x8160('0x56'));var _0x4ea059=squel[_0x8160('0x4e')]()[_0x8160('0x57')]('mail_interactions','i')[_0x8160('0x55')](_0x8160('0x58'),'c',_0x8160('0x59'))[_0x8160('0x55')](_0x8160('0x5a'),'o',_0x8160('0x5b'))['left_join'](_0x8160('0x5c'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0x8160('0x5d'),'me',_0x8160('0x5e'))[_0x8160('0x55')](_0x8160('0x5f'),'it','it.MailInteractionId\x20=\x20i.id')[_0x8160('0x55')](_0x8160('0x51'),'t',_0x8160('0x60'));var _0x25aec2=squel['expr']();var _0x3f1976=[];var _0x189b3b=squel[_0x8160('0x61')]();var _0x55ebaa;if(_0x582524[_0x8160('0x43')][_0x8160('0x62')]){_0x55ebaa=as[_0x8160('0x63')](_0x582524[_0x8160('0x43')]['search']);var _0x1471e7=_0x55ebaa[_0x8160('0x64')];for(var _0x404488=0x0;_0x404488<_0x55ebaa['conditions'][_0x8160('0x48')];_0x404488++){var _0x11cfa9=_0x55ebaa['conditions'][_0x404488];var _0x34d4ac='i';var _0x31cc1f=_[_0x8160('0x65')](_0x20fd8d,[_0x8160('0x30'),_0x11cfa9[_0x8160('0x4f')]]);if(!_0x31cc1f){switch(_0x11cfa9['field']){case _0x8160('0x66'):if(_0x11cfa9[_0x8160('0x67')]==0x1){_0x4ea059['having']('`'+_0x11cfa9[_0x8160('0x4f')]+'`\x20=\x200');}else{_0x4ea059[_0x8160('0x68')]('`'+_0x11cfa9[_0x8160('0x4f')]+_0x8160('0x69'));}break;case _0x8160('0x6a'):if(_0x11cfa9[_0x8160('0x6b')]===_0x8160('0x6c')){if(_0x11cfa9[_0x8160('0x67')][_0x8160('0x6d')]('\x20')[_0x8160('0x48')]>0x1){_0x25aec2[_0x1471e7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8160('0x6e')](_0x11cfa9[_0x8160('0x67')]),null);}else{var _0x57eb86='%'+_0x11cfa9['value']+'%';_0x25aec2[_0x1471e7](_0x8160('0x6f'),_0x57eb86,_0x57eb86,_0x57eb86);}}else{_0x31cc1f=_[_0x8160('0x65')](_0x20fd8d,[_0x8160('0x30'),'ContactId']);_0x11cfa9[_0x8160('0x4f')]='ContactId';_0x25eced=as['buildExpression'](_0x34d4ac,_0x31cc1f[_0x8160('0x40')],_0x11cfa9);_0x25aec2[_0x1471e7](_0x25eced[_0x8160('0x70')],_0x25eced['value']['start'],_0x25eced[_0x8160('0x67')]['end']);}break;case'Tag':var _0x4a2f12=_0x11cfa9[_0x8160('0x67')][_0x8160('0x6d')](',')[_0x8160('0x3d')](function(_0x108d93){return Number(_0x108d93);});_0x4a2f12[_0x8160('0x35')](function(_0x332a3d){_0x189b3b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x332a3d+',%');});_0x3f1976=_[_0x8160('0x71')](_0x3f1976,_0x4a2f12);break;case _0x8160('0x72'):if(_0x11cfa9[_0x8160('0x6b')]==='$substring'){_0x25aec2[_0x1471e7](_0x8160('0x73'),'%'+_0x11cfa9['value']+'%',null);}else{_0x31cc1f=_[_0x8160('0x65')](_0x20fd8d,[_0x8160('0x30'),_0x8160('0x74')]);_0x11cfa9[_0x8160('0x4f')]=_0x8160('0x74');_0x25eced=as[_0x8160('0x75')](_0x34d4ac,_0x31cc1f[_0x8160('0x40')],_0x11cfa9);_0x25aec2[_0x1471e7](_0x25eced['text'],_0x25eced[_0x8160('0x67')]['start'],_0x25eced[_0x8160('0x67')]['end']);}break;case'plainBody':_0x25eced=as[_0x8160('0x75')]('me',null,_0x11cfa9);_0x25aec2[_0x1471e7](_0x25eced[_0x8160('0x70')],_0x25eced[_0x8160('0x67')]['start'],_0x25eced[_0x8160('0x67')]['end']);break;}}else{var _0x25eced=as[_0x8160('0x75')](_0x34d4ac,_0x31cc1f['type'],_0x11cfa9);_0x25aec2[_0x1471e7](_0x25eced[_0x8160('0x70')],_0x25eced['value']['start'],_0x25eced[_0x8160('0x67')][_0x8160('0x23')]);}}}else{var _0x1fabb8=_(_0x582524[_0x8160('0x43')])[_0x8160('0x76')]()['map'](function(_0x4ec3e1){return _[_0x8160('0x77')](_0x20fd8d,['name',_0x4ec3e1])?_0x4ec3e1:undefined;})[_0x8160('0x78')]()[_0x8160('0x67')]();if(!_['isEmpty'](_0x1fabb8)){_0x1fabb8[_0x8160('0x35')](function(_0xdbd0c1){if(_0xdbd0c1==='MailAccountId'){_0x4ea059['where'](_0x8160('0x79'),[][_0x8160('0x7a')](_0x582524[_0x8160('0x43')][_0xdbd0c1]));}else if(_0xdbd0c1===_0x8160('0x7b')){var _0x13ae5d=JSON[_0x8160('0x7c')](_0x582524[_0x8160('0x43')][_0xdbd0c1])[_0x8160('0x7d')];var _0x7e3ace=JSON['parse'](_0x582524[_0x8160('0x43')][_0xdbd0c1])[_0x8160('0x7e')];_0x4ea059['where'](_0x8160('0x7f'),_0x13ae5d,_0x7e3ace);}else{if(_0x582524[_0x8160('0x43')][_0xdbd0c1]===_0x8160('0x80')){_0x4ea059[_0x8160('0x4c')]('i.'+_0xdbd0c1+'\x20IS\x20NULL');}else{_0x4ea059[_0x8160('0x4c')]('i.'+_0xdbd0c1+_0x8160('0x81'),_0x582524[_0x8160('0x43')][_0xdbd0c1]);}}});}if(_0x582524['query']['read']){if(_0x582524['query']['read']==0x1){_0x4ea059[_0x8160('0x68')]('`unreadMessages`\x20=\x200');}else{_0x4ea059['having'](_0x8160('0x82'));}}if(_0x582524[_0x8160('0x43')][_0x8160('0x83')]){_0x3f1976=_[_0x8160('0x84')](_0x582524[_0x8160('0x43')][_0x8160('0x83')])?_0x582524['query'][_0x8160('0x83')]:new Array(_0x582524[_0x8160('0x43')][_0x8160('0x83')]);_0x3f1976[_0x8160('0x35')](function(_0x5e3715){_0x189b3b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5e3715+',%');});}if(_0x582524[_0x8160('0x43')][_0x8160('0x85')]){var _0x3f031b=_0x582524[_0x8160('0x43')][_0x8160('0x85')][_0x8160('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8160('0x87')](_0x3f031b)){_0x25aec2['or'](_0x8160('0x88'),_0x3f031b+'%');}else if(qs[_0x8160('0x89')](_0x3f031b)){_0x25aec2['or'](_0x8160('0x8a'),_0x3f031b+'%');}else{_0x25aec2['or'](_0x8160('0x8b'),qs['getFullTextValue'](_0x3f031b))['or'](_0x8160('0x8c'),qs[_0x8160('0x6e')](_0x3f031b));}}}_0x4ea059[_0x8160('0x4c')](_0x25aec2);_0x4ea059[_0x8160('0x8d')](_0x8160('0x8e'));var _0x37a873={'type':db['Sequelize'][_0x8160('0x8f')][_0x8160('0x90')],'raw':!![]};var _0x38f6f2=_0x4ea059[_0x8160('0x91')]();_0x38f6f2[_0x8160('0x4f')](_0x8160('0x8e'));_0x38f6f2[_0x8160('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8160('0x66'));if(_0x50fb8a[_0x8160('0x92')]){_0x50fb8a['order'][_0x8160('0x35')](function(_0x454459){var _0x154d8a=_0x454459[0x0]==='contactName'?_0x454459[0x0]:'i.'+_0x454459[0x0];_0x4ea059[_0x8160('0x92')](_0x154d8a,_0x454459[0x1]===_0x8160('0x93')?![]:!![]);});}if(!_[_0x8160('0x94')](_0x3f1976)){_0x4ea059[_0x8160('0x68')](_0x189b3b);_0x38f6f2[_0x8160('0x4c')](_0x8160('0x95'),_0x3f1976);}BPromise[_0x8160('0x96')]()[_0x8160('0x2c')](function(){if(!_0x55ebaa){if(_0x582524['query']['MailAccountId']||_0x582524['query'][_0x8160('0x97')])return;_0x38f6f2[_0x8160('0x4c')](_0x8160('0x98'));_0x4ea059[_0x8160('0x4c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x582524['user'][_0x8160('0x99')]!==_0x8160('0x9a'))return;return _0x582524[_0x8160('0x9b')][_0x8160('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3c2d5c){if(_['isEmpty'](_0x3c2d5c)){_0x38f6f2[_0x8160('0x4c')]('i.MailAccountId\x20IS\x20NULL');_0x4ea059[_0x8160('0x4c')]('i.MailAccountId\x20IS\x20NULL');}else{_0x38f6f2[_0x8160('0x4c')](_0x8160('0x79'),_['map'](_0x3c2d5c,'id'));_0x4ea059[_0x8160('0x4c')](_0x8160('0x79'),_[_0x8160('0x3d')](_0x3c2d5c,'id'));}});})[_0x8160('0x2c')](function(){if(_0x582524['user'][_0x8160('0x99')]===_0x8160('0x9a')&&!_0x55ebaa&&!_0x582524[_0x8160('0x43')][_0x8160('0x9d')])return[];return db['sequelize']['query'](_0x38f6f2[_0x8160('0x9e')](),_0x37a873);})[_0x8160('0x2c')](function(_0x10b21c){_0x4e5a4b[_0x8160('0x9f')]=_0x10b21c['length'];if(_0x4e5a4b[_0x8160('0x9f')]===0x0)return[];return db[_0x8160('0xa0')]['query'](_0x487454[_0x8160('0x9e')](),_0x37a873)[_0x8160('0x2c')](function(_0x55dc1c){_0x111938=_[_0x8160('0xa1')](_0x55dc1c,'id');_0x37a873=_[_0x8160('0xa2')](_0x37a873,{'model':db[_0x8160('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x582524[_0x8160('0x43')][_0x8160('0x47')]){_0x50fb8a[_0x8160('0x46')][_0x8160('0x35')](function(_0x1d254a){_0x4ea059[_0x8160('0x4f')]('i.'+_0x1d254a);});}else{_0x4ea059['field'](_0x8160('0xa3'),_0x8160('0x66'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xa4'),_0x8160('0xa5'));_0x4ea059['field'](_0x8160('0xa6'),'Account.mandatoryDisposition');_0x4ea059[_0x8160('0x4f')](_0x8160('0xa7'),_0x8160('0xa8'));_0x4ea059[_0x8160('0x4f')](_0x8160('0x8e'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xa9'));_0x4ea059['field'](_0x8160('0xaa'));_0x4ea059[_0x8160('0x4f')]('i.closed');_0x4ea059[_0x8160('0x4f')]('i.closedAt');_0x4ea059['field'](_0x8160('0xab'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xac'));_0x4ea059[_0x8160('0x4f')]('i.lastMsgDirection');_0x4ea059['field'](_0x8160('0xad'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xae'));_0x4ea059[_0x8160('0x4f')]('i.secondDisposition');_0x4ea059[_0x8160('0x4f')](_0x8160('0xaf'));_0x4ea059['field'](_0x8160('0xb0'));_0x4ea059['field'](_0x8160('0xb1'));_0x4ea059[_0x8160('0x4f')]('i.ContactId');_0x4ea059[_0x8160('0x4f')]('i.MailAccountId');_0x4ea059[_0x8160('0x4f')](_0x8160('0xb2'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xb3'),'Contact.firstName');_0x4ea059['field'](_0x8160('0xb4'),_0x8160('0xb5'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xb6'),_0x8160('0xb7'));_0x4ea059['field'](_0x8160('0xb8'),_0x8160('0xb9'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xba'),_0x8160('0xbb'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xbc'),_0x8160('0xbd'));_0x4ea059['field'](_0x8160('0xbe'),_0x8160('0xbf'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xc0'),_0x8160('0xc1'));_0x4ea059[_0x8160('0x4f')](_0x8160('0xc2'),_0x8160('0x33'));}if(_0x50fb8a[_0x8160('0x26')])_0x4ea059[_0x8160('0x26')](_0x50fb8a[_0x8160('0x26')]);if(_0x50fb8a[_0x8160('0x25')])_0x4ea059[_0x8160('0x25')](_0x50fb8a[_0x8160('0x25')]);return db[_0x8160('0xa0')]['query'](_0x4ea059[_0x8160('0x9e')](),_0x37a873);})[_0x8160('0x2c')](function(_0x278fcb){_0x52d021['where'](_0x8160('0xc3'),_[_0x8160('0x3d')](_0x278fcb,'id'));return db[_0x8160('0xa0')][_0x8160('0x43')](_0x52d021[_0x8160('0x9e')](),_0x37a873)['then'](function(_0x142bae){var _0x2d7886=_[_0x8160('0xc4')](_0x142bae,_0x8160('0xc5'));var _0xa3cf9=[];return db[_0x8160('0xc6')][_0x8160('0x38')]({'attributes':[_0x8160('0xc7')],'raw':!![]})[_0x8160('0x2c')](function(_0x40c10f){var _0x23fa4a=_0x40c10f['enableEmailPreview'];_0x278fcb['forEach'](function(_0x10c0cb){_0xa3cf9[_0x8160('0x36')](updateMailInteraction(_0x10c0cb,_0x111938,_0x2d7886,_0x23fa4a));});return BPromise[_0x8160('0xc8')](_0xa3cf9);});});});})[_0x8160('0x2c')](function(_0x3c4536){_0x4e5a4b['rows']=_0x3c4536;return _0x4e5a4b;})[_0x8160('0x2c')](respondWithFilteredResult(_0x1d9e2b,_0x50fb8a))[_0x8160('0x3c')](handleError(_0x1d9e2b,null));};exports[_0x8160('0xc9')]=function(_0x54530f,_0x15d524){var _0x12edb7={'raw':![],'where':{'id':_0x54530f['params']['id']}},_0x2d60e5={};_0x2d60e5[_0x8160('0x42')]=_[_0x8160('0x76')](db[_0x8160('0x37')][_0x8160('0x3e')]);_0x2d60e5[_0x8160('0x43')]=_[_0x8160('0x76')](_0x54530f[_0x8160('0x43')]);_0x2d60e5[_0x8160('0x44')]=_[_0x8160('0x45')](_0x2d60e5[_0x8160('0x42')],_0x2d60e5[_0x8160('0x43')]);_0x12edb7[_0x8160('0x46')]=_[_0x8160('0x45')](_0x2d60e5[_0x8160('0x42')],qs[_0x8160('0x47')](_0x54530f[_0x8160('0x43')][_0x8160('0x47')]));_0x12edb7[_0x8160('0x46')]=_0x12edb7['attributes'][_0x8160('0x48')]?_0x12edb7[_0x8160('0x46')]:_0x2d60e5['model'];if(_0x54530f[_0x8160('0x43')][_0x8160('0xca')]){_0x12edb7[_0x8160('0xcb')]=[{'all':!![]}];}_0x12edb7=_[_0x8160('0xa2')]({},_0x12edb7,_0x54530f[_0x8160('0xcc')]);return db['MailInteraction'][_0x8160('0x65')](_0x12edb7)[_0x8160('0x2c')](handleEntityNotFound(_0x15d524,null))[_0x8160('0x2c')](respondWithResult(_0x15d524,null))[_0x8160('0x3c')](handleError(_0x15d524,null));};exports['create']=function(_0xd4d171,_0x4470d8){return db[_0x8160('0x37')][_0x8160('0xcd')](_0xd4d171['body'],{})[_0x8160('0x2c')](respondWithResult(_0x4470d8,0xc9))[_0x8160('0x3c')](handleError(_0x4470d8,null));};exports['update']=function(_0x3ec4cd,_0x56b806){if(_0x3ec4cd['body']['id']){delete _0x3ec4cd['body']['id'];}return db[_0x8160('0x37')][_0x8160('0x65')]({'where':{'id':_0x3ec4cd[_0x8160('0xce')]['id']}})[_0x8160('0x2c')](handleEntityNotFound(_0x56b806,null))[_0x8160('0x2c')](saveUpdates(_0x3ec4cd['body'],null))[_0x8160('0x2c')](respondWithResult(_0x56b806,null))['catch'](handleError(_0x56b806,null));};exports[_0x8160('0x2d')]=function(_0x43b139,_0x436620){return db[_0x8160('0x37')][_0x8160('0x65')]({'where':{'id':_0x43b139[_0x8160('0xce')]['id']}})[_0x8160('0x2c')](handleEntityNotFound(_0x436620,null))[_0x8160('0x2c')](removeEntity(_0x436620,null))['catch'](handleError(_0x436620,null));};exports[_0x8160('0xcf')]=function(_0x504410,_0xd9417e){return db[_0x8160('0x37')][_0x8160('0xcf')]()[_0x8160('0x2c')](respondWithResult(_0xd9417e,null))[_0x8160('0x3c')](handleError(_0xd9417e,null));};exports[_0x8160('0xd0')]=function(_0x4b31cb,_0x4b4207,_0x47a9b3){return db['MailMessage'][_0x8160('0x65')]({'where':{'id':_0x4b31cb[_0x8160('0xce')]['id']}})['then'](handleEntityNotFound(_0x4b4207,null))[_0x8160('0x2c')](function(_0xfff0fb){if(_0xfff0fb){return _0xfff0fb['addMessage'](_0x4b31cb[_0x8160('0xd1')]['ids'],_[_0x8160('0xd2')](_0x4b31cb['body'],[_0x8160('0xd3'),'id'])||{});}})[_0x8160('0x2c')](respondWithResult(_0x4b4207,null))[_0x8160('0x3c')](handleError(_0x4b4207,null));};exports[_0x8160('0xd4')]=function(_0xe95a45,_0x3290fb,_0xc256b2){var _0x4b3a16={'raw':![],'where':{}};var _0x47c40d={};var _0x40359c={'count':0x0,'rows':[]};return db[_0x8160('0x37')][_0x8160('0x38')]({'where':{'id':_0xe95a45[_0x8160('0xce')]['id']}})[_0x8160('0x2c')](handleEntityNotFound(_0x3290fb,null))[_0x8160('0x2c')](function(_0x237905){if(_0x237905){_0x47c40d[_0x8160('0x42')]=_['keys'](db['MailMessage'][_0x8160('0x3e')]);_0x47c40d[_0x8160('0x43')]=_[_0x8160('0x76')](_0xe95a45[_0x8160('0x43')]);_0x47c40d[_0x8160('0x44')]=_[_0x8160('0x45')](_0x47c40d[_0x8160('0x42')],_0x47c40d[_0x8160('0x43')]);_0x4b3a16['attributes']=_[_0x8160('0x45')](_0x47c40d[_0x8160('0x42')],qs['fields'](_0xe95a45['query'][_0x8160('0x47')]));_0x4b3a16[_0x8160('0x46')]=_0x4b3a16[_0x8160('0x46')]['length']?_0x4b3a16[_0x8160('0x46')]:_0x47c40d[_0x8160('0x42')];if(!_0xe95a45[_0x8160('0x43')][_0x8160('0x49')]('nolimit')){_0x4b3a16[_0x8160('0x26')]=qs[_0x8160('0x26')](_0xe95a45[_0x8160('0x43')][_0x8160('0x26')]);_0x4b3a16['offset']=qs[_0x8160('0x25')](_0xe95a45[_0x8160('0x43')][_0x8160('0x25')]);}_0x4b3a16[_0x8160('0x92')]=qs[_0x8160('0x4b')](_0xe95a45[_0x8160('0x43')][_0x8160('0x4b')]);_0x4b3a16[_0x8160('0x4c')]=qs[_0x8160('0x44')](_['pick'](_0xe95a45['query'],_0x47c40d['filters']));_0x4b3a16[_0x8160('0x4c')]['MailInteractionId']=_0x237905['id'];if(_0xe95a45[_0x8160('0x43')][_0x8160('0x85')]){_0x4b3a16[_0x8160('0x4c')]=_[_0x8160('0xa2')](_0x4b3a16['where'],{'$or':_['map'](_0x4b3a16[_0x8160('0x46')],function(_0x391322){var _0xc91a6e={};_0xc91a6e[_0x391322]={'$like':'%'+_0xe95a45[_0x8160('0x43')][_0x8160('0x85')]+'%'};return _0xc91a6e;})});}if(_0xe95a45['query'][_0x8160('0x7d')]){var _0x4bad25=_0xe95a45[_0x8160('0x43')][_0x8160('0x7d')][_0x8160('0x6d')](',');var _0x51959f={};_0x51959f[_0x4bad25[0x0]]={'$gte':moment(_0x4bad25[0x1])[_0x8160('0xd5')](_0x8160('0xd6'))};_0x4b3a16[_0x8160('0x4c')]=_[_0x8160('0xa2')](_0x4b3a16[_0x8160('0x4c')],_0x51959f);}_0x4b3a16=_[_0x8160('0xa2')]({},_0x4b3a16,_0xe95a45[_0x8160('0xcc')]);return db[_0x8160('0xd7')]['count']({'where':_0x4b3a16['where']})[_0x8160('0x2c')](function(_0x131ffc){_0x40359c['count']=_0x131ffc;if(_0xe95a45[_0x8160('0x43')]['includeAll']){_0x4b3a16[_0x8160('0xcb')]=[{'all':!![]}];}return db['MailMessage'][_0x8160('0xd8')](_0x4b3a16);})['then'](function(_0x4f526d){_0x40359c[_0x8160('0xd9')]=_0x4f526d;return _0x40359c;});}})['then'](respondWithFilteredResult(_0x3290fb,_0x4b3a16))[_0x8160('0x3c')](handleError(_0x3290fb,null));};exports[_0x8160('0xda')]=function(_0x258c16,_0x3eda73,_0x1d6b12){return db['MailInteraction'][_0x8160('0x65')]({'where':{'id':_0x258c16[_0x8160('0xce')]['id']}})[_0x8160('0x2c')](handleEntityNotFound(_0x3eda73,null))[_0x8160('0x2c')](function(_0x3d9b3f){if(_0x3d9b3f){return _0x3d9b3f[_0x8160('0xdb')](_0x258c16[_0x8160('0xd1')][_0x8160('0xd3')],_[_0x8160('0xd2')](_0x258c16['body'],['ids','id'])||{})[_0x8160('0xdc')](function(){return db[_0x8160('0xdd')][_0x8160('0xd8')]({'attributes':['id',_0x8160('0x30'),'color'],'where':{'id':_0x258c16[_0x8160('0xd1')][_0x8160('0xd3')]}});})[_0x8160('0x2c')](function(_0x1408f8){socket[_0x8160('0xde')](_0x8160('0xdf'),{'id':Number(_0x258c16[_0x8160('0xce')]['id']),'tags':_0x1408f8||[]});return{'id':Number(_0x258c16['params']['id']),'tags':_0x1408f8||[]};});}})['then'](respondWithResult(_0x3eda73,null))[_0x8160('0x3c')](handleError(_0x3eda73,null));};exports[_0x8160('0xe0')]=function(_0x247375,_0x4ebd8b,_0x5b4a5a){return db[_0x8160('0x37')]['find']({'where':{'id':_0x247375[_0x8160('0xce')]['id']}})[_0x8160('0x2c')](handleEntityNotFound(_0x4ebd8b,null))['then'](function(_0x29a8af){if(_0x29a8af){return _0x29a8af['removeTags'](_0x247375[_0x8160('0x43')][_0x8160('0xd3')]);}})[_0x8160('0x2c')](respondWithStatusCode(_0x4ebd8b,null))['catch'](handleError(_0x4ebd8b,null));};exports[_0x8160('0xe1')]=function(_0x673f08,_0x52ca2b){var _0x42af95=moment()[_0x8160('0xe2')]()[_0x8160('0x9e')]();var _0x187f00=path[_0x8160('0xe3')](config['root'],_0x8160('0xe4'),'files',_0x8160('0xe5'));var _0x106a62=path[_0x8160('0xe3')](config[_0x8160('0xe6')],_0x8160('0xe4'),_0x8160('0xe7'),'attachments');var _0x22eec5=path[_0x8160('0xe3')](_0x187f00,_0x42af95);var _0x55a055=util[_0x8160('0xd5')](_0x8160('0xe8'),_0x673f08['params']['id'],_0x42af95);var _0x375194=path[_0x8160('0xe3')](_0x187f00,_0x55a055);var _0x550c80=[];if(_0x673f08['query']['attachments']){_0x550c80[_0x8160('0x36')]({'model':db[_0x8160('0xe9')],'as':_0x8160('0xea'),'raw':!![]});}var _0x4c5735=[{'model':db[_0x8160('0xd7')],'as':_0x8160('0xeb'),'attributes':['id',_0x8160('0xd1'),_0x8160('0x57'),'to','cc',_0x8160('0xec'),'subject','createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x550c80}];return db[_0x8160('0x37')][_0x8160('0x65')]({'where':{'id':_0x673f08[_0x8160('0xce')]['id']},'include':_0x4c5735})[_0x8160('0x2c')](handleEntityNotFound(_0x52ca2b,null))[_0x8160('0x2c')](function(_0x596410){if(_0x596410&&_0x596410['Messages']){var _0x482bce=_0x596410[_0x8160('0xed')]({'plain':!![]});fs[_0x8160('0xee')](_0x22eec5);return BPromise[_0x8160('0xef')](_0x482bce['Messages'],function(_0xf5c457,_0x385d80){var _0x2b4814={'from':_0xf5c457[_0x8160('0x57')],'to':_0xf5c457['to'],'subject':_0xf5c457[_0x8160('0xf0')],'html':_0xf5c457[_0x8160('0xd1')],'headers':{'Date':moment(_0xf5c457['createdAt'])[_0x8160('0xd5')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xf5c457['cc']){_0x2b4814[_0x8160('0xf1')]['Cc']=_0xf5c457['cc'];}if(_0xf5c457[_0x8160('0xec')]){_0x2b4814[_0x8160('0xf1')][_0x8160('0xf2')]=_0xf5c457[_0x8160('0xec')];}return new BPromise(function(_0x5e78b7,_0x360c1e){if(_0xf5c457[_0x8160('0xea')]){for(var _0x2d36da=0x0;_0x2d36da<_0xf5c457[_0x8160('0xea')][_0x8160('0x48')];_0x2d36da++){var _0x40a234=_0xf5c457[_0x8160('0xea')][_0x2d36da];var _0x299f0e=path['join'](_0x106a62,_0x40a234[_0x8160('0xf3')]);if(fs['existsSync'](_0x299f0e)){_0x2b4814['attachments'][_0x8160('0x36')]({'name':_0x40a234['name'],'contentType':_0x40a234['type'],'data':fs[_0x8160('0xf4')](_0x299f0e)});}}}emlformat['build'](_0x2b4814,function(_0x682a2a,_0x4f2873){if(_0x682a2a)return _0x360c1e(_0x682a2a);fs[_0x8160('0xf5')](path[_0x8160('0xe3')](_0x22eec5,util[_0x8160('0xd5')](_0x8160('0xf6'),_0x385d80)),_0x4f2873);return _0x5e78b7(_0x4f2873);});});})[_0x8160('0x2c')](function(){return new BPromise(function(_0x21db6d,_0x7fb74b){zipdir(_0x22eec5,{'saveTo':_0x375194},function(_0x50d373,_0x4adb49){if(_0x50d373)return _0x7fb74b(_0x50d373);return _0x21db6d(_0x4adb49);});})[_0x8160('0x2c')](function(){return new BPromise(function(_0x5a34d3,_0x2917e2){rimraf(_0x22eec5,function(_0x377aad){if(_0x377aad)_0x2917e2(_0x377aad);return _0x5a34d3();});});})[_0x8160('0x2c')](function(){return _0x52ca2b[_0x8160('0xe1')](_0x375194,_0x55a055,function(_0x2405ad){if(_0x2405ad){console[_0x8160('0xf7')](_0x8160('0xf8'),_0x2405ad);}else{fs['unlinkSync'](_0x375194);}});});});}else{return _0x52ca2b[_0x8160('0x21')](0xc8);}})[_0x8160('0x3c')](handleError(_0x52ca2b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 65a34c6..8f8e2a0 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 _0x98e3=['update','remove','then','setDataValue','Users','map','findAll','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x4ea44b,_0x546b89){var _0x418cc9=function(_0x1eb1e5){while(--_0x1eb1e5){_0x4ea44b['push'](_0x4ea44b['shift']());}};_0x418cc9(++_0x546b89);}(_0x98e3,0xb3));var _0x398e=function(_0x32390a,_0x430c8c){_0x32390a=_0x32390a-0x0;var _0x525768=_0x98e3[_0x32390a];return _0x525768;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x398e('0x0'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x398e('0x1')](0x0);var events={'afterCreate':_0x398e('0x2'),'afterUpdate':_0x398e('0x3'),'afterDestroy':_0x398e('0x4')};function emitEvent(_0x465d98){return function(_0x39adea,_0x5b3d48,_0x460a5e){_0x39adea['getUsers']({'attributes':['id'],'raw':!![]})[_0x398e('0x5')](function(_0x494bc0){_0x39adea[_0x398e('0x6')](_0x398e('0x7'),_0x494bc0[_0x398e('0x8')](function(_0x36eb21){return{'id':_0x36eb21['id']};}));return MailMessage[_0x398e('0x9')]({'where':{'MailInteractionId':_0x39adea['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1a3cde){_0x39adea[_0x398e('0x6')]('unreadMessages',_0x1a3cde['length']);MailInteractionEvents[_0x398e('0xa')](_0x465d98+':'+_0x39adea['id'],_0x39adea);MailInteractionEvents[_0x398e('0xa')](_0x465d98,_0x39adea);_0x460a5e(null);})['catch'](_0x460a5e(null));};}for(var e in events){if(events[_0x398e('0xb')](e)){var event=events[e];MailInteraction[_0x398e('0xc')](e,emitEvent(event));}}module[_0x398e('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0xd912=['hook','events','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0xab8149,_0x23c7d7){var _0x383267=function(_0x1cf656){while(--_0x1cf656){_0xab8149['push'](_0xab8149['shift']());}};_0x383267(++_0x23c7d7);}(_0xd912,0x1dd));var _0x2d91=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd912[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x2d91('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x2d91('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x2d91('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2d91('0x3')](0x0);var events={'afterCreate':_0x2d91('0x4'),'afterUpdate':_0x2d91('0x5'),'afterDestroy':_0x2d91('0x6')};function emitEvent(_0x46335c){return function(_0x17382f,_0x30446e,_0x116f93){_0x17382f[_0x2d91('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1c754a){_0x17382f[_0x2d91('0x8')]('Users',_0x1c754a[_0x2d91('0x9')](function(_0x23d47d){return{'id':_0x23d47d['id']};}));return MailMessage[_0x2d91('0xa')]({'where':{'MailInteractionId':_0x17382f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d91('0xb')](function(_0x1d6d92){_0x17382f['setDataValue'](_0x2d91('0xc'),_0x1d6d92[_0x2d91('0xd')]);MailInteractionEvents['emit'](_0x46335c+':'+_0x17382f['id'],_0x17382f);MailInteractionEvents[_0x2d91('0xe')](_0x46335c,_0x17382f);_0x116f93(null);})[_0x2d91('0xf')](_0x116f93(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x2d91('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f0ec3cf..66013b2 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 _0x95b9=['models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95b9,0x10c));var _0x995b=function(_0x4e1596,_0x2ddba7){_0x4e1596=_0x4e1596-0x0;var _0x1016aa=_0x95b9[_0x4e1596];return _0x1016aa;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var logger=require('../../config/logger')(_0x995b('0x2'));var moment=require('moment');var BPromise=require(_0x995b('0x3'));var rp=require(_0x995b('0x4'));var fs=require('fs');var path=require(_0x995b('0x5'));var rimraf=require(_0x995b('0x6'));var config=require(_0x995b('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x995b('0x8')]=function(_0x402c63,_0x473daf){return _0x402c63[_0x995b('0x9')](_0x995b('0xa'),attributes,{'tableName':_0x995b('0xb'),'paranoid':![],'indexes':[{'name':_0x995b('0xc'),'fields':[_0x995b('0xd'),'to'],'type':_0x995b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x140822,_0x6893b0,_0x2a38eb){if(_0x140822[_0x995b('0xf')]){_0x140822[_0x995b('0x10')]=moment()['format'](_0x995b('0x11'));}if(_0x140822[_0x995b('0x12')]){_0x140822[_0x995b('0x13')]=moment()[_0x995b('0x14')](_0x995b('0x11'));}_0x2a38eb(null,_0x6893b0);},'beforeUpdate':function(_0x482922,_0x23ba85,_0x50beda){if(_0x482922[_0x995b('0x15')](_0x995b('0xf'))){_0x482922[_0x995b('0x10')]=_0x482922[_0x995b('0xf')]?moment()[_0x995b('0x14')](_0x995b('0x11')):null;}if(_0x482922[_0x995b('0x15')](_0x995b('0x12'))){_0x482922[_0x995b('0x13')]=moment()[_0x995b('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x482922[_0x995b('0xf')]=null;_0x482922['substatusAt']=null;}_0x50beda(null,_0x482922);},'afterUpdate':function(_0x24549e,_0x2cd604,_0x4f1195){var _0x5a5e70=_0x402c63[_0x995b('0x16')];var _0x5d6c0f=_0x24549e[_0x995b('0x17')]({'plain':!![]});if(_0x5d6c0f[_0x995b('0x12')]){return _0x5a5e70[_0x995b('0x18')][_0x995b('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5d6c0f['id']}})[_0x995b('0x1a')](function(){_0x4f1195();})['catch'](function(_0x3b54de){_0x4f1195(_0x3b54de);});}else{_0x4f1195();}}},'charset':_0x995b('0x1b'),'collate':_0x995b('0x1c')});}; \ No newline at end of file +var _0xc034=['./mailInteraction.attributes','exports','define','MailInteraction','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc034,0x170));var _0x4c03=function(_0x5bc8de,_0x404482){_0x5bc8de=_0x5bc8de-0x0;var _0x2c620b=_0xc034[_0x5bc8de];return _0x2c620b;};'use strict';var _=require(_0x4c03('0x0'));var util=require('util');var logger=require(_0x4c03('0x1'))(_0x4c03('0x2'));var moment=require(_0x4c03('0x3'));var BPromise=require(_0x4c03('0x4'));var rp=require(_0x4c03('0x5'));var fs=require('fs');var path=require(_0x4c03('0x6'));var rimraf=require(_0x4c03('0x7'));var config=require(_0x4c03('0x8'));var attributes=require(_0x4c03('0x9'));module[_0x4c03('0xa')]=function(_0x3944f1,_0x4c5c6d){return _0x3944f1[_0x4c03('0xb')](_0x4c03('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x4c03('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3bf92f,_0x515b03,_0x5db9d9){if(_0x3bf92f['substatus']){_0x3bf92f[_0x4c03('0xe')]=moment()[_0x4c03('0xf')](_0x4c03('0x10'));}if(_0x3bf92f[_0x4c03('0x11')]){_0x3bf92f[_0x4c03('0x12')]=moment()[_0x4c03('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5db9d9(null,_0x515b03);},'beforeUpdate':function(_0x154c33,_0x402c44,_0xe10085){if(_0x154c33[_0x4c03('0x13')]('substatus')){_0x154c33[_0x4c03('0xe')]=_0x154c33[_0x4c03('0x14')]?moment()[_0x4c03('0xf')](_0x4c03('0x10')):null;}if(_0x154c33[_0x4c03('0x13')](_0x4c03('0x11'))){_0x154c33[_0x4c03('0x12')]=moment()['format'](_0x4c03('0x10'));_0x154c33['substatus']=null;_0x154c33[_0x4c03('0xe')]=null;}_0xe10085(null,_0x154c33);},'afterUpdate':function(_0xc59477,_0x2cd36a,_0x5ac6f9){var _0x2197d7=_0x3944f1[_0x4c03('0x15')];var _0x39fdd6=_0xc59477[_0x4c03('0x16')]({'plain':!![]});if(_0x39fdd6['closed']){return _0x2197d7[_0x4c03('0x17')][_0x4c03('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x39fdd6['id']}})[_0x4c03('0x19')](function(){_0x5ac6f9();})[_0x4c03('0x1a')](function(_0x50ed18){_0x5ac6f9(_0x50ed18);});}else{_0x5ac6f9();}}},'charset':_0x4c03('0x1b'),'collate':_0x4c03('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9dada29..d71de76 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 _0x688a=['find','addTags','ids','AddTags','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailInteraction,\x20%s,\x20%s','result','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','stringify','catch','AddTagsToMailInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x688a,0x124));var _0xa688=function(_0x2e4d09,_0x3ea1e1){_0x2e4d09=_0x2e4d09-0x0;var _0xf0c6a2=_0x688a[_0x2e4d09];return _0xf0c6a2;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var moment=require(_0xa688('0x2'));var BPromise=require('bluebird');var rs=require(_0xa688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa688('0x4'))['db'];var utils=require(_0xa688('0x5'));var logger=require('../../config/logger')(_0xa688('0x6'));var config=require(_0xa688('0x7'));var jayson=require(_0xa688('0x8'));var client=jayson[_0xa688('0x9')][_0xa688('0xa')]({'port':0x232a});config[_0xa688('0xb')]=_['defaults'](config['redis'],{'host':_0xa688('0xc'),'port':0x18eb});var socket=require(_0xa688('0xd'))(new Redis(config[_0xa688('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x42b94e,_0x5ce966,_0x4bf4ee){return new BPromise(function(_0x442638,_0x74b76){return client[_0xa688('0xe')](_0x42b94e,_0x4bf4ee)[_0xa688('0xf')](function(_0x43852b){logger[_0xa688('0x10')]('MailInteraction,\x20%s,\x20%s',_0x5ce966,'request\x20sent');logger['debug'](_0xa688('0x11'),_0x5ce966,_0xa688('0x12'),JSON['stringify'](_0x43852b));if(_0x43852b[_0xa688('0x13')]){if(_0x43852b['error'][_0xa688('0x14')]===0x1f4){logger[_0xa688('0x13')]('MailInteraction,\x20%s,\x20%s',_0x5ce966,_0x43852b['error'][_0xa688('0x15')]);return _0x74b76(_0x43852b['error'][_0xa688('0x15')]);}logger['error'](_0xa688('0x16'),_0x5ce966,_0x43852b[_0xa688('0x13')][_0xa688('0x15')]);return _0x442638(_0x43852b[_0xa688('0x13')][_0xa688('0x15')]);}else{logger[_0xa688('0x10')]('MailInteraction,\x20%s,\x20%s',_0x5ce966,'request\x20sent');_0x442638(_0x43852b[_0xa688('0x17')][_0xa688('0x15')]);}})['catch'](function(_0x5af18b){logger[_0xa688('0x13')](_0xa688('0x16'),_0x5ce966,_0x5af18b);_0x74b76(_0x5af18b);});});}exports['UpdateMailInteraction']=function(_0x37e9af){var _0x598168=this;return new Promise(function(_0x5c6925,_0x152cfe){return db[_0xa688('0x18')][_0xa688('0x19')](_0x37e9af[_0xa688('0x1a')],{'raw':_0x37e9af[_0xa688('0x1b')]?_0x37e9af[_0xa688('0x1b')][_0xa688('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37e9af[_0xa688('0x1b')]?_0x37e9af[_0xa688('0x1b')][_0xa688('0x1d')]||null:null,'attributes':_0x37e9af[_0xa688('0x1b')]?_0x37e9af[_0xa688('0x1b')][_0xa688('0x1e')]||null:null,'limit':_0x37e9af[_0xa688('0x1b')]?_0x37e9af['options'][_0xa688('0x1f')]||null:null})[_0xa688('0xf')](function(_0x4fa15e){logger[_0xa688('0x10')](_0xa688('0x20'),_0x37e9af);logger['debug'](_0xa688('0x20'),_0x37e9af,JSON[_0xa688('0x21')](_0x4fa15e));_0x5c6925(_0x4fa15e);})[_0xa688('0x22')](function(_0x25d1fa){logger[_0xa688('0x13')](_0xa688('0x20'),_0x25d1fa[_0xa688('0x15')],_0x37e9af);_0x152cfe(_0x598168[_0xa688('0x13')](0x1f4,_0x25d1fa[_0xa688('0x15')]));});});};exports[_0xa688('0x23')]=function(_0x3ab038){return new Promise(function(_0x161741,_0x3c7245){return db[_0xa688('0x18')][_0xa688('0x24')]({'where':_0x3ab038['options']?_0x3ab038[_0xa688('0x1b')][_0xa688('0x1d')]||null:null})[_0xa688('0xf')](function(_0x1f9d59){if(_0x1f9d59){return _0x1f9d59[_0xa688('0x25')](_0x3ab038[_0xa688('0x1a')]['ids'],_['omit'](_0x3ab038['body'],[_0xa688('0x26'),'id'])||{});}})['spread'](function(_0x5d8753){logger[_0xa688('0x10')](_0xa688('0x27'),_0x3ab038);logger[_0xa688('0x28')](_0xa688('0x27'),_0x3ab038,JSON[_0xa688('0x21')](_0x5d8753));_0x161741(_0x5d8753);})[_0xa688('0x22')](function(_0x55c564){logger['error']('AddTags',_0x55c564['message'],_0x3ab038);_0x3c7245(_this[_0xa688('0x13')](0x1f4,_0x55c564[_0xa688('0x15')]));});});}; \ No newline at end of file +var _0x4157=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailInteraction','MailInteraction','update','body','raw','options','where','limit','debug','catch','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4200e3,_0xb34e23){var _0x26ac37=function(_0x5b09e5){while(--_0x5b09e5){_0x4200e3['push'](_0x4200e3['shift']());}};_0x26ac37(++_0xb34e23);}(_0x4157,0xf3));var _0x7415=function(_0x3f6112,_0x3b89ab){_0x3f6112=_0x3f6112-0x0;var _0x535587=_0x4157[_0x3f6112];return _0x535587;};'use strict';var _=require(_0x7415('0x0'));var util=require(_0x7415('0x1'));var moment=require(_0x7415('0x2'));var BPromise=require(_0x7415('0x3'));var rs=require(_0x7415('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7415('0x5'))['db'];var utils=require(_0x7415('0x6'));var logger=require(_0x7415('0x7'))(_0x7415('0x8'));var config=require(_0x7415('0x9'));var jayson=require(_0x7415('0xa'));var client=jayson[_0x7415('0xb')][_0x7415('0xc')]({'port':0x232a});config[_0x7415('0xd')]=_['defaults'](config[_0x7415('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7415('0xe'))(new Redis(config['redis']));require(_0x7415('0xf'))[_0x7415('0x10')](socket);function respondWithRpcPromise(_0x30090b,_0xb023fa,_0x9c9c38){return new BPromise(function(_0x1dc06d,_0x283f22){return client['request'](_0x30090b,_0x9c9c38)[_0x7415('0x11')](function(_0xaba79e){logger[_0x7415('0x12')](_0x7415('0x13'),_0xb023fa,_0x7415('0x14'));logger['debug'](_0x7415('0x15'),_0xb023fa,_0x7415('0x14'),JSON[_0x7415('0x16')](_0xaba79e));if(_0xaba79e[_0x7415('0x17')]){if(_0xaba79e[_0x7415('0x17')][_0x7415('0x18')]===0x1f4){logger[_0x7415('0x17')](_0x7415('0x13'),_0xb023fa,_0xaba79e[_0x7415('0x17')][_0x7415('0x19')]);return _0x283f22(_0xaba79e[_0x7415('0x17')][_0x7415('0x19')]);}logger[_0x7415('0x17')]('MailInteraction,\x20%s,\x20%s',_0xb023fa,_0xaba79e[_0x7415('0x17')][_0x7415('0x19')]);return _0x1dc06d(_0xaba79e[_0x7415('0x17')][_0x7415('0x19')]);}else{logger['info'](_0x7415('0x13'),_0xb023fa,_0x7415('0x14'));_0x1dc06d(_0xaba79e['result'][_0x7415('0x19')]);}})['catch'](function(_0x28ca7b){logger[_0x7415('0x17')](_0x7415('0x13'),_0xb023fa,_0x28ca7b);_0x283f22(_0x28ca7b);});});}exports[_0x7415('0x1a')]=function(_0x3cecb9){var _0x28cfec=this;return new Promise(function(_0x266fa3,_0x36a934){return db[_0x7415('0x1b')][_0x7415('0x1c')](_0x3cecb9[_0x7415('0x1d')],{'raw':_0x3cecb9['options']?_0x3cecb9['options'][_0x7415('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cecb9[_0x7415('0x1f')]?_0x3cecb9[_0x7415('0x1f')][_0x7415('0x20')]||null:null,'attributes':_0x3cecb9['options']?_0x3cecb9[_0x7415('0x1f')]['attributes']||null:null,'limit':_0x3cecb9['options']?_0x3cecb9[_0x7415('0x1f')][_0x7415('0x21')]||null:null})[_0x7415('0x11')](function(_0x1271ca){logger[_0x7415('0x12')](_0x7415('0x1a'),_0x3cecb9);logger[_0x7415('0x22')](_0x7415('0x1a'),_0x3cecb9,JSON[_0x7415('0x16')](_0x1271ca));_0x266fa3(_0x1271ca);})[_0x7415('0x23')](function(_0x57b08a){logger[_0x7415('0x17')](_0x7415('0x1a'),_0x57b08a[_0x7415('0x19')],_0x3cecb9);_0x36a934(_0x28cfec[_0x7415('0x17')](0x1f4,_0x57b08a[_0x7415('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x15e69d){return new Promise(function(_0x5d2a50,_0xea1932){return db[_0x7415('0x1b')][_0x7415('0x24')]({'where':_0x15e69d[_0x7415('0x1f')]?_0x15e69d['options'][_0x7415('0x20')]||null:null})['then'](function(_0x5acb16){if(_0x5acb16){return _0x5acb16[_0x7415('0x25')](_0x15e69d[_0x7415('0x1d')][_0x7415('0x26')],_[_0x7415('0x27')](_0x15e69d['body'],[_0x7415('0x26'),'id'])||{});}})[_0x7415('0x28')](function(_0x5ed06d){logger[_0x7415('0x12')](_0x7415('0x29'),_0x15e69d);logger[_0x7415('0x22')](_0x7415('0x29'),_0x15e69d,JSON[_0x7415('0x16')](_0x5ed06d));_0x5d2a50(_0x5ed06d);})[_0x7415('0x23')](function(_0x2b1698){logger[_0x7415('0x17')]('AddTags',_0x2b1698[_0x7415('0x19')],_0x15e69d);_0xea1932(_this[_0x7415('0x17')](0x1f4,_0x2b1698['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b69a53e..a4a025d 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 _0x1916=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x25da9f,_0x47d72c){var _0x447588=function(_0x212fa5){while(--_0x212fa5){_0x25da9f['push'](_0x25da9f['shift']());}};_0x447588(++_0x47d72c);}(_0x1916,0x1d5));var _0x6191=function(_0x3c42f7,_0x25c980){_0x3c42f7=_0x3c42f7-0x0;var _0x35ac7f=_0x1916[_0x3c42f7];return _0x35ac7f;};'use strict';var MailInteractionEvents=require(_0x6191('0x0'));var events=[_0x6191('0x1'),_0x6191('0x2'),_0x6191('0x3')];function createListener(_0x25f952,_0x2a86d0){return function(_0x4e5831){_0x2a86d0[_0x6191('0x4')](_0x25f952,_0x4e5831);};}function removeListener(_0x36c592,_0x891c21){return function(){MailInteractionEvents[_0x6191('0x5')](_0x36c592,_0x891c21);};}exports[_0x6191('0x6')]=function(_0x1228e9){for(var _0x5148de=0x0,_0x5a7599=events[_0x6191('0x7')];_0x5148de<_0x5a7599;_0x5148de++){var _0xe5d68f=events[_0x5148de];var _0x350cf4=createListener(_0x6191('0x8')+_0xe5d68f,_0x1228e9);MailInteractionEvents['on'](_0xe5d68f,_0x350cf4);}}; \ No newline at end of file +var _0x3854=['mailInteraction:','save','remove','update','emit','length'];(function(_0x4241c9,_0x429708){var _0xb5bea1=function(_0x165082){while(--_0x165082){_0x4241c9['push'](_0x4241c9['shift']());}};_0xb5bea1(++_0x429708);}(_0x3854,0x15d));var _0x4385=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x3854[_0x220dbb];return _0x2b77de;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x4385('0x0'),_0x4385('0x1'),_0x4385('0x2')];function createListener(_0x5888d0,_0x50fdd3){return function(_0x1832e4){_0x50fdd3[_0x4385('0x3')](_0x5888d0,_0x1832e4);};}function removeListener(_0x1533ec,_0x40c7af){return function(){MailInteractionEvents['removeListener'](_0x1533ec,_0x40c7af);};}exports['register']=function(_0xbb5c04){for(var _0x30416b=0x0,_0x269c84=events[_0x4385('0x4')];_0x30416b<_0x269c84;_0x30416b++){var _0x5f2c18=events[_0x30416b];var _0x2274d3=createListener(_0x4385('0x5')+_0x5f2c18,_0xbb5c04);MailInteractionEvents['on'](_0x5f2c18,_0x2274d3);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f4e3452..5e6a8b1 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(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x98a8,0x12c));var _0x898a=function(_0x3d6886,_0x895066){_0x3d6886=_0x3d6886-0x0;var _0x2e07cf=_0x98a8[_0x3d6886];return _0x2e07cf;};'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 _0x81bd=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x4800e0,_0x25208f){var _0x5ef943=function(_0x88cc1){while(--_0x88cc1){_0x4800e0['push'](_0x4800e0['shift']());}};_0x5ef943(++_0x25208f);}(_0x81bd,0x7c));var _0xd81b=function(_0x1ea5e2,_0x382cec){_0x1ea5e2=_0x1ea5e2-0x0;var _0x39380c=_0x81bd[_0x1ea5e2];return _0x39380c;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd81b('0x9')]('/:id',auth[_0xd81b('0xc')](),controller[_0xd81b('0xd')]);router[_0xd81b('0x9')](_0xd81b('0xe'),auth[_0xd81b('0xc')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xc')](),interaction[_0xd81b('0x11')](_0xd81b('0x12'),_0xd81b('0x13')),controller[_0xd81b('0x14')]);router[_0xd81b('0x15')]('/:id',auth[_0xd81b('0xc')](),controller['update']);router[_0xd81b('0x15')](_0xd81b('0x16'),auth['isAuthenticated'](),controller[_0xd81b('0x17')]);router['put'](_0xd81b('0x18'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x19')]);router[_0xd81b('0x1a')](_0xd81b('0x1b'),auth['isAuthenticated'](),controller[_0xd81b('0x1c')]);module[_0xd81b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 96a7bb7..515a440 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 _0x7cdc=['STRING','INTEGER','BOOLEAN','DATE','lodash','exports','long','TEXT','medium','ENUM','out'];(function(_0x39c281,_0x28dc4d){var _0x41bd06=function(_0x209f94){while(--_0x209f94){_0x39c281['push'](_0x39c281['shift']());}};_0x41bd06(++_0x28dc4d);}(_0x7cdc,0x190));var _0xc7cd=function(_0x507c46,_0x2589a4){_0x507c46=_0x507c46-0x0;var _0x53ac33=_0x7cdc[_0x507c46];return _0x53ac33;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc7cd('0x0'));module[_0xc7cd('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc7cd('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc7cd('0x5')]('in',_0xc7cd('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc7cd('0x7')](0x1fe)},'from':{'type':Sequelize[_0xc7cd('0x7')]},'to':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x2'))},'cc':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x2'))},'bcc':{'type':Sequelize[_0xc7cd('0x3')]('long')},'subject':{'type':Sequelize[_0xc7cd('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xc7cd('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc7cd('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc7cd('0xa')]},'originTo':{'type':Sequelize[_0xc7cd('0x3')]('long')},'originCc':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x2'))}}; \ No newline at end of file +var _0x9d56=['DATE','INTEGER','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long'];(function(_0xfc38ec,_0x452395){var _0x3bf341=function(_0x2ba79e){while(--_0x2ba79e){_0xfc38ec['push'](_0xfc38ec['shift']());}};_0x3bf341(++_0x452395);}(_0x9d56,0x122));var _0x69d5=function(_0x1073ff,_0x5bb10e){_0x1073ff=_0x1073ff-0x0;var _0x407a89=_0x9d56[_0x1073ff];return _0x407a89;};'use strict';var Sequelize=require(_0x69d5('0x0'));var _=require(_0x69d5('0x1'));module[_0x69d5('0x2')]={'body':{'type':Sequelize[_0x69d5('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x69d5('0x3')](_0x69d5('0x4'))},'read':{'type':Sequelize[_0x69d5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x69d5('0x6')]('in',_0x69d5('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x69d5('0x8')](0x1fe)},'from':{'type':Sequelize[_0x69d5('0x8')]},'to':{'type':Sequelize[_0x69d5('0x3')](_0x69d5('0x9'))},'cc':{'type':Sequelize[_0x69d5('0x3')](_0x69d5('0x9'))},'bcc':{'type':Sequelize[_0x69d5('0x3')](_0x69d5('0x9'))},'subject':{'type':Sequelize[_0x69d5('0x3')]},'sentAt':{'type':Sequelize[_0x69d5('0xa')]},'attach':{'type':Sequelize[_0x69d5('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x69d5('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x69d5('0xa')]},'originTo':{'type':Sequelize[_0x69d5('0x3')](_0x69d5('0x9'))},'originCc':{'type':Sequelize[_0x69d5('0x3')](_0x69d5('0x9'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 2fbc0f2..f9c17cb 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 _0xa734=['register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','findAll','show','params','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','user','pass','attachments','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','root','server','files','tmp','join','message-%s.eml','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket'];(function(_0x502feb,_0x48ce4a){var _0x1b995d=function(_0x1e1ddb){while(--_0x1e1ddb){_0x502feb['push'](_0x502feb['shift']());}};_0x1b995d(++_0x48ce4a);}(_0xa734,0x1ee));var _0x4a73=function(_0x40eb74,_0x3d9d63){_0x40eb74=_0x40eb74-0x0;var _0x58fe14=_0xa734[_0x40eb74];return _0x58fe14;};'use strict';var pdf=require(_0x4a73('0x0'));var emlformat=require(_0x4a73('0x1'));var rimraf=require(_0x4a73('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a73('0x3'));var rp=require('request-promise');var moment=require(_0x4a73('0x4'));var BPromise=require(_0x4a73('0x5'));var Mustache=require(_0x4a73('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4a73('0x7'));var csv=require('to-csv');var ejs=require(_0x4a73('0x8'));var fs=require('fs');var _=require(_0x4a73('0x9'));var squel=require('squel');var crypto=require(_0x4a73('0xa'));var jsforce=require(_0x4a73('0xb'));var deskjs=require(_0x4a73('0xc'));var toCsv=require(_0x4a73('0xd'));var querystring=require(_0x4a73('0xe'));var Papa=require(_0x4a73('0xf'));var Redis=require('ioredis');var authService=require(_0x4a73('0x10'));var qs=require(_0x4a73('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a73('0x12'));var logger=require(_0x4a73('0x13'))('api');var utils=require(_0x4a73('0x14'));var config=require(_0x4a73('0x15'));var licenseUtil=require(_0x4a73('0x16'));var db=require(_0x4a73('0x17'))['db'];config[_0x4a73('0x18')]=_['defaults'](config[_0x4a73('0x18')],{'host':_0x4a73('0x19'),'port':0x18eb});var socket=require(_0x4a73('0x1a'))(new Redis(config[_0x4a73('0x18')]));require(_0x4a73('0x1b'))[_0x4a73('0x1c')](socket);var jayson=require(_0x4a73('0x1d'));var client=jayson[_0x4a73('0x1e')][_0x4a73('0x1f')]({'port':0x232c});var client9003=jayson[_0x4a73('0x1e')][_0x4a73('0x1f')]({'port':0x232b});var client9002=jayson['client'][_0x4a73('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5dade6,_0x6a9919,_0x5e1683,_0x1095ee){return new BPromise(function(_0xe97885,_0x48ec04){var _0x5e8893=_0x1095ee||client;return _0x5e8893[_0x4a73('0x20')](_0x5dade6,_0x5e1683)[_0x4a73('0x21')](function(_0x2cfea1){logger[_0x4a73('0x22')](_0x4a73('0x23'),_0x6a9919,_0x4a73('0x24'));logger[_0x4a73('0x25')](_0x4a73('0x26'),_0x6a9919,_0x4a73('0x24'),JSON[_0x4a73('0x27')](_0x2cfea1));if(_0x2cfea1[_0x4a73('0x28')]){if(_0x2cfea1[_0x4a73('0x28')]['code']===0x1f4){logger['error'](_0x4a73('0x23'),_0x6a9919,_0x2cfea1[_0x4a73('0x28')][_0x4a73('0x29')]);return _0x48ec04(_0x2cfea1[_0x4a73('0x28')][_0x4a73('0x29')]);}logger[_0x4a73('0x28')](_0x4a73('0x23'),_0x6a9919,_0x2cfea1[_0x4a73('0x28')][_0x4a73('0x29')]);return _0xe97885(_0x2cfea1[_0x4a73('0x28')]['message']);}else{logger['info'](_0x4a73('0x23'),_0x6a9919,_0x4a73('0x24'));_0xe97885(_0x2cfea1[_0x4a73('0x2a')][_0x4a73('0x29')]);}})[_0x4a73('0x2b')](function(_0x149a9b){logger[_0x4a73('0x28')](_0x4a73('0x23'),_0x6a9919,_0x149a9b);_0x48ec04(_0x149a9b);});});}function respondWithStatusCode(_0x47ce64,_0xfa34b7){_0xfa34b7=_0xfa34b7||0xcc;return function(_0x5c0b25){if(_0x5c0b25){return _0x47ce64['sendStatus'](_0xfa34b7);}return _0x47ce64[_0x4a73('0x2c')](_0xfa34b7)[_0x4a73('0x2d')]();};}function respondWithResult(_0x4ce815,_0x5bb375){_0x5bb375=_0x5bb375||0xc8;return function(_0x146456){if(_0x146456){return _0x4ce815[_0x4a73('0x2c')](_0x5bb375)[_0x4a73('0x2e')](_0x146456);}};}function respondWithFilteredResult(_0x5a5533,_0x1a032f){return function(_0x1252b9){if(_0x1252b9){var _0x19b5d7=_0x1252b9[_0x4a73('0x2f')],_0x31da0b=_0x1a032f[_0x4a73('0x30')],_0x4b6a02=_0x1a032f[_0x4a73('0x30')]+_0x1a032f[_0x4a73('0x31')],_0x477f30;if(_0x4b6a02>=_0x19b5d7){_0x4b6a02=_0x19b5d7;_0x477f30=0xc8;}else{_0x477f30=0xce;}_0x5a5533[_0x4a73('0x2c')](_0x477f30);return _0x5a5533[_0x4a73('0x32')](_0x4a73('0x33'),_0x31da0b+'-'+_0x4b6a02+'/'+_0x19b5d7)[_0x4a73('0x2e')](_0x1252b9);}return null;};}function patchUpdates(_0xe30ab0){return function(_0x10e2d1){try{jsonpatch[_0x4a73('0x34')](_0x10e2d1,_0xe30ab0,!![]);}catch(_0x5616f4){return BPromise[_0x4a73('0x35')](_0x5616f4);}return _0x10e2d1[_0x4a73('0x36')]();};}function saveUpdates(_0x20221f,_0xf940c2){return function(_0x40b1f3){if(_0x40b1f3){return _0x40b1f3[_0x4a73('0x37')](_0x20221f)['then'](function(_0x17778d){return _0x17778d;});}return null;};}function removeEntity(_0x334c17,_0x2d9eaf){return function(_0x3f3af9){if(_0x3f3af9){return _0x3f3af9[_0x4a73('0x38')]()[_0x4a73('0x21')](function(){_0x334c17[_0x4a73('0x2c')](0xcc)[_0x4a73('0x2d')]();});}};}function handleEntityNotFound(_0x2b11bb,_0x184dbf){return function(_0x491621){if(!_0x491621){_0x2b11bb['sendStatus'](0x194);}return _0x491621;};}function handleError(_0xd4902e,_0x58c54d){_0x58c54d=_0x58c54d||0x1f4;return function(_0x326b64){logger[_0x4a73('0x28')](_0x326b64['stack']);if(_0x326b64[_0x4a73('0x39')]){delete _0x326b64[_0x4a73('0x39')];}_0xd4902e[_0x4a73('0x2c')](_0x58c54d)['send'](_0x326b64);};}exports[_0x4a73('0x3a')]=function(_0x4b645d,_0x28182e){var _0x1512bd={},_0x5b8dd6={},_0x1d7d6f={'count':0x0,'rows':[]};var _0x2fdb11=_[_0x4a73('0x3b')](db['MailMessage'][_0x4a73('0x3c')],function(_0xb1f435){return{'name':_0xb1f435[_0x4a73('0x3d')],'type':_0xb1f435[_0x4a73('0x3e')][_0x4a73('0x3f')]};});_0x5b8dd6[_0x4a73('0x40')]=_[_0x4a73('0x3b')](_0x2fdb11,'name');_0x5b8dd6['query']=_[_0x4a73('0x41')](_0x4b645d[_0x4a73('0x42')]);_0x5b8dd6[_0x4a73('0x43')]=_[_0x4a73('0x44')](_0x5b8dd6[_0x4a73('0x40')],_0x5b8dd6[_0x4a73('0x42')]);_0x1512bd['attributes']=_[_0x4a73('0x44')](_0x5b8dd6[_0x4a73('0x40')],qs[_0x4a73('0x45')](_0x4b645d[_0x4a73('0x42')][_0x4a73('0x45')]));_0x1512bd[_0x4a73('0x46')]=_0x1512bd[_0x4a73('0x46')][_0x4a73('0x47')]?_0x1512bd[_0x4a73('0x46')]:_0x5b8dd6[_0x4a73('0x40')];if(!_0x4b645d[_0x4a73('0x42')][_0x4a73('0x48')](_0x4a73('0x49'))){_0x1512bd[_0x4a73('0x31')]=qs[_0x4a73('0x31')](_0x4b645d[_0x4a73('0x42')][_0x4a73('0x31')]);_0x1512bd['offset']=qs[_0x4a73('0x30')](_0x4b645d['query']['offset']);}_0x1512bd[_0x4a73('0x4a')]=qs[_0x4a73('0x4b')](_0x4b645d[_0x4a73('0x42')]['sort']);_0x1512bd[_0x4a73('0x4c')]=qs['filters'](_[_0x4a73('0x4d')](_0x4b645d[_0x4a73('0x42')],_0x5b8dd6['filters']),_0x2fdb11);if(_0x4b645d['query'][_0x4a73('0x4e')]){_0x1512bd[_0x4a73('0x4c')]=_[_0x4a73('0x4f')](_0x1512bd[_0x4a73('0x4c')],{'$or':_[_0x4a73('0x3b')](_0x2fdb11,function(_0x33e498){if(_0x33e498[_0x4a73('0x3e')]!==_0x4a73('0x50')){var _0x5760e7={};_0x5760e7[_0x33e498['name']]={'$like':'%'+_0x4b645d[_0x4a73('0x42')]['filter']+'%'};return _0x5760e7;}})});}_0x1512bd=_[_0x4a73('0x4f')]({},_0x1512bd,_0x4b645d[_0x4a73('0x51')]);var _0x3ea35f={'where':_0x1512bd[_0x4a73('0x4c')]};return db[_0x4a73('0x52')][_0x4a73('0x2f')](_0x3ea35f)[_0x4a73('0x21')](function(_0x1db27a){_0x1d7d6f[_0x4a73('0x2f')]=_0x1db27a;if(_0x4b645d[_0x4a73('0x42')][_0x4a73('0x53')]){_0x1512bd[_0x4a73('0x54')]=[{'all':!![]}];}return db[_0x4a73('0x52')][_0x4a73('0x55')](_0x1512bd);})[_0x4a73('0x21')](function(_0x2159bc){_0x1d7d6f['rows']=_0x2159bc;return _0x1d7d6f;})[_0x4a73('0x21')](respondWithFilteredResult(_0x28182e,_0x1512bd))[_0x4a73('0x2b')](handleError(_0x28182e,null));};exports[_0x4a73('0x56')]=function(_0x2ec7d1,_0x5f0e4f){var _0xe6a0c6={'raw':!![],'where':{'id':_0x2ec7d1[_0x4a73('0x57')]['id']}},_0xdb28eb={};_0xdb28eb[_0x4a73('0x40')]=_[_0x4a73('0x41')](db[_0x4a73('0x52')][_0x4a73('0x3c')]);_0xdb28eb[_0x4a73('0x42')]=_[_0x4a73('0x41')](_0x2ec7d1[_0x4a73('0x42')]);_0xdb28eb[_0x4a73('0x43')]=_[_0x4a73('0x44')](_0xdb28eb[_0x4a73('0x40')],_0xdb28eb[_0x4a73('0x42')]);_0xe6a0c6[_0x4a73('0x46')]=_[_0x4a73('0x44')](_0xdb28eb[_0x4a73('0x40')],qs['fields'](_0x2ec7d1[_0x4a73('0x42')][_0x4a73('0x45')]));_0xe6a0c6[_0x4a73('0x46')]=_0xe6a0c6[_0x4a73('0x46')]['length']?_0xe6a0c6[_0x4a73('0x46')]:_0xdb28eb[_0x4a73('0x40')];if(_0x2ec7d1[_0x4a73('0x42')]['includeAll']){_0xe6a0c6['include']=[{'all':!![]}];}_0xe6a0c6=_[_0x4a73('0x4f')]({},_0xe6a0c6,_0x2ec7d1[_0x4a73('0x51')]);return db[_0x4a73('0x52')][_0x4a73('0x58')](_0xe6a0c6)[_0x4a73('0x21')](handleEntityNotFound(_0x5f0e4f,null))[_0x4a73('0x21')](respondWithResult(_0x5f0e4f,null))[_0x4a73('0x2b')](handleError(_0x5f0e4f,null));};exports[_0x4a73('0x37')]=function(_0x151274,_0x1e66ff){if(_0x151274[_0x4a73('0x59')]['id']){delete _0x151274['body']['id'];}return db[_0x4a73('0x52')]['find']({'where':{'id':_0x151274[_0x4a73('0x57')]['id']}})['then'](handleEntityNotFound(_0x1e66ff,null))[_0x4a73('0x21')](saveUpdates(_0x151274[_0x4a73('0x59')],null))[_0x4a73('0x21')](respondWithResult(_0x1e66ff,null))[_0x4a73('0x2b')](handleError(_0x1e66ff,null));};exports[_0x4a73('0x38')]=function(_0x1912f4,_0x4de782){return db[_0x4a73('0x52')][_0x4a73('0x58')]({'where':{'id':_0x1912f4['params']['id']}})[_0x4a73('0x21')](handleEntityNotFound(_0x4de782,null))[_0x4a73('0x21')](removeEntity(_0x4de782,null))[_0x4a73('0x2b')](handleError(_0x4de782,null));};exports[_0x4a73('0x5a')]=function(_0x1a70fe,_0x3014dc){return db[_0x4a73('0x52')][_0x4a73('0x5a')]()['then'](respondWithResult(_0x3014dc,null))[_0x4a73('0x2b')](handleError(_0x3014dc,null));};exports[_0x4a73('0x5b')]=function(_0x436df2,_0x302711){return db[_0x4a73('0x52')]['create'](_0x436df2[_0x4a73('0x59')])[_0x4a73('0x21')](function(_0xc03783){if(_0xc03783){if(_0xc03783[_0x4a73('0x5c')]===_0x4a73('0x5d')&&!_0xc03783[_0x4a73('0x5e')]){var _0xe7f5ce,_0x405fd3,_0x2bc32e;if(_0x436df2['body']['to']){_0x405fd3=_0x436df2['body']['to'][_0x4a73('0x5f')](',')[0x0];}return db[_0x4a73('0x60')]['findOne']({'where':{'id':_0xc03783[_0x4a73('0x61')]},'include':[{'model':db[_0x4a73('0x62')],'as':'List','include':[{'model':db[_0x4a73('0x63')],'as':_0x4a73('0x64'),'where':{'email':_0x405fd3},'limit':0x1,'order':[['updatedAt',_0x4a73('0x65')]]}]},{'model':db[_0x4a73('0x66')],'as':_0x4a73('0x67'),'raw':!![]}]})[_0x4a73('0x21')](function(_0x36c105){_0xe7f5ce=_0x36c105;if(_0xe7f5ce&&_0xe7f5ce[_0x4a73('0x67')]){var _0x56089d={'tls':{'rejectUnauthorized':![]}};if(_[_0x4a73('0x68')](_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x69')])){_0x56089d[_0x4a73('0x6a')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6a')];_0x56089d[_0x4a73('0x6b')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6b')];_0x56089d[_0x4a73('0x6c')]=_0xe7f5ce[_0x4a73('0x67')]['secure'];if(_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6d')]){_0x56089d['auth']={'user':_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6e')],'pass':_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6f')]};}}else{_0x56089d[_0x4a73('0x69')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x69')];_0x56089d['auth']={'user':_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6e')],'pass':_0xe7f5ce['Smtp']['pass']};_0x56089d[_0x4a73('0x6c')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6c')];}if(_0x436df2[_0x4a73('0x59')][_0x4a73('0x70')]&&_0x436df2['body'][_0x4a73('0x70')][_0x4a73('0x47')]){for(var _0x2ea599=0x0;_0x2ea599<_0x436df2[_0x4a73('0x59')]['attachments'][_0x4a73('0x47')];_0x2ea599+=0x1){_0x436df2[_0x4a73('0x59')]['attachments'][_0x2ea599]={'filename':_0x436df2[_0x4a73('0x59')][_0x4a73('0x70')][_0x2ea599][_0x4a73('0x39')],'path':path['join'](config['root'],_0x4a73('0x71'),_0x436df2[_0x4a73('0x59')][_0x4a73('0x70')][_0x2ea599][_0x4a73('0x72')])};}}_0x2bc32e={'account':_0x56089d,'message':_0x436df2['body']};return;}})[_0x4a73('0x21')](function(){if(_0xe7f5ce[_0x4a73('0x73')]){if(_0xe7f5ce[_0x4a73('0x73')][_0x4a73('0x64')]['length']){return _0xe7f5ce['List'][_0x4a73('0x64')][0x0];}else{return db[_0x4a73('0x63')][_0x4a73('0x5b')](_['defaults'](_0x436df2['body'],{'firstName':_0x436df2[_0x4a73('0x59')]['to'],'email':_0x436df2[_0x4a73('0x59')]['to'],'phone':_0x436df2['body']['to'],'ListId':_0xe7f5ce[_0x4a73('0x74')]}));}}else{throw new Error(_0x4a73('0x75'));}})[_0x4a73('0x21')](function(){if(_0x2bc32e){return respondWithRpcPromise(_0x4a73('0x76'),_0x4a73('0x77'),_0x2bc32e,client9003)[_0x4a73('0x21')](function(_0x1a7416){return _0xc03783[_0x4a73('0x37')]({'read':!![],'messageId':_0x1a7416[_0x4a73('0x78')],'sentAt':moment()[_0x4a73('0x79')](_0x4a73('0x7a'))});})[_0x4a73('0x2b')](function(_0x45a179){logger[_0x4a73('0x28')]('%s',JSON[_0x4a73('0x27')](_0x45a179));return _0xc03783;});}return _0xc03783;});}return _0xc03783;}})[_0x4a73('0x21')](respondWithResult(_0x302711,0xc9))['catch'](handleError(_0x302711,null));};var interaction_log=require('../../config/logger')(_0x4a73('0x7b'));exports[_0x4a73('0x7c')]=function(_0x324103,_0x1bb2f1,_0xc61ba8){var _0x50a6c0={'channel':'mail'};if(_0x324103[_0x4a73('0x59')]['id']){delete _0x324103['body']['id'];}_0x324103[_0x4a73('0x59')][_0x4a73('0x7d')]=!![];_0x324103['body'][_0x4a73('0x7e')]=moment()[_0x4a73('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x324103['body'][_0x4a73('0x7f')]=_0x324103[_0x4a73('0x59')][_0x4a73('0x7f')]||_0x324103[_0x4a73('0x6e')]['id'];return db[_0x4a73('0x52')][_0x4a73('0x58')]({'where':{'id':_0x324103[_0x4a73('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4a73('0x80')}]})[_0x4a73('0x21')](handleEntityNotFound(_0x1bb2f1,null))[_0x4a73('0x21')](saveUpdates(_0x324103['body'],null))[_0x4a73('0x21')](function(_0x10b66b){if(_0x10b66b){_0x50a6c0[_0x4a73('0x29')]=_0x10b66b[_0x4a73('0x81')]({'plain':!![]});return db[_0x4a73('0x82')][_0x4a73('0x58')]({'where':{'id':_0x10b66b[_0x4a73('0x83')]}});}return null;})[_0x4a73('0x21')](handleEntityNotFound(_0x1bb2f1,null))[_0x4a73('0x21')](function(_0x52e68e){if(_0x52e68e){return _0x52e68e[_0x4a73('0x37')]({'UserId':_0x324103[_0x4a73('0x59')][_0x4a73('0x7f')],'read1stAt':_[_0x4a73('0x68')](_0x52e68e['read1stAt'])?moment()[_0x4a73('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x371438){if(_0x371438){_0x50a6c0[_0x4a73('0x84')]=_0x371438[_0x4a73('0x81')]({'plain':!![]});interaction_log[_0x4a73('0x22')](_0x4a73('0x85'),_0x324103[_0x4a73('0x6e')]['id'],_0x324103[_0x4a73('0x6e')]['name'],_0x324103['user'][_0x4a73('0x86')],_0x50a6c0[_0x4a73('0x84')]['id'],_0x324103['body']?JSON[_0x4a73('0x27')](_0x324103['body']):_0x4a73('0x87'));return respondWithRpcPromise(_0x4a73('0x88'),'acceptMessage',_0x50a6c0);}return null;})['then'](function(_0x5f43fc){if(_0x5f43fc){if(_0x324103[_0x4a73('0x59')]['manual']){_0x50a6c0['message'][_0x4a73('0x89')]=util['format'](_0x4a73('0x8a'),_0x324103[_0x4a73('0x6e')][_0x4a73('0x39')]);_0x50a6c0['message'][_0x4a73('0x8b')]=_0x50a6c0[_0x4a73('0x8b')];_0x50a6c0[_0x4a73('0x29')][_0x4a73('0x8c')]=_0x4a73('0x7c');return respondWithRpcPromise('EventManager',_0x4a73('0x8d'),{'event':_0x4a73('0x8e'),'message':_0x50a6c0[_0x4a73('0x29')]},client9002)['then'](function(){return _0x50a6c0;});}return _0x50a6c0;}return null;})[_0x4a73('0x21')](respondWithResult(_0x1bb2f1,null))[_0x4a73('0x2b')](handleError(_0x1bb2f1,null));};var interaction_log=require(_0x4a73('0x13'))(_0x4a73('0x7b'));exports['reject']=function(_0x1e6846,_0x468bcb,_0x42e181){var _0xdbb169={'agent':{},'channel':_0x4a73('0x8f')};if(_0x1e6846[_0x4a73('0x59')]['id']){delete _0x1e6846[_0x4a73('0x59')]['id'];}_0x1e6846['body'][_0x4a73('0x7f')]=_0x1e6846[_0x4a73('0x59')]['UserId']||_0x1e6846[_0x4a73('0x6e')]['id'];_0xdbb169[_0x4a73('0x90')]['id']=_0x1e6846[_0x4a73('0x59')][_0x4a73('0x7f')];return db[_0x4a73('0x52')]['find']({'where':{'id':_0x1e6846['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x468bcb,null))['then'](function(_0x2f3e06){if(_0x2f3e06){_0xdbb169[_0x4a73('0x29')]=_0x2f3e06[_0x4a73('0x81')]({'plain':!![]});return db[_0x4a73('0x82')][_0x4a73('0x58')]({'where':{'id':_0x2f3e06[_0x4a73('0x83')]}});}return null;})[_0x4a73('0x21')](handleEntityNotFound(_0x468bcb,null))['then'](function(_0x3bb82f){if(_0x3bb82f){_0xdbb169[_0x4a73('0x84')]=_0x3bb82f[_0x4a73('0x81')]({'plain':!![]});interaction_log[_0x4a73('0x22')](_0x4a73('0x91'),_0x1e6846['user']['id'],_0x1e6846[_0x4a73('0x6e')][_0x4a73('0x39')],_0x1e6846[_0x4a73('0x6e')][_0x4a73('0x86')],_0xdbb169[_0x4a73('0x84')]['id'],_0x1e6846[_0x4a73('0x59')]?JSON[_0x4a73('0x27')](_0x1e6846['body']):_0x4a73('0x87'));return respondWithRpcPromise(_0x4a73('0x92'),_0x4a73('0x93'),_0xdbb169);}return null;})['then'](function(_0x261f09){if(_0x261f09){_0x261f09[_0x4a73('0x29')][_0x4a73('0x89')]=util[_0x4a73('0x79')](_0x4a73('0x8a'),_0x1e6846[_0x4a73('0x6e')][_0x4a73('0x39')]);_0x261f09[_0x4a73('0x29')]['channel']=_0xdbb169['channel'];_0x261f09[_0x4a73('0x29')][_0x4a73('0x8c')]='reject';respondWithRpcPromise('EventManager',_0x4a73('0x8d'),{'event':_0x4a73('0x94'),'message':_0x261f09[_0x4a73('0x29')]},client9002);return _0xdbb169;}return null;})['then'](respondWithResult(_0x468bcb,null))[_0x4a73('0x2b')](handleError(_0x468bcb,null));};exports[_0x4a73('0x95')]=function(_0x4b2955,_0x32c4cf){var _0x51708c=moment()[_0x4a73('0x96')]()[_0x4a73('0x97')]();var _0x585dd3=path['join'](config[_0x4a73('0x98')],_0x4a73('0x99'),_0x4a73('0x9a'),_0x4a73('0x9b'));var _0x70d597=path[_0x4a73('0x9c')](config['root'],_0x4a73('0x99'),_0x4a73('0x9a'),_0x4a73('0x70'));var _0x14c272=util[_0x4a73('0x79')](_0x4a73('0x9d'),_0x51708c);return db[_0x4a73('0x52')]['find']({'where':{'id':_0x4b2955[_0x4a73('0x57')]['id']},'attributes':['id','body','from','to','cc',_0x4a73('0x9e'),_0x4a73('0x9f'),_0x4a73('0xa0')],'include':_0x4b2955[_0x4a73('0x42')][_0x4a73('0x70')]?[{'model':db[_0x4a73('0xa1')],'as':'Attachments'}]:undefined})[_0x4a73('0x21')](handleEntityNotFound(_0x32c4cf,null))[_0x4a73('0x21')](function(_0x247974){if(_0x247974){var _0x36b78a=_0x247974;var _0x3a4d98={'from':_0x36b78a[_0x4a73('0xa2')],'to':_0x36b78a['to'],'subject':_0x36b78a[_0x4a73('0x9f')],'html':_0x36b78a[_0x4a73('0x59')],'headers':{'Date':moment(_0x36b78a[_0x4a73('0xa0')])[_0x4a73('0x79')](_0x4a73('0xa3'))},'attachments':[]};if(_0x247974['cc']){_0x3a4d98[_0x4a73('0xa4')]['Cc']=_0x247974['cc'];}if(_0x247974[_0x4a73('0x9e')]){_0x3a4d98[_0x4a73('0xa4')][_0x4a73('0xa5')]=_0x247974[_0x4a73('0x9e')];}return new BPromise(function(_0x727ec4,_0x30e628){if(_0x247974[_0x4a73('0xa6')]){for(var _0x148840=0x0;_0x148840<_0x247974['Attachments'][_0x4a73('0x47')];_0x148840++){var _0x419651=_0x247974[_0x4a73('0xa6')][_0x148840];var _0x5ddce4=path[_0x4a73('0x9c')](_0x70d597,_0x419651['basename']);if(fs[_0x4a73('0xa7')](_0x5ddce4)){_0x3a4d98['attachments'][_0x4a73('0xa8')]({'name':_0x419651[_0x4a73('0x39')],'contentType':_0x419651['type'],'data':fs[_0x4a73('0xa9')](_0x5ddce4)});}}}emlformat[_0x4a73('0xaa')](_0x3a4d98,function(_0x1a634d,_0x3d1110){if(_0x1a634d)return _0x30e628(_0x1a634d);fs['writeFileSync'](path[_0x4a73('0x9c')](_0x585dd3,_0x14c272),_0x3d1110);return _0x727ec4(_0x3d1110);});});}})[_0x4a73('0x21')](function(_0x3f6270){if(_0x3f6270){return _0x32c4cf[_0x4a73('0x95')](path[_0x4a73('0x9c')](_0x585dd3,_0x14c272),_0x14c272,function(_0x400e1e){if(_0x400e1e){console[_0x4a73('0xab')](_0x4a73('0xac'),_0x400e1e);}else{fs[_0x4a73('0xad')](path[_0x4a73('0x9c')](_0x585dd3,_0x14c272));}});}})[_0x4a73('0x2b')](handleError(_0x32c4cf,null));}; \ No newline at end of file +var _0x5d5e=['redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','map','MailMessage','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','body','describe','create','out','secret','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','Smtp','service','host','secure','authentication','auth','user','pass','attachments','root','basename','ListId','SendMail','sendMail','format','../../config/logger','mail-interactions','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','channel','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','EventManager','download','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','Attachments','existsSync','push','readFileSync','build','log','err','unlinkSync','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xfb41d,_0x32740c){var _0x246945=function(_0xd82dd9){while(--_0xd82dd9){_0xfb41d['push'](_0xfb41d['shift']());}};_0x246945(++_0x32740c);}(_0x5d5e,0x8b));var _0xe5d5=function(_0x3f288a,_0x537b22){_0x3f288a=_0x3f288a-0x0;var _0x1316ff=_0x5d5e[_0x3f288a];return _0x1316ff;};'use strict';var pdf=require(_0xe5d5('0x0'));var emlformat=require(_0xe5d5('0x1'));var rimraf=require(_0xe5d5('0x2'));var zipdir=require(_0xe5d5('0x3'));var jsonpatch=require(_0xe5d5('0x4'));var rp=require('request-promise');var moment=require(_0xe5d5('0x5'));var BPromise=require(_0xe5d5('0x6'));var Mustache=require(_0xe5d5('0x7'));var util=require(_0xe5d5('0x8'));var path=require(_0xe5d5('0x9'));var sox=require(_0xe5d5('0xa'));var csv=require(_0xe5d5('0xb'));var ejs=require(_0xe5d5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe5d5('0xd'));var crypto=require('crypto');var jsforce=require(_0xe5d5('0xe'));var deskjs=require(_0xe5d5('0xf'));var toCsv=require(_0xe5d5('0xb'));var querystring=require(_0xe5d5('0x10'));var Papa=require(_0xe5d5('0x11'));var Redis=require(_0xe5d5('0x12'));var authService=require(_0xe5d5('0x13'));var qs=require(_0xe5d5('0x14'));var as=require(_0xe5d5('0x15'));var hardwareService=require(_0xe5d5('0x16'));var logger=require('../../config/logger')(_0xe5d5('0x17'));var utils=require(_0xe5d5('0x18'));var config=require(_0xe5d5('0x19'));var licenseUtil=require(_0xe5d5('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe5d5('0x1b')]=_[_0xe5d5('0x1c')](config[_0xe5d5('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe5d5('0x1d'))(new Redis(config[_0xe5d5('0x1b')]));require(_0xe5d5('0x1e'))[_0xe5d5('0x1f')](socket);var jayson=require(_0xe5d5('0x20'));var client=jayson[_0xe5d5('0x21')]['http']({'port':0x232c});var client9003=jayson[_0xe5d5('0x21')][_0xe5d5('0x22')]({'port':0x232b});var client9002=jayson[_0xe5d5('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55c39a,_0x32522c,_0x3e7b4c,_0x5b6938){return new BPromise(function(_0x297842,_0x26d008){var _0x2bbb3b=_0x5b6938||client;return _0x2bbb3b['request'](_0x55c39a,_0x3e7b4c)['then'](function(_0x19b50c){logger[_0xe5d5('0x23')](_0xe5d5('0x24'),_0x32522c,_0xe5d5('0x25'));logger[_0xe5d5('0x26')](_0xe5d5('0x27'),_0x32522c,_0xe5d5('0x25'),JSON[_0xe5d5('0x28')](_0x19b50c));if(_0x19b50c[_0xe5d5('0x29')]){if(_0x19b50c[_0xe5d5('0x29')][_0xe5d5('0x2a')]===0x1f4){logger['error'](_0xe5d5('0x24'),_0x32522c,_0x19b50c['error'][_0xe5d5('0x2b')]);return _0x26d008(_0x19b50c['error'][_0xe5d5('0x2b')]);}logger[_0xe5d5('0x29')]('MailMessage,\x20%s,\x20%s',_0x32522c,_0x19b50c[_0xe5d5('0x29')][_0xe5d5('0x2b')]);return _0x297842(_0x19b50c[_0xe5d5('0x29')][_0xe5d5('0x2b')]);}else{logger[_0xe5d5('0x23')]('MailMessage,\x20%s,\x20%s',_0x32522c,_0xe5d5('0x25'));_0x297842(_0x19b50c[_0xe5d5('0x2c')][_0xe5d5('0x2b')]);}})[_0xe5d5('0x2d')](function(_0x5edc24){logger[_0xe5d5('0x29')](_0xe5d5('0x24'),_0x32522c,_0x5edc24);_0x26d008(_0x5edc24);});});}function respondWithStatusCode(_0x108588,_0x131bf8){_0x131bf8=_0x131bf8||0xcc;return function(_0x3ca87b){if(_0x3ca87b){return _0x108588[_0xe5d5('0x2e')](_0x131bf8);}return _0x108588['status'](_0x131bf8)[_0xe5d5('0x2f')]();};}function respondWithResult(_0x52bf3d,_0x1e8d99){_0x1e8d99=_0x1e8d99||0xc8;return function(_0x55019f){if(_0x55019f){return _0x52bf3d[_0xe5d5('0x30')](_0x1e8d99)['json'](_0x55019f);}};}function respondWithFilteredResult(_0x115763,_0x5978e){return function(_0x20982c){if(_0x20982c){var _0x2865fb=_0x20982c['count'],_0x508b42=_0x5978e[_0xe5d5('0x31')],_0x162216=_0x5978e[_0xe5d5('0x31')]+_0x5978e['limit'],_0x4a20a0;if(_0x162216>=_0x2865fb){_0x162216=_0x2865fb;_0x4a20a0=0xc8;}else{_0x4a20a0=0xce;}_0x115763[_0xe5d5('0x30')](_0x4a20a0);return _0x115763[_0xe5d5('0x32')](_0xe5d5('0x33'),_0x508b42+'-'+_0x162216+'/'+_0x2865fb)[_0xe5d5('0x34')](_0x20982c);}return null;};}function patchUpdates(_0x218c26){return function(_0x42033c){try{jsonpatch['apply'](_0x42033c,_0x218c26,!![]);}catch(_0x2ac2eb){return BPromise[_0xe5d5('0x35')](_0x2ac2eb);}return _0x42033c[_0xe5d5('0x36')]();};}function saveUpdates(_0x3de467,_0x25d5b6){return function(_0x4e7a86){if(_0x4e7a86){return _0x4e7a86[_0xe5d5('0x37')](_0x3de467)['then'](function(_0x1e107){return _0x1e107;});}return null;};}function removeEntity(_0x58abb9,_0x7c28f8){return function(_0x553e49){if(_0x553e49){return _0x553e49[_0xe5d5('0x38')]()[_0xe5d5('0x39')](function(){_0x58abb9[_0xe5d5('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d594,_0x4b823c){return function(_0x1dffa4){if(!_0x1dffa4){_0x56d594[_0xe5d5('0x2e')](0x194);}return _0x1dffa4;};}function handleError(_0x39cce1,_0x18a77d){_0x18a77d=_0x18a77d||0x1f4;return function(_0x5993b4){logger['error'](_0x5993b4[_0xe5d5('0x3a')]);if(_0x5993b4['name']){delete _0x5993b4[_0xe5d5('0x3b')];}_0x39cce1[_0xe5d5('0x30')](_0x18a77d)[_0xe5d5('0x3c')](_0x5993b4);};}exports['index']=function(_0x1e26ef,_0x4040c4){var _0x17a9f4={},_0x3e3ebb={},_0x1f76e1={'count':0x0,'rows':[]};var _0x2c2639=_[_0xe5d5('0x3d')](db[_0xe5d5('0x3e')][_0xe5d5('0x3f')],function(_0x42c347){return{'name':_0x42c347['fieldName'],'type':_0x42c347[_0xe5d5('0x40')][_0xe5d5('0x41')]};});_0x3e3ebb[_0xe5d5('0x42')]=_[_0xe5d5('0x3d')](_0x2c2639,_0xe5d5('0x3b'));_0x3e3ebb['query']=_[_0xe5d5('0x43')](_0x1e26ef['query']);_0x3e3ebb[_0xe5d5('0x44')]=_['intersection'](_0x3e3ebb[_0xe5d5('0x42')],_0x3e3ebb[_0xe5d5('0x45')]);_0x17a9f4[_0xe5d5('0x46')]=_[_0xe5d5('0x47')](_0x3e3ebb['model'],qs[_0xe5d5('0x48')](_0x1e26ef[_0xe5d5('0x45')]['fields']));_0x17a9f4[_0xe5d5('0x46')]=_0x17a9f4[_0xe5d5('0x46')][_0xe5d5('0x49')]?_0x17a9f4[_0xe5d5('0x46')]:_0x3e3ebb[_0xe5d5('0x42')];if(!_0x1e26ef[_0xe5d5('0x45')][_0xe5d5('0x4a')]('nolimit')){_0x17a9f4[_0xe5d5('0x4b')]=qs[_0xe5d5('0x4b')](_0x1e26ef[_0xe5d5('0x45')][_0xe5d5('0x4b')]);_0x17a9f4[_0xe5d5('0x31')]=qs[_0xe5d5('0x31')](_0x1e26ef[_0xe5d5('0x45')]['offset']);}_0x17a9f4['order']=qs['sort'](_0x1e26ef[_0xe5d5('0x45')][_0xe5d5('0x4c')]);_0x17a9f4[_0xe5d5('0x4d')]=qs[_0xe5d5('0x44')](_[_0xe5d5('0x4e')](_0x1e26ef[_0xe5d5('0x45')],_0x3e3ebb[_0xe5d5('0x44')]),_0x2c2639);if(_0x1e26ef[_0xe5d5('0x45')][_0xe5d5('0x4f')]){_0x17a9f4[_0xe5d5('0x4d')]=_[_0xe5d5('0x50')](_0x17a9f4['where'],{'$or':_[_0xe5d5('0x3d')](_0x2c2639,function(_0x514bbd){if(_0x514bbd['type']!==_0xe5d5('0x51')){var _0x1f7aeb={};_0x1f7aeb[_0x514bbd['name']]={'$like':'%'+_0x1e26ef[_0xe5d5('0x45')]['filter']+'%'};return _0x1f7aeb;}})});}_0x17a9f4=_[_0xe5d5('0x50')]({},_0x17a9f4,_0x1e26ef[_0xe5d5('0x52')]);var _0x5d5aea={'where':_0x17a9f4['where']};return db[_0xe5d5('0x3e')][_0xe5d5('0x53')](_0x5d5aea)[_0xe5d5('0x39')](function(_0x2eb987){_0x1f76e1[_0xe5d5('0x53')]=_0x2eb987;if(_0x1e26ef['query'][_0xe5d5('0x54')]){_0x17a9f4[_0xe5d5('0x55')]=[{'all':!![]}];}return db[_0xe5d5('0x3e')][_0xe5d5('0x56')](_0x17a9f4);})[_0xe5d5('0x39')](function(_0x5f00a2){_0x1f76e1['rows']=_0x5f00a2;return _0x1f76e1;})[_0xe5d5('0x39')](respondWithFilteredResult(_0x4040c4,_0x17a9f4))[_0xe5d5('0x2d')](handleError(_0x4040c4,null));};exports[_0xe5d5('0x57')]=function(_0x15520a,_0x475648){var _0x27df1b={'raw':!![],'where':{'id':_0x15520a[_0xe5d5('0x58')]['id']}},_0x2d818d={};_0x2d818d[_0xe5d5('0x42')]=_[_0xe5d5('0x43')](db[_0xe5d5('0x3e')]['rawAttributes']);_0x2d818d[_0xe5d5('0x45')]=_[_0xe5d5('0x43')](_0x15520a[_0xe5d5('0x45')]);_0x2d818d['filters']=_[_0xe5d5('0x47')](_0x2d818d[_0xe5d5('0x42')],_0x2d818d[_0xe5d5('0x45')]);_0x27df1b[_0xe5d5('0x46')]=_[_0xe5d5('0x47')](_0x2d818d[_0xe5d5('0x42')],qs[_0xe5d5('0x48')](_0x15520a[_0xe5d5('0x45')][_0xe5d5('0x48')]));_0x27df1b[_0xe5d5('0x46')]=_0x27df1b['attributes'][_0xe5d5('0x49')]?_0x27df1b[_0xe5d5('0x46')]:_0x2d818d[_0xe5d5('0x42')];if(_0x15520a[_0xe5d5('0x45')]['includeAll']){_0x27df1b[_0xe5d5('0x55')]=[{'all':!![]}];}_0x27df1b=_['merge']({},_0x27df1b,_0x15520a['options']);return db[_0xe5d5('0x3e')][_0xe5d5('0x59')](_0x27df1b)[_0xe5d5('0x39')](handleEntityNotFound(_0x475648,null))[_0xe5d5('0x39')](respondWithResult(_0x475648,null))[_0xe5d5('0x2d')](handleError(_0x475648,null));};exports[_0xe5d5('0x37')]=function(_0x1ce15e,_0x50867a){if(_0x1ce15e[_0xe5d5('0x5a')]['id']){delete _0x1ce15e['body']['id'];}return db['MailMessage'][_0xe5d5('0x59')]({'where':{'id':_0x1ce15e[_0xe5d5('0x58')]['id']}})[_0xe5d5('0x39')](handleEntityNotFound(_0x50867a,null))[_0xe5d5('0x39')](saveUpdates(_0x1ce15e[_0xe5d5('0x5a')],null))['then'](respondWithResult(_0x50867a,null))[_0xe5d5('0x2d')](handleError(_0x50867a,null));};exports[_0xe5d5('0x38')]=function(_0x493608,_0x2c8832){return db[_0xe5d5('0x3e')]['find']({'where':{'id':_0x493608[_0xe5d5('0x58')]['id']}})[_0xe5d5('0x39')](handleEntityNotFound(_0x2c8832,null))[_0xe5d5('0x39')](removeEntity(_0x2c8832,null))[_0xe5d5('0x2d')](handleError(_0x2c8832,null));};exports[_0xe5d5('0x5b')]=function(_0x4326d9,_0x44486a){return db[_0xe5d5('0x3e')][_0xe5d5('0x5b')]()[_0xe5d5('0x39')](respondWithResult(_0x44486a,null))[_0xe5d5('0x2d')](handleError(_0x44486a,null));};exports['create']=function(_0x472e21,_0x28dae4){return db[_0xe5d5('0x3e')][_0xe5d5('0x5c')](_0x472e21[_0xe5d5('0x5a')])[_0xe5d5('0x39')](function(_0x2e5b5c){if(_0x2e5b5c){if(_0x2e5b5c['direction']===_0xe5d5('0x5d')&&!_0x2e5b5c[_0xe5d5('0x5e')]){var _0x3c6882,_0x3e9954,_0x1feba1;if(_0x472e21[_0xe5d5('0x5a')]['to']){_0x3e9954=_0x472e21['body']['to']['split'](',')[0x0];}return db[_0xe5d5('0x5f')]['findOne']({'where':{'id':_0x2e5b5c[_0xe5d5('0x60')]},'include':[{'model':db[_0xe5d5('0x61')],'as':_0xe5d5('0x62'),'include':[{'model':db['CmContact'],'as':_0xe5d5('0x63'),'where':{'email':_0x3e9954},'limit':0x1,'order':[[_0xe5d5('0x64'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xe5d5('0x65'),'raw':!![]}]})[_0xe5d5('0x39')](function(_0x31b5a8){_0x3c6882=_0x31b5a8;if(_0x3c6882&&_0x3c6882[_0xe5d5('0x65')]){var _0x41ae15={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x3c6882[_0xe5d5('0x65')][_0xe5d5('0x66')])){_0x41ae15[_0xe5d5('0x67')]=_0x3c6882[_0xe5d5('0x65')][_0xe5d5('0x67')];_0x41ae15['port']=_0x3c6882[_0xe5d5('0x65')]['port'];_0x41ae15[_0xe5d5('0x68')]=_0x3c6882[_0xe5d5('0x65')][_0xe5d5('0x68')];if(_0x3c6882[_0xe5d5('0x65')][_0xe5d5('0x69')]){_0x41ae15[_0xe5d5('0x6a')]={'user':_0x3c6882[_0xe5d5('0x65')][_0xe5d5('0x6b')],'pass':_0x3c6882[_0xe5d5('0x65')][_0xe5d5('0x6c')]};}}else{_0x41ae15[_0xe5d5('0x66')]=_0x3c6882[_0xe5d5('0x65')][_0xe5d5('0x66')];_0x41ae15[_0xe5d5('0x6a')]={'user':_0x3c6882[_0xe5d5('0x65')]['user'],'pass':_0x3c6882[_0xe5d5('0x65')]['pass']};_0x41ae15[_0xe5d5('0x68')]=_0x3c6882['Smtp'][_0xe5d5('0x68')];}if(_0x472e21[_0xe5d5('0x5a')][_0xe5d5('0x6d')]&&_0x472e21['body']['attachments'][_0xe5d5('0x49')]){for(var _0x506627=0x0;_0x506627<_0x472e21[_0xe5d5('0x5a')][_0xe5d5('0x6d')][_0xe5d5('0x49')];_0x506627+=0x1){_0x472e21['body']['attachments'][_0x506627]={'filename':_0x472e21[_0xe5d5('0x5a')][_0xe5d5('0x6d')][_0x506627][_0xe5d5('0x3b')],'path':path['join'](config[_0xe5d5('0x6e')],'server/files/attachments',_0x472e21[_0xe5d5('0x5a')]['attachments'][_0x506627][_0xe5d5('0x6f')])};}}_0x1feba1={'account':_0x41ae15,'message':_0x472e21['body']};return;}})['then'](function(){if(_0x3c6882[_0xe5d5('0x62')]){if(_0x3c6882['List'][_0xe5d5('0x63')][_0xe5d5('0x49')]){return _0x3c6882['List'][_0xe5d5('0x63')][0x0];}else{return db['CmContact'][_0xe5d5('0x5c')](_[_0xe5d5('0x1c')](_0x472e21[_0xe5d5('0x5a')],{'firstName':_0x472e21[_0xe5d5('0x5a')]['to'],'email':_0x472e21[_0xe5d5('0x5a')]['to'],'phone':_0x472e21['body']['to'],'ListId':_0x3c6882[_0xe5d5('0x70')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xe5d5('0x39')](function(){if(_0x1feba1){return respondWithRpcPromise(_0xe5d5('0x71'),_0xe5d5('0x72'),_0x1feba1,client9003)['then'](function(_0x5d837e){return _0x2e5b5c[_0xe5d5('0x37')]({'read':!![],'messageId':_0x5d837e['messageId'],'sentAt':moment()[_0xe5d5('0x73')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xe5d5('0x2d')](function(_0x1ed770){logger[_0xe5d5('0x29')]('%s',JSON[_0xe5d5('0x28')](_0x1ed770));return _0x2e5b5c;});}return _0x2e5b5c;});}return _0x2e5b5c;}})['then'](respondWithResult(_0x28dae4,0xc9))[_0xe5d5('0x2d')](handleError(_0x28dae4,null));};var interaction_log=require(_0xe5d5('0x74'))(_0xe5d5('0x75'));exports[_0xe5d5('0x76')]=function(_0x296828,_0x5bf0d3,_0xbc1ecf){var _0xa13624={'channel':_0xe5d5('0x77')};if(_0x296828[_0xe5d5('0x5a')]['id']){delete _0x296828[_0xe5d5('0x5a')]['id'];}_0x296828[_0xe5d5('0x5a')][_0xe5d5('0x78')]=!![];_0x296828[_0xe5d5('0x5a')][_0xe5d5('0x79')]=moment()[_0xe5d5('0x73')](_0xe5d5('0x7a'));_0x296828[_0xe5d5('0x5a')][_0xe5d5('0x7b')]=_0x296828[_0xe5d5('0x5a')][_0xe5d5('0x7b')]||_0x296828['user']['id'];return db['MailMessage'][_0xe5d5('0x59')]({'where':{'id':_0x296828[_0xe5d5('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xe5d5('0x7c')],'as':'Contact'}]})[_0xe5d5('0x39')](handleEntityNotFound(_0x5bf0d3,null))[_0xe5d5('0x39')](saveUpdates(_0x296828['body'],null))[_0xe5d5('0x39')](function(_0x39acea){if(_0x39acea){_0xa13624[_0xe5d5('0x2b')]=_0x39acea[_0xe5d5('0x7d')]({'plain':!![]});return db[_0xe5d5('0x7e')][_0xe5d5('0x59')]({'where':{'id':_0x39acea[_0xe5d5('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x5bf0d3,null))[_0xe5d5('0x39')](function(_0x36f80b){if(_0x36f80b){return _0x36f80b[_0xe5d5('0x37')]({'UserId':_0x296828[_0xe5d5('0x5a')][_0xe5d5('0x7b')],'read1stAt':_[_0xe5d5('0x80')](_0x36f80b[_0xe5d5('0x81')])?moment()[_0xe5d5('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe5d5('0x39')](function(_0x3a4981){if(_0x3a4981){_0xa13624[_0xe5d5('0x82')]=_0x3a4981[_0xe5d5('0x7d')]({'plain':!![]});interaction_log[_0xe5d5('0x23')](_0xe5d5('0x83'),_0x296828[_0xe5d5('0x6b')]['id'],_0x296828[_0xe5d5('0x6b')]['name'],_0x296828[_0xe5d5('0x6b')][_0xe5d5('0x84')],_0xa13624['interaction']['id'],_0x296828[_0xe5d5('0x5a')]?JSON[_0xe5d5('0x28')](_0x296828['body']):_0xe5d5('0x85'));return respondWithRpcPromise('AcceptMessage',_0xe5d5('0x86'),_0xa13624);}return null;})['then'](function(_0x1b0ff1){if(_0x1b0ff1){if(_0x296828[_0xe5d5('0x5a')][_0xe5d5('0x87')]){_0xa13624['message'][_0xe5d5('0x88')]=util[_0xe5d5('0x73')]('SIP/%s',_0x296828[_0xe5d5('0x6b')][_0xe5d5('0x3b')]);_0xa13624['message'][_0xe5d5('0x89')]=_0xa13624['channel'];_0xa13624[_0xe5d5('0x2b')]['event']=_0xe5d5('0x76');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xe5d5('0x8a'),'message':_0xa13624[_0xe5d5('0x2b')]},client9002)[_0xe5d5('0x39')](function(){return _0xa13624;});}return _0xa13624;}return null;})[_0xe5d5('0x39')](respondWithResult(_0x5bf0d3,null))[_0xe5d5('0x2d')](handleError(_0x5bf0d3,null));};var interaction_log=require(_0xe5d5('0x74'))(_0xe5d5('0x75'));exports[_0xe5d5('0x35')]=function(_0x39c642,_0x3ba1cc,_0x579af2){var _0x2e6443={'agent':{},'channel':_0xe5d5('0x77')};if(_0x39c642[_0xe5d5('0x5a')]['id']){delete _0x39c642['body']['id'];}_0x39c642['body'][_0xe5d5('0x7b')]=_0x39c642[_0xe5d5('0x5a')][_0xe5d5('0x7b')]||_0x39c642[_0xe5d5('0x6b')]['id'];_0x2e6443[_0xe5d5('0x8b')]['id']=_0x39c642['body'][_0xe5d5('0x7b')];return db['MailMessage'][_0xe5d5('0x59')]({'where':{'id':_0x39c642[_0xe5d5('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ba1cc,null))[_0xe5d5('0x39')](function(_0x125810){if(_0x125810){_0x2e6443[_0xe5d5('0x2b')]=_0x125810[_0xe5d5('0x7d')]({'plain':!![]});return db[_0xe5d5('0x7e')][_0xe5d5('0x59')]({'where':{'id':_0x125810['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3ba1cc,null))[_0xe5d5('0x39')](function(_0x427119){if(_0x427119){_0x2e6443[_0xe5d5('0x82')]=_0x427119[_0xe5d5('0x7d')]({'plain':!![]});interaction_log[_0xe5d5('0x23')](_0xe5d5('0x8c'),_0x39c642[_0xe5d5('0x6b')]['id'],_0x39c642[_0xe5d5('0x6b')][_0xe5d5('0x3b')],_0x39c642['user'][_0xe5d5('0x84')],_0x2e6443[_0xe5d5('0x82')]['id'],_0x39c642[_0xe5d5('0x5a')]?JSON['stringify'](_0x39c642[_0xe5d5('0x5a')]):_0xe5d5('0x85'));return respondWithRpcPromise(_0xe5d5('0x8d'),_0xe5d5('0x8e'),_0x2e6443);}return null;})['then'](function(_0x5a54da){if(_0x5a54da){_0x5a54da[_0xe5d5('0x2b')][_0xe5d5('0x88')]=util[_0xe5d5('0x73')]('SIP/%s',_0x39c642[_0xe5d5('0x6b')][_0xe5d5('0x3b')]);_0x5a54da[_0xe5d5('0x2b')][_0xe5d5('0x89')]=_0x2e6443[_0xe5d5('0x89')];_0x5a54da[_0xe5d5('0x2b')]['event']=_0xe5d5('0x35');respondWithRpcPromise(_0xe5d5('0x8f'),_0xe5d5('0x8f'),{'event':'rejectmessage','message':_0x5a54da[_0xe5d5('0x2b')]},client9002);return _0x2e6443;}return null;})['then'](respondWithResult(_0x3ba1cc,null))[_0xe5d5('0x2d')](handleError(_0x3ba1cc,null));};exports[_0xe5d5('0x90')]=function(_0x3495ef,_0x222bc6){var _0xa8f878=moment()['unix']()[_0xe5d5('0x91')]();var _0xb2e2d9=path[_0xe5d5('0x92')](config[_0xe5d5('0x6e')],_0xe5d5('0x93'),_0xe5d5('0x94'),_0xe5d5('0x95'));var _0x3472bc=path['join'](config[_0xe5d5('0x6e')],'server',_0xe5d5('0x94'),_0xe5d5('0x6d'));var _0x3b8257=util[_0xe5d5('0x73')](_0xe5d5('0x96'),_0xa8f878);return db['MailMessage']['find']({'where':{'id':_0x3495ef[_0xe5d5('0x58')]['id']},'attributes':['id',_0xe5d5('0x5a'),_0xe5d5('0x97'),'to','cc',_0xe5d5('0x98'),_0xe5d5('0x99'),_0xe5d5('0x9a')],'include':_0x3495ef[_0xe5d5('0x45')][_0xe5d5('0x6d')]?[{'model':db[_0xe5d5('0x9b')],'as':'Attachments'}]:undefined})[_0xe5d5('0x39')](handleEntityNotFound(_0x222bc6,null))[_0xe5d5('0x39')](function(_0x3cd0a4){if(_0x3cd0a4){var _0x4be6c4=_0x3cd0a4;var _0x5e57cf={'from':_0x4be6c4[_0xe5d5('0x97')],'to':_0x4be6c4['to'],'subject':_0x4be6c4['subject'],'html':_0x4be6c4[_0xe5d5('0x5a')],'headers':{'Date':moment(_0x4be6c4['createdAt'])[_0xe5d5('0x73')](_0xe5d5('0x9c'))},'attachments':[]};if(_0x3cd0a4['cc']){_0x5e57cf['headers']['Cc']=_0x3cd0a4['cc'];}if(_0x3cd0a4[_0xe5d5('0x98')]){_0x5e57cf['headers'][_0xe5d5('0x9d')]=_0x3cd0a4[_0xe5d5('0x98')];}return new BPromise(function(_0x5069f1,_0x16e9af){if(_0x3cd0a4[_0xe5d5('0x9e')]){for(var _0x267e75=0x0;_0x267e75<_0x3cd0a4[_0xe5d5('0x9e')][_0xe5d5('0x49')];_0x267e75++){var _0x53364e=_0x3cd0a4['Attachments'][_0x267e75];var _0x5d50d0=path[_0xe5d5('0x92')](_0x3472bc,_0x53364e[_0xe5d5('0x6f')]);if(fs[_0xe5d5('0x9f')](_0x5d50d0)){_0x5e57cf[_0xe5d5('0x6d')][_0xe5d5('0xa0')]({'name':_0x53364e['name'],'contentType':_0x53364e[_0xe5d5('0x40')],'data':fs[_0xe5d5('0xa1')](_0x5d50d0)});}}}emlformat[_0xe5d5('0xa2')](_0x5e57cf,function(_0x4acbf5,_0x423f42){if(_0x4acbf5)return _0x16e9af(_0x4acbf5);fs['writeFileSync'](path[_0xe5d5('0x92')](_0xb2e2d9,_0x3b8257),_0x423f42);return _0x5069f1(_0x423f42);});});}})[_0xe5d5('0x39')](function(_0x994617){if(_0x994617){return _0x222bc6[_0xe5d5('0x90')](path['join'](_0xb2e2d9,_0x3b8257),_0x3b8257,function(_0x4dbda9){if(_0x4dbda9){console[_0xe5d5('0xa3')](_0xe5d5('0xa4'),_0x4dbda9);}else{fs[_0xe5d5('0xa5')](path[_0xe5d5('0x92')](_0xb2e2d9,_0x3b8257));}});}})[_0xe5d5('0x2d')](handleError(_0x222bc6,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d947d9e..c87f451 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 _0x8e46=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x15790f,_0x3dd5a8){var _0x30f02d=function(_0x172114){while(--_0x172114){_0x15790f['push'](_0x15790f['shift']());}};_0x30f02d(++_0x3dd5a8);}(_0x8e46,0x1eb));var _0x68e4=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x8e46[_0x2f2360];return _0x1cc8d3;};'use strict';var EventEmitter=require(_0x68e4('0x0'));var MailMessage=require(_0x68e4('0x1'))['db'][_0x68e4('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x68e4('0x3')](0x0);var events={'afterCreate':_0x68e4('0x4'),'afterUpdate':'update','afterDestroy':_0x68e4('0x5')};function emitEvent(_0xfe149){return function(_0x57aa10,_0x3c7b19,_0x1063ff){MailMessageEvents[_0x68e4('0x6')](_0xfe149+':'+_0x57aa10['id'],_0x57aa10);MailMessageEvents[_0x68e4('0x6')](_0xfe149,_0x57aa10);_0x1063ff(null);};}for(var e in events){if(events[_0x68e4('0x7')](e)){var event=events[e];MailMessage[_0x68e4('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xe760=['hook','exports','events','MailMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x3101a1,_0xc96898){var _0x9459a4=function(_0x3e4c12){while(--_0x3e4c12){_0x3101a1['push'](_0x3101a1['shift']());}};_0x9459a4(++_0xc96898);}(_0xe760,0x158));var _0x0e76=function(_0x583a3f,_0x58c492){_0x583a3f=_0x583a3f-0x0;var _0x5188e4=_0xe760[_0x583a3f];return _0x5188e4;};'use strict';var EventEmitter=require(_0x0e76('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x0e76('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e76('0x2'),'afterUpdate':_0x0e76('0x3'),'afterDestroy':_0x0e76('0x4')};function emitEvent(_0x35db0d){return function(_0x5975b3,_0x444381,_0x58f592){MailMessageEvents[_0x0e76('0x5')](_0x35db0d+':'+_0x5975b3['id'],_0x5975b3);MailMessageEvents['emit'](_0x35db0d,_0x5975b3);_0x58f592(null);};}for(var e in events){if(events[_0x0e76('0x6')](e)){var event=events[e];MailMessage[_0x0e76('0x7')](e,emitEvent(event));}}module[_0x0e76('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 00d074f..8b7f295 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 _0x6972=['error','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','MailInteraction','findOne','then','createdAt','catch'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0x6972,0xbc));var _0x2697=function(_0x3ebee6,_0xd74793){_0x3ebee6=_0x3ebee6-0x0;var _0x32fc02=_0x6972[_0x3ebee6];return _0x32fc02;};'use strict';var _=require(_0x2697('0x0'));var util=require('util');var logger=require(_0x2697('0x1'))('api');var moment=require(_0x2697('0x2'));var BPromise=require(_0x2697('0x3'));var rp=require('request-promise');var htmlToText=require(_0x2697('0x4'));var fs=require('fs');var path=require(_0x2697('0x5'));var rimraf=require(_0x2697('0x6'));var config=require('../../config/environment');var attributes=require(_0x2697('0x7'));module[_0x2697('0x8')]=function(_0x569188,_0x35bd1b){return _0x569188[_0x2697('0x9')](_0x2697('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x2697('0xb'),'fields':['messageId']},{'name':_0x2697('0xc'),'fields':[_0x2697('0xd'),_0x2697('0xe')],'type':_0x2697('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e96ba,_0x2cd945,_0x25dec3){if(_0x2e96ba['body']){_0x2e96ba[_0x2697('0xd')]=htmlToText[_0x2697('0x10')](_0x2e96ba[_0x2697('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x25dec3(null,_0x2cd945);},'afterCreate':function(_0x90e601,_0x1531b5,_0x1ad6b5){var _0x5e8e25=_0x569188[_0x2697('0x12')];var _0x43eaee=_0x90e601[_0x2697('0x13')]({'plain':!![]});if(_0x43eaee[_0x2697('0x14')][_0x2697('0x15')]()==='in'||_0x43eaee[_0x2697('0x14')][_0x2697('0x15')]()===_0x2697('0x16')&&!_0x43eaee[_0x2697('0x17')]&&!_['isNil'](_0x43eaee['UserId'])){_0x5e8e25[_0x2697('0x18')][_0x2697('0x19')]({'where':{'id':_0x43eaee['MailInteractionId']}})[_0x2697('0x1a')](function(_0x2beca4){if(_0x2beca4){_0x2beca4['update']({'lastMsgAt':_0x43eaee[_0x2697('0x1b')],'lastMsgDirection':_0x43eaee[_0x2697('0x14')][_0x2697('0x15')](),'lastMsgBody':_0x43eaee['body']});}})[_0x2697('0x1c')](function(_0x46fc4a){console[_0x2697('0x1d')](_0x46fc4a);});}_0x1ad6b5();}},'charset':'utf8mb4','collate':_0x2697('0x1e')});}; \ No newline at end of file +var _0xbb1e=['createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update'];(function(_0xfe1a94,_0x98b74d){var _0x46ea57=function(_0x5cf80c){while(--_0x5cf80c){_0xfe1a94['push'](_0xfe1a94['shift']());}};_0x46ea57(++_0x98b74d);}(_0xbb1e,0xbd));var _0xebb1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbb1e[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xebb1('0x0'));var util=require(_0xebb1('0x1'));var logger=require(_0xebb1('0x2'))(_0xebb1('0x3'));var moment=require(_0xebb1('0x4'));var BPromise=require(_0xebb1('0x5'));var rp=require(_0xebb1('0x6'));var htmlToText=require(_0xebb1('0x7'));var fs=require('fs');var path=require(_0xebb1('0x8'));var rimraf=require(_0xebb1('0x9'));var config=require(_0xebb1('0xa'));var attributes=require('./mailMessage.attributes');module[_0xebb1('0xb')]=function(_0x5cfb1c,_0x233c69){return _0x5cfb1c[_0xebb1('0xc')](_0xebb1('0xd'),attributes,{'tableName':_0xebb1('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xebb1('0xf')]},{'name':_0xebb1('0x10'),'fields':[_0xebb1('0x11'),_0xebb1('0x12')],'type':_0xebb1('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x251058,_0x2a5051,_0x468c67){if(_0x251058[_0xebb1('0x14')]){_0x251058[_0xebb1('0x11')]=htmlToText[_0xebb1('0x15')](_0x251058[_0xebb1('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x468c67(null,_0x2a5051);},'afterCreate':function(_0x257ca5,_0xa08f64,_0x2bd7f7){var _0x486f21=_0x5cfb1c[_0xebb1('0x16')];var _0x54aa2b=_0x257ca5['get']({'plain':!![]});if(_0x54aa2b[_0xebb1('0x17')][_0xebb1('0x18')]()==='in'||_0x54aa2b[_0xebb1('0x17')]['toLowerCase']()===_0xebb1('0x19')&&!_0x54aa2b[_0xebb1('0x1a')]&&!_['isNil'](_0x54aa2b[_0xebb1('0x1b')])){_0x486f21[_0xebb1('0x1c')][_0xebb1('0x1d')]({'where':{'id':_0x54aa2b[_0xebb1('0x1e')]}})[_0xebb1('0x1f')](function(_0x19bfcd){if(_0x19bfcd){_0x19bfcd[_0xebb1('0x20')]({'lastMsgAt':_0x54aa2b[_0xebb1('0x21')],'lastMsgDirection':_0x54aa2b[_0xebb1('0x17')][_0xebb1('0x18')](),'lastMsgBody':_0x54aa2b[_0xebb1('0x14')]});}})[_0xebb1('0x22')](function(_0x5eefc9){console['error'](_0x5eefc9);});}_0x2bd7f7();}},'charset':_0xebb1('0x23'),'collate':_0xebb1('0x24')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d1692c5..cb82fa7 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 _0x1c42=['result','catch','CreateMailMessage','MailMessage','create','options','raw','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','register','request','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x3d20d8,_0x3d873b){var _0x24d71d=function(_0x4b879c){while(--_0x4b879c){_0x3d20d8['push'](_0x3d20d8['shift']());}};_0x24d71d(++_0x3d873b);}(_0x1c42,0x13a));var _0x21c4=function(_0x4a7561,_0x40e232){_0x4a7561=_0x4a7561-0x0;var _0x30c313=_0x1c42[_0x4a7561];return _0x30c313;};'use strict';var _=require('lodash');var util=require(_0x21c4('0x0'));var moment=require(_0x21c4('0x1'));var BPromise=require(_0x21c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21c4('0x3'));var db=require(_0x21c4('0x4'))['db'];var utils=require(_0x21c4('0x5'));var logger=require(_0x21c4('0x6'))(_0x21c4('0x7'));var config=require(_0x21c4('0x8'));var jayson=require(_0x21c4('0x9'));var client=jayson[_0x21c4('0xa')]['http']({'port':0x232a});config[_0x21c4('0xb')]=_[_0x21c4('0xc')](config['redis'],{'host':_0x21c4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21c4('0xb')]));require(_0x21c4('0xe'))[_0x21c4('0xf')](socket);function respondWithRpcPromise(_0xe89bd0,_0x135282,_0x2367f1){return new BPromise(function(_0x315c30,_0x3d147a){return client[_0x21c4('0x10')](_0xe89bd0,_0x2367f1)['then'](function(_0xa58fa5){logger['info'](_0x21c4('0x11'),_0x135282,'request\x20sent');logger[_0x21c4('0x12')](_0x21c4('0x13'),_0x135282,_0x21c4('0x14'),JSON[_0x21c4('0x15')](_0xa58fa5));if(_0xa58fa5[_0x21c4('0x16')]){if(_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x17')]===0x1f4){logger[_0x21c4('0x16')](_0x21c4('0x11'),_0x135282,_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);return _0x3d147a(_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x135282,_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);return _0x315c30(_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);}else{logger[_0x21c4('0x19')](_0x21c4('0x11'),_0x135282,_0x21c4('0x14'));_0x315c30(_0xa58fa5[_0x21c4('0x1a')][_0x21c4('0x18')]);}})[_0x21c4('0x1b')](function(_0x373e83){logger[_0x21c4('0x16')](_0x21c4('0x11'),_0x135282,_0x373e83);_0x3d147a(_0x373e83);});});}exports[_0x21c4('0x1c')]=function(_0x2d0bf4){var _0x3d6c5c=this;return new Promise(function(_0x529c7c,_0x4ad6ed){return db[_0x21c4('0x1d')][_0x21c4('0x1e')](_0x2d0bf4['body'],{'raw':_0x2d0bf4[_0x21c4('0x1f')]?_0x2d0bf4['options'][_0x21c4('0x20')]===undefined?!![]:![]:!![]})[_0x21c4('0x21')](function(_0x42091a){logger[_0x21c4('0x19')](_0x21c4('0x1c'),_0x2d0bf4);logger[_0x21c4('0x12')](_0x21c4('0x1c'),_0x2d0bf4,JSON[_0x21c4('0x15')](_0x42091a));_0x529c7c(_0x42091a);})[_0x21c4('0x1b')](function(_0x58c25f){logger['error'](_0x21c4('0x1c'),_0x58c25f['message'],_0x2d0bf4);_0x4ad6ed(_0x3d6c5c[_0x21c4('0x16')](0x1f4,_0x58c25f[_0x21c4('0x18')]));});});}; \ No newline at end of file +var _0xc9cc=['debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','MailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x579594,_0x1059ce){var _0x500153=function(_0x5d3b57){while(--_0x5d3b57){_0x579594['push'](_0x579594['shift']());}};_0x500153(++_0x1059ce);}(_0xc9cc,0xb0));var _0xcc9c=function(_0x3fb2d4,_0x44a3a8){_0x3fb2d4=_0x3fb2d4-0x0;var _0x4cfd9a=_0xc9cc[_0x3fb2d4];return _0x4cfd9a;};'use strict';var _=require(_0xcc9c('0x0'));var util=require(_0xcc9c('0x1'));var moment=require(_0xcc9c('0x2'));var BPromise=require(_0xcc9c('0x3'));var rs=require(_0xcc9c('0x4'));var fs=require('fs');var Redis=require(_0xcc9c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcc9c('0x6'))('rpc');var config=require(_0xcc9c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcc9c('0x8')]['http']({'port':0x232a});config[_0xcc9c('0x9')]=_[_0xcc9c('0xa')](config[_0xcc9c('0x9')],{'host':_0xcc9c('0xb'),'port':0x18eb});var socket=require(_0xcc9c('0xc'))(new Redis(config[_0xcc9c('0x9')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2718c0,_0x51e407,_0x28f011){return new BPromise(function(_0x59cf8a,_0xb8e960){return client[_0xcc9c('0xd')](_0x2718c0,_0x28f011)['then'](function(_0x57974a){logger['info'](_0xcc9c('0xe'),_0x51e407,_0xcc9c('0xf'));logger[_0xcc9c('0x10')](_0xcc9c('0x11'),_0x51e407,_0xcc9c('0xf'),JSON[_0xcc9c('0x12')](_0x57974a));if(_0x57974a[_0xcc9c('0x13')]){if(_0x57974a['error'][_0xcc9c('0x14')]===0x1f4){logger[_0xcc9c('0x13')](_0xcc9c('0xe'),_0x51e407,_0x57974a[_0xcc9c('0x13')][_0xcc9c('0x15')]);return _0xb8e960(_0x57974a[_0xcc9c('0x13')][_0xcc9c('0x15')]);}logger[_0xcc9c('0x13')]('MailMessage,\x20%s,\x20%s',_0x51e407,_0x57974a[_0xcc9c('0x13')][_0xcc9c('0x15')]);return _0x59cf8a(_0x57974a[_0xcc9c('0x13')][_0xcc9c('0x15')]);}else{logger[_0xcc9c('0x16')](_0xcc9c('0xe'),_0x51e407,_0xcc9c('0xf'));_0x59cf8a(_0x57974a[_0xcc9c('0x17')]['message']);}})[_0xcc9c('0x18')](function(_0x423759){logger[_0xcc9c('0x13')](_0xcc9c('0xe'),_0x51e407,_0x423759);_0xb8e960(_0x423759);});});}exports[_0xcc9c('0x19')]=function(_0x564082){var _0xf90c4=this;return new Promise(function(_0x5e6ea2,_0x447364){return db[_0xcc9c('0x1a')][_0xcc9c('0x1b')](_0x564082[_0xcc9c('0x1c')],{'raw':_0x564082[_0xcc9c('0x1d')]?_0x564082[_0xcc9c('0x1d')][_0xcc9c('0x1e')]===undefined?!![]:![]:!![]})[_0xcc9c('0x1f')](function(_0x34a940){logger[_0xcc9c('0x16')](_0xcc9c('0x19'),_0x564082);logger[_0xcc9c('0x10')](_0xcc9c('0x19'),_0x564082,JSON[_0xcc9c('0x12')](_0x34a940));_0x5e6ea2(_0x34a940);})['catch'](function(_0xe116a5){logger[_0xcc9c('0x13')]('CreateMailMessage',_0xe116a5[_0xcc9c('0x15')],_0x564082);_0x447364(_0xf90c4[_0xcc9c('0x13')](0x1f4,_0xe116a5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b47aeb5..7dd2dbc 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 _0x749e=['length','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x28f86a,_0x5614c2){var _0x200ab8=function(_0x5dce6d){while(--_0x5dce6d){_0x28f86a['push'](_0x28f86a['shift']());}};_0x200ab8(++_0x5614c2);}(_0x749e,0x171));var _0xe749=function(_0x457f2e,_0x431c2a){_0x457f2e=_0x457f2e-0x0;var _0x2d0b8b=_0x749e[_0x457f2e];return _0x2d0b8b;};'use strict';var MailMessageEvents=require(_0xe749('0x0'));var events=[_0xe749('0x1'),_0xe749('0x2'),_0xe749('0x3')];function createListener(_0x2f7f96,_0x4c7a69){return function(_0xc1babb){_0x4c7a69[_0xe749('0x4')](_0x2f7f96,_0xc1babb);};}function removeListener(_0x1988cb,_0x13500d){return function(){MailMessageEvents[_0xe749('0x5')](_0x1988cb,_0x13500d);};}exports[_0xe749('0x6')]=function(_0x17879f){for(var _0x380a33=0x0,_0x10c39f=events[_0xe749('0x7')];_0x380a33<_0x10c39f;_0x380a33++){var _0x38e370=events[_0x380a33];var _0xf28c5f=createListener('mailMessage:'+_0x38e370,_0x17879f);MailMessageEvents['on'](_0x38e370,_0xf28c5f);}}; \ No newline at end of file +var _0x425d=['save','remove','update','emit','removeListener','length','./mailMessage.events'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x425d,0x179));var _0xd425=function(_0xca82a4,_0x407eb4){_0xca82a4=_0xca82a4-0x0;var _0x5eed21=_0x425d[_0xca82a4];return _0x5eed21;};'use strict';var MailMessageEvents=require(_0xd425('0x0'));var events=[_0xd425('0x1'),_0xd425('0x2'),_0xd425('0x3')];function createListener(_0x22f12f,_0x50eee4){return function(_0x1f10db){_0x50eee4[_0xd425('0x4')](_0x22f12f,_0x1f10db);};}function removeListener(_0x1a8186,_0x5127d8){return function(){MailMessageEvents[_0xd425('0x5')](_0x1a8186,_0x5127d8);};}exports['register']=function(_0x4377e9){for(var _0x3b6510=0x0,_0x4c7ed5=events[_0xd425('0x6')];_0x3b6510<_0x4c7ed5;_0x3b6510++){var _0x37cda8=events[_0x3b6510];var _0x3a047c=createListener('mailMessage:'+_0x37cda8,_0x4377e9);MailMessageEvents['on'](_0x37cda8,_0x3a047c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8ec8ae0..cbf4d95 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 _0x00a0=['removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','delete','destroy'];(function(_0x561001,_0x3ad884){var _0x55c45e=function(_0x2e97f2){while(--_0x2e97f2){_0x561001['push'](_0x561001['shift']());}};_0x55c45e(++_0x3ad884);}(_0x00a0,0x7b));var _0x000a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x00a0[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x000a('0x0'));var util=require(_0x000a('0x1'));var path=require(_0x000a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x000a('0x3')]();var auth=require(_0x000a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x000a('0x5'));var controller=require(_0x000a('0x6'));router[_0x000a('0x7')]('/',auth[_0x000a('0x8')](),controller[_0x000a('0x9')]);router[_0x000a('0x7')](_0x000a('0xa'),auth[_0x000a('0x8')](),controller[_0x000a('0xb')]);router[_0x000a('0x7')](_0x000a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x000a('0x7')](_0x000a('0xd'),auth[_0x000a('0x8')](),controller[_0x000a('0xe')]);router[_0x000a('0x7')]('/:id/teams',auth[_0x000a('0x8')](),controller['getTeams']);router[_0x000a('0x7')](_0x000a('0xf'),auth['isAuthenticated'](),controller[_0x000a('0x10')]);router[_0x000a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x000a('0x11')](_0x000a('0x12'),auth[_0x000a('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x000a('0x8')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x000a('0x13')](_0x000a('0xc'),auth[_0x000a('0x8')](),controller[_0x000a('0x14')]);router[_0x000a('0x13')](_0x000a('0x12'),auth[_0x000a('0x8')](),controller[_0x000a('0x15')]);router[_0x000a('0x13')](_0x000a('0xf'),auth[_0x000a('0x8')](),controller[_0x000a('0x16')]);module[_0x000a('0x17')]=router; \ No newline at end of file +var _0x12fa=['/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x68c4d9,_0x419b3c){var _0x62da93=function(_0x51ae9a){while(--_0x51ae9a){_0x68c4d9['push'](_0x68c4d9['shift']());}};_0x62da93(++_0x419b3c);}(_0x12fa,0x130));var _0xa12f=function(_0x476583,_0x23b0c6){_0x476583=_0x476583-0x0;var _0x1e3113=_0x12fa[_0x476583];return _0x1e3113;};'use strict';var multer=require(_0xa12f('0x0'));var util=require(_0xa12f('0x1'));var path=require(_0xa12f('0x2'));var timeout=require('connect-timeout');var express=require(_0xa12f('0x3'));var router=express[_0xa12f('0x4')]();var auth=require(_0xa12f('0x5'));var interaction=require(_0xa12f('0x6'));var config=require('../../config/environment');var controller=require(_0xa12f('0x7'));router[_0xa12f('0x8')]('/',auth[_0xa12f('0x9')](),controller[_0xa12f('0xa')]);router[_0xa12f('0x8')](_0xa12f('0xb'),auth[_0xa12f('0x9')](),controller[_0xa12f('0xc')]);router['get'](_0xa12f('0xd'),auth['isAuthenticated'](),controller[_0xa12f('0xe')]);router[_0xa12f('0x8')](_0xa12f('0xf'),auth[_0xa12f('0x9')](),controller['getMembers']);router[_0xa12f('0x8')](_0xa12f('0x10'),auth[_0xa12f('0x9')](),controller[_0xa12f('0x11')]);router['get'](_0xa12f('0x12'),auth[_0xa12f('0x9')](),controller[_0xa12f('0x13')]);router[_0xa12f('0x14')]('/',auth[_0xa12f('0x9')](),controller[_0xa12f('0x15')]);router['post'](_0xa12f('0x10'),auth[_0xa12f('0x9')](),controller[_0xa12f('0x16')]);router[_0xa12f('0x14')](_0xa12f('0x12'),auth[_0xa12f('0x9')](),controller[_0xa12f('0x17')]);router['put'](_0xa12f('0xd'),auth[_0xa12f('0x9')](),controller[_0xa12f('0x18')]);router[_0xa12f('0x19')](_0xa12f('0xd'),auth[_0xa12f('0x9')](),controller['destroy']);router[_0xa12f('0x19')](_0xa12f('0x10'),auth[_0xa12f('0x9')](),controller[_0xa12f('0x1a')]);router[_0xa12f('0x19')](_0xa12f('0x12'),auth['isAuthenticated'](),controller[_0xa12f('0x1b')]);module[_0xa12f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 470f71d..e6a0ce4 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 _0x78e7=['rrmemory','beepall','roundrobin','exports','STRING','ENUM'];(function(_0x17c2a4,_0xfd9bab){var _0x58f01c=function(_0x375968){while(--_0x375968){_0x17c2a4['push'](_0x17c2a4['shift']());}};_0x58f01c(++_0xfd9bab);}(_0x78e7,0x17d));var _0x778e=function(_0x438b8e,_0x453d8b){_0x438b8e=_0x438b8e-0x0;var _0x52b3f8=_0x78e7[_0x438b8e];return _0x52b3f8;};'use strict';var Sequelize=require('sequelize');module[_0x778e('0x0')]={'name':{'type':Sequelize[_0x778e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x778e('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x778e('0x2')](_0x778e('0x3'),_0x778e('0x4'),_0x778e('0x5'))}}; \ No newline at end of file +var _0x0424=['rrmemory','STRING','name','INTEGER'];(function(_0x3f2abd,_0x23b3a9){var _0x3d8338=function(_0x26d053){while(--_0x26d053){_0x3f2abd['push'](_0x3f2abd['shift']());}};_0x3d8338(++_0x23b3a9);}(_0x0424,0x159));var _0x4042=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x0424[_0x54f7c0];return _0x245d03;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4042('0x0')]},'timeout':{'type':Sequelize[_0x4042('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4042('0x3'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index bf27644..9acabd0 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 _0x4a1d=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','MailQueueId','findAll','UserId','agent','mailPause','SIP','createdAt','updatedAt','getTeams','Team','pick','ids','User','voicePause','interface','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','select','field','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','removeTeams','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x33d427,_0x47c8c2){var _0x383dbd=function(_0x578493){while(--_0x578493){_0x33d427['push'](_0x33d427['shift']());}};_0x383dbd(++_0x47c8c2);}(_0x4a1d,0x77));var _0xd4a1=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4a1d[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0xd4a1('0x0'));var emlformat=require(_0xd4a1('0x1'));var rimraf=require(_0xd4a1('0x2'));var zipdir=require(_0xd4a1('0x3'));var jsonpatch=require(_0xd4a1('0x4'));var rp=require('request-promise');var moment=require(_0xd4a1('0x5'));var BPromise=require(_0xd4a1('0x6'));var Mustache=require(_0xd4a1('0x7'));var util=require(_0xd4a1('0x8'));var path=require(_0xd4a1('0x9'));var sox=require(_0xd4a1('0xa'));var csv=require(_0xd4a1('0xb'));var ejs=require(_0xd4a1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd4a1('0xd'));var crypto=require(_0xd4a1('0xe'));var jsforce=require(_0xd4a1('0xf'));var deskjs=require(_0xd4a1('0x10'));var toCsv=require(_0xd4a1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4a1('0x11'));var authService=require(_0xd4a1('0x12'));var qs=require(_0xd4a1('0x13'));var as=require(_0xd4a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a1('0x15'))(_0xd4a1('0x16'));var utils=require(_0xd4a1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd4a1('0x18'));var db=require(_0xd4a1('0x19'))['db'];config[_0xd4a1('0x1a')]=_[_0xd4a1('0x1b')](config['redis'],{'host':_0xd4a1('0x1c'),'port':0x18eb});var socket=require(_0xd4a1('0x1d'))(new Redis(config[_0xd4a1('0x1a')]));require('./mailQueue.socket')[_0xd4a1('0x1e')](socket);function respondWithStatusCode(_0xafabbe,_0x23807c){_0x23807c=_0x23807c||0xcc;return function(_0x40138e){if(_0x40138e){return _0xafabbe['sendStatus'](_0x23807c);}return _0xafabbe['status'](_0x23807c)[_0xd4a1('0x1f')]();};}function respondWithResult(_0x41f682,_0x207d33){_0x207d33=_0x207d33||0xc8;return function(_0x21d0c7){if(_0x21d0c7){return _0x41f682[_0xd4a1('0x20')](_0x207d33)['json'](_0x21d0c7);}};}function respondWithFilteredResult(_0x3f1f8b,_0x20530d){return function(_0x13a6e6){if(_0x13a6e6){var _0xe73553=_0x13a6e6[_0xd4a1('0x21')],_0x1276e2=_0x20530d[_0xd4a1('0x22')],_0x51e932=_0x20530d['offset']+_0x20530d[_0xd4a1('0x23')],_0x1cc48d;if(_0x51e932>=_0xe73553){_0x51e932=_0xe73553;_0x1cc48d=0xc8;}else{_0x1cc48d=0xce;}_0x3f1f8b[_0xd4a1('0x20')](_0x1cc48d);return _0x3f1f8b[_0xd4a1('0x24')](_0xd4a1('0x25'),_0x1276e2+'-'+_0x51e932+'/'+_0xe73553)[_0xd4a1('0x26')](_0x13a6e6);}return null;};}function patchUpdates(_0x180e1f){return function(_0x2be7af){try{jsonpatch[_0xd4a1('0x27')](_0x2be7af,_0x180e1f,!![]);}catch(_0x4fdc36){return BPromise[_0xd4a1('0x28')](_0x4fdc36);}return _0x2be7af[_0xd4a1('0x29')]();};}function saveUpdates(_0x4b1876,_0x31b853){return function(_0x52ef5e){if(_0x52ef5e){return _0x52ef5e[_0xd4a1('0x2a')](_0x4b1876)[_0xd4a1('0x2b')](function(_0xb5e1d4){return _0xb5e1d4;});}return null;};}function removeEntity(_0x4ec590,_0x560ee1){return function(_0x197d08){if(_0x197d08){return _0x197d08[_0xd4a1('0x2c')]()['then'](function(){var _0x58bb02=_0x197d08[_0xd4a1('0x2d')]({'plain':!![]});var _0x105aa1=_0xd4a1('0x2e');return db[_0xd4a1('0x2f')][_0xd4a1('0x2c')]({'where':{'type':_0x105aa1,'resourceId':_0x58bb02['id']}})[_0xd4a1('0x2b')](function(){return _0x197d08;});})[_0xd4a1('0x2b')](function(){_0x4ec590[_0xd4a1('0x20')](0xcc)[_0xd4a1('0x1f')]();});}};}function handleEntityNotFound(_0x366d63,_0x2b5789){return function(_0xa5351e){if(!_0xa5351e){_0x366d63['sendStatus'](0x194);}return _0xa5351e;};}function handleError(_0x4eeed8,_0x4df499){_0x4df499=_0x4df499||0x1f4;return function(_0x8973c4){logger['error'](_0x8973c4[_0xd4a1('0x30')]);if(_0x8973c4[_0xd4a1('0x31')]){delete _0x8973c4[_0xd4a1('0x31')];}_0x4eeed8['status'](_0x4df499)[_0xd4a1('0x32')](_0x8973c4);};}exports[_0xd4a1('0x33')]=function(_0x5dd895,_0x51419d){var _0x386fa={},_0x115ae7={},_0x3042ac={'count':0x0,'rows':[]};var _0x162a20=_[_0xd4a1('0x34')](db[_0xd4a1('0x35')][_0xd4a1('0x36')],function(_0x5ae0ed){return{'name':_0x5ae0ed[_0xd4a1('0x37')],'type':_0x5ae0ed['type'][_0xd4a1('0x38')]};});_0x115ae7[_0xd4a1('0x39')]=_['map'](_0x162a20,_0xd4a1('0x31'));_0x115ae7[_0xd4a1('0x3a')]=_['keys'](_0x5dd895[_0xd4a1('0x3a')]);_0x115ae7[_0xd4a1('0x3b')]=_['intersection'](_0x115ae7[_0xd4a1('0x39')],_0x115ae7['query']);_0x386fa[_0xd4a1('0x3c')]=_[_0xd4a1('0x3d')](_0x115ae7[_0xd4a1('0x39')],qs[_0xd4a1('0x3e')](_0x5dd895[_0xd4a1('0x3a')]['fields']));_0x386fa[_0xd4a1('0x3c')]=_0x386fa[_0xd4a1('0x3c')][_0xd4a1('0x3f')]?_0x386fa['attributes']:_0x115ae7[_0xd4a1('0x39')];if(!_0x5dd895[_0xd4a1('0x3a')]['hasOwnProperty']('nolimit')){_0x386fa['limit']=qs[_0xd4a1('0x23')](_0x5dd895['query']['limit']);_0x386fa[_0xd4a1('0x22')]=qs[_0xd4a1('0x22')](_0x5dd895['query']['offset']);}_0x386fa[_0xd4a1('0x40')]=qs[_0xd4a1('0x41')](_0x5dd895['query'][_0xd4a1('0x41')]);_0x386fa['where']=qs[_0xd4a1('0x3b')](_['pick'](_0x5dd895[_0xd4a1('0x3a')],_0x115ae7['filters']),_0x162a20);if(_0x5dd895[_0xd4a1('0x3a')][_0xd4a1('0x42')]){_0x386fa[_0xd4a1('0x43')]=_[_0xd4a1('0x44')](_0x386fa['where'],{'$or':_['map'](_0x162a20,function(_0x833339){if(_0x833339[_0xd4a1('0x45')]!==_0xd4a1('0x46')){var _0x26a0c8={};_0x26a0c8[_0x833339['name']]={'$like':'%'+_0x5dd895['query']['filter']+'%'};return _0x26a0c8;}})});}_0x386fa=_[_0xd4a1('0x44')]({},_0x386fa,_0x5dd895[_0xd4a1('0x47')]);var _0x1c4c0b={'where':_0x386fa[_0xd4a1('0x43')]};return db[_0xd4a1('0x35')][_0xd4a1('0x21')](_0x1c4c0b)[_0xd4a1('0x2b')](function(_0x536688){_0x3042ac['count']=_0x536688;if(_0x5dd895[_0xd4a1('0x3a')][_0xd4a1('0x48')]){_0x386fa[_0xd4a1('0x49')]=[{'all':!![]}];}return db[_0xd4a1('0x35')]['findAll'](_0x386fa);})[_0xd4a1('0x2b')](function(_0x3719ba){_0x3042ac[_0xd4a1('0x4a')]=_0x3719ba;return _0x3042ac;})[_0xd4a1('0x2b')](respondWithFilteredResult(_0x51419d,_0x386fa))['catch'](handleError(_0x51419d,null));};exports[_0xd4a1('0x4b')]=function(_0x391f2f,_0xa01c5f){var _0x5c9436={'raw':!![],'where':{'id':_0x391f2f[_0xd4a1('0x4c')]['id']}},_0x74ab01={};_0x74ab01['model']=_[_0xd4a1('0x4d')](db['MailQueue'][_0xd4a1('0x36')]);_0x74ab01[_0xd4a1('0x3a')]=_[_0xd4a1('0x4d')](_0x391f2f[_0xd4a1('0x3a')]);_0x74ab01['filters']=_[_0xd4a1('0x3d')](_0x74ab01[_0xd4a1('0x39')],_0x74ab01[_0xd4a1('0x3a')]);_0x5c9436[_0xd4a1('0x3c')]=_['intersection'](_0x74ab01[_0xd4a1('0x39')],qs[_0xd4a1('0x3e')](_0x391f2f[_0xd4a1('0x3a')][_0xd4a1('0x3e')]));_0x5c9436[_0xd4a1('0x3c')]=_0x5c9436[_0xd4a1('0x3c')]['length']?_0x5c9436[_0xd4a1('0x3c')]:_0x74ab01[_0xd4a1('0x39')];if(_0x391f2f[_0xd4a1('0x3a')][_0xd4a1('0x48')]){_0x5c9436[_0xd4a1('0x49')]=[{'all':!![]}];}_0x5c9436=_[_0xd4a1('0x44')]({},_0x5c9436,_0x391f2f[_0xd4a1('0x47')]);return db[_0xd4a1('0x35')][_0xd4a1('0x4e')](_0x5c9436)[_0xd4a1('0x2b')](handleEntityNotFound(_0xa01c5f,null))[_0xd4a1('0x2b')](respondWithResult(_0xa01c5f,null))['catch'](handleError(_0xa01c5f,null));};exports[_0xd4a1('0x4f')]=function(_0xaabac9,_0x26e29d){return db[_0xd4a1('0x35')][_0xd4a1('0x4f')](_0xaabac9[_0xd4a1('0x50')],{})[_0xd4a1('0x2b')](function(_0x1c1153){var _0x97c330=_0xaabac9[_0xd4a1('0x51')][_0xd4a1('0x2d')]({'plain':!![]});if(!_0x97c330)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x97c330[_0xd4a1('0x52')]===_0xd4a1('0x51')){var _0x3c3aa7=_0x1c1153['get']({'plain':!![]});var _0x342bcb='MailQueues';return db[_0xd4a1('0x53')][_0xd4a1('0x4e')]({'where':{'name':_0x342bcb,'userProfileId':_0x97c330[_0xd4a1('0x54')]},'raw':!![]})[_0xd4a1('0x2b')](function(_0xa671f5){if(_0xa671f5&&_0xa671f5[_0xd4a1('0x55')]===0x0){return db[_0xd4a1('0x2f')][_0xd4a1('0x4f')]({'name':_0x3c3aa7[_0xd4a1('0x31')],'resourceId':_0x3c3aa7['id'],'type':_0xa671f5[_0xd4a1('0x31')],'sectionId':_0xa671f5['id']},{})[_0xd4a1('0x2b')](function(){return _0x1c1153;});}else{return _0x1c1153;}})[_0xd4a1('0x56')](function(_0x3cd228){logger[_0xd4a1('0x57')](_0xd4a1('0x58'),_0x3cd228);throw _0x3cd228;});}return _0x1c1153;})['then'](respondWithResult(_0x26e29d,0xc9))['catch'](handleError(_0x26e29d,null));};exports['update']=function(_0x205749,_0x1f853b){if(_0x205749[_0xd4a1('0x50')]['id']){delete _0x205749['body']['id'];}return db[_0xd4a1('0x35')]['find']({'where':{'id':_0x205749[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x1f853b,null))['then'](saveUpdates(_0x205749['body'],null))[_0xd4a1('0x2b')](respondWithResult(_0x1f853b,null))['catch'](handleError(_0x1f853b,null));};exports[_0xd4a1('0x2c')]=function(_0x1d2eb6,_0x274976){return db['MailQueue'][_0xd4a1('0x4e')]({'where':{'id':_0x1d2eb6[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x274976,null))[_0xd4a1('0x2b')](removeEntity(_0x274976,null))['catch'](handleError(_0x274976,null));};exports['describe']=function(_0x4d370b,_0x52fac6){return db[_0xd4a1('0x35')][_0xd4a1('0x59')]()[_0xd4a1('0x2b')](respondWithResult(_0x52fac6,null))[_0xd4a1('0x56')](handleError(_0x52fac6,null));};exports[_0xd4a1('0x5a')]=function(_0x4770f9,_0x435ed3,_0x3ea756){var _0x19d799={'raw':!![],'where':{}},_0x188225={},_0x42fb90;return db['MailQueue'][_0xd4a1('0x5b')]({'where':{'id':_0x4770f9['params']['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x435ed3,null))[_0xd4a1('0x2b')](function(_0x2b449a){if(_0x2b449a){_0x42fb90=_0x2b449a['get']({'plain':!![]});_0x188225['model']=_[_0xd4a1('0x4d')](db[_0xd4a1('0x5c')][_0xd4a1('0x36')]);_0x188225['query']=_[_0xd4a1('0x4d')](_0x4770f9[_0xd4a1('0x3a')]);_0x188225[_0xd4a1('0x3b')]=_[_0xd4a1('0x3d')](_0x188225[_0xd4a1('0x39')],_0x188225['query']);_0x19d799['attributes']=_[_0xd4a1('0x3d')](_0x188225[_0xd4a1('0x39')],qs[_0xd4a1('0x3e')](_0x4770f9['query'][_0xd4a1('0x3e')]));_0x19d799[_0xd4a1('0x3c')]=_0x19d799[_0xd4a1('0x3c')]['length']?_0x19d799[_0xd4a1('0x3c')]:_0x188225[_0xd4a1('0x39')];if(!_0x4770f9['query'][_0xd4a1('0x5d')](_0xd4a1('0x5e'))){_0x19d799['limit']=qs[_0xd4a1('0x23')](_0x4770f9[_0xd4a1('0x3a')][_0xd4a1('0x23')]);_0x19d799[_0xd4a1('0x22')]=qs['offset'](_0x4770f9[_0xd4a1('0x3a')]['offset']);}_0x19d799['order']=qs[_0xd4a1('0x41')](_0x4770f9[_0xd4a1('0x3a')]['sort']);_0x19d799['where']=qs['filters'](_['pick'](_0x4770f9[_0xd4a1('0x3a')],_0x188225[_0xd4a1('0x3b')]));_0x19d799['where'][_0xd4a1('0x5f')]=_0x2b449a['id'];if(_0x4770f9['query'][_0xd4a1('0x42')]){_0x19d799['where']=_[_0xd4a1('0x44')](_0x19d799[_0xd4a1('0x43')],{'$or':_[_0xd4a1('0x34')](_0x19d799[_0xd4a1('0x3c')],function(_0x2aad0d){var _0x1a1e18={};_0x1a1e18[_0x2aad0d]={'$like':'%'+_0x4770f9[_0xd4a1('0x3a')]['filter']+'%'};return _0x1a1e18;})});}_0x19d799=_['merge']({},_0x19d799,_0x4770f9[_0xd4a1('0x47')]);return db[_0xd4a1('0x5c')][_0xd4a1('0x60')](_0x19d799);}})[_0xd4a1('0x2b')](function(_0x44ed24){if(_0x44ed24){return db['User']['findAndCountAll']({'where':{'id':_[_0xd4a1('0x34')](_0x44ed24,_0xd4a1('0x61')),'role':_0xd4a1('0x62')},'attributes':['id',_0xd4a1('0x31'),_0xd4a1('0x63'),'updatedAt','createdAt']});}})[_0xd4a1('0x2b')](function(_0x130b37){if(_0x130b37){return{'count':_0x130b37[_0xd4a1('0x21')],'rows':_[_0xd4a1('0x34')](_0x130b37[_0xd4a1('0x4a')],function(_0x17a690){return{'membername':_0x17a690[_0xd4a1('0x31')],'UserId':_0x17a690['id'],'queue_name':_0x42fb90[_0xd4a1('0x31')],'MailQueueId':_0x42fb90['id'],'interface':util['format']('%s/%s',_0xd4a1('0x64'),_0x17a690[_0xd4a1('0x31')]),'penalty':0x0,'paused':_0x17a690[_0xd4a1('0x63')],'createdAt':_0x17a690[_0xd4a1('0x65')],'updatedAt':_0x17a690[_0xd4a1('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd4a1('0x2b')](respondWithFilteredResult(_0x435ed3,_0x19d799))[_0xd4a1('0x56')](handleError(_0x435ed3,null));};exports[_0xd4a1('0x67')]=function(_0x3e46d5,_0x11baef,_0x44424d){var _0x41a384={};var _0xfd506d={};var _0x2b97c0;var _0x1510d5;return db[_0xd4a1('0x35')]['findOne']({'where':{'id':_0x3e46d5[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x11baef,null))[_0xd4a1('0x2b')](function(_0x494f51){if(_0x494f51){_0x2b97c0=_0x494f51;_0xfd506d[_0xd4a1('0x39')]=_[_0xd4a1('0x4d')](db[_0xd4a1('0x68')]['rawAttributes']);_0xfd506d[_0xd4a1('0x3a')]=_[_0xd4a1('0x4d')](_0x3e46d5[_0xd4a1('0x3a')]);_0xfd506d[_0xd4a1('0x3b')]=_[_0xd4a1('0x3d')](_0xfd506d[_0xd4a1('0x39')],_0xfd506d['query']);_0x41a384[_0xd4a1('0x3c')]=_[_0xd4a1('0x3d')](_0xfd506d['model'],qs[_0xd4a1('0x3e')](_0x3e46d5[_0xd4a1('0x3a')]['fields']));_0x41a384[_0xd4a1('0x3c')]=_0x41a384['attributes'][_0xd4a1('0x3f')]?_0x41a384[_0xd4a1('0x3c')]:_0xfd506d[_0xd4a1('0x39')];_0x41a384[_0xd4a1('0x40')]=qs[_0xd4a1('0x41')](_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x41')]);_0x41a384[_0xd4a1('0x43')]=qs['filters'](_[_0xd4a1('0x69')](_0x3e46d5[_0xd4a1('0x3a')],_0xfd506d[_0xd4a1('0x3b')]));if(_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x42')]){_0x41a384['where']=_[_0xd4a1('0x44')](_0x41a384[_0xd4a1('0x43')],{'$or':_[_0xd4a1('0x34')](_0x41a384[_0xd4a1('0x3c')],function(_0x2a1b99){var _0x20ee60={};_0x20ee60[_0x2a1b99]={'$like':'%'+_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x42')]+'%'};return _0x20ee60;})});}_0x41a384=_['merge']({},_0x41a384,_0x3e46d5[_0xd4a1('0x47')]);return _0x2b97c0[_0xd4a1('0x67')](_0x41a384);}})[_0xd4a1('0x2b')](function(_0x2ac4e){if(_0x2ac4e){_0x1510d5=_0x2ac4e[_0xd4a1('0x3f')];if(!_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x5d')](_0xd4a1('0x5e'))){_0x41a384['limit']=qs['limit'](_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x23')]);_0x41a384[_0xd4a1('0x22')]=qs[_0xd4a1('0x22')](_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x22')]);}return _0x2b97c0[_0xd4a1('0x67')](_0x41a384);}})[_0xd4a1('0x2b')](function(_0xcfa125){if(_0xcfa125){return _0xcfa125?{'count':_0x1510d5,'rows':_0xcfa125}:null;}})['then'](respondWithResult(_0x11baef,null))['catch'](handleError(_0x11baef,null));};exports['addTeams']=function(_0x197039,_0x29ce3b,_0x412c64){var _0x145190=_0x197039[_0xd4a1('0x50')][_0xd4a1('0x6a')];return db[_0xd4a1('0x68')][_0xd4a1('0x60')]({'where':{'id':_0x145190},'attributes':['id'],'include':[{'model':db[_0xd4a1('0x6b')],'as':'Agents','attributes':['id',_0xd4a1('0x31'),'online',_0xd4a1('0x6c'),_0xd4a1('0x6d')],'raw':!![]}]})['then'](function(_0x492d0d){if(_0x492d0d){var _0x18fe18=_['flatMap'](_0x492d0d,function(_0x5d8089){var _0x293ea1=_0x5d8089['get']({'plain':!![]});return _0x293ea1[_0xd4a1('0x6e')];});return db['MailQueue'][_0xd4a1('0x4e')]({'where':{'id':_0x197039['params']['id']}})[_0xd4a1('0x2b')](function(_0xe134b1){return db[_0xd4a1('0x6f')][_0xd4a1('0x70')](function(_0xb9186d){return _0xe134b1[_0xd4a1('0x71')](_0x145190,{'transaction':_0xb9186d})[_0xd4a1('0x2b')](function(){return BPromise['each'](_0x18fe18,function(_0x39d0fb){return db[_0xd4a1('0x5c')][_0xd4a1('0x72')]({'where':{'UserId':_0x39d0fb['id'],'MailQueueId':_0x197039['params']['id']},'transaction':_0xb9186d});});})[_0xd4a1('0x2b')](function(){_0x18fe18[_0xd4a1('0x73')](function(_0x172500){socket[_0xd4a1('0x74')]('userMailQueue:save',{'UserId':_0x172500['id'],'MailQueueId':_0xe134b1['id']});});});});});}})['then'](respondWithStatusCode(_0x29ce3b,null))[_0xd4a1('0x56')](handleError(_0x29ce3b,null));};exports['removeTeams']=function(_0x543b5a,_0x1d939c,_0x16a2bd){return db[_0xd4a1('0x68')][_0xd4a1('0x60')]({'where':{'id':_0x543b5a['query'][_0xd4a1('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d939c,null))['then'](function(_0x16d9d9){var _0x35316b=_[_0xd4a1('0x34')](_0x16d9d9,'id');var _0x108bae=[];var _0x296dd3=[];var _0x2a6266=squel[_0xd4a1('0x75')]();_0x2a6266[_0xd4a1('0x76')]('tq.TeamId')['from'](_0xd4a1('0x77'),'tq')[_0xd4a1('0x78')]('user_has_teams','ut',_0xd4a1('0x79'))[_0xd4a1('0x43')](_0xd4a1('0x7a'),_0x543b5a[_0xd4a1('0x4c')]['id']);for(var _0xee1965=0x0;_0xee1965<_0x16d9d9[_0xd4a1('0x3f')];_0xee1965+=0x1){let _0x915900=_0x16d9d9[_0xee1965];for(var _0x18b476=0x0;_0x18b476<_0x915900[_0xd4a1('0x6e')]['length'];_0x18b476+=0x1){let _0x4f42ad=_0x915900[_0xd4a1('0x6e')][_0x18b476];var _0x36215a=_0x2a6266['clone']();_0x36215a[_0xd4a1('0x43')](_0xd4a1('0x7b'),_0x4f42ad['id']);_0x296dd3[_0xd4a1('0x7c')](db['sequelize'][_0xd4a1('0x3a')](_0x36215a[_0xd4a1('0x7d')](),{'type':db[_0xd4a1('0x6f')][_0xd4a1('0x7e')][_0xd4a1('0x7f')]})[_0xd4a1('0x2b')](function(_0x3523e6){if(_0x3523e6[_0xd4a1('0x3f')]===0x1){return _0x4f42ad['id'];}else{var _0x50d008=_[_0xd4a1('0x80')](_[_0xd4a1('0x34')](_0x3523e6,_0xd4a1('0x81')),function(_0x37bd15){return _['includes'](_0x35316b,_0x37bd15);});if(_0x50d008){return _0x4f42ad['id'];}}}));}}return BPromise[_0xd4a1('0x82')](_0x296dd3)[_0xd4a1('0x2b')](function(_0x5ec752){_0x108bae=_(_0x108bae)['union'](_0x5ec752)[_0xd4a1('0x83')]()['value']();return db[_0xd4a1('0x35')]['find']({'where':{'id':_0x543b5a['params']['id']}})[_0xd4a1('0x2b')](function(_0x5bfc37){return db[_0xd4a1('0x6f')]['transaction'](function(_0x332dfd){return _0x5bfc37[_0xd4a1('0x84')](_0x543b5a['query'][_0xd4a1('0x6a')],{'transaction':_0x332dfd})[_0xd4a1('0x2b')](function(){if(!_['isEmpty'](_0x108bae)){return _0x5bfc37['removeAgents'](_0x108bae,{'transaction':_0x332dfd});}})['then'](function(){_0x108bae[_0xd4a1('0x73')](function(_0x357c0b){socket['emit']('userMailQueue:remove',{'UserId':_0x357c0b,'MailQueueId':_0x5bfc37['id']});});});});});});})[_0xd4a1('0x2b')](respondWithStatusCode(_0x1d939c,null))[_0xd4a1('0x56')](handleError(_0x1d939c,null));};exports[_0xd4a1('0x85')]=function(_0x5ca36a,_0x4d68c7,_0x3d7115){return db['MailQueue'][_0xd4a1('0x4e')]({'where':{'id':_0x5ca36a[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x4d68c7,null))[_0xd4a1('0x2b')](function(_0x4ae73f){if(_0x4ae73f){return _0x4ae73f[_0xd4a1('0x85')](_0x5ca36a[_0xd4a1('0x50')][_0xd4a1('0x6a')],_[_0xd4a1('0x86')](_0x5ca36a[_0xd4a1('0x50')],[_0xd4a1('0x6a'),'id'])||{})[_0xd4a1('0x87')](function(_0x457a2a){for(var _0x4bb0cf=0x0;_0x4bb0cf<_0x5ca36a[_0xd4a1('0x50')][_0xd4a1('0x6a')][_0xd4a1('0x3f')];_0x4bb0cf+=0x1){socket[_0xd4a1('0x74')]('userMailQueue:save',{'UserId':_0x5ca36a['body']['ids'][_0x4bb0cf],'MailQueueId':_0x5ca36a[_0xd4a1('0x4c')]['id']});}return _0x457a2a;});}})['then'](respondWithResult(_0x4d68c7,null))[_0xd4a1('0x56')](handleError(_0x4d68c7,null));};exports['removeAgents']=function(_0x1d27b0,_0x2d5e7e,_0x1f762d){return db[_0xd4a1('0x35')][_0xd4a1('0x4e')]({'where':{'id':_0x1d27b0[_0xd4a1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d5e7e,null))[_0xd4a1('0x2b')](function(_0x183c4e){if(_0x183c4e){return _0x183c4e[_0xd4a1('0x88')](_0x1d27b0[_0xd4a1('0x3a')][_0xd4a1('0x6a')])[_0xd4a1('0x2b')](function(){if(_[_0xd4a1('0x89')](_0x1d27b0[_0xd4a1('0x3a')][_0xd4a1('0x6a')])){for(var _0x416db4=0x0;_0x416db4<_0x1d27b0[_0xd4a1('0x3a')][_0xd4a1('0x6a')][_0xd4a1('0x3f')];_0x416db4+=0x1){socket[_0xd4a1('0x74')](_0xd4a1('0x8a'),{'UserId':Number(_0x1d27b0[_0xd4a1('0x3a')]['ids'][_0x416db4]),'MailQueueId':Number(_0x1d27b0['params']['id'])});}}else{socket[_0xd4a1('0x74')](_0xd4a1('0x8a'),{'UserId':Number(_0x1d27b0[_0xd4a1('0x3a')]['ids']),'MailQueueId':Number(_0x1d27b0['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2d5e7e,null))[_0xd4a1('0x56')](handleError(_0x2d5e7e,null));};exports[_0xd4a1('0x8b')]=function(_0x44e6bd,_0x1c6ffd,_0x30acca){var _0x6f63c2={};var _0x122199={};var _0x434cf6;var _0x4fa17b;return db[_0xd4a1('0x35')][_0xd4a1('0x5b')]({'where':{'id':_0x44e6bd[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x1c6ffd,null))[_0xd4a1('0x2b')](function(_0x4b3fa1){if(_0x4b3fa1){_0x434cf6=_0x4b3fa1;_0x122199['model']=_[_0xd4a1('0x4d')](db['User'][_0xd4a1('0x36')]);_0x122199[_0xd4a1('0x3a')]=_[_0xd4a1('0x4d')](_0x44e6bd[_0xd4a1('0x3a')]);_0x122199['filters']=_[_0xd4a1('0x3d')](_0x122199['model'],_0x122199[_0xd4a1('0x3a')]);_0x6f63c2[_0xd4a1('0x3c')]=_[_0xd4a1('0x3d')](_0x122199[_0xd4a1('0x39')],qs['fields'](_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x3e')]));_0x6f63c2[_0xd4a1('0x3c')]=_0x6f63c2[_0xd4a1('0x3c')]['length']?_0x6f63c2[_0xd4a1('0x3c')]:_0x122199[_0xd4a1('0x39')];_0x6f63c2[_0xd4a1('0x40')]=qs['sort'](_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x41')]);_0x6f63c2['where']=qs[_0xd4a1('0x3b')](_[_0xd4a1('0x69')](_0x44e6bd[_0xd4a1('0x3a')],_0x122199[_0xd4a1('0x3b')]));if(_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x42')]){_0x6f63c2[_0xd4a1('0x43')]=_[_0xd4a1('0x44')](_0x6f63c2[_0xd4a1('0x43')],{'$or':_['map'](_0x6f63c2['attributes'],function(_0x8e544a){var _0x77fe52={};_0x77fe52[_0x8e544a]={'$like':'%'+_0x44e6bd['query'][_0xd4a1('0x42')]+'%'};return _0x77fe52;})});}_0x6f63c2=_[_0xd4a1('0x44')]({},_0x6f63c2,_0x44e6bd[_0xd4a1('0x47')]);return _0x434cf6['getAgents'](_0x6f63c2);}})[_0xd4a1('0x2b')](function(_0x3d3067){if(_0x3d3067){_0x4fa17b=_0x3d3067[_0xd4a1('0x3f')];if(!_0x44e6bd[_0xd4a1('0x3a')]['hasOwnProperty'](_0xd4a1('0x5e'))){_0x6f63c2[_0xd4a1('0x23')]=qs[_0xd4a1('0x23')](_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x23')]);_0x6f63c2[_0xd4a1('0x22')]=qs[_0xd4a1('0x22')](_0x44e6bd[_0xd4a1('0x3a')]['offset']);}return _0x434cf6[_0xd4a1('0x8b')](_0x6f63c2);}})[_0xd4a1('0x2b')](function(_0x48aee5){if(_0x48aee5){return _0x48aee5?{'count':_0x4fa17b,'rows':_0x48aee5}:null;}})['then'](respondWithResult(_0x1c6ffd,null))[_0xd4a1('0x56')](handleError(_0x1c6ffd,null));}; \ No newline at end of file +var _0x9efc=['select','field','tq.TeamId','from','join','clone','push','sequelize','toString','QueryTypes','all','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','MailQueues','UserProfileResource','sendStatus','name','index','map','MailQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserMailQueue','User','UserId','mailPause','createdAt','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','online','interface','flatMap','transaction','forEach','userMailQueue:save','removeTeams','ids','Agents'];(function(_0x2a107c,_0x56af76){var _0x3fde43=function(_0x313908){while(--_0x313908){_0x2a107c['push'](_0x2a107c['shift']());}};_0x3fde43(++_0x56af76);}(_0x9efc,0x19c));var _0xc9ef=function(_0x4f6afe,_0x44a4ff){_0x4f6afe=_0x4f6afe-0x0;var _0x5256f8=_0x9efc[_0x4f6afe];return _0x5256f8;};'use strict';var pdf=require(_0xc9ef('0x0'));var emlformat=require(_0xc9ef('0x1'));var rimraf=require(_0xc9ef('0x2'));var zipdir=require(_0xc9ef('0x3'));var jsonpatch=require(_0xc9ef('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc9ef('0x5'));var Mustache=require('mustache');var util=require(_0xc9ef('0x6'));var path=require('path');var sox=require(_0xc9ef('0x7'));var csv=require('to-csv');var ejs=require(_0xc9ef('0x8'));var fs=require('fs');var _=require(_0xc9ef('0x9'));var squel=require(_0xc9ef('0xa'));var crypto=require(_0xc9ef('0xb'));var jsforce=require(_0xc9ef('0xc'));var deskjs=require(_0xc9ef('0xd'));var toCsv=require(_0xc9ef('0xe'));var querystring=require(_0xc9ef('0xf'));var Papa=require(_0xc9ef('0x10'));var Redis=require(_0xc9ef('0x11'));var authService=require(_0xc9ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9ef('0x13'));var logger=require('../../config/logger')(_0xc9ef('0x14'));var utils=require('../../config/utils');var config=require(_0xc9ef('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc9ef('0x16')]=_[_0xc9ef('0x17')](config[_0xc9ef('0x16')],{'host':_0xc9ef('0x18'),'port':0x18eb});var socket=require(_0xc9ef('0x19'))(new Redis(config[_0xc9ef('0x16')]));require(_0xc9ef('0x1a'))[_0xc9ef('0x1b')](socket);function respondWithStatusCode(_0x106a92,_0x437385){_0x437385=_0x437385||0xcc;return function(_0x624d74){if(_0x624d74){return _0x106a92['sendStatus'](_0x437385);}return _0x106a92[_0xc9ef('0x1c')](_0x437385)[_0xc9ef('0x1d')]();};}function respondWithResult(_0xc63528,_0x215be8){_0x215be8=_0x215be8||0xc8;return function(_0xaea0df){if(_0xaea0df){return _0xc63528['status'](_0x215be8)[_0xc9ef('0x1e')](_0xaea0df);}};}function respondWithFilteredResult(_0xd0cd36,_0x1a56bd){return function(_0x122fb8){if(_0x122fb8){var _0x292e06=_0x122fb8[_0xc9ef('0x1f')],_0x2d1b60=_0x1a56bd[_0xc9ef('0x20')],_0x1a2519=_0x1a56bd[_0xc9ef('0x20')]+_0x1a56bd[_0xc9ef('0x21')],_0x22a0de;if(_0x1a2519>=_0x292e06){_0x1a2519=_0x292e06;_0x22a0de=0xc8;}else{_0x22a0de=0xce;}_0xd0cd36[_0xc9ef('0x1c')](_0x22a0de);return _0xd0cd36[_0xc9ef('0x22')]('Content-Range',_0x2d1b60+'-'+_0x1a2519+'/'+_0x292e06)[_0xc9ef('0x1e')](_0x122fb8);}return null;};}function patchUpdates(_0x3d1f5e){return function(_0x32999b){try{jsonpatch['apply'](_0x32999b,_0x3d1f5e,!![]);}catch(_0x36c8e0){return BPromise[_0xc9ef('0x23')](_0x36c8e0);}return _0x32999b[_0xc9ef('0x24')]();};}function saveUpdates(_0x2bc10b,_0x5c5212){return function(_0x2d83c0){if(_0x2d83c0){return _0x2d83c0[_0xc9ef('0x25')](_0x2bc10b)['then'](function(_0x3357e3){return _0x3357e3;});}return null;};}function removeEntity(_0xcd720a,_0x51b8dd){return function(_0x13a214){if(_0x13a214){return _0x13a214[_0xc9ef('0x26')]()[_0xc9ef('0x27')](function(){var _0xf746bb=_0x13a214['get']({'plain':!![]});var _0x1c6422=_0xc9ef('0x28');return db[_0xc9ef('0x29')][_0xc9ef('0x26')]({'where':{'type':_0x1c6422,'resourceId':_0xf746bb['id']}})['then'](function(){return _0x13a214;});})['then'](function(){_0xcd720a[_0xc9ef('0x1c')](0xcc)[_0xc9ef('0x1d')]();});}};}function handleEntityNotFound(_0x6dc9ee,_0x53e1fe){return function(_0xe8d305){if(!_0xe8d305){_0x6dc9ee[_0xc9ef('0x2a')](0x194);}return _0xe8d305;};}function handleError(_0x2b5831,_0x4042fc){_0x4042fc=_0x4042fc||0x1f4;return function(_0x147812){logger['error'](_0x147812['stack']);if(_0x147812[_0xc9ef('0x2b')]){delete _0x147812[_0xc9ef('0x2b')];}_0x2b5831['status'](_0x4042fc)['send'](_0x147812);};}exports[_0xc9ef('0x2c')]=function(_0x4ec594,_0x3a5c1b){var _0x5eca97={},_0x2bf9be={},_0x972d47={'count':0x0,'rows':[]};var _0x178a50=_[_0xc9ef('0x2d')](db[_0xc9ef('0x2e')][_0xc9ef('0x2f')],function(_0x5210ac){return{'name':_0x5210ac[_0xc9ef('0x30')],'type':_0x5210ac[_0xc9ef('0x31')]['key']};});_0x2bf9be[_0xc9ef('0x32')]=_[_0xc9ef('0x2d')](_0x178a50,_0xc9ef('0x2b'));_0x2bf9be[_0xc9ef('0x33')]=_[_0xc9ef('0x34')](_0x4ec594['query']);_0x2bf9be[_0xc9ef('0x35')]=_[_0xc9ef('0x36')](_0x2bf9be[_0xc9ef('0x32')],_0x2bf9be[_0xc9ef('0x33')]);_0x5eca97[_0xc9ef('0x37')]=_['intersection'](_0x2bf9be['model'],qs[_0xc9ef('0x38')](_0x4ec594[_0xc9ef('0x33')][_0xc9ef('0x38')]));_0x5eca97['attributes']=_0x5eca97['attributes'][_0xc9ef('0x39')]?_0x5eca97[_0xc9ef('0x37')]:_0x2bf9be['model'];if(!_0x4ec594['query'][_0xc9ef('0x3a')](_0xc9ef('0x3b'))){_0x5eca97[_0xc9ef('0x21')]=qs['limit'](_0x4ec594[_0xc9ef('0x33')][_0xc9ef('0x21')]);_0x5eca97[_0xc9ef('0x20')]=qs['offset'](_0x4ec594[_0xc9ef('0x33')][_0xc9ef('0x20')]);}_0x5eca97[_0xc9ef('0x3c')]=qs['sort'](_0x4ec594['query'][_0xc9ef('0x3d')]);_0x5eca97[_0xc9ef('0x3e')]=qs['filters'](_[_0xc9ef('0x3f')](_0x4ec594['query'],_0x2bf9be[_0xc9ef('0x35')]),_0x178a50);if(_0x4ec594[_0xc9ef('0x33')][_0xc9ef('0x40')]){_0x5eca97['where']=_[_0xc9ef('0x41')](_0x5eca97[_0xc9ef('0x3e')],{'$or':_[_0xc9ef('0x2d')](_0x178a50,function(_0x115422){if(_0x115422[_0xc9ef('0x31')]!==_0xc9ef('0x42')){var _0xf1e27d={};_0xf1e27d[_0x115422[_0xc9ef('0x2b')]]={'$like':'%'+_0x4ec594[_0xc9ef('0x33')]['filter']+'%'};return _0xf1e27d;}})});}_0x5eca97=_[_0xc9ef('0x41')]({},_0x5eca97,_0x4ec594[_0xc9ef('0x43')]);var _0x5c948e={'where':_0x5eca97[_0xc9ef('0x3e')]};return db[_0xc9ef('0x2e')][_0xc9ef('0x1f')](_0x5c948e)[_0xc9ef('0x27')](function(_0x260a68){_0x972d47[_0xc9ef('0x1f')]=_0x260a68;if(_0x4ec594[_0xc9ef('0x33')]['includeAll']){_0x5eca97[_0xc9ef('0x44')]=[{'all':!![]}];}return db['MailQueue'][_0xc9ef('0x45')](_0x5eca97);})['then'](function(_0x4ef754){_0x972d47[_0xc9ef('0x46')]=_0x4ef754;return _0x972d47;})[_0xc9ef('0x27')](respondWithFilteredResult(_0x3a5c1b,_0x5eca97))[_0xc9ef('0x47')](handleError(_0x3a5c1b,null));};exports[_0xc9ef('0x48')]=function(_0x24df12,_0x10d3cd){var _0x2d633a={'raw':!![],'where':{'id':_0x24df12['params']['id']}},_0x1af20d={};_0x1af20d[_0xc9ef('0x32')]=_['keys'](db[_0xc9ef('0x2e')][_0xc9ef('0x2f')]);_0x1af20d[_0xc9ef('0x33')]=_[_0xc9ef('0x34')](_0x24df12['query']);_0x1af20d[_0xc9ef('0x35')]=_[_0xc9ef('0x36')](_0x1af20d[_0xc9ef('0x32')],_0x1af20d[_0xc9ef('0x33')]);_0x2d633a['attributes']=_[_0xc9ef('0x36')](_0x1af20d[_0xc9ef('0x32')],qs[_0xc9ef('0x38')](_0x24df12['query']['fields']));_0x2d633a[_0xc9ef('0x37')]=_0x2d633a[_0xc9ef('0x37')][_0xc9ef('0x39')]?_0x2d633a['attributes']:_0x1af20d[_0xc9ef('0x32')];if(_0x24df12['query'][_0xc9ef('0x49')]){_0x2d633a[_0xc9ef('0x44')]=[{'all':!![]}];}_0x2d633a=_[_0xc9ef('0x41')]({},_0x2d633a,_0x24df12[_0xc9ef('0x43')]);return db[_0xc9ef('0x2e')]['find'](_0x2d633a)[_0xc9ef('0x27')](handleEntityNotFound(_0x10d3cd,null))['then'](respondWithResult(_0x10d3cd,null))[_0xc9ef('0x47')](handleError(_0x10d3cd,null));};exports[_0xc9ef('0x4a')]=function(_0x3c635b,_0x32ce9f){return db[_0xc9ef('0x2e')][_0xc9ef('0x4a')](_0x3c635b[_0xc9ef('0x4b')],{})[_0xc9ef('0x27')](function(_0x216b74){var _0x281cf5=_0x3c635b[_0xc9ef('0x4c')][_0xc9ef('0x4d')]({'plain':!![]});if(!_0x281cf5)throw new Error(_0xc9ef('0x4e'));if(_0x281cf5[_0xc9ef('0x4f')]===_0xc9ef('0x4c')){var _0x46d3b3=_0x216b74[_0xc9ef('0x4d')]({'plain':!![]});var _0x8c3874=_0xc9ef('0x28');return db[_0xc9ef('0x50')][_0xc9ef('0x51')]({'where':{'name':_0x8c3874,'userProfileId':_0x281cf5['userProfileId']},'raw':!![]})['then'](function(_0x66a935){if(_0x66a935&&_0x66a935['autoAssociation']===0x0){return db[_0xc9ef('0x29')]['create']({'name':_0x46d3b3[_0xc9ef('0x2b')],'resourceId':_0x46d3b3['id'],'type':_0x66a935[_0xc9ef('0x2b')],'sectionId':_0x66a935['id']},{})[_0xc9ef('0x27')](function(){return _0x216b74;});}else{return _0x216b74;}})[_0xc9ef('0x47')](function(_0x412510){logger[_0xc9ef('0x52')](_0xc9ef('0x53'),_0x412510);throw _0x412510;});}return _0x216b74;})[_0xc9ef('0x27')](respondWithResult(_0x32ce9f,0xc9))[_0xc9ef('0x47')](handleError(_0x32ce9f,null));};exports[_0xc9ef('0x25')]=function(_0x39cdd2,_0x2e0117){if(_0x39cdd2[_0xc9ef('0x4b')]['id']){delete _0x39cdd2[_0xc9ef('0x4b')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x39cdd2['params']['id']}})[_0xc9ef('0x27')](handleEntityNotFound(_0x2e0117,null))['then'](saveUpdates(_0x39cdd2['body'],null))[_0xc9ef('0x27')](respondWithResult(_0x2e0117,null))[_0xc9ef('0x47')](handleError(_0x2e0117,null));};exports['destroy']=function(_0x372ca4,_0x38dccb){return db['MailQueue'][_0xc9ef('0x51')]({'where':{'id':_0x372ca4[_0xc9ef('0x54')]['id']}})[_0xc9ef('0x27')](handleEntityNotFound(_0x38dccb,null))[_0xc9ef('0x27')](removeEntity(_0x38dccb,null))[_0xc9ef('0x47')](handleError(_0x38dccb,null));};exports[_0xc9ef('0x55')]=function(_0xb9265a,_0x8ff9cf){return db[_0xc9ef('0x2e')][_0xc9ef('0x55')]()[_0xc9ef('0x27')](respondWithResult(_0x8ff9cf,null))[_0xc9ef('0x47')](handleError(_0x8ff9cf,null));};exports[_0xc9ef('0x56')]=function(_0x250ad3,_0x18eda2,_0x51a55f){var _0x4f7d1={'raw':!![],'where':{}},_0x27a168={},_0x27c942;return db[_0xc9ef('0x2e')]['findOne']({'where':{'id':_0x250ad3[_0xc9ef('0x54')]['id']}})[_0xc9ef('0x27')](handleEntityNotFound(_0x18eda2,null))[_0xc9ef('0x27')](function(_0xe1baf4){if(_0xe1baf4){_0x27c942=_0xe1baf4[_0xc9ef('0x4d')]({'plain':!![]});_0x27a168['model']=_['keys'](db[_0xc9ef('0x57')][_0xc9ef('0x2f')]);_0x27a168[_0xc9ef('0x33')]=_[_0xc9ef('0x34')](_0x250ad3[_0xc9ef('0x33')]);_0x27a168[_0xc9ef('0x35')]=_['intersection'](_0x27a168[_0xc9ef('0x32')],_0x27a168['query']);_0x4f7d1[_0xc9ef('0x37')]=_['intersection'](_0x27a168[_0xc9ef('0x32')],qs[_0xc9ef('0x38')](_0x250ad3[_0xc9ef('0x33')][_0xc9ef('0x38')]));_0x4f7d1['attributes']=_0x4f7d1[_0xc9ef('0x37')][_0xc9ef('0x39')]?_0x4f7d1[_0xc9ef('0x37')]:_0x27a168[_0xc9ef('0x32')];if(!_0x250ad3[_0xc9ef('0x33')][_0xc9ef('0x3a')](_0xc9ef('0x3b'))){_0x4f7d1['limit']=qs[_0xc9ef('0x21')](_0x250ad3[_0xc9ef('0x33')][_0xc9ef('0x21')]);_0x4f7d1[_0xc9ef('0x20')]=qs['offset'](_0x250ad3[_0xc9ef('0x33')][_0xc9ef('0x20')]);}_0x4f7d1[_0xc9ef('0x3c')]=qs[_0xc9ef('0x3d')](_0x250ad3['query'][_0xc9ef('0x3d')]);_0x4f7d1[_0xc9ef('0x3e')]=qs['filters'](_[_0xc9ef('0x3f')](_0x250ad3[_0xc9ef('0x33')],_0x27a168['filters']));_0x4f7d1[_0xc9ef('0x3e')]['MailQueueId']=_0xe1baf4['id'];if(_0x250ad3[_0xc9ef('0x33')][_0xc9ef('0x40')]){_0x4f7d1['where']=_['merge'](_0x4f7d1[_0xc9ef('0x3e')],{'$or':_[_0xc9ef('0x2d')](_0x4f7d1[_0xc9ef('0x37')],function(_0x1abe0f){var _0x57bbce={};_0x57bbce[_0x1abe0f]={'$like':'%'+_0x250ad3[_0xc9ef('0x33')]['filter']+'%'};return _0x57bbce;})});}_0x4f7d1=_[_0xc9ef('0x41')]({},_0x4f7d1,_0x250ad3[_0xc9ef('0x43')]);return db[_0xc9ef('0x57')]['findAll'](_0x4f7d1);}})['then'](function(_0x14d108){if(_0x14d108){return db[_0xc9ef('0x58')]['findAndCountAll']({'where':{'id':_['map'](_0x14d108,_0xc9ef('0x59')),'role':'agent'},'attributes':['id',_0xc9ef('0x2b'),_0xc9ef('0x5a'),'updatedAt',_0xc9ef('0x5b')]});}})['then'](function(_0x213a79){if(_0x213a79){return{'count':_0x213a79['count'],'rows':_[_0xc9ef('0x2d')](_0x213a79[_0xc9ef('0x46')],function(_0x400d7d){return{'membername':_0x400d7d[_0xc9ef('0x2b')],'UserId':_0x400d7d['id'],'queue_name':_0x27c942[_0xc9ef('0x2b')],'MailQueueId':_0x27c942['id'],'interface':util['format'](_0xc9ef('0x5c'),_0xc9ef('0x5d'),_0x400d7d['name']),'penalty':0x0,'paused':_0x400d7d[_0xc9ef('0x5a')],'createdAt':_0x400d7d[_0xc9ef('0x5b')],'updatedAt':_0x400d7d[_0xc9ef('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc9ef('0x27')](respondWithFilteredResult(_0x18eda2,_0x4f7d1))[_0xc9ef('0x47')](handleError(_0x18eda2,null));};exports[_0xc9ef('0x5f')]=function(_0x90d6bc,_0x11dc8b,_0x42ad4){var _0x70081a={};var _0x3a0bec={};var _0x47ba86;var _0x54b52a;return db[_0xc9ef('0x2e')][_0xc9ef('0x60')]({'where':{'id':_0x90d6bc['params']['id']}})[_0xc9ef('0x27')](handleEntityNotFound(_0x11dc8b,null))[_0xc9ef('0x27')](function(_0x363032){if(_0x363032){_0x47ba86=_0x363032;_0x3a0bec['model']=_[_0xc9ef('0x34')](db[_0xc9ef('0x61')][_0xc9ef('0x2f')]);_0x3a0bec[_0xc9ef('0x33')]=_[_0xc9ef('0x34')](_0x90d6bc[_0xc9ef('0x33')]);_0x3a0bec[_0xc9ef('0x35')]=_[_0xc9ef('0x36')](_0x3a0bec[_0xc9ef('0x32')],_0x3a0bec['query']);_0x70081a[_0xc9ef('0x37')]=_[_0xc9ef('0x36')](_0x3a0bec['model'],qs[_0xc9ef('0x38')](_0x90d6bc['query'][_0xc9ef('0x38')]));_0x70081a[_0xc9ef('0x37')]=_0x70081a[_0xc9ef('0x37')][_0xc9ef('0x39')]?_0x70081a[_0xc9ef('0x37')]:_0x3a0bec[_0xc9ef('0x32')];_0x70081a[_0xc9ef('0x3c')]=qs['sort'](_0x90d6bc[_0xc9ef('0x33')][_0xc9ef('0x3d')]);_0x70081a[_0xc9ef('0x3e')]=qs[_0xc9ef('0x35')](_['pick'](_0x90d6bc['query'],_0x3a0bec[_0xc9ef('0x35')]));if(_0x90d6bc[_0xc9ef('0x33')][_0xc9ef('0x40')]){_0x70081a[_0xc9ef('0x3e')]=_[_0xc9ef('0x41')](_0x70081a[_0xc9ef('0x3e')],{'$or':_['map'](_0x70081a[_0xc9ef('0x37')],function(_0x51049a){var _0x1a18a3={};_0x1a18a3[_0x51049a]={'$like':'%'+_0x90d6bc[_0xc9ef('0x33')][_0xc9ef('0x40')]+'%'};return _0x1a18a3;})});}_0x70081a=_[_0xc9ef('0x41')]({},_0x70081a,_0x90d6bc[_0xc9ef('0x43')]);return _0x47ba86['getTeams'](_0x70081a);}})[_0xc9ef('0x27')](function(_0x656c29){if(_0x656c29){_0x54b52a=_0x656c29[_0xc9ef('0x39')];if(!_0x90d6bc['query']['hasOwnProperty']('nolimit')){_0x70081a[_0xc9ef('0x21')]=qs['limit'](_0x90d6bc[_0xc9ef('0x33')]['limit']);_0x70081a['offset']=qs[_0xc9ef('0x20')](_0x90d6bc[_0xc9ef('0x33')]['offset']);}return _0x47ba86['getTeams'](_0x70081a);}})['then'](function(_0x2c4177){if(_0x2c4177){return _0x2c4177?{'count':_0x54b52a,'rows':_0x2c4177}:null;}})[_0xc9ef('0x27')](respondWithResult(_0x11dc8b,null))[_0xc9ef('0x47')](handleError(_0x11dc8b,null));};exports[_0xc9ef('0x62')]=function(_0x755301,_0x2d618c,_0x2f07f6){var _0x282026=_0x755301['body']['ids'];return db[_0xc9ef('0x61')]['findAll']({'where':{'id':_0x282026},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xc9ef('0x63'),'voicePause',_0xc9ef('0x64')],'raw':!![]}]})[_0xc9ef('0x27')](function(_0xd0e35c){if(_0xd0e35c){var _0x32b4be=_[_0xc9ef('0x65')](_0xd0e35c,function(_0x26237b){var _0x3ff02c=_0x26237b[_0xc9ef('0x4d')]({'plain':!![]});return _0x3ff02c['Agents'];});return db['MailQueue'][_0xc9ef('0x51')]({'where':{'id':_0x755301[_0xc9ef('0x54')]['id']}})['then'](function(_0x1cce29){return db['sequelize'][_0xc9ef('0x66')](function(_0x115072){return _0x1cce29[_0xc9ef('0x62')](_0x282026,{'transaction':_0x115072})[_0xc9ef('0x27')](function(){return BPromise['each'](_0x32b4be,function(_0x4f5dbd){return db[_0xc9ef('0x57')]['findOrCreate']({'where':{'UserId':_0x4f5dbd['id'],'MailQueueId':_0x755301[_0xc9ef('0x54')]['id']},'transaction':_0x115072});});})['then'](function(){_0x32b4be[_0xc9ef('0x67')](function(_0x5a195f){socket['emit'](_0xc9ef('0x68'),{'UserId':_0x5a195f['id'],'MailQueueId':_0x1cce29['id']});});});});});}})[_0xc9ef('0x27')](respondWithStatusCode(_0x2d618c,null))[_0xc9ef('0x47')](handleError(_0x2d618c,null));};exports[_0xc9ef('0x69')]=function(_0xecfff7,_0x4ad5de,_0x28b69d){return db[_0xc9ef('0x61')][_0xc9ef('0x45')]({'where':{'id':_0xecfff7[_0xc9ef('0x33')][_0xc9ef('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xc9ef('0x58')],'as':_0xc9ef('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xc9ef('0x27')](handleEntityNotFound(_0x4ad5de,null))[_0xc9ef('0x27')](function(_0x2ab42f){var _0x494bfe=_[_0xc9ef('0x2d')](_0x2ab42f,'id');var _0x4fe532=[];var _0x255125=[];var _0x470f1c=squel[_0xc9ef('0x6c')]();_0x470f1c[_0xc9ef('0x6d')](_0xc9ef('0x6e'))[_0xc9ef('0x6f')]('team_has_mail_queues','tq')[_0xc9ef('0x70')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc9ef('0x3e')]('MailQueueId\x20=\x20?',_0xecfff7[_0xc9ef('0x54')]['id']);for(var _0x57b8ef=0x0;_0x57b8ef<_0x2ab42f[_0xc9ef('0x39')];_0x57b8ef+=0x1){let _0x46b8ed=_0x2ab42f[_0x57b8ef];for(var _0xa10b42=0x0;_0xa10b42<_0x46b8ed[_0xc9ef('0x6b')][_0xc9ef('0x39')];_0xa10b42+=0x1){let _0x8c2b79=_0x46b8ed['Agents'][_0xa10b42];var _0x2ed7fb=_0x470f1c[_0xc9ef('0x71')]();_0x2ed7fb[_0xc9ef('0x3e')]('ut.UserId\x20=\x20?',_0x8c2b79['id']);_0x255125[_0xc9ef('0x72')](db[_0xc9ef('0x73')][_0xc9ef('0x33')](_0x2ed7fb[_0xc9ef('0x74')](),{'type':db['sequelize'][_0xc9ef('0x75')]['SELECT']})['then'](function(_0x1adfad){if(_0x1adfad[_0xc9ef('0x39')]===0x1){return _0x8c2b79['id'];}else{var _0x14e3f0=_['every'](_[_0xc9ef('0x2d')](_0x1adfad,'TeamId'),function(_0x247096){return _['includes'](_0x494bfe,_0x247096);});if(_0x14e3f0){return _0x8c2b79['id'];}}}));}}return BPromise[_0xc9ef('0x76')](_0x255125)['then'](function(_0x3862bd){_0x4fe532=_(_0x4fe532)[_0xc9ef('0x77')](_0x3862bd)[_0xc9ef('0x78')]()[_0xc9ef('0x79')]();return db[_0xc9ef('0x2e')]['find']({'where':{'id':_0xecfff7[_0xc9ef('0x54')]['id']}})[_0xc9ef('0x27')](function(_0x286cdc){return db['sequelize'][_0xc9ef('0x66')](function(_0xc3c1cd){return _0x286cdc[_0xc9ef('0x69')](_0xecfff7[_0xc9ef('0x33')][_0xc9ef('0x6a')],{'transaction':_0xc3c1cd})[_0xc9ef('0x27')](function(){if(!_[_0xc9ef('0x7a')](_0x4fe532)){return _0x286cdc[_0xc9ef('0x7b')](_0x4fe532,{'transaction':_0xc3c1cd});}})[_0xc9ef('0x27')](function(){_0x4fe532['forEach'](function(_0xbacb91){socket[_0xc9ef('0x7c')](_0xc9ef('0x7d'),{'UserId':_0xbacb91,'MailQueueId':_0x286cdc['id']});});});});});});})['then'](respondWithStatusCode(_0x4ad5de,null))[_0xc9ef('0x47')](handleError(_0x4ad5de,null));};exports[_0xc9ef('0x7e')]=function(_0x89b157,_0x9552c0,_0x2fb564){return db[_0xc9ef('0x2e')]['find']({'where':{'id':_0x89b157['params']['id']}})['then'](handleEntityNotFound(_0x9552c0,null))[_0xc9ef('0x27')](function(_0x34253a){if(_0x34253a){return _0x34253a[_0xc9ef('0x7e')](_0x89b157[_0xc9ef('0x4b')][_0xc9ef('0x6a')],_[_0xc9ef('0x7f')](_0x89b157[_0xc9ef('0x4b')],[_0xc9ef('0x6a'),'id'])||{})['spread'](function(_0x3fc804){for(var _0x507544=0x0;_0x507544<_0x89b157['body'][_0xc9ef('0x6a')][_0xc9ef('0x39')];_0x507544+=0x1){socket[_0xc9ef('0x7c')]('userMailQueue:save',{'UserId':_0x89b157[_0xc9ef('0x4b')][_0xc9ef('0x6a')][_0x507544],'MailQueueId':_0x89b157['params']['id']});}return _0x3fc804;});}})[_0xc9ef('0x27')](respondWithResult(_0x9552c0,null))[_0xc9ef('0x47')](handleError(_0x9552c0,null));};exports[_0xc9ef('0x7b')]=function(_0x553c4a,_0x948bc9,_0x5be3c4){return db[_0xc9ef('0x2e')]['find']({'where':{'id':_0x553c4a[_0xc9ef('0x54')]['id']}})[_0xc9ef('0x27')](handleEntityNotFound(_0x948bc9,null))[_0xc9ef('0x27')](function(_0x20c3d7){if(_0x20c3d7){return _0x20c3d7['removeAgents'](_0x553c4a[_0xc9ef('0x33')][_0xc9ef('0x6a')])['then'](function(){if(_[_0xc9ef('0x80')](_0x553c4a['query'][_0xc9ef('0x6a')])){for(var _0x56612a=0x0;_0x56612a<_0x553c4a[_0xc9ef('0x33')][_0xc9ef('0x6a')]['length'];_0x56612a+=0x1){socket[_0xc9ef('0x7c')](_0xc9ef('0x7d'),{'UserId':Number(_0x553c4a[_0xc9ef('0x33')][_0xc9ef('0x6a')][_0x56612a]),'MailQueueId':Number(_0x553c4a[_0xc9ef('0x54')]['id'])});}}else{socket['emit'](_0xc9ef('0x7d'),{'UserId':Number(_0x553c4a[_0xc9ef('0x33')][_0xc9ef('0x6a')]),'MailQueueId':Number(_0x553c4a[_0xc9ef('0x54')]['id'])});}});}})[_0xc9ef('0x27')](respondWithStatusCode(_0x948bc9,null))[_0xc9ef('0x47')](handleError(_0x948bc9,null));};exports[_0xc9ef('0x81')]=function(_0x1e5c90,_0x39df1f,_0x2bb782){var _0x2727b9={};var _0x2532db={};var _0x24926a;var _0x54ae5f;return db[_0xc9ef('0x2e')][_0xc9ef('0x60')]({'where':{'id':_0x1e5c90[_0xc9ef('0x54')]['id']}})['then'](handleEntityNotFound(_0x39df1f,null))[_0xc9ef('0x27')](function(_0x43e874){if(_0x43e874){_0x24926a=_0x43e874;_0x2532db[_0xc9ef('0x32')]=_[_0xc9ef('0x34')](db['User'][_0xc9ef('0x2f')]);_0x2532db[_0xc9ef('0x33')]=_[_0xc9ef('0x34')](_0x1e5c90['query']);_0x2532db[_0xc9ef('0x35')]=_['intersection'](_0x2532db[_0xc9ef('0x32')],_0x2532db[_0xc9ef('0x33')]);_0x2727b9['attributes']=_[_0xc9ef('0x36')](_0x2532db['model'],qs['fields'](_0x1e5c90[_0xc9ef('0x33')]['fields']));_0x2727b9[_0xc9ef('0x37')]=_0x2727b9['attributes'][_0xc9ef('0x39')]?_0x2727b9['attributes']:_0x2532db[_0xc9ef('0x32')];_0x2727b9[_0xc9ef('0x3c')]=qs[_0xc9ef('0x3d')](_0x1e5c90[_0xc9ef('0x33')][_0xc9ef('0x3d')]);_0x2727b9[_0xc9ef('0x3e')]=qs[_0xc9ef('0x35')](_['pick'](_0x1e5c90[_0xc9ef('0x33')],_0x2532db[_0xc9ef('0x35')]));if(_0x1e5c90[_0xc9ef('0x33')][_0xc9ef('0x40')]){_0x2727b9[_0xc9ef('0x3e')]=_[_0xc9ef('0x41')](_0x2727b9[_0xc9ef('0x3e')],{'$or':_['map'](_0x2727b9[_0xc9ef('0x37')],function(_0x1a993e){var _0x23f1c6={};_0x23f1c6[_0x1a993e]={'$like':'%'+_0x1e5c90[_0xc9ef('0x33')][_0xc9ef('0x40')]+'%'};return _0x23f1c6;})});}_0x2727b9=_[_0xc9ef('0x41')]({},_0x2727b9,_0x1e5c90[_0xc9ef('0x43')]);return _0x24926a[_0xc9ef('0x81')](_0x2727b9);}})[_0xc9ef('0x27')](function(_0x5359df){if(_0x5359df){_0x54ae5f=_0x5359df['length'];if(!_0x1e5c90[_0xc9ef('0x33')][_0xc9ef('0x3a')]('nolimit')){_0x2727b9[_0xc9ef('0x21')]=qs[_0xc9ef('0x21')](_0x1e5c90['query']['limit']);_0x2727b9['offset']=qs['offset'](_0x1e5c90[_0xc9ef('0x33')][_0xc9ef('0x20')]);}return _0x24926a['getAgents'](_0x2727b9);}})[_0xc9ef('0x27')](function(_0x46fded){if(_0x46fded){return _0x46fded?{'count':_0x54ae5f,'rows':_0x46fded}:null;}})[_0xc9ef('0x27')](respondWithResult(_0x39df1f,null))[_0xc9ef('0x47')](handleError(_0x39df1f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 54cc950..6646759 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 _0x8791=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x5d8c39,_0x388d1d){var _0x1cfe93=function(_0x1bc650){while(--_0x1bc650){_0x5d8c39['push'](_0x5d8c39['shift']());}};_0x1cfe93(++_0x388d1d);}(_0x8791,0xdd));var _0x1879=function(_0x19c105,_0x16b945){_0x19c105=_0x19c105-0x0;var _0x5206bf=_0x8791[_0x19c105];return _0x5206bf;};'use strict';var EventEmitter=require(_0x1879('0x0'));var MailQueue=require(_0x1879('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1879('0x2')](0x0);var events={'afterCreate':_0x1879('0x3'),'afterUpdate':_0x1879('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bf31f){return function(_0x284fc5,_0x2ea75d,_0x4a8655){MailQueueEvents[_0x1879('0x5')](_0x4bf31f+':'+_0x284fc5['id'],_0x284fc5);MailQueueEvents[_0x1879('0x5')](_0x4bf31f,_0x284fc5);_0x4a8655(null);};}for(var e in events){if(events[_0x1879('0x6')](e)){var event=events[e];MailQueue[_0x1879('0x7')](e,emitEvent(event));}}module[_0x1879('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xd657=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x4c21a0,_0xbd9938){var _0x225f0e=function(_0x2e9d35){while(--_0x2e9d35){_0x4c21a0['push'](_0x4c21a0['shift']());}};_0x225f0e(++_0xbd9938);}(_0xd657,0xcb));var _0x7d65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd657[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7d65('0x0'));var MailQueue=require(_0x7d65('0x1'))['db'][_0x7d65('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7d65('0x3')](0x0);var events={'afterCreate':_0x7d65('0x4'),'afterUpdate':_0x7d65('0x5'),'afterDestroy':_0x7d65('0x6')};function emitEvent(_0x407c3f){return function(_0x37691c,_0xe7e013,_0x2fb36f){MailQueueEvents[_0x7d65('0x7')](_0x407c3f+':'+_0x37691c['id'],_0x37691c);MailQueueEvents[_0x7d65('0x7')](_0x407c3f,_0x37691c);_0x2fb36f(null);};}for(var e in events){if(events[_0x7d65('0x8')](e)){var event=events[e];MailQueue[_0x7d65('0x9')](e,emitEvent(event));}}module[_0x7d65('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4dc9235..7279594 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 _0xb979=['moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','define','util','../../config/logger','api'];(function(_0x37ffcd,_0x267c81){var _0x228cca=function(_0x4db723){while(--_0x4db723){_0x37ffcd['push'](_0x37ffcd['shift']());}};_0x228cca(++_0x267c81);}(_0xb979,0x1bf));var _0x9b97=function(_0x519b57,_0x5cfe04){_0x519b57=_0x519b57-0x0;var _0x27b8d0=_0xb979[_0x519b57];return _0x27b8d0;};'use strict';var _=require('lodash');var util=require(_0x9b97('0x0'));var logger=require(_0x9b97('0x1'))(_0x9b97('0x2'));var moment=require(_0x9b97('0x3'));var BPromise=require(_0x9b97('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b97('0x5'));var rimraf=require(_0x9b97('0x6'));var config=require(_0x9b97('0x7'));var attributes=require(_0x9b97('0x8'));module['exports']=function(_0x1e12d8,_0x588e1f){return _0x1e12d8[_0x9b97('0x9')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2de5=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues'];(function(_0x27fae5,_0x194770){var _0x3b2846=function(_0x262367){while(--_0x262367){_0x27fae5['push'](_0x27fae5['shift']());}};_0x3b2846(++_0x194770);}(_0x2de5,0x8f));var _0x52de=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x2de5[_0x54a9e3];return _0x247cce;};'use strict';var _=require(_0x52de('0x0'));var util=require(_0x52de('0x1'));var logger=require(_0x52de('0x2'))(_0x52de('0x3'));var moment=require('moment');var BPromise=require(_0x52de('0x4'));var rp=require(_0x52de('0x5'));var fs=require('fs');var path=require(_0x52de('0x6'));var rimraf=require(_0x52de('0x7'));var config=require(_0x52de('0x8'));var attributes=require('./mailQueue.attributes');module[_0x52de('0x9')]=function(_0x4fb3e9,_0xbbe412){return _0x4fb3e9[_0x52de('0xa')](_0x52de('0xb'),attributes,{'tableName':_0x52de('0xc'),'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 513f74c..6aa0ded 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 _0xbcd0=['then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x22babc,_0x434b80){var _0x3641ef=function(_0x45f351){while(--_0x45f351){_0x22babc['push'](_0x22babc['shift']());}};_0x3641ef(++_0x434b80);}(_0xbcd0,0xb8));var _0x0bcd=function(_0x37e2b0,_0x5ba5dd){_0x37e2b0=_0x37e2b0-0x0;var _0xe03021=_0xbcd0[_0x37e2b0];return _0xe03021;};'use strict';var _=require(_0x0bcd('0x0'));var util=require(_0x0bcd('0x1'));var moment=require(_0x0bcd('0x2'));var BPromise=require(_0x0bcd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bcd('0x4'));var db=require(_0x0bcd('0x5'))['db'];var utils=require(_0x0bcd('0x6'));var logger=require(_0x0bcd('0x7'))(_0x0bcd('0x8'));var config=require(_0x0bcd('0x9'));var jayson=require(_0x0bcd('0xa'));var client=jayson['client'][_0x0bcd('0xb')]({'port':0x232a});config[_0x0bcd('0xc')]=_['defaults'](config[_0x0bcd('0xc')],{'host':_0x0bcd('0xd'),'port':0x18eb});var socket=require(_0x0bcd('0xe'))(new Redis(config['redis']));require(_0x0bcd('0xf'))['register'](socket);function respondWithRpcPromise(_0x571fce,_0x4fd427,_0x14090f){return new BPromise(function(_0x2fb1f2,_0x1222e1){return client['request'](_0x571fce,_0x14090f)[_0x0bcd('0x10')](function(_0x32f4e8){logger[_0x0bcd('0x11')](_0x0bcd('0x12'),_0x4fd427,_0x0bcd('0x13'));logger[_0x0bcd('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4fd427,_0x0bcd('0x13'),JSON[_0x0bcd('0x15')](_0x32f4e8));if(_0x32f4e8[_0x0bcd('0x16')]){if(_0x32f4e8[_0x0bcd('0x16')][_0x0bcd('0x17')]===0x1f4){logger[_0x0bcd('0x16')](_0x0bcd('0x12'),_0x4fd427,_0x32f4e8[_0x0bcd('0x16')][_0x0bcd('0x18')]);return _0x1222e1(_0x32f4e8[_0x0bcd('0x16')][_0x0bcd('0x18')]);}logger[_0x0bcd('0x16')](_0x0bcd('0x12'),_0x4fd427,_0x32f4e8[_0x0bcd('0x16')]['message']);return _0x2fb1f2(_0x32f4e8['error']['message']);}else{logger[_0x0bcd('0x11')](_0x0bcd('0x12'),_0x4fd427,_0x0bcd('0x13'));_0x2fb1f2(_0x32f4e8[_0x0bcd('0x19')][_0x0bcd('0x18')]);}})[_0x0bcd('0x1a')](function(_0x52785e){logger[_0x0bcd('0x16')](_0x0bcd('0x12'),_0x4fd427,_0x52785e);_0x1222e1(_0x52785e);});});}exports[_0x0bcd('0x1b')]=function(_0x562a35){var _0xf8b76f=this;return new Promise(function(_0x1f886d,_0x2b18bb){return db[_0x0bcd('0x1c')][_0x0bcd('0x1d')]({'raw':_0x562a35[_0x0bcd('0x1e')]?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x1f')]===undefined?!![]:![]:!![],'where':_0x562a35[_0x0bcd('0x1e')]?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x20')]||null:null,'attributes':_0x562a35['options']?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x21')]||null:null,'limit':_0x562a35[_0x0bcd('0x1e')]?_0x562a35['options'][_0x0bcd('0x22')]||null:null,'include':_0x562a35['options']?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x23')],function(_0x16065b){return{'model':db[_0x16065b['model']],'as':_0x16065b['as'],'attributes':_0x16065b['attributes'],'include':_0x16065b[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x16065b[_0x0bcd('0x23')],function(_0x1d994f){return{'model':db[_0x1d994f['model']],'as':_0x1d994f['as'],'attributes':_0x1d994f[_0x0bcd('0x21')],'include':_0x1d994f[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x1d994f[_0x0bcd('0x23')],function(_0x67c8c2){return{'model':db[_0x67c8c2[_0x0bcd('0x25')]],'as':_0x67c8c2['as'],'attributes':_0x67c8c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x0bcd('0x10')](function(_0x15e33c){logger['info'](_0x0bcd('0x1b'),_0x562a35);logger[_0x0bcd('0x14')](_0x0bcd('0x1b'),_0x562a35,JSON[_0x0bcd('0x15')](_0x15e33c));_0x1f886d(_0x15e33c);})[_0x0bcd('0x1a')](function(_0x4f7a96){logger['error']('GetMailQueue',_0x4f7a96['message'],_0x562a35);_0x2b18bb(_0xf8b76f[_0x0bcd('0x16')](0x1f4,_0x4f7a96[_0x0bcd('0x18')]));});});};exports[_0x0bcd('0x26')]=function(_0x136463){var _0x206607=this;return new Promise(function(_0x3e5697,_0x4aacec){return db[_0x0bcd('0x1c')][_0x0bcd('0x27')]({'raw':_0x136463[_0x0bcd('0x1e')]?_0x136463['options']['raw']===undefined?!![]:![]:!![],'where':_0x136463['options']?_0x136463['options'][_0x0bcd('0x20')]||null:null,'attributes':_0x136463[_0x0bcd('0x1e')]?_0x136463[_0x0bcd('0x1e')][_0x0bcd('0x21')]||null:null,'include':_0x136463[_0x0bcd('0x1e')]?_0x136463[_0x0bcd('0x1e')][_0x0bcd('0x23')]?_['map'](_0x136463[_0x0bcd('0x1e')][_0x0bcd('0x23')],function(_0x551b37){return{'model':db[_0x551b37[_0x0bcd('0x25')]],'as':_0x551b37['as'],'attributes':_0x551b37[_0x0bcd('0x21')],'include':_0x551b37[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x551b37['include'],function(_0x22e505){return{'model':db[_0x22e505[_0x0bcd('0x25')]],'as':_0x22e505['as'],'attributes':_0x22e505[_0x0bcd('0x21')],'include':_0x22e505[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x22e505[_0x0bcd('0x23')],function(_0x36e240){return{'model':db[_0x36e240['model']],'as':_0x36e240['as'],'attributes':_0x36e240[_0x0bcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0bcd('0x10')](function(_0x377a74){logger[_0x0bcd('0x11')](_0x0bcd('0x26'),_0x136463);logger[_0x0bcd('0x14')](_0x0bcd('0x26'),_0x136463,JSON[_0x0bcd('0x15')](_0x377a74));_0x3e5697(_0x377a74);})[_0x0bcd('0x1a')](function(_0x49e826){logger[_0x0bcd('0x16')](_0x0bcd('0x26'),_0x49e826[_0x0bcd('0x18')],_0x136463);_0x4aacec(_0x206607[_0x0bcd('0x16')](0x1f4,_0x49e826[_0x0bcd('0x18')]));});});}; \ No newline at end of file +var _0x3636=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','map','model','debug','stringify','ShowMailQueue','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e68bd,_0x38c6d1){var _0x146ef3=function(_0x46c5d7){while(--_0x46c5d7){_0x4e68bd['push'](_0x4e68bd['shift']());}};_0x146ef3(++_0x38c6d1);}(_0x3636,0x1da));var _0x6363=function(_0x12a8c5,_0x51c435){_0x12a8c5=_0x12a8c5-0x0;var _0x4e960d=_0x3636[_0x12a8c5];return _0x4e960d;};'use strict';var _=require(_0x6363('0x0'));var util=require(_0x6363('0x1'));var moment=require(_0x6363('0x2'));var BPromise=require(_0x6363('0x3'));var rs=require(_0x6363('0x4'));var fs=require('fs');var Redis=require(_0x6363('0x5'));var db=require(_0x6363('0x6'))['db'];var utils=require(_0x6363('0x7'));var logger=require('../../config/logger')(_0x6363('0x8'));var config=require(_0x6363('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6363('0xa')][_0x6363('0xb')]({'port':0x232a});config[_0x6363('0xc')]=_[_0x6363('0xd')](config[_0x6363('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6363('0xc')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0xbc08ac,_0x5490e8,_0x144020){return new BPromise(function(_0x235626,_0x3a282f){return client['request'](_0xbc08ac,_0x144020)['then'](function(_0x3f780d){logger['info'](_0x6363('0xe'),_0x5490e8,_0x6363('0xf'));logger['debug'](_0x6363('0x10'),_0x5490e8,_0x6363('0xf'),JSON['stringify'](_0x3f780d));if(_0x3f780d[_0x6363('0x11')]){if(_0x3f780d[_0x6363('0x11')][_0x6363('0x12')]===0x1f4){logger['error'](_0x6363('0xe'),_0x5490e8,_0x3f780d[_0x6363('0x11')][_0x6363('0x13')]);return _0x3a282f(_0x3f780d['error'][_0x6363('0x13')]);}logger[_0x6363('0x11')](_0x6363('0xe'),_0x5490e8,_0x3f780d[_0x6363('0x11')][_0x6363('0x13')]);return _0x235626(_0x3f780d['error'][_0x6363('0x13')]);}else{logger[_0x6363('0x14')](_0x6363('0xe'),_0x5490e8,'request\x20sent');_0x235626(_0x3f780d['result'][_0x6363('0x13')]);}})[_0x6363('0x15')](function(_0x8d1552){logger['error'](_0x6363('0xe'),_0x5490e8,_0x8d1552);_0x3a282f(_0x8d1552);});});}exports[_0x6363('0x16')]=function(_0xf4a517){var _0x229e28=this;return new Promise(function(_0x50fdd4,_0x353d80){return db[_0x6363('0x17')][_0x6363('0x18')]({'raw':_0xf4a517[_0x6363('0x19')]?_0xf4a517[_0x6363('0x19')][_0x6363('0x1a')]===undefined?!![]:![]:!![],'where':_0xf4a517[_0x6363('0x19')]?_0xf4a517[_0x6363('0x19')][_0x6363('0x1b')]||null:null,'attributes':_0xf4a517['options']?_0xf4a517[_0x6363('0x19')][_0x6363('0x1c')]||null:null,'limit':_0xf4a517[_0x6363('0x19')]?_0xf4a517[_0x6363('0x19')]['limit']||null:null,'include':_0xf4a517[_0x6363('0x19')]?_0xf4a517[_0x6363('0x19')][_0x6363('0x1d')]?_[_0x6363('0x1e')](_0xf4a517[_0x6363('0x19')][_0x6363('0x1d')],function(_0x3d3131){return{'model':db[_0x3d3131['model']],'as':_0x3d3131['as'],'attributes':_0x3d3131[_0x6363('0x1c')],'include':_0x3d3131[_0x6363('0x1d')]?_[_0x6363('0x1e')](_0x3d3131[_0x6363('0x1d')],function(_0x14f874){return{'model':db[_0x14f874[_0x6363('0x1f')]],'as':_0x14f874['as'],'attributes':_0x14f874[_0x6363('0x1c')],'include':_0x14f874['include']?_['map'](_0x14f874[_0x6363('0x1d')],function(_0x1f0e9b){return{'model':db[_0x1f0e9b[_0x6363('0x1f')]],'as':_0x1f0e9b['as'],'attributes':_0x1f0e9b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0be1){logger['info']('GetMailQueue',_0xf4a517);logger[_0x6363('0x20')](_0x6363('0x16'),_0xf4a517,JSON[_0x6363('0x21')](_0x1a0be1));_0x50fdd4(_0x1a0be1);})[_0x6363('0x15')](function(_0x18ef93){logger[_0x6363('0x11')](_0x6363('0x16'),_0x18ef93[_0x6363('0x13')],_0xf4a517);_0x353d80(_0x229e28[_0x6363('0x11')](0x1f4,_0x18ef93['message']));});});};exports[_0x6363('0x22')]=function(_0x331719){var _0x6aa622=this;return new Promise(function(_0x5c57fe,_0x427117){return db[_0x6363('0x17')][_0x6363('0x23')]({'raw':_0x331719[_0x6363('0x19')]?_0x331719['options'][_0x6363('0x1a')]===undefined?!![]:![]:!![],'where':_0x331719['options']?_0x331719[_0x6363('0x19')][_0x6363('0x1b')]||null:null,'attributes':_0x331719[_0x6363('0x19')]?_0x331719[_0x6363('0x19')][_0x6363('0x1c')]||null:null,'include':_0x331719[_0x6363('0x19')]?_0x331719[_0x6363('0x19')][_0x6363('0x1d')]?_[_0x6363('0x1e')](_0x331719['options'][_0x6363('0x1d')],function(_0x3a7664){return{'model':db[_0x3a7664[_0x6363('0x1f')]],'as':_0x3a7664['as'],'attributes':_0x3a7664[_0x6363('0x1c')],'include':_0x3a7664[_0x6363('0x1d')]?_[_0x6363('0x1e')](_0x3a7664['include'],function(_0x255a1e){return{'model':db[_0x255a1e[_0x6363('0x1f')]],'as':_0x255a1e['as'],'attributes':_0x255a1e[_0x6363('0x1c')],'include':_0x255a1e[_0x6363('0x1d')]?_[_0x6363('0x1e')](_0x255a1e[_0x6363('0x1d')],function(_0x3ade94){return{'model':db[_0x3ade94[_0x6363('0x1f')]],'as':_0x3ade94['as'],'attributes':_0x3ade94[_0x6363('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6363('0x24')](function(_0x53cf4d){logger[_0x6363('0x14')](_0x6363('0x22'),_0x331719);logger[_0x6363('0x20')](_0x6363('0x22'),_0x331719,JSON['stringify'](_0x53cf4d));_0x5c57fe(_0x53cf4d);})[_0x6363('0x15')](function(_0x4e2b60){logger['error'](_0x6363('0x22'),_0x4e2b60[_0x6363('0x13')],_0x331719);_0x427117(_0x6aa622['error'](0x1f4,_0x4e2b60[_0x6363('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 912b520..06a092c 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 _0xcb7b=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcb7b,0x116));var _0xbcb7=function(_0x59b3aa,_0x5b6618){_0x59b3aa=_0x59b3aa-0x0;var _0x436513=_0xcb7b[_0x59b3aa];return _0x436513;};'use strict';var MailQueueEvents=require(_0xbcb7('0x0'));var events=[_0xbcb7('0x1'),_0xbcb7('0x2'),_0xbcb7('0x3')];function createListener(_0x2eb006,_0x3c21bd){return function(_0x3e632c){_0x3c21bd[_0xbcb7('0x4')](_0x2eb006,_0x3e632c);};}function removeListener(_0x411d06,_0x3bcebc){return function(){MailQueueEvents[_0xbcb7('0x5')](_0x411d06,_0x3bcebc);};}exports[_0xbcb7('0x6')]=function(_0x46862c){for(var _0xce333d=0x0,_0x291d5e=events[_0xbcb7('0x7')];_0xce333d<_0x291d5e;_0xce333d++){var _0x4d08b5=events[_0xce333d];var _0xb4758d=createListener(_0xbcb7('0x8')+_0x4d08b5,_0x46862c);MailQueueEvents['on'](_0x4d08b5,_0xb4758d);}}; \ No newline at end of file +var _0xf1c9=['removeListener','register','length','mailQueue:','./mailQueue.events','remove','update','emit'];(function(_0x18f7b3,_0x53d23e){var _0xe54b36=function(_0x35838b){while(--_0x35838b){_0x18f7b3['push'](_0x18f7b3['shift']());}};_0xe54b36(++_0x53d23e);}(_0xf1c9,0x1cc));var _0x9f1c=function(_0x3d1ea8,_0x7c2204){_0x3d1ea8=_0x3d1ea8-0x0;var _0x2ee493=_0xf1c9[_0x3d1ea8];return _0x2ee493;};'use strict';var MailQueueEvents=require(_0x9f1c('0x0'));var events=['save',_0x9f1c('0x1'),_0x9f1c('0x2')];function createListener(_0x9bdce,_0x199329){return function(_0x1bef77){_0x199329[_0x9f1c('0x3')](_0x9bdce,_0x1bef77);};}function removeListener(_0x31138a,_0x388471){return function(){MailQueueEvents[_0x9f1c('0x4')](_0x31138a,_0x388471);};}exports[_0x9f1c('0x5')]=function(_0x4e8f7a){for(var _0x576b20=0x0,_0x11dbd0=events[_0x9f1c('0x6')];_0x576b20<_0x11dbd0;_0x576b20++){var _0x24a619=events[_0x576b20];var _0x2ce903=createListener(_0x9f1c('0x7')+_0x24a619,_0x4e8f7a);MailQueueEvents['on'](_0x24a619,_0x2ce903);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 39b1d8a..2bfd2a3 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 _0x77b2=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','show','post','put','/:id','update','delete','destroy','multer','path'];(function(_0x42e89c,_0x4522cb){var _0x5b9e3f=function(_0x488aa4){while(--_0x488aa4){_0x42e89c['push'](_0x42e89c['shift']());}};_0x5b9e3f(++_0x4522cb);}(_0x77b2,0x1d9));var _0x277b=function(_0x2687e5,_0x5d297f){_0x2687e5=_0x2687e5-0x0;var _0x2e7d32=_0x77b2[_0x2687e5];return _0x2e7d32;};'use strict';var multer=require(_0x277b('0x0'));var util=require('util');var path=require(_0x277b('0x1'));var timeout=require('connect-timeout');var express=require(_0x277b('0x2'));var router=express[_0x277b('0x3')]();var auth=require(_0x277b('0x4'));var interaction=require(_0x277b('0x5'));var config=require(_0x277b('0x6'));var controller=require(_0x277b('0x7'));router['get']('/',auth[_0x277b('0x8')](),controller[_0x277b('0x9')]);router[_0x277b('0xa')]('/describe',auth[_0x277b('0x8')](),controller[_0x277b('0xb')]);router[_0x277b('0xa')]('/:id',auth[_0x277b('0x8')](),controller[_0x277b('0xc')]);router[_0x277b('0xd')]('/',auth[_0x277b('0x8')](),controller['create']);router[_0x277b('0xe')](_0x277b('0xf'),auth['isAuthenticated'](),controller[_0x277b('0x10')]);router[_0x277b('0x11')](_0x277b('0xf'),auth[_0x277b('0x8')](),controller[_0x277b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5d81=['describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','index','/describe'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x5d81,0xf2));var _0x15d8=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x5d81[_0x38eb23];return _0x48506a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x15d8('0x0'));var timeout=require(_0x15d8('0x1'));var express=require(_0x15d8('0x2'));var router=express[_0x15d8('0x3')]();var auth=require(_0x15d8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x15d8('0x5'));var controller=require(_0x15d8('0x6'));router[_0x15d8('0x7')]('/',auth['isAuthenticated'](),controller[_0x15d8('0x8')]);router['get'](_0x15d8('0x9'),auth['isAuthenticated'](),controller[_0x15d8('0xa')]);router[_0x15d8('0x7')](_0x15d8('0xb'),auth['isAuthenticated'](),controller[_0x15d8('0xc')]);router[_0x15d8('0xd')]('/',auth[_0x15d8('0xe')](),controller[_0x15d8('0xf')]);router[_0x15d8('0x10')](_0x15d8('0xb'),auth[_0x15d8('0xe')](),controller[_0x15d8('0x11')]);router[_0x15d8('0x12')](_0x15d8('0xb'),auth[_0x15d8('0xe')](),controller[_0x15d8('0x13')]);module[_0x15d8('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 e699953..e68bdd6 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 _0x6f9d=['exports','STRING','DATE','sequelize'];(function(_0x4ac4d4,_0x5d7418){var _0x272afb=function(_0x14dda6){while(--_0x14dda6){_0x4ac4d4['push'](_0x4ac4d4['shift']());}};_0x272afb(++_0x5d7418);}(_0x6f9d,0x1d3));var _0xd6f9=function(_0x22153b,_0x4528ec){_0x22153b=_0x22153b-0x0;var _0x217dae=_0x6f9d[_0x22153b];return _0x217dae;};'use strict';var moment=require('moment');var Sequelize=require(_0xd6f9('0x0'));module[_0xd6f9('0x1')]={'uniqueid':{'type':Sequelize[_0xd6f9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd6f9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd6f9('0x3')]},'acceptAt':{'type':Sequelize[_0xd6f9('0x3')]},'exitAt':{'type':Sequelize[_0xd6f9('0x3')]},'reason':{'type':Sequelize[_0xd6f9('0x2')]}}; \ No newline at end of file +var _0x5b5f=['exports','STRING','DATE','moment'];(function(_0x2dcb80,_0x43b8bb){var _0x1bdaa0=function(_0x22da5f){while(--_0x22da5f){_0x2dcb80['push'](_0x2dcb80['shift']());}};_0x1bdaa0(++_0x43b8bb);}(_0x5b5f,0x19b));var _0xf5b5=function(_0x3068c8,_0x1f5504){_0x3068c8=_0x3068c8-0x0;var _0x40c6e4=_0x5b5f[_0x3068c8];return _0x40c6e4;};'use strict';var moment=require(_0xf5b5('0x0'));var Sequelize=require('sequelize');module[_0xf5b5('0x1')]={'uniqueid':{'type':Sequelize[_0xf5b5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf5b5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 905f6d6..d716b63 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 _0x62e4=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','MailQueueReport','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x1f7fbf,_0x49e8c9){var _0x172e37=function(_0x39262b){while(--_0x39262b){_0x1f7fbf['push'](_0x1f7fbf['shift']());}};_0x172e37(++_0x49e8c9);}(_0x62e4,0x174));var _0x462e=function(_0x2e2c49,_0x57a847){_0x2e2c49=_0x2e2c49-0x0;var _0xaaa7ea=_0x62e4[_0x2e2c49];return _0xaaa7ea;};'use strict';var pdf=require(_0x462e('0x0'));var emlformat=require(_0x462e('0x1'));var rimraf=require(_0x462e('0x2'));var zipdir=require(_0x462e('0x3'));var jsonpatch=require(_0x462e('0x4'));var rp=require(_0x462e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x462e('0x6'));var util=require(_0x462e('0x7'));var path=require(_0x462e('0x8'));var sox=require('sox');var csv=require(_0x462e('0x9'));var ejs=require(_0x462e('0xa'));var fs=require('fs');var _=require(_0x462e('0xb'));var squel=require(_0x462e('0xc'));var crypto=require(_0x462e('0xd'));var jsforce=require(_0x462e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x462e('0x9'));var querystring=require(_0x462e('0xf'));var Papa=require(_0x462e('0x10'));var Redis=require(_0x462e('0x11'));var authService=require(_0x462e('0x12'));var qs=require(_0x462e('0x13'));var as=require(_0x462e('0x14'));var hardwareService=require(_0x462e('0x15'));var logger=require(_0x462e('0x16'))(_0x462e('0x17'));var utils=require(_0x462e('0x18'));var config=require(_0x462e('0x19'));var licenseUtil=require(_0x462e('0x1a'));var db=require(_0x462e('0x1b'))['db'];function respondWithStatusCode(_0x363833,_0x3d45fe){_0x3d45fe=_0x3d45fe||0xcc;return function(_0x212be8){if(_0x212be8){return _0x363833['sendStatus'](_0x3d45fe);}return _0x363833['status'](_0x3d45fe)['end']();};}function respondWithResult(_0x1ad17b,_0x5f3a06){_0x5f3a06=_0x5f3a06||0xc8;return function(_0x18374b){if(_0x18374b){return _0x1ad17b['status'](_0x5f3a06)['json'](_0x18374b);}};}function respondWithFilteredResult(_0x483261,_0x51e3f8){return function(_0x1e9b8f){if(_0x1e9b8f){var _0x1aa8cf=_0x1e9b8f['count'],_0x444b10=_0x51e3f8[_0x462e('0x1c')],_0x2948f0=_0x51e3f8[_0x462e('0x1c')]+_0x51e3f8[_0x462e('0x1d')],_0x1302b7;if(_0x2948f0>=_0x1aa8cf){_0x2948f0=_0x1aa8cf;_0x1302b7=0xc8;}else{_0x1302b7=0xce;}_0x483261[_0x462e('0x1e')](_0x1302b7);return _0x483261['set'](_0x462e('0x1f'),_0x444b10+'-'+_0x2948f0+'/'+_0x1aa8cf)['json'](_0x1e9b8f);}return null;};}function patchUpdates(_0x1589ce){return function(_0x195f02){try{jsonpatch[_0x462e('0x20')](_0x195f02,_0x1589ce,!![]);}catch(_0x4f5fbf){return BPromise[_0x462e('0x21')](_0x4f5fbf);}return _0x195f02[_0x462e('0x22')]();};}function saveUpdates(_0x45ed7b,_0x4f2f0a){return function(_0x1c6da8){if(_0x1c6da8){return _0x1c6da8[_0x462e('0x23')](_0x45ed7b)[_0x462e('0x24')](function(_0x41471c){return _0x41471c;});}return null;};}function removeEntity(_0x23ffa5,_0x4544cb){return function(_0x1861a4){if(_0x1861a4){return _0x1861a4[_0x462e('0x25')]()[_0x462e('0x24')](function(){_0x23ffa5['status'](0xcc)[_0x462e('0x26')]();});}};}function handleEntityNotFound(_0x3231a3,_0x413676){return function(_0x5b4d6f){if(!_0x5b4d6f){_0x3231a3[_0x462e('0x27')](0x194);}return _0x5b4d6f;};}function handleError(_0x29492a,_0xce85a9){_0xce85a9=_0xce85a9||0x1f4;return function(_0x2c5c14){logger[_0x462e('0x28')](_0x2c5c14['stack']);if(_0x2c5c14[_0x462e('0x29')]){delete _0x2c5c14['name'];}_0x29492a['status'](_0xce85a9)[_0x462e('0x2a')](_0x2c5c14);};}exports['index']=function(_0x4f270c,_0xec9bae){var _0x1f0fe3={},_0xcc5e4d={},_0x3541a9={'count':0x0,'rows':[]};var _0x2e1e58=_[_0x462e('0x2b')](db[_0x462e('0x2c')]['rawAttributes'],function(_0x45319c){return{'name':_0x45319c[_0x462e('0x2d')],'type':_0x45319c['type'][_0x462e('0x2e')]};});_0xcc5e4d['model']=_[_0x462e('0x2b')](_0x2e1e58,_0x462e('0x29'));_0xcc5e4d[_0x462e('0x2f')]=_['keys'](_0x4f270c[_0x462e('0x2f')]);_0xcc5e4d[_0x462e('0x30')]=_['intersection'](_0xcc5e4d[_0x462e('0x31')],_0xcc5e4d[_0x462e('0x2f')]);_0x1f0fe3[_0x462e('0x32')]=_[_0x462e('0x33')](_0xcc5e4d['model'],qs[_0x462e('0x34')](_0x4f270c[_0x462e('0x2f')][_0x462e('0x34')]));_0x1f0fe3[_0x462e('0x32')]=_0x1f0fe3[_0x462e('0x32')][_0x462e('0x35')]?_0x1f0fe3[_0x462e('0x32')]:_0xcc5e4d['model'];if(!_0x4f270c[_0x462e('0x2f')][_0x462e('0x36')]('nolimit')){_0x1f0fe3[_0x462e('0x1d')]=qs[_0x462e('0x1d')](_0x4f270c[_0x462e('0x2f')][_0x462e('0x1d')]);_0x1f0fe3[_0x462e('0x1c')]=qs[_0x462e('0x1c')](_0x4f270c['query']['offset']);}_0x1f0fe3[_0x462e('0x37')]=qs[_0x462e('0x38')](_0x4f270c[_0x462e('0x2f')][_0x462e('0x38')]);_0x1f0fe3[_0x462e('0x39')]=qs[_0x462e('0x30')](_[_0x462e('0x3a')](_0x4f270c[_0x462e('0x2f')],_0xcc5e4d[_0x462e('0x30')]),_0x2e1e58);if(_0x4f270c[_0x462e('0x2f')][_0x462e('0x3b')]){_0x1f0fe3['where']=_[_0x462e('0x3c')](_0x1f0fe3[_0x462e('0x39')],{'$or':_['map'](_0x2e1e58,function(_0x44690c){if(_0x44690c['type']!==_0x462e('0x3d')){var _0xc3bc3f={};_0xc3bc3f[_0x44690c[_0x462e('0x29')]]={'$like':'%'+_0x4f270c[_0x462e('0x2f')][_0x462e('0x3b')]+'%'};return _0xc3bc3f;}})});}_0x1f0fe3=_[_0x462e('0x3c')]({},_0x1f0fe3,_0x4f270c[_0x462e('0x3e')]);var _0x19e9d8={'where':_0x1f0fe3[_0x462e('0x39')]};return db[_0x462e('0x2c')][_0x462e('0x3f')](_0x19e9d8)[_0x462e('0x24')](function(_0x4ef960){_0x3541a9['count']=_0x4ef960;if(_0x4f270c[_0x462e('0x2f')][_0x462e('0x40')]){_0x1f0fe3[_0x462e('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x462e('0x42')](_0x1f0fe3);})[_0x462e('0x24')](function(_0x2e97ca){_0x3541a9[_0x462e('0x43')]=_0x2e97ca;return _0x3541a9;})['then'](respondWithFilteredResult(_0xec9bae,_0x1f0fe3))[_0x462e('0x44')](handleError(_0xec9bae,null));};exports[_0x462e('0x45')]=function(_0x2090ce,_0x70dfb7){var _0x2a7db2={'raw':!![],'where':{'id':_0x2090ce['params']['id']}},_0x5272f9={};_0x5272f9['model']=_[_0x462e('0x46')](db['MailQueueReport'][_0x462e('0x47')]);_0x5272f9[_0x462e('0x2f')]=_[_0x462e('0x46')](_0x2090ce[_0x462e('0x2f')]);_0x5272f9[_0x462e('0x30')]=_[_0x462e('0x33')](_0x5272f9[_0x462e('0x31')],_0x5272f9[_0x462e('0x2f')]);_0x2a7db2[_0x462e('0x32')]=_[_0x462e('0x33')](_0x5272f9[_0x462e('0x31')],qs[_0x462e('0x34')](_0x2090ce[_0x462e('0x2f')][_0x462e('0x34')]));_0x2a7db2['attributes']=_0x2a7db2[_0x462e('0x32')][_0x462e('0x35')]?_0x2a7db2[_0x462e('0x32')]:_0x5272f9['model'];if(_0x2090ce[_0x462e('0x2f')][_0x462e('0x40')]){_0x2a7db2['include']=[{'all':!![]}];}_0x2a7db2=_[_0x462e('0x3c')]({},_0x2a7db2,_0x2090ce['options']);return db['MailQueueReport']['find'](_0x2a7db2)['then'](handleEntityNotFound(_0x70dfb7,null))['then'](respondWithResult(_0x70dfb7,null))[_0x462e('0x44')](handleError(_0x70dfb7,null));};exports[_0x462e('0x48')]=function(_0x368659,_0x579dcd){return db[_0x462e('0x2c')]['create'](_0x368659[_0x462e('0x49')],{})[_0x462e('0x24')](respondWithResult(_0x579dcd,0xc9))[_0x462e('0x44')](handleError(_0x579dcd,null));};exports[_0x462e('0x23')]=function(_0x57b0f6,_0xcd891c){if(_0x57b0f6['body']['id']){delete _0x57b0f6[_0x462e('0x49')]['id'];}return db[_0x462e('0x2c')]['find']({'where':{'id':_0x57b0f6['params']['id']}})[_0x462e('0x24')](handleEntityNotFound(_0xcd891c,null))[_0x462e('0x24')](saveUpdates(_0x57b0f6[_0x462e('0x49')],null))[_0x462e('0x24')](respondWithResult(_0xcd891c,null))[_0x462e('0x44')](handleError(_0xcd891c,null));};exports['destroy']=function(_0x51abb9,_0x11c0fd){return db[_0x462e('0x2c')][_0x462e('0x4a')]({'where':{'id':_0x51abb9[_0x462e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11c0fd,null))[_0x462e('0x24')](removeEntity(_0x11c0fd,null))[_0x462e('0x44')](handleError(_0x11c0fd,null));};exports['describe']=function(_0x3f4744,_0x30716e){return db[_0x462e('0x2c')][_0x462e('0x4c')]()[_0x462e('0x24')](respondWithResult(_0x30716e,null))[_0x462e('0x44')](handleError(_0x30716e,null));}; \ No newline at end of file +var _0xe87a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','intersection','options','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring'];(function(_0x53a874,_0x5a9596){var _0x129810=function(_0x3a217f){while(--_0x3a217f){_0x53a874['push'](_0x53a874['shift']());}};_0x129810(++_0x5a9596);}(_0xe87a,0x1e2));var _0xae87=function(_0x1eee86,_0x274c22){_0x1eee86=_0x1eee86-0x0;var _0x190d39=_0xe87a[_0x1eee86];return _0x190d39;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xae87('0x0'));var zipdir=require(_0xae87('0x1'));var jsonpatch=require(_0xae87('0x2'));var rp=require(_0xae87('0x3'));var moment=require('moment');var BPromise=require(_0xae87('0x4'));var Mustache=require(_0xae87('0x5'));var util=require(_0xae87('0x6'));var path=require(_0xae87('0x7'));var sox=require(_0xae87('0x8'));var csv=require(_0xae87('0x9'));var ejs=require(_0xae87('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae87('0xb'));var crypto=require(_0xae87('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xae87('0xd'));var toCsv=require(_0xae87('0x9'));var querystring=require(_0xae87('0xe'));var Papa=require(_0xae87('0xf'));var Redis=require(_0xae87('0x10'));var authService=require(_0xae87('0x11'));var qs=require(_0xae87('0x12'));var as=require(_0xae87('0x13'));var hardwareService=require(_0xae87('0x14'));var logger=require('../../config/logger')(_0xae87('0x15'));var utils=require('../../config/utils');var config=require(_0xae87('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae87('0x17'))['db'];function respondWithStatusCode(_0x511c4b,_0x2aa1fa){_0x2aa1fa=_0x2aa1fa||0xcc;return function(_0x526e04){if(_0x526e04){return _0x511c4b[_0xae87('0x18')](_0x2aa1fa);}return _0x511c4b[_0xae87('0x19')](_0x2aa1fa)['end']();};}function respondWithResult(_0x483388,_0x5df4f9){_0x5df4f9=_0x5df4f9||0xc8;return function(_0x50c5f8){if(_0x50c5f8){return _0x483388[_0xae87('0x19')](_0x5df4f9)[_0xae87('0x1a')](_0x50c5f8);}};}function respondWithFilteredResult(_0x46ce52,_0x4af9e8){return function(_0x1ea914){if(_0x1ea914){var _0x49fa18=_0x1ea914[_0xae87('0x1b')],_0x2deb95=_0x4af9e8[_0xae87('0x1c')],_0x149be2=_0x4af9e8[_0xae87('0x1c')]+_0x4af9e8[_0xae87('0x1d')],_0x1d6326;if(_0x149be2>=_0x49fa18){_0x149be2=_0x49fa18;_0x1d6326=0xc8;}else{_0x1d6326=0xce;}_0x46ce52['status'](_0x1d6326);return _0x46ce52[_0xae87('0x1e')](_0xae87('0x1f'),_0x2deb95+'-'+_0x149be2+'/'+_0x49fa18)[_0xae87('0x1a')](_0x1ea914);}return null;};}function patchUpdates(_0x9ebc1e){return function(_0x487df7){try{jsonpatch['apply'](_0x487df7,_0x9ebc1e,!![]);}catch(_0x35302b){return BPromise[_0xae87('0x20')](_0x35302b);}return _0x487df7[_0xae87('0x21')]();};}function saveUpdates(_0x156312,_0x21fb55){return function(_0xbcea35){if(_0xbcea35){return _0xbcea35[_0xae87('0x22')](_0x156312)[_0xae87('0x23')](function(_0x3b9e44){return _0x3b9e44;});}return null;};}function removeEntity(_0xad0dfe,_0x587f01){return function(_0x2148e7){if(_0x2148e7){return _0x2148e7[_0xae87('0x24')]()[_0xae87('0x23')](function(){_0xad0dfe['status'](0xcc)[_0xae87('0x25')]();});}};}function handleEntityNotFound(_0x2f2c9d,_0x22a094){return function(_0x5c1da5){if(!_0x5c1da5){_0x2f2c9d[_0xae87('0x18')](0x194);}return _0x5c1da5;};}function handleError(_0x17309b,_0x59e848){_0x59e848=_0x59e848||0x1f4;return function(_0x549d65){logger[_0xae87('0x26')](_0x549d65[_0xae87('0x27')]);if(_0x549d65[_0xae87('0x28')]){delete _0x549d65[_0xae87('0x28')];}_0x17309b[_0xae87('0x19')](_0x59e848)['send'](_0x549d65);};}exports['index']=function(_0x51cd35,_0x56c173){var _0x1aa6bf={},_0x448f5b={},_0x48465d={'count':0x0,'rows':[]};var _0x151f12=_[_0xae87('0x29')](db[_0xae87('0x2a')][_0xae87('0x2b')],function(_0x353a49){return{'name':_0x353a49[_0xae87('0x2c')],'type':_0x353a49['type'][_0xae87('0x2d')]};});_0x448f5b[_0xae87('0x2e')]=_[_0xae87('0x29')](_0x151f12,'name');_0x448f5b[_0xae87('0x2f')]=_[_0xae87('0x30')](_0x51cd35[_0xae87('0x2f')]);_0x448f5b['filters']=_['intersection'](_0x448f5b[_0xae87('0x2e')],_0x448f5b['query']);_0x1aa6bf[_0xae87('0x31')]=_['intersection'](_0x448f5b[_0xae87('0x2e')],qs[_0xae87('0x32')](_0x51cd35['query'][_0xae87('0x32')]));_0x1aa6bf[_0xae87('0x31')]=_0x1aa6bf[_0xae87('0x31')][_0xae87('0x33')]?_0x1aa6bf[_0xae87('0x31')]:_0x448f5b['model'];if(!_0x51cd35[_0xae87('0x2f')]['hasOwnProperty']('nolimit')){_0x1aa6bf[_0xae87('0x1d')]=qs[_0xae87('0x1d')](_0x51cd35[_0xae87('0x2f')][_0xae87('0x1d')]);_0x1aa6bf[_0xae87('0x1c')]=qs[_0xae87('0x1c')](_0x51cd35[_0xae87('0x2f')]['offset']);}_0x1aa6bf['order']=qs[_0xae87('0x34')](_0x51cd35[_0xae87('0x2f')]['sort']);_0x1aa6bf[_0xae87('0x35')]=qs[_0xae87('0x36')](_[_0xae87('0x37')](_0x51cd35['query'],_0x448f5b[_0xae87('0x36')]),_0x151f12);if(_0x51cd35[_0xae87('0x2f')]['filter']){_0x1aa6bf[_0xae87('0x35')]=_[_0xae87('0x38')](_0x1aa6bf['where'],{'$or':_[_0xae87('0x29')](_0x151f12,function(_0x363788){if(_0x363788[_0xae87('0x39')]!==_0xae87('0x3a')){var _0x2e8ccc={};_0x2e8ccc[_0x363788[_0xae87('0x28')]]={'$like':'%'+_0x51cd35[_0xae87('0x2f')][_0xae87('0x3b')]+'%'};return _0x2e8ccc;}})});}_0x1aa6bf=_['merge']({},_0x1aa6bf,_0x51cd35['options']);var _0x12922c={'where':_0x1aa6bf['where']};return db[_0xae87('0x2a')][_0xae87('0x1b')](_0x12922c)[_0xae87('0x23')](function(_0x4cb556){_0x48465d[_0xae87('0x1b')]=_0x4cb556;if(_0x51cd35[_0xae87('0x2f')][_0xae87('0x3c')]){_0x1aa6bf['include']=[{'all':!![]}];}return db[_0xae87('0x2a')][_0xae87('0x3d')](_0x1aa6bf);})[_0xae87('0x23')](function(_0x793a9e){_0x48465d[_0xae87('0x3e')]=_0x793a9e;return _0x48465d;})[_0xae87('0x23')](respondWithFilteredResult(_0x56c173,_0x1aa6bf))[_0xae87('0x3f')](handleError(_0x56c173,null));};exports[_0xae87('0x40')]=function(_0x28348a,_0x2670b6){var _0x166bfd={'raw':!![],'where':{'id':_0x28348a[_0xae87('0x41')]['id']}},_0x505ab9={};_0x505ab9[_0xae87('0x2e')]=_[_0xae87('0x30')](db[_0xae87('0x2a')][_0xae87('0x2b')]);_0x505ab9[_0xae87('0x2f')]=_[_0xae87('0x30')](_0x28348a[_0xae87('0x2f')]);_0x505ab9['filters']=_['intersection'](_0x505ab9[_0xae87('0x2e')],_0x505ab9[_0xae87('0x2f')]);_0x166bfd[_0xae87('0x31')]=_[_0xae87('0x42')](_0x505ab9[_0xae87('0x2e')],qs[_0xae87('0x32')](_0x28348a[_0xae87('0x2f')][_0xae87('0x32')]));_0x166bfd['attributes']=_0x166bfd['attributes'][_0xae87('0x33')]?_0x166bfd['attributes']:_0x505ab9[_0xae87('0x2e')];if(_0x28348a['query'][_0xae87('0x3c')]){_0x166bfd['include']=[{'all':!![]}];}_0x166bfd=_[_0xae87('0x38')]({},_0x166bfd,_0x28348a[_0xae87('0x43')]);return db[_0xae87('0x2a')]['find'](_0x166bfd)[_0xae87('0x23')](handleEntityNotFound(_0x2670b6,null))[_0xae87('0x23')](respondWithResult(_0x2670b6,null))[_0xae87('0x3f')](handleError(_0x2670b6,null));};exports[_0xae87('0x44')]=function(_0x577ebc,_0x252dec){return db['MailQueueReport'][_0xae87('0x44')](_0x577ebc[_0xae87('0x45')],{})[_0xae87('0x23')](respondWithResult(_0x252dec,0xc9))[_0xae87('0x3f')](handleError(_0x252dec,null));};exports[_0xae87('0x22')]=function(_0x1d4789,_0x18c421){if(_0x1d4789['body']['id']){delete _0x1d4789[_0xae87('0x45')]['id'];}return db[_0xae87('0x2a')]['find']({'where':{'id':_0x1d4789[_0xae87('0x41')]['id']}})[_0xae87('0x23')](handleEntityNotFound(_0x18c421,null))[_0xae87('0x23')](saveUpdates(_0x1d4789[_0xae87('0x45')],null))['then'](respondWithResult(_0x18c421,null))[_0xae87('0x3f')](handleError(_0x18c421,null));};exports[_0xae87('0x24')]=function(_0x19ef7f,_0x27c414){return db[_0xae87('0x2a')]['find']({'where':{'id':_0x19ef7f[_0xae87('0x41')]['id']}})[_0xae87('0x23')](handleEntityNotFound(_0x27c414,null))[_0xae87('0x23')](removeEntity(_0x27c414,null))[_0xae87('0x3f')](handleError(_0x27c414,null));};exports['describe']=function(_0x2cc4d7,_0x3e8112){return db[_0xae87('0x2a')][_0xae87('0x46')]()[_0xae87('0x23')](respondWithResult(_0x3e8112,null))['catch'](handleError(_0x3e8112,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 248afab..fb60e1a 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 _0x96dc=['util','api','moment','bluebird','path','rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x96dc,0x134));var _0xc96d=function(_0x3b6fca,_0x38a543){_0x3b6fca=_0x3b6fca-0x0;var _0x54667e=_0x96dc[_0x3b6fca];return _0x54667e;};'use strict';var _=require('lodash');var util=require(_0xc96d('0x0'));var logger=require('../../config/logger')(_0xc96d('0x1'));var moment=require(_0xc96d('0x2'));var BPromise=require(_0xc96d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc96d('0x4'));var rimraf=require(_0xc96d('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xc96d('0x6')]=function(_0x5b8f61,_0xb047bc){return _0x5b8f61[_0xc96d('0x7')](_0xc96d('0x8'),attributes,{'tableName':_0xc96d('0x9'),'paranoid':![],'indexes':[{'name':_0xc96d('0xa'),'fields':[_0xc96d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cf3=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x1cf3,0x1ef));var _0x31cf=function(_0x373aba,_0x256fd8){_0x373aba=_0x373aba-0x0;var _0x575064=_0x1cf3[_0x373aba];return _0x575064;};'use strict';var _=require(_0x31cf('0x0'));var util=require(_0x31cf('0x1'));var logger=require(_0x31cf('0x2'))(_0x31cf('0x3'));var moment=require(_0x31cf('0x4'));var BPromise=require(_0x31cf('0x5'));var rp=require(_0x31cf('0x6'));var fs=require('fs');var path=require(_0x31cf('0x7'));var rimraf=require(_0x31cf('0x8'));var config=require('../../config/environment');var attributes=require(_0x31cf('0x9'));module[_0x31cf('0xa')]=function(_0x3d8bd0,_0x5a9325){return _0x3d8bd0[_0x31cf('0xb')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x31cf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a38e8f2..d7460b0 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 _0x4668=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes','limit','debug'];(function(_0x283f1b,_0x51fb64){var _0x3bc1d1=function(_0x4258b3){while(--_0x4258b3){_0x283f1b['push'](_0x283f1b['shift']());}};_0x3bc1d1(++_0x51fb64);}(_0x4668,0x1cf));var _0x8466=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4668[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x8466('0x0'));var moment=require(_0x8466('0x1'));var BPromise=require(_0x8466('0x2'));var rs=require(_0x8466('0x3'));var fs=require('fs');var Redis=require(_0x8466('0x4'));var db=require(_0x8466('0x5'))['db'];var utils=require(_0x8466('0x6'));var logger=require(_0x8466('0x7'))(_0x8466('0x8'));var config=require(_0x8466('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe5892,_0x15b6c3,_0x1dfcba){return new BPromise(function(_0x4be5d7,_0x1468ea){return client[_0x8466('0xa')](_0xe5892,_0x1dfcba)[_0x8466('0xb')](function(_0x5cbc64){logger[_0x8466('0xc')](_0x8466('0xd'),_0x15b6c3,_0x8466('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x15b6c3,'request\x20sent',JSON[_0x8466('0xf')](_0x5cbc64));if(_0x5cbc64[_0x8466('0x10')]){if(_0x5cbc64[_0x8466('0x10')][_0x8466('0x11')]===0x1f4){logger[_0x8466('0x10')](_0x8466('0xd'),_0x15b6c3,_0x5cbc64['error'][_0x8466('0x12')]);return _0x1468ea(_0x5cbc64[_0x8466('0x10')][_0x8466('0x12')]);}logger[_0x8466('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x15b6c3,_0x5cbc64[_0x8466('0x10')][_0x8466('0x12')]);return _0x4be5d7(_0x5cbc64[_0x8466('0x10')]['message']);}else{logger['info'](_0x8466('0xd'),_0x15b6c3,_0x8466('0xe'));_0x4be5d7(_0x5cbc64[_0x8466('0x13')][_0x8466('0x12')]);}})['catch'](function(_0x2729ad){logger[_0x8466('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x15b6c3,_0x2729ad);_0x1468ea(_0x2729ad);});});}exports[_0x8466('0x14')]=function(_0x3dd88c){var _0x438b32=this;return new Promise(function(_0x2e54c4,_0x44ffb9){return db[_0x8466('0x15')][_0x8466('0x16')](_0x3dd88c[_0x8466('0x17')],{'raw':_0x3dd88c['options']?_0x3dd88c[_0x8466('0x18')][_0x8466('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3468f7){logger['info'](_0x8466('0x14'),_0x3dd88c);logger['debug']('CreateMailQueueReport',_0x3dd88c,JSON[_0x8466('0xf')](_0x3468f7));_0x2e54c4(_0x3468f7);})['catch'](function(_0x79b9dd){logger['error'](_0x8466('0x14'),_0x79b9dd[_0x8466('0x12')],_0x3dd88c);_0x44ffb9(_0x438b32['error'](0x1f4,_0x79b9dd[_0x8466('0x12')]));});});};exports[_0x8466('0x1a')]=function(_0x40a2c2){var _0x19a403=this;return new Promise(function(_0x3009ee,_0x4fdc12){return db[_0x8466('0x15')][_0x8466('0x1b')](_0x40a2c2[_0x8466('0x17')],{'raw':_0x40a2c2[_0x8466('0x18')]?_0x40a2c2['options'][_0x8466('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a2c2[_0x8466('0x18')]?_0x40a2c2[_0x8466('0x18')][_0x8466('0x1c')]||null:null,'attributes':_0x40a2c2[_0x8466('0x18')]?_0x40a2c2[_0x8466('0x18')][_0x8466('0x1d')]||null:null,'limit':_0x40a2c2['options']?_0x40a2c2['options'][_0x8466('0x1e')]||null:null})[_0x8466('0xb')](function(_0x5115bc){logger['info'](_0x8466('0x1a'),_0x40a2c2);logger[_0x8466('0x1f')]('UpdateMailQueueReport',_0x40a2c2,JSON[_0x8466('0xf')](_0x5115bc));_0x3009ee(_0x5115bc);})[_0x8466('0x20')](function(_0x50950d){logger[_0x8466('0x10')](_0x8466('0x1a'),_0x50950d[_0x8466('0x12')],_0x40a2c2);_0x4fdc12(_0x19a403['error'](0x1f4,_0x50950d[_0x8466('0x12')]));});});}; \ No newline at end of file +var _0x6d4b=['body','options','info','debug','UpdateMailQueueReport','update','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x6d4b,0xb3));var _0xb6d4=function(_0x81a08f,_0x125ea7){_0x81a08f=_0x81a08f-0x0;var _0x35e1a4=_0x6d4b[_0x81a08f];return _0x35e1a4;};'use strict';var _=require(_0xb6d4('0x0'));var util=require(_0xb6d4('0x1'));var moment=require(_0xb6d4('0x2'));var BPromise=require(_0xb6d4('0x3'));var rs=require(_0xb6d4('0x4'));var fs=require('fs');var Redis=require(_0xb6d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb6d4('0x6'));var config=require(_0xb6d4('0x7'));var jayson=require(_0xb6d4('0x8'));var client=jayson[_0xb6d4('0x9')][_0xb6d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x500305,_0x16200e,_0x1e4496){return new BPromise(function(_0x35e366,_0x5702b3){return client[_0xb6d4('0xb')](_0x500305,_0x1e4496)[_0xb6d4('0xc')](function(_0x118afc){logger['info'](_0xb6d4('0xd'),_0x16200e,_0xb6d4('0xe'));logger['debug'](_0xb6d4('0xf'),_0x16200e,'request\x20sent',JSON[_0xb6d4('0x10')](_0x118afc));if(_0x118afc['error']){if(_0x118afc[_0xb6d4('0x11')][_0xb6d4('0x12')]===0x1f4){logger[_0xb6d4('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x16200e,_0x118afc[_0xb6d4('0x11')][_0xb6d4('0x13')]);return _0x5702b3(_0x118afc[_0xb6d4('0x11')]['message']);}logger[_0xb6d4('0x11')](_0xb6d4('0xd'),_0x16200e,_0x118afc['error']['message']);return _0x35e366(_0x118afc[_0xb6d4('0x11')][_0xb6d4('0x13')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x16200e,_0xb6d4('0xe'));_0x35e366(_0x118afc[_0xb6d4('0x14')]['message']);}})[_0xb6d4('0x15')](function(_0x10fef6){logger[_0xb6d4('0x11')](_0xb6d4('0xd'),_0x16200e,_0x10fef6);_0x5702b3(_0x10fef6);});});}exports[_0xb6d4('0x16')]=function(_0x1c4ab2){var _0xfdf5a2=this;return new Promise(function(_0x172cca,_0x573890){return db[_0xb6d4('0x17')][_0xb6d4('0x18')](_0x1c4ab2[_0xb6d4('0x19')],{'raw':_0x1c4ab2[_0xb6d4('0x1a')]?_0x1c4ab2[_0xb6d4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb6d4('0xc')](function(_0xc214ac){logger[_0xb6d4('0x1b')](_0xb6d4('0x16'),_0x1c4ab2);logger[_0xb6d4('0x1c')](_0xb6d4('0x16'),_0x1c4ab2,JSON[_0xb6d4('0x10')](_0xc214ac));_0x172cca(_0xc214ac);})[_0xb6d4('0x15')](function(_0x37e07e){logger[_0xb6d4('0x11')](_0xb6d4('0x16'),_0x37e07e[_0xb6d4('0x13')],_0x1c4ab2);_0x573890(_0xfdf5a2[_0xb6d4('0x11')](0x1f4,_0x37e07e[_0xb6d4('0x13')]));});});};exports[_0xb6d4('0x1d')]=function(_0x13d3fd){var _0x12f609=this;return new Promise(function(_0x3d013f,_0x32cf6a){return db[_0xb6d4('0x17')][_0xb6d4('0x1e')](_0x13d3fd[_0xb6d4('0x19')],{'raw':_0x13d3fd[_0xb6d4('0x1a')]?_0x13d3fd[_0xb6d4('0x1a')][_0xb6d4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13d3fd['options']?_0x13d3fd[_0xb6d4('0x1a')]['where']||null:null,'attributes':_0x13d3fd[_0xb6d4('0x1a')]?_0x13d3fd['options'][_0xb6d4('0x20')]||null:null,'limit':_0x13d3fd[_0xb6d4('0x1a')]?_0x13d3fd[_0xb6d4('0x1a')][_0xb6d4('0x21')]||null:null})[_0xb6d4('0xc')](function(_0xf9b097){logger[_0xb6d4('0x1b')](_0xb6d4('0x1d'),_0x13d3fd);logger[_0xb6d4('0x1c')](_0xb6d4('0x1d'),_0x13d3fd,JSON[_0xb6d4('0x10')](_0xf9b097));_0x3d013f(_0xf9b097);})[_0xb6d4('0x15')](function(_0x1aaee5){logger[_0xb6d4('0x11')](_0xb6d4('0x1d'),_0x1aaee5[_0xb6d4('0x13')],_0x13d3fd);_0x32cf6a(_0x12f609[_0xb6d4('0x11')](0x1f4,_0x1aaee5[_0xb6d4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5bb77dd..6d14bd7 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 _0x9365=['path','express','Router','../../components/auth/service','../../config/environment','util'];(function(_0x229ad7,_0x296078){var _0x39e032=function(_0x308384){while(--_0x308384){_0x229ad7['push'](_0x229ad7['shift']());}};_0x39e032(++_0x296078);}(_0x9365,0xe9));var _0x5936=function(_0x3fc7a5,_0x1d8a92){_0x3fc7a5=_0x3fc7a5-0x0;var _0xce911e=_0x9365[_0x3fc7a5];return _0xce911e;};'use strict';var multer=require('multer');var util=require(_0x5936('0x0'));var path=require(_0x5936('0x1'));var timeout=require('connect-timeout');var express=require(_0x5936('0x2'));var router=express[_0x5936('0x3')]();var auth=require(_0x5936('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5936('0x5'));module['exports']=router; \ No newline at end of file +var _0x302c=['express','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x26ed4b,_0xadc9a3){var _0x4669f3=function(_0x506824){while(--_0x506824){_0x26ed4b['push'](_0x26ed4b['shift']());}};_0x4669f3(++_0xadc9a3);}(_0x302c,0x1d9));var _0xc302=function(_0x499f8b,_0x4607a1){_0x499f8b=_0x499f8b-0x0;var _0x425630=_0x302c[_0x499f8b];return _0x425630;};'use strict';var multer=require('multer');var util=require(_0xc302('0x0'));var path=require(_0xc302('0x1'));var timeout=require(_0xc302('0x2'));var express=require(_0xc302('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc302('0x4'));var config=require(_0xc302('0x5'));module[_0xc302('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index fadf589..2f03cde 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 _0x49cb=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x49cb,0x134));var _0xb49c=function(_0x10afec,_0x5ee21b){_0x10afec=_0x10afec-0x0;var _0x3424f8=_0x49cb[_0x10afec];return _0x3424f8;};'use strict';var Sequelize=require(_0xb49c('0x0'));module[_0xb49c('0x1')]={'description':{'type':Sequelize[_0xb49c('0x2')]},'host':{'type':Sequelize[_0xb49c('0x2')]},'authentication':{'type':Sequelize[_0xb49c('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb49c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb49c('0x2')]},'port':{'type':Sequelize[_0xb49c('0x4')]},'tls':{'type':Sequelize[_0xb49c('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb49c('0x2')],'defaultValue':_0xb49c('0x5')},'connTimeout':{'type':Sequelize[_0xb49c('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb49c('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb49c('0x2')]}}; \ No newline at end of file +var _0x75b3=['INBOX','exports','STRING','username','INTEGER'];(function(_0x3899a3,_0xcb527){var _0x13e1ce=function(_0x19cdb4){while(--_0x19cdb4){_0x3899a3['push'](_0x3899a3['shift']());}};_0x13e1ce(++_0xcb527);}(_0x75b3,0x92));var _0x375b=function(_0xa5d4f7,_0x326a49){_0xa5d4f7=_0xa5d4f7-0x0;var _0x52991a=_0x75b3[_0xa5d4f7];return _0x52991a;};'use strict';var Sequelize=require('sequelize');module[_0x375b('0x0')]={'description':{'type':Sequelize[_0x375b('0x1')]},'host':{'type':Sequelize[_0x375b('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x375b('0x1')],'unique':_0x375b('0x2')},'password':{'type':Sequelize[_0x375b('0x1')]},'port':{'type':Sequelize[_0x375b('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x375b('0x1')],'defaultValue':_0x375b('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x375b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x375b('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 00f0c4f..19223e2 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 _0x49db=['util','../../config/logger','api','moment','request-promise','path','rimraf','./mailServerIn.attributes','define','MailServerIn','lodash'];(function(_0x366279,_0x209a2b){var _0x3d11b1=function(_0x2541ae){while(--_0x2541ae){_0x366279['push'](_0x366279['shift']());}};_0x3d11b1(++_0x209a2b);}(_0x49db,0xc5));var _0xb49d=function(_0x5b3e28,_0x2ad693){_0x5b3e28=_0x5b3e28-0x0;var _0x21a6f4=_0x49db[_0x5b3e28];return _0x21a6f4;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var logger=require(_0xb49d('0x2'))(_0xb49d('0x3'));var moment=require(_0xb49d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb49d('0x5'));var fs=require('fs');var path=require(_0xb49d('0x6'));var rimraf=require(_0xb49d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb49d('0x8'));module['exports']=function(_0x4c6887,_0x144a9a){return _0x4c6887[_0xb49d('0x9')](_0xb49d('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49f8=['define','MailServerIn','mail_servers_in','lodash','api','moment','request-promise','rimraf','./mailServerIn.attributes'];(function(_0xb65f24,_0x4e6a60){var _0x1750c4=function(_0x3d324c){while(--_0x3d324c){_0xb65f24['push'](_0xb65f24['shift']());}};_0x1750c4(++_0x4e6a60);}(_0x49f8,0xff));var _0x849f=function(_0x158b98,_0x42454b){_0x158b98=_0x158b98-0x0;var _0x4d9542=_0x49f8[_0x158b98];return _0x4d9542;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x849f('0x1'));var moment=require(_0x849f('0x2'));var BPromise=require('bluebird');var rp=require(_0x849f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x849f('0x4'));var config=require('../../config/environment');var attributes=require(_0x849f('0x5'));module['exports']=function(_0x1e8405,_0x30ebab){return _0x1e8405[_0x849f('0x6')](_0x849f('0x7'),attributes,{'tableName':_0x849f('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 18cca19..b922223 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 _0x51af=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','map','include','model','catch','util','moment','bluebird'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0x51af,0x133));var _0xf51a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x51af[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require(_0xf51a('0x0'));var moment=require(_0xf51a('0x1'));var BPromise=require(_0xf51a('0x2'));var rs=require(_0xf51a('0x3'));var fs=require('fs');var Redis=require(_0xf51a('0x4'));var db=require(_0xf51a('0x5'))['db'];var utils=require(_0xf51a('0x6'));var logger=require(_0xf51a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf51a('0x8'));var client=jayson[_0xf51a('0x9')][_0xf51a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe649,_0x149eaa,_0x3f61ad){return new BPromise(function(_0xafead3,_0x29e1e1){return client['request'](_0x4fe649,_0x3f61ad)['then'](function(_0x2aa883){logger[_0xf51a('0xb')](_0xf51a('0xc'),_0x149eaa,'request\x20sent');logger[_0xf51a('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x149eaa,_0xf51a('0xe'),JSON[_0xf51a('0xf')](_0x2aa883));if(_0x2aa883[_0xf51a('0x10')]){if(_0x2aa883['error'][_0xf51a('0x11')]===0x1f4){logger[_0xf51a('0x10')](_0xf51a('0xc'),_0x149eaa,_0x2aa883['error'][_0xf51a('0x12')]);return _0x29e1e1(_0x2aa883[_0xf51a('0x10')][_0xf51a('0x12')]);}logger[_0xf51a('0x10')]('MailServerIn,\x20%s,\x20%s',_0x149eaa,_0x2aa883[_0xf51a('0x10')][_0xf51a('0x12')]);return _0xafead3(_0x2aa883[_0xf51a('0x10')][_0xf51a('0x12')]);}else{logger[_0xf51a('0xb')](_0xf51a('0xc'),_0x149eaa,_0xf51a('0xe'));_0xafead3(_0x2aa883[_0xf51a('0x13')][_0xf51a('0x12')]);}})['catch'](function(_0x2ab9e0){logger['error']('MailServerIn,\x20%s,\x20%s',_0x149eaa,_0x2ab9e0);_0x29e1e1(_0x2ab9e0);});});}exports[_0xf51a('0x14')]=function(_0x372bc2){var _0x1166d7=this;return new Promise(function(_0x3af50b,_0x2dde8d){return db[_0xf51a('0x15')][_0xf51a('0x16')]({'raw':_0x372bc2[_0xf51a('0x17')]?_0x372bc2['options'][_0xf51a('0x18')]===undefined?!![]:![]:!![],'where':_0x372bc2[_0xf51a('0x17')]?_0x372bc2[_0xf51a('0x17')]['where']||null:null,'attributes':_0x372bc2[_0xf51a('0x17')]?_0x372bc2[_0xf51a('0x17')][_0xf51a('0x19')]||null:null,'limit':_0x372bc2['options']?_0x372bc2['options'][_0xf51a('0x1a')]||null:null,'include':_0x372bc2[_0xf51a('0x17')]?_0x372bc2[_0xf51a('0x17')]['include']?_[_0xf51a('0x1b')](_0x372bc2[_0xf51a('0x17')][_0xf51a('0x1c')],function(_0x5a47d7){return{'model':db[_0x5a47d7[_0xf51a('0x1d')]],'as':_0x5a47d7['as'],'attributes':_0x5a47d7[_0xf51a('0x19')],'include':_0x5a47d7[_0xf51a('0x1c')]?_[_0xf51a('0x1b')](_0x5a47d7[_0xf51a('0x1c')],function(_0x2d5b90){return{'model':db[_0x2d5b90[_0xf51a('0x1d')]],'as':_0x2d5b90['as'],'attributes':_0x2d5b90[_0xf51a('0x19')],'include':_0x2d5b90[_0xf51a('0x1c')]?_['map'](_0x2d5b90[_0xf51a('0x1c')],function(_0xa36ad1){return{'model':db[_0xa36ad1[_0xf51a('0x1d')]],'as':_0xa36ad1['as'],'attributes':_0xa36ad1[_0xf51a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x199718){logger[_0xf51a('0xb')](_0xf51a('0x14'),_0x372bc2);logger[_0xf51a('0xd')](_0xf51a('0x14'),_0x372bc2,JSON[_0xf51a('0xf')](_0x199718));_0x3af50b(_0x199718);})[_0xf51a('0x1e')](function(_0x6ce607){logger[_0xf51a('0x10')](_0xf51a('0x14'),_0x6ce607[_0xf51a('0x12')],_0x372bc2);_0x2dde8d(_0x1166d7[_0xf51a('0x10')](0x1f4,_0x6ce607[_0xf51a('0x12')]));});});}; \ No newline at end of file +var _0xb24e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','limit','include','map','model','attributes','debug','stringify','lodash'];(function(_0x5db5cc,_0xde802d){var _0x3f7156=function(_0x4bf7c3){while(--_0x4bf7c3){_0x5db5cc['push'](_0x5db5cc['shift']());}};_0x3f7156(++_0xde802d);}(_0xb24e,0x175));var _0xeb24=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb24e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xeb24('0x0'));var util=require('util');var moment=require(_0xeb24('0x1'));var BPromise=require(_0xeb24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb24('0x3'));var db=require(_0xeb24('0x4'))['db'];var utils=require(_0xeb24('0x5'));var logger=require(_0xeb24('0x6'))(_0xeb24('0x7'));var config=require(_0xeb24('0x8'));var jayson=require(_0xeb24('0x9'));var client=jayson[_0xeb24('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36c491,_0x300ed0,_0x62b4d7){return new BPromise(function(_0x512c0e,_0x6325d9){return client[_0xeb24('0xb')](_0x36c491,_0x62b4d7)[_0xeb24('0xc')](function(_0x2891d4){logger[_0xeb24('0xd')](_0xeb24('0xe'),_0x300ed0,_0xeb24('0xf'));logger['debug'](_0xeb24('0x10'),_0x300ed0,'request\x20sent',JSON['stringify'](_0x2891d4));if(_0x2891d4['error']){if(_0x2891d4[_0xeb24('0x11')][_0xeb24('0x12')]===0x1f4){logger[_0xeb24('0x11')](_0xeb24('0xe'),_0x300ed0,_0x2891d4[_0xeb24('0x11')]['message']);return _0x6325d9(_0x2891d4[_0xeb24('0x11')]['message']);}logger[_0xeb24('0x11')](_0xeb24('0xe'),_0x300ed0,_0x2891d4['error'][_0xeb24('0x13')]);return _0x512c0e(_0x2891d4[_0xeb24('0x11')]['message']);}else{logger[_0xeb24('0xd')](_0xeb24('0xe'),_0x300ed0,_0xeb24('0xf'));_0x512c0e(_0x2891d4[_0xeb24('0x14')][_0xeb24('0x13')]);}})[_0xeb24('0x15')](function(_0x342179){logger[_0xeb24('0x11')]('MailServerIn,\x20%s,\x20%s',_0x300ed0,_0x342179);_0x6325d9(_0x342179);});});}exports[_0xeb24('0x16')]=function(_0x43b061){var _0x52d288=this;return new Promise(function(_0xfae0f8,_0x45d537){return db[_0xeb24('0x17')][_0xeb24('0x18')]({'raw':_0x43b061[_0xeb24('0x19')]?_0x43b061[_0xeb24('0x19')][_0xeb24('0x1a')]===undefined?!![]:![]:!![],'where':_0x43b061[_0xeb24('0x19')]?_0x43b061[_0xeb24('0x19')]['where']||null:null,'attributes':_0x43b061[_0xeb24('0x19')]?_0x43b061['options']['attributes']||null:null,'limit':_0x43b061[_0xeb24('0x19')]?_0x43b061['options'][_0xeb24('0x1b')]||null:null,'include':_0x43b061['options']?_0x43b061['options'][_0xeb24('0x1c')]?_[_0xeb24('0x1d')](_0x43b061['options'][_0xeb24('0x1c')],function(_0x385e76){return{'model':db[_0x385e76['model']],'as':_0x385e76['as'],'attributes':_0x385e76['attributes'],'include':_0x385e76['include']?_[_0xeb24('0x1d')](_0x385e76[_0xeb24('0x1c')],function(_0x309a2e){return{'model':db[_0x309a2e[_0xeb24('0x1e')]],'as':_0x309a2e['as'],'attributes':_0x309a2e[_0xeb24('0x1f')],'include':_0x309a2e[_0xeb24('0x1c')]?_['map'](_0x309a2e[_0xeb24('0x1c')],function(_0xe323d2){return{'model':db[_0xe323d2[_0xeb24('0x1e')]],'as':_0xe323d2['as'],'attributes':_0xe323d2[_0xeb24('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeb24('0xc')](function(_0x27d80f){logger['info'](_0xeb24('0x16'),_0x43b061);logger[_0xeb24('0x20')](_0xeb24('0x16'),_0x43b061,JSON[_0xeb24('0x21')](_0x27d80f));_0xfae0f8(_0x27d80f);})[_0xeb24('0x15')](function(_0x5ad6f8){logger[_0xeb24('0x11')]('GetMailServerIn',_0x5ad6f8[_0xeb24('0x13')],_0x43b061);_0x45d537(_0x52d288[_0xeb24('0x11')](0x1f4,_0x5ad6f8[_0xeb24('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3710f86..1f56f0d 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 _0x34af=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x34af,0xd3));var _0xf34a=function(_0x2243ad,_0x4c1f9d){_0x2243ad=_0x2243ad-0x0;var _0x11826a=_0x34af[_0x2243ad];return _0x11826a;};'use strict';var multer=require(_0xf34a('0x0'));var util=require(_0xf34a('0x1'));var path=require(_0xf34a('0x2'));var timeout=require(_0xf34a('0x3'));var express=require(_0xf34a('0x4'));var router=express['Router']();var auth=require(_0xf34a('0x5'));var interaction=require(_0xf34a('0x6'));var config=require(_0xf34a('0x7'));var controller=require('./mailServerOut.controller');router[_0xf34a('0x8')]('/',auth[_0xf34a('0x9')](),controller[_0xf34a('0xa')]);router[_0xf34a('0x8')](_0xf34a('0xb'),auth[_0xf34a('0x9')](),controller[_0xf34a('0xc')]);router['post']('/',auth[_0xf34a('0x9')](),controller[_0xf34a('0xd')]);router[_0xf34a('0xe')](_0xf34a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf34a('0xf')](_0xf34a('0xb'),auth['isAuthenticated'](),controller[_0xf34a('0x10')]);module[_0xf34a('0x11')]=router; \ No newline at end of file +var _0x6bff=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x607a51,_0xad14a7){var _0x432a18=function(_0xe71cfd){while(--_0xe71cfd){_0x607a51['push'](_0x607a51['shift']());}};_0x432a18(++_0xad14a7);}(_0x6bff,0x16d));var _0xf6bf=function(_0x5f0fb0,_0x18ee3e){_0x5f0fb0=_0x5f0fb0-0x0;var _0x1e93e1=_0x6bff[_0x5f0fb0];return _0x1e93e1;};'use strict';var multer=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var path=require(_0xf6bf('0x2'));var timeout=require(_0xf6bf('0x3'));var express=require(_0xf6bf('0x4'));var router=express[_0xf6bf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf6bf('0x6'));var config=require(_0xf6bf('0x7'));var controller=require(_0xf6bf('0x8'));router[_0xf6bf('0x9')]('/',auth['isAuthenticated'](),controller[_0xf6bf('0xa')]);router[_0xf6bf('0x9')](_0xf6bf('0xb'),auth[_0xf6bf('0xc')](),controller[_0xf6bf('0xd')]);router[_0xf6bf('0xe')]('/',auth[_0xf6bf('0xc')](),controller[_0xf6bf('0xf')]);router[_0xf6bf('0x10')](_0xf6bf('0xb'),auth[_0xf6bf('0xc')](),controller[_0xf6bf('0x11')]);router['delete'](_0xf6bf('0xb'),auth['isAuthenticated'](),controller[_0xf6bf('0x12')]);module[_0xf6bf('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index cdd1480..6649c1e 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 _0x75dd=['BOOLEAN','sequelize','exports','STRING'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x75dd,0x1c9));var _0xd75d=function(_0x4fd2b8,_0x5232d9){_0x4fd2b8=_0x4fd2b8-0x0;var _0x205fcf=_0x75dd[_0x4fd2b8];return _0x205fcf;};'use strict';var Sequelize=require(_0xd75d('0x0'));module[_0xd75d('0x1')]={'description':{'type':Sequelize[_0xd75d('0x2')]},'host':{'type':Sequelize[_0xd75d('0x2')]},'user':{'type':Sequelize[_0xd75d('0x2')]},'pass':{'type':Sequelize[_0xd75d('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xd75d('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd75d('0x2')]},'authentication':{'type':Sequelize[_0xd75d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0f9f=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x3ebb04,_0x1a63a6){var _0x535db0=function(_0x651fb4){while(--_0x651fb4){_0x3ebb04['push'](_0x3ebb04['shift']());}};_0x535db0(++_0x1a63a6);}(_0x0f9f,0xae));var _0xf0f9=function(_0x2df4d7,_0x57da82){_0x2df4d7=_0x2df4d7-0x0;var _0x40787a=_0x0f9f[_0x2df4d7];return _0x40787a;};'use strict';var Sequelize=require(_0xf0f9('0x0'));module[_0xf0f9('0x1')]={'description':{'type':Sequelize[_0xf0f9('0x2')]},'host':{'type':Sequelize[_0xf0f9('0x2')]},'user':{'type':Sequelize[_0xf0f9('0x2')]},'pass':{'type':Sequelize[_0xf0f9('0x2')]},'port':{'type':Sequelize[_0xf0f9('0x3')]},'secure':{'type':Sequelize[_0xf0f9('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xf0f9('0x2')]},'authentication':{'type':Sequelize[_0xf0f9('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 2a41916..66cb53c 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 _0x59d2=['name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','update','then','destroy','error'];(function(_0x31ee55,_0x5a187d){var _0x5560e8=function(_0xebe3a6){while(--_0xebe3a6){_0x31ee55['push'](_0x31ee55['shift']());}};_0x5560e8(++_0x5a187d);}(_0x59d2,0x6c));var _0x259d=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x59d2[_0x55e08b];return _0xd1a7ff;};'use strict';var pdf=require(_0x259d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x259d('0x1'));var zipdir=require(_0x259d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x259d('0x3'));var moment=require(_0x259d('0x4'));var BPromise=require(_0x259d('0x5'));var Mustache=require(_0x259d('0x6'));var util=require(_0x259d('0x7'));var path=require(_0x259d('0x8'));var sox=require(_0x259d('0x9'));var csv=require('to-csv');var ejs=require(_0x259d('0xa'));var fs=require('fs');var _=require(_0x259d('0xb'));var squel=require(_0x259d('0xc'));var crypto=require(_0x259d('0xd'));var jsforce=require(_0x259d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x259d('0xf'));var querystring=require(_0x259d('0x10'));var Papa=require(_0x259d('0x11'));var Redis=require(_0x259d('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(_0x259d('0x13'))(_0x259d('0x14'));var utils=require(_0x259d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x259d('0x16'));var db=require(_0x259d('0x17'))['db'];function respondWithStatusCode(_0x2ac1b9,_0x5229e5){_0x5229e5=_0x5229e5||0xcc;return function(_0x44f4d8){if(_0x44f4d8){return _0x2ac1b9[_0x259d('0x18')](_0x5229e5);}return _0x2ac1b9[_0x259d('0x19')](_0x5229e5)[_0x259d('0x1a')]();};}function respondWithResult(_0x50339f,_0x1e76a7){_0x1e76a7=_0x1e76a7||0xc8;return function(_0xb2df80){if(_0xb2df80){return _0x50339f[_0x259d('0x19')](_0x1e76a7)[_0x259d('0x1b')](_0xb2df80);}};}function respondWithFilteredResult(_0x162a08,_0x25a6de){return function(_0x356533){if(_0x356533){var _0x478960=_0x356533['count'],_0x5b2059=_0x25a6de['offset'],_0xb73a04=_0x25a6de['offset']+_0x25a6de[_0x259d('0x1c')],_0x834e69;if(_0xb73a04>=_0x478960){_0xb73a04=_0x478960;_0x834e69=0xc8;}else{_0x834e69=0xce;}_0x162a08[_0x259d('0x19')](_0x834e69);return _0x162a08[_0x259d('0x1d')](_0x259d('0x1e'),_0x5b2059+'-'+_0xb73a04+'/'+_0x478960)[_0x259d('0x1b')](_0x356533);}return null;};}function patchUpdates(_0x57e6eb){return function(_0x5d6f0a){try{jsonpatch[_0x259d('0x1f')](_0x5d6f0a,_0x57e6eb,!![]);}catch(_0x1091bc){return BPromise['reject'](_0x1091bc);}return _0x5d6f0a['save']();};}function saveUpdates(_0xf42181,_0x23200b){return function(_0xfcb3f4){if(_0xfcb3f4){return _0xfcb3f4[_0x259d('0x20')](_0xf42181)[_0x259d('0x21')](function(_0x13f24d){return _0x13f24d;});}return null;};}function removeEntity(_0x50461f,_0x308086){return function(_0x5acf6c){if(_0x5acf6c){return _0x5acf6c[_0x259d('0x22')]()[_0x259d('0x21')](function(){_0x50461f[_0x259d('0x19')](0xcc)[_0x259d('0x1a')]();});}};}function handleEntityNotFound(_0x1f0894,_0x41d25c){return function(_0x342184){if(!_0x342184){_0x1f0894[_0x259d('0x18')](0x194);}return _0x342184;};}function handleError(_0xba183c,_0x5d6b6f){_0x5d6b6f=_0x5d6b6f||0x1f4;return function(_0x5207a3){logger[_0x259d('0x23')](_0x5207a3['stack']);if(_0x5207a3[_0x259d('0x24')]){delete _0x5207a3[_0x259d('0x24')];}_0xba183c['status'](_0x5d6b6f)[_0x259d('0x25')](_0x5207a3);};}exports[_0x259d('0x26')]=function(_0x40e905,_0x3a3170){var _0x276ca5={},_0x44d3ce={},_0x2c766f={'count':0x0,'rows':[]};var _0x328a66=_[_0x259d('0x27')](db[_0x259d('0x28')][_0x259d('0x29')],function(_0xea940f){return{'name':_0xea940f[_0x259d('0x2a')],'type':_0xea940f[_0x259d('0x2b')][_0x259d('0x2c')]};});_0x44d3ce[_0x259d('0x2d')]=_[_0x259d('0x27')](_0x328a66,_0x259d('0x24'));_0x44d3ce[_0x259d('0x2e')]=_['keys'](_0x40e905[_0x259d('0x2e')]);_0x44d3ce[_0x259d('0x2f')]=_['intersection'](_0x44d3ce['model'],_0x44d3ce[_0x259d('0x2e')]);_0x276ca5[_0x259d('0x30')]=_[_0x259d('0x31')](_0x44d3ce[_0x259d('0x2d')],qs['fields'](_0x40e905[_0x259d('0x2e')][_0x259d('0x32')]));_0x276ca5[_0x259d('0x30')]=_0x276ca5[_0x259d('0x30')][_0x259d('0x33')]?_0x276ca5[_0x259d('0x30')]:_0x44d3ce['model'];if(!_0x40e905[_0x259d('0x2e')]['hasOwnProperty'](_0x259d('0x34'))){_0x276ca5[_0x259d('0x1c')]=qs[_0x259d('0x1c')](_0x40e905['query']['limit']);_0x276ca5['offset']=qs[_0x259d('0x35')](_0x40e905[_0x259d('0x2e')][_0x259d('0x35')]);}_0x276ca5[_0x259d('0x36')]=qs[_0x259d('0x37')](_0x40e905[_0x259d('0x2e')]['sort']);_0x276ca5[_0x259d('0x38')]=qs['filters'](_['pick'](_0x40e905[_0x259d('0x2e')],_0x44d3ce[_0x259d('0x2f')]),_0x328a66);if(_0x40e905[_0x259d('0x2e')][_0x259d('0x39')]){_0x276ca5[_0x259d('0x38')]=_[_0x259d('0x3a')](_0x276ca5['where'],{'$or':_[_0x259d('0x27')](_0x328a66,function(_0x5e9dfc){if(_0x5e9dfc[_0x259d('0x2b')]!==_0x259d('0x3b')){var _0x105fdc={};_0x105fdc[_0x5e9dfc['name']]={'$like':'%'+_0x40e905['query'][_0x259d('0x39')]+'%'};return _0x105fdc;}})});}_0x276ca5=_[_0x259d('0x3a')]({},_0x276ca5,_0x40e905[_0x259d('0x3c')]);var _0xa04045={'where':_0x276ca5['where']};return db['MailServerOut'][_0x259d('0x3d')](_0xa04045)[_0x259d('0x21')](function(_0x5d0a63){_0x2c766f[_0x259d('0x3d')]=_0x5d0a63;if(_0x40e905['query'][_0x259d('0x3e')]){_0x276ca5[_0x259d('0x3f')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x276ca5);})['then'](function(_0x67fe7b){_0x2c766f[_0x259d('0x40')]=_0x67fe7b;return _0x2c766f;})['then'](respondWithFilteredResult(_0x3a3170,_0x276ca5))[_0x259d('0x41')](handleError(_0x3a3170,null));};exports[_0x259d('0x42')]=function(_0xf75729,_0x1fd256){var _0x3fc596={'raw':!![],'where':{'id':_0xf75729[_0x259d('0x43')]['id']}},_0x168791={};_0x168791[_0x259d('0x2d')]=_[_0x259d('0x44')](db[_0x259d('0x28')][_0x259d('0x29')]);_0x168791['query']=_['keys'](_0xf75729['query']);_0x168791[_0x259d('0x2f')]=_['intersection'](_0x168791[_0x259d('0x2d')],_0x168791['query']);_0x3fc596[_0x259d('0x30')]=_[_0x259d('0x31')](_0x168791[_0x259d('0x2d')],qs[_0x259d('0x32')](_0xf75729[_0x259d('0x2e')][_0x259d('0x32')]));_0x3fc596[_0x259d('0x30')]=_0x3fc596[_0x259d('0x30')][_0x259d('0x33')]?_0x3fc596['attributes']:_0x168791[_0x259d('0x2d')];if(_0xf75729[_0x259d('0x2e')][_0x259d('0x3e')]){_0x3fc596[_0x259d('0x3f')]=[{'all':!![]}];}_0x3fc596=_[_0x259d('0x3a')]({},_0x3fc596,_0xf75729[_0x259d('0x3c')]);return db['MailServerOut']['find'](_0x3fc596)[_0x259d('0x21')](handleEntityNotFound(_0x1fd256,null))[_0x259d('0x21')](respondWithResult(_0x1fd256,null))['catch'](handleError(_0x1fd256,null));};exports['create']=function(_0xfba7a9,_0x17cf32){return db[_0x259d('0x28')][_0x259d('0x45')](_0xfba7a9[_0x259d('0x46')],{})[_0x259d('0x21')](respondWithResult(_0x17cf32,0xc9))[_0x259d('0x41')](handleError(_0x17cf32,null));};exports[_0x259d('0x20')]=function(_0xb5958c,_0x4dd4c0){if(_0xb5958c[_0x259d('0x46')]['id']){delete _0xb5958c[_0x259d('0x46')]['id'];}return db[_0x259d('0x28')][_0x259d('0x47')]({'where':{'id':_0xb5958c[_0x259d('0x43')]['id']}})[_0x259d('0x21')](handleEntityNotFound(_0x4dd4c0,null))[_0x259d('0x21')](saveUpdates(_0xb5958c[_0x259d('0x46')],null))[_0x259d('0x21')](respondWithResult(_0x4dd4c0,null))['catch'](handleError(_0x4dd4c0,null));};exports[_0x259d('0x22')]=function(_0x3b22e4,_0x5299ca){return db[_0x259d('0x28')]['find']({'where':{'id':_0x3b22e4[_0x259d('0x43')]['id']}})[_0x259d('0x21')](handleEntityNotFound(_0x5299ca,null))[_0x259d('0x21')](removeEntity(_0x5299ca,null))[_0x259d('0x41')](handleError(_0x5299ca,null));}; \ No newline at end of file +var _0x9457=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x5ef9fc,_0x481b7f){var _0x27f8fb=function(_0x3a413a){while(--_0x3a413a){_0x5ef9fc['push'](_0x5ef9fc['shift']());}};_0x27f8fb(++_0x481b7f);}(_0x9457,0x1ae));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7945('0x0'));var rimraf=require(_0x7945('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7945('0x2'));var rp=require('request-promise');var moment=require(_0x7945('0x3'));var BPromise=require(_0x7945('0x4'));var Mustache=require(_0x7945('0x5'));var util=require(_0x7945('0x6'));var path=require(_0x7945('0x7'));var sox=require(_0x7945('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7945('0x9'));var deskjs=require(_0x7945('0xa'));var toCsv=require(_0x7945('0xb'));var querystring=require(_0x7945('0xc'));var Papa=require(_0x7945('0xd'));var Redis=require(_0x7945('0xe'));var authService=require(_0x7945('0xf'));var qs=require(_0x7945('0x10'));var as=require(_0x7945('0x11'));var hardwareService=require(_0x7945('0x12'));var logger=require(_0x7945('0x13'))(_0x7945('0x14'));var utils=require('../../config/utils');var config=require(_0x7945('0x15'));var licenseUtil=require(_0x7945('0x16'));var db=require(_0x7945('0x17'))['db'];function respondWithStatusCode(_0x576fe4,_0x578b76){_0x578b76=_0x578b76||0xcc;return function(_0xa69c1a){if(_0xa69c1a){return _0x576fe4[_0x7945('0x18')](_0x578b76);}return _0x576fe4[_0x7945('0x19')](_0x578b76)[_0x7945('0x1a')]();};}function respondWithResult(_0x20fdf9,_0x4997a8){_0x4997a8=_0x4997a8||0xc8;return function(_0x2533b9){if(_0x2533b9){return _0x20fdf9[_0x7945('0x19')](_0x4997a8)[_0x7945('0x1b')](_0x2533b9);}};}function respondWithFilteredResult(_0x58915f,_0x4f0b4e){return function(_0x7338d1){if(_0x7338d1){var _0x2181c6=_0x7338d1[_0x7945('0x1c')],_0x386d51=_0x4f0b4e[_0x7945('0x1d')],_0x4e107c=_0x4f0b4e[_0x7945('0x1d')]+_0x4f0b4e[_0x7945('0x1e')],_0x35aca2;if(_0x4e107c>=_0x2181c6){_0x4e107c=_0x2181c6;_0x35aca2=0xc8;}else{_0x35aca2=0xce;}_0x58915f[_0x7945('0x19')](_0x35aca2);return _0x58915f[_0x7945('0x1f')](_0x7945('0x20'),_0x386d51+'-'+_0x4e107c+'/'+_0x2181c6)[_0x7945('0x1b')](_0x7338d1);}return null;};}function patchUpdates(_0xc89c6b){return function(_0x27acad){try{jsonpatch[_0x7945('0x21')](_0x27acad,_0xc89c6b,!![]);}catch(_0x302ce6){return BPromise[_0x7945('0x22')](_0x302ce6);}return _0x27acad[_0x7945('0x23')]();};}function saveUpdates(_0x387efe,_0x110c06){return function(_0x1958a2){if(_0x1958a2){return _0x1958a2[_0x7945('0x24')](_0x387efe)[_0x7945('0x25')](function(_0x1ced19){return _0x1ced19;});}return null;};}function removeEntity(_0x28a0bc,_0x3281af){return function(_0x311458){if(_0x311458){return _0x311458[_0x7945('0x26')]()['then'](function(){_0x28a0bc[_0x7945('0x19')](0xcc)[_0x7945('0x1a')]();});}};}function handleEntityNotFound(_0x24df0e,_0x491291){return function(_0x1bb559){if(!_0x1bb559){_0x24df0e[_0x7945('0x18')](0x194);}return _0x1bb559;};}function handleError(_0x1bc2c8,_0x6ad031){_0x6ad031=_0x6ad031||0x1f4;return function(_0x28347d){logger['error'](_0x28347d[_0x7945('0x27')]);if(_0x28347d[_0x7945('0x28')]){delete _0x28347d[_0x7945('0x28')];}_0x1bc2c8[_0x7945('0x19')](_0x6ad031)[_0x7945('0x29')](_0x28347d);};}exports[_0x7945('0x2a')]=function(_0x2854c5,_0xe14bd5){var _0x59544={},_0x340464={},_0xce9ffb={'count':0x0,'rows':[]};var _0x11abcc=_[_0x7945('0x2b')](db[_0x7945('0x2c')][_0x7945('0x2d')],function(_0x2dd410){return{'name':_0x2dd410[_0x7945('0x2e')],'type':_0x2dd410['type'][_0x7945('0x2f')]};});_0x340464[_0x7945('0x30')]=_[_0x7945('0x2b')](_0x11abcc,_0x7945('0x28'));_0x340464[_0x7945('0x31')]=_[_0x7945('0x32')](_0x2854c5[_0x7945('0x31')]);_0x340464[_0x7945('0x33')]=_[_0x7945('0x34')](_0x340464['model'],_0x340464[_0x7945('0x31')]);_0x59544[_0x7945('0x35')]=_[_0x7945('0x34')](_0x340464[_0x7945('0x30')],qs[_0x7945('0x36')](_0x2854c5[_0x7945('0x31')][_0x7945('0x36')]));_0x59544[_0x7945('0x35')]=_0x59544['attributes']['length']?_0x59544[_0x7945('0x35')]:_0x340464[_0x7945('0x30')];if(!_0x2854c5[_0x7945('0x31')][_0x7945('0x37')]('nolimit')){_0x59544[_0x7945('0x1e')]=qs[_0x7945('0x1e')](_0x2854c5[_0x7945('0x31')][_0x7945('0x1e')]);_0x59544['offset']=qs[_0x7945('0x1d')](_0x2854c5[_0x7945('0x31')]['offset']);}_0x59544[_0x7945('0x38')]=qs[_0x7945('0x39')](_0x2854c5['query']['sort']);_0x59544['where']=qs[_0x7945('0x33')](_[_0x7945('0x3a')](_0x2854c5[_0x7945('0x31')],_0x340464[_0x7945('0x33')]),_0x11abcc);if(_0x2854c5[_0x7945('0x31')][_0x7945('0x3b')]){_0x59544[_0x7945('0x3c')]=_[_0x7945('0x3d')](_0x59544[_0x7945('0x3c')],{'$or':_['map'](_0x11abcc,function(_0x12e442){if(_0x12e442['type']!=='VIRTUAL'){var _0x4c2f7d={};_0x4c2f7d[_0x12e442['name']]={'$like':'%'+_0x2854c5['query'][_0x7945('0x3b')]+'%'};return _0x4c2f7d;}})});}_0x59544=_[_0x7945('0x3d')]({},_0x59544,_0x2854c5[_0x7945('0x3e')]);var _0x5e7827={'where':_0x59544['where']};return db[_0x7945('0x2c')]['count'](_0x5e7827)['then'](function(_0x700362){_0xce9ffb[_0x7945('0x1c')]=_0x700362;if(_0x2854c5[_0x7945('0x31')][_0x7945('0x3f')]){_0x59544[_0x7945('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x7945('0x41')](_0x59544);})['then'](function(_0x2ecafc){_0xce9ffb[_0x7945('0x42')]=_0x2ecafc;return _0xce9ffb;})[_0x7945('0x25')](respondWithFilteredResult(_0xe14bd5,_0x59544))['catch'](handleError(_0xe14bd5,null));};exports[_0x7945('0x43')]=function(_0x50f9b6,_0x72b33d){var _0x35a28d={'raw':!![],'where':{'id':_0x50f9b6[_0x7945('0x44')]['id']}},_0x4a0abb={};_0x4a0abb[_0x7945('0x30')]=_[_0x7945('0x32')](db[_0x7945('0x2c')][_0x7945('0x2d')]);_0x4a0abb[_0x7945('0x31')]=_['keys'](_0x50f9b6[_0x7945('0x31')]);_0x4a0abb[_0x7945('0x33')]=_[_0x7945('0x34')](_0x4a0abb[_0x7945('0x30')],_0x4a0abb['query']);_0x35a28d[_0x7945('0x35')]=_[_0x7945('0x34')](_0x4a0abb[_0x7945('0x30')],qs[_0x7945('0x36')](_0x50f9b6[_0x7945('0x31')]['fields']));_0x35a28d[_0x7945('0x35')]=_0x35a28d['attributes'][_0x7945('0x45')]?_0x35a28d['attributes']:_0x4a0abb[_0x7945('0x30')];if(_0x50f9b6['query'][_0x7945('0x3f')]){_0x35a28d['include']=[{'all':!![]}];}_0x35a28d=_[_0x7945('0x3d')]({},_0x35a28d,_0x50f9b6['options']);return db[_0x7945('0x2c')][_0x7945('0x46')](_0x35a28d)['then'](handleEntityNotFound(_0x72b33d,null))[_0x7945('0x25')](respondWithResult(_0x72b33d,null))[_0x7945('0x47')](handleError(_0x72b33d,null));};exports['create']=function(_0x19c3e6,_0x1cb9e8){return db[_0x7945('0x2c')][_0x7945('0x48')](_0x19c3e6[_0x7945('0x49')],{})[_0x7945('0x25')](respondWithResult(_0x1cb9e8,0xc9))[_0x7945('0x47')](handleError(_0x1cb9e8,null));};exports[_0x7945('0x24')]=function(_0x5b0b59,_0x262eda){if(_0x5b0b59['body']['id']){delete _0x5b0b59[_0x7945('0x49')]['id'];}return db['MailServerOut'][_0x7945('0x46')]({'where':{'id':_0x5b0b59[_0x7945('0x44')]['id']}})[_0x7945('0x25')](handleEntityNotFound(_0x262eda,null))[_0x7945('0x25')](saveUpdates(_0x5b0b59['body'],null))[_0x7945('0x25')](respondWithResult(_0x262eda,null))[_0x7945('0x47')](handleError(_0x262eda,null));};exports[_0x7945('0x26')]=function(_0x242ed7,_0x4f195e){return db[_0x7945('0x2c')][_0x7945('0x46')]({'where':{'id':_0x242ed7[_0x7945('0x44')]['id']}})[_0x7945('0x25')](handleEntityNotFound(_0x4f195e,null))[_0x7945('0x25')](removeEntity(_0x4f195e,null))[_0x7945('0x47')](handleError(_0x4f195e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 8842a21..2f4ce16 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 _0x2675=['lodash','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x42f1e7,_0x3a1279){var _0x460d91=function(_0x3e9820){while(--_0x3e9820){_0x42f1e7['push'](_0x42f1e7['shift']());}};_0x460d91(++_0x3a1279);}(_0x2675,0x75));var _0x5267=function(_0x35eaee,_0x24a4a1){_0x35eaee=_0x35eaee-0x0;var _0x4fb39c=_0x2675[_0x35eaee];return _0x4fb39c;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x15e0f2,_0x6cedd7){var _0x4fe6a8=function(_0x3b20ee){while(--_0x3b20ee){_0x15e0f2['push'](_0x15e0f2['shift']());}};_0x4fe6a8(++_0x6cedd7);}(_0x687b,0x14a));var _0xb687=function(_0x23e337,_0x1e3c57){_0x23e337=_0x23e337-0x0;var _0x45facf=_0x687b[_0x23e337];return _0x45facf;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index ab1a6f3..43f7208 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 _0x1139=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x1139,0x7f));var _0x9113=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x1139[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x9113('0x0'));var util=require('util');var moment=require(_0x9113('0x1'));var BPromise=require(_0x9113('0x2'));var rs=require(_0x9113('0x3'));var fs=require('fs');var Redis=require(_0x9113('0x4'));var db=require(_0x9113('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9113('0x6'))(_0x9113('0x7'));var config=require(_0x9113('0x8'));var jayson=require(_0x9113('0x9'));var client=jayson[_0x9113('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cf591,_0x5d0968,_0x56271f){return new BPromise(function(_0x2bdbe8,_0x450519){return client[_0x9113('0xb')](_0x1cf591,_0x56271f)[_0x9113('0xc')](function(_0x4f319c){logger['info'](_0x9113('0xd'),_0x5d0968,_0x9113('0xe'));logger['debug'](_0x9113('0xf'),_0x5d0968,_0x9113('0xe'),JSON['stringify'](_0x4f319c));if(_0x4f319c[_0x9113('0x10')]){if(_0x4f319c['error']['code']===0x1f4){logger[_0x9113('0x10')]('MailServerOut,\x20%s,\x20%s',_0x5d0968,_0x4f319c['error'][_0x9113('0x11')]);return _0x450519(_0x4f319c[_0x9113('0x10')]['message']);}logger[_0x9113('0x10')](_0x9113('0xd'),_0x5d0968,_0x4f319c[_0x9113('0x10')][_0x9113('0x11')]);return _0x2bdbe8(_0x4f319c['error'][_0x9113('0x11')]);}else{logger[_0x9113('0x12')](_0x9113('0xd'),_0x5d0968,_0x9113('0xe'));_0x2bdbe8(_0x4f319c[_0x9113('0x13')]['message']);}})[_0x9113('0x14')](function(_0xda4ef1){logger['error']('MailServerOut,\x20%s,\x20%s',_0x5d0968,_0xda4ef1);_0x450519(_0xda4ef1);});});} \ No newline at end of file +var _0x45da=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x45da,0xd6));var _0xa45d=function(_0x21a7bf,_0x25e3aa){_0x21a7bf=_0x21a7bf-0x0;var _0x5b68b1=_0x45da[_0x21a7bf];return _0x5b68b1;};'use strict';var _=require('lodash');var util=require(_0xa45d('0x0'));var moment=require(_0xa45d('0x1'));var BPromise=require(_0xa45d('0x2'));var rs=require(_0xa45d('0x3'));var fs=require('fs');var Redis=require(_0xa45d('0x4'));var db=require(_0xa45d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa45d('0x6'));var config=require(_0xa45d('0x7'));var jayson=require(_0xa45d('0x8'));var client=jayson['client'][_0xa45d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x856bc1,_0x39b663,_0x3d45a1){return new BPromise(function(_0x970b35,_0x11caa4){return client[_0xa45d('0xa')](_0x856bc1,_0x3d45a1)[_0xa45d('0xb')](function(_0x55ead2){logger[_0xa45d('0xc')]('MailServerOut,\x20%s,\x20%s',_0x39b663,_0xa45d('0xd'));logger[_0xa45d('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x39b663,_0xa45d('0xd'),JSON[_0xa45d('0xf')](_0x55ead2));if(_0x55ead2[_0xa45d('0x10')]){if(_0x55ead2[_0xa45d('0x10')][_0xa45d('0x11')]===0x1f4){logger[_0xa45d('0x10')](_0xa45d('0x12'),_0x39b663,_0x55ead2['error'][_0xa45d('0x13')]);return _0x11caa4(_0x55ead2[_0xa45d('0x10')][_0xa45d('0x13')]);}logger[_0xa45d('0x10')](_0xa45d('0x12'),_0x39b663,_0x55ead2[_0xa45d('0x10')]['message']);return _0x970b35(_0x55ead2[_0xa45d('0x10')][_0xa45d('0x13')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x39b663,_0xa45d('0xd'));_0x970b35(_0x55ead2[_0xa45d('0x14')][_0xa45d('0x13')]);}})[_0xa45d('0x15')](function(_0x154009){logger['error'](_0xa45d('0x12'),_0x39b663,_0x154009);_0x11caa4(_0x154009);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 63ace3b..aef3e9e 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 _0x251a=['express','../../config/environment','./mailSubstatus.controller','get','describe','/:id','isAuthenticated','create','put','delete','exports','multer','path'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x251a,0x80));var _0xa251=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x251a[_0x4f5108];return _0x2d56ca;};'use strict';var multer=require(_0xa251('0x0'));var util=require('util');var path=require(_0xa251('0x1'));var timeout=require('connect-timeout');var express=require(_0xa251('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa251('0x3'));var controller=require(_0xa251('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa251('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xa251('0x6')]);router['get'](_0xa251('0x7'),auth[_0xa251('0x8')](),controller['show']);router['post']('/',auth[_0xa251('0x8')](),controller[_0xa251('0x9')]);router[_0xa251('0xa')](_0xa251('0x7'),auth[_0xa251('0x8')](),controller['update']);router[_0xa251('0xb')](_0xa251('0x7'),auth[_0xa251('0x8')](),controller['destroy']);module[_0xa251('0xc')]=router; \ No newline at end of file +var _0x8074=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x466611,_0x421a63){var _0x4112c4=function(_0xeb1aab){while(--_0xeb1aab){_0x466611['push'](_0x466611['shift']());}};_0x4112c4(++_0x421a63);}(_0x8074,0x143));var _0x4807=function(_0x1e69fd,_0xf153d4){_0x1e69fd=_0x1e69fd-0x0;var _0x44df76=_0x8074[_0x1e69fd];return _0x44df76;};'use strict';var multer=require(_0x4807('0x0'));var util=require(_0x4807('0x1'));var path=require('path');var timeout=require(_0x4807('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4807('0x3'));var interaction=require(_0x4807('0x4'));var config=require(_0x4807('0x5'));var controller=require(_0x4807('0x6'));router['get']('/',auth[_0x4807('0x7')](),controller[_0x4807('0x8')]);router['get'](_0x4807('0x9'),auth[_0x4807('0x7')](),controller['describe']);router['get'](_0x4807('0xa'),auth[_0x4807('0x7')](),controller[_0x4807('0xb')]);router[_0x4807('0xc')]('/',auth['isAuthenticated'](),controller[_0x4807('0xd')]);router[_0x4807('0xe')](_0x4807('0xa'),auth[_0x4807('0x7')](),controller[_0x4807('0xf')]);router[_0x4807('0x10')](_0x4807('0xa'),auth[_0x4807('0x7')](),controller[_0x4807('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f259d2a..0dab251 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 _0x9b0d=['exports','STRING','name'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x31c4ec,_0x2d4889){_0x31c4ec=_0x31c4ec-0x0;var _0x2a1953=_0x9b0d[_0x31c4ec];return _0x2a1953;};'use strict';var Sequelize=require('sequelize');module[_0xd9b0('0x0')]={'name':{'type':Sequelize[_0xd9b0('0x1')],'unique':_0xd9b0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd9b0('0x1')]}}; \ No newline at end of file +var _0x2581=['exports','STRING','name','sequelize'];(function(_0x502672,_0x30af7a){var _0x16942f=function(_0x533f60){while(--_0x533f60){_0x502672['push'](_0x502672['shift']());}};_0x16942f(++_0x30af7a);}(_0x2581,0xcb));var _0x1258=function(_0xbbfcc1,_0x59c896){_0xbbfcc1=_0xbbfcc1-0x0;var _0xcb6a30=_0x2581[_0xbbfcc1];return _0xcb6a30;};'use strict';var Sequelize=require(_0x1258('0x0'));module[_0x1258('0x1')]={'name':{'type':Sequelize[_0x1258('0x2')],'unique':_0x1258('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1258('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index aa2b0bc..0bc808c 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 _0x2fde=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','map','MailSubstatus','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format'];(function(_0x3840b2,_0x3c46b5){var _0x257d05=function(_0x4d786b){while(--_0x4d786b){_0x3840b2['push'](_0x3840b2['shift']());}};_0x257d05(++_0x3c46b5);}(_0x2fde,0xd9));var _0xe2fd=function(_0x2e5b47,_0x40f777){_0x2e5b47=_0x2e5b47-0x0;var _0x561630=_0x2fde[_0x2e5b47];return _0x561630;};'use strict';var pdf=require(_0xe2fd('0x0'));var emlformat=require(_0xe2fd('0x1'));var rimraf=require(_0xe2fd('0x2'));var zipdir=require(_0xe2fd('0x3'));var jsonpatch=require(_0xe2fd('0x4'));var rp=require(_0xe2fd('0x5'));var moment=require(_0xe2fd('0x6'));var BPromise=require(_0xe2fd('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe2fd('0x8'));var sox=require(_0xe2fd('0x9'));var csv=require(_0xe2fd('0xa'));var ejs=require(_0xe2fd('0xb'));var fs=require('fs');var _=require(_0xe2fd('0xc'));var squel=require(_0xe2fd('0xd'));var crypto=require(_0xe2fd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe2fd('0xf'));var toCsv=require(_0xe2fd('0xa'));var querystring=require(_0xe2fd('0x10'));var Papa=require(_0xe2fd('0x11'));var Redis=require(_0xe2fd('0x12'));var authService=require(_0xe2fd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe2fd('0x14'));var hardwareService=require(_0xe2fd('0x15'));var logger=require(_0xe2fd('0x16'))(_0xe2fd('0x17'));var utils=require(_0xe2fd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe2fd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbfa06b,_0x56f045){_0x56f045=_0x56f045||0xcc;return function(_0x1fcb94){if(_0x1fcb94){return _0xbfa06b[_0xe2fd('0x1a')](_0x56f045);}return _0xbfa06b['status'](_0x56f045)[_0xe2fd('0x1b')]();};}function respondWithResult(_0x5067a5,_0x5b37c6){_0x5b37c6=_0x5b37c6||0xc8;return function(_0x413342){if(_0x413342){return _0x5067a5[_0xe2fd('0x1c')](_0x5b37c6)[_0xe2fd('0x1d')](_0x413342);}};}function respondWithFilteredResult(_0x433563,_0xae792){return function(_0x111570){if(_0x111570){var _0x2b5dd9=_0x111570[_0xe2fd('0x1e')],_0x5ace2c=_0xae792[_0xe2fd('0x1f')],_0x44fdf4=_0xae792[_0xe2fd('0x1f')]+_0xae792[_0xe2fd('0x20')],_0x3bc36c;if(_0x44fdf4>=_0x2b5dd9){_0x44fdf4=_0x2b5dd9;_0x3bc36c=0xc8;}else{_0x3bc36c=0xce;}_0x433563[_0xe2fd('0x1c')](_0x3bc36c);return _0x433563[_0xe2fd('0x21')](_0xe2fd('0x22'),_0x5ace2c+'-'+_0x44fdf4+'/'+_0x2b5dd9)[_0xe2fd('0x1d')](_0x111570);}return null;};}function patchUpdates(_0x52a86a){return function(_0x16dcf6){try{jsonpatch[_0xe2fd('0x23')](_0x16dcf6,_0x52a86a,!![]);}catch(_0x1fab09){return BPromise[_0xe2fd('0x24')](_0x1fab09);}return _0x16dcf6['save']();};}function saveUpdates(_0x4d5059,_0x5aaa7a){return function(_0x15735c){if(_0x15735c){return _0x15735c[_0xe2fd('0x25')](_0x4d5059)['then'](function(_0x24f8ce){return _0x24f8ce;});}return null;};}function removeEntity(_0x1fb678,_0x37c412){return function(_0x5f21d3){if(_0x5f21d3){return _0x5f21d3[_0xe2fd('0x26')]()[_0xe2fd('0x27')](function(){_0x1fb678['status'](0xcc)[_0xe2fd('0x1b')]();});}};}function handleEntityNotFound(_0x275500,_0x12d3a2){return function(_0xd794ec){if(!_0xd794ec){_0x275500[_0xe2fd('0x1a')](0x194);}return _0xd794ec;};}function handleError(_0x1d6c49,_0xde4b58){_0xde4b58=_0xde4b58||0x1f4;return function(_0x6b4e5a){logger[_0xe2fd('0x28')](_0x6b4e5a['stack']);if(_0x6b4e5a['name']){delete _0x6b4e5a[_0xe2fd('0x29')];}_0x1d6c49[_0xe2fd('0x1c')](_0xde4b58)[_0xe2fd('0x2a')](_0x6b4e5a);};}exports['index']=function(_0x10a5de,_0x1d1a15){var _0xfcce35={},_0xd7a97d={},_0x3b0532={'count':0x0,'rows':[]};var _0x424ed0=_[_0xe2fd('0x2b')](db[_0xe2fd('0x2c')]['rawAttributes'],function(_0x5bc032){return{'name':_0x5bc032['fieldName'],'type':_0x5bc032[_0xe2fd('0x2d')][_0xe2fd('0x2e')]};});_0xd7a97d[_0xe2fd('0x2f')]=_[_0xe2fd('0x2b')](_0x424ed0,'name');_0xd7a97d[_0xe2fd('0x30')]=_[_0xe2fd('0x31')](_0x10a5de['query']);_0xd7a97d[_0xe2fd('0x32')]=_[_0xe2fd('0x33')](_0xd7a97d[_0xe2fd('0x2f')],_0xd7a97d[_0xe2fd('0x30')]);_0xfcce35[_0xe2fd('0x34')]=_['intersection'](_0xd7a97d[_0xe2fd('0x2f')],qs[_0xe2fd('0x35')](_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x35')]));_0xfcce35[_0xe2fd('0x34')]=_0xfcce35[_0xe2fd('0x34')][_0xe2fd('0x36')]?_0xfcce35['attributes']:_0xd7a97d['model'];if(!_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x37')]('nolimit')){_0xfcce35[_0xe2fd('0x20')]=qs['limit'](_0x10a5de[_0xe2fd('0x30')]['limit']);_0xfcce35[_0xe2fd('0x1f')]=qs['offset'](_0x10a5de[_0xe2fd('0x30')]['offset']);}_0xfcce35[_0xe2fd('0x38')]=qs[_0xe2fd('0x39')](_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x39')]);_0xfcce35[_0xe2fd('0x3a')]=qs[_0xe2fd('0x32')](_[_0xe2fd('0x3b')](_0x10a5de[_0xe2fd('0x30')],_0xd7a97d['filters']),_0x424ed0);if(_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x3c')]){_0xfcce35[_0xe2fd('0x3a')]=_['merge'](_0xfcce35[_0xe2fd('0x3a')],{'$or':_[_0xe2fd('0x2b')](_0x424ed0,function(_0x374917){if(_0x374917[_0xe2fd('0x2d')]!=='VIRTUAL'){var _0x34178d={};_0x34178d[_0x374917[_0xe2fd('0x29')]]={'$like':'%'+_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x3c')]+'%'};return _0x34178d;}})});}_0xfcce35=_[_0xe2fd('0x3d')]({},_0xfcce35,_0x10a5de[_0xe2fd('0x3e')]);var _0x12586f={'where':_0xfcce35[_0xe2fd('0x3a')]};return db['MailSubstatus'][_0xe2fd('0x1e')](_0x12586f)[_0xe2fd('0x27')](function(_0x2fe668){_0x3b0532[_0xe2fd('0x1e')]=_0x2fe668;if(_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x3f')]){_0xfcce35[_0xe2fd('0x40')]=[{'all':!![]}];}return db[_0xe2fd('0x2c')][_0xe2fd('0x41')](_0xfcce35);})[_0xe2fd('0x27')](function(_0x53d08d){_0x3b0532['rows']=_0x53d08d;return _0x3b0532;})[_0xe2fd('0x27')](respondWithFilteredResult(_0x1d1a15,_0xfcce35))[_0xe2fd('0x42')](handleError(_0x1d1a15,null));};exports[_0xe2fd('0x43')]=function(_0x341a43,_0x1e064){var _0x2bcd78={'raw':!![],'where':{'id':_0x341a43[_0xe2fd('0x44')]['id']}},_0x287ce2={};_0x287ce2[_0xe2fd('0x2f')]=_[_0xe2fd('0x31')](db[_0xe2fd('0x2c')]['rawAttributes']);_0x287ce2['query']=_[_0xe2fd('0x31')](_0x341a43[_0xe2fd('0x30')]);_0x287ce2[_0xe2fd('0x32')]=_[_0xe2fd('0x33')](_0x287ce2['model'],_0x287ce2[_0xe2fd('0x30')]);_0x2bcd78['attributes']=_[_0xe2fd('0x33')](_0x287ce2[_0xe2fd('0x2f')],qs[_0xe2fd('0x35')](_0x341a43[_0xe2fd('0x30')][_0xe2fd('0x35')]));_0x2bcd78['attributes']=_0x2bcd78[_0xe2fd('0x34')]['length']?_0x2bcd78['attributes']:_0x287ce2[_0xe2fd('0x2f')];if(_0x341a43[_0xe2fd('0x30')][_0xe2fd('0x3f')]){_0x2bcd78['include']=[{'all':!![]}];}_0x2bcd78=_['merge']({},_0x2bcd78,_0x341a43[_0xe2fd('0x3e')]);return db[_0xe2fd('0x2c')][_0xe2fd('0x45')](_0x2bcd78)['then'](handleEntityNotFound(_0x1e064,null))['then'](respondWithResult(_0x1e064,null))[_0xe2fd('0x42')](handleError(_0x1e064,null));};exports[_0xe2fd('0x46')]=function(_0xbc9158,_0x27a0f4){return db[_0xe2fd('0x2c')]['create'](_0xbc9158['body'],{})[_0xe2fd('0x27')](respondWithResult(_0x27a0f4,0xc9))[_0xe2fd('0x42')](handleError(_0x27a0f4,null));};exports[_0xe2fd('0x25')]=function(_0x205087,_0x5a25c9){if(_0x205087['body']['id']){delete _0x205087[_0xe2fd('0x47')]['id'];}return db[_0xe2fd('0x2c')][_0xe2fd('0x45')]({'where':{'id':_0x205087['params']['id']}})[_0xe2fd('0x27')](handleEntityNotFound(_0x5a25c9,null))[_0xe2fd('0x27')](saveUpdates(_0x205087[_0xe2fd('0x47')],null))[_0xe2fd('0x27')](respondWithResult(_0x5a25c9,null))[_0xe2fd('0x42')](handleError(_0x5a25c9,null));};exports[_0xe2fd('0x26')]=function(_0x46ea20,_0x52c392){return db['MailSubstatus'][_0xe2fd('0x45')]({'where':{'id':_0x46ea20[_0xe2fd('0x44')]['id']}})[_0xe2fd('0x27')](handleEntityNotFound(_0x52c392,null))[_0xe2fd('0x27')](removeEntity(_0x52c392,null))[_0xe2fd('0x42')](handleError(_0x52c392,null));};exports['describe']=function(_0x571566,_0x4df2a7){return db['MailSubstatus'][_0xe2fd('0x48')]()[_0xe2fd('0x27')](respondWithResult(_0x4df2a7,null))[_0xe2fd('0x42')](handleError(_0x4df2a7,null));}; \ No newline at end of file +var _0xe544=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','length','find','create','body','destroy','catch','describe','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0xe544,0x16c));var _0x4e54=function(_0x106b6e,_0x25d723){_0x106b6e=_0x106b6e-0x0;var _0x266727=_0xe544[_0x106b6e];return _0x266727;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e54('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4e54('0x1'));var moment=require(_0x4e54('0x2'));var BPromise=require(_0x4e54('0x3'));var Mustache=require(_0x4e54('0x4'));var util=require('util');var path=require(_0x4e54('0x5'));var sox=require(_0x4e54('0x6'));var csv=require(_0x4e54('0x7'));var ejs=require(_0x4e54('0x8'));var fs=require('fs');var _=require(_0x4e54('0x9'));var squel=require('squel');var crypto=require(_0x4e54('0xa'));var jsforce=require(_0x4e54('0xb'));var deskjs=require(_0x4e54('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e54('0xd'));var Redis=require(_0x4e54('0xe'));var authService=require(_0x4e54('0xf'));var qs=require(_0x4e54('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e54('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4e54('0x12'));var config=require(_0x4e54('0x13'));var licenseUtil=require(_0x4e54('0x14'));var db=require(_0x4e54('0x15'))['db'];function respondWithStatusCode(_0x42d9bd,_0x49aa78){_0x49aa78=_0x49aa78||0xcc;return function(_0x40ee7a){if(_0x40ee7a){return _0x42d9bd[_0x4e54('0x16')](_0x49aa78);}return _0x42d9bd['status'](_0x49aa78)[_0x4e54('0x17')]();};}function respondWithResult(_0x177649,_0x27a162){_0x27a162=_0x27a162||0xc8;return function(_0x177251){if(_0x177251){return _0x177649[_0x4e54('0x18')](_0x27a162)[_0x4e54('0x19')](_0x177251);}};}function respondWithFilteredResult(_0x3e9f03,_0x439029){return function(_0x1a75da){if(_0x1a75da){var _0x589ef4=_0x1a75da[_0x4e54('0x1a')],_0x347c72=_0x439029[_0x4e54('0x1b')],_0x2fbdd6=_0x439029['offset']+_0x439029[_0x4e54('0x1c')],_0x33f597;if(_0x2fbdd6>=_0x589ef4){_0x2fbdd6=_0x589ef4;_0x33f597=0xc8;}else{_0x33f597=0xce;}_0x3e9f03['status'](_0x33f597);return _0x3e9f03[_0x4e54('0x1d')](_0x4e54('0x1e'),_0x347c72+'-'+_0x2fbdd6+'/'+_0x589ef4)[_0x4e54('0x19')](_0x1a75da);}return null;};}function patchUpdates(_0x288833){return function(_0xf12620){try{jsonpatch[_0x4e54('0x1f')](_0xf12620,_0x288833,!![]);}catch(_0x58c93f){return BPromise[_0x4e54('0x20')](_0x58c93f);}return _0xf12620[_0x4e54('0x21')]();};}function saveUpdates(_0x9d241a,_0x219a7b){return function(_0x159d69){if(_0x159d69){return _0x159d69[_0x4e54('0x22')](_0x9d241a)[_0x4e54('0x23')](function(_0x513b51){return _0x513b51;});}return null;};}function removeEntity(_0x247c8e,_0x10c97c){return function(_0x40ad81){if(_0x40ad81){return _0x40ad81['destroy']()[_0x4e54('0x23')](function(){_0x247c8e[_0x4e54('0x18')](0xcc)[_0x4e54('0x17')]();});}};}function handleEntityNotFound(_0x2e7251,_0x578fd2){return function(_0x176aab){if(!_0x176aab){_0x2e7251[_0x4e54('0x16')](0x194);}return _0x176aab;};}function handleError(_0x26db36,_0x4e82d9){_0x4e82d9=_0x4e82d9||0x1f4;return function(_0x52e031){logger[_0x4e54('0x24')](_0x52e031[_0x4e54('0x25')]);if(_0x52e031[_0x4e54('0x26')]){delete _0x52e031['name'];}_0x26db36[_0x4e54('0x18')](_0x4e82d9)['send'](_0x52e031);};}exports[_0x4e54('0x27')]=function(_0x9c2a86,_0x2bed3d){var _0x5a2122={},_0x88493e={},_0x27da0b={'count':0x0,'rows':[]};var _0x46c7a7=_[_0x4e54('0x28')](db[_0x4e54('0x29')][_0x4e54('0x2a')],function(_0x2fa4ad){return{'name':_0x2fa4ad[_0x4e54('0x2b')],'type':_0x2fa4ad[_0x4e54('0x2c')][_0x4e54('0x2d')]};});_0x88493e[_0x4e54('0x2e')]=_[_0x4e54('0x28')](_0x46c7a7,_0x4e54('0x26'));_0x88493e[_0x4e54('0x2f')]=_[_0x4e54('0x30')](_0x9c2a86[_0x4e54('0x2f')]);_0x88493e[_0x4e54('0x31')]=_['intersection'](_0x88493e[_0x4e54('0x2e')],_0x88493e['query']);_0x5a2122[_0x4e54('0x32')]=_['intersection'](_0x88493e[_0x4e54('0x2e')],qs[_0x4e54('0x33')](_0x9c2a86[_0x4e54('0x2f')][_0x4e54('0x33')]));_0x5a2122[_0x4e54('0x32')]=_0x5a2122[_0x4e54('0x32')]['length']?_0x5a2122[_0x4e54('0x32')]:_0x88493e[_0x4e54('0x2e')];if(!_0x9c2a86[_0x4e54('0x2f')][_0x4e54('0x34')](_0x4e54('0x35'))){_0x5a2122[_0x4e54('0x1c')]=qs[_0x4e54('0x1c')](_0x9c2a86['query'][_0x4e54('0x1c')]);_0x5a2122[_0x4e54('0x1b')]=qs[_0x4e54('0x1b')](_0x9c2a86[_0x4e54('0x2f')][_0x4e54('0x1b')]);}_0x5a2122[_0x4e54('0x36')]=qs[_0x4e54('0x37')](_0x9c2a86[_0x4e54('0x2f')][_0x4e54('0x37')]);_0x5a2122[_0x4e54('0x38')]=qs[_0x4e54('0x31')](_[_0x4e54('0x39')](_0x9c2a86['query'],_0x88493e[_0x4e54('0x31')]),_0x46c7a7);if(_0x9c2a86[_0x4e54('0x2f')][_0x4e54('0x3a')]){_0x5a2122[_0x4e54('0x38')]=_[_0x4e54('0x3b')](_0x5a2122['where'],{'$or':_[_0x4e54('0x28')](_0x46c7a7,function(_0xdffa1f){if(_0xdffa1f[_0x4e54('0x2c')]!=='VIRTUAL'){var _0x40cf9f={};_0x40cf9f[_0xdffa1f[_0x4e54('0x26')]]={'$like':'%'+_0x9c2a86[_0x4e54('0x2f')][_0x4e54('0x3a')]+'%'};return _0x40cf9f;}})});}_0x5a2122=_['merge']({},_0x5a2122,_0x9c2a86[_0x4e54('0x3c')]);var _0x154c25={'where':_0x5a2122[_0x4e54('0x38')]};return db['MailSubstatus'][_0x4e54('0x1a')](_0x154c25)[_0x4e54('0x23')](function(_0x29ca3e){_0x27da0b[_0x4e54('0x1a')]=_0x29ca3e;if(_0x9c2a86[_0x4e54('0x2f')][_0x4e54('0x3d')]){_0x5a2122[_0x4e54('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x4e54('0x3f')](_0x5a2122);})[_0x4e54('0x23')](function(_0x16098f){_0x27da0b[_0x4e54('0x40')]=_0x16098f;return _0x27da0b;})['then'](respondWithFilteredResult(_0x2bed3d,_0x5a2122))['catch'](handleError(_0x2bed3d,null));};exports[_0x4e54('0x41')]=function(_0x475357,_0x28ac9e){var _0x243a42={'raw':!![],'where':{'id':_0x475357[_0x4e54('0x42')]['id']}},_0x2e61ab={};_0x2e61ab[_0x4e54('0x2e')]=_[_0x4e54('0x30')](db['MailSubstatus'][_0x4e54('0x2a')]);_0x2e61ab[_0x4e54('0x2f')]=_['keys'](_0x475357[_0x4e54('0x2f')]);_0x2e61ab['filters']=_['intersection'](_0x2e61ab['model'],_0x2e61ab[_0x4e54('0x2f')]);_0x243a42[_0x4e54('0x32')]=_[_0x4e54('0x43')](_0x2e61ab['model'],qs[_0x4e54('0x33')](_0x475357['query']['fields']));_0x243a42[_0x4e54('0x32')]=_0x243a42[_0x4e54('0x32')][_0x4e54('0x44')]?_0x243a42[_0x4e54('0x32')]:_0x2e61ab[_0x4e54('0x2e')];if(_0x475357[_0x4e54('0x2f')]['includeAll']){_0x243a42[_0x4e54('0x3e')]=[{'all':!![]}];}_0x243a42=_[_0x4e54('0x3b')]({},_0x243a42,_0x475357[_0x4e54('0x3c')]);return db[_0x4e54('0x29')][_0x4e54('0x45')](_0x243a42)[_0x4e54('0x23')](handleEntityNotFound(_0x28ac9e,null))[_0x4e54('0x23')](respondWithResult(_0x28ac9e,null))['catch'](handleError(_0x28ac9e,null));};exports['create']=function(_0x4164db,_0x66c51d){return db['MailSubstatus'][_0x4e54('0x46')](_0x4164db[_0x4e54('0x47')],{})[_0x4e54('0x23')](respondWithResult(_0x66c51d,0xc9))['catch'](handleError(_0x66c51d,null));};exports[_0x4e54('0x22')]=function(_0x196821,_0x26bf06){if(_0x196821['body']['id']){delete _0x196821[_0x4e54('0x47')]['id'];}return db[_0x4e54('0x29')]['find']({'where':{'id':_0x196821[_0x4e54('0x42')]['id']}})[_0x4e54('0x23')](handleEntityNotFound(_0x26bf06,null))[_0x4e54('0x23')](saveUpdates(_0x196821[_0x4e54('0x47')],null))[_0x4e54('0x23')](respondWithResult(_0x26bf06,null))['catch'](handleError(_0x26bf06,null));};exports[_0x4e54('0x48')]=function(_0xc87c13,_0x19f19d){return db[_0x4e54('0x29')][_0x4e54('0x45')]({'where':{'id':_0xc87c13[_0x4e54('0x42')]['id']}})[_0x4e54('0x23')](handleEntityNotFound(_0x19f19d,null))[_0x4e54('0x23')](removeEntity(_0x19f19d,null))[_0x4e54('0x49')](handleError(_0x19f19d,null));};exports['describe']=function(_0x5e182b,_0x3ce059){return db[_0x4e54('0x29')][_0x4e54('0x4a')]()[_0x4e54('0x23')](respondWithResult(_0x3ce059,null))[_0x4e54('0x49')](handleError(_0x3ce059,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 58259a3..819f8db 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 _0x6931=['moment','bluebird','request-promise','path','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api'];(function(_0x49fbe8,_0x14452c){var _0xd3637d=function(_0x55e48f){while(--_0x55e48f){_0x49fbe8['push'](_0x49fbe8['shift']());}};_0xd3637d(++_0x14452c);}(_0x6931,0x1a9));var _0x1693=function(_0x7e74b6,_0x5d8d7e){_0x7e74b6=_0x7e74b6-0x0;var _0x4fbaf3=_0x6931[_0x7e74b6];return _0x4fbaf3;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var logger=require(_0x1693('0x2'))(_0x1693('0x3'));var moment=require(_0x1693('0x4'));var BPromise=require(_0x1693('0x5'));var rp=require(_0x1693('0x6'));var fs=require('fs');var path=require(_0x1693('0x7'));var rimraf=require('rimraf');var config=require(_0x1693('0x8'));var attributes=require(_0x1693('0x9'));module[_0x1693('0xa')]=function(_0x455646,_0x379d6c){return _0x455646['define'](_0x1693('0xb'),attributes,{'tableName':_0x1693('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x390a=['api','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','../../config/logger'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x390a,0xc9));var _0xa390=function(_0x239d62,_0x4667cf){_0x239d62=_0x239d62-0x0;var _0x365f47=_0x390a[_0x239d62];return _0x365f47;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var logger=require(_0xa390('0x2'))(_0xa390('0x3'));var moment=require('moment');var BPromise=require(_0xa390('0x4'));var rp=require(_0xa390('0x5'));var fs=require('fs');var path=require(_0xa390('0x6'));var rimraf=require(_0xa390('0x7'));var config=require('../../config/environment');var attributes=require(_0xa390('0x8'));module[_0xa390('0x9')]=function(_0x3d7cd7,_0x4ac9f5){return _0x3d7cd7[_0xa390('0xa')](_0xa390('0xb'),attributes,{'tableName':'mail_substatuses','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 5a7f59c..58859a5 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 _0xe706=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41052b,_0x136924){var _0x31bed0=function(_0x2d07fa){while(--_0x2d07fa){_0x41052b['push'](_0x41052b['shift']());}};_0x31bed0(++_0x136924);}(_0xe706,0xa3));var _0x6e70=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe706[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0x1be1,0x192));var _0x11be=function(_0x9d5639,_0x3ecfd7){_0x9d5639=_0x9d5639-0x0;var _0xb77c29=_0x1be1[_0x9d5639];return _0xb77c29;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a02f3ad..18a2577 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 _0x3048=['/describe','describe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3048,0x1d0));var _0x8304=function(_0x213502,_0x22ede6){_0x213502=_0x213502-0x0;var _0x40abef=_0x3048[_0x213502];return _0x40abef;};'use strict';var multer=require(_0x8304('0x0'));var util=require(_0x8304('0x1'));var path=require(_0x8304('0x2'));var timeout=require(_0x8304('0x3'));var express=require(_0x8304('0x4'));var router=express[_0x8304('0x5')]();var auth=require(_0x8304('0x6'));var interaction=require(_0x8304('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x8304('0x8')]('/',auth[_0x8304('0x9')](),controller[_0x8304('0xa')]);router[_0x8304('0x8')](_0x8304('0xb'),auth[_0x8304('0x9')](),controller[_0x8304('0xc')]);router[_0x8304('0x8')]('/:id',auth[_0x8304('0x9')](),controller['show']);router['post']('/',auth[_0x8304('0x9')](),controller['create']);router[_0x8304('0xd')](_0x8304('0xe'),auth[_0x8304('0x9')](),controller[_0x8304('0xf')]);router[_0x8304('0x10')](_0x8304('0xe'),auth[_0x8304('0x9')](),controller[_0x8304('0x11')]);module[_0x8304('0x12')]=router; \ No newline at end of file +var _0xe3ac=['post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4c1a6e,_0x5ab890){var _0x108d8f=function(_0x27cb41){while(--_0x27cb41){_0x4c1a6e['push'](_0x4c1a6e['shift']());}};_0x108d8f(++_0x5ab890);}(_0xe3ac,0x182));var _0xce3a=function(_0x35fee8,_0x478239){_0x35fee8=_0x35fee8-0x0;var _0x46d3d4=_0xe3ac[_0x35fee8];return _0x46d3d4;};'use strict';var multer=require(_0xce3a('0x0'));var util=require(_0xce3a('0x1'));var path=require('path');var timeout=require(_0xce3a('0x2'));var express=require(_0xce3a('0x3'));var router=express[_0xce3a('0x4')]();var auth=require(_0xce3a('0x5'));var interaction=require(_0xce3a('0x6'));var config=require('../../config/environment');var controller=require(_0xce3a('0x7'));router[_0xce3a('0x8')]('/',auth[_0xce3a('0x9')](),controller[_0xce3a('0xa')]);router[_0xce3a('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xce3a('0x8')](_0xce3a('0xb'),auth[_0xce3a('0x9')](),controller[_0xce3a('0xc')]);router[_0xce3a('0xd')]('/',auth[_0xce3a('0x9')](),controller['create']);router[_0xce3a('0xe')](_0xce3a('0xb'),auth['isAuthenticated'](),controller[_0xce3a('0xf')]);router[_0xce3a('0x10')](_0xce3a('0xb'),auth[_0xce3a('0x9')](),controller[_0xce3a('0x11')]);module[_0xce3a('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 882c840..ab269c3 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 _0xffbc=['NOW','moment','exports','ENUM','queue','DATE'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xffbc,0xc7));var _0xcffb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xffbc[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0xcffb('0x0'));var Sequelize=require('sequelize');module[_0xcffb('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcffb('0x2')]('account','agent',_0xcffb('0x3')),'allowNull':![],'defaultValue':_0xcffb('0x3')},'transferredAt':{'type':Sequelize[_0xcffb('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xcffb('0x5')]}}; \ No newline at end of file +var _0xc0e8=['ENUM','account','queue','NOW','moment','exports','STRING'];(function(_0x278e97,_0x58350b){var _0x4ce67c=function(_0x5f4630){while(--_0x5f4630){_0x278e97['push'](_0x278e97['shift']());}};_0x4ce67c(++_0x58350b);}(_0xc0e8,0xa5));var _0x8c0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc0e8[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8c0e('0x0'));var Sequelize=require('sequelize');module[_0x8c0e('0x1')]={'uniqueid':{'type':Sequelize[_0x8c0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8c0e('0x3')](_0x8c0e('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x8c0e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8c0e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index b08b2f6..f26e2a0 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 _0x758a=['offset','limit','set','Content-Range','reject','save','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','count','then','includeAll','rows','show','params','keys','fields','include','options','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x758a,0x1d1));var _0xa758=function(_0xed6929,_0x5842e4){_0xed6929=_0xed6929-0x0;var _0x5412a9=_0x758a[_0xed6929];return _0x5412a9;};'use strict';var pdf=require(_0xa758('0x0'));var emlformat=require(_0xa758('0x1'));var rimraf=require(_0xa758('0x2'));var zipdir=require(_0xa758('0x3'));var jsonpatch=require(_0xa758('0x4'));var rp=require(_0xa758('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa758('0x6'));var path=require('path');var sox=require(_0xa758('0x7'));var csv=require(_0xa758('0x8'));var ejs=require(_0xa758('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa758('0xa'));var jsforce=require(_0xa758('0xb'));var deskjs=require(_0xa758('0xc'));var toCsv=require(_0xa758('0x8'));var querystring=require(_0xa758('0xd'));var Papa=require(_0xa758('0xe'));var Redis=require('ioredis');var authService=require(_0xa758('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa758('0x10'));var logger=require(_0xa758('0x11'))('api');var utils=require(_0xa758('0x12'));var config=require(_0xa758('0x13'));var licenseUtil=require(_0xa758('0x14'));var db=require(_0xa758('0x15'))['db'];function respondWithStatusCode(_0x3a2a7f,_0x190ed7){_0x190ed7=_0x190ed7||0xcc;return function(_0x1a78c6){if(_0x1a78c6){return _0x3a2a7f['sendStatus'](_0x190ed7);}return _0x3a2a7f['status'](_0x190ed7)[_0xa758('0x16')]();};}function respondWithResult(_0x5b5e8d,_0x5cd902){_0x5cd902=_0x5cd902||0xc8;return function(_0x465ced){if(_0x465ced){return _0x5b5e8d[_0xa758('0x17')](_0x5cd902)[_0xa758('0x18')](_0x465ced);}};}function respondWithFilteredResult(_0x4ce12f,_0x5d837f){return function(_0x6383d4){if(_0x6383d4){var _0x5dad5a=_0x6383d4['count'],_0x2a37c4=_0x5d837f[_0xa758('0x19')],_0x50cfba=_0x5d837f[_0xa758('0x19')]+_0x5d837f[_0xa758('0x1a')],_0x1da460;if(_0x50cfba>=_0x5dad5a){_0x50cfba=_0x5dad5a;_0x1da460=0xc8;}else{_0x1da460=0xce;}_0x4ce12f[_0xa758('0x17')](_0x1da460);return _0x4ce12f[_0xa758('0x1b')](_0xa758('0x1c'),_0x2a37c4+'-'+_0x50cfba+'/'+_0x5dad5a)[_0xa758('0x18')](_0x6383d4);}return null;};}function patchUpdates(_0x584a36){return function(_0x220f28){try{jsonpatch['apply'](_0x220f28,_0x584a36,!![]);}catch(_0x21a823){return BPromise[_0xa758('0x1d')](_0x21a823);}return _0x220f28[_0xa758('0x1e')]();};}function saveUpdates(_0x36819c,_0x5ab473){return function(_0x225eb5){if(_0x225eb5){return _0x225eb5['update'](_0x36819c)['then'](function(_0x8f311){return _0x8f311;});}return null;};}function removeEntity(_0x1096b0,_0x11830f){return function(_0x49bcae){if(_0x49bcae){return _0x49bcae[_0xa758('0x1f')]()['then'](function(){_0x1096b0[_0xa758('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3445e8,_0x49b993){return function(_0x3cf203){if(!_0x3cf203){_0x3445e8['sendStatus'](0x194);}return _0x3cf203;};}function handleError(_0x1ef4ad,_0x4c4b71){_0x4c4b71=_0x4c4b71||0x1f4;return function(_0x1c7651){logger[_0xa758('0x20')](_0x1c7651[_0xa758('0x21')]);if(_0x1c7651[_0xa758('0x22')]){delete _0x1c7651[_0xa758('0x22')];}_0x1ef4ad[_0xa758('0x17')](_0x4c4b71)[_0xa758('0x23')](_0x1c7651);};}exports[_0xa758('0x24')]=function(_0x5eda50,_0x56f3e9){var _0x4bcb3d={},_0x5df5d6={},_0x30b254={'count':0x0,'rows':[]};var _0x36ae70=_['map'](db[_0xa758('0x25')][_0xa758('0x26')],function(_0x32f5ac){return{'name':_0x32f5ac[_0xa758('0x27')],'type':_0x32f5ac[_0xa758('0x28')][_0xa758('0x29')]};});_0x5df5d6[_0xa758('0x2a')]=_[_0xa758('0x2b')](_0x36ae70,_0xa758('0x22'));_0x5df5d6[_0xa758('0x2c')]=_['keys'](_0x5eda50[_0xa758('0x2c')]);_0x5df5d6[_0xa758('0x2d')]=_[_0xa758('0x2e')](_0x5df5d6[_0xa758('0x2a')],_0x5df5d6[_0xa758('0x2c')]);_0x4bcb3d['attributes']=_[_0xa758('0x2e')](_0x5df5d6[_0xa758('0x2a')],qs['fields'](_0x5eda50['query']['fields']));_0x4bcb3d[_0xa758('0x2f')]=_0x4bcb3d['attributes'][_0xa758('0x30')]?_0x4bcb3d[_0xa758('0x2f')]:_0x5df5d6['model'];if(!_0x5eda50[_0xa758('0x2c')]['hasOwnProperty'](_0xa758('0x31'))){_0x4bcb3d[_0xa758('0x1a')]=qs[_0xa758('0x1a')](_0x5eda50['query'][_0xa758('0x1a')]);_0x4bcb3d[_0xa758('0x19')]=qs[_0xa758('0x19')](_0x5eda50[_0xa758('0x2c')][_0xa758('0x19')]);}_0x4bcb3d[_0xa758('0x32')]=qs[_0xa758('0x33')](_0x5eda50[_0xa758('0x2c')][_0xa758('0x33')]);_0x4bcb3d[_0xa758('0x34')]=qs[_0xa758('0x2d')](_['pick'](_0x5eda50['query'],_0x5df5d6['filters']),_0x36ae70);if(_0x5eda50[_0xa758('0x2c')][_0xa758('0x35')]){_0x4bcb3d['where']=_[_0xa758('0x36')](_0x4bcb3d[_0xa758('0x34')],{'$or':_[_0xa758('0x2b')](_0x36ae70,function(_0x104cae){if(_0x104cae['type']!=='VIRTUAL'){var _0x2a1db5={};_0x2a1db5[_0x104cae['name']]={'$like':'%'+_0x5eda50[_0xa758('0x2c')][_0xa758('0x35')]+'%'};return _0x2a1db5;}})});}_0x4bcb3d=_[_0xa758('0x36')]({},_0x4bcb3d,_0x5eda50['options']);var _0x27ed04={'where':_0x4bcb3d[_0xa758('0x34')]};return db[_0xa758('0x25')][_0xa758('0x37')](_0x27ed04)[_0xa758('0x38')](function(_0x16e747){_0x30b254[_0xa758('0x37')]=_0x16e747;if(_0x5eda50[_0xa758('0x2c')][_0xa758('0x39')]){_0x4bcb3d['include']=[{'all':!![]}];}return db[_0xa758('0x25')]['findAll'](_0x4bcb3d);})[_0xa758('0x38')](function(_0xc7f2e6){_0x30b254[_0xa758('0x3a')]=_0xc7f2e6;return _0x30b254;})[_0xa758('0x38')](respondWithFilteredResult(_0x56f3e9,_0x4bcb3d))['catch'](handleError(_0x56f3e9,null));};exports[_0xa758('0x3b')]=function(_0x31d1c8,_0x3351a0){var _0x346083={'raw':!![],'where':{'id':_0x31d1c8[_0xa758('0x3c')]['id']}},_0xbf9d12={};_0xbf9d12[_0xa758('0x2a')]=_[_0xa758('0x3d')](db[_0xa758('0x25')][_0xa758('0x26')]);_0xbf9d12[_0xa758('0x2c')]=_[_0xa758('0x3d')](_0x31d1c8[_0xa758('0x2c')]);_0xbf9d12[_0xa758('0x2d')]=_['intersection'](_0xbf9d12[_0xa758('0x2a')],_0xbf9d12[_0xa758('0x2c')]);_0x346083[_0xa758('0x2f')]=_[_0xa758('0x2e')](_0xbf9d12[_0xa758('0x2a')],qs[_0xa758('0x3e')](_0x31d1c8[_0xa758('0x2c')][_0xa758('0x3e')]));_0x346083[_0xa758('0x2f')]=_0x346083['attributes']['length']?_0x346083[_0xa758('0x2f')]:_0xbf9d12[_0xa758('0x2a')];if(_0x31d1c8[_0xa758('0x2c')][_0xa758('0x39')]){_0x346083[_0xa758('0x3f')]=[{'all':!![]}];}_0x346083=_['merge']({},_0x346083,_0x31d1c8[_0xa758('0x40')]);return db[_0xa758('0x25')][_0xa758('0x41')](_0x346083)[_0xa758('0x38')](handleEntityNotFound(_0x3351a0,null))[_0xa758('0x38')](respondWithResult(_0x3351a0,null))['catch'](handleError(_0x3351a0,null));};exports[_0xa758('0x42')]=function(_0x3687be,_0x5086fe){return db[_0xa758('0x25')]['create'](_0x3687be[_0xa758('0x43')],{})[_0xa758('0x38')](respondWithResult(_0x5086fe,0xc9))[_0xa758('0x44')](handleError(_0x5086fe,null));};exports['update']=function(_0x2725c2,_0x464a11){if(_0x2725c2[_0xa758('0x43')]['id']){delete _0x2725c2[_0xa758('0x43')]['id'];}return db[_0xa758('0x25')]['find']({'where':{'id':_0x2725c2[_0xa758('0x3c')]['id']}})[_0xa758('0x38')](handleEntityNotFound(_0x464a11,null))['then'](saveUpdates(_0x2725c2[_0xa758('0x43')],null))[_0xa758('0x38')](respondWithResult(_0x464a11,null))[_0xa758('0x44')](handleError(_0x464a11,null));};exports[_0xa758('0x1f')]=function(_0x23c062,_0x5408da){return db[_0xa758('0x25')][_0xa758('0x41')]({'where':{'id':_0x23c062['params']['id']}})['then'](handleEntityNotFound(_0x5408da,null))[_0xa758('0x38')](removeEntity(_0x5408da,null))[_0xa758('0x44')](handleError(_0x5408da,null));};exports['describe']=function(_0xa288a4,_0x5307d6){return db[_0xa758('0x25')][_0xa758('0x45')]()[_0xa758('0x38')](respondWithResult(_0x5307d6,null))[_0xa758('0x44')](handleError(_0x5307d6,null));}; \ No newline at end of file +var _0x54d4=['eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailTransferReport','type','model','keys','filters','query','attributes','fields','length','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','rows','show','params','rawAttributes','intersection','include','find','body','catch','describe','html-pdf'];(function(_0x4db728,_0x461849){var _0x3ca8dd=function(_0xd11433){while(--_0xd11433){_0x4db728['push'](_0x4db728['shift']());}};_0x3ca8dd(++_0x461849);}(_0x54d4,0x113));var _0x454d=function(_0x5a9247,_0x59f465){_0x5a9247=_0x5a9247-0x0;var _0x335ada=_0x54d4[_0x5a9247];return _0x335ada;};'use strict';var pdf=require(_0x454d('0x0'));var emlformat=require(_0x454d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x454d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x454d('0x3'));var moment=require(_0x454d('0x4'));var BPromise=require(_0x454d('0x5'));var Mustache=require(_0x454d('0x6'));var util=require('util');var path=require(_0x454d('0x7'));var sox=require(_0x454d('0x8'));var csv=require('to-csv');var ejs=require(_0x454d('0x9'));var fs=require('fs');var _=require(_0x454d('0xa'));var squel=require(_0x454d('0xb'));var crypto=require('crypto');var jsforce=require(_0x454d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x454d('0xd'));var querystring=require(_0x454d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x454d('0xf'));var as=require(_0x454d('0x10'));var hardwareService=require(_0x454d('0x11'));var logger=require(_0x454d('0x12'))(_0x454d('0x13'));var utils=require('../../config/utils');var config=require(_0x454d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19c143,_0x4c9b4a){_0x4c9b4a=_0x4c9b4a||0xcc;return function(_0x90ce2e){if(_0x90ce2e){return _0x19c143[_0x454d('0x15')](_0x4c9b4a);}return _0x19c143['status'](_0x4c9b4a)[_0x454d('0x16')]();};}function respondWithResult(_0x4bf3d8,_0x20c1a0){_0x20c1a0=_0x20c1a0||0xc8;return function(_0x203846){if(_0x203846){return _0x4bf3d8[_0x454d('0x17')](_0x20c1a0)[_0x454d('0x18')](_0x203846);}};}function respondWithFilteredResult(_0x15a50a,_0x4d7528){return function(_0x3fc221){if(_0x3fc221){var _0x1bf026=_0x3fc221[_0x454d('0x19')],_0x5b0160=_0x4d7528['offset'],_0x34403a=_0x4d7528[_0x454d('0x1a')]+_0x4d7528[_0x454d('0x1b')],_0x242333;if(_0x34403a>=_0x1bf026){_0x34403a=_0x1bf026;_0x242333=0xc8;}else{_0x242333=0xce;}_0x15a50a[_0x454d('0x17')](_0x242333);return _0x15a50a[_0x454d('0x1c')](_0x454d('0x1d'),_0x5b0160+'-'+_0x34403a+'/'+_0x1bf026)['json'](_0x3fc221);}return null;};}function patchUpdates(_0x90af8a){return function(_0x2de83d){try{jsonpatch[_0x454d('0x1e')](_0x2de83d,_0x90af8a,!![]);}catch(_0x16b131){return BPromise[_0x454d('0x1f')](_0x16b131);}return _0x2de83d[_0x454d('0x20')]();};}function saveUpdates(_0x2e4d07,_0x4abb29){return function(_0x24d048){if(_0x24d048){return _0x24d048[_0x454d('0x21')](_0x2e4d07)[_0x454d('0x22')](function(_0x33c556){return _0x33c556;});}return null;};}function removeEntity(_0x4878c4,_0xfc1e85){return function(_0x21434b){if(_0x21434b){return _0x21434b[_0x454d('0x23')]()[_0x454d('0x22')](function(){_0x4878c4[_0x454d('0x17')](0xcc)[_0x454d('0x16')]();});}};}function handleEntityNotFound(_0x3b9a53,_0x1218d7){return function(_0x3182f5){if(!_0x3182f5){_0x3b9a53[_0x454d('0x15')](0x194);}return _0x3182f5;};}function handleError(_0x3cae58,_0x1edc7a){_0x1edc7a=_0x1edc7a||0x1f4;return function(_0x58db4a){logger[_0x454d('0x24')](_0x58db4a[_0x454d('0x25')]);if(_0x58db4a[_0x454d('0x26')]){delete _0x58db4a[_0x454d('0x26')];}_0x3cae58['status'](_0x1edc7a)[_0x454d('0x27')](_0x58db4a);};}exports['index']=function(_0xed497,_0x324f06){var _0x3fe6fe={},_0x3e2144={},_0x14a5ea={'count':0x0,'rows':[]};var _0x16648a=_[_0x454d('0x28')](db[_0x454d('0x29')]['rawAttributes'],function(_0x3bec06){return{'name':_0x3bec06['fieldName'],'type':_0x3bec06[_0x454d('0x2a')]['key']};});_0x3e2144[_0x454d('0x2b')]=_['map'](_0x16648a,_0x454d('0x26'));_0x3e2144['query']=_[_0x454d('0x2c')](_0xed497['query']);_0x3e2144[_0x454d('0x2d')]=_['intersection'](_0x3e2144[_0x454d('0x2b')],_0x3e2144[_0x454d('0x2e')]);_0x3fe6fe[_0x454d('0x2f')]=_['intersection'](_0x3e2144[_0x454d('0x2b')],qs['fields'](_0xed497[_0x454d('0x2e')][_0x454d('0x30')]));_0x3fe6fe['attributes']=_0x3fe6fe[_0x454d('0x2f')][_0x454d('0x31')]?_0x3fe6fe[_0x454d('0x2f')]:_0x3e2144['model'];if(!_0xed497[_0x454d('0x2e')]['hasOwnProperty'](_0x454d('0x32'))){_0x3fe6fe[_0x454d('0x1b')]=qs[_0x454d('0x1b')](_0xed497[_0x454d('0x2e')][_0x454d('0x1b')]);_0x3fe6fe[_0x454d('0x1a')]=qs[_0x454d('0x1a')](_0xed497[_0x454d('0x2e')][_0x454d('0x1a')]);}_0x3fe6fe['order']=qs[_0x454d('0x33')](_0xed497['query'][_0x454d('0x33')]);_0x3fe6fe['where']=qs[_0x454d('0x2d')](_[_0x454d('0x34')](_0xed497[_0x454d('0x2e')],_0x3e2144['filters']),_0x16648a);if(_0xed497[_0x454d('0x2e')][_0x454d('0x35')]){_0x3fe6fe['where']=_[_0x454d('0x36')](_0x3fe6fe['where'],{'$or':_[_0x454d('0x28')](_0x16648a,function(_0x3e9746){if(_0x3e9746[_0x454d('0x2a')]!==_0x454d('0x37')){var _0xd9e98={};_0xd9e98[_0x3e9746[_0x454d('0x26')]]={'$like':'%'+_0xed497[_0x454d('0x2e')][_0x454d('0x35')]+'%'};return _0xd9e98;}})});}_0x3fe6fe=_['merge']({},_0x3fe6fe,_0xed497[_0x454d('0x38')]);var _0x1ead5e={'where':_0x3fe6fe[_0x454d('0x39')]};return db['MailTransferReport'][_0x454d('0x19')](_0x1ead5e)[_0x454d('0x22')](function(_0x483fb6){_0x14a5ea[_0x454d('0x19')]=_0x483fb6;if(_0xed497[_0x454d('0x2e')][_0x454d('0x3a')]){_0x3fe6fe['include']=[{'all':!![]}];}return db[_0x454d('0x29')]['findAll'](_0x3fe6fe);})[_0x454d('0x22')](function(_0xd56888){_0x14a5ea[_0x454d('0x3b')]=_0xd56888;return _0x14a5ea;})[_0x454d('0x22')](respondWithFilteredResult(_0x324f06,_0x3fe6fe))['catch'](handleError(_0x324f06,null));};exports[_0x454d('0x3c')]=function(_0x15e897,_0x164b03){var _0x36f4c4={'raw':!![],'where':{'id':_0x15e897[_0x454d('0x3d')]['id']}},_0x10f3c7={};_0x10f3c7[_0x454d('0x2b')]=_[_0x454d('0x2c')](db[_0x454d('0x29')][_0x454d('0x3e')]);_0x10f3c7[_0x454d('0x2e')]=_[_0x454d('0x2c')](_0x15e897['query']);_0x10f3c7[_0x454d('0x2d')]=_[_0x454d('0x3f')](_0x10f3c7[_0x454d('0x2b')],_0x10f3c7[_0x454d('0x2e')]);_0x36f4c4['attributes']=_[_0x454d('0x3f')](_0x10f3c7[_0x454d('0x2b')],qs[_0x454d('0x30')](_0x15e897[_0x454d('0x2e')][_0x454d('0x30')]));_0x36f4c4[_0x454d('0x2f')]=_0x36f4c4['attributes'][_0x454d('0x31')]?_0x36f4c4[_0x454d('0x2f')]:_0x10f3c7[_0x454d('0x2b')];if(_0x15e897[_0x454d('0x2e')]['includeAll']){_0x36f4c4[_0x454d('0x40')]=[{'all':!![]}];}_0x36f4c4=_['merge']({},_0x36f4c4,_0x15e897[_0x454d('0x38')]);return db[_0x454d('0x29')][_0x454d('0x41')](_0x36f4c4)[_0x454d('0x22')](handleEntityNotFound(_0x164b03,null))['then'](respondWithResult(_0x164b03,null))['catch'](handleError(_0x164b03,null));};exports['create']=function(_0x36ad4d,_0x1d4571){return db[_0x454d('0x29')]['create'](_0x36ad4d['body'],{})[_0x454d('0x22')](respondWithResult(_0x1d4571,0xc9))['catch'](handleError(_0x1d4571,null));};exports[_0x454d('0x21')]=function(_0x23935b,_0x4c94c1){if(_0x23935b[_0x454d('0x42')]['id']){delete _0x23935b[_0x454d('0x42')]['id'];}return db[_0x454d('0x29')][_0x454d('0x41')]({'where':{'id':_0x23935b[_0x454d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4c94c1,null))[_0x454d('0x22')](saveUpdates(_0x23935b['body'],null))[_0x454d('0x22')](respondWithResult(_0x4c94c1,null))[_0x454d('0x43')](handleError(_0x4c94c1,null));};exports[_0x454d('0x23')]=function(_0x442c56,_0x5625e8){return db['MailTransferReport'][_0x454d('0x41')]({'where':{'id':_0x442c56['params']['id']}})['then'](handleEntityNotFound(_0x5625e8,null))[_0x454d('0x22')](removeEntity(_0x5625e8,null))[_0x454d('0x43')](handleError(_0x5625e8,null));};exports[_0x454d('0x44')]=function(_0x207af4,_0x2026b5){return db[_0x454d('0x29')]['describe']()['then'](respondWithResult(_0x2026b5,null))['catch'](handleError(_0x2026b5,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 426ec4c..039fd38 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 _0x93f7=['uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','define','report_mail_transfer'];(function(_0x5f4560,_0xbdb550){var _0x1b6536=function(_0x38c605){while(--_0x38c605){_0x5f4560['push'](_0x5f4560['shift']());}};_0x1b6536(++_0xbdb550);}(_0x93f7,0x79));var _0x793f=function(_0x8f5647,_0x9806bf){_0x8f5647=_0x8f5647-0x0;var _0x5750dc=_0x93f7[_0x8f5647];return _0x5750dc;};'use strict';var _=require('lodash');var util=require(_0x793f('0x0'));var logger=require('../../config/logger')(_0x793f('0x1'));var moment=require(_0x793f('0x2'));var BPromise=require(_0x793f('0x3'));var rp=require(_0x793f('0x4'));var fs=require('fs');var path=require(_0x793f('0x5'));var rimraf=require(_0x793f('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xcb5035,_0x4f377b){return _0xcb5035[_0x793f('0x7')]('MailTransferReport',attributes,{'tableName':_0x793f('0x8'),'paranoid':![],'indexes':[{'name':_0x793f('0x9'),'fields':[_0x793f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ea1=['report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0xb0cfd8,_0x5e6b2a){var _0x429bd6=function(_0x3e7b7c){while(--_0x3e7b7c){_0xb0cfd8['push'](_0xb0cfd8['shift']());}};_0x429bd6(++_0x5e6b2a);}(_0x2ea1,0x77));var _0x12ea=function(_0x5d515b,_0x4711a7){_0x5d515b=_0x5d515b-0x0;var _0x1d2ca2=_0x2ea1[_0x5d515b];return _0x1d2ca2;};'use strict';var _=require(_0x12ea('0x0'));var util=require('util');var logger=require(_0x12ea('0x1'))(_0x12ea('0x2'));var moment=require(_0x12ea('0x3'));var BPromise=require(_0x12ea('0x4'));var rp=require(_0x12ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12ea('0x6'));var config=require(_0x12ea('0x7'));var attributes=require(_0x12ea('0x8'));module[_0x12ea('0x9')]=function(_0x2bd53b,_0x4d795c){return _0x2bd53b[_0x12ea('0xa')]('MailTransferReport',attributes,{'tableName':_0x12ea('0xb'),'paranoid':![],'indexes':[{'name':_0x12ea('0xc'),'fields':[_0x12ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 5e84947..a547de5 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 _0x3698=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x328e04,_0x16ec5d){var _0x5f026d=function(_0x1af2a0){while(--_0x1af2a0){_0x328e04['push'](_0x328e04['shift']());}};_0x5f026d(++_0x16ec5d);}(_0x3698,0x141));var _0x8369=function(_0x43b88c,_0x46fb04){_0x43b88c=_0x43b88c-0x0;var _0x407299=_0x3698[_0x43b88c];return _0x407299;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8369('0x0'));var BPromise=require(_0x8369('0x1'));var rs=require(_0x8369('0x2'));var fs=require('fs');var Redis=require(_0x8369('0x3'));var db=require(_0x8369('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8369('0x5'));var config=require('../../config/environment');var jayson=require(_0x8369('0x6'));var client=jayson[_0x8369('0x7')][_0x8369('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b52f2,_0x2cfd74,_0x5c8f6c){return new BPromise(function(_0x146a12,_0x172da3){return client[_0x8369('0x9')](_0x4b52f2,_0x5c8f6c)[_0x8369('0xa')](function(_0x51a6cf){logger[_0x8369('0xb')](_0x8369('0xc'),_0x2cfd74,_0x8369('0xd'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2cfd74,_0x8369('0xd'),JSON[_0x8369('0xe')](_0x51a6cf));if(_0x51a6cf[_0x8369('0xf')]){if(_0x51a6cf[_0x8369('0xf')][_0x8369('0x10')]===0x1f4){logger[_0x8369('0xf')](_0x8369('0xc'),_0x2cfd74,_0x51a6cf['error']['message']);return _0x172da3(_0x51a6cf[_0x8369('0xf')][_0x8369('0x11')]);}logger[_0x8369('0xf')](_0x8369('0xc'),_0x2cfd74,_0x51a6cf['error']['message']);return _0x146a12(_0x51a6cf[_0x8369('0xf')][_0x8369('0x11')]);}else{logger[_0x8369('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x2cfd74,_0x8369('0xd'));_0x146a12(_0x51a6cf[_0x8369('0x12')][_0x8369('0x11')]);}})[_0x8369('0x13')](function(_0x3096be){logger[_0x8369('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x2cfd74,_0x3096be);_0x172da3(_0x3096be);});});} \ No newline at end of file +var _0x7ada=['request','then','info','MailTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7ada,0x114));var _0xa7ad=function(_0x5567e4,_0xea7749){_0x5567e4=_0x5567e4-0x0;var _0x83f733=_0x7ada[_0x5567e4];return _0x83f733;};'use strict';var _=require(_0xa7ad('0x0'));var util=require(_0xa7ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7ad('0x2'));var db=require(_0xa7ad('0x3'))['db'];var utils=require(_0xa7ad('0x4'));var logger=require(_0xa7ad('0x5'))(_0xa7ad('0x6'));var config=require(_0xa7ad('0x7'));var jayson=require(_0xa7ad('0x8'));var client=jayson[_0xa7ad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ebaf8,_0x5b2d60,_0x45ccc7){return new BPromise(function(_0x234be2,_0x40753a){return client[_0xa7ad('0xa')](_0x3ebaf8,_0x45ccc7)[_0xa7ad('0xb')](function(_0x2a5924){logger[_0xa7ad('0xc')](_0xa7ad('0xd'),_0x5b2d60,'request\x20sent');logger[_0xa7ad('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5b2d60,'request\x20sent',JSON[_0xa7ad('0xf')](_0x2a5924));if(_0x2a5924[_0xa7ad('0x10')]){if(_0x2a5924[_0xa7ad('0x10')][_0xa7ad('0x11')]===0x1f4){logger[_0xa7ad('0x10')](_0xa7ad('0xd'),_0x5b2d60,_0x2a5924[_0xa7ad('0x10')][_0xa7ad('0x12')]);return _0x40753a(_0x2a5924[_0xa7ad('0x10')][_0xa7ad('0x12')]);}logger[_0xa7ad('0x10')](_0xa7ad('0xd'),_0x5b2d60,_0x2a5924[_0xa7ad('0x10')][_0xa7ad('0x12')]);return _0x234be2(_0x2a5924[_0xa7ad('0x10')][_0xa7ad('0x12')]);}else{logger['info'](_0xa7ad('0xd'),_0x5b2d60,_0xa7ad('0x13'));_0x234be2(_0x2a5924[_0xa7ad('0x14')][_0xa7ad('0x12')]);}})[_0xa7ad('0x15')](function(_0x5e9ce2){logger[_0xa7ad('0x10')](_0xa7ad('0xd'),_0x5b2d60,_0x5e9ce2);_0x40753a(_0x5e9ce2);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 8348204..036a934 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 _0x2af3=['connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','describe','get','show','post','create','put','update','delete','/:id','destroy','exports','multer','path'];(function(_0x4e24cc,_0x7a1b4f){var _0x1f2ef6=function(_0x11ae68){while(--_0x11ae68){_0x4e24cc['push'](_0x4e24cc['shift']());}};_0x1f2ef6(++_0x7a1b4f);}(_0x2af3,0xbc));var _0x32af=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0x2af3[_0xfcfc24];return _0x58f773;};'use strict';var multer=require(_0x32af('0x0'));var util=require('util');var path=require(_0x32af('0x1'));var timeout=require(_0x32af('0x2'));var express=require(_0x32af('0x3'));var router=express[_0x32af('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x32af('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0x32af('0x6')](),controller[_0x32af('0x7')]);router['get']('/describe',auth[_0x32af('0x6')](),controller[_0x32af('0x8')]);router[_0x32af('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x32af('0xa')]);router[_0x32af('0xb')]('/',auth[_0x32af('0x6')](),controller[_0x32af('0xc')]);router[_0x32af('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x32af('0xe')]);router[_0x32af('0xf')](_0x32af('0x10'),auth[_0x32af('0x6')](),controller[_0x32af('0x11')]);module[_0x32af('0x12')]=router; \ No newline at end of file +var _0x7122=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','util','path'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7122,0x13e));var _0x2712=function(_0x405884,_0x44e430){_0x405884=_0x405884-0x0;var _0x783983=_0x7122[_0x405884];return _0x783983;};'use strict';var multer=require('multer');var util=require(_0x2712('0x0'));var path=require(_0x2712('0x1'));var timeout=require(_0x2712('0x2'));var express=require(_0x2712('0x3'));var router=express[_0x2712('0x4')]();var auth=require(_0x2712('0x5'));var interaction=require(_0x2712('0x6'));var config=require('../../config/environment');var controller=require(_0x2712('0x7'));router[_0x2712('0x8')]('/',auth[_0x2712('0x9')](),controller[_0x2712('0xa')]);router[_0x2712('0x8')](_0x2712('0xb'),auth[_0x2712('0x9')](),controller[_0x2712('0xc')]);router[_0x2712('0x8')](_0x2712('0xd'),auth[_0x2712('0x9')](),controller[_0x2712('0xe')]);router[_0x2712('0xf')]('/',auth[_0x2712('0x9')](),controller[_0x2712('0x10')]);router['put'](_0x2712('0xd'),auth[_0x2712('0x9')](),controller[_0x2712('0x11')]);router[_0x2712('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2712('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 80809f1..293fff7 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 _0x19cd=['duration','talk:[start]','talk:[queue]','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x368952,_0x5f44ad){var _0x40e355=function(_0x547dfc){while(--_0x547dfc){_0x368952['push'](_0x368952['shift']());}};_0x40e355(++_0x5f44ad);}(_0x19cd,0x189));var _0xd19c=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x19cd[_0x3207aa];return _0x51758f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xd19c('0x0')]},'membername':{'type':Sequelize[_0xd19c('0x0')]},'interface':{'type':Sequelize[_0xd19c('0x0')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xd19c('0x1'),'comment':_0xd19c('0x2')},'duration':{'type':Sequelize[_0xd19c('0x3')]},'enterAt':{'type':Sequelize[_0xd19c('0x4')]},'exitAt':{'type':Sequelize[_0xd19c('0x4')],'set':function(_0x582fd5){var _0x2f0702=moment(_0x582fd5);var _0x2b8614=moment(this['getDataValue'](_0xd19c('0x5')));var _0x2e7476=_0x2f0702[_0xd19c('0x6')](_0x2b8614,_0xd19c('0x7'));this[_0xd19c('0x8')](_0xd19c('0x9'),_0x582fd5);this[_0xd19c('0x8')](_0xd19c('0xa'),_0x2e7476||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xd19c('0xb')},'data3':{'type':Sequelize[_0xd19c('0x0')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xd19c('0x0')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xd19c('0xc')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xd19c('0x3')]},'uniqueid':{'type':Sequelize[_0xd19c('0x0')]}}; \ No newline at end of file +var _0x5ff0=['talk:[queue]','INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[start]','talk:[dial\x20string]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ff0,0x1c2));var _0x05ff=function(_0x165a95,_0x2ad12f){_0x165a95=_0x165a95-0x0;var _0x3b193c=_0x5ff0[_0x165a95];return _0x3b193c;};'use strict';var Sequelize=require(_0x05ff('0x0'));var moment=require('moment');module[_0x05ff('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x05ff('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x05ff('0x3'),'comment':_0x05ff('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x05ff('0x5')]},'exitAt':{'type':Sequelize[_0x05ff('0x5')],'set':function(_0x359142){var _0x2bb341=moment(_0x359142);var _0x2ae549=moment(this[_0x05ff('0x6')](_0x05ff('0x7')));var _0x48f953=_0x2bb341[_0x05ff('0x8')](_0x2ae549,'seconds');this[_0x05ff('0x9')](_0x05ff('0xa'),_0x359142);this[_0x05ff('0x9')](_0x05ff('0xb'),_0x48f953||null);}},'data1':{'type':Sequelize[_0x05ff('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x05ff('0x2')],'comment':_0x05ff('0xc')},'data3':{'type':Sequelize[_0x05ff('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x05ff('0x2')],'comment':_0x05ff('0xd')},'data5':{'type':Sequelize[_0x05ff('0x2')],'comment':_0x05ff('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x05ff('0xf')]},'uniqueid':{'type':Sequelize[_0x05ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8d10a6e..c7b2818 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 _0x8f17=['order','sort','where','merge','VIRTUAL','filter','options','MemberReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x3ba5cf,_0x59b092){var _0x1359d8=function(_0x50c1c8){while(--_0x50c1c8){_0x3ba5cf['push'](_0x3ba5cf['shift']());}};_0x1359d8(++_0x59b092);}(_0x8f17,0xfb));var _0x78f1=function(_0x35245d,_0x193583){_0x35245d=_0x35245d-0x0;var _0x184a83=_0x8f17[_0x35245d];return _0x184a83;};'use strict';var pdf=require(_0x78f1('0x0'));var emlformat=require(_0x78f1('0x1'));var rimraf=require(_0x78f1('0x2'));var zipdir=require(_0x78f1('0x3'));var jsonpatch=require(_0x78f1('0x4'));var rp=require('request-promise');var moment=require(_0x78f1('0x5'));var BPromise=require(_0x78f1('0x6'));var Mustache=require(_0x78f1('0x7'));var util=require(_0x78f1('0x8'));var path=require(_0x78f1('0x9'));var sox=require(_0x78f1('0xa'));var csv=require(_0x78f1('0xb'));var ejs=require(_0x78f1('0xc'));var fs=require('fs');var _=require(_0x78f1('0xd'));var squel=require('squel');var crypto=require(_0x78f1('0xe'));var jsforce=require(_0x78f1('0xf'));var deskjs=require(_0x78f1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x78f1('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78f1('0x12'));var qs=require(_0x78f1('0x13'));var as=require(_0x78f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78f1('0x15'))(_0x78f1('0x16'));var utils=require(_0x78f1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x78f1('0x18'));var db=require(_0x78f1('0x19'))['db'];function respondWithStatusCode(_0x591f22,_0x31330f){_0x31330f=_0x31330f||0xcc;return function(_0x1bdda6){if(_0x1bdda6){return _0x591f22['sendStatus'](_0x31330f);}return _0x591f22[_0x78f1('0x1a')](_0x31330f)[_0x78f1('0x1b')]();};}function respondWithResult(_0x6bb77a,_0x574120){_0x574120=_0x574120||0xc8;return function(_0x59b733){if(_0x59b733){return _0x6bb77a[_0x78f1('0x1a')](_0x574120)[_0x78f1('0x1c')](_0x59b733);}};}function respondWithFilteredResult(_0x49b3c0,_0x52b858){return function(_0x8fcd09){if(_0x8fcd09){var _0x4ba13b=_0x8fcd09[_0x78f1('0x1d')],_0x3807e9=_0x52b858['offset'],_0x5108b6=_0x52b858[_0x78f1('0x1e')]+_0x52b858['limit'],_0x59f315;if(_0x5108b6>=_0x4ba13b){_0x5108b6=_0x4ba13b;_0x59f315=0xc8;}else{_0x59f315=0xce;}_0x49b3c0[_0x78f1('0x1a')](_0x59f315);return _0x49b3c0[_0x78f1('0x1f')](_0x78f1('0x20'),_0x3807e9+'-'+_0x5108b6+'/'+_0x4ba13b)[_0x78f1('0x1c')](_0x8fcd09);}return null;};}function patchUpdates(_0x315771){return function(_0x273a26){try{jsonpatch[_0x78f1('0x21')](_0x273a26,_0x315771,!![]);}catch(_0x2f790b){return BPromise[_0x78f1('0x22')](_0x2f790b);}return _0x273a26[_0x78f1('0x23')]();};}function saveUpdates(_0x2d5693,_0x588ddd){return function(_0x8e8db6){if(_0x8e8db6){return _0x8e8db6[_0x78f1('0x24')](_0x2d5693)[_0x78f1('0x25')](function(_0x1b57b5){return _0x1b57b5;});}return null;};}function removeEntity(_0x831230,_0x379ffc){return function(_0x253368){if(_0x253368){return _0x253368[_0x78f1('0x26')]()[_0x78f1('0x25')](function(){_0x831230[_0x78f1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x67ec00,_0x3c3bff){return function(_0x11b785){if(!_0x11b785){_0x67ec00[_0x78f1('0x27')](0x194);}return _0x11b785;};}function handleError(_0x2ca787,_0x3e6437){_0x3e6437=_0x3e6437||0x1f4;return function(_0x392127){logger[_0x78f1('0x28')](_0x392127[_0x78f1('0x29')]);if(_0x392127[_0x78f1('0x2a')]){delete _0x392127[_0x78f1('0x2a')];}_0x2ca787['status'](_0x3e6437)['send'](_0x392127);};}exports['index']=function(_0x2bf94f,_0x56f4ea){var _0x3a8d1e={},_0x368de1={},_0x306063={'count':0x0,'rows':[]};var _0x44ad8c=_[_0x78f1('0x2b')](db['MemberReport']['rawAttributes'],function(_0x59efcd){return{'name':_0x59efcd[_0x78f1('0x2c')],'type':_0x59efcd[_0x78f1('0x2d')]['key']};});_0x368de1[_0x78f1('0x2e')]=_['map'](_0x44ad8c,_0x78f1('0x2a'));_0x368de1[_0x78f1('0x2f')]=_[_0x78f1('0x30')](_0x2bf94f[_0x78f1('0x2f')]);_0x368de1[_0x78f1('0x31')]=_[_0x78f1('0x32')](_0x368de1[_0x78f1('0x2e')],_0x368de1[_0x78f1('0x2f')]);_0x3a8d1e['attributes']=_['intersection'](_0x368de1[_0x78f1('0x2e')],qs[_0x78f1('0x33')](_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x33')]));_0x3a8d1e[_0x78f1('0x34')]=_0x3a8d1e[_0x78f1('0x34')][_0x78f1('0x35')]?_0x3a8d1e[_0x78f1('0x34')]:_0x368de1[_0x78f1('0x2e')];if(!_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x36')](_0x78f1('0x37'))){_0x3a8d1e[_0x78f1('0x38')]=qs[_0x78f1('0x38')](_0x2bf94f[_0x78f1('0x2f')]['limit']);_0x3a8d1e[_0x78f1('0x1e')]=qs['offset'](_0x2bf94f[_0x78f1('0x2f')]['offset']);}_0x3a8d1e[_0x78f1('0x39')]=qs[_0x78f1('0x3a')](_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x3a')]);_0x3a8d1e[_0x78f1('0x3b')]=qs[_0x78f1('0x31')](_['pick'](_0x2bf94f['query'],_0x368de1[_0x78f1('0x31')]),_0x44ad8c);if(_0x2bf94f[_0x78f1('0x2f')]['filter']){_0x3a8d1e['where']=_[_0x78f1('0x3c')](_0x3a8d1e[_0x78f1('0x3b')],{'$or':_['map'](_0x44ad8c,function(_0xe804d4){if(_0xe804d4[_0x78f1('0x2d')]!==_0x78f1('0x3d')){var _0x2c413f={};_0x2c413f[_0xe804d4[_0x78f1('0x2a')]]={'$like':'%'+_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x3e')]+'%'};return _0x2c413f;}})});}_0x3a8d1e=_[_0x78f1('0x3c')]({},_0x3a8d1e,_0x2bf94f[_0x78f1('0x3f')]);var _0x19d6af={'where':_0x3a8d1e['where']};return db[_0x78f1('0x40')][_0x78f1('0x1d')](_0x19d6af)[_0x78f1('0x25')](function(_0x535553){_0x306063[_0x78f1('0x1d')]=_0x535553;if(_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x41')]){_0x3a8d1e[_0x78f1('0x42')]=[{'all':!![]}];}return db[_0x78f1('0x40')][_0x78f1('0x43')](_0x3a8d1e);})['then'](function(_0x2f7313){_0x306063[_0x78f1('0x44')]=_0x2f7313;return _0x306063;})[_0x78f1('0x25')](respondWithFilteredResult(_0x56f4ea,_0x3a8d1e))['catch'](handleError(_0x56f4ea,null));};exports[_0x78f1('0x45')]=function(_0x503c72,_0x29708d){var _0x54aaed={'raw':!![],'where':{'id':_0x503c72[_0x78f1('0x46')]['id']}},_0x4f2c47={};_0x4f2c47['model']=_[_0x78f1('0x30')](db[_0x78f1('0x40')][_0x78f1('0x47')]);_0x4f2c47[_0x78f1('0x2f')]=_['keys'](_0x503c72[_0x78f1('0x2f')]);_0x4f2c47['filters']=_[_0x78f1('0x32')](_0x4f2c47[_0x78f1('0x2e')],_0x4f2c47['query']);_0x54aaed[_0x78f1('0x34')]=_[_0x78f1('0x32')](_0x4f2c47[_0x78f1('0x2e')],qs[_0x78f1('0x33')](_0x503c72[_0x78f1('0x2f')][_0x78f1('0x33')]));_0x54aaed[_0x78f1('0x34')]=_0x54aaed[_0x78f1('0x34')]['length']?_0x54aaed['attributes']:_0x4f2c47[_0x78f1('0x2e')];if(_0x503c72[_0x78f1('0x2f')][_0x78f1('0x41')]){_0x54aaed[_0x78f1('0x42')]=[{'all':!![]}];}_0x54aaed=_[_0x78f1('0x3c')]({},_0x54aaed,_0x503c72[_0x78f1('0x3f')]);return db[_0x78f1('0x40')][_0x78f1('0x48')](_0x54aaed)[_0x78f1('0x25')](handleEntityNotFound(_0x29708d,null))['then'](respondWithResult(_0x29708d,null))[_0x78f1('0x49')](handleError(_0x29708d,null));};exports[_0x78f1('0x4a')]=function(_0x4b91c0,_0x960b3d){return db['MemberReport']['create'](_0x4b91c0['body'],{})[_0x78f1('0x25')](respondWithResult(_0x960b3d,0xc9))[_0x78f1('0x49')](handleError(_0x960b3d,null));};exports['update']=function(_0x50a589,_0x4d6e7b){if(_0x50a589[_0x78f1('0x4b')]['id']){delete _0x50a589[_0x78f1('0x4b')]['id'];}return db['MemberReport'][_0x78f1('0x48')]({'where':{'id':_0x50a589[_0x78f1('0x46')]['id']}})[_0x78f1('0x25')](handleEntityNotFound(_0x4d6e7b,null))[_0x78f1('0x25')](saveUpdates(_0x50a589[_0x78f1('0x4b')],null))['then'](respondWithResult(_0x4d6e7b,null))[_0x78f1('0x49')](handleError(_0x4d6e7b,null));};exports[_0x78f1('0x26')]=function(_0x586c2c,_0x36972b){return db['MemberReport'][_0x78f1('0x48')]({'where':{'id':_0x586c2c[_0x78f1('0x46')]['id']}})[_0x78f1('0x25')](handleEntityNotFound(_0x36972b,null))[_0x78f1('0x25')](removeEntity(_0x36972b,null))[_0x78f1('0x49')](handleError(_0x36972b,null));};exports[_0x78f1('0x4c')]=function(_0x191de1,_0x387549){return db[_0x78f1('0x40')]['describe']()[_0x78f1('0x25')](respondWithResult(_0x387549,null))[_0x78f1('0x49')](handleError(_0x387549,null));}; \ No newline at end of file +var _0xf613=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','update','then','destroy','name','index','map','MemberReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3d9e75,_0x5e6afd){var _0x1beedb=function(_0x117ef9){while(--_0x117ef9){_0x3d9e75['push'](_0x3d9e75['shift']());}};_0x1beedb(++_0x5e6afd);}(_0xf613,0xb5));var _0x3f61=function(_0x24b0ab,_0x19de60){_0x24b0ab=_0x24b0ab-0x0;var _0x12112c=_0xf613[_0x24b0ab];return _0x12112c;};'use strict';var pdf=require(_0x3f61('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f61('0x2'));var rp=require(_0x3f61('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f61('0x4'));var util=require(_0x3f61('0x5'));var path=require('path');var sox=require(_0x3f61('0x6'));var csv=require(_0x3f61('0x7'));var ejs=require(_0x3f61('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f61('0x9'));var jsforce=require(_0x3f61('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3f61('0x7'));var querystring=require('querystring');var Papa=require(_0x3f61('0xb'));var Redis=require('ioredis');var authService=require(_0x3f61('0xc'));var qs=require(_0x3f61('0xd'));var as=require(_0x3f61('0xe'));var hardwareService=require(_0x3f61('0xf'));var logger=require(_0x3f61('0x10'))(_0x3f61('0x11'));var utils=require(_0x3f61('0x12'));var config=require(_0x3f61('0x13'));var licenseUtil=require(_0x3f61('0x14'));var db=require(_0x3f61('0x15'))['db'];function respondWithStatusCode(_0x1f4c25,_0x6b224d){_0x6b224d=_0x6b224d||0xcc;return function(_0x42f70a){if(_0x42f70a){return _0x1f4c25[_0x3f61('0x16')](_0x6b224d);}return _0x1f4c25['status'](_0x6b224d)[_0x3f61('0x17')]();};}function respondWithResult(_0x2062ec,_0x51c179){_0x51c179=_0x51c179||0xc8;return function(_0x47502b){if(_0x47502b){return _0x2062ec[_0x3f61('0x18')](_0x51c179)[_0x3f61('0x19')](_0x47502b);}};}function respondWithFilteredResult(_0xe09527,_0x3951e6){return function(_0x9031fb){if(_0x9031fb){var _0x1a9160=_0x9031fb[_0x3f61('0x1a')],_0x281020=_0x3951e6[_0x3f61('0x1b')],_0x1651fc=_0x3951e6[_0x3f61('0x1b')]+_0x3951e6['limit'],_0x2683da;if(_0x1651fc>=_0x1a9160){_0x1651fc=_0x1a9160;_0x2683da=0xc8;}else{_0x2683da=0xce;}_0xe09527['status'](_0x2683da);return _0xe09527[_0x3f61('0x1c')]('Content-Range',_0x281020+'-'+_0x1651fc+'/'+_0x1a9160)['json'](_0x9031fb);}return null;};}function patchUpdates(_0x15a936){return function(_0x137304){try{jsonpatch['apply'](_0x137304,_0x15a936,!![]);}catch(_0x138f13){return BPromise['reject'](_0x138f13);}return _0x137304['save']();};}function saveUpdates(_0x5643f8,_0x43f046){return function(_0x4baa25){if(_0x4baa25){return _0x4baa25[_0x3f61('0x1d')](_0x5643f8)[_0x3f61('0x1e')](function(_0x2a8571){return _0x2a8571;});}return null;};}function removeEntity(_0x2ba3c0,_0x3aec5d){return function(_0x3bb438){if(_0x3bb438){return _0x3bb438[_0x3f61('0x1f')]()['then'](function(){_0x2ba3c0[_0x3f61('0x18')](0xcc)[_0x3f61('0x17')]();});}};}function handleEntityNotFound(_0xce9009,_0x439edd){return function(_0x12b2f7){if(!_0x12b2f7){_0xce9009[_0x3f61('0x16')](0x194);}return _0x12b2f7;};}function handleError(_0x33a742,_0x1cad92){_0x1cad92=_0x1cad92||0x1f4;return function(_0x37ef0d){logger['error'](_0x37ef0d['stack']);if(_0x37ef0d['name']){delete _0x37ef0d[_0x3f61('0x20')];}_0x33a742[_0x3f61('0x18')](_0x1cad92)['send'](_0x37ef0d);};}exports[_0x3f61('0x21')]=function(_0x3df658,_0x2b137b){var _0xc416c2={},_0x2b08cc={},_0x273a7c={'count':0x0,'rows':[]};var _0x3192e4=_[_0x3f61('0x22')](db[_0x3f61('0x23')][_0x3f61('0x24')],function(_0x465ad3){return{'name':_0x465ad3['fieldName'],'type':_0x465ad3['type'][_0x3f61('0x25')]};});_0x2b08cc['model']=_[_0x3f61('0x22')](_0x3192e4,_0x3f61('0x20'));_0x2b08cc[_0x3f61('0x26')]=_[_0x3f61('0x27')](_0x3df658[_0x3f61('0x26')]);_0x2b08cc[_0x3f61('0x28')]=_[_0x3f61('0x29')](_0x2b08cc[_0x3f61('0x2a')],_0x2b08cc[_0x3f61('0x26')]);_0xc416c2['attributes']=_['intersection'](_0x2b08cc[_0x3f61('0x2a')],qs['fields'](_0x3df658[_0x3f61('0x26')]['fields']));_0xc416c2[_0x3f61('0x2b')]=_0xc416c2[_0x3f61('0x2b')][_0x3f61('0x2c')]?_0xc416c2[_0x3f61('0x2b')]:_0x2b08cc[_0x3f61('0x2a')];if(!_0x3df658[_0x3f61('0x26')][_0x3f61('0x2d')](_0x3f61('0x2e'))){_0xc416c2[_0x3f61('0x2f')]=qs[_0x3f61('0x2f')](_0x3df658['query'][_0x3f61('0x2f')]);_0xc416c2[_0x3f61('0x1b')]=qs[_0x3f61('0x1b')](_0x3df658[_0x3f61('0x26')]['offset']);}_0xc416c2['order']=qs['sort'](_0x3df658['query'][_0x3f61('0x30')]);_0xc416c2[_0x3f61('0x31')]=qs['filters'](_[_0x3f61('0x32')](_0x3df658[_0x3f61('0x26')],_0x2b08cc[_0x3f61('0x28')]),_0x3192e4);if(_0x3df658[_0x3f61('0x26')][_0x3f61('0x33')]){_0xc416c2['where']=_[_0x3f61('0x34')](_0xc416c2[_0x3f61('0x31')],{'$or':_[_0x3f61('0x22')](_0x3192e4,function(_0x40b559){if(_0x40b559['type']!==_0x3f61('0x35')){var _0xaf6cd4={};_0xaf6cd4[_0x40b559[_0x3f61('0x20')]]={'$like':'%'+_0x3df658['query'][_0x3f61('0x33')]+'%'};return _0xaf6cd4;}})});}_0xc416c2=_[_0x3f61('0x34')]({},_0xc416c2,_0x3df658[_0x3f61('0x36')]);var _0x5e2855={'where':_0xc416c2[_0x3f61('0x31')]};return db[_0x3f61('0x23')][_0x3f61('0x1a')](_0x5e2855)['then'](function(_0x1c91f5){_0x273a7c[_0x3f61('0x1a')]=_0x1c91f5;if(_0x3df658[_0x3f61('0x26')][_0x3f61('0x37')]){_0xc416c2[_0x3f61('0x38')]=[{'all':!![]}];}return db[_0x3f61('0x23')][_0x3f61('0x39')](_0xc416c2);})[_0x3f61('0x1e')](function(_0x1e08fb){_0x273a7c[_0x3f61('0x3a')]=_0x1e08fb;return _0x273a7c;})[_0x3f61('0x1e')](respondWithFilteredResult(_0x2b137b,_0xc416c2))[_0x3f61('0x3b')](handleError(_0x2b137b,null));};exports[_0x3f61('0x3c')]=function(_0x416352,_0x1afed0){var _0x293003={'raw':!![],'where':{'id':_0x416352[_0x3f61('0x3d')]['id']}},_0x3ee2ed={};_0x3ee2ed[_0x3f61('0x2a')]=_[_0x3f61('0x27')](db[_0x3f61('0x23')][_0x3f61('0x24')]);_0x3ee2ed[_0x3f61('0x26')]=_[_0x3f61('0x27')](_0x416352[_0x3f61('0x26')]);_0x3ee2ed[_0x3f61('0x28')]=_[_0x3f61('0x29')](_0x3ee2ed[_0x3f61('0x2a')],_0x3ee2ed[_0x3f61('0x26')]);_0x293003[_0x3f61('0x2b')]=_['intersection'](_0x3ee2ed['model'],qs[_0x3f61('0x3e')](_0x416352['query']['fields']));_0x293003[_0x3f61('0x2b')]=_0x293003[_0x3f61('0x2b')]['length']?_0x293003[_0x3f61('0x2b')]:_0x3ee2ed[_0x3f61('0x2a')];if(_0x416352[_0x3f61('0x26')]['includeAll']){_0x293003['include']=[{'all':!![]}];}_0x293003=_[_0x3f61('0x34')]({},_0x293003,_0x416352[_0x3f61('0x36')]);return db['MemberReport'][_0x3f61('0x3f')](_0x293003)[_0x3f61('0x1e')](handleEntityNotFound(_0x1afed0,null))['then'](respondWithResult(_0x1afed0,null))[_0x3f61('0x3b')](handleError(_0x1afed0,null));};exports[_0x3f61('0x40')]=function(_0x164278,_0x485bc8){return db[_0x3f61('0x23')][_0x3f61('0x40')](_0x164278['body'],{})['then'](respondWithResult(_0x485bc8,0xc9))[_0x3f61('0x3b')](handleError(_0x485bc8,null));};exports[_0x3f61('0x1d')]=function(_0x343d2e,_0x49e6dd){if(_0x343d2e[_0x3f61('0x41')]['id']){delete _0x343d2e[_0x3f61('0x41')]['id'];}return db[_0x3f61('0x23')][_0x3f61('0x3f')]({'where':{'id':_0x343d2e[_0x3f61('0x3d')]['id']}})[_0x3f61('0x1e')](handleEntityNotFound(_0x49e6dd,null))[_0x3f61('0x1e')](saveUpdates(_0x343d2e[_0x3f61('0x41')],null))[_0x3f61('0x1e')](respondWithResult(_0x49e6dd,null))['catch'](handleError(_0x49e6dd,null));};exports[_0x3f61('0x1f')]=function(_0x4de048,_0x2d0f2c){return db['MemberReport'][_0x3f61('0x3f')]({'where':{'id':_0x4de048[_0x3f61('0x3d')]['id']}})[_0x3f61('0x1e')](handleEntityNotFound(_0x2d0f2c,null))['then'](removeEntity(_0x2d0f2c,null))[_0x3f61('0x3b')](handleError(_0x2d0f2c,null));};exports[_0x3f61('0x42')]=function(_0x339990,_0x47ee8c){return db['MemberReport'][_0x3f61('0x42')]()[_0x3f61('0x1e')](respondWithResult(_0x47ee8c,null))[_0x3f61('0x3b')](handleError(_0x47ee8c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1d7edb7..f689f42 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 _0x1d69=['request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird'];(function(_0x38eaa6,_0x169ebb){var _0x2201ac=function(_0x27ddbb){while(--_0x27ddbb){_0x38eaa6['push'](_0x38eaa6['shift']());}};_0x2201ac(++_0x169ebb);}(_0x1d69,0x154));var _0x91d6=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x1d69[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x91d6('0x0'));var util=require(_0x91d6('0x1'));var logger=require(_0x91d6('0x2'))('api');var moment=require(_0x91d6('0x3'));var BPromise=require(_0x91d6('0x4'));var rp=require(_0x91d6('0x5'));var fs=require('fs');var path=require(_0x91d6('0x6'));var rimraf=require('rimraf');var config=require(_0x91d6('0x7'));var attributes=require(_0x91d6('0x8'));module[_0x91d6('0x9')]=function(_0x1fcfa2,_0x2796d1){return _0x1fcfa2[_0x91d6('0xa')]('MemberReport',attributes,{'tableName':_0x91d6('0xb'),'paranoid':![],'indexes':[{'name':_0x91d6('0xc'),'fields':[_0x91d6('0xd'),_0x91d6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x37b0=['membername_interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MemberReport'];(function(_0x2a89a1,_0x36fecc){var _0x49f6d8=function(_0x3d93fe){while(--_0x3d93fe){_0x2a89a1['push'](_0x2a89a1['shift']());}};_0x49f6d8(++_0x36fecc);}(_0x37b0,0xcd));var _0x037b=function(_0x1c2aeb,_0x48433c){_0x1c2aeb=_0x1c2aeb-0x0;var _0x783379=_0x37b0[_0x1c2aeb];return _0x783379;};'use strict';var _=require(_0x037b('0x0'));var util=require('util');var logger=require(_0x037b('0x1'))(_0x037b('0x2'));var moment=require(_0x037b('0x3'));var BPromise=require(_0x037b('0x4'));var rp=require(_0x037b('0x5'));var fs=require('fs');var path=require(_0x037b('0x6'));var rimraf=require('rimraf');var config=require(_0x037b('0x7'));var attributes=require('./memberReport.attributes');module[_0x037b('0x8')]=function(_0x38ece6,_0x5bec18){return _0x38ece6[_0x037b('0x9')](_0x037b('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x037b('0xb'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 70acadc..7a64f33 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 _0xe808=['model','CreateMemberReport','create','where','UpdateMemberReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','options','raw','attributes','limit','include','map'];(function(_0xe5da34,_0x1b0c8e){var _0x215d81=function(_0x43d164){while(--_0x43d164){_0xe5da34['push'](_0xe5da34['shift']());}};_0x215d81(++_0x1b0c8e);}(_0xe808,0x108));var _0x8e80=function(_0x507967,_0x57f126){_0x507967=_0x507967-0x0;var _0x1285a9=_0xe808[_0x507967];return _0x1285a9;};'use strict';var _=require(_0x8e80('0x0'));var util=require('util');var moment=require(_0x8e80('0x1'));var BPromise=require(_0x8e80('0x2'));var rs=require(_0x8e80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e80('0x4'))['db'];var utils=require(_0x8e80('0x5'));var logger=require(_0x8e80('0x6'))(_0x8e80('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e80('0x8'));var client=jayson[_0x8e80('0x9')][_0x8e80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aaadd,_0x18e8dd,_0x2ea8b6){return new BPromise(function(_0x5da673,_0x2d1084){return client[_0x8e80('0xb')](_0x4aaadd,_0x2ea8b6)[_0x8e80('0xc')](function(_0x2fc728){logger[_0x8e80('0xd')](_0x8e80('0xe'),_0x18e8dd,_0x8e80('0xf'));logger[_0x8e80('0x10')](_0x8e80('0x11'),_0x18e8dd,'request\x20sent',JSON[_0x8e80('0x12')](_0x2fc728));if(_0x2fc728['error']){if(_0x2fc728[_0x8e80('0x13')][_0x8e80('0x14')]===0x1f4){logger['error'](_0x8e80('0xe'),_0x18e8dd,_0x2fc728[_0x8e80('0x13')][_0x8e80('0x15')]);return _0x2d1084(_0x2fc728[_0x8e80('0x13')][_0x8e80('0x15')]);}logger['error'](_0x8e80('0xe'),_0x18e8dd,_0x2fc728[_0x8e80('0x13')]['message']);return _0x5da673(_0x2fc728['error'][_0x8e80('0x15')]);}else{logger['info'](_0x8e80('0xe'),_0x18e8dd,'request\x20sent');_0x5da673(_0x2fc728[_0x8e80('0x16')][_0x8e80('0x15')]);}})[_0x8e80('0x17')](function(_0x3513e8){logger['error']('MemberReport,\x20%s,\x20%s',_0x18e8dd,_0x3513e8);_0x2d1084(_0x3513e8);});});}exports[_0x8e80('0x18')]=function(_0x170c35){var _0x47f273=this;return new Promise(function(_0x59a352,_0x534183){return db[_0x8e80('0x19')]['findAll']({'raw':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1b')]===undefined?!![]:![]:!![],'where':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')]['where']||null:null,'attributes':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1c')]||null:null,'limit':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1d')]||null:null,'include':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1e')]?_[_0x8e80('0x1f')](_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1e')],function(_0x3227c8){return{'model':db[_0x3227c8[_0x8e80('0x20')]],'as':_0x3227c8['as'],'attributes':_0x3227c8[_0x8e80('0x1c')],'include':_0x3227c8[_0x8e80('0x1e')]?_['map'](_0x3227c8[_0x8e80('0x1e')],function(_0x1dd6c2){return{'model':db[_0x1dd6c2[_0x8e80('0x20')]],'as':_0x1dd6c2['as'],'attributes':_0x1dd6c2[_0x8e80('0x1c')],'include':_0x1dd6c2[_0x8e80('0x1e')]?_[_0x8e80('0x1f')](_0x1dd6c2[_0x8e80('0x1e')],function(_0x45072f){return{'model':db[_0x45072f['model']],'as':_0x45072f['as'],'attributes':_0x45072f[_0x8e80('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8e80('0xc')](function(_0x3c80e5){logger[_0x8e80('0xd')](_0x8e80('0x18'),_0x170c35);logger['debug'](_0x8e80('0x18'),_0x170c35,JSON[_0x8e80('0x12')](_0x3c80e5));_0x59a352(_0x3c80e5);})[_0x8e80('0x17')](function(_0x2e1509){logger[_0x8e80('0x13')](_0x8e80('0x18'),_0x2e1509[_0x8e80('0x15')],_0x170c35);_0x534183(_0x47f273[_0x8e80('0x13')](0x1f4,_0x2e1509['message']));});});};exports[_0x8e80('0x21')]=function(_0x5e23e0){var _0x1aef34=this;return new Promise(function(_0x4075bc,_0x31fa86){return db[_0x8e80('0x19')][_0x8e80('0x22')](_0x5e23e0['body'],{'raw':_0x5e23e0[_0x8e80('0x1a')]?_0x5e23e0[_0x8e80('0x1a')][_0x8e80('0x1b')]===undefined?!![]:![]:!![]})[_0x8e80('0xc')](function(_0x180c0e){logger['info'](_0x8e80('0x21'),_0x5e23e0);logger[_0x8e80('0x10')](_0x8e80('0x21'),_0x5e23e0,JSON[_0x8e80('0x12')](_0x180c0e));_0x4075bc(_0x180c0e);})[_0x8e80('0x17')](function(_0x3dcb45){logger[_0x8e80('0x13')](_0x8e80('0x21'),_0x3dcb45[_0x8e80('0x15')],_0x5e23e0);_0x31fa86(_0x1aef34['error'](0x1f4,_0x3dcb45['message']));});});};exports['UpdateMemberReport']=function(_0x40d774){var _0x207a11=this;return new Promise(function(_0x3f9a9c,_0x5acb51){return db[_0x8e80('0x19')]['update'](_0x40d774['body'],{'raw':_0x40d774['options']?_0x40d774[_0x8e80('0x1a')][_0x8e80('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40d774['options']?_0x40d774['options'][_0x8e80('0x23')]||null:null,'attributes':_0x40d774[_0x8e80('0x1a')]?_0x40d774[_0x8e80('0x1a')][_0x8e80('0x1c')]||null:null,'limit':_0x40d774[_0x8e80('0x1a')]?_0x40d774[_0x8e80('0x1a')]['limit']||null:null})[_0x8e80('0xc')](function(_0x31c87c){logger[_0x8e80('0xd')](_0x8e80('0x24'),_0x40d774);logger['debug'](_0x8e80('0x24'),_0x40d774,JSON[_0x8e80('0x12')](_0x31c87c));_0x3f9a9c(_0x31c87c);})[_0x8e80('0x17')](function(_0x33bb8e){logger['error'](_0x8e80('0x24'),_0x33bb8e[_0x8e80('0x15')],_0x40d774);_0x5acb51(_0x207a11[_0x8e80('0x13')](0x1f4,_0x33bb8e[_0x8e80('0x15')]));});});}; \ No newline at end of file +var _0x916f=['message','info','result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateMemberReport','MemberReport','create','body','then','update','UpdateMemberReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0x916f,0x175));var _0xf916=function(_0x581c60,_0x371c9c){_0x581c60=_0x581c60-0x0;var _0x131aaf=_0x916f[_0x581c60];return _0x131aaf;};'use strict';var _=require(_0xf916('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf916('0x1'));var rs=require(_0xf916('0x2'));var fs=require('fs');var Redis=require(_0xf916('0x3'));var db=require(_0xf916('0x4'))['db'];var utils=require(_0xf916('0x5'));var logger=require(_0xf916('0x6'))(_0xf916('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf916('0x8')][_0xf916('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d1ff8,_0x1b86f1,_0x792024){return new BPromise(function(_0x279e41,_0x31464e){return client[_0xf916('0xa')](_0x1d1ff8,_0x792024)['then'](function(_0x34f657){logger['info'](_0xf916('0xb'),_0x1b86f1,'request\x20sent');logger[_0xf916('0xc')](_0xf916('0xd'),_0x1b86f1,_0xf916('0xe'),JSON['stringify'](_0x34f657));if(_0x34f657['error']){if(_0x34f657['error'][_0xf916('0xf')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x1b86f1,_0x34f657['error']['message']);return _0x31464e(_0x34f657[_0xf916('0x10')][_0xf916('0x11')]);}logger['error'](_0xf916('0xb'),_0x1b86f1,_0x34f657[_0xf916('0x10')][_0xf916('0x11')]);return _0x279e41(_0x34f657[_0xf916('0x10')][_0xf916('0x11')]);}else{logger[_0xf916('0x12')](_0xf916('0xb'),_0x1b86f1,'request\x20sent');_0x279e41(_0x34f657[_0xf916('0x13')][_0xf916('0x11')]);}})[_0xf916('0x14')](function(_0x3d279b){logger[_0xf916('0x10')](_0xf916('0xb'),_0x1b86f1,_0x3d279b);_0x31464e(_0x3d279b);});});}exports[_0xf916('0x15')]=function(_0x42b499){var _0x1082b1=this;return new Promise(function(_0x1039db,_0x3b60b5){return db['MemberReport'][_0xf916('0x16')]({'raw':_0x42b499[_0xf916('0x17')]?_0x42b499[_0xf916('0x17')][_0xf916('0x18')]===undefined?!![]:![]:!![],'where':_0x42b499[_0xf916('0x17')]?_0x42b499[_0xf916('0x17')][_0xf916('0x19')]||null:null,'attributes':_0x42b499['options']?_0x42b499[_0xf916('0x17')][_0xf916('0x1a')]||null:null,'limit':_0x42b499[_0xf916('0x17')]?_0x42b499['options'][_0xf916('0x1b')]||null:null,'include':_0x42b499['options']?_0x42b499[_0xf916('0x17')][_0xf916('0x1c')]?_[_0xf916('0x1d')](_0x42b499[_0xf916('0x17')][_0xf916('0x1c')],function(_0x868381){return{'model':db[_0x868381[_0xf916('0x1e')]],'as':_0x868381['as'],'attributes':_0x868381[_0xf916('0x1a')],'include':_0x868381[_0xf916('0x1c')]?_[_0xf916('0x1d')](_0x868381['include'],function(_0x31b544){return{'model':db[_0x31b544['model']],'as':_0x31b544['as'],'attributes':_0x31b544[_0xf916('0x1a')],'include':_0x31b544[_0xf916('0x1c')]?_[_0xf916('0x1d')](_0x31b544[_0xf916('0x1c')],function(_0x512a43){return{'model':db[_0x512a43[_0xf916('0x1e')]],'as':_0x512a43['as'],'attributes':_0x512a43[_0xf916('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a0c8a){logger[_0xf916('0x12')](_0xf916('0x15'),_0x42b499);logger[_0xf916('0xc')](_0xf916('0x15'),_0x42b499,JSON[_0xf916('0x1f')](_0x5a0c8a));_0x1039db(_0x5a0c8a);})[_0xf916('0x14')](function(_0x2c3727){logger[_0xf916('0x10')](_0xf916('0x15'),_0x2c3727['message'],_0x42b499);_0x3b60b5(_0x1082b1[_0xf916('0x10')](0x1f4,_0x2c3727[_0xf916('0x11')]));});});};exports[_0xf916('0x20')]=function(_0x1eaa3d){var _0x584ddc=this;return new Promise(function(_0x585599,_0x56b687){return db[_0xf916('0x21')][_0xf916('0x22')](_0x1eaa3d[_0xf916('0x23')],{'raw':_0x1eaa3d['options']?_0x1eaa3d[_0xf916('0x17')][_0xf916('0x18')]===undefined?!![]:![]:!![]})[_0xf916('0x24')](function(_0x3e3488){logger[_0xf916('0x12')]('CreateMemberReport',_0x1eaa3d);logger[_0xf916('0xc')](_0xf916('0x20'),_0x1eaa3d,JSON[_0xf916('0x1f')](_0x3e3488));_0x585599(_0x3e3488);})['catch'](function(_0x55d9d8){logger['error'](_0xf916('0x20'),_0x55d9d8['message'],_0x1eaa3d);_0x56b687(_0x584ddc[_0xf916('0x10')](0x1f4,_0x55d9d8[_0xf916('0x11')]));});});};exports['UpdateMemberReport']=function(_0x54e1dc){var _0x2a5434=this;return new Promise(function(_0x5504e3,_0x69d171){return db[_0xf916('0x21')][_0xf916('0x25')](_0x54e1dc[_0xf916('0x23')],{'raw':_0x54e1dc[_0xf916('0x17')]?_0x54e1dc['options'][_0xf916('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54e1dc['options']?_0x54e1dc[_0xf916('0x17')]['where']||null:null,'attributes':_0x54e1dc[_0xf916('0x17')]?_0x54e1dc[_0xf916('0x17')]['attributes']||null:null,'limit':_0x54e1dc['options']?_0x54e1dc[_0xf916('0x17')]['limit']||null:null})[_0xf916('0x24')](function(_0x2ec8e3){logger['info']('UpdateMemberReport',_0x54e1dc);logger[_0xf916('0xc')](_0xf916('0x26'),_0x54e1dc,JSON[_0xf916('0x1f')](_0x2ec8e3));_0x5504e3(_0x2ec8e3);})['catch'](function(_0x28b17c){logger[_0xf916('0x10')](_0xf916('0x26'),_0x28b17c[_0xf916('0x11')],_0x54e1dc);_0x69d171(_0x2a5434['error'](0x1f4,_0x28b17c['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2fa6247..06b6e7e 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 _0xb7e7=['./migration.controller','get','multer','path','express','../../components/auth/service','../../config/environment'];(function(_0x2cd38a,_0x23833a){var _0x3ea56c=function(_0x29d391){while(--_0x29d391){_0x2cd38a['push'](_0x2cd38a['shift']());}};_0x3ea56c(++_0x23833a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'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')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x0bb5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x0bb5,0x148));var _0x50bb=function(_0x4c997a,_0x587507){_0x4c997a=_0x4c997a-0x0;var _0x43da25=_0x0bb5[_0x4c997a];return _0x43da25;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var auth=require(_0x50bb('0x4'));var interaction=require(_0x50bb('0x5'));var config=require(_0x50bb('0x6'));var controller=require(_0x50bb('0x7'));router[_0x50bb('0x8')]('/',controller[_0x50bb('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4a8450e..f14b3d8 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 _0xdafb=['exports','STRING','version'];(function(_0x172012,_0x2cdb3d){var _0x1e529a=function(_0x5e0e35){while(--_0x5e0e35){_0x172012['push'](_0x172012['shift']());}};_0x1e529a(++_0x2cdb3d);}(_0xdafb,0x192));var _0xbdaf=function(_0xa965d5,_0x4b0610){_0xa965d5=_0xa965d5-0x0;var _0x8ce43c=_0xdafb[_0xa965d5];return _0x8ce43c;};'use strict';var Sequelize=require('sequelize');module[_0xbdaf('0x0')]={'version':{'type':Sequelize[_0xbdaf('0x1')],'unique':_0xbdaf('0x2')}}; \ No newline at end of file +var _0x5462=['version','exports'];(function(_0x5dde8,_0x435ab6){var _0x4d2161=function(_0x124797){while(--_0x124797){_0x5dde8['push'](_0x5dde8['shift']());}};_0x4d2161(++_0x435ab6);}(_0x5462,0x135));var _0x2546=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x5462[_0xd0cd0b];return _0x59cced;};'use strict';var Sequelize=require('sequelize');module[_0x2546('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x2546('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 5e5fb0f..931ff98 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 _0xfe0d=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','Migration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e17a5,_0x17bd81){var _0x16ab9c=function(_0x44bdcb){while(--_0x44bdcb){_0x4e17a5['push'](_0x4e17a5['shift']());}};_0x16ab9c(++_0x17bd81);}(_0xfe0d,0xee));var _0xdfe0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfe0d[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0xdfe0('0x0'));var emlformat=require(_0xdfe0('0x1'));var rimraf=require(_0xdfe0('0x2'));var zipdir=require(_0xdfe0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfe0('0x4'));var moment=require('moment');var BPromise=require(_0xdfe0('0x5'));var Mustache=require(_0xdfe0('0x6'));var util=require('util');var path=require(_0xdfe0('0x7'));var sox=require(_0xdfe0('0x8'));var csv=require(_0xdfe0('0x9'));var ejs=require(_0xdfe0('0xa'));var fs=require('fs');var _=require(_0xdfe0('0xb'));var squel=require(_0xdfe0('0xc'));var crypto=require(_0xdfe0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdfe0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdfe0('0xf'));var Redis=require('ioredis');var authService=require(_0xdfe0('0x10'));var qs=require(_0xdfe0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfe0('0x12'));var logger=require(_0xdfe0('0x13'))('api');var utils=require(_0xdfe0('0x14'));var config=require(_0xdfe0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4efaa9,_0x413670){_0x413670=_0x413670||0xcc;return function(_0x28a7c4){if(_0x28a7c4){return _0x4efaa9[_0xdfe0('0x16')](_0x413670);}return _0x4efaa9[_0xdfe0('0x17')](_0x413670)[_0xdfe0('0x18')]();};}function respondWithResult(_0x4ba274,_0x377993){_0x377993=_0x377993||0xc8;return function(_0xddc8ea){if(_0xddc8ea){return _0x4ba274['status'](_0x377993)[_0xdfe0('0x19')](_0xddc8ea);}};}function respondWithFilteredResult(_0x5a586f,_0x18e782){return function(_0x37d1d5){if(_0x37d1d5){var _0x36efac=_0x37d1d5[_0xdfe0('0x1a')],_0x2e21d6=_0x18e782['offset'],_0x4e3d7a=_0x18e782[_0xdfe0('0x1b')]+_0x18e782[_0xdfe0('0x1c')],_0x38ef16;if(_0x4e3d7a>=_0x36efac){_0x4e3d7a=_0x36efac;_0x38ef16=0xc8;}else{_0x38ef16=0xce;}_0x5a586f['status'](_0x38ef16);return _0x5a586f[_0xdfe0('0x1d')](_0xdfe0('0x1e'),_0x2e21d6+'-'+_0x4e3d7a+'/'+_0x36efac)[_0xdfe0('0x19')](_0x37d1d5);}return null;};}function patchUpdates(_0x432fd3){return function(_0x53a24f){try{jsonpatch[_0xdfe0('0x1f')](_0x53a24f,_0x432fd3,!![]);}catch(_0x23d9f8){return BPromise[_0xdfe0('0x20')](_0x23d9f8);}return _0x53a24f[_0xdfe0('0x21')]();};}function saveUpdates(_0x2e1493,_0x5dc5ae){return function(_0x4a7ecc){if(_0x4a7ecc){return _0x4a7ecc[_0xdfe0('0x22')](_0x2e1493)[_0xdfe0('0x23')](function(_0x30c71e){return _0x30c71e;});}return null;};}function removeEntity(_0x1f4211,_0x2b3c53){return function(_0x27db43){if(_0x27db43){return _0x27db43[_0xdfe0('0x24')]()[_0xdfe0('0x23')](function(){_0x1f4211[_0xdfe0('0x17')](0xcc)[_0xdfe0('0x18')]();});}};}function handleEntityNotFound(_0x4ee07b,_0x27b37a){return function(_0x5a3fe5){if(!_0x5a3fe5){_0x4ee07b[_0xdfe0('0x16')](0x194);}return _0x5a3fe5;};}function handleError(_0x3968f5,_0x257ab2){_0x257ab2=_0x257ab2||0x1f4;return function(_0x18be87){logger['error'](_0x18be87[_0xdfe0('0x25')]);if(_0x18be87['name']){delete _0x18be87['name'];}_0x3968f5['status'](_0x257ab2)[_0xdfe0('0x26')](_0x18be87);};}exports[_0xdfe0('0x27')]=function(_0x30fdfc,_0x56e24e){var _0x120883={},_0x5004d8={},_0x3cd868={'count':0x0,'rows':[]};var _0x54b792=_[_0xdfe0('0x28')](db[_0xdfe0('0x29')][_0xdfe0('0x2a')],function(_0x1493c3){return{'name':_0x1493c3[_0xdfe0('0x2b')],'type':_0x1493c3[_0xdfe0('0x2c')][_0xdfe0('0x2d')]};});_0x5004d8[_0xdfe0('0x2e')]=_[_0xdfe0('0x28')](_0x54b792,_0xdfe0('0x2f'));_0x5004d8[_0xdfe0('0x30')]=_[_0xdfe0('0x31')](_0x30fdfc[_0xdfe0('0x30')]);_0x5004d8[_0xdfe0('0x32')]=_[_0xdfe0('0x33')](_0x5004d8[_0xdfe0('0x2e')],_0x5004d8[_0xdfe0('0x30')]);_0x120883['attributes']=_[_0xdfe0('0x33')](_0x5004d8['model'],qs[_0xdfe0('0x34')](_0x30fdfc[_0xdfe0('0x30')]['fields']));_0x120883[_0xdfe0('0x35')]=_0x120883[_0xdfe0('0x35')]['length']?_0x120883['attributes']:_0x5004d8[_0xdfe0('0x2e')];if(!_0x30fdfc[_0xdfe0('0x30')][_0xdfe0('0x36')](_0xdfe0('0x37'))){_0x120883[_0xdfe0('0x1c')]=qs[_0xdfe0('0x1c')](_0x30fdfc['query'][_0xdfe0('0x1c')]);_0x120883['offset']=qs['offset'](_0x30fdfc['query'][_0xdfe0('0x1b')]);}_0x120883[_0xdfe0('0x38')]=qs[_0xdfe0('0x39')](_0x30fdfc[_0xdfe0('0x30')]['sort']);_0x120883[_0xdfe0('0x3a')]=qs[_0xdfe0('0x32')](_['pick'](_0x30fdfc[_0xdfe0('0x30')],_0x5004d8[_0xdfe0('0x32')]),_0x54b792);if(_0x30fdfc[_0xdfe0('0x30')][_0xdfe0('0x3b')]){_0x120883[_0xdfe0('0x3a')]=_[_0xdfe0('0x3c')](_0x120883[_0xdfe0('0x3a')],{'$or':_['map'](_0x54b792,function(_0x5ac8d2){if(_0x5ac8d2['type']!=='VIRTUAL'){var _0x524a4e={};_0x524a4e[_0x5ac8d2['name']]={'$like':'%'+_0x30fdfc[_0xdfe0('0x30')]['filter']+'%'};return _0x524a4e;}})});}_0x120883=_['merge']({},_0x120883,_0x30fdfc[_0xdfe0('0x3d')]);var _0x5459b9={'where':_0x120883[_0xdfe0('0x3a')]};return db[_0xdfe0('0x29')][_0xdfe0('0x1a')](_0x5459b9)['then'](function(_0x2fd2ab){_0x3cd868['count']=_0x2fd2ab;if(_0x30fdfc['query']['includeAll']){_0x120883[_0xdfe0('0x3e')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x120883);})['then'](function(_0x35fd34){_0x3cd868[_0xdfe0('0x3f')]=_0x35fd34;return _0x3cd868;})[_0xdfe0('0x23')](respondWithFilteredResult(_0x56e24e,_0x120883))['catch'](handleError(_0x56e24e,null));}; \ No newline at end of file +var _0xb3e6=['rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','then','destroy','error','stack','send','map','Migration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x1b820f,_0x425eb4){var _0x423354=function(_0x3a8426){while(--_0x3a8426){_0x1b820f['push'](_0x1b820f['shift']());}};_0x423354(++_0x425eb4);}(_0xb3e6,0xd4));var _0x6b3e=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xb3e6[_0xd050c6];return _0x7278a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b3e('0x0'));var rimraf=require(_0x6b3e('0x1'));var zipdir=require(_0x6b3e('0x2'));var jsonpatch=require(_0x6b3e('0x3'));var rp=require(_0x6b3e('0x4'));var moment=require('moment');var BPromise=require(_0x6b3e('0x5'));var Mustache=require('mustache');var util=require(_0x6b3e('0x6'));var path=require(_0x6b3e('0x7'));var sox=require(_0x6b3e('0x8'));var csv=require(_0x6b3e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b3e('0xa'));var squel=require('squel');var crypto=require(_0x6b3e('0xb'));var jsforce=require(_0x6b3e('0xc'));var deskjs=require(_0x6b3e('0xd'));var toCsv=require(_0x6b3e('0x9'));var querystring=require(_0x6b3e('0xe'));var Papa=require(_0x6b3e('0xf'));var Redis=require(_0x6b3e('0x10'));var authService=require(_0x6b3e('0x11'));var qs=require(_0x6b3e('0x12'));var as=require(_0x6b3e('0x13'));var hardwareService=require(_0x6b3e('0x14'));var logger=require(_0x6b3e('0x15'))(_0x6b3e('0x16'));var utils=require(_0x6b3e('0x17'));var config=require(_0x6b3e('0x18'));var licenseUtil=require(_0x6b3e('0x19'));var db=require(_0x6b3e('0x1a'))['db'];function respondWithStatusCode(_0x5ea2e6,_0x1b3252){_0x1b3252=_0x1b3252||0xcc;return function(_0x5ca04a){if(_0x5ca04a){return _0x5ea2e6[_0x6b3e('0x1b')](_0x1b3252);}return _0x5ea2e6[_0x6b3e('0x1c')](_0x1b3252)['end']();};}function respondWithResult(_0x2fb11f,_0x49c2ce){_0x49c2ce=_0x49c2ce||0xc8;return function(_0x25c83f){if(_0x25c83f){return _0x2fb11f[_0x6b3e('0x1c')](_0x49c2ce)[_0x6b3e('0x1d')](_0x25c83f);}};}function respondWithFilteredResult(_0x32682d,_0x233e7e){return function(_0x57d1e8){if(_0x57d1e8){var _0x35f4f2=_0x57d1e8[_0x6b3e('0x1e')],_0x3eab1b=_0x233e7e[_0x6b3e('0x1f')],_0x4c098a=_0x233e7e['offset']+_0x233e7e['limit'],_0x32ea59;if(_0x4c098a>=_0x35f4f2){_0x4c098a=_0x35f4f2;_0x32ea59=0xc8;}else{_0x32ea59=0xce;}_0x32682d[_0x6b3e('0x1c')](_0x32ea59);return _0x32682d[_0x6b3e('0x20')]('Content-Range',_0x3eab1b+'-'+_0x4c098a+'/'+_0x35f4f2)[_0x6b3e('0x1d')](_0x57d1e8);}return null;};}function patchUpdates(_0x77dd33){return function(_0x5cbb8c){try{jsonpatch[_0x6b3e('0x21')](_0x5cbb8c,_0x77dd33,!![]);}catch(_0x23ad2d){return BPromise[_0x6b3e('0x22')](_0x23ad2d);}return _0x5cbb8c['save']();};}function saveUpdates(_0x5657fa,_0x1f78bf){return function(_0x30900f){if(_0x30900f){return _0x30900f['update'](_0x5657fa)[_0x6b3e('0x23')](function(_0x58b313){return _0x58b313;});}return null;};}function removeEntity(_0x407d0f,_0x19a737){return function(_0xa8da1e){if(_0xa8da1e){return _0xa8da1e[_0x6b3e('0x24')]()[_0x6b3e('0x23')](function(){_0x407d0f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x277585,_0x3b999f){return function(_0x37f604){if(!_0x37f604){_0x277585[_0x6b3e('0x1b')](0x194);}return _0x37f604;};}function handleError(_0x8ab0d4,_0x5ba8f0){_0x5ba8f0=_0x5ba8f0||0x1f4;return function(_0x551d42){logger[_0x6b3e('0x25')](_0x551d42[_0x6b3e('0x26')]);if(_0x551d42['name']){delete _0x551d42['name'];}_0x8ab0d4['status'](_0x5ba8f0)[_0x6b3e('0x27')](_0x551d42);};}exports['index']=function(_0x178ef3,_0x183fb5){var _0x31cd50={},_0x5291f6={},_0x39b668={'count':0x0,'rows':[]};var _0x3726f0=_[_0x6b3e('0x28')](db[_0x6b3e('0x29')][_0x6b3e('0x2a')],function(_0x3edfc6){return{'name':_0x3edfc6[_0x6b3e('0x2b')],'type':_0x3edfc6[_0x6b3e('0x2c')][_0x6b3e('0x2d')]};});_0x5291f6[_0x6b3e('0x2e')]=_['map'](_0x3726f0,_0x6b3e('0x2f'));_0x5291f6[_0x6b3e('0x30')]=_[_0x6b3e('0x31')](_0x178ef3[_0x6b3e('0x30')]);_0x5291f6[_0x6b3e('0x32')]=_[_0x6b3e('0x33')](_0x5291f6[_0x6b3e('0x2e')],_0x5291f6[_0x6b3e('0x30')]);_0x31cd50[_0x6b3e('0x34')]=_[_0x6b3e('0x33')](_0x5291f6[_0x6b3e('0x2e')],qs[_0x6b3e('0x35')](_0x178ef3[_0x6b3e('0x30')][_0x6b3e('0x35')]));_0x31cd50['attributes']=_0x31cd50[_0x6b3e('0x34')][_0x6b3e('0x36')]?_0x31cd50[_0x6b3e('0x34')]:_0x5291f6[_0x6b3e('0x2e')];if(!_0x178ef3['query'][_0x6b3e('0x37')](_0x6b3e('0x38'))){_0x31cd50[_0x6b3e('0x39')]=qs[_0x6b3e('0x39')](_0x178ef3[_0x6b3e('0x30')]['limit']);_0x31cd50[_0x6b3e('0x1f')]=qs[_0x6b3e('0x1f')](_0x178ef3[_0x6b3e('0x30')][_0x6b3e('0x1f')]);}_0x31cd50[_0x6b3e('0x3a')]=qs[_0x6b3e('0x3b')](_0x178ef3[_0x6b3e('0x30')][_0x6b3e('0x3b')]);_0x31cd50[_0x6b3e('0x3c')]=qs[_0x6b3e('0x32')](_[_0x6b3e('0x3d')](_0x178ef3[_0x6b3e('0x30')],_0x5291f6[_0x6b3e('0x32')]),_0x3726f0);if(_0x178ef3[_0x6b3e('0x30')][_0x6b3e('0x3e')]){_0x31cd50[_0x6b3e('0x3c')]=_[_0x6b3e('0x3f')](_0x31cd50[_0x6b3e('0x3c')],{'$or':_[_0x6b3e('0x28')](_0x3726f0,function(_0x1c84b0){if(_0x1c84b0[_0x6b3e('0x2c')]!==_0x6b3e('0x40')){var _0x5d79b3={};_0x5d79b3[_0x1c84b0[_0x6b3e('0x2f')]]={'$like':'%'+_0x178ef3['query'][_0x6b3e('0x3e')]+'%'};return _0x5d79b3;}})});}_0x31cd50=_['merge']({},_0x31cd50,_0x178ef3['options']);var _0x55e499={'where':_0x31cd50[_0x6b3e('0x3c')]};return db[_0x6b3e('0x29')][_0x6b3e('0x1e')](_0x55e499)[_0x6b3e('0x23')](function(_0x52485b){_0x39b668['count']=_0x52485b;if(_0x178ef3[_0x6b3e('0x30')][_0x6b3e('0x41')]){_0x31cd50[_0x6b3e('0x42')]=[{'all':!![]}];}return db[_0x6b3e('0x29')][_0x6b3e('0x43')](_0x31cd50);})[_0x6b3e('0x23')](function(_0x4a3bc0){_0x39b668[_0x6b3e('0x44')]=_0x4a3bc0;return _0x39b668;})['then'](respondWithFilteredResult(_0x183fb5,_0x31cd50))[_0x6b3e('0x45')](handleError(_0x183fb5,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a2d1fd4..67ea1dd 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 _0x41ee=['rimraf','../../config/environment','./migration.attributes','define','migrations','lodash','util','api','bluebird','request-promise'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x41ee,0x9b));var _0xe41e=function(_0x5676d3,_0x582062){_0x5676d3=_0x5676d3-0x0;var _0x573736=_0x41ee[_0x5676d3];return _0x573736;};'use strict';var _=require(_0xe41e('0x0'));var util=require(_0xe41e('0x1'));var logger=require('../../config/logger')(_0xe41e('0x2'));var moment=require('moment');var BPromise=require(_0xe41e('0x3'));var rp=require(_0xe41e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe41e('0x5'));var config=require(_0xe41e('0x6'));var attributes=require(_0xe41e('0x7'));module['exports']=function(_0x2a8e08,_0x29e885){return _0x2a8e08[_0xe41e('0x8')]('Migration',attributes,{'tableName':_0xe41e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x574f=['rimraf','../../config/environment','./migration.attributes','exports','migrations','lodash','util','moment','bluebird','request-promise'];(function(_0x175d21,_0x4749b3){var _0x369a54=function(_0x168ae2){while(--_0x168ae2){_0x175d21['push'](_0x175d21['shift']());}};_0x369a54(++_0x4749b3);}(_0x574f,0xeb));var _0xf574=function(_0x270dc1,_0x1286a9){_0x270dc1=_0x270dc1-0x0;var _0x391794=_0x574f[_0x270dc1];return _0x391794;};'use strict';var _=require(_0xf574('0x0'));var util=require(_0xf574('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf574('0x2'));var BPromise=require(_0xf574('0x3'));var rp=require(_0xf574('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf574('0x5'));var config=require(_0xf574('0x6'));var attributes=require(_0xf574('0x7'));module[_0xf574('0x8')]=function(_0x56fd27,_0x31ddf4){return _0x56fd27['define']('Migration',attributes,{'tableName':_0xf574('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index dea874b..5bfe373 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 _0xce3e=['info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x685608,_0x3348df){var _0x33b726=function(_0x2e54bd){while(--_0x2e54bd){_0x685608['push'](_0x685608['shift']());}};_0x33b726(++_0x3348df);}(_0xce3e,0x12e));var _0xece3=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xce3e[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0xece3('0x0'));var util=require('util');var moment=require(_0xece3('0x1'));var BPromise=require(_0xece3('0x2'));var rs=require(_0xece3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xece3('0x4'))['db'];var utils=require(_0xece3('0x5'));var logger=require(_0xece3('0x6'))(_0xece3('0x7'));var config=require('../../config/environment');var jayson=require(_0xece3('0x8'));var client=jayson[_0xece3('0x9')][_0xece3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6dea,_0x36adab,_0x452584){return new BPromise(function(_0x16be0f,_0x2e2e62){return client[_0xece3('0xb')](_0x3a6dea,_0x452584)[_0xece3('0xc')](function(_0x25f5e2){logger['info'](_0xece3('0xd'),_0x36adab,_0xece3('0xe'));logger[_0xece3('0xf')](_0xece3('0x10'),_0x36adab,'request\x20sent',JSON[_0xece3('0x11')](_0x25f5e2));if(_0x25f5e2['error']){if(_0x25f5e2[_0xece3('0x12')]['code']===0x1f4){logger[_0xece3('0x12')]('Migration,\x20%s,\x20%s',_0x36adab,_0x25f5e2[_0xece3('0x12')]['message']);return _0x2e2e62(_0x25f5e2['error'][_0xece3('0x13')]);}logger[_0xece3('0x12')](_0xece3('0xd'),_0x36adab,_0x25f5e2[_0xece3('0x12')][_0xece3('0x13')]);return _0x16be0f(_0x25f5e2[_0xece3('0x12')][_0xece3('0x13')]);}else{logger[_0xece3('0x14')](_0xece3('0xd'),_0x36adab,_0xece3('0xe'));_0x16be0f(_0x25f5e2[_0xece3('0x15')][_0xece3('0x13')]);}})[_0xece3('0x16')](function(_0x1cb8fa){logger[_0xece3('0x12')]('Migration,\x20%s,\x20%s',_0x36adab,_0x1cb8fa);_0x2e2e62(_0x1cb8fa);});});} \ No newline at end of file +var _0x661e=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x661e,0x169));var _0xe661=function(_0x2af291,_0x7e2ca0){_0x2af291=_0x2af291-0x0;var _0x1a4d28=_0x661e[_0x2af291];return _0x1a4d28;};'use strict';var _=require(_0xe661('0x0'));var util=require(_0xe661('0x1'));var moment=require('moment');var BPromise=require(_0xe661('0x2'));var rs=require(_0xe661('0x3'));var fs=require('fs');var Redis=require(_0xe661('0x4'));var db=require(_0xe661('0x5'))['db'];var utils=require(_0xe661('0x6'));var logger=require(_0xe661('0x7'))(_0xe661('0x8'));var config=require(_0xe661('0x9'));var jayson=require(_0xe661('0xa'));var client=jayson['client'][_0xe661('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42f967,_0x331ae4,_0x221759){return new BPromise(function(_0x4572aa,_0x459d34){return client[_0xe661('0xc')](_0x42f967,_0x221759)[_0xe661('0xd')](function(_0xd283b){logger[_0xe661('0xe')](_0xe661('0xf'),_0x331ae4,_0xe661('0x10'));logger[_0xe661('0x11')](_0xe661('0x12'),_0x331ae4,'request\x20sent',JSON[_0xe661('0x13')](_0xd283b));if(_0xd283b['error']){if(_0xd283b[_0xe661('0x14')][_0xe661('0x15')]===0x1f4){logger['error'](_0xe661('0xf'),_0x331ae4,_0xd283b[_0xe661('0x14')][_0xe661('0x16')]);return _0x459d34(_0xd283b[_0xe661('0x14')][_0xe661('0x16')]);}logger[_0xe661('0x14')]('Migration,\x20%s,\x20%s',_0x331ae4,_0xd283b[_0xe661('0x14')]['message']);return _0x4572aa(_0xd283b[_0xe661('0x14')][_0xe661('0x16')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x331ae4,_0xe661('0x10'));_0x4572aa(_0xd283b[_0xe661('0x17')][_0xe661('0x16')]);}})[_0xe661('0x18')](function(_0x225eae){logger[_0xe661('0x14')](_0xe661('0xf'),_0x331ae4,_0x225eae);_0x459d34(_0x225eae);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 41efaa1..678f70d 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 _0xb032=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x24eb7e,_0x1ffb7e){var _0x104dd8=function(_0x30abdb){while(--_0x30abdb){_0x24eb7e['push'](_0x24eb7e['shift']());}};_0x104dd8(++_0x1ffb7e);}(_0xb032,0x84));var _0x2b03=function(_0x4d9242,_0x385b6e){_0x4d9242=_0x4d9242-0x0;var _0x59301e=_0xb032[_0x4d9242];return _0x59301e;};'use strict';var multer=require(_0x2b03('0x0'));var util=require('util');var path=require(_0x2b03('0x1'));var timeout=require(_0x2b03('0x2'));var express=require(_0x2b03('0x3'));var router=express[_0x2b03('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b03('0x5'));var config=require(_0x2b03('0x6'));var controller=require(_0x2b03('0x7'));router[_0x2b03('0x8')]('/',auth[_0x2b03('0x9')](),controller[_0x2b03('0xa')]);router['get'](_0x2b03('0xb'),auth[_0x2b03('0x9')](),controller[_0x2b03('0xc')]);router[_0x2b03('0xd')]('/',auth['isAuthenticated'](),controller[_0x2b03('0xe')]);router[_0x2b03('0xf')](_0x2b03('0xb'),auth['isAuthenticated'](),controller[_0x2b03('0x10')]);router[_0x2b03('0x11')](_0x2b03('0xb'),auth[_0x2b03('0x9')](),controller[_0x2b03('0x12')]);module[_0x2b03('0x13')]=router; \ No newline at end of file +var _0xa1b2=['create','put','update','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x190545,_0x45442e){var _0x1761a6=function(_0xb1a4af){while(--_0xb1a4af){_0x190545['push'](_0x190545['shift']());}};_0x1761a6(++_0x45442e);}(_0xa1b2,0x174));var _0x2a1b=function(_0x18cf66,_0x296255){_0x18cf66=_0x18cf66-0x0;var _0x50d70a=_0xa1b2[_0x18cf66];return _0x50d70a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2a1b('0x0'));var timeout=require(_0x2a1b('0x1'));var express=require(_0x2a1b('0x2'));var router=express[_0x2a1b('0x3')]();var auth=require(_0x2a1b('0x4'));var interaction=require(_0x2a1b('0x5'));var config=require(_0x2a1b('0x6'));var controller=require('./network.controller');router[_0x2a1b('0x7')]('/',auth['isAuthenticated'](),controller[_0x2a1b('0x8')]);router[_0x2a1b('0x7')](_0x2a1b('0x9'),auth[_0x2a1b('0xa')](),controller[_0x2a1b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2a1b('0xc')]);router[_0x2a1b('0xd')](_0x2a1b('0x9'),auth[_0x2a1b('0xa')](),controller[_0x2a1b('0xe')]);router['delete'](_0x2a1b('0x9'),auth[_0x2a1b('0xa')](),controller[_0x2a1b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d56a575..bf8f89d 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(_0x240aaf,_0x3be9a2){var _0x38a9b1=function(_0x2a5059){while(--_0x2a5059){_0x240aaf['push'](_0x240aaf['shift']());}};_0x38a9b1(++_0x3be9a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x11a1a7,_0x31b5b8){var _0x13ca46=function(_0x22c3b1){while(--_0x22c3b1){_0x11a1a7['push'](_0x11a1a7['shift']());}};_0x13ca46(++_0x31b5b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 aa20820..0597d6c 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 _0x2add=['render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','join','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','update','TURN','/etc/asterisk/turn_xcally.conf','destroy','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','stack','name','index','map','Network','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','find','create','sequelize','body','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8'];(function(_0x43d209,_0x586174){var _0x224032=function(_0x44cd3f){while(--_0x44cd3f){_0x43d209['push'](_0x43d209['shift']());}};_0x224032(++_0x586174);}(_0x2add,0x7b));var _0xd2ad=function(_0x314b91,_0x488aea){_0x314b91=_0x314b91-0x0;var _0x2cd89e=_0x2add[_0x314b91];return _0x2cd89e;};'use strict';var pdf=require(_0xd2ad('0x0'));var emlformat=require(_0xd2ad('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd2ad('0x2'));var rp=require(_0xd2ad('0x3'));var moment=require(_0xd2ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2ad('0x5'));var util=require('util');var path=require(_0xd2ad('0x6'));var sox=require(_0xd2ad('0x7'));var csv=require('to-csv');var ejs=require(_0xd2ad('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd2ad('0x9'));var crypto=require(_0xd2ad('0xa'));var jsforce=require(_0xd2ad('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd2ad('0xc'));var querystring=require(_0xd2ad('0xd'));var Papa=require(_0xd2ad('0xe'));var Redis=require('ioredis');var authService=require(_0xd2ad('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2ad('0x10'))(_0xd2ad('0x11'));var utils=require(_0xd2ad('0x12'));var config=require(_0xd2ad('0x13'));var licenseUtil=require(_0xd2ad('0x14'));var db=require(_0xd2ad('0x15'))['db'];var jayson=require(_0xd2ad('0x16'));var client=jayson[_0xd2ad('0x17')][_0xd2ad('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1107d7,_0x59c387,_0x25ea4a,_0x40bddf){return new BPromise(function(_0x5f0c55,_0x6f5746){var _0x440497=_0x40bddf||client;return _0x440497['request'](_0x1107d7,_0x25ea4a)['then'](function(_0x391de7){logger[_0xd2ad('0x19')](_0xd2ad('0x1a'),_0x59c387,'request\x20sent');logger[_0xd2ad('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x59c387,_0xd2ad('0x1c'),JSON[_0xd2ad('0x1d')](_0x391de7));if(_0x391de7['error']){if(_0x391de7[_0xd2ad('0x1e')][_0xd2ad('0x1f')]===0x1f4){logger[_0xd2ad('0x1e')](_0xd2ad('0x1a'),_0x59c387,_0x391de7['error'][_0xd2ad('0x20')]);return _0x6f5746(_0x391de7[_0xd2ad('0x1e')][_0xd2ad('0x20')]);}logger[_0xd2ad('0x1e')](_0xd2ad('0x1a'),_0x59c387,_0x391de7[_0xd2ad('0x1e')]['message']);return _0x5f0c55(_0x391de7[_0xd2ad('0x1e')]['message']);}else{logger['info'](_0xd2ad('0x1a'),_0x59c387,'request\x20sent');_0x5f0c55(_0x391de7[_0xd2ad('0x21')]['message']);}})[_0xd2ad('0x22')](function(_0x4d28d8){logger[_0xd2ad('0x1e')](_0xd2ad('0x1a'),_0x59c387,_0x4d28d8);_0x6f5746(_0x4d28d8);});});}function respondWithStatusCode(_0x2dd29e,_0xdb3709){_0xdb3709=_0xdb3709||0xcc;return function(_0x55f681){if(_0x55f681){return _0x2dd29e[_0xd2ad('0x23')](_0xdb3709);}return _0x2dd29e[_0xd2ad('0x24')](_0xdb3709)[_0xd2ad('0x25')]();};}function respondWithResult(_0x5bcc1b,_0x1ca6b1){_0x1ca6b1=_0x1ca6b1||0xc8;return function(_0x7033d4){if(_0x7033d4){return _0x5bcc1b['status'](_0x1ca6b1)[_0xd2ad('0x26')](_0x7033d4);}};}function respondWithFilteredResult(_0x474115,_0x3c0505){return function(_0x58ce60){if(_0x58ce60){var _0x428177=_0x58ce60[_0xd2ad('0x27')],_0x2d4515=_0x3c0505[_0xd2ad('0x28')],_0x11dbc8=_0x3c0505[_0xd2ad('0x28')]+_0x3c0505[_0xd2ad('0x29')],_0x40c6c2;if(_0x11dbc8>=_0x428177){_0x11dbc8=_0x428177;_0x40c6c2=0xc8;}else{_0x40c6c2=0xce;}_0x474115[_0xd2ad('0x24')](_0x40c6c2);return _0x474115[_0xd2ad('0x2a')](_0xd2ad('0x2b'),_0x2d4515+'-'+_0x11dbc8+'/'+_0x428177)['json'](_0x58ce60);}return null;};}function patchUpdates(_0x310196){return function(_0x2f59bb){try{jsonpatch[_0xd2ad('0x2c')](_0x2f59bb,_0x310196,!![]);}catch(_0xd691d7){return BPromise['reject'](_0xd691d7);}return _0x2f59bb['save']();};}function saveUpdates(_0x349f28,_0x1e21f6){return function(_0x2db8d8){if(_0x2db8d8){return _0x2db8d8['update'](_0x349f28)[_0xd2ad('0x2d')](function(_0x3c1e66){return _0x3c1e66;});}return null;};}function removeEntity(_0x447022,_0x5ccf07){return function(_0x37c8c5){if(_0x37c8c5){return _0x37c8c5['destroy']()[_0xd2ad('0x2d')](function(){_0x447022[_0xd2ad('0x24')](0xcc)[_0xd2ad('0x25')]();});}};}function handleEntityNotFound(_0x456a80,_0xe0e472){return function(_0x24beff){if(!_0x24beff){_0x456a80['sendStatus'](0x194);}return _0x24beff;};}function handleError(_0xa60174,_0x54b04f){_0x54b04f=_0x54b04f||0x1f4;return function(_0x43d543){logger['error'](_0x43d543[_0xd2ad('0x2e')]);if(_0x43d543[_0xd2ad('0x2f')]){delete _0x43d543['name'];}_0xa60174[_0xd2ad('0x24')](_0x54b04f)['send'](_0x43d543);};}exports[_0xd2ad('0x30')]=function(_0x30d44d,_0x10b81b){var _0x4a09fa={},_0x2f25f6={},_0x46157b={'count':0x0,'rows':[]};var _0xa9b7be=_[_0xd2ad('0x31')](db[_0xd2ad('0x32')][_0xd2ad('0x33')],function(_0x1f46b1){return{'name':_0x1f46b1[_0xd2ad('0x34')],'type':_0x1f46b1['type'][_0xd2ad('0x35')]};});_0x2f25f6[_0xd2ad('0x36')]=_[_0xd2ad('0x31')](_0xa9b7be,_0xd2ad('0x2f'));_0x2f25f6[_0xd2ad('0x37')]=_['keys'](_0x30d44d['query']);_0x2f25f6[_0xd2ad('0x38')]=_[_0xd2ad('0x39')](_0x2f25f6[_0xd2ad('0x36')],_0x2f25f6[_0xd2ad('0x37')]);_0x4a09fa[_0xd2ad('0x3a')]=_[_0xd2ad('0x39')](_0x2f25f6[_0xd2ad('0x36')],qs[_0xd2ad('0x3b')](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x3b')]));_0x4a09fa[_0xd2ad('0x3a')]=_0x4a09fa[_0xd2ad('0x3a')][_0xd2ad('0x3c')]?_0x4a09fa[_0xd2ad('0x3a')]:_0x2f25f6['model'];if(!_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x3d')](_0xd2ad('0x3e'))){_0x4a09fa['limit']=qs['limit'](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x29')]);_0x4a09fa['offset']=qs[_0xd2ad('0x28')](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x28')]);}_0x4a09fa[_0xd2ad('0x3f')]=qs[_0xd2ad('0x40')](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x40')]);_0x4a09fa[_0xd2ad('0x41')]=qs[_0xd2ad('0x38')](_[_0xd2ad('0x42')](_0x30d44d[_0xd2ad('0x37')],_0x2f25f6[_0xd2ad('0x38')]),_0xa9b7be);if(_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x43')]){_0x4a09fa['where']=_[_0xd2ad('0x44')](_0x4a09fa[_0xd2ad('0x41')],{'$or':_[_0xd2ad('0x31')](_0xa9b7be,function(_0x10fa74){if(_0x10fa74[_0xd2ad('0x45')]!==_0xd2ad('0x46')){var _0x511769={};_0x511769[_0x10fa74[_0xd2ad('0x2f')]]={'$like':'%'+_0x30d44d['query']['filter']+'%'};return _0x511769;}})});}_0x4a09fa=_[_0xd2ad('0x44')]({},_0x4a09fa,_0x30d44d[_0xd2ad('0x47')]);var _0xa5d4ff={'where':_0x4a09fa[_0xd2ad('0x41')]};return db['Network'][_0xd2ad('0x27')](_0xa5d4ff)[_0xd2ad('0x2d')](function(_0x564ce7){_0x46157b[_0xd2ad('0x27')]=_0x564ce7;if(_0x30d44d[_0xd2ad('0x37')]['includeAll']){_0x4a09fa[_0xd2ad('0x48')]=[{'all':!![]}];}return db[_0xd2ad('0x32')][_0xd2ad('0x49')](_0x4a09fa);})['then'](function(_0x39f186){_0x46157b[_0xd2ad('0x4a')]=_0x39f186;return _0x46157b;})['then'](respondWithFilteredResult(_0x10b81b,_0x4a09fa))[_0xd2ad('0x22')](handleError(_0x10b81b,null));};exports[_0xd2ad('0x4b')]=function(_0x404a8f,_0x132446){var _0x4e0fe1={'raw':!![],'where':{'id':_0x404a8f[_0xd2ad('0x4c')]['id']}},_0x2133b2={};_0x2133b2[_0xd2ad('0x36')]=_[_0xd2ad('0x4d')](db[_0xd2ad('0x32')][_0xd2ad('0x33')]);_0x2133b2[_0xd2ad('0x37')]=_[_0xd2ad('0x4d')](_0x404a8f[_0xd2ad('0x37')]);_0x2133b2[_0xd2ad('0x38')]=_[_0xd2ad('0x39')](_0x2133b2[_0xd2ad('0x36')],_0x2133b2[_0xd2ad('0x37')]);_0x4e0fe1['attributes']=_['intersection'](_0x2133b2['model'],qs[_0xd2ad('0x3b')](_0x404a8f[_0xd2ad('0x37')][_0xd2ad('0x3b')]));_0x4e0fe1['attributes']=_0x4e0fe1['attributes']['length']?_0x4e0fe1[_0xd2ad('0x3a')]:_0x2133b2[_0xd2ad('0x36')];if(_0x404a8f[_0xd2ad('0x37')]['includeAll']){_0x4e0fe1[_0xd2ad('0x48')]=[{'all':!![]}];}_0x4e0fe1=_[_0xd2ad('0x44')]({},_0x4e0fe1,_0x404a8f[_0xd2ad('0x47')]);return db[_0xd2ad('0x32')][_0xd2ad('0x4e')](_0x4e0fe1)[_0xd2ad('0x2d')](handleEntityNotFound(_0x132446,null))[_0xd2ad('0x2d')](respondWithResult(_0x132446,null))[_0xd2ad('0x22')](handleError(_0x132446,null));};exports[_0xd2ad('0x4f')]=function(_0x3ec595,_0xa8ff46,_0x573ea5){var _0x290734;return db[_0xd2ad('0x50')]['transaction'](function(_0x49eac7){return db['Network'][_0xd2ad('0x4f')](_0x3ec595[_0xd2ad('0x51')],{'raw':!![]})[_0xd2ad('0x2d')](function(_0x398157){_0x290734=_0x398157;return db[_0xd2ad('0x32')][_0xd2ad('0x49')]({'where':{'type':_0x3ec595['body'][_0xd2ad('0x45')]},'raw':!![]});})[_0xd2ad('0x2d')](function(_0x3fb601){if(_0x290734[_0xd2ad('0x45')]['toUpperCase']()==_0xd2ad('0x52')){var _0x402e40=fs[_0xd2ad('0x53')](path['join'](config[_0xd2ad('0x54')],_0xd2ad('0x55')),_0xd2ad('0x56'));var _0x211849=ejs[_0xd2ad('0x57')](_0x402e40,{'networks':_0x3fb601||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x59'),_0x211849);return respondWithRpcPromise(_0xd2ad('0x5a'),'create',{'module':_0xd2ad('0x5b')});}else if(_0x290734['type'][_0xd2ad('0x5c')]()=='TURN'){var _0x2ce1d4=fs['readFileSync'](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],_0xd2ad('0x5e')),'utf8');var _0x2e4630=ejs[_0xd2ad('0x57')](_0x2ce1d4,{'networks':_0x3fb601||[]});fs[_0xd2ad('0x58')]('/etc/asterisk/turn_xcally.conf',_0x2e4630);return respondWithRpcPromise('Reload',_0xd2ad('0x4f'),{'module':_0xd2ad('0x5b')});}else{var _0x50bf51=fs[_0xd2ad('0x53')](path['join'](config[_0xd2ad('0x54')],_0xd2ad('0x5f')),'utf8');var _0x1f0b90=ejs['render'](_0x50bf51,{'networks':_0x3fb601||[]});fs[_0xd2ad('0x58')](util[_0xd2ad('0x60')](_0xd2ad('0x61'),_0x3ec595['body']['type'][_0xd2ad('0x62')]()),_0x1f0b90);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x4f'),{'module':_0xd2ad('0x63')});}return null;})[_0xd2ad('0x2d')](function(){return _0x290734;});})[_0xd2ad('0x2d')](respondWithResult(_0xa8ff46,0xc9))[_0xd2ad('0x22')](handleError(_0xa8ff46,null));};exports['update']=function(_0x30da57,_0x4e2179,_0x29f96a){var _0x3dc097;return db['sequelize'][_0xd2ad('0x64')](function(_0x120236){return db[_0xd2ad('0x32')][_0xd2ad('0x4e')]({'where':{'id':_0x30da57[_0xd2ad('0x4c')]['id']}})[_0xd2ad('0x2d')](handleEntityNotFound(_0x4e2179,null))[_0xd2ad('0x2d')](saveUpdates(_0x30da57['body'],null))[_0xd2ad('0x2d')](function(_0x4d21fb){if(_0x4d21fb){_0x3dc097=_0x4d21fb;return db[_0xd2ad('0x32')][_0xd2ad('0x49')]({'where':{'type':_0x3dc097['type']},'raw':!![]});}return null;})['then'](function(_0x43ac36){if(_0x3dc097[_0xd2ad('0x45')][_0xd2ad('0x5c')]()==_0xd2ad('0x52')){var _0x3a4236=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],'server/files/templates/stun_multiple.ejs'),_0xd2ad('0x56'));var _0x2db589=ejs[_0xd2ad('0x57')](_0x3a4236,{'networks':_0x43ac36||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x59'),_0x2db589);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x65'),{'module':'res_stun_monitor.so'});}else if(_0x3dc097['type'][_0xd2ad('0x5c')]()==_0xd2ad('0x66')){var _0x2d229c=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],_0xd2ad('0x5e')),_0xd2ad('0x56'));var _0x2ad46a=ejs['render'](_0x2d229c,{'networks':_0x43ac36||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x67'),_0x2ad46a);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x65'),{'module':_0xd2ad('0x5b')});}else{var _0x1756de=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config['root'],_0xd2ad('0x5f')),'utf8');var _0x718540=ejs[_0xd2ad('0x57')](_0x1756de,{'networks':_0x43ac36||[]});fs[_0xd2ad('0x58')](util[_0xd2ad('0x60')](_0xd2ad('0x61'),_0x30da57[_0xd2ad('0x51')][_0xd2ad('0x45')]['toLowerCase']()),_0x718540);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x65'),{'module':_0xd2ad('0x63')});}return null;})[_0xd2ad('0x2d')](function(_0x4dc8bd){if(_0x4dc8bd){return _0x3dc097;}return null;});})[_0xd2ad('0x2d')](respondWithResult(_0x4e2179,null))[_0xd2ad('0x22')](handleError(_0x4e2179,null));};exports[_0xd2ad('0x68')]=function(_0x1e27ae,_0x207f51,_0xdd1fe3){var _0x2ea5d0;return db['Network'][_0xd2ad('0x4e')]({'where':{'id':_0x1e27ae[_0xd2ad('0x4c')]['id']}})[_0xd2ad('0x2d')](function(_0x1e2a3c){_0x2ea5d0=_0x1e2a3c;return _0x1e2a3c;})['then'](handleEntityNotFound(_0x207f51,null))['then'](removeEntity(_0x207f51,null))[_0xd2ad('0x2d')](function(){if(_0x2ea5d0){return db[_0xd2ad('0x32')]['findAll']({'where':{'type':_0x2ea5d0[_0xd2ad('0x45')]},'raw':!![]});}})[_0xd2ad('0x2d')](function(_0xbbbc2f){if(_0x2ea5d0['type'][_0xd2ad('0x5c')]()==_0xd2ad('0x52')){var _0x16172c=fs['readFileSync'](path[_0xd2ad('0x5d')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xd2ad('0x56'));var _0x30ecd0=ejs[_0xd2ad('0x57')](_0x16172c,{'networks':_0xbbbc2f||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x59'),_0x30ecd0);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x68'),{'module':_0xd2ad('0x5b')});}else if(_0x2ea5d0['type']['toUpperCase']()==_0xd2ad('0x66')){var _0x494d8a=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],_0xd2ad('0x5e')),_0xd2ad('0x56'));var _0x9e69d3=ejs[_0xd2ad('0x57')](_0x494d8a,{'networks':_0xbbbc2f||[]});fs['writeFileSync'](_0xd2ad('0x67'),_0x9e69d3);return respondWithRpcPromise(_0xd2ad('0x5a'),'destroy',{'module':_0xd2ad('0x5b')});}else{var _0x44facc=fs['readFileSync'](path['join'](config['root'],_0xd2ad('0x5f')),_0xd2ad('0x56'));var _0x1c70cc=ejs[_0xd2ad('0x57')](_0x44facc,{'networks':_0xbbbc2f||[]});fs[_0xd2ad('0x58')](util[_0xd2ad('0x60')]('/etc/asterisk/sip_xcally_%s.conf',_0x1e27ae[_0xd2ad('0x51')][_0xd2ad('0x45')][_0xd2ad('0x62')]()),_0x1c70cc);return respondWithRpcPromise(_0xd2ad('0x5a'),'destroy',{'module':_0xd2ad('0x63')});}return null;})['catch'](handleError(_0x207f51,null));}; \ No newline at end of file +var _0xb137=['sequelize','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','transaction','toLowerCase','destroy','params','html-pdf','eml-format','zip-dir','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','catch','sendStatus','count','offset','status','Content-Range','save','update','end','stack','name','send','index','Network','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filters','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find'];(function(_0xba903,_0x2fc6e8){var _0x2bf8b0=function(_0x708fb1){while(--_0x708fb1){_0xba903['push'](_0xba903['shift']());}};_0x2bf8b0(++_0x2fc6e8);}(_0xb137,0x86));var _0x7b13=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xb137[_0x220f3f];return _0x1f170e;};'use strict';var pdf=require(_0x7b13('0x0'));var emlformat=require(_0x7b13('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7b13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b13('0x3'));var moment=require(_0x7b13('0x4'));var BPromise=require(_0x7b13('0x5'));var Mustache=require('mustache');var util=require(_0x7b13('0x6'));var path=require(_0x7b13('0x7'));var sox=require(_0x7b13('0x8'));var csv=require(_0x7b13('0x9'));var ejs=require(_0x7b13('0xa'));var fs=require('fs');var _=require(_0x7b13('0xb'));var squel=require('squel');var crypto=require(_0x7b13('0xc'));var jsforce=require(_0x7b13('0xd'));var deskjs=require(_0x7b13('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b13('0xf'));var Papa=require(_0x7b13('0x10'));var Redis=require(_0x7b13('0x11'));var authService=require(_0x7b13('0x12'));var qs=require(_0x7b13('0x13'));var as=require(_0x7b13('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b13('0x15'))('api');var utils=require(_0x7b13('0x16'));var config=require(_0x7b13('0x17'));var licenseUtil=require(_0x7b13('0x18'));var db=require(_0x7b13('0x19'))['db'];var jayson=require(_0x7b13('0x1a'));var client=jayson[_0x7b13('0x1b')][_0x7b13('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x30b93c,_0x39a17d,_0x30fb89,_0x43a61c){return new BPromise(function(_0x7bd148,_0x53b791){var _0x4b0720=_0x43a61c||client;return _0x4b0720[_0x7b13('0x1d')](_0x30b93c,_0x30fb89)[_0x7b13('0x1e')](function(_0x388159){logger[_0x7b13('0x1f')]('Network,\x20%s,\x20%s',_0x39a17d,_0x7b13('0x20'));logger[_0x7b13('0x21')](_0x7b13('0x22'),_0x39a17d,_0x7b13('0x20'),JSON[_0x7b13('0x23')](_0x388159));if(_0x388159[_0x7b13('0x24')]){if(_0x388159[_0x7b13('0x24')][_0x7b13('0x25')]===0x1f4){logger[_0x7b13('0x24')](_0x7b13('0x26'),_0x39a17d,_0x388159[_0x7b13('0x24')][_0x7b13('0x27')]);return _0x53b791(_0x388159[_0x7b13('0x24')]['message']);}logger[_0x7b13('0x24')]('Network,\x20%s,\x20%s',_0x39a17d,_0x388159[_0x7b13('0x24')][_0x7b13('0x27')]);return _0x7bd148(_0x388159[_0x7b13('0x24')]['message']);}else{logger['info'](_0x7b13('0x26'),_0x39a17d,_0x7b13('0x20'));_0x7bd148(_0x388159['result'][_0x7b13('0x27')]);}})[_0x7b13('0x28')](function(_0x34ccb8){logger['error'](_0x7b13('0x26'),_0x39a17d,_0x34ccb8);_0x53b791(_0x34ccb8);});});}function respondWithStatusCode(_0x717bfb,_0x492c04){_0x492c04=_0x492c04||0xcc;return function(_0x91a3f){if(_0x91a3f){return _0x717bfb[_0x7b13('0x29')](_0x492c04);}return _0x717bfb['status'](_0x492c04)['end']();};}function respondWithResult(_0x7f7fb6,_0x588083){_0x588083=_0x588083||0xc8;return function(_0x34f853){if(_0x34f853){return _0x7f7fb6['status'](_0x588083)['json'](_0x34f853);}};}function respondWithFilteredResult(_0x390d71,_0x3190cf){return function(_0x41c06f){if(_0x41c06f){var _0x1e9804=_0x41c06f[_0x7b13('0x2a')],_0x284c99=_0x3190cf[_0x7b13('0x2b')],_0x494c17=_0x3190cf['offset']+_0x3190cf['limit'],_0x94b175;if(_0x494c17>=_0x1e9804){_0x494c17=_0x1e9804;_0x94b175=0xc8;}else{_0x94b175=0xce;}_0x390d71[_0x7b13('0x2c')](_0x94b175);return _0x390d71['set'](_0x7b13('0x2d'),_0x284c99+'-'+_0x494c17+'/'+_0x1e9804)['json'](_0x41c06f);}return null;};}function patchUpdates(_0x127893){return function(_0x520ed7){try{jsonpatch['apply'](_0x520ed7,_0x127893,!![]);}catch(_0xfecb2c){return BPromise['reject'](_0xfecb2c);}return _0x520ed7[_0x7b13('0x2e')]();};}function saveUpdates(_0x25d62d,_0x8170ea){return function(_0x27cbfe){if(_0x27cbfe){return _0x27cbfe[_0x7b13('0x2f')](_0x25d62d)[_0x7b13('0x1e')](function(_0x37bdb6){return _0x37bdb6;});}return null;};}function removeEntity(_0x30f696,_0x714399){return function(_0x4d9e70){if(_0x4d9e70){return _0x4d9e70['destroy']()[_0x7b13('0x1e')](function(){_0x30f696[_0x7b13('0x2c')](0xcc)[_0x7b13('0x30')]();});}};}function handleEntityNotFound(_0x38d8a1,_0x840304){return function(_0x58ad65){if(!_0x58ad65){_0x38d8a1[_0x7b13('0x29')](0x194);}return _0x58ad65;};}function handleError(_0x275536,_0x4b1cb7){_0x4b1cb7=_0x4b1cb7||0x1f4;return function(_0x320ae2){logger[_0x7b13('0x24')](_0x320ae2[_0x7b13('0x31')]);if(_0x320ae2[_0x7b13('0x32')]){delete _0x320ae2[_0x7b13('0x32')];}_0x275536[_0x7b13('0x2c')](_0x4b1cb7)[_0x7b13('0x33')](_0x320ae2);};}exports[_0x7b13('0x34')]=function(_0x72aa3,_0x2c99e9){var _0x3f3998={},_0x21fd34={},_0x24b183={'count':0x0,'rows':[]};var _0x1628e5=_['map'](db[_0x7b13('0x35')][_0x7b13('0x36')],function(_0x5e92e3){return{'name':_0x5e92e3[_0x7b13('0x37')],'type':_0x5e92e3['type']['key']};});_0x21fd34[_0x7b13('0x38')]=_['map'](_0x1628e5,'name');_0x21fd34[_0x7b13('0x39')]=_[_0x7b13('0x3a')](_0x72aa3[_0x7b13('0x39')]);_0x21fd34['filters']=_[_0x7b13('0x3b')](_0x21fd34['model'],_0x21fd34['query']);_0x3f3998[_0x7b13('0x3c')]=_[_0x7b13('0x3b')](_0x21fd34[_0x7b13('0x38')],qs[_0x7b13('0x3d')](_0x72aa3[_0x7b13('0x39')][_0x7b13('0x3d')]));_0x3f3998['attributes']=_0x3f3998[_0x7b13('0x3c')][_0x7b13('0x3e')]?_0x3f3998['attributes']:_0x21fd34[_0x7b13('0x38')];if(!_0x72aa3[_0x7b13('0x39')][_0x7b13('0x3f')]('nolimit')){_0x3f3998[_0x7b13('0x40')]=qs[_0x7b13('0x40')](_0x72aa3['query'][_0x7b13('0x40')]);_0x3f3998[_0x7b13('0x2b')]=qs[_0x7b13('0x2b')](_0x72aa3[_0x7b13('0x39')]['offset']);}_0x3f3998[_0x7b13('0x41')]=qs['sort'](_0x72aa3[_0x7b13('0x39')][_0x7b13('0x42')]);_0x3f3998[_0x7b13('0x43')]=qs['filters'](_[_0x7b13('0x44')](_0x72aa3[_0x7b13('0x39')],_0x21fd34[_0x7b13('0x45')]),_0x1628e5);if(_0x72aa3['query']['filter']){_0x3f3998['where']=_[_0x7b13('0x46')](_0x3f3998['where'],{'$or':_[_0x7b13('0x47')](_0x1628e5,function(_0x25d053){if(_0x25d053[_0x7b13('0x48')]!==_0x7b13('0x49')){var _0x238592={};_0x238592[_0x25d053[_0x7b13('0x32')]]={'$like':'%'+_0x72aa3[_0x7b13('0x39')][_0x7b13('0x4a')]+'%'};return _0x238592;}})});}_0x3f3998=_[_0x7b13('0x46')]({},_0x3f3998,_0x72aa3[_0x7b13('0x4b')]);var _0x143177={'where':_0x3f3998[_0x7b13('0x43')]};return db[_0x7b13('0x35')][_0x7b13('0x2a')](_0x143177)['then'](function(_0x4157b1){_0x24b183[_0x7b13('0x2a')]=_0x4157b1;if(_0x72aa3[_0x7b13('0x39')][_0x7b13('0x4c')]){_0x3f3998[_0x7b13('0x4d')]=[{'all':!![]}];}return db[_0x7b13('0x35')][_0x7b13('0x4e')](_0x3f3998);})[_0x7b13('0x1e')](function(_0x230ab2){_0x24b183[_0x7b13('0x4f')]=_0x230ab2;return _0x24b183;})['then'](respondWithFilteredResult(_0x2c99e9,_0x3f3998))['catch'](handleError(_0x2c99e9,null));};exports[_0x7b13('0x50')]=function(_0x115842,_0x40397a){var _0x4351f0={'raw':!![],'where':{'id':_0x115842['params']['id']}},_0x170631={};_0x170631[_0x7b13('0x38')]=_['keys'](db[_0x7b13('0x35')][_0x7b13('0x36')]);_0x170631['query']=_[_0x7b13('0x3a')](_0x115842[_0x7b13('0x39')]);_0x170631[_0x7b13('0x45')]=_['intersection'](_0x170631['model'],_0x170631['query']);_0x4351f0[_0x7b13('0x3c')]=_[_0x7b13('0x3b')](_0x170631[_0x7b13('0x38')],qs[_0x7b13('0x3d')](_0x115842[_0x7b13('0x39')][_0x7b13('0x3d')]));_0x4351f0[_0x7b13('0x3c')]=_0x4351f0['attributes'][_0x7b13('0x3e')]?_0x4351f0[_0x7b13('0x3c')]:_0x170631[_0x7b13('0x38')];if(_0x115842[_0x7b13('0x39')]['includeAll']){_0x4351f0['include']=[{'all':!![]}];}_0x4351f0=_[_0x7b13('0x46')]({},_0x4351f0,_0x115842[_0x7b13('0x4b')]);return db['Network'][_0x7b13('0x51')](_0x4351f0)[_0x7b13('0x1e')](handleEntityNotFound(_0x40397a,null))[_0x7b13('0x1e')](respondWithResult(_0x40397a,null))[_0x7b13('0x28')](handleError(_0x40397a,null));};exports['create']=function(_0xdebc59,_0x42c447,_0x308ef0){var _0x497ad4;return db[_0x7b13('0x52')]['transaction'](function(_0x2cfcc0){return db[_0x7b13('0x35')][_0x7b13('0x53')](_0xdebc59['body'],{'raw':!![]})[_0x7b13('0x1e')](function(_0x19ac04){_0x497ad4=_0x19ac04;return db[_0x7b13('0x35')][_0x7b13('0x4e')]({'where':{'type':_0xdebc59[_0x7b13('0x54')][_0x7b13('0x48')]},'raw':!![]});})[_0x7b13('0x1e')](function(_0x354f63){if(_0x497ad4[_0x7b13('0x48')][_0x7b13('0x55')]()==_0x7b13('0x56')){var _0x2b59eb=fs[_0x7b13('0x57')](path[_0x7b13('0x58')](config[_0x7b13('0x59')],_0x7b13('0x5a')),_0x7b13('0x5b'));var _0x2534e9=ejs[_0x7b13('0x5c')](_0x2b59eb,{'networks':_0x354f63||[]});fs[_0x7b13('0x5d')](_0x7b13('0x5e'),_0x2534e9);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x53'),{'module':'res_stun_monitor.so'});}else if(_0x497ad4[_0x7b13('0x48')][_0x7b13('0x55')]()==_0x7b13('0x60')){var _0x17e3e1=fs[_0x7b13('0x57')](path[_0x7b13('0x58')](config[_0x7b13('0x59')],_0x7b13('0x61')),_0x7b13('0x5b'));var _0x4e421c=ejs[_0x7b13('0x5c')](_0x17e3e1,{'networks':_0x354f63||[]});fs[_0x7b13('0x5d')](_0x7b13('0x62'),_0x4e421c);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x53'),{'module':_0x7b13('0x63')});}else{var _0xd76521=fs[_0x7b13('0x57')](path[_0x7b13('0x58')](config['root'],_0x7b13('0x64')),'utf8');var _0x56a115=ejs['render'](_0xd76521,{'networks':_0x354f63||[]});fs[_0x7b13('0x5d')](util[_0x7b13('0x65')](_0x7b13('0x66'),_0xdebc59[_0x7b13('0x54')][_0x7b13('0x48')]['toLowerCase']()),_0x56a115);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x53'),{'module':_0x7b13('0x67')});}return null;})[_0x7b13('0x1e')](function(){return _0x497ad4;});})[_0x7b13('0x1e')](respondWithResult(_0x42c447,0xc9))[_0x7b13('0x28')](handleError(_0x42c447,null));};exports[_0x7b13('0x2f')]=function(_0x37980b,_0xb1f43a,_0x224561){var _0x137946;return db[_0x7b13('0x52')][_0x7b13('0x68')](function(_0x375470){return db[_0x7b13('0x35')][_0x7b13('0x51')]({'where':{'id':_0x37980b['params']['id']}})[_0x7b13('0x1e')](handleEntityNotFound(_0xb1f43a,null))[_0x7b13('0x1e')](saveUpdates(_0x37980b[_0x7b13('0x54')],null))[_0x7b13('0x1e')](function(_0xe2d672){if(_0xe2d672){_0x137946=_0xe2d672;return db[_0x7b13('0x35')][_0x7b13('0x4e')]({'where':{'type':_0x137946['type']},'raw':!![]});}return null;})[_0x7b13('0x1e')](function(_0x4f7310){if(_0x137946[_0x7b13('0x48')]['toUpperCase']()==_0x7b13('0x56')){var _0x108e5a=fs[_0x7b13('0x57')](path[_0x7b13('0x58')](config[_0x7b13('0x59')],'server/files/templates/stun_multiple.ejs'),_0x7b13('0x5b'));var _0x5a9676=ejs['render'](_0x108e5a,{'networks':_0x4f7310||[]});fs[_0x7b13('0x5d')](_0x7b13('0x5e'),_0x5a9676);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x2f'),{'module':_0x7b13('0x63')});}else if(_0x137946[_0x7b13('0x48')]['toUpperCase']()==_0x7b13('0x60')){var _0x1e2303=fs[_0x7b13('0x57')](path[_0x7b13('0x58')](config[_0x7b13('0x59')],_0x7b13('0x61')),_0x7b13('0x5b'));var _0x4d0a0e=ejs[_0x7b13('0x5c')](_0x1e2303,{'networks':_0x4f7310||[]});fs[_0x7b13('0x5d')](_0x7b13('0x62'),_0x4d0a0e);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x2f'),{'module':_0x7b13('0x63')});}else{var _0x1f1c28=fs[_0x7b13('0x57')](path['join'](config[_0x7b13('0x59')],_0x7b13('0x64')),'utf8');var _0x4fcb51=ejs['render'](_0x1f1c28,{'networks':_0x4f7310||[]});fs['writeFileSync'](util[_0x7b13('0x65')](_0x7b13('0x66'),_0x37980b[_0x7b13('0x54')][_0x7b13('0x48')][_0x7b13('0x69')]()),_0x4fcb51);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x2f'),{'module':_0x7b13('0x67')});}return null;})[_0x7b13('0x1e')](function(_0x5da027){if(_0x5da027){return _0x137946;}return null;});})[_0x7b13('0x1e')](respondWithResult(_0xb1f43a,null))['catch'](handleError(_0xb1f43a,null));};exports[_0x7b13('0x6a')]=function(_0x51c34e,_0x145573,_0x31a0b9){var _0x3117b2;return db[_0x7b13('0x35')][_0x7b13('0x51')]({'where':{'id':_0x51c34e[_0x7b13('0x6b')]['id']}})[_0x7b13('0x1e')](function(_0x4af0c4){_0x3117b2=_0x4af0c4;return _0x4af0c4;})[_0x7b13('0x1e')](handleEntityNotFound(_0x145573,null))[_0x7b13('0x1e')](removeEntity(_0x145573,null))[_0x7b13('0x1e')](function(){if(_0x3117b2){return db['Network']['findAll']({'where':{'type':_0x3117b2[_0x7b13('0x48')]},'raw':!![]});}})[_0x7b13('0x1e')](function(_0x33a2c2){if(_0x3117b2[_0x7b13('0x48')][_0x7b13('0x55')]()=='STUN'){var _0x34f41d=fs[_0x7b13('0x57')](path[_0x7b13('0x58')](config[_0x7b13('0x59')],_0x7b13('0x5a')),_0x7b13('0x5b'));var _0x3b1f5=ejs[_0x7b13('0x5c')](_0x34f41d,{'networks':_0x33a2c2||[]});fs[_0x7b13('0x5d')](_0x7b13('0x5e'),_0x3b1f5);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x6a'),{'module':_0x7b13('0x63')});}else if(_0x3117b2[_0x7b13('0x48')][_0x7b13('0x55')]()=='TURN'){var _0x19b197=fs['readFileSync'](path[_0x7b13('0x58')](config[_0x7b13('0x59')],_0x7b13('0x61')),_0x7b13('0x5b'));var _0x3d7e80=ejs[_0x7b13('0x5c')](_0x19b197,{'networks':_0x33a2c2||[]});fs[_0x7b13('0x5d')](_0x7b13('0x62'),_0x3d7e80);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x6a'),{'module':'res_stun_monitor.so'});}else{var _0x5eeb6e=fs[_0x7b13('0x57')](path[_0x7b13('0x58')](config[_0x7b13('0x59')],_0x7b13('0x64')),'utf8');var _0x35bcfd=ejs[_0x7b13('0x5c')](_0x5eeb6e,{'networks':_0x33a2c2||[]});fs[_0x7b13('0x5d')](util[_0x7b13('0x65')](_0x7b13('0x66'),_0x51c34e[_0x7b13('0x54')][_0x7b13('0x48')][_0x7b13('0x69')]()),_0x35bcfd);return respondWithRpcPromise(_0x7b13('0x5f'),_0x7b13('0x6a'),{'module':_0x7b13('0x67')});}return null;})[_0x7b13('0x28')](handleError(_0x145573,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5ce3e6e..81a50d1 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 _0xc46e=['exports','define','Network','network','lodash','util','api','request-promise','path','rimraf','./network.attributes'];(function(_0x50b072,_0x52b175){var _0x257025=function(_0x5ae4c4){while(--_0x5ae4c4){_0x50b072['push'](_0x50b072['shift']());}};_0x257025(++_0x52b175);}(_0xc46e,0x88));var _0xec46=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0xc46e[_0x40ebff];return _0x40122a;};'use strict';var _=require(_0xec46('0x0'));var util=require(_0xec46('0x1'));var logger=require('../../config/logger')(_0xec46('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec46('0x3'));var fs=require('fs');var path=require(_0xec46('0x4'));var rimraf=require(_0xec46('0x5'));var config=require('../../config/environment');var attributes=require(_0xec46('0x6'));module[_0xec46('0x7')]=function(_0x34b10a,_0xf00cd9){return _0x34b10a[_0xec46('0x8')](_0xec46('0x9'),attributes,{'tableName':_0xec46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f59=['rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x23e02e,_0x4d26cb){var _0x2a6db8=function(_0x46e7af){while(--_0x46e7af){_0x23e02e['push'](_0x23e02e['shift']());}};_0x2a6db8(++_0x4d26cb);}(_0x5f59,0xca));var _0x95f5=function(_0x2a93cb,_0x537c30){_0x2a93cb=_0x2a93cb-0x0;var _0x443c0c=_0x5f59[_0x2a93cb];return _0x443c0c;};'use strict';var _=require(_0x95f5('0x0'));var util=require('util');var logger=require(_0x95f5('0x1'))(_0x95f5('0x2'));var moment=require(_0x95f5('0x3'));var BPromise=require('bluebird');var rp=require(_0x95f5('0x4'));var fs=require('fs');var path=require(_0x95f5('0x5'));var rimraf=require(_0x95f5('0x6'));var config=require(_0x95f5('0x7'));var attributes=require(_0x95f5('0x8'));module[_0x95f5('0x9')]=function(_0x10a81f,_0x5042a4){return _0x10a81f[_0x95f5('0xa')](_0x95f5('0xb'),attributes,{'tableName':_0x95f5('0xc'),'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 1401d38..a28cfeb 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 _0x6af9=['jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1c6ca1,_0x298553){var _0x5ebcc2=function(_0x27bc18){while(--_0x27bc18){_0x1c6ca1['push'](_0x1c6ca1['shift']());}};_0x5ebcc2(++_0x298553);}(_0x6af9,0x12c));var _0x96af=function(_0x1c146f,_0x1184a2){_0x1c146f=_0x1c146f-0x0;var _0x15f322=_0x6af9[_0x1c146f];return _0x15f322;};'use strict';var _=require('lodash');var util=require(_0x96af('0x0'));var moment=require('moment');var BPromise=require(_0x96af('0x1'));var rs=require(_0x96af('0x2'));var fs=require('fs');var Redis=require(_0x96af('0x3'));var db=require(_0x96af('0x4'))['db'];var utils=require(_0x96af('0x5'));var logger=require('../../config/logger')(_0x96af('0x6'));var config=require(_0x96af('0x7'));var jayson=require(_0x96af('0x8'));var client=jayson[_0x96af('0x9')][_0x96af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c973f,_0x4f0ff7,_0x50e51b){return new BPromise(function(_0x2a8356,_0x2da6f0){return client[_0x96af('0xb')](_0x4c973f,_0x50e51b)['then'](function(_0x53d672){logger['info'](_0x96af('0xc'),_0x4f0ff7,_0x96af('0xd'));logger['debug'](_0x96af('0xe'),_0x4f0ff7,'request\x20sent',JSON[_0x96af('0xf')](_0x53d672));if(_0x53d672['error']){if(_0x53d672[_0x96af('0x10')][_0x96af('0x11')]===0x1f4){logger[_0x96af('0x10')](_0x96af('0xc'),_0x4f0ff7,_0x53d672[_0x96af('0x10')][_0x96af('0x12')]);return _0x2da6f0(_0x53d672[_0x96af('0x10')][_0x96af('0x12')]);}logger[_0x96af('0x10')](_0x96af('0xc'),_0x4f0ff7,_0x53d672[_0x96af('0x10')][_0x96af('0x12')]);return _0x2a8356(_0x53d672[_0x96af('0x10')]['message']);}else{logger[_0x96af('0x13')](_0x96af('0xc'),_0x4f0ff7,_0x96af('0xd'));_0x2a8356(_0x53d672[_0x96af('0x14')]['message']);}})[_0x96af('0x15')](function(_0x14e256){logger[_0x96af('0x10')](_0x96af('0xc'),_0x4f0ff7,_0x14e256);_0x2da6f0(_0x14e256);});});} \ No newline at end of file +var _0x9ded=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x9ded,0x9a));var _0xd9de=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x9ded[_0x54bac5];return _0xc15971;};'use strict';var _=require(_0xd9de('0x0'));var util=require(_0xd9de('0x1'));var moment=require('moment');var BPromise=require(_0xd9de('0x2'));var rs=require(_0xd9de('0x3'));var fs=require('fs');var Redis=require(_0xd9de('0x4'));var db=require(_0xd9de('0x5'))['db'];var utils=require(_0xd9de('0x6'));var logger=require(_0xd9de('0x7'))(_0xd9de('0x8'));var config=require(_0xd9de('0x9'));var jayson=require(_0xd9de('0xa'));var client=jayson[_0xd9de('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x145c5d,_0x4919ac,_0x294731){return new BPromise(function(_0x31f4e1,_0x3e5517){return client[_0xd9de('0xc')](_0x145c5d,_0x294731)[_0xd9de('0xd')](function(_0x491711){logger[_0xd9de('0xe')](_0xd9de('0xf'),_0x4919ac,_0xd9de('0x10'));logger[_0xd9de('0x11')](_0xd9de('0x12'),_0x4919ac,_0xd9de('0x10'),JSON[_0xd9de('0x13')](_0x491711));if(_0x491711['error']){if(_0x491711[_0xd9de('0x14')][_0xd9de('0x15')]===0x1f4){logger[_0xd9de('0x14')]('Network,\x20%s,\x20%s',_0x4919ac,_0x491711[_0xd9de('0x14')][_0xd9de('0x16')]);return _0x3e5517(_0x491711[_0xd9de('0x14')][_0xd9de('0x16')]);}logger['error'](_0xd9de('0xf'),_0x4919ac,_0x491711[_0xd9de('0x14')]['message']);return _0x31f4e1(_0x491711[_0xd9de('0x14')][_0xd9de('0x16')]);}else{logger['info'](_0xd9de('0xf'),_0x4919ac,_0xd9de('0x10'));_0x31f4e1(_0x491711[_0xd9de('0x17')][_0xd9de('0x16')]);}})[_0xd9de('0x18')](function(_0x235b83){logger['error'](_0xd9de('0xf'),_0x4919ac,_0x235b83);_0x3e5517(_0x235b83);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 8a17733..58df19f 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 _0x93f4=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','util'];(function(_0x5a5c54,_0x2f00ca){var _0x694bd=function(_0x4ac52){while(--_0x4ac52){_0x5a5c54['push'](_0x5a5c54['shift']());}};_0x694bd(++_0x2f00ca);}(_0x93f4,0x81));var _0x493f=function(_0x47804c,_0x3e5804){_0x47804c=_0x47804c-0x0;var _0x3d0b01=_0x93f4[_0x47804c];return _0x3d0b01;};'use strict';var multer=require('multer');var util=require(_0x493f('0x0'));var path=require(_0x493f('0x1'));var timeout=require(_0x493f('0x2'));var express=require(_0x493f('0x3'));var router=express['Router']();var auth=require(_0x493f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x493f('0x5'));var controller=require(_0x493f('0x6'));router[_0x493f('0x7')]('/',auth[_0x493f('0x8')](),controller[_0x493f('0x9')]);module['exports']=router; \ No newline at end of file +var _0x5343=['../../components/interaction/service','../../config/environment','./notification.controller','sendNotification','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x5343,0x177));var _0x3534=function(_0x181cd3,_0x51a423){_0x181cd3=_0x181cd3-0x0;var _0x5a9868=_0x5343[_0x181cd3];return _0x5a9868;};'use strict';var multer=require(_0x3534('0x0'));var util=require(_0x3534('0x1'));var path=require('path');var timeout=require(_0x3534('0x2'));var express=require(_0x3534('0x3'));var router=express['Router']();var auth=require(_0x3534('0x4'));var interaction=require(_0x3534('0x5'));var config=require(_0x3534('0x6'));var controller=require(_0x3534('0x7'));router['post']('/',auth['isAuthenticated'](),controller[_0x3534('0x8')]);module[_0x3534('0x9')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 6b6a80d..67db428 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 _0x5ff9=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x27bc63,_0x203fed){var _0x55a732=function(_0x133f5e){while(--_0x133f5e){_0x27bc63['push'](_0x27bc63['shift']());}};_0x55a732(++_0x203fed);}(_0x5ff9,0x177));var _0x95ff=function(_0x41ce1a,_0x2b3825){_0x41ce1a=_0x41ce1a-0x0;var _0x4a24ff=_0x5ff9[_0x41ce1a];return _0x4a24ff;};'use strict';var Sequelize=require(_0x95ff('0x0'));module[_0x95ff('0x1')]={'body':{'type':Sequelize[_0x95ff('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x95ff('0x3')]},'beep':{'type':Sequelize[_0x95ff('0x4')]}}; \ No newline at end of file +var _0x2665=['exports','TEXT','STRING','BOOLEAN'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2665,0x170));var _0x5266=function(_0x28fc95,_0xf8149a){_0x28fc95=_0x28fc95-0x0;var _0x2e38f0=_0x2665[_0x28fc95];return _0x2e38f0;};'use strict';var Sequelize=require('sequelize');module[_0x5266('0x0')]={'body':{'type':Sequelize[_0x5266('0x1')]},'senderName':{'type':Sequelize[_0x5266('0x2')]},'recipientsId':{'type':Sequelize[_0x5266('0x1')]},'recipientsDescription':{'type':Sequelize[_0x5266('0x2')]},'beep':{'type':Sequelize[_0x5266('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 0f37408..87e8e4b 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 _0x189f=['recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','some','includes','model','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','queue','Queue','ids','all','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','error','stack','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view'];(function(_0x211db0,_0x4356c8){var _0x805e20=function(_0x1503b9){while(--_0x1503b9){_0x211db0['push'](_0x211db0['shift']());}};_0x805e20(++_0x4356c8);}(_0x189f,0x145));var _0xf189=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x189f[_0x4d79bc];return _0x4b4760;};'use strict';var pdf=require(_0xf189('0x0'));var emlformat=require(_0xf189('0x1'));var rimraf=require(_0xf189('0x2'));var zipdir=require(_0xf189('0x3'));var jsonpatch=require(_0xf189('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf189('0x5'));var util=require(_0xf189('0x6'));var path=require(_0xf189('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf189('0x8'));var fs=require('fs');var _=require(_0xf189('0x9'));var squel=require(_0xf189('0xa'));var crypto=require(_0xf189('0xb'));var jsforce=require(_0xf189('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf189('0xd'));var Papa=require(_0xf189('0xe'));var Redis=require('ioredis');var authService=require(_0xf189('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf189('0x10'));var hardwareService=require(_0xf189('0x11'));var logger=require(_0xf189('0x12'))(_0xf189('0x13'));var utils=require('../../config/utils');var config=require(_0xf189('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf189('0x15')]=_['defaults'](config[_0xf189('0x15')],{'host':_0xf189('0x16'),'port':0x18eb});var socket=require(_0xf189('0x17'))(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x1634f2,_0x30bda1){_0x30bda1=_0x30bda1||0xcc;return function(_0x1e05d3){if(_0x1e05d3){return _0x1634f2[_0xf189('0x18')](_0x30bda1);}return _0x1634f2[_0xf189('0x19')](_0x30bda1)[_0xf189('0x1a')]();};}function respondWithResult(_0x5b7889,_0x40f6b0){_0x40f6b0=_0x40f6b0||0xc8;return function(_0x5e458c){if(_0x5e458c){return _0x5b7889[_0xf189('0x19')](_0x40f6b0)[_0xf189('0x1b')](_0x5e458c);}};}function respondWithFilteredResult(_0x568e4a,_0x5c5c55){return function(_0x543678){if(_0x543678){var _0x1b1e31=_0x543678[_0xf189('0x1c')],_0x2ec131=_0x5c5c55[_0xf189('0x1d')],_0x4912a6=_0x5c5c55[_0xf189('0x1d')]+_0x5c5c55[_0xf189('0x1e')],_0x52f4b8;if(_0x4912a6>=_0x1b1e31){_0x4912a6=_0x1b1e31;_0x52f4b8=0xc8;}else{_0x52f4b8=0xce;}_0x568e4a['status'](_0x52f4b8);return _0x568e4a[_0xf189('0x1f')]('Content-Range',_0x2ec131+'-'+_0x4912a6+'/'+_0x1b1e31)[_0xf189('0x1b')](_0x543678);}return null;};}function patchUpdates(_0x24c868){return function(_0x15ccd8){try{jsonpatch['apply'](_0x15ccd8,_0x24c868,!![]);}catch(_0x479085){return BPromise[_0xf189('0x20')](_0x479085);}return _0x15ccd8['save']();};}function saveUpdates(_0x507d4c,_0x1980da){return function(_0x21c240){if(_0x21c240){return _0x21c240[_0xf189('0x21')](_0x507d4c)[_0xf189('0x22')](function(_0xc28f41){return _0xc28f41;});}return null;};}function removeEntity(_0x17ee9c,_0x844a6){return function(_0xe70b39){if(_0xe70b39){return _0xe70b39['destroy']()['then'](function(){_0x17ee9c[_0xf189('0x19')](0xcc)[_0xf189('0x1a')]();});}};}function handleEntityNotFound(_0x3b6d81,_0x59730f){return function(_0x340697){if(!_0x340697){_0x3b6d81['sendStatus'](0x194);}return _0x340697;};}function handleError(_0x48eb70,_0x171e79){_0x171e79=_0x171e79||0x1f4;return function(_0x277546){logger[_0xf189('0x23')](_0x277546[_0xf189('0x24')]);if(_0x277546['name']){delete _0x277546['name'];}_0x48eb70[_0xf189('0x19')](_0x171e79)[_0xf189('0x25')](_0x277546);};}exports[_0xf189('0x26')]=function(_0x183af1,_0x31678e,_0x51a9b1){if(!_0x183af1['body'][_0xf189('0x27')](_0xf189('0x28'))&&!_0x183af1[_0xf189('0x29')]['hasOwnProperty'](_0xf189('0x2a'))){throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))](_0xf189('0x2d'));}else{if(_0x183af1[_0xf189('0x29')][_0xf189('0x27')](_0xf189('0x2a'))&&!_0x183af1[_0xf189('0x29')]['hasOwnProperty'](_0xf189('0x2e'))){throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x183af1['body'][_0xf189('0x27')](_0xf189('0x2f'))){throw new db[(_0xf189('0x2b'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5d8c08=JSON['parse'](_0x183af1[_0xf189('0x29')]['recipients']);}catch(_0x8de851){logger[_0xf189('0x23')](_0x8de851);throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))](_0xf189('0x30'));}var _0x1f0bf4=[_0xf189('0x31'),_0xf189('0x32'),_0xf189('0x33'),_0xf189('0x34'),_0xf189('0x35'),_0xf189('0x36'),'whatsappqueue',_0xf189('0x37'),'user'];if(_[_0xf189('0x38')](_0x5d8c08,function(_0x4f4440){return!_[_0xf189('0x39')](_0x1f0bf4,_0x4f4440[_0xf189('0x3a')]['toLowerCase']());})){throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0xb2f2e={};_0xb2f2e[_0xf189('0x3b')]=_0x183af1[_0xf189('0x29')][_0xf189('0x27')]('senderName')?_0x183af1['body']['senderName']:_0x183af1[_0xf189('0x3c')][_0xf189('0x3d')];_0xb2f2e[_0xf189('0x3e')]=_[_0xf189('0x3f')](_0x183af1[_0xf189('0x29')][_0xf189('0x3e')])?null:_0x183af1[_0xf189('0x29')][_0xf189('0x3e')];_0xb2f2e[_0xf189('0x40')]=_0x183af1['body'][_0xf189('0x40')]||![];_0xb2f2e[_0xf189('0x41')]=_0x183af1[_0xf189('0x3c')]['id'];return getContent(_0x183af1['body'])['then'](function(_0x27dd45){_0xb2f2e['body']=_0x27dd45;return getRecipients(_0x5d8c08);})[_0xf189('0x22')](function(_0x337753){_0xb2f2e[_0xf189('0x42')]=_[_0xf189('0x43')](_0x337753)[_0xf189('0x44')](',');return db[_0xf189('0x45')][_0xf189('0x46')](function(_0x33ec76){return db['Notification'][_0xf189('0x47')](_0xb2f2e,{'raw':!![],'transaction':_0x33ec76})[_0xf189('0x22')](function(_0x165bdf){var _0x122bbd={'sender':_0xb2f2e[_0xf189('0x3b')],'description':_0xb2f2e['recipientsDescription'],'content':_0xb2f2e[_0xf189('0x29')],'beep':_0xb2f2e[_0xf189('0x40')]};_0x337753[_0xf189('0x48')](function(_0x36797f){_0x122bbd[_0xf189('0x49')]=_0x36797f;socket[_0xf189('0x4a')](_0xf189('0x4b'),_0x122bbd);});return _0x165bdf;});});})[_0xf189('0x22')](respondWithResult(_0x31678e,0xc9))[_0xf189('0x4c')](handleError(_0x31678e,null));};function getContent(_0x54d5e1){return new BPromise(function(_0x1af6fd,_0x1a4ed3){if(_0x54d5e1[_0xf189('0x28')]){_0x1af6fd(_0x54d5e1['text']);return;}return db[_0xf189('0x4d')][_0xf189('0x4e')]({'attributes':[_0xf189('0x4f')],'where':{'id':_0x54d5e1[_0xf189('0x2a')]},'raw':!![]})[_0xf189('0x22')](function(_0x5ecf24){if(!_0x5ecf24)throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))](_0xf189('0x50'));var _0x278d27=Mustache[_0xf189('0x51')](_0x5ecf24['html'],_0x54d5e1[_0xf189('0x2e')]);_0x1af6fd(_0x278d27);})[_0xf189('0x4c')](function(_0x346beb){_0x1a4ed3(_0x346beb);});});}function getRecipients(_0x253442){return new BPromise(function(_0x5e650f,_0xf66512){var _0x3e7288=[];var _0x44f87e=[];_0x253442[_0xf189('0x48')](function(_0x14d488){var _0x3274f2=_[_0xf189('0x52')](_0x14d488[_0xf189('0x3a')][_0xf189('0x53')]());if(_0x3274f2===_0xf189('0x54')){_0x3e7288=_['union'](_0x3e7288,_0x14d488['ids']);}else{if(_[_0xf189('0x39')](_0x3274f2,_0xf189('0x55')))_0x3274f2=_0x3274f2['replace'](_0xf189('0x55'),_0xf189('0x56'));_0x14d488[_0xf189('0x57')][_0xf189('0x48')](function(_0x409056){_0x44f87e['push'](getAgents(_0x3274f2,_0x409056));});}});return BPromise[_0xf189('0x58')](_0x44f87e)['then'](function(_0x37bfa7){_0x3e7288=_[_0xf189('0x59')](_0x3e7288,_[_0xf189('0x5a')](_0x37bfa7));_0x5e650f(_0x3e7288);})[_0xf189('0x4c')](function(_0x425a5f){_0xf66512(_0x425a5f);});});}function getAgents(_0x135c2f,_0x107c19){return new BPromise(function(_0x3f5a91,_0x58088c){return db[_0x135c2f][_0xf189('0x4e')]({'where':{'id':_0x107c19}})['then'](function(_0x39ec65){return _0x39ec65[_0xf189('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb586e){var _0x10fefb=_[_0xf189('0x5c')](_0xb586e,'id');_0x3f5a91(_0x10fefb);});})[_0xf189('0x4c')](function(_0x584061){_0x58088c(_0x584061);});});} \ No newline at end of file +var _0x7428=['socket.io-emitter','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','Notification','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','queue','replace','Queue','ids','forEach','push','flatten','getAgents','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x16ec7b,_0x4f884b){var _0x10f477=function(_0x94a85a){while(--_0x94a85a){_0x16ec7b['push'](_0x16ec7b['shift']());}};_0x10f477(++_0x4f884b);}(_0x7428,0xfc));var _0x8742=function(_0x2622d0,_0xffe561){_0x2622d0=_0x2622d0-0x0;var _0x34eddd=_0x7428[_0x2622d0];return _0x34eddd;};'use strict';var pdf=require(_0x8742('0x0'));var emlformat=require(_0x8742('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8742('0x2'));var jsonpatch=require(_0x8742('0x3'));var rp=require(_0x8742('0x4'));var moment=require(_0x8742('0x5'));var BPromise=require(_0x8742('0x6'));var Mustache=require(_0x8742('0x7'));var util=require(_0x8742('0x8'));var path=require(_0x8742('0x9'));var sox=require(_0x8742('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8742('0xb'));var squel=require(_0x8742('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8742('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8742('0xe'));var authService=require(_0x8742('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8742('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8742('0x11'));var utils=require(_0x8742('0x12'));var config=require(_0x8742('0x13'));var licenseUtil=require(_0x8742('0x14'));var db=require('../../mysqldb')['db'];config[_0x8742('0x15')]=_[_0x8742('0x16')](config[_0x8742('0x15')],{'host':_0x8742('0x17'),'port':0x18eb});var socket=require(_0x8742('0x18'))(new Redis(config[_0x8742('0x15')]));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x40b30a,_0x175a4a){_0x175a4a=_0x175a4a||0xcc;return function(_0x3ab45c){if(_0x3ab45c){return _0x40b30a[_0x8742('0x19')](_0x175a4a);}return _0x40b30a[_0x8742('0x1a')](_0x175a4a)[_0x8742('0x1b')]();};}function respondWithResult(_0x1f0126,_0x573ca3){_0x573ca3=_0x573ca3||0xc8;return function(_0x5e6cf6){if(_0x5e6cf6){return _0x1f0126[_0x8742('0x1a')](_0x573ca3)[_0x8742('0x1c')](_0x5e6cf6);}};}function respondWithFilteredResult(_0xcbf383,_0x1e6c0c){return function(_0xfcd7a7){if(_0xfcd7a7){var _0x24e0eb=_0xfcd7a7[_0x8742('0x1d')],_0x5bde3e=_0x1e6c0c[_0x8742('0x1e')],_0x3130e1=_0x1e6c0c[_0x8742('0x1e')]+_0x1e6c0c[_0x8742('0x1f')],_0x127940;if(_0x3130e1>=_0x24e0eb){_0x3130e1=_0x24e0eb;_0x127940=0xc8;}else{_0x127940=0xce;}_0xcbf383[_0x8742('0x1a')](_0x127940);return _0xcbf383['set']('Content-Range',_0x5bde3e+'-'+_0x3130e1+'/'+_0x24e0eb)[_0x8742('0x1c')](_0xfcd7a7);}return null;};}function patchUpdates(_0x2adc25){return function(_0x3223d9){try{jsonpatch[_0x8742('0x20')](_0x3223d9,_0x2adc25,!![]);}catch(_0x4ffddf){return BPromise['reject'](_0x4ffddf);}return _0x3223d9[_0x8742('0x21')]();};}function saveUpdates(_0x26613b,_0x3f2bfd){return function(_0x515e04){if(_0x515e04){return _0x515e04[_0x8742('0x22')](_0x26613b)[_0x8742('0x23')](function(_0x57dd1b){return _0x57dd1b;});}return null;};}function removeEntity(_0x433632,_0x1a7029){return function(_0x487ecb){if(_0x487ecb){return _0x487ecb[_0x8742('0x24')]()[_0x8742('0x23')](function(){_0x433632[_0x8742('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe4824c,_0x10de26){return function(_0x328183){if(!_0x328183){_0xe4824c[_0x8742('0x19')](0x194);}return _0x328183;};}function handleError(_0x16d8a0,_0x2f6b19){_0x2f6b19=_0x2f6b19||0x1f4;return function(_0x312338){logger[_0x8742('0x25')](_0x312338[_0x8742('0x26')]);if(_0x312338[_0x8742('0x27')]){delete _0x312338[_0x8742('0x27')];}_0x16d8a0[_0x8742('0x1a')](_0x2f6b19)[_0x8742('0x28')](_0x312338);};}exports['sendNotification']=function(_0x5e8a51,_0x51dc5c,_0x552f19){if(!_0x5e8a51[_0x8742('0x29')][_0x8742('0x2a')](_0x8742('0x2b'))&&!_0x5e8a51[_0x8742('0x29')][_0x8742('0x2a')](_0x8742('0x2c'))){throw new db[(_0x8742('0x2d'))][(_0x8742('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5e8a51[_0x8742('0x29')][_0x8742('0x2a')](_0x8742('0x2c'))&&!_0x5e8a51[_0x8742('0x29')]['hasOwnProperty'](_0x8742('0x2f'))){throw new db[(_0x8742('0x2d'))][(_0x8742('0x2e'))](_0x8742('0x30'));}if(!_0x5e8a51[_0x8742('0x29')][_0x8742('0x2a')](_0x8742('0x31'))){throw new db['Sequelize'][(_0x8742('0x2e'))](_0x8742('0x32'));}else{try{var _0x62561b=JSON['parse'](_0x5e8a51[_0x8742('0x29')]['recipients']);}catch(_0x31d94b){logger[_0x8742('0x25')](_0x31d94b);throw new db['Sequelize'][(_0x8742('0x2e'))](_0x8742('0x33'));}var _0x475e57=[_0x8742('0x34'),_0x8742('0x35'),_0x8742('0x36'),_0x8742('0x37'),_0x8742('0x38'),_0x8742('0x39'),_0x8742('0x3a'),_0x8742('0x3b'),_0x8742('0x3c')];if(_[_0x8742('0x3d')](_0x62561b,function(_0xa2f79a){return!_[_0x8742('0x3e')](_0x475e57,_0xa2f79a[_0x8742('0x3f')][_0x8742('0x40')]());})){throw new db[(_0x8742('0x2d'))][(_0x8742('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x1216f7={};_0x1216f7[_0x8742('0x41')]=_0x5e8a51[_0x8742('0x29')][_0x8742('0x2a')](_0x8742('0x41'))?_0x5e8a51[_0x8742('0x29')][_0x8742('0x41')]:_0x5e8a51[_0x8742('0x3c')][_0x8742('0x42')];_0x1216f7[_0x8742('0x43')]=_[_0x8742('0x44')](_0x5e8a51['body'][_0x8742('0x43')])?null:_0x5e8a51[_0x8742('0x29')][_0x8742('0x43')];_0x1216f7[_0x8742('0x45')]=_0x5e8a51[_0x8742('0x29')][_0x8742('0x45')]||![];_0x1216f7[_0x8742('0x46')]=_0x5e8a51['user']['id'];return getContent(_0x5e8a51['body'])[_0x8742('0x23')](function(_0x1497ec){_0x1216f7['body']=_0x1497ec;return getRecipients(_0x62561b);})[_0x8742('0x23')](function(_0x46fd72){_0x1216f7['recipientsId']=_[_0x8742('0x47')](_0x46fd72)['join'](',');return db['sequelize']['transaction'](function(_0x4de58c){return db[_0x8742('0x48')]['create'](_0x1216f7,{'raw':!![],'transaction':_0x4de58c})[_0x8742('0x23')](function(_0x2a1583){var _0x38d94b={'sender':_0x1216f7[_0x8742('0x41')],'description':_0x1216f7['recipientsDescription'],'content':_0x1216f7['body'],'beep':_0x1216f7[_0x8742('0x45')]};_0x46fd72['forEach'](function(_0x34ca01){_0x38d94b[_0x8742('0x49')]=_0x34ca01;socket['emit']('notification:send',_0x38d94b);});return _0x2a1583;});});})[_0x8742('0x23')](respondWithResult(_0x51dc5c,0xc9))[_0x8742('0x4a')](handleError(_0x51dc5c,null));};function getContent(_0x21169f){return new BPromise(function(_0x48cabe,_0x2fb340){if(_0x21169f[_0x8742('0x2b')]){_0x48cabe(_0x21169f[_0x8742('0x2b')]);return;}return db[_0x8742('0x4b')][_0x8742('0x4c')]({'attributes':[_0x8742('0x4d')],'where':{'id':_0x21169f[_0x8742('0x2c')]},'raw':!![]})[_0x8742('0x23')](function(_0x24a4a9){if(!_0x24a4a9)throw new db[(_0x8742('0x2d'))][(_0x8742('0x2e'))](_0x8742('0x4e'));var _0x55794d=Mustache[_0x8742('0x4f')](_0x24a4a9[_0x8742('0x4d')],_0x21169f[_0x8742('0x2f')]);_0x48cabe(_0x55794d);})['catch'](function(_0xf6c963){_0x2fb340(_0xf6c963);});});}function getRecipients(_0x1f0c76){return new BPromise(function(_0x51ac62,_0x16e932){var _0x44d004=[];var _0x2f8798=[];_0x1f0c76['forEach'](function(_0x18c20f){var _0x21d47e=_[_0x8742('0x50')](_0x18c20f['model']['toLowerCase']());if(_0x21d47e===_0x8742('0x51')){_0x44d004=_[_0x8742('0x52')](_0x44d004,_0x18c20f['ids']);}else{if(_[_0x8742('0x3e')](_0x21d47e,_0x8742('0x53')))_0x21d47e=_0x21d47e[_0x8742('0x54')](_0x8742('0x53'),_0x8742('0x55'));_0x18c20f[_0x8742('0x56')][_0x8742('0x57')](function(_0x16857e){_0x2f8798[_0x8742('0x58')](getAgents(_0x21d47e,_0x16857e));});}});return BPromise['all'](_0x2f8798)[_0x8742('0x23')](function(_0x1306ca){_0x44d004=_['union'](_0x44d004,_[_0x8742('0x59')](_0x1306ca));_0x51ac62(_0x44d004);})[_0x8742('0x4a')](function(_0x2b6ae0){_0x16e932(_0x2b6ae0);});});}function getAgents(_0x128806,_0x9fc49b){return new BPromise(function(_0x39c1d5,_0xa87c54){return db[_0x128806][_0x8742('0x4c')]({'where':{'id':_0x9fc49b}})[_0x8742('0x23')](function(_0xe6413e){return _0xe6413e[_0x8742('0x5a')]({'attributes':['id'],'raw':!![]})[_0x8742('0x23')](function(_0x2e7891){var _0x314b80=_[_0x8742('0x5b')](_0x2e7891,'id');_0x39c1d5(_0x314b80);});})[_0x8742('0x4a')](function(_0x5eec28){_0xa87c54(_0x5eec28);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index f87b314..535d906 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 _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x4f960a,_0x1cba55){var _0x46207c=function(_0x114c72){while(--_0x114c72){_0x4f960a['push'](_0x4f960a['shift']());}};_0x46207c(++_0x1cba55);}(_0x757a,0xde));var _0xa757=function(_0xaf11be,_0x4d8732){_0xaf11be=_0xaf11be-0x0;var _0x2a38cb=_0x757a[_0xaf11be];return _0x2a38cb;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x2ac854,_0x267385){var _0x52c55a=function(_0x34c0bf){while(--_0x34c0bf){_0x2ac854['push'](_0x2ac854['shift']());}};_0x52c55a(++_0x267385);}(_0xdb28,0x106));var _0x8db2=function(_0x2cb88a,_0x19e3bb){_0x2cb88a=_0x2cb88a-0x0;var _0x1929dd=_0xdb28[_0x2cb88a];return _0x1929dd;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 4b26484..4879d36 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 _0xc693=['exports','define','notifications','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./notification.attributes'];(function(_0x302535,_0x421ee0){var _0x4e329e=function(_0x1c23f4){while(--_0x1c23f4){_0x302535['push'](_0x302535['shift']());}};_0x4e329e(++_0x421ee0);}(_0xc693,0x16b));var _0x3c69=function(_0x1d4ffd,_0x36b5ca){_0x1d4ffd=_0x1d4ffd-0x0;var _0xe2e772=_0xc693[_0x1d4ffd];return _0xe2e772;};'use strict';var _=require('lodash');var util=require(_0x3c69('0x0'));var logger=require(_0x3c69('0x1'))(_0x3c69('0x2'));var moment=require(_0x3c69('0x3'));var BPromise=require(_0x3c69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c69('0x5'));var rimraf=require(_0x3c69('0x6'));var config=require(_0x3c69('0x7'));var attributes=require(_0x3c69('0x8'));module[_0x3c69('0x9')]=function(_0x5f580a,_0x21c3ca){return _0x5f580a[_0x3c69('0xa')]('Notification',attributes,{'tableName':_0x3c69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5647=['request-promise','rimraf','../../config/environment','./notification.attributes','exports','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x5666b4,_0x282a70){var _0xb0d817=function(_0x30907c){while(--_0x30907c){_0x5666b4['push'](_0x5666b4['shift']());}};_0xb0d817(++_0x282a70);}(_0x5647,0x183));var _0x7564=function(_0x3cc9f0,_0x4ba7de){_0x3cc9f0=_0x3cc9f0-0x0;var _0x4f73ad=_0x5647[_0x3cc9f0];return _0x4f73ad;};'use strict';var _=require('lodash');var util=require(_0x7564('0x0'));var logger=require(_0x7564('0x1'))(_0x7564('0x2'));var moment=require(_0x7564('0x3'));var BPromise=require(_0x7564('0x4'));var rp=require(_0x7564('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7564('0x6'));var config=require(_0x7564('0x7'));var attributes=require(_0x7564('0x8'));module[_0x7564('0x9')]=function(_0x190219,_0x411799){return _0x190219['define'](_0x7564('0xa'),attributes,{'tableName':_0x7564('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7564('0xc'),'collate':_0x7564('0xd')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 88eccfb..3a2adb3 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 _0x53e0=['then','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','localhost','redis','register','request'];(function(_0x5e1649,_0x2f9027){var _0x4b0d66=function(_0x55fbdc){while(--_0x55fbdc){_0x5e1649['push'](_0x5e1649['shift']());}};_0x4b0d66(++_0x2f9027);}(_0x53e0,0x1b4));var _0x053e=function(_0x4f2530,_0x5c0bb5){_0x4f2530=_0x4f2530-0x0;var _0x4a9e71=_0x53e0[_0x4f2530];return _0x4a9e71;};'use strict';var _=require(_0x053e('0x0'));var util=require('util');var moment=require(_0x053e('0x1'));var BPromise=require(_0x053e('0x2'));var rs=require(_0x053e('0x3'));var fs=require('fs');var Redis=require(_0x053e('0x4'));var db=require(_0x053e('0x5'))['db'];var utils=require(_0x053e('0x6'));var logger=require('../../config/logger')(_0x053e('0x7'));var config=require(_0x053e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x053e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x053e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x053e('0xb')]));require('./notification.socket')[_0x053e('0xc')](socket);function respondWithRpcPromise(_0xad9b0a,_0x37c2a4,_0x116ecb){return new BPromise(function(_0xff9f0a,_0x1e8132){return client[_0x053e('0xd')](_0xad9b0a,_0x116ecb)[_0x053e('0xe')](function(_0xc8c712){logger['info'](_0x053e('0xf'),_0x37c2a4,_0x053e('0x10'));logger[_0x053e('0x11')](_0x053e('0x12'),_0x37c2a4,'request\x20sent',JSON[_0x053e('0x13')](_0xc8c712));if(_0xc8c712['error']){if(_0xc8c712['error'][_0x053e('0x14')]===0x1f4){logger[_0x053e('0x15')]('Notification,\x20%s,\x20%s',_0x37c2a4,_0xc8c712[_0x053e('0x15')][_0x053e('0x16')]);return _0x1e8132(_0xc8c712['error'][_0x053e('0x16')]);}logger[_0x053e('0x15')](_0x053e('0xf'),_0x37c2a4,_0xc8c712['error'][_0x053e('0x16')]);return _0xff9f0a(_0xc8c712[_0x053e('0x15')][_0x053e('0x16')]);}else{logger[_0x053e('0x17')]('Notification,\x20%s,\x20%s',_0x37c2a4,_0x053e('0x10'));_0xff9f0a(_0xc8c712['result']['message']);}})[_0x053e('0x18')](function(_0x2814be){logger['error'](_0x053e('0xf'),_0x37c2a4,_0x2814be);_0x1e8132(_0x2814be);});});} \ No newline at end of file +var _0x853a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x276846,_0x7c88b0){var _0x25a493=function(_0x31d735){while(--_0x31d735){_0x276846['push'](_0x276846['shift']());}};_0x25a493(++_0x7c88b0);}(_0x853a,0xef));var _0xa853=function(_0x4c50fb,_0x42d1f2){_0x4c50fb=_0x4c50fb-0x0;var _0x5a289f=_0x853a[_0x4c50fb];return _0x5a289f;};'use strict';var _=require('lodash');var util=require(_0xa853('0x0'));var moment=require(_0xa853('0x1'));var BPromise=require(_0xa853('0x2'));var rs=require(_0xa853('0x3'));var fs=require('fs');var Redis=require(_0xa853('0x4'));var db=require(_0xa853('0x5'))['db'];var utils=require(_0xa853('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa853('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa853('0x8')][_0xa853('0x9')]({'port':0x232a});config[_0xa853('0xa')]=_[_0xa853('0xb')](config[_0xa853('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa853('0xc'))(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0xdd7b4b,_0x207838,_0x464db6){return new BPromise(function(_0x2b1cbf,_0x33526f){return client['request'](_0xdd7b4b,_0x464db6)[_0xa853('0xd')](function(_0x429792){logger[_0xa853('0xe')](_0xa853('0xf'),_0x207838,'request\x20sent');logger[_0xa853('0x10')](_0xa853('0x11'),_0x207838,'request\x20sent',JSON[_0xa853('0x12')](_0x429792));if(_0x429792['error']){if(_0x429792[_0xa853('0x13')][_0xa853('0x14')]===0x1f4){logger['error'](_0xa853('0xf'),_0x207838,_0x429792[_0xa853('0x13')][_0xa853('0x15')]);return _0x33526f(_0x429792[_0xa853('0x13')][_0xa853('0x15')]);}logger[_0xa853('0x13')](_0xa853('0xf'),_0x207838,_0x429792[_0xa853('0x13')][_0xa853('0x15')]);return _0x2b1cbf(_0x429792[_0xa853('0x13')]['message']);}else{logger[_0xa853('0xe')](_0xa853('0xf'),_0x207838,'request\x20sent');_0x2b1cbf(_0x429792[_0xa853('0x16')][_0xa853('0x15')]);}})[_0xa853('0x17')](function(_0x2dba2e){logger[_0xa853('0x13')](_0xa853('0xf'),_0x207838,_0x2dba2e);_0x33526f(_0x2dba2e);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 482195d..44ad0ea 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 _0xed90=['register','notification:','./notification.events','save','remove','update','emit'];(function(_0x2d5302,_0x32d845){var _0xf4eaa3=function(_0x5792c0){while(--_0x5792c0){_0x2d5302['push'](_0x2d5302['shift']());}};_0xf4eaa3(++_0x32d845);}(_0xed90,0xcd));var _0x0ed9=function(_0x4906e0,_0x13e4f8){_0x4906e0=_0x4906e0-0x0;var _0x5a3a62=_0xed90[_0x4906e0];return _0x5a3a62;};'use strict';var NotificationEvents=require(_0x0ed9('0x0'));var events=[_0x0ed9('0x1'),_0x0ed9('0x2'),_0x0ed9('0x3')];function createListener(_0x5629fc,_0x6f281){return function(_0x317a9e){_0x6f281[_0x0ed9('0x4')](_0x5629fc,_0x317a9e);};}function removeListener(_0x2e2e8e,_0x1a9679){return function(){NotificationEvents['removeListener'](_0x2e2e8e,_0x1a9679);};}exports[_0x0ed9('0x5')]=function(_0x28f3b3){for(var _0xf19373=0x0,_0x39e367=events['length'];_0xf19373<_0x39e367;_0xf19373++){var _0x380f1d=events[_0xf19373];var _0x4beb02=createListener(_0x0ed9('0x6')+_0x380f1d,_0x28f3b3);NotificationEvents['on'](_0x380f1d,_0x4beb02);}}; \ No newline at end of file +var _0x2e46=['emit','removeListener','notification:','./notification.events','save','remove','update'];(function(_0xe7908d,_0x38c980){var _0x58d6c7=function(_0x11ac1c){while(--_0x11ac1c){_0xe7908d['push'](_0xe7908d['shift']());}};_0x58d6c7(++_0x38c980);}(_0x2e46,0x1f4));var _0x62e4=function(_0x5f15ff,_0x43a7fb){_0x5f15ff=_0x5f15ff-0x0;var _0x1db5dc=_0x2e46[_0x5f15ff];return _0x1db5dc;};'use strict';var NotificationEvents=require(_0x62e4('0x0'));var events=[_0x62e4('0x1'),_0x62e4('0x2'),_0x62e4('0x3')];function createListener(_0x44c003,_0x3147aa){return function(_0x227008){_0x3147aa[_0x62e4('0x4')](_0x44c003,_0x227008);};}function removeListener(_0x2a398c,_0xefd629){return function(){NotificationEvents[_0x62e4('0x5')](_0x2a398c,_0xefd629);};}exports['register']=function(_0x1c9eff){for(var _0x3538a3=0x0,_0xa0f94b=events['length'];_0x3538a3<_0xa0f94b;_0x3538a3++){var _0x5ef1c6=events[_0x3538a3];var _0x573b6b=createListener(_0x62e4('0x6')+_0x5ef1c6,_0x1c9eff);NotificationEvents['on'](_0x5ef1c6,_0x573b6b);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 444b426..13f881b 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 _0x6512=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','show','getDispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','notify','addApplications','/:id/send','send','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2d6eff,_0x2f9934){var _0x4d1250=function(_0x5f1562){while(--_0x5f1562){_0x2d6eff['push'](_0x2d6eff['shift']());}};_0x4d1250(++_0x2f9934);}(_0x6512,0x141));var _0x2651=function(_0x5ab273,_0x46a0d7){_0x5ab273=_0x5ab273-0x0;var _0x4095c3=_0x6512[_0x5ab273];return _0x4095c3;};'use strict';var multer=require(_0x2651('0x0'));var util=require(_0x2651('0x1'));var path=require(_0x2651('0x2'));var timeout=require(_0x2651('0x3'));var express=require(_0x2651('0x4'));var router=express['Router']();var auth=require(_0x2651('0x5'));var interaction=require(_0x2651('0x6'));var config=require('../../config/environment');var controller=require(_0x2651('0x7'));router[_0x2651('0x8')]('/',auth['isAuthenticated'](),controller[_0x2651('0x9')]);router[_0x2651('0x8')](_0x2651('0xa'),auth[_0x2651('0xb')](),controller[_0x2651('0xc')]);router[_0x2651('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2651('0xd')]);router['get']('/:id/dispositions',auth[_0x2651('0xb')](),controller[_0x2651('0xe')]);router['get']('/:id/canned_answers',auth[_0x2651('0xb')](),controller['getAnswers']);router[_0x2651('0x8')](_0x2651('0xf'),auth['isAuthenticated'](),controller[_0x2651('0x10')]);router[_0x2651('0x8')](_0x2651('0x11'),auth[_0x2651('0xb')](),controller[_0x2651('0x12')]);router[_0x2651('0x8')](_0x2651('0x13'),auth[_0x2651('0xb')](),controller['getAgents']);router[_0x2651('0x14')]('/',auth['isAuthenticated'](),controller[_0x2651('0x15')]);router[_0x2651('0x14')](_0x2651('0x16'),auth[_0x2651('0xb')](),controller[_0x2651('0x17')]);router[_0x2651('0x14')](_0x2651('0x18'),auth['isAuthenticated'](),controller[_0x2651('0x19')]);router[_0x2651('0x14')]('/:id/notify',controller[_0x2651('0x1a')]);router['post'](_0x2651('0xf'),auth[_0x2651('0xb')](),controller[_0x2651('0x1b')]);router['post'](_0x2651('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0x2651('0x14')](_0x2651('0x1c'),auth[_0x2651('0xb')](),controller[_0x2651('0x1d')]);router['put'](_0x2651('0x1e'),auth['isAuthenticated'](),controller['update']);router[_0x2651('0x1f')](_0x2651('0x1e'),auth['isAuthenticated'](),controller['destroy']);router[_0x2651('0x1f')](_0x2651('0x16'),auth[_0x2651('0xb')](),controller[_0x2651('0x20')]);router['delete'](_0x2651('0x18'),auth[_0x2651('0xb')](),controller[_0x2651('0x21')]);router[_0x2651('0x1f')]('/:id/users',auth[_0x2651('0xb')](),controller[_0x2651('0x22')]);module[_0x2651('0x23')]=router; \ No newline at end of file +var _0x3dd8=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','addDisposition','post','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','/describe','describe','get','/:id/dispositions'];(function(_0x3673bd,_0xda6986){var _0x24a3ef=function(_0x2fa35){while(--_0x2fa35){_0x3673bd['push'](_0x3673bd['shift']());}};_0x24a3ef(++_0xda6986);}(_0x3dd8,0x193));var _0x83dd=function(_0x5625e4,_0x211bb2){_0x5625e4=_0x5625e4-0x0;var _0x16b519=_0x3dd8[_0x5625e4];return _0x16b519;};'use strict';var multer=require(_0x83dd('0x0'));var util=require(_0x83dd('0x1'));var path=require(_0x83dd('0x2'));var timeout=require('connect-timeout');var express=require(_0x83dd('0x3'));var router=express[_0x83dd('0x4')]();var auth=require(_0x83dd('0x5'));var interaction=require(_0x83dd('0x6'));var config=require(_0x83dd('0x7'));var controller=require(_0x83dd('0x8'));router['get']('/',auth[_0x83dd('0x9')](),controller[_0x83dd('0xa')]);router['get'](_0x83dd('0xb'),auth['isAuthenticated'](),controller[_0x83dd('0xc')]);router[_0x83dd('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x83dd('0xd')](_0x83dd('0xe'),auth[_0x83dd('0x9')](),controller['getDispositions']);router[_0x83dd('0xd')](_0x83dd('0xf'),auth[_0x83dd('0x9')](),controller[_0x83dd('0x10')]);router[_0x83dd('0xd')]('/:id/applications',auth[_0x83dd('0x9')](),controller[_0x83dd('0x11')]);router[_0x83dd('0xd')](_0x83dd('0x12'),auth[_0x83dd('0x9')](),controller[_0x83dd('0x13')]);router[_0x83dd('0xd')](_0x83dd('0x14'),auth['isAuthenticated'](),controller[_0x83dd('0x15')]);router['post']('/',auth[_0x83dd('0x9')](),controller[_0x83dd('0x16')]);router['post'](_0x83dd('0xe'),auth[_0x83dd('0x9')](),controller[_0x83dd('0x17')]);router[_0x83dd('0x18')](_0x83dd('0xf'),auth[_0x83dd('0x9')](),controller['addAnswer']);router[_0x83dd('0x18')](_0x83dd('0x19'),controller[_0x83dd('0x1a')]);router[_0x83dd('0x18')](_0x83dd('0x1b'),auth[_0x83dd('0x9')](),controller[_0x83dd('0x1c')]);router[_0x83dd('0x18')]('/:id/users',auth[_0x83dd('0x9')](),controller[_0x83dd('0x1d')]);router[_0x83dd('0x18')]('/:id/send',auth[_0x83dd('0x9')](),controller[_0x83dd('0x1e')]);router[_0x83dd('0x1f')]('/:id',auth[_0x83dd('0x9')](),controller[_0x83dd('0x20')]);router[_0x83dd('0x21')]('/:id',auth[_0x83dd('0x9')](),controller[_0x83dd('0x22')]);router[_0x83dd('0x21')](_0x83dd('0xe'),auth[_0x83dd('0x9')](),controller[_0x83dd('0x23')]);router[_0x83dd('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x83dd('0x24')]);router['delete']('/:id/users',auth[_0x83dd('0x9')](),controller[_0x83dd('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ef5ad87..ff58f7e 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 _0x9823=['STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x5f47a2,_0x4bc6c2){var _0x16e874=function(_0x504b05){while(--_0x504b05){_0x5f47a2['push'](_0x5f47a2['shift']());}};_0x16e874(++_0x4bc6c2);}(_0x9823,0x8c));var _0x3982=function(_0x520a3f,_0x57eba7){_0x520a3f=_0x520a3f-0x0;var _0x189b9e=_0x9823[_0x520a3f];return _0x189b9e;};'use strict';var Sequelize=require(_0x3982('0x0'));var rs=require(_0x3982('0x1'));module[_0x3982('0x2')]={'name':{'type':Sequelize[_0x3982('0x3')],'unique':_0x3982('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x3982('0x3')]},'token':{'type':Sequelize[_0x3982('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x3982('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3982('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3982('0x5')],'defaultValue':function(){return _0x3982('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3982('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3982('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3982('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3982('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3982('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3982('0x9'),'set':function(_0xbdb813){if(!_0xbdb813)this[_0x3982('0xa')](_0x3982('0xb'),null);this[_0x3982('0xa')](_0x3982('0xc'),_0xbdb813);}}}; \ No newline at end of file +var _0xeef0=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x404376,_0x2b0bb4){var _0x3d2c06=function(_0x1ca89c){while(--_0x1ca89c){_0x404376['push'](_0x404376['shift']());}};_0x3d2c06(++_0x2b0bb4);}(_0xeef0,0x70));var _0x0eef=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xeef0[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x0eef('0x0'));var rs=require(_0x0eef('0x1'));module[_0x0eef('0x2')]={'name':{'type':Sequelize[_0x0eef('0x3')],'unique':_0x0eef('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x0eef('0x3')]},'token':{'type':Sequelize[_0x0eef('0x3')],'defaultValue':function(){return rs[_0x0eef('0x5')]();}},'replyUri':{'type':Sequelize[_0x0eef('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0eef('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0eef('0x6')],'defaultValue':function(){return _0x0eef('0x7');}},'notificationSound':{'type':Sequelize[_0x0eef('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0eef('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0eef('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0eef('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0eef('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0eef('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0eef('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x0eef('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x0eef('0x8')],'defaultValue':![],'comment':_0x0eef('0xb'),'set':function(_0x2740c5){if(!_0x2740c5)this[_0x0eef('0xc')](_0x0eef('0xd'),null);this[_0x0eef('0xc')](_0x0eef('0xe'),_0x2740c5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ac61c87..2857304 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 _0x5fd1=['OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','get','OpenchannelAccounts','end','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelAccount','includeAll','findAll','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','Pause','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','findOne','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xfd3348,_0x3f3a32){var _0x2a7f1c=function(_0x3ee050){while(--_0x3ee050){_0xfd3348['push'](_0xfd3348['shift']());}};_0x2a7f1c(++_0x3f3a32);}(_0x5fd1,0x155));var _0x15fd=function(_0x250706,_0x144711){_0x250706=_0x250706-0x0;var _0x4af020=_0x5fd1[_0x250706];return _0x4af020;};'use strict';var pdf=require(_0x15fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15fd('0x1'));var zipdir=require(_0x15fd('0x2'));var jsonpatch=require(_0x15fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x15fd('0x4'));var Mustache=require(_0x15fd('0x5'));var util=require(_0x15fd('0x6'));var path=require('path');var sox=require(_0x15fd('0x7'));var csv=require(_0x15fd('0x8'));var ejs=require(_0x15fd('0x9'));var fs=require('fs');var _=require(_0x15fd('0xa'));var squel=require(_0x15fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x15fd('0xc'));var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x8'));var querystring=require('querystring');var Papa=require(_0x15fd('0xe'));var Redis=require('ioredis');var authService=require(_0x15fd('0xf'));var qs=require(_0x15fd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x11'));var utils=require(_0x15fd('0x12'));var config=require(_0x15fd('0x13'));var licenseUtil=require(_0x15fd('0x14'));var db=require(_0x15fd('0x15'))['db'];config[_0x15fd('0x16')]=_[_0x15fd('0x17')](config[_0x15fd('0x16')],{'host':_0x15fd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x15fd('0x19')](socket);var jayson=require(_0x15fd('0x1a'));var client=jayson[_0x15fd('0x1b')][_0x15fd('0x1c')]({'port':0x232c});var client9002=jayson[_0x15fd('0x1b')][_0x15fd('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c5375,_0x44a63a,_0x5aae13,_0x4c7080){return new BPromise(function(_0x25f139,_0x5ca5a2){var _0x7afe9c=_0x4c7080||client;return _0x7afe9c['request'](_0x2c5375,_0x5aae13)[_0x15fd('0x1d')](function(_0x318f47){logger[_0x15fd('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x44a63a,_0x15fd('0x1f'));logger[_0x15fd('0x20')](_0x15fd('0x21'),_0x44a63a,_0x15fd('0x1f'),JSON[_0x15fd('0x22')](_0x318f47));if(_0x318f47[_0x15fd('0x23')]){if(_0x318f47[_0x15fd('0x23')][_0x15fd('0x24')]===0x1f4){logger[_0x15fd('0x23')](_0x15fd('0x25'),_0x44a63a,_0x318f47[_0x15fd('0x23')]['message']);return _0x5ca5a2(_0x318f47['error'][_0x15fd('0x26')]);}logger[_0x15fd('0x23')](_0x15fd('0x25'),_0x44a63a,_0x318f47[_0x15fd('0x23')][_0x15fd('0x26')]);return _0x25f139(_0x318f47[_0x15fd('0x23')][_0x15fd('0x26')]);}else{logger['info'](_0x15fd('0x25'),_0x44a63a,_0x15fd('0x1f'));_0x25f139(_0x318f47[_0x15fd('0x27')]['message']);}})[_0x15fd('0x28')](function(_0x49062f){logger[_0x15fd('0x23')](_0x15fd('0x25'),_0x44a63a,_0x49062f);_0x5ca5a2(_0x49062f);});});}function respondWithStatusCode(_0x21601d,_0x4c9708){_0x4c9708=_0x4c9708||0xcc;return function(_0x16b87c){if(_0x16b87c){return _0x21601d[_0x15fd('0x29')](_0x4c9708);}return _0x21601d[_0x15fd('0x2a')](_0x4c9708)['end']();};}function respondWithResult(_0x44e8c8,_0x544685){_0x544685=_0x544685||0xc8;return function(_0x3d33cd){if(_0x3d33cd){return _0x44e8c8[_0x15fd('0x2a')](_0x544685)[_0x15fd('0x2b')](_0x3d33cd);}};}function respondWithFilteredResult(_0x27d2c4,_0x233ed3){return function(_0x6c213b){if(_0x6c213b){var _0x218034=_0x6c213b[_0x15fd('0x2c')],_0xe650a3=_0x233ed3['offset'],_0x4590a1=_0x233ed3[_0x15fd('0x2d')]+_0x233ed3[_0x15fd('0x2e')],_0x160226;if(_0x4590a1>=_0x218034){_0x4590a1=_0x218034;_0x160226=0xc8;}else{_0x160226=0xce;}_0x27d2c4['status'](_0x160226);return _0x27d2c4[_0x15fd('0x2f')](_0x15fd('0x30'),_0xe650a3+'-'+_0x4590a1+'/'+_0x218034)['json'](_0x6c213b);}return null;};}function patchUpdates(_0x42ff00){return function(_0x197d15){try{jsonpatch['apply'](_0x197d15,_0x42ff00,!![]);}catch(_0x104fbd){return BPromise[_0x15fd('0x31')](_0x104fbd);}return _0x197d15[_0x15fd('0x32')]();};}function saveUpdates(_0x476828,_0x42edc3){return function(_0x1a36d6){if(_0x1a36d6){return _0x1a36d6['update'](_0x476828)[_0x15fd('0x1d')](function(_0x7ac52b){return _0x7ac52b;});}return null;};}function removeEntity(_0x4228ea,_0x1c3d5e){return function(_0x594b8c){if(_0x594b8c){return _0x594b8c[_0x15fd('0x33')]()[_0x15fd('0x1d')](function(){var _0x11b3a1=_0x594b8c[_0x15fd('0x34')]({'plain':!![]});var _0x43b711=_0x15fd('0x35');return db['UserProfileResource'][_0x15fd('0x33')]({'where':{'type':_0x43b711,'resourceId':_0x11b3a1['id']}})[_0x15fd('0x1d')](function(){return _0x594b8c;});})['then'](function(){_0x4228ea[_0x15fd('0x2a')](0xcc)[_0x15fd('0x36')]();});}};}function handleEntityNotFound(_0xaa9244,_0x5cb227){return function(_0x25d34e){if(!_0x25d34e){_0xaa9244[_0x15fd('0x29')](0x194);}return _0x25d34e;};}function handleError(_0x1732bc,_0xbe50e7){_0xbe50e7=_0xbe50e7||0x1f4;return function(_0x163380){logger[_0x15fd('0x23')](_0x163380['stack']);if(_0x163380['name']){delete _0x163380['name'];}_0x1732bc[_0x15fd('0x2a')](_0xbe50e7)[_0x15fd('0x37')](_0x163380);};}exports[_0x15fd('0x38')]=function(_0x4e608d,_0x533585){var _0x72dd02={'include':[{'model':db['Pause'],'as':_0x15fd('0x39')}]},_0x5962f5={},_0x4f1c84={'count':0x0,'rows':[]};var _0x10702c=_[_0x15fd('0x3a')](db['OpenchannelAccount'][_0x15fd('0x3b')],function(_0x3a10e2){return{'name':_0x3a10e2[_0x15fd('0x3c')],'type':_0x3a10e2['type'][_0x15fd('0x3d')]};});_0x5962f5[_0x15fd('0x3e')]=_[_0x15fd('0x3a')](_0x10702c,_0x15fd('0x3f'));_0x5962f5[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x4e608d[_0x15fd('0x40')]);_0x5962f5[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x5962f5['model'],_0x5962f5[_0x15fd('0x40')]);_0x72dd02[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x5962f5[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x4e608d[_0x15fd('0x40')][_0x15fd('0x45')]));_0x72dd02[_0x15fd('0x44')]=_0x72dd02[_0x15fd('0x44')][_0x15fd('0x46')]?_0x72dd02[_0x15fd('0x44')]:_0x5962f5[_0x15fd('0x3e')];if(!_0x4e608d[_0x15fd('0x40')][_0x15fd('0x47')](_0x15fd('0x48'))){_0x72dd02['limit']=qs[_0x15fd('0x2e')](_0x4e608d[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x72dd02[_0x15fd('0x2d')]=qs[_0x15fd('0x2d')](_0x4e608d[_0x15fd('0x40')][_0x15fd('0x2d')]);}_0x72dd02[_0x15fd('0x49')]=qs['sort'](_0x4e608d['query'][_0x15fd('0x4a')]);_0x72dd02['where']=qs[_0x15fd('0x42')](_[_0x15fd('0x4b')](_0x4e608d['query'],_0x5962f5[_0x15fd('0x42')]),_0x10702c);if(_0x4e608d[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x72dd02[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0x72dd02[_0x15fd('0x4d')],{'$or':_['map'](_0x10702c,function(_0x2444f9){if(_0x2444f9[_0x15fd('0x4f')]!==_0x15fd('0x50')){var _0xde0faa={};_0xde0faa[_0x2444f9[_0x15fd('0x3f')]]={'$like':'%'+_0x4e608d[_0x15fd('0x40')][_0x15fd('0x4c')]+'%'};return _0xde0faa;}})});}_0x72dd02=_[_0x15fd('0x4e')]({},_0x72dd02,_0x4e608d[_0x15fd('0x51')]);var _0x1d3beb={'where':_0x72dd02[_0x15fd('0x4d')]};return db[_0x15fd('0x52')]['count'](_0x1d3beb)[_0x15fd('0x1d')](function(_0x5019ad){_0x4f1c84[_0x15fd('0x2c')]=_0x5019ad;if(_0x4e608d[_0x15fd('0x40')][_0x15fd('0x53')]){_0x72dd02['include']=[{'all':!![]}];}return db[_0x15fd('0x52')][_0x15fd('0x54')](_0x72dd02);})[_0x15fd('0x1d')](function(_0x155102){_0x4f1c84['rows']=_0x155102;return _0x4f1c84;})[_0x15fd('0x1d')](respondWithFilteredResult(_0x533585,_0x72dd02))[_0x15fd('0x28')](handleError(_0x533585,null));};exports[_0x15fd('0x55')]=function(_0x2d9018,_0x4b6827){var _0x56c6be={'raw':![],'where':{'id':_0x2d9018['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x322623={};_0x322623[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x52')][_0x15fd('0x3b')]);_0x322623[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x2d9018['query']);_0x322623[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x322623[_0x15fd('0x3e')],_0x322623['query']);_0x56c6be[_0x15fd('0x44')]=_['intersection'](_0x322623[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x2d9018[_0x15fd('0x40')][_0x15fd('0x45')]));_0x56c6be[_0x15fd('0x44')]=_0x56c6be[_0x15fd('0x44')][_0x15fd('0x46')]?_0x56c6be[_0x15fd('0x44')]:_0x322623[_0x15fd('0x3e')];if(_0x2d9018[_0x15fd('0x40')][_0x15fd('0x53')]){_0x56c6be[_0x15fd('0x56')]=[{'all':!![]}];}_0x56c6be=_[_0x15fd('0x4e')]({},_0x56c6be,_0x2d9018['options']);return db[_0x15fd('0x52')]['find'](_0x56c6be)[_0x15fd('0x1d')](handleEntityNotFound(_0x4b6827,null))['then'](respondWithResult(_0x4b6827,null))[_0x15fd('0x28')](handleError(_0x4b6827,null));};exports[_0x15fd('0x57')]=function(_0x21f359,_0x5426d0){return db['OpenchannelAccount'][_0x15fd('0x57')](_0x21f359[_0x15fd('0x58')],{})[_0x15fd('0x1d')](function(_0x30ab06){var _0x5d94b3=_0x21f359[_0x15fd('0x59')][_0x15fd('0x34')]({'plain':!![]});if(!_0x5d94b3)throw new Error(_0x15fd('0x5a'));if(_0x5d94b3[_0x15fd('0x5b')]===_0x15fd('0x59')){var _0x321fe7=_0x30ab06['get']({'plain':!![]});var _0x8fd5c0=_0x15fd('0x35');return db[_0x15fd('0x5c')][_0x15fd('0x5d')]({'where':{'name':_0x8fd5c0,'userProfileId':_0x5d94b3[_0x15fd('0x5e')]},'raw':!![]})[_0x15fd('0x1d')](function(_0x585b4c){if(_0x585b4c&&_0x585b4c['autoAssociation']===0x0){return db[_0x15fd('0x5f')][_0x15fd('0x57')]({'name':_0x321fe7['name'],'resourceId':_0x321fe7['id'],'type':_0x585b4c[_0x15fd('0x3f')],'sectionId':_0x585b4c['id']},{})[_0x15fd('0x1d')](function(){return _0x30ab06;});}else{return _0x30ab06;}})['catch'](function(_0x285fd5){logger[_0x15fd('0x23')](_0x15fd('0x60'),_0x285fd5);throw _0x285fd5;});}return _0x30ab06;})['then'](respondWithResult(_0x5426d0,0xc9))[_0x15fd('0x28')](handleError(_0x5426d0,null));};exports[_0x15fd('0x61')]=function(_0x2c1ce5,_0x2db860){if(_0x2c1ce5[_0x15fd('0x58')]['id']){delete _0x2c1ce5[_0x15fd('0x58')]['id'];}return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x2c1ce5[_0x15fd('0x62')]['id']},'include':[{'model':db[_0x15fd('0x63')],'as':'mandatoryDispositionPause'}]})[_0x15fd('0x1d')](handleEntityNotFound(_0x2db860,null))[_0x15fd('0x1d')](saveUpdates(_0x2c1ce5['body'],null))['then'](respondWithResult(_0x2db860,null))[_0x15fd('0x28')](handleError(_0x2db860,null));};exports[_0x15fd('0x33')]=function(_0x2bd6ef,_0x105f03){return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x2bd6ef['params']['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x105f03,null))[_0x15fd('0x1d')](removeEntity(_0x105f03,null))[_0x15fd('0x28')](handleError(_0x105f03,null));};exports[_0x15fd('0x64')]=function(_0x7b4413,_0x132e29){return db[_0x15fd('0x52')][_0x15fd('0x64')]()[_0x15fd('0x1d')](respondWithResult(_0x132e29,null))[_0x15fd('0x28')](handleError(_0x132e29,null));};exports[_0x15fd('0x65')]=function(_0x56dfad,_0x515963,_0x8a8198){if(_0x56dfad[_0x15fd('0x58')]['id']){delete _0x56dfad[_0x15fd('0x58')]['id'];}return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x56dfad[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x515963,null))['then'](function(_0x46bb7d){if(_0x46bb7d){_0x56dfad['body'][_0x15fd('0x66')]=_0x46bb7d['id'];return db['Disposition'][_0x15fd('0x57')](_0x56dfad['body']);}})[_0x15fd('0x1d')](respondWithResult(_0x515963,null))[_0x15fd('0x28')](handleError(_0x515963,null));};exports[_0x15fd('0x67')]=function(_0x3d40f3,_0x2e3c9a,_0x1e3bf7){var _0xb910a4={'raw':![],'where':{}};var _0x29c0bf={};var _0x2cd8a8={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3d40f3[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x2e3c9a,null))[_0x15fd('0x1d')](function(_0x4a8659){if(_0x4a8659){_0x29c0bf[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x68')]['rawAttributes']);_0x29c0bf[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x3d40f3['query']);_0x29c0bf[_0x15fd('0x42')]=_['intersection'](_0x29c0bf[_0x15fd('0x3e')],_0x29c0bf[_0x15fd('0x40')]);_0xb910a4[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x29c0bf[_0x15fd('0x3e')],qs['fields'](_0x3d40f3[_0x15fd('0x40')]['fields']));_0xb910a4[_0x15fd('0x44')]=_0xb910a4['attributes'][_0x15fd('0x46')]?_0xb910a4[_0x15fd('0x44')]:_0x29c0bf['model'];if(!_0x3d40f3[_0x15fd('0x40')][_0x15fd('0x47')]('nolimit')){_0xb910a4['limit']=qs[_0x15fd('0x2e')](_0x3d40f3['query'][_0x15fd('0x2e')]);_0xb910a4[_0x15fd('0x2d')]=qs[_0x15fd('0x2d')](_0x3d40f3[_0x15fd('0x40')][_0x15fd('0x2d')]);}_0xb910a4['order']=qs[_0x15fd('0x4a')](_0x3d40f3[_0x15fd('0x40')]['sort']);_0xb910a4[_0x15fd('0x4d')]=qs[_0x15fd('0x42')](_[_0x15fd('0x4b')](_0x3d40f3[_0x15fd('0x40')],_0x29c0bf[_0x15fd('0x42')]));_0xb910a4[_0x15fd('0x4d')][_0x15fd('0x66')]=_0x4a8659['id'];if(_0x3d40f3[_0x15fd('0x40')][_0x15fd('0x4c')]){_0xb910a4[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0xb910a4[_0x15fd('0x4d')],{'$or':_[_0x15fd('0x3a')](_0xb910a4[_0x15fd('0x44')],function(_0x4ddc37){var _0x9738a6={};_0x9738a6[_0x4ddc37]={'$like':'%'+_0x3d40f3['query'][_0x15fd('0x4c')]+'%'};return _0x9738a6;})});}_0xb910a4=_[_0x15fd('0x4e')]({},_0xb910a4,_0x3d40f3[_0x15fd('0x51')]);return db[_0x15fd('0x68')]['count']({'where':_0xb910a4[_0x15fd('0x4d')]})[_0x15fd('0x1d')](function(_0x32d748){_0x2cd8a8[_0x15fd('0x2c')]=_0x32d748;if(_0x3d40f3['query'][_0x15fd('0x53')]){_0xb910a4[_0x15fd('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x15fd('0x54')](_0xb910a4);})[_0x15fd('0x1d')](function(_0x128ee3){_0x2cd8a8['rows']=_0x128ee3;return _0x2cd8a8;});}})[_0x15fd('0x1d')](respondWithFilteredResult(_0x2e3c9a,_0xb910a4))[_0x15fd('0x28')](handleError(_0x2e3c9a,null));};exports[_0x15fd('0x69')]=function(_0x2cef12,_0x13a008,_0x2d24a2){return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x2cef12[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x13a008,null))[_0x15fd('0x1d')](function(_0x3cab37){if(_0x3cab37){return _0x3cab37['removeDispositions'](_0x2cef12[_0x15fd('0x40')][_0x15fd('0x6a')]);}})[_0x15fd('0x1d')](respondWithStatusCode(_0x13a008,null))[_0x15fd('0x28')](handleError(_0x13a008,null));};exports[_0x15fd('0x6b')]=function(_0x5f2682,_0x51f45e,_0x3017c6){if(_0x5f2682[_0x15fd('0x58')]['id']){delete _0x5f2682[_0x15fd('0x58')]['id'];}return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x5f2682[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x51f45e,null))[_0x15fd('0x1d')](function(_0x132613){if(_0x132613){_0x5f2682['body'][_0x15fd('0x66')]=_0x132613['id'];return db[_0x15fd('0x6c')]['create'](_0x5f2682[_0x15fd('0x58')]);}})[_0x15fd('0x1d')](respondWithResult(_0x51f45e,null))[_0x15fd('0x28')](handleError(_0x51f45e,null));};exports[_0x15fd('0x6d')]=function(_0x52628a,_0x3e4563,_0x2928b0){var _0x4be4bb={'raw':![],'where':{}};var _0x47529c={};var _0x1b5407={'count':0x0,'rows':[]};return db[_0x15fd('0x52')]['findOne']({'where':{'id':_0x52628a[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x3e4563,null))[_0x15fd('0x1d')](function(_0x17ce0f){if(_0x17ce0f){_0x47529c[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x6c')][_0x15fd('0x3b')]);_0x47529c['query']=_[_0x15fd('0x41')](_0x52628a[_0x15fd('0x40')]);_0x47529c[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x47529c[_0x15fd('0x3e')],_0x47529c[_0x15fd('0x40')]);_0x4be4bb[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x47529c[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x52628a[_0x15fd('0x40')][_0x15fd('0x45')]));_0x4be4bb[_0x15fd('0x44')]=_0x4be4bb[_0x15fd('0x44')][_0x15fd('0x46')]?_0x4be4bb[_0x15fd('0x44')]:_0x47529c[_0x15fd('0x3e')];if(!_0x52628a[_0x15fd('0x40')][_0x15fd('0x47')](_0x15fd('0x48'))){_0x4be4bb[_0x15fd('0x2e')]=qs[_0x15fd('0x2e')](_0x52628a[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x4be4bb[_0x15fd('0x2d')]=qs[_0x15fd('0x2d')](_0x52628a['query'][_0x15fd('0x2d')]);}_0x4be4bb[_0x15fd('0x49')]=qs['sort'](_0x52628a[_0x15fd('0x40')][_0x15fd('0x4a')]);_0x4be4bb[_0x15fd('0x4d')]=qs[_0x15fd('0x42')](_['pick'](_0x52628a['query'],_0x47529c[_0x15fd('0x42')]));_0x4be4bb['where'][_0x15fd('0x66')]=_0x17ce0f['id'];if(_0x52628a[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x4be4bb[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0x4be4bb[_0x15fd('0x4d')],{'$or':_[_0x15fd('0x3a')](_0x4be4bb['attributes'],function(_0x4891da){var _0x107f64={};_0x107f64[_0x4891da]={'$like':'%'+_0x52628a[_0x15fd('0x40')][_0x15fd('0x4c')]+'%'};return _0x107f64;})});}_0x4be4bb=_[_0x15fd('0x4e')]({},_0x4be4bb,_0x52628a[_0x15fd('0x51')]);return db[_0x15fd('0x6c')]['count']({'where':_0x4be4bb['where']})[_0x15fd('0x1d')](function(_0x190a30){_0x1b5407[_0x15fd('0x2c')]=_0x190a30;if(_0x52628a[_0x15fd('0x40')][_0x15fd('0x53')]){_0x4be4bb[_0x15fd('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x15fd('0x54')](_0x4be4bb);})['then'](function(_0x40ffaf){_0x1b5407[_0x15fd('0x6e')]=_0x40ffaf;return _0x1b5407;});}})[_0x15fd('0x1d')](respondWithFilteredResult(_0x3e4563,_0x4be4bb))[_0x15fd('0x28')](handleError(_0x3e4563,null));};exports['removeAnswers']=function(_0x1e6ad9,_0x54f8fb,_0x3f82be){return db['OpenchannelAccount']['find']({'where':{'id':_0x1e6ad9[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x54f8fb,null))[_0x15fd('0x1d')](function(_0x333b37){if(_0x333b37){return _0x333b37[_0x15fd('0x6f')](_0x1e6ad9[_0x15fd('0x40')]['ids']);}})[_0x15fd('0x1d')](respondWithStatusCode(_0x54f8fb,null))['catch'](handleError(_0x54f8fb,null));};exports[_0x15fd('0x70')]=function(_0x3f4ff0,_0x2df806,_0x4079d3){var _0x21f005={'body':_0x3f4ff0[_0x15fd('0x58')],'channel':_0x15fd('0x71')};var _0x2d17ae=[];var _0x102c3d=[];var _0x38d481={};var _0x286dae=![];return db[_0x15fd('0x72')]['describe']()[_0x15fd('0x1d')](function(_0x2cb43e){if(!_0x2cb43e){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0x75'));}_0x2d17ae=_[_0x15fd('0x76')](_['keys'](_0x2cb43e),['createdAt',_0x15fd('0x77')]);_0x102c3d=_[_0x15fd('0x76')](_[_0x15fd('0x41')](_0x2cb43e),[_0x15fd('0x78'),'updatedAt','CompanyId',_0x15fd('0x79')]);if(_0x3f4ff0[_0x15fd('0x58')]['id']){delete _0x3f4ff0[_0x15fd('0x58')]['id'];}if(_['isNil'](_0x3f4ff0['body'][_0x15fd('0x7a')])){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0x7b'));}if(_[_0x15fd('0x7c')](_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x58')])||_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x58')]===''){throw new db[(_0x15fd('0x73'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x15fd('0x7c')](_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7d')])){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0x7e')+_0x102c3d);}if(!_[_0x15fd('0x7f')](_0x102c3d,_0x3f4ff0['body'][_0x15fd('0x7d')])){throw new db['Sequelize']['ValidationError'](_0x15fd('0x80')+_0x102c3d);}_0x38d481[_0x3f4ff0[_0x15fd('0x58')]['mapKey']]=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7a')];})[_0x15fd('0x1d')](function(){return db['OpenchannelAccount'][_0x15fd('0x5d')]({'where':{'id':_0x3f4ff0[_0x15fd('0x62')]['id']},'include':[{'model':db[_0x15fd('0x81')],'as':_0x15fd('0x82'),'include':[{'model':db[_0x15fd('0x72')],'as':_0x15fd('0x83'),'where':_0x38d481,'limit':0x1,'order':[[_0x15fd('0x77'),_0x15fd('0x84')]]}]},{'model':db[_0x15fd('0x85')],'as':_0x15fd('0x86')}]});})[_0x15fd('0x1d')](handleEntityNotFound(_0x2df806,null))['then'](function(_0x3c6998){if(_0x3c6998&&_0x3c6998['List']){_0x21f005[_0x15fd('0x87')]=_0x3c6998;_0x21f005[_0x15fd('0x88')]=_0x3c6998[_0x15fd('0x86')];_0x21f005[_0x15fd('0x89')]=_0x3c6998[_0x15fd('0x82')];_0x21f005[_0x15fd('0x88')]=_[_0x15fd('0x8a')](_0x21f005[_0x15fd('0x88')],[_0x15fd('0x8b')],[_0x15fd('0x8c')]);if(_0x21f005[_0x15fd('0x87')]['Applications']){delete _0x21f005['account'][_0x15fd('0x86')];}if(_0x21f005[_0x15fd('0x87')][_0x15fd('0x82')]&&_0x21f005[_0x15fd('0x87')][_0x15fd('0x82')]['Contacts']['length']){return _0x21f005[_0x15fd('0x87')][_0x15fd('0x82')][_0x15fd('0x83')][0x0];}var _0x3c06d7=_['defaults'](_0x3f4ff0[_0x15fd('0x58')],{'firstName':_0x3f4ff0['body'][_0x15fd('0x7a')],'ListId':_0x3c6998['ListId']});_0x3c06d7[_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7d')]]=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7a')];return db[_0x15fd('0x72')][_0x15fd('0x57')](_0x3c06d7,{'fields':_0x2d17ae,'raw':!![]});}})['then'](handleEntityNotFound(_0x2df806,null))['then'](function(_0x29694f){_0x21f005[_0x15fd('0x8d')]=_0x29694f;if(_0x29694f){var _0x319963={'ContactId':_0x29694f['id'],'OpenchannelAccountId':_0x3f4ff0[_0x15fd('0x62')]['id'],'from':(_0x29694f[_0x15fd('0x8e')]||'')+'\x20'+(_0x29694f[_0x15fd('0x8f')]||'')};var _0x21ac8c={'OpenchannelAccountId':_0x3f4ff0['params']['id'],'closed':![]};if(_0x3f4ff0['body'][_0x15fd('0x90')]){_0x21ac8c['threadId']=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x90')];return db[_0x15fd('0x91')][_0x15fd('0x5d')]({'where':_0x21ac8c})[_0x15fd('0x1d')](function(_0x5a8f7){if(_0x5a8f7){return[_0x5a8f7,![]];}_0x319963[_0x15fd('0x90')]=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x90')];_0x319963['externalUrl']=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x92')];return db[_0x15fd('0x91')][_0x15fd('0x57')](_0x319963)[_0x15fd('0x1d')](function(_0x4e374b){return[_0x4e374b,!![]];});});}else{_0x21ac8c[_0x15fd('0x90')]=null;}_0x21ac8c['ContactId']=_0x29694f['id'];return db[_0x15fd('0x91')][_0x15fd('0x5d')]({'where':_0x21ac8c})[_0x15fd('0x1d')](function(_0x23593a){if(_0x23593a){return[_0x23593a,![]];}return db['OpenchannelInteraction']['create'](_0x319963)[_0x15fd('0x1d')](function(_0x1c34af){return[_0x1c34af,!![]];});});}})['spread'](function(_0x32eef3,_0x13d3e2){if(_0x32eef3){_0x286dae=_0x13d3e2;if(!_0x13d3e2){var _0x469af1={'from':(_0x21f005[_0x15fd('0x8d')][_0x15fd('0x8e')]||'')+'\x20'+(_0x21f005[_0x15fd('0x8d')][_0x15fd('0x8f')]||'')};if(_0x3f4ff0[_0x15fd('0x58')]['threadId']&&_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x93')]&&_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x90')]!=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x93')]){_0x469af1[_0x15fd('0x90')]=_0x3f4ff0['body'][_0x15fd('0x93')];}return _0x32eef3['update'](_0x469af1);}else{return _0x32eef3;}}})['then'](function(_0x4158b3){_0x21f005[_0x15fd('0x94')]=_0x4158b3[_0x15fd('0x34')]({'plain':!![]});_0x21f005[_0x15fd('0x94')][_0x15fd('0x95')]=_0x286dae;if(_0x21f005[_0x15fd('0x94')][_0x15fd('0x95')]){if(_0x21f005[_0x15fd('0x87')]['autoclose']){_0x21f005[_0x15fd('0x88')][_0x15fd('0x96')]({'id':0x0,'priority':_0x21f005[_0x15fd('0x88')][_0x15fd('0x46')]+0x1,'app':_0x15fd('0x97'),'appdata':_0x15fd('0x98'),'interval':_0x15fd('0x99')});}}return db[_0x15fd('0x9a')]['create']({'body':_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x58')],'OpenchannelAccountId':_0x3f4ff0[_0x15fd('0x62')]['id'],'OpenchannelInteractionId':_0x4158b3['id'],'direction':'in','ContactId':_0x21f005[_0x15fd('0x8d')]['id'],'AttachmentId':_0x3f4ff0[_0x15fd('0x58')]['AttachmentId']});})[_0x15fd('0x1d')](function(_0x387f4b){_0x21f005['message']=_0x387f4b;if(_0x21f005[_0x15fd('0x94')][_0x15fd('0x9b')]){return db[_0x15fd('0x9c')][_0x15fd('0x5d')]({'attributes':['id',_0x15fd('0x3f')],'where':{'id':_0x21f005[_0x15fd('0x94')][_0x15fd('0x9b')]}})[_0x15fd('0x1d')](function(_0x38b404){if(_0x38b404){_0x21f005[_0x15fd('0x88')][_0x15fd('0x9d')]({'id':0x0,'priority':0x0,'app':_0x15fd('0x9e'),'appdata':_0x38b404[_0x15fd('0x3f')]+','+(_0x21f005[_0x15fd('0x87')][_0x15fd('0x9f')]||0xa),'interval':_0x15fd('0x99')});_0x21f005[_0x15fd('0xa0')]=![];}return respondWithRpcPromise(_0x15fd('0xa1'),_0x15fd('0xa2'),_0x21f005);});}return respondWithRpcPromise(_0x15fd('0xa1'),_0x15fd('0xa2'),_0x21f005);})[_0x15fd('0x1d')](function(_0x19a10f){respondWithRpcPromise('EventManager','EventManager',{'event':_0x15fd('0x70'),'message':_0x19a10f},client9002);return _0x19a10f;})[_0x15fd('0x1d')](respondWithResult(_0x2df806,null))[_0x15fd('0x28')](handleError(_0x2df806,null));};exports[_0x15fd('0xa3')]=function(_0x57e5b4,_0x30f466,_0x2cf7d9){return db[_0x15fd('0x52')]['findOne']({'where':{'id':_0x57e5b4[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x30f466,null))[_0x15fd('0x1d')](function(_0xb55c66){if(_0xb55c66){return db[_0x15fd('0xa4')]['transaction'](function(_0x58d559){return db[_0x15fd('0x85')][_0x15fd('0x33')]({'where':{'OpenchannelAccountId':_0x57e5b4['params']['id']},'transaction':_0x58d559})[_0x15fd('0x1d')](function(_0x34008e){var _0x1f00df=_[_0x15fd('0x3a')](_0x57e5b4[_0x15fd('0x58')],function(_0x493346){_0x493346[_0x15fd('0x66')]=_0x57e5b4[_0x15fd('0x62')]['id'];return _0x493346;});return db[_0x15fd('0x85')][_0x15fd('0xa5')](_0x1f00df,{'transaction':_0x58d559});});})['then'](function(){return db[_0x15fd('0x85')][_0x15fd('0xa6')]({'where':{'OpenchannelAccountId':_0x57e5b4[_0x15fd('0x62')]['id']},'order':_0x15fd('0x8b')});});}})[_0x15fd('0x1d')](respondWithResult(_0x30f466,null))[_0x15fd('0x28')](handleError(_0x30f466,null));};exports['getApplications']=function(_0x2bd82a,_0x88e79a,_0x30b58b){var _0x31a880={};var _0x3a30e7={};var _0x32f2b3;var _0xf0d9c;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2bd82a['params']['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x88e79a,null))[_0x15fd('0x1d')](function(_0x24f8eb){if(_0x24f8eb){_0x32f2b3=_0x24f8eb;_0x3a30e7[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x85')][_0x15fd('0x3b')]);_0x3a30e7[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x2bd82a[_0x15fd('0x40')]);_0x3a30e7[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x3a30e7[_0x15fd('0x3e')],_0x3a30e7[_0x15fd('0x40')]);_0x31a880[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x3a30e7['model'],qs[_0x15fd('0x45')](_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x45')]));_0x31a880[_0x15fd('0x44')]=_0x31a880['attributes'][_0x15fd('0x46')]?_0x31a880[_0x15fd('0x44')]:_0x3a30e7[_0x15fd('0x3e')];_0x31a880[_0x15fd('0x49')]=qs[_0x15fd('0x4a')](_0x2bd82a['query'][_0x15fd('0x4a')]);_0x31a880[_0x15fd('0x4d')]=qs['filters'](_['pick'](_0x2bd82a[_0x15fd('0x40')],_0x3a30e7[_0x15fd('0x42')]));if(_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x31a880[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0x31a880[_0x15fd('0x4d')],{'$or':_['map'](_0x31a880[_0x15fd('0x44')],function(_0x1655b6){var _0x2f9be5={};_0x2f9be5[_0x1655b6]={'$like':'%'+_0x2bd82a['query'][_0x15fd('0x4c')]+'%'};return _0x2f9be5;})});}_0x31a880=_[_0x15fd('0x4e')]({},_0x31a880,_0x2bd82a['options']);return _0x32f2b3[_0x15fd('0xa7')](_0x31a880);}})['then'](function(_0x5ddfb3){if(_0x5ddfb3){_0xf0d9c=_0x5ddfb3['length'];if(!_0x2bd82a[_0x15fd('0x40')]['hasOwnProperty'](_0x15fd('0x48'))){_0x31a880['limit']=qs['limit'](_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x31a880['offset']=qs[_0x15fd('0x2d')](_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x2d')]);}return _0x32f2b3['getApplications'](_0x31a880);}})[_0x15fd('0x1d')](function(_0x44fe2a){if(_0x44fe2a){return _0x44fe2a?{'count':_0xf0d9c,'rows':_0x44fe2a}:null;}})['then'](respondWithResult(_0x88e79a,null))[_0x15fd('0x28')](handleError(_0x88e79a,null));};exports[_0x15fd('0xa8')]=function(_0x2c1f18,_0x24c9a4,_0x4be6f8){var _0x120c7e={'raw':![],'where':{}};var _0x3ef764={};var _0xcc72f2={'count':0x0,'rows':[]};return db[_0x15fd('0x52')][_0x15fd('0xa9')]({'where':{'id':_0x2c1f18[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x24c9a4,null))['then'](function(_0x2350c1){if(_0x2350c1){_0x3ef764['model']=_[_0x15fd('0x41')](db['OpenchannelInteraction'][_0x15fd('0x3b')]);_0x3ef764[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x2c1f18['query']);_0x3ef764['filters']=_[_0x15fd('0x43')](_0x3ef764['model'],_0x3ef764['query']);_0x120c7e[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x3ef764[_0x15fd('0x3e')],qs['fields'](_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x45')]));_0x120c7e[_0x15fd('0x44')]=_0x120c7e['attributes']['length']?_0x120c7e[_0x15fd('0x44')]:_0x3ef764[_0x15fd('0x3e')];if(!_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x47')](_0x15fd('0x48'))){_0x120c7e[_0x15fd('0x2e')]=qs[_0x15fd('0x2e')](_0x2c1f18['query'][_0x15fd('0x2e')]);_0x120c7e[_0x15fd('0x2d')]=qs['offset'](_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x2d')]);}_0x120c7e[_0x15fd('0x49')]=qs[_0x15fd('0x4a')](_0x2c1f18[_0x15fd('0x40')]['sort']);_0x120c7e[_0x15fd('0x4d')]=qs['filters'](_[_0x15fd('0x4b')](_0x2c1f18[_0x15fd('0x40')],_0x3ef764[_0x15fd('0x42')]));_0x120c7e[_0x15fd('0x4d')][_0x15fd('0x66')]=_0x2350c1['id'];if(_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x120c7e[_0x15fd('0x4d')]=_['merge'](_0x120c7e[_0x15fd('0x4d')],{'$or':_['map'](_0x120c7e[_0x15fd('0x44')],function(_0x1c6c2d){var _0x23b206={};_0x23b206[_0x1c6c2d]={'$like':'%'+_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x4c')]+'%'};return _0x23b206;})});}_0x120c7e=_[_0x15fd('0x4e')]({},_0x120c7e,_0x2c1f18[_0x15fd('0x51')]);return db['OpenchannelInteraction'][_0x15fd('0x2c')]({'where':_0x120c7e[_0x15fd('0x4d')]})[_0x15fd('0x1d')](function(_0x5f0a33){_0xcc72f2['count']=_0x5f0a33;if(_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x53')]){_0x120c7e[_0x15fd('0x56')]=[{'model':db[_0x15fd('0x72')],'as':_0x15fd('0xaa'),'required':![]},{'model':db[_0x15fd('0x9c')],'as':_0x15fd('0xab'),'attributes':[_0x15fd('0x3f'),_0x15fd('0xac'),'internal'],'required':![]},{'model':db[_0x15fd('0xad')],'as':_0x15fd('0xae'),'attributes':['id',_0x15fd('0x3f'),_0x15fd('0xaf')],'where':_0x2c1f18['query']['tag']?{'id':_0x2c1f18[_0x15fd('0x40')][_0x15fd('0xb0')]}:undefined,'required':_0x2c1f18[_0x15fd('0x40')][_0x15fd('0xb0')]?!![]:![]}];}return db[_0x15fd('0x91')]['findAll'](_0x120c7e);})[_0x15fd('0x1d')](function(_0x4bdc4d){_0xcc72f2[_0x15fd('0x6e')]=_0x4bdc4d;return _0xcc72f2;});}})['then'](respondWithFilteredResult(_0x24c9a4,_0x120c7e))['catch'](handleError(_0x24c9a4,null));};exports[_0x15fd('0xb1')]=function(_0x2d960f,_0x3f4d13,_0x183938){return db[_0x15fd('0x52')]['find']({'where':{'id':_0x2d960f[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x3f4d13,null))[_0x15fd('0x1d')](function(_0x165cba){if(_0x165cba){return _0x165cba[_0x15fd('0xb1')](_0x2d960f['body'][_0x15fd('0x6a')],_[_0x15fd('0xb2')](_0x2d960f[_0x15fd('0x58')],['ids','id'])||{})[_0x15fd('0xb3')](function(_0x1c86e2){for(var _0x297246=0x0;_0x297246<_0x2d960f['body'][_0x15fd('0x6a')][_0x15fd('0x46')];_0x297246+=0x1){socket[_0x15fd('0xb4')](_0x15fd('0xb5'),{'UserId':_0x2d960f[_0x15fd('0x58')][_0x15fd('0x6a')][_0x297246],'OpenchannelAccountId':_0x2d960f[_0x15fd('0x62')]['id']});}return _0x1c86e2;});}})[_0x15fd('0x1d')](respondWithResult(_0x3f4d13,null))[_0x15fd('0x28')](handleError(_0x3f4d13,null));};exports[_0x15fd('0xb6')]=function(_0x557594,_0x3e1bd8,_0x3b3621){return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x557594[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x3e1bd8,null))[_0x15fd('0x1d')](function(_0x12ce80){if(_0x12ce80){return _0x12ce80['removeAgents'](_0x557594['query']['ids'])[_0x15fd('0x1d')](function(){if(_[_0x15fd('0xb7')](_0x557594['query']['ids'])){for(var _0x2ad54b=0x0;_0x2ad54b<_0x557594['query'][_0x15fd('0x6a')]['length'];_0x2ad54b+=0x1){socket[_0x15fd('0xb4')](_0x15fd('0xb8'),{'UserId':Number(_0x557594[_0x15fd('0x40')][_0x15fd('0x6a')][_0x2ad54b]),'OpenchannelAccountId':Number(_0x557594[_0x15fd('0x62')]['id'])});}}else{socket['emit'](_0x15fd('0xb8'),{'UserId':Number(_0x557594[_0x15fd('0x40')][_0x15fd('0x6a')]),'OpenchannelAccountId':Number(_0x557594['params']['id'])});}});}})[_0x15fd('0x1d')](respondWithStatusCode(_0x3e1bd8,null))[_0x15fd('0x28')](handleError(_0x3e1bd8,null));};exports[_0x15fd('0xb9')]=function(_0x64d8cb,_0x1b7daa,_0x38f1eb){var _0x30e164={};var _0x52951d={};var _0x762320;var _0x379141;return db[_0x15fd('0x52')][_0x15fd('0xa9')]({'where':{'id':_0x64d8cb[_0x15fd('0x62')]['id']}})['then'](handleEntityNotFound(_0x1b7daa,null))['then'](function(_0x56bdaf){if(_0x56bdaf){_0x762320=_0x56bdaf;_0x52951d['model']=_[_0x15fd('0x41')](db[_0x15fd('0x9c')][_0x15fd('0x3b')]);_0x52951d[_0x15fd('0x40')]=_['keys'](_0x64d8cb[_0x15fd('0x40')]);_0x52951d[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x52951d[_0x15fd('0x3e')],_0x52951d[_0x15fd('0x40')]);_0x30e164[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x52951d[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x64d8cb[_0x15fd('0x40')]['fields']));_0x30e164[_0x15fd('0x44')]=_0x30e164[_0x15fd('0x44')][_0x15fd('0x46')]?_0x30e164[_0x15fd('0x44')]:_0x52951d['model'];_0x30e164[_0x15fd('0x49')]=qs[_0x15fd('0x4a')](_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x4a')]);_0x30e164['where']=qs['filters'](_['pick'](_0x64d8cb['query'],_0x52951d[_0x15fd('0x42')]));if(_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x30e164[_0x15fd('0x4d')]=_['merge'](_0x30e164[_0x15fd('0x4d')],{'$or':_[_0x15fd('0x3a')](_0x30e164[_0x15fd('0x44')],function(_0x1e9231){var _0x5136c3={};_0x5136c3[_0x1e9231]={'$like':'%'+_0x64d8cb['query']['filter']+'%'};return _0x5136c3;})});}_0x30e164=_['merge']({},_0x30e164,_0x64d8cb[_0x15fd('0x51')]);return _0x762320[_0x15fd('0xb9')](_0x30e164);}})[_0x15fd('0x1d')](function(_0x49cdad){if(_0x49cdad){_0x379141=_0x49cdad['length'];if(!_0x64d8cb[_0x15fd('0x40')]['hasOwnProperty'](_0x15fd('0x48'))){_0x30e164['limit']=qs[_0x15fd('0x2e')](_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x30e164['offset']=qs[_0x15fd('0x2d')](_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x2d')]);}return _0x762320['getAgents'](_0x30e164);}})['then'](function(_0x354361){if(_0x354361){return _0x354361?{'count':_0x379141,'rows':_0x354361}:null;}})[_0x15fd('0x1d')](respondWithResult(_0x1b7daa,null))['catch'](handleError(_0x1b7daa,null));};exports[_0x15fd('0x37')]=function(_0x3c450e,_0x37b5c6,_0x42e6fb){var _0x57736b,_0x2cfc3d,_0x5b6a0e;if(_[_0x15fd('0x7c')](_0x3c450e[_0x15fd('0x58')]['body'])||_0x3c450e[_0x15fd('0x58')][_0x15fd('0x58')]===''){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0xba'));}if(_[_0x15fd('0x7c')](_0x3c450e[_0x15fd('0x58')]['to'])){}_0x57736b=_0x3c450e[_0x15fd('0x58')]['to'];return db[_0x15fd('0x52')][_0x15fd('0xa9')]({'where':{'id':_0x3c450e[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x37b5c6,null))['then'](function(_0x5b7510){if(_0x5b7510){return db[_0x15fd('0x52')]['find']({'where':{'id':_0x5b7510['id']},'include':[{'model':db[_0x15fd('0x81')],'as':_0x15fd('0x82'),'include':[{'model':db[_0x15fd('0x72')],'as':_0x15fd('0x83'),'where':{[_0x5b7510[_0x15fd('0x7d')]]:_0x57736b},'limit':0x1,'order':[[_0x15fd('0x77'),'DESC']]}]}]})[_0x15fd('0x1d')](handleEntityNotFound(_0x37b5c6,null))[_0x15fd('0x1d')](function(_0x3b3684){if(_0x3b3684&&_0x3b3684['List']){_0x2cfc3d=_0x3b3684[_0x15fd('0x34')]({'plain':!![]});if(_0x2cfc3d[_0x15fd('0x82')]&&_0x2cfc3d[_0x15fd('0x82')][_0x15fd('0x83')][_0x15fd('0x46')]){return _0x2cfc3d[_0x15fd('0x82')][_0x15fd('0x83')][0x0];}return db['CmContact'][_0x15fd('0x57')](_[_0x15fd('0x17')](_0x3c450e['body'],{'firstName':_0x57736b,[_0x3b3684[_0x15fd('0x7d')]]:_0x57736b,'phone':_0x57736b,'ListId':_0x2cfc3d[_0x15fd('0x79')]}));}})['then'](handleEntityNotFound(_0x37b5c6,null))['then'](function(_0x289052){if(_0x289052){_0x5b6a0e=_0x289052;return db[_0x15fd('0x91')]['find']({'where':{'ContactId':_0x5b6a0e['id'],'closed':![],'OpenchannelAccountId':_0x2cfc3d['id']}})[_0x15fd('0x1d')](function(_0x5c8272){if(_0x5c8272){return[_0x5c8272,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x3c450e['user']['id'],'ContactId':_0x5b6a0e['id'],'OpenchannelAccountId':_0x2cfc3d['id'],'lastMsgDirection':'out','Messages':[_[_0x15fd('0x4e')](_0x3c450e[_0x15fd('0x58')],{'read':![],'body':_0x3c450e['body'][_0x15fd('0x58')],'OpenchannelAccountId':_0x2cfc3d['id'],'UserId':_0x3c450e['user']['id'],'ContactId':_0x5b6a0e['id']})]},{'include':[{'model':db[_0x15fd('0x9a')],'as':_0x15fd('0xbb')}]})[_0x15fd('0x1d')](function(_0x401f25){return[_0x401f25,!![]];});});}})[_0x15fd('0xb3')](function(_0x2945e1,_0x76d279){if(_0x76d279){return _0x2945e1;}return db[_0x15fd('0x9a')]['create'](_[_0x15fd('0x4e')](_0x3c450e[_0x15fd('0x58')],{'read':![],'body':_0x3c450e[_0x15fd('0x58')][_0x15fd('0x58')],'OpenchannelAccountId':_0x2cfc3d['id'],'OpenchannelInteractionId':_0x2945e1['id'],'UserId':_0x3c450e[_0x15fd('0x59')]['id'],'ContactId':_0x5b6a0e['id']}))['then'](function(_0x5d9021){_0x2945e1[_0x15fd('0xbc')][_0x15fd('0xbb')]=[];_0x2945e1[_0x15fd('0xbc')][_0x15fd('0xbb')][_0x15fd('0x96')](_0x5d9021[_0x15fd('0xbc')]);return _0x2945e1;});});}})['then'](respondWithResult(_0x37b5c6,null))[_0x15fd('0x28')](handleError(_0x37b5c6,null));}; \ No newline at end of file +var _0xb138=['key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','from','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','contact','messageId','interaction','created','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','internal','color','tag','addAgents','emit','isArray','userOpenchannelAccount:remove','getAgents','send','CmList','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','get','OpenchannelAccounts','stack','name','Pause','mandatoryDispositionPause','map','type'];(function(_0x2b9e4d,_0x20631d){var _0x3e0205=function(_0x32e718){while(--_0x32e718){_0x2b9e4d['push'](_0x2b9e4d['shift']());}};_0x3e0205(++_0x20631d);}(_0xb138,0x1dd));var _0x8b13=function(_0x1ea9ed,_0xd012dc){_0x1ea9ed=_0x1ea9ed-0x0;var _0x1b459a=_0xb138[_0x1ea9ed];return _0x1b459a;};'use strict';var pdf=require(_0x8b13('0x0'));var emlformat=require(_0x8b13('0x1'));var rimraf=require(_0x8b13('0x2'));var zipdir=require(_0x8b13('0x3'));var jsonpatch=require(_0x8b13('0x4'));var rp=require(_0x8b13('0x5'));var moment=require(_0x8b13('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8b13('0x7'));var util=require(_0x8b13('0x8'));var path=require(_0x8b13('0x9'));var sox=require('sox');var csv=require(_0x8b13('0xa'));var ejs=require(_0x8b13('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xa'));var querystring=require(_0x8b13('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x10'));var qs=require(_0x8b13('0x11'));var as=require(_0x8b13('0x12'));var hardwareService=require(_0x8b13('0x13'));var logger=require(_0x8b13('0x14'))('api');var utils=require(_0x8b13('0x15'));var config=require(_0x8b13('0x16'));var licenseUtil=require(_0x8b13('0x17'));var db=require(_0x8b13('0x18'))['db'];config[_0x8b13('0x19')]=_[_0x8b13('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8b13('0x1b'))(new Redis(config[_0x8b13('0x19')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8b13('0x1c')][_0x8b13('0x1d')]({'port':0x232c});var client9002=jayson[_0x8b13('0x1c')][_0x8b13('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x13f956,_0x542357,_0x1c6c99,_0xea7881){return new BPromise(function(_0x393bc1,_0x178f15){var _0x3eed21=_0xea7881||client;return _0x3eed21[_0x8b13('0x1e')](_0x13f956,_0x1c6c99)[_0x8b13('0x1f')](function(_0x441ddc){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x542357,_0x8b13('0x20'));logger[_0x8b13('0x21')](_0x8b13('0x22'),_0x542357,_0x8b13('0x20'),JSON[_0x8b13('0x23')](_0x441ddc));if(_0x441ddc[_0x8b13('0x24')]){if(_0x441ddc['error'][_0x8b13('0x25')]===0x1f4){logger[_0x8b13('0x24')](_0x8b13('0x26'),_0x542357,_0x441ddc['error']['message']);return _0x178f15(_0x441ddc[_0x8b13('0x24')][_0x8b13('0x27')]);}logger['error'](_0x8b13('0x26'),_0x542357,_0x441ddc[_0x8b13('0x24')][_0x8b13('0x27')]);return _0x393bc1(_0x441ddc[_0x8b13('0x24')][_0x8b13('0x27')]);}else{logger['info'](_0x8b13('0x26'),_0x542357,_0x8b13('0x20'));_0x393bc1(_0x441ddc['result'][_0x8b13('0x27')]);}})['catch'](function(_0x420772){logger[_0x8b13('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x542357,_0x420772);_0x178f15(_0x420772);});});}function respondWithStatusCode(_0x3f1756,_0x3223d8){_0x3223d8=_0x3223d8||0xcc;return function(_0x4f8e58){if(_0x4f8e58){return _0x3f1756[_0x8b13('0x28')](_0x3223d8);}return _0x3f1756[_0x8b13('0x29')](_0x3223d8)[_0x8b13('0x2a')]();};}function respondWithResult(_0x4048e4,_0x27fef3){_0x27fef3=_0x27fef3||0xc8;return function(_0x54cdfc){if(_0x54cdfc){return _0x4048e4[_0x8b13('0x29')](_0x27fef3)[_0x8b13('0x2b')](_0x54cdfc);}};}function respondWithFilteredResult(_0x3475d8,_0x1511bf){return function(_0x114b01){if(_0x114b01){var _0x2bb51d=_0x114b01[_0x8b13('0x2c')],_0x5ab161=_0x1511bf[_0x8b13('0x2d')],_0x35fdca=_0x1511bf[_0x8b13('0x2d')]+_0x1511bf[_0x8b13('0x2e')],_0xfec033;if(_0x35fdca>=_0x2bb51d){_0x35fdca=_0x2bb51d;_0xfec033=0xc8;}else{_0xfec033=0xce;}_0x3475d8[_0x8b13('0x29')](_0xfec033);return _0x3475d8[_0x8b13('0x2f')](_0x8b13('0x30'),_0x5ab161+'-'+_0x35fdca+'/'+_0x2bb51d)['json'](_0x114b01);}return null;};}function patchUpdates(_0x14cc2e){return function(_0x193965){try{jsonpatch[_0x8b13('0x31')](_0x193965,_0x14cc2e,!![]);}catch(_0x2878a6){return BPromise['reject'](_0x2878a6);}return _0x193965['save']();};}function saveUpdates(_0xb7771d,_0x5cedea){return function(_0x5663fa){if(_0x5663fa){return _0x5663fa[_0x8b13('0x32')](_0xb7771d)['then'](function(_0x2ec1ab){return _0x2ec1ab;});}return null;};}function removeEntity(_0x408626,_0x40fc29){return function(_0x39a3d2){if(_0x39a3d2){return _0x39a3d2[_0x8b13('0x33')]()[_0x8b13('0x1f')](function(){var _0x1fcd82=_0x39a3d2[_0x8b13('0x34')]({'plain':!![]});var _0x269743=_0x8b13('0x35');return db['UserProfileResource'][_0x8b13('0x33')]({'where':{'type':_0x269743,'resourceId':_0x1fcd82['id']}})[_0x8b13('0x1f')](function(){return _0x39a3d2;});})[_0x8b13('0x1f')](function(){_0x408626[_0x8b13('0x29')](0xcc)[_0x8b13('0x2a')]();});}};}function handleEntityNotFound(_0x24179a,_0x6b4645){return function(_0x241687){if(!_0x241687){_0x24179a['sendStatus'](0x194);}return _0x241687;};}function handleError(_0x219bdf,_0x5089c6){_0x5089c6=_0x5089c6||0x1f4;return function(_0x3826a5){logger[_0x8b13('0x24')](_0x3826a5[_0x8b13('0x36')]);if(_0x3826a5[_0x8b13('0x37')]){delete _0x3826a5[_0x8b13('0x37')];}_0x219bdf[_0x8b13('0x29')](_0x5089c6)['send'](_0x3826a5);};}exports['index']=function(_0xe6963d,_0x5daee9){var _0x3ed902={'include':[{'model':db[_0x8b13('0x38')],'as':_0x8b13('0x39')}]},_0x5b7591={},_0x590a23={'count':0x0,'rows':[]};var _0x2bc877=_[_0x8b13('0x3a')](db['OpenchannelAccount']['rawAttributes'],function(_0x230a8c){return{'name':_0x230a8c['fieldName'],'type':_0x230a8c[_0x8b13('0x3b')][_0x8b13('0x3c')]};});_0x5b7591['model']=_[_0x8b13('0x3a')](_0x2bc877,_0x8b13('0x37'));_0x5b7591[_0x8b13('0x3d')]=_[_0x8b13('0x3e')](_0xe6963d[_0x8b13('0x3d')]);_0x5b7591[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0x5b7591['model'],_0x5b7591['query']);_0x3ed902['attributes']=_[_0x8b13('0x40')](_0x5b7591[_0x8b13('0x41')],qs[_0x8b13('0x42')](_0xe6963d[_0x8b13('0x3d')][_0x8b13('0x42')]));_0x3ed902[_0x8b13('0x43')]=_0x3ed902['attributes'][_0x8b13('0x44')]?_0x3ed902['attributes']:_0x5b7591[_0x8b13('0x41')];if(!_0xe6963d['query'][_0x8b13('0x45')](_0x8b13('0x46'))){_0x3ed902[_0x8b13('0x2e')]=qs[_0x8b13('0x2e')](_0xe6963d[_0x8b13('0x3d')][_0x8b13('0x2e')]);_0x3ed902[_0x8b13('0x2d')]=qs['offset'](_0xe6963d['query']['offset']);}_0x3ed902[_0x8b13('0x47')]=qs[_0x8b13('0x48')](_0xe6963d[_0x8b13('0x3d')][_0x8b13('0x48')]);_0x3ed902['where']=qs['filters'](_[_0x8b13('0x49')](_0xe6963d['query'],_0x5b7591[_0x8b13('0x3f')]),_0x2bc877);if(_0xe6963d[_0x8b13('0x3d')][_0x8b13('0x4a')]){_0x3ed902[_0x8b13('0x4b')]=_[_0x8b13('0x4c')](_0x3ed902['where'],{'$or':_[_0x8b13('0x3a')](_0x2bc877,function(_0x2044fc){if(_0x2044fc[_0x8b13('0x3b')]!==_0x8b13('0x4d')){var _0x2c2c28={};_0x2c2c28[_0x2044fc[_0x8b13('0x37')]]={'$like':'%'+_0xe6963d[_0x8b13('0x3d')][_0x8b13('0x4a')]+'%'};return _0x2c2c28;}})});}_0x3ed902=_[_0x8b13('0x4c')]({},_0x3ed902,_0xe6963d['options']);var _0x46d096={'where':_0x3ed902['where']};return db[_0x8b13('0x4e')][_0x8b13('0x2c')](_0x46d096)[_0x8b13('0x1f')](function(_0x5d9ddb){_0x590a23[_0x8b13('0x2c')]=_0x5d9ddb;if(_0xe6963d[_0x8b13('0x3d')][_0x8b13('0x4f')]){_0x3ed902[_0x8b13('0x50')]=[{'all':!![]}];}return db[_0x8b13('0x4e')][_0x8b13('0x51')](_0x3ed902);})[_0x8b13('0x1f')](function(_0x534636){_0x590a23[_0x8b13('0x52')]=_0x534636;return _0x590a23;})['then'](respondWithFilteredResult(_0x5daee9,_0x3ed902))[_0x8b13('0x53')](handleError(_0x5daee9,null));};exports[_0x8b13('0x54')]=function(_0x193338,_0x435867){var _0x2be640={'raw':![],'where':{'id':_0x193338[_0x8b13('0x55')]['id']},'include':[{'model':db[_0x8b13('0x38')],'as':_0x8b13('0x39')}]},_0x22e613={};_0x22e613[_0x8b13('0x41')]=_[_0x8b13('0x3e')](db[_0x8b13('0x4e')][_0x8b13('0x56')]);_0x22e613[_0x8b13('0x3d')]=_[_0x8b13('0x3e')](_0x193338[_0x8b13('0x3d')]);_0x22e613[_0x8b13('0x3f')]=_['intersection'](_0x22e613[_0x8b13('0x41')],_0x22e613[_0x8b13('0x3d')]);_0x2be640['attributes']=_[_0x8b13('0x40')](_0x22e613[_0x8b13('0x41')],qs[_0x8b13('0x42')](_0x193338[_0x8b13('0x3d')][_0x8b13('0x42')]));_0x2be640[_0x8b13('0x43')]=_0x2be640[_0x8b13('0x43')][_0x8b13('0x44')]?_0x2be640[_0x8b13('0x43')]:_0x22e613[_0x8b13('0x41')];if(_0x193338[_0x8b13('0x3d')][_0x8b13('0x4f')]){_0x2be640[_0x8b13('0x50')]=[{'all':!![]}];}_0x2be640=_[_0x8b13('0x4c')]({},_0x2be640,_0x193338[_0x8b13('0x57')]);return db['OpenchannelAccount'][_0x8b13('0x58')](_0x2be640)[_0x8b13('0x1f')](handleEntityNotFound(_0x435867,null))['then'](respondWithResult(_0x435867,null))[_0x8b13('0x53')](handleError(_0x435867,null));};exports[_0x8b13('0x59')]=function(_0x237e45,_0x46c595){return db[_0x8b13('0x4e')]['create'](_0x237e45[_0x8b13('0x5a')],{})[_0x8b13('0x1f')](function(_0x46850a){var _0x52e2a6=_0x237e45[_0x8b13('0x5b')][_0x8b13('0x34')]({'plain':!![]});if(!_0x52e2a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52e2a6[_0x8b13('0x5c')]===_0x8b13('0x5b')){var _0x475c8d=_0x46850a[_0x8b13('0x34')]({'plain':!![]});var _0x49e5cd=_0x8b13('0x35');return db[_0x8b13('0x5d')]['find']({'where':{'name':_0x49e5cd,'userProfileId':_0x52e2a6[_0x8b13('0x5e')]},'raw':!![]})[_0x8b13('0x1f')](function(_0x311a5e){if(_0x311a5e&&_0x311a5e[_0x8b13('0x5f')]===0x0){return db['UserProfileResource'][_0x8b13('0x59')]({'name':_0x475c8d[_0x8b13('0x37')],'resourceId':_0x475c8d['id'],'type':_0x311a5e[_0x8b13('0x37')],'sectionId':_0x311a5e['id']},{})[_0x8b13('0x1f')](function(){return _0x46850a;});}else{return _0x46850a;}})[_0x8b13('0x53')](function(_0x2fff4e){logger['error'](_0x8b13('0x60'),_0x2fff4e);throw _0x2fff4e;});}return _0x46850a;})[_0x8b13('0x1f')](respondWithResult(_0x46c595,0xc9))[_0x8b13('0x53')](handleError(_0x46c595,null));};exports['update']=function(_0xe7f2fc,_0x576c91){if(_0xe7f2fc[_0x8b13('0x5a')]['id']){delete _0xe7f2fc[_0x8b13('0x5a')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xe7f2fc['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x8b13('0x1f')](handleEntityNotFound(_0x576c91,null))[_0x8b13('0x1f')](saveUpdates(_0xe7f2fc['body'],null))[_0x8b13('0x1f')](respondWithResult(_0x576c91,null))['catch'](handleError(_0x576c91,null));};exports[_0x8b13('0x33')]=function(_0x2d2fa3,_0x42790f){return db[_0x8b13('0x4e')][_0x8b13('0x58')]({'where':{'id':_0x2d2fa3[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x42790f,null))['then'](removeEntity(_0x42790f,null))[_0x8b13('0x53')](handleError(_0x42790f,null));};exports['describe']=function(_0xa31d7d,_0x2ce908){return db[_0x8b13('0x4e')][_0x8b13('0x61')]()[_0x8b13('0x1f')](respondWithResult(_0x2ce908,null))[_0x8b13('0x53')](handleError(_0x2ce908,null));};exports[_0x8b13('0x62')]=function(_0x550ff1,_0x122588,_0x5d1174){if(_0x550ff1[_0x8b13('0x5a')]['id']){delete _0x550ff1[_0x8b13('0x5a')]['id'];}return db[_0x8b13('0x4e')][_0x8b13('0x58')]({'where':{'id':_0x550ff1[_0x8b13('0x55')]['id']}})['then'](handleEntityNotFound(_0x122588,null))['then'](function(_0x319923){if(_0x319923){_0x550ff1[_0x8b13('0x5a')]['OpenchannelAccountId']=_0x319923['id'];return db[_0x8b13('0x63')][_0x8b13('0x59')](_0x550ff1[_0x8b13('0x5a')]);}})['then'](respondWithResult(_0x122588,null))[_0x8b13('0x53')](handleError(_0x122588,null));};exports[_0x8b13('0x64')]=function(_0x15ce51,_0x228e63,_0x52850c){var _0x2a6c62={'raw':![],'where':{}};var _0xd7002a={};var _0x4f062d={'count':0x0,'rows':[]};return db[_0x8b13('0x4e')][_0x8b13('0x65')]({'where':{'id':_0x15ce51[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x228e63,null))[_0x8b13('0x1f')](function(_0x1243f8){if(_0x1243f8){_0xd7002a[_0x8b13('0x41')]=_[_0x8b13('0x3e')](db[_0x8b13('0x63')][_0x8b13('0x56')]);_0xd7002a[_0x8b13('0x3d')]=_[_0x8b13('0x3e')](_0x15ce51[_0x8b13('0x3d')]);_0xd7002a[_0x8b13('0x3f')]=_['intersection'](_0xd7002a[_0x8b13('0x41')],_0xd7002a['query']);_0x2a6c62[_0x8b13('0x43')]=_[_0x8b13('0x40')](_0xd7002a[_0x8b13('0x41')],qs[_0x8b13('0x42')](_0x15ce51['query']['fields']));_0x2a6c62[_0x8b13('0x43')]=_0x2a6c62[_0x8b13('0x43')]['length']?_0x2a6c62[_0x8b13('0x43')]:_0xd7002a[_0x8b13('0x41')];if(!_0x15ce51[_0x8b13('0x3d')][_0x8b13('0x45')](_0x8b13('0x46'))){_0x2a6c62[_0x8b13('0x2e')]=qs[_0x8b13('0x2e')](_0x15ce51[_0x8b13('0x3d')][_0x8b13('0x2e')]);_0x2a6c62[_0x8b13('0x2d')]=qs['offset'](_0x15ce51[_0x8b13('0x3d')][_0x8b13('0x2d')]);}_0x2a6c62['order']=qs[_0x8b13('0x48')](_0x15ce51[_0x8b13('0x3d')]['sort']);_0x2a6c62[_0x8b13('0x4b')]=qs[_0x8b13('0x3f')](_[_0x8b13('0x49')](_0x15ce51[_0x8b13('0x3d')],_0xd7002a[_0x8b13('0x3f')]));_0x2a6c62[_0x8b13('0x4b')][_0x8b13('0x66')]=_0x1243f8['id'];if(_0x15ce51[_0x8b13('0x3d')]['filter']){_0x2a6c62[_0x8b13('0x4b')]=_[_0x8b13('0x4c')](_0x2a6c62[_0x8b13('0x4b')],{'$or':_['map'](_0x2a6c62[_0x8b13('0x43')],function(_0x5d6647){var _0x2e736b={};_0x2e736b[_0x5d6647]={'$like':'%'+_0x15ce51[_0x8b13('0x3d')][_0x8b13('0x4a')]+'%'};return _0x2e736b;})});}_0x2a6c62=_[_0x8b13('0x4c')]({},_0x2a6c62,_0x15ce51[_0x8b13('0x57')]);return db[_0x8b13('0x63')][_0x8b13('0x2c')]({'where':_0x2a6c62[_0x8b13('0x4b')]})[_0x8b13('0x1f')](function(_0x2ae970){_0x4f062d['count']=_0x2ae970;if(_0x15ce51[_0x8b13('0x3d')][_0x8b13('0x4f')]){_0x2a6c62[_0x8b13('0x50')]=[{'all':!![]}];}return db[_0x8b13('0x63')][_0x8b13('0x51')](_0x2a6c62);})[_0x8b13('0x1f')](function(_0x2c69f5){_0x4f062d[_0x8b13('0x52')]=_0x2c69f5;return _0x4f062d;});}})[_0x8b13('0x1f')](respondWithFilteredResult(_0x228e63,_0x2a6c62))[_0x8b13('0x53')](handleError(_0x228e63,null));};exports[_0x8b13('0x67')]=function(_0x1819fb,_0x378e33,_0x4bb71a){return db['OpenchannelAccount'][_0x8b13('0x58')]({'where':{'id':_0x1819fb['params']['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x378e33,null))[_0x8b13('0x1f')](function(_0x57c9af){if(_0x57c9af){return _0x57c9af['removeDispositions'](_0x1819fb[_0x8b13('0x3d')][_0x8b13('0x68')]);}})[_0x8b13('0x1f')](respondWithStatusCode(_0x378e33,null))[_0x8b13('0x53')](handleError(_0x378e33,null));};exports[_0x8b13('0x69')]=function(_0x5b8abf,_0x2b0aca,_0x5152d0){if(_0x5b8abf[_0x8b13('0x5a')]['id']){delete _0x5b8abf[_0x8b13('0x5a')]['id'];}return db['OpenchannelAccount'][_0x8b13('0x58')]({'where':{'id':_0x5b8abf[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x2b0aca,null))[_0x8b13('0x1f')](function(_0x2f1ddf){if(_0x2f1ddf){_0x5b8abf['body'][_0x8b13('0x66')]=_0x2f1ddf['id'];return db[_0x8b13('0x6a')][_0x8b13('0x59')](_0x5b8abf['body']);}})[_0x8b13('0x1f')](respondWithResult(_0x2b0aca,null))['catch'](handleError(_0x2b0aca,null));};exports[_0x8b13('0x6b')]=function(_0xc4e163,_0x3f9df4,_0x30cadc){var _0x229009={'raw':![],'where':{}};var _0xe70f1b={};var _0x441173={'count':0x0,'rows':[]};return db[_0x8b13('0x4e')][_0x8b13('0x65')]({'where':{'id':_0xc4e163[_0x8b13('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f9df4,null))[_0x8b13('0x1f')](function(_0x355c4a){if(_0x355c4a){_0xe70f1b[_0x8b13('0x41')]=_[_0x8b13('0x3e')](db[_0x8b13('0x6a')]['rawAttributes']);_0xe70f1b[_0x8b13('0x3d')]=_[_0x8b13('0x3e')](_0xc4e163[_0x8b13('0x3d')]);_0xe70f1b[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0xe70f1b[_0x8b13('0x41')],_0xe70f1b['query']);_0x229009[_0x8b13('0x43')]=_[_0x8b13('0x40')](_0xe70f1b['model'],qs[_0x8b13('0x42')](_0xc4e163['query'][_0x8b13('0x42')]));_0x229009['attributes']=_0x229009[_0x8b13('0x43')][_0x8b13('0x44')]?_0x229009[_0x8b13('0x43')]:_0xe70f1b[_0x8b13('0x41')];if(!_0xc4e163[_0x8b13('0x3d')][_0x8b13('0x45')](_0x8b13('0x46'))){_0x229009[_0x8b13('0x2e')]=qs['limit'](_0xc4e163[_0x8b13('0x3d')][_0x8b13('0x2e')]);_0x229009['offset']=qs[_0x8b13('0x2d')](_0xc4e163[_0x8b13('0x3d')]['offset']);}_0x229009[_0x8b13('0x47')]=qs[_0x8b13('0x48')](_0xc4e163[_0x8b13('0x3d')][_0x8b13('0x48')]);_0x229009[_0x8b13('0x4b')]=qs['filters'](_['pick'](_0xc4e163[_0x8b13('0x3d')],_0xe70f1b[_0x8b13('0x3f')]));_0x229009[_0x8b13('0x4b')][_0x8b13('0x66')]=_0x355c4a['id'];if(_0xc4e163[_0x8b13('0x3d')][_0x8b13('0x4a')]){_0x229009[_0x8b13('0x4b')]=_[_0x8b13('0x4c')](_0x229009[_0x8b13('0x4b')],{'$or':_[_0x8b13('0x3a')](_0x229009[_0x8b13('0x43')],function(_0x30ad20){var _0xf19be7={};_0xf19be7[_0x30ad20]={'$like':'%'+_0xc4e163[_0x8b13('0x3d')][_0x8b13('0x4a')]+'%'};return _0xf19be7;})});}_0x229009=_[_0x8b13('0x4c')]({},_0x229009,_0xc4e163['options']);return db[_0x8b13('0x6a')]['count']({'where':_0x229009[_0x8b13('0x4b')]})[_0x8b13('0x1f')](function(_0xeb3c0f){_0x441173[_0x8b13('0x2c')]=_0xeb3c0f;if(_0xc4e163[_0x8b13('0x3d')][_0x8b13('0x4f')]){_0x229009[_0x8b13('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8b13('0x51')](_0x229009);})['then'](function(_0x85f327){_0x441173[_0x8b13('0x52')]=_0x85f327;return _0x441173;});}})['then'](respondWithFilteredResult(_0x3f9df4,_0x229009))['catch'](handleError(_0x3f9df4,null));};exports[_0x8b13('0x6c')]=function(_0xdbe4f6,_0x22ae53,_0x220abd){return db[_0x8b13('0x4e')][_0x8b13('0x58')]({'where':{'id':_0xdbe4f6['params']['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x22ae53,null))[_0x8b13('0x1f')](function(_0x4ed244){if(_0x4ed244){return _0x4ed244['removeAnswers'](_0xdbe4f6['query'][_0x8b13('0x68')]);}})[_0x8b13('0x1f')](respondWithStatusCode(_0x22ae53,null))[_0x8b13('0x53')](handleError(_0x22ae53,null));};exports[_0x8b13('0x6d')]=function(_0x44b19b,_0x3b92eb,_0x270b56){var _0xcfc265={'body':_0x44b19b['body'],'channel':_0x8b13('0x6e')};var _0x598662=[];var _0x3a7bc9=[];var _0x54af16={};var _0x38f4d2=![];return db[_0x8b13('0x6f')]['describe']()[_0x8b13('0x1f')](function(_0x2fa301){if(!_0x2fa301){throw new db[(_0x8b13('0x70'))][(_0x8b13('0x71'))](_0x8b13('0x72'));}_0x598662=_['difference'](_[_0x8b13('0x3e')](_0x2fa301),[_0x8b13('0x73'),_0x8b13('0x74')]);_0x3a7bc9=_[_0x8b13('0x75')](_['keys'](_0x2fa301),[_0x8b13('0x73'),'updatedAt',_0x8b13('0x76'),_0x8b13('0x77')]);if(_0x44b19b[_0x8b13('0x5a')]['id']){delete _0x44b19b['body']['id'];}if(_['isNil'](_0x44b19b['body']['from'])){throw new db[(_0x8b13('0x70'))]['ValidationError'](_0x8b13('0x78'));}if(_['isNil'](_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x5a')])||_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x5a')]===''){throw new db[(_0x8b13('0x70'))][(_0x8b13('0x71'))](_0x8b13('0x79'));}if(_[_0x8b13('0x7a')](_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x7b')])){throw new db[(_0x8b13('0x70'))][(_0x8b13('0x71'))](_0x8b13('0x7c')+_0x3a7bc9);}if(!_['includes'](_0x3a7bc9,_0x44b19b[_0x8b13('0x5a')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x8b13('0x7d')+_0x3a7bc9);}_0x54af16[_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x7b')]]=_0x44b19b[_0x8b13('0x5a')]['from'];})[_0x8b13('0x1f')](function(){return db['OpenchannelAccount'][_0x8b13('0x58')]({'where':{'id':_0x44b19b[_0x8b13('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x8b13('0x7e'),'include':[{'model':db[_0x8b13('0x6f')],'as':_0x8b13('0x7f'),'where':_0x54af16,'limit':0x1,'order':[['updatedAt',_0x8b13('0x80')]]}]},{'model':db[_0x8b13('0x81')],'as':_0x8b13('0x82')}]});})[_0x8b13('0x1f')](handleEntityNotFound(_0x3b92eb,null))[_0x8b13('0x1f')](function(_0x2a46ed){if(_0x2a46ed&&_0x2a46ed[_0x8b13('0x7e')]){_0xcfc265[_0x8b13('0x83')]=_0x2a46ed;_0xcfc265[_0x8b13('0x84')]=_0x2a46ed[_0x8b13('0x82')];_0xcfc265[_0x8b13('0x85')]=_0x2a46ed[_0x8b13('0x7e')];_0xcfc265[_0x8b13('0x84')]=_[_0x8b13('0x86')](_0xcfc265[_0x8b13('0x84')],[_0x8b13('0x87')],['asc']);if(_0xcfc265[_0x8b13('0x83')][_0x8b13('0x82')]){delete _0xcfc265[_0x8b13('0x83')]['Applications'];}if(_0xcfc265[_0x8b13('0x83')]['List']&&_0xcfc265[_0x8b13('0x83')][_0x8b13('0x7e')][_0x8b13('0x7f')]['length']){return _0xcfc265[_0x8b13('0x83')][_0x8b13('0x7e')][_0x8b13('0x7f')][0x0];}var _0x52ca71=_[_0x8b13('0x1a')](_0x44b19b[_0x8b13('0x5a')],{'firstName':_0x44b19b['body'][_0x8b13('0x88')],'ListId':_0x2a46ed[_0x8b13('0x77')]});_0x52ca71[_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x7b')]]=_0x44b19b['body'][_0x8b13('0x88')];return db[_0x8b13('0x6f')][_0x8b13('0x59')](_0x52ca71,{'fields':_0x598662,'raw':!![]});}})['then'](handleEntityNotFound(_0x3b92eb,null))[_0x8b13('0x1f')](function(_0x189c2c){_0xcfc265['contact']=_0x189c2c;if(_0x189c2c){var _0x1404db={'ContactId':_0x189c2c['id'],'OpenchannelAccountId':_0x44b19b['params']['id'],'from':(_0x189c2c[_0x8b13('0x89')]||'')+'\x20'+(_0x189c2c[_0x8b13('0x8a')]||'')};var _0x4b5d22={'OpenchannelAccountId':_0x44b19b['params']['id'],'closed':![]};if(_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x8b')]){_0x4b5d22[_0x8b13('0x8b')]=_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x8b')];return db[_0x8b13('0x8c')][_0x8b13('0x58')]({'where':_0x4b5d22})[_0x8b13('0x1f')](function(_0x21b089){if(_0x21b089){return[_0x21b089,![]];}_0x1404db[_0x8b13('0x8b')]=_0x44b19b[_0x8b13('0x5a')]['threadId'];_0x1404db[_0x8b13('0x8d')]=_0x44b19b[_0x8b13('0x5a')]['externalUrl'];return db[_0x8b13('0x8c')]['create'](_0x1404db)[_0x8b13('0x1f')](function(_0xea8843){return[_0xea8843,!![]];});});}else{_0x4b5d22[_0x8b13('0x8b')]=null;}_0x4b5d22['ContactId']=_0x189c2c['id'];return db[_0x8b13('0x8c')][_0x8b13('0x58')]({'where':_0x4b5d22})[_0x8b13('0x1f')](function(_0x3e0cf8){if(_0x3e0cf8){return[_0x3e0cf8,![]];}return db[_0x8b13('0x8c')]['create'](_0x1404db)[_0x8b13('0x1f')](function(_0x2dba23){return[_0x2dba23,!![]];});});}})[_0x8b13('0x8e')](function(_0x3c64fe,_0xfe9601){if(_0x3c64fe){_0x38f4d2=_0xfe9601;if(!_0xfe9601){var _0x22221e={'from':(_0xcfc265['contact'][_0x8b13('0x89')]||'')+'\x20'+(_0xcfc265[_0x8b13('0x8f')][_0x8b13('0x8a')]||'')};if(_0x44b19b[_0x8b13('0x5a')]['threadId']&&_0x44b19b[_0x8b13('0x5a')]['messageId']&&_0x44b19b['body'][_0x8b13('0x8b')]!=_0x44b19b[_0x8b13('0x5a')]['messageId']){_0x22221e[_0x8b13('0x8b')]=_0x44b19b['body'][_0x8b13('0x90')];}return _0x3c64fe['update'](_0x22221e);}else{return _0x3c64fe;}}})[_0x8b13('0x1f')](function(_0x18c4f3){_0xcfc265[_0x8b13('0x91')]=_0x18c4f3[_0x8b13('0x34')]({'plain':!![]});_0xcfc265[_0x8b13('0x91')][_0x8b13('0x92')]=_0x38f4d2;if(_0xcfc265[_0x8b13('0x91')][_0x8b13('0x92')]){if(_0xcfc265[_0x8b13('0x83')]['autoclose']){_0xcfc265[_0x8b13('0x84')][_0x8b13('0x93')]({'id':0x0,'priority':_0xcfc265['applications'][_0x8b13('0x44')]+0x1,'app':_0x8b13('0x94'),'appdata':_0x8b13('0x95'),'interval':'*,*,*,*'});}}return db[_0x8b13('0x96')][_0x8b13('0x59')]({'body':_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x5a')],'OpenchannelAccountId':_0x44b19b['params']['id'],'OpenchannelInteractionId':_0x18c4f3['id'],'direction':'in','ContactId':_0xcfc265[_0x8b13('0x8f')]['id'],'AttachmentId':_0x44b19b[_0x8b13('0x5a')][_0x8b13('0x97')]});})[_0x8b13('0x1f')](function(_0x2a44a7){_0xcfc265[_0x8b13('0x27')]=_0x2a44a7;if(_0xcfc265[_0x8b13('0x91')][_0x8b13('0x98')]){return db[_0x8b13('0x99')][_0x8b13('0x58')]({'attributes':['id',_0x8b13('0x37')],'where':{'id':_0xcfc265['interaction'][_0x8b13('0x98')]}})[_0x8b13('0x1f')](function(_0x5a2ff3){if(_0x5a2ff3){_0xcfc265[_0x8b13('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8b13('0x9a'),'appdata':_0x5a2ff3[_0x8b13('0x37')]+','+(_0xcfc265[_0x8b13('0x83')][_0x8b13('0x9b')]||0xa),'interval':_0x8b13('0x9c')});_0xcfc265[_0x8b13('0x9d')]=![];}return respondWithRpcPromise(_0x8b13('0x9e'),_0x8b13('0x9f'),_0xcfc265);});}return respondWithRpcPromise(_0x8b13('0x9e'),_0x8b13('0x9f'),_0xcfc265);})[_0x8b13('0x1f')](function(_0x37e345){respondWithRpcPromise(_0x8b13('0xa0'),_0x8b13('0xa0'),{'event':_0x8b13('0x6d'),'message':_0x37e345},client9002);return _0x37e345;})[_0x8b13('0x1f')](respondWithResult(_0x3b92eb,null))[_0x8b13('0x53')](handleError(_0x3b92eb,null));};exports[_0x8b13('0xa1')]=function(_0x2a31c5,_0x439581,_0x512e13){return db[_0x8b13('0x4e')]['findOne']({'where':{'id':_0x2a31c5[_0x8b13('0x55')]['id']}})['then'](handleEntityNotFound(_0x439581,null))[_0x8b13('0x1f')](function(_0x56b9aa){if(_0x56b9aa){return db[_0x8b13('0xa2')]['transaction'](function(_0x2de36d){return db[_0x8b13('0x81')][_0x8b13('0x33')]({'where':{'OpenchannelAccountId':_0x2a31c5['params']['id']},'transaction':_0x2de36d})[_0x8b13('0x1f')](function(_0x41782b){var _0xf541e4=_[_0x8b13('0x3a')](_0x2a31c5['body'],function(_0x3b795d){_0x3b795d[_0x8b13('0x66')]=_0x2a31c5[_0x8b13('0x55')]['id'];return _0x3b795d;});return db[_0x8b13('0x81')][_0x8b13('0xa3')](_0xf541e4,{'transaction':_0x2de36d});});})['then'](function(){return db[_0x8b13('0x81')][_0x8b13('0xa4')]({'where':{'OpenchannelAccountId':_0x2a31c5[_0x8b13('0x55')]['id']},'order':_0x8b13('0x87')});});}})[_0x8b13('0x1f')](respondWithResult(_0x439581,null))['catch'](handleError(_0x439581,null));};exports['getApplications']=function(_0x408300,_0x5d6aeb,_0x35d90b){var _0x3ce2f6={};var _0x467779={};var _0x905cf6;var _0x2154a1;return db[_0x8b13('0x4e')][_0x8b13('0x65')]({'where':{'id':_0x408300[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x5d6aeb,null))[_0x8b13('0x1f')](function(_0x147eed){if(_0x147eed){_0x905cf6=_0x147eed;_0x467779[_0x8b13('0x41')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x467779['query']=_['keys'](_0x408300[_0x8b13('0x3d')]);_0x467779[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0x467779[_0x8b13('0x41')],_0x467779[_0x8b13('0x3d')]);_0x3ce2f6[_0x8b13('0x43')]=_[_0x8b13('0x40')](_0x467779[_0x8b13('0x41')],qs[_0x8b13('0x42')](_0x408300[_0x8b13('0x3d')]['fields']));_0x3ce2f6[_0x8b13('0x43')]=_0x3ce2f6[_0x8b13('0x43')][_0x8b13('0x44')]?_0x3ce2f6['attributes']:_0x467779['model'];_0x3ce2f6[_0x8b13('0x47')]=qs[_0x8b13('0x48')](_0x408300['query'][_0x8b13('0x48')]);_0x3ce2f6[_0x8b13('0x4b')]=qs['filters'](_[_0x8b13('0x49')](_0x408300[_0x8b13('0x3d')],_0x467779[_0x8b13('0x3f')]));if(_0x408300[_0x8b13('0x3d')][_0x8b13('0x4a')]){_0x3ce2f6['where']=_['merge'](_0x3ce2f6[_0x8b13('0x4b')],{'$or':_['map'](_0x3ce2f6[_0x8b13('0x43')],function(_0xb97fdd){var _0x12805a={};_0x12805a[_0xb97fdd]={'$like':'%'+_0x408300['query'][_0x8b13('0x4a')]+'%'};return _0x12805a;})});}_0x3ce2f6=_[_0x8b13('0x4c')]({},_0x3ce2f6,_0x408300[_0x8b13('0x57')]);return _0x905cf6[_0x8b13('0xa5')](_0x3ce2f6);}})['then'](function(_0x164202){if(_0x164202){_0x2154a1=_0x164202['length'];if(!_0x408300[_0x8b13('0x3d')]['hasOwnProperty'](_0x8b13('0x46'))){_0x3ce2f6[_0x8b13('0x2e')]=qs[_0x8b13('0x2e')](_0x408300[_0x8b13('0x3d')][_0x8b13('0x2e')]);_0x3ce2f6[_0x8b13('0x2d')]=qs[_0x8b13('0x2d')](_0x408300[_0x8b13('0x3d')][_0x8b13('0x2d')]);}return _0x905cf6[_0x8b13('0xa5')](_0x3ce2f6);}})[_0x8b13('0x1f')](function(_0x5c6192){if(_0x5c6192){return _0x5c6192?{'count':_0x2154a1,'rows':_0x5c6192}:null;}})[_0x8b13('0x1f')](respondWithResult(_0x5d6aeb,null))[_0x8b13('0x53')](handleError(_0x5d6aeb,null));};exports['getInteractions']=function(_0x3dbd02,_0x2e6d85,_0x1650bb){var _0x2d605e={'raw':![],'where':{}};var _0x1cbb3d={};var _0x16bc2f={'count':0x0,'rows':[]};return db[_0x8b13('0x4e')][_0x8b13('0x65')]({'where':{'id':_0x3dbd02[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x2e6d85,null))['then'](function(_0x1b8bf6){if(_0x1b8bf6){_0x1cbb3d['model']=_[_0x8b13('0x3e')](db['OpenchannelInteraction'][_0x8b13('0x56')]);_0x1cbb3d['query']=_[_0x8b13('0x3e')](_0x3dbd02['query']);_0x1cbb3d[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0x1cbb3d[_0x8b13('0x41')],_0x1cbb3d[_0x8b13('0x3d')]);_0x2d605e[_0x8b13('0x43')]=_[_0x8b13('0x40')](_0x1cbb3d[_0x8b13('0x41')],qs[_0x8b13('0x42')](_0x3dbd02[_0x8b13('0x3d')][_0x8b13('0x42')]));_0x2d605e[_0x8b13('0x43')]=_0x2d605e['attributes'][_0x8b13('0x44')]?_0x2d605e[_0x8b13('0x43')]:_0x1cbb3d[_0x8b13('0x41')];if(!_0x3dbd02[_0x8b13('0x3d')]['hasOwnProperty'](_0x8b13('0x46'))){_0x2d605e[_0x8b13('0x2e')]=qs[_0x8b13('0x2e')](_0x3dbd02[_0x8b13('0x3d')][_0x8b13('0x2e')]);_0x2d605e[_0x8b13('0x2d')]=qs['offset'](_0x3dbd02[_0x8b13('0x3d')][_0x8b13('0x2d')]);}_0x2d605e[_0x8b13('0x47')]=qs[_0x8b13('0x48')](_0x3dbd02[_0x8b13('0x3d')][_0x8b13('0x48')]);_0x2d605e[_0x8b13('0x4b')]=qs[_0x8b13('0x3f')](_[_0x8b13('0x49')](_0x3dbd02[_0x8b13('0x3d')],_0x1cbb3d['filters']));_0x2d605e[_0x8b13('0x4b')][_0x8b13('0x66')]=_0x1b8bf6['id'];if(_0x3dbd02['query'][_0x8b13('0x4a')]){_0x2d605e['where']=_[_0x8b13('0x4c')](_0x2d605e[_0x8b13('0x4b')],{'$or':_[_0x8b13('0x3a')](_0x2d605e[_0x8b13('0x43')],function(_0x4dd58e){var _0x418c42={};_0x418c42[_0x4dd58e]={'$like':'%'+_0x3dbd02[_0x8b13('0x3d')]['filter']+'%'};return _0x418c42;})});}_0x2d605e=_[_0x8b13('0x4c')]({},_0x2d605e,_0x3dbd02['options']);return db[_0x8b13('0x8c')][_0x8b13('0x2c')]({'where':_0x2d605e[_0x8b13('0x4b')]})[_0x8b13('0x1f')](function(_0x3b9755){_0x16bc2f[_0x8b13('0x2c')]=_0x3b9755;if(_0x3dbd02[_0x8b13('0x3d')]['includeAll']){_0x2d605e[_0x8b13('0x50')]=[{'model':db[_0x8b13('0x6f')],'as':_0x8b13('0xa6'),'required':![]},{'model':db[_0x8b13('0x99')],'as':'Owner','attributes':['name','fullname',_0x8b13('0xa7')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x8b13('0x37'),_0x8b13('0xa8')],'where':_0x3dbd02[_0x8b13('0x3d')][_0x8b13('0xa9')]?{'id':_0x3dbd02[_0x8b13('0x3d')][_0x8b13('0xa9')]}:undefined,'required':_0x3dbd02[_0x8b13('0x3d')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x8b13('0x51')](_0x2d605e);})['then'](function(_0x230323){_0x16bc2f[_0x8b13('0x52')]=_0x230323;return _0x16bc2f;});}})[_0x8b13('0x1f')](respondWithFilteredResult(_0x2e6d85,_0x2d605e))['catch'](handleError(_0x2e6d85,null));};exports[_0x8b13('0xaa')]=function(_0x5b014a,_0x22f8e2,_0x1e593c){return db[_0x8b13('0x4e')]['find']({'where':{'id':_0x5b014a[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x22f8e2,null))[_0x8b13('0x1f')](function(_0x3cc463){if(_0x3cc463){return _0x3cc463[_0x8b13('0xaa')](_0x5b014a[_0x8b13('0x5a')][_0x8b13('0x68')],_['omit'](_0x5b014a['body'],['ids','id'])||{})[_0x8b13('0x8e')](function(_0x2c2d3c){for(var _0x5f1fb4=0x0;_0x5f1fb4<_0x5b014a[_0x8b13('0x5a')]['ids'][_0x8b13('0x44')];_0x5f1fb4+=0x1){socket[_0x8b13('0xab')]('userOpenchannelAccount:save',{'UserId':_0x5b014a[_0x8b13('0x5a')][_0x8b13('0x68')][_0x5f1fb4],'OpenchannelAccountId':_0x5b014a[_0x8b13('0x55')]['id']});}return _0x2c2d3c;});}})[_0x8b13('0x1f')](respondWithResult(_0x22f8e2,null))[_0x8b13('0x53')](handleError(_0x22f8e2,null));};exports['removeAgents']=function(_0x49c030,_0xc16754,_0x3cdd4a){return db[_0x8b13('0x4e')][_0x8b13('0x58')]({'where':{'id':_0x49c030[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0xc16754,null))[_0x8b13('0x1f')](function(_0x29e355){if(_0x29e355){return _0x29e355['removeAgents'](_0x49c030[_0x8b13('0x3d')]['ids'])[_0x8b13('0x1f')](function(){if(_[_0x8b13('0xac')](_0x49c030[_0x8b13('0x3d')][_0x8b13('0x68')])){for(var _0x4ec611=0x0;_0x4ec611<_0x49c030[_0x8b13('0x3d')][_0x8b13('0x68')][_0x8b13('0x44')];_0x4ec611+=0x1){socket[_0x8b13('0xab')](_0x8b13('0xad'),{'UserId':Number(_0x49c030[_0x8b13('0x3d')][_0x8b13('0x68')][_0x4ec611]),'OpenchannelAccountId':Number(_0x49c030[_0x8b13('0x55')]['id'])});}}else{socket[_0x8b13('0xab')]('userOpenchannelAccount:remove',{'UserId':Number(_0x49c030[_0x8b13('0x3d')][_0x8b13('0x68')]),'OpenchannelAccountId':Number(_0x49c030[_0x8b13('0x55')]['id'])});}});}})[_0x8b13('0x1f')](respondWithStatusCode(_0xc16754,null))[_0x8b13('0x53')](handleError(_0xc16754,null));};exports[_0x8b13('0xae')]=function(_0x21391c,_0x1855c1,_0xbb8d81){var _0x3ca469={};var _0xddccf7={};var _0x170d79;var _0x3f432d;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x21391c[_0x8b13('0x55')]['id']}})[_0x8b13('0x1f')](handleEntityNotFound(_0x1855c1,null))['then'](function(_0x12ed1e){if(_0x12ed1e){_0x170d79=_0x12ed1e;_0xddccf7[_0x8b13('0x41')]=_[_0x8b13('0x3e')](db[_0x8b13('0x99')]['rawAttributes']);_0xddccf7['query']=_[_0x8b13('0x3e')](_0x21391c[_0x8b13('0x3d')]);_0xddccf7[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0xddccf7[_0x8b13('0x41')],_0xddccf7[_0x8b13('0x3d')]);_0x3ca469['attributes']=_[_0x8b13('0x40')](_0xddccf7[_0x8b13('0x41')],qs['fields'](_0x21391c['query'][_0x8b13('0x42')]));_0x3ca469[_0x8b13('0x43')]=_0x3ca469[_0x8b13('0x43')]['length']?_0x3ca469[_0x8b13('0x43')]:_0xddccf7['model'];_0x3ca469['order']=qs[_0x8b13('0x48')](_0x21391c[_0x8b13('0x3d')]['sort']);_0x3ca469['where']=qs[_0x8b13('0x3f')](_['pick'](_0x21391c[_0x8b13('0x3d')],_0xddccf7[_0x8b13('0x3f')]));if(_0x21391c[_0x8b13('0x3d')][_0x8b13('0x4a')]){_0x3ca469[_0x8b13('0x4b')]=_['merge'](_0x3ca469['where'],{'$or':_[_0x8b13('0x3a')](_0x3ca469['attributes'],function(_0x5d459f){var _0x342ad8={};_0x342ad8[_0x5d459f]={'$like':'%'+_0x21391c[_0x8b13('0x3d')][_0x8b13('0x4a')]+'%'};return _0x342ad8;})});}_0x3ca469=_[_0x8b13('0x4c')]({},_0x3ca469,_0x21391c[_0x8b13('0x57')]);return _0x170d79[_0x8b13('0xae')](_0x3ca469);}})['then'](function(_0x460501){if(_0x460501){_0x3f432d=_0x460501[_0x8b13('0x44')];if(!_0x21391c[_0x8b13('0x3d')][_0x8b13('0x45')]('nolimit')){_0x3ca469['limit']=qs[_0x8b13('0x2e')](_0x21391c[_0x8b13('0x3d')][_0x8b13('0x2e')]);_0x3ca469[_0x8b13('0x2d')]=qs[_0x8b13('0x2d')](_0x21391c['query'][_0x8b13('0x2d')]);}return _0x170d79['getAgents'](_0x3ca469);}})[_0x8b13('0x1f')](function(_0x2f115c){if(_0x2f115c){return _0x2f115c?{'count':_0x3f432d,'rows':_0x2f115c}:null;}})[_0x8b13('0x1f')](respondWithResult(_0x1855c1,null))['catch'](handleError(_0x1855c1,null));};exports[_0x8b13('0xaf')]=function(_0x15071b,_0x1a1962,_0x575635){var _0x33f458,_0x128df7,_0x221f32;if(_[_0x8b13('0x7a')](_0x15071b[_0x8b13('0x5a')][_0x8b13('0x5a')])||_0x15071b['body'][_0x8b13('0x5a')]===''){throw new db[(_0x8b13('0x70'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x15071b[_0x8b13('0x5a')]['to'])){}_0x33f458=_0x15071b['body']['to'];return db[_0x8b13('0x4e')][_0x8b13('0x65')]({'where':{'id':_0x15071b[_0x8b13('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a1962,null))['then'](function(_0x4d9786){if(_0x4d9786){return db[_0x8b13('0x4e')][_0x8b13('0x58')]({'where':{'id':_0x4d9786['id']},'include':[{'model':db[_0x8b13('0xb0')],'as':'List','include':[{'model':db[_0x8b13('0x6f')],'as':'Contacts','where':{[_0x4d9786[_0x8b13('0x7b')]]:_0x33f458},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8b13('0x1f')](handleEntityNotFound(_0x1a1962,null))[_0x8b13('0x1f')](function(_0x453632){if(_0x453632&&_0x453632[_0x8b13('0x7e')]){_0x128df7=_0x453632['get']({'plain':!![]});if(_0x128df7['List']&&_0x128df7[_0x8b13('0x7e')][_0x8b13('0x7f')]['length']){return _0x128df7['List'][_0x8b13('0x7f')][0x0];}return db[_0x8b13('0x6f')][_0x8b13('0x59')](_[_0x8b13('0x1a')](_0x15071b[_0x8b13('0x5a')],{'firstName':_0x33f458,[_0x453632[_0x8b13('0x7b')]]:_0x33f458,'phone':_0x33f458,'ListId':_0x128df7['ListId']}));}})[_0x8b13('0x1f')](handleEntityNotFound(_0x1a1962,null))[_0x8b13('0x1f')](function(_0x38ac7d){if(_0x38ac7d){_0x221f32=_0x38ac7d;return db[_0x8b13('0x8c')]['find']({'where':{'ContactId':_0x221f32['id'],'closed':![],'OpenchannelAccountId':_0x128df7['id']}})['then'](function(_0x2e24f2){if(_0x2e24f2){return[_0x2e24f2,![]];}return db[_0x8b13('0x8c')][_0x8b13('0x59')]({'UserId':_0x15071b[_0x8b13('0x5b')]['id'],'ContactId':_0x221f32['id'],'OpenchannelAccountId':_0x128df7['id'],'lastMsgDirection':'out','Messages':[_[_0x8b13('0x4c')](_0x15071b[_0x8b13('0x5a')],{'read':![],'body':_0x15071b['body'][_0x8b13('0x5a')],'OpenchannelAccountId':_0x128df7['id'],'UserId':_0x15071b['user']['id'],'ContactId':_0x221f32['id']})]},{'include':[{'model':db[_0x8b13('0x96')],'as':_0x8b13('0xb1')}]})[_0x8b13('0x1f')](function(_0x24b945){return[_0x24b945,!![]];});});}})[_0x8b13('0x8e')](function(_0x15d91f,_0x151268){if(_0x151268){return _0x15d91f;}return db['OpenchannelMessage'][_0x8b13('0x59')](_['merge'](_0x15071b['body'],{'read':![],'body':_0x15071b[_0x8b13('0x5a')][_0x8b13('0x5a')],'OpenchannelAccountId':_0x128df7['id'],'OpenchannelInteractionId':_0x15d91f['id'],'UserId':_0x15071b[_0x8b13('0x5b')]['id'],'ContactId':_0x221f32['id']}))[_0x8b13('0x1f')](function(_0x5a1c83){_0x15d91f[_0x8b13('0xb2')][_0x8b13('0xb1')]=[];_0x15d91f[_0x8b13('0xb2')]['Messages'][_0x8b13('0x93')](_0x5a1c83[_0x8b13('0xb2')]);return _0x15d91f;});});}})[_0x8b13('0x1f')](respondWithResult(_0x1a1962,null))[_0x8b13('0x53')](handleError(_0x1a1962,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 08c4eb2..8b17127 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 _0x6d2c=['emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x6d2c,0x1b1));var _0xc6d2=function(_0x4eef8a,_0x3cf759){_0x4eef8a=_0x4eef8a-0x0;var _0x2c4e03=_0x6d2c[_0x4eef8a];return _0x2c4e03;};'use strict';var EventEmitter=require(_0xc6d2('0x0'));var OpenchannelAccount=require(_0xc6d2('0x1'))['db'][_0xc6d2('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc6d2('0x3')](0x0);var events={'afterCreate':_0xc6d2('0x4'),'afterUpdate':_0xc6d2('0x5'),'afterDestroy':_0xc6d2('0x6')};function emitEvent(_0x9e274b){return function(_0xd12e34,_0x991eb9,_0x28ffe7){OpenchannelAccountEvents[_0xc6d2('0x7')](_0x9e274b+':'+_0xd12e34['id'],_0xd12e34);OpenchannelAccountEvents['emit'](_0x9e274b,_0xd12e34);_0x28ffe7(null);};}for(var e in events){if(events[_0xc6d2('0x8')](e)){var event=events[e];OpenchannelAccount[_0xc6d2('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xae70=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xae70,0x167));var _0x0ae7=function(_0x3a6d96,_0x2e2b45){_0x3a6d96=_0x3a6d96-0x0;var _0x54d386=_0xae70[_0x3a6d96];return _0x54d386;};'use strict';var EventEmitter=require(_0x0ae7('0x0'));var OpenchannelAccount=require(_0x0ae7('0x1'))['db'][_0x0ae7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0ae7('0x3')](0x0);var events={'afterCreate':_0x0ae7('0x4'),'afterUpdate':_0x0ae7('0x5'),'afterDestroy':_0x0ae7('0x6')};function emitEvent(_0x110661){return function(_0x3d46b5,_0x575015,_0x335e0d){OpenchannelAccountEvents[_0x0ae7('0x7')](_0x110661+':'+_0x3d46b5['id'],_0x3d46b5);OpenchannelAccountEvents[_0x0ae7('0x7')](_0x110661,_0x3d46b5);_0x335e0d(null);};}for(var e in events){if(events[_0x0ae7('0x8')](e)){var event=events[e];OpenchannelAccount[_0x0ae7('0x9')](e,emitEvent(event));}}module[_0x0ae7('0xa')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index db4231f..e70106b 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 _0x2769=['bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','OpenchannelAccount','openchannel_accounts','util','api','moment'];(function(_0x12a581,_0x5622fd){var _0x580324=function(_0x2c9829){while(--_0x2c9829){_0x12a581['push'](_0x12a581['shift']());}};_0x580324(++_0x5622fd);}(_0x2769,0xcf));var _0x9276=function(_0x517644,_0x2f7068){_0x517644=_0x517644-0x0;var _0x1bef95=_0x2769[_0x517644];return _0x1bef95;};'use strict';var _=require('lodash');var util=require(_0x9276('0x0'));var logger=require('../../config/logger')(_0x9276('0x1'));var moment=require(_0x9276('0x2'));var BPromise=require(_0x9276('0x3'));var rp=require(_0x9276('0x4'));var fs=require('fs');var path=require(_0x9276('0x5'));var rimraf=require(_0x9276('0x6'));var config=require('../../config/environment');var attributes=require(_0x9276('0x7'));module['exports']=function(_0x30ca16,_0x30c895){return _0x30ca16['define'](_0x9276('0x8'),attributes,{'tableName':_0x9276('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3984=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','openchannel_accounts','util','../../config/logger','api','moment'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x3984,0x80));var _0x4398=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x3984[_0x207811];return _0x170d56;};'use strict';var _=require('lodash');var util=require(_0x4398('0x0'));var logger=require(_0x4398('0x1'))(_0x4398('0x2'));var moment=require(_0x4398('0x3'));var BPromise=require(_0x4398('0x4'));var rp=require(_0x4398('0x5'));var fs=require('fs');var path=require(_0x4398('0x6'));var rimraf=require(_0x4398('0x7'));var config=require(_0x4398('0x8'));var attributes=require(_0x4398('0x9'));module[_0x4398('0xa')]=function(_0x4b891e,_0x4a9bc3){return _0x4b891e['define']('OpenchannelAccount',attributes,{'tableName':_0x4398('0xb'),'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 30f9d92..0c9dc92 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 _0x6ff8=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','debug','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','http','redis','defaults'];(function(_0x4cdfb5,_0x58ce18){var _0x5ca496=function(_0x39e67b){while(--_0x39e67b){_0x4cdfb5['push'](_0x4cdfb5['shift']());}};_0x5ca496(++_0x58ce18);}(_0x6ff8,0x1df));var _0x86ff=function(_0x4fecb6,_0x45ed64){_0x4fecb6=_0x4fecb6-0x0;var _0xa9a47=_0x6ff8[_0x4fecb6];return _0xa9a47;};'use strict';var _=require(_0x86ff('0x0'));var util=require('util');var moment=require(_0x86ff('0x1'));var BPromise=require(_0x86ff('0x2'));var rs=require(_0x86ff('0x3'));var fs=require('fs');var Redis=require(_0x86ff('0x4'));var db=require(_0x86ff('0x5'))['db'];var utils=require(_0x86ff('0x6'));var logger=require(_0x86ff('0x7'))(_0x86ff('0x8'));var config=require('../../config/environment');var jayson=require(_0x86ff('0x9'));var client=jayson[_0x86ff('0xa')][_0x86ff('0xb')]({'port':0x232a});config[_0x86ff('0xc')]=_[_0x86ff('0xd')](config[_0x86ff('0xc')],{'host':_0x86ff('0xe'),'port':0x18eb});var socket=require(_0x86ff('0xf'))(new Redis(config['redis']));require(_0x86ff('0x10'))[_0x86ff('0x11')](socket);function respondWithRpcPromise(_0x24ba6e,_0x3db8ac,_0x1ba942){return new BPromise(function(_0x28b5ff,_0x474557){return client[_0x86ff('0x12')](_0x24ba6e,_0x1ba942)[_0x86ff('0x13')](function(_0x159a36){logger[_0x86ff('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x3db8ac,'request\x20sent');logger[_0x86ff('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3db8ac,'request\x20sent',JSON[_0x86ff('0x16')](_0x159a36));if(_0x159a36[_0x86ff('0x17')]){if(_0x159a36[_0x86ff('0x17')][_0x86ff('0x18')]===0x1f4){logger[_0x86ff('0x17')](_0x86ff('0x19'),_0x3db8ac,_0x159a36[_0x86ff('0x17')][_0x86ff('0x1a')]);return _0x474557(_0x159a36[_0x86ff('0x17')][_0x86ff('0x1a')]);}logger['error'](_0x86ff('0x19'),_0x3db8ac,_0x159a36['error']['message']);return _0x28b5ff(_0x159a36[_0x86ff('0x17')]['message']);}else{logger[_0x86ff('0x14')](_0x86ff('0x19'),_0x3db8ac,'request\x20sent');_0x28b5ff(_0x159a36[_0x86ff('0x1b')][_0x86ff('0x1a')]);}})[_0x86ff('0x1c')](function(_0x5ab9d9){logger[_0x86ff('0x17')](_0x86ff('0x19'),_0x3db8ac,_0x5ab9d9);_0x474557(_0x5ab9d9);});});} \ No newline at end of file +var _0x6179=['code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x380cf9,_0x561af1){var _0x5a1e4a=function(_0x3c580d){while(--_0x3c580d){_0x380cf9['push'](_0x380cf9['shift']());}};_0x5a1e4a(++_0x561af1);}(_0x6179,0x1ea));var _0x9617=function(_0x411d4b,_0x8ce248){_0x411d4b=_0x411d4b-0x0;var _0x3ef5c3=_0x6179[_0x411d4b];return _0x3ef5c3;};'use strict';var _=require('lodash');var util=require(_0x9617('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9617('0x1'));var fs=require('fs');var Redis=require(_0x9617('0x2'));var db=require(_0x9617('0x3'))['db'];var utils=require(_0x9617('0x4'));var logger=require(_0x9617('0x5'))(_0x9617('0x6'));var config=require(_0x9617('0x7'));var jayson=require(_0x9617('0x8'));var client=jayson[_0x9617('0x9')][_0x9617('0xa')]({'port':0x232a});config[_0x9617('0xb')]=_['defaults'](config[_0x9617('0xb')],{'host':_0x9617('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9617('0xb')]));require(_0x9617('0xd'))[_0x9617('0xe')](socket);function respondWithRpcPromise(_0x2ee1c5,_0x3d9b1f,_0x4bc661){return new BPromise(function(_0x1c84ec,_0xa4d492){return client[_0x9617('0xf')](_0x2ee1c5,_0x4bc661)[_0x9617('0x10')](function(_0x386e3e){logger['info'](_0x9617('0x11'),_0x3d9b1f,_0x9617('0x12'));logger[_0x9617('0x13')](_0x9617('0x14'),_0x3d9b1f,_0x9617('0x12'),JSON[_0x9617('0x15')](_0x386e3e));if(_0x386e3e['error']){if(_0x386e3e[_0x9617('0x16')][_0x9617('0x17')]===0x1f4){logger[_0x9617('0x16')](_0x9617('0x11'),_0x3d9b1f,_0x386e3e[_0x9617('0x16')][_0x9617('0x18')]);return _0xa4d492(_0x386e3e[_0x9617('0x16')]['message']);}logger[_0x9617('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x3d9b1f,_0x386e3e[_0x9617('0x16')][_0x9617('0x18')]);return _0x1c84ec(_0x386e3e['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3d9b1f,_0x9617('0x12'));_0x1c84ec(_0x386e3e[_0x9617('0x19')][_0x9617('0x18')]);}})[_0x9617('0x1a')](function(_0x4261c9){logger['error'](_0x9617('0x11'),_0x3d9b1f,_0x4261c9);_0xa4d492(_0x4261c9);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9eb91a6..789a74a 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 _0x6f46=['remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x4c44a0,_0xd7a260){var _0x3eec68=function(_0x12f172){while(--_0x12f172){_0x4c44a0['push'](_0x4c44a0['shift']());}};_0x3eec68(++_0xd7a260);}(_0x6f46,0x173));var _0x66f4=function(_0xbde8e7,_0x2d2702){_0xbde8e7=_0xbde8e7-0x0;var _0x1686d1=_0x6f46[_0xbde8e7];return _0x1686d1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x66f4('0x0'),_0x66f4('0x1')];function createListener(_0x97ff06,_0x2cfd19){return function(_0x320096){_0x2cfd19[_0x66f4('0x2')](_0x97ff06,_0x320096);};}function removeListener(_0x475349,_0x11d144){return function(){OpenchannelAccountEvents[_0x66f4('0x3')](_0x475349,_0x11d144);};}exports[_0x66f4('0x4')]=function(_0x44601e){for(var _0x597a2a=0x0,_0x3c578a=events[_0x66f4('0x5')];_0x597a2a<_0x3c578a;_0x597a2a++){var _0x38deb1=events[_0x597a2a];var _0x397587=createListener(_0x66f4('0x6')+_0x38deb1,_0x44601e);OpenchannelAccountEvents['on'](_0x38deb1,_0x397587);}}; \ No newline at end of file +var _0x2d63=['openchannelAccount:','./openchannelAccount.events','save','update','emit','register','length'];(function(_0x45134f,_0xd96567){var _0x24a66a=function(_0x571f3c){while(--_0x571f3c){_0x45134f['push'](_0x45134f['shift']());}};_0x24a66a(++_0xd96567);}(_0x2d63,0x112));var _0x32d6=function(_0x4ba092,_0x3d70f7){_0x4ba092=_0x4ba092-0x0;var _0x5def7a=_0x2d63[_0x4ba092];return _0x5def7a;};'use strict';var OpenchannelAccountEvents=require(_0x32d6('0x0'));var events=[_0x32d6('0x1'),'remove',_0x32d6('0x2')];function createListener(_0x13db13,_0xe4b582){return function(_0x2f3c82){_0xe4b582[_0x32d6('0x3')](_0x13db13,_0x2f3c82);};}function removeListener(_0x18b865,_0x2f6039){return function(){OpenchannelAccountEvents['removeListener'](_0x18b865,_0x2f6039);};}exports[_0x32d6('0x4')]=function(_0x463432){for(var _0x517f90=0x0,_0x201548=events[_0x32d6('0x5')];_0x517f90<_0x201548;_0x517f90++){var _0x5119be=events[_0x517f90];var _0x39ab26=createListener(_0x32d6('0x6')+_0x5119be,_0x463432);OpenchannelAccountEvents['on'](_0x5119be,_0x39ab26);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6c444fc..b510afd 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 _0x0bcf=['delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1d76e3,_0x309956){var _0x1bb63e=function(_0x29a86f){while(--_0x29a86f){_0x1d76e3['push'](_0x1d76e3['shift']());}};_0x1bb63e(++_0x309956);}(_0x0bcf,0x6a));var _0xf0bc=function(_0x826b5d,_0x5a01c8){_0x826b5d=_0x826b5d-0x0;var _0x1e5727=_0x0bcf[_0x826b5d];return _0x1e5727;};'use strict';var multer=require('multer');var util=require(_0xf0bc('0x0'));var path=require(_0xf0bc('0x1'));var timeout=require(_0xf0bc('0x2'));var express=require(_0xf0bc('0x3'));var router=express[_0xf0bc('0x4')]();var auth=require(_0xf0bc('0x5'));var interaction=require(_0xf0bc('0x6'));var config=require(_0xf0bc('0x7'));var controller=require('./openchannelApplication.controller');router[_0xf0bc('0x8')]('/',auth[_0xf0bc('0x9')](),controller[_0xf0bc('0xa')]);router[_0xf0bc('0x8')]('/:id',auth[_0xf0bc('0x9')](),controller['show']);router['post']('/',auth[_0xf0bc('0x9')](),controller['create']);router['put']('/:id',auth[_0xf0bc('0x9')](),controller['update']);router[_0xf0bc('0xb')]('/:id',auth[_0xf0bc('0x9')](),controller[_0xf0bc('0xc')]);module['exports']=router; \ No newline at end of file +var _0x22d4=['index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x3003dc,_0x593501){var _0x4f4b26=function(_0x179713){while(--_0x179713){_0x3003dc['push'](_0x3003dc['shift']());}};_0x4f4b26(++_0x593501);}(_0x22d4,0x1e8));var _0x422d=function(_0x37e342,_0x160c8f){_0x37e342=_0x37e342-0x0;var _0x1768f9=_0x22d4[_0x37e342];return _0x1768f9;};'use strict';var multer=require(_0x422d('0x0'));var util=require(_0x422d('0x1'));var path=require(_0x422d('0x2'));var timeout=require(_0x422d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x422d('0x4'));var interaction=require(_0x422d('0x5'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x422d('0x6')]('/',auth[_0x422d('0x7')](),controller[_0x422d('0x8')]);router[_0x422d('0x6')](_0x422d('0x9'),auth[_0x422d('0x7')](),controller[_0x422d('0xa')]);router[_0x422d('0xb')]('/',auth[_0x422d('0x7')](),controller[_0x422d('0xc')]);router[_0x422d('0xd')](_0x422d('0x9'),auth[_0x422d('0x7')](),controller['update']);router[_0x422d('0xe')](_0x422d('0x9'),auth[_0x422d('0x7')](),controller[_0x422d('0xf')]);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 6d52e0d..f4350a6 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 _0x45d8=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x38c136,_0x5f0228){var _0x555243=function(_0x536de1){while(--_0x536de1){_0x38c136['push'](_0x38c136['shift']());}};_0x555243(++_0x5f0228);}(_0x45d8,0x174));var _0x845d=function(_0x138293,_0x197e7f){_0x138293=_0x138293-0x0;var _0x34c4a2=_0x45d8[_0x138293];return _0x34c4a2;};'use strict';var Sequelize=require(_0x845d('0x0'));module[_0x845d('0x1')]={'priority':{'type':Sequelize[_0x845d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x845d('0x3')],'allowNull':![],'defaultValue':_0x845d('0x4')},'appdata':{'type':Sequelize[_0x845d('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x845d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf243=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x105d62,_0x13779c){var _0x1a598b=function(_0x588b3a){while(--_0x588b3a){_0x105d62['push'](_0x105d62['shift']());}};_0x1a598b(++_0x13779c);}(_0xf243,0x1f0));var _0x3f24=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xf243[_0x512f81];return _0xa15099;};'use strict';var Sequelize=require(_0x3f24('0x0'));module[_0x3f24('0x1')]={'priority':{'type':Sequelize[_0x3f24('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3f24('0x3')]()},'description':{'type':Sequelize[_0x3f24('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3f24('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1ee3000..5c6ff2f 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 _0x0462=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0xad9b66,_0x4a6b2c){var _0x3e4c3f=function(_0x24725c){while(--_0x24725c){_0xad9b66['push'](_0xad9b66['shift']());}};_0x3e4c3f(++_0x4a6b2c);}(_0x0462,0x182));var _0x2046=function(_0x58ec67,_0x32d80e){_0x58ec67=_0x58ec67-0x0;var _0xbae977=_0x0462[_0x58ec67];return _0xbae977;};'use strict';var pdf=require(_0x2046('0x0'));var emlformat=require(_0x2046('0x1'));var rimraf=require(_0x2046('0x2'));var zipdir=require(_0x2046('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2046('0x4'));var moment=require('moment');var BPromise=require(_0x2046('0x5'));var Mustache=require('mustache');var util=require(_0x2046('0x6'));var path=require('path');var sox=require(_0x2046('0x7'));var csv=require(_0x2046('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2046('0x9'));var squel=require(_0x2046('0xa'));var crypto=require(_0x2046('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2046('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2046('0xd'));var Redis=require(_0x2046('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2046('0xf'));var as=require(_0x2046('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2046('0x11'))(_0x2046('0x12'));var utils=require(_0x2046('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2046('0x14'));var db=require(_0x2046('0x15'))['db'];function respondWithStatusCode(_0x4cd633,_0x4c6f61){_0x4c6f61=_0x4c6f61||0xcc;return function(_0x2eadeb){if(_0x2eadeb){return _0x4cd633[_0x2046('0x16')](_0x4c6f61);}return _0x4cd633[_0x2046('0x17')](_0x4c6f61)[_0x2046('0x18')]();};}function respondWithResult(_0x5f2a95,_0xefb703){_0xefb703=_0xefb703||0xc8;return function(_0x468e1d){if(_0x468e1d){return _0x5f2a95['status'](_0xefb703)[_0x2046('0x19')](_0x468e1d);}};}function respondWithFilteredResult(_0x22af87,_0x17dcc8){return function(_0x4c141f){if(_0x4c141f){var _0x18dd64=_0x4c141f[_0x2046('0x1a')],_0x571876=_0x17dcc8['offset'],_0x43e567=_0x17dcc8[_0x2046('0x1b')]+_0x17dcc8[_0x2046('0x1c')],_0x495ae7;if(_0x43e567>=_0x18dd64){_0x43e567=_0x18dd64;_0x495ae7=0xc8;}else{_0x495ae7=0xce;}_0x22af87[_0x2046('0x17')](_0x495ae7);return _0x22af87[_0x2046('0x1d')]('Content-Range',_0x571876+'-'+_0x43e567+'/'+_0x18dd64)[_0x2046('0x19')](_0x4c141f);}return null;};}function patchUpdates(_0x8aae49){return function(_0x420308){try{jsonpatch[_0x2046('0x1e')](_0x420308,_0x8aae49,!![]);}catch(_0x721e6){return BPromise[_0x2046('0x1f')](_0x721e6);}return _0x420308[_0x2046('0x20')]();};}function saveUpdates(_0x27551f,_0x8848f4){return function(_0x482e7f){if(_0x482e7f){return _0x482e7f[_0x2046('0x21')](_0x27551f)[_0x2046('0x22')](function(_0x7b2bc1){return _0x7b2bc1;});}return null;};}function removeEntity(_0x44003e,_0x21a09d){return function(_0x38968c){if(_0x38968c){return _0x38968c[_0x2046('0x23')]()['then'](function(){_0x44003e[_0x2046('0x17')](0xcc)[_0x2046('0x18')]();});}};}function handleEntityNotFound(_0x5f346f,_0x580d6c){return function(_0x569db4){if(!_0x569db4){_0x5f346f[_0x2046('0x16')](0x194);}return _0x569db4;};}function handleError(_0x1a867b,_0x3fb8d1){_0x3fb8d1=_0x3fb8d1||0x1f4;return function(_0x1f9284){logger['error'](_0x1f9284[_0x2046('0x24')]);if(_0x1f9284[_0x2046('0x25')]){delete _0x1f9284['name'];}_0x1a867b[_0x2046('0x17')](_0x3fb8d1)[_0x2046('0x26')](_0x1f9284);};}exports[_0x2046('0x27')]=function(_0x3db3b9,_0x197895){var _0xb8562c={},_0x3b4f3c={},_0x56e64d={'count':0x0,'rows':[]};var _0x406136=_['map'](db[_0x2046('0x28')][_0x2046('0x29')],function(_0x4e6df6){return{'name':_0x4e6df6[_0x2046('0x2a')],'type':_0x4e6df6[_0x2046('0x2b')]['key']};});_0x3b4f3c[_0x2046('0x2c')]=_[_0x2046('0x2d')](_0x406136,'name');_0x3b4f3c['query']=_['keys'](_0x3db3b9['query']);_0x3b4f3c[_0x2046('0x2e')]=_[_0x2046('0x2f')](_0x3b4f3c['model'],_0x3b4f3c[_0x2046('0x30')]);_0xb8562c['attributes']=_[_0x2046('0x2f')](_0x3b4f3c[_0x2046('0x2c')],qs[_0x2046('0x31')](_0x3db3b9[_0x2046('0x30')][_0x2046('0x31')]));_0xb8562c['attributes']=_0xb8562c[_0x2046('0x32')][_0x2046('0x33')]?_0xb8562c['attributes']:_0x3b4f3c[_0x2046('0x2c')];if(!_0x3db3b9[_0x2046('0x30')][_0x2046('0x34')](_0x2046('0x35'))){_0xb8562c[_0x2046('0x1c')]=qs['limit'](_0x3db3b9[_0x2046('0x30')][_0x2046('0x1c')]);_0xb8562c[_0x2046('0x1b')]=qs[_0x2046('0x1b')](_0x3db3b9[_0x2046('0x30')][_0x2046('0x1b')]);}_0xb8562c['order']=qs['sort'](_0x3db3b9[_0x2046('0x30')]['sort']);_0xb8562c[_0x2046('0x36')]=qs[_0x2046('0x2e')](_[_0x2046('0x37')](_0x3db3b9[_0x2046('0x30')],_0x3b4f3c[_0x2046('0x2e')]),_0x406136);if(_0x3db3b9[_0x2046('0x30')]['filter']){_0xb8562c[_0x2046('0x36')]=_['merge'](_0xb8562c[_0x2046('0x36')],{'$or':_[_0x2046('0x2d')](_0x406136,function(_0x1f9d2c){if(_0x1f9d2c[_0x2046('0x2b')]!=='VIRTUAL'){var _0x2423a4={};_0x2423a4[_0x1f9d2c[_0x2046('0x25')]]={'$like':'%'+_0x3db3b9[_0x2046('0x30')][_0x2046('0x38')]+'%'};return _0x2423a4;}})});}_0xb8562c=_['merge']({},_0xb8562c,_0x3db3b9['options']);var _0x398174={'where':_0xb8562c[_0x2046('0x36')]};return db['OpenchannelApplication']['count'](_0x398174)[_0x2046('0x22')](function(_0x58bb97){_0x56e64d[_0x2046('0x1a')]=_0x58bb97;if(_0x3db3b9[_0x2046('0x30')][_0x2046('0x39')]){_0xb8562c[_0x2046('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x2046('0x3b')](_0xb8562c);})[_0x2046('0x22')](function(_0x5caa92){_0x56e64d[_0x2046('0x3c')]=_0x5caa92;return _0x56e64d;})['then'](respondWithFilteredResult(_0x197895,_0xb8562c))[_0x2046('0x3d')](handleError(_0x197895,null));};exports[_0x2046('0x3e')]=function(_0x1cfae0,_0x1a0d84){var _0x280ca1={'raw':!![],'where':{'id':_0x1cfae0[_0x2046('0x3f')]['id']}},_0x1b08dd={};_0x1b08dd['model']=_['keys'](db[_0x2046('0x28')][_0x2046('0x29')]);_0x1b08dd[_0x2046('0x30')]=_[_0x2046('0x40')](_0x1cfae0[_0x2046('0x30')]);_0x1b08dd[_0x2046('0x2e')]=_[_0x2046('0x2f')](_0x1b08dd[_0x2046('0x2c')],_0x1b08dd[_0x2046('0x30')]);_0x280ca1[_0x2046('0x32')]=_[_0x2046('0x2f')](_0x1b08dd[_0x2046('0x2c')],qs[_0x2046('0x31')](_0x1cfae0[_0x2046('0x30')][_0x2046('0x31')]));_0x280ca1[_0x2046('0x32')]=_0x280ca1['attributes'][_0x2046('0x33')]?_0x280ca1['attributes']:_0x1b08dd[_0x2046('0x2c')];if(_0x1cfae0[_0x2046('0x30')][_0x2046('0x39')]){_0x280ca1['include']=[{'all':!![]}];}_0x280ca1=_[_0x2046('0x41')]({},_0x280ca1,_0x1cfae0[_0x2046('0x42')]);return db[_0x2046('0x28')][_0x2046('0x43')](_0x280ca1)[_0x2046('0x22')](handleEntityNotFound(_0x1a0d84,null))[_0x2046('0x22')](respondWithResult(_0x1a0d84,null))[_0x2046('0x3d')](handleError(_0x1a0d84,null));};exports['create']=function(_0x218d58,_0x3913c7){return db[_0x2046('0x28')]['create'](_0x218d58[_0x2046('0x44')],{})['then'](respondWithResult(_0x3913c7,0xc9))[_0x2046('0x3d')](handleError(_0x3913c7,null));};exports[_0x2046('0x21')]=function(_0x42d98d,_0x5e56aa){if(_0x42d98d[_0x2046('0x44')]['id']){delete _0x42d98d['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x42d98d[_0x2046('0x3f')]['id']}})[_0x2046('0x22')](handleEntityNotFound(_0x5e56aa,null))[_0x2046('0x22')](saveUpdates(_0x42d98d[_0x2046('0x44')],null))['then'](respondWithResult(_0x5e56aa,null))[_0x2046('0x3d')](handleError(_0x5e56aa,null));};exports[_0x2046('0x23')]=function(_0x3ea360,_0x3c0c0c){return db[_0x2046('0x28')]['find']({'where':{'id':_0x3ea360['params']['id']}})[_0x2046('0x22')](handleEntityNotFound(_0x3c0c0c,null))['then'](removeEntity(_0x3c0c0c,null))['catch'](handleError(_0x3c0c0c,null));}; \ No newline at end of file +var _0xf4c3=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','set','save','then','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','limit','offset','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2ebece,_0x40c8d6){var _0x1f83a7=function(_0x3e7cad){while(--_0x3e7cad){_0x2ebece['push'](_0x2ebece['shift']());}};_0x1f83a7(++_0x40c8d6);}(_0xf4c3,0x19b));var _0x3f4c=function(_0x833417,_0x2ea2f9){_0x833417=_0x833417-0x0;var _0x388395=_0xf4c3[_0x833417];return _0x388395;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f4c('0x0'));var rimraf=require(_0x3f4c('0x1'));var zipdir=require(_0x3f4c('0x2'));var jsonpatch=require(_0x3f4c('0x3'));var rp=require('request-promise');var moment=require(_0x3f4c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f4c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3f4c('0x6'));var csv=require(_0x3f4c('0x7'));var ejs=require(_0x3f4c('0x8'));var fs=require('fs');var _=require(_0x3f4c('0x9'));var squel=require(_0x3f4c('0xa'));var crypto=require(_0x3f4c('0xb'));var jsforce=require(_0x3f4c('0xc'));var deskjs=require(_0x3f4c('0xd'));var toCsv=require(_0x3f4c('0x7'));var querystring=require(_0x3f4c('0xe'));var Papa=require('papaparse');var Redis=require(_0x3f4c('0xf'));var authService=require(_0x3f4c('0x10'));var qs=require(_0x3f4c('0x11'));var as=require(_0x3f4c('0x12'));var hardwareService=require(_0x3f4c('0x13'));var logger=require(_0x3f4c('0x14'))(_0x3f4c('0x15'));var utils=require(_0x3f4c('0x16'));var config=require(_0x3f4c('0x17'));var licenseUtil=require(_0x3f4c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e60b7,_0x2534a0){_0x2534a0=_0x2534a0||0xcc;return function(_0x459062){if(_0x459062){return _0x1e60b7[_0x3f4c('0x19')](_0x2534a0);}return _0x1e60b7[_0x3f4c('0x1a')](_0x2534a0)[_0x3f4c('0x1b')]();};}function respondWithResult(_0x39a94e,_0x498dee){_0x498dee=_0x498dee||0xc8;return function(_0x3172f8){if(_0x3172f8){return _0x39a94e['status'](_0x498dee)[_0x3f4c('0x1c')](_0x3172f8);}};}function respondWithFilteredResult(_0x2df876,_0x5c52a5){return function(_0x5be80b){if(_0x5be80b){var _0x40ab8e=_0x5be80b[_0x3f4c('0x1d')],_0x4acb45=_0x5c52a5['offset'],_0x1b29f2=_0x5c52a5['offset']+_0x5c52a5['limit'],_0x5c6faf;if(_0x1b29f2>=_0x40ab8e){_0x1b29f2=_0x40ab8e;_0x5c6faf=0xc8;}else{_0x5c6faf=0xce;}_0x2df876[_0x3f4c('0x1a')](_0x5c6faf);return _0x2df876[_0x3f4c('0x1e')]('Content-Range',_0x4acb45+'-'+_0x1b29f2+'/'+_0x40ab8e)['json'](_0x5be80b);}return null;};}function patchUpdates(_0x169ff0){return function(_0x47c660){try{jsonpatch['apply'](_0x47c660,_0x169ff0,!![]);}catch(_0x6d5a83){return BPromise['reject'](_0x6d5a83);}return _0x47c660[_0x3f4c('0x1f')]();};}function saveUpdates(_0x151c83,_0x2a24c6){return function(_0x16b77b){if(_0x16b77b){return _0x16b77b['update'](_0x151c83)[_0x3f4c('0x20')](function(_0x110661){return _0x110661;});}return null;};}function removeEntity(_0x54049c,_0x421d03){return function(_0x352cee){if(_0x352cee){return _0x352cee[_0x3f4c('0x21')]()['then'](function(){_0x54049c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f463a,_0x4ff968){return function(_0x442a4a){if(!_0x442a4a){_0x7f463a['sendStatus'](0x194);}return _0x442a4a;};}function handleError(_0x51ae63,_0x360715){_0x360715=_0x360715||0x1f4;return function(_0x28ce29){logger[_0x3f4c('0x22')](_0x28ce29['stack']);if(_0x28ce29[_0x3f4c('0x23')]){delete _0x28ce29[_0x3f4c('0x23')];}_0x51ae63['status'](_0x360715)[_0x3f4c('0x24')](_0x28ce29);};}exports[_0x3f4c('0x25')]=function(_0x265ebc,_0x53748b){var _0x39d530={},_0x1ef9fb={},_0x3314e1={'count':0x0,'rows':[]};var _0x351901=_[_0x3f4c('0x26')](db[_0x3f4c('0x27')][_0x3f4c('0x28')],function(_0x13d061){return{'name':_0x13d061[_0x3f4c('0x29')],'type':_0x13d061['type']['key']};});_0x1ef9fb[_0x3f4c('0x2a')]=_['map'](_0x351901,_0x3f4c('0x23'));_0x1ef9fb[_0x3f4c('0x2b')]=_['keys'](_0x265ebc['query']);_0x1ef9fb[_0x3f4c('0x2c')]=_[_0x3f4c('0x2d')](_0x1ef9fb[_0x3f4c('0x2a')],_0x1ef9fb['query']);_0x39d530['attributes']=_[_0x3f4c('0x2d')](_0x1ef9fb['model'],qs[_0x3f4c('0x2e')](_0x265ebc['query']['fields']));_0x39d530[_0x3f4c('0x2f')]=_0x39d530[_0x3f4c('0x2f')][_0x3f4c('0x30')]?_0x39d530[_0x3f4c('0x2f')]:_0x1ef9fb[_0x3f4c('0x2a')];if(!_0x265ebc[_0x3f4c('0x2b')]['hasOwnProperty'](_0x3f4c('0x31'))){_0x39d530[_0x3f4c('0x32')]=qs[_0x3f4c('0x32')](_0x265ebc[_0x3f4c('0x2b')][_0x3f4c('0x32')]);_0x39d530[_0x3f4c('0x33')]=qs[_0x3f4c('0x33')](_0x265ebc[_0x3f4c('0x2b')]['offset']);}_0x39d530['order']=qs[_0x3f4c('0x34')](_0x265ebc[_0x3f4c('0x2b')][_0x3f4c('0x34')]);_0x39d530[_0x3f4c('0x35')]=qs[_0x3f4c('0x2c')](_[_0x3f4c('0x36')](_0x265ebc[_0x3f4c('0x2b')],_0x1ef9fb[_0x3f4c('0x2c')]),_0x351901);if(_0x265ebc[_0x3f4c('0x2b')][_0x3f4c('0x37')]){_0x39d530[_0x3f4c('0x35')]=_[_0x3f4c('0x38')](_0x39d530[_0x3f4c('0x35')],{'$or':_[_0x3f4c('0x26')](_0x351901,function(_0x431f51){if(_0x431f51[_0x3f4c('0x39')]!==_0x3f4c('0x3a')){var _0x578434={};_0x578434[_0x431f51[_0x3f4c('0x23')]]={'$like':'%'+_0x265ebc[_0x3f4c('0x2b')]['filter']+'%'};return _0x578434;}})});}_0x39d530=_[_0x3f4c('0x38')]({},_0x39d530,_0x265ebc[_0x3f4c('0x3b')]);var _0x44bff6={'where':_0x39d530[_0x3f4c('0x35')]};return db[_0x3f4c('0x27')]['count'](_0x44bff6)[_0x3f4c('0x20')](function(_0x463b42){_0x3314e1[_0x3f4c('0x1d')]=_0x463b42;if(_0x265ebc[_0x3f4c('0x2b')][_0x3f4c('0x3c')]){_0x39d530[_0x3f4c('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x3f4c('0x3e')](_0x39d530);})[_0x3f4c('0x20')](function(_0x1f31ed){_0x3314e1[_0x3f4c('0x3f')]=_0x1f31ed;return _0x3314e1;})[_0x3f4c('0x20')](respondWithFilteredResult(_0x53748b,_0x39d530))['catch'](handleError(_0x53748b,null));};exports[_0x3f4c('0x40')]=function(_0x5ba826,_0x5f01d2){var _0x4ab5c0={'raw':!![],'where':{'id':_0x5ba826[_0x3f4c('0x41')]['id']}},_0x346ddd={};_0x346ddd['model']=_[_0x3f4c('0x42')](db[_0x3f4c('0x27')][_0x3f4c('0x28')]);_0x346ddd[_0x3f4c('0x2b')]=_[_0x3f4c('0x42')](_0x5ba826[_0x3f4c('0x2b')]);_0x346ddd[_0x3f4c('0x2c')]=_[_0x3f4c('0x2d')](_0x346ddd['model'],_0x346ddd['query']);_0x4ab5c0['attributes']=_[_0x3f4c('0x2d')](_0x346ddd[_0x3f4c('0x2a')],qs[_0x3f4c('0x2e')](_0x5ba826[_0x3f4c('0x2b')][_0x3f4c('0x2e')]));_0x4ab5c0[_0x3f4c('0x2f')]=_0x4ab5c0[_0x3f4c('0x2f')][_0x3f4c('0x30')]?_0x4ab5c0['attributes']:_0x346ddd[_0x3f4c('0x2a')];if(_0x5ba826['query'][_0x3f4c('0x3c')]){_0x4ab5c0[_0x3f4c('0x3d')]=[{'all':!![]}];}_0x4ab5c0=_['merge']({},_0x4ab5c0,_0x5ba826[_0x3f4c('0x3b')]);return db[_0x3f4c('0x27')][_0x3f4c('0x43')](_0x4ab5c0)[_0x3f4c('0x20')](handleEntityNotFound(_0x5f01d2,null))['then'](respondWithResult(_0x5f01d2,null))['catch'](handleError(_0x5f01d2,null));};exports['create']=function(_0x9f3e7e,_0x28d4b9){return db[_0x3f4c('0x27')][_0x3f4c('0x44')](_0x9f3e7e[_0x3f4c('0x45')],{})[_0x3f4c('0x20')](respondWithResult(_0x28d4b9,0xc9))[_0x3f4c('0x46')](handleError(_0x28d4b9,null));};exports[_0x3f4c('0x47')]=function(_0x405a7d,_0x360965){if(_0x405a7d[_0x3f4c('0x45')]['id']){delete _0x405a7d[_0x3f4c('0x45')]['id'];}return db[_0x3f4c('0x27')][_0x3f4c('0x43')]({'where':{'id':_0x405a7d[_0x3f4c('0x41')]['id']}})[_0x3f4c('0x20')](handleEntityNotFound(_0x360965,null))[_0x3f4c('0x20')](saveUpdates(_0x405a7d[_0x3f4c('0x45')],null))['then'](respondWithResult(_0x360965,null))[_0x3f4c('0x46')](handleError(_0x360965,null));};exports[_0x3f4c('0x21')]=function(_0x2b3917,_0x4fcf03){return db['OpenchannelApplication'][_0x3f4c('0x43')]({'where':{'id':_0x2b3917[_0x3f4c('0x41')]['id']}})[_0x3f4c('0x20')](handleEntityNotFound(_0x4fcf03,null))[_0x3f4c('0x20')](removeEntity(_0x4fcf03,null))[_0x3f4c('0x46')](handleError(_0x4fcf03,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 217b650..7be7478 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 _0x5555=['path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59001d,_0x37e7c2){var _0xb8f0e1=function(_0x1231fd){while(--_0x1231fd){_0x59001d['push'](_0x59001d['shift']());}};_0xb8f0e1(++_0x37e7c2);}(_0x5555,0x1d9));var _0x5555=function(_0x51b828,_0x450bac){_0x51b828=_0x51b828-0x0;var _0x31338e=_0x5555[_0x51b828];return _0x31338e;};'use strict';var _=require(_0x5555('0x0'));var util=require(_0x5555('0x1'));var logger=require(_0x5555('0x2'))(_0x5555('0x3'));var moment=require(_0x5555('0x4'));var BPromise=require(_0x5555('0x5'));var rp=require(_0x5555('0x6'));var fs=require('fs');var path=require(_0x5555('0x7'));var rimraf=require('rimraf');var config=require(_0x5555('0x8'));var attributes=require(_0x5555('0x9'));module[_0x5555('0xa')]=function(_0x5768ae,_0x9526af){return _0x5768ae[_0x5555('0xb')](_0x5555('0xc'),attributes,{'tableName':_0x5555('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5555('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2c76=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4'];(function(_0x27b423,_0x312583){var _0x5c11b8=function(_0x22a3b9){while(--_0x22a3b9){_0x27b423['push'](_0x27b423['shift']());}};_0x5c11b8(++_0x312583);}(_0x2c76,0x187));var _0x62c7=function(_0x546e22,_0x1e7df9){_0x546e22=_0x546e22-0x0;var _0x5c248b=_0x2c76[_0x546e22];return _0x5c248b;};'use strict';var _=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var logger=require(_0x62c7('0x2'))(_0x62c7('0x3'));var moment=require(_0x62c7('0x4'));var BPromise=require(_0x62c7('0x5'));var rp=require(_0x62c7('0x6'));var fs=require('fs');var path=require(_0x62c7('0x7'));var rimraf=require(_0x62c7('0x8'));var config=require(_0x62c7('0x9'));var attributes=require(_0x62c7('0xa'));module[_0x62c7('0xb')]=function(_0x2ef474,_0x1da368){return _0x2ef474['define'](_0x62c7('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x62c7('0xd'),'collate':_0x62c7('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0b3caff..df8a7c3 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(_0xede442,_0x5a86dd){var _0x58ff86=function(_0xdf84ca){while(--_0xdf84ca){_0xede442['push'](_0xede442['shift']());}};_0x58ff86(++_0x5a86dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x323413,_0x421d63){_0x323413=_0x323413-0x0;var _0xe2aca0=_0xb10b[_0x323413];return _0xe2aca0;};'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(_0x48a45d,_0x1f802b){var _0x46dd19=function(_0x38aa5a){while(--_0x38aa5a){_0x48a45d['push'](_0x48a45d['shift']());}};_0x46dd19(++_0x1f802b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ee907,_0x27e587){_0x5ee907=_0x5ee907-0x0;var _0x2cba70=_0xb10b[_0x5ee907];return _0x2cba70;};'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 0cbba14..7b50522 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 _0x5427=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','/:id/download','create','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete'];(function(_0x6c22dd,_0xcc47c4){var _0x382af6=function(_0x151b5e){while(--_0x151b5e){_0x6c22dd['push'](_0x6c22dd['shift']());}};_0x382af6(++_0xcc47c4);}(_0x5427,0x1b1));var _0x7542=function(_0x45b6d2,_0x118ef1){_0x45b6d2=_0x45b6d2-0x0;var _0x372b9a=_0x5427[_0x45b6d2];return _0x372b9a;};'use strict';var multer=require(_0x7542('0x0'));var util=require(_0x7542('0x1'));var path=require('path');var timeout=require(_0x7542('0x2'));var express=require(_0x7542('0x3'));var router=express[_0x7542('0x4')]();var auth=require(_0x7542('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7542('0x6'));var controller=require(_0x7542('0x7'));router[_0x7542('0x8')]('/',auth[_0x7542('0x9')](),controller['index']);router[_0x7542('0x8')](_0x7542('0xa'),auth[_0x7542('0x9')](),controller[_0x7542('0xb')]);router[_0x7542('0x8')](_0x7542('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7542('0x8')](_0x7542('0xd'),auth[_0x7542('0x9')](),controller['getMessages']);router[_0x7542('0x8')](_0x7542('0xe'),auth[_0x7542('0x9')](),controller['download']);router['post']('/',auth[_0x7542('0x9')](),controller[_0x7542('0xf')]);router['post'](_0x7542('0xd'),auth['isAuthenticated'](),controller[_0x7542('0x10')]);router[_0x7542('0x11')](_0x7542('0x12'),auth[_0x7542('0x9')](),interaction[_0x7542('0x13')](_0x7542('0x14'),_0x7542('0x15')),controller[_0x7542('0x16')]);router[_0x7542('0x17')](_0x7542('0xc'),auth[_0x7542('0x9')](),interaction['tracked'](_0x7542('0x14'),'openchannelinteraction:update'),controller[_0x7542('0x18')]);router[_0x7542('0x19')](_0x7542('0xc'),auth[_0x7542('0x9')](),interaction['tracked'](_0x7542('0x14'),'openchannelinteraction:destroy'),controller[_0x7542('0x1a')]);router[_0x7542('0x19')](_0x7542('0x12'),auth[_0x7542('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xde03=['addTags','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','/:id/tags','util','path','connect-timeout','Router','./openchannelInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','download','post','create','addMessage'];(function(_0xbe0702,_0x17c7c6){var _0x3b55cb=function(_0x3ce884){while(--_0x3ce884){_0xbe0702['push'](_0xbe0702['shift']());}};_0x3b55cb(++_0x17c7c6);}(_0xde03,0xbe));var _0x3de0=function(_0x459b75,_0x306f40){_0x459b75=_0x459b75-0x0;var _0x1349e1=_0xde03[_0x459b75];return _0x1349e1;};'use strict';var multer=require('multer');var util=require(_0x3de0('0x0'));var path=require(_0x3de0('0x1'));var timeout=require(_0x3de0('0x2'));var express=require('express');var router=express[_0x3de0('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3de0('0x4'));router[_0x3de0('0x5')]('/',auth['isAuthenticated'](),controller[_0x3de0('0x6')]);router[_0x3de0('0x5')](_0x3de0('0x7'),auth['isAuthenticated'](),controller[_0x3de0('0x8')]);router[_0x3de0('0x5')](_0x3de0('0x9'),auth[_0x3de0('0xa')](),controller[_0x3de0('0xb')]);router[_0x3de0('0x5')](_0x3de0('0xc'),auth['isAuthenticated'](),controller[_0x3de0('0xd')]);router[_0x3de0('0x5')]('/:id/download',auth[_0x3de0('0xa')](),controller[_0x3de0('0xe')]);router[_0x3de0('0xf')]('/',auth[_0x3de0('0xa')](),controller[_0x3de0('0x10')]);router[_0x3de0('0xf')]('/:id/messages',auth[_0x3de0('0xa')](),controller[_0x3de0('0x11')]);router[_0x3de0('0xf')]('/:id/tags',auth[_0x3de0('0xa')](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0x3de0('0x12')]);router['put'](_0x3de0('0x9'),auth[_0x3de0('0xa')](),interaction['tracked'](_0x3de0('0x13'),_0x3de0('0x14')),controller[_0x3de0('0x15')]);router['delete'](_0x3de0('0x9'),auth[_0x3de0('0xa')](),interaction['tracked'](_0x3de0('0x13'),_0x3de0('0x16')),controller[_0x3de0('0x17')]);router[_0x3de0('0x18')](_0x3de0('0x19'),auth[_0x3de0('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 23b8978..ac75e23 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 _0x4522=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x4522,0x9e));var _0x2452=function(_0x58ea99,_0x5902eb){_0x58ea99=_0x58ea99-0x0;var _0x30f4a0=_0x4522[_0x58ea99];return _0x30f4a0;};'use strict';var Sequelize=require('sequelize');module[_0x2452('0x0')]={'closed':{'type':Sequelize[_0x2452('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2452('0x2')]},'disposition':{'type':Sequelize[_0x2452('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2452('0x3')]},'note':{'type':Sequelize[_0x2452('0x3')]},'read1stAt':{'type':Sequelize[_0x2452('0x2')]},'threadId':{'type':Sequelize[_0x2452('0x3')]},'externalUrl':{'type':Sequelize[_0x2452('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2452('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2452('0x4')]('in',_0x2452('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2452('0x3')]}}; \ No newline at end of file +var _0x7117=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x7117,0x1ec));var _0x7711=function(_0x26118a,_0x3099f6){_0x26118a=_0x26118a-0x0;var _0x1da29e=_0x7117[_0x26118a];return _0x1da29e;};'use strict';var Sequelize=require(_0x7711('0x0'));module[_0x7711('0x1')]={'closed':{'type':Sequelize[_0x7711('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7711('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7711('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7711('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7711('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7711('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7711('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7711('0x5')]('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 e910144..2a3c785 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 _0xb76a=['User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','start','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','merge','options','create','describe','OpenchannelMessage','addMessage','ids','omit','findOne','rawAttributes','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','files','join','server','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','get','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','Owner','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','end','error','name','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','OpenchannelInteraction','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','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','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0xe1f9c,_0x2dabd6){var _0x3850b3=function(_0x16dd01){while(--_0x16dd01){_0xe1f9c['push'](_0xe1f9c['shift']());}};_0x3850b3(++_0x2dabd6);}(_0xb76a,0x180));var _0xab76=function(_0x292e26,_0x22a93a){_0x292e26=_0x292e26-0x0;var _0x1bde9d=_0xb76a[_0x292e26];return _0x1bde9d;};'use strict';var pdf=require(_0xab76('0x0'));var emlformat=require(_0xab76('0x1'));var rimraf=require(_0xab76('0x2'));var zipdir=require(_0xab76('0x3'));var jsonpatch=require(_0xab76('0x4'));var rp=require(_0xab76('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab76('0x6'));var path=require('path');var sox=require(_0xab76('0x7'));var csv=require(_0xab76('0x8'));var ejs=require(_0xab76('0x9'));var fs=require('fs');var _=require(_0xab76('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xab76('0xb'));var deskjs=require(_0xab76('0xc'));var toCsv=require(_0xab76('0x8'));var querystring=require(_0xab76('0xd'));var Papa=require(_0xab76('0xe'));var Redis=require(_0xab76('0xf'));var authService=require(_0xab76('0x10'));var qs=require(_0xab76('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab76('0x12'))(_0xab76('0x13'));var utils=require(_0xab76('0x14'));var config=require(_0xab76('0x15'));var licenseUtil=require(_0xab76('0x16'));var db=require(_0xab76('0x17'))['db'];config[_0xab76('0x18')]=_['defaults'](config['redis'],{'host':_0xab76('0x19'),'port':0x18eb});var socket=require(_0xab76('0x1a'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x44d3be,_0x11d253){_0x11d253=_0x11d253||0xcc;return function(_0xfbb6bd){if(_0xfbb6bd){return _0x44d3be[_0xab76('0x1b')](_0x11d253);}return _0x44d3be[_0xab76('0x1c')](_0x11d253)['end']();};}function respondWithResult(_0x48d614,_0x5953b2){_0x5953b2=_0x5953b2||0xc8;return function(_0x4472e4){if(_0x4472e4){return _0x48d614['status'](_0x5953b2)[_0xab76('0x1d')](_0x4472e4);}};}function respondWithFilteredResult(_0xeb1d1f,_0x461765){return function(_0x49b0eb){if(_0x49b0eb){var _0x2ea196=_0x49b0eb[_0xab76('0x1e')],_0x2676ac=_0x461765[_0xab76('0x1f')],_0x5ed06e=_0x461765[_0xab76('0x1f')]+_0x461765[_0xab76('0x20')],_0xd3b19d;if(_0x5ed06e>=_0x2ea196){_0x5ed06e=_0x2ea196;_0xd3b19d=0xc8;}else{_0xd3b19d=0xce;}_0xeb1d1f['status'](_0xd3b19d);return _0xeb1d1f[_0xab76('0x21')](_0xab76('0x22'),_0x2676ac+'-'+_0x5ed06e+'/'+_0x2ea196)[_0xab76('0x1d')](_0x49b0eb);}return null;};}function patchUpdates(_0x553b61){return function(_0x136f71){try{jsonpatch['apply'](_0x136f71,_0x553b61,!![]);}catch(_0x4dbf3a){return BPromise['reject'](_0x4dbf3a);}return _0x136f71[_0xab76('0x23')]();};}function saveUpdates(_0x870ff6,_0x282994){return function(_0x39e7b7){if(_0x39e7b7){return _0x39e7b7[_0xab76('0x24')](_0x870ff6)['then'](function(_0x379bd8){return _0x379bd8;});}return null;};}function removeEntity(_0x3dd01d,_0x53d3be){return function(_0x363b4a){if(_0x363b4a){return _0x363b4a[_0xab76('0x25')]()[_0xab76('0x26')](function(){_0x3dd01d['status'](0xcc)[_0xab76('0x27')]();});}};}function handleEntityNotFound(_0x449723,_0x3ed02d){return function(_0x45bf2b){if(!_0x45bf2b){_0x449723[_0xab76('0x1b')](0x194);}return _0x45bf2b;};}function handleError(_0x534741,_0x13464d){_0x13464d=_0x13464d||0x1f4;return function(_0x14d1e5){logger[_0xab76('0x28')](_0x14d1e5['stack']);if(_0x14d1e5[_0xab76('0x29')]){delete _0x14d1e5['name'];}_0x534741[_0xab76('0x1c')](_0x13464d)['send'](_0x14d1e5);};}function getInteractionUsers(_0x26a135,_0x1f000e){return new BPromise(function(_0x9808e,_0x28f8a9){try{if(_0x1f000e[_0x26a135['id']]){_0x26a135[_0xab76('0x2a')]=_[_0xab76('0x2b')](_0x1f000e[_0x26a135['id']],function(_0x31b1a3){return{'id':_0x31b1a3['id'],'fullname':_0x31b1a3[_0xab76('0x2c')]};});}}catch(_0x36ab9b){_0x28f8a9(_0x36ab9b);}_0x9808e(_0x26a135);});}function getInteractionTags(_0x1f20a5,_0x43a3c5){return new BPromise(function(_0x6cfdca,_0x4c6981){try{if(_0x1f20a5['TagIds']){_0x1f20a5[_0xab76('0x2d')]=[];_0x1f20a5[_0xab76('0x2e')][_0xab76('0x2f')](',')[_0xab76('0x30')](function(_0x56ac0f){_0x1f20a5[_0xab76('0x2d')][_0xab76('0x31')](_0x43a3c5[_0x56ac0f]);});}delete _0x1f20a5[_0xab76('0x2e')];}catch(_0x4a96d3){_0x4c6981(_0x4a96d3);}_0x6cfdca(_0x1f20a5);});}function updateOpenchannelInteraction(_0x53dc03,_0xb58dd1,_0x4b73aa){return new BPromise(function(_0x41cded,_0x2ddf9c){return getInteractionUsers(_0x53dc03,_0x4b73aa)[_0xab76('0x26')](function(_0x38102e){return getInteractionTags(_0x38102e,_0xb58dd1);})[_0xab76('0x26')](function(_0x1edb8d){_0x41cded(_0x1edb8d);})[_0xab76('0x32')](function(_0x488ba3){_0x2ddf9c(_0x488ba3);});});}exports[_0xab76('0x33')]=function(_0x53bf3a,_0x335b21){var _0xa0262e={},_0x2d9980={},_0x559eff={'count':0x0,'rows':[]};var _0xbd6fd7=_['map'](db[_0xab76('0x34')]['rawAttributes'],function(_0x5f3037){return{'name':_0x5f3037['fieldName'],'type':_0x5f3037[_0xab76('0x35')][_0xab76('0x36')]};});_0x2d9980['model']=_[_0xab76('0x2b')](_0xbd6fd7,_0xab76('0x29'));_0x2d9980['query']=_[_0xab76('0x37')](_0x53bf3a['query']);_0x2d9980[_0xab76('0x38')]=_[_0xab76('0x39')](_0x2d9980[_0xab76('0x3a')],_0x2d9980[_0xab76('0x3b')]);_0xa0262e[_0xab76('0x3c')]=_[_0xab76('0x39')](_0x2d9980[_0xab76('0x3a')],qs[_0xab76('0x3d')](_0x53bf3a['query'][_0xab76('0x3d')]));_0xa0262e['attributes']=_0xa0262e['attributes']['length']?_0xa0262e[_0xab76('0x3c')]:_0x2d9980['model'];if(!_0x53bf3a['query'][_0xab76('0x3e')](_0xab76('0x3f'))){_0xa0262e[_0xab76('0x20')]=qs[_0xab76('0x20')](_0x53bf3a[_0xab76('0x3b')]['limit']);_0xa0262e[_0xab76('0x1f')]=qs[_0xab76('0x1f')](_0x53bf3a[_0xab76('0x3b')][_0xab76('0x1f')]);}_0xa0262e[_0xab76('0x40')]=qs[_0xab76('0x41')](_0x53bf3a[_0xab76('0x3b')]['sort']);_0xa0262e[_0xab76('0x42')]=qs['filters'](_[_0xab76('0x43')](_0x53bf3a[_0xab76('0x3b')],_0x2d9980[_0xab76('0x38')]),_0xbd6fd7);var _0x19066d=[];var _0x43934d=squel['select']()['field']('id')[_0xab76('0x44')](_0xab76('0x29'))[_0xab76('0x44')](_0xab76('0x45'))[_0xab76('0x46')]('tools_tags');var _0x5b3e30=squel['select']()[_0xab76('0x44')](_0xab76('0x47'))[_0xab76('0x44')]('u.fullname')[_0xab76('0x44')](_0xab76('0x48'))[_0xab76('0x46')](_0xab76('0x49'),'ui')[_0xab76('0x4a')](_0xab76('0x4b'),'u',_0xab76('0x4c'));var _0x4c96cc=squel[_0xab76('0x4d')]()[_0xab76('0x46')](_0xab76('0x4e'),'i')[_0xab76('0x4a')](_0xab76('0x4f'),'c',_0xab76('0x50'))['left_join'](_0xab76('0x4b'),'o',_0xab76('0x51'))['left_join'](_0xab76('0x52'),'a',_0xab76('0x53'))[_0xab76('0x4a')]('openchannel_messages','me',_0xab76('0x54'))[_0xab76('0x4a')](_0xab76('0x55'),'it',_0xab76('0x56'))['left_join'](_0xab76('0x57'),'t',_0xab76('0x58'));var _0x5dfc30=squel[_0xab76('0x59')]();var _0x546293=[];var _0x4d0b0d=squel[_0xab76('0x59')]();var _0x1ab539;if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x5a')]){_0x1ab539=as[_0xab76('0x5b')](_0x53bf3a[_0xab76('0x3b')][_0xab76('0x5a')]);var _0x494811=_0x1ab539[_0xab76('0x5c')];for(var _0x4e3e72=0x0;_0x4e3e72<_0x1ab539['conditions'][_0xab76('0x5d')];_0x4e3e72++){var _0x19810b=_0x1ab539[_0xab76('0x5e')][_0x4e3e72];var _0x3bb2da='i';var _0x54e7df=_['find'](_0xbd6fd7,[_0xab76('0x29'),_0x19810b[_0xab76('0x44')]]);if(!_0x54e7df){switch(_0x19810b['field']){case _0xab76('0x5f'):if(_0x19810b['value']==0x1){_0x4c96cc[_0xab76('0x60')]('`'+_0x19810b[_0xab76('0x44')]+_0xab76('0x61'));}else{_0x4c96cc[_0xab76('0x60')]('`'+_0x19810b[_0xab76('0x44')]+'`\x20>\x200');}break;case _0xab76('0x62'):if(_0x19810b[_0xab76('0x63')]===_0xab76('0x64')){if(_0x19810b[_0xab76('0x65')][_0xab76('0x2f')]('\x20')['length']>0x1){_0x5dfc30[_0x494811]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x19810b[_0xab76('0x65')]),null);}else{var _0x582797='%'+_0x19810b[_0xab76('0x65')]+'%';_0x5dfc30[_0x494811](_0xab76('0x66'),_0x582797,_0x582797,_0x582797);}}else{_0x54e7df=_['find'](_0xbd6fd7,['name',_0xab76('0x67')]);_0x19810b['field']='ContactId';_0x1c64d2=as['buildExpression'](_0x3bb2da,_0x54e7df[_0xab76('0x35')],_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2[_0xab76('0x65')]['start'],_0x1c64d2[_0xab76('0x65')][_0xab76('0x27')]);}break;case _0xab76('0x69'):var _0x3b3bfd=_0x19810b[_0xab76('0x65')][_0xab76('0x2f')](',')[_0xab76('0x2b')](function(_0xa1b99b){return Number(_0xa1b99b);});_0x3b3bfd['forEach'](function(_0x1953e2){_0x4d0b0d['or'](_0xab76('0x6a'),'%,'+_0x1953e2+',%');});_0x546293=_[_0xab76('0x6b')](_0x546293,_0x3b3bfd);break;case _0xab76('0x6c'):if(_0x19810b[_0xab76('0x63')]===_0xab76('0x64')){_0x5dfc30[_0x494811](_0xab76('0x6d'),'%'+_0x19810b['value']+'%',null);}else{_0x54e7df=_[_0xab76('0x6e')](_0xbd6fd7,[_0xab76('0x29'),_0xab76('0x6f')]);_0x19810b['field']=_0xab76('0x6f');_0x1c64d2=as[_0xab76('0x70')](_0x3bb2da,_0x54e7df[_0xab76('0x35')],_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2['value'][_0xab76('0x71')],_0x1c64d2[_0xab76('0x65')][_0xab76('0x27')]);}break;case _0xab76('0x72'):_0x1c64d2=as['buildExpression']('me',null,_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2[_0xab76('0x65')]['start'],_0x1c64d2['value'][_0xab76('0x27')]);break;}}else{var _0x1c64d2=as[_0xab76('0x70')](_0x3bb2da,_0x54e7df['type'],_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2['value']['start'],_0x1c64d2[_0xab76('0x65')][_0xab76('0x27')]);}}}else{var _0x22f74e=_(_0x53bf3a[_0xab76('0x3b')])[_0xab76('0x37')]()[_0xab76('0x2b')](function(_0x213a48){return _[_0xab76('0x73')](_0xbd6fd7,[_0xab76('0x29'),_0x213a48])?_0x213a48:undefined;})['compact']()[_0xab76('0x65')]();if(!_[_0xab76('0x74')](_0x22f74e)){_0x22f74e['forEach'](function(_0xdcef44){if(_0xdcef44===_0xab76('0x75')){_0x4c96cc[_0xab76('0x42')](_0xab76('0x76'),[][_0xab76('0x77')](_0x53bf3a[_0xab76('0x3b')][_0xdcef44]));}else if(_0xdcef44===_0xab76('0x78')){var _0x1012b2=JSON[_0xab76('0x79')](_0x53bf3a[_0xab76('0x3b')][_0xdcef44])[_0xab76('0x7a')];var _0x420365=JSON['parse'](_0x53bf3a['query'][_0xdcef44])[_0xab76('0x7b')];_0x4c96cc[_0xab76('0x42')](_0xab76('0x7c'),_0x1012b2,_0x420365);}else{if(_0x53bf3a[_0xab76('0x3b')][_0xdcef44]===_0xab76('0x7d')){_0x4c96cc[_0xab76('0x42')]('i.'+_0xdcef44+_0xab76('0x7e'));}else{_0x4c96cc[_0xab76('0x42')]('i.'+_0xdcef44+'\x20=\x20?',_0x53bf3a['query'][_0xdcef44]);}}});}if(_0x53bf3a['query'][_0xab76('0x7f')]){if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x7f')]==0x1){_0x4c96cc[_0xab76('0x60')](_0xab76('0x80'));}else{_0x4c96cc[_0xab76('0x60')](_0xab76('0x81'));}}if(_0x53bf3a[_0xab76('0x3b')]['tag']){_0x546293=_[_0xab76('0x82')](_0x53bf3a['query'][_0xab76('0x83')])?_0x53bf3a['query'][_0xab76('0x83')]:new Array(_0x53bf3a[_0xab76('0x3b')]['tag']);_0x546293[_0xab76('0x30')](function(_0x1d7618){_0x4d0b0d['or'](_0xab76('0x6a'),'%,'+_0x1d7618+',%');});}if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x84')]){var _0x3ded18=_0x53bf3a[_0xab76('0x3b')][_0xab76('0x84')][_0xab76('0x85')]('\x5c','\x5c\x5c')[_0xab76('0x85')](/'/g,'\x27\x27');if(qs[_0xab76('0x86')](_0x3ded18)){_0x5dfc30['or'](_0xab76('0x87'),_0x3ded18+'%');}else{_0x5dfc30['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xab76('0x88')](_0x3ded18))['or']('i.from\x20LIKE\x20?',_0x3ded18+'%')['or'](_0xab76('0x89'),_0x3ded18+'%');}}}_0x4c96cc['where'](_0x5dfc30);_0x4c96cc[_0xab76('0x8a')](_0xab76('0x8b'));var _0x45eca7={'type':db[_0xab76('0x8c')][_0xab76('0x8d')]['SELECT'],'raw':!![]};var _0x2f9bd8=_0x4c96cc[_0xab76('0x8e')]();_0x2f9bd8[_0xab76('0x44')](_0xab76('0x8b'));_0x2f9bd8[_0xab76('0x44')](_0xab76('0x8f'),_0xab76('0x5f'));if(_0xa0262e['order']){_0xa0262e[_0xab76('0x40')][_0xab76('0x30')](function(_0xdc6f65){var _0x524929=_0xdc6f65[0x0]==='contactName'?_0xdc6f65[0x0]:'i.'+_0xdc6f65[0x0];_0x4c96cc['order'](_0x524929,_0xdc6f65[0x1]==='DESC'?![]:!![]);});}if(!_[_0xab76('0x74')](_0x546293)){_0x4c96cc[_0xab76('0x60')](_0x4d0b0d);_0x2f9bd8[_0xab76('0x42')](_0xab76('0x90'),_0x546293);}BPromise[_0xab76('0x91')]()[_0xab76('0x26')](function(){if(!_0x1ab539){if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x75')]||_0x53bf3a[_0xab76('0x3b')][_0xab76('0x92')])return;_0x2f9bd8[_0xab76('0x42')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4c96cc['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x53bf3a[_0xab76('0x93')]['role']!=='agent')return;return _0x53bf3a[_0xab76('0x93')][_0xab76('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1203c0){if(_['isEmpty'](_0x1203c0)){_0x2f9bd8[_0xab76('0x42')](_0xab76('0x95'));_0x4c96cc['where'](_0xab76('0x95'));}else{_0x2f9bd8['where'](_0xab76('0x76'),_[_0xab76('0x2b')](_0x1203c0,'id'));_0x4c96cc['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xab76('0x2b')](_0x1203c0,'id'));}});})[_0xab76('0x26')](function(){if(_0x53bf3a[_0xab76('0x93')]['role']===_0xab76('0x96')&&!_0x1ab539&&!_0x53bf3a[_0xab76('0x3b')][_0xab76('0x75')])return[];return db['sequelize'][_0xab76('0x3b')](_0x2f9bd8[_0xab76('0x97')](),_0x45eca7);})[_0xab76('0x26')](function(_0x3f6bf5){_0x559eff[_0xab76('0x1e')]=_0x3f6bf5[_0xab76('0x5d')];if(_0x559eff[_0xab76('0x1e')]===0x0)return[];return db[_0xab76('0x98')][_0xab76('0x3b')](_0x43934d[_0xab76('0x97')](),_0x45eca7)[_0xab76('0x26')](function(_0x55e8db){_0x19066d=_[_0xab76('0x99')](_0x55e8db,'id');_0x45eca7=_['merge'](_0x45eca7,{'model':db[_0xab76('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x3d')]){_0xa0262e[_0xab76('0x3c')][_0xab76('0x30')](function(_0x5e6173){_0x4c96cc[_0xab76('0x44')]('i.'+_0x5e6173);});}else{_0x4c96cc[_0xab76('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4c96cc['field'](_0xab76('0x9a'),_0xab76('0x9b'));_0x4c96cc[_0xab76('0x44')](_0xab76('0x9c'),_0xab76('0x9d'));_0x4c96cc[_0xab76('0x44')](_0xab76('0x9e'),_0xab76('0x9f'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa0'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa1'),_0xab76('0xa2'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa3'),_0xab76('0xa4'));_0x4c96cc[_0xab76('0x44')]('c.email','Contact.email');_0x4c96cc['field'](_0xab76('0xa5'),_0xab76('0xa6'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa7'),_0xab76('0xa8'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa9'),_0xab76('0xaa'));_0x4c96cc['field'](_0xab76('0xab'),_0xab76('0xac'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xad'),_0xab76('0xae'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xaf'),_0xab76('0x2e'));}if(_0xa0262e['limit'])_0x4c96cc[_0xab76('0x20')](_0xa0262e['limit']);if(_0xa0262e[_0xab76('0x1f')])_0x4c96cc[_0xab76('0x1f')](_0xa0262e[_0xab76('0x1f')]);return db[_0xab76('0x98')][_0xab76('0x3b')](_0x4c96cc[_0xab76('0x97')](),_0x45eca7);})['then'](function(_0x235e57){_0x5b3e30[_0xab76('0x42')](_0xab76('0xb0'),_[_0xab76('0x2b')](_0x235e57,'id'));return db[_0xab76('0x98')][_0xab76('0x3b')](_0x5b3e30[_0xab76('0x97')](),_0x45eca7)[_0xab76('0x26')](function(_0x282755){var _0x59488f=_[_0xab76('0xb1')](_0x282755,_0xab76('0xb2'));var _0x475b23=[];_0x235e57[_0xab76('0x30')](function(_0x40f89f){_0x475b23[_0xab76('0x31')](updateOpenchannelInteraction(_0x40f89f,_0x19066d,_0x59488f));});return BPromise[_0xab76('0xb3')](_0x475b23);});});})[_0xab76('0x26')](function(_0x7ba614){_0x559eff[_0xab76('0xb4')]=_0x7ba614;return _0x559eff;})[_0xab76('0x26')](respondWithFilteredResult(_0x335b21,_0xa0262e))['catch'](handleError(_0x335b21,null));};exports[_0xab76('0xb5')]=function(_0x1590c5,_0x1b3688){var _0xdcf38={};if(_0x1590c5['query'][_0xab76('0x35')]&&_0x1590c5['query'][_0xab76('0x35')]===_0xab76('0x46')){_0xdcf38[_0xab76('0x46')]=_0x1590c5[_0xab76('0xb6')]['id'];}else{_0xdcf38['id']=_0x1590c5[_0xab76('0xb6')]['id'];}var _0x5b46b7={'raw':![],'where':_0xdcf38},_0x269691={};_0x269691[_0xab76('0x3a')]=_[_0xab76('0x37')](db[_0xab76('0x34')]['rawAttributes']);_0x269691['query']=_['keys'](_0x1590c5[_0xab76('0x3b')]);_0x269691[_0xab76('0x38')]=_[_0xab76('0x39')](_0x269691[_0xab76('0x3a')],_0x269691[_0xab76('0x3b')]);_0x5b46b7[_0xab76('0x3c')]=_[_0xab76('0x39')](_0x269691[_0xab76('0x3a')],qs[_0xab76('0x3d')](_0x1590c5[_0xab76('0x3b')][_0xab76('0x3d')]));_0x5b46b7[_0xab76('0x3c')]=_0x5b46b7['attributes'][_0xab76('0x5d')]?_0x5b46b7[_0xab76('0x3c')]:_0x269691[_0xab76('0x3a')];if(_0x1590c5[_0xab76('0x3b')]['includeAll']){_0x5b46b7[_0xab76('0xb7')]=[{'all':!![]}];}_0x5b46b7=_[_0xab76('0xb8')]({},_0x5b46b7,_0x1590c5[_0xab76('0xb9')]);return db['OpenchannelInteraction'][_0xab76('0x6e')](_0x5b46b7)[_0xab76('0x26')](handleEntityNotFound(_0x1b3688,null))[_0xab76('0x26')](respondWithResult(_0x1b3688,null))[_0xab76('0x32')](handleError(_0x1b3688,null));};exports[_0xab76('0xba')]=function(_0x23a1d7,_0x38c591){return db['OpenchannelInteraction'][_0xab76('0xba')](_0x23a1d7[_0xab76('0x72')],{})[_0xab76('0x26')](respondWithResult(_0x38c591,0xc9))[_0xab76('0x32')](handleError(_0x38c591,null));};exports[_0xab76('0x24')]=function(_0x2195ba,_0x3b8475){if(_0x2195ba[_0xab76('0x72')]['id']){delete _0x2195ba[_0xab76('0x72')]['id'];}return db['OpenchannelInteraction'][_0xab76('0x6e')]({'where':{'id':_0x2195ba[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x3b8475,null))[_0xab76('0x26')](saveUpdates(_0x2195ba['body'],null))[_0xab76('0x26')](respondWithResult(_0x3b8475,null))[_0xab76('0x32')](handleError(_0x3b8475,null));};exports[_0xab76('0x25')]=function(_0x2b71f1,_0x4b78e4){return db[_0xab76('0x34')]['find']({'where':{'id':_0x2b71f1[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x4b78e4,null))[_0xab76('0x26')](removeEntity(_0x4b78e4,null))['catch'](handleError(_0x4b78e4,null));};exports[_0xab76('0xbb')]=function(_0x1b928b,_0x5af2c0){return db[_0xab76('0x34')]['describe']()[_0xab76('0x26')](respondWithResult(_0x5af2c0,null))[_0xab76('0x32')](handleError(_0x5af2c0,null));};exports['addMessage']=function(_0x1161ba,_0x25ce00,_0x3ac62b){return db[_0xab76('0xbc')][_0xab76('0x6e')]({'where':{'id':_0x1161ba['params']['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x25ce00,null))[_0xab76('0x26')](function(_0x455df9){if(_0x455df9){return _0x455df9[_0xab76('0xbd')](_0x1161ba[_0xab76('0x72')][_0xab76('0xbe')],_[_0xab76('0xbf')](_0x1161ba['body'],[_0xab76('0xbe'),'id'])||{});}})[_0xab76('0x26')](respondWithResult(_0x25ce00,null))[_0xab76('0x32')](handleError(_0x25ce00,null));};exports['getMessages']=function(_0xd0b563,_0x3e1228,_0x54fec3){var _0xde3388={'raw':![],'where':{}};var _0x514c4b={};var _0x13cba6={'count':0x0,'rows':[]};return db[_0xab76('0x34')][_0xab76('0xc0')]({'where':{'id':_0xd0b563[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x3e1228,null))[_0xab76('0x26')](function(_0x438f2f){if(_0x438f2f){_0x514c4b[_0xab76('0x3a')]=_[_0xab76('0x37')](db['OpenchannelMessage'][_0xab76('0xc1')]);_0x514c4b[_0xab76('0x3b')]=_[_0xab76('0x37')](_0xd0b563[_0xab76('0x3b')]);_0x514c4b['filters']=_[_0xab76('0x39')](_0x514c4b['model'],_0x514c4b[_0xab76('0x3b')]);_0xde3388['attributes']=_[_0xab76('0x39')](_0x514c4b[_0xab76('0x3a')],qs[_0xab76('0x3d')](_0xd0b563[_0xab76('0x3b')][_0xab76('0x3d')]));_0xde3388[_0xab76('0x3c')]=_0xde3388[_0xab76('0x3c')][_0xab76('0x5d')]?_0xde3388[_0xab76('0x3c')]:_0x514c4b[_0xab76('0x3a')];if(!_0xd0b563[_0xab76('0x3b')][_0xab76('0x3e')]('nolimit')){_0xde3388[_0xab76('0x20')]=qs[_0xab76('0x20')](_0xd0b563[_0xab76('0x3b')]['limit']);_0xde3388[_0xab76('0x1f')]=qs[_0xab76('0x1f')](_0xd0b563[_0xab76('0x3b')]['offset']);}_0xde3388[_0xab76('0x40')]=qs[_0xab76('0x41')](_0xd0b563[_0xab76('0x3b')][_0xab76('0x41')]);_0xde3388[_0xab76('0x42')]=qs[_0xab76('0x38')](_[_0xab76('0x43')](_0xd0b563[_0xab76('0x3b')],_0x514c4b['filters']));_0xde3388['where'][_0xab76('0xb2')]=_0x438f2f['id'];if(_0xd0b563[_0xab76('0x3b')][_0xab76('0x84')]){_0xde3388['where']=_[_0xab76('0xb8')](_0xde3388['where'],{'$or':_['map'](_0xde3388[_0xab76('0x3c')],function(_0x5a7619){var _0x2e388d={};_0x2e388d[_0x5a7619]={'$like':'%'+_0xd0b563['query'][_0xab76('0x84')]+'%'};return _0x2e388d;})});}if(_0xd0b563[_0xab76('0x3b')]['$gte']){var _0x8a99b1=_0xd0b563['query'][_0xab76('0x7a')][_0xab76('0x2f')](',');var _0x4a86a2={};_0x4a86a2[_0x8a99b1[0x0]]={'$gte':moment(_0x8a99b1[0x1])['format'](_0xab76('0xc2'))};_0xde3388[_0xab76('0x42')]=_[_0xab76('0xb8')](_0xde3388[_0xab76('0x42')],_0x4a86a2);}_0xde3388=_[_0xab76('0xb8')]({},_0xde3388,_0xd0b563[_0xab76('0xb9')]);return db[_0xab76('0xbc')][_0xab76('0x1e')]({'where':_0xde3388[_0xab76('0x42')]})[_0xab76('0x26')](function(_0x3977dc){_0x13cba6[_0xab76('0x1e')]=_0x3977dc;if(_0xd0b563[_0xab76('0x3b')][_0xab76('0xc3')]){_0xde3388[_0xab76('0xb7')]=[{'all':!![]}];}return db[_0xab76('0xbc')][_0xab76('0xc4')](_0xde3388);})[_0xab76('0x26')](function(_0x11bb48){_0x13cba6[_0xab76('0xb4')]=_0x11bb48;return _0x13cba6;});}})['then'](respondWithFilteredResult(_0x3e1228,_0xde3388))[_0xab76('0x32')](handleError(_0x3e1228,null));};exports[_0xab76('0xc5')]=function(_0x199961,_0x4026c4,_0xa2cf6){return db[_0xab76('0x34')][_0xab76('0x6e')]({'where':{'id':_0x199961[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x4026c4,null))[_0xab76('0x26')](function(_0x544fe4){if(_0x544fe4){return _0x544fe4[_0xab76('0xc6')](_0x199961[_0xab76('0x72')][_0xab76('0xbe')],_['omit'](_0x199961['body'],[_0xab76('0xbe'),'id'])||{})[_0xab76('0xc7')](function(){return db[_0xab76('0x69')][_0xab76('0xc4')]({'attributes':['id',_0xab76('0x29'),_0xab76('0x45')],'where':{'id':_0x199961[_0xab76('0x72')][_0xab76('0xbe')]}});})[_0xab76('0x26')](function(_0x4e59cc){socket[_0xab76('0xc8')](_0xab76('0xc9'),{'id':Number(_0x199961[_0xab76('0xb6')]['id']),'tags':_0x4e59cc||[]});return{'id':Number(_0x199961['params']['id']),'tags':_0x4e59cc||[]};});}})[_0xab76('0x26')](respondWithResult(_0x4026c4,null))[_0xab76('0x32')](handleError(_0x4026c4,null));};exports[_0xab76('0xca')]=function(_0x4143fa,_0x15388d,_0x43517d){return db[_0xab76('0x34')][_0xab76('0x6e')]({'where':{'id':_0x4143fa['params']['id']}})['then'](handleEntityNotFound(_0x15388d,null))['then'](function(_0x4534dc){if(_0x4534dc){return _0x4534dc[_0xab76('0xca')](_0x4143fa[_0xab76('0x3b')][_0xab76('0xbe')]);}})[_0xab76('0x26')](respondWithStatusCode(_0x15388d,null))[_0xab76('0x32')](handleError(_0x15388d,null));};exports[_0xab76('0xcb')]=function(_0x2a4192,_0x34b9c2){var _0x449f8c=moment()[_0xab76('0xcc')]()[_0xab76('0x97')]();var _0x22c32b=path['join'](config[_0xab76('0xcd')],'server',_0xab76('0xce'),'tmp');var _0x57eaad=path[_0xab76('0xcf')](config['root'],_0xab76('0xd0'),_0xab76('0xce'),_0xab76('0xd1'));var _0x1d369c=path[_0xab76('0xcf')](_0x22c32b,_0x449f8c);var _0x4cae37=util[_0xab76('0xd2')](_0xab76('0xd3'),_0x2a4192[_0xab76('0xb6')]['id'],_0x449f8c);var _0x824b7f=path[_0xab76('0xcf')](_0x22c32b,_0x4cae37);var _0x40c795=[];_0x40c795[_0xab76('0x31')]({'model':db['User'],'as':_0xab76('0x6c'),'attributes':['id',_0xab76('0x2c')],'raw':!![]});_0x40c795[_0xab76('0x31')]({'model':db[_0xab76('0xd4')],'as':_0xab76('0x62'),'attributes':['id',_0xab76('0xd5'),_0xab76('0xd6')],'raw':!![]});if(_0x2a4192[_0xab76('0x3b')][_0xab76('0xd1')]){_0x40c795[_0xab76('0x31')]({'model':db[_0xab76('0xd7')],'as':_0xab76('0xd7'),'raw':!![]});}var _0x3ec5f5=[{'model':db['OpenchannelMessage'],'as':_0xab76('0xd8'),'attributes':['id',_0xab76('0x72'),_0xab76('0x78'),'direction',_0xab76('0xd9'),_0xab76('0x7f')],'include':_0x40c795}];_0x3ec5f5[_0xab76('0x31')]({'model':db[_0xab76('0xda')],'as':_0xab76('0xdb'),'attributes':['id',_0xab76('0x29')]});_0x3ec5f5['push']({'model':db[_0xab76('0x6c')],'as':'Owner','attributes':['id',_0xab76('0x2c')]});return db[_0xab76('0x34')][_0xab76('0x6e')]({'where':{'id':_0x2a4192[_0xab76('0xb6')]['id']},'include':_0x3ec5f5})[_0xab76('0x26')](handleEntityNotFound(_0x34b9c2,null))[_0xab76('0x26')](function(_0x5687d2){if(_0x5687d2){var _0x4810cb=_0x5687d2[_0xab76('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x1d369c);var _0x7e9d08={'format':'A4','border':'10px','header':{'height':_0xab76('0xdd'),'contents':{'first':_0xab76('0xde')}},'footer':{'height':_0xab76('0xdf'),'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[_0xab76('0xd2')](_0xab76('0xe0'),_0xab76('0xe1'),_0x4810cb['id']),moment()[_0xab76('0xd2')]('YYYY-MM-DD')['toString']())}}};var _0x299a27={'channel':_0xab76('0xe1'),'account':_0x4810cb[_0xab76('0xdb')]['name'],'agent':_0x4810cb[_0xab76('0xe2')]?_0x4810cb[_0xab76('0xe2')]['fullname']:'N.A.','createdAt':moment(_0x4810cb[_0xab76('0x78')])['format'](_0xab76('0xc2'))['toString'](),'closedAt':_0x4810cb[_0xab76('0xe3')]?moment(_0x4810cb[_0xab76('0xe4')])[_0xab76('0xd2')](_0xab76('0xc2'))[_0xab76('0x97')]():'','disposition':_0x4810cb['disposition'],'visibility':_0x4810cb[_0xab76('0xe5')]?_0xab76('0xe6'):_0xab76('0xe7'),'messages':_(_0x4810cb['Messages'])[_0xab76('0x84')]({'secret':![]})['map'](function(_0x3c6c3a){if(_0x3c6c3a[_0xab76('0xd7')]){var _0x42c062=path[_0xab76('0xcf')](_0x57eaad,_0x3c6c3a[_0xab76('0xd7')][_0xab76('0xe8')]);if(fs[_0xab76('0xe9')](_0x42c062)){fs[_0xab76('0xea')](_0x42c062)[_0xab76('0xeb')](fs[_0xab76('0xec')](path[_0xab76('0xcf')](_0x1d369c,_0x3c6c3a[_0xab76('0xd7')][_0xab76('0xe8')])));}}return{'date':moment(_0x3c6c3a[_0xab76('0x78')])[_0xab76('0xd2')](_0xab76('0xc2'))[_0xab76('0x97')](),'sender':_0x3c6c3a['direction']===_0xab76('0xed')?_0x3c6c3a[_0xab76('0x6c')]?_0x3c6c3a[_0xab76('0x6c')][_0xab76('0x2c')]:'System':_0x3c6c3a[_0xab76('0x62')][_0xab76('0xd5')]+(_0x3c6c3a['Contact'][_0xab76('0xd6')]?'\x20'+_0x3c6c3a[_0xab76('0x62')][_0xab76('0xd6')]:''),'body':_0x3c6c3a[_0xab76('0xd7')]?_0x3c6c3a[_0xab76('0xd7')]['basename']:_0x3c6c3a[_0xab76('0x72')],'direction':_0x3c6c3a['direction']==='out'?'A':'C','secret':_0x3c6c3a['secret'],'read':_0x3c6c3a[_0xab76('0x7f')],'attachment':_0x3c6c3a[_0xab76('0xd7')]};})['value']()};return ejs[_0xab76('0xee')](path['join'](config[_0xab76('0xcd')],_0xab76('0xd0'),_0xab76('0xef'),_0xab76('0xf0')),{'interaction':_0x299a27})[_0xab76('0x26')](function(_0x47c41c){return new BPromise(function(_0x3c9ae1,_0xcf441c){pdf[_0xab76('0xba')](_0x47c41c,_0x7e9d08)[_0xab76('0xf1')](path[_0xab76('0xcf')](_0x1d369c,_0xab76('0xf2')+_0x4810cb['id']+'-'+_0x449f8c+'.pdf'),function(_0x3c77a4,_0x1c0117){if(_0x3c77a4)return _0xcf441c(_0x3c77a4);_0x3c9ae1(_0x1c0117);});});})[_0xab76('0x26')](function(){return new BPromise(function(_0x585e3e,_0x28e227){zipdir(_0x1d369c,{'saveTo':_0x824b7f},function(_0x32bfa6,_0x51604a){if(_0x32bfa6)return _0x28e227(_0x32bfa6);return _0x585e3e(_0x51604a);});})[_0xab76('0x26')](function(){return new BPromise(function(_0x16c1c9,_0x46c0b3){rimraf(_0x1d369c,function(_0x4df44b){if(_0x4df44b)_0x46c0b3(_0x4df44b);return _0x16c1c9();});});})[_0xab76('0x26')](function(){return _0x34b9c2[_0xab76('0xcb')](_0x824b7f,_0x4cae37,function(_0x172a25){if(_0x172a25){console[_0xab76('0xf3')](_0xab76('0xf4'),_0x172a25);}else{fs[_0xab76('0xf5')](_0x824b7f);}});});});}else{return _0x34b9c2[_0xab76('0x1b')](0xc8);}})[_0xab76('0x32')](handleError(_0x34b9c2,null));}; \ No newline at end of file +var _0x3bd8=['bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','fullname','TagIds','split','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','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?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','filters','includeAll','include','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','removeTags','download','unix','join','root','files','tmp','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','Account','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\x0a\x20\x20\x20\x20\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','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','System','secret','renderFile','server','views','downloadInteraction.html','create','toFile','.pdf','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x151634,_0x188750){var _0x2e2f2b=function(_0x4e9f31){while(--_0x4e9f31){_0x151634['push'](_0x151634['shift']());}};_0x2e2f2b(++_0x188750);}(_0x3bd8,0xf0));var _0x83bd=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x3bd8[_0x2c534a];return _0x3f5c99;};'use strict';var pdf=require(_0x83bd('0x0'));var emlformat=require(_0x83bd('0x1'));var rimraf=require(_0x83bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83bd('0x3'));var rp=require(_0x83bd('0x4'));var moment=require(_0x83bd('0x5'));var BPromise=require(_0x83bd('0x6'));var Mustache=require('mustache');var util=require(_0x83bd('0x7'));var path=require('path');var sox=require(_0x83bd('0x8'));var csv=require(_0x83bd('0x9'));var ejs=require(_0x83bd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x83bd('0xb'));var crypto=require(_0x83bd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x83bd('0xd'));var toCsv=require(_0x83bd('0x9'));var querystring=require(_0x83bd('0xe'));var Papa=require(_0x83bd('0xf'));var Redis=require(_0x83bd('0x10'));var authService=require(_0x83bd('0x11'));var qs=require(_0x83bd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83bd('0x13'));var logger=require(_0x83bd('0x14'))(_0x83bd('0x15'));var utils=require(_0x83bd('0x16'));var config=require(_0x83bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x83bd('0x18'))['db'];config[_0x83bd('0x19')]=_[_0x83bd('0x1a')](config[_0x83bd('0x19')],{'host':_0x83bd('0x1b'),'port':0x18eb});var socket=require(_0x83bd('0x1c'))(new Redis(config[_0x83bd('0x19')]));require('./openchannelInteraction.socket')[_0x83bd('0x1d')](socket);function respondWithStatusCode(_0x4766d5,_0x3862d){_0x3862d=_0x3862d||0xcc;return function(_0xffdbb8){if(_0xffdbb8){return _0x4766d5['sendStatus'](_0x3862d);}return _0x4766d5[_0x83bd('0x1e')](_0x3862d)['end']();};}function respondWithResult(_0x105b30,_0x4e18c6){_0x4e18c6=_0x4e18c6||0xc8;return function(_0x1557f5){if(_0x1557f5){return _0x105b30[_0x83bd('0x1e')](_0x4e18c6)[_0x83bd('0x1f')](_0x1557f5);}};}function respondWithFilteredResult(_0x4539d8,_0x1aa2e7){return function(_0x1654a3){if(_0x1654a3){var _0x30eec6=_0x1654a3[_0x83bd('0x20')],_0xa409b1=_0x1aa2e7[_0x83bd('0x21')],_0x428936=_0x1aa2e7[_0x83bd('0x21')]+_0x1aa2e7[_0x83bd('0x22')],_0x25db46;if(_0x428936>=_0x30eec6){_0x428936=_0x30eec6;_0x25db46=0xc8;}else{_0x25db46=0xce;}_0x4539d8[_0x83bd('0x1e')](_0x25db46);return _0x4539d8[_0x83bd('0x23')](_0x83bd('0x24'),_0xa409b1+'-'+_0x428936+'/'+_0x30eec6)[_0x83bd('0x1f')](_0x1654a3);}return null;};}function patchUpdates(_0x292d73){return function(_0x39632f){try{jsonpatch[_0x83bd('0x25')](_0x39632f,_0x292d73,!![]);}catch(_0x2b2bc1){return BPromise[_0x83bd('0x26')](_0x2b2bc1);}return _0x39632f[_0x83bd('0x27')]();};}function saveUpdates(_0x213d65,_0x16b01a){return function(_0x2babe0){if(_0x2babe0){return _0x2babe0[_0x83bd('0x28')](_0x213d65)[_0x83bd('0x29')](function(_0x55862e){return _0x55862e;});}return null;};}function removeEntity(_0x537f31,_0x479731){return function(_0xf61147){if(_0xf61147){return _0xf61147[_0x83bd('0x2a')]()[_0x83bd('0x29')](function(){_0x537f31['status'](0xcc)[_0x83bd('0x2b')]();});}};}function handleEntityNotFound(_0xfdf5fa,_0x1a6e82){return function(_0x4b09c9){if(!_0x4b09c9){_0xfdf5fa[_0x83bd('0x2c')](0x194);}return _0x4b09c9;};}function handleError(_0x3a41dc,_0x48f503){_0x48f503=_0x48f503||0x1f4;return function(_0x5138ba){logger[_0x83bd('0x2d')](_0x5138ba[_0x83bd('0x2e')]);if(_0x5138ba[_0x83bd('0x2f')]){delete _0x5138ba['name'];}_0x3a41dc[_0x83bd('0x1e')](_0x48f503)[_0x83bd('0x30')](_0x5138ba);};}function getInteractionUsers(_0x1f7f8d,_0x59307e){return new BPromise(function(_0xe2e71d,_0xeadf5a){try{if(_0x59307e[_0x1f7f8d['id']]){_0x1f7f8d['Users']=_[_0x83bd('0x31')](_0x59307e[_0x1f7f8d['id']],function(_0x49a656){return{'id':_0x49a656['id'],'fullname':_0x49a656[_0x83bd('0x32')]};});}}catch(_0x90de74){_0xeadf5a(_0x90de74);}_0xe2e71d(_0x1f7f8d);});}function getInteractionTags(_0x3899d3,_0x52bca6){return new BPromise(function(_0x225da9,_0x444bcf){try{if(_0x3899d3[_0x83bd('0x33')]){_0x3899d3['Tags']=[];_0x3899d3['TagIds'][_0x83bd('0x34')](',')['forEach'](function(_0x3ee033){_0x3899d3['Tags'][_0x83bd('0x35')](_0x52bca6[_0x3ee033]);});}delete _0x3899d3['TagIds'];}catch(_0x3d4ae7){_0x444bcf(_0x3d4ae7);}_0x225da9(_0x3899d3);});}function updateOpenchannelInteraction(_0x19bfb9,_0x12ce14,_0x2ad83a){return new BPromise(function(_0x103917,_0x5dbe8a){return getInteractionUsers(_0x19bfb9,_0x2ad83a)[_0x83bd('0x29')](function(_0xf8b769){return getInteractionTags(_0xf8b769,_0x12ce14);})[_0x83bd('0x29')](function(_0x305c88){_0x103917(_0x305c88);})[_0x83bd('0x36')](function(_0x392a19){_0x5dbe8a(_0x392a19);});});}exports[_0x83bd('0x37')]=function(_0x2edfed,_0x69569f){var _0x5b51f8={},_0x380e13={},_0x52a45c={'count':0x0,'rows':[]};var _0x29188e=_[_0x83bd('0x31')](db[_0x83bd('0x38')][_0x83bd('0x39')],function(_0x4be18b){return{'name':_0x4be18b[_0x83bd('0x3a')],'type':_0x4be18b[_0x83bd('0x3b')][_0x83bd('0x3c')]};});_0x380e13['model']=_[_0x83bd('0x31')](_0x29188e,_0x83bd('0x2f'));_0x380e13['query']=_[_0x83bd('0x3d')](_0x2edfed[_0x83bd('0x3e')]);_0x380e13['filters']=_[_0x83bd('0x3f')](_0x380e13[_0x83bd('0x40')],_0x380e13[_0x83bd('0x3e')]);_0x5b51f8[_0x83bd('0x41')]=_[_0x83bd('0x3f')](_0x380e13[_0x83bd('0x40')],qs['fields'](_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x42')]));_0x5b51f8['attributes']=_0x5b51f8[_0x83bd('0x41')][_0x83bd('0x43')]?_0x5b51f8[_0x83bd('0x41')]:_0x380e13['model'];if(!_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x44')](_0x83bd('0x45'))){_0x5b51f8[_0x83bd('0x22')]=qs[_0x83bd('0x22')](_0x2edfed['query'][_0x83bd('0x22')]);_0x5b51f8[_0x83bd('0x21')]=qs[_0x83bd('0x21')](_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x21')]);}_0x5b51f8[_0x83bd('0x46')]=qs[_0x83bd('0x47')](_0x2edfed[_0x83bd('0x3e')]['sort']);_0x5b51f8[_0x83bd('0x48')]=qs['filters'](_[_0x83bd('0x49')](_0x2edfed[_0x83bd('0x3e')],_0x380e13['filters']),_0x29188e);var _0x3dde5a=[];var _0x2460aa=squel[_0x83bd('0x4a')]()['field']('id')[_0x83bd('0x4b')](_0x83bd('0x2f'))[_0x83bd('0x4b')](_0x83bd('0x4c'))[_0x83bd('0x4d')](_0x83bd('0x4e'));var _0xd693b4=squel[_0x83bd('0x4a')]()[_0x83bd('0x4b')](_0x83bd('0x4f'))['field'](_0x83bd('0x50'))['field'](_0x83bd('0x51'))[_0x83bd('0x4d')](_0x83bd('0x52'),'ui')[_0x83bd('0x53')](_0x83bd('0x54'),'u',_0x83bd('0x55'));var _0xbbc0b2=squel[_0x83bd('0x4a')]()['from'](_0x83bd('0x56'),'i')['left_join'](_0x83bd('0x57'),'c',_0x83bd('0x58'))['left_join'](_0x83bd('0x54'),'o',_0x83bd('0x59'))[_0x83bd('0x53')](_0x83bd('0x5a'),'a',_0x83bd('0x5b'))[_0x83bd('0x53')](_0x83bd('0x5c'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x83bd('0x53')](_0x83bd('0x5d'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x83bd('0x53')](_0x83bd('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x4bfdb7=squel[_0x83bd('0x5e')]();var _0x314769=[];var _0x510a04=squel['expr']();var _0x11ba0e;if(_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x5f')]){_0x11ba0e=as[_0x83bd('0x60')](_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x5f')]);var _0x51ba81=_0x11ba0e[_0x83bd('0x61')];for(var _0xc0fda3=0x0;_0xc0fda3<_0x11ba0e[_0x83bd('0x62')][_0x83bd('0x43')];_0xc0fda3++){var _0x45deb8=_0x11ba0e[_0x83bd('0x62')][_0xc0fda3];var _0x1eaa74='i';var _0x6d9169=_[_0x83bd('0x63')](_0x29188e,['name',_0x45deb8['field']]);if(!_0x6d9169){switch(_0x45deb8[_0x83bd('0x4b')]){case _0x83bd('0x64'):if(_0x45deb8[_0x83bd('0x65')]==0x1){_0xbbc0b2[_0x83bd('0x66')]('`'+_0x45deb8[_0x83bd('0x4b')]+_0x83bd('0x67'));}else{_0xbbc0b2[_0x83bd('0x66')]('`'+_0x45deb8[_0x83bd('0x4b')]+'`\x20>\x200');}break;case _0x83bd('0x68'):if(_0x45deb8[_0x83bd('0x69')]===_0x83bd('0x6a')){if(_0x45deb8[_0x83bd('0x65')][_0x83bd('0x34')]('\x20')[_0x83bd('0x43')]>0x1){_0x4bfdb7[_0x51ba81](_0x83bd('0x6b'),qs[_0x83bd('0x6c')](_0x45deb8[_0x83bd('0x65')]),null);}else{var _0x36007c='%'+_0x45deb8[_0x83bd('0x65')]+'%';_0x4bfdb7[_0x51ba81]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x36007c,_0x36007c,_0x36007c);}}else{_0x6d9169=_[_0x83bd('0x63')](_0x29188e,['name',_0x83bd('0x6d')]);_0x45deb8['field']=_0x83bd('0x6d');_0x389726=as[_0x83bd('0x6e')](_0x1eaa74,_0x6d9169[_0x83bd('0x3b')],_0x45deb8);_0x4bfdb7[_0x51ba81](_0x389726['text'],_0x389726[_0x83bd('0x65')][_0x83bd('0x6f')],_0x389726[_0x83bd('0x65')][_0x83bd('0x2b')]);}break;case _0x83bd('0x70'):var _0x533287=_0x45deb8['value']['split'](',')[_0x83bd('0x31')](function(_0x57c50b){return Number(_0x57c50b);});_0x533287[_0x83bd('0x71')](function(_0xe7036c){_0x510a04['or'](_0x83bd('0x72'),'%,'+_0xe7036c+',%');});_0x314769=_[_0x83bd('0x73')](_0x314769,_0x533287);break;case _0x83bd('0x74'):if(_0x45deb8[_0x83bd('0x69')]===_0x83bd('0x6a')){_0x4bfdb7[_0x51ba81](_0x83bd('0x75'),'%'+_0x45deb8[_0x83bd('0x65')]+'%',null);}else{_0x6d9169=_[_0x83bd('0x63')](_0x29188e,[_0x83bd('0x2f'),_0x83bd('0x76')]);_0x45deb8[_0x83bd('0x4b')]=_0x83bd('0x76');_0x389726=as['buildExpression'](_0x1eaa74,_0x6d9169[_0x83bd('0x3b')],_0x45deb8);_0x4bfdb7[_0x51ba81](_0x389726[_0x83bd('0x77')],_0x389726[_0x83bd('0x65')][_0x83bd('0x6f')],_0x389726[_0x83bd('0x65')][_0x83bd('0x2b')]);}break;case _0x83bd('0x78'):_0x389726=as[_0x83bd('0x6e')]('me',null,_0x45deb8);_0x4bfdb7[_0x51ba81](_0x389726[_0x83bd('0x77')],_0x389726[_0x83bd('0x65')]['start'],_0x389726[_0x83bd('0x65')]['end']);break;}}else{var _0x389726=as['buildExpression'](_0x1eaa74,_0x6d9169[_0x83bd('0x3b')],_0x45deb8);_0x4bfdb7[_0x51ba81](_0x389726[_0x83bd('0x77')],_0x389726[_0x83bd('0x65')][_0x83bd('0x6f')],_0x389726['value']['end']);}}}else{var _0x4e3a07=_(_0x2edfed[_0x83bd('0x3e')])[_0x83bd('0x3d')]()[_0x83bd('0x31')](function(_0x4d55ca){return _[_0x83bd('0x79')](_0x29188e,[_0x83bd('0x2f'),_0x4d55ca])?_0x4d55ca:undefined;})[_0x83bd('0x7a')]()[_0x83bd('0x65')]();if(!_[_0x83bd('0x7b')](_0x4e3a07)){_0x4e3a07['forEach'](function(_0x28a9cc){if(_0x28a9cc===_0x83bd('0x7c')){_0xbbc0b2[_0x83bd('0x48')](_0x83bd('0x7d'),[][_0x83bd('0x7e')](_0x2edfed[_0x83bd('0x3e')][_0x28a9cc]));}else if(_0x28a9cc===_0x83bd('0x7f')){var _0x225086=JSON[_0x83bd('0x80')](_0x2edfed['query'][_0x28a9cc])[_0x83bd('0x81')];var _0x143cda=JSON[_0x83bd('0x80')](_0x2edfed[_0x83bd('0x3e')][_0x28a9cc])['$lte'];_0xbbc0b2[_0x83bd('0x48')](_0x83bd('0x82'),_0x225086,_0x143cda);}else{if(_0x2edfed['query'][_0x28a9cc]===_0x83bd('0x83')){_0xbbc0b2[_0x83bd('0x48')]('i.'+_0x28a9cc+_0x83bd('0x84'));}else{_0xbbc0b2['where']('i.'+_0x28a9cc+_0x83bd('0x85'),_0x2edfed[_0x83bd('0x3e')][_0x28a9cc]);}}});}if(_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x86')]){if(_0x2edfed[_0x83bd('0x3e')]['read']==0x1){_0xbbc0b2[_0x83bd('0x66')](_0x83bd('0x87'));}else{_0xbbc0b2['having'](_0x83bd('0x88'));}}if(_0x2edfed['query']['tag']){_0x314769=_[_0x83bd('0x89')](_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x8a')])?_0x2edfed[_0x83bd('0x3e')]['tag']:new Array(_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x8a')]);_0x314769[_0x83bd('0x71')](function(_0x6ad229){_0x510a04['or'](_0x83bd('0x72'),'%,'+_0x6ad229+',%');});}if(_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x8b')]){var _0x20b7b6=_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x8b')][_0x83bd('0x8c')]('\x5c','\x5c\x5c')[_0x83bd('0x8c')](/'/g,'\x27\x27');if(qs[_0x83bd('0x8d')](_0x20b7b6)){_0x4bfdb7['or'](_0x83bd('0x8e'),_0x20b7b6+'%');}else{_0x4bfdb7['or'](_0x83bd('0x8f'),qs[_0x83bd('0x6c')](_0x20b7b6))['or'](_0x83bd('0x90'),_0x20b7b6+'%')['or'](_0x83bd('0x91'),_0x20b7b6+'%');}}}_0xbbc0b2[_0x83bd('0x48')](_0x4bfdb7);_0xbbc0b2[_0x83bd('0x92')](_0x83bd('0x93'));var _0x4f5723={'type':db[_0x83bd('0x94')][_0x83bd('0x95')][_0x83bd('0x96')],'raw':!![]};var _0x310683=_0xbbc0b2['clone']();_0x310683[_0x83bd('0x4b')](_0x83bd('0x93'));_0x310683['field'](_0x83bd('0x97'),_0x83bd('0x64'));if(_0x5b51f8[_0x83bd('0x46')]){_0x5b51f8['order'][_0x83bd('0x71')](function(_0x21bdaa){var _0x3bbdbe=_0x21bdaa[0x0]===_0x83bd('0x98')?_0x21bdaa[0x0]:'i.'+_0x21bdaa[0x0];_0xbbc0b2['order'](_0x3bbdbe,_0x21bdaa[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x314769)){_0xbbc0b2[_0x83bd('0x66')](_0x510a04);_0x310683[_0x83bd('0x48')](_0x83bd('0x99'),_0x314769);}BPromise['resolve']()[_0x83bd('0x29')](function(){if(!_0x11ba0e){if(_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x7c')]||_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x9a')])return;_0x310683[_0x83bd('0x48')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0xbbc0b2[_0x83bd('0x48')](_0x83bd('0x9b'));return;}if(_0x2edfed['user']['role']!==_0x83bd('0x9c'))return;return _0x2edfed[_0x83bd('0x9d')][_0x83bd('0x9e')]({'attributes':['id'],'raw':!![]})[_0x83bd('0x29')](function(_0xc5da2e){if(_[_0x83bd('0x7b')](_0xc5da2e)){_0x310683[_0x83bd('0x48')](_0x83bd('0x9f'));_0xbbc0b2[_0x83bd('0x48')](_0x83bd('0x9f'));}else{_0x310683[_0x83bd('0x48')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x83bd('0x31')](_0xc5da2e,'id'));_0xbbc0b2[_0x83bd('0x48')](_0x83bd('0x7d'),_[_0x83bd('0x31')](_0xc5da2e,'id'));}});})['then'](function(){if(_0x2edfed[_0x83bd('0x9d')][_0x83bd('0xa0')]==='agent'&&!_0x11ba0e&&!_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x7c')])return[];return db[_0x83bd('0xa1')]['query'](_0x310683[_0x83bd('0xa2')](),_0x4f5723);})['then'](function(_0x282f0d){_0x52a45c['count']=_0x282f0d[_0x83bd('0x43')];if(_0x52a45c[_0x83bd('0x20')]===0x0)return[];return db[_0x83bd('0xa1')][_0x83bd('0x3e')](_0x2460aa['toString'](),_0x4f5723)['then'](function(_0x2f3c63){_0x3dde5a=_[_0x83bd('0xa3')](_0x2f3c63,'id');_0x4f5723=_[_0x83bd('0xa4')](_0x4f5723,{'model':db[_0x83bd('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2edfed[_0x83bd('0x3e')][_0x83bd('0x42')]){_0x5b51f8['attributes'][_0x83bd('0x71')](function(_0x2c0712){_0xbbc0b2[_0x83bd('0x4b')]('i.'+_0x2c0712);});}else{_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0x97'),'unreadMessages');_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xa5'),'Account.key');_0xbbc0b2[_0x83bd('0x4b')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xa6'),_0x83bd('0x98'));_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xa7'));_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xa8'),'Contact.firstName');_0xbbc0b2[_0x83bd('0x4b')]('c.lastName','Contact.lastName');_0xbbc0b2['field'](_0x83bd('0xa9'),_0x83bd('0xaa'));_0xbbc0b2['field'](_0x83bd('0xab'),_0x83bd('0xac'));_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xad'),_0x83bd('0xae'));_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xaf'),_0x83bd('0xb0'));_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xb1'),_0x83bd('0xb2'));_0xbbc0b2['field']('o.internal',_0x83bd('0xb3'));_0xbbc0b2[_0x83bd('0x4b')](_0x83bd('0xb4'),_0x83bd('0x33'));}if(_0x5b51f8[_0x83bd('0x22')])_0xbbc0b2[_0x83bd('0x22')](_0x5b51f8[_0x83bd('0x22')]);if(_0x5b51f8[_0x83bd('0x21')])_0xbbc0b2[_0x83bd('0x21')](_0x5b51f8[_0x83bd('0x21')]);return db[_0x83bd('0xa1')][_0x83bd('0x3e')](_0xbbc0b2[_0x83bd('0xa2')](),_0x4f5723);})[_0x83bd('0x29')](function(_0x84969b){_0xd693b4[_0x83bd('0x48')](_0x83bd('0xb5'),_['map'](_0x84969b,'id'));return db[_0x83bd('0xa1')][_0x83bd('0x3e')](_0xd693b4[_0x83bd('0xa2')](),_0x4f5723)[_0x83bd('0x29')](function(_0x1df4dd){var _0xe64c83=_[_0x83bd('0xb6')](_0x1df4dd,_0x83bd('0xb7'));var _0x155090=[];_0x84969b[_0x83bd('0x71')](function(_0x5babc0){_0x155090[_0x83bd('0x35')](updateOpenchannelInteraction(_0x5babc0,_0x3dde5a,_0xe64c83));});return BPromise[_0x83bd('0xb8')](_0x155090);});});})[_0x83bd('0x29')](function(_0x582e53){_0x52a45c[_0x83bd('0xb9')]=_0x582e53;return _0x52a45c;})[_0x83bd('0x29')](respondWithFilteredResult(_0x69569f,_0x5b51f8))[_0x83bd('0x36')](handleError(_0x69569f,null));};exports[_0x83bd('0xba')]=function(_0x3cdfa1,_0x109112){var _0x39542b={};if(_0x3cdfa1[_0x83bd('0x3e')][_0x83bd('0x3b')]&&_0x3cdfa1['query'][_0x83bd('0x3b')]===_0x83bd('0x4d')){_0x39542b[_0x83bd('0x4d')]=_0x3cdfa1[_0x83bd('0xbb')]['id'];}else{_0x39542b['id']=_0x3cdfa1[_0x83bd('0xbb')]['id'];}var _0x101adc={'raw':![],'where':_0x39542b},_0x5de740={};_0x5de740[_0x83bd('0x40')]=_[_0x83bd('0x3d')](db[_0x83bd('0x38')][_0x83bd('0x39')]);_0x5de740['query']=_[_0x83bd('0x3d')](_0x3cdfa1['query']);_0x5de740[_0x83bd('0xbc')]=_[_0x83bd('0x3f')](_0x5de740[_0x83bd('0x40')],_0x5de740['query']);_0x101adc['attributes']=_[_0x83bd('0x3f')](_0x5de740['model'],qs[_0x83bd('0x42')](_0x3cdfa1[_0x83bd('0x3e')][_0x83bd('0x42')]));_0x101adc[_0x83bd('0x41')]=_0x101adc[_0x83bd('0x41')][_0x83bd('0x43')]?_0x101adc[_0x83bd('0x41')]:_0x5de740[_0x83bd('0x40')];if(_0x3cdfa1[_0x83bd('0x3e')][_0x83bd('0xbd')]){_0x101adc[_0x83bd('0xbe')]=[{'all':!![]}];}_0x101adc=_['merge']({},_0x101adc,_0x3cdfa1['options']);return db['OpenchannelInteraction']['find'](_0x101adc)[_0x83bd('0x29')](handleEntityNotFound(_0x109112,null))['then'](respondWithResult(_0x109112,null))[_0x83bd('0x36')](handleError(_0x109112,null));};exports['create']=function(_0x28d052,_0x4c09a7){return db['OpenchannelInteraction']['create'](_0x28d052['body'],{})[_0x83bd('0x29')](respondWithResult(_0x4c09a7,0xc9))[_0x83bd('0x36')](handleError(_0x4c09a7,null));};exports[_0x83bd('0x28')]=function(_0x184b3c,_0xab7679){if(_0x184b3c[_0x83bd('0x78')]['id']){delete _0x184b3c['body']['id'];}return db[_0x83bd('0x38')][_0x83bd('0x63')]({'where':{'id':_0x184b3c[_0x83bd('0xbb')]['id']}})[_0x83bd('0x29')](handleEntityNotFound(_0xab7679,null))['then'](saveUpdates(_0x184b3c[_0x83bd('0x78')],null))[_0x83bd('0x29')](respondWithResult(_0xab7679,null))['catch'](handleError(_0xab7679,null));};exports[_0x83bd('0x2a')]=function(_0x2cf04e,_0x246cb3){return db[_0x83bd('0x38')][_0x83bd('0x63')]({'where':{'id':_0x2cf04e[_0x83bd('0xbb')]['id']}})['then'](handleEntityNotFound(_0x246cb3,null))[_0x83bd('0x29')](removeEntity(_0x246cb3,null))[_0x83bd('0x36')](handleError(_0x246cb3,null));};exports[_0x83bd('0xbf')]=function(_0x42a25c,_0x5ba2fa){return db['OpenchannelInteraction'][_0x83bd('0xbf')]()[_0x83bd('0x29')](respondWithResult(_0x5ba2fa,null))[_0x83bd('0x36')](handleError(_0x5ba2fa,null));};exports[_0x83bd('0xc0')]=function(_0x13e6f3,_0x490361,_0x4de1fb){return db[_0x83bd('0xc1')][_0x83bd('0x63')]({'where':{'id':_0x13e6f3[_0x83bd('0xbb')]['id']}})[_0x83bd('0x29')](handleEntityNotFound(_0x490361,null))[_0x83bd('0x29')](function(_0x5bdf0b){if(_0x5bdf0b){return _0x5bdf0b[_0x83bd('0xc0')](_0x13e6f3[_0x83bd('0x78')][_0x83bd('0xc2')],_['omit'](_0x13e6f3[_0x83bd('0x78')],[_0x83bd('0xc2'),'id'])||{});}})['then'](respondWithResult(_0x490361,null))[_0x83bd('0x36')](handleError(_0x490361,null));};exports[_0x83bd('0xc3')]=function(_0x2074cf,_0x56c293,_0x80dc5a){var _0xc1ccc3={'raw':![],'where':{}};var _0x4a6573={};var _0x37ace8={'count':0x0,'rows':[]};return db[_0x83bd('0x38')][_0x83bd('0xc4')]({'where':{'id':_0x2074cf[_0x83bd('0xbb')]['id']}})[_0x83bd('0x29')](handleEntityNotFound(_0x56c293,null))[_0x83bd('0x29')](function(_0x568472){if(_0x568472){_0x4a6573[_0x83bd('0x40')]=_['keys'](db[_0x83bd('0xc1')][_0x83bd('0x39')]);_0x4a6573[_0x83bd('0x3e')]=_[_0x83bd('0x3d')](_0x2074cf[_0x83bd('0x3e')]);_0x4a6573[_0x83bd('0xbc')]=_[_0x83bd('0x3f')](_0x4a6573[_0x83bd('0x40')],_0x4a6573[_0x83bd('0x3e')]);_0xc1ccc3['attributes']=_['intersection'](_0x4a6573[_0x83bd('0x40')],qs['fields'](_0x2074cf[_0x83bd('0x3e')][_0x83bd('0x42')]));_0xc1ccc3[_0x83bd('0x41')]=_0xc1ccc3[_0x83bd('0x41')]['length']?_0xc1ccc3[_0x83bd('0x41')]:_0x4a6573[_0x83bd('0x40')];if(!_0x2074cf[_0x83bd('0x3e')][_0x83bd('0x44')](_0x83bd('0x45'))){_0xc1ccc3[_0x83bd('0x22')]=qs[_0x83bd('0x22')](_0x2074cf[_0x83bd('0x3e')][_0x83bd('0x22')]);_0xc1ccc3[_0x83bd('0x21')]=qs['offset'](_0x2074cf[_0x83bd('0x3e')][_0x83bd('0x21')]);}_0xc1ccc3['order']=qs[_0x83bd('0x47')](_0x2074cf['query'][_0x83bd('0x47')]);_0xc1ccc3['where']=qs['filters'](_['pick'](_0x2074cf[_0x83bd('0x3e')],_0x4a6573[_0x83bd('0xbc')]));_0xc1ccc3[_0x83bd('0x48')]['OpenchannelInteractionId']=_0x568472['id'];if(_0x2074cf['query'][_0x83bd('0x8b')]){_0xc1ccc3[_0x83bd('0x48')]=_[_0x83bd('0xa4')](_0xc1ccc3[_0x83bd('0x48')],{'$or':_[_0x83bd('0x31')](_0xc1ccc3[_0x83bd('0x41')],function(_0x4a947d){var _0xcaec9c={};_0xcaec9c[_0x4a947d]={'$like':'%'+_0x2074cf['query']['filter']+'%'};return _0xcaec9c;})});}if(_0x2074cf[_0x83bd('0x3e')][_0x83bd('0x81')]){var _0x36a6a0=_0x2074cf[_0x83bd('0x3e')]['$gte'][_0x83bd('0x34')](',');var _0x36d7fd={};_0x36d7fd[_0x36a6a0[0x0]]={'$gte':moment(_0x36a6a0[0x1])['format'](_0x83bd('0xc5'))};_0xc1ccc3['where']=_['merge'](_0xc1ccc3[_0x83bd('0x48')],_0x36d7fd);}_0xc1ccc3=_[_0x83bd('0xa4')]({},_0xc1ccc3,_0x2074cf[_0x83bd('0xc6')]);return db[_0x83bd('0xc1')][_0x83bd('0x20')]({'where':_0xc1ccc3[_0x83bd('0x48')]})['then'](function(_0x3bc0a3){_0x37ace8[_0x83bd('0x20')]=_0x3bc0a3;if(_0x2074cf['query'][_0x83bd('0xbd')]){_0xc1ccc3[_0x83bd('0xbe')]=[{'all':!![]}];}return db[_0x83bd('0xc1')][_0x83bd('0xc7')](_0xc1ccc3);})[_0x83bd('0x29')](function(_0x58695c){_0x37ace8[_0x83bd('0xb9')]=_0x58695c;return _0x37ace8;});}})[_0x83bd('0x29')](respondWithFilteredResult(_0x56c293,_0xc1ccc3))[_0x83bd('0x36')](handleError(_0x56c293,null));};exports[_0x83bd('0xc8')]=function(_0x497378,_0x276483,_0x412f51){return db[_0x83bd('0x38')][_0x83bd('0x63')]({'where':{'id':_0x497378[_0x83bd('0xbb')]['id']}})[_0x83bd('0x29')](handleEntityNotFound(_0x276483,null))[_0x83bd('0x29')](function(_0x60e425){if(_0x60e425){return _0x60e425[_0x83bd('0xc9')](_0x497378[_0x83bd('0x78')][_0x83bd('0xc2')],_['omit'](_0x497378[_0x83bd('0x78')],['ids','id'])||{})['spread'](function(){return db[_0x83bd('0x70')]['findAll']({'attributes':['id',_0x83bd('0x2f'),_0x83bd('0x4c')],'where':{'id':_0x497378['body'][_0x83bd('0xc2')]}});})[_0x83bd('0x29')](function(_0x538bd7){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x497378[_0x83bd('0xbb')]['id']),'tags':_0x538bd7||[]});return{'id':Number(_0x497378[_0x83bd('0xbb')]['id']),'tags':_0x538bd7||[]};});}})[_0x83bd('0x29')](respondWithResult(_0x276483,null))[_0x83bd('0x36')](handleError(_0x276483,null));};exports[_0x83bd('0xca')]=function(_0x93547b,_0x53be69,_0x2a0dd1){return db['OpenchannelInteraction'][_0x83bd('0x63')]({'where':{'id':_0x93547b['params']['id']}})[_0x83bd('0x29')](handleEntityNotFound(_0x53be69,null))['then'](function(_0x16ab29){if(_0x16ab29){return _0x16ab29['removeTags'](_0x93547b[_0x83bd('0x3e')][_0x83bd('0xc2')]);}})[_0x83bd('0x29')](respondWithStatusCode(_0x53be69,null))['catch'](handleError(_0x53be69,null));};exports[_0x83bd('0xcb')]=function(_0x5b1dfe,_0x10b126){var _0x404122=moment()[_0x83bd('0xcc')]()[_0x83bd('0xa2')]();var _0x466f1e=path[_0x83bd('0xcd')](config[_0x83bd('0xce')],'server',_0x83bd('0xcf'),_0x83bd('0xd0'));var _0x3b0dab=path[_0x83bd('0xcd')](config[_0x83bd('0xce')],'server',_0x83bd('0xcf'),'attachments');var _0x51802d=path[_0x83bd('0xcd')](_0x466f1e,_0x404122);var _0x5e645d=util[_0x83bd('0xd1')](_0x83bd('0xd2'),_0x5b1dfe['params']['id'],_0x404122);var _0x7ca703=path[_0x83bd('0xcd')](_0x466f1e,_0x5e645d);var _0x3b8ea0=[];_0x3b8ea0['push']({'model':db[_0x83bd('0x74')],'as':_0x83bd('0x74'),'attributes':['id',_0x83bd('0x32')],'raw':!![]});_0x3b8ea0['push']({'model':db[_0x83bd('0xd3')],'as':_0x83bd('0x68'),'attributes':['id',_0x83bd('0xd4'),_0x83bd('0xd5')],'raw':!![]});if(_0x5b1dfe[_0x83bd('0x3e')]['attachments']){_0x3b8ea0[_0x83bd('0x35')]({'model':db['Attachment'],'as':_0x83bd('0xd6'),'raw':!![]});}var _0x374281=[{'model':db[_0x83bd('0xc1')],'as':_0x83bd('0xd7'),'attributes':['id',_0x83bd('0x78'),_0x83bd('0x7f'),'direction','secret',_0x83bd('0x86')],'include':_0x3b8ea0}];_0x374281[_0x83bd('0x35')]({'model':db['OpenchannelAccount'],'as':_0x83bd('0xd8'),'attributes':['id','name']});_0x374281[_0x83bd('0x35')]({'model':db[_0x83bd('0x74')],'as':_0x83bd('0xd9'),'attributes':['id',_0x83bd('0x32')]});return db[_0x83bd('0x38')]['find']({'where':{'id':_0x5b1dfe['params']['id']},'include':_0x374281})[_0x83bd('0x29')](handleEntityNotFound(_0x10b126,null))[_0x83bd('0x29')](function(_0x2246c3){if(_0x2246c3){var _0x1f6950=_0x2246c3[_0x83bd('0xda')]({'plain':!![]});fs[_0x83bd('0xdb')](_0x51802d);var _0x4563f3={'format':'A4','border':_0x83bd('0xdc'),'header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util['format'](_0x83bd('0xdd'),util[_0x83bd('0xd1')](_0x83bd('0xde'),_0x83bd('0xdf'),_0x1f6950['id']),moment()['format']('YYYY-MM-DD')[_0x83bd('0xa2')]())}}};var _0x353669={'channel':_0x83bd('0xdf'),'account':_0x1f6950[_0x83bd('0xd8')][_0x83bd('0x2f')],'agent':_0x1f6950[_0x83bd('0xd9')]?_0x1f6950[_0x83bd('0xd9')]['fullname']:'N.A.','createdAt':moment(_0x1f6950[_0x83bd('0x7f')])[_0x83bd('0xd1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x83bd('0xa2')](),'closedAt':_0x1f6950['closed']?moment(_0x1f6950[_0x83bd('0xe0')])['format'](_0x83bd('0xc5'))[_0x83bd('0xa2')]():'','disposition':_0x1f6950[_0x83bd('0xe1')],'visibility':_0x1f6950[_0x83bd('0xe2')]?_0x83bd('0xe3'):_0x83bd('0xe4'),'messages':_(_0x1f6950[_0x83bd('0xd7')])[_0x83bd('0x8b')]({'secret':![]})[_0x83bd('0x31')](function(_0x239cf7){if(_0x239cf7[_0x83bd('0xd6')]){var _0x13c377=path[_0x83bd('0xcd')](_0x3b0dab,_0x239cf7['Attachment']['basename']);if(fs[_0x83bd('0xe5')](_0x13c377)){fs[_0x83bd('0xe6')](_0x13c377)[_0x83bd('0xe7')](fs[_0x83bd('0xe8')](path[_0x83bd('0xcd')](_0x51802d,_0x239cf7[_0x83bd('0xd6')][_0x83bd('0xe9')])));}}return{'date':moment(_0x239cf7[_0x83bd('0x7f')])[_0x83bd('0xd1')](_0x83bd('0xc5'))['toString'](),'sender':_0x239cf7[_0x83bd('0xea')]==='out'?_0x239cf7[_0x83bd('0x74')]?_0x239cf7[_0x83bd('0x74')][_0x83bd('0x32')]:_0x83bd('0xeb'):_0x239cf7[_0x83bd('0x68')][_0x83bd('0xd4')]+(_0x239cf7[_0x83bd('0x68')][_0x83bd('0xd5')]?'\x20'+_0x239cf7[_0x83bd('0x68')][_0x83bd('0xd5')]:''),'body':_0x239cf7[_0x83bd('0xd6')]?_0x239cf7[_0x83bd('0xd6')]['basename']:_0x239cf7[_0x83bd('0x78')],'direction':_0x239cf7[_0x83bd('0xea')]==='out'?'A':'C','secret':_0x239cf7[_0x83bd('0xec')],'read':_0x239cf7[_0x83bd('0x86')],'attachment':_0x239cf7['Attachment']};})[_0x83bd('0x65')]()};return ejs[_0x83bd('0xed')](path['join'](config[_0x83bd('0xce')],_0x83bd('0xee'),_0x83bd('0xef'),_0x83bd('0xf0')),{'interaction':_0x353669})[_0x83bd('0x29')](function(_0x1189a6){return new BPromise(function(_0x3d92b3,_0x13fbf3){pdf[_0x83bd('0xf1')](_0x1189a6,_0x4563f3)[_0x83bd('0xf2')](path[_0x83bd('0xcd')](_0x51802d,'transcript-'+_0x1f6950['id']+'-'+_0x404122+_0x83bd('0xf3')),function(_0x4c6fd4,_0x3a166a){if(_0x4c6fd4)return _0x13fbf3(_0x4c6fd4);_0x3d92b3(_0x3a166a);});});})[_0x83bd('0x29')](function(){return new BPromise(function(_0x48d8db,_0xfc2d5c){zipdir(_0x51802d,{'saveTo':_0x7ca703},function(_0x1a2b45,_0x444326){if(_0x1a2b45)return _0xfc2d5c(_0x1a2b45);return _0x48d8db(_0x444326);});})[_0x83bd('0x29')](function(){return new BPromise(function(_0x4c2144,_0x452f0f){rimraf(_0x51802d,function(_0xd2fa0){if(_0xd2fa0)_0x452f0f(_0xd2fa0);return _0x4c2144();});});})[_0x83bd('0x29')](function(){return _0x10b126[_0x83bd('0xcb')](_0x7ca703,_0x5e645d,function(_0x47fa18){if(_0x47fa18){console[_0x83bd('0xf4')](_0x83bd('0xf5'),_0x47fa18);}else{fs['unlinkSync'](_0x7ca703);}});});});}else{return _0x10b126['sendStatus'](0xc8);}})[_0x83bd('0x36')](handleError(_0x10b126,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 6c681d5..ac82877 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 _0x0ad8=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x2a9aa3,_0x168d70){var _0x316e20=function(_0xd36806){while(--_0xd36806){_0x2a9aa3['push'](_0x2a9aa3['shift']());}};_0x316e20(++_0x168d70);}(_0x0ad8,0x145));var _0x80ad=function(_0x5c4a10,_0xfa273e){_0x5c4a10=_0x5c4a10-0x0;var _0x153ab7=_0x0ad8[_0x5c4a10];return _0x153ab7;};'use strict';var EventEmitter=require(_0x80ad('0x0'));var OpenchannelInteraction=require(_0x80ad('0x1'))['db'][_0x80ad('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x80ad('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x80ad('0x4')](0x0);var events={'afterCreate':_0x80ad('0x5'),'afterUpdate':_0x80ad('0x6'),'afterDestroy':_0x80ad('0x7')};function emitEvent(_0x79ba94){return function(_0x3052c0,_0x146aa9,_0x3b67c7){_0x3052c0['getUsers']({'attributes':['id'],'raw':!![]})[_0x80ad('0x8')](function(_0x45ae0d){_0x3052c0[_0x80ad('0x9')](_0x80ad('0xa'),_0x45ae0d[_0x80ad('0xb')](function(_0x521446){return{'id':_0x521446['id']};}));return OpenchannelMessage[_0x80ad('0xc')]({'where':{'OpenchannelInteractionId':_0x3052c0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x80ad('0x8')](function(_0x1fb969){_0x3052c0[_0x80ad('0x9')](_0x80ad('0xd'),_0x1fb969[_0x80ad('0xe')]);OpenchannelInteractionEvents[_0x80ad('0xf')](_0x79ba94+':'+_0x3052c0['id'],_0x3052c0);OpenchannelInteractionEvents[_0x80ad('0xf')](_0x79ba94,_0x3052c0);_0x3b67c7(null);})[_0x80ad('0x10')](_0x3b67c7(null));};}for(var e in events){if(events[_0x80ad('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x80ad('0x12')](e,emitEvent(event));}}module[_0x80ad('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc308=['catch','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','findAll','then','setDataValue','unreadMessages','length','emit'];(function(_0x171be1,_0x488744){var _0x29eb93=function(_0x3c48b7){while(--_0x3c48b7){_0x171be1['push'](_0x171be1['shift']());}};_0x29eb93(++_0x488744);}(_0xc308,0x1d4));var _0x8c30=function(_0x1922d2,_0x224ada){_0x1922d2=_0x1922d2-0x0;var _0x268072=_0xc308[_0x1922d2];return _0x268072;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x8c30('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8c30('0x0'))['db'][_0x8c30('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8c30('0x2')](0x0);var events={'afterCreate':_0x8c30('0x3'),'afterUpdate':_0x8c30('0x4'),'afterDestroy':_0x8c30('0x5')};function emitEvent(_0x55de48){return function(_0x2c9db2,_0x6dbea4,_0x4a4e9b){_0x2c9db2['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x282402){_0x2c9db2['setDataValue']('Users',_0x282402['map'](function(_0x16549b){return{'id':_0x16549b['id']};}));return OpenchannelMessage[_0x8c30('0x6')]({'where':{'OpenchannelInteractionId':_0x2c9db2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c30('0x7')](function(_0x60f73){_0x2c9db2[_0x8c30('0x8')](_0x8c30('0x9'),_0x60f73[_0x8c30('0xa')]);OpenchannelInteractionEvents[_0x8c30('0xb')](_0x55de48+':'+_0x2c9db2['id'],_0x2c9db2);OpenchannelInteractionEvents[_0x8c30('0xb')](_0x55de48,_0x2c9db2);_0x4a4e9b(null);})[_0x8c30('0xc')](_0x4a4e9b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x8c30('0xd')](e,emitEvent(event));}}module[_0x8c30('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9958361..377108e 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 _0x7fbe=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment'];(function(_0x39f337,_0x1c137c){var _0x1f9754=function(_0x520869){while(--_0x520869){_0x39f337['push'](_0x39f337['shift']());}};_0x1f9754(++_0x1c137c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3677fc,_0x187168){_0x3677fc=_0x3677fc-0x0;var _0x183fc3=_0x7fbe[_0x3677fc];return _0x183fc3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x213ebc,_0x228f6b,_0x1d0741){if(_0x213ebc[_0xe7fb('0xc')]('closed')){_0x213ebc['closedAt']=moment()[_0xe7fb('0xd')](_0xe7fb('0xe'));}_0x1d0741(null,_0x213ebc);}}});}; \ No newline at end of file +var _0xe132=['rimraf','../../config/environment','define','OpenchannelInteraction','openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f8b77,_0xc1e722){var _0x397bed=function(_0x1c6d21){while(--_0x1c6d21){_0x3f8b77['push'](_0x3f8b77['shift']());}};_0x397bed(++_0xc1e722);}(_0xe132,0x162));var _0x2e13=function(_0x4d4b3f,_0x594eb6){_0x4d4b3f=_0x4d4b3f-0x0;var _0x592c72=_0xe132[_0x4d4b3f];return _0x592c72;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var logger=require(_0x2e13('0x1'))(_0x2e13('0x2'));var moment=require(_0x2e13('0x3'));var BPromise=require(_0x2e13('0x4'));var rp=require(_0x2e13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x260dc1,_0x2f9d00){return _0x260dc1[_0x2e13('0x8')](_0x2e13('0x9'),attributes,{'tableName':_0x2e13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d9487,_0x370a85,_0x6de674){if(_0x2d9487[_0x2e13('0xb')](_0x2e13('0xc'))){_0x2d9487['closedAt']=moment()[_0x2e13('0xd')](_0x2e13('0xe'));}_0x6de674(null,_0x2d9487);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1afc8ed..4a96258 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 _0x3629=['update','body','options','raw','attributes','then','AddTagsToOpenchannelInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','UpdateOpenchannelInteraction','OpenchannelInteraction'];(function(_0x48fdef,_0x386060){var _0x50f85d=function(_0x2dc034){while(--_0x2dc034){_0x48fdef['push'](_0x48fdef['shift']());}};_0x50f85d(++_0x386060);}(_0x3629,0xaa));var _0x9362=function(_0x149033,_0x4fbd54){_0x149033=_0x149033-0x0;var _0x1fb5c7=_0x3629[_0x149033];return _0x1fb5c7;};'use strict';var _=require(_0x9362('0x0'));var util=require(_0x9362('0x1'));var moment=require(_0x9362('0x2'));var BPromise=require(_0x9362('0x3'));var rs=require(_0x9362('0x4'));var fs=require('fs');var Redis=require(_0x9362('0x5'));var db=require(_0x9362('0x6'))['db'];var utils=require(_0x9362('0x7'));var logger=require(_0x9362('0x8'))(_0x9362('0x9'));var config=require(_0x9362('0xa'));var jayson=require(_0x9362('0xb'));var client=jayson[_0x9362('0xc')]['http']({'port':0x232a});config[_0x9362('0xd')]=_['defaults'](config['redis'],{'host':_0x9362('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9362('0xd')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x45d2de,_0x4d9eaa,_0x5328de){return new BPromise(function(_0x2c01d9,_0x1e0ad2){return client['request'](_0x45d2de,_0x5328de)['then'](function(_0x56038d){logger['info'](_0x9362('0xf'),_0x4d9eaa,_0x9362('0x10'));logger[_0x9362('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4d9eaa,_0x9362('0x10'),JSON[_0x9362('0x12')](_0x56038d));if(_0x56038d[_0x9362('0x13')]){if(_0x56038d[_0x9362('0x13')][_0x9362('0x14')]===0x1f4){logger[_0x9362('0x13')](_0x9362('0xf'),_0x4d9eaa,_0x56038d['error'][_0x9362('0x15')]);return _0x1e0ad2(_0x56038d[_0x9362('0x13')][_0x9362('0x15')]);}logger[_0x9362('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4d9eaa,_0x56038d[_0x9362('0x13')][_0x9362('0x15')]);return _0x2c01d9(_0x56038d['error'][_0x9362('0x15')]);}else{logger[_0x9362('0x16')](_0x9362('0xf'),_0x4d9eaa,'request\x20sent');_0x2c01d9(_0x56038d['result']['message']);}})['catch'](function(_0x5ed37d){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4d9eaa,_0x5ed37d);_0x1e0ad2(_0x5ed37d);});});}exports[_0x9362('0x17')]=function(_0x182ba1){var _0x4ff8b2=this;return new Promise(function(_0x1a69c1,_0x1c0eda){return db[_0x9362('0x18')][_0x9362('0x19')](_0x182ba1[_0x9362('0x1a')],{'raw':_0x182ba1[_0x9362('0x1b')]?_0x182ba1[_0x9362('0x1b')][_0x9362('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x182ba1[_0x9362('0x1b')]?_0x182ba1['options']['where']||null:null,'attributes':_0x182ba1['options']?_0x182ba1['options'][_0x9362('0x1d')]||null:null,'limit':_0x182ba1[_0x9362('0x1b')]?_0x182ba1[_0x9362('0x1b')]['limit']||null:null})[_0x9362('0x1e')](function(_0x46d494){logger[_0x9362('0x16')](_0x9362('0x17'),_0x182ba1);logger['debug'](_0x9362('0x17'),_0x182ba1,JSON['stringify'](_0x46d494));_0x1a69c1(_0x46d494);})['catch'](function(_0x5ede37){logger[_0x9362('0x13')](_0x9362('0x17'),_0x5ede37[_0x9362('0x15')],_0x182ba1);_0x1c0eda(_0x4ff8b2[_0x9362('0x13')](0x1f4,_0x5ede37[_0x9362('0x15')]));});});};exports[_0x9362('0x1f')]=function(_0x7c877e){return new Promise(function(_0x2bad19,_0x259698){return db[_0x9362('0x18')][_0x9362('0x20')]({'where':_0x7c877e[_0x9362('0x1b')]?_0x7c877e[_0x9362('0x1b')][_0x9362('0x21')]||null:null})['then'](function(_0x3a4826){if(_0x3a4826){return _0x3a4826[_0x9362('0x22')](_0x7c877e[_0x9362('0x1a')][_0x9362('0x23')],_[_0x9362('0x24')](_0x7c877e[_0x9362('0x1a')],[_0x9362('0x23'),'id'])||{});}})[_0x9362('0x25')](function(_0x3907ec){logger[_0x9362('0x16')](_0x9362('0x26'),_0x7c877e);logger[_0x9362('0x11')](_0x9362('0x26'),_0x7c877e,JSON[_0x9362('0x12')](_0x3907ec));_0x2bad19(_0x3907ec);})['catch'](function(_0xb4be4){logger[_0x9362('0x13')](_0x9362('0x26'),_0xb4be4[_0x9362('0x15')],_0x7c877e);_0x259698(_this['error'](0x1f4,_0xb4be4[_0x9362('0x15')]));});});}; \ No newline at end of file +var _0x2fbe=['request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','stringify','ids','omit','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register'];(function(_0x17a2e6,_0x23e076){var _0x42df4a=function(_0x5da5cd){while(--_0x5da5cd){_0x17a2e6['push'](_0x17a2e6['shift']());}};_0x42df4a(++_0x23e076);}(_0x2fbe,0x19e));var _0xe2fb=function(_0xabc29d,_0x146226){_0xabc29d=_0xabc29d-0x0;var _0x18c99a=_0x2fbe[_0xabc29d];return _0x18c99a;};'use strict';var _=require('lodash');var util=require(_0xe2fb('0x0'));var moment=require('moment');var BPromise=require(_0xe2fb('0x1'));var rs=require(_0xe2fb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2fb('0x3'))['db'];var utils=require(_0xe2fb('0x4'));var logger=require('../../config/logger')(_0xe2fb('0x5'));var config=require(_0xe2fb('0x6'));var jayson=require(_0xe2fb('0x7'));var client=jayson[_0xe2fb('0x8')][_0xe2fb('0x9')]({'port':0x232a});config[_0xe2fb('0xa')]=_['defaults'](config[_0xe2fb('0xa')],{'host':_0xe2fb('0xb'),'port':0x18eb});var socket=require(_0xe2fb('0xc'))(new Redis(config['redis']));require(_0xe2fb('0xd'))[_0xe2fb('0xe')](socket);function respondWithRpcPromise(_0x34ebed,_0x3c5c21,_0xf4bc58){return new BPromise(function(_0x174c21,_0x2bdfc9){return client[_0xe2fb('0xf')](_0x34ebed,_0xf4bc58)[_0xe2fb('0x10')](function(_0x173bcf){logger[_0xe2fb('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3c5c21,_0xe2fb('0x12'));logger[_0xe2fb('0x13')](_0xe2fb('0x14'),_0x3c5c21,_0xe2fb('0x12'),JSON['stringify'](_0x173bcf));if(_0x173bcf[_0xe2fb('0x15')]){if(_0x173bcf[_0xe2fb('0x15')]['code']===0x1f4){logger['error'](_0xe2fb('0x16'),_0x3c5c21,_0x173bcf[_0xe2fb('0x15')][_0xe2fb('0x17')]);return _0x2bdfc9(_0x173bcf[_0xe2fb('0x15')][_0xe2fb('0x17')]);}logger[_0xe2fb('0x15')](_0xe2fb('0x16'),_0x3c5c21,_0x173bcf['error'][_0xe2fb('0x17')]);return _0x174c21(_0x173bcf[_0xe2fb('0x15')][_0xe2fb('0x17')]);}else{logger[_0xe2fb('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3c5c21,_0xe2fb('0x12'));_0x174c21(_0x173bcf[_0xe2fb('0x18')][_0xe2fb('0x17')]);}})[_0xe2fb('0x19')](function(_0x350be8){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3c5c21,_0x350be8);_0x2bdfc9(_0x350be8);});});}exports[_0xe2fb('0x1a')]=function(_0x5ca240){var _0x35fceb=this;return new Promise(function(_0x131cb9,_0x6b203d){return db[_0xe2fb('0x1b')]['update'](_0x5ca240[_0xe2fb('0x1c')],{'raw':_0x5ca240[_0xe2fb('0x1d')]?_0x5ca240[_0xe2fb('0x1d')][_0xe2fb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ca240[_0xe2fb('0x1d')]?_0x5ca240['options'][_0xe2fb('0x1f')]||null:null,'attributes':_0x5ca240[_0xe2fb('0x1d')]?_0x5ca240['options'][_0xe2fb('0x20')]||null:null,'limit':_0x5ca240['options']?_0x5ca240['options'][_0xe2fb('0x21')]||null:null})['then'](function(_0x198953){logger[_0xe2fb('0x11')](_0xe2fb('0x1a'),_0x5ca240);logger[_0xe2fb('0x13')](_0xe2fb('0x1a'),_0x5ca240,JSON[_0xe2fb('0x22')](_0x198953));_0x131cb9(_0x198953);})['catch'](function(_0x1d5150){logger[_0xe2fb('0x15')](_0xe2fb('0x1a'),_0x1d5150['message'],_0x5ca240);_0x6b203d(_0x35fceb[_0xe2fb('0x15')](0x1f4,_0x1d5150[_0xe2fb('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1b0c12){return new Promise(function(_0x5abd10,_0x51b640){return db[_0xe2fb('0x1b')]['find']({'where':_0x1b0c12[_0xe2fb('0x1d')]?_0x1b0c12[_0xe2fb('0x1d')][_0xe2fb('0x1f')]||null:null})[_0xe2fb('0x10')](function(_0x58c5b9){if(_0x58c5b9){return _0x58c5b9['addTags'](_0x1b0c12[_0xe2fb('0x1c')][_0xe2fb('0x23')],_[_0xe2fb('0x24')](_0x1b0c12[_0xe2fb('0x1c')],[_0xe2fb('0x23'),'id'])||{});}})[_0xe2fb('0x25')](function(_0x3e45fa){logger['info'](_0xe2fb('0x26'),_0x1b0c12);logger['debug']('AddTags',_0x1b0c12,JSON[_0xe2fb('0x22')](_0x3e45fa));_0x5abd10(_0x3e45fa);})[_0xe2fb('0x19')](function(_0xe62141){logger['error'](_0xe2fb('0x26'),_0xe62141[_0xe2fb('0x17')],_0x1b0c12);_0x51b640(_this['error'](0x1f4,_0xe62141[_0xe2fb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 27dd228..db0190a 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 _0x14b5=['update','emit','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x1b7683,_0x6c5a86){var _0xaa19db=function(_0x52442b){while(--_0x52442b){_0x1b7683['push'](_0x1b7683['shift']());}};_0xaa19db(++_0x6c5a86);}(_0x14b5,0x9a));var _0x514b=function(_0x1bd003,_0x8e39bf){_0x1bd003=_0x1bd003-0x0;var _0x575e3f=_0x14b5[_0x1bd003];return _0x575e3f;};'use strict';var OpenchannelInteractionEvents=require(_0x514b('0x0'));var events=[_0x514b('0x1'),'remove',_0x514b('0x2')];function createListener(_0x2208ed,_0xdfc624){return function(_0x57eb29){_0xdfc624[_0x514b('0x3')](_0x2208ed,_0x57eb29);};}function removeListener(_0x18bf82,_0x3aa35){return function(){OpenchannelInteractionEvents['removeListener'](_0x18bf82,_0x3aa35);};}exports['register']=function(_0x4d11ef){for(var _0xd7df29=0x0,_0x11583a=events[_0x514b('0x4')];_0xd7df29<_0x11583a;_0xd7df29++){var _0x143799=events[_0xd7df29];var _0x4281f2=createListener(_0x514b('0x5')+_0x143799,_0x4d11ef);OpenchannelInteractionEvents['on'](_0x143799,_0x4281f2);}}; \ No newline at end of file +var _0xdf5a=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener'];(function(_0x280895,_0x24b083){var _0x54eb9b=function(_0x42ac14){while(--_0x42ac14){_0x280895['push'](_0x280895['shift']());}};_0x54eb9b(++_0x24b083);}(_0xdf5a,0x15b));var _0xadf5=function(_0x3f7032,_0x114b09){_0x3f7032=_0x3f7032-0x0;var _0x22dce2=_0xdf5a[_0x3f7032];return _0x22dce2;};'use strict';var OpenchannelInteractionEvents=require(_0xadf5('0x0'));var events=[_0xadf5('0x1'),_0xadf5('0x2'),_0xadf5('0x3')];function createListener(_0x10f164,_0x34e330){return function(_0x274b0f){_0x34e330['emit'](_0x10f164,_0x274b0f);};}function removeListener(_0x5b8e56,_0x48853c){return function(){OpenchannelInteractionEvents[_0xadf5('0x4')](_0x5b8e56,_0x48853c);};}exports[_0xadf5('0x5')]=function(_0x2498c1){for(var _0x45a390=0x0,_0xe4bae7=events[_0xadf5('0x6')];_0x45a390<_0xe4bae7;_0x45a390++){var _0x1d66f4=events[_0x45a390];var _0x2c32e4=createListener(_0xadf5('0x7')+_0x1d66f4,_0x2498c1);OpenchannelInteractionEvents['on'](_0x1d66f4,_0x2c32e4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index fa0b936..b987b22 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 _0x2952=['../../config/environment','./openchannelMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','tracked','openchannel','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2952,0x1c2));var _0x2295=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2952[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2295('0x0'));var timeout=require(_0x2295('0x1'));var express=require(_0x2295('0x2'));var router=express[_0x2295('0x3')]();var auth=require(_0x2295('0x4'));var interaction=require(_0x2295('0x5'));var config=require(_0x2295('0x6'));var controller=require(_0x2295('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2295('0x8')](_0x2295('0x9'),auth[_0x2295('0xa')](),controller[_0x2295('0xb')]);router[_0x2295('0x8')](_0x2295('0xc'),auth['isAuthenticated'](),controller[_0x2295('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x2295('0xe')](_0x2295('0xf'),'openchannelmessage:create'),controller['create']);router['put'](_0x2295('0xc'),auth['isAuthenticated'](),controller[_0x2295('0x10')]);router[_0x2295('0x11')](_0x2295('0x12'),auth[_0x2295('0xa')](),controller[_0x2295('0x13')]);router[_0x2295('0x11')](_0x2295('0x14'),auth[_0x2295('0xa')](),controller[_0x2295('0x15')]);router['delete'](_0x2295('0xc'),auth[_0x2295('0xa')](),controller[_0x2295('0x16')]);module[_0x2295('0x17')]=router; \ No newline at end of file +var _0xd573=['reject','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','show','post','tracked','openchannel','openchannelmessage:create','create','put','/:id/accept','accept','/:id/reject'];(function(_0x16bbdf,_0x16fb32){var _0x384372=function(_0x1f321a){while(--_0x1f321a){_0x16bbdf['push'](_0x16bbdf['shift']());}};_0x384372(++_0x16fb32);}(_0xd573,0x189));var _0x3d57=function(_0x147334,_0x1bd866){_0x147334=_0x147334-0x0;var _0x2c152d=_0xd573[_0x147334];return _0x2c152d;};'use strict';var multer=require(_0x3d57('0x0'));var util=require(_0x3d57('0x1'));var path=require('path');var timeout=require(_0x3d57('0x2'));var express=require(_0x3d57('0x3'));var router=express[_0x3d57('0x4')]();var auth=require(_0x3d57('0x5'));var interaction=require(_0x3d57('0x6'));var config=require(_0x3d57('0x7'));var controller=require(_0x3d57('0x8'));router[_0x3d57('0x9')]('/',auth[_0x3d57('0xa')](),controller['index']);router[_0x3d57('0x9')](_0x3d57('0xb'),auth['isAuthenticated'](),controller[_0x3d57('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3d57('0xd')]);router[_0x3d57('0xe')]('/',auth[_0x3d57('0xa')](),interaction[_0x3d57('0xf')](_0x3d57('0x10'),_0x3d57('0x11')),controller[_0x3d57('0x12')]);router['put']('/:id',auth[_0x3d57('0xa')](),controller['update']);router[_0x3d57('0x13')](_0x3d57('0x14'),auth[_0x3d57('0xa')](),controller[_0x3d57('0x15')]);router['put'](_0x3d57('0x16'),auth[_0x3d57('0xa')](),controller[_0x3d57('0x17')]);router[_0x3d57('0x18')]('/:id',auth[_0x3d57('0xa')](),controller[_0x3d57('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3301025..1687a26 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 _0x6668=['out','DATE','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x19b673,_0x457ee5){var _0x10c7fb=function(_0x435432){while(--_0x435432){_0x19b673['push'](_0x19b673['shift']());}};_0x10c7fb(++_0x457ee5);}(_0x6668,0x1c9));var _0x8666=function(_0x520945,_0x28b144){_0x520945=_0x520945-0x0;var _0x17067a=_0x6668[_0x520945];return _0x17067a;};'use strict';var Sequelize=require('sequelize');module[_0x8666('0x0')]={'body':{'type':Sequelize[_0x8666('0x1')](_0x8666('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8666('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8666('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8666('0x4')]('in','out'),'defaultValue':_0x8666('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8666('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xad31=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x3eda5d,_0x2320c4){var _0x5cdebc=function(_0x1de022){while(--_0x1de022){_0x3eda5d['push'](_0x3eda5d['shift']());}};_0x5cdebc(++_0x2320c4);}(_0xad31,0x157));var _0x1ad3=function(_0x415c12,_0x4ea121){_0x415c12=_0x415c12-0x0;var _0x170a32=_0xad31[_0x415c12];return _0x170a32;};'use strict';var Sequelize=require(_0x1ad3('0x0'));module[_0x1ad3('0x1')]={'body':{'type':Sequelize[_0x1ad3('0x2')](_0x1ad3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1ad3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1ad3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1ad3('0x5')]('in','out'),'defaultValue':_0x1ad3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x1ad3('0x7')]},'providerResponse':{'type':Sequelize[_0x1ad3('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8f2f344..f1c3b36 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 _0x3a79=['request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','set','Content-Range','reject','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','update','params','describe','../../config/logger','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','openchannel','agent','OpenchannelInteraction','role','null','RejectMessage','rejectMessage','SIP/%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info'];(function(_0x14691c,_0xe1c878){var _0xbec98=function(_0x100b9e){while(--_0x100b9e){_0x14691c['push'](_0x14691c['shift']());}};_0xbec98(++_0xe1c878);}(_0x3a79,0xca));var _0x93a7=function(_0x1f892f,_0x50aba){_0x1f892f=_0x1f892f-0x0;var _0x38d4c7=_0x3a79[_0x1f892f];return _0x38d4c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x93a7('0x0'));var rimraf=require(_0x93a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93a7('0x2'));var rp=require(_0x93a7('0x3'));var moment=require(_0x93a7('0x4'));var BPromise=require(_0x93a7('0x5'));var Mustache=require(_0x93a7('0x6'));var util=require(_0x93a7('0x7'));var path=require(_0x93a7('0x8'));var sox=require('sox');var csv=require(_0x93a7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x93a7('0xa'));var squel=require(_0x93a7('0xb'));var crypto=require(_0x93a7('0xc'));var jsforce=require(_0x93a7('0xd'));var deskjs=require(_0x93a7('0xe'));var toCsv=require(_0x93a7('0x9'));var querystring=require('querystring');var Papa=require(_0x93a7('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93a7('0x10'));var as=require(_0x93a7('0x11'));var hardwareService=require(_0x93a7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x93a7('0x13'));var config=require(_0x93a7('0x14'));var licenseUtil=require(_0x93a7('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x93a7('0x16')](config['redis'],{'host':_0x93a7('0x17'),'port':0x18eb});var socket=require(_0x93a7('0x18'))(new Redis(config[_0x93a7('0x19')]));require(_0x93a7('0x1a'))[_0x93a7('0x1b')](socket);var jayson=require(_0x93a7('0x1c'));var client=jayson[_0x93a7('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x93a7('0x1d')][_0x93a7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4aa44e,_0x517a72,_0x29fae6,_0x5d6109){return new BPromise(function(_0xfac49d,_0x46769f){var _0x8c8f3b=_0x5d6109||client;return _0x8c8f3b[_0x93a7('0x1f')](_0x4aa44e,_0x29fae6)[_0x93a7('0x20')](function(_0x4eb2da){logger[_0x93a7('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x517a72,_0x93a7('0x22'));logger[_0x93a7('0x23')](_0x93a7('0x24'),_0x517a72,_0x93a7('0x22'),JSON[_0x93a7('0x25')](_0x4eb2da));if(_0x4eb2da['error']){if(_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x27')]===0x1f4){logger[_0x93a7('0x26')](_0x93a7('0x28'),_0x517a72,_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x29')]);return _0x46769f(_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x29')]);}logger['error'](_0x93a7('0x28'),_0x517a72,_0x4eb2da[_0x93a7('0x26')]['message']);return _0xfac49d(_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x29')]);}else{logger[_0x93a7('0x21')](_0x93a7('0x28'),_0x517a72,'request\x20sent');_0xfac49d(_0x4eb2da[_0x93a7('0x2a')][_0x93a7('0x29')]);}})['catch'](function(_0xafae92){logger[_0x93a7('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x517a72,_0xafae92);_0x46769f(_0xafae92);});});}function respondWithStatusCode(_0x8ac794,_0x4e72b4){_0x4e72b4=_0x4e72b4||0xcc;return function(_0x2c4ed7){if(_0x2c4ed7){return _0x8ac794[_0x93a7('0x2b')](_0x4e72b4);}return _0x8ac794[_0x93a7('0x2c')](_0x4e72b4)[_0x93a7('0x2d')]();};}function respondWithResult(_0x5994dd,_0x1eaff9){_0x1eaff9=_0x1eaff9||0xc8;return function(_0x4f3020){if(_0x4f3020){return _0x5994dd['status'](_0x1eaff9)[_0x93a7('0x2e')](_0x4f3020);}};}function respondWithFilteredResult(_0x44c6da,_0x15e30f){return function(_0x3f5448){if(_0x3f5448){var _0x1fad6e=_0x3f5448[_0x93a7('0x2f')],_0x4b1d61=_0x15e30f['offset'],_0x27e610=_0x15e30f['offset']+_0x15e30f['limit'],_0x4f2b58;if(_0x27e610>=_0x1fad6e){_0x27e610=_0x1fad6e;_0x4f2b58=0xc8;}else{_0x4f2b58=0xce;}_0x44c6da[_0x93a7('0x2c')](_0x4f2b58);return _0x44c6da[_0x93a7('0x30')](_0x93a7('0x31'),_0x4b1d61+'-'+_0x27e610+'/'+_0x1fad6e)['json'](_0x3f5448);}return null;};}function patchUpdates(_0x2842f8){return function(_0x5ca785){try{jsonpatch['apply'](_0x5ca785,_0x2842f8,!![]);}catch(_0x5136f1){return BPromise[_0x93a7('0x32')](_0x5136f1);}return _0x5ca785['save']();};}function saveUpdates(_0xb29e27,_0x1a0c46){return function(_0x507918){if(_0x507918){return _0x507918['update'](_0xb29e27)['then'](function(_0x165303){return _0x165303;});}return null;};}function removeEntity(_0x422a1d,_0x1ea17b){return function(_0xa24248){if(_0xa24248){return _0xa24248['destroy']()[_0x93a7('0x20')](function(){_0x422a1d[_0x93a7('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1992,_0x1057b3){return function(_0x210b21){if(!_0x210b21){_0x4d1992[_0x93a7('0x2b')](0x194);}return _0x210b21;};}function handleError(_0x2d4723,_0xa3bb5f){_0xa3bb5f=_0xa3bb5f||0x1f4;return function(_0xae3714){logger[_0x93a7('0x26')](_0xae3714['stack']);if(_0xae3714[_0x93a7('0x33')]){delete _0xae3714[_0x93a7('0x33')];}_0x2d4723[_0x93a7('0x2c')](_0xa3bb5f)[_0x93a7('0x34')](_0xae3714);};}exports[_0x93a7('0x35')]=function(_0x354de0,_0x33f8bf){var _0x5e72ca={},_0x53c540={},_0x7e980d={'count':0x0,'rows':[]};var _0x2cf9e7=_[_0x93a7('0x36')](db[_0x93a7('0x37')][_0x93a7('0x38')],function(_0x48a4bc){return{'name':_0x48a4bc[_0x93a7('0x39')],'type':_0x48a4bc[_0x93a7('0x3a')][_0x93a7('0x3b')]};});_0x53c540[_0x93a7('0x3c')]=_[_0x93a7('0x36')](_0x2cf9e7,_0x93a7('0x33'));_0x53c540[_0x93a7('0x3d')]=_[_0x93a7('0x3e')](_0x354de0[_0x93a7('0x3d')]);_0x53c540[_0x93a7('0x3f')]=_['intersection'](_0x53c540[_0x93a7('0x3c')],_0x53c540[_0x93a7('0x3d')]);_0x5e72ca['attributes']=_[_0x93a7('0x40')](_0x53c540[_0x93a7('0x3c')],qs[_0x93a7('0x41')](_0x354de0['query'][_0x93a7('0x41')]));_0x5e72ca[_0x93a7('0x42')]=_0x5e72ca[_0x93a7('0x42')][_0x93a7('0x43')]?_0x5e72ca[_0x93a7('0x42')]:_0x53c540[_0x93a7('0x3c')];if(!_0x354de0['query'][_0x93a7('0x44')]('nolimit')){_0x5e72ca[_0x93a7('0x45')]=qs[_0x93a7('0x45')](_0x354de0['query'][_0x93a7('0x45')]);_0x5e72ca[_0x93a7('0x46')]=qs['offset'](_0x354de0['query'][_0x93a7('0x46')]);}_0x5e72ca['order']=qs['sort'](_0x354de0[_0x93a7('0x3d')][_0x93a7('0x47')]);_0x5e72ca['where']=qs['filters'](_[_0x93a7('0x48')](_0x354de0['query'],_0x53c540[_0x93a7('0x3f')]),_0x2cf9e7);if(_0x354de0['query'][_0x93a7('0x49')]){_0x5e72ca[_0x93a7('0x4a')]=_[_0x93a7('0x4b')](_0x5e72ca[_0x93a7('0x4a')],{'$or':_['map'](_0x2cf9e7,function(_0x56db7f){if(_0x56db7f['type']!==_0x93a7('0x4c')){var _0x2c4150={};_0x2c4150[_0x56db7f[_0x93a7('0x33')]]={'$like':'%'+_0x354de0['query'][_0x93a7('0x49')]+'%'};return _0x2c4150;}})});}_0x5e72ca=_[_0x93a7('0x4b')]({},_0x5e72ca,_0x354de0[_0x93a7('0x4d')]);var _0x4e85fc={'where':_0x5e72ca[_0x93a7('0x4a')]};return db[_0x93a7('0x37')]['count'](_0x4e85fc)[_0x93a7('0x20')](function(_0x102e76){_0x7e980d['count']=_0x102e76;if(_0x354de0[_0x93a7('0x3d')][_0x93a7('0x4e')]){_0x5e72ca[_0x93a7('0x4f')]=[{'all':!![]}];}return db[_0x93a7('0x37')]['findAll'](_0x5e72ca);})[_0x93a7('0x20')](function(_0x2de07a){_0x7e980d[_0x93a7('0x50')]=_0x2de07a;return _0x7e980d;})['then'](respondWithFilteredResult(_0x33f8bf,_0x5e72ca))[_0x93a7('0x51')](handleError(_0x33f8bf,null));};exports[_0x93a7('0x52')]=function(_0xc03859,_0x439baf){var _0x3d1e65={'raw':!![],'where':{'id':_0xc03859['params']['id']}},_0x3a8786={};_0x3a8786['model']=_[_0x93a7('0x3e')](db[_0x93a7('0x37')][_0x93a7('0x38')]);_0x3a8786[_0x93a7('0x3d')]=_['keys'](_0xc03859[_0x93a7('0x3d')]);_0x3a8786[_0x93a7('0x3f')]=_[_0x93a7('0x40')](_0x3a8786[_0x93a7('0x3c')],_0x3a8786['query']);_0x3d1e65[_0x93a7('0x42')]=_[_0x93a7('0x40')](_0x3a8786[_0x93a7('0x3c')],qs['fields'](_0xc03859[_0x93a7('0x3d')][_0x93a7('0x41')]));_0x3d1e65['attributes']=_0x3d1e65[_0x93a7('0x42')][_0x93a7('0x43')]?_0x3d1e65[_0x93a7('0x42')]:_0x3a8786[_0x93a7('0x3c')];if(_0xc03859[_0x93a7('0x3d')][_0x93a7('0x4e')]){_0x3d1e65[_0x93a7('0x4f')]=[{'all':!![]}];}_0x3d1e65=_[_0x93a7('0x4b')]({},_0x3d1e65,_0xc03859['options']);return db['OpenchannelMessage'][_0x93a7('0x53')](_0x3d1e65)[_0x93a7('0x20')](handleEntityNotFound(_0x439baf,null))['then'](respondWithResult(_0x439baf,null))[_0x93a7('0x51')](handleError(_0x439baf,null));};exports['create']=function(_0xab1a47,_0x35b19a){return db[_0x93a7('0x37')][_0x93a7('0x54')](_0xab1a47[_0x93a7('0x55')],{})[_0x93a7('0x20')](respondWithResult(_0x35b19a,0xc9))[_0x93a7('0x51')](handleError(_0x35b19a,null));};exports[_0x93a7('0x56')]=function(_0x15905d,_0x5e1c9f){if(_0x15905d[_0x93a7('0x55')]['id']){delete _0x15905d[_0x93a7('0x55')]['id'];}return db[_0x93a7('0x37')][_0x93a7('0x53')]({'where':{'id':_0x15905d[_0x93a7('0x57')]['id']}})[_0x93a7('0x20')](handleEntityNotFound(_0x5e1c9f,null))[_0x93a7('0x20')](saveUpdates(_0x15905d[_0x93a7('0x55')],null))[_0x93a7('0x20')](respondWithResult(_0x5e1c9f,null))[_0x93a7('0x51')](handleError(_0x5e1c9f,null));};exports['destroy']=function(_0x4a5c82,_0x33223f){return db['OpenchannelMessage']['find']({'where':{'id':_0x4a5c82[_0x93a7('0x57')]['id']}})[_0x93a7('0x20')](handleEntityNotFound(_0x33223f,null))[_0x93a7('0x20')](removeEntity(_0x33223f,null))[_0x93a7('0x51')](handleError(_0x33223f,null));};exports[_0x93a7('0x58')]=function(_0x1aa329,_0x2a2335){return db[_0x93a7('0x37')][_0x93a7('0x58')]()[_0x93a7('0x20')](respondWithResult(_0x2a2335,null))[_0x93a7('0x51')](handleError(_0x2a2335,null));};var interaction_log=require(_0x93a7('0x59'))('openchannel-interactions');exports['accept']=function(_0x179aa2,_0x5b60bf,_0x4d7a3f){var _0x558a07={'channel':'openchannel'};if(_0x179aa2['body']['id']){delete _0x179aa2[_0x93a7('0x55')]['id'];}_0x179aa2[_0x93a7('0x55')]['read']=!![];_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5a')]=moment()[_0x93a7('0x5b')](_0x93a7('0x5c'));_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5d')]=_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5d')]||_0x179aa2[_0x93a7('0x5e')]['id'];return db[_0x93a7('0x37')][_0x93a7('0x53')]({'where':{'id':_0x179aa2[_0x93a7('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x93a7('0x5f')],'as':_0x93a7('0x60')}]})[_0x93a7('0x20')](handleEntityNotFound(_0x5b60bf,null))[_0x93a7('0x20')](saveUpdates(_0x179aa2[_0x93a7('0x55')],null))['then'](function(_0x3f2c4b){if(_0x3f2c4b){_0x558a07[_0x93a7('0x29')]=_0x3f2c4b[_0x93a7('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x93a7('0x53')]({'where':{'id':_0x3f2c4b[_0x93a7('0x62')]}});}return null;})[_0x93a7('0x20')](handleEntityNotFound(_0x5b60bf,null))['then'](function(_0x5f3b36){if(_0x5f3b36){return _0x5f3b36[_0x93a7('0x56')]({'UserId':_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5d')],'read1stAt':_[_0x93a7('0x63')](_0x5f3b36[_0x93a7('0x64')])?moment()[_0x93a7('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x856c4a){if(_0x856c4a){_0x558a07[_0x93a7('0x65')]=_0x856c4a[_0x93a7('0x61')]({'plain':!![]});interaction_log[_0x93a7('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x179aa2[_0x93a7('0x5e')]['id'],_0x179aa2[_0x93a7('0x5e')][_0x93a7('0x33')],_0x179aa2['user']['role'],_0x558a07[_0x93a7('0x65')]['id'],_0x179aa2[_0x93a7('0x55')]?JSON[_0x93a7('0x25')](_0x179aa2[_0x93a7('0x55')]):'null');return respondWithRpcPromise(_0x93a7('0x66'),_0x93a7('0x67'),_0x558a07);}return null;})[_0x93a7('0x20')](function(_0x5b4e68){if(_0x5b4e68){if(_0x179aa2['body'][_0x93a7('0x68')]){_0x558a07['message'][_0x93a7('0x69')]=util[_0x93a7('0x5b')]('SIP/%s',_0x179aa2[_0x93a7('0x5e')][_0x93a7('0x33')]);_0x558a07['message'][_0x93a7('0x6a')]=_0x558a07['channel'];_0x558a07[_0x93a7('0x29')][_0x93a7('0x6b')]=_0x93a7('0x6c');return respondWithRpcPromise(_0x93a7('0x6d'),_0x93a7('0x6d'),{'event':'acceptmessage','message':_0x558a07[_0x93a7('0x29')]},client9002)[_0x93a7('0x20')](function(){return _0x558a07;});}return _0x558a07;}return null;})[_0x93a7('0x20')](respondWithResult(_0x5b60bf,null))[_0x93a7('0x51')](handleError(_0x5b60bf,null));};var interaction_log=require(_0x93a7('0x59'))('openchannel-interactions');exports[_0x93a7('0x32')]=function(_0x11e0cb,_0x108dd6,_0xe20c7){var _0x39bd68={'agent':{},'channel':_0x93a7('0x6e')};if(_0x11e0cb['body']['id']){delete _0x11e0cb[_0x93a7('0x55')]['id'];}_0x11e0cb[_0x93a7('0x55')][_0x93a7('0x5d')]=_0x11e0cb[_0x93a7('0x55')][_0x93a7('0x5d')]||_0x11e0cb[_0x93a7('0x5e')]['id'];_0x39bd68[_0x93a7('0x6f')]['id']=_0x11e0cb[_0x93a7('0x55')]['UserId'];return db[_0x93a7('0x37')][_0x93a7('0x53')]({'where':{'id':_0x11e0cb[_0x93a7('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x108dd6,null))[_0x93a7('0x20')](function(_0x312503){if(_0x312503){_0x39bd68[_0x93a7('0x29')]=_0x312503[_0x93a7('0x61')]({'plain':!![]});return db[_0x93a7('0x70')][_0x93a7('0x53')]({'where':{'id':_0x312503[_0x93a7('0x62')]}});}return null;})[_0x93a7('0x20')](handleEntityNotFound(_0x108dd6,null))[_0x93a7('0x20')](function(_0x723926){if(_0x723926){_0x39bd68[_0x93a7('0x65')]=_0x723926['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11e0cb['user']['id'],_0x11e0cb[_0x93a7('0x5e')][_0x93a7('0x33')],_0x11e0cb['user'][_0x93a7('0x71')],_0x39bd68['interaction']['id'],_0x11e0cb[_0x93a7('0x55')]?JSON[_0x93a7('0x25')](_0x11e0cb['body']):_0x93a7('0x72'));return respondWithRpcPromise(_0x93a7('0x73'),_0x93a7('0x74'),_0x39bd68);}return null;})[_0x93a7('0x20')](function(_0xb720bd){if(_0xb720bd){_0xb720bd[_0x93a7('0x29')][_0x93a7('0x69')]=util['format'](_0x93a7('0x75'),_0x11e0cb[_0x93a7('0x5e')][_0x93a7('0x33')]);_0xb720bd[_0x93a7('0x29')][_0x93a7('0x6a')]=_0x39bd68[_0x93a7('0x6a')];_0xb720bd[_0x93a7('0x29')][_0x93a7('0x6b')]=_0x93a7('0x32');respondWithRpcPromise('EventManager',_0x93a7('0x6d'),{'event':'rejectmessage','message':_0xb720bd[_0x93a7('0x29')]},client9002);return _0x39bd68;}return null;})[_0x93a7('0x20')](respondWithResult(_0x108dd6,null))[_0x93a7('0x51')](handleError(_0x108dd6,null));}; \ No newline at end of file +var _0x0472=['rows','show','params','create','body','find','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','manual','interface','format','channel','event','EventManager','acceptmessage','openchannel-interactions','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','rimraf','fast-json-patch','request-promise','moment','bluebird','util','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x0472,0x197));var _0x2047=function(_0x472434,_0x3ac3cd){_0x472434=_0x472434-0x0;var _0xafbd0=_0x0472[_0x472434];return _0xafbd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2047('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2047('0x1'));var rp=require(_0x2047('0x2'));var moment=require(_0x2047('0x3'));var BPromise=require(_0x2047('0x4'));var Mustache=require('mustache');var util=require(_0x2047('0x5'));var path=require('path');var sox=require(_0x2047('0x6'));var csv=require(_0x2047('0x7'));var ejs=require(_0x2047('0x8'));var fs=require('fs');var _=require(_0x2047('0x9'));var squel=require('squel');var crypto=require(_0x2047('0xa'));var jsforce=require(_0x2047('0xb'));var deskjs=require(_0x2047('0xc'));var toCsv=require(_0x2047('0x7'));var querystring=require(_0x2047('0xd'));var Papa=require(_0x2047('0xe'));var Redis=require(_0x2047('0xf'));var authService=require(_0x2047('0x10'));var qs=require(_0x2047('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2047('0x12'));var logger=require(_0x2047('0x13'))('api');var utils=require(_0x2047('0x14'));var config=require(_0x2047('0x15'));var licenseUtil=require(_0x2047('0x16'));var db=require(_0x2047('0x17'))['db'];config[_0x2047('0x18')]=_[_0x2047('0x19')](config[_0x2047('0x18')],{'host':_0x2047('0x1a'),'port':0x18eb});var socket=require(_0x2047('0x1b'))(new Redis(config[_0x2047('0x18')]));require(_0x2047('0x1c'))[_0x2047('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2047('0x1e')][_0x2047('0x1f')]({'port':0x232c});var client9002=jayson[_0x2047('0x1e')][_0x2047('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e3188,_0x5bfe06,_0x1b8dcd,_0x1fbacd){return new BPromise(function(_0x354cb1,_0x20a331){var _0x3e1948=_0x1fbacd||client;return _0x3e1948[_0x2047('0x20')](_0x3e3188,_0x1b8dcd)[_0x2047('0x21')](function(_0x5f3be9){logger['info'](_0x2047('0x22'),_0x5bfe06,_0x2047('0x23'));logger[_0x2047('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5bfe06,_0x2047('0x23'),JSON[_0x2047('0x25')](_0x5f3be9));if(_0x5f3be9['error']){if(_0x5f3be9['error'][_0x2047('0x26')]===0x1f4){logger[_0x2047('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x5bfe06,_0x5f3be9[_0x2047('0x27')][_0x2047('0x28')]);return _0x20a331(_0x5f3be9[_0x2047('0x27')]['message']);}logger['error'](_0x2047('0x22'),_0x5bfe06,_0x5f3be9['error']['message']);return _0x354cb1(_0x5f3be9[_0x2047('0x27')][_0x2047('0x28')]);}else{logger[_0x2047('0x29')](_0x2047('0x22'),_0x5bfe06,_0x2047('0x23'));_0x354cb1(_0x5f3be9['result'][_0x2047('0x28')]);}})[_0x2047('0x2a')](function(_0x40d6df){logger[_0x2047('0x27')](_0x2047('0x22'),_0x5bfe06,_0x40d6df);_0x20a331(_0x40d6df);});});}function respondWithStatusCode(_0x24d33,_0x22f06d){_0x22f06d=_0x22f06d||0xcc;return function(_0x596ea8){if(_0x596ea8){return _0x24d33[_0x2047('0x2b')](_0x22f06d);}return _0x24d33[_0x2047('0x2c')](_0x22f06d)[_0x2047('0x2d')]();};}function respondWithResult(_0x518488,_0x535528){_0x535528=_0x535528||0xc8;return function(_0x4db0c2){if(_0x4db0c2){return _0x518488[_0x2047('0x2c')](_0x535528)[_0x2047('0x2e')](_0x4db0c2);}};}function respondWithFilteredResult(_0x1a90af,_0x2d369c){return function(_0x5e9d85){if(_0x5e9d85){var _0x2859ba=_0x5e9d85[_0x2047('0x2f')],_0x2a3dcb=_0x2d369c[_0x2047('0x30')],_0x5a5eee=_0x2d369c[_0x2047('0x30')]+_0x2d369c[_0x2047('0x31')],_0x1c176f;if(_0x5a5eee>=_0x2859ba){_0x5a5eee=_0x2859ba;_0x1c176f=0xc8;}else{_0x1c176f=0xce;}_0x1a90af[_0x2047('0x2c')](_0x1c176f);return _0x1a90af['set'](_0x2047('0x32'),_0x2a3dcb+'-'+_0x5a5eee+'/'+_0x2859ba)[_0x2047('0x2e')](_0x5e9d85);}return null;};}function patchUpdates(_0x37bfa4){return function(_0x195298){try{jsonpatch[_0x2047('0x33')](_0x195298,_0x37bfa4,!![]);}catch(_0x35a786){return BPromise[_0x2047('0x34')](_0x35a786);}return _0x195298[_0x2047('0x35')]();};}function saveUpdates(_0x37e832,_0x2798ad){return function(_0x468489){if(_0x468489){return _0x468489[_0x2047('0x36')](_0x37e832)[_0x2047('0x21')](function(_0x316922){return _0x316922;});}return null;};}function removeEntity(_0x48c6e6,_0x794dc7){return function(_0x629465){if(_0x629465){return _0x629465[_0x2047('0x37')]()[_0x2047('0x21')](function(){_0x48c6e6[_0x2047('0x2c')](0xcc)[_0x2047('0x2d')]();});}};}function handleEntityNotFound(_0x387869,_0x1bbe59){return function(_0x3ad84b){if(!_0x3ad84b){_0x387869[_0x2047('0x2b')](0x194);}return _0x3ad84b;};}function handleError(_0x23f7ef,_0x30c00b){_0x30c00b=_0x30c00b||0x1f4;return function(_0x447562){logger[_0x2047('0x27')](_0x447562['stack']);if(_0x447562['name']){delete _0x447562[_0x2047('0x38')];}_0x23f7ef[_0x2047('0x2c')](_0x30c00b)[_0x2047('0x39')](_0x447562);};}exports[_0x2047('0x3a')]=function(_0x24568e,_0x51426d){var _0x5db71c={},_0xb4ae91={},_0x13490d={'count':0x0,'rows':[]};var _0x4b7d22=_['map'](db[_0x2047('0x3b')][_0x2047('0x3c')],function(_0x5e3b29){return{'name':_0x5e3b29[_0x2047('0x3d')],'type':_0x5e3b29[_0x2047('0x3e')][_0x2047('0x3f')]};});_0xb4ae91[_0x2047('0x40')]=_[_0x2047('0x41')](_0x4b7d22,_0x2047('0x38'));_0xb4ae91[_0x2047('0x42')]=_[_0x2047('0x43')](_0x24568e['query']);_0xb4ae91[_0x2047('0x44')]=_[_0x2047('0x45')](_0xb4ae91[_0x2047('0x40')],_0xb4ae91['query']);_0x5db71c['attributes']=_[_0x2047('0x45')](_0xb4ae91['model'],qs[_0x2047('0x46')](_0x24568e['query'][_0x2047('0x46')]));_0x5db71c[_0x2047('0x47')]=_0x5db71c[_0x2047('0x47')][_0x2047('0x48')]?_0x5db71c[_0x2047('0x47')]:_0xb4ae91[_0x2047('0x40')];if(!_0x24568e[_0x2047('0x42')][_0x2047('0x49')](_0x2047('0x4a'))){_0x5db71c['limit']=qs[_0x2047('0x31')](_0x24568e[_0x2047('0x42')][_0x2047('0x31')]);_0x5db71c['offset']=qs[_0x2047('0x30')](_0x24568e[_0x2047('0x42')][_0x2047('0x30')]);}_0x5db71c[_0x2047('0x4b')]=qs[_0x2047('0x4c')](_0x24568e[_0x2047('0x42')][_0x2047('0x4c')]);_0x5db71c['where']=qs[_0x2047('0x44')](_[_0x2047('0x4d')](_0x24568e[_0x2047('0x42')],_0xb4ae91[_0x2047('0x44')]),_0x4b7d22);if(_0x24568e[_0x2047('0x42')][_0x2047('0x4e')]){_0x5db71c[_0x2047('0x4f')]=_['merge'](_0x5db71c['where'],{'$or':_['map'](_0x4b7d22,function(_0x1d4d78){if(_0x1d4d78[_0x2047('0x3e')]!==_0x2047('0x50')){var _0xb87d0e={};_0xb87d0e[_0x1d4d78[_0x2047('0x38')]]={'$like':'%'+_0x24568e[_0x2047('0x42')][_0x2047('0x4e')]+'%'};return _0xb87d0e;}})});}_0x5db71c=_[_0x2047('0x51')]({},_0x5db71c,_0x24568e[_0x2047('0x52')]);var _0x1da3eb={'where':_0x5db71c['where']};return db[_0x2047('0x3b')][_0x2047('0x2f')](_0x1da3eb)['then'](function(_0x28e06b){_0x13490d[_0x2047('0x2f')]=_0x28e06b;if(_0x24568e[_0x2047('0x42')]['includeAll']){_0x5db71c[_0x2047('0x53')]=[{'all':!![]}];}return db[_0x2047('0x3b')][_0x2047('0x54')](_0x5db71c);})[_0x2047('0x21')](function(_0x8d9aed){_0x13490d[_0x2047('0x55')]=_0x8d9aed;return _0x13490d;})[_0x2047('0x21')](respondWithFilteredResult(_0x51426d,_0x5db71c))[_0x2047('0x2a')](handleError(_0x51426d,null));};exports[_0x2047('0x56')]=function(_0x1427c6,_0xaed6e7){var _0x2f936f={'raw':!![],'where':{'id':_0x1427c6[_0x2047('0x57')]['id']}},_0x178a91={};_0x178a91[_0x2047('0x40')]=_['keys'](db[_0x2047('0x3b')]['rawAttributes']);_0x178a91[_0x2047('0x42')]=_[_0x2047('0x43')](_0x1427c6[_0x2047('0x42')]);_0x178a91[_0x2047('0x44')]=_[_0x2047('0x45')](_0x178a91['model'],_0x178a91[_0x2047('0x42')]);_0x2f936f[_0x2047('0x47')]=_[_0x2047('0x45')](_0x178a91['model'],qs[_0x2047('0x46')](_0x1427c6[_0x2047('0x42')]['fields']));_0x2f936f['attributes']=_0x2f936f[_0x2047('0x47')]['length']?_0x2f936f['attributes']:_0x178a91[_0x2047('0x40')];if(_0x1427c6[_0x2047('0x42')]['includeAll']){_0x2f936f[_0x2047('0x53')]=[{'all':!![]}];}_0x2f936f=_[_0x2047('0x51')]({},_0x2f936f,_0x1427c6['options']);return db['OpenchannelMessage']['find'](_0x2f936f)['then'](handleEntityNotFound(_0xaed6e7,null))[_0x2047('0x21')](respondWithResult(_0xaed6e7,null))[_0x2047('0x2a')](handleError(_0xaed6e7,null));};exports[_0x2047('0x58')]=function(_0x5eaf1f,_0xaf93a4){return db[_0x2047('0x3b')]['create'](_0x5eaf1f['body'],{})['then'](respondWithResult(_0xaf93a4,0xc9))['catch'](handleError(_0xaf93a4,null));};exports[_0x2047('0x36')]=function(_0x52e000,_0x4fc1f3){if(_0x52e000[_0x2047('0x59')]['id']){delete _0x52e000[_0x2047('0x59')]['id'];}return db[_0x2047('0x3b')][_0x2047('0x5a')]({'where':{'id':_0x52e000[_0x2047('0x57')]['id']}})[_0x2047('0x21')](handleEntityNotFound(_0x4fc1f3,null))['then'](saveUpdates(_0x52e000[_0x2047('0x59')],null))[_0x2047('0x21')](respondWithResult(_0x4fc1f3,null))[_0x2047('0x2a')](handleError(_0x4fc1f3,null));};exports[_0x2047('0x37')]=function(_0x4329ea,_0x152dc6){return db[_0x2047('0x3b')][_0x2047('0x5a')]({'where':{'id':_0x4329ea[_0x2047('0x57')]['id']}})[_0x2047('0x21')](handleEntityNotFound(_0x152dc6,null))[_0x2047('0x21')](removeEntity(_0x152dc6,null))[_0x2047('0x2a')](handleError(_0x152dc6,null));};exports[_0x2047('0x5b')]=function(_0x343ee6,_0x567b8f){return db[_0x2047('0x3b')][_0x2047('0x5b')]()[_0x2047('0x21')](respondWithResult(_0x567b8f,null))[_0x2047('0x2a')](handleError(_0x567b8f,null));};var interaction_log=require(_0x2047('0x13'))('openchannel-interactions');exports[_0x2047('0x5c')]=function(_0x50fb98,_0xf53074,_0x3a593d){var _0x34a041={'channel':_0x2047('0x5d')};if(_0x50fb98[_0x2047('0x59')]['id']){delete _0x50fb98['body']['id'];}_0x50fb98[_0x2047('0x59')][_0x2047('0x5e')]=!![];_0x50fb98['body'][_0x2047('0x5f')]=moment()['format'](_0x2047('0x60'));_0x50fb98[_0x2047('0x59')][_0x2047('0x61')]=_0x50fb98[_0x2047('0x59')][_0x2047('0x61')]||_0x50fb98[_0x2047('0x62')]['id'];return db[_0x2047('0x3b')][_0x2047('0x5a')]({'where':{'id':_0x50fb98[_0x2047('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x2047('0x63')],'as':_0x2047('0x64')}]})['then'](handleEntityNotFound(_0xf53074,null))[_0x2047('0x21')](saveUpdates(_0x50fb98['body'],null))[_0x2047('0x21')](function(_0x5c2f98){if(_0x5c2f98){_0x34a041[_0x2047('0x28')]=_0x5c2f98[_0x2047('0x65')]({'plain':!![]});return db[_0x2047('0x66')][_0x2047('0x5a')]({'where':{'id':_0x5c2f98[_0x2047('0x67')]}});}return null;})['then'](handleEntityNotFound(_0xf53074,null))[_0x2047('0x21')](function(_0x2a9835){if(_0x2a9835){return _0x2a9835[_0x2047('0x36')]({'UserId':_0x50fb98['body'][_0x2047('0x61')],'read1stAt':_[_0x2047('0x68')](_0x2a9835[_0x2047('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1749c8){if(_0x1749c8){_0x34a041['interaction']=_0x1749c8[_0x2047('0x65')]({'plain':!![]});interaction_log[_0x2047('0x29')](_0x2047('0x6a'),_0x50fb98['user']['id'],_0x50fb98[_0x2047('0x62')][_0x2047('0x38')],_0x50fb98['user'][_0x2047('0x6b')],_0x34a041[_0x2047('0x6c')]['id'],_0x50fb98[_0x2047('0x59')]?JSON[_0x2047('0x25')](_0x50fb98[_0x2047('0x59')]):_0x2047('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x2047('0x6e'),_0x34a041);}return null;})['then'](function(_0x28d317){if(_0x28d317){if(_0x50fb98[_0x2047('0x59')][_0x2047('0x6f')]){_0x34a041['message'][_0x2047('0x70')]=util[_0x2047('0x71')]('SIP/%s',_0x50fb98['user'][_0x2047('0x38')]);_0x34a041[_0x2047('0x28')][_0x2047('0x72')]=_0x34a041['channel'];_0x34a041['message'][_0x2047('0x73')]=_0x2047('0x5c');return respondWithRpcPromise(_0x2047('0x74'),'EventManager',{'event':_0x2047('0x75'),'message':_0x34a041[_0x2047('0x28')]},client9002)['then'](function(){return _0x34a041;});}return _0x34a041;}return null;})[_0x2047('0x21')](respondWithResult(_0xf53074,null))['catch'](handleError(_0xf53074,null));};var interaction_log=require(_0x2047('0x13'))(_0x2047('0x76'));exports[_0x2047('0x34')]=function(_0x3b7e53,_0x36a27d,_0x41251d){var _0x3ae92a={'agent':{},'channel':_0x2047('0x5d')};if(_0x3b7e53[_0x2047('0x59')]['id']){delete _0x3b7e53['body']['id'];}_0x3b7e53[_0x2047('0x59')][_0x2047('0x61')]=_0x3b7e53[_0x2047('0x59')][_0x2047('0x61')]||_0x3b7e53[_0x2047('0x62')]['id'];_0x3ae92a[_0x2047('0x77')]['id']=_0x3b7e53[_0x2047('0x59')][_0x2047('0x61')];return db[_0x2047('0x3b')][_0x2047('0x5a')]({'where':{'id':_0x3b7e53[_0x2047('0x57')]['id'],'UserId':null}})[_0x2047('0x21')](handleEntityNotFound(_0x36a27d,null))[_0x2047('0x21')](function(_0x1e7f70){if(_0x1e7f70){_0x3ae92a[_0x2047('0x28')]=_0x1e7f70[_0x2047('0x65')]({'plain':!![]});return db[_0x2047('0x66')][_0x2047('0x5a')]({'where':{'id':_0x1e7f70[_0x2047('0x67')]}});}return null;})[_0x2047('0x21')](handleEntityNotFound(_0x36a27d,null))['then'](function(_0x1cdff6){if(_0x1cdff6){_0x3ae92a[_0x2047('0x6c')]=_0x1cdff6[_0x2047('0x65')]({'plain':!![]});interaction_log['info'](_0x2047('0x78'),_0x3b7e53[_0x2047('0x62')]['id'],_0x3b7e53[_0x2047('0x62')][_0x2047('0x38')],_0x3b7e53[_0x2047('0x62')][_0x2047('0x6b')],_0x3ae92a[_0x2047('0x6c')]['id'],_0x3b7e53[_0x2047('0x59')]?JSON[_0x2047('0x25')](_0x3b7e53[_0x2047('0x59')]):_0x2047('0x6d'));return respondWithRpcPromise(_0x2047('0x79'),'rejectMessage',_0x3ae92a);}return null;})[_0x2047('0x21')](function(_0x48fc13){if(_0x48fc13){_0x48fc13['message'][_0x2047('0x70')]=util['format']('SIP/%s',_0x3b7e53[_0x2047('0x62')][_0x2047('0x38')]);_0x48fc13[_0x2047('0x28')][_0x2047('0x72')]=_0x3ae92a[_0x2047('0x72')];_0x48fc13[_0x2047('0x28')]['event']=_0x2047('0x34');respondWithRpcPromise(_0x2047('0x74'),_0x2047('0x74'),{'event':_0x2047('0x7a'),'message':_0x48fc13[_0x2047('0x28')]},client9002);return _0x3ae92a;}return null;})[_0x2047('0x21')](respondWithResult(_0x36a27d,null))[_0x2047('0x2a')](handleError(_0x36a27d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 67de8f9..44baad1 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 _0x14c3=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x14c3,0x110));var _0x314c=function(_0x13861b,_0x18d6af){_0x13861b=_0x13861b-0x0;var _0x5240dc=_0x14c3[_0x13861b];return _0x5240dc;};'use strict';var EventEmitter=require(_0x314c('0x0'));var OpenchannelMessage=require(_0x314c('0x1'))['db'][_0x314c('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x314c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x41a493){return function(_0x5d82d2,_0x5842e6,_0x480497){OpenchannelMessageEvents[_0x314c('0x4')](_0x41a493+':'+_0x5d82d2['id'],_0x5d82d2);OpenchannelMessageEvents[_0x314c('0x4')](_0x41a493,_0x5d82d2);_0x480497(null);};}for(var e in events){if(events[_0x314c('0x5')](e)){var event=events[e];OpenchannelMessage[_0x314c('0x6')](e,emitEvent(event));}}module[_0x314c('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfc8d=['remove','emit','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc8d,0x72));var _0xdfc8=function(_0x18e3e7,_0x39886c){_0x18e3e7=_0x18e3e7-0x0;var _0x211dee=_0xfc8d[_0x18e3e7];return _0x211dee;};'use strict';var EventEmitter=require(_0xdfc8('0x0'));var OpenchannelMessage=require(_0xdfc8('0x1'))['db'][_0xdfc8('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xdfc8('0x3')](0x0);var events={'afterCreate':_0xdfc8('0x4'),'afterUpdate':_0xdfc8('0x5'),'afterDestroy':_0xdfc8('0x6')};function emitEvent(_0x161ce9){return function(_0x3d8d6e,_0x1a9d48,_0x92d9f8){OpenchannelMessageEvents[_0xdfc8('0x7')](_0x161ce9+':'+_0x3d8d6e['id'],_0x3d8d6e);OpenchannelMessageEvents[_0xdfc8('0x7')](_0x161ce9,_0x3d8d6e);_0x92d9f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 27a36a9..2610eef 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 _0x0093=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelInteraction','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','body','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models'];(function(_0x1a5d07,_0x3dc909){var _0x36ccea=function(_0x539691){while(--_0x539691){_0x1a5d07['push'](_0x1a5d07['shift']());}};_0x36ccea(++_0x3dc909);}(_0x0093,0x164));var _0x3009=function(_0x1db1f2,_0x238fb1){_0x1db1f2=_0x1db1f2-0x0;var _0x530e85=_0x0093[_0x1db1f2];return _0x530e85;};'use strict';var _=require(_0x3009('0x0'));var util=require('util');var logger=require(_0x3009('0x1'))(_0x3009('0x2'));var moment=require('moment');var BPromise=require(_0x3009('0x3'));var rp=require(_0x3009('0x4'));var fs=require('fs');var path=require(_0x3009('0x5'));var rimraf=require(_0x3009('0x6'));var config=require('../../config/environment');var attributes=require(_0x3009('0x7'));module[_0x3009('0x8')]=function(_0xc8b457,_0x48a353){return _0xc8b457[_0x3009('0x9')](_0x3009('0xa'),attributes,{'tableName':_0x3009('0xb'),'paranoid':![],'indexes':[{'name':_0x3009('0xc'),'fields':['body'],'type':_0x3009('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe98efb,_0xeb1c27,_0x4cba25){var _0x2c1784=_0xc8b457[_0x3009('0xe')];var _0x204a29=_0xe98efb[_0x3009('0xf')]({'plain':!![]});if(_0x204a29[_0x3009('0x10')][_0x3009('0x11')]()==='in'||_0x204a29['direction'][_0x3009('0x11')]()===_0x3009('0x12')&&!_0x204a29[_0x3009('0x13')]&&!_[_0x3009('0x14')](_0x204a29[_0x3009('0x15')])){_0x2c1784['OpenchannelInteraction'][_0x3009('0x16')]({'where':{'id':_0x204a29[_0x3009('0x17')]}})['then'](function(_0x22fcfa){if(_0x22fcfa){_0x22fcfa[_0x3009('0x18')]({'lastMsgAt':_0x204a29[_0x3009('0x19')],'lastMsgDirection':_0x204a29[_0x3009('0x10')][_0x3009('0x11')]()});}})['catch'](function(_0x289eb3){console[_0x3009('0x1a')](_0x289eb3);});}if(_0x204a29[_0x3009('0x10')]===_0x3009('0x12')&&!_0x204a29[_0x3009('0x13')]){var _0x25ba34;_0x2c1784[_0x3009('0x1b')][_0x3009('0x1c')]()[_0x3009('0x1d')](function(_0x103ba7){return _0x2c1784[_0x3009('0x1e')][_0x3009('0x1f')]({'where':{'id':_0x204a29['OpenchannelAccountId']},'include':[{'model':_0x2c1784[_0x3009('0x20')],'as':_0x3009('0x21'),'where':{'id':_0x204a29[_0x3009('0x17')]},'limit':0x1,'include':[{'model':_0x2c1784[_0x3009('0x1b')],'as':_0x3009('0x22'),'attributes':_[_0x3009('0x23')](_0x103ba7)}]}]});})[_0x3009('0x1d')](function(_0x2ac547){_0x25ba34=_0x2ac547[_0x3009('0xf')]({'plain':!![]});if(_0x25ba34&&_0x25ba34['replyUri']){logger[_0x3009('0x24')](_0x3009('0x25'),'afterCreate',util['format'](_0x3009('0x26'),_0x204a29['id'],_0x25ba34[_0x3009('0x27')]));if(_0x25ba34[_0x3009('0x21')]&&_0x25ba34[_0x3009('0x21')][_0x3009('0x28')]){_0x204a29[_0x3009('0x29')]=_[_0x3009('0x2a')](_0x25ba34['Interactions'][0x0],_0x3009('0x22'));_0x204a29['Contact']=_0x25ba34['Interactions'][0x0]['Contact'];}var _0xeb1c27={'method':_0x3009('0x2b'),'uri':encodeURI(_0x25ba34[_0x3009('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xeb1c27[_0x3009('0x2c')]){case _0x3009('0x2d'):_0xeb1c27['qs']=_0x204a29;break;case'POST':_0xeb1c27[_0x3009('0x2e')]=_0x204a29;break;}return rp(_0xeb1c27)[_0x3009('0x1d')](function(_0x1b46cd){logger[_0x3009('0x24')](_0x3009('0x25'),_0x3009('0x2f'),util['format'](_0x3009('0x30'),_0x204a29['id'],_0x25ba34[_0x3009('0x27')]));if(_0x1b46cd[_0x3009('0x2e')]['threadId']&&_0x1b46cd[_0x3009('0x2e')][_0x3009('0x31')]!=_0x204a29[_0x3009('0x29')][_0x3009('0x31')]){return _0x2c1784[_0x3009('0x20')][_0x3009('0x18')]({'threadId':_0x1b46cd[_0x3009('0x2e')][_0x3009('0x31')]},{'logging':!![],'where':{'id':_0x204a29['Interaction']['id']}});}else{return;}})[_0x3009('0x1d')](function(){return _0xe98efb['update']({'read':!![]});})['catch'](function(_0x56346a){logger['error'](_0x3009('0x25'),_0x3009('0x2f'),util[_0x3009('0x32')](_0x56346a,{'showHidden':![],'depth':null}));_0x4cba25();});}else{_0x4cba25();}})['finally'](function(){_0x4cba25();});}else{_0x4cba25();}}},'charset':_0x3009('0x33'),'collate':_0x3009('0x34')});}; \ No newline at end of file +var _0xf401=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fti_openchannel_messages','body','FULLTEXT','direction','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','toLowerCase','catch','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Interaction','omit','POST','method','GET','then','replyUri','threadId','update','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x574b7f,_0x5a758e){var _0x3da1af=function(_0x4b382e){while(--_0x4b382e){_0x574b7f['push'](_0x574b7f['shift']());}};_0x3da1af(++_0x5a758e);}(_0xf401,0xe8));var _0x1f40=function(_0x564652,_0x3e9603){_0x564652=_0x564652-0x0;var _0x1e8b4e=_0xf401[_0x564652];return _0x1e8b4e;};'use strict';var _=require(_0x1f40('0x0'));var util=require(_0x1f40('0x1'));var logger=require(_0x1f40('0x2'))(_0x1f40('0x3'));var moment=require(_0x1f40('0x4'));var BPromise=require(_0x1f40('0x5'));var rp=require(_0x1f40('0x6'));var fs=require('fs');var path=require(_0x1f40('0x7'));var rimraf=require(_0x1f40('0x8'));var config=require(_0x1f40('0x9'));var attributes=require('./openchannelMessage.attributes');module[_0x1f40('0xa')]=function(_0x2b6e95,_0x36c07e){return _0x2b6e95[_0x1f40('0xb')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x1f40('0xc'),'fields':[_0x1f40('0xd')],'type':_0x1f40('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x172ded,_0x5aa3f0,_0x1fb827){var _0x3ecff8=_0x2b6e95['models'];var _0x421a90=_0x172ded['get']({'plain':!![]});if(_0x421a90[_0x1f40('0xf')]['toLowerCase']()==='in'||_0x421a90['direction']['toLowerCase']()==='out'&&!_0x421a90[_0x1f40('0x10')]&&!_['isNil'](_0x421a90[_0x1f40('0x11')])){_0x3ecff8[_0x1f40('0x12')][_0x1f40('0x13')]({'where':{'id':_0x421a90[_0x1f40('0x14')]}})['then'](function(_0x32dee2){if(_0x32dee2){_0x32dee2['update']({'lastMsgAt':_0x421a90[_0x1f40('0x15')],'lastMsgDirection':_0x421a90[_0x1f40('0xf')][_0x1f40('0x16')]()});}})[_0x1f40('0x17')](function(_0x4f7e4a){console['error'](_0x4f7e4a);});}if(_0x421a90[_0x1f40('0xf')]==='out'&&!_0x421a90[_0x1f40('0x10')]){var _0x46f76d;_0x3ecff8[_0x1f40('0x18')][_0x1f40('0x19')]()['then'](function(_0x1ee8a8){return _0x3ecff8[_0x1f40('0x1a')][_0x1f40('0x1b')]({'where':{'id':_0x421a90['OpenchannelAccountId']},'include':[{'model':_0x3ecff8[_0x1f40('0x12')],'as':_0x1f40('0x1c'),'where':{'id':_0x421a90['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3ecff8[_0x1f40('0x18')],'as':_0x1f40('0x1d'),'attributes':_[_0x1f40('0x1e')](_0x1ee8a8)}]}]});})['then'](function(_0x66cd64){_0x46f76d=_0x66cd64['get']({'plain':!![]});if(_0x46f76d&&_0x46f76d['replyUri']){logger[_0x1f40('0x1f')](_0x1f40('0x20'),_0x1f40('0x21'),util[_0x1f40('0x22')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x421a90['id'],_0x46f76d['replyUri']));if(_0x46f76d[_0x1f40('0x1c')]&&_0x46f76d[_0x1f40('0x1c')]['length']){_0x421a90[_0x1f40('0x23')]=_[_0x1f40('0x24')](_0x46f76d[_0x1f40('0x1c')][0x0],_0x1f40('0x1d'));_0x421a90['Contact']=_0x46f76d[_0x1f40('0x1c')][0x0][_0x1f40('0x1d')];}var _0x5aa3f0={'method':_0x1f40('0x25'),'uri':encodeURI(_0x46f76d['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5aa3f0[_0x1f40('0x26')]){case _0x1f40('0x27'):_0x5aa3f0['qs']=_0x421a90;break;case _0x1f40('0x25'):_0x5aa3f0['body']=_0x421a90;break;}return rp(_0x5aa3f0)[_0x1f40('0x28')](function(_0x124e80){logger['info'](_0x1f40('0x20'),_0x1f40('0x21'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x421a90['id'],_0x46f76d[_0x1f40('0x29')]));if(_0x124e80['body'][_0x1f40('0x2a')]&&_0x124e80[_0x1f40('0xd')]['threadId']!=_0x421a90[_0x1f40('0x23')][_0x1f40('0x2a')]){return _0x3ecff8['OpenchannelInteraction']['update']({'threadId':_0x124e80[_0x1f40('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x421a90['Interaction']['id']}});}else{return;}})[_0x1f40('0x28')](function(){return _0x172ded[_0x1f40('0x2b')]({'read':!![]});})['catch'](function(_0x1254e3){logger['error'](_0x1f40('0x20'),'afterCreate',util['inspect'](_0x1254e3,{'showHidden':![],'depth':null}));_0x1fb827();});}else{_0x1fb827();}})[_0x1f40('0x2c')](function(){_0x1fb827();});}else{_0x1fb827();}}},'charset':_0x1f40('0x2d'),'collate':_0x1f40('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 452732d..4876500 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(_0x18175b,_0x4d7376){var _0x210d45=function(_0x24f924){while(--_0x24f924){_0x18175b['push'](_0x18175b['shift']());}};_0x210d45(++_0x4d7376);}(_0xb10b,0x12a));var _0xbb10=function(_0x35c97a,_0x513aba){_0x35c97a=_0x35c97a-0x0;var _0x388917=_0xb10b[_0x35c97a];return _0x388917;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x58a9fb,_0x3ba1a5){var _0x49ddcd=function(_0x4b8f78){while(--_0x4b8f78){_0x58a9fb['push'](_0x58a9fb['shift']());}};_0x49ddcd(++_0x3ba1a5);}(_0xb10b,0x12a));var _0xbb10=function(_0x91e24e,_0x2eddb3){_0x91e24e=_0x91e24e-0x0;var _0x642ebd=_0xb10b[_0x91e24e];return _0x642ebd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index db958b1..c74f8e6 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_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 +var _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2b56ad,_0x501f49){_0x2b56ad=_0x2b56ad-0x0;var _0x415a31=_0x9bde[_0x2b56ad];return _0x415a31;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 40b71a2..ea82b10 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 _0xc627=['getAgents','post','create','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x478fd2,_0x47e6eb){var _0x313061=function(_0x271a9f){while(--_0x271a9f){_0x478fd2['push'](_0x478fd2['shift']());}};_0x313061(++_0x47e6eb);}(_0xc627,0x14a));var _0x7c62=function(_0x330c31,_0x5e016b){_0x330c31=_0x330c31-0x0;var _0x4b655c=_0xc627[_0x330c31];return _0x4b655c;};'use strict';var multer=require('multer');var util=require(_0x7c62('0x0'));var path=require(_0x7c62('0x1'));var timeout=require(_0x7c62('0x2'));var express=require('express');var router=express[_0x7c62('0x3')]();var auth=require(_0x7c62('0x4'));var interaction=require(_0x7c62('0x5'));var config=require(_0x7c62('0x6'));var controller=require(_0x7c62('0x7'));router[_0x7c62('0x8')]('/',auth[_0x7c62('0x9')](),controller[_0x7c62('0xa')]);router[_0x7c62('0x8')](_0x7c62('0xb'),auth[_0x7c62('0x9')](),controller[_0x7c62('0xc')]);router['get']('/:id',auth[_0x7c62('0x9')](),controller[_0x7c62('0xd')]);router[_0x7c62('0x8')](_0x7c62('0xe'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x7c62('0xf'),auth['isAuthenticated'](),controller[_0x7c62('0x10')]);router[_0x7c62('0x8')](_0x7c62('0x11'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x12')]);router[_0x7c62('0x13')]('/',auth[_0x7c62('0x9')](),controller[_0x7c62('0x14')]);router[_0x7c62('0x13')](_0x7c62('0xf'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x15')]);router[_0x7c62('0x13')](_0x7c62('0x11'),auth[_0x7c62('0x9')](),controller['addAgents']);router[_0x7c62('0x16')]('/:id',auth[_0x7c62('0x9')](),controller['update']);router[_0x7c62('0x17')](_0x7c62('0x18'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x19')]);router[_0x7c62('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7c62('0x1a')]);router['delete'](_0x7c62('0x11'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x1b')]);module[_0x7c62('0x1c')]=router; \ No newline at end of file +var _0x6b8f=['addAgents','/:id','update','delete','removeTeams','removeAgents','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams'];(function(_0x42d645,_0x61c13f){var _0x448a1=function(_0x285d12){while(--_0x285d12){_0x42d645['push'](_0x42d645['shift']());}};_0x448a1(++_0x61c13f);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x117072,_0x3f1e1a){_0x117072=_0x117072-0x0;var _0x5c7e7e=_0x6b8f[_0x117072];return _0x5c7e7e;};'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['get']('/:id',auth[_0xf6b8('0x6')](),controller['show']);router[_0xf6b8('0x5')](_0xf6b8('0x9'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xa')]);router[_0xf6b8('0x5')](_0xf6b8('0xb'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xf6b8('0xc'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf6b8('0xe')](_0xf6b8('0xb'),auth['isAuthenticated'](),controller[_0xf6b8('0xf')]);router[_0xf6b8('0xe')](_0xf6b8('0xc'),auth['isAuthenticated'](),controller[_0xf6b8('0x10')]);router['put'](_0xf6b8('0x11'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x12')]);router[_0xf6b8('0x13')](_0xf6b8('0x11'),auth['isAuthenticated'](),controller['destroy']);router[_0xf6b8('0x13')]('/:id/teams',auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x14')]);router['delete']('/:id/users',auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x15')]);module[_0xf6b8('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ecceb53..d559e3b 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 _0x675f=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x1108a7,_0x4ac899){var _0x2dfa9d=function(_0x23289c){while(--_0x23289c){_0x1108a7['push'](_0x1108a7['shift']());}};_0x2dfa9d(++_0x4ac899);}(_0x675f,0x149));var _0xf675=function(_0x4d6b47,_0x42eff4){_0x4d6b47=_0x4d6b47-0x0;var _0x592951=_0x675f[_0x4d6b47];return _0x592951;};'use strict';var Sequelize=require(_0xf675('0x0'));module[_0xf675('0x1')]={'name':{'type':Sequelize[_0xf675('0x2')],'unique':_0xf675('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf675('0x2')]},'timeout':{'type':Sequelize[_0xf675('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf675('0x5')](_0xf675('0x6'),_0xf675('0x7'),_0xf675('0x8'))}}; \ No newline at end of file +var _0x66b8=['roundrobin','sequelize','STRING','name','ENUM','rrmemory'];(function(_0xd6904f,_0x3fdc48){var _0x2129c4=function(_0x81aa9a){while(--_0x81aa9a){_0xd6904f['push'](_0xd6904f['shift']());}};_0x2129c4(++_0x3fdc48);}(_0x66b8,0x8b));var _0x866b=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x66b8[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x866b('0x0'));module['exports']={'name':{'type':Sequelize[_0x866b('0x1')],'unique':_0x866b('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[_0x866b('0x3')](_0x866b('0x4'),'beepall',_0x866b('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ec79e66..b9a0047 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 _0x4b77=['Team','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','User','field','tq.TeamId','from','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams'];(function(_0x44aa1b,_0x5a2a44){var _0x4dd483=function(_0xc46d11){while(--_0xc46d11){_0x44aa1b['push'](_0x44aa1b['shift']());}};_0x4dd483(++_0x5a2a44);}(_0x4b77,0x13a));var _0x74b7=function(_0x3b6a1e,_0x1395f0){_0x3b6a1e=_0x3b6a1e-0x0;var _0x2010c5=_0x4b77[_0x3b6a1e];return _0x2010c5;};'use strict';var pdf=require(_0x74b7('0x0'));var emlformat=require(_0x74b7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74b7('0x2'));var rp=require(_0x74b7('0x3'));var moment=require(_0x74b7('0x4'));var BPromise=require(_0x74b7('0x5'));var Mustache=require(_0x74b7('0x6'));var util=require(_0x74b7('0x7'));var path=require(_0x74b7('0x8'));var sox=require(_0x74b7('0x9'));var csv=require(_0x74b7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x74b7('0xb'));var crypto=require(_0x74b7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x74b7('0xd'));var Papa=require(_0x74b7('0xe'));var Redis=require(_0x74b7('0xf'));var authService=require(_0x74b7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x74b7('0x11'));var hardwareService=require(_0x74b7('0x12'));var logger=require(_0x74b7('0x13'))(_0x74b7('0x14'));var utils=require('../../config/utils');var config=require(_0x74b7('0x15'));var licenseUtil=require(_0x74b7('0x16'));var db=require(_0x74b7('0x17'))['db'];config[_0x74b7('0x18')]=_[_0x74b7('0x19')](config[_0x74b7('0x18')],{'host':_0x74b7('0x1a'),'port':0x18eb});var socket=require(_0x74b7('0x1b'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x74b7('0x1c')](socket);function respondWithStatusCode(_0x12d5ae,_0x18eb26){_0x18eb26=_0x18eb26||0xcc;return function(_0x295379){if(_0x295379){return _0x12d5ae[_0x74b7('0x1d')](_0x18eb26);}return _0x12d5ae[_0x74b7('0x1e')](_0x18eb26)['end']();};}function respondWithResult(_0xf6577d,_0x3c6680){_0x3c6680=_0x3c6680||0xc8;return function(_0x1cf4dd){if(_0x1cf4dd){return _0xf6577d[_0x74b7('0x1e')](_0x3c6680)[_0x74b7('0x1f')](_0x1cf4dd);}};}function respondWithFilteredResult(_0xf09e33,_0x338ef4){return function(_0x5402d4){if(_0x5402d4){var _0x5b32a9=_0x5402d4[_0x74b7('0x20')],_0x45908a=_0x338ef4[_0x74b7('0x21')],_0x4dd8f1=_0x338ef4[_0x74b7('0x21')]+_0x338ef4[_0x74b7('0x22')],_0x543f36;if(_0x4dd8f1>=_0x5b32a9){_0x4dd8f1=_0x5b32a9;_0x543f36=0xc8;}else{_0x543f36=0xce;}_0xf09e33[_0x74b7('0x1e')](_0x543f36);return _0xf09e33['set'](_0x74b7('0x23'),_0x45908a+'-'+_0x4dd8f1+'/'+_0x5b32a9)[_0x74b7('0x1f')](_0x5402d4);}return null;};}function patchUpdates(_0xb27f9a){return function(_0x3616e2){try{jsonpatch[_0x74b7('0x24')](_0x3616e2,_0xb27f9a,!![]);}catch(_0x5e0cd8){return BPromise[_0x74b7('0x25')](_0x5e0cd8);}return _0x3616e2['save']();};}function saveUpdates(_0x11a062,_0x501770){return function(_0x151db6){if(_0x151db6){return _0x151db6[_0x74b7('0x26')](_0x11a062)[_0x74b7('0x27')](function(_0x2157ef){return _0x2157ef;});}return null;};}function removeEntity(_0x2d189b,_0x489a2c){return function(_0x5b8588){if(_0x5b8588){return _0x5b8588['destroy']()['then'](function(){var _0x58aeec=_0x5b8588[_0x74b7('0x28')]({'plain':!![]});var _0x29c24d=_0x74b7('0x29');return db[_0x74b7('0x2a')][_0x74b7('0x2b')]({'where':{'type':_0x29c24d,'resourceId':_0x58aeec['id']}})['then'](function(){return _0x5b8588;});})['then'](function(){_0x2d189b['status'](0xcc)[_0x74b7('0x2c')]();});}};}function handleEntityNotFound(_0x9c081b,_0x358bf3){return function(_0xf27b45){if(!_0xf27b45){_0x9c081b[_0x74b7('0x1d')](0x194);}return _0xf27b45;};}function handleError(_0x3b9dd5,_0x290c90){_0x290c90=_0x290c90||0x1f4;return function(_0x12338f){logger[_0x74b7('0x2d')](_0x12338f[_0x74b7('0x2e')]);if(_0x12338f[_0x74b7('0x2f')]){delete _0x12338f[_0x74b7('0x2f')];}_0x3b9dd5[_0x74b7('0x1e')](_0x290c90)['send'](_0x12338f);};}exports['index']=function(_0x3e65ba,_0x4a1b51){var _0x464086={},_0x2ad790={},_0x1bda6e={'count':0x0,'rows':[]};var _0x3efa01=_[_0x74b7('0x30')](db[_0x74b7('0x31')][_0x74b7('0x32')],function(_0x429ac7){return{'name':_0x429ac7[_0x74b7('0x33')],'type':_0x429ac7[_0x74b7('0x34')]['key']};});_0x2ad790[_0x74b7('0x35')]=_[_0x74b7('0x30')](_0x3efa01,_0x74b7('0x2f'));_0x2ad790['query']=_[_0x74b7('0x36')](_0x3e65ba['query']);_0x2ad790[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x2ad790[_0x74b7('0x35')],_0x2ad790[_0x74b7('0x39')]);_0x464086['attributes']=_['intersection'](_0x2ad790['model'],qs[_0x74b7('0x3a')](_0x3e65ba['query'][_0x74b7('0x3a')]));_0x464086[_0x74b7('0x3b')]=_0x464086[_0x74b7('0x3b')][_0x74b7('0x3c')]?_0x464086[_0x74b7('0x3b')]:_0x2ad790[_0x74b7('0x35')];if(!_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x464086[_0x74b7('0x22')]=qs[_0x74b7('0x22')](_0x3e65ba[_0x74b7('0x39')]['limit']);_0x464086['offset']=qs[_0x74b7('0x21')](_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x21')]);}_0x464086[_0x74b7('0x3f')]=qs[_0x74b7('0x40')](_0x3e65ba['query']['sort']);_0x464086['where']=qs['filters'](_[_0x74b7('0x41')](_0x3e65ba['query'],_0x2ad790['filters']),_0x3efa01);if(_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x42')]){_0x464086[_0x74b7('0x43')]=_[_0x74b7('0x44')](_0x464086['where'],{'$or':_[_0x74b7('0x30')](_0x3efa01,function(_0x2fb195){if(_0x2fb195[_0x74b7('0x34')]!==_0x74b7('0x45')){var _0x5f02b8={};_0x5f02b8[_0x2fb195[_0x74b7('0x2f')]]={'$like':'%'+_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x42')]+'%'};return _0x5f02b8;}})});}_0x464086=_[_0x74b7('0x44')]({},_0x464086,_0x3e65ba[_0x74b7('0x46')]);var _0x13f68b={'where':_0x464086['where']};return db['OpenchannelQueue'][_0x74b7('0x20')](_0x13f68b)[_0x74b7('0x27')](function(_0xf247ee){_0x1bda6e[_0x74b7('0x20')]=_0xf247ee;if(_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x47')]){_0x464086[_0x74b7('0x48')]=[{'all':!![]}];}return db[_0x74b7('0x31')][_0x74b7('0x49')](_0x464086);})[_0x74b7('0x27')](function(_0x2fb9eb){_0x1bda6e[_0x74b7('0x4a')]=_0x2fb9eb;return _0x1bda6e;})['then'](respondWithFilteredResult(_0x4a1b51,_0x464086))[_0x74b7('0x4b')](handleError(_0x4a1b51,null));};exports['show']=function(_0x46b419,_0x1a4969){var _0x4e27e5={'raw':!![],'where':{'id':_0x46b419[_0x74b7('0x4c')]['id']}},_0x9db739={};_0x9db739[_0x74b7('0x35')]=_['keys'](db[_0x74b7('0x31')]['rawAttributes']);_0x9db739[_0x74b7('0x39')]=_[_0x74b7('0x36')](_0x46b419['query']);_0x9db739[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x9db739[_0x74b7('0x35')],_0x9db739[_0x74b7('0x39')]);_0x4e27e5[_0x74b7('0x3b')]=_[_0x74b7('0x38')](_0x9db739[_0x74b7('0x35')],qs['fields'](_0x46b419['query'][_0x74b7('0x3a')]));_0x4e27e5[_0x74b7('0x3b')]=_0x4e27e5['attributes'][_0x74b7('0x3c')]?_0x4e27e5['attributes']:_0x9db739['model'];if(_0x46b419[_0x74b7('0x39')]['includeAll']){_0x4e27e5[_0x74b7('0x48')]=[{'all':!![]}];}_0x4e27e5=_[_0x74b7('0x44')]({},_0x4e27e5,_0x46b419[_0x74b7('0x46')]);return db['OpenchannelQueue'][_0x74b7('0x4d')](_0x4e27e5)[_0x74b7('0x27')](handleEntityNotFound(_0x1a4969,null))['then'](respondWithResult(_0x1a4969,null))[_0x74b7('0x4b')](handleError(_0x1a4969,null));};exports[_0x74b7('0x4e')]=function(_0x33dea4,_0x5e7aab){return db['OpenchannelQueue'][_0x74b7('0x4e')](_0x33dea4[_0x74b7('0x4f')],{})[_0x74b7('0x27')](function(_0x2085fd){var _0x1185fe=_0x33dea4[_0x74b7('0x50')][_0x74b7('0x28')]({'plain':!![]});if(!_0x1185fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1185fe[_0x74b7('0x51')]==='user'){var _0x582262=_0x2085fd[_0x74b7('0x28')]({'plain':!![]});var _0x2b1c80=_0x74b7('0x29');return db[_0x74b7('0x52')]['find']({'where':{'name':_0x2b1c80,'userProfileId':_0x1185fe[_0x74b7('0x53')]},'raw':!![]})[_0x74b7('0x27')](function(_0x1e928f){if(_0x1e928f&&_0x1e928f[_0x74b7('0x54')]===0x0){return db[_0x74b7('0x2a')][_0x74b7('0x4e')]({'name':_0x582262[_0x74b7('0x2f')],'resourceId':_0x582262['id'],'type':_0x1e928f['name'],'sectionId':_0x1e928f['id']},{})['then'](function(){return _0x2085fd;});}else{return _0x2085fd;}})['catch'](function(_0x569f07){logger['error'](_0x74b7('0x55'),_0x569f07);throw _0x569f07;});}return _0x2085fd;})['then'](respondWithResult(_0x5e7aab,0xc9))['catch'](handleError(_0x5e7aab,null));};exports[_0x74b7('0x26')]=function(_0x538d4b,_0x167f92){if(_0x538d4b[_0x74b7('0x4f')]['id']){delete _0x538d4b[_0x74b7('0x4f')]['id'];}return db[_0x74b7('0x31')][_0x74b7('0x4d')]({'where':{'id':_0x538d4b[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x167f92,null))[_0x74b7('0x27')](saveUpdates(_0x538d4b['body'],null))[_0x74b7('0x27')](respondWithResult(_0x167f92,null))[_0x74b7('0x4b')](handleError(_0x167f92,null));};exports[_0x74b7('0x2b')]=function(_0x1745e3,_0x116743){return db['OpenchannelQueue'][_0x74b7('0x4d')]({'where':{'id':_0x1745e3['params']['id']}})['then'](handleEntityNotFound(_0x116743,null))[_0x74b7('0x27')](removeEntity(_0x116743,null))[_0x74b7('0x4b')](handleError(_0x116743,null));};exports[_0x74b7('0x56')]=function(_0x3e9ac7,_0xace57a){return db['OpenchannelQueue'][_0x74b7('0x56')]()[_0x74b7('0x27')](respondWithResult(_0xace57a,null))['catch'](handleError(_0xace57a,null));};exports[_0x74b7('0x57')]=function(_0x2d5071,_0x52546c,_0x1f711b){var _0x5668da={'raw':!![],'where':{}},_0x28a2e3={},_0x5a6df1;return db[_0x74b7('0x31')]['findOne']({'where':{'id':_0x2d5071[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x52546c,null))[_0x74b7('0x27')](function(_0x1d4f7c){if(_0x1d4f7c){_0x5a6df1=_0x1d4f7c[_0x74b7('0x28')]({'plain':!![]});_0x28a2e3[_0x74b7('0x35')]=_['keys'](db[_0x74b7('0x58')]['rawAttributes']);_0x28a2e3[_0x74b7('0x39')]=_[_0x74b7('0x36')](_0x2d5071[_0x74b7('0x39')]);_0x28a2e3[_0x74b7('0x37')]=_['intersection'](_0x28a2e3[_0x74b7('0x35')],_0x28a2e3[_0x74b7('0x39')]);_0x5668da['attributes']=_[_0x74b7('0x38')](_0x28a2e3[_0x74b7('0x35')],qs[_0x74b7('0x3a')](_0x2d5071['query']['fields']));_0x5668da[_0x74b7('0x3b')]=_0x5668da[_0x74b7('0x3b')][_0x74b7('0x3c')]?_0x5668da[_0x74b7('0x3b')]:_0x28a2e3['model'];if(!_0x2d5071[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x5668da[_0x74b7('0x22')]=qs[_0x74b7('0x22')](_0x2d5071[_0x74b7('0x39')]['limit']);_0x5668da['offset']=qs['offset'](_0x2d5071['query'][_0x74b7('0x21')]);}_0x5668da[_0x74b7('0x3f')]=qs[_0x74b7('0x40')](_0x2d5071['query']['sort']);_0x5668da[_0x74b7('0x43')]=qs[_0x74b7('0x37')](_[_0x74b7('0x41')](_0x2d5071['query'],_0x28a2e3[_0x74b7('0x37')]));_0x5668da[_0x74b7('0x43')][_0x74b7('0x59')]=_0x1d4f7c['id'];if(_0x2d5071[_0x74b7('0x39')]['filter']){_0x5668da[_0x74b7('0x43')]=_[_0x74b7('0x44')](_0x5668da['where'],{'$or':_[_0x74b7('0x30')](_0x5668da[_0x74b7('0x3b')],function(_0x52ef55){var _0x3f6b82={};_0x3f6b82[_0x52ef55]={'$like':'%'+_0x2d5071[_0x74b7('0x39')][_0x74b7('0x42')]+'%'};return _0x3f6b82;})});}_0x5668da=_[_0x74b7('0x44')]({},_0x5668da,_0x2d5071['options']);return db['UserOpenchannelQueue'][_0x74b7('0x49')](_0x5668da);}})['then'](function(_0x4ce464){if(_0x4ce464){return db['User'][_0x74b7('0x5a')]({'where':{'id':_[_0x74b7('0x30')](_0x4ce464,_0x74b7('0x5b')),'role':_0x74b7('0x5c')},'attributes':['id',_0x74b7('0x2f'),_0x74b7('0x5d'),_0x74b7('0x5e'),_0x74b7('0x5f')]});}})['then'](function(_0x18c3e8){if(_0x18c3e8){return{'count':_0x18c3e8['count'],'rows':_[_0x74b7('0x30')](_0x18c3e8['rows'],function(_0x523936){return{'membername':_0x523936[_0x74b7('0x2f')],'UserId':_0x523936['id'],'queue_name':_0x5a6df1['name'],'OpenchannelQueueId':_0x5a6df1['id'],'interface':util[_0x74b7('0x60')](_0x74b7('0x61'),_0x74b7('0x62'),_0x523936['name']),'penalty':0x0,'paused':_0x523936[_0x74b7('0x5d')],'createdAt':_0x523936[_0x74b7('0x5f')],'updatedAt':_0x523936[_0x74b7('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x74b7('0x27')](respondWithFilteredResult(_0x52546c,_0x5668da))['catch'](handleError(_0x52546c,null));};exports[_0x74b7('0x63')]=function(_0x3fbee4,_0x4dfd4e,_0x4b78a1){var _0x239d1f={};var _0x5339de={};var _0xaa4565;var _0x360540;return db[_0x74b7('0x31')]['findOne']({'where':{'id':_0x3fbee4[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x4dfd4e,null))[_0x74b7('0x27')](function(_0x39afac){if(_0x39afac){_0xaa4565=_0x39afac;_0x5339de['model']=_[_0x74b7('0x36')](db[_0x74b7('0x64')][_0x74b7('0x32')]);_0x5339de[_0x74b7('0x39')]=_[_0x74b7('0x36')](_0x3fbee4[_0x74b7('0x39')]);_0x5339de[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x5339de[_0x74b7('0x35')],_0x5339de[_0x74b7('0x39')]);_0x239d1f[_0x74b7('0x3b')]=_['intersection'](_0x5339de[_0x74b7('0x35')],qs[_0x74b7('0x3a')](_0x3fbee4[_0x74b7('0x39')]['fields']));_0x239d1f[_0x74b7('0x3b')]=_0x239d1f['attributes'][_0x74b7('0x3c')]?_0x239d1f[_0x74b7('0x3b')]:_0x5339de[_0x74b7('0x35')];_0x239d1f[_0x74b7('0x3f')]=qs['sort'](_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x40')]);_0x239d1f[_0x74b7('0x43')]=qs[_0x74b7('0x37')](_[_0x74b7('0x41')](_0x3fbee4[_0x74b7('0x39')],_0x5339de[_0x74b7('0x37')]));if(_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x42')]){_0x239d1f['where']=_[_0x74b7('0x44')](_0x239d1f[_0x74b7('0x43')],{'$or':_[_0x74b7('0x30')](_0x239d1f['attributes'],function(_0x59439f){var _0x70f9e5={};_0x70f9e5[_0x59439f]={'$like':'%'+_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x42')]+'%'};return _0x70f9e5;})});}_0x239d1f=_[_0x74b7('0x44')]({},_0x239d1f,_0x3fbee4[_0x74b7('0x46')]);return _0xaa4565[_0x74b7('0x63')](_0x239d1f);}})['then'](function(_0x79d293){if(_0x79d293){_0x360540=_0x79d293['length'];if(!_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x239d1f['limit']=qs[_0x74b7('0x22')](_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x22')]);_0x239d1f[_0x74b7('0x21')]=qs['offset'](_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x21')]);}return _0xaa4565[_0x74b7('0x63')](_0x239d1f);}})[_0x74b7('0x27')](function(_0x254e38){if(_0x254e38){return _0x254e38?{'count':_0x360540,'rows':_0x254e38}:null;}})[_0x74b7('0x27')](respondWithResult(_0x4dfd4e,null))[_0x74b7('0x4b')](handleError(_0x4dfd4e,null));};exports['addTeams']=function(_0x1fa611,_0xa93d3a,_0x544a37){var _0x3d71c7=_0x1fa611[_0x74b7('0x4f')][_0x74b7('0x65')];return db[_0x74b7('0x64')]['findAll']({'where':{'id':_0x3d71c7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x74b7('0x66'),'attributes':['id',_0x74b7('0x2f'),_0x74b7('0x67'),'voicePause',_0x74b7('0x68')],'raw':!![]}]})[_0x74b7('0x27')](function(_0x580419){if(_0x580419){var _0x3bdd36=_[_0x74b7('0x69')](_0x580419,function(_0x565bb9){var _0x58779b=_0x565bb9[_0x74b7('0x28')]({'plain':!![]});return _0x58779b[_0x74b7('0x66')];});return db[_0x74b7('0x31')][_0x74b7('0x4d')]({'where':{'id':_0x1fa611[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](function(_0x209e4f){return db[_0x74b7('0x6a')][_0x74b7('0x6b')](function(_0x1465de){return _0x209e4f['addTeams'](_0x3d71c7,{'transaction':_0x1465de})[_0x74b7('0x27')](function(){return BPromise[_0x74b7('0x6c')](_0x3bdd36,function(_0xbe26dc){return db[_0x74b7('0x58')][_0x74b7('0x6d')]({'where':{'UserId':_0xbe26dc['id'],'OpenchannelQueueId':_0x1fa611[_0x74b7('0x4c')]['id']},'transaction':_0x1465de});});})[_0x74b7('0x27')](function(){_0x3bdd36['forEach'](function(_0x31668a){socket[_0x74b7('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x31668a['id'],'OpenchannelQueueId':_0x209e4f['id']});});});});});}})[_0x74b7('0x27')](respondWithStatusCode(_0xa93d3a,null))[_0x74b7('0x4b')](handleError(_0xa93d3a,null));};exports['removeTeams']=function(_0x2f47ee,_0x2ad52c,_0x24d97b){return db[_0x74b7('0x64')][_0x74b7('0x49')]({'where':{'id':_0x2f47ee[_0x74b7('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x74b7('0x6f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74b7('0x27')](handleEntityNotFound(_0x2ad52c,null))[_0x74b7('0x27')](function(_0x21f3f5){var _0x33a357=_[_0x74b7('0x30')](_0x21f3f5,'id');var _0x42e50e=[];var _0x29bfa7=[];var _0x53c0bf=squel['select']();_0x53c0bf[_0x74b7('0x70')](_0x74b7('0x71'))[_0x74b7('0x72')]('team_has_openchannel_queues','tq')[_0x74b7('0x73')](_0x74b7('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x74b7('0x43')]('OpenchannelQueueId\x20=\x20?',_0x2f47ee[_0x74b7('0x4c')]['id']);for(var _0x37ad80=0x0;_0x37ad80<_0x21f3f5[_0x74b7('0x3c')];_0x37ad80+=0x1){let _0x2beb0a=_0x21f3f5[_0x37ad80];for(var _0x3865be=0x0;_0x3865be<_0x2beb0a[_0x74b7('0x66')][_0x74b7('0x3c')];_0x3865be+=0x1){let _0x3f10aa=_0x2beb0a['Agents'][_0x3865be];var _0x3b68a9=_0x53c0bf['clone']();_0x3b68a9['where'](_0x74b7('0x75'),_0x3f10aa['id']);_0x29bfa7[_0x74b7('0x76')](db[_0x74b7('0x6a')][_0x74b7('0x39')](_0x3b68a9[_0x74b7('0x77')](),{'type':db[_0x74b7('0x6a')][_0x74b7('0x78')][_0x74b7('0x79')]})['then'](function(_0xa48b41){if(_0xa48b41[_0x74b7('0x3c')]===0x1){return _0x3f10aa['id'];}else{var _0x140c59=_[_0x74b7('0x7a')](_[_0x74b7('0x30')](_0xa48b41,_0x74b7('0x7b')),function(_0x43377f){return _['includes'](_0x33a357,_0x43377f);});if(_0x140c59){return _0x3f10aa['id'];}}}));}}return BPromise[_0x74b7('0x7c')](_0x29bfa7)['then'](function(_0x4ab463){_0x42e50e=_(_0x42e50e)[_0x74b7('0x7d')](_0x4ab463)[_0x74b7('0x7e')]()[_0x74b7('0x7f')]();return db['OpenchannelQueue'][_0x74b7('0x4d')]({'where':{'id':_0x2f47ee[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](function(_0xb2d540){return db[_0x74b7('0x6a')][_0x74b7('0x6b')](function(_0x5e4e61){return _0xb2d540['removeTeams'](_0x2f47ee['query'][_0x74b7('0x65')],{'transaction':_0x5e4e61})[_0x74b7('0x27')](function(){if(!_[_0x74b7('0x80')](_0x42e50e)){return _0xb2d540[_0x74b7('0x81')](_0x42e50e,{'transaction':_0x5e4e61});}})['then'](function(){_0x42e50e[_0x74b7('0x82')](function(_0x142719){socket[_0x74b7('0x6e')](_0x74b7('0x83'),{'UserId':_0x142719,'OpenchannelQueueId':_0xb2d540['id']});});});});});});})['then'](respondWithStatusCode(_0x2ad52c,null))[_0x74b7('0x4b')](handleError(_0x2ad52c,null));};exports[_0x74b7('0x84')]=function(_0x4b6cee,_0x4a003f,_0x1e0b60){return db['OpenchannelQueue'][_0x74b7('0x4d')]({'where':{'id':_0x4b6cee[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x4a003f,null))['then'](function(_0x4736ca){if(_0x4736ca){return _0x4736ca['addAgents'](_0x4b6cee[_0x74b7('0x4f')][_0x74b7('0x65')],_[_0x74b7('0x85')](_0x4b6cee[_0x74b7('0x4f')],[_0x74b7('0x65'),'id'])||{})[_0x74b7('0x86')](function(_0xa36c95){for(var _0x4a810e=0x0;_0x4a810e<_0x4b6cee[_0x74b7('0x4f')][_0x74b7('0x65')][_0x74b7('0x3c')];_0x4a810e+=0x1){socket[_0x74b7('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x4b6cee[_0x74b7('0x4f')]['ids'][_0x4a810e],'OpenchannelQueueId':_0x4b6cee[_0x74b7('0x4c')]['id']});}return _0xa36c95;});}})['then'](respondWithResult(_0x4a003f,null))[_0x74b7('0x4b')](handleError(_0x4a003f,null));};exports['removeAgents']=function(_0x4a9c4e,_0x814dd4,_0x5c6843){return db['OpenchannelQueue']['find']({'where':{'id':_0x4a9c4e[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x814dd4,null))[_0x74b7('0x27')](function(_0xd339d1){if(_0xd339d1){return _0xd339d1[_0x74b7('0x81')](_0x4a9c4e[_0x74b7('0x39')][_0x74b7('0x65')])[_0x74b7('0x27')](function(){if(_[_0x74b7('0x87')](_0x4a9c4e[_0x74b7('0x39')][_0x74b7('0x65')])){for(var _0x33ca55=0x0;_0x33ca55<_0x4a9c4e[_0x74b7('0x39')]['ids'][_0x74b7('0x3c')];_0x33ca55+=0x1){socket[_0x74b7('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4a9c4e[_0x74b7('0x39')][_0x74b7('0x65')][_0x33ca55]),'OpenchannelQueueId':Number(_0x4a9c4e[_0x74b7('0x4c')]['id'])});}}else{socket['emit'](_0x74b7('0x83'),{'UserId':Number(_0x4a9c4e['query'][_0x74b7('0x65')]),'OpenchannelQueueId':Number(_0x4a9c4e[_0x74b7('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x814dd4,null))[_0x74b7('0x4b')](handleError(_0x814dd4,null));};exports[_0x74b7('0x88')]=function(_0x5bc640,_0x268486,_0x250b33){var _0x137e97={};var _0x50fe04={};var _0x5ebb79;var _0x203b53;return db[_0x74b7('0x31')][_0x74b7('0x89')]({'where':{'id':_0x5bc640['params']['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x268486,null))['then'](function(_0x5378bc){if(_0x5378bc){_0x5ebb79=_0x5378bc;_0x50fe04[_0x74b7('0x35')]=_[_0x74b7('0x36')](db[_0x74b7('0x6f')][_0x74b7('0x32')]);_0x50fe04['query']=_[_0x74b7('0x36')](_0x5bc640[_0x74b7('0x39')]);_0x50fe04[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x50fe04[_0x74b7('0x35')],_0x50fe04['query']);_0x137e97[_0x74b7('0x3b')]=_[_0x74b7('0x38')](_0x50fe04[_0x74b7('0x35')],qs[_0x74b7('0x3a')](_0x5bc640[_0x74b7('0x39')][_0x74b7('0x3a')]));_0x137e97['attributes']=_0x137e97[_0x74b7('0x3b')][_0x74b7('0x3c')]?_0x137e97[_0x74b7('0x3b')]:_0x50fe04['model'];_0x137e97[_0x74b7('0x3f')]=qs[_0x74b7('0x40')](_0x5bc640[_0x74b7('0x39')][_0x74b7('0x40')]);_0x137e97[_0x74b7('0x43')]=qs['filters'](_[_0x74b7('0x41')](_0x5bc640[_0x74b7('0x39')],_0x50fe04['filters']));if(_0x5bc640[_0x74b7('0x39')][_0x74b7('0x42')]){_0x137e97[_0x74b7('0x43')]=_[_0x74b7('0x44')](_0x137e97[_0x74b7('0x43')],{'$or':_['map'](_0x137e97[_0x74b7('0x3b')],function(_0x3c75ce){var _0x2ffa5b={};_0x2ffa5b[_0x3c75ce]={'$like':'%'+_0x5bc640['query'][_0x74b7('0x42')]+'%'};return _0x2ffa5b;})});}_0x137e97=_[_0x74b7('0x44')]({},_0x137e97,_0x5bc640[_0x74b7('0x46')]);return _0x5ebb79[_0x74b7('0x88')](_0x137e97);}})[_0x74b7('0x27')](function(_0x309260){if(_0x309260){_0x203b53=_0x309260[_0x74b7('0x3c')];if(!_0x5bc640[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x137e97[_0x74b7('0x22')]=qs[_0x74b7('0x22')](_0x5bc640['query'][_0x74b7('0x22')]);_0x137e97[_0x74b7('0x21')]=qs['offset'](_0x5bc640[_0x74b7('0x39')][_0x74b7('0x21')]);}return _0x5ebb79[_0x74b7('0x88')](_0x137e97);}})['then'](function(_0x246765){if(_0x246765){return _0x246765?{'count':_0x203b53,'rows':_0x246765}:null;}})[_0x74b7('0x27')](respondWithResult(_0x268486,null))['catch'](handleError(_0x268486,null));}; \ No newline at end of file +var _0xf56b=['userOpenchannelQueue:save','removeTeams','Team','Agents','select','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','addAgents','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','order','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','createdAt','%s/%s','SIP','getTeams','addTeams','ids','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit'];(function(_0x25bb4c,_0x1a0b53){var _0x4c78b2=function(_0x437620){while(--_0x437620){_0x25bb4c['push'](_0x25bb4c['shift']());}};_0x4c78b2(++_0x1a0b53);}(_0xf56b,0x1ba));var _0xbf56=function(_0x169766,_0x2e0e4c){_0x169766=_0x169766-0x0;var _0x685d57=_0xf56b[_0x169766];return _0x685d57;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf56('0x0'));var rimraf=require(_0xbf56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf56('0x2'));var rp=require(_0xbf56('0x3'));var moment=require(_0xbf56('0x4'));var BPromise=require(_0xbf56('0x5'));var Mustache=require('mustache');var util=require(_0xbf56('0x6'));var path=require(_0xbf56('0x7'));var sox=require(_0xbf56('0x8'));var csv=require(_0xbf56('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf56('0xa'));var squel=require(_0xbf56('0xb'));var crypto=require(_0xbf56('0xc'));var jsforce=require(_0xbf56('0xd'));var deskjs=require(_0xbf56('0xe'));var toCsv=require(_0xbf56('0x9'));var querystring=require(_0xbf56('0xf'));var Papa=require('papaparse');var Redis=require(_0xbf56('0x10'));var authService=require(_0xbf56('0x11'));var qs=require(_0xbf56('0x12'));var as=require(_0xbf56('0x13'));var hardwareService=require(_0xbf56('0x14'));var logger=require('../../config/logger')(_0xbf56('0x15'));var utils=require(_0xbf56('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf56('0x17'))['db'];config[_0xbf56('0x18')]=_[_0xbf56('0x19')](config[_0xbf56('0x18')],{'host':_0xbf56('0x1a'),'port':0x18eb});var socket=require(_0xbf56('0x1b'))(new Redis(config[_0xbf56('0x18')]));require(_0xbf56('0x1c'))['register'](socket);function respondWithStatusCode(_0x47bd08,_0x3aa27e){_0x3aa27e=_0x3aa27e||0xcc;return function(_0x2afc83){if(_0x2afc83){return _0x47bd08['sendStatus'](_0x3aa27e);}return _0x47bd08[_0xbf56('0x1d')](_0x3aa27e)[_0xbf56('0x1e')]();};}function respondWithResult(_0x541e16,_0x20836d){_0x20836d=_0x20836d||0xc8;return function(_0x4df91a){if(_0x4df91a){return _0x541e16['status'](_0x20836d)[_0xbf56('0x1f')](_0x4df91a);}};}function respondWithFilteredResult(_0x4d4a7a,_0x4de817){return function(_0x33522d){if(_0x33522d){var _0x48ebbf=_0x33522d[_0xbf56('0x20')],_0x51a24f=_0x4de817['offset'],_0x16f840=_0x4de817[_0xbf56('0x21')]+_0x4de817[_0xbf56('0x22')],_0xe8e228;if(_0x16f840>=_0x48ebbf){_0x16f840=_0x48ebbf;_0xe8e228=0xc8;}else{_0xe8e228=0xce;}_0x4d4a7a[_0xbf56('0x1d')](_0xe8e228);return _0x4d4a7a[_0xbf56('0x23')](_0xbf56('0x24'),_0x51a24f+'-'+_0x16f840+'/'+_0x48ebbf)[_0xbf56('0x1f')](_0x33522d);}return null;};}function patchUpdates(_0x4f73fe){return function(_0x19d2f3){try{jsonpatch[_0xbf56('0x25')](_0x19d2f3,_0x4f73fe,!![]);}catch(_0x5749bd){return BPromise[_0xbf56('0x26')](_0x5749bd);}return _0x19d2f3[_0xbf56('0x27')]();};}function saveUpdates(_0x4259b4,_0x54a06f){return function(_0x3186eb){if(_0x3186eb){return _0x3186eb['update'](_0x4259b4)[_0xbf56('0x28')](function(_0x223839){return _0x223839;});}return null;};}function removeEntity(_0x3b4388,_0x2a30e8){return function(_0x4dbd87){if(_0x4dbd87){return _0x4dbd87[_0xbf56('0x29')]()[_0xbf56('0x28')](function(){var _0x141392=_0x4dbd87[_0xbf56('0x2a')]({'plain':!![]});var _0x1a834c=_0xbf56('0x2b');return db[_0xbf56('0x2c')][_0xbf56('0x29')]({'where':{'type':_0x1a834c,'resourceId':_0x141392['id']}})['then'](function(){return _0x4dbd87;});})['then'](function(){_0x3b4388[_0xbf56('0x1d')](0xcc)[_0xbf56('0x1e')]();});}};}function handleEntityNotFound(_0x2bdc46,_0x3b3f38){return function(_0x13c9e4){if(!_0x13c9e4){_0x2bdc46[_0xbf56('0x2d')](0x194);}return _0x13c9e4;};}function handleError(_0x511500,_0x1b6e58){_0x1b6e58=_0x1b6e58||0x1f4;return function(_0x568c92){logger[_0xbf56('0x2e')](_0x568c92[_0xbf56('0x2f')]);if(_0x568c92['name']){delete _0x568c92[_0xbf56('0x30')];}_0x511500['status'](_0x1b6e58)['send'](_0x568c92);};}exports[_0xbf56('0x31')]=function(_0x4e7ed4,_0x53860f){var _0x25f0bf={},_0x9613f7={},_0x4ec709={'count':0x0,'rows':[]};var _0x54cef2=_[_0xbf56('0x32')](db[_0xbf56('0x33')][_0xbf56('0x34')],function(_0x5c2027){return{'name':_0x5c2027['fieldName'],'type':_0x5c2027[_0xbf56('0x35')]['key']};});_0x9613f7['model']=_[_0xbf56('0x32')](_0x54cef2,_0xbf56('0x30'));_0x9613f7[_0xbf56('0x36')]=_['keys'](_0x4e7ed4[_0xbf56('0x36')]);_0x9613f7[_0xbf56('0x37')]=_[_0xbf56('0x38')](_0x9613f7[_0xbf56('0x39')],_0x9613f7[_0xbf56('0x36')]);_0x25f0bf[_0xbf56('0x3a')]=_[_0xbf56('0x38')](_0x9613f7['model'],qs[_0xbf56('0x3b')](_0x4e7ed4[_0xbf56('0x36')][_0xbf56('0x3b')]));_0x25f0bf[_0xbf56('0x3a')]=_0x25f0bf[_0xbf56('0x3a')][_0xbf56('0x3c')]?_0x25f0bf[_0xbf56('0x3a')]:_0x9613f7[_0xbf56('0x39')];if(!_0x4e7ed4['query'][_0xbf56('0x3d')]('nolimit')){_0x25f0bf[_0xbf56('0x22')]=qs[_0xbf56('0x22')](_0x4e7ed4[_0xbf56('0x36')]['limit']);_0x25f0bf[_0xbf56('0x21')]=qs['offset'](_0x4e7ed4[_0xbf56('0x36')][_0xbf56('0x21')]);}_0x25f0bf['order']=qs[_0xbf56('0x3e')](_0x4e7ed4[_0xbf56('0x36')][_0xbf56('0x3e')]);_0x25f0bf['where']=qs[_0xbf56('0x37')](_[_0xbf56('0x3f')](_0x4e7ed4[_0xbf56('0x36')],_0x9613f7[_0xbf56('0x37')]),_0x54cef2);if(_0x4e7ed4[_0xbf56('0x36')]['filter']){_0x25f0bf[_0xbf56('0x40')]=_[_0xbf56('0x41')](_0x25f0bf[_0xbf56('0x40')],{'$or':_[_0xbf56('0x32')](_0x54cef2,function(_0x588104){if(_0x588104[_0xbf56('0x35')]!==_0xbf56('0x42')){var _0x318805={};_0x318805[_0x588104[_0xbf56('0x30')]]={'$like':'%'+_0x4e7ed4[_0xbf56('0x36')][_0xbf56('0x43')]+'%'};return _0x318805;}})});}_0x25f0bf=_['merge']({},_0x25f0bf,_0x4e7ed4[_0xbf56('0x44')]);var _0x485ed5={'where':_0x25f0bf[_0xbf56('0x40')]};return db[_0xbf56('0x33')][_0xbf56('0x20')](_0x485ed5)['then'](function(_0xe9f851){_0x4ec709[_0xbf56('0x20')]=_0xe9f851;if(_0x4e7ed4['query'][_0xbf56('0x45')]){_0x25f0bf[_0xbf56('0x46')]=[{'all':!![]}];}return db[_0xbf56('0x33')][_0xbf56('0x47')](_0x25f0bf);})[_0xbf56('0x28')](function(_0x33f0dd){_0x4ec709[_0xbf56('0x48')]=_0x33f0dd;return _0x4ec709;})['then'](respondWithFilteredResult(_0x53860f,_0x25f0bf))[_0xbf56('0x49')](handleError(_0x53860f,null));};exports[_0xbf56('0x4a')]=function(_0x365e63,_0x48c6a7){var _0x3f030e={'raw':!![],'where':{'id':_0x365e63[_0xbf56('0x4b')]['id']}},_0x5440f7={};_0x5440f7[_0xbf56('0x39')]=_[_0xbf56('0x4c')](db[_0xbf56('0x33')]['rawAttributes']);_0x5440f7[_0xbf56('0x36')]=_['keys'](_0x365e63['query']);_0x5440f7[_0xbf56('0x37')]=_['intersection'](_0x5440f7[_0xbf56('0x39')],_0x5440f7[_0xbf56('0x36')]);_0x3f030e['attributes']=_[_0xbf56('0x38')](_0x5440f7[_0xbf56('0x39')],qs[_0xbf56('0x3b')](_0x365e63[_0xbf56('0x36')][_0xbf56('0x3b')]));_0x3f030e['attributes']=_0x3f030e[_0xbf56('0x3a')][_0xbf56('0x3c')]?_0x3f030e[_0xbf56('0x3a')]:_0x5440f7['model'];if(_0x365e63[_0xbf56('0x36')][_0xbf56('0x45')]){_0x3f030e['include']=[{'all':!![]}];}_0x3f030e=_[_0xbf56('0x41')]({},_0x3f030e,_0x365e63[_0xbf56('0x44')]);return db[_0xbf56('0x33')][_0xbf56('0x4d')](_0x3f030e)['then'](handleEntityNotFound(_0x48c6a7,null))[_0xbf56('0x28')](respondWithResult(_0x48c6a7,null))[_0xbf56('0x49')](handleError(_0x48c6a7,null));};exports[_0xbf56('0x4e')]=function(_0x4b8f83,_0x2e9d55){return db[_0xbf56('0x33')][_0xbf56('0x4e')](_0x4b8f83[_0xbf56('0x4f')],{})['then'](function(_0x20ade2){var _0x3b9785=_0x4b8f83['user'][_0xbf56('0x2a')]({'plain':!![]});if(!_0x3b9785)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b9785[_0xbf56('0x50')]===_0xbf56('0x51')){var _0x321197=_0x20ade2[_0xbf56('0x2a')]({'plain':!![]});var _0x1c2137=_0xbf56('0x2b');return db[_0xbf56('0x52')][_0xbf56('0x4d')]({'where':{'name':_0x1c2137,'userProfileId':_0x3b9785[_0xbf56('0x53')]},'raw':!![]})[_0xbf56('0x28')](function(_0x58b184){if(_0x58b184&&_0x58b184['autoAssociation']===0x0){return db[_0xbf56('0x2c')]['create']({'name':_0x321197[_0xbf56('0x30')],'resourceId':_0x321197['id'],'type':_0x58b184['name'],'sectionId':_0x58b184['id']},{})[_0xbf56('0x28')](function(){return _0x20ade2;});}else{return _0x20ade2;}})[_0xbf56('0x49')](function(_0x5363db){logger['error'](_0xbf56('0x54'),_0x5363db);throw _0x5363db;});}return _0x20ade2;})['then'](respondWithResult(_0x2e9d55,0xc9))[_0xbf56('0x49')](handleError(_0x2e9d55,null));};exports['update']=function(_0xb51768,_0x3fa254){if(_0xb51768[_0xbf56('0x4f')]['id']){delete _0xb51768[_0xbf56('0x4f')]['id'];}return db['OpenchannelQueue'][_0xbf56('0x4d')]({'where':{'id':_0xb51768[_0xbf56('0x4b')]['id']}})[_0xbf56('0x28')](handleEntityNotFound(_0x3fa254,null))[_0xbf56('0x28')](saveUpdates(_0xb51768[_0xbf56('0x4f')],null))[_0xbf56('0x28')](respondWithResult(_0x3fa254,null))[_0xbf56('0x49')](handleError(_0x3fa254,null));};exports[_0xbf56('0x29')]=function(_0x3b47ed,_0x7b6da0){return db['OpenchannelQueue'][_0xbf56('0x4d')]({'where':{'id':_0x3b47ed[_0xbf56('0x4b')]['id']}})[_0xbf56('0x28')](handleEntityNotFound(_0x7b6da0,null))[_0xbf56('0x28')](removeEntity(_0x7b6da0,null))[_0xbf56('0x49')](handleError(_0x7b6da0,null));};exports[_0xbf56('0x55')]=function(_0x2c67fa,_0xc2a068){return db[_0xbf56('0x33')][_0xbf56('0x55')]()['then'](respondWithResult(_0xc2a068,null))[_0xbf56('0x49')](handleError(_0xc2a068,null));};exports[_0xbf56('0x56')]=function(_0x4ff77f,_0x128a59,_0x43c088){var _0x350075={'raw':!![],'where':{}},_0xdb152a={},_0x19f374;return db[_0xbf56('0x33')][_0xbf56('0x57')]({'where':{'id':_0x4ff77f['params']['id']}})[_0xbf56('0x28')](handleEntityNotFound(_0x128a59,null))[_0xbf56('0x28')](function(_0x1cf93d){if(_0x1cf93d){_0x19f374=_0x1cf93d[_0xbf56('0x2a')]({'plain':!![]});_0xdb152a['model']=_[_0xbf56('0x4c')](db[_0xbf56('0x58')]['rawAttributes']);_0xdb152a[_0xbf56('0x36')]=_[_0xbf56('0x4c')](_0x4ff77f[_0xbf56('0x36')]);_0xdb152a[_0xbf56('0x37')]=_[_0xbf56('0x38')](_0xdb152a['model'],_0xdb152a[_0xbf56('0x36')]);_0x350075[_0xbf56('0x3a')]=_[_0xbf56('0x38')](_0xdb152a[_0xbf56('0x39')],qs[_0xbf56('0x3b')](_0x4ff77f['query'][_0xbf56('0x3b')]));_0x350075[_0xbf56('0x3a')]=_0x350075['attributes'][_0xbf56('0x3c')]?_0x350075['attributes']:_0xdb152a[_0xbf56('0x39')];if(!_0x4ff77f[_0xbf56('0x36')][_0xbf56('0x3d')](_0xbf56('0x59'))){_0x350075['limit']=qs[_0xbf56('0x22')](_0x4ff77f['query'][_0xbf56('0x22')]);_0x350075[_0xbf56('0x21')]=qs['offset'](_0x4ff77f['query'][_0xbf56('0x21')]);}_0x350075[_0xbf56('0x5a')]=qs[_0xbf56('0x3e')](_0x4ff77f['query'][_0xbf56('0x3e')]);_0x350075['where']=qs[_0xbf56('0x37')](_[_0xbf56('0x3f')](_0x4ff77f[_0xbf56('0x36')],_0xdb152a[_0xbf56('0x37')]));_0x350075['where'][_0xbf56('0x5b')]=_0x1cf93d['id'];if(_0x4ff77f[_0xbf56('0x36')][_0xbf56('0x43')]){_0x350075['where']=_[_0xbf56('0x41')](_0x350075[_0xbf56('0x40')],{'$or':_['map'](_0x350075[_0xbf56('0x3a')],function(_0x157afe){var _0x24e674={};_0x24e674[_0x157afe]={'$like':'%'+_0x4ff77f[_0xbf56('0x36')][_0xbf56('0x43')]+'%'};return _0x24e674;})});}_0x350075=_[_0xbf56('0x41')]({},_0x350075,_0x4ff77f[_0xbf56('0x44')]);return db[_0xbf56('0x58')]['findAll'](_0x350075);}})[_0xbf56('0x28')](function(_0x4fdcdd){if(_0x4fdcdd){return db[_0xbf56('0x5c')][_0xbf56('0x5d')]({'where':{'id':_['map'](_0x4fdcdd,_0xbf56('0x5e')),'role':'agent'},'attributes':['id',_0xbf56('0x30'),_0xbf56('0x5f'),'updatedAt',_0xbf56('0x60')]});}})[_0xbf56('0x28')](function(_0xa40a33){if(_0xa40a33){return{'count':_0xa40a33[_0xbf56('0x20')],'rows':_[_0xbf56('0x32')](_0xa40a33['rows'],function(_0x45b39e){return{'membername':_0x45b39e['name'],'UserId':_0x45b39e['id'],'queue_name':_0x19f374[_0xbf56('0x30')],'OpenchannelQueueId':_0x19f374['id'],'interface':util['format'](_0xbf56('0x61'),_0xbf56('0x62'),_0x45b39e[_0xbf56('0x30')]),'penalty':0x0,'paused':_0x45b39e['openchannelPause'],'createdAt':_0x45b39e[_0xbf56('0x60')],'updatedAt':_0x45b39e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x128a59,_0x350075))[_0xbf56('0x49')](handleError(_0x128a59,null));};exports[_0xbf56('0x63')]=function(_0x36bbd7,_0x11f89d,_0xde038b){var _0x8cbb97={};var _0x2784f2={};var _0x29f311;var _0xdcb6b4;return db[_0xbf56('0x33')]['findOne']({'where':{'id':_0x36bbd7['params']['id']}})[_0xbf56('0x28')](handleEntityNotFound(_0x11f89d,null))[_0xbf56('0x28')](function(_0xab7424){if(_0xab7424){_0x29f311=_0xab7424;_0x2784f2[_0xbf56('0x39')]=_[_0xbf56('0x4c')](db['Team'][_0xbf56('0x34')]);_0x2784f2[_0xbf56('0x36')]=_[_0xbf56('0x4c')](_0x36bbd7['query']);_0x2784f2[_0xbf56('0x37')]=_['intersection'](_0x2784f2[_0xbf56('0x39')],_0x2784f2[_0xbf56('0x36')]);_0x8cbb97['attributes']=_[_0xbf56('0x38')](_0x2784f2[_0xbf56('0x39')],qs[_0xbf56('0x3b')](_0x36bbd7[_0xbf56('0x36')][_0xbf56('0x3b')]));_0x8cbb97[_0xbf56('0x3a')]=_0x8cbb97[_0xbf56('0x3a')][_0xbf56('0x3c')]?_0x8cbb97[_0xbf56('0x3a')]:_0x2784f2[_0xbf56('0x39')];_0x8cbb97[_0xbf56('0x5a')]=qs[_0xbf56('0x3e')](_0x36bbd7[_0xbf56('0x36')]['sort']);_0x8cbb97['where']=qs[_0xbf56('0x37')](_[_0xbf56('0x3f')](_0x36bbd7[_0xbf56('0x36')],_0x2784f2['filters']));if(_0x36bbd7['query'][_0xbf56('0x43')]){_0x8cbb97[_0xbf56('0x40')]=_[_0xbf56('0x41')](_0x8cbb97[_0xbf56('0x40')],{'$or':_['map'](_0x8cbb97[_0xbf56('0x3a')],function(_0x42ab34){var _0xf637b4={};_0xf637b4[_0x42ab34]={'$like':'%'+_0x36bbd7[_0xbf56('0x36')][_0xbf56('0x43')]+'%'};return _0xf637b4;})});}_0x8cbb97=_[_0xbf56('0x41')]({},_0x8cbb97,_0x36bbd7[_0xbf56('0x44')]);return _0x29f311['getTeams'](_0x8cbb97);}})[_0xbf56('0x28')](function(_0x2ea9bc){if(_0x2ea9bc){_0xdcb6b4=_0x2ea9bc[_0xbf56('0x3c')];if(!_0x36bbd7[_0xbf56('0x36')][_0xbf56('0x3d')](_0xbf56('0x59'))){_0x8cbb97[_0xbf56('0x22')]=qs['limit'](_0x36bbd7['query'][_0xbf56('0x22')]);_0x8cbb97['offset']=qs[_0xbf56('0x21')](_0x36bbd7['query']['offset']);}return _0x29f311['getTeams'](_0x8cbb97);}})[_0xbf56('0x28')](function(_0xb1e6dc){if(_0xb1e6dc){return _0xb1e6dc?{'count':_0xdcb6b4,'rows':_0xb1e6dc}:null;}})[_0xbf56('0x28')](respondWithResult(_0x11f89d,null))[_0xbf56('0x49')](handleError(_0x11f89d,null));};exports[_0xbf56('0x64')]=function(_0x2e43ed,_0x11dcdf,_0x9abf9){var _0x281156=_0x2e43ed['body'][_0xbf56('0x65')];return db['Team']['findAll']({'where':{'id':_0x281156},'attributes':['id'],'include':[{'model':db[_0xbf56('0x5c')],'as':'Agents','attributes':['id',_0xbf56('0x30'),_0xbf56('0x66'),'voicePause',_0xbf56('0x67')],'raw':!![]}]})[_0xbf56('0x28')](function(_0xd23a0b){if(_0xd23a0b){var _0x2074a0=_[_0xbf56('0x68')](_0xd23a0b,function(_0x5b09fa){var _0x22a4e1=_0x5b09fa[_0xbf56('0x2a')]({'plain':!![]});return _0x22a4e1['Agents'];});return db[_0xbf56('0x33')][_0xbf56('0x4d')]({'where':{'id':_0x2e43ed[_0xbf56('0x4b')]['id']}})[_0xbf56('0x28')](function(_0x1631b2){return db[_0xbf56('0x69')][_0xbf56('0x6a')](function(_0x343e4c){return _0x1631b2[_0xbf56('0x64')](_0x281156,{'transaction':_0x343e4c})['then'](function(){return BPromise['each'](_0x2074a0,function(_0xaf438d){return db['UserOpenchannelQueue'][_0xbf56('0x6b')]({'where':{'UserId':_0xaf438d['id'],'OpenchannelQueueId':_0x2e43ed['params']['id']},'transaction':_0x343e4c});});})[_0xbf56('0x28')](function(){_0x2074a0[_0xbf56('0x6c')](function(_0x713c46){socket[_0xbf56('0x6d')](_0xbf56('0x6e'),{'UserId':_0x713c46['id'],'OpenchannelQueueId':_0x1631b2['id']});});});});});}})[_0xbf56('0x28')](respondWithStatusCode(_0x11dcdf,null))['catch'](handleError(_0x11dcdf,null));};exports[_0xbf56('0x6f')]=function(_0x419d0a,_0x1a6638,_0x25cedc){return db[_0xbf56('0x70')][_0xbf56('0x47')]({'where':{'id':_0x419d0a[_0xbf56('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbf56('0x5c')],'as':_0xbf56('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1a6638,null))[_0xbf56('0x28')](function(_0x6b201b){var _0xa9f978=_[_0xbf56('0x32')](_0x6b201b,'id');var _0x5ab78b=[];var _0x363e00=[];var _0x25a22f=squel[_0xbf56('0x72')]();_0x25a22f['field']('tq.TeamId')[_0xbf56('0x73')](_0xbf56('0x74'),'tq')['join'](_0xbf56('0x75'),'ut',_0xbf56('0x76'))[_0xbf56('0x40')](_0xbf56('0x77'),_0x419d0a[_0xbf56('0x4b')]['id']);for(var _0x161b1b=0x0;_0x161b1b<_0x6b201b[_0xbf56('0x3c')];_0x161b1b+=0x1){let _0x5bcf5f=_0x6b201b[_0x161b1b];for(var _0x50664e=0x0;_0x50664e<_0x5bcf5f['Agents']['length'];_0x50664e+=0x1){let _0x2bce87=_0x5bcf5f[_0xbf56('0x71')][_0x50664e];var _0x26f47e=_0x25a22f[_0xbf56('0x78')]();_0x26f47e[_0xbf56('0x40')](_0xbf56('0x79'),_0x2bce87['id']);_0x363e00[_0xbf56('0x7a')](db[_0xbf56('0x69')][_0xbf56('0x36')](_0x26f47e[_0xbf56('0x7b')](),{'type':db[_0xbf56('0x69')][_0xbf56('0x7c')][_0xbf56('0x7d')]})[_0xbf56('0x28')](function(_0x2b6f19){if(_0x2b6f19[_0xbf56('0x3c')]===0x1){return _0x2bce87['id'];}else{var _0x3d3cbd=_[_0xbf56('0x7e')](_['map'](_0x2b6f19,'TeamId'),function(_0x190019){return _[_0xbf56('0x7f')](_0xa9f978,_0x190019);});if(_0x3d3cbd){return _0x2bce87['id'];}}}));}}return BPromise[_0xbf56('0x80')](_0x363e00)[_0xbf56('0x28')](function(_0x2f8f01){_0x5ab78b=_(_0x5ab78b)[_0xbf56('0x81')](_0x2f8f01)[_0xbf56('0x82')]()['value']();return db[_0xbf56('0x33')]['find']({'where':{'id':_0x419d0a[_0xbf56('0x4b')]['id']}})[_0xbf56('0x28')](function(_0x166753){return db[_0xbf56('0x69')][_0xbf56('0x6a')](function(_0xee1849){return _0x166753[_0xbf56('0x6f')](_0x419d0a[_0xbf56('0x36')]['ids'],{'transaction':_0xee1849})[_0xbf56('0x28')](function(){if(!_[_0xbf56('0x83')](_0x5ab78b)){return _0x166753[_0xbf56('0x84')](_0x5ab78b,{'transaction':_0xee1849});}})['then'](function(){_0x5ab78b[_0xbf56('0x6c')](function(_0x4135b7){socket[_0xbf56('0x6d')]('userOpenchannelQueue:remove',{'UserId':_0x4135b7,'OpenchannelQueueId':_0x166753['id']});});});});});});})[_0xbf56('0x28')](respondWithStatusCode(_0x1a6638,null))[_0xbf56('0x49')](handleError(_0x1a6638,null));};exports[_0xbf56('0x85')]=function(_0x28f9b0,_0xb41ee4,_0x278a6d){return db[_0xbf56('0x33')][_0xbf56('0x4d')]({'where':{'id':_0x28f9b0[_0xbf56('0x4b')]['id']}})[_0xbf56('0x28')](handleEntityNotFound(_0xb41ee4,null))[_0xbf56('0x28')](function(_0x16fd3b){if(_0x16fd3b){return _0x16fd3b['addAgents'](_0x28f9b0['body'][_0xbf56('0x65')],_['omit'](_0x28f9b0[_0xbf56('0x4f')],['ids','id'])||{})[_0xbf56('0x86')](function(_0x3e2afb){for(var _0x411f00=0x0;_0x411f00<_0x28f9b0[_0xbf56('0x4f')][_0xbf56('0x65')][_0xbf56('0x3c')];_0x411f00+=0x1){socket['emit'](_0xbf56('0x6e'),{'UserId':_0x28f9b0['body'][_0xbf56('0x65')][_0x411f00],'OpenchannelQueueId':_0x28f9b0['params']['id']});}return _0x3e2afb;});}})['then'](respondWithResult(_0xb41ee4,null))[_0xbf56('0x49')](handleError(_0xb41ee4,null));};exports[_0xbf56('0x84')]=function(_0x51a9e4,_0x242a43,_0x21e95b){return db[_0xbf56('0x33')][_0xbf56('0x4d')]({'where':{'id':_0x51a9e4['params']['id']}})[_0xbf56('0x28')](handleEntityNotFound(_0x242a43,null))[_0xbf56('0x28')](function(_0x56c1b2){if(_0x56c1b2){return _0x56c1b2[_0xbf56('0x84')](_0x51a9e4[_0xbf56('0x36')]['ids'])[_0xbf56('0x28')](function(){if(_[_0xbf56('0x87')](_0x51a9e4['query']['ids'])){for(var _0x7210a8=0x0;_0x7210a8<_0x51a9e4[_0xbf56('0x36')]['ids']['length'];_0x7210a8+=0x1){socket[_0xbf56('0x6d')](_0xbf56('0x88'),{'UserId':Number(_0x51a9e4[_0xbf56('0x36')][_0xbf56('0x65')][_0x7210a8]),'OpenchannelQueueId':Number(_0x51a9e4[_0xbf56('0x4b')]['id'])});}}else{socket[_0xbf56('0x6d')](_0xbf56('0x88'),{'UserId':Number(_0x51a9e4[_0xbf56('0x36')][_0xbf56('0x65')]),'OpenchannelQueueId':Number(_0x51a9e4['params']['id'])});}});}})[_0xbf56('0x28')](respondWithStatusCode(_0x242a43,null))[_0xbf56('0x49')](handleError(_0x242a43,null));};exports[_0xbf56('0x89')]=function(_0x59f136,_0x3082f3,_0x2c75cc){var _0x34fdca={};var _0x239186={};var _0x51840e;var _0x338da4;return db[_0xbf56('0x33')][_0xbf56('0x57')]({'where':{'id':_0x59f136['params']['id']}})[_0xbf56('0x28')](handleEntityNotFound(_0x3082f3,null))['then'](function(_0x4e4f32){if(_0x4e4f32){_0x51840e=_0x4e4f32;_0x239186[_0xbf56('0x39')]=_[_0xbf56('0x4c')](db[_0xbf56('0x5c')][_0xbf56('0x34')]);_0x239186[_0xbf56('0x36')]=_[_0xbf56('0x4c')](_0x59f136[_0xbf56('0x36')]);_0x239186[_0xbf56('0x37')]=_[_0xbf56('0x38')](_0x239186['model'],_0x239186[_0xbf56('0x36')]);_0x34fdca['attributes']=_['intersection'](_0x239186[_0xbf56('0x39')],qs[_0xbf56('0x3b')](_0x59f136['query']['fields']));_0x34fdca['attributes']=_0x34fdca[_0xbf56('0x3a')][_0xbf56('0x3c')]?_0x34fdca[_0xbf56('0x3a')]:_0x239186[_0xbf56('0x39')];_0x34fdca[_0xbf56('0x5a')]=qs[_0xbf56('0x3e')](_0x59f136[_0xbf56('0x36')][_0xbf56('0x3e')]);_0x34fdca[_0xbf56('0x40')]=qs[_0xbf56('0x37')](_[_0xbf56('0x3f')](_0x59f136['query'],_0x239186[_0xbf56('0x37')]));if(_0x59f136[_0xbf56('0x36')][_0xbf56('0x43')]){_0x34fdca['where']=_[_0xbf56('0x41')](_0x34fdca[_0xbf56('0x40')],{'$or':_[_0xbf56('0x32')](_0x34fdca['attributes'],function(_0x283cb8){var _0x59fcdb={};_0x59fcdb[_0x283cb8]={'$like':'%'+_0x59f136[_0xbf56('0x36')]['filter']+'%'};return _0x59fcdb;})});}_0x34fdca=_[_0xbf56('0x41')]({},_0x34fdca,_0x59f136[_0xbf56('0x44')]);return _0x51840e['getAgents'](_0x34fdca);}})[_0xbf56('0x28')](function(_0x33a24c){if(_0x33a24c){_0x338da4=_0x33a24c['length'];if(!_0x59f136[_0xbf56('0x36')][_0xbf56('0x3d')]('nolimit')){_0x34fdca[_0xbf56('0x22')]=qs[_0xbf56('0x22')](_0x59f136[_0xbf56('0x36')][_0xbf56('0x22')]);_0x34fdca[_0xbf56('0x21')]=qs[_0xbf56('0x21')](_0x59f136[_0xbf56('0x36')][_0xbf56('0x21')]);}return _0x51840e[_0xbf56('0x89')](_0x34fdca);}})[_0xbf56('0x28')](function(_0x5b3908){if(_0x5b3908){return _0x5b3908?{'count':_0x338da4,'rows':_0x5b3908}:null;}})[_0xbf56('0x28')](respondWithResult(_0x3082f3,null))['catch'](handleError(_0x3082f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8729634..8803bf7 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 _0xd762=['../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x41e519,_0x6bf4d9){var _0x5cd351=function(_0x3e8263){while(--_0x3e8263){_0x41e519['push'](_0x41e519['shift']());}};_0x5cd351(++_0x6bf4d9);}(_0xd762,0xa9));var _0x2d76=function(_0x39e2f5,_0x1a0163){_0x39e2f5=_0x39e2f5-0x0;var _0x2b1a29=_0xd762[_0x39e2f5];return _0x2b1a29;};'use strict';var EventEmitter=require(_0x2d76('0x0'));var OpenchannelQueue=require(_0x2d76('0x1'))['db'][_0x2d76('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2d76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d76('0x4'),'afterDestroy':_0x2d76('0x5')};function emitEvent(_0x539ff3){return function(_0x5c081f,_0xdbeabd,_0x68408e){OpenchannelQueueEvents[_0x2d76('0x6')](_0x539ff3+':'+_0x5c081f['id'],_0x5c081f);OpenchannelQueueEvents[_0x2d76('0x6')](_0x539ff3,_0x5c081f);_0x68408e(null);};}for(var e in events){if(events[_0x2d76('0x7')](e)){var event=events[e];OpenchannelQueue[_0x2d76('0x8')](e,emitEvent(event));}}module[_0x2d76('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb641=['hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xb641,0x15a));var _0x1b64=function(_0xaf50b9,_0x2deb78){_0xaf50b9=_0xaf50b9-0x0;var _0x31b0ac=_0xb641[_0xaf50b9];return _0x31b0ac;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x1b64('0x0'))['db'][_0x1b64('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1b64('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b64('0x3'),'afterDestroy':_0x1b64('0x4')};function emitEvent(_0x56c5b3){return function(_0x31cee9,_0x22a9d7,_0x2e4f47){OpenchannelQueueEvents['emit'](_0x56c5b3+':'+_0x31cee9['id'],_0x31cee9);OpenchannelQueueEvents['emit'](_0x56c5b3,_0x31cee9);_0x2e4f47(null);};}for(var e in events){if(events[_0x1b64('0x5')](e)){var event=events[e];OpenchannelQueue[_0x1b64('0x6')](e,emitEvent(event));}}module[_0x1b64('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8851e52..e95f82c 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 _0xa0bd=['exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x3dad7f,_0x1f0244){var _0x43cea6=function(_0x2928db){while(--_0x2928db){_0x3dad7f['push'](_0x3dad7f['shift']());}};_0x43cea6(++_0x1f0244);}(_0xa0bd,0x17e));var _0xda0b=function(_0x42cfa5,_0x2ac95b){_0x42cfa5=_0x42cfa5-0x0;var _0x2ae78b=_0xa0bd[_0x42cfa5];return _0x2ae78b;};'use strict';var _=require('lodash');var util=require(_0xda0b('0x0'));var logger=require(_0xda0b('0x1'))(_0xda0b('0x2'));var moment=require(_0xda0b('0x3'));var BPromise=require(_0xda0b('0x4'));var rp=require(_0xda0b('0x5'));var fs=require('fs');var path=require(_0xda0b('0x6'));var rimraf=require(_0xda0b('0x7'));var config=require(_0xda0b('0x8'));var attributes=require(_0xda0b('0x9'));module[_0xda0b('0xa')]=function(_0x103ef8,_0xc7ce90){return _0x103ef8[_0xda0b('0xb')](_0xda0b('0xc'),attributes,{'tableName':_0xda0b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x927d=['openchannel_queues','util','api','moment','bluebird','rimraf','../../config/environment','exports','OpenchannelQueue'];(function(_0x5da49e,_0x46be22){var _0x33da90=function(_0x212eca){while(--_0x212eca){_0x5da49e['push'](_0x5da49e['shift']());}};_0x33da90(++_0x46be22);}(_0x927d,0x88));var _0xd927=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x927d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd927('0x0'));var logger=require('../../config/logger')(_0xd927('0x1'));var moment=require(_0xd927('0x2'));var BPromise=require(_0xd927('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd927('0x4'));var config=require(_0xd927('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0xd927('0x6')]=function(_0x5810d9,_0x17ee19){return _0x5810d9['define'](_0xd927('0x7'),attributes,{'tableName':_0xd927('0x8'),'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 dc73428..9d1d499 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 _0xe494=['then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request'];(function(_0x2d1421,_0x1f708c){var _0x4ea5dc=function(_0x226b80){while(--_0x226b80){_0x2d1421['push'](_0x2d1421['shift']());}};_0x4ea5dc(++_0x1f708c);}(_0xe494,0x130));var _0x4e49=function(_0x235904,_0x5f4fcb){_0x235904=_0x235904-0x0;var _0x25499f=_0xe494[_0x235904];return _0x25499f;};'use strict';var _=require(_0x4e49('0x0'));var util=require(_0x4e49('0x1'));var moment=require(_0x4e49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e49('0x3'));var fs=require('fs');var Redis=require(_0x4e49('0x4'));var db=require(_0x4e49('0x5'))['db'];var utils=require(_0x4e49('0x6'));var logger=require(_0x4e49('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e49('0x8'));var client=jayson[_0x4e49('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4e49('0xa')],{'host':_0x4e49('0xb'),'port':0x18eb});var socket=require(_0x4e49('0xc'))(new Redis(config[_0x4e49('0xa')]));require(_0x4e49('0xd'))[_0x4e49('0xe')](socket);function respondWithRpcPromise(_0x16806c,_0x366484,_0x4f200f){return new BPromise(function(_0x5e2ea7,_0x23b701){return client[_0x4e49('0xf')](_0x16806c,_0x4f200f)[_0x4e49('0x10')](function(_0x11dfd4){logger[_0x4e49('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x366484,'request\x20sent');logger[_0x4e49('0x12')](_0x4e49('0x13'),_0x366484,_0x4e49('0x14'),JSON[_0x4e49('0x15')](_0x11dfd4));if(_0x11dfd4[_0x4e49('0x16')]){if(_0x11dfd4[_0x4e49('0x16')][_0x4e49('0x17')]===0x1f4){logger[_0x4e49('0x16')](_0x4e49('0x18'),_0x366484,_0x11dfd4[_0x4e49('0x16')][_0x4e49('0x19')]);return _0x23b701(_0x11dfd4[_0x4e49('0x16')][_0x4e49('0x19')]);}logger[_0x4e49('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x366484,_0x11dfd4[_0x4e49('0x16')]['message']);return _0x5e2ea7(_0x11dfd4['error'][_0x4e49('0x19')]);}else{logger[_0x4e49('0x11')](_0x4e49('0x18'),_0x366484,_0x4e49('0x14'));_0x5e2ea7(_0x11dfd4[_0x4e49('0x1a')]['message']);}})[_0x4e49('0x1b')](function(_0x191dac){logger[_0x4e49('0x16')](_0x4e49('0x18'),_0x366484,_0x191dac);_0x23b701(_0x191dac);});});}exports['GetOpenchannelQueue']=function(_0x557afc){var _0x37e17=this;return new Promise(function(_0x2534f4,_0x3bd33f){return db['OpenchannelQueue'][_0x4e49('0x1c')]({'raw':_0x557afc[_0x4e49('0x1d')]?_0x557afc['options'][_0x4e49('0x1e')]===undefined?!![]:![]:!![],'where':_0x557afc[_0x4e49('0x1d')]?_0x557afc['options'][_0x4e49('0x1f')]||null:null,'attributes':_0x557afc['options']?_0x557afc[_0x4e49('0x1d')][_0x4e49('0x20')]||null:null,'limit':_0x557afc[_0x4e49('0x1d')]?_0x557afc[_0x4e49('0x1d')][_0x4e49('0x21')]||null:null,'include':_0x557afc[_0x4e49('0x1d')]?_0x557afc[_0x4e49('0x1d')]['include']?_['map'](_0x557afc[_0x4e49('0x1d')][_0x4e49('0x22')],function(_0x29e3ac){return{'model':db[_0x29e3ac['model']],'as':_0x29e3ac['as'],'attributes':_0x29e3ac[_0x4e49('0x20')],'include':_0x29e3ac[_0x4e49('0x22')]?_[_0x4e49('0x23')](_0x29e3ac[_0x4e49('0x22')],function(_0xec7157){return{'model':db[_0xec7157['model']],'as':_0xec7157['as'],'attributes':_0xec7157['attributes'],'include':_0xec7157[_0x4e49('0x22')]?_[_0x4e49('0x23')](_0xec7157[_0x4e49('0x22')],function(_0x445b84){return{'model':db[_0x445b84[_0x4e49('0x24')]],'as':_0x445b84['as'],'attributes':_0x445b84['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49e7aa){logger[_0x4e49('0x11')](_0x4e49('0x25'),_0x557afc);logger['debug'](_0x4e49('0x25'),_0x557afc,JSON[_0x4e49('0x15')](_0x49e7aa));_0x2534f4(_0x49e7aa);})[_0x4e49('0x1b')](function(_0x2ae214){logger[_0x4e49('0x16')](_0x4e49('0x25'),_0x2ae214['message'],_0x557afc);_0x3bd33f(_0x37e17[_0x4e49('0x16')](0x1f4,_0x2ae214[_0x4e49('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x55f18d){var _0x5803a9=this;return new Promise(function(_0xd270d6,_0x5510b8){return db['OpenchannelQueue'][_0x4e49('0x26')]({'raw':_0x55f18d[_0x4e49('0x1d')]?_0x55f18d[_0x4e49('0x1d')][_0x4e49('0x1e')]===undefined?!![]:![]:!![],'where':_0x55f18d['options']?_0x55f18d[_0x4e49('0x1d')][_0x4e49('0x1f')]||null:null,'attributes':_0x55f18d['options']?_0x55f18d['options'][_0x4e49('0x20')]||null:null,'include':_0x55f18d[_0x4e49('0x1d')]?_0x55f18d['options']['include']?_[_0x4e49('0x23')](_0x55f18d[_0x4e49('0x1d')][_0x4e49('0x22')],function(_0x4f4a0f){return{'model':db[_0x4f4a0f['model']],'as':_0x4f4a0f['as'],'attributes':_0x4f4a0f[_0x4e49('0x20')],'include':_0x4f4a0f['include']?_[_0x4e49('0x23')](_0x4f4a0f['include'],function(_0x4f6eb3){return{'model':db[_0x4f6eb3[_0x4e49('0x24')]],'as':_0x4f6eb3['as'],'attributes':_0x4f6eb3[_0x4e49('0x20')],'include':_0x4f6eb3[_0x4e49('0x22')]?_[_0x4e49('0x23')](_0x4f6eb3[_0x4e49('0x22')],function(_0x5b9122){return{'model':db[_0x5b9122[_0x4e49('0x24')]],'as':_0x5b9122['as'],'attributes':_0x5b9122[_0x4e49('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4e49('0x10')](function(_0x5ec54d){logger[_0x4e49('0x11')]('ShowOpenchannelQueue',_0x55f18d);logger[_0x4e49('0x12')]('ShowOpenchannelQueue',_0x55f18d,JSON[_0x4e49('0x15')](_0x5ec54d));_0xd270d6(_0x5ec54d);})['catch'](function(_0x146864){logger['error'](_0x4e49('0x27'),_0x146864[_0x4e49('0x19')],_0x55f18d);_0x5510b8(_0x5803a9[_0x4e49('0x16')](0x1f4,_0x146864[_0x4e49('0x19')]));});});}; \ No newline at end of file +var _0x6a0c=['find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','info','catch','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','stringify','ShowOpenchannelQueue'];(function(_0x4934d1,_0x1fb432){var _0x23253e=function(_0x93f6c0){while(--_0x93f6c0){_0x4934d1['push'](_0x4934d1['shift']());}};_0x23253e(++_0x1fb432);}(_0x6a0c,0xb5));var _0xc6a0=function(_0x163757,_0x59b855){_0x163757=_0x163757-0x0;var _0x5ae6dc=_0x6a0c[_0x163757];return _0x5ae6dc;};'use strict';var _=require('lodash');var util=require(_0xc6a0('0x0'));var moment=require(_0xc6a0('0x1'));var BPromise=require(_0xc6a0('0x2'));var rs=require(_0xc6a0('0x3'));var fs=require('fs');var Redis=require(_0xc6a0('0x4'));var db=require(_0xc6a0('0x5'))['db'];var utils=require(_0xc6a0('0x6'));var logger=require(_0xc6a0('0x7'))('rpc');var config=require(_0xc6a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc6a0('0x9')][_0xc6a0('0xa')]({'port':0x232a});config[_0xc6a0('0xb')]=_['defaults'](config['redis'],{'host':_0xc6a0('0xc'),'port':0x18eb});var socket=require(_0xc6a0('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x290af6,_0x1db71b,_0x597aef){return new BPromise(function(_0x309d05,_0x407034){return client[_0xc6a0('0xe')](_0x290af6,_0x597aef)['then'](function(_0x1062b8){logger['info'](_0xc6a0('0xf'),_0x1db71b,_0xc6a0('0x10'));logger[_0xc6a0('0x11')](_0xc6a0('0x12'),_0x1db71b,_0xc6a0('0x10'),JSON['stringify'](_0x1062b8));if(_0x1062b8[_0xc6a0('0x13')]){if(_0x1062b8['error']['code']===0x1f4){logger[_0xc6a0('0x13')](_0xc6a0('0xf'),_0x1db71b,_0x1062b8[_0xc6a0('0x13')][_0xc6a0('0x14')]);return _0x407034(_0x1062b8[_0xc6a0('0x13')][_0xc6a0('0x14')]);}logger[_0xc6a0('0x13')](_0xc6a0('0xf'),_0x1db71b,_0x1062b8['error']['message']);return _0x309d05(_0x1062b8[_0xc6a0('0x13')][_0xc6a0('0x14')]);}else{logger[_0xc6a0('0x15')](_0xc6a0('0xf'),_0x1db71b,_0xc6a0('0x10'));_0x309d05(_0x1062b8['result'][_0xc6a0('0x14')]);}})[_0xc6a0('0x16')](function(_0x1b48a5){logger[_0xc6a0('0x13')](_0xc6a0('0xf'),_0x1db71b,_0x1b48a5);_0x407034(_0x1b48a5);});});}exports['GetOpenchannelQueue']=function(_0x245ff4){var _0x5d7c70=this;return new Promise(function(_0x1e683e,_0x14ff2e){return db[_0xc6a0('0x17')]['findAll']({'raw':_0x245ff4['options']?_0x245ff4[_0xc6a0('0x18')][_0xc6a0('0x19')]===undefined?!![]:![]:!![],'where':_0x245ff4['options']?_0x245ff4[_0xc6a0('0x18')][_0xc6a0('0x1a')]||null:null,'attributes':_0x245ff4[_0xc6a0('0x18')]?_0x245ff4[_0xc6a0('0x18')][_0xc6a0('0x1b')]||null:null,'limit':_0x245ff4['options']?_0x245ff4[_0xc6a0('0x18')][_0xc6a0('0x1c')]||null:null,'include':_0x245ff4['options']?_0x245ff4['options'][_0xc6a0('0x1d')]?_[_0xc6a0('0x1e')](_0x245ff4['options'][_0xc6a0('0x1d')],function(_0x12a19c){return{'model':db[_0x12a19c[_0xc6a0('0x1f')]],'as':_0x12a19c['as'],'attributes':_0x12a19c['attributes'],'include':_0x12a19c[_0xc6a0('0x1d')]?_[_0xc6a0('0x1e')](_0x12a19c['include'],function(_0x2fb33c){return{'model':db[_0x2fb33c[_0xc6a0('0x1f')]],'as':_0x2fb33c['as'],'attributes':_0x2fb33c['attributes'],'include':_0x2fb33c[_0xc6a0('0x1d')]?_[_0xc6a0('0x1e')](_0x2fb33c[_0xc6a0('0x1d')],function(_0x2a4502){return{'model':db[_0x2a4502[_0xc6a0('0x1f')]],'as':_0x2a4502['as'],'attributes':_0x2a4502[_0xc6a0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5937af){logger['info'](_0xc6a0('0x20'),_0x245ff4);logger[_0xc6a0('0x11')](_0xc6a0('0x20'),_0x245ff4,JSON[_0xc6a0('0x21')](_0x5937af));_0x1e683e(_0x5937af);})['catch'](function(_0x12d100){logger[_0xc6a0('0x13')](_0xc6a0('0x20'),_0x12d100[_0xc6a0('0x14')],_0x245ff4);_0x14ff2e(_0x5d7c70[_0xc6a0('0x13')](0x1f4,_0x12d100[_0xc6a0('0x14')]));});});};exports[_0xc6a0('0x22')]=function(_0x2af09f){var _0x4f045d=this;return new Promise(function(_0x5ccd35,_0x3c75f9){return db['OpenchannelQueue'][_0xc6a0('0x23')]({'raw':_0x2af09f[_0xc6a0('0x18')]?_0x2af09f[_0xc6a0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2af09f[_0xc6a0('0x18')]?_0x2af09f[_0xc6a0('0x18')][_0xc6a0('0x1a')]||null:null,'attributes':_0x2af09f[_0xc6a0('0x18')]?_0x2af09f[_0xc6a0('0x18')][_0xc6a0('0x1b')]||null:null,'include':_0x2af09f[_0xc6a0('0x18')]?_0x2af09f['options'][_0xc6a0('0x1d')]?_[_0xc6a0('0x1e')](_0x2af09f[_0xc6a0('0x18')][_0xc6a0('0x1d')],function(_0x30ede7){return{'model':db[_0x30ede7['model']],'as':_0x30ede7['as'],'attributes':_0x30ede7[_0xc6a0('0x1b')],'include':_0x30ede7[_0xc6a0('0x1d')]?_[_0xc6a0('0x1e')](_0x30ede7[_0xc6a0('0x1d')],function(_0x2e7c52){return{'model':db[_0x2e7c52['model']],'as':_0x2e7c52['as'],'attributes':_0x2e7c52[_0xc6a0('0x1b')],'include':_0x2e7c52[_0xc6a0('0x1d')]?_[_0xc6a0('0x1e')](_0x2e7c52[_0xc6a0('0x1d')],function(_0x4f6f90){return{'model':db[_0x4f6f90[_0xc6a0('0x1f')]],'as':_0x4f6f90['as'],'attributes':_0x4f6f90['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51e556){logger[_0xc6a0('0x15')](_0xc6a0('0x22'),_0x2af09f);logger[_0xc6a0('0x11')](_0xc6a0('0x22'),_0x2af09f,JSON[_0xc6a0('0x21')](_0x51e556));_0x5ccd35(_0x51e556);})[_0xc6a0('0x16')](function(_0x2ddc5b){logger[_0xc6a0('0x13')](_0xc6a0('0x22'),_0x2ddc5b['message'],_0x2af09f);_0x3c75f9(_0x4f045d[_0xc6a0('0x13')](0x1f4,_0x2ddc5b[_0xc6a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 4c2ef9b..61aaffe 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 _0xfb84=['update','emit','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x5c4587,_0x37f2a4){var _0x209263=function(_0x46ba5f){while(--_0x46ba5f){_0x5c4587['push'](_0x5c4587['shift']());}};_0x209263(++_0x37f2a4);}(_0xfb84,0x107));var _0x4fb8=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0xfb84[_0x28b7ab];return _0x56791b;};'use strict';var OpenchannelQueueEvents=require(_0x4fb8('0x0'));var events=[_0x4fb8('0x1'),'remove',_0x4fb8('0x2')];function createListener(_0xc2ffbc,_0x2cba1a){return function(_0x6abbc3){_0x2cba1a[_0x4fb8('0x3')](_0xc2ffbc,_0x6abbc3);};}function removeListener(_0x305969,_0x1e41a2){return function(){OpenchannelQueueEvents['removeListener'](_0x305969,_0x1e41a2);};}exports['register']=function(_0x566b05){for(var _0x5a9101=0x0,_0xf03c03=events['length'];_0x5a9101<_0xf03c03;_0x5a9101++){var _0x42a514=events[_0x5a9101];var _0x2cb901=createListener(_0x4fb8('0x4')+_0x42a514,_0x566b05);OpenchannelQueueEvents['on'](_0x42a514,_0x2cb901);}}; \ No newline at end of file +var _0x116a=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x339242,_0x527a0b){var _0x248068=function(_0x39a982){while(--_0x39a982){_0x339242['push'](_0x339242['shift']());}};_0x248068(++_0x527a0b);}(_0x116a,0x18b));var _0xa116=function(_0x5a951d,_0x52aaee){_0x5a951d=_0x5a951d-0x0;var _0x491800=_0x116a[_0x5a951d];return _0x491800;};'use strict';var OpenchannelQueueEvents=require(_0xa116('0x0'));var events=[_0xa116('0x1'),_0xa116('0x2'),_0xa116('0x3')];function createListener(_0x66dff1,_0x50f42a){return function(_0x65521d){_0x50f42a[_0xa116('0x4')](_0x66dff1,_0x65521d);};}function removeListener(_0x3ffe5d,_0x55a053){return function(){OpenchannelQueueEvents['removeListener'](_0x3ffe5d,_0x55a053);};}exports[_0xa116('0x5')]=function(_0xeeb8d7){for(var _0xa5cc70=0x0,_0x2884e8=events[_0xa116('0x6')];_0xa5cc70<_0x2884e8;_0xa5cc70++){var _0x324938=events[_0xa5cc70];var _0x569903=createListener(_0xa116('0x7')+_0x324938,_0xeeb8d7);OpenchannelQueueEvents['on'](_0x324938,_0x569903);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f406f4a..e5db7a9 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 _0x4b26=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b26,0xa6));var _0x64b2=function(_0x34665d,_0x872c51){_0x34665d=_0x34665d-0x0;var _0x299f04=_0x4b26[_0x34665d];return _0x299f04;};'use strict';var multer=require(_0x64b2('0x0'));var util=require(_0x64b2('0x1'));var path=require('path');var timeout=require(_0x64b2('0x2'));var express=require(_0x64b2('0x3'));var router=express[_0x64b2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x64b2('0x5'));var config=require(_0x64b2('0x6'));var controller=require(_0x64b2('0x7'));router[_0x64b2('0x8')]('/',auth[_0x64b2('0x9')](),controller[_0x64b2('0xa')]);router[_0x64b2('0x8')](_0x64b2('0xb'),auth[_0x64b2('0x9')](),controller[_0x64b2('0xc')]);router['get']('/:id',auth[_0x64b2('0x9')](),controller['show']);router[_0x64b2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x64b2('0xe')](_0x64b2('0xf'),auth[_0x64b2('0x9')](),controller[_0x64b2('0x10')]);router[_0x64b2('0x11')](_0x64b2('0xf'),auth[_0x64b2('0x9')](),controller['destroy']);module[_0x64b2('0x12')]=router; \ No newline at end of file +var _0x71af=['/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x36b3c3,_0x5233ff){var _0x1582be=function(_0x4d955b){while(--_0x4d955b){_0x36b3c3['push'](_0x36b3c3['shift']());}};_0x1582be(++_0x5233ff);}(_0x71af,0x1c1));var _0xf71a=function(_0x137dcb,_0x3607b0){_0x137dcb=_0x137dcb-0x0;var _0xe76ab5=_0x71af[_0x137dcb];return _0xe76ab5;};'use strict';var multer=require('multer');var util=require(_0xf71a('0x0'));var path=require(_0xf71a('0x1'));var timeout=require(_0xf71a('0x2'));var express=require(_0xf71a('0x3'));var router=express['Router']();var auth=require(_0xf71a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf71a('0x5'));var controller=require(_0xf71a('0x6'));router[_0xf71a('0x7')]('/',auth[_0xf71a('0x8')](),controller['index']);router[_0xf71a('0x7')](_0xf71a('0x9'),auth[_0xf71a('0x8')](),controller['describe']);router[_0xf71a('0x7')](_0xf71a('0xa'),auth['isAuthenticated'](),controller[_0xf71a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf71a('0xc')]);router['put']('/:id',auth[_0xf71a('0x8')](),controller[_0xf71a('0xd')]);router[_0xf71a('0xe')]('/:id',auth[_0xf71a('0x8')](),controller[_0xf71a('0xf')]);module[_0xf71a('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 3c5be85..84e6531 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 _0x77da=['DATE','moment','sequelize','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x77da,0xbf));var _0xa77d=function(_0x867a42,_0x738f07){_0x867a42=_0x867a42-0x0;var _0x1c51af=_0x77da[_0x867a42];return _0x1c51af;};'use strict';var moment=require(_0xa77d('0x0'));var Sequelize=require(_0xa77d('0x1'));module[_0xa77d('0x2')]={'uniqueid':{'type':Sequelize[_0xa77d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa77d('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa77d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa77d('0x4')]},'reason':{'type':Sequelize[_0xa77d('0x3')]}}; \ No newline at end of file +var _0x8290=['exports','STRING','DATE','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8290,0x18b));var _0x0829=function(_0x3b4226,_0x31950a){_0x3b4226=_0x3b4226-0x0;var _0x51e788=_0x8290[_0x3b4226];return _0x51e788;};'use strict';var moment=require('moment');var Sequelize=require(_0x0829('0x0'));module[_0x0829('0x1')]={'uniqueid':{'type':Sequelize[_0x0829('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0829('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0829('0x3')]},'acceptAt':{'type':Sequelize[_0x0829('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0829('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index bd4f121..e849bb4 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 _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','OpenchannelQueueReport','fieldName','type','key','query','keys','filters','intersection'];(function(_0x335bc7,_0x2feb4e){var _0x2a3fb1=function(_0x376029){while(--_0x376029){_0x335bc7['push'](_0x335bc7['shift']());}};_0x2a3fb1(++_0x2feb4e);}(_0x984b,0xee));var _0xb984=function(_0xe4f270,_0x315d18){_0xe4f270=_0xe4f270-0x0;var _0x44e466=_0x984b[_0xe4f270];return _0x44e466;};'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['OpenchannelQueueReport'][_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));};exports['describe']=function(_0x386faf,_0x36e411){return db[_0xb984('0x2a')]['describe']()[_0xb984('0x23')](respondWithResult(_0x36e411,null))[_0xb984('0x41')](handleError(_0x36e411,null));}; \ No newline at end of file +var _0x80c7=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x15d656,_0x12085e){var _0x1f8ea1=function(_0x7d76b3){while(--_0x7d76b3){_0x15d656['push'](_0x15d656['shift']());}};_0x1f8ea1(++_0x12085e);}(_0x80c7,0x8d));var _0x780c=function(_0x4d8365,_0xece07){_0x4d8365=_0x4d8365-0x0;var _0x1168b5=_0x80c7[_0x4d8365];return _0x1168b5;};'use strict';var pdf=require(_0x780c('0x0'));var emlformat=require(_0x780c('0x1'));var rimraf=require(_0x780c('0x2'));var zipdir=require(_0x780c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x780c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x780c('0x5'));var util=require(_0x780c('0x6'));var path=require(_0x780c('0x7'));var sox=require(_0x780c('0x8'));var csv=require(_0x780c('0x9'));var ejs=require(_0x780c('0xa'));var fs=require('fs');var _=require(_0x780c('0xb'));var squel=require(_0x780c('0xc'));var crypto=require(_0x780c('0xd'));var jsforce=require(_0x780c('0xe'));var deskjs=require(_0x780c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x780c('0x10'));var Papa=require(_0x780c('0x11'));var Redis=require('ioredis');var authService=require(_0x780c('0x12'));var qs=require(_0x780c('0x13'));var as=require(_0x780c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x780c('0x15'))(_0x780c('0x16'));var utils=require(_0x780c('0x17'));var config=require(_0x780c('0x18'));var licenseUtil=require(_0x780c('0x19'));var db=require(_0x780c('0x1a'))['db'];function respondWithStatusCode(_0x2b09af,_0x5a5986){_0x5a5986=_0x5a5986||0xcc;return function(_0x3aaa99){if(_0x3aaa99){return _0x2b09af[_0x780c('0x1b')](_0x5a5986);}return _0x2b09af[_0x780c('0x1c')](_0x5a5986)[_0x780c('0x1d')]();};}function respondWithResult(_0x5576e9,_0x4ea5df){_0x4ea5df=_0x4ea5df||0xc8;return function(_0x244934){if(_0x244934){return _0x5576e9[_0x780c('0x1c')](_0x4ea5df)['json'](_0x244934);}};}function respondWithFilteredResult(_0x5b74fb,_0x2c8c23){return function(_0xccd8c){if(_0xccd8c){var _0x21b69b=_0xccd8c['count'],_0x2f99d8=_0x2c8c23[_0x780c('0x1e')],_0x101b20=_0x2c8c23[_0x780c('0x1e')]+_0x2c8c23[_0x780c('0x1f')],_0x33c514;if(_0x101b20>=_0x21b69b){_0x101b20=_0x21b69b;_0x33c514=0xc8;}else{_0x33c514=0xce;}_0x5b74fb[_0x780c('0x1c')](_0x33c514);return _0x5b74fb['set'](_0x780c('0x20'),_0x2f99d8+'-'+_0x101b20+'/'+_0x21b69b)[_0x780c('0x21')](_0xccd8c);}return null;};}function patchUpdates(_0x1f696c){return function(_0x3d5269){try{jsonpatch['apply'](_0x3d5269,_0x1f696c,!![]);}catch(_0x416c56){return BPromise[_0x780c('0x22')](_0x416c56);}return _0x3d5269['save']();};}function saveUpdates(_0x4f665d,_0x5cccd3){return function(_0x31cf45){if(_0x31cf45){return _0x31cf45[_0x780c('0x23')](_0x4f665d)[_0x780c('0x24')](function(_0x2935d4){return _0x2935d4;});}return null;};}function removeEntity(_0x444905,_0x21e720){return function(_0x2c66c5){if(_0x2c66c5){return _0x2c66c5[_0x780c('0x25')]()[_0x780c('0x24')](function(){_0x444905[_0x780c('0x1c')](0xcc)[_0x780c('0x1d')]();});}};}function handleEntityNotFound(_0x55fc81,_0x226f7b){return function(_0x252127){if(!_0x252127){_0x55fc81[_0x780c('0x1b')](0x194);}return _0x252127;};}function handleError(_0x54d835,_0x3c7db0){_0x3c7db0=_0x3c7db0||0x1f4;return function(_0x121199){logger[_0x780c('0x26')](_0x121199[_0x780c('0x27')]);if(_0x121199[_0x780c('0x28')]){delete _0x121199[_0x780c('0x28')];}_0x54d835['status'](_0x3c7db0)[_0x780c('0x29')](_0x121199);};}exports[_0x780c('0x2a')]=function(_0x207dc8,_0x56ca81){var _0x2d9702={},_0xcfc565={},_0x3be361={'count':0x0,'rows':[]};var _0x436fca=_[_0x780c('0x2b')](db[_0x780c('0x2c')][_0x780c('0x2d')],function(_0x35b97a){return{'name':_0x35b97a[_0x780c('0x2e')],'type':_0x35b97a[_0x780c('0x2f')][_0x780c('0x30')]};});_0xcfc565[_0x780c('0x31')]=_[_0x780c('0x2b')](_0x436fca,_0x780c('0x28'));_0xcfc565['query']=_[_0x780c('0x32')](_0x207dc8[_0x780c('0x33')]);_0xcfc565[_0x780c('0x34')]=_[_0x780c('0x35')](_0xcfc565[_0x780c('0x31')],_0xcfc565[_0x780c('0x33')]);_0x2d9702['attributes']=_[_0x780c('0x35')](_0xcfc565[_0x780c('0x31')],qs[_0x780c('0x36')](_0x207dc8[_0x780c('0x33')]['fields']));_0x2d9702['attributes']=_0x2d9702[_0x780c('0x37')][_0x780c('0x38')]?_0x2d9702['attributes']:_0xcfc565['model'];if(!_0x207dc8['query'][_0x780c('0x39')](_0x780c('0x3a'))){_0x2d9702[_0x780c('0x1f')]=qs['limit'](_0x207dc8[_0x780c('0x33')]['limit']);_0x2d9702['offset']=qs[_0x780c('0x1e')](_0x207dc8[_0x780c('0x33')][_0x780c('0x1e')]);}_0x2d9702[_0x780c('0x3b')]=qs[_0x780c('0x3c')](_0x207dc8[_0x780c('0x33')]['sort']);_0x2d9702[_0x780c('0x3d')]=qs[_0x780c('0x34')](_['pick'](_0x207dc8['query'],_0xcfc565[_0x780c('0x34')]),_0x436fca);if(_0x207dc8[_0x780c('0x33')][_0x780c('0x3e')]){_0x2d9702[_0x780c('0x3d')]=_[_0x780c('0x3f')](_0x2d9702[_0x780c('0x3d')],{'$or':_[_0x780c('0x2b')](_0x436fca,function(_0x328ff1){if(_0x328ff1[_0x780c('0x2f')]!==_0x780c('0x40')){var _0x5191a7={};_0x5191a7[_0x328ff1[_0x780c('0x28')]]={'$like':'%'+_0x207dc8[_0x780c('0x33')]['filter']+'%'};return _0x5191a7;}})});}_0x2d9702=_[_0x780c('0x3f')]({},_0x2d9702,_0x207dc8[_0x780c('0x41')]);var _0x55ab16={'where':_0x2d9702[_0x780c('0x3d')]};return db['OpenchannelQueueReport'][_0x780c('0x42')](_0x55ab16)[_0x780c('0x24')](function(_0x1cb136){_0x3be361['count']=_0x1cb136;if(_0x207dc8['query'][_0x780c('0x43')]){_0x2d9702[_0x780c('0x44')]=[{'all':!![]}];}return db[_0x780c('0x2c')][_0x780c('0x45')](_0x2d9702);})[_0x780c('0x24')](function(_0x476283){_0x3be361[_0x780c('0x46')]=_0x476283;return _0x3be361;})[_0x780c('0x24')](respondWithFilteredResult(_0x56ca81,_0x2d9702))['catch'](handleError(_0x56ca81,null));};exports[_0x780c('0x47')]=function(_0xb1898d,_0x5db660){var _0x22ceda={'raw':!![],'where':{'id':_0xb1898d[_0x780c('0x48')]['id']}},_0x40bb7c={};_0x40bb7c['model']=_[_0x780c('0x32')](db[_0x780c('0x2c')][_0x780c('0x2d')]);_0x40bb7c['query']=_['keys'](_0xb1898d[_0x780c('0x33')]);_0x40bb7c[_0x780c('0x34')]=_[_0x780c('0x35')](_0x40bb7c[_0x780c('0x31')],_0x40bb7c[_0x780c('0x33')]);_0x22ceda[_0x780c('0x37')]=_[_0x780c('0x35')](_0x40bb7c['model'],qs['fields'](_0xb1898d[_0x780c('0x33')][_0x780c('0x36')]));_0x22ceda[_0x780c('0x37')]=_0x22ceda[_0x780c('0x37')][_0x780c('0x38')]?_0x22ceda[_0x780c('0x37')]:_0x40bb7c[_0x780c('0x31')];if(_0xb1898d[_0x780c('0x33')]['includeAll']){_0x22ceda[_0x780c('0x44')]=[{'all':!![]}];}_0x22ceda=_[_0x780c('0x3f')]({},_0x22ceda,_0xb1898d[_0x780c('0x41')]);return db['OpenchannelQueueReport']['find'](_0x22ceda)[_0x780c('0x24')](handleEntityNotFound(_0x5db660,null))[_0x780c('0x24')](respondWithResult(_0x5db660,null))[_0x780c('0x49')](handleError(_0x5db660,null));};exports[_0x780c('0x4a')]=function(_0x2d4245,_0x4979b8){return db[_0x780c('0x2c')][_0x780c('0x4a')](_0x2d4245['body'],{})['then'](respondWithResult(_0x4979b8,0xc9))[_0x780c('0x49')](handleError(_0x4979b8,null));};exports['update']=function(_0x545ebf,_0x5105ce){if(_0x545ebf[_0x780c('0x4b')]['id']){delete _0x545ebf['body']['id'];}return db[_0x780c('0x2c')]['find']({'where':{'id':_0x545ebf[_0x780c('0x48')]['id']}})['then'](handleEntityNotFound(_0x5105ce,null))[_0x780c('0x24')](saveUpdates(_0x545ebf[_0x780c('0x4b')],null))[_0x780c('0x24')](respondWithResult(_0x5105ce,null))[_0x780c('0x49')](handleError(_0x5105ce,null));};exports[_0x780c('0x25')]=function(_0x44c883,_0x1feb67){return db[_0x780c('0x2c')]['find']({'where':{'id':_0x44c883[_0x780c('0x48')]['id']}})[_0x780c('0x24')](handleEntityNotFound(_0x1feb67,null))[_0x780c('0x24')](removeEntity(_0x1feb67,null))['catch'](handleError(_0x1feb67,null));};exports[_0x780c('0x4c')]=function(_0x243c00,_0x4ef11e){return db[_0x780c('0x2c')][_0x780c('0x4c')]()[_0x780c('0x24')](respondWithResult(_0x4ef11e,null))['catch'](handleError(_0x4ef11e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ebee102..a6df8ce 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 _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','OpenchannelQueueReport','report_openchannel_queue','lodash','../../config/logger','moment'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xa8eb,0x179));var _0xba8e=function(_0x3f4a71,_0x367d39){_0x3f4a71=_0x3f4a71-0x0;var _0xee8f88=_0xa8eb[_0x3f4a71];return _0xee8f88;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./openchannelQueueReport.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2494=['api','moment','bluebird','request-promise','path','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','lodash','../../config/logger'];(function(_0x4f4b89,_0xb0b8b4){var _0x12a322=function(_0x586c01){while(--_0x586c01){_0x4f4b89['push'](_0x4f4b89['shift']());}};_0x12a322(++_0xb0b8b4);}(_0x2494,0x82));var _0x4249=function(_0x55c442,_0x38b5a0){_0x55c442=_0x55c442-0x0;var _0x1f9a14=_0x2494[_0x55c442];return _0x1f9a14;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('OpenchannelQueueReport',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[{'name':_0x4249('0xa'),'fields':[_0x4249('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5f55497..452fcb9 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 _0xceeb=['limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xceeb,0x140));var _0xbcee=function(_0xb6bdaf,_0x2b917f){_0xb6bdaf=_0xb6bdaf-0x0;var _0x2e98ab=_0xceeb[_0xb6bdaf];return _0x2e98ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbcee('0x0'));var rs=require(_0xbcee('0x1'));var fs=require('fs');var Redis=require(_0xbcee('0x2'));var db=require(_0xbcee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcee('0x4'))(_0xbcee('0x5'));var config=require(_0xbcee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbcee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3932da,_0x51190c,_0x2311d0){return new BPromise(function(_0x519d92,_0x176ca5){return client['request'](_0x3932da,_0x2311d0)[_0xbcee('0x8')](function(_0x4153b0){logger[_0xbcee('0x9')](_0xbcee('0xa'),_0x51190c,_0xbcee('0xb'));logger[_0xbcee('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x51190c,_0xbcee('0xb'),JSON[_0xbcee('0xd')](_0x4153b0));if(_0x4153b0[_0xbcee('0xe')]){if(_0x4153b0[_0xbcee('0xe')][_0xbcee('0xf')]===0x1f4){logger[_0xbcee('0xe')](_0xbcee('0xa'),_0x51190c,_0x4153b0[_0xbcee('0xe')][_0xbcee('0x10')]);return _0x176ca5(_0x4153b0[_0xbcee('0xe')]['message']);}logger[_0xbcee('0xe')](_0xbcee('0xa'),_0x51190c,_0x4153b0['error'][_0xbcee('0x10')]);return _0x519d92(_0x4153b0['error'][_0xbcee('0x10')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x51190c,_0xbcee('0xb'));_0x519d92(_0x4153b0[_0xbcee('0x11')]['message']);}})[_0xbcee('0x12')](function(_0x581dab){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x51190c,_0x581dab);_0x176ca5(_0x581dab);});});}exports[_0xbcee('0x13')]=function(_0x387d09){var _0x34f621=this;return new Promise(function(_0x3151f7,_0x4356df){return db['OpenchannelQueueReport']['create'](_0x387d09[_0xbcee('0x14')],{'raw':_0x387d09[_0xbcee('0x15')]?_0x387d09[_0xbcee('0x15')][_0xbcee('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1cbd1e){logger[_0xbcee('0x9')]('CreateOpenchannelQueueReport',_0x387d09);logger[_0xbcee('0xc')](_0xbcee('0x13'),_0x387d09,JSON['stringify'](_0x1cbd1e));_0x3151f7(_0x1cbd1e);})[_0xbcee('0x12')](function(_0xa91aaf){logger[_0xbcee('0xe')](_0xbcee('0x13'),_0xa91aaf[_0xbcee('0x10')],_0x387d09);_0x4356df(_0x34f621['error'](0x1f4,_0xa91aaf['message']));});});};exports[_0xbcee('0x17')]=function(_0x468759){var _0x597000=this;return new Promise(function(_0x1c8a66,_0x56a593){return db[_0xbcee('0x18')][_0xbcee('0x19')](_0x468759['body'],{'raw':_0x468759['options']?_0x468759[_0xbcee('0x15')][_0xbcee('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x468759['options']?_0x468759['options'][_0xbcee('0x1a')]||null:null,'attributes':_0x468759['options']?_0x468759[_0xbcee('0x15')][_0xbcee('0x1b')]||null:null,'limit':_0x468759[_0xbcee('0x15')]?_0x468759[_0xbcee('0x15')][_0xbcee('0x1c')]||null:null})[_0xbcee('0x8')](function(_0x3a6f17){logger[_0xbcee('0x9')](_0xbcee('0x17'),_0x468759);logger['debug'](_0xbcee('0x17'),_0x468759,JSON[_0xbcee('0xd')](_0x3a6f17));_0x1c8a66(_0x3a6f17);})[_0xbcee('0x12')](function(_0x4bcb98){logger[_0xbcee('0xe')](_0xbcee('0x17'),_0x4bcb98[_0xbcee('0x10')],_0x468759);_0x56a593(_0x597000[_0xbcee('0xe')](0x1f4,_0x4bcb98['message']));});});}; \ No newline at end of file +var _0x2a79=['debug','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','info'];(function(_0x2077f5,_0x3d7512){var _0xc2ab76=function(_0x5b2542){while(--_0x5b2542){_0x2077f5['push'](_0x2077f5['shift']());}};_0xc2ab76(++_0x3d7512);}(_0x2a79,0x13d));var _0x92a7=function(_0x49bbde,_0x5260f7){_0x49bbde=_0x49bbde-0x0;var _0x3e521a=_0x2a79[_0x49bbde];return _0x3e521a;};'use strict';var _=require('lodash');var util=require(_0x92a7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x92a7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92a7('0x2'))['db'];var utils=require(_0x92a7('0x3'));var logger=require(_0x92a7('0x4'))(_0x92a7('0x5'));var config=require(_0x92a7('0x6'));var jayson=require(_0x92a7('0x7'));var client=jayson['client'][_0x92a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3285c5,_0x12e5dc,_0x10cd85){return new BPromise(function(_0x295d42,_0x4fcdfa){return client[_0x92a7('0x9')](_0x3285c5,_0x10cd85)[_0x92a7('0xa')](function(_0x5cd6f7){logger['info'](_0x92a7('0xb'),_0x12e5dc,'request\x20sent');logger['debug'](_0x92a7('0xc'),_0x12e5dc,_0x92a7('0xd'),JSON[_0x92a7('0xe')](_0x5cd6f7));if(_0x5cd6f7['error']){if(_0x5cd6f7['error']['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x12e5dc,_0x5cd6f7['error']['message']);return _0x4fcdfa(_0x5cd6f7['error'][_0x92a7('0xf')]);}logger[_0x92a7('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12e5dc,_0x5cd6f7[_0x92a7('0x10')][_0x92a7('0xf')]);return _0x295d42(_0x5cd6f7[_0x92a7('0x10')][_0x92a7('0xf')]);}else{logger['info'](_0x92a7('0xb'),_0x12e5dc,_0x92a7('0xd'));_0x295d42(_0x5cd6f7['result'][_0x92a7('0xf')]);}})[_0x92a7('0x11')](function(_0x2ffc03){logger['error'](_0x92a7('0xb'),_0x12e5dc,_0x2ffc03);_0x4fcdfa(_0x2ffc03);});});}exports[_0x92a7('0x12')]=function(_0x2ecdf1){var _0x326dd2=this;return new Promise(function(_0x2332d8,_0x5b0569){return db[_0x92a7('0x13')][_0x92a7('0x14')](_0x2ecdf1['body'],{'raw':_0x2ecdf1['options']?_0x2ecdf1[_0x92a7('0x15')][_0x92a7('0x16')]===undefined?!![]:![]:!![]})[_0x92a7('0xa')](function(_0x206463){logger[_0x92a7('0x17')](_0x92a7('0x12'),_0x2ecdf1);logger[_0x92a7('0x18')](_0x92a7('0x12'),_0x2ecdf1,JSON[_0x92a7('0xe')](_0x206463));_0x2332d8(_0x206463);})[_0x92a7('0x11')](function(_0x356c21){logger[_0x92a7('0x10')]('CreateOpenchannelQueueReport',_0x356c21[_0x92a7('0xf')],_0x2ecdf1);_0x5b0569(_0x326dd2[_0x92a7('0x10')](0x1f4,_0x356c21['message']));});});};exports[_0x92a7('0x19')]=function(_0x460259){var _0x183739=this;return new Promise(function(_0x2ea18d,_0x450602){return db[_0x92a7('0x13')][_0x92a7('0x1a')](_0x460259[_0x92a7('0x1b')],{'raw':_0x460259[_0x92a7('0x15')]?_0x460259[_0x92a7('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460259[_0x92a7('0x15')]?_0x460259[_0x92a7('0x15')][_0x92a7('0x1c')]||null:null,'attributes':_0x460259[_0x92a7('0x15')]?_0x460259['options'][_0x92a7('0x1d')]||null:null,'limit':_0x460259['options']?_0x460259[_0x92a7('0x15')][_0x92a7('0x1e')]||null:null})['then'](function(_0x2e18c5){logger['info'](_0x92a7('0x19'),_0x460259);logger[_0x92a7('0x18')](_0x92a7('0x19'),_0x460259,JSON[_0x92a7('0xe')](_0x2e18c5));_0x2ea18d(_0x2e18c5);})['catch'](function(_0x1d9f73){logger['error']('UpdateOpenchannelQueueReport',_0x1d9f73[_0x92a7('0xf')],_0x460259);_0x450602(_0x183739[_0x92a7('0x10')](0x1f4,_0x1d9f73[_0x92a7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6dea26e..f638796 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(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 ac74cd8..5c24ea2 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 _0xea1b=['DATE','NOW','moment','sequelize','exports','ENUM','account','queue'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0xea1b,0xc2));var _0xbea1=function(_0x4def16,_0x5da0d5){_0x4def16=_0x4def16-0x0;var _0x5e3bc1=_0xea1b[_0x4def16];return _0x5e3bc1;};'use strict';var moment=require(_0xbea1('0x0'));var Sequelize=require(_0xbea1('0x1'));module[_0xbea1('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbea1('0x3')](_0xbea1('0x4'),'agent',_0xbea1('0x5')),'allowNull':![],'defaultValue':_0xbea1('0x5')},'transferredAt':{'type':Sequelize[_0xbea1('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbea1('0x7')]}}; \ No newline at end of file +var _0x5fdb=['exports','STRING','ENUM','account','queue','NOW','moment','sequelize'];(function(_0x3bf279,_0x42ff3f){var _0x1f67c5=function(_0x4b53ea){while(--_0x4b53ea){_0x3bf279['push'](_0x3bf279['shift']());}};_0x1f67c5(++_0x42ff3f);}(_0x5fdb,0x156));var _0xb5fd=function(_0xc234a8,_0x40c7c2){_0xc234a8=_0xc234a8-0x0;var _0x270b55=_0x5fdb[_0xc234a8];return _0x270b55;};'use strict';var moment=require(_0xb5fd('0x0'));var Sequelize=require(_0xb5fd('0x1'));module[_0xb5fd('0x2')]={'uniqueid':{'type':Sequelize[_0xb5fd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fd('0x4')](_0xb5fd('0x5'),'agent',_0xb5fd('0x6')),'allowNull':![],'defaultValue':_0xb5fd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb5fd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index af74e2a..de47d04 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 _0x6617=['show','params','keys','intersection','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','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','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch'];(function(_0x571bbc,_0x242132){var _0x3e8edb=function(_0x5cc0a2){while(--_0x5cc0a2){_0x571bbc['push'](_0x571bbc['shift']());}};_0x3e8edb(++_0x242132);}(_0x6617,0x9d));var _0x7661=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x6617[_0x231a47];return _0x48d7c9;};'use strict';var pdf=require(_0x7661('0x0'));var emlformat=require(_0x7661('0x1'));var rimraf=require(_0x7661('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7661('0x3'));var moment=require(_0x7661('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7661('0x5'));var path=require(_0x7661('0x6'));var sox=require('sox');var csv=require(_0x7661('0x7'));var ejs=require(_0x7661('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7661('0x9'));var crypto=require(_0x7661('0xa'));var jsforce=require(_0x7661('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7661('0x7'));var querystring=require('querystring');var Papa=require(_0x7661('0xc'));var Redis=require(_0x7661('0xd'));var authService=require(_0x7661('0xe'));var qs=require(_0x7661('0xf'));var as=require(_0x7661('0x10'));var hardwareService=require(_0x7661('0x11'));var logger=require(_0x7661('0x12'))('api');var utils=require(_0x7661('0x13'));var config=require(_0x7661('0x14'));var licenseUtil=require(_0x7661('0x15'));var db=require(_0x7661('0x16'))['db'];function respondWithStatusCode(_0x8090b2,_0x1f9049){_0x1f9049=_0x1f9049||0xcc;return function(_0x4fe486){if(_0x4fe486){return _0x8090b2[_0x7661('0x17')](_0x1f9049);}return _0x8090b2[_0x7661('0x18')](_0x1f9049)[_0x7661('0x19')]();};}function respondWithResult(_0x453947,_0xba4b5f){_0xba4b5f=_0xba4b5f||0xc8;return function(_0x189ac0){if(_0x189ac0){return _0x453947['status'](_0xba4b5f)[_0x7661('0x1a')](_0x189ac0);}};}function respondWithFilteredResult(_0x467bcc,_0x48a548){return function(_0x28723b){if(_0x28723b){var _0x2628a2=_0x28723b['count'],_0x2a9045=_0x48a548[_0x7661('0x1b')],_0x3637b7=_0x48a548[_0x7661('0x1b')]+_0x48a548[_0x7661('0x1c')],_0x31b4fb;if(_0x3637b7>=_0x2628a2){_0x3637b7=_0x2628a2;_0x31b4fb=0xc8;}else{_0x31b4fb=0xce;}_0x467bcc[_0x7661('0x18')](_0x31b4fb);return _0x467bcc['set'](_0x7661('0x1d'),_0x2a9045+'-'+_0x3637b7+'/'+_0x2628a2)[_0x7661('0x1a')](_0x28723b);}return null;};}function patchUpdates(_0x5a01cc){return function(_0x48d099){try{jsonpatch[_0x7661('0x1e')](_0x48d099,_0x5a01cc,!![]);}catch(_0x304f90){return BPromise['reject'](_0x304f90);}return _0x48d099[_0x7661('0x1f')]();};}function saveUpdates(_0x76ad13,_0x3e974d){return function(_0x33e7fa){if(_0x33e7fa){return _0x33e7fa[_0x7661('0x20')](_0x76ad13)[_0x7661('0x21')](function(_0x16a242){return _0x16a242;});}return null;};}function removeEntity(_0x19b617,_0x3beb16){return function(_0x3fd6d1){if(_0x3fd6d1){return _0x3fd6d1['destroy']()['then'](function(){_0x19b617[_0x7661('0x18')](0xcc)[_0x7661('0x19')]();});}};}function handleEntityNotFound(_0x28e236,_0xb506a2){return function(_0x6495ab){if(!_0x6495ab){_0x28e236[_0x7661('0x17')](0x194);}return _0x6495ab;};}function handleError(_0x2b879b,_0xb57697){_0xb57697=_0xb57697||0x1f4;return function(_0x1375cf){logger[_0x7661('0x22')](_0x1375cf[_0x7661('0x23')]);if(_0x1375cf['name']){delete _0x1375cf[_0x7661('0x24')];}_0x2b879b[_0x7661('0x18')](_0xb57697)[_0x7661('0x25')](_0x1375cf);};}exports[_0x7661('0x26')]=function(_0x3d561c,_0x16eed0){var _0x42de3c={},_0x53108d={},_0x468637={'count':0x0,'rows':[]};var _0x2aeba3=_['map'](db[_0x7661('0x27')][_0x7661('0x28')],function(_0x101220){return{'name':_0x101220[_0x7661('0x29')],'type':_0x101220[_0x7661('0x2a')][_0x7661('0x2b')]};});_0x53108d['model']=_['map'](_0x2aeba3,_0x7661('0x24'));_0x53108d[_0x7661('0x2c')]=_['keys'](_0x3d561c[_0x7661('0x2c')]);_0x53108d[_0x7661('0x2d')]=_['intersection'](_0x53108d[_0x7661('0x2e')],_0x53108d[_0x7661('0x2c')]);_0x42de3c['attributes']=_['intersection'](_0x53108d['model'],qs[_0x7661('0x2f')](_0x3d561c['query'][_0x7661('0x2f')]));_0x42de3c[_0x7661('0x30')]=_0x42de3c[_0x7661('0x30')][_0x7661('0x31')]?_0x42de3c['attributes']:_0x53108d[_0x7661('0x2e')];if(!_0x3d561c[_0x7661('0x2c')][_0x7661('0x32')](_0x7661('0x33'))){_0x42de3c[_0x7661('0x1c')]=qs[_0x7661('0x1c')](_0x3d561c[_0x7661('0x2c')][_0x7661('0x1c')]);_0x42de3c[_0x7661('0x1b')]=qs[_0x7661('0x1b')](_0x3d561c[_0x7661('0x2c')]['offset']);}_0x42de3c['order']=qs[_0x7661('0x34')](_0x3d561c[_0x7661('0x2c')]['sort']);_0x42de3c['where']=qs[_0x7661('0x2d')](_['pick'](_0x3d561c['query'],_0x53108d['filters']),_0x2aeba3);if(_0x3d561c[_0x7661('0x2c')][_0x7661('0x35')]){_0x42de3c[_0x7661('0x36')]=_[_0x7661('0x37')](_0x42de3c[_0x7661('0x36')],{'$or':_[_0x7661('0x38')](_0x2aeba3,function(_0x201b0c){if(_0x201b0c[_0x7661('0x2a')]!==_0x7661('0x39')){var _0xdcc2e5={};_0xdcc2e5[_0x201b0c[_0x7661('0x24')]]={'$like':'%'+_0x3d561c[_0x7661('0x2c')]['filter']+'%'};return _0xdcc2e5;}})});}_0x42de3c=_[_0x7661('0x37')]({},_0x42de3c,_0x3d561c[_0x7661('0x3a')]);var _0xfb37ee={'where':_0x42de3c[_0x7661('0x36')]};return db[_0x7661('0x27')][_0x7661('0x3b')](_0xfb37ee)['then'](function(_0x4f279e){_0x468637[_0x7661('0x3b')]=_0x4f279e;if(_0x3d561c[_0x7661('0x2c')][_0x7661('0x3c')]){_0x42de3c[_0x7661('0x3d')]=[{'all':!![]}];}return db[_0x7661('0x27')][_0x7661('0x3e')](_0x42de3c);})[_0x7661('0x21')](function(_0x411428){_0x468637[_0x7661('0x3f')]=_0x411428;return _0x468637;})[_0x7661('0x21')](respondWithFilteredResult(_0x16eed0,_0x42de3c))[_0x7661('0x40')](handleError(_0x16eed0,null));};exports[_0x7661('0x41')]=function(_0x51067d,_0x262d82){var _0xf4c7f2={'raw':!![],'where':{'id':_0x51067d[_0x7661('0x42')]['id']}},_0x133834={};_0x133834[_0x7661('0x2e')]=_['keys'](db[_0x7661('0x27')][_0x7661('0x28')]);_0x133834[_0x7661('0x2c')]=_[_0x7661('0x43')](_0x51067d[_0x7661('0x2c')]);_0x133834[_0x7661('0x2d')]=_[_0x7661('0x44')](_0x133834[_0x7661('0x2e')],_0x133834['query']);_0xf4c7f2[_0x7661('0x30')]=_[_0x7661('0x44')](_0x133834[_0x7661('0x2e')],qs['fields'](_0x51067d[_0x7661('0x2c')][_0x7661('0x2f')]));_0xf4c7f2[_0x7661('0x30')]=_0xf4c7f2[_0x7661('0x30')][_0x7661('0x31')]?_0xf4c7f2[_0x7661('0x30')]:_0x133834[_0x7661('0x2e')];if(_0x51067d['query'][_0x7661('0x3c')]){_0xf4c7f2[_0x7661('0x3d')]=[{'all':!![]}];}_0xf4c7f2=_[_0x7661('0x37')]({},_0xf4c7f2,_0x51067d[_0x7661('0x3a')]);return db['OpenchannelTransferReport']['find'](_0xf4c7f2)[_0x7661('0x21')](handleEntityNotFound(_0x262d82,null))[_0x7661('0x21')](respondWithResult(_0x262d82,null))[_0x7661('0x40')](handleError(_0x262d82,null));};exports[_0x7661('0x45')]=function(_0x1803de,_0x5f5603){return db[_0x7661('0x27')][_0x7661('0x45')](_0x1803de[_0x7661('0x46')],{})[_0x7661('0x21')](respondWithResult(_0x5f5603,0xc9))[_0x7661('0x40')](handleError(_0x5f5603,null));};exports[_0x7661('0x20')]=function(_0x38c648,_0x3facc3){if(_0x38c648['body']['id']){delete _0x38c648['body']['id'];}return db[_0x7661('0x27')][_0x7661('0x47')]({'where':{'id':_0x38c648[_0x7661('0x42')]['id']}})[_0x7661('0x21')](handleEntityNotFound(_0x3facc3,null))[_0x7661('0x21')](saveUpdates(_0x38c648[_0x7661('0x46')],null))[_0x7661('0x21')](respondWithResult(_0x3facc3,null))[_0x7661('0x40')](handleError(_0x3facc3,null));};exports[_0x7661('0x48')]=function(_0x5652e3,_0x38f81b){return db[_0x7661('0x27')][_0x7661('0x47')]({'where':{'id':_0x5652e3[_0x7661('0x42')]['id']}})[_0x7661('0x21')](handleEntityNotFound(_0x38f81b,null))[_0x7661('0x21')](removeEntity(_0x38f81b,null))['catch'](handleError(_0x38f81b,null));};exports[_0x7661('0x49')]=function(_0x2852e4,_0x144b83){return db['OpenchannelTransferReport']['describe']()[_0x7661('0x21')](respondWithResult(_0x144b83,null))[_0x7661('0x40')](handleError(_0x144b83,null));}; \ No newline at end of file +var _0x334c=['key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','merge','options','includeAll','include','findAll','show','find','catch','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','limit','Content-Range','apply','save','then','destroy','sendStatus','stack','name','OpenchannelTransferReport','rawAttributes','fieldName','type'];(function(_0x2f059a,_0x376b34){var _0x4cb0a8=function(_0xc6cc0f){while(--_0xc6cc0f){_0x2f059a['push'](_0x2f059a['shift']());}};_0x4cb0a8(++_0x376b34);}(_0x334c,0x119));var _0xc334=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x334c[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc334('0x0'));var zipdir=require(_0xc334('0x1'));var jsonpatch=require(_0xc334('0x2'));var rp=require('request-promise');var moment=require(_0xc334('0x3'));var BPromise=require(_0xc334('0x4'));var Mustache=require('mustache');var util=require(_0xc334('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc334('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc334('0x7'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc334('0x8'));var Papa=require(_0xc334('0x9'));var Redis=require(_0xc334('0xa'));var authService=require(_0xc334('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc334('0xc'));var logger=require(_0xc334('0xd'))(_0xc334('0xe'));var utils=require(_0xc334('0xf'));var config=require(_0xc334('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xc334('0x11'))['db'];function respondWithStatusCode(_0x1099a8,_0x57ec1e){_0x57ec1e=_0x57ec1e||0xcc;return function(_0x3d8f95){if(_0x3d8f95){return _0x1099a8['sendStatus'](_0x57ec1e);}return _0x1099a8[_0xc334('0x12')](_0x57ec1e)['end']();};}function respondWithResult(_0xfcc3bf,_0x393cdd){_0x393cdd=_0x393cdd||0xc8;return function(_0x14744f){if(_0x14744f){return _0xfcc3bf[_0xc334('0x12')](_0x393cdd)[_0xc334('0x13')](_0x14744f);}};}function respondWithFilteredResult(_0x4097c5,_0x5b8022){return function(_0x59910b){if(_0x59910b){var _0x19f595=_0x59910b[_0xc334('0x14')],_0x4d4ab3=_0x5b8022['offset'],_0x1a138c=_0x5b8022['offset']+_0x5b8022[_0xc334('0x15')],_0x3939a6;if(_0x1a138c>=_0x19f595){_0x1a138c=_0x19f595;_0x3939a6=0xc8;}else{_0x3939a6=0xce;}_0x4097c5[_0xc334('0x12')](_0x3939a6);return _0x4097c5['set'](_0xc334('0x16'),_0x4d4ab3+'-'+_0x1a138c+'/'+_0x19f595)['json'](_0x59910b);}return null;};}function patchUpdates(_0x767c1d){return function(_0x2d8c8d){try{jsonpatch[_0xc334('0x17')](_0x2d8c8d,_0x767c1d,!![]);}catch(_0x103110){return BPromise['reject'](_0x103110);}return _0x2d8c8d[_0xc334('0x18')]();};}function saveUpdates(_0x1e18c2,_0x5b78c7){return function(_0x118acf){if(_0x118acf){return _0x118acf['update'](_0x1e18c2)[_0xc334('0x19')](function(_0x5a1f09){return _0x5a1f09;});}return null;};}function removeEntity(_0x2c1a86,_0x33e390){return function(_0x5583c0){if(_0x5583c0){return _0x5583c0[_0xc334('0x1a')]()[_0xc334('0x19')](function(){_0x2c1a86[_0xc334('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31486b,_0x1736e7){return function(_0x1a9a07){if(!_0x1a9a07){_0x31486b[_0xc334('0x1b')](0x194);}return _0x1a9a07;};}function handleError(_0x5d24c7,_0x5d1c47){_0x5d1c47=_0x5d1c47||0x1f4;return function(_0x4a563e){logger['error'](_0x4a563e[_0xc334('0x1c')]);if(_0x4a563e[_0xc334('0x1d')]){delete _0x4a563e[_0xc334('0x1d')];}_0x5d24c7[_0xc334('0x12')](_0x5d1c47)['send'](_0x4a563e);};}exports['index']=function(_0x1a274e,_0x3ab5b5){var _0x52b2e0={},_0x3f3072={},_0x1a275d={'count':0x0,'rows':[]};var _0x89fc2e=_['map'](db[_0xc334('0x1e')][_0xc334('0x1f')],function(_0x3c4068){return{'name':_0x3c4068[_0xc334('0x20')],'type':_0x3c4068[_0xc334('0x21')][_0xc334('0x22')]};});_0x3f3072[_0xc334('0x23')]=_[_0xc334('0x24')](_0x89fc2e,'name');_0x3f3072[_0xc334('0x25')]=_[_0xc334('0x26')](_0x1a274e[_0xc334('0x25')]);_0x3f3072[_0xc334('0x27')]=_[_0xc334('0x28')](_0x3f3072[_0xc334('0x23')],_0x3f3072[_0xc334('0x25')]);_0x52b2e0['attributes']=_[_0xc334('0x28')](_0x3f3072['model'],qs[_0xc334('0x29')](_0x1a274e[_0xc334('0x25')][_0xc334('0x29')]));_0x52b2e0[_0xc334('0x2a')]=_0x52b2e0[_0xc334('0x2a')][_0xc334('0x2b')]?_0x52b2e0[_0xc334('0x2a')]:_0x3f3072[_0xc334('0x23')];if(!_0x1a274e[_0xc334('0x25')][_0xc334('0x2c')](_0xc334('0x2d'))){_0x52b2e0[_0xc334('0x15')]=qs[_0xc334('0x15')](_0x1a274e[_0xc334('0x25')][_0xc334('0x15')]);_0x52b2e0['offset']=qs[_0xc334('0x2e')](_0x1a274e['query'][_0xc334('0x2e')]);}_0x52b2e0[_0xc334('0x2f')]=qs[_0xc334('0x30')](_0x1a274e[_0xc334('0x25')][_0xc334('0x30')]);_0x52b2e0['where']=qs['filters'](_[_0xc334('0x31')](_0x1a274e[_0xc334('0x25')],_0x3f3072[_0xc334('0x27')]),_0x89fc2e);if(_0x1a274e[_0xc334('0x25')]['filter']){_0x52b2e0['where']=_[_0xc334('0x32')](_0x52b2e0['where'],{'$or':_['map'](_0x89fc2e,function(_0x341bea){if(_0x341bea['type']!=='VIRTUAL'){var _0x481d4f={};_0x481d4f[_0x341bea[_0xc334('0x1d')]]={'$like':'%'+_0x1a274e['query']['filter']+'%'};return _0x481d4f;}})});}_0x52b2e0=_[_0xc334('0x32')]({},_0x52b2e0,_0x1a274e[_0xc334('0x33')]);var _0x4f40fc={'where':_0x52b2e0['where']};return db[_0xc334('0x1e')][_0xc334('0x14')](_0x4f40fc)['then'](function(_0x116247){_0x1a275d['count']=_0x116247;if(_0x1a274e[_0xc334('0x25')][_0xc334('0x34')]){_0x52b2e0[_0xc334('0x35')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc334('0x36')](_0x52b2e0);})[_0xc334('0x19')](function(_0x4c2cd7){_0x1a275d['rows']=_0x4c2cd7;return _0x1a275d;})[_0xc334('0x19')](respondWithFilteredResult(_0x3ab5b5,_0x52b2e0))['catch'](handleError(_0x3ab5b5,null));};exports[_0xc334('0x37')]=function(_0x2eaec9,_0x351d47){var _0x4fe5a3={'raw':!![],'where':{'id':_0x2eaec9['params']['id']}},_0x5020bf={};_0x5020bf[_0xc334('0x23')]=_[_0xc334('0x26')](db[_0xc334('0x1e')][_0xc334('0x1f')]);_0x5020bf['query']=_[_0xc334('0x26')](_0x2eaec9[_0xc334('0x25')]);_0x5020bf[_0xc334('0x27')]=_[_0xc334('0x28')](_0x5020bf[_0xc334('0x23')],_0x5020bf['query']);_0x4fe5a3[_0xc334('0x2a')]=_[_0xc334('0x28')](_0x5020bf['model'],qs[_0xc334('0x29')](_0x2eaec9[_0xc334('0x25')][_0xc334('0x29')]));_0x4fe5a3[_0xc334('0x2a')]=_0x4fe5a3[_0xc334('0x2a')][_0xc334('0x2b')]?_0x4fe5a3[_0xc334('0x2a')]:_0x5020bf[_0xc334('0x23')];if(_0x2eaec9[_0xc334('0x25')][_0xc334('0x34')]){_0x4fe5a3[_0xc334('0x35')]=[{'all':!![]}];}_0x4fe5a3=_[_0xc334('0x32')]({},_0x4fe5a3,_0x2eaec9[_0xc334('0x33')]);return db[_0xc334('0x1e')][_0xc334('0x38')](_0x4fe5a3)[_0xc334('0x19')](handleEntityNotFound(_0x351d47,null))[_0xc334('0x19')](respondWithResult(_0x351d47,null))[_0xc334('0x39')](handleError(_0x351d47,null));};exports[_0xc334('0x3a')]=function(_0x42efd8,_0x5d7d45){return db[_0xc334('0x1e')]['create'](_0x42efd8[_0xc334('0x3b')],{})[_0xc334('0x19')](respondWithResult(_0x5d7d45,0xc9))[_0xc334('0x39')](handleError(_0x5d7d45,null));};exports[_0xc334('0x3c')]=function(_0x7c6682,_0x1202d5){if(_0x7c6682[_0xc334('0x3b')]['id']){delete _0x7c6682[_0xc334('0x3b')]['id'];}return db[_0xc334('0x1e')][_0xc334('0x38')]({'where':{'id':_0x7c6682[_0xc334('0x3d')]['id']}})[_0xc334('0x19')](handleEntityNotFound(_0x1202d5,null))[_0xc334('0x19')](saveUpdates(_0x7c6682['body'],null))[_0xc334('0x19')](respondWithResult(_0x1202d5,null))[_0xc334('0x39')](handleError(_0x1202d5,null));};exports['destroy']=function(_0x25d223,_0x3ff44a){return db[_0xc334('0x1e')][_0xc334('0x38')]({'where':{'id':_0x25d223[_0xc334('0x3d')]['id']}})[_0xc334('0x19')](handleEntityNotFound(_0x3ff44a,null))[_0xc334('0x19')](removeEntity(_0x3ff44a,null))[_0xc334('0x39')](handleError(_0x3ff44a,null));};exports[_0xc334('0x3e')]=function(_0x1c0887,_0x4acf92){return db[_0xc334('0x1e')][_0xc334('0x3e')]()['then'](respondWithResult(_0x4acf92,null))[_0xc334('0x39')](handleError(_0x4acf92,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f8aab7e..c0f7a77 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 _0xdc83=['path','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43a17a,_0x4fc0aa){var _0x3aed05=function(_0x18fac9){while(--_0x18fac9){_0x43a17a['push'](_0x43a17a['shift']());}};_0x3aed05(++_0x4fc0aa);}(_0xdc83,0x103));var _0x3dc8=function(_0x8ddd56,_0x10f63c){_0x8ddd56=_0x8ddd56-0x0;var _0x5668f8=_0xdc83[_0x8ddd56];return _0x5668f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3dc8('0x0'))(_0x3dc8('0x1'));var moment=require(_0x3dc8('0x2'));var BPromise=require(_0x3dc8('0x3'));var rp=require(_0x3dc8('0x4'));var fs=require('fs');var path=require(_0x3dc8('0x5'));var rimraf=require('rimraf');var config=require(_0x3dc8('0x6'));var attributes=require(_0x3dc8('0x7'));module['exports']=function(_0x1abd8e,_0x583c8b){return _0x1abd8e['define'](_0x3dc8('0x8'),attributes,{'tableName':_0x3dc8('0x9'),'paranoid':![],'indexes':[{'name':_0x3dc8('0xa'),'fields':[_0x3dc8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36da=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x455f19,_0x4f8f3a){var _0x422f21=function(_0x4537cd){while(--_0x4537cd){_0x455f19['push'](_0x455f19['shift']());}};_0x422f21(++_0x4f8f3a);}(_0x36da,0x162));var _0xa36d=function(_0x80582a,_0x31d6f0){_0x80582a=_0x80582a-0x0;var _0x1a6e2d=_0x36da[_0x80582a];return _0x1a6e2d;};'use strict';var _=require(_0xa36d('0x0'));var util=require(_0xa36d('0x1'));var logger=require('../../config/logger')(_0xa36d('0x2'));var moment=require(_0xa36d('0x3'));var BPromise=require(_0xa36d('0x4'));var rp=require(_0xa36d('0x5'));var fs=require('fs');var path=require(_0xa36d('0x6'));var rimraf=require(_0xa36d('0x7'));var config=require(_0xa36d('0x8'));var attributes=require(_0xa36d('0x9'));module[_0xa36d('0xa')]=function(_0x221628,_0x1dde8f){return _0x221628[_0xa36d('0xb')](_0xa36d('0xc'),attributes,{'tableName':_0xa36d('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7d66047..a0b31ab 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 _0x621f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x6aefe0,_0x16efc4){var _0x3ec1e5=function(_0x180284){while(--_0x180284){_0x6aefe0['push'](_0x6aefe0['shift']());}};_0x3ec1e5(++_0x16efc4);}(_0x621f,0x128));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var util=require(_0xf621('0x1'));var moment=require('moment');var BPromise=require(_0xf621('0x2'));var rs=require(_0xf621('0x3'));var fs=require('fs');var Redis=require(_0xf621('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf621('0x5'));var logger=require(_0xf621('0x6'))(_0xf621('0x7'));var config=require(_0xf621('0x8'));var jayson=require(_0xf621('0x9'));var client=jayson[_0xf621('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34acae,_0x545f38,_0x38fe85){return new BPromise(function(_0x88e735,_0x13012c){return client['request'](_0x34acae,_0x38fe85)[_0xf621('0xb')](function(_0x3b7d1c){logger[_0xf621('0xc')](_0xf621('0xd'),_0x545f38,'request\x20sent');logger[_0xf621('0xe')](_0xf621('0xf'),_0x545f38,_0xf621('0x10'),JSON[_0xf621('0x11')](_0x3b7d1c));if(_0x3b7d1c['error']){if(_0x3b7d1c[_0xf621('0x12')][_0xf621('0x13')]===0x1f4){logger[_0xf621('0x12')](_0xf621('0xd'),_0x545f38,_0x3b7d1c['error']['message']);return _0x13012c(_0x3b7d1c[_0xf621('0x12')][_0xf621('0x14')]);}logger[_0xf621('0x12')](_0xf621('0xd'),_0x545f38,_0x3b7d1c[_0xf621('0x12')]['message']);return _0x88e735(_0x3b7d1c[_0xf621('0x12')]['message']);}else{logger[_0xf621('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x545f38,'request\x20sent');_0x88e735(_0x3b7d1c[_0xf621('0x15')][_0xf621('0x14')]);}})[_0xf621('0x16')](function(_0xd5f0ef){logger[_0xf621('0x12')](_0xf621('0xd'),_0x545f38,_0xd5f0ef);_0x13012c(_0xd5f0ef);});});} \ No newline at end of file +var _0xe92e=['stringify','error','code','message','info','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2a0d22,_0x553737){var _0xf2669e=function(_0x1dcda4){while(--_0x1dcda4){_0x2a0d22['push'](_0x2a0d22['shift']());}};_0xf2669e(++_0x553737);}(_0xe92e,0x1b6));var _0xee92=function(_0x188530,_0x393abf){_0x188530=_0x188530-0x0;var _0x2df323=_0xe92e[_0x188530];return _0x2df323;};'use strict';var _=require(_0xee92('0x0'));var util=require(_0xee92('0x1'));var moment=require('moment');var BPromise=require(_0xee92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee92('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xee92('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xee92('0x5'));var jayson=require(_0xee92('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x522233,_0x32a59c,_0x5dc54c){return new BPromise(function(_0x16af48,_0x198800){return client[_0xee92('0x7')](_0x522233,_0x5dc54c)['then'](function(_0x163685){logger['info'](_0xee92('0x8'),_0x32a59c,_0xee92('0x9'));logger[_0xee92('0xa')](_0xee92('0xb'),_0x32a59c,_0xee92('0x9'),JSON[_0xee92('0xc')](_0x163685));if(_0x163685[_0xee92('0xd')]){if(_0x163685['error'][_0xee92('0xe')]===0x1f4){logger[_0xee92('0xd')](_0xee92('0x8'),_0x32a59c,_0x163685[_0xee92('0xd')]['message']);return _0x198800(_0x163685[_0xee92('0xd')][_0xee92('0xf')]);}logger[_0xee92('0xd')](_0xee92('0x8'),_0x32a59c,_0x163685[_0xee92('0xd')][_0xee92('0xf')]);return _0x16af48(_0x163685[_0xee92('0xd')]['message']);}else{logger[_0xee92('0x10')](_0xee92('0x8'),_0x32a59c,'request\x20sent');_0x16af48(_0x163685[_0xee92('0x11')][_0xee92('0xf')]);}})['catch'](function(_0x3be7e9){logger[_0xee92('0xd')](_0xee92('0x8'),_0x32a59c,_0x3be7e9);_0x198800(_0x3be7e9);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 580e044..bf82acc 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 _0x5bf6=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x59f126,_0x3e726b){var _0x4f8147=function(_0x4146e5){while(--_0x4146e5){_0x59f126['push'](_0x59f126['shift']());}};_0x4f8147(++_0x3e726b);}(_0x5bf6,0x87));var _0x65bf=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x5bf6[_0x9d1e6b];return _0x2b3070;};'use strict';var multer=require(_0x65bf('0x0'));var util=require(_0x65bf('0x1'));var path=require(_0x65bf('0x2'));var timeout=require(_0x65bf('0x3'));var express=require(_0x65bf('0x4'));var router=express[_0x65bf('0x5')]();var auth=require(_0x65bf('0x6'));var interaction=require(_0x65bf('0x7'));var config=require(_0x65bf('0x8'));var controller=require(_0x65bf('0x9'));router[_0x65bf('0xa')]('/',auth['isAuthenticated'](),controller[_0x65bf('0xb')]);router[_0x65bf('0xa')](_0x65bf('0xc'),auth[_0x65bf('0xd')](),controller[_0x65bf('0xe')]);router[_0x65bf('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65bf('0x10')](_0x65bf('0xc'),auth[_0x65bf('0xd')](),controller['update']);router[_0x65bf('0x11')](_0x65bf('0xc'),auth[_0x65bf('0xd')](),controller[_0x65bf('0x12')]);module['exports']=router; \ No newline at end of file +var _0x407c=['get','post','create','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x5e8d5b,_0x57692c){var _0x198aff=function(_0x19b77d){while(--_0x19b77d){_0x5e8d5b['push'](_0x5e8d5b['shift']());}};_0x198aff(++_0x57692c);}(_0x407c,0xba));var _0xc407=function(_0x3e7d64,_0x53d71b){_0x3e7d64=_0x3e7d64-0x0;var _0x137f44=_0x407c[_0x3e7d64];return _0x137f44;};'use strict';var multer=require('multer');var util=require(_0xc407('0x0'));var path=require(_0xc407('0x1'));var timeout=require(_0xc407('0x2'));var express=require(_0xc407('0x3'));var router=express[_0xc407('0x4')]();var auth=require(_0xc407('0x5'));var interaction=require(_0xc407('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0xc407('0x7')](),controller[_0xc407('0x8')]);router[_0xc407('0x9')]('/:id',auth[_0xc407('0x7')](),controller['show']);router[_0xc407('0xa')]('/',auth['isAuthenticated'](),controller[_0xc407('0xb')]);router['put']('/:id',auth[_0xc407('0x7')](),controller[_0xc407('0xc')]);router[_0xc407('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc407('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0ae6f0f..993443f 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 _0x21ee=['STRING','sequelize'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x21ee,0x1a5));var _0xe21e=function(_0x1ac3f9,_0x32169d){_0x1ac3f9=_0x1ac3f9-0x0;var _0x35982e=_0x21ee[_0x1ac3f9];return _0x35982e;};'use strict';var Sequelize=require(_0xe21e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe21e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe21e('0x1')]}}; \ No newline at end of file +var _0x5ced=['sequelize','exports','STRING','name'];(function(_0x1834fb,_0x38bfa4){var _0x578b25=function(_0xb3980e){while(--_0xb3980e){_0x1834fb['push'](_0x1834fb['shift']());}};_0x578b25(++_0x38bfa4);}(_0x5ced,0x180));var _0xd5ce=function(_0x60004,_0x1a53fd){_0x60004=_0x60004-0x0;var _0x1b4b52=_0x5ced[_0x60004];return _0x1b4b52;};'use strict';var Sequelize=require(_0xd5ce('0x0'));module[_0xd5ce('0x1')]={'name':{'type':Sequelize[_0xd5ce('0x2')],'unique':_0xd5ce('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7ba2951..ffdda00 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 _0x4e7f=['path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','then','get','Pauses','UserProfileResource','name','send','index','map','Pause','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e7f,0x1eb));var _0xf4e7=function(_0xb2454d,_0x291753){_0xb2454d=_0xb2454d-0x0;var _0x5464fb=_0x4e7f[_0xb2454d];return _0x5464fb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf4e7('0x0'));var rimraf=require(_0xf4e7('0x1'));var zipdir=require(_0xf4e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf4e7('0x3'));var BPromise=require(_0xf4e7('0x4'));var Mustache=require(_0xf4e7('0x5'));var util=require(_0xf4e7('0x6'));var path=require(_0xf4e7('0x7'));var sox=require('sox');var csv=require(_0xf4e7('0x8'));var ejs=require(_0xf4e7('0x9'));var fs=require('fs');var _=require(_0xf4e7('0xa'));var squel=require(_0xf4e7('0xb'));var crypto=require(_0xf4e7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4e7('0xd'));var Papa=require(_0xf4e7('0xe'));var Redis=require('ioredis');var authService=require(_0xf4e7('0xf'));var qs=require(_0xf4e7('0x10'));var as=require(_0xf4e7('0x11'));var hardwareService=require(_0xf4e7('0x12'));var logger=require(_0xf4e7('0x13'))(_0xf4e7('0x14'));var utils=require('../../config/utils');var config=require(_0xf4e7('0x15'));var licenseUtil=require(_0xf4e7('0x16'));var db=require(_0xf4e7('0x17'))['db'];function respondWithStatusCode(_0x2c44a4,_0x5718f2){_0x5718f2=_0x5718f2||0xcc;return function(_0x139b26){if(_0x139b26){return _0x2c44a4[_0xf4e7('0x18')](_0x5718f2);}return _0x2c44a4[_0xf4e7('0x19')](_0x5718f2)[_0xf4e7('0x1a')]();};}function respondWithResult(_0x4a8c41,_0x3f57e2){_0x3f57e2=_0x3f57e2||0xc8;return function(_0x191a7){if(_0x191a7){return _0x4a8c41[_0xf4e7('0x19')](_0x3f57e2)[_0xf4e7('0x1b')](_0x191a7);}};}function respondWithFilteredResult(_0x45f82e,_0x4231ee){return function(_0x599a88){if(_0x599a88){var _0xed8f83=_0x599a88[_0xf4e7('0x1c')],_0x5cdd54=_0x4231ee[_0xf4e7('0x1d')],_0x5c8330=_0x4231ee[_0xf4e7('0x1d')]+_0x4231ee['limit'],_0x3ebc42;if(_0x5c8330>=_0xed8f83){_0x5c8330=_0xed8f83;_0x3ebc42=0xc8;}else{_0x3ebc42=0xce;}_0x45f82e[_0xf4e7('0x19')](_0x3ebc42);return _0x45f82e['set'](_0xf4e7('0x1e'),_0x5cdd54+'-'+_0x5c8330+'/'+_0xed8f83)[_0xf4e7('0x1b')](_0x599a88);}return null;};}function patchUpdates(_0x7a36ab){return function(_0x1d4974){try{jsonpatch[_0xf4e7('0x1f')](_0x1d4974,_0x7a36ab,!![]);}catch(_0x2a899c){return BPromise[_0xf4e7('0x20')](_0x2a899c);}return _0x1d4974[_0xf4e7('0x21')]();};}function saveUpdates(_0x4cacf0,_0x413d9b){return function(_0x265225){if(_0x265225){return _0x265225['update'](_0x4cacf0)['then'](function(_0x40bbc8){return _0x40bbc8;});}return null;};}function removeEntity(_0x2c6592,_0x4188ed){return function(_0x3cf66b){if(_0x3cf66b){return _0x3cf66b[_0xf4e7('0x22')]()[_0xf4e7('0x23')](function(){var _0x1418b7=_0x3cf66b[_0xf4e7('0x24')]({'plain':!![]});var _0x2697c1=_0xf4e7('0x25');return db[_0xf4e7('0x26')][_0xf4e7('0x22')]({'where':{'type':_0x2697c1,'resourceId':_0x1418b7['id']}})[_0xf4e7('0x23')](function(){return _0x3cf66b;});})[_0xf4e7('0x23')](function(){_0x2c6592[_0xf4e7('0x19')](0xcc)[_0xf4e7('0x1a')]();});}};}function handleEntityNotFound(_0x943f19,_0x36b674){return function(_0xdc40b8){if(!_0xdc40b8){_0x943f19[_0xf4e7('0x18')](0x194);}return _0xdc40b8;};}function handleError(_0x3960f4,_0x1a4bda){_0x1a4bda=_0x1a4bda||0x1f4;return function(_0x459835){logger['error'](_0x459835['stack']);if(_0x459835[_0xf4e7('0x27')]){delete _0x459835[_0xf4e7('0x27')];}_0x3960f4[_0xf4e7('0x19')](_0x1a4bda)[_0xf4e7('0x28')](_0x459835);};}exports[_0xf4e7('0x29')]=function(_0x491e0c,_0x3b5520){var _0x138e47={},_0x1b944f={},_0x13412d={'count':0x0,'rows':[]};var _0x5cfc7e=_[_0xf4e7('0x2a')](db[_0xf4e7('0x2b')][_0xf4e7('0x2c')],function(_0x5eb74d){return{'name':_0x5eb74d[_0xf4e7('0x2d')],'type':_0x5eb74d[_0xf4e7('0x2e')][_0xf4e7('0x2f')]};});_0x1b944f['model']=_['map'](_0x5cfc7e,_0xf4e7('0x27'));_0x1b944f['query']=_[_0xf4e7('0x30')](_0x491e0c[_0xf4e7('0x31')]);_0x1b944f['filters']=_[_0xf4e7('0x32')](_0x1b944f[_0xf4e7('0x33')],_0x1b944f[_0xf4e7('0x31')]);_0x138e47[_0xf4e7('0x34')]=_[_0xf4e7('0x32')](_0x1b944f[_0xf4e7('0x33')],qs[_0xf4e7('0x35')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x35')]));_0x138e47['attributes']=_0x138e47[_0xf4e7('0x34')]['length']?_0x138e47[_0xf4e7('0x34')]:_0x1b944f[_0xf4e7('0x33')];if(!_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x36')](_0xf4e7('0x37'))){_0x138e47['limit']=qs[_0xf4e7('0x38')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x38')]);_0x138e47[_0xf4e7('0x1d')]=qs[_0xf4e7('0x1d')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x1d')]);}_0x138e47[_0xf4e7('0x39')]=qs[_0xf4e7('0x3a')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x3a')]);_0x138e47[_0xf4e7('0x3b')]=qs[_0xf4e7('0x3c')](_['pick'](_0x491e0c[_0xf4e7('0x31')],_0x1b944f[_0xf4e7('0x3c')]),_0x5cfc7e);if(_0x491e0c['query'][_0xf4e7('0x3d')]){_0x138e47[_0xf4e7('0x3b')]=_[_0xf4e7('0x3e')](_0x138e47[_0xf4e7('0x3b')],{'$or':_[_0xf4e7('0x2a')](_0x5cfc7e,function(_0x1f9e22){if(_0x1f9e22[_0xf4e7('0x2e')]!==_0xf4e7('0x3f')){var _0x288b97={};_0x288b97[_0x1f9e22[_0xf4e7('0x27')]]={'$like':'%'+_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x3d')]+'%'};return _0x288b97;}})});}_0x138e47=_[_0xf4e7('0x3e')]({},_0x138e47,_0x491e0c['options']);var _0x209648={'where':_0x138e47[_0xf4e7('0x3b')]};return db[_0xf4e7('0x2b')][_0xf4e7('0x1c')](_0x209648)[_0xf4e7('0x23')](function(_0x52505e){_0x13412d['count']=_0x52505e;if(_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x40')]){_0x138e47['include']=[{'all':!![]}];}return db[_0xf4e7('0x2b')][_0xf4e7('0x41')](_0x138e47);})[_0xf4e7('0x23')](function(_0x147a3e){_0x13412d[_0xf4e7('0x42')]=_0x147a3e;return _0x13412d;})['then'](respondWithFilteredResult(_0x3b5520,_0x138e47))['catch'](handleError(_0x3b5520,null));};exports[_0xf4e7('0x43')]=function(_0x52f010,_0x1e1a20){var _0x291b17={'raw':!![],'where':{'id':_0x52f010[_0xf4e7('0x44')]['id']}},_0x256c3f={};_0x256c3f[_0xf4e7('0x33')]=_[_0xf4e7('0x30')](db[_0xf4e7('0x2b')][_0xf4e7('0x2c')]);_0x256c3f[_0xf4e7('0x31')]=_['keys'](_0x52f010[_0xf4e7('0x31')]);_0x256c3f[_0xf4e7('0x3c')]=_['intersection'](_0x256c3f[_0xf4e7('0x33')],_0x256c3f[_0xf4e7('0x31')]);_0x291b17[_0xf4e7('0x34')]=_[_0xf4e7('0x32')](_0x256c3f[_0xf4e7('0x33')],qs[_0xf4e7('0x35')](_0x52f010['query'][_0xf4e7('0x35')]));_0x291b17[_0xf4e7('0x34')]=_0x291b17[_0xf4e7('0x34')][_0xf4e7('0x45')]?_0x291b17[_0xf4e7('0x34')]:_0x256c3f[_0xf4e7('0x33')];if(_0x52f010[_0xf4e7('0x31')][_0xf4e7('0x40')]){_0x291b17[_0xf4e7('0x46')]=[{'all':!![]}];}_0x291b17=_[_0xf4e7('0x3e')]({},_0x291b17,_0x52f010[_0xf4e7('0x47')]);return db[_0xf4e7('0x2b')][_0xf4e7('0x48')](_0x291b17)[_0xf4e7('0x23')](handleEntityNotFound(_0x1e1a20,null))[_0xf4e7('0x23')](respondWithResult(_0x1e1a20,null))['catch'](handleError(_0x1e1a20,null));};exports[_0xf4e7('0x49')]=function(_0x140065,_0x245e57){return db['Pause'][_0xf4e7('0x49')](_0x140065[_0xf4e7('0x4a')],{})[_0xf4e7('0x23')](function(_0x23629e){var _0x1e2282=_0x140065[_0xf4e7('0x4b')]['get']({'plain':!![]});if(!_0x1e2282)throw new Error(_0xf4e7('0x4c'));if(_0x1e2282[_0xf4e7('0x4d')]==='user'){var _0x4e0478=_0x23629e[_0xf4e7('0x24')]({'plain':!![]});var _0x2dff0a='Pauses';return db['UserProfileSection'][_0xf4e7('0x48')]({'where':{'name':_0x2dff0a,'userProfileId':_0x1e2282[_0xf4e7('0x4e')]},'raw':!![]})[_0xf4e7('0x23')](function(_0x93b685){if(_0x93b685&&_0x93b685['autoAssociation']===0x0){return db[_0xf4e7('0x26')][_0xf4e7('0x49')]({'name':_0x4e0478[_0xf4e7('0x27')],'resourceId':_0x4e0478['id'],'type':_0x93b685['name'],'sectionId':_0x93b685['id']},{})[_0xf4e7('0x23')](function(){return _0x23629e;});}else{return _0x23629e;}})[_0xf4e7('0x4f')](function(_0x560a18){logger[_0xf4e7('0x50')](_0xf4e7('0x51'),_0x560a18);throw _0x560a18;});}return _0x23629e;})[_0xf4e7('0x23')](respondWithResult(_0x245e57,0xc9))['catch'](handleError(_0x245e57,null));};exports[_0xf4e7('0x52')]=function(_0x2a3883,_0x5239d9){if(_0x2a3883[_0xf4e7('0x4a')]['id']){delete _0x2a3883[_0xf4e7('0x4a')]['id'];}return db[_0xf4e7('0x2b')][_0xf4e7('0x48')]({'where':{'id':_0x2a3883[_0xf4e7('0x44')]['id']}})[_0xf4e7('0x23')](handleEntityNotFound(_0x5239d9,null))['then'](saveUpdates(_0x2a3883[_0xf4e7('0x4a')],null))[_0xf4e7('0x23')](respondWithResult(_0x5239d9,null))['catch'](handleError(_0x5239d9,null));};exports[_0xf4e7('0x22')]=function(_0x28be22,_0x453f6c){return db['Pause'][_0xf4e7('0x48')]({'where':{'id':_0x28be22[_0xf4e7('0x44')]['id']}})[_0xf4e7('0x23')](handleEntityNotFound(_0x453f6c,null))[_0xf4e7('0x23')](removeEntity(_0x453f6c,null))['catch'](handleError(_0x453f6c,null));}; \ No newline at end of file +var _0xacf8=['include','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','request-promise','mustache','util','path','sox','to-csv','lodash','squel','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','reject','update','get','Pauses','then','sendStatus','error','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','Pause','count','includeAll','rows','catch','params','rawAttributes'];(function(_0x49d234,_0x1e7488){var _0xefbcb3=function(_0x46de6c){while(--_0x46de6c){_0x49d234['push'](_0x49d234['shift']());}};_0xefbcb3(++_0x1e7488);}(_0xacf8,0xef));var _0x8acf=function(_0xeea5ca,_0x2d569b){_0xeea5ca=_0xeea5ca-0x0;var _0x1fdf07=_0xacf8[_0xeea5ca];return _0x1fdf07;};'use strict';var pdf=require(_0x8acf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8acf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8acf('0x2'));var util=require(_0x8acf('0x3'));var path=require(_0x8acf('0x4'));var sox=require(_0x8acf('0x5'));var csv=require(_0x8acf('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8acf('0x7'));var squel=require(_0x8acf('0x8'));var crypto=require('crypto');var jsforce=require(_0x8acf('0x9'));var deskjs=require(_0x8acf('0xa'));var toCsv=require(_0x8acf('0x6'));var querystring=require(_0x8acf('0xb'));var Papa=require(_0x8acf('0xc'));var Redis=require(_0x8acf('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8acf('0xe'));var hardwareService=require(_0x8acf('0xf'));var logger=require(_0x8acf('0x10'))(_0x8acf('0x11'));var utils=require(_0x8acf('0x12'));var config=require(_0x8acf('0x13'));var licenseUtil=require(_0x8acf('0x14'));var db=require(_0x8acf('0x15'))['db'];function respondWithStatusCode(_0x14fcd3,_0x4b4df5){_0x4b4df5=_0x4b4df5||0xcc;return function(_0x5105d6){if(_0x5105d6){return _0x14fcd3['sendStatus'](_0x4b4df5);}return _0x14fcd3['status'](_0x4b4df5)[_0x8acf('0x16')]();};}function respondWithResult(_0x91efc5,_0x4df3b2){_0x4df3b2=_0x4df3b2||0xc8;return function(_0x49b52f){if(_0x49b52f){return _0x91efc5[_0x8acf('0x17')](_0x4df3b2)[_0x8acf('0x18')](_0x49b52f);}};}function respondWithFilteredResult(_0x329127,_0x23f5f8){return function(_0x41ba4b){if(_0x41ba4b){var _0x446648=_0x41ba4b['count'],_0x59c16a=_0x23f5f8[_0x8acf('0x19')],_0x4c2565=_0x23f5f8[_0x8acf('0x19')]+_0x23f5f8[_0x8acf('0x1a')],_0x232421;if(_0x4c2565>=_0x446648){_0x4c2565=_0x446648;_0x232421=0xc8;}else{_0x232421=0xce;}_0x329127[_0x8acf('0x17')](_0x232421);return _0x329127['set']('Content-Range',_0x59c16a+'-'+_0x4c2565+'/'+_0x446648)['json'](_0x41ba4b);}return null;};}function patchUpdates(_0x30f684){return function(_0x5ba297){try{jsonpatch['apply'](_0x5ba297,_0x30f684,!![]);}catch(_0x5df85b){return BPromise[_0x8acf('0x1b')](_0x5df85b);}return _0x5ba297['save']();};}function saveUpdates(_0x90ae43,_0x507871){return function(_0x544105){if(_0x544105){return _0x544105[_0x8acf('0x1c')](_0x90ae43)['then'](function(_0x2f991a){return _0x2f991a;});}return null;};}function removeEntity(_0x1f5f29,_0x1639b0){return function(_0x14ecb7){if(_0x14ecb7){return _0x14ecb7['destroy']()['then'](function(){var _0x3f7c7c=_0x14ecb7[_0x8acf('0x1d')]({'plain':!![]});var _0x3d1b62=_0x8acf('0x1e');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d1b62,'resourceId':_0x3f7c7c['id']}})['then'](function(){return _0x14ecb7;});})[_0x8acf('0x1f')](function(){_0x1f5f29[_0x8acf('0x17')](0xcc)[_0x8acf('0x16')]();});}};}function handleEntityNotFound(_0x6adea1,_0x502e8e){return function(_0x3f4ea1){if(!_0x3f4ea1){_0x6adea1[_0x8acf('0x20')](0x194);}return _0x3f4ea1;};}function handleError(_0x14d832,_0x30090e){_0x30090e=_0x30090e||0x1f4;return function(_0x2c4660){logger[_0x8acf('0x21')](_0x2c4660[_0x8acf('0x22')]);if(_0x2c4660[_0x8acf('0x23')]){delete _0x2c4660[_0x8acf('0x23')];}_0x14d832['status'](_0x30090e)[_0x8acf('0x24')](_0x2c4660);};}exports['index']=function(_0x588a9d,_0x31f215){var _0x331ee4={},_0x236b24={},_0x7d4376={'count':0x0,'rows':[]};var _0x548053=_[_0x8acf('0x25')](db['Pause']['rawAttributes'],function(_0x33083b){return{'name':_0x33083b[_0x8acf('0x26')],'type':_0x33083b[_0x8acf('0x27')][_0x8acf('0x28')]};});_0x236b24[_0x8acf('0x29')]=_[_0x8acf('0x25')](_0x548053,'name');_0x236b24['query']=_[_0x8acf('0x2a')](_0x588a9d[_0x8acf('0x2b')]);_0x236b24[_0x8acf('0x2c')]=_[_0x8acf('0x2d')](_0x236b24['model'],_0x236b24['query']);_0x331ee4[_0x8acf('0x2e')]=_['intersection'](_0x236b24[_0x8acf('0x29')],qs['fields'](_0x588a9d[_0x8acf('0x2b')][_0x8acf('0x2f')]));_0x331ee4[_0x8acf('0x2e')]=_0x331ee4[_0x8acf('0x2e')][_0x8acf('0x30')]?_0x331ee4[_0x8acf('0x2e')]:_0x236b24['model'];if(!_0x588a9d[_0x8acf('0x2b')][_0x8acf('0x31')](_0x8acf('0x32'))){_0x331ee4[_0x8acf('0x1a')]=qs[_0x8acf('0x1a')](_0x588a9d[_0x8acf('0x2b')][_0x8acf('0x1a')]);_0x331ee4['offset']=qs[_0x8acf('0x19')](_0x588a9d[_0x8acf('0x2b')][_0x8acf('0x19')]);}_0x331ee4[_0x8acf('0x33')]=qs[_0x8acf('0x34')](_0x588a9d['query']['sort']);_0x331ee4['where']=qs['filters'](_['pick'](_0x588a9d[_0x8acf('0x2b')],_0x236b24['filters']),_0x548053);if(_0x588a9d[_0x8acf('0x2b')][_0x8acf('0x35')]){_0x331ee4[_0x8acf('0x36')]=_[_0x8acf('0x37')](_0x331ee4[_0x8acf('0x36')],{'$or':_['map'](_0x548053,function(_0x362e56){if(_0x362e56[_0x8acf('0x27')]!==_0x8acf('0x38')){var _0x3d8b94={};_0x3d8b94[_0x362e56[_0x8acf('0x23')]]={'$like':'%'+_0x588a9d[_0x8acf('0x2b')][_0x8acf('0x35')]+'%'};return _0x3d8b94;}})});}_0x331ee4=_['merge']({},_0x331ee4,_0x588a9d[_0x8acf('0x39')]);var _0x36a380={'where':_0x331ee4['where']};return db[_0x8acf('0x3a')][_0x8acf('0x3b')](_0x36a380)[_0x8acf('0x1f')](function(_0x1515b2){_0x7d4376[_0x8acf('0x3b')]=_0x1515b2;if(_0x588a9d[_0x8acf('0x2b')][_0x8acf('0x3c')]){_0x331ee4['include']=[{'all':!![]}];}return db[_0x8acf('0x3a')]['findAll'](_0x331ee4);})['then'](function(_0x298096){_0x7d4376[_0x8acf('0x3d')]=_0x298096;return _0x7d4376;})['then'](respondWithFilteredResult(_0x31f215,_0x331ee4))[_0x8acf('0x3e')](handleError(_0x31f215,null));};exports['show']=function(_0x7fb623,_0x1df50c){var _0x12a0e={'raw':!![],'where':{'id':_0x7fb623[_0x8acf('0x3f')]['id']}},_0x46bb79={};_0x46bb79[_0x8acf('0x29')]=_[_0x8acf('0x2a')](db[_0x8acf('0x3a')][_0x8acf('0x40')]);_0x46bb79[_0x8acf('0x2b')]=_[_0x8acf('0x2a')](_0x7fb623[_0x8acf('0x2b')]);_0x46bb79[_0x8acf('0x2c')]=_[_0x8acf('0x2d')](_0x46bb79[_0x8acf('0x29')],_0x46bb79[_0x8acf('0x2b')]);_0x12a0e[_0x8acf('0x2e')]=_['intersection'](_0x46bb79[_0x8acf('0x29')],qs[_0x8acf('0x2f')](_0x7fb623[_0x8acf('0x2b')][_0x8acf('0x2f')]));_0x12a0e[_0x8acf('0x2e')]=_0x12a0e['attributes'][_0x8acf('0x30')]?_0x12a0e[_0x8acf('0x2e')]:_0x46bb79[_0x8acf('0x29')];if(_0x7fb623[_0x8acf('0x2b')]['includeAll']){_0x12a0e[_0x8acf('0x41')]=[{'all':!![]}];}_0x12a0e=_[_0x8acf('0x37')]({},_0x12a0e,_0x7fb623[_0x8acf('0x39')]);return db[_0x8acf('0x3a')][_0x8acf('0x42')](_0x12a0e)[_0x8acf('0x1f')](handleEntityNotFound(_0x1df50c,null))[_0x8acf('0x1f')](respondWithResult(_0x1df50c,null))[_0x8acf('0x3e')](handleError(_0x1df50c,null));};exports[_0x8acf('0x43')]=function(_0x23a880,_0x32d1da){return db['Pause']['create'](_0x23a880[_0x8acf('0x44')],{})[_0x8acf('0x1f')](function(_0x3e6587){var _0x8b4a91=_0x23a880['user'][_0x8acf('0x1d')]({'plain':!![]});if(!_0x8b4a91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8b4a91[_0x8acf('0x45')]===_0x8acf('0x46')){var _0x8d7029=_0x3e6587['get']({'plain':!![]});var _0x15fb71=_0x8acf('0x1e');return db[_0x8acf('0x47')][_0x8acf('0x42')]({'where':{'name':_0x15fb71,'userProfileId':_0x8b4a91[_0x8acf('0x48')]},'raw':!![]})[_0x8acf('0x1f')](function(_0x515f95){if(_0x515f95&&_0x515f95['autoAssociation']===0x0){return db[_0x8acf('0x49')][_0x8acf('0x43')]({'name':_0x8d7029[_0x8acf('0x23')],'resourceId':_0x8d7029['id'],'type':_0x515f95[_0x8acf('0x23')],'sectionId':_0x515f95['id']},{})['then'](function(){return _0x3e6587;});}else{return _0x3e6587;}})[_0x8acf('0x3e')](function(_0x27c727){logger[_0x8acf('0x21')](_0x8acf('0x4a'),_0x27c727);throw _0x27c727;});}return _0x3e6587;})[_0x8acf('0x1f')](respondWithResult(_0x32d1da,0xc9))[_0x8acf('0x3e')](handleError(_0x32d1da,null));};exports[_0x8acf('0x1c')]=function(_0x3a5ec7,_0x463442){if(_0x3a5ec7[_0x8acf('0x44')]['id']){delete _0x3a5ec7['body']['id'];}return db['Pause'][_0x8acf('0x42')]({'where':{'id':_0x3a5ec7['params']['id']}})[_0x8acf('0x1f')](handleEntityNotFound(_0x463442,null))[_0x8acf('0x1f')](saveUpdates(_0x3a5ec7['body'],null))[_0x8acf('0x1f')](respondWithResult(_0x463442,null))[_0x8acf('0x3e')](handleError(_0x463442,null));};exports[_0x8acf('0x4b')]=function(_0x7fcc4e,_0x39d23d){return db[_0x8acf('0x3a')][_0x8acf('0x42')]({'where':{'id':_0x7fcc4e['params']['id']}})[_0x8acf('0x1f')](handleEntityNotFound(_0x39d23d,null))[_0x8acf('0x1f')](removeEntity(_0x39d23d,null))[_0x8acf('0x3e')](handleError(_0x39d23d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7ef3bc1..3f8e587 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 _0xf79e=['../../config/logger','api','bluebird','request-promise','../../config/environment','./pause.attributes','exports','define','tools_pauses','util'];(function(_0x10a951,_0x5da875){var _0x6da0d=function(_0x249416){while(--_0x249416){_0x10a951['push'](_0x10a951['shift']());}};_0x6da0d(++_0x5da875);}(_0xf79e,0x185));var _0xef79=function(_0x22aab7,_0x368f0f){_0x22aab7=_0x22aab7-0x0;var _0x42f7ea=_0xf79e[_0x22aab7];return _0x42f7ea;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var logger=require(_0xef79('0x1'))(_0xef79('0x2'));var moment=require('moment');var BPromise=require(_0xef79('0x3'));var rp=require(_0xef79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef79('0x5'));var attributes=require(_0xef79('0x6'));module[_0xef79('0x7')]=function(_0x22b3c2,_0x396c51){return _0x22b3c2[_0xef79('0x8')]('Pause',attributes,{'tableName':_0xef79('0x9'),'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(_0x373d37,_0x35e054){var _0x259cb7=function(_0x3be842){while(--_0x3be842){_0x373d37['push'](_0x373d37['shift']());}};_0x259cb7(++_0x35e054);}(_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 dffaed7..413dbba 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 _0xf9f4=['Pause,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','debug'];(function(_0xda5612,_0x5391df){var _0x38c7a8=function(_0x4fcaa6){while(--_0x4fcaa6){_0xda5612['push'](_0xda5612['shift']());}};_0x38c7a8(++_0x5391df);}(_0xf9f4,0x1be));var _0x4f9f=function(_0x3c098b,_0x5e88b8){_0x3c098b=_0x3c098b-0x0;var _0x2541d4=_0xf9f4[_0x3c098b];return _0x2541d4;};'use strict';var _=require(_0x4f9f('0x0'));var util=require(_0x4f9f('0x1'));var moment=require(_0x4f9f('0x2'));var BPromise=require(_0x4f9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f9f('0x5'));var logger=require(_0x4f9f('0x6'))('rpc');var config=require(_0x4f9f('0x7'));var jayson=require(_0x4f9f('0x8'));var client=jayson[_0x4f9f('0x9')][_0x4f9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ffa30,_0x4695a4,_0x3443be){return new BPromise(function(_0x95c0a7,_0x538b2a){return client[_0x4f9f('0xb')](_0x3ffa30,_0x3443be)[_0x4f9f('0xc')](function(_0x21aac2){logger[_0x4f9f('0xd')](_0x4f9f('0xe'),_0x4695a4,'request\x20sent');logger[_0x4f9f('0xf')](_0x4f9f('0x10'),_0x4695a4,_0x4f9f('0x11'),JSON['stringify'](_0x21aac2));if(_0x21aac2[_0x4f9f('0x12')]){if(_0x21aac2[_0x4f9f('0x12')]['code']===0x1f4){logger[_0x4f9f('0x12')]('Pause,\x20%s,\x20%s',_0x4695a4,_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);return _0x538b2a(_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);}logger[_0x4f9f('0x12')](_0x4f9f('0xe'),_0x4695a4,_0x21aac2['error'][_0x4f9f('0x13')]);return _0x95c0a7(_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);}else{logger[_0x4f9f('0xd')](_0x4f9f('0xe'),_0x4695a4,_0x4f9f('0x11'));_0x95c0a7(_0x21aac2[_0x4f9f('0x14')][_0x4f9f('0x13')]);}})[_0x4f9f('0x15')](function(_0x4cf8b2){logger[_0x4f9f('0x12')](_0x4f9f('0xe'),_0x4695a4,_0x4cf8b2);_0x538b2a(_0x4cf8b2);});});}exports[_0x4f9f('0x16')]=function(_0x537097){var _0x1b9538=this;return new Promise(function(_0x5b1f43,_0x516ffc){return db[_0x4f9f('0x17')][_0x4f9f('0x18')]({'raw':_0x537097[_0x4f9f('0x19')]?_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1a')]===undefined?!![]:![]:!![],'where':_0x537097[_0x4f9f('0x19')]?_0x537097['options'][_0x4f9f('0x1b')]||null:null,'attributes':_0x537097[_0x4f9f('0x19')]?_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1c')]||null:null,'include':_0x537097[_0x4f9f('0x19')]?_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1d')]?_[_0x4f9f('0x1e')](_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1d')],function(_0xcd1f45){return{'model':db[_0xcd1f45[_0x4f9f('0x1f')]],'as':_0xcd1f45['as'],'attributes':_0xcd1f45['attributes'],'include':_0xcd1f45[_0x4f9f('0x1d')]?_[_0x4f9f('0x1e')](_0xcd1f45[_0x4f9f('0x1d')],function(_0x34df85){return{'model':db[_0x34df85[_0x4f9f('0x1f')]],'as':_0x34df85['as'],'attributes':_0x34df85[_0x4f9f('0x1c')],'include':_0x34df85[_0x4f9f('0x1d')]?_[_0x4f9f('0x1e')](_0x34df85[_0x4f9f('0x1d')],function(_0x21e756){return{'model':db[_0x21e756[_0x4f9f('0x1f')]],'as':_0x21e756['as'],'attributes':_0x21e756[_0x4f9f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4f9f('0xc')](function(_0x18cc3c){logger[_0x4f9f('0xd')](_0x4f9f('0x16'),_0x537097);logger[_0x4f9f('0xf')](_0x4f9f('0x16'),_0x537097,JSON[_0x4f9f('0x20')](_0x18cc3c));_0x5b1f43(_0x18cc3c);})[_0x4f9f('0x15')](function(_0xe9b1a4){logger[_0x4f9f('0x12')](_0x4f9f('0x16'),_0xe9b1a4[_0x4f9f('0x13')],_0x537097);_0x516ffc(_0x1b9538['error'](0x1f4,_0xe9b1a4['message']));});});}; \ No newline at end of file +var _0xb2b4=['find','options','where','attributes','map','model','include','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Pause,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','ShowPause','Pause'];(function(_0x434cc4,_0x30c31e){var _0x3e5ac4=function(_0x3e40ab){while(--_0x3e40ab){_0x434cc4['push'](_0x434cc4['shift']());}};_0x3e5ac4(++_0x30c31e);}(_0xb2b4,0x1b4));var _0x4b2b=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xb2b4[_0x4e93a9];return _0x43013c;};'use strict';var _=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var moment=require(_0x4b2b('0x2'));var BPromise=require(_0x4b2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b2b('0x4'));var db=require(_0x4b2b('0x5'))['db'];var utils=require(_0x4b2b('0x6'));var logger=require(_0x4b2b('0x7'))('rpc');var config=require(_0x4b2b('0x8'));var jayson=require(_0x4b2b('0x9'));var client=jayson[_0x4b2b('0xa')][_0x4b2b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3085c5,_0x4e6d9b,_0x335ddc){return new BPromise(function(_0x266a18,_0x1f20fd){return client[_0x4b2b('0xc')](_0x3085c5,_0x335ddc)[_0x4b2b('0xd')](function(_0x576ff0){logger['info'](_0x4b2b('0xe'),_0x4e6d9b,'request\x20sent');logger[_0x4b2b('0xf')]('Pause,\x20%s,\x20%s,\x20%s',_0x4e6d9b,_0x4b2b('0x10'),JSON[_0x4b2b('0x11')](_0x576ff0));if(_0x576ff0[_0x4b2b('0x12')]){if(_0x576ff0['error'][_0x4b2b('0x13')]===0x1f4){logger[_0x4b2b('0x12')](_0x4b2b('0xe'),_0x4e6d9b,_0x576ff0[_0x4b2b('0x12')]['message']);return _0x1f20fd(_0x576ff0[_0x4b2b('0x12')][_0x4b2b('0x14')]);}logger[_0x4b2b('0x12')](_0x4b2b('0xe'),_0x4e6d9b,_0x576ff0['error'][_0x4b2b('0x14')]);return _0x266a18(_0x576ff0[_0x4b2b('0x12')][_0x4b2b('0x14')]);}else{logger[_0x4b2b('0x15')]('Pause,\x20%s,\x20%s',_0x4e6d9b,_0x4b2b('0x10'));_0x266a18(_0x576ff0[_0x4b2b('0x16')][_0x4b2b('0x14')]);}})[_0x4b2b('0x17')](function(_0x3d3934){logger[_0x4b2b('0x12')]('Pause,\x20%s,\x20%s',_0x4e6d9b,_0x3d3934);_0x1f20fd(_0x3d3934);});});}exports[_0x4b2b('0x18')]=function(_0x37aa6b){var _0x22d5f5=this;return new Promise(function(_0x43befb,_0x23c3ea){return db[_0x4b2b('0x19')][_0x4b2b('0x1a')]({'raw':_0x37aa6b[_0x4b2b('0x1b')]?_0x37aa6b[_0x4b2b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x37aa6b[_0x4b2b('0x1b')]?_0x37aa6b[_0x4b2b('0x1b')][_0x4b2b('0x1c')]||null:null,'attributes':_0x37aa6b[_0x4b2b('0x1b')]?_0x37aa6b[_0x4b2b('0x1b')][_0x4b2b('0x1d')]||null:null,'include':_0x37aa6b[_0x4b2b('0x1b')]?_0x37aa6b[_0x4b2b('0x1b')]['include']?_[_0x4b2b('0x1e')](_0x37aa6b[_0x4b2b('0x1b')]['include'],function(_0x15110f){return{'model':db[_0x15110f[_0x4b2b('0x1f')]],'as':_0x15110f['as'],'attributes':_0x15110f[_0x4b2b('0x1d')],'include':_0x15110f['include']?_[_0x4b2b('0x1e')](_0x15110f[_0x4b2b('0x20')],function(_0x238b74){return{'model':db[_0x238b74[_0x4b2b('0x1f')]],'as':_0x238b74['as'],'attributes':_0x238b74[_0x4b2b('0x1d')],'include':_0x238b74[_0x4b2b('0x20')]?_['map'](_0x238b74['include'],function(_0x14ac5c){return{'model':db[_0x14ac5c['model']],'as':_0x14ac5c['as'],'attributes':_0x14ac5c[_0x4b2b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4b2b('0xd')](function(_0x27c677){logger[_0x4b2b('0x15')](_0x4b2b('0x18'),_0x37aa6b);logger[_0x4b2b('0xf')]('ShowPause',_0x37aa6b,JSON[_0x4b2b('0x11')](_0x27c677));_0x43befb(_0x27c677);})['catch'](function(_0x2d8fca){logger['error'](_0x4b2b('0x18'),_0x2d8fca[_0x4b2b('0x14')],_0x37aa6b);_0x23c3ea(_0x22d5f5[_0x4b2b('0x12')](0x1f4,_0x2d8fca[_0x4b2b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index a9d3f8d..4a23d54 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 _0xbc7c=['/webhook','webhookGet','/:id','show','/:id/download','isAuthenticated','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbc7c,0xbb));var _0xcbc7=function(_0x5c1ddc,_0x587040){_0x5c1ddc=_0x5c1ddc-0x0;var _0x542a11=_0xbc7c[_0x5c1ddc];return _0x542a11;};'use strict';var multer=require(_0xcbc7('0x0'));var util=require(_0xcbc7('0x1'));var path=require(_0xcbc7('0x2'));var timeout=require(_0xcbc7('0x3'));var express=require(_0xcbc7('0x4'));var router=express[_0xcbc7('0x5')]();var auth=require(_0xcbc7('0x6'));var interaction=require(_0xcbc7('0x7'));var config=require('../../config/environment');var controller=require(_0xcbc7('0x8'));router[_0xcbc7('0x9')]('/',auth['isAuthenticated'](),controller[_0xcbc7('0xa')]);router[_0xcbc7('0x9')](_0xcbc7('0xb'),controller[_0xcbc7('0xc')]);router[_0xcbc7('0x9')](_0xcbc7('0xd'),auth['isAuthenticated'](),controller[_0xcbc7('0xe')]);router[_0xcbc7('0x9')](_0xcbc7('0xf'),auth[_0xcbc7('0x10')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x54c769,_0x4ddda8,_0x543c4d){_0x543c4d(null,path['join'](config[_0xcbc7('0x11')],_0xcbc7('0x12')));},'filename':function(_0x2dcc2e,_0x9367b8,_0x1aa124){_0x9367b8[_0xcbc7('0x13')]=_0x9367b8[_0xcbc7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1aa124(null,util[_0xcbc7('0x14')](_0xcbc7('0x15'),path[_0xcbc7('0x16')](_0x9367b8[_0xcbc7('0x13')],path['extname'](_0x9367b8[_0xcbc7('0x13')])),Date['now'](),path[_0xcbc7('0x17')](_0x9367b8[_0xcbc7('0x13')])));}})});router['post']('/',upload[_0xcbc7('0x18')](_0xcbc7('0x19')),controller[_0xcbc7('0x1a')]);router[_0xcbc7('0x1b')](_0xcbc7('0xb'),controller[_0xcbc7('0x1c')]);router[_0xcbc7('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xcbc7('0x1e')]);router[_0xcbc7('0x1f')](_0xcbc7('0xd'),auth[_0xcbc7('0x10')](),controller[_0xcbc7('0x1f')]);module[_0xcbc7('0x20')]=router; \ No newline at end of file +var _0x5cf3=['diskStorage','root','server/files/plugins','originalname','replace','format','basename','extname','now','post','single','upload','webhookPost','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','/:id','show','download'];(function(_0x321327,_0x4965b){var _0x33be38=function(_0x27e02c){while(--_0x27e02c){_0x321327['push'](_0x321327['shift']());}};_0x33be38(++_0x4965b);}(_0x5cf3,0x191));var _0x35cf=function(_0xcfcdcb,_0x335750){_0xcfcdcb=_0xcfcdcb-0x0;var _0x55b9da=_0x5cf3[_0xcfcdcb];return _0x55b9da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35cf('0x0'));var timeout=require(_0x35cf('0x1'));var express=require(_0x35cf('0x2'));var router=express[_0x35cf('0x3')]();var auth=require(_0x35cf('0x4'));var interaction=require(_0x35cf('0x5'));var config=require(_0x35cf('0x6'));var controller=require(_0x35cf('0x7'));router['get']('/',auth[_0x35cf('0x8')](),controller[_0x35cf('0x9')]);router[_0x35cf('0xa')](_0x35cf('0xb'),controller['webhookGet']);router[_0x35cf('0xa')](_0x35cf('0xc'),auth['isAuthenticated'](),controller[_0x35cf('0xd')]);router[_0x35cf('0xa')]('/:id/download',auth[_0x35cf('0x8')](),controller[_0x35cf('0xe')]);var upload=multer({'storage':multer[_0x35cf('0xf')]({'destination':function(_0x2a3309,_0x3fa8ec,_0x386cdb){_0x386cdb(null,path['join'](config[_0x35cf('0x10')],_0x35cf('0x11')));},'filename':function(_0x54059b,_0x57f1a4,_0x22aa6b){_0x57f1a4[_0x35cf('0x12')]=_0x57f1a4[_0x35cf('0x12')][_0x35cf('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x22aa6b(null,util[_0x35cf('0x14')]('%s-%s%s',path[_0x35cf('0x15')](_0x57f1a4[_0x35cf('0x12')],path[_0x35cf('0x16')](_0x57f1a4[_0x35cf('0x12')])),Date[_0x35cf('0x17')](),path[_0x35cf('0x16')](_0x57f1a4[_0x35cf('0x12')])));}})});router[_0x35cf('0x18')]('/',upload[_0x35cf('0x19')]('file'),controller[_0x35cf('0x1a')]);router[_0x35cf('0x18')]('/webhook',controller[_0x35cf('0x1b')]);router[_0x35cf('0x1c')](_0x35cf('0xc'),auth['isAuthenticated'](),controller[_0x35cf('0x1d')]);router[_0x35cf('0x1e')](_0x35cf('0xc'),auth[_0x35cf('0x8')](),controller[_0x35cf('0x1e')]);module[_0x35cf('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2f7a696..2a6a535 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 _0x2b2f=['never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x8d20cd,_0x14458b){var _0x1d30d4=function(_0x72a016){while(--_0x72a016){_0x8d20cd['push'](_0x8d20cd['shift']());}};_0x1d30d4(++_0x14458b);}(_0x2b2f,0x137));var _0xf2b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2b2f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf2b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xf2b2('0x1')]},'type':{'type':Sequelize[_0xf2b2('0x2')]('html','script')},'description':{'type':Sequelize[_0xf2b2('0x3')]},'version':{'type':Sequelize[_0xf2b2('0x3')]},'path':{'type':Sequelize[_0xf2b2('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf2b2('0x4')],'defaultValue':0x0,'comment':_0xf2b2('0x5')},'sidebar':{'type':Sequelize[_0xf2b2('0x2')](_0xf2b2('0x6'),_0xf2b2('0x7'),'always',_0xf2b2('0x8')),'defaultValue':_0xf2b2('0x9'),'comment':_0xf2b2('0xa')},'icon':{'type':Sequelize[_0xf2b2('0x1')]},'adminUrl':{'type':Sequelize[_0xf2b2('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xf2b2('0x1')]},'scriptPath':{'type':Sequelize[_0xf2b2('0x1')]}}; \ No newline at end of file +var _0x5277=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x5277,0x1c9));var _0x7527=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5277[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7527('0x0'));module[_0x7527('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7527('0x2')](_0x7527('0x3'),_0x7527('0x4'))},'description':{'type':Sequelize[_0x7527('0x5')]},'version':{'type':Sequelize[_0x7527('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x7527('0x6')},'active':{'type':Sequelize[_0x7527('0x7')],'defaultValue':0x0,'comment':_0x7527('0x8')},'sidebar':{'type':Sequelize[_0x7527('0x2')](_0x7527('0x9'),_0x7527('0xa'),_0x7527('0xb'),_0x7527('0xc')),'defaultValue':_0x7527('0xb'),'comment':_0x7527('0xd')},'icon':{'type':Sequelize[_0x7527('0xe')]},'adminUrl':{'type':Sequelize[_0x7527('0xe')]},'agentUrl':{'type':Sequelize[_0x7527('0xe')]},'scriptName':{'type':Sequelize[_0x7527('0xe')]},'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 23efa84..8b86a8c 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 _0x4fbd=['content-type','set','statusCode','webhookPost','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','limit','Content-Range','apply','update','then','destroy','get','Plugins','UserProfileResource','end','error','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','intersection','fields','includeAll','include','find','download','params','path','join','root','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','server/files/plugins','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length'];(function(_0x362ba3,_0x38f2c0){var _0x2e8c6a=function(_0x4663b0){while(--_0x4663b0){_0x362ba3['push'](_0x362ba3['shift']());}};_0x2e8c6a(++_0x38f2c0);}(_0x4fbd,0xb3));var _0xd4fb=function(_0x240474,_0x3474ce){_0x240474=_0x240474-0x0;var _0x5ee312=_0x4fbd[_0x240474];return _0x5ee312;};'use strict';var pdf=require(_0xd4fb('0x0'));var emlformat=require(_0xd4fb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd4fb('0x2'));var jsonpatch=require(_0xd4fb('0x3'));var rp=require(_0xd4fb('0x4'));var moment=require(_0xd4fb('0x5'));var BPromise=require(_0xd4fb('0x6'));var Mustache=require(_0xd4fb('0x7'));var util=require(_0xd4fb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd4fb('0x9'));var ejs=require(_0xd4fb('0xa'));var fs=require('fs');var _=require(_0xd4fb('0xb'));var squel=require(_0xd4fb('0xc'));var crypto=require(_0xd4fb('0xd'));var jsforce=require(_0xd4fb('0xe'));var deskjs=require(_0xd4fb('0xf'));var toCsv=require(_0xd4fb('0x9'));var querystring=require(_0xd4fb('0x10'));var Papa=require('papaparse');var extract=require(_0xd4fb('0x11'));var rimraf=require(_0xd4fb('0x12'));var archiver=require('archiver');var Redis=require(_0xd4fb('0x13'));var authService=require(_0xd4fb('0x14'));var qs=require(_0xd4fb('0x15'));var as=require(_0xd4fb('0x16'));var hardwareService=require(_0xd4fb('0x17'));var logger=require(_0xd4fb('0x18'))(_0xd4fb('0x19'));var utils=require(_0xd4fb('0x1a'));var config=require(_0xd4fb('0x1b'));var licenseUtil=require(_0xd4fb('0x1c'));var db=require(_0xd4fb('0x1d'))['db'];config[_0xd4fb('0x1e')]=_['defaults'](config[_0xd4fb('0x1e')],{'host':_0xd4fb('0x1f'),'port':0x18eb});var socket=require(_0xd4fb('0x20'))(new Redis(config[_0xd4fb('0x1e')]));require(_0xd4fb('0x21'))[_0xd4fb('0x22')](socket);function respondWithStatusCode(_0x55d9a1,_0x512859){_0x512859=_0x512859||0xcc;return function(_0x407ee){if(_0x407ee){return _0x55d9a1[_0xd4fb('0x23')](_0x512859);}return _0x55d9a1[_0xd4fb('0x24')](_0x512859)['end']();};}function respondWithResult(_0x363b00,_0x1d948e){_0x1d948e=_0x1d948e||0xc8;return function(_0x4d9574){if(_0x4d9574){return _0x363b00[_0xd4fb('0x24')](_0x1d948e)[_0xd4fb('0x25')](_0x4d9574);}};}function respondWithFilteredResult(_0xba7923,_0x5350da){return function(_0x496505){if(_0x496505){var _0xdaef1a=_0x496505[_0xd4fb('0x26')],_0x2085ba=_0x5350da['offset'],_0x23ae9c=_0x5350da['offset']+_0x5350da[_0xd4fb('0x27')],_0xaa49a7;if(_0x23ae9c>=_0xdaef1a){_0x23ae9c=_0xdaef1a;_0xaa49a7=0xc8;}else{_0xaa49a7=0xce;}_0xba7923[_0xd4fb('0x24')](_0xaa49a7);return _0xba7923['set'](_0xd4fb('0x28'),_0x2085ba+'-'+_0x23ae9c+'/'+_0xdaef1a)[_0xd4fb('0x25')](_0x496505);}return null;};}function patchUpdates(_0xb9c481){return function(_0x3160f5){try{jsonpatch[_0xd4fb('0x29')](_0x3160f5,_0xb9c481,!![]);}catch(_0x843b4a){return BPromise['reject'](_0x843b4a);}return _0x3160f5['save']();};}function saveUpdates(_0x596e21,_0x3f5a12){return function(_0x29021e){if(_0x29021e){return _0x29021e[_0xd4fb('0x2a')](_0x596e21)[_0xd4fb('0x2b')](function(_0x37d4a5){return _0x37d4a5;});}return null;};}function removeEntity(_0x150a7e,_0x44cf9b){return function(_0x22585d){if(_0x22585d){return _0x22585d[_0xd4fb('0x2c')]()[_0xd4fb('0x2b')](function(){var _0x52fe4f=_0x22585d[_0xd4fb('0x2d')]({'plain':!![]});var _0x4a3371=_0xd4fb('0x2e');return db[_0xd4fb('0x2f')][_0xd4fb('0x2c')]({'where':{'type':_0x4a3371,'resourceId':_0x52fe4f['id']}})[_0xd4fb('0x2b')](function(){return _0x22585d;});})[_0xd4fb('0x2b')](function(){_0x150a7e[_0xd4fb('0x24')](0xcc)[_0xd4fb('0x30')]();});}};}function handleEntityNotFound(_0x914a79,_0x385205){return function(_0x3c6437){if(!_0x3c6437){_0x914a79[_0xd4fb('0x23')](0x194);}return _0x3c6437;};}function handleError(_0x50cc58,_0x110e46){_0x110e46=_0x110e46||0x1f4;return function(_0x3ab358){logger[_0xd4fb('0x31')](_0x3ab358['stack']);if(_0x3ab358['name']){delete _0x3ab358[_0xd4fb('0x32')];}_0x50cc58[_0xd4fb('0x24')](_0x110e46)['send'](_0x3ab358);};}exports[_0xd4fb('0x33')]=function(_0x52eed0,_0x21a8c6){var _0x3dbabd={},_0x141488={},_0x44d384={'count':0x0,'rows':[]};var _0x31c244=_[_0xd4fb('0x34')](db[_0xd4fb('0x35')][_0xd4fb('0x36')],function(_0x1f59ba){return{'name':_0x1f59ba[_0xd4fb('0x37')],'type':_0x1f59ba[_0xd4fb('0x38')][_0xd4fb('0x39')]};});_0x141488[_0xd4fb('0x3a')]=_['map'](_0x31c244,'name');_0x141488[_0xd4fb('0x3b')]=_[_0xd4fb('0x3c')](_0x52eed0['query']);_0x141488[_0xd4fb('0x3d')]=_['intersection'](_0x141488[_0xd4fb('0x3a')],_0x141488['query']);_0x3dbabd['attributes']=_['intersection'](_0x141488[_0xd4fb('0x3a')],qs['fields'](_0x52eed0[_0xd4fb('0x3b')]['fields']));_0x3dbabd[_0xd4fb('0x3e')]=_0x3dbabd[_0xd4fb('0x3e')][_0xd4fb('0x3f')]?_0x3dbabd[_0xd4fb('0x3e')]:_0x141488[_0xd4fb('0x3a')];if(!_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x40')](_0xd4fb('0x41'))){_0x3dbabd[_0xd4fb('0x27')]=qs[_0xd4fb('0x27')](_0x52eed0[_0xd4fb('0x3b')]['limit']);_0x3dbabd[_0xd4fb('0x42')]=qs['offset'](_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x42')]);}_0x3dbabd['order']=qs['sort'](_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x43')]);_0x3dbabd[_0xd4fb('0x44')]=qs['filters'](_[_0xd4fb('0x45')](_0x52eed0[_0xd4fb('0x3b')],_0x141488[_0xd4fb('0x3d')]),_0x31c244);if(_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x46')]){_0x3dbabd[_0xd4fb('0x44')]=_[_0xd4fb('0x47')](_0x3dbabd['where'],{'$or':_[_0xd4fb('0x34')](_0x31c244,function(_0x4808a1){if(_0x4808a1[_0xd4fb('0x38')]!==_0xd4fb('0x48')){var _0x278d5a={};_0x278d5a[_0x4808a1[_0xd4fb('0x32')]]={'$like':'%'+_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x46')]+'%'};return _0x278d5a;}})});}_0x3dbabd=_[_0xd4fb('0x47')]({},_0x3dbabd,_0x52eed0[_0xd4fb('0x49')]);var _0x352bc4={'where':_0x3dbabd['where']};return db['Plugin']['count'](_0x352bc4)['then'](function(_0x28fb5e){_0x44d384[_0xd4fb('0x26')]=_0x28fb5e;if(_0x52eed0[_0xd4fb('0x3b')]['includeAll']){_0x3dbabd['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x3dbabd);})[_0xd4fb('0x2b')](function(_0xaa790c){_0x44d384[_0xd4fb('0x4a')]=_0xaa790c;return _0x44d384;})['then'](respondWithFilteredResult(_0x21a8c6,_0x3dbabd))[_0xd4fb('0x4b')](handleError(_0x21a8c6,null));};exports[_0xd4fb('0x4c')]=function(_0x461394,_0x12413a){var _0x1e11b9={'raw':!![],'where':{'id':_0x461394['params']['id']}},_0x3915b0={};_0x3915b0[_0xd4fb('0x3a')]=_[_0xd4fb('0x3c')](db[_0xd4fb('0x35')][_0xd4fb('0x36')]);_0x3915b0['query']=_[_0xd4fb('0x3c')](_0x461394[_0xd4fb('0x3b')]);_0x3915b0['filters']=_[_0xd4fb('0x4d')](_0x3915b0[_0xd4fb('0x3a')],_0x3915b0['query']);_0x1e11b9[_0xd4fb('0x3e')]=_[_0xd4fb('0x4d')](_0x3915b0[_0xd4fb('0x3a')],qs[_0xd4fb('0x4e')](_0x461394['query']['fields']));_0x1e11b9['attributes']=_0x1e11b9[_0xd4fb('0x3e')][_0xd4fb('0x3f')]?_0x1e11b9[_0xd4fb('0x3e')]:_0x3915b0[_0xd4fb('0x3a')];if(_0x461394['query'][_0xd4fb('0x4f')]){_0x1e11b9[_0xd4fb('0x50')]=[{'all':!![]}];}_0x1e11b9=_[_0xd4fb('0x47')]({},_0x1e11b9,_0x461394[_0xd4fb('0x49')]);return db[_0xd4fb('0x35')][_0xd4fb('0x51')](_0x1e11b9)[_0xd4fb('0x2b')](handleEntityNotFound(_0x12413a,null))[_0xd4fb('0x2b')](respondWithResult(_0x12413a,null))[_0xd4fb('0x4b')](handleError(_0x12413a,null));};exports[_0xd4fb('0x52')]=function(_0x4b98e0,_0x5e00ed,_0x3cd83f){return db[_0xd4fb('0x35')][_0xd4fb('0x51')]({'where':{'id':_0x4b98e0[_0xd4fb('0x53')]['id']},'attributes':[_0xd4fb('0x32'),_0xd4fb('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x5e00ed,null))[_0xd4fb('0x2b')](function(_0x4af034){if(_0x4af034){var _0x1dec0a=path[_0xd4fb('0x55')](config[_0xd4fb('0x56')],'server/files/plugins',util['format'](_0xd4fb('0x57'),path[_0xd4fb('0x58')](_0x4af034['path'])));var _0x7d6462=fs[_0xd4fb('0x59')](_0x1dec0a);var _0x112ed9=archiver(_0xd4fb('0x5a'),{'zlib':{'level':0x9}});_0x112ed9['on'](_0xd4fb('0x5b'),function(_0x2267fb){if(_0x2267fb[_0xd4fb('0x5c')]===_0xd4fb('0x5d')){logger[_0xd4fb('0x31')](_0x2267fb);}else{throw new db[(_0xd4fb('0x5e'))]['Error'](_0xd4fb('0x5f'));}});_0x112ed9['on'](_0xd4fb('0x31'),function(_0x55f87d){throw new db[(_0xd4fb('0x5e'))][(_0xd4fb('0x60'))](_0xd4fb('0x5f'));});_0x112ed9[_0xd4fb('0x61')](_0x7d6462);_0x112ed9['glob'](_0xd4fb('0x62'),{'cwd':path['join'](config[_0xd4fb('0x56')],_0xd4fb('0x63'),path['dirname'](_0x4af034[_0xd4fb('0x54')])),'ignore':[path['join'](path[_0xd4fb('0x58')](_0x4af034[_0xd4fb('0x54')]),'node_modules/**/*'),path[_0xd4fb('0x55')](path['basename'](_0x4af034[_0xd4fb('0x54')]),_0xd4fb('0x64'))],'nodir':!![]})[_0xd4fb('0x65')]();_0x7d6462['on'](_0xd4fb('0x66'),function(){if(!fs[_0xd4fb('0x67')](_0x1dec0a)){throw new db[(_0xd4fb('0x5e'))][(_0xd4fb('0x60'))](_0xd4fb('0x68'));}return _0x5e00ed['download'](_0x1dec0a,util[_0xd4fb('0x69')]('%s.zip',path[_0xd4fb('0x58')](_0x4af034['path'])),function(_0x2386b8){if(_0x2386b8){throw new db[(_0xd4fb('0x5e'))][(_0xd4fb('0x60'))](_0xd4fb('0x6a'));}fs[_0xd4fb('0x6b')](_0x1dec0a);logger[_0xd4fb('0x6c')](_0xd4fb('0x6d'));logger[_0xd4fb('0x6c')](_0xd4fb('0x6e'));});});}return null;})['catch'](handleError(_0x5e00ed,null));};exports['upload']=function(_0x5a04d4,_0xe96b2f,_0x1fc6ee){var _0x85370d=path['basename'](_0x5a04d4[_0xd4fb('0x6f')][_0xd4fb('0x70')],path[_0xd4fb('0x71')](_0x5a04d4[_0xd4fb('0x6f')]['filename']));var _0x58c89c=path['join'](config[_0xd4fb('0x56')],_0xd4fb('0x63'),_0x5a04d4[_0xd4fb('0x6f')][_0xd4fb('0x70')]);var _0x3e04a5=path[_0xd4fb('0x55')](config['root'],_0xd4fb('0x63'),_0x85370d);logger['info'](_0xd4fb('0x72'),_0x58c89c);logger[_0xd4fb('0x6c')](_0xd4fb('0x73'),_0x3e04a5);try{fs[_0xd4fb('0x74')](_0x58c89c,parseInt(_0xd4fb('0x75'),0x8));extract(_0x58c89c,{'dir':_0x3e04a5},function(_0x45e7db){if(_0x45e7db){logger[_0xd4fb('0x31')](_0x45e7db);handleError(_0x45e7db,!![]);};var _0x51f29f=fs[_0xd4fb('0x76')](_0x3e04a5);if(_0x51f29f[_0xd4fb('0x3f')]>0x1){removeReferences(_0x58c89c,_0x3e04a5);logger['error']('Invalid\x20plugin\x20structure');return _0x1fc6ee(new Error(_0xd4fb('0x77')));}var _0xb8e9b0=fs[_0xd4fb('0x78')](path[_0xd4fb('0x55')](_0x3e04a5,_0x51f29f[0x0]));if(_0xb8e9b0['isFile']()){removeReferences(_0x58c89c,_0x3e04a5);logger[_0xd4fb('0x31')]('Invalid\x20plugin\x20structure');return _0x1fc6ee(new Error(_0xd4fb('0x77')));}if(_0xb8e9b0[_0xd4fb('0x79')]()){var _0x86bf53=fs[_0xd4fb('0x76')](path[_0xd4fb('0x55')](_0x3e04a5,_0x51f29f[0x0]));if(_0x86bf53[_0xd4fb('0x3f')]===0x0){removeReferences(_0x58c89c,_0x3e04a5);logger['error']('Invalid\x20plugin\x20structure');return _0x1fc6ee(new Error(_0xd4fb('0x77')));}var _0x937bd2=_0x86bf53[_0xd4fb('0x7a')](function(_0x34e521){return _0x34e521===_0xd4fb('0x7b');});if(!_0x937bd2){return _0x1fc6ee(new Error(_0xd4fb('0x7c')));}var _0x408065=fs[_0xd4fb('0x7d')](path[_0xd4fb('0x55')](_0x3e04a5,_0x51f29f[0x0],_0xd4fb('0x7b')));var _0x29a78a=JSON[_0xd4fb('0x7e')](_0x408065);if('undefined'==typeof _0x29a78a[_0xd4fb('0x32')]){return _0x1fc6ee(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x38')]){return _0x1fc6ee(new Error(_0xd4fb('0x80')));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x81')]){return _0x1fc6ee(new Error(_0xd4fb('0x82')));}if('undefined'==typeof _0x29a78a[_0xd4fb('0x83')]){return _0x1fc6ee(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x29a78a[_0xd4fb('0x38')]===_0xd4fb('0x84')){if('undefined'==typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')]){return _0x1fc6ee(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')]&&_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x87')]){return _0x1fc6ee(new Error(_0xd4fb('0x88')));}}else if(_0x29a78a[_0xd4fb('0x38')]===_0xd4fb('0x89')){if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')]['scriptName']){return _0x1fc6ee(new Error(_0xd4fb('0x8a')));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')]['scriptPath']){return _0x1fc6ee(new Error(_0xd4fb('0x8b')));}}else{return _0x1fc6ee(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1494e1=_0x29a78a[_0xd4fb('0x32')];var _0x401ba9=_0x29a78a[_0xd4fb('0x8c')];var _0x48e6f4=_0x29a78a[_0xd4fb('0x38')];var _0xf14c9b=_0x29a78a[_0xd4fb('0x8d')]?_0x29a78a[_0xd4fb('0x8d')]:_0xd4fb('0x8e');var _0x18d943=_0x29a78a[_0xd4fb('0x8f')]?_0x29a78a['icon']:_0xd4fb('0x90');var _0x551327='';var _0xa5acef='';var _0x3a8b74='';var _0x527fac='';var _0x3f3015=_0x29a78a[_0xd4fb('0x81')];if(_0x48e6f4===_0xd4fb('0x84')){if('undefined'!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')]){var _0x511fc4=_0x29a78a[_0xd4fb('0x83')]['views'][_0xd4fb('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x511fc4)){_0x551327=path['join']('plugins',_0x85370d,_0x51f29f[0x0],_0x511fc4);}else{_0x551327=_0x511fc4;}}else{logger[_0xd4fb('0x6c')](_0xd4fb('0x92'));}if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x87')]){var _0x555073=_0x29a78a['parameters']['views'][_0xd4fb('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x555073)){_0xa5acef=path[_0xd4fb('0x55')]('plugins',_0x85370d,_0x51f29f[0x0],_0x555073);}else{_0xa5acef=_0x555073;}}else{logger['info'](_0xd4fb('0x93'));}}else if(_0x48e6f4===_0xd4fb('0x89')){_0x3a8b74=_0x29a78a['parameters']['scriptName'];_0x527fac=_0x29a78a[_0xd4fb('0x83')]['scriptPath'];if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')]){if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')]){var _0x511fc4=_0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x511fc4)){_0x551327=path[_0xd4fb('0x55')](_0xd4fb('0x94'),_0x85370d,_0x51f29f[0x0],_0x511fc4);}else{_0x551327=_0x511fc4;}}if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')]['views'][_0xd4fb('0x87')]){var _0x555073=_0x29a78a['parameters']['views'][_0xd4fb('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x555073)){_0xa5acef=path['join'](_0xd4fb('0x94'),_0x85370d,_0x51f29f[0x0],_0x555073);}else{_0xa5acef=_0x555073;}}}}var _0x569e6f={'name':_0x1494e1,'description':_0x401ba9,'path':path[_0xd4fb('0x55')](_0x85370d,_0x51f29f[0x0]),'type':_0x48e6f4,'sidebar':_0xf14c9b,'icon':_0x18d943,'adminUrl':_0x551327,'agentUrl':_0xa5acef,'scriptName':_0x3a8b74,'scriptPath':_0x527fac,'version':_0x3f3015};removeReferences(_0x58c89c,null);return db[_0xd4fb('0x35')][_0xd4fb('0x95')](_0x569e6f)[_0xd4fb('0x2b')](function(_0x287fd0){var _0x254449={'role':_0x5a04d4[_0xd4fb('0x96')][_0xd4fb('0x97')],'userProfileId':_0x5a04d4[_0xd4fb('0x96')][_0xd4fb('0x98')]};if(!_0x254449)throw new Error(_0xd4fb('0x99'));if(_0x254449[_0xd4fb('0x97')]==='user'){var _0x33e9c1=_0x287fd0[_0xd4fb('0x2d')]({'plain':!![]});return db[_0xd4fb('0x9a')]['find']({'where':{'name':_0xd4fb('0x2e'),'userProfileId':_0x254449[_0xd4fb('0x98')]},'raw':!![]})[_0xd4fb('0x2b')](function(_0x2e4a48){if(_0x2e4a48&&_0x2e4a48[_0xd4fb('0x9b')]===0x0){return db[_0xd4fb('0x2f')]['create']({'name':_0x33e9c1['name'],'resourceId':_0x33e9c1['id'],'type':_0x2e4a48[_0xd4fb('0x32')],'sectionId':_0x2e4a48['id']},{})['then'](function(){return _0x287fd0;});}else{return _0x287fd0;}})[_0xd4fb('0x4b')](function(_0x4d7f21){logger[_0xd4fb('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d7f21);throw _0x4d7f21;});}return _0x287fd0;})['then'](respondWithResult(_0xe96b2f,null))[_0xd4fb('0x4b')](handleError(_0xe96b2f,null));}});}catch(_0x5e83d2){_0xe96b2f[_0xd4fb('0x24')](0x1f4)[_0xd4fb('0x9c')](_0x5e83d2);}};function removeReferences(_0x2957e3,_0x222f79){try{if(_0x2957e3){fs['unlinkSync'](_0x2957e3);logger[_0xd4fb('0x6c')](_0xd4fb('0x9d'));}if(_0x222f79){rimraf(_0x222f79,function(){});logger[_0xd4fb('0x6c')](_0xd4fb('0x9e'));}}catch(_0x6eb445){logger[_0xd4fb('0x31')](_0x6eb445);}}exports[_0xd4fb('0x2a')]=function(_0x386d4e,_0x16e16b,_0x1765cf){return db['Plugin'][_0xd4fb('0x51')]({'where':{'id':_0x386d4e[_0xd4fb('0x53')]['id']}})[_0xd4fb('0x2b')](handleEntityNotFound(_0x16e16b,null))[_0xd4fb('0x2b')](saveUpdates(_0x386d4e[_0xd4fb('0x96')],null))[_0xd4fb('0x2b')](respondWithResult(_0x16e16b,null))[_0xd4fb('0x4b')](handleError(_0x16e16b,null));};exports['delete']=function(_0x513df7,_0x3e7f1a,_0x16e025){return db[_0xd4fb('0x35')][_0xd4fb('0x51')]({'where':{'id':_0x513df7[_0xd4fb('0x53')]['id']}})[_0xd4fb('0x2b')](function(_0x1084cf){if(_0x1084cf){return _0x1084cf[_0xd4fb('0x2c')]();}})[_0xd4fb('0x2b')](function(_0x3eeda1){rimraf(path[_0xd4fb('0x55')](config[_0xd4fb('0x56')],_0xd4fb('0x63'),path['dirname'](_0x3eeda1['path'])),function(){});return _0x3eeda1;})[_0xd4fb('0x2b')](handleEntityNotFound(_0x3e7f1a,null))[_0xd4fb('0x2b')](respondWithStatusCode(_0x3e7f1a,null))[_0xd4fb('0x4b')](handleError(_0x3e7f1a,null));};exports[_0xd4fb('0x9f')]=function(_0x54f681,_0x3a0183,_0x1164b6){return BPromise[_0xd4fb('0xa0')]()[_0xd4fb('0x2b')](function(){if(!_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0x54')]){throw new Error(_0xd4fb('0xa1'));}if(!_0x54f681['query'][_0xd4fb('0xa2')]){throw new Error(_0xd4fb('0xa3'));}var _0x23e8dc=_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa4')]?_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa4')]+':'+_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa2')]:_0xd4fb('0xa5')+_0x54f681['query'][_0xd4fb('0xa2')];var _0x590255=_0x54f681[_0xd4fb('0x3b')]['json']?_0x54f681['query'][_0xd4fb('0x25')]:!![];var _0x58e20c=_0x54f681['query'][_0xd4fb('0xa6')]?_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa6')]:null;var _0x102447={'method':_0x54f681[_0xd4fb('0xa7')],'uri':util[_0xd4fb('0x69')](_0xd4fb('0xa8'),_0x23e8dc,_0x54f681['query'][_0xd4fb('0x54')]),'json':_0x590255,'resolveWithFullResponse':!![],'encoding':_0x58e20c,'qs':_0x54f681['query']};if(_0x54f681[_0xd4fb('0xa9')]){_0x102447[_0xd4fb('0xa9')]=_0x54f681['headers'];if(_0x102447[_0xd4fb('0xa9')][_0xd4fb('0xaa')]){delete _0x102447[_0xd4fb('0xa9')][_0xd4fb('0xaa')];}}if(_0x102447[_0xd4fb('0xa9')][_0xd4fb('0xab')]){delete _0x102447[_0xd4fb('0xa9')]['content-type'];}return rp(_0x102447);})[_0xd4fb('0x2b')](function(_0x45d66c){if(_0x45d66c){_0x3a0183[_0xd4fb('0xac')](_0x45d66c[_0xd4fb('0xa9')]);logger['info'](_0x45d66c[_0xd4fb('0x96')]);if(_['endsWith'](_0x54f681[_0xd4fb('0x3b')]['path'],_0xd4fb('0x52'))&&_0x45d66c['statusCode']==0x1f4){return _0x3a0183[_0xd4fb('0x23')](_0x45d66c['statusCode']);}else{return _0x3a0183[_0xd4fb('0x24')](_0x45d66c[_0xd4fb('0xad')])[_0xd4fb('0x9c')](_0x45d66c[_0xd4fb('0x96')]);}}else{return _0x3a0183[_0xd4fb('0x23')](0xc8);}})[_0xd4fb('0x4b')](handleError(_0x3a0183,null));};exports[_0xd4fb('0xae')]=function(_0x4da78f,_0x128375,_0x1a1946){return BPromise[_0xd4fb('0xa0')]()[_0xd4fb('0x2b')](function(){if(!_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0x54')]){throw new Error(_0xd4fb('0xa1'));}if(!_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x38b8b5=_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa4')]?_0x4da78f['query']['hostname']+':'+_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa2')]:_0xd4fb('0xa5')+_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa2')];var _0xf5e838=_0x4da78f[_0xd4fb('0x3b')]['json']?_0x4da78f[_0xd4fb('0x3b')]['json']:!![];var _0x1bd60d=_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa6')]?_0x4da78f[_0xd4fb('0x3b')]['encoding']:null;var _0x270f1f={'method':_0x4da78f[_0xd4fb('0xa7')],'uri':util[_0xd4fb('0x69')]('%s%s',_0x38b8b5,_0x4da78f['query']['path']),'json':_0xf5e838,'resolveWithFullResponse':!![],'encoding':_0x1bd60d,'body':_0x4da78f[_0xd4fb('0x96')]};if(_0x4da78f[_0xd4fb('0xa9')]){_0x270f1f['headers']=_0x4da78f[_0xd4fb('0xa9')];if(_0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xaa')]){delete _0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xaa')];}}if(_0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xab')]){delete _0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xab')];}return rp(_0x270f1f);})[_0xd4fb('0x2b')](function(_0x1f807e){if(_0x1f807e){_0x128375[_0xd4fb('0xac')](_0x1f807e[_0xd4fb('0xa9')]);logger['info'](_0x1f807e[_0xd4fb('0x96')]);return _0x128375[_0xd4fb('0x24')](_0x1f807e['statusCode'])[_0xd4fb('0x9c')](_0x1f807e[_0xd4fb('0x96')]);}else{return _0x128375[_0xd4fb('0x23')](0xc8);}})[_0xd4fb('0x4b')](handleError(_0x128375,null));}; \ No newline at end of file +var _0x5a41=['Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','unlinkSync','Zip\x20archive\x20removed','destroy','webhookGet','resolve','port','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','set','Content-Range','apply','reject','save','update','then','get','Plugins','UserProfileResource','end','stack','name','send','index','Plugin','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','download','root','server/files/plugins','format','%s.zip','basename','createWriteStream','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','error','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined'];(function(_0x5b0635,_0x509bf1){var _0x502113=function(_0x439bd7){while(--_0x439bd7){_0x5b0635['push'](_0x5b0635['shift']());}};_0x502113(++_0x509bf1);}(_0x5a41,0xdc));var _0x15a4=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0x5a41[_0x3c7d53];return _0x2c8387;};'use strict';var pdf=require(_0x15a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15a4('0x1'));var zipdir=require(_0x15a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15a4('0x3'));var moment=require(_0x15a4('0x4'));var BPromise=require(_0x15a4('0x5'));var Mustache=require('mustache');var util=require(_0x15a4('0x6'));var path=require(_0x15a4('0x7'));var sox=require('sox');var csv=require(_0x15a4('0x8'));var ejs=require(_0x15a4('0x9'));var fs=require('fs');var _=require(_0x15a4('0xa'));var squel=require(_0x15a4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x15a4('0xc'));var toCsv=require(_0x15a4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x15a4('0x1'));var archiver=require(_0x15a4('0xd'));var Redis=require(_0x15a4('0xe'));var authService=require(_0x15a4('0xf'));var qs=require(_0x15a4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15a4('0x11'));var logger=require(_0x15a4('0x12'))(_0x15a4('0x13'));var utils=require(_0x15a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x15a4('0x15'));var db=require(_0x15a4('0x16'))['db'];config['redis']=_[_0x15a4('0x17')](config[_0x15a4('0x18')],{'host':_0x15a4('0x19'),'port':0x18eb});var socket=require(_0x15a4('0x1a'))(new Redis(config['redis']));require(_0x15a4('0x1b'))[_0x15a4('0x1c')](socket);function respondWithStatusCode(_0x495342,_0x5dd302){_0x5dd302=_0x5dd302||0xcc;return function(_0x3e3a6d){if(_0x3e3a6d){return _0x495342[_0x15a4('0x1d')](_0x5dd302);}return _0x495342['status'](_0x5dd302)['end']();};}function respondWithResult(_0x181647,_0x4b4efa){_0x4b4efa=_0x4b4efa||0xc8;return function(_0x256b70){if(_0x256b70){return _0x181647[_0x15a4('0x1e')](_0x4b4efa)['json'](_0x256b70);}};}function respondWithFilteredResult(_0x464ddc,_0x2969b9){return function(_0xdf1658){if(_0xdf1658){var _0x4c7c0d=_0xdf1658['count'],_0x2dcb78=_0x2969b9[_0x15a4('0x1f')],_0x564a30=_0x2969b9['offset']+_0x2969b9['limit'],_0x40c9f3;if(_0x564a30>=_0x4c7c0d){_0x564a30=_0x4c7c0d;_0x40c9f3=0xc8;}else{_0x40c9f3=0xce;}_0x464ddc['status'](_0x40c9f3);return _0x464ddc[_0x15a4('0x20')](_0x15a4('0x21'),_0x2dcb78+'-'+_0x564a30+'/'+_0x4c7c0d)['json'](_0xdf1658);}return null;};}function patchUpdates(_0x197aed){return function(_0x2ba43b){try{jsonpatch[_0x15a4('0x22')](_0x2ba43b,_0x197aed,!![]);}catch(_0x36d18e){return BPromise[_0x15a4('0x23')](_0x36d18e);}return _0x2ba43b[_0x15a4('0x24')]();};}function saveUpdates(_0x4c82e6,_0x1d561c){return function(_0x8060a1){if(_0x8060a1){return _0x8060a1[_0x15a4('0x25')](_0x4c82e6)[_0x15a4('0x26')](function(_0x26187a){return _0x26187a;});}return null;};}function removeEntity(_0x5c9f3f,_0x1d2edd){return function(_0xa44f23){if(_0xa44f23){return _0xa44f23['destroy']()[_0x15a4('0x26')](function(){var _0x111301=_0xa44f23[_0x15a4('0x27')]({'plain':!![]});var _0x4ff2ee=_0x15a4('0x28');return db[_0x15a4('0x29')]['destroy']({'where':{'type':_0x4ff2ee,'resourceId':_0x111301['id']}})[_0x15a4('0x26')](function(){return _0xa44f23;});})[_0x15a4('0x26')](function(){_0x5c9f3f[_0x15a4('0x1e')](0xcc)[_0x15a4('0x2a')]();});}};}function handleEntityNotFound(_0x57106c,_0x113b56){return function(_0x199dff){if(!_0x199dff){_0x57106c[_0x15a4('0x1d')](0x194);}return _0x199dff;};}function handleError(_0x53a8a7,_0x5d9d8d){_0x5d9d8d=_0x5d9d8d||0x1f4;return function(_0x29718b){logger['error'](_0x29718b[_0x15a4('0x2b')]);if(_0x29718b['name']){delete _0x29718b[_0x15a4('0x2c')];}_0x53a8a7['status'](_0x5d9d8d)[_0x15a4('0x2d')](_0x29718b);};}exports[_0x15a4('0x2e')]=function(_0x395a9c,_0x56d5db){var _0x552b1b={},_0x2f24ee={},_0x57e224={'count':0x0,'rows':[]};var _0x32803e=_['map'](db[_0x15a4('0x2f')]['rawAttributes'],function(_0x518b0d){return{'name':_0x518b0d[_0x15a4('0x30')],'type':_0x518b0d[_0x15a4('0x31')][_0x15a4('0x32')]};});_0x2f24ee[_0x15a4('0x33')]=_[_0x15a4('0x34')](_0x32803e,_0x15a4('0x2c'));_0x2f24ee[_0x15a4('0x35')]=_[_0x15a4('0x36')](_0x395a9c[_0x15a4('0x35')]);_0x2f24ee[_0x15a4('0x37')]=_[_0x15a4('0x38')](_0x2f24ee[_0x15a4('0x33')],_0x2f24ee['query']);_0x552b1b[_0x15a4('0x39')]=_[_0x15a4('0x38')](_0x2f24ee[_0x15a4('0x33')],qs[_0x15a4('0x3a')](_0x395a9c[_0x15a4('0x35')][_0x15a4('0x3a')]));_0x552b1b[_0x15a4('0x39')]=_0x552b1b['attributes'][_0x15a4('0x3b')]?_0x552b1b[_0x15a4('0x39')]:_0x2f24ee[_0x15a4('0x33')];if(!_0x395a9c['query']['hasOwnProperty'](_0x15a4('0x3c'))){_0x552b1b[_0x15a4('0x3d')]=qs[_0x15a4('0x3d')](_0x395a9c[_0x15a4('0x35')][_0x15a4('0x3d')]);_0x552b1b[_0x15a4('0x1f')]=qs['offset'](_0x395a9c[_0x15a4('0x35')][_0x15a4('0x1f')]);}_0x552b1b[_0x15a4('0x3e')]=qs['sort'](_0x395a9c[_0x15a4('0x35')][_0x15a4('0x3f')]);_0x552b1b['where']=qs[_0x15a4('0x37')](_[_0x15a4('0x40')](_0x395a9c[_0x15a4('0x35')],_0x2f24ee[_0x15a4('0x37')]),_0x32803e);if(_0x395a9c[_0x15a4('0x35')]['filter']){_0x552b1b[_0x15a4('0x41')]=_['merge'](_0x552b1b[_0x15a4('0x41')],{'$or':_['map'](_0x32803e,function(_0x5b944b){if(_0x5b944b[_0x15a4('0x31')]!==_0x15a4('0x42')){var _0x5d1374={};_0x5d1374[_0x5b944b[_0x15a4('0x2c')]]={'$like':'%'+_0x395a9c['query'][_0x15a4('0x43')]+'%'};return _0x5d1374;}})});}_0x552b1b=_[_0x15a4('0x44')]({},_0x552b1b,_0x395a9c[_0x15a4('0x45')]);var _0x207596={'where':_0x552b1b[_0x15a4('0x41')]};return db[_0x15a4('0x2f')][_0x15a4('0x46')](_0x207596)[_0x15a4('0x26')](function(_0x52052d){_0x57e224[_0x15a4('0x46')]=_0x52052d;if(_0x395a9c[_0x15a4('0x35')][_0x15a4('0x47')]){_0x552b1b[_0x15a4('0x48')]=[{'all':!![]}];}return db[_0x15a4('0x2f')][_0x15a4('0x49')](_0x552b1b);})[_0x15a4('0x26')](function(_0x4f3949){_0x57e224[_0x15a4('0x4a')]=_0x4f3949;return _0x57e224;})[_0x15a4('0x26')](respondWithFilteredResult(_0x56d5db,_0x552b1b))[_0x15a4('0x4b')](handleError(_0x56d5db,null));};exports[_0x15a4('0x4c')]=function(_0x10bae7,_0x4b14b2){var _0x176515={'raw':!![],'where':{'id':_0x10bae7[_0x15a4('0x4d')]['id']}},_0x35c23a={};_0x35c23a[_0x15a4('0x33')]=_[_0x15a4('0x36')](db[_0x15a4('0x2f')][_0x15a4('0x4e')]);_0x35c23a['query']=_[_0x15a4('0x36')](_0x10bae7['query']);_0x35c23a[_0x15a4('0x37')]=_[_0x15a4('0x38')](_0x35c23a['model'],_0x35c23a[_0x15a4('0x35')]);_0x176515['attributes']=_[_0x15a4('0x38')](_0x35c23a[_0x15a4('0x33')],qs[_0x15a4('0x3a')](_0x10bae7[_0x15a4('0x35')][_0x15a4('0x3a')]));_0x176515['attributes']=_0x176515[_0x15a4('0x39')][_0x15a4('0x3b')]?_0x176515['attributes']:_0x35c23a[_0x15a4('0x33')];if(_0x10bae7[_0x15a4('0x35')][_0x15a4('0x47')]){_0x176515[_0x15a4('0x48')]=[{'all':!![]}];}_0x176515=_[_0x15a4('0x44')]({},_0x176515,_0x10bae7[_0x15a4('0x45')]);return db[_0x15a4('0x2f')][_0x15a4('0x4f')](_0x176515)[_0x15a4('0x26')](handleEntityNotFound(_0x4b14b2,null))[_0x15a4('0x26')](respondWithResult(_0x4b14b2,null))[_0x15a4('0x4b')](handleError(_0x4b14b2,null));};exports[_0x15a4('0x50')]=function(_0x3d56cd,_0x190911,_0x422df8){return db[_0x15a4('0x2f')][_0x15a4('0x4f')]({'where':{'id':_0x3d56cd[_0x15a4('0x4d')]['id']},'attributes':[_0x15a4('0x2c'),_0x15a4('0x7')],'raw':!![]})[_0x15a4('0x26')](handleEntityNotFound(_0x190911,null))[_0x15a4('0x26')](function(_0x3ee358){if(_0x3ee358){var _0x194d09=path['join'](config[_0x15a4('0x51')],_0x15a4('0x52'),util[_0x15a4('0x53')](_0x15a4('0x54'),path[_0x15a4('0x55')](_0x3ee358[_0x15a4('0x7')])));var _0x4abdfa=fs[_0x15a4('0x56')](_0x194d09);var _0x19fee5=archiver('zip',{'zlib':{'level':0x9}});_0x19fee5['on']('warning',function(_0x2bab70){if(_0x2bab70[_0x15a4('0x57')]===_0x15a4('0x58')){logger['error'](_0x2bab70);}else{throw new db[(_0x15a4('0x59'))]['Error'](_0x15a4('0x5a'));}});_0x19fee5['on']('error',function(_0x24302a){throw new db['Sequelize'][(_0x15a4('0x5b'))](_0x15a4('0x5a'));});_0x19fee5[_0x15a4('0x5c')](_0x4abdfa);_0x19fee5[_0x15a4('0x5d')](_0x15a4('0x5e'),{'cwd':path[_0x15a4('0x5f')](config[_0x15a4('0x51')],_0x15a4('0x52'),path[_0x15a4('0x60')](_0x3ee358[_0x15a4('0x7')])),'ignore':[path[_0x15a4('0x5f')](path[_0x15a4('0x55')](_0x3ee358[_0x15a4('0x7')]),_0x15a4('0x61')),path[_0x15a4('0x5f')](path['basename'](_0x3ee358[_0x15a4('0x7')]),_0x15a4('0x62'))],'nodir':!![]})['finalize']();_0x4abdfa['on'](_0x15a4('0x63'),function(){if(!fs[_0x15a4('0x64')](_0x194d09)){throw new db['Sequelize'][(_0x15a4('0x5b'))]('Plugin\x20not\x20found');}return _0x190911[_0x15a4('0x50')](_0x194d09,util[_0x15a4('0x53')](_0x15a4('0x54'),path[_0x15a4('0x55')](_0x3ee358[_0x15a4('0x7')])),function(_0x572664){if(_0x572664){throw new db[(_0x15a4('0x59'))]['Error'](_0x15a4('0x65'));}fs['unlinkSync'](_0x194d09);logger[_0x15a4('0x66')]('Download\x20completed');logger['info'](_0x15a4('0x67'));});});}return null;})[_0x15a4('0x4b')](handleError(_0x190911,null));};exports[_0x15a4('0x68')]=function(_0x41a36f,_0x45263c,_0x3eab93){var _0x2790ea=path[_0x15a4('0x55')](_0x41a36f[_0x15a4('0x69')][_0x15a4('0x6a')],path[_0x15a4('0x6b')](_0x41a36f[_0x15a4('0x69')][_0x15a4('0x6a')]));var _0x4b9623=path['join'](config['root'],_0x15a4('0x52'),_0x41a36f[_0x15a4('0x69')][_0x15a4('0x6a')]);var _0x5a0624=path['join'](config[_0x15a4('0x51')],'server/files/plugins',_0x2790ea);logger[_0x15a4('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x4b9623);logger[_0x15a4('0x66')](_0x15a4('0x6c'),_0x5a0624);try{fs[_0x15a4('0x6d')](_0x4b9623,parseInt(_0x15a4('0x6e'),0x8));extract(_0x4b9623,{'dir':_0x5a0624},function(_0x498864){if(_0x498864){logger[_0x15a4('0x6f')](_0x498864);handleError(_0x498864,!![]);};var _0x2c5911=fs[_0x15a4('0x70')](_0x5a0624);if(_0x2c5911[_0x15a4('0x3b')]>0x1){removeReferences(_0x4b9623,_0x5a0624);logger['error'](_0x15a4('0x71'));return _0x3eab93(new Error(_0x15a4('0x71')));}var _0x3faeab=fs[_0x15a4('0x72')](path[_0x15a4('0x5f')](_0x5a0624,_0x2c5911[0x0]));if(_0x3faeab['isFile']()){removeReferences(_0x4b9623,_0x5a0624);logger[_0x15a4('0x6f')](_0x15a4('0x71'));return _0x3eab93(new Error(_0x15a4('0x71')));}if(_0x3faeab[_0x15a4('0x73')]()){var _0x128730=fs['readdirSync'](path[_0x15a4('0x5f')](_0x5a0624,_0x2c5911[0x0]));if(_0x128730['length']===0x0){removeReferences(_0x4b9623,_0x5a0624);logger[_0x15a4('0x6f')](_0x15a4('0x71'));return _0x3eab93(new Error(_0x15a4('0x71')));}var _0x5328e5=_0x128730['some'](function(_0x223916){return _0x223916===_0x15a4('0x74');});if(!_0x5328e5){return _0x3eab93(new Error(_0x15a4('0x75')));}var _0xd1246b=fs[_0x15a4('0x76')](path[_0x15a4('0x5f')](_0x5a0624,_0x2c5911[0x0],_0x15a4('0x74')));var _0x8d1f09=JSON['parse'](_0xd1246b);if(_0x15a4('0x77')==typeof _0x8d1f09[_0x15a4('0x2c')]){return _0x3eab93(new Error(_0x15a4('0x78')));}if(_0x15a4('0x77')==typeof _0x8d1f09[_0x15a4('0x31')]){return _0x3eab93(new Error(_0x15a4('0x79')));}if(_0x15a4('0x77')==typeof _0x8d1f09[_0x15a4('0x7a')]){return _0x3eab93(new Error(_0x15a4('0x7b')));}if(_0x15a4('0x77')==typeof _0x8d1f09[_0x15a4('0x7c')]){return _0x3eab93(new Error(_0x15a4('0x7d')));}if(_0x8d1f09[_0x15a4('0x31')]==='html'){if(_0x15a4('0x77')==typeof _0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x7e')]){return _0x3eab93(new Error(_0x15a4('0x7f')));}if(_0x15a4('0x77')==typeof _0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x7e')]['admin']&&_0x15a4('0x77')==typeof _0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x7e')][_0x15a4('0x80')]){return _0x3eab93(new Error(_0x15a4('0x81')));}}else if(_0x8d1f09[_0x15a4('0x31')]==='script'){if('undefined'==typeof _0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x82')]){return _0x3eab93(new Error(_0x15a4('0x83')));}if('undefined'==typeof _0x8d1f09[_0x15a4('0x7c')]['scriptPath']){return _0x3eab93(new Error(_0x15a4('0x84')));}}else{return _0x3eab93(new Error(_0x15a4('0x85')));}var _0x426fe7=_0x8d1f09[_0x15a4('0x2c')];var _0x435b41=_0x8d1f09[_0x15a4('0x86')];var _0x2435be=_0x8d1f09['type'];var _0x5cf01d=_0x8d1f09[_0x15a4('0x87')]?_0x8d1f09[_0x15a4('0x87')]:_0x15a4('0x88');var _0x1b8b88=_0x8d1f09[_0x15a4('0x89')]?_0x8d1f09['icon']:_0x15a4('0x8a');var _0x507ae5='';var _0x2dc0fd='';var _0x251a7b='';var _0xb9d7b4='';var _0x1f062e=_0x8d1f09[_0x15a4('0x7a')];if(_0x2435be==='html'){if(_0x15a4('0x77')!=typeof _0x8d1f09[_0x15a4('0x7c')]['views'][_0x15a4('0x8b')]){var _0xd143bd=_0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x15a4('0x8c')](_0xd143bd)){_0x507ae5=path[_0x15a4('0x5f')]('plugins',_0x2790ea,_0x2c5911[0x0],_0xd143bd);}else{_0x507ae5=_0xd143bd;}}else{logger[_0x15a4('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x15a4('0x77')!=typeof _0x8d1f09['parameters'][_0x15a4('0x7e')][_0x15a4('0x80')]){var _0x43e208=_0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x15a4('0x8c')](_0x43e208)){_0x2dc0fd=path[_0x15a4('0x5f')](_0x15a4('0x8d'),_0x2790ea,_0x2c5911[0x0],_0x43e208);}else{_0x2dc0fd=_0x43e208;}}else{logger['info'](_0x15a4('0x8e'));}}else if(_0x2435be==='script'){_0x251a7b=_0x8d1f09[_0x15a4('0x7c')]['scriptName'];_0xb9d7b4=_0x8d1f09['parameters'][_0x15a4('0x8f')];if(_0x15a4('0x77')!=typeof _0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x7e')]){if('undefined'!=typeof _0x8d1f09['parameters'][_0x15a4('0x7e')]['admin']){var _0xd143bd=_0x8d1f09['parameters']['views'][_0x15a4('0x8b')];if(!/^(f|ht)tps?:\/\//i['test'](_0xd143bd)){_0x507ae5=path[_0x15a4('0x5f')](_0x15a4('0x8d'),_0x2790ea,_0x2c5911[0x0],_0xd143bd);}else{_0x507ae5=_0xd143bd;}}if('undefined'!=typeof _0x8d1f09['parameters'][_0x15a4('0x7e')][_0x15a4('0x80')]){var _0x43e208=_0x8d1f09[_0x15a4('0x7c')][_0x15a4('0x7e')][_0x15a4('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x15a4('0x8c')](_0x43e208)){_0x2dc0fd=path[_0x15a4('0x5f')](_0x15a4('0x8d'),_0x2790ea,_0x2c5911[0x0],_0x43e208);}else{_0x2dc0fd=_0x43e208;}}}}var _0x50afbd={'name':_0x426fe7,'description':_0x435b41,'path':path[_0x15a4('0x5f')](_0x2790ea,_0x2c5911[0x0]),'type':_0x2435be,'sidebar':_0x5cf01d,'icon':_0x1b8b88,'adminUrl':_0x507ae5,'agentUrl':_0x2dc0fd,'scriptName':_0x251a7b,'scriptPath':_0xb9d7b4,'version':_0x1f062e};removeReferences(_0x4b9623,null);return db[_0x15a4('0x2f')][_0x15a4('0x90')](_0x50afbd)[_0x15a4('0x26')](function(_0x6eb856){var _0x4aa5d4={'role':_0x41a36f[_0x15a4('0x91')]['role'],'userProfileId':_0x41a36f['body'][_0x15a4('0x92')]};if(!_0x4aa5d4)throw new Error(_0x15a4('0x93'));if(_0x4aa5d4[_0x15a4('0x94')]===_0x15a4('0x95')){var _0x2accfb=_0x6eb856['get']({'plain':!![]});return db[_0x15a4('0x96')]['find']({'where':{'name':_0x15a4('0x28'),'userProfileId':_0x4aa5d4['userProfileId']},'raw':!![]})['then'](function(_0x19c0c8){if(_0x19c0c8&&_0x19c0c8[_0x15a4('0x97')]===0x0){return db[_0x15a4('0x29')][_0x15a4('0x90')]({'name':_0x2accfb[_0x15a4('0x2c')],'resourceId':_0x2accfb['id'],'type':_0x19c0c8[_0x15a4('0x2c')],'sectionId':_0x19c0c8['id']},{})[_0x15a4('0x26')](function(){return _0x6eb856;});}else{return _0x6eb856;}})['catch'](function(_0xee284f){logger[_0x15a4('0x6f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xee284f);throw _0xee284f;});}return _0x6eb856;})[_0x15a4('0x26')](respondWithResult(_0x45263c,null))[_0x15a4('0x4b')](handleError(_0x45263c,null));}});}catch(_0x380eb5){_0x45263c[_0x15a4('0x1e')](0x1f4)[_0x15a4('0x2d')](_0x380eb5);}};function removeReferences(_0x22dac7,_0x47cd26){try{if(_0x22dac7){fs[_0x15a4('0x98')](_0x22dac7);logger[_0x15a4('0x66')](_0x15a4('0x99'));}if(_0x47cd26){rimraf(_0x47cd26,function(){});logger[_0x15a4('0x66')]('Extracted\x20folder\x20removed');}}catch(_0x1f97d3){logger[_0x15a4('0x6f')](_0x1f97d3);}}exports[_0x15a4('0x25')]=function(_0x5f3432,_0x7c29a5,_0x4c410f){return db[_0x15a4('0x2f')][_0x15a4('0x4f')]({'where':{'id':_0x5f3432[_0x15a4('0x4d')]['id']}})[_0x15a4('0x26')](handleEntityNotFound(_0x7c29a5,null))[_0x15a4('0x26')](saveUpdates(_0x5f3432['body'],null))['then'](respondWithResult(_0x7c29a5,null))[_0x15a4('0x4b')](handleError(_0x7c29a5,null));};exports['delete']=function(_0xfb26f6,_0x5b89c6,_0xf21af5){return db[_0x15a4('0x2f')][_0x15a4('0x4f')]({'where':{'id':_0xfb26f6[_0x15a4('0x4d')]['id']}})[_0x15a4('0x26')](function(_0x5ba9f7){if(_0x5ba9f7){return _0x5ba9f7[_0x15a4('0x9a')]();}})[_0x15a4('0x26')](function(_0x2216ae){rimraf(path[_0x15a4('0x5f')](config[_0x15a4('0x51')],_0x15a4('0x52'),path['dirname'](_0x2216ae[_0x15a4('0x7')])),function(){});return _0x2216ae;})[_0x15a4('0x26')](handleEntityNotFound(_0x5b89c6,null))[_0x15a4('0x26')](respondWithStatusCode(_0x5b89c6,null))['catch'](handleError(_0x5b89c6,null));};exports[_0x15a4('0x9b')]=function(_0x139aeb,_0x4a0e82,_0x19347a){return BPromise[_0x15a4('0x9c')]()['then'](function(){if(!_0x139aeb[_0x15a4('0x35')][_0x15a4('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x139aeb[_0x15a4('0x35')][_0x15a4('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1d321d=_0x139aeb['query'][_0x15a4('0x9e')]?_0x139aeb['query'][_0x15a4('0x9e')]+':'+_0x139aeb[_0x15a4('0x35')]['port']:_0x15a4('0x9f')+_0x139aeb[_0x15a4('0x35')][_0x15a4('0x9d')];var _0x281b5d=_0x139aeb['query'][_0x15a4('0xa0')]?_0x139aeb[_0x15a4('0x35')][_0x15a4('0xa0')]:!![];var _0x10e4c8=_0x139aeb['query'][_0x15a4('0xa1')]?_0x139aeb['query']['encoding']:null;var _0x24d231={'method':_0x139aeb[_0x15a4('0xa2')],'uri':util[_0x15a4('0x53')](_0x15a4('0xa3'),_0x1d321d,_0x139aeb[_0x15a4('0x35')]['path']),'json':_0x281b5d,'resolveWithFullResponse':!![],'encoding':_0x10e4c8,'qs':_0x139aeb['query']};if(_0x139aeb[_0x15a4('0xa4')]){_0x24d231[_0x15a4('0xa4')]=_0x139aeb[_0x15a4('0xa4')];if(_0x24d231[_0x15a4('0xa4')][_0x15a4('0xa5')]){delete _0x24d231[_0x15a4('0xa4')]['content-length'];}}if(_0x24d231[_0x15a4('0xa4')][_0x15a4('0xa6')]){delete _0x24d231[_0x15a4('0xa4')][_0x15a4('0xa6')];}return rp(_0x24d231);})[_0x15a4('0x26')](function(_0x209324){if(_0x209324){_0x4a0e82['set'](_0x209324[_0x15a4('0xa4')]);logger[_0x15a4('0x66')](_0x209324['body']);if(_[_0x15a4('0xa7')](_0x139aeb[_0x15a4('0x35')][_0x15a4('0x7')],'download')&&_0x209324[_0x15a4('0xa8')]==0x1f4){return _0x4a0e82[_0x15a4('0x1d')](_0x209324[_0x15a4('0xa8')]);}else{return _0x4a0e82[_0x15a4('0x1e')](_0x209324[_0x15a4('0xa8')])[_0x15a4('0x2d')](_0x209324[_0x15a4('0x91')]);}}else{return _0x4a0e82[_0x15a4('0x1d')](0xc8);}})[_0x15a4('0x4b')](handleError(_0x4a0e82,null));};exports['webhookPost']=function(_0x18aac3,_0x2599c6,_0xcd71e){return BPromise['resolve']()[_0x15a4('0x26')](function(){if(!_0x18aac3[_0x15a4('0x35')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x18aac3[_0x15a4('0x35')][_0x15a4('0x9d')]){throw new Error(_0x15a4('0xa9'));}var _0x229715=_0x18aac3[_0x15a4('0x35')][_0x15a4('0x9e')]?_0x18aac3[_0x15a4('0x35')][_0x15a4('0x9e')]+':'+_0x18aac3[_0x15a4('0x35')][_0x15a4('0x9d')]:_0x15a4('0x9f')+_0x18aac3[_0x15a4('0x35')][_0x15a4('0x9d')];var _0x47c6c6=_0x18aac3[_0x15a4('0x35')][_0x15a4('0xa0')]?_0x18aac3['query'][_0x15a4('0xa0')]:!![];var _0x4cdcd3=_0x18aac3[_0x15a4('0x35')][_0x15a4('0xa1')]?_0x18aac3['query'][_0x15a4('0xa1')]:null;var _0x2ab1c2={'method':_0x18aac3[_0x15a4('0xa2')],'uri':util[_0x15a4('0x53')](_0x15a4('0xa3'),_0x229715,_0x18aac3['query'][_0x15a4('0x7')]),'json':_0x47c6c6,'resolveWithFullResponse':!![],'encoding':_0x4cdcd3,'body':_0x18aac3[_0x15a4('0x91')]};if(_0x18aac3[_0x15a4('0xa4')]){_0x2ab1c2['headers']=_0x18aac3[_0x15a4('0xa4')];if(_0x2ab1c2[_0x15a4('0xa4')]['content-length']){delete _0x2ab1c2[_0x15a4('0xa4')][_0x15a4('0xa5')];}}if(_0x2ab1c2[_0x15a4('0xa4')][_0x15a4('0xa6')]){delete _0x2ab1c2['headers'][_0x15a4('0xa6')];}return rp(_0x2ab1c2);})['then'](function(_0x36367e){if(_0x36367e){_0x2599c6['set'](_0x36367e[_0x15a4('0xa4')]);logger[_0x15a4('0x66')](_0x36367e[_0x15a4('0x91')]);return _0x2599c6[_0x15a4('0x1e')](_0x36367e[_0x15a4('0xa8')])[_0x15a4('0x2d')](_0x36367e['body']);}else{return _0x2599c6['sendStatus'](0xc8);}})['catch'](handleError(_0x2599c6,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 926372b..d1a4932 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 _0xcf2f=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x524621,_0x6595c){var _0x228276=function(_0x3514e6){while(--_0x3514e6){_0x524621['push'](_0x524621['shift']());}};_0x228276(++_0x6595c);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x390fea,_0x25a6ed){_0x390fea=_0x390fea-0x0;var _0x412196=_0xcf2f[_0x390fea];return _0x412196;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var Plugin=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xfcf2('0x3')](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':'update','afterDestroy':_0xfcf2('0x5')};function emitEvent(_0x12ddf5){return function(_0x1e3661,_0x34bcaf,_0x179e60){PluginEvents[_0xfcf2('0x6')](_0x12ddf5+':'+_0x1e3661['id'],_0x1e3661);PluginEvents[_0xfcf2('0x6')](_0x12ddf5,_0x1e3661);_0x179e60(null);};}for(var e in events){if(events[_0xfcf2('0x7')](e)){var event=events[e];Plugin[_0xfcf2('0x8')](e,emitEvent(event));}}module[_0xfcf2('0x9')]=PluginEvents; \ No newline at end of file +var _0x1c9a=['events','Plugin','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5a8230,_0x75184a){var _0x1d70fc=function(_0x28b631){while(--_0x28b631){_0x5a8230['push'](_0x5a8230['shift']());}};_0x1d70fc(++_0x75184a);}(_0x1c9a,0x98));var _0xa1c9=function(_0x4a4845,_0x2af197){_0x4a4845=_0x4a4845-0x0;var _0x3bb0b1=_0x1c9a[_0x4a4845];return _0x3bb0b1;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var Plugin=require('../../mysqldb')['db'][_0xa1c9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa1c9('0x2'),'afterUpdate':_0xa1c9('0x3'),'afterDestroy':_0xa1c9('0x4')};function emitEvent(_0x4bf57e){return function(_0x21c0fc,_0x45d1f7,_0x20f0bf){PluginEvents[_0xa1c9('0x5')](_0x4bf57e+':'+_0x21c0fc['id'],_0x21c0fc);PluginEvents['emit'](_0x4bf57e,_0x21c0fc);_0x20f0bf(null);};}for(var e in events){if(events[_0xa1c9('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xa1c9('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4622aa3..3d87e05 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x58509c,_0x229042){var _0x285ef5=function(_0x45c713){while(--_0x45c713){_0x58509c['push'](_0x58509c['shift']());}};_0x285ef5(++_0x229042);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5b9aeb,_0x4cf4e1){_0x5b9aeb=_0x5b9aeb-0x0;var _0x22c26e=_0x9c5a[_0x5b9aeb];return _0x22c26e;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./plugin.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','plugins','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x008c,0x188));var _0xc008=function(_0x533897,_0x34e7c8){_0x533897=_0x533897-0x0;var _0x340bbd=_0x008c[_0x533897];return _0x340bbd;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Plugin',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 9944a82..489e606 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 _0x54df=['catch','CreatePlugin','Plugin','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x54df,0x65));var _0xf54d=function(_0x4b124d,_0xefd723){_0x4b124d=_0x4b124d-0x0;var _0x44e812=_0x54df[_0x4b124d];return _0x44e812;};'use strict';var _=require(_0xf54d('0x0'));var util=require(_0xf54d('0x1'));var moment=require(_0xf54d('0x2'));var BPromise=require(_0xf54d('0x3'));var rs=require(_0xf54d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf54d('0x5'))['db'];var utils=require(_0xf54d('0x6'));var logger=require(_0xf54d('0x7'))('rpc');var config=require(_0xf54d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf54d('0x9')]['http']({'port':0x232a});config[_0xf54d('0xa')]=_[_0xf54d('0xb')](config['redis'],{'host':_0xf54d('0xc'),'port':0x18eb});var socket=require(_0xf54d('0xd'))(new Redis(config[_0xf54d('0xa')]));require('./plugin.socket')[_0xf54d('0xe')](socket);function respondWithRpcPromise(_0x48c4de,_0x13601f,_0x3f8ad7){return new BPromise(function(_0x25bc35,_0x3abdfe){return client[_0xf54d('0xf')](_0x48c4de,_0x3f8ad7)[_0xf54d('0x10')](function(_0x98b6a9){logger[_0xf54d('0x11')](_0xf54d('0x12'),_0x13601f,_0xf54d('0x13'));logger[_0xf54d('0x14')](_0xf54d('0x15'),_0x13601f,_0xf54d('0x13'),JSON[_0xf54d('0x16')](_0x98b6a9));if(_0x98b6a9[_0xf54d('0x17')]){if(_0x98b6a9[_0xf54d('0x17')][_0xf54d('0x18')]===0x1f4){logger[_0xf54d('0x17')]('Plugin,\x20%s,\x20%s',_0x13601f,_0x98b6a9['error'][_0xf54d('0x19')]);return _0x3abdfe(_0x98b6a9[_0xf54d('0x17')]['message']);}logger[_0xf54d('0x17')](_0xf54d('0x12'),_0x13601f,_0x98b6a9[_0xf54d('0x17')][_0xf54d('0x19')]);return _0x25bc35(_0x98b6a9[_0xf54d('0x17')][_0xf54d('0x19')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x13601f,'request\x20sent');_0x25bc35(_0x98b6a9[_0xf54d('0x1a')][_0xf54d('0x19')]);}})[_0xf54d('0x1b')](function(_0x4c4ce8){logger[_0xf54d('0x17')](_0xf54d('0x12'),_0x13601f,_0x4c4ce8);_0x3abdfe(_0x4c4ce8);});});}exports[_0xf54d('0x1c')]=function(_0x32cbc6){var _0x4faaf1=this;return new Promise(function(_0x3b460b,_0x23feaa){return db[_0xf54d('0x1d')]['create'](_0x32cbc6[_0xf54d('0x1e')],{'raw':_0x32cbc6[_0xf54d('0x1f')]?_0x32cbc6[_0xf54d('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53c412){logger['info'](_0xf54d('0x1c'),_0x32cbc6);logger[_0xf54d('0x14')](_0xf54d('0x1c'),_0x32cbc6,JSON['stringify'](_0x53c412));_0x3b460b(_0x53c412);})[_0xf54d('0x1b')](function(_0x1befba){logger[_0xf54d('0x17')](_0xf54d('0x1c'),_0x1befba[_0xf54d('0x19')],_0x32cbc6);_0x23feaa(_0x4faaf1[_0xf54d('0x17')](0x1f4,_0x1befba[_0xf54d('0x19')]));});});}; \ No newline at end of file +var _0x92fd=['result','catch','CreatePlugin','create','body','options','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92fd,0x132));var _0xd92f=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x92fd[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0xd92f('0x0'));var util=require(_0xd92f('0x1'));var moment=require(_0xd92f('0x2'));var BPromise=require(_0xd92f('0x3'));var rs=require(_0xd92f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd92f('0x5'))(_0xd92f('0x6'));var config=require(_0xd92f('0x7'));var jayson=require(_0xd92f('0x8'));var client=jayson[_0xd92f('0x9')][_0xd92f('0xa')]({'port':0x232a});config['redis']=_[_0xd92f('0xb')](config[_0xd92f('0xc')],{'host':_0xd92f('0xd'),'port':0x18eb});var socket=require(_0xd92f('0xe'))(new Redis(config[_0xd92f('0xc')]));require('./plugin.socket')[_0xd92f('0xf')](socket);function respondWithRpcPromise(_0x422dbf,_0x54607e,_0x76e044){return new BPromise(function(_0x5260ca,_0x1798ef){return client['request'](_0x422dbf,_0x76e044)[_0xd92f('0x10')](function(_0x2de866){logger['info'](_0xd92f('0x11'),_0x54607e,'request\x20sent');logger[_0xd92f('0x12')](_0xd92f('0x13'),_0x54607e,'request\x20sent',JSON['stringify'](_0x2de866));if(_0x2de866[_0xd92f('0x14')]){if(_0x2de866['error']['code']===0x1f4){logger[_0xd92f('0x14')](_0xd92f('0x11'),_0x54607e,_0x2de866[_0xd92f('0x14')][_0xd92f('0x15')]);return _0x1798ef(_0x2de866[_0xd92f('0x14')]['message']);}logger['error']('Plugin,\x20%s,\x20%s',_0x54607e,_0x2de866['error'][_0xd92f('0x15')]);return _0x5260ca(_0x2de866['error'][_0xd92f('0x15')]);}else{logger[_0xd92f('0x16')](_0xd92f('0x11'),_0x54607e,_0xd92f('0x17'));_0x5260ca(_0x2de866[_0xd92f('0x18')]['message']);}})[_0xd92f('0x19')](function(_0xffc7d8){logger['error'](_0xd92f('0x11'),_0x54607e,_0xffc7d8);_0x1798ef(_0xffc7d8);});});}exports[_0xd92f('0x1a')]=function(_0x2c346c){var _0x533833=this;return new Promise(function(_0x2e9b73,_0x5aa035){return db['Plugin'][_0xd92f('0x1b')](_0x2c346c[_0xd92f('0x1c')],{'raw':_0x2c346c[_0xd92f('0x1d')]?_0x2c346c[_0xd92f('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xd92f('0x10')](function(_0x242405){logger[_0xd92f('0x16')]('CreatePlugin',_0x2c346c);logger['debug'](_0xd92f('0x1a'),_0x2c346c,JSON['stringify'](_0x242405));_0x2e9b73(_0x242405);})['catch'](function(_0x1360d2){logger[_0xd92f('0x14')]('CreatePlugin',_0x1360d2[_0xd92f('0x15')],_0x2c346c);_0x5aa035(_0x533833[_0xd92f('0x14')](0x1f4,_0x1360d2['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b9b8e59..adb9c8b 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 _0xefe8=['removeListener','length','plugin:','./plugin.events','remove','emit'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xefe8,0xc3));var _0x8efe=function(_0x454f02,_0x32ce79){_0x454f02=_0x454f02-0x0;var _0x3369f7=_0xefe8[_0x454f02];return _0x3369f7;};'use strict';var PluginEvents=require(_0x8efe('0x0'));var events=['save',_0x8efe('0x1'),'update'];function createListener(_0x5d0fa2,_0x1d85e8){return function(_0x2b8534){_0x1d85e8[_0x8efe('0x2')](_0x5d0fa2,_0x2b8534);};}function removeListener(_0xc4b454,_0x3de15f){return function(){PluginEvents[_0x8efe('0x3')](_0xc4b454,_0x3de15f);};}exports['register']=function(_0x4e7d5a){for(var _0x7ad446=0x0,_0x29a478=events[_0x8efe('0x4')];_0x7ad446<_0x29a478;_0x7ad446++){var _0x583885=events[_0x7ad446];var _0x1de1de=createListener(_0x8efe('0x5')+_0x583885,_0x4e7d5a);PluginEvents['on'](_0x583885,_0x1de1de);}}; \ No newline at end of file +var _0x4838=['removeListener','register','length','save','update','emit'];(function(_0xc2daf7,_0x2da9c7){var _0x473501=function(_0xce9111){while(--_0xce9111){_0xc2daf7['push'](_0xc2daf7['shift']());}};_0x473501(++_0x2da9c7);}(_0x4838,0x111));var _0x8483=function(_0xdc1af6,_0x79253c){_0xdc1af6=_0xdc1af6-0x0;var _0x13b90a=_0x4838[_0xdc1af6];return _0x13b90a;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8483('0x0'),'remove',_0x8483('0x1')];function createListener(_0x35ff37,_0x362905){return function(_0x27d9bf){_0x362905[_0x8483('0x2')](_0x35ff37,_0x27d9bf);};}function removeListener(_0x2a23c2,_0x255aac){return function(){PluginEvents[_0x8483('0x3')](_0x2a23c2,_0x255aac);};}exports[_0x8483('0x4')]=function(_0x3f21ad){for(var _0x24a29a=0x0,_0x169df1=events[_0x8483('0x5')];_0x24a29a<_0x169df1;_0x24a29a++){var _0x5efc2b=events[_0x24a29a];var _0x47ad02=createListener('plugin:'+_0x5efc2b,_0x3f21ad);PluginEvents['on'](_0x5efc2b,_0x47ad02);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 5bb6a0d..a128a44 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 _0x2d21=['post','create','put','update','delete','/:id','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2d21,0x1e8));var _0x12d2=function(_0x3b20c2,_0x888661){_0x3b20c2=_0x3b20c2-0x0;var _0x5b4482=_0x2d21[_0x3b20c2];return _0x5b4482;};'use strict';var express=require(_0x12d2('0x0'));var router=express[_0x12d2('0x1')]();var auth=require(_0x12d2('0x2'));var controller=require(_0x12d2('0x3'));router[_0x12d2('0x4')]('/',auth[_0x12d2('0x5')](),controller[_0x12d2('0x6')]);router[_0x12d2('0x4')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x12d2('0x7')]('/',auth[_0x12d2('0x5')](),controller[_0x12d2('0x8')]);router[_0x12d2('0x9')]('/:id',auth[_0x12d2('0x5')](),controller[_0x12d2('0xa')]);router[_0x12d2('0xb')](_0x12d2('0xc'),auth[_0x12d2('0x5')](),controller[_0x12d2('0xd')]);module[_0x12d2('0xe')]=router; \ No newline at end of file +var _0x5987=['Router','../../components/auth/service','get','/:id','isAuthenticated','show','post','delete','exports'];(function(_0x2ec3d3,_0x28269d){var _0x5d8b92=function(_0x1122c6){while(--_0x1122c6){_0x2ec3d3['push'](_0x2ec3d3['shift']());}};_0x5d8b92(++_0x28269d);}(_0x5987,0x17a));var _0x7598=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5987[_0x5ddb1c];return _0x354adc;};'use strict';var express=require('express');var router=express[_0x7598('0x0')]();var auth=require(_0x7598('0x1'));var controller=require('./pm2.controller');router[_0x7598('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7598('0x2')](_0x7598('0x3'),auth[_0x7598('0x4')](),controller[_0x7598('0x5')]);router[_0x7598('0x6')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7598('0x3'),auth['isAuthenticated'](),controller['update']);router[_0x7598('0x7')](_0x7598('0x3'),auth[_0x7598('0x4')](),controller['destroy']);module[_0x7598('0x8')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 1c2845e..7b3ae3a 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 _0xb207=['status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','create','body','script','../../files/plugins','cwd','dirname','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','Unknown\x20status','destroy','delete','dump','Unknown\x20id','../../config/pm2','path','child_process','exec','bluebird','sendStatus'];(function(_0x251fa4,_0x3d5860){var _0x453047=function(_0x337a6f){while(--_0x337a6f){_0x251fa4['push'](_0x251fa4['shift']());}};_0x453047(++_0x3d5860);}(_0xb207,0x18a));var _0x7b20=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xb207[_0xa990b7];return _0x52c99c;};'use strict';var _=require('lodash');var pm2=require(_0x7b20('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x7b20('0x1'));var exec=require(_0x7b20('0x2'))[_0x7b20('0x3')];var BPromise=require(_0x7b20('0x4'));function handleEntityNotFound(_0x350618,_0x3f5dfc){return function(_0x57f7b4){if(!_0x57f7b4){_0x350618[_0x7b20('0x5')](0x194);;}return _0x57f7b4;};}function respondWithResult(_0x2c0014,_0x452d3d){_0x452d3d=_0x452d3d||0xc8;return function(_0xc7a089){if(_0xc7a089){return _0x2c0014[_0x7b20('0x6')](_0x452d3d)[_0x7b20('0x7')](_0xc7a089);}return null;};}function handleError(_0x1dfb10,_0x102d97){_0x102d97=_0x102d97||0x1f4;return function(_0xaf5d5b){logger[_0x7b20('0x8')](_0xaf5d5b['stack']);if(_0xaf5d5b[_0x7b20('0x9')]){delete _0xaf5d5b[_0x7b20('0x9')];}_0x1dfb10['status'](_0x102d97)[_0x7b20('0xa')](_0xaf5d5b);};}function execChildProcess(){return new BPromise(function(_0x195d59,_0x457c75){exec(_0x7b20('0xb'),function(_0x3942d3,_0x302577,_0x18b59b){logger[_0x7b20('0xc')](_0x302577);logger['info'](_0x18b59b);if(_0x3942d3){logger[_0x7b20('0x8')](_0x3942d3);return _0x457c75(_0x3942d3);}return _0x195d59(_0x302577);});});}exports[_0x7b20('0xd')]=function(_0x4faf14,_0x5f4112){return pm2[_0x7b20('0xe')]()[_0x7b20('0xf')](function(_0x396e1e){if(_0x396e1e){var _0x1d6d02=_[_0x7b20('0x10')](_0x396e1e,function(_0x4b88d9){return _0x4b88d9[_0x7b20('0x9')]===_0x7b20('0x11')||_0x4b88d9[_0x7b20('0x9')]===_0x7b20('0x12');});return{'rows':_0x1d6d02,'count':_0x1d6d02[_0x7b20('0x13')]};}return null;})[_0x7b20('0xf')](respondWithResult(_0x5f4112,null))[_0x7b20('0x14')](handleError(_0x5f4112,null));};exports[_0x7b20('0x15')]=function(_0x831d3e,_0x54808a){return pm2['describe'](_0x831d3e['params']['id'])[_0x7b20('0xf')](respondWithResult(_0x54808a,null))[_0x7b20('0xf')](handleEntityNotFound(_0x54808a,null))[_0x7b20('0x14')](handleError(_0x54808a,null));};exports[_0x7b20('0x16')]=function(_0x3b1242,_0x272d7b){if(_0x3b1242[_0x7b20('0x17')]['name']&&_0x3b1242[_0x7b20('0x17')][_0x7b20('0x18')]){var _0x127ae1=path['join'](__dirname,_0x7b20('0x19'),_0x3b1242[_0x7b20('0x17')][_0x7b20('0x18')]);var _0x514d2e=process[_0x7b20('0x1a')]();process['chdir'](path[_0x7b20('0x1b')](_0x127ae1));return execChildProcess()['then'](function(_0x20dc5c){process[_0x7b20('0x1c')](_0x514d2e);return pm2[_0x7b20('0x1d')]({'name':_0x3b1242[_0x7b20('0x17')][_0x7b20('0x9')],'script':_0x127ae1});})[_0x7b20('0xf')](function(_0x1c4ed1){pm2['dump']();return _0x1c4ed1[0x0];})[_0x7b20('0xf')](respondWithResult(_0x272d7b,0xc9))[_0x7b20('0x14')](handleError(_0x272d7b,null));}else{return _0x272d7b[_0x7b20('0x6')](0x1f4)[_0x7b20('0xa')]({'message':_0x7b20('0x1e')});}};exports[_0x7b20('0x1f')]=function(_0x25f470,_0x239f22){if(_0x25f470['body']['id']){delete _0x25f470[_0x7b20('0x17')]['id'];}var _0x484d0a={'online':_0x7b20('0x20'),'stopped':'stop'};if(_0x484d0a[_0x7b20('0x21')](_0x25f470[_0x7b20('0x17')][_0x7b20('0x6')])){return pm2[_0x484d0a[_0x25f470['body'][_0x7b20('0x6')]]](_0x25f470[_0x7b20('0x22')]['id'])['then'](respondWithResult(_0x239f22,0xc8))[_0x7b20('0x14')](handleError(_0x239f22,null));}else{return _0x239f22['status'](0x1f4)[_0x7b20('0xa')]({'message':_0x7b20('0x23')});}};exports[_0x7b20('0x24')]=function(_0x1c257c,_0x2623e7){if(_0x1c257c['body']['id']){delete _0x1c257c[_0x7b20('0x17')]['id'];}if(_0x1c257c[_0x7b20('0x22')]['id']){return pm2[_0x7b20('0x25')](_0x1c257c[_0x7b20('0x22')]['id'])['then'](function(_0x369e25){pm2[_0x7b20('0x26')]();return _0x369e25[0x0];})[_0x7b20('0xf')](respondWithResult(_0x2623e7,null))['catch'](handleError(_0x2623e7,null));}else{return _0x2623e7[_0x7b20('0x6')](0x1f4)[_0x7b20('0xa')]({'message':_0x7b20('0x27')});}}; \ No newline at end of file +var _0x37f5=['dump','send','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','exec','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','then','express','motion2','catch','describe','params','create','body','../../files/plugins','script','cwd','chdir','dirname','start'];(function(_0x5f560f,_0x1a9428){var _0x27c90c=function(_0x4e673b){while(--_0x4e673b){_0x5f560f['push'](_0x5f560f['shift']());}};_0x27c90c(++_0x1a9428);}(_0x37f5,0x1b7));var _0x537f=function(_0x484284,_0x387c34){_0x484284=_0x484284-0x0;var _0x54f2b2=_0x37f5[_0x484284];return _0x54f2b2;};'use strict';var _=require(_0x537f('0x0'));var pm2=require(_0x537f('0x1'));var logger=require('../../config/logger')(_0x537f('0x2'));var path=require(_0x537f('0x3'));var exec=require('child_process')[_0x537f('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x1139d9,_0x2111ce){return function(_0x4049d3){if(!_0x4049d3){_0x1139d9[_0x537f('0x5')](0x194);;}return _0x4049d3;};}function respondWithResult(_0x4a165d,_0x4dc9ea){_0x4dc9ea=_0x4dc9ea||0xc8;return function(_0xd9f66d){if(_0xd9f66d){return _0x4a165d[_0x537f('0x6')](_0x4dc9ea)[_0x537f('0x7')](_0xd9f66d);}return null;};}function handleError(_0x1f942c,_0x5c5725){_0x5c5725=_0x5c5725||0x1f4;return function(_0x17215f){logger[_0x537f('0x8')](_0x17215f[_0x537f('0x9')]);if(_0x17215f[_0x537f('0xa')]){delete _0x17215f[_0x537f('0xa')];}_0x1f942c[_0x537f('0x6')](_0x5c5725)['send'](_0x17215f);};}function execChildProcess(){return new BPromise(function(_0x910729,_0x42acbe){exec(_0x537f('0xb'),function(_0x418b5b,_0x16bd6b,_0x204396){logger['info'](_0x16bd6b);logger[_0x537f('0xc')](_0x204396);if(_0x418b5b){logger['error'](_0x418b5b);return _0x42acbe(_0x418b5b);}return _0x910729(_0x16bd6b);});});}exports[_0x537f('0xd')]=function(_0x36d634,_0x29b31e){return pm2[_0x537f('0xe')]()[_0x537f('0xf')](function(_0x260185){if(_0x260185){var _0x46b222=_['reject'](_0x260185,function(_0x3f3ef6){return _0x3f3ef6[_0x537f('0xa')]===_0x537f('0x10')||_0x3f3ef6[_0x537f('0xa')]===_0x537f('0x11');});return{'rows':_0x46b222,'count':_0x46b222['length']};}return null;})[_0x537f('0xf')](respondWithResult(_0x29b31e,null))[_0x537f('0x12')](handleError(_0x29b31e,null));};exports['show']=function(_0xd2f074,_0x212060){return pm2[_0x537f('0x13')](_0xd2f074[_0x537f('0x14')]['id'])[_0x537f('0xf')](respondWithResult(_0x212060,null))['then'](handleEntityNotFound(_0x212060,null))[_0x537f('0x12')](handleError(_0x212060,null));};exports[_0x537f('0x15')]=function(_0x59437c,_0x14c783){if(_0x59437c[_0x537f('0x16')][_0x537f('0xa')]&&_0x59437c['body']['script']){var _0xdb9f68=path['join'](__dirname,_0x537f('0x17'),_0x59437c[_0x537f('0x16')][_0x537f('0x18')]);var _0x2c7bc3=process[_0x537f('0x19')]();process[_0x537f('0x1a')](path[_0x537f('0x1b')](_0xdb9f68));return execChildProcess()['then'](function(_0x30d39e){process[_0x537f('0x1a')](_0x2c7bc3);return pm2[_0x537f('0x1c')]({'name':_0x59437c[_0x537f('0x16')]['name'],'script':_0xdb9f68});})[_0x537f('0xf')](function(_0x2d89a3){pm2[_0x537f('0x1d')]();return _0x2d89a3[0x0];})[_0x537f('0xf')](respondWithResult(_0x14c783,0xc9))[_0x537f('0x12')](handleError(_0x14c783,null));}else{return _0x14c783[_0x537f('0x6')](0x1f4)[_0x537f('0x1e')]({'message':_0x537f('0x1f')});}};exports['update']=function(_0x13441d,_0x9353c7){if(_0x13441d[_0x537f('0x16')]['id']){delete _0x13441d[_0x537f('0x16')]['id'];}var _0x334312={'online':_0x537f('0x20'),'stopped':_0x537f('0x21')};if(_0x334312[_0x537f('0x22')](_0x13441d['body'][_0x537f('0x6')])){return pm2[_0x334312[_0x13441d[_0x537f('0x16')]['status']]](_0x13441d[_0x537f('0x14')]['id'])['then'](respondWithResult(_0x9353c7,0xc8))['catch'](handleError(_0x9353c7,null));}else{return _0x9353c7[_0x537f('0x6')](0x1f4)['send']({'message':_0x537f('0x23')});}};exports[_0x537f('0x24')]=function(_0x2c66aa,_0x590e49){if(_0x2c66aa[_0x537f('0x16')]['id']){delete _0x2c66aa['body']['id'];}if(_0x2c66aa[_0x537f('0x14')]['id']){return pm2[_0x537f('0x25')](_0x2c66aa[_0x537f('0x14')]['id'])[_0x537f('0xf')](function(_0x41980a){pm2[_0x537f('0x1d')]();return _0x41980a[0x0];})[_0x537f('0xf')](respondWithResult(_0x590e49,null))['catch'](handleError(_0x590e49,null));}else{return _0x590e49[_0x537f('0x6')](0x1f4)[_0x537f('0x1e')]({'message':_0x537f('0x26')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d360e66..f32b9c7 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 _0xaa5d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xaa5d,0xb7));var _0xdaa5=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xaa5d[_0x1f1511];return _0x1d9ab8;};'use strict';var multer=require('multer');var util=require(_0xdaa5('0x0'));var path=require(_0xdaa5('0x1'));var timeout=require(_0xdaa5('0x2'));var express=require(_0xdaa5('0x3'));var router=express[_0xdaa5('0x4')]();var auth=require(_0xdaa5('0x5'));var interaction=require(_0xdaa5('0x6'));var config=require('../../config/environment');module[_0xdaa5('0x7')]=router; \ No newline at end of file +var _0xc54d=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x4f6689,_0x3bd36d){var _0x585299=function(_0x1793fe){while(--_0x1793fe){_0x4f6689['push'](_0x4f6689['shift']());}};_0x585299(++_0x3bd36d);}(_0xc54d,0xa6));var _0xdc54=function(_0x910b22,_0x57e873){_0x910b22=_0x910b22-0x0;var _0x1f594d=_0xc54d[_0x910b22];return _0x1f594d;};'use strict';var multer=require(_0xdc54('0x0'));var util=require(_0xdc54('0x1'));var path=require('path');var timeout=require(_0xdc54('0x2'));var express=require(_0xdc54('0x3'));var router=express[_0xdc54('0x4')]();var auth=require(_0xdc54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc54('0x6'));module[_0xdc54('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c5d2429..a7737ab 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 _0x4de0=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x12283c,_0x379df9){var _0x536073=function(_0x1101a4){while(--_0x1101a4){_0x12283c['push'](_0x12283c['shift']());}};_0x536073(++_0x379df9);}(_0x4de0,0x198));var _0x04de=function(_0x4b05ee,_0x5e84e2){_0x4b05ee=_0x4b05ee-0x0;var _0x586d07=_0x4de0[_0x4b05ee];return _0x586d07;};'use strict';var Sequelize=require(_0x04de('0x0'));module[_0x04de('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x04de('0x2')]},'scheduledat':{'type':Sequelize[_0x04de('0x3')]},'uniqueid':{'type':Sequelize[_0x04de('0x2')]},'starttime':{'type':Sequelize[_0x04de('0x3')]},'responsetime':{'type':Sequelize[_0x04de('0x3')]},'ringtime':{'type':Sequelize[_0x04de('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x04de('0x2')]},'campaigntype':{'type':Sequelize[_0x04de('0x2')]},'membername':{'type':Sequelize[_0x04de('0x2')]}}; \ No newline at end of file +var _0xee2b=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xee2b,0x1a3));var _0xbee2=function(_0x5a08a0,_0xc74a2e){_0x5a08a0=_0x5a08a0-0x0;var _0x5bd3e3=_0xee2b[_0x5a08a0];return _0x5bd3e3;};'use strict';var Sequelize=require(_0xbee2('0x0'));module[_0xbee2('0x1')]={'state':{'type':Sequelize[_0xbee2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbee2('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xbee2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbee2('0x4')]},'ringtime':{'type':Sequelize[_0xbee2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xbee2('0x3')]},'campaigntype':{'type':Sequelize[_0xbee2('0x3')]},'membername':{'type':Sequelize[_0xbee2('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4ab4d79..15c8fae 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 _0xd099=['request-promise','path','rimraf','../../config/environment','define','ReportAgentPreview','report_agent_preview','../../config/logger','api','moment','bluebird'];(function(_0x503055,_0x304102){var _0x30fb63=function(_0x400662){while(--_0x400662){_0x503055['push'](_0x503055['shift']());}};_0x30fb63(++_0x304102);}(_0xd099,0x1d5));var _0x9d09=function(_0x4b90c2,_0xaae537){_0x4b90c2=_0x4b90c2-0x0;var _0x59b4c0=_0xd099[_0x4b90c2];return _0x59b4c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d09('0x0'))(_0x9d09('0x1'));var moment=require(_0x9d09('0x2'));var BPromise=require(_0x9d09('0x3'));var rp=require(_0x9d09('0x4'));var fs=require('fs');var path=require(_0x9d09('0x5'));var rimraf=require(_0x9d09('0x6'));var config=require(_0x9d09('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0xbd85de,_0x5ab2ef){return _0xbd85de[_0x9d09('0x8')](_0x9d09('0x9'),attributes,{'tableName':_0x9d09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e84=['report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ReportAgentPreview'];(function(_0x1689e9,_0x2b2047){var _0x2bc292=function(_0x283431){while(--_0x283431){_0x1689e9['push'](_0x1689e9['shift']());}};_0x2bc292(++_0x2b2047);}(_0x2e84,0x1d5));var _0x42e8=function(_0x152cbc,_0x4685ae){_0x152cbc=_0x152cbc-0x0;var _0x4b1658=_0x2e84[_0x152cbc];return _0x4b1658;};'use strict';var _=require(_0x42e8('0x0'));var util=require(_0x42e8('0x1'));var logger=require('../../config/logger')(_0x42e8('0x2'));var moment=require(_0x42e8('0x3'));var BPromise=require(_0x42e8('0x4'));var rp=require(_0x42e8('0x5'));var fs=require('fs');var path=require(_0x42e8('0x6'));var rimraf=require(_0x42e8('0x7'));var config=require(_0x42e8('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x42e8('0x9')]=function(_0x3e874f,_0x11fb4a){return _0x3e874f[_0x42e8('0xa')](_0x42e8('0xb'),attributes,{'tableName':_0x42e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index ca3d5a9..87fc633 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 _0x8517=['stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x8517,0x1d3));var _0x7851=function(_0x3f2e94,_0x591428){_0x3f2e94=_0x3f2e94-0x0;var _0x18349c=_0x8517[_0x3f2e94];return _0x18349c;};'use strict';var _=require('lodash');var util=require(_0x7851('0x0'));var moment=require('moment');var BPromise=require(_0x7851('0x1'));var rs=require(_0x7851('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7851('0x3'))['db'];var utils=require(_0x7851('0x4'));var logger=require('../../config/logger')(_0x7851('0x5'));var config=require('../../config/environment');var jayson=require(_0x7851('0x6'));var client=jayson[_0x7851('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13369d,_0x506fb4,_0x135b5f){return new BPromise(function(_0x2b382b,_0x150f78){return client['request'](_0x13369d,_0x135b5f)[_0x7851('0x8')](function(_0x35316d){logger[_0x7851('0x9')](_0x7851('0xa'),_0x506fb4,'request\x20sent');logger['debug'](_0x7851('0xb'),_0x506fb4,_0x7851('0xc'),JSON[_0x7851('0xd')](_0x35316d));if(_0x35316d[_0x7851('0xe')]){if(_0x35316d['error']['code']===0x1f4){logger[_0x7851('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x506fb4,_0x35316d['error'][_0x7851('0xf')]);return _0x150f78(_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);}logger[_0x7851('0xe')](_0x7851('0xa'),_0x506fb4,_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);return _0x2b382b(_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);}else{logger[_0x7851('0x9')](_0x7851('0xa'),_0x506fb4,_0x7851('0xc'));_0x2b382b(_0x35316d[_0x7851('0x10')][_0x7851('0xf')]);}})[_0x7851('0x11')](function(_0x184a30){logger[_0x7851('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x506fb4,_0x184a30);_0x150f78(_0x184a30);});});}exports[_0x7851('0x12')]=function(_0x18763d){var _0x10781c=this;return new Promise(function(_0x239eeb,_0x456ba1){return db[_0x7851('0x13')][_0x7851('0x14')](_0x18763d[_0x7851('0x15')],{'raw':_0x18763d[_0x7851('0x16')]?_0x18763d['options']['raw']===undefined?!![]:![]:!![]})[_0x7851('0x8')](function(_0x8476f){logger[_0x7851('0x9')](_0x7851('0x12'),_0x18763d);logger[_0x7851('0x17')](_0x7851('0x12'),_0x18763d,JSON[_0x7851('0xd')](_0x8476f));_0x239eeb(_0x8476f);})[_0x7851('0x11')](function(_0x563199){logger['error'](_0x7851('0x12'),_0x563199[_0x7851('0xf')],_0x18763d);_0x456ba1(_0x10781c['error'](0x1f4,_0x563199[_0x7851('0xf')]));});});}; \ No newline at end of file +var _0x44ea=['request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','create','options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x44ea,0x17c));var _0xa44e=function(_0x4dae63,_0x716ea9){_0x4dae63=_0x4dae63-0x0;var _0x145116=_0x44ea[_0x4dae63];return _0x145116;};'use strict';var _=require('lodash');var util=require(_0xa44e('0x0'));var moment=require(_0xa44e('0x1'));var BPromise=require(_0xa44e('0x2'));var rs=require(_0xa44e('0x3'));var fs=require('fs');var Redis=require(_0xa44e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa44e('0x5'));var logger=require(_0xa44e('0x6'))(_0xa44e('0x7'));var config=require(_0xa44e('0x8'));var jayson=require(_0xa44e('0x9'));var client=jayson[_0xa44e('0xa')][_0xa44e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x169df8,_0x44a7ec,_0x838d1e){return new BPromise(function(_0x1c034d,_0x17f91a){return client[_0xa44e('0xc')](_0x169df8,_0x838d1e)[_0xa44e('0xd')](function(_0x4d1bb3){logger[_0xa44e('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x44a7ec,_0xa44e('0xf'));logger['debug'](_0xa44e('0x10'),_0x44a7ec,_0xa44e('0xf'),JSON['stringify'](_0x4d1bb3));if(_0x4d1bb3[_0xa44e('0x11')]){if(_0x4d1bb3['error'][_0xa44e('0x12')]===0x1f4){logger['error'](_0xa44e('0x13'),_0x44a7ec,_0x4d1bb3[_0xa44e('0x11')]['message']);return _0x17f91a(_0x4d1bb3[_0xa44e('0x11')]['message']);}logger[_0xa44e('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x44a7ec,_0x4d1bb3['error']['message']);return _0x1c034d(_0x4d1bb3[_0xa44e('0x11')][_0xa44e('0x14')]);}else{logger[_0xa44e('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x44a7ec,_0xa44e('0xf'));_0x1c034d(_0x4d1bb3[_0xa44e('0x15')][_0xa44e('0x14')]);}})[_0xa44e('0x16')](function(_0x3c00ff){logger[_0xa44e('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x44a7ec,_0x3c00ff);_0x17f91a(_0x3c00ff);});});}exports[_0xa44e('0x17')]=function(_0x1403ef){var _0x1d38a6=this;return new Promise(function(_0x1973a4,_0x50ef24){return db['ReportAgentPreview'][_0xa44e('0x18')](_0x1403ef['body'],{'raw':_0x1403ef[_0xa44e('0x19')]?_0x1403ef['options'][_0xa44e('0x1a')]===undefined?!![]:![]:!![]})[_0xa44e('0xd')](function(_0x124b64){logger[_0xa44e('0xe')](_0xa44e('0x17'),_0x1403ef);logger[_0xa44e('0x1b')](_0xa44e('0x17'),_0x1403ef,JSON['stringify'](_0x124b64));_0x1973a4(_0x124b64);})[_0xa44e('0x16')](function(_0x518aaf){logger['error'](_0xa44e('0x17'),_0x518aaf['message'],_0x1403ef);_0x50ef24(_0x1d38a6[_0xa44e('0x11')](0x1f4,_0x518aaf[_0xa44e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index df0bcf3..ad14729 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 _0xfde0=['mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/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','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','outboundChannels','agents','put','/telephones','/trunks','trunks','campaigns','/fax/accounts','chatQueuesWaitingInteractions'];(function(_0x59cc72,_0x11f2f9){var _0x218624=function(_0x40f945){while(--_0x40f945){_0x59cc72['push'](_0x59cc72['shift']());}};_0x218624(++_0x11f2f9);}(_0xfde0,0x1b0));var _0x0fde=function(_0xf570f7,_0x29c76a){_0xf570f7=_0xf570f7-0x0;var _0x4e4105=_0xfde0[_0xf570f7];return _0x4e4105;};'use strict';var multer=require('multer');var util=require(_0x0fde('0x0'));var path=require(_0x0fde('0x1'));var express=require(_0x0fde('0x2'));var router=express[_0x0fde('0x3')]();var auth=require(_0x0fde('0x4'));var controller=require('./rpc.controller');router['get'](_0x0fde('0x5'),auth[_0x0fde('0x6')](),controller['voiceChannels']);router[_0x0fde('0x7')](_0x0fde('0x8'),auth['isAuthenticated'](),controller[_0x0fde('0x9')]);router[_0x0fde('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x0fde('0x6')](),controller[_0x0fde('0xa')]);router[_0x0fde('0x7')](_0x0fde('0xb'),auth['isAuthenticated'](),controller[_0x0fde('0xc')]);router[_0x0fde('0x7')]('/chat/queues',auth[_0x0fde('0x6')](),controller[_0x0fde('0xd')]);router[_0x0fde('0x7')]('/mail/queues',auth['isAuthenticated'](),controller[_0x0fde('0xe')]);router[_0x0fde('0x7')]('/mail/accounts',auth[_0x0fde('0x6')](),controller[_0x0fde('0xf')]);router[_0x0fde('0x7')](_0x0fde('0x10'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x11')]);router[_0x0fde('0x7')]('/sms/queues',auth[_0x0fde('0x6')](),controller['smsQueues']);router[_0x0fde('0x7')](_0x0fde('0x12'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x13')]);router['get'](_0x0fde('0x14'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x15')]);router[_0x0fde('0x7')]('/voice/queues/preview/:id',auth[_0x0fde('0x6')](),controller[_0x0fde('0x16')]);router[_0x0fde('0x7')](_0x0fde('0x17'),auth['isAuthenticated'](),controller[_0x0fde('0x18')]);router[_0x0fde('0x7')](_0x0fde('0x19'),auth[_0x0fde('0x6')](),controller['voiceQueuesChannel']);router[_0x0fde('0x7')](_0x0fde('0x1a'),auth['isAuthenticated'](),controller[_0x0fde('0x1b')]);router[_0x0fde('0x7')](_0x0fde('0x1c'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x1d')]);router[_0x0fde('0x7')]('/voice/queues/:id',auth[_0x0fde('0x6')](),controller[_0x0fde('0x1e')]);router[_0x0fde('0x7')](_0x0fde('0x1f'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x20')]);router[_0x0fde('0x7')]('/outbound/channels',auth[_0x0fde('0x6')](),controller[_0x0fde('0x21')]);router[_0x0fde('0x7')]('/agents',auth['isAuthenticated'](),controller[_0x0fde('0x22')]);router[_0x0fde('0x23')]('/agents/:id/capacity',auth[_0x0fde('0x6')](),controller['agentCapacity']);router[_0x0fde('0x7')](_0x0fde('0x24'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0x0fde('0x25'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x26')]);router[_0x0fde('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x0fde('0x27')]);router['get'](_0x0fde('0x28'),auth[_0x0fde('0x6')](),controller['faxAccounts']);router[_0x0fde('0x7')]('/chat/queues/waitinginteractions',auth[_0x0fde('0x6')](),controller[_0x0fde('0x29')]);router['get']('/mail/queues/waitinginteractions',auth[_0x0fde('0x6')](),controller[_0x0fde('0x2a')]);router[_0x0fde('0x7')](_0x0fde('0x2b'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x2c')]);router[_0x0fde('0x7')](_0x0fde('0x2d'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x2e')]);router[_0x0fde('0x7')](_0x0fde('0x2f'),auth['isAuthenticated'](),controller[_0x0fde('0x30')]);router[_0x0fde('0x7')](_0x0fde('0x31'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x32')]);router[_0x0fde('0x7')](_0x0fde('0x33'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x34')]);router[_0x0fde('0x35')](_0x0fde('0x36'),auth['isAuthenticated'](),controller[_0x0fde('0x37')](_0x0fde('0x38')));router[_0x0fde('0x7')](_0x0fde('0x39'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x3a')]);router[_0x0fde('0x35')](_0x0fde('0x3b'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x37')](_0x0fde('0x3c')));router[_0x0fde('0x7')](_0x0fde('0x3d'),auth['isAuthenticated'](),controller[_0x0fde('0x3e')]);router[_0x0fde('0x35')](_0x0fde('0x3f'),auth['isAuthenticated'](),controller['queueNotify'](_0x0fde('0x40')));router[_0x0fde('0x7')](_0x0fde('0x41'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x42')]);router[_0x0fde('0x35')](_0x0fde('0x43'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x37')](_0x0fde('0x44')));router[_0x0fde('0x7')](_0x0fde('0x45'),auth['isAuthenticated'](),controller[_0x0fde('0x46')]);router['post']('/sms/queues/:id/notify',auth[_0x0fde('0x6')](),controller[_0x0fde('0x37')](_0x0fde('0x47')));router[_0x0fde('0x35')](_0x0fde('0x48'),auth['isAuthenticated'](),controller[_0x0fde('0x37')](_0x0fde('0x49')));router[_0x0fde('0x7')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x0fde('0x4a')]);router[_0x0fde('0x7')](_0x0fde('0x4b'),auth[_0x0fde('0x6')](),controller['showWhatsappQueues']);router[_0x0fde('0x35')](_0x0fde('0x4c'),auth['isAuthenticated'](),controller[_0x0fde('0x4d')]);module[_0x0fde('0x4e')]=router; \ No newline at end of file +var _0x01f1=['agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','get','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity'];(function(_0x136e9c,_0x4ef350){var _0x1e3931=function(_0x3f6cb5){while(--_0x3f6cb5){_0x136e9c['push'](_0x136e9c['shift']());}};_0x1e3931(++_0x4ef350);}(_0x01f1,0x179));var _0x101f=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x01f1[_0x3c6dce];return _0x1450e9;};'use strict';var multer=require(_0x101f('0x0'));var util=require('util');var path=require(_0x101f('0x1'));var express=require(_0x101f('0x2'));var router=express[_0x101f('0x3')]();var auth=require(_0x101f('0x4'));var controller=require('./rpc.controller');router['get'](_0x101f('0x5'),auth[_0x101f('0x6')](),controller['voiceChannels']);router['get'](_0x101f('0x7'),auth['isAuthenticated'](),controller[_0x101f('0x8')]);router['get'](_0x101f('0x9'),auth[_0x101f('0x6')](),controller[_0x101f('0xa')]);router[_0x101f('0xb')](_0x101f('0xc'),auth['isAuthenticated'](),controller[_0x101f('0xd')]);router[_0x101f('0xb')](_0x101f('0xe'),auth['isAuthenticated'](),controller[_0x101f('0xf')]);router[_0x101f('0xb')](_0x101f('0x10'),auth[_0x101f('0x6')](),controller[_0x101f('0x11')]);router[_0x101f('0xb')](_0x101f('0x12'),auth[_0x101f('0x6')](),controller[_0x101f('0x13')]);router[_0x101f('0xb')](_0x101f('0x14'),auth[_0x101f('0x6')](),controller[_0x101f('0x15')]);router[_0x101f('0xb')]('/sms/queues',auth[_0x101f('0x6')](),controller[_0x101f('0x16')]);router['get'](_0x101f('0x17'),auth[_0x101f('0x6')](),controller[_0x101f('0x18')]);router[_0x101f('0xb')](_0x101f('0x19'),auth[_0x101f('0x6')](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x101f('0x1a')]);router['get'](_0x101f('0x1b'),auth[_0x101f('0x6')](),controller[_0x101f('0x1c')]);router[_0x101f('0xb')]('/voice/queues/channels/:uniqueid',auth[_0x101f('0x6')](),controller[_0x101f('0x1d')]);router['get'](_0x101f('0x1e'),auth[_0x101f('0x6')](),controller[_0x101f('0x1f')]);router['get'](_0x101f('0x20'),auth[_0x101f('0x6')](),controller[_0x101f('0x21')]);router[_0x101f('0xb')](_0x101f('0x22'),auth['isAuthenticated'](),controller[_0x101f('0x23')]);router['get']('/outbound',auth[_0x101f('0x6')](),controller[_0x101f('0x24')]);router['get'](_0x101f('0x25'),auth[_0x101f('0x6')](),controller[_0x101f('0x26')]);router['get'](_0x101f('0x27'),auth['isAuthenticated'](),controller[_0x101f('0x28')]);router[_0x101f('0x29')](_0x101f('0x2a'),auth[_0x101f('0x6')](),controller[_0x101f('0x2b')]);router['get'](_0x101f('0x2c'),auth[_0x101f('0x6')](),controller[_0x101f('0x2d')]);router[_0x101f('0xb')](_0x101f('0x2e'),auth[_0x101f('0x6')](),controller['trunks']);router[_0x101f('0xb')](_0x101f('0x2f'),auth[_0x101f('0x6')](),controller[_0x101f('0x30')]);router['get'](_0x101f('0x31'),auth[_0x101f('0x6')](),controller['faxAccounts']);router[_0x101f('0xb')](_0x101f('0x32'),auth[_0x101f('0x6')](),controller[_0x101f('0x33')]);router[_0x101f('0xb')](_0x101f('0x34'),auth[_0x101f('0x6')](),controller[_0x101f('0x35')]);router[_0x101f('0xb')](_0x101f('0x36'),auth['isAuthenticated'](),controller[_0x101f('0x37')]);router[_0x101f('0xb')](_0x101f('0x38'),auth[_0x101f('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x101f('0xb')](_0x101f('0x39'),auth[_0x101f('0x6')](),controller[_0x101f('0x3a')]);router[_0x101f('0xb')]('/whatsapp/queues/waitinginteractions',auth[_0x101f('0x6')](),controller[_0x101f('0x3b')]);router[_0x101f('0xb')]('/fax/queues/waitinginteractions',auth[_0x101f('0x6')](),controller[_0x101f('0x3c')]);router[_0x101f('0x3d')](_0x101f('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0x101f('0x3f')));router[_0x101f('0xb')](_0x101f('0x40'),auth[_0x101f('0x6')](),controller[_0x101f('0x41')]);router['post']('/chat/queues/:id/notify',auth[_0x101f('0x6')](),controller[_0x101f('0x42')](_0x101f('0x43')));router[_0x101f('0xb')](_0x101f('0x44'),auth[_0x101f('0x6')](),controller[_0x101f('0x45')]);router[_0x101f('0x3d')](_0x101f('0x46'),auth[_0x101f('0x6')](),controller['queueNotify']('fax'));router[_0x101f('0xb')](_0x101f('0x47'),auth[_0x101f('0x6')](),controller['showFaxQueues']);router[_0x101f('0x3d')](_0x101f('0x48'),auth['isAuthenticated'](),controller[_0x101f('0x42')]('openchannel'));router[_0x101f('0xb')](_0x101f('0x49'),auth['isAuthenticated'](),controller[_0x101f('0x4a')]);router[_0x101f('0x3d')](_0x101f('0x4b'),auth[_0x101f('0x6')](),controller[_0x101f('0x42')](_0x101f('0x4c')));router[_0x101f('0x3d')](_0x101f('0x4d'),auth[_0x101f('0x6')](),controller[_0x101f('0x42')]('whatsapp'));router[_0x101f('0xb')](_0x101f('0x4e'),auth[_0x101f('0x6')](),controller['showSmsQueues']);router['get'](_0x101f('0x4f'),auth[_0x101f('0x6')](),controller[_0x101f('0x50')]);router['post'](_0x101f('0x51'),auth[_0x101f('0x6')](),controller[_0x101f('0x52')]);module[_0x101f('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 54519e7..12c716e 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 _0xd098=['lodash','../../config/logger','jayson/promise','http','client','request','then','error','code','message','result','status','json','sendStatus','stack','name','send','isNil','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','updateAttributes','MemberReport','interface','format','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','telephones','trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','uniq','value','rows','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','create','Start','queue','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','InteractionId','TransferReport','agentTransferTimeout','*,*,*,*','bluebird'];(function(_0x3c9a89,_0x378778){var _0x1eb47b=function(_0x57998a){while(--_0x57998a){_0x3c9a89['push'](_0x3c9a89['shift']());}};_0x1eb47b(++_0x378778);}(_0xd098,0x105));var _0x8d09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd098[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x8d09('0x0'));var moment=require('moment');var _=require(_0x8d09('0x1'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x8d09('0x2'))('api');var jayson=require(_0x8d09('0x3'));var amiClient=jayson['client'][_0x8d09('0x4')]({'port':0x232a});var mailClient=jayson[_0x8d09('0x5')][_0x8d09('0x4')]({'port':0x232b});var routingClient=jayson['client'][_0x8d09('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x146d3b,_0xbfaf00,_0x13fe0e){return new BPromise(function(_0x548fde,_0x26d2dc){var _0xc66e60=_0x13fe0e?_0x13fe0e:amiClient;return _0xc66e60[_0x8d09('0x6')](_0x146d3b,_0xbfaf00)[_0x8d09('0x7')](function(_0x26b11d){if(_0x26b11d['error']){if(_0x26b11d[_0x8d09('0x8')][_0x8d09('0x9')]===0x1f4){return _0x26d2dc(_0x26b11d[_0x8d09('0x8')][_0x8d09('0xa')]);}return _0x548fde(_0x26b11d[_0x8d09('0x8')][_0x8d09('0xa')]);}else{_0x548fde(_0x26b11d[_0x8d09('0xb')]);}})['catch'](function(_0x4fd173){_0x26d2dc(_0x4fd173);});});}function respondWithResult(_0x42a75c,_0x59f82b){_0x59f82b=_0x59f82b||0xc8;return function(_0x5ba740){if(_0x5ba740){return _0x42a75c[_0x8d09('0xc')](_0x59f82b)[_0x8d09('0xd')](_0x5ba740);}return _0x42a75c[_0x8d09('0xe')](0x194);};}function handleError(_0x2856cb,_0x5922a1){_0x5922a1=_0x5922a1||0x1f4;return function(_0x2aa68f){logger['error'](_0x2aa68f[_0x8d09('0xf')]);if(_0x2aa68f['name']){delete _0x2aa68f[_0x8d09('0x10')];}_0x2856cb['status'](_0x5922a1)[_0x8d09('0x11')](_0x2aa68f);};}function findById(_0x330454){return function(_0x2786bb){if(!_['isNil'](_0x330454)&&!_['isNil'](_0x2786bb)&&!_[_0x8d09('0x12')](_0x2786bb['rows'])){return _[_0x8d09('0x13')](_0x2786bb['rows'],function(_0x5e21c6){return _0x5e21c6['id']==_0x330454;});}return null;};}exports[_0x8d09('0x14')]=function(_0x4668f1,_0x488812){return respondWithRpcPromise(_0x8d09('0x15'),_0x4668f1[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x488812,null))['catch'](handleError(_0x488812,null));};exports[_0x8d09('0x17')]=function(_0x17319a,_0x1b2dcf){return respondWithRpcPromise(_0x8d09('0x18'),_[_0x8d09('0x19')](_0x17319a[_0x8d09('0x16')],_0x17319a[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x1b2dcf,null))[_0x8d09('0x1b')](handleError(_0x1b2dcf,null));};exports[_0x8d09('0x1c')]=function(_0x3aa0e5,_0x1b20ac){return respondWithRpcPromise(_0x8d09('0x1d'),_[_0x8d09('0x19')](_0x3aa0e5[_0x8d09('0x16')],_0x3aa0e5['params']))['then'](respondWithResult(_0x1b20ac,null))['catch'](handleError(_0x1b20ac,null));};exports[_0x8d09('0x1e')]=function(_0x4f056b,_0xac79ce){return respondWithRpcPromise(_0x8d09('0x1f'),_0x4f056b[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0xac79ce,null))[_0x8d09('0x1b')](handleError(_0xac79ce,null));};exports[_0x8d09('0x20')]=function(_0x4dff93,_0x4f07fb){return respondWithRpcPromise('VoiceQueues',_0x4dff93[_0x8d09('0x16')])['then'](findById(_0x4dff93[_0x8d09('0x1a')]['id']))[_0x8d09('0x7')](respondWithResult(_0x4f07fb,null))[_0x8d09('0x1b')](handleError(_0x4f07fb,null));};exports[_0x8d09('0x21')]=function(_0x22d01b,_0x4278e1){return respondWithRpcPromise(_0x8d09('0x22'),_['merge'](_0x22d01b['query'],_0x22d01b[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x4278e1,null))[_0x8d09('0x1b')](handleError(_0x4278e1,null));};exports[_0x8d09('0x23')]=function(_0x413d3b,_0x6b440d){return respondWithRpcPromise(_0x8d09('0x24'),_0x413d3b[_0x8d09('0x16')])['then'](respondWithResult(_0x6b440d,null))[_0x8d09('0x1b')](handleError(_0x6b440d,null));};exports[_0x8d09('0x25')]=function(_0x549c71,_0x2071af){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x549c71['query'],_0x549c71[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x2071af,null))[_0x8d09('0x1b')](handleError(_0x2071af,null));};exports[_0x8d09('0x26')]=function(_0x1597ce,_0x53ac30){return respondWithRpcPromise(_0x8d09('0x27'),_['merge'](_0x1597ce[_0x8d09('0x16')],_0x1597ce[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x53ac30,null))[_0x8d09('0x1b')](handleError(_0x53ac30,null));};exports[_0x8d09('0x28')]=function(_0x263d88,_0x1149ff){return respondWithRpcPromise(_0x8d09('0x29'),_['merge'](_0x263d88[_0x8d09('0x16')],_0x263d88[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x1149ff,null))[_0x8d09('0x1b')](handleError(_0x1149ff,null));};exports[_0x8d09('0x2a')]=function(_0x248c08,_0x174226){return respondWithRpcPromise('Outbound',_0x248c08[_0x8d09('0x16')])['then'](respondWithResult(_0x174226,null))[_0x8d09('0x1b')](handleError(_0x174226,null));};exports[_0x8d09('0x2b')]=function(_0x2c8d83,_0x1eeaac){return respondWithRpcPromise(_0x8d09('0x2c'),_0x2c8d83[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x1eeaac,null))[_0x8d09('0x1b')](handleError(_0x1eeaac,null));};exports[_0x8d09('0x2d')]=function(_0x316a58,_0x50b654){var _0x4f9c53;return respondWithRpcPromise('Agents',_0x316a58[_0x8d09('0x16')])[_0x8d09('0x7')](function(_0x518989){_0x4f9c53=_0x518989;return respondWithRpcPromise(_0x8d09('0x2e'),_0x316a58['query'],routingClient);})[_0x8d09('0x7')](function(_0x59d4f0){return _[_0x8d09('0x19')]({},_0x59d4f0,_0x4f9c53);})[_0x8d09('0x7')](respondWithResult(_0x50b654,null))['catch'](handleError(_0x50b654,null));};exports[_0x8d09('0x2f')]=function(_0x180460,_0x9f97bf){if(_0x180460[_0x8d09('0x30')]&&_0x180460['body'][_0x8d09('0x31')]&&_0x180460[_0x8d09('0x32')]&&_0x180460[_0x8d09('0x32')][_0x8d09('0x10')]){for(var _0x1dc39f in _0x180460[_0x8d09('0x30')][_0x8d09('0x31')]){if(_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x8d09('0x33')](_0x1dc39f)){db['MemberReport'][_0x8d09('0x34')]({'where':{'channel':_0x1dc39f,'membername':_0x180460[_0x8d09('0x32')][_0x8d09('0x10')],'type':_0x8d09('0x35'),'exitAt':null,'uniqueid':_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f]&&_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f][_0x8d09('0x36')]?{'$notIn':_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f]}:{'$ne':null}}})[_0x8d09('0x7')](function(_0x5c00bd){var _0x163439=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3d9d18=0x0,_0x468fa3=_0x5c00bd['length'];_0x3d9d18<_0x468fa3;_0x3d9d18+=0x1){_0x5c00bd[_0x3d9d18][_0x8d09('0x37')]({'exitAt':_0x163439});}});for(var _0x56426c=0x0;_0x56426c<_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f][_0x8d09('0x36')];_0x56426c+=0x1){db[_0x8d09('0x38')]['findOrCreate']({'where':{'channel':_0x1dc39f,'membername':_0x180460['user'][_0x8d09('0x10')],'type':'INTERACTION','uniqueid':_0x180460['body'][_0x8d09('0x31')][_0x1dc39f][_0x56426c],'exitAt':null},'defaults':{'channel':_0x1dc39f,'membername':_0x180460[_0x8d09('0x32')][_0x8d09('0x10')],'interface':_['isNil'](_0x180460['user'][_0x8d09('0x39')])?util[_0x8d09('0x3a')](_0x8d09('0x3b'),_0x180460[_0x8d09('0x32')]['name']):_0x180460[_0x8d09('0x32')][_0x8d09('0x39')],'type':'INTERACTION','enterAt':moment()['format'](_0x8d09('0x3c')),'role':_0x8d09('0x3d'),'internal':_0x180460[_0x8d09('0x32')][_0x8d09('0x3e')],'uniqueid':_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f][_0x56426c]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x180460[_0x8d09('0x1a')]['id'],'capacity':_0x180460[_0x8d09('0x30')]['capacity']},routingClient)['then'](respondWithResult(_0x9f97bf,null))['catch'](handleError(_0x9f97bf,null));};exports[_0x8d09('0x3f')]=function(_0x3efe28,_0x55349e){return respondWithRpcPromise('Telephones',_0x3efe28[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x55349e,null))[_0x8d09('0x1b')](handleError(_0x55349e,null));};exports[_0x8d09('0x40')]=function(_0xcfb5f9,_0x10e437){return respondWithRpcPromise('Trunks',_0xcfb5f9['query'])[_0x8d09('0x7')](respondWithResult(_0x10e437,null))[_0x8d09('0x1b')](handleError(_0x10e437,null));};exports[_0x8d09('0x41')]=function(_0x4333b7,_0x3f6475){return respondWithRpcPromise(_0x8d09('0x42'),_0x4333b7[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x3f6475,null))[_0x8d09('0x1b')](handleError(_0x3f6475,null));};exports['chatQueues']=function(_0x17ffb0,_0x1610c1){return respondWithRpcPromise('ChatQueues',_0x17ffb0[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x1610c1,null))[_0x8d09('0x1b')](handleError(_0x1610c1,null));};exports[_0x8d09('0x43')]=function(_0x1cee90,_0x18722d){return respondWithRpcPromise(_0x8d09('0x44'),_0x1cee90[_0x8d09('0x16')],routingClient)['then'](findById(_0x1cee90[_0x8d09('0x1a')]['id']))['then'](respondWithResult(_0x18722d,null))[_0x8d09('0x1b')](handleError(_0x18722d,null));};exports[_0x8d09('0x45')]=function(_0x2c464e,_0x787b11){return respondWithRpcPromise('MailQueues',_0x2c464e[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x787b11,null))['catch'](handleError(_0x787b11,null));};exports['showMailQueues']=function(_0x483f90,_0x2711e1){return respondWithRpcPromise('MailQueues',_0x483f90[_0x8d09('0x16')],routingClient)['then'](findById(_0x483f90['params']['id']))['then'](respondWithResult(_0x2711e1,null))['catch'](handleError(_0x2711e1,null));};exports[_0x8d09('0x46')]=function(_0x544bdf,_0x5a3f4d){return respondWithRpcPromise(_0x8d09('0x47'),_0x544bdf[_0x8d09('0x16')],mailClient)['then'](respondWithResult(_0x5a3f4d,null))[_0x8d09('0x1b')](handleError(_0x5a3f4d,null));};exports[_0x8d09('0x48')]=function(_0xc9fd6c,_0x445c37){return respondWithRpcPromise(_0x8d09('0x49'),_0xc9fd6c['query'],routingClient)['then'](respondWithResult(_0x445c37,null))[_0x8d09('0x1b')](handleError(_0x445c37,null));};exports[_0x8d09('0x4a')]=function(_0x42c63b,_0x11cb4a){return respondWithRpcPromise('OpenchannelQueues',_0x42c63b['query'],routingClient)[_0x8d09('0x7')](findById(_0x42c63b['params']['id']))[_0x8d09('0x7')](respondWithResult(_0x11cb4a,null))[_0x8d09('0x1b')](handleError(_0x11cb4a,null));};exports['smsQueues']=function(_0x363998,_0x480293){return respondWithRpcPromise(_0x8d09('0x4b'),_0x363998[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x480293,null))[_0x8d09('0x1b')](handleError(_0x480293,null));};exports[_0x8d09('0x4c')]=function(_0x1e59d5,_0x32746b){return respondWithRpcPromise(_0x8d09('0x4b'),_0x1e59d5['query'],routingClient)['then'](findById(_0x1e59d5[_0x8d09('0x1a')]['id']))[_0x8d09('0x7')](respondWithResult(_0x32746b,null))[_0x8d09('0x1b')](handleError(_0x32746b,null));};exports[_0x8d09('0x4d')]=function(_0x38363f,_0x202cf0){return respondWithRpcPromise(_0x8d09('0x4e'),_0x38363f[_0x8d09('0x16')],routingClient)['then'](respondWithResult(_0x202cf0,null))['catch'](handleError(_0x202cf0,null));};exports[_0x8d09('0x4f')]=function(_0x1822f1,_0x4349a7){return respondWithRpcPromise(_0x8d09('0x4e'),_0x1822f1[_0x8d09('0x16')],routingClient)['then'](findById(_0x1822f1['params']['id']))[_0x8d09('0x7')](respondWithResult(_0x4349a7,null))['catch'](handleError(_0x4349a7,null));};exports[_0x8d09('0x50')]=function(_0x45300a,_0x380fe1){return respondWithRpcPromise(_0x8d09('0x51'),_0x45300a[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x380fe1,null))[_0x8d09('0x1b')](handleError(_0x380fe1,null));};exports[_0x8d09('0x52')]=function(_0x163672,_0x5de709){return respondWithRpcPromise(_0x8d09('0x51'),_0x163672[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](findById(_0x163672[_0x8d09('0x1a')]['id']))[_0x8d09('0x7')](respondWithResult(_0x5de709,null))[_0x8d09('0x1b')](handleError(_0x5de709,null));};exports[_0x8d09('0x53')]=function(_0x35c739,_0x5457b2){return respondWithRpcPromise(_0x8d09('0x54'),_0x35c739[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x5457b2,null))[_0x8d09('0x1b')](handleError(_0x5457b2,null));};exports[_0x8d09('0x55')]=function(_0x266b24,_0x5b2d7f){return respondWithRpcPromise(_0x8d09('0x56'),_0x266b24[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x5b2d7f,null))[_0x8d09('0x1b')](handleError(_0x5b2d7f,null));};exports[_0x8d09('0x57')]=function(_0x116dae,_0x4b45db){return respondWithRpcPromise(_0x8d09('0x58'),_0x116dae[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x4b45db,null))[_0x8d09('0x1b')](handleError(_0x4b45db,null));};exports[_0x8d09('0x59')]=function(_0x51062c,_0x2c857e){return respondWithRpcPromise(_0x8d09('0x5a'),_0x51062c[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x2c857e,null))['catch'](handleError(_0x2c857e,null));};exports[_0x8d09('0x5b')]=function(_0x9daa4d,_0x22c353){return respondWithRpcPromise(_0x8d09('0x5a'),_0x9daa4d[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](function(_0x107275){if(_0x9daa4d[_0x8d09('0x16')]['type']!==undefined){var _0x41ef6f=_(_0x107275['rows'])[_0x8d09('0x5c')]([_0x9daa4d['query'][_0x8d09('0x5d')],_0x9daa4d[_0x8d09('0x1a')]['id']])[_0x8d09('0x5e')]('queue_id')[_0x8d09('0x5f')]()[_0x8d09('0x60')]();return _0x107275[_0x8d09('0x61')][_0x8d09('0x5c')](function(_0xf3a6b4){return _0x41ef6f[_0x8d09('0x62')](_0xf3a6b4['queue_id'])>-0x1;});}else{return _0x107275[_0x8d09('0x61')]['filter'](function(_0x13f799){return _0x13f799['queue_id']===parseInt(_0x9daa4d[_0x8d09('0x1a')]['id']);});}})[_0x8d09('0x7')](respondWithResult(_0x22c353,null))[_0x8d09('0x1b')](handleError(_0x22c353,null));};exports[_0x8d09('0x63')]=function(_0x1ef4d6,_0x4f445e){return respondWithRpcPromise(_0x8d09('0x64'),_0x1ef4d6['query'],routingClient)[_0x8d09('0x7')](respondWithResult(_0x4f445e,null))['catch'](handleError(_0x4f445e,null));};exports[_0x8d09('0x65')]=function(_0xcf7c2f,_0xf6a13){return respondWithRpcPromise(_0x8d09('0x66'),_0xcf7c2f[_0x8d09('0x16')],routingClient)['then'](respondWithResult(_0xf6a13,null))[_0x8d09('0x1b')](handleError(_0xf6a13,null));};exports['faxQueuesWaitingInteractions']=function(_0x4311a7,_0x4e82c9){return respondWithRpcPromise(_0x8d09('0x67'),_0x4311a7[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x4e82c9,null))[_0x8d09('0x1b')](handleError(_0x4e82c9,null));};exports[_0x8d09('0x68')]=function(_0x72f6d3){return function(_0x303899,_0x1eaafa){var _0x9f77df,_0x5e6423;var _0x2ced4d=_[_0x8d09('0x69')](_0x72f6d3);var _0x1b8e9e=_0x72f6d3==='chat'?_0x8d09('0x6a'):_0x8d09('0x6b');return db[_0x2ced4d+_0x8d09('0x6c')][_0x8d09('0x6d')]({'raw':!![],'where':{'id':_0x303899[_0x8d09('0x1a')]['id']}})['then'](function(_0x28512e){if(_[_0x8d09('0x12')](_0x28512e)){throw new Error(_0x2ced4d+_0x8d09('0x6e'));}_0x9f77df=_0x28512e;return db[_0x2ced4d+_0x8d09('0x6f')]['findOne']({'where':{'id':_0x303899[_0x8d09('0x30')][_0x8d09('0x70')]},'include':[{'model':db[_0x2ced4d+_0x8d09('0x71')],'as':_0x8d09('0x71')},{'model':db[_0x2ced4d+_0x1b8e9e],'as':_0x8d09('0x6b')}]});})['then'](function(_0x1a602c){if(_[_0x8d09('0x12')](_0x1a602c)){throw new Error(_0x2ced4d+_0x8d09('0x72'));}_0x5e6423=_0x1a602c;return _0x1a602c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8d09('0x7')](function(){var _0x514908={'uniqueid':_0x72f6d3+'.'+_0x5e6423['id']+'.'+_0x5e6423[_0x8d09('0x71')]['id'],'FromUserId':_0x303899[_0x8d09('0x32')]['id'],'type':'queue'};_0x514908[_0x2ced4d+_0x8d09('0x73')]=_0x5e6423['id'];_0x514908[_0x2ced4d+'InteractionId']=_0x5e6423[_0x8d09('0x71')]['id'];_0x514908[_0x8d09('0x74')+_0x2ced4d+_0x1b8e9e+'Id']=_0x5e6423[_0x8d09('0x6b')]['id'];_0x514908['To'+_0x2ced4d+_0x8d09('0x75')]=_0x9f77df['id'];return db[_0x2ced4d+'TransferReport'][_0x8d09('0x76')](_0x514908);})[_0x8d09('0x7')](function(){return respondWithRpcPromise(_0x8d09('0x77'),{'channel':_0x72f6d3,'interaction':_0x5e6423[_0x8d09('0x71')],'message':_0x5e6423,'account':_0x5e6423[_0x8d09('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8d09('0x78'),'appdata':_0x9f77df[_0x8d09('0x10')]+','+(_0x5e6423['Account'][_0x8d09('0x79')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x8d09('0x7')](respondWithResult(_0x1eaafa,null))[_0x8d09('0x1b')](handleError(_0x1eaafa,null));};};exports[_0x8d09('0x7a')]=function(_0x36a847,_0x3e3ed9){var _0x2a7ab7,_0x2dc280;if(_[_0x8d09('0x12')](_0x36a847[_0x8d09('0x30')][_0x8d09('0x7b')])){throw new Error(_0x8d09('0x7c'));}var _0x27e6e7=_0x36a847['body']['channel'];var _0x6fba39=_['capitalize'](_0x27e6e7);var _0x37a28a=_0x27e6e7===_0x8d09('0x7d')?_0x8d09('0x6a'):'Account';return db[_0x8d09('0x7e')][_0x8d09('0x6d')]({'raw':!![],'where':{'id':_0x36a847[_0x8d09('0x1a')]['id'],'role':_0x8d09('0x3d')}})[_0x8d09('0x7')](function(_0x2c6204){if(_[_0x8d09('0x12')](_0x2c6204)){throw new Error('Agent\x20not\x20found');}_0x2a7ab7=_0x2c6204;return db[_0x6fba39+_0x8d09('0x6f')][_0x8d09('0x6d')]({'where':{'id':_0x36a847[_0x8d09('0x30')]['messageId']},'include':[{'model':db[_0x6fba39+'Interaction'],'as':'Interaction'},{'model':db[_0x6fba39+_0x37a28a],'as':_0x8d09('0x6b')}]});})[_0x8d09('0x7')](function(_0x2914e4){if(_[_0x8d09('0x12')](_0x2914e4)){throw new Error(_0x6fba39+_0x8d09('0x72'));}_0x2dc280=_0x2914e4;return _0x2914e4['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8d09('0x7')](function(){var _0x12acfb={'uniqueid':_0x27e6e7+'.'+_0x2dc280['id']+'.'+_0x2dc280[_0x8d09('0x71')]['id'],'FromUserId':_0x36a847[_0x8d09('0x32')]['id'],'type':_0x8d09('0x78'),'ToUserId':_0x2a7ab7['id']};_0x12acfb[_0x6fba39+'MessageId']=_0x2dc280['id'];_0x12acfb[_0x6fba39+_0x8d09('0x7f')]=_0x2dc280[_0x8d09('0x71')]['id'];_0x12acfb[_0x8d09('0x74')+_0x6fba39+_0x37a28a+'Id']=_0x2dc280['Account']['id'];return db[_0x6fba39+_0x8d09('0x80')][_0x8d09('0x76')](_0x12acfb);})[_0x8d09('0x7')](function(){return respondWithRpcPromise(_0x8d09('0x77'),{'channel':_0x27e6e7,'interaction':_0x2dc280[_0x8d09('0x71')],'message':_0x2dc280,'account':_0x2dc280[_0x8d09('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2a7ab7[_0x8d09('0x10')]+','+(_0x2dc280[_0x8d09('0x6b')][_0x8d09('0x81')]||0x12c),'interval':_0x8d09('0x82')}]},routingClient);})[_0x8d09('0x7')](respondWithResult(_0x3e3ed9,null))['catch'](handleError(_0x3e3ed9,null));}; \ No newline at end of file +var _0x3bc7=['*,*,*,*','agentNotify','channel','agent','Agent\x20not\x20found','messageId','MessageId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','agentCapacity','body','interaction','user','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Message','findOne','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x3bc7,0x85));var _0x73bc=function(_0x16ea45,_0x154ece){_0x16ea45=_0x16ea45-0x0;var _0xfd4793=_0x3bc7[_0x16ea45];return _0xfd4793;};'use strict';var BPromise=require(_0x73bc('0x0'));var moment=require(_0x73bc('0x1'));var _=require(_0x73bc('0x2'));var util=require(_0x73bc('0x3'));var db=require(_0x73bc('0x4'))['db'];var logger=require(_0x73bc('0x5'))(_0x73bc('0x6'));var jayson=require(_0x73bc('0x7'));var amiClient=jayson[_0x73bc('0x8')][_0x73bc('0x9')]({'port':0x232a});var mailClient=jayson[_0x73bc('0x8')][_0x73bc('0x9')]({'port':0x232b});var routingClient=jayson['client'][_0x73bc('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x1e82bc,_0x4179dc,_0x51b9f2){return new BPromise(function(_0xf72c5a,_0x534fa9){var _0x25ad94=_0x51b9f2?_0x51b9f2:amiClient;return _0x25ad94['request'](_0x1e82bc,_0x4179dc)[_0x73bc('0xa')](function(_0x93763c){if(_0x93763c['error']){if(_0x93763c[_0x73bc('0xb')][_0x73bc('0xc')]===0x1f4){return _0x534fa9(_0x93763c[_0x73bc('0xb')][_0x73bc('0xd')]);}return _0xf72c5a(_0x93763c['error'][_0x73bc('0xd')]);}else{_0xf72c5a(_0x93763c['result']);}})[_0x73bc('0xe')](function(_0x293908){_0x534fa9(_0x293908);});});}function respondWithResult(_0x7b0085,_0x5ac29c){_0x5ac29c=_0x5ac29c||0xc8;return function(_0x5a9876){if(_0x5a9876){return _0x7b0085[_0x73bc('0xf')](_0x5ac29c)[_0x73bc('0x10')](_0x5a9876);}return _0x7b0085[_0x73bc('0x11')](0x194);};}function handleError(_0x176e45,_0x4dedec){_0x4dedec=_0x4dedec||0x1f4;return function(_0x1145d8){logger[_0x73bc('0xb')](_0x1145d8[_0x73bc('0x12')]);if(_0x1145d8[_0x73bc('0x13')]){delete _0x1145d8[_0x73bc('0x13')];}_0x176e45[_0x73bc('0xf')](_0x4dedec)[_0x73bc('0x14')](_0x1145d8);};}function findById(_0x4815fb){return function(_0x24b913){if(!_['isNil'](_0x4815fb)&&!_[_0x73bc('0x15')](_0x24b913)&&!_['isNil'](_0x24b913[_0x73bc('0x16')])){return _[_0x73bc('0x17')](_0x24b913['rows'],function(_0x4d4ba4){return _0x4d4ba4['id']==_0x4815fb;});}return null;};}exports['voiceChannels']=function(_0x4ddca0,_0x156022){return respondWithRpcPromise(_0x73bc('0x18'),_0x4ddca0[_0x73bc('0x19')])['then'](respondWithResult(_0x156022,null))[_0x73bc('0xe')](handleError(_0x156022,null));};exports['voiceChannelMixMonitor']=function(_0x912033,_0x41a51f){return respondWithRpcPromise(_0x73bc('0x1a'),_[_0x73bc('0x1b')](_0x912033[_0x73bc('0x19')],_0x912033[_0x73bc('0x1c')]))['then'](respondWithResult(_0x41a51f,null))[_0x73bc('0xe')](handleError(_0x41a51f,null));};exports['voiceChannelStopMixMonitor']=function(_0x27437b,_0x400a1f){return respondWithRpcPromise(_0x73bc('0x1d'),_[_0x73bc('0x1b')](_0x27437b[_0x73bc('0x19')],_0x27437b[_0x73bc('0x1c')]))[_0x73bc('0xa')](respondWithResult(_0x400a1f,null))['catch'](handleError(_0x400a1f,null));};exports[_0x73bc('0x1e')]=function(_0x40da68,_0x4be48c){return respondWithRpcPromise(_0x73bc('0x1f'),_0x40da68[_0x73bc('0x19')])[_0x73bc('0xa')](respondWithResult(_0x4be48c,null))[_0x73bc('0xe')](handleError(_0x4be48c,null));};exports[_0x73bc('0x20')]=function(_0x334f42,_0x2efaff){return respondWithRpcPromise(_0x73bc('0x1f'),_0x334f42[_0x73bc('0x19')])[_0x73bc('0xa')](findById(_0x334f42[_0x73bc('0x1c')]['id']))[_0x73bc('0xa')](respondWithResult(_0x2efaff,null))[_0x73bc('0xe')](handleError(_0x2efaff,null));};exports['voiceQueuesPreview']=function(_0x31ec19,_0x429d8c){return respondWithRpcPromise(_0x73bc('0x21'),_[_0x73bc('0x1b')](_0x31ec19[_0x73bc('0x19')],_0x31ec19[_0x73bc('0x1c')]))[_0x73bc('0xa')](respondWithResult(_0x429d8c,null))[_0x73bc('0xe')](handleError(_0x429d8c,null));};exports[_0x73bc('0x22')]=function(_0x1e51ad,_0x401c66){return respondWithRpcPromise('VoiceQueuesChannels',_0x1e51ad[_0x73bc('0x19')])[_0x73bc('0xa')](respondWithResult(_0x401c66,null))[_0x73bc('0xe')](handleError(_0x401c66,null));};exports[_0x73bc('0x23')]=function(_0x27a8fa,_0xb6744a){return respondWithRpcPromise(_0x73bc('0x24'),_[_0x73bc('0x1b')](_0x27a8fa[_0x73bc('0x19')],_0x27a8fa[_0x73bc('0x1c')]))[_0x73bc('0xa')](respondWithResult(_0xb6744a,null))[_0x73bc('0xe')](handleError(_0xb6744a,null));};exports[_0x73bc('0x25')]=function(_0x4d01b5,_0x2c3997){return respondWithRpcPromise(_0x73bc('0x26'),_['merge'](_0x4d01b5[_0x73bc('0x19')],_0x4d01b5[_0x73bc('0x1c')]))[_0x73bc('0xa')](respondWithResult(_0x2c3997,null))[_0x73bc('0xe')](handleError(_0x2c3997,null));};exports[_0x73bc('0x27')]=function(_0x129a4a,_0x3b2114){return respondWithRpcPromise(_0x73bc('0x28'),_[_0x73bc('0x1b')](_0x129a4a[_0x73bc('0x19')],_0x129a4a[_0x73bc('0x1c')]))[_0x73bc('0xa')](respondWithResult(_0x3b2114,null))[_0x73bc('0xe')](handleError(_0x3b2114,null));};exports[_0x73bc('0x29')]=function(_0x5648f9,_0x3c30e7){return respondWithRpcPromise(_0x73bc('0x2a'),_0x5648f9['query'])['then'](respondWithResult(_0x3c30e7,null))[_0x73bc('0xe')](handleError(_0x3c30e7,null));};exports['outboundChannels']=function(_0x677951,_0x2915ec){return respondWithRpcPromise(_0x73bc('0x2b'),_0x677951['query'])[_0x73bc('0xa')](respondWithResult(_0x2915ec,null))[_0x73bc('0xe')](handleError(_0x2915ec,null));};exports['agents']=function(_0x3d1767,_0x361e85){var _0x5817b4;return respondWithRpcPromise(_0x73bc('0x2c'),_0x3d1767[_0x73bc('0x19')])['then'](function(_0x47a6bb){_0x5817b4=_0x47a6bb;return respondWithRpcPromise('Agents',_0x3d1767[_0x73bc('0x19')],routingClient);})['then'](function(_0x15651e){return _[_0x73bc('0x1b')]({},_0x15651e,_0x5817b4);})[_0x73bc('0xa')](respondWithResult(_0x361e85,null))[_0x73bc('0xe')](handleError(_0x361e85,null));};exports[_0x73bc('0x2d')]=function(_0x27086f,_0x3c12c3){if(_0x27086f[_0x73bc('0x2e')]&&_0x27086f[_0x73bc('0x2e')][_0x73bc('0x2f')]&&_0x27086f['user']&&_0x27086f[_0x73bc('0x30')][_0x73bc('0x13')]){for(var _0x15f930 in _0x27086f[_0x73bc('0x2e')][_0x73bc('0x2f')]){if(_0x27086f[_0x73bc('0x2e')][_0x73bc('0x2f')]['hasOwnProperty'](_0x15f930)){db[_0x73bc('0x31')]['findAll']({'where':{'channel':_0x15f930,'membername':_0x27086f[_0x73bc('0x30')][_0x73bc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x27086f['body'][_0x73bc('0x2f')][_0x15f930]&&_0x27086f[_0x73bc('0x2e')][_0x73bc('0x2f')][_0x15f930][_0x73bc('0x32')]?{'$notIn':_0x27086f[_0x73bc('0x2e')]['interaction'][_0x15f930]}:{'$ne':null}}})[_0x73bc('0xa')](function(_0x48ca33){var _0x491e64=moment()[_0x73bc('0x33')](_0x73bc('0x34'));for(var _0x453e50=0x0,_0x5efbd7=_0x48ca33[_0x73bc('0x32')];_0x453e50<_0x5efbd7;_0x453e50+=0x1){_0x48ca33[_0x453e50][_0x73bc('0x35')]({'exitAt':_0x491e64});}});for(var _0x20e2a8=0x0;_0x20e2a8<_0x27086f[_0x73bc('0x2e')]['interaction'][_0x15f930]['length'];_0x20e2a8+=0x1){db['MemberReport'][_0x73bc('0x36')]({'where':{'channel':_0x15f930,'membername':_0x27086f[_0x73bc('0x30')]['name'],'type':_0x73bc('0x37'),'uniqueid':_0x27086f[_0x73bc('0x2e')][_0x73bc('0x2f')][_0x15f930][_0x20e2a8],'exitAt':null},'defaults':{'channel':_0x15f930,'membername':_0x27086f[_0x73bc('0x30')][_0x73bc('0x13')],'interface':_[_0x73bc('0x15')](_0x27086f['user'][_0x73bc('0x38')])?util['format']('SIP/%s',_0x27086f['user'][_0x73bc('0x13')]):_0x27086f[_0x73bc('0x30')][_0x73bc('0x38')],'type':_0x73bc('0x37'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x27086f['user']['internal'],'uniqueid':_0x27086f['body']['interaction'][_0x15f930][_0x20e2a8]}});}}}}return respondWithRpcPromise(_0x73bc('0x39'),{'id':_0x27086f[_0x73bc('0x1c')]['id'],'capacity':_0x27086f[_0x73bc('0x2e')][_0x73bc('0x3a')]},routingClient)[_0x73bc('0xa')](respondWithResult(_0x3c12c3,null))[_0x73bc('0xe')](handleError(_0x3c12c3,null));};exports[_0x73bc('0x3b')]=function(_0x4429a0,_0xcec5c4){return respondWithRpcPromise(_0x73bc('0x3c'),_0x4429a0[_0x73bc('0x19')])[_0x73bc('0xa')](respondWithResult(_0xcec5c4,null))[_0x73bc('0xe')](handleError(_0xcec5c4,null));};exports[_0x73bc('0x3d')]=function(_0x255fde,_0x245dd0){return respondWithRpcPromise('Trunks',_0x255fde[_0x73bc('0x19')])[_0x73bc('0xa')](respondWithResult(_0x245dd0,null))['catch'](handleError(_0x245dd0,null));};exports[_0x73bc('0x3e')]=function(_0x1122c8,_0x59450b){return respondWithRpcPromise('Campaigns',_0x1122c8[_0x73bc('0x19')])[_0x73bc('0xa')](respondWithResult(_0x59450b,null))[_0x73bc('0xe')](handleError(_0x59450b,null));};exports['chatQueues']=function(_0x24129e,_0x545f45){return respondWithRpcPromise(_0x73bc('0x3f'),_0x24129e[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](respondWithResult(_0x545f45,null))['catch'](handleError(_0x545f45,null));};exports[_0x73bc('0x40')]=function(_0xc4de23,_0x13bce1){return respondWithRpcPromise(_0x73bc('0x3f'),_0xc4de23['query'],routingClient)[_0x73bc('0xa')](findById(_0xc4de23[_0x73bc('0x1c')]['id']))[_0x73bc('0xa')](respondWithResult(_0x13bce1,null))[_0x73bc('0xe')](handleError(_0x13bce1,null));};exports[_0x73bc('0x41')]=function(_0x23c6f9,_0x5820e2){return respondWithRpcPromise('MailQueues',_0x23c6f9['query'],routingClient)[_0x73bc('0xa')](respondWithResult(_0x5820e2,null))[_0x73bc('0xe')](handleError(_0x5820e2,null));};exports[_0x73bc('0x42')]=function(_0x2fa43e,_0x3d4b15){return respondWithRpcPromise(_0x73bc('0x43'),_0x2fa43e[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](findById(_0x2fa43e[_0x73bc('0x1c')]['id']))[_0x73bc('0xa')](respondWithResult(_0x3d4b15,null))[_0x73bc('0xe')](handleError(_0x3d4b15,null));};exports[_0x73bc('0x44')]=function(_0x31c169,_0xfb39e1){return respondWithRpcPromise('MailAccounts',_0x31c169[_0x73bc('0x19')],mailClient)[_0x73bc('0xa')](respondWithResult(_0xfb39e1,null))[_0x73bc('0xe')](handleError(_0xfb39e1,null));};exports[_0x73bc('0x45')]=function(_0x324a65,_0x302b3c){return respondWithRpcPromise(_0x73bc('0x46'),_0x324a65['query'],routingClient)[_0x73bc('0xa')](respondWithResult(_0x302b3c,null))[_0x73bc('0xe')](handleError(_0x302b3c,null));};exports[_0x73bc('0x47')]=function(_0x5a5d39,_0x5ff2ae){return respondWithRpcPromise(_0x73bc('0x46'),_0x5a5d39[_0x73bc('0x19')],routingClient)['then'](findById(_0x5a5d39[_0x73bc('0x1c')]['id']))[_0x73bc('0xa')](respondWithResult(_0x5ff2ae,null))[_0x73bc('0xe')](handleError(_0x5ff2ae,null));};exports['smsQueues']=function(_0xabe3c6,_0x3e769f){return respondWithRpcPromise('SmsQueues',_0xabe3c6[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](respondWithResult(_0x3e769f,null))[_0x73bc('0xe')](handleError(_0x3e769f,null));};exports[_0x73bc('0x48')]=function(_0x713472,_0x503cf8){return respondWithRpcPromise(_0x73bc('0x49'),_0x713472[_0x73bc('0x19')],routingClient)['then'](findById(_0x713472[_0x73bc('0x1c')]['id']))[_0x73bc('0xa')](respondWithResult(_0x503cf8,null))[_0x73bc('0xe')](handleError(_0x503cf8,null));};exports['whatsappQueues']=function(_0x3a1751,_0x2d3b6b){return respondWithRpcPromise('WhatsappQueues',_0x3a1751['query'],routingClient)[_0x73bc('0xa')](respondWithResult(_0x2d3b6b,null))[_0x73bc('0xe')](handleError(_0x2d3b6b,null));};exports[_0x73bc('0x4a')]=function(_0x52ac45,_0x272e82){return respondWithRpcPromise(_0x73bc('0x4b'),_0x52ac45[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](findById(_0x52ac45['params']['id']))[_0x73bc('0xa')](respondWithResult(_0x272e82,null))[_0x73bc('0xe')](handleError(_0x272e82,null));};exports[_0x73bc('0x4c')]=function(_0x243721,_0x510f0d){return respondWithRpcPromise(_0x73bc('0x4d'),_0x243721[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](respondWithResult(_0x510f0d,null))[_0x73bc('0xe')](handleError(_0x510f0d,null));};exports[_0x73bc('0x4e')]=function(_0x37aba3,_0x5bd394){return respondWithRpcPromise(_0x73bc('0x4d'),_0x37aba3[_0x73bc('0x19')],routingClient)['then'](findById(_0x37aba3[_0x73bc('0x1c')]['id']))[_0x73bc('0xa')](respondWithResult(_0x5bd394,null))[_0x73bc('0xe')](handleError(_0x5bd394,null));};exports[_0x73bc('0x4f')]=function(_0x4e75e0,_0x16ee4b){return respondWithRpcPromise(_0x73bc('0x50'),_0x4e75e0[_0x73bc('0x19')])[_0x73bc('0xa')](respondWithResult(_0x16ee4b,null))[_0x73bc('0xe')](handleError(_0x16ee4b,null));};exports[_0x73bc('0x51')]=function(_0x3d6e8d,_0x5c4f09){return respondWithRpcPromise(_0x73bc('0x52'),_0x3d6e8d[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](respondWithResult(_0x5c4f09,null))['catch'](handleError(_0x5c4f09,null));};exports[_0x73bc('0x53')]=function(_0x36763c,_0x576947){return respondWithRpcPromise(_0x73bc('0x54'),_0x36763c[_0x73bc('0x19')],routingClient)['then'](respondWithResult(_0x576947,null))[_0x73bc('0xe')](handleError(_0x576947,null));};exports[_0x73bc('0x55')]=function(_0x478bec,_0x18e28d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x478bec[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](respondWithResult(_0x18e28d,null))['catch'](handleError(_0x18e28d,null));};exports[_0x73bc('0x56')]=function(_0x2fa204,_0xfac594){return respondWithRpcPromise(_0x73bc('0x57'),_0x2fa204[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](function(_0x3d32a9){if(_0x2fa204['query'][_0x73bc('0x58')]!==undefined){var _0xba2393=_(_0x3d32a9['rows'])[_0x73bc('0x59')]([_0x2fa204[_0x73bc('0x19')][_0x73bc('0x58')],_0x2fa204[_0x73bc('0x1c')]['id']])[_0x73bc('0x5a')]('queue_id')['uniq']()[_0x73bc('0x5b')]();return _0x3d32a9[_0x73bc('0x16')][_0x73bc('0x59')](function(_0x1568d4){return _0xba2393[_0x73bc('0x5c')](_0x1568d4['queue_id'])>-0x1;});}else{return _0x3d32a9[_0x73bc('0x16')]['filter'](function(_0x1be49d){return _0x1be49d[_0x73bc('0x5d')]===parseInt(_0x2fa204[_0x73bc('0x1c')]['id']);});}})[_0x73bc('0xa')](respondWithResult(_0xfac594,null))[_0x73bc('0xe')](handleError(_0xfac594,null));};exports[_0x73bc('0x5e')]=function(_0x3654de,_0x3559f0){return respondWithRpcPromise(_0x73bc('0x5f'),_0x3654de[_0x73bc('0x19')],routingClient)[_0x73bc('0xa')](respondWithResult(_0x3559f0,null))[_0x73bc('0xe')](handleError(_0x3559f0,null));};exports[_0x73bc('0x60')]=function(_0x3899dd,_0x4ec388){return respondWithRpcPromise(_0x73bc('0x61'),_0x3899dd['query'],routingClient)[_0x73bc('0xa')](respondWithResult(_0x4ec388,null))[_0x73bc('0xe')](handleError(_0x4ec388,null));};exports[_0x73bc('0x62')]=function(_0x496e2f,_0x30c260){return respondWithRpcPromise(_0x73bc('0x63'),_0x496e2f[_0x73bc('0x19')],routingClient)['then'](respondWithResult(_0x30c260,null))[_0x73bc('0xe')](handleError(_0x30c260,null));};exports['queueNotify']=function(_0x2dd45e){return function(_0xec9b6b,_0x585211){var _0x3be871,_0x386ed5;var _0xd72991=_[_0x73bc('0x64')](_0x2dd45e);var _0x177ab0=_0x2dd45e===_0x73bc('0x65')?_0x73bc('0x66'):_0x73bc('0x67');return db[_0xd72991+'Queue']['findOne']({'raw':!![],'where':{'id':_0xec9b6b[_0x73bc('0x1c')]['id']}})[_0x73bc('0xa')](function(_0x2f0d6d){if(_[_0x73bc('0x15')](_0x2f0d6d)){throw new Error(_0xd72991+'\x20Queue\x20not\x20found');}_0x3be871=_0x2f0d6d;return db[_0xd72991+_0x73bc('0x68')][_0x73bc('0x69')]({'where':{'id':_0xec9b6b['body']['messageId']},'include':[{'model':db[_0xd72991+'Interaction'],'as':_0x73bc('0x6a')},{'model':db[_0xd72991+_0x177ab0],'as':_0x73bc('0x67')}]});})[_0x73bc('0xa')](function(_0x4d1543){if(_['isNil'](_0x4d1543)){throw new Error(_0xd72991+_0x73bc('0x6b'));}_0x386ed5=_0x4d1543;return _0x4d1543[_0x73bc('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x73bc('0xa')](function(){var _0x1e0a68={'uniqueid':_0x2dd45e+'.'+_0x386ed5['id']+'.'+_0x386ed5[_0x73bc('0x6a')]['id'],'FromUserId':_0xec9b6b[_0x73bc('0x30')]['id'],'type':_0x73bc('0x6d')};_0x1e0a68[_0xd72991+'MessageId']=_0x386ed5['id'];_0x1e0a68[_0xd72991+_0x73bc('0x6e')]=_0x386ed5[_0x73bc('0x6a')]['id'];_0x1e0a68[_0x73bc('0x6f')+_0xd72991+_0x177ab0+'Id']=_0x386ed5['Account']['id'];_0x1e0a68['To'+_0xd72991+_0x73bc('0x70')]=_0x3be871['id'];return db[_0xd72991+_0x73bc('0x71')][_0x73bc('0x72')](_0x1e0a68);})[_0x73bc('0xa')](function(){return respondWithRpcPromise(_0x73bc('0x73'),{'channel':_0x2dd45e,'interaction':_0x386ed5[_0x73bc('0x6a')],'message':_0x386ed5,'account':_0x386ed5[_0x73bc('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x73bc('0x6d'),'appdata':_0x3be871[_0x73bc('0x13')]+','+(_0x386ed5[_0x73bc('0x67')][_0x73bc('0x74')]||0x12c),'interval':_0x73bc('0x75')}]},routingClient);})[_0x73bc('0xa')](respondWithResult(_0x585211,null))[_0x73bc('0xe')](handleError(_0x585211,null));};};exports[_0x73bc('0x76')]=function(_0x18a8dc,_0x50d598){var _0x198295,_0x27eda4;if(_[_0x73bc('0x15')](_0x18a8dc[_0x73bc('0x2e')][_0x73bc('0x77')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x5e12e9=_0x18a8dc['body'][_0x73bc('0x77')];var _0xe8e165=_[_0x73bc('0x64')](_0x5e12e9);var _0x4c4e5f=_0x5e12e9===_0x73bc('0x65')?_0x73bc('0x66'):_0x73bc('0x67');return db['User'][_0x73bc('0x69')]({'raw':!![],'where':{'id':_0x18a8dc[_0x73bc('0x1c')]['id'],'role':_0x73bc('0x78')}})[_0x73bc('0xa')](function(_0x2628d3){if(_['isNil'](_0x2628d3)){throw new Error(_0x73bc('0x79'));}_0x198295=_0x2628d3;return db[_0xe8e165+_0x73bc('0x68')]['findOne']({'where':{'id':_0x18a8dc[_0x73bc('0x2e')][_0x73bc('0x7a')]},'include':[{'model':db[_0xe8e165+_0x73bc('0x6a')],'as':_0x73bc('0x6a')},{'model':db[_0xe8e165+_0x4c4e5f],'as':_0x73bc('0x67')}]});})['then'](function(_0x47389d){if(_[_0x73bc('0x15')](_0x47389d)){throw new Error(_0xe8e165+'\x20Message\x20not\x20found');}_0x27eda4=_0x47389d;return _0x47389d[_0x73bc('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x73bc('0xa')](function(){var _0x50264d={'uniqueid':_0x5e12e9+'.'+_0x27eda4['id']+'.'+_0x27eda4[_0x73bc('0x6a')]['id'],'FromUserId':_0x18a8dc[_0x73bc('0x30')]['id'],'type':'queue','ToUserId':_0x198295['id']};_0x50264d[_0xe8e165+_0x73bc('0x7b')]=_0x27eda4['id'];_0x50264d[_0xe8e165+_0x73bc('0x6e')]=_0x27eda4[_0x73bc('0x6a')]['id'];_0x50264d[_0x73bc('0x6f')+_0xe8e165+_0x4c4e5f+'Id']=_0x27eda4[_0x73bc('0x67')]['id'];return db[_0xe8e165+'TransferReport'][_0x73bc('0x72')](_0x50264d);})[_0x73bc('0xa')](function(){return respondWithRpcPromise(_0x73bc('0x73'),{'channel':_0x5e12e9,'interaction':_0x27eda4[_0x73bc('0x6a')],'message':_0x27eda4,'account':_0x27eda4['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x198295[_0x73bc('0x13')]+','+(_0x27eda4['Account'][_0x73bc('0x7c')]||0x12c),'interval':_0x73bc('0x75')}]},routingClient);})[_0x73bc('0xa')](respondWithResult(_0x50d598,null))[_0x73bc('0xe')](handleError(_0x50d598,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 393fd07..c9c9b02 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 _0x47b5=['run','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/run'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x47b5,0x66));var _0x547b=function(_0x2484a1,_0x3f7b87){_0x2484a1=_0x2484a1-0x0;var _0x1032bf=_0x47b5[_0x2484a1];return _0x1032bf;};'use strict';var multer=require(_0x547b('0x0'));var util=require('util');var path=require(_0x547b('0x1'));var timeout=require(_0x547b('0x2'));var express=require(_0x547b('0x3'));var router=express['Router']();var auth=require(_0x547b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x547b('0x5'));var controller=require('./schedule.controller');router[_0x547b('0x6')]('/',auth['isAuthenticated'](),controller[_0x547b('0x7')]);router[_0x547b('0x6')](_0x547b('0x8'),auth[_0x547b('0x9')](),controller[_0x547b('0xa')]);router['get'](_0x547b('0xb'),auth['isAuthenticated'](),controller[_0x547b('0xc')]);router[_0x547b('0xd')]('/',auth[_0x547b('0x9')](),controller[_0x547b('0xe')]);router[_0x547b('0xf')](_0x547b('0x8'),auth['isAuthenticated'](),controller[_0x547b('0x10')]);router[_0x547b('0x11')]('/:id',auth[_0x547b('0x9')](),controller[_0x547b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x48f8=['../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','create','put','/:id','update','delete','destroy','exports','util','express','Router'];(function(_0x4f8349,_0x6e8f62){var _0x1504ae=function(_0x4c80c6){while(--_0x4c80c6){_0x4f8349['push'](_0x4f8349['shift']());}};_0x1504ae(++_0x6e8f62);}(_0x48f8,0x9f));var _0x848f=function(_0x3c3930,_0x56f942){_0x3c3930=_0x3c3930-0x0;var _0x2fc3d1=_0x48f8[_0x3c3930];return _0x2fc3d1;};'use strict';var multer=require('multer');var util=require(_0x848f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x848f('0x1'));var router=express[_0x848f('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x848f('0x3'));var controller=require(_0x848f('0x4'));router[_0x848f('0x5')]('/',auth[_0x848f('0x6')](),controller[_0x848f('0x7')]);router[_0x848f('0x5')]('/:id',auth[_0x848f('0x6')](),controller[_0x848f('0x8')]);router['get'](_0x848f('0x9'),auth[_0x848f('0x6')](),controller[_0x848f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x848f('0xb')]);router[_0x848f('0xc')](_0x848f('0xd'),auth['isAuthenticated'](),controller[_0x848f('0xe')]);router[_0x848f('0xf')](_0x848f('0xd'),auth[_0x848f('0x6')](),controller[_0x848f('0x10')]);module[_0x848f('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e0d094f..9de36e8 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 _0xa630=['days','hours','minutes','pdf','xlsx','csv','custom','default','STRING','TEXT','sequelize','exports','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa630,0xbe));var _0x0a63=function(_0x24136e,_0x3e91ea){_0x24136e=_0x24136e-0x0;var _0x5379f3=_0xa630[_0x24136e];return _0x5379f3;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a63('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0a63('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0a63('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0a63('0x6')](_0x0a63('0x7'),_0x0a63('0x8'),'months',_0x0a63('0x9'),_0x0a63('0xa'),_0x0a63('0xb'),_0x0a63('0xc')),'allowNull':![],'defaultValue':_0x0a63('0xa')},'output':{'type':Sequelize[_0x0a63('0x6')]('csv',_0x0a63('0xd'),_0x0a63('0xe')),'allowNull':![],'defaultValue':_0x0a63('0xf')},'type':{'type':Sequelize[_0x0a63('0x6')](_0x0a63('0x10'),_0x0a63('0x11')),'allowNull':![],'defaultValue':_0x0a63('0x10')},'sendMail':{'type':Sequelize[_0x0a63('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0a63('0x12')]},'cc':{'type':Sequelize[_0x0a63('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0a63('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8085=['pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x8085,0x71));var _0x5808=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x8085[_0x2f3794];return _0x1c9fbe;};'use strict';var Sequelize=require(_0x5808('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5808('0x1')]},'active':{'type':Sequelize[_0x5808('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5808('0x1')],'allowNull':![],'defaultValue':_0x5808('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5808('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5808('0x5')]('years',_0x5808('0x6'),_0x5808('0x7'),_0x5808('0x8'),_0x5808('0x9'),_0x5808('0xa'),_0x5808('0xb')),'allowNull':![],'defaultValue':_0x5808('0x9')},'output':{'type':Sequelize[_0x5808('0x5')](_0x5808('0xc'),_0x5808('0xd'),_0x5808('0xe')),'allowNull':![],'defaultValue':_0x5808('0xc')},'type':{'type':Sequelize[_0x5808('0x5')](_0x5808('0xf'),_0x5808('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5808('0x1')]},'cc':{'type':Sequelize[_0x5808('0x11')]},'bcc':{'type':Sequelize[_0x5808('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x5808('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 052d2e6..85d8e0d 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 _0x0ec0=['map','Schedule','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','reject','then','get','Scheduler','UserProfileResource','stack','name','index'];(function(_0x498a86,_0x27d3fb){var _0x16a89e=function(_0x1c2940){while(--_0x1c2940){_0x498a86['push'](_0x498a86['shift']());}};_0x16a89e(++_0x27d3fb);}(_0x0ec0,0x1c9));var _0x00ec=function(_0x34b7a2,_0x1d0571){_0x34b7a2=_0x34b7a2-0x0;var _0x1d9283=_0x0ec0[_0x34b7a2];return _0x1d9283;};'use strict';var pdf=require(_0x00ec('0x0'));var emlformat=require(_0x00ec('0x1'));var rimraf=require(_0x00ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00ec('0x3'));var rp=require(_0x00ec('0x4'));var moment=require(_0x00ec('0x5'));var BPromise=require(_0x00ec('0x6'));var Mustache=require('mustache');var util=require(_0x00ec('0x7'));var path=require(_0x00ec('0x8'));var sox=require(_0x00ec('0x9'));var csv=require('to-csv');var ejs=require(_0x00ec('0xa'));var fs=require('fs');var _=require(_0x00ec('0xb'));var squel=require(_0x00ec('0xc'));var crypto=require(_0x00ec('0xd'));var jsforce=require(_0x00ec('0xe'));var deskjs=require(_0x00ec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x00ec('0x10'));var Papa=require('papaparse');var Redis=require(_0x00ec('0x11'));var authService=require(_0x00ec('0x12'));var qs=require(_0x00ec('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00ec('0x14'));var logger=require(_0x00ec('0x15'))('api');var utils=require(_0x00ec('0x16'));var config=require(_0x00ec('0x17'));var licenseUtil=require(_0x00ec('0x18'));var db=require(_0x00ec('0x19'))['db'];function respondWithStatusCode(_0x1859bf,_0x214697){_0x214697=_0x214697||0xcc;return function(_0x53ccc7){if(_0x53ccc7){return _0x1859bf[_0x00ec('0x1a')](_0x214697);}return _0x1859bf[_0x00ec('0x1b')](_0x214697)[_0x00ec('0x1c')]();};}function respondWithResult(_0x3c944d,_0x2350e8){_0x2350e8=_0x2350e8||0xc8;return function(_0x1576ca){if(_0x1576ca){return _0x3c944d[_0x00ec('0x1b')](_0x2350e8)['json'](_0x1576ca);}};}function respondWithFilteredResult(_0x5230ac,_0x3c3a02){return function(_0x4ceadd){if(_0x4ceadd){var _0x4b0bae=_0x4ceadd['count'],_0x7694a9=_0x3c3a02[_0x00ec('0x1d')],_0x5a5ae1=_0x3c3a02['offset']+_0x3c3a02['limit'],_0x133d1c;if(_0x5a5ae1>=_0x4b0bae){_0x5a5ae1=_0x4b0bae;_0x133d1c=0xc8;}else{_0x133d1c=0xce;}_0x5230ac['status'](_0x133d1c);return _0x5230ac[_0x00ec('0x1e')](_0x00ec('0x1f'),_0x7694a9+'-'+_0x5a5ae1+'/'+_0x4b0bae)[_0x00ec('0x20')](_0x4ceadd);}return null;};}function patchUpdates(_0x467ca8){return function(_0x41bee5){try{jsonpatch['apply'](_0x41bee5,_0x467ca8,!![]);}catch(_0x5ac5ed){return BPromise[_0x00ec('0x21')](_0x5ac5ed);}return _0x41bee5['save']();};}function saveUpdates(_0x21fc1c,_0x2fbf64){return function(_0x2537aa){if(_0x2537aa){return _0x2537aa['update'](_0x21fc1c)[_0x00ec('0x22')](function(_0x719ca8){return _0x719ca8;});}return null;};}function removeEntity(_0x108052,_0x2b3fb2){return function(_0x4a0ef9){if(_0x4a0ef9){return _0x4a0ef9['destroy']()['then'](function(){var _0x1ea6a4=_0x4a0ef9[_0x00ec('0x23')]({'plain':!![]});var _0x3c8873=_0x00ec('0x24');return db[_0x00ec('0x25')]['destroy']({'where':{'type':_0x3c8873,'resourceId':_0x1ea6a4['id']}})[_0x00ec('0x22')](function(){return _0x4a0ef9;});})[_0x00ec('0x22')](function(){_0x108052[_0x00ec('0x1b')](0xcc)[_0x00ec('0x1c')]();});}};}function handleEntityNotFound(_0xc7492d,_0x2977da){return function(_0x1cec4d){if(!_0x1cec4d){_0xc7492d[_0x00ec('0x1a')](0x194);}return _0x1cec4d;};}function handleError(_0xc2cbf1,_0x10cfeb){_0x10cfeb=_0x10cfeb||0x1f4;return function(_0x3c931b){logger['error'](_0x3c931b[_0x00ec('0x26')]);if(_0x3c931b[_0x00ec('0x27')]){delete _0x3c931b[_0x00ec('0x27')];}_0xc2cbf1[_0x00ec('0x1b')](_0x10cfeb)['send'](_0x3c931b);};}exports[_0x00ec('0x28')]=function(_0x4d6f18,_0xd46ba7){var _0x115e53={},_0x5cb9d1={},_0xb6634d={'count':0x0,'rows':[]};var _0x560498=_[_0x00ec('0x29')](db[_0x00ec('0x2a')][_0x00ec('0x2b')],function(_0x68ed0a){return{'name':_0x68ed0a['fieldName'],'type':_0x68ed0a[_0x00ec('0x2c')]['key']};});_0x5cb9d1[_0x00ec('0x2d')]=_[_0x00ec('0x29')](_0x560498,_0x00ec('0x27'));_0x5cb9d1[_0x00ec('0x2e')]=_[_0x00ec('0x2f')](_0x4d6f18[_0x00ec('0x2e')]);_0x5cb9d1[_0x00ec('0x30')]=_[_0x00ec('0x31')](_0x5cb9d1[_0x00ec('0x2d')],_0x5cb9d1[_0x00ec('0x2e')]);_0x115e53[_0x00ec('0x32')]=_[_0x00ec('0x31')](_0x5cb9d1[_0x00ec('0x2d')],qs[_0x00ec('0x33')](_0x4d6f18[_0x00ec('0x2e')]['fields']));_0x115e53[_0x00ec('0x32')]=_0x115e53[_0x00ec('0x32')][_0x00ec('0x34')]?_0x115e53[_0x00ec('0x32')]:_0x5cb9d1['model'];if(!_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x35')](_0x00ec('0x36'))){_0x115e53[_0x00ec('0x37')]=qs[_0x00ec('0x37')](_0x4d6f18[_0x00ec('0x2e')]['limit']);_0x115e53[_0x00ec('0x1d')]=qs[_0x00ec('0x1d')](_0x4d6f18[_0x00ec('0x2e')]['offset']);}_0x115e53['order']=qs['sort'](_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x38')]);_0x115e53[_0x00ec('0x39')]=qs[_0x00ec('0x30')](_[_0x00ec('0x3a')](_0x4d6f18[_0x00ec('0x2e')],_0x5cb9d1[_0x00ec('0x30')]),_0x560498);if(_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x3b')]){_0x115e53[_0x00ec('0x39')]=_['merge'](_0x115e53[_0x00ec('0x39')],{'$or':_[_0x00ec('0x29')](_0x560498,function(_0x3c7fe2){if(_0x3c7fe2[_0x00ec('0x2c')]!==_0x00ec('0x3c')){var _0x4c93cf={};_0x4c93cf[_0x3c7fe2[_0x00ec('0x27')]]={'$like':'%'+_0x4d6f18['query'][_0x00ec('0x3b')]+'%'};return _0x4c93cf;}})});}_0x115e53=_[_0x00ec('0x3d')]({},_0x115e53,_0x4d6f18[_0x00ec('0x3e')]);var _0x316f5e={'where':_0x115e53[_0x00ec('0x39')]};return db[_0x00ec('0x2a')][_0x00ec('0x3f')](_0x316f5e)['then'](function(_0x241ccd){_0xb6634d['count']=_0x241ccd;if(_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x40')]){_0x115e53[_0x00ec('0x41')]=[{'all':!![]}];}return db[_0x00ec('0x2a')]['findAll'](_0x115e53);})[_0x00ec('0x22')](function(_0xb311df){_0xb6634d[_0x00ec('0x42')]=_0xb311df;return _0xb6634d;})[_0x00ec('0x22')](respondWithFilteredResult(_0xd46ba7,_0x115e53))[_0x00ec('0x43')](handleError(_0xd46ba7,null));};exports[_0x00ec('0x44')]=function(_0xed8b37,_0xb06072){var _0x2d9afe={'raw':![],'where':{'id':_0xed8b37['params']['id']}},_0x8f52f3={};_0x8f52f3[_0x00ec('0x2d')]=_[_0x00ec('0x2f')](db['Schedule'][_0x00ec('0x2b')]);_0x8f52f3[_0x00ec('0x2e')]=_[_0x00ec('0x2f')](_0xed8b37['query']);_0x8f52f3[_0x00ec('0x30')]=_[_0x00ec('0x31')](_0x8f52f3[_0x00ec('0x2d')],_0x8f52f3['query']);_0x2d9afe[_0x00ec('0x32')]=_[_0x00ec('0x31')](_0x8f52f3[_0x00ec('0x2d')],qs['fields'](_0xed8b37[_0x00ec('0x2e')][_0x00ec('0x33')]));_0x2d9afe[_0x00ec('0x32')]=_0x2d9afe[_0x00ec('0x32')][_0x00ec('0x34')]?_0x2d9afe[_0x00ec('0x32')]:_0x8f52f3[_0x00ec('0x2d')];if(_0xed8b37[_0x00ec('0x2e')][_0x00ec('0x40')]){_0x2d9afe[_0x00ec('0x41')]=[{'all':!![]}];}_0x2d9afe=_[_0x00ec('0x3d')]({},_0x2d9afe,_0xed8b37[_0x00ec('0x3e')]);return db[_0x00ec('0x2a')]['find'](_0x2d9afe)[_0x00ec('0x22')](handleEntityNotFound(_0xb06072,null))[_0x00ec('0x22')](respondWithResult(_0xb06072,null))[_0x00ec('0x43')](handleError(_0xb06072,null));};exports[_0x00ec('0x45')]=function(_0x208eae,_0x26a8f0){return db['Schedule'][_0x00ec('0x45')](_0x208eae[_0x00ec('0x46')],{})['then'](function(_0x386f2f){var _0x456fd0=_0x208eae[_0x00ec('0x47')][_0x00ec('0x23')]({'plain':!![]});if(!_0x456fd0)throw new Error(_0x00ec('0x48'));if(_0x456fd0[_0x00ec('0x49')]===_0x00ec('0x47')){var _0x3f7f1=_0x386f2f[_0x00ec('0x23')]({'plain':!![]});var _0x5e34ce='Scheduler';return db[_0x00ec('0x4a')][_0x00ec('0x4b')]({'where':{'name':_0x5e34ce,'userProfileId':_0x456fd0['userProfileId']},'raw':!![]})[_0x00ec('0x22')](function(_0x34b011){if(_0x34b011&&_0x34b011[_0x00ec('0x4c')]===0x0){return db[_0x00ec('0x25')][_0x00ec('0x45')]({'name':_0x3f7f1[_0x00ec('0x27')],'resourceId':_0x3f7f1['id'],'type':_0x34b011[_0x00ec('0x27')],'sectionId':_0x34b011['id']},{})[_0x00ec('0x22')](function(){return _0x386f2f;});}else{return _0x386f2f;}})[_0x00ec('0x43')](function(_0x2af6f1){logger[_0x00ec('0x4d')](_0x00ec('0x4e'),_0x2af6f1);throw _0x2af6f1;});}return _0x386f2f;})[_0x00ec('0x22')](respondWithResult(_0x26a8f0,0xc9))[_0x00ec('0x43')](handleError(_0x26a8f0,null));};exports[_0x00ec('0x4f')]=function(_0x58e98c,_0x39211c){if(_0x58e98c['body']['id']){delete _0x58e98c[_0x00ec('0x46')]['id'];}return db[_0x00ec('0x2a')][_0x00ec('0x4b')]({'where':{'id':_0x58e98c[_0x00ec('0x50')]['id']}})['then'](handleEntityNotFound(_0x39211c,null))[_0x00ec('0x22')](saveUpdates(_0x58e98c['body'],null))[_0x00ec('0x22')](respondWithResult(_0x39211c,null))[_0x00ec('0x43')](handleError(_0x39211c,null));};exports[_0x00ec('0x51')]=function(_0x95b63c,_0x1136bb){return db[_0x00ec('0x2a')][_0x00ec('0x4b')]({'where':{'id':_0x95b63c[_0x00ec('0x50')]['id']}})[_0x00ec('0x22')](handleEntityNotFound(_0x1136bb,null))[_0x00ec('0x22')](removeEntity(_0x1136bb,null))[_0x00ec('0x43')](handleError(_0x1136bb,null));};exports[_0x00ec('0x52')]=function(_0x199595,_0x56cdf0,_0x138be0){var _0x8592fd=require('../../config/schedule');return db[_0x00ec('0x2a')][_0x00ec('0x4b')]({'where':{'id':_0x199595['params']['id']},'raw':!![]})[_0x00ec('0x22')](handleEntityNotFound(_0x56cdf0,null))[_0x00ec('0x22')](function(){_0x8592fd[_0x00ec('0x52')](_0x199595[_0x00ec('0x50')]['id']);})[_0x00ec('0x22')](respondWithStatusCode(_0x56cdf0,null))['catch'](handleError(_0x56cdf0,null));}; \ No newline at end of file +var _0x07f7=['get','Scheduler','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','catch','show','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then'];(function(_0x3e4faa,_0x21ea6b){var _0x3b9f25=function(_0x45da69){while(--_0x45da69){_0x3e4faa['push'](_0x3e4faa['shift']());}};_0x3b9f25(++_0x21ea6b);}(_0x07f7,0x193));var _0x707f=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x07f7[_0x49ca18];return _0x145d54;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x707f('0x0'));var rimraf=require(_0x707f('0x1'));var zipdir=require(_0x707f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x707f('0x3'));var moment=require(_0x707f('0x4'));var BPromise=require(_0x707f('0x5'));var Mustache=require(_0x707f('0x6'));var util=require('util');var path=require(_0x707f('0x7'));var sox=require(_0x707f('0x8'));var csv=require(_0x707f('0x9'));var ejs=require(_0x707f('0xa'));var fs=require('fs');var _=require(_0x707f('0xb'));var squel=require(_0x707f('0xc'));var crypto=require(_0x707f('0xd'));var jsforce=require(_0x707f('0xe'));var deskjs=require(_0x707f('0xf'));var toCsv=require(_0x707f('0x9'));var querystring=require(_0x707f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x707f('0x11'));var qs=require(_0x707f('0x12'));var as=require(_0x707f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x707f('0x14'));var utils=require(_0x707f('0x15'));var config=require(_0x707f('0x16'));var licenseUtil=require(_0x707f('0x17'));var db=require(_0x707f('0x18'))['db'];function respondWithStatusCode(_0x4883fb,_0x3f40fe){_0x3f40fe=_0x3f40fe||0xcc;return function(_0x3dd617){if(_0x3dd617){return _0x4883fb[_0x707f('0x19')](_0x3f40fe);}return _0x4883fb[_0x707f('0x1a')](_0x3f40fe)[_0x707f('0x1b')]();};}function respondWithResult(_0xbfc463,_0x4e88ef){_0x4e88ef=_0x4e88ef||0xc8;return function(_0x568def){if(_0x568def){return _0xbfc463['status'](_0x4e88ef)['json'](_0x568def);}};}function respondWithFilteredResult(_0x321927,_0x33ec23){return function(_0x1ca6f6){if(_0x1ca6f6){var _0x2dc71a=_0x1ca6f6[_0x707f('0x1c')],_0x1bbf5e=_0x33ec23[_0x707f('0x1d')],_0x21e840=_0x33ec23[_0x707f('0x1d')]+_0x33ec23['limit'],_0x4a2504;if(_0x21e840>=_0x2dc71a){_0x21e840=_0x2dc71a;_0x4a2504=0xc8;}else{_0x4a2504=0xce;}_0x321927['status'](_0x4a2504);return _0x321927[_0x707f('0x1e')](_0x707f('0x1f'),_0x1bbf5e+'-'+_0x21e840+'/'+_0x2dc71a)[_0x707f('0x20')](_0x1ca6f6);}return null;};}function patchUpdates(_0x5559ea){return function(_0x30e0c1){try{jsonpatch[_0x707f('0x21')](_0x30e0c1,_0x5559ea,!![]);}catch(_0x3b2f9d){return BPromise[_0x707f('0x22')](_0x3b2f9d);}return _0x30e0c1[_0x707f('0x23')]();};}function saveUpdates(_0x51c382,_0x1b1512){return function(_0x525dec){if(_0x525dec){return _0x525dec['update'](_0x51c382)[_0x707f('0x24')](function(_0x41cbc2){return _0x41cbc2;});}return null;};}function removeEntity(_0x185069,_0x1aa026){return function(_0x5481c0){if(_0x5481c0){return _0x5481c0['destroy']()[_0x707f('0x24')](function(){var _0x296fb7=_0x5481c0[_0x707f('0x25')]({'plain':!![]});var _0x3209c0=_0x707f('0x26');return db['UserProfileResource'][_0x707f('0x27')]({'where':{'type':_0x3209c0,'resourceId':_0x296fb7['id']}})['then'](function(){return _0x5481c0;});})['then'](function(){_0x185069[_0x707f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3fda,_0x51f023){return function(_0x132dc7){if(!_0x132dc7){_0x2e3fda['sendStatus'](0x194);}return _0x132dc7;};}function handleError(_0x247542,_0x3748c8){_0x3748c8=_0x3748c8||0x1f4;return function(_0x1bc538){logger['error'](_0x1bc538[_0x707f('0x28')]);if(_0x1bc538[_0x707f('0x29')]){delete _0x1bc538[_0x707f('0x29')];}_0x247542[_0x707f('0x1a')](_0x3748c8)[_0x707f('0x2a')](_0x1bc538);};}exports[_0x707f('0x2b')]=function(_0x43826f,_0x116234){var _0x4e45d2={},_0x1ac3ed={},_0x201f07={'count':0x0,'rows':[]};var _0x166838=_['map'](db['Schedule'][_0x707f('0x2c')],function(_0x43ec6a){return{'name':_0x43ec6a[_0x707f('0x2d')],'type':_0x43ec6a[_0x707f('0x2e')][_0x707f('0x2f')]};});_0x1ac3ed[_0x707f('0x30')]=_[_0x707f('0x31')](_0x166838,_0x707f('0x29'));_0x1ac3ed[_0x707f('0x32')]=_[_0x707f('0x33')](_0x43826f[_0x707f('0x32')]);_0x1ac3ed[_0x707f('0x34')]=_[_0x707f('0x35')](_0x1ac3ed[_0x707f('0x30')],_0x1ac3ed['query']);_0x4e45d2[_0x707f('0x36')]=_[_0x707f('0x35')](_0x1ac3ed[_0x707f('0x30')],qs[_0x707f('0x37')](_0x43826f[_0x707f('0x32')]['fields']));_0x4e45d2[_0x707f('0x36')]=_0x4e45d2[_0x707f('0x36')][_0x707f('0x38')]?_0x4e45d2[_0x707f('0x36')]:_0x1ac3ed[_0x707f('0x30')];if(!_0x43826f[_0x707f('0x32')][_0x707f('0x39')](_0x707f('0x3a'))){_0x4e45d2['limit']=qs['limit'](_0x43826f[_0x707f('0x32')][_0x707f('0x3b')]);_0x4e45d2[_0x707f('0x1d')]=qs[_0x707f('0x1d')](_0x43826f[_0x707f('0x32')]['offset']);}_0x4e45d2[_0x707f('0x3c')]=qs[_0x707f('0x3d')](_0x43826f[_0x707f('0x32')][_0x707f('0x3d')]);_0x4e45d2[_0x707f('0x3e')]=qs['filters'](_[_0x707f('0x3f')](_0x43826f[_0x707f('0x32')],_0x1ac3ed[_0x707f('0x34')]),_0x166838);if(_0x43826f[_0x707f('0x32')][_0x707f('0x40')]){_0x4e45d2['where']=_[_0x707f('0x41')](_0x4e45d2[_0x707f('0x3e')],{'$or':_[_0x707f('0x31')](_0x166838,function(_0x2c907a){if(_0x2c907a[_0x707f('0x2e')]!==_0x707f('0x42')){var _0x3c660c={};_0x3c660c[_0x2c907a[_0x707f('0x29')]]={'$like':'%'+_0x43826f[_0x707f('0x32')][_0x707f('0x40')]+'%'};return _0x3c660c;}})});}_0x4e45d2=_[_0x707f('0x41')]({},_0x4e45d2,_0x43826f[_0x707f('0x43')]);var _0x2cb0d0={'where':_0x4e45d2[_0x707f('0x3e')]};return db[_0x707f('0x44')][_0x707f('0x1c')](_0x2cb0d0)[_0x707f('0x24')](function(_0x35c87f){_0x201f07[_0x707f('0x1c')]=_0x35c87f;if(_0x43826f[_0x707f('0x32')][_0x707f('0x45')]){_0x4e45d2['include']=[{'all':!![]}];}return db['Schedule']['findAll'](_0x4e45d2);})[_0x707f('0x24')](function(_0x2f7cbf){_0x201f07['rows']=_0x2f7cbf;return _0x201f07;})[_0x707f('0x24')](respondWithFilteredResult(_0x116234,_0x4e45d2))[_0x707f('0x46')](handleError(_0x116234,null));};exports[_0x707f('0x47')]=function(_0x1cf4d1,_0x2abd62){var _0x398a7f={'raw':![],'where':{'id':_0x1cf4d1[_0x707f('0x48')]['id']}},_0x4de916={};_0x4de916[_0x707f('0x30')]=_[_0x707f('0x33')](db['Schedule'][_0x707f('0x2c')]);_0x4de916[_0x707f('0x32')]=_['keys'](_0x1cf4d1['query']);_0x4de916['filters']=_['intersection'](_0x4de916[_0x707f('0x30')],_0x4de916['query']);_0x398a7f[_0x707f('0x36')]=_[_0x707f('0x35')](_0x4de916[_0x707f('0x30')],qs[_0x707f('0x37')](_0x1cf4d1[_0x707f('0x32')][_0x707f('0x37')]));_0x398a7f[_0x707f('0x36')]=_0x398a7f[_0x707f('0x36')]['length']?_0x398a7f['attributes']:_0x4de916[_0x707f('0x30')];if(_0x1cf4d1[_0x707f('0x32')]['includeAll']){_0x398a7f[_0x707f('0x49')]=[{'all':!![]}];}_0x398a7f=_['merge']({},_0x398a7f,_0x1cf4d1[_0x707f('0x43')]);return db['Schedule'][_0x707f('0x4a')](_0x398a7f)[_0x707f('0x24')](handleEntityNotFound(_0x2abd62,null))[_0x707f('0x24')](respondWithResult(_0x2abd62,null))[_0x707f('0x46')](handleError(_0x2abd62,null));};exports[_0x707f('0x4b')]=function(_0x22b330,_0x2322f9){return db[_0x707f('0x44')][_0x707f('0x4b')](_0x22b330['body'],{})[_0x707f('0x24')](function(_0x507284){var _0x5701b8=_0x22b330['user']['get']({'plain':!![]});if(!_0x5701b8)throw new Error(_0x707f('0x4c'));if(_0x5701b8[_0x707f('0x4d')]===_0x707f('0x4e')){var _0x3723eb=_0x507284[_0x707f('0x25')]({'plain':!![]});var _0xb5af52=_0x707f('0x26');return db[_0x707f('0x4f')][_0x707f('0x4a')]({'where':{'name':_0xb5af52,'userProfileId':_0x5701b8[_0x707f('0x50')]},'raw':!![]})[_0x707f('0x24')](function(_0x27fea3){if(_0x27fea3&&_0x27fea3[_0x707f('0x51')]===0x0){return db[_0x707f('0x52')][_0x707f('0x4b')]({'name':_0x3723eb[_0x707f('0x29')],'resourceId':_0x3723eb['id'],'type':_0x27fea3[_0x707f('0x29')],'sectionId':_0x27fea3['id']},{})[_0x707f('0x24')](function(){return _0x507284;});}else{return _0x507284;}})['catch'](function(_0x53cb02){logger[_0x707f('0x53')](_0x707f('0x54'),_0x53cb02);throw _0x53cb02;});}return _0x507284;})[_0x707f('0x24')](respondWithResult(_0x2322f9,0xc9))[_0x707f('0x46')](handleError(_0x2322f9,null));};exports['update']=function(_0x374bcd,_0x8b2854){if(_0x374bcd['body']['id']){delete _0x374bcd[_0x707f('0x55')]['id'];}return db[_0x707f('0x44')][_0x707f('0x4a')]({'where':{'id':_0x374bcd[_0x707f('0x48')]['id']}})['then'](handleEntityNotFound(_0x8b2854,null))[_0x707f('0x24')](saveUpdates(_0x374bcd['body'],null))[_0x707f('0x24')](respondWithResult(_0x8b2854,null))[_0x707f('0x46')](handleError(_0x8b2854,null));};exports['destroy']=function(_0x2721be,_0x271c9c){return db[_0x707f('0x44')]['find']({'where':{'id':_0x2721be[_0x707f('0x48')]['id']}})[_0x707f('0x24')](handleEntityNotFound(_0x271c9c,null))[_0x707f('0x24')](removeEntity(_0x271c9c,null))[_0x707f('0x46')](handleError(_0x271c9c,null));};exports[_0x707f('0x56')]=function(_0x4c1f8d,_0x2adb03,_0x19b9ed){var _0x554f88=require(_0x707f('0x57'));return db[_0x707f('0x44')][_0x707f('0x4a')]({'where':{'id':_0x4c1f8d[_0x707f('0x48')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2adb03,null))['then'](function(){_0x554f88[_0x707f('0x56')](_0x4c1f8d[_0x707f('0x48')]['id']);})[_0x707f('0x24')](respondWithStatusCode(_0x2adb03,null))[_0x707f('0x46')](handleError(_0x2adb03,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a8c0678..d0b11a4 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 _0xcb2d=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xcb2d,0x1a0));var _0xdcb2=function(_0xcc7039,_0x5a3274){_0xcc7039=_0xcc7039-0x0;var _0x4e308a=_0xcb2d[_0xcc7039];return _0x4e308a;};'use strict';var _=require(_0xdcb2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdcb2('0x1'));var moment=require(_0xdcb2('0x2'));var BPromise=require(_0xdcb2('0x3'));var rp=require(_0xdcb2('0x4'));var fs=require('fs');var path=require(_0xdcb2('0x5'));var rimraf=require(_0xdcb2('0x6'));var config=require(_0xdcb2('0x7'));var attributes=require(_0xdcb2('0x8'));module[_0xdcb2('0x9')]=function(_0x385c06,_0x26aee7){return _0x385c06[_0xdcb2('0xa')](_0xdcb2('0xb'),attributes,{'tableName':_0xdcb2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb48c=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./schedule.attributes','Schedule','tools_schedules'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xb48c,0x190));var _0xcb48=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb48c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var logger=require(_0xcb48('0x2'))(_0xcb48('0x3'));var moment=require(_0xcb48('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb48('0x5'));var config=require(_0xcb48('0x6'));var attributes=require(_0xcb48('0x7'));module['exports']=function(_0x47d763,_0x12f448){return _0x47d763['define'](_0xcb48('0x8'),attributes,{'tableName':_0xcb48('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 215114c..feb1428 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 _0x7ad6=['debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','Schedule,\x20%s,\x20%s'];(function(_0x205489,_0x36bc54){var _0x5da094=function(_0x4faae3){while(--_0x4faae3){_0x205489['push'](_0x205489['shift']());}};_0x5da094(++_0x36bc54);}(_0x7ad6,0x158));var _0x67ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7ad6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x67ad('0x0'));var moment=require(_0x67ad('0x1'));var BPromise=require(_0x67ad('0x2'));var rs=require(_0x67ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67ad('0x4'))['db'];var utils=require(_0x67ad('0x5'));var logger=require('../../config/logger')(_0x67ad('0x6'));var config=require(_0x67ad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x67ad('0x8')][_0x67ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19562b,_0x5892bc,_0x21a1d3){return new BPromise(function(_0x2997ee,_0xf7de77){return client['request'](_0x19562b,_0x21a1d3)[_0x67ad('0xa')](function(_0x1a5230){logger[_0x67ad('0xb')](_0x67ad('0xc'),_0x5892bc,'request\x20sent');logger[_0x67ad('0xd')](_0x67ad('0xe'),_0x5892bc,_0x67ad('0xf'),JSON[_0x67ad('0x10')](_0x1a5230));if(_0x1a5230[_0x67ad('0x11')]){if(_0x1a5230[_0x67ad('0x11')]['code']===0x1f4){logger[_0x67ad('0x11')](_0x67ad('0xc'),_0x5892bc,_0x1a5230['error'][_0x67ad('0x12')]);return _0xf7de77(_0x1a5230[_0x67ad('0x11')]['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x5892bc,_0x1a5230[_0x67ad('0x11')]['message']);return _0x2997ee(_0x1a5230[_0x67ad('0x11')][_0x67ad('0x12')]);}else{logger[_0x67ad('0xb')](_0x67ad('0xc'),_0x5892bc,_0x67ad('0xf'));_0x2997ee(_0x1a5230[_0x67ad('0x13')][_0x67ad('0x12')]);}})[_0x67ad('0x14')](function(_0x47c5b7){logger['error'](_0x67ad('0xc'),_0x5892bc,_0x47c5b7);_0xf7de77(_0x47c5b7);});});} \ No newline at end of file +var _0x34c9=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x349116,_0x45173){var _0xf585c3=function(_0x5e15b3){while(--_0x5e15b3){_0x349116['push'](_0x349116['shift']());}};_0xf585c3(++_0x45173);}(_0x34c9,0x177));var _0x934c=function(_0x1e8a01,_0x3b0fa2){_0x1e8a01=_0x1e8a01-0x0;var _0x3497d9=_0x34c9[_0x1e8a01];return _0x3497d9;};'use strict';var _=require('lodash');var util=require(_0x934c('0x0'));var moment=require(_0x934c('0x1'));var BPromise=require(_0x934c('0x2'));var rs=require(_0x934c('0x3'));var fs=require('fs');var Redis=require(_0x934c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x934c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x934c('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31ee53,_0x119bd1,_0x37863b){return new BPromise(function(_0x1db30a,_0x3831e8){return client[_0x934c('0x7')](_0x31ee53,_0x37863b)[_0x934c('0x8')](function(_0x5e74a5){logger[_0x934c('0x9')](_0x934c('0xa'),_0x119bd1,_0x934c('0xb'));logger[_0x934c('0xc')](_0x934c('0xd'),_0x119bd1,_0x934c('0xb'),JSON['stringify'](_0x5e74a5));if(_0x5e74a5[_0x934c('0xe')]){if(_0x5e74a5['error']['code']===0x1f4){logger[_0x934c('0xe')](_0x934c('0xa'),_0x119bd1,_0x5e74a5[_0x934c('0xe')]['message']);return _0x3831e8(_0x5e74a5[_0x934c('0xe')]['message']);}logger[_0x934c('0xe')]('Schedule,\x20%s,\x20%s',_0x119bd1,_0x5e74a5[_0x934c('0xe')][_0x934c('0xf')]);return _0x1db30a(_0x5e74a5[_0x934c('0xe')][_0x934c('0xf')]);}else{logger[_0x934c('0x9')](_0x934c('0xa'),_0x119bd1,'request\x20sent');_0x1db30a(_0x5e74a5['result']['message']);}})[_0x934c('0x10')](function(_0xcd3dbb){logger['error'](_0x934c('0xa'),_0x119bd1,_0xcd3dbb);_0x3831e8(_0xcd3dbb);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 82ef041..aa63c1d 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 _0x5d20=['update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','create','put'];(function(_0x17e099,_0x2a46ac){var _0x3719dc=function(_0x4cf4fa){while(--_0x4cf4fa){_0x17e099['push'](_0x17e099['shift']());}};_0x3719dc(++_0x2a46ac);}(_0x5d20,0xb7));var _0x05d2=function(_0x2e77c3,_0x3181d2){_0x2e77c3=_0x2e77c3-0x0;var _0x5c9031=_0x5d20[_0x2e77c3];return _0x5c9031;};'use strict';var multer=require(_0x05d2('0x0'));var util=require(_0x05d2('0x1'));var path=require(_0x05d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x05d2('0x3'));var router=express[_0x05d2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x05d2('0x5'));var config=require(_0x05d2('0x6'));var controller=require('./screenRecording.controller');router[_0x05d2('0x7')]('/',auth[_0x05d2('0x8')](),controller['index']);router[_0x05d2('0x7')](_0x05d2('0x9'),auth['isAuthenticated'](),controller[_0x05d2('0xa')]);router[_0x05d2('0x7')](_0x05d2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x05d2('0x7')](_0x05d2('0xc'),auth[_0x05d2('0x8')](),controller[_0x05d2('0xd')]);router[_0x05d2('0xe')]('/',auth[_0x05d2('0x8')](),controller[_0x05d2('0xf')]);router[_0x05d2('0x10')](_0x05d2('0xb'),auth['isAuthenticated'](),controller[_0x05d2('0x11')]);router['delete'](_0x05d2('0xb'),auth[_0x05d2('0x8')](),controller[_0x05d2('0x12')]);module[_0x05d2('0x13')]=router; \ No newline at end of file +var _0x9bbf=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','exports','multer','util'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x9bbf,0xf8));var _0xf9bb=function(_0x4882d2,_0x11d8af){_0x4882d2=_0x4882d2-0x0;var _0x22c366=_0x9bbf[_0x4882d2];return _0x22c366;};'use strict';var multer=require(_0xf9bb('0x0'));var util=require(_0xf9bb('0x1'));var path=require(_0xf9bb('0x2'));var timeout=require(_0xf9bb('0x3'));var express=require(_0xf9bb('0x4'));var router=express[_0xf9bb('0x5')]();var auth=require(_0xf9bb('0x6'));var interaction=require(_0xf9bb('0x7'));var config=require(_0xf9bb('0x8'));var controller=require(_0xf9bb('0x9'));router[_0xf9bb('0xa')]('/',auth[_0xf9bb('0xb')](),controller[_0xf9bb('0xc')]);router['get'](_0xf9bb('0xd'),auth['isAuthenticated'](),controller[_0xf9bb('0xe')]);router[_0xf9bb('0xa')](_0xf9bb('0xf'),auth[_0xf9bb('0xb')](),controller[_0xf9bb('0x10')]);router[_0xf9bb('0xa')](_0xf9bb('0x11'),auth[_0xf9bb('0xb')](),controller[_0xf9bb('0x12')]);router[_0xf9bb('0x13')]('/',auth[_0xf9bb('0xb')](),controller[_0xf9bb('0x14')]);router[_0xf9bb('0x15')](_0xf9bb('0xf'),auth[_0xf9bb('0xb')](),controller[_0xf9bb('0x16')]);router[_0xf9bb('0x17')](_0xf9bb('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf9bb('0x18')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 130af07..0ac8557 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 _0xee14=['extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','VIRTUAL','getDataValue','value'];(function(_0x10df85,_0x12bcdd){var _0x680fc=function(_0x292b01){while(--_0x292b01){_0x10df85['push'](_0x10df85['shift']());}};_0x680fc(++_0x12bcdd);}(_0xee14,0x13a));var _0x4ee1=function(_0x5c565c,_0x55fc8d){_0x5c565c=_0x5c565c-0x0;var _0x389886=_0xee14[_0x5c565c];return _0x389886;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x4ee1('0x0'));var config=require(_0x4ee1('0x1'));module[_0x4ee1('0x2')]={'format':{'type':Sequelize[_0x4ee1('0x3')],'get':function(){return this[_0x4ee1('0x4')](_0x4ee1('0x5'))?path[_0x4ee1('0x6')](this[_0x4ee1('0x4')](_0x4ee1('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4ee1('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x327c18){var _0x3a45a3=_0x327c18[_0x4ee1('0x8')](/\\/g,'/');this[_0x4ee1('0x9')](_0x4ee1('0x5'),_0x3a45a3);}},'rating':{'type':Sequelize[_0x4ee1('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x33dbe6){this[_0x4ee1('0x9')]('startedAt',moment()[_0x4ee1('0xb')](_0x33dbe6,'ms'));this[_0x4ee1('0x9')](_0x4ee1('0xc'),moment());this[_0x4ee1('0x9')]('duration',_0x33dbe6);}},'startedAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0xe')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0xc')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}},'createdAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0x12')))[_0x4ee1('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4ee1('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0x13')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}}}; \ No newline at end of file +var _0x6aa7=['../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','format','updatedAt','toString','sequelize','path'];(function(_0x1d8a29,_0x20d465){var _0x2a94b7=function(_0x21daf8){while(--_0x21daf8){_0x1d8a29['push'](_0x1d8a29['shift']());}};_0x2a94b7(++_0x20d465);}(_0x6aa7,0x178));var _0x76aa=function(_0x32f11e,_0x1507a9){_0x32f11e=_0x32f11e-0x0;var _0x55139b=_0x6aa7[_0x32f11e];return _0x55139b;};'use strict';var Sequelize=require(_0x76aa('0x0'));var moment=require('moment');var path=require(_0x76aa('0x1'));var config=require(_0x76aa('0x2'));module[_0x76aa('0x3')]={'format':{'type':Sequelize[_0x76aa('0x4')],'get':function(){return this['getDataValue'](_0x76aa('0x5'))?path[_0x76aa('0x6')](this[_0x76aa('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x76aa('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x32dee5){var _0x36d12b=_0x32dee5[_0x76aa('0x9')](/\\/g,'/');this['setDataValue'](_0x76aa('0x5'),_0x36d12b);}},'rating':{'type':Sequelize[_0x76aa('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x76aa('0xa')],'set':function(_0x557d69){this[_0x76aa('0xb')](_0x76aa('0xc'),moment()[_0x76aa('0xd')](_0x557d69,'ms'));this[_0x76aa('0xb')](_0x76aa('0xe'),moment());this[_0x76aa('0xb')](_0x76aa('0xf'),_0x557d69);}},'startedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this[_0x76aa('0x7')](_0x76aa('0xc')))['format'](_0x76aa('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this[_0x76aa('0x7')](_0x76aa('0xe')))[_0x76aa('0x12')](_0x76aa('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x76aa('0x7')]('createdAt'))[_0x76aa('0x12')](_0x76aa('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this['getDataValue'](_0x76aa('0x13')))['format'](_0x76aa('0x11'))[_0x76aa('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1fac132..d122dc2 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 _0x9111=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','then','destroy','end','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','unlink','message','Not\x20found','Entity\x20not\x20found','join','server/files/screen_recordings','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x2b490d,_0x50c391){var _0x459a4c=function(_0x5f240f){while(--_0x5f240f){_0x2b490d['push'](_0x2b490d['shift']());}};_0x459a4c(++_0x50c391);}(_0x9111,0xb9));var _0x1911=function(_0x3688dd,_0x3830b7){_0x3688dd=_0x3688dd-0x0;var _0x13df2c=_0x9111[_0x3688dd];return _0x13df2c;};'use strict';var pdf=require(_0x1911('0x0'));var emlformat=require(_0x1911('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1911('0x2'));var jsonpatch=require(_0x1911('0x3'));var rp=require(_0x1911('0x4'));var moment=require('moment');var BPromise=require(_0x1911('0x5'));var Mustache=require(_0x1911('0x6'));var util=require(_0x1911('0x7'));var path=require(_0x1911('0x8'));var sox=require(_0x1911('0x9'));var csv=require(_0x1911('0xa'));var ejs=require(_0x1911('0xb'));var fs=require('fs');var _=require(_0x1911('0xc'));var squel=require('squel');var crypto=require(_0x1911('0xd'));var jsforce=require(_0x1911('0xe'));var deskjs=require(_0x1911('0xf'));var toCsv=require(_0x1911('0xa'));var querystring=require(_0x1911('0x10'));var Papa=require(_0x1911('0x11'));var Redis=require(_0x1911('0x12'));var authService=require(_0x1911('0x13'));var qs=require(_0x1911('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1911('0x15'));var logger=require(_0x1911('0x16'))(_0x1911('0x17'));var utils=require(_0x1911('0x18'));var config=require(_0x1911('0x19'));var licenseUtil=require(_0x1911('0x1a'));var db=require(_0x1911('0x1b'))['db'];function respondWithStatusCode(_0x3fe786,_0x301c6d){_0x301c6d=_0x301c6d||0xcc;return function(_0x41db8c){if(_0x41db8c){return _0x3fe786[_0x1911('0x1c')](_0x301c6d);}return _0x3fe786[_0x1911('0x1d')](_0x301c6d)['end']();};}function respondWithResult(_0x50daff,_0xcb2425){_0xcb2425=_0xcb2425||0xc8;return function(_0x30b479){if(_0x30b479){return _0x50daff[_0x1911('0x1d')](_0xcb2425)[_0x1911('0x1e')](_0x30b479);}};}function respondWithFilteredResult(_0x37b5a3,_0x187d41){return function(_0x20607a){if(_0x20607a){var _0x2835bc=_0x20607a[_0x1911('0x1f')],_0x2cadae=_0x187d41[_0x1911('0x20')],_0x468adf=_0x187d41[_0x1911('0x20')]+_0x187d41[_0x1911('0x21')],_0x22ecab;if(_0x468adf>=_0x2835bc){_0x468adf=_0x2835bc;_0x22ecab=0xc8;}else{_0x22ecab=0xce;}_0x37b5a3[_0x1911('0x1d')](_0x22ecab);return _0x37b5a3[_0x1911('0x22')]('Content-Range',_0x2cadae+'-'+_0x468adf+'/'+_0x2835bc)[_0x1911('0x1e')](_0x20607a);}return null;};}function patchUpdates(_0x897d5){return function(_0x37f24b){try{jsonpatch['apply'](_0x37f24b,_0x897d5,!![]);}catch(_0x7b988a){return BPromise[_0x1911('0x23')](_0x7b988a);}return _0x37f24b['save']();};}function saveUpdates(_0x5740d6,_0x43bd4e){return function(_0x5d189e){if(_0x5d189e){return _0x5d189e[_0x1911('0x24')](_0x5740d6)[_0x1911('0x25')](function(_0x3f7ce2){return _0x3f7ce2;});}return null;};}function removeEntity(_0x2b82c5,_0x18bf36){return function(_0x319926){if(_0x319926){return _0x319926[_0x1911('0x26')]()[_0x1911('0x25')](function(){_0x2b82c5[_0x1911('0x1d')](0xcc)[_0x1911('0x27')]();});}};}function handleEntityNotFound(_0x1c8d6c,_0xd0e782){return function(_0x4c8940){if(!_0x4c8940){_0x1c8d6c[_0x1911('0x1c')](0x194);}return _0x4c8940;};}function handleError(_0x26f0ff,_0x405002){_0x405002=_0x405002||0x1f4;return function(_0x139175){logger['error'](_0x139175[_0x1911('0x28')]);if(_0x139175[_0x1911('0x29')]){delete _0x139175[_0x1911('0x29')];}_0x26f0ff[_0x1911('0x1d')](_0x405002)[_0x1911('0x2a')](_0x139175);};}exports['index']=function(_0x7778f9,_0x2a8357){var _0x2d776e={},_0x22e502={},_0x5e2f85={'count':0x0,'rows':[]};var _0x1f4363=_[_0x1911('0x2b')](db[_0x1911('0x2c')]['rawAttributes'],function(_0x525a28){return{'name':_0x525a28['fieldName'],'type':_0x525a28[_0x1911('0x2d')][_0x1911('0x2e')]};});_0x22e502[_0x1911('0x2f')]=_[_0x1911('0x30')](_[_0x1911('0x2b')](_0x1f4363,_0x1911('0x29')),[_0x1911('0x31')]);_0x22e502['query']=_[_0x1911('0x32')](_0x7778f9[_0x1911('0x33')]);_0x22e502['filters']=_[_0x1911('0x34')](_0x22e502['model'],_0x22e502[_0x1911('0x33')]);_0x2d776e[_0x1911('0x35')]=_[_0x1911('0x34')](_0x22e502[_0x1911('0x2f')],qs[_0x1911('0x36')](_0x7778f9[_0x1911('0x33')][_0x1911('0x36')]));_0x2d776e[_0x1911('0x35')]=_0x2d776e[_0x1911('0x35')][_0x1911('0x37')]?_0x2d776e[_0x1911('0x35')]:_0x22e502[_0x1911('0x2f')];if(!_0x7778f9[_0x1911('0x33')][_0x1911('0x38')](_0x1911('0x39'))){_0x2d776e['limit']=qs[_0x1911('0x21')](_0x7778f9[_0x1911('0x33')][_0x1911('0x21')]);_0x2d776e['offset']=qs[_0x1911('0x20')](_0x7778f9['query'][_0x1911('0x20')]);}_0x2d776e[_0x1911('0x3a')]=qs[_0x1911('0x3b')](_0x7778f9[_0x1911('0x33')][_0x1911('0x3b')]);_0x2d776e[_0x1911('0x3c')]=qs[_0x1911('0x3d')](_['pick'](_0x7778f9[_0x1911('0x33')],_0x22e502[_0x1911('0x3d')]),_0x1f4363);if(_0x7778f9[_0x1911('0x33')][_0x1911('0x3e')]){_0x2d776e[_0x1911('0x3c')]=_[_0x1911('0x3f')](_0x2d776e[_0x1911('0x3c')],{'$or':_[_0x1911('0x2b')](_0x1f4363,function(_0x18c14a){if(_0x18c14a['type']!==_0x1911('0x40')){var _0xa69034={};_0xa69034[_0x18c14a[_0x1911('0x29')]]={'$like':'%'+_0x7778f9['query'][_0x1911('0x3e')]+'%'};return _0xa69034;}})});}_0x2d776e=_[_0x1911('0x3f')]({},_0x2d776e,_0x7778f9[_0x1911('0x41')]);var _0x1d3454={'where':_0x2d776e[_0x1911('0x3c')]};return db[_0x1911('0x2c')][_0x1911('0x1f')](_0x1d3454)['then'](function(_0x51f91e){_0x5e2f85[_0x1911('0x1f')]=_0x51f91e;if(_0x7778f9[_0x1911('0x33')]['includeAll']){_0x2d776e[_0x1911('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x1911('0x43')](_0x2d776e);})[_0x1911('0x25')](function(_0x509faa){_0x5e2f85['rows']=_0x509faa;return _0x5e2f85;})[_0x1911('0x25')](respondWithFilteredResult(_0x2a8357,_0x2d776e))[_0x1911('0x44')](handleError(_0x2a8357,null));};exports['show']=function(_0x82269f,_0x1e2047){var _0x4b47b5={'raw':![],'where':{'id':_0x82269f[_0x1911('0x45')]['id']}},_0x3afdb5={};_0x3afdb5[_0x1911('0x2f')]=_[_0x1911('0x32')](db['ScreenRecording']['rawAttributes']);_0x3afdb5['query']=_['keys'](_0x82269f[_0x1911('0x33')]);_0x3afdb5[_0x1911('0x3d')]=_[_0x1911('0x34')](_0x3afdb5[_0x1911('0x2f')],_0x3afdb5[_0x1911('0x33')]);_0x4b47b5[_0x1911('0x35')]=_['intersection'](_0x3afdb5['model'],qs[_0x1911('0x36')](_0x82269f[_0x1911('0x33')][_0x1911('0x36')]));_0x4b47b5[_0x1911('0x35')]=_0x4b47b5[_0x1911('0x35')][_0x1911('0x37')]?_0x4b47b5['attributes']:_0x3afdb5[_0x1911('0x2f')];if(_0x82269f[_0x1911('0x33')][_0x1911('0x46')]){_0x4b47b5['include']=[{'all':!![]}];}_0x4b47b5=_[_0x1911('0x3f')]({},_0x4b47b5,_0x82269f[_0x1911('0x41')]);return db['ScreenRecording'][_0x1911('0x47')](_0x4b47b5)['then'](handleEntityNotFound(_0x1e2047,null))['then'](respondWithResult(_0x1e2047,null))[_0x1911('0x44')](handleError(_0x1e2047,null));};exports[_0x1911('0x48')]=function(_0x3896b5,_0x5c4691){return db[_0x1911('0x2c')][_0x1911('0x48')](_0x3896b5[_0x1911('0x49')],{})[_0x1911('0x25')](respondWithResult(_0x5c4691,0xc9))[_0x1911('0x44')](handleError(_0x5c4691,null));};exports[_0x1911('0x24')]=function(_0x3b7d4d,_0x2a353f){if(_0x3b7d4d[_0x1911('0x49')]['id']){delete _0x3b7d4d[_0x1911('0x49')]['id'];}delete _0x3b7d4d[_0x1911('0x49')]['duration'];delete _0x3b7d4d[_0x1911('0x49')]['createdAt'];delete _0x3b7d4d[_0x1911('0x49')][_0x1911('0x4a')];delete _0x3b7d4d[_0x1911('0x49')][_0x1911('0x4b')];return db['ScreenRecording'][_0x1911('0x47')]({'where':{'id':_0x3b7d4d['params']['id']}})[_0x1911('0x25')](handleEntityNotFound(_0x2a353f,null))[_0x1911('0x25')](saveUpdates(_0x3b7d4d[_0x1911('0x49')],null))[_0x1911('0x25')](respondWithResult(_0x2a353f,null))[_0x1911('0x44')](handleError(_0x2a353f,null));};exports[_0x1911('0x4c')]=function(_0x56a333,_0x408be2){return db[_0x1911('0x2c')][_0x1911('0x4c')]()[_0x1911('0x25')](respondWithResult(_0x408be2,null))[_0x1911('0x44')](handleError(_0x408be2,null));};exports[_0x1911('0x4d')]=function(_0x4b85d8,_0x1f93ee,_0xe83ab0){var _0x3479fb=require(_0x1911('0x4e'));var _0x517608=![];var _0x4e437b={};if(_0x4b85d8['query']['type']&&_0x4b85d8[_0x1911('0x33')][_0x1911('0x2d')]===_0x1911('0x4f')){_0x4e437b[_0x1911('0x4f')]=_0x4b85d8[_0x1911('0x45')]['id'];}else{_0x4e437b['id']=_0x4b85d8[_0x1911('0x45')]['id'];}return db[_0x1911('0x2c')][_0x1911('0x47')]({'where':_0x4e437b,'attributes':['id',_0x1911('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x1f93ee,null))[_0x1911('0x25')](function(_0x433c18){if(_0x433c18){var _0x1f6e13=path['join'](config[_0x1911('0x50')],'server/files/screen_recordings',_0x433c18[_0x1911('0x4b')]);var _0x59a416=util[_0x1911('0x31')]('%s.cypher',_0x1f6e13);if(fs[_0x1911('0x51')](_0x59a416)){_0x517608=!![];return _0x3479fb[_0x1911('0x52')](_0x59a416,_0x1f6e13,config[_0x1911('0x53')][_0x1911('0x54')])[_0x1911('0x25')](function(){return _0x433c18;});}return _0x433c18;}})[_0x1911('0x25')](function(_0x42bac1){if(_0x42bac1){var _0x1a1059=path['join'](config[_0x1911('0x50')],'server/files/screen_recordings',_0x42bac1['value']);if(!fs[_0x1911('0x51')](_0x1a1059)){throw new db[(_0x1911('0x55'))][(_0x1911('0x56'))](_0x1911('0x57'));}if(_0x42bac1['filename']){return _0x1f93ee[_0x1911('0x4d')](_0x1a1059,_0x42bac1['filename']+path['extname'](_0x1a1059),function(){if(_0x517608){fs[_0x1911('0x58')](_0x1a1059);}});}else{return _0x1f93ee[_0x1911('0x4d')](_0x1a1059,function(_0x2fcad9){if(_0x517608){fs[_0x1911('0x58')](_0x1a1059);}});}}})[_0x1911('0x44')](function(_0x35545a){if(_0x35545a[_0x1911('0x59')]===_0x1911('0x57')){_0x1f93ee[_0x1911('0x1d')](0x194)[_0x1911('0x2a')](_0x1911('0x5a'));}else{return handleError(_0x1f93ee,null);}});};exports[_0x1911('0x26')]=function(_0x58b48b,_0x43f952){return db[_0x1911('0x2c')]['find']({'where':{'id':_0x58b48b[_0x1911('0x45')]['id']}})['then'](function(_0x50b879){if(!_0x50b879)throw new ReferenceError(_0x1911('0x5b'));return _0x50b879;})[_0x1911('0x25')](function(_0x2d405c){var _0x2e50a5=path[_0x1911('0x5c')](config[_0x1911('0x50')],_0x1911('0x5d'),_0x2d405c[_0x1911('0x4b')]);logger[_0x1911('0x5e')](_0x1911('0x5f'),_0x2e50a5);if(!_['isNil'](_0x2d405c[_0x1911('0x4b')])&&fs[_0x1911('0x51')](_0x2e50a5)){logger[_0x1911('0x5e')](_0x1911('0x60')+_0x2e50a5+_0x1911('0x61'));fs[_0x1911('0x62')](_0x2e50a5);}_0x2e50a5=_0x2e50a5+_0x1911('0x63');if(!_['isNil'](_0x2d405c[_0x1911('0x4b')])&&fs[_0x1911('0x51')](_0x2e50a5)){logger[_0x1911('0x5e')]('File:\x20\x22'+_0x2e50a5+_0x1911('0x61'));fs[_0x1911('0x62')](_0x2e50a5);}return _0x2d405c;})[_0x1911('0x25')](function(_0x2ad9af){if(!_0x2ad9af)throw new InternalError();return _0x2ad9af[_0x1911('0x26')]();})[_0x1911('0x25')](function(){_0x43f952[_0x1911('0x1d')](0xcc)[_0x1911('0x27')]();})[_0x1911('0x44')](handleError(_0x43f952,null));}; \ No newline at end of file +var _0xf17b=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','ScreenRecording','type','key','model','differenceBy','map','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','merge','count','includeAll','include','findAll','rows','show','params','keys','fields','options','catch','create','body','duration','createdAt','closedAt','find','describe','download','uniqueid','value','join','root','format','%s.cypher','decryptFile','secrets','server/files/screen_recordings','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x3d5c83,_0x3fb19c){var _0x4945d5=function(_0x139b5d){while(--_0x139b5d){_0x3d5c83['push'](_0x3d5c83['shift']());}};_0x4945d5(++_0x3fb19c);}(_0xf17b,0xbb));var _0xbf17=function(_0x4f67e3,_0x32b097){_0x4f67e3=_0x4f67e3-0x0;var _0x5cedc0=_0xf17b[_0x4f67e3];return _0x5cedc0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf17('0x0'));var rimraf=require(_0xbf17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf17('0x2'));var rp=require(_0xbf17('0x3'));var moment=require(_0xbf17('0x4'));var BPromise=require(_0xbf17('0x5'));var Mustache=require(_0xbf17('0x6'));var util=require(_0xbf17('0x7'));var path=require(_0xbf17('0x8'));var sox=require('sox');var csv=require(_0xbf17('0x9'));var ejs=require(_0xbf17('0xa'));var fs=require('fs');var _=require(_0xbf17('0xb'));var squel=require(_0xbf17('0xc'));var crypto=require(_0xbf17('0xd'));var jsforce=require(_0xbf17('0xe'));var deskjs=require(_0xbf17('0xf'));var toCsv=require(_0xbf17('0x9'));var querystring=require('querystring');var Papa=require(_0xbf17('0x10'));var Redis=require(_0xbf17('0x11'));var authService=require(_0xbf17('0x12'));var qs=require(_0xbf17('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf17('0x14'))(_0xbf17('0x15'));var utils=require(_0xbf17('0x16'));var config=require(_0xbf17('0x17'));var licenseUtil=require(_0xbf17('0x18'));var db=require(_0xbf17('0x19'))['db'];function respondWithStatusCode(_0x4ef735,_0x29e73d){_0x29e73d=_0x29e73d||0xcc;return function(_0x139310){if(_0x139310){return _0x4ef735[_0xbf17('0x1a')](_0x29e73d);}return _0x4ef735[_0xbf17('0x1b')](_0x29e73d)['end']();};}function respondWithResult(_0x47587d,_0xea806b){_0xea806b=_0xea806b||0xc8;return function(_0x5e67af){if(_0x5e67af){return _0x47587d['status'](_0xea806b)[_0xbf17('0x1c')](_0x5e67af);}};}function respondWithFilteredResult(_0x3977ad,_0x649e77){return function(_0x54111b){if(_0x54111b){var _0x2241bb=_0x54111b['count'],_0x15f5fd=_0x649e77[_0xbf17('0x1d')],_0x4d1215=_0x649e77[_0xbf17('0x1d')]+_0x649e77[_0xbf17('0x1e')],_0x4c11b2;if(_0x4d1215>=_0x2241bb){_0x4d1215=_0x2241bb;_0x4c11b2=0xc8;}else{_0x4c11b2=0xce;}_0x3977ad[_0xbf17('0x1b')](_0x4c11b2);return _0x3977ad[_0xbf17('0x1f')](_0xbf17('0x20'),_0x15f5fd+'-'+_0x4d1215+'/'+_0x2241bb)[_0xbf17('0x1c')](_0x54111b);}return null;};}function patchUpdates(_0x5b752b){return function(_0x470d6f){try{jsonpatch['apply'](_0x470d6f,_0x5b752b,!![]);}catch(_0x31957a){return BPromise[_0xbf17('0x21')](_0x31957a);}return _0x470d6f[_0xbf17('0x22')]();};}function saveUpdates(_0x15dc67,_0x3ed4ef){return function(_0x6d67c6){if(_0x6d67c6){return _0x6d67c6[_0xbf17('0x23')](_0x15dc67)[_0xbf17('0x24')](function(_0x49366a){return _0x49366a;});}return null;};}function removeEntity(_0x3c2e45,_0x44eb2d){return function(_0x1e47c3){if(_0x1e47c3){return _0x1e47c3[_0xbf17('0x25')]()[_0xbf17('0x24')](function(){_0x3c2e45[_0xbf17('0x1b')](0xcc)[_0xbf17('0x26')]();});}};}function handleEntityNotFound(_0x23ac29,_0x5eb7c2){return function(_0x57bb22){if(!_0x57bb22){_0x23ac29[_0xbf17('0x1a')](0x194);}return _0x57bb22;};}function handleError(_0x42e2f2,_0x33aa56){_0x33aa56=_0x33aa56||0x1f4;return function(_0x3584af){logger[_0xbf17('0x27')](_0x3584af[_0xbf17('0x28')]);if(_0x3584af[_0xbf17('0x29')]){delete _0x3584af[_0xbf17('0x29')];}_0x42e2f2['status'](_0x33aa56)[_0xbf17('0x2a')](_0x3584af);};}exports[_0xbf17('0x2b')]=function(_0x477e52,_0x37d477){var _0x4e09de={},_0x51d031={},_0xd46f6={'count':0x0,'rows':[]};var _0x320d6f=_['map'](db[_0xbf17('0x2c')]['rawAttributes'],function(_0x2b9da6){return{'name':_0x2b9da6['fieldName'],'type':_0x2b9da6[_0xbf17('0x2d')][_0xbf17('0x2e')]};});_0x51d031[_0xbf17('0x2f')]=_[_0xbf17('0x30')](_[_0xbf17('0x31')](_0x320d6f,_0xbf17('0x29')),['format']);_0x51d031[_0xbf17('0x32')]=_['keys'](_0x477e52[_0xbf17('0x32')]);_0x51d031[_0xbf17('0x33')]=_[_0xbf17('0x34')](_0x51d031['model'],_0x51d031[_0xbf17('0x32')]);_0x4e09de[_0xbf17('0x35')]=_[_0xbf17('0x34')](_0x51d031[_0xbf17('0x2f')],qs['fields'](_0x477e52['query']['fields']));_0x4e09de['attributes']=_0x4e09de[_0xbf17('0x35')][_0xbf17('0x36')]?_0x4e09de['attributes']:_0x51d031[_0xbf17('0x2f')];if(!_0x477e52[_0xbf17('0x32')][_0xbf17('0x37')]('nolimit')){_0x4e09de[_0xbf17('0x1e')]=qs[_0xbf17('0x1e')](_0x477e52[_0xbf17('0x32')][_0xbf17('0x1e')]);_0x4e09de[_0xbf17('0x1d')]=qs['offset'](_0x477e52[_0xbf17('0x32')][_0xbf17('0x1d')]);}_0x4e09de[_0xbf17('0x38')]=qs['sort'](_0x477e52[_0xbf17('0x32')][_0xbf17('0x39')]);_0x4e09de[_0xbf17('0x3a')]=qs[_0xbf17('0x33')](_['pick'](_0x477e52[_0xbf17('0x32')],_0x51d031[_0xbf17('0x33')]),_0x320d6f);if(_0x477e52[_0xbf17('0x32')]['filter']){_0x4e09de[_0xbf17('0x3a')]=_[_0xbf17('0x3b')](_0x4e09de[_0xbf17('0x3a')],{'$or':_[_0xbf17('0x31')](_0x320d6f,function(_0x113037){if(_0x113037[_0xbf17('0x2d')]!=='VIRTUAL'){var _0x30808b={};_0x30808b[_0x113037['name']]={'$like':'%'+_0x477e52[_0xbf17('0x32')]['filter']+'%'};return _0x30808b;}})});}_0x4e09de=_[_0xbf17('0x3b')]({},_0x4e09de,_0x477e52['options']);var _0x288786={'where':_0x4e09de[_0xbf17('0x3a')]};return db[_0xbf17('0x2c')]['count'](_0x288786)['then'](function(_0x1cce1b){_0xd46f6[_0xbf17('0x3c')]=_0x1cce1b;if(_0x477e52[_0xbf17('0x32')][_0xbf17('0x3d')]){_0x4e09de[_0xbf17('0x3e')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbf17('0x3f')](_0x4e09de);})['then'](function(_0x711fb2){_0xd46f6[_0xbf17('0x40')]=_0x711fb2;return _0xd46f6;})[_0xbf17('0x24')](respondWithFilteredResult(_0x37d477,_0x4e09de))['catch'](handleError(_0x37d477,null));};exports[_0xbf17('0x41')]=function(_0x51cb33,_0x902577){var _0x4ead4a={'raw':![],'where':{'id':_0x51cb33[_0xbf17('0x42')]['id']}},_0x142131={};_0x142131['model']=_[_0xbf17('0x43')](db[_0xbf17('0x2c')]['rawAttributes']);_0x142131[_0xbf17('0x32')]=_['keys'](_0x51cb33[_0xbf17('0x32')]);_0x142131[_0xbf17('0x33')]=_[_0xbf17('0x34')](_0x142131[_0xbf17('0x2f')],_0x142131['query']);_0x4ead4a['attributes']=_[_0xbf17('0x34')](_0x142131[_0xbf17('0x2f')],qs['fields'](_0x51cb33['query'][_0xbf17('0x44')]));_0x4ead4a[_0xbf17('0x35')]=_0x4ead4a[_0xbf17('0x35')]['length']?_0x4ead4a[_0xbf17('0x35')]:_0x142131['model'];if(_0x51cb33['query'][_0xbf17('0x3d')]){_0x4ead4a[_0xbf17('0x3e')]=[{'all':!![]}];}_0x4ead4a=_[_0xbf17('0x3b')]({},_0x4ead4a,_0x51cb33[_0xbf17('0x45')]);return db[_0xbf17('0x2c')]['find'](_0x4ead4a)[_0xbf17('0x24')](handleEntityNotFound(_0x902577,null))[_0xbf17('0x24')](respondWithResult(_0x902577,null))[_0xbf17('0x46')](handleError(_0x902577,null));};exports[_0xbf17('0x47')]=function(_0x1dea62,_0x31acc6){return db[_0xbf17('0x2c')]['create'](_0x1dea62[_0xbf17('0x48')],{})[_0xbf17('0x24')](respondWithResult(_0x31acc6,0xc9))['catch'](handleError(_0x31acc6,null));};exports[_0xbf17('0x23')]=function(_0x31dd0d,_0x1042f9){if(_0x31dd0d['body']['id']){delete _0x31dd0d[_0xbf17('0x48')]['id'];}delete _0x31dd0d[_0xbf17('0x48')][_0xbf17('0x49')];delete _0x31dd0d[_0xbf17('0x48')][_0xbf17('0x4a')];delete _0x31dd0d[_0xbf17('0x48')][_0xbf17('0x4b')];delete _0x31dd0d[_0xbf17('0x48')]['value'];return db[_0xbf17('0x2c')][_0xbf17('0x4c')]({'where':{'id':_0x31dd0d['params']['id']}})[_0xbf17('0x24')](handleEntityNotFound(_0x1042f9,null))['then'](saveUpdates(_0x31dd0d['body'],null))[_0xbf17('0x24')](respondWithResult(_0x1042f9,null))[_0xbf17('0x46')](handleError(_0x1042f9,null));};exports['describe']=function(_0x1893c6,_0x190fe7){return db[_0xbf17('0x2c')][_0xbf17('0x4d')]()['then'](respondWithResult(_0x190fe7,null))[_0xbf17('0x46')](handleError(_0x190fe7,null));};exports[_0xbf17('0x4e')]=function(_0x5b3582,_0x16d11f,_0x341d61){var _0x546332=require('../../components/encryptor');var _0x42a91d=![];var _0x3aa526={};if(_0x5b3582['query'][_0xbf17('0x2d')]&&_0x5b3582[_0xbf17('0x32')][_0xbf17('0x2d')]===_0xbf17('0x4f')){_0x3aa526[_0xbf17('0x4f')]=_0x5b3582[_0xbf17('0x42')]['id'];}else{_0x3aa526['id']=_0x5b3582[_0xbf17('0x42')]['id'];}return db[_0xbf17('0x2c')][_0xbf17('0x4c')]({'where':_0x3aa526,'attributes':['id',_0xbf17('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x16d11f,null))[_0xbf17('0x24')](function(_0x2f1b4e){if(_0x2f1b4e){var _0x247b3d=path[_0xbf17('0x51')](config[_0xbf17('0x52')],'server/files/screen_recordings',_0x2f1b4e[_0xbf17('0x50')]);var _0x4cce67=util[_0xbf17('0x53')](_0xbf17('0x54'),_0x247b3d);if(fs['existsSync'](_0x4cce67)){_0x42a91d=!![];return _0x546332[_0xbf17('0x55')](_0x4cce67,_0x247b3d,config[_0xbf17('0x56')]['recording'])[_0xbf17('0x24')](function(){return _0x2f1b4e;});}return _0x2f1b4e;}})[_0xbf17('0x24')](function(_0x264f56){if(_0x264f56){var _0x9740b3=path[_0xbf17('0x51')](config[_0xbf17('0x52')],_0xbf17('0x57'),_0x264f56['value']);if(!fs[_0xbf17('0x58')](_0x9740b3)){throw new db[(_0xbf17('0x59'))]['ValidationError'](_0xbf17('0x5a'));}if(_0x264f56[_0xbf17('0x5b')]){return _0x16d11f[_0xbf17('0x4e')](_0x9740b3,_0x264f56[_0xbf17('0x5b')]+path['extname'](_0x9740b3),function(){if(_0x42a91d){fs['unlink'](_0x9740b3);}});}else{return _0x16d11f[_0xbf17('0x4e')](_0x9740b3,function(_0x38bc34){if(_0x42a91d){fs[_0xbf17('0x5c')](_0x9740b3);}});}}})[_0xbf17('0x46')](function(_0x3e7774){if(_0x3e7774[_0xbf17('0x5d')]==='ScreenRecording\x20not\x20found'){_0x16d11f[_0xbf17('0x1b')](0x194)[_0xbf17('0x2a')](_0xbf17('0x5e'));}else{return handleError(_0x16d11f,null);}});};exports['destroy']=function(_0xe95648,_0x1aa8ca){return db[_0xbf17('0x2c')]['find']({'where':{'id':_0xe95648[_0xbf17('0x42')]['id']}})['then'](function(_0xc7f086){if(!_0xc7f086)throw new ReferenceError(_0xbf17('0x5f'));return _0xc7f086;})[_0xbf17('0x24')](function(_0x5cbef9){var _0x1760c8=path[_0xbf17('0x51')](config[_0xbf17('0x52')],_0xbf17('0x57'),_0x5cbef9[_0xbf17('0x50')]);logger[_0xbf17('0x60')](_0xbf17('0x61'),_0x1760c8);if(!_[_0xbf17('0x62')](_0x5cbef9[_0xbf17('0x50')])&&fs['existsSync'](_0x1760c8)){logger[_0xbf17('0x60')](_0xbf17('0x63')+_0x1760c8+_0xbf17('0x64'));fs['unlinkSync'](_0x1760c8);}_0x1760c8=_0x1760c8+_0xbf17('0x65');if(!_[_0xbf17('0x62')](_0x5cbef9[_0xbf17('0x50')])&&fs[_0xbf17('0x58')](_0x1760c8)){logger['info'](_0xbf17('0x63')+_0x1760c8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbf17('0x66')](_0x1760c8);}return _0x5cbef9;})[_0xbf17('0x24')](function(_0x564efc){if(!_0x564efc)throw new InternalError();return _0x564efc[_0xbf17('0x25')]();})[_0xbf17('0x24')](function(){_0x1aa8ca[_0xbf17('0x1b')](0xcc)[_0xbf17('0x26')]();})[_0xbf17('0x46')](handleError(_0x1aa8ca,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 04d5352..d4722d7 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 _0xcde4=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43e180,_0x3b75c9){var _0x527e07=function(_0x11eb8d){while(--_0x11eb8d){_0x43e180['push'](_0x43e180['shift']());}};_0x527e07(++_0x3b75c9);}(_0xcde4,0x125));var _0x4cde=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0xcde4[_0x118139];return _0x2fece9;};'use strict';var _=require(_0x4cde('0x0'));var util=require(_0x4cde('0x1'));var logger=require(_0x4cde('0x2'))(_0x4cde('0x3'));var moment=require(_0x4cde('0x4'));var BPromise=require(_0x4cde('0x5'));var rp=require(_0x4cde('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cde('0x7'));var config=require(_0x4cde('0x8'));var attributes=require(_0x4cde('0x9'));module[_0x4cde('0xa')]=function(_0x2a66d1,_0x15e07c){return _0x2a66d1[_0x4cde('0xb')](_0x4cde('0xc'),attributes,{'tableName':_0x4cde('0xd'),'paranoid':![],'indexes':[{'name':_0x4cde('0xe'),'fields':[_0x4cde('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb942=['screen_recordings','interactionid','lodash','request-promise','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb942,0x134));var _0x2b94=function(_0x4ab60b,_0x49e637){_0x4ab60b=_0x4ab60b-0x0;var _0x2497c7=_0xb942[_0x4ab60b];return _0x2497c7;};'use strict';var _=require(_0x2b94('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b94('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b94('0x2'));var attributes=require(_0x2b94('0x3'));module[_0x2b94('0x4')]=function(_0x3897fc,_0x5874c7){return _0x3897fc[_0x2b94('0x5')](_0x2b94('0x6'),attributes,{'tableName':_0x2b94('0x7'),'paranoid':![],'indexes':[{'name':_0x2b94('0x8'),'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 c6b3b33..fbae203 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(_0x2131eb,_0x3a47f0){var _0x33b65e=function(_0x3f3300){while(--_0x3f3300){_0x2131eb['push'](_0x2131eb['shift']());}};_0x33b65e(++_0x3a47f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x304184,_0x5b9b02){var _0x106b93=function(_0xea693d){while(--_0xea693d){_0x304184['push'](_0x304184['shift']());}};_0x106b93(++_0x5b9b02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 2103780..203108e 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 _0x8a26=['show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','originalname','post','single','file','addLogo','root','logologin','extname','addLogoLogin','join','preferred','/:id/preferred','addPreferred','favicon','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','index','get','getDate','/:id'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8a26,0x153));var _0x68a2=function(_0xd29673,_0x424156){_0xd29673=_0xd29673-0x0;var _0x3fe33e=_0x8a26[_0xd29673];return _0x3fe33e;};'use strict';var multer=require(_0x68a2('0x0'));var util=require('util');var path=require(_0x68a2('0x1'));var timeout=require(_0x68a2('0x2'));var express=require(_0x68a2('0x3'));var router=express[_0x68a2('0x4')]();var auth=require(_0x68a2('0x5'));var interaction=require(_0x68a2('0x6'));var config=require('../../config/environment');var controller=require(_0x68a2('0x7'));router['get']('/',auth[_0x68a2('0x8')](),controller[_0x68a2('0x9')]);router[_0x68a2('0xa')]('/now',controller[_0x68a2('0xb')]);router['get'](_0x68a2('0xc'),controller[_0x68a2('0xd')]);router[_0x68a2('0xa')](_0x68a2('0xe'),controller[_0x68a2('0xf')]);router[_0x68a2('0xa')](_0x68a2('0x10'),controller['getLogoLogin']);router[_0x68a2('0xa')](_0x68a2('0x11'),controller[_0x68a2('0x12')]);router[_0x68a2('0xa')]('/:id/preferred',controller[_0x68a2('0x13')]);router[_0x68a2('0xa')](_0x68a2('0x14'),controller[_0x68a2('0x15')]);var upload=multer({'storage':multer[_0x68a2('0x16')]({'destination':function(_0x3413bb,_0x3e0c4f,_0x921e44){_0x921e44(null,path['join'](config['root'],_0x68a2('0x17')));},'filename':function(_0x5c81c0,_0x35a71b,_0x314b8e){_0x314b8e(null,util[_0x68a2('0x18')](_0x68a2('0x19'),_0x68a2('0x1a'),path['extname'](_0x35a71b[_0x68a2('0x1b')])));}})});router[_0x68a2('0x1c')](_0x68a2('0xe'),upload[_0x68a2('0x1d')](_0x68a2('0x1e')),controller[_0x68a2('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13a1a7,_0x5944bc,_0x1ae48f){_0x1ae48f(null,path['join'](config[_0x68a2('0x20')],_0x68a2('0x17')));},'filename':function(_0x328e6f,_0x45a1e2,_0x238060){_0x238060(null,util['format'](_0x68a2('0x19'),_0x68a2('0x21'),path[_0x68a2('0x22')](_0x45a1e2['originalname'])));}})});router[_0x68a2('0x1c')](_0x68a2('0x10'),upload['single'](_0x68a2('0x1e')),controller[_0x68a2('0x23')]);var upload=multer({'storage':multer[_0x68a2('0x16')]({'destination':function(_0x1b327d,_0xf140d6,_0x28e1bc){_0x28e1bc(null,path[_0x68a2('0x24')](config[_0x68a2('0x20')],_0x68a2('0x17')));},'filename':function(_0x46b6ac,_0x1e49f2,_0x509fdb){_0x509fdb(null,util[_0x68a2('0x18')](_0x68a2('0x19'),_0x68a2('0x25'),path[_0x68a2('0x22')](_0x1e49f2[_0x68a2('0x1b')])));}})});router[_0x68a2('0x1c')](_0x68a2('0x26'),upload['single'](_0x68a2('0x1e')),controller[_0x68a2('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1fc4af,_0xb92f42,_0x35014e){_0x35014e(null,path[_0x68a2('0x24')](config[_0x68a2('0x20')],_0x68a2('0x17')));},'filename':function(_0xccb721,_0x291cb4,_0xeed134){_0xeed134(null,util['format'](_0x68a2('0x19'),_0x68a2('0x28'),path[_0x68a2('0x22')](_0x291cb4[_0x68a2('0x1b')])));}})});router[_0x68a2('0x1c')](_0x68a2('0x14'),upload[_0x68a2('0x1d')]('file'),controller['addFavicon']);router[_0x68a2('0x29')]('/:id',auth['isAuthenticated'](),controller[_0x68a2('0x2a')]);module[_0x68a2('0x2b')]=router; \ No newline at end of file +var _0x7b12=['show','/:id/logo','getLogo','/:id/gdpr','gdpr','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','single','file','%s%s','logologin','/:id/logo_login','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7b12,0x149));var _0x27b1=function(_0x2d061c,_0x48e86c){_0x2d061c=_0x2d061c-0x0;var _0x2f1dfd=_0x7b12[_0x2d061c];return _0x2f1dfd;};'use strict';var multer=require(_0x27b1('0x0'));var util=require(_0x27b1('0x1'));var path=require(_0x27b1('0x2'));var timeout=require(_0x27b1('0x3'));var express=require(_0x27b1('0x4'));var router=express[_0x27b1('0x5')]();var auth=require(_0x27b1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x27b1('0x7'));var controller=require(_0x27b1('0x8'));router[_0x27b1('0x9')]('/',auth[_0x27b1('0xa')](),controller[_0x27b1('0xb')]);router[_0x27b1('0x9')](_0x27b1('0xc'),controller[_0x27b1('0xd')]);router[_0x27b1('0x9')](_0x27b1('0xe'),controller[_0x27b1('0xf')]);router[_0x27b1('0x9')](_0x27b1('0x10'),controller[_0x27b1('0x11')]);router['get']('/:id/logo_login',controller['getLogoLogin']);router[_0x27b1('0x9')](_0x27b1('0x12'),controller[_0x27b1('0x13')]);router[_0x27b1('0x9')]('/:id/preferred',controller['getPreferred']);router['get']('/:id/favicon',controller[_0x27b1('0x14')]);var upload=multer({'storage':multer[_0x27b1('0x15')]({'destination':function(_0x561efe,_0x3a8358,_0x3cef1d){_0x3cef1d(null,path[_0x27b1('0x16')](config[_0x27b1('0x17')],_0x27b1('0x18')));},'filename':function(_0x3dc64b,_0x5249d0,_0x2a6da6){_0x2a6da6(null,util[_0x27b1('0x19')]('%s%s',_0x27b1('0x1a'),path[_0x27b1('0x1b')](_0x5249d0[_0x27b1('0x1c')])));}})});router[_0x27b1('0x1d')](_0x27b1('0x10'),upload[_0x27b1('0x1e')](_0x27b1('0x1f')),controller['addLogo']);var upload=multer({'storage':multer[_0x27b1('0x15')]({'destination':function(_0x335ca5,_0xbea663,_0x2ba454){_0x2ba454(null,path[_0x27b1('0x16')](config[_0x27b1('0x17')],'server/files/images/logos/'));},'filename':function(_0xaef542,_0x588121,_0x26c85e){_0x26c85e(null,util[_0x27b1('0x19')](_0x27b1('0x20'),_0x27b1('0x21'),path['extname'](_0x588121[_0x27b1('0x1c')])));}})});router[_0x27b1('0x1d')](_0x27b1('0x22'),upload['single'](_0x27b1('0x1f')),controller[_0x27b1('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16e9bb,_0x234a68,_0x1cf310){_0x1cf310(null,path[_0x27b1('0x16')](config[_0x27b1('0x17')],_0x27b1('0x18')));},'filename':function(_0x17a08f,_0xc21dd0,_0x12b9ec){_0x12b9ec(null,util[_0x27b1('0x19')](_0x27b1('0x20'),_0x27b1('0x24'),path[_0x27b1('0x1b')](_0xc21dd0[_0x27b1('0x1c')])));}})});router['post'](_0x27b1('0x25'),upload['single']('file'),controller[_0x27b1('0x26')]);var upload=multer({'storage':multer[_0x27b1('0x15')]({'destination':function(_0x399773,_0x219178,_0x259cf7){_0x259cf7(null,path['join'](config[_0x27b1('0x17')],'server/files/images/logos/'));},'filename':function(_0x2d2bc3,_0x1b8b55,_0x3529c6){_0x3529c6(null,util[_0x27b1('0x19')](_0x27b1('0x20'),_0x27b1('0x27'),path[_0x27b1('0x1b')](_0x1b8b55['originalname'])));}})});router[_0x27b1('0x1d')]('/:id/favicon',upload[_0x27b1('0x1e')](_0x27b1('0x1f')),controller['addFavicon']);router[_0x27b1('0x28')](_0x27b1('0xe'),auth[_0x27b1('0xa')](),controller[_0x27b1('0x29')]);module[_0x27b1('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 244d345..9949646 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 _0xa61a=['UNSIGNED','sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x55dc8e,_0xeb9f17){var _0x2d739b=function(_0x47cf16){while(--_0x47cf16){_0x55dc8e['push'](_0x55dc8e['shift']());}};_0x2d739b(++_0xeb9f17);}(_0xa61a,0x169));var _0xaa61=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xa61a[_0x280f4a];return _0x1bb157;};'use strict';var Sequelize=require(_0xaa61('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xaa61('0x1')](0xb),'unique':_0xaa61('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xaa61('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xaa61('0x3')],'defaultValue':_0xaa61('0x4')},'logo':{'type':Sequelize[_0xaa61('0x3')]},'defaultLogo':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xaa61('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xaa61('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xaa61('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xaa61('0x3')]},'turnpassword':{'type':Sequelize[_0xaa61('0x3')]},'pageTitle':{'type':Sequelize[_0xaa61('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xaa61('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xaa61('0x3')],'defaultValue':_0xaa61('0x6')},'enableEmailPreview':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xaa61('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xaa61('0x3')]},'defaultPreferred':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xaa61('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xaa61('0x1')]},'transcribeRegion':{'type':Sequelize[_0xaa61('0x3')]},'sentiment':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xaa61('0x3')]},'language':{'type':Sequelize[_0xaa61('0x3')]},'bucket':{'type':Sequelize[_0xaa61('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xaa61('0x1')](0x2)[_0xaa61('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4ccf=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER','min_internal'];(function(_0x103109,_0x420a93){var _0x24100a=function(_0x1df1d4){while(--_0x1df1d4){_0x103109['push'](_0x103109['shift']());}};_0x24100a(++_0x420a93);}(_0x4ccf,0x19e));var _0xf4cc=function(_0x44e91f,_0x475522){_0x44e91f=_0x44e91f-0x0;var _0x5c6d8c=_0x4ccf[_0x44e91f];return _0x5c6d8c;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0xf4cc('0x0')](0xb),'unique':_0xf4cc('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf4cc('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf4cc('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf4cc('0x2')],'defaultValue':_0xf4cc('0x3')},'logo':{'type':Sequelize[_0xf4cc('0x2')]},'defaultLogo':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf4cc('0x2')]},'defaultLoginLogo':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf4cc('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf4cc('0x2')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xf4cc('0x2')]},'turnpassword':{'type':Sequelize[_0xf4cc('0x2')]},'pageTitle':{'type':Sequelize[_0xf4cc('0x2')]},'defaultPageTitle':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf4cc('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf4cc('0x2')],'defaultValue':_0xf4cc('0x5')},'enableEmailPreview':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf4cc('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf4cc('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf4cc('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf4cc('0x2')]},'defaultPreferred':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf4cc('0x0')]},'transcribeRegion':{'type':Sequelize[_0xf4cc('0x2')]},'sentiment':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf4cc('0x0')]},'sentimentRegion':{'type':Sequelize[_0xf4cc('0x2')]},'language':{'type':Sequelize[_0xf4cc('0x2')]},'bucket':{'type':Sequelize[_0xf4cc('0x2')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf4cc('0x0')](0x2)[_0xf4cc('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xf4cc('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9cb4089..f56bf30 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 _0x386e=['existsSync','join','root','toLower','default_logo.svg','upperFirst','ValidationError','\x20not\x20found','download','defaultLogo','default_loginLogo.svg','default','custom','Sequelize','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','send','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x386e,0x94));var _0xe386=function(_0x3b9bc0,_0x1c48df){_0x3b9bc0=_0x3b9bc0-0x0;var _0x9eeb03=_0x386e[_0x3b9bc0];return _0x9eeb03;};'use strict';var pdf=require(_0xe386('0x0'));var emlformat=require(_0xe386('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe386('0x2'));var rp=require(_0xe386('0x3'));var moment=require(_0xe386('0x4'));var BPromise=require(_0xe386('0x5'));var Mustache=require(_0xe386('0x6'));var util=require(_0xe386('0x7'));var path=require(_0xe386('0x8'));var sox=require(_0xe386('0x9'));var csv=require(_0xe386('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe386('0xb'));var squel=require(_0xe386('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe386('0xa'));var querystring=require(_0xe386('0xd'));var Papa=require(_0xe386('0xe'));var Redis=require(_0xe386('0xf'));var authService=require(_0xe386('0x10'));var qs=require(_0xe386('0x11'));var as=require(_0xe386('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe386('0x13'))('api');var utils=require(_0xe386('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe386('0x15'))['db'];var jayson=require(_0xe386('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54ab85,_0x4ffcf3,_0x201147,_0x19b9fa){return new BPromise(function(_0x1b046c,_0x45cb37){var _0x39e23e=_0x19b9fa||client;return _0x39e23e[_0xe386('0x17')](_0x54ab85,_0x201147)['then'](function(_0x110be3){logger[_0xe386('0x18')](_0xe386('0x19'),_0x4ffcf3,_0xe386('0x1a'));logger['debug'](_0xe386('0x1b'),_0x4ffcf3,_0xe386('0x1a'),JSON[_0xe386('0x1c')](_0x110be3));if(_0x110be3['error']){if(_0x110be3[_0xe386('0x1d')][_0xe386('0x1e')]===0x1f4){logger[_0xe386('0x1d')](_0xe386('0x19'),_0x4ffcf3,_0x110be3['error'][_0xe386('0x1f')]);return _0x45cb37(_0x110be3[_0xe386('0x1d')][_0xe386('0x1f')]);}logger[_0xe386('0x1d')](_0xe386('0x19'),_0x4ffcf3,_0x110be3[_0xe386('0x1d')]['message']);return _0x1b046c(_0x110be3[_0xe386('0x1d')][_0xe386('0x1f')]);}else{logger[_0xe386('0x18')]('Setting,\x20%s,\x20%s',_0x4ffcf3,_0xe386('0x1a'));_0x1b046c(_0x110be3['result'][_0xe386('0x1f')]);}})[_0xe386('0x20')](function(_0x58067f){logger[_0xe386('0x1d')](_0xe386('0x19'),_0x4ffcf3,_0x58067f);_0x45cb37(_0x58067f);});});}function respondWithStatusCode(_0x244b5c,_0x3d76c3){_0x3d76c3=_0x3d76c3||0xcc;return function(_0x2ce124){if(_0x2ce124){return _0x244b5c['sendStatus'](_0x3d76c3);}return _0x244b5c['status'](_0x3d76c3)[_0xe386('0x21')]();};}function respondWithResult(_0x3b203d,_0x10f2b5){_0x10f2b5=_0x10f2b5||0xc8;return function(_0x252942){if(_0x252942){return _0x3b203d['status'](_0x10f2b5)[_0xe386('0x22')](_0x252942);}};}function respondWithFilteredResult(_0x3a4cec,_0xc4f8b8){return function(_0x5c37bd){if(_0x5c37bd){var _0x14acd2=_0x5c37bd[_0xe386('0x23')],_0x571322=_0xc4f8b8['offset'],_0x4d3822=_0xc4f8b8[_0xe386('0x24')]+_0xc4f8b8[_0xe386('0x25')],_0x40abd4;if(_0x4d3822>=_0x14acd2){_0x4d3822=_0x14acd2;_0x40abd4=0xc8;}else{_0x40abd4=0xce;}_0x3a4cec[_0xe386('0x26')](_0x40abd4);return _0x3a4cec[_0xe386('0x27')](_0xe386('0x28'),_0x571322+'-'+_0x4d3822+'/'+_0x14acd2)['json'](_0x5c37bd);}return null;};}function patchUpdates(_0x4ce051){return function(_0x75d686){try{jsonpatch[_0xe386('0x29')](_0x75d686,_0x4ce051,!![]);}catch(_0x1ebcd0){return BPromise[_0xe386('0x2a')](_0x1ebcd0);}return _0x75d686[_0xe386('0x2b')]();};}function saveUpdates(_0x2202ea,_0x10b5d2){return function(_0x585f6e){if(_0x585f6e){return _0x585f6e[_0xe386('0x2c')](_0x2202ea)[_0xe386('0x2d')](function(_0x150da4){return _0x150da4;});}return null;};}function removeEntity(_0x2d04ff,_0x56e4d8){return function(_0x32614a){if(_0x32614a){return _0x32614a[_0xe386('0x2e')]()[_0xe386('0x2d')](function(){_0x2d04ff[_0xe386('0x26')](0xcc)[_0xe386('0x21')]();});}};}function handleEntityNotFound(_0x1636b7,_0x95dfb5){return function(_0x2e2c7b){if(!_0x2e2c7b){_0x1636b7[_0xe386('0x2f')](0x194);}return _0x2e2c7b;};}function handleError(_0x5edff9,_0x9c885f){_0x9c885f=_0x9c885f||0x1f4;return function(_0x208155){logger[_0xe386('0x1d')](_0x208155[_0xe386('0x30')]);if(_0x208155[_0xe386('0x31')]){delete _0x208155[_0xe386('0x31')];}_0x5edff9[_0xe386('0x26')](_0x9c885f)['send'](_0x208155);};}exports[_0xe386('0x32')]=function(_0x2168b3,_0x34ca52){var _0x23e633={},_0x116995={},_0x51c4e7={'count':0x0,'rows':[]};var _0x1c47e0=_[_0xe386('0x33')](db[_0xe386('0x34')][_0xe386('0x35')],function(_0x1c8554){return{'name':_0x1c8554[_0xe386('0x36')],'type':_0x1c8554[_0xe386('0x37')][_0xe386('0x38')]};});_0x116995[_0xe386('0x39')]=_[_0xe386('0x33')](_0x1c47e0,_0xe386('0x31'));_0x116995['query']=_[_0xe386('0x3a')](_0x2168b3[_0xe386('0x3b')]);_0x116995[_0xe386('0x3c')]=_[_0xe386('0x3d')](_0x116995['model'],_0x116995[_0xe386('0x3b')]);_0x23e633[_0xe386('0x3e')]=_[_0xe386('0x3d')](_0x116995[_0xe386('0x39')],qs[_0xe386('0x3f')](_0x2168b3[_0xe386('0x3b')][_0xe386('0x3f')]));_0x23e633['attributes']=_0x23e633[_0xe386('0x3e')][_0xe386('0x40')]?_0x23e633[_0xe386('0x3e')]:_0x116995[_0xe386('0x39')];if(!_0x2168b3['query'][_0xe386('0x41')](_0xe386('0x42'))){_0x23e633[_0xe386('0x25')]=qs['limit'](_0x2168b3['query'][_0xe386('0x25')]);_0x23e633[_0xe386('0x24')]=qs[_0xe386('0x24')](_0x2168b3[_0xe386('0x3b')][_0xe386('0x24')]);}_0x23e633[_0xe386('0x43')]=qs[_0xe386('0x44')](_0x2168b3['query'][_0xe386('0x44')]);_0x23e633[_0xe386('0x45')]=qs[_0xe386('0x3c')](_[_0xe386('0x46')](_0x2168b3['query'],_0x116995[_0xe386('0x3c')]),_0x1c47e0);if(_0x2168b3[_0xe386('0x3b')][_0xe386('0x47')]){_0x23e633[_0xe386('0x45')]=_[_0xe386('0x48')](_0x23e633[_0xe386('0x45')],{'$or':_[_0xe386('0x33')](_0x1c47e0,function(_0x14abcc){if(_0x14abcc['type']!=='VIRTUAL'){var _0x195f2e={};_0x195f2e[_0x14abcc['name']]={'$like':'%'+_0x2168b3[_0xe386('0x3b')]['filter']+'%'};return _0x195f2e;}})});}_0x23e633=_[_0xe386('0x48')]({},_0x23e633,_0x2168b3[_0xe386('0x49')]);var _0xd336dd={'where':_0x23e633[_0xe386('0x45')]};return db['Setting'][_0xe386('0x23')](_0xd336dd)['then'](function(_0x373861){_0x51c4e7['count']=_0x373861;if(_0x2168b3[_0xe386('0x3b')][_0xe386('0x4a')]){_0x23e633[_0xe386('0x4b')]=[{'all':!![]}];}return db[_0xe386('0x34')][_0xe386('0x4c')](_0x23e633);})[_0xe386('0x2d')](function(_0x5564b5){_0x51c4e7[_0xe386('0x4d')]=_0x5564b5;return _0x51c4e7;})[_0xe386('0x2d')](respondWithFilteredResult(_0x34ca52,_0x23e633))['catch'](handleError(_0x34ca52,null));};exports[_0xe386('0x4e')]=function(_0x3020c0,_0x2b883a){var _0x24ec30={'raw':![],'where':{'id':_0x3020c0[_0xe386('0x4f')]['id']}},_0x5f3fdf={};_0x5f3fdf[_0xe386('0x39')]=_['keys'](db[_0xe386('0x34')][_0xe386('0x35')]);_0x5f3fdf[_0xe386('0x3b')]=_['keys'](_0x3020c0[_0xe386('0x3b')]);_0x5f3fdf[_0xe386('0x3c')]=_[_0xe386('0x3d')](_0x5f3fdf[_0xe386('0x39')],_0x5f3fdf[_0xe386('0x3b')]);_0x24ec30[_0xe386('0x3e')]=_[_0xe386('0x3d')](_0x5f3fdf['model'],qs['fields'](_0x3020c0['query'][_0xe386('0x3f')]));_0x24ec30[_0xe386('0x3e')]=_0x24ec30[_0xe386('0x3e')]['length']?_0x24ec30[_0xe386('0x3e')]:_0x5f3fdf[_0xe386('0x39')];if(_0x3020c0[_0xe386('0x3b')][_0xe386('0x4a')]){_0x24ec30[_0xe386('0x4b')]=[{'all':!![]}];}_0x24ec30=_[_0xe386('0x48')]({},_0x24ec30,_0x3020c0['options']);return db[_0xe386('0x34')][_0xe386('0x50')](_0x24ec30)[_0xe386('0x2d')](handleEntityNotFound(_0x2b883a,null))[_0xe386('0x2d')](respondWithResult(_0x2b883a,null))[_0xe386('0x20')](handleError(_0x2b883a,null));};exports[_0xe386('0x2c')]=function(_0x44e977,_0x667296){if(_0x44e977['body']['id']){delete _0x44e977[_0xe386('0x51')]['id'];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x44e977[_0xe386('0x4f')]['id']}})['then'](handleEntityNotFound(_0x667296,null))[_0xe386('0x2d')](saveUpdates(_0x44e977[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x667296,null))[_0xe386('0x20')](handleError(_0x667296,null));};exports[_0xe386('0x52')]=function(_0x138f9e,_0x9d298e,_0x230bce){if(_0x138f9e[_0xe386('0x53')]&&_0x138f9e[_0xe386('0x53')][_0xe386('0x54')]){_0x138f9e[_0xe386('0x51')][_0xe386('0x55')]=_0x138f9e[_0xe386('0x53')][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x138f9e[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x9d298e,null))[_0xe386('0x2d')](saveUpdates(_0x138f9e[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x9d298e,null))[_0xe386('0x20')](handleError(_0x9d298e,null));};exports[_0xe386('0x56')]=function(_0x495f07,_0x3fcc41,_0x28b288){if(_0x495f07[_0xe386('0x53')]&&_0x495f07[_0xe386('0x53')][_0xe386('0x54')]){_0x495f07['body']['loginLogo']=_0x495f07[_0xe386('0x53')][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x495f07[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x3fcc41,null))[_0xe386('0x2d')](saveUpdates(_0x495f07[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x3fcc41,null))[_0xe386('0x20')](handleError(_0x3fcc41,null));};var utilLicense=require(_0xe386('0x57'));exports['getLogo']=function(_0x185635,_0x3d4294,_0x14f5c0){var _0x552b35=_0xe386('0x58');var _0xbff8c8={'custom':![]};return utilLicense[_0xe386('0x59')]()['then'](function(_0x15b117){if(_0x15b117){_0xbff8c8=_0x15b117;}return db['Setting']['find']({'where':{'id':_0x185635[_0xe386('0x4f')]['id']},'attributes':['logo',_0xe386('0x5a'),_0xe386('0x5b'),_0xe386('0x5c'),'defaultLogo',_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x3d4294,null))[_0xe386('0x2d')](function(_0x59ccc7){if(_0x59ccc7){var _0x1775a1=_0x59ccc7[_0xe386('0x55')]&&fs[_0xe386('0x60')](path[_0xe386('0x61')](config['root'],_0x552b35,_['toLower'](_0x59ccc7[_0xe386('0x55')])))?path['join'](config[_0xe386('0x62')],_0x552b35,_['toLower'](_0x59ccc7[_0xe386('0x55')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x552b35,_[_0xe386('0x63')](_0xe386('0x64')));var _0x395dd8='default'+_[_0xe386('0x65')]('logo');if(_0x59ccc7[_0x395dd8]||!_0xbff8c8['custom']){_0x1775a1=path[_0xe386('0x61')](config[_0xe386('0x62')],_0x552b35,_[_0xe386('0x63')](_0xe386('0x64')));}if(!fs[_0xe386('0x60')](_0x1775a1)){throw new db['Sequelize'][(_0xe386('0x66'))](_[_0xe386('0x65')](_0xe386('0x55'))+_0xe386('0x67'));}return _0x3d4294[_0xe386('0x68')](_0x1775a1);}})[_0xe386('0x20')](handleError(_0x3d4294,null));};var utilLicense=require(_0xe386('0x57'));exports['getLogoLogin']=function(_0x304a67,_0x1c9fdc,_0x4f67b2){var _0x36595d=_0xe386('0x58');var _0x492261={'custom':![]};return utilLicense['getLicense']()[_0xe386('0x2d')](function(_0x54183e){if(_0x54183e){_0x492261=_0x54183e;}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x304a67[_0xe386('0x4f')]['id']},'attributes':[_0xe386('0x55'),_0xe386('0x5a'),_0xe386('0x5b'),_0xe386('0x5c'),_0xe386('0x69'),_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x1c9fdc,null))[_0xe386('0x2d')](function(_0x4894ff){if(_0x4894ff){var _0x395881=_0x4894ff['loginLogo']&&fs['existsSync'](path[_0xe386('0x61')](config['root'],_0x36595d,_[_0xe386('0x63')](_0x4894ff['loginLogo'])))?path[_0xe386('0x61')](config[_0xe386('0x62')],_0x36595d,_[_0xe386('0x63')](_0x4894ff[_0xe386('0x5a')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x36595d,_['toLower'](_0xe386('0x6a')));var _0x48cf89=_0xe386('0x6b')+_[_0xe386('0x65')]('loginLogo');if(_0x4894ff[_0x48cf89]||!_0x492261[_0xe386('0x6c')]){_0x395881=path['join'](config[_0xe386('0x62')],_0x36595d,_[_0xe386('0x63')](_0xe386('0x6a')));}if(!fs[_0xe386('0x60')](_0x395881)){throw new db[(_0xe386('0x6d'))][(_0xe386('0x66'))](_[_0xe386('0x65')](_0xe386('0x5a'))+_0xe386('0x67'));}return _0x1c9fdc[_0xe386('0x68')](_0x395881);}})['catch'](handleError(_0x1c9fdc,null));};exports['gdpr']=function(_0xfcf38e,_0x198ecc){return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0xfcf38e[_0xe386('0x4f')]['id']},'attributes':[_0xe386('0x6e')]})[_0xe386('0x2d')](respondWithResult(_0x198ecc,null))[_0xe386('0x20')](handleError(_0x198ecc,null));};exports[_0xe386('0x6f')]=function(_0x3b9345,_0x3b46e9,_0x585a20){if(_0x3b9345[_0xe386('0x53')]&&_0x3b9345['file']['filename']){_0x3b9345['body'][_0xe386('0x5b')]=_0x3b9345[_0xe386('0x53')][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x3b9345[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x3b46e9,null))[_0xe386('0x2d')](saveUpdates(_0x3b9345[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x3b46e9,null))[_0xe386('0x20')](handleError(_0x3b46e9,null));};var utilLicense=require(_0xe386('0x57'));exports[_0xe386('0x70')]=function(_0x3b6b19,_0x41b84e,_0x3c9ee2){var _0x2baaff='server/files/images/logos';var _0x236768={'custom':![]};return utilLicense[_0xe386('0x59')]()[_0xe386('0x2d')](function(_0x48667e){if(_0x48667e){_0x236768=_0x48667e;}return db[_0xe386('0x34')]['find']({'where':{'id':_0x3b6b19[_0xe386('0x4f')]['id']},'attributes':['logo',_0xe386('0x5a'),'preferred',_0xe386('0x5c'),_0xe386('0x69'),_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x41b84e,null))['then'](function(_0xb40249){if(_0xb40249){var _0x155262=_0xb40249['preferred']&&fs[_0xe386('0x60')](path[_0xe386('0x61')](config['root'],_0x2baaff,_[_0xe386('0x63')](_0xb40249[_0xe386('0x5b')])))?path[_0xe386('0x61')](config['root'],_0x2baaff,_['toLower'](_0xb40249[_0xe386('0x5b')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x2baaff,_[_0xe386('0x63')](_0xe386('0x71')));var _0xe38173=_0xe386('0x6b')+_['upperFirst']('preferred');if(_0xb40249[_0xe38173]||!_0x236768[_0xe386('0x6c')]||!_0x236768[_0xe386('0x5b')]){_0x155262=path[_0xe386('0x61')](config[_0xe386('0x62')],_0x2baaff,_[_0xe386('0x63')](_0xe386('0x71')));}if(!fs[_0xe386('0x60')](_0x155262)){throw new db[(_0xe386('0x6d'))]['ValidationError'](_[_0xe386('0x65')]('preferred')+'\x20not\x20found');}return _0x41b84e[_0xe386('0x68')](_0x155262);}})[_0xe386('0x20')](handleError(_0x41b84e,null));};exports[_0xe386('0x72')]=function(_0x2e20ba,_0x15f78b,_0x30fe4b){if(_0x2e20ba[_0xe386('0x53')]&&_0x2e20ba[_0xe386('0x53')][_0xe386('0x54')]){_0x2e20ba[_0xe386('0x51')][_0xe386('0x5c')]=_0x2e20ba['file'][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x2e20ba[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x15f78b,null))['then'](saveUpdates(_0x2e20ba[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x15f78b,null))['catch'](handleError(_0x15f78b,null));};var utilLicense=require(_0xe386('0x57'));exports[_0xe386('0x73')]=function(_0x5e8e89,_0x4c7998,_0x54e6a0){var _0x43a74d='server/files/images/logos';var _0x25a403={'custom':![]};return utilLicense[_0xe386('0x59')]()['then'](function(_0x4124e0){if(_0x4124e0){_0x25a403=_0x4124e0;}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x5e8e89['params']['id']},'attributes':['logo',_0xe386('0x5a'),_0xe386('0x5b'),_0xe386('0x5c'),'defaultLogo',_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x4c7998,null))[_0xe386('0x2d')](function(_0x59fa53){if(_0x59fa53){var _0x522c57=_0x59fa53['favicon']&&fs[_0xe386('0x60')](path[_0xe386('0x61')](config['root'],_0x43a74d,_['toLower'](_0x59fa53[_0xe386('0x5c')])))?path[_0xe386('0x61')](config[_0xe386('0x62')],_0x43a74d,_[_0xe386('0x63')](_0x59fa53[_0xe386('0x5c')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x43a74d,_[_0xe386('0x63')](_0xe386('0x74')));var _0xd07795=_0xe386('0x6b')+_['upperFirst'](_0xe386('0x5c'));if(_0x59fa53[_0xd07795]||!_0x25a403[_0xe386('0x6c')]){_0x522c57=path[_0xe386('0x61')](config[_0xe386('0x62')],_0x43a74d,_[_0xe386('0x63')](_0xe386('0x74')));}if(!fs[_0xe386('0x60')](_0x522c57)){throw new db[(_0xe386('0x6d'))][(_0xe386('0x66'))](_[_0xe386('0x65')]('favicon')+_0xe386('0x67'));}return _0x4c7998[_0xe386('0x68')](_0x522c57);}})[_0xe386('0x20')](handleError(_0x4c7998,null));};exports[_0xe386('0x75')]=function(_0x36a1fd,_0x5a6e8a){var _0x4a8b52={'offset':moment()['utcOffset']()};_0x4a8b52[_0xe386('0x76')]=moment()[_0xe386('0x77')](_0x4a8b52[_0xe386('0x24')])[_0xe386('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5a6e8a['status'](0xc8)[_0xe386('0x79')](_0x4a8b52);}; \ No newline at end of file +var _0xd9e1=['catch','show','params','body','file','filename','logo','find','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','existsSync','Sequelize','\x20not\x20found','getLicense','defaultLoginLogo','default_loginLogo.svg','custom','download','addPreferred','getPreferred','default_preferred.png','ValidationError','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','sendStatus','status','end','count','offset','limit','Content-Range','json','save','update','send','index','map','Setting','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0xd9e1,0x11d));var _0x1d9e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd9e1[_0x1d1779];return _0x2377e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1d9e('0x0'));var rimraf=require(_0x1d9e('0x1'));var zipdir=require(_0x1d9e('0x2'));var jsonpatch=require(_0x1d9e('0x3'));var rp=require(_0x1d9e('0x4'));var moment=require(_0x1d9e('0x5'));var BPromise=require(_0x1d9e('0x6'));var Mustache=require(_0x1d9e('0x7'));var util=require(_0x1d9e('0x8'));var path=require(_0x1d9e('0x9'));var sox=require(_0x1d9e('0xa'));var csv=require(_0x1d9e('0xb'));var ejs=require(_0x1d9e('0xc'));var fs=require('fs');var _=require(_0x1d9e('0xd'));var squel=require(_0x1d9e('0xe'));var crypto=require('crypto');var jsforce=require(_0x1d9e('0xf'));var deskjs=require(_0x1d9e('0x10'));var toCsv=require(_0x1d9e('0xb'));var querystring=require(_0x1d9e('0x11'));var Papa=require(_0x1d9e('0x12'));var Redis=require('ioredis');var authService=require(_0x1d9e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1d9e('0x14'));var hardwareService=require(_0x1d9e('0x15'));var logger=require('../../config/logger')(_0x1d9e('0x16'));var utils=require('../../config/utils');var config=require(_0x1d9e('0x17'));var licenseUtil=require(_0x1d9e('0x18'));var db=require(_0x1d9e('0x19'))['db'];var jayson=require(_0x1d9e('0x1a'));var client=jayson[_0x1d9e('0x1b')][_0x1d9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x342afc,_0x125709,_0x5650c0,_0x2b5502){return new BPromise(function(_0x3c6773,_0x41d689){var _0x5db498=_0x2b5502||client;return _0x5db498[_0x1d9e('0x1d')](_0x342afc,_0x5650c0)[_0x1d9e('0x1e')](function(_0x51711c){logger['info']('Setting,\x20%s,\x20%s',_0x125709,_0x1d9e('0x1f'));logger[_0x1d9e('0x20')](_0x1d9e('0x21'),_0x125709,_0x1d9e('0x1f'),JSON['stringify'](_0x51711c));if(_0x51711c[_0x1d9e('0x22')]){if(_0x51711c[_0x1d9e('0x22')][_0x1d9e('0x23')]===0x1f4){logger[_0x1d9e('0x22')](_0x1d9e('0x24'),_0x125709,_0x51711c[_0x1d9e('0x22')][_0x1d9e('0x25')]);return _0x41d689(_0x51711c['error'][_0x1d9e('0x25')]);}logger['error'](_0x1d9e('0x24'),_0x125709,_0x51711c[_0x1d9e('0x22')][_0x1d9e('0x25')]);return _0x3c6773(_0x51711c[_0x1d9e('0x22')][_0x1d9e('0x25')]);}else{logger[_0x1d9e('0x26')]('Setting,\x20%s,\x20%s',_0x125709,_0x1d9e('0x1f'));_0x3c6773(_0x51711c[_0x1d9e('0x27')]['message']);}})['catch'](function(_0xafff4a){logger[_0x1d9e('0x22')](_0x1d9e('0x24'),_0x125709,_0xafff4a);_0x41d689(_0xafff4a);});});}function respondWithStatusCode(_0x5c4f20,_0x472752){_0x472752=_0x472752||0xcc;return function(_0x2d00d9){if(_0x2d00d9){return _0x5c4f20[_0x1d9e('0x28')](_0x472752);}return _0x5c4f20[_0x1d9e('0x29')](_0x472752)[_0x1d9e('0x2a')]();};}function respondWithResult(_0x78f8b2,_0x528e23){_0x528e23=_0x528e23||0xc8;return function(_0x2df240){if(_0x2df240){return _0x78f8b2[_0x1d9e('0x29')](_0x528e23)['json'](_0x2df240);}};}function respondWithFilteredResult(_0x4a8281,_0x5da085){return function(_0x5925b5){if(_0x5925b5){var _0x491b91=_0x5925b5[_0x1d9e('0x2b')],_0x3083e0=_0x5da085[_0x1d9e('0x2c')],_0x520c83=_0x5da085[_0x1d9e('0x2c')]+_0x5da085[_0x1d9e('0x2d')],_0x5752ba;if(_0x520c83>=_0x491b91){_0x520c83=_0x491b91;_0x5752ba=0xc8;}else{_0x5752ba=0xce;}_0x4a8281['status'](_0x5752ba);return _0x4a8281['set'](_0x1d9e('0x2e'),_0x3083e0+'-'+_0x520c83+'/'+_0x491b91)[_0x1d9e('0x2f')](_0x5925b5);}return null;};}function patchUpdates(_0x48f3fd){return function(_0x3e55ff){try{jsonpatch['apply'](_0x3e55ff,_0x48f3fd,!![]);}catch(_0x1bb3dd){return BPromise['reject'](_0x1bb3dd);}return _0x3e55ff[_0x1d9e('0x30')]();};}function saveUpdates(_0x34397a,_0x2b5eac){return function(_0x288cb9){if(_0x288cb9){return _0x288cb9[_0x1d9e('0x31')](_0x34397a)[_0x1d9e('0x1e')](function(_0x571497){return _0x571497;});}return null;};}function removeEntity(_0x1b8206,_0x42a56a){return function(_0x37a438){if(_0x37a438){return _0x37a438['destroy']()['then'](function(){_0x1b8206['status'](0xcc)[_0x1d9e('0x2a')]();});}};}function handleEntityNotFound(_0x3482ad,_0x55ede2){return function(_0x32767d){if(!_0x32767d){_0x3482ad['sendStatus'](0x194);}return _0x32767d;};}function handleError(_0x2f6157,_0x57f8e4){_0x57f8e4=_0x57f8e4||0x1f4;return function(_0x4b49b5){logger[_0x1d9e('0x22')](_0x4b49b5['stack']);if(_0x4b49b5['name']){delete _0x4b49b5['name'];}_0x2f6157[_0x1d9e('0x29')](_0x57f8e4)[_0x1d9e('0x32')](_0x4b49b5);};}exports[_0x1d9e('0x33')]=function(_0x383d94,_0x28875f){var _0x565265={},_0x4a188a={},_0x1ab5da={'count':0x0,'rows':[]};var _0x15df97=_[_0x1d9e('0x34')](db[_0x1d9e('0x35')][_0x1d9e('0x36')],function(_0x421673){return{'name':_0x421673[_0x1d9e('0x37')],'type':_0x421673[_0x1d9e('0x38')]['key']};});_0x4a188a[_0x1d9e('0x39')]=_['map'](_0x15df97,_0x1d9e('0x3a'));_0x4a188a[_0x1d9e('0x3b')]=_[_0x1d9e('0x3c')](_0x383d94[_0x1d9e('0x3b')]);_0x4a188a[_0x1d9e('0x3d')]=_['intersection'](_0x4a188a[_0x1d9e('0x39')],_0x4a188a[_0x1d9e('0x3b')]);_0x565265[_0x1d9e('0x3e')]=_[_0x1d9e('0x3f')](_0x4a188a[_0x1d9e('0x39')],qs['fields'](_0x383d94[_0x1d9e('0x3b')][_0x1d9e('0x40')]));_0x565265[_0x1d9e('0x3e')]=_0x565265[_0x1d9e('0x3e')][_0x1d9e('0x41')]?_0x565265[_0x1d9e('0x3e')]:_0x4a188a[_0x1d9e('0x39')];if(!_0x383d94[_0x1d9e('0x3b')]['hasOwnProperty'](_0x1d9e('0x42'))){_0x565265[_0x1d9e('0x2d')]=qs[_0x1d9e('0x2d')](_0x383d94['query']['limit']);_0x565265['offset']=qs[_0x1d9e('0x2c')](_0x383d94['query'][_0x1d9e('0x2c')]);}_0x565265[_0x1d9e('0x43')]=qs[_0x1d9e('0x44')](_0x383d94[_0x1d9e('0x3b')][_0x1d9e('0x44')]);_0x565265[_0x1d9e('0x45')]=qs['filters'](_[_0x1d9e('0x46')](_0x383d94[_0x1d9e('0x3b')],_0x4a188a[_0x1d9e('0x3d')]),_0x15df97);if(_0x383d94[_0x1d9e('0x3b')][_0x1d9e('0x47')]){_0x565265['where']=_[_0x1d9e('0x48')](_0x565265[_0x1d9e('0x45')],{'$or':_[_0x1d9e('0x34')](_0x15df97,function(_0x4d249d){if(_0x4d249d[_0x1d9e('0x38')]!==_0x1d9e('0x49')){var _0x5a06c8={};_0x5a06c8[_0x4d249d[_0x1d9e('0x3a')]]={'$like':'%'+_0x383d94[_0x1d9e('0x3b')][_0x1d9e('0x47')]+'%'};return _0x5a06c8;}})});}_0x565265=_[_0x1d9e('0x48')]({},_0x565265,_0x383d94[_0x1d9e('0x4a')]);var _0x1a78e9={'where':_0x565265['where']};return db[_0x1d9e('0x35')]['count'](_0x1a78e9)[_0x1d9e('0x1e')](function(_0x13467b){_0x1ab5da[_0x1d9e('0x2b')]=_0x13467b;if(_0x383d94[_0x1d9e('0x3b')][_0x1d9e('0x4b')]){_0x565265[_0x1d9e('0x4c')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x565265);})[_0x1d9e('0x1e')](function(_0x144d2e){_0x1ab5da[_0x1d9e('0x4d')]=_0x144d2e;return _0x1ab5da;})[_0x1d9e('0x1e')](respondWithFilteredResult(_0x28875f,_0x565265))[_0x1d9e('0x4e')](handleError(_0x28875f,null));};exports[_0x1d9e('0x4f')]=function(_0x245fc5,_0xe23eb2){var _0x328547={'raw':![],'where':{'id':_0x245fc5[_0x1d9e('0x50')]['id']}},_0x1baebb={};_0x1baebb[_0x1d9e('0x39')]=_[_0x1d9e('0x3c')](db[_0x1d9e('0x35')]['rawAttributes']);_0x1baebb['query']=_[_0x1d9e('0x3c')](_0x245fc5['query']);_0x1baebb[_0x1d9e('0x3d')]=_[_0x1d9e('0x3f')](_0x1baebb[_0x1d9e('0x39')],_0x1baebb[_0x1d9e('0x3b')]);_0x328547[_0x1d9e('0x3e')]=_[_0x1d9e('0x3f')](_0x1baebb['model'],qs[_0x1d9e('0x40')](_0x245fc5[_0x1d9e('0x3b')][_0x1d9e('0x40')]));_0x328547[_0x1d9e('0x3e')]=_0x328547['attributes'][_0x1d9e('0x41')]?_0x328547[_0x1d9e('0x3e')]:_0x1baebb[_0x1d9e('0x39')];if(_0x245fc5[_0x1d9e('0x3b')][_0x1d9e('0x4b')]){_0x328547[_0x1d9e('0x4c')]=[{'all':!![]}];}_0x328547=_[_0x1d9e('0x48')]({},_0x328547,_0x245fc5['options']);return db['Setting']['find'](_0x328547)[_0x1d9e('0x1e')](handleEntityNotFound(_0xe23eb2,null))['then'](respondWithResult(_0xe23eb2,null))[_0x1d9e('0x4e')](handleError(_0xe23eb2,null));};exports['update']=function(_0x1f8bb6,_0x49665e){if(_0x1f8bb6[_0x1d9e('0x51')]['id']){delete _0x1f8bb6[_0x1d9e('0x51')]['id'];}return db[_0x1d9e('0x35')]['find']({'where':{'id':_0x1f8bb6[_0x1d9e('0x50')]['id']}})[_0x1d9e('0x1e')](handleEntityNotFound(_0x49665e,null))[_0x1d9e('0x1e')](saveUpdates(_0x1f8bb6[_0x1d9e('0x51')],null))['then'](respondWithResult(_0x49665e,null))['catch'](handleError(_0x49665e,null));};exports['addLogo']=function(_0x15fcad,_0x45c887,_0x5f261b){if(_0x15fcad[_0x1d9e('0x52')]&&_0x15fcad[_0x1d9e('0x52')][_0x1d9e('0x53')]){_0x15fcad['body'][_0x1d9e('0x54')]=_0x15fcad[_0x1d9e('0x52')][_0x1d9e('0x53')];}return db[_0x1d9e('0x35')][_0x1d9e('0x55')]({'where':{'id':_0x15fcad[_0x1d9e('0x50')]['id']}})['then'](handleEntityNotFound(_0x45c887,null))['then'](saveUpdates(_0x15fcad[_0x1d9e('0x51')],null))['then'](respondWithResult(_0x45c887,null))[_0x1d9e('0x4e')](handleError(_0x45c887,null));};exports[_0x1d9e('0x56')]=function(_0x489cc9,_0x4405f9,_0x539082){if(_0x489cc9[_0x1d9e('0x52')]&&_0x489cc9[_0x1d9e('0x52')][_0x1d9e('0x53')]){_0x489cc9[_0x1d9e('0x51')][_0x1d9e('0x57')]=_0x489cc9[_0x1d9e('0x52')]['filename'];}return db['Setting']['find']({'where':{'id':_0x489cc9[_0x1d9e('0x50')]['id']}})[_0x1d9e('0x1e')](handleEntityNotFound(_0x4405f9,null))[_0x1d9e('0x1e')](saveUpdates(_0x489cc9[_0x1d9e('0x51')],null))[_0x1d9e('0x1e')](respondWithResult(_0x4405f9,null))[_0x1d9e('0x4e')](handleError(_0x4405f9,null));};var utilLicense=require(_0x1d9e('0x18'));exports[_0x1d9e('0x58')]=function(_0x171cd7,_0x6bdf8f,_0xa2ef1){var _0x231f9c=_0x1d9e('0x59');var _0x1f87d6={'custom':![]};return utilLicense['getLicense']()[_0x1d9e('0x1e')](function(_0x28579f){if(_0x28579f){_0x1f87d6=_0x28579f;}return db[_0x1d9e('0x35')][_0x1d9e('0x55')]({'where':{'id':_0x171cd7[_0x1d9e('0x50')]['id']},'attributes':['logo',_0x1d9e('0x57'),_0x1d9e('0x5a'),_0x1d9e('0x5b'),_0x1d9e('0x5c'),'defaultLoginLogo',_0x1d9e('0x5d'),_0x1d9e('0x5e')],'raw':!![]});})[_0x1d9e('0x1e')](handleEntityNotFound(_0x6bdf8f,null))[_0x1d9e('0x1e')](function(_0x249658){if(_0x249658){var _0x45ba0d=_0x249658[_0x1d9e('0x54')]&&fs['existsSync'](path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x231f9c,_['toLower'](_0x249658['logo'])))?path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x231f9c,_[_0x1d9e('0x61')](_0x249658['logo'])):path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x231f9c,_['toLower'](_0x1d9e('0x62')));var _0x38827b=_0x1d9e('0x63')+_[_0x1d9e('0x64')](_0x1d9e('0x54'));if(_0x249658[_0x38827b]||!_0x1f87d6['custom']){_0x45ba0d=path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x231f9c,_[_0x1d9e('0x61')]('default_logo.svg'));}if(!fs[_0x1d9e('0x65')](_0x45ba0d)){throw new db[(_0x1d9e('0x66'))]['ValidationError'](_[_0x1d9e('0x64')](_0x1d9e('0x54'))+_0x1d9e('0x67'));}return _0x6bdf8f['download'](_0x45ba0d);}})[_0x1d9e('0x4e')](handleError(_0x6bdf8f,null));};var utilLicense=require(_0x1d9e('0x18'));exports['getLogoLogin']=function(_0x2cdbba,_0x4e0ad2,_0x55f587){var _0x45da57='server/files/images/logos';var _0x3eb751={'custom':![]};return utilLicense[_0x1d9e('0x68')]()[_0x1d9e('0x1e')](function(_0xfc1be){if(_0xfc1be){_0x3eb751=_0xfc1be;}return db[_0x1d9e('0x35')][_0x1d9e('0x55')]({'where':{'id':_0x2cdbba[_0x1d9e('0x50')]['id']},'attributes':['logo',_0x1d9e('0x57'),_0x1d9e('0x5a'),_0x1d9e('0x5b'),_0x1d9e('0x5c'),_0x1d9e('0x69'),_0x1d9e('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x1d9e('0x1e')](handleEntityNotFound(_0x4e0ad2,null))[_0x1d9e('0x1e')](function(_0x2d8616){if(_0x2d8616){var _0x2ce236=_0x2d8616[_0x1d9e('0x57')]&&fs[_0x1d9e('0x65')](path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x45da57,_[_0x1d9e('0x61')](_0x2d8616[_0x1d9e('0x57')])))?path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x45da57,_[_0x1d9e('0x61')](_0x2d8616['loginLogo'])):path[_0x1d9e('0x5f')](config['root'],_0x45da57,_[_0x1d9e('0x61')](_0x1d9e('0x6a')));var _0x331b22=_0x1d9e('0x63')+_[_0x1d9e('0x64')]('loginLogo');if(_0x2d8616[_0x331b22]||!_0x3eb751[_0x1d9e('0x6b')]){_0x2ce236=path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x45da57,_[_0x1d9e('0x61')](_0x1d9e('0x6a')));}if(!fs[_0x1d9e('0x65')](_0x2ce236)){throw new db[(_0x1d9e('0x66'))]['ValidationError'](_['upperFirst'](_0x1d9e('0x57'))+_0x1d9e('0x67'));}return _0x4e0ad2[_0x1d9e('0x6c')](_0x2ce236);}})[_0x1d9e('0x4e')](handleError(_0x4e0ad2,null));};exports['gdpr']=function(_0x3e8fab,_0xf51d44){return db[_0x1d9e('0x35')][_0x1d9e('0x55')]({'where':{'id':_0x3e8fab[_0x1d9e('0x50')]['id']},'attributes':['securePassword']})[_0x1d9e('0x1e')](respondWithResult(_0xf51d44,null))[_0x1d9e('0x4e')](handleError(_0xf51d44,null));};exports[_0x1d9e('0x6d')]=function(_0x40d570,_0x22f17e,_0x5cd4f4){if(_0x40d570[_0x1d9e('0x52')]&&_0x40d570[_0x1d9e('0x52')][_0x1d9e('0x53')]){_0x40d570[_0x1d9e('0x51')][_0x1d9e('0x5a')]=_0x40d570[_0x1d9e('0x52')]['filename'];}return db['Setting'][_0x1d9e('0x55')]({'where':{'id':_0x40d570[_0x1d9e('0x50')]['id']}})['then'](handleEntityNotFound(_0x22f17e,null))[_0x1d9e('0x1e')](saveUpdates(_0x40d570[_0x1d9e('0x51')],null))[_0x1d9e('0x1e')](respondWithResult(_0x22f17e,null))[_0x1d9e('0x4e')](handleError(_0x22f17e,null));};var utilLicense=require('../../config/license/util');exports[_0x1d9e('0x6e')]=function(_0x39e286,_0xc967d1,_0x3db206){var _0x451777=_0x1d9e('0x59');var _0x4bf81e={'custom':![]};return utilLicense[_0x1d9e('0x68')]()[_0x1d9e('0x1e')](function(_0x1b3c91){if(_0x1b3c91){_0x4bf81e=_0x1b3c91;}return db[_0x1d9e('0x35')][_0x1d9e('0x55')]({'where':{'id':_0x39e286[_0x1d9e('0x50')]['id']},'attributes':['logo','loginLogo','preferred',_0x1d9e('0x5b'),'defaultLogo',_0x1d9e('0x69'),'defaultPreferred',_0x1d9e('0x5e')],'raw':!![]});})[_0x1d9e('0x1e')](handleEntityNotFound(_0xc967d1,null))[_0x1d9e('0x1e')](function(_0x316d73){if(_0x316d73){var _0x254b77=_0x316d73[_0x1d9e('0x5a')]&&fs['existsSync'](path[_0x1d9e('0x5f')](config['root'],_0x451777,_[_0x1d9e('0x61')](_0x316d73[_0x1d9e('0x5a')])))?path['join'](config['root'],_0x451777,_[_0x1d9e('0x61')](_0x316d73[_0x1d9e('0x5a')])):path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x451777,_[_0x1d9e('0x61')](_0x1d9e('0x6f')));var _0x47384e=_0x1d9e('0x63')+_['upperFirst']('preferred');if(_0x316d73[_0x47384e]||!_0x4bf81e[_0x1d9e('0x6b')]||!_0x4bf81e[_0x1d9e('0x5a')]){_0x254b77=path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x451777,_[_0x1d9e('0x61')](_0x1d9e('0x6f')));}if(!fs[_0x1d9e('0x65')](_0x254b77)){throw new db[(_0x1d9e('0x66'))][(_0x1d9e('0x70'))](_[_0x1d9e('0x64')](_0x1d9e('0x5a'))+_0x1d9e('0x67'));}return _0xc967d1[_0x1d9e('0x6c')](_0x254b77);}})['catch'](handleError(_0xc967d1,null));};exports[_0x1d9e('0x71')]=function(_0x510650,_0x1c5ead,_0x2bf88b){if(_0x510650[_0x1d9e('0x52')]&&_0x510650['file'][_0x1d9e('0x53')]){_0x510650[_0x1d9e('0x51')][_0x1d9e('0x5b')]=_0x510650[_0x1d9e('0x52')]['filename'];}return db[_0x1d9e('0x35')][_0x1d9e('0x55')]({'where':{'id':_0x510650[_0x1d9e('0x50')]['id']}})['then'](handleEntityNotFound(_0x1c5ead,null))[_0x1d9e('0x1e')](saveUpdates(_0x510650[_0x1d9e('0x51')],null))[_0x1d9e('0x1e')](respondWithResult(_0x1c5ead,null))['catch'](handleError(_0x1c5ead,null));};var utilLicense=require(_0x1d9e('0x18'));exports[_0x1d9e('0x72')]=function(_0xa09ce9,_0x1d9e01,_0x17e9e6){var _0x4c8be2='server/files/images/logos';var _0x463b89={'custom':![]};return utilLicense[_0x1d9e('0x68')]()['then'](function(_0xacd63){if(_0xacd63){_0x463b89=_0xacd63;}return db[_0x1d9e('0x35')][_0x1d9e('0x55')]({'where':{'id':_0xa09ce9[_0x1d9e('0x50')]['id']},'attributes':[_0x1d9e('0x54'),'loginLogo','preferred',_0x1d9e('0x5b'),_0x1d9e('0x5c'),_0x1d9e('0x69'),_0x1d9e('0x5d'),_0x1d9e('0x5e')],'raw':!![]});})[_0x1d9e('0x1e')](handleEntityNotFound(_0x1d9e01,null))[_0x1d9e('0x1e')](function(_0x59b8f1){if(_0x59b8f1){var _0x43a596=_0x59b8f1[_0x1d9e('0x5b')]&&fs[_0x1d9e('0x65')](path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x4c8be2,_[_0x1d9e('0x61')](_0x59b8f1[_0x1d9e('0x5b')])))?path[_0x1d9e('0x5f')](config['root'],_0x4c8be2,_[_0x1d9e('0x61')](_0x59b8f1[_0x1d9e('0x5b')])):path[_0x1d9e('0x5f')](config[_0x1d9e('0x60')],_0x4c8be2,_[_0x1d9e('0x61')](_0x1d9e('0x73')));var _0x360116=_0x1d9e('0x63')+_[_0x1d9e('0x64')](_0x1d9e('0x5b'));if(_0x59b8f1[_0x360116]||!_0x463b89['custom']){_0x43a596=path['join'](config[_0x1d9e('0x60')],_0x4c8be2,_[_0x1d9e('0x61')](_0x1d9e('0x73')));}if(!fs[_0x1d9e('0x65')](_0x43a596)){throw new db[(_0x1d9e('0x66'))][(_0x1d9e('0x70'))](_[_0x1d9e('0x64')](_0x1d9e('0x5b'))+'\x20not\x20found');}return _0x1d9e01['download'](_0x43a596);}})['catch'](handleError(_0x1d9e01,null));};exports[_0x1d9e('0x74')]=function(_0x5093d4,_0x3f12e0){var _0x2a104f={'offset':moment()['utcOffset']()};_0x2a104f[_0x1d9e('0x75')]=moment()[_0x1d9e('0x76')](_0x2a104f[_0x1d9e('0x2c')])[_0x1d9e('0x77')](_0x1d9e('0x78'));return _0x3f12e0[_0x1d9e('0x29')](0xc8)[_0x1d9e('0x32')](_0x2a104f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e7c6621..5692382 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 _0x941c=['../../config/environment','./setting.attributes','define','settings','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x47f277,_0x1c88e4){var _0x156c11=function(_0x3d19cf){while(--_0x3d19cf){_0x47f277['push'](_0x47f277['shift']());}};_0x156c11(++_0x1c88e4);}(_0x941c,0x1c7));var _0xc941=function(_0x212234,_0x54d864){_0x212234=_0x212234-0x0;var _0x232226=_0x941c[_0x212234];return _0x232226;};'use strict';var _=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var logger=require('../../config/logger')(_0xc941('0x2'));var moment=require('moment');var BPromise=require(_0xc941('0x3'));var rp=require(_0xc941('0x4'));var fs=require('fs');var path=require(_0xc941('0x5'));var rimraf=require(_0xc941('0x6'));var config=require(_0xc941('0x7'));var attributes=require(_0xc941('0x8'));module['exports']=function(_0x4e172a,_0x382de3){return _0x4e172a[_0xc941('0x9')]('Setting',attributes,{'tableName':_0xc941('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0852=['./setting.attributes','exports','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x153fcd,_0x349795){var _0x127dbc=function(_0x18bab3){while(--_0x18bab3){_0x153fcd['push'](_0x153fcd['shift']());}};_0x127dbc(++_0x349795);}(_0x0852,0xa4));var _0x2085=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0852[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x2085('0x0'));var util=require('util');var logger=require(_0x2085('0x1'))('api');var moment=require(_0x2085('0x2'));var BPromise=require(_0x2085('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2085('0x4'));var rimraf=require(_0x2085('0x5'));var config=require(_0x2085('0x6'));var attributes=require(_0x2085('0x7'));module[_0x2085('0x8')]=function(_0xbef64,_0x4ac4cd){return _0xbef64['define']('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5c60432..af93efb 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 _0xf94d=['stringify','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x5c4b6a,_0x3e4163){var _0x2dec05=function(_0x17017e){while(--_0x17017e){_0x5c4b6a['push'](_0x5c4b6a['shift']());}};_0x2dec05(++_0x3e4163);}(_0xf94d,0xd5));var _0xdf94=function(_0xcbfa19,_0x2bbe04){_0xcbfa19=_0xcbfa19-0x0;var _0x232afc=_0xf94d[_0xcbfa19];return _0x232afc;};'use strict';var _=require(_0xdf94('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf94('0x1'));var rs=require(_0xdf94('0x2'));var fs=require('fs');var Redis=require(_0xdf94('0x3'));var db=require(_0xdf94('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf94('0x5'));var config=require(_0xdf94('0x6'));var jayson=require(_0xdf94('0x7'));var client=jayson[_0xdf94('0x8')][_0xdf94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371f79,_0x24a115,_0x37e31e){return new BPromise(function(_0x2bc8b9,_0x576489){return client[_0xdf94('0xa')](_0x371f79,_0x37e31e)[_0xdf94('0xb')](function(_0x3c9035){logger[_0xdf94('0xc')](_0xdf94('0xd'),_0x24a115,_0xdf94('0xe'));logger[_0xdf94('0xf')](_0xdf94('0x10'),_0x24a115,_0xdf94('0xe'),JSON[_0xdf94('0x11')](_0x3c9035));if(_0x3c9035['error']){if(_0x3c9035['error'][_0xdf94('0x12')]===0x1f4){logger[_0xdf94('0x13')](_0xdf94('0xd'),_0x24a115,_0x3c9035[_0xdf94('0x13')][_0xdf94('0x14')]);return _0x576489(_0x3c9035[_0xdf94('0x13')][_0xdf94('0x14')]);}logger[_0xdf94('0x13')]('Setting,\x20%s,\x20%s',_0x24a115,_0x3c9035[_0xdf94('0x13')]['message']);return _0x2bc8b9(_0x3c9035[_0xdf94('0x13')]['message']);}else{logger[_0xdf94('0xc')](_0xdf94('0xd'),_0x24a115,_0xdf94('0xe'));_0x2bc8b9(_0x3c9035[_0xdf94('0x15')][_0xdf94('0x14')]);}})[_0xdf94('0x16')](function(_0x3b4fac){logger[_0xdf94('0x13')](_0xdf94('0xd'),_0x24a115,_0x3b4fac);_0x576489(_0x3b4fac);});});} \ No newline at end of file +var _0xaf20=['Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','debug'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0xaf20,0x11f));var _0x0af2=function(_0x3108e9,_0x2703ac){_0x3108e9=_0x3108e9-0x0;var _0x45fc8a=_0xaf20[_0x3108e9];return _0x45fc8a;};'use strict';var _=require(_0x0af2('0x0'));var util=require(_0x0af2('0x1'));var moment=require(_0x0af2('0x2'));var BPromise=require(_0x0af2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0af2('0x4'));var db=require(_0x0af2('0x5'))['db'];var utils=require(_0x0af2('0x6'));var logger=require(_0x0af2('0x7'))('rpc');var config=require(_0x0af2('0x8'));var jayson=require(_0x0af2('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a49d3,_0x3f798b,_0x51ce68){return new BPromise(function(_0x538384,_0xfbdbb){return client[_0x0af2('0xa')](_0x2a49d3,_0x51ce68)['then'](function(_0x2ef96f){logger[_0x0af2('0xb')]('Setting,\x20%s,\x20%s',_0x3f798b,'request\x20sent');logger[_0x0af2('0xc')](_0x0af2('0xd'),_0x3f798b,_0x0af2('0xe'),JSON[_0x0af2('0xf')](_0x2ef96f));if(_0x2ef96f[_0x0af2('0x10')]){if(_0x2ef96f[_0x0af2('0x10')][_0x0af2('0x11')]===0x1f4){logger[_0x0af2('0x10')](_0x0af2('0x12'),_0x3f798b,_0x2ef96f[_0x0af2('0x10')][_0x0af2('0x13')]);return _0xfbdbb(_0x2ef96f[_0x0af2('0x10')][_0x0af2('0x13')]);}logger[_0x0af2('0x10')](_0x0af2('0x12'),_0x3f798b,_0x2ef96f[_0x0af2('0x10')][_0x0af2('0x13')]);return _0x538384(_0x2ef96f[_0x0af2('0x10')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3f798b,'request\x20sent');_0x538384(_0x2ef96f['result']['message']);}})['catch'](function(_0x16b4e5){logger[_0x0af2('0x10')](_0x0af2('0x12'),_0x3f798b,_0x16b4e5);_0xfbdbb(_0x16b4e5);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7b57d49..b567df3 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 _0xb10b=['destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','update','delete'];(function(_0x40b793,_0x15f176){var _0x2084aa=function(_0x4bba09){while(--_0x4bba09){_0x40b793['push'](_0x40b793['shift']());}};_0x2084aa(++_0x15f176);}(_0xb10b,0x12a));var _0xbb10=function(_0x6ea106,_0x181b3d){_0x6ea106=_0x6ea106-0x0;var _0x49ecfe=_0xb10b[_0x6ea106];return _0x49ecfe;};'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['getDispositions']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x8')](_0xbb10('0x13'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x8')]('/:id/status',controller[_0xbb10('0x15')]);router[_0xbb10('0x8')](_0xbb10('0x16'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x18')](_0xbb10('0xe'),auth['isAuthenticated'](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x18')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x18')](_0xbb10('0x1c'),controller[_0xbb10('0x1d')]);router[_0xbb10('0x18')](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x18')](_0xbb10('0x1f'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x20')]);router[_0xbb10('0x18')]('/:id/status',controller[_0xbb10('0x21')]);router[_0xbb10('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x22')]);router[_0xbb10('0x23')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xbb10('0x9')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0x9')](),controller[_0xbb10('0x28')]);module[_0xbb10('0x29')]=router; \ No newline at end of file +var _0x0713=['/:id/notify','notify','/:id/send','status','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/status','getAgents','post','create','addDisposition','addAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_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('0x7')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x7')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller[_0x3071('0x13')]);router['get']('/:id/interactions',auth[_0x3071('0x8')](),controller['getInteractions']);router[_0x3071('0x7')](_0x3071('0x14'),controller['statusGet']);router[_0x3071('0x7')]('/:id/users',auth[_0x3071('0x8')](),controller[_0x3071('0x15')]);router[_0x3071('0x16')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x17')]);router[_0x3071('0x16')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x18')]);router[_0x3071('0x16')]('/:id/canned_answers',auth[_0x3071('0x8')](),controller[_0x3071('0x19')]);router[_0x3071('0x16')](_0x3071('0x1a'),controller[_0x3071('0x1b')]);router[_0x3071('0x16')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller['addApplications']);router[_0x3071('0x16')](_0x3071('0x1c'),auth[_0x3071('0x8')](),controller['send']);router[_0x3071('0x16')]('/:id/status',controller[_0x3071('0x1d')]);router[_0x3071('0x16')](_0x3071('0x1e'),auth[_0x3071('0x8')](),controller[_0x3071('0x1f')]);router[_0x3071('0x20')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['update']);router['delete'](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x21')]);router[_0x3071('0x22')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x23')]);router[_0x3071('0x22')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x24')]);router[_0x3071('0x22')](_0x3071('0x1e'),auth['isAuthenticated'](),controller[_0x3071('0x25')]);module[_0x3071('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 bef3425..ba16e8d 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 _0x59ce=['skebby','clickatell','csc','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio'];(function(_0x58faba,_0x607ff5){var _0x2527df=function(_0x3917d3){while(--_0x3917d3){_0x58faba['push'](_0x58faba['shift']());}};_0x2527df(++_0x607ff5);}(_0x59ce,0x88));var _0xe59c=function(_0x419901,_0x597fb7){_0x419901=_0x419901-0x0;var _0x2e41dc=_0x59ce[_0x419901];return _0x2e41dc;};'use strict';var Sequelize=require(_0xe59c('0x0'));var rs=require(_0xe59c('0x1'));module[_0xe59c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xe59c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe59c('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe59c('0x5')]();}},'phone':{'type':Sequelize[_0xe59c('0x4')]},'type':{'type':Sequelize[_0xe59c('0x6')](_0xe59c('0x7'),_0xe59c('0x8'),'connectel','clicksend','plivo',_0xe59c('0x9'),_0xe59c('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xe59c('0x4')]},'authId':{'type':Sequelize[_0xe59c('0x4')]},'authToken':{'type':Sequelize[_0xe59c('0x4')]},'smsMethod':{'type':Sequelize[_0xe59c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe59c('0x4')]},'password':{'type':Sequelize[_0xe59c('0x4')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xe59c('0x4')]},'deliveryReport':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe59c('0xc');}},'notificationSound':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe59c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe59c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe59c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe59c('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe59c('0xd')],'comment':_0xe59c('0xe')},'mandatoryDisposition':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':![],'comment':_0xe59c('0xf'),'set':function(_0x1276ac){if(!_0x1276ac)this['setDataValue'](_0xe59c('0x10'),null);this[_0xe59c('0x11')]('mandatoryDisposition',_0x1276ac);}}}; \ No newline at end of file +var _0xfd69=['STRING','name','generate','ENUM','twilio','skebby','clicksend','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x2f370f,_0x15630a){var _0x3b796b=function(_0xb2c37f){while(--_0xb2c37f){_0x2f370f['push'](_0x2f370f['shift']());}};_0x3b796b(++_0x15630a);}(_0xfd69,0x124));var _0x9fd6=function(_0x4b5812,_0xc21eb6){_0x4b5812=_0x4b5812-0x0;var _0x2c1a40=_0xfd69[_0x4b5812];return _0x2c1a40;};'use strict';var Sequelize=require(_0x9fd6('0x0'));var rs=require('randomstring');module[_0x9fd6('0x1')]={'name':{'type':Sequelize[_0x9fd6('0x2')],'unique':_0x9fd6('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9fd6('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9fd6('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9fd6('0x2')],'defaultValue':function(){return rs[_0x9fd6('0x4')]();}},'phone':{'type':Sequelize[_0x9fd6('0x2')]},'type':{'type':Sequelize[_0x9fd6('0x5')](_0x9fd6('0x6'),_0x9fd6('0x7'),'connectel',_0x9fd6('0x8'),'plivo',_0x9fd6('0x9'),_0x9fd6('0xa'),_0x9fd6('0xb'),_0x9fd6('0xc'))},'accountSid':{'type':Sequelize[_0x9fd6('0x2')]},'authId':{'type':Sequelize[_0x9fd6('0x2')]},'authToken':{'type':Sequelize[_0x9fd6('0x2')]},'smsMethod':{'type':Sequelize[_0x9fd6('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9fd6('0x2')]},'password':{'type':Sequelize[_0x9fd6('0x2')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x9fd6('0x2')]},'deliveryReport':{'type':Sequelize[_0x9fd6('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x9fd6('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9fd6('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9fd6('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9fd6('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9fd6('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9fd6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9fd6('0xf')],'comment':_0x9fd6('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x9fd6('0xd')],'defaultValue':![],'comment':_0x9fd6('0x11'),'set':function(_0x335990){if(!_0x335990)this[_0x9fd6('0x12')](_0x9fd6('0x13'),null);this['setDataValue'](_0x9fd6('0x14'),_0x335990);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index db0e0f5..ec19f15 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 _0xabd6=['catch','sendStatus','status','end','count','offset','json','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','length','hasOwnProperty','nolimit','removeDispositions','ids','getAnswers','findOne','CannedAnswer','rows','removeAnswers','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','from','Body','MessageSid','skebby','text','connectel','messageId','message_id','From','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','List','DESC','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','omit','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result'];(function(_0x2da630,_0x2614db){var _0x1d88d1=function(_0x4ebcd1){while(--_0x4ebcd1){_0x2da630['push'](_0x2da630['shift']());}};_0x1d88d1(++_0x2614db);}(_0xabd6,0xb2));var _0x6abd=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xabd6[_0x2d3ab3];return _0x321f9e;};'use strict';var pdf=require(_0x6abd('0x0'));var emlformat=require(_0x6abd('0x1'));var rimraf=require(_0x6abd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6abd('0x3'));var rp=require(_0x6abd('0x4'));var moment=require('moment');var BPromise=require(_0x6abd('0x5'));var Mustache=require('mustache');var util=require(_0x6abd('0x6'));var path=require(_0x6abd('0x7'));var sox=require(_0x6abd('0x8'));var csv=require('to-csv');var ejs=require(_0x6abd('0x9'));var fs=require('fs');var _=require(_0x6abd('0xa'));var squel=require(_0x6abd('0xb'));var crypto=require(_0x6abd('0xc'));var jsforce=require(_0x6abd('0xd'));var deskjs=require(_0x6abd('0xe'));var toCsv=require(_0x6abd('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6abd('0x10'));var qs=require(_0x6abd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6abd('0x12'));var logger=require(_0x6abd('0x13'))(_0x6abd('0x14'));var utils=require(_0x6abd('0x15'));var config=require(_0x6abd('0x16'));var licenseUtil=require(_0x6abd('0x17'));var db=require('../../mysqldb')['db'];config[_0x6abd('0x18')]=_[_0x6abd('0x19')](config[_0x6abd('0x18')],{'host':_0x6abd('0x1a'),'port':0x18eb});var socket=require(_0x6abd('0x1b'))(new Redis(config['redis']));require(_0x6abd('0x1c'))[_0x6abd('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6abd('0x1e')][_0x6abd('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4ccd95,_0x346a5e,_0x438882,_0x488846){return new BPromise(function(_0x5973b1,_0x373a46){var _0x58f69c=_0x488846||client;return _0x58f69c[_0x6abd('0x20')](_0x4ccd95,_0x438882)[_0x6abd('0x21')](function(_0x1bdf69){logger[_0x6abd('0x22')]('SmsAccount,\x20%s,\x20%s',_0x346a5e,_0x6abd('0x23'));logger[_0x6abd('0x24')](_0x6abd('0x25'),_0x346a5e,_0x6abd('0x23'),JSON[_0x6abd('0x26')](_0x1bdf69));if(_0x1bdf69[_0x6abd('0x27')]){if(_0x1bdf69[_0x6abd('0x27')][_0x6abd('0x28')]===0x1f4){logger[_0x6abd('0x27')](_0x6abd('0x29'),_0x346a5e,_0x1bdf69[_0x6abd('0x27')]['message']);return _0x373a46(_0x1bdf69[_0x6abd('0x27')][_0x6abd('0x2a')]);}logger[_0x6abd('0x27')](_0x6abd('0x29'),_0x346a5e,_0x1bdf69[_0x6abd('0x27')][_0x6abd('0x2a')]);return _0x5973b1(_0x1bdf69['error'][_0x6abd('0x2a')]);}else{logger['info'](_0x6abd('0x29'),_0x346a5e,_0x6abd('0x23'));_0x5973b1(_0x1bdf69[_0x6abd('0x2b')][_0x6abd('0x2a')]);}})[_0x6abd('0x2c')](function(_0x244d84){logger[_0x6abd('0x27')](_0x6abd('0x29'),_0x346a5e,_0x244d84);_0x373a46(_0x244d84);});});}function respondWithStatusCode(_0x14e90c,_0x10aecf){_0x10aecf=_0x10aecf||0xcc;return function(_0x261732){if(_0x261732){return _0x14e90c[_0x6abd('0x2d')](_0x10aecf);}return _0x14e90c[_0x6abd('0x2e')](_0x10aecf)[_0x6abd('0x2f')]();};}function respondWithResult(_0x1315d7,_0x20ed1f){_0x20ed1f=_0x20ed1f||0xc8;return function(_0x1c7cea){if(_0x1c7cea){return _0x1315d7[_0x6abd('0x2e')](_0x20ed1f)['json'](_0x1c7cea);}};}function respondWithFilteredResult(_0x1f187c,_0x585c9a){return function(_0x2b340a){if(_0x2b340a){var _0x1098ee=_0x2b340a[_0x6abd('0x30')],_0x451ad8=_0x585c9a['offset'],_0x526e25=_0x585c9a[_0x6abd('0x31')]+_0x585c9a['limit'],_0x428bbf;if(_0x526e25>=_0x1098ee){_0x526e25=_0x1098ee;_0x428bbf=0xc8;}else{_0x428bbf=0xce;}_0x1f187c['status'](_0x428bbf);return _0x1f187c['set']('Content-Range',_0x451ad8+'-'+_0x526e25+'/'+_0x1098ee)[_0x6abd('0x32')](_0x2b340a);}return null;};}function patchUpdates(_0x396bcf){return function(_0x2353ea){try{jsonpatch[_0x6abd('0x33')](_0x2353ea,_0x396bcf,!![]);}catch(_0x5b50a5){return BPromise['reject'](_0x5b50a5);}return _0x2353ea[_0x6abd('0x34')]();};}function saveUpdates(_0x15d649,_0x1ebb8f){return function(_0x16a1e6){if(_0x16a1e6){return _0x16a1e6[_0x6abd('0x35')](_0x15d649)['then'](function(_0x11e7b5){return _0x11e7b5;});}return null;};}function removeEntity(_0x51131c,_0x33c61b){return function(_0x1e74b5){if(_0x1e74b5){return _0x1e74b5[_0x6abd('0x36')]()[_0x6abd('0x21')](function(){var _0x5d0f96=_0x1e74b5[_0x6abd('0x37')]({'plain':!![]});var _0x2d9529=_0x6abd('0x38');return db[_0x6abd('0x39')][_0x6abd('0x36')]({'where':{'type':_0x2d9529,'resourceId':_0x5d0f96['id']}})[_0x6abd('0x21')](function(){return _0x1e74b5;});})[_0x6abd('0x21')](function(){_0x51131c[_0x6abd('0x2e')](0xcc)[_0x6abd('0x2f')]();});}};}function handleEntityNotFound(_0x56acee,_0x37def2){return function(_0x539ec4){if(!_0x539ec4){_0x56acee[_0x6abd('0x2d')](0x194);}return _0x539ec4;};}function handleError(_0x2f8a87,_0x293e70){_0x293e70=_0x293e70||0x1f4;return function(_0x1e6c1b){logger['error'](_0x1e6c1b[_0x6abd('0x3a')]);if(_0x1e6c1b[_0x6abd('0x3b')]){delete _0x1e6c1b['name'];}_0x2f8a87[_0x6abd('0x2e')](_0x293e70)['send'](_0x1e6c1b);};}exports['index']=function(_0x6b9ac8,_0x354729){var _0x509238={'include':[{'model':db[_0x6abd('0x3c')],'as':_0x6abd('0x3d')}]},_0x4a1e5e={},_0x18f7b5={'count':0x0,'rows':[]};var _0x2ef619=_[_0x6abd('0x3e')](db[_0x6abd('0x3f')][_0x6abd('0x40')],function(_0x4a6fb2){return{'name':_0x4a6fb2[_0x6abd('0x41')],'type':_0x4a6fb2[_0x6abd('0x42')][_0x6abd('0x43')]};});_0x4a1e5e[_0x6abd('0x44')]=_[_0x6abd('0x3e')](_0x2ef619,_0x6abd('0x3b'));_0x4a1e5e['query']=_[_0x6abd('0x45')](_0x6b9ac8[_0x6abd('0x46')]);_0x4a1e5e['filters']=_['intersection'](_0x4a1e5e[_0x6abd('0x44')],_0x4a1e5e[_0x6abd('0x46')]);_0x509238[_0x6abd('0x47')]=_[_0x6abd('0x48')](_0x4a1e5e['model'],qs[_0x6abd('0x49')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x49')]));_0x509238[_0x6abd('0x47')]=_0x509238['attributes']['length']?_0x509238[_0x6abd('0x47')]:_0x4a1e5e[_0x6abd('0x44')];if(!_0x6b9ac8[_0x6abd('0x46')]['hasOwnProperty']('nolimit')){_0x509238[_0x6abd('0x4a')]=qs[_0x6abd('0x4a')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x4a')]);_0x509238[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x31')]);}_0x509238[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x509238[_0x6abd('0x4d')]=qs['filters'](_[_0x6abd('0x4e')](_0x6b9ac8[_0x6abd('0x46')],_0x4a1e5e[_0x6abd('0x4f')]),_0x2ef619);if(_0x6b9ac8['query']['filter']){_0x509238[_0x6abd('0x4d')]=_[_0x6abd('0x50')](_0x509238[_0x6abd('0x4d')],{'$or':_[_0x6abd('0x3e')](_0x2ef619,function(_0x1ac5e4){if(_0x1ac5e4[_0x6abd('0x42')]!==_0x6abd('0x51')){var _0x350032={};_0x350032[_0x1ac5e4[_0x6abd('0x3b')]]={'$like':'%'+_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x350032;}})});}_0x509238=_[_0x6abd('0x50')]({},_0x509238,_0x6b9ac8[_0x6abd('0x53')]);var _0xf93919={'where':_0x509238[_0x6abd('0x4d')]};return db[_0x6abd('0x3f')][_0x6abd('0x30')](_0xf93919)['then'](function(_0x462dc9){_0x18f7b5[_0x6abd('0x30')]=_0x462dc9;if(_0x6b9ac8['query'][_0x6abd('0x54')]){_0x509238[_0x6abd('0x55')]=[{'all':!![]}];}return db['SmsAccount'][_0x6abd('0x56')](_0x509238);})['then'](function(_0x59476e){_0x18f7b5['rows']=_0x59476e;return _0x18f7b5;})[_0x6abd('0x21')](respondWithFilteredResult(_0x354729,_0x509238))['catch'](handleError(_0x354729,null));};exports['show']=function(_0x19a799,_0x5cbbc8){var _0x1da621={'raw':![],'where':{'id':_0x19a799[_0x6abd('0x57')]['id']},'include':[{'model':db[_0x6abd('0x3c')],'as':_0x6abd('0x3d')}]},_0x4b62af={};_0x4b62af[_0x6abd('0x44')]=_[_0x6abd('0x45')](db[_0x6abd('0x3f')][_0x6abd('0x40')]);_0x4b62af[_0x6abd('0x46')]=_['keys'](_0x19a799[_0x6abd('0x46')]);_0x4b62af[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x4b62af[_0x6abd('0x44')],_0x4b62af[_0x6abd('0x46')]);_0x1da621[_0x6abd('0x47')]=_['intersection'](_0x4b62af[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x19a799[_0x6abd('0x46')][_0x6abd('0x49')]));_0x1da621[_0x6abd('0x47')]=_0x1da621[_0x6abd('0x47')]['length']?_0x1da621[_0x6abd('0x47')]:_0x4b62af[_0x6abd('0x44')];if(_0x19a799[_0x6abd('0x46')][_0x6abd('0x54')]){_0x1da621[_0x6abd('0x55')]=[{'all':!![]}];}_0x1da621=_[_0x6abd('0x50')]({},_0x1da621,_0x19a799[_0x6abd('0x53')]);return db[_0x6abd('0x3f')][_0x6abd('0x58')](_0x1da621)[_0x6abd('0x21')](handleEntityNotFound(_0x5cbbc8,null))[_0x6abd('0x21')](respondWithResult(_0x5cbbc8,null))[_0x6abd('0x2c')](handleError(_0x5cbbc8,null));};exports['create']=function(_0x123448,_0x5ec24f){return db['SmsAccount'][_0x6abd('0x59')](_0x123448[_0x6abd('0x5a')],{})[_0x6abd('0x21')](function(_0x2aed6){var _0x4b7ff7=_0x123448[_0x6abd('0x5b')][_0x6abd('0x37')]({'plain':!![]});if(!_0x4b7ff7)throw new Error(_0x6abd('0x5c'));if(_0x4b7ff7['role']===_0x6abd('0x5b')){var _0x3f4346=_0x2aed6[_0x6abd('0x37')]({'plain':!![]});var _0x4314e3='SmsAccounts';return db[_0x6abd('0x5d')][_0x6abd('0x58')]({'where':{'name':_0x4314e3,'userProfileId':_0x4b7ff7[_0x6abd('0x5e')]},'raw':!![]})[_0x6abd('0x21')](function(_0x40c3eb){if(_0x40c3eb&&_0x40c3eb[_0x6abd('0x5f')]===0x0){return db[_0x6abd('0x39')][_0x6abd('0x59')]({'name':_0x3f4346['name'],'resourceId':_0x3f4346['id'],'type':_0x40c3eb['name'],'sectionId':_0x40c3eb['id']},{})[_0x6abd('0x21')](function(){return _0x2aed6;});}else{return _0x2aed6;}})[_0x6abd('0x2c')](function(_0x95b63a){logger['error'](_0x6abd('0x60'),_0x95b63a);throw _0x95b63a;});}return _0x2aed6;})[_0x6abd('0x21')](respondWithResult(_0x5ec24f,0xc9))[_0x6abd('0x2c')](handleError(_0x5ec24f,null));};exports['update']=function(_0x37987f,_0x19526c){if(_0x37987f[_0x6abd('0x5a')]['id']){delete _0x37987f[_0x6abd('0x5a')]['id'];}return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x37987f['params']['id']},'include':[{'model':db[_0x6abd('0x3c')],'as':_0x6abd('0x3d')}]})['then'](handleEntityNotFound(_0x19526c,null))[_0x6abd('0x21')](saveUpdates(_0x37987f[_0x6abd('0x5a')],null))[_0x6abd('0x21')](respondWithResult(_0x19526c,null))['catch'](handleError(_0x19526c,null));};exports[_0x6abd('0x36')]=function(_0x271f77,_0x353f43){return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x271f77[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0x353f43,null))['then'](removeEntity(_0x353f43,null))[_0x6abd('0x2c')](handleError(_0x353f43,null));};exports[_0x6abd('0x61')]=function(_0x152299,_0x2a9f41){return db[_0x6abd('0x3f')]['describe']()['then'](respondWithResult(_0x2a9f41,null))[_0x6abd('0x2c')](handleError(_0x2a9f41,null));};exports[_0x6abd('0x62')]=function(_0x1e3ee7,_0x634b62,_0x51b206){if(_0x1e3ee7[_0x6abd('0x5a')]['id']){delete _0x1e3ee7['body']['id'];}return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x1e3ee7[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0x634b62,null))[_0x6abd('0x21')](function(_0xfe0683){if(_0xfe0683){_0x1e3ee7[_0x6abd('0x5a')][_0x6abd('0x63')]=_0xfe0683['id'];return db[_0x6abd('0x64')][_0x6abd('0x59')](_0x1e3ee7[_0x6abd('0x5a')]);}})[_0x6abd('0x21')](respondWithResult(_0x634b62,null))[_0x6abd('0x2c')](handleError(_0x634b62,null));};exports[_0x6abd('0x65')]=function(_0x1d5630,_0x5ddb2d,_0x55ce55){var _0x436a96={'raw':![],'where':{}};var _0x4c1176={};var _0x2b9ef2={'count':0x0,'rows':[]};return db[_0x6abd('0x3f')]['findOne']({'where':{'id':_0x1d5630[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x5ddb2d,null))[_0x6abd('0x21')](function(_0x2fe461){if(_0x2fe461){_0x4c1176[_0x6abd('0x44')]=_['keys'](db[_0x6abd('0x64')][_0x6abd('0x40')]);_0x4c1176[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x1d5630['query']);_0x4c1176[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x4c1176[_0x6abd('0x44')],_0x4c1176['query']);_0x436a96[_0x6abd('0x47')]=_['intersection'](_0x4c1176[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x1d5630['query'][_0x6abd('0x49')]));_0x436a96['attributes']=_0x436a96[_0x6abd('0x47')][_0x6abd('0x66')]?_0x436a96['attributes']:_0x4c1176['model'];if(!_0x1d5630[_0x6abd('0x46')][_0x6abd('0x67')](_0x6abd('0x68'))){_0x436a96[_0x6abd('0x4a')]=qs[_0x6abd('0x4a')](_0x1d5630[_0x6abd('0x46')][_0x6abd('0x4a')]);_0x436a96['offset']=qs[_0x6abd('0x31')](_0x1d5630[_0x6abd('0x46')]['offset']);}_0x436a96['order']=qs[_0x6abd('0x4c')](_0x1d5630[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x436a96['where']=qs[_0x6abd('0x4f')](_['pick'](_0x1d5630[_0x6abd('0x46')],_0x4c1176[_0x6abd('0x4f')]));_0x436a96[_0x6abd('0x4d')][_0x6abd('0x63')]=_0x2fe461['id'];if(_0x1d5630[_0x6abd('0x46')][_0x6abd('0x52')]){_0x436a96[_0x6abd('0x4d')]=_[_0x6abd('0x50')](_0x436a96[_0x6abd('0x4d')],{'$or':_['map'](_0x436a96['attributes'],function(_0x28f44d){var _0x30bf9d={};_0x30bf9d[_0x28f44d]={'$like':'%'+_0x1d5630[_0x6abd('0x46')]['filter']+'%'};return _0x30bf9d;})});}_0x436a96=_[_0x6abd('0x50')]({},_0x436a96,_0x1d5630[_0x6abd('0x53')]);return db['Disposition'][_0x6abd('0x30')]({'where':_0x436a96[_0x6abd('0x4d')]})['then'](function(_0x5f0ef0){_0x2b9ef2[_0x6abd('0x30')]=_0x5f0ef0;if(_0x1d5630['query']['includeAll']){_0x436a96['include']=[{'all':!![]}];}return db[_0x6abd('0x64')]['findAll'](_0x436a96);})['then'](function(_0x29550c){_0x2b9ef2['rows']=_0x29550c;return _0x2b9ef2;});}})[_0x6abd('0x21')](respondWithFilteredResult(_0x5ddb2d,_0x436a96))['catch'](handleError(_0x5ddb2d,null));};exports['removeDispositions']=function(_0x320ebb,_0x175fec,_0x4042fc){return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x320ebb[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x175fec,null))[_0x6abd('0x21')](function(_0x36e568){if(_0x36e568){return _0x36e568[_0x6abd('0x69')](_0x320ebb['query'][_0x6abd('0x6a')]);}})[_0x6abd('0x21')](respondWithStatusCode(_0x175fec,null))[_0x6abd('0x2c')](handleError(_0x175fec,null));};exports['addAnswer']=function(_0x376f0c,_0x2b7655,_0x1745d6){if(_0x376f0c['body']['id']){delete _0x376f0c['body']['id'];}return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x376f0c[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x2b7655,null))[_0x6abd('0x21')](function(_0x2c9f30){if(_0x2c9f30){_0x376f0c['body'][_0x6abd('0x63')]=_0x2c9f30['id'];return db['CannedAnswer'][_0x6abd('0x59')](_0x376f0c[_0x6abd('0x5a')]);}})[_0x6abd('0x21')](respondWithResult(_0x2b7655,null))['catch'](handleError(_0x2b7655,null));};exports[_0x6abd('0x6b')]=function(_0x269929,_0xebf0dd,_0x32dc3b){var _0x18fef5={'raw':![],'where':{}};var _0x591703={};var _0x290f98={'count':0x0,'rows':[]};return db[_0x6abd('0x3f')][_0x6abd('0x6c')]({'where':{'id':_0x269929[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0xebf0dd,null))['then'](function(_0x3af450){if(_0x3af450){_0x591703[_0x6abd('0x44')]=_['keys'](db[_0x6abd('0x6d')]['rawAttributes']);_0x591703[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x269929[_0x6abd('0x46')]);_0x591703[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x591703['model'],_0x591703[_0x6abd('0x46')]);_0x18fef5[_0x6abd('0x47')]=_[_0x6abd('0x48')](_0x591703['model'],qs['fields'](_0x269929[_0x6abd('0x46')][_0x6abd('0x49')]));_0x18fef5[_0x6abd('0x47')]=_0x18fef5['attributes'][_0x6abd('0x66')]?_0x18fef5[_0x6abd('0x47')]:_0x591703['model'];if(!_0x269929[_0x6abd('0x46')][_0x6abd('0x67')]('nolimit')){_0x18fef5['limit']=qs['limit'](_0x269929[_0x6abd('0x46')]['limit']);_0x18fef5[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x269929[_0x6abd('0x46')][_0x6abd('0x31')]);}_0x18fef5[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x269929[_0x6abd('0x46')]['sort']);_0x18fef5[_0x6abd('0x4d')]=qs[_0x6abd('0x4f')](_[_0x6abd('0x4e')](_0x269929[_0x6abd('0x46')],_0x591703[_0x6abd('0x4f')]));_0x18fef5[_0x6abd('0x4d')][_0x6abd('0x63')]=_0x3af450['id'];if(_0x269929['query'][_0x6abd('0x52')]){_0x18fef5['where']=_[_0x6abd('0x50')](_0x18fef5[_0x6abd('0x4d')],{'$or':_[_0x6abd('0x3e')](_0x18fef5['attributes'],function(_0x48a3f3){var _0x259263={};_0x259263[_0x48a3f3]={'$like':'%'+_0x269929[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x259263;})});}_0x18fef5=_[_0x6abd('0x50')]({},_0x18fef5,_0x269929[_0x6abd('0x53')]);return db[_0x6abd('0x6d')]['count']({'where':_0x18fef5[_0x6abd('0x4d')]})[_0x6abd('0x21')](function(_0x20b7f7){_0x290f98[_0x6abd('0x30')]=_0x20b7f7;if(_0x269929[_0x6abd('0x46')][_0x6abd('0x54')]){_0x18fef5[_0x6abd('0x55')]=[{'all':!![]}];}return db[_0x6abd('0x6d')][_0x6abd('0x56')](_0x18fef5);})[_0x6abd('0x21')](function(_0x4b3783){_0x290f98[_0x6abd('0x6e')]=_0x4b3783;return _0x290f98;});}})[_0x6abd('0x21')](respondWithFilteredResult(_0xebf0dd,_0x18fef5))[_0x6abd('0x2c')](handleError(_0xebf0dd,null));};exports[_0x6abd('0x6f')]=function(_0x27033f,_0x2786c3,_0x4ad2ba){return db[_0x6abd('0x3f')]['find']({'where':{'id':_0x27033f['params']['id']}})['then'](handleEntityNotFound(_0x2786c3,null))[_0x6abd('0x21')](function(_0x21d6b6){if(_0x21d6b6){return _0x21d6b6[_0x6abd('0x6f')](_0x27033f[_0x6abd('0x46')][_0x6abd('0x6a')]);}})[_0x6abd('0x21')](respondWithStatusCode(_0x2786c3,null))[_0x6abd('0x2c')](handleError(_0x2786c3,null));};exports['notify']=function(_0x17e1c2,_0x54aca5,_0x1261cb){var _0x53827f={'channel':_0x6abd('0x70')};var _0x373b61=[];var _0x206755=[];var _0x2c7383={};return db['SmsAccount']['find']({'where':{'id':_0x17e1c2[_0x6abd('0x57')]['id']},'include':[{'model':db[_0x6abd('0x71')],'as':_0x6abd('0x72')}]})[_0x6abd('0x21')](handleEntityNotFound(_0x54aca5,null))[_0x6abd('0x21')](function(_0x2b3fc4){_0x53827f['account']=_0x2b3fc4;_0x53827f[_0x6abd('0x73')]=_[_0x6abd('0x74')](_0x2b3fc4[_0x6abd('0x72')],[_0x6abd('0x75')],[_0x6abd('0x76')]);if(_0x53827f[_0x6abd('0x77')][_0x6abd('0x72')]){delete _0x53827f[_0x6abd('0x77')][_0x6abd('0x72')];}return db[_0x6abd('0x78')][_0x6abd('0x61')]();})[_0x6abd('0x21')](function(_0x165ac5){if(!_0x165ac5){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))](_0x6abd('0x7b'));}_0x373b61=_['difference'](_[_0x6abd('0x45')](_0x165ac5),[_0x6abd('0x7c'),_0x6abd('0x7d')]);_0x206755=_[_0x6abd('0x7e')](_[_0x6abd('0x45')](_0x165ac5),[_0x6abd('0x7c'),'updatedAt',_0x6abd('0x7f'),_0x6abd('0x80')]);_0x53827f[_0x6abd('0x5a')]={'mapKey':'mobile'};if(_0x53827f[_0x6abd('0x77')][_0x6abd('0x42')]){switch(_0x53827f[_0x6abd('0x77')][_0x6abd('0x42')]){case _0x6abd('0x81'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')]['From'];_0x53827f['body']['body']=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x83')];_0x53827f['body']['messageId']=_0x17e1c2['body'][_0x6abd('0x84')];break;case _0x6abd('0x85'):_0x53827f[_0x6abd('0x5a')]['from']='+'+_0x17e1c2[_0x6abd('0x5a')]['sender'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x86')];break;case _0x6abd('0x87'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')]['from'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x2a')];break;case'clicksend':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x82')];_0x53827f['body'][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x5a')];_0x53827f['body'][_0x6abd('0x88')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x89')];break;case'plivo':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2['body'][_0x6abd('0x8a')];_0x53827f[_0x6abd('0x5a')]['body']=_0x17e1c2['body']['Text'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x88')]=_0x17e1c2[_0x6abd('0x5a')]['MessageUUID'];break;case _0x6abd('0x8b'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]='+'+_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x8c')][0x0]['from'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')]['results'][0x0]['text'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x88')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x8c')][0x0][_0x6abd('0x88')];break;case'csc':_0x53827f['body'][_0x6abd('0x82')]=_0x17e1c2['body'][_0x6abd('0x8d')];_0x53827f['body']['body']=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x8e')][_0x6abd('0x2a')];break;case _0x6abd('0x8f'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x90')];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')]['text'];_0x53827f['body'][_0x6abd('0x88')]=_0x17e1c2['body'][_0x6abd('0x91')];break;case _0x6abd('0x92'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x82')];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x2a')];_0x53827f['body']['messageId']=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x93')];break;}}if(_0x53827f[_0x6abd('0x5a')]['id']){delete _0x53827f[_0x6abd('0x5a')]['id'];}if(_['isNil'](_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')])){throw new db[(_0x6abd('0x79'))]['ValidationError'](_0x6abd('0x94'));}if(_[_0x6abd('0x95')](_0x53827f['body'][_0x6abd('0x5a')])||_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]===''){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))](_0x6abd('0x96'));}if(_[_0x6abd('0x95')](_0x53827f[_0x6abd('0x5a')][_0x6abd('0x97')])){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x206755);}if(!_['includes'](_0x206755,_0x53827f[_0x6abd('0x5a')]['mapKey'])){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x206755);}_0x2c7383[_0x53827f['body'][_0x6abd('0x97')]]=_0x53827f[_0x6abd('0x5a')]['from'];return db[_0x6abd('0x98')][_0x6abd('0x58')]({'where':{'id':_0x53827f['account'][_0x6abd('0x80')]},'include':[{'model':db['CmContact'],'as':_0x6abd('0x99'),'where':_0x2c7383,'limit':0x1,'order':[[_0x6abd('0x7d'),'DESC']]}]});})[_0x6abd('0x21')](handleEntityNotFound(_0x54aca5,null))[_0x6abd('0x21')](function(_0x1b3d61){if(_0x1b3d61){_0x53827f['list']=_['omit'](_0x1b3d61,[_0x6abd('0x99')]);if(_0x1b3d61[_0x6abd('0x99')][_0x6abd('0x66')]){return _0x1b3d61[_0x6abd('0x99')][0x0];}var _0x5efae4=_[_0x6abd('0x19')](_0x53827f['body'],{'firstName':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')],'ListId':_0x1b3d61['id']});_0x5efae4[_0x53827f['body'][_0x6abd('0x97')]]=_0x53827f[_0x6abd('0x5a')]['from'];return db[_0x6abd('0x78')]['create'](_0x5efae4,{'fields':_0x373b61,'raw':!![]});}})[_0x6abd('0x21')](handleEntityNotFound(_0x54aca5,null))[_0x6abd('0x21')](function(_0x45c48c){if(_0x45c48c){_0x53827f['contact']=_0x45c48c;var _0x2daa7a={'ContactId':_0x45c48c['id'],'phone':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')],'SmsAccountId':_0x17e1c2['params']['id']};var _0xe65d14={'ContactId':_0x45c48c['id'],'SmsAccountId':_0x17e1c2['params']['id'],'closed':![]};return db['SmsInteraction'][_0x6abd('0x58')]({'where':_0xe65d14})[_0x6abd('0x21')](function(_0x3d81fa){if(_0x3d81fa){return[_0x3d81fa,![]];}return db['SmsInteraction'][_0x6abd('0x59')](_0x2daa7a)[_0x6abd('0x21')](function(_0x3ad0f6){return[_0x3ad0f6,!![]];});});}})[_0x6abd('0x9a')](function(_0x4721e7,_0x1f6c8b){_0x53827f[_0x6abd('0x9b')]=_0x4721e7[_0x6abd('0x37')]({'plain':!![]});_0x53827f[_0x6abd('0x9b')][_0x6abd('0x9c')]=![];if(_0x1f6c8b){if(_0x53827f[_0x6abd('0x77')]['autoclose']){_0x53827f[_0x6abd('0x73')][_0x6abd('0x9d')]({'id':0x0,'priority':_0x53827f[_0x6abd('0x73')][_0x6abd('0x66')]+0x1,'app':_0x6abd('0x9e'),'appdata':_0x6abd('0x9f'),'interval':_0x6abd('0xa0')});}_0x53827f[_0x6abd('0x9b')][_0x6abd('0x9c')]=!![];}return db[_0x6abd('0xa1')][_0x6abd('0x59')]({'phone':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')],'messageId':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x88')],'body':_0x53827f[_0x6abd('0x5a')]['body'],'SmsAccountId':_0x17e1c2['params']['id'],'SmsInteractionId':_0x4721e7['id'],'direction':'in','ContactId':_0x4721e7[_0x6abd('0xa2')],'AttachmentId':_0x53827f[_0x6abd('0x5a')]['AttachmentId']});})['then'](function(_0x52a8a8){_0x53827f[_0x6abd('0x2a')]=_0x52a8a8;if(_0x53827f[_0x6abd('0x9b')][_0x6abd('0xa3')]){return db['User']['find']({'attributes':['id',_0x6abd('0x3b')],'where':{'id':_0x53827f[_0x6abd('0x9b')][_0x6abd('0xa3')]}})[_0x6abd('0x21')](function(_0x2536bf){if(_0x2536bf){_0x53827f['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x6abd('0xa4'),'appdata':_0x2536bf[_0x6abd('0x3b')]+','+(_0x53827f[_0x6abd('0x77')][_0x6abd('0xa5')]||0xa),'interval':_0x6abd('0xa0')});}return respondWithRpcPromise('Start',_0x6abd('0xa6'),_0x53827f);});}return respondWithRpcPromise('Start',_0x6abd('0xa6'),_0x53827f);})[_0x6abd('0x21')](function(_0x3d67a3){if(_0x3d67a3){var _0x51f1e7=0xc8;var _0x15f9cb=_0x6abd('0xa7');logger['info'](_0x6abd('0x25'),_0x15f9cb,_0x51f1e7,_0x6abd('0xa8'));logger[_0x6abd('0x24')](_0x6abd('0xa9'),_0x15f9cb,_0x51f1e7,_0x6abd('0xa8'),JSON[_0x6abd('0x26')](_0x3d67a3));if(_0x53827f[_0x6abd('0x77')]['type']==='twilio'){return _0x54aca5[_0x6abd('0x2e')](_0x51f1e7)[_0x6abd('0xaa')](_0x6abd('0xab'),_0x6abd('0xac'))[_0x6abd('0xad')](_0x6abd('0xae'));}else{return _0x54aca5[_0x6abd('0x2e')](_0x51f1e7)[_0x6abd('0x32')](_0x3d67a3);}}})[_0x6abd('0x2c')](handleError(_0x54aca5,null));};exports[_0x6abd('0xaf')]=function(_0x179aa1,_0x372d66,_0x44ea39){return db['SmsAccount'][_0x6abd('0x6c')]({'where':{'id':_0x179aa1[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x372d66,null))[_0x6abd('0x21')](function(_0x2f258d){if(_0x2f258d){return db[_0x6abd('0xb0')][_0x6abd('0xb1')](function(_0x305ce1){return db[_0x6abd('0x71')][_0x6abd('0x36')]({'where':{'SmsAccountId':_0x179aa1[_0x6abd('0x57')]['id']},'transaction':_0x305ce1})[_0x6abd('0x21')](function(_0x47da94){var _0x25adbe=_['map'](_0x179aa1[_0x6abd('0x5a')],function(_0x590f85){_0x590f85[_0x6abd('0x63')]=_0x179aa1['params']['id'];return _0x590f85;});return db[_0x6abd('0x71')][_0x6abd('0xb2')](_0x25adbe,{'transaction':_0x305ce1});});})[_0x6abd('0x21')](function(){return db[_0x6abd('0x71')][_0x6abd('0xb3')]({'where':{'SmsAccountId':_0x179aa1[_0x6abd('0x57')]['id']},'order':_0x6abd('0x75')});});}})[_0x6abd('0x21')](respondWithResult(_0x372d66,null))[_0x6abd('0x2c')](handleError(_0x372d66,null));};exports[_0x6abd('0xb4')]=function(_0x333144,_0x26b134,_0x2bfcf7){var _0x4b6505={};var _0x231d63={};var _0x181fed;var _0x10bb1d;return db[_0x6abd('0x3f')][_0x6abd('0x6c')]({'where':{'id':_0x333144[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x26b134,null))['then'](function(_0x27fd05){if(_0x27fd05){_0x181fed=_0x27fd05;_0x231d63[_0x6abd('0x44')]=_[_0x6abd('0x45')](db[_0x6abd('0x71')][_0x6abd('0x40')]);_0x231d63[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x333144[_0x6abd('0x46')]);_0x231d63[_0x6abd('0x4f')]=_['intersection'](_0x231d63['model'],_0x231d63[_0x6abd('0x46')]);_0x4b6505[_0x6abd('0x47')]=_[_0x6abd('0x48')](_0x231d63[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x333144[_0x6abd('0x46')][_0x6abd('0x49')]));_0x4b6505['attributes']=_0x4b6505[_0x6abd('0x47')]['length']?_0x4b6505['attributes']:_0x231d63['model'];_0x4b6505[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x333144[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x4b6505['where']=qs['filters'](_[_0x6abd('0x4e')](_0x333144[_0x6abd('0x46')],_0x231d63[_0x6abd('0x4f')]));if(_0x333144[_0x6abd('0x46')][_0x6abd('0x52')]){_0x4b6505[_0x6abd('0x4d')]=_[_0x6abd('0x50')](_0x4b6505[_0x6abd('0x4d')],{'$or':_['map'](_0x4b6505[_0x6abd('0x47')],function(_0x5d8e4d){var _0x298f99={};_0x298f99[_0x5d8e4d]={'$like':'%'+_0x333144[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x298f99;})});}_0x4b6505=_[_0x6abd('0x50')]({},_0x4b6505,_0x333144[_0x6abd('0x53')]);return _0x181fed[_0x6abd('0xb4')](_0x4b6505);}})[_0x6abd('0x21')](function(_0x39efe2){if(_0x39efe2){_0x10bb1d=_0x39efe2['length'];if(!_0x333144[_0x6abd('0x46')][_0x6abd('0x67')]('nolimit')){_0x4b6505[_0x6abd('0x4a')]=qs['limit'](_0x333144['query'][_0x6abd('0x4a')]);_0x4b6505[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x333144['query'][_0x6abd('0x31')]);}return _0x181fed[_0x6abd('0xb4')](_0x4b6505);}})['then'](function(_0x299b5a){if(_0x299b5a){return _0x299b5a?{'count':_0x10bb1d,'rows':_0x299b5a}:null;}})['then'](respondWithResult(_0x26b134,null))[_0x6abd('0x2c')](handleError(_0x26b134,null));};exports[_0x6abd('0xb5')]=function(_0x5aa787,_0xd68588,_0x3ca06d){var _0x46f8de={'raw':![],'where':{}};var _0x40f60e={};var _0x38af21={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6abd('0x6c')]({'where':{'id':_0x5aa787[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0xd68588,null))[_0x6abd('0x21')](function(_0x3dc7f1){if(_0x3dc7f1){_0x40f60e[_0x6abd('0x44')]=_['keys'](db[_0x6abd('0xb6')][_0x6abd('0x40')]);_0x40f60e[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x5aa787[_0x6abd('0x46')]);_0x40f60e['filters']=_[_0x6abd('0x48')](_0x40f60e[_0x6abd('0x44')],_0x40f60e['query']);_0x46f8de[_0x6abd('0x47')]=_['intersection'](_0x40f60e['model'],qs[_0x6abd('0x49')](_0x5aa787['query'][_0x6abd('0x49')]));_0x46f8de[_0x6abd('0x47')]=_0x46f8de[_0x6abd('0x47')][_0x6abd('0x66')]?_0x46f8de['attributes']:_0x40f60e[_0x6abd('0x44')];if(!_0x5aa787['query'][_0x6abd('0x67')]('nolimit')){_0x46f8de[_0x6abd('0x4a')]=qs['limit'](_0x5aa787['query'][_0x6abd('0x4a')]);_0x46f8de['offset']=qs[_0x6abd('0x31')](_0x5aa787[_0x6abd('0x46')][_0x6abd('0x31')]);}_0x46f8de[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x5aa787[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x46f8de[_0x6abd('0x4d')]=qs[_0x6abd('0x4f')](_[_0x6abd('0x4e')](_0x5aa787[_0x6abd('0x46')],_0x40f60e[_0x6abd('0x4f')]));_0x46f8de[_0x6abd('0x4d')][_0x6abd('0x63')]=_0x3dc7f1['id'];if(_0x5aa787[_0x6abd('0x46')][_0x6abd('0x52')]){_0x46f8de['where']=_[_0x6abd('0x50')](_0x46f8de[_0x6abd('0x4d')],{'$or':_[_0x6abd('0x3e')](_0x46f8de['attributes'],function(_0xa45c6a){var _0x5eecbc={};_0x5eecbc[_0xa45c6a]={'$like':'%'+_0x5aa787['query'][_0x6abd('0x52')]+'%'};return _0x5eecbc;})});}_0x46f8de=_['merge']({},_0x46f8de,_0x5aa787[_0x6abd('0x53')]);return db[_0x6abd('0xb6')]['count']({'where':_0x46f8de[_0x6abd('0x4d')]})[_0x6abd('0x21')](function(_0x1af6dc){_0x38af21[_0x6abd('0x30')]=_0x1af6dc;if(_0x5aa787[_0x6abd('0x46')]['includeAll']){_0x46f8de[_0x6abd('0x55')]=[{'model':db[_0x6abd('0x78')],'as':_0x6abd('0xb7'),'required':![]},{'model':db[_0x6abd('0xb8')],'as':_0x6abd('0xb9'),'attributes':[_0x6abd('0x3b'),_0x6abd('0xba'),_0x6abd('0xbb')],'required':![]},{'model':db[_0x6abd('0xbc')],'as':_0x6abd('0xbd'),'attributes':['id','name',_0x6abd('0xbe')],'where':_0x5aa787[_0x6abd('0x46')][_0x6abd('0xbf')]?{'id':_0x5aa787[_0x6abd('0x46')][_0x6abd('0xbf')]}:undefined,'required':_0x5aa787[_0x6abd('0x46')][_0x6abd('0xbf')]?!![]:![]}];}return db[_0x6abd('0xb6')]['findAll'](_0x46f8de);})[_0x6abd('0x21')](function(_0x106257){_0x38af21[_0x6abd('0x6e')]=_0x106257;return _0x38af21;});}})['then'](respondWithFilteredResult(_0xd68588,_0x46f8de))[_0x6abd('0x2c')](handleError(_0xd68588,null));};exports[_0x6abd('0xad')]=function(_0x100cd6,_0x47e85b,_0x3b93b6){var _0xedb800,_0x451a61,_0x213517;if(_[_0x6abd('0x95')](_0x100cd6[_0x6abd('0x5a')][_0x6abd('0x5a')])||_0x100cd6[_0x6abd('0x5a')][_0x6abd('0x5a')]===''){throw new db['Sequelize'][(_0x6abd('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x100cd6[_0x6abd('0x5a')]['to'])){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))]('to\x20is\x20mandatory');}_0xedb800=_0x100cd6[_0x6abd('0x5a')]['to'];return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x100cd6[_0x6abd('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x6abd('0xc0'),'include':[{'model':db['CmContact'],'as':_0x6abd('0x99'),'where':{'mobile':_0xedb800},'limit':0x1,'order':[[_0x6abd('0x7d'),_0x6abd('0xc1')]]}]}]})[_0x6abd('0x21')](handleEntityNotFound(_0x47e85b,null))[_0x6abd('0x21')](function(_0x50dc5a){if(_0x50dc5a&&_0x50dc5a[_0x6abd('0xc0')]){_0x451a61=_0x50dc5a[_0x6abd('0x37')]({'plain':!![]});if(_0x451a61[_0x6abd('0xc0')]&&_0x451a61[_0x6abd('0xc0')][_0x6abd('0x99')][_0x6abd('0x66')]){return _0x451a61[_0x6abd('0xc0')][_0x6abd('0x99')][0x0];}return db[_0x6abd('0x78')][_0x6abd('0x59')](_[_0x6abd('0x19')](_0x100cd6[_0x6abd('0x5a')],{'firstName':_0xedb800,'mobile':_0xedb800,'phone':_0xedb800,'ListId':_0x451a61['ListId']}));}})[_0x6abd('0x21')](handleEntityNotFound(_0x47e85b,null))['then'](function(_0x9c7325){if(_0x9c7325){_0x213517=_0x9c7325;return db['SmsInteraction'][_0x6abd('0x58')]({'where':{'ContactId':_0x213517['id'],'closed':![],'SmsAccountId':_0x451a61['id']}})[_0x6abd('0x21')](function(_0x14447b){if(_0x14447b){return[_0x14447b,![]];}return db[_0x6abd('0xb6')][_0x6abd('0x59')]({'UserId':_0x100cd6['user']['id'],'ContactId':_0x213517['id'],'SmsAccountId':_0x451a61['id'],'phone':_0xedb800,'firstMsgDirection':_0x6abd('0xc2'),'Messages':[_[_0x6abd('0x50')](_0x100cd6[_0x6abd('0x5a')],{'read':![],'body':_0x100cd6[_0x6abd('0x5a')][_0x6abd('0x5a')],'phone':_0xedb800,'SmsAccountId':_0x451a61['id'],'UserId':_0x100cd6['user']['id'],'ContactId':_0x213517['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6abd('0xc3')}]})[_0x6abd('0x21')](function(_0xb02f1d){return[_0xb02f1d,!![]];});});}})[_0x6abd('0x9a')](function(_0x3c31ec,_0x49031b){if(_0x49031b){return _0x3c31ec;}return db[_0x6abd('0xa1')][_0x6abd('0x59')](_['merge'](_0x100cd6['body'],{'read':![],'body':_0x100cd6['body'][_0x6abd('0x5a')],'phone':_0xedb800,'SmsAccountId':_0x451a61['id'],'SmsInteractionId':_0x3c31ec['id'],'UserId':_0x100cd6['user']['id'],'ContactId':_0x213517['id']}))[_0x6abd('0x21')](function(_0x1e409e){_0x3c31ec['dataValues'][_0x6abd('0xc3')]=[];_0x3c31ec[_0x6abd('0xc4')][_0x6abd('0xc3')]['push'](_0x1e409e[_0x6abd('0xc4')]);return _0x3c31ec;});})[_0x6abd('0x21')](respondWithResult(_0x47e85b,null))['catch'](handleError(_0x47e85b,null));};exports[_0x6abd('0x2e')]=function(_0x4ad2c9,_0x3511c2,_0x41766a){if(_0x4ad2c9[_0x6abd('0x5a')]['id']){delete _0x4ad2c9[_0x6abd('0x5a')]['id'];}console[_0x6abd('0xc5')](_0x6abd('0xc6'),_0x4ad2c9[_0x6abd('0x5a')]);var _0x597a41,_0x97412f,_0x384dd4;return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x4ad2c9['params']['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x3511c2,null))[_0x6abd('0x21')](function(_0x65ddb7){if(_0x65ddb7){_0x384dd4=_0x65ddb7;logger[_0x6abd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6abd('0x2e'),_0x6abd('0xc7'),_0x65ddb7[_0x6abd('0x42')],util[_0x6abd('0xc8')](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));switch(_0x65ddb7[_0x6abd('0x42')]){case _0x6abd('0x85'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xc9')]&&_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x2e')]){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')]['status'];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xc9')]}});}break;case _0x6abd('0x87'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xca')]&&_0x4ad2c9[_0x6abd('0x5a')]['statusInt']){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xcb')];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xca')]}});}break;case _0x6abd('0xcc'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x89')]&&_0x4ad2c9['body'][_0x6abd('0xcd')]){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xcd')];return db[_0x6abd('0xa1')]['find']({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x89')]}});}break;case _0x6abd('0x8b'):var _0x23c91a=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x8c')][0x0];if(_0x23c91a['messageId']&&_0x23c91a[_0x6abd('0x2e')][_0x6abd('0xce')]===_0x6abd('0xcf')){_0x97412f=_0x23c91a['status']['groupName'];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x23c91a[_0x6abd('0x88')]}});}break;case _0x6abd('0x8f'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x88')]&&_0x4ad2c9[_0x6abd('0x5a')]['status']){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x2e')];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x88')]}});}break;case'intelepeer':if(_0x4ad2c9[_0x6abd('0x5a')]['redif']&&_0x4ad2c9['body'][_0x6abd('0x2e')]){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x2e')];return db[_0x6abd('0xa1')]['find']({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xd0')]}});}break;}}})[_0x6abd('0x21')](handleEntityNotFound(_0x3511c2,null))['then'](function(_0x5b1803){if(_0x5b1803){_0x597a41=_0x5b1803;switch(_0x384dd4[_0x6abd('0x42')]){case _0x6abd('0x85'):if(_0x97412f===_0x6abd('0xcf')){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0x85'),util['inspect'](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x97412f==='1'){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger['error'](_0x6abd('0x25'),'status',_0x6abd('0x85'),util['inspect'](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6abd('0xcc'):if(!_0x4ad2c9['body'][_0x6abd('0xd1')]&&_0x97412f>=0xc8&&_0x97412f<=0xce){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger['error'](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0xcc'),util[_0x6abd('0xc8')](_0x4ad2c9['body'],{'showHidden':![],'depth':null}));}break;case _0x6abd('0x8b'):var _0x48d5f2=_0x4ad2c9[_0x6abd('0x5a')]['results'][0x0];if(_0x48d5f2[_0x6abd('0x2e')][_0x6abd('0xce')]==='DELIVERED'){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),'status','infobip',util[_0x6abd('0xc8')](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6abd('0x8f'):if(_0x97412f==_0x6abd('0xd2')||_0x97412f=='RECEIVED_BY_RECIPIENT'){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0x8f'),util['inspect'](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6abd('0x92'):if(_0x97412f===_0x6abd('0xd3')||_0x97412f===_0x6abd('0xd4')){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0x92'),util[_0x6abd('0xc8')](_0x4ad2c9['body'],{'showHidden':![],'depth':null}));}break;}return _0x597a41;}})['then'](respondWithResult(_0x3511c2,null))[_0x6abd('0x2c')](handleError(_0x3511c2,null));};exports['statusGet']=function(_0x56a06e,_0x131c9a,_0x44db41){var _0x31eed1,_0x4ec23f,_0x31b1e3;return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x56a06e[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0x131c9a,null))['then'](function(_0x18b8e1){if(_0x18b8e1){_0x31b1e3=_0x18b8e1;logger[_0x6abd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6abd('0x2e'),_0x6abd('0xc7'),_0x18b8e1['type'],util[_0x6abd('0xc8')](_0x56a06e[_0x6abd('0x46')],{'showHidden':![],'depth':null}));switch(_0x18b8e1['type']){case _0x6abd('0xd5'):if(_0x56a06e[_0x6abd('0x46')][_0x6abd('0xd6')]&&_0x56a06e[_0x6abd('0x46')][_0x6abd('0xd7')]){_0x4ec23f=_0x56a06e[_0x6abd('0x46')][_0x6abd('0xd7')];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x56a06e['query'][_0x6abd('0xd6')]}});}break;}}})[_0x6abd('0x21')](handleEntityNotFound(_0x131c9a,null))[_0x6abd('0x21')](function(_0x1828ac){if(_0x1828ac){_0x31eed1=_0x1828ac;switch(_0x31b1e3[_0x6abd('0x42')]){case'csc':if(_0x4ec23f==='2'||_0x4ec23f==='6'){return _0x31eed1[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0xd5'),util['inspect'](_0x56a06e[_0x6abd('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x31eed1;}})[_0x6abd('0x21')](respondWithResult(_0x131c9a,null))[_0x6abd('0x2c')](handleError(_0x131c9a,null));};exports['addAgents']=function(_0x3f4cc2,_0x1b5019,_0x4e9a86){return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x3f4cc2['params']['id']}})['then'](handleEntityNotFound(_0x1b5019,null))[_0x6abd('0x21')](function(_0x20df8c){if(_0x20df8c){return _0x20df8c[_0x6abd('0xd8')](_0x3f4cc2[_0x6abd('0x5a')][_0x6abd('0x6a')],_[_0x6abd('0xd9')](_0x3f4cc2[_0x6abd('0x5a')],[_0x6abd('0x6a'),'id'])||{})[_0x6abd('0x9a')](function(_0xef90c9){for(var _0x52ca41=0x0;_0x52ca41<_0x3f4cc2[_0x6abd('0x5a')]['ids']['length'];_0x52ca41+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x3f4cc2[_0x6abd('0x5a')]['ids'][_0x52ca41],'SmsAccountId':_0x3f4cc2[_0x6abd('0x57')]['id']});}return _0xef90c9;});}})['then'](respondWithResult(_0x1b5019,null))[_0x6abd('0x2c')](handleError(_0x1b5019,null));};exports['removeAgents']=function(_0x3847e3,_0x25f300,_0x1eeb45){return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x3847e3[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x25f300,null))['then'](function(_0xeaa7d8){if(_0xeaa7d8){return _0xeaa7d8['removeAgents'](_0x3847e3['query'][_0x6abd('0x6a')])[_0x6abd('0x21')](function(){if(_[_0x6abd('0xda')](_0x3847e3[_0x6abd('0x46')]['ids'])){for(var _0x46442a=0x0;_0x46442a<_0x3847e3['query']['ids'][_0x6abd('0x66')];_0x46442a+=0x1){socket[_0x6abd('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x3847e3['query'][_0x6abd('0x6a')][_0x46442a]),'SmsAccountId':Number(_0x3847e3[_0x6abd('0x57')]['id'])});}}else{socket[_0x6abd('0xdb')](_0x6abd('0xdc'),{'UserId':Number(_0x3847e3['query'][_0x6abd('0x6a')]),'SmsAccountId':Number(_0x3847e3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x25f300,null))[_0x6abd('0x2c')](handleError(_0x25f300,null));};exports[_0x6abd('0xdd')]=function(_0x72dd1b,_0x16b711,_0x4686a9){var _0x285d1c={};var _0x3026f5={};var _0x3e1a1d;var _0x40e55f;return db[_0x6abd('0x3f')]['findOne']({'where':{'id':_0x72dd1b['params']['id']}})['then'](handleEntityNotFound(_0x16b711,null))['then'](function(_0x38008e){if(_0x38008e){_0x3e1a1d=_0x38008e;_0x3026f5[_0x6abd('0x44')]=_[_0x6abd('0x45')](db[_0x6abd('0xb8')][_0x6abd('0x40')]);_0x3026f5[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x72dd1b['query']);_0x3026f5[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x3026f5['model'],_0x3026f5[_0x6abd('0x46')]);_0x285d1c['attributes']=_[_0x6abd('0x48')](_0x3026f5[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x72dd1b['query'][_0x6abd('0x49')]));_0x285d1c[_0x6abd('0x47')]=_0x285d1c[_0x6abd('0x47')][_0x6abd('0x66')]?_0x285d1c[_0x6abd('0x47')]:_0x3026f5[_0x6abd('0x44')];_0x285d1c['order']=qs['sort'](_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x285d1c[_0x6abd('0x4d')]=qs['filters'](_[_0x6abd('0x4e')](_0x72dd1b[_0x6abd('0x46')],_0x3026f5[_0x6abd('0x4f')]));if(_0x72dd1b[_0x6abd('0x46')]['filter']){_0x285d1c['where']=_[_0x6abd('0x50')](_0x285d1c['where'],{'$or':_[_0x6abd('0x3e')](_0x285d1c[_0x6abd('0x47')],function(_0x38d178){var _0x3d2830={};_0x3d2830[_0x38d178]={'$like':'%'+_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x3d2830;})});}_0x285d1c=_[_0x6abd('0x50')]({},_0x285d1c,_0x72dd1b[_0x6abd('0x53')]);return _0x3e1a1d['getAgents'](_0x285d1c);}})[_0x6abd('0x21')](function(_0x47df87){if(_0x47df87){_0x40e55f=_0x47df87[_0x6abd('0x66')];if(!_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x67')](_0x6abd('0x68'))){_0x285d1c[_0x6abd('0x4a')]=qs[_0x6abd('0x4a')](_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x4a')]);_0x285d1c[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x31')]);}return _0x3e1a1d[_0x6abd('0xdd')](_0x285d1c);}})[_0x6abd('0x21')](function(_0x97145f){if(_0x97145f){return _0x97145f?{'count':_0x40e55f,'rows':_0x97145f}:null;}})[_0x6abd('0x21')](respondWithResult(_0x16b711,null))['catch'](handleError(_0x16b711,null));}; \ No newline at end of file +var _0xdf5e=['createdAt','updatedAt','CompanyId','ListId','twilio','from','From','MessageSid','sender','clicksend','message_id','plivo','messageId','MessageUUID','infobip','results','text','segmentedMessage','fromNumber','replyMessageId','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','omit','SmsInteraction','spread','interaction','autoclose','push','unmanaged','*,*,*,*','created','SmsMessage','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','\x0a','addApplications','findOne','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','DESC','List','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','requestid','status_code','groupName','DELIVERED','clickatell','intelepeer','redif','skebby','error_code','RECEIVED_BY_RECIPIENT','ACCEPTD','csc','message-id','state','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','SmsAccount','include','findAll','rows','Pause','rawAttributes','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','pick','includeAll','removeDispositions','CannedAnswer','getAnswers','ids','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','difference'];(function(_0x1b87a5,_0x5875ef){var _0x212666=function(_0x49f640){while(--_0x49f640){_0x1b87a5['push'](_0x1b87a5['shift']());}};_0x212666(++_0x5875ef);}(_0xdf5e,0x136));var _0xedf5=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0xdf5e[_0x6287b6];return _0x5d6be4;};'use strict';var pdf=require(_0xedf5('0x0'));var emlformat=require(_0xedf5('0x1'));var rimraf=require(_0xedf5('0x2'));var zipdir=require(_0xedf5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedf5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xedf5('0x5'));var util=require('util');var path=require(_0xedf5('0x6'));var sox=require(_0xedf5('0x7'));var csv=require(_0xedf5('0x8'));var ejs=require(_0xedf5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xedf5('0xa'));var crypto=require(_0xedf5('0xb'));var jsforce=require(_0xedf5('0xc'));var deskjs=require(_0xedf5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xedf5('0xe'));var Papa=require(_0xedf5('0xf'));var Redis=require(_0xedf5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xedf5('0x11'));var as=require(_0xedf5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedf5('0x13'))('api');var utils=require(_0xedf5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xedf5('0x15'))['db'];config[_0xedf5('0x16')]=_[_0xedf5('0x17')](config['redis'],{'host':_0xedf5('0x18'),'port':0x18eb});var socket=require(_0xedf5('0x19'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);var jayson=require(_0xedf5('0x1a'));var client=jayson[_0xedf5('0x1b')][_0xedf5('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x27c139,_0x1f9cf6,_0x4b4d13,_0x18349a){return new BPromise(function(_0x5d4ea9,_0x2eb876){var _0x265b87=_0x18349a||client;return _0x265b87['request'](_0x27c139,_0x4b4d13)['then'](function(_0x4a2add){logger[_0xedf5('0x1d')](_0xedf5('0x1e'),_0x1f9cf6,'request\x20sent');logger['debug'](_0xedf5('0x1f'),_0x1f9cf6,'request\x20sent',JSON['stringify'](_0x4a2add));if(_0x4a2add[_0xedf5('0x20')]){if(_0x4a2add[_0xedf5('0x20')][_0xedf5('0x21')]===0x1f4){logger[_0xedf5('0x20')]('SmsAccount,\x20%s,\x20%s',_0x1f9cf6,_0x4a2add['error']['message']);return _0x2eb876(_0x4a2add[_0xedf5('0x20')][_0xedf5('0x22')]);}logger['error'](_0xedf5('0x1e'),_0x1f9cf6,_0x4a2add['error'][_0xedf5('0x22')]);return _0x5d4ea9(_0x4a2add[_0xedf5('0x20')][_0xedf5('0x22')]);}else{logger[_0xedf5('0x1d')]('SmsAccount,\x20%s,\x20%s',_0x1f9cf6,'request\x20sent');_0x5d4ea9(_0x4a2add[_0xedf5('0x23')]['message']);}})[_0xedf5('0x24')](function(_0x5e9e3d){logger[_0xedf5('0x20')](_0xedf5('0x1e'),_0x1f9cf6,_0x5e9e3d);_0x2eb876(_0x5e9e3d);});});}function respondWithStatusCode(_0x5e944d,_0x5c6a0f){_0x5c6a0f=_0x5c6a0f||0xcc;return function(_0x3beb5a){if(_0x3beb5a){return _0x5e944d['sendStatus'](_0x5c6a0f);}return _0x5e944d['status'](_0x5c6a0f)[_0xedf5('0x25')]();};}function respondWithResult(_0x5aa146,_0x8735cc){_0x8735cc=_0x8735cc||0xc8;return function(_0x404d4f){if(_0x404d4f){return _0x5aa146[_0xedf5('0x26')](_0x8735cc)[_0xedf5('0x27')](_0x404d4f);}};}function respondWithFilteredResult(_0x23b4d6,_0x37ee7f){return function(_0x468be4){if(_0x468be4){var _0x7b06c4=_0x468be4[_0xedf5('0x28')],_0x3eb834=_0x37ee7f[_0xedf5('0x29')],_0x1539ae=_0x37ee7f['offset']+_0x37ee7f[_0xedf5('0x2a')],_0x3234fd;if(_0x1539ae>=_0x7b06c4){_0x1539ae=_0x7b06c4;_0x3234fd=0xc8;}else{_0x3234fd=0xce;}_0x23b4d6[_0xedf5('0x26')](_0x3234fd);return _0x23b4d6[_0xedf5('0x2b')]('Content-Range',_0x3eb834+'-'+_0x1539ae+'/'+_0x7b06c4)[_0xedf5('0x27')](_0x468be4);}return null;};}function patchUpdates(_0x148a71){return function(_0x47b899){try{jsonpatch[_0xedf5('0x2c')](_0x47b899,_0x148a71,!![]);}catch(_0x2abb0a){return BPromise[_0xedf5('0x2d')](_0x2abb0a);}return _0x47b899[_0xedf5('0x2e')]();};}function saveUpdates(_0x26f8c7,_0x4a6545){return function(_0x5d30ba){if(_0x5d30ba){return _0x5d30ba[_0xedf5('0x2f')](_0x26f8c7)[_0xedf5('0x30')](function(_0x2218a1){return _0x2218a1;});}return null;};}function removeEntity(_0x534fd0,_0x1387fb){return function(_0x4914ee){if(_0x4914ee){return _0x4914ee[_0xedf5('0x31')]()[_0xedf5('0x30')](function(){var _0x40b146=_0x4914ee[_0xedf5('0x32')]({'plain':!![]});var _0x228740=_0xedf5('0x33');return db[_0xedf5('0x34')][_0xedf5('0x31')]({'where':{'type':_0x228740,'resourceId':_0x40b146['id']}})['then'](function(){return _0x4914ee;});})[_0xedf5('0x30')](function(){_0x534fd0[_0xedf5('0x26')](0xcc)[_0xedf5('0x25')]();});}};}function handleEntityNotFound(_0x5144e0,_0x3e2b7f){return function(_0xa7375){if(!_0xa7375){_0x5144e0['sendStatus'](0x194);}return _0xa7375;};}function handleError(_0x45e805,_0x3699d4){_0x3699d4=_0x3699d4||0x1f4;return function(_0x5eaf08){logger[_0xedf5('0x20')](_0x5eaf08[_0xedf5('0x35')]);if(_0x5eaf08[_0xedf5('0x36')]){delete _0x5eaf08['name'];}_0x45e805[_0xedf5('0x26')](_0x3699d4)[_0xedf5('0x37')](_0x5eaf08);};}exports['index']=function(_0x1485bb,_0x469c2c){var _0xcdda13={'include':[{'model':db['Pause'],'as':_0xedf5('0x38')}]},_0x877e0d={},_0x1bab04={'count':0x0,'rows':[]};var _0x7ab15e=_[_0xedf5('0x39')](db['SmsAccount']['rawAttributes'],function(_0x2d5c29){return{'name':_0x2d5c29[_0xedf5('0x3a')],'type':_0x2d5c29[_0xedf5('0x3b')][_0xedf5('0x3c')]};});_0x877e0d[_0xedf5('0x3d')]=_[_0xedf5('0x39')](_0x7ab15e,'name');_0x877e0d[_0xedf5('0x3e')]=_[_0xedf5('0x3f')](_0x1485bb['query']);_0x877e0d[_0xedf5('0x40')]=_[_0xedf5('0x41')](_0x877e0d[_0xedf5('0x3d')],_0x877e0d[_0xedf5('0x3e')]);_0xcdda13[_0xedf5('0x42')]=_[_0xedf5('0x41')](_0x877e0d[_0xedf5('0x3d')],qs[_0xedf5('0x43')](_0x1485bb[_0xedf5('0x3e')][_0xedf5('0x43')]));_0xcdda13[_0xedf5('0x42')]=_0xcdda13[_0xedf5('0x42')][_0xedf5('0x44')]?_0xcdda13[_0xedf5('0x42')]:_0x877e0d['model'];if(!_0x1485bb[_0xedf5('0x3e')][_0xedf5('0x45')](_0xedf5('0x46'))){_0xcdda13['limit']=qs[_0xedf5('0x2a')](_0x1485bb['query'][_0xedf5('0x2a')]);_0xcdda13['offset']=qs[_0xedf5('0x29')](_0x1485bb['query'][_0xedf5('0x29')]);}_0xcdda13[_0xedf5('0x47')]=qs[_0xedf5('0x48')](_0x1485bb[_0xedf5('0x3e')][_0xedf5('0x48')]);_0xcdda13['where']=qs['filters'](_['pick'](_0x1485bb[_0xedf5('0x3e')],_0x877e0d[_0xedf5('0x40')]),_0x7ab15e);if(_0x1485bb[_0xedf5('0x3e')]['filter']){_0xcdda13[_0xedf5('0x49')]=_['merge'](_0xcdda13[_0xedf5('0x49')],{'$or':_[_0xedf5('0x39')](_0x7ab15e,function(_0x3b5b67){if(_0x3b5b67['type']!==_0xedf5('0x4a')){var _0x1b3ebe={};_0x1b3ebe[_0x3b5b67['name']]={'$like':'%'+_0x1485bb[_0xedf5('0x3e')][_0xedf5('0x4b')]+'%'};return _0x1b3ebe;}})});}_0xcdda13=_['merge']({},_0xcdda13,_0x1485bb[_0xedf5('0x4c')]);var _0x563acf={'where':_0xcdda13[_0xedf5('0x49')]};return db[_0xedf5('0x4d')][_0xedf5('0x28')](_0x563acf)[_0xedf5('0x30')](function(_0x42b3a8){_0x1bab04[_0xedf5('0x28')]=_0x42b3a8;if(_0x1485bb[_0xedf5('0x3e')]['includeAll']){_0xcdda13[_0xedf5('0x4e')]=[{'all':!![]}];}return db[_0xedf5('0x4d')][_0xedf5('0x4f')](_0xcdda13);})['then'](function(_0xfae883){_0x1bab04[_0xedf5('0x50')]=_0xfae883;return _0x1bab04;})['then'](respondWithFilteredResult(_0x469c2c,_0xcdda13))[_0xedf5('0x24')](handleError(_0x469c2c,null));};exports['show']=function(_0x300b51,_0x2c13de){var _0x17ba64={'raw':![],'where':{'id':_0x300b51['params']['id']},'include':[{'model':db[_0xedf5('0x51')],'as':'mandatoryDispositionPause'}]},_0x28d9b2={};_0x28d9b2[_0xedf5('0x3d')]=_[_0xedf5('0x3f')](db[_0xedf5('0x4d')][_0xedf5('0x52')]);_0x28d9b2[_0xedf5('0x3e')]=_['keys'](_0x300b51[_0xedf5('0x3e')]);_0x28d9b2[_0xedf5('0x40')]=_[_0xedf5('0x41')](_0x28d9b2[_0xedf5('0x3d')],_0x28d9b2[_0xedf5('0x3e')]);_0x17ba64[_0xedf5('0x42')]=_['intersection'](_0x28d9b2[_0xedf5('0x3d')],qs[_0xedf5('0x43')](_0x300b51[_0xedf5('0x3e')][_0xedf5('0x43')]));_0x17ba64['attributes']=_0x17ba64[_0xedf5('0x42')]['length']?_0x17ba64[_0xedf5('0x42')]:_0x28d9b2[_0xedf5('0x3d')];if(_0x300b51[_0xedf5('0x3e')]['includeAll']){_0x17ba64['include']=[{'all':!![]}];}_0x17ba64=_[_0xedf5('0x53')]({},_0x17ba64,_0x300b51[_0xedf5('0x4c')]);return db['SmsAccount'][_0xedf5('0x54')](_0x17ba64)[_0xedf5('0x30')](handleEntityNotFound(_0x2c13de,null))[_0xedf5('0x30')](respondWithResult(_0x2c13de,null))[_0xedf5('0x24')](handleError(_0x2c13de,null));};exports['create']=function(_0x4081c9,_0x24c589){return db[_0xedf5('0x4d')][_0xedf5('0x55')](_0x4081c9[_0xedf5('0x56')],{})[_0xedf5('0x30')](function(_0x50d99e){var _0x3b0758=_0x4081c9['user'][_0xedf5('0x32')]({'plain':!![]});if(!_0x3b0758)throw new Error(_0xedf5('0x57'));if(_0x3b0758['role']===_0xedf5('0x58')){var _0x327027=_0x50d99e[_0xedf5('0x32')]({'plain':!![]});var _0x565cf5=_0xedf5('0x33');return db[_0xedf5('0x59')][_0xedf5('0x54')]({'where':{'name':_0x565cf5,'userProfileId':_0x3b0758[_0xedf5('0x5a')]},'raw':!![]})[_0xedf5('0x30')](function(_0x1a825d){if(_0x1a825d&&_0x1a825d[_0xedf5('0x5b')]===0x0){return db[_0xedf5('0x34')][_0xedf5('0x55')]({'name':_0x327027[_0xedf5('0x36')],'resourceId':_0x327027['id'],'type':_0x1a825d[_0xedf5('0x36')],'sectionId':_0x1a825d['id']},{})[_0xedf5('0x30')](function(){return _0x50d99e;});}else{return _0x50d99e;}})[_0xedf5('0x24')](function(_0xf99312){logger[_0xedf5('0x20')](_0xedf5('0x5c'),_0xf99312);throw _0xf99312;});}return _0x50d99e;})[_0xedf5('0x30')](respondWithResult(_0x24c589,0xc9))[_0xedf5('0x24')](handleError(_0x24c589,null));};exports[_0xedf5('0x2f')]=function(_0x282e9e,_0x226637){if(_0x282e9e['body']['id']){delete _0x282e9e['body']['id'];}return db[_0xedf5('0x4d')][_0xedf5('0x54')]({'where':{'id':_0x282e9e[_0xedf5('0x5d')]['id']},'include':[{'model':db[_0xedf5('0x51')],'as':_0xedf5('0x38')}]})[_0xedf5('0x30')](handleEntityNotFound(_0x226637,null))['then'](saveUpdates(_0x282e9e['body'],null))[_0xedf5('0x30')](respondWithResult(_0x226637,null))['catch'](handleError(_0x226637,null));};exports[_0xedf5('0x31')]=function(_0xa52506,_0x8a84ba){return db[_0xedf5('0x4d')]['find']({'where':{'id':_0xa52506[_0xedf5('0x5d')]['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x8a84ba,null))[_0xedf5('0x30')](removeEntity(_0x8a84ba,null))[_0xedf5('0x24')](handleError(_0x8a84ba,null));};exports[_0xedf5('0x5e')]=function(_0x1b0ab5,_0x47c511){return db['SmsAccount'][_0xedf5('0x5e')]()['then'](respondWithResult(_0x47c511,null))[_0xedf5('0x24')](handleError(_0x47c511,null));};exports[_0xedf5('0x5f')]=function(_0x575aa5,_0x789f4b,_0x755d0e){if(_0x575aa5[_0xedf5('0x56')]['id']){delete _0x575aa5['body']['id'];}return db[_0xedf5('0x4d')][_0xedf5('0x54')]({'where':{'id':_0x575aa5['params']['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x789f4b,null))[_0xedf5('0x30')](function(_0x1c263c){if(_0x1c263c){_0x575aa5[_0xedf5('0x56')][_0xedf5('0x60')]=_0x1c263c['id'];return db[_0xedf5('0x61')][_0xedf5('0x55')](_0x575aa5[_0xedf5('0x56')]);}})[_0xedf5('0x30')](respondWithResult(_0x789f4b,null))[_0xedf5('0x24')](handleError(_0x789f4b,null));};exports[_0xedf5('0x62')]=function(_0xee5aa0,_0x274b28,_0x4180a9){var _0x41f313={'raw':![],'where':{}};var _0x6ba2a5={};var _0x4e5ec6={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xee5aa0[_0xedf5('0x5d')]['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x274b28,null))[_0xedf5('0x30')](function(_0x41b6ea){if(_0x41b6ea){_0x6ba2a5[_0xedf5('0x3d')]=_[_0xedf5('0x3f')](db[_0xedf5('0x61')]['rawAttributes']);_0x6ba2a5[_0xedf5('0x3e')]=_[_0xedf5('0x3f')](_0xee5aa0['query']);_0x6ba2a5[_0xedf5('0x40')]=_[_0xedf5('0x41')](_0x6ba2a5[_0xedf5('0x3d')],_0x6ba2a5[_0xedf5('0x3e')]);_0x41f313[_0xedf5('0x42')]=_[_0xedf5('0x41')](_0x6ba2a5['model'],qs[_0xedf5('0x43')](_0xee5aa0['query'][_0xedf5('0x43')]));_0x41f313[_0xedf5('0x42')]=_0x41f313[_0xedf5('0x42')][_0xedf5('0x44')]?_0x41f313['attributes']:_0x6ba2a5[_0xedf5('0x3d')];if(!_0xee5aa0[_0xedf5('0x3e')][_0xedf5('0x45')](_0xedf5('0x46'))){_0x41f313[_0xedf5('0x2a')]=qs[_0xedf5('0x2a')](_0xee5aa0[_0xedf5('0x3e')][_0xedf5('0x2a')]);_0x41f313[_0xedf5('0x29')]=qs[_0xedf5('0x29')](_0xee5aa0[_0xedf5('0x3e')][_0xedf5('0x29')]);}_0x41f313['order']=qs[_0xedf5('0x48')](_0xee5aa0[_0xedf5('0x3e')]['sort']);_0x41f313[_0xedf5('0x49')]=qs['filters'](_[_0xedf5('0x63')](_0xee5aa0[_0xedf5('0x3e')],_0x6ba2a5[_0xedf5('0x40')]));_0x41f313['where']['SmsAccountId']=_0x41b6ea['id'];if(_0xee5aa0[_0xedf5('0x3e')][_0xedf5('0x4b')]){_0x41f313['where']=_['merge'](_0x41f313[_0xedf5('0x49')],{'$or':_['map'](_0x41f313[_0xedf5('0x42')],function(_0x52ab36){var _0x164f92={};_0x164f92[_0x52ab36]={'$like':'%'+_0xee5aa0['query'][_0xedf5('0x4b')]+'%'};return _0x164f92;})});}_0x41f313=_[_0xedf5('0x53')]({},_0x41f313,_0xee5aa0[_0xedf5('0x4c')]);return db[_0xedf5('0x61')][_0xedf5('0x28')]({'where':_0x41f313[_0xedf5('0x49')]})['then'](function(_0x580216){_0x4e5ec6['count']=_0x580216;if(_0xee5aa0[_0xedf5('0x3e')][_0xedf5('0x64')]){_0x41f313['include']=[{'all':!![]}];}return db[_0xedf5('0x61')][_0xedf5('0x4f')](_0x41f313);})[_0xedf5('0x30')](function(_0x2715e7){_0x4e5ec6[_0xedf5('0x50')]=_0x2715e7;return _0x4e5ec6;});}})[_0xedf5('0x30')](respondWithFilteredResult(_0x274b28,_0x41f313))[_0xedf5('0x24')](handleError(_0x274b28,null));};exports[_0xedf5('0x65')]=function(_0x1b7aaa,_0xe59666,_0x45d8da){return db[_0xedf5('0x4d')][_0xedf5('0x54')]({'where':{'id':_0x1b7aaa[_0xedf5('0x5d')]['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0xe59666,null))['then'](function(_0x15dfa2){if(_0x15dfa2){return _0x15dfa2[_0xedf5('0x65')](_0x1b7aaa[_0xedf5('0x3e')]['ids']);}})[_0xedf5('0x30')](respondWithStatusCode(_0xe59666,null))['catch'](handleError(_0xe59666,null));};exports['addAnswer']=function(_0x5570c3,_0x5c5c08,_0x42cf9a){if(_0x5570c3[_0xedf5('0x56')]['id']){delete _0x5570c3['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5570c3['params']['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x5c5c08,null))[_0xedf5('0x30')](function(_0x47b73c){if(_0x47b73c){_0x5570c3['body'][_0xedf5('0x60')]=_0x47b73c['id'];return db[_0xedf5('0x66')][_0xedf5('0x55')](_0x5570c3[_0xedf5('0x56')]);}})['then'](respondWithResult(_0x5c5c08,null))['catch'](handleError(_0x5c5c08,null));};exports[_0xedf5('0x67')]=function(_0x12f728,_0x5ca7f3,_0x4af34c){var _0x1964ef={'raw':![],'where':{}};var _0x4edd6b={};var _0x299d36={'count':0x0,'rows':[]};return db[_0xedf5('0x4d')]['findOne']({'where':{'id':_0x12f728['params']['id']}})['then'](handleEntityNotFound(_0x5ca7f3,null))[_0xedf5('0x30')](function(_0x1e22e6){if(_0x1e22e6){_0x4edd6b[_0xedf5('0x3d')]=_['keys'](db[_0xedf5('0x66')]['rawAttributes']);_0x4edd6b[_0xedf5('0x3e')]=_[_0xedf5('0x3f')](_0x12f728[_0xedf5('0x3e')]);_0x4edd6b[_0xedf5('0x40')]=_[_0xedf5('0x41')](_0x4edd6b[_0xedf5('0x3d')],_0x4edd6b[_0xedf5('0x3e')]);_0x1964ef[_0xedf5('0x42')]=_[_0xedf5('0x41')](_0x4edd6b[_0xedf5('0x3d')],qs[_0xedf5('0x43')](_0x12f728[_0xedf5('0x3e')][_0xedf5('0x43')]));_0x1964ef[_0xedf5('0x42')]=_0x1964ef[_0xedf5('0x42')]['length']?_0x1964ef[_0xedf5('0x42')]:_0x4edd6b[_0xedf5('0x3d')];if(!_0x12f728[_0xedf5('0x3e')][_0xedf5('0x45')](_0xedf5('0x46'))){_0x1964ef[_0xedf5('0x2a')]=qs[_0xedf5('0x2a')](_0x12f728[_0xedf5('0x3e')][_0xedf5('0x2a')]);_0x1964ef['offset']=qs[_0xedf5('0x29')](_0x12f728[_0xedf5('0x3e')][_0xedf5('0x29')]);}_0x1964ef['order']=qs[_0xedf5('0x48')](_0x12f728[_0xedf5('0x3e')]['sort']);_0x1964ef['where']=qs['filters'](_[_0xedf5('0x63')](_0x12f728[_0xedf5('0x3e')],_0x4edd6b[_0xedf5('0x40')]));_0x1964ef['where']['SmsAccountId']=_0x1e22e6['id'];if(_0x12f728['query'][_0xedf5('0x4b')]){_0x1964ef[_0xedf5('0x49')]=_[_0xedf5('0x53')](_0x1964ef['where'],{'$or':_['map'](_0x1964ef[_0xedf5('0x42')],function(_0x1233c5){var _0x21792c={};_0x21792c[_0x1233c5]={'$like':'%'+_0x12f728[_0xedf5('0x3e')][_0xedf5('0x4b')]+'%'};return _0x21792c;})});}_0x1964ef=_['merge']({},_0x1964ef,_0x12f728[_0xedf5('0x4c')]);return db['CannedAnswer']['count']({'where':_0x1964ef[_0xedf5('0x49')]})[_0xedf5('0x30')](function(_0x4c7c1a){_0x299d36[_0xedf5('0x28')]=_0x4c7c1a;if(_0x12f728['query'][_0xedf5('0x64')]){_0x1964ef[_0xedf5('0x4e')]=[{'all':!![]}];}return db[_0xedf5('0x66')][_0xedf5('0x4f')](_0x1964ef);})[_0xedf5('0x30')](function(_0x80d7b0){_0x299d36[_0xedf5('0x50')]=_0x80d7b0;return _0x299d36;});}})[_0xedf5('0x30')](respondWithFilteredResult(_0x5ca7f3,_0x1964ef))['catch'](handleError(_0x5ca7f3,null));};exports['removeAnswers']=function(_0x509829,_0x13e29f,_0x5518b9){return db[_0xedf5('0x4d')][_0xedf5('0x54')]({'where':{'id':_0x509829[_0xedf5('0x5d')]['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x13e29f,null))[_0xedf5('0x30')](function(_0x331328){if(_0x331328){return _0x331328['removeAnswers'](_0x509829['query'][_0xedf5('0x68')]);}})[_0xedf5('0x30')](respondWithStatusCode(_0x13e29f,null))['catch'](handleError(_0x13e29f,null));};exports['notify']=function(_0x185cfe,_0x289293,_0x2cb7cd){var _0x1944ce={'channel':_0xedf5('0x69')};var _0x42fcc2=[];var _0x2ac313=[];var _0x970e9f={};return db['SmsAccount'][_0xedf5('0x54')]({'where':{'id':_0x185cfe[_0xedf5('0x5d')]['id']},'include':[{'model':db[_0xedf5('0x6a')],'as':_0xedf5('0x6b')}]})['then'](handleEntityNotFound(_0x289293,null))[_0xedf5('0x30')](function(_0x187480){_0x1944ce[_0xedf5('0x6c')]=_0x187480;_0x1944ce[_0xedf5('0x6d')]=_[_0xedf5('0x6e')](_0x187480[_0xedf5('0x6b')],[_0xedf5('0x6f')],['asc']);if(_0x1944ce[_0xedf5('0x6c')][_0xedf5('0x6b')]){delete _0x1944ce['account'][_0xedf5('0x6b')];}return db[_0xedf5('0x70')][_0xedf5('0x5e')]();})['then'](function(_0xc63bec){if(!_0xc63bec){throw new db[(_0xedf5('0x71'))][(_0xedf5('0x72'))]('no\x20available\x20attributes');}_0x42fcc2=_[_0xedf5('0x73')](_[_0xedf5('0x3f')](_0xc63bec),[_0xedf5('0x74'),_0xedf5('0x75')]);_0x2ac313=_['difference'](_[_0xedf5('0x3f')](_0xc63bec),[_0xedf5('0x74'),'updatedAt',_0xedf5('0x76'),_0xedf5('0x77')]);_0x1944ce[_0xedf5('0x56')]={'mapKey':'mobile'};if(_0x1944ce[_0xedf5('0x6c')]['type']){switch(_0x1944ce[_0xedf5('0x6c')][_0xedf5('0x3b')]){case _0xedf5('0x78'):_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x7a')];_0x1944ce['body'][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')]['Body'];_0x1944ce[_0xedf5('0x56')]['messageId']=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x7b')];break;case'skebby':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]='+'+_0x185cfe['body'][_0xedf5('0x7c')];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')]['text'];break;case'connectel':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]=_0x185cfe['body']['from'];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x22')];break;case _0xedf5('0x7d'):_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x79')];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x56')];_0x1944ce[_0xedf5('0x56')]['messageId']=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x7e')];break;case _0xedf5('0x7f'):_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x7a')];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')]['Text'];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x80')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x81')];break;case _0xedf5('0x82'):_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]='+'+_0x185cfe['body'][_0xedf5('0x83')][0x0][_0xedf5('0x79')];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x83')][0x0][_0xedf5('0x84')];_0x1944ce[_0xedf5('0x56')]['messageId']=_0x185cfe[_0xedf5('0x56')]['results'][0x0][_0xedf5('0x80')];break;case'csc':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]=_0x185cfe[_0xedf5('0x56')]['originatingAddress'];_0x1944ce[_0xedf5('0x56')]['body']=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x85')][_0xedf5('0x22')];break;case'clickatell':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x86')];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')]['text'];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x80')]=_0x185cfe['body'][_0xedf5('0x87')];break;case'intelepeer':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')]=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x79')];_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]=_0x185cfe[_0xedf5('0x56')]['message'];_0x1944ce[_0xedf5('0x56')]['messageId']=_0x185cfe[_0xedf5('0x56')][_0xedf5('0x88')];break;}}if(_0x1944ce['body']['id']){delete _0x1944ce[_0xedf5('0x56')]['id'];}if(_[_0xedf5('0x89')](_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')])){throw new db[(_0xedf5('0x71'))][(_0xedf5('0x72'))](_0xedf5('0x8a'));}if(_[_0xedf5('0x89')](_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')])||_0x1944ce[_0xedf5('0x56')][_0xedf5('0x56')]===''){throw new db[(_0xedf5('0x71'))]['ValidationError'](_0xedf5('0x8b'));}if(_[_0xedf5('0x89')](_0x1944ce[_0xedf5('0x56')][_0xedf5('0x8c')])){throw new db[(_0xedf5('0x71'))]['ValidationError'](_0xedf5('0x8d')+_0x2ac313);}if(!_[_0xedf5('0x8e')](_0x2ac313,_0x1944ce[_0xedf5('0x56')][_0xedf5('0x8c')])){throw new db[(_0xedf5('0x71'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ac313);}_0x970e9f[_0x1944ce[_0xedf5('0x56')][_0xedf5('0x8c')]]=_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')];return db[_0xedf5('0x8f')][_0xedf5('0x54')]({'where':{'id':_0x1944ce[_0xedf5('0x6c')][_0xedf5('0x77')]},'include':[{'model':db['CmContact'],'as':_0xedf5('0x90'),'where':_0x970e9f,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x289293,null))['then'](function(_0xf76159){if(_0xf76159){_0x1944ce['list']=_[_0xedf5('0x91')](_0xf76159,['Contacts']);if(_0xf76159['Contacts']['length']){return _0xf76159['Contacts'][0x0];}var _0x36163f=_[_0xedf5('0x17')](_0x1944ce[_0xedf5('0x56')],{'firstName':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')],'ListId':_0xf76159['id']});_0x36163f[_0x1944ce[_0xedf5('0x56')][_0xedf5('0x8c')]]=_0x1944ce[_0xedf5('0x56')]['from'];return db[_0xedf5('0x70')][_0xedf5('0x55')](_0x36163f,{'fields':_0x42fcc2,'raw':!![]});}})[_0xedf5('0x30')](handleEntityNotFound(_0x289293,null))[_0xedf5('0x30')](function(_0x1d6a1b){if(_0x1d6a1b){_0x1944ce['contact']=_0x1d6a1b;var _0x326565={'ContactId':_0x1d6a1b['id'],'phone':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')],'SmsAccountId':_0x185cfe[_0xedf5('0x5d')]['id']};var _0x53c8e3={'ContactId':_0x1d6a1b['id'],'SmsAccountId':_0x185cfe[_0xedf5('0x5d')]['id'],'closed':![]};return db[_0xedf5('0x92')][_0xedf5('0x54')]({'where':_0x53c8e3})[_0xedf5('0x30')](function(_0x3a6c8e){if(_0x3a6c8e){return[_0x3a6c8e,![]];}return db[_0xedf5('0x92')][_0xedf5('0x55')](_0x326565)[_0xedf5('0x30')](function(_0x1de96a){return[_0x1de96a,!![]];});});}})[_0xedf5('0x93')](function(_0x5eeff8,_0x4908e2){_0x1944ce[_0xedf5('0x94')]=_0x5eeff8[_0xedf5('0x32')]({'plain':!![]});_0x1944ce[_0xedf5('0x94')]['created']=![];if(_0x4908e2){if(_0x1944ce[_0xedf5('0x6c')][_0xedf5('0x95')]){_0x1944ce['applications'][_0xedf5('0x96')]({'id':0x0,'priority':_0x1944ce[_0xedf5('0x6d')][_0xedf5('0x44')]+0x1,'app':'close','appdata':_0xedf5('0x97'),'interval':_0xedf5('0x98')});}_0x1944ce[_0xedf5('0x94')][_0xedf5('0x99')]=!![];}return db[_0xedf5('0x9a')][_0xedf5('0x55')]({'phone':_0x1944ce[_0xedf5('0x56')][_0xedf5('0x79')],'messageId':_0x1944ce[_0xedf5('0x56')]['messageId'],'body':_0x1944ce['body'][_0xedf5('0x56')],'SmsAccountId':_0x185cfe[_0xedf5('0x5d')]['id'],'SmsInteractionId':_0x5eeff8['id'],'direction':'in','ContactId':_0x5eeff8['ContactId'],'AttachmentId':_0x1944ce[_0xedf5('0x56')]['AttachmentId']});})['then'](function(_0x3ee1e6){_0x1944ce[_0xedf5('0x22')]=_0x3ee1e6;if(_0x1944ce[_0xedf5('0x94')][_0xedf5('0x9b')]){return db[_0xedf5('0x9c')][_0xedf5('0x54')]({'attributes':['id',_0xedf5('0x36')],'where':{'id':_0x1944ce[_0xedf5('0x94')][_0xedf5('0x9b')]}})[_0xedf5('0x30')](function(_0x46631a){if(_0x46631a){_0x1944ce[_0xedf5('0x6d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xedf5('0x9d'),'appdata':_0x46631a['name']+','+(_0x1944ce[_0xedf5('0x6c')][_0xedf5('0x9e')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xedf5('0x9f'),'startRouting',_0x1944ce);});}return respondWithRpcPromise('Start',_0xedf5('0xa0'),_0x1944ce);})[_0xedf5('0x30')](function(_0x3ddbff){if(_0x3ddbff){var _0x437263=0xc8;var _0x574e99=_0xedf5('0xa1');logger[_0xedf5('0x1d')](_0xedf5('0x1f'),_0x574e99,_0x437263,'entity\x20found');logger[_0xedf5('0xa2')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x574e99,_0x437263,_0xedf5('0xa3'),JSON[_0xedf5('0xa4')](_0x3ddbff));if(_0x1944ce[_0xedf5('0x6c')][_0xedf5('0x3b')]===_0xedf5('0x78')){return _0x289293[_0xedf5('0x26')](_0x437263)[_0xedf5('0x2b')](_0xedf5('0xa5'),'text/xml')[_0xedf5('0x37')](_0xedf5('0xa6'));}else{return _0x289293[_0xedf5('0x26')](_0x437263)[_0xedf5('0x27')](_0x3ddbff);}}})['catch'](handleError(_0x289293,null));};exports[_0xedf5('0xa7')]=function(_0x446253,_0x2b6e22,_0x9fad8d){return db[_0xedf5('0x4d')][_0xedf5('0xa8')]({'where':{'id':_0x446253['params']['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x2b6e22,null))['then'](function(_0x419aa2){if(_0x419aa2){return db['sequelize'][_0xedf5('0xa9')](function(_0x19d30f){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x446253[_0xedf5('0x5d')]['id']},'transaction':_0x19d30f})[_0xedf5('0x30')](function(_0x4e8dbe){var _0x5bfcf9=_[_0xedf5('0x39')](_0x446253[_0xedf5('0x56')],function(_0x518a2d){_0x518a2d[_0xedf5('0x60')]=_0x446253['params']['id'];return _0x518a2d;});return db[_0xedf5('0x6a')][_0xedf5('0xaa')](_0x5bfcf9,{'transaction':_0x19d30f});});})[_0xedf5('0x30')](function(){return db['SmsApplication'][_0xedf5('0xab')]({'where':{'SmsAccountId':_0x446253[_0xedf5('0x5d')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x2b6e22,null))[_0xedf5('0x24')](handleError(_0x2b6e22,null));};exports[_0xedf5('0xac')]=function(_0x515c8e,_0x6488c6,_0x4fb76a){var _0x3e1fae={};var _0x35484f={};var _0xe725ce;var _0x2cd56d;return db['SmsAccount']['findOne']({'where':{'id':_0x515c8e['params']['id']}})['then'](handleEntityNotFound(_0x6488c6,null))[_0xedf5('0x30')](function(_0x2e7120){if(_0x2e7120){_0xe725ce=_0x2e7120;_0x35484f[_0xedf5('0x3d')]=_[_0xedf5('0x3f')](db[_0xedf5('0x6a')][_0xedf5('0x52')]);_0x35484f[_0xedf5('0x3e')]=_[_0xedf5('0x3f')](_0x515c8e[_0xedf5('0x3e')]);_0x35484f[_0xedf5('0x40')]=_[_0xedf5('0x41')](_0x35484f['model'],_0x35484f[_0xedf5('0x3e')]);_0x3e1fae[_0xedf5('0x42')]=_[_0xedf5('0x41')](_0x35484f[_0xedf5('0x3d')],qs[_0xedf5('0x43')](_0x515c8e[_0xedf5('0x3e')]['fields']));_0x3e1fae[_0xedf5('0x42')]=_0x3e1fae['attributes'][_0xedf5('0x44')]?_0x3e1fae[_0xedf5('0x42')]:_0x35484f['model'];_0x3e1fae[_0xedf5('0x47')]=qs['sort'](_0x515c8e[_0xedf5('0x3e')]['sort']);_0x3e1fae[_0xedf5('0x49')]=qs[_0xedf5('0x40')](_[_0xedf5('0x63')](_0x515c8e['query'],_0x35484f[_0xedf5('0x40')]));if(_0x515c8e[_0xedf5('0x3e')]['filter']){_0x3e1fae['where']=_[_0xedf5('0x53')](_0x3e1fae['where'],{'$or':_[_0xedf5('0x39')](_0x3e1fae[_0xedf5('0x42')],function(_0x54db19){var _0x23cb83={};_0x23cb83[_0x54db19]={'$like':'%'+_0x515c8e[_0xedf5('0x3e')][_0xedf5('0x4b')]+'%'};return _0x23cb83;})});}_0x3e1fae=_['merge']({},_0x3e1fae,_0x515c8e[_0xedf5('0x4c')]);return _0xe725ce[_0xedf5('0xac')](_0x3e1fae);}})['then'](function(_0x2b37a7){if(_0x2b37a7){_0x2cd56d=_0x2b37a7[_0xedf5('0x44')];if(!_0x515c8e['query'][_0xedf5('0x45')](_0xedf5('0x46'))){_0x3e1fae[_0xedf5('0x2a')]=qs[_0xedf5('0x2a')](_0x515c8e['query'][_0xedf5('0x2a')]);_0x3e1fae[_0xedf5('0x29')]=qs[_0xedf5('0x29')](_0x515c8e[_0xedf5('0x3e')][_0xedf5('0x29')]);}return _0xe725ce['getApplications'](_0x3e1fae);}})[_0xedf5('0x30')](function(_0x4d4625){if(_0x4d4625){return _0x4d4625?{'count':_0x2cd56d,'rows':_0x4d4625}:null;}})['then'](respondWithResult(_0x6488c6,null))[_0xedf5('0x24')](handleError(_0x6488c6,null));};exports[_0xedf5('0xad')]=function(_0xa0ea08,_0x1c436c,_0x58857){var _0x42a791={'raw':![],'where':{}};var _0xfcf588={};var _0x27df0e={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xa0ea08['params']['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x1c436c,null))['then'](function(_0x4290b8){if(_0x4290b8){_0xfcf588[_0xedf5('0x3d')]=_[_0xedf5('0x3f')](db[_0xedf5('0x92')][_0xedf5('0x52')]);_0xfcf588['query']=_[_0xedf5('0x3f')](_0xa0ea08[_0xedf5('0x3e')]);_0xfcf588[_0xedf5('0x40')]=_[_0xedf5('0x41')](_0xfcf588[_0xedf5('0x3d')],_0xfcf588[_0xedf5('0x3e')]);_0x42a791['attributes']=_[_0xedf5('0x41')](_0xfcf588[_0xedf5('0x3d')],qs['fields'](_0xa0ea08['query']['fields']));_0x42a791[_0xedf5('0x42')]=_0x42a791[_0xedf5('0x42')][_0xedf5('0x44')]?_0x42a791[_0xedf5('0x42')]:_0xfcf588[_0xedf5('0x3d')];if(!_0xa0ea08[_0xedf5('0x3e')][_0xedf5('0x45')]('nolimit')){_0x42a791[_0xedf5('0x2a')]=qs[_0xedf5('0x2a')](_0xa0ea08['query'][_0xedf5('0x2a')]);_0x42a791['offset']=qs[_0xedf5('0x29')](_0xa0ea08['query'][_0xedf5('0x29')]);}_0x42a791[_0xedf5('0x47')]=qs[_0xedf5('0x48')](_0xa0ea08[_0xedf5('0x3e')][_0xedf5('0x48')]);_0x42a791['where']=qs[_0xedf5('0x40')](_[_0xedf5('0x63')](_0xa0ea08[_0xedf5('0x3e')],_0xfcf588[_0xedf5('0x40')]));_0x42a791[_0xedf5('0x49')]['SmsAccountId']=_0x4290b8['id'];if(_0xa0ea08[_0xedf5('0x3e')][_0xedf5('0x4b')]){_0x42a791['where']=_[_0xedf5('0x53')](_0x42a791['where'],{'$or':_[_0xedf5('0x39')](_0x42a791[_0xedf5('0x42')],function(_0x55a89a){var _0x542062={};_0x542062[_0x55a89a]={'$like':'%'+_0xa0ea08[_0xedf5('0x3e')]['filter']+'%'};return _0x542062;})});}_0x42a791=_['merge']({},_0x42a791,_0xa0ea08[_0xedf5('0x4c')]);return db['SmsInteraction'][_0xedf5('0x28')]({'where':_0x42a791[_0xedf5('0x49')]})[_0xedf5('0x30')](function(_0x491b76){_0x27df0e[_0xedf5('0x28')]=_0x491b76;if(_0xa0ea08[_0xedf5('0x3e')][_0xedf5('0x64')]){_0x42a791[_0xedf5('0x4e')]=[{'model':db[_0xedf5('0x70')],'as':_0xedf5('0xae'),'required':![]},{'model':db[_0xedf5('0x9c')],'as':_0xedf5('0xaf'),'attributes':[_0xedf5('0x36'),_0xedf5('0xb0'),_0xedf5('0xb1')],'required':![]},{'model':db[_0xedf5('0xb2')],'as':_0xedf5('0xb3'),'attributes':['id',_0xedf5('0x36'),_0xedf5('0xb4')],'where':_0xa0ea08['query'][_0xedf5('0xb5')]?{'id':_0xa0ea08[_0xedf5('0x3e')]['tag']}:undefined,'required':_0xa0ea08[_0xedf5('0x3e')][_0xedf5('0xb5')]?!![]:![]}];}return db[_0xedf5('0x92')][_0xedf5('0x4f')](_0x42a791);})[_0xedf5('0x30')](function(_0x2a146c){_0x27df0e[_0xedf5('0x50')]=_0x2a146c;return _0x27df0e;});}})['then'](respondWithFilteredResult(_0x1c436c,_0x42a791))[_0xedf5('0x24')](handleError(_0x1c436c,null));};exports[_0xedf5('0x37')]=function(_0x57920b,_0x4bfade,_0x299719){var _0x26f206,_0x403602,_0x4a885e;if(_[_0xedf5('0x89')](_0x57920b[_0xedf5('0x56')][_0xedf5('0x56')])||_0x57920b[_0xedf5('0x56')][_0xedf5('0x56')]===''){throw new db[(_0xedf5('0x71'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xedf5('0x89')](_0x57920b['body']['to'])){throw new db['Sequelize'][(_0xedf5('0x72'))]('to\x20is\x20mandatory');}_0x26f206=_0x57920b[_0xedf5('0x56')]['to'];return db['SmsAccount'][_0xedf5('0x54')]({'where':{'id':_0x57920b[_0xedf5('0x5d')]['id']},'include':[{'model':db[_0xedf5('0x8f')],'as':'List','include':[{'model':db[_0xedf5('0x70')],'as':_0xedf5('0x90'),'where':{'mobile':_0x26f206},'limit':0x1,'order':[[_0xedf5('0x75'),_0xedf5('0xb6')]]}]}]})[_0xedf5('0x30')](handleEntityNotFound(_0x4bfade,null))[_0xedf5('0x30')](function(_0x56d4c2){if(_0x56d4c2&&_0x56d4c2[_0xedf5('0xb7')]){_0x403602=_0x56d4c2['get']({'plain':!![]});if(_0x403602['List']&&_0x403602[_0xedf5('0xb7')][_0xedf5('0x90')][_0xedf5('0x44')]){return _0x403602['List'][_0xedf5('0x90')][0x0];}return db[_0xedf5('0x70')][_0xedf5('0x55')](_[_0xedf5('0x17')](_0x57920b[_0xedf5('0x56')],{'firstName':_0x26f206,'mobile':_0x26f206,'phone':_0x26f206,'ListId':_0x403602[_0xedf5('0x77')]}));}})[_0xedf5('0x30')](handleEntityNotFound(_0x4bfade,null))[_0xedf5('0x30')](function(_0x2308ea){if(_0x2308ea){_0x4a885e=_0x2308ea;return db['SmsInteraction'][_0xedf5('0x54')]({'where':{'ContactId':_0x4a885e['id'],'closed':![],'SmsAccountId':_0x403602['id']}})[_0xedf5('0x30')](function(_0x78f5bc){if(_0x78f5bc){return[_0x78f5bc,![]];}return db[_0xedf5('0x92')][_0xedf5('0x55')]({'UserId':_0x57920b['user']['id'],'ContactId':_0x4a885e['id'],'SmsAccountId':_0x403602['id'],'phone':_0x26f206,'firstMsgDirection':_0xedf5('0xb8'),'Messages':[_[_0xedf5('0x53')](_0x57920b['body'],{'read':![],'body':_0x57920b[_0xedf5('0x56')][_0xedf5('0x56')],'phone':_0x26f206,'SmsAccountId':_0x403602['id'],'UserId':_0x57920b['user']['id'],'ContactId':_0x4a885e['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xedf5('0xb9')}]})[_0xedf5('0x30')](function(_0x1656f5){return[_0x1656f5,!![]];});});}})[_0xedf5('0x93')](function(_0x4b37d6,_0x301f47){if(_0x301f47){return _0x4b37d6;}return db[_0xedf5('0x9a')][_0xedf5('0x55')](_[_0xedf5('0x53')](_0x57920b[_0xedf5('0x56')],{'read':![],'body':_0x57920b[_0xedf5('0x56')][_0xedf5('0x56')],'phone':_0x26f206,'SmsAccountId':_0x403602['id'],'SmsInteractionId':_0x4b37d6['id'],'UserId':_0x57920b[_0xedf5('0x58')]['id'],'ContactId':_0x4a885e['id']}))[_0xedf5('0x30')](function(_0x3143e9){_0x4b37d6['dataValues'][_0xedf5('0xb9')]=[];_0x4b37d6[_0xedf5('0xba')]['Messages'][_0xedf5('0x96')](_0x3143e9[_0xedf5('0xba')]);return _0x4b37d6;});})[_0xedf5('0x30')](respondWithResult(_0x4bfade,null))[_0xedf5('0x24')](handleError(_0x4bfade,null));};exports[_0xedf5('0x26')]=function(_0x231762,_0x25e5a8,_0x5d8a84){if(_0x231762[_0xedf5('0x56')]['id']){delete _0x231762[_0xedf5('0x56')]['id'];}console[_0xedf5('0xbb')](_0xedf5('0xbc'),_0x231762['body']);var _0x300d8c,_0x2eb80c,_0x4bd1ec;return db[_0xedf5('0x4d')][_0xedf5('0x54')]({'where':{'id':_0x231762['params']['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x25e5a8,null))[_0xedf5('0x30')](function(_0x5c98a2){if(_0x5c98a2){_0x4bd1ec=_0x5c98a2;logger[_0xedf5('0xa2')](_0xedf5('0x1f'),_0xedf5('0x26'),_0xedf5('0xbd'),_0x5c98a2[_0xedf5('0x3b')],util[_0xedf5('0xbe')](_0x231762['body'],{'showHidden':![],'depth':null}));switch(_0x5c98a2[_0xedf5('0x3b')]){case'skebby':if(_0x231762[_0xedf5('0x56')][_0xedf5('0xbf')]&&_0x231762[_0xedf5('0x56')][_0xedf5('0x26')]){_0x2eb80c=_0x231762['body']['status'];return db[_0xedf5('0x9a')][_0xedf5('0x54')]({'where':{'messageId':_0x231762['body'][_0xedf5('0xbf')]}});}break;case _0xedf5('0xc0'):if(_0x231762[_0xedf5('0x56')]['requestid']&&_0x231762[_0xedf5('0x56')][_0xedf5('0xc1')]){_0x2eb80c=_0x231762[_0xedf5('0x56')]['statusInt'];return db[_0xedf5('0x9a')][_0xedf5('0x54')]({'where':{'messageId':_0x231762[_0xedf5('0x56')][_0xedf5('0xc2')]}});}break;case _0xedf5('0x7d'):if(_0x231762[_0xedf5('0x56')][_0xedf5('0x7e')]&&_0x231762[_0xedf5('0x56')]['status_code']){_0x2eb80c=_0x231762[_0xedf5('0x56')][_0xedf5('0xc3')];return db[_0xedf5('0x9a')]['find']({'where':{'messageId':_0x231762[_0xedf5('0x56')]['message_id']}});}break;case _0xedf5('0x82'):var _0x578360=_0x231762['body']['results'][0x0];if(_0x578360[_0xedf5('0x80')]&&_0x578360['status'][_0xedf5('0xc4')]===_0xedf5('0xc5')){_0x2eb80c=_0x578360[_0xedf5('0x26')][_0xedf5('0xc4')];return db[_0xedf5('0x9a')]['find']({'where':{'messageId':_0x578360[_0xedf5('0x80')]}});}break;case _0xedf5('0xc6'):if(_0x231762['body'][_0xedf5('0x80')]&&_0x231762[_0xedf5('0x56')][_0xedf5('0x26')]){_0x2eb80c=_0x231762[_0xedf5('0x56')][_0xedf5('0x26')];return db[_0xedf5('0x9a')][_0xedf5('0x54')]({'where':{'messageId':_0x231762[_0xedf5('0x56')]['messageId']}});}break;case _0xedf5('0xc7'):if(_0x231762[_0xedf5('0x56')][_0xedf5('0xc8')]&&_0x231762[_0xedf5('0x56')][_0xedf5('0x26')]){_0x2eb80c=_0x231762[_0xedf5('0x56')][_0xedf5('0x26')];return db[_0xedf5('0x9a')][_0xedf5('0x54')]({'where':{'messageId':_0x231762[_0xedf5('0x56')][_0xedf5('0xc8')]}});}break;}}})[_0xedf5('0x30')](handleEntityNotFound(_0x25e5a8,null))[_0xedf5('0x30')](function(_0x49134b){if(_0x49134b){_0x300d8c=_0x49134b;switch(_0x4bd1ec[_0xedf5('0x3b')]){case _0xedf5('0xc9'):if(_0x2eb80c===_0xedf5('0xc5')){return _0x300d8c[_0xedf5('0x2f')]({'read':!![]});}else{logger[_0xedf5('0x20')](_0xedf5('0x1f'),_0xedf5('0x26'),'skebby',util[_0xedf5('0xbe')](_0x231762['body'],{'showHidden':![],'depth':null}));}break;case _0xedf5('0xc0'):if(_0x2eb80c==='1'){return _0x300d8c[_0xedf5('0x2f')]({'read':!![]});}else{logger['error'](_0xedf5('0x1f'),_0xedf5('0x26'),_0xedf5('0xc9'),util[_0xedf5('0xbe')](_0x231762[_0xedf5('0x56')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x231762['body'][_0xedf5('0xca')]&&_0x2eb80c>=0xc8&&_0x2eb80c<=0xce){return _0x300d8c[_0xedf5('0x2f')]({'read':!![]});}else{logger['error'](_0xedf5('0x1f'),_0xedf5('0x26'),_0xedf5('0x7d'),util[_0xedf5('0xbe')](_0x231762[_0xedf5('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x94763f=_0x231762['body'][_0xedf5('0x83')][0x0];if(_0x94763f[_0xedf5('0x26')][_0xedf5('0xc4')]===_0xedf5('0xc5')){return _0x300d8c[_0xedf5('0x2f')]({'read':!![]});}else{logger[_0xedf5('0x20')](_0xedf5('0x1f'),_0xedf5('0x26'),_0xedf5('0x82'),util[_0xedf5('0xbe')](_0x231762[_0xedf5('0x56')],{'showHidden':![],'depth':null}));}break;case _0xedf5('0xc6'):if(_0x2eb80c=='DELIVERED_TO_GATEWAY'||_0x2eb80c==_0xedf5('0xcb')){return _0x300d8c[_0xedf5('0x2f')]({'read':!![]});}else{logger['error'](_0xedf5('0x1f'),_0xedf5('0x26'),'clickatell',util['inspect'](_0x231762[_0xedf5('0x56')],{'showHidden':![],'depth':null}));}break;case _0xedf5('0xc7'):if(_0x2eb80c==='DELIVRD'||_0x2eb80c===_0xedf5('0xcc')){return _0x300d8c[_0xedf5('0x2f')]({'read':!![]});}else{logger['error'](_0xedf5('0x1f'),'status',_0xedf5('0xc7'),util[_0xedf5('0xbe')](_0x231762[_0xedf5('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x300d8c;}})[_0xedf5('0x30')](respondWithResult(_0x25e5a8,null))[_0xedf5('0x24')](handleError(_0x25e5a8,null));};exports['statusGet']=function(_0x153f5e,_0x49c8f5,_0x57974a){var _0x5b8d57,_0x10b7fc,_0x411bd1;return db[_0xedf5('0x4d')]['find']({'where':{'id':_0x153f5e[_0xedf5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x49c8f5,null))[_0xedf5('0x30')](function(_0xa9cec5){if(_0xa9cec5){_0x411bd1=_0xa9cec5;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xedf5('0x26'),_0xedf5('0xbd'),_0xa9cec5['type'],util[_0xedf5('0xbe')](_0x153f5e['query'],{'showHidden':![],'depth':null}));switch(_0xa9cec5[_0xedf5('0x3b')]){case _0xedf5('0xcd'):if(_0x153f5e[_0xedf5('0x3e')][_0xedf5('0xce')]&&_0x153f5e[_0xedf5('0x3e')][_0xedf5('0xcf')]){_0x10b7fc=_0x153f5e[_0xedf5('0x3e')][_0xedf5('0xcf')];return db[_0xedf5('0x9a')]['find']({'where':{'messageId':_0x153f5e['query'][_0xedf5('0xce')]}});}break;}}})['then'](handleEntityNotFound(_0x49c8f5,null))['then'](function(_0x13e53d){if(_0x13e53d){_0x5b8d57=_0x13e53d;switch(_0x411bd1['type']){case _0xedf5('0xcd'):if(_0x10b7fc==='2'||_0x10b7fc==='6'){return _0x5b8d57[_0xedf5('0x2f')]({'read':!![]});}else{logger['error'](_0xedf5('0x1f'),'status',_0xedf5('0xcd'),util[_0xedf5('0xbe')](_0x153f5e[_0xedf5('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x5b8d57;}})[_0xedf5('0x30')](respondWithResult(_0x49c8f5,null))[_0xedf5('0x24')](handleError(_0x49c8f5,null));};exports['addAgents']=function(_0x41cc02,_0xf6058e,_0xdc7049){return db[_0xedf5('0x4d')][_0xedf5('0x54')]({'where':{'id':_0x41cc02[_0xedf5('0x5d')]['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0xf6058e,null))[_0xedf5('0x30')](function(_0xcc3a7e){if(_0xcc3a7e){return _0xcc3a7e['addAgents'](_0x41cc02[_0xedf5('0x56')]['ids'],_[_0xedf5('0x91')](_0x41cc02[_0xedf5('0x56')],[_0xedf5('0x68'),'id'])||{})[_0xedf5('0x93')](function(_0x6bd9bc){for(var _0x3c4160=0x0;_0x3c4160<_0x41cc02[_0xedf5('0x56')][_0xedf5('0x68')][_0xedf5('0x44')];_0x3c4160+=0x1){socket[_0xedf5('0xd0')](_0xedf5('0xd1'),{'UserId':_0x41cc02[_0xedf5('0x56')]['ids'][_0x3c4160],'SmsAccountId':_0x41cc02[_0xedf5('0x5d')]['id']});}return _0x6bd9bc;});}})[_0xedf5('0x30')](respondWithResult(_0xf6058e,null))[_0xedf5('0x24')](handleError(_0xf6058e,null));};exports[_0xedf5('0xd2')]=function(_0x14b13f,_0x4a907d,_0x51a3e3){return db['SmsAccount'][_0xedf5('0x54')]({'where':{'id':_0x14b13f[_0xedf5('0x5d')]['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x4a907d,null))[_0xedf5('0x30')](function(_0x1f6eb1){if(_0x1f6eb1){return _0x1f6eb1[_0xedf5('0xd2')](_0x14b13f[_0xedf5('0x3e')]['ids'])[_0xedf5('0x30')](function(){if(_['isArray'](_0x14b13f[_0xedf5('0x3e')][_0xedf5('0x68')])){for(var _0x405794=0x0;_0x405794<_0x14b13f[_0xedf5('0x3e')][_0xedf5('0x68')]['length'];_0x405794+=0x1){socket[_0xedf5('0xd0')](_0xedf5('0xd3'),{'UserId':Number(_0x14b13f[_0xedf5('0x3e')][_0xedf5('0x68')][_0x405794]),'SmsAccountId':Number(_0x14b13f[_0xedf5('0x5d')]['id'])});}}else{socket[_0xedf5('0xd0')]('userSmsAccount:remove',{'UserId':Number(_0x14b13f['query'][_0xedf5('0x68')]),'SmsAccountId':Number(_0x14b13f['params']['id'])});}});}})[_0xedf5('0x30')](respondWithStatusCode(_0x4a907d,null))[_0xedf5('0x24')](handleError(_0x4a907d,null));};exports[_0xedf5('0xd4')]=function(_0x24eda3,_0x132bee,_0x2c9c2d){var _0x32ba00={};var _0x57c491={};var _0x7cce3f;var _0x2df665;return db[_0xedf5('0x4d')][_0xedf5('0xa8')]({'where':{'id':_0x24eda3[_0xedf5('0x5d')]['id']}})[_0xedf5('0x30')](handleEntityNotFound(_0x132bee,null))[_0xedf5('0x30')](function(_0x59b7db){if(_0x59b7db){_0x7cce3f=_0x59b7db;_0x57c491[_0xedf5('0x3d')]=_[_0xedf5('0x3f')](db[_0xedf5('0x9c')][_0xedf5('0x52')]);_0x57c491[_0xedf5('0x3e')]=_[_0xedf5('0x3f')](_0x24eda3[_0xedf5('0x3e')]);_0x57c491[_0xedf5('0x40')]=_[_0xedf5('0x41')](_0x57c491[_0xedf5('0x3d')],_0x57c491[_0xedf5('0x3e')]);_0x32ba00[_0xedf5('0x42')]=_[_0xedf5('0x41')](_0x57c491[_0xedf5('0x3d')],qs['fields'](_0x24eda3['query'][_0xedf5('0x43')]));_0x32ba00['attributes']=_0x32ba00[_0xedf5('0x42')][_0xedf5('0x44')]?_0x32ba00[_0xedf5('0x42')]:_0x57c491[_0xedf5('0x3d')];_0x32ba00[_0xedf5('0x47')]=qs[_0xedf5('0x48')](_0x24eda3[_0xedf5('0x3e')][_0xedf5('0x48')]);_0x32ba00[_0xedf5('0x49')]=qs['filters'](_[_0xedf5('0x63')](_0x24eda3[_0xedf5('0x3e')],_0x57c491[_0xedf5('0x40')]));if(_0x24eda3['query'][_0xedf5('0x4b')]){_0x32ba00['where']=_[_0xedf5('0x53')](_0x32ba00[_0xedf5('0x49')],{'$or':_[_0xedf5('0x39')](_0x32ba00[_0xedf5('0x42')],function(_0x400c32){var _0x3b1a3b={};_0x3b1a3b[_0x400c32]={'$like':'%'+_0x24eda3['query'][_0xedf5('0x4b')]+'%'};return _0x3b1a3b;})});}_0x32ba00=_[_0xedf5('0x53')]({},_0x32ba00,_0x24eda3[_0xedf5('0x4c')]);return _0x7cce3f[_0xedf5('0xd4')](_0x32ba00);}})[_0xedf5('0x30')](function(_0x1b80f4){if(_0x1b80f4){_0x2df665=_0x1b80f4[_0xedf5('0x44')];if(!_0x24eda3[_0xedf5('0x3e')][_0xedf5('0x45')](_0xedf5('0x46'))){_0x32ba00['limit']=qs[_0xedf5('0x2a')](_0x24eda3['query'][_0xedf5('0x2a')]);_0x32ba00[_0xedf5('0x29')]=qs['offset'](_0x24eda3['query'][_0xedf5('0x29')]);}return _0x7cce3f[_0xedf5('0xd4')](_0x32ba00);}})[_0xedf5('0x30')](function(_0x233e39){if(_0x233e39){return _0x233e39?{'count':_0x2df665,'rows':_0x233e39}:null;}})[_0xedf5('0x30')](respondWithResult(_0x132bee,null))[_0xedf5('0x24')](handleError(_0x132bee,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e7df1d3..81fb1e0 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 _0x0577=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x8cd354,_0x2d9bec){var _0x4aa12e=function(_0x46568c){while(--_0x46568c){_0x8cd354['push'](_0x8cd354['shift']());}};_0x4aa12e(++_0x2d9bec);}(_0x0577,0x1ac));var _0x7057=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x0577[_0x1b6186];return _0x186121;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x7057('0x0'))['db'][_0x7057('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7057('0x2')](0x0);var events={'afterCreate':_0x7057('0x3'),'afterUpdate':_0x7057('0x4'),'afterDestroy':_0x7057('0x5')};function emitEvent(_0x7160e1){return function(_0x41c3d0,_0x9c96e9,_0x36e509){SmsAccountEvents['emit'](_0x7160e1+':'+_0x41c3d0['id'],_0x41c3d0);SmsAccountEvents[_0x7057('0x6')](_0x7160e1,_0x41c3d0);_0x36e509(null);};}for(var e in events){if(events[_0x7057('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x7057('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xb93e=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','save','update'];(function(_0x1d94bc,_0xa7ed66){var _0x47a921=function(_0x3684ab){while(--_0x3684ab){_0x1d94bc['push'](_0x1d94bc['shift']());}};_0x47a921(++_0xa7ed66);}(_0xb93e,0xe3));var _0xeb93=function(_0x2c87e9,_0x4a90fa){_0x2c87e9=_0x2c87e9-0x0;var _0x497b80=_0xb93e[_0x2c87e9];return _0x497b80;};'use strict';var EventEmitter=require(_0xeb93('0x0'));var SmsAccount=require(_0xeb93('0x1'))['db'][_0xeb93('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb93('0x3'),'afterUpdate':_0xeb93('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ba076){return function(_0x26d4ce,_0x24616a,_0xe8be7e){SmsAccountEvents[_0xeb93('0x5')](_0x1ba076+':'+_0x26d4ce['id'],_0x26d4ce);SmsAccountEvents[_0xeb93('0x5')](_0x1ba076,_0x26d4ce);_0xe8be7e(null);};}for(var e in events){if(events[_0xeb93('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xeb93('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index abd90bb..ddecdb5 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 _0x0443=['define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x363367,_0xc487bc){var _0x32caf7=function(_0x2dde84){while(--_0x2dde84){_0x363367['push'](_0x363367['shift']());}};_0x32caf7(++_0xc487bc);}(_0x0443,0x114));var _0x3044=function(_0x20c928,_0x3cf13b){_0x20c928=_0x20c928-0x0;var _0x541e41=_0x0443[_0x20c928];return _0x541e41;};'use strict';var _=require(_0x3044('0x0'));var util=require(_0x3044('0x1'));var logger=require(_0x3044('0x2'))('api');var moment=require(_0x3044('0x3'));var BPromise=require(_0x3044('0x4'));var rp=require(_0x3044('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3044('0x6'));var config=require(_0x3044('0x7'));var attributes=require(_0x3044('0x8'));module[_0x3044('0x9')]=function(_0x5913cf,_0x465c3e){return _0x5913cf[_0x3044('0xa')](_0x3044('0xb'),attributes,{'tableName':_0x3044('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa00a=['rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','moment','bluebird','request-promise','path'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0xa00a,0xf6));var _0xaa00=function(_0x2548f2,_0x44a7da){_0x2548f2=_0x2548f2-0x0;var _0xf3e6bb=_0xa00a[_0x2548f2];return _0xf3e6bb;};'use strict';var _=require(_0xaa00('0x0'));var util=require(_0xaa00('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaa00('0x2'));var BPromise=require(_0xaa00('0x3'));var rp=require(_0xaa00('0x4'));var fs=require('fs');var path=require(_0xaa00('0x5'));var rimraf=require(_0xaa00('0x6'));var config=require(_0xaa00('0x7'));var attributes=require(_0xaa00('0x8'));module[_0xaa00('0x9')]=function(_0x34af65,_0x2525fd){return _0x34af65['define'](_0xaa00('0xa'),attributes,{'tableName':_0xaa00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 10f1ec6..600a42d 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 _0x27c6=['localhost','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSmsAccount','find','options','raw','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','defaults','redis'];(function(_0x467511,_0x464ec3){var _0x3b54d6=function(_0x343cc9){while(--_0x343cc9){_0x467511['push'](_0x467511['shift']());}};_0x3b54d6(++_0x464ec3);}(_0x27c6,0x12c));var _0x627c=function(_0x29c896,_0x1084c3){_0x29c896=_0x29c896-0x0;var _0x2c654c=_0x27c6[_0x29c896];return _0x2c654c;};'use strict';var _=require('lodash');var util=require(_0x627c('0x0'));var moment=require('moment');var BPromise=require(_0x627c('0x1'));var rs=require(_0x627c('0x2'));var fs=require('fs');var Redis=require(_0x627c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x627c('0x4'))(_0x627c('0x5'));var config=require('../../config/environment');var jayson=require(_0x627c('0x6'));var client=jayson['client'][_0x627c('0x7')]({'port':0x232a});config['redis']=_[_0x627c('0x8')](config[_0x627c('0x9')],{'host':_0x627c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x627c('0x9')]));require(_0x627c('0xb'))[_0x627c('0xc')](socket);function respondWithRpcPromise(_0x3a8f9a,_0x4f4f10,_0x52dee5){return new BPromise(function(_0x565a0d,_0x9d5165){return client['request'](_0x3a8f9a,_0x52dee5)[_0x627c('0xd')](function(_0x388a84){logger[_0x627c('0xe')](_0x627c('0xf'),_0x4f4f10,_0x627c('0x10'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4f4f10,'request\x20sent',JSON[_0x627c('0x11')](_0x388a84));if(_0x388a84[_0x627c('0x12')]){if(_0x388a84[_0x627c('0x12')][_0x627c('0x13')]===0x1f4){logger[_0x627c('0x12')](_0x627c('0xf'),_0x4f4f10,_0x388a84[_0x627c('0x12')][_0x627c('0x14')]);return _0x9d5165(_0x388a84[_0x627c('0x12')][_0x627c('0x14')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4f4f10,_0x388a84[_0x627c('0x12')]['message']);return _0x565a0d(_0x388a84[_0x627c('0x12')][_0x627c('0x14')]);}else{logger[_0x627c('0xe')]('SmsAccount,\x20%s,\x20%s',_0x4f4f10,_0x627c('0x10'));_0x565a0d(_0x388a84['result'][_0x627c('0x14')]);}})[_0x627c('0x15')](function(_0x189161){logger[_0x627c('0x12')](_0x627c('0xf'),_0x4f4f10,_0x189161);_0x9d5165(_0x189161);});});}exports[_0x627c('0x16')]=function(_0x446b93){var _0x741220=this;return new Promise(function(_0x4dd29e,_0x478a87){return db['SmsAccount'][_0x627c('0x17')]({'raw':_0x446b93[_0x627c('0x18')]?_0x446b93[_0x627c('0x18')][_0x627c('0x19')]===undefined?!![]:![]:!![],'where':_0x446b93[_0x627c('0x18')]?_0x446b93[_0x627c('0x18')][_0x627c('0x1a')]||null:null,'attributes':_0x446b93[_0x627c('0x18')]?_0x446b93[_0x627c('0x18')]['attributes']||null:null,'include':_0x446b93[_0x627c('0x18')]?_0x446b93['options'][_0x627c('0x1b')]?_[_0x627c('0x1c')](_0x446b93[_0x627c('0x18')][_0x627c('0x1b')],function(_0x1ed2d2){return{'model':db[_0x1ed2d2[_0x627c('0x1d')]],'as':_0x1ed2d2['as'],'attributes':_0x1ed2d2[_0x627c('0x1e')],'include':_0x1ed2d2['include']?_[_0x627c('0x1c')](_0x1ed2d2[_0x627c('0x1b')],function(_0x5efba8){return{'model':db[_0x5efba8[_0x627c('0x1d')]],'as':_0x5efba8['as'],'attributes':_0x5efba8[_0x627c('0x1e')],'include':_0x5efba8[_0x627c('0x1b')]?_[_0x627c('0x1c')](_0x5efba8[_0x627c('0x1b')],function(_0x220b82){return{'model':db[_0x220b82['model']],'as':_0x220b82['as'],'attributes':_0x220b82['attributes']};}):[]};}):[]};}):[]:[]})[_0x627c('0xd')](function(_0x4c2705){logger[_0x627c('0xe')]('ShowSmsAccount',_0x446b93);logger['debug']('ShowSmsAccount',_0x446b93,JSON[_0x627c('0x11')](_0x4c2705));_0x4dd29e(_0x4c2705);})['catch'](function(_0x30977f){logger[_0x627c('0x12')](_0x627c('0x16'),_0x30977f[_0x627c('0x14')],_0x446b93);_0x478a87(_0x741220[_0x627c('0x12')](0x1f4,_0x30977f[_0x627c('0x14')]));});});}; \ No newline at end of file +var _0xac21=['raw','where','attributes','include','map','model','then','ShowSmsAccount','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','options'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xac21,0x1d1));var _0x1ac2=function(_0xe776cd,_0x591e35){_0xe776cd=_0xe776cd-0x0;var _0x4ee4b7=_0xac21[_0xe776cd];return _0x4ee4b7;};'use strict';var _=require(_0x1ac2('0x0'));var util=require(_0x1ac2('0x1'));var moment=require(_0x1ac2('0x2'));var BPromise=require(_0x1ac2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ac2('0x4'));var db=require(_0x1ac2('0x5'))['db'];var utils=require(_0x1ac2('0x6'));var logger=require(_0x1ac2('0x7'))('rpc');var config=require(_0x1ac2('0x8'));var jayson=require(_0x1ac2('0x9'));var client=jayson[_0x1ac2('0xa')][_0x1ac2('0xb')]({'port':0x232a});config['redis']=_[_0x1ac2('0xc')](config[_0x1ac2('0xd')],{'host':_0x1ac2('0xe'),'port':0x18eb});var socket=require(_0x1ac2('0xf'))(new Redis(config['redis']));require(_0x1ac2('0x10'))[_0x1ac2('0x11')](socket);function respondWithRpcPromise(_0x46d68f,_0x4f876f,_0x3081c7){return new BPromise(function(_0x1fd6c1,_0x1f00f9){return client['request'](_0x46d68f,_0x3081c7)['then'](function(_0x49643b){logger[_0x1ac2('0x12')]('SmsAccount,\x20%s,\x20%s',_0x4f876f,_0x1ac2('0x13'));logger[_0x1ac2('0x14')](_0x1ac2('0x15'),_0x4f876f,_0x1ac2('0x13'),JSON['stringify'](_0x49643b));if(_0x49643b[_0x1ac2('0x16')]){if(_0x49643b[_0x1ac2('0x16')][_0x1ac2('0x17')]===0x1f4){logger[_0x1ac2('0x16')]('SmsAccount,\x20%s,\x20%s',_0x4f876f,_0x49643b[_0x1ac2('0x16')][_0x1ac2('0x18')]);return _0x1f00f9(_0x49643b[_0x1ac2('0x16')][_0x1ac2('0x18')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4f876f,_0x49643b[_0x1ac2('0x16')]['message']);return _0x1fd6c1(_0x49643b[_0x1ac2('0x16')]['message']);}else{logger[_0x1ac2('0x12')](_0x1ac2('0x19'),_0x4f876f,_0x1ac2('0x13'));_0x1fd6c1(_0x49643b[_0x1ac2('0x1a')][_0x1ac2('0x18')]);}})[_0x1ac2('0x1b')](function(_0x14713e){logger[_0x1ac2('0x16')](_0x1ac2('0x19'),_0x4f876f,_0x14713e);_0x1f00f9(_0x14713e);});});}exports['ShowSmsAccount']=function(_0x554ca4){var _0x2d8fa6=this;return new Promise(function(_0x1011af,_0x51cad3){return db['SmsAccount']['find']({'raw':_0x554ca4[_0x1ac2('0x1c')]?_0x554ca4[_0x1ac2('0x1c')][_0x1ac2('0x1d')]===undefined?!![]:![]:!![],'where':_0x554ca4['options']?_0x554ca4[_0x1ac2('0x1c')][_0x1ac2('0x1e')]||null:null,'attributes':_0x554ca4[_0x1ac2('0x1c')]?_0x554ca4[_0x1ac2('0x1c')][_0x1ac2('0x1f')]||null:null,'include':_0x554ca4['options']?_0x554ca4[_0x1ac2('0x1c')][_0x1ac2('0x20')]?_[_0x1ac2('0x21')](_0x554ca4[_0x1ac2('0x1c')][_0x1ac2('0x20')],function(_0x1018d0){return{'model':db[_0x1018d0[_0x1ac2('0x22')]],'as':_0x1018d0['as'],'attributes':_0x1018d0[_0x1ac2('0x1f')],'include':_0x1018d0[_0x1ac2('0x20')]?_[_0x1ac2('0x21')](_0x1018d0['include'],function(_0x32d5e3){return{'model':db[_0x32d5e3['model']],'as':_0x32d5e3['as'],'attributes':_0x32d5e3[_0x1ac2('0x1f')],'include':_0x32d5e3['include']?_[_0x1ac2('0x21')](_0x32d5e3['include'],function(_0x230a84){return{'model':db[_0x230a84['model']],'as':_0x230a84['as'],'attributes':_0x230a84[_0x1ac2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1ac2('0x23')](function(_0xa461fc){logger[_0x1ac2('0x12')](_0x1ac2('0x24'),_0x554ca4);logger[_0x1ac2('0x14')](_0x1ac2('0x24'),_0x554ca4,JSON[_0x1ac2('0x25')](_0xa461fc));_0x1011af(_0xa461fc);})[_0x1ac2('0x1b')](function(_0xf8405){logger[_0x1ac2('0x16')](_0x1ac2('0x24'),_0xf8405['message'],_0x554ca4);_0x51cad3(_0x2d8fa6[_0x1ac2('0x16')](0x1f4,_0xf8405['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f36b9b8..77d499c 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 _0x51c5=['save','remove','update','removeListener','register','length','smsAccount:','./smsAccount.events'];(function(_0x381271,_0x282e3f){var _0x2a68a6=function(_0x3f0e41){while(--_0x3f0e41){_0x381271['push'](_0x381271['shift']());}};_0x2a68a6(++_0x282e3f);}(_0x51c5,0x8f));var _0x551c=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x51c5[_0x4e7d25];return _0x526fe6;};'use strict';var SmsAccountEvents=require(_0x551c('0x0'));var events=[_0x551c('0x1'),_0x551c('0x2'),_0x551c('0x3')];function createListener(_0x3b6f53,_0x2279a3){return function(_0xe03709){_0x2279a3['emit'](_0x3b6f53,_0xe03709);};}function removeListener(_0x230657,_0x1639d0){return function(){SmsAccountEvents[_0x551c('0x4')](_0x230657,_0x1639d0);};}exports[_0x551c('0x5')]=function(_0xe0272c){for(var _0x1aa8df=0x0,_0x21dfa1=events[_0x551c('0x6')];_0x1aa8df<_0x21dfa1;_0x1aa8df++){var _0x4f3a0a=events[_0x1aa8df];var _0x414edb=createListener(_0x551c('0x7')+_0x4f3a0a,_0xe0272c);SmsAccountEvents['on'](_0x4f3a0a,_0x414edb);}}; \ No newline at end of file +var _0xc71c=['remove','register','length','smsAccount:','save'];(function(_0x12b586,_0x295511){var _0x15c15d=function(_0xb38ae1){while(--_0xb38ae1){_0x12b586['push'](_0x12b586['shift']());}};_0x15c15d(++_0x295511);}(_0xc71c,0xfe));var _0xcc71=function(_0x1237fa,_0xeab61a){_0x1237fa=_0x1237fa-0x0;var _0xec781b=_0xc71c[_0x1237fa];return _0xec781b;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xcc71('0x0'),_0xcc71('0x1'),'update'];function createListener(_0x3c06e4,_0x419e79){return function(_0x562dc9){_0x419e79['emit'](_0x3c06e4,_0x562dc9);};}function removeListener(_0x335f2d,_0x48464f){return function(){SmsAccountEvents['removeListener'](_0x335f2d,_0x48464f);};}exports[_0xcc71('0x2')]=function(_0x276bed){for(var _0x50b577=0x0,_0x25d63d=events[_0xcc71('0x3')];_0x50b577<_0x25d63d;_0x50b577++){var _0x2084ba=events[_0x50b577];var _0x5f02a1=createListener(_0xcc71('0x4')+_0x2084ba,_0x276bed);SmsAccountEvents['on'](_0x2084ba,_0x5f02a1);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 5f94769..ed90913 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 _0xca7f=['index','/:id','show','post','create','put','update','exports','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated'];(function(_0x3f6b57,_0x4996a2){var _0x35b267=function(_0x2017f3){while(--_0x2017f3){_0x3f6b57['push'](_0x3f6b57['shift']());}};_0x35b267(++_0x4996a2);}(_0xca7f,0x1ac));var _0xfca7=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xca7f[_0x1e4f2d];return _0xd05ce5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfca7('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfca7('0x1'));var interaction=require(_0xfca7('0x2'));var config=require(_0xfca7('0x3'));var controller=require(_0xfca7('0x4'));router[_0xfca7('0x5')]('/',auth[_0xfca7('0x6')](),controller[_0xfca7('0x7')]);router[_0xfca7('0x5')](_0xfca7('0x8'),auth[_0xfca7('0x6')](),controller[_0xfca7('0x9')]);router[_0xfca7('0xa')]('/',auth[_0xfca7('0x6')](),controller[_0xfca7('0xb')]);router[_0xfca7('0xc')](_0xfca7('0x8'),auth['isAuthenticated'](),controller[_0xfca7('0xd')]);router['delete'](_0xfca7('0x8'),auth[_0xfca7('0x6')](),controller['destroy']);module[_0xfca7('0xe')]=router; \ No newline at end of file +var _0xe870=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4f5a21,_0x43237b){var _0xb87871=function(_0x3ef685){while(--_0x3ef685){_0x4f5a21['push'](_0x4f5a21['shift']());}};_0xb87871(++_0x43237b);}(_0xe870,0x1f3));var _0x0e87=function(_0x393895,_0x226a89){_0x393895=_0x393895-0x0;var _0x124702=_0xe870[_0x393895];return _0x124702;};'use strict';var multer=require(_0x0e87('0x0'));var util=require(_0x0e87('0x1'));var path=require(_0x0e87('0x2'));var timeout=require(_0x0e87('0x3'));var express=require(_0x0e87('0x4'));var router=express['Router']();var auth=require(_0x0e87('0x5'));var interaction=require(_0x0e87('0x6'));var config=require(_0x0e87('0x7'));var controller=require(_0x0e87('0x8'));router[_0x0e87('0x9')]('/',auth[_0x0e87('0xa')](),controller['index']);router[_0x0e87('0x9')](_0x0e87('0xb'),auth[_0x0e87('0xa')](),controller[_0x0e87('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e87('0xd')]);router['put'](_0x0e87('0xb'),auth[_0x0e87('0xa')](),controller[_0x0e87('0xe')]);router[_0x0e87('0xf')](_0x0e87('0xb'),auth[_0x0e87('0xa')](),controller[_0x0e87('0x10')]);module[_0x0e87('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index c7617d2..a31ab41 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 _0x501b=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x4e82ff,_0x3cbf4b){var _0x495205=function(_0x21bc88){while(--_0x21bc88){_0x4e82ff['push'](_0x4e82ff['shift']());}};_0x495205(++_0x3cbf4b);}(_0x501b,0x13e));var _0xb501=function(_0x11b237,_0x135320){_0x11b237=_0x11b237-0x0;var _0x5932da=_0x501b[_0x11b237];return _0x5932da;};'use strict';var Sequelize=require(_0xb501('0x0'));module[_0xb501('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb501('0x2')},'appdata':{'type':Sequelize[_0xb501('0x3')]()},'description':{'type':Sequelize[_0xb501('0x4')]},'interval':{'type':Sequelize[_0xb501('0x4')],'defaultValue':_0xb501('0x5')}}; \ No newline at end of file +var _0x1786=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x5746c2,_0x207500){var _0x45bb04=function(_0x580886){while(--_0x580886){_0x5746c2['push'](_0x5746c2['shift']());}};_0x45bb04(++_0x207500);}(_0x1786,0x1a8));var _0x6178=function(_0x166414,_0x36bd02){_0x166414=_0x166414-0x0;var _0x3c24ea=_0x1786[_0x166414];return _0x3c24ea;};'use strict';var Sequelize=require('sequelize');module[_0x6178('0x0')]={'priority':{'type':Sequelize[_0x6178('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6178('0x2')],'allowNull':![],'defaultValue':_0x6178('0x3')},'appdata':{'type':Sequelize[_0x6178('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6178('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 87bf790..bdaa39f 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 _0xc8be=['map','SmsApplication','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','keys','includeAll','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name'];(function(_0x48303b,_0x1c2207){var _0x39226e=function(_0x56703e){while(--_0x56703e){_0x48303b['push'](_0x48303b['shift']());}};_0x39226e(++_0x1c2207);}(_0xc8be,0x66));var _0xec8b=function(_0x5e85a7,_0x180744){_0x5e85a7=_0x5e85a7-0x0;var _0x4768b1=_0xc8be[_0x5e85a7];return _0x4768b1;};'use strict';var pdf=require(_0xec8b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xec8b('0x1'));var zipdir=require(_0xec8b('0x2'));var jsonpatch=require(_0xec8b('0x3'));var rp=require(_0xec8b('0x4'));var moment=require('moment');var BPromise=require(_0xec8b('0x5'));var Mustache=require('mustache');var util=require(_0xec8b('0x6'));var path=require('path');var sox=require(_0xec8b('0x7'));var csv=require(_0xec8b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec8b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec8b('0xa'));var deskjs=require(_0xec8b('0xb'));var toCsv=require(_0xec8b('0x8'));var querystring=require(_0xec8b('0xc'));var Papa=require(_0xec8b('0xd'));var Redis=require(_0xec8b('0xe'));var authService=require(_0xec8b('0xf'));var qs=require(_0xec8b('0x10'));var as=require(_0xec8b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec8b('0x12'));var utils=require(_0xec8b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xec8b('0x14'));var db=require(_0xec8b('0x15'))['db'];function respondWithStatusCode(_0x4ca809,_0x1995c1){_0x1995c1=_0x1995c1||0xcc;return function(_0x422fa4){if(_0x422fa4){return _0x4ca809['sendStatus'](_0x1995c1);}return _0x4ca809[_0xec8b('0x16')](_0x1995c1)[_0xec8b('0x17')]();};}function respondWithResult(_0x13f906,_0x5690ae){_0x5690ae=_0x5690ae||0xc8;return function(_0xf45552){if(_0xf45552){return _0x13f906[_0xec8b('0x16')](_0x5690ae)['json'](_0xf45552);}};}function respondWithFilteredResult(_0xce7885,_0xaeb0e8){return function(_0x58b20c){if(_0x58b20c){var _0x20b6d3=_0x58b20c[_0xec8b('0x18')],_0x37d573=_0xaeb0e8['offset'],_0x108044=_0xaeb0e8['offset']+_0xaeb0e8[_0xec8b('0x19')],_0x3102f2;if(_0x108044>=_0x20b6d3){_0x108044=_0x20b6d3;_0x3102f2=0xc8;}else{_0x3102f2=0xce;}_0xce7885[_0xec8b('0x16')](_0x3102f2);return _0xce7885[_0xec8b('0x1a')](_0xec8b('0x1b'),_0x37d573+'-'+_0x108044+'/'+_0x20b6d3)['json'](_0x58b20c);}return null;};}function patchUpdates(_0x2c0057){return function(_0x2fc86){try{jsonpatch[_0xec8b('0x1c')](_0x2fc86,_0x2c0057,!![]);}catch(_0x471996){return BPromise[_0xec8b('0x1d')](_0x471996);}return _0x2fc86[_0xec8b('0x1e')]();};}function saveUpdates(_0x87ed51,_0xc28469){return function(_0x3e1d73){if(_0x3e1d73){return _0x3e1d73[_0xec8b('0x1f')](_0x87ed51)['then'](function(_0x34b786){return _0x34b786;});}return null;};}function removeEntity(_0x4201c9,_0x5d393b){return function(_0x886b1f){if(_0x886b1f){return _0x886b1f['destroy']()[_0xec8b('0x20')](function(){_0x4201c9[_0xec8b('0x16')](0xcc)[_0xec8b('0x17')]();});}};}function handleEntityNotFound(_0x3b0e3b,_0xccd17d){return function(_0x3cb789){if(!_0x3cb789){_0x3b0e3b[_0xec8b('0x21')](0x194);}return _0x3cb789;};}function handleError(_0x11afdf,_0xfa0e21){_0xfa0e21=_0xfa0e21||0x1f4;return function(_0x437b20){logger['error'](_0x437b20[_0xec8b('0x22')]);if(_0x437b20[_0xec8b('0x23')]){delete _0x437b20['name'];}_0x11afdf[_0xec8b('0x16')](_0xfa0e21)['send'](_0x437b20);};}exports['index']=function(_0x1344d0,_0x57b70e){var _0x96ff6d={},_0x5929b9={},_0x4b950b={'count':0x0,'rows':[]};var _0x29c5=_[_0xec8b('0x24')](db[_0xec8b('0x25')]['rawAttributes'],function(_0x3167d0){return{'name':_0x3167d0[_0xec8b('0x26')],'type':_0x3167d0[_0xec8b('0x27')][_0xec8b('0x28')]};});_0x5929b9[_0xec8b('0x29')]=_[_0xec8b('0x24')](_0x29c5,_0xec8b('0x23'));_0x5929b9[_0xec8b('0x2a')]=_['keys'](_0x1344d0['query']);_0x5929b9[_0xec8b('0x2b')]=_[_0xec8b('0x2c')](_0x5929b9[_0xec8b('0x29')],_0x5929b9['query']);_0x96ff6d[_0xec8b('0x2d')]=_[_0xec8b('0x2c')](_0x5929b9[_0xec8b('0x29')],qs[_0xec8b('0x2e')](_0x1344d0['query']['fields']));_0x96ff6d[_0xec8b('0x2d')]=_0x96ff6d[_0xec8b('0x2d')][_0xec8b('0x2f')]?_0x96ff6d[_0xec8b('0x2d')]:_0x5929b9[_0xec8b('0x29')];if(!_0x1344d0['query'][_0xec8b('0x30')](_0xec8b('0x31'))){_0x96ff6d['limit']=qs[_0xec8b('0x19')](_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x19')]);_0x96ff6d[_0xec8b('0x32')]=qs['offset'](_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x32')]);}_0x96ff6d['order']=qs[_0xec8b('0x33')](_0x1344d0['query'][_0xec8b('0x33')]);_0x96ff6d[_0xec8b('0x34')]=qs[_0xec8b('0x2b')](_[_0xec8b('0x35')](_0x1344d0['query'],_0x5929b9[_0xec8b('0x2b')]),_0x29c5);if(_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x36')]){_0x96ff6d[_0xec8b('0x34')]=_['merge'](_0x96ff6d['where'],{'$or':_['map'](_0x29c5,function(_0x4cd469){if(_0x4cd469[_0xec8b('0x27')]!=='VIRTUAL'){var _0x515778={};_0x515778[_0x4cd469['name']]={'$like':'%'+_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x36')]+'%'};return _0x515778;}})});}_0x96ff6d=_[_0xec8b('0x37')]({},_0x96ff6d,_0x1344d0[_0xec8b('0x38')]);var _0x21d2e5={'where':_0x96ff6d['where']};return db[_0xec8b('0x25')][_0xec8b('0x18')](_0x21d2e5)[_0xec8b('0x20')](function(_0x515b67){_0x4b950b[_0xec8b('0x18')]=_0x515b67;if(_0x1344d0[_0xec8b('0x2a')]['includeAll']){_0x96ff6d[_0xec8b('0x39')]=[{'all':!![]}];}return db[_0xec8b('0x25')][_0xec8b('0x3a')](_0x96ff6d);})[_0xec8b('0x20')](function(_0x2f30ef){_0x4b950b[_0xec8b('0x3b')]=_0x2f30ef;return _0x4b950b;})[_0xec8b('0x20')](respondWithFilteredResult(_0x57b70e,_0x96ff6d))[_0xec8b('0x3c')](handleError(_0x57b70e,null));};exports[_0xec8b('0x3d')]=function(_0x44e0e8,_0x308ff7){var _0x180e1f={'raw':!![],'where':{'id':_0x44e0e8['params']['id']}},_0x1ddccd={};_0x1ddccd[_0xec8b('0x29')]=_['keys'](db[_0xec8b('0x25')][_0xec8b('0x3e')]);_0x1ddccd['query']=_[_0xec8b('0x3f')](_0x44e0e8['query']);_0x1ddccd['filters']=_[_0xec8b('0x2c')](_0x1ddccd[_0xec8b('0x29')],_0x1ddccd[_0xec8b('0x2a')]);_0x180e1f['attributes']=_['intersection'](_0x1ddccd[_0xec8b('0x29')],qs['fields'](_0x44e0e8['query'][_0xec8b('0x2e')]));_0x180e1f[_0xec8b('0x2d')]=_0x180e1f[_0xec8b('0x2d')][_0xec8b('0x2f')]?_0x180e1f['attributes']:_0x1ddccd[_0xec8b('0x29')];if(_0x44e0e8[_0xec8b('0x2a')][_0xec8b('0x40')]){_0x180e1f[_0xec8b('0x39')]=[{'all':!![]}];}_0x180e1f=_[_0xec8b('0x37')]({},_0x180e1f,_0x44e0e8['options']);return db[_0xec8b('0x25')][_0xec8b('0x41')](_0x180e1f)[_0xec8b('0x20')](handleEntityNotFound(_0x308ff7,null))['then'](respondWithResult(_0x308ff7,null))['catch'](handleError(_0x308ff7,null));};exports[_0xec8b('0x42')]=function(_0x54e0b6,_0x4c6575){return db[_0xec8b('0x25')][_0xec8b('0x42')](_0x54e0b6['body'],{})[_0xec8b('0x20')](respondWithResult(_0x4c6575,0xc9))[_0xec8b('0x3c')](handleError(_0x4c6575,null));};exports[_0xec8b('0x1f')]=function(_0x4fc726,_0x162918){if(_0x4fc726[_0xec8b('0x43')]['id']){delete _0x4fc726[_0xec8b('0x43')]['id'];}return db[_0xec8b('0x25')][_0xec8b('0x41')]({'where':{'id':_0x4fc726['params']['id']}})['then'](handleEntityNotFound(_0x162918,null))[_0xec8b('0x20')](saveUpdates(_0x4fc726[_0xec8b('0x43')],null))['then'](respondWithResult(_0x162918,null))[_0xec8b('0x3c')](handleError(_0x162918,null));};exports['destroy']=function(_0x24859d,_0x5d93cd){return db['SmsApplication'][_0xec8b('0x41')]({'where':{'id':_0x24859d[_0xec8b('0x44')]['id']}})[_0xec8b('0x20')](handleEntityNotFound(_0x5d93cd,null))['then'](removeEntity(_0x5d93cd,null))['catch'](handleError(_0x5d93cd,null));}; \ No newline at end of file +var _0x0805=['reject','update','then','destroy','end','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','sort','where','filter','type','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x486cf2,_0x53afbd){var _0x4985d5=function(_0x42599a){while(--_0x42599a){_0x486cf2['push'](_0x486cf2['shift']());}};_0x4985d5(++_0x53afbd);}(_0x0805,0x1c9));var _0x5080=function(_0x2eb87a,_0xae17c2){_0x2eb87a=_0x2eb87a-0x0;var _0x1c4a93=_0x0805[_0x2eb87a];return _0x1c4a93;};'use strict';var pdf=require(_0x5080('0x0'));var emlformat=require(_0x5080('0x1'));var rimraf=require(_0x5080('0x2'));var zipdir=require(_0x5080('0x3'));var jsonpatch=require(_0x5080('0x4'));var rp=require(_0x5080('0x5'));var moment=require(_0x5080('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5080('0x7'));var util=require(_0x5080('0x8'));var path=require('path');var sox=require(_0x5080('0x9'));var csv=require('to-csv');var ejs=require(_0x5080('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5080('0xb'));var crypto=require(_0x5080('0xc'));var jsforce=require(_0x5080('0xd'));var deskjs=require(_0x5080('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5080('0xf'));var Papa=require(_0x5080('0x10'));var Redis=require('ioredis');var authService=require(_0x5080('0x11'));var qs=require(_0x5080('0x12'));var as=require(_0x5080('0x13'));var hardwareService=require(_0x5080('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5080('0x15'));var licenseUtil=require(_0x5080('0x16'));var db=require(_0x5080('0x17'))['db'];function respondWithStatusCode(_0x342414,_0x405260){_0x405260=_0x405260||0xcc;return function(_0x4bad93){if(_0x4bad93){return _0x342414[_0x5080('0x18')](_0x405260);}return _0x342414[_0x5080('0x19')](_0x405260)['end']();};}function respondWithResult(_0x5158e5,_0x41cd99){_0x41cd99=_0x41cd99||0xc8;return function(_0x1793f9){if(_0x1793f9){return _0x5158e5['status'](_0x41cd99)[_0x5080('0x1a')](_0x1793f9);}};}function respondWithFilteredResult(_0x5eafc9,_0x30650c){return function(_0x4c02d0){if(_0x4c02d0){var _0x37b87c=_0x4c02d0[_0x5080('0x1b')],_0x35e1c7=_0x30650c[_0x5080('0x1c')],_0x3fd5a2=_0x30650c[_0x5080('0x1c')]+_0x30650c[_0x5080('0x1d')],_0x4ca401;if(_0x3fd5a2>=_0x37b87c){_0x3fd5a2=_0x37b87c;_0x4ca401=0xc8;}else{_0x4ca401=0xce;}_0x5eafc9[_0x5080('0x19')](_0x4ca401);return _0x5eafc9[_0x5080('0x1e')](_0x5080('0x1f'),_0x35e1c7+'-'+_0x3fd5a2+'/'+_0x37b87c)['json'](_0x4c02d0);}return null;};}function patchUpdates(_0x37f5b5){return function(_0x1cfbd8){try{jsonpatch[_0x5080('0x20')](_0x1cfbd8,_0x37f5b5,!![]);}catch(_0xe8ca47){return BPromise[_0x5080('0x21')](_0xe8ca47);}return _0x1cfbd8['save']();};}function saveUpdates(_0x505a3a,_0x400391){return function(_0x3424fe){if(_0x3424fe){return _0x3424fe[_0x5080('0x22')](_0x505a3a)[_0x5080('0x23')](function(_0x343afc){return _0x343afc;});}return null;};}function removeEntity(_0x4be373,_0x83af9b){return function(_0x90cbb2){if(_0x90cbb2){return _0x90cbb2[_0x5080('0x24')]()[_0x5080('0x23')](function(){_0x4be373[_0x5080('0x19')](0xcc)[_0x5080('0x25')]();});}};}function handleEntityNotFound(_0x6fdf77,_0x35a151){return function(_0x562ae5){if(!_0x562ae5){_0x6fdf77['sendStatus'](0x194);}return _0x562ae5;};}function handleError(_0x53b000,_0x5698c1){_0x5698c1=_0x5698c1||0x1f4;return function(_0x4b3dd7){logger[_0x5080('0x26')](_0x4b3dd7[_0x5080('0x27')]);if(_0x4b3dd7[_0x5080('0x28')]){delete _0x4b3dd7[_0x5080('0x28')];}_0x53b000[_0x5080('0x19')](_0x5698c1)[_0x5080('0x29')](_0x4b3dd7);};}exports['index']=function(_0x2a93c8,_0x3dd280){var _0x947a19={},_0x305210={},_0x12cdb1={'count':0x0,'rows':[]};var _0x589ff7=_[_0x5080('0x2a')](db[_0x5080('0x2b')][_0x5080('0x2c')],function(_0x415ce3){return{'name':_0x415ce3[_0x5080('0x2d')],'type':_0x415ce3['type'][_0x5080('0x2e')]};});_0x305210[_0x5080('0x2f')]=_[_0x5080('0x2a')](_0x589ff7,_0x5080('0x28'));_0x305210['query']=_['keys'](_0x2a93c8['query']);_0x305210[_0x5080('0x30')]=_[_0x5080('0x31')](_0x305210[_0x5080('0x2f')],_0x305210[_0x5080('0x32')]);_0x947a19[_0x5080('0x33')]=_[_0x5080('0x31')](_0x305210[_0x5080('0x2f')],qs['fields'](_0x2a93c8[_0x5080('0x32')][_0x5080('0x34')]));_0x947a19['attributes']=_0x947a19['attributes'][_0x5080('0x35')]?_0x947a19[_0x5080('0x33')]:_0x305210[_0x5080('0x2f')];if(!_0x2a93c8[_0x5080('0x32')]['hasOwnProperty']('nolimit')){_0x947a19[_0x5080('0x1d')]=qs[_0x5080('0x1d')](_0x2a93c8['query'][_0x5080('0x1d')]);_0x947a19[_0x5080('0x1c')]=qs[_0x5080('0x1c')](_0x2a93c8['query']['offset']);}_0x947a19['order']=qs[_0x5080('0x36')](_0x2a93c8[_0x5080('0x32')][_0x5080('0x36')]);_0x947a19[_0x5080('0x37')]=qs[_0x5080('0x30')](_['pick'](_0x2a93c8[_0x5080('0x32')],_0x305210[_0x5080('0x30')]),_0x589ff7);if(_0x2a93c8[_0x5080('0x32')][_0x5080('0x38')]){_0x947a19['where']=_['merge'](_0x947a19[_0x5080('0x37')],{'$or':_['map'](_0x589ff7,function(_0x3ca6dc){if(_0x3ca6dc[_0x5080('0x39')]!=='VIRTUAL'){var _0x41aea9={};_0x41aea9[_0x3ca6dc['name']]={'$like':'%'+_0x2a93c8['query'][_0x5080('0x38')]+'%'};return _0x41aea9;}})});}_0x947a19=_[_0x5080('0x3a')]({},_0x947a19,_0x2a93c8[_0x5080('0x3b')]);var _0x2adcef={'where':_0x947a19[_0x5080('0x37')]};return db[_0x5080('0x2b')][_0x5080('0x1b')](_0x2adcef)['then'](function(_0x3dbce3){_0x12cdb1[_0x5080('0x1b')]=_0x3dbce3;if(_0x2a93c8[_0x5080('0x32')][_0x5080('0x3c')]){_0x947a19[_0x5080('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x5080('0x3e')](_0x947a19);})[_0x5080('0x23')](function(_0x5c6a81){_0x12cdb1['rows']=_0x5c6a81;return _0x12cdb1;})[_0x5080('0x23')](respondWithFilteredResult(_0x3dd280,_0x947a19))[_0x5080('0x3f')](handleError(_0x3dd280,null));};exports[_0x5080('0x40')]=function(_0x1a4f82,_0x5ba920){var _0x1847ff={'raw':!![],'where':{'id':_0x1a4f82[_0x5080('0x41')]['id']}},_0x276b27={};_0x276b27[_0x5080('0x2f')]=_[_0x5080('0x42')](db[_0x5080('0x2b')][_0x5080('0x2c')]);_0x276b27[_0x5080('0x32')]=_[_0x5080('0x42')](_0x1a4f82[_0x5080('0x32')]);_0x276b27[_0x5080('0x30')]=_[_0x5080('0x31')](_0x276b27[_0x5080('0x2f')],_0x276b27[_0x5080('0x32')]);_0x1847ff[_0x5080('0x33')]=_['intersection'](_0x276b27[_0x5080('0x2f')],qs[_0x5080('0x34')](_0x1a4f82[_0x5080('0x32')][_0x5080('0x34')]));_0x1847ff[_0x5080('0x33')]=_0x1847ff[_0x5080('0x33')][_0x5080('0x35')]?_0x1847ff['attributes']:_0x276b27[_0x5080('0x2f')];if(_0x1a4f82[_0x5080('0x32')][_0x5080('0x3c')]){_0x1847ff[_0x5080('0x3d')]=[{'all':!![]}];}_0x1847ff=_[_0x5080('0x3a')]({},_0x1847ff,_0x1a4f82[_0x5080('0x3b')]);return db[_0x5080('0x2b')][_0x5080('0x43')](_0x1847ff)['then'](handleEntityNotFound(_0x5ba920,null))['then'](respondWithResult(_0x5ba920,null))['catch'](handleError(_0x5ba920,null));};exports[_0x5080('0x44')]=function(_0x59fd07,_0x4d747d){return db[_0x5080('0x2b')][_0x5080('0x44')](_0x59fd07[_0x5080('0x45')],{})[_0x5080('0x23')](respondWithResult(_0x4d747d,0xc9))[_0x5080('0x3f')](handleError(_0x4d747d,null));};exports[_0x5080('0x22')]=function(_0x312e59,_0x2ffc78){if(_0x312e59[_0x5080('0x45')]['id']){delete _0x312e59[_0x5080('0x45')]['id'];}return db[_0x5080('0x2b')]['find']({'where':{'id':_0x312e59['params']['id']}})[_0x5080('0x23')](handleEntityNotFound(_0x2ffc78,null))[_0x5080('0x23')](saveUpdates(_0x312e59[_0x5080('0x45')],null))[_0x5080('0x23')](respondWithResult(_0x2ffc78,null))[_0x5080('0x3f')](handleError(_0x2ffc78,null));};exports['destroy']=function(_0x28c1b4,_0xb0ea13){return db[_0x5080('0x2b')][_0x5080('0x43')]({'where':{'id':_0x28c1b4[_0x5080('0x41')]['id']}})['then'](handleEntityNotFound(_0xb0ea13,null))[_0x5080('0x23')](removeEntity(_0xb0ea13,null))[_0x5080('0x3f')](handleError(_0xb0ea13,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 11fbc2e..e5938f1 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 _0x1c59=['request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x4c74f4,_0x2f93c4){var _0x5aaee1=function(_0x41326b){while(--_0x41326b){_0x4c74f4['push'](_0x4c74f4['shift']());}};_0x5aaee1(++_0x2f93c4);}(_0x1c59,0x11c));var _0x91c5=function(_0x5cd082,_0x149ca3){_0x5cd082=_0x5cd082-0x0;var _0x34e4c8=_0x1c59[_0x5cd082];return _0x34e4c8;};'use strict';var _=require(_0x91c5('0x0'));var util=require(_0x91c5('0x1'));var logger=require(_0x91c5('0x2'))('api');var moment=require(_0x91c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x91c5('0x4'));var fs=require('fs');var path=require(_0x91c5('0x5'));var rimraf=require(_0x91c5('0x6'));var config=require('../../config/environment');var attributes=require(_0x91c5('0x7'));module['exports']=function(_0x46bae7,_0x42aeb5){return _0x46bae7[_0x91c5('0x8')](_0x91c5('0x9'),attributes,{'tableName':_0x91c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x91c5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd98e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0xbfc7c0,_0xdc38ce){var _0x180870=function(_0x27c04a){while(--_0x27c04a){_0xbfc7c0['push'](_0xbfc7c0['shift']());}};_0x180870(++_0xdc38ce);}(_0xd98e,0x173));var _0xed98=function(_0x26a5a8,_0x56cb86){_0x26a5a8=_0x26a5a8-0x0;var _0xf3c51f=_0xd98e[_0x26a5a8];return _0xf3c51f;};'use strict';var _=require(_0xed98('0x0'));var util=require(_0xed98('0x1'));var logger=require(_0xed98('0x2'))(_0xed98('0x3'));var moment=require(_0xed98('0x4'));var BPromise=require(_0xed98('0x5'));var rp=require(_0xed98('0x6'));var fs=require('fs');var path=require(_0xed98('0x7'));var rimraf=require(_0xed98('0x8'));var config=require(_0xed98('0x9'));var attributes=require(_0xed98('0xa'));module[_0xed98('0xb')]=function(_0x52579c,_0x3c9ecc){return _0x52579c[_0xed98('0xc')]('SmsApplication',attributes,{'tableName':_0xed98('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xed98('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 286d5bc..4f2937b 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 _0x9658=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x6d1330,_0xd87fc9){var _0x20776e=function(_0x2593b6){while(--_0x2593b6){_0x6d1330['push'](_0x6d1330['shift']());}};_0x20776e(++_0xd87fc9);}(_0x9658,0x6f));var _0x8965=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x9658[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0x8965('0x0'));var util=require('util');var moment=require(_0x8965('0x1'));var BPromise=require(_0x8965('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8965('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8965('0x4'));var logger=require(_0x8965('0x5'))(_0x8965('0x6'));var config=require('../../config/environment');var jayson=require(_0x8965('0x7'));var client=jayson[_0x8965('0x8')][_0x8965('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290f30,_0x271060,_0x27b334){return new BPromise(function(_0x1e7d61,_0xe14503){return client[_0x8965('0xa')](_0x290f30,_0x27b334)[_0x8965('0xb')](function(_0x214249){logger[_0x8965('0xc')](_0x8965('0xd'),_0x271060,_0x8965('0xe'));logger[_0x8965('0xf')](_0x8965('0x10'),_0x271060,_0x8965('0xe'),JSON[_0x8965('0x11')](_0x214249));if(_0x214249[_0x8965('0x12')]){if(_0x214249['error'][_0x8965('0x13')]===0x1f4){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0xe14503(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}logger[_0x8965('0x12')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0x1e7d61(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}else{logger[_0x8965('0xc')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x8965('0xe'));_0x1e7d61(_0x214249[_0x8965('0x15')][_0x8965('0x14')]);}})[_0x8965('0x16')](function(_0x5c7d55){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x5c7d55);_0xe14503(_0x5c7d55);});});} \ No newline at end of file +var _0x5162=['jayson/promise','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5162,0x103));var _0x2516=function(_0x48fff1,_0x50c537){_0x48fff1=_0x48fff1-0x0;var _0x127a1d=_0x5162[_0x48fff1];return _0x127a1d;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2516('0x1'));var db=require(_0x2516('0x2'))['db'];var utils=require(_0x2516('0x3'));var logger=require(_0x2516('0x4'))(_0x2516('0x5'));var config=require(_0x2516('0x6'));var jayson=require(_0x2516('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5beeb3,_0x20a4a4,_0xba4b36){return new BPromise(function(_0xa1557,_0x3a8834){return client[_0x2516('0x8')](_0x5beeb3,_0xba4b36)[_0x2516('0x9')](function(_0x1cb817){logger['info'](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));logger[_0x2516('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x20a4a4,'request\x20sent',JSON['stringify'](_0x1cb817));if(_0x1cb817['error']){if(_0x1cb817[_0x2516('0xd')][_0x2516('0xe')]===0x1f4){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817['error'][_0x2516('0xf')]);return _0x3a8834(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);return _0xa1557(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}else{logger[_0x2516('0x10')](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));_0xa1557(_0x1cb817[_0x2516('0x11')][_0x2516('0xf')]);}})[_0x2516('0x12')](function(_0x5623be){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x5623be);_0x3a8834(_0x5623be);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index e0f54c8..34d5784 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 _0xc863=['sms','smsinteraction:addtags','addTags','put','/:id','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc863,0x155));var _0x3c86=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xc863[_0xf50820];return _0x2a9b10;};'use strict';var multer=require('multer');var util=require(_0x3c86('0x0'));var path=require(_0x3c86('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c86('0x2'));var router=express[_0x3c86('0x3')]();var auth=require(_0x3c86('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsInteraction.controller');router[_0x3c86('0x5')]('/',auth[_0x3c86('0x6')](),controller[_0x3c86('0x7')]);router[_0x3c86('0x5')](_0x3c86('0x8'),auth[_0x3c86('0x6')](),controller[_0x3c86('0x9')]);router[_0x3c86('0x5')]('/:id',auth[_0x3c86('0x6')](),controller[_0x3c86('0xa')]);router['get'](_0x3c86('0xb'),auth[_0x3c86('0x6')](),controller[_0x3c86('0xc')]);router['get'](_0x3c86('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x3c86('0xe')]('/',auth[_0x3c86('0x6')](),controller[_0x3c86('0xf')]);router['post'](_0x3c86('0xb'),auth['isAuthenticated'](),controller[_0x3c86('0x10')]);router[_0x3c86('0xe')](_0x3c86('0x11'),auth['isAuthenticated'](),interaction[_0x3c86('0x12')](_0x3c86('0x13'),_0x3c86('0x14')),controller[_0x3c86('0x15')]);router[_0x3c86('0x16')](_0x3c86('0x17'),auth[_0x3c86('0x6')](),interaction[_0x3c86('0x12')](_0x3c86('0x13'),'smsinteraction:update'),controller[_0x3c86('0x18')]);router[_0x3c86('0x19')](_0x3c86('0x17'),auth[_0x3c86('0x6')](),interaction[_0x3c86('0x12')](_0x3c86('0x13'),_0x3c86('0x1a')),controller[_0x3c86('0x1b')]);router[_0x3c86('0x19')](_0x3c86('0x11'),auth[_0x3c86('0x6')](),controller[_0x3c86('0x1c')]);module[_0x3c86('0x1d')]=router; \ No newline at end of file +var _0x15b1=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','sms','smsinteraction:addtags','put','tracked','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b1,0x13e));var _0x115b=function(_0x1553a4,_0xb4e3f9){_0x1553a4=_0x1553a4-0x0;var _0x37fd3c=_0x15b1[_0x1553a4];return _0x37fd3c;};'use strict';var multer=require(_0x115b('0x0'));var util=require(_0x115b('0x1'));var path=require(_0x115b('0x2'));var timeout=require(_0x115b('0x3'));var express=require(_0x115b('0x4'));var router=express[_0x115b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x115b('0x6'));var config=require(_0x115b('0x7'));var controller=require(_0x115b('0x8'));router[_0x115b('0x9')]('/',auth[_0x115b('0xa')](),controller[_0x115b('0xb')]);router[_0x115b('0x9')](_0x115b('0xc'),auth[_0x115b('0xa')](),controller['describe']);router[_0x115b('0x9')](_0x115b('0xd'),auth[_0x115b('0xa')](),controller['show']);router[_0x115b('0x9')](_0x115b('0xe'),auth[_0x115b('0xa')](),controller[_0x115b('0xf')]);router[_0x115b('0x9')](_0x115b('0x10'),auth['isAuthenticated'](),controller[_0x115b('0x11')]);router[_0x115b('0x12')]('/',auth[_0x115b('0xa')](),controller[_0x115b('0x13')]);router[_0x115b('0x12')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x115b('0x12')](_0x115b('0x14'),auth[_0x115b('0xa')](),interaction['tracked'](_0x115b('0x15'),_0x115b('0x16')),controller['addTags']);router[_0x115b('0x17')](_0x115b('0xd'),auth[_0x115b('0xa')](),interaction[_0x115b('0x18')](_0x115b('0x15'),_0x115b('0x19')),controller[_0x115b('0x1a')]);router[_0x115b('0x1b')](_0x115b('0xd'),auth[_0x115b('0xa')](),interaction['tracked'](_0x115b('0x15'),_0x115b('0x1c')),controller[_0x115b('0x1d')]);router[_0x115b('0x1b')](_0x115b('0x14'),auth[_0x115b('0xa')](),controller[_0x115b('0x1e')]);module[_0x115b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 71cff58..e4d9449 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 _0x3ef8=['exports','STRING','ENUM','out','DATE','sequelize'];(function(_0x1f2ef2,_0x5ae3a7){var _0x31bce2=function(_0x5a7e1c){while(--_0x5a7e1c){_0x1f2ef2['push'](_0x1f2ef2['shift']());}};_0x31bce2(++_0x5ae3a7);}(_0x3ef8,0xef));var _0x83ef=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3ef8[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x83ef('0x0'));var moment=require('moment');module[_0x83ef('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x83ef('0x2')]},'thirdDisposition':{'type':Sequelize[_0x83ef('0x2')]},'note':{'type':Sequelize[_0x83ef('0x2')]},'phone':{'type':Sequelize[_0x83ef('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x83ef('0x3')]('in',_0x83ef('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x83ef('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x83ef('0x3')]('in',_0x83ef('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4711=['moment','exports','BOOLEAN','STRING','DATE','out','ENUM','sequelize'];(function(_0x11622f,_0x20cde1){var _0x4112b3=function(_0x141f3d){while(--_0x141f3d){_0x11622f['push'](_0x11622f['shift']());}};_0x4112b3(++_0x20cde1);}(_0x4711,0x1c7));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1471('0x0'));var moment=require(_0x1471('0x1'));module[_0x1471('0x2')]={'closed':{'type':Sequelize[_0x1471('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1471('0x4')]},'secondDisposition':{'type':Sequelize[_0x1471('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1471('0x4')]},'note':{'type':Sequelize[_0x1471('0x4')]},'phone':{'type':Sequelize[_0x1471('0x4')]},'read1stAt':{'type':Sequelize[_0x1471('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1471('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1471('0x7')]('in',_0x1471('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 2c91b2e..fc841a8 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 _0xc2c2=['redis','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','select','field','from','tools_tags','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','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','find','UserId','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\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','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','agent','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','all','show','params','includeAll','include','options','create','body','destroy','addMessage','SmsMessage','ids','omit','findOne','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','push','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','N.A.','closedAt','disposition','out','System','views','toFile','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc2c2,0x1bb));var _0x2c2c=function(_0x5cb366,_0x2a3d54){_0x5cb366=_0x5cb366-0x0;var _0x4358cd=_0xc2c2[_0x5cb366];return _0x4358cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c2c('0x0'));var rimraf=require(_0x2c2c('0x1'));var zipdir=require(_0x2c2c('0x2'));var jsonpatch=require(_0x2c2c('0x3'));var rp=require(_0x2c2c('0x4'));var moment=require(_0x2c2c('0x5'));var BPromise=require(_0x2c2c('0x6'));var Mustache=require(_0x2c2c('0x7'));var util=require(_0x2c2c('0x8'));var path=require(_0x2c2c('0x9'));var sox=require(_0x2c2c('0xa'));var csv=require(_0x2c2c('0xb'));var ejs=require(_0x2c2c('0xc'));var fs=require('fs');var _=require(_0x2c2c('0xd'));var squel=require(_0x2c2c('0xe'));var crypto=require(_0x2c2c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2c2c('0x10'));var toCsv=require(_0x2c2c('0xb'));var querystring=require(_0x2c2c('0x11'));var Papa=require(_0x2c2c('0x12'));var Redis=require(_0x2c2c('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2c2c('0x14'));var hardwareService=require(_0x2c2c('0x15'));var logger=require(_0x2c2c('0x16'))(_0x2c2c('0x17'));var utils=require(_0x2c2c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2c2c('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2c2c('0x1a')](config[_0x2c2c('0x1b')],{'host':_0x2c2c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c2c('0x1b')]));require('./smsInteraction.socket')[_0x2c2c('0x1d')](socket);function respondWithStatusCode(_0x2e6935,_0x392cdc){_0x392cdc=_0x392cdc||0xcc;return function(_0x4db14c){if(_0x4db14c){return _0x2e6935[_0x2c2c('0x1e')](_0x392cdc);}return _0x2e6935[_0x2c2c('0x1f')](_0x392cdc)[_0x2c2c('0x20')]();};}function respondWithResult(_0x1f587c,_0x33dcea){_0x33dcea=_0x33dcea||0xc8;return function(_0xcbee95){if(_0xcbee95){return _0x1f587c[_0x2c2c('0x1f')](_0x33dcea)[_0x2c2c('0x21')](_0xcbee95);}};}function respondWithFilteredResult(_0x4ea8dc,_0xbaa836){return function(_0x1d190c){if(_0x1d190c){var _0x2f1020=_0x1d190c[_0x2c2c('0x22')],_0x5b5aeb=_0xbaa836[_0x2c2c('0x23')],_0x578875=_0xbaa836[_0x2c2c('0x23')]+_0xbaa836[_0x2c2c('0x24')],_0x2d5241;if(_0x578875>=_0x2f1020){_0x578875=_0x2f1020;_0x2d5241=0xc8;}else{_0x2d5241=0xce;}_0x4ea8dc[_0x2c2c('0x1f')](_0x2d5241);return _0x4ea8dc[_0x2c2c('0x25')](_0x2c2c('0x26'),_0x5b5aeb+'-'+_0x578875+'/'+_0x2f1020)[_0x2c2c('0x21')](_0x1d190c);}return null;};}function patchUpdates(_0x102f0f){return function(_0x16fbab){try{jsonpatch[_0x2c2c('0x27')](_0x16fbab,_0x102f0f,!![]);}catch(_0x21066d){return BPromise[_0x2c2c('0x28')](_0x21066d);}return _0x16fbab[_0x2c2c('0x29')]();};}function saveUpdates(_0x42d936,_0x159cbb){return function(_0x366253){if(_0x366253){return _0x366253[_0x2c2c('0x2a')](_0x42d936)['then'](function(_0x247bf2){return _0x247bf2;});}return null;};}function removeEntity(_0x579cb8,_0x5c9ed9){return function(_0x5170cd){if(_0x5170cd){return _0x5170cd['destroy']()[_0x2c2c('0x2b')](function(){_0x579cb8['status'](0xcc)[_0x2c2c('0x20')]();});}};}function handleEntityNotFound(_0x4480be,_0x2bf15b){return function(_0xe83116){if(!_0xe83116){_0x4480be[_0x2c2c('0x1e')](0x194);}return _0xe83116;};}function handleError(_0x3a581c,_0x43d69c){_0x43d69c=_0x43d69c||0x1f4;return function(_0x238232){logger['error'](_0x238232[_0x2c2c('0x2c')]);if(_0x238232[_0x2c2c('0x2d')]){delete _0x238232[_0x2c2c('0x2d')];}_0x3a581c[_0x2c2c('0x1f')](_0x43d69c)[_0x2c2c('0x2e')](_0x238232);};}function getInteractionUsers(_0x4dfb15,_0xebee03){return new BPromise(function(_0x3d78a8,_0x2c4e86){try{if(_0xebee03[_0x4dfb15['id']]){_0x4dfb15[_0x2c2c('0x2f')]=_[_0x2c2c('0x30')](_0xebee03[_0x4dfb15['id']],function(_0x43453d){return{'id':_0x43453d['id'],'fullname':_0x43453d[_0x2c2c('0x31')]};});}}catch(_0x24513e){_0x2c4e86(_0x24513e);}_0x3d78a8(_0x4dfb15);});}function getInteractionTags(_0x4cf22d,_0x131ac8){return new BPromise(function(_0x4b23fb,_0x237fe8){try{if(_0x4cf22d[_0x2c2c('0x32')]){_0x4cf22d[_0x2c2c('0x33')]=[];_0x4cf22d[_0x2c2c('0x32')][_0x2c2c('0x34')](',')[_0x2c2c('0x35')](function(_0x37721c){_0x4cf22d[_0x2c2c('0x33')]['push'](_0x131ac8[_0x37721c]);});}delete _0x4cf22d[_0x2c2c('0x32')];}catch(_0x24de10){_0x237fe8(_0x24de10);}_0x4b23fb(_0x4cf22d);});}function updateSmsInteraction(_0x64be85,_0x1771b3,_0x43c225){return new BPromise(function(_0x1ee92f,_0x210836){return getInteractionUsers(_0x64be85,_0x43c225)['then'](function(_0x28faa4){return getInteractionTags(_0x28faa4,_0x1771b3);})[_0x2c2c('0x2b')](function(_0x516a94){_0x1ee92f(_0x516a94);})[_0x2c2c('0x36')](function(_0x54efe1){_0x210836(_0x54efe1);});});}exports[_0x2c2c('0x37')]=function(_0x2fc72f,_0xff594){var _0x2ccea9={},_0x1c5c73={},_0x260f52={'count':0x0,'rows':[]};var _0x1f6371=_[_0x2c2c('0x30')](db[_0x2c2c('0x38')][_0x2c2c('0x39')],function(_0x5b4b75){return{'name':_0x5b4b75[_0x2c2c('0x3a')],'type':_0x5b4b75[_0x2c2c('0x3b')][_0x2c2c('0x3c')]};});_0x1c5c73[_0x2c2c('0x3d')]=_[_0x2c2c('0x30')](_0x1f6371,_0x2c2c('0x2d'));_0x1c5c73[_0x2c2c('0x3e')]=_[_0x2c2c('0x3f')](_0x2fc72f[_0x2c2c('0x3e')]);_0x1c5c73['filters']=_['intersection'](_0x1c5c73[_0x2c2c('0x3d')],_0x1c5c73[_0x2c2c('0x3e')]);_0x2ccea9[_0x2c2c('0x40')]=_[_0x2c2c('0x41')](_0x1c5c73[_0x2c2c('0x3d')],qs[_0x2c2c('0x42')](_0x2fc72f[_0x2c2c('0x3e')]['fields']));_0x2ccea9['attributes']=_0x2ccea9[_0x2c2c('0x40')]['length']?_0x2ccea9[_0x2c2c('0x40')]:_0x1c5c73['model'];if(!_0x2fc72f[_0x2c2c('0x3e')]['hasOwnProperty'](_0x2c2c('0x43'))){_0x2ccea9[_0x2c2c('0x24')]=qs['limit'](_0x2fc72f[_0x2c2c('0x3e')]['limit']);_0x2ccea9[_0x2c2c('0x23')]=qs[_0x2c2c('0x23')](_0x2fc72f['query'][_0x2c2c('0x23')]);}_0x2ccea9[_0x2c2c('0x44')]=qs[_0x2c2c('0x45')](_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x45')]);_0x2ccea9['where']=qs[_0x2c2c('0x46')](_[_0x2c2c('0x47')](_0x2fc72f['query'],_0x1c5c73[_0x2c2c('0x46')]),_0x1f6371);var _0x27817f=[];var _0x3b1ece=squel[_0x2c2c('0x48')]()[_0x2c2c('0x49')]('id')[_0x2c2c('0x49')](_0x2c2c('0x2d'))[_0x2c2c('0x49')]('color')[_0x2c2c('0x4a')](_0x2c2c('0x4b'));var _0x38e593=squel[_0x2c2c('0x48')]()[_0x2c2c('0x49')]('u.id')['field']('u.fullname')['field'](_0x2c2c('0x4c'))[_0x2c2c('0x4a')](_0x2c2c('0x4d'),'ui')[_0x2c2c('0x4e')](_0x2c2c('0x4f'),'u',_0x2c2c('0x50'));var _0x5e2d5a=squel[_0x2c2c('0x48')]()[_0x2c2c('0x4a')]('sms_interactions','i')[_0x2c2c('0x4e')]('cm_contacts','c',_0x2c2c('0x51'))[_0x2c2c('0x4e')](_0x2c2c('0x4f'),'o',_0x2c2c('0x52'))[_0x2c2c('0x4e')](_0x2c2c('0x53'),'a',_0x2c2c('0x54'))[_0x2c2c('0x4e')]('sms_messages','me',_0x2c2c('0x55'))[_0x2c2c('0x4e')]('sms_interaction_has_tags','it',_0x2c2c('0x56'))[_0x2c2c('0x4e')](_0x2c2c('0x4b'),'t',_0x2c2c('0x57'));var _0x1b1048=squel[_0x2c2c('0x58')]();var _0x222c51=[];var _0x273566=squel['expr']();var _0x337a95;if(_0x2fc72f['query'][_0x2c2c('0x59')]){_0x337a95=as[_0x2c2c('0x5a')](_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x59')]);var _0x2f204a=_0x337a95['sqlOperator'];for(var _0x5004c8=0x0;_0x5004c8<_0x337a95['conditions']['length'];_0x5004c8++){var _0x1d2390=_0x337a95[_0x2c2c('0x5b')][_0x5004c8];var _0x3e674b='i';var _0x364e56=_['find'](_0x1f6371,['name',_0x1d2390[_0x2c2c('0x49')]]);if(!_0x364e56){switch(_0x1d2390[_0x2c2c('0x49')]){case _0x2c2c('0x5c'):if(_0x1d2390['value']==0x1){_0x5e2d5a[_0x2c2c('0x5d')]('`'+_0x1d2390[_0x2c2c('0x49')]+_0x2c2c('0x5e'));}else{_0x5e2d5a[_0x2c2c('0x5d')]('`'+_0x1d2390[_0x2c2c('0x49')]+_0x2c2c('0x5f'));}break;case _0x2c2c('0x60'):if(_0x1d2390[_0x2c2c('0x61')]===_0x2c2c('0x62')){if(_0x1d2390['value'][_0x2c2c('0x34')]('\x20')[_0x2c2c('0x63')]>0x1){_0x1b1048[_0x2f204a](_0x2c2c('0x64'),qs['getFullTextValue'](_0x1d2390[_0x2c2c('0x65')]),null);}else{var _0x70ce7a='%'+_0x1d2390[_0x2c2c('0x65')]+'%';_0x1b1048[_0x2f204a](_0x2c2c('0x66'),_0x70ce7a,_0x70ce7a,_0x70ce7a);}}else{_0x364e56=_['find'](_0x1f6371,[_0x2c2c('0x2d'),_0x2c2c('0x67')]);_0x1d2390[_0x2c2c('0x49')]='ContactId';_0x578f0d=as[_0x2c2c('0x68')](_0x3e674b,_0x364e56['type'],_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d[_0x2c2c('0x69')],_0x578f0d['value'][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x20')]);}break;case _0x2c2c('0x6b'):var _0x214199=_0x1d2390[_0x2c2c('0x65')]['split'](',')['map'](function(_0x1b0b6d){return Number(_0x1b0b6d);});_0x214199['forEach'](function(_0x2246dd){_0x273566['or'](_0x2c2c('0x6c'),'%,'+_0x2246dd+',%');});_0x222c51=_[_0x2c2c('0x6d')](_0x222c51,_0x214199);break;case _0x2c2c('0x6e'):if(_0x1d2390[_0x2c2c('0x61')]==='$substring'){_0x1b1048[_0x2f204a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1d2390[_0x2c2c('0x65')]+'%',null);}else{_0x364e56=_[_0x2c2c('0x6f')](_0x1f6371,[_0x2c2c('0x2d'),_0x2c2c('0x70')]);_0x1d2390[_0x2c2c('0x49')]=_0x2c2c('0x70');_0x578f0d=as[_0x2c2c('0x68')](_0x3e674b,_0x364e56[_0x2c2c('0x3b')],_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d['text'],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x20')]);}break;case'body':_0x578f0d=as[_0x2c2c('0x68')]('me',null,_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d[_0x2c2c('0x69')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')]['end']);break;}}else{var _0x578f0d=as[_0x2c2c('0x68')](_0x3e674b,_0x364e56[_0x2c2c('0x3b')],_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d[_0x2c2c('0x69')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x20')]);}}}else{var _0xa7b6c9=_(_0x2fc72f[_0x2c2c('0x3e')])['keys']()[_0x2c2c('0x30')](function(_0x44c115){return _[_0x2c2c('0x71')](_0x1f6371,[_0x2c2c('0x2d'),_0x44c115])?_0x44c115:undefined;})[_0x2c2c('0x72')]()[_0x2c2c('0x65')]();if(!_[_0x2c2c('0x73')](_0xa7b6c9)){_0xa7b6c9[_0x2c2c('0x35')](function(_0x3a2bcd){if(_0x3a2bcd===_0x2c2c('0x74')){_0x5e2d5a[_0x2c2c('0x75')](_0x2c2c('0x76'),[]['concat'](_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd]));}else if(_0x3a2bcd===_0x2c2c('0x77')){var _0x44f4e6=JSON[_0x2c2c('0x78')](_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd])[_0x2c2c('0x79')];var _0x301362=JSON[_0x2c2c('0x78')](_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd])[_0x2c2c('0x7a')];_0x5e2d5a[_0x2c2c('0x75')](_0x2c2c('0x7b'),_0x44f4e6,_0x301362);}else{if(_0x2fc72f['query'][_0x3a2bcd]===_0x2c2c('0x7c')){_0x5e2d5a[_0x2c2c('0x75')]('i.'+_0x3a2bcd+_0x2c2c('0x7d'));}else{_0x5e2d5a[_0x2c2c('0x75')]('i.'+_0x3a2bcd+_0x2c2c('0x7e'),_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd]);}}});}if(_0x2fc72f['query'][_0x2c2c('0x7f')]){if(_0x2fc72f[_0x2c2c('0x3e')]['read']==0x1){_0x5e2d5a[_0x2c2c('0x5d')](_0x2c2c('0x80'));}else{_0x5e2d5a[_0x2c2c('0x5d')](_0x2c2c('0x81'));}}if(_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x82')]){_0x222c51=_['isArray'](_0x2fc72f[_0x2c2c('0x3e')]['tag'])?_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x82')]:new Array(_0x2fc72f['query']['tag']);_0x222c51['forEach'](function(_0x2e93c0){_0x273566['or'](_0x2c2c('0x6c'),'%,'+_0x2e93c0+',%');});}if(_0x2fc72f[_0x2c2c('0x3e')]['filter']){var _0x2a405b=_0x2fc72f['query'][_0x2c2c('0x83')][_0x2c2c('0x84')]('\x5c','\x5c\x5c')[_0x2c2c('0x84')](/'/g,'\x27\x27');if(qs[_0x2c2c('0x85')](_0x2a405b)){_0x1b1048['or'](_0x2c2c('0x86'),_0x2a405b+'%')['or']('i.phone\x20LIKE\x20?',_0x2a405b+'%');}else{_0x1b1048['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2c2c('0x87')](_0x2a405b))['or'](_0x2c2c('0x88'),_0x2a405b+'%');}}}_0x5e2d5a[_0x2c2c('0x75')](_0x1b1048);_0x5e2d5a['group']('i.id');var _0x22c414={'type':db[_0x2c2c('0x89')]['QueryTypes'][_0x2c2c('0x8a')],'raw':!![]};var _0x25a29b=_0x5e2d5a[_0x2c2c('0x8b')]();_0x25a29b[_0x2c2c('0x49')](_0x2c2c('0x8c'));_0x25a29b[_0x2c2c('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2c2c('0x5c'));if(_0x2ccea9[_0x2c2c('0x44')]){_0x2ccea9['order']['forEach'](function(_0x21c2ce){var _0x2cc99e=_0x21c2ce[0x0]===_0x2c2c('0x8d')?_0x21c2ce[0x0]:'i.'+_0x21c2ce[0x0];_0x5e2d5a['order'](_0x2cc99e,_0x21c2ce[0x1]===_0x2c2c('0x8e')?![]:!![]);});}if(!_[_0x2c2c('0x73')](_0x222c51)){_0x5e2d5a['having'](_0x273566);_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x8f'),_0x222c51);}BPromise[_0x2c2c('0x90')]()['then'](function(){if(!_0x337a95){if(_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x74')]||_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x91')])return;_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x92'));_0x5e2d5a[_0x2c2c('0x75')](_0x2c2c('0x92'));return;}if(_0x2fc72f[_0x2c2c('0x93')]['role']!=='agent')return;return _0x2fc72f[_0x2c2c('0x93')][_0x2c2c('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x351fb5){if(_[_0x2c2c('0x73')](_0x351fb5)){_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x95'));_0x5e2d5a[_0x2c2c('0x75')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x76'),_[_0x2c2c('0x30')](_0x351fb5,'id'));_0x5e2d5a[_0x2c2c('0x75')]('i.SmsAccountId\x20IN\x20?',_[_0x2c2c('0x30')](_0x351fb5,'id'));}});})['then'](function(){if(_0x2fc72f['user'][_0x2c2c('0x96')]===_0x2c2c('0x97')&&!_0x337a95&&!_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x74')])return[];return db['sequelize']['query'](_0x25a29b['toString'](),_0x22c414);})[_0x2c2c('0x2b')](function(_0xe6d4f5){_0x260f52[_0x2c2c('0x22')]=_0xe6d4f5[_0x2c2c('0x63')];if(_0x260f52[_0x2c2c('0x22')]===0x0)return[];return db[_0x2c2c('0x98')]['query'](_0x3b1ece['toString'](),_0x22c414)['then'](function(_0x1bb396){_0x27817f=_[_0x2c2c('0x99')](_0x1bb396,'id');_0x22c414=_[_0x2c2c('0x9a')](_0x22c414,{'model':db[_0x2c2c('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x42')]){_0x2ccea9['attributes'][_0x2c2c('0x35')](function(_0x6f3d13){_0x5e2d5a[_0x2c2c('0x49')]('i.'+_0x6f3d13);});}else{_0x5e2d5a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5e2d5a['field'](_0x2c2c('0x9b'),'Account.key');_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0x9c'),_0x2c2c('0x9d'));_0x5e2d5a['field'](_0x2c2c('0x9e'),_0x2c2c('0x8d'));_0x5e2d5a[_0x2c2c('0x49')]('i.*');_0x5e2d5a['field'](_0x2c2c('0x9f'),_0x2c2c('0xa0'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa1'),'Contact.lastName');_0x5e2d5a['field']('c.email',_0x2c2c('0xa2'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa3'),_0x2c2c('0xa4'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa5'),_0x2c2c('0xa6'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa7'),'Contact.fax');_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa8'),_0x2c2c('0xa9'));_0x5e2d5a[_0x2c2c('0x49')]('o.internal',_0x2c2c('0xaa'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xab'),_0x2c2c('0x32'));}if(_0x2ccea9[_0x2c2c('0x24')])_0x5e2d5a[_0x2c2c('0x24')](_0x2ccea9[_0x2c2c('0x24')]);if(_0x2ccea9[_0x2c2c('0x23')])_0x5e2d5a['offset'](_0x2ccea9[_0x2c2c('0x23')]);return db[_0x2c2c('0x98')][_0x2c2c('0x3e')](_0x5e2d5a[_0x2c2c('0xac')](),_0x22c414);})[_0x2c2c('0x2b')](function(_0x229652){_0x38e593['where'](_0x2c2c('0xad'),_[_0x2c2c('0x30')](_0x229652,'id'));return db[_0x2c2c('0x98')][_0x2c2c('0x3e')](_0x38e593['toString'](),_0x22c414)[_0x2c2c('0x2b')](function(_0x109d89){var _0x185a4b=_[_0x2c2c('0xae')](_0x109d89,'SmsInteractionId');var _0xf4c18a=[];_0x229652[_0x2c2c('0x35')](function(_0x1839ad){_0xf4c18a['push'](updateSmsInteraction(_0x1839ad,_0x27817f,_0x185a4b));});return BPromise[_0x2c2c('0xaf')](_0xf4c18a);});});})[_0x2c2c('0x2b')](function(_0x28b062){_0x260f52['rows']=_0x28b062;return _0x260f52;})[_0x2c2c('0x2b')](respondWithFilteredResult(_0xff594,_0x2ccea9))[_0x2c2c('0x36')](handleError(_0xff594,null));};exports[_0x2c2c('0xb0')]=function(_0x30f322,_0x56f40c){var _0x3b76a0={'raw':![],'where':{'id':_0x30f322[_0x2c2c('0xb1')]['id']}},_0x5639e5={};_0x5639e5[_0x2c2c('0x3d')]=_[_0x2c2c('0x3f')](db[_0x2c2c('0x38')][_0x2c2c('0x39')]);_0x5639e5['query']=_[_0x2c2c('0x3f')](_0x30f322[_0x2c2c('0x3e')]);_0x5639e5[_0x2c2c('0x46')]=_['intersection'](_0x5639e5['model'],_0x5639e5[_0x2c2c('0x3e')]);_0x3b76a0[_0x2c2c('0x40')]=_[_0x2c2c('0x41')](_0x5639e5[_0x2c2c('0x3d')],qs[_0x2c2c('0x42')](_0x30f322[_0x2c2c('0x3e')][_0x2c2c('0x42')]));_0x3b76a0[_0x2c2c('0x40')]=_0x3b76a0[_0x2c2c('0x40')]['length']?_0x3b76a0[_0x2c2c('0x40')]:_0x5639e5[_0x2c2c('0x3d')];if(_0x30f322[_0x2c2c('0x3e')][_0x2c2c('0xb2')]){_0x3b76a0[_0x2c2c('0xb3')]=[{'all':!![]}];}_0x3b76a0=_[_0x2c2c('0x9a')]({},_0x3b76a0,_0x30f322[_0x2c2c('0xb4')]);return db[_0x2c2c('0x38')]['find'](_0x3b76a0)[_0x2c2c('0x2b')](handleEntityNotFound(_0x56f40c,null))[_0x2c2c('0x2b')](respondWithResult(_0x56f40c,null))['catch'](handleError(_0x56f40c,null));};exports[_0x2c2c('0xb5')]=function(_0x7c9e36,_0x1c4bf8){return db['SmsInteraction'][_0x2c2c('0xb5')](_0x7c9e36[_0x2c2c('0xb6')],{})[_0x2c2c('0x2b')](respondWithResult(_0x1c4bf8,0xc9))[_0x2c2c('0x36')](handleError(_0x1c4bf8,null));};exports['update']=function(_0x35a23f,_0x2de9df){if(_0x35a23f[_0x2c2c('0xb6')]['id']){delete _0x35a23f[_0x2c2c('0xb6')]['id'];}return db[_0x2c2c('0x38')][_0x2c2c('0x6f')]({'where':{'id':_0x35a23f[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x2de9df,null))[_0x2c2c('0x2b')](saveUpdates(_0x35a23f[_0x2c2c('0xb6')],null))['then'](respondWithResult(_0x2de9df,null))['catch'](handleError(_0x2de9df,null));};exports[_0x2c2c('0xb7')]=function(_0x2f549b,_0xe65f8f){return db['SmsInteraction'][_0x2c2c('0x6f')]({'where':{'id':_0x2f549b[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0xe65f8f,null))[_0x2c2c('0x2b')](removeEntity(_0xe65f8f,null))['catch'](handleError(_0xe65f8f,null));};exports['describe']=function(_0x306e80,_0x57380d){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x57380d,null))[_0x2c2c('0x36')](handleError(_0x57380d,null));};exports[_0x2c2c('0xb8')]=function(_0x1b17ff,_0x32ed49,_0x3cc25a){return db[_0x2c2c('0xb9')][_0x2c2c('0x6f')]({'where':{'id':_0x1b17ff[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x32ed49,null))[_0x2c2c('0x2b')](function(_0x321166){if(_0x321166){return _0x321166[_0x2c2c('0xb8')](_0x1b17ff['body'][_0x2c2c('0xba')],_[_0x2c2c('0xbb')](_0x1b17ff[_0x2c2c('0xb6')],[_0x2c2c('0xba'),'id'])||{});}})[_0x2c2c('0x2b')](respondWithResult(_0x32ed49,null))[_0x2c2c('0x36')](handleError(_0x32ed49,null));};exports['getMessages']=function(_0xeb02c9,_0x4673ca,_0x138815){var _0x9bbea6={'raw':![],'where':{}};var _0x1921f4={};var _0x13a72c={'count':0x0,'rows':[]};return db[_0x2c2c('0x38')][_0x2c2c('0xbc')]({'where':{'id':_0xeb02c9[_0x2c2c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4673ca,null))['then'](function(_0x30ff16){if(_0x30ff16){_0x1921f4['model']=_[_0x2c2c('0x3f')](db[_0x2c2c('0xb9')][_0x2c2c('0x39')]);_0x1921f4[_0x2c2c('0x3e')]=_['keys'](_0xeb02c9['query']);_0x1921f4[_0x2c2c('0x46')]=_[_0x2c2c('0x41')](_0x1921f4[_0x2c2c('0x3d')],_0x1921f4[_0x2c2c('0x3e')]);_0x9bbea6[_0x2c2c('0x40')]=_['intersection'](_0x1921f4[_0x2c2c('0x3d')],qs[_0x2c2c('0x42')](_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x42')]));_0x9bbea6['attributes']=_0x9bbea6[_0x2c2c('0x40')]['length']?_0x9bbea6[_0x2c2c('0x40')]:_0x1921f4['model'];if(!_0xeb02c9['query']['hasOwnProperty'](_0x2c2c('0x43'))){_0x9bbea6[_0x2c2c('0x24')]=qs[_0x2c2c('0x24')](_0xeb02c9['query'][_0x2c2c('0x24')]);_0x9bbea6[_0x2c2c('0x23')]=qs[_0x2c2c('0x23')](_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x23')]);}_0x9bbea6[_0x2c2c('0x44')]=qs['sort'](_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x45')]);_0x9bbea6[_0x2c2c('0x75')]=qs[_0x2c2c('0x46')](_['pick'](_0xeb02c9[_0x2c2c('0x3e')],_0x1921f4[_0x2c2c('0x46')]));_0x9bbea6[_0x2c2c('0x75')][_0x2c2c('0xbd')]=_0x30ff16['id'];if(_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x83')]){_0x9bbea6[_0x2c2c('0x75')]=_['merge'](_0x9bbea6[_0x2c2c('0x75')],{'$or':_['map'](_0x9bbea6['attributes'],function(_0xde536e){var _0x3398e9={};_0x3398e9[_0xde536e]={'$like':'%'+_0xeb02c9[_0x2c2c('0x3e')]['filter']+'%'};return _0x3398e9;})});}if(_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x79')]){var _0x481ac8=_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x79')][_0x2c2c('0x34')](',');var _0x17854b={};_0x17854b[_0x481ac8[0x0]]={'$gte':moment(_0x481ac8[0x1])[_0x2c2c('0xbe')](_0x2c2c('0xbf'))};_0x9bbea6[_0x2c2c('0x75')]=_[_0x2c2c('0x9a')](_0x9bbea6[_0x2c2c('0x75')],_0x17854b);}_0x9bbea6=_[_0x2c2c('0x9a')]({},_0x9bbea6,_0xeb02c9['options']);return db['SmsMessage'][_0x2c2c('0x22')]({'where':_0x9bbea6['where']})[_0x2c2c('0x2b')](function(_0x2bc5a6){_0x13a72c[_0x2c2c('0x22')]=_0x2bc5a6;if(_0xeb02c9[_0x2c2c('0x3e')]['includeAll']){_0x9bbea6[_0x2c2c('0xb3')]=[{'all':!![]}];}return db[_0x2c2c('0xb9')][_0x2c2c('0xc0')](_0x9bbea6);})['then'](function(_0x59981a){_0x13a72c[_0x2c2c('0xc1')]=_0x59981a;return _0x13a72c;});}})[_0x2c2c('0x2b')](respondWithFilteredResult(_0x4673ca,_0x9bbea6))[_0x2c2c('0x36')](handleError(_0x4673ca,null));};exports[_0x2c2c('0xc2')]=function(_0x356646,_0x3cf4d3,_0x3cf89d){return db['SmsInteraction'][_0x2c2c('0x6f')]({'where':{'id':_0x356646[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x3cf4d3,null))[_0x2c2c('0x2b')](function(_0x42c5c8){if(_0x42c5c8){return _0x42c5c8[_0x2c2c('0xc3')](_0x356646[_0x2c2c('0xb6')]['ids'],_[_0x2c2c('0xbb')](_0x356646[_0x2c2c('0xb6')],['ids','id'])||{})[_0x2c2c('0xc4')](function(){return db[_0x2c2c('0x6b')][_0x2c2c('0xc0')]({'attributes':['id',_0x2c2c('0x2d'),_0x2c2c('0xc5')],'where':{'id':_0x356646[_0x2c2c('0xb6')][_0x2c2c('0xba')]}});})['then'](function(_0x5a3f3a){socket['emit'](_0x2c2c('0xc6'),{'id':Number(_0x356646[_0x2c2c('0xb1')]['id']),'tags':_0x5a3f3a||[]});return{'id':Number(_0x356646['params']['id']),'tags':_0x5a3f3a||[]};});}})[_0x2c2c('0x2b')](respondWithResult(_0x3cf4d3,null))['catch'](handleError(_0x3cf4d3,null));};exports[_0x2c2c('0xc7')]=function(_0x22f585,_0x5abcca,_0x2d3c82){return db[_0x2c2c('0x38')][_0x2c2c('0x6f')]({'where':{'id':_0x22f585[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x5abcca,null))['then'](function(_0x3e8e73){if(_0x3e8e73){return _0x3e8e73[_0x2c2c('0xc7')](_0x22f585[_0x2c2c('0x3e')][_0x2c2c('0xba')]);}})[_0x2c2c('0x2b')](respondWithStatusCode(_0x5abcca,null))['catch'](handleError(_0x5abcca,null));};exports[_0x2c2c('0xc8')]=function(_0x3fd7af,_0x27f88e){var _0x18a6dd=moment()[_0x2c2c('0xc9')]()[_0x2c2c('0xac')]();var _0x417f11=path[_0x2c2c('0xca')](config[_0x2c2c('0xcb')],_0x2c2c('0xcc'),_0x2c2c('0xcd'),_0x2c2c('0xce'));var _0x37a110=path['join'](config[_0x2c2c('0xcb')],_0x2c2c('0xcc'),_0x2c2c('0xcd'),_0x2c2c('0xcf'));var _0x25af55=path[_0x2c2c('0xca')](_0x417f11,_0x18a6dd);var _0x3f406b=util[_0x2c2c('0xbe')]('transcript-%d-%s.zip',_0x3fd7af[_0x2c2c('0xb1')]['id'],_0x18a6dd);var _0x41ebbf=path['join'](_0x417f11,_0x3f406b);var _0x5a5dac=[];_0x5a5dac[_0x2c2c('0xd0')]({'model':db[_0x2c2c('0x6e')],'as':_0x2c2c('0x6e'),'attributes':['id',_0x2c2c('0x31')],'raw':!![]});_0x5a5dac['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x2c2c('0xd1'),_0x2c2c('0xd2')],'raw':!![]});var _0x562a2d=[{'model':db[_0x2c2c('0xb9')],'as':_0x2c2c('0xd3'),'attributes':['id',_0x2c2c('0xb6'),_0x2c2c('0x77'),_0x2c2c('0xd4'),_0x2c2c('0xd5'),'read'],'include':_0x5a5dac}];_0x562a2d[_0x2c2c('0xd0')]({'model':db[_0x2c2c('0xd6')],'as':_0x2c2c('0xd7'),'attributes':['id',_0x2c2c('0x2d')]});_0x562a2d[_0x2c2c('0xd0')]({'model':db[_0x2c2c('0x6e')],'as':_0x2c2c('0xd8'),'attributes':['id',_0x2c2c('0x31')]});return db[_0x2c2c('0x38')][_0x2c2c('0x6f')]({'where':{'id':_0x3fd7af['params']['id']},'include':_0x562a2d})[_0x2c2c('0x2b')](handleEntityNotFound(_0x27f88e,null))[_0x2c2c('0x2b')](function(_0x1c8442){if(_0x1c8442){var _0xec352d=_0x1c8442['get']({'plain':!![]});fs[_0x2c2c('0xd9')](_0x25af55);var _0x10f16c={'format':'A4','border':'10px','header':{'height':_0x2c2c('0xda'),'contents':{'first':_0x2c2c('0xdb')}},'footer':{'height':_0x2c2c('0xdc'),'contents':{'default':util[_0x2c2c('0xbe')](_0x2c2c('0xdd'),util[_0x2c2c('0xbe')](_0x2c2c('0xde'),_0x2c2c('0xdf'),_0xec352d['id']),moment()['format']('YYYY-MM-DD')[_0x2c2c('0xac')]())}}};var _0xa7198d={'channel':'Sms','account':_0xec352d[_0x2c2c('0xd7')]['name'],'agent':_0xec352d['Owner']?_0xec352d['Owner'][_0x2c2c('0x31')]:_0x2c2c('0xe0'),'createdAt':moment(_0xec352d['createdAt'])[_0x2c2c('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2c2c('0xac')](),'closedAt':_0xec352d['closed']?moment(_0xec352d[_0x2c2c('0xe1')])[_0x2c2c('0xbe')](_0x2c2c('0xbf'))[_0x2c2c('0xac')]():'','disposition':_0xec352d[_0x2c2c('0xe2')],'messages':_(_0xec352d[_0x2c2c('0xd3')])[_0x2c2c('0x83')]({'secret':![]})['map'](function(_0x47c8ec){return{'date':moment(_0x47c8ec['createdAt'])[_0x2c2c('0xbe')](_0x2c2c('0xbf'))[_0x2c2c('0xac')](),'sender':_0x47c8ec[_0x2c2c('0xd4')]===_0x2c2c('0xe3')?_0x47c8ec[_0x2c2c('0x6e')]?_0x47c8ec[_0x2c2c('0x6e')][_0x2c2c('0x31')]:_0x2c2c('0xe4'):_0x47c8ec['Contact'][_0x2c2c('0xd1')]+(_0x47c8ec[_0x2c2c('0x60')][_0x2c2c('0xd2')]?'\x20'+_0x47c8ec[_0x2c2c('0x60')][_0x2c2c('0xd2')]:''),'body':_0x47c8ec[_0x2c2c('0xb6')],'direction':_0x47c8ec[_0x2c2c('0xd4')]===_0x2c2c('0xe3')?'A':'C','secret':_0x47c8ec[_0x2c2c('0xd5')],'read':_0x47c8ec['read']};})['value']()};return ejs['renderFile'](path['join'](config[_0x2c2c('0xcb')],'server',_0x2c2c('0xe5'),'downloadInteraction.html'),{'interaction':_0xa7198d})['then'](function(_0x536289){return new BPromise(function(_0x2d963a,_0x42110d){pdf[_0x2c2c('0xb5')](_0x536289,_0x10f16c)[_0x2c2c('0xe6')](path[_0x2c2c('0xca')](_0x25af55,_0x2c2c('0xe7')+_0xec352d['id']+'-'+_0x18a6dd+'.pdf'),function(_0x5be366,_0x4c8fea){if(_0x5be366)return _0x42110d(_0x5be366);_0x2d963a(_0x4c8fea);});});})[_0x2c2c('0x2b')](function(){return new BPromise(function(_0x48d54d,_0x5cf23e){zipdir(_0x25af55,{'saveTo':_0x41ebbf},function(_0x5453b1,_0x1cac58){if(_0x5453b1)return _0x5cf23e(_0x5453b1);return _0x48d54d(_0x1cac58);});})[_0x2c2c('0x2b')](function(){return new BPromise(function(_0xc830a5,_0x21d3fc){rimraf(_0x25af55,function(_0x4b2721){if(_0x4b2721)_0x21d3fc(_0x4b2721);return _0xc830a5();});});})[_0x2c2c('0x2b')](function(){return _0x27f88e['download'](_0x41ebbf,_0x3f406b,function(_0xd1f891){if(_0xd1f891){console[_0x2c2c('0xe8')](_0x2c2c('0xe9'),_0xd1f891);}else{fs[_0x2c2c('0xea')](_0x41ebbf);}});});});}else{return _0x27f88e['sendStatus'](0xc8);}})['catch'](handleError(_0x27f88e,null));}; \ No newline at end of file +var _0x953f=['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\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','Owner','closed','closedAt','out','System','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','download','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','set','save','destroy','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','SmsInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','left_join','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','SmsAccountId','concat','createdAt','parse','$gte','$lte','\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','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','isEmpty','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','agent','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','contactName','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','include','create','body','update','params','describe','addMessage','ids','getMessages','findOne','SmsMessage','hasOwnProperty','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','spread','removeTags','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','SmsAccount','Account'];(function(_0x42b5d6,_0x444d17){var _0x26f3cc=function(_0x21da2d){while(--_0x21da2d){_0x42b5d6['push'](_0x42b5d6['shift']());}};_0x26f3cc(++_0x444d17);}(_0x953f,0xf5));var _0xf953=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x953f[_0x5c2e3e];return _0x53f64a;};'use strict';var pdf=require(_0xf953('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf953('0x1'));var zipdir=require(_0xf953('0x2'));var jsonpatch=require(_0xf953('0x3'));var rp=require(_0xf953('0x4'));var moment=require(_0xf953('0x5'));var BPromise=require(_0xf953('0x6'));var Mustache=require('mustache');var util=require(_0xf953('0x7'));var path=require(_0xf953('0x8'));var sox=require(_0xf953('0x9'));var csv=require('to-csv');var ejs=require(_0xf953('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf953('0xb'));var crypto=require('crypto');var jsforce=require(_0xf953('0xc'));var deskjs=require(_0xf953('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf953('0xe'));var Redis=require(_0xf953('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf953('0x10'));var hardwareService=require(_0xf953('0x11'));var logger=require(_0xf953('0x12'))(_0xf953('0x13'));var utils=require(_0xf953('0x14'));var config=require(_0xf953('0x15'));var licenseUtil=require(_0xf953('0x16'));var db=require('../../mysqldb')['db'];config[_0xf953('0x17')]=_['defaults'](config['redis'],{'host':_0xf953('0x18'),'port':0x18eb});var socket=require(_0xf953('0x19'))(new Redis(config['redis']));require(_0xf953('0x1a'))[_0xf953('0x1b')](socket);function respondWithStatusCode(_0x1f3b7f,_0x6ade65){_0x6ade65=_0x6ade65||0xcc;return function(_0x3e5cd8){if(_0x3e5cd8){return _0x1f3b7f[_0xf953('0x1c')](_0x6ade65);}return _0x1f3b7f[_0xf953('0x1d')](_0x6ade65)['end']();};}function respondWithResult(_0x5cba62,_0x35d6de){_0x35d6de=_0x35d6de||0xc8;return function(_0x48830e){if(_0x48830e){return _0x5cba62[_0xf953('0x1d')](_0x35d6de)[_0xf953('0x1e')](_0x48830e);}};}function respondWithFilteredResult(_0x5c8aaa,_0x39d187){return function(_0x429f56){if(_0x429f56){var _0x48714c=_0x429f56['count'],_0x4703a5=_0x39d187[_0xf953('0x1f')],_0x2a166d=_0x39d187[_0xf953('0x1f')]+_0x39d187['limit'],_0x58b1b0;if(_0x2a166d>=_0x48714c){_0x2a166d=_0x48714c;_0x58b1b0=0xc8;}else{_0x58b1b0=0xce;}_0x5c8aaa[_0xf953('0x1d')](_0x58b1b0);return _0x5c8aaa[_0xf953('0x20')]('Content-Range',_0x4703a5+'-'+_0x2a166d+'/'+_0x48714c)[_0xf953('0x1e')](_0x429f56);}return null;};}function patchUpdates(_0x35b727){return function(_0x24b00a){try{jsonpatch['apply'](_0x24b00a,_0x35b727,!![]);}catch(_0x551f21){return BPromise['reject'](_0x551f21);}return _0x24b00a[_0xf953('0x21')]();};}function saveUpdates(_0x2de33c,_0x265fbb){return function(_0xca7cb1){if(_0xca7cb1){return _0xca7cb1['update'](_0x2de33c)['then'](function(_0x4724b2){return _0x4724b2;});}return null;};}function removeEntity(_0x3227f0,_0x419c23){return function(_0x38baf4){if(_0x38baf4){return _0x38baf4[_0xf953('0x22')]()[_0xf953('0x23')](function(){_0x3227f0[_0xf953('0x1d')](0xcc)[_0xf953('0x24')]();});}};}function handleEntityNotFound(_0x435fb6,_0x2769e0){return function(_0x36edc6){if(!_0x36edc6){_0x435fb6[_0xf953('0x1c')](0x194);}return _0x36edc6;};}function handleError(_0x28e794,_0x53d8af){_0x53d8af=_0x53d8af||0x1f4;return function(_0x2b15e9){logger[_0xf953('0x25')](_0x2b15e9[_0xf953('0x26')]);if(_0x2b15e9[_0xf953('0x27')]){delete _0x2b15e9[_0xf953('0x27')];}_0x28e794[_0xf953('0x1d')](_0x53d8af)[_0xf953('0x28')](_0x2b15e9);};}function getInteractionUsers(_0x5ca419,_0x3b0b42){return new BPromise(function(_0x2d1b86,_0x80f0e4){try{if(_0x3b0b42[_0x5ca419['id']]){_0x5ca419[_0xf953('0x29')]=_[_0xf953('0x2a')](_0x3b0b42[_0x5ca419['id']],function(_0x246ed7){return{'id':_0x246ed7['id'],'fullname':_0x246ed7[_0xf953('0x2b')]};});}}catch(_0x3f4c61){_0x80f0e4(_0x3f4c61);}_0x2d1b86(_0x5ca419);});}function getInteractionTags(_0x1e50c,_0x872318){return new BPromise(function(_0x3e088b,_0x50b5d7){try{if(_0x1e50c[_0xf953('0x2c')]){_0x1e50c[_0xf953('0x2d')]=[];_0x1e50c[_0xf953('0x2c')][_0xf953('0x2e')](',')[_0xf953('0x2f')](function(_0xdac879){_0x1e50c[_0xf953('0x2d')][_0xf953('0x30')](_0x872318[_0xdac879]);});}delete _0x1e50c[_0xf953('0x2c')];}catch(_0x488654){_0x50b5d7(_0x488654);}_0x3e088b(_0x1e50c);});}function updateSmsInteraction(_0x54ee06,_0x31f32d,_0x1c5d5c){return new BPromise(function(_0x2fbae8,_0x4689a7){return getInteractionUsers(_0x54ee06,_0x1c5d5c)[_0xf953('0x23')](function(_0x399e96){return getInteractionTags(_0x399e96,_0x31f32d);})[_0xf953('0x23')](function(_0x439e56){_0x2fbae8(_0x439e56);})[_0xf953('0x31')](function(_0x1f11ee){_0x4689a7(_0x1f11ee);});});}exports['index']=function(_0x36d85f,_0xc680bd){var _0x38a9bf={},_0x18a5ab={},_0x53ea8b={'count':0x0,'rows':[]};var _0x1776ce=_['map'](db[_0xf953('0x32')][_0xf953('0x33')],function(_0x259bef){return{'name':_0x259bef['fieldName'],'type':_0x259bef[_0xf953('0x34')][_0xf953('0x35')]};});_0x18a5ab[_0xf953('0x36')]=_[_0xf953('0x2a')](_0x1776ce,_0xf953('0x27'));_0x18a5ab[_0xf953('0x37')]=_[_0xf953('0x38')](_0x36d85f[_0xf953('0x37')]);_0x18a5ab[_0xf953('0x39')]=_['intersection'](_0x18a5ab['model'],_0x18a5ab[_0xf953('0x37')]);_0x38a9bf['attributes']=_[_0xf953('0x3a')](_0x18a5ab[_0xf953('0x36')],qs[_0xf953('0x3b')](_0x36d85f[_0xf953('0x37')]['fields']));_0x38a9bf[_0xf953('0x3c')]=_0x38a9bf['attributes'][_0xf953('0x3d')]?_0x38a9bf[_0xf953('0x3c')]:_0x18a5ab[_0xf953('0x36')];if(!_0x36d85f[_0xf953('0x37')]['hasOwnProperty'](_0xf953('0x3e'))){_0x38a9bf[_0xf953('0x3f')]=qs['limit'](_0x36d85f['query'][_0xf953('0x3f')]);_0x38a9bf[_0xf953('0x1f')]=qs[_0xf953('0x1f')](_0x36d85f[_0xf953('0x37')][_0xf953('0x1f')]);}_0x38a9bf['order']=qs[_0xf953('0x40')](_0x36d85f[_0xf953('0x37')][_0xf953('0x40')]);_0x38a9bf[_0xf953('0x41')]=qs[_0xf953('0x39')](_[_0xf953('0x42')](_0x36d85f[_0xf953('0x37')],_0x18a5ab['filters']),_0x1776ce);var _0x570353=[];var _0x5ef07d=squel[_0xf953('0x43')]()[_0xf953('0x44')]('id')[_0xf953('0x44')]('name')['field'](_0xf953('0x45'))[_0xf953('0x46')]('tools_tags');var _0x5e6e00=squel[_0xf953('0x43')]()['field'](_0xf953('0x47'))[_0xf953('0x44')](_0xf953('0x48'))[_0xf953('0x44')](_0xf953('0x49'))[_0xf953('0x46')](_0xf953('0x4a'),'ui')['left_join'](_0xf953('0x4b'),'u',_0xf953('0x4c'));var _0x57fe09=squel[_0xf953('0x43')]()[_0xf953('0x46')](_0xf953('0x4d'),'i')['left_join'](_0xf953('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xf953('0x4f'))[_0xf953('0x50')](_0xf953('0x51'),'a','a.id\x20=\x20i.SmsAccountId')[_0xf953('0x50')]('sms_messages','me',_0xf953('0x52'))['left_join'](_0xf953('0x53'),'it',_0xf953('0x54'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x58a028=squel[_0xf953('0x55')]();var _0xedaeed=[];var _0x3a179=squel[_0xf953('0x55')]();var _0x167e4f;if(_0x36d85f['query'][_0xf953('0x56')]){_0x167e4f=as[_0xf953('0x57')](_0x36d85f['query'][_0xf953('0x56')]);var _0x2cb361=_0x167e4f[_0xf953('0x58')];for(var _0x23da2c=0x0;_0x23da2c<_0x167e4f[_0xf953('0x59')][_0xf953('0x3d')];_0x23da2c++){var _0x761a65=_0x167e4f['conditions'][_0x23da2c];var _0x33e5f7='i';var _0x4f6ab5=_[_0xf953('0x5a')](_0x1776ce,[_0xf953('0x27'),_0x761a65[_0xf953('0x44')]]);if(!_0x4f6ab5){switch(_0x761a65[_0xf953('0x44')]){case _0xf953('0x5b'):if(_0x761a65['value']==0x1){_0x57fe09['having']('`'+_0x761a65[_0xf953('0x44')]+'`\x20=\x200');}else{_0x57fe09[_0xf953('0x5c')]('`'+_0x761a65[_0xf953('0x44')]+'`\x20>\x200');}break;case _0xf953('0x5d'):if(_0x761a65[_0xf953('0x5e')]===_0xf953('0x5f')){if(_0x761a65[_0xf953('0x60')][_0xf953('0x2e')]('\x20')[_0xf953('0x3d')]>0x1){_0x58a028[_0x2cb361](_0xf953('0x61'),qs[_0xf953('0x62')](_0x761a65[_0xf953('0x60')]),null);}else{var _0x3e5664='%'+_0x761a65[_0xf953('0x60')]+'%';_0x58a028[_0x2cb361](_0xf953('0x63'),_0x3e5664,_0x3e5664,_0x3e5664);}}else{_0x4f6ab5=_[_0xf953('0x5a')](_0x1776ce,[_0xf953('0x27'),_0xf953('0x64')]);_0x761a65[_0xf953('0x44')]=_0xf953('0x64');_0x55ad3c=as[_0xf953('0x65')](_0x33e5f7,_0x4f6ab5['type'],_0x761a65);_0x58a028[_0x2cb361](_0x55ad3c[_0xf953('0x66')],_0x55ad3c[_0xf953('0x60')][_0xf953('0x67')],_0x55ad3c['value']['end']);}break;case _0xf953('0x68'):var _0x3ef467=_0x761a65['value']['split'](',')[_0xf953('0x2a')](function(_0x1e66c7){return Number(_0x1e66c7);});_0x3ef467[_0xf953('0x2f')](function(_0x34881c){_0x3a179['or'](_0xf953('0x69'),'%,'+_0x34881c+',%');});_0xedaeed=_['union'](_0xedaeed,_0x3ef467);break;case _0xf953('0x6a'):if(_0x761a65[_0xf953('0x5e')]===_0xf953('0x5f')){_0x58a028[_0x2cb361](_0xf953('0x6b'),'%'+_0x761a65[_0xf953('0x60')]+'%',null);}else{_0x4f6ab5=_[_0xf953('0x5a')](_0x1776ce,[_0xf953('0x27'),_0xf953('0x6c')]);_0x761a65[_0xf953('0x44')]=_0xf953('0x6c');_0x55ad3c=as[_0xf953('0x65')](_0x33e5f7,_0x4f6ab5[_0xf953('0x34')],_0x761a65);_0x58a028[_0x2cb361](_0x55ad3c[_0xf953('0x66')],_0x55ad3c[_0xf953('0x60')][_0xf953('0x67')],_0x55ad3c[_0xf953('0x60')]['end']);}break;case'body':_0x55ad3c=as[_0xf953('0x65')]('me',null,_0x761a65);_0x58a028[_0x2cb361](_0x55ad3c[_0xf953('0x66')],_0x55ad3c['value'][_0xf953('0x67')],_0x55ad3c[_0xf953('0x60')][_0xf953('0x24')]);break;}}else{var _0x55ad3c=as[_0xf953('0x65')](_0x33e5f7,_0x4f6ab5[_0xf953('0x34')],_0x761a65);_0x58a028[_0x2cb361](_0x55ad3c[_0xf953('0x66')],_0x55ad3c[_0xf953('0x60')][_0xf953('0x67')],_0x55ad3c['value'][_0xf953('0x24')]);}}}else{var _0xf4c662=_(_0x36d85f[_0xf953('0x37')])[_0xf953('0x38')]()[_0xf953('0x2a')](function(_0x1e279e){return _[_0xf953('0x6d')](_0x1776ce,['name',_0x1e279e])?_0x1e279e:undefined;})['compact']()[_0xf953('0x60')]();if(!_['isEmpty'](_0xf4c662)){_0xf4c662[_0xf953('0x2f')](function(_0x4ae697){if(_0x4ae697===_0xf953('0x6e')){_0x57fe09['where']('i.SmsAccountId\x20IN\x20?',[][_0xf953('0x6f')](_0x36d85f['query'][_0x4ae697]));}else if(_0x4ae697===_0xf953('0x70')){var _0x2dcc11=JSON[_0xf953('0x71')](_0x36d85f[_0xf953('0x37')][_0x4ae697])[_0xf953('0x72')];var _0x5ac6a2=JSON[_0xf953('0x71')](_0x36d85f[_0xf953('0x37')][_0x4ae697])[_0xf953('0x73')];_0x57fe09['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2dcc11,_0x5ac6a2);}else{if(_0x36d85f['query'][_0x4ae697]==='null'){_0x57fe09[_0xf953('0x41')]('i.'+_0x4ae697+_0xf953('0x74'));}else{_0x57fe09['where']('i.'+_0x4ae697+_0xf953('0x75'),_0x36d85f[_0xf953('0x37')][_0x4ae697]);}}});}if(_0x36d85f[_0xf953('0x37')][_0xf953('0x76')]){if(_0x36d85f[_0xf953('0x37')][_0xf953('0x76')]==0x1){_0x57fe09['having'](_0xf953('0x77'));}else{_0x57fe09['having'](_0xf953('0x78'));}}if(_0x36d85f[_0xf953('0x37')][_0xf953('0x79')]){_0xedaeed=_[_0xf953('0x7a')](_0x36d85f[_0xf953('0x37')][_0xf953('0x79')])?_0x36d85f[_0xf953('0x37')][_0xf953('0x79')]:new Array(_0x36d85f[_0xf953('0x37')][_0xf953('0x79')]);_0xedaeed[_0xf953('0x2f')](function(_0x24b444){_0x3a179['or'](_0xf953('0x69'),'%,'+_0x24b444+',%');});}if(_0x36d85f[_0xf953('0x37')][_0xf953('0x7b')]){var _0x411df6=_0x36d85f[_0xf953('0x37')][_0xf953('0x7b')][_0xf953('0x7c')]('\x5c','\x5c\x5c')[_0xf953('0x7c')](/'/g,'\x27\x27');if(qs[_0xf953('0x7d')](_0x411df6)){_0x58a028['or'](_0xf953('0x7e'),_0x411df6+'%')['or'](_0xf953('0x7f'),_0x411df6+'%');}else{_0x58a028['or'](_0xf953('0x80'),qs[_0xf953('0x62')](_0x411df6))['or'](_0xf953('0x81'),_0x411df6+'%');}}}_0x57fe09[_0xf953('0x41')](_0x58a028);_0x57fe09[_0xf953('0x82')]('i.id');var _0x4961ea={'type':db[_0xf953('0x83')][_0xf953('0x84')]['SELECT'],'raw':!![]};var _0x307de3=_0x57fe09[_0xf953('0x85')]();_0x307de3[_0xf953('0x44')]('i.id');_0x307de3[_0xf953('0x44')](_0xf953('0x86'),_0xf953('0x5b'));if(_0x38a9bf[_0xf953('0x87')]){_0x38a9bf[_0xf953('0x87')][_0xf953('0x2f')](function(_0x41f2e2){var _0x21b737=_0x41f2e2[0x0]==='contactName'?_0x41f2e2[0x0]:'i.'+_0x41f2e2[0x0];_0x57fe09['order'](_0x21b737,_0x41f2e2[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf953('0x88')](_0xedaeed)){_0x57fe09[_0xf953('0x5c')](_0x3a179);_0x307de3['where']('t.id\x20IN\x20?',_0xedaeed);}BPromise['resolve']()[_0xf953('0x23')](function(){if(!_0x167e4f){if(_0x36d85f[_0xf953('0x37')][_0xf953('0x6e')]||_0x36d85f[_0xf953('0x37')]['journey'])return;_0x307de3[_0xf953('0x41')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x57fe09[_0xf953('0x41')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x36d85f[_0xf953('0x89')][_0xf953('0x8a')]!=='agent')return;return _0x36d85f[_0xf953('0x89')][_0xf953('0x8b')]({'attributes':['id'],'raw':!![]})[_0xf953('0x23')](function(_0x46611c){if(_[_0xf953('0x88')](_0x46611c)){_0x307de3[_0xf953('0x41')]('i.SmsAccountId\x20IS\x20NULL');_0x57fe09['where'](_0xf953('0x8c'));}else{_0x307de3['where'](_0xf953('0x8d'),_[_0xf953('0x2a')](_0x46611c,'id'));_0x57fe09[_0xf953('0x41')](_0xf953('0x8d'),_[_0xf953('0x2a')](_0x46611c,'id'));}});})[_0xf953('0x23')](function(){if(_0x36d85f[_0xf953('0x89')]['role']===_0xf953('0x8e')&&!_0x167e4f&&!_0x36d85f[_0xf953('0x37')]['SmsAccountId'])return[];return db[_0xf953('0x8f')]['query'](_0x307de3[_0xf953('0x90')](),_0x4961ea);})[_0xf953('0x23')](function(_0xf65be3){_0x53ea8b[_0xf953('0x91')]=_0xf65be3[_0xf953('0x3d')];if(_0x53ea8b[_0xf953('0x91')]===0x0)return[];return db[_0xf953('0x8f')][_0xf953('0x37')](_0x5ef07d[_0xf953('0x90')](),_0x4961ea)[_0xf953('0x23')](function(_0x476667){_0x570353=_[_0xf953('0x92')](_0x476667,'id');_0x4961ea=_[_0xf953('0x93')](_0x4961ea,{'model':db[_0xf953('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36d85f['query'][_0xf953('0x3b')]){_0x38a9bf[_0xf953('0x3c')]['forEach'](function(_0x4b3879){_0x57fe09['field']('i.'+_0x4b3879);});}else{_0x57fe09[_0xf953('0x44')](_0xf953('0x86'),'unreadMessages');_0x57fe09['field'](_0xf953('0x94'),_0xf953('0x95'));_0x57fe09[_0xf953('0x44')](_0xf953('0x96'),'Account.mandatoryDisposition');_0x57fe09[_0xf953('0x44')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xf953('0x97'));_0x57fe09[_0xf953('0x44')]('i.*');_0x57fe09['field'](_0xf953('0x98'),_0xf953('0x99'));_0x57fe09['field'](_0xf953('0x9a'),'Contact.lastName');_0x57fe09[_0xf953('0x44')](_0xf953('0x9b'),_0xf953('0x9c'));_0x57fe09[_0xf953('0x44')](_0xf953('0x9d'),'Contact.phone');_0x57fe09[_0xf953('0x44')](_0xf953('0x9e'),_0xf953('0x9f'));_0x57fe09['field']('c.fax','Contact.fax');_0x57fe09['field'](_0xf953('0xa0'),_0xf953('0xa1'));_0x57fe09[_0xf953('0x44')](_0xf953('0xa2'),_0xf953('0xa3'));_0x57fe09[_0xf953('0x44')](_0xf953('0xa4'),_0xf953('0x2c'));}if(_0x38a9bf[_0xf953('0x3f')])_0x57fe09[_0xf953('0x3f')](_0x38a9bf[_0xf953('0x3f')]);if(_0x38a9bf[_0xf953('0x1f')])_0x57fe09[_0xf953('0x1f')](_0x38a9bf[_0xf953('0x1f')]);return db[_0xf953('0x8f')][_0xf953('0x37')](_0x57fe09[_0xf953('0x90')](),_0x4961ea);})[_0xf953('0x23')](function(_0xe8b4c5){_0x5e6e00['where'](_0xf953('0xa5'),_[_0xf953('0x2a')](_0xe8b4c5,'id'));return db['sequelize'][_0xf953('0x37')](_0x5e6e00['toString'](),_0x4961ea)['then'](function(_0x331c1e){var _0x380565=_[_0xf953('0xa6')](_0x331c1e,'SmsInteractionId');var _0x3db150=[];_0xe8b4c5['forEach'](function(_0x529783){_0x3db150[_0xf953('0x30')](updateSmsInteraction(_0x529783,_0x570353,_0x380565));});return BPromise[_0xf953('0xa7')](_0x3db150);});});})[_0xf953('0x23')](function(_0x28ed34){_0x53ea8b[_0xf953('0xa8')]=_0x28ed34;return _0x53ea8b;})[_0xf953('0x23')](respondWithFilteredResult(_0xc680bd,_0x38a9bf))[_0xf953('0x31')](handleError(_0xc680bd,null));};exports['show']=function(_0x430e90,_0x2e79e7){var _0x54c1d3={'raw':![],'where':{'id':_0x430e90['params']['id']}},_0x4b2d93={};_0x4b2d93[_0xf953('0x36')]=_[_0xf953('0x38')](db[_0xf953('0x32')][_0xf953('0x33')]);_0x4b2d93[_0xf953('0x37')]=_[_0xf953('0x38')](_0x430e90[_0xf953('0x37')]);_0x4b2d93[_0xf953('0x39')]=_[_0xf953('0x3a')](_0x4b2d93[_0xf953('0x36')],_0x4b2d93[_0xf953('0x37')]);_0x54c1d3['attributes']=_[_0xf953('0x3a')](_0x4b2d93['model'],qs[_0xf953('0x3b')](_0x430e90[_0xf953('0x37')]['fields']));_0x54c1d3[_0xf953('0x3c')]=_0x54c1d3[_0xf953('0x3c')][_0xf953('0x3d')]?_0x54c1d3[_0xf953('0x3c')]:_0x4b2d93[_0xf953('0x36')];if(_0x430e90[_0xf953('0x37')]['includeAll']){_0x54c1d3[_0xf953('0xa9')]=[{'all':!![]}];}_0x54c1d3=_[_0xf953('0x93')]({},_0x54c1d3,_0x430e90['options']);return db[_0xf953('0x32')]['find'](_0x54c1d3)[_0xf953('0x23')](handleEntityNotFound(_0x2e79e7,null))[_0xf953('0x23')](respondWithResult(_0x2e79e7,null))[_0xf953('0x31')](handleError(_0x2e79e7,null));};exports[_0xf953('0xaa')]=function(_0xad6761,_0x100018){return db['SmsInteraction'][_0xf953('0xaa')](_0xad6761[_0xf953('0xab')],{})[_0xf953('0x23')](respondWithResult(_0x100018,0xc9))[_0xf953('0x31')](handleError(_0x100018,null));};exports[_0xf953('0xac')]=function(_0x120705,_0x3944d4){if(_0x120705[_0xf953('0xab')]['id']){delete _0x120705[_0xf953('0xab')]['id'];}return db[_0xf953('0x32')][_0xf953('0x5a')]({'where':{'id':_0x120705[_0xf953('0xad')]['id']}})[_0xf953('0x23')](handleEntityNotFound(_0x3944d4,null))[_0xf953('0x23')](saveUpdates(_0x120705[_0xf953('0xab')],null))[_0xf953('0x23')](respondWithResult(_0x3944d4,null))['catch'](handleError(_0x3944d4,null));};exports[_0xf953('0x22')]=function(_0x50d7e7,_0x2a1e5d){return db[_0xf953('0x32')][_0xf953('0x5a')]({'where':{'id':_0x50d7e7[_0xf953('0xad')]['id']}})['then'](handleEntityNotFound(_0x2a1e5d,null))[_0xf953('0x23')](removeEntity(_0x2a1e5d,null))['catch'](handleError(_0x2a1e5d,null));};exports[_0xf953('0xae')]=function(_0x1028d2,_0x46516f){return db[_0xf953('0x32')]['describe']()['then'](respondWithResult(_0x46516f,null))[_0xf953('0x31')](handleError(_0x46516f,null));};exports['addMessage']=function(_0x2548f2,_0x2d6ba4,_0x4c1d69){return db['SmsMessage'][_0xf953('0x5a')]({'where':{'id':_0x2548f2[_0xf953('0xad')]['id']}})[_0xf953('0x23')](handleEntityNotFound(_0x2d6ba4,null))['then'](function(_0x29fd3b){if(_0x29fd3b){return _0x29fd3b[_0xf953('0xaf')](_0x2548f2['body'][_0xf953('0xb0')],_['omit'](_0x2548f2[_0xf953('0xab')],[_0xf953('0xb0'),'id'])||{});}})[_0xf953('0x23')](respondWithResult(_0x2d6ba4,null))[_0xf953('0x31')](handleError(_0x2d6ba4,null));};exports[_0xf953('0xb1')]=function(_0x37e133,_0x227dc8,_0x467485){var _0x1d0a9c={'raw':![],'where':{}};var _0x5c7d66={};var _0x7e9598={'count':0x0,'rows':[]};return db[_0xf953('0x32')][_0xf953('0xb2')]({'where':{'id':_0x37e133[_0xf953('0xad')]['id']}})['then'](handleEntityNotFound(_0x227dc8,null))[_0xf953('0x23')](function(_0x560484){if(_0x560484){_0x5c7d66[_0xf953('0x36')]=_['keys'](db[_0xf953('0xb3')][_0xf953('0x33')]);_0x5c7d66[_0xf953('0x37')]=_[_0xf953('0x38')](_0x37e133['query']);_0x5c7d66[_0xf953('0x39')]=_[_0xf953('0x3a')](_0x5c7d66['model'],_0x5c7d66['query']);_0x1d0a9c[_0xf953('0x3c')]=_[_0xf953('0x3a')](_0x5c7d66['model'],qs[_0xf953('0x3b')](_0x37e133[_0xf953('0x37')][_0xf953('0x3b')]));_0x1d0a9c[_0xf953('0x3c')]=_0x1d0a9c[_0xf953('0x3c')][_0xf953('0x3d')]?_0x1d0a9c[_0xf953('0x3c')]:_0x5c7d66[_0xf953('0x36')];if(!_0x37e133[_0xf953('0x37')][_0xf953('0xb4')](_0xf953('0x3e'))){_0x1d0a9c[_0xf953('0x3f')]=qs[_0xf953('0x3f')](_0x37e133['query'][_0xf953('0x3f')]);_0x1d0a9c[_0xf953('0x1f')]=qs[_0xf953('0x1f')](_0x37e133[_0xf953('0x37')]['offset']);}_0x1d0a9c['order']=qs[_0xf953('0x40')](_0x37e133['query'][_0xf953('0x40')]);_0x1d0a9c[_0xf953('0x41')]=qs[_0xf953('0x39')](_[_0xf953('0x42')](_0x37e133[_0xf953('0x37')],_0x5c7d66['filters']));_0x1d0a9c[_0xf953('0x41')][_0xf953('0xb5')]=_0x560484['id'];if(_0x37e133[_0xf953('0x37')][_0xf953('0x7b')]){_0x1d0a9c['where']=_[_0xf953('0x93')](_0x1d0a9c[_0xf953('0x41')],{'$or':_['map'](_0x1d0a9c[_0xf953('0x3c')],function(_0x41e06e){var _0x5bab3f={};_0x5bab3f[_0x41e06e]={'$like':'%'+_0x37e133[_0xf953('0x37')]['filter']+'%'};return _0x5bab3f;})});}if(_0x37e133[_0xf953('0x37')][_0xf953('0x72')]){var _0x363a86=_0x37e133[_0xf953('0x37')]['$gte'][_0xf953('0x2e')](',');var _0x1fb5d5={};_0x1fb5d5[_0x363a86[0x0]]={'$gte':moment(_0x363a86[0x1])['format'](_0xf953('0xb6'))};_0x1d0a9c[_0xf953('0x41')]=_[_0xf953('0x93')](_0x1d0a9c[_0xf953('0x41')],_0x1fb5d5);}_0x1d0a9c=_[_0xf953('0x93')]({},_0x1d0a9c,_0x37e133[_0xf953('0xb7')]);return db[_0xf953('0xb3')][_0xf953('0x91')]({'where':_0x1d0a9c['where']})[_0xf953('0x23')](function(_0x44da7e){_0x7e9598['count']=_0x44da7e;if(_0x37e133[_0xf953('0x37')]['includeAll']){_0x1d0a9c[_0xf953('0xa9')]=[{'all':!![]}];}return db[_0xf953('0xb3')][_0xf953('0xb8')](_0x1d0a9c);})[_0xf953('0x23')](function(_0x11f03a){_0x7e9598['rows']=_0x11f03a;return _0x7e9598;});}})[_0xf953('0x23')](respondWithFilteredResult(_0x227dc8,_0x1d0a9c))[_0xf953('0x31')](handleError(_0x227dc8,null));};exports['addTags']=function(_0x7b776a,_0x53974f,_0x13e942){return db[_0xf953('0x32')][_0xf953('0x5a')]({'where':{'id':_0x7b776a[_0xf953('0xad')]['id']}})[_0xf953('0x23')](handleEntityNotFound(_0x53974f,null))[_0xf953('0x23')](function(_0x2129dc){if(_0x2129dc){return _0x2129dc[_0xf953('0xb9')](_0x7b776a[_0xf953('0xab')][_0xf953('0xb0')],_[_0xf953('0xba')](_0x7b776a['body'],[_0xf953('0xb0'),'id'])||{})[_0xf953('0xbb')](function(){return db[_0xf953('0x68')][_0xf953('0xb8')]({'attributes':['id',_0xf953('0x27'),_0xf953('0x45')],'where':{'id':_0x7b776a[_0xf953('0xab')][_0xf953('0xb0')]}});})['then'](function(_0x548259){socket['emit']('smsInteractionTags:save',{'id':Number(_0x7b776a['params']['id']),'tags':_0x548259||[]});return{'id':Number(_0x7b776a[_0xf953('0xad')]['id']),'tags':_0x548259||[]};});}})[_0xf953('0x23')](respondWithResult(_0x53974f,null))[_0xf953('0x31')](handleError(_0x53974f,null));};exports[_0xf953('0xbc')]=function(_0x330835,_0x3ba076,_0x3f2669){return db[_0xf953('0x32')][_0xf953('0x5a')]({'where':{'id':_0x330835['params']['id']}})[_0xf953('0x23')](handleEntityNotFound(_0x3ba076,null))[_0xf953('0x23')](function(_0xe11a14){if(_0xe11a14){return _0xe11a14[_0xf953('0xbc')](_0x330835[_0xf953('0x37')][_0xf953('0xb0')]);}})['then'](respondWithStatusCode(_0x3ba076,null))[_0xf953('0x31')](handleError(_0x3ba076,null));};exports['download']=function(_0x39b26b,_0x55e970){var _0x45b48e=moment()[_0xf953('0xbd')]()['toString']();var _0x51b8c9=path[_0xf953('0xbe')](config[_0xf953('0xbf')],_0xf953('0xc0'),_0xf953('0xc1'),_0xf953('0xc2'));var _0x559955=path[_0xf953('0xbe')](config[_0xf953('0xbf')],_0xf953('0xc0'),'files',_0xf953('0xc3'));var _0x27362a=path[_0xf953('0xbe')](_0x51b8c9,_0x45b48e);var _0x3c2489=util[_0xf953('0xc4')](_0xf953('0xc5'),_0x39b26b[_0xf953('0xad')]['id'],_0x45b48e);var _0x552b48=path[_0xf953('0xbe')](_0x51b8c9,_0x3c2489);var _0x3f74bc=[];_0x3f74bc['push']({'model':db[_0xf953('0x6a')],'as':_0xf953('0x6a'),'attributes':['id',_0xf953('0x2b')],'raw':!![]});_0x3f74bc[_0xf953('0x30')]({'model':db[_0xf953('0xc6')],'as':_0xf953('0x5d'),'attributes':['id',_0xf953('0xc7'),_0xf953('0xc8')],'raw':!![]});var _0xbcc174=[{'model':db[_0xf953('0xb3')],'as':_0xf953('0xc9'),'attributes':['id',_0xf953('0xab'),_0xf953('0x70'),_0xf953('0xca'),'secret','read'],'include':_0x3f74bc}];_0xbcc174[_0xf953('0x30')]({'model':db[_0xf953('0xcb')],'as':_0xf953('0xcc'),'attributes':['id',_0xf953('0x27')]});_0xbcc174['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xf953('0x2b')]});return db[_0xf953('0x32')][_0xf953('0x5a')]({'where':{'id':_0x39b26b['params']['id']},'include':_0xbcc174})[_0xf953('0x23')](handleEntityNotFound(_0x55e970,null))[_0xf953('0x23')](function(_0x275598){if(_0x275598){var _0x15ebf3=_0x275598[_0xf953('0xcd')]({'plain':!![]});fs['mkdirSync'](_0x27362a);var _0x169db={'format':'A4','border':_0xf953('0xce'),'header':{'height':_0xf953('0xcf'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util['format'](_0xf953('0xd0'),util[_0xf953('0xc4')](_0xf953('0xd1'),_0xf953('0xd2'),_0x15ebf3['id']),moment()['format']('YYYY-MM-DD')[_0xf953('0x90')]())}}};var _0xddead7={'channel':'Sms','account':_0x15ebf3[_0xf953('0xcc')]['name'],'agent':_0x15ebf3[_0xf953('0xd3')]?_0x15ebf3[_0xf953('0xd3')]['fullname']:'N.A.','createdAt':moment(_0x15ebf3[_0xf953('0x70')])['format'](_0xf953('0xb6'))['toString'](),'closedAt':_0x15ebf3[_0xf953('0xd4')]?moment(_0x15ebf3[_0xf953('0xd5')])[_0xf953('0xc4')](_0xf953('0xb6'))['toString']():'','disposition':_0x15ebf3['disposition'],'messages':_(_0x15ebf3[_0xf953('0xc9')])[_0xf953('0x7b')]({'secret':![]})[_0xf953('0x2a')](function(_0x2eab8c){return{'date':moment(_0x2eab8c['createdAt'])[_0xf953('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf953('0x90')](),'sender':_0x2eab8c[_0xf953('0xca')]===_0xf953('0xd6')?_0x2eab8c['User']?_0x2eab8c[_0xf953('0x6a')][_0xf953('0x2b')]:_0xf953('0xd7'):_0x2eab8c[_0xf953('0x5d')][_0xf953('0xc7')]+(_0x2eab8c['Contact'][_0xf953('0xc8')]?'\x20'+_0x2eab8c[_0xf953('0x5d')]['lastName']:''),'body':_0x2eab8c[_0xf953('0xab')],'direction':_0x2eab8c[_0xf953('0xca')]===_0xf953('0xd6')?'A':'C','secret':_0x2eab8c[_0xf953('0xd8')],'read':_0x2eab8c[_0xf953('0x76')]};})[_0xf953('0x60')]()};return ejs[_0xf953('0xd9')](path['join'](config[_0xf953('0xbf')],_0xf953('0xc0'),_0xf953('0xda'),_0xf953('0xdb')),{'interaction':_0xddead7})['then'](function(_0x54b5d){return new BPromise(function(_0x2098a0,_0x3b620c){pdf[_0xf953('0xaa')](_0x54b5d,_0x169db)['toFile'](path['join'](_0x27362a,_0xf953('0xdc')+_0x15ebf3['id']+'-'+_0x45b48e+_0xf953('0xdd')),function(_0x48808d,_0x49b859){if(_0x48808d)return _0x3b620c(_0x48808d);_0x2098a0(_0x49b859);});});})[_0xf953('0x23')](function(){return new BPromise(function(_0x494d15,_0x2a60e2){zipdir(_0x27362a,{'saveTo':_0x552b48},function(_0x7a03bd,_0x362d87){if(_0x7a03bd)return _0x2a60e2(_0x7a03bd);return _0x494d15(_0x362d87);});})[_0xf953('0x23')](function(){return new BPromise(function(_0x35e0b2,_0x42cbc9){rimraf(_0x27362a,function(_0x396223){if(_0x396223)_0x42cbc9(_0x396223);return _0x35e0b2();});});})[_0xf953('0x23')](function(){return _0x55e970[_0xf953('0xde')](_0x552b48,_0x3c2489,function(_0xd28d7a){if(_0xd28d7a){console[_0xf953('0xdf')]('err',_0xd28d7a);}else{fs[_0xf953('0xe0')](_0x552b48);}});});});}else{return _0x55e970[_0xf953('0x1c')](0xc8);}})[_0xf953('0x31')](handleError(_0x55e970,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f8ba01e..f8067f2 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 _0x5fc3=['SmsMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x4a4bcd,_0x3438a4){var _0x4e2d0f=function(_0x1d61c5){while(--_0x1d61c5){_0x4a4bcd['push'](_0x4a4bcd['shift']());}};_0x4e2d0f(++_0x3438a4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x5fc3[_0x37a7c6];return _0x539905;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var SmsInteraction=require(_0x35fc('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x35fc('0x1'))['db'][_0x35fc('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x35fc('0x3')](0x0);var events={'afterCreate':_0x35fc('0x4'),'afterUpdate':_0x35fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2d1404){return function(_0x1d5fec,_0x186a06,_0x5b85ad){_0x1d5fec['getUsers']({'attributes':['id'],'raw':!![]})[_0x35fc('0x6')](function(_0x508b32){_0x1d5fec[_0x35fc('0x7')](_0x35fc('0x8'),_0x508b32[_0x35fc('0x9')](function(_0x1e5f90){return{'id':_0x1e5f90['id']};}));return SmsMessage[_0x35fc('0xa')]({'where':{'SmsInteractionId':_0x1d5fec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x35fc('0x6')](function(_0x2051ab){_0x1d5fec['setDataValue'](_0x35fc('0xb'),_0x2051ab[_0x35fc('0xc')]);SmsInteractionEvents['emit'](_0x2d1404+':'+_0x1d5fec['id'],_0x1d5fec);SmsInteractionEvents[_0x35fc('0xd')](_0x2d1404,_0x1d5fec);_0x5b85ad(null);})[_0x35fc('0xe')](_0x5b85ad(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x35fc('0xf')](e,emitEvent(event));}}module[_0x35fc('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xed95=['length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xed95,0xb9));var _0x5ed9=function(_0x556ca6,_0x36ddcc){_0x556ca6=_0x556ca6-0x0;var _0x10e6bd=_0xed95[_0x556ca6];return _0x10e6bd;};'use strict';var EventEmitter=require(_0x5ed9('0x0'));var SmsInteraction=require(_0x5ed9('0x1'))['db'][_0x5ed9('0x2')];var SmsMessage=require(_0x5ed9('0x1'))['db'][_0x5ed9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5ed9('0x4')](0x0);var events={'afterCreate':_0x5ed9('0x5'),'afterUpdate':_0x5ed9('0x6'),'afterDestroy':_0x5ed9('0x7')};function emitEvent(_0x7b84d6){return function(_0x206a5e,_0x15b734,_0x52a57d){_0x206a5e['getUsers']({'attributes':['id'],'raw':!![]})[_0x5ed9('0x8')](function(_0x217c71){_0x206a5e[_0x5ed9('0x9')](_0x5ed9('0xa'),_0x217c71[_0x5ed9('0xb')](function(_0x40e8eb){return{'id':_0x40e8eb['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x206a5e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3cbaf0){_0x206a5e[_0x5ed9('0x9')](_0x5ed9('0xc'),_0x3cbaf0[_0x5ed9('0xd')]);SmsInteractionEvents['emit'](_0x7b84d6+':'+_0x206a5e['id'],_0x206a5e);SmsInteractionEvents['emit'](_0x7b84d6,_0x206a5e);_0x52a57d(null);})[_0x5ed9('0xe')](_0x52a57d(null));};}for(var e in events){if(events[_0x5ed9('0xf')](e)){var event=events[e];SmsInteraction[_0x5ed9('0x10')](e,emitEvent(event));}}module[_0x5ed9('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8386280..2e42fb2 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 _0xbd2a=['rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path'];(function(_0x57c9ab,_0x4622fc){var _0x53afc0=function(_0x26cc14){while(--_0x26cc14){_0x57c9ab['push'](_0x57c9ab['shift']());}};_0x53afc0(++_0x4622fc);}(_0xbd2a,0x13d));var _0xabd2=function(_0x303d60,_0x26a9da){_0x303d60=_0x303d60-0x0;var _0x55854d=_0xbd2a[_0x303d60];return _0x55854d;};'use strict';var _=require('lodash');var util=require(_0xabd2('0x0'));var logger=require(_0xabd2('0x1'))('api');var moment=require(_0xabd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xabd2('0x3'));var fs=require('fs');var path=require(_0xabd2('0x4'));var rimraf=require(_0xabd2('0x5'));var config=require(_0xabd2('0x6'));var attributes=require(_0xabd2('0x7'));module[_0xabd2('0x8')]=function(_0x48184e,_0x5ab43e){return _0x48184e[_0xabd2('0x9')](_0xabd2('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x452091,_0x20c3c7,_0x15c7b6){if(_0x452091[_0xabd2('0xb')]('closed')){_0x452091['closedAt']=moment()[_0xabd2('0xc')](_0xabd2('0xd'));}_0x15c7b6(null,_0x452091);}}});}; \ No newline at end of file +var _0xbdbf=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x36f4b2,_0x4e8b9d){var _0x3e70c6=function(_0x2399b0){while(--_0x2399b0){_0x36f4b2['push'](_0x36f4b2['shift']());}};_0x3e70c6(++_0x4e8b9d);}(_0xbdbf,0x88));var _0xfbdb=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xbdbf[_0x5eef05];return _0x56d4b8;};'use strict';var _=require('lodash');var util=require(_0xfbdb('0x0'));var logger=require(_0xfbdb('0x1'))(_0xfbdb('0x2'));var moment=require(_0xfbdb('0x3'));var BPromise=require(_0xfbdb('0x4'));var rp=require(_0xfbdb('0x5'));var fs=require('fs');var path=require(_0xfbdb('0x6'));var rimraf=require(_0xfbdb('0x7'));var config=require(_0xfbdb('0x8'));var attributes=require(_0xfbdb('0x9'));module['exports']=function(_0x561a49,_0x1f84cf){return _0x561a49[_0xfbdb('0xa')](_0xfbdb('0xb'),attributes,{'tableName':_0xfbdb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x481faf,_0x37d39a,_0x221899){if(_0x481faf[_0xfbdb('0xd')](_0xfbdb('0xe'))){_0x481faf[_0xfbdb('0xf')]=moment()[_0xfbdb('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x221899(null,_0x481faf);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 72dca48..0b60e90 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 _0x5d87=['redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','SmsInteraction','update','body','options','attributes','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x452985,_0x1ca4af){var _0x115294=function(_0x38a74d){while(--_0x38a74d){_0x452985['push'](_0x452985['shift']());}};_0x115294(++_0x1ca4af);}(_0x5d87,0x115));var _0x75d8=function(_0x1208d7,_0x4d4ec0){_0x1208d7=_0x1208d7-0x0;var _0x4b4988=_0x5d87[_0x1208d7];return _0x4b4988;};'use strict';var _=require(_0x75d8('0x0'));var util=require(_0x75d8('0x1'));var moment=require('moment');var BPromise=require(_0x75d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75d8('0x3'));var db=require(_0x75d8('0x4'))['db'];var utils=require(_0x75d8('0x5'));var logger=require(_0x75d8('0x6'))('rpc');var config=require(_0x75d8('0x7'));var jayson=require(_0x75d8('0x8'));var client=jayson[_0x75d8('0x9')]['http']({'port':0x232a});config[_0x75d8('0xa')]=_[_0x75d8('0xb')](config[_0x75d8('0xa')],{'host':_0x75d8('0xc'),'port':0x18eb});var socket=require(_0x75d8('0xd'))(new Redis(config[_0x75d8('0xa')]));require(_0x75d8('0xe'))[_0x75d8('0xf')](socket);function respondWithRpcPromise(_0x5711d9,_0x430002,_0x5ace6d){return new BPromise(function(_0x8001ff,_0x500f8a){return client[_0x75d8('0x10')](_0x5711d9,_0x5ace6d)[_0x75d8('0x11')](function(_0x505063){logger[_0x75d8('0x12')](_0x75d8('0x13'),_0x430002,_0x75d8('0x14'));logger[_0x75d8('0x15')](_0x75d8('0x16'),_0x430002,_0x75d8('0x14'),JSON['stringify'](_0x505063));if(_0x505063[_0x75d8('0x17')]){if(_0x505063[_0x75d8('0x17')][_0x75d8('0x18')]===0x1f4){logger['error'](_0x75d8('0x13'),_0x430002,_0x505063['error'][_0x75d8('0x19')]);return _0x500f8a(_0x505063['error'][_0x75d8('0x19')]);}logger[_0x75d8('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x430002,_0x505063[_0x75d8('0x17')][_0x75d8('0x19')]);return _0x8001ff(_0x505063['error']['message']);}else{logger[_0x75d8('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x430002,_0x75d8('0x14'));_0x8001ff(_0x505063[_0x75d8('0x1a')][_0x75d8('0x19')]);}})['catch'](function(_0x4d438c){logger[_0x75d8('0x17')](_0x75d8('0x13'),_0x430002,_0x4d438c);_0x500f8a(_0x4d438c);});});}exports['UpdateSmsInteraction']=function(_0x52950a){var _0x240df0=this;return new Promise(function(_0x457a6e,_0x5a5137){return db[_0x75d8('0x1b')][_0x75d8('0x1c')](_0x52950a[_0x75d8('0x1d')],{'raw':_0x52950a[_0x75d8('0x1e')]?_0x52950a[_0x75d8('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52950a['options']?_0x52950a['options']['where']||null:null,'attributes':_0x52950a[_0x75d8('0x1e')]?_0x52950a[_0x75d8('0x1e')][_0x75d8('0x1f')]||null:null,'limit':_0x52950a[_0x75d8('0x1e')]?_0x52950a[_0x75d8('0x1e')]['limit']||null:null})['then'](function(_0x35eb08){logger[_0x75d8('0x12')](_0x75d8('0x20'),_0x52950a);logger[_0x75d8('0x15')](_0x75d8('0x20'),_0x52950a,JSON[_0x75d8('0x21')](_0x35eb08));_0x457a6e(_0x35eb08);})['catch'](function(_0x5ed3f0){logger['error'](_0x75d8('0x20'),_0x5ed3f0[_0x75d8('0x19')],_0x52950a);_0x5a5137(_0x240df0[_0x75d8('0x17')](0x1f4,_0x5ed3f0['message']));});});};exports[_0x75d8('0x22')]=function(_0x9392e4){return new Promise(function(_0x19c1ba,_0x311917){return db[_0x75d8('0x1b')][_0x75d8('0x23')]({'where':_0x9392e4[_0x75d8('0x1e')]?_0x9392e4[_0x75d8('0x1e')]['where']||null:null})['then'](function(_0x31b1f6){if(_0x31b1f6){return _0x31b1f6['addTags'](_0x9392e4['body'][_0x75d8('0x24')],_[_0x75d8('0x25')](_0x9392e4[_0x75d8('0x1d')],[_0x75d8('0x24'),'id'])||{});}})[_0x75d8('0x26')](function(_0x37e7a6){logger[_0x75d8('0x12')]('AddTags',_0x9392e4);logger['debug'](_0x75d8('0x27'),_0x9392e4,JSON['stringify'](_0x37e7a6));_0x19c1ba(_0x37e7a6);})[_0x75d8('0x28')](function(_0x1185d9){logger[_0x75d8('0x17')](_0x75d8('0x27'),_0x1185d9['message'],_0x9392e4);_0x311917(_this[_0x75d8('0x17')](0x1f4,_0x1185d9['message']));});});}; \ No newline at end of file +var _0xabf1=['find','where','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','catch'];(function(_0x23e4cf,_0x12704d){var _0x2bd35a=function(_0xaa827a){while(--_0xaa827a){_0x23e4cf['push'](_0x23e4cf['shift']());}};_0x2bd35a(++_0x12704d);}(_0xabf1,0x1b6));var _0x1abf=function(_0x3b96d4,_0x339b04){_0x3b96d4=_0x3b96d4-0x0;var _0x40bd53=_0xabf1[_0x3b96d4];return _0x40bd53;};'use strict';var _=require(_0x1abf('0x0'));var util=require(_0x1abf('0x1'));var moment=require(_0x1abf('0x2'));var BPromise=require(_0x1abf('0x3'));var rs=require(_0x1abf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1abf('0x5'))['db'];var utils=require(_0x1abf('0x6'));var logger=require(_0x1abf('0x7'))(_0x1abf('0x8'));var config=require(_0x1abf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1abf('0xa')][_0x1abf('0xb')]({'port':0x232a});config[_0x1abf('0xc')]=_[_0x1abf('0xd')](config[_0x1abf('0xc')],{'host':_0x1abf('0xe'),'port':0x18eb});var socket=require(_0x1abf('0xf'))(new Redis(config[_0x1abf('0xc')]));require('./smsInteraction.socket')[_0x1abf('0x10')](socket);function respondWithRpcPromise(_0x4c4d16,_0x3661ec,_0x2a1c75){return new BPromise(function(_0x6e12eb,_0x3b8b96){return client[_0x1abf('0x11')](_0x4c4d16,_0x2a1c75)[_0x1abf('0x12')](function(_0x14a535){logger['info'](_0x1abf('0x13'),_0x3661ec,_0x1abf('0x14'));logger[_0x1abf('0x15')](_0x1abf('0x16'),_0x3661ec,_0x1abf('0x14'),JSON[_0x1abf('0x17')](_0x14a535));if(_0x14a535[_0x1abf('0x18')]){if(_0x14a535[_0x1abf('0x18')][_0x1abf('0x19')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x3661ec,_0x14a535[_0x1abf('0x18')][_0x1abf('0x1a')]);return _0x3b8b96(_0x14a535[_0x1abf('0x18')]['message']);}logger[_0x1abf('0x18')](_0x1abf('0x13'),_0x3661ec,_0x14a535['error'][_0x1abf('0x1a')]);return _0x6e12eb(_0x14a535[_0x1abf('0x18')]['message']);}else{logger[_0x1abf('0x1b')](_0x1abf('0x13'),_0x3661ec,_0x1abf('0x14'));_0x6e12eb(_0x14a535['result'][_0x1abf('0x1a')]);}})['catch'](function(_0x48dcf1){logger[_0x1abf('0x18')](_0x1abf('0x13'),_0x3661ec,_0x48dcf1);_0x3b8b96(_0x48dcf1);});});}exports[_0x1abf('0x1c')]=function(_0x28a057){var _0x241332=this;return new Promise(function(_0x3f9dfe,_0x3e6d2c){return db[_0x1abf('0x1d')][_0x1abf('0x1e')](_0x28a057['body'],{'raw':_0x28a057['options']?_0x28a057[_0x1abf('0x1f')][_0x1abf('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28a057[_0x1abf('0x1f')]?_0x28a057[_0x1abf('0x1f')]['where']||null:null,'attributes':_0x28a057['options']?_0x28a057[_0x1abf('0x1f')][_0x1abf('0x21')]||null:null,'limit':_0x28a057[_0x1abf('0x1f')]?_0x28a057[_0x1abf('0x1f')]['limit']||null:null})[_0x1abf('0x12')](function(_0x57b11b){logger[_0x1abf('0x1b')](_0x1abf('0x1c'),_0x28a057);logger[_0x1abf('0x15')](_0x1abf('0x1c'),_0x28a057,JSON[_0x1abf('0x17')](_0x57b11b));_0x3f9dfe(_0x57b11b);})[_0x1abf('0x22')](function(_0x10338a){logger[_0x1abf('0x18')](_0x1abf('0x1c'),_0x10338a[_0x1abf('0x1a')],_0x28a057);_0x3e6d2c(_0x241332[_0x1abf('0x18')](0x1f4,_0x10338a[_0x1abf('0x1a')]));});});};exports['AddTagsToSmsInteraction']=function(_0x501eb2){return new Promise(function(_0x595aae,_0x13a9e4){return db[_0x1abf('0x1d')][_0x1abf('0x23')]({'where':_0x501eb2[_0x1abf('0x1f')]?_0x501eb2[_0x1abf('0x1f')][_0x1abf('0x24')]||null:null})[_0x1abf('0x12')](function(_0xd644e9){if(_0xd644e9){return _0xd644e9[_0x1abf('0x25')](_0x501eb2[_0x1abf('0x26')]['ids'],_[_0x1abf('0x27')](_0x501eb2['body'],[_0x1abf('0x28'),'id'])||{});}})[_0x1abf('0x29')](function(_0x262768){logger['info'](_0x1abf('0x2a'),_0x501eb2);logger[_0x1abf('0x15')](_0x1abf('0x2a'),_0x501eb2,JSON[_0x1abf('0x17')](_0x262768));_0x595aae(_0x262768);})[_0x1abf('0x22')](function(_0x48b128){logger[_0x1abf('0x18')]('AddTags',_0x48b128[_0x1abf('0x1a')],_0x501eb2);_0x13a9e4(_this[_0x1abf('0x18')](0x1f4,_0x48b128[_0x1abf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5403ab3..2cd3c1b 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 _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x30345f,_0x51718e){var _0x20f2fe=function(_0x4edb09){while(--_0x4edb09){_0x30345f['push'](_0x30345f['shift']());}};_0x20f2fe(++_0x51718e);}(_0x757a,0xde));var _0xa757=function(_0x1365a8,_0x35fbc8){_0x1365a8=_0x1365a8-0x0;var _0x4de0bf=_0x757a[_0x1365a8];return _0x4de0bf;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x397d64,_0x6e7df1){var _0x1d90a8=function(_0x5845a1){while(--_0x5845a1){_0x397d64['push'](_0x397d64['shift']());}};_0x1d90a8(++_0x6e7df1);}(_0x757a,0xde));var _0xa757=function(_0x43623e,_0x19723d){_0x43623e=_0x43623e-0x0;var _0x827bc8=_0x757a[_0x43623e];return _0x827bc8;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 7c5d1f6..ec616ee 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 _0x727d=['index','/describe','isAuthenticated','describe','/:id','show','post','sms','create','status','update','/:id/accept','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get'];(function(_0x2e9094,_0x3765b8){var _0x5b5cab=function(_0x3c2925){while(--_0x3c2925){_0x2e9094['push'](_0x2e9094['shift']());}};_0x5b5cab(++_0x3765b8);}(_0x727d,0xf1));var _0xd727=function(_0x50c7e5,_0x380f0f){_0x50c7e5=_0x50c7e5-0x0;var _0x108f56=_0x727d[_0x50c7e5];return _0x108f56;};'use strict';var multer=require('multer');var util=require(_0xd727('0x0'));var path=require(_0xd727('0x1'));var timeout=require(_0xd727('0x2'));var express=require(_0xd727('0x3'));var router=express[_0xd727('0x4')]();var auth=require(_0xd727('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd727('0x6'));var controller=require(_0xd727('0x7'));router[_0xd727('0x8')]('/',auth['isAuthenticated'](),controller[_0xd727('0x9')]);router[_0xd727('0x8')](_0xd727('0xa'),auth[_0xd727('0xb')](),controller[_0xd727('0xc')]);router[_0xd727('0x8')](_0xd727('0xd'),auth[_0xd727('0xb')](),controller[_0xd727('0xe')]);router[_0xd727('0xf')]('/',auth[_0xd727('0xb')](),interaction['tracked'](_0xd727('0x10'),'smsmessage:create'),controller[_0xd727('0x11')]);router[_0xd727('0xf')]('/:id/status',controller[_0xd727('0x12')]);router['put'](_0xd727('0xd'),auth[_0xd727('0xb')](),controller[_0xd727('0x13')]);router['put'](_0xd727('0x14'),auth[_0xd727('0xb')](),controller['accept']);router[_0xd727('0x15')]('/:id/reject',auth[_0xd727('0xb')](),controller['reject']);router[_0xd727('0x16')](_0xd727('0xd'),auth[_0xd727('0xb')](),controller[_0xd727('0x17')]);module[_0xd727('0x18')]=router; \ No newline at end of file +var _0x404b=['./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','smsmessage:create','create','post','status','put','update','/:id/accept','accept','/:id/reject','reject','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x27b8fa,_0x2b186a){var _0x222f1c=function(_0x14bd66){while(--_0x14bd66){_0x27b8fa['push'](_0x27b8fa['shift']());}};_0x222f1c(++_0x2b186a);}(_0x404b,0x68));var _0xb404=function(_0x36d910,_0x2e8f99){_0x36d910=_0x36d910-0x0;var _0x4bba9e=_0x404b[_0x36d910];return _0x4bba9e;};'use strict';var multer=require(_0xb404('0x0'));var util=require(_0xb404('0x1'));var path=require(_0xb404('0x2'));var timeout=require(_0xb404('0x3'));var express=require(_0xb404('0x4'));var router=express[_0xb404('0x5')]();var auth=require(_0xb404('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb404('0x7'));var controller=require(_0xb404('0x8'));router[_0xb404('0x9')]('/',auth[_0xb404('0xa')](),controller[_0xb404('0xb')]);router[_0xb404('0x9')](_0xb404('0xc'),auth[_0xb404('0xa')](),controller[_0xb404('0xd')]);router[_0xb404('0x9')]('/:id',auth[_0xb404('0xa')](),controller[_0xb404('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0xb404('0xf')),controller[_0xb404('0x10')]);router[_0xb404('0x11')]('/:id/status',controller[_0xb404('0x12')]);router[_0xb404('0x13')]('/:id',auth[_0xb404('0xa')](),controller[_0xb404('0x14')]);router[_0xb404('0x13')](_0xb404('0x15'),auth['isAuthenticated'](),controller[_0xb404('0x16')]);router[_0xb404('0x13')](_0xb404('0x17'),auth[_0xb404('0xa')](),controller[_0xb404('0x18')]);router['delete'](_0xb404('0x19'),auth[_0xb404('0xa')](),controller[_0xb404('0x1a')]);module[_0xb404('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a4b14fa..5adaa3b 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 _0x6c3a=['sequelize','exports','medium','ENUM','out','STRING','BOOLEAN','TEXT'];(function(_0x3719b9,_0x15d82e){var _0x3f8893=function(_0x2301b9){while(--_0x2301b9){_0x3719b9['push'](_0x3719b9['shift']());}};_0x3f8893(++_0x15d82e);}(_0x6c3a,0x198));var _0xa6c3=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x6c3a[_0xcfd89f];return _0x59acd4;};'use strict';var Sequelize=require(_0xa6c3('0x0'));module[_0xa6c3('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa6c3('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa6c3('0x3')]('in',_0xa6c3('0x4')),'defaultValue':_0xa6c3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa6c3('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa6c3('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa6c3('0x7')]}}; \ No newline at end of file +var _0xfc39=['TEXT','medium','out','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x443fa6,_0x4b9beb){var _0xd44a49=function(_0x33fd02){while(--_0x33fd02){_0x443fa6['push'](_0x443fa6['shift']());}};_0xd44a49(++_0x4b9beb);}(_0xfc39,0x1ee));var _0x9fc3=function(_0x44ab94,_0x31e7f0){_0x44ab94=_0x44ab94-0x0;var _0x3404a7=_0xfc39[_0x44ab94];return _0x3404a7;};'use strict';var Sequelize=require(_0x9fc3('0x0'));module[_0x9fc3('0x1')]={'body':{'type':Sequelize[_0x9fc3('0x2')](_0x9fc3('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9fc3('0x4')),'defaultValue':_0x9fc3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9fc3('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x9fc3('0x6')]},'secret':{'type':Sequelize[_0x9fc3('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 46909c7..46d30d8 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 _0xf610=['[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsMessage.socket','register','jayson/promise','client','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','status','end','offset','limit','set','Content-Range','apply','reject','save','sendStatus','name','send','map','SmsMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','merge','where','filter','options','count','include','findAll','rows','show','params','keys','includeAll','find','create','body','update','destroy','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','../../config/logger','agent','info'];(function(_0x1ae139,_0x529c60){var _0x5e0de7=function(_0x2b8273){while(--_0x2b8273){_0x1ae139['push'](_0x1ae139['shift']());}};_0x5e0de7(++_0x529c60);}(_0xf610,0x199));var _0x0f61=function(_0x58fb9b,_0x345a74){_0x58fb9b=_0x58fb9b-0x0;var _0x496ffe=_0xf610[_0x58fb9b];return _0x496ffe;};'use strict';var pdf=require(_0x0f61('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f61('0x1'));var jsonpatch=require(_0x0f61('0x2'));var rp=require(_0x0f61('0x3'));var moment=require('moment');var BPromise=require(_0x0f61('0x4'));var Mustache=require('mustache');var util=require(_0x0f61('0x5'));var path=require(_0x0f61('0x6'));var sox=require(_0x0f61('0x7'));var csv=require(_0x0f61('0x8'));var ejs=require(_0x0f61('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f61('0xa'));var jsforce=require(_0x0f61('0xb'));var deskjs=require(_0x0f61('0xc'));var toCsv=require(_0x0f61('0x8'));var querystring=require(_0x0f61('0xd'));var Papa=require('papaparse');var Redis=require(_0x0f61('0xe'));var authService=require(_0x0f61('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0f61('0x10'));var hardwareService=require(_0x0f61('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0f61('0x12'));var licenseUtil=require(_0x0f61('0x13'));var db=require(_0x0f61('0x14'))['db'];config[_0x0f61('0x15')]=_['defaults'](config[_0x0f61('0x15')],{'host':_0x0f61('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f61('0x17'))[_0x0f61('0x18')](socket);var jayson=require(_0x0f61('0x19'));var client=jayson[_0x0f61('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x0f61('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4da776,_0x174b69,_0x5932b6,_0x40a676){return new BPromise(function(_0x1052fa,_0x20803a){var _0x4038dd=_0x40a676||client;return _0x4038dd['request'](_0x4da776,_0x5932b6)[_0x0f61('0x1b')](function(_0x409d3d){logger['info'](_0x0f61('0x1c'),_0x174b69,'request\x20sent');logger[_0x0f61('0x1d')](_0x0f61('0x1e'),_0x174b69,'request\x20sent',JSON[_0x0f61('0x1f')](_0x409d3d));if(_0x409d3d[_0x0f61('0x20')]){if(_0x409d3d[_0x0f61('0x20')]['code']===0x1f4){logger[_0x0f61('0x20')](_0x0f61('0x1c'),_0x174b69,_0x409d3d[_0x0f61('0x20')][_0x0f61('0x21')]);return _0x20803a(_0x409d3d['error'][_0x0f61('0x21')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x174b69,_0x409d3d[_0x0f61('0x20')]['message']);return _0x1052fa(_0x409d3d['error'][_0x0f61('0x21')]);}else{logger['info'](_0x0f61('0x1c'),_0x174b69,_0x0f61('0x22'));_0x1052fa(_0x409d3d['result'][_0x0f61('0x21')]);}})[_0x0f61('0x23')](function(_0x2d7717){logger['error']('SmsMessage,\x20%s,\x20%s',_0x174b69,_0x2d7717);_0x20803a(_0x2d7717);});});}function respondWithStatusCode(_0x545b6d,_0x1fabab){_0x1fabab=_0x1fabab||0xcc;return function(_0x5f31f1){if(_0x5f31f1){return _0x545b6d['sendStatus'](_0x1fabab);}return _0x545b6d[_0x0f61('0x24')](_0x1fabab)[_0x0f61('0x25')]();};}function respondWithResult(_0x23baa9,_0x117ef0){_0x117ef0=_0x117ef0||0xc8;return function(_0x36e3db){if(_0x36e3db){return _0x23baa9[_0x0f61('0x24')](_0x117ef0)['json'](_0x36e3db);}};}function respondWithFilteredResult(_0x3191de,_0x4ec347){return function(_0x28a937){if(_0x28a937){var _0x28d9a1=_0x28a937['count'],_0x3f04d9=_0x4ec347[_0x0f61('0x26')],_0x33d6eb=_0x4ec347[_0x0f61('0x26')]+_0x4ec347[_0x0f61('0x27')],_0x5dfbc5;if(_0x33d6eb>=_0x28d9a1){_0x33d6eb=_0x28d9a1;_0x5dfbc5=0xc8;}else{_0x5dfbc5=0xce;}_0x3191de[_0x0f61('0x24')](_0x5dfbc5);return _0x3191de[_0x0f61('0x28')](_0x0f61('0x29'),_0x3f04d9+'-'+_0x33d6eb+'/'+_0x28d9a1)['json'](_0x28a937);}return null;};}function patchUpdates(_0x2f9da2){return function(_0x27120a){try{jsonpatch[_0x0f61('0x2a')](_0x27120a,_0x2f9da2,!![]);}catch(_0x687534){return BPromise[_0x0f61('0x2b')](_0x687534);}return _0x27120a[_0x0f61('0x2c')]();};}function saveUpdates(_0x24b69e,_0x2d7147){return function(_0x5d7b5f){if(_0x5d7b5f){return _0x5d7b5f['update'](_0x24b69e)['then'](function(_0x2f462b){return _0x2f462b;});}return null;};}function removeEntity(_0x341785,_0x4ed62c){return function(_0x1953bc){if(_0x1953bc){return _0x1953bc['destroy']()[_0x0f61('0x1b')](function(){_0x341785[_0x0f61('0x24')](0xcc)[_0x0f61('0x25')]();});}};}function handleEntityNotFound(_0x346708,_0x5c15b1){return function(_0x139ecd){if(!_0x139ecd){_0x346708[_0x0f61('0x2d')](0x194);}return _0x139ecd;};}function handleError(_0x55dad5,_0x47ee80){_0x47ee80=_0x47ee80||0x1f4;return function(_0xa9a0d1){logger['error'](_0xa9a0d1['stack']);if(_0xa9a0d1[_0x0f61('0x2e')]){delete _0xa9a0d1['name'];}_0x55dad5[_0x0f61('0x24')](_0x47ee80)[_0x0f61('0x2f')](_0xa9a0d1);};}exports['index']=function(_0x383ae3,_0x40b406){var _0xd4fea7={},_0x468424={},_0x4befeb={'count':0x0,'rows':[]};var _0x2f2363=_[_0x0f61('0x30')](db[_0x0f61('0x31')][_0x0f61('0x32')],function(_0x55202b){return{'name':_0x55202b['fieldName'],'type':_0x55202b[_0x0f61('0x33')][_0x0f61('0x34')]};});_0x468424[_0x0f61('0x35')]=_[_0x0f61('0x30')](_0x2f2363,_0x0f61('0x2e'));_0x468424[_0x0f61('0x36')]=_['keys'](_0x383ae3[_0x0f61('0x36')]);_0x468424[_0x0f61('0x37')]=_[_0x0f61('0x38')](_0x468424[_0x0f61('0x35')],_0x468424[_0x0f61('0x36')]);_0xd4fea7[_0x0f61('0x39')]=_[_0x0f61('0x38')](_0x468424[_0x0f61('0x35')],qs[_0x0f61('0x3a')](_0x383ae3[_0x0f61('0x36')][_0x0f61('0x3a')]));_0xd4fea7[_0x0f61('0x39')]=_0xd4fea7[_0x0f61('0x39')]['length']?_0xd4fea7['attributes']:_0x468424['model'];if(!_0x383ae3['query'][_0x0f61('0x3b')]('nolimit')){_0xd4fea7['limit']=qs[_0x0f61('0x27')](_0x383ae3[_0x0f61('0x36')][_0x0f61('0x27')]);_0xd4fea7['offset']=qs[_0x0f61('0x26')](_0x383ae3[_0x0f61('0x36')]['offset']);}_0xd4fea7['order']=qs[_0x0f61('0x3c')](_0x383ae3['query'][_0x0f61('0x3c')]);_0xd4fea7['where']=qs[_0x0f61('0x37')](_[_0x0f61('0x3d')](_0x383ae3['query'],_0x468424[_0x0f61('0x37')]),_0x2f2363);if(_0x383ae3[_0x0f61('0x36')]['filter']){_0xd4fea7['where']=_[_0x0f61('0x3e')](_0xd4fea7[_0x0f61('0x3f')],{'$or':_[_0x0f61('0x30')](_0x2f2363,function(_0x41dbb9){if(_0x41dbb9['type']!=='VIRTUAL'){var _0x50f38d={};_0x50f38d[_0x41dbb9['name']]={'$like':'%'+_0x383ae3['query'][_0x0f61('0x40')]+'%'};return _0x50f38d;}})});}_0xd4fea7=_[_0x0f61('0x3e')]({},_0xd4fea7,_0x383ae3[_0x0f61('0x41')]);var _0x14aec5={'where':_0xd4fea7[_0x0f61('0x3f')]};return db[_0x0f61('0x31')][_0x0f61('0x42')](_0x14aec5)[_0x0f61('0x1b')](function(_0x40d00e){_0x4befeb[_0x0f61('0x42')]=_0x40d00e;if(_0x383ae3['query']['includeAll']){_0xd4fea7[_0x0f61('0x43')]=[{'all':!![]}];}return db[_0x0f61('0x31')][_0x0f61('0x44')](_0xd4fea7);})[_0x0f61('0x1b')](function(_0x52375d){_0x4befeb[_0x0f61('0x45')]=_0x52375d;return _0x4befeb;})[_0x0f61('0x1b')](respondWithFilteredResult(_0x40b406,_0xd4fea7))[_0x0f61('0x23')](handleError(_0x40b406,null));};exports[_0x0f61('0x46')]=function(_0x1450d2,_0x1edca){var _0x2e25a6={'raw':!![],'where':{'id':_0x1450d2[_0x0f61('0x47')]['id']}},_0x242c8d={};_0x242c8d['model']=_[_0x0f61('0x48')](db[_0x0f61('0x31')][_0x0f61('0x32')]);_0x242c8d[_0x0f61('0x36')]=_[_0x0f61('0x48')](_0x1450d2[_0x0f61('0x36')]);_0x242c8d['filters']=_['intersection'](_0x242c8d[_0x0f61('0x35')],_0x242c8d[_0x0f61('0x36')]);_0x2e25a6[_0x0f61('0x39')]=_[_0x0f61('0x38')](_0x242c8d[_0x0f61('0x35')],qs[_0x0f61('0x3a')](_0x1450d2[_0x0f61('0x36')][_0x0f61('0x3a')]));_0x2e25a6[_0x0f61('0x39')]=_0x2e25a6[_0x0f61('0x39')]['length']?_0x2e25a6[_0x0f61('0x39')]:_0x242c8d[_0x0f61('0x35')];if(_0x1450d2['query'][_0x0f61('0x49')]){_0x2e25a6['include']=[{'all':!![]}];}_0x2e25a6=_['merge']({},_0x2e25a6,_0x1450d2[_0x0f61('0x41')]);return db['SmsMessage'][_0x0f61('0x4a')](_0x2e25a6)['then'](handleEntityNotFound(_0x1edca,null))[_0x0f61('0x1b')](respondWithResult(_0x1edca,null))['catch'](handleError(_0x1edca,null));};exports[_0x0f61('0x4b')]=function(_0x4ae0a1,_0x15f4eb){return db[_0x0f61('0x31')][_0x0f61('0x4b')](_0x4ae0a1[_0x0f61('0x4c')],{})[_0x0f61('0x1b')](respondWithResult(_0x15f4eb,0xc9))[_0x0f61('0x23')](handleError(_0x15f4eb,null));};exports[_0x0f61('0x4d')]=function(_0x1c4238,_0x1bc764){if(_0x1c4238[_0x0f61('0x4c')]['id']){delete _0x1c4238['body']['id'];}return db['SmsMessage'][_0x0f61('0x4a')]({'where':{'id':_0x1c4238['params']['id']}})['then'](handleEntityNotFound(_0x1bc764,null))[_0x0f61('0x1b')](saveUpdates(_0x1c4238[_0x0f61('0x4c')],null))['then'](respondWithResult(_0x1bc764,null))['catch'](handleError(_0x1bc764,null));};exports[_0x0f61('0x4e')]=function(_0x51b05d,_0x2615a6){return db[_0x0f61('0x31')]['find']({'where':{'id':_0x51b05d[_0x0f61('0x47')]['id']}})['then'](handleEntityNotFound(_0x2615a6,null))[_0x0f61('0x1b')](removeEntity(_0x2615a6,null))['catch'](handleError(_0x2615a6,null));};exports[_0x0f61('0x4f')]=function(_0x3e4d1e,_0x1c7a31){return db[_0x0f61('0x31')][_0x0f61('0x4f')]()['then'](respondWithResult(_0x1c7a31,null))[_0x0f61('0x23')](handleError(_0x1c7a31,null));};var interaction_log=require('../../config/logger')(_0x0f61('0x50'));exports[_0x0f61('0x51')]=function(_0x747884,_0x3c657d,_0x44ce37){var _0x5d4986={'channel':_0x0f61('0x52')};if(_0x747884[_0x0f61('0x4c')]['id']){delete _0x747884[_0x0f61('0x4c')]['id'];}_0x747884['body'][_0x0f61('0x53')]=!![];_0x747884[_0x0f61('0x4c')][_0x0f61('0x54')]=moment()[_0x0f61('0x55')](_0x0f61('0x56'));_0x747884[_0x0f61('0x4c')][_0x0f61('0x57')]=_0x747884[_0x0f61('0x4c')][_0x0f61('0x57')]||_0x747884[_0x0f61('0x58')]['id'];return db[_0x0f61('0x31')][_0x0f61('0x4a')]({'where':{'id':_0x747884[_0x0f61('0x47')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0f61('0x59')}]})[_0x0f61('0x1b')](handleEntityNotFound(_0x3c657d,null))['then'](saveUpdates(_0x747884[_0x0f61('0x4c')],null))[_0x0f61('0x1b')](function(_0x54f96a){if(_0x54f96a){_0x5d4986['message']=_0x54f96a[_0x0f61('0x5a')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x54f96a[_0x0f61('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x3c657d,null))[_0x0f61('0x1b')](function(_0x5a7944){if(_0x5a7944){return _0x5a7944[_0x0f61('0x4d')]({'UserId':_0x747884[_0x0f61('0x4c')][_0x0f61('0x57')],'read1stAt':_[_0x0f61('0x5c')](_0x5a7944[_0x0f61('0x5d')])?moment()[_0x0f61('0x55')](_0x0f61('0x56')):undefined});}return null;})['then'](function(_0x29e188){if(_0x29e188){_0x5d4986[_0x0f61('0x5e')]=_0x29e188['get']({'plain':!![]});interaction_log['info'](_0x0f61('0x5f'),_0x747884['user']['id'],_0x747884[_0x0f61('0x58')]['name'],_0x747884[_0x0f61('0x58')][_0x0f61('0x60')],_0x5d4986[_0x0f61('0x5e')]['id'],_0x747884[_0x0f61('0x4c')]?JSON[_0x0f61('0x1f')](_0x747884['body']):_0x0f61('0x61'));return respondWithRpcPromise(_0x0f61('0x62'),'acceptMessage',_0x5d4986);}return null;})[_0x0f61('0x1b')](function(_0x4253f7){if(_0x4253f7){if(_0x747884[_0x0f61('0x4c')][_0x0f61('0x63')]){_0x5d4986[_0x0f61('0x21')]['interface']=util['format'](_0x0f61('0x64'),_0x747884[_0x0f61('0x58')][_0x0f61('0x2e')]);_0x5d4986[_0x0f61('0x21')][_0x0f61('0x65')]=_0x5d4986['channel'];_0x5d4986[_0x0f61('0x21')][_0x0f61('0x66')]=_0x0f61('0x51');return respondWithRpcPromise(_0x0f61('0x67'),_0x0f61('0x67'),{'event':'acceptmessage','message':_0x5d4986[_0x0f61('0x21')]},client9002)[_0x0f61('0x1b')](function(){return _0x5d4986;});}return _0x5d4986;}return null;})[_0x0f61('0x1b')](respondWithResult(_0x3c657d,null))['catch'](handleError(_0x3c657d,null));};var interaction_log=require(_0x0f61('0x68'))(_0x0f61('0x50'));exports[_0x0f61('0x2b')]=function(_0x5d5719,_0x484960,_0x33213a){var _0x8c0b45={'agent':{},'channel':_0x0f61('0x52')};if(_0x5d5719[_0x0f61('0x4c')]['id']){delete _0x5d5719[_0x0f61('0x4c')]['id'];}_0x5d5719[_0x0f61('0x4c')][_0x0f61('0x57')]=_0x5d5719[_0x0f61('0x4c')][_0x0f61('0x57')]||_0x5d5719['user']['id'];_0x8c0b45[_0x0f61('0x69')]['id']=_0x5d5719[_0x0f61('0x4c')]['UserId'];return db[_0x0f61('0x31')][_0x0f61('0x4a')]({'where':{'id':_0x5d5719[_0x0f61('0x47')]['id'],'UserId':null}})[_0x0f61('0x1b')](handleEntityNotFound(_0x484960,null))['then'](function(_0x3b4b66){if(_0x3b4b66){_0x8c0b45[_0x0f61('0x21')]=_0x3b4b66[_0x0f61('0x5a')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3b4b66[_0x0f61('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x484960,null))['then'](function(_0x57895d){if(_0x57895d){_0x8c0b45[_0x0f61('0x5e')]=_0x57895d['get']({'plain':!![]});interaction_log[_0x0f61('0x6a')](_0x0f61('0x6b'),_0x5d5719[_0x0f61('0x58')]['id'],_0x5d5719[_0x0f61('0x58')][_0x0f61('0x2e')],_0x5d5719[_0x0f61('0x58')]['role'],_0x8c0b45[_0x0f61('0x5e')]['id'],_0x5d5719[_0x0f61('0x4c')]?JSON[_0x0f61('0x1f')](_0x5d5719[_0x0f61('0x4c')]):_0x0f61('0x61'));return respondWithRpcPromise(_0x0f61('0x6c'),'rejectMessage',_0x8c0b45);}return null;})[_0x0f61('0x1b')](function(_0x53d19a){if(_0x53d19a){_0x53d19a[_0x0f61('0x21')][_0x0f61('0x6d')]=util[_0x0f61('0x55')](_0x0f61('0x64'),_0x5d5719[_0x0f61('0x58')][_0x0f61('0x2e')]);_0x53d19a['message'][_0x0f61('0x65')]=_0x8c0b45[_0x0f61('0x65')];_0x53d19a[_0x0f61('0x21')][_0x0f61('0x66')]=_0x0f61('0x2b');respondWithRpcPromise(_0x0f61('0x67'),_0x0f61('0x67'),{'event':'rejectmessage','message':_0x53d19a[_0x0f61('0x21')]},client9002);return _0x8c0b45;}return null;})[_0x0f61('0x1b')](respondWithResult(_0x484960,null))[_0x0f61('0x23')](handleError(_0x484960,null));};exports[_0x0f61('0x24')]=function(_0x4d3552,_0x4817c7,_0xdce0a0){if(_0x4d3552[_0x0f61('0x4c')]['id']){delete _0x4d3552[_0x0f61('0x4c')]['id'];}var _0x38edbc;return db[_0x0f61('0x31')][_0x0f61('0x4a')]({'where':{'id':_0x4d3552[_0x0f61('0x47')]['id']}})[_0x0f61('0x1b')](handleEntityNotFound(_0x4817c7,null))[_0x0f61('0x1b')](function(_0x10089e){if(_0x10089e){_0x38edbc=_0x10089e;return db[_0x0f61('0x6e')]['find']({'where':{'id':_0x10089e[_0x0f61('0x6f')]}});}})[_0x0f61('0x1b')](handleEntityNotFound(_0x4817c7,null))['then'](function(_0x294343){if(_0x294343){logger[_0x0f61('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0f61('0x24'),_0x0f61('0x70'),_0x294343[_0x0f61('0x33')],util[_0x0f61('0x71')](_0x4d3552[_0x0f61('0x4c')],{'showHidden':![],'depth':null}));switch(_0x294343[_0x0f61('0x33')]){case _0x0f61('0x72'):if(_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x73')]&&_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x73')]===_0x38edbc[_0x0f61('0x74')]){return _0x38edbc[_0x0f61('0x4d')]({'read':!![]});}else{logger['error'](_0x0f61('0x75'),_0x0f61('0x24'),_0x0f61('0x72'),util[_0x0f61('0x71')](_0x4d3552[_0x0f61('0x4c')],{'showHidden':![],'depth':null}));}break;case _0x0f61('0x76'):if(_0x4d3552['body'][_0x0f61('0x77')]&&_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x77')]===_0x38edbc['messageId']&&_[_0x0f61('0x78')]([_0x0f61('0x79'),_0x0f61('0x7a')],_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x7b')])>=0x0){return _0x38edbc[_0x0f61('0x4d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0f61('0x24'),_0x0f61('0x7c'),util[_0x0f61('0x71')](_0x4d3552[_0x0f61('0x4c')],{'showHidden':![],'depth':null}));}break;case _0x0f61('0x7d'):var _0x2f991c=_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x7e')][0x0];if(_0x2f991c['status'][_0x0f61('0x7f')]===_0x0f61('0x80')){return _0x38edbc[_0x0f61('0x4d')]({'read':!![]});}else{logger[_0x0f61('0x20')](_0x0f61('0x75'),_0x0f61('0x24'),_0x0f61('0x7d'),util[_0x0f61('0x71')](_0x4d3552['body'],{'showHidden':![],'depth':null}));}break;}return _0x38edbc;}})['then'](respondWithResult(_0x4817c7,null))[_0x0f61('0x23')](handleError(_0x4817c7,null));}; \ No newline at end of file +var _0x6bf0=['results','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','SmsMessage','includeAll','include','findAll','show','params','create','body','find','describe','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','rejectmessage','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','indexOf','delivered','Status','plivio','infobip'];(function(_0x4d955b,_0x1eb048){var _0x1c06b8=function(_0x2a4fc9){while(--_0x2a4fc9){_0x4d955b['push'](_0x4d955b['shift']());}};_0x1c06b8(++_0x1eb048);}(_0x6bf0,0x85));var _0x06bf=function(_0x141307,_0x7694e9){_0x141307=_0x141307-0x0;var _0x32b59e=_0x6bf0[_0x141307];return _0x32b59e;};'use strict';var pdf=require(_0x06bf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x06bf('0x1'));var zipdir=require(_0x06bf('0x2'));var jsonpatch=require(_0x06bf('0x3'));var rp=require(_0x06bf('0x4'));var moment=require(_0x06bf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06bf('0x6'));var path=require(_0x06bf('0x7'));var sox=require(_0x06bf('0x8'));var csv=require('to-csv');var ejs=require(_0x06bf('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06bf('0xa'));var crypto=require('crypto');var jsforce=require(_0x06bf('0xb'));var deskjs=require(_0x06bf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x06bf('0xd'));var Papa=require(_0x06bf('0xe'));var Redis=require('ioredis');var authService=require(_0x06bf('0xf'));var qs=require(_0x06bf('0x10'));var as=require(_0x06bf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06bf('0x12'))(_0x06bf('0x13'));var utils=require(_0x06bf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x06bf('0x15'));var db=require(_0x06bf('0x16'))['db'];config['redis']=_[_0x06bf('0x17')](config[_0x06bf('0x18')],{'host':_0x06bf('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x06bf('0x18')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x06bf('0x1a'));var client=jayson[_0x06bf('0x1b')][_0x06bf('0x1c')]({'port':0x232c});var client9002=jayson[_0x06bf('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40b684,_0x2dc734,_0x3fc560,_0x24c02a){return new BPromise(function(_0x33c4c0,_0x5e7f88){var _0x353c3a=_0x24c02a||client;return _0x353c3a[_0x06bf('0x1d')](_0x40b684,_0x3fc560)[_0x06bf('0x1e')](function(_0x4a285d){logger[_0x06bf('0x1f')](_0x06bf('0x20'),_0x2dc734,'request\x20sent');logger[_0x06bf('0x21')](_0x06bf('0x22'),_0x2dc734,_0x06bf('0x23'),JSON[_0x06bf('0x24')](_0x4a285d));if(_0x4a285d[_0x06bf('0x25')]){if(_0x4a285d[_0x06bf('0x25')][_0x06bf('0x26')]===0x1f4){logger[_0x06bf('0x25')](_0x06bf('0x20'),_0x2dc734,_0x4a285d['error'][_0x06bf('0x27')]);return _0x5e7f88(_0x4a285d['error'][_0x06bf('0x27')]);}logger[_0x06bf('0x25')]('SmsMessage,\x20%s,\x20%s',_0x2dc734,_0x4a285d[_0x06bf('0x25')][_0x06bf('0x27')]);return _0x33c4c0(_0x4a285d[_0x06bf('0x25')][_0x06bf('0x27')]);}else{logger[_0x06bf('0x1f')](_0x06bf('0x20'),_0x2dc734,_0x06bf('0x23'));_0x33c4c0(_0x4a285d[_0x06bf('0x28')][_0x06bf('0x27')]);}})[_0x06bf('0x29')](function(_0x2c55d5){logger[_0x06bf('0x25')]('SmsMessage,\x20%s,\x20%s',_0x2dc734,_0x2c55d5);_0x5e7f88(_0x2c55d5);});});}function respondWithStatusCode(_0x1137e3,_0x132850){_0x132850=_0x132850||0xcc;return function(_0x300c1a){if(_0x300c1a){return _0x1137e3[_0x06bf('0x2a')](_0x132850);}return _0x1137e3[_0x06bf('0x2b')](_0x132850)[_0x06bf('0x2c')]();};}function respondWithResult(_0x3fdfcf,_0x4cddc8){_0x4cddc8=_0x4cddc8||0xc8;return function(_0x44dfb7){if(_0x44dfb7){return _0x3fdfcf['status'](_0x4cddc8)[_0x06bf('0x2d')](_0x44dfb7);}};}function respondWithFilteredResult(_0x2912e7,_0x5e85d3){return function(_0x3119ae){if(_0x3119ae){var _0x141274=_0x3119ae[_0x06bf('0x2e')],_0x47085c=_0x5e85d3[_0x06bf('0x2f')],_0x4f468f=_0x5e85d3['offset']+_0x5e85d3['limit'],_0x556acd;if(_0x4f468f>=_0x141274){_0x4f468f=_0x141274;_0x556acd=0xc8;}else{_0x556acd=0xce;}_0x2912e7[_0x06bf('0x2b')](_0x556acd);return _0x2912e7[_0x06bf('0x30')](_0x06bf('0x31'),_0x47085c+'-'+_0x4f468f+'/'+_0x141274)[_0x06bf('0x2d')](_0x3119ae);}return null;};}function patchUpdates(_0x563cc1){return function(_0x4b9f25){try{jsonpatch[_0x06bf('0x32')](_0x4b9f25,_0x563cc1,!![]);}catch(_0x3a23bc){return BPromise[_0x06bf('0x33')](_0x3a23bc);}return _0x4b9f25[_0x06bf('0x34')]();};}function saveUpdates(_0x2f1af4,_0x551f8f){return function(_0x1e5a77){if(_0x1e5a77){return _0x1e5a77[_0x06bf('0x35')](_0x2f1af4)[_0x06bf('0x1e')](function(_0x2b9116){return _0x2b9116;});}return null;};}function removeEntity(_0x278676,_0xcbcc4d){return function(_0x1bc2e1){if(_0x1bc2e1){return _0x1bc2e1[_0x06bf('0x36')]()['then'](function(){_0x278676[_0x06bf('0x2b')](0xcc)[_0x06bf('0x2c')]();});}};}function handleEntityNotFound(_0x4aab75,_0x4e107e){return function(_0x1a9e2f){if(!_0x1a9e2f){_0x4aab75['sendStatus'](0x194);}return _0x1a9e2f;};}function handleError(_0x240c73,_0x51d50c){_0x51d50c=_0x51d50c||0x1f4;return function(_0xcb9623){logger['error'](_0xcb9623[_0x06bf('0x37')]);if(_0xcb9623[_0x06bf('0x38')]){delete _0xcb9623[_0x06bf('0x38')];}_0x240c73[_0x06bf('0x2b')](_0x51d50c)[_0x06bf('0x39')](_0xcb9623);};}exports[_0x06bf('0x3a')]=function(_0x224afc,_0x289ff9){var _0x4af7c1={},_0x3cd2b6={},_0x4bfd4c={'count':0x0,'rows':[]};var _0x37b5f1=_[_0x06bf('0x3b')](db['SmsMessage'][_0x06bf('0x3c')],function(_0x308710){return{'name':_0x308710['fieldName'],'type':_0x308710['type']['key']};});_0x3cd2b6[_0x06bf('0x3d')]=_['map'](_0x37b5f1,'name');_0x3cd2b6[_0x06bf('0x3e')]=_[_0x06bf('0x3f')](_0x224afc['query']);_0x3cd2b6[_0x06bf('0x40')]=_[_0x06bf('0x41')](_0x3cd2b6[_0x06bf('0x3d')],_0x3cd2b6[_0x06bf('0x3e')]);_0x4af7c1['attributes']=_[_0x06bf('0x41')](_0x3cd2b6[_0x06bf('0x3d')],qs[_0x06bf('0x42')](_0x224afc[_0x06bf('0x3e')][_0x06bf('0x42')]));_0x4af7c1[_0x06bf('0x43')]=_0x4af7c1[_0x06bf('0x43')][_0x06bf('0x44')]?_0x4af7c1['attributes']:_0x3cd2b6[_0x06bf('0x3d')];if(!_0x224afc[_0x06bf('0x3e')][_0x06bf('0x45')](_0x06bf('0x46'))){_0x4af7c1[_0x06bf('0x47')]=qs[_0x06bf('0x47')](_0x224afc[_0x06bf('0x3e')][_0x06bf('0x47')]);_0x4af7c1[_0x06bf('0x2f')]=qs['offset'](_0x224afc[_0x06bf('0x3e')][_0x06bf('0x2f')]);}_0x4af7c1[_0x06bf('0x48')]=qs[_0x06bf('0x49')](_0x224afc['query'][_0x06bf('0x49')]);_0x4af7c1['where']=qs[_0x06bf('0x40')](_[_0x06bf('0x4a')](_0x224afc[_0x06bf('0x3e')],_0x3cd2b6[_0x06bf('0x40')]),_0x37b5f1);if(_0x224afc[_0x06bf('0x3e')][_0x06bf('0x4b')]){_0x4af7c1['where']=_[_0x06bf('0x4c')](_0x4af7c1[_0x06bf('0x4d')],{'$or':_['map'](_0x37b5f1,function(_0x5de0e8){if(_0x5de0e8[_0x06bf('0x4e')]!==_0x06bf('0x4f')){var _0x206c2b={};_0x206c2b[_0x5de0e8[_0x06bf('0x38')]]={'$like':'%'+_0x224afc['query'][_0x06bf('0x4b')]+'%'};return _0x206c2b;}})});}_0x4af7c1=_[_0x06bf('0x4c')]({},_0x4af7c1,_0x224afc[_0x06bf('0x50')]);var _0x146497={'where':_0x4af7c1[_0x06bf('0x4d')]};return db[_0x06bf('0x51')][_0x06bf('0x2e')](_0x146497)[_0x06bf('0x1e')](function(_0x506767){_0x4bfd4c[_0x06bf('0x2e')]=_0x506767;if(_0x224afc[_0x06bf('0x3e')][_0x06bf('0x52')]){_0x4af7c1[_0x06bf('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0x06bf('0x54')](_0x4af7c1);})[_0x06bf('0x1e')](function(_0x1a3db3){_0x4bfd4c['rows']=_0x1a3db3;return _0x4bfd4c;})['then'](respondWithFilteredResult(_0x289ff9,_0x4af7c1))[_0x06bf('0x29')](handleError(_0x289ff9,null));};exports[_0x06bf('0x55')]=function(_0x3acfb4,_0x152b4b){var _0x2c0bb4={'raw':!![],'where':{'id':_0x3acfb4[_0x06bf('0x56')]['id']}},_0x51feda={};_0x51feda[_0x06bf('0x3d')]=_[_0x06bf('0x3f')](db[_0x06bf('0x51')][_0x06bf('0x3c')]);_0x51feda[_0x06bf('0x3e')]=_[_0x06bf('0x3f')](_0x3acfb4[_0x06bf('0x3e')]);_0x51feda[_0x06bf('0x40')]=_[_0x06bf('0x41')](_0x51feda[_0x06bf('0x3d')],_0x51feda[_0x06bf('0x3e')]);_0x2c0bb4[_0x06bf('0x43')]=_[_0x06bf('0x41')](_0x51feda[_0x06bf('0x3d')],qs[_0x06bf('0x42')](_0x3acfb4[_0x06bf('0x3e')][_0x06bf('0x42')]));_0x2c0bb4[_0x06bf('0x43')]=_0x2c0bb4[_0x06bf('0x43')][_0x06bf('0x44')]?_0x2c0bb4['attributes']:_0x51feda['model'];if(_0x3acfb4[_0x06bf('0x3e')][_0x06bf('0x52')]){_0x2c0bb4[_0x06bf('0x53')]=[{'all':!![]}];}_0x2c0bb4=_[_0x06bf('0x4c')]({},_0x2c0bb4,_0x3acfb4['options']);return db[_0x06bf('0x51')]['find'](_0x2c0bb4)[_0x06bf('0x1e')](handleEntityNotFound(_0x152b4b,null))[_0x06bf('0x1e')](respondWithResult(_0x152b4b,null))[_0x06bf('0x29')](handleError(_0x152b4b,null));};exports[_0x06bf('0x57')]=function(_0xbd83c3,_0x499ecc){return db[_0x06bf('0x51')][_0x06bf('0x57')](_0xbd83c3[_0x06bf('0x58')],{})[_0x06bf('0x1e')](respondWithResult(_0x499ecc,0xc9))[_0x06bf('0x29')](handleError(_0x499ecc,null));};exports[_0x06bf('0x35')]=function(_0x374f8d,_0x50814f){if(_0x374f8d[_0x06bf('0x58')]['id']){delete _0x374f8d['body']['id'];}return db['SmsMessage'][_0x06bf('0x59')]({'where':{'id':_0x374f8d[_0x06bf('0x56')]['id']}})[_0x06bf('0x1e')](handleEntityNotFound(_0x50814f,null))[_0x06bf('0x1e')](saveUpdates(_0x374f8d[_0x06bf('0x58')],null))['then'](respondWithResult(_0x50814f,null))[_0x06bf('0x29')](handleError(_0x50814f,null));};exports[_0x06bf('0x36')]=function(_0x5e14d9,_0x10d0be){return db[_0x06bf('0x51')][_0x06bf('0x59')]({'where':{'id':_0x5e14d9[_0x06bf('0x56')]['id']}})[_0x06bf('0x1e')](handleEntityNotFound(_0x10d0be,null))['then'](removeEntity(_0x10d0be,null))[_0x06bf('0x29')](handleError(_0x10d0be,null));};exports['describe']=function(_0x4c8f33,_0x48c78c){return db[_0x06bf('0x51')][_0x06bf('0x5a')]()[_0x06bf('0x1e')](respondWithResult(_0x48c78c,null))['catch'](handleError(_0x48c78c,null));};var interaction_log=require(_0x06bf('0x12'))('sms-interactions');exports['accept']=function(_0x4525bd,_0x4bfb70,_0x5e86cf){var _0x3460d7={'channel':_0x06bf('0x5b')};if(_0x4525bd['body']['id']){delete _0x4525bd[_0x06bf('0x58')]['id'];}_0x4525bd[_0x06bf('0x58')][_0x06bf('0x5c')]=!![];_0x4525bd['body'][_0x06bf('0x5d')]=moment()[_0x06bf('0x5e')](_0x06bf('0x5f'));_0x4525bd[_0x06bf('0x58')][_0x06bf('0x60')]=_0x4525bd[_0x06bf('0x58')][_0x06bf('0x60')]||_0x4525bd[_0x06bf('0x61')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x4525bd[_0x06bf('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x06bf('0x62')}]})[_0x06bf('0x1e')](handleEntityNotFound(_0x4bfb70,null))[_0x06bf('0x1e')](saveUpdates(_0x4525bd['body'],null))[_0x06bf('0x1e')](function(_0x2afc5f){if(_0x2afc5f){_0x3460d7[_0x06bf('0x27')]=_0x2afc5f[_0x06bf('0x63')]({'plain':!![]});return db[_0x06bf('0x64')][_0x06bf('0x59')]({'where':{'id':_0x2afc5f[_0x06bf('0x65')]}});}return null;})[_0x06bf('0x1e')](handleEntityNotFound(_0x4bfb70,null))[_0x06bf('0x1e')](function(_0x33b0ef){if(_0x33b0ef){return _0x33b0ef['update']({'UserId':_0x4525bd[_0x06bf('0x58')]['UserId'],'read1stAt':_['isNil'](_0x33b0ef['read1stAt'])?moment()[_0x06bf('0x5e')](_0x06bf('0x5f')):undefined});}return null;})[_0x06bf('0x1e')](function(_0x466310){if(_0x466310){_0x3460d7[_0x06bf('0x66')]=_0x466310[_0x06bf('0x63')]({'plain':!![]});interaction_log[_0x06bf('0x1f')](_0x06bf('0x67'),_0x4525bd[_0x06bf('0x61')]['id'],_0x4525bd[_0x06bf('0x61')]['name'],_0x4525bd[_0x06bf('0x61')]['role'],_0x3460d7['interaction']['id'],_0x4525bd[_0x06bf('0x58')]?JSON[_0x06bf('0x24')](_0x4525bd[_0x06bf('0x58')]):_0x06bf('0x68'));return respondWithRpcPromise(_0x06bf('0x69'),_0x06bf('0x6a'),_0x3460d7);}return null;})[_0x06bf('0x1e')](function(_0x3277b6){if(_0x3277b6){if(_0x4525bd[_0x06bf('0x58')][_0x06bf('0x6b')]){_0x3460d7[_0x06bf('0x27')]['interface']=util['format'](_0x06bf('0x6c'),_0x4525bd['user'][_0x06bf('0x38')]);_0x3460d7[_0x06bf('0x27')][_0x06bf('0x6d')]=_0x3460d7[_0x06bf('0x6d')];_0x3460d7[_0x06bf('0x27')][_0x06bf('0x6e')]='accept';return respondWithRpcPromise(_0x06bf('0x6f'),_0x06bf('0x6f'),{'event':_0x06bf('0x70'),'message':_0x3460d7[_0x06bf('0x27')]},client9002)['then'](function(){return _0x3460d7;});}return _0x3460d7;}return null;})[_0x06bf('0x1e')](respondWithResult(_0x4bfb70,null))['catch'](handleError(_0x4bfb70,null));};var interaction_log=require(_0x06bf('0x12'))(_0x06bf('0x71'));exports[_0x06bf('0x33')]=function(_0x5296a0,_0x574004,_0x181862){var _0x48052b={'agent':{},'channel':_0x06bf('0x5b')};if(_0x5296a0[_0x06bf('0x58')]['id']){delete _0x5296a0['body']['id'];}_0x5296a0[_0x06bf('0x58')][_0x06bf('0x60')]=_0x5296a0[_0x06bf('0x58')][_0x06bf('0x60')]||_0x5296a0['user']['id'];_0x48052b['agent']['id']=_0x5296a0[_0x06bf('0x58')][_0x06bf('0x60')];return db[_0x06bf('0x51')][_0x06bf('0x59')]({'where':{'id':_0x5296a0['params']['id'],'UserId':null}})[_0x06bf('0x1e')](handleEntityNotFound(_0x574004,null))['then'](function(_0x406541){if(_0x406541){_0x48052b[_0x06bf('0x27')]=_0x406541[_0x06bf('0x63')]({'plain':!![]});return db[_0x06bf('0x64')][_0x06bf('0x59')]({'where':{'id':_0x406541[_0x06bf('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x574004,null))[_0x06bf('0x1e')](function(_0x263119){if(_0x263119){_0x48052b[_0x06bf('0x66')]=_0x263119[_0x06bf('0x63')]({'plain':!![]});interaction_log[_0x06bf('0x1f')](_0x06bf('0x72'),_0x5296a0['user']['id'],_0x5296a0[_0x06bf('0x61')][_0x06bf('0x38')],_0x5296a0[_0x06bf('0x61')]['role'],_0x48052b[_0x06bf('0x66')]['id'],_0x5296a0['body']?JSON[_0x06bf('0x24')](_0x5296a0[_0x06bf('0x58')]):_0x06bf('0x68'));return respondWithRpcPromise('RejectMessage',_0x06bf('0x73'),_0x48052b);}return null;})[_0x06bf('0x1e')](function(_0x1d0a4e){if(_0x1d0a4e){_0x1d0a4e['message'][_0x06bf('0x74')]=util[_0x06bf('0x5e')](_0x06bf('0x6c'),_0x5296a0[_0x06bf('0x61')]['name']);_0x1d0a4e['message']['channel']=_0x48052b[_0x06bf('0x6d')];_0x1d0a4e[_0x06bf('0x27')]['event']=_0x06bf('0x33');respondWithRpcPromise('EventManager',_0x06bf('0x6f'),{'event':_0x06bf('0x75'),'message':_0x1d0a4e[_0x06bf('0x27')]},client9002);return _0x48052b;}return null;})[_0x06bf('0x1e')](respondWithResult(_0x574004,null))[_0x06bf('0x29')](handleError(_0x574004,null));};exports[_0x06bf('0x2b')]=function(_0x344652,_0x2736f3,_0x3076b5){if(_0x344652['body']['id']){delete _0x344652[_0x06bf('0x58')]['id'];}var _0x221bdf;return db[_0x06bf('0x51')][_0x06bf('0x59')]({'where':{'id':_0x344652[_0x06bf('0x56')]['id']}})[_0x06bf('0x1e')](handleEntityNotFound(_0x2736f3,null))[_0x06bf('0x1e')](function(_0x556d45){if(_0x556d45){_0x221bdf=_0x556d45;return db['SmsAccount'][_0x06bf('0x59')]({'where':{'id':_0x556d45['SmsAccountId']}});}})[_0x06bf('0x1e')](handleEntityNotFound(_0x2736f3,null))[_0x06bf('0x1e')](function(_0x55ec98){if(_0x55ec98){logger[_0x06bf('0x21')](_0x06bf('0x22'),_0x06bf('0x2b'),'received\x20delivery\x20report\x20from',_0x55ec98[_0x06bf('0x4e')],util[_0x06bf('0x76')](_0x344652[_0x06bf('0x58')],{'showHidden':![],'depth':null}));switch(_0x55ec98[_0x06bf('0x4e')]){case _0x06bf('0x77'):if(_0x344652['body'][_0x06bf('0x78')]&&_0x344652[_0x06bf('0x58')]['MessageSid']===_0x221bdf[_0x06bf('0x79')]){return _0x221bdf[_0x06bf('0x35')]({'read':!![]});}else{logger[_0x06bf('0x25')](_0x06bf('0x7a'),_0x06bf('0x2b'),'twilio',util[_0x06bf('0x76')](_0x344652['body'],{'showHidden':![],'depth':null}));}break;case _0x06bf('0x7b'):if(_0x344652[_0x06bf('0x58')]['MessageUUID']&&_0x344652[_0x06bf('0x58')]['MessageUUID']===_0x221bdf['messageId']&&_[_0x06bf('0x7c')](['sent',_0x06bf('0x7d')],_0x344652['body'][_0x06bf('0x7e')])>=0x0){return _0x221bdf[_0x06bf('0x35')]({'read':!![]});}else{logger[_0x06bf('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x06bf('0x2b'),_0x06bf('0x7f'),util[_0x06bf('0x76')](_0x344652[_0x06bf('0x58')],{'showHidden':![],'depth':null}));}break;case _0x06bf('0x80'):var _0x5b918f=_0x344652[_0x06bf('0x58')][_0x06bf('0x81')][0x0];if(_0x5b918f[_0x06bf('0x2b')]['groupName']===_0x06bf('0x82')){return _0x221bdf[_0x06bf('0x35')]({'read':!![]});}else{logger[_0x06bf('0x25')](_0x06bf('0x7a'),_0x06bf('0x2b'),_0x06bf('0x80'),util[_0x06bf('0x76')](_0x344652['body'],{'showHidden':![],'depth':null}));}break;}return _0x221bdf;}})[_0x06bf('0x1e')](respondWithResult(_0x2736f3,null))[_0x06bf('0x29')](handleError(_0x2736f3,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 66a579b..13f32c4 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 _0x79b6=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x207d4e,_0x5158dc){var _0x24b6f4=function(_0x96ce36){while(--_0x96ce36){_0x207d4e['push'](_0x207d4e['shift']());}};_0x24b6f4(++_0x5158dc);}(_0x79b6,0xd6));var _0x679b=function(_0x50a1a9,_0xd1fbe7){_0x50a1a9=_0x50a1a9-0x0;var _0x535056=_0x79b6[_0x50a1a9];return _0x535056;};'use strict';var EventEmitter=require(_0x679b('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x679b('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x679b('0x2')](0x0);var events={'afterCreate':_0x679b('0x3'),'afterUpdate':_0x679b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b55c5){return function(_0x2cf023,_0x27eee6,_0x3ca0c0){SmsMessageEvents['emit'](_0x2b55c5+':'+_0x2cf023['id'],_0x2cf023);SmsMessageEvents[_0x679b('0x5')](_0x2b55c5,_0x2cf023);_0x3ca0c0(null);};}for(var e in events){if(events[_0x679b('0x6')](e)){var event=events[e];SmsMessage[_0x679b('0x7')](e,emitEvent(event));}}module[_0x679b('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xd961=['../../mysqldb','SmsMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd961,0xf9));var _0x1d96=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0xd961[_0x3ae2b2];return _0x1dbf00;};'use strict';var EventEmitter=require(_0x1d96('0x0'));var SmsMessage=require(_0x1d96('0x1'))['db'][_0x1d96('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1d96('0x3'),'afterUpdate':_0x1d96('0x4'),'afterDestroy':_0x1d96('0x5')};function emitEvent(_0xdff703){return function(_0x229b0b,_0x4f251a,_0x597c41){SmsMessageEvents[_0x1d96('0x6')](_0xdff703+':'+_0x229b0b['id'],_0x229b0b);SmsMessageEvents['emit'](_0xdff703,_0x229b0b);_0x597c41(null);};}for(var e in events){if(events[_0x1d96('0x7')](e)){var event=events[e];SmsMessage[_0x1d96('0x8')](e,emitEvent(event));}}module[_0x1d96('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 41c2eac..5c5f160 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 _0x2f0f=['login','timestamp','sort','createHash','md5','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','SmsInteractionId','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','messages','create','phone','remote','/api/sms/messages/','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','body','smsMethod','login?username=','&password=','password','then','split','sms','POST','user_key','total_sent','internal_order_id','read','afterCreate','Missing\x20parameters:\x20username,\x20password','senderString','authToken','https://smsapi.connectel.se/api/v2/send/','deliveryReport','connectel','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','base64','http_code','data','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','baseUrl','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey'];(function(_0x244f2c,_0x478ac9){var _0x1f1b7e=function(_0xd8ef0){while(--_0xd8ef0){_0x244f2c['push'](_0x244f2c['shift']());}};_0x1f1b7e(++_0x478ac9);}(_0x2f0f,0x10b));var _0xf2f0=function(_0x19903c,_0x5192e4){_0x19903c=_0x19903c-0x0;var _0x222a6c=_0x2f0f[_0x19903c];return _0x222a6c;};'use strict';var _=require('lodash');var util=require(_0xf2f0('0x0'));var logger=require(_0xf2f0('0x1'))(_0xf2f0('0x2'));var moment=require(_0xf2f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2f0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2f0('0x5'));var config=require(_0xf2f0('0x6'));var attributes=require(_0xf2f0('0x7'));module['exports']=function(_0x3046cf,_0x1a38bb){return _0x3046cf[_0xf2f0('0x8')](_0xf2f0('0x9'),attributes,{'tableName':_0xf2f0('0xa'),'paranoid':![],'indexes':[{'name':_0xf2f0('0xb'),'fields':[_0xf2f0('0xb')]},{'name':_0xf2f0('0xc'),'fields':['body'],'type':_0xf2f0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5847b6,_0x183716,_0xfab420){var _0xc3d4b=_0x3046cf[_0xf2f0('0xe')];var _0x3f2e5d=_0x5847b6[_0xf2f0('0xf')]({'plain':!![]});if(_0x3f2e5d[_0xf2f0('0x10')][_0xf2f0('0x11')]()==='in'||_0x3f2e5d[_0xf2f0('0x10')][_0xf2f0('0x11')]()===_0xf2f0('0x12')&&!_0x3f2e5d[_0xf2f0('0x13')]&&!_['isNil'](_0x3f2e5d[_0xf2f0('0x14')])){_0xc3d4b['SmsInteraction'][_0xf2f0('0x15')]({'where':{'id':_0x3f2e5d[_0xf2f0('0x16')]}})['then'](function(_0x47e1b7){if(_0x47e1b7){_0x47e1b7['update']({'lastMsgAt':_0x3f2e5d[_0xf2f0('0x17')],'lastMsgDirection':_0x3f2e5d[_0xf2f0('0x10')][_0xf2f0('0x11')]()});}})[_0xf2f0('0x18')](function(_0x52b9b4){console[_0xf2f0('0x19')](_0x52b9b4);});}if(_0x3f2e5d[_0xf2f0('0x10')]===_0xf2f0('0x12')&&!_0x3f2e5d['secret']){var _0x36d0db;_0xc3d4b['SmsAccount'][_0xf2f0('0x1a')]({'where':{'id':_0x3f2e5d[_0xf2f0('0x1b')]},'raw':!![]})['then'](function(_0x514bd1){_0x36d0db=_0x514bd1;if(_0x36d0db&&_0x36d0db[_0xf2f0('0x1c')]){switch(_0x36d0db[_0xf2f0('0x1c')]){case _0xf2f0('0x1d'):var _0x21faec=require('twilio');if(_0x36d0db[_0xf2f0('0x1e')]&&_0x36d0db['authToken']&&_0x36d0db['phone']){var _0x5aa287=new _0x21faec(_0x36d0db['accountSid'],_0x36d0db['authToken']);_0x5aa287[_0xf2f0('0x1f')][_0xf2f0('0x20')]({'body':_0x3f2e5d['body'],'to':_0x3f2e5d[_0xf2f0('0x21')],'from':_0x36d0db[_0xf2f0('0x21')],'statusCallback':_0x36d0db[_0xf2f0('0x22')]+_0xf2f0('0x23')+_0x3f2e5d['id']+_0xf2f0('0x24')+_0x36d0db['token']})['then'](function(_0x5c67c7){if(_0x5c67c7[_0xf2f0('0x25')]){return _0x5847b6[_0xf2f0('0x26')]({'messageId':_0x5c67c7['sid']});}})[_0xf2f0('0x18')](function(_0x4da7c4){logger[_0xf2f0('0x19')](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x1d'),util[_0xf2f0('0x28')](_0x4da7c4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x1d'),_0xf2f0('0x29'));}break;case _0xf2f0('0x2a'):var _0x2809d2=_0xf2f0('0x2b');if(_0x36d0db[_0xf2f0('0x2c')]&&_0x36d0db['password']){var _0x418fb5={'recipient':[_0x3f2e5d[_0xf2f0('0x21')]],'message':_0x3f2e5d[_0xf2f0('0x2d')],'message_type':_0x36d0db[_0xf2f0('0x2e')]};if(_0x36d0db['smsMethod']&&_0x36d0db[_0xf2f0('0x2e')]!=='SI'){_0x418fb5['sender']=_0x36d0db['phone'];}var _0x2dcbd0={'url':_0x2809d2+_0xf2f0('0x2f')+_0x36d0db[_0xf2f0('0x2c')]+_0xf2f0('0x30')+_0x36d0db[_0xf2f0('0x31')],'method':'GET'};rp(_0x2dcbd0)[_0xf2f0('0x32')](function(_0x415d02){var _0x2fac70=_0x415d02[_0xf2f0('0x33')](';');var _0xc32c16={'user_key':_0x2fac70[0x0],'session_key':_0x2fac70[0x1]};_0x2dcbd0={'url':_0x2809d2+_0xf2f0('0x34'),'method':_0xf2f0('0x35'),'headers':{'user_key':_0xc32c16[_0xf2f0('0x36')],'Session_key':_0xc32c16['session_key']},'json':!![],'body':_0x418fb5};return rp(_0x2dcbd0);})[_0xf2f0('0x32')](function(_0x10f5da){if(_0x10f5da[_0xf2f0('0x37')]>=0x1){var _0x3246a8={'messageId':_0x10f5da[_0xf2f0('0x38')]};if(_0x36d0db[_0xf2f0('0x2e')]!=='GP'||!_0x36d0db['deliveryReport']){_0x3246a8[_0xf2f0('0x39')]=!![];}return _0x5847b6['update'](_0x3246a8);}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'skebby',util[_0xf2f0('0x28')](_0x10f5da,{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0xec9b5a){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x2a'),util[_0xf2f0('0x28')](_0xec9b5a,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf2f0('0x3a'),_0xf2f0('0x2a'),_0xf2f0('0x3b'));}break;case'connectel':if(_0x36d0db['authToken']){var _0x23fb85={'recipient':_0x3f2e5d[_0xf2f0('0x21')],'message':_0x3f2e5d['body'],'sender':_0x36d0db[_0xf2f0('0x3c')]||_0x36d0db[_0xf2f0('0x21')],'authorization':_0x36d0db[_0xf2f0('0x3d')]};var _0x183716={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x3e'),'body':_0x23fb85,'json':!![]};rp(_0x183716)['then'](function(_0x5dfef5){var _0x45682e={'messageId':_0x5dfef5['requestid']};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x45682e[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x45682e);})[_0xf2f0('0x18')](function(_0x1c35ac){logger[_0xf2f0('0x19')](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x40'),util[_0xf2f0('0x28')](_0x1c35ac,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0xf2f0('0x41'):if(_0x36d0db[_0xf2f0('0x2c')]&&_0x36d0db[_0xf2f0('0x31')]){var _0x23fb85={'messages':[{'source':_0xf2f0('0x42'),'to':_0x3f2e5d[_0xf2f0('0x21')],'body':_0x3f2e5d[_0xf2f0('0x2d')],'from':_0x36d0db[_0xf2f0('0x3c')]||_0x36d0db[_0xf2f0('0x21')]}]};var _0x1e8b02=util['format'](_0xf2f0('0x43'),_0x36d0db[_0xf2f0('0x2c')],_0x36d0db[_0xf2f0('0x31')]);var _0x183716={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x44'),'body':_0x23fb85,'headers':{'Authorization':util[_0xf2f0('0x45')](_0xf2f0('0x46'),new Buffer(_0x1e8b02)['toString'](_0xf2f0('0x47')))},'json':!![]};rp(_0x183716)[_0xf2f0('0x32')](function(_0x386b50){if(_0x386b50[_0xf2f0('0x48')]>=0xc8&&_0x386b50['http_code']<=0xce){if(_0x386b50[_0xf2f0('0x49')]&&_0x386b50[_0xf2f0('0x49')]['queued_count']>0x0){var _0x5502bb=_['head'](_0x386b50['data'][_0xf2f0('0x1f')]);var _0x329bcc={'messageId':_0x5502bb[_0xf2f0('0x4a')]};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x329bcc[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x329bcc);}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x4b'),util['inspect'](_0x386b50,{'showHidden':![],'depth':null}));}}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'clickSend',util[_0xf2f0('0x28')](_0x386b50,{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x5885d1){logger[_0xf2f0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf2f0('0x4b'),util[_0xf2f0('0x28')](_0x5885d1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x4b'),_0xf2f0('0x3b'));}break;case _0xf2f0('0x4c'):if(_0x36d0db[_0xf2f0('0x4d')]&&_0x36d0db[_0xf2f0('0x3d')]){var _0x23fb85={'dst':_0x3f2e5d[_0xf2f0('0x21')],'text':_0x3f2e5d[_0xf2f0('0x2d')],'src':_0x36d0db[_0xf2f0('0x3c')]||_0x36d0db[_0xf2f0('0x21')],'url':_0x36d0db[_0xf2f0('0x22')]+'/api/sms/messages/'+_0x3f2e5d['id']+_0xf2f0('0x24')+_0x36d0db[_0xf2f0('0x4e')]};var _0x1e8b02=util['format'](_0xf2f0('0x43'),_0x36d0db[_0xf2f0('0x4d')],_0x36d0db['authToken']);var _0x183716={'method':_0xf2f0('0x35'),'uri':util[_0xf2f0('0x45')](_0xf2f0('0x4f'),_0x36d0db[_0xf2f0('0x4d')]),'body':_0x23fb85,'headers':{'Authorization':util[_0xf2f0('0x45')](_0xf2f0('0x46'),new Buffer(_0x1e8b02)[_0xf2f0('0x50')](_0xf2f0('0x47')))},'json':!![]};rp(_0x183716)[_0xf2f0('0x32')](function(_0x1107d4){var _0x39e305={'messageId':_0x1107d4[_0xf2f0('0x51')][0x0]};return _0x5847b6[_0xf2f0('0x26')](_0x39e305);})[_0xf2f0('0x18')](function(_0x206a4e){logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x4c'),util[_0xf2f0('0x28')](_0x206a4e,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x36d0db['username']&&_0x36d0db[_0xf2f0('0x31')]){if(_0x36d0db[_0xf2f0('0x52')]){var _0x94e5a9={'method':'POST','uri':_0x36d0db['baseUrl']+'/auth/1/session','body':{'username':_0x36d0db['username'],'password':_0x36d0db[_0xf2f0('0x31')]},'json':!![]};return rp(_0x94e5a9)[_0xf2f0('0x32')](function(_0x2b7f66){var _0x357130={'method':'POST','uri':_0x36d0db[_0xf2f0('0x52')]+_0xf2f0('0x53'),'body':{'messages':[{'from':_0x36d0db[_0xf2f0('0x21')],'destinations':[{'to':_0x3f2e5d[_0xf2f0('0x21')]}],'text':_0x3f2e5d[_0xf2f0('0x2d')],'notifyUrl':_0x36d0db[_0xf2f0('0x22')]+_0xf2f0('0x23')+_0x3f2e5d['id']+_0xf2f0('0x24')+_0x36d0db['token'],'notifyContentType':'application/json','callbackData':_0x36d0db[_0xf2f0('0x21')]+';'+_0x3f2e5d[_0xf2f0('0x2d')]}]},'headers':{'Authorization':_0xf2f0('0x54')+_0x2b7f66[_0xf2f0('0x4e')]},'json':!![]};return rp(_0x357130)['then'](function(_0x171c01){if(_0x171c01['messages']){var _0x171eee={'messageId':_0x171c01[_0xf2f0('0x1f')][0x0]['messageId']};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x171eee[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x171eee);}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x55'),util[_0xf2f0('0x28')](_0x171c01,{'showHidden':![],'depth':null}));}});})[_0xf2f0('0x18')](function(_0x13f8bc){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x55'),util[_0xf2f0('0x28')](_0x13f8bc,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x55'),_0xf2f0('0x56'));}}else{logger['error'](_0xf2f0('0x27'),'afterCreate','infobip',_0xf2f0('0x3b'));}break;case _0xf2f0('0x57'):var _0x4c9e92=require(_0xf2f0('0x58'));if(_0x36d0db[_0xf2f0('0x59')]){var _0x46ea10={};_0x46ea10[_0xf2f0('0x5a')]=_0x36d0db[_0xf2f0('0x2c')];_0x46ea10['phone']=_0x3f2e5d['phone'];_0x46ea10['sender']=_0x36d0db[_0xf2f0('0x21')];_0x46ea10['text']=_0x3f2e5d[_0xf2f0('0x2d')];_0x46ea10[_0xf2f0('0x5b')]=+new Date();var _0x14cb2c='';var _0x4bc52e='';var _0xe25395=Object['keys'](_0x46ea10);_0xe25395[_0xf2f0('0x5c')]();for(var _0x4d88f2=0x0;_0x4d88f2<_0xe25395['length'];_0x4d88f2++){if(_0x14cb2c!=''){_0x14cb2c+='&';}_0x14cb2c+=_0xe25395[_0x4d88f2]+'='+encodeURIComponent(_0x46ea10[_0xe25395[_0x4d88f2]]);_0x4bc52e+=_0x46ea10[_0xe25395[_0x4d88f2]];}_0x4bc52e+=_0x36d0db[_0xf2f0('0x59')];_0x4bc52e=_0x4c9e92[_0xf2f0('0x5d')](_0xf2f0('0x5e'))[_0xf2f0('0x26')](_0x4bc52e)[_0xf2f0('0x5f')](_0xf2f0('0x60'));if(_0x14cb2c!==''){_0x14cb2c+='&';}_0x14cb2c+=_0xf2f0('0x61')+_0x4bc52e;var _0x2dcbd0={'method':'GET','uri':_0x36d0db[_0xf2f0('0x52')]+'/external/get/send.php?'+_0x14cb2c,'json':!![]};return rp(_0x2dcbd0)[_0xf2f0('0x32')](function(_0x19ae1e){var _0x179b3b=Object[_0xf2f0('0x62')](_0x19ae1e);if(_0x19ae1e[_0x179b3b[0x0]][_0xf2f0('0x19')]&&parseInt(_0x19ae1e[_0x179b3b[0x0]][_0xf2f0('0x19')])===0x0){var _0x4b6493={'messageId':_0x19ae1e[_0x179b3b[0x0]][_0xf2f0('0x63')]};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x4b6493[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x4b6493);}else{return logger[_0xf2f0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf2f0('0x3a'),_0xf2f0('0x57'),util[_0xf2f0('0x28')](_0x19ae1e[_0xf2f0('0x19')],{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x11f6bb){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x57'),util[_0xf2f0('0x28')](_0x11f6bb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf2f0('0x27'),'afterCreate','csc',_0xf2f0('0x64'));}break;case _0xf2f0('0x65'):if(_0x36d0db[_0xf2f0('0x59')]){var _0x2091a6={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x66'),'headers':{'Authorization':_0x36d0db[_0xf2f0('0x59')]},'body':{'content':_0x3f2e5d[_0xf2f0('0x2d')],'to':[_0x3f2e5d[_0xf2f0('0x21')]],'from':_0x36d0db['phone'],'binary':![],'clientMessageId':_0xf2f0('0x67'),'charset':_0xf2f0('0x68')},'json':!![]};rp(_0x2091a6)[_0xf2f0('0x32')](function(_0x4ff493){if(!_0x4ff493[_0xf2f0('0x19')]){var _0x34cc75={'messageId':_0x4ff493[_0xf2f0('0x1f')][0x0][_0xf2f0('0x69')]};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x34cc75[_0xf2f0('0x39')]=!![];}return _0x5847b6['update'](_0x34cc75);}else{return logger['error'](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x65'),util[_0xf2f0('0x28')](_0x4ff493[_0xf2f0('0x19')],{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x444660){return logger['error'](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x65'),util[_0xf2f0('0x28')](_0x444660,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0xf2f0('0x6a'):if(_0x36d0db['apiKey']){var _0x3720b2={};var _0x2dcbd0={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x6b'),'headers':{'Authorization':_0xf2f0('0x6c')+_0x36d0db['apiKey'],'Content-Type':_0xf2f0('0x6d')},'body':{'from':_0x36d0db[_0xf2f0('0x21')],'to':_0x3f2e5d['phone'],'text':_0x3f2e5d[_0xf2f0('0x2d')]},'json':!![]};return rp(_0x2dcbd0)['then'](function(_0x51e6fc){if(_0x51e6fc[_0xf2f0('0x6e')]==0xca){_0x3720b2[_0xf2f0('0x6f')]=_0x51e6fc;var _0x48bee1={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x70'),'headers':{'Authorization':_0xf2f0('0x6c')+_0x36d0db['apiKey'],'Content-Type':_0xf2f0('0x6d')},'body':{'refid':_0x3720b2['message'][_0xf2f0('0x71')]},'json':!![]};return rp(_0x48bee1)[_0xf2f0('0x32')](function(_0x58a8d3){_0x3720b2[_0xf2f0('0x72')]=_0x58a8d3;var _0x2d623e={'messageId':_0x3720b2['message'][_0xf2f0('0x71')],'read':!![]};return _0x5847b6[_0xf2f0('0x26')](_0x2d623e);});}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'intelepeer',util[_0xf2f0('0x28')](_0x51e6fc,{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x58d595){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),'afterCreate','intelepeer',util[_0xf2f0('0x28')](_0x58d595,{'showHidden':![],'depth':null}));});}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'intelepeer',_0xf2f0('0x73'));}break;}}})[_0xf2f0('0x74')](function(){_0xfab420();});}else{_0xfab420();}}},'charset':_0xf2f0('0x75'),'collate':_0xf2f0('0x76')});}; \ No newline at end of file +var _0x615d=['POST','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','deliveryReport','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','messages','message_id','clickSend','plivo','/status?token=','authId','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','login','timestamp','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','finally','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','update','createdAt','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','password','GET','split','sms'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0x615d,0xad));var _0xd615=function(_0x2b63a0,_0x14fc48){_0x2b63a0=_0x2b63a0-0x0;var _0x4f0434=_0x615d[_0x2b63a0];return _0x4f0434;};'use strict';var _=require(_0xd615('0x0'));var util=require(_0xd615('0x1'));var logger=require('../../config/logger')(_0xd615('0x2'));var moment=require(_0xd615('0x3'));var BPromise=require(_0xd615('0x4'));var rp=require(_0xd615('0x5'));var fs=require('fs');var path=require(_0xd615('0x6'));var rimraf=require('rimraf');var config=require(_0xd615('0x7'));var attributes=require(_0xd615('0x8'));module[_0xd615('0x9')]=function(_0x29fdf4,_0x28a235){return _0x29fdf4[_0xd615('0xa')]('SmsMessage',attributes,{'tableName':_0xd615('0xb'),'paranoid':![],'indexes':[{'name':_0xd615('0xc'),'fields':[_0xd615('0xc')]},{'name':_0xd615('0xd'),'fields':[_0xd615('0xe')],'type':_0xd615('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bddb5,_0x4e85b1,_0x49284f){var _0x1220c7=_0x29fdf4[_0xd615('0x10')];var _0x2786fa=_0x5bddb5['get']({'plain':!![]});if(_0x2786fa[_0xd615('0x11')][_0xd615('0x12')]()==='in'||_0x2786fa[_0xd615('0x11')]['toLowerCase']()===_0xd615('0x13')&&!_0x2786fa[_0xd615('0x14')]&&!_[_0xd615('0x15')](_0x2786fa[_0xd615('0x16')])){_0x1220c7['SmsInteraction'][_0xd615('0x17')]({'where':{'id':_0x2786fa[_0xd615('0x18')]}})['then'](function(_0x57278b){if(_0x57278b){_0x57278b[_0xd615('0x19')]({'lastMsgAt':_0x2786fa[_0xd615('0x1a')],'lastMsgDirection':_0x2786fa[_0xd615('0x11')][_0xd615('0x12')]()});}})['catch'](function(_0x680003){console['error'](_0x680003);});}if(_0x2786fa['direction']===_0xd615('0x13')&&!_0x2786fa['secret']){var _0x56b8ba;_0x1220c7[_0xd615('0x1b')][_0xd615('0x1c')]({'where':{'id':_0x2786fa[_0xd615('0x1d')]},'raw':!![]})[_0xd615('0x1e')](function(_0x5e210a){_0x56b8ba=_0x5e210a;if(_0x56b8ba&&_0x56b8ba[_0xd615('0x1f')]){switch(_0x56b8ba['type']){case _0xd615('0x20'):var _0x25f5e8=require('twilio');if(_0x56b8ba[_0xd615('0x21')]&&_0x56b8ba[_0xd615('0x22')]&&_0x56b8ba[_0xd615('0x23')]){var _0x503e4c=new _0x25f5e8(_0x56b8ba[_0xd615('0x21')],_0x56b8ba['authToken']);_0x503e4c['messages'][_0xd615('0x24')]({'body':_0x2786fa[_0xd615('0xe')],'to':_0x2786fa[_0xd615('0x23')],'from':_0x56b8ba['phone'],'statusCallback':_0x56b8ba[_0xd615('0x25')]+_0xd615('0x26')+_0x2786fa['id']+'/status?token='+_0x56b8ba[_0xd615('0x27')]})[_0xd615('0x1e')](function(_0x3dd25c){if(_0x3dd25c['sid']){return _0x5bddb5[_0xd615('0x19')]({'messageId':_0x3dd25c[_0xd615('0x28')]});}})[_0xd615('0x29')](function(_0x3eda6a){logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x20'),util[_0xd615('0x2d')](_0x3eda6a,{'showHidden':![],'depth':null}));});}else{logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x20'),_0xd615('0x2e'));}break;case _0xd615('0x2f'):var _0x1d43d2=_0xd615('0x30');if(_0x56b8ba[_0xd615('0x31')]&&_0x56b8ba['password']){var _0x58bd00={'recipient':[_0x2786fa[_0xd615('0x23')]],'message':_0x2786fa[_0xd615('0xe')],'message_type':_0x56b8ba[_0xd615('0x32')]};if(_0x56b8ba[_0xd615('0x32')]&&_0x56b8ba[_0xd615('0x32')]!=='SI'){_0x58bd00[_0xd615('0x33')]=_0x56b8ba[_0xd615('0x23')];}var _0x3f2fd6={'url':_0x1d43d2+_0xd615('0x34')+_0x56b8ba[_0xd615('0x31')]+'&password='+_0x56b8ba[_0xd615('0x35')],'method':_0xd615('0x36')};rp(_0x3f2fd6)[_0xd615('0x1e')](function(_0xdd08c5){var _0x2d0c68=_0xdd08c5[_0xd615('0x37')](';');var _0x33d4ab={'user_key':_0x2d0c68[0x0],'session_key':_0x2d0c68[0x1]};_0x3f2fd6={'url':_0x1d43d2+_0xd615('0x38'),'method':_0xd615('0x39'),'headers':{'user_key':_0x33d4ab[_0xd615('0x3a')],'Session_key':_0x33d4ab[_0xd615('0x3b')]},'json':!![],'body':_0x58bd00};return rp(_0x3f2fd6);})[_0xd615('0x1e')](function(_0x14a4fd){if(_0x14a4fd[_0xd615('0x3c')]>=0x1){var _0x50afcd={'messageId':_0x14a4fd[_0xd615('0x3d')]};if(_0x56b8ba['smsMethod']!=='GP'||!_0x56b8ba['deliveryReport']){_0x50afcd[_0xd615('0x3e')]=!![];}return _0x5bddb5[_0xd615('0x19')](_0x50afcd);}else{return logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),'skebby',util[_0xd615('0x2d')](_0x14a4fd,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5a9e59){return logger[_0xd615('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd615('0x2c'),_0xd615('0x2f'),util[_0xd615('0x2d')](_0x5a9e59,{'showHidden':![],'depth':null}));});}else{logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),'skebby',_0xd615('0x3f'));}break;case _0xd615('0x40'):if(_0x56b8ba[_0xd615('0x22')]){var _0x245233={'recipient':_0x2786fa['phone'],'message':_0x2786fa[_0xd615('0xe')],'sender':_0x56b8ba[_0xd615('0x41')]||_0x56b8ba[_0xd615('0x23')],'authorization':_0x56b8ba[_0xd615('0x22')]};var _0x4e85b1={'method':_0xd615('0x39'),'uri':_0xd615('0x42'),'body':_0x245233,'json':!![]};rp(_0x4e85b1)['then'](function(_0x27e3a9){var _0x257760={'messageId':_0x27e3a9['requestid']};if(!_0x56b8ba[_0xd615('0x43')]){_0x257760[_0xd615('0x3e')]=!![];}return _0x5bddb5[_0xd615('0x19')](_0x257760);})[_0xd615('0x29')](function(_0xc01174){logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x40'),util[_0xd615('0x2d')](_0xc01174,{'showHidden':![],'depth':null}));});}else{logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x40'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x56b8ba[_0xd615('0x31')]&&_0x56b8ba[_0xd615('0x35')]){var _0x245233={'messages':[{'source':'xCALLY\x20Motion','to':_0x2786fa[_0xd615('0x23')],'body':_0x2786fa[_0xd615('0xe')],'from':_0x56b8ba[_0xd615('0x41')]||_0x56b8ba['phone']}]};var _0x183ffa=util[_0xd615('0x44')](_0xd615('0x45'),_0x56b8ba[_0xd615('0x31')],_0x56b8ba[_0xd615('0x35')]);var _0x4e85b1={'method':_0xd615('0x39'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x245233,'headers':{'Authorization':util[_0xd615('0x44')](_0xd615('0x46'),new Buffer(_0x183ffa)[_0xd615('0x47')](_0xd615('0x48')))},'json':!![]};rp(_0x4e85b1)[_0xd615('0x1e')](function(_0x3177d7){if(_0x3177d7[_0xd615('0x49')]>=0xc8&&_0x3177d7[_0xd615('0x49')]<=0xce){if(_0x3177d7[_0xd615('0x4a')]&&_0x3177d7[_0xd615('0x4a')]['queued_count']>0x0){var _0x4a15e5=_['head'](_0x3177d7[_0xd615('0x4a')][_0xd615('0x4b')]);var _0x28fa96={'messageId':_0x4a15e5[_0xd615('0x4c')]};if(!_0x56b8ba['deliveryReport']){_0x28fa96[_0xd615('0x3e')]=!![];}return _0x5bddb5[_0xd615('0x19')](_0x28fa96);}else{logger[_0xd615('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd615('0x4d'),util['inspect'](_0x3177d7,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xd615('0x2b'),_0xd615('0x2c'),'clickSend',util[_0xd615('0x2d')](_0x3177d7,{'showHidden':![],'depth':null}));}})[_0xd615('0x29')](function(_0x177249){logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x4d'),util[_0xd615('0x2d')](_0x177249,{'showHidden':![],'depth':null}));});}else{logger[_0xd615('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd615('0x2c'),_0xd615('0x4d'),_0xd615('0x3f'));}break;case _0xd615('0x4e'):if(_0x56b8ba['authId']&&_0x56b8ba['authToken']){var _0x245233={'dst':_0x2786fa[_0xd615('0x23')],'text':_0x2786fa[_0xd615('0xe')],'src':_0x56b8ba[_0xd615('0x41')]||_0x56b8ba[_0xd615('0x23')],'url':_0x56b8ba[_0xd615('0x25')]+_0xd615('0x26')+_0x2786fa['id']+_0xd615('0x4f')+_0x56b8ba[_0xd615('0x27')]};var _0x183ffa=util[_0xd615('0x44')]('%s:%s',_0x56b8ba['authId'],_0x56b8ba[_0xd615('0x22')]);var _0x4e85b1={'method':_0xd615('0x39'),'uri':util[_0xd615('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x56b8ba[_0xd615('0x50')]),'body':_0x245233,'headers':{'Authorization':util[_0xd615('0x44')](_0xd615('0x46'),new Buffer(_0x183ffa)[_0xd615('0x47')](_0xd615('0x48')))},'json':!![]};rp(_0x4e85b1)[_0xd615('0x1e')](function(_0x5d80e5){var _0x3b6c8c={'messageId':_0x5d80e5['message_uuid'][0x0]};return _0x5bddb5[_0xd615('0x19')](_0x3b6c8c);})[_0xd615('0x29')](function(_0x1081e0){logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x4e'),util[_0xd615('0x2d')](_0x1081e0,{'showHidden':![],'depth':null}));});}else{logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x56b8ba['username']&&_0x56b8ba['password']){if(_0x56b8ba['baseUrl']){var _0x2f0d47={'method':_0xd615('0x39'),'uri':_0x56b8ba[_0xd615('0x51')]+_0xd615('0x52'),'body':{'username':_0x56b8ba[_0xd615('0x31')],'password':_0x56b8ba['password']},'json':!![]};return rp(_0x2f0d47)[_0xd615('0x1e')](function(_0x2fb2d7){var _0x4d0a04={'method':_0xd615('0x39'),'uri':_0x56b8ba[_0xd615('0x51')]+_0xd615('0x53'),'body':{'messages':[{'from':_0x56b8ba[_0xd615('0x23')],'destinations':[{'to':_0x2786fa['phone']}],'text':_0x2786fa['body'],'notifyUrl':_0x56b8ba[_0xd615('0x25')]+_0xd615('0x26')+_0x2786fa['id']+_0xd615('0x4f')+_0x56b8ba[_0xd615('0x27')],'notifyContentType':_0xd615('0x54'),'callbackData':_0x56b8ba[_0xd615('0x23')]+';'+_0x2786fa[_0xd615('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2fb2d7['token']},'json':!![]};return rp(_0x4d0a04)[_0xd615('0x1e')](function(_0x51014c){if(_0x51014c['messages']){var _0x193ada={'messageId':_0x51014c[_0xd615('0x4b')][0x0][_0xd615('0xc')]};if(!_0x56b8ba[_0xd615('0x43')]){_0x193ada['read']=!![];}return _0x5bddb5[_0xd615('0x19')](_0x193ada);}else{return logger['error'](_0xd615('0x2b'),'afterCreate',_0xd615('0x55'),util[_0xd615('0x2d')](_0x51014c,{'showHidden':![],'depth':null}));}});})[_0xd615('0x29')](function(_0x380017){return logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),'infobip',util[_0xd615('0x2d')](_0x380017,{'showHidden':![],'depth':null}));});}else{logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),'infobip',_0xd615('0x56'));}}else{logger[_0xd615('0x2a')](_0xd615('0x2b'),'afterCreate','infobip',_0xd615('0x3f'));}break;case _0xd615('0x57'):var _0x21061d=require('crypto');if(_0x56b8ba[_0xd615('0x58')]){var _0x2775cc={};_0x2775cc[_0xd615('0x59')]=_0x56b8ba[_0xd615('0x31')];_0x2775cc[_0xd615('0x23')]=_0x2786fa[_0xd615('0x23')];_0x2775cc[_0xd615('0x33')]=_0x56b8ba[_0xd615('0x23')];_0x2775cc['text']=_0x2786fa['body'];_0x2775cc[_0xd615('0x5a')]=+new Date();var _0x323ec6='';var _0x545623='';var _0x8fedb9=Object['keys'](_0x2775cc);_0x8fedb9[_0xd615('0x5b')]();for(var _0x49c5df=0x0;_0x49c5df<_0x8fedb9[_0xd615('0x5c')];_0x49c5df++){if(_0x323ec6!=''){_0x323ec6+='&';}_0x323ec6+=_0x8fedb9[_0x49c5df]+'='+encodeURIComponent(_0x2775cc[_0x8fedb9[_0x49c5df]]);_0x545623+=_0x2775cc[_0x8fedb9[_0x49c5df]];}_0x545623+=_0x56b8ba[_0xd615('0x58')];_0x545623=_0x21061d[_0xd615('0x5d')](_0xd615('0x5e'))['update'](_0x545623)[_0xd615('0x5f')](_0xd615('0x60'));if(_0x323ec6!==''){_0x323ec6+='&';}_0x323ec6+=_0xd615('0x61')+_0x545623;var _0x3f2fd6={'method':_0xd615('0x36'),'uri':_0x56b8ba['baseUrl']+_0xd615('0x62')+_0x323ec6,'json':!![]};return rp(_0x3f2fd6)[_0xd615('0x1e')](function(_0x1d13d2){var _0x3a06b1=Object[_0xd615('0x63')](_0x1d13d2);if(_0x1d13d2[_0x3a06b1[0x0]]['error']&&parseInt(_0x1d13d2[_0x3a06b1[0x0]]['error'])===0x0){var _0x218363={'messageId':_0x1d13d2[_0x3a06b1[0x0]]['id_sms']};if(!_0x56b8ba[_0xd615('0x43')]){_0x218363[_0xd615('0x3e')]=!![];}return _0x5bddb5[_0xd615('0x19')](_0x218363);}else{return logger['error'](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x57'),util[_0xd615('0x2d')](_0x1d13d2[_0xd615('0x2a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x428d56){return logger['error'](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x57'),util['inspect'](_0x428d56,{'showHidden':![],'depth':null}));});}else{logger[_0xd615('0x2a')](_0xd615('0x2b'),'afterCreate','csc',_0xd615('0x64'));}break;case _0xd615('0x65'):if(_0x56b8ba[_0xd615('0x58')]){var _0x3d7fca={'method':_0xd615('0x39'),'uri':_0xd615('0x66'),'headers':{'Authorization':_0x56b8ba['apiKey']},'body':{'content':_0x2786fa['body'],'to':[_0x2786fa[_0xd615('0x23')]],'from':_0x56b8ba[_0xd615('0x23')],'binary':![],'clientMessageId':_0xd615('0x67'),'charset':_0xd615('0x68')},'json':!![]};rp(_0x3d7fca)[_0xd615('0x1e')](function(_0xecd046){if(!_0xecd046[_0xd615('0x2a')]){var _0x22fb1b={'messageId':_0xecd046['messages'][0x0][_0xd615('0x69')]};if(!_0x56b8ba[_0xd615('0x43')]){_0x22fb1b['read']=!![];}return _0x5bddb5[_0xd615('0x19')](_0x22fb1b);}else{return logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),'clickatell',util[_0xd615('0x2d')](_0xecd046[_0xd615('0x2a')],{'showHidden':![],'depth':null}));}})[_0xd615('0x29')](function(_0x3b6460){return logger[_0xd615('0x2a')](_0xd615('0x2b'),'afterCreate','clickatell',util[_0xd615('0x2d')](_0x3b6460,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd615('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0xd615('0x6a'):if(_0x56b8ba[_0xd615('0x58')]){var _0xbb5978={};var _0x3f2fd6={'method':_0xd615('0x39'),'uri':_0xd615('0x6b'),'headers':{'Authorization':_0xd615('0x6c')+_0x56b8ba['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x56b8ba['phone'],'to':_0x2786fa['phone'],'text':_0x2786fa['body']},'json':!![]};return rp(_0x3f2fd6)[_0xd615('0x1e')](function(_0x37b395){if(_0x37b395['code']==0xca){_0xbb5978[_0xd615('0x6d')]=_0x37b395;var _0x46e762={'method':'POST','uri':_0xd615('0x6e'),'headers':{'Authorization':_0xd615('0x6c')+_0x56b8ba[_0xd615('0x58')],'Content-Type':_0xd615('0x54')},'body':{'refid':_0xbb5978['message']['refid']},'json':!![]};return rp(_0x46e762)[_0xd615('0x1e')](function(_0x340ab7){_0xbb5978[_0xd615('0x6f')]=_0x340ab7;var _0x41381d={'messageId':_0xbb5978['message'][_0xd615('0x70')],'read':!![]};return _0x5bddb5[_0xd615('0x19')](_0x41381d);});}else{return logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x6a'),util['inspect'](_0x37b395,{'showHidden':![],'depth':null}));}})[_0xd615('0x29')](function(_0x1b093e){return logger[_0xd615('0x2a')](_0xd615('0x2b'),_0xd615('0x2c'),_0xd615('0x6a'),util[_0xd615('0x2d')](_0x1b093e,{'showHidden':![],'depth':null}));});}else{return logger[_0xd615('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd615('0x2c'),_0xd615('0x6a'),'Token\x20not\x20received');}break;}}})[_0xd615('0x71')](function(){_0x49284f();});}else{_0x49284f();}}},'charset':_0xd615('0x72'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e4703f4..e3f3247 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 _0xabdb=['SmsMessage','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage'];(function(_0x21cd58,_0x4604d6){var _0x3fba55=function(_0x51922e){while(--_0x51922e){_0x21cd58['push'](_0x21cd58['shift']());}};_0x3fba55(++_0x4604d6);}(_0xabdb,0x185));var _0xbabd=function(_0x7568a,_0x41c9fe){_0x7568a=_0x7568a-0x0;var _0x29e8eb=_0xabdb[_0x7568a];return _0x29e8eb;};'use strict';var _=require('lodash');var util=require(_0xbabd('0x0'));var moment=require('moment');var BPromise=require(_0xbabd('0x1'));var rs=require(_0xbabd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbabd('0x3'))['db'];var utils=require(_0xbabd('0x4'));var logger=require('../../config/logger')(_0xbabd('0x5'));var config=require(_0xbabd('0x6'));var jayson=require(_0xbabd('0x7'));var client=jayson[_0xbabd('0x8')][_0xbabd('0x9')]({'port':0x232a});config['redis']=_[_0xbabd('0xa')](config[_0xbabd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbabd('0xc'))(new Redis(config[_0xbabd('0xb')]));require(_0xbabd('0xd'))['register'](socket);function respondWithRpcPromise(_0x8232ae,_0x498c05,_0x1c7eac){return new BPromise(function(_0x15157b,_0x2aab99){return client[_0xbabd('0xe')](_0x8232ae,_0x1c7eac)[_0xbabd('0xf')](function(_0x243353){logger[_0xbabd('0x10')](_0xbabd('0x11'),_0x498c05,_0xbabd('0x12'));logger[_0xbabd('0x13')](_0xbabd('0x14'),_0x498c05,_0xbabd('0x12'),JSON[_0xbabd('0x15')](_0x243353));if(_0x243353[_0xbabd('0x16')]){if(_0x243353[_0xbabd('0x16')]['code']===0x1f4){logger[_0xbabd('0x16')](_0xbabd('0x11'),_0x498c05,_0x243353[_0xbabd('0x16')]['message']);return _0x2aab99(_0x243353['error']['message']);}logger[_0xbabd('0x16')](_0xbabd('0x11'),_0x498c05,_0x243353[_0xbabd('0x16')][_0xbabd('0x17')]);return _0x15157b(_0x243353[_0xbabd('0x16')]['message']);}else{logger[_0xbabd('0x10')](_0xbabd('0x11'),_0x498c05,_0xbabd('0x12'));_0x15157b(_0x243353[_0xbabd('0x18')][_0xbabd('0x17')]);}})[_0xbabd('0x19')](function(_0x55e8f8){logger[_0xbabd('0x16')](_0xbabd('0x11'),_0x498c05,_0x55e8f8);_0x2aab99(_0x55e8f8);});});}exports[_0xbabd('0x1a')]=function(_0xd28281){var _0x34d6d5=this;return new Promise(function(_0x1393b8,_0x1c8172){return db[_0xbabd('0x1b')][_0xbabd('0x1c')](_0xd28281[_0xbabd('0x1d')],{'raw':_0xd28281[_0xbabd('0x1e')]?_0xd28281['options'][_0xbabd('0x1f')]===undefined?!![]:![]:!![]})[_0xbabd('0xf')](function(_0x296250){logger[_0xbabd('0x10')](_0xbabd('0x1a'),_0xd28281);logger[_0xbabd('0x13')](_0xbabd('0x1a'),_0xd28281,JSON[_0xbabd('0x15')](_0x296250));_0x1393b8(_0x296250);})[_0xbabd('0x19')](function(_0x1c5cfd){logger[_0xbabd('0x16')](_0xbabd('0x1a'),_0x1c5cfd['message'],_0xd28281);_0x1c8172(_0x34d6d5[_0xbabd('0x16')](0x1f4,_0x1c5cfd[_0xbabd('0x17')]));});});}; \ No newline at end of file +var _0xba91=['raw','CreateSmsMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','SmsMessage','create','body','options'];(function(_0x5afa3d,_0x54f4a3){var _0x539628=function(_0x3e5cfa){while(--_0x3e5cfa){_0x5afa3d['push'](_0x5afa3d['shift']());}};_0x539628(++_0x54f4a3);}(_0xba91,0x1d3));var _0x1ba9=function(_0x1a8887,_0x1c78af){_0x1a8887=_0x1a8887-0x0;var _0x51e4fc=_0xba91[_0x1a8887];return _0x51e4fc;};'use strict';var _=require(_0x1ba9('0x0'));var util=require('util');var moment=require(_0x1ba9('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ba9('0x2'));var fs=require('fs');var Redis=require(_0x1ba9('0x3'));var db=require(_0x1ba9('0x4'))['db'];var utils=require(_0x1ba9('0x5'));var logger=require(_0x1ba9('0x6'))(_0x1ba9('0x7'));var config=require(_0x1ba9('0x8'));var jayson=require(_0x1ba9('0x9'));var client=jayson['client'][_0x1ba9('0xa')]({'port':0x232a});config[_0x1ba9('0xb')]=_['defaults'](config[_0x1ba9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ba9('0xc'))(new Redis(config[_0x1ba9('0xb')]));require(_0x1ba9('0xd'))[_0x1ba9('0xe')](socket);function respondWithRpcPromise(_0x42f6e0,_0x27ff91,_0x5216e1){return new BPromise(function(_0x50803e,_0x2e3afc){return client[_0x1ba9('0xf')](_0x42f6e0,_0x5216e1)[_0x1ba9('0x10')](function(_0x890b41){logger[_0x1ba9('0x11')](_0x1ba9('0x12'),_0x27ff91,_0x1ba9('0x13'));logger[_0x1ba9('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27ff91,_0x1ba9('0x13'),JSON[_0x1ba9('0x15')](_0x890b41));if(_0x890b41['error']){if(_0x890b41[_0x1ba9('0x16')][_0x1ba9('0x17')]===0x1f4){logger['error'](_0x1ba9('0x12'),_0x27ff91,_0x890b41[_0x1ba9('0x16')][_0x1ba9('0x18')]);return _0x2e3afc(_0x890b41[_0x1ba9('0x16')][_0x1ba9('0x18')]);}logger[_0x1ba9('0x16')]('SmsMessage,\x20%s,\x20%s',_0x27ff91,_0x890b41[_0x1ba9('0x16')][_0x1ba9('0x18')]);return _0x50803e(_0x890b41['error'][_0x1ba9('0x18')]);}else{logger[_0x1ba9('0x11')](_0x1ba9('0x12'),_0x27ff91,_0x1ba9('0x13'));_0x50803e(_0x890b41['result']['message']);}})['catch'](function(_0x40ef7d){logger[_0x1ba9('0x16')](_0x1ba9('0x12'),_0x27ff91,_0x40ef7d);_0x2e3afc(_0x40ef7d);});});}exports['CreateSmsMessage']=function(_0x47e70c){var _0x5d466b=this;return new Promise(function(_0x50413b,_0x51bf4a){return db[_0x1ba9('0x19')][_0x1ba9('0x1a')](_0x47e70c[_0x1ba9('0x1b')],{'raw':_0x47e70c[_0x1ba9('0x1c')]?_0x47e70c[_0x1ba9('0x1c')][_0x1ba9('0x1d')]===undefined?!![]:![]:!![]})[_0x1ba9('0x10')](function(_0x2b6fb1){logger[_0x1ba9('0x11')]('CreateSmsMessage',_0x47e70c);logger[_0x1ba9('0x14')](_0x1ba9('0x1e'),_0x47e70c,JSON[_0x1ba9('0x15')](_0x2b6fb1));_0x50413b(_0x2b6fb1);})['catch'](function(_0x4203ff){logger['error']('CreateSmsMessage',_0x4203ff['message'],_0x47e70c);_0x51bf4a(_0x5d466b[_0x1ba9('0x16')](0x1f4,_0x4203ff[_0x1ba9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 336c3af..742ab81 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 _0x6015=['emit','removeListener','register','length','smsMessage:','remove','update'];(function(_0xe66101,_0x6eb5a6){var _0x5bae1b=function(_0x4aeda5){while(--_0x4aeda5){_0xe66101['push'](_0xe66101['shift']());}};_0x5bae1b(++_0x6eb5a6);}(_0x6015,0xde));var _0x5601=function(_0x5826b2,_0x2bb5fe){_0x5826b2=_0x5826b2-0x0;var _0x565929=_0x6015[_0x5826b2];return _0x565929;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x5601('0x0'),_0x5601('0x1')];function createListener(_0x4cfb8b,_0x4b2547){return function(_0x250c50){_0x4b2547[_0x5601('0x2')](_0x4cfb8b,_0x250c50);};}function removeListener(_0x3aaabd,_0x5c83af){return function(){SmsMessageEvents[_0x5601('0x3')](_0x3aaabd,_0x5c83af);};}exports[_0x5601('0x4')]=function(_0x532fda){for(var _0x3e883f=0x0,_0x43a755=events[_0x5601('0x5')];_0x3e883f<_0x43a755;_0x3e883f++){var _0x57ae8a=events[_0x3e883f];var _0x585894=createListener(_0x5601('0x6')+_0x57ae8a,_0x532fda);SmsMessageEvents['on'](_0x57ae8a,_0x585894);}}; \ No newline at end of file +var _0xedfa=['smsMessage:','save','emit','register','length'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xedfa,0x1dc));var _0xaedf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedfa[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xaedf('0x0'),'remove','update'];function createListener(_0x14e9e1,_0x226989){return function(_0x1ab0af){_0x226989[_0xaedf('0x1')](_0x14e9e1,_0x1ab0af);};}function removeListener(_0x3b103c,_0x6af16b){return function(){SmsMessageEvents['removeListener'](_0x3b103c,_0x6af16b);};}exports[_0xaedf('0x2')]=function(_0x234463){for(var _0x43dfb4=0x0,_0x5761b9=events[_0xaedf('0x3')];_0x43dfb4<_0x5761b9;_0x43dfb4++){var _0x2739d3=events[_0x43dfb4];var _0x2c646e=createListener(_0xaedf('0x4')+_0x2739d3,_0x234463);SmsMessageEvents['on'](_0x2739d3,_0x2c646e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5b93f46..56b0eea 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 _0xf95f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','delete','destroy','removeTeams','exports','multer','util'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xf95f,0x142));var _0xff95=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xf95f[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var path=require(_0xff95('0x2'));var timeout=require(_0xff95('0x3'));var express=require(_0xff95('0x4'));var router=express[_0xff95('0x5')]();var auth=require(_0xff95('0x6'));var interaction=require(_0xff95('0x7'));var config=require(_0xff95('0x8'));var controller=require('./smsQueue.controller');router[_0xff95('0x9')]('/',auth['isAuthenticated'](),controller[_0xff95('0xa')]);router['get'](_0xff95('0xb'),auth[_0xff95('0xc')](),controller[_0xff95('0xd')]);router[_0xff95('0x9')](_0xff95('0xe'),auth[_0xff95('0xc')](),controller[_0xff95('0xf')]);router[_0xff95('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xff95('0x10')]);router[_0xff95('0x9')](_0xff95('0x11'),auth[_0xff95('0xc')](),controller[_0xff95('0x12')]);router[_0xff95('0x9')](_0xff95('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xff95('0x14')]('/',auth[_0xff95('0xc')](),controller['create']);router[_0xff95('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xff95('0x14')](_0xff95('0x13'),auth[_0xff95('0xc')](),controller[_0xff95('0x15')]);router[_0xff95('0x16')](_0xff95('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xff95('0x17')](_0xff95('0xe'),auth[_0xff95('0xc')](),controller[_0xff95('0x18')]);router[_0xff95('0x17')](_0xff95('0x11'),auth['isAuthenticated'](),controller[_0xff95('0x19')]);router[_0xff95('0x17')](_0xff95('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xff95('0x1a')]=router; \ No newline at end of file +var _0x7dee=['addTeams','/:id/users','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create'];(function(_0x2aa61a,_0x511b2d){var _0x5ef025=function(_0x8bce7){while(--_0x8bce7){_0x2aa61a['push'](_0x2aa61a['shift']());}};_0x5ef025(++_0x511b2d);}(_0x7dee,0xb0));var _0xe7de=function(_0x30554f,_0x27a85c){_0x30554f=_0x30554f-0x0;var _0x5c34ee=_0x7dee[_0x30554f];return _0x5c34ee;};'use strict';var multer=require(_0xe7de('0x0'));var util=require('util');var path=require(_0xe7de('0x1'));var timeout=require('connect-timeout');var express=require(_0xe7de('0x2'));var router=express[_0xe7de('0x3')]();var auth=require(_0xe7de('0x4'));var interaction=require(_0xe7de('0x5'));var config=require('../../config/environment');var controller=require(_0xe7de('0x6'));router['get']('/',auth[_0xe7de('0x7')](),controller[_0xe7de('0x8')]);router[_0xe7de('0x9')](_0xe7de('0xa'),auth[_0xe7de('0x7')](),controller[_0xe7de('0xb')]);router['get'](_0xe7de('0xc'),auth[_0xe7de('0x7')](),controller[_0xe7de('0xd')]);router[_0xe7de('0x9')]('/:id/members',auth[_0xe7de('0x7')](),controller[_0xe7de('0xe')]);router[_0xe7de('0x9')](_0xe7de('0xf'),auth[_0xe7de('0x7')](),controller[_0xe7de('0x10')]);router[_0xe7de('0x9')]('/:id/users',auth[_0xe7de('0x7')](),controller[_0xe7de('0x11')]);router[_0xe7de('0x12')]('/',auth[_0xe7de('0x7')](),controller[_0xe7de('0x13')]);router['post'](_0xe7de('0xf'),auth[_0xe7de('0x7')](),controller[_0xe7de('0x14')]);router[_0xe7de('0x12')](_0xe7de('0x15'),auth[_0xe7de('0x7')](),controller['addAgents']);router['put'](_0xe7de('0xc'),auth[_0xe7de('0x7')](),controller[_0xe7de('0x16')]);router[_0xe7de('0x17')](_0xe7de('0xc'),auth['isAuthenticated'](),controller[_0xe7de('0x18')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xe7de('0x19')]);router[_0xe7de('0x17')]('/:id/users',auth[_0xe7de('0x7')](),controller[_0xe7de('0x1a')]);module[_0xe7de('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 43ca8c1..157adf0 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 _0x77f5=['STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x20ac6e,_0x2d5d0c){var _0x2df2b9=function(_0x290c0c){while(--_0x290c0c){_0x20ac6e['push'](_0x20ac6e['shift']());}};_0x2df2b9(++_0x2d5d0c);}(_0x77f5,0x17c));var _0x577f=function(_0x23629f,_0x4b37fa){_0x23629f=_0x23629f-0x0;var _0x4d810a=_0x77f5[_0x23629f];return _0x4d810a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x577f('0x0')],'unique':_0x577f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x577f('0x0')]},'timeout':{'type':Sequelize[_0x577f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x577f('0x3')](_0x577f('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x4945=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x53dec0,_0x2a9d29){var _0x2d71c4=function(_0x269b03){while(--_0x269b03){_0x53dec0['push'](_0x53dec0['shift']());}};_0x2d71c4(++_0x2a9d29);}(_0x4945,0x120));var _0x5494=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4945[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x5494('0x0'));module[_0x5494('0x1')]={'name':{'type':Sequelize[_0x5494('0x2')],'unique':_0x5494('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5494('0x2')]},'timeout':{'type':Sequelize[_0x5494('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5494('0x5')]('rrmemory',_0x5494('0x6'),_0x5494('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 27649c6..3edcc87 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 _0xf69d=['role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','hasOwnProperty','pick','SmsQueueId','UserId','agent','updatedAt','createdAt','rows','%s/%s','SIP','smsPause','getTeams','Team','order','addTeams','ids','User','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeTeams','isEmpty','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','status','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','nolimit','sort','filter','where','merge','options','count','findAll','catch','show','params','fields','includeAll','SmsQueue','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x24a956,_0x1a7a4f){var _0x38aac9=function(_0x12d778){while(--_0x12d778){_0x24a956['push'](_0x24a956['shift']());}};_0x38aac9(++_0x1a7a4f);}(_0xf69d,0xd3));var _0xdf69=function(_0x471e3a,_0x144537){_0x471e3a=_0x471e3a-0x0;var _0x330052=_0xf69d[_0x471e3a];return _0x330052;};'use strict';var pdf=require(_0xdf69('0x0'));var emlformat=require(_0xdf69('0x1'));var rimraf=require(_0xdf69('0x2'));var zipdir=require(_0xdf69('0x3'));var jsonpatch=require(_0xdf69('0x4'));var rp=require('request-promise');var moment=require(_0xdf69('0x5'));var BPromise=require(_0xdf69('0x6'));var Mustache=require(_0xdf69('0x7'));var util=require(_0xdf69('0x8'));var path=require(_0xdf69('0x9'));var sox=require(_0xdf69('0xa'));var csv=require(_0xdf69('0xb'));var ejs=require(_0xdf69('0xc'));var fs=require('fs');var _=require(_0xdf69('0xd'));var squel=require(_0xdf69('0xe'));var crypto=require(_0xdf69('0xf'));var jsforce=require(_0xdf69('0x10'));var deskjs=require(_0xdf69('0x11'));var toCsv=require(_0xdf69('0xb'));var querystring=require(_0xdf69('0x12'));var Papa=require(_0xdf69('0x13'));var Redis=require(_0xdf69('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdf69('0x15'));var as=require(_0xdf69('0x16'));var hardwareService=require(_0xdf69('0x17'));var logger=require(_0xdf69('0x18'))(_0xdf69('0x19'));var utils=require(_0xdf69('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdf69('0x1b')](config[_0xdf69('0x1c')],{'host':_0xdf69('0x1d'),'port':0x18eb});var socket=require(_0xdf69('0x1e'))(new Redis(config[_0xdf69('0x1c')]));require(_0xdf69('0x1f'))['register'](socket);function respondWithStatusCode(_0x41cc77,_0x42d448){_0x42d448=_0x42d448||0xcc;return function(_0x3da128){if(_0x3da128){return _0x41cc77[_0xdf69('0x20')](_0x42d448);}return _0x41cc77['status'](_0x42d448)[_0xdf69('0x21')]();};}function respondWithResult(_0x56be66,_0x2a6e55){_0x2a6e55=_0x2a6e55||0xc8;return function(_0x1899a2){if(_0x1899a2){return _0x56be66['status'](_0x2a6e55)[_0xdf69('0x22')](_0x1899a2);}};}function respondWithFilteredResult(_0x449908,_0x1af696){return function(_0x85d1d){if(_0x85d1d){var _0x59bfd2=_0x85d1d['count'],_0x5ae237=_0x1af696[_0xdf69('0x23')],_0x352400=_0x1af696[_0xdf69('0x23')]+_0x1af696[_0xdf69('0x24')],_0x15e73a;if(_0x352400>=_0x59bfd2){_0x352400=_0x59bfd2;_0x15e73a=0xc8;}else{_0x15e73a=0xce;}_0x449908['status'](_0x15e73a);return _0x449908[_0xdf69('0x25')](_0xdf69('0x26'),_0x5ae237+'-'+_0x352400+'/'+_0x59bfd2)['json'](_0x85d1d);}return null;};}function patchUpdates(_0x56647c){return function(_0x32505a){try{jsonpatch[_0xdf69('0x27')](_0x32505a,_0x56647c,!![]);}catch(_0x13b98e){return BPromise['reject'](_0x13b98e);}return _0x32505a['save']();};}function saveUpdates(_0x5be7dd,_0x2ae7d4){return function(_0x5b931b){if(_0x5b931b){return _0x5b931b[_0xdf69('0x28')](_0x5be7dd)[_0xdf69('0x29')](function(_0x1d37d8){return _0x1d37d8;});}return null;};}function removeEntity(_0x54d2ca,_0x541da0){return function(_0x3c916d){if(_0x3c916d){return _0x3c916d[_0xdf69('0x2a')]()[_0xdf69('0x29')](function(){var _0x3fd933=_0x3c916d['get']({'plain':!![]});var _0x3b727c=_0xdf69('0x2b');return db[_0xdf69('0x2c')]['destroy']({'where':{'type':_0x3b727c,'resourceId':_0x3fd933['id']}})[_0xdf69('0x29')](function(){return _0x3c916d;});})['then'](function(){_0x54d2ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2738,_0x146b6a){return function(_0xe339ac){if(!_0xe339ac){_0x5c2738['sendStatus'](0x194);}return _0xe339ac;};}function handleError(_0x301bd2,_0xd81d0a){_0xd81d0a=_0xd81d0a||0x1f4;return function(_0x19cf2d){logger[_0xdf69('0x2d')](_0x19cf2d[_0xdf69('0x2e')]);if(_0x19cf2d[_0xdf69('0x2f')]){delete _0x19cf2d[_0xdf69('0x2f')];}_0x301bd2[_0xdf69('0x30')](_0xd81d0a)[_0xdf69('0x31')](_0x19cf2d);};}exports[_0xdf69('0x32')]=function(_0x38c1bb,_0x2a23ed){var _0x38f848={},_0x2cb97e={},_0x1b145b={'count':0x0,'rows':[]};var _0x31cee5=_[_0xdf69('0x33')](db['SmsQueue'][_0xdf69('0x34')],function(_0x2aab76){return{'name':_0x2aab76[_0xdf69('0x35')],'type':_0x2aab76[_0xdf69('0x36')][_0xdf69('0x37')]};});_0x2cb97e['model']=_[_0xdf69('0x33')](_0x31cee5,'name');_0x2cb97e[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0x38c1bb['query']);_0x2cb97e[_0xdf69('0x3a')]=_['intersection'](_0x2cb97e[_0xdf69('0x3b')],_0x2cb97e[_0xdf69('0x38')]);_0x38f848[_0xdf69('0x3c')]=_[_0xdf69('0x3d')](_0x2cb97e[_0xdf69('0x3b')],qs['fields'](_0x38c1bb[_0xdf69('0x38')]['fields']));_0x38f848[_0xdf69('0x3c')]=_0x38f848[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x38f848[_0xdf69('0x3c')]:_0x2cb97e['model'];if(!_0x38c1bb[_0xdf69('0x38')]['hasOwnProperty'](_0xdf69('0x3f'))){_0x38f848['limit']=qs[_0xdf69('0x24')](_0x38c1bb['query'][_0xdf69('0x24')]);_0x38f848[_0xdf69('0x23')]=qs[_0xdf69('0x23')](_0x38c1bb[_0xdf69('0x38')][_0xdf69('0x23')]);}_0x38f848['order']=qs[_0xdf69('0x40')](_0x38c1bb[_0xdf69('0x38')]['sort']);_0x38f848['where']=qs['filters'](_['pick'](_0x38c1bb[_0xdf69('0x38')],_0x2cb97e['filters']),_0x31cee5);if(_0x38c1bb[_0xdf69('0x38')][_0xdf69('0x41')]){_0x38f848[_0xdf69('0x42')]=_[_0xdf69('0x43')](_0x38f848['where'],{'$or':_[_0xdf69('0x33')](_0x31cee5,function(_0x1a4114){if(_0x1a4114[_0xdf69('0x36')]!=='VIRTUAL'){var _0x216f62={};_0x216f62[_0x1a4114[_0xdf69('0x2f')]]={'$like':'%'+_0x38c1bb[_0xdf69('0x38')][_0xdf69('0x41')]+'%'};return _0x216f62;}})});}_0x38f848=_[_0xdf69('0x43')]({},_0x38f848,_0x38c1bb[_0xdf69('0x44')]);var _0x4094d7={'where':_0x38f848['where']};return db['SmsQueue'][_0xdf69('0x45')](_0x4094d7)[_0xdf69('0x29')](function(_0x1d7b7c){_0x1b145b[_0xdf69('0x45')]=_0x1d7b7c;if(_0x38c1bb['query']['includeAll']){_0x38f848['include']=[{'all':!![]}];}return db['SmsQueue'][_0xdf69('0x46')](_0x38f848);})['then'](function(_0x366701){_0x1b145b['rows']=_0x366701;return _0x1b145b;})[_0xdf69('0x29')](respondWithFilteredResult(_0x2a23ed,_0x38f848))[_0xdf69('0x47')](handleError(_0x2a23ed,null));};exports[_0xdf69('0x48')]=function(_0x26c404,_0x13a3e8){var _0x2a7c7d={'raw':!![],'where':{'id':_0x26c404[_0xdf69('0x49')]['id']}},_0x1fcf56={};_0x1fcf56[_0xdf69('0x3b')]=_['keys'](db['SmsQueue'][_0xdf69('0x34')]);_0x1fcf56['query']=_[_0xdf69('0x39')](_0x26c404[_0xdf69('0x38')]);_0x1fcf56[_0xdf69('0x3a')]=_['intersection'](_0x1fcf56[_0xdf69('0x3b')],_0x1fcf56[_0xdf69('0x38')]);_0x2a7c7d[_0xdf69('0x3c')]=_[_0xdf69('0x3d')](_0x1fcf56['model'],qs[_0xdf69('0x4a')](_0x26c404[_0xdf69('0x38')]['fields']));_0x2a7c7d['attributes']=_0x2a7c7d[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x2a7c7d[_0xdf69('0x3c')]:_0x1fcf56[_0xdf69('0x3b')];if(_0x26c404[_0xdf69('0x38')][_0xdf69('0x4b')]){_0x2a7c7d['include']=[{'all':!![]}];}_0x2a7c7d=_['merge']({},_0x2a7c7d,_0x26c404[_0xdf69('0x44')]);return db[_0xdf69('0x4c')][_0xdf69('0x4d')](_0x2a7c7d)[_0xdf69('0x29')](handleEntityNotFound(_0x13a3e8,null))['then'](respondWithResult(_0x13a3e8,null))['catch'](handleError(_0x13a3e8,null));};exports[_0xdf69('0x4e')]=function(_0xe4e247,_0x3ee7a5){return db[_0xdf69('0x4c')][_0xdf69('0x4e')](_0xe4e247[_0xdf69('0x4f')],{})[_0xdf69('0x29')](function(_0x2f2e18){var _0x714374=_0xe4e247[_0xdf69('0x50')][_0xdf69('0x51')]({'plain':!![]});if(!_0x714374)throw new Error(_0xdf69('0x52'));if(_0x714374[_0xdf69('0x53')]===_0xdf69('0x50')){var _0x4bf6d0=_0x2f2e18[_0xdf69('0x51')]({'plain':!![]});var _0x476833=_0xdf69('0x2b');return db['UserProfileSection'][_0xdf69('0x4d')]({'where':{'name':_0x476833,'userProfileId':_0x714374[_0xdf69('0x54')]},'raw':!![]})[_0xdf69('0x29')](function(_0x4abeb7){if(_0x4abeb7&&_0x4abeb7[_0xdf69('0x55')]===0x0){return db['UserProfileResource'][_0xdf69('0x4e')]({'name':_0x4bf6d0[_0xdf69('0x2f')],'resourceId':_0x4bf6d0['id'],'type':_0x4abeb7[_0xdf69('0x2f')],'sectionId':_0x4abeb7['id']},{})[_0xdf69('0x29')](function(){return _0x2f2e18;});}else{return _0x2f2e18;}})['catch'](function(_0x2b1fe2){logger[_0xdf69('0x2d')](_0xdf69('0x56'),_0x2b1fe2);throw _0x2b1fe2;});}return _0x2f2e18;})[_0xdf69('0x29')](respondWithResult(_0x3ee7a5,0xc9))[_0xdf69('0x47')](handleError(_0x3ee7a5,null));};exports[_0xdf69('0x28')]=function(_0x25b5f3,_0x905914){if(_0x25b5f3[_0xdf69('0x4f')]['id']){delete _0x25b5f3['body']['id'];}return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0x25b5f3['params']['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x905914,null))[_0xdf69('0x29')](saveUpdates(_0x25b5f3['body'],null))['then'](respondWithResult(_0x905914,null))[_0xdf69('0x47')](handleError(_0x905914,null));};exports['destroy']=function(_0x36bd47,_0x1bbdda){return db[_0xdf69('0x4c')]['find']({'where':{'id':_0x36bd47['params']['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x1bbdda,null))[_0xdf69('0x29')](removeEntity(_0x1bbdda,null))[_0xdf69('0x47')](handleError(_0x1bbdda,null));};exports[_0xdf69('0x57')]=function(_0x2f57f1,_0x13adae){return db[_0xdf69('0x4c')][_0xdf69('0x57')]()[_0xdf69('0x29')](respondWithResult(_0x13adae,null))[_0xdf69('0x47')](handleError(_0x13adae,null));};exports['getMembers']=function(_0x653233,_0x2762df,_0x260294){var _0x25b8ec={'raw':!![],'where':{}},_0x11ee6c={},_0x18ead3;return db[_0xdf69('0x4c')][_0xdf69('0x58')]({'where':{'id':_0x653233[_0xdf69('0x49')]['id']}})['then'](handleEntityNotFound(_0x2762df,null))['then'](function(_0x293925){if(_0x293925){_0x18ead3=_0x293925[_0xdf69('0x51')]({'plain':!![]});_0x11ee6c['model']=_[_0xdf69('0x39')](db[_0xdf69('0x59')][_0xdf69('0x34')]);_0x11ee6c[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0x653233[_0xdf69('0x38')]);_0x11ee6c['filters']=_[_0xdf69('0x3d')](_0x11ee6c['model'],_0x11ee6c[_0xdf69('0x38')]);_0x25b8ec['attributes']=_['intersection'](_0x11ee6c[_0xdf69('0x3b')],qs[_0xdf69('0x4a')](_0x653233['query'][_0xdf69('0x4a')]));_0x25b8ec[_0xdf69('0x3c')]=_0x25b8ec[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x25b8ec[_0xdf69('0x3c')]:_0x11ee6c[_0xdf69('0x3b')];if(!_0x653233[_0xdf69('0x38')][_0xdf69('0x5a')](_0xdf69('0x3f'))){_0x25b8ec['limit']=qs['limit'](_0x653233['query'][_0xdf69('0x24')]);_0x25b8ec['offset']=qs[_0xdf69('0x23')](_0x653233[_0xdf69('0x38')]['offset']);}_0x25b8ec['order']=qs[_0xdf69('0x40')](_0x653233[_0xdf69('0x38')][_0xdf69('0x40')]);_0x25b8ec[_0xdf69('0x42')]=qs[_0xdf69('0x3a')](_[_0xdf69('0x5b')](_0x653233[_0xdf69('0x38')],_0x11ee6c[_0xdf69('0x3a')]));_0x25b8ec['where'][_0xdf69('0x5c')]=_0x293925['id'];if(_0x653233[_0xdf69('0x38')][_0xdf69('0x41')]){_0x25b8ec[_0xdf69('0x42')]=_['merge'](_0x25b8ec[_0xdf69('0x42')],{'$or':_[_0xdf69('0x33')](_0x25b8ec[_0xdf69('0x3c')],function(_0xccac7a){var _0xc360d4={};_0xc360d4[_0xccac7a]={'$like':'%'+_0x653233['query']['filter']+'%'};return _0xc360d4;})});}_0x25b8ec=_['merge']({},_0x25b8ec,_0x653233['options']);return db['UserSmsQueue'][_0xdf69('0x46')](_0x25b8ec);}})['then'](function(_0x5af4f0){if(_0x5af4f0){return db['User']['findAndCountAll']({'where':{'id':_[_0xdf69('0x33')](_0x5af4f0,_0xdf69('0x5d')),'role':_0xdf69('0x5e')},'attributes':['id',_0xdf69('0x2f'),'smsPause',_0xdf69('0x5f'),_0xdf69('0x60')]});}})['then'](function(_0x40fc57){if(_0x40fc57){return{'count':_0x40fc57[_0xdf69('0x45')],'rows':_[_0xdf69('0x33')](_0x40fc57[_0xdf69('0x61')],function(_0x463a2a){return{'membername':_0x463a2a[_0xdf69('0x2f')],'UserId':_0x463a2a['id'],'queue_name':_0x18ead3[_0xdf69('0x2f')],'SmsQueueId':_0x18ead3['id'],'interface':util['format'](_0xdf69('0x62'),_0xdf69('0x63'),_0x463a2a[_0xdf69('0x2f')]),'penalty':0x0,'paused':_0x463a2a[_0xdf69('0x64')],'createdAt':_0x463a2a[_0xdf69('0x60')],'updatedAt':_0x463a2a[_0xdf69('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdf69('0x29')](respondWithFilteredResult(_0x2762df,_0x25b8ec))[_0xdf69('0x47')](handleError(_0x2762df,null));};exports[_0xdf69('0x65')]=function(_0xcfff2b,_0x2bea8b,_0x385da6){var _0x42d7a9={};var _0x291639={};var _0x5deae0;var _0xccdaef;return db['SmsQueue'][_0xdf69('0x58')]({'where':{'id':_0xcfff2b[_0xdf69('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bea8b,null))[_0xdf69('0x29')](function(_0x42fa46){if(_0x42fa46){_0x5deae0=_0x42fa46;_0x291639[_0xdf69('0x3b')]=_[_0xdf69('0x39')](db[_0xdf69('0x66')][_0xdf69('0x34')]);_0x291639[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0xcfff2b['query']);_0x291639['filters']=_['intersection'](_0x291639[_0xdf69('0x3b')],_0x291639[_0xdf69('0x38')]);_0x42d7a9[_0xdf69('0x3c')]=_['intersection'](_0x291639['model'],qs['fields'](_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x4a')]));_0x42d7a9[_0xdf69('0x3c')]=_0x42d7a9['attributes']['length']?_0x42d7a9[_0xdf69('0x3c')]:_0x291639[_0xdf69('0x3b')];_0x42d7a9[_0xdf69('0x67')]=qs[_0xdf69('0x40')](_0xcfff2b['query'][_0xdf69('0x40')]);_0x42d7a9[_0xdf69('0x42')]=qs['filters'](_['pick'](_0xcfff2b[_0xdf69('0x38')],_0x291639[_0xdf69('0x3a')]));if(_0xcfff2b['query'][_0xdf69('0x41')]){_0x42d7a9[_0xdf69('0x42')]=_[_0xdf69('0x43')](_0x42d7a9['where'],{'$or':_[_0xdf69('0x33')](_0x42d7a9['attributes'],function(_0x4ba3a0){var _0x5d0eac={};_0x5d0eac[_0x4ba3a0]={'$like':'%'+_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x41')]+'%'};return _0x5d0eac;})});}_0x42d7a9=_[_0xdf69('0x43')]({},_0x42d7a9,_0xcfff2b[_0xdf69('0x44')]);return _0x5deae0['getTeams'](_0x42d7a9);}})[_0xdf69('0x29')](function(_0x59b5bf){if(_0x59b5bf){_0xccdaef=_0x59b5bf['length'];if(!_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x5a')](_0xdf69('0x3f'))){_0x42d7a9[_0xdf69('0x24')]=qs[_0xdf69('0x24')](_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x24')]);_0x42d7a9[_0xdf69('0x23')]=qs[_0xdf69('0x23')](_0xcfff2b['query']['offset']);}return _0x5deae0[_0xdf69('0x65')](_0x42d7a9);}})[_0xdf69('0x29')](function(_0x247084){if(_0x247084){return _0x247084?{'count':_0xccdaef,'rows':_0x247084}:null;}})[_0xdf69('0x29')](respondWithResult(_0x2bea8b,null))[_0xdf69('0x47')](handleError(_0x2bea8b,null));};exports[_0xdf69('0x68')]=function(_0xc4b56b,_0x24f8ab,_0x3ab275){var _0x2d443c=_0xc4b56b['body'][_0xdf69('0x69')];return db[_0xdf69('0x66')][_0xdf69('0x46')]({'where':{'id':_0x2d443c},'attributes':['id'],'include':[{'model':db[_0xdf69('0x6a')],'as':_0xdf69('0x6b'),'attributes':['id',_0xdf69('0x2f'),'online',_0xdf69('0x6c'),_0xdf69('0x6d')],'raw':!![]}]})[_0xdf69('0x29')](function(_0x35d3db){if(_0x35d3db){var _0x4e85a6=_[_0xdf69('0x6e')](_0x35d3db,function(_0x5168c6){var _0x57f356=_0x5168c6[_0xdf69('0x51')]({'plain':!![]});return _0x57f356[_0xdf69('0x6b')];});return db['SmsQueue'][_0xdf69('0x4d')]({'where':{'id':_0xc4b56b['params']['id']}})[_0xdf69('0x29')](function(_0x4a2ce5){return db['sequelize'][_0xdf69('0x6f')](function(_0x1428ed){return _0x4a2ce5[_0xdf69('0x68')](_0x2d443c,{'transaction':_0x1428ed})['then'](function(){return BPromise[_0xdf69('0x70')](_0x4e85a6,function(_0xb13308){return db[_0xdf69('0x59')][_0xdf69('0x71')]({'where':{'UserId':_0xb13308['id'],'SmsQueueId':_0xc4b56b[_0xdf69('0x49')]['id']},'transaction':_0x1428ed});});})[_0xdf69('0x29')](function(){_0x4e85a6[_0xdf69('0x72')](function(_0x31df4e){socket[_0xdf69('0x73')]('userSmsQueue:save',{'UserId':_0x31df4e['id'],'SmsQueueId':_0x4a2ce5['id']});});});});});}})[_0xdf69('0x29')](respondWithStatusCode(_0x24f8ab,null))[_0xdf69('0x47')](handleError(_0x24f8ab,null));};exports['removeTeams']=function(_0x2a7998,_0x36537b,_0x3ef9fa){return db['Team'][_0xdf69('0x46')]({'where':{'id':_0x2a7998['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdf69('0x29')](handleEntityNotFound(_0x36537b,null))[_0xdf69('0x29')](function(_0x5a3074){var _0x2a1402=_['map'](_0x5a3074,'id');var _0x23a0e2=[];var _0x30b78d=[];var _0x2e6820=squel[_0xdf69('0x74')]();_0x2e6820[_0xdf69('0x75')](_0xdf69('0x76'))[_0xdf69('0x77')](_0xdf69('0x78'),'tq')[_0xdf69('0x79')](_0xdf69('0x7a'),'ut',_0xdf69('0x7b'))[_0xdf69('0x42')](_0xdf69('0x7c'),_0x2a7998[_0xdf69('0x49')]['id']);for(var _0x5a15c4=0x0;_0x5a15c4<_0x5a3074[_0xdf69('0x3e')];_0x5a15c4+=0x1){let _0x310cb2=_0x5a3074[_0x5a15c4];for(var _0x57bef0=0x0;_0x57bef0<_0x310cb2['Agents'][_0xdf69('0x3e')];_0x57bef0+=0x1){let _0x304ddc=_0x310cb2['Agents'][_0x57bef0];var _0x508716=_0x2e6820[_0xdf69('0x7d')]();_0x508716[_0xdf69('0x42')](_0xdf69('0x7e'),_0x304ddc['id']);_0x30b78d[_0xdf69('0x7f')](db[_0xdf69('0x80')][_0xdf69('0x38')](_0x508716[_0xdf69('0x81')](),{'type':db[_0xdf69('0x80')][_0xdf69('0x82')][_0xdf69('0x83')]})['then'](function(_0x26ed52){if(_0x26ed52[_0xdf69('0x3e')]===0x1){return _0x304ddc['id'];}else{var _0x7e9145=_['every'](_[_0xdf69('0x33')](_0x26ed52,_0xdf69('0x84')),function(_0x56192e){return _[_0xdf69('0x85')](_0x2a1402,_0x56192e);});if(_0x7e9145){return _0x304ddc['id'];}}}));}}return BPromise['all'](_0x30b78d)[_0xdf69('0x29')](function(_0x3f9900){_0x23a0e2=_(_0x23a0e2)[_0xdf69('0x86')](_0x3f9900)[_0xdf69('0x87')]()[_0xdf69('0x88')]();return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0x2a7998[_0xdf69('0x49')]['id']}})[_0xdf69('0x29')](function(_0x49c6bf){return db[_0xdf69('0x80')][_0xdf69('0x6f')](function(_0x328692){return _0x49c6bf[_0xdf69('0x89')](_0x2a7998['query']['ids'],{'transaction':_0x328692})[_0xdf69('0x29')](function(){if(!_[_0xdf69('0x8a')](_0x23a0e2)){return _0x49c6bf['removeAgents'](_0x23a0e2,{'transaction':_0x328692});}})['then'](function(){_0x23a0e2[_0xdf69('0x72')](function(_0x2b9c50){socket[_0xdf69('0x73')]('userSmsQueue:remove',{'UserId':_0x2b9c50,'SmsQueueId':_0x49c6bf['id']});});});});});});})['then'](respondWithStatusCode(_0x36537b,null))[_0xdf69('0x47')](handleError(_0x36537b,null));};exports['addAgents']=function(_0xe5f628,_0x5ccc91,_0x46d2f8){return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0xe5f628['params']['id']}})['then'](handleEntityNotFound(_0x5ccc91,null))['then'](function(_0x420dc1){if(_0x420dc1){return _0x420dc1[_0xdf69('0x8b')](_0xe5f628[_0xdf69('0x4f')][_0xdf69('0x69')],_[_0xdf69('0x8c')](_0xe5f628[_0xdf69('0x4f')],['ids','id'])||{})[_0xdf69('0x8d')](function(_0x30d7cc){for(var _0x53024e=0x0;_0x53024e<_0xe5f628[_0xdf69('0x4f')]['ids'][_0xdf69('0x3e')];_0x53024e+=0x1){socket[_0xdf69('0x73')](_0xdf69('0x8e'),{'UserId':_0xe5f628[_0xdf69('0x4f')]['ids'][_0x53024e],'SmsQueueId':_0xe5f628[_0xdf69('0x49')]['id']});}return _0x30d7cc;});}})[_0xdf69('0x29')](respondWithResult(_0x5ccc91,null))['catch'](handleError(_0x5ccc91,null));};exports[_0xdf69('0x8f')]=function(_0x3c8583,_0x552a02,_0x8395f7){return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0x3c8583[_0xdf69('0x49')]['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x552a02,null))[_0xdf69('0x29')](function(_0xd3d0a7){if(_0xd3d0a7){return _0xd3d0a7[_0xdf69('0x8f')](_0x3c8583['query'][_0xdf69('0x69')])['then'](function(){if(_[_0xdf69('0x90')](_0x3c8583[_0xdf69('0x38')]['ids'])){for(var _0x3253a8=0x0;_0x3253a8<_0x3c8583['query'][_0xdf69('0x69')]['length'];_0x3253a8+=0x1){socket[_0xdf69('0x73')](_0xdf69('0x91'),{'UserId':Number(_0x3c8583[_0xdf69('0x38')][_0xdf69('0x69')][_0x3253a8]),'SmsQueueId':Number(_0x3c8583[_0xdf69('0x49')]['id'])});}}else{socket['emit'](_0xdf69('0x91'),{'UserId':Number(_0x3c8583[_0xdf69('0x38')][_0xdf69('0x69')]),'SmsQueueId':Number(_0x3c8583[_0xdf69('0x49')]['id'])});}});}})[_0xdf69('0x29')](respondWithStatusCode(_0x552a02,null))[_0xdf69('0x47')](handleError(_0x552a02,null));};exports[_0xdf69('0x92')]=function(_0x85db67,_0x5cf24a,_0x27b622){var _0x8b66d3={};var _0x14f1c2={};var _0x4f7290;var _0xc935d5;return db[_0xdf69('0x4c')][_0xdf69('0x58')]({'where':{'id':_0x85db67[_0xdf69('0x49')]['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x5cf24a,null))[_0xdf69('0x29')](function(_0x587d8e){if(_0x587d8e){_0x4f7290=_0x587d8e;_0x14f1c2['model']=_[_0xdf69('0x39')](db[_0xdf69('0x6a')][_0xdf69('0x34')]);_0x14f1c2[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0x85db67[_0xdf69('0x38')]);_0x14f1c2[_0xdf69('0x3a')]=_['intersection'](_0x14f1c2[_0xdf69('0x3b')],_0x14f1c2[_0xdf69('0x38')]);_0x8b66d3['attributes']=_['intersection'](_0x14f1c2[_0xdf69('0x3b')],qs['fields'](_0x85db67[_0xdf69('0x38')][_0xdf69('0x4a')]));_0x8b66d3[_0xdf69('0x3c')]=_0x8b66d3[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x8b66d3[_0xdf69('0x3c')]:_0x14f1c2[_0xdf69('0x3b')];_0x8b66d3[_0xdf69('0x67')]=qs[_0xdf69('0x40')](_0x85db67[_0xdf69('0x38')]['sort']);_0x8b66d3[_0xdf69('0x42')]=qs['filters'](_[_0xdf69('0x5b')](_0x85db67[_0xdf69('0x38')],_0x14f1c2[_0xdf69('0x3a')]));if(_0x85db67[_0xdf69('0x38')][_0xdf69('0x41')]){_0x8b66d3[_0xdf69('0x42')]=_[_0xdf69('0x43')](_0x8b66d3[_0xdf69('0x42')],{'$or':_[_0xdf69('0x33')](_0x8b66d3[_0xdf69('0x3c')],function(_0x4d1ad2){var _0x423c2b={};_0x423c2b[_0x4d1ad2]={'$like':'%'+_0x85db67[_0xdf69('0x38')]['filter']+'%'};return _0x423c2b;})});}_0x8b66d3=_[_0xdf69('0x43')]({},_0x8b66d3,_0x85db67[_0xdf69('0x44')]);return _0x4f7290[_0xdf69('0x92')](_0x8b66d3);}})[_0xdf69('0x29')](function(_0x107676){if(_0x107676){_0xc935d5=_0x107676[_0xdf69('0x3e')];if(!_0x85db67[_0xdf69('0x38')][_0xdf69('0x5a')](_0xdf69('0x3f'))){_0x8b66d3[_0xdf69('0x24')]=qs['limit'](_0x85db67[_0xdf69('0x38')][_0xdf69('0x24')]);_0x8b66d3[_0xdf69('0x23')]=qs['offset'](_0x85db67[_0xdf69('0x38')]['offset']);}return _0x4f7290[_0xdf69('0x92')](_0x8b66d3);}})['then'](function(_0x4fee9c){if(_0x4fee9c){return _0x4fee9c?{'count':_0xc935d5,'rows':_0x4fee9c}:null;}})[_0xdf69('0x29')](respondWithResult(_0x5cf24a,null))[_0xdf69('0x47')](handleError(_0x5cf24a,null));}; \ No newline at end of file +var _0x6f47=['VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','filters','pick','filter','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','userSmsQueue:save','removeTeams','tq.TeamId','from','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','union','compact','value','isEmpty','userSmsQueue:remove','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','get','destroy','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge'];(function(_0xf75fe6,_0x146f64){var _0x58d310=function(_0x32f5b4){while(--_0x32f5b4){_0xf75fe6['push'](_0xf75fe6['shift']());}};_0x58d310(++_0x146f64);}(_0x6f47,0xc7));var _0x76f4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6f47[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x76f4('0x0'));var rimraf=require(_0x76f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76f4('0x2'));var rp=require('request-promise');var moment=require(_0x76f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x76f4('0x4'));var util=require(_0x76f4('0x5'));var path=require(_0x76f4('0x6'));var sox=require(_0x76f4('0x7'));var csv=require('to-csv');var ejs=require(_0x76f4('0x8'));var fs=require('fs');var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0xd'));var querystring=require(_0x76f4('0xe'));var Papa=require(_0x76f4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0x10'));var as=require(_0x76f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x12'));var utils=require(_0x76f4('0x13'));var config=require(_0x76f4('0x14'));var licenseUtil=require(_0x76f4('0x15'));var db=require(_0x76f4('0x16'))['db'];config[_0x76f4('0x17')]=_[_0x76f4('0x18')](config[_0x76f4('0x17')],{'host':_0x76f4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76f4('0x17')]));require(_0x76f4('0x1a'))['register'](socket);function respondWithStatusCode(_0x4b6021,_0x5d6f8e){_0x5d6f8e=_0x5d6f8e||0xcc;return function(_0x1d7755){if(_0x1d7755){return _0x4b6021[_0x76f4('0x1b')](_0x5d6f8e);}return _0x4b6021[_0x76f4('0x1c')](_0x5d6f8e)[_0x76f4('0x1d')]();};}function respondWithResult(_0x3d8f5a,_0x2b5e23){_0x2b5e23=_0x2b5e23||0xc8;return function(_0x46ba51){if(_0x46ba51){return _0x3d8f5a[_0x76f4('0x1c')](_0x2b5e23)[_0x76f4('0x1e')](_0x46ba51);}};}function respondWithFilteredResult(_0xb159a9,_0x672960){return function(_0x2d4bd1){if(_0x2d4bd1){var _0x214bef=_0x2d4bd1[_0x76f4('0x1f')],_0x38450e=_0x672960[_0x76f4('0x20')],_0x17625e=_0x672960[_0x76f4('0x20')]+_0x672960[_0x76f4('0x21')],_0x397360;if(_0x17625e>=_0x214bef){_0x17625e=_0x214bef;_0x397360=0xc8;}else{_0x397360=0xce;}_0xb159a9[_0x76f4('0x1c')](_0x397360);return _0xb159a9[_0x76f4('0x22')]('Content-Range',_0x38450e+'-'+_0x17625e+'/'+_0x214bef)[_0x76f4('0x1e')](_0x2d4bd1);}return null;};}function patchUpdates(_0x4dad9b){return function(_0x13f3b1){try{jsonpatch[_0x76f4('0x23')](_0x13f3b1,_0x4dad9b,!![]);}catch(_0xf8f722){return BPromise['reject'](_0xf8f722);}return _0x13f3b1['save']();};}function saveUpdates(_0x52da65,_0x465240){return function(_0x681d67){if(_0x681d67){return _0x681d67[_0x76f4('0x24')](_0x52da65)[_0x76f4('0x25')](function(_0x42ef70){return _0x42ef70;});}return null;};}function removeEntity(_0x4786c9,_0x3f4d11){return function(_0x4dac8e){if(_0x4dac8e){return _0x4dac8e['destroy']()[_0x76f4('0x25')](function(){var _0x497913=_0x4dac8e[_0x76f4('0x26')]({'plain':!![]});var _0x5355bd='SmsQueues';return db['UserProfileResource'][_0x76f4('0x27')]({'where':{'type':_0x5355bd,'resourceId':_0x497913['id']}})[_0x76f4('0x25')](function(){return _0x4dac8e;});})[_0x76f4('0x25')](function(){_0x4786c9[_0x76f4('0x1c')](0xcc)[_0x76f4('0x1d')]();});}};}function handleEntityNotFound(_0x447dbc,_0x5ca31f){return function(_0x306cb4){if(!_0x306cb4){_0x447dbc['sendStatus'](0x194);}return _0x306cb4;};}function handleError(_0x5346be,_0x5b3f07){_0x5b3f07=_0x5b3f07||0x1f4;return function(_0x10ddb4){logger[_0x76f4('0x28')](_0x10ddb4[_0x76f4('0x29')]);if(_0x10ddb4[_0x76f4('0x2a')]){delete _0x10ddb4['name'];}_0x5346be[_0x76f4('0x1c')](_0x5b3f07)['send'](_0x10ddb4);};}exports[_0x76f4('0x2b')]=function(_0x3c7513,_0x43ac4a){var _0x1c2c5c={},_0x4f41c7={},_0x5a6fd4={'count':0x0,'rows':[]};var _0x51019e=_[_0x76f4('0x2c')](db[_0x76f4('0x2d')][_0x76f4('0x2e')],function(_0x281db6){return{'name':_0x281db6[_0x76f4('0x2f')],'type':_0x281db6[_0x76f4('0x30')][_0x76f4('0x31')]};});_0x4f41c7[_0x76f4('0x32')]=_[_0x76f4('0x2c')](_0x51019e,_0x76f4('0x2a'));_0x4f41c7[_0x76f4('0x33')]=_[_0x76f4('0x34')](_0x3c7513['query']);_0x4f41c7['filters']=_['intersection'](_0x4f41c7['model'],_0x4f41c7[_0x76f4('0x33')]);_0x1c2c5c[_0x76f4('0x35')]=_[_0x76f4('0x36')](_0x4f41c7[_0x76f4('0x32')],qs[_0x76f4('0x37')](_0x3c7513['query'][_0x76f4('0x37')]));_0x1c2c5c[_0x76f4('0x35')]=_0x1c2c5c[_0x76f4('0x35')][_0x76f4('0x38')]?_0x1c2c5c[_0x76f4('0x35')]:_0x4f41c7[_0x76f4('0x32')];if(!_0x3c7513[_0x76f4('0x33')][_0x76f4('0x39')](_0x76f4('0x3a'))){_0x1c2c5c[_0x76f4('0x21')]=qs[_0x76f4('0x21')](_0x3c7513[_0x76f4('0x33')][_0x76f4('0x21')]);_0x1c2c5c[_0x76f4('0x20')]=qs[_0x76f4('0x20')](_0x3c7513[_0x76f4('0x33')][_0x76f4('0x20')]);}_0x1c2c5c[_0x76f4('0x3b')]=qs['sort'](_0x3c7513[_0x76f4('0x33')][_0x76f4('0x3c')]);_0x1c2c5c[_0x76f4('0x3d')]=qs['filters'](_['pick'](_0x3c7513[_0x76f4('0x33')],_0x4f41c7['filters']),_0x51019e);if(_0x3c7513[_0x76f4('0x33')]['filter']){_0x1c2c5c[_0x76f4('0x3d')]=_[_0x76f4('0x3e')](_0x1c2c5c[_0x76f4('0x3d')],{'$or':_[_0x76f4('0x2c')](_0x51019e,function(_0x2c0b76){if(_0x2c0b76[_0x76f4('0x30')]!==_0x76f4('0x3f')){var _0x109ad9={};_0x109ad9[_0x2c0b76[_0x76f4('0x2a')]]={'$like':'%'+_0x3c7513[_0x76f4('0x33')]['filter']+'%'};return _0x109ad9;}})});}_0x1c2c5c=_['merge']({},_0x1c2c5c,_0x3c7513[_0x76f4('0x40')]);var _0x13a5a7={'where':_0x1c2c5c[_0x76f4('0x3d')]};return db[_0x76f4('0x2d')][_0x76f4('0x1f')](_0x13a5a7)[_0x76f4('0x25')](function(_0x42754d){_0x5a6fd4[_0x76f4('0x1f')]=_0x42754d;if(_0x3c7513[_0x76f4('0x33')]['includeAll']){_0x1c2c5c[_0x76f4('0x41')]=[{'all':!![]}];}return db[_0x76f4('0x2d')]['findAll'](_0x1c2c5c);})['then'](function(_0x26c411){_0x5a6fd4[_0x76f4('0x42')]=_0x26c411;return _0x5a6fd4;})[_0x76f4('0x25')](respondWithFilteredResult(_0x43ac4a,_0x1c2c5c))[_0x76f4('0x43')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x44')]=function(_0x597734,_0x1b6183){var _0x4126aa={'raw':!![],'where':{'id':_0x597734[_0x76f4('0x45')]['id']}},_0x37f2f5={};_0x37f2f5[_0x76f4('0x32')]=_[_0x76f4('0x34')](db['SmsQueue'][_0x76f4('0x2e')]);_0x37f2f5[_0x76f4('0x33')]=_[_0x76f4('0x34')](_0x597734['query']);_0x37f2f5['filters']=_[_0x76f4('0x36')](_0x37f2f5[_0x76f4('0x32')],_0x37f2f5[_0x76f4('0x33')]);_0x4126aa[_0x76f4('0x35')]=_[_0x76f4('0x36')](_0x37f2f5['model'],qs['fields'](_0x597734[_0x76f4('0x33')]['fields']));_0x4126aa[_0x76f4('0x35')]=_0x4126aa[_0x76f4('0x35')]['length']?_0x4126aa['attributes']:_0x37f2f5[_0x76f4('0x32')];if(_0x597734[_0x76f4('0x33')][_0x76f4('0x46')]){_0x4126aa[_0x76f4('0x41')]=[{'all':!![]}];}_0x4126aa=_['merge']({},_0x4126aa,_0x597734[_0x76f4('0x40')]);return db[_0x76f4('0x2d')][_0x76f4('0x47')](_0x4126aa)['then'](handleEntityNotFound(_0x1b6183,null))[_0x76f4('0x25')](respondWithResult(_0x1b6183,null))[_0x76f4('0x43')](handleError(_0x1b6183,null));};exports['create']=function(_0x56d905,_0x4ab620){return db[_0x76f4('0x2d')][_0x76f4('0x48')](_0x56d905[_0x76f4('0x49')],{})[_0x76f4('0x25')](function(_0x524503){var _0xa3d139=_0x56d905['user'][_0x76f4('0x26')]({'plain':!![]});if(!_0xa3d139)throw new Error(_0x76f4('0x4a'));if(_0xa3d139[_0x76f4('0x4b')]==='user'){var _0x312319=_0x524503[_0x76f4('0x26')]({'plain':!![]});var _0x48030c=_0x76f4('0x4c');return db[_0x76f4('0x4d')][_0x76f4('0x47')]({'where':{'name':_0x48030c,'userProfileId':_0xa3d139[_0x76f4('0x4e')]},'raw':!![]})[_0x76f4('0x25')](function(_0x479c4b){if(_0x479c4b&&_0x479c4b[_0x76f4('0x4f')]===0x0){return db['UserProfileResource'][_0x76f4('0x48')]({'name':_0x312319[_0x76f4('0x2a')],'resourceId':_0x312319['id'],'type':_0x479c4b[_0x76f4('0x2a')],'sectionId':_0x479c4b['id']},{})['then'](function(){return _0x524503;});}else{return _0x524503;}})[_0x76f4('0x43')](function(_0x46c944){logger[_0x76f4('0x28')](_0x76f4('0x50'),_0x46c944);throw _0x46c944;});}return _0x524503;})['then'](respondWithResult(_0x4ab620,0xc9))[_0x76f4('0x43')](handleError(_0x4ab620,null));};exports[_0x76f4('0x24')]=function(_0xaad66b,_0xff4b9b){if(_0xaad66b['body']['id']){delete _0xaad66b[_0x76f4('0x49')]['id'];}return db['SmsQueue'][_0x76f4('0x47')]({'where':{'id':_0xaad66b[_0x76f4('0x45')]['id']}})['then'](handleEntityNotFound(_0xff4b9b,null))['then'](saveUpdates(_0xaad66b[_0x76f4('0x49')],null))[_0x76f4('0x25')](respondWithResult(_0xff4b9b,null))[_0x76f4('0x43')](handleError(_0xff4b9b,null));};exports['destroy']=function(_0x27ba06,_0x15ec0f){return db[_0x76f4('0x2d')]['find']({'where':{'id':_0x27ba06['params']['id']}})[_0x76f4('0x25')](handleEntityNotFound(_0x15ec0f,null))[_0x76f4('0x25')](removeEntity(_0x15ec0f,null))['catch'](handleError(_0x15ec0f,null));};exports['describe']=function(_0x3f1840,_0x34a5d1){return db[_0x76f4('0x2d')][_0x76f4('0x51')]()[_0x76f4('0x25')](respondWithResult(_0x34a5d1,null))[_0x76f4('0x43')](handleError(_0x34a5d1,null));};exports[_0x76f4('0x52')]=function(_0x36a52a,_0x6fd962,_0x4b26da){var _0x48198e={'raw':!![],'where':{}},_0x5cc5c1={},_0x2c2125;return db[_0x76f4('0x2d')][_0x76f4('0x53')]({'where':{'id':_0x36a52a[_0x76f4('0x45')]['id']}})['then'](handleEntityNotFound(_0x6fd962,null))['then'](function(_0x1c22c1){if(_0x1c22c1){_0x2c2125=_0x1c22c1['get']({'plain':!![]});_0x5cc5c1[_0x76f4('0x32')]=_['keys'](db[_0x76f4('0x54')][_0x76f4('0x2e')]);_0x5cc5c1[_0x76f4('0x33')]=_[_0x76f4('0x34')](_0x36a52a['query']);_0x5cc5c1[_0x76f4('0x55')]=_[_0x76f4('0x36')](_0x5cc5c1[_0x76f4('0x32')],_0x5cc5c1[_0x76f4('0x33')]);_0x48198e[_0x76f4('0x35')]=_[_0x76f4('0x36')](_0x5cc5c1[_0x76f4('0x32')],qs['fields'](_0x36a52a[_0x76f4('0x33')][_0x76f4('0x37')]));_0x48198e[_0x76f4('0x35')]=_0x48198e[_0x76f4('0x35')][_0x76f4('0x38')]?_0x48198e[_0x76f4('0x35')]:_0x5cc5c1[_0x76f4('0x32')];if(!_0x36a52a[_0x76f4('0x33')]['hasOwnProperty']('nolimit')){_0x48198e[_0x76f4('0x21')]=qs[_0x76f4('0x21')](_0x36a52a[_0x76f4('0x33')]['limit']);_0x48198e[_0x76f4('0x20')]=qs['offset'](_0x36a52a[_0x76f4('0x33')][_0x76f4('0x20')]);}_0x48198e['order']=qs[_0x76f4('0x3c')](_0x36a52a[_0x76f4('0x33')][_0x76f4('0x3c')]);_0x48198e[_0x76f4('0x3d')]=qs[_0x76f4('0x55')](_[_0x76f4('0x56')](_0x36a52a[_0x76f4('0x33')],_0x5cc5c1[_0x76f4('0x55')]));_0x48198e[_0x76f4('0x3d')]['SmsQueueId']=_0x1c22c1['id'];if(_0x36a52a[_0x76f4('0x33')]['filter']){_0x48198e[_0x76f4('0x3d')]=_[_0x76f4('0x3e')](_0x48198e[_0x76f4('0x3d')],{'$or':_[_0x76f4('0x2c')](_0x48198e[_0x76f4('0x35')],function(_0x8de630){var _0x3a5d96={};_0x3a5d96[_0x8de630]={'$like':'%'+_0x36a52a[_0x76f4('0x33')][_0x76f4('0x57')]+'%'};return _0x3a5d96;})});}_0x48198e=_[_0x76f4('0x3e')]({},_0x48198e,_0x36a52a['options']);return db[_0x76f4('0x54')][_0x76f4('0x58')](_0x48198e);}})['then'](function(_0x30b1f7){if(_0x30b1f7){return db[_0x76f4('0x59')][_0x76f4('0x5a')]({'where':{'id':_['map'](_0x30b1f7,_0x76f4('0x5b')),'role':_0x76f4('0x5c')},'attributes':['id',_0x76f4('0x2a'),'smsPause',_0x76f4('0x5d'),_0x76f4('0x5e')]});}})[_0x76f4('0x25')](function(_0x1ed3b0){if(_0x1ed3b0){return{'count':_0x1ed3b0[_0x76f4('0x1f')],'rows':_[_0x76f4('0x2c')](_0x1ed3b0[_0x76f4('0x42')],function(_0x2b35fe){return{'membername':_0x2b35fe[_0x76f4('0x2a')],'UserId':_0x2b35fe['id'],'queue_name':_0x2c2125['name'],'SmsQueueId':_0x2c2125['id'],'interface':util[_0x76f4('0x5f')](_0x76f4('0x60'),_0x76f4('0x61'),_0x2b35fe[_0x76f4('0x2a')]),'penalty':0x0,'paused':_0x2b35fe['smsPause'],'createdAt':_0x2b35fe[_0x76f4('0x5e')],'updatedAt':_0x2b35fe[_0x76f4('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x76f4('0x25')](respondWithFilteredResult(_0x6fd962,_0x48198e))['catch'](handleError(_0x6fd962,null));};exports[_0x76f4('0x62')]=function(_0x1375d5,_0x31249b,_0x99fbd6){var _0x400050={};var _0x505a6e={};var _0x344406;var _0x4dd41f;return db[_0x76f4('0x2d')][_0x76f4('0x53')]({'where':{'id':_0x1375d5['params']['id']}})['then'](handleEntityNotFound(_0x31249b,null))['then'](function(_0x3aa958){if(_0x3aa958){_0x344406=_0x3aa958;_0x505a6e[_0x76f4('0x32')]=_[_0x76f4('0x34')](db[_0x76f4('0x63')][_0x76f4('0x2e')]);_0x505a6e[_0x76f4('0x33')]=_['keys'](_0x1375d5[_0x76f4('0x33')]);_0x505a6e[_0x76f4('0x55')]=_[_0x76f4('0x36')](_0x505a6e[_0x76f4('0x32')],_0x505a6e[_0x76f4('0x33')]);_0x400050[_0x76f4('0x35')]=_[_0x76f4('0x36')](_0x505a6e[_0x76f4('0x32')],qs['fields'](_0x1375d5[_0x76f4('0x33')]['fields']));_0x400050[_0x76f4('0x35')]=_0x400050[_0x76f4('0x35')][_0x76f4('0x38')]?_0x400050[_0x76f4('0x35')]:_0x505a6e[_0x76f4('0x32')];_0x400050[_0x76f4('0x3b')]=qs[_0x76f4('0x3c')](_0x1375d5[_0x76f4('0x33')]['sort']);_0x400050[_0x76f4('0x3d')]=qs['filters'](_['pick'](_0x1375d5['query'],_0x505a6e[_0x76f4('0x55')]));if(_0x1375d5[_0x76f4('0x33')][_0x76f4('0x57')]){_0x400050[_0x76f4('0x3d')]=_['merge'](_0x400050[_0x76f4('0x3d')],{'$or':_[_0x76f4('0x2c')](_0x400050[_0x76f4('0x35')],function(_0x5f5c24){var _0x12f16e={};_0x12f16e[_0x5f5c24]={'$like':'%'+_0x1375d5[_0x76f4('0x33')][_0x76f4('0x57')]+'%'};return _0x12f16e;})});}_0x400050=_[_0x76f4('0x3e')]({},_0x400050,_0x1375d5[_0x76f4('0x40')]);return _0x344406[_0x76f4('0x62')](_0x400050);}})[_0x76f4('0x25')](function(_0x4b562c){if(_0x4b562c){_0x4dd41f=_0x4b562c[_0x76f4('0x38')];if(!_0x1375d5[_0x76f4('0x33')]['hasOwnProperty'](_0x76f4('0x3a'))){_0x400050[_0x76f4('0x21')]=qs[_0x76f4('0x21')](_0x1375d5[_0x76f4('0x33')][_0x76f4('0x21')]);_0x400050[_0x76f4('0x20')]=qs[_0x76f4('0x20')](_0x1375d5[_0x76f4('0x33')][_0x76f4('0x20')]);}return _0x344406['getTeams'](_0x400050);}})[_0x76f4('0x25')](function(_0x164f7b){if(_0x164f7b){return _0x164f7b?{'count':_0x4dd41f,'rows':_0x164f7b}:null;}})[_0x76f4('0x25')](respondWithResult(_0x31249b,null))[_0x76f4('0x43')](handleError(_0x31249b,null));};exports['addTeams']=function(_0x14bbbd,_0x5df706,_0x420281){var _0x4a7a98=_0x14bbbd[_0x76f4('0x49')][_0x76f4('0x64')];return db['Team']['findAll']({'where':{'id':_0x4a7a98},'attributes':['id'],'include':[{'model':db[_0x76f4('0x59')],'as':_0x76f4('0x65'),'attributes':['id',_0x76f4('0x2a'),'online','voicePause',_0x76f4('0x66')],'raw':!![]}]})[_0x76f4('0x25')](function(_0x52453){if(_0x52453){var _0x36ab57=_[_0x76f4('0x67')](_0x52453,function(_0x3f7645){var _0x98a269=_0x3f7645[_0x76f4('0x26')]({'plain':!![]});return _0x98a269['Agents'];});return db['SmsQueue'][_0x76f4('0x47')]({'where':{'id':_0x14bbbd[_0x76f4('0x45')]['id']}})[_0x76f4('0x25')](function(_0x4c9042){return db[_0x76f4('0x68')][_0x76f4('0x69')](function(_0xc011ec){return _0x4c9042[_0x76f4('0x6a')](_0x4a7a98,{'transaction':_0xc011ec})[_0x76f4('0x25')](function(){return BPromise[_0x76f4('0x6b')](_0x36ab57,function(_0x438656){return db['UserSmsQueue'][_0x76f4('0x6c')]({'where':{'UserId':_0x438656['id'],'SmsQueueId':_0x14bbbd[_0x76f4('0x45')]['id']},'transaction':_0xc011ec});});})[_0x76f4('0x25')](function(){_0x36ab57['forEach'](function(_0x2b403d){socket[_0x76f4('0x6d')](_0x76f4('0x6e'),{'UserId':_0x2b403d['id'],'SmsQueueId':_0x4c9042['id']});});});});});}})[_0x76f4('0x25')](respondWithStatusCode(_0x5df706,null))['catch'](handleError(_0x5df706,null));};exports[_0x76f4('0x6f')]=function(_0x4de9a0,_0xc80d4c,_0x4bb70f){return db[_0x76f4('0x63')][_0x76f4('0x58')]({'where':{'id':_0x4de9a0[_0x76f4('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x76f4('0x59')],'as':_0x76f4('0x65'),'attributes':['id'],'raw':!![]}]})[_0x76f4('0x25')](handleEntityNotFound(_0xc80d4c,null))['then'](function(_0x1d36d3){var _0x460867=_['map'](_0x1d36d3,'id');var _0x5e9a6c=[];var _0x3adc09=[];var _0x39afa3=squel['select']();_0x39afa3['field'](_0x76f4('0x70'))[_0x76f4('0x71')]('team_has_sms_queues','tq')[_0x76f4('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x76f4('0x73'),_0x4de9a0['params']['id']);for(var _0x59265d=0x0;_0x59265d<_0x1d36d3[_0x76f4('0x38')];_0x59265d+=0x1){let _0x5c191f=_0x1d36d3[_0x59265d];for(var _0x585747=0x0;_0x585747<_0x5c191f[_0x76f4('0x65')]['length'];_0x585747+=0x1){let _0x1f34f5=_0x5c191f[_0x76f4('0x65')][_0x585747];var _0x5314dc=_0x39afa3['clone']();_0x5314dc[_0x76f4('0x3d')](_0x76f4('0x74'),_0x1f34f5['id']);_0x3adc09[_0x76f4('0x75')](db['sequelize'][_0x76f4('0x33')](_0x5314dc[_0x76f4('0x76')](),{'type':db[_0x76f4('0x68')][_0x76f4('0x77')]['SELECT']})[_0x76f4('0x25')](function(_0x2fe861){if(_0x2fe861[_0x76f4('0x38')]===0x1){return _0x1f34f5['id'];}else{var _0x155142=_[_0x76f4('0x78')](_['map'](_0x2fe861,_0x76f4('0x79')),function(_0x51ba98){return _['includes'](_0x460867,_0x51ba98);});if(_0x155142){return _0x1f34f5['id'];}}}));}}return BPromise['all'](_0x3adc09)[_0x76f4('0x25')](function(_0x354727){_0x5e9a6c=_(_0x5e9a6c)[_0x76f4('0x7a')](_0x354727)[_0x76f4('0x7b')]()[_0x76f4('0x7c')]();return db[_0x76f4('0x2d')]['find']({'where':{'id':_0x4de9a0[_0x76f4('0x45')]['id']}})[_0x76f4('0x25')](function(_0x50e364){return db[_0x76f4('0x68')][_0x76f4('0x69')](function(_0x5ebce2){return _0x50e364[_0x76f4('0x6f')](_0x4de9a0[_0x76f4('0x33')][_0x76f4('0x64')],{'transaction':_0x5ebce2})['then'](function(){if(!_[_0x76f4('0x7d')](_0x5e9a6c)){return _0x50e364['removeAgents'](_0x5e9a6c,{'transaction':_0x5ebce2});}})[_0x76f4('0x25')](function(){_0x5e9a6c['forEach'](function(_0x351106){socket[_0x76f4('0x6d')](_0x76f4('0x7e'),{'UserId':_0x351106,'SmsQueueId':_0x50e364['id']});});});});});});})[_0x76f4('0x25')](respondWithStatusCode(_0xc80d4c,null))[_0x76f4('0x43')](handleError(_0xc80d4c,null));};exports['addAgents']=function(_0x139b5f,_0x4a8caf,_0x39cacc){return db['SmsQueue'][_0x76f4('0x47')]({'where':{'id':_0x139b5f[_0x76f4('0x45')]['id']}})[_0x76f4('0x25')](handleEntityNotFound(_0x4a8caf,null))[_0x76f4('0x25')](function(_0x3dc383){if(_0x3dc383){return _0x3dc383['addAgents'](_0x139b5f[_0x76f4('0x49')][_0x76f4('0x64')],_['omit'](_0x139b5f['body'],[_0x76f4('0x64'),'id'])||{})[_0x76f4('0x7f')](function(_0x13bfea){for(var _0x4415e6=0x0;_0x4415e6<_0x139b5f[_0x76f4('0x49')][_0x76f4('0x64')]['length'];_0x4415e6+=0x1){socket[_0x76f4('0x6d')](_0x76f4('0x6e'),{'UserId':_0x139b5f[_0x76f4('0x49')][_0x76f4('0x64')][_0x4415e6],'SmsQueueId':_0x139b5f[_0x76f4('0x45')]['id']});}return _0x13bfea;});}})['then'](respondWithResult(_0x4a8caf,null))['catch'](handleError(_0x4a8caf,null));};exports[_0x76f4('0x80')]=function(_0x53f627,_0x5f449c,_0x2fe097){return db[_0x76f4('0x2d')][_0x76f4('0x47')]({'where':{'id':_0x53f627[_0x76f4('0x45')]['id']}})[_0x76f4('0x25')](handleEntityNotFound(_0x5f449c,null))[_0x76f4('0x25')](function(_0x5bc925){if(_0x5bc925){return _0x5bc925[_0x76f4('0x80')](_0x53f627[_0x76f4('0x33')][_0x76f4('0x64')])[_0x76f4('0x25')](function(){if(_[_0x76f4('0x81')](_0x53f627[_0x76f4('0x33')]['ids'])){for(var _0x40d3a6=0x0;_0x40d3a6<_0x53f627['query'][_0x76f4('0x64')][_0x76f4('0x38')];_0x40d3a6+=0x1){socket[_0x76f4('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x53f627[_0x76f4('0x33')]['ids'][_0x40d3a6]),'SmsQueueId':Number(_0x53f627['params']['id'])});}}else{socket[_0x76f4('0x6d')](_0x76f4('0x7e'),{'UserId':Number(_0x53f627[_0x76f4('0x33')][_0x76f4('0x64')]),'SmsQueueId':Number(_0x53f627[_0x76f4('0x45')]['id'])});}});}})[_0x76f4('0x25')](respondWithStatusCode(_0x5f449c,null))[_0x76f4('0x43')](handleError(_0x5f449c,null));};exports[_0x76f4('0x82')]=function(_0x3e13af,_0x1f71ea,_0x2cfcc0){var _0x3f59ac={};var _0x2a1e10={};var _0x5935d4;var _0x50135e;return db['SmsQueue'][_0x76f4('0x53')]({'where':{'id':_0x3e13af[_0x76f4('0x45')]['id']}})[_0x76f4('0x25')](handleEntityNotFound(_0x1f71ea,null))['then'](function(_0x4fdd13){if(_0x4fdd13){_0x5935d4=_0x4fdd13;_0x2a1e10['model']=_[_0x76f4('0x34')](db[_0x76f4('0x59')][_0x76f4('0x2e')]);_0x2a1e10[_0x76f4('0x33')]=_[_0x76f4('0x34')](_0x3e13af['query']);_0x2a1e10['filters']=_['intersection'](_0x2a1e10['model'],_0x2a1e10[_0x76f4('0x33')]);_0x3f59ac[_0x76f4('0x35')]=_[_0x76f4('0x36')](_0x2a1e10[_0x76f4('0x32')],qs['fields'](_0x3e13af[_0x76f4('0x33')][_0x76f4('0x37')]));_0x3f59ac[_0x76f4('0x35')]=_0x3f59ac[_0x76f4('0x35')][_0x76f4('0x38')]?_0x3f59ac[_0x76f4('0x35')]:_0x2a1e10['model'];_0x3f59ac[_0x76f4('0x3b')]=qs['sort'](_0x3e13af['query']['sort']);_0x3f59ac[_0x76f4('0x3d')]=qs[_0x76f4('0x55')](_[_0x76f4('0x56')](_0x3e13af['query'],_0x2a1e10[_0x76f4('0x55')]));if(_0x3e13af[_0x76f4('0x33')]['filter']){_0x3f59ac[_0x76f4('0x3d')]=_[_0x76f4('0x3e')](_0x3f59ac[_0x76f4('0x3d')],{'$or':_['map'](_0x3f59ac[_0x76f4('0x35')],function(_0xfa0726){var _0xd0b0b5={};_0xd0b0b5[_0xfa0726]={'$like':'%'+_0x3e13af[_0x76f4('0x33')][_0x76f4('0x57')]+'%'};return _0xd0b0b5;})});}_0x3f59ac=_['merge']({},_0x3f59ac,_0x3e13af[_0x76f4('0x40')]);return _0x5935d4['getAgents'](_0x3f59ac);}})[_0x76f4('0x25')](function(_0xb03b7c){if(_0xb03b7c){_0x50135e=_0xb03b7c[_0x76f4('0x38')];if(!_0x3e13af[_0x76f4('0x33')]['hasOwnProperty']('nolimit')){_0x3f59ac[_0x76f4('0x21')]=qs[_0x76f4('0x21')](_0x3e13af[_0x76f4('0x33')]['limit']);_0x3f59ac['offset']=qs[_0x76f4('0x20')](_0x3e13af[_0x76f4('0x33')][_0x76f4('0x20')]);}return _0x5935d4[_0x76f4('0x82')](_0x3f59ac);}})[_0x76f4('0x25')](function(_0x4de88c){if(_0x4de88c){return _0x4de88c?{'count':_0x50135e,'rows':_0x4de88c}:null;}})[_0x76f4('0x25')](respondWithResult(_0x1f71ea,null))[_0x76f4('0x43')](handleError(_0x1f71ea,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8f091c2..6e78236 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 _0x8e89=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x50a1af,_0x1d5a5d){var _0x1ece76=function(_0x31a57b){while(--_0x31a57b){_0x50a1af['push'](_0x50a1af['shift']());}};_0x1ece76(++_0x1d5a5d);}(_0x8e89,0x1a5));var _0x98e8=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x8e89[_0x35fabd];return _0x61a8ee;};'use strict';var EventEmitter=require(_0x98e8('0x0'));var SmsQueue=require(_0x98e8('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x98e8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x98e8('0x3'),'afterDestroy':_0x98e8('0x4')};function emitEvent(_0x4980b1){return function(_0xb3d96b,_0x1bbe96,_0x4474f8){SmsQueueEvents[_0x98e8('0x5')](_0x4980b1+':'+_0xb3d96b['id'],_0xb3d96b);SmsQueueEvents[_0x98e8('0x5')](_0x4980b1,_0xb3d96b);_0x4474f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x98e8('0x6')](e,emitEvent(event));}}module[_0x98e8('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x5235=['hasOwnProperty','exports','events','SmsQueue','setMaxListeners','save','remove','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5235,0x1f2));var _0x5523=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x5235[_0x2fd0f0];return _0x57f71a;};'use strict';var EventEmitter=require(_0x5523('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x5523('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5523('0x2')](0x0);var events={'afterCreate':_0x5523('0x3'),'afterUpdate':'update','afterDestroy':_0x5523('0x4')};function emitEvent(_0x3ea43e){return function(_0x3a0599,_0x99a6a6,_0x1ffb46){SmsQueueEvents[_0x5523('0x5')](_0x3ea43e+':'+_0x3a0599['id'],_0x3a0599);SmsQueueEvents[_0x5523('0x5')](_0x3ea43e,_0x3a0599);_0x1ffb46(null);};}for(var e in events){if(events[_0x5523('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x5523('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 408f48c..60633a5 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 _0x7409=['sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','SmsQueue'];(function(_0x3f8bdf,_0x39bf38){var _0x46c99b=function(_0x2f365d){while(--_0x2f365d){_0x3f8bdf['push'](_0x3f8bdf['shift']());}};_0x46c99b(++_0x39bf38);}(_0x7409,0x64));var _0x9740=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x7409[_0x1dd82f];return _0x353ca4;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var logger=require(_0x9740('0x2'))(_0x9740('0x3'));var moment=require('moment');var BPromise=require(_0x9740('0x4'));var rp=require(_0x9740('0x5'));var fs=require('fs');var path=require(_0x9740('0x6'));var rimraf=require(_0x9740('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x9740('0x8')]=function(_0x9a551b,_0xb32931){return _0x9a551b['define'](_0x9740('0x9'),attributes,{'tableName':_0x9740('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79fb=['./smsQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a1dd2,_0x53373e){var _0x2db573=function(_0x40efb1){while(--_0x40efb1){_0x1a1dd2['push'](_0x1a1dd2['shift']());}};_0x2db573(++_0x53373e);}(_0x79fb,0xb2));var _0xb79f=function(_0x59e740,_0x43eaea){_0x59e740=_0x59e740-0x0;var _0x4f0d2a=_0x79fb[_0x59e740];return _0x4f0d2a;};'use strict';var _=require(_0xb79f('0x0'));var util=require(_0xb79f('0x1'));var logger=require(_0xb79f('0x2'))(_0xb79f('0x3'));var moment=require(_0xb79f('0x4'));var BPromise=require(_0xb79f('0x5'));var rp=require(_0xb79f('0x6'));var fs=require('fs');var path=require(_0xb79f('0x7'));var rimraf=require(_0xb79f('0x8'));var config=require('../../config/environment');var attributes=require(_0xb79f('0x9'));module['exports']=function(_0x3c3045,_0x101a09){return _0x3c3045[_0xb79f('0xa')]('SmsQueue',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 7bb76e7..2c1f990 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 _0xd9dc=['register','request','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueue,\x20%s,\x20%s','message','request\x20sent','catch','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','then','GetSmsQueue','find','where','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./smsQueue.socket'];(function(_0x4f5e67,_0x163a00){var _0xa8e9dc=function(_0x3f69ae){while(--_0x3f69ae){_0x4f5e67['push'](_0x4f5e67['shift']());}};_0xa8e9dc(++_0x163a00);}(_0xd9dc,0x1aa));var _0xcd9d=function(_0x317f85,_0x267263){_0x317f85=_0x317f85-0x0;var _0x594b2c=_0xd9dc[_0x317f85];return _0x594b2c;};'use strict';var _=require(_0xcd9d('0x0'));var util=require(_0xcd9d('0x1'));var moment=require(_0xcd9d('0x2'));var BPromise=require(_0xcd9d('0x3'));var rs=require(_0xcd9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcd9d('0x5'));var logger=require(_0xcd9d('0x6'))(_0xcd9d('0x7'));var config=require(_0xcd9d('0x8'));var jayson=require(_0xcd9d('0x9'));var client=jayson['client'][_0xcd9d('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcd9d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd9d('0xc'))(new Redis(config[_0xcd9d('0xb')]));require(_0xcd9d('0xd'))[_0xcd9d('0xe')](socket);function respondWithRpcPromise(_0x470f06,_0x59564c,_0x4bbb1f){return new BPromise(function(_0x1eca63,_0x3ee32c){return client[_0xcd9d('0xf')](_0x470f06,_0x4bbb1f)['then'](function(_0x4fa74e){logger[_0xcd9d('0x10')]('SmsQueue,\x20%s,\x20%s',_0x59564c,'request\x20sent');logger[_0xcd9d('0x11')](_0xcd9d('0x12'),_0x59564c,'request\x20sent',JSON[_0xcd9d('0x13')](_0x4fa74e));if(_0x4fa74e['error']){if(_0x4fa74e['error'][_0xcd9d('0x14')]===0x1f4){logger[_0xcd9d('0x15')](_0xcd9d('0x16'),_0x59564c,_0x4fa74e[_0xcd9d('0x15')]['message']);return _0x3ee32c(_0x4fa74e[_0xcd9d('0x15')]['message']);}logger[_0xcd9d('0x15')](_0xcd9d('0x16'),_0x59564c,_0x4fa74e[_0xcd9d('0x15')][_0xcd9d('0x17')]);return _0x1eca63(_0x4fa74e[_0xcd9d('0x15')][_0xcd9d('0x17')]);}else{logger['info'](_0xcd9d('0x16'),_0x59564c,_0xcd9d('0x18'));_0x1eca63(_0x4fa74e['result'][_0xcd9d('0x17')]);}})[_0xcd9d('0x19')](function(_0x48e0b3){logger[_0xcd9d('0x15')](_0xcd9d('0x16'),_0x59564c,_0x48e0b3);_0x3ee32c(_0x48e0b3);});});}exports['GetSmsQueue']=function(_0x2756cd){var _0x483dc2=this;return new Promise(function(_0x2b92c2,_0x5f02b8){return db[_0xcd9d('0x1a')][_0xcd9d('0x1b')]({'raw':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x1d')]===undefined?!![]:![]:!![],'where':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd['options']['where']||null:null,'attributes':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x1e')]||null:null,'limit':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x1f')]||null:null,'include':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0x2756cd[_0xcd9d('0x1c')]['include'],function(_0x2d8d7a){return{'model':db[_0x2d8d7a[_0xcd9d('0x22')]],'as':_0x2d8d7a['as'],'attributes':_0x2d8d7a[_0xcd9d('0x1e')],'include':_0x2d8d7a[_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0x2d8d7a['include'],function(_0x7f80de){return{'model':db[_0x7f80de[_0xcd9d('0x22')]],'as':_0x7f80de['as'],'attributes':_0x7f80de[_0xcd9d('0x1e')],'include':_0x7f80de[_0xcd9d('0x20')]?_['map'](_0x7f80de[_0xcd9d('0x20')],function(_0xb94f5a){return{'model':db[_0xb94f5a[_0xcd9d('0x22')]],'as':_0xb94f5a['as'],'attributes':_0xb94f5a[_0xcd9d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcd9d('0x23')](function(_0x2cc32e){logger[_0xcd9d('0x10')](_0xcd9d('0x24'),_0x2756cd);logger[_0xcd9d('0x11')](_0xcd9d('0x24'),_0x2756cd,JSON[_0xcd9d('0x13')](_0x2cc32e));_0x2b92c2(_0x2cc32e);})[_0xcd9d('0x19')](function(_0x4178bf){logger[_0xcd9d('0x15')](_0xcd9d('0x24'),_0x4178bf[_0xcd9d('0x17')],_0x2756cd);_0x5f02b8(_0x483dc2['error'](0x1f4,_0x4178bf[_0xcd9d('0x17')]));});});};exports['ShowSmsQueue']=function(_0x578522){var _0x10070a=this;return new Promise(function(_0x5cec80,_0xe3e39c){return db[_0xcd9d('0x1a')][_0xcd9d('0x25')]({'raw':_0x578522[_0xcd9d('0x1c')]?_0x578522['options'][_0xcd9d('0x1d')]===undefined?!![]:![]:!![],'where':_0x578522['options']?_0x578522[_0xcd9d('0x1c')][_0xcd9d('0x26')]||null:null,'attributes':_0x578522['options']?_0x578522['options'][_0xcd9d('0x1e')]||null:null,'include':_0x578522['options']?_0x578522[_0xcd9d('0x1c')][_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0x578522['options']['include'],function(_0xfe6648){return{'model':db[_0xfe6648['model']],'as':_0xfe6648['as'],'attributes':_0xfe6648[_0xcd9d('0x1e')],'include':_0xfe6648[_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0xfe6648['include'],function(_0x5eea28){return{'model':db[_0x5eea28[_0xcd9d('0x22')]],'as':_0x5eea28['as'],'attributes':_0x5eea28[_0xcd9d('0x1e')],'include':_0x5eea28[_0xcd9d('0x20')]?_['map'](_0x5eea28[_0xcd9d('0x20')],function(_0x5be98f){return{'model':db[_0x5be98f[_0xcd9d('0x22')]],'as':_0x5be98f['as'],'attributes':_0x5be98f[_0xcd9d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcd9d('0x23')](function(_0x340bc9){logger['info'](_0xcd9d('0x27'),_0x578522);logger['debug'](_0xcd9d('0x27'),_0x578522,JSON['stringify'](_0x340bc9));_0x5cec80(_0x340bc9);})[_0xcd9d('0x19')](function(_0x530b49){logger[_0xcd9d('0x15')]('ShowSmsQueue',_0x530b49[_0xcd9d('0x17')],_0x578522);_0xe3e39c(_0x10070a[_0xcd9d('0x15')](0x1f4,_0x530b49['message']));});});}; \ No newline at end of file +var _0x6e7f=['./smsQueue.socket','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowSmsQueue','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x5354e3,_0x1caf61){var _0x49b4de=function(_0x5d71fa){while(--_0x5d71fa){_0x5354e3['push'](_0x5354e3['shift']());}};_0x49b4de(++_0x1caf61);}(_0x6e7f,0x18c));var _0xf6e7=function(_0x7b574b,_0x1e4016){_0x7b574b=_0x7b574b-0x0;var _0x2fd8f6=_0x6e7f[_0x7b574b];return _0x2fd8f6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf6e7('0x0'));var rs=require(_0xf6e7('0x1'));var fs=require('fs');var Redis=require(_0xf6e7('0x2'));var db=require(_0xf6e7('0x3'))['db'];var utils=require(_0xf6e7('0x4'));var logger=require(_0xf6e7('0x5'))(_0xf6e7('0x6'));var config=require(_0xf6e7('0x7'));var jayson=require(_0xf6e7('0x8'));var client=jayson[_0xf6e7('0x9')]['http']({'port':0x232a});config[_0xf6e7('0xa')]=_[_0xf6e7('0xb')](config['redis'],{'host':_0xf6e7('0xc'),'port':0x18eb});var socket=require(_0xf6e7('0xd'))(new Redis(config[_0xf6e7('0xa')]));require(_0xf6e7('0xe'))['register'](socket);function respondWithRpcPromise(_0x302380,_0x360f61,_0x2a824c){return new BPromise(function(_0x2709c4,_0x17ce96){return client[_0xf6e7('0xf')](_0x302380,_0x2a824c)[_0xf6e7('0x10')](function(_0x400e30){logger[_0xf6e7('0x11')]('SmsQueue,\x20%s,\x20%s',_0x360f61,'request\x20sent');logger[_0xf6e7('0x12')](_0xf6e7('0x13'),_0x360f61,_0xf6e7('0x14'),JSON[_0xf6e7('0x15')](_0x400e30));if(_0x400e30[_0xf6e7('0x16')]){if(_0x400e30[_0xf6e7('0x16')][_0xf6e7('0x17')]===0x1f4){logger[_0xf6e7('0x16')](_0xf6e7('0x18'),_0x360f61,_0x400e30[_0xf6e7('0x16')][_0xf6e7('0x19')]);return _0x17ce96(_0x400e30['error']['message']);}logger[_0xf6e7('0x16')](_0xf6e7('0x18'),_0x360f61,_0x400e30[_0xf6e7('0x16')][_0xf6e7('0x19')]);return _0x2709c4(_0x400e30[_0xf6e7('0x16')]['message']);}else{logger['info'](_0xf6e7('0x18'),_0x360f61,'request\x20sent');_0x2709c4(_0x400e30[_0xf6e7('0x1a')][_0xf6e7('0x19')]);}})['catch'](function(_0x560314){logger[_0xf6e7('0x16')](_0xf6e7('0x18'),_0x360f61,_0x560314);_0x17ce96(_0x560314);});});}exports[_0xf6e7('0x1b')]=function(_0x404cd1){var _0x46a8c3=this;return new Promise(function(_0xd4ff53,_0x5a667d){return db[_0xf6e7('0x1c')][_0xf6e7('0x1d')]({'raw':_0x404cd1[_0xf6e7('0x1e')]?_0x404cd1['options'][_0xf6e7('0x1f')]===undefined?!![]:![]:!![],'where':_0x404cd1['options']?_0x404cd1[_0xf6e7('0x1e')][_0xf6e7('0x20')]||null:null,'attributes':_0x404cd1['options']?_0x404cd1['options'][_0xf6e7('0x21')]||null:null,'limit':_0x404cd1[_0xf6e7('0x1e')]?_0x404cd1[_0xf6e7('0x1e')][_0xf6e7('0x22')]||null:null,'include':_0x404cd1[_0xf6e7('0x1e')]?_0x404cd1[_0xf6e7('0x1e')][_0xf6e7('0x23')]?_[_0xf6e7('0x24')](_0x404cd1[_0xf6e7('0x1e')][_0xf6e7('0x23')],function(_0x592873){return{'model':db[_0x592873['model']],'as':_0x592873['as'],'attributes':_0x592873[_0xf6e7('0x21')],'include':_0x592873[_0xf6e7('0x23')]?_[_0xf6e7('0x24')](_0x592873['include'],function(_0x2f7cfd){return{'model':db[_0x2f7cfd[_0xf6e7('0x25')]],'as':_0x2f7cfd['as'],'attributes':_0x2f7cfd[_0xf6e7('0x21')],'include':_0x2f7cfd['include']?_[_0xf6e7('0x24')](_0x2f7cfd['include'],function(_0x1db128){return{'model':db[_0x1db128[_0xf6e7('0x25')]],'as':_0x1db128['as'],'attributes':_0x1db128[_0xf6e7('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf6e7('0x10')](function(_0x5a33fe){logger[_0xf6e7('0x11')](_0xf6e7('0x1b'),_0x404cd1);logger[_0xf6e7('0x12')](_0xf6e7('0x1b'),_0x404cd1,JSON[_0xf6e7('0x15')](_0x5a33fe));_0xd4ff53(_0x5a33fe);})[_0xf6e7('0x26')](function(_0x44e9a2){logger['error'](_0xf6e7('0x1b'),_0x44e9a2[_0xf6e7('0x19')],_0x404cd1);_0x5a667d(_0x46a8c3[_0xf6e7('0x16')](0x1f4,_0x44e9a2['message']));});});};exports[_0xf6e7('0x27')]=function(_0x1f4447){var _0x297926=this;return new Promise(function(_0x1e2c80,_0x5a3a8c){return db['SmsQueue'][_0xf6e7('0x28')]({'raw':_0x1f4447[_0xf6e7('0x1e')]?_0x1f4447[_0xf6e7('0x1e')][_0xf6e7('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f4447['options']?_0x1f4447[_0xf6e7('0x1e')][_0xf6e7('0x20')]||null:null,'attributes':_0x1f4447[_0xf6e7('0x1e')]?_0x1f4447[_0xf6e7('0x1e')][_0xf6e7('0x21')]||null:null,'include':_0x1f4447['options']?_0x1f4447['options'][_0xf6e7('0x23')]?_[_0xf6e7('0x24')](_0x1f4447['options'][_0xf6e7('0x23')],function(_0x2a2ae6){return{'model':db[_0x2a2ae6[_0xf6e7('0x25')]],'as':_0x2a2ae6['as'],'attributes':_0x2a2ae6[_0xf6e7('0x21')],'include':_0x2a2ae6[_0xf6e7('0x23')]?_[_0xf6e7('0x24')](_0x2a2ae6[_0xf6e7('0x23')],function(_0x1f390b){return{'model':db[_0x1f390b[_0xf6e7('0x25')]],'as':_0x1f390b['as'],'attributes':_0x1f390b[_0xf6e7('0x21')],'include':_0x1f390b[_0xf6e7('0x23')]?_[_0xf6e7('0x24')](_0x1f390b[_0xf6e7('0x23')],function(_0x4cc40c){return{'model':db[_0x4cc40c[_0xf6e7('0x25')]],'as':_0x4cc40c['as'],'attributes':_0x4cc40c[_0xf6e7('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf6e7('0x10')](function(_0x1f4c05){logger[_0xf6e7('0x11')](_0xf6e7('0x27'),_0x1f4447);logger[_0xf6e7('0x12')](_0xf6e7('0x27'),_0x1f4447,JSON[_0xf6e7('0x15')](_0x1f4c05));_0x1e2c80(_0x1f4c05);})['catch'](function(_0x204e52){logger[_0xf6e7('0x16')]('ShowSmsQueue',_0x204e52[_0xf6e7('0x19')],_0x1f4447);_0x5a3a8c(_0x297926[_0xf6e7('0x16')](0x1f4,_0x204e52[_0xf6e7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 35e2bb5..d1777cb 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 _0x37a4=['removeListener','length','smsQueue:','save','update','emit'];(function(_0x23257e,_0x108e5b){var _0x41199a=function(_0x11464b){while(--_0x11464b){_0x23257e['push'](_0x23257e['shift']());}};_0x41199a(++_0x108e5b);}(_0x37a4,0x1dd));var _0x437a=function(_0x379ad8,_0x13c7e3){_0x379ad8=_0x379ad8-0x0;var _0x11a862=_0x37a4[_0x379ad8];return _0x11a862;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x437a('0x0'),'remove',_0x437a('0x1')];function createListener(_0x47b4de,_0x1afddc){return function(_0x5828ed){_0x1afddc[_0x437a('0x2')](_0x47b4de,_0x5828ed);};}function removeListener(_0x452d46,_0x29526b){return function(){SmsQueueEvents[_0x437a('0x3')](_0x452d46,_0x29526b);};}exports['register']=function(_0x23d365){for(var _0x7b4b34=0x0,_0xe77051=events[_0x437a('0x4')];_0x7b4b34<_0xe77051;_0x7b4b34++){var _0x5de36f=events[_0x7b4b34];var _0x5a6155=createListener(_0x437a('0x5')+_0x5de36f,_0x23d365);SmsQueueEvents['on'](_0x5de36f,_0x5a6155);}}; \ No newline at end of file +var _0x6341=['removeListener','length','./smsQueue.events','remove','update','emit'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x6341,0x11c));var _0x1634=function(_0x34d522,_0x21c11d){_0x34d522=_0x34d522-0x0;var _0xe0525d=_0x6341[_0x34d522];return _0xe0525d;};'use strict';var SmsQueueEvents=require(_0x1634('0x0'));var events=['save',_0x1634('0x1'),_0x1634('0x2')];function createListener(_0x51da63,_0x4603f7){return function(_0x2aad48){_0x4603f7[_0x1634('0x3')](_0x51da63,_0x2aad48);};}function removeListener(_0xfccc5c,_0x150f27){return function(){SmsQueueEvents[_0x1634('0x4')](_0xfccc5c,_0x150f27);};}exports['register']=function(_0x2eb733){for(var _0x2d69f7=0x0,_0x52d5ee=events[_0x1634('0x5')];_0x2d69f7<_0x52d5ee;_0x2d69f7++){var _0x17dbae=events[_0x2d69f7];var _0x485f24=createListener('smsQueue:'+_0x17dbae,_0x2eb733);SmsQueueEvents['on'](_0x17dbae,_0x485f24);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index edded98..69e38de 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 _0x7789=['get','isAuthenticated','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x515dad,_0x453976){var _0x12f992=function(_0x2235de){while(--_0x2235de){_0x515dad['push'](_0x515dad['shift']());}};_0x12f992(++_0x453976);}(_0x7789,0x161));var _0x9778=function(_0x436b9e,_0x335d1b){_0x436b9e=_0x436b9e-0x0;var _0x46aa4a=_0x7789[_0x436b9e];return _0x46aa4a;};'use strict';var multer=require(_0x9778('0x0'));var util=require(_0x9778('0x1'));var path=require(_0x9778('0x2'));var timeout=require(_0x9778('0x3'));var express=require(_0x9778('0x4'));var router=express['Router']();var auth=require(_0x9778('0x5'));var interaction=require(_0x9778('0x6'));var config=require(_0x9778('0x7'));var controller=require('./smsQueueReport.controller');router[_0x9778('0x8')]('/',auth[_0x9778('0x9')](),controller['index']);router[_0x9778('0x8')](_0x9778('0xa'),auth['isAuthenticated'](),controller[_0x9778('0xb')]);router['get'](_0x9778('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9778('0xd')]('/',auth[_0x9778('0x9')](),controller['create']);router[_0x9778('0xe')](_0x9778('0xc'),auth[_0x9778('0x9')](),controller[_0x9778('0xf')]);router[_0x9778('0x10')](_0x9778('0xc'),auth[_0x9778('0x9')](),controller[_0x9778('0x11')]);module[_0x9778('0x12')]=router; \ No newline at end of file +var _0x4fa6=['get','isAuthenticated','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueueReport.controller'];(function(_0x141cfe,_0x249fd7){var _0x487671=function(_0x535dc2){while(--_0x535dc2){_0x141cfe['push'](_0x141cfe['shift']());}};_0x487671(++_0x249fd7);}(_0x4fa6,0x9b));var _0x64fa=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x4fa6[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require(_0x64fa('0x0'));var path=require(_0x64fa('0x1'));var timeout=require(_0x64fa('0x2'));var express=require(_0x64fa('0x3'));var router=express['Router']();var auth=require(_0x64fa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x64fa('0x5'));var controller=require(_0x64fa('0x6'));router[_0x64fa('0x7')]('/',auth[_0x64fa('0x8')](),controller['index']);router[_0x64fa('0x7')](_0x64fa('0x9'),auth[_0x64fa('0x8')](),controller[_0x64fa('0xa')]);router['get'](_0x64fa('0xb'),auth['isAuthenticated'](),controller[_0x64fa('0xc')]);router['post']('/',auth[_0x64fa('0x8')](),controller[_0x64fa('0xd')]);router['put']('/:id',auth[_0x64fa('0x8')](),controller[_0x64fa('0xe')]);router[_0x64fa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x64fa('0x10')]);module[_0x64fa('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 4bc2e60..ca75236 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 _0x505f=['moment','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x505f,0xc3));var _0xf505=function(_0xd4b1a0,_0x51247e){_0xd4b1a0=_0xd4b1a0-0x0;var _0x25b461=_0x505f[_0xd4b1a0];return _0x25b461;};'use strict';var moment=require(_0xf505('0x0'));var Sequelize=require(_0xf505('0x1'));module[_0xf505('0x2')]={'uniqueid':{'type':Sequelize[_0xf505('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf505('0x3')]},'joinAt':{'type':Sequelize[_0xf505('0x4')]},'leaveAt':{'type':Sequelize[_0xf505('0x4')]},'acceptAt':{'type':Sequelize[_0xf505('0x4')]},'exitAt':{'type':Sequelize[_0xf505('0x4')]},'reason':{'type':Sequelize[_0xf505('0x3')]}}; \ No newline at end of file +var _0xb200=['DATE','moment','sequelize','exports','STRING'];(function(_0x2a9ec5,_0xed23b){var _0x52c7c0=function(_0x54b22d){while(--_0x54b22d){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x52c7c0(++_0xed23b);}(_0xb200,0x173));var _0x0b20=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0xb200[_0x1305e3];return _0x1068e9;};'use strict';var moment=require(_0x0b20('0x0'));var Sequelize=require(_0x0b20('0x1'));module[_0x0b20('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0b20('0x3')]},'joinAt':{'type':Sequelize[_0x0b20('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0b20('0x4')]},'exitAt':{'type':Sequelize[_0x0b20('0x4')]},'reason':{'type':Sequelize[_0x0b20('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4c49c45..732789f 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 _0x860d=['then','sendStatus','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','rows','catch','params','rawAttributes','length','includeAll','merge','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update'];(function(_0x22b61f,_0x5886c8){var _0x55e512=function(_0x20009f){while(--_0x20009f){_0x22b61f['push'](_0x22b61f['shift']());}};_0x55e512(++_0x5886c8);}(_0x860d,0xff));var _0xd860=function(_0x5e8b46,_0x21eb4a){_0x5e8b46=_0x5e8b46-0x0;var _0x252814=_0x860d[_0x5e8b46];return _0x252814;};'use strict';var pdf=require(_0xd860('0x0'));var emlformat=require(_0xd860('0x1'));var rimraf=require(_0xd860('0x2'));var zipdir=require(_0xd860('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd860('0x4'));var BPromise=require(_0xd860('0x5'));var Mustache=require(_0xd860('0x6'));var util=require('util');var path=require(_0xd860('0x7'));var sox=require(_0xd860('0x8'));var csv=require(_0xd860('0x9'));var ejs=require(_0xd860('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd860('0xb'));var jsforce=require(_0xd860('0xc'));var deskjs=require(_0xd860('0xd'));var toCsv=require(_0xd860('0x9'));var querystring=require(_0xd860('0xe'));var Papa=require('papaparse');var Redis=require(_0xd860('0xf'));var authService=require(_0xd860('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd860('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd860('0x12'))('api');var utils=require(_0xd860('0x13'));var config=require(_0xd860('0x14'));var licenseUtil=require(_0xd860('0x15'));var db=require(_0xd860('0x16'))['db'];function respondWithStatusCode(_0xf4d6c5,_0x432d5c){_0x432d5c=_0x432d5c||0xcc;return function(_0x3bbabf){if(_0x3bbabf){return _0xf4d6c5['sendStatus'](_0x432d5c);}return _0xf4d6c5[_0xd860('0x17')](_0x432d5c)['end']();};}function respondWithResult(_0xd11c28,_0x3df8f8){_0x3df8f8=_0x3df8f8||0xc8;return function(_0x1cee5c){if(_0x1cee5c){return _0xd11c28['status'](_0x3df8f8)[_0xd860('0x18')](_0x1cee5c);}};}function respondWithFilteredResult(_0x37e4f0,_0x1b8334){return function(_0xabe8fd){if(_0xabe8fd){var _0x8303ef=_0xabe8fd[_0xd860('0x19')],_0x2bfe0d=_0x1b8334[_0xd860('0x1a')],_0x5c333c=_0x1b8334['offset']+_0x1b8334[_0xd860('0x1b')],_0x2fdeb4;if(_0x5c333c>=_0x8303ef){_0x5c333c=_0x8303ef;_0x2fdeb4=0xc8;}else{_0x2fdeb4=0xce;}_0x37e4f0[_0xd860('0x17')](_0x2fdeb4);return _0x37e4f0[_0xd860('0x1c')]('Content-Range',_0x2bfe0d+'-'+_0x5c333c+'/'+_0x8303ef)[_0xd860('0x18')](_0xabe8fd);}return null;};}function patchUpdates(_0x50a1ef){return function(_0x50a8f2){try{jsonpatch[_0xd860('0x1d')](_0x50a8f2,_0x50a1ef,!![]);}catch(_0x5916dd){return BPromise[_0xd860('0x1e')](_0x5916dd);}return _0x50a8f2[_0xd860('0x1f')]();};}function saveUpdates(_0x372fa4,_0x3e65b4){return function(_0x53bd59){if(_0x53bd59){return _0x53bd59[_0xd860('0x20')](_0x372fa4)[_0xd860('0x21')](function(_0x3d9a0e){return _0x3d9a0e;});}return null;};}function removeEntity(_0x5e82e3,_0x34ce00){return function(_0x145136){if(_0x145136){return _0x145136['destroy']()['then'](function(){_0x5e82e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b800,_0x35ad19){return function(_0x5ec818){if(!_0x5ec818){_0x44b800[_0xd860('0x22')](0x194);}return _0x5ec818;};}function handleError(_0x37000f,_0xe6c280){_0xe6c280=_0xe6c280||0x1f4;return function(_0x330660){logger[_0xd860('0x23')](_0x330660[_0xd860('0x24')]);if(_0x330660[_0xd860('0x25')]){delete _0x330660[_0xd860('0x25')];}_0x37000f[_0xd860('0x17')](_0xe6c280)[_0xd860('0x26')](_0x330660);};}exports[_0xd860('0x27')]=function(_0x3650d9,_0x30fc95){var _0x3a054f={},_0x216661={},_0x383bdf={'count':0x0,'rows':[]};var _0x528f4c=_[_0xd860('0x28')](db[_0xd860('0x29')]['rawAttributes'],function(_0x4bc401){return{'name':_0x4bc401[_0xd860('0x2a')],'type':_0x4bc401[_0xd860('0x2b')]['key']};});_0x216661[_0xd860('0x2c')]=_[_0xd860('0x28')](_0x528f4c,_0xd860('0x25'));_0x216661[_0xd860('0x2d')]=_[_0xd860('0x2e')](_0x3650d9[_0xd860('0x2d')]);_0x216661['filters']=_[_0xd860('0x2f')](_0x216661[_0xd860('0x2c')],_0x216661[_0xd860('0x2d')]);_0x3a054f[_0xd860('0x30')]=_[_0xd860('0x2f')](_0x216661[_0xd860('0x2c')],qs[_0xd860('0x31')](_0x3650d9[_0xd860('0x2d')][_0xd860('0x31')]));_0x3a054f[_0xd860('0x30')]=_0x3a054f[_0xd860('0x30')]['length']?_0x3a054f['attributes']:_0x216661[_0xd860('0x2c')];if(!_0x3650d9[_0xd860('0x2d')][_0xd860('0x32')](_0xd860('0x33'))){_0x3a054f[_0xd860('0x1b')]=qs[_0xd860('0x1b')](_0x3650d9[_0xd860('0x2d')]['limit']);_0x3a054f[_0xd860('0x1a')]=qs[_0xd860('0x1a')](_0x3650d9['query'][_0xd860('0x1a')]);}_0x3a054f[_0xd860('0x34')]=qs[_0xd860('0x35')](_0x3650d9[_0xd860('0x2d')][_0xd860('0x35')]);_0x3a054f[_0xd860('0x36')]=qs[_0xd860('0x37')](_[_0xd860('0x38')](_0x3650d9['query'],_0x216661[_0xd860('0x37')]),_0x528f4c);if(_0x3650d9[_0xd860('0x2d')][_0xd860('0x39')]){_0x3a054f[_0xd860('0x36')]=_['merge'](_0x3a054f['where'],{'$or':_[_0xd860('0x28')](_0x528f4c,function(_0x518cda){if(_0x518cda[_0xd860('0x2b')]!==_0xd860('0x3a')){var _0x168b81={};_0x168b81[_0x518cda['name']]={'$like':'%'+_0x3650d9['query'][_0xd860('0x39')]+'%'};return _0x168b81;}})});}_0x3a054f=_['merge']({},_0x3a054f,_0x3650d9[_0xd860('0x3b')]);var _0x3ddc36={'where':_0x3a054f['where']};return db[_0xd860('0x29')]['count'](_0x3ddc36)['then'](function(_0x3c2565){_0x383bdf[_0xd860('0x19')]=_0x3c2565;if(_0x3650d9[_0xd860('0x2d')]['includeAll']){_0x3a054f[_0xd860('0x3c')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x3a054f);})['then'](function(_0x4e84de){_0x383bdf[_0xd860('0x3d')]=_0x4e84de;return _0x383bdf;})['then'](respondWithFilteredResult(_0x30fc95,_0x3a054f))[_0xd860('0x3e')](handleError(_0x30fc95,null));};exports['show']=function(_0x571668,_0x1433b3){var _0x29876b={'raw':!![],'where':{'id':_0x571668[_0xd860('0x3f')]['id']}},_0x1ea65a={};_0x1ea65a[_0xd860('0x2c')]=_[_0xd860('0x2e')](db[_0xd860('0x29')][_0xd860('0x40')]);_0x1ea65a['query']=_[_0xd860('0x2e')](_0x571668[_0xd860('0x2d')]);_0x1ea65a[_0xd860('0x37')]=_[_0xd860('0x2f')](_0x1ea65a[_0xd860('0x2c')],_0x1ea65a[_0xd860('0x2d')]);_0x29876b[_0xd860('0x30')]=_['intersection'](_0x1ea65a['model'],qs[_0xd860('0x31')](_0x571668[_0xd860('0x2d')][_0xd860('0x31')]));_0x29876b[_0xd860('0x30')]=_0x29876b['attributes'][_0xd860('0x41')]?_0x29876b['attributes']:_0x1ea65a[_0xd860('0x2c')];if(_0x571668['query'][_0xd860('0x42')]){_0x29876b['include']=[{'all':!![]}];}_0x29876b=_[_0xd860('0x43')]({},_0x29876b,_0x571668[_0xd860('0x3b')]);return db[_0xd860('0x29')][_0xd860('0x44')](_0x29876b)[_0xd860('0x21')](handleEntityNotFound(_0x1433b3,null))[_0xd860('0x21')](respondWithResult(_0x1433b3,null))['catch'](handleError(_0x1433b3,null));};exports[_0xd860('0x45')]=function(_0x15af27,_0x1347b0){return db[_0xd860('0x29')]['create'](_0x15af27['body'],{})[_0xd860('0x21')](respondWithResult(_0x1347b0,0xc9))[_0xd860('0x3e')](handleError(_0x1347b0,null));};exports['update']=function(_0x32402c,_0x5e9590){if(_0x32402c[_0xd860('0x46')]['id']){delete _0x32402c[_0xd860('0x46')]['id'];}return db['SmsQueueReport'][_0xd860('0x44')]({'where':{'id':_0x32402c['params']['id']}})[_0xd860('0x21')](handleEntityNotFound(_0x5e9590,null))[_0xd860('0x21')](saveUpdates(_0x32402c[_0xd860('0x46')],null))[_0xd860('0x21')](respondWithResult(_0x5e9590,null))['catch'](handleError(_0x5e9590,null));};exports[_0xd860('0x47')]=function(_0x5c153a,_0x2a4a8c){return db[_0xd860('0x29')]['find']({'where':{'id':_0x5c153a['params']['id']}})[_0xd860('0x21')](handleEntityNotFound(_0x2a4a8c,null))[_0xd860('0x21')](removeEntity(_0x2a4a8c,null))[_0xd860('0x3e')](handleError(_0x2a4a8c,null));};exports['describe']=function(_0x217f0b,_0x59915c){return db[_0xd860('0x29')]['describe']()[_0xd860('0x21')](respondWithResult(_0x59915c,null))['catch'](handleError(_0x59915c,null));}; \ No newline at end of file +var _0xedd5=['stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','include','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','count','offset','limit','status','Content-Range','reject','save','update','then','destroy','error'];(function(_0x2f61a5,_0x4e1710){var _0x33642a=function(_0xd29cdb){while(--_0xd29cdb){_0x2f61a5['push'](_0x2f61a5['shift']());}};_0x33642a(++_0x4e1710);}(_0xedd5,0x6c));var _0x5edd=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xedd5[_0x2134b7];return _0x6c5914;};'use strict';var pdf=require(_0x5edd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5edd('0x1'));var zipdir=require(_0x5edd('0x2'));var jsonpatch=require(_0x5edd('0x3'));var rp=require('request-promise');var moment=require(_0x5edd('0x4'));var BPromise=require(_0x5edd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5edd('0x6'));var squel=require(_0x5edd('0x7'));var crypto=require(_0x5edd('0x8'));var jsforce=require(_0x5edd('0x9'));var deskjs=require(_0x5edd('0xa'));var toCsv=require(_0x5edd('0xb'));var querystring=require('querystring');var Papa=require(_0x5edd('0xc'));var Redis=require(_0x5edd('0xd'));var authService=require(_0x5edd('0xe'));var qs=require(_0x5edd('0xf'));var as=require(_0x5edd('0x10'));var hardwareService=require(_0x5edd('0x11'));var logger=require(_0x5edd('0x12'))(_0x5edd('0x13'));var utils=require(_0x5edd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5edd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ba52f,_0x1dc45b){_0x1dc45b=_0x1dc45b||0xcc;return function(_0x3ac0ca){if(_0x3ac0ca){return _0x1ba52f[_0x5edd('0x16')](_0x1dc45b);}return _0x1ba52f['status'](_0x1dc45b)[_0x5edd('0x17')]();};}function respondWithResult(_0x31977e,_0x4919a7){_0x4919a7=_0x4919a7||0xc8;return function(_0x37c34b){if(_0x37c34b){return _0x31977e['status'](_0x4919a7)[_0x5edd('0x18')](_0x37c34b);}};}function respondWithFilteredResult(_0x407ef8,_0x3d7d02){return function(_0x5e594b){if(_0x5e594b){var _0x507078=_0x5e594b[_0x5edd('0x19')],_0x3a14d7=_0x3d7d02[_0x5edd('0x1a')],_0x1a483f=_0x3d7d02[_0x5edd('0x1a')]+_0x3d7d02[_0x5edd('0x1b')],_0x40ffa4;if(_0x1a483f>=_0x507078){_0x1a483f=_0x507078;_0x40ffa4=0xc8;}else{_0x40ffa4=0xce;}_0x407ef8[_0x5edd('0x1c')](_0x40ffa4);return _0x407ef8['set'](_0x5edd('0x1d'),_0x3a14d7+'-'+_0x1a483f+'/'+_0x507078)[_0x5edd('0x18')](_0x5e594b);}return null;};}function patchUpdates(_0x4f0d85){return function(_0x491010){try{jsonpatch['apply'](_0x491010,_0x4f0d85,!![]);}catch(_0x1a1dbd){return BPromise[_0x5edd('0x1e')](_0x1a1dbd);}return _0x491010[_0x5edd('0x1f')]();};}function saveUpdates(_0x1c4b7e,_0x35df27){return function(_0x4ac59a){if(_0x4ac59a){return _0x4ac59a[_0x5edd('0x20')](_0x1c4b7e)[_0x5edd('0x21')](function(_0x20af76){return _0x20af76;});}return null;};}function removeEntity(_0x1ba7a0,_0xab8aab){return function(_0x178728){if(_0x178728){return _0x178728[_0x5edd('0x22')]()[_0x5edd('0x21')](function(){_0x1ba7a0['status'](0xcc)[_0x5edd('0x17')]();});}};}function handleEntityNotFound(_0x111ae6,_0x5e542e){return function(_0x459812){if(!_0x459812){_0x111ae6[_0x5edd('0x16')](0x194);}return _0x459812;};}function handleError(_0x550165,_0x136f33){_0x136f33=_0x136f33||0x1f4;return function(_0x1ec0f5){logger[_0x5edd('0x23')](_0x1ec0f5[_0x5edd('0x24')]);if(_0x1ec0f5[_0x5edd('0x25')]){delete _0x1ec0f5[_0x5edd('0x25')];}_0x550165[_0x5edd('0x1c')](_0x136f33)[_0x5edd('0x26')](_0x1ec0f5);};}exports[_0x5edd('0x27')]=function(_0x35c00b,_0x1be07a){var _0x5da2b1={},_0x23b2e8={},_0x1937cf={'count':0x0,'rows':[]};var _0x3a7e36=_[_0x5edd('0x28')](db[_0x5edd('0x29')][_0x5edd('0x2a')],function(_0xde727e){return{'name':_0xde727e[_0x5edd('0x2b')],'type':_0xde727e['type'][_0x5edd('0x2c')]};});_0x23b2e8[_0x5edd('0x2d')]=_[_0x5edd('0x28')](_0x3a7e36,_0x5edd('0x25'));_0x23b2e8[_0x5edd('0x2e')]=_[_0x5edd('0x2f')](_0x35c00b[_0x5edd('0x2e')]);_0x23b2e8['filters']=_[_0x5edd('0x30')](_0x23b2e8[_0x5edd('0x2d')],_0x23b2e8[_0x5edd('0x2e')]);_0x5da2b1[_0x5edd('0x31')]=_['intersection'](_0x23b2e8[_0x5edd('0x2d')],qs[_0x5edd('0x32')](_0x35c00b[_0x5edd('0x2e')]['fields']));_0x5da2b1[_0x5edd('0x31')]=_0x5da2b1[_0x5edd('0x31')][_0x5edd('0x33')]?_0x5da2b1[_0x5edd('0x31')]:_0x23b2e8[_0x5edd('0x2d')];if(!_0x35c00b['query']['hasOwnProperty'](_0x5edd('0x34'))){_0x5da2b1[_0x5edd('0x1b')]=qs[_0x5edd('0x1b')](_0x35c00b['query'][_0x5edd('0x1b')]);_0x5da2b1[_0x5edd('0x1a')]=qs[_0x5edd('0x1a')](_0x35c00b['query'][_0x5edd('0x1a')]);}_0x5da2b1[_0x5edd('0x35')]=qs[_0x5edd('0x36')](_0x35c00b[_0x5edd('0x2e')][_0x5edd('0x36')]);_0x5da2b1[_0x5edd('0x37')]=qs[_0x5edd('0x38')](_[_0x5edd('0x39')](_0x35c00b[_0x5edd('0x2e')],_0x23b2e8[_0x5edd('0x38')]),_0x3a7e36);if(_0x35c00b[_0x5edd('0x2e')][_0x5edd('0x3a')]){_0x5da2b1[_0x5edd('0x37')]=_[_0x5edd('0x3b')](_0x5da2b1[_0x5edd('0x37')],{'$or':_[_0x5edd('0x28')](_0x3a7e36,function(_0xaf8533){if(_0xaf8533[_0x5edd('0x3c')]!==_0x5edd('0x3d')){var _0x31eb5b={};_0x31eb5b[_0xaf8533[_0x5edd('0x25')]]={'$like':'%'+_0x35c00b['query'][_0x5edd('0x3a')]+'%'};return _0x31eb5b;}})});}_0x5da2b1=_['merge']({},_0x5da2b1,_0x35c00b[_0x5edd('0x3e')]);var _0x57a0ec={'where':_0x5da2b1['where']};return db[_0x5edd('0x29')]['count'](_0x57a0ec)[_0x5edd('0x21')](function(_0x278c1c){_0x1937cf['count']=_0x278c1c;if(_0x35c00b['query'][_0x5edd('0x3f')]){_0x5da2b1['include']=[{'all':!![]}];}return db[_0x5edd('0x29')]['findAll'](_0x5da2b1);})[_0x5edd('0x21')](function(_0x348356){_0x1937cf['rows']=_0x348356;return _0x1937cf;})['then'](respondWithFilteredResult(_0x1be07a,_0x5da2b1))[_0x5edd('0x40')](handleError(_0x1be07a,null));};exports[_0x5edd('0x41')]=function(_0x4a13f3,_0x5f3fd0){var _0x4ef98c={'raw':!![],'where':{'id':_0x4a13f3[_0x5edd('0x42')]['id']}},_0x471fcd={};_0x471fcd[_0x5edd('0x2d')]=_['keys'](db[_0x5edd('0x29')]['rawAttributes']);_0x471fcd[_0x5edd('0x2e')]=_[_0x5edd('0x2f')](_0x4a13f3[_0x5edd('0x2e')]);_0x471fcd[_0x5edd('0x38')]=_['intersection'](_0x471fcd[_0x5edd('0x2d')],_0x471fcd['query']);_0x4ef98c[_0x5edd('0x31')]=_[_0x5edd('0x30')](_0x471fcd[_0x5edd('0x2d')],qs[_0x5edd('0x32')](_0x4a13f3[_0x5edd('0x2e')][_0x5edd('0x32')]));_0x4ef98c['attributes']=_0x4ef98c[_0x5edd('0x31')][_0x5edd('0x33')]?_0x4ef98c[_0x5edd('0x31')]:_0x471fcd[_0x5edd('0x2d')];if(_0x4a13f3[_0x5edd('0x2e')][_0x5edd('0x3f')]){_0x4ef98c[_0x5edd('0x43')]=[{'all':!![]}];}_0x4ef98c=_[_0x5edd('0x3b')]({},_0x4ef98c,_0x4a13f3[_0x5edd('0x3e')]);return db[_0x5edd('0x29')]['find'](_0x4ef98c)[_0x5edd('0x21')](handleEntityNotFound(_0x5f3fd0,null))[_0x5edd('0x21')](respondWithResult(_0x5f3fd0,null))[_0x5edd('0x40')](handleError(_0x5f3fd0,null));};exports['create']=function(_0x406bd9,_0x3a7395){return db[_0x5edd('0x29')][_0x5edd('0x44')](_0x406bd9[_0x5edd('0x45')],{})[_0x5edd('0x21')](respondWithResult(_0x3a7395,0xc9))[_0x5edd('0x40')](handleError(_0x3a7395,null));};exports[_0x5edd('0x20')]=function(_0x80c48,_0x445f65){if(_0x80c48['body']['id']){delete _0x80c48[_0x5edd('0x45')]['id'];}return db[_0x5edd('0x29')][_0x5edd('0x46')]({'where':{'id':_0x80c48[_0x5edd('0x42')]['id']}})[_0x5edd('0x21')](handleEntityNotFound(_0x445f65,null))[_0x5edd('0x21')](saveUpdates(_0x80c48[_0x5edd('0x45')],null))['then'](respondWithResult(_0x445f65,null))[_0x5edd('0x40')](handleError(_0x445f65,null));};exports['destroy']=function(_0x1c779c,_0x276a8e){return db[_0x5edd('0x29')][_0x5edd('0x46')]({'where':{'id':_0x1c779c['params']['id']}})[_0x5edd('0x21')](handleEntityNotFound(_0x276a8e,null))[_0x5edd('0x21')](removeEntity(_0x276a8e,null))[_0x5edd('0x40')](handleError(_0x276a8e,null));};exports[_0x5edd('0x47')]=function(_0x1889b4,_0x4afe3d){return db['SmsQueueReport'][_0x5edd('0x47')]()[_0x5edd('0x21')](respondWithResult(_0x4afe3d,null))['catch'](handleError(_0x4afe3d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9474c61..e9f3478 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 _0xe739=['moment','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','uniqueid','lodash','../../config/logger','api'];(function(_0x2d28cf,_0xbc4f5f){var _0x486821=function(_0x3ce6f0){while(--_0x3ce6f0){_0x2d28cf['push'](_0x2d28cf['shift']());}};_0x486821(++_0xbc4f5f);}(_0xe739,0x105));var _0x9e73=function(_0x313133,_0x39f2e5){_0x313133=_0x313133-0x0;var _0x68f3bb=_0xe739[_0x313133];return _0x68f3bb;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var moment=require(_0x9e73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e73('0x4'));var config=require(_0x9e73('0x5'));var attributes=require(_0x9e73('0x6'));module[_0x9e73('0x7')]=function(_0x4cb2ed,_0x3db8fa){return _0x4cb2ed[_0x9e73('0x8')](_0x9e73('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x9e73('0xa'),'fields':[_0x9e73('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43ae=['report_sms_queue','lodash','util','api','moment','request-promise','path','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport'];(function(_0x5c86f8,_0x1671f8){var _0x4f9adb=function(_0x2f2f8d){while(--_0x2f2f8d){_0x5c86f8['push'](_0x5c86f8['shift']());}};_0x4f9adb(++_0x1671f8);}(_0x43ae,0x199));var _0xe43a=function(_0x4c9862,_0x11e53f){_0x4c9862=_0x4c9862-0x0;var _0x2395d7=_0x43ae[_0x4c9862];return _0x2395d7;};'use strict';var _=require(_0xe43a('0x0'));var util=require(_0xe43a('0x1'));var logger=require('../../config/logger')(_0xe43a('0x2'));var moment=require(_0xe43a('0x3'));var BPromise=require('bluebird');var rp=require(_0xe43a('0x4'));var fs=require('fs');var path=require(_0xe43a('0x5'));var rimraf=require(_0xe43a('0x6'));var config=require('../../config/environment');var attributes=require(_0xe43a('0x7'));module[_0xe43a('0x8')]=function(_0x30dc38,_0x2d2dca){return _0x30dc38[_0xe43a('0x9')](_0xe43a('0xa'),attributes,{'tableName':_0xe43a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','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 08dfb9f..0cf67c2 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 _0x7515=['update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','create','body','options','raw','info','UpdateSmsQueueReport','SmsQueueReport'];(function(_0x4ae683,_0x343b9e){var _0x537532=function(_0x62eded){while(--_0x62eded){_0x4ae683['push'](_0x4ae683['shift']());}};_0x537532(++_0x343b9e);}(_0x7515,0x1c2));var _0x5751=function(_0xcdcd20,_0x441b40){_0xcdcd20=_0xcdcd20-0x0;var _0x43f9d4=_0x7515[_0xcdcd20];return _0x43f9d4;};'use strict';var _=require(_0x5751('0x0'));var util=require(_0x5751('0x1'));var moment=require(_0x5751('0x2'));var BPromise=require(_0x5751('0x3'));var rs=require(_0x5751('0x4'));var fs=require('fs');var Redis=require(_0x5751('0x5'));var db=require(_0x5751('0x6'))['db'];var utils=require(_0x5751('0x7'));var logger=require(_0x5751('0x8'))(_0x5751('0x9'));var config=require(_0x5751('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38f313,_0x495faa,_0x3725a8){return new BPromise(function(_0x11fd33,_0x5f3151){return client[_0x5751('0xb')](_0x38f313,_0x3725a8)[_0x5751('0xc')](function(_0x41c52d){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x495faa,_0x5751('0xd'));logger[_0x5751('0xe')](_0x5751('0xf'),_0x495faa,_0x5751('0xd'),JSON[_0x5751('0x10')](_0x41c52d));if(_0x41c52d[_0x5751('0x11')]){if(_0x41c52d[_0x5751('0x11')][_0x5751('0x12')]===0x1f4){logger[_0x5751('0x11')](_0x5751('0x13'),_0x495faa,_0x41c52d[_0x5751('0x11')][_0x5751('0x14')]);return _0x5f3151(_0x41c52d[_0x5751('0x11')][_0x5751('0x14')]);}logger[_0x5751('0x11')](_0x5751('0x13'),_0x495faa,_0x41c52d[_0x5751('0x11')][_0x5751('0x14')]);return _0x11fd33(_0x41c52d['error'][_0x5751('0x14')]);}else{logger['info'](_0x5751('0x13'),_0x495faa,'request\x20sent');_0x11fd33(_0x41c52d['result']['message']);}})[_0x5751('0x15')](function(_0x3ed159){logger[_0x5751('0x11')](_0x5751('0x13'),_0x495faa,_0x3ed159);_0x5f3151(_0x3ed159);});});}exports[_0x5751('0x16')]=function(_0xdfa804){var _0x123c4a=this;return new Promise(function(_0xaebd36,_0x11c78f){return db['SmsQueueReport'][_0x5751('0x17')](_0xdfa804[_0x5751('0x18')],{'raw':_0xdfa804[_0x5751('0x19')]?_0xdfa804[_0x5751('0x19')][_0x5751('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xbaabd6){logger[_0x5751('0x1b')]('CreateSmsQueueReport',_0xdfa804);logger[_0x5751('0xe')](_0x5751('0x16'),_0xdfa804,JSON[_0x5751('0x10')](_0xbaabd6));_0xaebd36(_0xbaabd6);})['catch'](function(_0x39e40c){logger[_0x5751('0x11')](_0x5751('0x16'),_0x39e40c['message'],_0xdfa804);_0x11c78f(_0x123c4a['error'](0x1f4,_0x39e40c[_0x5751('0x14')]));});});};exports[_0x5751('0x1c')]=function(_0x23c518){var _0x737ef6=this;return new Promise(function(_0x17ca41,_0x3ff5fa){return db[_0x5751('0x1d')][_0x5751('0x1e')](_0x23c518['body'],{'raw':_0x23c518[_0x5751('0x19')]?_0x23c518[_0x5751('0x19')][_0x5751('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c518[_0x5751('0x19')]?_0x23c518['options']['where']||null:null,'attributes':_0x23c518[_0x5751('0x19')]?_0x23c518[_0x5751('0x19')][_0x5751('0x1f')]||null:null,'limit':_0x23c518[_0x5751('0x19')]?_0x23c518[_0x5751('0x19')]['limit']||null:null})['then'](function(_0x59b776){logger[_0x5751('0x1b')](_0x5751('0x1c'),_0x23c518);logger[_0x5751('0xe')](_0x5751('0x1c'),_0x23c518,JSON[_0x5751('0x10')](_0x59b776));_0x17ca41(_0x59b776);})[_0x5751('0x15')](function(_0x26197f){logger[_0x5751('0x11')]('UpdateSmsQueueReport',_0x26197f['message'],_0x23c518);_0x3ff5fa(_0x737ef6[_0x5751('0x11')](0x1f4,_0x26197f[_0x5751('0x14')]));});});}; \ No newline at end of file +var _0xace9=['CreateSmsQueueReport','create','body','options','raw','info','stringify','catch','UpdateSmsQueueReport','SmsQueueReport','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0xace9,0x160));var _0x9ace=function(_0x4041ef,_0x2e36ff){_0x4041ef=_0x4041ef-0x0;var _0x37f0a9=_0xace9[_0x4041ef];return _0x37f0a9;};'use strict';var _=require(_0x9ace('0x0'));var util=require('util');var moment=require(_0x9ace('0x1'));var BPromise=require(_0x9ace('0x2'));var rs=require(_0x9ace('0x3'));var fs=require('fs');var Redis=require(_0x9ace('0x4'));var db=require(_0x9ace('0x5'))['db'];var utils=require(_0x9ace('0x6'));var logger=require(_0x9ace('0x7'))(_0x9ace('0x8'));var config=require(_0x9ace('0x9'));var jayson=require(_0x9ace('0xa'));var client=jayson[_0x9ace('0xb')][_0x9ace('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23eb83,_0x3c78d9,_0x1a029c){return new BPromise(function(_0x42eaa0,_0x5cc71b){return client[_0x9ace('0xd')](_0x23eb83,_0x1a029c)[_0x9ace('0xe')](function(_0x1a2fc3){logger['info'](_0x9ace('0xf'),_0x3c78d9,_0x9ace('0x10'));logger[_0x9ace('0x11')](_0x9ace('0x12'),_0x3c78d9,_0x9ace('0x10'),JSON['stringify'](_0x1a2fc3));if(_0x1a2fc3['error']){if(_0x1a2fc3[_0x9ace('0x13')]['code']===0x1f4){logger[_0x9ace('0x13')](_0x9ace('0xf'),_0x3c78d9,_0x1a2fc3[_0x9ace('0x13')][_0x9ace('0x14')]);return _0x5cc71b(_0x1a2fc3[_0x9ace('0x13')][_0x9ace('0x14')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3c78d9,_0x1a2fc3[_0x9ace('0x13')][_0x9ace('0x14')]);return _0x42eaa0(_0x1a2fc3[_0x9ace('0x13')][_0x9ace('0x14')]);}else{logger['info'](_0x9ace('0xf'),_0x3c78d9,_0x9ace('0x10'));_0x42eaa0(_0x1a2fc3[_0x9ace('0x15')][_0x9ace('0x14')]);}})['catch'](function(_0xfbf7a1){logger[_0x9ace('0x13')](_0x9ace('0xf'),_0x3c78d9,_0xfbf7a1);_0x5cc71b(_0xfbf7a1);});});}exports[_0x9ace('0x16')]=function(_0x45873a){var _0x44293e=this;return new Promise(function(_0x538618,_0x4d5937){return db['SmsQueueReport'][_0x9ace('0x17')](_0x45873a[_0x9ace('0x18')],{'raw':_0x45873a['options']?_0x45873a[_0x9ace('0x19')][_0x9ace('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x395f50){logger[_0x9ace('0x1b')](_0x9ace('0x16'),_0x45873a);logger[_0x9ace('0x11')](_0x9ace('0x16'),_0x45873a,JSON[_0x9ace('0x1c')](_0x395f50));_0x538618(_0x395f50);})[_0x9ace('0x1d')](function(_0x2b5c73){logger[_0x9ace('0x13')](_0x9ace('0x16'),_0x2b5c73['message'],_0x45873a);_0x4d5937(_0x44293e[_0x9ace('0x13')](0x1f4,_0x2b5c73[_0x9ace('0x14')]));});});};exports[_0x9ace('0x1e')]=function(_0x565e66){var _0xb82fc3=this;return new Promise(function(_0x49ee61,_0x17e1b0){return db[_0x9ace('0x1f')]['update'](_0x565e66[_0x9ace('0x18')],{'raw':_0x565e66[_0x9ace('0x19')]?_0x565e66[_0x9ace('0x19')][_0x9ace('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565e66['options']?_0x565e66['options'][_0x9ace('0x20')]||null:null,'attributes':_0x565e66['options']?_0x565e66[_0x9ace('0x19')]['attributes']||null:null,'limit':_0x565e66[_0x9ace('0x19')]?_0x565e66[_0x9ace('0x19')][_0x9ace('0x21')]||null:null})[_0x9ace('0xe')](function(_0x5bc53e){logger['info'](_0x9ace('0x1e'),_0x565e66);logger['debug'](_0x9ace('0x1e'),_0x565e66,JSON['stringify'](_0x5bc53e));_0x49ee61(_0x5bc53e);})[_0x9ace('0x1d')](function(_0x3596e2){logger['error']('UpdateSmsQueueReport',_0x3596e2[_0x9ace('0x14')],_0x565e66);_0x17e1b0(_0xb82fc3[_0x9ace('0x13')](0x1f4,_0x3596e2[_0x9ace('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 938dad9..4e904e0 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 _0xda3f=['../../components/auth/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x3f9bd,_0x510fb9){var _0x52508b=function(_0x17dbfc){while(--_0x17dbfc){_0x3f9bd['push'](_0x3f9bd['shift']());}};_0x52508b(++_0x510fb9);}(_0xda3f,0xec));var _0xfda3=function(_0x2a8a3d,_0x446cb1){_0x2a8a3d=_0x2a8a3d-0x0;var _0x53580e=_0xda3f[_0x2a8a3d];return _0x53580e;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfda3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfda3('0x3'));var controller=require(_0xfda3('0x4'));router['get']('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0x6')]);router['get']('/describe',auth[_0xfda3('0x5')](),controller[_0xfda3('0x7')]);router[_0xfda3('0x8')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')]('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller['update']);router[_0xfda3('0xe')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xf')]);module[_0xfda3('0x10')]=router; \ No newline at end of file +var _0x4483=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','multer'];(function(_0x25ef1b,_0x27c972){var _0x2fd940=function(_0x5cf1bb){while(--_0x5cf1bb){_0x25ef1b['push'](_0x25ef1b['shift']());}};_0x2fd940(++_0x27c972);}(_0x4483,0x1a3));var _0x3448=function(_0x1be105,_0x2ef820){_0x1be105=_0x1be105-0x0;var _0x394135=_0x4483[_0x1be105];return _0x394135;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var auth=require(_0x3448('0x5'));var interaction=require(_0x3448('0x6'));var config=require(_0x3448('0x7'));var controller=require('./smsTransferReport.controller');router[_0x3448('0x8')]('/',auth[_0x3448('0x9')](),controller[_0x3448('0xa')]);router[_0x3448('0x8')](_0x3448('0xb'),auth[_0x3448('0x9')](),controller[_0x3448('0xc')]);router[_0x3448('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3448('0xd')]);router[_0x3448('0xe')]('/',auth[_0x3448('0x9')](),controller[_0x3448('0xf')]);router[_0x3448('0x10')](_0x3448('0x11'),auth[_0x3448('0x9')](),controller[_0x3448('0x12')]);router[_0x3448('0x13')](_0x3448('0x11'),auth[_0x3448('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 6fd37ff..03a0d2f 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 _0x7dca=['sequelize','STRING','ENUM','account','queue','DATE','moment'];(function(_0x482cf9,_0x496732){var _0x36c2a8=function(_0x6a8d81){while(--_0x6a8d81){_0x482cf9['push'](_0x482cf9['shift']());}};_0x36c2a8(++_0x496732);}(_0x7dca,0x76));var _0xa7dc=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x7dca[_0x5a9c0c];return _0x53c77d;};'use strict';var moment=require(_0xa7dc('0x0'));var Sequelize=require(_0xa7dc('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa7dc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa7dc('0x3')](_0xa7dc('0x4'),'agent',_0xa7dc('0x5')),'allowNull':![],'defaultValue':_0xa7dc('0x5')},'transferredAt':{'type':Sequelize[_0xa7dc('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa08a=['moment','exports','STRING','account','queue','DATE','NOW'];(function(_0x32b910,_0x92750e){var _0x373de1=function(_0x7c988){while(--_0x7c988){_0x32b910['push'](_0x32b910['shift']());}};_0x373de1(++_0x92750e);}(_0xa08a,0x1c0));var _0xaa08=function(_0x426711,_0x12264c){_0x426711=_0x426711-0x0;var _0x592991=_0xa08a[_0x426711];return _0x592991;};'use strict';var moment=require(_0xaa08('0x0'));var Sequelize=require('sequelize');module[_0xaa08('0x1')]={'uniqueid':{'type':Sequelize[_0xaa08('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaa08('0x3'),'agent',_0xaa08('0x4')),'allowNull':![],'defaultValue':_0xaa08('0x4')},'transferredAt':{'type':Sequelize[_0xaa08('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xaa08('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 883cdc2..a40b95e 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 _0x24cd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3b932a,_0x16d059){var _0x524678=function(_0x30cfe5){while(--_0x30cfe5){_0x3b932a['push'](_0x3b932a['shift']());}};_0x524678(++_0x16d059);}(_0x24cd,0x83));var _0xd24c=function(_0xd1292a,_0x427782){_0xd1292a=_0xd1292a-0x0;var _0x2fcfc3=_0x24cd[_0xd1292a];return _0x2fcfc3;};'use strict';var pdf=require(_0xd24c('0x0'));var emlformat=require(_0xd24c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd24c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd24c('0x3'));var moment=require(_0xd24c('0x4'));var BPromise=require(_0xd24c('0x5'));var Mustache=require('mustache');var util=require(_0xd24c('0x6'));var path=require(_0xd24c('0x7'));var sox=require('sox');var csv=require(_0xd24c('0x8'));var ejs=require(_0xd24c('0x9'));var fs=require('fs');var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0xf'));var authService=require(_0xd24c('0x10'));var qs=require(_0xd24c('0x11'));var as=require(_0xd24c('0x12'));var hardwareService=require(_0xd24c('0x13'));var logger=require(_0xd24c('0x14'))(_0xd24c('0x15'));var utils=require(_0xd24c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x17'));var db=require(_0xd24c('0x18'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x19')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1a')](_0x3296ea)[_0xd24c('0x1b')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1c')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=_0x34aa92['count'],_0x1a1111=_0x528489[_0xd24c('0x1d')],_0x3221a8=_0x528489[_0xd24c('0x1d')]+_0x528489[_0xd24c('0x1e')],_0x509992;if(_0x3221a8>=_0x3aa193){_0x3221a8=_0x3aa193;_0x509992=0xc8;}else{_0x509992=0xce;}_0xe096c['status'](_0x509992);return _0xe096c[_0xd24c('0x1f')](_0xd24c('0x20'),_0x1a1111+'-'+_0x3221a8+'/'+_0x3aa193)[_0xd24c('0x1c')](_0x34aa92);}return null;};}function patchUpdates(_0x62e228){return function(_0x478a0f){try{jsonpatch[_0xd24c('0x21')](_0x478a0f,_0x62e228,!![]);}catch(_0x56f8af){return BPromise[_0xd24c('0x22')](_0x56f8af);}return _0x478a0f[_0xd24c('0x23')]();};}function saveUpdates(_0x1b3a2f,_0x38c380){return function(_0x333416){if(_0x333416){return _0x333416[_0xd24c('0x24')](_0x1b3a2f)[_0xd24c('0x25')](function(_0x298d73){return _0x298d73;});}return null;};}function removeEntity(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')]()[_0xd24c('0x25')](function(){_0x17375b[_0xd24c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44471f,_0x2c3328){return function(_0x317eb0){if(!_0x317eb0){_0x44471f['sendStatus'](0x194);}return _0x317eb0;};}function handleError(_0x4539e7,_0x391cd5){_0x391cd5=_0x391cd5||0x1f4;return function(_0x848e0e){logger[_0xd24c('0x27')](_0x848e0e['stack']);if(_0x848e0e['name']){delete _0x848e0e[_0xd24c('0x28')];}_0x4539e7['status'](_0x391cd5)[_0xd24c('0x29')](_0x848e0e);};}exports[_0xd24c('0x2a')]=function(_0x325fcc,_0x4c0d99){var _0x4cb1b3={},_0x26fd85={},_0x14d44a={'count':0x0,'rows':[]};var _0x1a18b7=_[_0xd24c('0x2b')](db[_0xd24c('0x2c')][_0xd24c('0x2d')],function(_0x1be144){return{'name':_0x1be144[_0xd24c('0x2e')],'type':_0x1be144[_0xd24c('0x2f')][_0xd24c('0x30')]};});_0x26fd85[_0xd24c('0x31')]=_['map'](_0x1a18b7,_0xd24c('0x28'));_0x26fd85[_0xd24c('0x32')]=_[_0xd24c('0x33')](_0x325fcc[_0xd24c('0x32')]);_0x26fd85['filters']=_['intersection'](_0x26fd85[_0xd24c('0x31')],_0x26fd85[_0xd24c('0x32')]);_0x4cb1b3[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x26fd85['model'],qs[_0xd24c('0x36')](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x36')]));_0x4cb1b3[_0xd24c('0x34')]=_0x4cb1b3[_0xd24c('0x34')][_0xd24c('0x37')]?_0x4cb1b3[_0xd24c('0x34')]:_0x26fd85[_0xd24c('0x31')];if(!_0x325fcc[_0xd24c('0x32')]['hasOwnProperty'](_0xd24c('0x38'))){_0x4cb1b3['limit']=qs['limit'](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x1e')]);_0x4cb1b3[_0xd24c('0x1d')]=qs[_0xd24c('0x1d')](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x1d')]);}_0x4cb1b3[_0xd24c('0x39')]=qs['sort'](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3a')]);_0x4cb1b3[_0xd24c('0x3b')]=qs[_0xd24c('0x3c')](_[_0xd24c('0x3d')](_0x325fcc[_0xd24c('0x32')],_0x26fd85['filters']),_0x1a18b7);if(_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3e')]){_0x4cb1b3['where']=_[_0xd24c('0x3f')](_0x4cb1b3[_0xd24c('0x3b')],{'$or':_['map'](_0x1a18b7,function(_0x1e5718){if(_0x1e5718[_0xd24c('0x2f')]!=='VIRTUAL'){var _0x2e1cce={};_0x2e1cce[_0x1e5718[_0xd24c('0x28')]]={'$like':'%'+_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3e')]+'%'};return _0x2e1cce;}})});}_0x4cb1b3=_['merge']({},_0x4cb1b3,_0x325fcc[_0xd24c('0x40')]);var _0x5c2a39={'where':_0x4cb1b3[_0xd24c('0x3b')]};return db['SmsTransferReport']['count'](_0x5c2a39)['then'](function(_0x4160fb){_0x14d44a['count']=_0x4160fb;if(_0x325fcc['query'][_0xd24c('0x41')]){_0x4cb1b3[_0xd24c('0x42')]=[{'all':!![]}];}return db[_0xd24c('0x2c')][_0xd24c('0x43')](_0x4cb1b3);})['then'](function(_0xe5fe3a){_0x14d44a['rows']=_0xe5fe3a;return _0x14d44a;})[_0xd24c('0x25')](respondWithFilteredResult(_0x4c0d99,_0x4cb1b3))[_0xd24c('0x44')](handleError(_0x4c0d99,null));};exports[_0xd24c('0x45')]=function(_0x181836,_0x27eefa){var _0x5ee293={'raw':!![],'where':{'id':_0x181836[_0xd24c('0x46')]['id']}},_0x17f070={};_0x17f070[_0xd24c('0x31')]=_[_0xd24c('0x33')](db['SmsTransferReport'][_0xd24c('0x2d')]);_0x17f070[_0xd24c('0x32')]=_['keys'](_0x181836[_0xd24c('0x32')]);_0x17f070[_0xd24c('0x3c')]=_['intersection'](_0x17f070[_0xd24c('0x31')],_0x17f070['query']);_0x5ee293[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x17f070[_0xd24c('0x31')],qs[_0xd24c('0x36')](_0x181836[_0xd24c('0x32')]['fields']));_0x5ee293[_0xd24c('0x34')]=_0x5ee293['attributes'][_0xd24c('0x37')]?_0x5ee293['attributes']:_0x17f070[_0xd24c('0x31')];if(_0x181836[_0xd24c('0x32')]['includeAll']){_0x5ee293[_0xd24c('0x42')]=[{'all':!![]}];}_0x5ee293=_[_0xd24c('0x3f')]({},_0x5ee293,_0x181836['options']);return db[_0xd24c('0x2c')]['find'](_0x5ee293)['then'](handleEntityNotFound(_0x27eefa,null))['then'](respondWithResult(_0x27eefa,null))[_0xd24c('0x44')](handleError(_0x27eefa,null));};exports[_0xd24c('0x47')]=function(_0x490957,_0x516734){return db[_0xd24c('0x2c')][_0xd24c('0x47')](_0x490957[_0xd24c('0x48')],{})[_0xd24c('0x25')](respondWithResult(_0x516734,0xc9))['catch'](handleError(_0x516734,null));};exports[_0xd24c('0x24')]=function(_0x186348,_0x496694){if(_0x186348[_0xd24c('0x48')]['id']){delete _0x186348[_0xd24c('0x48')]['id'];}return db[_0xd24c('0x2c')]['find']({'where':{'id':_0x186348[_0xd24c('0x46')]['id']}})['then'](handleEntityNotFound(_0x496694,null))[_0xd24c('0x25')](saveUpdates(_0x186348[_0xd24c('0x48')],null))[_0xd24c('0x25')](respondWithResult(_0x496694,null))[_0xd24c('0x44')](handleError(_0x496694,null));};exports['destroy']=function(_0x14684c,_0x153dc4){return db[_0xd24c('0x2c')][_0xd24c('0x49')]({'where':{'id':_0x14684c[_0xd24c('0x46')]['id']}})[_0xd24c('0x25')](handleEntityNotFound(_0x153dc4,null))[_0xd24c('0x25')](removeEntity(_0x153dc4,null))[_0xd24c('0x44')](handleError(_0x153dc4,null));};exports[_0xd24c('0x4a')]=function(_0x3f29e6,_0x131e14){return db['SmsTransferReport'][_0xd24c('0x4a')]()[_0xd24c('0x25')](respondWithResult(_0x131e14,null))['catch'](handleError(_0x131e14,null));}; \ No newline at end of file +var _0x9b87=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x565de9,_0x114287){var _0x5f5dab=function(_0x264405){while(--_0x264405){_0x565de9['push'](_0x565de9['shift']());}};_0x5f5dab(++_0x114287);}(_0x9b87,0x8e));var _0x79b8=function(_0x171768,_0x2d4405){_0x171768=_0x171768-0x0;var _0x370f30=_0x9b87[_0x171768];return _0x370f30;};'use strict';var pdf=require(_0x79b8('0x0'));var emlformat=require(_0x79b8('0x1'));var rimraf=require(_0x79b8('0x2'));var zipdir=require(_0x79b8('0x3'));var jsonpatch=require(_0x79b8('0x4'));var rp=require(_0x79b8('0x5'));var moment=require(_0x79b8('0x6'));var BPromise=require(_0x79b8('0x7'));var Mustache=require(_0x79b8('0x8'));var util=require(_0x79b8('0x9'));var path=require(_0x79b8('0xa'));var sox=require(_0x79b8('0xb'));var csv=require(_0x79b8('0xc'));var ejs=require(_0x79b8('0xd'));var fs=require('fs');var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=_0x57a248[_0x79b8('0x1d')],_0x3e3de3=_0x21aae0[_0x79b8('0x1e')],_0x49e40b=_0x21aae0[_0x79b8('0x1e')]+_0x21aae0[_0x79b8('0x1f')],_0x5ef869;if(_0x49e40b>=_0x5ddab5){_0x49e40b=_0x5ddab5;_0x5ef869=0xc8;}else{_0x5ef869=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x5ef869);return _0x3142e9[_0x79b8('0x20')]('Content-Range',_0x3e3de3+'-'+_0x49e40b+'/'+_0x5ddab5)[_0x79b8('0x21')](_0x57a248);}return null;};}function patchUpdates(_0x5bdfb9){return function(_0x53d386){try{jsonpatch[_0x79b8('0x22')](_0x53d386,_0x5bdfb9,!![]);}catch(_0x131d04){return BPromise[_0x79b8('0x23')](_0x131d04);}return _0x53d386[_0x79b8('0x24')]();};}function saveUpdates(_0x1e24cf,_0x1e7507){return function(_0x3611c3){if(_0x3611c3){return _0x3611c3[_0x79b8('0x25')](_0x1e24cf)[_0x79b8('0x26')](function(_0x48ba32){return _0x48ba32;});}return null;};}function removeEntity(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){_0x3e9d83['status'](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x4f543f,_0x5e8228){return function(_0x257ea5){if(!_0x257ea5){_0x4f543f[_0x79b8('0x1a')](0x194);}return _0x257ea5;};}function handleError(_0x262b48,_0x665170){_0x665170=_0x665170||0x1f4;return function(_0x9deb6c){logger['error'](_0x9deb6c[_0x79b8('0x28')]);if(_0x9deb6c[_0x79b8('0x29')]){delete _0x9deb6c[_0x79b8('0x29')];}_0x262b48[_0x79b8('0x1b')](_0x665170)['send'](_0x9deb6c);};}exports[_0x79b8('0x2a')]=function(_0x2b6fad,_0x14a4d6){var _0x4aa92c={},_0x43a09e={},_0x4a4ef6={'count':0x0,'rows':[]};var _0x43058e=_[_0x79b8('0x2b')](db[_0x79b8('0x2c')][_0x79b8('0x2d')],function(_0x4f51d1){return{'name':_0x4f51d1[_0x79b8('0x2e')],'type':_0x4f51d1['type'][_0x79b8('0x2f')]};});_0x43a09e['model']=_[_0x79b8('0x2b')](_0x43058e,_0x79b8('0x29'));_0x43a09e[_0x79b8('0x30')]=_['keys'](_0x2b6fad[_0x79b8('0x30')]);_0x43a09e[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x43a09e[_0x79b8('0x33')],_0x43a09e['query']);_0x4aa92c[_0x79b8('0x34')]=_['intersection'](_0x43a09e['model'],qs[_0x79b8('0x35')](_0x2b6fad[_0x79b8('0x30')]['fields']));_0x4aa92c[_0x79b8('0x34')]=_0x4aa92c['attributes']['length']?_0x4aa92c[_0x79b8('0x34')]:_0x43a09e['model'];if(!_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x36')]('nolimit')){_0x4aa92c[_0x79b8('0x1f')]=qs[_0x79b8('0x1f')](_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x1f')]);_0x4aa92c[_0x79b8('0x1e')]=qs[_0x79b8('0x1e')](_0x2b6fad['query'][_0x79b8('0x1e')]);}_0x4aa92c[_0x79b8('0x37')]=qs[_0x79b8('0x38')](_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x38')]);_0x4aa92c[_0x79b8('0x39')]=qs[_0x79b8('0x31')](_[_0x79b8('0x3a')](_0x2b6fad[_0x79b8('0x30')],_0x43a09e[_0x79b8('0x31')]),_0x43058e);if(_0x2b6fad[_0x79b8('0x30')]['filter']){_0x4aa92c[_0x79b8('0x39')]=_[_0x79b8('0x3b')](_0x4aa92c[_0x79b8('0x39')],{'$or':_['map'](_0x43058e,function(_0x3cbf9b){if(_0x3cbf9b[_0x79b8('0x3c')]!==_0x79b8('0x3d')){var _0x1f0dea={};_0x1f0dea[_0x3cbf9b[_0x79b8('0x29')]]={'$like':'%'+_0x2b6fad[_0x79b8('0x30')]['filter']+'%'};return _0x1f0dea;}})});}_0x4aa92c=_[_0x79b8('0x3b')]({},_0x4aa92c,_0x2b6fad['options']);var _0x512d04={'where':_0x4aa92c[_0x79b8('0x39')]};return db['SmsTransferReport']['count'](_0x512d04)[_0x79b8('0x26')](function(_0x1f211a){_0x4a4ef6[_0x79b8('0x1d')]=_0x1f211a;if(_0x2b6fad[_0x79b8('0x30')][_0x79b8('0x3e')]){_0x4aa92c[_0x79b8('0x3f')]=[{'all':!![]}];}return db[_0x79b8('0x2c')][_0x79b8('0x40')](_0x4aa92c);})[_0x79b8('0x26')](function(_0x37fe86){_0x4a4ef6[_0x79b8('0x41')]=_0x37fe86;return _0x4a4ef6;})[_0x79b8('0x26')](respondWithFilteredResult(_0x14a4d6,_0x4aa92c))[_0x79b8('0x42')](handleError(_0x14a4d6,null));};exports['show']=function(_0x317fe2,_0x13b041){var _0x4da364={'raw':!![],'where':{'id':_0x317fe2[_0x79b8('0x43')]['id']}},_0x3c4ce7={};_0x3c4ce7['model']=_[_0x79b8('0x44')](db[_0x79b8('0x2c')][_0x79b8('0x2d')]);_0x3c4ce7[_0x79b8('0x30')]=_[_0x79b8('0x44')](_0x317fe2[_0x79b8('0x30')]);_0x3c4ce7[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x3c4ce7[_0x79b8('0x33')],_0x3c4ce7[_0x79b8('0x30')]);_0x4da364[_0x79b8('0x34')]=_[_0x79b8('0x32')](_0x3c4ce7['model'],qs['fields'](_0x317fe2[_0x79b8('0x30')][_0x79b8('0x35')]));_0x4da364[_0x79b8('0x34')]=_0x4da364[_0x79b8('0x34')]['length']?_0x4da364[_0x79b8('0x34')]:_0x3c4ce7[_0x79b8('0x33')];if(_0x317fe2[_0x79b8('0x30')][_0x79b8('0x3e')]){_0x4da364['include']=[{'all':!![]}];}_0x4da364=_[_0x79b8('0x3b')]({},_0x4da364,_0x317fe2[_0x79b8('0x45')]);return db[_0x79b8('0x2c')][_0x79b8('0x46')](_0x4da364)['then'](handleEntityNotFound(_0x13b041,null))[_0x79b8('0x26')](respondWithResult(_0x13b041,null))[_0x79b8('0x42')](handleError(_0x13b041,null));};exports[_0x79b8('0x47')]=function(_0x181f52,_0x354ddc){return db[_0x79b8('0x2c')]['create'](_0x181f52[_0x79b8('0x48')],{})[_0x79b8('0x26')](respondWithResult(_0x354ddc,0xc9))[_0x79b8('0x42')](handleError(_0x354ddc,null));};exports[_0x79b8('0x25')]=function(_0x478940,_0x49ec63){if(_0x478940[_0x79b8('0x48')]['id']){delete _0x478940[_0x79b8('0x48')]['id'];}return db[_0x79b8('0x2c')][_0x79b8('0x46')]({'where':{'id':_0x478940[_0x79b8('0x43')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x49ec63,null))[_0x79b8('0x26')](saveUpdates(_0x478940[_0x79b8('0x48')],null))[_0x79b8('0x26')](respondWithResult(_0x49ec63,null))['catch'](handleError(_0x49ec63,null));};exports[_0x79b8('0x27')]=function(_0x374fe9,_0xe82504){return db['SmsTransferReport'][_0x79b8('0x46')]({'where':{'id':_0x374fe9['params']['id']}})['then'](handleEntityNotFound(_0xe82504,null))[_0x79b8('0x26')](removeEntity(_0xe82504,null))[_0x79b8('0x42')](handleError(_0xe82504,null));};exports[_0x79b8('0x49')]=function(_0xac07cc,_0x4cdcf9){return db['SmsTransferReport'][_0x79b8('0x49')]()[_0x79b8('0x26')](respondWithResult(_0x4cdcf9,null))[_0x79b8('0x42')](handleError(_0x4cdcf9,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 61c424c..5d35a95 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','util'];(function(_0x5ad79c,_0x24f27c){var _0x5080a9=function(_0x3556e9){while(--_0x3556e9){_0x5ad79c['push'](_0x5ad79c['shift']());}};_0x5080a9(++_0x24f27c);}(_0x1261,0x144));var _0x1126=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x1261[_0x28d225];return _0x1f79e1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('SmsTransferReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ace=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','lodash','util','../../config/logger','api'];(function(_0x2f4005,_0x35f4d8){var _0x5bbc96=function(_0x54ba8a){while(--_0x54ba8a){_0x2f4005['push'](_0x2f4005['shift']());}};_0x5bbc96(++_0x35f4d8);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x33f3db,_0x19a892){_0x33f3db=_0x33f3db-0x0;var _0x2f7cbb=_0x8ace[_0x33f3db];return _0x2f7cbb;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));module[_0xe8ac('0xb')]=function(_0x170e14,_0x2b48ec){return _0x170e14['define'](_0xe8ac('0xc'),attributes,{'tableName':_0xe8ac('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','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 255d7a0..3659ddc 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 _0x8032=['code','SmsTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59de37,_0x255cf5){var _0x2532a5=function(_0x5ec6b2){while(--_0x5ec6b2){_0x59de37['push'](_0x59de37['shift']());}};_0x2532a5(++_0x255cf5);}(_0x8032,0xc1));var _0x2803=function(_0x84a85,_0x54e55c){_0x84a85=_0x84a85-0x0;var _0x1c2943=_0x8032[_0x84a85];return _0x1c2943;};'use strict';var _=require(_0x2803('0x0'));var util=require(_0x2803('0x1'));var moment=require('moment');var BPromise=require(_0x2803('0x2'));var rs=require(_0x2803('0x3'));var fs=require('fs');var Redis=require(_0x2803('0x4'));var db=require(_0x2803('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2803('0x6'))(_0x2803('0x7'));var config=require('../../config/environment');var jayson=require(_0x2803('0x8'));var client=jayson[_0x2803('0x9')][_0x2803('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xef3a87,_0x3bade1,_0x197700){return new BPromise(function(_0x44356e,_0x4e3c7b){return client[_0x2803('0xb')](_0xef3a87,_0x197700)['then'](function(_0x1ed089){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3bade1,_0x2803('0xc'));logger[_0x2803('0xd')](_0x2803('0xe'),_0x3bade1,_0x2803('0xc'),JSON[_0x2803('0xf')](_0x1ed089));if(_0x1ed089[_0x2803('0x10')]){if(_0x1ed089[_0x2803('0x10')][_0x2803('0x11')]===0x1f4){logger[_0x2803('0x10')](_0x2803('0x12'),_0x3bade1,_0x1ed089[_0x2803('0x10')][_0x2803('0x13')]);return _0x4e3c7b(_0x1ed089[_0x2803('0x10')][_0x2803('0x13')]);}logger[_0x2803('0x10')](_0x2803('0x12'),_0x3bade1,_0x1ed089[_0x2803('0x10')]['message']);return _0x44356e(_0x1ed089[_0x2803('0x10')][_0x2803('0x13')]);}else{logger['info'](_0x2803('0x12'),_0x3bade1,_0x2803('0xc'));_0x44356e(_0x1ed089['result'][_0x2803('0x13')]);}})[_0x2803('0x14')](function(_0x4682db){logger[_0x2803('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3bade1,_0x4682db);_0x4e3c7b(_0x4682db);});});} \ No newline at end of file +var _0xd84c=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x2f0304,_0x114eb4){var _0x20b30a=function(_0x397c48){while(--_0x397c48){_0x2f0304['push'](_0x2f0304['shift']());}};_0x20b30a(++_0x114eb4);}(_0xd84c,0x103));var _0xcd84=function(_0x41c054,_0xc89a30){_0x41c054=_0x41c054-0x0;var _0x457f5f=_0xd84c[_0x41c054];return _0x457f5f;};'use strict';var _=require(_0xcd84('0x0'));var util=require(_0xcd84('0x1'));var moment=require(_0xcd84('0x2'));var BPromise=require(_0xcd84('0x3'));var rs=require(_0xcd84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcd84('0x5'));var logger=require(_0xcd84('0x6'))('rpc');var config=require(_0xcd84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcd84('0x8')][_0xcd84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eaf15,_0x29a2b9,_0x273dbb){return new BPromise(function(_0x460675,_0xc8a3e8){return client[_0xcd84('0xa')](_0x4eaf15,_0x273dbb)[_0xcd84('0xb')](function(_0x4b72a9){logger[_0xcd84('0xc')](_0xcd84('0xd'),_0x29a2b9,_0xcd84('0xe'));logger['debug'](_0xcd84('0xf'),_0x29a2b9,_0xcd84('0xe'),JSON[_0xcd84('0x10')](_0x4b72a9));if(_0x4b72a9[_0xcd84('0x11')]){if(_0x4b72a9[_0xcd84('0x11')]['code']===0x1f4){logger[_0xcd84('0x11')](_0xcd84('0xd'),_0x29a2b9,_0x4b72a9[_0xcd84('0x11')][_0xcd84('0x12')]);return _0xc8a3e8(_0x4b72a9[_0xcd84('0x11')]['message']);}logger[_0xcd84('0x11')](_0xcd84('0xd'),_0x29a2b9,_0x4b72a9[_0xcd84('0x11')][_0xcd84('0x12')]);return _0x460675(_0x4b72a9[_0xcd84('0x11')][_0xcd84('0x12')]);}else{logger[_0xcd84('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x29a2b9,_0xcd84('0xe'));_0x460675(_0x4b72a9['result'][_0xcd84('0x12')]);}})[_0xcd84('0x13')](function(_0x50092c){logger[_0xcd84('0x11')](_0xcd84('0xd'),_0x29a2b9,_0x50092c);_0xc8a3e8(_0x50092c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b6ebd7a..ef751ee 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 _0x286f=['../../config/environment','get','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','create','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x286f,0x160));var _0xf286=function(_0x33ebf7,_0x4820e3){_0x33ebf7=_0x33ebf7-0x0;var _0xdc6fc4=_0x286f[_0x33ebf7];return _0xdc6fc4;};'use strict';var multer=require(_0xf286('0x0'));var util=require(_0xf286('0x1'));var path=require(_0xf286('0x2'));var timeout=require(_0xf286('0x3'));var express=require(_0xf286('0x4'));var router=express[_0xf286('0x5')]();var auth=require(_0xf286('0x6'));var interaction=require(_0xf286('0x7'));var config=require(_0xf286('0x8'));var controller=require('./sound.controller');router[_0xf286('0x9')]('/',auth[_0xf286('0xa')](),controller['index']);router[_0xf286('0x9')]('/:id',auth[_0xf286('0xa')](),controller[_0xf286('0xb')]);router[_0xf286('0x9')](_0xf286('0xc'),auth[_0xf286('0xa')](),controller[_0xf286('0xd')]);var upload=multer({'storage':multer[_0xf286('0xe')]({'destination':function(_0x704d5b,_0x587991,_0x7ddfc1){_0x7ddfc1(null,path[_0xf286('0xf')](config[_0xf286('0x10')],'server/files/sounds/original/'));},'filename':function(_0x3ccafa,_0x40ba19,_0x3c812b){_0x40ba19[_0xf286('0x11')]=_0x40ba19[_0xf286('0x11')][_0xf286('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c812b(null,util[_0xf286('0x13')](_0xf286('0x14'),path[_0xf286('0x15')](_0x40ba19[_0xf286('0x11')],path[_0xf286('0x16')](_0x40ba19[_0xf286('0x11')])),Date[_0xf286('0x17')](),path[_0xf286('0x16')](_0x40ba19[_0xf286('0x11')])));}})});router[_0xf286('0x18')]('/',upload['single'](_0xf286('0x19')),controller[_0xf286('0x1a')]);router[_0xf286('0x1b')](_0xf286('0x1c'),auth[_0xf286('0xa')](),controller['update']);router[_0xf286('0x1d')](_0xf286('0x1c'),auth['isAuthenticated'](),controller[_0xf286('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xaefc=['isAuthenticated','/:id/download','download','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id'];(function(_0x51ca86,_0x368813){var _0x168d27=function(_0x2a4f3a){while(--_0x2a4f3a){_0x51ca86['push'](_0x51ca86['shift']());}};_0x168d27(++_0x368813);}(_0xaefc,0x82));var _0xcaef=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0xaefc[_0x26bf51];return _0x503415;};'use strict';var multer=require(_0xcaef('0x0'));var util=require(_0xcaef('0x1'));var path=require(_0xcaef('0x2'));var timeout=require(_0xcaef('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xcaef('0x4'));var interaction=require(_0xcaef('0x5'));var config=require('../../config/environment');var controller=require(_0xcaef('0x6'));router[_0xcaef('0x7')]('/',auth['isAuthenticated'](),controller[_0xcaef('0x8')]);router[_0xcaef('0x7')](_0xcaef('0x9'),auth[_0xcaef('0xa')](),controller['show']);router[_0xcaef('0x7')](_0xcaef('0xb'),auth[_0xcaef('0xa')](),controller[_0xcaef('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x285063,_0x694717,_0x517481){_0x517481(null,path['join'](config[_0xcaef('0xd')],_0xcaef('0xe')));},'filename':function(_0x1649b9,_0x400a63,_0x2147e8){_0x400a63[_0xcaef('0xf')]=_0x400a63['originalname'][_0xcaef('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2147e8(null,util[_0xcaef('0x11')](_0xcaef('0x12'),path[_0xcaef('0x13')](_0x400a63[_0xcaef('0xf')],path[_0xcaef('0x14')](_0x400a63[_0xcaef('0xf')])),Date['now'](),path['extname'](_0x400a63['originalname'])));}})});router[_0xcaef('0x15')]('/',upload[_0xcaef('0x16')](_0xcaef('0x17')),controller['create']);router[_0xcaef('0x18')](_0xcaef('0x9'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x19')]);router[_0xcaef('0x1a')](_0xcaef('0x9'),auth['isAuthenticated'](),controller[_0xcaef('0x1a')]);module[_0xcaef('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index ecbdc36..6c0d299 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 _0x7144=['name','STRING','FLOAT','INTEGER','BIGINT'];(function(_0xd98def,_0x19ebc7){var _0x55b182=function(_0x1d3372){while(--_0x1d3372){_0xd98def['push'](_0xd98def['shift']());}};_0x55b182(++_0x19ebc7);}(_0x7144,0x8c));var _0x4714=function(_0x10fb3d,_0x33f9dc){_0x10fb3d=_0x10fb3d-0x0;var _0x33781f=_0x7144[_0x10fb3d];return _0x33781f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4714('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4714('0x1')]},'display_name':{'type':Sequelize[_0x4714('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4714('0x1')]},'original_format':{'type':Sequelize[_0x4714('0x1')]},'original_duration':{'type':Sequelize[_0x4714('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x4714('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x4714('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x4714('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4714('0x3')]},'converted_bitRate':{'type':Sequelize[_0x4714('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9fab=['name','FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x5c5c73,_0x457e4c){var _0x49c56b=function(_0x4b3c91){while(--_0x4b3c91){_0x5c5c73['push'](_0x5c5c73['shift']());}};_0x49c56b(++_0x457e4c);}(_0x9fab,0xf9));var _0xb9fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fab[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb9fa('0x0'));module[_0xb9fa('0x1')]={'name':{'type':Sequelize[_0xb9fa('0x2')],'unique':_0xb9fa('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb9fa('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xb9fa('0x2')]},'original_format':{'type':Sequelize[_0xb9fa('0x2')]},'original_duration':{'type':Sequelize[_0xb9fa('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xb9fa('0x5')]},'original_bitRate':{'type':Sequelize[_0xb9fa('0x6')]},'original_sampleRate':{'type':Sequelize[_0xb9fa('0x5')]},'converted_format':{'type':Sequelize[_0xb9fa('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xb9fa('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xb9fa('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8e65a28..4450106 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 _0xf0e8=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','keys','filters','intersection','include','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','format','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','src','original_duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','duration','converted_sampleCount','converted_channelCount','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf0e8,0x173));var _0x8f0e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf0e8[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x8f0e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8f0e('0x1'));var zipdir=require(_0x8f0e('0x2'));var jsonpatch=require(_0x8f0e('0x3'));var rp=require(_0x8f0e('0x4'));var moment=require(_0x8f0e('0x5'));var BPromise=require(_0x8f0e('0x6'));var Mustache=require(_0x8f0e('0x7'));var util=require(_0x8f0e('0x8'));var path=require(_0x8f0e('0x9'));var sox=require(_0x8f0e('0xa'));var csv=require(_0x8f0e('0xb'));var ejs=require(_0x8f0e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f0e('0xd'));var crypto=require(_0x8f0e('0xe'));var jsforce=require(_0x8f0e('0xf'));var deskjs=require(_0x8f0e('0x10'));var toCsv=require(_0x8f0e('0xb'));var querystring=require(_0x8f0e('0x11'));var Papa=require(_0x8f0e('0x12'));var Redis=require(_0x8f0e('0x13'));var authService=require(_0x8f0e('0x14'));var qs=require(_0x8f0e('0x15'));var as=require(_0x8f0e('0x16'));var hardwareService=require(_0x8f0e('0x17'));var logger=require(_0x8f0e('0x18'))(_0x8f0e('0x19'));var utils=require('../../config/utils');var config=require(_0x8f0e('0x1a'));var licenseUtil=require(_0x8f0e('0x1b'));var db=require(_0x8f0e('0x1c'))['db'];function respondWithStatusCode(_0x364f82,_0x1a8145){_0x1a8145=_0x1a8145||0xcc;return function(_0x269085){if(_0x269085){return _0x364f82['sendStatus'](_0x1a8145);}return _0x364f82['status'](_0x1a8145)[_0x8f0e('0x1d')]();};}function respondWithResult(_0x37d605,_0x53ca95){_0x53ca95=_0x53ca95||0xc8;return function(_0x134ae7){if(_0x134ae7){return _0x37d605['status'](_0x53ca95)[_0x8f0e('0x1e')](_0x134ae7);}};}function respondWithFilteredResult(_0xc72463,_0x7bd907){return function(_0x5d5f01){if(_0x5d5f01){var _0x577857=_0x5d5f01[_0x8f0e('0x1f')],_0x4dd04f=_0x7bd907[_0x8f0e('0x20')],_0x3f7a47=_0x7bd907['offset']+_0x7bd907[_0x8f0e('0x21')],_0x14befb;if(_0x3f7a47>=_0x577857){_0x3f7a47=_0x577857;_0x14befb=0xc8;}else{_0x14befb=0xce;}_0xc72463[_0x8f0e('0x22')](_0x14befb);return _0xc72463['set'](_0x8f0e('0x23'),_0x4dd04f+'-'+_0x3f7a47+'/'+_0x577857)[_0x8f0e('0x1e')](_0x5d5f01);}return null;};}function patchUpdates(_0xb1900c){return function(_0x9f9c15){try{jsonpatch[_0x8f0e('0x24')](_0x9f9c15,_0xb1900c,!![]);}catch(_0xfcd764){return BPromise[_0x8f0e('0x25')](_0xfcd764);}return _0x9f9c15[_0x8f0e('0x26')]();};}function saveUpdates(_0x493493,_0x1cc5e5){return function(_0x2238e7){if(_0x2238e7){return _0x2238e7[_0x8f0e('0x27')](_0x493493)[_0x8f0e('0x28')](function(_0x1bd4ec){return _0x1bd4ec;});}return null;};}function removeEntity(_0x219804,_0x2a2647){return function(_0x371ce3){if(_0x371ce3){return _0x371ce3[_0x8f0e('0x29')]()[_0x8f0e('0x28')](function(){var _0x36cea5=_0x371ce3[_0x8f0e('0x2a')]({'plain':!![]});var _0x32983c=_0x8f0e('0x2b');return db[_0x8f0e('0x2c')]['destroy']({'where':{'type':_0x32983c,'resourceId':_0x36cea5['id']}})[_0x8f0e('0x28')](function(){return _0x371ce3;});})['then'](function(){_0x219804[_0x8f0e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x455b30,_0x5e8bde){return function(_0x53dcba){if(!_0x53dcba){_0x455b30[_0x8f0e('0x2d')](0x194);}return _0x53dcba;};}function handleError(_0x3e8eeb,_0x18212f){_0x18212f=_0x18212f||0x1f4;return function(_0x3882a5){logger['error'](_0x3882a5[_0x8f0e('0x2e')]);if(_0x3882a5[_0x8f0e('0x2f')]){delete _0x3882a5['name'];}_0x3e8eeb[_0x8f0e('0x22')](_0x18212f)[_0x8f0e('0x30')](_0x3882a5);};}exports[_0x8f0e('0x31')]=function(_0x1ceec2,_0x56c3ec){var _0x2bc535={},_0x5aac82={},_0x4f850e={'count':0x0,'rows':[]};var _0x47ae50=_[_0x8f0e('0x32')](db[_0x8f0e('0x33')][_0x8f0e('0x34')],function(_0x199329){return{'name':_0x199329['fieldName'],'type':_0x199329[_0x8f0e('0x35')][_0x8f0e('0x36')]};});_0x5aac82[_0x8f0e('0x37')]=_[_0x8f0e('0x32')](_0x47ae50,_0x8f0e('0x2f'));_0x5aac82[_0x8f0e('0x38')]=_['keys'](_0x1ceec2[_0x8f0e('0x38')]);_0x5aac82['filters']=_['intersection'](_0x5aac82[_0x8f0e('0x37')],_0x5aac82[_0x8f0e('0x38')]);_0x2bc535[_0x8f0e('0x39')]=_['intersection'](_0x5aac82[_0x8f0e('0x37')],qs['fields'](_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x3a')]));_0x2bc535['attributes']=_0x2bc535[_0x8f0e('0x39')][_0x8f0e('0x3b')]?_0x2bc535['attributes']:_0x5aac82[_0x8f0e('0x37')];if(!_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x3c')]('nolimit')){_0x2bc535[_0x8f0e('0x21')]=qs['limit'](_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x21')]);_0x2bc535[_0x8f0e('0x20')]=qs[_0x8f0e('0x20')](_0x1ceec2['query'][_0x8f0e('0x20')]);}_0x2bc535[_0x8f0e('0x3d')]=qs[_0x8f0e('0x3e')](_0x1ceec2['query'][_0x8f0e('0x3e')]);_0x2bc535[_0x8f0e('0x3f')]=qs['filters'](_[_0x8f0e('0x40')](_0x1ceec2[_0x8f0e('0x38')],_0x5aac82['filters']),_0x47ae50);if(_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x41')]){_0x2bc535[_0x8f0e('0x3f')]=_['merge'](_0x2bc535[_0x8f0e('0x3f')],{'$or':_[_0x8f0e('0x32')](_0x47ae50,function(_0x426708){if(_0x426708[_0x8f0e('0x35')]!==_0x8f0e('0x42')){var _0x197e6e={};_0x197e6e[_0x426708['name']]={'$like':'%'+_0x1ceec2['query']['filter']+'%'};return _0x197e6e;}})});}_0x2bc535=_[_0x8f0e('0x43')]({},_0x2bc535,_0x1ceec2['options']);var _0x4726fe={'where':_0x2bc535['where']};return db[_0x8f0e('0x33')]['count'](_0x4726fe)[_0x8f0e('0x28')](function(_0x26aabc){_0x4f850e[_0x8f0e('0x1f')]=_0x26aabc;if(_0x1ceec2['query'][_0x8f0e('0x44')]){_0x2bc535['include']=[{'all':!![]}];}return db[_0x8f0e('0x33')][_0x8f0e('0x45')](_0x2bc535);})['then'](function(_0xc5777d){_0x4f850e['rows']=_0xc5777d;return _0x4f850e;})[_0x8f0e('0x28')](respondWithFilteredResult(_0x56c3ec,_0x2bc535))[_0x8f0e('0x46')](handleError(_0x56c3ec,null));};exports[_0x8f0e('0x47')]=function(_0x53f1af,_0x5ae124){var _0x1da02f={'raw':!![],'where':{'id':_0x53f1af[_0x8f0e('0x48')]['id']}},_0x530296={};_0x530296['model']=_[_0x8f0e('0x49')](db[_0x8f0e('0x33')][_0x8f0e('0x34')]);_0x530296[_0x8f0e('0x38')]=_[_0x8f0e('0x49')](_0x53f1af[_0x8f0e('0x38')]);_0x530296[_0x8f0e('0x4a')]=_[_0x8f0e('0x4b')](_0x530296[_0x8f0e('0x37')],_0x530296[_0x8f0e('0x38')]);_0x1da02f[_0x8f0e('0x39')]=_[_0x8f0e('0x4b')](_0x530296[_0x8f0e('0x37')],qs[_0x8f0e('0x3a')](_0x53f1af[_0x8f0e('0x38')][_0x8f0e('0x3a')]));_0x1da02f[_0x8f0e('0x39')]=_0x1da02f['attributes']['length']?_0x1da02f[_0x8f0e('0x39')]:_0x530296['model'];if(_0x53f1af[_0x8f0e('0x38')]['includeAll']){_0x1da02f[_0x8f0e('0x4c')]=[{'all':!![]}];}_0x1da02f=_[_0x8f0e('0x43')]({},_0x1da02f,_0x53f1af[_0x8f0e('0x4d')]);return db[_0x8f0e('0x33')][_0x8f0e('0x4e')](_0x1da02f)['then'](handleEntityNotFound(_0x5ae124,null))[_0x8f0e('0x28')](respondWithResult(_0x5ae124,null))['catch'](handleError(_0x5ae124,null));};exports[_0x8f0e('0x4f')]=function(_0x407322,_0x4404c2,_0x3ef821){return db[_0x8f0e('0x33')][_0x8f0e('0x4e')]({'where':{'id':_0x407322['params']['id']},'attributes':[_0x8f0e('0x2f'),_0x8f0e('0x50'),_0x8f0e('0x51')],'raw':!![]})[_0x8f0e('0x28')](handleEntityNotFound(_0x4404c2,null))['then'](function(_0x320a2b){if(_0x320a2b){if(!fs[_0x8f0e('0x52')](path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x55'),_0x320a2b['save_name']+'.'+_0x320a2b[_0x8f0e('0x51')]))){throw new db[(_0x8f0e('0x56'))][(_0x8f0e('0x57'))]('Sound\x20not\x20found');}return _0x4404c2[_0x8f0e('0x4f')](path['join'](config[_0x8f0e('0x54')],_0x8f0e('0x55'),util['format'](_0x8f0e('0x58'),_0x320a2b[_0x8f0e('0x50')],_0x320a2b['converted_format'])),util[_0x8f0e('0x59')]('%s.%s',_0x320a2b['name'],_0x320a2b[_0x8f0e('0x51')]));}return null;})['catch'](handleError(_0x4404c2,null));};exports[_0x8f0e('0x5a')]=function(_0x2f8925,_0x285c33,_0x547c7a){var _0x2e4076={'name':path[_0x8f0e('0x5b')](_0x2f8925[_0x8f0e('0x5c')]['originalname'],path[_0x8f0e('0x5d')](_0x2f8925[_0x8f0e('0x5c')][_0x8f0e('0x5e')])),'save_name':path['basename'](_0x2f8925[_0x8f0e('0x5c')][_0x8f0e('0x5f')],path[_0x8f0e('0x5d')](_0x2f8925['file']['filename'])),'original_format':path[_0x8f0e('0x5d')](_0x2f8925[_0x8f0e('0x5c')]['originalname'])[_0x8f0e('0x60')](0x1),'converted_format':_0x8f0e('0x61')};var _0x197837=path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x62'),_0x2f8925[_0x8f0e('0x5c')][_0x8f0e('0x5f')]);var _0x1b50b0=path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x55'),util[_0x8f0e('0x59')]('%s.%s',path['basename'](_0x2f8925['file']['filename'],path['extname'](_0x2f8925['file'][_0x8f0e('0x5f')])),_0x2e4076[_0x8f0e('0x51')]));logger[_0x8f0e('0x63')](_0x8f0e('0x64'),_0x197837);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1b50b0);try{fs[_0x8f0e('0x65')](_0x197837,parseInt('0777',0x8));var _0x28fef8=sox['transcode'](_0x197837,_0x1b50b0,{'sampleRate':0x1f40,'format':_0x8f0e('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x28fef8['on']('error',function(_0x51977b){fs['unlinkSync'](_0x197837);_0x285c33[_0x8f0e('0x22')](0x1f4)['send'](_0x51977b);});_0x28fef8['on'](_0x8f0e('0x66'),function(_0x2b02f3){_0x2e4076[_0x8f0e('0x67')]=isNaN(_0x2b02f3['duration'])?null:_0x2b02f3['duration']*0x3e8;_0x2e4076[_0x8f0e('0x68')]=isNaN(_0x2b02f3[_0x8f0e('0x69')])?null:_0x2b02f3[_0x8f0e('0x69')];_0x2e4076[_0x8f0e('0x6a')]=isNaN(_0x2b02f3[_0x8f0e('0x6b')])?null:_0x2b02f3[_0x8f0e('0x6b')];_0x2e4076[_0x8f0e('0x6c')]=isNaN(_0x2b02f3[_0x8f0e('0x6d')])?null:_0x2b02f3[_0x8f0e('0x6d')];_0x2e4076['original_sampleRate']=isNaN(_0x2b02f3['sampleRate'])?null:_0x2b02f3[_0x8f0e('0x6e')];});_0x28fef8['on']('dest',function(_0x4be8d5){_0x2e4076[_0x8f0e('0x6f')]=isNaN(_0x4be8d5[_0x8f0e('0x70')])?null:_0x4be8d5[_0x8f0e('0x70')]*0x3e8;_0x2e4076[_0x8f0e('0x71')]=isNaN(_0x4be8d5[_0x8f0e('0x69')])?null:_0x4be8d5[_0x8f0e('0x69')];_0x2e4076[_0x8f0e('0x72')]=isNaN(_0x4be8d5['channelCount'])?null:_0x4be8d5[_0x8f0e('0x6b')];_0x2e4076['converted_bitRate']=isNaN(_0x4be8d5[_0x8f0e('0x6d')])?null:_0x4be8d5[_0x8f0e('0x6d')];_0x2e4076['converted_sampleRate']=isNaN(_0x4be8d5[_0x8f0e('0x6e')])?null:_0x4be8d5['sampleRate'];});_0x28fef8['on'](_0x8f0e('0x1d'),function(){fs[_0x8f0e('0x65')](_0x1b50b0,parseInt(_0x8f0e('0x73'),0x8));return db[_0x8f0e('0x33')]['create'](_0x2e4076)[_0x8f0e('0x28')](function(_0x2af7f6){var _0x8af55f={'role':_0x2f8925[_0x8f0e('0x74')]['role'],'userProfileId':_0x2f8925['body'][_0x8f0e('0x75')]};if(!_0x8af55f)throw new Error(_0x8f0e('0x76'));if(_0x8af55f[_0x8f0e('0x77')]===_0x8f0e('0x78')){var _0xce9511=_0x2af7f6[_0x8f0e('0x2a')]({'plain':!![]});return db[_0x8f0e('0x79')][_0x8f0e('0x4e')]({'where':{'name':_0x8f0e('0x2b'),'userProfileId':_0x8af55f['userProfileId']},'raw':!![]})[_0x8f0e('0x28')](function(_0x3d7997){if(_0x3d7997&&_0x3d7997[_0x8f0e('0x7a')]===0x0){return db[_0x8f0e('0x2c')][_0x8f0e('0x5a')]({'name':_0xce9511[_0x8f0e('0x2f')],'resourceId':_0xce9511['id'],'type':_0x3d7997[_0x8f0e('0x2f')],'sectionId':_0x3d7997['id']},{})['then'](function(){return _0x2af7f6;});}else{return _0x2af7f6;}})['catch'](function(_0x54341c){logger[_0x8f0e('0x7b')](_0x8f0e('0x7c'),_0x54341c);throw _0x54341c;});}return _0x2af7f6;})[_0x8f0e('0x28')](respondWithResult(_0x285c33,null))[_0x8f0e('0x46')](handleError(_0x285c33,null));});_0x28fef8[_0x8f0e('0x7d')]();}catch(_0x58a4e5){_0x285c33['status'](0x1f4)[_0x8f0e('0x30')](_0x58a4e5);}};exports['update']=function(_0x5ba249,_0x3e3e0a,_0x3783c9){return db[_0x8f0e('0x33')][_0x8f0e('0x4e')]({'where':{'id':_0x5ba249[_0x8f0e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e3e0a,null))[_0x8f0e('0x28')](saveUpdates(_[_0x8f0e('0x40')](_0x5ba249[_0x8f0e('0x74')],['name',_0x8f0e('0x7e')]),null))[_0x8f0e('0x28')](respondWithResult(_0x3e3e0a,null))[_0x8f0e('0x46')](handleError(_0x3e3e0a,null));};exports['delete']=function(_0x2a3deb,_0x4fcd6d,_0x12f27f){return db[_0x8f0e('0x33')]['find']({'where':{'id':_0x2a3deb[_0x8f0e('0x48')]['id']}})[_0x8f0e('0x28')](function(_0x358a53){if(_0x358a53){return _0x358a53[_0x8f0e('0x29')]();}})[_0x8f0e('0x28')](function(_0x1dc40d){var _0x48759e=path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x62'),util[_0x8f0e('0x59')]('%s.%s',_0x1dc40d['save_name'],_0x1dc40d['original_format']));var _0xbd605a=path['join'](config[_0x8f0e('0x54')],_0x8f0e('0x55'),util[_0x8f0e('0x59')](_0x8f0e('0x58'),_0x1dc40d[_0x8f0e('0x50')],_0x1dc40d['converted_format']));fs[_0x8f0e('0x7f')](_0x48759e);fs['unlinkSync'](_0xbd605a);return _0x1dc40d;})[_0x8f0e('0x28')](function(_0x20111b){if(_0x20111b){return _0x4fcd6d[_0x8f0e('0x22')](0xcc)[_0x8f0e('0x1d')]();}})[_0x8f0e('0x28')](handleEntityNotFound(_0x4fcd6d,null))['catch'](handleError(_0x4fcd6d,null));}; \ No newline at end of file +var _0x9aae=['reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','format','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','sampleRate','0777','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','find','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0x268ae4,_0x4280bf){var _0x432e21=function(_0x51ce74){while(--_0x51ce74){_0x268ae4['push'](_0x268ae4['shift']());}};_0x432e21(++_0x4280bf);}(_0x9aae,0x1de));var _0xe9aa=function(_0x349f31,_0xf0ab94){_0x349f31=_0x349f31-0x0;var _0x1ed5a7=_0x9aae[_0x349f31];return _0x1ed5a7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9aa('0x0'));var rimraf=require(_0xe9aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9aa('0x2'));var rp=require(_0xe9aa('0x3'));var moment=require('moment');var BPromise=require(_0xe9aa('0x4'));var Mustache=require(_0xe9aa('0x5'));var util=require(_0xe9aa('0x6'));var path=require(_0xe9aa('0x7'));var sox=require(_0xe9aa('0x8'));var csv=require(_0xe9aa('0x9'));var ejs=require(_0xe9aa('0xa'));var fs=require('fs');var _=require(_0xe9aa('0xb'));var squel=require(_0xe9aa('0xc'));var crypto=require('crypto');var jsforce=require(_0xe9aa('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe9aa('0xe'));var Papa=require(_0xe9aa('0xf'));var Redis=require(_0xe9aa('0x10'));var authService=require(_0xe9aa('0x11'));var qs=require(_0xe9aa('0x12'));var as=require(_0xe9aa('0x13'));var hardwareService=require(_0xe9aa('0x14'));var logger=require(_0xe9aa('0x15'))(_0xe9aa('0x16'));var utils=require(_0xe9aa('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe9aa('0x18'));var db=require(_0xe9aa('0x19'))['db'];function respondWithStatusCode(_0x49547e,_0x2a3f34){_0x2a3f34=_0x2a3f34||0xcc;return function(_0x4207ec){if(_0x4207ec){return _0x49547e[_0xe9aa('0x1a')](_0x2a3f34);}return _0x49547e[_0xe9aa('0x1b')](_0x2a3f34)[_0xe9aa('0x1c')]();};}function respondWithResult(_0x3ee9ad,_0x451ce9){_0x451ce9=_0x451ce9||0xc8;return function(_0x536ed7){if(_0x536ed7){return _0x3ee9ad['status'](_0x451ce9)[_0xe9aa('0x1d')](_0x536ed7);}};}function respondWithFilteredResult(_0x23a6f3,_0x2c31e0){return function(_0x1d28b3){if(_0x1d28b3){var _0x1f23ac=_0x1d28b3[_0xe9aa('0x1e')],_0x47ab75=_0x2c31e0[_0xe9aa('0x1f')],_0x136aaf=_0x2c31e0['offset']+_0x2c31e0['limit'],_0x5466d2;if(_0x136aaf>=_0x1f23ac){_0x136aaf=_0x1f23ac;_0x5466d2=0xc8;}else{_0x5466d2=0xce;}_0x23a6f3[_0xe9aa('0x1b')](_0x5466d2);return _0x23a6f3[_0xe9aa('0x20')](_0xe9aa('0x21'),_0x47ab75+'-'+_0x136aaf+'/'+_0x1f23ac)['json'](_0x1d28b3);}return null;};}function patchUpdates(_0x32587d){return function(_0x8401d3){try{jsonpatch['apply'](_0x8401d3,_0x32587d,!![]);}catch(_0x4d1f55){return BPromise[_0xe9aa('0x22')](_0x4d1f55);}return _0x8401d3['save']();};}function saveUpdates(_0x3a523e,_0x27dd70){return function(_0x366718){if(_0x366718){return _0x366718[_0xe9aa('0x23')](_0x3a523e)[_0xe9aa('0x24')](function(_0x4c103a){return _0x4c103a;});}return null;};}function removeEntity(_0x594770,_0x5ce6ce){return function(_0x184732){if(_0x184732){return _0x184732[_0xe9aa('0x25')]()[_0xe9aa('0x24')](function(){var _0x1bd6fd=_0x184732[_0xe9aa('0x26')]({'plain':!![]});var _0x5f3b1b=_0xe9aa('0x27');return db[_0xe9aa('0x28')][_0xe9aa('0x25')]({'where':{'type':_0x5f3b1b,'resourceId':_0x1bd6fd['id']}})['then'](function(){return _0x184732;});})[_0xe9aa('0x24')](function(){_0x594770[_0xe9aa('0x1b')](0xcc)[_0xe9aa('0x1c')]();});}};}function handleEntityNotFound(_0x2062dc,_0x2fb0cc){return function(_0x41991d){if(!_0x41991d){_0x2062dc['sendStatus'](0x194);}return _0x41991d;};}function handleError(_0xd0b951,_0x555ba9){_0x555ba9=_0x555ba9||0x1f4;return function(_0x5eadb2){logger[_0xe9aa('0x29')](_0x5eadb2[_0xe9aa('0x2a')]);if(_0x5eadb2[_0xe9aa('0x2b')]){delete _0x5eadb2[_0xe9aa('0x2b')];}_0xd0b951['status'](_0x555ba9)[_0xe9aa('0x2c')](_0x5eadb2);};}exports[_0xe9aa('0x2d')]=function(_0x619723,_0x4152ad){var _0x505778={},_0x5e5b2d={},_0x5c9b5f={'count':0x0,'rows':[]};var _0x5f1eb7=_[_0xe9aa('0x2e')](db[_0xe9aa('0x2f')][_0xe9aa('0x30')],function(_0x2ee119){return{'name':_0x2ee119[_0xe9aa('0x31')],'type':_0x2ee119[_0xe9aa('0x32')][_0xe9aa('0x33')]};});_0x5e5b2d['model']=_[_0xe9aa('0x2e')](_0x5f1eb7,_0xe9aa('0x2b'));_0x5e5b2d['query']=_[_0xe9aa('0x34')](_0x619723['query']);_0x5e5b2d[_0xe9aa('0x35')]=_[_0xe9aa('0x36')](_0x5e5b2d[_0xe9aa('0x37')],_0x5e5b2d['query']);_0x505778[_0xe9aa('0x38')]=_[_0xe9aa('0x36')](_0x5e5b2d[_0xe9aa('0x37')],qs[_0xe9aa('0x39')](_0x619723['query']['fields']));_0x505778[_0xe9aa('0x38')]=_0x505778['attributes'][_0xe9aa('0x3a')]?_0x505778['attributes']:_0x5e5b2d[_0xe9aa('0x37')];if(!_0x619723[_0xe9aa('0x3b')][_0xe9aa('0x3c')]('nolimit')){_0x505778[_0xe9aa('0x3d')]=qs[_0xe9aa('0x3d')](_0x619723[_0xe9aa('0x3b')][_0xe9aa('0x3d')]);_0x505778[_0xe9aa('0x1f')]=qs[_0xe9aa('0x1f')](_0x619723[_0xe9aa('0x3b')][_0xe9aa('0x1f')]);}_0x505778[_0xe9aa('0x3e')]=qs[_0xe9aa('0x3f')](_0x619723[_0xe9aa('0x3b')]['sort']);_0x505778[_0xe9aa('0x40')]=qs[_0xe9aa('0x35')](_[_0xe9aa('0x41')](_0x619723['query'],_0x5e5b2d[_0xe9aa('0x35')]),_0x5f1eb7);if(_0x619723[_0xe9aa('0x3b')][_0xe9aa('0x42')]){_0x505778[_0xe9aa('0x40')]=_[_0xe9aa('0x43')](_0x505778['where'],{'$or':_[_0xe9aa('0x2e')](_0x5f1eb7,function(_0x2d537e){if(_0x2d537e[_0xe9aa('0x32')]!==_0xe9aa('0x44')){var _0x24aa72={};_0x24aa72[_0x2d537e['name']]={'$like':'%'+_0x619723[_0xe9aa('0x3b')][_0xe9aa('0x42')]+'%'};return _0x24aa72;}})});}_0x505778=_[_0xe9aa('0x43')]({},_0x505778,_0x619723[_0xe9aa('0x45')]);var _0x3b6877={'where':_0x505778[_0xe9aa('0x40')]};return db[_0xe9aa('0x2f')]['count'](_0x3b6877)[_0xe9aa('0x24')](function(_0x2d2c4a){_0x5c9b5f['count']=_0x2d2c4a;if(_0x619723[_0xe9aa('0x3b')]['includeAll']){_0x505778[_0xe9aa('0x46')]=[{'all':!![]}];}return db[_0xe9aa('0x2f')][_0xe9aa('0x47')](_0x505778);})[_0xe9aa('0x24')](function(_0x1537fb){_0x5c9b5f[_0xe9aa('0x48')]=_0x1537fb;return _0x5c9b5f;})['then'](respondWithFilteredResult(_0x4152ad,_0x505778))[_0xe9aa('0x49')](handleError(_0x4152ad,null));};exports['show']=function(_0x7d8bca,_0x3e2afb){var _0x58b180={'raw':!![],'where':{'id':_0x7d8bca[_0xe9aa('0x4a')]['id']}},_0x37ddee={};_0x37ddee['model']=_[_0xe9aa('0x34')](db[_0xe9aa('0x2f')][_0xe9aa('0x30')]);_0x37ddee['query']=_[_0xe9aa('0x34')](_0x7d8bca[_0xe9aa('0x3b')]);_0x37ddee['filters']=_[_0xe9aa('0x36')](_0x37ddee[_0xe9aa('0x37')],_0x37ddee[_0xe9aa('0x3b')]);_0x58b180[_0xe9aa('0x38')]=_[_0xe9aa('0x36')](_0x37ddee[_0xe9aa('0x37')],qs[_0xe9aa('0x39')](_0x7d8bca[_0xe9aa('0x3b')][_0xe9aa('0x39')]));_0x58b180[_0xe9aa('0x38')]=_0x58b180['attributes'][_0xe9aa('0x3a')]?_0x58b180[_0xe9aa('0x38')]:_0x37ddee[_0xe9aa('0x37')];if(_0x7d8bca['query'][_0xe9aa('0x4b')]){_0x58b180[_0xe9aa('0x46')]=[{'all':!![]}];}_0x58b180=_[_0xe9aa('0x43')]({},_0x58b180,_0x7d8bca[_0xe9aa('0x45')]);return db[_0xe9aa('0x2f')]['find'](_0x58b180)[_0xe9aa('0x24')](handleEntityNotFound(_0x3e2afb,null))[_0xe9aa('0x24')](respondWithResult(_0x3e2afb,null))[_0xe9aa('0x49')](handleError(_0x3e2afb,null));};exports['download']=function(_0xe2c783,_0x422a3a,_0x5b7198){return db[_0xe9aa('0x2f')]['find']({'where':{'id':_0xe2c783[_0xe9aa('0x4a')]['id']},'attributes':[_0xe9aa('0x2b'),_0xe9aa('0x4c'),_0xe9aa('0x4d')],'raw':!![]})[_0xe9aa('0x24')](handleEntityNotFound(_0x422a3a,null))['then'](function(_0x2cee4f){if(_0x2cee4f){if(!fs[_0xe9aa('0x4e')](path[_0xe9aa('0x4f')](config[_0xe9aa('0x50')],_0xe9aa('0x51'),_0x2cee4f[_0xe9aa('0x4c')]+'.'+_0x2cee4f['converted_format']))){throw new db[(_0xe9aa('0x52'))][(_0xe9aa('0x53'))]('Sound\x20not\x20found');}return _0x422a3a['download'](path['join'](config['root'],_0xe9aa('0x51'),util['format'](_0xe9aa('0x54'),_0x2cee4f[_0xe9aa('0x4c')],_0x2cee4f[_0xe9aa('0x4d')])),util['format'](_0xe9aa('0x54'),_0x2cee4f[_0xe9aa('0x2b')],_0x2cee4f['converted_format']));}return null;})[_0xe9aa('0x49')](handleError(_0x422a3a,null));};exports[_0xe9aa('0x55')]=function(_0x129c6e,_0xe97192,_0x12a17f){var _0x3405a7={'name':path[_0xe9aa('0x56')](_0x129c6e[_0xe9aa('0x57')][_0xe9aa('0x58')],path[_0xe9aa('0x59')](_0x129c6e[_0xe9aa('0x57')]['originalname'])),'save_name':path['basename'](_0x129c6e[_0xe9aa('0x57')][_0xe9aa('0x5a')],path[_0xe9aa('0x59')](_0x129c6e[_0xe9aa('0x57')]['filename'])),'original_format':path[_0xe9aa('0x59')](_0x129c6e[_0xe9aa('0x57')][_0xe9aa('0x58')])['substring'](0x1),'converted_format':_0xe9aa('0x5b')};var _0xdaa44f=path[_0xe9aa('0x4f')](config[_0xe9aa('0x50')],_0xe9aa('0x5c'),_0x129c6e['file'][_0xe9aa('0x5a')]);var _0x470b0a=path['join'](config['root'],_0xe9aa('0x51'),util[_0xe9aa('0x5d')](_0xe9aa('0x54'),path[_0xe9aa('0x56')](_0x129c6e[_0xe9aa('0x57')][_0xe9aa('0x5a')],path['extname'](_0x129c6e[_0xe9aa('0x57')]['filename'])),_0x3405a7[_0xe9aa('0x4d')]));logger['info'](_0xe9aa('0x5e'),_0xdaa44f);logger[_0xe9aa('0x5f')](_0xe9aa('0x60'),_0x470b0a);try{fs[_0xe9aa('0x61')](_0xdaa44f,parseInt('0777',0x8));var _0x512f7d=sox[_0xe9aa('0x62')](_0xdaa44f,_0x470b0a,{'sampleRate':0x1f40,'format':_0xe9aa('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x512f7d['on'](_0xe9aa('0x29'),function(_0x2eb863){fs[_0xe9aa('0x63')](_0xdaa44f);_0xe97192[_0xe9aa('0x1b')](0x1f4)[_0xe9aa('0x2c')](_0x2eb863);});_0x512f7d['on'](_0xe9aa('0x64'),function(_0xca11bd){_0x3405a7[_0xe9aa('0x65')]=isNaN(_0xca11bd[_0xe9aa('0x66')])?null:_0xca11bd[_0xe9aa('0x66')]*0x3e8;_0x3405a7[_0xe9aa('0x67')]=isNaN(_0xca11bd[_0xe9aa('0x68')])?null:_0xca11bd[_0xe9aa('0x68')];_0x3405a7[_0xe9aa('0x69')]=isNaN(_0xca11bd[_0xe9aa('0x6a')])?null:_0xca11bd[_0xe9aa('0x6a')];_0x3405a7[_0xe9aa('0x6b')]=isNaN(_0xca11bd[_0xe9aa('0x6c')])?null:_0xca11bd[_0xe9aa('0x6c')];_0x3405a7[_0xe9aa('0x6d')]=isNaN(_0xca11bd['sampleRate'])?null:_0xca11bd['sampleRate'];});_0x512f7d['on'](_0xe9aa('0x6e'),function(_0x24f06a){_0x3405a7[_0xe9aa('0x6f')]=isNaN(_0x24f06a[_0xe9aa('0x66')])?null:_0x24f06a[_0xe9aa('0x66')]*0x3e8;_0x3405a7[_0xe9aa('0x70')]=isNaN(_0x24f06a[_0xe9aa('0x68')])?null:_0x24f06a['sampleCount'];_0x3405a7[_0xe9aa('0x71')]=isNaN(_0x24f06a[_0xe9aa('0x6a')])?null:_0x24f06a[_0xe9aa('0x6a')];_0x3405a7['converted_bitRate']=isNaN(_0x24f06a['bitRate'])?null:_0x24f06a['bitRate'];_0x3405a7['converted_sampleRate']=isNaN(_0x24f06a[_0xe9aa('0x72')])?null:_0x24f06a[_0xe9aa('0x72')];});_0x512f7d['on'](_0xe9aa('0x1c'),function(){fs[_0xe9aa('0x61')](_0x470b0a,parseInt(_0xe9aa('0x73'),0x8));return db[_0xe9aa('0x2f')][_0xe9aa('0x55')](_0x3405a7)[_0xe9aa('0x24')](function(_0xc5269b){var _0x2b5c93={'role':_0x129c6e[_0xe9aa('0x74')]['role'],'userProfileId':_0x129c6e['body']['userProfileId']};if(!_0x2b5c93)throw new Error(_0xe9aa('0x75'));if(_0x2b5c93[_0xe9aa('0x76')]===_0xe9aa('0x77')){var _0x278873=_0xc5269b[_0xe9aa('0x26')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe9aa('0x27'),'userProfileId':_0x2b5c93[_0xe9aa('0x78')]},'raw':!![]})[_0xe9aa('0x24')](function(_0x4bc566){if(_0x4bc566&&_0x4bc566[_0xe9aa('0x79')]===0x0){return db['UserProfileResource'][_0xe9aa('0x55')]({'name':_0x278873[_0xe9aa('0x2b')],'resourceId':_0x278873['id'],'type':_0x4bc566['name'],'sectionId':_0x4bc566['id']},{})[_0xe9aa('0x24')](function(){return _0xc5269b;});}else{return _0xc5269b;}})[_0xe9aa('0x49')](function(_0x44b37e){logger[_0xe9aa('0x29')](_0xe9aa('0x7a'),_0x44b37e);throw _0x44b37e;});}return _0xc5269b;})[_0xe9aa('0x24')](respondWithResult(_0xe97192,null))[_0xe9aa('0x49')](handleError(_0xe97192,null));});_0x512f7d[_0xe9aa('0x7b')]();}catch(_0x92a3d7){_0xe97192[_0xe9aa('0x1b')](0x1f4)[_0xe9aa('0x2c')](_0x92a3d7);}};exports[_0xe9aa('0x23')]=function(_0x23c7ed,_0x50448e,_0xd02402){return db[_0xe9aa('0x2f')][_0xe9aa('0x7c')]({'where':{'id':_0x23c7ed[_0xe9aa('0x4a')]['id']}})[_0xe9aa('0x24')](handleEntityNotFound(_0x50448e,null))['then'](saveUpdates(_[_0xe9aa('0x41')](_0x23c7ed['body'],[_0xe9aa('0x2b'),_0xe9aa('0x7d')]),null))[_0xe9aa('0x24')](respondWithResult(_0x50448e,null))['catch'](handleError(_0x50448e,null));};exports[_0xe9aa('0x7e')]=function(_0x5f18c4,_0x39a7f6,_0x12da7f){return db[_0xe9aa('0x2f')][_0xe9aa('0x7c')]({'where':{'id':_0x5f18c4[_0xe9aa('0x4a')]['id']}})[_0xe9aa('0x24')](function(_0x1de1b5){if(_0x1de1b5){return _0x1de1b5[_0xe9aa('0x25')]();}})[_0xe9aa('0x24')](function(_0x3fd5cb){var _0x285f51=path[_0xe9aa('0x4f')](config[_0xe9aa('0x50')],_0xe9aa('0x5c'),util[_0xe9aa('0x5d')](_0xe9aa('0x54'),_0x3fd5cb[_0xe9aa('0x4c')],_0x3fd5cb[_0xe9aa('0x7f')]));var _0x27a436=path[_0xe9aa('0x4f')](config[_0xe9aa('0x50')],_0xe9aa('0x51'),util[_0xe9aa('0x5d')](_0xe9aa('0x54'),_0x3fd5cb[_0xe9aa('0x4c')],_0x3fd5cb[_0xe9aa('0x4d')]));fs['unlinkSync'](_0x285f51);fs[_0xe9aa('0x63')](_0x27a436);return _0x3fd5cb;})[_0xe9aa('0x24')](function(_0x33c770){if(_0x33c770){return _0x39a7f6[_0xe9aa('0x1b')](0xcc)[_0xe9aa('0x1c')]();}})[_0xe9aa('0x24')](handleEntityNotFound(_0x39a7f6,null))[_0xe9aa('0x49')](handleError(_0x39a7f6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a3fb3d6..dcae8ad 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 _0x4682=['define','Sound','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x2e3065,_0x1e21bd){var _0x3a59d1=function(_0x1520f0){while(--_0x1520f0){_0x2e3065['push'](_0x2e3065['shift']());}};_0x3a59d1(++_0x1e21bd);}(_0x4682,0xa7));var _0x2468=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4682[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x2468('0x0'));var util=require(_0x2468('0x1'));var logger=require('../../config/logger')(_0x2468('0x2'));var moment=require('moment');var BPromise=require(_0x2468('0x3'));var rp=require(_0x2468('0x4'));var fs=require('fs');var path=require(_0x2468('0x5'));var rimraf=require(_0x2468('0x6'));var config=require(_0x2468('0x7'));var attributes=require(_0x2468('0x8'));module['exports']=function(_0x2e6fa6,_0x4b9592){return _0x2e6fa6[_0x2468('0x9')](_0x2468('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3800=['./sound.attributes','exports','Sound','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3800,0x121));var _0x0380=function(_0xe5eec9,_0x5ae27e){_0xe5eec9=_0xe5eec9-0x0;var _0x5db7f1=_0x3800[_0xe5eec9];return _0x5db7f1;};'use strict';var _=require(_0x0380('0x0'));var util=require(_0x0380('0x1'));var logger=require(_0x0380('0x2'))(_0x0380('0x3'));var moment=require(_0x0380('0x4'));var BPromise=require(_0x0380('0x5'));var rp=require(_0x0380('0x6'));var fs=require('fs');var path=require(_0x0380('0x7'));var rimraf=require(_0x0380('0x8'));var config=require(_0x0380('0x9'));var attributes=require(_0x0380('0xa'));module[_0x0380('0xb')]=function(_0x5d7ca6,_0x556733){return _0x5d7ca6['define'](_0x0380('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 70854f7..354cdbd 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 _0xc788=['debug','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','include','map','attributes','model'];(function(_0x550c75,_0x1d84fe){var _0x28624b=function(_0x37df51){while(--_0x37df51){_0x550c75['push'](_0x550c75['shift']());}};_0x28624b(++_0x1d84fe);}(_0xc788,0x156));var _0x8c78=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0xc788[_0x169a8a];return _0x2e8502;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c78('0x0'));var BPromise=require('bluebird');var rs=require(_0x8c78('0x1'));var fs=require('fs');var Redis=require(_0x8c78('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c78('0x3'));var logger=require('../../config/logger')(_0x8c78('0x4'));var config=require(_0x8c78('0x5'));var jayson=require(_0x8c78('0x6'));var client=jayson[_0x8c78('0x7')][_0x8c78('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a17ba,_0x426cd5,_0x4733f0){return new BPromise(function(_0x393e51,_0x187a80){return client[_0x8c78('0x9')](_0x4a17ba,_0x4733f0)[_0x8c78('0xa')](function(_0x2b9bef){logger[_0x8c78('0xb')](_0x8c78('0xc'),_0x426cd5,'request\x20sent');logger['debug'](_0x8c78('0xd'),_0x426cd5,_0x8c78('0xe'),JSON['stringify'](_0x2b9bef));if(_0x2b9bef[_0x8c78('0xf')]){if(_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x10')]===0x1f4){logger['error'](_0x8c78('0xc'),_0x426cd5,_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x11')]);return _0x187a80(_0x2b9bef[_0x8c78('0xf')]['message']);}logger[_0x8c78('0xf')]('Sound,\x20%s,\x20%s',_0x426cd5,_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x11')]);return _0x393e51(_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xb')]('Sound,\x20%s,\x20%s',_0x426cd5,_0x8c78('0xe'));_0x393e51(_0x2b9bef[_0x8c78('0x12')][_0x8c78('0x11')]);}})[_0x8c78('0x13')](function(_0x4483a5){logger['error'](_0x8c78('0xc'),_0x426cd5,_0x4483a5);_0x187a80(_0x4483a5);});});}exports[_0x8c78('0x14')]=function(_0x554fb1){var _0x6ff759=this;return new Promise(function(_0x39e1fc,_0x4d711a){return db[_0x8c78('0x15')][_0x8c78('0x16')]({'raw':_0x554fb1[_0x8c78('0x17')]?_0x554fb1[_0x8c78('0x17')][_0x8c78('0x18')]===undefined?!![]:![]:!![],'where':_0x554fb1['options']?_0x554fb1[_0x8c78('0x17')][_0x8c78('0x19')]||null:null,'attributes':_0x554fb1['options']?_0x554fb1[_0x8c78('0x17')]['attributes']||null:null,'include':_0x554fb1[_0x8c78('0x17')]?_0x554fb1[_0x8c78('0x17')][_0x8c78('0x1a')]?_[_0x8c78('0x1b')](_0x554fb1['options'][_0x8c78('0x1a')],function(_0x21fedb){return{'model':db[_0x21fedb['model']],'as':_0x21fedb['as'],'attributes':_0x21fedb[_0x8c78('0x1c')],'include':_0x21fedb[_0x8c78('0x1a')]?_[_0x8c78('0x1b')](_0x21fedb['include'],function(_0x32a779){return{'model':db[_0x32a779[_0x8c78('0x1d')]],'as':_0x32a779['as'],'attributes':_0x32a779[_0x8c78('0x1c')],'include':_0x32a779[_0x8c78('0x1a')]?_['map'](_0x32a779[_0x8c78('0x1a')],function(_0x76e138){return{'model':db[_0x76e138[_0x8c78('0x1d')]],'as':_0x76e138['as'],'attributes':_0x76e138['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x295334){logger[_0x8c78('0xb')](_0x8c78('0x14'),_0x554fb1);logger[_0x8c78('0x1e')](_0x8c78('0x14'),_0x554fb1,JSON['stringify'](_0x295334));_0x39e1fc(_0x295334);})[_0x8c78('0x13')](function(_0x329850){logger[_0x8c78('0xf')](_0x8c78('0x14'),_0x329850['message'],_0x554fb1);_0x4d711a(_0x6ff759[_0x8c78('0xf')](0x1f4,_0x329850[_0x8c78('0x11')]));});});}; \ No newline at end of file +var _0x10cd=['include','model','map','attributes','ShowSound','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','Sound','options','raw','where'];(function(_0x2bf780,_0x15b8a9){var _0x4cb3ec=function(_0x41af64){while(--_0x41af64){_0x2bf780['push'](_0x2bf780['shift']());}};_0x4cb3ec(++_0x15b8a9);}(_0x10cd,0x1f3));var _0xd10c=function(_0x4c762f,_0x41455f){_0x4c762f=_0x4c762f-0x0;var _0x3cdb43=_0x10cd[_0x4c762f];return _0x3cdb43;};'use strict';var _=require(_0xd10c('0x0'));var util=require(_0xd10c('0x1'));var moment=require('moment');var BPromise=require(_0xd10c('0x2'));var rs=require(_0xd10c('0x3'));var fs=require('fs');var Redis=require(_0xd10c('0x4'));var db=require(_0xd10c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd10c('0x6'))(_0xd10c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd10c('0x8'));var client=jayson[_0xd10c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48cd3f,_0x5b7e4c,_0x47252c){return new BPromise(function(_0x167461,_0x592021){return client['request'](_0x48cd3f,_0x47252c)[_0xd10c('0xa')](function(_0x5919af){logger[_0xd10c('0xb')](_0xd10c('0xc'),_0x5b7e4c,_0xd10c('0xd'));logger[_0xd10c('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x5b7e4c,_0xd10c('0xd'),JSON[_0xd10c('0xf')](_0x5919af));if(_0x5919af['error']){if(_0x5919af[_0xd10c('0x10')][_0xd10c('0x11')]===0x1f4){logger[_0xd10c('0x10')](_0xd10c('0xc'),_0x5b7e4c,_0x5919af[_0xd10c('0x10')][_0xd10c('0x12')]);return _0x592021(_0x5919af['error'][_0xd10c('0x12')]);}logger[_0xd10c('0x10')](_0xd10c('0xc'),_0x5b7e4c,_0x5919af[_0xd10c('0x10')][_0xd10c('0x12')]);return _0x167461(_0x5919af['error'][_0xd10c('0x12')]);}else{logger[_0xd10c('0xb')]('Sound,\x20%s,\x20%s',_0x5b7e4c,'request\x20sent');_0x167461(_0x5919af['result'][_0xd10c('0x12')]);}})['catch'](function(_0x1b853c){logger[_0xd10c('0x10')](_0xd10c('0xc'),_0x5b7e4c,_0x1b853c);_0x592021(_0x1b853c);});});}exports['ShowSound']=function(_0x40328){var _0x578943=this;return new Promise(function(_0x39c646,_0x28c8f0){return db[_0xd10c('0x13')]['find']({'raw':_0x40328[_0xd10c('0x14')]?_0x40328['options'][_0xd10c('0x15')]===undefined?!![]:![]:!![],'where':_0x40328['options']?_0x40328[_0xd10c('0x14')][_0xd10c('0x16')]||null:null,'attributes':_0x40328[_0xd10c('0x14')]?_0x40328[_0xd10c('0x14')]['attributes']||null:null,'include':_0x40328['options']?_0x40328['options'][_0xd10c('0x17')]?_['map'](_0x40328[_0xd10c('0x14')][_0xd10c('0x17')],function(_0x3a9da8){return{'model':db[_0x3a9da8[_0xd10c('0x18')]],'as':_0x3a9da8['as'],'attributes':_0x3a9da8['attributes'],'include':_0x3a9da8[_0xd10c('0x17')]?_[_0xd10c('0x19')](_0x3a9da8[_0xd10c('0x17')],function(_0x24ef68){return{'model':db[_0x24ef68[_0xd10c('0x18')]],'as':_0x24ef68['as'],'attributes':_0x24ef68[_0xd10c('0x1a')],'include':_0x24ef68[_0xd10c('0x17')]?_[_0xd10c('0x19')](_0x24ef68[_0xd10c('0x17')],function(_0x2b347e){return{'model':db[_0x2b347e[_0xd10c('0x18')]],'as':_0x2b347e['as'],'attributes':_0x2b347e[_0xd10c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd10c('0xa')](function(_0x570bc2){logger[_0xd10c('0xb')]('ShowSound',_0x40328);logger[_0xd10c('0xe')](_0xd10c('0x1b'),_0x40328,JSON[_0xd10c('0xf')](_0x570bc2));_0x39c646(_0x570bc2);})[_0xd10c('0x1c')](function(_0xce5636){logger[_0xd10c('0x10')]('ShowSound',_0xce5636['message'],_0x40328);_0x28c8f0(_0x578943[_0xd10c('0x10')](0x1f4,_0xce5636['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 434b04b..c4c5a1a 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 _0x136d=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','/:id','show','create'];(function(_0x26bfb4,_0x1673ed){var _0x53579a=function(_0x256635){while(--_0x256635){_0x26bfb4['push'](_0x26bfb4['shift']());}};_0x53579a(++_0x1673ed);}(_0x136d,0x135));var _0xd136=function(_0x179c89,_0x3a69b2){_0x179c89=_0x179c89-0x0;var _0x4b87e5=_0x136d[_0x179c89];return _0x4b87e5;};'use strict';var multer=require(_0xd136('0x0'));var util=require(_0xd136('0x1'));var path=require(_0xd136('0x2'));var timeout=require(_0xd136('0x3'));var express=require(_0xd136('0x4'));var router=express[_0xd136('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd136('0x6'));var config=require(_0xd136('0x7'));var controller=require(_0xd136('0x8'));router['get']('/',auth[_0xd136('0x9')](),controller['index']);router[_0xd136('0xa')](_0xd136('0xb'),auth[_0xd136('0x9')](),controller[_0xd136('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd136('0xd')]);router['put']('/:id',auth[_0xd136('0x9')](),controller[_0xd136('0xe')]);router[_0xd136('0xf')](_0xd136('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd136('0x10')]=router; \ No newline at end of file +var _0x9fee=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x58c513,_0x15deec){var _0x4da4c4=function(_0x112a83){while(--_0x112a83){_0x58c513['push'](_0x58c513['shift']());}};_0x4da4c4(++_0x15deec);}(_0x9fee,0x153));var _0xe9fe=function(_0x411061,_0x24a185){_0x411061=_0x411061-0x0;var _0x4ed903=_0x9fee[_0x411061];return _0x4ed903;};'use strict';var multer=require(_0xe9fe('0x0'));var util=require(_0xe9fe('0x1'));var path=require(_0xe9fe('0x2'));var timeout=require(_0xe9fe('0x3'));var express=require(_0xe9fe('0x4'));var router=express[_0xe9fe('0x5')]();var auth=require(_0xe9fe('0x6'));var interaction=require(_0xe9fe('0x7'));var config=require(_0xe9fe('0x8'));var controller=require('./squareMessage.controller');router[_0xe9fe('0x9')]('/',auth[_0xe9fe('0xa')](),controller[_0xe9fe('0xb')]);router[_0xe9fe('0x9')](_0xe9fe('0xc'),auth[_0xe9fe('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe9fe('0xd')]);router[_0xe9fe('0xe')](_0xe9fe('0xc'),auth['isAuthenticated'](),controller[_0xe9fe('0xf')]);router[_0xe9fe('0x10')](_0xe9fe('0xc'),auth[_0xe9fe('0xa')](),controller[_0xe9fe('0x11')]);module[_0xe9fe('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4a68bf0..189696a 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 _0x4b84=['medium','out','STRING','TEXT','sequelize','exports'];(function(_0x2ccf5e,_0x1fe9d9){var _0x3fcd82=function(_0x37e85e){while(--_0x37e85e){_0x2ccf5e['push'](_0x2ccf5e['shift']());}};_0x3fcd82(++_0x1fe9d9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x4b84[_0x22bee0];return _0x2d295b;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x44b8('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x44b8('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x44b8('0x4')]},'providerResponse':{'type':Sequelize[_0x44b8('0x5')]}}; \ No newline at end of file +var _0xa630=['medium','out','STRING','TEXT','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa630,0xbe));var _0x0a63=function(_0x407b65,_0x5a0e0f){_0x407b65=_0x407b65-0x0;var _0x51ffa2=_0xa630[_0x407b65];return _0x51ffa2;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x0a63('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0a63('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x0a63('0x4')]},'providerResponse':{'type':Sequelize[_0x0a63('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 24b4ddf..dfca6ac 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 _0xfeb7=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','SquareMessage','catch','params','include','create','body','update','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xfeb7,0xc9));var _0x7feb=function(_0x5201c5,_0xb32238){_0x5201c5=_0x5201c5-0x0;var _0x3bf676=_0xfeb7[_0x5201c5];return _0x3bf676;};'use strict';var pdf=require(_0x7feb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7feb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7feb('0x2'));var rp=require(_0x7feb('0x3'));var moment=require(_0x7feb('0x4'));var BPromise=require(_0x7feb('0x5'));var Mustache=require(_0x7feb('0x6'));var util=require(_0x7feb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7feb('0x8'));var ejs=require(_0x7feb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7feb('0xa'));var crypto=require(_0x7feb('0xb'));var jsforce=require(_0x7feb('0xc'));var deskjs=require(_0x7feb('0xd'));var toCsv=require(_0x7feb('0x8'));var querystring=require(_0x7feb('0xe'));var Papa=require(_0x7feb('0xf'));var Redis=require('ioredis');var authService=require(_0x7feb('0x10'));var qs=require(_0x7feb('0x11'));var as=require(_0x7feb('0x12'));var hardwareService=require(_0x7feb('0x13'));var logger=require(_0x7feb('0x14'))('api');var utils=require(_0x7feb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7feb('0x16'));var db=require(_0x7feb('0x17'))['db'];function respondWithStatusCode(_0x55924d,_0x2702ad){_0x2702ad=_0x2702ad||0xcc;return function(_0x5a8127){if(_0x5a8127){return _0x55924d[_0x7feb('0x18')](_0x2702ad);}return _0x55924d[_0x7feb('0x19')](_0x2702ad)[_0x7feb('0x1a')]();};}function respondWithResult(_0x1f9b23,_0x4c0f19){_0x4c0f19=_0x4c0f19||0xc8;return function(_0x1c4c8f){if(_0x1c4c8f){return _0x1f9b23['status'](_0x4c0f19)['json'](_0x1c4c8f);}};}function respondWithFilteredResult(_0x442c2,_0x3768b5){return function(_0x37bd59){if(_0x37bd59){var _0x33fab8=_0x37bd59[_0x7feb('0x1b')],_0x10569e=_0x3768b5[_0x7feb('0x1c')],_0x4d09ae=_0x3768b5[_0x7feb('0x1c')]+_0x3768b5[_0x7feb('0x1d')],_0x7f8b55;if(_0x4d09ae>=_0x33fab8){_0x4d09ae=_0x33fab8;_0x7f8b55=0xc8;}else{_0x7f8b55=0xce;}_0x442c2[_0x7feb('0x19')](_0x7f8b55);return _0x442c2[_0x7feb('0x1e')](_0x7feb('0x1f'),_0x10569e+'-'+_0x4d09ae+'/'+_0x33fab8)[_0x7feb('0x20')](_0x37bd59);}return null;};}function patchUpdates(_0xbb3f9c){return function(_0x3cc709){try{jsonpatch[_0x7feb('0x21')](_0x3cc709,_0xbb3f9c,!![]);}catch(_0x223e2b){return BPromise[_0x7feb('0x22')](_0x223e2b);}return _0x3cc709[_0x7feb('0x23')]();};}function saveUpdates(_0xe7f23e,_0xe0c78c){return function(_0xa57717){if(_0xa57717){return _0xa57717['update'](_0xe7f23e)['then'](function(_0x2204fb){return _0x2204fb;});}return null;};}function removeEntity(_0x3388f4,_0x7c4c90){return function(_0x47508c){if(_0x47508c){return _0x47508c[_0x7feb('0x24')]()[_0x7feb('0x25')](function(){_0x3388f4[_0x7feb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1ee1,_0x199304){return function(_0x358cb0){if(!_0x358cb0){_0x4e1ee1['sendStatus'](0x194);}return _0x358cb0;};}function handleError(_0x4c3e10,_0x31e90f){_0x31e90f=_0x31e90f||0x1f4;return function(_0x451c39){logger[_0x7feb('0x26')](_0x451c39[_0x7feb('0x27')]);if(_0x451c39[_0x7feb('0x28')]){delete _0x451c39[_0x7feb('0x28')];}_0x4c3e10['status'](_0x31e90f)[_0x7feb('0x29')](_0x451c39);};}exports[_0x7feb('0x2a')]=function(_0x775536,_0x420529){var _0x390e80={},_0x486f8e={},_0xc7e7d0={'count':0x0,'rows':[]};var _0x59d5f8=_['map'](db['SquareMessage'][_0x7feb('0x2b')],function(_0x3b40f2){return{'name':_0x3b40f2[_0x7feb('0x2c')],'type':_0x3b40f2[_0x7feb('0x2d')][_0x7feb('0x2e')]};});_0x486f8e[_0x7feb('0x2f')]=_[_0x7feb('0x30')](_0x59d5f8,_0x7feb('0x28'));_0x486f8e[_0x7feb('0x31')]=_[_0x7feb('0x32')](_0x775536[_0x7feb('0x31')]);_0x486f8e[_0x7feb('0x33')]=_[_0x7feb('0x34')](_0x486f8e['model'],_0x486f8e[_0x7feb('0x31')]);_0x390e80[_0x7feb('0x35')]=_['intersection'](_0x486f8e[_0x7feb('0x2f')],qs['fields'](_0x775536['query'][_0x7feb('0x36')]));_0x390e80[_0x7feb('0x35')]=_0x390e80[_0x7feb('0x35')][_0x7feb('0x37')]?_0x390e80[_0x7feb('0x35')]:_0x486f8e['model'];if(!_0x775536['query']['hasOwnProperty'](_0x7feb('0x38'))){_0x390e80[_0x7feb('0x1d')]=qs[_0x7feb('0x1d')](_0x775536[_0x7feb('0x31')][_0x7feb('0x1d')]);_0x390e80[_0x7feb('0x1c')]=qs[_0x7feb('0x1c')](_0x775536[_0x7feb('0x31')]['offset']);}_0x390e80[_0x7feb('0x39')]=qs[_0x7feb('0x3a')](_0x775536[_0x7feb('0x31')][_0x7feb('0x3a')]);_0x390e80[_0x7feb('0x3b')]=qs['filters'](_[_0x7feb('0x3c')](_0x775536[_0x7feb('0x31')],_0x486f8e[_0x7feb('0x33')]),_0x59d5f8);if(_0x775536['query'][_0x7feb('0x3d')]){_0x390e80[_0x7feb('0x3b')]=_[_0x7feb('0x3e')](_0x390e80[_0x7feb('0x3b')],{'$or':_[_0x7feb('0x30')](_0x59d5f8,function(_0xdc3e6a){if(_0xdc3e6a[_0x7feb('0x2d')]!=='VIRTUAL'){var _0xebf989={};_0xebf989[_0xdc3e6a[_0x7feb('0x28')]]={'$like':'%'+_0x775536[_0x7feb('0x31')][_0x7feb('0x3d')]+'%'};return _0xebf989;}})});}_0x390e80=_[_0x7feb('0x3e')]({},_0x390e80,_0x775536[_0x7feb('0x3f')]);var _0x32c8ac={'where':_0x390e80[_0x7feb('0x3b')]};return db[_0x7feb('0x40')][_0x7feb('0x1b')](_0x32c8ac)['then'](function(_0x2197cf){_0xc7e7d0[_0x7feb('0x1b')]=_0x2197cf;if(_0x775536[_0x7feb('0x31')]['includeAll']){_0x390e80['include']=[{'all':!![]}];}return db[_0x7feb('0x40')]['findAll'](_0x390e80);})['then'](function(_0x37b7dc){_0xc7e7d0['rows']=_0x37b7dc;return _0xc7e7d0;})['then'](respondWithFilteredResult(_0x420529,_0x390e80))[_0x7feb('0x41')](handleError(_0x420529,null));};exports['show']=function(_0x4adf8a,_0x13b93e){var _0x51c52b={'raw':!![],'where':{'id':_0x4adf8a[_0x7feb('0x42')]['id']}},_0x170e4f={};_0x170e4f[_0x7feb('0x2f')]=_['keys'](db['SquareMessage'][_0x7feb('0x2b')]);_0x170e4f['query']=_['keys'](_0x4adf8a[_0x7feb('0x31')]);_0x170e4f[_0x7feb('0x33')]=_['intersection'](_0x170e4f[_0x7feb('0x2f')],_0x170e4f['query']);_0x51c52b[_0x7feb('0x35')]=_[_0x7feb('0x34')](_0x170e4f[_0x7feb('0x2f')],qs[_0x7feb('0x36')](_0x4adf8a[_0x7feb('0x31')][_0x7feb('0x36')]));_0x51c52b[_0x7feb('0x35')]=_0x51c52b[_0x7feb('0x35')]['length']?_0x51c52b['attributes']:_0x170e4f[_0x7feb('0x2f')];if(_0x4adf8a[_0x7feb('0x31')]['includeAll']){_0x51c52b[_0x7feb('0x43')]=[{'all':!![]}];}_0x51c52b=_[_0x7feb('0x3e')]({},_0x51c52b,_0x4adf8a[_0x7feb('0x3f')]);return db[_0x7feb('0x40')]['find'](_0x51c52b)[_0x7feb('0x25')](handleEntityNotFound(_0x13b93e,null))[_0x7feb('0x25')](respondWithResult(_0x13b93e,null))[_0x7feb('0x41')](handleError(_0x13b93e,null));};exports[_0x7feb('0x44')]=function(_0x29a347,_0x7282c3){return db[_0x7feb('0x40')]['create'](_0x29a347[_0x7feb('0x45')],{})['then'](respondWithResult(_0x7282c3,0xc9))[_0x7feb('0x41')](handleError(_0x7282c3,null));};exports[_0x7feb('0x46')]=function(_0x499914,_0xccab04){if(_0x499914[_0x7feb('0x45')]['id']){delete _0x499914['body']['id'];}return db[_0x7feb('0x40')][_0x7feb('0x47')]({'where':{'id':_0x499914[_0x7feb('0x42')]['id']}})[_0x7feb('0x25')](handleEntityNotFound(_0xccab04,null))['then'](saveUpdates(_0x499914[_0x7feb('0x45')],null))[_0x7feb('0x25')](respondWithResult(_0xccab04,null))[_0x7feb('0x41')](handleError(_0xccab04,null));};exports[_0x7feb('0x24')]=function(_0x5d7202,_0x317085){return db[_0x7feb('0x40')][_0x7feb('0x47')]({'where':{'id':_0x5d7202[_0x7feb('0x42')]['id']}})[_0x7feb('0x25')](handleEntityNotFound(_0x317085,null))[_0x7feb('0x25')](removeEntity(_0x317085,null))[_0x7feb('0x41')](handleError(_0x317085,null));}; \ No newline at end of file +var _0x5ff6=['mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','type','options','count','includeAll','include','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x5e3d3f,_0x16492f){var _0x12ff3e=function(_0x3393dc){while(--_0x3393dc){_0x5e3d3f['push'](_0x5e3d3f['shift']());}};_0x12ff3e(++_0x16492f);}(_0x5ff6,0x12a));var _0x65ff=function(_0x537599,_0x334886){_0x537599=_0x537599-0x0;var _0x5a1c67=_0x5ff6[_0x537599];return _0x5a1c67;};'use strict';var pdf=require(_0x65ff('0x0'));var emlformat=require(_0x65ff('0x1'));var rimraf=require(_0x65ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65ff('0x3'));var moment=require(_0x65ff('0x4'));var BPromise=require(_0x65ff('0x5'));var Mustache=require(_0x65ff('0x6'));var util=require(_0x65ff('0x7'));var path=require(_0x65ff('0x8'));var sox=require(_0x65ff('0x9'));var csv=require(_0x65ff('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x65ff('0xb'));var squel=require(_0x65ff('0xc'));var crypto=require(_0x65ff('0xd'));var jsforce=require(_0x65ff('0xe'));var deskjs=require(_0x65ff('0xf'));var toCsv=require(_0x65ff('0xa'));var querystring=require(_0x65ff('0x10'));var Papa=require(_0x65ff('0x11'));var Redis=require('ioredis');var authService=require(_0x65ff('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x65ff('0x13'));var hardwareService=require(_0x65ff('0x14'));var logger=require(_0x65ff('0x15'))('api');var utils=require(_0x65ff('0x16'));var config=require(_0x65ff('0x17'));var licenseUtil=require(_0x65ff('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc2ad8e,_0x4c5fe3){_0x4c5fe3=_0x4c5fe3||0xcc;return function(_0x9962f0){if(_0x9962f0){return _0xc2ad8e[_0x65ff('0x19')](_0x4c5fe3);}return _0xc2ad8e[_0x65ff('0x1a')](_0x4c5fe3)[_0x65ff('0x1b')]();};}function respondWithResult(_0x48e172,_0x265c3e){_0x265c3e=_0x265c3e||0xc8;return function(_0x51d455){if(_0x51d455){return _0x48e172[_0x65ff('0x1a')](_0x265c3e)['json'](_0x51d455);}};}function respondWithFilteredResult(_0x1f03df,_0x2f6f72){return function(_0x4dfbb0){if(_0x4dfbb0){var _0x71328=_0x4dfbb0['count'],_0x2f27db=_0x2f6f72[_0x65ff('0x1c')],_0x5c2799=_0x2f6f72[_0x65ff('0x1c')]+_0x2f6f72[_0x65ff('0x1d')],_0x2d3f1f;if(_0x5c2799>=_0x71328){_0x5c2799=_0x71328;_0x2d3f1f=0xc8;}else{_0x2d3f1f=0xce;}_0x1f03df[_0x65ff('0x1a')](_0x2d3f1f);return _0x1f03df[_0x65ff('0x1e')](_0x65ff('0x1f'),_0x2f27db+'-'+_0x5c2799+'/'+_0x71328)[_0x65ff('0x20')](_0x4dfbb0);}return null;};}function patchUpdates(_0x57f7d0){return function(_0x230bd3){try{jsonpatch[_0x65ff('0x21')](_0x230bd3,_0x57f7d0,!![]);}catch(_0x1841b6){return BPromise[_0x65ff('0x22')](_0x1841b6);}return _0x230bd3[_0x65ff('0x23')]();};}function saveUpdates(_0x29fcdb,_0x485815){return function(_0x3bfd6d){if(_0x3bfd6d){return _0x3bfd6d[_0x65ff('0x24')](_0x29fcdb)[_0x65ff('0x25')](function(_0x1007c3){return _0x1007c3;});}return null;};}function removeEntity(_0x8acaa,_0x3e0ab6){return function(_0x3c1a84){if(_0x3c1a84){return _0x3c1a84[_0x65ff('0x26')]()[_0x65ff('0x25')](function(){_0x8acaa[_0x65ff('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12a6cc,_0x10d9a2){return function(_0x17cc6a){if(!_0x17cc6a){_0x12a6cc[_0x65ff('0x19')](0x194);}return _0x17cc6a;};}function handleError(_0x24e2d0,_0x4488e1){_0x4488e1=_0x4488e1||0x1f4;return function(_0x4d3c10){logger[_0x65ff('0x27')](_0x4d3c10[_0x65ff('0x28')]);if(_0x4d3c10[_0x65ff('0x29')]){delete _0x4d3c10[_0x65ff('0x29')];}_0x24e2d0[_0x65ff('0x1a')](_0x4488e1)[_0x65ff('0x2a')](_0x4d3c10);};}exports[_0x65ff('0x2b')]=function(_0x344ad8,_0x5230ea){var _0x104c9a={},_0x517771={},_0x41ace3={'count':0x0,'rows':[]};var _0x3cf7f7=_['map'](db[_0x65ff('0x2c')][_0x65ff('0x2d')],function(_0xfe0f52){return{'name':_0xfe0f52[_0x65ff('0x2e')],'type':_0xfe0f52['type'][_0x65ff('0x2f')]};});_0x517771[_0x65ff('0x30')]=_[_0x65ff('0x31')](_0x3cf7f7,_0x65ff('0x29'));_0x517771[_0x65ff('0x32')]=_[_0x65ff('0x33')](_0x344ad8[_0x65ff('0x32')]);_0x517771['filters']=_[_0x65ff('0x34')](_0x517771[_0x65ff('0x30')],_0x517771[_0x65ff('0x32')]);_0x104c9a[_0x65ff('0x35')]=_[_0x65ff('0x34')](_0x517771[_0x65ff('0x30')],qs[_0x65ff('0x36')](_0x344ad8[_0x65ff('0x32')][_0x65ff('0x36')]));_0x104c9a[_0x65ff('0x35')]=_0x104c9a[_0x65ff('0x35')][_0x65ff('0x37')]?_0x104c9a[_0x65ff('0x35')]:_0x517771[_0x65ff('0x30')];if(!_0x344ad8[_0x65ff('0x32')][_0x65ff('0x38')](_0x65ff('0x39'))){_0x104c9a[_0x65ff('0x1d')]=qs[_0x65ff('0x1d')](_0x344ad8[_0x65ff('0x32')][_0x65ff('0x1d')]);_0x104c9a[_0x65ff('0x1c')]=qs[_0x65ff('0x1c')](_0x344ad8[_0x65ff('0x32')][_0x65ff('0x1c')]);}_0x104c9a[_0x65ff('0x3a')]=qs[_0x65ff('0x3b')](_0x344ad8[_0x65ff('0x32')]['sort']);_0x104c9a['where']=qs['filters'](_['pick'](_0x344ad8[_0x65ff('0x32')],_0x517771[_0x65ff('0x3c')]),_0x3cf7f7);if(_0x344ad8[_0x65ff('0x32')][_0x65ff('0x3d')]){_0x104c9a['where']=_[_0x65ff('0x3e')](_0x104c9a[_0x65ff('0x3f')],{'$or':_[_0x65ff('0x31')](_0x3cf7f7,function(_0x2fca1b){if(_0x2fca1b[_0x65ff('0x40')]!=='VIRTUAL'){var _0x1fd11c={};_0x1fd11c[_0x2fca1b[_0x65ff('0x29')]]={'$like':'%'+_0x344ad8[_0x65ff('0x32')][_0x65ff('0x3d')]+'%'};return _0x1fd11c;}})});}_0x104c9a=_[_0x65ff('0x3e')]({},_0x104c9a,_0x344ad8[_0x65ff('0x41')]);var _0x4ec787={'where':_0x104c9a[_0x65ff('0x3f')]};return db[_0x65ff('0x2c')][_0x65ff('0x42')](_0x4ec787)[_0x65ff('0x25')](function(_0x59e3a3){_0x41ace3[_0x65ff('0x42')]=_0x59e3a3;if(_0x344ad8['query'][_0x65ff('0x43')]){_0x104c9a[_0x65ff('0x44')]=[{'all':!![]}];}return db[_0x65ff('0x2c')]['findAll'](_0x104c9a);})[_0x65ff('0x25')](function(_0x4a7624){_0x41ace3[_0x65ff('0x45')]=_0x4a7624;return _0x41ace3;})['then'](respondWithFilteredResult(_0x5230ea,_0x104c9a))[_0x65ff('0x46')](handleError(_0x5230ea,null));};exports[_0x65ff('0x47')]=function(_0x371891,_0x36c829){var _0x14fd14={'raw':!![],'where':{'id':_0x371891[_0x65ff('0x48')]['id']}},_0x27636e={};_0x27636e[_0x65ff('0x30')]=_['keys'](db[_0x65ff('0x2c')]['rawAttributes']);_0x27636e['query']=_[_0x65ff('0x33')](_0x371891[_0x65ff('0x32')]);_0x27636e[_0x65ff('0x3c')]=_[_0x65ff('0x34')](_0x27636e[_0x65ff('0x30')],_0x27636e['query']);_0x14fd14[_0x65ff('0x35')]=_[_0x65ff('0x34')](_0x27636e['model'],qs[_0x65ff('0x36')](_0x371891[_0x65ff('0x32')]['fields']));_0x14fd14[_0x65ff('0x35')]=_0x14fd14[_0x65ff('0x35')][_0x65ff('0x37')]?_0x14fd14[_0x65ff('0x35')]:_0x27636e[_0x65ff('0x30')];if(_0x371891[_0x65ff('0x32')][_0x65ff('0x43')]){_0x14fd14[_0x65ff('0x44')]=[{'all':!![]}];}_0x14fd14=_[_0x65ff('0x3e')]({},_0x14fd14,_0x371891[_0x65ff('0x41')]);return db['SquareMessage'][_0x65ff('0x49')](_0x14fd14)[_0x65ff('0x25')](handleEntityNotFound(_0x36c829,null))[_0x65ff('0x25')](respondWithResult(_0x36c829,null))[_0x65ff('0x46')](handleError(_0x36c829,null));};exports['create']=function(_0x5996c8,_0x411a56){return db['SquareMessage'][_0x65ff('0x4a')](_0x5996c8[_0x65ff('0x4b')],{})[_0x65ff('0x25')](respondWithResult(_0x411a56,0xc9))['catch'](handleError(_0x411a56,null));};exports[_0x65ff('0x24')]=function(_0x5347f1,_0x2e2f83){if(_0x5347f1[_0x65ff('0x4b')]['id']){delete _0x5347f1[_0x65ff('0x4b')]['id'];}return db['SquareMessage'][_0x65ff('0x49')]({'where':{'id':_0x5347f1[_0x65ff('0x48')]['id']}})[_0x65ff('0x25')](handleEntityNotFound(_0x2e2f83,null))[_0x65ff('0x25')](saveUpdates(_0x5347f1[_0x65ff('0x4b')],null))[_0x65ff('0x25')](respondWithResult(_0x2e2f83,null))[_0x65ff('0x46')](handleError(_0x2e2f83,null));};exports['destroy']=function(_0x57597d,_0x26f713){return db['SquareMessage'][_0x65ff('0x49')]({'where':{'id':_0x57597d[_0x65ff('0x48')]['id']}})[_0x65ff('0x25')](handleEntityNotFound(_0x26f713,null))[_0x65ff('0x25')](removeEntity(_0x26f713,null))[_0x65ff('0x46')](handleError(_0x26f713,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 938dab8..254b1d1 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 _0xb3dc=['request-promise','path','exports','SquareMessage','square_messages','../../config/logger','api','moment','bluebird'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xb3dc,0x1e2));var _0xcb3d=function(_0x448206,_0x1b0bda){_0x448206=_0x448206-0x0;var _0x159290=_0xb3dc[_0x448206];return _0x159290;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcb3d('0x0'))(_0xcb3d('0x1'));var moment=require(_0xcb3d('0x2'));var BPromise=require(_0xcb3d('0x3'));var rp=require(_0xcb3d('0x4'));var fs=require('fs');var path=require(_0xcb3d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xcb3d('0x6')]=function(_0x1fd76c,_0x5cec7f){return _0x1fd76c['define'](_0xcb3d('0x7'),attributes,{'tableName':_0xcb3d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd421=['define','SquareMessage','square_messages','lodash','util','../../config/logger','api','request-promise','path','rimraf','./squareMessage.attributes','exports'];(function(_0x2f97ec,_0x20480d){var _0x15df31=function(_0x5bb666){while(--_0x5bb666){_0x2f97ec['push'](_0x2f97ec['shift']());}};_0x15df31(++_0x20480d);}(_0xd421,0xdb));var _0x1d42=function(_0x1c5945,_0x116f84){_0x1c5945=_0x1c5945-0x0;var _0xe7b1e9=_0xd421[_0x1c5945];return _0xe7b1e9;};'use strict';var _=require(_0x1d42('0x0'));var util=require(_0x1d42('0x1'));var logger=require(_0x1d42('0x2'))(_0x1d42('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d42('0x4'));var fs=require('fs');var path=require(_0x1d42('0x5'));var rimraf=require(_0x1d42('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d42('0x7'));module[_0x1d42('0x8')]=function(_0x9d6165,_0xecbad1){return _0x9d6165[_0x1d42('0x9')](_0x1d42('0xa'),attributes,{'tableName':_0x1d42('0xb'),'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 7e8fb11..99eef1c 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(_0x44ef2b,_0x3dff5e){var _0x92db20=function(_0xcadf03){while(--_0xcadf03){_0x44ef2b['push'](_0x44ef2b['shift']());}};_0x92db20(++_0x3dff5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x55c960,_0x9683e7){var _0x333369=function(_0x1386c6){while(--_0x1386c6){_0x55c960['push'](_0x55c960['shift']());}};_0x333369(++_0x9683e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 3b84b07..0c2b308 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 _0xe15a=['../../config/environment','./squareOdbc.controller','index','get','isAuthenticated','show','/:id/test','15s','test','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x58ade6,_0x5a676c){var _0x317afe=function(_0x160540){while(--_0x160540){_0x58ade6['push'](_0x58ade6['shift']());}};_0x317afe(++_0x5a676c);}(_0xe15a,0x180));var _0xae15=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0xe15a[_0x547e20];return _0x359171;};'use strict';var multer=require(_0xae15('0x0'));var util=require(_0xae15('0x1'));var path=require(_0xae15('0x2'));var timeout=require(_0xae15('0x3'));var express=require(_0xae15('0x4'));var router=express[_0xae15('0x5')]();var auth=require(_0xae15('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae15('0x7'));var controller=require(_0xae15('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xae15('0x9')]);router[_0xae15('0xa')]('/:id',auth[_0xae15('0xb')](),controller[_0xae15('0xc')]);router[_0xae15('0xa')](_0xae15('0xd'),auth[_0xae15('0xb')](),timeout(_0xae15('0xe')),controller[_0xae15('0xf')]);router[_0xae15('0x10')]('/',auth[_0xae15('0xb')](),controller[_0xae15('0x11')]);router[_0xae15('0x12')](_0xae15('0x13'),auth[_0xae15('0xb')](),controller[_0xae15('0x14')]);router['delete'](_0xae15('0x13'),auth[_0xae15('0xb')](),controller[_0xae15('0x15')]);module[_0xae15('0x16')]=router; \ No newline at end of file +var _0xc92b=['./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55d426,_0x4c5f58){var _0x3a3ee0=function(_0x5eb4ad){while(--_0x5eb4ad){_0x55d426['push'](_0x55d426['shift']());}};_0x3a3ee0(++_0x4c5f58);}(_0xc92b,0x1c7));var _0xbc92=function(_0x26f5d2,_0x4e3a55){_0x26f5d2=_0x26f5d2-0x0;var _0x29c4e6=_0xc92b[_0x26f5d2];return _0x29c4e6;};'use strict';var multer=require('multer');var util=require(_0xbc92('0x0'));var path=require(_0xbc92('0x1'));var timeout=require(_0xbc92('0x2'));var express=require('express');var router=express[_0xbc92('0x3')]();var auth=require(_0xbc92('0x4'));var interaction=require(_0xbc92('0x5'));var config=require(_0xbc92('0x6'));var controller=require(_0xbc92('0x7'));router[_0xbc92('0x8')]('/',auth[_0xbc92('0x9')](),controller[_0xbc92('0xa')]);router['get'](_0xbc92('0xb'),auth[_0xbc92('0x9')](),controller[_0xbc92('0xc')]);router[_0xbc92('0x8')](_0xbc92('0xd'),auth[_0xbc92('0x9')](),timeout(_0xbc92('0xe')),controller[_0xbc92('0xf')]);router[_0xbc92('0x10')]('/',auth[_0xbc92('0x9')](),controller[_0xbc92('0x11')]);router['put'](_0xbc92('0xb'),auth[_0xbc92('0x9')](),controller['update']);router[_0xbc92('0x12')](_0xbc92('0xb'),auth[_0xbc92('0x9')](),controller[_0xbc92('0x13')]);module[_0xbc92('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index cc9d5b7..f81a4c7 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 _0x3b0e=['sequelize','exports','name','STRING'];(function(_0x5adc49,_0x471f9b){var _0xd90bd=function(_0xb8f68a){while(--_0xb8f68a){_0x5adc49['push'](_0x5adc49['shift']());}};_0xd90bd(++_0x471f9b);}(_0x3b0e,0x78));var _0xe3b0=function(_0x12dbe9,_0x4b8a5a){_0x12dbe9=_0x12dbe9-0x0;var _0x96ad6d=_0x3b0e[_0x12dbe9];return _0x96ad6d;};'use strict';var Sequelize=require(_0xe3b0('0x0'));module[_0xe3b0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe3b0('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe3b0('0x3')]}}; \ No newline at end of file +var _0xb1eb=['sequelize','exports','STRING'];(function(_0x27bfc1,_0x822cc2){var _0x4f946e=function(_0x41fa16){while(--_0x41fa16){_0x27bfc1['push'](_0x27bfc1['shift']());}};_0x4f946e(++_0x822cc2);}(_0xb1eb,0x1e0));var _0xbb1e=function(_0x13e715,_0x4db568){_0x13e715=_0x13e715-0x0;var _0x588c51=_0xb1eb[_0x13e715];return _0x588c51;};'use strict';var Sequelize=require(_0xbb1e('0x0'));module[_0xbb1e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xbb1e('0x2')]},'description':{'type':Sequelize[_0xbb1e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e6dd898..6e26267 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 _0xbff6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SquareOdbc','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','include','rows','catch','params','rawAttributes','includeAll','find','create','user','role','ODBC','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xbff6,0x136));var _0x6bff=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xbff6[_0x24f31b];return _0x488401;};'use strict';var pdf=require(_0x6bff('0x0'));var emlformat=require(_0x6bff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6bff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6bff('0x3'));var moment=require(_0x6bff('0x4'));var BPromise=require(_0x6bff('0x5'));var Mustache=require(_0x6bff('0x6'));var util=require(_0x6bff('0x7'));var path=require(_0x6bff('0x8'));var sox=require('sox');var csv=require(_0x6bff('0x9'));var ejs=require(_0x6bff('0xa'));var fs=require('fs');var _=require(_0x6bff('0xb'));var squel=require('squel');var crypto=require(_0x6bff('0xc'));var jsforce=require(_0x6bff('0xd'));var deskjs=require(_0x6bff('0xe'));var toCsv=require(_0x6bff('0x9'));var querystring=require(_0x6bff('0xf'));var Papa=require(_0x6bff('0x10'));var Redis=require(_0x6bff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6bff('0x12'));var as=require(_0x6bff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bff('0x14'))('api');var utils=require(_0x6bff('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e909a,_0x22a2ed){_0x22a2ed=_0x22a2ed||0xcc;return function(_0x1e17e0){if(_0x1e17e0){return _0x5e909a[_0x6bff('0x17')](_0x22a2ed);}return _0x5e909a[_0x6bff('0x18')](_0x22a2ed)[_0x6bff('0x19')]();};}function respondWithResult(_0x5ba955,_0x11fb6e){_0x11fb6e=_0x11fb6e||0xc8;return function(_0x5a4edc){if(_0x5a4edc){return _0x5ba955[_0x6bff('0x18')](_0x11fb6e)['json'](_0x5a4edc);}};}function respondWithFilteredResult(_0x31bc7e,_0x540e09){return function(_0xc325ea){if(_0xc325ea){var _0x14114e=_0xc325ea[_0x6bff('0x1a')],_0xb23c1a=_0x540e09[_0x6bff('0x1b')],_0x46775d=_0x540e09[_0x6bff('0x1b')]+_0x540e09[_0x6bff('0x1c')],_0x6ea6b5;if(_0x46775d>=_0x14114e){_0x46775d=_0x14114e;_0x6ea6b5=0xc8;}else{_0x6ea6b5=0xce;}_0x31bc7e[_0x6bff('0x18')](_0x6ea6b5);return _0x31bc7e['set']('Content-Range',_0xb23c1a+'-'+_0x46775d+'/'+_0x14114e)[_0x6bff('0x1d')](_0xc325ea);}return null;};}function patchUpdates(_0x4d1e11){return function(_0x5d96b6){try{jsonpatch[_0x6bff('0x1e')](_0x5d96b6,_0x4d1e11,!![]);}catch(_0x4ed7bc){return BPromise[_0x6bff('0x1f')](_0x4ed7bc);}return _0x5d96b6['save']();};}function saveUpdates(_0x3ab20a,_0x5274fa){return function(_0x258afc){if(_0x258afc){return _0x258afc[_0x6bff('0x20')](_0x3ab20a)[_0x6bff('0x21')](function(_0x3db0eb){return _0x3db0eb;});}return null;};}function removeEntity(_0x3c9bf4,_0x1ef6e5){return function(_0xf19d6a){if(_0xf19d6a){return _0xf19d6a[_0x6bff('0x22')]()[_0x6bff('0x21')](function(){var _0x261ca7=_0xf19d6a[_0x6bff('0x23')]({'plain':!![]});var _0x470bca='ODBC';return db[_0x6bff('0x24')][_0x6bff('0x22')]({'where':{'type':_0x470bca,'resourceId':_0x261ca7['id']}})['then'](function(){return _0xf19d6a;});})[_0x6bff('0x21')](function(){_0x3c9bf4['status'](0xcc)[_0x6bff('0x19')]();});}};}function handleEntityNotFound(_0x47c54c,_0x371113){return function(_0x36843c){if(!_0x36843c){_0x47c54c[_0x6bff('0x17')](0x194);}return _0x36843c;};}function handleError(_0x59fead,_0x5a0407){_0x5a0407=_0x5a0407||0x1f4;return function(_0x2363ab){logger['error'](_0x2363ab[_0x6bff('0x25')]);if(_0x2363ab[_0x6bff('0x26')]){delete _0x2363ab[_0x6bff('0x26')];}_0x59fead['status'](_0x5a0407)[_0x6bff('0x27')](_0x2363ab);};}exports[_0x6bff('0x28')]=function(_0x5d2dfb,_0x3534a0){var _0x5071c3={},_0x5b11ca={},_0xe0424f={'count':0x0,'rows':[]};var _0x27c7e2=_[_0x6bff('0x29')](db[_0x6bff('0x2a')]['rawAttributes'],function(_0x2e4eef){return{'name':_0x2e4eef['fieldName'],'type':_0x2e4eef[_0x6bff('0x2b')][_0x6bff('0x2c')]};});_0x5b11ca[_0x6bff('0x2d')]=_[_0x6bff('0x29')](_0x27c7e2,'name');_0x5b11ca[_0x6bff('0x2e')]=_[_0x6bff('0x2f')](_0x5d2dfb[_0x6bff('0x2e')]);_0x5b11ca[_0x6bff('0x30')]=_[_0x6bff('0x31')](_0x5b11ca[_0x6bff('0x2d')],_0x5b11ca['query']);_0x5071c3['attributes']=_['intersection'](_0x5b11ca[_0x6bff('0x2d')],qs[_0x6bff('0x32')](_0x5d2dfb['query']['fields']));_0x5071c3[_0x6bff('0x33')]=_0x5071c3['attributes'][_0x6bff('0x34')]?_0x5071c3[_0x6bff('0x33')]:_0x5b11ca['model'];if(!_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x35')](_0x6bff('0x36'))){_0x5071c3[_0x6bff('0x1c')]=qs[_0x6bff('0x1c')](_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x1c')]);_0x5071c3[_0x6bff('0x1b')]=qs[_0x6bff('0x1b')](_0x5d2dfb[_0x6bff('0x2e')]['offset']);}_0x5071c3['order']=qs[_0x6bff('0x37')](_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x37')]);_0x5071c3['where']=qs[_0x6bff('0x30')](_[_0x6bff('0x38')](_0x5d2dfb['query'],_0x5b11ca[_0x6bff('0x30')]),_0x27c7e2);if(_0x5d2dfb[_0x6bff('0x2e')]['filter']){_0x5071c3[_0x6bff('0x39')]=_[_0x6bff('0x3a')](_0x5071c3[_0x6bff('0x39')],{'$or':_[_0x6bff('0x29')](_0x27c7e2,function(_0x5e2f67){if(_0x5e2f67[_0x6bff('0x2b')]!=='VIRTUAL'){var _0x3b2ea0={};_0x3b2ea0[_0x5e2f67[_0x6bff('0x26')]]={'$like':'%'+_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x3b')]+'%'};return _0x3b2ea0;}})});}_0x5071c3=_[_0x6bff('0x3a')]({},_0x5071c3,_0x5d2dfb[_0x6bff('0x3c')]);var _0x57b655={'where':_0x5071c3[_0x6bff('0x39')]};return db[_0x6bff('0x2a')][_0x6bff('0x1a')](_0x57b655)['then'](function(_0x3337c0){_0xe0424f[_0x6bff('0x1a')]=_0x3337c0;if(_0x5d2dfb[_0x6bff('0x2e')]['includeAll']){_0x5071c3[_0x6bff('0x3d')]=[{'all':!![]}];}return db[_0x6bff('0x2a')]['findAll'](_0x5071c3);})[_0x6bff('0x21')](function(_0xf39f35){_0xe0424f[_0x6bff('0x3e')]=_0xf39f35;return _0xe0424f;})[_0x6bff('0x21')](respondWithFilteredResult(_0x3534a0,_0x5071c3))[_0x6bff('0x3f')](handleError(_0x3534a0,null));};exports['show']=function(_0x4984c2,_0x9164b9){var _0x2fb648={'raw':!![],'where':{'id':_0x4984c2[_0x6bff('0x40')]['id']}},_0x313840={};_0x313840[_0x6bff('0x2d')]=_[_0x6bff('0x2f')](db['SquareOdbc'][_0x6bff('0x41')]);_0x313840['query']=_[_0x6bff('0x2f')](_0x4984c2['query']);_0x313840[_0x6bff('0x30')]=_[_0x6bff('0x31')](_0x313840[_0x6bff('0x2d')],_0x313840['query']);_0x2fb648['attributes']=_[_0x6bff('0x31')](_0x313840['model'],qs[_0x6bff('0x32')](_0x4984c2[_0x6bff('0x2e')][_0x6bff('0x32')]));_0x2fb648[_0x6bff('0x33')]=_0x2fb648[_0x6bff('0x33')]['length']?_0x2fb648[_0x6bff('0x33')]:_0x313840['model'];if(_0x4984c2[_0x6bff('0x2e')][_0x6bff('0x42')]){_0x2fb648[_0x6bff('0x3d')]=[{'all':!![]}];}_0x2fb648=_['merge']({},_0x2fb648,_0x4984c2[_0x6bff('0x3c')]);return db[_0x6bff('0x2a')][_0x6bff('0x43')](_0x2fb648)[_0x6bff('0x21')](handleEntityNotFound(_0x9164b9,null))[_0x6bff('0x21')](respondWithResult(_0x9164b9,null))['catch'](handleError(_0x9164b9,null));};exports[_0x6bff('0x44')]=function(_0x4a3833,_0xf43b54){return db[_0x6bff('0x2a')][_0x6bff('0x44')](_0x4a3833['body'],{})[_0x6bff('0x21')](function(_0x3797bc){var _0x145170=_0x4a3833[_0x6bff('0x45')][_0x6bff('0x23')]({'plain':!![]});if(!_0x145170)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145170[_0x6bff('0x46')]==='user'){var _0x18427d=_0x3797bc[_0x6bff('0x23')]({'plain':!![]});var _0x2e0041=_0x6bff('0x47');return db[_0x6bff('0x48')][_0x6bff('0x43')]({'where':{'name':_0x2e0041,'userProfileId':_0x145170['userProfileId']},'raw':!![]})[_0x6bff('0x21')](function(_0x40126a){if(_0x40126a&&_0x40126a[_0x6bff('0x49')]===0x0){return db[_0x6bff('0x24')][_0x6bff('0x44')]({'name':_0x18427d[_0x6bff('0x26')],'resourceId':_0x18427d['id'],'type':_0x40126a['name'],'sectionId':_0x40126a['id']},{})[_0x6bff('0x21')](function(){return _0x3797bc;});}else{return _0x3797bc;}})[_0x6bff('0x3f')](function(_0x475404){logger[_0x6bff('0x4a')](_0x6bff('0x4b'),_0x475404);throw _0x475404;});}return _0x3797bc;})[_0x6bff('0x21')](respondWithResult(_0xf43b54,0xc9))[_0x6bff('0x3f')](handleError(_0xf43b54,null));};exports[_0x6bff('0x20')]=function(_0x23938c,_0x51685a){if(_0x23938c[_0x6bff('0x4c')]['id']){delete _0x23938c[_0x6bff('0x4c')]['id'];}return db['SquareOdbc'][_0x6bff('0x43')]({'where':{'id':_0x23938c[_0x6bff('0x40')]['id']}})[_0x6bff('0x21')](handleEntityNotFound(_0x51685a,null))[_0x6bff('0x21')](saveUpdates(_0x23938c[_0x6bff('0x4c')],null))[_0x6bff('0x21')](respondWithResult(_0x51685a,null))[_0x6bff('0x3f')](handleError(_0x51685a,null));};exports[_0x6bff('0x22')]=function(_0x1350da,_0x100f8a){return db[_0x6bff('0x2a')][_0x6bff('0x43')]({'where':{'id':_0x1350da['params']['id']}})[_0x6bff('0x21')](handleEntityNotFound(_0x100f8a,null))[_0x6bff('0x21')](removeEntity(_0x100f8a,null))[_0x6bff('0x3f')](handleError(_0x100f8a,null));};exports[_0x6bff('0x4d')]=function(_0x109c22,_0x2dbe53,_0x4c594f){var _0x1a6985;return db[_0x6bff('0x2a')]['find']({'where':{'id':_0x109c22[_0x6bff('0x40')]['id']},'attributes':['id',_0x6bff('0x4e')]})[_0x6bff('0x21')](handleEntityNotFound(_0x2dbe53,null))[_0x6bff('0x21')](function(_0x1e3d23){if(_0x1e3d23){var _0x33276a=require(_0x6bff('0x4f'))();_0x33276a[_0x6bff('0x50')](_0x1e3d23[_0x6bff('0x4e')]);_0x33276a[_0x6bff('0x51')]();return _0x1e3d23;}})[_0x6bff('0x21')](respondWithResult(_0x2dbe53,null))[_0x6bff('0x3f')](handleError(_0x2dbe53,null));}; \ No newline at end of file +var _0x380a=['fields','includeAll','include','find','create','body','user','get','role','userProfileId','autoAssociation','update','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','send','map','SquareOdbc','fieldName','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','where','filters','pick','merge','type','filter','options','findAll','rows','catch','params','keys','rawAttributes'];(function(_0xfd4492,_0x182c25){var _0x587319=function(_0x352494){while(--_0x352494){_0xfd4492['push'](_0xfd4492['shift']());}};_0x587319(++_0x182c25);}(_0x380a,0x10b));var _0xa380=function(_0x20187f,_0xbf67c9){_0x20187f=_0x20187f-0x0;var _0x398db5=_0x380a[_0x20187f];return _0x398db5;};'use strict';var pdf=require(_0xa380('0x0'));var emlformat=require(_0xa380('0x1'));var rimraf=require(_0xa380('0x2'));var zipdir=require(_0xa380('0x3'));var jsonpatch=require(_0xa380('0x4'));var rp=require(_0xa380('0x5'));var moment=require('moment');var BPromise=require(_0xa380('0x6'));var Mustache=require(_0xa380('0x7'));var util=require(_0xa380('0x8'));var path=require(_0xa380('0x9'));var sox=require(_0xa380('0xa'));var csv=require('to-csv');var ejs=require(_0xa380('0xb'));var fs=require('fs');var _=require(_0xa380('0xc'));var squel=require('squel');var crypto=require(_0xa380('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa380('0xe'));var toCsv=require(_0xa380('0xf'));var querystring=require(_0xa380('0x10'));var Papa=require(_0xa380('0x11'));var Redis=require(_0xa380('0x12'));var authService=require(_0xa380('0x13'));var qs=require(_0xa380('0x14'));var as=require(_0xa380('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa380('0x16'))(_0xa380('0x17'));var utils=require(_0xa380('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa380('0x19'));var db=require(_0xa380('0x1a'))['db'];function respondWithStatusCode(_0x48ddb9,_0x429f77){_0x429f77=_0x429f77||0xcc;return function(_0x4da066){if(_0x4da066){return _0x48ddb9[_0xa380('0x1b')](_0x429f77);}return _0x48ddb9['status'](_0x429f77)['end']();};}function respondWithResult(_0x4667bd,_0x3baf60){_0x3baf60=_0x3baf60||0xc8;return function(_0x1628d3){if(_0x1628d3){return _0x4667bd[_0xa380('0x1c')](_0x3baf60)['json'](_0x1628d3);}};}function respondWithFilteredResult(_0x3b3688,_0x2749c1){return function(_0x20252b){if(_0x20252b){var _0x2c479b=_0x20252b[_0xa380('0x1d')],_0x51aec9=_0x2749c1[_0xa380('0x1e')],_0x30884a=_0x2749c1['offset']+_0x2749c1['limit'],_0x5d9477;if(_0x30884a>=_0x2c479b){_0x30884a=_0x2c479b;_0x5d9477=0xc8;}else{_0x5d9477=0xce;}_0x3b3688[_0xa380('0x1c')](_0x5d9477);return _0x3b3688['set'](_0xa380('0x1f'),_0x51aec9+'-'+_0x30884a+'/'+_0x2c479b)[_0xa380('0x20')](_0x20252b);}return null;};}function patchUpdates(_0xd19b1c){return function(_0x72e20c){try{jsonpatch[_0xa380('0x21')](_0x72e20c,_0xd19b1c,!![]);}catch(_0x504133){return BPromise[_0xa380('0x22')](_0x504133);}return _0x72e20c[_0xa380('0x23')]();};}function saveUpdates(_0x53da3d,_0x24ae28){return function(_0x5d3545){if(_0x5d3545){return _0x5d3545['update'](_0x53da3d)['then'](function(_0x3d7a56){return _0x3d7a56;});}return null;};}function removeEntity(_0x25660e,_0x1f9a2c){return function(_0x5e1023){if(_0x5e1023){return _0x5e1023[_0xa380('0x24')]()[_0xa380('0x25')](function(){var _0x297016=_0x5e1023['get']({'plain':!![]});var _0x102b4a='ODBC';return db[_0xa380('0x26')][_0xa380('0x24')]({'where':{'type':_0x102b4a,'resourceId':_0x297016['id']}})['then'](function(){return _0x5e1023;});})[_0xa380('0x25')](function(){_0x25660e[_0xa380('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5438ff,_0x216114){return function(_0x4c130b){if(!_0x4c130b){_0x5438ff['sendStatus'](0x194);}return _0x4c130b;};}function handleError(_0x1a4f42,_0x20ebbe){_0x20ebbe=_0x20ebbe||0x1f4;return function(_0x38ea5){logger[_0xa380('0x27')](_0x38ea5[_0xa380('0x28')]);if(_0x38ea5['name']){delete _0x38ea5[_0xa380('0x29')];}_0x1a4f42[_0xa380('0x1c')](_0x20ebbe)[_0xa380('0x2a')](_0x38ea5);};}exports['index']=function(_0x43bbf0,_0x15faae){var _0x11a84c={},_0x624091={},_0x3e8a68={'count':0x0,'rows':[]};var _0x13953a=_[_0xa380('0x2b')](db[_0xa380('0x2c')]['rawAttributes'],function(_0x4054f0){return{'name':_0x4054f0[_0xa380('0x2d')],'type':_0x4054f0['type'][_0xa380('0x2e')]};});_0x624091[_0xa380('0x2f')]=_[_0xa380('0x2b')](_0x13953a,_0xa380('0x29'));_0x624091[_0xa380('0x30')]=_['keys'](_0x43bbf0[_0xa380('0x30')]);_0x624091['filters']=_[_0xa380('0x31')](_0x624091[_0xa380('0x2f')],_0x624091['query']);_0x11a84c[_0xa380('0x32')]=_[_0xa380('0x31')](_0x624091[_0xa380('0x2f')],qs['fields'](_0x43bbf0['query']['fields']));_0x11a84c[_0xa380('0x32')]=_0x11a84c[_0xa380('0x32')][_0xa380('0x33')]?_0x11a84c['attributes']:_0x624091[_0xa380('0x2f')];if(!_0x43bbf0[_0xa380('0x30')]['hasOwnProperty'](_0xa380('0x34'))){_0x11a84c[_0xa380('0x35')]=qs[_0xa380('0x35')](_0x43bbf0[_0xa380('0x30')][_0xa380('0x35')]);_0x11a84c[_0xa380('0x1e')]=qs[_0xa380('0x1e')](_0x43bbf0[_0xa380('0x30')][_0xa380('0x1e')]);}_0x11a84c[_0xa380('0x36')]=qs[_0xa380('0x37')](_0x43bbf0[_0xa380('0x30')][_0xa380('0x37')]);_0x11a84c[_0xa380('0x38')]=qs[_0xa380('0x39')](_[_0xa380('0x3a')](_0x43bbf0[_0xa380('0x30')],_0x624091[_0xa380('0x39')]),_0x13953a);if(_0x43bbf0[_0xa380('0x30')]['filter']){_0x11a84c[_0xa380('0x38')]=_[_0xa380('0x3b')](_0x11a84c['where'],{'$or':_[_0xa380('0x2b')](_0x13953a,function(_0x56589b){if(_0x56589b[_0xa380('0x3c')]!=='VIRTUAL'){var _0x33f0cf={};_0x33f0cf[_0x56589b[_0xa380('0x29')]]={'$like':'%'+_0x43bbf0[_0xa380('0x30')][_0xa380('0x3d')]+'%'};return _0x33f0cf;}})});}_0x11a84c=_[_0xa380('0x3b')]({},_0x11a84c,_0x43bbf0[_0xa380('0x3e')]);var _0x1243b9={'where':_0x11a84c[_0xa380('0x38')]};return db[_0xa380('0x2c')][_0xa380('0x1d')](_0x1243b9)[_0xa380('0x25')](function(_0x559cae){_0x3e8a68[_0xa380('0x1d')]=_0x559cae;if(_0x43bbf0[_0xa380('0x30')]['includeAll']){_0x11a84c['include']=[{'all':!![]}];}return db[_0xa380('0x2c')][_0xa380('0x3f')](_0x11a84c);})[_0xa380('0x25')](function(_0x31b04d){_0x3e8a68[_0xa380('0x40')]=_0x31b04d;return _0x3e8a68;})[_0xa380('0x25')](respondWithFilteredResult(_0x15faae,_0x11a84c))[_0xa380('0x41')](handleError(_0x15faae,null));};exports['show']=function(_0x15e59d,_0x1886f7){var _0x3f006f={'raw':!![],'where':{'id':_0x15e59d[_0xa380('0x42')]['id']}},_0x5c2e66={};_0x5c2e66[_0xa380('0x2f')]=_[_0xa380('0x43')](db[_0xa380('0x2c')][_0xa380('0x44')]);_0x5c2e66[_0xa380('0x30')]=_[_0xa380('0x43')](_0x15e59d['query']);_0x5c2e66[_0xa380('0x39')]=_[_0xa380('0x31')](_0x5c2e66[_0xa380('0x2f')],_0x5c2e66['query']);_0x3f006f[_0xa380('0x32')]=_[_0xa380('0x31')](_0x5c2e66[_0xa380('0x2f')],qs[_0xa380('0x45')](_0x15e59d['query'][_0xa380('0x45')]));_0x3f006f[_0xa380('0x32')]=_0x3f006f[_0xa380('0x32')][_0xa380('0x33')]?_0x3f006f['attributes']:_0x5c2e66[_0xa380('0x2f')];if(_0x15e59d[_0xa380('0x30')][_0xa380('0x46')]){_0x3f006f[_0xa380('0x47')]=[{'all':!![]}];}_0x3f006f=_[_0xa380('0x3b')]({},_0x3f006f,_0x15e59d[_0xa380('0x3e')]);return db['SquareOdbc'][_0xa380('0x48')](_0x3f006f)[_0xa380('0x25')](handleEntityNotFound(_0x1886f7,null))['then'](respondWithResult(_0x1886f7,null))[_0xa380('0x41')](handleError(_0x1886f7,null));};exports[_0xa380('0x49')]=function(_0x114ddb,_0x55e1f2){return db[_0xa380('0x2c')][_0xa380('0x49')](_0x114ddb[_0xa380('0x4a')],{})[_0xa380('0x25')](function(_0x162433){var _0x5680d1=_0x114ddb[_0xa380('0x4b')][_0xa380('0x4c')]({'plain':!![]});if(!_0x5680d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5680d1[_0xa380('0x4d')]==='user'){var _0x3243=_0x162433[_0xa380('0x4c')]({'plain':!![]});var _0x19a5f2='ODBC';return db['UserProfileSection'][_0xa380('0x48')]({'where':{'name':_0x19a5f2,'userProfileId':_0x5680d1[_0xa380('0x4e')]},'raw':!![]})[_0xa380('0x25')](function(_0x3c62ac){if(_0x3c62ac&&_0x3c62ac[_0xa380('0x4f')]===0x0){return db[_0xa380('0x26')][_0xa380('0x49')]({'name':_0x3243[_0xa380('0x29')],'resourceId':_0x3243['id'],'type':_0x3c62ac[_0xa380('0x29')],'sectionId':_0x3c62ac['id']},{})['then'](function(){return _0x162433;});}else{return _0x162433;}})[_0xa380('0x41')](function(_0x1c5c16){logger[_0xa380('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c5c16);throw _0x1c5c16;});}return _0x162433;})[_0xa380('0x25')](respondWithResult(_0x55e1f2,0xc9))[_0xa380('0x41')](handleError(_0x55e1f2,null));};exports[_0xa380('0x50')]=function(_0x5e5e5a,_0x42a072){if(_0x5e5e5a['body']['id']){delete _0x5e5e5a[_0xa380('0x4a')]['id'];}return db[_0xa380('0x2c')][_0xa380('0x48')]({'where':{'id':_0x5e5e5a[_0xa380('0x42')]['id']}})[_0xa380('0x25')](handleEntityNotFound(_0x42a072,null))[_0xa380('0x25')](saveUpdates(_0x5e5e5a[_0xa380('0x4a')],null))['then'](respondWithResult(_0x42a072,null))['catch'](handleError(_0x42a072,null));};exports[_0xa380('0x24')]=function(_0x1e5715,_0x52aa8a){return db[_0xa380('0x2c')][_0xa380('0x48')]({'where':{'id':_0x1e5715[_0xa380('0x42')]['id']}})[_0xa380('0x25')](handleEntityNotFound(_0x52aa8a,null))[_0xa380('0x25')](removeEntity(_0x52aa8a,null))[_0xa380('0x41')](handleError(_0x52aa8a,null));};exports['test']=function(_0x31a152,_0x537f8a,_0x5b6275){var _0x1c288d;return db[_0xa380('0x2c')]['find']({'where':{'id':_0x31a152['params']['id']},'attributes':['id',_0xa380('0x51')]})[_0xa380('0x25')](handleEntityNotFound(_0x537f8a,null))[_0xa380('0x25')](function(_0x157890){if(_0x157890){var _0x49c172=require(_0xa380('0x52'))();_0x49c172['openSync'](_0x157890['dsn']);_0x49c172[_0xa380('0x53')]();return _0x157890;}})[_0xa380('0x25')](respondWithResult(_0x537f8a,null))[_0xa380('0x41')](handleError(_0x537f8a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index fbf1b3c..9c37380 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 _0x5f63=['path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x570984,_0x53e43c){var _0xc80b08=function(_0x2c8ef1){while(--_0x2c8ef1){_0x570984['push'](_0x570984['shift']());}};_0xc80b08(++_0x53e43c);}(_0x5f63,0x117));var _0x35f6=function(_0x372175,_0x3b50ce){_0x372175=_0x372175-0x0;var _0x3fa7e1=_0x5f63[_0x372175];return _0x3fa7e1;};'use strict';var _=require(_0x35f6('0x0'));var util=require(_0x35f6('0x1'));var logger=require(_0x35f6('0x2'))(_0x35f6('0x3'));var moment=require(_0x35f6('0x4'));var BPromise=require(_0x35f6('0x5'));var rp=require(_0x35f6('0x6'));var fs=require('fs');var path=require(_0x35f6('0x7'));var rimraf=require('rimraf');var config=require(_0x35f6('0x8'));var attributes=require(_0x35f6('0x9'));module[_0x35f6('0xa')]=function(_0xe63a5b,_0x36101a){return _0xe63a5b[_0x35f6('0xb')]('SquareOdbc',attributes,{'tableName':_0x35f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49f5=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x2bf40f,_0x36c9da){var _0x57c391=function(_0x1be4da){while(--_0x1be4da){_0x2bf40f['push'](_0x2bf40f['shift']());}};_0x57c391(++_0x36c9da);}(_0x49f5,0x18c));var _0x549f=function(_0x59b061,_0x171121){_0x59b061=_0x59b061-0x0;var _0x4aabe5=_0x49f5[_0x59b061];return _0x4aabe5;};'use strict';var _=require(_0x549f('0x0'));var util=require(_0x549f('0x1'));var logger=require('../../config/logger')(_0x549f('0x2'));var moment=require(_0x549f('0x3'));var BPromise=require(_0x549f('0x4'));var rp=require(_0x549f('0x5'));var fs=require('fs');var path=require(_0x549f('0x6'));var rimraf=require('rimraf');var config=require(_0x549f('0x7'));var attributes=require(_0x549f('0x8'));module[_0x549f('0x9')]=function(_0x42f431,_0x231e26){return _0x42f431[_0x549f('0xa')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 67bbc56..3141ab2 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 _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(_0x378c37,_0x5ad9df){var _0x3766e9=function(_0x522612){while(--_0x522612){_0x378c37['push'](_0x378c37['shift']());}};_0x3766e9(++_0x5ad9df);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 +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(_0x381663,_0x4c765c){var _0x5bc19a=function(_0x405359){while(--_0x405359){_0x381663['push'](_0x381663['shift']());}};_0x5bc19a(++_0x4c765c);}(_0x7217,0x19e));var _0x7721=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x7217[_0xbe200f];return _0x192597;};'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 diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5c3ee09..25a6a8d 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 _0x50e1=['destroy','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','show','getUsers','post','/:id/users','addUsers','put','/:id','update'];(function(_0x4b14a8,_0x56c223){var _0x442b6c=function(_0x2c433a){while(--_0x2c433a){_0x4b14a8['push'](_0x4b14a8['shift']());}};_0x442b6c(++_0x56c223);}(_0x50e1,0x113));var _0x150e=function(_0x540646,_0x3bfae2){_0x540646=_0x540646-0x0;var _0x5373e9=_0x50e1[_0x540646];return _0x5373e9;};'use strict';var multer=require(_0x150e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x150e('0x1'));var express=require(_0x150e('0x2'));var router=express[_0x150e('0x3')]();var auth=require(_0x150e('0x4'));var interaction=require(_0x150e('0x5'));var config=require(_0x150e('0x6'));var controller=require(_0x150e('0x7'));router[_0x150e('0x8')]('/',auth['isAuthenticated'](),controller[_0x150e('0x9')]);router['get']('/:id',auth[_0x150e('0xa')](),controller[_0x150e('0xb')]);router[_0x150e('0x8')]('/:id/users',auth[_0x150e('0xa')](),controller[_0x150e('0xc')]);router[_0x150e('0xd')]('/',auth[_0x150e('0xa')](),controller['create']);router[_0x150e('0xd')](_0x150e('0xe'),auth[_0x150e('0xa')](),controller[_0x150e('0xf')]);router[_0x150e('0x10')](_0x150e('0x11'),auth[_0x150e('0xa')](),controller[_0x150e('0x12')]);router['delete'](_0x150e('0x11'),auth[_0x150e('0xa')](),controller[_0x150e('0x13')]);router[_0x150e('0x14')](_0x150e('0xe'),auth[_0x150e('0xa')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0xc07d=['../../config/environment','./squareProject.controller','get','index','/:id','show','/:id/users','getUsers','post','isAuthenticated','create','addUsers','update','delete','destroy','removeUsers','multer','path','../../components/auth/service','../../components/interaction/service'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xc07d,0x178));var _0xdc07=function(_0x17f732,_0x20456f){_0x17f732=_0x17f732-0x0;var _0x5a0e67=_0xc07d[_0x17f732];return _0x5a0e67;};'use strict';var multer=require(_0xdc07('0x0'));var util=require('util');var path=require(_0xdc07('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xdc07('0x2'));var interaction=require(_0xdc07('0x3'));var config=require(_0xdc07('0x4'));var controller=require(_0xdc07('0x5'));router[_0xdc07('0x6')]('/',auth['isAuthenticated'](),controller[_0xdc07('0x7')]);router[_0xdc07('0x6')](_0xdc07('0x8'),auth['isAuthenticated'](),controller[_0xdc07('0x9')]);router[_0xdc07('0x6')](_0xdc07('0xa'),auth['isAuthenticated'](),controller[_0xdc07('0xb')]);router[_0xdc07('0xc')]('/',auth[_0xdc07('0xd')](),controller[_0xdc07('0xe')]);router[_0xdc07('0xc')]('/:id/users',auth[_0xdc07('0xd')](),controller[_0xdc07('0xf')]);router['put'](_0xdc07('0x8'),auth[_0xdc07('0xd')](),controller[_0xdc07('0x10')]);router[_0xdc07('0x11')](_0xdc07('0x8'),auth[_0xdc07('0xd')](),controller[_0xdc07('0x12')]);router['delete'](_0xdc07('0xa'),auth[_0xdc07('0xd')](),controller[_0xdc07('0x13')]);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 510a23e..e0dfe3b 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 _0x5761=['production','toString','DATE','sequelize','exports','STRING','BLOB','long','getDataValue','preproduction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5761,0x107));var _0x1576=function(_0x5352fc,_0x4cfcf7){_0x5352fc=_0x5352fc-0x0;var _0x25a45d=_0x5761[_0x5352fc];return _0x25a45d;};'use strict';var Sequelize=require(_0x1576('0x0'));module[_0x1576('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1576('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x1576('0x3')](_0x1576('0x4')),'get':function(){if(this[_0x1576('0x5')](_0x1576('0x6'))){return this[_0x1576('0x5')](_0x1576('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x1576('0x3')](_0x1576('0x4')),'get':function(){if(this[_0x1576('0x5')](_0x1576('0x7'))){return this['getDataValue'](_0x1576('0x7'))[_0x1576('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x1576('0x9')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x56a0=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING'];(function(_0xee21c0,_0x54a3ab){var _0x668fb9=function(_0x3f2b93){while(--_0x3f2b93){_0xee21c0['push'](_0xee21c0['shift']());}};_0x668fb9(++_0x54a3ab);}(_0x56a0,0x101));var _0x056a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x56a0[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x056a('0x0'));module[_0x056a('0x1')]={'name':{'type':Sequelize[_0x056a('0x2')],'unique':_0x056a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x056a('0x2')]},'notes':{'type':Sequelize[_0x056a('0x4')]},'preproduction':{'type':Sequelize[_0x056a('0x5')](_0x056a('0x6')),'get':function(){if(this[_0x056a('0x7')](_0x056a('0x8'))){return this[_0x056a('0x7')](_0x056a('0x8'))[_0x056a('0x9')](_0x056a('0xa'));}}},'production':{'type':Sequelize[_0x056a('0x5')]('long'),'get':function(){if(this[_0x056a('0x7')](_0x056a('0xb'))){return this['getDataValue']('production')[_0x056a('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0x056a('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ca57775..36074ed 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 _0xd18c=['UserProfileResource','stack','name','send','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','SquareProject','include','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','get','SquareProjects'];(function(_0x4b14bb,_0xe7b4d3){var _0x285200=function(_0x48c1d7){while(--_0x48c1d7){_0x4b14bb['push'](_0x4b14bb['shift']());}};_0x285200(++_0xe7b4d3);}(_0xd18c,0xee));var _0xcd18=function(_0x5383f1,_0x327fb3){_0x5383f1=_0x5383f1-0x0;var _0xa23930=_0xd18c[_0x5383f1];return _0xa23930;};'use strict';var pdf=require(_0xcd18('0x0'));var emlformat=require(_0xcd18('0x1'));var rimraf=require(_0xcd18('0x2'));var zipdir=require(_0xcd18('0x3'));var jsonpatch=require(_0xcd18('0x4'));var rp=require(_0xcd18('0x5'));var moment=require('moment');var BPromise=require(_0xcd18('0x6'));var Mustache=require(_0xcd18('0x7'));var util=require('util');var path=require(_0xcd18('0x8'));var sox=require('sox');var csv=require(_0xcd18('0x9'));var ejs=require(_0xcd18('0xa'));var fs=require('fs');var _=require(_0xcd18('0xb'));var squel=require(_0xcd18('0xc'));var crypto=require('crypto');var jsforce=require(_0xcd18('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcd18('0x9'));var querystring=require(_0xcd18('0xe'));var Papa=require(_0xcd18('0xf'));var Redis=require(_0xcd18('0x10'));var authService=require(_0xcd18('0x11'));var qs=require(_0xcd18('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd18('0x13'))(_0xcd18('0x14'));var utils=require('../../config/utils');var config=require(_0xcd18('0x15'));var licenseUtil=require(_0xcd18('0x16'));var db=require(_0xcd18('0x17'))['db'];config['redis']=_[_0xcd18('0x18')](config[_0xcd18('0x19')],{'host':_0xcd18('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd18('0x19')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x48bf39,_0x49f286){_0x49f286=_0x49f286||0xcc;return function(_0x385e4c){if(_0x385e4c){return _0x48bf39[_0xcd18('0x1b')](_0x49f286);}return _0x48bf39[_0xcd18('0x1c')](_0x49f286)[_0xcd18('0x1d')]();};}function respondWithResult(_0x10064e,_0x20761f){_0x20761f=_0x20761f||0xc8;return function(_0x44a88a){if(_0x44a88a){return _0x10064e[_0xcd18('0x1c')](_0x20761f)[_0xcd18('0x1e')](_0x44a88a);}};}function respondWithFilteredResult(_0x4adde4,_0x5e6bc9){return function(_0x4fee42){if(_0x4fee42){var _0x1bbafd=_0x4fee42[_0xcd18('0x1f')],_0xd4ba1d=_0x5e6bc9[_0xcd18('0x20')],_0x4f28e0=_0x5e6bc9[_0xcd18('0x20')]+_0x5e6bc9[_0xcd18('0x21')],_0x4d0026;if(_0x4f28e0>=_0x1bbafd){_0x4f28e0=_0x1bbafd;_0x4d0026=0xc8;}else{_0x4d0026=0xce;}_0x4adde4[_0xcd18('0x1c')](_0x4d0026);return _0x4adde4[_0xcd18('0x22')]('Content-Range',_0xd4ba1d+'-'+_0x4f28e0+'/'+_0x1bbafd)['json'](_0x4fee42);}return null;};}function patchUpdates(_0x5a205b){return function(_0x1a44da){try{jsonpatch[_0xcd18('0x23')](_0x1a44da,_0x5a205b,!![]);}catch(_0xb703b){return BPromise[_0xcd18('0x24')](_0xb703b);}return _0x1a44da['save']();};}function saveUpdates(_0x2dfac5,_0x2e9ebd){return function(_0x41ea91){if(_0x41ea91){return _0x41ea91['update'](_0x2dfac5)[_0xcd18('0x25')](function(_0x3fc7a5){return _0x3fc7a5;});}return null;};}function removeEntity(_0x4bb620,_0x32997e){return function(_0x387d74){if(_0x387d74){return _0x387d74[_0xcd18('0x26')]()[_0xcd18('0x25')](function(){var _0x7275d6=_0x387d74[_0xcd18('0x27')]({'plain':!![]});var _0x5b7b8b=_0xcd18('0x28');return db[_0xcd18('0x29')][_0xcd18('0x26')]({'where':{'type':_0x5b7b8b,'resourceId':_0x7275d6['id']}})[_0xcd18('0x25')](function(){return _0x387d74;});})[_0xcd18('0x25')](function(){_0x4bb620[_0xcd18('0x1c')](0xcc)[_0xcd18('0x1d')]();});}};}function handleEntityNotFound(_0x236daa,_0x200a8b){return function(_0x3da41e){if(!_0x3da41e){_0x236daa['sendStatus'](0x194);}return _0x3da41e;};}function handleError(_0x3702af,_0x2c3934){_0x2c3934=_0x2c3934||0x1f4;return function(_0x7ebd40){logger['error'](_0x7ebd40[_0xcd18('0x2a')]);if(_0x7ebd40[_0xcd18('0x2b')]){delete _0x7ebd40[_0xcd18('0x2b')];}_0x3702af[_0xcd18('0x1c')](_0x2c3934)[_0xcd18('0x2c')](_0x7ebd40);};}exports['index']=function(_0x17b371,_0x30289f){var _0xd1cd7={},_0x3cfd2e={},_0x173eb4={'count':0x0,'rows':[]};var _0x1724ba=_[_0xcd18('0x2d')](db['SquareProject'][_0xcd18('0x2e')],function(_0x121c59){return{'name':_0x121c59['fieldName'],'type':_0x121c59['type'][_0xcd18('0x2f')]};});_0x3cfd2e[_0xcd18('0x30')]=_[_0xcd18('0x2d')](_0x1724ba,_0xcd18('0x2b'));_0x3cfd2e[_0xcd18('0x31')]=_[_0xcd18('0x32')](_0x17b371[_0xcd18('0x31')]);_0x3cfd2e[_0xcd18('0x33')]=_['intersection'](_0x3cfd2e[_0xcd18('0x30')],_0x3cfd2e['query']);_0xd1cd7[_0xcd18('0x34')]=_[_0xcd18('0x35')](_0x3cfd2e['model'],qs[_0xcd18('0x36')](_0x17b371[_0xcd18('0x31')][_0xcd18('0x36')]));_0xd1cd7['attributes']=_0xd1cd7[_0xcd18('0x34')]['length']?_0xd1cd7[_0xcd18('0x34')]:_0x3cfd2e[_0xcd18('0x30')];if(!_0x17b371[_0xcd18('0x31')][_0xcd18('0x37')](_0xcd18('0x38'))){_0xd1cd7[_0xcd18('0x21')]=qs[_0xcd18('0x21')](_0x17b371[_0xcd18('0x31')]['limit']);_0xd1cd7['offset']=qs[_0xcd18('0x20')](_0x17b371[_0xcd18('0x31')][_0xcd18('0x20')]);}_0xd1cd7['order']=qs[_0xcd18('0x39')](_0x17b371['query'][_0xcd18('0x39')]);_0xd1cd7[_0xcd18('0x3a')]=qs['filters'](_[_0xcd18('0x3b')](_0x17b371[_0xcd18('0x31')],_0x3cfd2e[_0xcd18('0x33')]),_0x1724ba);if(_0x17b371[_0xcd18('0x31')][_0xcd18('0x3c')]){_0xd1cd7[_0xcd18('0x3a')]=_[_0xcd18('0x3d')](_0xd1cd7[_0xcd18('0x3a')],{'$or':_[_0xcd18('0x2d')](_0x1724ba,function(_0x33e8c4){if(_0x33e8c4[_0xcd18('0x3e')]!=='VIRTUAL'){var _0x5dae9e={};_0x5dae9e[_0x33e8c4[_0xcd18('0x2b')]]={'$like':'%'+_0x17b371[_0xcd18('0x31')][_0xcd18('0x3c')]+'%'};return _0x5dae9e;}})});}_0xd1cd7=_[_0xcd18('0x3d')]({},_0xd1cd7,_0x17b371[_0xcd18('0x3f')]);var _0xaf21ab={'where':_0xd1cd7['where']};return db[_0xcd18('0x40')][_0xcd18('0x1f')](_0xaf21ab)[_0xcd18('0x25')](function(_0x27f312){_0x173eb4[_0xcd18('0x1f')]=_0x27f312;if(_0x17b371[_0xcd18('0x31')]['includeAll']){_0xd1cd7[_0xcd18('0x41')]=[{'all':!![]}];}return db[_0xcd18('0x40')]['findAll'](_0xd1cd7);})[_0xcd18('0x25')](function(_0x10c915){_0x173eb4[_0xcd18('0x42')]=_0x10c915;return _0x173eb4;})['then'](respondWithFilteredResult(_0x30289f,_0xd1cd7))[_0xcd18('0x43')](handleError(_0x30289f,null));};exports[_0xcd18('0x44')]=function(_0x215792,_0x1abc6d){var _0x3cef73={'raw':![],'where':{'id':_0x215792[_0xcd18('0x45')]['id']}},_0x1a589f={};_0x1a589f[_0xcd18('0x30')]=_['keys'](db[_0xcd18('0x40')]['rawAttributes']);_0x1a589f[_0xcd18('0x31')]=_[_0xcd18('0x32')](_0x215792[_0xcd18('0x31')]);_0x1a589f[_0xcd18('0x33')]=_[_0xcd18('0x35')](_0x1a589f['model'],_0x1a589f[_0xcd18('0x31')]);_0x3cef73['attributes']=_[_0xcd18('0x35')](_0x1a589f[_0xcd18('0x30')],qs[_0xcd18('0x36')](_0x215792[_0xcd18('0x31')][_0xcd18('0x36')]));_0x3cef73[_0xcd18('0x34')]=_0x3cef73[_0xcd18('0x34')][_0xcd18('0x46')]?_0x3cef73[_0xcd18('0x34')]:_0x1a589f[_0xcd18('0x30')];if(_0x215792[_0xcd18('0x31')][_0xcd18('0x47')]){_0x3cef73[_0xcd18('0x41')]=[{'all':!![]}];}_0x3cef73=_['merge']({},_0x3cef73,_0x215792[_0xcd18('0x3f')]);return db[_0xcd18('0x40')][_0xcd18('0x48')](_0x3cef73)[_0xcd18('0x25')](handleEntityNotFound(_0x1abc6d,null))['then'](respondWithResult(_0x1abc6d,null))[_0xcd18('0x43')](handleError(_0x1abc6d,null));};exports[_0xcd18('0x49')]=function(_0x180a3e,_0x111425){return db[_0xcd18('0x40')][_0xcd18('0x49')](_0x180a3e[_0xcd18('0x4a')],{})[_0xcd18('0x25')](function(_0x290de5){var _0x2e1f54=_0x180a3e[_0xcd18('0x4b')]['get']({'plain':!![]});if(!_0x2e1f54)throw new Error(_0xcd18('0x4c'));if(_0x2e1f54[_0xcd18('0x4d')]===_0xcd18('0x4b')){var _0x34b24b=_0x290de5[_0xcd18('0x27')]({'plain':!![]});var _0x425e3d=_0xcd18('0x28');return db[_0xcd18('0x4e')][_0xcd18('0x48')]({'where':{'name':_0x425e3d,'userProfileId':_0x2e1f54[_0xcd18('0x4f')]},'raw':!![]})[_0xcd18('0x25')](function(_0x1818d3){if(_0x1818d3&&_0x1818d3[_0xcd18('0x50')]===0x0){return db['UserProfileResource'][_0xcd18('0x49')]({'name':_0x34b24b[_0xcd18('0x2b')],'resourceId':_0x34b24b['id'],'type':_0x1818d3['name'],'sectionId':_0x1818d3['id']},{})[_0xcd18('0x25')](function(){return _0x290de5;});}else{return _0x290de5;}})[_0xcd18('0x43')](function(_0x45bf7a){logger['error'](_0xcd18('0x51'),_0x45bf7a);throw _0x45bf7a;});}return _0x290de5;})[_0xcd18('0x25')](respondWithResult(_0x111425,0xc9))['catch'](handleError(_0x111425,null));};exports[_0xcd18('0x52')]=function(_0x2ab701,_0x14b63c){if(_0x2ab701[_0xcd18('0x4a')]['id']){delete _0x2ab701['body']['id'];}return db[_0xcd18('0x40')]['find']({'where':{'id':_0x2ab701[_0xcd18('0x45')]['id']}})['then'](handleEntityNotFound(_0x14b63c,null))[_0xcd18('0x25')](saveUpdates(_0x2ab701[_0xcd18('0x4a')],null))[_0xcd18('0x25')](respondWithResult(_0x14b63c,null))[_0xcd18('0x43')](handleError(_0x14b63c,null));};exports[_0xcd18('0x26')]=function(_0xc52f6e,_0x2a9cea){return db[_0xcd18('0x40')][_0xcd18('0x48')]({'where':{'id':_0xc52f6e[_0xcd18('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a9cea,null))['then'](removeEntity(_0x2a9cea,null))[_0xcd18('0x43')](handleError(_0x2a9cea,null));};exports[_0xcd18('0x53')]=function(_0x53235b,_0x510394,_0x4ad5b0){return db[_0xcd18('0x40')][_0xcd18('0x48')]({'where':{'id':_0x53235b[_0xcd18('0x45')]['id']}})['then'](handleEntityNotFound(_0x510394,null))['then'](function(_0x380312){if(_0x380312){return _0x380312[_0xcd18('0x53')](_0x53235b[_0xcd18('0x4a')][_0xcd18('0x54')],_[_0xcd18('0x55')](_0x53235b['body'],[_0xcd18('0x54'),'id'])||{});}})[_0xcd18('0x25')](respondWithResult(_0x510394,null))['catch'](handleError(_0x510394,null));};exports[_0xcd18('0x56')]=function(_0x4b1d6f,_0xb8acb3,_0x39b749){return db[_0xcd18('0x40')][_0xcd18('0x48')]({'where':{'id':_0x4b1d6f[_0xcd18('0x45')]['id']}})[_0xcd18('0x25')](handleEntityNotFound(_0xb8acb3,null))['then'](function(_0x4f0682){if(_0x4f0682){return _0x4f0682[_0xcd18('0x56')](_0x4b1d6f[_0xcd18('0x31')]['ids'])[_0xcd18('0x25')](function(){if(_[_0xcd18('0x57')](_0x4b1d6f[_0xcd18('0x31')]['ids'])){for(var _0x5074f0=0x0;_0x5074f0<_0x4b1d6f['query'][_0xcd18('0x54')]['length'];_0x5074f0+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x4b1d6f[_0xcd18('0x31')][_0xcd18('0x54')][_0x5074f0]),'SquareProjectId':Number(_0x4b1d6f['params']['id'])});}}else{socket[_0xcd18('0x58')](_0xcd18('0x59'),{'UserId':Number(_0x4b1d6f[_0xcd18('0x31')]['ids']),'SquareProjectId':Number(_0x4b1d6f['params']['id'])});}});}})[_0xcd18('0x25')](respondWithStatusCode(_0xb8acb3,null))[_0xcd18('0x43')](handleError(_0xb8acb3,null));};exports[_0xcd18('0x5a')]=function(_0x3ba632,_0x40c237,_0x40ab22){var _0x51d9f7={};var _0x65a6f3={};var _0x1c7302;var _0x40ded8;return db[_0xcd18('0x40')]['findOne']({'where':{'id':_0x3ba632[_0xcd18('0x45')]['id']}})[_0xcd18('0x25')](handleEntityNotFound(_0x40c237,null))[_0xcd18('0x25')](function(_0x2a116e){if(_0x2a116e){_0x1c7302=_0x2a116e;_0x65a6f3[_0xcd18('0x30')]=_[_0xcd18('0x32')](db[_0xcd18('0x5b')][_0xcd18('0x2e')]);_0x65a6f3['query']=_['keys'](_0x3ba632['query']);_0x65a6f3['filters']=_['intersection'](_0x65a6f3[_0xcd18('0x30')],_0x65a6f3['query']);_0x51d9f7[_0xcd18('0x34')]=_[_0xcd18('0x35')](_0x65a6f3[_0xcd18('0x30')],qs[_0xcd18('0x36')](_0x3ba632[_0xcd18('0x31')]['fields']));_0x51d9f7[_0xcd18('0x34')]=_0x51d9f7['attributes'][_0xcd18('0x46')]?_0x51d9f7[_0xcd18('0x34')]:_0x65a6f3[_0xcd18('0x30')];_0x51d9f7[_0xcd18('0x5c')]=qs[_0xcd18('0x39')](_0x3ba632[_0xcd18('0x31')]['sort']);_0x51d9f7[_0xcd18('0x3a')]=qs[_0xcd18('0x33')](_['pick'](_0x3ba632['query'],_0x65a6f3[_0xcd18('0x33')]));if(_0x3ba632[_0xcd18('0x31')]['filter']){_0x51d9f7['where']=_[_0xcd18('0x3d')](_0x51d9f7[_0xcd18('0x3a')],{'$or':_[_0xcd18('0x2d')](_0x51d9f7[_0xcd18('0x34')],function(_0x289b5c){var _0x16d49c={};_0x16d49c[_0x289b5c]={'$like':'%'+_0x3ba632[_0xcd18('0x31')][_0xcd18('0x3c')]+'%'};return _0x16d49c;})});}_0x51d9f7=_[_0xcd18('0x3d')]({},_0x51d9f7,_0x3ba632[_0xcd18('0x3f')]);return _0x1c7302[_0xcd18('0x5a')](_0x51d9f7);}})[_0xcd18('0x25')](function(_0x2ec3eb){if(_0x2ec3eb){_0x40ded8=_0x2ec3eb[_0xcd18('0x46')];if(!_0x3ba632['query'][_0xcd18('0x37')](_0xcd18('0x38'))){_0x51d9f7[_0xcd18('0x21')]=qs['limit'](_0x3ba632[_0xcd18('0x31')][_0xcd18('0x21')]);_0x51d9f7['offset']=qs[_0xcd18('0x20')](_0x3ba632[_0xcd18('0x31')][_0xcd18('0x20')]);}return _0x1c7302[_0xcd18('0x5a')](_0x51d9f7);}})[_0xcd18('0x25')](function(_0x33262f){if(_0x33262f){return _0x33262f?{'count':_0x40ded8,'rows':_0x33262f}:null;}})[_0xcd18('0x25')](respondWithResult(_0x40c237,null))['catch'](handleError(_0x40c237,null));}; \ No newline at end of file +var _0x846a=['findOne','User','pick','html-pdf','zip-dir','fast-json-patch','mustache','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','offset','limit','set','apply','save','update','destroy','then','get','SquareProjects','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','count','includeAll','findAll','rows','keys','SquareProject','length','include','options','find','catch','create','body','role','user','userProfileId','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers'];(function(_0x329c23,_0x12f869){var _0x2c1a23=function(_0x25eace){while(--_0x25eace){_0x329c23['push'](_0x329c23['shift']());}};_0x2c1a23(++_0x12f869);}(_0x846a,0x11a));var _0xa846=function(_0x22a724,_0x56b1c2){_0x22a724=_0x22a724-0x0;var _0x142ae0=_0x846a[_0x22a724];return _0x142ae0;};'use strict';var pdf=require(_0xa846('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa846('0x1'));var jsonpatch=require(_0xa846('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa846('0x3'));var util=require('util');var path=require(_0xa846('0x4'));var sox=require('sox');var csv=require(_0xa846('0x5'));var ejs=require(_0xa846('0x6'));var fs=require('fs');var _=require(_0xa846('0x7'));var squel=require(_0xa846('0x8'));var crypto=require(_0xa846('0x9'));var jsforce=require(_0xa846('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa846('0x5'));var querystring=require(_0xa846('0xb'));var Papa=require(_0xa846('0xc'));var Redis=require(_0xa846('0xd'));var authService=require(_0xa846('0xe'));var qs=require(_0xa846('0xf'));var as=require(_0xa846('0x10'));var hardwareService=require(_0xa846('0x11'));var logger=require('../../config/logger')(_0xa846('0x12'));var utils=require(_0xa846('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa846('0x14'));var db=require(_0xa846('0x15'))['db'];config[_0xa846('0x16')]=_['defaults'](config['redis'],{'host':_0xa846('0x17'),'port':0x18eb});var socket=require(_0xa846('0x18'))(new Redis(config['redis']));require(_0xa846('0x19'))[_0xa846('0x1a')](socket);function respondWithStatusCode(_0x1ce566,_0x15c33d){_0x15c33d=_0x15c33d||0xcc;return function(_0x5714c1){if(_0x5714c1){return _0x1ce566[_0xa846('0x1b')](_0x15c33d);}return _0x1ce566[_0xa846('0x1c')](_0x15c33d)['end']();};}function respondWithResult(_0x5d6095,_0xb66fa0){_0xb66fa0=_0xb66fa0||0xc8;return function(_0x37e8c9){if(_0x37e8c9){return _0x5d6095[_0xa846('0x1c')](_0xb66fa0)[_0xa846('0x1d')](_0x37e8c9);}};}function respondWithFilteredResult(_0x49f766,_0x2c538a){return function(_0x44d518){if(_0x44d518){var _0x3ad9f1=_0x44d518['count'],_0x2026d4=_0x2c538a[_0xa846('0x1e')],_0x3c44e9=_0x2c538a[_0xa846('0x1e')]+_0x2c538a[_0xa846('0x1f')],_0x2e0d6a;if(_0x3c44e9>=_0x3ad9f1){_0x3c44e9=_0x3ad9f1;_0x2e0d6a=0xc8;}else{_0x2e0d6a=0xce;}_0x49f766[_0xa846('0x1c')](_0x2e0d6a);return _0x49f766[_0xa846('0x20')]('Content-Range',_0x2026d4+'-'+_0x3c44e9+'/'+_0x3ad9f1)[_0xa846('0x1d')](_0x44d518);}return null;};}function patchUpdates(_0x4351d0){return function(_0x36c7d1){try{jsonpatch[_0xa846('0x21')](_0x36c7d1,_0x4351d0,!![]);}catch(_0x1236ae){return BPromise['reject'](_0x1236ae);}return _0x36c7d1[_0xa846('0x22')]();};}function saveUpdates(_0x23eb26,_0x7a648e){return function(_0xd21dae){if(_0xd21dae){return _0xd21dae[_0xa846('0x23')](_0x23eb26)['then'](function(_0x3a62f2){return _0x3a62f2;});}return null;};}function removeEntity(_0x1b134d,_0x3a7368){return function(_0x1349f9){if(_0x1349f9){return _0x1349f9[_0xa846('0x24')]()[_0xa846('0x25')](function(){var _0x585086=_0x1349f9[_0xa846('0x26')]({'plain':!![]});var _0x12343b=_0xa846('0x27');return db[_0xa846('0x28')][_0xa846('0x24')]({'where':{'type':_0x12343b,'resourceId':_0x585086['id']}})['then'](function(){return _0x1349f9;});})[_0xa846('0x25')](function(){_0x1b134d[_0xa846('0x1c')](0xcc)[_0xa846('0x29')]();});}};}function handleEntityNotFound(_0x18a4e9,_0x291dc6){return function(_0x47e78c){if(!_0x47e78c){_0x18a4e9[_0xa846('0x1b')](0x194);}return _0x47e78c;};}function handleError(_0x53d448,_0x4480d8){_0x4480d8=_0x4480d8||0x1f4;return function(_0x10b420){logger[_0xa846('0x2a')](_0x10b420[_0xa846('0x2b')]);if(_0x10b420[_0xa846('0x2c')]){delete _0x10b420[_0xa846('0x2c')];}_0x53d448['status'](_0x4480d8)[_0xa846('0x2d')](_0x10b420);};}exports[_0xa846('0x2e')]=function(_0x5376ba,_0x55c36a){var _0x327799={},_0x494f9c={},_0x25fd40={'count':0x0,'rows':[]};var _0x130348=_['map'](db['SquareProject'][_0xa846('0x2f')],function(_0x25d546){return{'name':_0x25d546[_0xa846('0x30')],'type':_0x25d546['type'][_0xa846('0x31')]};});_0x494f9c[_0xa846('0x32')]=_[_0xa846('0x33')](_0x130348,'name');_0x494f9c[_0xa846('0x34')]=_['keys'](_0x5376ba['query']);_0x494f9c[_0xa846('0x35')]=_[_0xa846('0x36')](_0x494f9c[_0xa846('0x32')],_0x494f9c[_0xa846('0x34')]);_0x327799[_0xa846('0x37')]=_[_0xa846('0x36')](_0x494f9c['model'],qs[_0xa846('0x38')](_0x5376ba[_0xa846('0x34')][_0xa846('0x38')]));_0x327799[_0xa846('0x37')]=_0x327799['attributes']['length']?_0x327799[_0xa846('0x37')]:_0x494f9c[_0xa846('0x32')];if(!_0x5376ba[_0xa846('0x34')][_0xa846('0x39')](_0xa846('0x3a'))){_0x327799[_0xa846('0x1f')]=qs[_0xa846('0x1f')](_0x5376ba[_0xa846('0x34')][_0xa846('0x1f')]);_0x327799[_0xa846('0x1e')]=qs[_0xa846('0x1e')](_0x5376ba[_0xa846('0x34')][_0xa846('0x1e')]);}_0x327799[_0xa846('0x3b')]=qs[_0xa846('0x3c')](_0x5376ba[_0xa846('0x34')][_0xa846('0x3c')]);_0x327799['where']=qs[_0xa846('0x35')](_['pick'](_0x5376ba[_0xa846('0x34')],_0x494f9c['filters']),_0x130348);if(_0x5376ba[_0xa846('0x34')]['filter']){_0x327799['where']=_[_0xa846('0x3d')](_0x327799[_0xa846('0x3e')],{'$or':_[_0xa846('0x33')](_0x130348,function(_0x48ec02){if(_0x48ec02['type']!==_0xa846('0x3f')){var _0x4f6861={};_0x4f6861[_0x48ec02[_0xa846('0x2c')]]={'$like':'%'+_0x5376ba['query'][_0xa846('0x40')]+'%'};return _0x4f6861;}})});}_0x327799=_['merge']({},_0x327799,_0x5376ba['options']);var _0x56ff6f={'where':_0x327799[_0xa846('0x3e')]};return db['SquareProject'][_0xa846('0x41')](_0x56ff6f)[_0xa846('0x25')](function(_0x5e3371){_0x25fd40[_0xa846('0x41')]=_0x5e3371;if(_0x5376ba[_0xa846('0x34')][_0xa846('0x42')]){_0x327799['include']=[{'all':!![]}];}return db['SquareProject'][_0xa846('0x43')](_0x327799);})[_0xa846('0x25')](function(_0xe95bec){_0x25fd40[_0xa846('0x44')]=_0xe95bec;return _0x25fd40;})[_0xa846('0x25')](respondWithFilteredResult(_0x55c36a,_0x327799))['catch'](handleError(_0x55c36a,null));};exports['show']=function(_0x1a0127,_0x82ee4d){var _0x374a38={'raw':![],'where':{'id':_0x1a0127['params']['id']}},_0x5ba386={};_0x5ba386[_0xa846('0x32')]=_[_0xa846('0x45')](db[_0xa846('0x46')][_0xa846('0x2f')]);_0x5ba386['query']=_[_0xa846('0x45')](_0x1a0127[_0xa846('0x34')]);_0x5ba386[_0xa846('0x35')]=_['intersection'](_0x5ba386[_0xa846('0x32')],_0x5ba386['query']);_0x374a38['attributes']=_[_0xa846('0x36')](_0x5ba386[_0xa846('0x32')],qs[_0xa846('0x38')](_0x1a0127['query']['fields']));_0x374a38[_0xa846('0x37')]=_0x374a38[_0xa846('0x37')][_0xa846('0x47')]?_0x374a38[_0xa846('0x37')]:_0x5ba386[_0xa846('0x32')];if(_0x1a0127[_0xa846('0x34')][_0xa846('0x42')]){_0x374a38[_0xa846('0x48')]=[{'all':!![]}];}_0x374a38=_[_0xa846('0x3d')]({},_0x374a38,_0x1a0127[_0xa846('0x49')]);return db['SquareProject'][_0xa846('0x4a')](_0x374a38)[_0xa846('0x25')](handleEntityNotFound(_0x82ee4d,null))[_0xa846('0x25')](respondWithResult(_0x82ee4d,null))[_0xa846('0x4b')](handleError(_0x82ee4d,null));};exports[_0xa846('0x4c')]=function(_0x5b73ca,_0x1f3c34){return db[_0xa846('0x46')][_0xa846('0x4c')](_0x5b73ca[_0xa846('0x4d')],{})['then'](function(_0x5380f0){var _0x4e6520=_0x5b73ca['user'][_0xa846('0x26')]({'plain':!![]});if(!_0x4e6520)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e6520[_0xa846('0x4e')]===_0xa846('0x4f')){var _0x3cfaa7=_0x5380f0[_0xa846('0x26')]({'plain':!![]});var _0x3c4735=_0xa846('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x3c4735,'userProfileId':_0x4e6520[_0xa846('0x50')]},'raw':!![]})[_0xa846('0x25')](function(_0x23e86a){if(_0x23e86a&&_0x23e86a['autoAssociation']===0x0){return db[_0xa846('0x28')][_0xa846('0x4c')]({'name':_0x3cfaa7[_0xa846('0x2c')],'resourceId':_0x3cfaa7['id'],'type':_0x23e86a[_0xa846('0x2c')],'sectionId':_0x23e86a['id']},{})['then'](function(){return _0x5380f0;});}else{return _0x5380f0;}})[_0xa846('0x4b')](function(_0x3e8d61){logger[_0xa846('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e8d61);throw _0x3e8d61;});}return _0x5380f0;})['then'](respondWithResult(_0x1f3c34,0xc9))[_0xa846('0x4b')](handleError(_0x1f3c34,null));};exports[_0xa846('0x23')]=function(_0x4bbe9,_0x490b42){if(_0x4bbe9['body']['id']){delete _0x4bbe9[_0xa846('0x4d')]['id'];}return db[_0xa846('0x46')][_0xa846('0x4a')]({'where':{'id':_0x4bbe9['params']['id']}})['then'](handleEntityNotFound(_0x490b42,null))['then'](saveUpdates(_0x4bbe9[_0xa846('0x4d')],null))[_0xa846('0x25')](respondWithResult(_0x490b42,null))[_0xa846('0x4b')](handleError(_0x490b42,null));};exports[_0xa846('0x24')]=function(_0x4232b7,_0x15bdb4){return db[_0xa846('0x46')][_0xa846('0x4a')]({'where':{'id':_0x4232b7[_0xa846('0x51')]['id']}})[_0xa846('0x25')](handleEntityNotFound(_0x15bdb4,null))[_0xa846('0x25')](removeEntity(_0x15bdb4,null))[_0xa846('0x4b')](handleError(_0x15bdb4,null));};exports[_0xa846('0x52')]=function(_0x5a8d0c,_0x414b26,_0xd86bf3){return db[_0xa846('0x46')][_0xa846('0x4a')]({'where':{'id':_0x5a8d0c['params']['id']}})[_0xa846('0x25')](handleEntityNotFound(_0x414b26,null))[_0xa846('0x25')](function(_0x5045f4){if(_0x5045f4){return _0x5045f4[_0xa846('0x52')](_0x5a8d0c[_0xa846('0x4d')][_0xa846('0x53')],_[_0xa846('0x54')](_0x5a8d0c[_0xa846('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x414b26,null))[_0xa846('0x4b')](handleError(_0x414b26,null));};exports[_0xa846('0x55')]=function(_0x32bb91,_0x167373,_0x1453cf){return db[_0xa846('0x46')][_0xa846('0x4a')]({'where':{'id':_0x32bb91[_0xa846('0x51')]['id']}})['then'](handleEntityNotFound(_0x167373,null))[_0xa846('0x25')](function(_0x1edb25){if(_0x1edb25){return _0x1edb25[_0xa846('0x55')](_0x32bb91[_0xa846('0x34')][_0xa846('0x53')])[_0xa846('0x25')](function(){if(_[_0xa846('0x56')](_0x32bb91[_0xa846('0x34')][_0xa846('0x53')])){for(var _0x8cf67c=0x0;_0x8cf67c<_0x32bb91[_0xa846('0x34')]['ids']['length'];_0x8cf67c+=0x1){socket[_0xa846('0x57')](_0xa846('0x58'),{'UserId':Number(_0x32bb91[_0xa846('0x34')]['ids'][_0x8cf67c]),'SquareProjectId':Number(_0x32bb91[_0xa846('0x51')]['id'])});}}else{socket['emit'](_0xa846('0x58'),{'UserId':Number(_0x32bb91[_0xa846('0x34')][_0xa846('0x53')]),'SquareProjectId':Number(_0x32bb91[_0xa846('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x167373,null))[_0xa846('0x4b')](handleError(_0x167373,null));};exports[_0xa846('0x59')]=function(_0x391042,_0x54da66,_0x6c54c1){var _0x148aec={};var _0xbd7727={};var _0x354fd5;var _0x5e2d2f;return db[_0xa846('0x46')][_0xa846('0x5a')]({'where':{'id':_0x391042[_0xa846('0x51')]['id']}})[_0xa846('0x25')](handleEntityNotFound(_0x54da66,null))[_0xa846('0x25')](function(_0x50ce0d){if(_0x50ce0d){_0x354fd5=_0x50ce0d;_0xbd7727['model']=_[_0xa846('0x45')](db[_0xa846('0x5b')][_0xa846('0x2f')]);_0xbd7727[_0xa846('0x34')]=_['keys'](_0x391042[_0xa846('0x34')]);_0xbd7727[_0xa846('0x35')]=_['intersection'](_0xbd7727[_0xa846('0x32')],_0xbd7727[_0xa846('0x34')]);_0x148aec[_0xa846('0x37')]=_['intersection'](_0xbd7727['model'],qs['fields'](_0x391042[_0xa846('0x34')]['fields']));_0x148aec['attributes']=_0x148aec[_0xa846('0x37')][_0xa846('0x47')]?_0x148aec[_0xa846('0x37')]:_0xbd7727[_0xa846('0x32')];_0x148aec[_0xa846('0x3b')]=qs['sort'](_0x391042[_0xa846('0x34')][_0xa846('0x3c')]);_0x148aec['where']=qs['filters'](_[_0xa846('0x5c')](_0x391042[_0xa846('0x34')],_0xbd7727[_0xa846('0x35')]));if(_0x391042[_0xa846('0x34')]['filter']){_0x148aec['where']=_[_0xa846('0x3d')](_0x148aec[_0xa846('0x3e')],{'$or':_[_0xa846('0x33')](_0x148aec['attributes'],function(_0x41b8b4){var _0x59450b={};_0x59450b[_0x41b8b4]={'$like':'%'+_0x391042[_0xa846('0x34')][_0xa846('0x40')]+'%'};return _0x59450b;})});}_0x148aec=_[_0xa846('0x3d')]({},_0x148aec,_0x391042[_0xa846('0x49')]);return _0x354fd5['getUsers'](_0x148aec);}})[_0xa846('0x25')](function(_0x1af0e1){if(_0x1af0e1){_0x5e2d2f=_0x1af0e1['length'];if(!_0x391042[_0xa846('0x34')][_0xa846('0x39')](_0xa846('0x3a'))){_0x148aec[_0xa846('0x1f')]=qs[_0xa846('0x1f')](_0x391042[_0xa846('0x34')][_0xa846('0x1f')]);_0x148aec[_0xa846('0x1e')]=qs[_0xa846('0x1e')](_0x391042['query']['offset']);}return _0x354fd5['getUsers'](_0x148aec);}})[_0xa846('0x25')](function(_0xf98e42){if(_0xf98e42){return _0xf98e42?{'count':_0x5e2d2f,'rows':_0xf98e42}:null;}})[_0xa846('0x25')](respondWithResult(_0x54da66,null))[_0xa846('0x4b')](handleError(_0x54da66,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1d13658..0a6b37b 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 _0x5a1f=['SquareProject','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x5a1f,0x19c));var _0xf5a1=function(_0x14daf3,_0x5a90f9){_0x14daf3=_0x14daf3-0x0;var _0x390818=_0x5a1f[_0x14daf3];return _0x390818;};'use strict';var EventEmitter=require(_0xf5a1('0x0'));var SquareProject=require(_0xf5a1('0x1'))['db'][_0xf5a1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf5a1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf5a1('0x4')};function emitEvent(_0x4287f1){return function(_0x431b16,_0x508949,_0x4d3415){SquareProjectEvents[_0xf5a1('0x5')](_0x4287f1+':'+_0x431b16['id'],_0x431b16);SquareProjectEvents[_0xf5a1('0x5')](_0x4287f1,_0x431b16);_0x4d3415(null);};}for(var e in events){if(events[_0xf5a1('0x6')](e)){var event=events[e];SquareProject[_0xf5a1('0x7')](e,emitEvent(event));}}module[_0xf5a1('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xae3c=['remove','emit','hasOwnProperty','exports','events','SquareProject','save','update'];(function(_0x3add0f,_0x49a609){var _0xb5ca42=function(_0x2f930b){while(--_0x2f930b){_0x3add0f['push'](_0x3add0f['shift']());}};_0xb5ca42(++_0x49a609);}(_0xae3c,0x104));var _0xcae3=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xae3c[_0x4207f4];return _0x29a621;};'use strict';var EventEmitter=require(_0xcae3('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xcae3('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcae3('0x2'),'afterUpdate':_0xcae3('0x3'),'afterDestroy':_0xcae3('0x4')};function emitEvent(_0x219bac){return function(_0x5d47a1,_0x3a6b31,_0x36ebc5){SquareProjectEvents[_0xcae3('0x5')](_0x219bac+':'+_0x5d47a1['id'],_0x5d47a1);SquareProjectEvents['emit'](_0x219bac,_0x5d47a1);_0x36ebc5(null);};}for(var e in events){if(events[_0xcae3('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xcae3('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9b4609a..d1782c4 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 _0x7a59=['exports','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes'];(function(_0xe5ce72,_0x3245b9){var _0x4c8f5d=function(_0x31ea60){while(--_0x31ea60){_0xe5ce72['push'](_0xe5ce72['shift']());}};_0x4c8f5d(++_0x3245b9);}(_0x7a59,0x16e));var _0x97a5=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x7a59[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97a5('0x1'));var moment=require(_0x97a5('0x2'));var BPromise=require(_0x97a5('0x3'));var rp=require(_0x97a5('0x4'));var fs=require('fs');var path=require(_0x97a5('0x5'));var rimraf=require('rimraf');var config=require(_0x97a5('0x6'));var attributes=require(_0x97a5('0x7'));module[_0x97a5('0x8')]=function(_0x48201b,_0x438520){return _0x48201b[_0x97a5('0x9')](_0x97a5('0xa'),attributes,{'tableName':_0x97a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27e8a6,_0x156789,_0x260690){if(_0x27e8a6['changed'](_0x97a5('0xc'))){_0x27e8a6[_0x97a5('0xd')]=moment()[_0x97a5('0xe')](_0x97a5('0xf'));}if(_0x27e8a6[_0x97a5('0x10')]('production')){_0x27e8a6['publishedAt']=moment()[_0x97a5('0xe')](_0x97a5('0xf'));}_0x260690(null,_0x27e8a6);}}});}; \ No newline at end of file +var _0x2cd3=['path','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x525028,_0x2e1f44){var _0x2b846d=function(_0x4009ee){while(--_0x4009ee){_0x525028['push'](_0x525028['shift']());}};_0x2b846d(++_0x2e1f44);}(_0x2cd3,0xf1));var _0x32cd=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x2cd3[_0x2d4065];return _0xef6016;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var logger=require(_0x32cd('0x1'))(_0x32cd('0x2'));var moment=require(_0x32cd('0x3'));var BPromise=require(_0x32cd('0x4'));var rp=require(_0x32cd('0x5'));var fs=require('fs');var path=require(_0x32cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32cd('0x7'));module[_0x32cd('0x8')]=function(_0x1af8c8,_0x1024e0){return _0x1af8c8[_0x32cd('0x9')](_0x32cd('0xa'),attributes,{'tableName':_0x32cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27797f,_0x2d60fa,_0x1021fd){if(_0x27797f[_0x32cd('0xc')](_0x32cd('0xd'))){_0x27797f[_0x32cd('0xe')]=moment()[_0x32cd('0xf')](_0x32cd('0x10'));}if(_0x27797f[_0x32cd('0xc')](_0x32cd('0x11'))){_0x27797f[_0x32cd('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1021fd(null,_0x27797f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2143e2a..2b47335 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 _0xe287=['SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','where','attributes','include','map','model','ShowSquareProject','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xe287,0x1ce));var _0x7e28=function(_0x1bc0e2,_0x2a65e3){_0x1bc0e2=_0x1bc0e2-0x0;var _0xac6e4e=_0xe287[_0x1bc0e2];return _0xac6e4e;};'use strict';var _=require('lodash');var util=require(_0x7e28('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e28('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7e28('0x2'))(_0x7e28('0x3'));var config=require(_0x7e28('0x4'));var jayson=require(_0x7e28('0x5'));var client=jayson['client'][_0x7e28('0x6')]({'port':0x232a});config[_0x7e28('0x7')]=_[_0x7e28('0x8')](config['redis'],{'host':_0x7e28('0x9'),'port':0x18eb});var socket=require(_0x7e28('0xa'))(new Redis(config[_0x7e28('0x7')]));require(_0x7e28('0xb'))[_0x7e28('0xc')](socket);function respondWithRpcPromise(_0x2d202e,_0x4f60e3,_0x419f88){return new BPromise(function(_0x199cc9,_0x9955e2){return client['request'](_0x2d202e,_0x419f88)[_0x7e28('0xd')](function(_0x47ebf9){logger[_0x7e28('0xe')](_0x7e28('0xf'),_0x4f60e3,_0x7e28('0x10'));logger[_0x7e28('0x11')](_0x7e28('0x12'),_0x4f60e3,'request\x20sent',JSON[_0x7e28('0x13')](_0x47ebf9));if(_0x47ebf9[_0x7e28('0x14')]){if(_0x47ebf9[_0x7e28('0x14')]['code']===0x1f4){logger['error'](_0x7e28('0xf'),_0x4f60e3,_0x47ebf9[_0x7e28('0x14')][_0x7e28('0x15')]);return _0x9955e2(_0x47ebf9[_0x7e28('0x14')][_0x7e28('0x15')]);}logger[_0x7e28('0x14')](_0x7e28('0xf'),_0x4f60e3,_0x47ebf9[_0x7e28('0x14')][_0x7e28('0x15')]);return _0x199cc9(_0x47ebf9[_0x7e28('0x14')]['message']);}else{logger['info'](_0x7e28('0xf'),_0x4f60e3,_0x7e28('0x10'));_0x199cc9(_0x47ebf9[_0x7e28('0x16')][_0x7e28('0x15')]);}})[_0x7e28('0x17')](function(_0xaf1a0b){logger['error'](_0x7e28('0xf'),_0x4f60e3,_0xaf1a0b);_0x9955e2(_0xaf1a0b);});});}exports['ShowSquareProject']=function(_0x5f0fb7){var _0xcc6099=this;return new Promise(function(_0x299965,_0xee5cd2){return db['SquareProject']['find']({'raw':_0x5f0fb7['options']?_0x5f0fb7[_0x7e28('0x18')][_0x7e28('0x19')]===undefined?!![]:![]:!![],'where':_0x5f0fb7[_0x7e28('0x18')]?_0x5f0fb7[_0x7e28('0x18')][_0x7e28('0x1a')]||null:null,'attributes':_0x5f0fb7['options']?_0x5f0fb7[_0x7e28('0x18')][_0x7e28('0x1b')]||null:null,'include':_0x5f0fb7[_0x7e28('0x18')]?_0x5f0fb7['options'][_0x7e28('0x1c')]?_['map'](_0x5f0fb7[_0x7e28('0x18')]['include'],function(_0x1ae6fb){return{'model':db[_0x1ae6fb['model']],'as':_0x1ae6fb['as'],'attributes':_0x1ae6fb[_0x7e28('0x1b')],'include':_0x1ae6fb['include']?_[_0x7e28('0x1d')](_0x1ae6fb[_0x7e28('0x1c')],function(_0x34a7e2){return{'model':db[_0x34a7e2[_0x7e28('0x1e')]],'as':_0x34a7e2['as'],'attributes':_0x34a7e2[_0x7e28('0x1b')],'include':_0x34a7e2['include']?_['map'](_0x34a7e2[_0x7e28('0x1c')],function(_0xa8c7b6){return{'model':db[_0xa8c7b6[_0x7e28('0x1e')]],'as':_0xa8c7b6['as'],'attributes':_0xa8c7b6[_0x7e28('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34fbfa){logger[_0x7e28('0xe')](_0x7e28('0x1f'),_0x5f0fb7);logger[_0x7e28('0x11')](_0x7e28('0x1f'),_0x5f0fb7,JSON[_0x7e28('0x13')](_0x34fbfa));_0x299965(_0x34fbfa);})[_0x7e28('0x17')](function(_0x45d226){logger['error'](_0x7e28('0x1f'),_0x45d226[_0x7e28('0x15')],_0x5f0fb7);_0xee5cd2(_0xcc6099[_0x7e28('0x14')](0x1f4,_0x45d226[_0x7e28('0x15')]));});});}; \ No newline at end of file +var _0xc09a=['where','include','map','model','attributes','ShowSquareProject','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareProject','find','options','raw'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xc09a,0xc5));var _0xac09=function(_0x266617,_0x55dc33){_0x266617=_0x266617-0x0;var _0x108af0=_0xc09a[_0x266617];return _0x108af0;};'use strict';var _=require(_0xac09('0x0'));var util=require('util');var moment=require(_0xac09('0x1'));var BPromise=require(_0xac09('0x2'));var rs=require(_0xac09('0x3'));var fs=require('fs');var Redis=require(_0xac09('0x4'));var db=require(_0xac09('0x5'))['db'];var utils=require(_0xac09('0x6'));var logger=require(_0xac09('0x7'))(_0xac09('0x8'));var config=require(_0xac09('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xac09('0xa')][_0xac09('0xb')]({'port':0x232a});config[_0xac09('0xc')]=_['defaults'](config['redis'],{'host':_0xac09('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac09('0xc')]));require(_0xac09('0xe'))[_0xac09('0xf')](socket);function respondWithRpcPromise(_0x1b20eb,_0x3fbe72,_0x2d675f){return new BPromise(function(_0x25c9c9,_0x39d9ac){return client[_0xac09('0x10')](_0x1b20eb,_0x2d675f)['then'](function(_0x54dcb0){logger[_0xac09('0x11')](_0xac09('0x12'),_0x3fbe72,_0xac09('0x13'));logger[_0xac09('0x14')](_0xac09('0x15'),_0x3fbe72,_0xac09('0x13'),JSON[_0xac09('0x16')](_0x54dcb0));if(_0x54dcb0['error']){if(_0x54dcb0[_0xac09('0x17')][_0xac09('0x18')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x3fbe72,_0x54dcb0[_0xac09('0x17')][_0xac09('0x19')]);return _0x39d9ac(_0x54dcb0[_0xac09('0x17')][_0xac09('0x19')]);}logger[_0xac09('0x17')](_0xac09('0x12'),_0x3fbe72,_0x54dcb0[_0xac09('0x17')]['message']);return _0x25c9c9(_0x54dcb0[_0xac09('0x17')][_0xac09('0x19')]);}else{logger[_0xac09('0x11')](_0xac09('0x12'),_0x3fbe72,_0xac09('0x13'));_0x25c9c9(_0x54dcb0[_0xac09('0x1a')][_0xac09('0x19')]);}})['catch'](function(_0x321a8e){logger[_0xac09('0x17')](_0xac09('0x12'),_0x3fbe72,_0x321a8e);_0x39d9ac(_0x321a8e);});});}exports['ShowSquareProject']=function(_0x4d5d48){var _0x17e8a6=this;return new Promise(function(_0x25cc87,_0x33e070){return db[_0xac09('0x1b')][_0xac09('0x1c')]({'raw':_0x4d5d48[_0xac09('0x1d')]?_0x4d5d48[_0xac09('0x1d')][_0xac09('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d5d48[_0xac09('0x1d')]?_0x4d5d48[_0xac09('0x1d')][_0xac09('0x1f')]||null:null,'attributes':_0x4d5d48[_0xac09('0x1d')]?_0x4d5d48[_0xac09('0x1d')]['attributes']||null:null,'include':_0x4d5d48[_0xac09('0x1d')]?_0x4d5d48[_0xac09('0x1d')][_0xac09('0x20')]?_[_0xac09('0x21')](_0x4d5d48[_0xac09('0x1d')][_0xac09('0x20')],function(_0x3b5559){return{'model':db[_0x3b5559[_0xac09('0x22')]],'as':_0x3b5559['as'],'attributes':_0x3b5559[_0xac09('0x23')],'include':_0x3b5559['include']?_['map'](_0x3b5559[_0xac09('0x20')],function(_0xbece9c){return{'model':db[_0xbece9c[_0xac09('0x22')]],'as':_0xbece9c['as'],'attributes':_0xbece9c[_0xac09('0x23')],'include':_0xbece9c['include']?_[_0xac09('0x21')](_0xbece9c[_0xac09('0x20')],function(_0xd86ad1){return{'model':db[_0xd86ad1[_0xac09('0x22')]],'as':_0xd86ad1['as'],'attributes':_0xd86ad1[_0xac09('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48d760){logger[_0xac09('0x11')](_0xac09('0x24'),_0x4d5d48);logger[_0xac09('0x14')](_0xac09('0x24'),_0x4d5d48,JSON[_0xac09('0x16')](_0x48d760));_0x25cc87(_0x48d760);})[_0xac09('0x25')](function(_0x1a275f){logger[_0xac09('0x17')](_0xac09('0x24'),_0x1a275f[_0xac09('0x19')],_0x4d5d48);_0x33e070(_0x17e8a6[_0xac09('0x17')](0x1f4,_0x1a275f[_0xac09('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d2172b2..e6f4344 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 _0xd117=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x452d3e,_0x46aff8){var _0x3b1530=function(_0x51aee7){while(--_0x51aee7){_0x452d3e['push'](_0x452d3e['shift']());}};_0x3b1530(++_0x46aff8);}(_0xd117,0x182));var _0x7d11=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0xd117[_0x3ce937];return _0x41d2fa;};'use strict';var SquareProjectEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){SquareProjectEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);SquareProjectEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file +var _0xfdbd=['removeListener','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x1e48ee,_0x2c412f){var _0x4b548a=function(_0x105b15){while(--_0x105b15){_0x1e48ee['push'](_0x1e48ee['shift']());}};_0x4b548a(++_0x2c412f);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xfdbd[_0x43d16c];return _0x208cce;};'use strict';var SquareProjectEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){SquareProjectEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);SquareProjectEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4fb2a16..6558a2c 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 _0x22a8=['/:id/delete','destroy','multer','path','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','download','post','create','put','/:id','update','delete'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x22a8,0xec));var _0x822a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x22a8[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x822a('0x0'));var util=require('util');var path=require(_0x822a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x822a('0x2')]();var auth=require(_0x822a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x822a('0x4'));var controller=require(_0x822a('0x5'));router[_0x822a('0x6')]('/',auth[_0x822a('0x7')](),controller[_0x822a('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x822a('0x6')]('/:id/download',auth[_0x822a('0x7')](),controller[_0x822a('0x9')]);router[_0x822a('0xa')]('/',auth[_0x822a('0x7')](),controller[_0x822a('0xb')]);router[_0x822a('0xc')](_0x822a('0xd'),auth[_0x822a('0x7')](),controller[_0x822a('0xe')]);router[_0x822a('0xf')](_0x822a('0x10'),auth[_0x822a('0x7')](),controller[_0x822a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd01b=['index','get','/:id','show','/:id/download','download','post','create','update','delete','/:id/delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x14dfa0,_0x383c03){var _0x226811=function(_0x22f032){while(--_0x22f032){_0x14dfa0['push'](_0x14dfa0['shift']());}};_0x226811(++_0x383c03);}(_0xd01b,0x160));var _0xbd01=function(_0x4ce925,_0x196e8c){_0x4ce925=_0x4ce925-0x0;var _0x259723=_0xd01b[_0x4ce925];return _0x259723;};'use strict';var multer=require('multer');var util=require(_0xbd01('0x0'));var path=require(_0xbd01('0x1'));var timeout=require(_0xbd01('0x2'));var express=require(_0xbd01('0x3'));var router=express[_0xbd01('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbd01('0x5'));var config=require(_0xbd01('0x6'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xbd01('0x7')](),controller[_0xbd01('0x8')]);router[_0xbd01('0x9')](_0xbd01('0xa'),auth['isAuthenticated'](),controller[_0xbd01('0xb')]);router['get'](_0xbd01('0xc'),auth[_0xbd01('0x7')](),controller[_0xbd01('0xd')]);router[_0xbd01('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd01('0xf')]);router['put'](_0xbd01('0xa'),auth['isAuthenticated'](),controller[_0xbd01('0x10')]);router[_0xbd01('0x11')](_0xbd01('0x12'),auth['isAuthenticated'](),controller[_0xbd01('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ab77089..bd85933 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 _0xdaa1=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xdaa1,0x17d));var _0x1daa=function(_0x2042f7,_0x4d5c82){_0x2042f7=_0x2042f7-0x0;var _0x1d7e2a=_0xdaa1[_0x2042f7];return _0x1d7e2a;};'use strict';var Sequelize=require(_0x1daa('0x0'));module[_0x1daa('0x1')]={'uniqueid':{'type':Sequelize[_0x1daa('0x2')]},'callerid':{'type':Sequelize[_0x1daa('0x2')]},'calleridname':{'type':Sequelize[_0x1daa('0x2')]},'context':{'type':Sequelize[_0x1daa('0x2')]},'extension':{'type':Sequelize[_0x1daa('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1daa('0x2')]},'dnid':{'type':Sequelize[_0x1daa('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x1daa('0x2')]},'filename':{'type':Sequelize[_0x1daa('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1daa('0x3')],'get':function(){var _0x25e882='';var _0x2aef81=this[_0x1daa('0x4')]('savePath');if(_0x2aef81){_0x25e882=_0x2aef81[_0x1daa('0x5')](_0x2aef81[_0x1daa('0x6')]('.'));}return _0x25e882;}}}; \ No newline at end of file +var _0xd775=['getDataValue','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x2194ed,_0x386a52){var _0x437e67=function(_0x583086){while(--_0x583086){_0x2194ed['push'](_0x2194ed['shift']());}};_0x437e67(++_0x386a52);}(_0xd775,0x18e));var _0x5d77=function(_0x1e920e,_0x148c13){_0x1e920e=_0x1e920e-0x0;var _0x452ff6=_0xd775[_0x1e920e];return _0x452ff6;};'use strict';var Sequelize=require(_0x5d77('0x0'));module[_0x5d77('0x1')]={'uniqueid':{'type':Sequelize[_0x5d77('0x2')]},'callerid':{'type':Sequelize[_0x5d77('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5d77('0x2')]},'extension':{'type':Sequelize[_0x5d77('0x2')]},'priority':{'type':Sequelize[_0x5d77('0x2')]},'accountcode':{'type':Sequelize[_0x5d77('0x2')]},'dnid':{'type':Sequelize[_0x5d77('0x2')]},'projectName':{'type':Sequelize[_0x5d77('0x2')]},'saveName':{'type':Sequelize[_0x5d77('0x2')]},'filename':{'type':Sequelize[_0x5d77('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x5d77('0x3')],'get':function(){var _0x25fe83='';var _0xe41cc8=this[_0x5d77('0x4')]('savePath');if(_0xe41cc8){_0x25fe83=_0xe41cc8['substring'](_0xe41cc8[_0x5d77('0x5')]('.'));}return _0x25fe83;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 57dbe83..084ba0c 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 _0xbf13=['destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','error','stack','map','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','merge','options','where','include','SquareRecording','findAll','rows','catch','show','params','keys','body','update','find','download','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found'];(function(_0x5a5aaf,_0x108d76){var _0x1cdd42=function(_0x4332fe){while(--_0x4332fe){_0x5a5aaf['push'](_0x5a5aaf['shift']());}};_0x1cdd42(++_0x108d76);}(_0xbf13,0x66));var _0x3bf1=function(_0x5ae055,_0x2d5726){_0x5ae055=_0x5ae055-0x0;var _0x4eb3fe=_0xbf13[_0x5ae055];return _0x4eb3fe;};'use strict';var pdf=require(_0x3bf1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3bf1('0x1'));var zipdir=require(_0x3bf1('0x2'));var jsonpatch=require(_0x3bf1('0x3'));var rp=require(_0x3bf1('0x4'));var moment=require(_0x3bf1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3bf1('0x6'));var util=require(_0x3bf1('0x7'));var path=require(_0x3bf1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bf1('0x9'));var fs=require('fs');var _=require(_0x3bf1('0xa'));var squel=require(_0x3bf1('0xb'));var crypto=require(_0x3bf1('0xc'));var jsforce=require(_0x3bf1('0xd'));var deskjs=require(_0x3bf1('0xe'));var toCsv=require(_0x3bf1('0xf'));var querystring=require(_0x3bf1('0x10'));var Papa=require(_0x3bf1('0x11'));var Redis=require(_0x3bf1('0x12'));var authService=require(_0x3bf1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bf1('0x14'));var logger=require('../../config/logger')(_0x3bf1('0x15'));var utils=require(_0x3bf1('0x16'));var config=require(_0x3bf1('0x17'));var licenseUtil=require(_0x3bf1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x250432,_0x2aa27a){_0x2aa27a=_0x2aa27a||0xcc;return function(_0x3bbca7){if(_0x3bbca7){return _0x250432[_0x3bf1('0x19')](_0x2aa27a);}return _0x250432[_0x3bf1('0x1a')](_0x2aa27a)[_0x3bf1('0x1b')]();};}function respondWithResult(_0x13a831,_0x5eb98c){_0x5eb98c=_0x5eb98c||0xc8;return function(_0x4d802d){if(_0x4d802d){return _0x13a831[_0x3bf1('0x1a')](_0x5eb98c)[_0x3bf1('0x1c')](_0x4d802d);}};}function respondWithFilteredResult(_0xd1da3,_0x33fafd){return function(_0x46f535){if(_0x46f535){var _0x501254=_0x46f535[_0x3bf1('0x1d')],_0x4c009d=_0x33fafd[_0x3bf1('0x1e')],_0x308ad4=_0x33fafd[_0x3bf1('0x1e')]+_0x33fafd['limit'],_0x851237;if(_0x308ad4>=_0x501254){_0x308ad4=_0x501254;_0x851237=0xc8;}else{_0x851237=0xce;}_0xd1da3['status'](_0x851237);return _0xd1da3[_0x3bf1('0x1f')](_0x3bf1('0x20'),_0x4c009d+'-'+_0x308ad4+'/'+_0x501254)[_0x3bf1('0x1c')](_0x46f535);}return null;};}function patchUpdates(_0x5937f5){return function(_0x705e87){try{jsonpatch[_0x3bf1('0x21')](_0x705e87,_0x5937f5,!![]);}catch(_0x19c3ff){return BPromise['reject'](_0x19c3ff);}return _0x705e87[_0x3bf1('0x22')]();};}function saveUpdates(_0x20e095,_0x126a25){return function(_0xc65b2e){if(_0xc65b2e){return _0xc65b2e['update'](_0x20e095)[_0x3bf1('0x23')](function(_0x37ae11){return _0x37ae11;});}return null;};}function removeEntity(_0x156a11,_0x372bfc){return function(_0x4106bc){if(_0x4106bc){return _0x4106bc['destroy']()[_0x3bf1('0x23')](function(){_0x156a11[_0x3bf1('0x1a')](0xcc)[_0x3bf1('0x1b')]();});}};}function handleEntityNotFound(_0x1b59c4,_0x3631b4){return function(_0x1ef719){if(!_0x1ef719){_0x1b59c4[_0x3bf1('0x19')](0x194);}return _0x1ef719;};}function handleError(_0x257666,_0x4d95e2){_0x4d95e2=_0x4d95e2||0x1f4;return function(_0x347f7e){logger[_0x3bf1('0x24')](_0x347f7e[_0x3bf1('0x25')]);if(_0x347f7e['name']){delete _0x347f7e['name'];}_0x257666[_0x3bf1('0x1a')](_0x4d95e2)['send'](_0x347f7e);};}exports['index']=function(_0x2c78a4,_0xf5a037){var _0x7fa220={},_0x462b1d={},_0x47b21f={'count':0x0,'rows':[]};var _0x4de752=_[_0x3bf1('0x26')](db['SquareRecording'][_0x3bf1('0x27')],function(_0x1681ac){return{'name':_0x1681ac['fieldName'],'type':_0x1681ac[_0x3bf1('0x28')][_0x3bf1('0x29')]};});_0x462b1d[_0x3bf1('0x2a')]=_[_0x3bf1('0x26')](_0x4de752,_0x3bf1('0x2b'));_0x462b1d[_0x3bf1('0x2c')]=_['keys'](_0x2c78a4[_0x3bf1('0x2c')]);_0x462b1d[_0x3bf1('0x2d')]=_[_0x3bf1('0x2e')](_0x462b1d[_0x3bf1('0x2a')],_0x462b1d[_0x3bf1('0x2c')]);_0x7fa220['attributes']=_[_0x3bf1('0x2e')](_0x462b1d[_0x3bf1('0x2a')],qs[_0x3bf1('0x2f')](_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x2f')]));_0x7fa220[_0x3bf1('0x30')]=_0x7fa220[_0x3bf1('0x30')][_0x3bf1('0x31')]?_0x7fa220[_0x3bf1('0x30')]:_0x462b1d[_0x3bf1('0x2a')];if(!_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x32')]('nolimit')){_0x7fa220[_0x3bf1('0x33')]=qs['limit'](_0x2c78a4[_0x3bf1('0x2c')]['limit']);_0x7fa220[_0x3bf1('0x1e')]=qs[_0x3bf1('0x1e')](_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x1e')]);}_0x7fa220[_0x3bf1('0x34')]=qs['sort'](_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x35')]);_0x7fa220['where']=qs[_0x3bf1('0x2d')](_[_0x3bf1('0x36')](_0x2c78a4[_0x3bf1('0x2c')],_0x462b1d['filters']),_0x4de752);if(_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x37')]){_0x7fa220['where']=_[_0x3bf1('0x38')](_0x7fa220['where'],{'$or':_['map'](_0x4de752,function(_0x3b59c0){if(_0x3b59c0['type']!=='VIRTUAL'){var _0x356670={};_0x356670[_0x3b59c0['name']]={'$like':'%'+_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x37')]+'%'};return _0x356670;}})});}_0x7fa220=_[_0x3bf1('0x38')]({},_0x7fa220,_0x2c78a4[_0x3bf1('0x39')]);var _0xa03e70={'where':_0x7fa220[_0x3bf1('0x3a')]};return db['SquareRecording'][_0x3bf1('0x1d')](_0xa03e70)[_0x3bf1('0x23')](function(_0x3a7f77){_0x47b21f[_0x3bf1('0x1d')]=_0x3a7f77;if(_0x2c78a4[_0x3bf1('0x2c')]['includeAll']){_0x7fa220[_0x3bf1('0x3b')]=[{'all':!![]}];}return db[_0x3bf1('0x3c')][_0x3bf1('0x3d')](_0x7fa220);})['then'](function(_0x420794){_0x47b21f[_0x3bf1('0x3e')]=_0x420794;return _0x47b21f;})[_0x3bf1('0x23')](respondWithFilteredResult(_0xf5a037,_0x7fa220))[_0x3bf1('0x3f')](handleError(_0xf5a037,null));};exports[_0x3bf1('0x40')]=function(_0x463130,_0x15d834){var _0x2ce706={'raw':!![],'where':{'id':_0x463130[_0x3bf1('0x41')]['id']}},_0x44e447={};_0x44e447[_0x3bf1('0x2a')]=_[_0x3bf1('0x42')](db['SquareRecording'][_0x3bf1('0x27')]);_0x44e447[_0x3bf1('0x2c')]=_['keys'](_0x463130['query']);_0x44e447[_0x3bf1('0x2d')]=_[_0x3bf1('0x2e')](_0x44e447[_0x3bf1('0x2a')],_0x44e447[_0x3bf1('0x2c')]);_0x2ce706[_0x3bf1('0x30')]=_['intersection'](_0x44e447[_0x3bf1('0x2a')],qs[_0x3bf1('0x2f')](_0x463130['query'][_0x3bf1('0x2f')]));_0x2ce706[_0x3bf1('0x30')]=_0x2ce706[_0x3bf1('0x30')]['length']?_0x2ce706[_0x3bf1('0x30')]:_0x44e447['model'];if(_0x463130['query']['includeAll']){_0x2ce706['include']=[{'all':!![]}];}_0x2ce706=_[_0x3bf1('0x38')]({},_0x2ce706,_0x463130[_0x3bf1('0x39')]);return db[_0x3bf1('0x3c')]['find'](_0x2ce706)[_0x3bf1('0x23')](handleEntityNotFound(_0x15d834,null))['then'](respondWithResult(_0x15d834,null))[_0x3bf1('0x3f')](handleError(_0x15d834,null));};exports['create']=function(_0x4ebb09,_0x21f9c4){return db[_0x3bf1('0x3c')]['create'](_0x4ebb09[_0x3bf1('0x43')],{})[_0x3bf1('0x23')](respondWithResult(_0x21f9c4,0xc9))[_0x3bf1('0x3f')](handleError(_0x21f9c4,null));};exports[_0x3bf1('0x44')]=function(_0x24bcd7,_0x2b1f02){if(_0x24bcd7[_0x3bf1('0x43')]['id']){delete _0x24bcd7[_0x3bf1('0x43')]['id'];}return db[_0x3bf1('0x3c')][_0x3bf1('0x45')]({'where':{'id':_0x24bcd7[_0x3bf1('0x41')]['id']}})[_0x3bf1('0x23')](handleEntityNotFound(_0x2b1f02,null))[_0x3bf1('0x23')](saveUpdates(_0x24bcd7['body'],null))[_0x3bf1('0x23')](respondWithResult(_0x2b1f02,null))[_0x3bf1('0x3f')](handleError(_0x2b1f02,null));};exports[_0x3bf1('0x46')]=function(_0x46f086,_0x285198,_0x55c27e){var _0x40ebca=require(_0x3bf1('0x47'));var _0x50a212=![];var _0x3b77b8={};if(_0x46f086[_0x3bf1('0x2c')][_0x3bf1('0x28')]&&_0x46f086[_0x3bf1('0x2c')][_0x3bf1('0x28')]===_0x3bf1('0x48')){_0x3b77b8[_0x3bf1('0x48')]=_0x46f086[_0x3bf1('0x41')]['id'];}else{_0x3b77b8['id']=_0x46f086[_0x3bf1('0x41')]['id'];}return db[_0x3bf1('0x3c')][_0x3bf1('0x45')]({'where':_0x3b77b8,'attributes':['id',_0x3bf1('0x49'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x285198,null))[_0x3bf1('0x23')](function(_0x1b982b){if(_0x1b982b){var _0xf671be=_0x1b982b['savePath'];var _0x252d3c=util[_0x3bf1('0x4a')]('%s.cypher',_0xf671be);if(fs[_0x3bf1('0x4b')](_0x252d3c)){_0x50a212=!![];return _0x40ebca[_0x3bf1('0x4c')](_0x252d3c,_0xf671be,config[_0x3bf1('0x4d')][_0x3bf1('0x4e')])['then'](function(){return _0x1b982b;});}return _0x1b982b;}})['then'](function(_0x3e5291){if(_0x3e5291){var _0x1846ef=_0x3e5291[_0x3bf1('0x49')];if(!fs[_0x3bf1('0x4b')](_0x1846ef)){throw new db['Sequelize'][(_0x3bf1('0x4f'))](_0x3bf1('0x50'));}if(_0x3e5291[_0x3bf1('0x51')]){return _0x285198[_0x3bf1('0x46')](_0x1846ef,_0x3e5291[_0x3bf1('0x51')]+path[_0x3bf1('0x52')](_0x1846ef),function(){if(_0x50a212){fs[_0x3bf1('0x53')](_0x1846ef);}});}else{return _0x285198[_0x3bf1('0x46')](_0x1846ef,function(_0x163613){if(_0x50a212){fs[_0x3bf1('0x53')](_0x1846ef);}});}}})[_0x3bf1('0x3f')](function(_0x1f17ab){if(_0x1f17ab[_0x3bf1('0x54')]===_0x3bf1('0x50')){_0x285198[_0x3bf1('0x1a')](0x194)['send'](_0x3bf1('0x55'));}else{return handleError(_0x285198,null);}});};exports[_0x3bf1('0x56')]=function(_0x5b90e3,_0x27c841){return db[_0x3bf1('0x3c')]['find']({'where':{'id':_0x5b90e3[_0x3bf1('0x41')]['id']}})[_0x3bf1('0x23')](function(_0x30db08){if(!_0x30db08)throw new ReferenceError(_0x3bf1('0x57'));return _0x30db08;})['then'](function(_0x3cacb0){var _0x1c1d86=_0x3cacb0[_0x3bf1('0x49')];logger['info'](_0x3bf1('0x58'),_0x1c1d86);if(!_[_0x3bf1('0x59')](_0x3cacb0[_0x3bf1('0x49')])&&fs[_0x3bf1('0x4b')](_0x1c1d86)){logger[_0x3bf1('0x5a')](_0x3bf1('0x5b')+_0x1c1d86+_0x3bf1('0x5c'));fs['unlinkSync'](_0x1c1d86);}_0x1c1d86=_0x1c1d86+'.cypher';if(!_['isNil'](_0x3cacb0['savePath'])&&fs[_0x3bf1('0x4b')](_0x1c1d86)){logger['info'](_0x3bf1('0x5b')+_0x1c1d86+_0x3bf1('0x5c'));fs[_0x3bf1('0x5d')](_0x1c1d86);}return _0x3cacb0;})[_0x3bf1('0x23')](function(_0x466cdd){if(!_0x466cdd)throw new InternalError();return _0x466cdd[_0x3bf1('0x56')]();})[_0x3bf1('0x23')](function(){_0x27c841[_0x3bf1('0x1a')](0xcc)[_0x3bf1('0x1b')]();})[_0x3bf1('0x3f')](handleError(_0x27c841,null));}; \ No newline at end of file +var _0x3cd6=['show','include','options','find','create','body','download','../../components/encryptor','type','uniqueid','params','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Entity\x20not\x20found','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','SquareRecording','includeAll','findAll','rows','catch'];(function(_0x491cc1,_0x17966e){var _0x317541=function(_0x291114){while(--_0x291114){_0x491cc1['push'](_0x491cc1['shift']());}};_0x317541(++_0x17966e);}(_0x3cd6,0x19f));var _0x63cd=function(_0x41c597,_0x32cddf){_0x41c597=_0x41c597-0x0;var _0xa58b15=_0x3cd6[_0x41c597];return _0xa58b15;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x63cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x63cd('0x1'));var jsonpatch=require(_0x63cd('0x2'));var rp=require(_0x63cd('0x3'));var moment=require(_0x63cd('0x4'));var BPromise=require(_0x63cd('0x5'));var Mustache=require(_0x63cd('0x6'));var util=require(_0x63cd('0x7'));var path=require(_0x63cd('0x8'));var sox=require(_0x63cd('0x9'));var csv=require(_0x63cd('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x63cd('0xb'));var crypto=require(_0x63cd('0xc'));var jsforce=require(_0x63cd('0xd'));var deskjs=require(_0x63cd('0xe'));var toCsv=require(_0x63cd('0xa'));var querystring=require(_0x63cd('0xf'));var Papa=require(_0x63cd('0x10'));var Redis=require('ioredis');var authService=require(_0x63cd('0x11'));var qs=require(_0x63cd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63cd('0x13'));var logger=require(_0x63cd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x63cd('0x15'));var licenseUtil=require(_0x63cd('0x16'));var db=require(_0x63cd('0x17'))['db'];function respondWithStatusCode(_0x439cfc,_0x319a05){_0x319a05=_0x319a05||0xcc;return function(_0x1876c9){if(_0x1876c9){return _0x439cfc[_0x63cd('0x18')](_0x319a05);}return _0x439cfc['status'](_0x319a05)[_0x63cd('0x19')]();};}function respondWithResult(_0x31a14a,_0x2bab92){_0x2bab92=_0x2bab92||0xc8;return function(_0x2c3336){if(_0x2c3336){return _0x31a14a[_0x63cd('0x1a')](_0x2bab92)[_0x63cd('0x1b')](_0x2c3336);}};}function respondWithFilteredResult(_0x371a6c,_0x2d6f2b){return function(_0x29054f){if(_0x29054f){var _0x47e30a=_0x29054f[_0x63cd('0x1c')],_0x435443=_0x2d6f2b[_0x63cd('0x1d')],_0x9a1e85=_0x2d6f2b[_0x63cd('0x1d')]+_0x2d6f2b[_0x63cd('0x1e')],_0x2315a0;if(_0x9a1e85>=_0x47e30a){_0x9a1e85=_0x47e30a;_0x2315a0=0xc8;}else{_0x2315a0=0xce;}_0x371a6c['status'](_0x2315a0);return _0x371a6c['set'](_0x63cd('0x1f'),_0x435443+'-'+_0x9a1e85+'/'+_0x47e30a)[_0x63cd('0x1b')](_0x29054f);}return null;};}function patchUpdates(_0x34303c){return function(_0x3482bd){try{jsonpatch[_0x63cd('0x20')](_0x3482bd,_0x34303c,!![]);}catch(_0x5b3d8a){return BPromise[_0x63cd('0x21')](_0x5b3d8a);}return _0x3482bd[_0x63cd('0x22')]();};}function saveUpdates(_0x37774b,_0x5de217){return function(_0x189c5d){if(_0x189c5d){return _0x189c5d[_0x63cd('0x23')](_0x37774b)[_0x63cd('0x24')](function(_0x19a94){return _0x19a94;});}return null;};}function removeEntity(_0x93ddbd,_0x44e3e2){return function(_0x12f04e){if(_0x12f04e){return _0x12f04e[_0x63cd('0x25')]()['then'](function(){_0x93ddbd[_0x63cd('0x1a')](0xcc)[_0x63cd('0x19')]();});}};}function handleEntityNotFound(_0x2e7248,_0x5648b1){return function(_0x5baf57){if(!_0x5baf57){_0x2e7248[_0x63cd('0x18')](0x194);}return _0x5baf57;};}function handleError(_0x4efe28,_0x8c0487){_0x8c0487=_0x8c0487||0x1f4;return function(_0x1f69d5){logger[_0x63cd('0x26')](_0x1f69d5[_0x63cd('0x27')]);if(_0x1f69d5['name']){delete _0x1f69d5['name'];}_0x4efe28[_0x63cd('0x1a')](_0x8c0487)[_0x63cd('0x28')](_0x1f69d5);};}exports[_0x63cd('0x29')]=function(_0x4e00ca,_0x415884){var _0x3af918={},_0x496fa3={},_0x1405b0={'count':0x0,'rows':[]};var _0x4f63e9=_['map'](db['SquareRecording'][_0x63cd('0x2a')],function(_0x13a330){return{'name':_0x13a330[_0x63cd('0x2b')],'type':_0x13a330['type'][_0x63cd('0x2c')]};});_0x496fa3[_0x63cd('0x2d')]=_[_0x63cd('0x2e')](_0x4f63e9,_0x63cd('0x2f'));_0x496fa3[_0x63cd('0x30')]=_['keys'](_0x4e00ca[_0x63cd('0x30')]);_0x496fa3[_0x63cd('0x31')]=_[_0x63cd('0x32')](_0x496fa3[_0x63cd('0x2d')],_0x496fa3['query']);_0x3af918[_0x63cd('0x33')]=_[_0x63cd('0x32')](_0x496fa3[_0x63cd('0x2d')],qs['fields'](_0x4e00ca[_0x63cd('0x30')][_0x63cd('0x34')]));_0x3af918[_0x63cd('0x33')]=_0x3af918[_0x63cd('0x33')][_0x63cd('0x35')]?_0x3af918[_0x63cd('0x33')]:_0x496fa3[_0x63cd('0x2d')];if(!_0x4e00ca[_0x63cd('0x30')]['hasOwnProperty']('nolimit')){_0x3af918[_0x63cd('0x1e')]=qs['limit'](_0x4e00ca['query'][_0x63cd('0x1e')]);_0x3af918[_0x63cd('0x1d')]=qs[_0x63cd('0x1d')](_0x4e00ca[_0x63cd('0x30')][_0x63cd('0x1d')]);}_0x3af918['order']=qs[_0x63cd('0x36')](_0x4e00ca[_0x63cd('0x30')][_0x63cd('0x36')]);_0x3af918[_0x63cd('0x37')]=qs[_0x63cd('0x31')](_[_0x63cd('0x38')](_0x4e00ca['query'],_0x496fa3[_0x63cd('0x31')]),_0x4f63e9);if(_0x4e00ca[_0x63cd('0x30')][_0x63cd('0x39')]){_0x3af918[_0x63cd('0x37')]=_[_0x63cd('0x3a')](_0x3af918[_0x63cd('0x37')],{'$or':_[_0x63cd('0x2e')](_0x4f63e9,function(_0x4044a0){if(_0x4044a0['type']!==_0x63cd('0x3b')){var _0x3c3256={};_0x3c3256[_0x4044a0[_0x63cd('0x2f')]]={'$like':'%'+_0x4e00ca[_0x63cd('0x30')][_0x63cd('0x39')]+'%'};return _0x3c3256;}})});}_0x3af918=_[_0x63cd('0x3a')]({},_0x3af918,_0x4e00ca['options']);var _0x2f4973={'where':_0x3af918[_0x63cd('0x37')]};return db[_0x63cd('0x3c')]['count'](_0x2f4973)[_0x63cd('0x24')](function(_0xda9876){_0x1405b0[_0x63cd('0x1c')]=_0xda9876;if(_0x4e00ca['query'][_0x63cd('0x3d')]){_0x3af918['include']=[{'all':!![]}];}return db[_0x63cd('0x3c')][_0x63cd('0x3e')](_0x3af918);})[_0x63cd('0x24')](function(_0xe48aac){_0x1405b0[_0x63cd('0x3f')]=_0xe48aac;return _0x1405b0;})[_0x63cd('0x24')](respondWithFilteredResult(_0x415884,_0x3af918))[_0x63cd('0x40')](handleError(_0x415884,null));};exports[_0x63cd('0x41')]=function(_0x4dcb66,_0x3127c1){var _0x20c436={'raw':!![],'where':{'id':_0x4dcb66['params']['id']}},_0x1a1471={};_0x1a1471[_0x63cd('0x2d')]=_['keys'](db['SquareRecording']['rawAttributes']);_0x1a1471['query']=_['keys'](_0x4dcb66[_0x63cd('0x30')]);_0x1a1471['filters']=_[_0x63cd('0x32')](_0x1a1471[_0x63cd('0x2d')],_0x1a1471[_0x63cd('0x30')]);_0x20c436['attributes']=_[_0x63cd('0x32')](_0x1a1471[_0x63cd('0x2d')],qs[_0x63cd('0x34')](_0x4dcb66[_0x63cd('0x30')]['fields']));_0x20c436['attributes']=_0x20c436[_0x63cd('0x33')]['length']?_0x20c436[_0x63cd('0x33')]:_0x1a1471[_0x63cd('0x2d')];if(_0x4dcb66[_0x63cd('0x30')][_0x63cd('0x3d')]){_0x20c436[_0x63cd('0x42')]=[{'all':!![]}];}_0x20c436=_[_0x63cd('0x3a')]({},_0x20c436,_0x4dcb66[_0x63cd('0x43')]);return db[_0x63cd('0x3c')][_0x63cd('0x44')](_0x20c436)[_0x63cd('0x24')](handleEntityNotFound(_0x3127c1,null))['then'](respondWithResult(_0x3127c1,null))[_0x63cd('0x40')](handleError(_0x3127c1,null));};exports[_0x63cd('0x45')]=function(_0x20c89c,_0x261e10){return db[_0x63cd('0x3c')]['create'](_0x20c89c[_0x63cd('0x46')],{})[_0x63cd('0x24')](respondWithResult(_0x261e10,0xc9))[_0x63cd('0x40')](handleError(_0x261e10,null));};exports['update']=function(_0x2816d9,_0x5ca680){if(_0x2816d9[_0x63cd('0x46')]['id']){delete _0x2816d9[_0x63cd('0x46')]['id'];}return db[_0x63cd('0x3c')][_0x63cd('0x44')]({'where':{'id':_0x2816d9['params']['id']}})[_0x63cd('0x24')](handleEntityNotFound(_0x5ca680,null))[_0x63cd('0x24')](saveUpdates(_0x2816d9[_0x63cd('0x46')],null))[_0x63cd('0x24')](respondWithResult(_0x5ca680,null))[_0x63cd('0x40')](handleError(_0x5ca680,null));};exports[_0x63cd('0x47')]=function(_0x325bf6,_0x3a8d50,_0x212c4e){var _0x2368e1=require(_0x63cd('0x48'));var _0x290360=![];var _0x24d50a={};if(_0x325bf6[_0x63cd('0x30')]['type']&&_0x325bf6[_0x63cd('0x30')][_0x63cd('0x49')]===_0x63cd('0x4a')){_0x24d50a[_0x63cd('0x4a')]=_0x325bf6[_0x63cd('0x4b')]['id'];}else{_0x24d50a['id']=_0x325bf6[_0x63cd('0x4b')]['id'];}return db[_0x63cd('0x3c')]['find']({'where':_0x24d50a,'attributes':['id',_0x63cd('0x4c'),_0x63cd('0x4d')],'raw':!![]})[_0x63cd('0x24')](handleEntityNotFound(_0x3a8d50,null))[_0x63cd('0x24')](function(_0x2dd899){if(_0x2dd899){var _0x55739f=_0x2dd899[_0x63cd('0x4c')];var _0xfd83af=util[_0x63cd('0x4e')](_0x63cd('0x4f'),_0x55739f);if(fs[_0x63cd('0x50')](_0xfd83af)){_0x290360=!![];return _0x2368e1[_0x63cd('0x51')](_0xfd83af,_0x55739f,config[_0x63cd('0x52')][_0x63cd('0x53')])[_0x63cd('0x24')](function(){return _0x2dd899;});}return _0x2dd899;}})[_0x63cd('0x24')](function(_0x6113f){if(_0x6113f){var _0x264334=_0x6113f['savePath'];if(!fs[_0x63cd('0x50')](_0x264334)){throw new db[(_0x63cd('0x54'))][(_0x63cd('0x55'))](_0x63cd('0x56'));}if(_0x6113f['filename']){return _0x3a8d50[_0x63cd('0x47')](_0x264334,_0x6113f[_0x63cd('0x4d')]+path[_0x63cd('0x57')](_0x264334),function(){if(_0x290360){fs[_0x63cd('0x58')](_0x264334);}});}else{return _0x3a8d50['download'](_0x264334,function(_0x2b97bf){if(_0x290360){fs[_0x63cd('0x58')](_0x264334);}});}}})[_0x63cd('0x40')](function(_0x235916){if(_0x235916[_0x63cd('0x59')]===_0x63cd('0x56')){_0x3a8d50[_0x63cd('0x1a')](0x194)[_0x63cd('0x28')]('Not\x20found');}else{return handleError(_0x3a8d50,null);}});};exports[_0x63cd('0x25')]=function(_0x2ff3ba,_0x5d34f2){return db[_0x63cd('0x3c')][_0x63cd('0x44')]({'where':{'id':_0x2ff3ba[_0x63cd('0x4b')]['id']}})[_0x63cd('0x24')](function(_0x1f6bce){if(!_0x1f6bce)throw new ReferenceError(_0x63cd('0x5a'));return _0x1f6bce;})['then'](function(_0x131e97){var _0x29b7a0=_0x131e97['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x29b7a0);if(!_[_0x63cd('0x5b')](_0x131e97[_0x63cd('0x4c')])&&fs[_0x63cd('0x50')](_0x29b7a0)){logger[_0x63cd('0x5c')]('File:\x20\x22'+_0x29b7a0+_0x63cd('0x5d'));fs[_0x63cd('0x5e')](_0x29b7a0);}_0x29b7a0=_0x29b7a0+'.cypher';if(!_[_0x63cd('0x5b')](_0x131e97[_0x63cd('0x4c')])&&fs[_0x63cd('0x50')](_0x29b7a0)){logger[_0x63cd('0x5c')](_0x63cd('0x5f')+_0x29b7a0+_0x63cd('0x5d'));fs[_0x63cd('0x5e')](_0x29b7a0);}return _0x131e97;})[_0x63cd('0x24')](function(_0x198382){if(!_0x198382)throw new InternalError();return _0x198382[_0x63cd('0x25')]();})[_0x63cd('0x24')](function(){_0x5d34f2[_0x63cd('0x1a')](0xcc)[_0x63cd('0x19')]();})['catch'](handleError(_0x5d34f2,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 77856d2..7d88277 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 _0x3c2c=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording'];(function(_0x3d2b19,_0x349a5b){var _0x29769b=function(_0x5048ad){while(--_0x5048ad){_0x3d2b19['push'](_0x3d2b19['shift']());}};_0x29769b(++_0x349a5b);}(_0x3c2c,0x160));var _0xc3c2=function(_0x54591e,_0x375db5){_0x54591e=_0x54591e-0x0;var _0xb8d1f0=_0x3c2c[_0x54591e];return _0xb8d1f0;};'use strict';var _=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var logger=require(_0xc3c2('0x2'))(_0xc3c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3c2('0x4'));var fs=require('fs');var path=require(_0xc3c2('0x5'));var rimraf=require(_0xc3c2('0x6'));var config=require(_0xc3c2('0x7'));var attributes=require('./squareRecording.attributes');module[_0xc3c2('0x8')]=function(_0x158a5f,_0x234da9){return _0x158a5f[_0xc3c2('0x9')](_0xc3c2('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','define','lodash'];(function(_0xf3fc65,_0x1c65c9){var _0x344779=function(_0x2871a8){while(--_0x2871a8){_0xf3fc65['push'](_0xf3fc65['shift']());}};_0x344779(++_0x1c65c9);}(_0x8f59,0x11d));var _0x98f5=function(_0x5114aa,_0x4596b9){_0x5114aa=_0x5114aa-0x0;var _0x1841bc=_0x8f59[_0x5114aa];return _0x1841bc;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 4f128bd..f052bee 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 _0x01d4=['stringify','error','message','result','CreateSquareRecording','SquareRecording','options','raw','debug','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x01d4,0x142));var _0x401d=function(_0x20cd96,_0x3812e7){_0x20cd96=_0x20cd96-0x0;var _0x12c893=_0x01d4[_0x20cd96];return _0x12c893;};'use strict';var _=require('lodash');var util=require(_0x401d('0x0'));var moment=require(_0x401d('0x1'));var BPromise=require('bluebird');var rs=require(_0x401d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x401d('0x3'))['db'];var utils=require(_0x401d('0x4'));var logger=require(_0x401d('0x5'))(_0x401d('0x6'));var config=require(_0x401d('0x7'));var jayson=require(_0x401d('0x8'));var client=jayson[_0x401d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5153fa,_0x43d249,_0x6a095a){return new BPromise(function(_0x4d0737,_0xe3d04c){return client[_0x401d('0xa')](_0x5153fa,_0x6a095a)[_0x401d('0xb')](function(_0x57320b){logger[_0x401d('0xc')](_0x401d('0xd'),_0x43d249,'request\x20sent');logger['debug'](_0x401d('0xe'),_0x43d249,_0x401d('0xf'),JSON[_0x401d('0x10')](_0x57320b));if(_0x57320b['error']){if(_0x57320b[_0x401d('0x11')]['code']===0x1f4){logger['error'](_0x401d('0xd'),_0x43d249,_0x57320b['error'][_0x401d('0x12')]);return _0xe3d04c(_0x57320b['error'][_0x401d('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x43d249,_0x57320b[_0x401d('0x11')][_0x401d('0x12')]);return _0x4d0737(_0x57320b[_0x401d('0x11')][_0x401d('0x12')]);}else{logger[_0x401d('0xc')](_0x401d('0xd'),_0x43d249,_0x401d('0xf'));_0x4d0737(_0x57320b[_0x401d('0x13')]['message']);}})['catch'](function(_0x571a1c){logger['error'](_0x401d('0xd'),_0x43d249,_0x571a1c);_0xe3d04c(_0x571a1c);});});}exports[_0x401d('0x14')]=function(_0x3c30fb){var _0x4a25b7=this;return new Promise(function(_0x5f1e5d,_0xb3eceb){return db[_0x401d('0x15')]['create'](_0x3c30fb['body'],{'raw':_0x3c30fb['options']?_0x3c30fb[_0x401d('0x16')][_0x401d('0x17')]===undefined?!![]:![]:!![]})[_0x401d('0xb')](function(_0x2a8ece){logger[_0x401d('0xc')](_0x401d('0x14'),_0x3c30fb);logger[_0x401d('0x18')](_0x401d('0x14'),_0x3c30fb,JSON[_0x401d('0x10')](_0x2a8ece));_0x5f1e5d(_0x2a8ece);})[_0x401d('0x19')](function(_0x36d921){logger[_0x401d('0x11')](_0x401d('0x14'),_0x36d921[_0x401d('0x12')],_0x3c30fb);_0xb3eceb(_0x4a25b7[_0x401d('0x11')](0x1f4,_0x36d921[_0x401d('0x12')]));});});}; \ No newline at end of file +var _0x956e=['request\x20sent','debug','stringify','error','code','message','result','catch','SquareRecording','body','options','raw','then','CreateSquareRecording','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','SquareRecording,\x20%s,\x20%s'];(function(_0xfc1be4,_0x70fc0b){var _0x314b12=function(_0x1cd23a){while(--_0x1cd23a){_0xfc1be4['push'](_0xfc1be4['shift']());}};_0x314b12(++_0x70fc0b);}(_0x956e,0x15e));var _0xe956=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x956e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xe956('0x0'));var util=require(_0xe956('0x1'));var moment=require(_0xe956('0x2'));var BPromise=require('bluebird');var rs=require(_0xe956('0x3'));var fs=require('fs');var Redis=require(_0xe956('0x4'));var db=require(_0xe956('0x5'))['db'];var utils=require(_0xe956('0x6'));var logger=require(_0xe956('0x7'))('rpc');var config=require(_0xe956('0x8'));var jayson=require(_0xe956('0x9'));var client=jayson[_0xe956('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34503f,_0x2a64c8,_0x3064ce){return new BPromise(function(_0x313a6c,_0x41d3e2){return client[_0xe956('0xb')](_0x34503f,_0x3064ce)['then'](function(_0xb1e66){logger[_0xe956('0xc')](_0xe956('0xd'),_0x2a64c8,_0xe956('0xe'));logger[_0xe956('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2a64c8,_0xe956('0xe'),JSON[_0xe956('0x10')](_0xb1e66));if(_0xb1e66[_0xe956('0x11')]){if(_0xb1e66['error'][_0xe956('0x12')]===0x1f4){logger[_0xe956('0x11')](_0xe956('0xd'),_0x2a64c8,_0xb1e66['error'][_0xe956('0x13')]);return _0x41d3e2(_0xb1e66[_0xe956('0x11')][_0xe956('0x13')]);}logger[_0xe956('0x11')](_0xe956('0xd'),_0x2a64c8,_0xb1e66[_0xe956('0x11')][_0xe956('0x13')]);return _0x313a6c(_0xb1e66[_0xe956('0x11')][_0xe956('0x13')]);}else{logger[_0xe956('0xc')](_0xe956('0xd'),_0x2a64c8,_0xe956('0xe'));_0x313a6c(_0xb1e66[_0xe956('0x14')][_0xe956('0x13')]);}})[_0xe956('0x15')](function(_0x2ebf66){logger[_0xe956('0x11')]('SquareRecording,\x20%s,\x20%s',_0x2a64c8,_0x2ebf66);_0x41d3e2(_0x2ebf66);});});}exports['CreateSquareRecording']=function(_0x143c4b){var _0x4bcdd5=this;return new Promise(function(_0x2b1f57,_0x5ce2f2){return db[_0xe956('0x16')]['create'](_0x143c4b[_0xe956('0x17')],{'raw':_0x143c4b[_0xe956('0x18')]?_0x143c4b[_0xe956('0x18')][_0xe956('0x19')]===undefined?!![]:![]:!![]})[_0xe956('0x1a')](function(_0x150f64){logger[_0xe956('0xc')]('CreateSquareRecording',_0x143c4b);logger['debug'](_0xe956('0x1b'),_0x143c4b,JSON[_0xe956('0x10')](_0x150f64));_0x2b1f57(_0x150f64);})[_0xe956('0x15')](function(_0x25efdc){logger['error'](_0xe956('0x1b'),_0x25efdc['message'],_0x143c4b);_0x5ce2f2(_0x4bcdd5[_0xe956('0x11')](0x1f4,_0x25efdc[_0xe956('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 49ab0f7..d3a3f00 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 _0x1f54=['../../config/environment','./squareReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5b998d,_0x1b78ff){var _0x5311b7=function(_0x594d59){while(--_0x594d59){_0x5b998d['push'](_0x5b998d['shift']());}};_0x5311b7(++_0x1b78ff);}(_0x1f54,0x14e));var _0x41f5=function(_0x1e35bd,_0x40ee90){_0x1e35bd=_0x1e35bd-0x0;var _0x2c379d=_0x1f54[_0x1e35bd];return _0x2c379d;};'use strict';var multer=require(_0x41f5('0x0'));var util=require(_0x41f5('0x1'));var path=require(_0x41f5('0x2'));var timeout=require(_0x41f5('0x3'));var express=require('express');var router=express[_0x41f5('0x4')]();var auth=require(_0x41f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x41f5('0x6'));var controller=require(_0x41f5('0x7'));router[_0x41f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x41f5('0x9')]);router[_0x41f5('0x8')](_0x41f5('0xa'),auth['isAuthenticated'](),controller[_0x41f5('0xb')]);router[_0x41f5('0x8')](_0x41f5('0xc'),auth[_0x41f5('0xd')](),controller['show']);router[_0x41f5('0xe')]('/',auth['isAuthenticated'](),controller[_0x41f5('0xf')]);router[_0x41f5('0x10')](_0x41f5('0xc'),auth[_0x41f5('0xd')](),controller[_0x41f5('0x11')]);router['delete'](_0x41f5('0xc'),auth[_0x41f5('0xd')](),controller[_0x41f5('0x12')]);module[_0x41f5('0x13')]=router; \ No newline at end of file +var _0xd200=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xd200,0x13e));var _0x0d20=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xd200[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require(_0x0d20('0x0'));var util=require(_0x0d20('0x1'));var path=require('path');var timeout=require(_0x0d20('0x2'));var express=require('express');var router=express[_0x0d20('0x3')]();var auth=require(_0x0d20('0x4'));var interaction=require(_0x0d20('0x5'));var config=require(_0x0d20('0x6'));var controller=require(_0x0d20('0x7'));router[_0x0d20('0x8')]('/',auth[_0x0d20('0x9')](),controller['index']);router[_0x0d20('0x8')](_0x0d20('0xa'),auth[_0x0d20('0x9')](),controller['describe']);router['get'](_0x0d20('0xb'),auth[_0x0d20('0x9')](),controller[_0x0d20('0xc')]);router[_0x0d20('0xd')]('/',auth['isAuthenticated'](),controller[_0x0d20('0xe')]);router[_0x0d20('0xf')](_0x0d20('0xb'),auth[_0x0d20('0x9')](),controller[_0x0d20('0x10')]);router[_0x0d20('0x11')]('/:id',auth[_0x0d20('0x9')](),controller[_0x0d20('0x12')]);module[_0x0d20('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 303cbd0..b696825 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 _0x6e21=['exports','STRING','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e21,0x98));var _0x16e2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6e21[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x16e2('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x16e2('0x1')]},'channel':{'type':Sequelize[_0x16e2('0x1')]},'language':{'type':Sequelize[_0x16e2('0x1')]},'type':{'type':Sequelize[_0x16e2('0x1')]},'uniqueid':{'type':Sequelize[_0x16e2('0x1')]},'version':{'type':Sequelize[_0x16e2('0x1')]},'callerid':{'type':Sequelize[_0x16e2('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x16e2('0x1')]},'callington':{'type':Sequelize[_0x16e2('0x1')]},'callingtns':{'type':Sequelize[_0x16e2('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x16e2('0x1')]},'context':{'type':Sequelize[_0x16e2('0x1')]},'extension':{'type':Sequelize[_0x16e2('0x1')]},'priority':{'type':Sequelize[_0x16e2('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x16e2('0x1')]},'threadid':{'type':Sequelize[_0x16e2('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x16e2('0x2')]},'bot':{'type':Sequelize[_0x16e2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe27a=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x427ed7,_0x28ac32){var _0x325239=function(_0x3e6d98){while(--_0x3e6d98){_0x427ed7['push'](_0x427ed7['shift']());}};_0x325239(++_0x28ac32);}(_0xe27a,0x1c5));var _0xae27=function(_0x6323e2,_0x314096){_0x6323e2=_0x6323e2-0x0;var _0x3a37f3=_0xe27a[_0x6323e2];return _0x3a37f3;};'use strict';var Sequelize=require(_0xae27('0x0'));module[_0xae27('0x1')]={'network':{'type':Sequelize[_0xae27('0x2')]},'network_script':{'type':Sequelize[_0xae27('0x2')]},'request':{'type':Sequelize[_0xae27('0x2')]},'channel':{'type':Sequelize[_0xae27('0x2')]},'language':{'type':Sequelize[_0xae27('0x2')]},'type':{'type':Sequelize[_0xae27('0x2')]},'uniqueid':{'type':Sequelize[_0xae27('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xae27('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xae27('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xae27('0x2')]},'rdnis':{'type':Sequelize[_0xae27('0x2')]},'context':{'type':Sequelize[_0xae27('0x2')]},'extension':{'type':Sequelize[_0xae27('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xae27('0x2')]},'accountcode':{'type':Sequelize[_0xae27('0x2')]},'threadid':{'type':Sequelize[_0xae27('0x2')]},'project_name':{'type':Sequelize[_0xae27('0x2')]},'joinAt':{'type':Sequelize[_0xae27('0x3')]},'leaveAt':{'type':Sequelize[_0xae27('0x3')]},'bot':{'type':Sequelize[_0xae27('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 c91ade2..dff149e 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 _0xaf0d=['limit','Content-Range','apply','reject','update','then','end','error','stack','name','index','map','SquareReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','rawAttributes','options','find','create','body','params','describe','eml-format','rimraf','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x2139c8,_0x2e22f1){var _0x4e9f84=function(_0x2ee187){while(--_0x2ee187){_0x2139c8['push'](_0x2139c8['shift']());}};_0x4e9f84(++_0x2e22f1);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x2820e3,_0xe8629e){_0x2820e3=_0x2820e3-0x0;var _0x436eb6=_0xaf0d[_0x2820e3];return _0x436eb6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdaf0('0x0'));var rimraf=require(_0xdaf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdaf0('0x2'));var util=require(_0xdaf0('0x3'));var path=require(_0xdaf0('0x4'));var sox=require('sox');var csv=require(_0xdaf0('0x5'));var ejs=require(_0xdaf0('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdaf0('0x7'));var jsforce=require(_0xdaf0('0x8'));var deskjs=require(_0xdaf0('0x9'));var toCsv=require(_0xdaf0('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdaf0('0xa'));var as=require(_0xdaf0('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaf0('0xc'))(_0xdaf0('0xd'));var utils=require(_0xdaf0('0xe'));var config=require(_0xdaf0('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaf0('0x10'))['db'];function respondWithStatusCode(_0x149261,_0x1e7a70){_0x1e7a70=_0x1e7a70||0xcc;return function(_0x4fbd9c){if(_0x4fbd9c){return _0x149261[_0xdaf0('0x11')](_0x1e7a70);}return _0x149261[_0xdaf0('0x12')](_0x1e7a70)['end']();};}function respondWithResult(_0x557f8b,_0x48ea31){_0x48ea31=_0x48ea31||0xc8;return function(_0x4f0b4a){if(_0x4f0b4a){return _0x557f8b['status'](_0x48ea31)[_0xdaf0('0x13')](_0x4f0b4a);}};}function respondWithFilteredResult(_0x4ab77b,_0x4296fc){return function(_0x56bc8e){if(_0x56bc8e){var _0x499482=_0x56bc8e['count'],_0x3b5edf=_0x4296fc[_0xdaf0('0x14')],_0xeefdcd=_0x4296fc[_0xdaf0('0x14')]+_0x4296fc[_0xdaf0('0x15')],_0x370345;if(_0xeefdcd>=_0x499482){_0xeefdcd=_0x499482;_0x370345=0xc8;}else{_0x370345=0xce;}_0x4ab77b['status'](_0x370345);return _0x4ab77b['set'](_0xdaf0('0x16'),_0x3b5edf+'-'+_0xeefdcd+'/'+_0x499482)[_0xdaf0('0x13')](_0x56bc8e);}return null;};}function patchUpdates(_0x26bf71){return function(_0x15d2a9){try{jsonpatch[_0xdaf0('0x17')](_0x15d2a9,_0x26bf71,!![]);}catch(_0x77c850){return BPromise[_0xdaf0('0x18')](_0x77c850);}return _0x15d2a9['save']();};}function saveUpdates(_0x353229,_0x350f65){return function(_0x164632){if(_0x164632){return _0x164632[_0xdaf0('0x19')](_0x353229)['then'](function(_0x176ca4){return _0x176ca4;});}return null;};}function removeEntity(_0x320d6e,_0x100817){return function(_0xdc104f){if(_0xdc104f){return _0xdc104f['destroy']()[_0xdaf0('0x1a')](function(){_0x320d6e[_0xdaf0('0x12')](0xcc)[_0xdaf0('0x1b')]();});}};}function handleEntityNotFound(_0x13abfc,_0xb921d5){return function(_0x444800){if(!_0x444800){_0x13abfc[_0xdaf0('0x11')](0x194);}return _0x444800;};}function handleError(_0x5a3584,_0x13ee7f){_0x13ee7f=_0x13ee7f||0x1f4;return function(_0x33e5c2){logger[_0xdaf0('0x1c')](_0x33e5c2[_0xdaf0('0x1d')]);if(_0x33e5c2[_0xdaf0('0x1e')]){delete _0x33e5c2[_0xdaf0('0x1e')];}_0x5a3584[_0xdaf0('0x12')](_0x13ee7f)['send'](_0x33e5c2);};}exports[_0xdaf0('0x1f')]=function(_0x4cd0bf,_0x413d27){var _0x740ff={},_0x4e6974={},_0x39a5b2={'count':0x0,'rows':[]};var _0x5762cc=_[_0xdaf0('0x20')](db[_0xdaf0('0x21')]['rawAttributes'],function(_0xaf86cb){return{'name':_0xaf86cb[_0xdaf0('0x22')],'type':_0xaf86cb[_0xdaf0('0x23')][_0xdaf0('0x24')]};});_0x4e6974[_0xdaf0('0x25')]=_['map'](_0x5762cc,_0xdaf0('0x1e'));_0x4e6974[_0xdaf0('0x26')]=_[_0xdaf0('0x27')](_0x4cd0bf['query']);_0x4e6974[_0xdaf0('0x28')]=_[_0xdaf0('0x29')](_0x4e6974['model'],_0x4e6974[_0xdaf0('0x26')]);_0x740ff[_0xdaf0('0x2a')]=_['intersection'](_0x4e6974[_0xdaf0('0x25')],qs[_0xdaf0('0x2b')](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x2b')]));_0x740ff[_0xdaf0('0x2a')]=_0x740ff[_0xdaf0('0x2a')][_0xdaf0('0x2c')]?_0x740ff[_0xdaf0('0x2a')]:_0x4e6974[_0xdaf0('0x25')];if(!_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x2d')]('nolimit')){_0x740ff['limit']=qs['limit'](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x15')]);_0x740ff['offset']=qs[_0xdaf0('0x14')](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x14')]);}_0x740ff[_0xdaf0('0x2e')]=qs[_0xdaf0('0x2f')](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x2f')]);_0x740ff[_0xdaf0('0x30')]=qs[_0xdaf0('0x28')](_[_0xdaf0('0x31')](_0x4cd0bf[_0xdaf0('0x26')],_0x4e6974[_0xdaf0('0x28')]),_0x5762cc);if(_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x32')]){_0x740ff[_0xdaf0('0x30')]=_[_0xdaf0('0x33')](_0x740ff[_0xdaf0('0x30')],{'$or':_['map'](_0x5762cc,function(_0xe61d26){if(_0xe61d26[_0xdaf0('0x23')]!==_0xdaf0('0x34')){var _0x2b8272={};_0x2b8272[_0xe61d26[_0xdaf0('0x1e')]]={'$like':'%'+_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x32')]+'%'};return _0x2b8272;}})});}_0x740ff=_[_0xdaf0('0x33')]({},_0x740ff,_0x4cd0bf['options']);var _0x514d1c={'where':_0x740ff[_0xdaf0('0x30')]};return db[_0xdaf0('0x21')][_0xdaf0('0x35')](_0x514d1c)['then'](function(_0x4699c1){_0x39a5b2['count']=_0x4699c1;if(_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x36')]){_0x740ff[_0xdaf0('0x37')]=[{'all':!![]}];}return db[_0xdaf0('0x21')][_0xdaf0('0x38')](_0x740ff);})[_0xdaf0('0x1a')](function(_0x357e4b){_0x39a5b2['rows']=_0x357e4b;return _0x39a5b2;})[_0xdaf0('0x1a')](respondWithFilteredResult(_0x413d27,_0x740ff))[_0xdaf0('0x39')](handleError(_0x413d27,null));};exports['show']=function(_0x2a9209,_0x5b5f3b){var _0x480b2b={'raw':!![],'where':{'id':_0x2a9209['params']['id']}},_0x60218a={};_0x60218a[_0xdaf0('0x25')]=_['keys'](db[_0xdaf0('0x21')][_0xdaf0('0x3a')]);_0x60218a[_0xdaf0('0x26')]=_['keys'](_0x2a9209[_0xdaf0('0x26')]);_0x60218a[_0xdaf0('0x28')]=_[_0xdaf0('0x29')](_0x60218a['model'],_0x60218a[_0xdaf0('0x26')]);_0x480b2b[_0xdaf0('0x2a')]=_[_0xdaf0('0x29')](_0x60218a[_0xdaf0('0x25')],qs[_0xdaf0('0x2b')](_0x2a9209[_0xdaf0('0x26')][_0xdaf0('0x2b')]));_0x480b2b[_0xdaf0('0x2a')]=_0x480b2b['attributes'][_0xdaf0('0x2c')]?_0x480b2b[_0xdaf0('0x2a')]:_0x60218a['model'];if(_0x2a9209[_0xdaf0('0x26')][_0xdaf0('0x36')]){_0x480b2b[_0xdaf0('0x37')]=[{'all':!![]}];}_0x480b2b=_[_0xdaf0('0x33')]({},_0x480b2b,_0x2a9209[_0xdaf0('0x3b')]);return db[_0xdaf0('0x21')][_0xdaf0('0x3c')](_0x480b2b)['then'](handleEntityNotFound(_0x5b5f3b,null))[_0xdaf0('0x1a')](respondWithResult(_0x5b5f3b,null))[_0xdaf0('0x39')](handleError(_0x5b5f3b,null));};exports['create']=function(_0x48c69b,_0x59c70a){return db[_0xdaf0('0x21')][_0xdaf0('0x3d')](_0x48c69b[_0xdaf0('0x3e')],{})[_0xdaf0('0x1a')](respondWithResult(_0x59c70a,0xc9))[_0xdaf0('0x39')](handleError(_0x59c70a,null));};exports[_0xdaf0('0x19')]=function(_0x859066,_0x425e2f){if(_0x859066[_0xdaf0('0x3e')]['id']){delete _0x859066[_0xdaf0('0x3e')]['id'];}return db[_0xdaf0('0x21')]['find']({'where':{'id':_0x859066[_0xdaf0('0x3f')]['id']}})[_0xdaf0('0x1a')](handleEntityNotFound(_0x425e2f,null))[_0xdaf0('0x1a')](saveUpdates(_0x859066['body'],null))[_0xdaf0('0x1a')](respondWithResult(_0x425e2f,null))[_0xdaf0('0x39')](handleError(_0x425e2f,null));};exports['destroy']=function(_0x432cf7,_0x28e19f){return db['SquareReport'][_0xdaf0('0x3c')]({'where':{'id':_0x432cf7[_0xdaf0('0x3f')]['id']}})[_0xdaf0('0x1a')](handleEntityNotFound(_0x28e19f,null))[_0xdaf0('0x1a')](removeEntity(_0x28e19f,null))[_0xdaf0('0x39')](handleError(_0x28e19f,null));};exports['describe']=function(_0x2364e8,_0x34ae87){return db[_0xdaf0('0x21')][_0xdaf0('0x40')]()[_0xdaf0('0x1a')](respondWithResult(_0x34ae87,null))[_0xdaf0('0x39')](handleError(_0x34ae87,null));}; \ No newline at end of file +var _0x99a0=['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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','update','then','error','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','show','params','find','catch','create','body','describe','html-pdf','eml-format','moment'];(function(_0x2678c7,_0x18af03){var _0x4b8d5c=function(_0x20d354){while(--_0x20d354){_0x2678c7['push'](_0x2678c7['shift']());}};_0x4b8d5c(++_0x18af03);}(_0x99a0,0x121));var _0x099a=function(_0x4398cc,_0x272371){_0x4398cc=_0x4398cc-0x0;var _0x56cfdb=_0x99a0[_0x4398cc];return _0x56cfdb;};'use strict';var pdf=require(_0x099a('0x0'));var emlformat=require(_0x099a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x099a('0x2'));var BPromise=require(_0x099a('0x3'));var Mustache=require('mustache');var util=require(_0x099a('0x4'));var path=require(_0x099a('0x5'));var sox=require(_0x099a('0x6'));var csv=require(_0x099a('0x7'));var ejs=require(_0x099a('0x8'));var fs=require('fs');var _=require(_0x099a('0x9'));var squel=require('squel');var crypto=require(_0x099a('0xa'));var jsforce=require(_0x099a('0xb'));var deskjs=require(_0x099a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x099a('0xd'));var Papa=require(_0x099a('0xe'));var Redis=require(_0x099a('0xf'));var authService=require(_0x099a('0x10'));var qs=require(_0x099a('0x11'));var as=require(_0x099a('0x12'));var hardwareService=require(_0x099a('0x13'));var logger=require(_0x099a('0x14'))(_0x099a('0x15'));var utils=require(_0x099a('0x16'));var config=require(_0x099a('0x17'));var licenseUtil=require(_0x099a('0x18'));var db=require(_0x099a('0x19'))['db'];function respondWithStatusCode(_0x1e9dc1,_0x2e8afc){_0x2e8afc=_0x2e8afc||0xcc;return function(_0x4bd3ee){if(_0x4bd3ee){return _0x1e9dc1[_0x099a('0x1a')](_0x2e8afc);}return _0x1e9dc1['status'](_0x2e8afc)[_0x099a('0x1b')]();};}function respondWithResult(_0x4f2dbe,_0x249392){_0x249392=_0x249392||0xc8;return function(_0x3a134e){if(_0x3a134e){return _0x4f2dbe[_0x099a('0x1c')](_0x249392)[_0x099a('0x1d')](_0x3a134e);}};}function respondWithFilteredResult(_0x23a5fd,_0x3b4bdf){return function(_0x5086d8){if(_0x5086d8){var _0x443eea=_0x5086d8['count'],_0x88c471=_0x3b4bdf[_0x099a('0x1e')],_0x452a34=_0x3b4bdf['offset']+_0x3b4bdf[_0x099a('0x1f')],_0x371af7;if(_0x452a34>=_0x443eea){_0x452a34=_0x443eea;_0x371af7=0xc8;}else{_0x371af7=0xce;}_0x23a5fd[_0x099a('0x1c')](_0x371af7);return _0x23a5fd[_0x099a('0x20')]('Content-Range',_0x88c471+'-'+_0x452a34+'/'+_0x443eea)[_0x099a('0x1d')](_0x5086d8);}return null;};}function patchUpdates(_0x243b0b){return function(_0x1c5314){try{jsonpatch[_0x099a('0x21')](_0x1c5314,_0x243b0b,!![]);}catch(_0x364fad){return BPromise['reject'](_0x364fad);}return _0x1c5314['save']();};}function saveUpdates(_0x2ec23b,_0x851d2){return function(_0x471f9f){if(_0x471f9f){return _0x471f9f[_0x099a('0x22')](_0x2ec23b)[_0x099a('0x23')](function(_0x3c64ce){return _0x3c64ce;});}return null;};}function removeEntity(_0x2b2b9b,_0x23558b){return function(_0x545830){if(_0x545830){return _0x545830['destroy']()[_0x099a('0x23')](function(){_0x2b2b9b[_0x099a('0x1c')](0xcc)[_0x099a('0x1b')]();});}};}function handleEntityNotFound(_0x7cd361,_0x1d1e5f){return function(_0x2527f9){if(!_0x2527f9){_0x7cd361[_0x099a('0x1a')](0x194);}return _0x2527f9;};}function handleError(_0x1593fb,_0x2c4745){_0x2c4745=_0x2c4745||0x1f4;return function(_0x42ee18){logger[_0x099a('0x24')](_0x42ee18['stack']);if(_0x42ee18[_0x099a('0x25')]){delete _0x42ee18['name'];}_0x1593fb[_0x099a('0x1c')](_0x2c4745)[_0x099a('0x26')](_0x42ee18);};}exports[_0x099a('0x27')]=function(_0x4cbc26,_0x320d29){var _0x1101aa={},_0x1a51ec={},_0x485d12={'count':0x0,'rows':[]};var _0x4b2bba=_['map'](db[_0x099a('0x28')][_0x099a('0x29')],function(_0x4a1663){return{'name':_0x4a1663[_0x099a('0x2a')],'type':_0x4a1663[_0x099a('0x2b')][_0x099a('0x2c')]};});_0x1a51ec[_0x099a('0x2d')]=_[_0x099a('0x2e')](_0x4b2bba,_0x099a('0x25'));_0x1a51ec['query']=_[_0x099a('0x2f')](_0x4cbc26[_0x099a('0x30')]);_0x1a51ec[_0x099a('0x31')]=_[_0x099a('0x32')](_0x1a51ec[_0x099a('0x2d')],_0x1a51ec[_0x099a('0x30')]);_0x1101aa[_0x099a('0x33')]=_[_0x099a('0x32')](_0x1a51ec['model'],qs[_0x099a('0x34')](_0x4cbc26[_0x099a('0x30')][_0x099a('0x34')]));_0x1101aa[_0x099a('0x33')]=_0x1101aa[_0x099a('0x33')][_0x099a('0x35')]?_0x1101aa['attributes']:_0x1a51ec[_0x099a('0x2d')];if(!_0x4cbc26['query'][_0x099a('0x36')](_0x099a('0x37'))){_0x1101aa['limit']=qs[_0x099a('0x1f')](_0x4cbc26[_0x099a('0x30')][_0x099a('0x1f')]);_0x1101aa[_0x099a('0x1e')]=qs[_0x099a('0x1e')](_0x4cbc26['query'][_0x099a('0x1e')]);}_0x1101aa[_0x099a('0x38')]=qs['sort'](_0x4cbc26[_0x099a('0x30')][_0x099a('0x39')]);_0x1101aa[_0x099a('0x3a')]=qs['filters'](_[_0x099a('0x3b')](_0x4cbc26[_0x099a('0x30')],_0x1a51ec[_0x099a('0x31')]),_0x4b2bba);if(_0x4cbc26[_0x099a('0x30')][_0x099a('0x3c')]){_0x1101aa[_0x099a('0x3a')]=_['merge'](_0x1101aa[_0x099a('0x3a')],{'$or':_['map'](_0x4b2bba,function(_0x2dd733){if(_0x2dd733[_0x099a('0x2b')]!=='VIRTUAL'){var _0x22c66d={};_0x22c66d[_0x2dd733[_0x099a('0x25')]]={'$like':'%'+_0x4cbc26[_0x099a('0x30')][_0x099a('0x3c')]+'%'};return _0x22c66d;}})});}_0x1101aa=_[_0x099a('0x3d')]({},_0x1101aa,_0x4cbc26[_0x099a('0x3e')]);var _0x1386cb={'where':_0x1101aa[_0x099a('0x3a')]};return db[_0x099a('0x28')]['count'](_0x1386cb)[_0x099a('0x23')](function(_0x402a06){_0x485d12[_0x099a('0x3f')]=_0x402a06;if(_0x4cbc26[_0x099a('0x30')][_0x099a('0x40')]){_0x1101aa[_0x099a('0x41')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x1101aa);})[_0x099a('0x23')](function(_0x8e5dcc){_0x485d12['rows']=_0x8e5dcc;return _0x485d12;})[_0x099a('0x23')](respondWithFilteredResult(_0x320d29,_0x1101aa))['catch'](handleError(_0x320d29,null));};exports[_0x099a('0x42')]=function(_0x119861,_0x13070f){var _0x446a51={'raw':!![],'where':{'id':_0x119861[_0x099a('0x43')]['id']}},_0x106fe0={};_0x106fe0[_0x099a('0x2d')]=_[_0x099a('0x2f')](db['SquareReport'][_0x099a('0x29')]);_0x106fe0['query']=_[_0x099a('0x2f')](_0x119861['query']);_0x106fe0[_0x099a('0x31')]=_[_0x099a('0x32')](_0x106fe0[_0x099a('0x2d')],_0x106fe0[_0x099a('0x30')]);_0x446a51['attributes']=_[_0x099a('0x32')](_0x106fe0[_0x099a('0x2d')],qs['fields'](_0x119861[_0x099a('0x30')]['fields']));_0x446a51[_0x099a('0x33')]=_0x446a51[_0x099a('0x33')][_0x099a('0x35')]?_0x446a51[_0x099a('0x33')]:_0x106fe0[_0x099a('0x2d')];if(_0x119861[_0x099a('0x30')][_0x099a('0x40')]){_0x446a51[_0x099a('0x41')]=[{'all':!![]}];}_0x446a51=_['merge']({},_0x446a51,_0x119861[_0x099a('0x3e')]);return db['SquareReport'][_0x099a('0x44')](_0x446a51)[_0x099a('0x23')](handleEntityNotFound(_0x13070f,null))[_0x099a('0x23')](respondWithResult(_0x13070f,null))[_0x099a('0x45')](handleError(_0x13070f,null));};exports[_0x099a('0x46')]=function(_0x473b56,_0x56c3f2){return db['SquareReport'][_0x099a('0x46')](_0x473b56[_0x099a('0x47')],{})['then'](respondWithResult(_0x56c3f2,0xc9))[_0x099a('0x45')](handleError(_0x56c3f2,null));};exports[_0x099a('0x22')]=function(_0x2b5aae,_0x47dafb){if(_0x2b5aae[_0x099a('0x47')]['id']){delete _0x2b5aae[_0x099a('0x47')]['id'];}return db[_0x099a('0x28')][_0x099a('0x44')]({'where':{'id':_0x2b5aae['params']['id']}})[_0x099a('0x23')](handleEntityNotFound(_0x47dafb,null))['then'](saveUpdates(_0x2b5aae[_0x099a('0x47')],null))[_0x099a('0x23')](respondWithResult(_0x47dafb,null))['catch'](handleError(_0x47dafb,null));};exports['destroy']=function(_0x155a52,_0x248e03){return db[_0x099a('0x28')]['find']({'where':{'id':_0x155a52[_0x099a('0x43')]['id']}})[_0x099a('0x23')](handleEntityNotFound(_0x248e03,null))[_0x099a('0x23')](removeEntity(_0x248e03,null))['catch'](handleError(_0x248e03,null));};exports[_0x099a('0x48')]=function(_0x4fe0ef,_0x556168){return db[_0x099a('0x28')]['describe']()['then'](respondWithResult(_0x556168,null))[_0x099a('0x45')](handleError(_0x556168,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 953b0ee..922f461 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 _0x741d=['leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','report_square','uid_pname','uniqueid','project_name'];(function(_0x9972d9,_0x2afda8){var _0x1ee4cb=function(_0x5ceded){while(--_0x5ceded){_0x9972d9['push'](_0x9972d9['shift']());}};_0x1ee4cb(++_0x2afda8);}(_0x741d,0x71));var _0xd741=function(_0x507d71,_0x260c61){_0x507d71=_0x507d71-0x0;var _0xa8f225=_0x741d[_0x507d71];return _0xa8f225;};'use strict';var _=require(_0xd741('0x0'));var util=require(_0xd741('0x1'));var logger=require(_0xd741('0x2'))(_0xd741('0x3'));var moment=require('moment');var BPromise=require(_0xd741('0x4'));var rp=require(_0xd741('0x5'));var fs=require('fs');var path=require(_0xd741('0x6'));var rimraf=require(_0xd741('0x7'));var config=require('../../config/environment');var attributes=require(_0xd741('0x8'));module['exports']=function(_0x53298f,_0x3fda09){return _0x53298f['define']('SquareReport',attributes,{'tableName':_0xd741('0x9'),'paranoid':![],'indexes':[{'name':_0xd741('0xa'),'fields':[_0xd741('0xb'),_0xd741('0xc')]},{'name':'leaveAt','fields':[_0xd741('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd13=['uniqueid','project_name','leaveAt','lodash','util','moment','path','rimraf','../../config/environment','exports','define','SquareReport','report_square'];(function(_0x42eb4f,_0x3e1a17){var _0xb03f52=function(_0x270068){while(--_0x270068){_0x42eb4f['push'](_0x42eb4f['shift']());}};_0xb03f52(++_0x3e1a17);}(_0xdd13,0x107));var _0x3dd1=function(_0x313e88,_0x47c9e6){_0x313e88=_0x313e88-0x0;var _0x50f0ee=_0xdd13[_0x313e88];return _0x50f0ee;};'use strict';var _=require(_0x3dd1('0x0'));var util=require(_0x3dd1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3dd1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dd1('0x3'));var rimraf=require(_0x3dd1('0x4'));var config=require(_0x3dd1('0x5'));var attributes=require('./squareReport.attributes');module[_0x3dd1('0x6')]=function(_0xc3c72c,_0x4ac24c){return _0xc3c72c[_0x3dd1('0x7')](_0x3dd1('0x8'),attributes,{'tableName':_0x3dd1('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x3dd1('0xa'),_0x3dd1('0xb')]},{'name':_0x3dd1('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 51bcab7..5d98580 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','debug','stringify','update','raw','where','UpdateSquareReport','lodash','util','randomstring'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0xe14b,0x93));var _0xbe14=function(_0x1719e8,_0x16c4bd){_0x1719e8=_0x1719e8-0x0;var _0x2c6523=_0xe14b[_0x1719e8];return _0x2c6523;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')](_0x29ab73[_0xbe14('0x16')],{'raw':_0x29ab73[_0xbe14('0x17')]?_0x29ab73[_0xbe14('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbe14('0x9')](function(_0x4a1bbd){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger[_0xbe14('0x18')]('CreateSquareReport',_0x29ab73,JSON[_0xbe14('0x19')](_0x4a1bbd));_0x5ea1f8(_0x4a1bbd);})['catch'](function(_0x3c1c85){logger['error'](_0xbe14('0x13'),_0x3c1c85['message'],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c1c85[_0xbe14('0x10')]));});});};exports['UpdateSquareReport']=function(_0x2da350){var _0x4d4190=this;return new Promise(function(_0x4587a8,_0x4851f8){return db[_0xbe14('0x14')][_0xbe14('0x1a')](_0x2da350[_0xbe14('0x16')],{'raw':_0x2da350[_0xbe14('0x17')]?_0x2da350[_0xbe14('0x17')][_0xbe14('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da350['options']?_0x2da350[_0xbe14('0x17')][_0xbe14('0x1c')]||null:null,'attributes':_0x2da350[_0xbe14('0x17')]?_0x2da350[_0xbe14('0x17')]['attributes']||null:null,'limit':_0x2da350[_0xbe14('0x17')]?_0x2da350[_0xbe14('0x17')]['limit']||null:null})[_0xbe14('0x9')](function(_0x3b3e84){logger[_0xbe14('0xa')](_0xbe14('0x1d'),_0x2da350);logger[_0xbe14('0x18')](_0xbe14('0x1d'),_0x2da350,JSON[_0xbe14('0x19')](_0x3b3e84));_0x4587a8(_0x3b3e84);})[_0xbe14('0x12')](function(_0x4168c8){logger[_0xbe14('0xe')](_0xbe14('0x1d'),_0x4168c8[_0xbe14('0x10')],_0x2da350);_0x4851f8(_0x4d4190[_0xbe14('0xe')](0x1f4,_0x4168c8[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x16a1f8,_0xd57bbd){var _0x207a17=function(_0x1a8ab1){while(--_0x1a8ab1){_0x16a1f8['push'](_0x16a1f8['shift']());}};_0x207a17(++_0xd57bbd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x5fc3[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareReport,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareReport'][_0x35fc('0x17')](_0x553677[_0x35fc('0x18')],{'raw':_0x553677[_0x35fc('0x19')]?_0x553677['options'][_0x35fc('0x1a')]===undefined?!![]:![]:!![]})[_0x35fc('0xb')](function(_0x3229d1){logger[_0x35fc('0xc')](_0x35fc('0x16'),_0x553677);logger[_0x35fc('0xe')](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x3229d1));_0x363e47(_0x3229d1);})[_0x35fc('0x15')](function(_0x427eae){logger['error'](_0x35fc('0x16'),_0x427eae[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x427eae[_0x35fc('0x12')]));});});};exports[_0x35fc('0x1b')]=function(_0x55e9e7){var _0x33f5e8=this;return new Promise(function(_0x4c587a,_0x561bf8){return db[_0x35fc('0x1c')][_0x35fc('0x1d')](_0x55e9e7[_0x35fc('0x18')],{'raw':_0x55e9e7['options']?_0x55e9e7[_0x35fc('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e9e7[_0x35fc('0x19')]?_0x55e9e7[_0x35fc('0x19')]['where']||null:null,'attributes':_0x55e9e7['options']?_0x55e9e7[_0x35fc('0x19')]['attributes']||null:null,'limit':_0x55e9e7[_0x35fc('0x19')]?_0x55e9e7[_0x35fc('0x19')]['limit']||null:null})[_0x35fc('0xb')](function(_0x645eac){logger[_0x35fc('0xc')](_0x35fc('0x1b'),_0x55e9e7);logger[_0x35fc('0xe')](_0x35fc('0x1b'),_0x55e9e7,JSON[_0x35fc('0xf')](_0x645eac));_0x4c587a(_0x645eac);})[_0x35fc('0x15')](function(_0x54aedc){logger[_0x35fc('0x10')](_0x35fc('0x1b'),_0x54aedc[_0x35fc('0x12')],_0x55e9e7);_0x561bf8(_0x33f5e8['error'](0x1f4,_0x54aedc[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 12813cd..dc4692e 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(_0x3df552,_0x2988c1){var _0xed396a=function(_0x58fe8c){while(--_0x58fe8c){_0x3df552['push'](_0x3df552['shift']());}};_0xed396a(++_0x2988c1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ebaf,_0x2e737f){_0x20ebaf=_0x20ebaf-0x0;var _0x3fa8d7=_0x5f2f[_0x20ebaf];return _0x3fa8d7;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x814b,0x1a2));var _0xb814=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x814b[_0x2300f2];return _0x6bd508;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7f6490f..03814a7 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 _0x06a8=['TEXT','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x06a8,0x111));var _0x806a=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x06a8[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x806a('0x0'));module[_0x806a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x806a('0x2')]},'application':{'type':Sequelize[_0x806a('0x2')]},'data':{'type':Sequelize[_0x806a('0x3')]},'project_name':{'type':Sequelize[_0x806a('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbe91=['STRING','TEXT','exports'];(function(_0x2e17b4,_0x16bef3){var _0x47829b=function(_0x252880){while(--_0x252880){_0x2e17b4['push'](_0x2e17b4['shift']());}};_0x47829b(++_0x16bef3);}(_0xbe91,0x107));var _0x1be9=function(_0x1c33dc,_0x177c7e){_0x1c33dc=_0x1c33dc-0x0;var _0x405580=_0xbe91[_0x1c33dc];return _0x405580;};'use strict';var Sequelize=require('sequelize');module[_0x1be9('0x0')]={'uniqueid':{'type':Sequelize[_0x1be9('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x1be9('0x2')]},'project_name':{'type':Sequelize[_0x1be9('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 29348de..cb7e9fe 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 _0x02ce=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','status','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport'];(function(_0x20cb79,_0x11e512){var _0x5e3f60=function(_0x1035b1){while(--_0x1035b1){_0x20cb79['push'](_0x20cb79['shift']());}};_0x5e3f60(++_0x11e512);}(_0x02ce,0x1ac));var _0xe02c=function(_0x33e6c6,_0x278c94){_0x33e6c6=_0x33e6c6-0x0;var _0x540e66=_0x02ce[_0x33e6c6];return _0x540e66;};'use strict';var pdf=require(_0xe02c('0x0'));var emlformat=require(_0xe02c('0x1'));var rimraf=require(_0xe02c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe02c('0x3'));var rp=require('request-promise');var moment=require(_0xe02c('0x4'));var BPromise=require(_0xe02c('0x5'));var Mustache=require(_0xe02c('0x6'));var util=require(_0xe02c('0x7'));var path=require(_0xe02c('0x8'));var sox=require(_0xe02c('0x9'));var csv=require(_0xe02c('0xa'));var ejs=require(_0xe02c('0xb'));var fs=require('fs');var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0xa'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=_0x366893[_0xe02c('0x1e')],_0x10a2a6=_0x256311[_0xe02c('0x1f')],_0x226a80=_0x256311['offset']+_0x256311['limit'],_0x51676c;if(_0x226a80>=_0x59f2f6){_0x226a80=_0x59f2f6;_0x51676c=0xc8;}else{_0x51676c=0xce;}_0x4e9c6d[_0xe02c('0x20')](_0x51676c);return _0x4e9c6d['set'](_0xe02c('0x21'),_0x10a2a6+'-'+_0x226a80+'/'+_0x59f2f6)[_0xe02c('0x1d')](_0x366893);}return null;};}function patchUpdates(_0x706946){return function(_0x36fed0){try{jsonpatch[_0xe02c('0x22')](_0x36fed0,_0x706946,!![]);}catch(_0x54c5b0){return BPromise[_0xe02c('0x23')](_0x54c5b0);}return _0x36fed0['save']();};}function saveUpdates(_0x4ea9b5,_0x393621){return function(_0x4514ac){if(_0x4514ac){return _0x4514ac['update'](_0x4ea9b5)[_0xe02c('0x24')](function(_0x2d652e){return _0x2d652e;});}return null;};}function removeEntity(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x25')]()[_0xe02c('0x24')](function(){_0x4ce5ee[_0xe02c('0x20')](0xcc)[_0xe02c('0x26')]();});}};}function handleEntityNotFound(_0x3e80e3,_0xf41d4c){return function(_0xeae877){if(!_0xeae877){_0x3e80e3[_0xe02c('0x1c')](0x194);}return _0xeae877;};}function handleError(_0x60b65e,_0x47bbef){_0x47bbef=_0x47bbef||0x1f4;return function(_0xefd882){logger[_0xe02c('0x27')](_0xefd882[_0xe02c('0x28')]);if(_0xefd882[_0xe02c('0x29')]){delete _0xefd882[_0xe02c('0x29')];}_0x60b65e[_0xe02c('0x20')](_0x47bbef)[_0xe02c('0x2a')](_0xefd882);};}exports[_0xe02c('0x2b')]=function(_0x55ef2a,_0x55e475){var _0x3790eb={},_0x148e2b={},_0x481e02={'count':0x0,'rows':[]};var _0x18b572=_[_0xe02c('0x2c')](db[_0xe02c('0x2d')][_0xe02c('0x2e')],function(_0x1e7eab){return{'name':_0x1e7eab[_0xe02c('0x2f')],'type':_0x1e7eab[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x148e2b[_0xe02c('0x32')]=_[_0xe02c('0x2c')](_0x18b572,_0xe02c('0x29'));_0x148e2b['query']=_[_0xe02c('0x33')](_0x55ef2a[_0xe02c('0x34')]);_0x148e2b[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x148e2b[_0xe02c('0x32')],_0x148e2b[_0xe02c('0x34')]);_0x3790eb['attributes']=_[_0xe02c('0x36')](_0x148e2b[_0xe02c('0x32')],qs['fields'](_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x37')]));_0x3790eb[_0xe02c('0x38')]=_0x3790eb[_0xe02c('0x38')][_0xe02c('0x39')]?_0x3790eb['attributes']:_0x148e2b['model'];if(!_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x3a')]('nolimit')){_0x3790eb[_0xe02c('0x3b')]=qs['limit'](_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x3b')]);_0x3790eb[_0xe02c('0x1f')]=qs[_0xe02c('0x1f')](_0x55ef2a[_0xe02c('0x34')]['offset']);}_0x3790eb[_0xe02c('0x3c')]=qs['sort'](_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x3d')]);_0x3790eb[_0xe02c('0x3e')]=qs[_0xe02c('0x35')](_[_0xe02c('0x3f')](_0x55ef2a[_0xe02c('0x34')],_0x148e2b['filters']),_0x18b572);if(_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x40')]){_0x3790eb['where']=_[_0xe02c('0x41')](_0x3790eb[_0xe02c('0x3e')],{'$or':_['map'](_0x18b572,function(_0x396a06){if(_0x396a06['type']!==_0xe02c('0x42')){var _0x12b3e5={};_0x12b3e5[_0x396a06['name']]={'$like':'%'+_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x40')]+'%'};return _0x12b3e5;}})});}_0x3790eb=_[_0xe02c('0x41')]({},_0x3790eb,_0x55ef2a[_0xe02c('0x43')]);var _0x3c4a65={'where':_0x3790eb[_0xe02c('0x3e')]};return db['SquareDetailsReport'][_0xe02c('0x1e')](_0x3c4a65)['then'](function(_0x5ae8cd){_0x481e02[_0xe02c('0x1e')]=_0x5ae8cd;if(_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x44')]){_0x3790eb[_0xe02c('0x45')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xe02c('0x46')](_0x3790eb);})[_0xe02c('0x24')](function(_0x163573){_0x481e02['rows']=_0x163573;return _0x481e02;})['then'](respondWithFilteredResult(_0x55e475,_0x3790eb))[_0xe02c('0x47')](handleError(_0x55e475,null));};exports[_0xe02c('0x48')]=function(_0x381db9,_0x2313d2){var _0x1b0876={'raw':!![],'where':{'id':_0x381db9[_0xe02c('0x49')]['id']}},_0x4543a8={};_0x4543a8[_0xe02c('0x32')]=_[_0xe02c('0x33')](db['SquareDetailsReport'][_0xe02c('0x2e')]);_0x4543a8['query']=_['keys'](_0x381db9[_0xe02c('0x34')]);_0x4543a8[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x4543a8[_0xe02c('0x32')],_0x4543a8[_0xe02c('0x34')]);_0x1b0876[_0xe02c('0x38')]=_[_0xe02c('0x36')](_0x4543a8[_0xe02c('0x32')],qs['fields'](_0x381db9['query'][_0xe02c('0x37')]));_0x1b0876[_0xe02c('0x38')]=_0x1b0876[_0xe02c('0x38')]['length']?_0x1b0876[_0xe02c('0x38')]:_0x4543a8[_0xe02c('0x32')];if(_0x381db9[_0xe02c('0x34')][_0xe02c('0x44')]){_0x1b0876[_0xe02c('0x45')]=[{'all':!![]}];}_0x1b0876=_[_0xe02c('0x41')]({},_0x1b0876,_0x381db9[_0xe02c('0x43')]);return db[_0xe02c('0x2d')][_0xe02c('0x4a')](_0x1b0876)[_0xe02c('0x24')](handleEntityNotFound(_0x2313d2,null))['then'](respondWithResult(_0x2313d2,null))[_0xe02c('0x47')](handleError(_0x2313d2,null));};exports[_0xe02c('0x4b')]=function(_0x292707,_0x1a39ea){return db[_0xe02c('0x2d')][_0xe02c('0x4b')](_0x292707[_0xe02c('0x4c')],{})[_0xe02c('0x24')](respondWithResult(_0x1a39ea,0xc9))[_0xe02c('0x47')](handleError(_0x1a39ea,null));};exports[_0xe02c('0x4d')]=function(_0xfed475,_0x693565){if(_0xfed475[_0xe02c('0x4c')]['id']){delete _0xfed475['body']['id'];}return db[_0xe02c('0x2d')]['find']({'where':{'id':_0xfed475[_0xe02c('0x49')]['id']}})[_0xe02c('0x24')](handleEntityNotFound(_0x693565,null))[_0xe02c('0x24')](saveUpdates(_0xfed475[_0xe02c('0x4c')],null))[_0xe02c('0x24')](respondWithResult(_0x693565,null))[_0xe02c('0x47')](handleError(_0x693565,null));};exports[_0xe02c('0x25')]=function(_0xc2b5dd,_0xc6ea7b){return db[_0xe02c('0x2d')]['find']({'where':{'id':_0xc2b5dd[_0xe02c('0x49')]['id']}})[_0xe02c('0x24')](handleEntityNotFound(_0xc6ea7b,null))[_0xe02c('0x24')](removeEntity(_0xc6ea7b,null))['catch'](handleError(_0xc6ea7b,null));};exports[_0xe02c('0x4e')]=function(_0x5ab97d,_0x21a126){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x21a126,null))['catch'](handleError(_0x21a126,null));}; \ No newline at end of file +var _0x2884=['path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','status','set','apply','reject','then','destroy','error','name','send','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x24eb6a,_0x5599b5){var _0x2b5fca=function(_0x2c2153){while(--_0x2c2153){_0x24eb6a['push'](_0x24eb6a['shift']());}};_0x2b5fca(++_0x5599b5);}(_0x2884,0x1eb));var _0x4288=function(_0x173f79,_0x3b2224){_0x173f79=_0x173f79-0x0;var _0x59ce8c=_0x2884[_0x173f79];return _0x59ce8c;};'use strict';var pdf=require(_0x4288('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4288('0x1'));var zipdir=require(_0x4288('0x2'));var jsonpatch=require(_0x4288('0x3'));var rp=require('request-promise');var moment=require(_0x4288('0x4'));var BPromise=require(_0x4288('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4288('0x6'));var sox=require(_0x4288('0x7'));var csv=require(_0x4288('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4288('0x9'));var crypto=require('crypto');var jsforce=require(_0x4288('0xa'));var deskjs=require(_0x4288('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4288('0xc'));var Papa=require(_0x4288('0xd'));var Redis=require(_0x4288('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4288('0xf'));var hardwareService=require(_0x4288('0x10'));var logger=require(_0x4288('0x11'))(_0x4288('0x12'));var utils=require(_0x4288('0x13'));var config=require(_0x4288('0x14'));var licenseUtil=require(_0x4288('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10eb55,_0x1c4bd0){_0x1c4bd0=_0x1c4bd0||0xcc;return function(_0xfa6eca){if(_0xfa6eca){return _0x10eb55[_0x4288('0x16')](_0x1c4bd0);}return _0x10eb55['status'](_0x1c4bd0)[_0x4288('0x17')]();};}function respondWithResult(_0x102458,_0x5e4432){_0x5e4432=_0x5e4432||0xc8;return function(_0x1782d2){if(_0x1782d2){return _0x102458['status'](_0x5e4432)[_0x4288('0x18')](_0x1782d2);}};}function respondWithFilteredResult(_0x5c43e4,_0x35d792){return function(_0x1c3a7f){if(_0x1c3a7f){var _0x183c70=_0x1c3a7f[_0x4288('0x19')],_0x17afda=_0x35d792[_0x4288('0x1a')],_0xe24ccb=_0x35d792[_0x4288('0x1a')]+_0x35d792['limit'],_0x1db33b;if(_0xe24ccb>=_0x183c70){_0xe24ccb=_0x183c70;_0x1db33b=0xc8;}else{_0x1db33b=0xce;}_0x5c43e4[_0x4288('0x1b')](_0x1db33b);return _0x5c43e4[_0x4288('0x1c')]('Content-Range',_0x17afda+'-'+_0xe24ccb+'/'+_0x183c70)['json'](_0x1c3a7f);}return null;};}function patchUpdates(_0x50da09){return function(_0x417d89){try{jsonpatch[_0x4288('0x1d')](_0x417d89,_0x50da09,!![]);}catch(_0x5e891c){return BPromise[_0x4288('0x1e')](_0x5e891c);}return _0x417d89['save']();};}function saveUpdates(_0x865365,_0x2ebdf4){return function(_0xcedf50){if(_0xcedf50){return _0xcedf50['update'](_0x865365)[_0x4288('0x1f')](function(_0x3547c1){return _0x3547c1;});}return null;};}function removeEntity(_0x349c92,_0x4b9cda){return function(_0x4fc547){if(_0x4fc547){return _0x4fc547[_0x4288('0x20')]()[_0x4288('0x1f')](function(){_0x349c92[_0x4288('0x1b')](0xcc)[_0x4288('0x17')]();});}};}function handleEntityNotFound(_0x5b2041,_0x292e74){return function(_0x500c1e){if(!_0x500c1e){_0x5b2041['sendStatus'](0x194);}return _0x500c1e;};}function handleError(_0x1ff415,_0xa3d2df){_0xa3d2df=_0xa3d2df||0x1f4;return function(_0x576af9){logger[_0x4288('0x21')](_0x576af9['stack']);if(_0x576af9['name']){delete _0x576af9[_0x4288('0x22')];}_0x1ff415[_0x4288('0x1b')](_0xa3d2df)[_0x4288('0x23')](_0x576af9);};}exports['index']=function(_0xcd16d3,_0x1bba92){var _0xec0001={},_0x1c82a7={},_0x29e9ad={'count':0x0,'rows':[]};var _0xf7f6d6=_['map'](db[_0x4288('0x24')][_0x4288('0x25')],function(_0x46a537){return{'name':_0x46a537[_0x4288('0x26')],'type':_0x46a537[_0x4288('0x27')][_0x4288('0x28')]};});_0x1c82a7[_0x4288('0x29')]=_['map'](_0xf7f6d6,_0x4288('0x22'));_0x1c82a7[_0x4288('0x2a')]=_[_0x4288('0x2b')](_0xcd16d3[_0x4288('0x2a')]);_0x1c82a7[_0x4288('0x2c')]=_['intersection'](_0x1c82a7[_0x4288('0x29')],_0x1c82a7[_0x4288('0x2a')]);_0xec0001[_0x4288('0x2d')]=_[_0x4288('0x2e')](_0x1c82a7[_0x4288('0x29')],qs['fields'](_0xcd16d3[_0x4288('0x2a')][_0x4288('0x2f')]));_0xec0001[_0x4288('0x2d')]=_0xec0001[_0x4288('0x2d')]['length']?_0xec0001[_0x4288('0x2d')]:_0x1c82a7[_0x4288('0x29')];if(!_0xcd16d3[_0x4288('0x2a')][_0x4288('0x30')]('nolimit')){_0xec0001[_0x4288('0x31')]=qs[_0x4288('0x31')](_0xcd16d3[_0x4288('0x2a')][_0x4288('0x31')]);_0xec0001[_0x4288('0x1a')]=qs[_0x4288('0x1a')](_0xcd16d3['query'][_0x4288('0x1a')]);}_0xec0001['order']=qs[_0x4288('0x32')](_0xcd16d3['query']['sort']);_0xec0001[_0x4288('0x33')]=qs[_0x4288('0x2c')](_[_0x4288('0x34')](_0xcd16d3[_0x4288('0x2a')],_0x1c82a7[_0x4288('0x2c')]),_0xf7f6d6);if(_0xcd16d3[_0x4288('0x2a')]['filter']){_0xec0001[_0x4288('0x33')]=_[_0x4288('0x35')](_0xec0001[_0x4288('0x33')],{'$or':_[_0x4288('0x36')](_0xf7f6d6,function(_0x260daa){if(_0x260daa[_0x4288('0x27')]!==_0x4288('0x37')){var _0x1dc27b={};_0x1dc27b[_0x260daa[_0x4288('0x22')]]={'$like':'%'+_0xcd16d3[_0x4288('0x2a')][_0x4288('0x38')]+'%'};return _0x1dc27b;}})});}_0xec0001=_[_0x4288('0x35')]({},_0xec0001,_0xcd16d3[_0x4288('0x39')]);var _0x3733a2={'where':_0xec0001[_0x4288('0x33')]};return db[_0x4288('0x24')][_0x4288('0x19')](_0x3733a2)['then'](function(_0x36bd21){_0x29e9ad[_0x4288('0x19')]=_0x36bd21;if(_0xcd16d3[_0x4288('0x2a')]['includeAll']){_0xec0001[_0x4288('0x3a')]=[{'all':!![]}];}return db[_0x4288('0x24')][_0x4288('0x3b')](_0xec0001);})['then'](function(_0x403606){_0x29e9ad[_0x4288('0x3c')]=_0x403606;return _0x29e9ad;})[_0x4288('0x1f')](respondWithFilteredResult(_0x1bba92,_0xec0001))[_0x4288('0x3d')](handleError(_0x1bba92,null));};exports[_0x4288('0x3e')]=function(_0x26d378,_0x4453ee){var _0x236519={'raw':!![],'where':{'id':_0x26d378[_0x4288('0x3f')]['id']}},_0x1f9843={};_0x1f9843[_0x4288('0x29')]=_[_0x4288('0x2b')](db[_0x4288('0x24')][_0x4288('0x25')]);_0x1f9843[_0x4288('0x2a')]=_[_0x4288('0x2b')](_0x26d378[_0x4288('0x2a')]);_0x1f9843[_0x4288('0x2c')]=_['intersection'](_0x1f9843[_0x4288('0x29')],_0x1f9843['query']);_0x236519[_0x4288('0x2d')]=_[_0x4288('0x2e')](_0x1f9843[_0x4288('0x29')],qs[_0x4288('0x2f')](_0x26d378[_0x4288('0x2a')][_0x4288('0x2f')]));_0x236519[_0x4288('0x2d')]=_0x236519[_0x4288('0x2d')][_0x4288('0x40')]?_0x236519[_0x4288('0x2d')]:_0x1f9843[_0x4288('0x29')];if(_0x26d378[_0x4288('0x2a')][_0x4288('0x41')]){_0x236519[_0x4288('0x3a')]=[{'all':!![]}];}_0x236519=_[_0x4288('0x35')]({},_0x236519,_0x26d378[_0x4288('0x39')]);return db[_0x4288('0x24')][_0x4288('0x42')](_0x236519)[_0x4288('0x1f')](handleEntityNotFound(_0x4453ee,null))[_0x4288('0x1f')](respondWithResult(_0x4453ee,null))[_0x4288('0x3d')](handleError(_0x4453ee,null));};exports[_0x4288('0x43')]=function(_0x4adcd7,_0x46d76d){return db[_0x4288('0x24')]['create'](_0x4adcd7[_0x4288('0x44')],{})[_0x4288('0x1f')](respondWithResult(_0x46d76d,0xc9))['catch'](handleError(_0x46d76d,null));};exports[_0x4288('0x45')]=function(_0x2fe94c,_0x3f5489){if(_0x2fe94c[_0x4288('0x44')]['id']){delete _0x2fe94c[_0x4288('0x44')]['id'];}return db[_0x4288('0x24')][_0x4288('0x42')]({'where':{'id':_0x2fe94c['params']['id']}})[_0x4288('0x1f')](handleEntityNotFound(_0x3f5489,null))[_0x4288('0x1f')](saveUpdates(_0x2fe94c[_0x4288('0x44')],null))[_0x4288('0x1f')](respondWithResult(_0x3f5489,null))[_0x4288('0x3d')](handleError(_0x3f5489,null));};exports[_0x4288('0x20')]=function(_0x33748f,_0x472c82){return db[_0x4288('0x24')]['find']({'where':{'id':_0x33748f[_0x4288('0x3f')]['id']}})['then'](handleEntityNotFound(_0x472c82,null))[_0x4288('0x1f')](removeEntity(_0x472c82,null))['catch'](handleError(_0x472c82,null));};exports['describe']=function(_0x2d5614,_0x1f627c){return db[_0x4288('0x24')][_0x4288('0x46')]()[_0x4288('0x1f')](respondWithResult(_0x1f627c,null))[_0x4288('0x3d')](handleError(_0x1f627c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 3e3a673..aaafe5d 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 _0xa1f9=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa1f9,0x16f));var _0x9a1f=function(_0x5daebd,_0x3b96a8){_0x5daebd=_0x5daebd-0x0;var _0x2f5a67=_0xa1f9[_0x5daebd];return _0x2f5a67;};'use strict';var _=require(_0x9a1f('0x0'));var util=require(_0x9a1f('0x1'));var logger=require(_0x9a1f('0x2'))(_0x9a1f('0x3'));var moment=require(_0x9a1f('0x4'));var BPromise=require(_0x9a1f('0x5'));var rp=require(_0x9a1f('0x6'));var fs=require('fs');var path=require(_0x9a1f('0x7'));var rimraf=require(_0x9a1f('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a1f('0x9'));module['exports']=function(_0x1802e4,_0x418db5){return _0x1802e4[_0x9a1f('0xa')](_0x9a1f('0xb'),attributes,{'tableName':_0x9a1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60d2=['api','moment','bluebird','request-promise','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0xd35a2b,_0x52b885){var _0x2ca398=function(_0x3bc5da){while(--_0x3bc5da){_0xd35a2b['push'](_0xd35a2b['shift']());}};_0x2ca398(++_0x52b885);}(_0x60d2,0x6a));var _0x260d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x60d2[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x260d('0x0'));var util=require(_0x260d('0x1'));var logger=require('../../config/logger')(_0x260d('0x2'));var moment=require(_0x260d('0x3'));var BPromise=require(_0x260d('0x4'));var rp=require(_0x260d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x260d('0x6'));var attributes=require(_0x260d('0x7'));module[_0x260d('0x8')]=function(_0x2eb404,_0x30b939){return _0x2eb404[_0x260d('0x9')](_0x260d('0xa'),attributes,{'tableName':_0x260d('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 c0747be..e4bd6a7 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 _0x1ebc=['raw','then','CreateSquareDetailsReport','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create'];(function(_0x4ba1cb,_0x2c19c5){var _0x1ea1d4=function(_0x48f320){while(--_0x48f320){_0x4ba1cb['push'](_0x4ba1cb['shift']());}};_0x1ea1d4(++_0x2c19c5);}(_0x1ebc,0x1cb));var _0xc1eb=function(_0x37e257,_0x165bba){_0x37e257=_0x37e257-0x0;var _0x368a96=_0x1ebc[_0x37e257];return _0x368a96;};'use strict';var _=require(_0xc1eb('0x0'));var util=require(_0xc1eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1eb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1eb('0x3'));var logger=require(_0xc1eb('0x4'))(_0xc1eb('0x5'));var config=require(_0xc1eb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc1eb('0x7')][_0xc1eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd691d0,_0x374461,_0x58dfbd){return new BPromise(function(_0x2dffeb,_0x46ee06){return client[_0xc1eb('0x9')](_0xd691d0,_0x58dfbd)['then'](function(_0x5b66a4){logger['info'](_0xc1eb('0xa'),_0x374461,'request\x20sent');logger['debug'](_0xc1eb('0xb'),_0x374461,_0xc1eb('0xc'),JSON[_0xc1eb('0xd')](_0x5b66a4));if(_0x5b66a4['error']){if(_0x5b66a4[_0xc1eb('0xe')][_0xc1eb('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x374461,_0x5b66a4[_0xc1eb('0xe')]['message']);return _0x46ee06(_0x5b66a4[_0xc1eb('0xe')]['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x374461,_0x5b66a4[_0xc1eb('0xe')][_0xc1eb('0x10')]);return _0x2dffeb(_0x5b66a4['error'][_0xc1eb('0x10')]);}else{logger['info'](_0xc1eb('0xa'),_0x374461,'request\x20sent');_0x2dffeb(_0x5b66a4[_0xc1eb('0x11')][_0xc1eb('0x10')]);}})[_0xc1eb('0x12')](function(_0x515171){logger[_0xc1eb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x374461,_0x515171);_0x46ee06(_0x515171);});});}exports['CreateSquareDetailsReport']=function(_0x968be5){var _0xe5016b=this;return new Promise(function(_0x49da90,_0x3a54b9){return db[_0xc1eb('0x13')][_0xc1eb('0x14')](_0x968be5['body'],{'raw':_0x968be5['options']?_0x968be5['options'][_0xc1eb('0x15')]===undefined?!![]:![]:!![]})[_0xc1eb('0x16')](function(_0x2656b7){logger['info']('CreateSquareDetailsReport',_0x968be5);logger['debug'](_0xc1eb('0x17'),_0x968be5,JSON[_0xc1eb('0xd')](_0x2656b7));_0x49da90(_0x2656b7);})[_0xc1eb('0x12')](function(_0x509104){logger[_0xc1eb('0xe')](_0xc1eb('0x17'),_0x509104[_0xc1eb('0x10')],_0x968be5);_0x3a54b9(_0xe5016b['error'](0x1f4,_0x509104['message']));});});}; \ No newline at end of file +var _0xeea4=['options','then','lodash','randomstring','ioredis','../../config/utils','rpc','request','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport'];(function(_0x1e4a0e,_0x4e65c8){var _0xbc1cd8=function(_0x2084f4){while(--_0x2084f4){_0x1e4a0e['push'](_0x1e4a0e['shift']());}};_0xbc1cd8(++_0x4e65c8);}(_0xeea4,0x1dd));var _0x4eea=function(_0x367bf9,_0x5c8925){_0x367bf9=_0x367bf9-0x0;var _0x1c67e3=_0xeea4[_0x367bf9];return _0x1c67e3;};'use strict';var _=require(_0x4eea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4eea('0x1'));var fs=require('fs');var Redis=require(_0x4eea('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4eea('0x3'));var logger=require('../../config/logger')(_0x4eea('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20a3a7,_0xf6df51,_0xf19712){return new BPromise(function(_0x1c1677,_0x3e442b){return client[_0x4eea('0x5')](_0x20a3a7,_0xf19712)['then'](function(_0x372f76){logger[_0x4eea('0x6')]('SquareDetailsReport,\x20%s,\x20%s',_0xf6df51,_0x4eea('0x7'));logger[_0x4eea('0x8')](_0x4eea('0x9'),_0xf6df51,_0x4eea('0x7'),JSON[_0x4eea('0xa')](_0x372f76));if(_0x372f76[_0x4eea('0xb')]){if(_0x372f76['error'][_0x4eea('0xc')]===0x1f4){logger[_0x4eea('0xb')](_0x4eea('0xd'),_0xf6df51,_0x372f76['error'][_0x4eea('0xe')]);return _0x3e442b(_0x372f76[_0x4eea('0xb')][_0x4eea('0xe')]);}logger[_0x4eea('0xb')](_0x4eea('0xd'),_0xf6df51,_0x372f76[_0x4eea('0xb')]['message']);return _0x1c1677(_0x372f76[_0x4eea('0xb')]['message']);}else{logger[_0x4eea('0x6')](_0x4eea('0xd'),_0xf6df51,_0x4eea('0x7'));_0x1c1677(_0x372f76['result'][_0x4eea('0xe')]);}})[_0x4eea('0xf')](function(_0x34da67){logger[_0x4eea('0xb')](_0x4eea('0xd'),_0xf6df51,_0x34da67);_0x3e442b(_0x34da67);});});}exports[_0x4eea('0x10')]=function(_0x3c4822){var _0x1d6ce4=this;return new Promise(function(_0x3ac465,_0x1758c3){return db['SquareDetailsReport']['create'](_0x3c4822['body'],{'raw':_0x3c4822['options']?_0x3c4822[_0x4eea('0x11')]['raw']===undefined?!![]:![]:!![]})[_0x4eea('0x12')](function(_0x1bdcb4){logger[_0x4eea('0x6')](_0x4eea('0x10'),_0x3c4822);logger[_0x4eea('0x8')](_0x4eea('0x10'),_0x3c4822,JSON[_0x4eea('0xa')](_0x1bdcb4));_0x3ac465(_0x1bdcb4);})['catch'](function(_0x57fdd9){logger[_0x4eea('0xb')](_0x4eea('0x10'),_0x57fdd9[_0x4eea('0xe')],_0x3c4822);_0x1758c3(_0x1d6ce4['error'](0x1f4,_0x57fdd9['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d4757e1..ec1f3d5 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 _0x760b=['get','/process/:pid/kill','killProcess','exports','express','isAuthenticated','index'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x760b,0x97));var _0xb760=function(_0x33583d,_0x248810){_0x33583d=_0x33583d-0x0;var _0x26803d=_0x760b[_0x33583d];return _0x26803d;};'use strict';var express=require(_0xb760('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0xb760('0x1')](),controller[_0xb760('0x2')]);router[_0xb760('0x3')](_0xb760('0x4'),auth[_0xb760('0x1')](),controller[_0xb760('0x5')]);module[_0xb760('0x6')]=router; \ No newline at end of file +var _0x7a8b=['isAuthenticated','index','killProcess','express','Router','../../components/auth/service','./system.controller','get'];(function(_0xacff59,_0x2bd4c8){var _0x58b153=function(_0x3837d5){while(--_0x3837d5){_0xacff59['push'](_0xacff59['shift']());}};_0x58b153(++_0x2bd4c8);}(_0x7a8b,0x153));var _0xb7a8=function(_0x320379,_0x43edf7){_0x320379=_0x320379-0x0;var _0x3e0aa7=_0x7a8b[_0x320379];return _0x3e0aa7;};'use strict';var express=require(_0xb7a8('0x0'));var router=express[_0xb7a8('0x1')]();var auth=require(_0xb7a8('0x2'));var controller=require(_0xb7a8('0x3'));router[_0xb7a8('0x4')]('/',auth[_0xb7a8('0x5')](),controller[_0xb7a8('0x6')]);router[_0xb7a8('0x4')]('/process/:pid/kill',auth[_0xb7a8('0x5')](),controller[_0xb7a8('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 4719834..110f77b 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 _0x17c1=['send','index','getAllData','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status'];(function(_0x3358ee,_0x599447){var _0x2d976f=function(_0x26e7af){while(--_0x26e7af){_0x3358ee['push'](_0x3358ee['shift']());}};_0x2d976f(++_0x599447);}(_0x17c1,0x1c2));var _0x117c=function(_0xb1f07c,_0x28311a){_0xb1f07c=_0xb1f07c-0x0;var _0x27da11=_0x17c1[_0xb1f07c];return _0x27da11;};'use strict';var info=require(_0x117c('0x0'));var exec=require(_0x117c('0x1'))[_0x117c('0x2')];var logger=require(_0x117c('0x3'))(_0x117c('0x4'));var util=require(_0x117c('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x2e633b,_0x466af0,_0xf5804){_0x466af0=_0x466af0||0x1f4;return function(_0x4d4ff9){logger[_0x117c('0x6')](_0x117c('0x7'),_0xf5804,_0x466af0,util['inspect'](_0x4d4ff9,{'showHidden':![],'depth':null}));delete _0x4d4ff9[_0x117c('0x8')];_0x2e633b[_0x117c('0x9')](_0x466af0)[_0x117c('0xa')](_0x4d4ff9);};}exports[_0x117c('0xb')]=function(_0x3e09de,_0x1a54b8){return info[_0x117c('0xc')]()[_0x117c('0xd')](function(_0x19cac6){return _0x1a54b8['status'](0xc8)[_0x117c('0xe')](_0x19cac6);})['catch'](function(_0x1b6ca8){return _0x1a54b8[_0x117c('0x9')](0x1f4)['json'](_0x1b6ca8);});};exports[_0x117c('0xf')]=function(_0x39a780,_0x2fb7c9){var _0x1d863c=['components/import/cm'];return new BPromise(function(_0x2680ef,_0x4e3990){return exec(util[_0x117c('0x10')](_0x117c('0x11'),_0x39a780[_0x117c('0x12')][_0x117c('0x13')]),function(_0x32788d,_0x525c5d,_0x1a5ab5){if(_0x32788d){return _0x4e3990(_0x32788d);}return _0x2680ef(_0x525c5d);});})['then'](function(_0x22a8ca){var _0x14c9b1=![];var _0xde4ed7=_0x22a8ca[_0x117c('0x14')](/\n/);for(var _0x2565ed=0x0,_0x399809=_0x1d863c['length'];_0x2565ed<_0x399809,_0x14c9b1===![];_0x2565ed+=0x1){if(_0x22a8ca['indexOf'](_0x1d863c[_0x2565ed])>=0x0){_0x14c9b1=!![];}}if(!_0x14c9b1){throw new Error(util[_0x117c('0x10')](_0x117c('0x15'),_0x39a780[_0x117c('0x12')]['pid']));}process['kill'](_0x39a780['params'][_0x117c('0x13')],'SIGINT');return _0x2fb7c9['status'](0xc8)[_0x117c('0xe')]({'message':util[_0x117c('0x10')](_0x117c('0x16'),_0x39a780['params'][_0x117c('0x13')])});})['catch'](handleError(_0x2fb7c9,null,_0x117c('0xf')));}; \ No newline at end of file +var _0xd572=['name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x24eaf3,_0x2a564e){var _0x32cea1=function(_0x12107f){while(--_0x12107f){_0x24eaf3['push'](_0x24eaf3['shift']());}};_0x32cea1(++_0x2a564e);}(_0xd572,0xae));var _0x2d57=function(_0x4df8a6,_0x5c920d){_0x4df8a6=_0x4df8a6-0x0;var _0x300370=_0xd572[_0x4df8a6];return _0x300370;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x2d57('0x0')];var logger=require(_0x2d57('0x1'))(_0x2d57('0x2'));var util=require(_0x2d57('0x3'));var BPromise=require(_0x2d57('0x4'));var _=require(_0x2d57('0x5'));function handleError(_0x54b637,_0x4f6916,_0x2f9cec){_0x4f6916=_0x4f6916||0x1f4;return function(_0x21f5d0){logger[_0x2d57('0x6')](_0x2d57('0x7'),_0x2f9cec,_0x4f6916,util['inspect'](_0x21f5d0,{'showHidden':![],'depth':null}));delete _0x21f5d0[_0x2d57('0x8')];_0x54b637[_0x2d57('0x9')](_0x4f6916)[_0x2d57('0xa')](_0x21f5d0);};}exports[_0x2d57('0xb')]=function(_0x41632b,_0x78ffb7){return info[_0x2d57('0xc')]()[_0x2d57('0xd')](function(_0x48fb02){return _0x78ffb7['status'](0xc8)[_0x2d57('0xe')](_0x48fb02);})[_0x2d57('0xf')](function(_0x21e59b){return _0x78ffb7[_0x2d57('0x9')](0x1f4)['json'](_0x21e59b);});};exports[_0x2d57('0x10')]=function(_0x35eb63,_0x541936){var _0x28b431=[_0x2d57('0x11')];return new BPromise(function(_0x3377fc,_0x13fe3b){return exec(util[_0x2d57('0x12')](_0x2d57('0x13'),_0x35eb63[_0x2d57('0x14')][_0x2d57('0x15')]),function(_0x8a9e4b,_0x73beca,_0x358ce8){if(_0x8a9e4b){return _0x13fe3b(_0x8a9e4b);}return _0x3377fc(_0x73beca);});})[_0x2d57('0xd')](function(_0x1ea484){var _0x55b72c=![];var _0x32d90b=_0x1ea484['split'](/\n/);for(var _0x4607ee=0x0,_0x103404=_0x28b431[_0x2d57('0x16')];_0x4607ee<_0x103404,_0x55b72c===![];_0x4607ee+=0x1){if(_0x1ea484[_0x2d57('0x17')](_0x28b431[_0x4607ee])>=0x0){_0x55b72c=!![];}}if(!_0x55b72c){throw new Error(util['format'](_0x2d57('0x18'),_0x35eb63[_0x2d57('0x14')][_0x2d57('0x15')]));}process[_0x2d57('0x19')](_0x35eb63['params'][_0x2d57('0x15')],'SIGINT');return _0x541936[_0x2d57('0x9')](0xc8)['json']({'message':util[_0x2d57('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x35eb63[_0x2d57('0x14')][_0x2d57('0x15')])});})[_0x2d57('0xf')](handleError(_0x541936,null,_0x2d57('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 71e5bca..5aa3a90 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 _0x9bde=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','destroy'];(function(_0x36c9c5,_0x295ff6){var _0x1c960b=function(_0x4060ad){while(--_0x4060ad){_0x36c9c5['push'](_0x36c9c5['shift']());}};_0x1c960b(++_0x295ff6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d7eaa,_0x59746a){_0x1d7eaa=_0x1d7eaa-0x0;var _0x343f77=_0x9bde[_0x1d7eaa];return _0x343f77;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var auth=require(_0xe9bd('0x3'));var interaction=require(_0xe9bd('0x4'));var config=require(_0xe9bd('0x5'));var controller=require(_0xe9bd('0x6'));router[_0xe9bd('0x7')]('/',auth[_0xe9bd('0x8')](),controller['index']);router[_0xe9bd('0x7')](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0xb')]('/',auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0xd')](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller['update']);router['delete'](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file +var _0x41bb=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer'];(function(_0xf9fb96,_0x4037bc){var _0x53ec33=function(_0x1f742e){while(--_0x1f742e){_0xf9fb96['push'](_0xf9fb96['shift']());}};_0x53ec33(++_0x4037bc);}(_0x41bb,0xc5));var _0xb41b=function(_0xcca6e4,_0x250b8d){_0xcca6e4=_0xcca6e4-0x0;var _0x13ef13=_0x41bb[_0xcca6e4];return _0x13ef13;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var auth=require(_0xb41b('0x4'));var interaction=require(_0xb41b('0x5'));var config=require(_0xb41b('0x6'));var controller=require('./tag.controller');router[_0xb41b('0x7')]('/',auth[_0xb41b('0x8')](),controller[_0xb41b('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb41b('0xa')]);router[_0xb41b('0xb')]('/',auth['isAuthenticated'](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')](_0xb41b('0xe'),auth[_0xb41b('0x8')](),controller[_0xb41b('0xf')]);router[_0xb41b('0x10')](_0xb41b('0xe'),auth['isAuthenticated'](),controller[_0xb41b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6b6b309..6c8b8f8 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 _0x8603=['name','exports','STRING'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8603,0x190));var _0x3860=function(_0xeb80c9,_0x3fe888){_0xeb80c9=_0xeb80c9-0x0;var _0x259c37=_0x8603[_0xeb80c9];return _0x259c37;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x3860('0x1')]}}; \ No newline at end of file +var _0x2032=['#0091EA','exports','STRING','name'];(function(_0x18f068,_0x59bd76){var _0x3b02b1=function(_0x5432fc){while(--_0x5432fc){_0x18f068['push'](_0x18f068['shift']());}};_0x3b02b1(++_0x59bd76);}(_0x2032,0xd9));var _0x2203=function(_0x56cca6,_0x1151c7){_0x56cca6=_0x56cca6-0x0;var _0x417a6e=_0x2032[_0x56cca6];return _0x417a6e;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'unique':_0x2203('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x3')},'description':{'type':Sequelize[_0x2203('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d0d7851..93fe062 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 _0x9f2b=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0x9f2b,0xe9));var _0xb9f2=function(_0x35f6a6,_0x1b8d2d){_0x35f6a6=_0x35f6a6-0x0;var _0x1f4882=_0x9f2b[_0x35f6a6];return _0x1f4882;};'use strict';var pdf=require(_0xb9f2('0x0'));var emlformat=require(_0xb9f2('0x1'));var rimraf=require(_0xb9f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9f2('0x3'));var rp=require(_0xb9f2('0x4'));var moment=require(_0xb9f2('0x5'));var BPromise=require(_0xb9f2('0x6'));var Mustache=require(_0xb9f2('0x7'));var util=require('util');var path=require(_0xb9f2('0x8'));var sox=require(_0xb9f2('0x9'));var csv=require(_0xb9f2('0xa'));var ejs=require(_0xb9f2('0xb'));var fs=require('fs');var _=require(_0xb9f2('0xc'));var squel=require(_0xb9f2('0xd'));var crypto=require(_0xb9f2('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9f2('0xa'));var querystring=require(_0xb9f2('0xf'));var Papa=require(_0xb9f2('0x10'));var Redis=require(_0xb9f2('0x11'));var authService=require(_0xb9f2('0x12'));var qs=require(_0xb9f2('0x13'));var as=require(_0xb9f2('0x14'));var hardwareService=require(_0xb9f2('0x15'));var logger=require('../../config/logger')(_0xb9f2('0x16'));var utils=require(_0xb9f2('0x17'));var config=require(_0xb9f2('0x18'));var licenseUtil=require(_0xb9f2('0x19'));var db=require(_0xb9f2('0x1a'))['db'];function respondWithStatusCode(_0x1b1589,_0x5505cb){_0x5505cb=_0x5505cb||0xcc;return function(_0x300f99){if(_0x300f99){return _0x1b1589[_0xb9f2('0x1b')](_0x5505cb);}return _0x1b1589['status'](_0x5505cb)[_0xb9f2('0x1c')]();};}function respondWithResult(_0x3bd9a1,_0x1ea2b1){_0x1ea2b1=_0x1ea2b1||0xc8;return function(_0x2dcfbe){if(_0x2dcfbe){return _0x3bd9a1[_0xb9f2('0x1d')](_0x1ea2b1)[_0xb9f2('0x1e')](_0x2dcfbe);}};}function respondWithFilteredResult(_0x2090e6,_0x44aa6c){return function(_0x3a6a60){if(_0x3a6a60){var _0x3cf5fa=_0x3a6a60[_0xb9f2('0x1f')],_0x151556=_0x44aa6c[_0xb9f2('0x20')],_0x2a765e=_0x44aa6c['offset']+_0x44aa6c[_0xb9f2('0x21')],_0x3d9857;if(_0x2a765e>=_0x3cf5fa){_0x2a765e=_0x3cf5fa;_0x3d9857=0xc8;}else{_0x3d9857=0xce;}_0x2090e6[_0xb9f2('0x1d')](_0x3d9857);return _0x2090e6[_0xb9f2('0x22')](_0xb9f2('0x23'),_0x151556+'-'+_0x2a765e+'/'+_0x3cf5fa)['json'](_0x3a6a60);}return null;};}function patchUpdates(_0xc39022){return function(_0x365e7a){try{jsonpatch[_0xb9f2('0x24')](_0x365e7a,_0xc39022,!![]);}catch(_0x94acfc){return BPromise[_0xb9f2('0x25')](_0x94acfc);}return _0x365e7a[_0xb9f2('0x26')]();};}function saveUpdates(_0x4dd1be,_0x95e3ce){return function(_0x3c3899){if(_0x3c3899){return _0x3c3899['update'](_0x4dd1be)['then'](function(_0x979a8d){return _0x979a8d;});}return null;};}function removeEntity(_0x4019ef,_0x4d9513){return function(_0x4061f3){if(_0x4061f3){return _0x4061f3[_0xb9f2('0x27')]()[_0xb9f2('0x28')](function(){var _0x1a895f=_0x4061f3[_0xb9f2('0x29')]({'plain':!![]});var _0x4edc08=_0xb9f2('0x2a');return db[_0xb9f2('0x2b')][_0xb9f2('0x27')]({'where':{'type':_0x4edc08,'resourceId':_0x1a895f['id']}})[_0xb9f2('0x28')](function(){return _0x4061f3;});})[_0xb9f2('0x28')](function(){_0x4019ef[_0xb9f2('0x1d')](0xcc)[_0xb9f2('0x1c')]();});}};}function handleEntityNotFound(_0x942121,_0x259ab9){return function(_0x3276e8){if(!_0x3276e8){_0x942121[_0xb9f2('0x1b')](0x194);}return _0x3276e8;};}function handleError(_0x1aa127,_0x296f92){_0x296f92=_0x296f92||0x1f4;return function(_0x33a2d0){logger[_0xb9f2('0x2c')](_0x33a2d0[_0xb9f2('0x2d')]);if(_0x33a2d0[_0xb9f2('0x2e')]){delete _0x33a2d0[_0xb9f2('0x2e')];}_0x1aa127[_0xb9f2('0x1d')](_0x296f92)[_0xb9f2('0x2f')](_0x33a2d0);};}exports['index']=function(_0x1de423,_0x595d68){var _0x3aaed5={},_0x43f100={},_0x5ac5ef={'count':0x0,'rows':[]};var _0x4cd925=_[_0xb9f2('0x30')](db[_0xb9f2('0x31')]['rawAttributes'],function(_0xac4152){return{'name':_0xac4152[_0xb9f2('0x32')],'type':_0xac4152['type']['key']};});_0x43f100['model']=_[_0xb9f2('0x30')](_0x4cd925,_0xb9f2('0x2e'));_0x43f100[_0xb9f2('0x33')]=_[_0xb9f2('0x34')](_0x1de423[_0xb9f2('0x33')]);_0x43f100[_0xb9f2('0x35')]=_[_0xb9f2('0x36')](_0x43f100[_0xb9f2('0x37')],_0x43f100[_0xb9f2('0x33')]);_0x3aaed5[_0xb9f2('0x38')]=_[_0xb9f2('0x36')](_0x43f100[_0xb9f2('0x37')],qs[_0xb9f2('0x39')](_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x39')]));_0x3aaed5[_0xb9f2('0x38')]=_0x3aaed5[_0xb9f2('0x38')][_0xb9f2('0x3a')]?_0x3aaed5['attributes']:_0x43f100[_0xb9f2('0x37')];if(!_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x3b')](_0xb9f2('0x3c'))){_0x3aaed5['limit']=qs[_0xb9f2('0x21')](_0x1de423[_0xb9f2('0x33')]['limit']);_0x3aaed5[_0xb9f2('0x20')]=qs[_0xb9f2('0x20')](_0x1de423[_0xb9f2('0x33')]['offset']);}_0x3aaed5[_0xb9f2('0x3d')]=qs['sort'](_0x1de423['query'][_0xb9f2('0x3e')]);_0x3aaed5[_0xb9f2('0x3f')]=qs['filters'](_[_0xb9f2('0x40')](_0x1de423[_0xb9f2('0x33')],_0x43f100[_0xb9f2('0x35')]),_0x4cd925);if(_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x41')]){_0x3aaed5['where']=_[_0xb9f2('0x42')](_0x3aaed5['where'],{'$or':_['map'](_0x4cd925,function(_0x35d1f9){if(_0x35d1f9['type']!==_0xb9f2('0x43')){var _0x396790={};_0x396790[_0x35d1f9[_0xb9f2('0x2e')]]={'$like':'%'+_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x41')]+'%'};return _0x396790;}})});}_0x3aaed5=_[_0xb9f2('0x42')]({},_0x3aaed5,_0x1de423[_0xb9f2('0x44')]);var _0x186812={'where':_0x3aaed5[_0xb9f2('0x3f')]};return db[_0xb9f2('0x31')][_0xb9f2('0x1f')](_0x186812)['then'](function(_0x286c20){_0x5ac5ef['count']=_0x286c20;if(_0x1de423[_0xb9f2('0x33')]['includeAll']){_0x3aaed5[_0xb9f2('0x45')]=[{'all':!![]}];}return db[_0xb9f2('0x31')][_0xb9f2('0x46')](_0x3aaed5);})[_0xb9f2('0x28')](function(_0x1ea34c){_0x5ac5ef[_0xb9f2('0x47')]=_0x1ea34c;return _0x5ac5ef;})[_0xb9f2('0x28')](respondWithFilteredResult(_0x595d68,_0x3aaed5))[_0xb9f2('0x48')](handleError(_0x595d68,null));};exports['show']=function(_0x21956f,_0x50155d){var _0x257a21={'raw':!![],'where':{'id':_0x21956f[_0xb9f2('0x49')]['id']}},_0x54c038={};_0x54c038[_0xb9f2('0x37')]=_['keys'](db[_0xb9f2('0x31')][_0xb9f2('0x4a')]);_0x54c038[_0xb9f2('0x33')]=_[_0xb9f2('0x34')](_0x21956f['query']);_0x54c038[_0xb9f2('0x35')]=_[_0xb9f2('0x36')](_0x54c038[_0xb9f2('0x37')],_0x54c038[_0xb9f2('0x33')]);_0x257a21[_0xb9f2('0x38')]=_[_0xb9f2('0x36')](_0x54c038[_0xb9f2('0x37')],qs['fields'](_0x21956f[_0xb9f2('0x33')]['fields']));_0x257a21[_0xb9f2('0x38')]=_0x257a21[_0xb9f2('0x38')][_0xb9f2('0x3a')]?_0x257a21['attributes']:_0x54c038[_0xb9f2('0x37')];if(_0x21956f['query']['includeAll']){_0x257a21[_0xb9f2('0x45')]=[{'all':!![]}];}_0x257a21=_[_0xb9f2('0x42')]({},_0x257a21,_0x21956f[_0xb9f2('0x44')]);return db[_0xb9f2('0x31')]['find'](_0x257a21)[_0xb9f2('0x28')](handleEntityNotFound(_0x50155d,null))[_0xb9f2('0x28')](respondWithResult(_0x50155d,null))[_0xb9f2('0x48')](handleError(_0x50155d,null));};exports[_0xb9f2('0x4b')]=function(_0x3b7f61,_0x503607){return db['Tag']['create'](_0x3b7f61[_0xb9f2('0x4c')],{})[_0xb9f2('0x28')](function(_0xc31c65){var _0x301ab1=_0x3b7f61['user']['get']({'plain':!![]});if(!_0x301ab1)throw new Error(_0xb9f2('0x4d'));if(_0x301ab1['role']===_0xb9f2('0x4e')){var _0x5dfce3=_0xc31c65['get']({'plain':!![]});var _0x285843=_0xb9f2('0x2a');return db[_0xb9f2('0x4f')]['find']({'where':{'name':_0x285843,'userProfileId':_0x301ab1[_0xb9f2('0x50')]},'raw':!![]})[_0xb9f2('0x28')](function(_0x23d5e3){if(_0x23d5e3&&_0x23d5e3[_0xb9f2('0x51')]===0x0){return db['UserProfileResource'][_0xb9f2('0x4b')]({'name':_0x5dfce3['name'],'resourceId':_0x5dfce3['id'],'type':_0x23d5e3[_0xb9f2('0x2e')],'sectionId':_0x23d5e3['id']},{})[_0xb9f2('0x28')](function(){return _0xc31c65;});}else{return _0xc31c65;}})[_0xb9f2('0x48')](function(_0x2a843f){logger[_0xb9f2('0x2c')](_0xb9f2('0x52'),_0x2a843f);throw _0x2a843f;});}return _0xc31c65;})[_0xb9f2('0x28')](respondWithResult(_0x503607,0xc9))[_0xb9f2('0x48')](handleError(_0x503607,null));};exports[_0xb9f2('0x53')]=function(_0x123ff7,_0x13b39a){if(_0x123ff7['body']['id']){delete _0x123ff7[_0xb9f2('0x4c')]['id'];}return db['Tag'][_0xb9f2('0x54')]({'where':{'id':_0x123ff7[_0xb9f2('0x49')]['id']}})[_0xb9f2('0x28')](handleEntityNotFound(_0x13b39a,null))[_0xb9f2('0x28')](saveUpdates(_0x123ff7[_0xb9f2('0x4c')],null))[_0xb9f2('0x28')](respondWithResult(_0x13b39a,null))[_0xb9f2('0x48')](handleError(_0x13b39a,null));};exports[_0xb9f2('0x27')]=function(_0xeb30d,_0xe4d878){return db[_0xb9f2('0x31')][_0xb9f2('0x54')]({'where':{'id':_0xeb30d[_0xb9f2('0x49')]['id']}})[_0xb9f2('0x28')](handleEntityNotFound(_0xe4d878,null))[_0xb9f2('0x28')](removeEntity(_0xe4d878,null))['catch'](handleError(_0xe4d878,null));}; \ No newline at end of file +var _0x227a=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','Tags','UserProfileResource','error','name','index','map','Tag','rawAttributes','key','model','query','keys','filters'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x227a,0x6d));var _0xa227=function(_0x116135,_0x665a46){_0x116135=_0x116135-0x0;var _0x3faa51=_0x227a[_0x116135];return _0x3faa51;};'use strict';var pdf=require(_0xa227('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa227('0x1'));var zipdir=require(_0xa227('0x2'));var jsonpatch=require(_0xa227('0x3'));var rp=require(_0xa227('0x4'));var moment=require(_0xa227('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa227('0x6'));var util=require(_0xa227('0x7'));var path=require(_0xa227('0x8'));var sox=require(_0xa227('0x9'));var csv=require(_0xa227('0xa'));var ejs=require(_0xa227('0xb'));var fs=require('fs');var _=require(_0xa227('0xc'));var squel=require(_0xa227('0xd'));var crypto=require('crypto');var jsforce=require(_0xa227('0xe'));var deskjs=require(_0xa227('0xf'));var toCsv=require(_0xa227('0xa'));var querystring=require(_0xa227('0x10'));var Papa=require(_0xa227('0x11'));var Redis=require(_0xa227('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa227('0x13'));var logger=require(_0xa227('0x14'))(_0xa227('0x15'));var utils=require('../../config/utils');var config=require(_0xa227('0x16'));var licenseUtil=require(_0xa227('0x17'));var db=require(_0xa227('0x18'))['db'];function respondWithStatusCode(_0x3b1d4a,_0x34b5b4){_0x34b5b4=_0x34b5b4||0xcc;return function(_0x54f100){if(_0x54f100){return _0x3b1d4a[_0xa227('0x19')](_0x34b5b4);}return _0x3b1d4a['status'](_0x34b5b4)[_0xa227('0x1a')]();};}function respondWithResult(_0xadf03b,_0x3cb2bb){_0x3cb2bb=_0x3cb2bb||0xc8;return function(_0x4d6437){if(_0x4d6437){return _0xadf03b[_0xa227('0x1b')](_0x3cb2bb)['json'](_0x4d6437);}};}function respondWithFilteredResult(_0xab5bf,_0x53de0a){return function(_0x16331a){if(_0x16331a){var _0x117539=_0x16331a[_0xa227('0x1c')],_0x6d4603=_0x53de0a[_0xa227('0x1d')],_0x39993d=_0x53de0a[_0xa227('0x1d')]+_0x53de0a[_0xa227('0x1e')],_0x2ee40a;if(_0x39993d>=_0x117539){_0x39993d=_0x117539;_0x2ee40a=0xc8;}else{_0x2ee40a=0xce;}_0xab5bf[_0xa227('0x1b')](_0x2ee40a);return _0xab5bf[_0xa227('0x1f')](_0xa227('0x20'),_0x6d4603+'-'+_0x39993d+'/'+_0x117539)[_0xa227('0x21')](_0x16331a);}return null;};}function patchUpdates(_0x2622b7){return function(_0x5cb6dc){try{jsonpatch[_0xa227('0x22')](_0x5cb6dc,_0x2622b7,!![]);}catch(_0x50e6fb){return BPromise[_0xa227('0x23')](_0x50e6fb);}return _0x5cb6dc[_0xa227('0x24')]();};}function saveUpdates(_0x4dfbee,_0x147a16){return function(_0x215121){if(_0x215121){return _0x215121[_0xa227('0x25')](_0x4dfbee)['then'](function(_0x188ac5){return _0x188ac5;});}return null;};}function removeEntity(_0x6a8b74,_0x2e5bc3){return function(_0x354f48){if(_0x354f48){return _0x354f48[_0xa227('0x26')]()[_0xa227('0x27')](function(){var _0x5c713b=_0x354f48['get']({'plain':!![]});var _0x297ab1=_0xa227('0x28');return db[_0xa227('0x29')][_0xa227('0x26')]({'where':{'type':_0x297ab1,'resourceId':_0x5c713b['id']}})[_0xa227('0x27')](function(){return _0x354f48;});})[_0xa227('0x27')](function(){_0x6a8b74[_0xa227('0x1b')](0xcc)[_0xa227('0x1a')]();});}};}function handleEntityNotFound(_0x111bb1,_0x201d64){return function(_0xc09d46){if(!_0xc09d46){_0x111bb1[_0xa227('0x19')](0x194);}return _0xc09d46;};}function handleError(_0x566e7c,_0x300ee1){_0x300ee1=_0x300ee1||0x1f4;return function(_0x12bc38){logger[_0xa227('0x2a')](_0x12bc38['stack']);if(_0x12bc38['name']){delete _0x12bc38[_0xa227('0x2b')];}_0x566e7c[_0xa227('0x1b')](_0x300ee1)['send'](_0x12bc38);};}exports[_0xa227('0x2c')]=function(_0x472d3b,_0x511743){var _0x3904d5={},_0x323c64={},_0x5394ca={'count':0x0,'rows':[]};var _0x45fd55=_[_0xa227('0x2d')](db[_0xa227('0x2e')][_0xa227('0x2f')],function(_0x1c0b14){return{'name':_0x1c0b14['fieldName'],'type':_0x1c0b14['type'][_0xa227('0x30')]};});_0x323c64[_0xa227('0x31')]=_[_0xa227('0x2d')](_0x45fd55,_0xa227('0x2b'));_0x323c64[_0xa227('0x32')]=_[_0xa227('0x33')](_0x472d3b['query']);_0x323c64[_0xa227('0x34')]=_['intersection'](_0x323c64[_0xa227('0x31')],_0x323c64[_0xa227('0x32')]);_0x3904d5['attributes']=_[_0xa227('0x35')](_0x323c64[_0xa227('0x31')],qs['fields'](_0x472d3b['query']['fields']));_0x3904d5[_0xa227('0x36')]=_0x3904d5[_0xa227('0x36')][_0xa227('0x37')]?_0x3904d5[_0xa227('0x36')]:_0x323c64['model'];if(!_0x472d3b[_0xa227('0x32')][_0xa227('0x38')](_0xa227('0x39'))){_0x3904d5[_0xa227('0x1e')]=qs[_0xa227('0x1e')](_0x472d3b['query'][_0xa227('0x1e')]);_0x3904d5[_0xa227('0x1d')]=qs[_0xa227('0x1d')](_0x472d3b[_0xa227('0x32')][_0xa227('0x1d')]);}_0x3904d5[_0xa227('0x3a')]=qs[_0xa227('0x3b')](_0x472d3b['query'][_0xa227('0x3b')]);_0x3904d5[_0xa227('0x3c')]=qs['filters'](_[_0xa227('0x3d')](_0x472d3b[_0xa227('0x32')],_0x323c64[_0xa227('0x34')]),_0x45fd55);if(_0x472d3b[_0xa227('0x32')][_0xa227('0x3e')]){_0x3904d5[_0xa227('0x3c')]=_[_0xa227('0x3f')](_0x3904d5[_0xa227('0x3c')],{'$or':_['map'](_0x45fd55,function(_0x440a9a){if(_0x440a9a[_0xa227('0x40')]!==_0xa227('0x41')){var _0x3f2bcd={};_0x3f2bcd[_0x440a9a[_0xa227('0x2b')]]={'$like':'%'+_0x472d3b[_0xa227('0x32')]['filter']+'%'};return _0x3f2bcd;}})});}_0x3904d5=_[_0xa227('0x3f')]({},_0x3904d5,_0x472d3b[_0xa227('0x42')]);var _0x382066={'where':_0x3904d5[_0xa227('0x3c')]};return db[_0xa227('0x2e')][_0xa227('0x1c')](_0x382066)[_0xa227('0x27')](function(_0x1ccfde){_0x5394ca[_0xa227('0x1c')]=_0x1ccfde;if(_0x472d3b['query'][_0xa227('0x43')]){_0x3904d5[_0xa227('0x44')]=[{'all':!![]}];}return db[_0xa227('0x2e')]['findAll'](_0x3904d5);})[_0xa227('0x27')](function(_0x28d46a){_0x5394ca[_0xa227('0x45')]=_0x28d46a;return _0x5394ca;})[_0xa227('0x27')](respondWithFilteredResult(_0x511743,_0x3904d5))[_0xa227('0x46')](handleError(_0x511743,null));};exports['show']=function(_0x5558a4,_0x5f2866){var _0x527934={'raw':!![],'where':{'id':_0x5558a4[_0xa227('0x47')]['id']}},_0x441ed0={};_0x441ed0[_0xa227('0x31')]=_['keys'](db[_0xa227('0x2e')][_0xa227('0x2f')]);_0x441ed0['query']=_[_0xa227('0x33')](_0x5558a4['query']);_0x441ed0[_0xa227('0x34')]=_[_0xa227('0x35')](_0x441ed0[_0xa227('0x31')],_0x441ed0['query']);_0x527934[_0xa227('0x36')]=_[_0xa227('0x35')](_0x441ed0['model'],qs[_0xa227('0x48')](_0x5558a4[_0xa227('0x32')]['fields']));_0x527934[_0xa227('0x36')]=_0x527934[_0xa227('0x36')][_0xa227('0x37')]?_0x527934['attributes']:_0x441ed0[_0xa227('0x31')];if(_0x5558a4[_0xa227('0x32')][_0xa227('0x43')]){_0x527934[_0xa227('0x44')]=[{'all':!![]}];}_0x527934=_[_0xa227('0x3f')]({},_0x527934,_0x5558a4[_0xa227('0x42')]);return db[_0xa227('0x2e')][_0xa227('0x49')](_0x527934)['then'](handleEntityNotFound(_0x5f2866,null))['then'](respondWithResult(_0x5f2866,null))['catch'](handleError(_0x5f2866,null));};exports[_0xa227('0x4a')]=function(_0x5177b1,_0xfe70f6){return db[_0xa227('0x2e')]['create'](_0x5177b1[_0xa227('0x4b')],{})['then'](function(_0x393f50){var _0x2d940f=_0x5177b1[_0xa227('0x4c')][_0xa227('0x4d')]({'plain':!![]});if(!_0x2d940f)throw new Error(_0xa227('0x4e'));if(_0x2d940f['role']===_0xa227('0x4c')){var _0x14e912=_0x393f50[_0xa227('0x4d')]({'plain':!![]});var _0x30bd4c='Tags';return db[_0xa227('0x4f')]['find']({'where':{'name':_0x30bd4c,'userProfileId':_0x2d940f[_0xa227('0x50')]},'raw':!![]})['then'](function(_0x36db17){if(_0x36db17&&_0x36db17['autoAssociation']===0x0){return db['UserProfileResource'][_0xa227('0x4a')]({'name':_0x14e912[_0xa227('0x2b')],'resourceId':_0x14e912['id'],'type':_0x36db17[_0xa227('0x2b')],'sectionId':_0x36db17['id']},{})['then'](function(){return _0x393f50;});}else{return _0x393f50;}})['catch'](function(_0x4ea225){logger[_0xa227('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ea225);throw _0x4ea225;});}return _0x393f50;})[_0xa227('0x27')](respondWithResult(_0xfe70f6,0xc9))[_0xa227('0x46')](handleError(_0xfe70f6,null));};exports[_0xa227('0x25')]=function(_0x5b8152,_0x3a401e){if(_0x5b8152[_0xa227('0x4b')]['id']){delete _0x5b8152[_0xa227('0x4b')]['id'];}return db[_0xa227('0x2e')][_0xa227('0x49')]({'where':{'id':_0x5b8152[_0xa227('0x47')]['id']}})[_0xa227('0x27')](handleEntityNotFound(_0x3a401e,null))[_0xa227('0x27')](saveUpdates(_0x5b8152[_0xa227('0x4b')],null))[_0xa227('0x27')](respondWithResult(_0x3a401e,null))[_0xa227('0x46')](handleError(_0x3a401e,null));};exports[_0xa227('0x26')]=function(_0x416405,_0x22c7f5){return db[_0xa227('0x2e')][_0xa227('0x49')]({'where':{'id':_0x416405[_0xa227('0x47')]['id']}})[_0xa227('0x27')](handleEntityNotFound(_0x22c7f5,null))['then'](removeEntity(_0x22c7f5,null))[_0xa227('0x46')](handleError(_0x22c7f5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3898d8c..fb2c41c 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 _0xe6e4=['tools_tags','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','define','Tag'];(function(_0x165abf,_0x1c8df5){var _0x25d167=function(_0x1bd1f0){while(--_0x1bd1f0){_0x165abf['push'](_0x165abf['shift']());}};_0x25d167(++_0x1c8df5);}(_0xe6e4,0x139));var _0x4e6e=function(_0x1d53b0,_0x42145e){_0x1d53b0=_0x1d53b0-0x0;var _0x11cf0f=_0xe6e4[_0x1d53b0];return _0x11cf0f;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var logger=require('../../config/logger')(_0x4e6e('0x2'));var moment=require(_0x4e6e('0x3'));var BPromise=require(_0x4e6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e6e('0x5'));var rimraf=require(_0x4e6e('0x6'));var config=require(_0x4e6e('0x7'));var attributes=require(_0x4e6e('0x8'));module['exports']=function(_0x439090,_0x248b61){return _0x439090[_0x4e6e('0x9')](_0x4e6e('0xa'),attributes,{'tableName':_0x4e6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd407=['api','moment','request-promise','path','rimraf','exports','define','tools_tags','lodash','util'];(function(_0x4adc27,_0x35f89d){var _0x49b937=function(_0x341e70){while(--_0x341e70){_0x4adc27['push'](_0x4adc27['shift']());}};_0x49b937(++_0x35f89d);}(_0xd407,0x1de));var _0x7d40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd407[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d40('0x0'));var util=require(_0x7d40('0x1'));var logger=require('../../config/logger')(_0x7d40('0x2'));var moment=require(_0x7d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d40('0x4'));var fs=require('fs');var path=require(_0x7d40('0x5'));var rimraf=require(_0x7d40('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x7d40('0x7')]=function(_0x1ce147,_0x46307f){return _0x1ce147[_0x7d40('0x8')]('Tag',attributes,{'tableName':_0x7d40('0x9'),'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 0b3dbe4..7a945b4 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 _0x41bb=['Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x26e9ff,_0x335566){var _0x5018d7=function(_0x61810b){while(--_0x61810b){_0x26e9ff['push'](_0x26e9ff['shift']());}};_0x5018d7(++_0x335566);}(_0x41bb,0xc5));var _0xb41b=function(_0x4353b9,_0x1e8c39){_0x4353b9=_0x4353b9-0x0;var _0x4ccfa3=_0x41bb[_0x4353b9];return _0x4ccfa3;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});} \ No newline at end of file +var _0xe205=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0xe205,0xa7));var _0x5e20=function(_0x10d1a9,_0xa1aa59){_0x10d1a9=_0x10d1a9-0x0;var _0x4a7b02=_0xe205[_0x10d1a9];return _0x4a7b02;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('Tag,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('Tag,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('Tag,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 21e4871..11132f9 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 _0xf3bc=['index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x34ae7d,_0x359c6f){var _0x5d4f3d=function(_0x2701c7){while(--_0x2701c7){_0x34ae7d['push'](_0x34ae7d['shift']());}};_0x5d4f3d(++_0x359c6f);}(_0xf3bc,0x13b));var _0xcf3b=function(_0x1a4a9a,_0x500630){_0x1a4a9a=_0x1a4a9a-0x0;var _0x40a449=_0xf3bc[_0x1a4a9a];return _0x40a449;};'use strict';var multer=require(_0xcf3b('0x0'));var util=require(_0xcf3b('0x1'));var path=require(_0xcf3b('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf3b('0x3'));var router=express[_0xcf3b('0x4')]();var auth=require(_0xcf3b('0x5'));var interaction=require(_0xcf3b('0x6'));var config=require(_0xcf3b('0x7'));var controller=require('./team.controller');router[_0xcf3b('0x8')]('/',auth[_0xcf3b('0x9')](),controller[_0xcf3b('0xa')]);router[_0xcf3b('0x8')](_0xcf3b('0xb'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0xc')]);router['get'](_0xcf3b('0xd'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0xe')]);router['get'](_0xcf3b('0xf'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0x10')]);router[_0xcf3b('0x11')]('/',auth[_0xcf3b('0x9')](),controller['create']);router[_0xcf3b('0x11')]('/:id/queues',auth[_0xcf3b('0x9')](),controller[_0xcf3b('0x12')]);router[_0xcf3b('0x11')](_0xcf3b('0xf'),auth['isAuthenticated'](),controller[_0xcf3b('0x13')]);router[_0xcf3b('0x14')]('/:id',auth[_0xcf3b('0x9')](),controller['update']);router[_0xcf3b('0x15')](_0xcf3b('0xb'),auth['isAuthenticated'](),controller[_0xcf3b('0x16')]);router[_0xcf3b('0x15')](_0xcf3b('0xd'),auth[_0xcf3b('0x9')](),controller['removeQueues']);router[_0xcf3b('0x15')](_0xcf3b('0xf'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0x17')]);module[_0xcf3b('0x18')]=router; \ No newline at end of file +var _0xd28e=['/:id','delete','removeQueues','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./team.controller','get','index','show','/:id/queues','isAuthenticated','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put'];(function(_0x545455,_0x5af43a){var _0x3afc96=function(_0x1ba73e){while(--_0x1ba73e){_0x545455['push'](_0x545455['shift']());}};_0x3afc96(++_0x5af43a);}(_0xd28e,0x9a));var _0xed28=function(_0x7b368c,_0x4808d7){_0x7b368c=_0x7b368c-0x0;var _0x3db470=_0xd28e[_0x7b368c];return _0x3db470;};'use strict';var multer=require(_0xed28('0x0'));var util=require(_0xed28('0x1'));var path=require(_0xed28('0x2'));var timeout=require(_0xed28('0x3'));var express=require(_0xed28('0x4'));var router=express[_0xed28('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xed28('0x6'));var config=require('../../config/environment');var controller=require(_0xed28('0x7'));router[_0xed28('0x8')]('/',auth['isAuthenticated'](),controller[_0xed28('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xed28('0xa')]);router[_0xed28('0x8')](_0xed28('0xb'),auth[_0xed28('0xc')](),controller[_0xed28('0xd')]);router['get'](_0xed28('0xe'),auth[_0xed28('0xc')](),controller[_0xed28('0xf')]);router[_0xed28('0x10')]('/',auth[_0xed28('0xc')](),controller[_0xed28('0x11')]);router[_0xed28('0x10')]('/:id/queues',auth['isAuthenticated'](),controller[_0xed28('0x12')]);router[_0xed28('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xed28('0x13')]);router[_0xed28('0x14')](_0xed28('0x15'),auth[_0xed28('0xc')](),controller['update']);router[_0xed28('0x16')]('/:id',auth[_0xed28('0xc')](),controller['destroy']);router[_0xed28('0x16')](_0xed28('0xb'),auth['isAuthenticated'](),controller[_0xed28('0x17')]);router[_0xed28('0x16')]('/:id/users',auth[_0xed28('0xc')](),controller['removeAgents']);module[_0xed28('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 94191d5..fe90db1 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 _0x5acd=['sequelize','STRING','name'];(function(_0x42b67b,_0x23bca1){var _0x5e1cb2=function(_0x28a266){while(--_0x28a266){_0x42b67b['push'](_0x42b67b['shift']());}};_0x5e1cb2(++_0x23bca1);}(_0x5acd,0xe4));var _0xd5ac=function(_0xd16d89,_0x1af913){_0xd16d89=_0xd16d89-0x0;var _0x2a3a16=_0x5acd[_0xd16d89];return _0x2a3a16;};'use strict';var Sequelize=require(_0xd5ac('0x0'));module['exports']={'name':{'type':Sequelize[_0xd5ac('0x1')],'allowNull':![],'unique':_0xd5ac('0x2')},'description':{'type':Sequelize[_0xd5ac('0x1')]}}; \ No newline at end of file +var _0x658e=['name','sequelize','exports'];(function(_0x41449d,_0x4b36a5){var _0x4eee5a=function(_0x15fd6a){while(--_0x15fd6a){_0x41449d['push'](_0x41449d['shift']());}};_0x4eee5a(++_0x4b36a5);}(_0x658e,0x9a));var _0xe658=function(_0x40b241,_0x2ce6cc){_0x40b241=_0x40b241-0x0;var _0x22b4b1=_0x658e[_0x40b241];return _0x22b4b1;};'use strict';var Sequelize=require(_0xe658('0x0'));module[_0xe658('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe658('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 5923512..494884a 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 _0x23d5=['UserProfileResource','create','isValidChannel','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','merge','Queues','addQueues','findOne','Sequelize','capitalize','ids','removeQueues','remove','Voice','Chat','Fax','Openchannel','each','User','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','addAgents','omit','spread','userTeam:save','removeAgents','chat','mail','sms','fax','whatsapp','isArray','emit','userTeam:remove','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','get','Teams','destroy','error','stack','send','index','map','Team','rawAttributes','key','name','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x1147ca,_0x4c5058){var _0x46c270=function(_0x57ef50){while(--_0x57ef50){_0x1147ca['push'](_0x1147ca['shift']());}};_0x46c270(++_0x4c5058);}(_0x23d5,0x12a));var _0x523d=function(_0x27e45a,_0x580214){_0x27e45a=_0x27e45a-0x0;var _0x20ce3b=_0x23d5[_0x27e45a];return _0x20ce3b;};'use strict';var pdf=require(_0x523d('0x0'));var emlformat=require(_0x523d('0x1'));var rimraf=require(_0x523d('0x2'));var zipdir=require(_0x523d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x523d('0x4'));var Mustache=require('mustache');var util=require(_0x523d('0x5'));var path=require(_0x523d('0x6'));var sox=require(_0x523d('0x7'));var csv=require('to-csv');var ejs=require(_0x523d('0x8'));var fs=require('fs');var _=require(_0x523d('0x9'));var squel=require('squel');var crypto=require(_0x523d('0xa'));var jsforce=require(_0x523d('0xb'));var deskjs=require(_0x523d('0xc'));var toCsv=require(_0x523d('0xd'));var querystring=require(_0x523d('0xe'));var Papa=require(_0x523d('0xf'));var Redis=require(_0x523d('0x10'));var authService=require(_0x523d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x523d('0x12'));var logger=require(_0x523d('0x13'))(_0x523d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x523d('0x15'));var db=require(_0x523d('0x16'))['db'];config[_0x523d('0x17')]=_[_0x523d('0x18')](config[_0x523d('0x17')],{'host':_0x523d('0x19'),'port':0x18eb});var socket=require(_0x523d('0x1a'))(new Redis(config['redis']));require(_0x523d('0x1b'))[_0x523d('0x1c')](socket);function respondWithStatusCode(_0x36570b,_0x5669a3){_0x5669a3=_0x5669a3||0xcc;return function(_0x2ce5c7){if(_0x2ce5c7){return _0x36570b[_0x523d('0x1d')](_0x5669a3);}return _0x36570b['status'](_0x5669a3)[_0x523d('0x1e')]();};}function respondWithResult(_0x3a90c6,_0x3846cd){_0x3846cd=_0x3846cd||0xc8;return function(_0x34548e){if(_0x34548e){return _0x3a90c6[_0x523d('0x1f')](_0x3846cd)[_0x523d('0x20')](_0x34548e);}};}function respondWithFilteredResult(_0x517b48,_0x44e687){return function(_0x2c973a){if(_0x2c973a){var _0x1e6cc7=_0x2c973a['count'],_0x129c8d=_0x44e687['offset'],_0x3ab614=_0x44e687[_0x523d('0x21')]+_0x44e687[_0x523d('0x22')],_0x236519;if(_0x3ab614>=_0x1e6cc7){_0x3ab614=_0x1e6cc7;_0x236519=0xc8;}else{_0x236519=0xce;}_0x517b48['status'](_0x236519);return _0x517b48[_0x523d('0x23')](_0x523d('0x24'),_0x129c8d+'-'+_0x3ab614+'/'+_0x1e6cc7)[_0x523d('0x20')](_0x2c973a);}return null;};}function patchUpdates(_0x3612e0){return function(_0x350816){try{jsonpatch[_0x523d('0x25')](_0x350816,_0x3612e0,!![]);}catch(_0x15663){return BPromise[_0x523d('0x26')](_0x15663);}return _0x350816['save']();};}function saveUpdates(_0x5c5ee6,_0x2daace){return function(_0x48a056){if(_0x48a056){return _0x48a056[_0x523d('0x27')](_0x5c5ee6)[_0x523d('0x28')](function(_0x1d7183){return _0x1d7183;});}return null;};}function removeEntity(_0x5cc5be,_0x4beb3f){return function(_0x1dea5f){if(_0x1dea5f){return _0x1dea5f['destroy']()[_0x523d('0x28')](function(){var _0xeedeb3=_0x1dea5f[_0x523d('0x29')]({'plain':!![]});var _0x565c17=_0x523d('0x2a');return db['UserProfileResource'][_0x523d('0x2b')]({'where':{'type':_0x565c17,'resourceId':_0xeedeb3['id']}})[_0x523d('0x28')](function(){return _0x1dea5f;});})[_0x523d('0x28')](function(){_0x5cc5be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d24c,_0x4c0cd4){return function(_0x1c0e68){if(!_0x1c0e68){_0x17d24c[_0x523d('0x1d')](0x194);}return _0x1c0e68;};}function handleError(_0x376fbb,_0x407c06){_0x407c06=_0x407c06||0x1f4;return function(_0xafbc34){logger[_0x523d('0x2c')](_0xafbc34[_0x523d('0x2d')]);if(_0xafbc34['name']){delete _0xafbc34['name'];}_0x376fbb[_0x523d('0x1f')](_0x407c06)[_0x523d('0x2e')](_0xafbc34);};}exports[_0x523d('0x2f')]=function(_0x57a9cf,_0x5b992b){var _0x137d69={},_0x518c04={},_0x2e2621={'count':0x0,'rows':[]};var _0x711260=_[_0x523d('0x30')](db[_0x523d('0x31')][_0x523d('0x32')],function(_0x3587cd){return{'name':_0x3587cd['fieldName'],'type':_0x3587cd['type'][_0x523d('0x33')]};});_0x518c04['model']=_[_0x523d('0x30')](_0x711260,_0x523d('0x34'));_0x518c04[_0x523d('0x35')]=_['keys'](_0x57a9cf[_0x523d('0x35')]);_0x518c04['filters']=_[_0x523d('0x36')](_0x518c04[_0x523d('0x37')],_0x518c04[_0x523d('0x35')]);_0x137d69[_0x523d('0x38')]=_[_0x523d('0x36')](_0x518c04[_0x523d('0x37')],qs[_0x523d('0x39')](_0x57a9cf[_0x523d('0x35')]['fields']));_0x137d69[_0x523d('0x38')]=_0x137d69['attributes'][_0x523d('0x3a')]?_0x137d69['attributes']:_0x518c04[_0x523d('0x37')];if(!_0x57a9cf[_0x523d('0x35')]['hasOwnProperty'](_0x523d('0x3b'))){_0x137d69[_0x523d('0x22')]=qs[_0x523d('0x22')](_0x57a9cf[_0x523d('0x35')]['limit']);_0x137d69[_0x523d('0x21')]=qs[_0x523d('0x21')](_0x57a9cf[_0x523d('0x35')][_0x523d('0x21')]);}_0x137d69[_0x523d('0x3c')]=qs[_0x523d('0x3d')](_0x57a9cf[_0x523d('0x35')][_0x523d('0x3d')]);_0x137d69[_0x523d('0x3e')]=qs[_0x523d('0x3f')](_[_0x523d('0x40')](_0x57a9cf[_0x523d('0x35')],_0x518c04[_0x523d('0x3f')]),_0x711260);if(_0x57a9cf['query'][_0x523d('0x41')]){_0x137d69[_0x523d('0x3e')]=_['merge'](_0x137d69[_0x523d('0x3e')],{'$or':_[_0x523d('0x30')](_0x711260,function(_0x34dbd5){if(_0x34dbd5['type']!==_0x523d('0x42')){var _0x3b84c8={};_0x3b84c8[_0x34dbd5[_0x523d('0x34')]]={'$like':'%'+_0x57a9cf[_0x523d('0x35')][_0x523d('0x41')]+'%'};return _0x3b84c8;}})});}_0x137d69=_['merge']({},_0x137d69,_0x57a9cf[_0x523d('0x43')]);var _0x2c6ebb={'where':_0x137d69[_0x523d('0x3e')]};return db[_0x523d('0x31')]['count'](_0x2c6ebb)[_0x523d('0x28')](function(_0x2d5333){_0x2e2621[_0x523d('0x44')]=_0x2d5333;if(_0x57a9cf[_0x523d('0x35')][_0x523d('0x45')]){_0x137d69[_0x523d('0x46')]=[{'all':!![]}];}return db['Team'][_0x523d('0x47')](_0x137d69);})['then'](function(_0x4574c5){_0x2e2621['rows']=_0x4574c5;return _0x2e2621;})[_0x523d('0x28')](respondWithFilteredResult(_0x5b992b,_0x137d69))[_0x523d('0x48')](handleError(_0x5b992b,null));};exports['show']=function(_0x57d528,_0x1ed9a7){var _0x1f7a0c={'raw':![],'where':{'id':_0x57d528[_0x523d('0x49')]['id']}},_0x14618d={};_0x14618d[_0x523d('0x37')]=_[_0x523d('0x4a')](db[_0x523d('0x31')][_0x523d('0x32')]);_0x14618d[_0x523d('0x35')]=_[_0x523d('0x4a')](_0x57d528['query']);_0x14618d['filters']=_[_0x523d('0x36')](_0x14618d[_0x523d('0x37')],_0x14618d[_0x523d('0x35')]);_0x1f7a0c[_0x523d('0x38')]=_['intersection'](_0x14618d['model'],qs[_0x523d('0x39')](_0x57d528[_0x523d('0x35')][_0x523d('0x39')]));_0x1f7a0c['attributes']=_0x1f7a0c[_0x523d('0x38')][_0x523d('0x3a')]?_0x1f7a0c[_0x523d('0x38')]:_0x14618d[_0x523d('0x37')];if(_0x57d528[_0x523d('0x35')][_0x523d('0x45')]){_0x1f7a0c[_0x523d('0x46')]=[{'all':!![]}];}_0x1f7a0c=_['merge']({},_0x1f7a0c,_0x57d528[_0x523d('0x43')]);return db[_0x523d('0x31')][_0x523d('0x4b')](_0x1f7a0c)['then'](handleEntityNotFound(_0x1ed9a7,null))[_0x523d('0x28')](respondWithResult(_0x1ed9a7,null))[_0x523d('0x48')](handleError(_0x1ed9a7,null));};exports['create']=function(_0x3d08f9,_0x5dddde){return db[_0x523d('0x31')]['create'](_0x3d08f9[_0x523d('0x4c')],{})['then'](function(_0x3e122b){var _0x31abb1=_0x3d08f9[_0x523d('0x4d')][_0x523d('0x29')]({'plain':!![]});if(!_0x31abb1)throw new Error(_0x523d('0x4e'));if(_0x31abb1[_0x523d('0x4f')]==='user'){var _0x30e94d=_0x3e122b[_0x523d('0x29')]({'plain':!![]});var _0x1defe8=_0x523d('0x2a');return db[_0x523d('0x50')]['find']({'where':{'name':_0x1defe8,'userProfileId':_0x31abb1[_0x523d('0x51')]},'raw':!![]})[_0x523d('0x28')](function(_0x52114c){if(_0x52114c&&_0x52114c[_0x523d('0x52')]===0x0){return db[_0x523d('0x53')][_0x523d('0x54')]({'name':_0x30e94d[_0x523d('0x34')],'resourceId':_0x30e94d['id'],'type':_0x52114c[_0x523d('0x34')],'sectionId':_0x52114c['id']},{})[_0x523d('0x28')](function(){return _0x3e122b;});}else{return _0x3e122b;}})[_0x523d('0x48')](function(_0x59eef5){logger[_0x523d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59eef5);throw _0x59eef5;});}return _0x3e122b;})['then'](respondWithResult(_0x5dddde,0xc9))['catch'](handleError(_0x5dddde,null));};exports[_0x523d('0x27')]=function(_0x4a53e5,_0x259093){if(_0x4a53e5[_0x523d('0x4c')]['id']){delete _0x4a53e5[_0x523d('0x4c')]['id'];}return db[_0x523d('0x31')]['find']({'where':{'id':_0x4a53e5[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x259093,null))[_0x523d('0x28')](saveUpdates(_0x4a53e5['body'],null))['then'](respondWithResult(_0x259093,null))['catch'](handleError(_0x259093,null));};exports['destroy']=function(_0xca4fc3,_0x5214dc){return db[_0x523d('0x31')]['find']({'where':{'id':_0xca4fc3[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x5214dc,null))['then'](removeEntity(_0x5214dc,null))[_0x523d('0x48')](handleError(_0x5214dc,null));};exports['getQueues']=function(_0x170e70,_0xf4e2bf,_0x1db5d4){return db[_0x523d('0x31')]['findOne']({'where':{'id':_0x170e70[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0xf4e2bf,null))['then'](function(_0x536eea){if(!_0x170e70[_0x523d('0x35')]['channel']||!utils[_0x523d('0x55')](_0x170e70['query'][_0x523d('0x56')])){throw new db['Sequelize'][(_0x523d('0x57'))](_0x523d('0x58'));}var _0x5793cc={};var _0x3b410f={};_0x3b410f[_0x523d('0x37')]=_[_0x523d('0x4a')](db[_['capitalize'](_0x170e70[_0x523d('0x35')]['channel'][_0x523d('0x59')]())+_0x523d('0x5a')][_0x523d('0x32')]);_0x3b410f[_0x523d('0x35')]=_[_0x523d('0x4a')](_0x170e70['query']);_0x3b410f[_0x523d('0x3f')]=_[_0x523d('0x36')](_0x3b410f[_0x523d('0x37')],_0x3b410f[_0x523d('0x35')]);_0x5793cc[_0x523d('0x38')]=_['intersection'](_0x3b410f[_0x523d('0x37')],qs[_0x523d('0x39')](_0x170e70[_0x523d('0x35')][_0x523d('0x39')]));_0x5793cc[_0x523d('0x38')]=_0x5793cc[_0x523d('0x38')][_0x523d('0x3a')]?_0x5793cc[_0x523d('0x38')]:_0x3b410f['model'];_0x5793cc[_0x523d('0x22')]=qs[_0x523d('0x22')](_0x170e70[_0x523d('0x35')][_0x523d('0x22')]);_0x5793cc[_0x523d('0x21')]=qs[_0x523d('0x21')](_0x170e70['query'][_0x523d('0x21')]);_0x5793cc[_0x523d('0x3c')]=qs[_0x523d('0x3d')](_0x170e70['query'][_0x523d('0x3d')]);_0x5793cc[_0x523d('0x3e')]=qs['filters'](_[_0x523d('0x40')](_0x170e70[_0x523d('0x35')],_0x3b410f[_0x523d('0x3f')]));_0x5793cc=_[_0x523d('0x5b')]({},_0x5793cc,_0x170e70['options']);return _0x536eea[_0x523d('0x29')+_['capitalize'](_0x170e70['query'][_0x523d('0x56')]['toLowerCase']())+_0x523d('0x5c')](_0x5793cc);})[_0x523d('0x28')](respondWithResult(_0xf4e2bf,null))['catch'](handleError(_0xf4e2bf,null));};exports[_0x523d('0x5d')]=function(_0x214b00,_0x303019,_0xd1716){return db['Team'][_0x523d('0x5e')]({'where':{'id':_0x214b00['params']['id']}})[_0x523d('0x28')](function(_0x1f8d8b){if(_0x1f8d8b){if(!_0x214b00[_0x523d('0x4c')][_0x523d('0x56')]||!utils[_0x523d('0x55')](_0x214b00[_0x523d('0x4c')][_0x523d('0x56')])){throw new db[(_0x523d('0x5f'))][(_0x523d('0x57'))]('Unknown\x20channel');}return _0x1f8d8b['add'+_[_0x523d('0x60')](_0x214b00[_0x523d('0x4c')][_0x523d('0x56')][_0x523d('0x59')]())+_0x523d('0x5c')](_0x214b00['body'][_0x523d('0x61')]);}return null;})[_0x523d('0x28')](handleEntityNotFound(_0x303019,null))[_0x523d('0x28')](respondWithStatusCode(_0x303019,null))[_0x523d('0x48')](handleError(_0x303019,null));};exports[_0x523d('0x62')]=function(_0x15c67a,_0xbc1280,_0x2e9504){return db[_0x523d('0x31')][_0x523d('0x5e')]({'where':{'id':_0x15c67a[_0x523d('0x49')]['id']}})[_0x523d('0x28')](function(_0x45161d){if(_0x45161d){if(!_0x15c67a[_0x523d('0x35')][_0x523d('0x56')]||!utils[_0x523d('0x55')](_0x15c67a['query'][_0x523d('0x56')])){throw new db[(_0x523d('0x5f'))][(_0x523d('0x57'))](_0x523d('0x58'));}return _0x45161d[_0x523d('0x63')+_[_0x523d('0x60')](_0x15c67a['query'][_0x523d('0x56')]['toLowerCase']())+'Queues'](_0x15c67a[_0x523d('0x35')][_0x523d('0x61')]);}return null;})['then'](handleEntityNotFound(_0xbc1280,null))[_0x523d('0x28')](respondWithStatusCode(_0xbc1280,null))['catch'](handleError(_0xbc1280,null));};exports['addAgents']=function(_0x320c83,_0x58e149,_0x7aa5b7){return db[_0x523d('0x31')]['find']({'where':{'id':_0x320c83['params']['id']}})['then'](handleEntityNotFound(_0x58e149,null))['then'](function(_0x3ae3e7){if(_0x3ae3e7){var _0x38c2a5=[_0x523d('0x64'),_0x523d('0x65'),'Mail','Sms',_0x523d('0x66'),_0x523d('0x67'),'Whatsapp'];return BPromise['each'](_0x38c2a5,function(_0x173e13){return _0x3ae3e7[_0x523d('0x29')+_0x173e13+'Queues']({'attributes':['id',_0x523d('0x34')]})[_0x523d('0x28')](function(_0x3a26fe){return BPromise[_0x523d('0x68')](_0x3a26fe,function(_0x2d20be){return _0x2d20be['addAgents'](_0x320c83['body']['ids'])[_0x523d('0x28')](function(){if(_0x173e13===_0x523d('0x64')){return db[_0x523d('0x69')][_0x523d('0x47')]({'where':{'id':_0x320c83['body'][_0x523d('0x61')]},'attributes':['id',_0x523d('0x34'),_0x523d('0x6a'),'voicePause',_0x523d('0x6b')],'raw':!![]})[_0x523d('0x28')](function(_0x2aea8a){return BPromise[_0x523d('0x68')](_[_0x523d('0x41')](_0x2aea8a,{'online':0x1}),function(_0x40f32b){return db[_0x523d('0x6c')][_0x523d('0x6d')]({'membername':_0x40f32b['name'],'UserId':_0x40f32b['id'],'queue_name':_0x2d20be[_0x523d('0x34')],'VoiceQueueId':_0x2d20be['id'],'interface':_['isNil'](_0x40f32b[_0x523d('0x6b')])?util[_0x523d('0x6e')](_0x523d('0x6f'),_0x40f32b[_0x523d('0x34')]):_0x40f32b[_0x523d('0x6b')],'paused':_0x40f32b['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x3ae3e7;});})[_0x523d('0x28')](function(){return _0x3ae3e7;});}})[_0x523d('0x28')](function(_0x290d7b){if(_0x290d7b){return _0x290d7b[_0x523d('0x70')](_0x320c83[_0x523d('0x4c')]['ids'],_[_0x523d('0x71')](_0x320c83[_0x523d('0x4c')],[_0x523d('0x61'),'id'])||{})[_0x523d('0x72')](function(_0x5928c6){for(var _0x29d021=0x0;_0x29d021<_0x320c83['body'][_0x523d('0x61')][_0x523d('0x3a')];_0x29d021+=0x1){socket['emit'](_0x523d('0x73'),{'UserId':_0x320c83['body']['ids'][_0x29d021],'TeamId':_0x320c83[_0x523d('0x49')]['id']});}return _0x5928c6;});}})[_0x523d('0x28')](respondWithResult(_0x58e149,null))[_0x523d('0x48')](handleError(_0x58e149,null));};exports[_0x523d('0x74')]=function(_0x17467e,_0x2304fe,_0x568bb1){return db[_0x523d('0x31')][_0x523d('0x4b')]({'where':{'id':_0x17467e[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x2304fe,null))[_0x523d('0x28')](function(_0x652b59){if(_0x652b59){return BPromise[_0x523d('0x68')](['voice',_0x523d('0x75'),_0x523d('0x76'),_0x523d('0x77'),_0x523d('0x78'),'openchannel',_0x523d('0x79')],function(_0x59f137){return _0x652b59['get'+_[_0x523d('0x60')](_0x59f137)+_0x523d('0x5c')]({'attributes':['id',_0x523d('0x34')]})[_0x523d('0x28')](function(_0x2dcc8d){return BPromise['each'](_0x2dcc8d,function(_0x2467ad){return _0x2467ad['removeAgents'](_0x17467e['query'][_0x523d('0x61')])['then'](function(){if(_0x59f137==='voice'){return db[_0x523d('0x6c')][_0x523d('0x2b')]({'where':{'VoiceQueueId':_0x2467ad['id'],'UserId':_0x17467e[_0x523d('0x35')]['ids']}});}});});})[_0x523d('0x28')](function(){return _0x652b59;});})[_0x523d('0x28')](function(){return _0x652b59;});}})['then'](function(_0x46ccdb){if(_0x46ccdb){return _0x46ccdb[_0x523d('0x74')](_0x17467e['query'][_0x523d('0x61')])[_0x523d('0x28')](function(){if(_[_0x523d('0x7a')](_0x17467e['query'][_0x523d('0x61')])){for(var _0x2cf688=0x0;_0x2cf688<_0x17467e['query'][_0x523d('0x61')][_0x523d('0x3a')];_0x2cf688+=0x1){socket[_0x523d('0x7b')](_0x523d('0x7c'),{'UserId':Number(_0x17467e[_0x523d('0x35')][_0x523d('0x61')][_0x2cf688]),'TeamId':Number(_0x17467e[_0x523d('0x49')]['id'])});}}else{socket['emit'](_0x523d('0x7c'),{'UserId':Number(_0x17467e[_0x523d('0x35')][_0x523d('0x61')]),'TeamId':Number(_0x17467e[_0x523d('0x49')]['id'])});}});}})[_0x523d('0x28')](respondWithStatusCode(_0x2304fe,null))['catch'](handleError(_0x2304fe,null));};exports['getAgents']=function(_0x538287,_0x3a9432,_0x198049){var _0x5008cb={};var _0x36c390={};var _0xdf50b1;var _0x14b0f8;return db[_0x523d('0x31')]['findOne']({'where':{'id':_0x538287[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x3a9432,null))[_0x523d('0x28')](function(_0x15faee){if(_0x15faee){_0xdf50b1=_0x15faee;_0x36c390[_0x523d('0x37')]=_[_0x523d('0x4a')](db[_0x523d('0x69')]['rawAttributes']);_0x36c390[_0x523d('0x35')]=_[_0x523d('0x4a')](_0x538287[_0x523d('0x35')]);_0x36c390[_0x523d('0x3f')]=_[_0x523d('0x36')](_0x36c390[_0x523d('0x37')],_0x36c390[_0x523d('0x35')]);_0x5008cb[_0x523d('0x38')]=_['intersection'](_0x36c390[_0x523d('0x37')],qs[_0x523d('0x39')](_0x538287[_0x523d('0x35')][_0x523d('0x39')]));_0x5008cb[_0x523d('0x38')]=_0x5008cb[_0x523d('0x38')][_0x523d('0x3a')]?_0x5008cb['attributes']:_0x36c390[_0x523d('0x37')];_0x5008cb[_0x523d('0x3c')]=qs[_0x523d('0x3d')](_0x538287[_0x523d('0x35')]['sort']);_0x5008cb['where']=qs['filters'](_[_0x523d('0x40')](_0x538287[_0x523d('0x35')],_0x36c390[_0x523d('0x3f')]));if(_0x538287[_0x523d('0x35')][_0x523d('0x41')]){_0x5008cb[_0x523d('0x3e')]=_[_0x523d('0x5b')](_0x5008cb[_0x523d('0x3e')],{'$or':_['map'](_0x5008cb[_0x523d('0x38')],function(_0x1f9781){var _0x328d86={};_0x328d86[_0x1f9781]={'$like':'%'+_0x538287[_0x523d('0x35')]['filter']+'%'};return _0x328d86;})});}_0x5008cb=_[_0x523d('0x5b')]({},_0x5008cb,_0x538287[_0x523d('0x43')]);return _0xdf50b1[_0x523d('0x7d')](_0x5008cb);}})['then'](function(_0x4a06f3){if(_0x4a06f3){_0x14b0f8=_0x4a06f3[_0x523d('0x3a')];if(!_0x538287[_0x523d('0x35')][_0x523d('0x7e')](_0x523d('0x3b'))){_0x5008cb['limit']=qs['limit'](_0x538287['query']['limit']);_0x5008cb['offset']=qs[_0x523d('0x21')](_0x538287[_0x523d('0x35')][_0x523d('0x21')]);}return _0xdf50b1[_0x523d('0x7d')](_0x5008cb);}})[_0x523d('0x28')](function(_0x354a2e){if(_0x354a2e){return _0x354a2e?{'count':_0x14b0f8,'rows':_0x354a2e}:null;}})['then'](respondWithResult(_0x3a9432,null))['catch'](handleError(_0x3a9432,null));}; \ No newline at end of file +var _0x3d51=['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','../../mysqldb','defaults','redis','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','map','Team','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','autoAssociation','body','getQueues','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queues','addQueues','findOne','Unknown\x20channel','add','ids','removeQueues','addAgents','Voice','Sms','Openchannel','Whatsapp','each','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','emit','userTeam:save','removeAgents','voice','chat','sms','whatsapp','isArray','userTeam:remove','getAgents','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0x3d51,0xea));var _0x13d5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3d51[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x13d5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x13d5('0x1'));var zipdir=require(_0x13d5('0x2'));var jsonpatch=require(_0x13d5('0x3'));var rp=require(_0x13d5('0x4'));var moment=require(_0x13d5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x13d5('0x6'));var util=require(_0x13d5('0x7'));var path=require(_0x13d5('0x8'));var sox=require('sox');var csv=require(_0x13d5('0x9'));var ejs=require(_0x13d5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x13d5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x13d5('0xc'));var toCsv=require(_0x13d5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x13d5('0xd'));var authService=require(_0x13d5('0xe'));var qs=require(_0x13d5('0xf'));var as=require(_0x13d5('0x10'));var hardwareService=require(_0x13d5('0x11'));var logger=require(_0x13d5('0x12'))(_0x13d5('0x13'));var utils=require(_0x13d5('0x14'));var config=require(_0x13d5('0x15'));var licenseUtil=require(_0x13d5('0x16'));var db=require(_0x13d5('0x17'))['db'];config['redis']=_[_0x13d5('0x18')](config[_0x13d5('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x2c4822,_0x21e000){_0x21e000=_0x21e000||0xcc;return function(_0xa682f8){if(_0xa682f8){return _0x2c4822[_0x13d5('0x1a')](_0x21e000);}return _0x2c4822[_0x13d5('0x1b')](_0x21e000)['end']();};}function respondWithResult(_0x5e7838,_0xf0d3a7){_0xf0d3a7=_0xf0d3a7||0xc8;return function(_0x55f22c){if(_0x55f22c){return _0x5e7838[_0x13d5('0x1b')](_0xf0d3a7)[_0x13d5('0x1c')](_0x55f22c);}};}function respondWithFilteredResult(_0x41ab85,_0x4fdf26){return function(_0x1272c9){if(_0x1272c9){var _0x58d2ed=_0x1272c9[_0x13d5('0x1d')],_0x4bf9ec=_0x4fdf26[_0x13d5('0x1e')],_0x4bc2aa=_0x4fdf26[_0x13d5('0x1e')]+_0x4fdf26[_0x13d5('0x1f')],_0xe2a96c;if(_0x4bc2aa>=_0x58d2ed){_0x4bc2aa=_0x58d2ed;_0xe2a96c=0xc8;}else{_0xe2a96c=0xce;}_0x41ab85[_0x13d5('0x1b')](_0xe2a96c);return _0x41ab85[_0x13d5('0x20')](_0x13d5('0x21'),_0x4bf9ec+'-'+_0x4bc2aa+'/'+_0x58d2ed)[_0x13d5('0x1c')](_0x1272c9);}return null;};}function patchUpdates(_0x19f236){return function(_0x17d434){try{jsonpatch[_0x13d5('0x22')](_0x17d434,_0x19f236,!![]);}catch(_0x54c493){return BPromise['reject'](_0x54c493);}return _0x17d434[_0x13d5('0x23')]();};}function saveUpdates(_0x795a7,_0x2969ed){return function(_0x1ffe1a){if(_0x1ffe1a){return _0x1ffe1a[_0x13d5('0x24')](_0x795a7)[_0x13d5('0x25')](function(_0x2e04ce){return _0x2e04ce;});}return null;};}function removeEntity(_0x477d3d,_0x348465){return function(_0x5e089f){if(_0x5e089f){return _0x5e089f[_0x13d5('0x26')]()[_0x13d5('0x25')](function(){var _0x345781=_0x5e089f[_0x13d5('0x27')]({'plain':!![]});var _0x6af5f6='Teams';return db[_0x13d5('0x28')][_0x13d5('0x26')]({'where':{'type':_0x6af5f6,'resourceId':_0x345781['id']}})[_0x13d5('0x25')](function(){return _0x5e089f;});})[_0x13d5('0x25')](function(){_0x477d3d[_0x13d5('0x1b')](0xcc)[_0x13d5('0x29')]();});}};}function handleEntityNotFound(_0x5a1fcd,_0xf3aeac){return function(_0x2686db){if(!_0x2686db){_0x5a1fcd['sendStatus'](0x194);}return _0x2686db;};}function handleError(_0x430ea5,_0x3fd0a5){_0x3fd0a5=_0x3fd0a5||0x1f4;return function(_0x5ec35b){logger[_0x13d5('0x2a')](_0x5ec35b[_0x13d5('0x2b')]);if(_0x5ec35b[_0x13d5('0x2c')]){delete _0x5ec35b[_0x13d5('0x2c')];}_0x430ea5[_0x13d5('0x1b')](_0x3fd0a5)['send'](_0x5ec35b);};}exports['index']=function(_0x124b8a,_0x21c897){var _0x3559e6={},_0x55dcbf={},_0x3fb072={'count':0x0,'rows':[]};var _0x497870=_[_0x13d5('0x2d')](db[_0x13d5('0x2e')]['rawAttributes'],function(_0x53f4b6){return{'name':_0x53f4b6[_0x13d5('0x2f')],'type':_0x53f4b6[_0x13d5('0x30')][_0x13d5('0x31')]};});_0x55dcbf['model']=_['map'](_0x497870,_0x13d5('0x2c'));_0x55dcbf[_0x13d5('0x32')]=_[_0x13d5('0x33')](_0x124b8a['query']);_0x55dcbf[_0x13d5('0x34')]=_[_0x13d5('0x35')](_0x55dcbf[_0x13d5('0x36')],_0x55dcbf[_0x13d5('0x32')]);_0x3559e6[_0x13d5('0x37')]=_[_0x13d5('0x35')](_0x55dcbf[_0x13d5('0x36')],qs['fields'](_0x124b8a[_0x13d5('0x32')]['fields']));_0x3559e6['attributes']=_0x3559e6['attributes'][_0x13d5('0x38')]?_0x3559e6[_0x13d5('0x37')]:_0x55dcbf['model'];if(!_0x124b8a[_0x13d5('0x32')][_0x13d5('0x39')](_0x13d5('0x3a'))){_0x3559e6[_0x13d5('0x1f')]=qs[_0x13d5('0x1f')](_0x124b8a['query'][_0x13d5('0x1f')]);_0x3559e6[_0x13d5('0x1e')]=qs[_0x13d5('0x1e')](_0x124b8a['query'][_0x13d5('0x1e')]);}_0x3559e6[_0x13d5('0x3b')]=qs[_0x13d5('0x3c')](_0x124b8a[_0x13d5('0x32')][_0x13d5('0x3c')]);_0x3559e6['where']=qs['filters'](_[_0x13d5('0x3d')](_0x124b8a[_0x13d5('0x32')],_0x55dcbf[_0x13d5('0x34')]),_0x497870);if(_0x124b8a['query'][_0x13d5('0x3e')]){_0x3559e6['where']=_['merge'](_0x3559e6[_0x13d5('0x3f')],{'$or':_[_0x13d5('0x2d')](_0x497870,function(_0x3bd2e4){if(_0x3bd2e4[_0x13d5('0x30')]!==_0x13d5('0x40')){var _0x4a0f15={};_0x4a0f15[_0x3bd2e4[_0x13d5('0x2c')]]={'$like':'%'+_0x124b8a[_0x13d5('0x32')]['filter']+'%'};return _0x4a0f15;}})});}_0x3559e6=_[_0x13d5('0x41')]({},_0x3559e6,_0x124b8a[_0x13d5('0x42')]);var _0x44d439={'where':_0x3559e6['where']};return db[_0x13d5('0x2e')][_0x13d5('0x1d')](_0x44d439)[_0x13d5('0x25')](function(_0x3d0fc3){_0x3fb072[_0x13d5('0x1d')]=_0x3d0fc3;if(_0x124b8a[_0x13d5('0x32')][_0x13d5('0x43')]){_0x3559e6[_0x13d5('0x44')]=[{'all':!![]}];}return db['Team']['findAll'](_0x3559e6);})[_0x13d5('0x25')](function(_0x462031){_0x3fb072[_0x13d5('0x45')]=_0x462031;return _0x3fb072;})[_0x13d5('0x25')](respondWithFilteredResult(_0x21c897,_0x3559e6))['catch'](handleError(_0x21c897,null));};exports[_0x13d5('0x46')]=function(_0x341357,_0x5af50d){var _0x40dd88={'raw':![],'where':{'id':_0x341357[_0x13d5('0x47')]['id']}},_0x4d20c2={};_0x4d20c2[_0x13d5('0x36')]=_[_0x13d5('0x33')](db[_0x13d5('0x2e')][_0x13d5('0x48')]);_0x4d20c2['query']=_['keys'](_0x341357[_0x13d5('0x32')]);_0x4d20c2[_0x13d5('0x34')]=_[_0x13d5('0x35')](_0x4d20c2['model'],_0x4d20c2[_0x13d5('0x32')]);_0x40dd88[_0x13d5('0x37')]=_[_0x13d5('0x35')](_0x4d20c2[_0x13d5('0x36')],qs[_0x13d5('0x49')](_0x341357['query']['fields']));_0x40dd88['attributes']=_0x40dd88[_0x13d5('0x37')]['length']?_0x40dd88[_0x13d5('0x37')]:_0x4d20c2[_0x13d5('0x36')];if(_0x341357[_0x13d5('0x32')][_0x13d5('0x43')]){_0x40dd88[_0x13d5('0x44')]=[{'all':!![]}];}_0x40dd88=_[_0x13d5('0x41')]({},_0x40dd88,_0x341357[_0x13d5('0x42')]);return db[_0x13d5('0x2e')][_0x13d5('0x4a')](_0x40dd88)[_0x13d5('0x25')](handleEntityNotFound(_0x5af50d,null))['then'](respondWithResult(_0x5af50d,null))[_0x13d5('0x4b')](handleError(_0x5af50d,null));};exports[_0x13d5('0x4c')]=function(_0x457635,_0x4a266e){return db['Team'][_0x13d5('0x4c')](_0x457635['body'],{})[_0x13d5('0x25')](function(_0x3f8f55){var _0x2d9da3=_0x457635[_0x13d5('0x4d')][_0x13d5('0x27')]({'plain':!![]});if(!_0x2d9da3)throw new Error(_0x13d5('0x4e'));if(_0x2d9da3['role']===_0x13d5('0x4d')){var _0x3077ca=_0x3f8f55[_0x13d5('0x27')]({'plain':!![]});var _0x557aa6=_0x13d5('0x4f');return db['UserProfileSection'][_0x13d5('0x4a')]({'where':{'name':_0x557aa6,'userProfileId':_0x2d9da3['userProfileId']},'raw':!![]})[_0x13d5('0x25')](function(_0x2f9e19){if(_0x2f9e19&&_0x2f9e19[_0x13d5('0x50')]===0x0){return db[_0x13d5('0x28')][_0x13d5('0x4c')]({'name':_0x3077ca[_0x13d5('0x2c')],'resourceId':_0x3077ca['id'],'type':_0x2f9e19['name'],'sectionId':_0x2f9e19['id']},{})[_0x13d5('0x25')](function(){return _0x3f8f55;});}else{return _0x3f8f55;}})['catch'](function(_0xb166b){logger[_0x13d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb166b);throw _0xb166b;});}return _0x3f8f55;})[_0x13d5('0x25')](respondWithResult(_0x4a266e,0xc9))[_0x13d5('0x4b')](handleError(_0x4a266e,null));};exports[_0x13d5('0x24')]=function(_0x1e7f6c,_0x36626f){if(_0x1e7f6c[_0x13d5('0x51')]['id']){delete _0x1e7f6c['body']['id'];}return db['Team'][_0x13d5('0x4a')]({'where':{'id':_0x1e7f6c[_0x13d5('0x47')]['id']}})[_0x13d5('0x25')](handleEntityNotFound(_0x36626f,null))[_0x13d5('0x25')](saveUpdates(_0x1e7f6c['body'],null))[_0x13d5('0x25')](respondWithResult(_0x36626f,null))['catch'](handleError(_0x36626f,null));};exports['destroy']=function(_0x49a06d,_0x1789ff){return db[_0x13d5('0x2e')][_0x13d5('0x4a')]({'where':{'id':_0x49a06d[_0x13d5('0x47')]['id']}})[_0x13d5('0x25')](handleEntityNotFound(_0x1789ff,null))[_0x13d5('0x25')](removeEntity(_0x1789ff,null))[_0x13d5('0x4b')](handleError(_0x1789ff,null));};exports[_0x13d5('0x52')]=function(_0x463092,_0x2f5342,_0x3125d5){return db[_0x13d5('0x2e')]['findOne']({'where':{'id':_0x463092[_0x13d5('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f5342,null))[_0x13d5('0x25')](function(_0x207e76){if(!_0x463092['query'][_0x13d5('0x53')]||!utils[_0x13d5('0x54')](_0x463092['query']['channel'])){throw new db[(_0x13d5('0x55'))][(_0x13d5('0x56'))]('Unknown\x20channel');}var _0x59b63a={};var _0x55885f={};_0x55885f[_0x13d5('0x36')]=_[_0x13d5('0x33')](db[_[_0x13d5('0x57')](_0x463092[_0x13d5('0x32')][_0x13d5('0x53')][_0x13d5('0x58')]())+'Queue'][_0x13d5('0x48')]);_0x55885f['query']=_[_0x13d5('0x33')](_0x463092[_0x13d5('0x32')]);_0x55885f[_0x13d5('0x34')]=_['intersection'](_0x55885f[_0x13d5('0x36')],_0x55885f['query']);_0x59b63a[_0x13d5('0x37')]=_['intersection'](_0x55885f[_0x13d5('0x36')],qs[_0x13d5('0x49')](_0x463092[_0x13d5('0x32')][_0x13d5('0x49')]));_0x59b63a[_0x13d5('0x37')]=_0x59b63a[_0x13d5('0x37')][_0x13d5('0x38')]?_0x59b63a[_0x13d5('0x37')]:_0x55885f['model'];_0x59b63a[_0x13d5('0x1f')]=qs['limit'](_0x463092[_0x13d5('0x32')]['limit']);_0x59b63a[_0x13d5('0x1e')]=qs[_0x13d5('0x1e')](_0x463092[_0x13d5('0x32')][_0x13d5('0x1e')]);_0x59b63a[_0x13d5('0x3b')]=qs[_0x13d5('0x3c')](_0x463092[_0x13d5('0x32')][_0x13d5('0x3c')]);_0x59b63a['where']=qs['filters'](_[_0x13d5('0x3d')](_0x463092['query'],_0x55885f[_0x13d5('0x34')]));_0x59b63a=_[_0x13d5('0x41')]({},_0x59b63a,_0x463092[_0x13d5('0x42')]);return _0x207e76['get'+_[_0x13d5('0x57')](_0x463092[_0x13d5('0x32')][_0x13d5('0x53')][_0x13d5('0x58')]())+_0x13d5('0x59')](_0x59b63a);})['then'](respondWithResult(_0x2f5342,null))[_0x13d5('0x4b')](handleError(_0x2f5342,null));};exports[_0x13d5('0x5a')]=function(_0x165b1c,_0x3861a3,_0x3dfa2a){return db[_0x13d5('0x2e')][_0x13d5('0x5b')]({'where':{'id':_0x165b1c[_0x13d5('0x47')]['id']}})[_0x13d5('0x25')](function(_0x22d0ec){if(_0x22d0ec){if(!_0x165b1c[_0x13d5('0x51')][_0x13d5('0x53')]||!utils[_0x13d5('0x54')](_0x165b1c['body'][_0x13d5('0x53')])){throw new db[(_0x13d5('0x55'))][(_0x13d5('0x56'))](_0x13d5('0x5c'));}return _0x22d0ec[_0x13d5('0x5d')+_['capitalize'](_0x165b1c[_0x13d5('0x51')]['channel'][_0x13d5('0x58')]())+'Queues'](_0x165b1c[_0x13d5('0x51')][_0x13d5('0x5e')]);}return null;})[_0x13d5('0x25')](handleEntityNotFound(_0x3861a3,null))['then'](respondWithStatusCode(_0x3861a3,null))[_0x13d5('0x4b')](handleError(_0x3861a3,null));};exports[_0x13d5('0x5f')]=function(_0x3e82e8,_0x2e812e,_0x172639){return db[_0x13d5('0x2e')][_0x13d5('0x5b')]({'where':{'id':_0x3e82e8[_0x13d5('0x47')]['id']}})['then'](function(_0x20d6ff){if(_0x20d6ff){if(!_0x3e82e8[_0x13d5('0x32')]['channel']||!utils[_0x13d5('0x54')](_0x3e82e8['query'][_0x13d5('0x53')])){throw new db[(_0x13d5('0x55'))][(_0x13d5('0x56'))](_0x13d5('0x5c'));}return _0x20d6ff['remove'+_[_0x13d5('0x57')](_0x3e82e8[_0x13d5('0x32')][_0x13d5('0x53')][_0x13d5('0x58')]())+_0x13d5('0x59')](_0x3e82e8[_0x13d5('0x32')][_0x13d5('0x5e')]);}return null;})[_0x13d5('0x25')](handleEntityNotFound(_0x2e812e,null))[_0x13d5('0x25')](respondWithStatusCode(_0x2e812e,null))[_0x13d5('0x4b')](handleError(_0x2e812e,null));};exports[_0x13d5('0x60')]=function(_0xbe4d5c,_0x5f1a8a,_0x35fddf){return db['Team'][_0x13d5('0x4a')]({'where':{'id':_0xbe4d5c[_0x13d5('0x47')]['id']}})[_0x13d5('0x25')](handleEntityNotFound(_0x5f1a8a,null))[_0x13d5('0x25')](function(_0x2b7a97){if(_0x2b7a97){var _0x4423ec=[_0x13d5('0x61'),'Chat','Mail',_0x13d5('0x62'),'Fax',_0x13d5('0x63'),_0x13d5('0x64')];return BPromise[_0x13d5('0x65')](_0x4423ec,function(_0x5d04b9){return _0x2b7a97[_0x13d5('0x27')+_0x5d04b9+_0x13d5('0x59')]({'attributes':['id','name']})['then'](function(_0x5ef7e7){return BPromise[_0x13d5('0x65')](_0x5ef7e7,function(_0xa79c79){return _0xa79c79[_0x13d5('0x60')](_0xbe4d5c[_0x13d5('0x51')]['ids'])[_0x13d5('0x25')](function(){if(_0x5d04b9==='Voice'){return db['User'][_0x13d5('0x66')]({'where':{'id':_0xbe4d5c[_0x13d5('0x51')][_0x13d5('0x5e')]},'attributes':['id',_0x13d5('0x2c'),_0x13d5('0x67'),_0x13d5('0x68'),_0x13d5('0x69')],'raw':!![]})['then'](function(_0x2bf647){return BPromise[_0x13d5('0x65')](_['filter'](_0x2bf647,{'online':0x1}),function(_0x3f6325){return db[_0x13d5('0x6a')][_0x13d5('0x6b')]({'membername':_0x3f6325['name'],'UserId':_0x3f6325['id'],'queue_name':_0xa79c79[_0x13d5('0x2c')],'VoiceQueueId':_0xa79c79['id'],'interface':_[_0x13d5('0x6c')](_0x3f6325['interface'])?util[_0x13d5('0x6d')](_0x13d5('0x6e'),_0x3f6325[_0x13d5('0x2c')]):_0x3f6325[_0x13d5('0x69')],'paused':_0x3f6325[_0x13d5('0x68')]||![],'penalty':0x0});});});}});});})[_0x13d5('0x25')](function(){return _0x2b7a97;});})[_0x13d5('0x25')](function(){return _0x2b7a97;});}})[_0x13d5('0x25')](function(_0x3addc7){if(_0x3addc7){return _0x3addc7['addAgents'](_0xbe4d5c['body'][_0x13d5('0x5e')],_[_0x13d5('0x6f')](_0xbe4d5c['body'],[_0x13d5('0x5e'),'id'])||{})['spread'](function(_0x4927b5){for(var _0x1de790=0x0;_0x1de790<_0xbe4d5c[_0x13d5('0x51')]['ids'][_0x13d5('0x38')];_0x1de790+=0x1){socket[_0x13d5('0x70')](_0x13d5('0x71'),{'UserId':_0xbe4d5c[_0x13d5('0x51')]['ids'][_0x1de790],'TeamId':_0xbe4d5c[_0x13d5('0x47')]['id']});}return _0x4927b5;});}})[_0x13d5('0x25')](respondWithResult(_0x5f1a8a,null))[_0x13d5('0x4b')](handleError(_0x5f1a8a,null));};exports[_0x13d5('0x72')]=function(_0x404eae,_0x401671,_0x105a31){return db['Team'][_0x13d5('0x4a')]({'where':{'id':_0x404eae[_0x13d5('0x47')]['id']}})['then'](handleEntityNotFound(_0x401671,null))['then'](function(_0x4e9374){if(_0x4e9374){return BPromise[_0x13d5('0x65')]([_0x13d5('0x73'),_0x13d5('0x74'),'mail',_0x13d5('0x75'),'fax','openchannel',_0x13d5('0x76')],function(_0x5140e4){return _0x4e9374[_0x13d5('0x27')+_['capitalize'](_0x5140e4)+_0x13d5('0x59')]({'attributes':['id','name']})[_0x13d5('0x25')](function(_0x5c1623){return BPromise[_0x13d5('0x65')](_0x5c1623,function(_0x293a9b){return _0x293a9b[_0x13d5('0x72')](_0x404eae[_0x13d5('0x32')][_0x13d5('0x5e')])['then'](function(){if(_0x5140e4==='voice'){return db['UserVoiceQueueRt'][_0x13d5('0x26')]({'where':{'VoiceQueueId':_0x293a9b['id'],'UserId':_0x404eae[_0x13d5('0x32')][_0x13d5('0x5e')]}});}});});})[_0x13d5('0x25')](function(){return _0x4e9374;});})[_0x13d5('0x25')](function(){return _0x4e9374;});}})[_0x13d5('0x25')](function(_0x2623ff){if(_0x2623ff){return _0x2623ff['removeAgents'](_0x404eae['query']['ids'])[_0x13d5('0x25')](function(){if(_[_0x13d5('0x77')](_0x404eae[_0x13d5('0x32')][_0x13d5('0x5e')])){for(var _0x1a0a77=0x0;_0x1a0a77<_0x404eae[_0x13d5('0x32')][_0x13d5('0x5e')][_0x13d5('0x38')];_0x1a0a77+=0x1){socket[_0x13d5('0x70')]('userTeam:remove',{'UserId':Number(_0x404eae[_0x13d5('0x32')][_0x13d5('0x5e')][_0x1a0a77]),'TeamId':Number(_0x404eae[_0x13d5('0x47')]['id'])});}}else{socket[_0x13d5('0x70')](_0x13d5('0x78'),{'UserId':Number(_0x404eae[_0x13d5('0x32')]['ids']),'TeamId':Number(_0x404eae[_0x13d5('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x401671,null))[_0x13d5('0x4b')](handleError(_0x401671,null));};exports[_0x13d5('0x79')]=function(_0x103213,_0x26fe8c,_0x54bf26){var _0x51103c={};var _0x591219={};var _0x236a8a;var _0x7838bb;return db[_0x13d5('0x2e')][_0x13d5('0x5b')]({'where':{'id':_0x103213['params']['id']}})[_0x13d5('0x25')](handleEntityNotFound(_0x26fe8c,null))[_0x13d5('0x25')](function(_0xce3f39){if(_0xce3f39){_0x236a8a=_0xce3f39;_0x591219['model']=_[_0x13d5('0x33')](db[_0x13d5('0x7a')]['rawAttributes']);_0x591219[_0x13d5('0x32')]=_[_0x13d5('0x33')](_0x103213['query']);_0x591219[_0x13d5('0x34')]=_[_0x13d5('0x35')](_0x591219[_0x13d5('0x36')],_0x591219['query']);_0x51103c[_0x13d5('0x37')]=_['intersection'](_0x591219['model'],qs['fields'](_0x103213[_0x13d5('0x32')]['fields']));_0x51103c[_0x13d5('0x37')]=_0x51103c['attributes'][_0x13d5('0x38')]?_0x51103c[_0x13d5('0x37')]:_0x591219[_0x13d5('0x36')];_0x51103c[_0x13d5('0x3b')]=qs[_0x13d5('0x3c')](_0x103213[_0x13d5('0x32')]['sort']);_0x51103c[_0x13d5('0x3f')]=qs[_0x13d5('0x34')](_[_0x13d5('0x3d')](_0x103213['query'],_0x591219[_0x13d5('0x34')]));if(_0x103213[_0x13d5('0x32')][_0x13d5('0x3e')]){_0x51103c[_0x13d5('0x3f')]=_[_0x13d5('0x41')](_0x51103c[_0x13d5('0x3f')],{'$or':_[_0x13d5('0x2d')](_0x51103c[_0x13d5('0x37')],function(_0xb6c823){var _0x59ebdb={};_0x59ebdb[_0xb6c823]={'$like':'%'+_0x103213[_0x13d5('0x32')][_0x13d5('0x3e')]+'%'};return _0x59ebdb;})});}_0x51103c=_[_0x13d5('0x41')]({},_0x51103c,_0x103213[_0x13d5('0x42')]);return _0x236a8a['getAgents'](_0x51103c);}})[_0x13d5('0x25')](function(_0x5ad093){if(_0x5ad093){_0x7838bb=_0x5ad093[_0x13d5('0x38')];if(!_0x103213[_0x13d5('0x32')][_0x13d5('0x39')]('nolimit')){_0x51103c['limit']=qs['limit'](_0x103213[_0x13d5('0x32')]['limit']);_0x51103c[_0x13d5('0x1e')]=qs[_0x13d5('0x1e')](_0x103213[_0x13d5('0x32')][_0x13d5('0x1e')]);}return _0x236a8a[_0x13d5('0x79')](_0x51103c);}})['then'](function(_0x49f7bc){if(_0x49f7bc){return _0x49f7bc?{'count':_0x7838bb,'rows':_0x49f7bc}:null;}})[_0x13d5('0x25')](respondWithResult(_0x26fe8c,null))[_0x13d5('0x4b')](handleError(_0x26fe8c,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 455c1fa..dc95bfa 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 _0x6456=['hasOwnProperty','hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x6456,0x172));var _0x6645=function(_0x7a6e0,_0x35f1d3){_0x7a6e0=_0x7a6e0-0x0;var _0x2ef4a7=_0x6456[_0x7a6e0];return _0x2ef4a7;};'use strict';var EventEmitter=require(_0x6645('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x6645('0x1')](0x0);var events={'afterCreate':_0x6645('0x2'),'afterUpdate':_0x6645('0x3'),'afterDestroy':_0x6645('0x4')};function emitEvent(_0x14fe57){return function(_0x183eaf,_0x2f8a1c,_0x174008){TeamEvents[_0x6645('0x5')](_0x14fe57+':'+_0x183eaf['id'],_0x183eaf);TeamEvents[_0x6645('0x5')](_0x14fe57,_0x183eaf);_0x174008(null);};}for(var e in events){if(events[_0x6645('0x6')](e)){var event=events[e];Team[_0x6645('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x0e2b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x11e6c0,_0x320d27){var _0x4f4a00=function(_0x1e12e2){while(--_0x1e12e2){_0x11e6c0['push'](_0x11e6c0['shift']());}};_0x4f4a00(++_0x320d27);}(_0x0e2b,0xc2));var _0xb0e2=function(_0x50d422,_0x43d874){_0x50d422=_0x50d422-0x0;var _0x47d4f0=_0x0e2b[_0x50d422];return _0x47d4f0;};'use strict';var EventEmitter=require(_0xb0e2('0x0'));var Team=require(_0xb0e2('0x1'))['db'][_0xb0e2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb0e2('0x3')](0x0);var events={'afterCreate':_0xb0e2('0x4'),'afterUpdate':_0xb0e2('0x5'),'afterDestroy':_0xb0e2('0x6')};function emitEvent(_0x36fa27){return function(_0x542a18,_0x104d37,_0x1d5233){TeamEvents['emit'](_0x36fa27+':'+_0x542a18['id'],_0x542a18);TeamEvents[_0xb0e2('0x7')](_0x36fa27,_0x542a18);_0x1d5233(null);};}for(var e in events){if(events[_0xb0e2('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xb0e2('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 781f820..3c4049b 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 _0xf455=['define','Team','teams','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./team.attributes','exports'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0xf455,0x153));var _0x5f45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf455[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f45('0x0'));var util=require('util');var logger=require(_0x5f45('0x1'))(_0x5f45('0x2'));var moment=require('moment');var BPromise=require(_0x5f45('0x3'));var rp=require(_0x5f45('0x4'));var fs=require('fs');var path=require(_0x5f45('0x5'));var rimraf=require(_0x5f45('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f45('0x7'));module[_0x5f45('0x8')]=function(_0x4007c1,_0x48945c){return _0x4007c1[_0x5f45('0x9')](_0x5f45('0xa'),attributes,{'tableName':_0x5f45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10ce=['../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2e2a29,_0x108b6a){var _0x181a74=function(_0x396a3d){while(--_0x396a3d){_0x2e2a29['push'](_0x2e2a29['shift']());}};_0x181a74(++_0x108b6a);}(_0x10ce,0x186));var _0xe10c=function(_0x370e7c,_0x26c113){_0x370e7c=_0x370e7c-0x0;var _0x29fce1=_0x10ce[_0x370e7c];return _0x29fce1;};'use strict';var _=require(_0xe10c('0x0'));var util=require(_0xe10c('0x1'));var logger=require('../../config/logger')(_0xe10c('0x2'));var moment=require(_0xe10c('0x3'));var BPromise=require(_0xe10c('0x4'));var rp=require(_0xe10c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe10c('0x6'));var attributes=require(_0xe10c('0x7'));module[_0xe10c('0x8')]=function(_0x1cd3d7,_0x53bcca){return _0x1cd3d7[_0xe10c('0x9')](_0xe10c('0xa'),attributes,{'tableName':_0xe10c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d56d467..f5c9aee 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 _0x1bcb=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x1bcb,0x146));var _0xb1bc=function(_0x2ae8fe,_0x5aeef3){_0x2ae8fe=_0x2ae8fe-0x0;var _0x5a3b29=_0x1bcb[_0x2ae8fe];return _0x5a3b29;};'use strict';var _=require(_0xb1bc('0x0'));var util=require(_0xb1bc('0x1'));var moment=require(_0xb1bc('0x2'));var BPromise=require(_0xb1bc('0x3'));var rs=require(_0xb1bc('0x4'));var fs=require('fs');var Redis=require(_0xb1bc('0x5'));var db=require(_0xb1bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1bc('0x7'))(_0xb1bc('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1bc('0x9'));var client=jayson['client'][_0xb1bc('0xa')]({'port':0x232a});config[_0xb1bc('0xb')]=_[_0xb1bc('0xc')](config[_0xb1bc('0xb')],{'host':_0xb1bc('0xd'),'port':0x18eb});var socket=require(_0xb1bc('0xe'))(new Redis(config[_0xb1bc('0xb')]));require(_0xb1bc('0xf'))[_0xb1bc('0x10')](socket);function respondWithRpcPromise(_0x42c316,_0x1112f6,_0x29eac3){return new BPromise(function(_0x20e104,_0x10652d){return client[_0xb1bc('0x11')](_0x42c316,_0x29eac3)[_0xb1bc('0x12')](function(_0x5b262d){logger[_0xb1bc('0x13')]('Team,\x20%s,\x20%s',_0x1112f6,_0xb1bc('0x14'));logger[_0xb1bc('0x15')](_0xb1bc('0x16'),_0x1112f6,_0xb1bc('0x14'),JSON[_0xb1bc('0x17')](_0x5b262d));if(_0x5b262d['error']){if(_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x19')]===0x1f4){logger['error'](_0xb1bc('0x1a'),_0x1112f6,_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);return _0x10652d(_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);}logger['error'](_0xb1bc('0x1a'),_0x1112f6,_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);return _0x20e104(_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);}else{logger[_0xb1bc('0x13')](_0xb1bc('0x1a'),_0x1112f6,_0xb1bc('0x14'));_0x20e104(_0x5b262d['result']['message']);}})['catch'](function(_0x2ff85a){logger['error'](_0xb1bc('0x1a'),_0x1112f6,_0x2ff85a);_0x10652d(_0x2ff85a);});});} \ No newline at end of file +var _0x629e=['then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','./team.socket','register','request'];(function(_0x2dd3b8,_0x289de1){var _0x49e18e=function(_0x5816e1){while(--_0x5816e1){_0x2dd3b8['push'](_0x2dd3b8['shift']());}};_0x49e18e(++_0x289de1);}(_0x629e,0xc2));var _0xe629=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x629e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe629('0x0'));var moment=require(_0xe629('0x1'));var BPromise=require(_0xe629('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe629('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe629('0x4'))(_0xe629('0x5'));var config=require('../../config/environment');var jayson=require(_0xe629('0x6'));var client=jayson[_0xe629('0x7')]['http']({'port':0x232a});config[_0xe629('0x8')]=_[_0xe629('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe629('0xa'))[_0xe629('0xb')](socket);function respondWithRpcPromise(_0x225cfe,_0x57b5d1,_0x8bf27){return new BPromise(function(_0x5a8e7e,_0x42cd83){return client[_0xe629('0xc')](_0x225cfe,_0x8bf27)[_0xe629('0xd')](function(_0x2d8159){logger['info'](_0xe629('0xe'),_0x57b5d1,_0xe629('0xf'));logger[_0xe629('0x10')](_0xe629('0x11'),_0x57b5d1,_0xe629('0xf'),JSON[_0xe629('0x12')](_0x2d8159));if(_0x2d8159[_0xe629('0x13')]){if(_0x2d8159[_0xe629('0x13')]['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x57b5d1,_0x2d8159[_0xe629('0x13')]['message']);return _0x42cd83(_0x2d8159['error'][_0xe629('0x14')]);}logger['error'](_0xe629('0xe'),_0x57b5d1,_0x2d8159[_0xe629('0x13')][_0xe629('0x14')]);return _0x5a8e7e(_0x2d8159[_0xe629('0x13')][_0xe629('0x14')]);}else{logger[_0xe629('0x15')](_0xe629('0xe'),_0x57b5d1,_0xe629('0xf'));_0x5a8e7e(_0x2d8159[_0xe629('0x16')][_0xe629('0x14')]);}})['catch'](function(_0x29bc1c){logger[_0xe629('0x13')](_0xe629('0xe'),_0x57b5d1,_0x29bc1c);_0x42cd83(_0x29bc1c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a39cac8..a3853eb 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 _0xf562=['./team.events','save','remove','update','emit','removeListener','length','team:'];(function(_0x569b08,_0x3ea265){var _0xa1e05d=function(_0x467658){while(--_0x467658){_0x569b08['push'](_0x569b08['shift']());}};_0xa1e05d(++_0x3ea265);}(_0xf562,0x100));var _0x2f56=function(_0x12dc05,_0x55988f){_0x12dc05=_0x12dc05-0x0;var _0x4489cc=_0xf562[_0x12dc05];return _0x4489cc;};'use strict';var TeamEvents=require(_0x2f56('0x0'));var events=[_0x2f56('0x1'),_0x2f56('0x2'),_0x2f56('0x3')];function createListener(_0x2f77c6,_0x1f9134){return function(_0x2e6618){_0x1f9134[_0x2f56('0x4')](_0x2f77c6,_0x2e6618);};}function removeListener(_0x38a249,_0x55a78f){return function(){TeamEvents[_0x2f56('0x5')](_0x38a249,_0x55a78f);};}exports['register']=function(_0x14436b){for(var _0x5b3784=0x0,_0x1fd9d8=events[_0x2f56('0x6')];_0x5b3784<_0x1fd9d8;_0x5b3784++){var _0x25f51a=events[_0x5b3784];var _0x1add20=createListener(_0x2f56('0x7')+_0x25f51a,_0x14436b);TeamEvents['on'](_0x25f51a,_0x1add20);}}; \ No newline at end of file +var _0xd9ce=['update','emit','removeListener','register','./team.events','save','remove'];(function(_0x1a1131,_0x404e25){var _0x2a73ee=function(_0x18690f){while(--_0x18690f){_0x1a1131['push'](_0x1a1131['shift']());}};_0x2a73ee(++_0x404e25);}(_0xd9ce,0xeb));var _0xed9c=function(_0x2cf437,_0x5b0508){_0x2cf437=_0x2cf437-0x0;var _0x2f1fd2=_0xd9ce[_0x2cf437];return _0x2f1fd2;};'use strict';var TeamEvents=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(){TeamEvents[_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('team:'+_0x2ad757,_0x154e9d);TeamEvents['on'](_0x2ad757,_0xde32e4);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 857347f..8e6e1d7 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 _0xa02f=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy'];(function(_0x31db5f,_0x555bf0){var _0x10888e=function(_0x1ccd2f){while(--_0x1ccd2f){_0x31db5f['push'](_0x31db5f['shift']());}};_0x10888e(++_0x555bf0);}(_0xa02f,0x8d));var _0xfa02=function(_0x582d4c,_0x4a5361){_0x582d4c=_0x582d4c-0x0;var _0x3676d7=_0xa02f[_0x582d4c];return _0x3676d7;};'use strict';var multer=require(_0xfa02('0x0'));var util=require(_0xfa02('0x1'));var path=require('path');var timeout=require(_0xfa02('0x2'));var express=require(_0xfa02('0x3'));var router=express['Router']();var auth=require(_0xfa02('0x4'));var interaction=require(_0xfa02('0x5'));var config=require(_0xfa02('0x6'));var controller=require(_0xfa02('0x7'));router['get']('/',auth[_0xfa02('0x8')](),controller[_0xfa02('0x9')]);router[_0xfa02('0xa')]('/:id',auth[_0xfa02('0x8')](),controller[_0xfa02('0xb')]);router[_0xfa02('0xc')]('/',auth[_0xfa02('0x8')](),controller[_0xfa02('0xd')]);router[_0xfa02('0xe')](_0xfa02('0xf'),auth['isAuthenticated'](),controller[_0xfa02('0x10')]);router[_0xfa02('0x11')]('/:id',auth[_0xfa02('0x8')](),controller[_0xfa02('0x12')]);module[_0xfa02('0x13')]=router; \ No newline at end of file +var _0x14a4=['/:id','multer','util','path','express','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','create','put','update','delete'];(function(_0x2366ac,_0x227250){var _0x4ce391=function(_0x281438){while(--_0x281438){_0x2366ac['push'](_0x2366ac['shift']());}};_0x4ce391(++_0x227250);}(_0x14a4,0x155));var _0x414a=function(_0x5875c5,_0x14e0a5){_0x5875c5=_0x5875c5-0x0;var _0x193544=_0x14a4[_0x5875c5];return _0x193544;};'use strict';var multer=require(_0x414a('0x0'));var util=require(_0x414a('0x1'));var path=require(_0x414a('0x2'));var timeout=require('connect-timeout');var express=require(_0x414a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x414a('0x4'));var config=require(_0x414a('0x5'));var controller=require(_0x414a('0x6'));router[_0x414a('0x7')]('/',auth[_0x414a('0x8')](),controller[_0x414a('0x9')]);router[_0x414a('0x7')]('/:id',auth[_0x414a('0x8')](),controller[_0x414a('0xa')]);router[_0x414a('0xb')]('/',auth['isAuthenticated'](),controller[_0x414a('0xc')]);router[_0x414a('0xd')]('/:id',auth[_0x414a('0x8')](),controller[_0x414a('0xe')]);router[_0x414a('0xf')](_0x414a('0x10'),auth[_0x414a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ac4c583..b1ccca2 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 _0xa4db=['sequelize','exports','STRING','TEXT'];(function(_0x5576ca,_0x3b6f29){var _0x384933=function(_0x50e46d){while(--_0x50e46d){_0x5576ca['push'](_0x5576ca['shift']());}};_0x384933(++_0x3b6f29);}(_0xa4db,0xd4));var _0xba4d=function(_0x2f949c,_0x12b42d){_0x2f949c=_0x2f949c-0x0;var _0x665c7f=_0xa4db[_0x2f949c];return _0x665c7f;};'use strict';var Sequelize=require(_0xba4d('0x0'));module[_0xba4d('0x1')]={'name':{'type':Sequelize[_0xba4d('0x2')]},'description':{'type':Sequelize[_0xba4d('0x2')]},'html':{'type':Sequelize[_0xba4d('0x3')]}}; \ No newline at end of file +var _0xf681=['exports','STRING','TEXT','sequelize'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xf681,0x19b));var _0x1f68=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf681[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x1f68('0x0'));module[_0x1f68('0x1')]={'name':{'type':Sequelize[_0x1f68('0x2')]},'description':{'type':Sequelize[_0x1f68('0x2')]},'html':{'type':Sequelize[_0x1f68('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c50584b..22166b0 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 _0xc4aa=['send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','filter','options','Template','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name'];(function(_0x31b8c9,_0x39c14d){var _0x5805e6=function(_0x3cb619){while(--_0x3cb619){_0x31b8c9['push'](_0x31b8c9['shift']());}};_0x5805e6(++_0x39c14d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=_0x26dbb8[_0xac4a('0x1b')],_0x402fff=_0x11e101[_0xac4a('0x1c')],_0x34d797=_0x11e101[_0xac4a('0x1c')]+_0x11e101[_0xac4a('0x1d')],_0x23eb66;if(_0x34d797>=_0x4a2119){_0x34d797=_0x4a2119;_0x23eb66=0xc8;}else{_0x23eb66=0xce;}_0x42c7fc[_0xac4a('0x18')](_0x23eb66);return _0x42c7fc['set']('Content-Range',_0x402fff+'-'+_0x34d797+'/'+_0x4a2119)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x13c8eb){return function(_0x39b691){try{jsonpatch['apply'](_0x39b691,_0x13c8eb,!![]);}catch(_0x39e83e){return BPromise[_0xac4a('0x1e')](_0x39e83e);}return _0x39b691[_0xac4a('0x1f')]();};}function saveUpdates(_0x3a3cdb,_0x123694){return function(_0x3e829c){if(_0x3e829c){return _0x3e829c[_0xac4a('0x20')](_0x3a3cdb)[_0xac4a('0x21')](function(_0x534092){return _0x534092;});}return null;};}function removeEntity(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x22')]()[_0xac4a('0x21')](function(){var _0x3eacd3=_0x599787[_0xac4a('0x23')]({'plain':!![]});var _0x4d2d6c=_0xac4a('0x24');return db[_0xac4a('0x25')][_0xac4a('0x22')]({'where':{'type':_0x4d2d6c,'resourceId':_0x3eacd3['id']}})[_0xac4a('0x21')](function(){return _0x599787;});})[_0xac4a('0x21')](function(){_0x3d8f0a[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x36054a,_0x3e2c69){return function(_0x3bc318){if(!_0x3bc318){_0x36054a[_0xac4a('0x17')](0x194);}return _0x3bc318;};}function handleError(_0x215a31,_0x14832b){_0x14832b=_0x14832b||0x1f4;return function(_0x472c57){logger[_0xac4a('0x26')](_0x472c57[_0xac4a('0x27')]);if(_0x472c57['name']){delete _0x472c57[_0xac4a('0x28')];}_0x215a31[_0xac4a('0x18')](_0x14832b)[_0xac4a('0x29')](_0x472c57);};}exports[_0xac4a('0x2a')]=function(_0x116700,_0x4a5a9e){var _0x47f49c={},_0xdb7e={},_0x7a948b={'count':0x0,'rows':[]};var _0x1f12d5=_['map'](db['Template'][_0xac4a('0x2b')],function(_0x2896bc){return{'name':_0x2896bc[_0xac4a('0x2c')],'type':_0x2896bc[_0xac4a('0x2d')][_0xac4a('0x2e')]};});_0xdb7e['model']=_[_0xac4a('0x2f')](_0x1f12d5,'name');_0xdb7e[_0xac4a('0x30')]=_['keys'](_0x116700[_0xac4a('0x30')]);_0xdb7e[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0xdb7e[_0xac4a('0x33')],_0xdb7e[_0xac4a('0x30')]);_0x47f49c[_0xac4a('0x34')]=_[_0xac4a('0x32')](_0xdb7e[_0xac4a('0x33')],qs[_0xac4a('0x35')](_0x116700[_0xac4a('0x30')][_0xac4a('0x35')]));_0x47f49c[_0xac4a('0x34')]=_0x47f49c[_0xac4a('0x34')][_0xac4a('0x36')]?_0x47f49c['attributes']:_0xdb7e[_0xac4a('0x33')];if(!_0x116700[_0xac4a('0x30')]['hasOwnProperty'](_0xac4a('0x37'))){_0x47f49c[_0xac4a('0x1d')]=qs['limit'](_0x116700['query'][_0xac4a('0x1d')]);_0x47f49c[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x116700[_0xac4a('0x30')]['offset']);}_0x47f49c[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x116700['query'][_0xac4a('0x39')]);_0x47f49c[_0xac4a('0x3a')]=qs[_0xac4a('0x31')](_['pick'](_0x116700[_0xac4a('0x30')],_0xdb7e[_0xac4a('0x31')]),_0x1f12d5);if(_0x116700[_0xac4a('0x30')]['filter']){_0x47f49c[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x47f49c['where'],{'$or':_['map'](_0x1f12d5,function(_0x4319a1){if(_0x4319a1['type']!=='VIRTUAL'){var _0x5f0af0={};_0x5f0af0[_0x4319a1['name']]={'$like':'%'+_0x116700[_0xac4a('0x30')][_0xac4a('0x3c')]+'%'};return _0x5f0af0;}})});}_0x47f49c=_[_0xac4a('0x3b')]({},_0x47f49c,_0x116700[_0xac4a('0x3d')]);var _0x2bdb21={'where':_0x47f49c[_0xac4a('0x3a')]};return db[_0xac4a('0x3e')][_0xac4a('0x1b')](_0x2bdb21)[_0xac4a('0x21')](function(_0x1f7721){_0x7a948b[_0xac4a('0x1b')]=_0x1f7721;if(_0x116700[_0xac4a('0x30')]['includeAll']){_0x47f49c['include']=[{'all':!![]}];}return db['Template'][_0xac4a('0x3f')](_0x47f49c);})[_0xac4a('0x21')](function(_0x14e80b){_0x7a948b[_0xac4a('0x40')]=_0x14e80b;return _0x7a948b;})[_0xac4a('0x21')](respondWithFilteredResult(_0x4a5a9e,_0x47f49c))[_0xac4a('0x41')](handleError(_0x4a5a9e,null));};exports[_0xac4a('0x42')]=function(_0x3441f2,_0x3e9973){var _0x3edb19={'raw':!![],'where':{'id':_0x3441f2[_0xac4a('0x43')]['id']}},_0x561cb7={};_0x561cb7[_0xac4a('0x33')]=_[_0xac4a('0x44')](db[_0xac4a('0x3e')][_0xac4a('0x2b')]);_0x561cb7['query']=_[_0xac4a('0x44')](_0x3441f2[_0xac4a('0x30')]);_0x561cb7['filters']=_[_0xac4a('0x32')](_0x561cb7['model'],_0x561cb7[_0xac4a('0x30')]);_0x3edb19[_0xac4a('0x34')]=_[_0xac4a('0x32')](_0x561cb7[_0xac4a('0x33')],qs[_0xac4a('0x35')](_0x3441f2[_0xac4a('0x30')][_0xac4a('0x35')]));_0x3edb19[_0xac4a('0x34')]=_0x3edb19[_0xac4a('0x34')][_0xac4a('0x36')]?_0x3edb19[_0xac4a('0x34')]:_0x561cb7[_0xac4a('0x33')];if(_0x3441f2['query'][_0xac4a('0x45')]){_0x3edb19[_0xac4a('0x46')]=[{'all':!![]}];}_0x3edb19=_[_0xac4a('0x3b')]({},_0x3edb19,_0x3441f2['options']);return db[_0xac4a('0x3e')][_0xac4a('0x47')](_0x3edb19)['then'](handleEntityNotFound(_0x3e9973,null))[_0xac4a('0x21')](respondWithResult(_0x3e9973,null))['catch'](handleError(_0x3e9973,null));};exports[_0xac4a('0x48')]=function(_0xe620f6,_0x136a65){return db['Template']['create'](_0xe620f6[_0xac4a('0x49')],{})['then'](function(_0x18ae96){var _0x566258=_0xe620f6[_0xac4a('0x4a')]['get']({'plain':!![]});if(!_0x566258)throw new Error(_0xac4a('0x4b'));if(_0x566258[_0xac4a('0x4c')]===_0xac4a('0x4a')){var _0x1c8c39=_0x18ae96['get']({'plain':!![]});var _0x31c794=_0xac4a('0x24');return db[_0xac4a('0x4d')][_0xac4a('0x47')]({'where':{'name':_0x31c794,'userProfileId':_0x566258[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x21')](function(_0x187306){if(_0x187306&&_0x187306['autoAssociation']===0x0){return db[_0xac4a('0x25')][_0xac4a('0x48')]({'name':_0x1c8c39['name'],'resourceId':_0x1c8c39['id'],'type':_0x187306[_0xac4a('0x28')],'sectionId':_0x187306['id']},{})[_0xac4a('0x21')](function(){return _0x18ae96;});}else{return _0x18ae96;}})[_0xac4a('0x41')](function(_0x3ac36e){logger['error'](_0xac4a('0x4f'),_0x3ac36e);throw _0x3ac36e;});}return _0x18ae96;})[_0xac4a('0x21')](respondWithResult(_0x136a65,0xc9))[_0xac4a('0x41')](handleError(_0x136a65,null));};exports[_0xac4a('0x20')]=function(_0x890910,_0x49fbc3){if(_0x890910[_0xac4a('0x49')]['id']){delete _0x890910['body']['id'];}return db[_0xac4a('0x3e')][_0xac4a('0x47')]({'where':{'id':_0x890910['params']['id']}})['then'](handleEntityNotFound(_0x49fbc3,null))[_0xac4a('0x21')](saveUpdates(_0x890910[_0xac4a('0x49')],null))['then'](respondWithResult(_0x49fbc3,null))[_0xac4a('0x41')](handleError(_0x49fbc3,null));};exports[_0xac4a('0x22')]=function(_0x26b582,_0x103d05){return db['Template'][_0xac4a('0x47')]({'where':{'id':_0x26b582[_0xac4a('0x43')]['id']}})[_0xac4a('0x21')](handleEntityNotFound(_0x103d05,null))[_0xac4a('0x21')](removeEntity(_0x103d05,null))[_0xac4a('0x41')](handleError(_0x103d05,null));}; \ No newline at end of file +var _0xe14b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','get','Templates','then','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0xe14b,0x93));var _0xbe14=function(_0x5d7c70,_0x443b58){_0x5d7c70=_0x5d7c70-0x0;var _0x449d2b=_0xe14b[_0x5d7c70];return _0x449d2b;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){var _0x274018=_0x56e80c[_0xbe14('0x22')]({'plain':!![]});var _0x505dbd=_0xbe14('0x23');return db['UserProfileResource'][_0xbe14('0x21')]({'where':{'type':_0x505dbd,'resourceId':_0x274018['id']}})['then'](function(){return _0x56e80c;});})[_0xbe14('0x24')](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(!_0x2703f5){_0x39cc81['sendStatus'](0x194);}return _0x2703f5;};}function handleError(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0x1f4;return function(_0x391556){logger[_0xbe14('0x25')](_0x391556['stack']);if(_0x391556[_0xbe14('0x26')]){delete _0x391556[_0xbe14('0x26')];}_0x1822e0['status'](_0x1ba46a)[_0xbe14('0x27')](_0x391556);};}exports[_0xbe14('0x28')]=function(_0x1c7cc7,_0x19252f){var _0x34d648={},_0x36d4b2={},_0x31a664={'count':0x0,'rows':[]};var _0x2b05cb=_[_0xbe14('0x29')](db[_0xbe14('0x2a')][_0xbe14('0x2b')],function(_0x3bf43c){return{'name':_0x3bf43c[_0xbe14('0x2c')],'type':_0x3bf43c[_0xbe14('0x2d')][_0xbe14('0x2e')]};});_0x36d4b2[_0xbe14('0x2f')]=_[_0xbe14('0x29')](_0x2b05cb,_0xbe14('0x26'));_0x36d4b2[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x1c7cc7['query']);_0x36d4b2[_0xbe14('0x32')]=_['intersection'](_0x36d4b2['model'],_0x36d4b2[_0xbe14('0x30')]);_0x34d648['attributes']=_[_0xbe14('0x33')](_0x36d4b2[_0xbe14('0x2f')],qs['fields'](_0x1c7cc7['query']['fields']));_0x34d648[_0xbe14('0x34')]=_0x34d648[_0xbe14('0x34')]['length']?_0x34d648[_0xbe14('0x34')]:_0x36d4b2[_0xbe14('0x2f')];if(!_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x34d648['limit']=qs['limit'](_0x1c7cc7[_0xbe14('0x30')]['limit']);_0x34d648['offset']=qs['offset'](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x1a')]);}_0x34d648[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x38')]);_0x34d648[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x1c7cc7[_0xbe14('0x30')],_0x36d4b2[_0xbe14('0x32')]),_0x2b05cb);if(_0x1c7cc7[_0xbe14('0x30')]['filter']){_0x34d648['where']=_[_0xbe14('0x3b')](_0x34d648[_0xbe14('0x39')],{'$or':_[_0xbe14('0x29')](_0x2b05cb,function(_0x520e09){if(_0x520e09[_0xbe14('0x2d')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x26')]]={'$like':'%'+_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x34d648=_[_0xbe14('0x3b')]({},_0x34d648,_0x1c7cc7[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x34d648['where']};return db[_0xbe14('0x2a')][_0xbe14('0x19')](_0x1b2608)[_0xbe14('0x24')](function(_0x1b3118){_0x31a664[_0xbe14('0x19')]=_0x1b3118;if(_0x1c7cc7[_0xbe14('0x30')]['includeAll']){_0x34d648[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2a')][_0xbe14('0x40')](_0x34d648);})[_0xbe14('0x24')](function(_0x5cf713){_0x31a664['rows']=_0x5cf713;return _0x31a664;})[_0xbe14('0x24')](respondWithFilteredResult(_0x19252f,_0x34d648))[_0xbe14('0x41')](handleError(_0x19252f,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':!![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2f')]=_[_0xbe14('0x31')](db[_0xbe14('0x2a')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2f')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['Template'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x24')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['Template']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x24')](function(_0x4a1a37){var _0x5acf90=_0x2d6ee8[_0xbe14('0x49')][_0xbe14('0x22')]({'plain':!![]});if(!_0x5acf90)throw new Error(_0xbe14('0x4a'));if(_0x5acf90[_0xbe14('0x4b')]===_0xbe14('0x49')){var _0xd04fd5=_0x4a1a37[_0xbe14('0x22')]({'plain':!![]});var _0x5a4068=_0xbe14('0x23');return db[_0xbe14('0x4c')][_0xbe14('0x46')]({'where':{'name':_0x5a4068,'userProfileId':_0x5acf90[_0xbe14('0x4d')]},'raw':!![]})[_0xbe14('0x24')](function(_0x494c32){if(_0x494c32&&_0x494c32[_0xbe14('0x4e')]===0x0){return db[_0xbe14('0x4f')][_0xbe14('0x47')]({'name':_0xd04fd5[_0xbe14('0x26')],'resourceId':_0xd04fd5['id'],'type':_0x494c32[_0xbe14('0x26')],'sectionId':_0x494c32['id']},{})[_0xbe14('0x24')](function(){return _0x4a1a37;});}else{return _0x4a1a37;}})['catch'](function(_0x5aeea9){logger[_0xbe14('0x25')](_0xbe14('0x50'),_0x5aeea9);throw _0x5aeea9;});}return _0x4a1a37;})[_0xbe14('0x24')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0x44fe0d,_0x134878){if(_0x44fe0d['body']['id']){delete _0x44fe0d[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x2a')]['find']({'where':{'id':_0x44fe0d[_0xbe14('0x51')]['id']}})['then'](handleEntityNotFound(_0x134878,null))[_0xbe14('0x24')](saveUpdates(_0x44fe0d[_0xbe14('0x48')],null))[_0xbe14('0x24')](respondWithResult(_0x134878,null))['catch'](handleError(_0x134878,null));};exports[_0xbe14('0x21')]=function(_0x404212,_0x5dc78a){return db[_0xbe14('0x2a')][_0xbe14('0x46')]({'where':{'id':_0x404212[_0xbe14('0x51')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x5dc78a,null))[_0xbe14('0x24')](removeEntity(_0x5dc78a,null))['catch'](handleError(_0x5dc78a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 36115d0..941ec4e 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 _0x4046=['./template.attributes','exports','define','Template','tools_templates','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x244c65,_0x104d0a){var _0x33029e=function(_0x297f2a){while(--_0x297f2a){_0x244c65['push'](_0x244c65['shift']());}};_0x33029e(++_0x104d0a);}(_0x4046,0x102));var _0x6404=function(_0x44738f,_0x29dea7){_0x44738f=_0x44738f-0x0;var _0x1e3ca8=_0x4046[_0x44738f];return _0x1e3ca8;};'use strict';var _=require('lodash');var util=require(_0x6404('0x0'));var logger=require(_0x6404('0x1'))(_0x6404('0x2'));var moment=require(_0x6404('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6404('0x4'));var config=require(_0x6404('0x5'));var attributes=require(_0x6404('0x6'));module[_0x6404('0x7')]=function(_0x4fccef,_0x5480ca){return _0x4fccef[_0x6404('0x8')](_0x6404('0x9'),attributes,{'tableName':_0x6404('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa897=['tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xa897,0x160));var _0x7a89=function(_0x30a946,_0x376279){_0x30a946=_0x30a946-0x0;var _0x12935a=_0xa897[_0x30a946];return _0x12935a;};'use strict';var _=require(_0x7a89('0x0'));var util=require('util');var logger=require(_0x7a89('0x1'))(_0x7a89('0x2'));var moment=require(_0x7a89('0x3'));var BPromise=require(_0x7a89('0x4'));var rp=require(_0x7a89('0x5'));var fs=require('fs');var path=require(_0x7a89('0x6'));var rimraf=require(_0x7a89('0x7'));var config=require(_0x7a89('0x8'));var attributes=require(_0x7a89('0x9'));module['exports']=function(_0x3dc746,_0x3a86f4){return _0x3dc746[_0x7a89('0xa')](_0x7a89('0xb'),attributes,{'tableName':_0x7a89('0xc'),'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 fb8c44d..5398b70 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 _0x5bd4=['debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','info','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x5bd4,0x77));var _0x45bd=function(_0x1f480c,_0x4ce48e){_0x1f480c=_0x1f480c-0x0;var _0x357483=_0x5bd4[_0x1f480c];return _0x357483;};'use strict';var _=require(_0x45bd('0x0'));var util=require('util');var moment=require(_0x45bd('0x1'));var BPromise=require(_0x45bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45bd('0x3'));var db=require(_0x45bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45bd('0x5'))(_0x45bd('0x6'));var config=require('../../config/environment');var jayson=require(_0x45bd('0x7'));var client=jayson[_0x45bd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bf123,_0x10e3e2,_0x35152e){return new BPromise(function(_0x40569a,_0x330637){return client[_0x45bd('0x9')](_0x2bf123,_0x35152e)[_0x45bd('0xa')](function(_0x135910){logger['info'](_0x45bd('0xb'),_0x10e3e2,_0x45bd('0xc'));logger[_0x45bd('0xd')](_0x45bd('0xe'),_0x10e3e2,_0x45bd('0xc'),JSON[_0x45bd('0xf')](_0x135910));if(_0x135910[_0x45bd('0x10')]){if(_0x135910[_0x45bd('0x10')][_0x45bd('0x11')]===0x1f4){logger[_0x45bd('0x10')](_0x45bd('0xb'),_0x10e3e2,_0x135910[_0x45bd('0x10')]['message']);return _0x330637(_0x135910[_0x45bd('0x10')][_0x45bd('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0x10e3e2,_0x135910['error'][_0x45bd('0x12')]);return _0x40569a(_0x135910[_0x45bd('0x10')][_0x45bd('0x12')]);}else{logger['info'](_0x45bd('0xb'),_0x10e3e2,'request\x20sent');_0x40569a(_0x135910[_0x45bd('0x13')][_0x45bd('0x12')]);}})[_0x45bd('0x14')](function(_0x4311bb){logger[_0x45bd('0x10')](_0x45bd('0xb'),_0x10e3e2,_0x4311bb);_0x330637(_0x4311bb);});});}exports[_0x45bd('0x15')]=function(_0xe96bad){var _0x256f03=this;return new Promise(function(_0x398b22,_0x487d1f){return db[_0x45bd('0x16')][_0x45bd('0x17')]({'raw':_0xe96bad[_0x45bd('0x18')]?_0xe96bad['options'][_0x45bd('0x19')]===undefined?!![]:![]:!![],'where':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1a')]||null:null,'attributes':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1b')]||null:null,'limit':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1c')]||null:null,'include':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1d')]?_[_0x45bd('0x1e')](_0xe96bad['options'][_0x45bd('0x1d')],function(_0x3f8949){return{'model':db[_0x3f8949[_0x45bd('0x1f')]],'as':_0x3f8949['as'],'attributes':_0x3f8949[_0x45bd('0x1b')],'include':_0x3f8949[_0x45bd('0x1d')]?_['map'](_0x3f8949[_0x45bd('0x1d')],function(_0x30f4b1){return{'model':db[_0x30f4b1['model']],'as':_0x30f4b1['as'],'attributes':_0x30f4b1[_0x45bd('0x1b')],'include':_0x30f4b1[_0x45bd('0x1d')]?_['map'](_0x30f4b1[_0x45bd('0x1d')],function(_0x2bc100){return{'model':db[_0x2bc100[_0x45bd('0x1f')]],'as':_0x2bc100['as'],'attributes':_0x2bc100[_0x45bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x45bd('0xa')](function(_0x41ec97){logger[_0x45bd('0x20')](_0x45bd('0x15'),_0xe96bad);logger[_0x45bd('0xd')](_0x45bd('0x15'),_0xe96bad,JSON[_0x45bd('0xf')](_0x41ec97));_0x398b22(_0x41ec97);})['catch'](function(_0x440575){logger['error'](_0x45bd('0x15'),_0x440575[_0x45bd('0x12')],_0xe96bad);_0x487d1f(_0x256f03[_0x45bd('0x10')](0x1f4,_0x440575['message']));});});}; \ No newline at end of file +var _0xe224=['include','attributes','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','limit'];(function(_0x9afe43,_0x472d6c){var _0x17b3b2=function(_0x21404e){while(--_0x21404e){_0x9afe43['push'](_0x9afe43['shift']());}};_0x17b3b2(++_0x472d6c);}(_0xe224,0x159));var _0x4e22=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe224[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4e22('0x0'));var util=require(_0x4e22('0x1'));var moment=require(_0x4e22('0x2'));var BPromise=require(_0x4e22('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e22('0x4'));var db=require(_0x4e22('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e22('0x6'))(_0x4e22('0x7'));var config=require('../../config/environment');var jayson=require(_0x4e22('0x8'));var client=jayson[_0x4e22('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x157b0c,_0x3cd0e2,_0x478cd3){return new BPromise(function(_0x2f0993,_0x1a2f59){return client[_0x4e22('0xa')](_0x157b0c,_0x478cd3)[_0x4e22('0xb')](function(_0x481eeb){logger[_0x4e22('0xc')](_0x4e22('0xd'),_0x3cd0e2,_0x4e22('0xe'));logger['debug'](_0x4e22('0xf'),_0x3cd0e2,_0x4e22('0xe'),JSON[_0x4e22('0x10')](_0x481eeb));if(_0x481eeb[_0x4e22('0x11')]){if(_0x481eeb['error'][_0x4e22('0x12')]===0x1f4){logger[_0x4e22('0x11')](_0x4e22('0xd'),_0x3cd0e2,_0x481eeb[_0x4e22('0x11')][_0x4e22('0x13')]);return _0x1a2f59(_0x481eeb[_0x4e22('0x11')]['message']);}logger[_0x4e22('0x11')](_0x4e22('0xd'),_0x3cd0e2,_0x481eeb[_0x4e22('0x11')][_0x4e22('0x13')]);return _0x2f0993(_0x481eeb[_0x4e22('0x11')][_0x4e22('0x13')]);}else{logger[_0x4e22('0xc')](_0x4e22('0xd'),_0x3cd0e2,_0x4e22('0xe'));_0x2f0993(_0x481eeb[_0x4e22('0x14')][_0x4e22('0x13')]);}})[_0x4e22('0x15')](function(_0x1ffc3b){logger[_0x4e22('0x11')](_0x4e22('0xd'),_0x3cd0e2,_0x1ffc3b);_0x1a2f59(_0x1ffc3b);});});}exports[_0x4e22('0x16')]=function(_0x3e6345){var _0x515476=this;return new Promise(function(_0x11969c,_0x522610){return db[_0x4e22('0x17')]['findAll']({'raw':_0x3e6345[_0x4e22('0x18')]?_0x3e6345[_0x4e22('0x18')][_0x4e22('0x19')]===undefined?!![]:![]:!![],'where':_0x3e6345['options']?_0x3e6345[_0x4e22('0x18')]['where']||null:null,'attributes':_0x3e6345[_0x4e22('0x18')]?_0x3e6345['options']['attributes']||null:null,'limit':_0x3e6345[_0x4e22('0x18')]?_0x3e6345[_0x4e22('0x18')][_0x4e22('0x1a')]||null:null,'include':_0x3e6345['options']?_0x3e6345[_0x4e22('0x18')][_0x4e22('0x1b')]?_['map'](_0x3e6345[_0x4e22('0x18')]['include'],function(_0x455064){return{'model':db[_0x455064['model']],'as':_0x455064['as'],'attributes':_0x455064[_0x4e22('0x1c')],'include':_0x455064[_0x4e22('0x1b')]?_[_0x4e22('0x1d')](_0x455064[_0x4e22('0x1b')],function(_0x3520fe){return{'model':db[_0x3520fe[_0x4e22('0x1e')]],'as':_0x3520fe['as'],'attributes':_0x3520fe[_0x4e22('0x1c')],'include':_0x3520fe[_0x4e22('0x1b')]?_['map'](_0x3520fe[_0x4e22('0x1b')],function(_0x53bdd3){return{'model':db[_0x53bdd3[_0x4e22('0x1e')]],'as':_0x53bdd3['as'],'attributes':_0x53bdd3[_0x4e22('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4e22('0xb')](function(_0x26389c){logger[_0x4e22('0xc')](_0x4e22('0x16'),_0x3e6345);logger['debug']('GetTemplate',_0x3e6345,JSON[_0x4e22('0x10')](_0x26389c));_0x11969c(_0x26389c);})[_0x4e22('0x15')](function(_0x5f2e99){logger['error'](_0x4e22('0x16'),_0x5f2e99[_0x4e22('0x13')],_0x3e6345);_0x522610(_0x515476['error'](0x1f4,_0x5f2e99[_0x4e22('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b1bf117..f6e3f5a 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 _0xd6e8=['../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x14ea8e,_0x218880){var _0x2806da=function(_0x511891){while(--_0x511891){_0x14ea8e['push'](_0x14ea8e['shift']());}};_0x2806da(++_0x218880);}(_0xd6e8,0x166));var _0x8d6e=function(_0x598fa0,_0x183280){_0x598fa0=_0x598fa0-0x0;var _0x29a6ab=_0xd6e8[_0x598fa0];return _0x29a6ab;};'use strict';var multer=require(_0x8d6e('0x0'));var util=require(_0x8d6e('0x1'));var path=require(_0x8d6e('0x2'));var timeout=require(_0x8d6e('0x3'));var express=require('express');var router=express[_0x8d6e('0x4')]();var auth=require(_0x8d6e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d6e('0x6'));var controller=require(_0x8d6e('0x7'));router[_0x8d6e('0x8')]('/',auth[_0x8d6e('0x9')](),controller[_0x8d6e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8d6e('0xb')]);router[_0x8d6e('0x8')](_0x8d6e('0xc'),auth[_0x8d6e('0x9')](),controller['getAllConditions']);router['get'](_0x8d6e('0xd'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0xe')]);router[_0x8d6e('0x8')](_0x8d6e('0xf'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x10')]);router['post']('/',auth[_0x8d6e('0x9')](),controller['create']);router[_0x8d6e('0x11')](_0x8d6e('0xc'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x12')]);router['post'](_0x8d6e('0xd'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x13')]);router[_0x8d6e('0x11')]('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0x8d6e('0x14')](_0x8d6e('0x15'),auth['isAuthenticated'](),controller[_0x8d6e('0x16')]);router[_0x8d6e('0x17')](_0x8d6e('0x15'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x18')]);module[_0x8d6e('0x19')]=router; \ No newline at end of file +var _0x8c99=['connect-timeout','Router','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','create','post','addAllCondition','/:id/actions','addAction','put','update','delete','destroy','multer','util','path'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x8c99,0xb3));var _0x98c9=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x8c99[_0x3c97e3];return _0x9bb0ed;};'use strict';var multer=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var path=require(_0x98c9('0x2'));var timeout=require(_0x98c9('0x3'));var express=require('express');var router=express[_0x98c9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x98c9('0x5'));var config=require('../../config/environment');var controller=require(_0x98c9('0x6'));router[_0x98c9('0x7')]('/',auth[_0x98c9('0x8')](),controller[_0x98c9('0x9')]);router['get'](_0x98c9('0xa'),auth['isAuthenticated'](),controller[_0x98c9('0xb')]);router[_0x98c9('0x7')](_0x98c9('0xc'),auth[_0x98c9('0x8')](),controller[_0x98c9('0xd')]);router[_0x98c9('0x7')](_0x98c9('0xe'),auth[_0x98c9('0x8')](),controller[_0x98c9('0xf')]);router[_0x98c9('0x7')]('/:id/actions',auth[_0x98c9('0x8')](),controller[_0x98c9('0x10')]);router['post']('/',auth[_0x98c9('0x8')](),controller[_0x98c9('0x11')]);router[_0x98c9('0x12')](_0x98c9('0xc'),auth[_0x98c9('0x8')](),controller[_0x98c9('0x13')]);router[_0x98c9('0x12')]('/:id/any_conditions',auth[_0x98c9('0x8')](),controller['addAnyCondition']);router['post'](_0x98c9('0x14'),auth['isAuthenticated'](),controller[_0x98c9('0x15')]);router[_0x98c9('0x16')](_0x98c9('0xa'),auth['isAuthenticated'](),controller[_0x98c9('0x17')]);router[_0x98c9('0x18')](_0x98c9('0xa'),auth['isAuthenticated'](),controller[_0x98c9('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 1930396..9e96520 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 _0xe784=['sequelize','STRING'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xe784,0x98));var _0x4e78=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe784[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x4e78('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4e78('0x1')]},'description':{'type':Sequelize[_0x4e78('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc3b7=['BOOLEAN','sequelize','exports','STRING'];(function(_0xcc69c5,_0x5b35b2){var _0x14ec59=function(_0x4377ec){while(--_0x4377ec){_0xcc69c5['push'](_0xcc69c5['shift']());}};_0x14ec59(++_0x5b35b2);}(_0xc3b7,0x181));var _0x7c3b=function(_0x768277,_0x1567e2){_0x768277=_0x768277-0x0;var _0x32e9c9=_0xc3b7[_0x768277];return _0x32e9c9;};'use strict';var Sequelize=require(_0x7c3b('0x0'));module[_0x7c3b('0x1')]={'name':{'type':Sequelize[_0x7c3b('0x2')]},'channel':{'type':Sequelize[_0x7c3b('0x2')]},'description':{'type':Sequelize[_0x7c3b('0x2')]},'status':{'type':Sequelize[_0x7c3b('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 fdb55fd..6b84bbe 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 _0x5ed2=['TriggerAnyId','findOne','pick','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','json','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','type','merge','options','Trigger','include','findAll','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5ed2,0x114));var _0x25ed=function(_0x3da1c5,_0x53f43f){_0x3da1c5=_0x3da1c5-0x0;var _0x20d262=_0x5ed2[_0x3da1c5];return _0x20d262;};'use strict';var pdf=require(_0x25ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25ed('0x1'));var zipdir=require(_0x25ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25ed('0x3'));var moment=require(_0x25ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25ed('0x5'));var util=require(_0x25ed('0x6'));var path=require(_0x25ed('0x7'));var sox=require(_0x25ed('0x8'));var csv=require('to-csv');var ejs=require(_0x25ed('0x9'));var fs=require('fs');var _=require(_0x25ed('0xa'));var squel=require(_0x25ed('0xb'));var crypto=require(_0x25ed('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x25ed('0xd'));var Redis=require(_0x25ed('0xe'));var authService=require(_0x25ed('0xf'));var qs=require(_0x25ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25ed('0x11'));var logger=require(_0x25ed('0x12'))(_0x25ed('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x25ed('0x14'));var db=require(_0x25ed('0x15'))['db'];function respondWithStatusCode(_0x1530e0,_0x623120){_0x623120=_0x623120||0xcc;return function(_0x187a10){if(_0x187a10){return _0x1530e0[_0x25ed('0x16')](_0x623120);}return _0x1530e0['status'](_0x623120)[_0x25ed('0x17')]();};}function respondWithResult(_0xbdc943,_0x4730c5){_0x4730c5=_0x4730c5||0xc8;return function(_0x54c37c){if(_0x54c37c){return _0xbdc943[_0x25ed('0x18')](_0x4730c5)['json'](_0x54c37c);}};}function respondWithFilteredResult(_0x3e9b5e,_0x7244b7){return function(_0x43e295){if(_0x43e295){var _0x551342=_0x43e295[_0x25ed('0x19')],_0xfabdb=_0x7244b7[_0x25ed('0x1a')],_0x419076=_0x7244b7[_0x25ed('0x1a')]+_0x7244b7['limit'],_0x1796d8;if(_0x419076>=_0x551342){_0x419076=_0x551342;_0x1796d8=0xc8;}else{_0x1796d8=0xce;}_0x3e9b5e[_0x25ed('0x18')](_0x1796d8);return _0x3e9b5e[_0x25ed('0x1b')]('Content-Range',_0xfabdb+'-'+_0x419076+'/'+_0x551342)[_0x25ed('0x1c')](_0x43e295);}return null;};}function patchUpdates(_0x3a144b){return function(_0x3ec467){try{jsonpatch['apply'](_0x3ec467,_0x3a144b,!![]);}catch(_0x1a079c){return BPromise[_0x25ed('0x1d')](_0x1a079c);}return _0x3ec467[_0x25ed('0x1e')]();};}function saveUpdates(_0x2fb6ba,_0xc04e54){return function(_0x2bff09){if(_0x2bff09){return _0x2bff09[_0x25ed('0x1f')](_0x2fb6ba)[_0x25ed('0x20')](function(_0x24f315){return _0x24f315;});}return null;};}function removeEntity(_0x3414ac,_0x3bc398){return function(_0x4a8135){if(_0x4a8135){return _0x4a8135[_0x25ed('0x21')]()[_0x25ed('0x20')](function(){var _0x402010=_0x4a8135[_0x25ed('0x22')]({'plain':!![]});var _0x1e33f1='Triggers';return db[_0x25ed('0x23')][_0x25ed('0x21')]({'where':{'type':_0x1e33f1,'resourceId':_0x402010['id']}})[_0x25ed('0x20')](function(){return _0x4a8135;});})[_0x25ed('0x20')](function(){_0x3414ac['status'](0xcc)[_0x25ed('0x17')]();});}};}function handleEntityNotFound(_0x225916,_0x1dcb61){return function(_0x5cd61f){if(!_0x5cd61f){_0x225916['sendStatus'](0x194);}return _0x5cd61f;};}function handleError(_0x35b206,_0x5141ba){_0x5141ba=_0x5141ba||0x1f4;return function(_0x2e7de5){logger[_0x25ed('0x24')](_0x2e7de5['stack']);if(_0x2e7de5[_0x25ed('0x25')]){delete _0x2e7de5[_0x25ed('0x25')];}_0x35b206['status'](_0x5141ba)[_0x25ed('0x26')](_0x2e7de5);};}exports[_0x25ed('0x27')]=function(_0x31bde0,_0x6f3d9){var _0x26cac4={},_0x1988a4={},_0x35f14c={'count':0x0,'rows':[]};var _0x47c592=_[_0x25ed('0x28')](db['Trigger'][_0x25ed('0x29')],function(_0xc64318){return{'name':_0xc64318[_0x25ed('0x2a')],'type':_0xc64318['type'][_0x25ed('0x2b')]};});_0x1988a4['model']=_[_0x25ed('0x28')](_0x47c592,_0x25ed('0x25'));_0x1988a4[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x31bde0['query']);_0x1988a4[_0x25ed('0x2e')]=_[_0x25ed('0x2f')](_0x1988a4[_0x25ed('0x30')],_0x1988a4[_0x25ed('0x2c')]);_0x26cac4[_0x25ed('0x31')]=_['intersection'](_0x1988a4[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x32')]));_0x26cac4[_0x25ed('0x31')]=_0x26cac4[_0x25ed('0x31')][_0x25ed('0x33')]?_0x26cac4[_0x25ed('0x31')]:_0x1988a4[_0x25ed('0x30')];if(!_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x34')](_0x25ed('0x35'))){_0x26cac4['limit']=qs[_0x25ed('0x36')](_0x31bde0['query'][_0x25ed('0x36')]);_0x26cac4[_0x25ed('0x1a')]=qs['offset'](_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x1a')]);}_0x26cac4[_0x25ed('0x37')]=qs[_0x25ed('0x38')](_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x26cac4['where']=qs[_0x25ed('0x2e')](_['pick'](_0x31bde0[_0x25ed('0x2c')],_0x1988a4['filters']),_0x47c592);if(_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x39')]){_0x26cac4[_0x25ed('0x3a')]=_['merge'](_0x26cac4[_0x25ed('0x3a')],{'$or':_[_0x25ed('0x28')](_0x47c592,function(_0x2c8cd9){if(_0x2c8cd9[_0x25ed('0x3b')]!=='VIRTUAL'){var _0x2a56c7={};_0x2a56c7[_0x2c8cd9[_0x25ed('0x25')]]={'$like':'%'+_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x39')]+'%'};return _0x2a56c7;}})});}_0x26cac4=_[_0x25ed('0x3c')]({},_0x26cac4,_0x31bde0[_0x25ed('0x3d')]);var _0x2301ad={'where':_0x26cac4[_0x25ed('0x3a')]};return db[_0x25ed('0x3e')][_0x25ed('0x19')](_0x2301ad)['then'](function(_0x4be845){_0x35f14c[_0x25ed('0x19')]=_0x4be845;if(_0x31bde0[_0x25ed('0x2c')]['includeAll']){_0x26cac4[_0x25ed('0x3f')]=[{'all':!![]}];}return db[_0x25ed('0x3e')][_0x25ed('0x40')](_0x26cac4);})[_0x25ed('0x20')](function(_0x2002ea){_0x35f14c['rows']=_0x2002ea;return _0x35f14c;})[_0x25ed('0x20')](respondWithFilteredResult(_0x6f3d9,_0x26cac4))[_0x25ed('0x41')](handleError(_0x6f3d9,null));};exports[_0x25ed('0x42')]=function(_0x560235,_0x29d252){var _0x59af90={'raw':![],'where':{'id':_0x560235[_0x25ed('0x43')]['id']}},_0x5101ec={};_0x5101ec[_0x25ed('0x30')]=_[_0x25ed('0x2d')](db['Trigger'][_0x25ed('0x29')]);_0x5101ec[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x560235[_0x25ed('0x2c')]);_0x5101ec[_0x25ed('0x2e')]=_[_0x25ed('0x2f')](_0x5101ec[_0x25ed('0x30')],_0x5101ec['query']);_0x59af90['attributes']=_[_0x25ed('0x2f')](_0x5101ec[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x560235[_0x25ed('0x2c')]['fields']));_0x59af90[_0x25ed('0x31')]=_0x59af90[_0x25ed('0x31')]['length']?_0x59af90[_0x25ed('0x31')]:_0x5101ec['model'];if(_0x560235['query'][_0x25ed('0x44')]){_0x59af90['include']=[{'all':!![]}];}_0x59af90=_[_0x25ed('0x3c')]({},_0x59af90,_0x560235['options']);return db['Trigger'][_0x25ed('0x45')](_0x59af90)[_0x25ed('0x20')](handleEntityNotFound(_0x29d252,null))['then'](respondWithResult(_0x29d252,null))[_0x25ed('0x41')](handleError(_0x29d252,null));};exports[_0x25ed('0x46')]=function(_0x56a572,_0x50bcb5){return db[_0x25ed('0x3e')][_0x25ed('0x46')](_0x56a572['body'],{})[_0x25ed('0x20')](function(_0x874493){var _0x2154fd=_0x56a572['user'][_0x25ed('0x22')]({'plain':!![]});if(!_0x2154fd)throw new Error(_0x25ed('0x47'));if(_0x2154fd[_0x25ed('0x48')]===_0x25ed('0x49')){var _0x5a6d45=_0x874493[_0x25ed('0x22')]({'plain':!![]});var _0x2f030b='Triggers';return db[_0x25ed('0x4a')][_0x25ed('0x45')]({'where':{'name':_0x2f030b,'userProfileId':_0x2154fd['userProfileId']},'raw':!![]})['then'](function(_0x423ca2){if(_0x423ca2&&_0x423ca2['autoAssociation']===0x0){return db[_0x25ed('0x23')]['create']({'name':_0x5a6d45[_0x25ed('0x25')],'resourceId':_0x5a6d45['id'],'type':_0x423ca2[_0x25ed('0x25')],'sectionId':_0x423ca2['id']},{})[_0x25ed('0x20')](function(){return _0x874493;});}else{return _0x874493;}})[_0x25ed('0x41')](function(_0x4d9615){logger[_0x25ed('0x24')](_0x25ed('0x4b'),_0x4d9615);throw _0x4d9615;});}return _0x874493;})[_0x25ed('0x20')](respondWithResult(_0x50bcb5,0xc9))['catch'](handleError(_0x50bcb5,null));};exports[_0x25ed('0x1f')]=function(_0x536d29,_0x2ed575){if(_0x536d29[_0x25ed('0x4c')]['id']){delete _0x536d29['body']['id'];}return db[_0x25ed('0x3e')]['find']({'where':{'id':_0x536d29[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x2ed575,null))[_0x25ed('0x20')](saveUpdates(_0x536d29[_0x25ed('0x4c')],null))[_0x25ed('0x20')](respondWithResult(_0x2ed575,null))['catch'](handleError(_0x2ed575,null));};exports[_0x25ed('0x21')]=function(_0x45ed31,_0x1d41a7){return db[_0x25ed('0x3e')][_0x25ed('0x45')]({'where':{'id':_0x45ed31['params']['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x1d41a7,null))[_0x25ed('0x20')](removeEntity(_0x1d41a7,null))['catch'](handleError(_0x1d41a7,null));};exports[_0x25ed('0x4d')]=function(_0x224785,_0x167bcb,_0xbd46f3){if(_0x224785[_0x25ed('0x4c')]['id']){delete _0x224785[_0x25ed('0x4c')]['id'];}return db['Trigger'][_0x25ed('0x45')]({'where':{'id':_0x224785[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x167bcb,null))[_0x25ed('0x20')](function(_0x12de91){if(_0x12de91){_0x224785[_0x25ed('0x4c')][_0x25ed('0x4e')]=_0x12de91['id'];return db[_0x25ed('0x4f')][_0x25ed('0x46')](_0x224785[_0x25ed('0x4c')]);}})[_0x25ed('0x20')](respondWithResult(_0x167bcb,null))[_0x25ed('0x41')](handleError(_0x167bcb,null));};exports['addAnyCondition']=function(_0x2341ca,_0x4da499,_0x5cd163){if(_0x2341ca['body']['id']){delete _0x2341ca[_0x25ed('0x4c')]['id'];}return db[_0x25ed('0x3e')]['find']({'where':{'id':_0x2341ca[_0x25ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x4da499,null))['then'](function(_0x3dbe29){if(_0x3dbe29){_0x2341ca[_0x25ed('0x4c')][_0x25ed('0x50')]=_0x3dbe29['id'];return db['Condition'][_0x25ed('0x46')](_0x2341ca[_0x25ed('0x4c')]);}})[_0x25ed('0x20')](respondWithResult(_0x4da499,null))[_0x25ed('0x41')](handleError(_0x4da499,null));};exports['getAllConditions']=function(_0x3ac514,_0x45c000,_0x33c594){var _0x101403={};var _0x3c8264={};var _0x16a32f;var _0x12eceb;return db[_0x25ed('0x3e')][_0x25ed('0x51')]({'where':{'id':_0x3ac514[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x45c000,null))[_0x25ed('0x20')](function(_0x3d1ab8){if(_0x3d1ab8){_0x16a32f=_0x3d1ab8;_0x3c8264[_0x25ed('0x30')]=_[_0x25ed('0x2d')](db[_0x25ed('0x4f')]['rawAttributes']);_0x3c8264[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x3ac514[_0x25ed('0x2c')]);_0x3c8264['filters']=_['intersection'](_0x3c8264[_0x25ed('0x30')],_0x3c8264[_0x25ed('0x2c')]);_0x101403[_0x25ed('0x31')]=_[_0x25ed('0x2f')](_0x3c8264['model'],qs[_0x25ed('0x32')](_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x32')]));_0x101403[_0x25ed('0x31')]=_0x101403['attributes']['length']?_0x101403['attributes']:_0x3c8264['model'];_0x101403[_0x25ed('0x37')]=qs['sort'](_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x101403[_0x25ed('0x3a')]=qs['filters'](_[_0x25ed('0x52')](_0x3ac514[_0x25ed('0x2c')],_0x3c8264[_0x25ed('0x2e')]));if(_0x3ac514['query'][_0x25ed('0x39')]){_0x101403[_0x25ed('0x3a')]=_['merge'](_0x101403[_0x25ed('0x3a')],{'$or':_['map'](_0x101403[_0x25ed('0x31')],function(_0x4a8485){var _0x588630={};_0x588630[_0x4a8485]={'$like':'%'+_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x39')]+'%'};return _0x588630;})});}_0x101403=_['merge']({},_0x101403,_0x3ac514['options']);return _0x16a32f[_0x25ed('0x53')](_0x101403);}})[_0x25ed('0x20')](function(_0x1fed33){if(_0x1fed33){_0x12eceb=_0x1fed33[_0x25ed('0x33')];if(!_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x34')]('nolimit')){_0x101403['limit']=qs[_0x25ed('0x36')](_0x3ac514[_0x25ed('0x2c')]['limit']);_0x101403[_0x25ed('0x1a')]=qs[_0x25ed('0x1a')](_0x3ac514['query'][_0x25ed('0x1a')]);}return _0x16a32f[_0x25ed('0x53')](_0x101403);}})[_0x25ed('0x20')](function(_0x3ac796){if(_0x3ac796){return _0x3ac796?{'count':_0x12eceb,'rows':_0x3ac796}:null;}})[_0x25ed('0x20')](respondWithResult(_0x45c000,null))['catch'](handleError(_0x45c000,null));};exports[_0x25ed('0x54')]=function(_0x5bb0b8,_0x3e54e8,_0x5d2413){var _0x4c4d4e={};var _0x319f54={};var _0xe1a35;var _0x462049;return db[_0x25ed('0x3e')]['findOne']({'where':{'id':_0x5bb0b8[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x3e54e8,null))[_0x25ed('0x20')](function(_0x1c5a0c){if(_0x1c5a0c){_0xe1a35=_0x1c5a0c;_0x319f54['model']=_[_0x25ed('0x2d')](db[_0x25ed('0x4f')][_0x25ed('0x29')]);_0x319f54[_0x25ed('0x2c')]=_['keys'](_0x5bb0b8['query']);_0x319f54['filters']=_[_0x25ed('0x2f')](_0x319f54[_0x25ed('0x30')],_0x319f54[_0x25ed('0x2c')]);_0x4c4d4e['attributes']=_['intersection'](_0x319f54[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x32')]));_0x4c4d4e[_0x25ed('0x31')]=_0x4c4d4e[_0x25ed('0x31')][_0x25ed('0x33')]?_0x4c4d4e['attributes']:_0x319f54[_0x25ed('0x30')];_0x4c4d4e[_0x25ed('0x37')]=qs[_0x25ed('0x38')](_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x4c4d4e[_0x25ed('0x3a')]=qs[_0x25ed('0x2e')](_['pick'](_0x5bb0b8[_0x25ed('0x2c')],_0x319f54['filters']));if(_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x39')]){_0x4c4d4e[_0x25ed('0x3a')]=_[_0x25ed('0x3c')](_0x4c4d4e[_0x25ed('0x3a')],{'$or':_[_0x25ed('0x28')](_0x4c4d4e[_0x25ed('0x31')],function(_0x86177a){var _0x68f3c2={};_0x68f3c2[_0x86177a]={'$like':'%'+_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x39')]+'%'};return _0x68f3c2;})});}_0x4c4d4e=_['merge']({},_0x4c4d4e,_0x5bb0b8[_0x25ed('0x3d')]);return _0xe1a35['getAnyConditions'](_0x4c4d4e);}})[_0x25ed('0x20')](function(_0x18f138){if(_0x18f138){_0x462049=_0x18f138['length'];if(!_0x5bb0b8[_0x25ed('0x2c')]['hasOwnProperty'](_0x25ed('0x35'))){_0x4c4d4e[_0x25ed('0x36')]=qs[_0x25ed('0x36')](_0x5bb0b8[_0x25ed('0x2c')]['limit']);_0x4c4d4e['offset']=qs['offset'](_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x1a')]);}return _0xe1a35[_0x25ed('0x54')](_0x4c4d4e);}})[_0x25ed('0x20')](function(_0xc32ed){if(_0xc32ed){return _0xc32ed?{'count':_0x462049,'rows':_0xc32ed}:null;}})['then'](respondWithResult(_0x3e54e8,null))['catch'](handleError(_0x3e54e8,null));};exports[_0x25ed('0x55')]=function(_0x1ccd63,_0x372215,_0x1c68f4){if(_0x1ccd63[_0x25ed('0x4c')]['id']){delete _0x1ccd63[_0x25ed('0x4c')]['id'];}return db[_0x25ed('0x3e')][_0x25ed('0x45')]({'where':{'id':_0x1ccd63[_0x25ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x372215,null))[_0x25ed('0x20')](function(_0x2b786a){if(_0x2b786a){_0x1ccd63['body'][_0x25ed('0x56')]=_0x2b786a['id'];return db[_0x25ed('0x57')][_0x25ed('0x46')](_0x1ccd63['body']);}})['then'](respondWithResult(_0x372215,null))[_0x25ed('0x41')](handleError(_0x372215,null));};exports[_0x25ed('0x58')]=function(_0x5d2733,_0x449012,_0x229042){var _0x6e2206={};var _0x1b0982={};var _0x375485;var _0x52174d;return db[_0x25ed('0x3e')][_0x25ed('0x51')]({'where':{'id':_0x5d2733[_0x25ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x449012,null))[_0x25ed('0x20')](function(_0x2ce969){if(_0x2ce969){_0x375485=_0x2ce969;_0x1b0982[_0x25ed('0x30')]=_[_0x25ed('0x2d')](db[_0x25ed('0x57')][_0x25ed('0x29')]);_0x1b0982[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x5d2733[_0x25ed('0x2c')]);_0x1b0982[_0x25ed('0x2e')]=_[_0x25ed('0x2f')](_0x1b0982[_0x25ed('0x30')],_0x1b0982['query']);_0x6e2206[_0x25ed('0x31')]=_[_0x25ed('0x2f')](_0x1b0982[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x5d2733['query'][_0x25ed('0x32')]));_0x6e2206[_0x25ed('0x31')]=_0x6e2206['attributes']['length']?_0x6e2206['attributes']:_0x1b0982[_0x25ed('0x30')];_0x6e2206['order']=qs[_0x25ed('0x38')](_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x6e2206[_0x25ed('0x3a')]=qs[_0x25ed('0x2e')](_[_0x25ed('0x52')](_0x5d2733['query'],_0x1b0982['filters']));if(_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x39')]){_0x6e2206['where']=_['merge'](_0x6e2206[_0x25ed('0x3a')],{'$or':_[_0x25ed('0x28')](_0x6e2206['attributes'],function(_0x1ad12f){var _0x2b7900={};_0x2b7900[_0x1ad12f]={'$like':'%'+_0x5d2733[_0x25ed('0x2c')]['filter']+'%'};return _0x2b7900;})});}_0x6e2206=_[_0x25ed('0x3c')]({},_0x6e2206,_0x5d2733[_0x25ed('0x3d')]);return _0x375485[_0x25ed('0x58')](_0x6e2206);}})[_0x25ed('0x20')](function(_0x8c17e3){if(_0x8c17e3){_0x52174d=_0x8c17e3[_0x25ed('0x33')];if(!_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x34')]('nolimit')){_0x6e2206[_0x25ed('0x36')]=qs['limit'](_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x36')]);_0x6e2206[_0x25ed('0x1a')]=qs[_0x25ed('0x1a')](_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x1a')]);}return _0x375485['getActions'](_0x6e2206);}})['then'](function(_0x4ffb56){if(_0x4ffb56){return _0x4ffb56?{'count':_0x52174d,'rows':_0x4ffb56}:null;}})[_0x25ed('0x20')](respondWithResult(_0x449012,null))[_0x25ed('0x41')](handleError(_0x449012,null));}; \ No newline at end of file +var _0xcb66=['destroy','end','stack','name','send','index','map','Trigger','fieldName','type','model','keys','query','intersection','attributes','fields','length','limit','order','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','rawAttributes','sort','hasOwnProperty','getAnyConditions','nolimit','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','reject','save','then','Triggers'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcb66,0x19f));var _0x6cb6=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0xcb66[_0x40b3f2];return _0x4ce90c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6cb6('0x0'));var rimraf=require(_0x6cb6('0x1'));var zipdir=require(_0x6cb6('0x2'));var jsonpatch=require(_0x6cb6('0x3'));var rp=require(_0x6cb6('0x4'));var moment=require('moment');var BPromise=require(_0x6cb6('0x5'));var Mustache=require(_0x6cb6('0x6'));var util=require(_0x6cb6('0x7'));var path=require(_0x6cb6('0x8'));var sox=require(_0x6cb6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6cb6('0xa'));var squel=require(_0x6cb6('0xb'));var crypto=require(_0x6cb6('0xc'));var jsforce=require(_0x6cb6('0xd'));var deskjs=require(_0x6cb6('0xe'));var toCsv=require(_0x6cb6('0xf'));var querystring=require(_0x6cb6('0x10'));var Papa=require(_0x6cb6('0x11'));var Redis=require(_0x6cb6('0x12'));var authService=require(_0x6cb6('0x13'));var qs=require(_0x6cb6('0x14'));var as=require(_0x6cb6('0x15'));var hardwareService=require(_0x6cb6('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cb6('0x17'));var db=require(_0x6cb6('0x18'))['db'];function respondWithStatusCode(_0xad49d9,_0x2604e7){_0x2604e7=_0x2604e7||0xcc;return function(_0x585233){if(_0x585233){return _0xad49d9[_0x6cb6('0x19')](_0x2604e7);}return _0xad49d9[_0x6cb6('0x1a')](_0x2604e7)['end']();};}function respondWithResult(_0x1e5468,_0x14a581){_0x14a581=_0x14a581||0xc8;return function(_0x5af476){if(_0x5af476){return _0x1e5468[_0x6cb6('0x1a')](_0x14a581)[_0x6cb6('0x1b')](_0x5af476);}};}function respondWithFilteredResult(_0x492629,_0x5ab865){return function(_0x505b4d){if(_0x505b4d){var _0x5dd4cd=_0x505b4d[_0x6cb6('0x1c')],_0x380edc=_0x5ab865[_0x6cb6('0x1d')],_0x298daa=_0x5ab865[_0x6cb6('0x1d')]+_0x5ab865['limit'],_0x9c901a;if(_0x298daa>=_0x5dd4cd){_0x298daa=_0x5dd4cd;_0x9c901a=0xc8;}else{_0x9c901a=0xce;}_0x492629[_0x6cb6('0x1a')](_0x9c901a);return _0x492629[_0x6cb6('0x1e')]('Content-Range',_0x380edc+'-'+_0x298daa+'/'+_0x5dd4cd)['json'](_0x505b4d);}return null;};}function patchUpdates(_0x5ef3d2){return function(_0x5b5dab){try{jsonpatch['apply'](_0x5b5dab,_0x5ef3d2,!![]);}catch(_0x5e5349){return BPromise[_0x6cb6('0x1f')](_0x5e5349);}return _0x5b5dab[_0x6cb6('0x20')]();};}function saveUpdates(_0x407455,_0x2d41c4){return function(_0xc5dea0){if(_0xc5dea0){return _0xc5dea0['update'](_0x407455)['then'](function(_0x2dffa4){return _0x2dffa4;});}return null;};}function removeEntity(_0x1d35d1,_0x1c4bcd){return function(_0x153915){if(_0x153915){return _0x153915['destroy']()[_0x6cb6('0x21')](function(){var _0x19837e=_0x153915['get']({'plain':!![]});var _0x5ad4f2=_0x6cb6('0x22');return db['UserProfileResource'][_0x6cb6('0x23')]({'where':{'type':_0x5ad4f2,'resourceId':_0x19837e['id']}})[_0x6cb6('0x21')](function(){return _0x153915;});})[_0x6cb6('0x21')](function(){_0x1d35d1[_0x6cb6('0x1a')](0xcc)[_0x6cb6('0x24')]();});}};}function handleEntityNotFound(_0x16db1d,_0x3b57f0){return function(_0xcae6af){if(!_0xcae6af){_0x16db1d[_0x6cb6('0x19')](0x194);}return _0xcae6af;};}function handleError(_0x112e47,_0x47a81b){_0x47a81b=_0x47a81b||0x1f4;return function(_0x5c525b){logger['error'](_0x5c525b[_0x6cb6('0x25')]);if(_0x5c525b[_0x6cb6('0x26')]){delete _0x5c525b[_0x6cb6('0x26')];}_0x112e47[_0x6cb6('0x1a')](_0x47a81b)[_0x6cb6('0x27')](_0x5c525b);};}exports[_0x6cb6('0x28')]=function(_0x57cd74,_0x124291){var _0x4d4ad9={},_0x2b2c4b={},_0x4d5471={'count':0x0,'rows':[]};var _0x13126c=_[_0x6cb6('0x29')](db[_0x6cb6('0x2a')]['rawAttributes'],function(_0x417dec){return{'name':_0x417dec[_0x6cb6('0x2b')],'type':_0x417dec[_0x6cb6('0x2c')]['key']};});_0x2b2c4b[_0x6cb6('0x2d')]=_[_0x6cb6('0x29')](_0x13126c,_0x6cb6('0x26'));_0x2b2c4b['query']=_[_0x6cb6('0x2e')](_0x57cd74[_0x6cb6('0x2f')]);_0x2b2c4b['filters']=_[_0x6cb6('0x30')](_0x2b2c4b[_0x6cb6('0x2d')],_0x2b2c4b[_0x6cb6('0x2f')]);_0x4d4ad9[_0x6cb6('0x31')]=_[_0x6cb6('0x30')](_0x2b2c4b[_0x6cb6('0x2d')],qs[_0x6cb6('0x32')](_0x57cd74[_0x6cb6('0x2f')][_0x6cb6('0x32')]));_0x4d4ad9[_0x6cb6('0x31')]=_0x4d4ad9['attributes'][_0x6cb6('0x33')]?_0x4d4ad9[_0x6cb6('0x31')]:_0x2b2c4b[_0x6cb6('0x2d')];if(!_0x57cd74[_0x6cb6('0x2f')]['hasOwnProperty']('nolimit')){_0x4d4ad9['limit']=qs[_0x6cb6('0x34')](_0x57cd74[_0x6cb6('0x2f')][_0x6cb6('0x34')]);_0x4d4ad9[_0x6cb6('0x1d')]=qs[_0x6cb6('0x1d')](_0x57cd74[_0x6cb6('0x2f')][_0x6cb6('0x1d')]);}_0x4d4ad9[_0x6cb6('0x35')]=qs['sort'](_0x57cd74[_0x6cb6('0x2f')]['sort']);_0x4d4ad9[_0x6cb6('0x36')]=qs[_0x6cb6('0x37')](_[_0x6cb6('0x38')](_0x57cd74[_0x6cb6('0x2f')],_0x2b2c4b[_0x6cb6('0x37')]),_0x13126c);if(_0x57cd74[_0x6cb6('0x2f')][_0x6cb6('0x39')]){_0x4d4ad9['where']=_[_0x6cb6('0x3a')](_0x4d4ad9['where'],{'$or':_[_0x6cb6('0x29')](_0x13126c,function(_0x18a4a1){if(_0x18a4a1[_0x6cb6('0x2c')]!=='VIRTUAL'){var _0x4cbef4={};_0x4cbef4[_0x18a4a1[_0x6cb6('0x26')]]={'$like':'%'+_0x57cd74['query'][_0x6cb6('0x39')]+'%'};return _0x4cbef4;}})});}_0x4d4ad9=_[_0x6cb6('0x3a')]({},_0x4d4ad9,_0x57cd74[_0x6cb6('0x3b')]);var _0x3228d7={'where':_0x4d4ad9[_0x6cb6('0x36')]};return db[_0x6cb6('0x2a')][_0x6cb6('0x1c')](_0x3228d7)['then'](function(_0x359bd1){_0x4d5471[_0x6cb6('0x1c')]=_0x359bd1;if(_0x57cd74['query'][_0x6cb6('0x3c')]){_0x4d4ad9[_0x6cb6('0x3d')]=[{'all':!![]}];}return db[_0x6cb6('0x2a')][_0x6cb6('0x3e')](_0x4d4ad9);})[_0x6cb6('0x21')](function(_0x3b435e){_0x4d5471['rows']=_0x3b435e;return _0x4d5471;})['then'](respondWithFilteredResult(_0x124291,_0x4d4ad9))[_0x6cb6('0x3f')](handleError(_0x124291,null));};exports['show']=function(_0x588ea4,_0x605673){var _0x49beec={'raw':![],'where':{'id':_0x588ea4[_0x6cb6('0x40')]['id']}},_0x428d65={};_0x428d65['model']=_['keys'](db[_0x6cb6('0x2a')]['rawAttributes']);_0x428d65[_0x6cb6('0x2f')]=_[_0x6cb6('0x2e')](_0x588ea4['query']);_0x428d65[_0x6cb6('0x37')]=_[_0x6cb6('0x30')](_0x428d65['model'],_0x428d65[_0x6cb6('0x2f')]);_0x49beec['attributes']=_[_0x6cb6('0x30')](_0x428d65[_0x6cb6('0x2d')],qs['fields'](_0x588ea4[_0x6cb6('0x2f')][_0x6cb6('0x32')]));_0x49beec['attributes']=_0x49beec['attributes'][_0x6cb6('0x33')]?_0x49beec[_0x6cb6('0x31')]:_0x428d65[_0x6cb6('0x2d')];if(_0x588ea4['query'][_0x6cb6('0x3c')]){_0x49beec[_0x6cb6('0x3d')]=[{'all':!![]}];}_0x49beec=_['merge']({},_0x49beec,_0x588ea4[_0x6cb6('0x3b')]);return db[_0x6cb6('0x2a')][_0x6cb6('0x41')](_0x49beec)['then'](handleEntityNotFound(_0x605673,null))[_0x6cb6('0x21')](respondWithResult(_0x605673,null))[_0x6cb6('0x3f')](handleError(_0x605673,null));};exports[_0x6cb6('0x42')]=function(_0x12bd7f,_0x182daa){return db[_0x6cb6('0x2a')]['create'](_0x12bd7f[_0x6cb6('0x43')],{})['then'](function(_0x4c3a3a){var _0x29cb39=_0x12bd7f[_0x6cb6('0x44')]['get']({'plain':!![]});if(!_0x29cb39)throw new Error(_0x6cb6('0x45'));if(_0x29cb39['role']===_0x6cb6('0x44')){var _0x2ae4ed=_0x4c3a3a[_0x6cb6('0x46')]({'plain':!![]});var _0x5ee84a=_0x6cb6('0x22');return db[_0x6cb6('0x47')][_0x6cb6('0x41')]({'where':{'name':_0x5ee84a,'userProfileId':_0x29cb39['userProfileId']},'raw':!![]})[_0x6cb6('0x21')](function(_0x5b9a06){if(_0x5b9a06&&_0x5b9a06[_0x6cb6('0x48')]===0x0){return db[_0x6cb6('0x49')][_0x6cb6('0x42')]({'name':_0x2ae4ed['name'],'resourceId':_0x2ae4ed['id'],'type':_0x5b9a06['name'],'sectionId':_0x5b9a06['id']},{})[_0x6cb6('0x21')](function(){return _0x4c3a3a;});}else{return _0x4c3a3a;}})[_0x6cb6('0x3f')](function(_0x1d12da){logger['error'](_0x6cb6('0x4a'),_0x1d12da);throw _0x1d12da;});}return _0x4c3a3a;})[_0x6cb6('0x21')](respondWithResult(_0x182daa,0xc9))[_0x6cb6('0x3f')](handleError(_0x182daa,null));};exports['update']=function(_0x232b71,_0x580f0f){if(_0x232b71[_0x6cb6('0x43')]['id']){delete _0x232b71['body']['id'];}return db[_0x6cb6('0x2a')][_0x6cb6('0x41')]({'where':{'id':_0x232b71[_0x6cb6('0x40')]['id']}})[_0x6cb6('0x21')](handleEntityNotFound(_0x580f0f,null))[_0x6cb6('0x21')](saveUpdates(_0x232b71[_0x6cb6('0x43')],null))[_0x6cb6('0x21')](respondWithResult(_0x580f0f,null))[_0x6cb6('0x3f')](handleError(_0x580f0f,null));};exports[_0x6cb6('0x23')]=function(_0xfc9ae0,_0x2662ab){return db[_0x6cb6('0x2a')]['find']({'where':{'id':_0xfc9ae0[_0x6cb6('0x40')]['id']}})[_0x6cb6('0x21')](handleEntityNotFound(_0x2662ab,null))['then'](removeEntity(_0x2662ab,null))[_0x6cb6('0x3f')](handleError(_0x2662ab,null));};exports[_0x6cb6('0x4b')]=function(_0x5929e7,_0x18787a,_0x23eba3){if(_0x5929e7[_0x6cb6('0x43')]['id']){delete _0x5929e7['body']['id'];}return db[_0x6cb6('0x2a')][_0x6cb6('0x41')]({'where':{'id':_0x5929e7[_0x6cb6('0x40')]['id']}})[_0x6cb6('0x21')](handleEntityNotFound(_0x18787a,null))[_0x6cb6('0x21')](function(_0x9f2d9f){if(_0x9f2d9f){_0x5929e7[_0x6cb6('0x43')][_0x6cb6('0x4c')]=_0x9f2d9f['id'];return db[_0x6cb6('0x4d')][_0x6cb6('0x42')](_0x5929e7['body']);}})[_0x6cb6('0x21')](respondWithResult(_0x18787a,null))[_0x6cb6('0x3f')](handleError(_0x18787a,null));};exports['addAnyCondition']=function(_0x24ded9,_0x555bbd,_0x5818a1){if(_0x24ded9[_0x6cb6('0x43')]['id']){delete _0x24ded9[_0x6cb6('0x43')]['id'];}return db[_0x6cb6('0x2a')][_0x6cb6('0x41')]({'where':{'id':_0x24ded9[_0x6cb6('0x40')]['id']}})['then'](handleEntityNotFound(_0x555bbd,null))[_0x6cb6('0x21')](function(_0x316c6a){if(_0x316c6a){_0x24ded9['body'][_0x6cb6('0x4e')]=_0x316c6a['id'];return db[_0x6cb6('0x4d')][_0x6cb6('0x42')](_0x24ded9['body']);}})[_0x6cb6('0x21')](respondWithResult(_0x555bbd,null))[_0x6cb6('0x3f')](handleError(_0x555bbd,null));};exports[_0x6cb6('0x4f')]=function(_0x19867b,_0xca24f0,_0x5eb198){var _0x34f98c={};var _0x5c643d={};var _0x33030f;var _0x5d2091;return db[_0x6cb6('0x2a')][_0x6cb6('0x50')]({'where':{'id':_0x19867b[_0x6cb6('0x40')]['id']}})[_0x6cb6('0x21')](handleEntityNotFound(_0xca24f0,null))[_0x6cb6('0x21')](function(_0x5b7de3){if(_0x5b7de3){_0x33030f=_0x5b7de3;_0x5c643d[_0x6cb6('0x2d')]=_[_0x6cb6('0x2e')](db[_0x6cb6('0x4d')][_0x6cb6('0x51')]);_0x5c643d[_0x6cb6('0x2f')]=_[_0x6cb6('0x2e')](_0x19867b['query']);_0x5c643d['filters']=_[_0x6cb6('0x30')](_0x5c643d[_0x6cb6('0x2d')],_0x5c643d[_0x6cb6('0x2f')]);_0x34f98c['attributes']=_[_0x6cb6('0x30')](_0x5c643d[_0x6cb6('0x2d')],qs[_0x6cb6('0x32')](_0x19867b['query'][_0x6cb6('0x32')]));_0x34f98c[_0x6cb6('0x31')]=_0x34f98c[_0x6cb6('0x31')][_0x6cb6('0x33')]?_0x34f98c['attributes']:_0x5c643d[_0x6cb6('0x2d')];_0x34f98c['order']=qs[_0x6cb6('0x52')](_0x19867b[_0x6cb6('0x2f')][_0x6cb6('0x52')]);_0x34f98c['where']=qs['filters'](_[_0x6cb6('0x38')](_0x19867b[_0x6cb6('0x2f')],_0x5c643d['filters']));if(_0x19867b[_0x6cb6('0x2f')]['filter']){_0x34f98c[_0x6cb6('0x36')]=_['merge'](_0x34f98c['where'],{'$or':_['map'](_0x34f98c[_0x6cb6('0x31')],function(_0x4020f7){var _0x45a231={};_0x45a231[_0x4020f7]={'$like':'%'+_0x19867b[_0x6cb6('0x2f')]['filter']+'%'};return _0x45a231;})});}_0x34f98c=_['merge']({},_0x34f98c,_0x19867b[_0x6cb6('0x3b')]);return _0x33030f['getAllConditions'](_0x34f98c);}})['then'](function(_0x302c63){if(_0x302c63){_0x5d2091=_0x302c63[_0x6cb6('0x33')];if(!_0x19867b[_0x6cb6('0x2f')][_0x6cb6('0x53')]('nolimit')){_0x34f98c[_0x6cb6('0x34')]=qs[_0x6cb6('0x34')](_0x19867b[_0x6cb6('0x2f')]['limit']);_0x34f98c['offset']=qs[_0x6cb6('0x1d')](_0x19867b['query'][_0x6cb6('0x1d')]);}return _0x33030f['getAllConditions'](_0x34f98c);}})['then'](function(_0x251322){if(_0x251322){return _0x251322?{'count':_0x5d2091,'rows':_0x251322}:null;}})[_0x6cb6('0x21')](respondWithResult(_0xca24f0,null))[_0x6cb6('0x3f')](handleError(_0xca24f0,null));};exports[_0x6cb6('0x54')]=function(_0xe28845,_0x2c3d4c,_0xd2db31){var _0x2f2957={};var _0x566a61={};var _0x2de60a;var _0x11644d;return db[_0x6cb6('0x2a')][_0x6cb6('0x50')]({'where':{'id':_0xe28845[_0x6cb6('0x40')]['id']}})[_0x6cb6('0x21')](handleEntityNotFound(_0x2c3d4c,null))[_0x6cb6('0x21')](function(_0xeaa6ab){if(_0xeaa6ab){_0x2de60a=_0xeaa6ab;_0x566a61[_0x6cb6('0x2d')]=_['keys'](db['Condition']['rawAttributes']);_0x566a61['query']=_[_0x6cb6('0x2e')](_0xe28845['query']);_0x566a61[_0x6cb6('0x37')]=_[_0x6cb6('0x30')](_0x566a61[_0x6cb6('0x2d')],_0x566a61[_0x6cb6('0x2f')]);_0x2f2957[_0x6cb6('0x31')]=_[_0x6cb6('0x30')](_0x566a61[_0x6cb6('0x2d')],qs[_0x6cb6('0x32')](_0xe28845[_0x6cb6('0x2f')][_0x6cb6('0x32')]));_0x2f2957[_0x6cb6('0x31')]=_0x2f2957['attributes']['length']?_0x2f2957[_0x6cb6('0x31')]:_0x566a61[_0x6cb6('0x2d')];_0x2f2957[_0x6cb6('0x35')]=qs[_0x6cb6('0x52')](_0xe28845[_0x6cb6('0x2f')][_0x6cb6('0x52')]);_0x2f2957['where']=qs[_0x6cb6('0x37')](_['pick'](_0xe28845[_0x6cb6('0x2f')],_0x566a61[_0x6cb6('0x37')]));if(_0xe28845[_0x6cb6('0x2f')][_0x6cb6('0x39')]){_0x2f2957[_0x6cb6('0x36')]=_[_0x6cb6('0x3a')](_0x2f2957[_0x6cb6('0x36')],{'$or':_['map'](_0x2f2957['attributes'],function(_0x527665){var _0x3c28a3={};_0x3c28a3[_0x527665]={'$like':'%'+_0xe28845[_0x6cb6('0x2f')][_0x6cb6('0x39')]+'%'};return _0x3c28a3;})});}_0x2f2957=_[_0x6cb6('0x3a')]({},_0x2f2957,_0xe28845[_0x6cb6('0x3b')]);return _0x2de60a[_0x6cb6('0x54')](_0x2f2957);}})[_0x6cb6('0x21')](function(_0x2c0db0){if(_0x2c0db0){_0x11644d=_0x2c0db0[_0x6cb6('0x33')];if(!_0xe28845['query'][_0x6cb6('0x53')](_0x6cb6('0x55'))){_0x2f2957[_0x6cb6('0x34')]=qs[_0x6cb6('0x34')](_0xe28845[_0x6cb6('0x2f')][_0x6cb6('0x34')]);_0x2f2957[_0x6cb6('0x1d')]=qs['offset'](_0xe28845[_0x6cb6('0x2f')][_0x6cb6('0x1d')]);}return _0x2de60a[_0x6cb6('0x54')](_0x2f2957);}})[_0x6cb6('0x21')](function(_0x23f39d){if(_0x23f39d){return _0x23f39d?{'count':_0x11644d,'rows':_0x23f39d}:null;}})['then'](respondWithResult(_0x2c3d4c,null))[_0x6cb6('0x3f')](handleError(_0x2c3d4c,null));};exports[_0x6cb6('0x56')]=function(_0x9aa8d0,_0x13e1e2,_0x208f7b){if(_0x9aa8d0['body']['id']){delete _0x9aa8d0[_0x6cb6('0x43')]['id'];}return db[_0x6cb6('0x2a')][_0x6cb6('0x41')]({'where':{'id':_0x9aa8d0[_0x6cb6('0x40')]['id']}})[_0x6cb6('0x21')](handleEntityNotFound(_0x13e1e2,null))[_0x6cb6('0x21')](function(_0x268a4c){if(_0x268a4c){_0x9aa8d0[_0x6cb6('0x43')][_0x6cb6('0x57')]=_0x268a4c['id'];return db[_0x6cb6('0x58')][_0x6cb6('0x42')](_0x9aa8d0[_0x6cb6('0x43')]);}})['then'](respondWithResult(_0x13e1e2,null))[_0x6cb6('0x3f')](handleError(_0x13e1e2,null));};exports['getActions']=function(_0x49a7b7,_0x532f98,_0x377caf){var _0x57f52e={};var _0x1d0359={};var _0x2dd062;var _0x24cd89;return db[_0x6cb6('0x2a')][_0x6cb6('0x50')]({'where':{'id':_0x49a7b7[_0x6cb6('0x40')]['id']}})[_0x6cb6('0x21')](handleEntityNotFound(_0x532f98,null))[_0x6cb6('0x21')](function(_0x3c3219){if(_0x3c3219){_0x2dd062=_0x3c3219;_0x1d0359[_0x6cb6('0x2d')]=_['keys'](db[_0x6cb6('0x58')][_0x6cb6('0x51')]);_0x1d0359['query']=_[_0x6cb6('0x2e')](_0x49a7b7['query']);_0x1d0359[_0x6cb6('0x37')]=_[_0x6cb6('0x30')](_0x1d0359[_0x6cb6('0x2d')],_0x1d0359[_0x6cb6('0x2f')]);_0x57f52e[_0x6cb6('0x31')]=_[_0x6cb6('0x30')](_0x1d0359[_0x6cb6('0x2d')],qs['fields'](_0x49a7b7[_0x6cb6('0x2f')][_0x6cb6('0x32')]));_0x57f52e['attributes']=_0x57f52e[_0x6cb6('0x31')]['length']?_0x57f52e[_0x6cb6('0x31')]:_0x1d0359[_0x6cb6('0x2d')];_0x57f52e['order']=qs[_0x6cb6('0x52')](_0x49a7b7[_0x6cb6('0x2f')][_0x6cb6('0x52')]);_0x57f52e[_0x6cb6('0x36')]=qs[_0x6cb6('0x37')](_[_0x6cb6('0x38')](_0x49a7b7['query'],_0x1d0359[_0x6cb6('0x37')]));if(_0x49a7b7[_0x6cb6('0x2f')][_0x6cb6('0x39')]){_0x57f52e[_0x6cb6('0x36')]=_[_0x6cb6('0x3a')](_0x57f52e[_0x6cb6('0x36')],{'$or':_['map'](_0x57f52e[_0x6cb6('0x31')],function(_0x483492){var _0x5a5446={};_0x5a5446[_0x483492]={'$like':'%'+_0x49a7b7[_0x6cb6('0x2f')][_0x6cb6('0x39')]+'%'};return _0x5a5446;})});}_0x57f52e=_['merge']({},_0x57f52e,_0x49a7b7[_0x6cb6('0x3b')]);return _0x2dd062[_0x6cb6('0x59')](_0x57f52e);}})['then'](function(_0x1c3dfc){if(_0x1c3dfc){_0x24cd89=_0x1c3dfc[_0x6cb6('0x33')];if(!_0x49a7b7[_0x6cb6('0x2f')]['hasOwnProperty']('nolimit')){_0x57f52e[_0x6cb6('0x34')]=qs[_0x6cb6('0x34')](_0x49a7b7[_0x6cb6('0x2f')][_0x6cb6('0x34')]);_0x57f52e[_0x6cb6('0x1d')]=qs[_0x6cb6('0x1d')](_0x49a7b7[_0x6cb6('0x2f')][_0x6cb6('0x1d')]);}return _0x2dd062[_0x6cb6('0x59')](_0x57f52e);}})[_0x6cb6('0x21')](function(_0x29683d){if(_0x29683d){return _0x29683d?{'count':_0x24cd89,'rows':_0x29683d}:null;}})['then'](respondWithResult(_0x532f98,null))[_0x6cb6('0x3f')](handleError(_0x532f98,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7913704..bbe8335 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 _0xf23d=['rimraf','../../config/environment','./trigger.attributes','define','Trigger','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf23d,0xd1));var _0xdf23=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xf23d[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xdf23('0x0'));var util=require('util');var logger=require(_0xdf23('0x1'))(_0xdf23('0x2'));var moment=require(_0xdf23('0x3'));var BPromise=require(_0xdf23('0x4'));var rp=require(_0xdf23('0x5'));var fs=require('fs');var path=require(_0xdf23('0x6'));var rimraf=require(_0xdf23('0x7'));var config=require(_0xdf23('0x8'));var attributes=require(_0xdf23('0x9'));module['exports']=function(_0x3fef08,_0x49c9f3){return _0x3fef08[_0xdf23('0xa')](_0xdf23('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b53=['bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x2d53be,_0x438382){var _0x5464c4=function(_0x3c6344){while(--_0x3c6344){_0x2d53be['push'](_0x2d53be['shift']());}};_0x5464c4(++_0x438382);}(_0x2b53,0x8a));var _0x32b5=function(_0x583a1a,_0x20da28){_0x583a1a=_0x583a1a-0x0;var _0x9ce43a=_0x2b53[_0x583a1a];return _0x9ce43a;};'use strict';var _=require(_0x32b5('0x0'));var util=require(_0x32b5('0x1'));var logger=require(_0x32b5('0x2'))(_0x32b5('0x3'));var moment=require(_0x32b5('0x4'));var BPromise=require(_0x32b5('0x5'));var rp=require(_0x32b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32b5('0x7'));var config=require(_0x32b5('0x8'));var attributes=require(_0x32b5('0x9'));module['exports']=function(_0x1b055e,_0x4ac09f){return _0x1b055e[_0x32b5('0xa')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 7020363..3c91645 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 _0x13f6=['debug','stringify','error','code','message','info','result','GetTrigger','Trigger','findAll','options','limit','include','map','model','attributes','ShowTrigger','find','raw','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x1d2064,_0x47aef1){var _0x269138=function(_0xe10ada){while(--_0xe10ada){_0x1d2064['push'](_0x1d2064['shift']());}};_0x269138(++_0x47aef1);}(_0x13f6,0x124));var _0x613f=function(_0x336a7e,_0x4af2ca){_0x336a7e=_0x336a7e-0x0;var _0x587ba1=_0x13f6[_0x336a7e];return _0x587ba1;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('Trigger,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('Trigger,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});}exports[_0x613f('0x15')]=function(_0x4f9dae){var _0x62ebfe=this;return new Promise(function(_0x1e5a11,_0x431266){return db[_0x613f('0x16')][_0x613f('0x17')]({'raw':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['where']||null:null,'attributes':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')]['attributes']||null:null,'limit':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')][_0x613f('0x19')]||null:null,'include':_0x4f9dae['options']?_0x4f9dae['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x4f9dae[_0x613f('0x18')]['include'],function(_0x41104e){return{'model':db[_0x41104e[_0x613f('0x1c')]],'as':_0x41104e['as'],'attributes':_0x41104e[_0x613f('0x1d')],'include':_0x41104e[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x41104e['include'],function(_0x30fb15){return{'model':db[_0x30fb15[_0x613f('0x1c')]],'as':_0x30fb15['as'],'attributes':_0x30fb15['attributes'],'include':_0x30fb15[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x30fb15[_0x613f('0x1a')],function(_0x4a878d){return{'model':db[_0x4a878d['model']],'as':_0x4a878d['as'],'attributes':_0x4a878d['attributes']};}):[]};}):[]};}):[]:[]})[_0x613f('0xb')](function(_0x594c28){logger[_0x613f('0x13')](_0x613f('0x15'),_0x4f9dae);logger['debug'](_0x613f('0x15'),_0x4f9dae,JSON[_0x613f('0xf')](_0x594c28));_0x1e5a11(_0x594c28);})['catch'](function(_0x4cff5d){logger['error'](_0x613f('0x15'),_0x4cff5d[_0x613f('0x12')],_0x4f9dae);_0x431266(_0x62ebfe[_0x613f('0x10')](0x1f4,_0x4cff5d['message']));});});};exports[_0x613f('0x1e')]=function(_0x439478){var _0xd335a6=this;return new Promise(function(_0x19bb8f,_0x4f8500){return db[_0x613f('0x16')][_0x613f('0x1f')]({'raw':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')][_0x613f('0x20')]===undefined?!![]:![]:!![],'where':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x21')]||null:null,'attributes':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')]['attributes']||null:null,'include':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x439478[_0x613f('0x18')][_0x613f('0x1a')],function(_0x2bceaa){return{'model':db[_0x2bceaa[_0x613f('0x1c')]],'as':_0x2bceaa['as'],'attributes':_0x2bceaa['attributes'],'include':_0x2bceaa[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x2bceaa[_0x613f('0x1a')],function(_0x25b2e4){return{'model':db[_0x25b2e4[_0x613f('0x1c')]],'as':_0x25b2e4['as'],'attributes':_0x25b2e4['attributes'],'include':_0x25b2e4['include']?_['map'](_0x25b2e4[_0x613f('0x1a')],function(_0x72c804){return{'model':db[_0x72c804[_0x613f('0x1c')]],'as':_0x72c804['as'],'attributes':_0x72c804[_0x613f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fc02e){logger[_0x613f('0x13')]('ShowTrigger',_0x439478);logger[_0x613f('0xe')]('ShowTrigger',_0x439478,JSON[_0x613f('0xf')](_0x2fc02e));_0x19bb8f(_0x2fc02e);})['catch'](function(_0x36dfd4){logger['error'](_0x613f('0x1e'),_0x36dfd4[_0x613f('0x12')],_0x439478);_0x4f8500(_0xd335a6[_0x613f('0x10')](0x1f4,_0x36dfd4['message']));});});}; \ No newline at end of file +var _0x4024=['attributes','include','map','model','then','debug','ShowTrigger','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','options'];(function(_0x565b23,_0x2ba1ee){var _0x20913c=function(_0x1891f5){while(--_0x1891f5){_0x565b23['push'](_0x565b23['shift']());}};_0x20913c(++_0x2ba1ee);}(_0x4024,0x89));var _0x4402=function(_0x415584,_0x4311ac){_0x415584=_0x415584-0x0;var _0x483a19=_0x4024[_0x415584];return _0x483a19;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('Trigger,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['findAll']({'raw':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x231382[_0x4402('0x16')]?_0x231382['options']['where']||null:null,'attributes':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')][_0x4402('0x17')]||null:null,'limit':_0x231382['options']?_0x231382[_0x4402('0x16')]['limit']||null:null,'include':_0x231382['options']?_0x231382[_0x4402('0x16')][_0x4402('0x18')]?_[_0x4402('0x19')](_0x231382[_0x4402('0x16')][_0x4402('0x18')],function(_0x2e6fee){return{'model':db[_0x2e6fee[_0x4402('0x1a')]],'as':_0x2e6fee['as'],'attributes':_0x2e6fee[_0x4402('0x17')],'include':_0x2e6fee[_0x4402('0x18')]?_['map'](_0x2e6fee[_0x4402('0x18')],function(_0x4e1c04){return{'model':db[_0x4e1c04[_0x4402('0x1a')]],'as':_0x4e1c04['as'],'attributes':_0x4e1c04[_0x4402('0x17')],'include':_0x4e1c04[_0x4402('0x18')]?_[_0x4402('0x19')](_0x4e1c04['include'],function(_0x15c19f){return{'model':db[_0x15c19f['model']],'as':_0x15c19f['as'],'attributes':_0x15c19f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x395e49){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x1c')]('GetTrigger',_0x231382,JSON[_0x4402('0xd')](_0x395e49));_0x494389(_0x395e49);})['catch'](function(_0x71da2f){logger[_0x4402('0xe')](_0x4402('0x14'),_0x71da2f['message'],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x71da2f[_0x4402('0x11')]));});});};exports[_0x4402('0x1d')]=function(_0x3f4bcb){var _0x2526d1=this;return new Promise(function(_0x605702,_0x1189b8){return db[_0x4402('0x15')][_0x4402('0x1e')]({'raw':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb['options'][_0x4402('0x1f')]||null:null,'attributes':_0x3f4bcb['options']?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x17')]||null:null,'include':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')]?_['map'](_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')],function(_0x169340){return{'model':db[_0x169340['model']],'as':_0x169340['as'],'attributes':_0x169340[_0x4402('0x17')],'include':_0x169340[_0x4402('0x18')]?_['map'](_0x169340[_0x4402('0x18')],function(_0x437e83){return{'model':db[_0x437e83[_0x4402('0x1a')]],'as':_0x437e83['as'],'attributes':_0x437e83[_0x4402('0x17')],'include':_0x437e83[_0x4402('0x18')]?_[_0x4402('0x19')](_0x437e83[_0x4402('0x18')],function(_0x6e9fb7){return{'model':db[_0x6e9fb7[_0x4402('0x1a')]],'as':_0x6e9fb7['as'],'attributes':_0x6e9fb7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x28fee8){logger[_0x4402('0xa')]('ShowTrigger',_0x3f4bcb);logger[_0x4402('0x1c')](_0x4402('0x1d'),_0x3f4bcb,JSON['stringify'](_0x28fee8));_0x605702(_0x28fee8);})['catch'](function(_0x2b9d51){logger[_0x4402('0xe')](_0x4402('0x1d'),_0x2b9d51[_0x4402('0x11')],_0x3f4bcb);_0x1189b8(_0x2526d1['error'](0x1f4,_0x2b9d51['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 2f02986..30c85be 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 _0x0e85=['connect-timeout','express','../../config/environment','get','isAuthenticated','index','show','post','/:id/clone','clone','create','put','/:id','update','delete','exports','multer','util'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0e85,0x7c));var _0x50e8=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0e85[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./trunk.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/:id',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x9')](_0x50e8('0xa'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xb')]);router['post']('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0xc')]);router[_0x50e8('0xd')](_0x50e8('0xe'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')](_0x50e8('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x50e8('0x11')]=router; \ No newline at end of file +var _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','index','get','/:id','isAuthenticated','show','/:id/clone','clone','post','put'];(function(_0x5248c8,_0x3962c6){var _0x4e5d4c=function(_0x318e1c){while(--_0x318e1c){_0x5248c8['push'](_0x5248c8['shift']());}};_0x4e5d4c(++_0x3962c6);}(_0xac31,0xca));var _0x1ac3=function(_0x10575c,_0x256852){_0x10575c=_0x10575c-0x0;var _0x2925df=_0xac31[_0x10575c];return _0x2925df;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var auth=require(_0x1ac3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac3('0x7'));var controller=require(_0x1ac3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ac3('0x9')]);router[_0x1ac3('0xa')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0xd')]);router['post'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')]('/',auth[_0x1ac3('0xc')](),controller['create']);router[_0x1ac3('0x11')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')](_0x1ac3('0xb'),auth['isAuthenticated'](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9bd3a1c..62632d6 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 _0xee93=['INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','yes','nonat','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','setDataValue','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x289ed9,_0x40b982){var _0xb02f85=function(_0x1ef4ec){while(--_0x1ef4ec){_0x289ed9['push'](_0x289ed9['shift']());}};_0xb02f85(++_0x40b982);}(_0xee93,0x11d));var _0x3ee9=function(_0x264eef,_0x109ed3){_0x264eef=_0x264eef-0x0;var _0x124df1=_0xee93[_0x264eef];return _0x124df1;};'use strict';var Sequelize=require(_0x3ee9('0x0'));module[_0x3ee9('0x1')]={'name':{'type':Sequelize[_0x3ee9('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x3ee9('0x3'),_0x3ee9('0x4'),_0x3ee9('0x5')),'allowNull':![],'defaultValue':_0x3ee9('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x7'),_0x3ee9('0x8'),_0x3ee9('0x9'),_0x3ee9('0xa'),_0x3ee9('0xb'),_0x3ee9('0xc'),_0x3ee9('0xd'),_0x3ee9('0xe'))},'deny':{'type':Sequelize[_0x3ee9('0x2')]},'permit':{'type':Sequelize[_0x3ee9('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3ee9('0x2')]},'remotesecret':{'type':Sequelize[_0x3ee9('0x2')]},'transport':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0xf'),'set':function(_0x26728d){this['setDataValue'](_0x3ee9('0x10'),_0x26728d?_0x26728d[_0x3ee9('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x3ee9('0x10'))?this['getDataValue'](_0x3ee9('0x10'))[_0x3ee9('0x12')](','):null;},'comment':_0x3ee9('0x13')},'dtmfmode':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x14'),_0x3ee9('0x15'),_0x3ee9('0x16'),'inband','auto'),'defaultValue':_0x3ee9('0x14')},'directmedia':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x18'),'update',_0x3ee9('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0x1a'),'set':function(_0x55ac98){this['setDataValue'](_0x3ee9('0x1b'),_0x55ac98?_0x55ac98[_0x3ee9('0x11')](','):null);},'get':function(){return this[_0x3ee9('0x1c')](_0x3ee9('0x1b'))?this[_0x3ee9('0x1c')](_0x3ee9('0x1b'))['split'](','):null;},'comment':_0x3ee9('0x1d')},'callgroup':{'type':Sequelize[_0x3ee9('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3ee9('0x2')]},'pickupgroup':{'type':Sequelize[_0x3ee9('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3ee9('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x3ee9('0x1e')},'allow':{'type':Sequelize[_0x3ee9('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x36d5eb){this[_0x3ee9('0x1f')]('allow',_0x36d5eb?_0x36d5eb['join'](';'):_0x3ee9('0x20'));},'get':function(){return this[_0x3ee9('0x1c')](_0x3ee9('0x21'))?this[_0x3ee9('0x1c')](_0x3ee9('0x21'))[_0x3ee9('0x12')](';'):null;},'comment':_0x3ee9('0x22')},'autoframing':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'insecure':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0x23'),'set':function(_0x5252bd){this[_0x3ee9('0x1f')](_0x3ee9('0x24'),_0x5252bd?_0x5252bd[_0x3ee9('0x11')](','):null);},'get':function(){return this[_0x3ee9('0x1c')](_0x3ee9('0x24'))?this[_0x3ee9('0x1c')](_0x3ee9('0x24'))['split'](','):null;},'comment':_0x3ee9('0x25')},'trustrpid':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x26'))},'promiscredir':{'type':Sequelize['ENUM'](_0x3ee9('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0x28')},'amaflags':{'type':Sequelize[_0x3ee9('0x2')]},'callcounter':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':_0x3ee9('0x17')},'busylevel':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x3ee9('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3ee9('0x6')]('yes','no',_0x3ee9('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'mailbox':{'type':Sequelize[_0x3ee9('0x2')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x3ee9('0x2a'),_0x3ee9('0x2b'))},'session_expires':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x2c'),_0x3ee9('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3ee9('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x3ee9('0x6')]('yes','no'),'defaultValue':_0x3ee9('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3ee9('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3ee9('0x2')]},'callbackextension':{'type':Sequelize[_0x3ee9('0x2')]},'timert1':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'timerb':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x3ee9('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3ee9('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3ee9('0x2')]},'maxforwards':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x3ee9('0x17'),'no',_0x3ee9('0x2f'),_0x3ee9('0x30'))},'dtlsrekey':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3ee9('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3ee9('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x3ee9('0x2')]},'dtlscapath':{'type':Sequelize[_0x3ee9('0x2')]},'dtlssetup':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x31'),_0x3ee9('0x32'),_0x3ee9('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3ee9('0x2')]},'usereqphone':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3ee9('0x2')]},'recordofffeature':{'type':Sequelize[_0x3ee9('0x2')]},'call_limit':{'type':Sequelize[_0x3ee9('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x3ee9('0x2')]},'mohinterpret':{'type':Sequelize[_0x3ee9('0x2')]},'mohsuggest':{'type':Sequelize[_0x3ee9('0x2')]},'parkinglot':{'type':Sequelize[_0x3ee9('0x2')]},'description':{'type':Sequelize[_0x3ee9('0x2')]},'host':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x18'),'update',_0x3ee9('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3ee9('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3ee9('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6d56=['split','rfc2833','info','yes','nonat','update','outgoing','setDataValue','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','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','getDataValue'];(function(_0x2172ca,_0xad140a){var _0x45d89e=function(_0x288f63){while(--_0x288f63){_0x2172ca['push'](_0x2172ca['shift']());}};_0x45d89e(++_0xad140a);}(_0x6d56,0x187));var _0x66d5=function(_0x5c94d1,_0x2dc27d){_0x5c94d1=_0x5c94d1-0x0;var _0x4d0ddc=_0x6d56[_0x5c94d1];return _0x4d0ddc;};'use strict';var Sequelize=require(_0x66d5('0x0'));module[_0x66d5('0x1')]={'name':{'type':Sequelize[_0x66d5('0x2')],'allowNull':![],'unique':_0x66d5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x5'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x66d5('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x6'),_0x66d5('0x7'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x66d5('0x8'),'PROHIB_FAILED_SCREEN',_0x66d5('0x9'))},'deny':{'type':Sequelize[_0x66d5('0x2')]},'permit':{'type':Sequelize[_0x66d5('0x2')]},'secret':{'type':Sequelize[_0x66d5('0x2')]},'md5secret':{'type':Sequelize[_0x66d5('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x66d5('0x2')],'defaultValue':_0x66d5('0xa'),'set':function(_0x2030c2){this['setDataValue'](_0x66d5('0xb'),_0x2030c2?_0x2030c2[_0x66d5('0xc')](','):null);},'get':function(){return this[_0x66d5('0xd')](_0x66d5('0xb'))?this['getDataValue'](_0x66d5('0xb'))[_0x66d5('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0xf'),_0x66d5('0x10'),'shortinfo','inband','auto'),'defaultValue':_0x66d5('0xf')},'directmedia':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no',_0x66d5('0x12'),_0x66d5('0x13'),_0x66d5('0x14')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x66d5('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x3876f7){this[_0x66d5('0x15')](_0x66d5('0x16'),_0x3876f7?_0x3876f7[_0x66d5('0xc')](','):null);},'get':function(){return this[_0x66d5('0xd')](_0x66d5('0x16'))?this[_0x66d5('0xd')](_0x66d5('0x16'))['split'](','):null;},'comment':_0x66d5('0x17')},'callgroup':{'type':Sequelize[_0x66d5('0x2')]},'namedcallgroup':{'type':Sequelize[_0x66d5('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x66d5('0x2')]},'language':{'type':Sequelize[_0x66d5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x66d5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x66d5('0x2')],'defaultValue':_0x66d5('0x18')},'allow':{'type':Sequelize[_0x66d5('0x2')],'allowNull':![],'defaultValue':_0x66d5('0x19'),'set':function(_0x64704){this[_0x66d5('0x15')]('allow',_0x64704?_0x64704[_0x66d5('0xc')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x66d5('0xd')](_0x66d5('0x1a'))?this[_0x66d5('0xd')](_0x66d5('0x1a'))['split'](';'):null;},'comment':_0x66d5('0x1b')},'autoframing':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no')},'insecure':{'type':Sequelize[_0x66d5('0x2')],'defaultValue':'port,invite','set':function(_0x131321){this[_0x66d5('0x15')]('insecure',_0x131321?_0x131321[_0x66d5('0xc')](','):null);},'get':function(){return this['getDataValue'](_0x66d5('0x1c'))?this[_0x66d5('0xd')](_0x66d5('0x1c'))[_0x66d5('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no',_0x66d5('0x1d'))},'promiscredir':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no')},'useclientcode':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no')},'accountcode':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'setvar':{'type':Sequelize[_0x66d5('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x66d5('0x1f')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no'),'defaultValue':_0x66d5('0x11')},'busylevel':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'allowoverlap':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x66d5('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x66d5('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x66d5('0x2')]},'template':{'type':Sequelize[_0x66d5('0x2')]},'videosupport':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x66d5('0x11'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x20'),_0x66d5('0x21'),_0x66d5('0x22'))},'session_expires':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'session_minse':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'session_refresher':{'type':Sequelize[_0x66d5('0x4')]('uac',_0x66d5('0x23')),'defaultValue':_0x66d5('0x23')},'t38pt_usertpsource':{'type':Sequelize[_0x66d5('0x2')]},'regexten':{'type':Sequelize[_0x66d5('0x2')]},'fromdomain':{'type':Sequelize[_0x66d5('0x2')]},'fromuser':{'type':Sequelize[_0x66d5('0x2')]},'port':{'type':Sequelize[_0x66d5('0x1e')](0x5)},'qualify':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no'),'defaultValue':_0x66d5('0x11')},'keepalive':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'defaultip':{'type':Sequelize[_0x66d5('0x2')]},'defaultuser':{'type':Sequelize[_0x66d5('0x2')]},'rtptimeout':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x66d5('0x11'),'no',_0x66d5('0x24')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x66d5('0x2')]},'callbackextension':{'type':Sequelize[_0x66d5('0x2')]},'timert1':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'timerb':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x66d5('0x2')]},'contactdeny':{'type':Sequelize[_0x66d5('0x2')]},'contactacl':{'type':Sequelize[_0x66d5('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x66d5('0x2')]},'use_q850_reason':{'type':Sequelize[_0x66d5('0x2')]},'maxforwards':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'encryption':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no')},'force_avp':{'type':Sequelize[_0x66d5('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no')},'dtlsenable':{'type':Sequelize[_0x66d5('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no',_0x66d5('0x25'),_0x66d5('0x26'))},'dtlsrekey':{'type':Sequelize[_0x66d5('0x1e')](0xb)},'dtlscertfile':{'type':Sequelize[_0x66d5('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x66d5('0x2')]},'dtlscipher':{'type':Sequelize[_0x66d5('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x66d5('0x27'),_0x66d5('0x28'),_0x66d5('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x66d5('0x2')]},'usereqphone':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x66d5('0x2')]},'call_limit':{'type':Sequelize[_0x66d5('0x1e')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x66d5('0x4')](_0x66d5('0x11'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x66d5('0x11'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x66d5('0x2')]},'mohsuggest':{'type':Sequelize[_0x66d5('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x66d5('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x66d5('0x2a')},'canreinvite':{'type':Sequelize['ENUM'](_0x66d5('0x11'),'no','nonat',_0x66d5('0x13'),_0x66d5('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x66d5('0x2')]},'active':{'type':Sequelize[_0x66d5('0x2c')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x66d5('0x2')],'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 22346ed..1eb1ffb 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 _0x7a51=['pick','filter','merge','options','includeAll','include','rows','show','params','keys','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','findAll','utf8','writeFileSync','Reload','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','end','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x26a76e,_0x3ca834){var _0x2d0b8a=function(_0xb2376e){while(--_0xb2376e){_0x26a76e['push'](_0x26a76e['shift']());}};_0x2d0b8a(++_0x3ca834);}(_0x7a51,0x96));var _0x17a5=function(_0x4789a4,_0x5b9016){_0x4789a4=_0x4789a4-0x0;var _0x2f2a51=_0x7a51[_0x4789a4];return _0x2f2a51;};'use strict';var pdf=require(_0x17a5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x17a5('0x1'));var jsonpatch=require(_0x17a5('0x2'));var rp=require(_0x17a5('0x3'));var moment=require(_0x17a5('0x4'));var BPromise=require(_0x17a5('0x5'));var Mustache=require(_0x17a5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x17a5('0x7'));var csv=require(_0x17a5('0x8'));var ejs=require(_0x17a5('0x9'));var fs=require('fs');var _=require(_0x17a5('0xa'));var squel=require(_0x17a5('0xb'));var crypto=require('crypto');var jsforce=require(_0x17a5('0xc'));var deskjs=require(_0x17a5('0xd'));var toCsv=require(_0x17a5('0x8'));var querystring=require('querystring');var Papa=require(_0x17a5('0xe'));var Redis=require(_0x17a5('0xf'));var authService=require(_0x17a5('0x10'));var qs=require(_0x17a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17a5('0x12'));var logger=require(_0x17a5('0x13'))(_0x17a5('0x14'));var utils=require(_0x17a5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x17a5('0x16'));var db=require(_0x17a5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x17a5('0x18')][_0x17a5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5bfbd9,_0x1e0dc4,_0x218032,_0x1969ed){return new BPromise(function(_0x16281a,_0x4fc8b6){var _0x2cd5b1=_0x1969ed||client;return _0x2cd5b1[_0x17a5('0x1a')](_0x5bfbd9,_0x218032)[_0x17a5('0x1b')](function(_0x25d07c){logger[_0x17a5('0x1c')]('Trunk,\x20%s,\x20%s',_0x1e0dc4,_0x17a5('0x1d'));logger['debug'](_0x17a5('0x1e'),_0x1e0dc4,_0x17a5('0x1d'),JSON[_0x17a5('0x1f')](_0x25d07c));if(_0x25d07c[_0x17a5('0x20')]){if(_0x25d07c[_0x17a5('0x20')][_0x17a5('0x21')]===0x1f4){logger[_0x17a5('0x20')](_0x17a5('0x22'),_0x1e0dc4,_0x25d07c[_0x17a5('0x20')][_0x17a5('0x23')]);return _0x4fc8b6(_0x25d07c['error'][_0x17a5('0x23')]);}logger[_0x17a5('0x20')](_0x17a5('0x22'),_0x1e0dc4,_0x25d07c[_0x17a5('0x20')][_0x17a5('0x23')]);return _0x16281a(_0x25d07c['error']['message']);}else{logger[_0x17a5('0x1c')](_0x17a5('0x22'),_0x1e0dc4,_0x17a5('0x1d'));_0x16281a(_0x25d07c[_0x17a5('0x24')][_0x17a5('0x23')]);}})[_0x17a5('0x25')](function(_0x37c545){logger[_0x17a5('0x20')](_0x17a5('0x22'),_0x1e0dc4,_0x37c545);_0x4fc8b6(_0x37c545);});});}function respondWithStatusCode(_0x182756,_0x2ee257){_0x2ee257=_0x2ee257||0xcc;return function(_0x559802){if(_0x559802){return _0x182756[_0x17a5('0x26')](_0x2ee257);}return _0x182756['status'](_0x2ee257)['end']();};}function respondWithResult(_0xd06bed,_0x18a87){_0x18a87=_0x18a87||0xc8;return function(_0x5a2767){if(_0x5a2767){return _0xd06bed[_0x17a5('0x27')](_0x18a87)[_0x17a5('0x28')](_0x5a2767);}};}function respondWithFilteredResult(_0x868ae7,_0x84db96){return function(_0x555d0e){if(_0x555d0e){var _0x887ed1=_0x555d0e[_0x17a5('0x29')],_0x52b45d=_0x84db96[_0x17a5('0x2a')],_0x267cfd=_0x84db96[_0x17a5('0x2a')]+_0x84db96[_0x17a5('0x2b')],_0x303d83;if(_0x267cfd>=_0x887ed1){_0x267cfd=_0x887ed1;_0x303d83=0xc8;}else{_0x303d83=0xce;}_0x868ae7['status'](_0x303d83);return _0x868ae7[_0x17a5('0x2c')](_0x17a5('0x2d'),_0x52b45d+'-'+_0x267cfd+'/'+_0x887ed1)[_0x17a5('0x28')](_0x555d0e);}return null;};}function patchUpdates(_0x14dfa3){return function(_0x2d7042){try{jsonpatch[_0x17a5('0x2e')](_0x2d7042,_0x14dfa3,!![]);}catch(_0xbd5b80){return BPromise[_0x17a5('0x2f')](_0xbd5b80);}return _0x2d7042[_0x17a5('0x30')]();};}function saveUpdates(_0x33a251,_0x5aff41){return function(_0x20d526){if(_0x20d526){return _0x20d526[_0x17a5('0x31')](_0x33a251)[_0x17a5('0x1b')](function(_0x1aa138){return _0x1aa138;});}return null;};}function removeEntity(_0x1c12a0,_0x1d7337){return function(_0x58c76e){if(_0x58c76e){return _0x58c76e[_0x17a5('0x32')]()[_0x17a5('0x1b')](function(){var _0x54dc41=_0x58c76e[_0x17a5('0x33')]({'plain':!![]});var _0x3d7db8=_0x17a5('0x34');return db[_0x17a5('0x35')][_0x17a5('0x32')]({'where':{'type':_0x3d7db8,'resourceId':_0x54dc41['id']}})[_0x17a5('0x1b')](function(){return _0x58c76e;});})[_0x17a5('0x1b')](function(){_0x1c12a0[_0x17a5('0x27')](0xcc)[_0x17a5('0x36')]();});}};}function handleEntityNotFound(_0xfbf698,_0xc38613){return function(_0x5db5a1){if(!_0x5db5a1){_0xfbf698[_0x17a5('0x26')](0x194);}return _0x5db5a1;};}function handleError(_0x3b9a9f,_0xdae019){_0xdae019=_0xdae019||0x1f4;return function(_0x1d0dff){logger[_0x17a5('0x20')](_0x1d0dff['stack']);if(_0x1d0dff[_0x17a5('0x37')]){delete _0x1d0dff[_0x17a5('0x37')];}_0x3b9a9f[_0x17a5('0x27')](_0xdae019)[_0x17a5('0x38')](_0x1d0dff);};}exports[_0x17a5('0x39')]=function(_0x16b717,_0x1b3d1e){var _0x543fb0={},_0x1b8675={},_0x7ff32e={'count':0x0,'rows':[]};var _0x89880f=_[_0x17a5('0x3a')](db[_0x17a5('0x3b')][_0x17a5('0x3c')],function(_0x39729d){return{'name':_0x39729d[_0x17a5('0x3d')],'type':_0x39729d[_0x17a5('0x3e')][_0x17a5('0x3f')]};});_0x1b8675[_0x17a5('0x40')]=_['map'](_0x89880f,_0x17a5('0x37'));_0x1b8675['query']=_['keys'](_0x16b717['query']);_0x1b8675[_0x17a5('0x41')]=_[_0x17a5('0x42')](_0x1b8675[_0x17a5('0x40')],_0x1b8675[_0x17a5('0x43')]);_0x543fb0[_0x17a5('0x44')]=_[_0x17a5('0x42')](_0x1b8675[_0x17a5('0x40')],qs[_0x17a5('0x45')](_0x16b717['query'][_0x17a5('0x45')]));_0x543fb0[_0x17a5('0x44')]=_0x543fb0[_0x17a5('0x44')][_0x17a5('0x46')]?_0x543fb0[_0x17a5('0x44')]:_0x1b8675[_0x17a5('0x40')];if(!_0x16b717[_0x17a5('0x43')][_0x17a5('0x47')](_0x17a5('0x48'))){_0x543fb0[_0x17a5('0x2b')]=qs['limit'](_0x16b717[_0x17a5('0x43')][_0x17a5('0x2b')]);_0x543fb0[_0x17a5('0x2a')]=qs['offset'](_0x16b717[_0x17a5('0x43')][_0x17a5('0x2a')]);}_0x543fb0[_0x17a5('0x49')]=qs['sort'](_0x16b717[_0x17a5('0x43')][_0x17a5('0x4a')]);_0x543fb0[_0x17a5('0x4b')]=qs['filters'](_[_0x17a5('0x4c')](_0x16b717[_0x17a5('0x43')],_0x1b8675[_0x17a5('0x41')]),_0x89880f);if(_0x16b717[_0x17a5('0x43')][_0x17a5('0x4d')]){_0x543fb0['where']=_['merge'](_0x543fb0['where'],{'$or':_['map'](_0x89880f,function(_0x52c4d2){if(_0x52c4d2[_0x17a5('0x3e')]!=='VIRTUAL'){var _0x113ce1={};_0x113ce1[_0x52c4d2[_0x17a5('0x37')]]={'$like':'%'+_0x16b717[_0x17a5('0x43')]['filter']+'%'};return _0x113ce1;}})});}_0x543fb0=_[_0x17a5('0x4e')]({},_0x543fb0,_0x16b717[_0x17a5('0x4f')]);var _0x38ab48={'where':_0x543fb0[_0x17a5('0x4b')]};return db['Trunk']['count'](_0x38ab48)[_0x17a5('0x1b')](function(_0x24f9e4){_0x7ff32e[_0x17a5('0x29')]=_0x24f9e4;if(_0x16b717[_0x17a5('0x43')][_0x17a5('0x50')]){_0x543fb0[_0x17a5('0x51')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x543fb0);})[_0x17a5('0x1b')](function(_0x4b7a6a){_0x7ff32e[_0x17a5('0x52')]=_0x4b7a6a;return _0x7ff32e;})[_0x17a5('0x1b')](respondWithFilteredResult(_0x1b3d1e,_0x543fb0))[_0x17a5('0x25')](handleError(_0x1b3d1e,null));};exports[_0x17a5('0x53')]=function(_0x443d1e,_0x3a9532){var _0x1ea8f7={'raw':![],'where':{'id':_0x443d1e[_0x17a5('0x54')]['id']}},_0x3c4678={};_0x3c4678[_0x17a5('0x40')]=_[_0x17a5('0x55')](db['Trunk'][_0x17a5('0x3c')]);_0x3c4678[_0x17a5('0x43')]=_['keys'](_0x443d1e[_0x17a5('0x43')]);_0x3c4678[_0x17a5('0x41')]=_[_0x17a5('0x42')](_0x3c4678[_0x17a5('0x40')],_0x3c4678[_0x17a5('0x43')]);_0x1ea8f7[_0x17a5('0x44')]=_[_0x17a5('0x42')](_0x3c4678[_0x17a5('0x40')],qs[_0x17a5('0x45')](_0x443d1e[_0x17a5('0x43')][_0x17a5('0x45')]));_0x1ea8f7[_0x17a5('0x44')]=_0x1ea8f7[_0x17a5('0x44')][_0x17a5('0x46')]?_0x1ea8f7[_0x17a5('0x44')]:_0x3c4678[_0x17a5('0x40')];if(_0x443d1e[_0x17a5('0x43')][_0x17a5('0x50')]){_0x1ea8f7['include']=[{'all':!![]}];}_0x1ea8f7=_[_0x17a5('0x4e')]({},_0x1ea8f7,_0x443d1e[_0x17a5('0x4f')]);return db['Trunk'][_0x17a5('0x56')](_0x1ea8f7)['then'](handleEntityNotFound(_0x3a9532,null))['then'](respondWithResult(_0x3a9532,null))[_0x17a5('0x25')](handleError(_0x3a9532,null));};exports[_0x17a5('0x57')]=function(_0x56aa04,_0x5e7693){var _0x85e33c={'where':{'id':_0x56aa04[_0x17a5('0x54')]['id']}},_0x1a3de8={};_0x1a3de8[_0x17a5('0x40')]=_['keys'](db['Trunk'][_0x17a5('0x3c')]);_0x85e33c[_0x17a5('0x44')]=_[_0x17a5('0x42')](_0x1a3de8[_0x17a5('0x40')],qs[_0x17a5('0x45')](_0x56aa04['query'][_0x17a5('0x45')]));_0x85e33c[_0x17a5('0x44')]=_0x85e33c[_0x17a5('0x44')][_0x17a5('0x46')]?_0x85e33c[_0x17a5('0x44')]:_0x1a3de8[_0x17a5('0x40')];if(_0x56aa04[_0x17a5('0x43')]['includeAll']){_0x85e33c[_0x17a5('0x51')]=[{'all':!![]}];}_0x85e33c=_[_0x17a5('0x4e')]({},_0x85e33c,_0x56aa04[_0x17a5('0x4f')]);return db[_0x17a5('0x3b')][_0x17a5('0x56')](_0x85e33c)['then'](handleEntityNotFound(_0x5e7693,null))['then'](function(_0x3484f2){if(_0x3484f2){var _0x54bc04=_0x3484f2[_0x17a5('0x33')]({'plain':!![]});_0x54bc04=qs[_0x17a5('0x58')](_0x54bc04,['id',_0x17a5('0x59'),_0x17a5('0x5a')]);_0x56aa04[_0x17a5('0x5b')]=_[_0x17a5('0x58')](_0x56aa04[_0x17a5('0x5b')],['id',_0x17a5('0x59'),'updatedAt']);return db[_0x17a5('0x3b')][_0x17a5('0x5c')](_[_0x17a5('0x4e')](_0x54bc04,_0x56aa04['body']),{'include':_0x56aa04[_0x17a5('0x43')][_0x17a5('0x50')]?[{'all':!![]}]:undefined})[_0x17a5('0x1b')](function(_0x3c293b){var _0x40ebf6=_0x56aa04[_0x17a5('0x5d')]['get']({'plain':!![]});if(!_0x40ebf6)throw new Error(_0x17a5('0x5e'));if(_0x40ebf6[_0x17a5('0x5f')]==='user'){var _0x220c3d=_0x3c293b['get']({'plain':!![]});var _0x4d421e=_0x17a5('0x34');return db[_0x17a5('0x60')][_0x17a5('0x56')]({'where':{'name':_0x4d421e,'userProfileId':_0x40ebf6[_0x17a5('0x61')]},'raw':!![]})[_0x17a5('0x1b')](function(_0x2f2646){if(_0x2f2646&&_0x2f2646[_0x17a5('0x62')]===0x0){return db['UserProfileResource'][_0x17a5('0x5c')]({'name':_0x220c3d[_0x17a5('0x37')],'resourceId':_0x220c3d['id'],'type':_0x2f2646['name'],'sectionId':_0x2f2646['id']},{})[_0x17a5('0x1b')](function(){return _0x3c293b;});}else{return _0x3c293b;}})['catch'](function(_0x3d848a){logger['error'](_0x17a5('0x63'),_0x3d848a);throw _0x3d848a;});}return _0x3c293b;});}})[_0x17a5('0x1b')](respondWithResult(_0x5e7693,0xc9))[_0x17a5('0x25')](handleError(_0x5e7693,null));};exports[_0x17a5('0x5c')]=function(_0xe84ca1,_0x2ede16,_0x360590){var _0x3d6aa4;return db[_0x17a5('0x3b')][_0x17a5('0x5c')](_0xe84ca1[_0x17a5('0x5b')],{'raw':!![]})['then'](function(_0x1d8f78){_0x3d6aa4=_0x1d8f78;return db['Trunk']['findAll']({'raw':!![]});})[_0x17a5('0x1b')](function(_0x491d8d){var _0x2592c3=fs[_0x17a5('0x64')](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x67')),'utf8');var _0x1b2e6d=fs[_0x17a5('0x64')](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x68')),'utf8');var _0x512269=ejs['render'](_0x2592c3,{'trunks':_0x491d8d||[]});fs['writeFileSync'](_0x17a5('0x69'),_0x512269);if(_0x3d6aa4[_0x17a5('0x6a')]){var _0x3c5b52=ejs[_0x17a5('0x6b')](_0x1b2e6d,{'trunks':_0x491d8d||[]});fs['writeFileSync'](_0x17a5('0x6c'),_0x3c5b52);}})[_0x17a5('0x1b')](function(){return respondWithRpcPromise('Reload',_0x17a5('0x5c'),{'module':'chan_sip.so'});})[_0x17a5('0x1b')](function(){var _0xde4842=_0xe84ca1[_0x17a5('0x5d')][_0x17a5('0x33')]({'plain':!![]});if(!_0xde4842)throw new Error(_0x17a5('0x5e'));if(_0xde4842[_0x17a5('0x5f')]===_0x17a5('0x5d')){var _0x4fe3f4=_0x3d6aa4[_0x17a5('0x33')]({'plain':!![]});return db[_0x17a5('0x60')]['find']({'where':{'name':'Trunks','userProfileId':_0xde4842[_0x17a5('0x61')]},'raw':!![]})['then'](function(_0x573015){if(_0x573015&&_0x573015[_0x17a5('0x62')]===0x0){return db[_0x17a5('0x35')][_0x17a5('0x5c')]({'name':_0x4fe3f4[_0x17a5('0x37')],'resourceId':_0x4fe3f4['id'],'type':_0x573015[_0x17a5('0x37')],'sectionId':_0x573015['id']},{})[_0x17a5('0x1b')](function(){return _0x3d6aa4;});}else{return _0x3d6aa4;}})[_0x17a5('0x25')](function(_0x348ad5){logger[_0x17a5('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x348ad5);throw _0x348ad5;});}return _0x3d6aa4;})[_0x17a5('0x1b')](respondWithResult(_0x2ede16,0xc9))['catch'](handleError(_0x2ede16,null));};exports[_0x17a5('0x31')]=function(_0x29b88c,_0xd91e8c,_0x41ef3e){var _0x3397fe;return db[_0x17a5('0x3b')][_0x17a5('0x56')]({'where':{'id':_0x29b88c[_0x17a5('0x54')]['id']}})[_0x17a5('0x1b')](handleEntityNotFound(_0xd91e8c,null))[_0x17a5('0x1b')](saveUpdates(_0x29b88c[_0x17a5('0x5b')],null))[_0x17a5('0x1b')](function(_0x16f363){if(_0x16f363){_0x3397fe=_0x16f363;return db[_0x17a5('0x3b')][_0x17a5('0x6d')]({'raw':!![]});}})[_0x17a5('0x1b')](function(_0x4d35cb){if(_0x4d35cb){var _0x1e3544=fs['readFileSync'](path[_0x17a5('0x65')](config['root'],_0x17a5('0x67')),_0x17a5('0x6e'));var _0x2d9f2b=fs[_0x17a5('0x64')](path[_0x17a5('0x65')](config['root'],'server/files/templates/registry.ejs'),_0x17a5('0x6e'));var _0x1c4d89=ejs[_0x17a5('0x6b')](_0x1e3544,{'trunks':_0x4d35cb||[]});fs[_0x17a5('0x6f')](_0x17a5('0x69'),_0x1c4d89);var _0x3dd46c=ejs['render'](_0x2d9f2b,{'trunks':_0x4d35cb||[]});fs['writeFileSync'](_0x17a5('0x6c'),_0x3dd46c);return respondWithRpcPromise('Reload',_0x17a5('0x31'),{'module':'chan_sip.so'});}return null;})[_0x17a5('0x1b')](function(_0x5a9a4e){if(_0x5a9a4e){return _0x3397fe;}})[_0x17a5('0x1b')](respondWithResult(_0xd91e8c,null))[_0x17a5('0x25')](handleError(_0xd91e8c,null));};exports[_0x17a5('0x32')]=function(_0x92570e,_0x65379f,_0x493569){var _0x5bb25c;return db[_0x17a5('0x3b')][_0x17a5('0x56')]({'where':{'id':_0x92570e[_0x17a5('0x54')]['id']}})[_0x17a5('0x1b')](handleEntityNotFound(_0x65379f,null))['then'](removeEntity(_0x65379f,null))[_0x17a5('0x1b')](function(){return db[_0x17a5('0x3b')]['findAll']({'raw':!![]});})[_0x17a5('0x1b')](function(_0x4b88cb){var _0xae2e7a=fs['readFileSync'](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x67')),_0x17a5('0x6e'));var _0x1f9708=fs['readFileSync'](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x68')),'utf8');var _0x2725bf=ejs[_0x17a5('0x6b')](_0xae2e7a,{'trunks':_0x4b88cb});var _0x20f9d8=ejs[_0x17a5('0x6b')](_0x1f9708,{'trunks':_0x4b88cb});fs['writeFileSync'](_0x17a5('0x69'),_0x2725bf);fs[_0x17a5('0x6f')]('/etc/asterisk/sip_xcally_registers.conf',_0x20f9d8);return respondWithRpcPromise(_0x17a5('0x70'),'destroy',{'module':'chan_sip.so'});})[_0x17a5('0x25')](handleError(_0x65379f,null));}; \ No newline at end of file +var _0x692e=['json','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','stack','name','index','Trunk','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','clone','find','get','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','UserProfileSection','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end'];(function(_0x1dceb6,_0x102bd4){var _0x559e89=function(_0x365465){while(--_0x365465){_0x1dceb6['push'](_0x1dceb6['shift']());}};_0x559e89(++_0x102bd4);}(_0x692e,0xb4));var _0xe692=function(_0x5e951b,_0x43e699){_0x5e951b=_0x5e951b-0x0;var _0x5ea88e=_0x692e[_0x5e951b];return _0x5ea88e;};'use strict';var pdf=require(_0xe692('0x0'));var emlformat=require(_0xe692('0x1'));var rimraf=require(_0xe692('0x2'));var zipdir=require(_0xe692('0x3'));var jsonpatch=require(_0xe692('0x4'));var rp=require(_0xe692('0x5'));var moment=require('moment');var BPromise=require(_0xe692('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe692('0x7'));var csv=require(_0xe692('0x8'));var ejs=require(_0xe692('0x9'));var fs=require('fs');var _=require(_0xe692('0xa'));var squel=require(_0xe692('0xb'));var crypto=require(_0xe692('0xc'));var jsforce=require(_0xe692('0xd'));var deskjs=require(_0xe692('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe692('0xf'));var Papa=require(_0xe692('0x10'));var Redis=require(_0xe692('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe692('0x12'));var as=require(_0xe692('0x13'));var hardwareService=require(_0xe692('0x14'));var logger=require(_0xe692('0x15'))(_0xe692('0x16'));var utils=require(_0xe692('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe692('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x273363,_0x13e3a3,_0x18adc7,_0x31674c){return new BPromise(function(_0x47b040,_0x4114c7){var _0x3580cc=_0x31674c||client;return _0x3580cc[_0xe692('0x19')](_0x273363,_0x18adc7)['then'](function(_0x2acbf1){logger[_0xe692('0x1a')](_0xe692('0x1b'),_0x13e3a3,_0xe692('0x1c'));logger[_0xe692('0x1d')](_0xe692('0x1e'),_0x13e3a3,_0xe692('0x1c'),JSON['stringify'](_0x2acbf1));if(_0x2acbf1[_0xe692('0x1f')]){if(_0x2acbf1[_0xe692('0x1f')][_0xe692('0x20')]===0x1f4){logger[_0xe692('0x1f')](_0xe692('0x1b'),_0x13e3a3,_0x2acbf1['error'][_0xe692('0x21')]);return _0x4114c7(_0x2acbf1[_0xe692('0x1f')]['message']);}logger[_0xe692('0x1f')](_0xe692('0x1b'),_0x13e3a3,_0x2acbf1[_0xe692('0x1f')][_0xe692('0x21')]);return _0x47b040(_0x2acbf1['error'][_0xe692('0x21')]);}else{logger[_0xe692('0x1a')]('Trunk,\x20%s,\x20%s',_0x13e3a3,_0xe692('0x1c'));_0x47b040(_0x2acbf1['result'][_0xe692('0x21')]);}})[_0xe692('0x22')](function(_0x509d3d){logger[_0xe692('0x1f')](_0xe692('0x1b'),_0x13e3a3,_0x509d3d);_0x4114c7(_0x509d3d);});});}function respondWithStatusCode(_0x3e7ac5,_0x386180){_0x386180=_0x386180||0xcc;return function(_0x52bdd6){if(_0x52bdd6){return _0x3e7ac5[_0xe692('0x23')](_0x386180);}return _0x3e7ac5[_0xe692('0x24')](_0x386180)[_0xe692('0x25')]();};}function respondWithResult(_0x342a8a,_0x31378e){_0x31378e=_0x31378e||0xc8;return function(_0xfddf54){if(_0xfddf54){return _0x342a8a[_0xe692('0x24')](_0x31378e)[_0xe692('0x26')](_0xfddf54);}};}function respondWithFilteredResult(_0x1ca456,_0x412568){return function(_0x34e501){if(_0x34e501){var _0x5cfa64=_0x34e501[_0xe692('0x27')],_0xca229a=_0x412568['offset'],_0x488703=_0x412568['offset']+_0x412568['limit'],_0x317669;if(_0x488703>=_0x5cfa64){_0x488703=_0x5cfa64;_0x317669=0xc8;}else{_0x317669=0xce;}_0x1ca456[_0xe692('0x24')](_0x317669);return _0x1ca456[_0xe692('0x28')](_0xe692('0x29'),_0xca229a+'-'+_0x488703+'/'+_0x5cfa64)[_0xe692('0x26')](_0x34e501);}return null;};}function patchUpdates(_0x46577d){return function(_0x2d8faa){try{jsonpatch[_0xe692('0x2a')](_0x2d8faa,_0x46577d,!![]);}catch(_0x5547a0){return BPromise[_0xe692('0x2b')](_0x5547a0);}return _0x2d8faa[_0xe692('0x2c')]();};}function saveUpdates(_0x30dc77,_0x2f86c1){return function(_0xbacfe4){if(_0xbacfe4){return _0xbacfe4[_0xe692('0x2d')](_0x30dc77)[_0xe692('0x2e')](function(_0x27a57f){return _0x27a57f;});}return null;};}function removeEntity(_0x3d2fcc,_0x46e0a3){return function(_0x2e434d){if(_0x2e434d){return _0x2e434d[_0xe692('0x2f')]()['then'](function(){var _0x1200be=_0x2e434d['get']({'plain':!![]});var _0x5e2ff9=_0xe692('0x30');return db[_0xe692('0x31')][_0xe692('0x2f')]({'where':{'type':_0x5e2ff9,'resourceId':_0x1200be['id']}})['then'](function(){return _0x2e434d;});})[_0xe692('0x2e')](function(){_0x3d2fcc[_0xe692('0x24')](0xcc)[_0xe692('0x25')]();});}};}function handleEntityNotFound(_0x4c4ab2,_0x3b3d65){return function(_0x1d08d4){if(!_0x1d08d4){_0x4c4ab2[_0xe692('0x23')](0x194);}return _0x1d08d4;};}function handleError(_0x1202e3,_0x338c96){_0x338c96=_0x338c96||0x1f4;return function(_0x33d079){logger[_0xe692('0x1f')](_0x33d079[_0xe692('0x32')]);if(_0x33d079[_0xe692('0x33')]){delete _0x33d079[_0xe692('0x33')];}_0x1202e3[_0xe692('0x24')](_0x338c96)['send'](_0x33d079);};}exports[_0xe692('0x34')]=function(_0x50076e,_0xaef720){var _0x2c26a6={},_0x38d412={},_0x4ad01b={'count':0x0,'rows':[]};var _0x2b300d=_['map'](db[_0xe692('0x35')][_0xe692('0x36')],function(_0x4957b9){return{'name':_0x4957b9['fieldName'],'type':_0x4957b9[_0xe692('0x37')][_0xe692('0x38')]};});_0x38d412[_0xe692('0x39')]=_[_0xe692('0x3a')](_0x2b300d,'name');_0x38d412['query']=_[_0xe692('0x3b')](_0x50076e[_0xe692('0x3c')]);_0x38d412[_0xe692('0x3d')]=_[_0xe692('0x3e')](_0x38d412[_0xe692('0x39')],_0x38d412['query']);_0x2c26a6[_0xe692('0x3f')]=_[_0xe692('0x3e')](_0x38d412[_0xe692('0x39')],qs[_0xe692('0x40')](_0x50076e[_0xe692('0x3c')][_0xe692('0x40')]));_0x2c26a6[_0xe692('0x3f')]=_0x2c26a6[_0xe692('0x3f')]['length']?_0x2c26a6[_0xe692('0x3f')]:_0x38d412['model'];if(!_0x50076e[_0xe692('0x3c')]['hasOwnProperty'](_0xe692('0x41'))){_0x2c26a6[_0xe692('0x42')]=qs[_0xe692('0x42')](_0x50076e[_0xe692('0x3c')]['limit']);_0x2c26a6[_0xe692('0x43')]=qs[_0xe692('0x43')](_0x50076e['query'][_0xe692('0x43')]);}_0x2c26a6[_0xe692('0x44')]=qs[_0xe692('0x45')](_0x50076e[_0xe692('0x3c')][_0xe692('0x45')]);_0x2c26a6[_0xe692('0x46')]=qs[_0xe692('0x3d')](_[_0xe692('0x47')](_0x50076e[_0xe692('0x3c')],_0x38d412[_0xe692('0x3d')]),_0x2b300d);if(_0x50076e[_0xe692('0x3c')][_0xe692('0x48')]){_0x2c26a6[_0xe692('0x46')]=_[_0xe692('0x49')](_0x2c26a6[_0xe692('0x46')],{'$or':_[_0xe692('0x3a')](_0x2b300d,function(_0xf50bfa){if(_0xf50bfa[_0xe692('0x37')]!==_0xe692('0x4a')){var _0xb7aa2c={};_0xb7aa2c[_0xf50bfa[_0xe692('0x33')]]={'$like':'%'+_0x50076e[_0xe692('0x3c')][_0xe692('0x48')]+'%'};return _0xb7aa2c;}})});}_0x2c26a6=_[_0xe692('0x49')]({},_0x2c26a6,_0x50076e[_0xe692('0x4b')]);var _0x35480d={'where':_0x2c26a6[_0xe692('0x46')]};return db['Trunk']['count'](_0x35480d)[_0xe692('0x2e')](function(_0x12bb76){_0x4ad01b['count']=_0x12bb76;if(_0x50076e[_0xe692('0x3c')][_0xe692('0x4c')]){_0x2c26a6[_0xe692('0x4d')]=[{'all':!![]}];}return db[_0xe692('0x35')][_0xe692('0x4e')](_0x2c26a6);})[_0xe692('0x2e')](function(_0xd3fc2c){_0x4ad01b[_0xe692('0x4f')]=_0xd3fc2c;return _0x4ad01b;})[_0xe692('0x2e')](respondWithFilteredResult(_0xaef720,_0x2c26a6))[_0xe692('0x22')](handleError(_0xaef720,null));};exports[_0xe692('0x50')]=function(_0x505918,_0x20ba2a){var _0xe8cec9={'raw':![],'where':{'id':_0x505918[_0xe692('0x51')]['id']}},_0xc3fa58={};_0xc3fa58[_0xe692('0x39')]=_['keys'](db[_0xe692('0x35')]['rawAttributes']);_0xc3fa58['query']=_[_0xe692('0x3b')](_0x505918[_0xe692('0x3c')]);_0xc3fa58[_0xe692('0x3d')]=_[_0xe692('0x3e')](_0xc3fa58['model'],_0xc3fa58[_0xe692('0x3c')]);_0xe8cec9[_0xe692('0x3f')]=_[_0xe692('0x3e')](_0xc3fa58['model'],qs['fields'](_0x505918[_0xe692('0x3c')]['fields']));_0xe8cec9[_0xe692('0x3f')]=_0xe8cec9[_0xe692('0x3f')][_0xe692('0x52')]?_0xe8cec9[_0xe692('0x3f')]:_0xc3fa58['model'];if(_0x505918[_0xe692('0x3c')][_0xe692('0x4c')]){_0xe8cec9[_0xe692('0x4d')]=[{'all':!![]}];}_0xe8cec9=_[_0xe692('0x49')]({},_0xe8cec9,_0x505918[_0xe692('0x4b')]);return db[_0xe692('0x35')]['find'](_0xe8cec9)['then'](handleEntityNotFound(_0x20ba2a,null))[_0xe692('0x2e')](respondWithResult(_0x20ba2a,null))[_0xe692('0x22')](handleError(_0x20ba2a,null));};exports[_0xe692('0x53')]=function(_0xe6bc3a,_0x2b6bca){var _0x46364a={'where':{'id':_0xe6bc3a[_0xe692('0x51')]['id']}},_0x3d12e1={};_0x3d12e1['model']=_[_0xe692('0x3b')](db[_0xe692('0x35')][_0xe692('0x36')]);_0x46364a[_0xe692('0x3f')]=_[_0xe692('0x3e')](_0x3d12e1[_0xe692('0x39')],qs[_0xe692('0x40')](_0xe6bc3a[_0xe692('0x3c')][_0xe692('0x40')]));_0x46364a[_0xe692('0x3f')]=_0x46364a['attributes'][_0xe692('0x52')]?_0x46364a[_0xe692('0x3f')]:_0x3d12e1[_0xe692('0x39')];if(_0xe6bc3a[_0xe692('0x3c')][_0xe692('0x4c')]){_0x46364a[_0xe692('0x4d')]=[{'all':!![]}];}_0x46364a=_[_0xe692('0x49')]({},_0x46364a,_0xe6bc3a[_0xe692('0x4b')]);return db['Trunk'][_0xe692('0x54')](_0x46364a)[_0xe692('0x2e')](handleEntityNotFound(_0x2b6bca,null))[_0xe692('0x2e')](function(_0x35f9c1){if(_0x35f9c1){var _0x4d0ddd=_0x35f9c1[_0xe692('0x55')]({'plain':!![]});_0x4d0ddd=qs['omit'](_0x4d0ddd,['id',_0xe692('0x56'),_0xe692('0x57')]);_0xe6bc3a[_0xe692('0x58')]=_[_0xe692('0x59')](_0xe6bc3a[_0xe692('0x58')],['id',_0xe692('0x56'),_0xe692('0x57')]);return db[_0xe692('0x35')][_0xe692('0x5a')](_[_0xe692('0x49')](_0x4d0ddd,_0xe6bc3a[_0xe692('0x58')]),{'include':_0xe6bc3a[_0xe692('0x3c')][_0xe692('0x4c')]?[{'all':!![]}]:undefined})[_0xe692('0x2e')](function(_0x3e63d6){var _0x28968b=_0xe6bc3a[_0xe692('0x5b')][_0xe692('0x55')]({'plain':!![]});if(!_0x28968b)throw new Error(_0xe692('0x5c'));if(_0x28968b['role']===_0xe692('0x5b')){var _0x5cc566=_0x3e63d6[_0xe692('0x55')]({'plain':!![]});var _0x52a59a=_0xe692('0x30');return db['UserProfileSection'][_0xe692('0x54')]({'where':{'name':_0x52a59a,'userProfileId':_0x28968b[_0xe692('0x5d')]},'raw':!![]})[_0xe692('0x2e')](function(_0x19462d){if(_0x19462d&&_0x19462d[_0xe692('0x5e')]===0x0){return db['UserProfileResource'][_0xe692('0x5a')]({'name':_0x5cc566['name'],'resourceId':_0x5cc566['id'],'type':_0x19462d[_0xe692('0x33')],'sectionId':_0x19462d['id']},{})[_0xe692('0x2e')](function(){return _0x3e63d6;});}else{return _0x3e63d6;}})[_0xe692('0x22')](function(_0x7b3c16){logger[_0xe692('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7b3c16);throw _0x7b3c16;});}return _0x3e63d6;});}})[_0xe692('0x2e')](respondWithResult(_0x2b6bca,0xc9))[_0xe692('0x22')](handleError(_0x2b6bca,null));};exports[_0xe692('0x5a')]=function(_0x2a141c,_0xa7d84f,_0xacce49){var _0x4eb003;return db[_0xe692('0x35')][_0xe692('0x5a')](_0x2a141c[_0xe692('0x58')],{'raw':!![]})[_0xe692('0x2e')](function(_0x1a8a7b){_0x4eb003=_0x1a8a7b;return db[_0xe692('0x35')][_0xe692('0x4e')]({'raw':!![]});})[_0xe692('0x2e')](function(_0x5cf565){var _0x5731eb=fs[_0xe692('0x5f')](path[_0xe692('0x60')](config[_0xe692('0x61')],_0xe692('0x62')),_0xe692('0x63'));var _0x3b7372=fs[_0xe692('0x5f')](path[_0xe692('0x60')](config['root'],_0xe692('0x64')),_0xe692('0x63'));var _0x553357=ejs[_0xe692('0x65')](_0x5731eb,{'trunks':_0x5cf565||[]});fs[_0xe692('0x66')](_0xe692('0x67'),_0x553357);if(_0x4eb003[_0xe692('0x68')]){var _0x389c33=ejs[_0xe692('0x65')](_0x3b7372,{'trunks':_0x5cf565||[]});fs[_0xe692('0x66')](_0xe692('0x69'),_0x389c33);}})[_0xe692('0x2e')](function(){return respondWithRpcPromise(_0xe692('0x6a'),_0xe692('0x5a'),{'module':'chan_sip.so'});})[_0xe692('0x2e')](function(){var _0x3ac9f8=_0x2a141c[_0xe692('0x5b')][_0xe692('0x55')]({'plain':!![]});if(!_0x3ac9f8)throw new Error(_0xe692('0x5c'));if(_0x3ac9f8['role']===_0xe692('0x5b')){var _0x31bf31=_0x4eb003[_0xe692('0x55')]({'plain':!![]});return db[_0xe692('0x6b')]['find']({'where':{'name':_0xe692('0x30'),'userProfileId':_0x3ac9f8[_0xe692('0x5d')]},'raw':!![]})[_0xe692('0x2e')](function(_0x5b729a){if(_0x5b729a&&_0x5b729a['autoAssociation']===0x0){return db[_0xe692('0x31')][_0xe692('0x5a')]({'name':_0x31bf31[_0xe692('0x33')],'resourceId':_0x31bf31['id'],'type':_0x5b729a[_0xe692('0x33')],'sectionId':_0x5b729a['id']},{})[_0xe692('0x2e')](function(){return _0x4eb003;});}else{return _0x4eb003;}})[_0xe692('0x22')](function(_0x5ea50e){logger[_0xe692('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ea50e);throw _0x5ea50e;});}return _0x4eb003;})[_0xe692('0x2e')](respondWithResult(_0xa7d84f,0xc9))[_0xe692('0x22')](handleError(_0xa7d84f,null));};exports[_0xe692('0x2d')]=function(_0x2c1ce9,_0x5ed8c8,_0x68c479){var _0x3fd183;return db[_0xe692('0x35')]['find']({'where':{'id':_0x2c1ce9[_0xe692('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ed8c8,null))[_0xe692('0x2e')](saveUpdates(_0x2c1ce9[_0xe692('0x58')],null))['then'](function(_0xf03d0a){if(_0xf03d0a){_0x3fd183=_0xf03d0a;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x9e897c){if(_0x9e897c){var _0x3a77f5=fs[_0xe692('0x5f')](path[_0xe692('0x60')](config['root'],_0xe692('0x62')),_0xe692('0x63'));var _0x3fdcf2=fs[_0xe692('0x5f')](path[_0xe692('0x60')](config[_0xe692('0x61')],'server/files/templates/registry.ejs'),_0xe692('0x63'));var _0x2817da=ejs['render'](_0x3a77f5,{'trunks':_0x9e897c||[]});fs[_0xe692('0x66')](_0xe692('0x67'),_0x2817da);var _0x1064ac=ejs[_0xe692('0x65')](_0x3fdcf2,{'trunks':_0x9e897c||[]});fs['writeFileSync'](_0xe692('0x69'),_0x1064ac);return respondWithRpcPromise(_0xe692('0x6a'),_0xe692('0x2d'),{'module':_0xe692('0x6c')});}return null;})[_0xe692('0x2e')](function(_0x14c215){if(_0x14c215){return _0x3fd183;}})[_0xe692('0x2e')](respondWithResult(_0x5ed8c8,null))[_0xe692('0x22')](handleError(_0x5ed8c8,null));};exports['destroy']=function(_0x3d02ae,_0x4a6c65,_0x34d235){var _0x459b5f;return db['Trunk'][_0xe692('0x54')]({'where':{'id':_0x3d02ae[_0xe692('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a6c65,null))[_0xe692('0x2e')](removeEntity(_0x4a6c65,null))[_0xe692('0x2e')](function(){return db[_0xe692('0x35')][_0xe692('0x4e')]({'raw':!![]});})[_0xe692('0x2e')](function(_0x555c6a){var _0x546e8f=fs[_0xe692('0x5f')](path['join'](config[_0xe692('0x61')],_0xe692('0x62')),'utf8');var _0x39156f=fs[_0xe692('0x5f')](path[_0xe692('0x60')](config[_0xe692('0x61')],_0xe692('0x64')),_0xe692('0x63'));var _0x2f6e91=ejs[_0xe692('0x65')](_0x546e8f,{'trunks':_0x555c6a});var _0x516dfa=ejs[_0xe692('0x65')](_0x39156f,{'trunks':_0x555c6a});fs[_0xe692('0x66')](_0xe692('0x67'),_0x2f6e91);fs['writeFileSync'](_0xe692('0x69'),_0x516dfa);return respondWithRpcPromise(_0xe692('0x6a'),_0xe692('0x2f'),{'module':_0xe692('0x6c')});})[_0xe692('0x22')](handleError(_0x4a6c65,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1c68fbb..4602714 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 _0x2eeb=['path','rimraf','define','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe6a9f9,_0x1d399d){var _0x3a80fe=function(_0x1365e0){while(--_0x1365e0){_0xe6a9f9['push'](_0xe6a9f9['shift']());}};_0x3a80fe(++_0x1d399d);}(_0x2eeb,0x7d));var _0xb2ee=function(_0x3ba0da,_0x3a68f2){_0x3ba0da=_0x3ba0da-0x0;var _0x3b7d84=_0x2eeb[_0x3ba0da];return _0x3b7d84;};'use strict';var _=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var logger=require(_0xb2ee('0x2'))(_0xb2ee('0x3'));var moment=require(_0xb2ee('0x4'));var BPromise=require(_0xb2ee('0x5'));var rp=require(_0xb2ee('0x6'));var fs=require('fs');var path=require(_0xb2ee('0x7'));var rimraf=require(_0xb2ee('0x8'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module['exports']=function(_0x42f4ff,_0x4a80ab){return _0x42f4ff[_0xb2ee('0x9')]('Trunk',attributes,{'tableName':_0xb2ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf68=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','Trunk','lodash','util'];(function(_0x4c13e8,_0xf9404c){var _0x54d57e=function(_0x52afc5){while(--_0x52afc5){_0x4c13e8['push'](_0x4c13e8['shift']());}};_0x54d57e(++_0xf9404c);}(_0xdf68,0x1ca));var _0x8df6=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0xdf68[_0x592d48];return _0x5d789e;};'use strict';var _=require(_0x8df6('0x0'));var util=require(_0x8df6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8df6('0x2'));var BPromise=require(_0x8df6('0x3'));var rp=require(_0x8df6('0x4'));var fs=require('fs');var path=require(_0x8df6('0x5'));var rimraf=require(_0x8df6('0x6'));var config=require(_0x8df6('0x7'));var attributes=require(_0x8df6('0x8'));module['exports']=function(_0x4059c1,_0x7e9275){return _0x4059c1['define'](_0x8df6('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 807f0dc..1f1cdd4 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 _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowTrunk','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4751d6,_0x2911a1){var _0x55e2c3=function(_0x420a54){while(--_0x420a54){_0x4751d6['push'](_0x4751d6['shift']());}};_0x55e2c3(++_0x2911a1);}(_0xb10b,0x12a));var _0xbb10=function(_0x96691d,_0x544a9d){_0x96691d=_0x96691d-0x0;var _0x5a79ca=_0xb10b[_0x96691d];return _0x5a79ca;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetTrunk',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowTrunk']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowTrunk',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ 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(_0x43212c,_0x1da7be){var _0x4f9c2c=function(_0x298acb){while(--_0x298acb){_0x43212c['push'](_0x43212c['shift']());}};_0x4f9c2c(++_0x1da7be);}(_0x14a0,0x8e));var _0x014a=function(_0x15c7f8,_0x2a3e5e){_0x15c7f8=_0x15c7f8-0x0;var _0xfcfeae=_0x14a0[_0x15c7f8];return _0xfcfeae;};'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 ceb7cff..9fe3d14 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 _0xfeef=['bulkCreate','post','addQueues','diskStorage','join','format','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','addSquareProjects','createApiKey','/:id','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','whoami','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','create'];(function(_0x5544ef,_0x5030df){var _0x35ad53=function(_0x179bb0){while(--_0x179bb0){_0x5544ef['push'](_0x5544ef['shift']());}};_0x35ad53(++_0x5030df);}(_0xfeef,0x11b));var _0xffee=function(_0x2ee47b,_0x137886){_0x2ee47b=_0x2ee47b-0x0;var _0x4ee090=_0xfeef[_0x2ee47b];return _0x4ee090;};'use strict';var multer=require(_0xffee('0x0'));var util=require(_0xffee('0x1'));var path=require(_0xffee('0x2'));var timeout=require(_0xffee('0x3'));var express=require('express');var router=express[_0xffee('0x4')]();var auth=require(_0xffee('0x5'));var interaction=require(_0xffee('0x6'));var config=require(_0xffee('0x7'));var controller=require(_0xffee('0x8'));router['get']('/',auth[_0xffee('0x9')](),controller[_0xffee('0xa')]);router[_0xffee('0xb')](_0xffee('0xc'),auth[_0xffee('0x9')](),controller[_0xffee('0xd')]);router['get']('/whoami',auth[_0xffee('0x9')](),controller[_0xffee('0xe')]);router[_0xffee('0xb')]('/:id',auth[_0xffee('0x9')](),controller[_0xffee('0xf')]);router[_0xffee('0xb')]('/:id/avatar',controller[_0xffee('0x10')]);router[_0xffee('0xb')](_0xffee('0x11'),auth['isAuthenticated'](),controller[_0xffee('0x12')]);router[_0xffee('0xb')](_0xffee('0x13'),auth[_0xffee('0x9')](),controller[_0xffee('0x14')]);router[_0xffee('0xb')](_0xffee('0x15'),auth[_0xffee('0x9')](),controller[_0xffee('0x16')]);router['get'](_0xffee('0x17'),auth[_0xffee('0x9')](),controller[_0xffee('0x18')]);router[_0xffee('0xb')](_0xffee('0x19'),auth['isAuthenticated'](),controller[_0xffee('0x1a')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xffee('0x1b')]);router[_0xffee('0xb')](_0xffee('0x1c'),auth[_0xffee('0x9')](),controller[_0xffee('0x1d')]);router[_0xffee('0xb')](_0xffee('0x1e'),auth[_0xffee('0x9')](),controller[_0xffee('0x1f')]);router[_0xffee('0xb')](_0xffee('0x20'),auth[_0xffee('0x9')](),controller[_0xffee('0x21')]);router[_0xffee('0xb')](_0xffee('0x22'),auth[_0xffee('0x9')](),controller[_0xffee('0x23')]);router[_0xffee('0xb')](_0xffee('0x24'),auth['isAuthenticated'](),controller[_0xffee('0x25')]);router[_0xffee('0xb')](_0xffee('0x26'),auth[_0xffee('0x9')](),controller['getWhatsappInteractions']);router[_0xffee('0xb')](_0xffee('0x27'),auth[_0xffee('0x9')](),controller[_0xffee('0x28')]);router[_0xffee('0xb')]('/:id/lists',auth['isAuthenticated'](),controller[_0xffee('0x29')]);router['get']('/:id/agents',auth[_0xffee('0x9')](),controller['getAgents']);router[_0xffee('0xb')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xffee('0x2a')]);router[_0xffee('0xb')](_0xffee('0x2b'),auth[_0xffee('0x9')](),controller[_0xffee('0x2c')]);router[_0xffee('0xb')](_0xffee('0x2d'),auth[_0xffee('0x9')](),controller['getMailAccounts']);router['get'](_0xffee('0x2e'),auth[_0xffee('0x9')](),controller[_0xffee('0x2f')]);router[_0xffee('0xb')](_0xffee('0x30'),auth[_0xffee('0x9')](),controller[_0xffee('0x31')]);router[_0xffee('0xb')]('/:id/chat_websites',auth[_0xffee('0x9')](),controller[_0xffee('0x32')]);router['get'](_0xffee('0x33'),auth['isAuthenticated'](),controller[_0xffee('0x34')]);router[_0xffee('0xb')](_0xffee('0x35'),auth[_0xffee('0x9')](),controller['getSquareProjects']);router[_0xffee('0xb')](_0xffee('0x36'),auth['isAuthenticated'](),controller[_0xffee('0x37')]);router[_0xffee('0xb')](_0xffee('0x38'),auth[_0xffee('0x9')](),controller[_0xffee('0x39')]);router['post'](_0xffee('0x11'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0xffee('0x9')](),controller[_0xffee('0x3a')]);router['post']('/create_many',auth[_0xffee('0x9')](),controller[_0xffee('0x3b')]);router[_0xffee('0x3c')](_0xffee('0x13'),auth[_0xffee('0x9')](),controller[_0xffee('0x3d')]);var upload=multer({'storage':multer[_0xffee('0x3e')]({'destination':function(_0xcfe692,_0x111748,_0x4f3b07){_0x4f3b07(null,path[_0xffee('0x3f')](config['root'],'server/files/images/'));},'filename':function(_0x525fce,_0x4b061b,_0x2a2cb4){_0x2a2cb4(null,util[_0xffee('0x40')](_0xffee('0x41'),Date['now'](),_0x4b061b[_0xffee('0x42')]));}})});router[_0xffee('0x3c')](_0xffee('0x43'),upload[_0xffee('0x44')](_0xffee('0x45')),controller[_0xffee('0x46')]);router[_0xffee('0x3c')](_0xffee('0x47'),auth[_0xffee('0x9')](),controller[_0xffee('0x48')]);router[_0xffee('0x3c')]('/:id/logout',auth[_0xffee('0x9')](),controller['logout']);router[_0xffee('0x3c')]('/:id/pause',auth[_0xffee('0x9')](),controller['pause']);router[_0xffee('0x3c')](_0xffee('0x49'),auth['isAuthenticated'](),controller[_0xffee('0x4a')]);router[_0xffee('0x3c')](_0xffee('0x27'),auth[_0xffee('0x9')](),controller[_0xffee('0x4b')]);router['post'](_0xffee('0x4c'),auth[_0xffee('0x9')](),controller[_0xffee('0x4d')]);router[_0xffee('0x3c')]('/:id/mail_interactions',auth[_0xffee('0x9')](),controller[_0xffee('0x4e')]);router[_0xffee('0x3c')](_0xffee('0x4f'),auth['isAuthenticated'](),controller[_0xffee('0x50')]);router[_0xffee('0x3c')](_0xffee('0x51'),auth[_0xffee('0x9')](),controller[_0xffee('0x52')]);router[_0xffee('0x3c')](_0xffee('0x53'),auth[_0xffee('0x9')](),controller[_0xffee('0x54')]);router[_0xffee('0x3c')](_0xffee('0x55'),auth[_0xffee('0x9')](),controller['addWhatsappInteractions']);router[_0xffee('0x3c')](_0xffee('0x2b'),auth[_0xffee('0x9')](),controller[_0xffee('0x56')]);router[_0xffee('0x3c')](_0xffee('0x2d'),auth['isAuthenticated'](),controller[_0xffee('0x57')]);router[_0xffee('0x3c')](_0xffee('0x2e'),auth[_0xffee('0x9')](),controller[_0xffee('0x58')]);router['post'](_0xffee('0x30'),auth[_0xffee('0x9')](),controller[_0xffee('0x59')]);router['post'](_0xffee('0x5a'),auth[_0xffee('0x9')](),controller['addChatWebsites']);router[_0xffee('0x3c')]('/:id/whatsapp_accounts',auth[_0xffee('0x9')](),controller[_0xffee('0x5b')]);router[_0xffee('0x3c')]('/:id/square_projects',auth[_0xffee('0x9')](),controller[_0xffee('0x5c')]);router[_0xffee('0x3c')](_0xffee('0x38'),auth[_0xffee('0x9')](),controller[_0xffee('0x5d')]);router['put'](_0xffee('0x5e'),auth[_0xffee('0x9')](),controller[_0xffee('0x5f')]);router[_0xffee('0x60')](_0xffee('0x61'),auth['isAuthenticated'](),controller[_0xffee('0x62')]);router[_0xffee('0x63')](_0xffee('0x13'),auth[_0xffee('0x9')](),controller[_0xffee('0x64')]);router[_0xffee('0x63')](_0xffee('0x27'),auth[_0xffee('0x9')](),controller[_0xffee('0x65')]);router[_0xffee('0x63')](_0xffee('0x5e'),auth[_0xffee('0x9')](),controller['destroy']);router[_0xffee('0x63')](_0xffee('0x4c'),auth[_0xffee('0x9')](),controller['removeChatInteractions']);router[_0xffee('0x63')](_0xffee('0x66'),auth[_0xffee('0x9')](),controller[_0xffee('0x67')]);router[_0xffee('0x63')](_0xffee('0x4f'),auth[_0xffee('0x9')](),controller[_0xffee('0x68')]);router[_0xffee('0x63')](_0xffee('0x51'),auth[_0xffee('0x9')](),controller[_0xffee('0x69')]);router[_0xffee('0x63')](_0xffee('0x53'),auth['isAuthenticated'](),controller[_0xffee('0x6a')]);router[_0xffee('0x63')](_0xffee('0x55'),auth['isAuthenticated'](),controller[_0xffee('0x6b')]);router[_0xffee('0x63')](_0xffee('0x2b'),auth[_0xffee('0x9')](),controller[_0xffee('0x6c')]);router[_0xffee('0x63')](_0xffee('0x2d'),auth[_0xffee('0x9')](),controller['removeMailAccounts']);router[_0xffee('0x63')](_0xffee('0x2e'),auth[_0xffee('0x9')](),controller[_0xffee('0x6d')]);router[_0xffee('0x63')](_0xffee('0x30'),auth[_0xffee('0x9')](),controller[_0xffee('0x6e')]);router['delete'](_0xffee('0x5a'),auth[_0xffee('0x9')](),controller['removeChatWebsites']);router['delete']('/:id/whatsapp_accounts',auth[_0xffee('0x9')](),controller[_0xffee('0x6f')]);router['delete']('/:id/square_projects',auth[_0xffee('0x9')](),controller['removeSquareProjects']);router[_0xffee('0x63')](_0xffee('0x38'),auth[_0xffee('0x9')](),controller[_0xffee('0x70')]);module[_0xffee('0x71')]=router; \ No newline at end of file +var _0x98a1=['format','%s-%s','now','originalname','file','/:id/login','login','/:id/pause','pause','unpause','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addChatWebsites','/:id/whatsapp_accounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','whoami','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98a1,0x10e));var _0x198a=function(_0x5a84f5,_0x3b53e0){_0x5a84f5=_0x5a84f5-0x0;var _0x3333d7=_0x98a1[_0x5a84f5];return _0x3333d7;};'use strict';var multer=require(_0x198a('0x0'));var util=require('util');var path=require(_0x198a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x198a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x198a('0x3'));var config=require(_0x198a('0x4'));var controller=require(_0x198a('0x5'));router['get']('/',auth[_0x198a('0x6')](),controller[_0x198a('0x7')]);router[_0x198a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x198a('0x9')]);router[_0x198a('0x8')](_0x198a('0xa'),auth[_0x198a('0x6')](),controller[_0x198a('0xb')]);router[_0x198a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x198a('0xc')]);router[_0x198a('0x8')](_0x198a('0xd'),controller[_0x198a('0xe')]);router[_0x198a('0x8')](_0x198a('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0x198a('0x8')](_0x198a('0x10'),auth[_0x198a('0x6')](),controller[_0x198a('0x11')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x198a('0x12')]);router[_0x198a('0x8')](_0x198a('0x13'),auth[_0x198a('0x6')](),controller[_0x198a('0x14')]);router['get'](_0x198a('0x15'),auth[_0x198a('0x6')](),controller[_0x198a('0x16')]);router[_0x198a('0x8')]('/:id/screen_recordings',auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x198a('0x8')](_0x198a('0x17'),auth[_0x198a('0x6')](),controller[_0x198a('0x18')]);router[_0x198a('0x8')](_0x198a('0x19'),auth[_0x198a('0x6')](),controller['getOpenchannelInteractions']);router[_0x198a('0x8')](_0x198a('0x1a'),auth[_0x198a('0x6')](),controller['getMailInteractions']);router[_0x198a('0x8')](_0x198a('0x1b'),auth[_0x198a('0x6')](),controller[_0x198a('0x1c')]);router[_0x198a('0x8')](_0x198a('0x1d'),auth['isAuthenticated'](),controller[_0x198a('0x1e')]);router[_0x198a('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x198a('0x8')](_0x198a('0x1f'),auth[_0x198a('0x6')](),controller['getTeams']);router[_0x198a('0x8')](_0x198a('0x20'),auth['isAuthenticated'](),controller[_0x198a('0x21')]);router[_0x198a('0x8')](_0x198a('0x22'),auth[_0x198a('0x6')](),controller[_0x198a('0x23')]);router['get'](_0x198a('0x24'),auth['isAuthenticated'](),controller[_0x198a('0x25')]);router['get'](_0x198a('0x26'),auth[_0x198a('0x6')](),controller[_0x198a('0x27')]);router[_0x198a('0x8')]('/:id/mail_accounts',auth[_0x198a('0x6')](),controller[_0x198a('0x28')]);router['get']('/:id/openchannel_accounts',auth[_0x198a('0x6')](),controller[_0x198a('0x29')]);router[_0x198a('0x8')](_0x198a('0x2a'),auth[_0x198a('0x6')](),controller[_0x198a('0x2b')]);router['get'](_0x198a('0x2c'),auth[_0x198a('0x6')](),controller[_0x198a('0x2d')]);router[_0x198a('0x8')]('/:id/whatsapp_accounts',auth[_0x198a('0x6')](),controller[_0x198a('0x2e')]);router[_0x198a('0x8')](_0x198a('0x2f'),auth[_0x198a('0x6')](),controller[_0x198a('0x30')]);router[_0x198a('0x8')](_0x198a('0x31'),auth[_0x198a('0x6')](),controller['getScheduledCalls']);router[_0x198a('0x8')](_0x198a('0x32'),auth[_0x198a('0x6')](),controller[_0x198a('0x33')]);router['post'](_0x198a('0xf'),auth['isAuthenticated'](),controller[_0x198a('0x34')]);router[_0x198a('0x35')]('/',auth[_0x198a('0x6')](),controller['create']);router[_0x198a('0x35')](_0x198a('0x36'),auth[_0x198a('0x6')](),controller[_0x198a('0x37')]);router['post'](_0x198a('0x10'),auth['isAuthenticated'](),controller[_0x198a('0x38')]);var upload=multer({'storage':multer[_0x198a('0x39')]({'destination':function(_0x2f53c4,_0x41191e,_0x4ab137){_0x4ab137(null,path[_0x198a('0x3a')](config['root'],_0x198a('0x3b')));},'filename':function(_0x5d80de,_0x369494,_0x623e1b){_0x623e1b(null,util[_0x198a('0x3c')](_0x198a('0x3d'),Date[_0x198a('0x3e')](),_0x369494[_0x198a('0x3f')]));}})});router[_0x198a('0x35')](_0x198a('0xd'),upload['single'](_0x198a('0x40')),controller['addAvatar']);router[_0x198a('0x35')](_0x198a('0x41'),auth[_0x198a('0x6')](),controller[_0x198a('0x42')]);router[_0x198a('0x35')]('/:id/logout',auth[_0x198a('0x6')](),controller['logout']);router[_0x198a('0x35')](_0x198a('0x43'),auth[_0x198a('0x6')](),controller[_0x198a('0x44')]);router['post']('/:id/unpause',auth[_0x198a('0x6')](),controller[_0x198a('0x45')]);router['post'](_0x198a('0x1f'),auth[_0x198a('0x6')](),controller[_0x198a('0x46')]);router[_0x198a('0x35')]('/:id/chat_interactions',auth[_0x198a('0x6')](),controller['addChatInteractions']);router['post'](_0x198a('0x47'),auth[_0x198a('0x6')](),controller[_0x198a('0x48')]);router['post'](_0x198a('0x49'),auth[_0x198a('0x6')](),controller[_0x198a('0x4a')]);router[_0x198a('0x35')]('/:id/sms_interactions',auth[_0x198a('0x6')](),controller[_0x198a('0x4b')]);router[_0x198a('0x35')](_0x198a('0x4c'),auth[_0x198a('0x6')](),controller[_0x198a('0x4d')]);router[_0x198a('0x35')](_0x198a('0x4e'),auth[_0x198a('0x6')](),controller[_0x198a('0x4f')]);router[_0x198a('0x35')](_0x198a('0x26'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x198a('0x35')](_0x198a('0x50'),auth['isAuthenticated'](),controller[_0x198a('0x51')]);router[_0x198a('0x35')](_0x198a('0x52'),auth[_0x198a('0x6')](),controller['addOpenchannelAccounts']);router['post'](_0x198a('0x2a'),auth[_0x198a('0x6')](),controller['addSmsAccounts']);router[_0x198a('0x35')](_0x198a('0x2c'),auth[_0x198a('0x6')](),controller[_0x198a('0x53')]);router[_0x198a('0x35')](_0x198a('0x54'),auth[_0x198a('0x6')](),controller['addWhatsappAccounts']);router[_0x198a('0x35')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x198a('0x55')]);router[_0x198a('0x35')](_0x198a('0x32'),auth[_0x198a('0x6')](),controller[_0x198a('0x56')]);router[_0x198a('0x57')](_0x198a('0x58'),auth['isAuthenticated'](),controller[_0x198a('0x59')]);router[_0x198a('0x57')](_0x198a('0x5a'),auth['isAuthenticated'](),controller['changePassword']);router[_0x198a('0x5b')](_0x198a('0x10'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x198a('0x5b')](_0x198a('0x1f'),auth[_0x198a('0x6')](),controller[_0x198a('0x5c')]);router['delete'](_0x198a('0x58'),auth['isAuthenticated'](),controller[_0x198a('0x5d')]);router[_0x198a('0x5b')](_0x198a('0x5e'),auth[_0x198a('0x6')](),controller[_0x198a('0x5f')]);router[_0x198a('0x5b')](_0x198a('0x47'),auth[_0x198a('0x6')](),controller[_0x198a('0x60')]);router[_0x198a('0x5b')](_0x198a('0x49'),auth[_0x198a('0x6')](),controller[_0x198a('0x61')]);router[_0x198a('0x5b')](_0x198a('0x62'),auth['isAuthenticated'](),controller[_0x198a('0x63')]);router[_0x198a('0x5b')](_0x198a('0x4c'),auth['isAuthenticated'](),controller[_0x198a('0x64')]);router['delete'](_0x198a('0x4e'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0x198a('0x26'),auth['isAuthenticated'](),controller[_0x198a('0x65')]);router[_0x198a('0x5b')](_0x198a('0x50'),auth[_0x198a('0x6')](),controller[_0x198a('0x66')]);router[_0x198a('0x5b')](_0x198a('0x52'),auth[_0x198a('0x6')](),controller[_0x198a('0x67')]);router[_0x198a('0x5b')](_0x198a('0x2a'),auth['isAuthenticated'](),controller[_0x198a('0x68')]);router['delete'](_0x198a('0x2c'),auth[_0x198a('0x6')](),controller[_0x198a('0x69')]);router[_0x198a('0x5b')](_0x198a('0x54'),auth[_0x198a('0x6')](),controller[_0x198a('0x6a')]);router[_0x198a('0x5b')]('/:id/square_projects',auth[_0x198a('0x6')](),controller[_0x198a('0x6b')]);router[_0x198a('0x5b')](_0x198a('0x32'),auth[_0x198a('0x6')](),controller[_0x198a('0x6c')]);module[_0x198a('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f05f491..192d999 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 _0x3bad=['map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','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','actpass','showWebBar','isArray','wss','encryption','force_avp','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','avpf','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','TEXT','permissions'];(function(_0x7ae37,_0x37fc1d){var _0x1d1a9a=function(_0x4ab086){while(--_0x4ab086){_0x7ae37['push'](_0x7ae37['shift']());}};_0x1d1a9a(++_0x37fc1d);}(_0x3bad,0xc1));var _0xd3ba=function(_0x56937e,_0x1afc7d){_0x56937e=_0x56937e-0x0;var _0x337487=_0x3bad[_0x56937e];return _0x337487;};'use strict';var Sequelize=require(_0xd3ba('0x0'));var moment=require(_0xd3ba('0x1'));var util=require(_0xd3ba('0x2'));var _=require(_0xd3ba('0x3'));module[_0xd3ba('0x4')]={'name':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'unique':_0xd3ba('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x332e8b){this[_0xd3ba('0x7')]('name',_0x332e8b);this[_0xd3ba('0x7')](_0xd3ba('0x8'),_0x332e8b);},'comment':_0xd3ba('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x25665c){this['setDataValue'](_0xd3ba('0xa'),_0x25665c);this['setDataValue'](_0xd3ba('0xb'),util[_0xd3ba('0xc')]('\x22%s\x22\x20<%s>',_0x25665c,this[_0xd3ba('0xd')](_0xd3ba('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'unique':_0xd3ba('0xf'),'validate':{'isEmail':!![]},'set':function(_0x4c5e18){if(_0x4c5e18){this[_0xd3ba('0x7')](_0xd3ba('0xf'),_0x4c5e18[_0xd3ba('0x10')]());}}},'role':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x12'),_0xd3ba('0x13'),'agent',_0xd3ba('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':_0xd3ba('0x15')},'internal':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':![],'unique':_0xd3ba('0xe'),'set':function(_0xf55a06){this[_0xd3ba('0x7')](_0xd3ba('0xe'),_0xf55a06);this[_0xd3ba('0x7')](_0xd3ba('0x17'),_0xf55a06);this[_0xd3ba('0x7')](_0xd3ba('0xb'),util[_0xd3ba('0xc')](_0xd3ba('0x18'),this[_0xd3ba('0xd')](_0xd3ba('0xa')),_0xf55a06));}},'salt':{'type':Sequelize[_0xd3ba('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd3ba('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xd3ba('0x5')]},'userpic':{'type':Sequelize[_0xd3ba('0x5')]},'city':{'type':Sequelize[_0xd3ba('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd3ba('0x1a')]},'voicePause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':_0xd3ba('0x1b')},'lastPauseAt':{'type':Sequelize[_0xd3ba('0x1a')]},'chatCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd3ba('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd3ba('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x1c')},'ipaddr':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xd3ba('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x1d'),_0xd3ba('0x13'),_0xd3ba('0x1e')),'allowNull':!![],'defaultValue':_0xd3ba('0x1d')},'context':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x1f')},'callingpres':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x20'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xd3ba('0x21'),_0xd3ba('0x22'),'PROHIB_PASSED_SCREEN',_0xd3ba('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x24'),'set':function(_0x473779){this['setDataValue'](_0xd3ba('0x25'),_0x473779?_0x473779[_0xd3ba('0x26')](','):null);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x25'))?this['getDataValue'](_0xd3ba('0x25'))['split'](','):null;},'comment':_0xd3ba('0x27')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xd3ba('0x28'),_0xd3ba('0x29'),_0xd3ba('0x2a'),_0xd3ba('0x2b')),'allowNull':!![],'defaultValue':_0xd3ba('0x2c')},'directmedia':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no',_0xd3ba('0x2e'),_0xd3ba('0x2f'),_0xd3ba('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x11167f){this[_0xd3ba('0x7')](_0xd3ba('0x31'),_0x11167f?_0x11167f[_0xd3ba('0x26')](','):null);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x31'))?this[_0xd3ba('0xd')](_0xd3ba('0x31'))[_0xd3ba('0x32')](','):null;},'comment':_0xd3ba('0x33')},'callgroup':{'type':Sequelize[_0xd3ba('0x5')]},'namedcallgroup':{'type':Sequelize[_0xd3ba('0x5')]},'pickupgroup':{'type':Sequelize[_0xd3ba('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xd3ba('0x5')]},'language':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd3ba('0x5')]},'disallow':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'defaultValue':_0xd3ba('0x34')},'allow':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'defaultValue':_0xd3ba('0x35'),'set':function(_0x45983a){this[_0xd3ba('0x7')](_0xd3ba('0x36'),_0x45983a?_0x45983a[_0xd3ba('0x26')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xd3ba('0xd')]('allow')?this[_0xd3ba('0xd')]('allow')[_0xd3ba('0x32')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'set':function(_0x123852){this[_0xd3ba('0x7')]('insecure',_0x123852?_0x123852[_0xd3ba('0x26')](','):null);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x37'))?this[_0xd3ba('0xd')]('insecure')[_0xd3ba('0x32')](','):null;},'comment':_0xd3ba('0x38')},'trustrpid':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no',_0xd3ba('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x3a')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xd3ba('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd3ba('0x11')]('yes','no',_0xd3ba('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x3c'),_0xd3ba('0x3d'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x3e'),_0xd3ba('0x3f')),'allowNull':!![],'defaultValue':_0xd3ba('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no',_0xd3ba('0x40'),_0xd3ba('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd3ba('0x11')]('active',_0xd3ba('0x42'),_0xd3ba('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no',_0xd3ba('0x2e'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd3ba('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xd3ba('0x1a')]},'passwordResetAt':{'type':Sequelize[_0xd3ba('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0,'set':function(_0x1a7bd0){this[_0xd3ba('0x7')](_0xd3ba('0x44'),_0x1a7bd0);var _0x29ecb7=this['get']({'plain':!![]});switch(_0x1a7bd0){case 0x0:case 0x1:var _0x5e166c=_0x29ecb7[_0xd3ba('0x25')]?_[_0xd3ba('0x45')](_0x29ecb7[_0xd3ba('0x25')])?_0x29ecb7[_0xd3ba('0x25')]['join']():_0x29ecb7[_0xd3ba('0x25')]:_0xd3ba('0x24');if(_0x5e166c===_0xd3ba('0x46')){_0x5e166c=_0xd3ba('0x24');}this[_0xd3ba('0x7')](_0xd3ba('0x25'),_0x5e166c);this[_0xd3ba('0x7')](_0xd3ba('0x47'),'no');this['setDataValue']('avpf',null);this['setDataValue'](_0xd3ba('0x48'),null);this[_0xd3ba('0x7')]('icesupport',null);this[_0xd3ba('0x7')](_0xd3ba('0x49'),null);this['setDataValue'](_0xd3ba('0x4a'),null);this[_0xd3ba('0x7')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0xd3ba('0x7')](_0xd3ba('0x4b'),null);this[_0xd3ba('0x7')](_0xd3ba('0x4c'),'no');break;case 0x2:this[_0xd3ba('0x7')]('transport',_0xd3ba('0x46'));this['setDataValue']('encryption',_0xd3ba('0x2d'));this[_0xd3ba('0x7')](_0xd3ba('0x4d'),_0xd3ba('0x2d'));this[_0xd3ba('0x7')]('force_avp','yes');this['setDataValue']('icesupport',_0xd3ba('0x2d'));this[_0xd3ba('0x7')](_0xd3ba('0x49'),'yes');this['setDataValue'](_0xd3ba('0x4a'),'no');this[_0xd3ba('0x7')](_0xd3ba('0x4e'),_0xd3ba('0x43'));this[_0xd3ba('0x7')](_0xd3ba('0x4f'),_0x29ecb7['dtlscertfile']||_0xd3ba('0x50'));this[_0xd3ba('0x7')](_0xd3ba('0x4b'),_0x29ecb7[_0xd3ba('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0xd3ba('0x7')](_0xd3ba('0x4c'),_0xd3ba('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xd3ba('0x51')],'set':function(_0x5e9433){this[_0xd3ba('0x7')](_0xd3ba('0x52'),_0x5e9433?_0x5e9433[_0xd3ba('0x26')](','):[]);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x52'))?_[_0xd3ba('0x53')](this[_0xd3ba('0xd')](_0xd3ba('0x52'))[_0xd3ba('0x32')](','),function(_0x47621b){return parseInt(_0x47621b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xd3ba('0x54'))?this['getDataValue'](_0xd3ba('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![],'set':function(_0x596cfb){if(typeof _0x596cfb===_0xd3ba('0x55')){var _0x293894=_0x596cfb==='1'?!![]:_0x596cfb==='0'?![]:_0x596cfb===_0xd3ba('0x56')?!![]:_0x596cfb===_0xd3ba('0x57')?![]:![];this[_0xd3ba('0x7')](_0xd3ba('0x58'),_0x293894);}else{this[_0xd3ba('0x7')]('screenrecording',_0x596cfb);}}},'blocked':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![],'set':function(_0x3c8582){this[_0xd3ba('0x7')](_0xd3ba('0x59'),_0x3c8582);if(_0x3c8582===!![]){this[_0xd3ba('0x7')]('blockedAt',moment());this[_0xd3ba('0x7')](_0xd3ba('0x5a'),0x0);}else{this[_0xd3ba('0x7')](_0xd3ba('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0xd3ba('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcd43=['format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','join','transport','split','rfc2833','info','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','passive','actpass','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','icesupport','dtlsenable','dtlscertfile','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid'];(function(_0x5be368,_0x230f63){var _0x49954a=function(_0x2d44){while(--_0x2d44){_0x5be368['push'](_0x5be368['shift']());}};_0x49954a(++_0x230f63);}(_0xcd43,0x1a9));var _0x3cd4=function(_0x53f629,_0x4d578e){_0x53f629=_0x53f629-0x0;var _0xea7ea4=_0xcd43[_0x53f629];return _0xea7ea4;};'use strict';var Sequelize=require(_0x3cd4('0x0'));var moment=require(_0x3cd4('0x1'));var util=require(_0x3cd4('0x2'));var _=require(_0x3cd4('0x3'));module['exports']={'name':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':![],'unique':_0x3cd4('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3bd8d6){this[_0x3cd4('0x6')](_0x3cd4('0x5'),_0x3bd8d6);this[_0x3cd4('0x6')]('defaultuser',_0x3bd8d6);},'comment':_0x3cd4('0x7')},'fullname':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':![],'set':function(_0x1ce163){this[_0x3cd4('0x6')](_0x3cd4('0x8'),_0x1ce163);this[_0x3cd4('0x6')](_0x3cd4('0x9'),util[_0x3cd4('0xa')](_0x3cd4('0xb'),_0x1ce163,this[_0x3cd4('0xc')](_0x3cd4('0xd'))));}},'alias':{'type':Sequelize[_0x3cd4('0x4')]},'email':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':![],'unique':_0x3cd4('0xe'),'validate':{'isEmail':!![]},'set':function(_0x66dcc9){if(_0x66dcc9){this[_0x3cd4('0x6')](_0x3cd4('0xe'),_0x66dcc9[_0x3cd4('0xf')]());}}},'role':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x11'),_0x3cd4('0x12'),_0x3cd4('0x13'),_0x3cd4('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3cd4('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x3cd4('0xd'),'set':function(_0x1fbb84){this[_0x3cd4('0x6')](_0x3cd4('0xd'),_0x1fbb84);this[_0x3cd4('0x6')](_0x3cd4('0x15'),_0x1fbb84);this[_0x3cd4('0x6')](_0x3cd4('0x9'),util[_0x3cd4('0xa')](_0x3cd4('0xb'),this[_0x3cd4('0xc')](_0x3cd4('0x8')),_0x1fbb84));}},'salt':{'type':Sequelize[_0x3cd4('0x4')]},'phone':{'type':Sequelize[_0x3cd4('0x4')]},'mobile':{'type':Sequelize[_0x3cd4('0x4')]},'address':{'type':Sequelize[_0x3cd4('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x3cd4('0x4')]},'city':{'type':Sequelize[_0x3cd4('0x4')]},'country':{'type':Sequelize[_0x3cd4('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3cd4('0x16')]},'voicePause':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3cd4('0x4')],'defaultValue':_0x3cd4('0x18')},'lastPauseAt':{'type':Sequelize[_0x3cd4('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3cd4('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3cd4('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3cd4('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3cd4('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3cd4('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3cd4('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3cd4('0x10')]('friend','user',_0x3cd4('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![],'defaultValue':_0x3cd4('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x3cd4('0x1c'),_0x3cd4('0x1d'),_0x3cd4('0x1e'),'ALLOWED',_0x3cd4('0x1f'),_0x3cd4('0x20'),'PROHIB_FAILED_SCREEN',_0x3cd4('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![],'defaultValue':_0x3cd4('0x22'),'set':function(_0x42277f){this[_0x3cd4('0x6')]('transport',_0x42277f?_0x42277f[_0x3cd4('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x3cd4('0x24'))?this[_0x3cd4('0xc')](_0x3cd4('0x24'))[_0x3cd4('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x3cd4('0x26'),_0x3cd4('0x27'),_0x3cd4('0x28'),'inband','auto'),'allowNull':!![],'defaultValue':_0x3cd4('0x26')},'directmedia':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no',_0x3cd4('0x2a'),_0x3cd4('0x2b'),_0x3cd4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3cd4('0x2d'),'set':function(_0x3ab1d0){this[_0x3cd4('0x6')](_0x3cd4('0x2e'),_0x3ab1d0?_0x3ab1d0[_0x3cd4('0x23')](','):null);},'get':function(){return this[_0x3cd4('0xc')]('nat')?this[_0x3cd4('0xc')](_0x3cd4('0x2e'))[_0x3cd4('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3cd4('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3cd4('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':![],'defaultValue':_0x3cd4('0x2f')},'allow':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':![],'defaultValue':_0x3cd4('0x30'),'set':function(_0x5b6cec){this[_0x3cd4('0x6')](_0x3cd4('0x31'),_0x5b6cec?_0x5b6cec[_0x3cd4('0x23')](';'):_0x3cd4('0x30'));},'get':function(){return this[_0x3cd4('0xc')](_0x3cd4('0x31'))?this[_0x3cd4('0xc')](_0x3cd4('0x31'))[_0x3cd4('0x25')](';'):null;},'comment':_0x3cd4('0x32')},'autoframing':{'type':Sequelize['ENUM'](_0x3cd4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![],'set':function(_0x40b7c5){this['setDataValue'](_0x3cd4('0x33'),_0x40b7c5?_0x40b7c5['join'](','):null);},'get':function(){return this[_0x3cd4('0xc')]('insecure')?this[_0x3cd4('0xc')](_0x3cd4('0x33'))[_0x3cd4('0x25')](','):null;},'comment':_0x3cd4('0x34')},'trustrpid':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no',_0x3cd4('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3cd4('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![],'defaultValue':_0x3cd4('0x36')},'amaflags':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x3cd4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3cd4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no',_0x3cd4('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3cd4('0x10')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x38'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x39'),_0x3cd4('0x3a')),'allowNull':!![],'defaultValue':_0x3cd4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':_0x3cd4('0x29')},'keepalive':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no',_0x3cd4('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x3cd4('0x3c'),_0x3cd4('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3cd4('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x3cd4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no',_0x3cd4('0x2a'),_0x3cd4('0x2b'),_0x3cd4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x3cd4('0x16')]},'passwordResetAt':{'type':Sequelize[_0x3cd4('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3cd4('0x4')]},'showWebBar':{'type':Sequelize[_0x3cd4('0x19')],'defaultValue':0x0,'set':function(_0x821c93){this['setDataValue'](_0x3cd4('0x3f'),_0x821c93);var _0x374595=this[_0x3cd4('0x40')]({'plain':!![]});switch(_0x821c93){case 0x0:case 0x1:var _0x299b3d=_0x374595[_0x3cd4('0x24')]?_[_0x3cd4('0x41')](_0x374595[_0x3cd4('0x24')])?_0x374595[_0x3cd4('0x24')][_0x3cd4('0x23')]():_0x374595[_0x3cd4('0x24')]:'udp';if(_0x299b3d===_0x3cd4('0x42')){_0x299b3d=_0x3cd4('0x22');}this[_0x3cd4('0x6')](_0x3cd4('0x24'),_0x299b3d);this['setDataValue'](_0x3cd4('0x43'),'no');this[_0x3cd4('0x6')](_0x3cd4('0x44'),null);this[_0x3cd4('0x6')](_0x3cd4('0x45'),null);this['setDataValue']('icesupport',null);this[_0x3cd4('0x6')]('dtlsenable',null);this[_0x3cd4('0x6')](_0x3cd4('0x46'),null);this['setDataValue'](_0x3cd4('0x47'),null);this[_0x3cd4('0x6')]('dtlscertfile',null);this[_0x3cd4('0x6')](_0x3cd4('0x48'),null);this['setDataValue'](_0x3cd4('0x49'),'no');break;case 0x2:this['setDataValue'](_0x3cd4('0x24'),_0x3cd4('0x42'));this[_0x3cd4('0x6')](_0x3cd4('0x43'),'yes');this[_0x3cd4('0x6')](_0x3cd4('0x44'),'yes');this[_0x3cd4('0x6')](_0x3cd4('0x45'),_0x3cd4('0x29'));this[_0x3cd4('0x6')](_0x3cd4('0x4a'),_0x3cd4('0x29'));this[_0x3cd4('0x6')](_0x3cd4('0x4b'),_0x3cd4('0x29'));this[_0x3cd4('0x6')](_0x3cd4('0x46'),'no');this[_0x3cd4('0x6')]('dtlssetup',_0x3cd4('0x3d'));this[_0x3cd4('0x6')](_0x3cd4('0x4c'),_0x374595[_0x3cd4('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0x3cd4('0x6')](_0x3cd4('0x48'),_0x374595[_0x3cd4('0x48')]||_0x3cd4('0x4d'));this[_0x3cd4('0x6')](_0x3cd4('0x49'),_0x3cd4('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x3cd4('0x4e')],'set':function(_0x262e9c){this[_0x3cd4('0x6')](_0x3cd4('0x4f'),_0x262e9c?_0x262e9c['join'](','):[]);},'get':function(){return this[_0x3cd4('0xc')](_0x3cd4('0x4f'))?_[_0x3cd4('0x50')](this[_0x3cd4('0xc')](_0x3cd4('0x4f'))[_0x3cd4('0x25')](','),function(_0x479002){return parseInt(_0x479002,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3cd4('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3cd4('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3cd4('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3cd4('0x10')](_0x3cd4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3cd4('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3cd4('0x51')],'get':function(){return this['getDataValue'](_0x3cd4('0x52'))?this['getDataValue'](_0x3cd4('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3cd4('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3cd4('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![],'set':function(_0x35f2e0){if(typeof _0x35f2e0===_0x3cd4('0x53')){var _0x38e269=_0x35f2e0==='1'?!![]:_0x35f2e0==='0'?![]:_0x35f2e0==='true'?!![]:_0x35f2e0==='false'?![]:![];this[_0x3cd4('0x6')](_0x3cd4('0x54'),_0x38e269);}else{this[_0x3cd4('0x6')]('screenrecording',_0x35f2e0);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4ad3d7){this['setDataValue'](_0x3cd4('0x55'),_0x4ad3d7);if(_0x4ad3d7===!![]){this['setDataValue'](_0x3cd4('0x56'),moment());this[_0x3cd4('0x6')]('loginAttempts',0x0);}else{this[_0x3cd4('0x6')](_0x3cd4('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x3cd4('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3cd4('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3cd4('0x17')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index bf6381b..adbdf34 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 _0xa992=['whoami','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','role','admin','Users','Agents','agent','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','stack','send','index','User','rawAttributes','fieldName','type','key','model','password','salt','filters','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','sequelize','lower','col','options','includeAll','include','findAll','catch','params','differenceBy','keys','length','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','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','mailbox','fullname','email','permissions','101','102','103','113','110','104','105','107','108','109','100','111','114','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','isEmpty','includes','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','QueueId','emit','capitalize','Queue:save','voice','VoiceQueue','online','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','download','existsSync','root','server/files/images/','getContacts','findOne','CmContact','order','pick','CmList','List','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','rows','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','remoteAddress','socket','connection','getVoiceQueues','UserVoiceQueue.penalty','forEach','update','LOGIN','device','PAUSE','MemberReport','YYYY-MM-DD\x20HH:mm:ss','LOGININPAUSE','resolve','QueuePause','pause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','mail','fax','sms','whatsapp','openchannel','manual','%s%s','Pause','getTeams','addTeams','Team','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','getApiKey','retrieveApiKey','json','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','apiKeyNonce','API\x20key\x20not\x20available'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa992,0x18c));var _0x2a99=function(_0x331718,_0x54f993){_0x331718=_0x331718-0x0;var _0x1f75e8=_0xa992[_0x331718];return _0x1f75e8;};'use strict';var pdf=require(_0x2a99('0x0'));var emlformat=require(_0x2a99('0x1'));var rimraf=require(_0x2a99('0x2'));var zipdir=require(_0x2a99('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a99('0x4'));var moment=require(_0x2a99('0x5'));var BPromise=require(_0x2a99('0x6'));var Mustache=require(_0x2a99('0x7'));var util=require(_0x2a99('0x8'));var path=require(_0x2a99('0x9'));var sox=require(_0x2a99('0xa'));var csv=require(_0x2a99('0xb'));var ejs=require(_0x2a99('0xc'));var fs=require('fs');var _=require(_0x2a99('0xd'));var squel=require('squel');var crypto=require(_0x2a99('0xe'));var jsforce=require(_0x2a99('0xf'));var deskjs=require(_0x2a99('0x10'));var toCsv=require(_0x2a99('0xb'));var querystring=require(_0x2a99('0x11'));var Papa=require(_0x2a99('0x12'));var Redis=require(_0x2a99('0x13'));var authService=require(_0x2a99('0x14'));var qs=require(_0x2a99('0x15'));var as=require(_0x2a99('0x16'));var hardwareService=require(_0x2a99('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2a99('0x18'));var config=require(_0x2a99('0x19'));var licenseUtil=require(_0x2a99('0x1a'));var db=require(_0x2a99('0x1b'))['db'];config[_0x2a99('0x1c')]=_[_0x2a99('0x1d')](config['redis'],{'host':_0x2a99('0x1e'),'port':0x18eb});var socket=require(_0x2a99('0x1f'))(new Redis(config[_0x2a99('0x1c')]));require(_0x2a99('0x20'))[_0x2a99('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2a99('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cbe7b,_0x14528e,_0x271db6,_0x343ba4){return new BPromise(function(_0x4aa37c,_0x5bf701){var _0x55d1f0=_0x343ba4||client;return _0x55d1f0[_0x2a99('0x23')](_0x5cbe7b,_0x271db6)[_0x2a99('0x24')](function(_0x59f0f0){logger[_0x2a99('0x25')](_0x2a99('0x26'),_0x14528e,_0x2a99('0x27'));logger[_0x2a99('0x28')]('User,\x20%s,\x20%s,\x20%s',_0x14528e,_0x2a99('0x27'),JSON[_0x2a99('0x29')](_0x59f0f0));if(_0x59f0f0[_0x2a99('0x2a')]){if(_0x59f0f0[_0x2a99('0x2a')][_0x2a99('0x2b')]===0x1f4){logger['error'](_0x2a99('0x26'),_0x14528e,_0x59f0f0[_0x2a99('0x2a')][_0x2a99('0x2c')]);return _0x5bf701(_0x59f0f0[_0x2a99('0x2a')][_0x2a99('0x2c')]);}logger[_0x2a99('0x2a')](_0x2a99('0x26'),_0x14528e,_0x59f0f0[_0x2a99('0x2a')][_0x2a99('0x2c')]);return _0x4aa37c(_0x59f0f0[_0x2a99('0x2a')]['message']);}else{logger[_0x2a99('0x25')]('User,\x20%s,\x20%s',_0x14528e,'request\x20sent');_0x4aa37c(_0x59f0f0['result'][_0x2a99('0x2c')]);}})['catch'](function(_0x4bb142){logger[_0x2a99('0x2a')]('User,\x20%s,\x20%s',_0x14528e,_0x4bb142);_0x5bf701(_0x4bb142);});});}function respondWithStatusCode(_0x324a1c,_0x228737){_0x228737=_0x228737||0xcc;return function(_0x274707){if(_0x274707){return _0x324a1c[_0x2a99('0x2d')](_0x228737);}return _0x324a1c[_0x2a99('0x2e')](_0x228737)[_0x2a99('0x2f')]();};}function respondWithResult(_0x1372c7,_0x3485c8){_0x3485c8=_0x3485c8||0xc8;return function(_0x2b5d97){if(_0x2b5d97){return _0x1372c7[_0x2a99('0x2e')](_0x3485c8)['json'](_0x2b5d97);}};}function respondWithFilteredResult(_0x47736f,_0x4271b4){return function(_0x5ad092){if(_0x5ad092){var _0x298b12=_0x5ad092[_0x2a99('0x30')],_0x17a9a0=_0x4271b4[_0x2a99('0x31')],_0x12c857=_0x4271b4[_0x2a99('0x31')]+_0x4271b4[_0x2a99('0x32')],_0x5bc6f6;if(_0x12c857>=_0x298b12){_0x12c857=_0x298b12;_0x5bc6f6=0xc8;}else{_0x5bc6f6=0xce;}_0x47736f['status'](_0x5bc6f6);return _0x47736f[_0x2a99('0x33')](_0x2a99('0x34'),_0x17a9a0+'-'+_0x12c857+'/'+_0x298b12)['json'](_0x5ad092);}return null;};}function patchUpdates(_0x153a3e){return function(_0xe463af){try{jsonpatch[_0x2a99('0x35')](_0xe463af,_0x153a3e,!![]);}catch(_0x56dee2){return BPromise[_0x2a99('0x36')](_0x56dee2);}return _0xe463af[_0x2a99('0x37')]();};}function saveUpdates(_0xafccad,_0x4756de){return function(_0x18ad48){if(_0x18ad48){return _0x18ad48['update'](_0xafccad)[_0x2a99('0x24')](function(_0x4fef34){return _0x4fef34;});}return null;};}function removeEntity(_0x177dae,_0x3e6bbc){return function(_0x29567a){if(_0x29567a){return _0x29567a[_0x2a99('0x38')]()[_0x2a99('0x24')](function(){var _0x1f2e46=_0x29567a[_0x2a99('0x39')]({'plain':!![]});if(_0x1f2e46[_0x2a99('0x3a')]===_0x2a99('0x3b'))return;var _0x1232da=[{'name':_0x2a99('0x3c'),'value':'user','ignore':!![]},{'name':_0x2a99('0x3d'),'value':_0x2a99('0x3e'),'ignore':![]},{'name':_0x2a99('0x3f'),'value':_0x2a99('0x40'),'ignore':![]}];var _0x2e7b21=_(_0x1232da)[_0x2a99('0x41')](_0x2a99('0x42'))[_0x2a99('0x43')](_0x2a99('0x44'))[_0x2a99('0x44')]();if(_['includes'](_0x2e7b21,_0x1f2e46['role'])){return;}var _0x5b8fce=_[_0x2a99('0x45')](_0x1232da,[_0x2a99('0x44'),_0x1f2e46[_0x2a99('0x3a')]])[_0x2a99('0x46')];return db[_0x2a99('0x47')][_0x2a99('0x38')]({'where':{'type':_0x5b8fce,'resourceId':_0x1f2e46['id']}})[_0x2a99('0x24')](function(){return _0x29567a;});})['then'](function(){_0x177dae[_0x2a99('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501835,_0x28ab83){return function(_0x22cf4b){if(!_0x22cf4b){_0x501835[_0x2a99('0x2d')](0x194);}return _0x22cf4b;};}function handleError(_0x10dd44,_0x475268){_0x475268=_0x475268||0x1f4;return function(_0x3f6729){logger[_0x2a99('0x2a')](_0x3f6729[_0x2a99('0x48')]);if(_0x3f6729[_0x2a99('0x46')]){delete _0x3f6729[_0x2a99('0x46')];}_0x10dd44[_0x2a99('0x2e')](_0x475268)[_0x2a99('0x49')](_0x3f6729);};}exports[_0x2a99('0x4a')]=function(_0x57df22,_0x9d46e3){var _0x20e4b7={},_0x529822={},_0xa1dba5={'count':0x0,'rows':[]};var _0x1af68b=_[_0x2a99('0x43')](db[_0x2a99('0x4b')][_0x2a99('0x4c')],function(_0x5a6850){return{'name':_0x5a6850[_0x2a99('0x4d')],'type':_0x5a6850[_0x2a99('0x4e')][_0x2a99('0x4f')]};});_0x529822[_0x2a99('0x50')]=_['differenceBy'](_[_0x2a99('0x43')](_0x1af68b,_0x2a99('0x46')),[_0x2a99('0x51'),_0x2a99('0x52')]);_0x529822['query']=_['keys'](_0x57df22['query']);_0x529822[_0x2a99('0x53')]=_['intersection'](_0x529822[_0x2a99('0x50')],_0x529822[_0x2a99('0x54')]);_0x20e4b7['attributes']=_[_0x2a99('0x55')](_0x529822['model'],qs[_0x2a99('0x56')](_0x57df22[_0x2a99('0x54')][_0x2a99('0x56')]));_0x20e4b7['attributes']=_0x20e4b7[_0x2a99('0x57')]['length']?_0x20e4b7['attributes']:_0x529822[_0x2a99('0x50')];if(!_0x57df22[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x20e4b7[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x57df22['query'][_0x2a99('0x32')]);_0x20e4b7[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x57df22[_0x2a99('0x54')]['offset']);}_0x20e4b7['order']=qs[_0x2a99('0x5a')](_0x57df22[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x20e4b7[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_['pick'](_0x57df22[_0x2a99('0x54')],_0x529822[_0x2a99('0x53')]),_0x1af68b);if(_0x57df22[_0x2a99('0x54')][_0x2a99('0x41')]){_0x20e4b7[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x20e4b7[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x1af68b,function(_0x525e61){if(_0x525e61['type']!==_0x2a99('0x5d')){return db[_0x2a99('0x5e')][_0x2a99('0x5b')](db[_0x2a99('0x5e')]['fn'](_0x2a99('0x5f'),db[_0x2a99('0x5e')][_0x2a99('0x60')](_0x525e61['name'])),{'$like':db[_0x2a99('0x5e')]['fn']('lower','%'+_0x57df22[_0x2a99('0x54')][_0x2a99('0x41')]+'%')});}})});}_0x20e4b7=_['merge']({},_0x20e4b7,_0x57df22[_0x2a99('0x61')]);var _0x50cb3d={'where':_0x20e4b7['where']};return db[_0x2a99('0x4b')]['count'](_0x50cb3d)[_0x2a99('0x24')](function(_0x5188e0){_0xa1dba5[_0x2a99('0x30')]=_0x5188e0;if(_0x57df22['query'][_0x2a99('0x62')]){_0x20e4b7[_0x2a99('0x63')]=[{'all':!![]}];}return db[_0x2a99('0x4b')][_0x2a99('0x64')](_0x20e4b7);})[_0x2a99('0x24')](function(_0x464b01){_0xa1dba5['rows']=_0x464b01;return _0xa1dba5;})[_0x2a99('0x24')](respondWithFilteredResult(_0x9d46e3,_0x20e4b7))[_0x2a99('0x65')](handleError(_0x9d46e3,null));};exports['show']=function(_0x4d4216,_0x529e8d){var _0x7fe1f={'raw':![],'where':{'id':_0x4d4216[_0x2a99('0x66')]['id']}},_0x51be38={};_0x51be38['model']=_[_0x2a99('0x67')](_[_0x2a99('0x68')](db[_0x2a99('0x4b')][_0x2a99('0x4c')]),[_0x2a99('0x51'),_0x2a99('0x52')]);_0x51be38['query']=_['keys'](_0x4d4216[_0x2a99('0x54')]);_0x51be38[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x51be38[_0x2a99('0x50')],_0x51be38['query']);_0x7fe1f[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x51be38[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x4d4216['query'][_0x2a99('0x56')]));_0x7fe1f[_0x2a99('0x57')]=_0x7fe1f[_0x2a99('0x57')][_0x2a99('0x69')]?_0x7fe1f[_0x2a99('0x57')]:_0x51be38[_0x2a99('0x50')];if(_0x4d4216['query'][_0x2a99('0x62')]){_0x7fe1f['include']=[{'all':!![]}];}_0x7fe1f=_[_0x2a99('0x5c')]({},_0x7fe1f,_0x4d4216[_0x2a99('0x61')]);return db[_0x2a99('0x4b')]['find'](_0x7fe1f)[_0x2a99('0x24')](handleEntityNotFound(_0x529e8d,null))[_0x2a99('0x24')](respondWithResult(_0x529e8d,null))[_0x2a99('0x65')](handleError(_0x529e8d,null));};exports['update']=function(_0x2526ed,_0x39fc69){if(_0x2526ed['body']['id']){delete _0x2526ed[_0x2a99('0x6a')]['id'];}delete _0x2526ed[_0x2a99('0x6a')][_0x2a99('0x3a')];return db[_0x2a99('0x4b')]['find']({'where':{'id':_0x2526ed[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x39fc69,null))[_0x2a99('0x24')](saveUpdates(_0x2526ed['body'],null))[_0x2a99('0x24')](respondWithResult(_0x39fc69,null))['catch'](handleError(_0x39fc69,null));};exports['describe']=function(_0x2a043e,_0x318b6f){return db['User'][_0x2a99('0x6b')]()[_0x2a99('0x24')](respondWithResult(_0x318b6f,null))['catch'](handleError(_0x318b6f,null));};exports[_0x2a99('0x6c')]=function(_0x2c7a62,_0x27c6c6,_0x1e2c1c){return db[_0x2a99('0x4b')]['find']({'where':{'id':_0x2c7a62[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x27c6c6,null))[_0x2a99('0x24')](function(_0x480bb3){if(_0x480bb3){return _0x480bb3[_0x2a99('0x6c')](_0x2c7a62[_0x2a99('0x6a')][_0x2a99('0x6d')],_[_0x2a99('0x6e')](_0x2c7a62[_0x2a99('0x6a')],['ids','id'])||{});}})[_0x2a99('0x24')](respondWithResult(_0x27c6c6,null))[_0x2a99('0x65')](handleError(_0x27c6c6,null));};function validateUser(_0x2df943){return new BPromise(function(_0x332327,_0x499356){if(_0x2df943[_0x2a99('0x6f')])return _0x332327(_0x2df943);return db['Setting'][_0x2a99('0x70')](0x1)[_0x2a99('0x24')](function(_0x4867e6){if(_0x4867e6[_0x2a99('0x71')])authService[_0x2a99('0x72')](_0x2df943[_0x2a99('0x51')]);db[_0x2a99('0x4b')][_0x2a99('0x73')](_0x2a99('0x6f'))[_0x2a99('0x24')](function(_0x4c61e0){if(_['isNil'](_0x4c61e0)){_0x2df943[_0x2a99('0x6f')]=_0x4867e6[_0x2a99('0x74')]||0x1;return;}if(_[_0x2a99('0x75')](_0x4867e6[_0x2a99('0x74')])||_0x4867e6[_0x2a99('0x74')]===_0x4c61e0){_0x2df943['internal']=_0x4c61e0+0x1;return;}if(_0x4867e6[_0x2a99('0x74')]>_0x4c61e0){_0x2df943[_0x2a99('0x6f')]=_0x4867e6[_0x2a99('0x74')];return;}return db['sequelize'][_0x2a99('0x54')](_0x2a99('0x76'),{'type':db[_0x2a99('0x5e')][_0x2a99('0x77')][_0x2a99('0x78')]})[_0x2a99('0x24')](function(_0x15f496){if(_0x15f496&&_0x15f496[_0x2a99('0x69')]){for(var _0x4a4478=0x0,_0x38b15e=_0x15f496[_0x2a99('0x69')];_0x4a4478<_0x38b15e&&_[_0x2a99('0x75')](_0x2df943[_0x2a99('0x6f')]);_0x4a4478++){if(_0x4867e6[_0x2a99('0x74')]<=_0x15f496[_0x4a4478][_0x2a99('0x79')]){_0x2df943[_0x2a99('0x6f')]=_0x15f496[_0x4a4478]['from'];}else if(_0x4867e6[_0x2a99('0x74')]>_0x15f496[_0x4a4478][_0x2a99('0x79')]&&_0x4867e6[_0x2a99('0x74')]<=_0x15f496[_0x4a4478]['to']){_0x2df943[_0x2a99('0x6f')]=_0x4867e6[_0x2a99('0x74')];}}}if(_[_0x2a99('0x75')](_0x2df943[_0x2a99('0x6f')])){_0x2df943[_0x2a99('0x6f')]=_0x4c61e0+0x1;}return _0x332327(_0x2df943);});});})[_0x2a99('0x65')](function(_0x2e1aea){_0x499356(_0x2e1aea);});});}function updateUser(_0x5f4ebb){return new BPromise(function(_0x2c6778,_0x158c26){try{if(_0x5f4ebb['voicemail']){_0x5f4ebb[_0x2a99('0x7a')]=_0x5f4ebb[_0x2a99('0x6f')];_0x5f4ebb['VoiceMail']={'mailbox':_0x5f4ebb['internal'],'password':_0x5f4ebb[_0x2a99('0x51')],'fullname':_0x5f4ebb[_0x2a99('0x7b')],'email':_0x5f4ebb[_0x2a99('0x7c')]};}if(_0x5f4ebb[_0x2a99('0x3a')]==='agent'){if(!_0x5f4ebb[_0x2a99('0x7d')])_0x5f4ebb['permissions']=[_0x2a99('0x7e'),_0x2a99('0x7f'),_0x2a99('0x80'),_0x2a99('0x81'),_0x2a99('0x82'),_0x2a99('0x83'),_0x2a99('0x84'),'106',_0x2a99('0x85'),_0x2a99('0x86'),_0x2a99('0x87'),_0x2a99('0x88'),_0x2a99('0x89'),_0x2a99('0x8a')];}_0x2c6778(_0x5f4ebb);}catch(_0x152f94){_0x158c26(_0x152f94);}});}exports[_0x2a99('0x8b')]=function(_0x2754de,_0x5aad22){if(_0x2754de[_0x2a99('0x8c')][_0x2a99('0x3a')]===_0x2a99('0x3e'))throw new Error(_0x2a99('0x8d'));if(_0x2754de[_0x2a99('0x6a')][_0x2a99('0x3a')]==='user'&&_0x2754de[_0x2a99('0x8c')]['role']!==_0x2a99('0x3b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2754de[_0x2a99('0x6a')][_0x2a99('0x3a')]===_0x2a99('0x3b')&&_0x2754de[_0x2a99('0x8c')]['role']!=='admin'){throw new Error(_0x2a99('0x8e'));}return licenseUtil[_0x2a99('0x8f')]([_0x2754de['body']])['then'](function(){return validateUser(_0x2754de['body']);})[_0x2a99('0x24')](function(_0x4baad9){return updateUser(_0x4baad9)[_0x2a99('0x24')](function(_0x4f90a1){if(_0x4f90a1[_0x2a99('0x3a')]===_0x2a99('0x3b')){_0x4f90a1[_0x2a99('0x90')]=_0x2754de[_0x2a99('0x8c')][_0x2a99('0x90')];delete _0x4f90a1[_0x2a99('0x91')];}return _0x4f90a1;});})['then'](function(_0x466370){return db[_0x2a99('0x4b')][_0x2a99('0x8b')](_0x466370,{'include':[{'model':db[_0x2a99('0x92')],'as':_0x2a99('0x92')}]});})[_0x2a99('0x24')](function(_0x58ca4d){if(_0x2754de['body'][_0x2a99('0x3a')]===_0x2a99('0x8c'))return _0x58ca4d;if(_0x2754de['user'][_0x2a99('0x3a')]!==_0x2a99('0x8c'))return _0x58ca4d;return db[_0x2a99('0x93')][_0x2a99('0x45')]({'where':{'name':_0x58ca4d[_0x2a99('0x3a')]===_0x2a99('0x3e')?_0x2a99('0x3d'):_0x2a99('0x3f'),'userProfileId':_0x2754de[_0x2a99('0x8c')][_0x2a99('0x91')]},'raw':!![]})[_0x2a99('0x24')](function(_0x21ac05){if(!_0x21ac05||_0x21ac05[_0x2a99('0x94')]!=0x0)return _0x58ca4d;return db['UserProfileResource'][_0x2a99('0x8b')]({'name':_0x58ca4d[_0x2a99('0x46')],'resourceId':_0x58ca4d['id'],'type':_0x21ac05['name'],'sectionId':_0x21ac05['id']},{})[_0x2a99('0x24')](function(){return _0x58ca4d;});})[_0x2a99('0x65')](function(_0x424cd5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x424cd5);throw _0x424cd5;});})[_0x2a99('0x24')](respondWithResult(_0x5aad22,0xc9))[_0x2a99('0x65')](handleError(_0x5aad22,null));};exports[_0x2a99('0x95')]=function(_0x1bc2a1,_0x1d613d){var _0x137249=_0x1bc2a1[_0x2a99('0x6a')];var _0x3d4381=[];if(_0x1bc2a1[_0x2a99('0x8c')][_0x2a99('0x3a')]==='agent')throw new Error('Unauthorized');if(_[_0x2a99('0x96')](_0x137249,[_0x2a99('0x3a'),_0x2a99('0x8c')])&&_0x1bc2a1[_0x2a99('0x8c')][_0x2a99('0x3a')]!==_0x2a99('0x3b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x137249,['role',_0x2a99('0x3b')])&&_0x1bc2a1[_0x2a99('0x8c')]['role']!==_0x2a99('0x3b')){throw new Error(_0x2a99('0x97'));}return licenseUtil[_0x2a99('0x8f')](_0x137249)[_0x2a99('0x24')](function(){return validateUser(_0x137249[0x0]);})[_0x2a99('0x24')](function(){for(var _0x1e63aa=0x1;_0x1e63aa<_0x137249['length'];_0x1e63aa++){var _0x4da9ce=_0x137249[_0x1e63aa-0x1][_0x2a99('0x6f')];if(!_0x137249[_0x1e63aa]['internal'])_0x137249[_0x1e63aa][_0x2a99('0x6f')]=_0x4da9ce+0x1;_0x3d4381[_0x2a99('0x98')](validateUser(_0x137249[_0x1e63aa]));}return BPromise[_0x2a99('0x99')](_0x3d4381);})[_0x2a99('0x24')](function(){_0x3d4381=[];for(var _0x341553=0x0;_0x341553<_0x137249[_0x2a99('0x69')];_0x341553++){_0x3d4381[_0x2a99('0x98')](updateUser(_0x137249[_0x341553]));}return BPromise['all'](_0x3d4381);})[_0x2a99('0x24')](function(){return BPromise[_0x2a99('0x9a')](_0x137249,function(_0x5c8f65){return db[_0x2a99('0x4b')][_0x2a99('0x8b')](_0x5c8f65,{'include':[{'model':db[_0x2a99('0x92')],'as':_0x2a99('0x92')}]})[_0x2a99('0x24')](function(_0x3e31f5){_0x5c8f65['id']=_0x3e31f5['id'];return _0x5c8f65;});});})['then'](function(_0x1469b6){if(_0x1bc2a1[_0x2a99('0x6a')][_0x2a99('0x3a')]==='user')return _0x1469b6;if(_0x1bc2a1['user'][_0x2a99('0x3a')]!==_0x2a99('0x8c'))return _0x1469b6;var _0x25f448=_['some'](_0x1469b6,function(_0xcbe054){return _0xcbe054[_0x2a99('0x3a')]==='agent'||_0xcbe054[_0x2a99('0x3a')]===_0x2a99('0x40');});if(!_0x25f448)return _0x1469b6;return db[_0x2a99('0x93')]['findAll']({'where':{'name':{'$or':['Agents',_0x2a99('0x3f')]},'userProfileId':_0x1bc2a1[_0x2a99('0x8c')]['userProfileId']},'raw':!![]})[_0x2a99('0x24')](function(_0x258682){if(_[_0x2a99('0x9b')](_0x258682)||!_[_0x2a99('0x96')](_0x258682,['autoAssociation',0x0]))return _0x1469b6;_0x3d4381=[];var _0x546281=_(_0x258682)[_0x2a99('0x43')](function(_0x312c54){if(_0x312c54[_0x2a99('0x94')]===0x1)return;return _0x312c54[_0x2a99('0x46')]==='Agents'?_0x2a99('0x3e'):_0x2a99('0x40');})['compact']()['value']();for(var _0x57c240=0x0;_0x57c240<_0x1469b6['length'];_0x57c240++){if(!_[_0x2a99('0x9c')](_0x546281,_0x1469b6[_0x57c240]['role']))return;var _0x3fba73=_0x1469b6[_0x57c240][_0x2a99('0x3a')]===_0x2a99('0x3e')?'Agents':_0x2a99('0x3f');_0x3d4381[_0x2a99('0x98')](db[_0x2a99('0x47')][_0x2a99('0x8b')]({'name':_0x1469b6[_0x57c240][_0x2a99('0x46')],'resourceId':_0x1469b6[_0x57c240]['id'],'type':_0x3fba73,'sectionId':_[_0x2a99('0x45')](_0x258682,[_0x2a99('0x46'),_0x3fba73])['id']},{}));}return BPromise[_0x2a99('0x99')](_0x3d4381);})['then'](respondWithResult(_0x1d613d,0xc9))['catch'](handleError(_0x1d613d,null));});};exports[_0x2a99('0x9d')]=function(_0x4e6a4c,_0x2cc9a4,_0x861497){if(_0x4e6a4c[_0x2a99('0x6a')]['id']){delete _0x4e6a4c[_0x2a99('0x6a')]['id'];}return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x4e6a4c['params']['id']}})[_0x2a99('0x24')](function(_0x4ff915){if(!_0x4ff915)return null;if(_0x4ff915['id']===_0x4e6a4c[_0x2a99('0x8c')]['id']){if(!_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9e')]||!_0x4e6a4c['body'][_0x2a99('0x9f')]){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xa2'));}if(!_0x4ff915[_0x2a99('0xa3')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9e')])){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xa4'));}if(_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9e')]===_0x4e6a4c['body']['newPassword']){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4e6a4c['user'][_0x2a99('0x3a')]==='admin'){if(!_0x4e6a4c['body'][_0x2a99('0x9f')]){throw new db['Sequelize'][(_0x2a99('0xa1'))](_0x2a99('0xa5'));}}else if(_0x4e6a4c[_0x2a99('0x8c')]['role']==='user'){if(!_0x4e6a4c[_0x2a99('0x6a')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x2a99('0xa5'));}if(_0x4ff915[_0x2a99('0x3a')]!==_0x2a99('0x3e')){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0x8d'));}}else{throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0x8d'));}return _0x4ff915;})[_0x2a99('0x24')](handleEntityNotFound(_0x2cc9a4,null))['then'](function(_0x3b8fd4){return db[_0x2a99('0xa6')]['findOne']({'attributes':['id',_0x2a99('0x71'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x2a99('0x24')](function(_0xfd4cdb){if(_0xfd4cdb['securePassword'])authService[_0x2a99('0x72')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9f')]);if(!_0xfd4cdb[_0x2a99('0xa7')]||!_0x3b8fd4[_0x2a99('0xa8')])return _0x3b8fd4;authService[_0x2a99('0xa9')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9f')],_0x3b8fd4[_0x2a99('0xa8')],_0xfd4cdb[_0x2a99('0xaa')]);return _0x3b8fd4;})[_0x2a99('0x24')](saveUpdates({'password':_0x4e6a4c['body'][_0x2a99('0x9f')],'passwordResetAt':_0x4e6a4c[_0x2a99('0x8c')]['id']==_0x4e6a4c[_0x2a99('0x66')]['id']?moment():null,'previousPasswords':authService[_0x2a99('0xab')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9f')],_0x3b8fd4[_0x2a99('0xa8')])},null));})['then'](respondWithResult(_0x2cc9a4,null))['catch'](handleError(_0x2cc9a4,null));};exports[_0x2a99('0xac')]=function(_0x585b6b,_0x2d0891,_0x1613b0){var _0x39ffa4=_0x585b6b[_0x2a99('0x6a')][_0x2a99('0xad')];return db['User']['find']({'where':{'id':_0x585b6b[_0x2a99('0x66')]['id']},'attributes':['id','name',_0x2a99('0x3a'),'online',_0x2a99('0xae'),_0x2a99('0xaf'),_0x2a99('0xb0')]})[_0x2a99('0x24')](handleEntityNotFound(_0x2d0891,null))[_0x2a99('0x24')](function(_0x3bac3b){if(_0x3bac3b){if(!utils['isValidChannel'](_0x39ffa4)){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}return _0x3bac3b[_0x2a99('0xb2')+_['capitalize'](_0x39ffa4[_0x2a99('0xb3')]())+_0x2a99('0xb4')](_0x585b6b[_0x2a99('0x6a')]['ids'],{'penalty':_0x585b6b['body'][_0x2a99('0xb5')]||0x0})[_0x2a99('0xb6')](function(_0x57ff3a){for(var _0x188dd8=0x0;_0x188dd8<_0x585b6b[_0x2a99('0x6a')][_0x2a99('0x6d')][_0x2a99('0x69')];_0x188dd8+=0x1){var _0x208954={'UserId':_0x585b6b[_0x2a99('0x66')]['id']};_0x208954[_['capitalize'](_0x39ffa4[_0x2a99('0xb3')]())+_0x2a99('0xb7')]=_0x585b6b[_0x2a99('0x6a')][_0x2a99('0x6d')][_0x188dd8];socket[_0x2a99('0xb8')](_0x2a99('0x8c')+_[_0x2a99('0xb9')](_0x39ffa4['toLowerCase']())+_0x2a99('0xba'),_0x208954);}return _0x57ff3a;})[_0x2a99('0x24')](function(){if(_0x39ffa4===_0x2a99('0xbb')){return db[_0x2a99('0xbc')][_0x2a99('0x64')]({'where':{'id':_0x585b6b[_0x2a99('0x6a')][_0x2a99('0x6d')]||[]},'raw':!![],'attributes':['id',_0x2a99('0x46')]});}})[_0x2a99('0x24')](function(_0x1073bb){var _0x2a4b8d=_0x3bac3b[_0x2a99('0x39')]({'plain':!![]});var _0x2acd16=[];if(_0x39ffa4==='voice'&&_0x2a4b8d[_0x2a99('0x3a')]==='agent'&&_0x2a4b8d[_0x2a99('0xbd')]){for(var _0x38dccc=0x0;_0x38dccc<_0x1073bb[_0x2a99('0x69')];_0x38dccc+=0x1){_0x2acd16[_0x2a99('0x98')]({'membername':_0x2a4b8d[_0x2a99('0x46')],'UserId':_0x2a4b8d['id'],'queue_name':_0x1073bb[_0x38dccc][_0x2a99('0x46')],'VoiceQueueId':_0x1073bb[_0x38dccc]['id'],'interface':_[_0x2a99('0x75')](_0x2a4b8d['interface'])?util[_0x2a99('0xbe')](_0x2a99('0xbf'),_0x2a4b8d['name']):_0x2a4b8d[_0x2a99('0xb0')],'paused':_0x2a4b8d[_0x2a99('0xaf')]||![],'penalty':_0x585b6b[_0x2a99('0x6a')][_0x2a99('0xb5')]||0x0});}return BPromise[_0x2a99('0x9a')](_0x2acd16,function(_0x3f0305){return db[_0x2a99('0xc0')][_0x2a99('0xc1')](_0x3f0305);});}return _0x3bac3b;});}})[_0x2a99('0x24')](respondWithStatusCode(_0x2d0891,null))[_0x2a99('0x65')](handleError(_0x2d0891,null));};exports[_0x2a99('0xc2')]=function(_0x2c05ff,_0x21bf23,_0x448932){var _0x5dc18f;return db['User'][_0x2a99('0x45')]({'where':{'id':_0x2c05ff[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a')]})[_0x2a99('0x24')](handleEntityNotFound(_0x21bf23,null))[_0x2a99('0x24')](function(_0x4afc2e){if(_0x4afc2e){_0x5dc18f=_0x4afc2e;if(!_0x2c05ff[_0x2a99('0x54')]['channel']||!utils[_0x2a99('0xc3')](_0x2c05ff[_0x2a99('0x54')][_0x2a99('0xad')])){throw new db['Sequelize'][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}return _0x4afc2e[_0x2a99('0xc4')+_[_0x2a99('0xb9')](_0x2c05ff[_0x2a99('0x54')]['channel'][_0x2a99('0xb3')]())+_0x2a99('0xb4')](_0x2c05ff[_0x2a99('0x54')][_0x2a99('0x6d')]);}})[_0x2a99('0x24')](function(_0x60f301){for(var _0xee0b9=0x0;_0xee0b9<_0x2c05ff[_0x2a99('0x54')][_0x2a99('0x6d')][_0x2a99('0x69')];_0xee0b9+=0x1){var _0x2e851f={'UserId':_0x2c05ff[_0x2a99('0x66')]['id']};_0x2e851f[_['capitalize'](_0x2c05ff['query']['channel'][_0x2a99('0xb3')]())+'QueueId']=_0x2c05ff['query']['ids'][_0xee0b9];socket['emit'](_0x2a99('0x8c')+_[_0x2a99('0xb9')](_0x2c05ff[_0x2a99('0x54')][_0x2a99('0xad')]['toLowerCase']())+_0x2a99('0xc5'),_0x2e851f);}return _0x60f301;})[_0x2a99('0x24')](function(){if(_0x2c05ff['query'][_0x2a99('0xad')]==='voice'){return db[_0x2a99('0xc0')]['destroy']({'where':{'UserId':_0x2c05ff['params']['id'],'VoiceQueueId':_0x2c05ff[_0x2a99('0x54')][_0x2a99('0x6d')]},'individualHooks':!![]})[_0x2a99('0x24')](function(){return _0x5dc18f;});}return _0x5dc18f;})['then'](respondWithStatusCode(_0x21bf23,null))[_0x2a99('0x65')](handleError(_0x21bf23,null));};exports[_0x2a99('0xc6')]=function(_0x380633,_0x805370,_0x1a30e4){_0x380633[_0x2a99('0x6a')][_0x2a99('0xc7')]=_0x380633[_0x2a99('0xc8')][_0x2a99('0xc9')];return db['User'][_0x2a99('0x45')]({'where':{'id':_0x380633[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x805370,null))['then'](saveUpdates(_0x380633[_0x2a99('0x6a')],null))[_0x2a99('0x24')](respondWithResult(_0x805370,null))[_0x2a99('0x65')](handleError(_0x805370,null));};exports[_0x2a99('0xca')]=function(_0x957bc7,_0x5b0d57,_0x595573){var _0x39d733=path[_0x2a99('0xcb')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x957bc7[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0xc7')],'raw':!![]})[_0x2a99('0x24')](handleEntityNotFound(_0x5b0d57,null))[_0x2a99('0x24')](function(_0x445fca){if(_0x445fca){if(_['isNil'](_0x445fca['userpic'])){return _0x5b0d57[_0x2a99('0xcc')](_0x39d733);}else{if(!fs[_0x2a99('0xcd')](path[_0x2a99('0xcb')](config[_0x2a99('0xce')],_0x2a99('0xcf'),_0x445fca[_0x2a99('0xc7')]))){return _0x5b0d57[_0x2a99('0xcc')](_0x39d733);}return _0x5b0d57['download'](path[_0x2a99('0xcb')](config[_0x2a99('0xce')],_0x2a99('0xcf'),_0x445fca['userpic']));}}})['catch'](handleError(_0x5b0d57,null));};exports[_0x2a99('0xd0')]=function(_0x29ec15,_0x57cee3,_0x7d457f){var _0x47bef1={};var _0x5776ee={};var _0x22f086;var _0x4418e3;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x29ec15['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x57cee3,null))[_0x2a99('0x24')](function(_0x42c0a4){if(_0x42c0a4){_0x22f086=_0x42c0a4;_0x5776ee[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xd2')][_0x2a99('0x4c')]);_0x5776ee[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x29ec15[_0x2a99('0x54')]);_0x5776ee[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x5776ee[_0x2a99('0x50')],_0x5776ee['query']);_0x47bef1['attributes']=_['intersection'](_0x5776ee[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x29ec15[_0x2a99('0x54')]['fields']));_0x47bef1[_0x2a99('0x57')]=_0x47bef1[_0x2a99('0x57')][_0x2a99('0x69')]?_0x47bef1['attributes']:_0x5776ee[_0x2a99('0x50')];_0x47bef1[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x29ec15[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x47bef1['where']=qs['filters'](_[_0x2a99('0xd4')](_0x29ec15[_0x2a99('0x54')],_0x5776ee[_0x2a99('0x53')]));if(_0x29ec15[_0x2a99('0x54')][_0x2a99('0x41')]){_0x47bef1[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x47bef1[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x47bef1[_0x2a99('0x57')],function(_0x1b8390){var _0xdd324={};_0xdd324[_0x1b8390]={'$like':'%'+_0x29ec15[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0xdd324;})});}_0x47bef1=_['merge']({},_0x47bef1,_0x29ec15['options']);return _0x22f086[_0x2a99('0xd0')](_0x47bef1);}})['then'](function(_0x521a93){if(_0x521a93){_0x4418e3=_0x521a93[_0x2a99('0x69')];if(_0x29ec15[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x62'))){_0x47bef1[_0x2a99('0x63')]=[{'model':db[_0x2a99('0xd5')],'as':_0x2a99('0xd6'),'required':![]},{'model':db['Tag'],'as':_0x2a99('0xd7'),'attributes':['id',_0x2a99('0x46'),_0x2a99('0xd8')],'where':_0x29ec15[_0x2a99('0x54')][_0x2a99('0xd9')]?{'id':_0x29ec15[_0x2a99('0x54')][_0x2a99('0xd9')]}:undefined,'required':_0x29ec15[_0x2a99('0x54')]['tag']?!![]:![]}];}if(!_0x29ec15[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x47bef1[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x29ec15[_0x2a99('0x54')][_0x2a99('0x32')]);_0x47bef1[_0x2a99('0x31')]=qs['offset'](_0x29ec15[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x22f086['getContacts'](_0x47bef1);}})[_0x2a99('0x24')](function(_0x33e2cb){if(_0x33e2cb){return _0x33e2cb?{'count':_0x4418e3,'rows':_0x33e2cb}:null;}})[_0x2a99('0x24')](respondWithResult(_0x57cee3,null))[_0x2a99('0x65')](handleError(_0x57cee3,null));};exports[_0x2a99('0xda')]=function(_0x44398f,_0x21b529,_0x25800f){var _0x1dca9e;var _0x226e77;var _0x2f489f={};var _0x1eed53;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x44398f[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a')]})[_0x2a99('0x24')](handleEntityNotFound(_0x21b529,null))['then'](function(_0x5142cd){if(!utils[_0x2a99('0xc3')](_0x44398f['query'][_0x2a99('0xad')])){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}_0x1dca9e=_0x5142cd;var _0x20ba77={};_0x20ba77['model']=_[_0x2a99('0x68')](db[_[_0x2a99('0xb9')](_0x44398f[_0x2a99('0x54')][_0x2a99('0xad')])+_0x2a99('0xdb')]['rawAttributes']);_0x20ba77[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x44398f[_0x2a99('0x54')]);_0x20ba77[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x20ba77[_0x2a99('0x50')],_0x20ba77['query']);_0x2f489f[_0x2a99('0x57')]=_['intersection'](_0x20ba77['model'],qs[_0x2a99('0x56')](_0x44398f[_0x2a99('0x54')][_0x2a99('0x56')]));_0x2f489f[_0x2a99('0x57')]=_0x2f489f[_0x2a99('0x57')][_0x2a99('0x69')]?_0x2f489f['attributes']:_0x20ba77[_0x2a99('0x50')];_0x2f489f[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x44398f[_0x2a99('0x54')]['sort']);_0x2f489f[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x44398f['query'],_0x20ba77[_0x2a99('0x53')]));if(_0x44398f['query'][_0x2a99('0x41')]){_0x2f489f[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x2f489f[_0x2a99('0x5b')],{'$or':_['map'](_0x2f489f[_0x2a99('0x57')],function(_0x1a3d57){var _0x183efe={};_0x183efe[_0x1a3d57]={'$like':'%'+_0x44398f[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x183efe;})});}_0x2f489f=_[_0x2a99('0x5c')]({},_0x2f489f,_0x44398f['options']);switch(_0x1dca9e[_0x2a99('0x3a')]){case _0x2a99('0x3b'):return db[_['capitalize'](_0x44398f[_0x2a99('0x54')][_0x2a99('0xad')])+_0x2a99('0xdb')]['findAll'](_0x2f489f);case _0x2a99('0x8c'):case'agent':return _0x1dca9e['get'+_[_0x2a99('0xb9')](_0x44398f['query'][_0x2a99('0xad')])+_0x2a99('0xb4')](_0x2f489f);default:throw new db[(_0x2a99('0xa0'))]['ValidationError'](_0x2a99('0xdc'));}})['then'](function(_0x3f92c9){_0x1eed53=_0x3f92c9[_0x2a99('0x69')];if(!_0x44398f[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x2f489f[_0x2a99('0x32')]=qs['limit'](_0x44398f['query']['limit']);_0x2f489f[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x44398f[_0x2a99('0x54')][_0x2a99('0x31')]);}switch(_0x1dca9e['role']){case _0x2a99('0x3b'):return db[_[_0x2a99('0xb9')](_0x44398f[_0x2a99('0x54')]['channel'])+_0x2a99('0xdb')][_0x2a99('0x64')](_0x2f489f);case _0x2a99('0x8c'):case _0x2a99('0x3e'):return _0x1dca9e['get'+_[_0x2a99('0xb9')](_0x44398f[_0x2a99('0x54')]['channel'])+_0x2a99('0xb4')](_0x2f489f);}})[_0x2a99('0x24')](function(_0x2ee24c){return{'count':_0x1eed53,'rows':_0x2ee24c};})[_0x2a99('0x24')](respondWithResult(_0x21b529,null))['catch'](handleError(_0x21b529,null));};exports[_0x2a99('0xdd')]=function(_0x1b41c4,_0xf12c3a,_0x52dcae){var _0x50ebfe={};var _0x28a6ba={};var _0x240a18;var _0x1be5cb;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x1b41c4[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0xf12c3a,null))[_0x2a99('0x24')](function(_0x34d235){if(_0x34d235){_0x240a18=_0x34d235;_0x28a6ba['model']=_['keys'](db[_0x2a99('0xc0')][_0x2a99('0x4c')]);_0x28a6ba[_0x2a99('0x54')]=_['keys'](_0x1b41c4[_0x2a99('0x54')]);_0x28a6ba[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x28a6ba[_0x2a99('0x50')],_0x28a6ba['query']);_0x50ebfe[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x28a6ba[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x56')]));_0x50ebfe[_0x2a99('0x57')]=_0x50ebfe[_0x2a99('0x57')][_0x2a99('0x69')]?_0x50ebfe['attributes']:_0x28a6ba[_0x2a99('0x50')];_0x50ebfe[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x50ebfe['where']=qs[_0x2a99('0x53')](_['pick'](_0x1b41c4[_0x2a99('0x54')],_0x28a6ba['filters']));if(_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x41')]){_0x50ebfe[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x50ebfe[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x50ebfe[_0x2a99('0x57')],function(_0x37db2e){var _0x4c981b={};_0x4c981b[_0x37db2e]={'$like':'%'+_0x1b41c4['query'][_0x2a99('0x41')]+'%'};return _0x4c981b;})});}_0x50ebfe=_[_0x2a99('0x5c')]({},_0x50ebfe,_0x1b41c4[_0x2a99('0x61')]);return _0x240a18[_0x2a99('0xdd')](_0x50ebfe);}})[_0x2a99('0x24')](function(_0x3e833b){if(_0x3e833b){_0x1be5cb=_0x3e833b[_0x2a99('0x69')];if(!_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x50ebfe['limit']=qs['limit'](_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x32')]);_0x50ebfe['offset']=qs['offset'](_0x1b41c4[_0x2a99('0x54')]['offset']);}return _0x240a18[_0x2a99('0xdd')](_0x50ebfe);}})[_0x2a99('0x24')](function(_0x41fb14){if(_0x41fb14){return _0x41fb14?{'count':_0x1be5cb,'rows':_0x41fb14}:null;}})['then'](respondWithResult(_0xf12c3a,null))[_0x2a99('0x65')](handleError(_0xf12c3a,null));};exports[_0x2a99('0xde')]=function(_0x395a29,_0x1563bb,_0x16187a){var _0x5552a5={};var _0xf9eda5={};var _0x19816c;var _0x552206;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x395a29[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x1563bb,null))['then'](function(_0x2d9e2e){if(_0x2d9e2e){_0x19816c=_0x2d9e2e;_0xf9eda5['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0xf9eda5[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x395a29[_0x2a99('0x54')]);_0xf9eda5[_0x2a99('0x53')]=_['intersection'](_0xf9eda5[_0x2a99('0x50')],_0xf9eda5[_0x2a99('0x54')]);_0x5552a5[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0xf9eda5[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x395a29[_0x2a99('0x54')]['fields']));_0x5552a5[_0x2a99('0x57')]=_0x5552a5[_0x2a99('0x57')][_0x2a99('0x69')]?_0x5552a5['attributes']:_0xf9eda5[_0x2a99('0x50')];_0x5552a5['order']=qs[_0x2a99('0x5a')](_0x395a29['query']['sort']);_0x5552a5[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x395a29[_0x2a99('0x54')],_0xf9eda5['filters']));if(_0x395a29['query'][_0x2a99('0x41')]){_0x5552a5[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x5552a5[_0x2a99('0x5b')],{'$or':_['map'](_0x5552a5['attributes'],function(_0x42adf6){var _0x12fb8e={};_0x12fb8e[_0x42adf6]={'$like':'%'+_0x395a29[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x12fb8e;})});}_0x5552a5=_['merge']({},_0x5552a5,_0x395a29[_0x2a99('0x61')]);return _0x19816c['getGroups'](_0x5552a5);}})['then'](function(_0x2a810c){if(_0x2a810c){_0x552206=_0x2a810c[_0x2a99('0x69')];if(!_0x395a29[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x5552a5[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x395a29[_0x2a99('0x54')][_0x2a99('0x32')]);_0x5552a5['offset']=qs[_0x2a99('0x31')](_0x395a29[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x19816c[_0x2a99('0xde')](_0x5552a5);}})[_0x2a99('0x24')](function(_0x59f918){if(_0x59f918){return _0x59f918?{'count':_0x552206,'rows':_0x59f918}:null;}})['then'](respondWithResult(_0x1563bb,null))[_0x2a99('0x65')](handleError(_0x1563bb,null));};exports[_0x2a99('0xdf')]=function(_0x24ff40,_0x1cbd05,_0x150092){var _0x1c4d74={'raw':!![],'where':{}};var _0x4d06a7={};var _0x4d7b63={'count':0x0,'rows':[]};return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x24ff40[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x1cbd05,null))[_0x2a99('0x24')](function(_0x31a9a0){if(_0x31a9a0){_0x4d06a7[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xe0')][_0x2a99('0x4c')]);_0x4d06a7[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x24ff40[_0x2a99('0x54')]);_0x4d06a7[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x4d06a7['model'],_0x4d06a7['query']);_0x1c4d74[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x4d06a7['model'],qs['fields'](_0x24ff40['query']['fields']));_0x1c4d74[_0x2a99('0x57')]=_0x1c4d74[_0x2a99('0x57')]['length']?_0x1c4d74[_0x2a99('0x57')]:_0x4d06a7[_0x2a99('0x50')];if(!_0x24ff40[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x1c4d74['limit']=qs['limit'](_0x24ff40['query'][_0x2a99('0x32')]);_0x1c4d74[_0x2a99('0x31')]=qs['offset'](_0x24ff40[_0x2a99('0x54')][_0x2a99('0x31')]);}_0x1c4d74['order']=qs[_0x2a99('0x5a')](_0x24ff40[_0x2a99('0x54')]['sort']);_0x1c4d74['where']=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x24ff40[_0x2a99('0x54')],_0x4d06a7[_0x2a99('0x53')]));_0x1c4d74[_0x2a99('0x5b')][_0x2a99('0xe1')]=_0x31a9a0['id'];if(_0x24ff40[_0x2a99('0x54')]['filter']){_0x1c4d74[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x1c4d74[_0x2a99('0x5b')],{'$or':_['map'](_0x1c4d74['attributes'],function(_0x3ab369){var _0x1ff52f={};_0x1ff52f[_0x3ab369]={'$like':'%'+_0x24ff40[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x1ff52f;})});}_0x1c4d74=_[_0x2a99('0x5c')]({},_0x1c4d74,_0x24ff40[_0x2a99('0x61')]);return db['VoiceRecording']['count']({'where':_0x1c4d74[_0x2a99('0x5b')]})[_0x2a99('0x24')](function(_0x4f81bf){_0x4d7b63['count']=_0x4f81bf;if(_0x24ff40[_0x2a99('0x54')]['includeAll']){_0x1c4d74[_0x2a99('0x63')]=[{'all':!![]}];}return db[_0x2a99('0xe0')][_0x2a99('0x64')](_0x1c4d74);})[_0x2a99('0x24')](function(_0x3fe4c3){_0x4d7b63['rows']=_0x3fe4c3;return _0x4d7b63;});}})[_0x2a99('0x24')](respondWithFilteredResult(_0x1cbd05,_0x1c4d74))[_0x2a99('0x65')](handleError(_0x1cbd05,null));};exports[_0x2a99('0xe2')]=function(_0x56504a,_0x4a7974,_0x4997a2){var _0x188f63={'raw':!![],'where':{}};var _0x12baa1={};var _0x481576={'count':0x0,'rows':[]};return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x56504a[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x4a7974,null))[_0x2a99('0x24')](function(_0x30397a){if(_0x30397a){_0x12baa1['model']=_[_0x2a99('0x68')](db[_0x2a99('0xe3')][_0x2a99('0x4c')]);_0x12baa1[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x56504a[_0x2a99('0x54')]);_0x12baa1[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x12baa1['model'],_0x12baa1[_0x2a99('0x54')]);_0x188f63['attributes']=_[_0x2a99('0x55')](_0x12baa1[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x56504a[_0x2a99('0x54')][_0x2a99('0x56')]));_0x188f63[_0x2a99('0x57')]=_0x188f63[_0x2a99('0x57')]['length']?_0x188f63[_0x2a99('0x57')]:_0x12baa1['model'];if(!_0x56504a[_0x2a99('0x54')]['hasOwnProperty'](_0x2a99('0x59'))){_0x188f63[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x56504a[_0x2a99('0x54')][_0x2a99('0x32')]);_0x188f63[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x56504a[_0x2a99('0x54')]['offset']);}_0x188f63['order']=qs[_0x2a99('0x5a')](_0x56504a['query'][_0x2a99('0x5a')]);_0x188f63[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x56504a[_0x2a99('0x54')],_0x12baa1[_0x2a99('0x53')]));_0x188f63['where']['UserId']=_0x30397a['id'];if(_0x56504a[_0x2a99('0x54')][_0x2a99('0x41')]){_0x188f63[_0x2a99('0x5b')]=_['merge'](_0x188f63['where'],{'$or':_[_0x2a99('0x43')](_0x188f63[_0x2a99('0x57')],function(_0xae51ed){var _0x4547bb={};_0x4547bb[_0xae51ed]={'$like':'%'+_0x56504a[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x4547bb;})});}_0x188f63=_[_0x2a99('0x5c')]({},_0x188f63,_0x56504a[_0x2a99('0x61')]);return db['ScreenRecording'][_0x2a99('0x30')]({'where':_0x188f63[_0x2a99('0x5b')]})[_0x2a99('0x24')](function(_0xab854c){_0x481576[_0x2a99('0x30')]=_0xab854c;if(_0x56504a[_0x2a99('0x54')][_0x2a99('0x62')]){_0x188f63[_0x2a99('0x63')]=[{'all':!![]}];}return db[_0x2a99('0xe3')][_0x2a99('0x64')](_0x188f63);})['then'](function(_0x415101){_0x481576[_0x2a99('0xe4')]=_0x415101;return _0x481576;});}})[_0x2a99('0x24')](respondWithFilteredResult(_0x4a7974,_0x188f63))[_0x2a99('0x65')](handleError(_0x4a7974,null));};exports[_0x2a99('0xe5')]=function(_0x1997b7,_0x39c9e8,_0x2b8311){var _0x29a9e9={};var _0x38353d={};var _0x181f8c;var _0x1fc731;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x1997b7['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x39c9e8,null))[_0x2a99('0x24')](function(_0x361a31){if(_0x361a31){_0x181f8c=_0x361a31;_0x38353d['model']=_['keys'](db[_0x2a99('0xe6')]['rawAttributes']);_0x38353d['query']=_[_0x2a99('0x68')](_0x1997b7[_0x2a99('0x54')]);_0x38353d[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x38353d['model'],_0x38353d['query']);_0x29a9e9['attributes']=_[_0x2a99('0x55')](_0x38353d[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x1997b7['query'][_0x2a99('0x56')]));_0x29a9e9[_0x2a99('0x57')]=_0x29a9e9[_0x2a99('0x57')]['length']?_0x29a9e9['attributes']:_0x38353d[_0x2a99('0x50')];_0x29a9e9['order']=qs['sort'](_0x1997b7[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x29a9e9[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x1997b7[_0x2a99('0x54')],_0x38353d[_0x2a99('0x53')]));if(_0x1997b7[_0x2a99('0x54')][_0x2a99('0x41')]){_0x29a9e9[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x29a9e9[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x29a9e9[_0x2a99('0x57')],function(_0x11ab7e){var _0x363908={};_0x363908[_0x11ab7e]={'$like':'%'+_0x1997b7[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x363908;})});}_0x29a9e9=_[_0x2a99('0x5c')]({},_0x29a9e9,_0x1997b7[_0x2a99('0x61')]);return _0x181f8c['getChatInteractions'](_0x29a9e9);}})[_0x2a99('0x24')](function(_0x409f41){if(_0x409f41){_0x1fc731=_0x409f41['length'];if(!_0x1997b7[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x29a9e9['limit']=qs[_0x2a99('0x32')](_0x1997b7['query'][_0x2a99('0x32')]);_0x29a9e9[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x1997b7[_0x2a99('0x54')]['offset']);}return _0x181f8c[_0x2a99('0xe5')](_0x29a9e9);}})[_0x2a99('0x24')](function(_0x255ed8){if(_0x255ed8){return _0x255ed8?{'count':_0x1fc731,'rows':_0x255ed8}:null;}})['then'](respondWithResult(_0x39c9e8,null))[_0x2a99('0x65')](handleError(_0x39c9e8,null));};exports[_0x2a99('0xe7')]=function(_0x2a9564,_0x34d72d,_0x4bb73d){var _0x25cc70={};var _0xef2ce5={};var _0x39e4b7;var _0xc6afc3;return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x2a9564[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x34d72d,null))[_0x2a99('0x24')](function(_0x254e82){if(_0x254e82){_0x39e4b7=_0x254e82;_0xef2ce5['model']=_[_0x2a99('0x68')](db[_0x2a99('0xe8')][_0x2a99('0x4c')]);_0xef2ce5[_0x2a99('0x54')]=_['keys'](_0x2a9564['query']);_0xef2ce5[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0xef2ce5[_0x2a99('0x50')],_0xef2ce5['query']);_0x25cc70[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0xef2ce5['model'],qs[_0x2a99('0x56')](_0x2a9564[_0x2a99('0x54')]['fields']));_0x25cc70[_0x2a99('0x57')]=_0x25cc70['attributes'][_0x2a99('0x69')]?_0x25cc70[_0x2a99('0x57')]:_0xef2ce5['model'];_0x25cc70['order']=qs[_0x2a99('0x5a')](_0x2a9564[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x25cc70[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x2a9564[_0x2a99('0x54')],_0xef2ce5[_0x2a99('0x53')]));if(_0x2a9564['query']['filter']){_0x25cc70[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x25cc70['where'],{'$or':_['map'](_0x25cc70[_0x2a99('0x57')],function(_0x5a4940){var _0x1a1283={};_0x1a1283[_0x5a4940]={'$like':'%'+_0x2a9564['query'][_0x2a99('0x41')]+'%'};return _0x1a1283;})});}_0x25cc70=_['merge']({},_0x25cc70,_0x2a9564[_0x2a99('0x61')]);return _0x39e4b7[_0x2a99('0xe7')](_0x25cc70);}})[_0x2a99('0x24')](function(_0x11624e){if(_0x11624e){_0xc6afc3=_0x11624e[_0x2a99('0x69')];if(!_0x2a9564[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x25cc70[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x2a9564[_0x2a99('0x54')][_0x2a99('0x32')]);_0x25cc70[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x2a9564[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x39e4b7[_0x2a99('0xe7')](_0x25cc70);}})[_0x2a99('0x24')](function(_0x3505f4){if(_0x3505f4){return _0x3505f4?{'count':_0xc6afc3,'rows':_0x3505f4}:null;}})[_0x2a99('0x24')](respondWithResult(_0x34d72d,null))[_0x2a99('0x65')](handleError(_0x34d72d,null));};exports[_0x2a99('0xe9')]=function(_0x4498fe,_0x5b8e9f,_0x5e9c59){var _0x239910={'raw':!![],'where':{}};var _0x4a965d={};var _0x196a8e={'count':0x0,'rows':[]};return db['User'][_0x2a99('0xd1')]({'where':{'id':_0x4498fe[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x5b8e9f,null))[_0x2a99('0x24')](function(_0x3b1a10){if(_0x3b1a10){_0x4a965d[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xea')][_0x2a99('0x4c')]);_0x4a965d[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x4498fe[_0x2a99('0x54')]);_0x4a965d[_0x2a99('0x53')]=_['intersection'](_0x4a965d[_0x2a99('0x50')],_0x4a965d[_0x2a99('0x54')]);_0x239910[_0x2a99('0x57')]=_['intersection'](_0x4a965d[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x4498fe[_0x2a99('0x54')][_0x2a99('0x56')]));_0x239910[_0x2a99('0x57')]=_0x239910[_0x2a99('0x57')][_0x2a99('0x69')]?_0x239910[_0x2a99('0x57')]:_0x4a965d['model'];if(!_0x4498fe[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x239910[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x4498fe[_0x2a99('0x54')][_0x2a99('0x32')]);_0x239910[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x4498fe[_0x2a99('0x54')]['offset']);}_0x239910[_0x2a99('0xd3')]=qs['sort'](_0x4498fe['query'][_0x2a99('0x5a')]);_0x239910[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x4498fe[_0x2a99('0x54')],_0x4a965d[_0x2a99('0x53')]));_0x239910['where'][_0x2a99('0xe1')]=_0x3b1a10['id'];if(_0x4498fe[_0x2a99('0x54')][_0x2a99('0x41')]){_0x239910[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x239910[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x239910[_0x2a99('0x57')],function(_0x32b2fe){var _0xc45bd6={};_0xc45bd6[_0x32b2fe]={'$like':'%'+_0x4498fe[_0x2a99('0x54')]['filter']+'%'};return _0xc45bd6;})});}_0x239910=_['merge']({},_0x239910,_0x4498fe[_0x2a99('0x61')]);return db['MailInteraction'][_0x2a99('0x30')]({'where':_0x239910[_0x2a99('0x5b')]})['then'](function(_0x3cb7c3){_0x196a8e[_0x2a99('0x30')]=_0x3cb7c3;if(_0x4498fe[_0x2a99('0x54')]['includeAll']){_0x239910['include']=[{'all':!![]}];}return db[_0x2a99('0xea')][_0x2a99('0x64')](_0x239910);})[_0x2a99('0x24')](function(_0x3c8b16){_0x196a8e[_0x2a99('0xe4')]=_0x3c8b16;return _0x196a8e;});}})['then'](respondWithFilteredResult(_0x5b8e9f,_0x239910))[_0x2a99('0x65')](handleError(_0x5b8e9f,null));};exports[_0x2a99('0xeb')]=function(_0xba9f,_0x240c74,_0x2f271e){var _0x3cbb9b={};var _0x49458f={};var _0x356b69;var _0x40abfe;return db['User']['findOne']({'where':{'id':_0xba9f[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x240c74,null))[_0x2a99('0x24')](function(_0x28333b){if(_0x28333b){_0x356b69=_0x28333b;_0x49458f[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xec')][_0x2a99('0x4c')]);_0x49458f[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0xba9f['query']);_0x49458f[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x49458f[_0x2a99('0x50')],_0x49458f[_0x2a99('0x54')]);_0x3cbb9b[_0x2a99('0x57')]=_['intersection'](_0x49458f[_0x2a99('0x50')],qs['fields'](_0xba9f['query']['fields']));_0x3cbb9b['attributes']=_0x3cbb9b[_0x2a99('0x57')][_0x2a99('0x69')]?_0x3cbb9b[_0x2a99('0x57')]:_0x49458f['model'];_0x3cbb9b[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0xba9f['query'][_0x2a99('0x5a')]);_0x3cbb9b['where']=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0xba9f[_0x2a99('0x54')],_0x49458f[_0x2a99('0x53')]));if(_0xba9f[_0x2a99('0x54')]['filter']){_0x3cbb9b[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x3cbb9b[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x3cbb9b['attributes'],function(_0x521943){var _0x1d23a4={};_0x1d23a4[_0x521943]={'$like':'%'+_0xba9f[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x1d23a4;})});}_0x3cbb9b=_[_0x2a99('0x5c')]({},_0x3cbb9b,_0xba9f[_0x2a99('0x61')]);return _0x356b69['getSmsInteractions'](_0x3cbb9b);}})[_0x2a99('0x24')](function(_0x266a65){if(_0x266a65){_0x40abfe=_0x266a65['length'];if(!_0xba9f[_0x2a99('0x54')]['hasOwnProperty'](_0x2a99('0x59'))){_0x3cbb9b[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0xba9f['query']['limit']);_0x3cbb9b[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0xba9f[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x356b69[_0x2a99('0xeb')](_0x3cbb9b);}})[_0x2a99('0x24')](function(_0x5a3647){if(_0x5a3647){return _0x5a3647?{'count':_0x40abfe,'rows':_0x5a3647}:null;}})[_0x2a99('0x24')](respondWithResult(_0x240c74,null))[_0x2a99('0x65')](handleError(_0x240c74,null));};exports[_0x2a99('0xed')]=function(_0x56eac9,_0x55ad96,_0x44d26f){var _0x2b5449={};var _0x2e842d={};var _0x5bfc0f;var _0x51d356;return db['User']['findOne']({'where':{'id':_0x56eac9['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x55ad96,null))[_0x2a99('0x24')](function(_0x3de53f){if(_0x3de53f){_0x5bfc0f=_0x3de53f;_0x2e842d[_0x2a99('0x50')]=_['keys'](db[_0x2a99('0xee')][_0x2a99('0x4c')]);_0x2e842d[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x56eac9[_0x2a99('0x54')]);_0x2e842d[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x2e842d[_0x2a99('0x50')],_0x2e842d[_0x2a99('0x54')]);_0x2b5449[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x2e842d[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x56eac9['query']['fields']));_0x2b5449[_0x2a99('0x57')]=_0x2b5449[_0x2a99('0x57')][_0x2a99('0x69')]?_0x2b5449[_0x2a99('0x57')]:_0x2e842d[_0x2a99('0x50')];_0x2b5449[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x56eac9[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x2b5449[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x56eac9[_0x2a99('0x54')],_0x2e842d[_0x2a99('0x53')]));if(_0x56eac9[_0x2a99('0x54')][_0x2a99('0x41')]){_0x2b5449[_0x2a99('0x5b')]=_['merge'](_0x2b5449['where'],{'$or':_[_0x2a99('0x43')](_0x2b5449['attributes'],function(_0x5ed6b8){var _0x2f851d={};_0x2f851d[_0x5ed6b8]={'$like':'%'+_0x56eac9[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x2f851d;})});}_0x2b5449=_['merge']({},_0x2b5449,_0x56eac9[_0x2a99('0x61')]);return _0x5bfc0f['getFaxInteractions'](_0x2b5449);}})[_0x2a99('0x24')](function(_0x2ba6e3){if(_0x2ba6e3){_0x51d356=_0x2ba6e3['length'];if(!_0x56eac9['query'][_0x2a99('0x58')](_0x2a99('0x59'))){_0x2b5449[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x56eac9['query'][_0x2a99('0x32')]);_0x2b5449[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x56eac9[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x5bfc0f[_0x2a99('0xed')](_0x2b5449);}})['then'](function(_0x32113e){if(_0x32113e){return _0x32113e?{'count':_0x51d356,'rows':_0x32113e}:null;}})[_0x2a99('0x24')](respondWithResult(_0x55ad96,null))['catch'](handleError(_0x55ad96,null));};exports[_0x2a99('0xef')]=function(_0x1ba918,_0x42e524,_0x3e0060){var _0x21eca0={};var _0x497a67={};var _0x81ef03;var _0xd1be8e;return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x1ba918[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x42e524,null))[_0x2a99('0x24')](function(_0x3aae0e){if(_0x3aae0e){_0x81ef03=_0x3aae0e;_0x497a67[_0x2a99('0x50')]=_[_0x2a99('0x68')](db['WhatsappInteraction']['rawAttributes']);_0x497a67[_0x2a99('0x54')]=_['keys'](_0x1ba918['query']);_0x497a67[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x497a67['model'],_0x497a67[_0x2a99('0x54')]);_0x21eca0[_0x2a99('0x57')]=_['intersection'](_0x497a67[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x1ba918['query'][_0x2a99('0x56')]));_0x21eca0[_0x2a99('0x57')]=_0x21eca0[_0x2a99('0x57')][_0x2a99('0x69')]?_0x21eca0[_0x2a99('0x57')]:_0x497a67[_0x2a99('0x50')];_0x21eca0[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x1ba918[_0x2a99('0x54')]['sort']);_0x21eca0[_0x2a99('0x5b')]=qs['filters'](_[_0x2a99('0xd4')](_0x1ba918[_0x2a99('0x54')],_0x497a67['filters']));if(_0x1ba918['query'][_0x2a99('0x41')]){_0x21eca0[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x21eca0[_0x2a99('0x5b')],{'$or':_['map'](_0x21eca0[_0x2a99('0x57')],function(_0x2d9e84){var _0x43d901={};_0x43d901[_0x2d9e84]={'$like':'%'+_0x1ba918[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x43d901;})});}_0x21eca0=_[_0x2a99('0x5c')]({},_0x21eca0,_0x1ba918[_0x2a99('0x61')]);return _0x81ef03[_0x2a99('0xef')](_0x21eca0);}})['then'](function(_0x10749c){if(_0x10749c){_0xd1be8e=_0x10749c[_0x2a99('0x69')];if(!_0x1ba918[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x21eca0['limit']=qs['limit'](_0x1ba918[_0x2a99('0x54')][_0x2a99('0x32')]);_0x21eca0[_0x2a99('0x31')]=qs['offset'](_0x1ba918['query']['offset']);}return _0x81ef03[_0x2a99('0xef')](_0x21eca0);}})[_0x2a99('0x24')](function(_0x54215d){if(_0x54215d){return _0x54215d?{'count':_0xd1be8e,'rows':_0x54215d}:null;}})['then'](respondWithResult(_0x42e524,null))['catch'](handleError(_0x42e524,null));};exports[_0x2a99('0xf0')]=function(_0x3d6725,_0x350c23,_0x3f21cc){var _0x1b17cb;var _0x418208;var _0x52374b;var _0x5a04cd=!_[_0x2a99('0x75')](_0x3d6725['params']['id'])?_0x3d6725[_0x2a99('0x66')]['id']:!_['isNil'](_0x3d6725['user']['id'])?_0x3d6725['user']['id']:null;return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x5a04cd,'role':{'$or':[_0x2a99('0x3b'),_0x2a99('0x8c'),_0x2a99('0x3e')]}},'attributes':['id',_0x2a99('0x46'),_0x2a99('0xf1'),'mobile',_0x2a99('0x3a'),_0x2a99('0x6f'),'loginInPause']})[_0x2a99('0x24')](function(_0x428a77){if(_0x428a77){if(_0x428a77[_0x2a99('0x3a')]==='agent'){_0x1b17cb=_0x428a77;if(_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xb0')]){_0x52374b=util['format'](_0x2a99('0xf2'),_0x1b17cb[_0x3d6725[_0x2a99('0x6a')]['interface']]);}else if(_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xf3')]){_0x52374b=util[_0x2a99('0xbe')](_0x2a99('0xbf'),_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xf3')]);}else{_0x52374b=util[_0x2a99('0xbe')]('SIP/%s',_0x1b17cb['name']);}socket['to'](util[_0x2a99('0xbe')](_0x2a99('0xf4'),_0x1b17cb[_0x2a99('0x46')]))[_0x2a99('0xb8')](_0x2a99('0xf5'),{'ip':_0x3d6725[_0x2a99('0xf6')]['x-forwarded-for']||_0x3d6725['connection'][_0x2a99('0xf7')]||_0x3d6725[_0x2a99('0xf8')][_0x2a99('0xf7')]||_0x3d6725[_0x2a99('0xf9')]['socket'][_0x2a99('0xf7')]});return db[_0x2a99('0xc0')][_0x2a99('0x38')]({'where':{'membername':_0x1b17cb[_0x2a99('0x46')]},'individualHooks':!![]});}}else{throw new db[(_0x2a99('0xa0'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2a99('0x24')](function(){if(_0x1b17cb){return _0x1b17cb[_0x2a99('0xfa')]({'raw':!![]});}})['then'](function(_0x5d7b4e){if(_0x1b17cb){var _0x3cf40f=[];if(_0x5d7b4e){_0x418208=_0x5d7b4e;if(_0x418208[_0x2a99('0x69')]){for(var _0x851c75=0x0;_0x851c75<_0x418208[_0x2a99('0x69')];_0x851c75++){_0x3cf40f[_0x2a99('0x98')]({'membername':_0x1b17cb['name'],'UserId':_0x1b17cb['id'],'queue_name':_0x418208[_0x851c75][_0x2a99('0x46')],'VoiceQueueId':_0x418208[_0x851c75]['id'],'interface':_0x52374b,'paused':_0x1b17cb[_0x2a99('0xae')]||![],'penalty':_0x418208[_0x851c75][_0x2a99('0xfb')]||0x0});}return BPromise[_0x2a99('0x9a')](_0x3cf40f,function(_0x37d448){return db['UserVoiceQueueRt'][_0x2a99('0xc1')](_0x37d448);});}}}})[_0x2a99('0x24')](function(){if(_0x1b17cb){return db['MemberReport'][_0x2a99('0x64')]({'where':{'membername':_0x1b17cb[_0x2a99('0x46')],'exitAt':null}});}})[_0x2a99('0x24')](function(_0xbb9cab){if(_0x1b17cb){var _0x2586fd=[];_0xbb9cab[_0x2a99('0xfc')](function(_0x41e8aa){_0x2586fd[_0x2a99('0x98')](_0x41e8aa[_0x2a99('0xfd')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2a99('0x99')](_0x2586fd);}})[_0x2a99('0x24')](function(){if(_0x1b17cb){var _0x205627=[];var _0xec2c10=[];var _0x1e5cef=utils['getChannels']();var _0x4c0c35={'membername':_0x1b17cb[_0x2a99('0x46')],'interface':_0x52374b,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1b17cb[_0x2a99('0x3a')],'internal':_0x1b17cb[_0x2a99('0x6f')]};_0x1e5cef[_0x2a99('0xfc')](function(_0x2bcc89){_0x205627['push'](_[_0x2a99('0x5c')]({'channel':_0x2bcc89,'type':_0x2a99('0xfe'),'data1':_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xff')],'data2':_0x52374b},_0x4c0c35));if(_0x1b17cb[_0x2a99('0xae')]){_0xec2c10[_0x2a99('0x98')](_['merge']({'channel':_0x2bcc89,'type':_0x2a99('0x100'),'data1':'LOGININPAUSE'},_0x4c0c35));}});return db[_0x2a99('0x101')][_0x2a99('0x95')](_0x205627['concat'](_0xec2c10),{'individualHooks':!![]});}})[_0x2a99('0x24')](function(){if(_0x1b17cb){return _0x1b17cb[_0x2a99('0xfd')]({'online':!![],'lastLoginAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102')),'voicePause':_0x1b17cb[_0x2a99('0xae')]||![],'mailPause':_0x1b17cb['loginInPause']||![],'chatPause':_0x1b17cb['loginInPause']||![],'faxPause':_0x1b17cb[_0x2a99('0xae')]||![],'smsPause':_0x1b17cb[_0x2a99('0xae')]||![],'openchannelPause':_0x1b17cb[_0x2a99('0xae')]||![],'whatsappPause':_0x1b17cb[_0x2a99('0xae')]||![],'pauseType':_0x1b17cb[_0x2a99('0xae')]?_0x2a99('0x103'):null,'interface':_0x52374b,'lastPauseAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102'))});}})[_0x2a99('0x24')](function(_0x20aa4c){if(_0x3d6725['isMiddleware']){return _0x3f21cc();}else{return BPromise[_0x2a99('0x104')](_0x20aa4c)['then'](respondWithResult(_0x350c23,null));}})[_0x2a99('0x65')](handleError(_0x350c23,null));};exports['logout']=function(_0x1da883,_0xc046b2,_0x19d148){var _0x3ef3ed;return db['User'][_0x2a99('0x45')]({'where':{'id':_0x1da883['params']['id'],'role':_0x2a99('0x3e')},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a')]})[_0x2a99('0x24')](handleEntityNotFound(_0xc046b2,null))['then'](function(_0xb93bbf){if(_0xb93bbf){_0x3ef3ed=_0xb93bbf;return db[_0x2a99('0xc0')][_0x2a99('0x38')]({'where':{'membername':_0x3ef3ed[_0x2a99('0x46')]},'individualHooks':!![]});}})[_0x2a99('0x24')](function(){return db[_0x2a99('0x101')][_0x2a99('0x64')]({'where':{'membername':_0x3ef3ed[_0x2a99('0x46')],'exitAt':null}});})[_0x2a99('0x24')](function(_0x3f8ec5){var _0x38f179=[];_0x3f8ec5[_0x2a99('0xfc')](function(_0x588fc3){_0x38f179[_0x2a99('0x98')](_0x588fc3['update']({'exitAt':moment()[_0x2a99('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2a99('0x99')](_0x38f179);})[_0x2a99('0x24')](function(){return _0x3ef3ed[_0x2a99('0xfd')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0xc046b2,null))[_0x2a99('0x65')](handleError(_0xc046b2,null));};exports['pause']=function(_0x19f14e,_0xb18456,_0x107166){var _0x386ad6;return db['UserVoiceQueueRt'][_0x2a99('0xfd')]({'paused':0x1},{'where':{'UserId':_0x19f14e['params']['id']},'individualHooks':!![]})[_0x2a99('0x24')](function(){return db['User'][_0x2a99('0x45')]({'where':{'id':_0x19f14e[_0x2a99('0x66')]['id'],'role':_0x2a99('0x3e')},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a'),'internal',_0x2a99('0xb0')]});})['then'](handleEntityNotFound(_0xb18456,null))[_0x2a99('0x24')](function(_0x4578da){if(_0x4578da){_0x386ad6=_0x4578da;return respondWithRpcPromise(_0x2a99('0x105'),_0x2a99('0x106'),{'id':_0x386ad6['id'],'name':_0x386ad6[_0x2a99('0x46')],'pause':!![]});}})[_0x2a99('0x24')](function(){if(_0x386ad6){return db[_0x2a99('0x101')][_0x2a99('0x64')]({'where':{'membername':_0x386ad6[_0x2a99('0x46')],'type':_0x2a99('0x100'),'exitAt':null}});}})['then'](function(_0x45c26f){if(_0x45c26f[_0x2a99('0x69')]){var _0x43840c=moment()['format'](_0x2a99('0x102'));for(var _0x130864=0x0,_0x160155=_0x45c26f[_0x2a99('0x69')];_0x130864<_0x160155;_0x130864++){_0x45c26f[_0x130864][_0x2a99('0x107')]({'exitAt':_0x43840c});}}})['then'](function(){var _0x357e5c=[];var _0x3fb3ac=utils[_0x2a99('0x108')]();_0x3fb3ac[_0x2a99('0xfc')](function(_0x1e9af5){_0x357e5c[_0x2a99('0x98')]({'channel':_0x1e9af5,'membername':_0x386ad6['name'],'interface':_['isNil'](_0x386ad6[_0x2a99('0xb0')])?util['format'](_0x2a99('0xbf'),_0x386ad6[_0x2a99('0x46')]):_0x386ad6['interface'],'type':_0x2a99('0x100'),'enterAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102')),'data1':_0x19f14e[_0x2a99('0x6a')]['type']||_0x2a99('0x109'),'role':_0x386ad6[_0x2a99('0x3a')],'internal':_0x386ad6[_0x2a99('0x6f')]});});return db[_0x2a99('0x101')][_0x2a99('0x95')](_0x357e5c,{'individualHooks':!![]});})[_0x2a99('0x24')](function(){return _0x386ad6['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x19f14e[_0x2a99('0x6a')][_0x2a99('0x4e')]||_0x2a99('0x109'),'lastPauseAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102'))});})[_0x2a99('0x24')](respondWithResult(_0xb18456,null))[_0x2a99('0x65')](handleError(_0xb18456,null));};exports[_0x2a99('0x10a')]=function(_0x25e282,_0x57898d,_0xb2f754){var _0x440075;return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x25e282[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0x46'),'role','voicePause','mailPause',_0x2a99('0x10b'),_0x2a99('0x10c'),_0x2a99('0x10d'),'smsPause',_0x2a99('0x10e'),_0x2a99('0x10f'),_0x2a99('0x110')]})[_0x2a99('0x24')](handleEntityNotFound(_0x57898d,null))[_0x2a99('0x24')](function(_0x3c60fc){if(_0x3c60fc){_0x440075=_0x3c60fc;if(_0x25e282[_0x2a99('0x6a')][_0x2a99('0xad')]&&!utils[_0x2a99('0xc3')](_0x25e282[_0x2a99('0x6a')]['channel'])){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}switch(_0x25e282[_0x2a99('0x6a')][_0x2a99('0xad')]){case _0x2a99('0xbb'):return respondWithRpcPromise('QueuePause',_0x2a99('0x10a'),{'id':_0x440075['id'],'name':_0x440075['name'],'pause':![]})[_0x2a99('0x24')](function(){return db[_0x2a99('0xc0')]['update']({'paused':0x0},{'where':{'UserId':_0x440075['id']},'individualHooks':!![]});})[_0x2a99('0x24')](function(){return db['MemberReport'][_0x2a99('0x45')]({'where':{'channel':_0x25e282['body']['channel'],'membername':_0x440075['name'],'type':_0x2a99('0x100'),'exitAt':null}});})['then'](function(_0x201cb4){if(_0x201cb4){return _0x201cb4[_0x2a99('0xfd')]({'exitAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x440075[_0x2a99('0xfd')]({'voicePause':![]});});case _0x2a99('0x111'):case'chat':case _0x2a99('0x112'):case _0x2a99('0x113'):case _0x2a99('0x114'):case _0x2a99('0x115'):return db[_0x2a99('0x101')][_0x2a99('0x45')]({'where':{'channel':_0x25e282[_0x2a99('0x6a')]['channel'],'membername':_0x440075[_0x2a99('0x46')],'type':_0x2a99('0x100'),'exitAt':null}})[_0x2a99('0x24')](function(_0x2dba6c){if(_0x2dba6c){return _0x2dba6c['update']({'exitAt':moment()[_0x2a99('0xbe')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2a99('0x116')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x49db6f={};_[_0x2a99('0x33')](_0x49db6f,util[_0x2a99('0xbe')](_0x2a99('0x117'),_0x25e282[_0x2a99('0x6a')]['channel'],_0x2a99('0x118')),![]);return _0x440075['update'](_0x49db6f);});default:return respondWithRpcPromise(_0x2a99('0x105'),'unpause',{'id':_0x440075['id'],'name':_0x440075[_0x2a99('0x46')],'pause':![]})[_0x2a99('0x24')](function(){return db[_0x2a99('0xc0')]['update']({'paused':0x0},{'where':{'UserId':_0x440075['id']}});})[_0x2a99('0x24')](function(){return db[_0x2a99('0x101')][_0x2a99('0x64')]({'where':{'membername':_0x440075[_0x2a99('0x46')],'type':_0x2a99('0x100'),'exitAt':null}});})[_0x2a99('0x24')](function(_0x1415f1){var _0x35425b=[];_0x1415f1[_0x2a99('0xfc')](function(_0x2613e7){_0x35425b['push'](_0x2613e7[_0x2a99('0xfd')]({'exitAt':moment()['format'](_0x2a99('0x102')),'data2':_0x2a99('0x116')}));});return BPromise[_0x2a99('0x99')](_0x35425b);})['then'](function(){return _0x440075[_0x2a99('0xfd')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2a99('0x24')](respondWithResult(_0x57898d,null))['catch'](handleError(_0x57898d,null));};exports[_0x2a99('0x119')]=function(_0x150f05,_0x531cf4,_0x537996){var _0x5c6a34={};var _0x5417fa={};var _0x12b39d;var _0x547d0f;return db['User']['findOne']({'where':{'id':_0x150f05[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x531cf4,null))[_0x2a99('0x24')](function(_0x37affa){if(_0x37affa){_0x12b39d=_0x37affa;_0x5417fa[_0x2a99('0x50')]=_[_0x2a99('0x68')](db['Team'][_0x2a99('0x4c')]);_0x5417fa['query']=_[_0x2a99('0x68')](_0x150f05[_0x2a99('0x54')]);_0x5417fa[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x5417fa[_0x2a99('0x50')],_0x5417fa['query']);_0x5c6a34['attributes']=_[_0x2a99('0x55')](_0x5417fa[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x150f05[_0x2a99('0x54')][_0x2a99('0x56')]));_0x5c6a34[_0x2a99('0x57')]=_0x5c6a34[_0x2a99('0x57')]['length']?_0x5c6a34[_0x2a99('0x57')]:_0x5417fa[_0x2a99('0x50')];_0x5c6a34[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x150f05[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x5c6a34[_0x2a99('0x5b')]=qs['filters'](_[_0x2a99('0xd4')](_0x150f05['query'],_0x5417fa[_0x2a99('0x53')]));if(_0x150f05['query'][_0x2a99('0x41')]){_0x5c6a34['where']=_['merge'](_0x5c6a34[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x5c6a34[_0x2a99('0x57')],function(_0x34acab){var _0x5c6ba4={};_0x5c6ba4[_0x34acab]={'$like':'%'+_0x150f05[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x5c6ba4;})});}_0x5c6a34=_['merge']({},_0x5c6a34,_0x150f05[_0x2a99('0x61')]);return _0x12b39d[_0x2a99('0x119')](_0x5c6a34);}})['then'](function(_0x27b2d3){if(_0x27b2d3){_0x547d0f=_0x27b2d3[_0x2a99('0x69')];if(!_0x150f05['query'][_0x2a99('0x58')](_0x2a99('0x59'))){_0x5c6a34[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x150f05[_0x2a99('0x54')][_0x2a99('0x32')]);_0x5c6a34[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x150f05[_0x2a99('0x54')]['offset']);}return _0x12b39d['getTeams'](_0x5c6a34);}})[_0x2a99('0x24')](function(_0x22e4ac){if(_0x22e4ac){return _0x22e4ac?{'count':_0x547d0f,'rows':_0x22e4ac}:null;}})[_0x2a99('0x24')](respondWithResult(_0x531cf4,null))[_0x2a99('0x65')](handleError(_0x531cf4,null));};exports[_0x2a99('0x11a')]=function(_0x2c412f,_0x402ab8){return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x2c412f[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x402ab8,null))[_0x2a99('0x24')](function(_0x36a2b6){if(_0x36a2b6){var _0x5f052e=_0x36a2b6[_0x2a99('0x39')]({'plain':!![]});return _0x36a2b6['addTeams'](_0x2c412f[_0x2a99('0x6a')]['ids'],_[_0x2a99('0x6e')](_0x2c412f[_0x2a99('0x6a')],[_0x2a99('0x6d'),'id'])||{})[_0x2a99('0x24')](function(){for(var _0x1cdf6b=0x0;_0x1cdf6b<_0x2c412f['body']['ids'][_0x2a99('0x69')];_0x1cdf6b++){var _0xd0b129=[];db[_0x2a99('0x11b')][_0x2a99('0xd1')]({'where':{'id':_0x2c412f[_0x2a99('0x6a')][_0x2a99('0x6d')][_0x1cdf6b]}})['then'](function(_0x96f9cb){_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0xfa')]()['then'](function(_0x1dbbf4){for(var _0x448437=0x0;_0x448437<_0x1dbbf4['length'];_0x448437++){_0x1dbbf4[_0x448437]['setDataValue'](_0x2a99('0xad'),_0x2a99('0x11c'));}return _0x1dbbf4;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x11d')]()[_0x2a99('0x24')](function(_0x1290fb){for(var _0x3b4973=0x0;_0x3b4973<_0x1290fb[_0x2a99('0x69')];_0x3b4973++){_0x1290fb[_0x3b4973][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x11f'));}return _0x1290fb;}));_0xd0b129['push'](_0x96f9cb[_0x2a99('0x120')]()[_0x2a99('0x24')](function(_0x448975){for(var _0x16a994=0x0;_0x16a994<_0x448975['length'];_0x16a994++){_0x448975[_0x16a994][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x121'));}return _0x448975;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x122')]()[_0x2a99('0x24')](function(_0x2fc4a7){for(var _0x16d39a=0x0;_0x16d39a<_0x2fc4a7[_0x2a99('0x69')];_0x16d39a++){_0x2fc4a7[_0x16d39a]['setDataValue'](_0x2a99('0xad'),_0x2a99('0x123'));}return _0x2fc4a7;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x124')]()[_0x2a99('0x24')](function(_0x44c46e){for(var _0x46818d=0x0;_0x46818d<_0x44c46e[_0x2a99('0x69')];_0x46818d++){_0x44c46e[_0x46818d][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x125'));}return _0x44c46e;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x126')]()[_0x2a99('0x24')](function(_0x27f7d0){for(var _0x31dbd7=0x0;_0x31dbd7<_0x27f7d0[_0x2a99('0x69')];_0x31dbd7++){_0x27f7d0[_0x31dbd7]['setDataValue'](_0x2a99('0xad'),'Fax');}return _0x27f7d0;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb['getOpenchannelQueues']()[_0x2a99('0x24')](function(_0x3ef82e){for(var _0x5a30dd=0x0;_0x5a30dd<_0x3ef82e[_0x2a99('0x69')];_0x5a30dd++){_0x3ef82e[_0x5a30dd]['setDataValue']('channel',_0x2a99('0x127'));}return _0x3ef82e;}));return BPromise[_0x2a99('0x99')](_0xd0b129);})['then'](function(_0xe830b3){var _0x44c65c=_[_0x2a99('0x128')](_0xe830b3);_0xd0b129=[];return db[_0x2a99('0x5e')][_0x2a99('0x129')](function(_0x3e3f2a){for(var _0x5f5782=0x0;_0x5f5782<_0x44c65c[_0x2a99('0x69')];_0x5f5782++){_0xd0b129[_0x2a99('0x98')](_0x44c65c[_0x5f5782][_0x2a99('0x12a')](_0x5f052e['id']),{'transaction':_0x3e3f2a});}return BPromise['all'](_0xd0b129)[_0x2a99('0x24')](function(){if(_0x5f052e[_0x2a99('0xbd')]){return BPromise[_0x2a99('0x9a')](_[_0x2a99('0x41')](_0x44c65c,function(_0x17e0cb){return _0x17e0cb[_0x2a99('0x12b')](_0x2a99('0xad'))===_0x2a99('0x11c');}),function(_0x3a3322){return db[_0x2a99('0xc0')][_0x2a99('0xc1')]({'membername':_0x5f052e[_0x2a99('0x46')],'UserId':_0x5f052e['id'],'queue_name':_0x3a3322[_0x2a99('0x46')],'VoiceQueueId':_0x3a3322['id'],'interface':_[_0x2a99('0x75')](_0x5f052e[_0x2a99('0xb0')])?util[_0x2a99('0xbe')](_0x2a99('0xbf'),_0x5f052e[_0x2a99('0x46')]):_0x5f052e[_0x2a99('0xb0')],'paused':_0x5f052e[_0x2a99('0xaf')]||![],'penalty':_0x5f052e[_0x2a99('0xb5')]},{'transaction':_0x3e3f2a});});}else{return;}})[_0x2a99('0x24')](function(){for(var _0x18b1eb=0x0;_0x18b1eb<_0x44c65c['length'];_0x18b1eb++){var _0x580fd8=_0x44c65c[_0x18b1eb][_0x2a99('0x12b')](_0x2a99('0xad'));var _0x63b18b=_0x580fd8+_0x2a99('0xb7');socket[_0x2a99('0xb8')](_0x2a99('0x8c')+_0x580fd8+_0x2a99('0xba'),{'UserId':_0x5f052e['id'],['queueField']:_0x44c65c[_0x18b1eb]['id']});}});});});}});}})[_0x2a99('0x24')](respondWithStatusCode(_0x402ab8,null))['catch'](handleError(_0x402ab8,null));};exports[_0x2a99('0x12c')]=function(_0x50c5dd,_0x5c41af){return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x50c5dd['params']['id']}})['then'](handleEntityNotFound(_0x5c41af,null))[_0x2a99('0x24')](function(_0x220a90){if(_0x220a90){var _0x4539c2=_0x220a90[_0x2a99('0x39')]({'plain':!![]});var _0x4dbc67=_0x50c5dd[_0x2a99('0x54')][_0x2a99('0x6d')];return _0x220a90[_0x2a99('0x12c')](_0x4dbc67)[_0x2a99('0x24')](function(){for(var _0x5f3895=0x0;_0x5f3895<_0x4dbc67['length'];_0x5f3895++){var _0x3c0e87=[];db['Team']['findOne']({'where':{'id':_0x4dbc67[_0x5f3895]}})['then'](function(_0x2909f5){_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0xfa')]()[_0x2a99('0x24')](function(_0x561255){for(var _0x4f19b6=0x0;_0x4f19b6<_0x561255[_0x2a99('0x69')];_0x4f19b6++){_0x561255[_0x4f19b6][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x11c'));}return _0x561255;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x11d')]()[_0x2a99('0x24')](function(_0x2331e5){for(var _0x3a9d05=0x0;_0x3a9d05<_0x2331e5[_0x2a99('0x69')];_0x3a9d05++){_0x2331e5[_0x3a9d05]['setDataValue'](_0x2a99('0xad'),_0x2a99('0x11f'));}return _0x2331e5;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x120')]()[_0x2a99('0x24')](function(_0x1399e9){for(var _0x83a959=0x0;_0x83a959<_0x1399e9[_0x2a99('0x69')];_0x83a959++){_0x1399e9[_0x83a959][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x121'));}return _0x1399e9;}));_0x3c0e87['push'](_0x2909f5['getSmsQueues']()['then'](function(_0x204104){for(var _0x44f5e5=0x0;_0x44f5e5<_0x204104[_0x2a99('0x69')];_0x44f5e5++){_0x204104[_0x44f5e5][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x123'));}return _0x204104;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x124')]()[_0x2a99('0x24')](function(_0x4518dc){for(var _0x38eba0=0x0;_0x38eba0<_0x4518dc[_0x2a99('0x69')];_0x38eba0++){_0x4518dc[_0x38eba0]['setDataValue']('channel',_0x2a99('0x125'));}return _0x4518dc;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x126')]()[_0x2a99('0x24')](function(_0x309571){for(var _0x3d9a73=0x0;_0x3d9a73<_0x309571[_0x2a99('0x69')];_0x3d9a73++){_0x309571[_0x3d9a73]['setDataValue'](_0x2a99('0xad'),'Fax');}return _0x309571;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5['getOpenchannelQueues']()['then'](function(_0x37b7ca){for(var _0x4e6be5=0x0;_0x4e6be5<_0x37b7ca[_0x2a99('0x69')];_0x4e6be5++){_0x37b7ca[_0x4e6be5][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x127'));}return _0x37b7ca;}));return BPromise['all'](_0x3c0e87);})[_0x2a99('0x24')](function(_0x345220){var _0xbf5b38=_[_0x2a99('0x128')](_0x345220);_0x3c0e87=[];return db[_0x2a99('0x5e')][_0x2a99('0x129')](function(_0x3fc870){for(var _0x573dc4=0x0;_0x573dc4<_0xbf5b38[_0x2a99('0x69')];_0x573dc4++){_0x3c0e87[_0x2a99('0x98')](_0xbf5b38[_0x573dc4][_0x2a99('0x12d')](_0x4539c2['id']),{'transaction':_0x3fc870});}return BPromise[_0x2a99('0x99')](_0x3c0e87)[_0x2a99('0x24')](function(){if(_0x4539c2[_0x2a99('0xbd')]){return BPromise[_0x2a99('0x9a')](_['filter'](_0xbf5b38,function(_0x187c93){return _0x187c93['getDataValue'](_0x2a99('0xad'))==='Voice';}),function(_0x2492e8){return db[_0x2a99('0xc0')][_0x2a99('0x38')]({'where':{'VoiceQueueId':_0x2492e8['id'],'UserId':_0x4539c2['id']},'transaction':_0x3fc870});});}else{return;}})['then'](function(){for(var _0x24a449=0x0;_0x24a449<_0xbf5b38['length'];_0x24a449++){var _0x2f0ed5=_0xbf5b38[_0x24a449]['getDataValue'](_0x2a99('0xad'));var _0x404000=_0x2f0ed5+_0x2a99('0xb7');socket['emit'](_0x2a99('0x8c')+_0x2f0ed5+_0x2a99('0xc5'),{'UserId':_0x4539c2['id'],['queueField']:_0xbf5b38[_0x24a449]['id']});}});});});}});}})[_0x2a99('0x24')](respondWithStatusCode(_0x5c41af,null))[_0x2a99('0x65')](handleError(_0x5c41af,null));};exports['getLists']=function(_0x5c20f6,_0x16129f,_0x3a0ff9){var _0x59fb11={};var _0x5b46b0={};var _0x44b87f;var _0x48a7df;return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x5c20f6['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x16129f,null))[_0x2a99('0x24')](function(_0x282096){if(_0x282096){_0x44b87f=_0x282096;_0x5b46b0[_0x2a99('0x50')]=_[_0x2a99('0x68')](db['CmList'][_0x2a99('0x4c')]);_0x5b46b0[_0x2a99('0x54')]=_['keys'](_0x5c20f6[_0x2a99('0x54')]);_0x5b46b0[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x5b46b0['model'],_0x5b46b0['query']);_0x59fb11[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x5b46b0['model'],qs[_0x2a99('0x56')](_0x5c20f6['query'][_0x2a99('0x56')]));_0x59fb11[_0x2a99('0x57')]=_0x59fb11[_0x2a99('0x57')][_0x2a99('0x69')]?_0x59fb11[_0x2a99('0x57')]:_0x5b46b0['model'];_0x59fb11[_0x2a99('0xd3')]=qs['sort'](_0x5c20f6['query'][_0x2a99('0x5a')]);_0x59fb11[_0x2a99('0x5b')]=qs['filters'](_[_0x2a99('0xd4')](_0x5c20f6[_0x2a99('0x54')],_0x5b46b0[_0x2a99('0x53')]));if(_0x5c20f6['query'][_0x2a99('0x41')]){_0x59fb11[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x59fb11[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x59fb11['attributes'],function(_0x15ac3d){var _0x2d94a9={};_0x2d94a9[_0x15ac3d]={'$like':'%'+_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x2d94a9;})});}_0x59fb11=_[_0x2a99('0x5c')]({},_0x59fb11,_0x5c20f6[_0x2a99('0x61')]);return _0x44b87f[_0x2a99('0x12e')](_0x59fb11);}})[_0x2a99('0x24')](function(_0x349325){if(_0x349325){_0x48a7df=_0x349325[_0x2a99('0x69')];if(!_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x59fb11[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x32')]);_0x59fb11[_0x2a99('0x31')]=qs['offset'](_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x44b87f[_0x2a99('0x12e')](_0x59fb11);}})[_0x2a99('0x24')](function(_0x5bcdec){if(_0x5bcdec){return _0x5bcdec?{'count':_0x48a7df,'rows':_0x5bcdec}:null;}})[_0x2a99('0x24')](respondWithResult(_0x16129f,null))['catch'](handleError(_0x16129f,null));};exports['getAgents']=function(_0x417d11,_0x467e65,_0x359e49){var _0x1a1c45={};var _0x488281={};var _0x3167b7;var _0x4f199b;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x417d11[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x467e65,null))[_0x2a99('0x24')](function(_0x42fc4d){if(_0x42fc4d){_0x3167b7=_0x42fc4d;_0x488281['model']=_[_0x2a99('0x68')](db['User'][_0x2a99('0x4c')]);_0x488281[_0x2a99('0x54')]=_['keys'](_0x417d11[_0x2a99('0x54')]);_0x488281['filters']=_['intersection'](_0x488281[_0x2a99('0x50')],_0x488281[_0x2a99('0x54')]);_0x1a1c45['attributes']=_[_0x2a99('0x55')](_0x488281[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x417d11[_0x2a99('0x54')][_0x2a99('0x56')]));_0x1a1c45[_0x2a99('0x57')]=_0x1a1c45[_0x2a99('0x57')][_0x2a99('0x69')]?_0x1a1c45[_0x2a99('0x57')]:_0x488281['model'];_0x1a1c45[_0x2a99('0xd3')]=qs['sort'](_0x417d11[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x1a1c45[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x417d11[_0x2a99('0x54')],_0x488281['filters']));if(_0x417d11[_0x2a99('0x54')][_0x2a99('0x41')]){_0x1a1c45[_0x2a99('0x5b')]=_['merge'](_0x1a1c45[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x1a1c45[_0x2a99('0x57')],function(_0x19ba68){var _0x54939e={};_0x54939e[_0x19ba68]={'$like':'%'+_0x417d11['query']['filter']+'%'};return _0x54939e;})});}_0x1a1c45[_0x2a99('0x50')]=db[_0x2a99('0x4b')];_0x1a1c45['as']=_0x2a99('0x3d');_0x1a1c45=_[_0x2a99('0x5c')]({},_0x1a1c45,_0x417d11['options']);return _0x3167b7[_0x2a99('0xfa')]({'include':[_0x1a1c45]});}})['then'](function(_0x2dbaed){if(_0x2dbaed){var _0x53cb8e={},_0x39166c=[],_0x380e92=0x0;for(var _0x1a8472=0x0;_0x1a8472<_0x2dbaed[_0x2a99('0x69')];_0x1a8472+=0x1){for(var _0x258be8=0x0,_0x1119a5;_0x258be8<_0x2dbaed[_0x1a8472][_0x2a99('0x3d')]['length'];_0x258be8+=0x1){_0x1119a5=_0x2dbaed[_0x1a8472][_0x2a99('0x3d')][_0x258be8][_0x2a99('0x39')]({'plain':!![]});_0x53cb8e[_0x1119a5['id']]=_0x1119a5;}}_0x53cb8e=_[_0x2a99('0x12f')](_0x53cb8e);for(var _0x9a583f=qs[_0x2a99('0x31')](_0x417d11[_0x2a99('0x54')][_0x2a99('0x31')]);_0x9a583f<_0x53cb8e[_0x2a99('0x69')]&&_0x39166c['length']=_0x4fbc02){_0x23614f=_0x4fbc02;_0x36b470=0xc8;}else{_0x36b470=0xce;}_0x9e7938[_0x9cb5('0x2e')](_0x36b470);return _0x9e7938[_0x9cb5('0x33')](_0x9cb5('0x34'),_0x5de044+'-'+_0x23614f+'/'+_0x4fbc02)['json'](_0xb6f0fe);}return null;};}function patchUpdates(_0x4b02c5){return function(_0x50e05e){try{jsonpatch['apply'](_0x50e05e,_0x4b02c5,!![]);}catch(_0x95a973){return BPromise['reject'](_0x95a973);}return _0x50e05e['save']();};}function saveUpdates(_0x791933,_0x2792ea){return function(_0x218650){if(_0x218650){return _0x218650['update'](_0x791933)['then'](function(_0x1695ee){return _0x1695ee;});}return null;};}function removeEntity(_0x43bd74,_0x2bc2e6){return function(_0x12cf5c){if(_0x12cf5c){return _0x12cf5c[_0x9cb5('0x35')]()[_0x9cb5('0x22')](function(){var _0x4b3c0=_0x12cf5c[_0x9cb5('0x36')]({'plain':!![]});if(_0x4b3c0[_0x9cb5('0x37')]==='admin')return;var _0x59d52c=[{'name':_0x9cb5('0x38'),'value':'user','ignore':!![]},{'name':_0x9cb5('0x39'),'value':'agent','ignore':![]},{'name':_0x9cb5('0x3a'),'value':_0x9cb5('0x3b'),'ignore':![]}];var _0x4bf37f=_(_0x59d52c)[_0x9cb5('0x3c')]('ignore')[_0x9cb5('0x3d')](_0x9cb5('0x3e'))[_0x9cb5('0x3e')]();if(_[_0x9cb5('0x3f')](_0x4bf37f,_0x4b3c0[_0x9cb5('0x37')])){return;}var _0x3e70d5=_[_0x9cb5('0x40')](_0x59d52c,['value',_0x4b3c0[_0x9cb5('0x37')]])[_0x9cb5('0x41')];return db['UserProfileResource'][_0x9cb5('0x35')]({'where':{'type':_0x3e70d5,'resourceId':_0x4b3c0['id']}})[_0x9cb5('0x22')](function(){return _0x12cf5c;});})[_0x9cb5('0x22')](function(){_0x43bd74['status'](0xcc)[_0x9cb5('0x2f')]();});}};}function handleEntityNotFound(_0xb1feb7,_0x324dd5){return function(_0x354fd0){if(!_0x354fd0){_0xb1feb7['sendStatus'](0x194);}return _0x354fd0;};}function handleError(_0x10309e,_0x45edd7){_0x45edd7=_0x45edd7||0x1f4;return function(_0x88af8d){logger[_0x9cb5('0x28')](_0x88af8d['stack']);if(_0x88af8d[_0x9cb5('0x41')]){delete _0x88af8d[_0x9cb5('0x41')];}_0x10309e['status'](_0x45edd7)[_0x9cb5('0x42')](_0x88af8d);};}exports[_0x9cb5('0x43')]=function(_0x59d031,_0x617edd){var _0x258005={},_0x3ee98d={},_0xfbffd1={'count':0x0,'rows':[]};var _0x11ece6=_['map'](db[_0x9cb5('0x44')]['rawAttributes'],function(_0x4a159b){return{'name':_0x4a159b['fieldName'],'type':_0x4a159b['type'][_0x9cb5('0x45')]};});_0x3ee98d[_0x9cb5('0x46')]=_[_0x9cb5('0x47')](_[_0x9cb5('0x3d')](_0x11ece6,_0x9cb5('0x41')),[_0x9cb5('0x48'),_0x9cb5('0x49')]);_0x3ee98d['query']=_[_0x9cb5('0x4a')](_0x59d031['query']);_0x3ee98d[_0x9cb5('0x4b')]=_['intersection'](_0x3ee98d[_0x9cb5('0x46')],_0x3ee98d[_0x9cb5('0x4c')]);_0x258005['attributes']=_[_0x9cb5('0x4d')](_0x3ee98d[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x59d031['query'][_0x9cb5('0x4e')]));_0x258005[_0x9cb5('0x4f')]=_0x258005[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x258005[_0x9cb5('0x4f')]:_0x3ee98d[_0x9cb5('0x46')];if(!_0x59d031['query'][_0x9cb5('0x51')]('nolimit')){_0x258005[_0x9cb5('0x32')]=qs[_0x9cb5('0x32')](_0x59d031[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x258005[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x59d031[_0x9cb5('0x4c')][_0x9cb5('0x31')]);}_0x258005['order']=qs[_0x9cb5('0x52')](_0x59d031[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x258005[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x59d031[_0x9cb5('0x4c')],_0x3ee98d[_0x9cb5('0x4b')]),_0x11ece6);if(_0x59d031['query'][_0x9cb5('0x3c')]){_0x258005[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x258005[_0x9cb5('0x53')],{'$or':_[_0x9cb5('0x3d')](_0x11ece6,function(_0x352b5f){if(_0x352b5f[_0x9cb5('0x56')]!==_0x9cb5('0x57')){return db[_0x9cb5('0x58')][_0x9cb5('0x53')](db[_0x9cb5('0x58')]['fn']('lower',db['sequelize'][_0x9cb5('0x59')](_0x352b5f[_0x9cb5('0x41')])),{'$like':db[_0x9cb5('0x58')]['fn']('lower','%'+_0x59d031[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%')});}})});}_0x258005=_['merge']({},_0x258005,_0x59d031[_0x9cb5('0x5a')]);var _0x2889b2={'where':_0x258005[_0x9cb5('0x53')]};return db[_0x9cb5('0x44')][_0x9cb5('0x30')](_0x2889b2)['then'](function(_0x274a73){_0xfbffd1[_0x9cb5('0x30')]=_0x274a73;if(_0x59d031[_0x9cb5('0x4c')][_0x9cb5('0x5b')]){_0x258005['include']=[{'all':!![]}];}return db['User']['findAll'](_0x258005);})[_0x9cb5('0x22')](function(_0x138b44){_0xfbffd1[_0x9cb5('0x5c')]=_0x138b44;return _0xfbffd1;})[_0x9cb5('0x22')](respondWithFilteredResult(_0x617edd,_0x258005))[_0x9cb5('0x2c')](handleError(_0x617edd,null));};exports[_0x9cb5('0x5d')]=function(_0x22f61b,_0x4d1e69){var _0x539c73={'raw':![],'where':{'id':_0x22f61b[_0x9cb5('0x5e')]['id']}},_0x4d68dd={};_0x4d68dd[_0x9cb5('0x46')]=_[_0x9cb5('0x47')](_['keys'](db[_0x9cb5('0x44')][_0x9cb5('0x5f')]),[_0x9cb5('0x48'),'salt']);_0x4d68dd[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x22f61b[_0x9cb5('0x4c')]);_0x4d68dd[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x4d68dd[_0x9cb5('0x46')],_0x4d68dd[_0x9cb5('0x4c')]);_0x539c73[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x4d68dd[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x22f61b['query'][_0x9cb5('0x4e')]));_0x539c73['attributes']=_0x539c73['attributes'][_0x9cb5('0x50')]?_0x539c73['attributes']:_0x4d68dd[_0x9cb5('0x46')];if(_0x22f61b[_0x9cb5('0x4c')][_0x9cb5('0x5b')]){_0x539c73[_0x9cb5('0x60')]=[{'all':!![]}];}_0x539c73=_[_0x9cb5('0x55')]({},_0x539c73,_0x22f61b['options']);return db[_0x9cb5('0x44')][_0x9cb5('0x40')](_0x539c73)[_0x9cb5('0x22')](handleEntityNotFound(_0x4d1e69,null))[_0x9cb5('0x22')](respondWithResult(_0x4d1e69,null))['catch'](handleError(_0x4d1e69,null));};exports[_0x9cb5('0x61')]=function(_0x2f8bfe,_0x1e33c6){if(_0x2f8bfe[_0x9cb5('0x62')]['id']){delete _0x2f8bfe[_0x9cb5('0x62')]['id'];}delete _0x2f8bfe['body'][_0x9cb5('0x37')];return db[_0x9cb5('0x44')][_0x9cb5('0x40')]({'where':{'id':_0x2f8bfe[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x1e33c6,null))[_0x9cb5('0x22')](saveUpdates(_0x2f8bfe[_0x9cb5('0x62')],null))[_0x9cb5('0x22')](respondWithResult(_0x1e33c6,null))[_0x9cb5('0x2c')](handleError(_0x1e33c6,null));};exports[_0x9cb5('0x63')]=function(_0x3901a2,_0x1a894a){return db[_0x9cb5('0x44')]['describe']()['then'](respondWithResult(_0x1a894a,null))[_0x9cb5('0x2c')](handleError(_0x1a894a,null));};exports[_0x9cb5('0x64')]=function(_0x393e69,_0x4d99d2,_0x419fc0){return db[_0x9cb5('0x44')][_0x9cb5('0x40')]({'where':{'id':_0x393e69[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x4d99d2,null))[_0x9cb5('0x22')](function(_0x2eacd7){if(_0x2eacd7){return _0x2eacd7[_0x9cb5('0x64')](_0x393e69[_0x9cb5('0x62')][_0x9cb5('0x65')],_[_0x9cb5('0x66')](_0x393e69['body'],[_0x9cb5('0x65'),'id'])||{});}})['then'](respondWithResult(_0x4d99d2,null))['catch'](handleError(_0x4d99d2,null));};function validateUser(_0x5d0ddf){return new BPromise(function(_0x5ece00,_0x3f3604){if(_0x5d0ddf['internal'])return _0x5ece00(_0x5d0ddf);return db[_0x9cb5('0x67')][_0x9cb5('0x68')](0x1)[_0x9cb5('0x22')](function(_0x3153e2){if(_0x3153e2[_0x9cb5('0x69')])authService[_0x9cb5('0x6a')](_0x5d0ddf[_0x9cb5('0x48')]);db['User'][_0x9cb5('0x6b')]('internal')[_0x9cb5('0x22')](function(_0x5b54cb){if(_['isNil'](_0x5b54cb)){_0x5d0ddf['internal']=_0x3153e2[_0x9cb5('0x6c')]||0x1;return;}if(_[_0x9cb5('0x6d')](_0x3153e2[_0x9cb5('0x6c')])||_0x3153e2[_0x9cb5('0x6c')]===_0x5b54cb){_0x5d0ddf[_0x9cb5('0x6e')]=_0x5b54cb+0x1;return;}if(_0x3153e2['min_internal']>_0x5b54cb){_0x5d0ddf[_0x9cb5('0x6e')]=_0x3153e2[_0x9cb5('0x6c')];return;}return db[_0x9cb5('0x58')]['query'](_0x9cb5('0x6f'),{'type':db[_0x9cb5('0x58')][_0x9cb5('0x70')][_0x9cb5('0x71')]})[_0x9cb5('0x22')](function(_0x4ce149){if(_0x4ce149&&_0x4ce149[_0x9cb5('0x50')]){for(var _0x31245a=0x0,_0x2b3661=_0x4ce149[_0x9cb5('0x50')];_0x31245a<_0x2b3661&&_[_0x9cb5('0x6d')](_0x5d0ddf[_0x9cb5('0x6e')]);_0x31245a++){if(_0x3153e2[_0x9cb5('0x6c')]<=_0x4ce149[_0x31245a]['from']){_0x5d0ddf[_0x9cb5('0x6e')]=_0x4ce149[_0x31245a]['from'];}else if(_0x3153e2[_0x9cb5('0x6c')]>_0x4ce149[_0x31245a][_0x9cb5('0x72')]&&_0x3153e2[_0x9cb5('0x6c')]<=_0x4ce149[_0x31245a]['to']){_0x5d0ddf[_0x9cb5('0x6e')]=_0x3153e2[_0x9cb5('0x6c')];}}}if(_[_0x9cb5('0x6d')](_0x5d0ddf[_0x9cb5('0x6e')])){_0x5d0ddf['internal']=_0x5b54cb+0x1;}return _0x5ece00(_0x5d0ddf);});});})[_0x9cb5('0x2c')](function(_0xbf1792){_0x3f3604(_0xbf1792);});});}function updateUser(_0x3f96c7){return new BPromise(function(_0x3ed70f,_0x5b495a){try{if(_0x3f96c7[_0x9cb5('0x73')]){_0x3f96c7[_0x9cb5('0x74')]=_0x3f96c7[_0x9cb5('0x6e')];_0x3f96c7[_0x9cb5('0x75')]={'mailbox':_0x3f96c7[_0x9cb5('0x6e')],'password':_0x3f96c7[_0x9cb5('0x48')],'fullname':_0x3f96c7[_0x9cb5('0x76')],'email':_0x3f96c7[_0x9cb5('0x77')]};}if(_0x3f96c7[_0x9cb5('0x37')]===_0x9cb5('0x78')){if(!_0x3f96c7[_0x9cb5('0x79')])_0x3f96c7[_0x9cb5('0x79')]=[_0x9cb5('0x7a'),'102',_0x9cb5('0x7b'),_0x9cb5('0x7c'),'110',_0x9cb5('0x7d'),_0x9cb5('0x7e'),'106',_0x9cb5('0x7f'),_0x9cb5('0x80'),_0x9cb5('0x81'),_0x9cb5('0x82'),'111',_0x9cb5('0x83')];}_0x3ed70f(_0x3f96c7);}catch(_0x20eeb3){_0x5b495a(_0x20eeb3);}});}exports[_0x9cb5('0x84')]=function(_0x5c0aff,_0x40f4fb){if(_0x5c0aff[_0x9cb5('0x85')]['role']===_0x9cb5('0x78'))throw new Error(_0x9cb5('0x86'));if(_0x5c0aff[_0x9cb5('0x62')][_0x9cb5('0x37')]===_0x9cb5('0x85')&&_0x5c0aff[_0x9cb5('0x85')]['role']!==_0x9cb5('0x87')){throw new Error(_0x9cb5('0x88'));}if(_0x5c0aff['body'][_0x9cb5('0x37')]==='admin'&&_0x5c0aff[_0x9cb5('0x85')][_0x9cb5('0x37')]!==_0x9cb5('0x87')){throw new Error(_0x9cb5('0x89'));}return licenseUtil[_0x9cb5('0x8a')]([_0x5c0aff[_0x9cb5('0x62')]])['then'](function(){return validateUser(_0x5c0aff[_0x9cb5('0x62')]);})[_0x9cb5('0x22')](function(_0x13121c){return updateUser(_0x13121c)[_0x9cb5('0x22')](function(_0x307316){if(_0x307316['role']===_0x9cb5('0x87')){_0x307316[_0x9cb5('0x8b')]=_0x5c0aff[_0x9cb5('0x85')]['settingsEnabled'];delete _0x307316[_0x9cb5('0x8c')];}return _0x307316;});})['then'](function(_0x17ebce){return db[_0x9cb5('0x44')][_0x9cb5('0x84')](_0x17ebce,{'include':[{'model':db[_0x9cb5('0x75')],'as':'VoiceMail'}]});})[_0x9cb5('0x22')](function(_0x3d7a18){if(_0x5c0aff[_0x9cb5('0x62')][_0x9cb5('0x37')]===_0x9cb5('0x85'))return _0x3d7a18;if(_0x5c0aff[_0x9cb5('0x85')]['role']!==_0x9cb5('0x85'))return _0x3d7a18;return db[_0x9cb5('0x8d')][_0x9cb5('0x40')]({'where':{'name':_0x3d7a18['role']===_0x9cb5('0x78')?_0x9cb5('0x39'):_0x9cb5('0x3a'),'userProfileId':_0x5c0aff[_0x9cb5('0x85')][_0x9cb5('0x8c')]},'raw':!![]})['then'](function(_0x590e54){if(!_0x590e54||_0x590e54['autoAssociation']!=0x0)return _0x3d7a18;return db[_0x9cb5('0x8e')]['create']({'name':_0x3d7a18[_0x9cb5('0x41')],'resourceId':_0x3d7a18['id'],'type':_0x590e54[_0x9cb5('0x41')],'sectionId':_0x590e54['id']},{})[_0x9cb5('0x22')](function(){return _0x3d7a18;});})['catch'](function(_0x2a3596){logger[_0x9cb5('0x28')](_0x9cb5('0x8f'),_0x2a3596);throw _0x2a3596;});})[_0x9cb5('0x22')](respondWithResult(_0x40f4fb,0xc9))[_0x9cb5('0x2c')](handleError(_0x40f4fb,null));};exports[_0x9cb5('0x90')]=function(_0x3fd3a6,_0x553ace){var _0x33074c=_0x3fd3a6[_0x9cb5('0x62')];var _0x2dc43b=[];if(_0x3fd3a6[_0x9cb5('0x85')]['role']===_0x9cb5('0x78'))throw new Error('Unauthorized');if(_['some'](_0x33074c,[_0x9cb5('0x37'),_0x9cb5('0x85')])&&_0x3fd3a6[_0x9cb5('0x85')][_0x9cb5('0x37')]!==_0x9cb5('0x87')){throw new Error(_0x9cb5('0x88'));}if(_[_0x9cb5('0x91')](_0x33074c,[_0x9cb5('0x37'),_0x9cb5('0x87')])&&_0x3fd3a6[_0x9cb5('0x85')][_0x9cb5('0x37')]!==_0x9cb5('0x87')){throw new Error(_0x9cb5('0x92'));}return licenseUtil[_0x9cb5('0x8a')](_0x33074c)['then'](function(){return validateUser(_0x33074c[0x0]);})[_0x9cb5('0x22')](function(){for(var _0x1f5549=0x1;_0x1f5549<_0x33074c[_0x9cb5('0x50')];_0x1f5549++){var _0x5c4357=_0x33074c[_0x1f5549-0x1][_0x9cb5('0x6e')];if(!_0x33074c[_0x1f5549][_0x9cb5('0x6e')])_0x33074c[_0x1f5549][_0x9cb5('0x6e')]=_0x5c4357+0x1;_0x2dc43b['push'](validateUser(_0x33074c[_0x1f5549]));}return BPromise[_0x9cb5('0x93')](_0x2dc43b);})[_0x9cb5('0x22')](function(){_0x2dc43b=[];for(var _0x563fa8=0x0;_0x563fa8<_0x33074c[_0x9cb5('0x50')];_0x563fa8++){_0x2dc43b['push'](updateUser(_0x33074c[_0x563fa8]));}return BPromise[_0x9cb5('0x93')](_0x2dc43b);})['then'](function(){return BPromise['each'](_0x33074c,function(_0x6d40df){return db[_0x9cb5('0x44')][_0x9cb5('0x84')](_0x6d40df,{'include':[{'model':db['VoiceMail'],'as':_0x9cb5('0x75')}]})[_0x9cb5('0x22')](function(_0x1ccb4c){_0x6d40df['id']=_0x1ccb4c['id'];return _0x6d40df;});});})['then'](function(_0xf87681){if(_0x3fd3a6[_0x9cb5('0x62')]['role']===_0x9cb5('0x85'))return _0xf87681;if(_0x3fd3a6[_0x9cb5('0x85')][_0x9cb5('0x37')]!==_0x9cb5('0x85'))return _0xf87681;var _0x29860f=_[_0x9cb5('0x91')](_0xf87681,function(_0x252d49){return _0x252d49[_0x9cb5('0x37')]===_0x9cb5('0x78')||_0x252d49['role']==='telephone';});if(!_0x29860f)return _0xf87681;return db['UserProfileSection'][_0x9cb5('0x94')]({'where':{'name':{'$or':[_0x9cb5('0x39'),'Telephones']},'userProfileId':_0x3fd3a6[_0x9cb5('0x85')][_0x9cb5('0x8c')]},'raw':!![]})['then'](function(_0x48e14b){if(_[_0x9cb5('0x95')](_0x48e14b)||!_[_0x9cb5('0x91')](_0x48e14b,[_0x9cb5('0x96'),0x0]))return _0xf87681;_0x2dc43b=[];var _0x22cd5b=_(_0x48e14b)[_0x9cb5('0x3d')](function(_0x3748ae){if(_0x3748ae[_0x9cb5('0x96')]===0x1)return;return _0x3748ae[_0x9cb5('0x41')]===_0x9cb5('0x39')?_0x9cb5('0x78'):_0x9cb5('0x3b');})[_0x9cb5('0x97')]()[_0x9cb5('0x3e')]();for(var _0x4a7691=0x0;_0x4a7691<_0xf87681[_0x9cb5('0x50')];_0x4a7691++){if(!_[_0x9cb5('0x3f')](_0x22cd5b,_0xf87681[_0x4a7691][_0x9cb5('0x37')]))return;var _0x3133c1=_0xf87681[_0x4a7691][_0x9cb5('0x37')]===_0x9cb5('0x78')?'Agents':_0x9cb5('0x3a');_0x2dc43b['push'](db[_0x9cb5('0x8e')]['create']({'name':_0xf87681[_0x4a7691][_0x9cb5('0x41')],'resourceId':_0xf87681[_0x4a7691]['id'],'type':_0x3133c1,'sectionId':_[_0x9cb5('0x40')](_0x48e14b,['name',_0x3133c1])['id']},{}));}return BPromise[_0x9cb5('0x93')](_0x2dc43b);})[_0x9cb5('0x22')](respondWithResult(_0x553ace,0xc9))[_0x9cb5('0x2c')](handleError(_0x553ace,null));});};exports[_0x9cb5('0x98')]=function(_0x51f245,_0x4715f6,_0x458a85){if(_0x51f245[_0x9cb5('0x62')]['id']){delete _0x51f245[_0x9cb5('0x62')]['id'];}return db['User'][_0x9cb5('0x40')]({'where':{'id':_0x51f245[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](function(_0x73d476){if(!_0x73d476)return null;if(_0x73d476['id']===_0x51f245[_0x9cb5('0x85')]['id']){if(!_0x51f245[_0x9cb5('0x62')][_0x9cb5('0x99')]||!_0x51f245[_0x9cb5('0x62')][_0x9cb5('0x9a')]){throw new db[(_0x9cb5('0x9b'))][(_0x9cb5('0x9c'))](_0x9cb5('0x9d'));}if(!_0x73d476[_0x9cb5('0x9e')](_0x51f245['body']['oldPassword'])){throw new db['Sequelize'][(_0x9cb5('0x9c'))](_0x9cb5('0x9f'));}if(_0x51f245[_0x9cb5('0x62')][_0x9cb5('0x99')]===_0x51f245[_0x9cb5('0x62')]['newPassword']){throw new db[(_0x9cb5('0x9b'))][(_0x9cb5('0x9c'))](_0x9cb5('0xa0'));}}else if(_0x51f245[_0x9cb5('0x85')][_0x9cb5('0x37')]===_0x9cb5('0x87')){if(!_0x51f245[_0x9cb5('0x62')]['newPassword']){throw new db[(_0x9cb5('0x9b'))]['ValidationError'](_0x9cb5('0xa1'));}}else if(_0x51f245['user'][_0x9cb5('0x37')]===_0x9cb5('0x85')){if(!_0x51f245[_0x9cb5('0x62')][_0x9cb5('0x9a')]){throw new db['Sequelize'][(_0x9cb5('0x9c'))](_0x9cb5('0xa1'));}if(_0x73d476[_0x9cb5('0x37')]!==_0x9cb5('0x78')){throw new db[(_0x9cb5('0x9b'))][(_0x9cb5('0x9c'))](_0x9cb5('0x86'));}}else{throw new db[(_0x9cb5('0x9b'))]['ValidationError']('Unauthorized');}return _0x73d476;})[_0x9cb5('0x22')](handleEntityNotFound(_0x4715f6,null))['then'](function(_0xfa8743){return db[_0x9cb5('0x67')][_0x9cb5('0xa2')]({'attributes':['id',_0x9cb5('0x69'),_0x9cb5('0xa3'),_0x9cb5('0xa4')]})[_0x9cb5('0x22')](function(_0x1ee52e){if(_0x1ee52e[_0x9cb5('0x69')])authService[_0x9cb5('0x6a')](_0x51f245[_0x9cb5('0x62')][_0x9cb5('0x9a')]);if(!_0x1ee52e[_0x9cb5('0xa3')]||!_0xfa8743[_0x9cb5('0xa5')])return _0xfa8743;authService['validatePasswordHistory'](_0x51f245[_0x9cb5('0x62')][_0x9cb5('0x9a')],_0xfa8743['previousPasswords'],_0x1ee52e[_0x9cb5('0xa4')]);return _0xfa8743;})[_0x9cb5('0x22')](saveUpdates({'password':_0x51f245[_0x9cb5('0x62')][_0x9cb5('0x9a')],'passwordResetAt':_0x51f245[_0x9cb5('0x85')]['id']==_0x51f245['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x51f245[_0x9cb5('0x62')]['newPassword'],_0xfa8743[_0x9cb5('0xa5')])},null));})[_0x9cb5('0x22')](respondWithResult(_0x4715f6,null))['catch'](handleError(_0x4715f6,null));};exports[_0x9cb5('0xa6')]=function(_0x55a6c7,_0x330c97,_0x1746ea){var _0x4d9e81=_0x55a6c7['body'][_0x9cb5('0xa7')];return db['User'][_0x9cb5('0x40')]({'where':{'id':_0x55a6c7['params']['id']},'attributes':['id',_0x9cb5('0x41'),_0x9cb5('0x37'),_0x9cb5('0xa8'),_0x9cb5('0xa9'),_0x9cb5('0xaa'),'interface']})[_0x9cb5('0x22')](handleEntityNotFound(_0x330c97,null))[_0x9cb5('0x22')](function(_0x23c8d1){if(_0x23c8d1){if(!utils['isValidChannel'](_0x4d9e81)){throw new db[(_0x9cb5('0x9b'))][(_0x9cb5('0x9c'))](_0x9cb5('0xab'));}return _0x23c8d1[_0x9cb5('0xac')+_[_0x9cb5('0xad')](_0x4d9e81[_0x9cb5('0xae')]())+_0x9cb5('0xaf')](_0x55a6c7[_0x9cb5('0x62')][_0x9cb5('0x65')],{'penalty':_0x55a6c7[_0x9cb5('0x62')]['penalty']||0x0})['spread'](function(_0xc6240a){for(var _0x3dfd17=0x0;_0x3dfd17<_0x55a6c7[_0x9cb5('0x62')][_0x9cb5('0x65')][_0x9cb5('0x50')];_0x3dfd17+=0x1){var _0x5086e6={'UserId':_0x55a6c7[_0x9cb5('0x5e')]['id']};_0x5086e6[_[_0x9cb5('0xad')](_0x4d9e81[_0x9cb5('0xae')]())+_0x9cb5('0xb0')]=_0x55a6c7['body'][_0x9cb5('0x65')][_0x3dfd17];socket['emit'](_0x9cb5('0x85')+_[_0x9cb5('0xad')](_0x4d9e81['toLowerCase']())+_0x9cb5('0xb1'),_0x5086e6);}return _0xc6240a;})[_0x9cb5('0x22')](function(){if(_0x4d9e81==='voice'){return db[_0x9cb5('0xb2')][_0x9cb5('0x94')]({'where':{'id':_0x55a6c7['body'][_0x9cb5('0x65')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x9cb5('0x22')](function(_0x280101){var _0x122fed=_0x23c8d1[_0x9cb5('0x36')]({'plain':!![]});var _0x4d119a=[];if(_0x4d9e81===_0x9cb5('0xb3')&&_0x122fed[_0x9cb5('0x37')]===_0x9cb5('0x78')&&_0x122fed[_0x9cb5('0xa8')]){for(var _0xd795a1=0x0;_0xd795a1<_0x280101[_0x9cb5('0x50')];_0xd795a1+=0x1){_0x4d119a[_0x9cb5('0xb4')]({'membername':_0x122fed[_0x9cb5('0x41')],'UserId':_0x122fed['id'],'queue_name':_0x280101[_0xd795a1][_0x9cb5('0x41')],'VoiceQueueId':_0x280101[_0xd795a1]['id'],'interface':_[_0x9cb5('0x6d')](_0x122fed[_0x9cb5('0xb5')])?util[_0x9cb5('0xb6')](_0x9cb5('0xb7'),_0x122fed[_0x9cb5('0x41')]):_0x122fed[_0x9cb5('0xb5')],'paused':_0x122fed[_0x9cb5('0xaa')]||![],'penalty':_0x55a6c7[_0x9cb5('0x62')][_0x9cb5('0xb8')]||0x0});}return BPromise['each'](_0x4d119a,function(_0x276d28){return db[_0x9cb5('0xb9')][_0x9cb5('0xba')](_0x276d28);});}return _0x23c8d1;});}})[_0x9cb5('0x22')](respondWithStatusCode(_0x330c97,null))['catch'](handleError(_0x330c97,null));};exports['removeQueues']=function(_0x480296,_0x57e9c8,_0x141e07){var _0x3015f8;return db['User'][_0x9cb5('0x40')]({'where':{'id':_0x480296[_0x9cb5('0x5e')]['id']},'attributes':['id','name',_0x9cb5('0x37')]})[_0x9cb5('0x22')](handleEntityNotFound(_0x57e9c8,null))[_0x9cb5('0x22')](function(_0x243867){if(_0x243867){_0x3015f8=_0x243867;if(!_0x480296[_0x9cb5('0x4c')][_0x9cb5('0xa7')]||!utils[_0x9cb5('0xbb')](_0x480296['query'][_0x9cb5('0xa7')])){throw new db[(_0x9cb5('0x9b'))]['ValidationError'](_0x9cb5('0xab'));}return _0x243867['remove'+_[_0x9cb5('0xad')](_0x480296['query'][_0x9cb5('0xa7')]['toLowerCase']())+'Queues'](_0x480296[_0x9cb5('0x4c')]['ids']);}})[_0x9cb5('0x22')](function(_0x28db7a){for(var _0x3c57e2=0x0;_0x3c57e2<_0x480296[_0x9cb5('0x4c')][_0x9cb5('0x65')][_0x9cb5('0x50')];_0x3c57e2+=0x1){var _0xb4c09={'UserId':_0x480296['params']['id']};_0xb4c09[_['capitalize'](_0x480296[_0x9cb5('0x4c')][_0x9cb5('0xa7')][_0x9cb5('0xae')]())+_0x9cb5('0xb0')]=_0x480296['query'][_0x9cb5('0x65')][_0x3c57e2];socket[_0x9cb5('0xbc')](_0x9cb5('0x85')+_[_0x9cb5('0xad')](_0x480296[_0x9cb5('0x4c')][_0x9cb5('0xa7')][_0x9cb5('0xae')]())+_0x9cb5('0xbd'),_0xb4c09);}return _0x28db7a;})[_0x9cb5('0x22')](function(){if(_0x480296[_0x9cb5('0x4c')][_0x9cb5('0xa7')]==='voice'){return db[_0x9cb5('0xb9')]['destroy']({'where':{'UserId':_0x480296['params']['id'],'VoiceQueueId':_0x480296['query'][_0x9cb5('0x65')]},'individualHooks':!![]})[_0x9cb5('0x22')](function(){return _0x3015f8;});}return _0x3015f8;})['then'](respondWithStatusCode(_0x57e9c8,null))[_0x9cb5('0x2c')](handleError(_0x57e9c8,null));};exports[_0x9cb5('0xbe')]=function(_0x13c965,_0x4f4313,_0xb83019){_0x13c965[_0x9cb5('0x62')][_0x9cb5('0xbf')]=_0x13c965['file'][_0x9cb5('0xc0')];return db[_0x9cb5('0x44')][_0x9cb5('0x40')]({'where':{'id':_0x13c965[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x4f4313,null))[_0x9cb5('0x22')](saveUpdates(_0x13c965[_0x9cb5('0x62')],null))[_0x9cb5('0x22')](respondWithResult(_0x4f4313,null))[_0x9cb5('0x2c')](handleError(_0x4f4313,null));};exports[_0x9cb5('0xc1')]=function(_0x2224e3,_0x352258,_0x1f7ecf){var _0x449d6d=path[_0x9cb5('0xc2')](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x9cb5('0x40')]({'where':{'id':_0x2224e3[_0x9cb5('0x5e')]['id']},'attributes':['id',_0x9cb5('0xbf')],'raw':!![]})[_0x9cb5('0x22')](handleEntityNotFound(_0x352258,null))[_0x9cb5('0x22')](function(_0x479738){if(_0x479738){if(_[_0x9cb5('0x6d')](_0x479738[_0x9cb5('0xbf')])){return _0x352258[_0x9cb5('0xc3')](_0x449d6d);}else{if(!fs[_0x9cb5('0xc4')](path[_0x9cb5('0xc2')](config[_0x9cb5('0xc5')],_0x9cb5('0xc6'),_0x479738['userpic']))){return _0x352258['download'](_0x449d6d);}return _0x352258['download'](path[_0x9cb5('0xc2')](config[_0x9cb5('0xc5')],_0x9cb5('0xc6'),_0x479738[_0x9cb5('0xbf')]));}}})['catch'](handleError(_0x352258,null));};exports[_0x9cb5('0xc7')]=function(_0x2bdd42,_0x5ca38c,_0x17df13){var _0x1fbe64={};var _0x406b11={};var _0x1841fb;var _0x18bb2c;return db[_0x9cb5('0x44')]['findOne']({'where':{'id':_0x2bdd42[_0x9cb5('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ca38c,null))[_0x9cb5('0x22')](function(_0x69a6f7){if(_0x69a6f7){_0x1841fb=_0x69a6f7;_0x406b11[_0x9cb5('0x46')]=_[_0x9cb5('0x4a')](db[_0x9cb5('0xc8')][_0x9cb5('0x5f')]);_0x406b11['query']=_[_0x9cb5('0x4a')](_0x2bdd42[_0x9cb5('0x4c')]);_0x406b11['filters']=_[_0x9cb5('0x4d')](_0x406b11['model'],_0x406b11[_0x9cb5('0x4c')]);_0x1fbe64[_0x9cb5('0x4f')]=_['intersection'](_0x406b11[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x2bdd42['query'][_0x9cb5('0x4e')]));_0x1fbe64[_0x9cb5('0x4f')]=_0x1fbe64['attributes']['length']?_0x1fbe64[_0x9cb5('0x4f')]:_0x406b11[_0x9cb5('0x46')];_0x1fbe64['order']=qs['sort'](_0x2bdd42[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x1fbe64[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x2bdd42['query'],_0x406b11['filters']));if(_0x2bdd42[_0x9cb5('0x4c')]['filter']){_0x1fbe64['where']=_['merge'](_0x1fbe64['where'],{'$or':_['map'](_0x1fbe64['attributes'],function(_0x5325bc){var _0x217803={};_0x217803[_0x5325bc]={'$like':'%'+_0x2bdd42[_0x9cb5('0x4c')]['filter']+'%'};return _0x217803;})});}_0x1fbe64=_[_0x9cb5('0x55')]({},_0x1fbe64,_0x2bdd42[_0x9cb5('0x5a')]);return _0x1841fb[_0x9cb5('0xc7')](_0x1fbe64);}})['then'](function(_0x36601f){if(_0x36601f){_0x18bb2c=_0x36601f[_0x9cb5('0x50')];if(_0x2bdd42[_0x9cb5('0x4c')]['hasOwnProperty']('includeAll')){_0x1fbe64[_0x9cb5('0x60')]=[{'model':db[_0x9cb5('0xc9')],'as':_0x9cb5('0xca'),'required':![]},{'model':db[_0x9cb5('0xcb')],'as':_0x9cb5('0xcc'),'attributes':['id',_0x9cb5('0x41'),_0x9cb5('0xcd')],'where':_0x2bdd42[_0x9cb5('0x4c')][_0x9cb5('0xce')]?{'id':_0x2bdd42['query'][_0x9cb5('0xce')]}:undefined,'required':_0x2bdd42[_0x9cb5('0x4c')][_0x9cb5('0xce')]?!![]:![]}];}if(!_0x2bdd42['query'][_0x9cb5('0x51')]('nolimit')){_0x1fbe64['limit']=qs[_0x9cb5('0x32')](_0x2bdd42[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x1fbe64['offset']=qs[_0x9cb5('0x31')](_0x2bdd42[_0x9cb5('0x4c')][_0x9cb5('0x31')]);}return _0x1841fb['getContacts'](_0x1fbe64);}})['then'](function(_0x1fd044){if(_0x1fd044){return _0x1fd044?{'count':_0x18bb2c,'rows':_0x1fd044}:null;}})['then'](respondWithResult(_0x5ca38c,null))[_0x9cb5('0x2c')](handleError(_0x5ca38c,null));};exports['getQueues']=function(_0xfc766,_0x597890,_0x2a5cc1){var _0x59d510;var _0x22bb2b;var _0x2dc62e={};var _0x480867;return db['User'][_0x9cb5('0xa2')]({'where':{'id':_0xfc766['params']['id']},'attributes':['id',_0x9cb5('0x41'),_0x9cb5('0x37')]})[_0x9cb5('0x22')](handleEntityNotFound(_0x597890,null))[_0x9cb5('0x22')](function(_0x474a09){if(!utils[_0x9cb5('0xbb')](_0xfc766[_0x9cb5('0x4c')]['channel'])){throw new db['Sequelize'][(_0x9cb5('0x9c'))](_0x9cb5('0xab'));}_0x59d510=_0x474a09;var _0x2ce66e={};_0x2ce66e[_0x9cb5('0x46')]=_['keys'](db[_[_0x9cb5('0xad')](_0xfc766['query']['channel'])+'Queue'][_0x9cb5('0x5f')]);_0x2ce66e['query']=_[_0x9cb5('0x4a')](_0xfc766['query']);_0x2ce66e['filters']=_[_0x9cb5('0x4d')](_0x2ce66e[_0x9cb5('0x46')],_0x2ce66e['query']);_0x2dc62e[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x2ce66e[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x2dc62e[_0x9cb5('0x4f')]=_0x2dc62e[_0x9cb5('0x4f')]['length']?_0x2dc62e[_0x9cb5('0x4f')]:_0x2ce66e['model'];_0x2dc62e[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x2dc62e[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0xfc766[_0x9cb5('0x4c')],_0x2ce66e[_0x9cb5('0x4b')]));if(_0xfc766['query']['filter']){_0x2dc62e[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x2dc62e[_0x9cb5('0x53')],{'$or':_[_0x9cb5('0x3d')](_0x2dc62e[_0x9cb5('0x4f')],function(_0x88a20d){var _0x432fb3={};_0x432fb3[_0x88a20d]={'$like':'%'+_0xfc766[_0x9cb5('0x4c')]['filter']+'%'};return _0x432fb3;})});}_0x2dc62e=_['merge']({},_0x2dc62e,_0xfc766[_0x9cb5('0x5a')]);switch(_0x59d510['role']){case _0x9cb5('0x87'):return db[_[_0x9cb5('0xad')](_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0xa7')])+_0x9cb5('0xd0')][_0x9cb5('0x94')](_0x2dc62e);case _0x9cb5('0x85'):case _0x9cb5('0x78'):return _0x59d510[_0x9cb5('0x36')+_[_0x9cb5('0xad')](_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0xa7')])+'Queues'](_0x2dc62e);default:throw new db[(_0x9cb5('0x9b'))][(_0x9cb5('0x9c'))]('Unknown\x20role');}})[_0x9cb5('0x22')](function(_0x2b6316){_0x480867=_0x2b6316[_0x9cb5('0x50')];if(!_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0x51')](_0x9cb5('0xd1'))){_0x2dc62e['limit']=qs[_0x9cb5('0x32')](_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x2dc62e[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0x31')]);}switch(_0x59d510[_0x9cb5('0x37')]){case'admin':return db[_[_0x9cb5('0xad')](_0xfc766['query'][_0x9cb5('0xa7')])+_0x9cb5('0xd0')]['findAll'](_0x2dc62e);case'user':case _0x9cb5('0x78'):return _0x59d510[_0x9cb5('0x36')+_[_0x9cb5('0xad')](_0xfc766[_0x9cb5('0x4c')][_0x9cb5('0xa7')])+_0x9cb5('0xaf')](_0x2dc62e);}})[_0x9cb5('0x22')](function(_0x2f2cb3){return{'count':_0x480867,'rows':_0x2f2cb3};})[_0x9cb5('0x22')](respondWithResult(_0x597890,null))[_0x9cb5('0x2c')](handleError(_0x597890,null));};exports['getVoiceQueuesRt']=function(_0x33d7aa,_0x3be8ca,_0x3119c1){var _0x2ac42a={};var _0x584207={};var _0x3661b8;var _0x336d03;return db['User']['findOne']({'where':{'id':_0x33d7aa[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x3be8ca,null))[_0x9cb5('0x22')](function(_0x2e8319){if(_0x2e8319){_0x3661b8=_0x2e8319;_0x584207[_0x9cb5('0x46')]=_[_0x9cb5('0x4a')](db[_0x9cb5('0xb9')]['rawAttributes']);_0x584207['query']=_[_0x9cb5('0x4a')](_0x33d7aa[_0x9cb5('0x4c')]);_0x584207[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x584207['model'],_0x584207[_0x9cb5('0x4c')]);_0x2ac42a[_0x9cb5('0x4f')]=_['intersection'](_0x584207['model'],qs['fields'](_0x33d7aa[_0x9cb5('0x4c')]['fields']));_0x2ac42a[_0x9cb5('0x4f')]=_0x2ac42a[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x2ac42a[_0x9cb5('0x4f')]:_0x584207['model'];_0x2ac42a['order']=qs[_0x9cb5('0x52')](_0x33d7aa[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x2ac42a['where']=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x33d7aa[_0x9cb5('0x4c')],_0x584207[_0x9cb5('0x4b')]));if(_0x33d7aa[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x2ac42a[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x2ac42a[_0x9cb5('0x53')],{'$or':_['map'](_0x2ac42a[_0x9cb5('0x4f')],function(_0xb8119){var _0x2e2f3b={};_0x2e2f3b[_0xb8119]={'$like':'%'+_0x33d7aa[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%'};return _0x2e2f3b;})});}_0x2ac42a=_[_0x9cb5('0x55')]({},_0x2ac42a,_0x33d7aa[_0x9cb5('0x5a')]);return _0x3661b8[_0x9cb5('0xd2')](_0x2ac42a);}})[_0x9cb5('0x22')](function(_0x18e408){if(_0x18e408){_0x336d03=_0x18e408[_0x9cb5('0x50')];if(!_0x33d7aa[_0x9cb5('0x4c')][_0x9cb5('0x51')](_0x9cb5('0xd1'))){_0x2ac42a[_0x9cb5('0x32')]=qs[_0x9cb5('0x32')](_0x33d7aa[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x2ac42a['offset']=qs[_0x9cb5('0x31')](_0x33d7aa[_0x9cb5('0x4c')]['offset']);}return _0x3661b8[_0x9cb5('0xd2')](_0x2ac42a);}})[_0x9cb5('0x22')](function(_0x34f122){if(_0x34f122){return _0x34f122?{'count':_0x336d03,'rows':_0x34f122}:null;}})['then'](respondWithResult(_0x3be8ca,null))[_0x9cb5('0x2c')](handleError(_0x3be8ca,null));};exports['getGroups']=function(_0x2b5d38,_0x48a9be,_0x23e014){var _0x32636d={};var _0x587651={};var _0x5393d1;var _0x1289ff;return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0x2b5d38[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x48a9be,null))[_0x9cb5('0x22')](function(_0x578623){if(_0x578623){_0x5393d1=_0x578623;_0x587651['model']=_[_0x9cb5('0x4a')](db['ChatGroup']['rawAttributes']);_0x587651[_0x9cb5('0x4c')]=_['keys'](_0x2b5d38[_0x9cb5('0x4c')]);_0x587651['filters']=_[_0x9cb5('0x4d')](_0x587651['model'],_0x587651[_0x9cb5('0x4c')]);_0x32636d['attributes']=_[_0x9cb5('0x4d')](_0x587651[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x2b5d38[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x32636d[_0x9cb5('0x4f')]=_0x32636d[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x32636d[_0x9cb5('0x4f')]:_0x587651[_0x9cb5('0x46')];_0x32636d[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x2b5d38[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x32636d['where']=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x2b5d38[_0x9cb5('0x4c')],_0x587651[_0x9cb5('0x4b')]));if(_0x2b5d38[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x32636d[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x32636d[_0x9cb5('0x53')],{'$or':_['map'](_0x32636d[_0x9cb5('0x4f')],function(_0x4b0b9b){var _0x365c24={};_0x365c24[_0x4b0b9b]={'$like':'%'+_0x2b5d38['query']['filter']+'%'};return _0x365c24;})});}_0x32636d=_[_0x9cb5('0x55')]({},_0x32636d,_0x2b5d38[_0x9cb5('0x5a')]);return _0x5393d1[_0x9cb5('0xd3')](_0x32636d);}})[_0x9cb5('0x22')](function(_0x2908dd){if(_0x2908dd){_0x1289ff=_0x2908dd['length'];if(!_0x2b5d38[_0x9cb5('0x4c')]['hasOwnProperty'](_0x9cb5('0xd1'))){_0x32636d[_0x9cb5('0x32')]=qs[_0x9cb5('0x32')](_0x2b5d38[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x32636d[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x2b5d38[_0x9cb5('0x4c')]['offset']);}return _0x5393d1[_0x9cb5('0xd3')](_0x32636d);}})[_0x9cb5('0x22')](function(_0x17a1f0){if(_0x17a1f0){return _0x17a1f0?{'count':_0x1289ff,'rows':_0x17a1f0}:null;}})[_0x9cb5('0x22')](respondWithResult(_0x48a9be,null))[_0x9cb5('0x2c')](handleError(_0x48a9be,null));};exports[_0x9cb5('0xd4')]=function(_0x180c50,_0x1e3621,_0x35cfb9){var _0x56e98a={'raw':!![],'where':{}};var _0x21ab4a={};var _0x8e4832={'count':0x0,'rows':[]};return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0x180c50['params']['id']}})['then'](handleEntityNotFound(_0x1e3621,null))[_0x9cb5('0x22')](function(_0x4cb811){if(_0x4cb811){_0x21ab4a[_0x9cb5('0x46')]=_[_0x9cb5('0x4a')](db[_0x9cb5('0xd5')]['rawAttributes']);_0x21ab4a[_0x9cb5('0x4c')]=_['keys'](_0x180c50['query']);_0x21ab4a[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x21ab4a[_0x9cb5('0x46')],_0x21ab4a[_0x9cb5('0x4c')]);_0x56e98a[_0x9cb5('0x4f')]=_['intersection'](_0x21ab4a['model'],qs[_0x9cb5('0x4e')](_0x180c50[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x56e98a[_0x9cb5('0x4f')]=_0x56e98a['attributes']['length']?_0x56e98a[_0x9cb5('0x4f')]:_0x21ab4a[_0x9cb5('0x46')];if(!_0x180c50[_0x9cb5('0x4c')]['hasOwnProperty'](_0x9cb5('0xd1'))){_0x56e98a['limit']=qs[_0x9cb5('0x32')](_0x180c50[_0x9cb5('0x4c')]['limit']);_0x56e98a[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x180c50[_0x9cb5('0x4c')][_0x9cb5('0x31')]);}_0x56e98a[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x180c50[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x56e98a['where']=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x180c50['query'],_0x21ab4a[_0x9cb5('0x4b')]));_0x56e98a['where'][_0x9cb5('0xd6')]=_0x4cb811['id'];if(_0x180c50[_0x9cb5('0x4c')]['filter']){_0x56e98a['where']=_[_0x9cb5('0x55')](_0x56e98a['where'],{'$or':_[_0x9cb5('0x3d')](_0x56e98a[_0x9cb5('0x4f')],function(_0x1b2ea0){var _0x59f86b={};_0x59f86b[_0x1b2ea0]={'$like':'%'+_0x180c50[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%'};return _0x59f86b;})});}_0x56e98a=_['merge']({},_0x56e98a,_0x180c50[_0x9cb5('0x5a')]);return db[_0x9cb5('0xd5')]['count']({'where':_0x56e98a[_0x9cb5('0x53')]})['then'](function(_0x4733ed){_0x8e4832['count']=_0x4733ed;if(_0x180c50['query'][_0x9cb5('0x5b')]){_0x56e98a[_0x9cb5('0x60')]=[{'all':!![]}];}return db[_0x9cb5('0xd5')]['findAll'](_0x56e98a);})[_0x9cb5('0x22')](function(_0x1ab9b0){_0x8e4832[_0x9cb5('0x5c')]=_0x1ab9b0;return _0x8e4832;});}})[_0x9cb5('0x22')](respondWithFilteredResult(_0x1e3621,_0x56e98a))[_0x9cb5('0x2c')](handleError(_0x1e3621,null));};exports[_0x9cb5('0xd7')]=function(_0x36ac06,_0x4d2af8,_0x4f9ee9){var _0x58de51={'raw':!![],'where':{}};var _0x3fda91={};var _0x2a73e={'count':0x0,'rows':[]};return db['User'][_0x9cb5('0xa2')]({'where':{'id':_0x36ac06['params']['id']}})['then'](handleEntityNotFound(_0x4d2af8,null))['then'](function(_0x4a0690){if(_0x4a0690){_0x3fda91[_0x9cb5('0x46')]=_['keys'](db[_0x9cb5('0xd8')][_0x9cb5('0x5f')]);_0x3fda91[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x36ac06[_0x9cb5('0x4c')]);_0x3fda91[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x3fda91['model'],_0x3fda91['query']);_0x58de51[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x3fda91[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x36ac06[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x58de51[_0x9cb5('0x4f')]=_0x58de51[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x58de51[_0x9cb5('0x4f')]:_0x3fda91['model'];if(!_0x36ac06[_0x9cb5('0x4c')]['hasOwnProperty'](_0x9cb5('0xd1'))){_0x58de51[_0x9cb5('0x32')]=qs[_0x9cb5('0x32')](_0x36ac06[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x58de51[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x36ac06['query'][_0x9cb5('0x31')]);}_0x58de51['order']=qs[_0x9cb5('0x52')](_0x36ac06[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x58de51['where']=qs[_0x9cb5('0x4b')](_['pick'](_0x36ac06[_0x9cb5('0x4c')],_0x3fda91['filters']));_0x58de51[_0x9cb5('0x53')]['UserId']=_0x4a0690['id'];if(_0x36ac06['query'][_0x9cb5('0x3c')]){_0x58de51['where']=_[_0x9cb5('0x55')](_0x58de51[_0x9cb5('0x53')],{'$or':_['map'](_0x58de51[_0x9cb5('0x4f')],function(_0x491dc3){var _0x2fd6b7={};_0x2fd6b7[_0x491dc3]={'$like':'%'+_0x36ac06[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%'};return _0x2fd6b7;})});}_0x58de51=_[_0x9cb5('0x55')]({},_0x58de51,_0x36ac06[_0x9cb5('0x5a')]);return db['ScreenRecording']['count']({'where':_0x58de51[_0x9cb5('0x53')]})[_0x9cb5('0x22')](function(_0xb47226){_0x2a73e[_0x9cb5('0x30')]=_0xb47226;if(_0x36ac06[_0x9cb5('0x4c')][_0x9cb5('0x5b')]){_0x58de51[_0x9cb5('0x60')]=[{'all':!![]}];}return db[_0x9cb5('0xd8')][_0x9cb5('0x94')](_0x58de51);})[_0x9cb5('0x22')](function(_0x210515){_0x2a73e[_0x9cb5('0x5c')]=_0x210515;return _0x2a73e;});}})[_0x9cb5('0x22')](respondWithFilteredResult(_0x4d2af8,_0x58de51))['catch'](handleError(_0x4d2af8,null));};exports[_0x9cb5('0xd9')]=function(_0x160c3b,_0x21aa2e,_0x13aa46){var _0x27ae94={};var _0x53ec66={};var _0x298ab8;var _0x2f7ba6;return db['User'][_0x9cb5('0xa2')]({'where':{'id':_0x160c3b[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x21aa2e,null))[_0x9cb5('0x22')](function(_0x13cb8d){if(_0x13cb8d){_0x298ab8=_0x13cb8d;_0x53ec66[_0x9cb5('0x46')]=_[_0x9cb5('0x4a')](db['ChatInteraction'][_0x9cb5('0x5f')]);_0x53ec66[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x160c3b['query']);_0x53ec66[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x53ec66['model'],_0x53ec66[_0x9cb5('0x4c')]);_0x27ae94[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x53ec66[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x160c3b[_0x9cb5('0x4c')]['fields']));_0x27ae94[_0x9cb5('0x4f')]=_0x27ae94['attributes']['length']?_0x27ae94[_0x9cb5('0x4f')]:_0x53ec66[_0x9cb5('0x46')];_0x27ae94[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x160c3b[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x27ae94['where']=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x160c3b['query'],_0x53ec66['filters']));if(_0x160c3b[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x27ae94[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x27ae94['where'],{'$or':_[_0x9cb5('0x3d')](_0x27ae94[_0x9cb5('0x4f')],function(_0x5413bf){var _0x3a5bb1={};_0x3a5bb1[_0x5413bf]={'$like':'%'+_0x160c3b[_0x9cb5('0x4c')]['filter']+'%'};return _0x3a5bb1;})});}_0x27ae94=_[_0x9cb5('0x55')]({},_0x27ae94,_0x160c3b[_0x9cb5('0x5a')]);return _0x298ab8['getChatInteractions'](_0x27ae94);}})['then'](function(_0x114525){if(_0x114525){_0x2f7ba6=_0x114525[_0x9cb5('0x50')];if(!_0x160c3b['query']['hasOwnProperty'](_0x9cb5('0xd1'))){_0x27ae94[_0x9cb5('0x32')]=qs['limit'](_0x160c3b['query'][_0x9cb5('0x32')]);_0x27ae94[_0x9cb5('0x31')]=qs['offset'](_0x160c3b['query'][_0x9cb5('0x31')]);}return _0x298ab8['getChatInteractions'](_0x27ae94);}})[_0x9cb5('0x22')](function(_0x5772fa){if(_0x5772fa){return _0x5772fa?{'count':_0x2f7ba6,'rows':_0x5772fa}:null;}})['then'](respondWithResult(_0x21aa2e,null))[_0x9cb5('0x2c')](handleError(_0x21aa2e,null));};exports[_0x9cb5('0xda')]=function(_0x1ff9bb,_0x2395a9,_0x5876a9){var _0x599c9b={};var _0x9a86b0={};var _0x159d3f;var _0x18042d;return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0x1ff9bb[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x2395a9,null))[_0x9cb5('0x22')](function(_0x4054de){if(_0x4054de){_0x159d3f=_0x4054de;_0x9a86b0[_0x9cb5('0x46')]=_['keys'](db[_0x9cb5('0xdb')][_0x9cb5('0x5f')]);_0x9a86b0[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x1ff9bb[_0x9cb5('0x4c')]);_0x9a86b0[_0x9cb5('0x4b')]=_['intersection'](_0x9a86b0[_0x9cb5('0x46')],_0x9a86b0[_0x9cb5('0x4c')]);_0x599c9b[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x9a86b0[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x1ff9bb[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x599c9b[_0x9cb5('0x4f')]=_0x599c9b[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x599c9b[_0x9cb5('0x4f')]:_0x9a86b0[_0x9cb5('0x46')];_0x599c9b[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x1ff9bb[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x599c9b[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x1ff9bb[_0x9cb5('0x4c')],_0x9a86b0['filters']));if(_0x1ff9bb[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x599c9b[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x599c9b[_0x9cb5('0x53')],{'$or':_['map'](_0x599c9b[_0x9cb5('0x4f')],function(_0x27851d){var _0x36c396={};_0x36c396[_0x27851d]={'$like':'%'+_0x1ff9bb[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%'};return _0x36c396;})});}_0x599c9b=_['merge']({},_0x599c9b,_0x1ff9bb['options']);return _0x159d3f['getOpenchannelInteractions'](_0x599c9b);}})[_0x9cb5('0x22')](function(_0x18f7dc){if(_0x18f7dc){_0x18042d=_0x18f7dc['length'];if(!_0x1ff9bb[_0x9cb5('0x4c')]['hasOwnProperty'](_0x9cb5('0xd1'))){_0x599c9b[_0x9cb5('0x32')]=qs['limit'](_0x1ff9bb[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x599c9b[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x1ff9bb['query'][_0x9cb5('0x31')]);}return _0x159d3f['getOpenchannelInteractions'](_0x599c9b);}})[_0x9cb5('0x22')](function(_0x39989b){if(_0x39989b){return _0x39989b?{'count':_0x18042d,'rows':_0x39989b}:null;}})[_0x9cb5('0x22')](respondWithResult(_0x2395a9,null))[_0x9cb5('0x2c')](handleError(_0x2395a9,null));};exports['getMailInteractions']=function(_0x17957e,_0x36b1ff,_0x963f83){var _0x1bde06={'raw':!![],'where':{}};var _0x1fd9da={};var _0x298132={'count':0x0,'rows':[]};return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0x17957e['params']['id']}})['then'](handleEntityNotFound(_0x36b1ff,null))[_0x9cb5('0x22')](function(_0x249d21){if(_0x249d21){_0x1fd9da['model']=_[_0x9cb5('0x4a')](db[_0x9cb5('0xdc')][_0x9cb5('0x5f')]);_0x1fd9da['query']=_[_0x9cb5('0x4a')](_0x17957e['query']);_0x1fd9da[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x1fd9da[_0x9cb5('0x46')],_0x1fd9da[_0x9cb5('0x4c')]);_0x1bde06[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x1fd9da[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x17957e[_0x9cb5('0x4c')]['fields']));_0x1bde06[_0x9cb5('0x4f')]=_0x1bde06[_0x9cb5('0x4f')]['length']?_0x1bde06[_0x9cb5('0x4f')]:_0x1fd9da[_0x9cb5('0x46')];if(!_0x17957e[_0x9cb5('0x4c')][_0x9cb5('0x51')](_0x9cb5('0xd1'))){_0x1bde06['limit']=qs[_0x9cb5('0x32')](_0x17957e[_0x9cb5('0x4c')]['limit']);_0x1bde06['offset']=qs[_0x9cb5('0x31')](_0x17957e[_0x9cb5('0x4c')][_0x9cb5('0x31')]);}_0x1bde06[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x17957e[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x1bde06[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x17957e[_0x9cb5('0x4c')],_0x1fd9da['filters']));_0x1bde06['where'][_0x9cb5('0xd6')]=_0x249d21['id'];if(_0x17957e[_0x9cb5('0x4c')]['filter']){_0x1bde06['where']=_[_0x9cb5('0x55')](_0x1bde06[_0x9cb5('0x53')],{'$or':_[_0x9cb5('0x3d')](_0x1bde06['attributes'],function(_0xeb182f){var _0x3aa4bd={};_0x3aa4bd[_0xeb182f]={'$like':'%'+_0x17957e['query'][_0x9cb5('0x3c')]+'%'};return _0x3aa4bd;})});}_0x1bde06=_[_0x9cb5('0x55')]({},_0x1bde06,_0x17957e[_0x9cb5('0x5a')]);return db[_0x9cb5('0xdc')][_0x9cb5('0x30')]({'where':_0x1bde06[_0x9cb5('0x53')]})['then'](function(_0x4a82d1){_0x298132[_0x9cb5('0x30')]=_0x4a82d1;if(_0x17957e[_0x9cb5('0x4c')][_0x9cb5('0x5b')]){_0x1bde06[_0x9cb5('0x60')]=[{'all':!![]}];}return db[_0x9cb5('0xdc')][_0x9cb5('0x94')](_0x1bde06);})[_0x9cb5('0x22')](function(_0x5abe4c){_0x298132[_0x9cb5('0x5c')]=_0x5abe4c;return _0x298132;});}})['then'](respondWithFilteredResult(_0x36b1ff,_0x1bde06))[_0x9cb5('0x2c')](handleError(_0x36b1ff,null));};exports[_0x9cb5('0xdd')]=function(_0x10cfb7,_0x2ccb37,_0x389bf4){var _0x1f4b57={};var _0x25a13a={};var _0x23fba3;var _0x24c97a;return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0x10cfb7[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x2ccb37,null))[_0x9cb5('0x22')](function(_0x3da061){if(_0x3da061){_0x23fba3=_0x3da061;_0x25a13a['model']=_['keys'](db[_0x9cb5('0xde')]['rawAttributes']);_0x25a13a[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x10cfb7[_0x9cb5('0x4c')]);_0x25a13a[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x25a13a[_0x9cb5('0x46')],_0x25a13a['query']);_0x1f4b57[_0x9cb5('0x4f')]=_['intersection'](_0x25a13a['model'],qs[_0x9cb5('0x4e')](_0x10cfb7[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x1f4b57[_0x9cb5('0x4f')]=_0x1f4b57['attributes'][_0x9cb5('0x50')]?_0x1f4b57['attributes']:_0x25a13a[_0x9cb5('0x46')];_0x1f4b57[_0x9cb5('0xcf')]=qs['sort'](_0x10cfb7[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x1f4b57['where']=qs['filters'](_[_0x9cb5('0x54')](_0x10cfb7[_0x9cb5('0x4c')],_0x25a13a[_0x9cb5('0x4b')]));if(_0x10cfb7[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x1f4b57[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x1f4b57[_0x9cb5('0x53')],{'$or':_[_0x9cb5('0x3d')](_0x1f4b57[_0x9cb5('0x4f')],function(_0x34ec89){var _0x215307={};_0x215307[_0x34ec89]={'$like':'%'+_0x10cfb7[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%'};return _0x215307;})});}_0x1f4b57=_['merge']({},_0x1f4b57,_0x10cfb7['options']);return _0x23fba3[_0x9cb5('0xdd')](_0x1f4b57);}})[_0x9cb5('0x22')](function(_0x3ee19e){if(_0x3ee19e){_0x24c97a=_0x3ee19e[_0x9cb5('0x50')];if(!_0x10cfb7[_0x9cb5('0x4c')][_0x9cb5('0x51')](_0x9cb5('0xd1'))){_0x1f4b57['limit']=qs[_0x9cb5('0x32')](_0x10cfb7[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x1f4b57[_0x9cb5('0x31')]=qs['offset'](_0x10cfb7[_0x9cb5('0x4c')][_0x9cb5('0x31')]);}return _0x23fba3[_0x9cb5('0xdd')](_0x1f4b57);}})[_0x9cb5('0x22')](function(_0xb97f61){if(_0xb97f61){return _0xb97f61?{'count':_0x24c97a,'rows':_0xb97f61}:null;}})[_0x9cb5('0x22')](respondWithResult(_0x2ccb37,null))['catch'](handleError(_0x2ccb37,null));};exports[_0x9cb5('0xdf')]=function(_0x4a7009,_0x3060f2,_0x3203eb){var _0xbf481d={};var _0x46fce6={};var _0x47d1b5;var _0x5761e8;return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0x4a7009[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x3060f2,null))[_0x9cb5('0x22')](function(_0x536771){if(_0x536771){_0x47d1b5=_0x536771;_0x46fce6[_0x9cb5('0x46')]=_[_0x9cb5('0x4a')](db[_0x9cb5('0xe0')][_0x9cb5('0x5f')]);_0x46fce6[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x4a7009['query']);_0x46fce6[_0x9cb5('0x4b')]=_['intersection'](_0x46fce6[_0x9cb5('0x46')],_0x46fce6[_0x9cb5('0x4c')]);_0xbf481d[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x46fce6['model'],qs[_0x9cb5('0x4e')](_0x4a7009['query'][_0x9cb5('0x4e')]));_0xbf481d[_0x9cb5('0x4f')]=_0xbf481d['attributes']['length']?_0xbf481d[_0x9cb5('0x4f')]:_0x46fce6[_0x9cb5('0x46')];_0xbf481d[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x4a7009[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0xbf481d['where']=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x4a7009['query'],_0x46fce6[_0x9cb5('0x4b')]));if(_0x4a7009[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0xbf481d['where']=_['merge'](_0xbf481d[_0x9cb5('0x53')],{'$or':_[_0x9cb5('0x3d')](_0xbf481d[_0x9cb5('0x4f')],function(_0x252122){var _0x1c254e={};_0x1c254e[_0x252122]={'$like':'%'+_0x4a7009[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%'};return _0x1c254e;})});}_0xbf481d=_[_0x9cb5('0x55')]({},_0xbf481d,_0x4a7009['options']);return _0x47d1b5[_0x9cb5('0xdf')](_0xbf481d);}})[_0x9cb5('0x22')](function(_0x47a0cb){if(_0x47a0cb){_0x5761e8=_0x47a0cb['length'];if(!_0x4a7009['query'][_0x9cb5('0x51')]('nolimit')){_0xbf481d[_0x9cb5('0x32')]=qs[_0x9cb5('0x32')](_0x4a7009['query']['limit']);_0xbf481d[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x4a7009[_0x9cb5('0x4c')][_0x9cb5('0x31')]);}return _0x47d1b5[_0x9cb5('0xdf')](_0xbf481d);}})[_0x9cb5('0x22')](function(_0x498312){if(_0x498312){return _0x498312?{'count':_0x5761e8,'rows':_0x498312}:null;}})[_0x9cb5('0x22')](respondWithResult(_0x3060f2,null))[_0x9cb5('0x2c')](handleError(_0x3060f2,null));};exports['getWhatsappInteractions']=function(_0x40b061,_0x5bf0a2,_0x12afb6){var _0x7ae348={};var _0x46dd6b={};var _0x54beaf;var _0x3f68f9;return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0x40b061[_0x9cb5('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5bf0a2,null))[_0x9cb5('0x22')](function(_0x46efb5){if(_0x46efb5){_0x54beaf=_0x46efb5;_0x46dd6b[_0x9cb5('0x46')]=_['keys'](db[_0x9cb5('0xe1')][_0x9cb5('0x5f')]);_0x46dd6b['query']=_[_0x9cb5('0x4a')](_0x40b061[_0x9cb5('0x4c')]);_0x46dd6b[_0x9cb5('0x4b')]=_['intersection'](_0x46dd6b['model'],_0x46dd6b['query']);_0x7ae348[_0x9cb5('0x4f')]=_['intersection'](_0x46dd6b[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x40b061['query'][_0x9cb5('0x4e')]));_0x7ae348[_0x9cb5('0x4f')]=_0x7ae348[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x7ae348[_0x9cb5('0x4f')]:_0x46dd6b[_0x9cb5('0x46')];_0x7ae348[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x40b061[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x7ae348[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_['pick'](_0x40b061[_0x9cb5('0x4c')],_0x46dd6b[_0x9cb5('0x4b')]));if(_0x40b061[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x7ae348[_0x9cb5('0x53')]=_['merge'](_0x7ae348['where'],{'$or':_[_0x9cb5('0x3d')](_0x7ae348[_0x9cb5('0x4f')],function(_0x1abc28){var _0x372741={};_0x372741[_0x1abc28]={'$like':'%'+_0x40b061['query'][_0x9cb5('0x3c')]+'%'};return _0x372741;})});}_0x7ae348=_[_0x9cb5('0x55')]({},_0x7ae348,_0x40b061[_0x9cb5('0x5a')]);return _0x54beaf[_0x9cb5('0xe2')](_0x7ae348);}})[_0x9cb5('0x22')](function(_0x1745ab){if(_0x1745ab){_0x3f68f9=_0x1745ab[_0x9cb5('0x50')];if(!_0x40b061['query'][_0x9cb5('0x51')]('nolimit')){_0x7ae348[_0x9cb5('0x32')]=qs[_0x9cb5('0x32')](_0x40b061[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x7ae348[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x40b061['query']['offset']);}return _0x54beaf[_0x9cb5('0xe2')](_0x7ae348);}})[_0x9cb5('0x22')](function(_0x4e46d3){if(_0x4e46d3){return _0x4e46d3?{'count':_0x3f68f9,'rows':_0x4e46d3}:null;}})[_0x9cb5('0x22')](respondWithResult(_0x5bf0a2,null))[_0x9cb5('0x2c')](handleError(_0x5bf0a2,null));};exports[_0x9cb5('0xe3')]=function(_0x3c75b1,_0x12c067,_0x562898){var _0x2aeaa8;var _0x584d08;var _0x317e46;var _0x648a7b=!_['isNil'](_0x3c75b1[_0x9cb5('0x5e')]['id'])?_0x3c75b1['params']['id']:!_[_0x9cb5('0x6d')](_0x3c75b1[_0x9cb5('0x85')]['id'])?_0x3c75b1[_0x9cb5('0x85')]['id']:null;return db[_0x9cb5('0x44')]['find']({'where':{'id':_0x648a7b,'role':{'$or':[_0x9cb5('0x87'),_0x9cb5('0x85'),_0x9cb5('0x78')]}},'attributes':['id',_0x9cb5('0x41'),_0x9cb5('0xe4'),'mobile','role',_0x9cb5('0x6e'),'loginInPause']})['then'](function(_0x221547){if(_0x221547){if(_0x221547[_0x9cb5('0x37')]===_0x9cb5('0x78')){_0x2aeaa8=_0x221547;if(_0x3c75b1['body'][_0x9cb5('0xb5')]){_0x317e46=util[_0x9cb5('0xb6')](_0x9cb5('0xe5'),_0x2aeaa8[_0x3c75b1[_0x9cb5('0x62')][_0x9cb5('0xb5')]]);}else if(_0x3c75b1[_0x9cb5('0x62')]['intrf']){_0x317e46=util[_0x9cb5('0xb6')](_0x9cb5('0xb7'),_0x3c75b1[_0x9cb5('0x62')][_0x9cb5('0xe6')]);}else{_0x317e46=util['format']('SIP/%s',_0x2aeaa8[_0x9cb5('0x41')]);}socket['to'](util[_0x9cb5('0xb6')](_0x9cb5('0xe7'),_0x2aeaa8[_0x9cb5('0x41')]))[_0x9cb5('0xbc')](_0x9cb5('0xe8'),{'ip':_0x3c75b1['headers'][_0x9cb5('0xe9')]||_0x3c75b1[_0x9cb5('0xea')][_0x9cb5('0xeb')]||_0x3c75b1['socket'][_0x9cb5('0xeb')]||_0x3c75b1[_0x9cb5('0xea')]['socket'][_0x9cb5('0xeb')]});return db[_0x9cb5('0xb9')][_0x9cb5('0x35')]({'where':{'membername':_0x2aeaa8['name']},'individualHooks':!![]});}}else{throw new db[(_0x9cb5('0x9b'))][(_0x9cb5('0x9c'))](_0x9cb5('0xec'));}})['then'](function(){if(_0x2aeaa8){return _0x2aeaa8[_0x9cb5('0xed')]({'raw':!![]});}})[_0x9cb5('0x22')](function(_0x13c8a8){if(_0x2aeaa8){var _0x25bfdf=[];if(_0x13c8a8){_0x584d08=_0x13c8a8;if(_0x584d08[_0x9cb5('0x50')]){for(var _0x43844c=0x0;_0x43844c<_0x584d08[_0x9cb5('0x50')];_0x43844c++){_0x25bfdf[_0x9cb5('0xb4')]({'membername':_0x2aeaa8[_0x9cb5('0x41')],'UserId':_0x2aeaa8['id'],'queue_name':_0x584d08[_0x43844c]['name'],'VoiceQueueId':_0x584d08[_0x43844c]['id'],'interface':_0x317e46,'paused':_0x2aeaa8[_0x9cb5('0xa9')]||![],'penalty':_0x584d08[_0x43844c][_0x9cb5('0xee')]||0x0});}return BPromise[_0x9cb5('0xef')](_0x25bfdf,function(_0x452bfa){return db[_0x9cb5('0xb9')][_0x9cb5('0xba')](_0x452bfa);});}}}})[_0x9cb5('0x22')](function(){if(_0x2aeaa8){return db[_0x9cb5('0xf0')][_0x9cb5('0x94')]({'where':{'membername':_0x2aeaa8[_0x9cb5('0x41')],'exitAt':null}});}})[_0x9cb5('0x22')](function(_0x455d9d){if(_0x2aeaa8){var _0x2dd74d=[];_0x455d9d[_0x9cb5('0xf1')](function(_0x410a1d){_0x2dd74d[_0x9cb5('0xb4')](_0x410a1d[_0x9cb5('0x61')]({'exitAt':moment()[_0x9cb5('0xb6')](_0x9cb5('0xf2'))}));});return BPromise[_0x9cb5('0x93')](_0x2dd74d);}})[_0x9cb5('0x22')](function(){if(_0x2aeaa8){var _0x41c7dc=[];var _0x50d9b7=[];var _0x59b5c2=utils[_0x9cb5('0xf3')]();var _0x22bcca={'membername':_0x2aeaa8[_0x9cb5('0x41')],'interface':_0x317e46,'enterAt':moment()[_0x9cb5('0xb6')](_0x9cb5('0xf2')),'role':_0x2aeaa8[_0x9cb5('0x37')],'internal':_0x2aeaa8['internal']};_0x59b5c2[_0x9cb5('0xf1')](function(_0x5aadc8){_0x41c7dc[_0x9cb5('0xb4')](_[_0x9cb5('0x55')]({'channel':_0x5aadc8,'type':'LOGIN','data1':_0x3c75b1[_0x9cb5('0x62')][_0x9cb5('0xf4')],'data2':_0x317e46},_0x22bcca));if(_0x2aeaa8['loginInPause']){_0x50d9b7[_0x9cb5('0xb4')](_[_0x9cb5('0x55')]({'channel':_0x5aadc8,'type':_0x9cb5('0xf5'),'data1':_0x9cb5('0xf6')},_0x22bcca));}});return db[_0x9cb5('0xf0')]['bulkCreate'](_0x41c7dc[_0x9cb5('0xf7')](_0x50d9b7),{'individualHooks':!![]});}})[_0x9cb5('0x22')](function(){if(_0x2aeaa8){return _0x2aeaa8[_0x9cb5('0x61')]({'online':!![],'lastLoginAt':moment()[_0x9cb5('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2aeaa8[_0x9cb5('0xa9')]||![],'mailPause':_0x2aeaa8[_0x9cb5('0xa9')]||![],'chatPause':_0x2aeaa8[_0x9cb5('0xa9')]||![],'faxPause':_0x2aeaa8['loginInPause']||![],'smsPause':_0x2aeaa8[_0x9cb5('0xa9')]||![],'openchannelPause':_0x2aeaa8[_0x9cb5('0xa9')]||![],'whatsappPause':_0x2aeaa8[_0x9cb5('0xa9')]||![],'pauseType':_0x2aeaa8[_0x9cb5('0xa9')]?_0x9cb5('0xf6'):null,'interface':_0x317e46,'lastPauseAt':moment()[_0x9cb5('0xb6')](_0x9cb5('0xf2'))});}})['then'](function(_0x3c503f){if(_0x3c75b1[_0x9cb5('0xf8')]){return _0x562898();}else{return BPromise[_0x9cb5('0xf9')](_0x3c503f)[_0x9cb5('0x22')](respondWithResult(_0x12c067,null));}})[_0x9cb5('0x2c')](handleError(_0x12c067,null));};exports[_0x9cb5('0xfa')]=function(_0x299a8f,_0x2801a5,_0x1043de){var _0x3a4049;return db[_0x9cb5('0x44')][_0x9cb5('0x40')]({'where':{'id':_0x299a8f[_0x9cb5('0x5e')]['id'],'role':'agent'},'attributes':['id',_0x9cb5('0x41'),_0x9cb5('0x37')]})[_0x9cb5('0x22')](handleEntityNotFound(_0x2801a5,null))['then'](function(_0x53b938){if(_0x53b938){_0x3a4049=_0x53b938;return db[_0x9cb5('0xb9')]['destroy']({'where':{'membername':_0x3a4049[_0x9cb5('0x41')]},'individualHooks':!![]});}})[_0x9cb5('0x22')](function(){return db[_0x9cb5('0xf0')][_0x9cb5('0x94')]({'where':{'membername':_0x3a4049[_0x9cb5('0x41')],'exitAt':null}});})['then'](function(_0x218131){var _0x1ac9ea=[];_0x218131['forEach'](function(_0xc1fb09){_0x1ac9ea['push'](_0xc1fb09[_0x9cb5('0x61')]({'exitAt':moment()[_0x9cb5('0xb6')](_0x9cb5('0xf2'))}));});return BPromise[_0x9cb5('0x93')](_0x1ac9ea);})[_0x9cb5('0x22')](function(){return _0x3a4049['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2801a5,null))['catch'](handleError(_0x2801a5,null));};exports[_0x9cb5('0xfb')]=function(_0x2c8804,_0x38ae9b,_0x13c2de){var _0x31a5fe;return db[_0x9cb5('0xb9')][_0x9cb5('0x61')]({'paused':0x1},{'where':{'UserId':_0x2c8804['params']['id']},'individualHooks':!![]})[_0x9cb5('0x22')](function(){return db[_0x9cb5('0x44')]['find']({'where':{'id':_0x2c8804[_0x9cb5('0x5e')]['id'],'role':_0x9cb5('0x78')},'attributes':['id',_0x9cb5('0x41'),_0x9cb5('0x37'),_0x9cb5('0x6e'),_0x9cb5('0xb5')]});})['then'](handleEntityNotFound(_0x38ae9b,null))[_0x9cb5('0x22')](function(_0x22ecfe){if(_0x22ecfe){_0x31a5fe=_0x22ecfe;return respondWithRpcPromise(_0x9cb5('0xfc'),_0x9cb5('0xfb'),{'id':_0x31a5fe['id'],'name':_0x31a5fe[_0x9cb5('0x41')],'pause':!![]});}})['then'](function(){if(_0x31a5fe){return db[_0x9cb5('0xf0')][_0x9cb5('0x94')]({'where':{'membername':_0x31a5fe[_0x9cb5('0x41')],'type':'PAUSE','exitAt':null}});}})[_0x9cb5('0x22')](function(_0x232934){if(_0x232934[_0x9cb5('0x50')]){var _0x5cc7a9=moment()[_0x9cb5('0xb6')](_0x9cb5('0xf2'));for(var _0x3a6249=0x0,_0x4c5c5f=_0x232934['length'];_0x3a6249<_0x4c5c5f;_0x3a6249++){_0x232934[_0x3a6249]['updateAttributes']({'exitAt':_0x5cc7a9});}}})[_0x9cb5('0x22')](function(){var _0x4be813=[];var _0x51152b=utils[_0x9cb5('0xf3')]();_0x51152b[_0x9cb5('0xf1')](function(_0x43682d){_0x4be813[_0x9cb5('0xb4')]({'channel':_0x43682d,'membername':_0x31a5fe[_0x9cb5('0x41')],'interface':_['isNil'](_0x31a5fe[_0x9cb5('0xb5')])?util['format'](_0x9cb5('0xb7'),_0x31a5fe['name']):_0x31a5fe[_0x9cb5('0xb5')],'type':_0x9cb5('0xf5'),'enterAt':moment()[_0x9cb5('0xb6')](_0x9cb5('0xf2')),'data1':_0x2c8804[_0x9cb5('0x62')]['type']||_0x9cb5('0xfd'),'role':_0x31a5fe[_0x9cb5('0x37')],'internal':_0x31a5fe[_0x9cb5('0x6e')]});});return db['MemberReport'][_0x9cb5('0x90')](_0x4be813,{'individualHooks':!![]});})[_0x9cb5('0x22')](function(){return _0x31a5fe[_0x9cb5('0x61')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2c8804[_0x9cb5('0x62')][_0x9cb5('0x56')]||_0x9cb5('0xfd'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x9cb5('0x22')](respondWithResult(_0x38ae9b,null))['catch'](handleError(_0x38ae9b,null));};exports['unpause']=function(_0x4b398c,_0x5685d2,_0x593aae){var _0x41ee1e;return db[_0x9cb5('0x44')][_0x9cb5('0x40')]({'where':{'id':_0x4b398c[_0x9cb5('0x5e')]['id']},'attributes':['id',_0x9cb5('0x41'),'role','voicePause',_0x9cb5('0xfe'),_0x9cb5('0xff'),_0x9cb5('0x100'),'openchannelPause','smsPause',_0x9cb5('0x101'),_0x9cb5('0x102'),_0x9cb5('0x103')]})[_0x9cb5('0x22')](handleEntityNotFound(_0x5685d2,null))['then'](function(_0x31845f){if(_0x31845f){_0x41ee1e=_0x31845f;if(_0x4b398c[_0x9cb5('0x62')][_0x9cb5('0xa7')]&&!utils[_0x9cb5('0xbb')](_0x4b398c[_0x9cb5('0x62')][_0x9cb5('0xa7')])){throw new db[(_0x9cb5('0x9b'))][(_0x9cb5('0x9c'))]('Unknown\x20channel');}switch(_0x4b398c[_0x9cb5('0x62')][_0x9cb5('0xa7')]){case _0x9cb5('0xb3'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0x41ee1e['id'],'name':_0x41ee1e['name'],'pause':![]})[_0x9cb5('0x22')](function(){return db[_0x9cb5('0xb9')][_0x9cb5('0x61')]({'paused':0x0},{'where':{'UserId':_0x41ee1e['id']},'individualHooks':!![]});})[_0x9cb5('0x22')](function(){return db['MemberReport']['find']({'where':{'channel':_0x4b398c[_0x9cb5('0x62')][_0x9cb5('0xa7')],'membername':_0x41ee1e[_0x9cb5('0x41')],'type':_0x9cb5('0xf5'),'exitAt':null}});})['then'](function(_0x57c282){if(_0x57c282){return _0x57c282[_0x9cb5('0x61')]({'exitAt':moment()[_0x9cb5('0xb6')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9cb5('0x104')},{'individualHooks':!![]});}return null;})[_0x9cb5('0x22')](function(){return _0x41ee1e['update']({'voicePause':![]});});case'mail':case _0x9cb5('0x105'):case _0x9cb5('0x106'):case _0x9cb5('0x107'):case'whatsapp':case _0x9cb5('0x108'):return db['MemberReport'][_0x9cb5('0x40')]({'where':{'channel':_0x4b398c[_0x9cb5('0x62')][_0x9cb5('0xa7')],'membername':_0x41ee1e[_0x9cb5('0x41')],'type':'PAUSE','exitAt':null}})[_0x9cb5('0x22')](function(_0x39c1e5){if(_0x39c1e5){return _0x39c1e5[_0x9cb5('0x61')]({'exitAt':moment()['format'](_0x9cb5('0xf2')),'data2':_0x9cb5('0x104')},{'individualHooks':!![]});}return null;})[_0x9cb5('0x22')](function(){var _0x2fe933={};_[_0x9cb5('0x33')](_0x2fe933,util['format']('%s%s',_0x4b398c[_0x9cb5('0x62')][_0x9cb5('0xa7')],_0x9cb5('0x109')),![]);return _0x41ee1e['update'](_0x2fe933);});default:return respondWithRpcPromise(_0x9cb5('0xfc'),_0x9cb5('0x10a'),{'id':_0x41ee1e['id'],'name':_0x41ee1e[_0x9cb5('0x41')],'pause':![]})[_0x9cb5('0x22')](function(){return db[_0x9cb5('0xb9')][_0x9cb5('0x61')]({'paused':0x0},{'where':{'UserId':_0x41ee1e['id']}});})[_0x9cb5('0x22')](function(){return db[_0x9cb5('0xf0')][_0x9cb5('0x94')]({'where':{'membername':_0x41ee1e[_0x9cb5('0x41')],'type':_0x9cb5('0xf5'),'exitAt':null}});})['then'](function(_0x494f0e){var _0x24ac7d=[];_0x494f0e[_0x9cb5('0xf1')](function(_0x1bd73f){_0x24ac7d[_0x9cb5('0xb4')](_0x1bd73f[_0x9cb5('0x61')]({'exitAt':moment()[_0x9cb5('0xb6')](_0x9cb5('0xf2')),'data2':_0x9cb5('0x104')}));});return BPromise[_0x9cb5('0x93')](_0x24ac7d);})[_0x9cb5('0x22')](function(){return _0x41ee1e[_0x9cb5('0x61')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9cb5('0x22')](respondWithResult(_0x5685d2,null))['catch'](handleError(_0x5685d2,null));};exports[_0x9cb5('0x10b')]=function(_0x143c7c,_0x11498e,_0x3cb895){var _0x2f39c8={};var _0x43383d={};var _0x1ab1d2;var _0xa82d0f;return db[_0x9cb5('0x44')]['findOne']({'where':{'id':_0x143c7c[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x11498e,null))[_0x9cb5('0x22')](function(_0x59280d){if(_0x59280d){_0x1ab1d2=_0x59280d;_0x43383d[_0x9cb5('0x46')]=_[_0x9cb5('0x4a')](db[_0x9cb5('0x10c')]['rawAttributes']);_0x43383d[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x143c7c[_0x9cb5('0x4c')]);_0x43383d[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x43383d['model'],_0x43383d[_0x9cb5('0x4c')]);_0x2f39c8[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x43383d[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x143c7c[_0x9cb5('0x4c')]['fields']));_0x2f39c8['attributes']=_0x2f39c8[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x2f39c8['attributes']:_0x43383d[_0x9cb5('0x46')];_0x2f39c8[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x143c7c[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x2f39c8['where']=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x143c7c[_0x9cb5('0x4c')],_0x43383d[_0x9cb5('0x4b')]));if(_0x143c7c[_0x9cb5('0x4c')]['filter']){_0x2f39c8[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x2f39c8['where'],{'$or':_[_0x9cb5('0x3d')](_0x2f39c8[_0x9cb5('0x4f')],function(_0x2a53d8){var _0x43f0e5={};_0x43f0e5[_0x2a53d8]={'$like':'%'+_0x143c7c['query'][_0x9cb5('0x3c')]+'%'};return _0x43f0e5;})});}_0x2f39c8=_[_0x9cb5('0x55')]({},_0x2f39c8,_0x143c7c[_0x9cb5('0x5a')]);return _0x1ab1d2[_0x9cb5('0x10b')](_0x2f39c8);}})[_0x9cb5('0x22')](function(_0x211922){if(_0x211922){_0xa82d0f=_0x211922['length'];if(!_0x143c7c[_0x9cb5('0x4c')][_0x9cb5('0x51')](_0x9cb5('0xd1'))){_0x2f39c8[_0x9cb5('0x32')]=qs[_0x9cb5('0x32')](_0x143c7c[_0x9cb5('0x4c')][_0x9cb5('0x32')]);_0x2f39c8['offset']=qs['offset'](_0x143c7c[_0x9cb5('0x4c')]['offset']);}return _0x1ab1d2[_0x9cb5('0x10b')](_0x2f39c8);}})[_0x9cb5('0x22')](function(_0xc229f2){if(_0xc229f2){return _0xc229f2?{'count':_0xa82d0f,'rows':_0xc229f2}:null;}})[_0x9cb5('0x22')](respondWithResult(_0x11498e,null))[_0x9cb5('0x2c')](handleError(_0x11498e,null));};exports['addTeams']=function(_0x1ec494,_0x402012){return db[_0x9cb5('0x44')][_0x9cb5('0x40')]({'where':{'id':_0x1ec494[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x402012,null))[_0x9cb5('0x22')](function(_0x338f51){if(_0x338f51){var _0x5919de=_0x338f51['get']({'plain':!![]});return _0x338f51['addTeams'](_0x1ec494[_0x9cb5('0x62')]['ids'],_['omit'](_0x1ec494[_0x9cb5('0x62')],[_0x9cb5('0x65'),'id'])||{})[_0x9cb5('0x22')](function(){for(var _0x1248f5=0x0;_0x1248f5<_0x1ec494[_0x9cb5('0x62')][_0x9cb5('0x65')][_0x9cb5('0x50')];_0x1248f5++){var _0x558514=[];db[_0x9cb5('0x10c')]['findOne']({'where':{'id':_0x1ec494[_0x9cb5('0x62')]['ids'][_0x1248f5]}})['then'](function(_0x542d65){_0x558514['push'](_0x542d65['getVoiceQueues']()['then'](function(_0x2328d2){for(var _0x4ade14=0x0;_0x4ade14<_0x2328d2[_0x9cb5('0x50')];_0x4ade14++){_0x2328d2[_0x4ade14]['setDataValue'](_0x9cb5('0xa7'),'Voice');}return _0x2328d2;}));_0x558514[_0x9cb5('0xb4')](_0x542d65[_0x9cb5('0x10d')]()[_0x9cb5('0x22')](function(_0x543aa7){for(var _0x40da0e=0x0;_0x40da0e<_0x543aa7[_0x9cb5('0x50')];_0x40da0e++){_0x543aa7[_0x40da0e][_0x9cb5('0x10e')](_0x9cb5('0xa7'),_0x9cb5('0x10f'));}return _0x543aa7;}));_0x558514[_0x9cb5('0xb4')](_0x542d65['getMailQueues']()['then'](function(_0xec0a9){for(var _0x3fb968=0x0;_0x3fb968<_0xec0a9[_0x9cb5('0x50')];_0x3fb968++){_0xec0a9[_0x3fb968]['setDataValue'](_0x9cb5('0xa7'),'Mail');}return _0xec0a9;}));_0x558514['push'](_0x542d65[_0x9cb5('0x110')]()['then'](function(_0xabd842){for(var _0x263491=0x0;_0x263491<_0xabd842[_0x9cb5('0x50')];_0x263491++){_0xabd842[_0x263491][_0x9cb5('0x10e')](_0x9cb5('0xa7'),_0x9cb5('0x111'));}return _0xabd842;}));_0x558514[_0x9cb5('0xb4')](_0x542d65['getWhatsappQueues']()['then'](function(_0x789b8a){for(var _0x51a235=0x0;_0x51a235<_0x789b8a[_0x9cb5('0x50')];_0x51a235++){_0x789b8a[_0x51a235]['setDataValue']('channel','Whatsapp');}return _0x789b8a;}));_0x558514['push'](_0x542d65['getFaxQueues']()[_0x9cb5('0x22')](function(_0x1ed8e0){for(var _0x4f945e=0x0;_0x4f945e<_0x1ed8e0[_0x9cb5('0x50')];_0x4f945e++){_0x1ed8e0[_0x4f945e][_0x9cb5('0x10e')]('channel',_0x9cb5('0x112'));}return _0x1ed8e0;}));_0x558514[_0x9cb5('0xb4')](_0x542d65[_0x9cb5('0x113')]()[_0x9cb5('0x22')](function(_0x143a85){for(var _0x1a4624=0x0;_0x1a4624<_0x143a85[_0x9cb5('0x50')];_0x1a4624++){_0x143a85[_0x1a4624]['setDataValue'](_0x9cb5('0xa7'),_0x9cb5('0x114'));}return _0x143a85;}));return BPromise[_0x9cb5('0x93')](_0x558514);})['then'](function(_0x53372c){var _0x59157c=_[_0x9cb5('0x115')](_0x53372c);_0x558514=[];return db[_0x9cb5('0x58')][_0x9cb5('0x116')](function(_0x3efd40){for(var _0x2327b3=0x0;_0x2327b3<_0x59157c[_0x9cb5('0x50')];_0x2327b3++){_0x558514[_0x9cb5('0xb4')](_0x59157c[_0x2327b3][_0x9cb5('0x117')](_0x5919de['id']),{'transaction':_0x3efd40});}return BPromise[_0x9cb5('0x93')](_0x558514)[_0x9cb5('0x22')](function(){if(_0x5919de[_0x9cb5('0xa8')]){return BPromise['each'](_[_0x9cb5('0x3c')](_0x59157c,function(_0x26b6d1){return _0x26b6d1[_0x9cb5('0x118')](_0x9cb5('0xa7'))===_0x9cb5('0x119');}),function(_0x44c77d){return db[_0x9cb5('0xb9')][_0x9cb5('0xba')]({'membername':_0x5919de[_0x9cb5('0x41')],'UserId':_0x5919de['id'],'queue_name':_0x44c77d[_0x9cb5('0x41')],'VoiceQueueId':_0x44c77d['id'],'interface':_[_0x9cb5('0x6d')](_0x5919de[_0x9cb5('0xb5')])?util['format'](_0x9cb5('0xb7'),_0x5919de[_0x9cb5('0x41')]):_0x5919de[_0x9cb5('0xb5')],'paused':_0x5919de['voicePause']||![],'penalty':_0x5919de[_0x9cb5('0xb8')]},{'transaction':_0x3efd40});});}else{return;}})[_0x9cb5('0x22')](function(){for(var _0xb904d6=0x0;_0xb904d6<_0x59157c['length'];_0xb904d6++){var _0x412037=_0x59157c[_0xb904d6][_0x9cb5('0x118')](_0x9cb5('0xa7'));var _0x33b7d0=_0x412037+'QueueId';socket[_0x9cb5('0xbc')]('user'+_0x412037+_0x9cb5('0xb1'),{'UserId':_0x5919de['id'],['queueField']:_0x59157c[_0xb904d6]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x402012,null))[_0x9cb5('0x2c')](handleError(_0x402012,null));};exports[_0x9cb5('0x11a')]=function(_0xcbbf34,_0x324103){return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0xcbbf34[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x324103,null))[_0x9cb5('0x22')](function(_0x27d3c2){if(_0x27d3c2){var _0xaf17de=_0x27d3c2[_0x9cb5('0x36')]({'plain':!![]});var _0x17e04b=_0xcbbf34[_0x9cb5('0x4c')]['ids'];return _0x27d3c2[_0x9cb5('0x11a')](_0x17e04b)[_0x9cb5('0x22')](function(){for(var _0x20f5b6=0x0;_0x20f5b6<_0x17e04b['length'];_0x20f5b6++){var _0x2dbcaa=[];db[_0x9cb5('0x10c')][_0x9cb5('0xa2')]({'where':{'id':_0x17e04b[_0x20f5b6]}})['then'](function(_0x4a5e20){_0x2dbcaa[_0x9cb5('0xb4')](_0x4a5e20[_0x9cb5('0xed')]()[_0x9cb5('0x22')](function(_0x4026e2){for(var _0x53683a=0x0;_0x53683a<_0x4026e2[_0x9cb5('0x50')];_0x53683a++){_0x4026e2[_0x53683a][_0x9cb5('0x10e')](_0x9cb5('0xa7'),_0x9cb5('0x119'));}return _0x4026e2;}));_0x2dbcaa[_0x9cb5('0xb4')](_0x4a5e20[_0x9cb5('0x10d')]()['then'](function(_0x19fa82){for(var _0x29146b=0x0;_0x29146b<_0x19fa82['length'];_0x29146b++){_0x19fa82[_0x29146b][_0x9cb5('0x10e')](_0x9cb5('0xa7'),_0x9cb5('0x10f'));}return _0x19fa82;}));_0x2dbcaa['push'](_0x4a5e20[_0x9cb5('0x11b')]()[_0x9cb5('0x22')](function(_0x38c65a){for(var _0x50bb54=0x0;_0x50bb54<_0x38c65a[_0x9cb5('0x50')];_0x50bb54++){_0x38c65a[_0x50bb54]['setDataValue'](_0x9cb5('0xa7'),_0x9cb5('0x11c'));}return _0x38c65a;}));_0x2dbcaa['push'](_0x4a5e20[_0x9cb5('0x110')]()[_0x9cb5('0x22')](function(_0x5accd2){for(var _0x2d5a15=0x0;_0x2d5a15<_0x5accd2[_0x9cb5('0x50')];_0x2d5a15++){_0x5accd2[_0x2d5a15][_0x9cb5('0x10e')](_0x9cb5('0xa7'),_0x9cb5('0x111'));}return _0x5accd2;}));_0x2dbcaa['push'](_0x4a5e20[_0x9cb5('0x11d')]()[_0x9cb5('0x22')](function(_0xf341cd){for(var _0x2fb8b4=0x0;_0x2fb8b4<_0xf341cd['length'];_0x2fb8b4++){_0xf341cd[_0x2fb8b4]['setDataValue']('channel','Whatsapp');}return _0xf341cd;}));_0x2dbcaa[_0x9cb5('0xb4')](_0x4a5e20['getFaxQueues']()['then'](function(_0x18a99f){for(var _0x3afce8=0x0;_0x3afce8<_0x18a99f[_0x9cb5('0x50')];_0x3afce8++){_0x18a99f[_0x3afce8][_0x9cb5('0x10e')](_0x9cb5('0xa7'),_0x9cb5('0x112'));}return _0x18a99f;}));_0x2dbcaa[_0x9cb5('0xb4')](_0x4a5e20[_0x9cb5('0x113')]()['then'](function(_0x11e54b){for(var _0x4e7345=0x0;_0x4e7345<_0x11e54b['length'];_0x4e7345++){_0x11e54b[_0x4e7345]['setDataValue'](_0x9cb5('0xa7'),_0x9cb5('0x114'));}return _0x11e54b;}));return BPromise[_0x9cb5('0x93')](_0x2dbcaa);})[_0x9cb5('0x22')](function(_0x2fe20f){var _0x54e80a=_[_0x9cb5('0x115')](_0x2fe20f);_0x2dbcaa=[];return db[_0x9cb5('0x58')][_0x9cb5('0x116')](function(_0x57af44){for(var _0x53b513=0x0;_0x53b513<_0x54e80a[_0x9cb5('0x50')];_0x53b513++){_0x2dbcaa[_0x9cb5('0xb4')](_0x54e80a[_0x53b513][_0x9cb5('0x11e')](_0xaf17de['id']),{'transaction':_0x57af44});}return BPromise[_0x9cb5('0x93')](_0x2dbcaa)['then'](function(){if(_0xaf17de[_0x9cb5('0xa8')]){return BPromise[_0x9cb5('0xef')](_['filter'](_0x54e80a,function(_0x4c27d6){return _0x4c27d6[_0x9cb5('0x118')](_0x9cb5('0xa7'))===_0x9cb5('0x119');}),function(_0x3d975e){return db[_0x9cb5('0xb9')]['destroy']({'where':{'VoiceQueueId':_0x3d975e['id'],'UserId':_0xaf17de['id']},'transaction':_0x57af44});});}else{return;}})[_0x9cb5('0x22')](function(){for(var _0x247c82=0x0;_0x247c82<_0x54e80a[_0x9cb5('0x50')];_0x247c82++){var _0x503738=_0x54e80a[_0x247c82][_0x9cb5('0x118')](_0x9cb5('0xa7'));var _0x56a4e9=_0x503738+_0x9cb5('0xb0');socket[_0x9cb5('0xbc')]('user'+_0x503738+_0x9cb5('0xbd'),{'UserId':_0xaf17de['id'],['queueField']:_0x54e80a[_0x247c82]['id']});}});});});}});}})[_0x9cb5('0x22')](respondWithStatusCode(_0x324103,null))[_0x9cb5('0x2c')](handleError(_0x324103,null));};exports['getLists']=function(_0xa48d7f,_0x58243f,_0x291881){var _0x45fdb7={};var _0x434252={};var _0x5643ee;var _0x298760;return db[_0x9cb5('0x44')][_0x9cb5('0xa2')]({'where':{'id':_0xa48d7f[_0x9cb5('0x5e')]['id']}})[_0x9cb5('0x22')](handleEntityNotFound(_0x58243f,null))[_0x9cb5('0x22')](function(_0x26505e){if(_0x26505e){_0x5643ee=_0x26505e;_0x434252[_0x9cb5('0x46')]=_[_0x9cb5('0x4a')](db[_0x9cb5('0xc9')][_0x9cb5('0x5f')]);_0x434252[_0x9cb5('0x4c')]=_['keys'](_0xa48d7f['query']);_0x434252['filters']=_['intersection'](_0x434252[_0x9cb5('0x46')],_0x434252['query']);_0x45fdb7[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x434252[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0xa48d7f[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x45fdb7[_0x9cb5('0x4f')]=_0x45fdb7[_0x9cb5('0x4f')][_0x9cb5('0x50')]?_0x45fdb7['attributes']:_0x434252[_0x9cb5('0x46')];_0x45fdb7[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0xa48d7f['query'][_0x9cb5('0x52')]);_0x45fdb7[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_['pick'](_0xa48d7f[_0x9cb5('0x4c')],_0x434252['filters']));if(_0xa48d7f[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x45fdb7[_0x9cb5('0x53')]=_[_0x9cb5('0x55')](_0x45fdb7[_0x9cb5('0x53')],{'$or':_[_0x9cb5('0x3d')](_0x45fdb7[_0x9cb5('0x4f')],function(_0x17cc15){var _0x20f51d={};_0x20f51d[_0x17cc15]={'$like':'%'+_0xa48d7f[_0x9cb5('0x4c')][_0x9cb5('0x3c')]+'%'};return _0x20f51d;})});}_0x45fdb7=_['merge']({},_0x45fdb7,_0xa48d7f['options']);return _0x5643ee['getLists'](_0x45fdb7);}})[_0x9cb5('0x22')](function(_0x3b9484){if(_0x3b9484){_0x298760=_0x3b9484[_0x9cb5('0x50')];if(!_0xa48d7f[_0x9cb5('0x4c')]['hasOwnProperty'](_0x9cb5('0xd1'))){_0x45fdb7[_0x9cb5('0x32')]=qs['limit'](_0xa48d7f[_0x9cb5('0x4c')]['limit']);_0x45fdb7[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0xa48d7f[_0x9cb5('0x4c')]['offset']);}return _0x5643ee[_0x9cb5('0x11f')](_0x45fdb7);}})['then'](function(_0x1dd0fd){if(_0x1dd0fd){return _0x1dd0fd?{'count':_0x298760,'rows':_0x1dd0fd}:null;}})[_0x9cb5('0x22')](respondWithResult(_0x58243f,null))[_0x9cb5('0x2c')](handleError(_0x58243f,null));};exports[_0x9cb5('0x120')]=function(_0x4ce5a9,_0x6db190,_0x3b56e6){var _0x1560bc={};var _0x50f5f0={};var _0x3da669;var _0x59417f;return db['User'][_0x9cb5('0xa2')]({'where':{'id':_0x4ce5a9['params']['id']}})['then'](handleEntityNotFound(_0x6db190,null))[_0x9cb5('0x22')](function(_0x28ca2d){if(_0x28ca2d){_0x3da669=_0x28ca2d;_0x50f5f0[_0x9cb5('0x46')]=_['keys'](db['User']['rawAttributes']);_0x50f5f0[_0x9cb5('0x4c')]=_[_0x9cb5('0x4a')](_0x4ce5a9[_0x9cb5('0x4c')]);_0x50f5f0[_0x9cb5('0x4b')]=_[_0x9cb5('0x4d')](_0x50f5f0['model'],_0x50f5f0['query']);_0x1560bc[_0x9cb5('0x4f')]=_[_0x9cb5('0x4d')](_0x50f5f0[_0x9cb5('0x46')],qs[_0x9cb5('0x4e')](_0x4ce5a9[_0x9cb5('0x4c')][_0x9cb5('0x4e')]));_0x1560bc[_0x9cb5('0x4f')]=_0x1560bc[_0x9cb5('0x4f')]['length']?_0x1560bc[_0x9cb5('0x4f')]:_0x50f5f0[_0x9cb5('0x46')];_0x1560bc[_0x9cb5('0xcf')]=qs[_0x9cb5('0x52')](_0x4ce5a9[_0x9cb5('0x4c')][_0x9cb5('0x52')]);_0x1560bc[_0x9cb5('0x53')]=qs[_0x9cb5('0x4b')](_[_0x9cb5('0x54')](_0x4ce5a9[_0x9cb5('0x4c')],_0x50f5f0[_0x9cb5('0x4b')]));if(_0x4ce5a9[_0x9cb5('0x4c')][_0x9cb5('0x3c')]){_0x1560bc[_0x9cb5('0x53')]=_['merge'](_0x1560bc[_0x9cb5('0x53')],{'$or':_['map'](_0x1560bc['attributes'],function(_0xaed720){var _0x39fd08={};_0x39fd08[_0xaed720]={'$like':'%'+_0x4ce5a9[_0x9cb5('0x4c')]['filter']+'%'};return _0x39fd08;})});}_0x1560bc[_0x9cb5('0x46')]=db[_0x9cb5('0x44')];_0x1560bc['as']=_0x9cb5('0x39');_0x1560bc=_[_0x9cb5('0x55')]({},_0x1560bc,_0x4ce5a9[_0x9cb5('0x5a')]);return _0x3da669[_0x9cb5('0xed')]({'include':[_0x1560bc]});}})[_0x9cb5('0x22')](function(_0x349ea6){if(_0x349ea6){var _0x25d198={},_0x22ba01=[],_0xb3fc59=0x0;for(var _0x46745c=0x0;_0x46745c<_0x349ea6[_0x9cb5('0x50')];_0x46745c+=0x1){for(var _0x1082c3=0x0,_0x36f854;_0x1082c3<_0x349ea6[_0x46745c][_0x9cb5('0x39')][_0x9cb5('0x50')];_0x1082c3+=0x1){_0x36f854=_0x349ea6[_0x46745c][_0x9cb5('0x39')][_0x1082c3][_0x9cb5('0x36')]({'plain':!![]});_0x25d198[_0x36f854['id']]=_0x36f854;}}_0x25d198=_[_0x9cb5('0x121')](_0x25d198);for(var _0xa9a3fc=qs['offset'](_0x4ce5a9[_0x9cb5('0x4c')][_0x9cb5('0x31')]);_0xa9a3fc<_0x25d198[_0x9cb5('0x50')]&&_0x22ba01[_0x9cb5('0x50')]=_0x7321ab['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x56a9('0x11')](function(){if(_0x25b6b6){return db[_0x56a9('0x2f')][_0x56a9('0x54')]({'where':{'membername':_0x25b6b6[_0x56a9('0x2b')]},'individualHooks':!![]});}})[_0x56a9('0x11')](function(){if(_0x25b6b6){return _0x25b6b6[_0x56a9('0x55')]({'raw':!![]});}})[_0x56a9('0x11')](function(_0x30874d){if(_0x25b6b6){if(_0x30874d){var _0x4ce390=[];_0x1eeae3=_0x30874d;if(_0x1eeae3['length']){for(var _0x57f598=0x0;_0x57f598<_0x1eeae3[_0x56a9('0x4b')];_0x57f598++){_0x4ce390['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x25b6b6['name'],'UserId':_0x25b6b6['id'],'queue_name':_0x1eeae3[_0x57f598][_0x56a9('0x2b')],'VoiceQueueId':_0x1eeae3[_0x57f598]['id'],'interface':_0x2efe37,'paused':_0x25b6b6[_0x56a9('0x4f')]||![],'penalty':_0x1eeae3[_0x57f598][_0x56a9('0x56')]||0x0}));}return BPromise[_0x56a9('0x57')](_0x4ce390);}}}})['then'](function(){if(_0x25b6b6){return db[_0x56a9('0x30')][_0x56a9('0x1d')]({'where':{'membername':_0x25b6b6[_0x56a9('0x2b')],'exitAt':null}});}})[_0x56a9('0x11')](function(_0x174cb8){if(_0x25b6b6){if(_0x174cb8&&_0x174cb8[_0x56a9('0x4b')]){var _0x16dd48=[];_0x174cb8[_0x56a9('0x35')](function(_0x3b6fe7){_0x16dd48[_0x56a9('0x36')](_0x3b6fe7[_0x56a9('0x3d')]({'exitAt':moment()[_0x56a9('0x32')](_0x56a9('0x33'))}));});return BPromise['all'](_0x16dd48);}}})['then'](function(_0x4c2f80){if(_0x25b6b6){var _0x54e04a=[];var _0x135b37=[];var _0x3f1da4=utils['getChannels']();var _0x447177={'membername':_0x25b6b6[_0x56a9('0x2b')],'interface':_0x2efe37,'enterAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'role':_0x25b6b6[_0x56a9('0x2c')],'internal':_0x25b6b6[_0x56a9('0x2d')]};_0x3f1da4['forEach'](function(_0x8a5775){_0x54e04a['push'](_[_0x56a9('0x58')]({'channel':_0x8a5775,'type':_0x56a9('0x59'),'data1':_0x56a9('0x5a'),'data2':_0x2efe37},_0x447177));if(_0x25b6b6['loginInPause']){_0x135b37[_0x56a9('0x36')](_[_0x56a9('0x58')]({'channel':_0x8a5775,'type':_0x56a9('0x31'),'data1':_0x56a9('0x5b')},_0x447177));}});return db[_0x56a9('0x30')][_0x56a9('0x3c')](_0x54e04a['concat'](_0x135b37),{'individualHooks':!![]});}})[_0x56a9('0x11')](function(){if(_0x25b6b6){return _0x25b6b6[_0x56a9('0x3d')]({'online':!![],'lastLoginAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'voicePause':_0x25b6b6[_0x56a9('0x4f')]||![],'mailPause':_0x25b6b6['loginInPause']||![],'chatPause':_0x25b6b6[_0x56a9('0x4f')]||![],'faxPause':_0x25b6b6[_0x56a9('0x4f')]||![],'smsPause':_0x25b6b6[_0x56a9('0x4f')]||![],'openchannelPause':_0x25b6b6[_0x56a9('0x4f')]||![],'pauseType':_0x25b6b6[_0x56a9('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'interface':_0x2efe37});}})['then'](function(_0x6d9a59){_0x26315b(_0x6d9a59);})[_0x56a9('0x1b')](function(_0x38f65d){_0x398a63(_0x58108a['error'](0x1f4,_0x38f65d[_0x56a9('0x19')]));});});}; \ No newline at end of file +var _0xa413=['mail','chat','fax','sms','openchannel','whatsapp','Pause','findAll','all','LogoutUser','findOne','destroy','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','attributes','limit','include','model','map','info','GetUser','stringify','User','find','ShowUser','PauseUser','where','name','role','internal','interface','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','PAUSE','body','type','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','channel','isValidChannel','voice','UserVoiceQueueRt','update','system'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0xa413,0x1e5));var _0x3a41=function(_0x1b3cfc,_0xf68ca1){_0x1b3cfc=_0x1b3cfc-0x0;var _0x7d7fe4=_0xa413[_0x1b3cfc];return _0x7d7fe4;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var moment=require(_0x3a41('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a41('0x2'));var fs=require('fs');var Redis=require(_0x3a41('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a41('0x4'))(_0x3a41('0x5'));var config=require(_0x3a41('0x6'));var jayson=require(_0x3a41('0x7'));var client=jayson[_0x3a41('0x8')][_0x3a41('0x9')]({'port':0x232a});config[_0x3a41('0xa')]=_[_0x3a41('0xb')](config[_0x3a41('0xa')],{'host':_0x3a41('0xc'),'port':0x18eb});var socket=require(_0x3a41('0xd'))(new Redis(config['redis']));require(_0x3a41('0xe'))['register'](socket);function respondWithRpcPromise(_0x562882,_0x55371e,_0x3d1037){return new BPromise(function(_0x57ef75,_0x1554ab){return client['request'](_0x562882,_0x3d1037)[_0x3a41('0xf')](function(_0xccd84e){logger['info'](_0x3a41('0x10'),_0x55371e,_0x3a41('0x11'));logger[_0x3a41('0x12')](_0x3a41('0x13'),_0x55371e,_0x3a41('0x11'),JSON['stringify'](_0xccd84e));if(_0xccd84e[_0x3a41('0x14')]){if(_0xccd84e[_0x3a41('0x14')][_0x3a41('0x15')]===0x1f4){logger[_0x3a41('0x14')](_0x3a41('0x10'),_0x55371e,_0xccd84e[_0x3a41('0x14')][_0x3a41('0x16')]);return _0x1554ab(_0xccd84e[_0x3a41('0x14')][_0x3a41('0x16')]);}logger[_0x3a41('0x14')](_0x3a41('0x10'),_0x55371e,_0xccd84e['error'][_0x3a41('0x16')]);return _0x57ef75(_0xccd84e[_0x3a41('0x14')]['message']);}else{logger['info'](_0x3a41('0x10'),_0x55371e,_0x3a41('0x11'));_0x57ef75(_0xccd84e[_0x3a41('0x17')][_0x3a41('0x16')]);}})[_0x3a41('0x18')](function(_0x38c802){logger[_0x3a41('0x14')](_0x3a41('0x10'),_0x55371e,_0x38c802);_0x1554ab(_0x38c802);});});}exports['GetUser']=function(_0x5c2652){var _0x2fa25b=this;return new Promise(function(_0x37a5bb,_0x4cd443){return db['User']['findAll']({'raw':_0x5c2652[_0x3a41('0x19')]?_0x5c2652[_0x3a41('0x19')][_0x3a41('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c2652[_0x3a41('0x19')]?_0x5c2652['options']['where']||null:null,'attributes':_0x5c2652[_0x3a41('0x19')]?_0x5c2652[_0x3a41('0x19')][_0x3a41('0x1b')]||null:null,'limit':_0x5c2652[_0x3a41('0x19')]?_0x5c2652[_0x3a41('0x19')][_0x3a41('0x1c')]||null:null,'include':_0x5c2652['options']?_0x5c2652[_0x3a41('0x19')][_0x3a41('0x1d')]?_['map'](_0x5c2652[_0x3a41('0x19')][_0x3a41('0x1d')],function(_0x4240a8){return{'model':db[_0x4240a8[_0x3a41('0x1e')]],'as':_0x4240a8['as'],'attributes':_0x4240a8[_0x3a41('0x1b')],'include':_0x4240a8['include']?_[_0x3a41('0x1f')](_0x4240a8[_0x3a41('0x1d')],function(_0x56e559){return{'model':db[_0x56e559[_0x3a41('0x1e')]],'as':_0x56e559['as'],'attributes':_0x56e559['attributes'],'include':_0x56e559[_0x3a41('0x1d')]?_['map'](_0x56e559[_0x3a41('0x1d')],function(_0x5be3cd){return{'model':db[_0x5be3cd[_0x3a41('0x1e')]],'as':_0x5be3cd['as'],'attributes':_0x5be3cd[_0x3a41('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3a41('0xf')](function(_0x2209d1){logger[_0x3a41('0x20')](_0x3a41('0x21'),_0x5c2652);logger[_0x3a41('0x12')](_0x3a41('0x21'),_0x5c2652,JSON[_0x3a41('0x22')](_0x2209d1));_0x37a5bb(_0x2209d1);})[_0x3a41('0x18')](function(_0x12b166){logger[_0x3a41('0x14')](_0x3a41('0x21'),_0x12b166[_0x3a41('0x16')],_0x5c2652);_0x4cd443(_0x2fa25b['error'](0x1f4,_0x12b166['message']));});});};exports['ShowUser']=function(_0x4e2d4c){var _0x22d0be=this;return new Promise(function(_0x2b9a5e,_0x34c4ce){return db[_0x3a41('0x23')][_0x3a41('0x24')]({'raw':_0x4e2d4c['options']?_0x4e2d4c['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e2d4c[_0x3a41('0x19')]?_0x4e2d4c[_0x3a41('0x19')]['where']||null:null,'attributes':_0x4e2d4c[_0x3a41('0x19')]?_0x4e2d4c[_0x3a41('0x19')][_0x3a41('0x1b')]||null:null,'include':_0x4e2d4c[_0x3a41('0x19')]?_0x4e2d4c[_0x3a41('0x19')][_0x3a41('0x1d')]?_[_0x3a41('0x1f')](_0x4e2d4c[_0x3a41('0x19')][_0x3a41('0x1d')],function(_0x136f36){return{'model':db[_0x136f36[_0x3a41('0x1e')]],'as':_0x136f36['as'],'attributes':_0x136f36[_0x3a41('0x1b')],'include':_0x136f36[_0x3a41('0x1d')]?_[_0x3a41('0x1f')](_0x136f36[_0x3a41('0x1d')],function(_0x4b2a4d){return{'model':db[_0x4b2a4d['model']],'as':_0x4b2a4d['as'],'attributes':_0x4b2a4d[_0x3a41('0x1b')],'include':_0x4b2a4d[_0x3a41('0x1d')]?_['map'](_0x4b2a4d[_0x3a41('0x1d')],function(_0x5e1fc4){return{'model':db[_0x5e1fc4['model']],'as':_0x5e1fc4['as'],'attributes':_0x5e1fc4['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a41('0xf')](function(_0x3c7835){logger['info'](_0x3a41('0x25'),_0x4e2d4c);logger[_0x3a41('0x12')]('ShowUser',_0x4e2d4c,JSON[_0x3a41('0x22')](_0x3c7835));_0x2b9a5e(_0x3c7835);})[_0x3a41('0x18')](function(_0x488d5a){logger[_0x3a41('0x14')]('ShowUser',_0x488d5a['message'],_0x4e2d4c);_0x34c4ce(_0x22d0be['error'](0x1f4,_0x488d5a[_0x3a41('0x16')]));});});};exports[_0x3a41('0x26')]=function(_0x58ce30){var _0x331f51=this;return new Promise(function(_0x1cff1c,_0xbfaa0e){var _0x149b11;return db[_0x3a41('0x23')][_0x3a41('0x24')]({'where':_0x58ce30[_0x3a41('0x19')][_0x3a41('0x27')]||{},'attributes':['id',_0x3a41('0x28'),_0x3a41('0x29'),_0x3a41('0x2a'),_0x3a41('0x2b')]})[_0x3a41('0xf')](function(_0x5cd892){if(_0x5cd892){_0x149b11=_0x5cd892;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x149b11['id']},'individualHooks':!![]});}})[_0x3a41('0xf')](function(){if(_0x149b11){return db[_0x3a41('0x2c')]['findAll']({'where':{'membername':_0x149b11[_0x3a41('0x28')],'type':'PAUSE','exitAt':null}});}})[_0x3a41('0xf')](function(_0x38e85e){if(_0x149b11){if(_0x38e85e&&_0x38e85e[_0x3a41('0x2d')]){var _0x49b0bb=moment()[_0x3a41('0x2e')](_0x3a41('0x2f'));for(var _0x382dfd=0x0,_0x48c94c=_0x38e85e[_0x3a41('0x2d')];_0x382dfd<_0x48c94c;_0x382dfd++){_0x38e85e[_0x382dfd][_0x3a41('0x30')]({'exitAt':_0x49b0bb});}}}})[_0x3a41('0xf')](function(){if(_0x149b11){var _0x3504cd=[];var _0x407c13=utils[_0x3a41('0x31')]();_0x407c13[_0x3a41('0x32')](function(_0x4be952){_0x3504cd[_0x3a41('0x33')]({'channel':_0x4be952,'membername':_0x149b11[_0x3a41('0x28')],'interface':_[_0x3a41('0x34')](_0x149b11[_0x3a41('0x2b')])?util['format'](_0x3a41('0x35'),_0x149b11[_0x3a41('0x28')]):_0x149b11['interface'],'type':_0x3a41('0x36'),'enterAt':moment()[_0x3a41('0x2e')](_0x3a41('0x2f')),'data1':_0x58ce30[_0x3a41('0x37')][_0x3a41('0x38')]||'DEFAULT\x20PAUSE','role':_0x149b11[_0x3a41('0x29')],'internal':_0x149b11['internal'],'uniqueid':_0x58ce30['body'][_0x3a41('0x39')]||null});});return db[_0x3a41('0x2c')][_0x3a41('0x3a')](_0x3504cd,{'individualHooks':!![]});}})[_0x3a41('0xf')](function(){if(_0x149b11){return _0x149b11['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x58ce30['body']['type']||_0x3a41('0x3b'),'lastPauseAt':moment()[_0x3a41('0x2e')](_0x3a41('0x2f'))});}})[_0x3a41('0xf')](function(_0xef91ac){_0x1cff1c(_0xef91ac);})[_0x3a41('0x18')](function(_0x349c26){_0xbfaa0e(_0x331f51[_0x3a41('0x14')](0x1f4,_0x349c26[_0x3a41('0x16')]));});});};exports[_0x3a41('0x3c')]=function(_0x14d70b){var _0x13da9a=this;return new Promise(function(_0x2ef003,_0x19aa48){var _0x5417e8;return db[_0x3a41('0x23')]['findOne']({'where':_0x14d70b[_0x3a41('0x19')]['where']||{},'attributes':['id',_0x3a41('0x28')]})['then'](function(_0x42de23){if(_0x42de23){_0x5417e8=_0x42de23;if(_0x14d70b[_0x3a41('0x37')][_0x3a41('0x3d')]&&!utils[_0x3a41('0x3e')](_0x14d70b['body'][_0x3a41('0x3d')])){throw new Error('Unknown\x20channel');}switch(_0x14d70b[_0x3a41('0x37')][_0x3a41('0x3d')]){case _0x3a41('0x3f'):return db[_0x3a41('0x40')][_0x3a41('0x41')]({'paused':0x0},{'where':{'UserId':_0x5417e8['id']}})[_0x3a41('0xf')](function(){return db[_0x3a41('0x2c')][_0x3a41('0x24')]({'where':{'channel':_0x14d70b[_0x3a41('0x37')]['channel'],'membername':_0x5417e8[_0x3a41('0x28')],'type':'PAUSE','exitAt':null}});})[_0x3a41('0xf')](function(_0x438498){if(_0x438498){return _0x438498[_0x3a41('0x41')]({'exitAt':moment()['format'](_0x3a41('0x2f')),'data2':_0x3a41('0x42')},{'individualHooks':!![]});}return null;})[_0x3a41('0xf')](function(){return _0x5417e8['update']({'voicePause':![]});});case _0x3a41('0x43'):case _0x3a41('0x44'):case _0x3a41('0x45'):case _0x3a41('0x46'):case _0x3a41('0x47'):case _0x3a41('0x48'):return db[_0x3a41('0x2c')][_0x3a41('0x24')]({'where':{'channel':_0x14d70b[_0x3a41('0x37')][_0x3a41('0x3d')],'membername':_0x5417e8['name'],'type':_0x3a41('0x36'),'exitAt':null}})[_0x3a41('0xf')](function(_0x462294){return _0x462294[_0x3a41('0x41')]({'exitAt':moment()[_0x3a41('0x2e')](_0x3a41('0x2f')),'data2':_0x3a41('0x42')},{'individualHooks':!![]});})[_0x3a41('0xf')](function(){var _0x46cf43={};_['set'](_0x46cf43,util[_0x3a41('0x2e')]('%s%s',_0x14d70b[_0x3a41('0x37')]['channel'],_0x3a41('0x49')),![]);return _0x5417e8[_0x3a41('0x41')](_0x46cf43);});default:return db[_0x3a41('0x40')][_0x3a41('0x41')]({'paused':0x0},{'where':{'UserId':_0x5417e8['id']}})[_0x3a41('0xf')](function(){return db[_0x3a41('0x2c')][_0x3a41('0x4a')]({'where':{'membername':_0x5417e8[_0x3a41('0x28')],'type':_0x3a41('0x36'),'exitAt':null}});})[_0x3a41('0xf')](function(_0x500f23){var _0x3c4371=[];_0x500f23[_0x3a41('0x32')](function(_0x4dca66){_0x3c4371[_0x3a41('0x33')](_0x4dca66[_0x3a41('0x41')]({'exitAt':moment()[_0x3a41('0x2e')](_0x3a41('0x2f')),'data2':_0x3a41('0x42')}));});return BPromise[_0x3a41('0x4b')](_0x3c4371);})['then'](function(){return _0x5417e8[_0x3a41('0x41')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x3a41('0xf')](function(_0x178c27){_0x2ef003(_0x178c27);})[_0x3a41('0x18')](function(_0x473ac3){_0x19aa48(_0x13da9a[_0x3a41('0x14')](0x1f4,_0x473ac3[_0x3a41('0x16')]));});});};exports[_0x3a41('0x4c')]=function(_0x5c095a){var _0x5ea081=this;return new Promise(function(_0xe736b3,_0xbe0c96){var _0x488b53;return db['User'][_0x3a41('0x4d')]({'where':_0x5c095a[_0x3a41('0x19')][_0x3a41('0x27')]||{},'attributes':['id',_0x3a41('0x28')]})['then'](function(_0x48ed40){if(_0x48ed40){_0x488b53=_0x48ed40;return db[_0x3a41('0x40')][_0x3a41('0x4e')]({'where':{'membername':_0x488b53[_0x3a41('0x28')]},'individualHooks':!![]});}})[_0x3a41('0xf')](function(){if(_0x488b53){return db[_0x3a41('0x2c')][_0x3a41('0x4a')]({'where':{'membername':_0x488b53['name'],'exitAt':null}});}})[_0x3a41('0xf')](function(_0x5a6a78){if(_0x488b53){if(_0x5a6a78&&_0x5a6a78[_0x3a41('0x2d')]){var _0x2ccfd9=[];_0x5a6a78[_0x3a41('0x32')](function(_0x65cba9){_0x2ccfd9[_0x3a41('0x33')](_0x65cba9['update']({'exitAt':moment()[_0x3a41('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x3a41('0x4b')](_0x2ccfd9);}}})[_0x3a41('0xf')](function(){if(_0x488b53){return _0x488b53[_0x3a41('0x41')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x3a41('0xf')](function(_0x2861f5){_0xe736b3(_0x2861f5);})[_0x3a41('0x18')](function(_0x2b497d){_0xbe0c96(_0x5ea081[_0x3a41('0x14')](0x1f4,_0x2b497d[_0x3a41('0x16')]));});});};exports['LoginUser']=function(_0x544d28){var _0x141588=this;return new Promise(function(_0x29cf23,_0x1ccf46){var _0x436b7e;var _0x1c5734;var _0x50915b;var _0x5460ec;return db[_0x3a41('0x23')]['findOne']({'where':_0x544d28[_0x3a41('0x19')]['where']||{},'attributes':['id',_0x3a41('0x28'),_0x3a41('0x29'),_0x3a41('0x4f'),'phone',_0x3a41('0x2a'),_0x3a41('0x50'),_0x3a41('0x2b')]})['then'](function(_0xa4d112){if(_0xa4d112){_0x436b7e=_0xa4d112;_0x5460ec=_0x544d28['body'][_0x3a41('0x2b')]?_0x544d28[_0x3a41('0x37')]['interface']:util[_0x3a41('0x2e')](_0x3a41('0x35'),_0x436b7e[_0x3a41('0x28')]);return db[_0x3a41('0x23')][_0x3a41('0x51')]({'where':{'role':_0x3a41('0x52'),'online':!![],'id':{'$ne':_0x436b7e['id']}}});}})['then'](function(_0x9a7372){if(_0x9a7372){_0x50915b=_0x9a7372;return require('../../config/license/util')[_0x3a41('0x53')]();}})['then'](function(_0x1f96f9){if(_0x1f96f9&&_0x1f96f9[_0x3a41('0x54')]&&_0x50915b>=_0x1f96f9['agents']){throw new Error(_0x3a41('0x55'));}})['then'](function(){if(_0x436b7e){return db[_0x3a41('0x40')][_0x3a41('0x4e')]({'where':{'membername':_0x436b7e['name']},'individualHooks':!![]});}})[_0x3a41('0xf')](function(){if(_0x436b7e){return _0x436b7e[_0x3a41('0x56')]({'raw':!![]});}})[_0x3a41('0xf')](function(_0x54cb35){if(_0x436b7e){if(_0x54cb35){var _0x3f3a4b=[];_0x1c5734=_0x54cb35;if(_0x1c5734['length']){for(var _0x3556f6=0x0;_0x3556f6<_0x1c5734[_0x3a41('0x2d')];_0x3556f6++){_0x3f3a4b[_0x3a41('0x33')](db[_0x3a41('0x40')][_0x3a41('0x57')]({'membername':_0x436b7e['name'],'UserId':_0x436b7e['id'],'queue_name':_0x1c5734[_0x3556f6][_0x3a41('0x28')],'VoiceQueueId':_0x1c5734[_0x3556f6]['id'],'interface':_0x5460ec,'paused':_0x436b7e['loginInPause']||![],'penalty':_0x1c5734[_0x3556f6][_0x3a41('0x58')]||0x0}));}return BPromise[_0x3a41('0x4b')](_0x3f3a4b);}}}})[_0x3a41('0xf')](function(){if(_0x436b7e){return db[_0x3a41('0x2c')][_0x3a41('0x4a')]({'where':{'membername':_0x436b7e[_0x3a41('0x28')],'exitAt':null}});}})['then'](function(_0x2e7bcc){if(_0x436b7e){if(_0x2e7bcc&&_0x2e7bcc['length']){var _0x1c553a=[];_0x2e7bcc[_0x3a41('0x32')](function(_0x2b86bb){_0x1c553a['push'](_0x2b86bb['update']({'exitAt':moment()[_0x3a41('0x2e')](_0x3a41('0x2f'))}));});return BPromise[_0x3a41('0x4b')](_0x1c553a);}}})[_0x3a41('0xf')](function(_0x5353e0){if(_0x436b7e){var _0x57532e=[];var _0x4e915d=[];var _0x40d572=utils[_0x3a41('0x31')]();var _0x3f3d63={'membername':_0x436b7e['name'],'interface':_0x5460ec,'enterAt':moment()[_0x3a41('0x2e')](_0x3a41('0x2f')),'role':_0x436b7e[_0x3a41('0x29')],'internal':_0x436b7e[_0x3a41('0x2a')]};_0x40d572[_0x3a41('0x32')](function(_0x319a10){_0x57532e[_0x3a41('0x33')](_[_0x3a41('0x59')]({'channel':_0x319a10,'type':'LOGIN','data1':_0x3a41('0x5a'),'data2':_0x5460ec},_0x3f3d63));if(_0x436b7e[_0x3a41('0x50')]){_0x4e915d[_0x3a41('0x33')](_[_0x3a41('0x59')]({'channel':_0x319a10,'type':_0x3a41('0x36'),'data1':_0x3a41('0x5b')},_0x3f3d63));}});return db['MemberReport']['bulkCreate'](_0x57532e['concat'](_0x4e915d),{'individualHooks':!![]});}})['then'](function(){if(_0x436b7e){return _0x436b7e['update']({'online':!![],'lastLoginAt':moment()[_0x3a41('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x436b7e[_0x3a41('0x50')]||![],'mailPause':_0x436b7e['loginInPause']||![],'chatPause':_0x436b7e['loginInPause']||![],'faxPause':_0x436b7e[_0x3a41('0x50')]||![],'smsPause':_0x436b7e[_0x3a41('0x50')]||![],'openchannelPause':_0x436b7e[_0x3a41('0x50')]||![],'pauseType':_0x436b7e[_0x3a41('0x50')]?_0x3a41('0x5b'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x5460ec});}})[_0x3a41('0xf')](function(_0x30f5a8){_0x29cf23(_0x30f5a8);})['catch'](function(_0x4acaaa){_0x1ccf46(_0x141588[_0x3a41('0x14')](0x1f4,_0x4acaaa[_0x3a41('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5d0c50d..e4401db 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 _0xd7c0=['remove','update','emit','register','length','user:','./user.events','save'];(function(_0x4d2472,_0x217290){var _0x313bb4=function(_0x15248b){while(--_0x15248b){_0x4d2472['push'](_0x4d2472['shift']());}};_0x313bb4(++_0x217290);}(_0xd7c0,0x116));var _0x0d7c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7c0[_0xfae23b];return _0x200640;};'use strict';var UserEvents=require(_0x0d7c('0x0'));var events=[_0x0d7c('0x1'),_0x0d7c('0x2'),_0x0d7c('0x3')];function createListener(_0x23e582,_0x5164ba){return function(_0x23b73){_0x5164ba[_0x0d7c('0x4')](_0x23e582,_0x23b73);};}function removeListener(_0x2a5607,_0x2c4059){return function(){UserEvents['removeListener'](_0x2a5607,_0x2c4059);};}exports[_0x0d7c('0x5')]=function(_0x3fbdd6){for(var _0x2929cc=0x0,_0xdfec7c=events[_0x0d7c('0x6')];_0x2929cc<_0xdfec7c;_0x2929cc++){var _0x43aca3=events[_0x2929cc];var _0x34c5dc=createListener(_0x0d7c('0x7')+_0x43aca3,_0x3fbdd6);UserEvents['on'](_0x43aca3,_0x34c5dc);}}; \ No newline at end of file +var _0x4fa4=['save','remove','emit','register','length','user:','./user.events'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4fa4,0x1e2));var _0x44fa=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x4fa4[_0x3070dc];return _0x431489;};'use strict';var UserEvents=require(_0x44fa('0x0'));var events=[_0x44fa('0x1'),_0x44fa('0x2'),'update'];function createListener(_0xdd3ed1,_0x29039e){return function(_0x4a3832){_0x29039e[_0x44fa('0x3')](_0xdd3ed1,_0x4a3832);};}function removeListener(_0x255af0,_0x4f05ca){return function(){UserEvents['removeListener'](_0x255af0,_0x4f05ca);};}exports[_0x44fa('0x4')]=function(_0x34aca9){for(var _0x288a58=0x0,_0x5e87e1=events[_0x44fa('0x5')];_0x288a58<_0x5e87e1;_0x288a58++){var _0x1ade30=events[_0x288a58];var _0x1435f2=createListener(_0x44fa('0x6')+_0x1ade30,_0x34aca9);UserEvents['on'](_0x1ade30,_0x1435f2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9b1ac3f..8488c72 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 _0xf61e=['../../config/environment','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5cb857,_0x30c229){var _0x152e27=function(_0x400fb6){while(--_0x400fb6){_0x5cb857['push'](_0x5cb857['shift']());}};_0x152e27(++_0x30c229);}(_0xf61e,0x82));var _0xef61=function(_0x5bc35a,_0x4f707f){_0x5bc35a=_0x5bc35a-0x0;var _0x1f7e8d=_0xf61e[_0x5bc35a];return _0x1f7e8d;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef61('0x3')]();var auth=require(_0xef61('0x4'));var interaction=require(_0xef61('0x5'));var config=require(_0xef61('0x6'));module[_0xef61('0x7')]=router; \ No newline at end of file +var _0x1ef6=['express','Router','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x58d619,_0x23543a){var _0xd44305=function(_0x59bb00){while(--_0x59bb00){_0x58d619['push'](_0x58d619['shift']());}};_0xd44305(++_0x23543a);}(_0x1ef6,0x12b));var _0x61ef=function(_0x397e27,_0x578f87){_0x397e27=_0x397e27-0x0;var _0x284c21=_0x1ef6[_0x397e27];return _0x284c21;};'use strict';var multer=require('multer');var util=require(_0x61ef('0x0'));var path=require(_0x61ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x61ef('0x2'));var router=express[_0x61ef('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x61ef('0x4'));var config=require(_0x61ef('0x5'));module[_0x61ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 1da1df7..f858846 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 _0xd8b0=['exports','sequelize'];(function(_0x230962,_0x5e9cdc){var _0x198020=function(_0x14b30c){while(--_0x14b30c){_0x230962['push'](_0x230962['shift']());}};_0x198020(++_0x5e9cdc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x19921b,_0x5c0c2d){var _0x273545=function(_0x387462){while(--_0x387462){_0x19921b['push'](_0x19921b['shift']());}};_0x273545(++_0x5c0c2d);}(_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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index cc4b236..fe432b8 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 _0x7582=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','util'];(function(_0x4004c2,_0x11f4be){var _0x553b69=function(_0x3d199e){while(--_0x3d199e){_0x4004c2['push'](_0x4004c2['shift']());}};_0x553b69(++_0x11f4be);}(_0x7582,0x167));var _0x2758=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0x7582[_0x3d2d6f];return _0x5c0022;};'use strict';var _=require('lodash');var util=require(_0x2758('0x0'));var logger=require(_0x2758('0x1'))(_0x2758('0x2'));var moment=require('moment');var BPromise=require(_0x2758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2758('0x4'));var rimraf=require(_0x2758('0x5'));var config=require(_0x2758('0x6'));var attributes=require(_0x2758('0x7'));module['exports']=function(_0x1d5ddd,_0x1dcc5f){return _0x1d5ddd['define'](_0x2758('0x8'),attributes,{'tableName':_0x2758('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc81=['exports','define','UserChatQueue','user_has_chat_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes'];(function(_0x482bc3,_0x3d5ab){var _0x458dbe=function(_0x9600eb){while(--_0x9600eb){_0x482bc3['push'](_0x482bc3['shift']());}};_0x458dbe(++_0x3d5ab);}(_0xcc81,0x19c));var _0x1cc8=function(_0x4ed383,_0x5cd212){_0x4ed383=_0x4ed383-0x0;var _0x135bf3=_0xcc81[_0x4ed383];return _0x135bf3;};'use strict';var _=require(_0x1cc8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1cc8('0x1'));var moment=require(_0x1cc8('0x2'));var BPromise=require(_0x1cc8('0x3'));var rp=require(_0x1cc8('0x4'));var fs=require('fs');var path=require(_0x1cc8('0x5'));var rimraf=require(_0x1cc8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cc8('0x7'));module[_0x1cc8('0x8')]=function(_0x577f88,_0x434432){return _0x577f88[_0x1cc8('0x9')](_0x1cc8('0xa'),attributes,{'tableName':_0x1cc8('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 d1ea946..130ac02 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 _0x425f=['jayson/promise','client','http','request','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserChatQueue,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x425f,0x1ac));var _0xf425=function(_0x3caac8,_0x57ce64){_0x3caac8=_0x3caac8-0x0;var _0x5622a6=_0x425f[_0x3caac8];return _0x5622a6;};'use strict';var _=require(_0xf425('0x0'));var util=require(_0xf425('0x1'));var moment=require(_0xf425('0x2'));var BPromise=require(_0xf425('0x3'));var rs=require(_0xf425('0x4'));var fs=require('fs');var Redis=require(_0xf425('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf425('0x6'));var logger=require(_0xf425('0x7'))(_0xf425('0x8'));var config=require('../../config/environment');var jayson=require(_0xf425('0x9'));var client=jayson[_0xf425('0xa')][_0xf425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x92c7c5,_0x22f18a,_0x548696){return new BPromise(function(_0x3807c9,_0x451ed3){return client[_0xf425('0xc')](_0x92c7c5,_0x548696)['then'](function(_0x5e3a40){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x22f18a,_0xf425('0xd'));logger[_0xf425('0xe')](_0xf425('0xf'),_0x22f18a,'request\x20sent',JSON[_0xf425('0x10')](_0x5e3a40));if(_0x5e3a40[_0xf425('0x11')]){if(_0x5e3a40['error']['code']===0x1f4){logger[_0xf425('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x22f18a,_0x5e3a40[_0xf425('0x11')][_0xf425('0x12')]);return _0x451ed3(_0x5e3a40['error'][_0xf425('0x12')]);}logger[_0xf425('0x11')](_0xf425('0x13'),_0x22f18a,_0x5e3a40[_0xf425('0x11')][_0xf425('0x12')]);return _0x3807c9(_0x5e3a40[_0xf425('0x11')][_0xf425('0x12')]);}else{logger[_0xf425('0x14')](_0xf425('0x13'),_0x22f18a,_0xf425('0xd'));_0x3807c9(_0x5e3a40[_0xf425('0x15')][_0xf425('0x12')]);}})[_0xf425('0x16')](function(_0x89bcd3){logger['error'](_0xf425('0x13'),_0x22f18a,_0x89bcd3);_0x451ed3(_0x89bcd3);});});} \ No newline at end of file +var _0xf010=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xf010,0x12e));var _0x0f01=function(_0x4bc293,_0x3bf537){_0x4bc293=_0x4bc293-0x0;var _0x51317a=_0xf010[_0x4bc293];return _0x51317a;};'use strict';var _=require(_0x0f01('0x0'));var util=require(_0x0f01('0x1'));var moment=require(_0x0f01('0x2'));var BPromise=require(_0x0f01('0x3'));var rs=require(_0x0f01('0x4'));var fs=require('fs');var Redis=require(_0x0f01('0x5'));var db=require(_0x0f01('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0f01('0x7'));var config=require(_0x0f01('0x8'));var jayson=require(_0x0f01('0x9'));var client=jayson[_0x0f01('0xa')][_0x0f01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14898f,_0x677c74,_0x42b184){return new BPromise(function(_0x568461,_0x15f44c){return client[_0x0f01('0xc')](_0x14898f,_0x42b184)['then'](function(_0x43f1aa){logger[_0x0f01('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x677c74,_0x0f01('0xe'));logger['debug'](_0x0f01('0xf'),_0x677c74,_0x0f01('0xe'),JSON['stringify'](_0x43f1aa));if(_0x43f1aa['error']){if(_0x43f1aa[_0x0f01('0x10')][_0x0f01('0x11')]===0x1f4){logger[_0x0f01('0x10')](_0x0f01('0x12'),_0x677c74,_0x43f1aa['error'][_0x0f01('0x13')]);return _0x15f44c(_0x43f1aa[_0x0f01('0x10')][_0x0f01('0x13')]);}logger[_0x0f01('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x677c74,_0x43f1aa[_0x0f01('0x10')][_0x0f01('0x13')]);return _0x568461(_0x43f1aa[_0x0f01('0x10')][_0x0f01('0x13')]);}else{logger[_0x0f01('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x677c74,_0x0f01('0xe'));_0x568461(_0x43f1aa[_0x0f01('0x14')][_0x0f01('0x13')]);}})[_0x0f01('0x15')](function(_0x20e121){logger[_0x0f01('0x10')](_0x0f01('0x12'),_0x677c74,_0x20e121);_0x15f44c(_0x20e121);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5da0e49..e4ebbbc 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 _0x0457=['express','Router','../../components/auth/service','../../components/interaction/service','util','connect-timeout'];(function(_0x2d9e46,_0x299ee4){var _0xb343dd=function(_0x311a03){while(--_0x311a03){_0x2d9e46['push'](_0x2d9e46['shift']());}};_0xb343dd(++_0x299ee4);}(_0x0457,0x82));var _0x7045=function(_0x4de02a,_0x111635){_0x4de02a=_0x4de02a-0x0;var _0x14be17=_0x0457[_0x4de02a];return _0x14be17;};'use strict';var multer=require('multer');var util=require(_0x7045('0x0'));var path=require('path');var timeout=require(_0x7045('0x1'));var express=require(_0x7045('0x2'));var router=express[_0x7045('0x3')]();var auth=require(_0x7045('0x4'));var interaction=require(_0x7045('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x8bcf=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','multer'];(function(_0x15639e,_0x196c85){var _0x552d7f=function(_0x885389){while(--_0x885389){_0x15639e['push'](_0x15639e['shift']());}};_0x552d7f(++_0x196c85);}(_0x8bcf,0xed));var _0xf8bc=function(_0x3fb6af,_0x420d61){_0x3fb6af=_0x3fb6af-0x0;var _0x1db5f4=_0x8bcf[_0x3fb6af];return _0x1db5f4;};'use strict';var multer=require(_0xf8bc('0x0'));var util=require(_0xf8bc('0x1'));var path=require(_0xf8bc('0x2'));var timeout=require(_0xf8bc('0x3'));var express=require(_0xf8bc('0x4'));var router=express['Router']();var auth=require(_0xf8bc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8bc('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ad71373..04b3d0a 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 _0x0abf=['sequelize','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4a2=['INTEGER','sequelize'];(function(_0x3bd4ab,_0x54d676){var _0x1c3b62=function(_0x1df993){while(--_0x1df993){_0x3bd4ab['push'](_0x3bd4ab['shift']());}};_0x1c3b62(++_0x54d676);}(_0xd4a2,0x173));var _0x2d4a=function(_0x13760d,_0x1cf251){_0x13760d=_0x13760d-0x0;var _0x10874a=_0xd4a2[_0x13760d];return _0x10874a;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2d4a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 908abfd..f55eebb 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 _0xf1f2=['UserFaxQueue','user_has_fax_queues','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x233f8d,_0x2bbfc4){var _0x5d08f3=function(_0x236564){while(--_0x236564){_0x233f8d['push'](_0x233f8d['shift']());}};_0x5d08f3(++_0x2bbfc4);}(_0xf1f2,0x192));var _0x2f1f=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xf1f2[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2f1f('0x0'))(_0x2f1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f1f('0x2'));var fs=require('fs');var path=require(_0x2f1f('0x3'));var rimraf=require(_0x2f1f('0x4'));var config=require(_0x2f1f('0x5'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x3888cc,_0x20f42b){return _0x3888cc['define'](_0x2f1f('0x6'),attributes,{'tableName':_0x2f1f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61e2=['rimraf','../../config/environment','exports','define','user_has_fax_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x61e2,0xeb));var _0x261e=function(_0xc37902,_0x325d26){_0xc37902=_0xc37902-0x0;var _0x2c63fc=_0x61e2[_0xc37902];return _0x2c63fc;};'use strict';var _=require(_0x261e('0x0'));var util=require(_0x261e('0x1'));var logger=require(_0x261e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x261e('0x3'));var rp=require(_0x261e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x261e('0x5'));var config=require(_0x261e('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x261e('0x7')]=function(_0x2a446d,_0x4c79eb){return _0x2a446d[_0x261e('0x8')]('UserFaxQueue',attributes,{'tableName':_0x261e('0x9'),'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 0bb1153..4fe3653 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 _0x63ea=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x23f52f,_0x30f497){var _0x5db5cf=function(_0x3de15e){while(--_0x3de15e){_0x23f52f['push'](_0x23f52f['shift']());}};_0x5db5cf(++_0x30f497);}(_0x63ea,0x113));var _0xa63e=function(_0x1053d6,_0x479a3e){_0x1053d6=_0x1053d6-0x0;var _0x1ee809=_0x63ea[_0x1053d6];return _0x1ee809;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa63e('0x0'));var BPromise=require(_0xa63e('0x1'));var rs=require(_0xa63e('0x2'));var fs=require('fs');var Redis=require(_0xa63e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa63e('0x4'));var logger=require('../../config/logger')(_0xa63e('0x5'));var config=require(_0xa63e('0x6'));var jayson=require(_0xa63e('0x7'));var client=jayson['client'][_0xa63e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x196c91,_0x62ae88,_0x309ce7){return new BPromise(function(_0x5c8083,_0x54c46a){return client[_0xa63e('0x9')](_0x196c91,_0x309ce7)['then'](function(_0x32d5ea){logger[_0xa63e('0xa')](_0xa63e('0xb'),_0x62ae88,_0xa63e('0xc'));logger['debug'](_0xa63e('0xd'),_0x62ae88,_0xa63e('0xc'),JSON[_0xa63e('0xe')](_0x32d5ea));if(_0x32d5ea[_0xa63e('0xf')]){if(_0x32d5ea[_0xa63e('0xf')]['code']===0x1f4){logger[_0xa63e('0xf')](_0xa63e('0xb'),_0x62ae88,_0x32d5ea['error'][_0xa63e('0x10')]);return _0x54c46a(_0x32d5ea['error'][_0xa63e('0x10')]);}logger[_0xa63e('0xf')](_0xa63e('0xb'),_0x62ae88,_0x32d5ea['error']['message']);return _0x5c8083(_0x32d5ea[_0xa63e('0xf')][_0xa63e('0x10')]);}else{logger[_0xa63e('0xa')](_0xa63e('0xb'),_0x62ae88,_0xa63e('0xc'));_0x5c8083(_0x32d5ea[_0xa63e('0x11')]['message']);}})['catch'](function(_0x1cec12){logger[_0xa63e('0xf')](_0xa63e('0xb'),_0x62ae88,_0x1cec12);_0x54c46a(_0x1cec12);});});} \ No newline at end of file +var _0x3ed1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1045e7,_0x4d7152){var _0x2a1a58=function(_0x5e4275){while(--_0x5e4275){_0x1045e7['push'](_0x1045e7['shift']());}};_0x2a1a58(++_0x4d7152);}(_0x3ed1,0x13d));var _0x13ed=function(_0x4470b8,_0x20729d){_0x4470b8=_0x4470b8-0x0;var _0x31961e=_0x3ed1[_0x4470b8];return _0x31961e;};'use strict';var _=require('lodash');var util=require(_0x13ed('0x0'));var moment=require(_0x13ed('0x1'));var BPromise=require(_0x13ed('0x2'));var rs=require(_0x13ed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13ed('0x4'))['db'];var utils=require(_0x13ed('0x5'));var logger=require(_0x13ed('0x6'))(_0x13ed('0x7'));var config=require(_0x13ed('0x8'));var jayson=require(_0x13ed('0x9'));var client=jayson[_0x13ed('0xa')][_0x13ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x167f02,_0x364cae,_0xc7c957){return new BPromise(function(_0x1dafcc,_0x46f378){return client['request'](_0x167f02,_0xc7c957)[_0x13ed('0xc')](function(_0xce3b1f){logger[_0x13ed('0xd')](_0x13ed('0xe'),_0x364cae,_0x13ed('0xf'));logger[_0x13ed('0x10')](_0x13ed('0x11'),_0x364cae,_0x13ed('0xf'),JSON['stringify'](_0xce3b1f));if(_0xce3b1f[_0x13ed('0x12')]){if(_0xce3b1f[_0x13ed('0x12')][_0x13ed('0x13')]===0x1f4){logger[_0x13ed('0x12')](_0x13ed('0xe'),_0x364cae,_0xce3b1f[_0x13ed('0x12')][_0x13ed('0x14')]);return _0x46f378(_0xce3b1f[_0x13ed('0x12')][_0x13ed('0x14')]);}logger['error'](_0x13ed('0xe'),_0x364cae,_0xce3b1f[_0x13ed('0x12')][_0x13ed('0x14')]);return _0x1dafcc(_0xce3b1f[_0x13ed('0x12')]['message']);}else{logger[_0x13ed('0xd')](_0x13ed('0xe'),_0x364cae,'request\x20sent');_0x1dafcc(_0xce3b1f[_0x13ed('0x15')][_0x13ed('0x14')]);}})[_0x13ed('0x16')](function(_0x547303){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x364cae,_0x547303);_0x46f378(_0x547303);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 065c9b6..485b9e3 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 _0xc5c6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','util'];(function(_0x8fe4b7,_0x3a880c){var _0x11d6e4=function(_0x15e7e5){while(--_0x15e7e5){_0x8fe4b7['push'](_0x8fe4b7['shift']());}};_0x11d6e4(++_0x3a880c);}(_0xc5c6,0x1c7));var _0x6c5c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xc5c6[_0x36884e];return _0x1cc367;};'use strict';var multer=require('multer');var util=require(_0x6c5c('0x0'));var path=require(_0x6c5c('0x1'));var timeout=require(_0x6c5c('0x2'));var express=require(_0x6c5c('0x3'));var router=express[_0x6c5c('0x4')]();var auth=require(_0x6c5c('0x5'));var interaction=require(_0x6c5c('0x6'));var config=require('../../config/environment');module[_0x6c5c('0x7')]=router; \ No newline at end of file +var _0xd21e=['connect-timeout','Router','../../config/environment','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd21e,0x16b));var _0xed21=function(_0x55c99e,_0x46d478){_0x55c99e=_0x55c99e-0x0;var _0x5a89be=_0xd21e[_0x55c99e];return _0x5a89be;};'use strict';var multer=require(_0xed21('0x0'));var util=require(_0xed21('0x1'));var path=require(_0xed21('0x2'));var timeout=require(_0xed21('0x3'));var express=require('express');var router=express[_0xed21('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed21('0x5'));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 499ddeb..4551d24 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 _0xb10b=['sequelize','INTEGER'];(function(_0x364632,_0x2a4740){var _0x108956=function(_0x32b775){while(--_0x32b775){_0x364632['push'](_0x364632['shift']());}};_0x108956(++_0x2a4740);}(_0xb10b,0x12a));var _0xbb10=function(_0x9e7f3a,_0x37105f){_0x9e7f3a=_0x9e7f3a-0x0;var _0x5ab145=_0xb10b[_0x9e7f3a];return _0x5ab145;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x34b33c,_0x4258d0){var _0x5047ec=function(_0x52f472){while(--_0x52f472){_0x34b33c['push'](_0x34b33c['shift']());}};_0x5047ec(++_0x4258d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 21cc202..974f81f 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x5596fe,_0x2c4a14){var _0x4a8707=function(_0x25182e){while(--_0x25182e){_0x5596fe['push'](_0x5596fe['shift']());}};_0x4a8707(++_0x2c4a14);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x38f26e,_0xa15f5e){var _0x1e2fb3=function(_0x432fba){while(--_0x432fba){_0x38f26e['push'](_0x38f26e['shift']());}};_0x1e2fb3(++_0xa15f5e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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 e02514d..45db762 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 _0xf693=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xf693,0x181));var _0x3f69=function(_0x247cb2,_0x3c912e){_0x247cb2=_0x247cb2-0x0;var _0x51f2b2=_0xf693[_0x247cb2];return _0x51f2b2;};'use strict';var _=require('lodash');var util=require(_0x3f69('0x0'));var moment=require(_0x3f69('0x1'));var BPromise=require(_0x3f69('0x2'));var rs=require(_0x3f69('0x3'));var fs=require('fs');var Redis=require(_0x3f69('0x4'));var db=require(_0x3f69('0x5'))['db'];var utils=require(_0x3f69('0x6'));var logger=require('../../config/logger')(_0x3f69('0x7'));var config=require(_0x3f69('0x8'));var jayson=require(_0x3f69('0x9'));var client=jayson[_0x3f69('0xa')][_0x3f69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45461a,_0x7ecb76,_0x32544e){return new BPromise(function(_0x1ac268,_0xad860e){return client[_0x3f69('0xc')](_0x45461a,_0x32544e)[_0x3f69('0xd')](function(_0x134f69){logger[_0x3f69('0xe')](_0x3f69('0xf'),_0x7ecb76,_0x3f69('0x10'));logger[_0x3f69('0x11')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x7ecb76,_0x3f69('0x10'),JSON[_0x3f69('0x12')](_0x134f69));if(_0x134f69[_0x3f69('0x13')]){if(_0x134f69[_0x3f69('0x13')][_0x3f69('0x14')]===0x1f4){logger['error'](_0x3f69('0xf'),_0x7ecb76,_0x134f69[_0x3f69('0x13')]['message']);return _0xad860e(_0x134f69[_0x3f69('0x13')]['message']);}logger['error'](_0x3f69('0xf'),_0x7ecb76,_0x134f69[_0x3f69('0x13')][_0x3f69('0x15')]);return _0x1ac268(_0x134f69['error'][_0x3f69('0x15')]);}else{logger[_0x3f69('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x7ecb76,_0x3f69('0x10'));_0x1ac268(_0x134f69[_0x3f69('0x16')][_0x3f69('0x15')]);}})[_0x3f69('0x17')](function(_0x18f60a){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x7ecb76,_0x18f60a);_0xad860e(_0x18f60a);});});} \ No newline at end of file +var _0x6455=['client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xd91f48,_0x33b7b3){var _0x1962c6=function(_0x17d472){while(--_0x17d472){_0xd91f48['push'](_0xd91f48['shift']());}};_0x1962c6(++_0x33b7b3);}(_0x6455,0x97));var _0x5645=function(_0x4b10ae,_0x4b3584){_0x4b10ae=_0x4b10ae-0x0;var _0x125b0d=_0x6455[_0x4b10ae];return _0x125b0d;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('UserMailQueue,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ca70bfd..8a43aee 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 _0x1243=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','util','path'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x1243,0x9e));var _0x3124=function(_0x4583f5,_0x48986e){_0x4583f5=_0x4583f5-0x0;var _0x16513b=_0x1243[_0x4583f5];return _0x16513b;};'use strict';var multer=require('multer');var util=require(_0x3124('0x0'));var path=require(_0x3124('0x1'));var timeout=require(_0x3124('0x2'));var express=require(_0x3124('0x3'));var router=express[_0x3124('0x4')]();var auth=require(_0x3124('0x5'));var interaction=require(_0x3124('0x6'));var config=require('../../config/environment');module[_0x3124('0x7')]=router; \ No newline at end of file +var _0x8ea8=['../../config/environment','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x8ea8,0xf2));var _0x88ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x88ea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x88ea('0x1'));var express=require(_0x88ea('0x2'));var router=express[_0x88ea('0x3')]();var auth=require(_0x88ea('0x4'));var interaction=require(_0x88ea('0x5'));var config=require(_0x88ea('0x6'));module[_0x88ea('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0546f5a..541668c 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1038f3,_0x277b63){var _0x34aa4e=function(_0x2c33dc){while(--_0x2c33dc){_0x1038f3['push'](_0x1038f3['shift']());}};_0x34aa4e(++_0x277b63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1346db,_0x3b5b3a){var _0x2c600a=function(_0x436258){while(--_0x436258){_0x1346db['push'](_0x1346db['shift']());}};_0x2c600a(++_0x3b5b3a);}(_0xe706,0xa3));var _0x6e70=function(_0x36549f,_0x5c74f9){_0x36549f=_0x36549f-0x0;var _0x174066=_0xe706[_0x36549f];return _0x174066;};'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 5738bf7..be1283d 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 _0x484c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x484c,0xee));var _0xc484=function(_0xdd436e,_0x13b655){_0xdd436e=_0xdd436e-0x0;var _0x2e5d98=_0x484c[_0xdd436e];return _0x2e5d98;};'use strict';var _=require(_0xc484('0x0'));var util=require(_0xc484('0x1'));var logger=require(_0xc484('0x2'))(_0xc484('0x3'));var moment=require(_0xc484('0x4'));var BPromise=require(_0xc484('0x5'));var rp=require(_0xc484('0x6'));var fs=require('fs');var path=require(_0xc484('0x7'));var rimraf=require(_0xc484('0x8'));var config=require('../../config/environment');var attributes=require(_0xc484('0x9'));module[_0xc484('0xa')]=function(_0x3dbfa0,_0x3f8153){return _0x3dbfa0[_0xc484('0xb')](_0xc484('0xc'),attributes,{'tableName':_0xc484('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2979=['request-promise','path','rimraf','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','bluebird'];(function(_0x112a75,_0x48ec32){var _0x457574=function(_0xb18573){while(--_0xb18573){_0x112a75['push'](_0x112a75['shift']());}};_0x457574(++_0x48ec32);}(_0x2979,0x1d5));var _0x9297=function(_0x2f5dad,_0x4313ad){_0x2f5dad=_0x2f5dad-0x0;var _0x38e02d=_0x2979[_0x2f5dad];return _0x38e02d;};'use strict';var _=require(_0x9297('0x0'));var util=require('util');var logger=require(_0x9297('0x1'))(_0x9297('0x2'));var moment=require('moment');var BPromise=require(_0x9297('0x3'));var rp=require(_0x9297('0x4'));var fs=require('fs');var path=require(_0x9297('0x5'));var rimraf=require(_0x9297('0x6'));var config=require(_0x9297('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x184dc0,_0xd5d6a0){return _0x184dc0[_0x9297('0x8')](_0x9297('0x9'),attributes,{'tableName':_0x9297('0xa'),'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 50e1734..b8fcff1 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 _0xf7ad=['../../config/utils','../../config/logger','rpc','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x29a66a,_0x39988c){var _0x3b8e17=function(_0x4149ec){while(--_0x4149ec){_0x29a66a['push'](_0x29a66a['shift']());}};_0x3b8e17(++_0x39988c);}(_0xf7ad,0x1f2));var _0xdf7a=function(_0x376e96,_0x2a53b4){_0x376e96=_0x376e96-0x0;var _0x54bd5f=_0xf7ad[_0x376e96];return _0x54bd5f;};'use strict';var _=require(_0xdf7a('0x0'));var util=require('util');var moment=require(_0xdf7a('0x1'));var BPromise=require(_0xdf7a('0x2'));var rs=require(_0xdf7a('0x3'));var fs=require('fs');var Redis=require(_0xdf7a('0x4'));var db=require(_0xdf7a('0x5'))['db'];var utils=require(_0xdf7a('0x6'));var logger=require(_0xdf7a('0x7'))(_0xdf7a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf7a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x339ff4,_0x4eb8aa,_0x4c9a72){return new BPromise(function(_0x32ff12,_0x1b4943){return client[_0xdf7a('0xa')](_0x339ff4,_0x4c9a72)[_0xdf7a('0xb')](function(_0x2aa892){logger['info'](_0xdf7a('0xc'),_0x4eb8aa,_0xdf7a('0xd'));logger['debug'](_0xdf7a('0xe'),_0x4eb8aa,'request\x20sent',JSON[_0xdf7a('0xf')](_0x2aa892));if(_0x2aa892[_0xdf7a('0x10')]){if(_0x2aa892[_0xdf7a('0x10')]['code']===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4eb8aa,_0x2aa892['error'][_0xdf7a('0x11')]);return _0x1b4943(_0x2aa892[_0xdf7a('0x10')][_0xdf7a('0x11')]);}logger[_0xdf7a('0x10')](_0xdf7a('0xc'),_0x4eb8aa,_0x2aa892[_0xdf7a('0x10')][_0xdf7a('0x11')]);return _0x32ff12(_0x2aa892[_0xdf7a('0x10')][_0xdf7a('0x11')]);}else{logger[_0xdf7a('0x12')](_0xdf7a('0xc'),_0x4eb8aa,'request\x20sent');_0x32ff12(_0x2aa892[_0xdf7a('0x13')]['message']);}})[_0xdf7a('0x14')](function(_0x2a37dd){logger[_0xdf7a('0x10')](_0xdf7a('0xc'),_0x4eb8aa,_0x2a37dd);_0x1b4943(_0x2a37dd);});});} \ No newline at end of file +var _0x536a=['error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify'];(function(_0x4ddd44,_0x3c9683){var _0x4327e3=function(_0x490587){while(--_0x490587){_0x4ddd44['push'](_0x4ddd44['shift']());}};_0x4327e3(++_0x3c9683);}(_0x536a,0xd7));var _0xa536=function(_0x28d095,_0x532bd8){_0x28d095=_0x28d095-0x0;var _0x355c30=_0x536a[_0x28d095];return _0x355c30;};'use strict';var _=require(_0xa536('0x0'));var util=require(_0xa536('0x1'));var moment=require('moment');var BPromise=require(_0xa536('0x2'));var rs=require(_0xa536('0x3'));var fs=require('fs');var Redis=require(_0xa536('0x4'));var db=require(_0xa536('0x5'))['db'];var utils=require(_0xa536('0x6'));var logger=require('../../config/logger')(_0xa536('0x7'));var config=require(_0xa536('0x8'));var jayson=require(_0xa536('0x9'));var client=jayson[_0xa536('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6779f,_0x2a8054,_0x1501b9){return new BPromise(function(_0xe29fc8,_0xfd0a34){return client[_0xa536('0xb')](_0xd6779f,_0x1501b9)['then'](function(_0x16de18){logger[_0xa536('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2a8054,_0xa536('0xd'));logger[_0xa536('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2a8054,_0xa536('0xd'),JSON[_0xa536('0xf')](_0x16de18));if(_0x16de18[_0xa536('0x10')]){if(_0x16de18[_0xa536('0x10')][_0xa536('0x11')]===0x1f4){logger['error'](_0xa536('0x12'),_0x2a8054,_0x16de18[_0xa536('0x10')]['message']);return _0xfd0a34(_0x16de18['error'][_0xa536('0x13')]);}logger[_0xa536('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2a8054,_0x16de18['error'][_0xa536('0x13')]);return _0xe29fc8(_0x16de18[_0xa536('0x10')][_0xa536('0x13')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2a8054,_0xa536('0xd'));_0xe29fc8(_0x16de18[_0xa536('0x14')]['message']);}})['catch'](function(_0x58f472){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2a8054,_0x58f472);_0xfd0a34(_0x58f472);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 365ee09..b889eb9 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 _0x142d=['removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','/:id/resources','addResources','put','/:id','delete','destroy'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x142d,0x199));var _0xd142=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x142d[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0xd142('0x0'));var util=require(_0xd142('0x1'));var path=require(_0xd142('0x2'));var timeout=require(_0xd142('0x3'));var express=require(_0xd142('0x4'));var router=express[_0xd142('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd142('0x6'));router[_0xd142('0x7')]('/',auth[_0xd142('0x8')](),controller[_0xd142('0x9')]);router[_0xd142('0x7')](_0xd142('0xa'),auth['isAuthenticated'](),controller[_0xd142('0xb')]);router[_0xd142('0x7')]('/:id',auth[_0xd142('0x8')](),controller[_0xd142('0xc')]);router[_0xd142('0x7')](_0xd142('0xd'),auth['isAuthenticated'](),controller[_0xd142('0xe')]);router['get']('/:id/resources',auth[_0xd142('0x8')](),controller[_0xd142('0xf')]);router[_0xd142('0x10')]('/',auth[_0xd142('0x8')](),controller[_0xd142('0x11')]);router['post'](_0xd142('0x12'),auth[_0xd142('0x8')](),controller[_0xd142('0x13')]);router['post'](_0xd142('0xd'),auth[_0xd142('0x8')](),controller['addSections']);router[_0xd142('0x10')](_0xd142('0x14'),auth[_0xd142('0x8')](),controller[_0xd142('0x15')]);router[_0xd142('0x16')](_0xd142('0x17'),auth['isAuthenticated'](),controller['update']);router[_0xd142('0x18')]('/:id',auth[_0xd142('0x8')](),controller[_0xd142('0x19')]);router[_0xd142('0x18')]('/:id/sections',auth[_0xd142('0x8')](),controller[_0xd142('0x1a')]);router[_0xd142('0x18')](_0xd142('0x14'),auth['isAuthenticated'](),controller[_0xd142('0x1b')]);module[_0xd142('0x1c')]=router; \ No newline at end of file +var _0x1bdc=['/:id/sections','getSections','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','removeSections','/:id/resources','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x471856,_0x23b475){var _0x2c8f7f=function(_0x19e2fe){while(--_0x19e2fe){_0x471856['push'](_0x471856['shift']());}};_0x2c8f7f(++_0x23b475);}(_0x1bdc,0x160));var _0xc1bd=function(_0x4ac8ef,_0x5c2c6e){_0x4ac8ef=_0x4ac8ef-0x0;var _0x3a9239=_0x1bdc[_0x4ac8ef];return _0x3a9239;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc1bd('0x0'));var express=require('express');var router=express[_0xc1bd('0x1')]();var auth=require(_0xc1bd('0x2'));var interaction=require(_0xc1bd('0x3'));var config=require(_0xc1bd('0x4'));var controller=require(_0xc1bd('0x5'));router[_0xc1bd('0x6')]('/',auth[_0xc1bd('0x7')](),controller[_0xc1bd('0x8')]);router['get'](_0xc1bd('0x9'),auth[_0xc1bd('0x7')](),controller[_0xc1bd('0xa')]);router[_0xc1bd('0x6')](_0xc1bd('0xb'),auth[_0xc1bd('0x7')](),controller['show']);router[_0xc1bd('0x6')](_0xc1bd('0xc'),auth[_0xc1bd('0x7')](),controller[_0xc1bd('0xd')]);router[_0xc1bd('0x6')]('/:id/resources',auth[_0xc1bd('0x7')](),controller['getResources']);router[_0xc1bd('0xe')]('/',auth[_0xc1bd('0x7')](),controller[_0xc1bd('0xf')]);router[_0xc1bd('0xe')](_0xc1bd('0x10'),auth[_0xc1bd('0x7')](),controller[_0xc1bd('0x11')]);router['post']('/:id/sections',auth[_0xc1bd('0x7')](),controller[_0xc1bd('0x12')]);router[_0xc1bd('0xe')]('/:id/resources',auth[_0xc1bd('0x7')](),controller[_0xc1bd('0x13')]);router[_0xc1bd('0x14')](_0xc1bd('0xb'),auth[_0xc1bd('0x7')](),controller[_0xc1bd('0x15')]);router[_0xc1bd('0x16')]('/:id',auth[_0xc1bd('0x7')](),controller['destroy']);router[_0xc1bd('0x16')](_0xc1bd('0xc'),auth['isAuthenticated'](),controller[_0xc1bd('0x17')]);router[_0xc1bd('0x16')](_0xc1bd('0x18'),auth[_0xc1bd('0x7')](),controller['removeResources']);module[_0xc1bd('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 e4de6a5..d9a613c 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 _0x8de9=['STRING','name','setDataValue','crudPermissions','getDataValue','split','exports'];(function(_0x9a51b3,_0x34ac18){var _0x4ca7b1=function(_0x455c6d){while(--_0x455c6d){_0x9a51b3['push'](_0x9a51b3['shift']());}};_0x4ca7b1(++_0x34ac18);}(_0x8de9,0x1e2));var _0x98de=function(_0xd00ca0,_0xfc9fa0){_0xd00ca0=_0xd00ca0-0x0;var _0x5a2c81=_0x8de9[_0xd00ca0];return _0x5a2c81;};'use strict';var Sequelize=require('sequelize');module[_0x98de('0x0')]={'name':{'type':Sequelize[_0x98de('0x1')],'allowNull':![],'unique':_0x98de('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5442b3){this[_0x98de('0x3')](_0x98de('0x4'),_0x5442b3?_0x5442b3['join'](''):[]);},'get':function(){return this[_0x98de('0x5')](_0x98de('0x4'))?this[_0x98de('0x5')](_0x98de('0x4'))[_0x98de('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x98de('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xe386=['crudPermissions','join','getDataValue','split','exports','STRING','name','setDataValue'];(function(_0x2aa948,_0x4fec9a){var _0x48493a=function(_0x3cdf11){while(--_0x3cdf11){_0x2aa948['push'](_0x2aa948['shift']());}};_0x48493a(++_0x4fec9a);}(_0xe386,0x11c));var _0x6e38=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe386[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x6e38('0x0')]={'name':{'type':Sequelize[_0x6e38('0x1')],'allowNull':![],'unique':_0x6e38('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1ce38a){this[_0x6e38('0x3')](_0x6e38('0x4'),_0x1ce38a?_0x1ce38a[_0x6e38('0x5')](''):[]);},'get':function(){return this[_0x6e38('0x6')](_0x6e38('0x4'))?this[_0x6e38('0x6')](_0x6e38('0x4'))[_0x6e38('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6e38('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 58106dd..f0a4e58 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 _0x014e=['enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','order','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','reportId','CustomReports','CmContact','Tag','Tags','tag','color','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','admin','user','zendeskaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','Sound','templates','Template','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','./userProfile.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','merge','VIRTUAL','filter','options','UserProfile','findAll','rows','catch','show','params','includeAll','include','find','create','body','clone','createdAt','crudPermissions','omit','updatedAt','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','update','describe','sectionId','push','ids','getSections'];(function(_0x238b9a,_0x4fcbb8){var _0x59ebf3=function(_0x165123){while(--_0x165123){_0x238b9a['push'](_0x238b9a['shift']());}};_0x59ebf3(++_0x4fcbb8);}(_0x014e,0x16d));var _0xe014=function(_0x476b89,_0x2817d3){_0x476b89=_0x476b89-0x0;var _0x508f23=_0x014e[_0x476b89];return _0x508f23;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe014('0x0'));var rimraf=require(_0xe014('0x1'));var zipdir=require(_0xe014('0x2'));var jsonpatch=require(_0xe014('0x3'));var rp=require(_0xe014('0x4'));var moment=require(_0xe014('0x5'));var BPromise=require(_0xe014('0x6'));var Mustache=require(_0xe014('0x7'));var util=require(_0xe014('0x8'));var path=require('path');var sox=require(_0xe014('0x9'));var csv=require(_0xe014('0xa'));var ejs=require(_0xe014('0xb'));var fs=require('fs');var _=require(_0xe014('0xc'));var squel=require(_0xe014('0xd'));var crypto=require(_0xe014('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe014('0xf'));var toCsv=require(_0xe014('0xa'));var querystring=require(_0xe014('0x10'));var Papa=require(_0xe014('0x11'));var Redis=require(_0xe014('0x12'));var authService=require(_0xe014('0x13'));var qs=require(_0xe014('0x14'));var as=require(_0xe014('0x15'));var hardwareService=require(_0xe014('0x16'));var logger=require(_0xe014('0x17'))(_0xe014('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe014('0x19'));var db=require(_0xe014('0x1a'))['db'];config[_0xe014('0x1b')]=_['defaults'](config[_0xe014('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe014('0x1b')]));require(_0xe014('0x1c'))['register'](socket);function respondWithStatusCode(_0x284034,_0x1d17a5){_0x1d17a5=_0x1d17a5||0xcc;return function(_0xa524ac){if(_0xa524ac){return _0x284034[_0xe014('0x1d')](_0x1d17a5);}return _0x284034[_0xe014('0x1e')](_0x1d17a5)[_0xe014('0x1f')]();};}function respondWithResult(_0x4ab119,_0x5f1329){_0x5f1329=_0x5f1329||0xc8;return function(_0x246aa2){if(_0x246aa2){return _0x4ab119[_0xe014('0x1e')](_0x5f1329)[_0xe014('0x20')](_0x246aa2);}};}function respondWithFilteredResult(_0x172282,_0x19d413){return function(_0x22248f){if(_0x22248f){var _0xdc7ead=_0x22248f[_0xe014('0x21')],_0x38808f=_0x19d413[_0xe014('0x22')],_0x45cb3f=_0x19d413[_0xe014('0x22')]+_0x19d413['limit'],_0x7e3ecf;if(_0x45cb3f>=_0xdc7ead){_0x45cb3f=_0xdc7ead;_0x7e3ecf=0xc8;}else{_0x7e3ecf=0xce;}_0x172282[_0xe014('0x1e')](_0x7e3ecf);return _0x172282[_0xe014('0x23')](_0xe014('0x24'),_0x38808f+'-'+_0x45cb3f+'/'+_0xdc7ead)[_0xe014('0x20')](_0x22248f);}return null;};}function patchUpdates(_0x39bef1){return function(_0x1a58c0){try{jsonpatch[_0xe014('0x25')](_0x1a58c0,_0x39bef1,!![]);}catch(_0x5a572f){return BPromise[_0xe014('0x26')](_0x5a572f);}return _0x1a58c0[_0xe014('0x27')]();};}function saveUpdates(_0x25d86e,_0xd6e7da){return function(_0xf774ea){if(_0xf774ea){return _0xf774ea['update'](_0x25d86e)['then'](function(_0x1c5946){return _0x1c5946;});}return null;};}function removeEntity(_0x2fbc7c,_0x1f0803){return function(_0x5d9355){if(_0x5d9355){return _0x5d9355[_0xe014('0x28')]()[_0xe014('0x29')](function(){_0x2fbc7c['status'](0xcc)[_0xe014('0x1f')]();});}};}function handleEntityNotFound(_0x13c133,_0x7be509){return function(_0x1144d8){if(!_0x1144d8){_0x13c133[_0xe014('0x1d')](0x194);}return _0x1144d8;};}function handleError(_0x367832,_0x5215b9){_0x5215b9=_0x5215b9||0x1f4;return function(_0x1a7e0b){logger[_0xe014('0x2a')](_0x1a7e0b[_0xe014('0x2b')]);if(_0x1a7e0b[_0xe014('0x2c')]){delete _0x1a7e0b['name'];}_0x367832['status'](_0x5215b9)[_0xe014('0x2d')](_0x1a7e0b);};}exports[_0xe014('0x2e')]=function(_0x1cf8d3,_0x4c59ad){var _0x39c458={},_0x3e5e5d={},_0x5b9548={'count':0x0,'rows':[]};var _0x48b7d1=_['map'](db['UserProfile'][_0xe014('0x2f')],function(_0x1e0735){return{'name':_0x1e0735[_0xe014('0x30')],'type':_0x1e0735[_0xe014('0x31')]['key']};});_0x3e5e5d[_0xe014('0x32')]=_[_0xe014('0x33')](_0x48b7d1,_0xe014('0x2c'));_0x3e5e5d[_0xe014('0x34')]=_[_0xe014('0x35')](_0x1cf8d3[_0xe014('0x34')]);_0x3e5e5d['filters']=_[_0xe014('0x36')](_0x3e5e5d['model'],_0x3e5e5d[_0xe014('0x34')]);_0x39c458[_0xe014('0x37')]=_[_0xe014('0x36')](_0x3e5e5d['model'],qs[_0xe014('0x38')](_0x1cf8d3[_0xe014('0x34')]['fields']));_0x39c458[_0xe014('0x37')]=_0x39c458[_0xe014('0x37')][_0xe014('0x39')]?_0x39c458['attributes']:_0x3e5e5d['model'];if(!_0x1cf8d3[_0xe014('0x34')][_0xe014('0x3a')](_0xe014('0x3b'))){_0x39c458[_0xe014('0x3c')]=qs[_0xe014('0x3c')](_0x1cf8d3[_0xe014('0x34')][_0xe014('0x3c')]);_0x39c458[_0xe014('0x22')]=qs['offset'](_0x1cf8d3[_0xe014('0x34')][_0xe014('0x22')]);}_0x39c458['order']=qs[_0xe014('0x3d')](_0x1cf8d3[_0xe014('0x34')][_0xe014('0x3d')]);_0x39c458[_0xe014('0x3e')]=qs['filters'](_[_0xe014('0x3f')](_0x1cf8d3[_0xe014('0x34')],_0x3e5e5d[_0xe014('0x40')]),_0x48b7d1);if(_0x1cf8d3[_0xe014('0x34')]['filter']){_0x39c458[_0xe014('0x3e')]=_[_0xe014('0x41')](_0x39c458[_0xe014('0x3e')],{'$or':_[_0xe014('0x33')](_0x48b7d1,function(_0x1d5acc){if(_0x1d5acc[_0xe014('0x31')]!==_0xe014('0x42')){var _0x36f54d={};_0x36f54d[_0x1d5acc[_0xe014('0x2c')]]={'$like':'%'+_0x1cf8d3[_0xe014('0x34')][_0xe014('0x43')]+'%'};return _0x36f54d;}})});}_0x39c458=_[_0xe014('0x41')]({},_0x39c458,_0x1cf8d3[_0xe014('0x44')]);var _0x597ff4={'where':_0x39c458[_0xe014('0x3e')]};return db[_0xe014('0x45')][_0xe014('0x21')](_0x597ff4)[_0xe014('0x29')](function(_0x371d03){_0x5b9548[_0xe014('0x21')]=_0x371d03;if(_0x1cf8d3[_0xe014('0x34')]['includeAll']){_0x39c458['include']=[{'all':!![]}];}return db[_0xe014('0x45')][_0xe014('0x46')](_0x39c458);})['then'](function(_0xfd32e8){_0x5b9548[_0xe014('0x47')]=_0xfd32e8;return _0x5b9548;})[_0xe014('0x29')](respondWithFilteredResult(_0x4c59ad,_0x39c458))[_0xe014('0x48')](handleError(_0x4c59ad,null));};exports[_0xe014('0x49')]=function(_0x4300fa,_0x4cdfe7){var _0x1ddd2a={'raw':![],'where':{'id':_0x4300fa[_0xe014('0x4a')]['id']}},_0x368911={};_0x368911[_0xe014('0x32')]=_['keys'](db['UserProfile'][_0xe014('0x2f')]);_0x368911[_0xe014('0x34')]=_[_0xe014('0x35')](_0x4300fa[_0xe014('0x34')]);_0x368911[_0xe014('0x40')]=_[_0xe014('0x36')](_0x368911[_0xe014('0x32')],_0x368911[_0xe014('0x34')]);_0x1ddd2a['attributes']=_['intersection'](_0x368911[_0xe014('0x32')],qs[_0xe014('0x38')](_0x4300fa['query'][_0xe014('0x38')]));_0x1ddd2a['attributes']=_0x1ddd2a[_0xe014('0x37')][_0xe014('0x39')]?_0x1ddd2a[_0xe014('0x37')]:_0x368911['model'];if(_0x4300fa[_0xe014('0x34')][_0xe014('0x4b')]){_0x1ddd2a[_0xe014('0x4c')]=[{'all':!![]}];}_0x1ddd2a=_[_0xe014('0x41')]({},_0x1ddd2a,_0x4300fa[_0xe014('0x44')]);return db[_0xe014('0x45')][_0xe014('0x4d')](_0x1ddd2a)[_0xe014('0x29')](handleEntityNotFound(_0x4cdfe7,null))[_0xe014('0x29')](respondWithResult(_0x4cdfe7,null))[_0xe014('0x48')](handleError(_0x4cdfe7,null));};exports[_0xe014('0x4e')]=function(_0x34b077,_0x5c8fdc){return db[_0xe014('0x45')][_0xe014('0x4e')](_0x34b077[_0xe014('0x4f')],{})['then'](respondWithResult(_0x5c8fdc,0xc9))[_0xe014('0x48')](handleError(_0x5c8fdc,null));};exports[_0xe014('0x50')]=function(_0x50e5fd,_0x2f5ff1){var _0x3ed83a={'where':{'id':_0x50e5fd['params']['id']}},_0x47779d={};_0x47779d['model']=_[_0xe014('0x35')](db[_0xe014('0x45')][_0xe014('0x2f')]);_0x3ed83a[_0xe014('0x37')]=_[_0xe014('0x36')](_0x47779d['model'],qs[_0xe014('0x38')](_0x50e5fd[_0xe014('0x34')][_0xe014('0x38')]));_0x3ed83a[_0xe014('0x37')]=_0x3ed83a[_0xe014('0x37')]['length']?_0x3ed83a[_0xe014('0x37')]:_0x47779d['model'];if(_0x50e5fd['query']['includeAll']){_0x3ed83a['include']=[{'all':!![]}];}_0x3ed83a=_[_0xe014('0x41')]({},_0x3ed83a,_0x50e5fd[_0xe014('0x44')]);return db[_0xe014('0x45')][_0xe014('0x4d')](_0x3ed83a)['then'](handleEntityNotFound(_0x2f5ff1,null))[_0xe014('0x29')](function(_0x2f874e){if(_0x2f874e){var _0x14d456=_0x2f874e['get']({'plain':!![]});_0x14d456=qs['omit'](_0x14d456,['id',_0xe014('0x51'),'updatedAt',_0xe014('0x52')]);_0x50e5fd[_0xe014('0x4f')]=_[_0xe014('0x53')](_0x50e5fd[_0xe014('0x4f')],['id',_0xe014('0x51'),_0xe014('0x54')]);return db[_0xe014('0x55')][_0xe014('0x56')](function(_0x4410ca){return db['UserProfile'][_0xe014('0x4e')](_[_0xe014('0x41')](_0x14d456,_0x50e5fd[_0xe014('0x4f')]),{'include':_0x50e5fd[_0xe014('0x34')][_0xe014('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x4410ca})[_0xe014('0x29')](function(_0x31c0ed){var _0x58c0eb=_0x31c0ed[_0xe014('0x57')]({'plain':!![]});return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x50e5fd[_0xe014('0x4a')]['id']},'raw':!![]})[_0xe014('0x29')](function(_0x4c1c6d){if(_0x4c1c6d){return BPromise['each'](_0x4c1c6d,function(_0x21ec01){return new BPromise(function(_0x3a7d60,_0x3f0cc7){if(_0x21ec01[_0xe014('0x59')]===null||_0x21ec01[_0xe014('0x59')]===0x1)_0x3a7d60(null);return db[_0xe014('0x5a')][_0xe014('0x46')]({'where':{'sectionId':_0x21ec01['id']},'raw':!![]})[_0xe014('0x29')](function(_0x579bb3){var _0x3f2128=_[_0xe014('0x33')](_0x579bb3,function(_0x39512b){return qs[_0xe014('0x53')](_0x39512b,['id',_0xe014('0x51'),_0xe014('0x54'),'sectionId']);});_0x3a7d60(_0x3f2128);})[_0xe014('0x48')](function(_0xf67d3){_0x3f0cc7(_0xf67d3);});})[_0xe014('0x29')](function(_0x29373c){var _0x202da4=qs['omit'](_0x21ec01,['id','createdAt',_0xe014('0x54')]);_0x202da4[_0xe014('0x5b')]=_0x58c0eb['id'];if(_0x29373c)_0x202da4[_0xe014('0x5c')]=_0x29373c;return _0x202da4;})[_0xe014('0x29')](function(_0x4ae8a0){return db['UserProfileSection'][_0xe014('0x4e')](_0x4ae8a0,{'include':[{'model':db['UserProfileResource'],'as':_0xe014('0x5c')}],'raw':!![],'transaction':_0x4410ca});});})[_0xe014('0x29')](function(){return _0x58c0eb;});}});});});}})[_0xe014('0x29')](respondWithResult(_0x2f5ff1,0xc9))[_0xe014('0x48')](handleError(_0x2f5ff1,null));};exports[_0xe014('0x5d')]=function(_0x475250,_0x1046e5){if(_0x475250['body']['id']){delete _0x475250[_0xe014('0x4f')]['id'];}return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x475250[_0xe014('0x4a')]['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x1046e5,null))[_0xe014('0x29')](saveUpdates(_0x475250[_0xe014('0x4f')],null))[_0xe014('0x29')](respondWithResult(_0x1046e5,null))['catch'](handleError(_0x1046e5,null));};exports[_0xe014('0x28')]=function(_0x684aa1,_0x59201a){return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x684aa1['params']['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x59201a,null))[_0xe014('0x29')](removeEntity(_0x59201a,null))[_0xe014('0x48')](handleError(_0x59201a,null));};exports[_0xe014('0x5e')]=function(_0x529aa5,_0x19e1f6){return db[_0xe014('0x45')][_0xe014('0x5e')]()[_0xe014('0x29')](respondWithResult(_0x19e1f6,null))[_0xe014('0x48')](handleError(_0x19e1f6,null));};exports['addSections']=function(_0x544416,_0x221635){var _0x296025=_0x544416[_0xe014('0x4f')];return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x544416['params']['id']}})['then'](handleEntityNotFound(_0x221635,null))[_0xe014('0x29')](function(_0x492337){if(_0x492337){return db[_0xe014('0x55')][_0xe014('0x56')](function(_0x256c51){return db['UserProfileSection'][_0xe014('0x28')]({'where':{'userProfileId':_0x544416['params']['id'],'sectionId':_[_0xe014('0x33')](_0x296025,function(_0x4d1c22){return _0x4d1c22[_0xe014('0x5f')];})},'transaction':_0x256c51})[_0xe014('0x29')](function(){var _0x3d722a=_[_0xe014('0x33')](_0x296025,function(_0x3e85ae){_0x3e85ae[_0xe014('0x5b')]=_0x544416['params']['id'];return _0x3e85ae;});var _0x5e2124=[];return BPromise['each'](_0x3d722a,function(_0x42416c){return db[_0xe014('0x58')]['create'](_0x42416c,{'include':[{'model':db['UserProfileResource'],'as':_0xe014('0x5c')}],'raw':!![],'transaction':_0x256c51})[_0xe014('0x29')](function(_0x3f5110){_0x5e2124[_0xe014('0x60')](_0x3f5110['get']({'plain':!![]}));});})[_0xe014('0x29')](function(){return _0x5e2124;});});});}})[_0xe014('0x29')](function(_0x26fd86){return _0x26fd86;})['then'](respondWithResult(_0x221635,null))[_0xe014('0x48')](handleError(_0x221635,null));};exports['removeSections']=function(_0x299a38,_0x9f04f3){var _0x7c610b;return db['UserProfile'][_0xe014('0x4d')]({'where':{'id':_0x299a38[_0xe014('0x4a')]['id']},'attributes':['id','name']})[_0xe014('0x29')](handleEntityNotFound(_0x9f04f3,null))[_0xe014('0x29')](function(_0x5b1811){if(_0x5b1811){_0x7c610b=_0x5b1811;return db['UserProfileSection'][_0xe014('0x28')]({'where':{'userProfileId':_0x299a38[_0xe014('0x4a')]['id'],'sectionId':_0x299a38[_0xe014('0x34')][_0xe014('0x61')]}});}})['then'](function(){return _0x7c610b;})[_0xe014('0x29')](respondWithStatusCode(_0x9f04f3,null))[_0xe014('0x48')](handleError(_0x9f04f3,null));};exports[_0xe014('0x62')]=function(_0x172f71,_0x32baaf){var _0x27e7be=[];var _0x1ebfcf=[];return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x172f71[_0xe014('0x4a')]['id']},'raw':!![]})[_0xe014('0x29')](function(_0x392e22){_0x27e7be=_['filter'](_0x392e22,function(_0x3a3fe1){return _0x3a3fe1[_0xe014('0x63')]===0x1||_[_0xe014('0x64')]([0x3eb,0x709],_0x3a3fe1[_0xe014('0x5f')]);});if(!_[_0xe014('0x65')](_0x27e7be)){return _[_0xe014('0x33')](_0x27e7be,function(_0x3b0ef5){return _0x3b0ef5['sectionId'];});}else{return;}})[_0xe014('0x29')](function(_0x43d3d4){if(_0x43d3d4)_0x1ebfcf=_0x43d3d4;if(_[_0xe014('0x64')](_0x1ebfcf,0x64)){var _0x9bc974=_['find'](_0x27e7be,{'sectionId':0x64});return hasDefaultDashboard(_0x9bc974)['then'](function(_0x936709){return _['map'](_0x27e7be,function(_0x206806){if(_0x206806['sectionId']===0x64){_0x206806['subsections']=_0x936709;}return _0x206806;});});}else{return;}})[_0xe014('0x29')](function(_0x809857){if(_0x809857)_0x27e7be=_0x809857;if(_[_0xe014('0x64')](_0x1ebfcf,0x3eb)){var _0x573500=_['find'](_0x27e7be,{'sectionId':0x3eb});return getCustomDashboards(_0x573500)[_0xe014('0x29')](function(_0x538b05){return _[_0xe014('0x33')](_0x27e7be,function(_0x4ef7c5){if(_0x573500[_0xe014('0x63')]){if(_0x4ef7c5[_0xe014('0x5f')]===0x3eb){_0x4ef7c5[_0xe014('0x66')]=_0x538b05;}}else{if(_0x4ef7c5[_0xe014('0x5f')]===0x64){_0x4ef7c5[_0xe014('0x66')]=_0x538b05;}}return _0x4ef7c5;});});}else{return;}})[_0xe014('0x29')](function(_0x1a4e6e){if(_0x1a4e6e)_0x27e7be=_0x1a4e6e;if(_[_0xe014('0x64')](_0x1ebfcf,0x709)){var _0xd61418=_[_0xe014('0x4d')](_0x27e7be,{'sectionId':0x709});return getPlugins(_0xd61418)[_0xe014('0x29')](function(_0x19b003){if(_0xd61418[_0xe014('0x63')]){return _['map'](_0x27e7be,function(_0x3a3eef){if(_0x3a3eef['sectionId']===0x709){_0x3a3eef[_0xe014('0x66')]=_0x19b003;}return _0x3a3eef;});}else{var _0x3c9f14={'sectionId':0x76c,'enabled':0x1,'subsections':_0x19b003};var _0x3633ea=_[_0xe014('0x33')](_0x27e7be);_0x3633ea[_0xe014('0x60')](_0x3c9f14);return _0x3633ea;}});}else{return;}})[_0xe014('0x29')](function(_0x408d94){if(_0x408d94)_0x27e7be=_0x408d94;return _[_0xe014('0x43')](_0x27e7be,[_0xe014('0x63'),0x1]);})['then'](respondWithResult(_0x32baaf,null))[_0xe014('0x48')](handleError(_0x32baaf,null));};function hasDefaultDashboard(_0x5aabe5){var _0xaf65d7=[0x65];return new BPromise(function(_0x4b778f,_0x381e64){try{if(_0x5aabe5[_0xe014('0x59')]){_0x4b778f(_0xaf65d7);}else{return db[_0xe014('0x5a')][_0xe014('0x67')]({'where':{'sectionId':_0x5aabe5['id']},'raw':!![]})[_0xe014('0x29')](function(_0x1528f0){_0x1528f0?_0x4b778f(_0xaf65d7):_0x4b778f();});}}catch(_0x1ef942){_0x381e64(_0x1ef942);}});}function getCustomDashboards(_0x1e0546){var _0x1a1750=[];return new BPromise(function(_0x47cdef,_0x40faf6){try{if(_0x1e0546['autoAssociation']){return db['Dashboard'][_0xe014('0x46')]({'raw':!![]})['then'](function(_0x412a3f){_0x412a3f['forEach'](function(_0x432296){_0x1a1750[_0xe014('0x60')](_0x432296['id']+0x1869f);});_0x47cdef(_0x1a1750);});}else{return db[_0xe014('0x5a')][_0xe014('0x46')]({'where':{'sectionId':_0x1e0546['id']},'raw':!![]})[_0xe014('0x29')](function(_0x411052){_0x411052[_0xe014('0x68')](function(_0x10ab8d){_0x1a1750[_0xe014('0x60')](_0x10ab8d[_0xe014('0x69')]+0x1869f);});_0x47cdef(_0x1a1750);});}}catch(_0x23479e){_0x40faf6(_0x23479e);}});}function getPlugins(_0x5642f2){var _0x188ca2=[];return new BPromise(function(_0x2fb4c7,_0x1266fe){try{if(_0x5642f2[_0xe014('0x59')]){return db['Plugin'][_0xe014('0x46')]({'raw':!![]})[_0xe014('0x29')](function(_0x1d7a7c){_0x1d7a7c['forEach'](function(_0x285338){_0x188ca2['push'](_0x285338['id']+0x15b38);});_0x2fb4c7(_0x188ca2);});}else{return db[_0xe014('0x5a')][_0xe014('0x46')]({'where':{'sectionId':_0x5642f2['id']},'raw':!![]})[_0xe014('0x29')](function(_0x15cd4e){_0x15cd4e[_0xe014('0x68')](function(_0x5eec00){_0x188ca2[_0xe014('0x60')](_0x5eec00[_0xe014('0x69')]+0x15b38);});_0x2fb4c7(_0x188ca2);});}}catch(_0x5a000d){_0x1266fe(_0x5a000d);}});}exports[_0xe014('0x6a')]=function(_0x2605e0,_0x1681d6){return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x2605e0[_0xe014('0x4a')]['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x1681d6,null))[_0xe014('0x29')](function(_0x1d4ec3){if(_0x1d4ec3){return db[_0xe014('0x55')][_0xe014('0x56')](function(_0x590fd1){return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x2605e0[_0xe014('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xe014('0x29')](function(_0xb55927){if(_0xb55927){return db[_0xe014('0x58')][_0xe014('0x28')]({'where':{'userProfileId':_0x2605e0[_0xe014('0x4a')]['id'],'id':_[_0xe014('0x33')](_0xb55927,function(_0x254554){return _0x254554['id'];})},'transaction':_0x590fd1});}})[_0xe014('0x29')](function(_0x49505f){var _0x44edaa=_[_0xe014('0x33')](_0x2605e0[_0xe014('0x4f')],function(_0x1dfbdd){_0x1dfbdd['userProfileId']=_0x2605e0[_0xe014('0x4a')]['id'];return _0x1dfbdd;});return db[_0xe014('0x58')][_0xe014('0x6b')](_0x44edaa,{'raw':!![],'transaction':_0x590fd1});})[_0xe014('0x29')](function(_0x91e091){var _0x4fabe3=_[_0xe014('0x43')](_['map'](_0x91e091,function(_0x927846){return _0x927846[_0xe014('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x4fabe3){return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x2605e0[_0xe014('0x4a')]['id'],'sectionId':_[_0xe014('0x33')](_0x4fabe3,function(_0x45c525){return _0x45c525['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xe014('0x29')](function(_0x4532c7){var _0x55b366=_[_0xe014('0x33')](_0x2605e0[_0xe014('0x4f')],function(_0x12bb5e){_0x12bb5e[_0xe014('0x5b')]=_0x2605e0['params']['id'];return _0x12bb5e;});return db[_0xe014('0x5a')]['bulkCreate'](_0x55b366,{'raw':!![],'transaction':_0x590fd1});});}})['catch'](handleError(_0x1681d6,null));});}})[_0xe014('0x29')](function(_0x2d44f8){var _0x255746=_[_0xe014('0x33')](_0x2d44f8,function(_0x3d2e20){return _0x3d2e20[_0xe014('0x57')]({'plain':!![]});});})[_0xe014('0x29')](respondWithResult(_0x1681d6,null))[_0xe014('0x48')](handleError(_0x1681d6,null));};exports['removeResources']=function(_0x107a04,_0x2a560a,_0x3b6408){return db[_0xe014('0x45')]['find']({'where':{'id':_0x107a04['params']['id']}})['then'](handleEntityNotFound(_0x2a560a,null))[_0xe014('0x29')](function(_0x455da8){if(_0x455da8){return _0x455da8[_0xe014('0x6c')](_0x107a04['query']['ids']);}})[_0xe014('0x29')](respondWithStatusCode(_0x2a560a,null))[_0xe014('0x48')](handleError(_0x2a560a,null));};exports[_0xe014('0x6d')]=function(_0xcc90d9,_0x3b3836){var _0x3d0564={'raw':![],'where':{}};var _0x508506={};var _0x3a589e={'count':0x0,'rows':[]};var _0x4ac5c6=_0xcc90d9[_0xe014('0x34')]['section'];if(typeof _0x4ac5c6===_0xe014('0x6e')){throw new db[(_0xe014('0x6f'))][(_0xe014('0x70'))](_0xe014('0x71'));}var _0x2385b3=_0xcc90d9['query'][_0xe014('0x72')]||![];var _0x11522c=getQueryModels(_0x4ac5c6,_0x2385b3);if(typeof _0x11522c[_0xe014('0x73')]==='undefined'){throw new db[(_0xe014('0x6f'))]['ValidationError'](_0xe014('0x74')+_0x4ac5c6+'\x27');}var _0x49c4bb=[];if(!_['isEmpty'](_0x11522c[_0xe014('0x75')])){_0x49c4bb=_0x11522c[_0xe014('0x75')];}else{_0x49c4bb=[{'name':_0x4ac5c6}];}return db['UserProfile']['findOne']({'where':{'id':_0xcc90d9[_0xe014('0x4a')]['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x3b3836,null))[_0xe014('0x29')](function(_0x413ddf){if(_0x413ddf){var _0x5b30c3=[];for(var _0x1a7bdd=0x0;_0x1a7bdd<_0x49c4bb[_0xe014('0x39')];_0x1a7bdd++){_0x5b30c3[_0xe014('0x60')](db[_0xe014('0x58')][_0xe014('0x67')]({'where':{'userProfileId':_0x413ddf['id'],'name':_0x49c4bb[_0x1a7bdd][_0xe014('0x2c')]},'raw':!![]}));}return BPromise[_0xe014('0x76')](_0x5b30c3);}})[_0xe014('0x29')](function(_0x294cef){var _0x2a2f69=_[_0xe014('0x43')](_0x294cef,function(_0x4c7c5e){return _0x4c7c5e?_0x4c7c5e:undefined;});var _0x5ed568=_[_0xe014('0x43')](_0x49c4bb,[_0xe014('0x77'),!![]]);var _0x1d6bfe=_[_0xe014('0x65')](_0x2a2f69)&&_[_0xe014('0x65')](_0x5ed568)?null:_['union'](_0x5ed568,_0x2a2f69);if(_0x1d6bfe){var _0x51d917=[];for(var _0x11f73f=0x0;_0x11f73f<_0x1d6bfe[_0xe014('0x39')];_0x11f73f++){var _0x437b98=_[_0xe014('0x4d')](_0x49c4bb,function(_0x44d927){return _0x1d6bfe[_0x11f73f]?_0x44d927[_0xe014('0x2c')]===_0x1d6bfe[_0x11f73f][_0xe014('0x2c')]:null;});if(_0x437b98){if(_0x1d6bfe[_0x11f73f]['ignore']){_0x51d917[_0xe014('0x60')](getAllResources(_0x11522c[_0xe014('0x73')],_0x1d6bfe[_0x11f73f]));}else{if(!_0x1d6bfe[_0x11f73f][_0xe014('0x59')]){_0x51d917[_0xe014('0x60')](getAllowedResources(_0x437b98,_0x1d6bfe[_0x11f73f],_0x11522c[_0xe014('0x73')]));}else{if(_0x437b98[_0xe014('0x32')]){_0x51d917[_0xe014('0x60')](getAllFilteredResources(_0x437b98,_0x1d6bfe[_0x11f73f]));}}}}}return BPromise[_0xe014('0x76')](_0x51d917);}else{return null;}})['then'](function(_0x5f0a22){var _0x57b3d4=_0x5f0a22;var _0x94f0d2=null;if(_0x57b3d4){_0x94f0d2=_0x57b3d4[_0xe014('0x39')]===0x1?_0x57b3d4[0x0]:null;}if(_0x94f0d2||_0x57b3d4){var _0x2897b3=db[_0x11522c['childModel']][_0xe014('0x2f')];_0x508506[_0xe014('0x32')]=_[_0xe014('0x35')](_0x2897b3);_0x508506['query']=_[_0xe014('0x35')](_0xcc90d9[_0xe014('0x34')]);_0x508506[_0xe014('0x40')]=_['intersection'](_0x508506[_0xe014('0x32')],_0x508506[_0xe014('0x34')]);_0x3d0564[_0xe014('0x37')]=_[_0xe014('0x36')](_0x508506[_0xe014('0x32')],qs[_0xe014('0x38')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x38')]));_0x3d0564['attributes']=_0x3d0564['attributes']['length']?_0x3d0564['attributes']:_0x508506[_0xe014('0x32')];if(!_0xcc90d9[_0xe014('0x34')][_0xe014('0x3a')]('nolimit')){_0x3d0564[_0xe014('0x3c')]=qs[_0xe014('0x3c')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x3c')]);_0x3d0564[_0xe014('0x22')]=qs[_0xe014('0x22')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x22')]);}_0x3d0564[_0xe014('0x78')]=qs[_0xe014('0x3d')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x3d')]);_0x3d0564[_0xe014('0x3e')]=qs[_0xe014('0x40')](_[_0xe014('0x3f')](_0xcc90d9[_0xe014('0x34')],_0x508506[_0xe014('0x40')]));if(_0xcc90d9['query']['filter']){_0x3d0564[_0xe014('0x3e')]=_[_0xe014('0x41')](_0x3d0564[_0xe014('0x3e')],{'$or':_['map'](_0x2897b3,function(_0x50f76f){if(_0x50f76f[_0xe014('0x31')]['key']!==_0xe014('0x42')){var _0x211641={};_0x211641[_0x50f76f['field']]={'$like':'%'+_0xcc90d9[_0xe014('0x34')][_0xe014('0x43')]+'%'};return _0x211641;}})});}var _0x5a1496=[];if(_0x94f0d2){var _0x249351=_[_0xe014('0x4d')](_0x49c4bb,[_0xe014('0x2c'),_0x94f0d2[_0xe014('0x2c')]]);if(_0x249351[_0xe014('0x79')]){var _0x296c47={};if(_0x11522c[_0xe014('0x73')]===_0xe014('0x7a')){_0x296c47[_0x249351[_0xe014('0x7b')]]=_['map'](_0x94f0d2['associatedResources'],'id');}else{_0x296c47[_0x249351['foreignKey']]=_0x94f0d2['associatedResources'];}_0x5a1496[_0xe014('0x60')](_0x296c47);}else{_0x3d0564[_0xe014('0x3e')]['id']=_0x94f0d2['associatedResources'];}}else{for(var _0x5c42e9=0x0;_0x5c42e9<_0x57b3d4[_0xe014('0x39')];_0x5c42e9++){var _0x249351=_['find'](_0x49c4bb,[_0xe014('0x2c'),_0x57b3d4[_0x5c42e9][_0xe014('0x2c')]]);if(_0x249351[_0xe014('0x79')]){var _0x296c47={};_0x296c47[_0x249351['foreignKey']]=_0x57b3d4[_0x5c42e9][_0xe014('0x7c')];_0x5a1496[_0xe014('0x60')](_0x296c47);}else{if(!_0x3d0564[_0xe014('0x3e')]['id'])_0x3d0564['where']['id']=[];_0x57b3d4[_0x5c42e9][_0xe014('0x7c')]['forEach'](function(_0x16db46){_0x3d0564[_0xe014('0x3e')]['id'][_0xe014('0x60')](_0x16db46);});}}}if(!_['isEmpty'](_0x5a1496)){_0x3d0564[_0xe014('0x3e')]=_[_0xe014('0x41')](_0x3d0564[_0xe014('0x3e')],{'$and':{'$or':_0x5a1496}});}_0x3d0564=_[_0xe014('0x41')]({},_0x3d0564,_0xcc90d9[_0xe014('0x44')]);if(_0x94f0d2&&!_0x94f0d2[_0xe014('0x59')]&&_0x11522c[_0xe014('0x73')]==='AnalyticExtractedReport'){if(_0xcc90d9[_0xe014('0x34')][_0xe014('0x4b')]){_0x3d0564['include']=[{'all':!![]}];}return db[_0x11522c[_0xe014('0x73')]][_0xe014('0x46')](_0x3d0564)[_0xe014('0x29')](function(_0x435763){var _0x12bd70=[];_0x435763[_0xe014('0x68')](function(_0x345fa9){var _0x1ad02a;switch(_0x345fa9[_0xe014('0x7d')]){case _0xe014('0x7e'):_0x1ad02a=_[_0xe014('0x4d')](_0x94f0d2[_0xe014('0x7c')],function(_0x18399d){return _0x18399d['id']===_0x345fa9['reportId']&&_0x18399d[_0xe014('0x31')]===_0xe014('0x7f');});break;case'custom':_0x1ad02a=_['find'](_0x94f0d2[_0xe014('0x7c')],function(_0x897e84){return _0x897e84['id']===_0x345fa9[_0xe014('0x80')]&&_0x897e84[_0xe014('0x31')]===_0xe014('0x81');});break;}if(_0x1ad02a)_0x12bd70[_0xe014('0x60')](_0x345fa9);});_0x3a589e[_0xe014('0x21')]=_0x12bd70['length'];_0x3a589e[_0xe014('0x47')]=_0x12bd70;return _0x3a589e;});}else{return db[_0x11522c['childModel']]['count']({'where':_0x3d0564[_0xe014('0x3e')]})[_0xe014('0x29')](function(_0x412125){_0x3a589e['count']=_0x412125;if(_0xcc90d9[_0xe014('0x34')][_0xe014('0x4b')]){if(_0x11522c[_0xe014('0x73')]===_0xe014('0x82')){_0x3d0564[_0xe014('0x4c')]=[{'model':db[_0xe014('0x83')],'as':_0xe014('0x84'),'attributes':['id',_0xe014('0x2c'),'color'],'required':_0xcc90d9[_0xe014('0x34')][_0xe014('0x85')]?!![]:![]},{'model':db[_0xe014('0x83')],'as':'ThroughTags','attributes':['id',_0xe014('0x2c'),_0xe014('0x86')],'through':_0xcc90d9[_0xe014('0x34')]['tag']?{'attributes':[],'where':{'TagId':_0xcc90d9['query'][_0xe014('0x85')]||undefined}}:{},'required':_0xcc90d9[_0xe014('0x34')][_0xe014('0x85')]?!![]:![]}];}else{_0x3d0564[_0xe014('0x4c')]=[{'all':!![]}];}}return db[_0x11522c['childModel']][_0xe014('0x46')](_0x3d0564);})[_0xe014('0x29')](function(_0xe5cc08){_0x3a589e[_0xe014('0x47')]=_0xe5cc08;return _0x3a589e;});}}else{return _0x3a589e;}})[_0xe014('0x29')](respondWithFilteredResult(_0x3b3836,_0x3d0564))[_0xe014('0x48')](handleError(_0x3b3836,null));};function getAllResources(_0x431e92,_0x2f24cf){return new BPromise(function(_0x40a907,_0x407fe1){if(_0x2f24cf){var _0x97f5d8=_0x2f24cf[_0xe014('0x43')]?{[_0x2f24cf[_0xe014('0x43')][_0xe014('0x79')]]:_0x2f24cf[_0xe014('0x43')]['value']}:undefined;return db[_0x431e92][_0xe014('0x46')]({'where':_0x97f5d8,'raw':!![]})[_0xe014('0x29')](function(_0x436039){_0x2f24cf['associatedResources']=_[_0xe014('0x33')](_0x436039,'id');_0x40a907(_0x2f24cf);})[_0xe014('0x48')](function(_0x5168b9){_0x407fe1(_0x5168b9);});}else{_0x40a907(null);}});}function getAllFilteredResources(_0x590586,_0x28e597){return new BPromise(function(_0xadefef,_0x1e7d4e){var _0x36ac9c=_0x590586[_0xe014('0x43')]?{[_0x590586[_0xe014('0x43')][_0xe014('0x79')]]:_0x590586[_0xe014('0x43')]['value']}:undefined;return db[_0x590586[_0xe014('0x32')]]['findAll']({'where':_0x36ac9c,'raw':!![]})['then'](function(_0x4ec7fd){_0x28e597[_0xe014('0x7c')]=_['map'](_0x4ec7fd,function(_0x57c48b){return _0x57c48b[_0xe014('0x2c')];});_0xadefef(_0x28e597);})[_0xe014('0x48')](function(_0x13357a){_0x1e7d4e(_0x13357a);});});}function getAllowedResources(_0x5adaa6,_0x2e9e36,_0x5f1323){return new BPromise(function(_0x22533f,_0x59c698){if(_0x2e9e36){return db['UserProfileResource'][_0xe014('0x46')]({'where':{'sectionId':_0x2e9e36['id']},'raw':!![]})[_0xe014('0x29')](function(_0x3e455e){if(_0x5adaa6['field']&&_0x5adaa6[_0xe014('0x79')]!=='id'){_0x2e9e36[_0xe014('0x7c')]=_[_0xe014('0x33')](_0x3e455e,function(_0x6df8b5){return _0x6df8b5[_0x5adaa6['field']];});}else{if(_0x5f1323===_0xe014('0x7a')){_0x2e9e36[_0xe014('0x7c')]=_[_0xe014('0x33')](_0x3e455e,function(_0x2fb198){return{'id':_0x2fb198[_0xe014('0x69')],'type':_0x2fb198[_0xe014('0x31')]};});}else{_0x2e9e36[_0xe014('0x7c')]=_[_0xe014('0x33')](_0x3e455e,function(_0x48e74e){return _0x48e74e['resourceId'];});}}_0x22533f(_0x2e9e36);})[_0xe014('0x48')](function(_0x3e631d){_0x59c698(_0x3e631d);});}else{_0x22533f(null);}});}function getQueryModels(_0x8a0e2a,_0x44de78){var _0x663c09=_0x8a0e2a['toLowerCase']();var _0x2705c5={'childModel':undefined,'parentSections':[]};switch(_0x663c09){case _0xe014('0x87'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x88');break;case _0xe014('0x89'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x8a');break;case _0xe014('0x8b'):_0x2705c5['childModel']=_0xe014('0x8c');_0x2705c5[_0xe014('0x75')]=[{'name':_0xe014('0x8d'),'field':'name','foreignKey':_0xe014('0x8e')}];break;case'projects':_0x2705c5[_0xe014('0x73')]=_0xe014('0x8f');break;case _0xe014('0x90'):_0x2705c5['childModel']=_0xe014('0x82');_0x2705c5['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xe014('0x91'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x92');break;case _0xe014('0x93'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x94');break;case _0xe014('0x95'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x96');break;case _0xe014('0x97'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x98');break;case _0xe014('0x99'):_0x2705c5['childModel']='ChatWebsite';break;case _0xe014('0x9a'):_0x2705c5['childModel']='FaxQueue';break;case'faxaccounts':_0x2705c5[_0xe014('0x73')]=_0xe014('0x9b');break;case _0xe014('0x9c'):case _0xe014('0x9d'):case'outboundroutes':_0x2705c5[_0xe014('0x73')]=_0xe014('0x9e');break;case'contexts':_0x2705c5[_0xe014('0x73')]=_0xe014('0x9f');break;case _0xe014('0xa0'):_0x2705c5['childModel']=_0xe014('0xa1');break;case _0xe014('0xa2'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xa3');_0x2705c5['parentSections']=[{'name':_0xe014('0xa4'),'field':_0xe014('0x2c'),'foreignKey':_0xe014('0xa5'),'model':_0xe014('0xa6'),'filter':{'field':_0xe014('0xa7'),'value':[_0xe014('0xa8')]}},{'name':_0xe014('0xa9'),'field':'name','foreignKey':'membername','model':_0xe014('0xa6'),'filter':{'field':_0xe014('0xa7'),'value':[_0xe014('0xaa')]}},{'name':_0xe014('0xab'),'field':_0xe014('0x2c'),'foreignKey':_0xe014('0xac'),'model':_0xe014('0xad'),'filter':{'field':_0xe014('0x31'),'value':['inbound']}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xe014('0xac'),'model':_0xe014('0xad'),'filter':{'field':_0xe014('0x31'),'value':['outbound']}}];break;case'musiconholds':_0x2705c5[_0xe014('0x73')]=_0xe014('0xae');break;case'chanspies':_0x2705c5[_0xe014('0x73')]='VoiceChanSpy';break;case _0xe014('0xaf'):_0x2705c5['childModel']=_0xe014('0xb0');break;case _0xe014('0xb1'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xb2');break;case _0xe014('0xb3'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xb4');break;case'mailaccounts':_0x2705c5['childModel']=_0xe014('0xb5');break;case'mailsubstatuses':_0x2705c5[_0xe014('0x73')]=_0xe014('0xb6');break;case _0xe014('0xb7'):_0x2705c5['childModel']=_0xe014('0xb8');break;case _0xe014('0xb9'):_0x2705c5['childModel']='OpenchannelAccount';break;case _0xe014('0xba'):_0x2705c5['childModel']=_0xe014('0xbb');break;case'smsaccounts':_0x2705c5[_0xe014('0x73')]='SmsAccount';break;case _0xe014('0xbc'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xbd');break;case _0xe014('0xbe'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xbf');break;case _0xe014('0xc0'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xc1');break;case _0xe014('0xc2'):case _0xe014('0xc3'):_0x2705c5[_0xe014('0x73')]='VoiceQueue';if(_0x44de78){_0x2705c5['parentSections']=[{'name':_0xe014('0xab')},{'name':_0xe014('0xc4')}];}break;case _0xe014('0xc5'):case _0xe014('0xc6'):case _0xe014('0xc7'):_0x2705c5['childModel']=_0xe014('0xa6');if(_0x44de78){_0x2705c5[_0xe014('0x75')]=[{'name':'Users','filter':{'field':_0xe014('0xa7'),'value':[_0xe014('0xc8'),_0xe014('0xc9')]},'ignore':!![]},{'name':_0xe014('0xa4')},{'name':_0xe014('0xa9')}];}break;case _0xe014('0xca'):_0x2705c5[_0xe014('0x73')]='ZendeskAccount';break;case'salesforceaccounts':_0x2705c5['childModel']='SalesforceAccount';break;case _0xe014('0xcb'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xcc');break;case _0xe014('0xcd'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xce');break;case _0xe014('0xcf'):_0x2705c5['childModel']='DeskAccount';break;case'zohoaccounts':_0x2705c5[_0xe014('0x73')]=_0xe014('0xd0');break;case'vtigeraccounts':_0x2705c5[_0xe014('0x73')]='User';break;case _0xe014('0xd1'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd2');break;case _0xe014('0xd3'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd4');break;case _0xe014('0xd5'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd6');break;case'intervals':_0x2705c5[_0xe014('0x73')]='Interval';break;case _0xe014('0xd7'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd8');break;case _0xe014('0xd9'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xda');break;case'sounds':_0x2705c5['childModel']=_0xe014('0xdb');break;case'tags':_0x2705c5[_0xe014('0x73')]=_0xe014('0x83');break;case _0xe014('0xdc'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xdd');break;case'triggers':_0x2705c5[_0xe014('0x73')]=_0xe014('0xde');break;case'trunks':_0x2705c5[_0xe014('0x73')]=_0xe014('0xdf');break;case _0xe014('0xe0'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xe1');break;case _0xe014('0xe2'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xe3');break;case _0xe014('0xe4'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x7a');_0x2705c5['parentSections']=[{'name':_0xe014('0xe5'),'field':'id','foreignKey':_0xe014('0x80')}];break;case _0xe014('0xe6'):_0x2705c5['childModel']=_0xe014('0xe7');break;case _0xe014('0xbe'):_0x2705c5[_0xe014('0x73')]='WhatsappAccount';break;default:return _0x2705c5;}return _0x2705c5;} \ No newline at end of file +var _0xa049=['moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','includeAll','include','findAll','catch','show','params','options','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','UserProfileSection','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','describe','addSections','transaction','each','push','removeSections','ids','filter','enabled','isEmpty','includes','subsections','findOne','Dashboard','resourceId','Plugin','forEach','destroy','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','undefined','Invalid\x20section\x20\x27','parentSections','all','union','childModel','VIRTUAL','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','DefaultReports','custom','rows','Tag','tag','value','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','agent','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Interval','scheduler','sounds','Sound','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x448128,_0x3e7fba){var _0x162f5c=function(_0x1d0d46){while(--_0x1d0d46){_0x448128['push'](_0x448128['shift']());}};_0x162f5c(++_0x3e7fba);}(_0xa049,0x1db));var _0x9a04=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xa049[_0x4dcc2d];return _0x1bbd79;};'use strict';var pdf=require(_0x9a04('0x0'));var emlformat=require(_0x9a04('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9a04('0x2'));var jsonpatch=require(_0x9a04('0x3'));var rp=require(_0x9a04('0x4'));var moment=require(_0x9a04('0x5'));var BPromise=require(_0x9a04('0x6'));var Mustache=require(_0x9a04('0x7'));var util=require(_0x9a04('0x8'));var path=require(_0x9a04('0x9'));var sox=require(_0x9a04('0xa'));var csv=require('to-csv');var ejs=require(_0x9a04('0xb'));var fs=require('fs');var _=require(_0x9a04('0xc'));var squel=require('squel');var crypto=require(_0x9a04('0xd'));var jsforce=require(_0x9a04('0xe'));var deskjs=require(_0x9a04('0xf'));var toCsv=require(_0x9a04('0x10'));var querystring=require(_0x9a04('0x11'));var Papa=require(_0x9a04('0x12'));var Redis=require('ioredis');var authService=require(_0x9a04('0x13'));var qs=require(_0x9a04('0x14'));var as=require(_0x9a04('0x15'));var hardwareService=require(_0x9a04('0x16'));var logger=require(_0x9a04('0x17'))(_0x9a04('0x18'));var utils=require('../../config/utils');var config=require(_0x9a04('0x19'));var licenseUtil=require(_0x9a04('0x1a'));var db=require(_0x9a04('0x1b'))['db'];config['redis']=_[_0x9a04('0x1c')](config[_0x9a04('0x1d')],{'host':_0x9a04('0x1e'),'port':0x18eb});var socket=require(_0x9a04('0x1f'))(new Redis(config[_0x9a04('0x1d')]));require('./userProfile.socket')[_0x9a04('0x20')](socket);function respondWithStatusCode(_0x49a642,_0xef2ada){_0xef2ada=_0xef2ada||0xcc;return function(_0x83b9ff){if(_0x83b9ff){return _0x49a642['sendStatus'](_0xef2ada);}return _0x49a642[_0x9a04('0x21')](_0xef2ada)[_0x9a04('0x22')]();};}function respondWithResult(_0x549aeb,_0x8637bb){_0x8637bb=_0x8637bb||0xc8;return function(_0x3dda79){if(_0x3dda79){return _0x549aeb[_0x9a04('0x21')](_0x8637bb)[_0x9a04('0x23')](_0x3dda79);}};}function respondWithFilteredResult(_0xd86cdb,_0x54d0c8){return function(_0x357648){if(_0x357648){var _0x27e434=_0x357648[_0x9a04('0x24')],_0x39512c=_0x54d0c8[_0x9a04('0x25')],_0x29fd7d=_0x54d0c8['offset']+_0x54d0c8['limit'],_0x436c71;if(_0x29fd7d>=_0x27e434){_0x29fd7d=_0x27e434;_0x436c71=0xc8;}else{_0x436c71=0xce;}_0xd86cdb[_0x9a04('0x21')](_0x436c71);return _0xd86cdb[_0x9a04('0x26')](_0x9a04('0x27'),_0x39512c+'-'+_0x29fd7d+'/'+_0x27e434)[_0x9a04('0x23')](_0x357648);}return null;};}function patchUpdates(_0x8ff643){return function(_0x1b51a2){try{jsonpatch[_0x9a04('0x28')](_0x1b51a2,_0x8ff643,!![]);}catch(_0x22fd4a){return BPromise[_0x9a04('0x29')](_0x22fd4a);}return _0x1b51a2[_0x9a04('0x2a')]();};}function saveUpdates(_0x4c5116,_0x1d8eca){return function(_0x2e7e1c){if(_0x2e7e1c){return _0x2e7e1c['update'](_0x4c5116)[_0x9a04('0x2b')](function(_0xdbeafd){return _0xdbeafd;});}return null;};}function removeEntity(_0x38c515,_0x4a949c){return function(_0xbe2ae6){if(_0xbe2ae6){return _0xbe2ae6['destroy']()[_0x9a04('0x2b')](function(){_0x38c515[_0x9a04('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x119b6b,_0x2d5883){return function(_0xc1da46){if(!_0xc1da46){_0x119b6b[_0x9a04('0x2c')](0x194);}return _0xc1da46;};}function handleError(_0x13712e,_0x1c3cd1){_0x1c3cd1=_0x1c3cd1||0x1f4;return function(_0x5403ec){logger['error'](_0x5403ec[_0x9a04('0x2d')]);if(_0x5403ec[_0x9a04('0x2e')]){delete _0x5403ec[_0x9a04('0x2e')];}_0x13712e[_0x9a04('0x21')](_0x1c3cd1)[_0x9a04('0x2f')](_0x5403ec);};}exports[_0x9a04('0x30')]=function(_0x3fd094,_0x40717e){var _0xa0354f={},_0x505432={},_0xce8658={'count':0x0,'rows':[]};var _0x17c5f7=_[_0x9a04('0x31')](db[_0x9a04('0x32')][_0x9a04('0x33')],function(_0x33fb43){return{'name':_0x33fb43[_0x9a04('0x34')],'type':_0x33fb43[_0x9a04('0x35')][_0x9a04('0x36')]};});_0x505432[_0x9a04('0x37')]=_[_0x9a04('0x31')](_0x17c5f7,_0x9a04('0x2e'));_0x505432[_0x9a04('0x38')]=_[_0x9a04('0x39')](_0x3fd094[_0x9a04('0x38')]);_0x505432[_0x9a04('0x3a')]=_[_0x9a04('0x3b')](_0x505432[_0x9a04('0x37')],_0x505432[_0x9a04('0x38')]);_0xa0354f[_0x9a04('0x3c')]=_[_0x9a04('0x3b')](_0x505432[_0x9a04('0x37')],qs['fields'](_0x3fd094[_0x9a04('0x38')][_0x9a04('0x3d')]));_0xa0354f[_0x9a04('0x3c')]=_0xa0354f[_0x9a04('0x3c')][_0x9a04('0x3e')]?_0xa0354f['attributes']:_0x505432['model'];if(!_0x3fd094['query'][_0x9a04('0x3f')](_0x9a04('0x40'))){_0xa0354f[_0x9a04('0x41')]=qs[_0x9a04('0x41')](_0x3fd094[_0x9a04('0x38')][_0x9a04('0x41')]);_0xa0354f[_0x9a04('0x25')]=qs[_0x9a04('0x25')](_0x3fd094[_0x9a04('0x38')][_0x9a04('0x25')]);}_0xa0354f[_0x9a04('0x42')]=qs[_0x9a04('0x43')](_0x3fd094[_0x9a04('0x38')]['sort']);_0xa0354f[_0x9a04('0x44')]=qs[_0x9a04('0x3a')](_[_0x9a04('0x45')](_0x3fd094[_0x9a04('0x38')],_0x505432[_0x9a04('0x3a')]),_0x17c5f7);if(_0x3fd094[_0x9a04('0x38')]['filter']){_0xa0354f[_0x9a04('0x44')]=_['merge'](_0xa0354f[_0x9a04('0x44')],{'$or':_[_0x9a04('0x31')](_0x17c5f7,function(_0x515969){if(_0x515969['type']!=='VIRTUAL'){var _0xddce40={};_0xddce40[_0x515969[_0x9a04('0x2e')]]={'$like':'%'+_0x3fd094[_0x9a04('0x38')]['filter']+'%'};return _0xddce40;}})});}_0xa0354f=_[_0x9a04('0x46')]({},_0xa0354f,_0x3fd094['options']);var _0x49c132={'where':_0xa0354f[_0x9a04('0x44')]};return db[_0x9a04('0x32')][_0x9a04('0x24')](_0x49c132)['then'](function(_0x15d9ac){_0xce8658[_0x9a04('0x24')]=_0x15d9ac;if(_0x3fd094[_0x9a04('0x38')][_0x9a04('0x47')]){_0xa0354f[_0x9a04('0x48')]=[{'all':!![]}];}return db[_0x9a04('0x32')][_0x9a04('0x49')](_0xa0354f);})[_0x9a04('0x2b')](function(_0x447c83){_0xce8658['rows']=_0x447c83;return _0xce8658;})['then'](respondWithFilteredResult(_0x40717e,_0xa0354f))[_0x9a04('0x4a')](handleError(_0x40717e,null));};exports[_0x9a04('0x4b')]=function(_0x579d6e,_0x3b7866){var _0x3daa03={'raw':![],'where':{'id':_0x579d6e[_0x9a04('0x4c')]['id']}},_0x1a5676={};_0x1a5676['model']=_[_0x9a04('0x39')](db[_0x9a04('0x32')][_0x9a04('0x33')]);_0x1a5676[_0x9a04('0x38')]=_[_0x9a04('0x39')](_0x579d6e[_0x9a04('0x38')]);_0x1a5676[_0x9a04('0x3a')]=_[_0x9a04('0x3b')](_0x1a5676[_0x9a04('0x37')],_0x1a5676['query']);_0x3daa03[_0x9a04('0x3c')]=_[_0x9a04('0x3b')](_0x1a5676[_0x9a04('0x37')],qs[_0x9a04('0x3d')](_0x579d6e[_0x9a04('0x38')][_0x9a04('0x3d')]));_0x3daa03['attributes']=_0x3daa03[_0x9a04('0x3c')]['length']?_0x3daa03['attributes']:_0x1a5676['model'];if(_0x579d6e[_0x9a04('0x38')]['includeAll']){_0x3daa03[_0x9a04('0x48')]=[{'all':!![]}];}_0x3daa03=_[_0x9a04('0x46')]({},_0x3daa03,_0x579d6e[_0x9a04('0x4d')]);return db['UserProfile'][_0x9a04('0x4e')](_0x3daa03)[_0x9a04('0x2b')](handleEntityNotFound(_0x3b7866,null))[_0x9a04('0x2b')](respondWithResult(_0x3b7866,null))[_0x9a04('0x4a')](handleError(_0x3b7866,null));};exports[_0x9a04('0x4f')]=function(_0x4b450e,_0x1a5ed2){return db['UserProfile']['create'](_0x4b450e['body'],{})['then'](respondWithResult(_0x1a5ed2,0xc9))[_0x9a04('0x4a')](handleError(_0x1a5ed2,null));};exports[_0x9a04('0x50')]=function(_0x313c6a,_0x3408de){var _0x556b38={'where':{'id':_0x313c6a[_0x9a04('0x4c')]['id']}},_0x1d228a={};_0x1d228a[_0x9a04('0x37')]=_[_0x9a04('0x39')](db['UserProfile'][_0x9a04('0x33')]);_0x556b38[_0x9a04('0x3c')]=_[_0x9a04('0x3b')](_0x1d228a['model'],qs[_0x9a04('0x3d')](_0x313c6a[_0x9a04('0x38')][_0x9a04('0x3d')]));_0x556b38['attributes']=_0x556b38[_0x9a04('0x3c')][_0x9a04('0x3e')]?_0x556b38[_0x9a04('0x3c')]:_0x1d228a['model'];if(_0x313c6a['query'][_0x9a04('0x47')]){_0x556b38[_0x9a04('0x48')]=[{'all':!![]}];}_0x556b38=_['merge']({},_0x556b38,_0x313c6a[_0x9a04('0x4d')]);return db[_0x9a04('0x32')]['find'](_0x556b38)[_0x9a04('0x2b')](handleEntityNotFound(_0x3408de,null))[_0x9a04('0x2b')](function(_0x205b6e){if(_0x205b6e){var _0x15e321=_0x205b6e[_0x9a04('0x51')]({'plain':!![]});_0x15e321=qs[_0x9a04('0x52')](_0x15e321,['id',_0x9a04('0x53'),_0x9a04('0x54'),_0x9a04('0x55')]);_0x313c6a[_0x9a04('0x56')]=_[_0x9a04('0x52')](_0x313c6a[_0x9a04('0x56')],['id','createdAt',_0x9a04('0x54')]);return db[_0x9a04('0x57')]['transaction'](function(_0x3a283e){return db[_0x9a04('0x32')][_0x9a04('0x4f')](_[_0x9a04('0x46')](_0x15e321,_0x313c6a[_0x9a04('0x56')]),{'include':_0x313c6a[_0x9a04('0x38')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3a283e})[_0x9a04('0x2b')](function(_0x30207f){var _0x2affd5=_0x30207f[_0x9a04('0x51')]({'plain':!![]});return db[_0x9a04('0x58')][_0x9a04('0x49')]({'where':{'userProfileId':_0x313c6a[_0x9a04('0x4c')]['id']},'raw':!![]})[_0x9a04('0x2b')](function(_0x26bc3c){if(_0x26bc3c){return BPromise['each'](_0x26bc3c,function(_0x3df3d0){return new BPromise(function(_0x4cad23,_0x46e495){if(_0x3df3d0[_0x9a04('0x59')]===null||_0x3df3d0[_0x9a04('0x59')]===0x1)_0x4cad23(null);return db['UserProfileResource'][_0x9a04('0x49')]({'where':{'sectionId':_0x3df3d0['id']},'raw':!![]})['then'](function(_0x3f5f78){var _0x73ae5c=_[_0x9a04('0x31')](_0x3f5f78,function(_0xc5d0b){return qs[_0x9a04('0x52')](_0xc5d0b,['id',_0x9a04('0x53'),'updatedAt',_0x9a04('0x5a')]);});_0x4cad23(_0x73ae5c);})['catch'](function(_0x5e31e8){_0x46e495(_0x5e31e8);});})[_0x9a04('0x2b')](function(_0x496a98){var _0x1324c5=qs[_0x9a04('0x52')](_0x3df3d0,['id','createdAt',_0x9a04('0x54')]);_0x1324c5[_0x9a04('0x5b')]=_0x2affd5['id'];if(_0x496a98)_0x1324c5[_0x9a04('0x5c')]=_0x496a98;return _0x1324c5;})[_0x9a04('0x2b')](function(_0x281587){return db[_0x9a04('0x58')]['create'](_0x281587,{'include':[{'model':db[_0x9a04('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x3a283e});});})['then'](function(){return _0x2affd5;});}});});});}})[_0x9a04('0x2b')](respondWithResult(_0x3408de,0xc9))['catch'](handleError(_0x3408de,null));};exports[_0x9a04('0x5e')]=function(_0x4a2567,_0x35f1ac){if(_0x4a2567[_0x9a04('0x56')]['id']){delete _0x4a2567[_0x9a04('0x56')]['id'];}return db[_0x9a04('0x32')][_0x9a04('0x4e')]({'where':{'id':_0x4a2567[_0x9a04('0x4c')]['id']}})[_0x9a04('0x2b')](handleEntityNotFound(_0x35f1ac,null))[_0x9a04('0x2b')](saveUpdates(_0x4a2567[_0x9a04('0x56')],null))[_0x9a04('0x2b')](respondWithResult(_0x35f1ac,null))[_0x9a04('0x4a')](handleError(_0x35f1ac,null));};exports['destroy']=function(_0x5e1449,_0x28a731){return db['UserProfile'][_0x9a04('0x4e')]({'where':{'id':_0x5e1449[_0x9a04('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28a731,null))[_0x9a04('0x2b')](removeEntity(_0x28a731,null))[_0x9a04('0x4a')](handleError(_0x28a731,null));};exports[_0x9a04('0x5f')]=function(_0x420696,_0x375344){return db[_0x9a04('0x32')]['describe']()[_0x9a04('0x2b')](respondWithResult(_0x375344,null))[_0x9a04('0x4a')](handleError(_0x375344,null));};exports[_0x9a04('0x60')]=function(_0x2626dc,_0x40179c){var _0xd4114=_0x2626dc[_0x9a04('0x56')];return db[_0x9a04('0x32')][_0x9a04('0x4e')]({'where':{'id':_0x2626dc[_0x9a04('0x4c')]['id']}})[_0x9a04('0x2b')](handleEntityNotFound(_0x40179c,null))[_0x9a04('0x2b')](function(_0x31b96b){if(_0x31b96b){return db[_0x9a04('0x57')][_0x9a04('0x61')](function(_0x4e10e5){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2626dc['params']['id'],'sectionId':_[_0x9a04('0x31')](_0xd4114,function(_0x435af5){return _0x435af5[_0x9a04('0x5a')];})},'transaction':_0x4e10e5})['then'](function(){var _0x45cfcd=_[_0x9a04('0x31')](_0xd4114,function(_0x21aff3){_0x21aff3[_0x9a04('0x5b')]=_0x2626dc[_0x9a04('0x4c')]['id'];return _0x21aff3;});var _0x4229d6=[];return BPromise[_0x9a04('0x62')](_0x45cfcd,function(_0x16fd5c){return db['UserProfileSection'][_0x9a04('0x4f')](_0x16fd5c,{'include':[{'model':db[_0x9a04('0x5d')],'as':_0x9a04('0x5c')}],'raw':!![],'transaction':_0x4e10e5})[_0x9a04('0x2b')](function(_0x58d86a){_0x4229d6[_0x9a04('0x63')](_0x58d86a[_0x9a04('0x51')]({'plain':!![]}));});})[_0x9a04('0x2b')](function(){return _0x4229d6;});});});}})['then'](function(_0x1db1f0){return _0x1db1f0;})['then'](respondWithResult(_0x40179c,null))['catch'](handleError(_0x40179c,null));};exports[_0x9a04('0x64')]=function(_0x100d90,_0x438f9f){var _0x3f2fdb;return db[_0x9a04('0x32')][_0x9a04('0x4e')]({'where':{'id':_0x100d90[_0x9a04('0x4c')]['id']},'attributes':['id',_0x9a04('0x2e')]})[_0x9a04('0x2b')](handleEntityNotFound(_0x438f9f,null))['then'](function(_0x504a97){if(_0x504a97){_0x3f2fdb=_0x504a97;return db[_0x9a04('0x58')]['destroy']({'where':{'userProfileId':_0x100d90['params']['id'],'sectionId':_0x100d90[_0x9a04('0x38')][_0x9a04('0x65')]}});}})[_0x9a04('0x2b')](function(){return _0x3f2fdb;})[_0x9a04('0x2b')](respondWithStatusCode(_0x438f9f,null))['catch'](handleError(_0x438f9f,null));};exports['getSections']=function(_0x57de03,_0x27dd36){var _0x47a432=[];var _0x5c9818=[];return db[_0x9a04('0x58')][_0x9a04('0x49')]({'where':{'userProfileId':_0x57de03['params']['id']},'raw':!![]})['then'](function(_0x195033){_0x47a432=_[_0x9a04('0x66')](_0x195033,function(_0xe87795){return _0xe87795[_0x9a04('0x67')]===0x1||_['includes']([0x3eb,0x709],_0xe87795['sectionId']);});if(!_[_0x9a04('0x68')](_0x47a432)){return _[_0x9a04('0x31')](_0x47a432,function(_0x117af6){return _0x117af6[_0x9a04('0x5a')];});}else{return;}})[_0x9a04('0x2b')](function(_0x13b136){if(_0x13b136)_0x5c9818=_0x13b136;if(_[_0x9a04('0x69')](_0x5c9818,0x64)){var _0x213256=_[_0x9a04('0x4e')](_0x47a432,{'sectionId':0x64});return hasDefaultDashboard(_0x213256)[_0x9a04('0x2b')](function(_0x1f8f52){return _[_0x9a04('0x31')](_0x47a432,function(_0x51c547){if(_0x51c547[_0x9a04('0x5a')]===0x64){_0x51c547[_0x9a04('0x6a')]=_0x1f8f52;}return _0x51c547;});});}else{return;}})[_0x9a04('0x2b')](function(_0x373713){if(_0x373713)_0x47a432=_0x373713;if(_['includes'](_0x5c9818,0x3eb)){var _0x2f07f2=_[_0x9a04('0x4e')](_0x47a432,{'sectionId':0x3eb});return getCustomDashboards(_0x2f07f2)[_0x9a04('0x2b')](function(_0x15fbb6){return _[_0x9a04('0x31')](_0x47a432,function(_0x2573fd){if(_0x2f07f2[_0x9a04('0x67')]){if(_0x2573fd[_0x9a04('0x5a')]===0x3eb){_0x2573fd[_0x9a04('0x6a')]=_0x15fbb6;}}else{if(_0x2573fd[_0x9a04('0x5a')]===0x64){_0x2573fd[_0x9a04('0x6a')]=_0x15fbb6;}}return _0x2573fd;});});}else{return;}})[_0x9a04('0x2b')](function(_0x58e7f6){if(_0x58e7f6)_0x47a432=_0x58e7f6;if(_[_0x9a04('0x69')](_0x5c9818,0x709)){var _0x8fea09=_[_0x9a04('0x4e')](_0x47a432,{'sectionId':0x709});return getPlugins(_0x8fea09)[_0x9a04('0x2b')](function(_0x1d8cfa){if(_0x8fea09[_0x9a04('0x67')]){return _[_0x9a04('0x31')](_0x47a432,function(_0x2a5b84){if(_0x2a5b84['sectionId']===0x709){_0x2a5b84['subsections']=_0x1d8cfa;}return _0x2a5b84;});}else{var _0x160594={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1d8cfa};var _0x57e647=_[_0x9a04('0x31')](_0x47a432);_0x57e647[_0x9a04('0x63')](_0x160594);return _0x57e647;}});}else{return;}})['then'](function(_0x4dabff){if(_0x4dabff)_0x47a432=_0x4dabff;return _['filter'](_0x47a432,[_0x9a04('0x67'),0x1]);})[_0x9a04('0x2b')](respondWithResult(_0x27dd36,null))[_0x9a04('0x4a')](handleError(_0x27dd36,null));};function hasDefaultDashboard(_0x5a030a){var _0xe2d682=[0x65];return new BPromise(function(_0x405656,_0x4d36ee){try{if(_0x5a030a[_0x9a04('0x59')]){_0x405656(_0xe2d682);}else{return db[_0x9a04('0x5d')][_0x9a04('0x6b')]({'where':{'sectionId':_0x5a030a['id']},'raw':!![]})[_0x9a04('0x2b')](function(_0xbd2600){_0xbd2600?_0x405656(_0xe2d682):_0x405656();});}}catch(_0x1dbeed){_0x4d36ee(_0x1dbeed);}});}function getCustomDashboards(_0x493064){var _0x4cb0ad=[];return new BPromise(function(_0x37021f,_0x3cf455){try{if(_0x493064['autoAssociation']){return db[_0x9a04('0x6c')][_0x9a04('0x49')]({'raw':!![]})[_0x9a04('0x2b')](function(_0x9355a5){_0x9355a5['forEach'](function(_0x197abf){_0x4cb0ad[_0x9a04('0x63')](_0x197abf['id']+0x1869f);});_0x37021f(_0x4cb0ad);});}else{return db['UserProfileResource'][_0x9a04('0x49')]({'where':{'sectionId':_0x493064['id']},'raw':!![]})['then'](function(_0x4d34f1){_0x4d34f1['forEach'](function(_0x4b17e4){_0x4cb0ad[_0x9a04('0x63')](_0x4b17e4[_0x9a04('0x6d')]+0x1869f);});_0x37021f(_0x4cb0ad);});}}catch(_0x7dfccd){_0x3cf455(_0x7dfccd);}});}function getPlugins(_0x580bf5){var _0x29ebf0=[];return new BPromise(function(_0x239a78,_0x507498){try{if(_0x580bf5['autoAssociation']){return db[_0x9a04('0x6e')][_0x9a04('0x49')]({'raw':!![]})['then'](function(_0x31e40f){_0x31e40f[_0x9a04('0x6f')](function(_0x227626){_0x29ebf0[_0x9a04('0x63')](_0x227626['id']+0x15b38);});_0x239a78(_0x29ebf0);});}else{return db[_0x9a04('0x5d')][_0x9a04('0x49')]({'where':{'sectionId':_0x580bf5['id']},'raw':!![]})['then'](function(_0x4521f2){_0x4521f2['forEach'](function(_0x1a4985){_0x29ebf0['push'](_0x1a4985[_0x9a04('0x6d')]+0x15b38);});_0x239a78(_0x29ebf0);});}}catch(_0x5af77b){_0x507498(_0x5af77b);}});}exports['addResources']=function(_0x491da2,_0x136fda){return db[_0x9a04('0x32')][_0x9a04('0x4e')]({'where':{'id':_0x491da2['params']['id']}})[_0x9a04('0x2b')](handleEntityNotFound(_0x136fda,null))[_0x9a04('0x2b')](function(_0x5aaf0f){if(_0x5aaf0f){return db['sequelize'][_0x9a04('0x61')](function(_0x340f9a){return db[_0x9a04('0x58')][_0x9a04('0x49')]({'where':{'userProfileId':_0x491da2['params']['id']},'attributes':['id'],'raw':!![]})[_0x9a04('0x2b')](function(_0xcc03b){if(_0xcc03b){return db['UserProfileSection'][_0x9a04('0x70')]({'where':{'userProfileId':_0x491da2[_0x9a04('0x4c')]['id'],'id':_['map'](_0xcc03b,function(_0x434f0c){return _0x434f0c['id'];})},'transaction':_0x340f9a});}})[_0x9a04('0x2b')](function(_0x1f0e4d){var _0x1d7b12=_['map'](_0x491da2['body'],function(_0xa12768){_0xa12768[_0x9a04('0x5b')]=_0x491da2[_0x9a04('0x4c')]['id'];return _0xa12768;});return db[_0x9a04('0x58')]['bulkCreate'](_0x1d7b12,{'raw':!![],'transaction':_0x340f9a});})[_0x9a04('0x2b')](function(_0x107d64){var _0x331cb6=_[_0x9a04('0x66')](_[_0x9a04('0x31')](_0x107d64,function(_0x20fa59){return _0x20fa59[_0x9a04('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x331cb6){return db[_0x9a04('0x58')][_0x9a04('0x49')]({'where':{'userProfileId':_0x491da2['params']['id'],'sectionId':_[_0x9a04('0x31')](_0x331cb6,function(_0x6534fb){return _0x6534fb['sectionId'];})},'attributes':['id',_0x9a04('0x5a')],'raw':!![]})[_0x9a04('0x2b')](function(_0x5ae167){var _0x44d2d8=_[_0x9a04('0x31')](_0x491da2[_0x9a04('0x56')],function(_0x37436e){_0x37436e['userProfileId']=_0x491da2[_0x9a04('0x4c')]['id'];return _0x37436e;});return db[_0x9a04('0x5d')][_0x9a04('0x71')](_0x44d2d8,{'raw':!![],'transaction':_0x340f9a});});}})['catch'](handleError(_0x136fda,null));});}})[_0x9a04('0x2b')](function(_0x41c9a9){var _0x408f81=_['map'](_0x41c9a9,function(_0x2e8b04){return _0x2e8b04[_0x9a04('0x51')]({'plain':!![]});});})[_0x9a04('0x2b')](respondWithResult(_0x136fda,null))[_0x9a04('0x4a')](handleError(_0x136fda,null));};exports[_0x9a04('0x72')]=function(_0x5f42af,_0x3d0149,_0x577a55){return db[_0x9a04('0x32')][_0x9a04('0x4e')]({'where':{'id':_0x5f42af[_0x9a04('0x4c')]['id']}})[_0x9a04('0x2b')](handleEntityNotFound(_0x3d0149,null))['then'](function(_0x55d8d6){if(_0x55d8d6){return _0x55d8d6[_0x9a04('0x72')](_0x5f42af['query'][_0x9a04('0x65')]);}})[_0x9a04('0x2b')](respondWithStatusCode(_0x3d0149,null))[_0x9a04('0x4a')](handleError(_0x3d0149,null));};exports[_0x9a04('0x73')]=function(_0x4ac43b,_0x76bdb7){var _0x3a2c91={'raw':![],'where':{}};var _0x2871dd={};var _0x3dd03a={'count':0x0,'rows':[]};var _0x19e63a=_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x74')];if(typeof _0x19e63a==='undefined'){throw new db[(_0x9a04('0x75'))][(_0x9a04('0x76'))](_0x9a04('0x77'));}var _0x40ed41=_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x78')]||![];var _0x3deddb=getQueryModels(_0x19e63a,_0x40ed41);if(typeof _0x3deddb['childModel']===_0x9a04('0x79')){throw new db[(_0x9a04('0x75'))]['ValidationError'](_0x9a04('0x7a')+_0x19e63a+'\x27');}var _0xb1b840=[];if(!_[_0x9a04('0x68')](_0x3deddb[_0x9a04('0x7b')])){_0xb1b840=_0x3deddb[_0x9a04('0x7b')];}else{_0xb1b840=[{'name':_0x19e63a}];}return db[_0x9a04('0x32')][_0x9a04('0x6b')]({'where':{'id':_0x4ac43b[_0x9a04('0x4c')]['id']}})['then'](handleEntityNotFound(_0x76bdb7,null))['then'](function(_0x4648e0){if(_0x4648e0){var _0x201f71=[];for(var _0x31f66a=0x0;_0x31f66a<_0xb1b840[_0x9a04('0x3e')];_0x31f66a++){_0x201f71[_0x9a04('0x63')](db[_0x9a04('0x58')][_0x9a04('0x6b')]({'where':{'userProfileId':_0x4648e0['id'],'name':_0xb1b840[_0x31f66a][_0x9a04('0x2e')]},'raw':!![]}));}return BPromise[_0x9a04('0x7c')](_0x201f71);}})[_0x9a04('0x2b')](function(_0x67df82){var _0x4042ed=_[_0x9a04('0x66')](_0x67df82,function(_0x3167df){return _0x3167df?_0x3167df:undefined;});var _0x43de1a=_[_0x9a04('0x66')](_0xb1b840,['ignore',!![]]);var _0x1d9336=_['isEmpty'](_0x4042ed)&&_[_0x9a04('0x68')](_0x43de1a)?null:_[_0x9a04('0x7d')](_0x43de1a,_0x4042ed);if(_0x1d9336){var _0x1231ed=[];for(var _0x396cf5=0x0;_0x396cf5<_0x1d9336[_0x9a04('0x3e')];_0x396cf5++){var _0x4092f=_[_0x9a04('0x4e')](_0xb1b840,function(_0x2bdd7f){return _0x1d9336[_0x396cf5]?_0x2bdd7f[_0x9a04('0x2e')]===_0x1d9336[_0x396cf5][_0x9a04('0x2e')]:null;});if(_0x4092f){if(_0x1d9336[_0x396cf5]['ignore']){_0x1231ed[_0x9a04('0x63')](getAllResources(_0x3deddb[_0x9a04('0x7e')],_0x1d9336[_0x396cf5]));}else{if(!_0x1d9336[_0x396cf5][_0x9a04('0x59')]){_0x1231ed[_0x9a04('0x63')](getAllowedResources(_0x4092f,_0x1d9336[_0x396cf5],_0x3deddb[_0x9a04('0x7e')]));}else{if(_0x4092f[_0x9a04('0x37')]){_0x1231ed[_0x9a04('0x63')](getAllFilteredResources(_0x4092f,_0x1d9336[_0x396cf5]));}}}}}return BPromise[_0x9a04('0x7c')](_0x1231ed);}else{return null;}})[_0x9a04('0x2b')](function(_0x1e7acc){var _0x1d7620=_0x1e7acc;var _0x4bd5bb=null;if(_0x1d7620){_0x4bd5bb=_0x1d7620[_0x9a04('0x3e')]===0x1?_0x1d7620[0x0]:null;}if(_0x4bd5bb||_0x1d7620){var _0x5bd7dd=db[_0x3deddb['childModel']]['rawAttributes'];_0x2871dd[_0x9a04('0x37')]=_[_0x9a04('0x39')](_0x5bd7dd);_0x2871dd[_0x9a04('0x38')]=_[_0x9a04('0x39')](_0x4ac43b[_0x9a04('0x38')]);_0x2871dd[_0x9a04('0x3a')]=_[_0x9a04('0x3b')](_0x2871dd[_0x9a04('0x37')],_0x2871dd[_0x9a04('0x38')]);_0x3a2c91[_0x9a04('0x3c')]=_[_0x9a04('0x3b')](_0x2871dd[_0x9a04('0x37')],qs[_0x9a04('0x3d')](_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x3d')]));_0x3a2c91[_0x9a04('0x3c')]=_0x3a2c91[_0x9a04('0x3c')][_0x9a04('0x3e')]?_0x3a2c91[_0x9a04('0x3c')]:_0x2871dd[_0x9a04('0x37')];if(!_0x4ac43b['query'][_0x9a04('0x3f')](_0x9a04('0x40'))){_0x3a2c91['limit']=qs['limit'](_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x41')]);_0x3a2c91[_0x9a04('0x25')]=qs[_0x9a04('0x25')](_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x25')]);}_0x3a2c91[_0x9a04('0x42')]=qs[_0x9a04('0x43')](_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x43')]);_0x3a2c91[_0x9a04('0x44')]=qs[_0x9a04('0x3a')](_[_0x9a04('0x45')](_0x4ac43b[_0x9a04('0x38')],_0x2871dd['filters']));if(_0x4ac43b[_0x9a04('0x38')]['filter']){_0x3a2c91[_0x9a04('0x44')]=_[_0x9a04('0x46')](_0x3a2c91[_0x9a04('0x44')],{'$or':_['map'](_0x5bd7dd,function(_0x37b03a){if(_0x37b03a[_0x9a04('0x35')][_0x9a04('0x36')]!==_0x9a04('0x7f')){var _0x21b395={};_0x21b395[_0x37b03a[_0x9a04('0x80')]]={'$like':'%'+_0x4ac43b[_0x9a04('0x38')]['filter']+'%'};return _0x21b395;}})});}var _0xa0d449=[];if(_0x4bd5bb){var _0x35e1e4=_[_0x9a04('0x4e')](_0xb1b840,[_0x9a04('0x2e'),_0x4bd5bb[_0x9a04('0x2e')]]);if(_0x35e1e4['field']){var _0x57d16e={};if(_0x3deddb[_0x9a04('0x7e')]===_0x9a04('0x81')){_0x57d16e[_0x35e1e4['foreignKey']]=_[_0x9a04('0x31')](_0x4bd5bb[_0x9a04('0x82')],'id');}else{_0x57d16e[_0x35e1e4[_0x9a04('0x83')]]=_0x4bd5bb[_0x9a04('0x82')];}_0xa0d449[_0x9a04('0x63')](_0x57d16e);}else{_0x3a2c91['where']['id']=_0x4bd5bb['associatedResources'];}}else{for(var _0x29a3ab=0x0;_0x29a3ab<_0x1d7620['length'];_0x29a3ab++){var _0x35e1e4=_[_0x9a04('0x4e')](_0xb1b840,[_0x9a04('0x2e'),_0x1d7620[_0x29a3ab][_0x9a04('0x2e')]]);if(_0x35e1e4['field']){var _0x57d16e={};_0x57d16e[_0x35e1e4[_0x9a04('0x83')]]=_0x1d7620[_0x29a3ab][_0x9a04('0x82')];_0xa0d449['push'](_0x57d16e);}else{if(!_0x3a2c91['where']['id'])_0x3a2c91[_0x9a04('0x44')]['id']=[];_0x1d7620[_0x29a3ab][_0x9a04('0x82')]['forEach'](function(_0x2a0da5){_0x3a2c91[_0x9a04('0x44')]['id']['push'](_0x2a0da5);});}}}if(!_[_0x9a04('0x68')](_0xa0d449)){_0x3a2c91['where']=_[_0x9a04('0x46')](_0x3a2c91['where'],{'$and':{'$or':_0xa0d449}});}_0x3a2c91=_[_0x9a04('0x46')]({},_0x3a2c91,_0x4ac43b[_0x9a04('0x4d')]);if(_0x4bd5bb&&!_0x4bd5bb[_0x9a04('0x59')]&&_0x3deddb['childModel']==='AnalyticExtractedReport'){if(_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x47')]){_0x3a2c91[_0x9a04('0x48')]=[{'all':!![]}];}return db[_0x3deddb[_0x9a04('0x7e')]][_0x9a04('0x49')](_0x3a2c91)[_0x9a04('0x2b')](function(_0x5eb506){var _0x3b8ea7=[];_0x5eb506[_0x9a04('0x6f')](function(_0x3f958b){var _0x13636c;switch(_0x3f958b[_0x9a04('0x84')]){case _0x9a04('0x85'):_0x13636c=_[_0x9a04('0x4e')](_0x4bd5bb[_0x9a04('0x82')],function(_0x19d199){return _0x19d199['id']===_0x3f958b[_0x9a04('0x86')]&&_0x19d199[_0x9a04('0x35')]===_0x9a04('0x87');});break;case _0x9a04('0x88'):_0x13636c=_['find'](_0x4bd5bb[_0x9a04('0x82')],function(_0x2b1aed){return _0x2b1aed['id']===_0x3f958b[_0x9a04('0x86')]&&_0x2b1aed[_0x9a04('0x35')]==='CustomReports';});break;}if(_0x13636c)_0x3b8ea7['push'](_0x3f958b);});_0x3dd03a[_0x9a04('0x24')]=_0x3b8ea7[_0x9a04('0x3e')];_0x3dd03a[_0x9a04('0x89')]=_0x3b8ea7;return _0x3dd03a;});}else{return db[_0x3deddb[_0x9a04('0x7e')]]['count']({'where':_0x3a2c91[_0x9a04('0x44')]})[_0x9a04('0x2b')](function(_0x62a21d){_0x3dd03a[_0x9a04('0x24')]=_0x62a21d;if(_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x47')]){if(_0x3deddb[_0x9a04('0x7e')]==='CmContact'){_0x3a2c91[_0x9a04('0x48')]=[{'model':db[_0x9a04('0x8a')],'as':'Tags','attributes':['id',_0x9a04('0x2e'),'color'],'required':_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x8b')]?!![]:![]},{'model':db[_0x9a04('0x8a')],'as':'ThroughTags','attributes':['id',_0x9a04('0x2e'),'color'],'through':_0x4ac43b[_0x9a04('0x38')][_0x9a04('0x8b')]?{'attributes':[],'where':{'TagId':_0x4ac43b['query'][_0x9a04('0x8b')]||undefined}}:{},'required':_0x4ac43b['query']['tag']?!![]:![]}];}else{_0x3a2c91[_0x9a04('0x48')]=[{'all':!![]}];}}return db[_0x3deddb['childModel']]['findAll'](_0x3a2c91);})['then'](function(_0x58f20c){_0x3dd03a[_0x9a04('0x89')]=_0x58f20c;return _0x3dd03a;});}}else{return _0x3dd03a;}})['then'](respondWithFilteredResult(_0x76bdb7,_0x3a2c91))[_0x9a04('0x4a')](handleError(_0x76bdb7,null));};function getAllResources(_0x4a1ace,_0x2d0e1f){return new BPromise(function(_0x25acf0,_0x46df74){if(_0x2d0e1f){var _0x5847d0=_0x2d0e1f['filter']?{[_0x2d0e1f[_0x9a04('0x66')][_0x9a04('0x80')]]:_0x2d0e1f[_0x9a04('0x66')]['value']}:undefined;return db[_0x4a1ace][_0x9a04('0x49')]({'where':_0x5847d0,'raw':!![]})[_0x9a04('0x2b')](function(_0x431e5a){_0x2d0e1f[_0x9a04('0x82')]=_[_0x9a04('0x31')](_0x431e5a,'id');_0x25acf0(_0x2d0e1f);})[_0x9a04('0x4a')](function(_0x5ef3e5){_0x46df74(_0x5ef3e5);});}else{_0x25acf0(null);}});}function getAllFilteredResources(_0xd260e3,_0x11a85f){return new BPromise(function(_0x53718d,_0x1371f0){var _0x947a24=_0xd260e3[_0x9a04('0x66')]?{[_0xd260e3[_0x9a04('0x66')][_0x9a04('0x80')]]:_0xd260e3[_0x9a04('0x66')][_0x9a04('0x8c')]}:undefined;return db[_0xd260e3[_0x9a04('0x37')]][_0x9a04('0x49')]({'where':_0x947a24,'raw':!![]})[_0x9a04('0x2b')](function(_0x359740){_0x11a85f[_0x9a04('0x82')]=_[_0x9a04('0x31')](_0x359740,function(_0x1dc814){return _0x1dc814[_0x9a04('0x2e')];});_0x53718d(_0x11a85f);})[_0x9a04('0x4a')](function(_0x131473){_0x1371f0(_0x131473);});});}function getAllowedResources(_0x19ecec,_0x217d62,_0x10728f){return new BPromise(function(_0x3a57c4,_0x2a0f35){if(_0x217d62){return db[_0x9a04('0x5d')][_0x9a04('0x49')]({'where':{'sectionId':_0x217d62['id']},'raw':!![]})[_0x9a04('0x2b')](function(_0x127695){if(_0x19ecec[_0x9a04('0x80')]&&_0x19ecec[_0x9a04('0x80')]!=='id'){_0x217d62[_0x9a04('0x82')]=_[_0x9a04('0x31')](_0x127695,function(_0x11a780){return _0x11a780[_0x19ecec[_0x9a04('0x80')]];});}else{if(_0x10728f==='AnalyticExtractedReport'){_0x217d62[_0x9a04('0x82')]=_[_0x9a04('0x31')](_0x127695,function(_0x4b8481){return{'id':_0x4b8481[_0x9a04('0x6d')],'type':_0x4b8481[_0x9a04('0x35')]};});}else{_0x217d62[_0x9a04('0x82')]=_[_0x9a04('0x31')](_0x127695,function(_0x596b49){return _0x596b49['resourceId'];});}}_0x3a57c4(_0x217d62);})[_0x9a04('0x4a')](function(_0x543c1d){_0x2a0f35(_0x543c1d);});}else{_0x3a57c4(null);}});}function getQueryModels(_0xd2323d,_0x3cc371){var _0x75e1c=_0xd2323d['toLowerCase']();var _0x4d182c={'childModel':undefined,'parentSections':[]};switch(_0x75e1c){case _0x9a04('0x8d'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x8e');break;case _0x9a04('0x8f'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x90');break;case'squarerecordings':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x91');_0x4d182c[_0x9a04('0x7b')]=[{'name':'SquareProjects','field':_0x9a04('0x2e'),'foreignKey':'projectName'}];break;case _0x9a04('0x92'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x93');break;case _0x9a04('0x94'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x95');_0x4d182c[_0x9a04('0x7b')]=[{'name':_0x9a04('0x96'),'field':'id','foreignKey':'ListId'}];break;case _0x9a04('0x97'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x98');break;case _0x9a04('0x99'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x9a');break;case _0x9a04('0x9b'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x9c');break;case'chatqueues':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x9d');break;case _0x9a04('0x9e'):_0x4d182c['childModel']=_0x9a04('0x9f');break;case _0x9a04('0xa0'):_0x4d182c[_0x9a04('0x7e')]='FaxQueue';break;case _0x9a04('0xa1'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xa2');break;case _0x9a04('0xa3'):case _0x9a04('0xa4'):case _0x9a04('0xa5'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xa6');break;case _0x9a04('0xa7'):_0x4d182c['childModel']=_0x9a04('0xa8');break;case _0x9a04('0xa9'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xaa');break;case _0x9a04('0xab'):_0x4d182c['childModel']='VoiceRecording';_0x4d182c[_0x9a04('0x7b')]=[{'name':_0x9a04('0xac'),'field':_0x9a04('0x2e'),'foreignKey':_0x9a04('0xad'),'model':_0x9a04('0xae'),'filter':{'field':_0x9a04('0xaf'),'value':[_0x9a04('0xb0')]}},{'name':'Telephones','field':_0x9a04('0x2e'),'foreignKey':_0x9a04('0xad'),'model':_0x9a04('0xae'),'filter':{'field':_0x9a04('0xaf'),'value':['telephone']}},{'name':_0x9a04('0xb1'),'field':_0x9a04('0x2e'),'foreignKey':_0x9a04('0xb2'),'model':_0x9a04('0xb3'),'filter':{'field':_0x9a04('0x35'),'value':[_0x9a04('0xb4')]}},{'name':_0x9a04('0xb5'),'field':_0x9a04('0x2e'),'foreignKey':'queue','model':_0x9a04('0xb3'),'filter':{'field':_0x9a04('0x35'),'value':[_0x9a04('0xb6')]}}];break;case'musiconholds':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xb7');break;case _0x9a04('0xb8'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xb9');break;case _0x9a04('0xba'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xbb');break;case _0x9a04('0xbc'):_0x4d182c[_0x9a04('0x7e')]='Campaign';break;case'mailqueues':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xbd');break;case _0x9a04('0xbe'):_0x4d182c['childModel']='MailAccount';break;case _0x9a04('0xbf'):_0x4d182c['childModel']='MailSubstatus';break;case _0x9a04('0xc0'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xc1');break;case _0x9a04('0xc2'):_0x4d182c['childModel']='OpenchannelAccount';break;case _0x9a04('0xc3'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xc4');break;case'smsaccounts':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xc5');break;case _0x9a04('0xc6'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xc7');break;case'whatsappaccounts':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xc8');break;case _0x9a04('0xc9'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xca');break;case _0x9a04('0xcb'):case _0x9a04('0xcc'):_0x4d182c['childModel']=_0x9a04('0xb3');if(_0x3cc371){_0x4d182c[_0x9a04('0x7b')]=[{'name':_0x9a04('0xb1')},{'name':_0x9a04('0xb5')}];}break;case _0x9a04('0xcd'):case'agents':case _0x9a04('0xce'):_0x4d182c['childModel']=_0x9a04('0xae');if(_0x3cc371){_0x4d182c[_0x9a04('0x7b')]=[{'name':'Users','filter':{'field':'role','value':['admin',_0x9a04('0xcf')]},'ignore':!![]},{'name':_0x9a04('0xac')},{'name':_0x9a04('0xd0')}];}break;case _0x9a04('0xd1'):_0x4d182c['childModel']=_0x9a04('0xd2');break;case _0x9a04('0xd3'):_0x4d182c['childModel']=_0x9a04('0xd4');break;case'freshdeskaccounts':_0x4d182c['childModel']=_0x9a04('0xd5');break;case _0x9a04('0xd6'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xd7');break;case'deskaccounts':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xd8');break;case _0x9a04('0xd9'):_0x4d182c['childModel']=_0x9a04('0xda');break;case _0x9a04('0xdb'):_0x4d182c['childModel']=_0x9a04('0xae');break;case _0x9a04('0xdc'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xdd');break;case'dispositions':_0x4d182c[_0x9a04('0x7e')]='Disposition';break;case'customdashboards':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x6c');break;case'intervals':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xde');break;case'pauses':_0x4d182c['childModel']='Pause';break;case _0x9a04('0xdf'):_0x4d182c['childModel']='Schedule';break;case _0x9a04('0xe0'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xe1');break;case _0x9a04('0xe2'):_0x4d182c[_0x9a04('0x7e')]='Tag';break;case _0x9a04('0xe3'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xe4');break;case _0x9a04('0xe5'):_0x4d182c['childModel']=_0x9a04('0xe6');break;case'trunks':_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0xe7');break;case _0x9a04('0xe8'):_0x4d182c['childModel']=_0x9a04('0xe9');break;case _0x9a04('0xea'):_0x4d182c['childModel']='Plugin';break;case _0x9a04('0xeb'):_0x4d182c[_0x9a04('0x7e')]=_0x9a04('0x81');_0x4d182c[_0x9a04('0x7b')]=[{'name':_0x9a04('0xec'),'field':'id','foreignKey':_0x9a04('0x86')}];break;case _0x9a04('0xed'):_0x4d182c['childModel']=_0x9a04('0xee');break;case _0x9a04('0xef'):_0x4d182c[_0x9a04('0x7e')]='WhatsappAccount';break;default:return _0x4d182c;}return _0x4d182c;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 875a0dd..a838cfb 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 _0x9ab2=['hook','exports','events','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x9ab2,0x1a6));var _0x29ab=function(_0x5bd03b,_0x477364){_0x5bd03b=_0x5bd03b-0x0;var _0x3bd1f7=_0x9ab2[_0x5bd03b];return _0x3bd1f7;};'use strict';var EventEmitter=require(_0x29ab('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x29ab('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x29ab('0x2')](0x0);var events={'afterCreate':_0x29ab('0x3'),'afterUpdate':_0x29ab('0x4'),'afterDestroy':_0x29ab('0x5')};function emitEvent(_0x30256c){return function(_0x5a6da2,_0x2d5614,_0x289b6e){UserProfileEvents[_0x29ab('0x6')](_0x30256c+':'+_0x5a6da2['id'],_0x5a6da2);UserProfileEvents[_0x29ab('0x6')](_0x30256c,_0x5a6da2);_0x289b6e(null);};}for(var e in events){if(events[_0x29ab('0x7')](e)){var event=events[e];UserProfile[_0x29ab('0x8')](e,emitEvent(event));}}module[_0x29ab('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x470d=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5cca92,_0x6f4824){var _0x59d12d=function(_0x5e5b5){while(--_0x5e5b5){_0x5cca92['push'](_0x5cca92['shift']());}};_0x59d12d(++_0x6f4824);}(_0x470d,0x17b));var _0xd470=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x470d[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xd470('0x0'));var UserProfile=require(_0xd470('0x1'))['db'][_0xd470('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd470('0x3')](0x0);var events={'afterCreate':_0xd470('0x4'),'afterUpdate':_0xd470('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5d4b5f){return function(_0x4d27e0,_0x45503c,_0x52609d){UserProfileEvents[_0xd470('0x6')](_0x5d4b5f+':'+_0x4d27e0['id'],_0x4d27e0);UserProfileEvents[_0xd470('0x6')](_0x5d4b5f,_0x4d27e0);_0x52609d(null);};}for(var e in events){if(events[_0xd470('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd470('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 12c564f..0f4f197 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 _0x776e=['path','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','api','moment','bluebird','request-promise'];(function(_0x7e7e5a,_0x387a27){var _0x227db7=function(_0x7abe46){while(--_0x7abe46){_0x7e7e5a['push'](_0x7e7e5a['shift']());}};_0x227db7(++_0x387a27);}(_0x776e,0x167));var _0xe776=function(_0x1350d5,_0x46ad96){_0x1350d5=_0x1350d5-0x0;var _0x15f8c9=_0x776e[_0x1350d5];return _0x15f8c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe776('0x0'));var moment=require(_0xe776('0x1'));var BPromise=require(_0xe776('0x2'));var rp=require(_0xe776('0x3'));var fs=require('fs');var path=require(_0xe776('0x4'));var rimraf=require('rimraf');var config=require(_0xe776('0x5'));var attributes=require(_0xe776('0x6'));module[_0xe776('0x7')]=function(_0x5bceeb,_0x1b2ebe){return _0x5bceeb[_0xe776('0x8')](_0xe776('0x9'),attributes,{'tableName':_0xe776('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1db=['UserProfile','user_profiles','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfile.attributes','exports'];(function(_0x164367,_0x2f212e){var _0x3e3e7e=function(_0x42d233){while(--_0x42d233){_0x164367['push'](_0x164367['shift']());}};_0x3e3e7e(++_0x2f212e);}(_0xd1db,0x65));var _0xbd1d=function(_0x42b02c,_0x5c7b99){_0x42b02c=_0x42b02c-0x0;var _0x105518=_0xd1db[_0x42b02c];return _0x105518;};'use strict';var _=require('lodash');var util=require(_0xbd1d('0x0'));var logger=require('../../config/logger')(_0xbd1d('0x1'));var moment=require(_0xbd1d('0x2'));var BPromise=require(_0xbd1d('0x3'));var rp=require(_0xbd1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd1d('0x5'));var config=require(_0xbd1d('0x6'));var attributes=require(_0xbd1d('0x7'));module[_0xbd1d('0x8')]=function(_0x1b99e7,_0x2a0bc5){return _0x1b99e7['define'](_0xbd1d('0x9'),attributes,{'tableName':_0xbd1d('0xa'),'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 29486d6..c64e6cd 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 _0xc4aa=['redis','defaults','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29eb61,_0x364104){var _0x2ed150=function(_0x4dc5b2){while(--_0x4dc5b2){_0x29eb61['push'](_0x29eb61['shift']());}};_0x2ed150(++_0x364104);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});config[_0xac4a('0xb')]=_[_0xac4a('0xc')](config[_0xac4a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac4a('0xb')]));require(_0xac4a('0xd'))[_0xac4a('0xe')](socket);function respondWithRpcPromise(_0x4f4146,_0x1d182e,_0x3a82de){return new BPromise(function(_0x3e64f5,_0x4d4acc){return client[_0xac4a('0xf')](_0x4f4146,_0x3a82de)['then'](function(_0x2f062c){logger['info'](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));logger[_0xac4a('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1d182e,_0xac4a('0x11'),JSON[_0xac4a('0x13')](_0x2f062c));if(_0x2f062c[_0xac4a('0x14')]){if(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x15')]===0x1f4){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x4d4acc(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}logger[_0xac4a('0x14')]('UserProfile,\x20%s,\x20%s',_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x3e64f5(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}else{logger[_0xac4a('0x17')](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));_0x3e64f5(_0x2f062c[_0xac4a('0x18')]['message']);}})['catch'](function(_0x21a729){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x21a729);_0x4d4acc(_0x21a729);});});} \ No newline at end of file +var _0x5fab=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./userProfile.socket','register'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x5fab,0x177));var _0xb5fa=function(_0x38aa3d,_0x5ed191){_0x38aa3d=_0x38aa3d-0x0;var _0x8936ba=_0x5fab[_0x38aa3d];return _0x8936ba;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb5fa('0xc')](config[_0xb5fa('0xd')],{'host':_0xb5fa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0xd')]));require(_0xb5fa('0xf'))[_0xb5fa('0x10')](socket);function respondWithRpcPromise(_0x54c7eb,_0x5b5ea8,_0x3a8e1b){return new BPromise(function(_0x23d124,_0xe46b26){return client[_0xb5fa('0x11')](_0x54c7eb,_0x3a8e1b)[_0xb5fa('0x12')](function(_0xadef41){logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));logger['debug'](_0xb5fa('0x16'),_0x5b5ea8,_0xb5fa('0x15'),JSON['stringify'](_0xadef41));if(_0xadef41[_0xb5fa('0x17')]){if(_0xadef41['error'][_0xb5fa('0x18')]===0x1f4){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0xe46b26(_0xadef41['error']['message']);}logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0xadef41[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x23d124(_0xadef41['error']['message']);}else{logger[_0xb5fa('0x13')](_0xb5fa('0x14'),_0x5b5ea8,_0xb5fa('0x15'));_0x23d124(_0xadef41[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x3b0f69){logger[_0xb5fa('0x17')](_0xb5fa('0x14'),_0x5b5ea8,_0x3b0f69);_0xe46b26(_0x3b0f69);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a5feabc..399fa05 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 _0xa1a2=['removeListener','register','length','userProfile:','remove','update'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xa1a2,0xca));var _0x2a1a=function(_0x1d25f4,_0x2900db){_0x1d25f4=_0x1d25f4-0x0;var _0x5ca4ee=_0xa1a2[_0x1d25f4];return _0x5ca4ee;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x2a1a('0x0'),_0x2a1a('0x1')];function createListener(_0x138a29,_0x1f062e){return function(_0x63903c){_0x1f062e['emit'](_0x138a29,_0x63903c);};}function removeListener(_0x348f66,_0x1e50f7){return function(){UserProfileEvents[_0x2a1a('0x2')](_0x348f66,_0x1e50f7);};}exports[_0x2a1a('0x3')]=function(_0x4baf3e){for(var _0x39beb6=0x0,_0x3eda83=events[_0x2a1a('0x4')];_0x39beb6<_0x3eda83;_0x39beb6++){var _0x293e4b=events[_0x39beb6];var _0x27458a=createListener(_0x2a1a('0x5')+_0x293e4b,_0x4baf3e);UserProfileEvents['on'](_0x293e4b,_0x27458a);}}; \ No newline at end of file +var _0x2586=['emit','removeListener','register','length','userProfile:','save'];(function(_0x27e38c,_0x3d325a){var _0x1515f2=function(_0xcc4f54){while(--_0xcc4f54){_0x27e38c['push'](_0x27e38c['shift']());}};_0x1515f2(++_0x3d325a);}(_0x2586,0x12b));var _0x6258=function(_0x3c7582,_0x4e2c49){_0x3c7582=_0x3c7582-0x0;var _0x18d6cb=_0x2586[_0x3c7582];return _0x18d6cb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x6258('0x0'),'remove','update'];function createListener(_0x4d22c6,_0x51e4b1){return function(_0x50301e){_0x51e4b1[_0x6258('0x1')](_0x4d22c6,_0x50301e);};}function removeListener(_0x413c48,_0xbad475){return function(){UserProfileEvents[_0x6258('0x2')](_0x413c48,_0xbad475);};}exports[_0x6258('0x3')]=function(_0x3def7b){for(var _0x1c2f44=0x0,_0x171af=events[_0x6258('0x4')];_0x1c2f44<_0x171af;_0x1c2f44++){var _0x3b5eaa=events[_0x1c2f44];var _0x5db4a4=createListener(_0x6258('0x5')+_0x3b5eaa,_0x3def7b);UserProfileEvents['on'](_0x3b5eaa,_0x5db4a4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4488b30..3e26629 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 _0x9aea=['isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','Router','../../config/environment','./userProfileResource.controller','get','index'];(function(_0x5bbcab,_0xad0ce8){var _0x1c1413=function(_0x15408d){while(--_0x15408d){_0x5bbcab['push'](_0x5bbcab['shift']());}};_0x1c1413(++_0xad0ce8);}(_0x9aea,0x196));var _0xa9ae=function(_0x5d67c8,_0x3fe315){_0x5d67c8=_0x5d67c8-0x0;var _0x51d9dc=_0x9aea[_0x5d67c8];return _0x51d9dc;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require(_0xa9ae('0x1'));var path=require(_0xa9ae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9ae('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9ae('0x4'));var controller=require(_0xa9ae('0x5'));router[_0xa9ae('0x6')]('/',auth['isAuthenticated'](),controller[_0xa9ae('0x7')]);router[_0xa9ae('0x6')]('/describe',auth[_0xa9ae('0x8')](),controller[_0xa9ae('0x9')]);router['get'](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router['post']('/',auth[_0xa9ae('0x8')](),controller[_0xa9ae('0xc')]);router[_0xa9ae('0xd')](_0xa9ae('0xa'),auth[_0xa9ae('0x8')](),controller[_0xa9ae('0xe')]);router[_0xa9ae('0xf')](_0xa9ae('0xa'),auth[_0xa9ae('0x8')](),controller[_0xa9ae('0x10')]);module[_0xa9ae('0x11')]=router; \ No newline at end of file +var _0x11c4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x543a23,_0x59512f){var _0x39f83c=function(_0x254cc8){while(--_0x254cc8){_0x543a23['push'](_0x543a23['shift']());}};_0x39f83c(++_0x59512f);}(_0x11c4,0x174));var _0x411c=function(_0x2f43b0,_0x22adbc){_0x2f43b0=_0x2f43b0-0x0;var _0x45e9a4=_0x11c4[_0x2f43b0];return _0x45e9a4;};'use strict';var multer=require(_0x411c('0x0'));var util=require(_0x411c('0x1'));var path=require('path');var timeout=require(_0x411c('0x2'));var express=require(_0x411c('0x3'));var router=express[_0x411c('0x4')]();var auth=require(_0x411c('0x5'));var interaction=require(_0x411c('0x6'));var config=require(_0x411c('0x7'));var controller=require('./userProfileResource.controller');router[_0x411c('0x8')]('/',auth[_0x411c('0x9')](),controller[_0x411c('0xa')]);router[_0x411c('0x8')](_0x411c('0xb'),auth[_0x411c('0x9')](),controller[_0x411c('0xc')]);router[_0x411c('0x8')](_0x411c('0xd'),auth[_0x411c('0x9')](),controller[_0x411c('0xe')]);router[_0x411c('0xf')]('/',auth[_0x411c('0x9')](),controller[_0x411c('0x10')]);router[_0x411c('0x11')](_0x411c('0xd'),auth[_0x411c('0x9')](),controller[_0x411c('0x12')]);router[_0x411c('0x13')](_0x411c('0xd'),auth['isAuthenticated'](),controller[_0x411c('0x14')]);module[_0x411c('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e5b0d38..bd05a89 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 _0x3e2b=['STRING','INTEGER','sequelize','exports'];(function(_0x39523d,_0x1d5cb3){var _0x5a2675=function(_0x22e0a1){while(--_0x22e0a1){_0x39523d['push'](_0x39523d['shift']());}};_0x5a2675(++_0x1d5cb3);}(_0x3e2b,0x14e));var _0xb3e2=function(_0xe99807,_0x180b47){_0xe99807=_0xe99807-0x0;var _0x2f4762=_0x3e2b[_0xe99807];return _0x2f4762;};'use strict';var Sequelize=require(_0xb3e2('0x0'));module[_0xb3e2('0x1')]={'name':{'type':Sequelize[_0xb3e2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb3e2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb3e2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x05b2=['INTEGER','exports','STRING'];(function(_0x28b1e5,_0x48d3a9){var _0x5cc014=function(_0x18599c){while(--_0x18599c){_0x28b1e5['push'](_0x28b1e5['shift']());}};_0x5cc014(++_0x48d3a9);}(_0x05b2,0x1f3));var _0x205b=function(_0x5e8697,_0x2acdff){_0x5e8697=_0x5e8697-0x0;var _0x2ed741=_0x05b2[_0x5e8697];return _0x2ed741;};'use strict';var Sequelize=require('sequelize');module[_0x205b('0x0')]={'name':{'type':Sequelize[_0x205b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x205b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x205b('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 edc290a..068967d 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 _0x1cb9=['json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','merge','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','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','offset','limit','Content-Range'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x1cb9,0x14e));var _0x91cb=function(_0x80f21,_0x4398ae){_0x80f21=_0x80f21-0x0;var _0x473e58=_0x1cb9[_0x80f21];return _0x473e58;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=_0xc3629e['count'],_0x5ea796=_0x576369[_0x91cb('0x1c')],_0x238f11=_0x576369[_0x91cb('0x1c')]+_0x576369[_0x91cb('0x1d')],_0x135890;if(_0x238f11>=_0x347980){_0x238f11=_0x347980;_0x135890=0xc8;}else{_0x135890=0xce;}_0x528f73[_0x91cb('0x1a')](_0x135890);return _0x528f73['set'](_0x91cb('0x1e'),_0x5ea796+'-'+_0x238f11+'/'+_0x347980)[_0x91cb('0x1f')](_0xc3629e);}return null;};}function patchUpdates(_0x4ca8e8){return function(_0x123847){try{jsonpatch['apply'](_0x123847,_0x4ca8e8,!![]);}catch(_0x55042a){return BPromise[_0x91cb('0x20')](_0x55042a);}return _0x123847[_0x91cb('0x21')]();};}function saveUpdates(_0x56e409,_0x51a1d5){return function(_0x5b385a){if(_0x5b385a){return _0x5b385a[_0x91cb('0x22')](_0x56e409)[_0x91cb('0x23')](function(_0x20aff5){return _0x20aff5;});}return null;};}function removeEntity(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){_0x1dbee2['status'](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x1a7a54,_0x2447e7){return function(_0x422d14){if(!_0x422d14){_0x1a7a54[_0x91cb('0x19')](0x194);}return _0x422d14;};}function handleError(_0x7ad361,_0x414e60){_0x414e60=_0x414e60||0x1f4;return function(_0x423c4f){logger[_0x91cb('0x25')](_0x423c4f['stack']);if(_0x423c4f['name']){delete _0x423c4f[_0x91cb('0x26')];}_0x7ad361['status'](_0x414e60)[_0x91cb('0x27')](_0x423c4f);};}exports[_0x91cb('0x28')]=function(_0x318031,_0x5595c5){var _0x9b26a6={},_0x4f5a7b={},_0x4572f6={'count':0x0,'rows':[]};var _0x308e8c=_[_0x91cb('0x29')](db[_0x91cb('0x2a')][_0x91cb('0x2b')],function(_0x504275){return{'name':_0x504275[_0x91cb('0x2c')],'type':_0x504275['type'][_0x91cb('0x2d')]};});_0x4f5a7b[_0x91cb('0x2e')]=_[_0x91cb('0x29')](_0x308e8c,'name');_0x4f5a7b[_0x91cb('0x2f')]=_[_0x91cb('0x30')](_0x318031[_0x91cb('0x2f')]);_0x4f5a7b[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x4f5a7b[_0x91cb('0x2e')],_0x4f5a7b[_0x91cb('0x2f')]);_0x9b26a6[_0x91cb('0x33')]=_[_0x91cb('0x32')](_0x4f5a7b['model'],qs[_0x91cb('0x34')](_0x318031[_0x91cb('0x2f')][_0x91cb('0x34')]));_0x9b26a6[_0x91cb('0x33')]=_0x9b26a6[_0x91cb('0x33')]['length']?_0x9b26a6[_0x91cb('0x33')]:_0x4f5a7b[_0x91cb('0x2e')];if(!_0x318031[_0x91cb('0x2f')][_0x91cb('0x35')](_0x91cb('0x36'))){_0x9b26a6['limit']=qs[_0x91cb('0x1d')](_0x318031['query']['limit']);_0x9b26a6['offset']=qs[_0x91cb('0x1c')](_0x318031['query'][_0x91cb('0x1c')]);}_0x9b26a6['order']=qs['sort'](_0x318031[_0x91cb('0x2f')][_0x91cb('0x37')]);_0x9b26a6[_0x91cb('0x38')]=qs[_0x91cb('0x31')](_[_0x91cb('0x39')](_0x318031['query'],_0x4f5a7b[_0x91cb('0x31')]),_0x308e8c);if(_0x318031[_0x91cb('0x2f')][_0x91cb('0x3a')]){_0x9b26a6[_0x91cb('0x38')]=_['merge'](_0x9b26a6['where'],{'$or':_[_0x91cb('0x29')](_0x308e8c,function(_0x135bf1){if(_0x135bf1['type']!==_0x91cb('0x3b')){var _0x1dcdfe={};_0x1dcdfe[_0x135bf1['name']]={'$like':'%'+_0x318031[_0x91cb('0x2f')][_0x91cb('0x3a')]+'%'};return _0x1dcdfe;}})});}_0x9b26a6=_['merge']({},_0x9b26a6,_0x318031[_0x91cb('0x3c')]);var _0x545687={'where':_0x9b26a6[_0x91cb('0x38')]};return db[_0x91cb('0x2a')][_0x91cb('0x3d')](_0x545687)[_0x91cb('0x23')](function(_0x51d0ea){_0x4572f6[_0x91cb('0x3d')]=_0x51d0ea;if(_0x318031['query'][_0x91cb('0x3e')]){_0x9b26a6[_0x91cb('0x3f')]=[{'all':!![]}];}return db['UserProfileResource'][_0x91cb('0x40')](_0x9b26a6);})['then'](function(_0x2c6102){_0x4572f6[_0x91cb('0x41')]=_0x2c6102;return _0x4572f6;})[_0x91cb('0x23')](respondWithFilteredResult(_0x5595c5,_0x9b26a6))[_0x91cb('0x42')](handleError(_0x5595c5,null));};exports['show']=function(_0x435fff,_0x5af0e6){var _0x2cf27e={'raw':![],'where':{'id':_0x435fff[_0x91cb('0x43')]['id']}},_0x37e777={};_0x37e777[_0x91cb('0x2e')]=_[_0x91cb('0x30')](db[_0x91cb('0x2a')][_0x91cb('0x2b')]);_0x37e777[_0x91cb('0x2f')]=_['keys'](_0x435fff[_0x91cb('0x2f')]);_0x37e777['filters']=_[_0x91cb('0x32')](_0x37e777['model'],_0x37e777[_0x91cb('0x2f')]);_0x2cf27e['attributes']=_[_0x91cb('0x32')](_0x37e777[_0x91cb('0x2e')],qs[_0x91cb('0x34')](_0x435fff[_0x91cb('0x2f')]['fields']));_0x2cf27e[_0x91cb('0x33')]=_0x2cf27e[_0x91cb('0x33')]['length']?_0x2cf27e[_0x91cb('0x33')]:_0x37e777[_0x91cb('0x2e')];if(_0x435fff[_0x91cb('0x2f')][_0x91cb('0x3e')]){_0x2cf27e[_0x91cb('0x3f')]=[{'all':!![]}];}_0x2cf27e=_[_0x91cb('0x44')]({},_0x2cf27e,_0x435fff[_0x91cb('0x3c')]);return db[_0x91cb('0x2a')][_0x91cb('0x45')](_0x2cf27e)['then'](handleEntityNotFound(_0x5af0e6,null))[_0x91cb('0x23')](respondWithResult(_0x5af0e6,null))[_0x91cb('0x42')](handleError(_0x5af0e6,null));};exports[_0x91cb('0x46')]=function(_0x470996,_0x3314cc){return db[_0x91cb('0x2a')][_0x91cb('0x46')](_0x470996[_0x91cb('0x47')],{})['then'](respondWithResult(_0x3314cc,0xc9))[_0x91cb('0x42')](handleError(_0x3314cc,null));};exports[_0x91cb('0x22')]=function(_0x2b8b7f,_0x3b8cfd){if(_0x2b8b7f['body']['id']){delete _0x2b8b7f[_0x91cb('0x47')]['id'];}return db[_0x91cb('0x2a')]['find']({'where':{'id':_0x2b8b7f[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b8cfd,null))[_0x91cb('0x23')](saveUpdates(_0x2b8b7f['body'],null))['then'](respondWithResult(_0x3b8cfd,null))['catch'](handleError(_0x3b8cfd,null));};exports[_0x91cb('0x24')]=function(_0xff3d11,_0x3d62c4){return db[_0x91cb('0x2a')][_0x91cb('0x45')]({'where':{'id':_0xff3d11['params']['id']}})['then'](handleEntityNotFound(_0x3d62c4,null))[_0x91cb('0x23')](removeEntity(_0x3d62c4,null))[_0x91cb('0x42')](handleError(_0x3d62c4,null));};exports[_0x91cb('0x48')]=function(_0x14eaab,_0x57adff){return db['UserProfileResource']['describe']()[_0x91cb('0x23')](respondWithResult(_0x57adff,null))['catch'](handleError(_0x57adff,null));}; \ No newline at end of file +var _0xe14b=['catch','create','body','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','rows','show','fields','length','include','options','find'];(function(_0x483ae5,_0x1db864){var _0x2dbdf5=function(_0x48770c){while(--_0x48770c){_0x483ae5['push'](_0x483ae5['shift']());}};_0x2dbdf5(++_0x1db864);}(_0xe14b,0x93));var _0xbe14=function(_0x41b0bc,_0x2c0ec7){_0x41b0bc=_0x41b0bc-0x0;var _0x574e01=_0xe14b[_0x41b0bc];return _0x574e01;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x505dbd,_0x2da350){return function(_0x4d4190){if(!_0x4d4190){_0x505dbd[_0xbe14('0x16')](0x194);}return _0x4d4190;};}function handleError(_0x4851f8,_0x36a21e){_0x36a21e=_0x36a21e||0x1f4;return function(_0x5fa043){logger[_0xbe14('0x22')](_0x5fa043[_0xbe14('0x23')]);if(_0x5fa043[_0xbe14('0x24')]){delete _0x5fa043[_0xbe14('0x24')];}_0x4851f8['status'](_0x36a21e)[_0xbe14('0x25')](_0x5fa043);};}exports[_0xbe14('0x26')]=function(_0x391556,_0x169369){var _0x5dd475={},_0x16f884={},_0x29fc64={'count':0x0,'rows':[]};var _0x59bf34=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x19252f){return{'name':_0x19252f[_0xbe14('0x2a')],'type':_0x19252f[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x16f884[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x59bf34,_0xbe14('0x24'));_0x16f884[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x391556[_0xbe14('0x2e')]);_0x16f884[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],_0x16f884[_0xbe14('0x2e')]);_0x5dd475[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],qs['fields'](_0x391556[_0xbe14('0x2e')]['fields']));_0x5dd475['attributes']=_0x5dd475[_0xbe14('0x32')]['length']?_0x5dd475[_0xbe14('0x32')]:_0x16f884[_0xbe14('0x2d')];if(!_0x391556['query']['hasOwnProperty']('nolimit')){_0x5dd475[_0xbe14('0x1b')]=qs[_0xbe14('0x1b')](_0x391556['query'][_0xbe14('0x1b')]);_0x5dd475[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x391556[_0xbe14('0x2e')][_0xbe14('0x1a')]);}_0x5dd475['order']=qs['sort'](_0x391556[_0xbe14('0x2e')]['sort']);_0x5dd475['where']=qs['filters'](_[_0xbe14('0x33')](_0x391556[_0xbe14('0x2e')],_0x16f884[_0xbe14('0x30')]),_0x59bf34);if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]){_0x5dd475[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x5dd475[_0xbe14('0x35')],{'$or':_[_0xbe14('0x27')](_0x59bf34,function(_0x2dfd5a){if(_0x2dfd5a[_0xbe14('0x2b')]!==_0xbe14('0x37')){var _0x539c41={};_0x539c41[_0x2dfd5a['name']]={'$like':'%'+_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]+'%'};return _0x539c41;}})});}_0x5dd475=_[_0xbe14('0x36')]({},_0x5dd475,_0x391556['options']);var _0x326329={'where':_0x5dd475[_0xbe14('0x35')]};return db[_0xbe14('0x28')][_0xbe14('0x19')](_0x326329)[_0xbe14('0x38')](function(_0x25ee1f){_0x29fc64[_0xbe14('0x19')]=_0x25ee1f;if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x39')]){_0x5dd475['include']=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x3a')](_0x5dd475);})[_0xbe14('0x38')](function(_0x1b3118){_0x29fc64[_0xbe14('0x3b')]=_0x1b3118;return _0x29fc64;})[_0xbe14('0x38')](respondWithFilteredResult(_0x169369,_0x5dd475))['catch'](handleError(_0x169369,null));};exports[_0xbe14('0x3c')]=function(_0x1974a4,_0x1220c9){var _0x36263c={'raw':![],'where':{'id':_0x1974a4['params']['id']}},_0x5cf713={};_0x5cf713[_0xbe14('0x2d')]=_[_0xbe14('0x2f')](db[_0xbe14('0x28')]['rawAttributes']);_0x5cf713['query']=_[_0xbe14('0x2f')](_0x1974a4['query']);_0x5cf713['filters']=_[_0xbe14('0x31')](_0x5cf713[_0xbe14('0x2d')],_0x5cf713[_0xbe14('0x2e')]);_0x36263c['attributes']=_['intersection'](_0x5cf713['model'],qs[_0xbe14('0x3d')](_0x1974a4[_0xbe14('0x2e')][_0xbe14('0x3d')]));_0x36263c['attributes']=_0x36263c[_0xbe14('0x32')][_0xbe14('0x3e')]?_0x36263c[_0xbe14('0x32')]:_0x5cf713[_0xbe14('0x2d')];if(_0x1974a4['query']['includeAll']){_0x36263c[_0xbe14('0x3f')]=[{'all':!![]}];}_0x36263c=_[_0xbe14('0x36')]({},_0x36263c,_0x1974a4[_0xbe14('0x40')]);return db[_0xbe14('0x28')][_0xbe14('0x41')](_0x36263c)['then'](handleEntityNotFound(_0x1220c9,null))['then'](respondWithResult(_0x1220c9,null))[_0xbe14('0x42')](handleError(_0x1220c9,null));};exports[_0xbe14('0x43')]=function(_0x238c60,_0x2a3b35){return db['UserProfileResource'][_0xbe14('0x43')](_0x238c60[_0xbe14('0x44')],{})['then'](respondWithResult(_0x2a3b35,0xc9))[_0xbe14('0x42')](handleError(_0x2a3b35,null));};exports[_0xbe14('0x20')]=function(_0x2d6ee8,_0x36c20c){if(_0x2d6ee8['body']['id']){delete _0x2d6ee8['body']['id'];}return db[_0xbe14('0x28')][_0xbe14('0x41')]({'where':{'id':_0x2d6ee8['params']['id']}})['then'](handleEntityNotFound(_0x36c20c,null))[_0xbe14('0x38')](saveUpdates(_0x2d6ee8[_0xbe14('0x44')],null))[_0xbe14('0x38')](respondWithResult(_0x36c20c,null))[_0xbe14('0x42')](handleError(_0x36c20c,null));};exports[_0xbe14('0x21')]=function(_0xd04fd5,_0x10cd86){return db['UserProfileResource'][_0xbe14('0x41')]({'where':{'id':_0xd04fd5[_0xbe14('0x45')]['id']}})[_0xbe14('0x38')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x38')](removeEntity(_0x10cd86,null))[_0xbe14('0x42')](handleError(_0x10cd86,null));};exports['describe']=function(_0x3a221b,_0x3d419a){return db[_0xbe14('0x28')][_0xbe14('0x46')]()[_0xbe14('0x38')](respondWithResult(_0x3d419a,null))[_0xbe14('0x42')](handleError(_0x3d419a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f336734..027e0e4 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 _0x3a4e=['bluebird','request-promise','path','rimraf','exports','UserProfileResource','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3a4e,0x1b5));var _0xe3a4=function(_0x2ac804,_0x536f14){_0x2ac804=_0x2ac804-0x0;var _0x563dea=_0x3a4e[_0x2ac804];return _0x563dea;};'use strict';var _=require(_0xe3a4('0x0'));var util=require(_0xe3a4('0x1'));var logger=require(_0xe3a4('0x2'))(_0xe3a4('0x3'));var moment=require(_0xe3a4('0x4'));var BPromise=require(_0xe3a4('0x5'));var rp=require(_0xe3a4('0x6'));var fs=require('fs');var path=require(_0xe3a4('0x7'));var rimraf=require(_0xe3a4('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xe3a4('0x9')]=function(_0x73e538,_0xdfa38f){return _0x73e538['define'](_0xe3a4('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xe3a4('0xb'),'fields':['resourceId',_0xe3a4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8dac=['sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8dac,0xc5));var _0xc8da=function(_0x9d94f2,_0x4093e3){_0x9d94f2=_0x9d94f2-0x0;var _0x35f1fe=_0x8dac[_0x9d94f2];return _0x35f1fe;};'use strict';var _=require(_0xc8da('0x0'));var util=require('util');var logger=require(_0xc8da('0x1'))(_0xc8da('0x2'));var moment=require(_0xc8da('0x3'));var BPromise=require(_0xc8da('0x4'));var rp=require(_0xc8da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8da('0x6'));var attributes=require(_0xc8da('0x7'));module[_0xc8da('0x8')]=function(_0x1c3e09,_0x5da698){return _0x1c3e09[_0xc8da('0x9')](_0xc8da('0xa'),attributes,{'tableName':_0xc8da('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc8da('0xc'),_0xc8da('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 145efee..a23b10d 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 _0xf376=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x429e7e,_0x5ae693){var _0x22c7d7=function(_0x1d4c77){while(--_0x1d4c77){_0x429e7e['push'](_0x429e7e['shift']());}};_0x22c7d7(++_0x5ae693);}(_0xf376,0x14d));var _0x6f37=function(_0x3970df,_0x2522a4){_0x3970df=_0x3970df-0x0;var _0x2c7054=_0xf376[_0x3970df];return _0x2c7054;};'use strict';var _=require(_0x6f37('0x0'));var util=require(_0x6f37('0x1'));var moment=require(_0x6f37('0x2'));var BPromise=require(_0x6f37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f37('0x4'))['db'];var utils=require(_0x6f37('0x5'));var logger=require('../../config/logger')(_0x6f37('0x6'));var config=require(_0x6f37('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f37('0x8')][_0x6f37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x127411,_0x31da6e,_0x2c9abe){return new BPromise(function(_0x286b38,_0x36c0b8){return client['request'](_0x127411,_0x2c9abe)[_0x6f37('0xa')](function(_0x4952cb){logger[_0x6f37('0xb')](_0x6f37('0xc'),_0x31da6e,_0x6f37('0xd'));logger[_0x6f37('0xe')](_0x6f37('0xf'),_0x31da6e,'request\x20sent',JSON[_0x6f37('0x10')](_0x4952cb));if(_0x4952cb['error']){if(_0x4952cb['error'][_0x6f37('0x11')]===0x1f4){logger[_0x6f37('0x12')](_0x6f37('0xc'),_0x31da6e,_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);return _0x36c0b8(_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x31da6e,_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);return _0x286b38(_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);}else{logger[_0x6f37('0xb')](_0x6f37('0xc'),_0x31da6e,_0x6f37('0xd'));_0x286b38(_0x4952cb[_0x6f37('0x14')][_0x6f37('0x13')]);}})[_0x6f37('0x15')](function(_0x3d088c){logger[_0x6f37('0x12')](_0x6f37('0xc'),_0x31da6e,_0x3d088c);_0x36c0b8(_0x3d088c);});});} \ No newline at end of file +var _0x67d4=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x4003b2,_0x3309ed){var _0x5d0d45=function(_0x4cffb7){while(--_0x4cffb7){_0x4003b2['push'](_0x4003b2['shift']());}};_0x5d0d45(++_0x3309ed);}(_0x67d4,0x14e));var _0x467d=function(_0xe4e7f,_0x5879ab){_0xe4e7f=_0xe4e7f-0x0;var _0x24a64e=_0x67d4[_0xe4e7f];return _0x24a64e;};'use strict';var _=require(_0x467d('0x0'));var util=require(_0x467d('0x1'));var moment=require(_0x467d('0x2'));var BPromise=require(_0x467d('0x3'));var rs=require(_0x467d('0x4'));var fs=require('fs');var Redis=require(_0x467d('0x5'));var db=require(_0x467d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x467d('0x7'));var config=require(_0x467d('0x8'));var jayson=require(_0x467d('0x9'));var client=jayson[_0x467d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33e6e1,_0x2dc8bc,_0x1cf5b5){return new BPromise(function(_0x42c13b,_0x3d7e4d){return client[_0x467d('0xb')](_0x33e6e1,_0x1cf5b5)[_0x467d('0xc')](function(_0x375778){logger[_0x467d('0xd')](_0x467d('0xe'),_0x2dc8bc,_0x467d('0xf'));logger[_0x467d('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2dc8bc,'request\x20sent',JSON[_0x467d('0x11')](_0x375778));if(_0x375778[_0x467d('0x12')]){if(_0x375778[_0x467d('0x12')][_0x467d('0x13')]===0x1f4){logger[_0x467d('0x12')](_0x467d('0xe'),_0x2dc8bc,_0x375778[_0x467d('0x12')]['message']);return _0x3d7e4d(_0x375778[_0x467d('0x12')][_0x467d('0x14')]);}logger[_0x467d('0x12')](_0x467d('0xe'),_0x2dc8bc,_0x375778['error']['message']);return _0x42c13b(_0x375778[_0x467d('0x12')][_0x467d('0x14')]);}else{logger[_0x467d('0xd')](_0x467d('0xe'),_0x2dc8bc,_0x467d('0xf'));_0x42c13b(_0x375778[_0x467d('0x15')]['message']);}})[_0x467d('0x16')](function(_0x439016){logger['error'](_0x467d('0xe'),_0x2dc8bc,_0x439016);_0x3d7e4d(_0x439016);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index d51fe67..814fb6f 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 _0x3a5e=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5e5099,_0x32b6a1){var _0x21b248=function(_0x156236){while(--_0x156236){_0x5e5099['push'](_0x5e5099['shift']());}};_0x21b248(++_0x32b6a1);}(_0x3a5e,0x14c));var _0xe3a5=function(_0xe2872,_0x5f9a58){_0xe2872=_0xe2872-0x0;var _0x3967ad=_0x3a5e[_0xe2872];return _0x3967ad;};'use strict';var multer=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var path=require(_0xe3a5('0x2'));var timeout=require(_0xe3a5('0x3'));var express=require(_0xe3a5('0x4'));var router=express[_0xe3a5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe3a5('0x6'));var config=require(_0xe3a5('0x7'));var controller=require(_0xe3a5('0x8'));router[_0xe3a5('0x9')]('/',auth[_0xe3a5('0xa')](),controller['index']);router['get'](_0xe3a5('0xb'),auth['isAuthenticated'](),controller[_0xe3a5('0xc')]);router[_0xe3a5('0x9')](_0xe3a5('0xd'),auth[_0xe3a5('0xa')](),controller[_0xe3a5('0xe')]);router[_0xe3a5('0xf')]('/',auth[_0xe3a5('0xa')](),controller['create']);router[_0xe3a5('0x10')](_0xe3a5('0xd'),auth[_0xe3a5('0xa')](),controller[_0xe3a5('0x11')]);router['delete'](_0xe3a5('0xd'),auth[_0xe3a5('0xa')](),controller[_0xe3a5('0x12')]);module[_0xe3a5('0x13')]=router; \ No newline at end of file +var _0x64d0=['create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0x64d0,0xf2));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x064d('0x0'));var util=require(_0x064d('0x1'));var path=require(_0x064d('0x2'));var timeout=require(_0x064d('0x3'));var express=require('express');var router=express[_0x064d('0x4')]();var auth=require(_0x064d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x064d('0x6'));var controller=require('./userProfileSection.controller');router[_0x064d('0x7')]('/',auth[_0x064d('0x8')](),controller[_0x064d('0x9')]);router[_0x064d('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x064d('0x7')](_0x064d('0xa'),auth[_0x064d('0x8')](),controller[_0x064d('0xb')]);router[_0x064d('0xc')]('/',auth['isAuthenticated'](),controller[_0x064d('0xd')]);router[_0x064d('0xe')](_0x064d('0xa'),auth[_0x064d('0x8')](),controller['update']);router[_0x064d('0xf')](_0x064d('0xa'),auth[_0x064d('0x8')](),controller['destroy']);module[_0x064d('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ff35764..44d93bf 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 _0x8e0d=['BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','STRING','INTEGER'];(function(_0x38194f,_0x282edf){var _0x27975b=function(_0x1c1d62){while(--_0x1c1d62){_0x38194f['push'](_0x38194f['shift']());}};_0x27975b(++_0x282edf);}(_0x8e0d,0x82));var _0xd8e0=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x8e0d[_0x95411e];return _0x2c8718;};'use strict';var Sequelize=require(_0xd8e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xd8e0('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd8e0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd8e0('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd8e0('0x1')],'set':function(_0x14598d){this[_0xd8e0('0x4')]('crudPermissions',_0x14598d?_0x14598d['join'](''):[]);},'get':function(){return this[_0xd8e0('0x5')](_0xd8e0('0x6'))?this[_0xd8e0('0x5')](_0xd8e0('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0x8f69=['sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x11d1bc,_0x380f4f){var _0x567d00=function(_0x3814e3){while(--_0x3814e3){_0x11d1bc['push'](_0x11d1bc['shift']());}};_0x567d00(++_0x380f4f);}(_0x8f69,0xfa));var _0x98f6=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x8f69[_0x3e6729];return _0x535bcd;};'use strict';var Sequelize=require(_0x98f6('0x0'));module[_0x98f6('0x1')]={'name':{'type':Sequelize[_0x98f6('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x98f6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x98f6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x98f6('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x515b73){this[_0x98f6('0x5')]('crudPermissions',_0x515b73?_0x515b73[_0x98f6('0x6')](''):[]);},'get':function(){return this[_0x98f6('0x7')](_0x98f6('0x8'))?this[_0x98f6('0x7')]('crudPermissions')[_0x98f6('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6157ac1..17afc83 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 _0x544a=['key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type'];(function(_0x4c7f5d,_0x4e0ba0){var _0xff7bb4=function(_0x1f5316){while(--_0x1f5316){_0x4c7f5d['push'](_0x4c7f5d['shift']());}};_0xff7bb4(++_0x4e0ba0);}(_0x544a,0xaf));var _0xa544=function(_0x49ba83,_0x190d71){_0x49ba83=_0x49ba83-0x0;var _0xf84e81=_0x544a[_0x49ba83];return _0xf84e81;};'use strict';var pdf=require(_0xa544('0x0'));var emlformat=require(_0xa544('0x1'));var rimraf=require(_0xa544('0x2'));var zipdir=require(_0xa544('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa544('0x4'));var moment=require(_0xa544('0x5'));var BPromise=require(_0xa544('0x6'));var Mustache=require(_0xa544('0x7'));var util=require('util');var path=require(_0xa544('0x8'));var sox=require(_0xa544('0x9'));var csv=require(_0xa544('0xa'));var ejs=require(_0xa544('0xb'));var fs=require('fs');var _=require(_0xa544('0xc'));var squel=require(_0xa544('0xd'));var crypto=require(_0xa544('0xe'));var jsforce=require(_0xa544('0xf'));var deskjs=require(_0xa544('0x10'));var toCsv=require(_0xa544('0xa'));var querystring=require(_0xa544('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa544('0x12'))(_0xa544('0x13'));var utils=require(_0xa544('0x14'));var config=require(_0xa544('0x15'));var licenseUtil=require(_0xa544('0x16'));var db=require(_0xa544('0x17'))['db'];function respondWithStatusCode(_0x1bead8,_0x22ee61){_0x22ee61=_0x22ee61||0xcc;return function(_0x38412d){if(_0x38412d){return _0x1bead8['sendStatus'](_0x22ee61);}return _0x1bead8[_0xa544('0x18')](_0x22ee61)[_0xa544('0x19')]();};}function respondWithResult(_0x62cd1d,_0x3144fe){_0x3144fe=_0x3144fe||0xc8;return function(_0x5406a8){if(_0x5406a8){return _0x62cd1d['status'](_0x3144fe)[_0xa544('0x1a')](_0x5406a8);}};}function respondWithFilteredResult(_0x41b544,_0x4a5831){return function(_0x1409ba){if(_0x1409ba){var _0x1b39f3=_0x1409ba[_0xa544('0x1b')],_0x4f4a65=_0x4a5831[_0xa544('0x1c')],_0x558d62=_0x4a5831[_0xa544('0x1c')]+_0x4a5831['limit'],_0x38d339;if(_0x558d62>=_0x1b39f3){_0x558d62=_0x1b39f3;_0x38d339=0xc8;}else{_0x38d339=0xce;}_0x41b544[_0xa544('0x18')](_0x38d339);return _0x41b544[_0xa544('0x1d')](_0xa544('0x1e'),_0x4f4a65+'-'+_0x558d62+'/'+_0x1b39f3)['json'](_0x1409ba);}return null;};}function patchUpdates(_0x3c2a94){return function(_0x3e8cec){try{jsonpatch[_0xa544('0x1f')](_0x3e8cec,_0x3c2a94,!![]);}catch(_0x4227ff){return BPromise['reject'](_0x4227ff);}return _0x3e8cec[_0xa544('0x20')]();};}function saveUpdates(_0x3ba847,_0x15f841){return function(_0x3fed97){if(_0x3fed97){return _0x3fed97[_0xa544('0x21')](_0x3ba847)[_0xa544('0x22')](function(_0x574e5f){return _0x574e5f;});}return null;};}function removeEntity(_0x196a54,_0x1f2e25){return function(_0xb2c3f7){if(_0xb2c3f7){return _0xb2c3f7[_0xa544('0x23')]()['then'](function(){_0x196a54[_0xa544('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcdf95f,_0x586b1b){return function(_0x453de5){if(!_0x453de5){_0xcdf95f[_0xa544('0x24')](0x194);}return _0x453de5;};}function handleError(_0x4dce75,_0x16ed8d){_0x16ed8d=_0x16ed8d||0x1f4;return function(_0x1eac75){logger[_0xa544('0x25')](_0x1eac75[_0xa544('0x26')]);if(_0x1eac75['name']){delete _0x1eac75[_0xa544('0x27')];}_0x4dce75['status'](_0x16ed8d)[_0xa544('0x28')](_0x1eac75);};}exports[_0xa544('0x29')]=function(_0x1f0b5d,_0xdd8d75){var _0x2af390={},_0x57db12={},_0x31127e={'count':0x0,'rows':[]};var _0x2b361d=_[_0xa544('0x2a')](db[_0xa544('0x2b')][_0xa544('0x2c')],function(_0x526a36){return{'name':_0x526a36[_0xa544('0x2d')],'type':_0x526a36[_0xa544('0x2e')][_0xa544('0x2f')]};});_0x57db12[_0xa544('0x30')]=_[_0xa544('0x2a')](_0x2b361d,'name');_0x57db12['query']=_[_0xa544('0x31')](_0x1f0b5d[_0xa544('0x32')]);_0x57db12['filters']=_['intersection'](_0x57db12[_0xa544('0x30')],_0x57db12[_0xa544('0x32')]);_0x2af390[_0xa544('0x33')]=_[_0xa544('0x34')](_0x57db12[_0xa544('0x30')],qs[_0xa544('0x35')](_0x1f0b5d[_0xa544('0x32')][_0xa544('0x35')]));_0x2af390[_0xa544('0x33')]=_0x2af390[_0xa544('0x33')][_0xa544('0x36')]?_0x2af390[_0xa544('0x33')]:_0x57db12[_0xa544('0x30')];if(!_0x1f0b5d[_0xa544('0x32')][_0xa544('0x37')](_0xa544('0x38'))){_0x2af390[_0xa544('0x39')]=qs[_0xa544('0x39')](_0x1f0b5d[_0xa544('0x32')]['limit']);_0x2af390[_0xa544('0x1c')]=qs[_0xa544('0x1c')](_0x1f0b5d['query'][_0xa544('0x1c')]);}_0x2af390['order']=qs[_0xa544('0x3a')](_0x1f0b5d[_0xa544('0x32')][_0xa544('0x3a')]);_0x2af390[_0xa544('0x3b')]=qs[_0xa544('0x3c')](_[_0xa544('0x3d')](_0x1f0b5d[_0xa544('0x32')],_0x57db12[_0xa544('0x3c')]),_0x2b361d);if(_0x1f0b5d[_0xa544('0x32')]['filter']){_0x2af390[_0xa544('0x3b')]=_[_0xa544('0x3e')](_0x2af390[_0xa544('0x3b')],{'$or':_[_0xa544('0x2a')](_0x2b361d,function(_0x27cca9){if(_0x27cca9[_0xa544('0x2e')]!=='VIRTUAL'){var _0x1a3b1f={};_0x1a3b1f[_0x27cca9['name']]={'$like':'%'+_0x1f0b5d[_0xa544('0x32')][_0xa544('0x3f')]+'%'};return _0x1a3b1f;}})});}_0x2af390=_[_0xa544('0x3e')]({},_0x2af390,_0x1f0b5d[_0xa544('0x40')]);var _0x5d72a4={'where':_0x2af390['where']};return db['UserProfileSection'][_0xa544('0x1b')](_0x5d72a4)[_0xa544('0x22')](function(_0x5b8d5a){_0x31127e['count']=_0x5b8d5a;if(_0x1f0b5d[_0xa544('0x32')][_0xa544('0x41')]){_0x2af390['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xa544('0x42')](_0x2af390);})[_0xa544('0x22')](function(_0x25f64e){_0x31127e[_0xa544('0x43')]=_0x25f64e;return _0x31127e;})[_0xa544('0x22')](respondWithFilteredResult(_0xdd8d75,_0x2af390))[_0xa544('0x44')](handleError(_0xdd8d75,null));};exports[_0xa544('0x45')]=function(_0x5081b2,_0x51d7a1){var _0x1e687f={'raw':![],'where':{'id':_0x5081b2[_0xa544('0x46')]['id']}},_0x3a6dae={};_0x3a6dae[_0xa544('0x30')]=_['keys'](db[_0xa544('0x2b')][_0xa544('0x2c')]);_0x3a6dae[_0xa544('0x32')]=_[_0xa544('0x31')](_0x5081b2[_0xa544('0x32')]);_0x3a6dae['filters']=_[_0xa544('0x34')](_0x3a6dae[_0xa544('0x30')],_0x3a6dae[_0xa544('0x32')]);_0x1e687f[_0xa544('0x33')]=_[_0xa544('0x34')](_0x3a6dae['model'],qs['fields'](_0x5081b2['query'][_0xa544('0x35')]));_0x1e687f[_0xa544('0x33')]=_0x1e687f[_0xa544('0x33')]['length']?_0x1e687f[_0xa544('0x33')]:_0x3a6dae[_0xa544('0x30')];if(_0x5081b2[_0xa544('0x32')][_0xa544('0x41')]){_0x1e687f['include']=[{'all':!![]}];}_0x1e687f=_[_0xa544('0x3e')]({},_0x1e687f,_0x5081b2[_0xa544('0x40')]);return db[_0xa544('0x2b')][_0xa544('0x47')](_0x1e687f)[_0xa544('0x22')](handleEntityNotFound(_0x51d7a1,null))[_0xa544('0x22')](respondWithResult(_0x51d7a1,null))[_0xa544('0x44')](handleError(_0x51d7a1,null));};exports['create']=function(_0x2e1e41,_0x453352){return db['UserProfileSection']['create'](_0x2e1e41[_0xa544('0x48')],{})[_0xa544('0x22')](respondWithResult(_0x453352,0xc9))[_0xa544('0x44')](handleError(_0x453352,null));};exports['update']=function(_0xf5ede6,_0x3c5a23){if(_0xf5ede6[_0xa544('0x48')]['id']){delete _0xf5ede6['body']['id'];}return db[_0xa544('0x2b')][_0xa544('0x47')]({'where':{'id':_0xf5ede6[_0xa544('0x46')]['id']}})[_0xa544('0x22')](handleEntityNotFound(_0x3c5a23,null))[_0xa544('0x22')](saveUpdates(_0xf5ede6['body'],null))[_0xa544('0x22')](respondWithResult(_0x3c5a23,null))['catch'](handleError(_0x3c5a23,null));};exports[_0xa544('0x23')]=function(_0x5f1634,_0x1523cc){return db[_0xa544('0x2b')][_0xa544('0x47')]({'where':{'id':_0x5f1634[_0xa544('0x46')]['id']}})[_0xa544('0x22')](handleEntityNotFound(_0x1523cc,null))[_0xa544('0x22')](removeEntity(_0x1523cc,null))[_0xa544('0x44')](handleError(_0x1523cc,null));};exports[_0xa544('0x49')]=function(_0x396e3b,_0x1de60){return db[_0xa544('0x2b')][_0xa544('0x49')]()['then'](respondWithResult(_0x1de60,null))['catch'](handleError(_0x1de60,null));}; \ No newline at end of file +var _0xe021=['filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','show','params','include','create','body','catch','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','model','query','keys'];(function(_0x1d1fdf,_0x33ba5a){var _0x3521d6=function(_0x53281c){while(--_0x53281c){_0x1d1fdf['push'](_0x1d1fdf['shift']());}};_0x3521d6(++_0x33ba5a);}(_0xe021,0x138));var _0x1e02=function(_0x1d4447,_0x3a3336){_0x1d4447=_0x1d4447-0x0;var _0xd8d065=_0xe021[_0x1d4447];return _0xd8d065;};'use strict';var pdf=require(_0x1e02('0x0'));var emlformat=require(_0x1e02('0x1'));var rimraf=require(_0x1e02('0x2'));var zipdir=require(_0x1e02('0x3'));var jsonpatch=require(_0x1e02('0x4'));var rp=require(_0x1e02('0x5'));var moment=require(_0x1e02('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1e02('0x7'));var util=require(_0x1e02('0x8'));var path=require(_0x1e02('0x9'));var sox=require(_0x1e02('0xa'));var csv=require(_0x1e02('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e02('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e02('0xd'));var deskjs=require(_0x1e02('0xe'));var toCsv=require(_0x1e02('0xb'));var querystring=require(_0x1e02('0xf'));var Papa=require(_0x1e02('0x10'));var Redis=require(_0x1e02('0x11'));var authService=require(_0x1e02('0x12'));var qs=require(_0x1e02('0x13'));var as=require(_0x1e02('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e02('0x15'))(_0x1e02('0x16'));var utils=require(_0x1e02('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1e02('0x18'))['db'];function respondWithStatusCode(_0x3bbc4c,_0x4e0228){_0x4e0228=_0x4e0228||0xcc;return function(_0x21075b){if(_0x21075b){return _0x3bbc4c[_0x1e02('0x19')](_0x4e0228);}return _0x3bbc4c[_0x1e02('0x1a')](_0x4e0228)[_0x1e02('0x1b')]();};}function respondWithResult(_0x4c4645,_0x3d4edd){_0x3d4edd=_0x3d4edd||0xc8;return function(_0x32e615){if(_0x32e615){return _0x4c4645['status'](_0x3d4edd)[_0x1e02('0x1c')](_0x32e615);}};}function respondWithFilteredResult(_0x5ea601,_0x4a90b3){return function(_0x4262f7){if(_0x4262f7){var _0x497e72=_0x4262f7[_0x1e02('0x1d')],_0x57149b=_0x4a90b3[_0x1e02('0x1e')],_0x2012e0=_0x4a90b3['offset']+_0x4a90b3['limit'],_0x4649e1;if(_0x2012e0>=_0x497e72){_0x2012e0=_0x497e72;_0x4649e1=0xc8;}else{_0x4649e1=0xce;}_0x5ea601[_0x1e02('0x1a')](_0x4649e1);return _0x5ea601['set'](_0x1e02('0x1f'),_0x57149b+'-'+_0x2012e0+'/'+_0x497e72)['json'](_0x4262f7);}return null;};}function patchUpdates(_0x140683){return function(_0xbc70cb){try{jsonpatch['apply'](_0xbc70cb,_0x140683,!![]);}catch(_0x34a39a){return BPromise[_0x1e02('0x20')](_0x34a39a);}return _0xbc70cb[_0x1e02('0x21')]();};}function saveUpdates(_0x18eed9,_0xe63ef3){return function(_0x250dad){if(_0x250dad){return _0x250dad['update'](_0x18eed9)[_0x1e02('0x22')](function(_0x132ae7){return _0x132ae7;});}return null;};}function removeEntity(_0x27c9ed,_0x3b4efd){return function(_0x2086c5){if(_0x2086c5){return _0x2086c5['destroy']()[_0x1e02('0x22')](function(){_0x27c9ed[_0x1e02('0x1a')](0xcc)[_0x1e02('0x1b')]();});}};}function handleEntityNotFound(_0x2cea9a,_0xa3d4c7){return function(_0x54ff08){if(!_0x54ff08){_0x2cea9a['sendStatus'](0x194);}return _0x54ff08;};}function handleError(_0x5ed31e,_0x3c5d00){_0x3c5d00=_0x3c5d00||0x1f4;return function(_0x316a43){logger[_0x1e02('0x23')](_0x316a43[_0x1e02('0x24')]);if(_0x316a43[_0x1e02('0x25')]){delete _0x316a43['name'];}_0x5ed31e['status'](_0x3c5d00)[_0x1e02('0x26')](_0x316a43);};}exports[_0x1e02('0x27')]=function(_0x146b91,_0x13bc42){var _0x293481={},_0x3143d5={},_0x11622d={'count':0x0,'rows':[]};var _0x23681d=_[_0x1e02('0x28')](db[_0x1e02('0x29')][_0x1e02('0x2a')],function(_0x34789e){return{'name':_0x34789e['fieldName'],'type':_0x34789e[_0x1e02('0x2b')][_0x1e02('0x2c')]};});_0x3143d5[_0x1e02('0x2d')]=_[_0x1e02('0x28')](_0x23681d,_0x1e02('0x25'));_0x3143d5[_0x1e02('0x2e')]=_[_0x1e02('0x2f')](_0x146b91[_0x1e02('0x2e')]);_0x3143d5[_0x1e02('0x30')]=_['intersection'](_0x3143d5[_0x1e02('0x2d')],_0x3143d5[_0x1e02('0x2e')]);_0x293481[_0x1e02('0x31')]=_[_0x1e02('0x32')](_0x3143d5[_0x1e02('0x2d')],qs[_0x1e02('0x33')](_0x146b91[_0x1e02('0x2e')][_0x1e02('0x33')]));_0x293481[_0x1e02('0x31')]=_0x293481[_0x1e02('0x31')][_0x1e02('0x34')]?_0x293481[_0x1e02('0x31')]:_0x3143d5['model'];if(!_0x146b91[_0x1e02('0x2e')]['hasOwnProperty']('nolimit')){_0x293481['limit']=qs['limit'](_0x146b91[_0x1e02('0x2e')][_0x1e02('0x35')]);_0x293481[_0x1e02('0x1e')]=qs['offset'](_0x146b91[_0x1e02('0x2e')][_0x1e02('0x1e')]);}_0x293481[_0x1e02('0x36')]=qs['sort'](_0x146b91['query'][_0x1e02('0x37')]);_0x293481[_0x1e02('0x38')]=qs[_0x1e02('0x30')](_[_0x1e02('0x39')](_0x146b91[_0x1e02('0x2e')],_0x3143d5[_0x1e02('0x30')]),_0x23681d);if(_0x146b91[_0x1e02('0x2e')][_0x1e02('0x3a')]){_0x293481['where']=_['merge'](_0x293481['where'],{'$or':_['map'](_0x23681d,function(_0x322a9b){if(_0x322a9b[_0x1e02('0x2b')]!==_0x1e02('0x3b')){var _0x240999={};_0x240999[_0x322a9b[_0x1e02('0x25')]]={'$like':'%'+_0x146b91[_0x1e02('0x2e')]['filter']+'%'};return _0x240999;}})});}_0x293481=_['merge']({},_0x293481,_0x146b91[_0x1e02('0x3c')]);var _0x2d09e2={'where':_0x293481[_0x1e02('0x38')]};return db['UserProfileSection'][_0x1e02('0x1d')](_0x2d09e2)[_0x1e02('0x22')](function(_0x14e578){_0x11622d[_0x1e02('0x1d')]=_0x14e578;if(_0x146b91[_0x1e02('0x2e')][_0x1e02('0x3d')]){_0x293481['include']=[{'all':!![]}];}return db[_0x1e02('0x29')]['findAll'](_0x293481);})['then'](function(_0x3ce034){_0x11622d[_0x1e02('0x3e')]=_0x3ce034;return _0x11622d;})[_0x1e02('0x22')](respondWithFilteredResult(_0x13bc42,_0x293481))['catch'](handleError(_0x13bc42,null));};exports[_0x1e02('0x3f')]=function(_0x18ae2f,_0x193ae9){var _0x263f99={'raw':![],'where':{'id':_0x18ae2f[_0x1e02('0x40')]['id']}},_0x354456={};_0x354456[_0x1e02('0x2d')]=_[_0x1e02('0x2f')](db[_0x1e02('0x29')]['rawAttributes']);_0x354456[_0x1e02('0x2e')]=_[_0x1e02('0x2f')](_0x18ae2f[_0x1e02('0x2e')]);_0x354456[_0x1e02('0x30')]=_[_0x1e02('0x32')](_0x354456[_0x1e02('0x2d')],_0x354456[_0x1e02('0x2e')]);_0x263f99[_0x1e02('0x31')]=_[_0x1e02('0x32')](_0x354456['model'],qs['fields'](_0x18ae2f['query']['fields']));_0x263f99[_0x1e02('0x31')]=_0x263f99[_0x1e02('0x31')][_0x1e02('0x34')]?_0x263f99[_0x1e02('0x31')]:_0x354456[_0x1e02('0x2d')];if(_0x18ae2f[_0x1e02('0x2e')][_0x1e02('0x3d')]){_0x263f99[_0x1e02('0x41')]=[{'all':!![]}];}_0x263f99=_['merge']({},_0x263f99,_0x18ae2f['options']);return db[_0x1e02('0x29')]['find'](_0x263f99)['then'](handleEntityNotFound(_0x193ae9,null))['then'](respondWithResult(_0x193ae9,null))['catch'](handleError(_0x193ae9,null));};exports['create']=function(_0x3c5043,_0x2c0931){return db[_0x1e02('0x29')][_0x1e02('0x42')](_0x3c5043[_0x1e02('0x43')],{})[_0x1e02('0x22')](respondWithResult(_0x2c0931,0xc9))[_0x1e02('0x44')](handleError(_0x2c0931,null));};exports['update']=function(_0x475258,_0x4e23e9){if(_0x475258['body']['id']){delete _0x475258[_0x1e02('0x43')]['id'];}return db['UserProfileSection'][_0x1e02('0x45')]({'where':{'id':_0x475258['params']['id']}})[_0x1e02('0x22')](handleEntityNotFound(_0x4e23e9,null))[_0x1e02('0x22')](saveUpdates(_0x475258['body'],null))['then'](respondWithResult(_0x4e23e9,null))[_0x1e02('0x44')](handleError(_0x4e23e9,null));};exports[_0x1e02('0x46')]=function(_0x111136,_0x1bd098){return db[_0x1e02('0x29')][_0x1e02('0x45')]({'where':{'id':_0x111136['params']['id']}})['then'](handleEntityNotFound(_0x1bd098,null))[_0x1e02('0x22')](removeEntity(_0x1bd098,null))[_0x1e02('0x44')](handleError(_0x1bd098,null));};exports[_0x1e02('0x47')]=function(_0x3e11cf,_0x51af05){return db[_0x1e02('0x29')][_0x1e02('0x47')]()['then'](respondWithResult(_0x51af05,null))[_0x1e02('0x44')](handleError(_0x51af05,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2225e01..1ebe748 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 _0x0f4b=['rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','sectionId','userProfileId','../../config/logger','api','moment','bluebird'];(function(_0x4eca71,_0x93e47e){var _0x45d25d=function(_0x155791){while(--_0x155791){_0x4eca71['push'](_0x4eca71['shift']());}};_0x45d25d(++_0x93e47e);}(_0x0f4b,0x1a9));var _0xb0f4=function(_0x2c93f0,_0x2a88e7){_0x2c93f0=_0x2c93f0-0x0;var _0x2dc388=_0x0f4b[_0x2c93f0];return _0x2dc388;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb0f4('0x0'))(_0xb0f4('0x1'));var moment=require(_0xb0f4('0x2'));var BPromise=require(_0xb0f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0f4('0x4'));var config=require(_0xb0f4('0x5'));var attributes=require(_0xb0f4('0x6'));module['exports']=function(_0x3cc841,_0x379070){return _0x3cc841[_0xb0f4('0x7')](_0xb0f4('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb0f4('0x9'),_0xb0f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d90=['request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1c4006,_0x2524d4){var _0x19586e=function(_0x75a04b){while(--_0x75a04b){_0x1c4006['push'](_0x1c4006['shift']());}};_0x19586e(++_0x2524d4);}(_0x0d90,0xa0));var _0x00d9=function(_0x28af0f,_0x414fa3){_0x28af0f=_0x28af0f-0x0;var _0x300e44=_0x0d90[_0x28af0f];return _0x300e44;};'use strict';var _=require(_0x00d9('0x0'));var util=require(_0x00d9('0x1'));var logger=require(_0x00d9('0x2'))('api');var moment=require(_0x00d9('0x3'));var BPromise=require(_0x00d9('0x4'));var rp=require(_0x00d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00d9('0x6'));var config=require(_0x00d9('0x7'));var attributes=require(_0x00d9('0x8'));module[_0x00d9('0x9')]=function(_0xf76e6a,_0x5768fb){return _0xf76e6a[_0x00d9('0xa')](_0x00d9('0xb'),attributes,{'tableName':_0x00d9('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x00d9('0xd'),_0x00d9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index faeaf15..1a56ce4 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 _0x7056=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x881128,_0x4e73b9){var _0x53f69f=function(_0x17f410){while(--_0x17f410){_0x881128['push'](_0x881128['shift']());}};_0x53f69f(++_0x4e73b9);}(_0x7056,0xc1));var _0x6705=function(_0x23291a,_0x9d9e12){_0x23291a=_0x23291a-0x0;var _0x75ae3d=_0x7056[_0x23291a];return _0x75ae3d;};'use strict';var _=require(_0x6705('0x0'));var util=require(_0x6705('0x1'));var moment=require('moment');var BPromise=require(_0x6705('0x2'));var rs=require(_0x6705('0x3'));var fs=require('fs');var Redis=require(_0x6705('0x4'));var db=require(_0x6705('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6705('0x6'))('rpc');var config=require(_0x6705('0x7'));var jayson=require(_0x6705('0x8'));var client=jayson[_0x6705('0x9')][_0x6705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b9e0a,_0x424809,_0x2033c6){return new BPromise(function(_0x555454,_0x67a6b5){return client[_0x6705('0xb')](_0x4b9e0a,_0x2033c6)[_0x6705('0xc')](function(_0x15b58c){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x424809,_0x6705('0xd'));logger[_0x6705('0xe')](_0x6705('0xf'),_0x424809,_0x6705('0xd'),JSON[_0x6705('0x10')](_0x15b58c));if(_0x15b58c[_0x6705('0x11')]){if(_0x15b58c[_0x6705('0x11')][_0x6705('0x12')]===0x1f4){logger['error'](_0x6705('0x13'),_0x424809,_0x15b58c[_0x6705('0x11')]['message']);return _0x67a6b5(_0x15b58c[_0x6705('0x11')][_0x6705('0x14')]);}logger[_0x6705('0x11')](_0x6705('0x13'),_0x424809,_0x15b58c[_0x6705('0x11')][_0x6705('0x14')]);return _0x555454(_0x15b58c['error']['message']);}else{logger[_0x6705('0x15')](_0x6705('0x13'),_0x424809,_0x6705('0xd'));_0x555454(_0x15b58c[_0x6705('0x16')]['message']);}})['catch'](function(_0x2cec7f){logger[_0x6705('0x11')](_0x6705('0x13'),_0x424809,_0x2cec7f);_0x67a6b5(_0x2cec7f);});});} \ No newline at end of file +var _0x32b6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis'];(function(_0x9b5735,_0x51a3c1){var _0x53605a=function(_0x10208b){while(--_0x10208b){_0x9b5735['push'](_0x9b5735['shift']());}};_0x53605a(++_0x51a3c1);}(_0x32b6,0x18b));var _0x632b=function(_0x20109d,_0x552810){_0x20109d=_0x20109d-0x0;var _0x3a42b7=_0x32b6[_0x20109d];return _0x3a42b7;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require(_0x632b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x632b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))('rpc');var config=require(_0x632b('0x6'));var jayson=require(_0x632b('0x7'));var client=jayson[_0x632b('0x8')][_0x632b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2791c7,_0x4bf6b5,_0x115f8f){return new BPromise(function(_0x3adbdc,_0x3b98a4){return client['request'](_0x2791c7,_0x115f8f)[_0x632b('0xa')](function(_0x4cfa11){logger['info'](_0x632b('0xb'),_0x4bf6b5,'request\x20sent');logger['debug'](_0x632b('0xc'),_0x4bf6b5,_0x632b('0xd'),JSON[_0x632b('0xe')](_0x4cfa11));if(_0x4cfa11['error']){if(_0x4cfa11[_0x632b('0xf')]['code']===0x1f4){logger[_0x632b('0xf')](_0x632b('0xb'),_0x4bf6b5,_0x4cfa11['error'][_0x632b('0x10')]);return _0x3b98a4(_0x4cfa11['error'][_0x632b('0x10')]);}logger[_0x632b('0xf')](_0x632b('0xb'),_0x4bf6b5,_0x4cfa11['error'][_0x632b('0x10')]);return _0x3adbdc(_0x4cfa11[_0x632b('0xf')][_0x632b('0x10')]);}else{logger['info'](_0x632b('0xb'),_0x4bf6b5,_0x632b('0xd'));_0x3adbdc(_0x4cfa11[_0x632b('0x11')]['message']);}})[_0x632b('0x12')](function(_0x50d213){logger[_0x632b('0xf')](_0x632b('0xb'),_0x4bf6b5,_0x50d213);_0x3b98a4(_0x50d213);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 7d85fb7..3e64f14 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 _0x0edc=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x526137,_0x43ff1c){var _0x92cec=function(_0x7b288e){while(--_0x7b288e){_0x526137['push'](_0x526137['shift']());}};_0x92cec(++_0x43ff1c);}(_0x0edc,0x9f));var _0xc0ed=function(_0x2d964d,_0x599ad8){_0x2d964d=_0x2d964d-0x0;var _0x59d1d2=_0x0edc[_0x2d964d];return _0x59d1d2;};'use strict';var multer=require(_0xc0ed('0x0'));var util=require(_0xc0ed('0x1'));var path=require(_0xc0ed('0x2'));var timeout=require('connect-timeout');var express=require(_0xc0ed('0x3'));var router=express[_0xc0ed('0x4')]();var auth=require(_0xc0ed('0x5'));var interaction=require(_0xc0ed('0x6'));var config=require(_0xc0ed('0x7'));module[_0xc0ed('0x8')]=router; \ No newline at end of file +var _0xb87c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x374962,_0x57852a){var _0x3b371d=function(_0x12d806){while(--_0x12d806){_0x374962['push'](_0x374962['shift']());}};_0x3b371d(++_0x57852a);}(_0xb87c,0x1a6));var _0xcb87=function(_0x5ca6cb,_0x3b15c7){_0x5ca6cb=_0x5ca6cb-0x0;var _0x4c4eaa=_0xb87c[_0x5ca6cb];return _0x4c4eaa;};'use strict';var multer=require('multer');var util=require(_0xcb87('0x0'));var path=require(_0xcb87('0x1'));var timeout=require(_0xcb87('0x2'));var express=require(_0xcb87('0x3'));var router=express[_0xcb87('0x4')]();var auth=require(_0xcb87('0x5'));var interaction=require(_0xcb87('0x6'));var config=require(_0xcb87('0x7'));module[_0xcb87('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 9920734..5f7b804 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(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_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 +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4e8638,_0x1c8a42){var _0x1ba7f9=function(_0x45d9d1){while(--_0x45d9d1){_0x4e8638['push'](_0x4e8638['shift']());}};_0x1ba7f9(++_0x1c8a42);}(_0xe706,0xa3));var _0x6e70=function(_0x657e67,_0x518f58){_0x657e67=_0x657e67-0x0;var _0x29e86d=_0xe706[_0x657e67];return _0x29e86d;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 151c5e6..48f6ed3 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 _0x75a4=['lodash','util','../../config/logger','moment','bluebird','../../config/environment','UserSmsQueue','user_has_sms_queues'];(function(_0x4765c5,_0x40917e){var _0x22576e=function(_0x194252){while(--_0x194252){_0x4765c5['push'](_0x4765c5['shift']());}};_0x22576e(++_0x40917e);}(_0x75a4,0x110));var _0x475a=function(_0x1d344b,_0x3a7f7c){_0x1d344b=_0x1d344b-0x0;var _0x421744=_0x75a4[_0x1d344b];return _0x421744;};'use strict';var _=require(_0x475a('0x0'));var util=require(_0x475a('0x1'));var logger=require(_0x475a('0x2'))('api');var moment=require(_0x475a('0x3'));var BPromise=require(_0x475a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x475a('0x5'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x23ef57,_0x2b26ae){return _0x23ef57['define'](_0x475a('0x6'),attributes,{'tableName':_0x475a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce72=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xce72,0x136));var _0x2ce7=function(_0x19a3f2,_0x4b7f63){_0x19a3f2=_0x19a3f2-0x0;var _0x1ed045=_0xce72[_0x19a3f2];return _0x1ed045;};'use strict';var _=require('lodash');var util=require(_0x2ce7('0x0'));var logger=require(_0x2ce7('0x1'))(_0x2ce7('0x2'));var moment=require('moment');var BPromise=require(_0x2ce7('0x3'));var rp=require(_0x2ce7('0x4'));var fs=require('fs');var path=require(_0x2ce7('0x5'));var rimraf=require(_0x2ce7('0x6'));var config=require(_0x2ce7('0x7'));var attributes=require(_0x2ce7('0x8'));module['exports']=function(_0x22bb36,_0x5293f4){return _0x22bb36[_0x2ce7('0x9')](_0x2ce7('0xa'),attributes,{'tableName':_0x2ce7('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 042ace1..e113063 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 _0xc455=['../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x24040c,_0x45d054){var _0x2e7880=function(_0x29f701){while(--_0x29f701){_0x24040c['push'](_0x24040c['shift']());}};_0x2e7880(++_0x45d054);}(_0xc455,0x19f));var _0x5c45=function(_0x5bfff5,_0x13a721){_0x5bfff5=_0x5bfff5-0x0;var _0x3a00c6=_0xc455[_0x5bfff5];return _0x3a00c6;};'use strict';var _=require(_0x5c45('0x0'));var util=require(_0x5c45('0x1'));var moment=require('moment');var BPromise=require(_0x5c45('0x2'));var rs=require(_0x5c45('0x3'));var fs=require('fs');var Redis=require(_0x5c45('0x4'));var db=require(_0x5c45('0x5'))['db'];var utils=require(_0x5c45('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5c45('0x7'));var client=jayson[_0x5c45('0x8')][_0x5c45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bc57a,_0x309fff,_0x16a261){return new BPromise(function(_0x41c442,_0x5a4f94){return client[_0x5c45('0xa')](_0x5bc57a,_0x16a261)[_0x5c45('0xb')](function(_0x8c9d76){logger['info'](_0x5c45('0xc'),_0x309fff,_0x5c45('0xd'));logger['debug'](_0x5c45('0xe'),_0x309fff,_0x5c45('0xd'),JSON[_0x5c45('0xf')](_0x8c9d76));if(_0x8c9d76[_0x5c45('0x10')]){if(_0x8c9d76[_0x5c45('0x10')]['code']===0x1f4){logger[_0x5c45('0x10')](_0x5c45('0xc'),_0x309fff,_0x8c9d76[_0x5c45('0x10')]['message']);return _0x5a4f94(_0x8c9d76[_0x5c45('0x10')][_0x5c45('0x11')]);}logger[_0x5c45('0x10')](_0x5c45('0xc'),_0x309fff,_0x8c9d76[_0x5c45('0x10')]['message']);return _0x41c442(_0x8c9d76[_0x5c45('0x10')][_0x5c45('0x11')]);}else{logger[_0x5c45('0x12')](_0x5c45('0xc'),_0x309fff,_0x5c45('0xd'));_0x41c442(_0x8c9d76['result'][_0x5c45('0x11')]);}})[_0x5c45('0x13')](function(_0x2c8945){logger[_0x5c45('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x309fff,_0x2c8945);_0x5a4f94(_0x2c8945);});});} \ No newline at end of file +var _0x0a98=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x44a274,_0x17b558){var _0x582fdc=function(_0x2f006a){while(--_0x2f006a){_0x44a274['push'](_0x44a274['shift']());}};_0x582fdc(++_0x17b558);}(_0x0a98,0x113));var _0x80a9=function(_0x2a41d0,_0x315c87){_0x2a41d0=_0x2a41d0-0x0;var _0xca5a69=_0x0a98[_0x2a41d0];return _0xca5a69;};'use strict';var _=require(_0x80a9('0x0'));var util=require(_0x80a9('0x1'));var moment=require('moment');var BPromise=require(_0x80a9('0x2'));var rs=require(_0x80a9('0x3'));var fs=require('fs');var Redis=require(_0x80a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x80a9('0x5'));var logger=require(_0x80a9('0x6'))(_0x80a9('0x7'));var config=require(_0x80a9('0x8'));var jayson=require(_0x80a9('0x9'));var client=jayson[_0x80a9('0xa')][_0x80a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6d3407,_0x28591b,_0x44386b){return new BPromise(function(_0x358af1,_0x319419){return client[_0x80a9('0xc')](_0x6d3407,_0x44386b)[_0x80a9('0xd')](function(_0x51060a){logger[_0x80a9('0xe')](_0x80a9('0xf'),_0x28591b,_0x80a9('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x28591b,_0x80a9('0x10'),JSON[_0x80a9('0x11')](_0x51060a));if(_0x51060a[_0x80a9('0x12')]){if(_0x51060a[_0x80a9('0x12')][_0x80a9('0x13')]===0x1f4){logger[_0x80a9('0x12')](_0x80a9('0xf'),_0x28591b,_0x51060a[_0x80a9('0x12')][_0x80a9('0x14')]);return _0x319419(_0x51060a[_0x80a9('0x12')]['message']);}logger[_0x80a9('0x12')](_0x80a9('0xf'),_0x28591b,_0x51060a[_0x80a9('0x12')][_0x80a9('0x14')]);return _0x358af1(_0x51060a[_0x80a9('0x12')][_0x80a9('0x14')]);}else{logger[_0x80a9('0xe')](_0x80a9('0xf'),_0x28591b,_0x80a9('0x10'));_0x358af1(_0x51060a[_0x80a9('0x15')]['message']);}})[_0x80a9('0x16')](function(_0x32a8e7){logger[_0x80a9('0x12')](_0x80a9('0xf'),_0x28591b,_0x32a8e7);_0x319419(_0x32a8e7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 8d58991..a072654 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 _0x8446=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x8446,0xfe));var _0x6844=function(_0x1715a2,_0x13d1d3){_0x1715a2=_0x1715a2-0x0;var _0x447fc1=_0x8446[_0x1715a2];return _0x447fc1;};'use strict';var multer=require(_0x6844('0x0'));var util=require(_0x6844('0x1'));var path=require(_0x6844('0x2'));var timeout=require(_0x6844('0x3'));var express=require(_0x6844('0x4'));var router=express['Router']();var auth=require(_0x6844('0x5'));var interaction=require(_0x6844('0x6'));var config=require(_0x6844('0x7'));module[_0x6844('0x8')]=router; \ No newline at end of file +var _0x8129=['Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout','express'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x8129,0xf9));var _0x9812=function(_0x42dfd3,_0x2c68e2){_0x42dfd3=_0x42dfd3-0x0;var _0x2cd73f=_0x8129[_0x42dfd3];return _0x2cd73f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9812('0x0'));var timeout=require(_0x9812('0x1'));var express=require(_0x9812('0x2'));var router=express[_0x9812('0x3')]();var auth=require(_0x9812('0x4'));var interaction=require(_0x9812('0x5'));var config=require('../../config/environment');module[_0x9812('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 d6c321f..8ce2066 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 _0xb10b=['sequelize','INTEGER'];(function(_0x32f2ed,_0x467862){var _0x38f276=function(_0x5b85ce){while(--_0x5b85ce){_0x32f2ed['push'](_0x32f2ed['shift']());}};_0x38f276(++_0x467862);}(_0xb10b,0x12a));var _0xbb10=function(_0x210ccc,_0x18a85a){_0x210ccc=_0x210ccc-0x0;var _0x334164=_0xb10b[_0x210ccc];return _0x334164;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xf25c17,_0x288f2c){var _0x429736=function(_0x1fe8b0){while(--_0x1fe8b0){_0xf25c17['push'](_0xf25c17['shift']());}};_0x429736(++_0x288f2c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index dbddc4a..e92b4b6 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 _0x4b84=['moment','path','rimraf','../../config/environment','UserVoiceQueue','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0x4b84[_0x22663b];return _0x310d0a;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d9e=['lodash','api','bluebird','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x5162d2,_0x4f135c){_0x5162d2=_0x5162d2-0x0;var _0x3729d7=_0x4d9e[_0x5162d2];return _0x3729d7;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'user_has_voice_queues','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 6019ceb..5a63ddf 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 _0x8f95=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x1524a7,_0xffe64d){var _0x6a4acf=function(_0x28fb95){while(--_0x28fb95){_0x1524a7['push'](_0x1524a7['shift']());}};_0x6a4acf(++_0xffe64d);}(_0x8f95,0x108));var _0x58f9=function(_0x3f2ef3,_0x3f16f1){_0x3f2ef3=_0x3f2ef3-0x0;var _0x3fd1a3=_0x8f95[_0x3f2ef3];return _0x3fd1a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x58f9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f9('0x1'))['db'];var utils=require(_0x58f9('0x2'));var logger=require(_0x58f9('0x3'))(_0x58f9('0x4'));var config=require(_0x58f9('0x5'));var jayson=require(_0x58f9('0x6'));var client=jayson[_0x58f9('0x7')][_0x58f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12245f,_0x5071f7,_0x3e5374){return new BPromise(function(_0x23261f,_0x468523){return client[_0x58f9('0x9')](_0x12245f,_0x3e5374)[_0x58f9('0xa')](function(_0x581e45){logger[_0x58f9('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x5071f7,_0x58f9('0xc'));logger[_0x58f9('0xd')](_0x58f9('0xe'),_0x5071f7,_0x58f9('0xc'),JSON[_0x58f9('0xf')](_0x581e45));if(_0x581e45[_0x58f9('0x10')]){if(_0x581e45[_0x58f9('0x10')][_0x58f9('0x11')]===0x1f4){logger[_0x58f9('0x10')](_0x58f9('0x12'),_0x5071f7,_0x581e45['error'][_0x58f9('0x13')]);return _0x468523(_0x581e45[_0x58f9('0x10')][_0x58f9('0x13')]);}logger['error'](_0x58f9('0x12'),_0x5071f7,_0x581e45[_0x58f9('0x10')][_0x58f9('0x13')]);return _0x23261f(_0x581e45[_0x58f9('0x10')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x5071f7,_0x58f9('0xc'));_0x23261f(_0x581e45[_0x58f9('0x14')][_0x58f9('0x13')]);}})[_0x58f9('0x15')](function(_0x599c9b){logger[_0x58f9('0x10')](_0x58f9('0x12'),_0x5071f7,_0x599c9b);_0x468523(_0x599c9b);});});} \ No newline at end of file +var _0x0aaa=['ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x0aaa,0x1eb));var _0xa0aa=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x0aaa[_0x30e004];return _0x5ca247;};'use strict';var _=require('lodash');var util=require(_0xa0aa('0x0'));var moment=require(_0xa0aa('0x1'));var BPromise=require('bluebird');var rs=require(_0xa0aa('0x2'));var fs=require('fs');var Redis=require(_0xa0aa('0x3'));var db=require(_0xa0aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa0aa('0x5'));var jayson=require(_0xa0aa('0x6'));var client=jayson[_0xa0aa('0x7')][_0xa0aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x372425,_0x156c3c,_0x145c7b){return new BPromise(function(_0x5e7fe9,_0x4f805f){return client[_0xa0aa('0x9')](_0x372425,_0x145c7b)['then'](function(_0x2eaf88){logger[_0xa0aa('0xa')](_0xa0aa('0xb'),_0x156c3c,_0xa0aa('0xc'));logger[_0xa0aa('0xd')](_0xa0aa('0xe'),_0x156c3c,_0xa0aa('0xc'),JSON['stringify'](_0x2eaf88));if(_0x2eaf88['error']){if(_0x2eaf88[_0xa0aa('0xf')]['code']===0x1f4){logger['error'](_0xa0aa('0xb'),_0x156c3c,_0x2eaf88[_0xa0aa('0xf')][_0xa0aa('0x10')]);return _0x4f805f(_0x2eaf88[_0xa0aa('0xf')]['message']);}logger[_0xa0aa('0xf')](_0xa0aa('0xb'),_0x156c3c,_0x2eaf88[_0xa0aa('0xf')]['message']);return _0x5e7fe9(_0x2eaf88['error']['message']);}else{logger[_0xa0aa('0xa')](_0xa0aa('0xb'),_0x156c3c,_0xa0aa('0xc'));_0x5e7fe9(_0x2eaf88[_0xa0aa('0x11')]['message']);}})[_0xa0aa('0x12')](function(_0x1cca0b){logger[_0xa0aa('0xf')](_0xa0aa('0xb'),_0x156c3c,_0x1cca0b);_0x4f805f(_0x1cca0b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index abdea36..38e19e7 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 _0xc855=['connect-timeout','../../components/auth/service','../../components/interaction/service','exports','multer','util'];(function(_0x61dcaa,_0x59ee33){var _0x1e3674=function(_0x2b0c01){while(--_0x2b0c01){_0x61dcaa['push'](_0x61dcaa['shift']());}};_0x1e3674(++_0x59ee33);}(_0xc855,0xdc));var _0x5c85=function(_0x3a2354,_0x5c0602){_0x3a2354=_0x3a2354-0x0;var _0x43ba2e=_0xc855[_0x3a2354];return _0x43ba2e;};'use strict';var multer=require(_0x5c85('0x0'));var util=require(_0x5c85('0x1'));var path=require('path');var timeout=require(_0x5c85('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5c85('0x3'));var interaction=require(_0x5c85('0x4'));var config=require('../../config/environment');module[_0x5c85('0x5')]=router; \ No newline at end of file +var _0x5ce5=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x27018e,_0x166073){var _0x1b617c=function(_0x438422){while(--_0x438422){_0x27018e['push'](_0x27018e['shift']());}};_0x1b617c(++_0x166073);}(_0x5ce5,0xef));var _0x55ce=function(_0x5d705e,_0x112925){_0x5d705e=_0x5d705e-0x0;var _0x5054b2=_0x5ce5[_0x5d705e];return _0x5054b2;};'use strict';var multer=require(_0x55ce('0x0'));var util=require(_0x55ce('0x1'));var path=require(_0x55ce('0x2'));var timeout=require(_0x55ce('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x55ce('0x4'));var interaction=require(_0x55ce('0x5'));var config=require(_0x55ce('0x6'));module[_0x55ce('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 c95db32..a0bd804 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 _0xa200=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4d0ab9,_0x33fc36){var _0x2ac90d=function(_0x2b114c){while(--_0x2b114c){_0x4d0ab9['push'](_0x4d0ab9['shift']());}};_0x2ac90d(++_0x33fc36);}(_0xa200,0x1a9));var _0x0a20=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa200[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0a20('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0a20('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0a20('0x2')},'membername':{'type':Sequelize[_0x0a20('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x0a20('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a20('0x4'),'comment':_0x0a20('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0a20('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0a20('0x3')],'allowNull':![],'unique':_0x0a20('0x4'),'comment':_0x0a20('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x4494=['queue_interface','INTEGER','Required\x20by\x20Asterisk','sequelize','exports','STRING'];(function(_0x81dae,_0x4437c9){var _0x2cab87=function(_0x1f1088){while(--_0x1f1088){_0x81dae['push'](_0x81dae['shift']());}};_0x2cab87(++_0x4437c9);}(_0x4494,0xdb));var _0x4449=function(_0x186b36,_0x1bef5e){_0x186b36=_0x186b36-0x0;var _0x3a4cb7=_0x4494[_0x186b36];return _0x3a4cb7;};'use strict';var Sequelize=require(_0x4449('0x0'));module[_0x4449('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4449('0x2')],'allowNull':![],'unique':_0x4449('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x4449('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x4449('0x2')],'allowNull':![],'unique':_0x4449('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4449('0x4')](0xb),'defaultValue':0x0,'comment':_0x4449('0x5')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 67f16a3..aa06daa 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 _0x734a=['../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x231295,_0x5f0700){var _0x15c39b=function(_0x542343){while(--_0x542343){_0x231295['push'](_0x231295['shift']());}};_0x15c39b(++_0x5f0700);}(_0x734a,0x16f));var _0xa734=function(_0x4cb8e7,_0x2e1d22){_0x4cb8e7=_0x4cb8e7-0x0;var _0x3d0188=_0x734a[_0x4cb8e7];return _0x3d0188;};'use strict';var EventEmitter=require(_0xa734('0x0'));var UserVoiceQueueRt=require(_0xa734('0x1'))['db'][_0xa734('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa734('0x3'),'afterDestroy':_0xa734('0x4')};function emitEvent(_0x39011f){return function(_0x1a75d9,_0x43b3f6,_0x1ab08e){UserVoiceQueueRtEvents[_0xa734('0x5')](_0x39011f+':'+_0x1a75d9['id'],_0x1a75d9);UserVoiceQueueRtEvents[_0xa734('0x5')](_0x39011f,_0x1a75d9);_0x1ab08e(null);};}for(var e in events){if(events[_0xa734('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa734('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xcfbd=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xcfbd,0x16d));var _0xdcfb=function(_0x2840b6,_0x3abb8b){_0x2840b6=_0x2840b6-0x0;var _0x38169f=_0xcfbd[_0x2840b6];return _0x38169f;};'use strict';var EventEmitter=require(_0xdcfb('0x0'));var UserVoiceQueueRt=require(_0xdcfb('0x1'))['db'][_0xdcfb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdcfb('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b2da3){return function(_0x39cdab,_0x438f7f,_0x209728){UserVoiceQueueRtEvents[_0xdcfb('0x4')](_0x5b2da3+':'+_0x39cdab['id'],_0x39cdab);UserVoiceQueueRtEvents[_0xdcfb('0x4')](_0x5b2da3,_0x39cdab);_0x209728(null);};}for(var e in events){if(events[_0xdcfb('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xdcfb('0x6')](e,emitEvent(event));}}module[_0xdcfb('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 24bfe12..53223a8 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 _0xb0d9=['bluebird','../../config/environment','./userVoiceQueueRt.attributes','exports','define','../../config/logger','api','moment'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0xb0d9,0x115));var _0x9b0d=function(_0x199c00,_0x76ae17){_0x199c00=_0x199c00-0x0;var _0x4732f1=_0xb0d9[_0x199c00];return _0x4732f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9b0d('0x0'))(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9b0d('0x4'));var attributes=require(_0x9b0d('0x5'));module[_0x9b0d('0x6')]=function(_0x518073,_0x2b96ba){return _0x518073[_0x9b0d('0x7')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee6=['UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./userVoiceQueueRt.attributes','define'];(function(_0x3905b8,_0x116e04){var _0x47f50b=function(_0x4b7be9){while(--_0x4b7be9){_0x3905b8['push'](_0x3905b8['shift']());}};_0x47f50b(++_0x116e04);}(_0x3ee6,0xb5));var _0x63ee=function(_0x5bde78,_0xef666d){_0x5bde78=_0x5bde78-0x0;var _0x587f12=_0x3ee6[_0x5bde78];return _0x587f12;};'use strict';var _=require(_0x63ee('0x0'));var util=require(_0x63ee('0x1'));var logger=require(_0x63ee('0x2'))(_0x63ee('0x3'));var moment=require(_0x63ee('0x4'));var BPromise=require('bluebird');var rp=require(_0x63ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x63ee('0x6'));var attributes=require(_0x63ee('0x7'));module['exports']=function(_0x3e6c4b,_0x4f9f07){return _0x3e6c4b[_0x63ee('0x8')](_0x63ee('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','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 52cf262..b0a6a5a 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 _0xb6d8=['defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','COUNT','literal','outboundQueuePauses','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x1f7e3a,_0x57975f){var _0x27e6f6=function(_0x4523bc){while(--_0x4523bc){_0x1f7e3a['push'](_0x1f7e3a['shift']());}};_0x27e6f6(++_0x57975f);}(_0xb6d8,0x198));var _0x8b6d=function(_0x43675c,_0x408d85){_0x43675c=_0x43675c-0x0;var _0x362215=_0xb6d8[_0x43675c];return _0x362215;};'use strict';var _=require(_0x8b6d('0x0'));var util=require('util');var moment=require(_0x8b6d('0x1'));var BPromise=require(_0x8b6d('0x2'));var rs=require(_0x8b6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b6d('0x4'))['db'];var utils=require(_0x8b6d('0x5'));var logger=require(_0x8b6d('0x6'))(_0x8b6d('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b6d('0x8'));var client=jayson[_0x8b6d('0x9')][_0x8b6d('0xa')]({'port':0x232a});config[_0x8b6d('0xb')]=_[_0x8b6d('0xc')](config[_0x8b6d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b6d('0xd'))(new Redis(config[_0x8b6d('0xb')]));require(_0x8b6d('0xe'))['register'](socket);function respondWithRpcPromise(_0x5363f6,_0x4a1657,_0x3bfd69){return new BPromise(function(_0x42e104,_0x3dfdc8){return client[_0x8b6d('0xf')](_0x5363f6,_0x3bfd69)[_0x8b6d('0x10')](function(_0x36272b){logger[_0x8b6d('0x11')](_0x8b6d('0x12'),_0x4a1657,_0x8b6d('0x13'));logger['debug'](_0x8b6d('0x14'),_0x4a1657,'request\x20sent',JSON[_0x8b6d('0x15')](_0x36272b));if(_0x36272b[_0x8b6d('0x16')]){if(_0x36272b['error'][_0x8b6d('0x17')]===0x1f4){logger[_0x8b6d('0x16')](_0x8b6d('0x12'),_0x4a1657,_0x36272b[_0x8b6d('0x16')][_0x8b6d('0x18')]);return _0x3dfdc8(_0x36272b[_0x8b6d('0x16')]['message']);}logger[_0x8b6d('0x16')](_0x8b6d('0x12'),_0x4a1657,_0x36272b[_0x8b6d('0x16')][_0x8b6d('0x18')]);return _0x42e104(_0x36272b[_0x8b6d('0x16')][_0x8b6d('0x18')]);}else{logger['info'](_0x8b6d('0x12'),_0x4a1657,_0x8b6d('0x13'));_0x42e104(_0x36272b[_0x8b6d('0x19')][_0x8b6d('0x18')]);}})[_0x8b6d('0x1a')](function(_0x191357){logger[_0x8b6d('0x16')](_0x8b6d('0x12'),_0x4a1657,_0x191357);_0x3dfdc8(_0x191357);});});}exports[_0x8b6d('0x1b')]=function(_0x1a8107){var _0x15dcbc=this;return new Promise(function(_0x508255,_0x36835b){return db['UserVoiceQueueRt'][_0x8b6d('0x1c')]({'raw':_0x1a8107[_0x8b6d('0x1d')]?_0x1a8107[_0x8b6d('0x1d')][_0x8b6d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a8107[_0x8b6d('0x1d')]?_0x1a8107['options'][_0x8b6d('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8b6d('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8b6d('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0x8b6d('0x22')]]})[_0x8b6d('0x10')](function(_0x444d59){logger[_0x8b6d('0x11')]('GetVoiceQueueRtPauses',_0x1a8107);logger['debug'](_0x8b6d('0x1b'),_0x1a8107,JSON[_0x8b6d('0x15')](_0x444d59));_0x508255(_0x444d59);})['catch'](function(_0x186662){logger['error'](_0x8b6d('0x1b'),_0x186662[_0x8b6d('0x18')],_0x1a8107);_0x36835b(_0x15dcbc[_0x8b6d('0x16')](0x1f4,_0x186662[_0x8b6d('0x18')]));});});}; \ No newline at end of file +var _0xdc7d=['stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null'];(function(_0x353873,_0x22df10){var _0xc247d5=function(_0x2e852b){while(--_0x2e852b){_0x353873['push'](_0x353873['shift']());}};_0xc247d5(++_0x22df10);}(_0xdc7d,0x1bb));var _0xddc7=function(_0x26ebbb,_0x2e7a97){_0x26ebbb=_0x26ebbb-0x0;var _0x476476=_0xdc7d[_0x26ebbb];return _0x476476;};'use strict';var _=require(_0xddc7('0x0'));var util=require(_0xddc7('0x1'));var moment=require(_0xddc7('0x2'));var BPromise=require(_0xddc7('0x3'));var rs=require(_0xddc7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xddc7('0x5'));var logger=require(_0xddc7('0x6'))(_0xddc7('0x7'));var config=require(_0xddc7('0x8'));var jayson=require(_0xddc7('0x9'));var client=jayson['client'][_0xddc7('0xa')]({'port':0x232a});config[_0xddc7('0xb')]=_['defaults'](config['redis'],{'host':_0xddc7('0xc'),'port':0x18eb});var socket=require(_0xddc7('0xd'))(new Redis(config[_0xddc7('0xb')]));require(_0xddc7('0xe'))['register'](socket);function respondWithRpcPromise(_0x1a52f6,_0x553f69,_0x65151a){return new BPromise(function(_0x45fda4,_0x490d4d){return client[_0xddc7('0xf')](_0x1a52f6,_0x65151a)[_0xddc7('0x10')](function(_0x1d2be4){logger[_0xddc7('0x11')](_0xddc7('0x12'),_0x553f69,_0xddc7('0x13'));logger[_0xddc7('0x14')](_0xddc7('0x15'),_0x553f69,_0xddc7('0x13'),JSON['stringify'](_0x1d2be4));if(_0x1d2be4[_0xddc7('0x16')]){if(_0x1d2be4['error']['code']===0x1f4){logger['error'](_0xddc7('0x12'),_0x553f69,_0x1d2be4[_0xddc7('0x16')][_0xddc7('0x17')]);return _0x490d4d(_0x1d2be4['error']['message']);}logger['error'](_0xddc7('0x12'),_0x553f69,_0x1d2be4[_0xddc7('0x16')][_0xddc7('0x17')]);return _0x45fda4(_0x1d2be4[_0xddc7('0x16')]['message']);}else{logger[_0xddc7('0x11')](_0xddc7('0x12'),_0x553f69,_0xddc7('0x13'));_0x45fda4(_0x1d2be4[_0xddc7('0x18')]['message']);}})['catch'](function(_0x3e1794){logger[_0xddc7('0x16')](_0xddc7('0x12'),_0x553f69,_0x3e1794);_0x490d4d(_0x3e1794);});});}exports[_0xddc7('0x19')]=function(_0xe6a453){var _0x536cfc=this;return new Promise(function(_0x5c1dce,_0x574d88){return db[_0xddc7('0x1a')]['findAll']({'raw':_0xe6a453[_0xddc7('0x1b')]?_0xe6a453[_0xddc7('0x1b')][_0xddc7('0x1c')]===undefined?!![]:![]:!![],'where':_0xe6a453[_0xddc7('0x1b')]?_0xe6a453[_0xddc7('0x1b')][_0xddc7('0x1d')]||null:null,'attributes':[[db[_0xddc7('0x1e')]['fn'](_0xddc7('0x1f'),db[_0xddc7('0x1e')]['fn']('IF',db[_0xddc7('0x1e')]['literal'](_0xddc7('0x20')))),'outboundQueuePauses']]})[_0xddc7('0x10')](function(_0x711894){logger['info'](_0xddc7('0x19'),_0xe6a453);logger['debug']('GetVoiceQueueRtPauses',_0xe6a453,JSON[_0xddc7('0x21')](_0x711894));_0x5c1dce(_0x711894);})['catch'](function(_0x5069b6){logger[_0xddc7('0x16')](_0xddc7('0x19'),_0x5069b6[_0xddc7('0x17')],_0xe6a453);_0x574d88(_0x536cfc['error'](0x1f4,_0x5069b6[_0xddc7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 0838308..52eca58 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 _0x0df8=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0x0df8,0x98));var _0x80df=function(_0x233f1e,_0x4c42f6){_0x233f1e=_0x233f1e-0x0;var _0x27dc8a=_0x0df8[_0x233f1e];return _0x27dc8a;};'use strict';var UserVoiceQueueRtEvents=require(_0x80df('0x0'));var events=[_0x80df('0x1'),'remove','update'];function createListener(_0x3be113,_0x6d03ce){return function(_0x88e992){_0x6d03ce[_0x80df('0x2')](_0x3be113,_0x88e992);};}function removeListener(_0x3fec57,_0x11b556){return function(){UserVoiceQueueRtEvents[_0x80df('0x3')](_0x3fec57,_0x11b556);};}exports[_0x80df('0x4')]=function(_0x34668a){for(var _0x181c0a=0x0,_0x781c60=events[_0x80df('0x5')];_0x181c0a<_0x781c60;_0x181c0a++){var _0x1e2605=events[_0x181c0a];var _0x247128=createListener(_0x80df('0x6')+_0x1e2605,_0x34668a);UserVoiceQueueRtEvents['on'](_0x1e2605,_0x247128);}}; \ No newline at end of file +var _0xc00b=['length','userVoiceQueueRt:','save','register'];(function(_0x1d4223,_0x188f82){var _0x26a8fa=function(_0x96430b){while(--_0x96430b){_0x1d4223['push'](_0x1d4223['shift']());}};_0x26a8fa(++_0x188f82);}(_0xc00b,0x8e));var _0xbc00=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0xc00b[_0xe480f0];return _0x57b198;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xbc00('0x0'),'remove','update'];function createListener(_0x34d765,_0x20a64b){return function(_0x248d33){_0x20a64b['emit'](_0x34d765,_0x248d33);};}function removeListener(_0x4612c7,_0x57df04){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4612c7,_0x57df04);};}exports[_0xbc00('0x1')]=function(_0xe8d627){for(var _0x45a46f=0x0,_0x34474c=events[_0xbc00('0x2')];_0x45a46f<_0x34474c;_0x45a46f++){var _0x4b6162=events[_0x45a46f];var _0x5b083a=createListener(_0xbc00('0x3')+_0x4b6162,_0xe8d627);UserVoiceQueueRtEvents['on'](_0x4b6162,_0x5b083a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 636f5f8..c079f4c 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 _0x6d2b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x250ce7,_0x502ad3){var _0x416428=function(_0x46564d){while(--_0x46564d){_0x250ce7['push'](_0x250ce7['shift']());}};_0x416428(++_0x502ad3);}(_0x6d2b,0x16e));var _0xb6d2=function(_0x4d2a53,_0x5a4760){_0x4d2a53=_0x4d2a53-0x0;var _0x421f9d=_0x6d2b[_0x4d2a53];return _0x421f9d;};'use strict';var multer=require(_0xb6d2('0x0'));var util=require(_0xb6d2('0x1'));var path=require(_0xb6d2('0x2'));var timeout=require(_0xb6d2('0x3'));var express=require(_0xb6d2('0x4'));var router=express[_0xb6d2('0x5')]();var auth=require(_0xb6d2('0x6'));var interaction=require(_0xb6d2('0x7'));var config=require(_0xb6d2('0x8'));module[_0xb6d2('0x9')]=router; \ No newline at end of file +var _0xb3e7=['multer','util','path','connect-timeout','express','exports'];(function(_0x4614b8,_0x2e9828){var _0x4a25ea=function(_0x3787a1){while(--_0x3787a1){_0x4614b8['push'](_0x4614b8['shift']());}};_0x4a25ea(++_0x2e9828);}(_0xb3e7,0xb4));var _0x7b3e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xb3e7[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x7b3e('0x0'));var util=require(_0x7b3e('0x1'));var path=require(_0x7b3e('0x2'));var timeout=require(_0x7b3e('0x3'));var express=require(_0x7b3e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x7b3e('0x5')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 08d352a..40e2cbf 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x58ac8b,_0x51c5fd){var _0x8f584=function(_0x2231b5){while(--_0x2231b5){_0x58ac8b['push'](_0x58ac8b['shift']());}};_0x8f584(++_0x51c5fd);}(_0xe706,0xa3));var _0x6e70=function(_0x10c4f9,_0x100fb4){_0x10c4f9=_0x10c4f9-0x0;var _0x522b09=_0xe706[_0x10c4f9];return _0x522b09;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4a9a17,_0x273a09){var _0x30e831=function(_0xabbcbd){while(--_0xabbcbd){_0x4a9a17['push'](_0x4a9a17['shift']());}};_0x30e831(++_0x273a09);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 2eb0851..0150fdf 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 _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','lodash','util','api','moment'];(function(_0x88902,_0x494283){var _0x3b16b6=function(_0x27423a){while(--_0x27423a){_0x88902['push'](_0x88902['shift']());}};_0x3b16b6(++_0x494283);}(_0x5423,0xe3));var _0x3542=function(_0x20d34c,_0x30372){_0x20d34c=_0x20d34c-0x0;var _0x660145=_0x5423[_0x20d34c];return _0x660145;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9be=['path','rimraf','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59a632,_0x1fc0f9){var _0x124ca4=function(_0x2ac059){while(--_0x2ac059){_0x59a632['push'](_0x59a632['shift']());}};_0x124ca4(++_0x1fc0f9);}(_0xb9be,0xc5));var _0xeb9b=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xb9be[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'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 b6719f4..7dbb7d2 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(_0x5788c8,_0x36efd7){var _0x5111bd=function(_0x46a667){while(--_0x46a667){_0x5788c8['push'](_0x5788c8['shift']());}};_0x5111bd(++_0x36efd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x2f4c89,_0x5e4c1c){var _0x5c0c1e=function(_0x1da03b){while(--_0x1da03b){_0x2f4c89['push'](_0x2f4c89['shift']());}};_0x5c0c1e(++_0x5e4c1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 367146e..a90db44 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 _0x97fb=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','show','post','create'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0x97fb,0x137));var _0xb97f=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0x97fb[_0x3f993e];return _0x39c135;};'use strict';var multer=require(_0xb97f('0x0'));var util=require(_0xb97f('0x1'));var path=require('path');var timeout=require(_0xb97f('0x2'));var express=require(_0xb97f('0x3'));var router=express[_0xb97f('0x4')]();var auth=require(_0xb97f('0x5'));var interaction=require(_0xb97f('0x6'));var config=require('../../config/environment');var controller=require(_0xb97f('0x7'));router['get']('/',auth[_0xb97f('0x8')](),controller['index']);router['get']('/:id',auth[_0xb97f('0x8')](),controller[_0xb97f('0x9')]);router[_0xb97f('0xa')]('/',auth[_0xb97f('0x8')](),controller[_0xb97f('0xb')]);router[_0xb97f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb97f('0xd')]);router[_0xb97f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb97f('0xf')]);module[_0xb97f('0x10')]=router; \ No newline at end of file +var _0x2c91=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x4f65d2,_0x51ce91){var _0x44c0db=function(_0x171143){while(--_0x171143){_0x4f65d2['push'](_0x4f65d2['shift']());}};_0x44c0db(++_0x51ce91);}(_0x2c91,0x18f));var _0x12c9=function(_0x130e50,_0x7783b0){_0x130e50=_0x130e50-0x0;var _0x1dfe89=_0x2c91[_0x130e50];return _0x1dfe89;};'use strict';var multer=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var path=require(_0x12c9('0x2'));var timeout=require(_0x12c9('0x3'));var express=require(_0x12c9('0x4'));var router=express[_0x12c9('0x5')]();var auth=require(_0x12c9('0x6'));var interaction=require(_0x12c9('0x7'));var config=require(_0x12c9('0x8'));var controller=require(_0x12c9('0x9'));router[_0x12c9('0xa')]('/',auth[_0x12c9('0xb')](),controller[_0x12c9('0xc')]);router[_0x12c9('0xa')](_0x12c9('0xd'),auth[_0x12c9('0xb')](),controller[_0x12c9('0xe')]);router[_0x12c9('0xf')]('/',auth[_0x12c9('0xb')](),controller['create']);router[_0x12c9('0x10')](_0x12c9('0xd'),auth['isAuthenticated'](),controller[_0x12c9('0x11')]);router['delete'](_0x12c9('0xd'),auth[_0x12c9('0xb')](),controller[_0x12c9('0x12')]);module[_0x12c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d0fd700..7afa375 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 _0xb1b9=['name','exports','STRING'];(function(_0x1ce23d,_0x25a351){var _0x4338d9=function(_0xf8d3a9){while(--_0xf8d3a9){_0x1ce23d['push'](_0x1ce23d['shift']());}};_0x4338d9(++_0x25a351);}(_0xb1b9,0x12d));var _0x9b1b=function(_0x5b5670,_0x59b8e1){_0x5b5670=_0x5b5670-0x0;var _0x1f569d=_0xb1b9[_0x5b5670];return _0x1f569d;};'use strict';var Sequelize=require('sequelize');module[_0x9b1b('0x0')]={'name':{'type':Sequelize[_0x9b1b('0x1')],'unique':_0x9b1b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9b1b('0x1')]}}; \ No newline at end of file +var _0x1887=['sequelize','exports','STRING','name'];(function(_0x32092d,_0x28f672){var _0x1ad8c3=function(_0x39837a){while(--_0x39837a){_0x32092d['push'](_0x32092d['shift']());}};_0x1ad8c3(++_0x28f672);}(_0x1887,0xa8));var _0x7188=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1887[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7188('0x0'));module[_0x7188('0x1')]={'name':{'type':Sequelize[_0x7188('0x2')],'unique':_0x7188('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 1f1422f..489ba52 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 _0x9d80=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','get','Variables','error','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filter','merge','options','Variable','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x9d80,0xf2));var _0x09d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d80[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x09d8('0x0'));var emlformat=require(_0x09d8('0x1'));var rimraf=require(_0x09d8('0x2'));var zipdir=require(_0x09d8('0x3'));var jsonpatch=require(_0x09d8('0x4'));var rp=require(_0x09d8('0x5'));var moment=require(_0x09d8('0x6'));var BPromise=require(_0x09d8('0x7'));var Mustache=require(_0x09d8('0x8'));var util=require(_0x09d8('0x9'));var path=require(_0x09d8('0xa'));var sox=require(_0x09d8('0xb'));var csv=require('to-csv');var ejs=require(_0x09d8('0xc'));var fs=require('fs');var _=require(_0x09d8('0xd'));var squel=require(_0x09d8('0xe'));var crypto=require(_0x09d8('0xf'));var jsforce=require(_0x09d8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x09d8('0x11'));var querystring=require(_0x09d8('0x12'));var Papa=require(_0x09d8('0x13'));var Redis=require(_0x09d8('0x14'));var authService=require(_0x09d8('0x15'));var qs=require(_0x09d8('0x16'));var as=require(_0x09d8('0x17'));var hardwareService=require(_0x09d8('0x18'));var logger=require(_0x09d8('0x19'))(_0x09d8('0x1a'));var utils=require(_0x09d8('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x09d8('0x1c'));var db=require(_0x09d8('0x1d'))['db'];function respondWithStatusCode(_0x29647f,_0x20a75b){_0x20a75b=_0x20a75b||0xcc;return function(_0x30cfa8){if(_0x30cfa8){return _0x29647f[_0x09d8('0x1e')](_0x20a75b);}return _0x29647f[_0x09d8('0x1f')](_0x20a75b)[_0x09d8('0x20')]();};}function respondWithResult(_0x55bdb0,_0x52d7e1){_0x52d7e1=_0x52d7e1||0xc8;return function(_0x34bbcb){if(_0x34bbcb){return _0x55bdb0[_0x09d8('0x1f')](_0x52d7e1)[_0x09d8('0x21')](_0x34bbcb);}};}function respondWithFilteredResult(_0x34c39e,_0x2a3830){return function(_0x57625d){if(_0x57625d){var _0x569650=_0x57625d[_0x09d8('0x22')],_0x58fee1=_0x2a3830[_0x09d8('0x23')],_0x1b3aec=_0x2a3830[_0x09d8('0x23')]+_0x2a3830['limit'],_0x5e2356;if(_0x1b3aec>=_0x569650){_0x1b3aec=_0x569650;_0x5e2356=0xc8;}else{_0x5e2356=0xce;}_0x34c39e[_0x09d8('0x1f')](_0x5e2356);return _0x34c39e[_0x09d8('0x24')](_0x09d8('0x25'),_0x58fee1+'-'+_0x1b3aec+'/'+_0x569650)[_0x09d8('0x21')](_0x57625d);}return null;};}function patchUpdates(_0x31e6fd){return function(_0x2226dd){try{jsonpatch[_0x09d8('0x26')](_0x2226dd,_0x31e6fd,!![]);}catch(_0x470f5f){return BPromise['reject'](_0x470f5f);}return _0x2226dd[_0x09d8('0x27')]();};}function saveUpdates(_0x18a2f0,_0x1591aa){return function(_0xc1af5b){if(_0xc1af5b){return _0xc1af5b['update'](_0x18a2f0)[_0x09d8('0x28')](function(_0xaadec6){return _0xaadec6;});}return null;};}function removeEntity(_0x585568,_0x5a9462){return function(_0xe24091){if(_0xe24091){return _0xe24091['destroy']()[_0x09d8('0x28')](function(){var _0x5960ec=_0xe24091[_0x09d8('0x29')]({'plain':!![]});var _0x3d9f30=_0x09d8('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d9f30,'resourceId':_0x5960ec['id']}})[_0x09d8('0x28')](function(){return _0xe24091;});})[_0x09d8('0x28')](function(){_0x585568[_0x09d8('0x1f')](0xcc)[_0x09d8('0x20')]();});}};}function handleEntityNotFound(_0x1be897,_0x5d49b9){return function(_0x47b942){if(!_0x47b942){_0x1be897['sendStatus'](0x194);}return _0x47b942;};}function handleError(_0x55661e,_0x32ba51){_0x32ba51=_0x32ba51||0x1f4;return function(_0x201fa0){logger[_0x09d8('0x2b')](_0x201fa0['stack']);if(_0x201fa0['name']){delete _0x201fa0[_0x09d8('0x2c')];}_0x55661e['status'](_0x32ba51)['send'](_0x201fa0);};}exports[_0x09d8('0x2d')]=function(_0x2378dd,_0x54f685){var _0xd37353={},_0x3394c2={},_0x10b0b1={'count':0x0,'rows':[]};var _0x39aac8=_[_0x09d8('0x2e')](db['Variable']['rawAttributes'],function(_0x149a97){return{'name':_0x149a97[_0x09d8('0x2f')],'type':_0x149a97[_0x09d8('0x30')][_0x09d8('0x31')]};});_0x3394c2[_0x09d8('0x32')]=_[_0x09d8('0x2e')](_0x39aac8,_0x09d8('0x2c'));_0x3394c2[_0x09d8('0x33')]=_[_0x09d8('0x34')](_0x2378dd[_0x09d8('0x33')]);_0x3394c2[_0x09d8('0x35')]=_['intersection'](_0x3394c2[_0x09d8('0x32')],_0x3394c2[_0x09d8('0x33')]);_0xd37353[_0x09d8('0x36')]=_[_0x09d8('0x37')](_0x3394c2[_0x09d8('0x32')],qs[_0x09d8('0x38')](_0x2378dd[_0x09d8('0x33')]['fields']));_0xd37353[_0x09d8('0x36')]=_0xd37353[_0x09d8('0x36')]['length']?_0xd37353[_0x09d8('0x36')]:_0x3394c2[_0x09d8('0x32')];if(!_0x2378dd['query'][_0x09d8('0x39')]('nolimit')){_0xd37353[_0x09d8('0x3a')]=qs[_0x09d8('0x3a')](_0x2378dd['query'][_0x09d8('0x3a')]);_0xd37353['offset']=qs[_0x09d8('0x23')](_0x2378dd[_0x09d8('0x33')][_0x09d8('0x23')]);}_0xd37353[_0x09d8('0x3b')]=qs[_0x09d8('0x3c')](_0x2378dd['query'][_0x09d8('0x3c')]);_0xd37353[_0x09d8('0x3d')]=qs[_0x09d8('0x35')](_['pick'](_0x2378dd['query'],_0x3394c2[_0x09d8('0x35')]),_0x39aac8);if(_0x2378dd[_0x09d8('0x33')]['filter']){_0xd37353[_0x09d8('0x3d')]=_['merge'](_0xd37353[_0x09d8('0x3d')],{'$or':_[_0x09d8('0x2e')](_0x39aac8,function(_0x2763a1){if(_0x2763a1[_0x09d8('0x30')]!=='VIRTUAL'){var _0x19451d={};_0x19451d[_0x2763a1[_0x09d8('0x2c')]]={'$like':'%'+_0x2378dd[_0x09d8('0x33')][_0x09d8('0x3e')]+'%'};return _0x19451d;}})});}_0xd37353=_[_0x09d8('0x3f')]({},_0xd37353,_0x2378dd[_0x09d8('0x40')]);var _0x2407e4={'where':_0xd37353[_0x09d8('0x3d')]};return db[_0x09d8('0x41')]['count'](_0x2407e4)[_0x09d8('0x28')](function(_0x302a29){_0x10b0b1[_0x09d8('0x22')]=_0x302a29;if(_0x2378dd[_0x09d8('0x33')][_0x09d8('0x42')]){_0xd37353[_0x09d8('0x43')]=[{'all':!![]}];}return db['Variable'][_0x09d8('0x44')](_0xd37353);})['then'](function(_0x23d978){_0x10b0b1[_0x09d8('0x45')]=_0x23d978;return _0x10b0b1;})[_0x09d8('0x28')](respondWithFilteredResult(_0x54f685,_0xd37353))['catch'](handleError(_0x54f685,null));};exports[_0x09d8('0x46')]=function(_0x40d8cb,_0x458194){var _0x1ebcd2={'raw':!![],'where':{'id':_0x40d8cb['params']['id']}},_0x1cbd9d={};_0x1cbd9d['model']=_['keys'](db['Variable'][_0x09d8('0x47')]);_0x1cbd9d[_0x09d8('0x33')]=_[_0x09d8('0x34')](_0x40d8cb[_0x09d8('0x33')]);_0x1cbd9d[_0x09d8('0x35')]=_[_0x09d8('0x37')](_0x1cbd9d[_0x09d8('0x32')],_0x1cbd9d[_0x09d8('0x33')]);_0x1ebcd2[_0x09d8('0x36')]=_[_0x09d8('0x37')](_0x1cbd9d['model'],qs[_0x09d8('0x38')](_0x40d8cb[_0x09d8('0x33')][_0x09d8('0x38')]));_0x1ebcd2['attributes']=_0x1ebcd2[_0x09d8('0x36')][_0x09d8('0x48')]?_0x1ebcd2[_0x09d8('0x36')]:_0x1cbd9d[_0x09d8('0x32')];if(_0x40d8cb['query'][_0x09d8('0x42')]){_0x1ebcd2[_0x09d8('0x43')]=[{'all':!![]}];}_0x1ebcd2=_[_0x09d8('0x3f')]({},_0x1ebcd2,_0x40d8cb[_0x09d8('0x40')]);return db[_0x09d8('0x41')][_0x09d8('0x49')](_0x1ebcd2)[_0x09d8('0x28')](handleEntityNotFound(_0x458194,null))[_0x09d8('0x28')](respondWithResult(_0x458194,null))[_0x09d8('0x4a')](handleError(_0x458194,null));};exports[_0x09d8('0x4b')]=function(_0x4d317c,_0x486c2c){return db[_0x09d8('0x41')]['create'](_0x4d317c[_0x09d8('0x4c')],{})[_0x09d8('0x28')](function(_0x2821a0){var _0x55b87b=_0x4d317c[_0x09d8('0x4d')][_0x09d8('0x29')]({'plain':!![]});if(!_0x55b87b)throw new Error(_0x09d8('0x4e'));if(_0x55b87b[_0x09d8('0x4f')]===_0x09d8('0x4d')){var _0x304b2c=_0x2821a0[_0x09d8('0x29')]({'plain':!![]});var _0x48fec9='Variables';return db[_0x09d8('0x50')][_0x09d8('0x49')]({'where':{'name':_0x48fec9,'userProfileId':_0x55b87b[_0x09d8('0x51')]},'raw':!![]})[_0x09d8('0x28')](function(_0x3e3537){if(_0x3e3537&&_0x3e3537[_0x09d8('0x52')]===0x0){return db[_0x09d8('0x53')][_0x09d8('0x4b')]({'name':_0x304b2c[_0x09d8('0x2c')],'resourceId':_0x304b2c['id'],'type':_0x3e3537['name'],'sectionId':_0x3e3537['id']},{})[_0x09d8('0x28')](function(){return _0x2821a0;});}else{return _0x2821a0;}})[_0x09d8('0x4a')](function(_0x256332){logger[_0x09d8('0x2b')](_0x09d8('0x54'),_0x256332);throw _0x256332;});}return _0x2821a0;})['then'](respondWithResult(_0x486c2c,0xc9))[_0x09d8('0x4a')](handleError(_0x486c2c,null));};exports['update']=function(_0x3d19f0,_0x3d96fa){if(_0x3d19f0[_0x09d8('0x4c')]['id']){delete _0x3d19f0[_0x09d8('0x4c')]['id'];}return db[_0x09d8('0x41')][_0x09d8('0x49')]({'where':{'id':_0x3d19f0[_0x09d8('0x55')]['id']}})[_0x09d8('0x28')](handleEntityNotFound(_0x3d96fa,null))[_0x09d8('0x28')](saveUpdates(_0x3d19f0[_0x09d8('0x4c')],null))[_0x09d8('0x28')](respondWithResult(_0x3d96fa,null))['catch'](handleError(_0x3d96fa,null));};exports[_0x09d8('0x56')]=function(_0x309dba,_0x2ff0f2){return db[_0x09d8('0x41')][_0x09d8('0x49')]({'where':{'id':_0x309dba[_0x09d8('0x55')]['id']}})[_0x09d8('0x28')](handleEntityNotFound(_0x2ff0f2,null))[_0x09d8('0x28')](removeEntity(_0x2ff0f2,null))[_0x09d8('0x4a')](handleError(_0x2ff0f2,null));}; \ No newline at end of file +var _0x1a76=['map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','stack','name','send','index'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1a76,0x1ce));var _0x61a7=function(_0x6aaf7a,_0x2ddf35){_0x6aaf7a=_0x6aaf7a-0x0;var _0x522e20=_0x1a76[_0x6aaf7a];return _0x522e20;};'use strict';var pdf=require(_0x61a7('0x0'));var emlformat=require(_0x61a7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x61a7('0x2'));var rp=require('request-promise');var moment=require(_0x61a7('0x3'));var BPromise=require(_0x61a7('0x4'));var Mustache=require('mustache');var util=require(_0x61a7('0x5'));var path=require(_0x61a7('0x6'));var sox=require(_0x61a7('0x7'));var csv=require('to-csv');var ejs=require(_0x61a7('0x8'));var fs=require('fs');var _=require(_0x61a7('0x9'));var squel=require('squel');var crypto=require(_0x61a7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x61a7('0xb'));var querystring=require(_0x61a7('0xc'));var Papa=require(_0x61a7('0xd'));var Redis=require('ioredis');var authService=require(_0x61a7('0xe'));var qs=require(_0x61a7('0xf'));var as=require(_0x61a7('0x10'));var hardwareService=require(_0x61a7('0x11'));var logger=require(_0x61a7('0x12'))(_0x61a7('0x13'));var utils=require(_0x61a7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x61a7('0x15'));var db=require(_0x61a7('0x16'))['db'];function respondWithStatusCode(_0x5a7337,_0x3f2864){_0x3f2864=_0x3f2864||0xcc;return function(_0x398c53){if(_0x398c53){return _0x5a7337['sendStatus'](_0x3f2864);}return _0x5a7337[_0x61a7('0x17')](_0x3f2864)[_0x61a7('0x18')]();};}function respondWithResult(_0xd3f174,_0x2ee096){_0x2ee096=_0x2ee096||0xc8;return function(_0x47b69d){if(_0x47b69d){return _0xd3f174[_0x61a7('0x17')](_0x2ee096)[_0x61a7('0x19')](_0x47b69d);}};}function respondWithFilteredResult(_0x424bfb,_0x11f0d2){return function(_0x1c3d55){if(_0x1c3d55){var _0x184709=_0x1c3d55[_0x61a7('0x1a')],_0x12d609=_0x11f0d2[_0x61a7('0x1b')],_0x42e3bb=_0x11f0d2[_0x61a7('0x1b')]+_0x11f0d2['limit'],_0x2894fd;if(_0x42e3bb>=_0x184709){_0x42e3bb=_0x184709;_0x2894fd=0xc8;}else{_0x2894fd=0xce;}_0x424bfb[_0x61a7('0x17')](_0x2894fd);return _0x424bfb['set']('Content-Range',_0x12d609+'-'+_0x42e3bb+'/'+_0x184709)[_0x61a7('0x19')](_0x1c3d55);}return null;};}function patchUpdates(_0x13b125){return function(_0x81e5de){try{jsonpatch[_0x61a7('0x1c')](_0x81e5de,_0x13b125,!![]);}catch(_0x329ccf){return BPromise[_0x61a7('0x1d')](_0x329ccf);}return _0x81e5de[_0x61a7('0x1e')]();};}function saveUpdates(_0x2426dd,_0x36c720){return function(_0x2f3f7d){if(_0x2f3f7d){return _0x2f3f7d[_0x61a7('0x1f')](_0x2426dd)[_0x61a7('0x20')](function(_0x597f8a){return _0x597f8a;});}return null;};}function removeEntity(_0x4182c7,_0x1a2463){return function(_0x53b7db){if(_0x53b7db){return _0x53b7db[_0x61a7('0x21')]()[_0x61a7('0x20')](function(){var _0x22228b=_0x53b7db[_0x61a7('0x22')]({'plain':!![]});var _0x5e5c73=_0x61a7('0x23');return db[_0x61a7('0x24')][_0x61a7('0x21')]({'where':{'type':_0x5e5c73,'resourceId':_0x22228b['id']}})[_0x61a7('0x20')](function(){return _0x53b7db;});})[_0x61a7('0x20')](function(){_0x4182c7[_0x61a7('0x17')](0xcc)[_0x61a7('0x18')]();});}};}function handleEntityNotFound(_0x5431a5,_0x57785c){return function(_0x1def25){if(!_0x1def25){_0x5431a5[_0x61a7('0x25')](0x194);}return _0x1def25;};}function handleError(_0x3c67a0,_0x1e932b){_0x1e932b=_0x1e932b||0x1f4;return function(_0x435115){logger['error'](_0x435115[_0x61a7('0x26')]);if(_0x435115[_0x61a7('0x27')]){delete _0x435115[_0x61a7('0x27')];}_0x3c67a0[_0x61a7('0x17')](_0x1e932b)[_0x61a7('0x28')](_0x435115);};}exports[_0x61a7('0x29')]=function(_0x1807e1,_0x4b6dc4){var _0x1ea843={},_0x8d0bc7={},_0x2abe5b={'count':0x0,'rows':[]};var _0x3da974=_[_0x61a7('0x2a')](db['Variable'][_0x61a7('0x2b')],function(_0x137d72){return{'name':_0x137d72[_0x61a7('0x2c')],'type':_0x137d72[_0x61a7('0x2d')]['key']};});_0x8d0bc7[_0x61a7('0x2e')]=_['map'](_0x3da974,'name');_0x8d0bc7['query']=_[_0x61a7('0x2f')](_0x1807e1[_0x61a7('0x30')]);_0x8d0bc7[_0x61a7('0x31')]=_[_0x61a7('0x32')](_0x8d0bc7[_0x61a7('0x2e')],_0x8d0bc7['query']);_0x1ea843[_0x61a7('0x33')]=_[_0x61a7('0x32')](_0x8d0bc7[_0x61a7('0x2e')],qs[_0x61a7('0x34')](_0x1807e1[_0x61a7('0x30')][_0x61a7('0x34')]));_0x1ea843[_0x61a7('0x33')]=_0x1ea843[_0x61a7('0x33')]['length']?_0x1ea843['attributes']:_0x8d0bc7['model'];if(!_0x1807e1[_0x61a7('0x30')][_0x61a7('0x35')](_0x61a7('0x36'))){_0x1ea843[_0x61a7('0x37')]=qs['limit'](_0x1807e1[_0x61a7('0x30')][_0x61a7('0x37')]);_0x1ea843[_0x61a7('0x1b')]=qs[_0x61a7('0x1b')](_0x1807e1['query'][_0x61a7('0x1b')]);}_0x1ea843[_0x61a7('0x38')]=qs[_0x61a7('0x39')](_0x1807e1[_0x61a7('0x30')][_0x61a7('0x39')]);_0x1ea843[_0x61a7('0x3a')]=qs['filters'](_[_0x61a7('0x3b')](_0x1807e1[_0x61a7('0x30')],_0x8d0bc7[_0x61a7('0x31')]),_0x3da974);if(_0x1807e1['query'][_0x61a7('0x3c')]){_0x1ea843['where']=_[_0x61a7('0x3d')](_0x1ea843[_0x61a7('0x3a')],{'$or':_[_0x61a7('0x2a')](_0x3da974,function(_0x14b90a){if(_0x14b90a[_0x61a7('0x2d')]!==_0x61a7('0x3e')){var _0x489082={};_0x489082[_0x14b90a[_0x61a7('0x27')]]={'$like':'%'+_0x1807e1[_0x61a7('0x30')][_0x61a7('0x3c')]+'%'};return _0x489082;}})});}_0x1ea843=_[_0x61a7('0x3d')]({},_0x1ea843,_0x1807e1[_0x61a7('0x3f')]);var _0x19f952={'where':_0x1ea843[_0x61a7('0x3a')]};return db[_0x61a7('0x40')][_0x61a7('0x1a')](_0x19f952)[_0x61a7('0x20')](function(_0x35e68e){_0x2abe5b[_0x61a7('0x1a')]=_0x35e68e;if(_0x1807e1['query'][_0x61a7('0x41')]){_0x1ea843[_0x61a7('0x42')]=[{'all':!![]}];}return db[_0x61a7('0x40')][_0x61a7('0x43')](_0x1ea843);})[_0x61a7('0x20')](function(_0x2329b9){_0x2abe5b[_0x61a7('0x44')]=_0x2329b9;return _0x2abe5b;})[_0x61a7('0x20')](respondWithFilteredResult(_0x4b6dc4,_0x1ea843))[_0x61a7('0x45')](handleError(_0x4b6dc4,null));};exports[_0x61a7('0x46')]=function(_0x33f906,_0x515be5){var _0x101651={'raw':!![],'where':{'id':_0x33f906[_0x61a7('0x47')]['id']}},_0x416576={};_0x416576[_0x61a7('0x2e')]=_['keys'](db[_0x61a7('0x40')]['rawAttributes']);_0x416576[_0x61a7('0x30')]=_[_0x61a7('0x2f')](_0x33f906[_0x61a7('0x30')]);_0x416576['filters']=_[_0x61a7('0x32')](_0x416576[_0x61a7('0x2e')],_0x416576[_0x61a7('0x30')]);_0x101651[_0x61a7('0x33')]=_[_0x61a7('0x32')](_0x416576[_0x61a7('0x2e')],qs['fields'](_0x33f906[_0x61a7('0x30')][_0x61a7('0x34')]));_0x101651[_0x61a7('0x33')]=_0x101651[_0x61a7('0x33')][_0x61a7('0x48')]?_0x101651[_0x61a7('0x33')]:_0x416576[_0x61a7('0x2e')];if(_0x33f906['query']['includeAll']){_0x101651[_0x61a7('0x42')]=[{'all':!![]}];}_0x101651=_[_0x61a7('0x3d')]({},_0x101651,_0x33f906[_0x61a7('0x3f')]);return db[_0x61a7('0x40')][_0x61a7('0x49')](_0x101651)[_0x61a7('0x20')](handleEntityNotFound(_0x515be5,null))['then'](respondWithResult(_0x515be5,null))[_0x61a7('0x45')](handleError(_0x515be5,null));};exports[_0x61a7('0x4a')]=function(_0x1fe169,_0x42e56e){return db[_0x61a7('0x40')][_0x61a7('0x4a')](_0x1fe169[_0x61a7('0x4b')],{})[_0x61a7('0x20')](function(_0x33a263){var _0x4c6b30=_0x1fe169[_0x61a7('0x4c')][_0x61a7('0x22')]({'plain':!![]});if(!_0x4c6b30)throw new Error(_0x61a7('0x4d'));if(_0x4c6b30[_0x61a7('0x4e')]==='user'){var _0x1f41d7=_0x33a263[_0x61a7('0x22')]({'plain':!![]});var _0x380e17=_0x61a7('0x23');return db[_0x61a7('0x4f')][_0x61a7('0x49')]({'where':{'name':_0x380e17,'userProfileId':_0x4c6b30[_0x61a7('0x50')]},'raw':!![]})['then'](function(_0x2ffc1f){if(_0x2ffc1f&&_0x2ffc1f[_0x61a7('0x51')]===0x0){return db['UserProfileResource'][_0x61a7('0x4a')]({'name':_0x1f41d7[_0x61a7('0x27')],'resourceId':_0x1f41d7['id'],'type':_0x2ffc1f[_0x61a7('0x27')],'sectionId':_0x2ffc1f['id']},{})[_0x61a7('0x20')](function(){return _0x33a263;});}else{return _0x33a263;}})[_0x61a7('0x45')](function(_0x52d3fe){logger[_0x61a7('0x52')](_0x61a7('0x53'),_0x52d3fe);throw _0x52d3fe;});}return _0x33a263;})[_0x61a7('0x20')](respondWithResult(_0x42e56e,0xc9))[_0x61a7('0x45')](handleError(_0x42e56e,null));};exports[_0x61a7('0x1f')]=function(_0xf7fbb2,_0x240fab){if(_0xf7fbb2[_0x61a7('0x4b')]['id']){delete _0xf7fbb2[_0x61a7('0x4b')]['id'];}return db[_0x61a7('0x40')][_0x61a7('0x49')]({'where':{'id':_0xf7fbb2[_0x61a7('0x47')]['id']}})[_0x61a7('0x20')](handleEntityNotFound(_0x240fab,null))['then'](saveUpdates(_0xf7fbb2[_0x61a7('0x4b')],null))['then'](respondWithResult(_0x240fab,null))[_0x61a7('0x45')](handleError(_0x240fab,null));};exports[_0x61a7('0x21')]=function(_0x16ee81,_0x4c079f){return db[_0x61a7('0x40')][_0x61a7('0x49')]({'where':{'id':_0x16ee81[_0x61a7('0x47')]['id']}})[_0x61a7('0x20')](handleEntityNotFound(_0x4c079f,null))['then'](removeEntity(_0x4c079f,null))[_0x61a7('0x45')](handleError(_0x4c079f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index b65ac88..0e3a42e 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 _0xe062=['moment','bluebird','rimraf','../../config/environment','tools_variables','lodash','util','api'];(function(_0x3fb74d,_0x59c3b3){var _0x570bf4=function(_0x4d7040){while(--_0x4d7040){_0x3fb74d['push'](_0x3fb74d['shift']());}};_0x570bf4(++_0x59c3b3);}(_0xe062,0xd5));var _0x2e06=function(_0xbbb392,_0x303aa8){_0xbbb392=_0xbbb392-0x0;var _0x2454fe=_0xe062[_0xbbb392];return _0x2454fe;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var logger=require('../../config/logger')(_0x2e06('0x2'));var moment=require(_0x2e06('0x3'));var BPromise=require(_0x2e06('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e06('0x5'));var config=require(_0x2e06('0x6'));var attributes=require('./variable.attributes');module['exports']=function(_0x912daf,_0x31d2a3){return _0x912daf['define']('Variable',attributes,{'tableName':_0x2e06('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x851d=['bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','../../config/logger','api'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd851('0x0'));var util=require('util');var logger=require(_0xd851('0x1'))(_0xd851('0x2'));var moment=require('moment');var BPromise=require(_0xd851('0x3'));var rp=require(_0xd851('0x4'));var fs=require('fs');var path=require(_0xd851('0x5'));var rimraf=require(_0xd851('0x6'));var config=require(_0xd851('0x7'));var attributes=require(_0xd851('0x8'));module['exports']=function(_0x578809,_0x1fff93){return _0x578809[_0xd851('0x9')](_0xd851('0xa'),attributes,{'tableName':_0xd851('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 72cabf4..596f0bc 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 _0x27ef=['catch','Variable','find','options','raw','attributes','include','map','model','ShowVariable','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0xa1bae2,_0x352272){var _0x2f3344=function(_0x336692){while(--_0x336692){_0xa1bae2['push'](_0xa1bae2['shift']());}};_0x2f3344(++_0x352272);}(_0x27ef,0xb5));var _0xf27e=function(_0x4f828c,_0x2f6cac){_0x4f828c=_0x4f828c-0x0;var _0x1fea4d=_0x27ef[_0x4f828c];return _0x1fea4d;};'use strict';var _=require(_0xf27e('0x0'));var util=require(_0xf27e('0x1'));var moment=require(_0xf27e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf27e('0x3'));var fs=require('fs');var Redis=require(_0xf27e('0x4'));var db=require(_0xf27e('0x5'))['db'];var utils=require(_0xf27e('0x6'));var logger=require(_0xf27e('0x7'))(_0xf27e('0x8'));var config=require(_0xf27e('0x9'));var jayson=require(_0xf27e('0xa'));var client=jayson[_0xf27e('0xb')][_0xf27e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x477b7a,_0x27cd21,_0x313615){return new BPromise(function(_0x20606b,_0x58ed79){return client[_0xf27e('0xd')](_0x477b7a,_0x313615)[_0xf27e('0xe')](function(_0x3d0dd7){logger[_0xf27e('0xf')](_0xf27e('0x10'),_0x27cd21,_0xf27e('0x11'));logger[_0xf27e('0x12')](_0xf27e('0x13'),_0x27cd21,_0xf27e('0x11'),JSON['stringify'](_0x3d0dd7));if(_0x3d0dd7['error']){if(_0x3d0dd7[_0xf27e('0x14')]['code']===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x27cd21,_0x3d0dd7[_0xf27e('0x14')][_0xf27e('0x15')]);return _0x58ed79(_0x3d0dd7[_0xf27e('0x14')][_0xf27e('0x15')]);}logger[_0xf27e('0x14')](_0xf27e('0x10'),_0x27cd21,_0x3d0dd7['error'][_0xf27e('0x15')]);return _0x20606b(_0x3d0dd7[_0xf27e('0x14')]['message']);}else{logger['info'](_0xf27e('0x10'),_0x27cd21,_0xf27e('0x11'));_0x20606b(_0x3d0dd7[_0xf27e('0x16')]['message']);}})[_0xf27e('0x17')](function(_0x1f25ab){logger[_0xf27e('0x14')](_0xf27e('0x10'),_0x27cd21,_0x1f25ab);_0x58ed79(_0x1f25ab);});});}exports['ShowVariable']=function(_0x5bce68){var _0x5417fd=this;return new Promise(function(_0x480810,_0x3b8e94){return db[_0xf27e('0x18')][_0xf27e('0x19')]({'raw':_0x5bce68['options']?_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bce68[_0xf27e('0x1a')]?_0x5bce68[_0xf27e('0x1a')]['where']||null:null,'attributes':_0x5bce68['options']?_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1c')]||null:null,'include':_0x5bce68[_0xf27e('0x1a')]?_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1d')]?_[_0xf27e('0x1e')](_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1d')],function(_0x173f46){return{'model':db[_0x173f46[_0xf27e('0x1f')]],'as':_0x173f46['as'],'attributes':_0x173f46[_0xf27e('0x1c')],'include':_0x173f46['include']?_[_0xf27e('0x1e')](_0x173f46[_0xf27e('0x1d')],function(_0x48d194){return{'model':db[_0x48d194[_0xf27e('0x1f')]],'as':_0x48d194['as'],'attributes':_0x48d194[_0xf27e('0x1c')],'include':_0x48d194[_0xf27e('0x1d')]?_[_0xf27e('0x1e')](_0x48d194[_0xf27e('0x1d')],function(_0x4f69f8){return{'model':db[_0x4f69f8[_0xf27e('0x1f')]],'as':_0x4f69f8['as'],'attributes':_0x4f69f8[_0xf27e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf27e('0xe')](function(_0x38c0ad){logger[_0xf27e('0xf')](_0xf27e('0x20'),_0x5bce68);logger[_0xf27e('0x12')](_0xf27e('0x20'),_0x5bce68,JSON[_0xf27e('0x21')](_0x38c0ad));_0x480810(_0x38c0ad);})['catch'](function(_0x184fd4){logger[_0xf27e('0x14')](_0xf27e('0x20'),_0x184fd4[_0xf27e('0x15')],_0x5bce68);_0x3b8e94(_0x5417fd['error'](0x1f4,_0x184fd4[_0xf27e('0x15')]));});});}; \ No newline at end of file +var _0xe13f=['raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','Variable,\x20%s,\x20%s','message','info','result','catch','ShowVariable','Variable','options'];(function(_0x406aff,_0x22c459){var _0x509d36=function(_0x2a50a7){while(--_0x2a50a7){_0x406aff['push'](_0x406aff['shift']());}};_0x509d36(++_0x22c459);}(_0xe13f,0x1c6));var _0xfe13=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe13f[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xfe13('0x0'));var util=require(_0xfe13('0x1'));var moment=require(_0xfe13('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe13('0x3'));var fs=require('fs');var Redis=require(_0xfe13('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe13('0x5'))(_0xfe13('0x6'));var config=require(_0xfe13('0x7'));var jayson=require(_0xfe13('0x8'));var client=jayson['client'][_0xfe13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bc0c3,_0x41e7d5,_0x21b4f4){return new BPromise(function(_0x45054a,_0x19055a){return client[_0xfe13('0xa')](_0x2bc0c3,_0x21b4f4)[_0xfe13('0xb')](function(_0x5ecbed){logger['info']('Variable,\x20%s,\x20%s',_0x41e7d5,_0xfe13('0xc'));logger[_0xfe13('0xd')](_0xfe13('0xe'),_0x41e7d5,_0xfe13('0xc'),JSON[_0xfe13('0xf')](_0x5ecbed));if(_0x5ecbed[_0xfe13('0x10')]){if(_0x5ecbed['error'][_0xfe13('0x11')]===0x1f4){logger[_0xfe13('0x10')](_0xfe13('0x12'),_0x41e7d5,_0x5ecbed['error']['message']);return _0x19055a(_0x5ecbed[_0xfe13('0x10')][_0xfe13('0x13')]);}logger['error']('Variable,\x20%s,\x20%s',_0x41e7d5,_0x5ecbed['error'][_0xfe13('0x13')]);return _0x45054a(_0x5ecbed[_0xfe13('0x10')]['message']);}else{logger[_0xfe13('0x14')](_0xfe13('0x12'),_0x41e7d5,_0xfe13('0xc'));_0x45054a(_0x5ecbed[_0xfe13('0x15')]['message']);}})[_0xfe13('0x16')](function(_0x944334){logger['error'](_0xfe13('0x12'),_0x41e7d5,_0x944334);_0x19055a(_0x944334);});});}exports[_0xfe13('0x17')]=function(_0x4e7420){var _0x214671=this;return new Promise(function(_0x1d3fc8,_0x392ed2){return db[_0xfe13('0x18')]['find']({'raw':_0x4e7420['options']?_0x4e7420[_0xfe13('0x19')][_0xfe13('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e7420[_0xfe13('0x19')]?_0x4e7420[_0xfe13('0x19')][_0xfe13('0x1b')]||null:null,'attributes':_0x4e7420[_0xfe13('0x19')]?_0x4e7420['options'][_0xfe13('0x1c')]||null:null,'include':_0x4e7420[_0xfe13('0x19')]?_0x4e7420[_0xfe13('0x19')][_0xfe13('0x1d')]?_[_0xfe13('0x1e')](_0x4e7420['options']['include'],function(_0x5474fa){return{'model':db[_0x5474fa[_0xfe13('0x1f')]],'as':_0x5474fa['as'],'attributes':_0x5474fa[_0xfe13('0x1c')],'include':_0x5474fa[_0xfe13('0x1d')]?_[_0xfe13('0x1e')](_0x5474fa[_0xfe13('0x1d')],function(_0x5a8d3c){return{'model':db[_0x5a8d3c[_0xfe13('0x1f')]],'as':_0x5a8d3c['as'],'attributes':_0x5a8d3c[_0xfe13('0x1c')],'include':_0x5a8d3c[_0xfe13('0x1d')]?_[_0xfe13('0x1e')](_0x5a8d3c[_0xfe13('0x1d')],function(_0x5b1799){return{'model':db[_0x5b1799['model']],'as':_0x5b1799['as'],'attributes':_0x5b1799[_0xfe13('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfe13('0xb')](function(_0x4262d0){logger['info']('ShowVariable',_0x4e7420);logger[_0xfe13('0xd')]('ShowVariable',_0x4e7420,JSON[_0xfe13('0xf')](_0x4262d0));_0x1d3fc8(_0x4262d0);})[_0xfe13('0x16')](function(_0x3a9f66){logger[_0xfe13('0x10')](_0xfe13('0x17'),_0x3a9f66['message'],_0x4e7420);_0x392ed2(_0x214671[_0xfe13('0x10')](0x1f4,_0x3a9f66[_0xfe13('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 68ba812..1885111 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 _0xfa3a=['isAuthenticated','canUpdate','fetch','/reset','reset','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','index','get','/fetch'];(function(_0x1b98c9,_0x5cf679){var _0x158af9=function(_0x30795a){while(--_0x30795a){_0x1b98c9['push'](_0x1b98c9['shift']());}};_0x158af9(++_0x5cf679);}(_0xfa3a,0x1ad));var _0xafa3=function(_0xfaaad,_0x4c46e6){_0xfaaad=_0xfaaad-0x0;var _0x59136e=_0xfa3a[_0xfaaad];return _0x59136e;};'use strict';var express=require(_0xafa3('0x0'));var router=express[_0xafa3('0x1')]();var auth=require(_0xafa3('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0xafa3('0x3')]);router[_0xafa3('0x4')](_0xafa3('0x5'),auth[_0xafa3('0x6')](),auth[_0xafa3('0x7')](),controller[_0xafa3('0x8')]);router[_0xafa3('0x4')](_0xafa3('0x9'),auth[_0xafa3('0x6')](),auth[_0xafa3('0x7')](),controller[_0xafa3('0xa')]);router[_0xafa3('0x4')]('/pull',auth[_0xafa3('0x6')](),auth['canUpdate'](),controller['pull']);router[_0xafa3('0x4')](_0xafa3('0xb'),auth[_0xafa3('0x6')](),controller[_0xafa3('0xc')]);router['get'](_0xafa3('0xd'),controller['migrations']);module[_0xafa3('0xe')]=router; \ No newline at end of file +var _0xce6e=['/pull','pull','restart','/migrations','migrations','exports','express','../../components/auth/service','get','index','isAuthenticated','canUpdate','fetch','/reset','reset'];(function(_0x3aaed7,_0x155e9e){var _0x1bb8e2=function(_0x10b4e9){while(--_0x10b4e9){_0x3aaed7['push'](_0x3aaed7['shift']());}};_0x1bb8e2(++_0x155e9e);}(_0xce6e,0x7e));var _0xece6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce6e[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xece6('0x0'));var router=express['Router']();var auth=require(_0xece6('0x1'));var controller=require('./version.controller');router[_0xece6('0x2')]('/',controller[_0xece6('0x3')]);router[_0xece6('0x2')]('/fetch',auth[_0xece6('0x4')](),auth[_0xece6('0x5')](),controller[_0xece6('0x6')]);router[_0xece6('0x2')](_0xece6('0x7'),auth[_0xece6('0x4')](),auth[_0xece6('0x5')](),controller[_0xece6('0x8')]);router[_0xece6('0x2')](_0xece6('0x9'),auth[_0xece6('0x4')](),auth['canUpdate'](),controller[_0xece6('0xa')]);router[_0xece6('0x2')]('/restart',auth['isAuthenticated'](),controller[_0xece6('0xb')]);router['get'](_0xece6('0xc'),controller[_0xece6('0xd')]);module[_0xece6('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0190b9a..50103fc 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 _0x5800=['getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','child_process','exec','../../config/environment','update','simple-git','index','exports','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','root','server','migrations','length','replace','.js','push','sort','sequelize','Migration'];(function(_0x47dd12,_0x2ac0e0){var _0x5a2e04=function(_0x73cb8){while(--_0x73cb8){_0x47dd12['push'](_0x47dd12['shift']());}};_0x5a2e04(++_0x2ac0e0);}(_0x5800,0x1b9));var _0x0580=function(_0x21ff61,_0x4b2027){_0x21ff61=_0x21ff61-0x0;var _0x21cf68=_0x5800[_0x21ff61];return _0x21cf68;};'use strict';var Umzug=require('umzug');var path=require(_0x0580('0x0'));var fs=require('fs');var _=require(_0x0580('0x1'));var pkginfo=require(_0x0580('0x2'))(module,_0x0580('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x0580('0x4'))[_0x0580('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x0580('0x6'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x0580('0x7'));var git=require(_0x0580('0x8'))(config['root']);exports[_0x0580('0x9')]=function(_0x5c4ab8,_0x1e4b42){var _0x51bb48={'current':module[_0x0580('0xa')][_0x0580('0x3')],'phonebar':0x2};if(_0x5c4ab8[_0x0580('0xb')]&&_0x5c4ab8[_0x0580('0xb')][_0x0580('0xc')]){return git[_0x0580('0xd')]()[_0x0580('0xe')](function(_0x1edc39,_0x4a6786){_0x51bb48[_0x0580('0xc')]=(_0x1edc39?module[_0x0580('0xa')][_0x0580('0x3')]:_0x4a6786['latest'])||'2.0.0';return _0x1e4b42[_0x0580('0xf')](0xc8)[_0x0580('0x10')](_0x51bb48);});}else{return _0x1e4b42[_0x0580('0xf')](0xc8)['json'](_0x51bb48);}};exports[_0x0580('0xd')]=function(_0x41ec01,_0x45d8b2){return git['fetch']([_0x0580('0x11'),_0x0580('0x12')],function(_0x473bcd){if(_0x473bcd){logger[_0x0580('0x13')](_0x473bcd);return _0x45d8b2[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x473bcd);}logger[_0x0580('0x14')]('git\x20fetch');return _0x45d8b2[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x15')});});};exports[_0x0580('0x16')]=function(_0x18739d,_0x549e64){return git[_0x0580('0x16')]([_0x0580('0x17'),_0x0580('0x18')],function(_0x5b3db9){if(_0x5b3db9){logger[_0x0580('0x13')](_0x5b3db9);return _0x549e64[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x5b3db9);}logger[_0x0580('0x14')](_0x0580('0x19'));return _0x549e64[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':'git\x20reset\x20--hard'});});};exports[_0x0580('0x1a')]=function(_0x3c9415,_0xab9d36){exec(_0x0580('0x1b'),function(_0x23cfa8,_0x36f360,_0x180fc3){logger[_0x0580('0x14')](_0x36f360);logger[_0x0580('0x14')](_0x180fc3);if(_0x23cfa8){logger[_0x0580('0x13')](_0x23cfa8);return _0xab9d36[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x23cfa8);}return _0xab9d36[_0x0580('0xf')](0xc8)['json']({'output':_0x36f360});});};exports['restart']=function(_0x137ac6,_0x5ee76e){return pm2[_0x0580('0x1c')](_0x0580('0x1d'))[_0x0580('0x1e')](function(_0x1833db){logger[_0x0580('0x14')](_0x0580('0x1f'),_0x1833db);return _0x5ee76e[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x20')});})[_0x0580('0x21')](function(_0x22a5c2){logger['error'](_0x22a5c2);return _0x5ee76e[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x22a5c2);});};exports['migrations']=function(_0x36333e,_0x2720f3){var _0xae8068=fs[_0x0580('0x22')](path['join'](config[_0x0580('0x23')],_0x0580('0x24'),_0x0580('0x25')));var _0x457f1b=[];for(var _0x2522df=0x0;_0x2522df<_0xae8068[_0x0580('0x26')];_0x2522df++){var _0x3429ed=_0xae8068[_0x2522df][_0x0580('0x27')](_0x0580('0x28'),'');if(compareVersions(module[_0x0580('0xa')][_0x0580('0x3')],_0x3429ed)===-0x1){_0x457f1b[_0x0580('0x29')](_0x3429ed);}}if(_0x457f1b['length']){var _0x5227ed=_0x457f1b[_0x0580('0x2a')](compareVersions);var _0x1eaef0=new Umzug({'storage':_0x0580('0x2b'),'storageOptions':{'model':db[_0x0580('0x2c')],'modelName':_0x0580('0x2c'),'columnName':_0x0580('0x3')},'migrations':{'params':[db[_0x0580('0x2b')][_0x0580('0x2d')](),db[_0x0580('0x2b')]['constructor'],function(){throw new Error(_0x0580('0x2e'));}],'path':path[_0x0580('0x2f')](config[_0x0580('0x23')],_0x0580('0x24'),_0x0580('0x25')),'pattern':/\.js$/}});_0x1eaef0['up']({'migrations':_[_0x0580('0x30')](_0x5227ed,function(_0x4ce695){return _0x4ce695+_0x0580('0x28');})})['then'](function(){return _0x2720f3['status'](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x31')+module[_0x0580('0xa')][_0x0580('0x3')]+_0x0580('0x32')+_[_0x0580('0x33')](_0x5227ed),'migrations':_['join'](_0x5227ed)});})[_0x0580('0x21')](function(_0xb89e6c){if(_0xb89e6c instanceof db[_0x0580('0x2b')][_0x0580('0x34')]){return _0x2720f3['status'](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x35')});}else{return _0x2720f3['status'](0x1f4)[_0x0580('0x10')](_0xb89e6c);}});}else{return _0x2720f3[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x2678=['last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','version','query','latest','fetch','tags','exports','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','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','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20'];(function(_0x1b63e1,_0x30a406){var _0x18e513=function(_0x4827fb){while(--_0x4827fb){_0x1b63e1['push'](_0x1b63e1['shift']());}};_0x18e513(++_0x30a406);}(_0x2678,0x1bb));var _0x8267=function(_0x1ae152,_0x21f035){_0x1ae152=_0x1ae152-0x0;var _0x265ede=_0x2678[_0x1ae152];return _0x265ede;};'use strict';var Umzug=require('umzug');var path=require(_0x8267('0x0'));var fs=require('fs');var _=require(_0x8267('0x1'));var pkginfo=require(_0x8267('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require('child_process')[_0x8267('0x3')];var db=require(_0x8267('0x4'))['db'];var config=require(_0x8267('0x5'));var pm2=require('../../config/pm2');var logger=require(_0x8267('0x6'))(_0x8267('0x7'));var git=require(_0x8267('0x8'))(config[_0x8267('0x9')]);exports[_0x8267('0xa')]=function(_0x3f30c2,_0x2ac4ad){var _0x2bbb0d={'current':module['exports'][_0x8267('0xb')],'phonebar':0x2};if(_0x3f30c2[_0x8267('0xc')]&&_0x3f30c2['query'][_0x8267('0xd')]){return git[_0x8267('0xe')]()[_0x8267('0xf')](function(_0x283fc4,_0x3a67c0){_0x2bbb0d['latest']=(_0x283fc4?module[_0x8267('0x10')][_0x8267('0xb')]:_0x3a67c0[_0x8267('0xd')])||_0x8267('0x11');return _0x2ac4ad[_0x8267('0x12')](0xc8)[_0x8267('0x13')](_0x2bbb0d);});}else{return _0x2ac4ad[_0x8267('0x12')](0xc8)[_0x8267('0x13')](_0x2bbb0d);}};exports[_0x8267('0xe')]=function(_0x16eccf,_0x2ed051){return git['fetch']([_0x8267('0x14'),'master'],function(_0x39cc14){if(_0x39cc14){logger[_0x8267('0x15')](_0x39cc14);return _0x2ed051[_0x8267('0x12')](0x1f4)[_0x8267('0x13')](_0x39cc14);}logger['info'](_0x8267('0x16'));return _0x2ed051['status'](0xc8)[_0x8267('0x13')]({'output':_0x8267('0x17')});});};exports['reset']=function(_0x59685b,_0x2577a5){return git[_0x8267('0x18')]([_0x8267('0x19'),_0x8267('0x1a')],function(_0x4c5b8a){if(_0x4c5b8a){logger[_0x8267('0x15')](_0x4c5b8a);return _0x2577a5['status'](0x1f4)[_0x8267('0x13')](_0x4c5b8a);}logger[_0x8267('0x1b')](_0x8267('0x1c'));return _0x2577a5['status'](0xc8)[_0x8267('0x13')]({'output':_0x8267('0x1d')});});};exports[_0x8267('0x1e')]=function(_0x1dd8b7,_0xfdef8c){exec(_0x8267('0x1f'),function(_0x143300,_0x590931,_0x54db81){logger[_0x8267('0x1b')](_0x590931);logger[_0x8267('0x1b')](_0x54db81);if(_0x143300){logger[_0x8267('0x15')](_0x143300);return _0xfdef8c[_0x8267('0x12')](0x1f4)[_0x8267('0x13')](_0x143300);}return _0xfdef8c[_0x8267('0x12')](0xc8)['json']({'output':_0x590931});});};exports[_0x8267('0x20')]=function(_0x11f5ac,_0x24c03c){return pm2[_0x8267('0x20')](_0x8267('0x21'))['then'](function(_0x2e8e7e){logger[_0x8267('0x1b')](_0x8267('0x22'),_0x2e8e7e);return _0x24c03c[_0x8267('0x12')](0xc8)[_0x8267('0x13')]({'output':_0x8267('0x23')});})[_0x8267('0x24')](function(_0x59cee3){logger[_0x8267('0x15')](_0x59cee3);return _0x24c03c[_0x8267('0x12')](0x1f4)[_0x8267('0x13')](_0x59cee3);});};exports[_0x8267('0x25')]=function(_0x398ebd,_0x21fbe4){var _0x2d75e1=fs[_0x8267('0x26')](path[_0x8267('0x27')](config[_0x8267('0x9')],_0x8267('0x28'),'migrations'));var _0x32323b=[];for(var _0x4f7377=0x0;_0x4f7377<_0x2d75e1[_0x8267('0x29')];_0x4f7377++){var _0x4f4501=_0x2d75e1[_0x4f7377]['replace']('.js','');if(compareVersions(module['exports']['version'],_0x4f4501)===-0x1){_0x32323b[_0x8267('0x2a')](_0x4f4501);}}if(_0x32323b[_0x8267('0x29')]){var _0x523340=_0x32323b[_0x8267('0x2b')](compareVersions);var _0x257787=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x8267('0x2c')],'modelName':_0x8267('0x2c'),'columnName':_0x8267('0xb')},'migrations':{'params':[db[_0x8267('0x2d')]['getQueryInterface'](),db[_0x8267('0x2d')][_0x8267('0x2e')],function(){throw new Error(_0x8267('0x2f'));}],'path':path['join'](config[_0x8267('0x9')],_0x8267('0x28'),_0x8267('0x25')),'pattern':/\.js$/}});_0x257787['up']({'migrations':_[_0x8267('0x30')](_0x523340,function(_0x18ea89){return _0x18ea89+_0x8267('0x31');})})['then'](function(){return _0x21fbe4[_0x8267('0x12')](0xc8)[_0x8267('0x13')]({'output':_0x8267('0x32')+module[_0x8267('0x10')]['version']+_0x8267('0x33')+_[_0x8267('0x34')](_0x523340),'migrations':_[_0x8267('0x27')](_0x523340)});})[_0x8267('0x24')](function(_0x423afe){if(_0x423afe instanceof db[_0x8267('0x2d')][_0x8267('0x35')]){return _0x21fbe4['status'](0xc8)[_0x8267('0x13')]({'output':_0x8267('0x36')});}else{return _0x21fbe4[_0x8267('0x12')](0x1f4)['json'](_0x423afe);}});}else{return _0x21fbe4[_0x8267('0x12')](0xc8)[_0x8267('0x13')]({'output':_0x8267('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7999942..cab0d12 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 _0x7bd8=['show','post','create','put','/:id','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get'];(function(_0x1c0c5d,_0x4747dd){var _0x687a80=function(_0x1a1ff6){while(--_0x1a1ff6){_0x1c0c5d['push'](_0x1c0c5d['shift']());}};_0x687a80(++_0x4747dd);}(_0x7bd8,0x1dc));var _0x87bd=function(_0x310c37,_0x3b921b){_0x310c37=_0x310c37-0x0;var _0x3f414a=_0x7bd8[_0x310c37];return _0x3f414a;};'use strict';var multer=require(_0x87bd('0x0'));var util=require(_0x87bd('0x1'));var path=require(_0x87bd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x87bd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x87bd('0x4'));var config=require(_0x87bd('0x5'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x87bd('0x6')]);router['get']('/describe',auth[_0x87bd('0x7')](),controller[_0x87bd('0x8')]);router[_0x87bd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x87bd('0xa')]);router[_0x87bd('0xb')]('/',auth[_0x87bd('0x7')](),controller[_0x87bd('0xc')]);router[_0x87bd('0xd')](_0x87bd('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x87bd('0xf')](_0x87bd('0xe'),auth['isAuthenticated'](),controller[_0x87bd('0x10')]);module[_0x87bd('0x11')]=router; \ No newline at end of file +var _0x7d9d=['/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x7d9d,0x101));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7d9('0x0'));var util=require(_0xd7d9('0x1'));var path=require('path');var timeout=require(_0xd7d9('0x2'));var express=require(_0xd7d9('0x3'));var router=express[_0xd7d9('0x4')]();var auth=require(_0xd7d9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xd7d9('0x6')]('/',auth[_0xd7d9('0x7')](),controller[_0xd7d9('0x8')]);router[_0xd7d9('0x6')](_0xd7d9('0x9'),auth['isAuthenticated'](),controller[_0xd7d9('0xa')]);router['get'](_0xd7d9('0xb'),auth[_0xd7d9('0x7')](),controller[_0xd7d9('0xc')]);router[_0xd7d9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd7d9('0xe')](_0xd7d9('0xb'),auth[_0xd7d9('0x7')](),controller[_0xd7d9('0xf')]);router[_0xd7d9('0x10')](_0xd7d9('0xb'),auth[_0xd7d9('0x7')](),controller[_0xd7d9('0x11')]);module[_0xd7d9('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 fa7e5de..dc78a15 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x4d79b6,_0x1efe78){var _0x44650f=function(_0x50f328){while(--_0x50f328){_0x4d79b6['push'](_0x4d79b6['shift']());}};_0x44650f(++_0x1efe78);}(_0xabce,0x103));var _0xeabc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xabce[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'type':{'type':Sequelize[_0xeabc('0x2')]},'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'calleridnum':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xeabc('0x2')]},'membername':{'type':Sequelize[_0xeabc('0x2')]},'agentcalledAt':{'type':Sequelize[_0xeabc('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xeabc('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xeabc('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeabc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeabc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeabc('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeabc('0x4')]},'reason':{'type':Sequelize[_0xeabc('0x2')]},'lastevent':{'type':Sequelize[_0xeabc('0x2')]},'channel':{'type':Sequelize[_0xeabc('0x2')]},'channelstate':{'type':Sequelize[_0xeabc('0x4')]},'channelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'language':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize[_0xeabc('0x2')]},'exten':{'type':Sequelize[_0xeabc('0x2')]},'priority':{'type':Sequelize[_0xeabc('0x2')]},'destchannel':{'type':Sequelize[_0xeabc('0x2')]},'destchannelstate':{'type':Sequelize[_0xeabc('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xeabc('0x2')]},'destexten':{'type':Sequelize[_0xeabc('0x2')]},'destpriority':{'type':Sequelize[_0xeabc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeabc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xeabc('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xeabc('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xeabc('0x2')]},'agententerreason':{'type':Sequelize[_0xeabc('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x038b=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x501caf,_0x2ffea6){var _0x550433=function(_0xd3d6ff){while(--_0xd3d6ff){_0x501caf['push'](_0x501caf['shift']());}};_0x550433(++_0x2ffea6);}(_0x038b,0x114));var _0xb038=function(_0x3d4bce,_0x30d692){_0x3d4bce=_0x3d4bce-0x0;var _0x2d4d8e=_0x038b[_0x3d4bce];return _0x2d4d8e;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'type':{'type':Sequelize[_0xb038('0x1')]},'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb038('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb038('0x1')]},'membername':{'type':Sequelize[_0xb038('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb038('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb038('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb038('0x3')]},'agentcomplete':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb038('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb038('0x1')]},'channelstate':{'type':Sequelize[_0xb038('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'connectedlinename':{'type':Sequelize[_0xb038('0x1')]},'language':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'context':{'type':Sequelize[_0xb038('0x1')]},'exten':{'type':Sequelize[_0xb038('0x1')]},'priority':{'type':Sequelize[_0xb038('0x1')]},'destchannel':{'type':Sequelize[_0xb038('0x1')]},'destchannelstate':{'type':Sequelize[_0xb038('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb038('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb038('0x1')]},'destcalleridname':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb038('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb038('0x1')]},'destlanguage':{'type':Sequelize[_0xb038('0x1')]},'destaccountcode':{'type':Sequelize[_0xb038('0x1')]},'destcontext':{'type':Sequelize[_0xb038('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb038('0x1')]},'destuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb038('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb038('0x1')]},'transfer':{'type':Sequelize[_0xb038('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb038('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xb038('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb038('0x1')]},'agententerreason':{'type':Sequelize[_0xb038('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 8ed715c..866f3c5 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 _0x8b58=['VoiceAgentReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','fields','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x745e14,_0x262a08){var _0x55b28d=function(_0x582d93){while(--_0x582d93){_0x745e14['push'](_0x745e14['shift']());}};_0x55b28d(++_0x262a08);}(_0x8b58,0x6b));var _0x88b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b58[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x88b5('0x0'));var emlformat=require(_0x88b5('0x1'));var rimraf=require(_0x88b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88b5('0x3'));var rp=require('request-promise');var moment=require(_0x88b5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x88b5('0x5'));var sox=require(_0x88b5('0x6'));var csv=require('to-csv');var ejs=require(_0x88b5('0x7'));var fs=require('fs');var _=require(_0x88b5('0x8'));var squel=require(_0x88b5('0x9'));var crypto=require(_0x88b5('0xa'));var jsforce=require(_0x88b5('0xb'));var deskjs=require(_0x88b5('0xc'));var toCsv=require(_0x88b5('0xd'));var querystring=require(_0x88b5('0xe'));var Papa=require(_0x88b5('0xf'));var Redis=require('ioredis');var authService=require(_0x88b5('0x10'));var qs=require(_0x88b5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88b5('0x12'));var logger=require(_0x88b5('0x13'))(_0x88b5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x88b5('0x15'));var db=require(_0x88b5('0x16'))['db'];function respondWithStatusCode(_0x17a1bc,_0x49fd93){_0x49fd93=_0x49fd93||0xcc;return function(_0x1a3a20){if(_0x1a3a20){return _0x17a1bc['sendStatus'](_0x49fd93);}return _0x17a1bc[_0x88b5('0x17')](_0x49fd93)[_0x88b5('0x18')]();};}function respondWithResult(_0x5823eb,_0x33df42){_0x33df42=_0x33df42||0xc8;return function(_0x9b09d0){if(_0x9b09d0){return _0x5823eb[_0x88b5('0x17')](_0x33df42)[_0x88b5('0x19')](_0x9b09d0);}};}function respondWithFilteredResult(_0x1cebea,_0x4b3890){return function(_0x33a6d8){if(_0x33a6d8){var _0x23f1fa=_0x33a6d8[_0x88b5('0x1a')],_0x447331=_0x4b3890['offset'],_0x4e74da=_0x4b3890[_0x88b5('0x1b')]+_0x4b3890['limit'],_0x45ddf8;if(_0x4e74da>=_0x23f1fa){_0x4e74da=_0x23f1fa;_0x45ddf8=0xc8;}else{_0x45ddf8=0xce;}_0x1cebea['status'](_0x45ddf8);return _0x1cebea['set'](_0x88b5('0x1c'),_0x447331+'-'+_0x4e74da+'/'+_0x23f1fa)[_0x88b5('0x19')](_0x33a6d8);}return null;};}function patchUpdates(_0x1b69fb){return function(_0x57c1fa){try{jsonpatch['apply'](_0x57c1fa,_0x1b69fb,!![]);}catch(_0x481e80){return BPromise[_0x88b5('0x1d')](_0x481e80);}return _0x57c1fa[_0x88b5('0x1e')]();};}function saveUpdates(_0x167c71,_0x336a47){return function(_0x1fa893){if(_0x1fa893){return _0x1fa893[_0x88b5('0x1f')](_0x167c71)[_0x88b5('0x20')](function(_0x4f546a){return _0x4f546a;});}return null;};}function removeEntity(_0x4d3a38,_0x21c7d1){return function(_0x285c01){if(_0x285c01){return _0x285c01[_0x88b5('0x21')]()[_0x88b5('0x20')](function(){_0x4d3a38[_0x88b5('0x17')](0xcc)[_0x88b5('0x18')]();});}};}function handleEntityNotFound(_0x407f16,_0x52f193){return function(_0x423f7b){if(!_0x423f7b){_0x407f16[_0x88b5('0x22')](0x194);}return _0x423f7b;};}function handleError(_0x1b208a,_0x282929){_0x282929=_0x282929||0x1f4;return function(_0x84330f){logger[_0x88b5('0x23')](_0x84330f[_0x88b5('0x24')]);if(_0x84330f[_0x88b5('0x25')]){delete _0x84330f[_0x88b5('0x25')];}_0x1b208a['status'](_0x282929)[_0x88b5('0x26')](_0x84330f);};}exports[_0x88b5('0x27')]=function(_0x9dd3d8,_0x2aedf0){var _0x5c24d6={},_0x275d9a={},_0x4cb68c={'count':0x0,'rows':[]};var _0x3dd664=_[_0x88b5('0x28')](db[_0x88b5('0x29')][_0x88b5('0x2a')],function(_0x16e06a){return{'name':_0x16e06a['fieldName'],'type':_0x16e06a[_0x88b5('0x2b')][_0x88b5('0x2c')]};});_0x275d9a[_0x88b5('0x2d')]=_[_0x88b5('0x28')](_0x3dd664,_0x88b5('0x25'));_0x275d9a[_0x88b5('0x2e')]=_[_0x88b5('0x2f')](_0x9dd3d8['query']);_0x275d9a[_0x88b5('0x30')]=_[_0x88b5('0x31')](_0x275d9a[_0x88b5('0x2d')],_0x275d9a[_0x88b5('0x2e')]);_0x5c24d6[_0x88b5('0x32')]=_[_0x88b5('0x31')](_0x275d9a[_0x88b5('0x2d')],qs['fields'](_0x9dd3d8[_0x88b5('0x2e')]['fields']));_0x5c24d6['attributes']=_0x5c24d6[_0x88b5('0x32')]['length']?_0x5c24d6[_0x88b5('0x32')]:_0x275d9a[_0x88b5('0x2d')];if(!_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x33')](_0x88b5('0x34'))){_0x5c24d6[_0x88b5('0x35')]=qs[_0x88b5('0x35')](_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x35')]);_0x5c24d6[_0x88b5('0x1b')]=qs['offset'](_0x9dd3d8['query']['offset']);}_0x5c24d6[_0x88b5('0x36')]=qs[_0x88b5('0x37')](_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x37')]);_0x5c24d6[_0x88b5('0x38')]=qs[_0x88b5('0x30')](_[_0x88b5('0x39')](_0x9dd3d8[_0x88b5('0x2e')],_0x275d9a[_0x88b5('0x30')]),_0x3dd664);if(_0x9dd3d8[_0x88b5('0x2e')]['filter']){_0x5c24d6[_0x88b5('0x38')]=_[_0x88b5('0x3a')](_0x5c24d6[_0x88b5('0x38')],{'$or':_[_0x88b5('0x28')](_0x3dd664,function(_0x5c0fd2){if(_0x5c0fd2[_0x88b5('0x2b')]!==_0x88b5('0x3b')){var _0x5e6454={};_0x5e6454[_0x5c0fd2[_0x88b5('0x25')]]={'$like':'%'+_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x3c')]+'%'};return _0x5e6454;}})});}_0x5c24d6=_[_0x88b5('0x3a')]({},_0x5c24d6,_0x9dd3d8[_0x88b5('0x3d')]);var _0x8bf2fa={'where':_0x5c24d6[_0x88b5('0x38')]};return db['VoiceAgentReport'][_0x88b5('0x1a')](_0x8bf2fa)['then'](function(_0x168b23){_0x4cb68c[_0x88b5('0x1a')]=_0x168b23;if(_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x3e')]){_0x5c24d6[_0x88b5('0x3f')]=[{'all':!![]}];}return db[_0x88b5('0x29')]['findAll'](_0x5c24d6);})['then'](function(_0x39820c){_0x4cb68c[_0x88b5('0x40')]=_0x39820c;return _0x4cb68c;})['then'](respondWithFilteredResult(_0x2aedf0,_0x5c24d6))[_0x88b5('0x41')](handleError(_0x2aedf0,null));};exports[_0x88b5('0x42')]=function(_0x2b73a7,_0x45c9fe){var _0x3eaa66={'raw':![],'where':{'id':_0x2b73a7['params']['id']}},_0x57b7c6={};_0x57b7c6[_0x88b5('0x2d')]=_[_0x88b5('0x2f')](db[_0x88b5('0x29')][_0x88b5('0x2a')]);_0x57b7c6[_0x88b5('0x2e')]=_[_0x88b5('0x2f')](_0x2b73a7[_0x88b5('0x2e')]);_0x57b7c6[_0x88b5('0x30')]=_[_0x88b5('0x31')](_0x57b7c6[_0x88b5('0x2d')],_0x57b7c6[_0x88b5('0x2e')]);_0x3eaa66['attributes']=_[_0x88b5('0x31')](_0x57b7c6[_0x88b5('0x2d')],qs[_0x88b5('0x43')](_0x2b73a7[_0x88b5('0x2e')][_0x88b5('0x43')]));_0x3eaa66[_0x88b5('0x32')]=_0x3eaa66[_0x88b5('0x32')][_0x88b5('0x44')]?_0x3eaa66[_0x88b5('0x32')]:_0x57b7c6[_0x88b5('0x2d')];if(_0x2b73a7[_0x88b5('0x2e')][_0x88b5('0x3e')]){_0x3eaa66[_0x88b5('0x3f')]=[{'all':!![]}];}_0x3eaa66=_[_0x88b5('0x3a')]({},_0x3eaa66,_0x2b73a7[_0x88b5('0x3d')]);return db[_0x88b5('0x29')][_0x88b5('0x45')](_0x3eaa66)['then'](handleEntityNotFound(_0x45c9fe,null))[_0x88b5('0x20')](respondWithResult(_0x45c9fe,null))['catch'](handleError(_0x45c9fe,null));};exports[_0x88b5('0x46')]=function(_0x45e641,_0x53bd11){return db['VoiceAgentReport'][_0x88b5('0x46')](_0x45e641[_0x88b5('0x47')],{})['then'](respondWithResult(_0x53bd11,0xc9))[_0x88b5('0x41')](handleError(_0x53bd11,null));};exports[_0x88b5('0x1f')]=function(_0x4e8869,_0x1691ad){if(_0x4e8869['body']['id']){delete _0x4e8869[_0x88b5('0x47')]['id'];}return db['VoiceAgentReport'][_0x88b5('0x45')]({'where':{'id':_0x4e8869[_0x88b5('0x48')]['id']}})['then'](handleEntityNotFound(_0x1691ad,null))[_0x88b5('0x20')](saveUpdates(_0x4e8869[_0x88b5('0x47')],null))[_0x88b5('0x20')](respondWithResult(_0x1691ad,null))['catch'](handleError(_0x1691ad,null));};exports[_0x88b5('0x21')]=function(_0x53ce9b,_0x2148a0){return db[_0x88b5('0x29')][_0x88b5('0x45')]({'where':{'id':_0x53ce9b[_0x88b5('0x48')]['id']}})[_0x88b5('0x20')](handleEntityNotFound(_0x2148a0,null))[_0x88b5('0x20')](removeEntity(_0x2148a0,null))[_0x88b5('0x41')](handleError(_0x2148a0,null));};exports[_0x88b5('0x49')]=function(_0x24e2ab,_0x2811b){return db[_0x88b5('0x29')][_0x88b5('0x49')]()['then'](respondWithResult(_0x2811b,null))[_0x88b5('0x41')](handleError(_0x2811b,null));}; \ No newline at end of file +var _0x124c=['end','error','stack','name','send','map','VoiceAgentReport','rawAttributes','model','query','keys','intersection','attributes','hasOwnProperty','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','fields','length','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x124c,0xb8));var _0xc124=function(_0x3d8fc9,_0x5c0a68){_0x3d8fc9=_0x3d8fc9-0x0;var _0x5d61cd=_0x124c[_0x3d8fc9];return _0x5d61cd;};'use strict';var pdf=require(_0xc124('0x0'));var emlformat=require(_0xc124('0x1'));var rimraf=require(_0xc124('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc124('0x3'));var rp=require(_0xc124('0x4'));var moment=require(_0xc124('0x5'));var BPromise=require(_0xc124('0x6'));var Mustache=require(_0xc124('0x7'));var util=require(_0xc124('0x8'));var path=require(_0xc124('0x9'));var sox=require(_0xc124('0xa'));var csv=require(_0xc124('0xb'));var ejs=require(_0xc124('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc124('0xd'));var jsforce=require(_0xc124('0xe'));var deskjs=require(_0xc124('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc124('0x10'));var Papa=require(_0xc124('0x11'));var Redis=require(_0xc124('0x12'));var authService=require(_0xc124('0x13'));var qs=require(_0xc124('0x14'));var as=require(_0xc124('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc124('0x16'))('api');var utils=require(_0xc124('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc124('0x18'));var db=require(_0xc124('0x19'))['db'];function respondWithStatusCode(_0x751cf3,_0x3135e9){_0x3135e9=_0x3135e9||0xcc;return function(_0x1b4ef5){if(_0x1b4ef5){return _0x751cf3[_0xc124('0x1a')](_0x3135e9);}return _0x751cf3[_0xc124('0x1b')](_0x3135e9)['end']();};}function respondWithResult(_0x27b9ba,_0x385a87){_0x385a87=_0x385a87||0xc8;return function(_0x534499){if(_0x534499){return _0x27b9ba[_0xc124('0x1b')](_0x385a87)[_0xc124('0x1c')](_0x534499);}};}function respondWithFilteredResult(_0x96289b,_0x3f7b80){return function(_0x31c8d4){if(_0x31c8d4){var _0x2cac31=_0x31c8d4[_0xc124('0x1d')],_0x5b1f2f=_0x3f7b80[_0xc124('0x1e')],_0x4cb2ef=_0x3f7b80[_0xc124('0x1e')]+_0x3f7b80['limit'],_0x1ea5fe;if(_0x4cb2ef>=_0x2cac31){_0x4cb2ef=_0x2cac31;_0x1ea5fe=0xc8;}else{_0x1ea5fe=0xce;}_0x96289b['status'](_0x1ea5fe);return _0x96289b[_0xc124('0x1f')](_0xc124('0x20'),_0x5b1f2f+'-'+_0x4cb2ef+'/'+_0x2cac31)['json'](_0x31c8d4);}return null;};}function patchUpdates(_0x2e420c){return function(_0x315315){try{jsonpatch[_0xc124('0x21')](_0x315315,_0x2e420c,!![]);}catch(_0x5eb03c){return BPromise[_0xc124('0x22')](_0x5eb03c);}return _0x315315['save']();};}function saveUpdates(_0x4994fa,_0x4d55b9){return function(_0x55fbb9){if(_0x55fbb9){return _0x55fbb9[_0xc124('0x23')](_0x4994fa)['then'](function(_0x1eeef3){return _0x1eeef3;});}return null;};}function removeEntity(_0x541377,_0x584073){return function(_0x4dc5a8){if(_0x4dc5a8){return _0x4dc5a8[_0xc124('0x24')]()[_0xc124('0x25')](function(){_0x541377['status'](0xcc)[_0xc124('0x26')]();});}};}function handleEntityNotFound(_0xf54abf,_0x482f60){return function(_0x200b6c){if(!_0x200b6c){_0xf54abf[_0xc124('0x1a')](0x194);}return _0x200b6c;};}function handleError(_0x27ba4d,_0x9b3648){_0x9b3648=_0x9b3648||0x1f4;return function(_0x22d146){logger[_0xc124('0x27')](_0x22d146[_0xc124('0x28')]);if(_0x22d146[_0xc124('0x29')]){delete _0x22d146[_0xc124('0x29')];}_0x27ba4d[_0xc124('0x1b')](_0x9b3648)[_0xc124('0x2a')](_0x22d146);};}exports['index']=function(_0x236342,_0x55a047){var _0x482e04={},_0x21af33={},_0x73598a={'count':0x0,'rows':[]};var _0x83596=_[_0xc124('0x2b')](db[_0xc124('0x2c')][_0xc124('0x2d')],function(_0x4d7a2e){return{'name':_0x4d7a2e['fieldName'],'type':_0x4d7a2e['type']['key']};});_0x21af33[_0xc124('0x2e')]=_[_0xc124('0x2b')](_0x83596,_0xc124('0x29'));_0x21af33[_0xc124('0x2f')]=_[_0xc124('0x30')](_0x236342['query']);_0x21af33['filters']=_[_0xc124('0x31')](_0x21af33[_0xc124('0x2e')],_0x21af33['query']);_0x482e04['attributes']=_[_0xc124('0x31')](_0x21af33[_0xc124('0x2e')],qs['fields'](_0x236342[_0xc124('0x2f')]['fields']));_0x482e04[_0xc124('0x32')]=_0x482e04['attributes']['length']?_0x482e04['attributes']:_0x21af33[_0xc124('0x2e')];if(!_0x236342['query'][_0xc124('0x33')]('nolimit')){_0x482e04[_0xc124('0x34')]=qs[_0xc124('0x34')](_0x236342[_0xc124('0x2f')][_0xc124('0x34')]);_0x482e04[_0xc124('0x1e')]=qs['offset'](_0x236342[_0xc124('0x2f')][_0xc124('0x1e')]);}_0x482e04['order']=qs[_0xc124('0x35')](_0x236342[_0xc124('0x2f')][_0xc124('0x35')]);_0x482e04[_0xc124('0x36')]=qs[_0xc124('0x37')](_[_0xc124('0x38')](_0x236342[_0xc124('0x2f')],_0x21af33[_0xc124('0x37')]),_0x83596);if(_0x236342[_0xc124('0x2f')][_0xc124('0x39')]){_0x482e04['where']=_['merge'](_0x482e04[_0xc124('0x36')],{'$or':_[_0xc124('0x2b')](_0x83596,function(_0x266503){if(_0x266503['type']!==_0xc124('0x3a')){var _0x1c5b43={};_0x1c5b43[_0x266503['name']]={'$like':'%'+_0x236342[_0xc124('0x2f')][_0xc124('0x39')]+'%'};return _0x1c5b43;}})});}_0x482e04=_[_0xc124('0x3b')]({},_0x482e04,_0x236342[_0xc124('0x3c')]);var _0x394ab8={'where':_0x482e04[_0xc124('0x36')]};return db[_0xc124('0x2c')][_0xc124('0x1d')](_0x394ab8)['then'](function(_0x4dac43){_0x73598a['count']=_0x4dac43;if(_0x236342[_0xc124('0x2f')][_0xc124('0x3d')]){_0x482e04[_0xc124('0x3e')]=[{'all':!![]}];}return db[_0xc124('0x2c')][_0xc124('0x3f')](_0x482e04);})[_0xc124('0x25')](function(_0x51ed5b){_0x73598a[_0xc124('0x40')]=_0x51ed5b;return _0x73598a;})[_0xc124('0x25')](respondWithFilteredResult(_0x55a047,_0x482e04))['catch'](handleError(_0x55a047,null));};exports[_0xc124('0x41')]=function(_0x457d4f,_0x490a4e){var _0x919d75={'raw':![],'where':{'id':_0x457d4f['params']['id']}},_0x11cc1f={};_0x11cc1f['model']=_[_0xc124('0x30')](db['VoiceAgentReport']['rawAttributes']);_0x11cc1f[_0xc124('0x2f')]=_[_0xc124('0x30')](_0x457d4f['query']);_0x11cc1f[_0xc124('0x37')]=_[_0xc124('0x31')](_0x11cc1f['model'],_0x11cc1f[_0xc124('0x2f')]);_0x919d75[_0xc124('0x32')]=_['intersection'](_0x11cc1f[_0xc124('0x2e')],qs[_0xc124('0x42')](_0x457d4f[_0xc124('0x2f')][_0xc124('0x42')]));_0x919d75[_0xc124('0x32')]=_0x919d75[_0xc124('0x32')][_0xc124('0x43')]?_0x919d75[_0xc124('0x32')]:_0x11cc1f['model'];if(_0x457d4f[_0xc124('0x2f')][_0xc124('0x3d')]){_0x919d75[_0xc124('0x3e')]=[{'all':!![]}];}_0x919d75=_['merge']({},_0x919d75,_0x457d4f[_0xc124('0x3c')]);return db[_0xc124('0x2c')][_0xc124('0x44')](_0x919d75)[_0xc124('0x25')](handleEntityNotFound(_0x490a4e,null))[_0xc124('0x25')](respondWithResult(_0x490a4e,null))[_0xc124('0x45')](handleError(_0x490a4e,null));};exports[_0xc124('0x46')]=function(_0x3312d6,_0x4bc790){return db[_0xc124('0x2c')]['create'](_0x3312d6[_0xc124('0x47')],{})['then'](respondWithResult(_0x4bc790,0xc9))['catch'](handleError(_0x4bc790,null));};exports['update']=function(_0x6564f5,_0x598d36){if(_0x6564f5[_0xc124('0x47')]['id']){delete _0x6564f5[_0xc124('0x47')]['id'];}return db[_0xc124('0x2c')][_0xc124('0x44')]({'where':{'id':_0x6564f5[_0xc124('0x48')]['id']}})[_0xc124('0x25')](handleEntityNotFound(_0x598d36,null))[_0xc124('0x25')](saveUpdates(_0x6564f5['body'],null))[_0xc124('0x25')](respondWithResult(_0x598d36,null))[_0xc124('0x45')](handleError(_0x598d36,null));};exports[_0xc124('0x24')]=function(_0x1a9434,_0x480c48){return db[_0xc124('0x2c')][_0xc124('0x44')]({'where':{'id':_0x1a9434[_0xc124('0x48')]['id']}})['then'](handleEntityNotFound(_0x480c48,null))[_0xc124('0x25')](removeEntity(_0x480c48,null))['catch'](handleError(_0x480c48,null));};exports[_0xc124('0x49')]=function(_0x2e5485,_0x389d95){return db['VoiceAgentReport']['describe']()[_0xc124('0x25')](respondWithResult(_0x389d95,null))[_0xc124('0x45')](handleError(_0x389d95,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index ff28262..1eb2d78 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 _0xcf3c=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','destuniqueid','lodash','../../config/logger','moment'];(function(_0x11ff55,_0x313baf){var _0x25afdd=function(_0x386058){while(--_0x386058){_0x11ff55['push'](_0x11ff55['shift']());}};_0x25afdd(++_0x313baf);}(_0xcf3c,0x168));var _0xccf3=function(_0x394d8b,_0x365fa2){_0x394d8b=_0x394d8b-0x0;var _0x172da4=_0xcf3c[_0x394d8b];return _0x172da4;};'use strict';var _=require(_0xccf3('0x0'));var util=require('util');var logger=require(_0xccf3('0x1'))('api');var moment=require(_0xccf3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xccf3('0x3'));var rimraf=require(_0xccf3('0x4'));var config=require(_0xccf3('0x5'));var attributes=require(_0xccf3('0x6'));module[_0xccf3('0x7')]=function(_0x29c751,_0x282b6e){return _0x29c751[_0xccf3('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xccf3('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xccf3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88fa=['request-promise','path','../../config/environment','exports','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x88fa,0x19f));var _0xa88f=function(_0x44766f,_0x2d31ae){_0x44766f=_0x44766f-0x0;var _0x227d88=_0x88fa[_0x44766f];return _0x227d88;};'use strict';var _=require(_0xa88f('0x0'));var util=require(_0xa88f('0x1'));var logger=require(_0xa88f('0x2'))(_0xa88f('0x3'));var moment=require(_0xa88f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa88f('0x5'));var fs=require('fs');var path=require(_0xa88f('0x6'));var rimraf=require('rimraf');var config=require(_0xa88f('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0xa88f('0x8')]=function(_0x259f67,_0x253405){return _0x259f67['define'](_0xa88f('0x9'),attributes,{'tableName':_0xa88f('0xa'),'paranoid':![],'indexes':[{'fields':[_0xa88f('0xb'),'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 9c0a041..9e12620 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 _0x5655=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','UpdateVoiceAgentReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5655,0x82));var _0x5565=function(_0x309af6,_0x38b21e){_0x309af6=_0x309af6-0x0;var _0x104daa=_0x5655[_0x309af6];return _0x104daa;};'use strict';var _=require('lodash');var util=require(_0x5565('0x0'));var moment=require(_0x5565('0x1'));var BPromise=require(_0x5565('0x2'));var rs=require(_0x5565('0x3'));var fs=require('fs');var Redis=require(_0x5565('0x4'));var db=require(_0x5565('0x5'))['db'];var utils=require(_0x5565('0x6'));var logger=require('../../config/logger')(_0x5565('0x7'));var config=require(_0x5565('0x8'));var jayson=require(_0x5565('0x9'));var client=jayson[_0x5565('0xa')][_0x5565('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb23,_0x4169bc,_0x52546a){return new BPromise(function(_0x35ef77,_0x4bd9f9){return client[_0x5565('0xc')](_0x4eeb23,_0x52546a)[_0x5565('0xd')](function(_0x1ef82c){logger[_0x5565('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4169bc,_0x5565('0xf'));logger[_0x5565('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4169bc,_0x5565('0xf'),JSON['stringify'](_0x1ef82c));if(_0x1ef82c[_0x5565('0x11')]){if(_0x1ef82c[_0x5565('0x11')][_0x5565('0x12')]===0x1f4){logger[_0x5565('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x4169bc,_0x1ef82c[_0x5565('0x11')][_0x5565('0x13')]);return _0x4bd9f9(_0x1ef82c[_0x5565('0x11')][_0x5565('0x13')]);}logger[_0x5565('0x11')](_0x5565('0x14'),_0x4169bc,_0x1ef82c['error']['message']);return _0x35ef77(_0x1ef82c[_0x5565('0x11')][_0x5565('0x13')]);}else{logger[_0x5565('0xe')](_0x5565('0x14'),_0x4169bc,_0x5565('0xf'));_0x35ef77(_0x1ef82c[_0x5565('0x15')][_0x5565('0x13')]);}})[_0x5565('0x16')](function(_0x3230ca){logger[_0x5565('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x4169bc,_0x3230ca);_0x4bd9f9(_0x3230ca);});});}exports[_0x5565('0x17')]=function(_0x473f63){var _0x3a1a3a=this;return new Promise(function(_0x575cd5,_0x2b81fb){return db[_0x5565('0x18')][_0x5565('0x19')](_0x473f63[_0x5565('0x1a')],{'raw':_0x473f63[_0x5565('0x1b')]?_0x473f63[_0x5565('0x1b')][_0x5565('0x1c')]===undefined?!![]:![]:!![]})[_0x5565('0xd')](function(_0x2b54f2){logger[_0x5565('0xe')](_0x5565('0x17'),_0x473f63);logger[_0x5565('0x10')](_0x5565('0x17'),_0x473f63,JSON[_0x5565('0x1d')](_0x2b54f2));_0x575cd5(_0x2b54f2);})[_0x5565('0x16')](function(_0x313190){logger[_0x5565('0x11')](_0x5565('0x17'),_0x313190[_0x5565('0x13')],_0x473f63);_0x2b81fb(_0x3a1a3a[_0x5565('0x11')](0x1f4,_0x313190[_0x5565('0x13')]));});});};exports[_0x5565('0x1e')]=function(_0xcf9ecb){var _0x5dee86=this;return new Promise(function(_0x24d67f,_0x5615e9){return db[_0x5565('0x18')]['update'](_0xcf9ecb[_0x5565('0x1a')],{'raw':_0xcf9ecb['options']?_0xcf9ecb['options'][_0x5565('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf9ecb[_0x5565('0x1b')]?_0xcf9ecb[_0x5565('0x1b')][_0x5565('0x1f')]||null:null,'attributes':_0xcf9ecb[_0x5565('0x1b')]?_0xcf9ecb[_0x5565('0x1b')][_0x5565('0x20')]||null:null,'limit':_0xcf9ecb[_0x5565('0x1b')]?_0xcf9ecb[_0x5565('0x1b')][_0x5565('0x21')]||null:null})[_0x5565('0xd')](function(_0x56ca8f){logger[_0x5565('0xe')](_0x5565('0x1e'),_0xcf9ecb);logger['debug'](_0x5565('0x1e'),_0xcf9ecb,JSON['stringify'](_0x56ca8f));_0x24d67f(_0x56ca8f);})[_0x5565('0x16')](function(_0x3fba4a){logger[_0x5565('0x11')]('UpdateVoiceAgentReport',_0x3fba4a[_0x5565('0x13')],_0xcf9ecb);_0x5615e9(_0x5dee86[_0x5565('0x11')](0x1f4,_0x3fba4a['message']));});});}; \ No newline at end of file +var _0xca68=['catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','UpdateVoiceAgentReport','update','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5e2239,_0x1a9da4){var _0x29da0e=function(_0x44450){while(--_0x44450){_0x5e2239['push'](_0x5e2239['shift']());}};_0x29da0e(++_0x1a9da4);}(_0xca68,0x134));var _0x8ca6=function(_0x725803,_0x5aefc0){_0x725803=_0x725803-0x0;var _0x4660f8=_0xca68[_0x725803];return _0x4660f8;};'use strict';var _=require(_0x8ca6('0x0'));var util=require(_0x8ca6('0x1'));var moment=require(_0x8ca6('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ca6('0x3'));var fs=require('fs');var Redis=require(_0x8ca6('0x4'));var db=require(_0x8ca6('0x5'))['db'];var utils=require(_0x8ca6('0x6'));var logger=require(_0x8ca6('0x7'))('rpc');var config=require(_0x8ca6('0x8'));var jayson=require(_0x8ca6('0x9'));var client=jayson[_0x8ca6('0xa')][_0x8ca6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b607b,_0x1034cf,_0x15f891){return new BPromise(function(_0x4968de,_0x3da801){return client['request'](_0x5b607b,_0x15f891)[_0x8ca6('0xc')](function(_0x32c128){logger[_0x8ca6('0xd')](_0x8ca6('0xe'),_0x1034cf,_0x8ca6('0xf'));logger['debug'](_0x8ca6('0x10'),_0x1034cf,_0x8ca6('0xf'),JSON[_0x8ca6('0x11')](_0x32c128));if(_0x32c128[_0x8ca6('0x12')]){if(_0x32c128['error'][_0x8ca6('0x13')]===0x1f4){logger[_0x8ca6('0x12')](_0x8ca6('0xe'),_0x1034cf,_0x32c128[_0x8ca6('0x12')]['message']);return _0x3da801(_0x32c128[_0x8ca6('0x12')]['message']);}logger[_0x8ca6('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x1034cf,_0x32c128[_0x8ca6('0x12')][_0x8ca6('0x14')]);return _0x4968de(_0x32c128[_0x8ca6('0x12')]['message']);}else{logger[_0x8ca6('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1034cf,_0x8ca6('0xf'));_0x4968de(_0x32c128[_0x8ca6('0x15')]['message']);}})[_0x8ca6('0x16')](function(_0x566d10){logger[_0x8ca6('0x12')](_0x8ca6('0xe'),_0x1034cf,_0x566d10);_0x3da801(_0x566d10);});});}exports[_0x8ca6('0x17')]=function(_0x2ca650){var _0x25c101=this;return new Promise(function(_0x1cc2ac,_0x5bfca9){return db[_0x8ca6('0x18')][_0x8ca6('0x19')](_0x2ca650[_0x8ca6('0x1a')],{'raw':_0x2ca650['options']?_0x2ca650[_0x8ca6('0x1b')][_0x8ca6('0x1c')]===undefined?!![]:![]:!![]})[_0x8ca6('0xc')](function(_0xa37571){logger[_0x8ca6('0xd')](_0x8ca6('0x17'),_0x2ca650);logger[_0x8ca6('0x1d')](_0x8ca6('0x17'),_0x2ca650,JSON[_0x8ca6('0x11')](_0xa37571));_0x1cc2ac(_0xa37571);})[_0x8ca6('0x16')](function(_0x171240){logger[_0x8ca6('0x12')]('CreateVoiceAgentReport',_0x171240[_0x8ca6('0x14')],_0x2ca650);_0x5bfca9(_0x25c101['error'](0x1f4,_0x171240[_0x8ca6('0x14')]));});});};exports[_0x8ca6('0x1e')]=function(_0x57db89){var _0x21b63d=this;return new Promise(function(_0x1624ec,_0x2a6ed5){return db[_0x8ca6('0x18')][_0x8ca6('0x1f')](_0x57db89[_0x8ca6('0x1a')],{'raw':_0x57db89[_0x8ca6('0x1b')]?_0x57db89[_0x8ca6('0x1b')][_0x8ca6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57db89[_0x8ca6('0x1b')]?_0x57db89[_0x8ca6('0x1b')][_0x8ca6('0x20')]||null:null,'attributes':_0x57db89[_0x8ca6('0x1b')]?_0x57db89['options']['attributes']||null:null,'limit':_0x57db89['options']?_0x57db89[_0x8ca6('0x1b')]['limit']||null:null})[_0x8ca6('0xc')](function(_0x253ad1){logger['info'](_0x8ca6('0x1e'),_0x57db89);logger['debug'](_0x8ca6('0x1e'),_0x57db89,JSON[_0x8ca6('0x11')](_0x253ad1));_0x1624ec(_0x253ad1);})[_0x8ca6('0x16')](function(_0x487c78){logger[_0x8ca6('0x12')]('UpdateVoiceAgentReport',_0x487c78[_0x8ca6('0x14')],_0x57db89);_0x2a6ed5(_0x21b63d['error'](0x1f4,_0x487c78[_0x8ca6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a1ab1b8..4d79fb1 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 _0x7538=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7538,0x78));var _0x8753=function(_0x1bb536,_0x23501c){_0x1bb536=_0x1bb536-0x0;var _0x12e57b=_0x7538[_0x1bb536];return _0x12e57b;};'use strict';var multer=require(_0x8753('0x0'));var util=require(_0x8753('0x1'));var path=require('path');var timeout=require(_0x8753('0x2'));var express=require(_0x8753('0x3'));var router=express[_0x8753('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8753('0x5'));var config=require(_0x8753('0x6'));var controller=require('./voiceCallReport.controller');router[_0x8753('0x7')]('/',auth[_0x8753('0x8')](),controller['index']);router[_0x8753('0x7')](_0x8753('0x9'),auth[_0x8753('0x8')](),controller['describe']);router[_0x8753('0x7')](_0x8753('0xa'),auth[_0x8753('0x8')](),controller[_0x8753('0xb')]);router[_0x8753('0xc')]('/',auth[_0x8753('0x8')](),controller[_0x8753('0xd')]);router[_0x8753('0xe')](_0x8753('0xa'),auth['isAuthenticated'](),controller[_0x8753('0xf')]);router[_0x8753('0x10')](_0x8753('0xa'),auth['isAuthenticated'](),controller[_0x8753('0x11')]);module[_0x8753('0x12')]=router; \ No newline at end of file +var _0x3624=['path','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xbdcecc,_0x3665b1){var _0x34f097=function(_0x530239){while(--_0x530239){_0xbdcecc['push'](_0xbdcecc['shift']());}};_0x34f097(++_0x3665b1);}(_0x3624,0x17a));var _0x4362=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x3624[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x4362('0x0'));var util=require(_0x4362('0x1'));var path=require(_0x4362('0x2'));var timeout=require('connect-timeout');var express=require(_0x4362('0x3'));var router=express[_0x4362('0x4')]();var auth=require(_0x4362('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0x4362('0x6')]('/',auth[_0x4362('0x7')](),controller[_0x4362('0x8')]);router[_0x4362('0x6')](_0x4362('0x9'),auth[_0x4362('0x7')](),controller[_0x4362('0xa')]);router[_0x4362('0x6')](_0x4362('0xb'),auth[_0x4362('0x7')](),controller[_0x4362('0xc')]);router[_0x4362('0xd')]('/',auth['isAuthenticated'](),controller[_0x4362('0xe')]);router[_0x4362('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4362('0x10')]);router[_0x4362('0x11')](_0x4362('0xb'),auth[_0x4362('0x7')](),controller[_0x4362('0x12')]);module[_0x4362('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index bbbeb64..2e67c9c 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 _0x6aa7=['DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x2d0f8a,_0x286053){var _0x8bcfb4=function(_0x369e1b){while(--_0x369e1b){_0x2d0f8a['push'](_0x2d0f8a['shift']());}};_0x8bcfb4(++_0x286053);}(_0x6aa7,0x178));var _0x76aa=function(_0x2bfe09,_0x47309d){_0x2bfe09=_0x2bfe09-0x0;var _0x39dae4=_0x6aa7[_0x2bfe09];return _0x39dae4;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'type':{'type':Sequelize[_0x76aa('0x2')](_0x76aa('0x3'),_0x76aa('0x4'),'outbound',_0x76aa('0x5'),_0x76aa('0x6'),_0x76aa('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x76aa('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x76aa('0x1')]},'lastdata':{'type':Sequelize[_0x76aa('0x8')]},'starttime':{'type':Sequelize[_0x76aa('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x76aa('0x9')]},'endtime':{'type':Sequelize[_0x76aa('0x9')]},'duration':{'type':Sequelize[_0x76aa('0xa')]},'billableseconds':{'type':Sequelize[_0x76aa('0xa')]},'mohtime':{'type':Sequelize[_0x76aa('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x76aa('0x1')]},'amaflags':{'type':Sequelize[_0x76aa('0x1')]},'userfield':{'type':Sequelize[_0x76aa('0x1')]},'userDisposition':{'type':Sequelize[_0x76aa('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x76aa('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x76aa('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x76aa('0xa')]},'sipcallid':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0xeff8=['outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','inbound-fax'];(function(_0x365eef,_0x12bf9c){var _0x42960d=function(_0x2a65f0){while(--_0x2a65f0){_0x365eef['push'](_0x365eef['shift']());}};_0x42960d(++_0x12bf9c);}(_0xeff8,0x186));var _0x8eff=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xeff8[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8eff('0x2')](_0x8eff('0x3'),_0x8eff('0x4'),'outbound',_0x8eff('0x5'),_0x8eff('0x6'),_0x8eff('0x7'))},'tag':{'type':Sequelize[_0x8eff('0x8')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x8eff('0x8')]},'destination':{'type':Sequelize[_0x8eff('0x8')]},'destinationcontext':{'type':Sequelize[_0x8eff('0x8')]},'callerid':{'type':Sequelize[_0x8eff('0x8')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x8eff('0x8')]},'lastapplication':{'type':Sequelize[_0x8eff('0x8')]},'lastdata':{'type':Sequelize[_0x8eff('0x9')]},'starttime':{'type':Sequelize[_0x8eff('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8eff('0xa')]},'duration':{'type':Sequelize[_0x8eff('0xb')]},'billableseconds':{'type':Sequelize[_0x8eff('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8eff('0x8')]},'amaflags':{'type':Sequelize[_0x8eff('0x8')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x8eff('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x8eff('0x8')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x8eff('0x8')]},'routeid':{'type':Sequelize[_0x8eff('0xb')]},'sipcallid':{'type':Sequelize[_0x8eff('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8eb81f5..e49b681 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_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 d1fd6e9..aab807b 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 _0x7254=['bluebird','path','rimraf','../../config/environment','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x7254,0x6b));var _0x4725=function(_0x3857f8,_0x58417b){_0x3857f8=_0x3857f8-0x0;var _0x2c51ea=_0x7254[_0x3857f8];return _0x2c51ea;};'use strict';var _=require('lodash');var util=require(_0x4725('0x0'));var logger=require(_0x4725('0x1'))(_0x4725('0x2'));var moment=require('moment');var BPromise=require(_0x4725('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4725('0x4'));var rimraf=require(_0x4725('0x5'));var config=require(_0x4725('0x6'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x26c202,_0x59c7be){return _0x26c202['define'](_0x4725('0x7'),attributes,{'tableName':_0x4725('0x8'),'paranoid':![],'indexes':[{'fields':[_0x4725('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb946=['define','VoiceCallReport','report_call','uniqueid','util','api','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xb946,0x1c7));var _0x6b94=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xb946[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require(_0x6b94('0x0'));var logger=require('../../config/logger')(_0x6b94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b94('0x2'));var rimraf=require(_0x6b94('0x3'));var config=require(_0x6b94('0x4'));var attributes=require(_0x6b94('0x5'));module[_0x6b94('0x6')]=function(_0x5d155a,_0x612137){return _0x5d155a[_0x6b94('0x7')](_0x6b94('0x8'),attributes,{'tableName':_0x6b94('0x9'),'paranoid':![],'indexes':[{'fields':[_0x6b94('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 1f2144f..567182a 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 _0xb118=['VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','map','model','include','debug','CreateVoiceCallReport','VoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0xb118,0xce));var _0x8b11=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0xb118[_0x24693e];return _0x53e672;};'use strict';var _=require(_0x8b11('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b11('0x1'));var fs=require('fs');var Redis=require(_0x8b11('0x2'));var db=require(_0x8b11('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8b11('0x4'));var config=require(_0x8b11('0x5'));var jayson=require(_0x8b11('0x6'));var client=jayson['client'][_0x8b11('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d7ba1,_0x3a285c,_0x489882){return new BPromise(function(_0x3927f1,_0x5ca678){return client['request'](_0x1d7ba1,_0x489882)[_0x8b11('0x8')](function(_0x1bc55f){logger[_0x8b11('0x9')](_0x8b11('0xa'),_0x3a285c,'request\x20sent');logger['debug'](_0x8b11('0xb'),_0x3a285c,_0x8b11('0xc'),JSON[_0x8b11('0xd')](_0x1bc55f));if(_0x1bc55f[_0x8b11('0xe')]){if(_0x1bc55f[_0x8b11('0xe')][_0x8b11('0xf')]===0x1f4){logger['error'](_0x8b11('0xa'),_0x3a285c,_0x1bc55f['error'][_0x8b11('0x10')]);return _0x5ca678(_0x1bc55f['error'][_0x8b11('0x10')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3a285c,_0x1bc55f[_0x8b11('0xe')][_0x8b11('0x10')]);return _0x3927f1(_0x1bc55f[_0x8b11('0xe')][_0x8b11('0x10')]);}else{logger[_0x8b11('0x9')](_0x8b11('0xa'),_0x3a285c,_0x8b11('0xc'));_0x3927f1(_0x1bc55f[_0x8b11('0x11')][_0x8b11('0x10')]);}})[_0x8b11('0x12')](function(_0x5db860){logger[_0x8b11('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x3a285c,_0x5db860);_0x5ca678(_0x5db860);});});}exports[_0x8b11('0x13')]=function(_0x1d88ea){var _0x1f3f16=this;return new Promise(function(_0x37eaf9,_0x3649c4){return db['VoiceCallReport'][_0x8b11('0x14')]({'raw':_0x1d88ea[_0x8b11('0x15')]?_0x1d88ea[_0x8b11('0x15')][_0x8b11('0x16')]===undefined?!![]:![]:!![],'where':_0x1d88ea['options']?_0x1d88ea[_0x8b11('0x15')][_0x8b11('0x17')]||null:null,'attributes':_0x1d88ea[_0x8b11('0x15')]?_0x1d88ea[_0x8b11('0x15')][_0x8b11('0x18')]||null:null,'limit':_0x1d88ea['options']?_0x1d88ea['options'][_0x8b11('0x19')]||null:null,'include':_0x1d88ea[_0x8b11('0x15')]?_0x1d88ea[_0x8b11('0x15')]['include']?_[_0x8b11('0x1a')](_0x1d88ea[_0x8b11('0x15')]['include'],function(_0x247b7c){return{'model':db[_0x247b7c[_0x8b11('0x1b')]],'as':_0x247b7c['as'],'attributes':_0x247b7c[_0x8b11('0x18')],'include':_0x247b7c['include']?_['map'](_0x247b7c[_0x8b11('0x1c')],function(_0x4de9c2){return{'model':db[_0x4de9c2[_0x8b11('0x1b')]],'as':_0x4de9c2['as'],'attributes':_0x4de9c2[_0x8b11('0x18')],'include':_0x4de9c2[_0x8b11('0x1c')]?_[_0x8b11('0x1a')](_0x4de9c2[_0x8b11('0x1c')],function(_0x31b352){return{'model':db[_0x31b352['model']],'as':_0x31b352['as'],'attributes':_0x31b352['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b11('0x8')](function(_0x29a233){logger[_0x8b11('0x9')](_0x8b11('0x13'),_0x1d88ea);logger[_0x8b11('0x1d')](_0x8b11('0x13'),_0x1d88ea,JSON['stringify'](_0x29a233));_0x37eaf9(_0x29a233);})[_0x8b11('0x12')](function(_0x330c0b){logger['error']('GetVoiceCallReport',_0x330c0b['message'],_0x1d88ea);_0x3649c4(_0x1f3f16[_0x8b11('0xe')](0x1f4,_0x330c0b[_0x8b11('0x10')]));});});};exports[_0x8b11('0x1e')]=function(_0x566291){var _0x26bba6=this;return new Promise(function(_0x1b8361,_0x41f301){return db[_0x8b11('0x1f')][_0x8b11('0x20')](_0x566291['body'],{'raw':_0x566291[_0x8b11('0x15')]?_0x566291[_0x8b11('0x15')][_0x8b11('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x58d504){logger[_0x8b11('0x9')](_0x8b11('0x1e'),_0x566291);logger[_0x8b11('0x1d')](_0x8b11('0x1e'),_0x566291,JSON[_0x8b11('0xd')](_0x58d504));_0x1b8361(_0x58d504);})['catch'](function(_0x5ea5dd){logger[_0x8b11('0xe')](_0x8b11('0x1e'),_0x5ea5dd[_0x8b11('0x10')],_0x566291);_0x41f301(_0x26bba6[_0x8b11('0xe')](0x1f4,_0x5ea5dd[_0x8b11('0x10')]));});});};exports['UpdateVoiceCallReport']=function(_0x3b880f){var _0x6cee19=this;return new Promise(function(_0x53adff,_0x295d69){return db[_0x8b11('0x1f')][_0x8b11('0x21')](_0x3b880f[_0x8b11('0x22')],{'raw':_0x3b880f[_0x8b11('0x15')]?_0x3b880f[_0x8b11('0x15')][_0x8b11('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b880f[_0x8b11('0x15')]?_0x3b880f[_0x8b11('0x15')]['where']||null:null,'attributes':_0x3b880f[_0x8b11('0x15')]?_0x3b880f['options']['attributes']||null:null,'limit':_0x3b880f[_0x8b11('0x15')]?_0x3b880f[_0x8b11('0x15')]['limit']||null:null})[_0x8b11('0x8')](function(_0x414b7e){logger[_0x8b11('0x9')](_0x8b11('0x23'),_0x3b880f);logger[_0x8b11('0x1d')]('UpdateVoiceCallReport',_0x3b880f,JSON['stringify'](_0x414b7e));_0x53adff(_0x414b7e);})[_0x8b11('0x12')](function(_0x2b1558){logger['error'](_0x8b11('0x23'),_0x2b1558[_0x8b11('0x10')],_0x3b880f);_0x295d69(_0x6cee19[_0x8b11('0xe')](0x1f4,_0x2b1558[_0x8b11('0x10')]));});});}; \ No newline at end of file +var _0x666d=['where','limit','include','map','model','attributes','GetVoiceCallReport','debug','catch','CreateVoiceCallReport','info','UpdateVoiceCallReport','body','raw','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport','findAll','options'];(function(_0x695685,_0x2067b2){var _0x1b2090=function(_0x1325ba){while(--_0x1325ba){_0x695685['push'](_0x695685['shift']());}};_0x1b2090(++_0x2067b2);}(_0x666d,0x1bb));var _0xd666=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x666d[_0x368fb9];return _0x4892fb;};'use strict';var _=require('lodash');var util=require(_0xd666('0x0'));var moment=require(_0xd666('0x1'));var BPromise=require('bluebird');var rs=require(_0xd666('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd666('0x3'));var logger=require(_0xd666('0x4'))('rpc');var config=require(_0xd666('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd666('0x6')][_0xd666('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23591b,_0x37aaa1,_0x15453e){return new BPromise(function(_0x457ee9,_0x114aa5){return client['request'](_0x23591b,_0x15453e)[_0xd666('0x8')](function(_0x4b2fc4){logger['info'](_0xd666('0x9'),_0x37aaa1,_0xd666('0xa'));logger['debug'](_0xd666('0xb'),_0x37aaa1,_0xd666('0xa'),JSON[_0xd666('0xc')](_0x4b2fc4));if(_0x4b2fc4[_0xd666('0xd')]){if(_0x4b2fc4[_0xd666('0xd')][_0xd666('0xe')]===0x1f4){logger[_0xd666('0xd')](_0xd666('0x9'),_0x37aaa1,_0x4b2fc4['error'][_0xd666('0xf')]);return _0x114aa5(_0x4b2fc4[_0xd666('0xd')][_0xd666('0xf')]);}logger[_0xd666('0xd')](_0xd666('0x9'),_0x37aaa1,_0x4b2fc4['error'][_0xd666('0xf')]);return _0x457ee9(_0x4b2fc4[_0xd666('0xd')][_0xd666('0xf')]);}else{logger['info'](_0xd666('0x9'),_0x37aaa1,_0xd666('0xa'));_0x457ee9(_0x4b2fc4['result'][_0xd666('0xf')]);}})['catch'](function(_0x4057f0){logger[_0xd666('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x37aaa1,_0x4057f0);_0x114aa5(_0x4057f0);});});}exports['GetVoiceCallReport']=function(_0x416be6){var _0xbf0050=this;return new Promise(function(_0x5e3b79,_0x2def2d){return db[_0xd666('0x10')][_0xd666('0x11')]({'raw':_0x416be6[_0xd666('0x12')]?_0x416be6[_0xd666('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x416be6[_0xd666('0x12')]?_0x416be6[_0xd666('0x12')][_0xd666('0x13')]||null:null,'attributes':_0x416be6[_0xd666('0x12')]?_0x416be6[_0xd666('0x12')]['attributes']||null:null,'limit':_0x416be6['options']?_0x416be6[_0xd666('0x12')][_0xd666('0x14')]||null:null,'include':_0x416be6[_0xd666('0x12')]?_0x416be6[_0xd666('0x12')][_0xd666('0x15')]?_[_0xd666('0x16')](_0x416be6[_0xd666('0x12')][_0xd666('0x15')],function(_0x29251e){return{'model':db[_0x29251e[_0xd666('0x17')]],'as':_0x29251e['as'],'attributes':_0x29251e[_0xd666('0x18')],'include':_0x29251e[_0xd666('0x15')]?_[_0xd666('0x16')](_0x29251e['include'],function(_0x372f0e){return{'model':db[_0x372f0e[_0xd666('0x17')]],'as':_0x372f0e['as'],'attributes':_0x372f0e['attributes'],'include':_0x372f0e[_0xd666('0x15')]?_[_0xd666('0x16')](_0x372f0e['include'],function(_0x3101dd){return{'model':db[_0x3101dd[_0xd666('0x17')]],'as':_0x3101dd['as'],'attributes':_0x3101dd[_0xd666('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd666('0x8')](function(_0x2d6ed0){logger['info'](_0xd666('0x19'),_0x416be6);logger[_0xd666('0x1a')](_0xd666('0x19'),_0x416be6,JSON[_0xd666('0xc')](_0x2d6ed0));_0x5e3b79(_0x2d6ed0);})[_0xd666('0x1b')](function(_0x4904b1){logger[_0xd666('0xd')]('GetVoiceCallReport',_0x4904b1['message'],_0x416be6);_0x2def2d(_0xbf0050[_0xd666('0xd')](0x1f4,_0x4904b1['message']));});});};exports[_0xd666('0x1c')]=function(_0x41586b){var _0x70ccdc=this;return new Promise(function(_0x1f10f7,_0x2eebc2){return db[_0xd666('0x10')]['create'](_0x41586b['body'],{'raw':_0x41586b[_0xd666('0x12')]?_0x41586b['options']['raw']===undefined?!![]:![]:!![]})[_0xd666('0x8')](function(_0x18b444){logger[_0xd666('0x1d')](_0xd666('0x1c'),_0x41586b);logger[_0xd666('0x1a')]('CreateVoiceCallReport',_0x41586b,JSON[_0xd666('0xc')](_0x18b444));_0x1f10f7(_0x18b444);})[_0xd666('0x1b')](function(_0x2235cd){logger['error']('CreateVoiceCallReport',_0x2235cd[_0xd666('0xf')],_0x41586b);_0x2eebc2(_0x70ccdc[_0xd666('0xd')](0x1f4,_0x2235cd[_0xd666('0xf')]));});});};exports[_0xd666('0x1e')]=function(_0x19e20d){var _0x256d0d=this;return new Promise(function(_0x4d8c24,_0x285f1b){return db[_0xd666('0x10')]['update'](_0x19e20d[_0xd666('0x1f')],{'raw':_0x19e20d[_0xd666('0x12')]?_0x19e20d[_0xd666('0x12')][_0xd666('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19e20d[_0xd666('0x12')]?_0x19e20d[_0xd666('0x12')][_0xd666('0x13')]||null:null,'attributes':_0x19e20d[_0xd666('0x12')]?_0x19e20d[_0xd666('0x12')][_0xd666('0x18')]||null:null,'limit':_0x19e20d[_0xd666('0x12')]?_0x19e20d[_0xd666('0x12')][_0xd666('0x14')]||null:null})[_0xd666('0x8')](function(_0x3958c0){logger[_0xd666('0x1d')]('UpdateVoiceCallReport',_0x19e20d);logger[_0xd666('0x1a')]('UpdateVoiceCallReport',_0x19e20d,JSON[_0xd666('0xc')](_0x3958c0));_0x4d8c24(_0x3958c0);})[_0xd666('0x1b')](function(_0x1dc405){logger[_0xd666('0xd')](_0xd666('0x1e'),_0x1dc405[_0xd666('0xf')],_0x19e20d);_0x285f1b(_0x256d0d[_0xd666('0xd')](0x1f4,_0x1dc405[_0xd666('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c26e99d..3199160 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 _0xe9a6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xd3a0a0,_0x3bdab1){var _0x18846f=function(_0x2347e8){while(--_0x2347e8){_0xd3a0a0['push'](_0xd3a0a0['shift']());}};_0x18846f(++_0x3bdab1);}(_0xe9a6,0x64));var _0x6e9a=function(_0x2a6c77,_0x2e2a06){_0x2a6c77=_0x2a6c77-0x0;var _0x18b81a=_0xe9a6[_0x2a6c77];return _0x18b81a;};'use strict';var multer=require(_0x6e9a('0x0'));var util=require('util');var path=require(_0x6e9a('0x1'));var timeout=require(_0x6e9a('0x2'));var express=require(_0x6e9a('0x3'));var router=express[_0x6e9a('0x4')]();var auth=require(_0x6e9a('0x5'));var interaction=require(_0x6e9a('0x6'));var config=require(_0x6e9a('0x7'));var controller=require(_0x6e9a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e9a('0x9')]);router[_0x6e9a('0xa')](_0x6e9a('0xb'),auth['isAuthenticated'](),controller[_0x6e9a('0xc')]);router[_0x6e9a('0xd')]('/',auth[_0x6e9a('0xe')](),controller[_0x6e9a('0xf')]);router[_0x6e9a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6e9a('0x11')]);router[_0x6e9a('0x12')](_0x6e9a('0xb'),auth[_0x6e9a('0xe')](),controller[_0x6e9a('0x13')]);module[_0x6e9a('0x14')]=router; \ No newline at end of file +var _0xb8cd=['./voiceChanSpy.controller','get','isAuthenticated','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x262085,_0x2b670f){var _0x378d05=function(_0x2cc1e6){while(--_0x2cc1e6){_0x262085['push'](_0x262085['shift']());}};_0x378d05(++_0x2b670f);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x4b653c,_0x33bd95){_0x4b653c=_0x4b653c-0x0;var _0x33c6fa=_0xb8cd[_0x4b653c];return _0x33c6fa;};'use strict';var multer=require(_0xdb8c('0x0'));var util=require(_0xdb8c('0x1'));var path=require(_0xdb8c('0x2'));var timeout=require(_0xdb8c('0x3'));var express=require(_0xdb8c('0x4'));var router=express['Router']();var auth=require(_0xdb8c('0x5'));var interaction=require(_0xdb8c('0x6'));var config=require('../../config/environment');var controller=require(_0xdb8c('0x7'));router[_0xdb8c('0x8')]('/',auth[_0xdb8c('0x9')](),controller['index']);router[_0xdb8c('0x8')](_0xdb8c('0xa'),auth[_0xdb8c('0x9')](),controller[_0xdb8c('0xb')]);router['post']('/',auth[_0xdb8c('0x9')](),controller['create']);router[_0xdb8c('0xc')](_0xdb8c('0xa'),auth[_0xdb8c('0x9')](),controller['update']);router[_0xdb8c('0xd')]('/:id',auth[_0xdb8c('0x9')](),controller[_0xdb8c('0xe')]);module[_0xdb8c('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 41f531a..ba88fc7 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 _0xcc19=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xcc19,0x1ab));var _0x9cc1=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xcc19[_0x378b4];return _0x11d07b;};'use strict';var Sequelize=require(_0x9cc1('0x0'));module[_0x9cc1('0x1')]={'name':{'type':Sequelize[_0x9cc1('0x2')]},'prefix':{'type':Sequelize[_0x9cc1('0x2')],'unique':_0x9cc1('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x245488){this[_0x9cc1('0x4')]('options',_0x245488?_0x245488['join'](''):[]);},'get':function(){return this[_0x9cc1('0x5')]('options')?this[_0x9cc1('0x5')](_0x9cc1('0x6'))[_0x9cc1('0x7')](''):[];}},'auth':{'type':Sequelize[_0x9cc1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x9cc1('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9cc1('0x2')]},'description':{'type':Sequelize[_0x9cc1('0x2')]}}; \ No newline at end of file +var _0x424e=['split','BOOLEAN','sequelize','exports','STRING','name','getDataValue','options'];(function(_0x2fc960,_0x5219db){var _0x3072a7=function(_0x3f6730){while(--_0x3f6730){_0x2fc960['push'](_0x2fc960['shift']());}};_0x3072a7(++_0x5219db);}(_0x424e,0x13a));var _0xe424=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x424e[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0xe424('0x0'));module[_0xe424('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe424('0x2')],'unique':_0xe424('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe424('0x2')],'set':function(_0x55514e){this['setDataValue']('options',_0x55514e?_0x55514e['join'](''):[]);},'get':function(){return this[_0xe424('0x4')](_0xe424('0x5'))?this['getDataValue']('options')[_0xe424('0x6')](''):[];}},'auth':{'type':Sequelize[_0xe424('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe424('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index fcc0a52..bca1a4f 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 _0x7463=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','stack','name','send','map','VoiceChanSpy','rawAttributes','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies'];(function(_0x4a40ce,_0x396eba){var _0x1919f0=function(_0x443658){while(--_0x443658){_0x4a40ce['push'](_0x4a40ce['shift']());}};_0x1919f0(++_0x396eba);}(_0x7463,0x18d));var _0x3746=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x7463[_0xbc2974];return _0x3a5b4f;};'use strict';var pdf=require(_0x3746('0x0'));var emlformat=require(_0x3746('0x1'));var rimraf=require(_0x3746('0x2'));var zipdir=require(_0x3746('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3746('0x4'));var moment=require(_0x3746('0x5'));var BPromise=require(_0x3746('0x6'));var Mustache=require(_0x3746('0x7'));var util=require(_0x3746('0x8'));var path=require(_0x3746('0x9'));var sox=require(_0x3746('0xa'));var csv=require(_0x3746('0xb'));var ejs=require(_0x3746('0xc'));var fs=require('fs');var _=require(_0x3746('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3746('0xe'));var deskjs=require(_0x3746('0xf'));var toCsv=require(_0x3746('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3746('0x10'));var authService=require(_0x3746('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3746('0x12'));var hardwareService=require(_0x3746('0x13'));var logger=require(_0x3746('0x14'))(_0x3746('0x15'));var utils=require(_0x3746('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40576e,_0x4fa401){_0x4fa401=_0x4fa401||0xcc;return function(_0x5198ee){if(_0x5198ee){return _0x40576e[_0x3746('0x17')](_0x4fa401);}return _0x40576e[_0x3746('0x18')](_0x4fa401)[_0x3746('0x19')]();};}function respondWithResult(_0x30cedd,_0x4d2cc9){_0x4d2cc9=_0x4d2cc9||0xc8;return function(_0x16f6a1){if(_0x16f6a1){return _0x30cedd['status'](_0x4d2cc9)[_0x3746('0x1a')](_0x16f6a1);}};}function respondWithFilteredResult(_0x22b154,_0x5d28bd){return function(_0x46b736){if(_0x46b736){var _0xdb539c=_0x46b736[_0x3746('0x1b')],_0x404c26=_0x5d28bd[_0x3746('0x1c')],_0x59e899=_0x5d28bd[_0x3746('0x1c')]+_0x5d28bd[_0x3746('0x1d')],_0x40bdc8;if(_0x59e899>=_0xdb539c){_0x59e899=_0xdb539c;_0x40bdc8=0xc8;}else{_0x40bdc8=0xce;}_0x22b154[_0x3746('0x18')](_0x40bdc8);return _0x22b154['set'](_0x3746('0x1e'),_0x404c26+'-'+_0x59e899+'/'+_0xdb539c)[_0x3746('0x1a')](_0x46b736);}return null;};}function patchUpdates(_0x1b2914){return function(_0x1d71c4){try{jsonpatch[_0x3746('0x1f')](_0x1d71c4,_0x1b2914,!![]);}catch(_0x555f30){return BPromise['reject'](_0x555f30);}return _0x1d71c4[_0x3746('0x20')]();};}function saveUpdates(_0x4028c2,_0x36fe83){return function(_0x782524){if(_0x782524){return _0x782524[_0x3746('0x21')](_0x4028c2)[_0x3746('0x22')](function(_0x16ba6b){return _0x16ba6b;});}return null;};}function removeEntity(_0x4a800a,_0x2d536a){return function(_0x1fc895){if(_0x1fc895){return _0x1fc895[_0x3746('0x23')]()['then'](function(){var _0x4f65ca=_0x1fc895[_0x3746('0x24')]({'plain':!![]});var _0x2e2177='ChanSpies';return db['UserProfileResource'][_0x3746('0x23')]({'where':{'type':_0x2e2177,'resourceId':_0x4f65ca['id']}})[_0x3746('0x22')](function(){return _0x1fc895;});})[_0x3746('0x22')](function(){_0x4a800a['status'](0xcc)[_0x3746('0x19')]();});}};}function handleEntityNotFound(_0x5d2189,_0xb48c7f){return function(_0x19ae06){if(!_0x19ae06){_0x5d2189[_0x3746('0x17')](0x194);}return _0x19ae06;};}function handleError(_0x2d6f75,_0x183165){_0x183165=_0x183165||0x1f4;return function(_0x36fba2){logger['error'](_0x36fba2[_0x3746('0x25')]);if(_0x36fba2[_0x3746('0x26')]){delete _0x36fba2[_0x3746('0x26')];}_0x2d6f75['status'](_0x183165)[_0x3746('0x27')](_0x36fba2);};}exports['index']=function(_0x43a1f6,_0x582ace){var _0xea3ede={},_0x482093={},_0x2ac26f={'count':0x0,'rows':[]};var _0x5967a3=_[_0x3746('0x28')](db[_0x3746('0x29')][_0x3746('0x2a')],function(_0x18a5d9){return{'name':_0x18a5d9['fieldName'],'type':_0x18a5d9[_0x3746('0x2b')]['key']};});_0x482093[_0x3746('0x2c')]=_[_0x3746('0x28')](_0x5967a3,_0x3746('0x26'));_0x482093['query']=_[_0x3746('0x2d')](_0x43a1f6[_0x3746('0x2e')]);_0x482093[_0x3746('0x2f')]=_['intersection'](_0x482093[_0x3746('0x2c')],_0x482093[_0x3746('0x2e')]);_0xea3ede[_0x3746('0x30')]=_['intersection'](_0x482093['model'],qs[_0x3746('0x31')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x31')]));_0xea3ede[_0x3746('0x30')]=_0xea3ede[_0x3746('0x30')][_0x3746('0x32')]?_0xea3ede[_0x3746('0x30')]:_0x482093[_0x3746('0x2c')];if(!_0x43a1f6['query'][_0x3746('0x33')]('nolimit')){_0xea3ede[_0x3746('0x1d')]=qs[_0x3746('0x1d')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x1d')]);_0xea3ede[_0x3746('0x1c')]=qs[_0x3746('0x1c')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x1c')]);}_0xea3ede['order']=qs[_0x3746('0x34')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x34')]);_0xea3ede[_0x3746('0x35')]=qs[_0x3746('0x2f')](_['pick'](_0x43a1f6['query'],_0x482093[_0x3746('0x2f')]),_0x5967a3);if(_0x43a1f6[_0x3746('0x2e')]['filter']){_0xea3ede[_0x3746('0x35')]=_['merge'](_0xea3ede['where'],{'$or':_[_0x3746('0x28')](_0x5967a3,function(_0x5f5924){if(_0x5f5924[_0x3746('0x2b')]!==_0x3746('0x36')){var _0x30a3ef={};_0x30a3ef[_0x5f5924[_0x3746('0x26')]]={'$like':'%'+_0x43a1f6[_0x3746('0x2e')]['filter']+'%'};return _0x30a3ef;}})});}_0xea3ede=_[_0x3746('0x37')]({},_0xea3ede,_0x43a1f6[_0x3746('0x38')]);var _0x22c674={'where':_0xea3ede[_0x3746('0x35')]};return db['VoiceChanSpy'][_0x3746('0x1b')](_0x22c674)['then'](function(_0x30cfbd){_0x2ac26f['count']=_0x30cfbd;if(_0x43a1f6[_0x3746('0x2e')][_0x3746('0x39')]){_0xea3ede[_0x3746('0x3a')]=[{'all':!![]}];}return db[_0x3746('0x29')][_0x3746('0x3b')](_0xea3ede);})[_0x3746('0x22')](function(_0x47646b){_0x2ac26f[_0x3746('0x3c')]=_0x47646b;return _0x2ac26f;})['then'](respondWithFilteredResult(_0x582ace,_0xea3ede))['catch'](handleError(_0x582ace,null));};exports[_0x3746('0x3d')]=function(_0x5dcf56,_0x475fd0){var _0x11aed0={'raw':![],'where':{'id':_0x5dcf56[_0x3746('0x3e')]['id']}},_0x29b9f5={};_0x29b9f5['model']=_[_0x3746('0x2d')](db[_0x3746('0x29')]['rawAttributes']);_0x29b9f5[_0x3746('0x2e')]=_['keys'](_0x5dcf56[_0x3746('0x2e')]);_0x29b9f5[_0x3746('0x2f')]=_[_0x3746('0x3f')](_0x29b9f5['model'],_0x29b9f5[_0x3746('0x2e')]);_0x11aed0[_0x3746('0x30')]=_['intersection'](_0x29b9f5[_0x3746('0x2c')],qs['fields'](_0x5dcf56['query'][_0x3746('0x31')]));_0x11aed0[_0x3746('0x30')]=_0x11aed0[_0x3746('0x30')]['length']?_0x11aed0[_0x3746('0x30')]:_0x29b9f5[_0x3746('0x2c')];if(_0x5dcf56[_0x3746('0x2e')]['includeAll']){_0x11aed0['include']=[{'all':!![]}];}_0x11aed0=_[_0x3746('0x37')]({},_0x11aed0,_0x5dcf56[_0x3746('0x38')]);return db['VoiceChanSpy']['find'](_0x11aed0)[_0x3746('0x22')](handleEntityNotFound(_0x475fd0,null))['then'](respondWithResult(_0x475fd0,null))[_0x3746('0x40')](handleError(_0x475fd0,null));};exports['create']=function(_0x1c7a18,_0x2aa1a8){return db['VoiceChanSpy'][_0x3746('0x41')](_0x1c7a18[_0x3746('0x42')],{})[_0x3746('0x22')](function(_0x1393bf){var _0x5aa674=_0x1c7a18[_0x3746('0x43')][_0x3746('0x24')]({'plain':!![]});if(!_0x5aa674)throw new Error(_0x3746('0x44'));if(_0x5aa674[_0x3746('0x45')]===_0x3746('0x43')){var _0x527f81=_0x1393bf[_0x3746('0x24')]({'plain':!![]});var _0x440d14=_0x3746('0x46');return db[_0x3746('0x47')]['find']({'where':{'name':_0x440d14,'userProfileId':_0x5aa674[_0x3746('0x48')]},'raw':!![]})['then'](function(_0x5315a6){if(_0x5315a6&&_0x5315a6[_0x3746('0x49')]===0x0){return db[_0x3746('0x4a')]['create']({'name':_0x527f81[_0x3746('0x26')],'resourceId':_0x527f81['id'],'type':_0x5315a6[_0x3746('0x26')],'sectionId':_0x5315a6['id']},{})[_0x3746('0x22')](function(){return _0x1393bf;});}else{return _0x1393bf;}})[_0x3746('0x40')](function(_0x181de5){logger[_0x3746('0x4b')](_0x3746('0x4c'),_0x181de5);throw _0x181de5;});}return _0x1393bf;})[_0x3746('0x22')](respondWithResult(_0x2aa1a8,0xc9))[_0x3746('0x40')](handleError(_0x2aa1a8,null));};exports[_0x3746('0x21')]=function(_0x5c4ae4,_0x11051e){if(_0x5c4ae4['body']['id']){delete _0x5c4ae4['body']['id'];}return db[_0x3746('0x29')][_0x3746('0x4d')]({'where':{'id':_0x5c4ae4[_0x3746('0x3e')]['id']}})[_0x3746('0x22')](handleEntityNotFound(_0x11051e,null))[_0x3746('0x22')](saveUpdates(_0x5c4ae4[_0x3746('0x42')],null))[_0x3746('0x22')](respondWithResult(_0x11051e,null))[_0x3746('0x40')](handleError(_0x11051e,null));};exports[_0x3746('0x23')]=function(_0x4efdf6,_0x2ad310){return db[_0x3746('0x29')][_0x3746('0x4d')]({'where':{'id':_0x4efdf6[_0x3746('0x3e')]['id']}})[_0x3746('0x22')](handleEntityNotFound(_0x2ad310,null))[_0x3746('0x22')](removeEntity(_0x2ad310,null))[_0x3746('0x40')](handleError(_0x2ad310,null));}; \ No newline at end of file +var _0xfc8a=['key','model','map','query','attributes','intersection','length','nolimit','order','sort','where','filters','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','Content-Range','apply','save','update','destroy','then','get','end','error','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type'];(function(_0x4b0830,_0x2e3b0a){var _0x1f53a7=function(_0x4b5503){while(--_0x4b5503){_0x4b0830['push'](_0x4b0830['shift']());}};_0x1f53a7(++_0x2e3b0a);}(_0xfc8a,0xc5));var _0xafc8=function(_0x2869f8,_0x9756fb){_0x2869f8=_0x2869f8-0x0;var _0x2a9fe6=_0xfc8a[_0x2869f8];return _0x2a9fe6;};'use strict';var pdf=require(_0xafc8('0x0'));var emlformat=require(_0xafc8('0x1'));var rimraf=require(_0xafc8('0x2'));var zipdir=require(_0xafc8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafc8('0x4'));var moment=require('moment');var BPromise=require(_0xafc8('0x5'));var Mustache=require(_0xafc8('0x6'));var util=require(_0xafc8('0x7'));var path=require(_0xafc8('0x8'));var sox=require(_0xafc8('0x9'));var csv=require(_0xafc8('0xa'));var ejs=require(_0xafc8('0xb'));var fs=require('fs');var _=require(_0xafc8('0xc'));var squel=require(_0xafc8('0xd'));var crypto=require(_0xafc8('0xe'));var jsforce=require(_0xafc8('0xf'));var deskjs=require(_0xafc8('0x10'));var toCsv=require('to-csv');var querystring=require(_0xafc8('0x11'));var Papa=require(_0xafc8('0x12'));var Redis=require(_0xafc8('0x13'));var authService=require(_0xafc8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafc8('0x15'));var logger=require(_0xafc8('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xafc8('0x17'));var licenseUtil=require(_0xafc8('0x18'));var db=require(_0xafc8('0x19'))['db'];function respondWithStatusCode(_0x3b62ff,_0x5ac9e8){_0x5ac9e8=_0x5ac9e8||0xcc;return function(_0x1e0b2c){if(_0x1e0b2c){return _0x3b62ff['sendStatus'](_0x5ac9e8);}return _0x3b62ff[_0xafc8('0x1a')](_0x5ac9e8)['end']();};}function respondWithResult(_0x40d8f6,_0x608156){_0x608156=_0x608156||0xc8;return function(_0x25bf50){if(_0x25bf50){return _0x40d8f6[_0xafc8('0x1a')](_0x608156)[_0xafc8('0x1b')](_0x25bf50);}};}function respondWithFilteredResult(_0x45d97b,_0x32c19){return function(_0x31a909){if(_0x31a909){var _0x4668f8=_0x31a909['count'],_0x53ad61=_0x32c19[_0xafc8('0x1c')],_0xd174a3=_0x32c19[_0xafc8('0x1c')]+_0x32c19[_0xafc8('0x1d')],_0x318a50;if(_0xd174a3>=_0x4668f8){_0xd174a3=_0x4668f8;_0x318a50=0xc8;}else{_0x318a50=0xce;}_0x45d97b['status'](_0x318a50);return _0x45d97b['set'](_0xafc8('0x1e'),_0x53ad61+'-'+_0xd174a3+'/'+_0x4668f8)['json'](_0x31a909);}return null;};}function patchUpdates(_0x5c8286){return function(_0x4048a4){try{jsonpatch[_0xafc8('0x1f')](_0x4048a4,_0x5c8286,!![]);}catch(_0x163d24){return BPromise['reject'](_0x163d24);}return _0x4048a4[_0xafc8('0x20')]();};}function saveUpdates(_0x3e7298,_0x8857fe){return function(_0x37a0d0){if(_0x37a0d0){return _0x37a0d0[_0xafc8('0x21')](_0x3e7298)['then'](function(_0x2cd349){return _0x2cd349;});}return null;};}function removeEntity(_0x21b442,_0x20b722){return function(_0x14a617){if(_0x14a617){return _0x14a617[_0xafc8('0x22')]()[_0xafc8('0x23')](function(){var _0x43f0aa=_0x14a617[_0xafc8('0x24')]({'plain':!![]});var _0x156788='ChanSpies';return db['UserProfileResource'][_0xafc8('0x22')]({'where':{'type':_0x156788,'resourceId':_0x43f0aa['id']}})[_0xafc8('0x23')](function(){return _0x14a617;});})[_0xafc8('0x23')](function(){_0x21b442[_0xafc8('0x1a')](0xcc)[_0xafc8('0x25')]();});}};}function handleEntityNotFound(_0x3ec238,_0x5b0f7d){return function(_0x52fa9d){if(!_0x52fa9d){_0x3ec238['sendStatus'](0x194);}return _0x52fa9d;};}function handleError(_0x5e9ccb,_0x43189d){_0x43189d=_0x43189d||0x1f4;return function(_0x358aa6){logger[_0xafc8('0x26')](_0x358aa6['stack']);if(_0x358aa6[_0xafc8('0x27')]){delete _0x358aa6[_0xafc8('0x27')];}_0x5e9ccb['status'](_0x43189d)[_0xafc8('0x28')](_0x358aa6);};}exports[_0xafc8('0x29')]=function(_0x47fc6d,_0x3f5a5d){var _0x22fd08={},_0x1f3ba9={},_0x25554e={'count':0x0,'rows':[]};var _0x3ad8fa=_['map'](db[_0xafc8('0x2a')][_0xafc8('0x2b')],function(_0x508fba){return{'name':_0x508fba[_0xafc8('0x2c')],'type':_0x508fba[_0xafc8('0x2d')][_0xafc8('0x2e')]};});_0x1f3ba9[_0xafc8('0x2f')]=_[_0xafc8('0x30')](_0x3ad8fa,'name');_0x1f3ba9[_0xafc8('0x31')]=_['keys'](_0x47fc6d[_0xafc8('0x31')]);_0x1f3ba9['filters']=_['intersection'](_0x1f3ba9['model'],_0x1f3ba9[_0xafc8('0x31')]);_0x22fd08[_0xafc8('0x32')]=_[_0xafc8('0x33')](_0x1f3ba9[_0xafc8('0x2f')],qs['fields'](_0x47fc6d[_0xafc8('0x31')]['fields']));_0x22fd08[_0xafc8('0x32')]=_0x22fd08['attributes'][_0xafc8('0x34')]?_0x22fd08[_0xafc8('0x32')]:_0x1f3ba9[_0xafc8('0x2f')];if(!_0x47fc6d['query']['hasOwnProperty'](_0xafc8('0x35'))){_0x22fd08['limit']=qs[_0xafc8('0x1d')](_0x47fc6d['query']['limit']);_0x22fd08[_0xafc8('0x1c')]=qs['offset'](_0x47fc6d['query'][_0xafc8('0x1c')]);}_0x22fd08[_0xafc8('0x36')]=qs['sort'](_0x47fc6d['query'][_0xafc8('0x37')]);_0x22fd08[_0xafc8('0x38')]=qs[_0xafc8('0x39')](_[_0xafc8('0x3a')](_0x47fc6d[_0xafc8('0x31')],_0x1f3ba9[_0xafc8('0x39')]),_0x3ad8fa);if(_0x47fc6d[_0xafc8('0x31')]['filter']){_0x22fd08['where']=_[_0xafc8('0x3b')](_0x22fd08[_0xafc8('0x38')],{'$or':_['map'](_0x3ad8fa,function(_0x8b22f8){if(_0x8b22f8[_0xafc8('0x2d')]!=='VIRTUAL'){var _0x58847f={};_0x58847f[_0x8b22f8[_0xafc8('0x27')]]={'$like':'%'+_0x47fc6d[_0xafc8('0x31')][_0xafc8('0x3c')]+'%'};return _0x58847f;}})});}_0x22fd08=_['merge']({},_0x22fd08,_0x47fc6d[_0xafc8('0x3d')]);var _0x1a45fa={'where':_0x22fd08['where']};return db[_0xafc8('0x2a')][_0xafc8('0x3e')](_0x1a45fa)[_0xafc8('0x23')](function(_0x376762){_0x25554e[_0xafc8('0x3e')]=_0x376762;if(_0x47fc6d[_0xafc8('0x31')][_0xafc8('0x3f')]){_0x22fd08[_0xafc8('0x40')]=[{'all':!![]}];}return db[_0xafc8('0x2a')][_0xafc8('0x41')](_0x22fd08);})[_0xafc8('0x23')](function(_0x4c71b9){_0x25554e[_0xafc8('0x42')]=_0x4c71b9;return _0x25554e;})[_0xafc8('0x23')](respondWithFilteredResult(_0x3f5a5d,_0x22fd08))[_0xafc8('0x43')](handleError(_0x3f5a5d,null));};exports['show']=function(_0xb8340e,_0x5516ca){var _0x4a2335={'raw':![],'where':{'id':_0xb8340e['params']['id']}},_0x36ec48={};_0x36ec48[_0xafc8('0x2f')]=_[_0xafc8('0x44')](db['VoiceChanSpy'][_0xafc8('0x2b')]);_0x36ec48[_0xafc8('0x31')]=_[_0xafc8('0x44')](_0xb8340e[_0xafc8('0x31')]);_0x36ec48[_0xafc8('0x39')]=_[_0xafc8('0x33')](_0x36ec48[_0xafc8('0x2f')],_0x36ec48[_0xafc8('0x31')]);_0x4a2335[_0xafc8('0x32')]=_[_0xafc8('0x33')](_0x36ec48[_0xafc8('0x2f')],qs['fields'](_0xb8340e[_0xafc8('0x31')][_0xafc8('0x45')]));_0x4a2335[_0xafc8('0x32')]=_0x4a2335[_0xafc8('0x32')]['length']?_0x4a2335[_0xafc8('0x32')]:_0x36ec48['model'];if(_0xb8340e[_0xafc8('0x31')][_0xafc8('0x3f')]){_0x4a2335[_0xafc8('0x40')]=[{'all':!![]}];}_0x4a2335=_[_0xafc8('0x3b')]({},_0x4a2335,_0xb8340e['options']);return db['VoiceChanSpy'][_0xafc8('0x46')](_0x4a2335)[_0xafc8('0x23')](handleEntityNotFound(_0x5516ca,null))[_0xafc8('0x23')](respondWithResult(_0x5516ca,null))[_0xafc8('0x43')](handleError(_0x5516ca,null));};exports['create']=function(_0x502f45,_0x4d0c26){return db[_0xafc8('0x2a')][_0xafc8('0x47')](_0x502f45[_0xafc8('0x48')],{})[_0xafc8('0x23')](function(_0x35c2fe){var _0x5da45b=_0x502f45[_0xafc8('0x49')]['get']({'plain':!![]});if(!_0x5da45b)throw new Error(_0xafc8('0x4a'));if(_0x5da45b[_0xafc8('0x4b')]===_0xafc8('0x49')){var _0x16396e=_0x35c2fe[_0xafc8('0x24')]({'plain':!![]});var _0x34e751=_0xafc8('0x4c');return db[_0xafc8('0x4d')][_0xafc8('0x46')]({'where':{'name':_0x34e751,'userProfileId':_0x5da45b['userProfileId']},'raw':!![]})[_0xafc8('0x23')](function(_0x54fcb5){if(_0x54fcb5&&_0x54fcb5[_0xafc8('0x4e')]===0x0){return db['UserProfileResource'][_0xafc8('0x47')]({'name':_0x16396e['name'],'resourceId':_0x16396e['id'],'type':_0x54fcb5[_0xafc8('0x27')],'sectionId':_0x54fcb5['id']},{})[_0xafc8('0x23')](function(){return _0x35c2fe;});}else{return _0x35c2fe;}})['catch'](function(_0x3946b4){logger[_0xafc8('0x26')](_0xafc8('0x4f'),_0x3946b4);throw _0x3946b4;});}return _0x35c2fe;})[_0xafc8('0x23')](respondWithResult(_0x4d0c26,0xc9))['catch'](handleError(_0x4d0c26,null));};exports[_0xafc8('0x21')]=function(_0x23cbeb,_0x2fa215){if(_0x23cbeb[_0xafc8('0x48')]['id']){delete _0x23cbeb['body']['id'];}return db[_0xafc8('0x2a')][_0xafc8('0x46')]({'where':{'id':_0x23cbeb[_0xafc8('0x50')]['id']}})[_0xafc8('0x23')](handleEntityNotFound(_0x2fa215,null))[_0xafc8('0x23')](saveUpdates(_0x23cbeb[_0xafc8('0x48')],null))[_0xafc8('0x23')](respondWithResult(_0x2fa215,null))[_0xafc8('0x43')](handleError(_0x2fa215,null));};exports[_0xafc8('0x22')]=function(_0x2f58fb,_0x4fab9b){return db[_0xafc8('0x2a')][_0xafc8('0x46')]({'where':{'id':_0x2f58fb[_0xafc8('0x50')]['id']}})[_0xafc8('0x23')](handleEntityNotFound(_0x4fab9b,null))[_0xafc8('0x23')](removeEntity(_0x4fab9b,null))['catch'](handleError(_0x4fab9b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c178481..92dd678 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 _0x37dc=['%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','internal','concat','User','findAll','agent','exports','models','define','VoiceChanSpy','voice_chanspy','then','length','catch','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','format'];(function(_0x38ea94,_0x7c929f){var _0x1c429e=function(_0x1e57d6){while(--_0x1e57d6){_0x38ea94['push'](_0x38ea94['shift']());}};_0x1c429e(++_0x7c929f);}(_0x37dc,0x1e9));var _0xc37d=function(_0x4c3bee,_0x556316){_0x4c3bee=_0x4c3bee-0x0;var _0x1f629f=_0x37dc[_0x4c3bee];return _0x1f629f;};'use strict';var _=require(_0xc37d('0x0'));var util=require(_0xc37d('0x1'));var BPromise=require(_0xc37d('0x2'));var attributes=require(_0xc37d('0x3'));var getUserApplications=function(_0x4cfb8b,_0x3f4a3e,_0x551d27){var _0x4240cc=0x1;var _0x52c6ae=[];var _0x5ecb1f={'context':_0x3f4a3e['context']||'from-sip','exten':util[_0xc37d('0x4')](_0xc37d('0x5'),_0x4cfb8b[_0xc37d('0x6')],_0x551d27),'type':_0xc37d('0x7'),'isApp':![],'ChanSpyId':_0x4cfb8b['id'],'UserId':_0x3f4a3e['id']};_0x52c6ae[_0xc37d('0x8')](_[_0xc37d('0x9')]({'app':_0xc37d('0xa'),'appdata':util[_0xc37d('0x4')](_0xc37d('0xb'),'chanspy'),'priority':_0x4240cc++},_0x5ecb1f));if(_0x4cfb8b[_0xc37d('0xc')]){_0x52c6ae[_0xc37d('0x8')](_['merge']({'app':_0xc37d('0xd'),'appdata':util[_0xc37d('0x4')]('${UNIQUEID}.%s,a',_0x4cfb8b[_0xc37d('0xe')]),'priority':_0x4240cc++},_0x5ecb1f));}if(_0x4cfb8b[_0xc37d('0xf')]){_0x52c6ae['push'](_[_0xc37d('0x9')]({'app':_0xc37d('0x10'),'appdata':_0x4cfb8b[_0xc37d('0x11')],'priority':_0x4240cc++},_0x5ecb1f));}_0x52c6ae[_0xc37d('0x8')](_[_0xc37d('0x9')]({'app':_0xc37d('0x12'),'appdata':util[_0xc37d('0x4')](_0xc37d('0x13'),_0x3f4a3e[_0xc37d('0x14')],_0x4cfb8b[_0xc37d('0x15')]?_0x4cfb8b[_0xc37d('0x15')][_0xc37d('0x16')](''):''),'priority':_0x4240cc++},_0x5ecb1f));if(_0x4cfb8b['record']){_0x52c6ae['push'](_[_0xc37d('0x9')]({'app':'StopMixMonitor','priority':_0x4240cc++},_0x5ecb1f));}return _0x52c6ae;};var getChanSpyApplications=function(_0x5c90e3,_0xce39b1){var _0x11615a=[];for(var _0x5b204f=0x0,_0x365126=0x1;_0x5b204f<_0xce39b1['length'];_0x5b204f++,_0x365126=0x1){_0x11615a=_0x11615a['concat'](getUserApplications(_0x5c90e3,_0xce39b1[_0x5b204f],_0xce39b1[_0x5b204f][_0xc37d('0x17')]));if(_0xce39b1[_0x5b204f][_0xc37d('0x17')]!=_0xce39b1[_0x5b204f][_0xc37d('0x14')]){_0x11615a=_0x11615a[_0xc37d('0x18')](getUserApplications(_0x5c90e3,_0xce39b1[_0x5b204f],_0xce39b1[_0x5b204f][_0xc37d('0x14')]));}}return _0x11615a;};var getChanSpyPromise=function(_0x314a6c,_0x59d7cb){return new BPromise(function(_0x5dbbb1,_0x210663){return _0x314a6c[_0xc37d('0x19')][_0xc37d('0x1a')]({'attributes':['id','name',_0xc37d('0x17')],'where':{'role':_0xc37d('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3356a){if(_0x3356a){return _0x5dbbb1(getChanSpyApplications(_0x59d7cb,_0x3356a));}return _0x5dbbb1([]);})['catch'](function(_0x219840){_0x210663(_0x219840);});});};module[_0xc37d('0x1c')]=function(_0x1c1e3a,_0x2d1c55){var _0x2e6752=_0x1c1e3a[_0xc37d('0x1d')];return _0x1c1e3a[_0xc37d('0x1e')](_0xc37d('0x1f'),attributes,{'tableName':_0xc37d('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4960a4,_0x32dff8,_0x3940a5){return getChanSpyPromise(_0x2e6752,_0x4960a4)[_0xc37d('0x21')](function(_0x5c1dd7){if(_0x5c1dd7&&_0x5c1dd7[_0xc37d('0x22')]){return _0x2e6752['VoiceExtension']['bulkCreate'](_0x5c1dd7);}})[_0xc37d('0x21')](function(){_0x3940a5();})[_0xc37d('0x23')](function(_0x459f13){_0x3940a5(_0x459f13);});},'afterUpdate':function(_0x806e96,_0x2fd529,_0x59abfd){return _0x2e6752[_0xc37d('0x24')]['destroy']({'where':{'ChanSpyId':_0x806e96['id']}})[_0xc37d('0x21')](function(){return getChanSpyPromise(_0x2e6752,_0x806e96);})['then'](function(_0x1f69fb){if(_0x1f69fb&&_0x1f69fb[_0xc37d('0x22')]){return _0x2e6752[_0xc37d('0x24')][_0xc37d('0x25')](_0x1f69fb);}})[_0xc37d('0x21')](function(){_0x59abfd();})[_0xc37d('0x23')](function(_0x429b4f){_0x59abfd(_0x429b4f);});},'afterDestroy':function(_0x8a18f2,_0x5281cd,_0x146831){return _0x2e6752['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x8a18f2['id']}})[_0xc37d('0x21')](function(){_0x146831();})[_0xc37d('0x23')](function(_0x404049){_0x146831(_0x404049);});}}});}; \ No newline at end of file +var _0x702d=['${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','internal','concat','User','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','merge','format','CDR(type)=%s','chanspy','record','push','MixMonitor'];(function(_0x595150,_0x3d32c4){var _0xfd88c3=function(_0x1d9121){while(--_0x1d9121){_0x595150['push'](_0x595150['shift']());}};_0xfd88c3(++_0x3d32c4);}(_0x702d,0x147));var _0xd702=function(_0x217cff,_0xb32488){_0x217cff=_0x217cff-0x0;var _0x48662e=_0x702d[_0x217cff];return _0x48662e;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var BPromise=require(_0xd702('0x2'));var attributes=require(_0xd702('0x3'));var getUserApplications=function(_0x37ed5c,_0x5c2b9e,_0x20c11a){var _0xebbd7c=0x1;var _0x27b260=[];var _0x1c5a32={'context':_0x5c2b9e['context']||_0xd702('0x4'),'exten':util['format'](_0xd702('0x5'),_0x37ed5c[_0xd702('0x6')],_0x20c11a),'type':_0xd702('0x7'),'isApp':![],'ChanSpyId':_0x37ed5c['id'],'UserId':_0x5c2b9e['id']};_0x27b260['push'](_[_0xd702('0x8')]({'app':'Set','appdata':util[_0xd702('0x9')](_0xd702('0xa'),_0xd702('0xb')),'priority':_0xebbd7c++},_0x1c5a32));if(_0x37ed5c[_0xd702('0xc')]){_0x27b260[_0xd702('0xd')](_[_0xd702('0x8')]({'app':_0xd702('0xe'),'appdata':util[_0xd702('0x9')](_0xd702('0xf'),_0x37ed5c[_0xd702('0x10')]),'priority':_0xebbd7c++},_0x1c5a32));}if(_0x37ed5c['auth']){_0x27b260['push'](_[_0xd702('0x8')]({'app':_0xd702('0x11'),'appdata':_0x37ed5c[_0xd702('0x12')],'priority':_0xebbd7c++},_0x1c5a32));}_0x27b260['push'](_[_0xd702('0x8')]({'app':_0xd702('0x13'),'appdata':util[_0xd702('0x9')](_0xd702('0x14'),_0x5c2b9e[_0xd702('0x15')],_0x37ed5c[_0xd702('0x16')]?_0x37ed5c['options'][_0xd702('0x17')](''):''),'priority':_0xebbd7c++},_0x1c5a32));if(_0x37ed5c[_0xd702('0xc')]){_0x27b260['push'](_[_0xd702('0x8')]({'app':'StopMixMonitor','priority':_0xebbd7c++},_0x1c5a32));}return _0x27b260;};var getChanSpyApplications=function(_0x268c66,_0x210c32){var _0x55b93e=[];for(var _0x2ba791=0x0,_0x2f3e1f=0x1;_0x2ba791<_0x210c32[_0xd702('0x18')];_0x2ba791++,_0x2f3e1f=0x1){_0x55b93e=_0x55b93e['concat'](getUserApplications(_0x268c66,_0x210c32[_0x2ba791],_0x210c32[_0x2ba791]['internal']));if(_0x210c32[_0x2ba791][_0xd702('0x19')]!=_0x210c32[_0x2ba791]['name']){_0x55b93e=_0x55b93e[_0xd702('0x1a')](getUserApplications(_0x268c66,_0x210c32[_0x2ba791],_0x210c32[_0x2ba791][_0xd702('0x15')]));}}return _0x55b93e;};var getChanSpyPromise=function(_0x37267c,_0x265b1b){return new BPromise(function(_0x4cf326,_0x120e3f){return _0x37267c[_0xd702('0x1b')]['findAll']({'attributes':['id','name','internal'],'where':{'role':_0xd702('0x1c'),'chanspy':!![]},'raw':!![]})[_0xd702('0x1d')](function(_0x5cbff4){if(_0x5cbff4){return _0x4cf326(getChanSpyApplications(_0x265b1b,_0x5cbff4));}return _0x4cf326([]);})[_0xd702('0x1e')](function(_0x5d91fd){_0x120e3f(_0x5d91fd);});});};module[_0xd702('0x1f')]=function(_0x5824ec,_0x5e8d61){var _0x51899c=_0x5824ec[_0xd702('0x20')];return _0x5824ec[_0xd702('0x21')](_0xd702('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f0c44,_0x17cd14,_0x10599a){return getChanSpyPromise(_0x51899c,_0x1f0c44)[_0xd702('0x1d')](function(_0x1200ed){if(_0x1200ed&&_0x1200ed[_0xd702('0x18')]){return _0x51899c[_0xd702('0x23')][_0xd702('0x24')](_0x1200ed);}})[_0xd702('0x1d')](function(){_0x10599a();})['catch'](function(_0x116b2f){_0x10599a(_0x116b2f);});},'afterUpdate':function(_0x322cb8,_0x25e96a,_0x335202){return _0x51899c[_0xd702('0x23')][_0xd702('0x25')]({'where':{'ChanSpyId':_0x322cb8['id']}})[_0xd702('0x1d')](function(){return getChanSpyPromise(_0x51899c,_0x322cb8);})[_0xd702('0x1d')](function(_0x5f1084){if(_0x5f1084&&_0x5f1084['length']){return _0x51899c[_0xd702('0x23')][_0xd702('0x24')](_0x5f1084);}})['then'](function(){_0x335202();})[_0xd702('0x1e')](function(_0xee8bf1){_0x335202(_0xee8bf1);});},'afterDestroy':function(_0xffdb54,_0x2946ae,_0x56e9cd){return _0x51899c[_0xd702('0x23')][_0xd702('0x25')]({'where':{'ChanSpyId':_0xffdb54['id']}})[_0xd702('0x1d')](function(){_0x56e9cd();})[_0xd702('0x1e')](function(_0x3baedf){_0x56e9cd(_0x3baedf);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e85c0f0..2f074c2 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 _0x041f=['message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4925de,_0x5672ba){var _0x1faf03=function(_0x5bc9ff){while(--_0x5bc9ff){_0x4925de['push'](_0x4925de['shift']());}};_0x1faf03(++_0x5672ba);}(_0x041f,0x190));var _0xf041=function(_0x22ec4c,_0x35356c){_0x22ec4c=_0x22ec4c-0x0;var _0x593ca1=_0x041f[_0x22ec4c];return _0x593ca1;};'use strict';var _=require('lodash');var util=require(_0xf041('0x0'));var moment=require(_0xf041('0x1'));var BPromise=require(_0xf041('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf041('0x3'));var db=require(_0xf041('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf041('0x5'))(_0xf041('0x6'));var config=require(_0xf041('0x7'));var jayson=require(_0xf041('0x8'));var client=jayson[_0xf041('0x9')][_0xf041('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5164a2,_0x1832e2,_0x33ace0){return new BPromise(function(_0x5844fd,_0x3b2ad1){return client[_0xf041('0xb')](_0x5164a2,_0x33ace0)['then'](function(_0x4e2b0a){logger[_0xf041('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1832e2,_0xf041('0xd'));logger['debug'](_0xf041('0xe'),_0x1832e2,_0xf041('0xd'),JSON[_0xf041('0xf')](_0x4e2b0a));if(_0x4e2b0a['error']){if(_0x4e2b0a[_0xf041('0x10')][_0xf041('0x11')]===0x1f4){logger[_0xf041('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1832e2,_0x4e2b0a[_0xf041('0x10')]['message']);return _0x3b2ad1(_0x4e2b0a[_0xf041('0x10')][_0xf041('0x12')]);}logger['error'](_0xf041('0x13'),_0x1832e2,_0x4e2b0a[_0xf041('0x10')]['message']);return _0x5844fd(_0x4e2b0a[_0xf041('0x10')][_0xf041('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x1832e2,'request\x20sent');_0x5844fd(_0x4e2b0a[_0xf041('0x14')][_0xf041('0x12')]);}})[_0xf041('0x15')](function(_0x3776f9){logger[_0xf041('0x10')](_0xf041('0x13'),_0x1832e2,_0x3776f9);_0x3b2ad1(_0x3776f9);});});} \ No newline at end of file +var _0x2343=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x4773cd,_0x118f7b){var _0x2dc3b4=function(_0x4e8213){while(--_0x4e8213){_0x4773cd['push'](_0x4773cd['shift']());}};_0x2dc3b4(++_0x118f7b);}(_0x2343,0x1e0));var _0x3234=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x2343[_0xed4881];return _0x7fcbd5;};'use strict';var _=require(_0x3234('0x0'));var util=require(_0x3234('0x1'));var moment=require(_0x3234('0x2'));var BPromise=require(_0x3234('0x3'));var rs=require(_0x3234('0x4'));var fs=require('fs');var Redis=require(_0x3234('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3234('0x6'));var logger=require(_0x3234('0x7'))(_0x3234('0x8'));var config=require(_0x3234('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3234('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ec80f,_0x36687c,_0x523efe){return new BPromise(function(_0x4e0907,_0x6584f){return client[_0x3234('0xb')](_0x4ec80f,_0x523efe)[_0x3234('0xc')](function(_0x27d397){logger[_0x3234('0xd')](_0x3234('0xe'),_0x36687c,'request\x20sent');logger[_0x3234('0xf')](_0x3234('0x10'),_0x36687c,_0x3234('0x11'),JSON['stringify'](_0x27d397));if(_0x27d397['error']){if(_0x27d397[_0x3234('0x12')][_0x3234('0x13')]===0x1f4){logger[_0x3234('0x12')](_0x3234('0xe'),_0x36687c,_0x27d397[_0x3234('0x12')]['message']);return _0x6584f(_0x27d397['error'][_0x3234('0x14')]);}logger[_0x3234('0x12')](_0x3234('0xe'),_0x36687c,_0x27d397[_0x3234('0x12')][_0x3234('0x14')]);return _0x4e0907(_0x27d397[_0x3234('0x12')][_0x3234('0x14')]);}else{logger[_0x3234('0xd')](_0x3234('0xe'),_0x36687c,_0x3234('0x11'));_0x4e0907(_0x27d397[_0x3234('0x15')][_0x3234('0x14')]);}})[_0x3234('0x16')](function(_0x4e4324){logger[_0x3234('0x12')](_0x3234('0xe'),_0x36687c,_0x4e4324);_0x6584f(_0x4e4324);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0ac3754..1ff79d4 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 _0x708b=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id'];(function(_0x5285b1,_0x18ff14){var _0x1294ed=function(_0x37f1f6){while(--_0x37f1f6){_0x5285b1['push'](_0x5285b1['shift']());}};_0x1294ed(++_0x18ff14);}(_0x708b,0x77));var _0xb708=function(_0x523ce3,_0x9790e4){_0x523ce3=_0x523ce3-0x0;var _0x4dcd46=_0x708b[_0x523ce3];return _0x4dcd46;};'use strict';var multer=require(_0xb708('0x0'));var util=require(_0xb708('0x1'));var path=require(_0xb708('0x2'));var timeout=require(_0xb708('0x3'));var express=require(_0xb708('0x4'));var router=express['Router']();var auth=require(_0xb708('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb708('0x6'));var controller=require(_0xb708('0x7'));router[_0xb708('0x8')]('/',auth[_0xb708('0x9')](),controller[_0xb708('0xa')]);router[_0xb708('0x8')]('/:id',auth[_0xb708('0x9')](),controller[_0xb708('0xb')]);router[_0xb708('0xc')]('/',auth[_0xb708('0x9')](),controller[_0xb708('0xd')]);router[_0xb708('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb708('0xf')](_0xb708('0x10'),auth[_0xb708('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7e5c=['post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated'];(function(_0x38b3cb,_0x4ad7b3){var _0x5a9a84=function(_0x237634){while(--_0x237634){_0x38b3cb['push'](_0x38b3cb['shift']());}};_0x5a9a84(++_0x4ad7b3);}(_0x7e5c,0x15c));var _0xc7e5=function(_0x3a5efb,_0x478a17){_0x3a5efb=_0x3a5efb-0x0;var _0x5736ae=_0x7e5c[_0x3a5efb];return _0x5736ae;};'use strict';var multer=require(_0xc7e5('0x0'));var util=require(_0xc7e5('0x1'));var path=require('path');var timeout=require(_0xc7e5('0x2'));var express=require(_0xc7e5('0x3'));var router=express[_0xc7e5('0x4')]();var auth=require(_0xc7e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc7e5('0x6'));var controller=require(_0xc7e5('0x7'));router[_0xc7e5('0x8')]('/',auth['isAuthenticated'](),controller[_0xc7e5('0x9')]);router['get'](_0xc7e5('0xa'),auth[_0xc7e5('0xb')](),controller['show']);router[_0xc7e5('0xc')]('/',auth[_0xc7e5('0xb')](),controller['create']);router[_0xc7e5('0xd')](_0xc7e5('0xa'),auth['isAuthenticated'](),controller[_0xc7e5('0xe')]);router[_0xc7e5('0xf')](_0xc7e5('0xa'),auth['isAuthenticated'](),controller[_0xc7e5('0x10')]);module[_0xc7e5('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 c8fb1f9..2a57e38 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 _0x3e74=['name','sequelize','STRING'];(function(_0x17d8a8,_0x255ae3){var _0x16b317=function(_0x4f4518){while(--_0x4f4518){_0x17d8a8['push'](_0x17d8a8['shift']());}};_0x16b317(++_0x255ae3);}(_0x3e74,0x175));var _0x43e7=function(_0x3ac282,_0x169de8){_0x3ac282=_0x3ac282-0x0;var _0x1af8ab=_0x3e74[_0x3ac282];return _0x1af8ab;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x592fc2,_0x3e199e){var _0x53cb11=function(_0x2c210e){while(--_0x2c210e){_0x592fc2['push'](_0x592fc2['shift']());}};_0x53cb11(++_0x3e199e);}(_0x34e8,0x12c));var _0x834e=function(_0x2ea8c4,_0x187b9d){_0x2ea8c4=_0x2ea8c4-0x0;var _0x10d58a=_0x34e8[_0x2ea8c4];return _0x10d58a;};'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 e50fe50..593c03a 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 _0x2e31=['utf8','render','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/extensions_xcally_contexts.conf','Reload','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','index','VoiceContext','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','readFileSync','join','root','server/files/templates/context.ejs'];(function(_0x3b76e9,_0x39efb2){var _0x43489c=function(_0x1040a9){while(--_0x1040a9){_0x3b76e9['push'](_0x3b76e9['shift']());}};_0x43489c(++_0x39efb2);}(_0x2e31,0x145));var _0x12e3=function(_0x1f86c8,_0x44d603){_0x1f86c8=_0x1f86c8-0x0;var _0x248fd8=_0x2e31[_0x1f86c8];return _0x248fd8;};'use strict';var pdf=require(_0x12e3('0x0'));var emlformat=require(_0x12e3('0x1'));var rimraf=require(_0x12e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12e3('0x3'));var rp=require(_0x12e3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x12e3('0x5'));var util=require(_0x12e3('0x6'));var path=require(_0x12e3('0x7'));var sox=require('sox');var csv=require(_0x12e3('0x8'));var ejs=require(_0x12e3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x12e3('0xa'));var jsforce=require(_0x12e3('0xb'));var deskjs=require(_0x12e3('0xc'));var toCsv=require(_0x12e3('0x8'));var querystring=require('querystring');var Papa=require(_0x12e3('0xd'));var Redis=require(_0x12e3('0xe'));var authService=require(_0x12e3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12e3('0x10'));var logger=require(_0x12e3('0x11'))(_0x12e3('0x12'));var utils=require(_0x12e3('0x13'));var config=require(_0x12e3('0x14'));var licenseUtil=require(_0x12e3('0x15'));var db=require(_0x12e3('0x16'))['db'];var jayson=require(_0x12e3('0x17'));var client=jayson[_0x12e3('0x18')][_0x12e3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x247631,_0x4320d3,_0x5a18bb,_0x2b5352){return new BPromise(function(_0x19de67,_0xd9f80f){var _0x5f315a=_0x2b5352||client;return _0x5f315a[_0x12e3('0x1a')](_0x247631,_0x5a18bb)[_0x12e3('0x1b')](function(_0x4a29e8){logger['info']('VoiceContext,\x20%s,\x20%s',_0x4320d3,_0x12e3('0x1c'));logger['debug'](_0x12e3('0x1d'),_0x4320d3,_0x12e3('0x1c'),JSON[_0x12e3('0x1e')](_0x4a29e8));if(_0x4a29e8[_0x12e3('0x1f')]){if(_0x4a29e8[_0x12e3('0x1f')][_0x12e3('0x20')]===0x1f4){logger['error'](_0x12e3('0x21'),_0x4320d3,_0x4a29e8[_0x12e3('0x1f')]['message']);return _0xd9f80f(_0x4a29e8['error']['message']);}logger[_0x12e3('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x4320d3,_0x4a29e8[_0x12e3('0x1f')][_0x12e3('0x22')]);return _0x19de67(_0x4a29e8['error']['message']);}else{logger[_0x12e3('0x23')](_0x12e3('0x21'),_0x4320d3,_0x12e3('0x1c'));_0x19de67(_0x4a29e8[_0x12e3('0x24')]['message']);}})['catch'](function(_0x3e03d8){logger[_0x12e3('0x1f')](_0x12e3('0x21'),_0x4320d3,_0x3e03d8);_0xd9f80f(_0x3e03d8);});});}function respondWithStatusCode(_0x2705e8,_0x2cf78a){_0x2cf78a=_0x2cf78a||0xcc;return function(_0x553982){if(_0x553982){return _0x2705e8[_0x12e3('0x25')](_0x2cf78a);}return _0x2705e8[_0x12e3('0x26')](_0x2cf78a)[_0x12e3('0x27')]();};}function respondWithResult(_0x2218e7,_0x43a59f){_0x43a59f=_0x43a59f||0xc8;return function(_0x3361d2){if(_0x3361d2){return _0x2218e7['status'](_0x43a59f)[_0x12e3('0x28')](_0x3361d2);}};}function respondWithFilteredResult(_0x1c5344,_0x4213db){return function(_0x42765f){if(_0x42765f){var _0x4d1792=_0x42765f['count'],_0x1609ea=_0x4213db[_0x12e3('0x29')],_0x29880d=_0x4213db[_0x12e3('0x29')]+_0x4213db[_0x12e3('0x2a')],_0x2293ec;if(_0x29880d>=_0x4d1792){_0x29880d=_0x4d1792;_0x2293ec=0xc8;}else{_0x2293ec=0xce;}_0x1c5344[_0x12e3('0x26')](_0x2293ec);return _0x1c5344['set'](_0x12e3('0x2b'),_0x1609ea+'-'+_0x29880d+'/'+_0x4d1792)[_0x12e3('0x28')](_0x42765f);}return null;};}function patchUpdates(_0x40aefe){return function(_0x546f26){try{jsonpatch[_0x12e3('0x2c')](_0x546f26,_0x40aefe,!![]);}catch(_0x531923){return BPromise[_0x12e3('0x2d')](_0x531923);}return _0x546f26[_0x12e3('0x2e')]();};}function saveUpdates(_0x286676,_0x1b3b79){return function(_0x18fe12){if(_0x18fe12){return _0x18fe12[_0x12e3('0x2f')](_0x286676)['then'](function(_0x25219e){return _0x25219e;});}return null;};}function removeEntity(_0x2609c4,_0x5d731c){return function(_0xf4647c){if(_0xf4647c){return _0xf4647c[_0x12e3('0x30')]()['then'](function(){var _0x3012c9=_0xf4647c[_0x12e3('0x31')]({'plain':!![]});var _0x5afd7b=_0x12e3('0x32');return db[_0x12e3('0x33')][_0x12e3('0x30')]({'where':{'type':_0x5afd7b,'resourceId':_0x3012c9['id']}})['then'](function(){return _0xf4647c;});})[_0x12e3('0x1b')](function(){_0x2609c4[_0x12e3('0x26')](0xcc)[_0x12e3('0x27')]();});}};}function handleEntityNotFound(_0xc4a3d1,_0x1cd7e9){return function(_0x418952){if(!_0x418952){_0xc4a3d1[_0x12e3('0x25')](0x194);}return _0x418952;};}function handleError(_0x3a7a8b,_0x31c6e2){_0x31c6e2=_0x31c6e2||0x1f4;return function(_0x273d2f){logger[_0x12e3('0x1f')](_0x273d2f[_0x12e3('0x34')]);if(_0x273d2f[_0x12e3('0x35')]){delete _0x273d2f['name'];}_0x3a7a8b[_0x12e3('0x26')](_0x31c6e2)['send'](_0x273d2f);};}exports[_0x12e3('0x36')]=function(_0x56fde2,_0x14f0d1){var _0x1a29b1={},_0x584cc5={},_0x61a053={'count':0x0,'rows':[]};var _0x31910f=_['map'](db[_0x12e3('0x37')][_0x12e3('0x38')],function(_0x1f1ed3){return{'name':_0x1f1ed3['fieldName'],'type':_0x1f1ed3[_0x12e3('0x39')][_0x12e3('0x3a')]};});_0x584cc5[_0x12e3('0x3b')]=_['map'](_0x31910f,_0x12e3('0x35'));_0x584cc5['query']=_['keys'](_0x56fde2[_0x12e3('0x3c')]);_0x584cc5[_0x12e3('0x3d')]=_[_0x12e3('0x3e')](_0x584cc5['model'],_0x584cc5['query']);_0x1a29b1[_0x12e3('0x3f')]=_['intersection'](_0x584cc5[_0x12e3('0x3b')],qs['fields'](_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x40')]));_0x1a29b1[_0x12e3('0x3f')]=_0x1a29b1['attributes'][_0x12e3('0x41')]?_0x1a29b1[_0x12e3('0x3f')]:_0x584cc5[_0x12e3('0x3b')];if(!_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x42')](_0x12e3('0x43'))){_0x1a29b1['limit']=qs[_0x12e3('0x2a')](_0x56fde2[_0x12e3('0x3c')]['limit']);_0x1a29b1[_0x12e3('0x29')]=qs[_0x12e3('0x29')](_0x56fde2['query'][_0x12e3('0x29')]);}_0x1a29b1[_0x12e3('0x44')]=qs[_0x12e3('0x45')](_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x45')]);_0x1a29b1[_0x12e3('0x46')]=qs[_0x12e3('0x3d')](_['pick'](_0x56fde2[_0x12e3('0x3c')],_0x584cc5[_0x12e3('0x3d')]),_0x31910f);if(_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x47')]){_0x1a29b1[_0x12e3('0x46')]=_[_0x12e3('0x48')](_0x1a29b1[_0x12e3('0x46')],{'$or':_[_0x12e3('0x49')](_0x31910f,function(_0x5539f7){if(_0x5539f7['type']!==_0x12e3('0x4a')){var _0x2db2d1={};_0x2db2d1[_0x5539f7['name']]={'$like':'%'+_0x56fde2[_0x12e3('0x3c')]['filter']+'%'};return _0x2db2d1;}})});}_0x1a29b1=_[_0x12e3('0x48')]({},_0x1a29b1,_0x56fde2[_0x12e3('0x4b')]);var _0x2b75aa={'where':_0x1a29b1[_0x12e3('0x46')]};return db[_0x12e3('0x37')][_0x12e3('0x4c')](_0x2b75aa)['then'](function(_0x4f9a5e){_0x61a053['count']=_0x4f9a5e;if(_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x4d')]){_0x1a29b1['include']=[{'all':!![]}];}return db['VoiceContext'][_0x12e3('0x4e')](_0x1a29b1);})['then'](function(_0x117af4){_0x61a053[_0x12e3('0x4f')]=_0x117af4;return _0x61a053;})[_0x12e3('0x1b')](respondWithFilteredResult(_0x14f0d1,_0x1a29b1))[_0x12e3('0x50')](handleError(_0x14f0d1,null));};exports[_0x12e3('0x51')]=function(_0x1b129a,_0x20fb60){var _0x5541db={'raw':![],'where':{'id':_0x1b129a[_0x12e3('0x52')]['id']}},_0x193ef7={};_0x193ef7['model']=_['keys'](db[_0x12e3('0x37')][_0x12e3('0x38')]);_0x193ef7[_0x12e3('0x3c')]=_['keys'](_0x1b129a[_0x12e3('0x3c')]);_0x193ef7[_0x12e3('0x3d')]=_[_0x12e3('0x3e')](_0x193ef7['model'],_0x193ef7[_0x12e3('0x3c')]);_0x5541db[_0x12e3('0x3f')]=_[_0x12e3('0x3e')](_0x193ef7['model'],qs[_0x12e3('0x40')](_0x1b129a[_0x12e3('0x3c')][_0x12e3('0x40')]));_0x5541db[_0x12e3('0x3f')]=_0x5541db[_0x12e3('0x3f')][_0x12e3('0x41')]?_0x5541db[_0x12e3('0x3f')]:_0x193ef7[_0x12e3('0x3b')];if(_0x1b129a[_0x12e3('0x3c')][_0x12e3('0x4d')]){_0x5541db[_0x12e3('0x53')]=[{'all':!![]}];}_0x5541db=_[_0x12e3('0x48')]({},_0x5541db,_0x1b129a[_0x12e3('0x4b')]);return db[_0x12e3('0x37')][_0x12e3('0x54')](_0x5541db)['then'](handleEntityNotFound(_0x20fb60,null))['then'](respondWithResult(_0x20fb60,null))[_0x12e3('0x50')](handleError(_0x20fb60,null));};exports[_0x12e3('0x55')]=function(_0x37d793,_0x125013,_0x18bda5){var _0x3c17ec;return db[_0x12e3('0x37')]['create'](_0x37d793[_0x12e3('0x56')],{'raw':!![]})[_0x12e3('0x1b')](function(_0x5e0a3d){_0x3c17ec=_0x5e0a3d;return db[_0x12e3('0x37')][_0x12e3('0x4e')]({'raw':!![]});})['then'](function(_0x4f0e64){var _0x23ceb2=fs[_0x12e3('0x57')](path[_0x12e3('0x58')](config[_0x12e3('0x59')],_0x12e3('0x5a')),_0x12e3('0x5b'));var _0x39955f=ejs[_0x12e3('0x5c')](_0x23ceb2,{'contexts':_0x4f0e64||[]});fs[_0x12e3('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x39955f);})[_0x12e3('0x1b')](function(){return respondWithRpcPromise('Reload',_0x12e3('0x55'),{'module':_0x12e3('0x5e')});})[_0x12e3('0x1b')](function(){var _0x41d9fe=_0x37d793[_0x12e3('0x5f')][_0x12e3('0x31')]({'plain':!![]});if(!_0x41d9fe)throw new Error(_0x12e3('0x60'));if(_0x41d9fe[_0x12e3('0x61')]===_0x12e3('0x5f')){var _0x189b23=_0x3c17ec[_0x12e3('0x31')]({'plain':!![]});return db[_0x12e3('0x62')][_0x12e3('0x54')]({'where':{'name':_0x12e3('0x32'),'userProfileId':_0x41d9fe[_0x12e3('0x63')]},'raw':!![]})['then'](function(_0x2fd3ba){if(_0x2fd3ba&&_0x2fd3ba[_0x12e3('0x64')]===0x0){return db['UserProfileResource'][_0x12e3('0x55')]({'name':_0x189b23[_0x12e3('0x35')],'resourceId':_0x189b23['id'],'type':_0x2fd3ba[_0x12e3('0x35')],'sectionId':_0x2fd3ba['id']},{})['then'](function(){return _0x3c17ec;});}else{return _0x3c17ec;}})[_0x12e3('0x50')](function(_0x2414d5){logger[_0x12e3('0x1f')](_0x12e3('0x65'),_0x2414d5);throw _0x2414d5;});}return _0x3c17ec;})['then'](respondWithResult(_0x125013,0xc9))[_0x12e3('0x50')](handleError(_0x125013,null));};exports[_0x12e3('0x2f')]=function(_0x1e0a81,_0x570d5e,_0x154734){var _0x1f98b0;return db['VoiceContext'][_0x12e3('0x54')]({'where':{'id':_0x1e0a81[_0x12e3('0x52')]['id']}})[_0x12e3('0x1b')](handleEntityNotFound(_0x570d5e,null))[_0x12e3('0x1b')](saveUpdates(_0x1e0a81[_0x12e3('0x56')],null))[_0x12e3('0x1b')](function(_0xa1527c){if(_0xa1527c){_0x1f98b0=_0xa1527c;return db['VoiceContext'][_0x12e3('0x4e')]({'raw':!![]});}})[_0x12e3('0x1b')](function(_0x485098){var _0x45bb1b=fs[_0x12e3('0x57')](path[_0x12e3('0x58')](config[_0x12e3('0x59')],_0x12e3('0x5a')),'utf8');var _0x44dd0d=ejs['render'](_0x45bb1b,{'contexts':_0x485098||[]});fs['writeFileSync'](_0x12e3('0x66'),_0x44dd0d);})[_0x12e3('0x1b')](function(){return respondWithRpcPromise(_0x12e3('0x67'),_0x12e3('0x2f'),{'module':_0x12e3('0x5e')});})['then'](function(){return _0x1f98b0;})[_0x12e3('0x1b')](respondWithResult(_0x570d5e,null))[_0x12e3('0x50')](handleError(_0x570d5e,null));};exports['destroy']=function(_0x25d281,_0x1438d1,_0x2bc574){var _0xd45690;return db[_0x12e3('0x37')]['find']({'where':{'id':_0x25d281[_0x12e3('0x52')]['id']}})[_0x12e3('0x1b')](handleEntityNotFound(_0x1438d1,null))[_0x12e3('0x1b')](removeEntity(_0x1438d1,null))[_0x12e3('0x1b')](function(){return db[_0x12e3('0x37')]['findAll']({'raw':!![]});})[_0x12e3('0x1b')](function(_0xe73106){var _0x2d8d37=fs[_0x12e3('0x57')](path['join'](config[_0x12e3('0x59')],_0x12e3('0x5a')),'utf8');var _0x408987=ejs[_0x12e3('0x5c')](_0x2d8d37,{'contexts':_0xe73106});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x408987);return respondWithRpcPromise(_0x12e3('0x67'),_0x12e3('0x30'),{'module':_0x12e3('0x5e')});})[_0x12e3('0x50')](handleError(_0x1438d1,null));}; \ No newline at end of file +var _0x6170=['request\x20sent','stringify','error','code','message','result','sendStatus','status','count','offset','set','Content-Range','json','reject','update','destroy','get','UserProfileResource','stack','send','index','map','VoiceContext','type','key','model','name','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','params','rawAttributes','length','include','find','create','body','findAll','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x3002ae,_0x495bec){var _0x19913a=function(_0x31ae5d){while(--_0x31ae5d){_0x3002ae['push'](_0x3002ae['shift']());}};_0x19913a(++_0x495bec);}(_0x6170,0x17d));var _0x0617=function(_0x380d29,_0x415418){_0x380d29=_0x380d29-0x0;var _0x40b504=_0x6170[_0x380d29];return _0x40b504;};'use strict';var pdf=require(_0x0617('0x0'));var emlformat=require(_0x0617('0x1'));var rimraf=require(_0x0617('0x2'));var zipdir=require(_0x0617('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0617('0x4'));var moment=require(_0x0617('0x5'));var BPromise=require(_0x0617('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0617('0x7'));var csv=require('to-csv');var ejs=require(_0x0617('0x8'));var fs=require('fs');var _=require(_0x0617('0x9'));var squel=require(_0x0617('0xa'));var crypto=require(_0x0617('0xb'));var jsforce=require(_0x0617('0xc'));var deskjs=require(_0x0617('0xd'));var toCsv=require(_0x0617('0xe'));var querystring=require(_0x0617('0xf'));var Papa=require(_0x0617('0x10'));var Redis=require(_0x0617('0x11'));var authService=require(_0x0617('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0617('0x13'));var hardwareService=require(_0x0617('0x14'));var logger=require(_0x0617('0x15'))('api');var utils=require(_0x0617('0x16'));var config=require(_0x0617('0x17'));var licenseUtil=require(_0x0617('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0617('0x19'));var client=jayson[_0x0617('0x1a')][_0x0617('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x254e59,_0x4dd063,_0x330864,_0x9229fc){return new BPromise(function(_0x530072,_0x221fb4){var _0x5d6f08=_0x9229fc||client;return _0x5d6f08['request'](_0x254e59,_0x330864)[_0x0617('0x1c')](function(_0x16e870){logger[_0x0617('0x1d')](_0x0617('0x1e'),_0x4dd063,_0x0617('0x1f'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4dd063,_0x0617('0x1f'),JSON[_0x0617('0x20')](_0x16e870));if(_0x16e870[_0x0617('0x21')]){if(_0x16e870[_0x0617('0x21')][_0x0617('0x22')]===0x1f4){logger[_0x0617('0x21')](_0x0617('0x1e'),_0x4dd063,_0x16e870[_0x0617('0x21')][_0x0617('0x23')]);return _0x221fb4(_0x16e870['error'][_0x0617('0x23')]);}logger[_0x0617('0x21')](_0x0617('0x1e'),_0x4dd063,_0x16e870['error'][_0x0617('0x23')]);return _0x530072(_0x16e870[_0x0617('0x21')]['message']);}else{logger[_0x0617('0x1d')](_0x0617('0x1e'),_0x4dd063,'request\x20sent');_0x530072(_0x16e870[_0x0617('0x24')][_0x0617('0x23')]);}})['catch'](function(_0x2a8f70){logger[_0x0617('0x21')](_0x0617('0x1e'),_0x4dd063,_0x2a8f70);_0x221fb4(_0x2a8f70);});});}function respondWithStatusCode(_0x475aaf,_0x5a3ad8){_0x5a3ad8=_0x5a3ad8||0xcc;return function(_0x5989b8){if(_0x5989b8){return _0x475aaf[_0x0617('0x25')](_0x5a3ad8);}return _0x475aaf[_0x0617('0x26')](_0x5a3ad8)['end']();};}function respondWithResult(_0x193b81,_0x40df17){_0x40df17=_0x40df17||0xc8;return function(_0x5bc350){if(_0x5bc350){return _0x193b81[_0x0617('0x26')](_0x40df17)['json'](_0x5bc350);}};}function respondWithFilteredResult(_0x2c0148,_0x45f00d){return function(_0xaba0f8){if(_0xaba0f8){var _0x45aef5=_0xaba0f8[_0x0617('0x27')],_0x903c59=_0x45f00d[_0x0617('0x28')],_0x269238=_0x45f00d[_0x0617('0x28')]+_0x45f00d['limit'],_0x32ef28;if(_0x269238>=_0x45aef5){_0x269238=_0x45aef5;_0x32ef28=0xc8;}else{_0x32ef28=0xce;}_0x2c0148[_0x0617('0x26')](_0x32ef28);return _0x2c0148[_0x0617('0x29')](_0x0617('0x2a'),_0x903c59+'-'+_0x269238+'/'+_0x45aef5)[_0x0617('0x2b')](_0xaba0f8);}return null;};}function patchUpdates(_0x94815c){return function(_0x47ed12){try{jsonpatch['apply'](_0x47ed12,_0x94815c,!![]);}catch(_0x351b37){return BPromise[_0x0617('0x2c')](_0x351b37);}return _0x47ed12['save']();};}function saveUpdates(_0x58f146,_0x211f35){return function(_0x3388b7){if(_0x3388b7){return _0x3388b7[_0x0617('0x2d')](_0x58f146)[_0x0617('0x1c')](function(_0x5d0896){return _0x5d0896;});}return null;};}function removeEntity(_0x537354,_0x4ff00f){return function(_0x2dded3){if(_0x2dded3){return _0x2dded3[_0x0617('0x2e')]()[_0x0617('0x1c')](function(){var _0x2eaf09=_0x2dded3[_0x0617('0x2f')]({'plain':!![]});var _0x159600='Contexts';return db[_0x0617('0x30')][_0x0617('0x2e')]({'where':{'type':_0x159600,'resourceId':_0x2eaf09['id']}})[_0x0617('0x1c')](function(){return _0x2dded3;});})[_0x0617('0x1c')](function(){_0x537354[_0x0617('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x180466,_0x148405){return function(_0x4a5bc4){if(!_0x4a5bc4){_0x180466[_0x0617('0x25')](0x194);}return _0x4a5bc4;};}function handleError(_0x87ff21,_0x1b57cc){_0x1b57cc=_0x1b57cc||0x1f4;return function(_0x400fc6){logger[_0x0617('0x21')](_0x400fc6[_0x0617('0x31')]);if(_0x400fc6['name']){delete _0x400fc6['name'];}_0x87ff21[_0x0617('0x26')](_0x1b57cc)[_0x0617('0x32')](_0x400fc6);};}exports[_0x0617('0x33')]=function(_0x4b0b90,_0x3634d0){var _0x175777={},_0x5bd03b={},_0x4fa32d={'count':0x0,'rows':[]};var _0x1cfd47=_[_0x0617('0x34')](db[_0x0617('0x35')]['rawAttributes'],function(_0x330f4a){return{'name':_0x330f4a['fieldName'],'type':_0x330f4a[_0x0617('0x36')][_0x0617('0x37')]};});_0x5bd03b[_0x0617('0x38')]=_[_0x0617('0x34')](_0x1cfd47,_0x0617('0x39'));_0x5bd03b[_0x0617('0x3a')]=_[_0x0617('0x3b')](_0x4b0b90[_0x0617('0x3a')]);_0x5bd03b[_0x0617('0x3c')]=_['intersection'](_0x5bd03b['model'],_0x5bd03b[_0x0617('0x3a')]);_0x175777[_0x0617('0x3d')]=_[_0x0617('0x3e')](_0x5bd03b[_0x0617('0x38')],qs[_0x0617('0x3f')](_0x4b0b90[_0x0617('0x3a')]['fields']));_0x175777[_0x0617('0x3d')]=_0x175777[_0x0617('0x3d')]['length']?_0x175777[_0x0617('0x3d')]:_0x5bd03b[_0x0617('0x38')];if(!_0x4b0b90[_0x0617('0x3a')]['hasOwnProperty'](_0x0617('0x40'))){_0x175777[_0x0617('0x41')]=qs[_0x0617('0x41')](_0x4b0b90[_0x0617('0x3a')][_0x0617('0x41')]);_0x175777[_0x0617('0x28')]=qs['offset'](_0x4b0b90[_0x0617('0x3a')]['offset']);}_0x175777[_0x0617('0x42')]=qs[_0x0617('0x43')](_0x4b0b90[_0x0617('0x3a')][_0x0617('0x43')]);_0x175777['where']=qs[_0x0617('0x3c')](_[_0x0617('0x44')](_0x4b0b90[_0x0617('0x3a')],_0x5bd03b[_0x0617('0x3c')]),_0x1cfd47);if(_0x4b0b90[_0x0617('0x3a')][_0x0617('0x45')]){_0x175777[_0x0617('0x46')]=_['merge'](_0x175777[_0x0617('0x46')],{'$or':_[_0x0617('0x34')](_0x1cfd47,function(_0x44cfab){if(_0x44cfab[_0x0617('0x36')]!==_0x0617('0x47')){var _0x6b44f0={};_0x6b44f0[_0x44cfab[_0x0617('0x39')]]={'$like':'%'+_0x4b0b90[_0x0617('0x3a')][_0x0617('0x45')]+'%'};return _0x6b44f0;}})});}_0x175777=_[_0x0617('0x48')]({},_0x175777,_0x4b0b90[_0x0617('0x49')]);var _0x22c691={'where':_0x175777['where']};return db[_0x0617('0x35')][_0x0617('0x27')](_0x22c691)[_0x0617('0x1c')](function(_0x207400){_0x4fa32d[_0x0617('0x27')]=_0x207400;if(_0x4b0b90[_0x0617('0x3a')][_0x0617('0x4a')]){_0x175777['include']=[{'all':!![]}];}return db[_0x0617('0x35')]['findAll'](_0x175777);})[_0x0617('0x1c')](function(_0x71ded){_0x4fa32d[_0x0617('0x4b')]=_0x71ded;return _0x4fa32d;})[_0x0617('0x1c')](respondWithFilteredResult(_0x3634d0,_0x175777))['catch'](handleError(_0x3634d0,null));};exports['show']=function(_0x520f36,_0x44b3cb){var _0x1f83cc={'raw':![],'where':{'id':_0x520f36[_0x0617('0x4c')]['id']}},_0x420aba={};_0x420aba[_0x0617('0x38')]=_['keys'](db[_0x0617('0x35')][_0x0617('0x4d')]);_0x420aba['query']=_[_0x0617('0x3b')](_0x520f36[_0x0617('0x3a')]);_0x420aba[_0x0617('0x3c')]=_[_0x0617('0x3e')](_0x420aba[_0x0617('0x38')],_0x420aba[_0x0617('0x3a')]);_0x1f83cc[_0x0617('0x3d')]=_[_0x0617('0x3e')](_0x420aba[_0x0617('0x38')],qs[_0x0617('0x3f')](_0x520f36[_0x0617('0x3a')]['fields']));_0x1f83cc[_0x0617('0x3d')]=_0x1f83cc[_0x0617('0x3d')][_0x0617('0x4e')]?_0x1f83cc[_0x0617('0x3d')]:_0x420aba[_0x0617('0x38')];if(_0x520f36['query'][_0x0617('0x4a')]){_0x1f83cc[_0x0617('0x4f')]=[{'all':!![]}];}_0x1f83cc=_[_0x0617('0x48')]({},_0x1f83cc,_0x520f36[_0x0617('0x49')]);return db['VoiceContext'][_0x0617('0x50')](_0x1f83cc)['then'](handleEntityNotFound(_0x44b3cb,null))[_0x0617('0x1c')](respondWithResult(_0x44b3cb,null))['catch'](handleError(_0x44b3cb,null));};exports[_0x0617('0x51')]=function(_0x213d32,_0x5376c3,_0x6f8cfe){var _0x4b687b;return db[_0x0617('0x35')]['create'](_0x213d32[_0x0617('0x52')],{'raw':!![]})['then'](function(_0x491a40){_0x4b687b=_0x491a40;return db[_0x0617('0x35')][_0x0617('0x53')]({'raw':!![]});})[_0x0617('0x1c')](function(_0x2a3bc7){var _0x1d42f1=fs['readFileSync'](path['join'](config['root'],_0x0617('0x54')),_0x0617('0x55'));var _0x379e85=ejs[_0x0617('0x56')](_0x1d42f1,{'contexts':_0x2a3bc7||[]});fs[_0x0617('0x57')](_0x0617('0x58'),_0x379e85);})[_0x0617('0x1c')](function(){return respondWithRpcPromise(_0x0617('0x59'),_0x0617('0x51'),{'module':_0x0617('0x5a')});})[_0x0617('0x1c')](function(){var _0x49d306=_0x213d32['user'][_0x0617('0x2f')]({'plain':!![]});if(!_0x49d306)throw new Error(_0x0617('0x5b'));if(_0x49d306[_0x0617('0x5c')]===_0x0617('0x5d')){var _0x5b61f4=_0x4b687b['get']({'plain':!![]});return db[_0x0617('0x5e')][_0x0617('0x50')]({'where':{'name':_0x0617('0x5f'),'userProfileId':_0x49d306[_0x0617('0x60')]},'raw':!![]})[_0x0617('0x1c')](function(_0x25126d){if(_0x25126d&&_0x25126d[_0x0617('0x61')]===0x0){return db[_0x0617('0x30')][_0x0617('0x51')]({'name':_0x5b61f4[_0x0617('0x39')],'resourceId':_0x5b61f4['id'],'type':_0x25126d[_0x0617('0x39')],'sectionId':_0x25126d['id']},{})['then'](function(){return _0x4b687b;});}else{return _0x4b687b;}})[_0x0617('0x62')](function(_0x59b23f){logger[_0x0617('0x21')](_0x0617('0x63'),_0x59b23f);throw _0x59b23f;});}return _0x4b687b;})[_0x0617('0x1c')](respondWithResult(_0x5376c3,0xc9))[_0x0617('0x62')](handleError(_0x5376c3,null));};exports[_0x0617('0x2d')]=function(_0x79ac67,_0x5342c2,_0x419b6e){var _0x5ef573;return db[_0x0617('0x35')][_0x0617('0x50')]({'where':{'id':_0x79ac67[_0x0617('0x4c')]['id']}})[_0x0617('0x1c')](handleEntityNotFound(_0x5342c2,null))[_0x0617('0x1c')](saveUpdates(_0x79ac67[_0x0617('0x52')],null))[_0x0617('0x1c')](function(_0x37b79d){if(_0x37b79d){_0x5ef573=_0x37b79d;return db[_0x0617('0x35')][_0x0617('0x53')]({'raw':!![]});}})[_0x0617('0x1c')](function(_0x49c519){var _0x59cbd9=fs[_0x0617('0x64')](path[_0x0617('0x65')](config['root'],_0x0617('0x54')),_0x0617('0x55'));var _0x2e872a=ejs[_0x0617('0x56')](_0x59cbd9,{'contexts':_0x49c519||[]});fs[_0x0617('0x57')](_0x0617('0x58'),_0x2e872a);})[_0x0617('0x1c')](function(){return respondWithRpcPromise(_0x0617('0x59'),'update',{'module':'chan_sip.so'});})['then'](function(){return _0x5ef573;})[_0x0617('0x1c')](respondWithResult(_0x5342c2,null))['catch'](handleError(_0x5342c2,null));};exports[_0x0617('0x2e')]=function(_0x2020a6,_0x4b84a9,_0x15ace8){var _0x43a8ee;return db[_0x0617('0x35')]['find']({'where':{'id':_0x2020a6[_0x0617('0x4c')]['id']}})[_0x0617('0x1c')](handleEntityNotFound(_0x4b84a9,null))[_0x0617('0x1c')](removeEntity(_0x4b84a9,null))[_0x0617('0x1c')](function(){return db['VoiceContext'][_0x0617('0x53')]({'raw':!![]});})['then'](function(_0x4a20b8){var _0x2e1d29=fs[_0x0617('0x64')](path[_0x0617('0x65')](config[_0x0617('0x66')],_0x0617('0x54')),_0x0617('0x55'));var _0x3b87e9=ejs[_0x0617('0x56')](_0x2e1d29,{'contexts':_0x4a20b8});fs['writeFileSync'](_0x0617('0x58'),_0x3b87e9);return respondWithRpcPromise(_0x0617('0x59'),_0x0617('0x2e'),{'module':_0x0617('0x5a')});})[_0x0617('0x62')](handleError(_0x4b84a9,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5f2f720..9f19371 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 _0x7fb9=['util','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts'];(function(_0x37feab,_0x1e4e8b){var _0x4e81e7=function(_0x323de7){while(--_0x323de7){_0x37feab['push'](_0x37feab['shift']());}};_0x4e81e7(++_0x1e4e8b);}(_0x7fb9,0x15e));var _0x97fb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7fb9[_0x397cfb];return _0x15fed9;};'use strict';var _=require('lodash');var util=require(_0x97fb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x97fb('0x1'));var BPromise=require(_0x97fb('0x2'));var rp=require(_0x97fb('0x3'));var fs=require('fs');var path=require(_0x97fb('0x4'));var rimraf=require('rimraf');var config=require(_0x97fb('0x5'));var attributes=require(_0x97fb('0x6'));module[_0x97fb('0x7')]=function(_0x50b63b,_0x13dd02){return _0x50b63b['define'](_0x97fb('0x8'),attributes,{'tableName':_0x97fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe7b=['path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','moment','bluebird'];(function(_0x5e7ba1,_0x3940d9){var _0x2c80a6=function(_0x14a81d){while(--_0x14a81d){_0x5e7ba1['push'](_0x5e7ba1['shift']());}};_0x2c80a6(++_0x3940d9);}(_0xbe7b,0x194));var _0xbbe7=function(_0x3eb998,_0x4f5cee){_0x3eb998=_0x3eb998-0x0;var _0x272be1=_0xbe7b[_0x3eb998];return _0x272be1;};'use strict';var _=require(_0xbbe7('0x0'));var util=require(_0xbbe7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbbe7('0x2'));var BPromise=require(_0xbbe7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbe7('0x4'));var rimraf=require(_0xbbe7('0x5'));var config=require(_0xbbe7('0x6'));var attributes=require(_0xbbe7('0x7'));module[_0xbbe7('0x8')]=function(_0x100885,_0x5aed80){return _0x100885[_0xbbe7('0x9')](_0xbbe7('0xa'),attributes,{'tableName':_0xbbe7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 22aac91..b2a853a 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 _0x0360=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4484c2,_0x38a289){var _0x510748=function(_0x3e4fd1){while(--_0x3e4fd1){_0x4484c2['push'](_0x4484c2['shift']());}};_0x510748(++_0x38a289);}(_0x0360,0x15c));var _0x0036=function(_0x376ac8,_0x4d43a0){_0x376ac8=_0x376ac8-0x0;var _0x399eae=_0x0360[_0x376ac8];return _0x399eae;};'use strict';var _=require('lodash');var util=require(_0x0036('0x0'));var moment=require(_0x0036('0x1'));var BPromise=require(_0x0036('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0036('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0036('0x4'));var logger=require('../../config/logger')(_0x0036('0x5'));var config=require(_0x0036('0x6'));var jayson=require(_0x0036('0x7'));var client=jayson[_0x0036('0x8')][_0x0036('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5981a1,_0x31f672,_0x36956b){return new BPromise(function(_0x503597,_0x28d21c){return client[_0x0036('0xa')](_0x5981a1,_0x36956b)[_0x0036('0xb')](function(_0x5a1bbb){logger[_0x0036('0xc')](_0x0036('0xd'),_0x31f672,_0x0036('0xe'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x31f672,'request\x20sent',JSON['stringify'](_0x5a1bbb));if(_0x5a1bbb[_0x0036('0xf')]){if(_0x5a1bbb[_0x0036('0xf')][_0x0036('0x10')]===0x1f4){logger[_0x0036('0xf')](_0x0036('0xd'),_0x31f672,_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);return _0x28d21c(_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);}logger['error'](_0x0036('0xd'),_0x31f672,_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);return _0x503597(_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);}else{logger[_0x0036('0xc')](_0x0036('0xd'),_0x31f672,_0x0036('0xe'));_0x503597(_0x5a1bbb[_0x0036('0x12')][_0x0036('0x11')]);}})[_0x0036('0x13')](function(_0x1b5544){logger[_0x0036('0xf')](_0x0036('0xd'),_0x31f672,_0x1b5544);_0x28d21c(_0x1b5544);});});} \ No newline at end of file +var _0x8032=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment'];(function(_0x2dda23,_0x4da5f0){var _0x5f100d=function(_0x4b55e6){while(--_0x4b55e6){_0x2dda23['push'](_0x2dda23['shift']());}};_0x5f100d(++_0x4da5f0);}(_0x8032,0xd7));var _0x2803=function(_0x2b395a,_0x35db69){_0x2b395a=_0x2b395a-0x0;var _0x1beba0=_0x8032[_0x2b395a];return _0x1beba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2803('0x0'));var BPromise=require(_0x2803('0x1'));var rs=require(_0x2803('0x2'));var fs=require('fs');var Redis=require(_0x2803('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2803('0x4'));var logger=require(_0x2803('0x5'))('rpc');var config=require(_0x2803('0x6'));var jayson=require(_0x2803('0x7'));var client=jayson['client'][_0x2803('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2417ba,_0x3c3aec,_0x5f32da){return new BPromise(function(_0xee9255,_0x2af770){return client[_0x2803('0x9')](_0x2417ba,_0x5f32da)['then'](function(_0x4faec4){logger['info'](_0x2803('0xa'),_0x3c3aec,_0x2803('0xb'));logger[_0x2803('0xc')](_0x2803('0xd'),_0x3c3aec,'request\x20sent',JSON[_0x2803('0xe')](_0x4faec4));if(_0x4faec4['error']){if(_0x4faec4[_0x2803('0xf')][_0x2803('0x10')]===0x1f4){logger[_0x2803('0xf')](_0x2803('0xa'),_0x3c3aec,_0x4faec4['error'][_0x2803('0x11')]);return _0x2af770(_0x4faec4[_0x2803('0xf')][_0x2803('0x11')]);}logger[_0x2803('0xf')](_0x2803('0xa'),_0x3c3aec,_0x4faec4[_0x2803('0xf')][_0x2803('0x11')]);return _0xee9255(_0x4faec4[_0x2803('0xf')][_0x2803('0x11')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3c3aec,_0x2803('0xb'));_0xee9255(_0x4faec4['result'][_0x2803('0x11')]);}})['catch'](function(_0x48ae98){logger[_0x2803('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3c3aec,_0x48ae98);_0x2af770(_0x48ae98);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d29965b..2275363 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 _0x71d8=['get','isAuthenticated','index','/describe','/:id','show','post','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x47ec21,_0x9ec608){var _0x4113b1=function(_0x9d7e63){while(--_0x9d7e63){_0x47ec21['push'](_0x47ec21['shift']());}};_0x4113b1(++_0x9ec608);}(_0x71d8,0x13c));var _0x871d=function(_0x2a7c45,_0x33185c){_0x2a7c45=_0x2a7c45-0x0;var _0x45c675=_0x71d8[_0x2a7c45];return _0x45c675;};'use strict';var multer=require('multer');var util=require(_0x871d('0x0'));var path=require(_0x871d('0x1'));var timeout=require('connect-timeout');var express=require(_0x871d('0x2'));var router=express[_0x871d('0x3')]();var auth=require(_0x871d('0x4'));var interaction=require(_0x871d('0x5'));var config=require(_0x871d('0x6'));var controller=require(_0x871d('0x7'));router[_0x871d('0x8')]('/',auth[_0x871d('0x9')](),controller[_0x871d('0xa')]);router[_0x871d('0x8')](_0x871d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x871d('0xc'),auth[_0x871d('0x9')](),controller[_0x871d('0xd')]);router[_0x871d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x871d('0xc'),auth[_0x871d('0x9')](),controller[_0x871d('0xf')]);router[_0x871d('0x10')](_0x871d('0xc'),auth[_0x871d('0x9')](),controller['destroy']);module[_0x871d('0x11')]=router; \ No newline at end of file +var _0xd682=['isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x78b79f,_0x6c3319){var _0x24db0e=function(_0x31b059){while(--_0x31b059){_0x78b79f['push'](_0x78b79f['shift']());}};_0x24db0e(++_0x6c3319);}(_0xd682,0x102));var _0x2d68=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd682[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x2d68('0x0'));var util=require('util');var path=require(_0x2d68('0x1'));var timeout=require(_0x2d68('0x2'));var express=require(_0x2d68('0x3'));var router=express['Router']();var auth=require(_0x2d68('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2d68('0x5'));var controller=require(_0x2d68('0x6'));router[_0x2d68('0x7')]('/',auth[_0x2d68('0x8')](),controller[_0x2d68('0x9')]);router['get'](_0x2d68('0xa'),auth[_0x2d68('0x8')](),controller[_0x2d68('0xb')]);router['get'](_0x2d68('0xc'),auth[_0x2d68('0x8')](),controller[_0x2d68('0xd')]);router[_0x2d68('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d68('0xf')]('/:id',auth[_0x2d68('0x8')](),controller[_0x2d68('0x10')]);router['delete'](_0x2d68('0xc'),auth['isAuthenticated'](),controller[_0x2d68('0x11')]);module[_0x2d68('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5676995..775e2f9 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 _0x060d=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x3fd22e,_0x3d57e5){var _0x1e1666=function(_0x25d47b){while(--_0x25d47b){_0x3fd22e['push'](_0x3fd22e['shift']());}};_0x1e1666(++_0x3d57e5);}(_0x060d,0x112));var _0xd060=function(_0x5665a8,_0xaf288d){_0x5665a8=_0x5665a8-0x0;var _0x2d5928=_0x060d[_0x5665a8];return _0x2d5928;};'use strict';var Sequelize=require(_0xd060('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd060('0x1')]},'channel':{'type':Sequelize[_0xd060('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd060('0x1')]},'calleridnum':{'type':Sequelize[_0xd060('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd060('0x1')]},'connectedlinename':{'type':Sequelize[_0xd060('0x1')]},'language':{'type':Sequelize[_0xd060('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd060('0x1')]},'exten':{'type':Sequelize[_0xd060('0x1')]},'priority':{'type':Sequelize[_0xd060('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd060('0x1')]},'destchannel':{'type':Sequelize[_0xd060('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd060('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd060('0x1')]},'destcalleridname':{'type':Sequelize[_0xd060('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd060('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd060('0x1')]},'destlanguage':{'type':Sequelize[_0xd060('0x1')]},'destaccountcode':{'type':Sequelize[_0xd060('0x1')]},'destcontext':{'type':Sequelize[_0xd060('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd060('0x2')]},'destuniqueid':{'type':Sequelize[_0xd060('0x1')]},'destlinkedid':{'type':Sequelize[_0xd060('0x1')]},'dialstring':{'type':Sequelize[_0xd060('0x1')]},'dialstatus':{'type':Sequelize[_0xd060('0x1')]},'starttime':{'type':Sequelize[_0xd060('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd060('0x3')]},'lastevent':{'type':Sequelize[_0xd060('0x1')],'comment':_0xd060('0x4')},'routeId':{'type':Sequelize[_0xd060('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd060('0x2')]},'billableseconds':{'type':Sequelize[_0xd060('0x2')]}}; \ No newline at end of file +var _0x9ad8=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x216cfa,_0x22c924){var _0x96bd7a=function(_0x5cbc56){while(--_0x5cbc56){_0x216cfa['push'](_0x216cfa['shift']());}};_0x96bd7a(++_0x22c924);}(_0x9ad8,0x13b));var _0x89ad=function(_0x11fb16,_0x29a381){_0x11fb16=_0x11fb16-0x0;var _0x343de1=_0x9ad8[_0x11fb16];return _0x343de1;};'use strict';var Sequelize=require(_0x89ad('0x0'));module[_0x89ad('0x1')]={'privilege':{'type':Sequelize[_0x89ad('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x89ad('0x2')]},'calleridnum':{'type':Sequelize[_0x89ad('0x2')]},'calleridname':{'type':Sequelize[_0x89ad('0x2')]},'connectedlinenum':{'type':Sequelize[_0x89ad('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x89ad('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x89ad('0x3')]},'uniqueid':{'type':Sequelize[_0x89ad('0x2')]},'linkedid':{'type':Sequelize[_0x89ad('0x2')]},'destchannel':{'type':Sequelize[_0x89ad('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x89ad('0x2')]},'destcalleridnum':{'type':Sequelize[_0x89ad('0x2')]},'destcalleridname':{'type':Sequelize[_0x89ad('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x89ad('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x89ad('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x89ad('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x89ad('0x2')]},'destlinkedid':{'type':Sequelize[_0x89ad('0x2')]},'dialstring':{'type':Sequelize[_0x89ad('0x2')]},'dialstatus':{'type':Sequelize[_0x89ad('0x2')]},'starttime':{'type':Sequelize[_0x89ad('0x4')]},'answertime':{'type':Sequelize[_0x89ad('0x4')]},'endtime':{'type':Sequelize[_0x89ad('0x4')]},'lastevent':{'type':Sequelize[_0x89ad('0x2')],'comment':_0x89ad('0x5')},'routeId':{'type':Sequelize[_0x89ad('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x89ad('0x3')]},'billableseconds':{'type':Sequelize[_0x89ad('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b1d95d7..fdcab77 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 _0x5b08=['create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','findAll','rows','catch','show','params'];(function(_0x3ae018,_0x10e030){var _0x5296db=function(_0x2d08f9){while(--_0x2d08f9){_0x3ae018['push'](_0x3ae018['shift']());}};_0x5296db(++_0x10e030);}(_0x5b08,0xa0));var _0x85b0=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x5b08[_0x2b0a86];return _0x955940;};'use strict';var pdf=require(_0x85b0('0x0'));var emlformat=require(_0x85b0('0x1'));var rimraf=require(_0x85b0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85b0('0x3'));var rp=require(_0x85b0('0x4'));var moment=require(_0x85b0('0x5'));var BPromise=require(_0x85b0('0x6'));var Mustache=require(_0x85b0('0x7'));var util=require(_0x85b0('0x8'));var path=require(_0x85b0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85b0('0xa'));var fs=require('fs');var _=require(_0x85b0('0xb'));var squel=require(_0x85b0('0xc'));var crypto=require(_0x85b0('0xd'));var jsforce=require(_0x85b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85b0('0xf'));var querystring=require(_0x85b0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x85b0('0x11'));var as=require(_0x85b0('0x12'));var hardwareService=require(_0x85b0('0x13'));var logger=require('../../config/logger')(_0x85b0('0x14'));var utils=require(_0x85b0('0x15'));var config=require(_0x85b0('0x16'));var licenseUtil=require(_0x85b0('0x17'));var db=require(_0x85b0('0x18'))['db'];function respondWithStatusCode(_0x4e0b4c,_0x1e5e68){_0x1e5e68=_0x1e5e68||0xcc;return function(_0x539488){if(_0x539488){return _0x4e0b4c[_0x85b0('0x19')](_0x1e5e68);}return _0x4e0b4c[_0x85b0('0x1a')](_0x1e5e68)[_0x85b0('0x1b')]();};}function respondWithResult(_0x5ac264,_0x2185a8){_0x2185a8=_0x2185a8||0xc8;return function(_0xfe0f34){if(_0xfe0f34){return _0x5ac264[_0x85b0('0x1a')](_0x2185a8)[_0x85b0('0x1c')](_0xfe0f34);}};}function respondWithFilteredResult(_0x519a13,_0x1cc933){return function(_0x2df506){if(_0x2df506){var _0x5dc1c0=_0x2df506[_0x85b0('0x1d')],_0x174bb9=_0x1cc933[_0x85b0('0x1e')],_0x90e098=_0x1cc933[_0x85b0('0x1e')]+_0x1cc933['limit'],_0x544217;if(_0x90e098>=_0x5dc1c0){_0x90e098=_0x5dc1c0;_0x544217=0xc8;}else{_0x544217=0xce;}_0x519a13[_0x85b0('0x1a')](_0x544217);return _0x519a13[_0x85b0('0x1f')](_0x85b0('0x20'),_0x174bb9+'-'+_0x90e098+'/'+_0x5dc1c0)['json'](_0x2df506);}return null;};}function patchUpdates(_0x82b477){return function(_0x12ea09){try{jsonpatch[_0x85b0('0x21')](_0x12ea09,_0x82b477,!![]);}catch(_0xf1d79f){return BPromise[_0x85b0('0x22')](_0xf1d79f);}return _0x12ea09[_0x85b0('0x23')]();};}function saveUpdates(_0x2891b8,_0x4375b9){return function(_0x5b89e4){if(_0x5b89e4){return _0x5b89e4[_0x85b0('0x24')](_0x2891b8)[_0x85b0('0x25')](function(_0x3e9098){return _0x3e9098;});}return null;};}function removeEntity(_0x136794,_0x21863e){return function(_0x19a95f){if(_0x19a95f){return _0x19a95f[_0x85b0('0x26')]()[_0x85b0('0x25')](function(){_0x136794[_0x85b0('0x1a')](0xcc)[_0x85b0('0x1b')]();});}};}function handleEntityNotFound(_0x40cb95,_0x2d2f8b){return function(_0x25f292){if(!_0x25f292){_0x40cb95[_0x85b0('0x19')](0x194);}return _0x25f292;};}function handleError(_0x7c3716,_0x5d2f18){_0x5d2f18=_0x5d2f18||0x1f4;return function(_0x51812e){logger[_0x85b0('0x27')](_0x51812e[_0x85b0('0x28')]);if(_0x51812e[_0x85b0('0x29')]){delete _0x51812e[_0x85b0('0x29')];}_0x7c3716[_0x85b0('0x1a')](_0x5d2f18)[_0x85b0('0x2a')](_0x51812e);};}exports['index']=function(_0x1e569d,_0x50b4e9){var _0x8277b1={},_0x3f30a8={},_0x4b22d4={'count':0x0,'rows':[]};var _0x407b01=_[_0x85b0('0x2b')](db['VoiceDialReport'][_0x85b0('0x2c')],function(_0x32da48){return{'name':_0x32da48[_0x85b0('0x2d')],'type':_0x32da48[_0x85b0('0x2e')][_0x85b0('0x2f')]};});_0x3f30a8[_0x85b0('0x30')]=_[_0x85b0('0x2b')](_0x407b01,_0x85b0('0x29'));_0x3f30a8[_0x85b0('0x31')]=_[_0x85b0('0x32')](_0x1e569d[_0x85b0('0x31')]);_0x3f30a8[_0x85b0('0x33')]=_[_0x85b0('0x34')](_0x3f30a8[_0x85b0('0x30')],_0x3f30a8[_0x85b0('0x31')]);_0x8277b1[_0x85b0('0x35')]=_[_0x85b0('0x34')](_0x3f30a8[_0x85b0('0x30')],qs[_0x85b0('0x36')](_0x1e569d[_0x85b0('0x31')][_0x85b0('0x36')]));_0x8277b1[_0x85b0('0x35')]=_0x8277b1[_0x85b0('0x35')][_0x85b0('0x37')]?_0x8277b1[_0x85b0('0x35')]:_0x3f30a8[_0x85b0('0x30')];if(!_0x1e569d[_0x85b0('0x31')][_0x85b0('0x38')](_0x85b0('0x39'))){_0x8277b1[_0x85b0('0x3a')]=qs[_0x85b0('0x3a')](_0x1e569d[_0x85b0('0x31')][_0x85b0('0x3a')]);_0x8277b1['offset']=qs[_0x85b0('0x1e')](_0x1e569d[_0x85b0('0x31')][_0x85b0('0x1e')]);}_0x8277b1[_0x85b0('0x3b')]=qs[_0x85b0('0x3c')](_0x1e569d[_0x85b0('0x31')]['sort']);_0x8277b1[_0x85b0('0x3d')]=qs[_0x85b0('0x33')](_[_0x85b0('0x3e')](_0x1e569d[_0x85b0('0x31')],_0x3f30a8['filters']),_0x407b01);if(_0x1e569d['query'][_0x85b0('0x3f')]){_0x8277b1[_0x85b0('0x3d')]=_[_0x85b0('0x40')](_0x8277b1[_0x85b0('0x3d')],{'$or':_[_0x85b0('0x2b')](_0x407b01,function(_0x27445a){if(_0x27445a[_0x85b0('0x2e')]!==_0x85b0('0x41')){var _0x147388={};_0x147388[_0x27445a[_0x85b0('0x29')]]={'$like':'%'+_0x1e569d[_0x85b0('0x31')][_0x85b0('0x3f')]+'%'};return _0x147388;}})});}_0x8277b1=_[_0x85b0('0x40')]({},_0x8277b1,_0x1e569d[_0x85b0('0x42')]);var _0x5484a9={'where':_0x8277b1[_0x85b0('0x3d')]};return db[_0x85b0('0x43')][_0x85b0('0x1d')](_0x5484a9)[_0x85b0('0x25')](function(_0x3807ed){_0x4b22d4[_0x85b0('0x1d')]=_0x3807ed;if(_0x1e569d[_0x85b0('0x31')][_0x85b0('0x44')]){_0x8277b1['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x85b0('0x45')](_0x8277b1);})['then'](function(_0x201f89){_0x4b22d4[_0x85b0('0x46')]=_0x201f89;return _0x4b22d4;})[_0x85b0('0x25')](respondWithFilteredResult(_0x50b4e9,_0x8277b1))[_0x85b0('0x47')](handleError(_0x50b4e9,null));};exports[_0x85b0('0x48')]=function(_0x466017,_0x5d1912){var _0x17adbf={'raw':!![],'where':{'id':_0x466017[_0x85b0('0x49')]['id']}},_0x53e432={};_0x53e432['model']=_['keys'](db[_0x85b0('0x43')][_0x85b0('0x2c')]);_0x53e432[_0x85b0('0x31')]=_[_0x85b0('0x32')](_0x466017[_0x85b0('0x31')]);_0x53e432[_0x85b0('0x33')]=_['intersection'](_0x53e432[_0x85b0('0x30')],_0x53e432['query']);_0x17adbf['attributes']=_[_0x85b0('0x34')](_0x53e432['model'],qs[_0x85b0('0x36')](_0x466017[_0x85b0('0x31')][_0x85b0('0x36')]));_0x17adbf[_0x85b0('0x35')]=_0x17adbf[_0x85b0('0x35')][_0x85b0('0x37')]?_0x17adbf[_0x85b0('0x35')]:_0x53e432['model'];if(_0x466017[_0x85b0('0x31')][_0x85b0('0x44')]){_0x17adbf['include']=[{'all':!![]}];}_0x17adbf=_[_0x85b0('0x40')]({},_0x17adbf,_0x466017[_0x85b0('0x42')]);return db[_0x85b0('0x43')]['find'](_0x17adbf)['then'](handleEntityNotFound(_0x5d1912,null))['then'](respondWithResult(_0x5d1912,null))[_0x85b0('0x47')](handleError(_0x5d1912,null));};exports[_0x85b0('0x4a')]=function(_0x1c8613,_0x51d7a2){return db[_0x85b0('0x43')][_0x85b0('0x4a')](_0x1c8613[_0x85b0('0x4b')],{})['then'](respondWithResult(_0x51d7a2,0xc9))[_0x85b0('0x47')](handleError(_0x51d7a2,null));};exports[_0x85b0('0x24')]=function(_0x3a17bb,_0x578b44){if(_0x3a17bb['body']['id']){delete _0x3a17bb[_0x85b0('0x4b')]['id'];}return db[_0x85b0('0x43')]['find']({'where':{'id':_0x3a17bb[_0x85b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x578b44,null))[_0x85b0('0x25')](saveUpdates(_0x3a17bb['body'],null))[_0x85b0('0x25')](respondWithResult(_0x578b44,null))[_0x85b0('0x47')](handleError(_0x578b44,null));};exports[_0x85b0('0x26')]=function(_0x181697,_0x28ce53){return db[_0x85b0('0x43')][_0x85b0('0x4c')]({'where':{'id':_0x181697[_0x85b0('0x49')]['id']}})[_0x85b0('0x25')](handleEntityNotFound(_0x28ce53,null))['then'](removeEntity(_0x28ce53,null))[_0x85b0('0x47')](handleError(_0x28ce53,null));};exports[_0x85b0('0x4d')]=function(_0xbbc69b,_0x5610fa){return db['VoiceDialReport']['describe']()[_0x85b0('0x25')](respondWithResult(_0x5610fa,null))['catch'](handleError(_0x5610fa,null));}; \ No newline at end of file +var _0x2196=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb'];(function(_0x4ca0d9,_0x34dfac){var _0x2361f4=function(_0xd3aabd){while(--_0xd3aabd){_0x4ca0d9['push'](_0x4ca0d9['shift']());}};_0x2361f4(++_0x34dfac);}(_0x2196,0x152));var _0x6219=function(_0xcdc1e2,_0xe7a35b){_0xcdc1e2=_0xcdc1e2-0x0;var _0x21e4da=_0x2196[_0xcdc1e2];return _0x21e4da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6219('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6219('0x1'));var rp=require('request-promise');var moment=require(_0x6219('0x2'));var BPromise=require(_0x6219('0x3'));var Mustache=require(_0x6219('0x4'));var util=require(_0x6219('0x5'));var path=require(_0x6219('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6219('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6219('0x8'));var crypto=require(_0x6219('0x9'));var jsforce=require(_0x6219('0xa'));var deskjs=require(_0x6219('0xb'));var toCsv=require(_0x6219('0xc'));var querystring=require(_0x6219('0xd'));var Papa=require('papaparse');var Redis=require(_0x6219('0xe'));var authService=require(_0x6219('0xf'));var qs=require(_0x6219('0x10'));var as=require(_0x6219('0x11'));var hardwareService=require(_0x6219('0x12'));var logger=require(_0x6219('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6219('0x14'));var db=require(_0x6219('0x15'))['db'];function respondWithStatusCode(_0x48d59b,_0x4525df){_0x4525df=_0x4525df||0xcc;return function(_0x1c0299){if(_0x1c0299){return _0x48d59b[_0x6219('0x16')](_0x4525df);}return _0x48d59b[_0x6219('0x17')](_0x4525df)[_0x6219('0x18')]();};}function respondWithResult(_0x159c1f,_0x288c82){_0x288c82=_0x288c82||0xc8;return function(_0x395052){if(_0x395052){return _0x159c1f['status'](_0x288c82)[_0x6219('0x19')](_0x395052);}};}function respondWithFilteredResult(_0x383dbb,_0x3e0f55){return function(_0xc3335f){if(_0xc3335f){var _0xa8831a=_0xc3335f[_0x6219('0x1a')],_0x2dbaa5=_0x3e0f55[_0x6219('0x1b')],_0x5c0797=_0x3e0f55['offset']+_0x3e0f55['limit'],_0x40da04;if(_0x5c0797>=_0xa8831a){_0x5c0797=_0xa8831a;_0x40da04=0xc8;}else{_0x40da04=0xce;}_0x383dbb['status'](_0x40da04);return _0x383dbb[_0x6219('0x1c')](_0x6219('0x1d'),_0x2dbaa5+'-'+_0x5c0797+'/'+_0xa8831a)[_0x6219('0x19')](_0xc3335f);}return null;};}function patchUpdates(_0x49a01c){return function(_0x5503a4){try{jsonpatch[_0x6219('0x1e')](_0x5503a4,_0x49a01c,!![]);}catch(_0x42edf4){return BPromise[_0x6219('0x1f')](_0x42edf4);}return _0x5503a4[_0x6219('0x20')]();};}function saveUpdates(_0x364527,_0x2d1e79){return function(_0x3f4b07){if(_0x3f4b07){return _0x3f4b07[_0x6219('0x21')](_0x364527)[_0x6219('0x22')](function(_0x8943df){return _0x8943df;});}return null;};}function removeEntity(_0x3c6416,_0x4a9b36){return function(_0x4aaa31){if(_0x4aaa31){return _0x4aaa31[_0x6219('0x23')]()[_0x6219('0x22')](function(){_0x3c6416['status'](0xcc)[_0x6219('0x18')]();});}};}function handleEntityNotFound(_0x381325,_0x43e084){return function(_0x426f59){if(!_0x426f59){_0x381325[_0x6219('0x16')](0x194);}return _0x426f59;};}function handleError(_0x2c65c7,_0x4d40ce){_0x4d40ce=_0x4d40ce||0x1f4;return function(_0x5ab03){logger[_0x6219('0x24')](_0x5ab03[_0x6219('0x25')]);if(_0x5ab03[_0x6219('0x26')]){delete _0x5ab03[_0x6219('0x26')];}_0x2c65c7[_0x6219('0x17')](_0x4d40ce)[_0x6219('0x27')](_0x5ab03);};}exports['index']=function(_0x4d91e2,_0x7a8a91){var _0x51b721={},_0x2368de={},_0x5ed9bf={'count':0x0,'rows':[]};var _0x3ee2b7=_[_0x6219('0x28')](db[_0x6219('0x29')][_0x6219('0x2a')],function(_0x5d3a6a){return{'name':_0x5d3a6a[_0x6219('0x2b')],'type':_0x5d3a6a[_0x6219('0x2c')][_0x6219('0x2d')]};});_0x2368de[_0x6219('0x2e')]=_[_0x6219('0x28')](_0x3ee2b7,'name');_0x2368de['query']=_[_0x6219('0x2f')](_0x4d91e2['query']);_0x2368de['filters']=_['intersection'](_0x2368de[_0x6219('0x2e')],_0x2368de[_0x6219('0x30')]);_0x51b721['attributes']=_[_0x6219('0x31')](_0x2368de[_0x6219('0x2e')],qs[_0x6219('0x32')](_0x4d91e2['query'][_0x6219('0x32')]));_0x51b721[_0x6219('0x33')]=_0x51b721[_0x6219('0x33')][_0x6219('0x34')]?_0x51b721[_0x6219('0x33')]:_0x2368de[_0x6219('0x2e')];if(!_0x4d91e2['query']['hasOwnProperty'](_0x6219('0x35'))){_0x51b721['limit']=qs[_0x6219('0x36')](_0x4d91e2[_0x6219('0x30')][_0x6219('0x36')]);_0x51b721[_0x6219('0x1b')]=qs['offset'](_0x4d91e2[_0x6219('0x30')]['offset']);}_0x51b721[_0x6219('0x37')]=qs[_0x6219('0x38')](_0x4d91e2[_0x6219('0x30')][_0x6219('0x38')]);_0x51b721[_0x6219('0x39')]=qs[_0x6219('0x3a')](_['pick'](_0x4d91e2['query'],_0x2368de[_0x6219('0x3a')]),_0x3ee2b7);if(_0x4d91e2['query'][_0x6219('0x3b')]){_0x51b721[_0x6219('0x39')]=_['merge'](_0x51b721[_0x6219('0x39')],{'$or':_[_0x6219('0x28')](_0x3ee2b7,function(_0x891ee9){if(_0x891ee9['type']!=='VIRTUAL'){var _0x239dfb={};_0x239dfb[_0x891ee9[_0x6219('0x26')]]={'$like':'%'+_0x4d91e2[_0x6219('0x30')][_0x6219('0x3b')]+'%'};return _0x239dfb;}})});}_0x51b721=_[_0x6219('0x3c')]({},_0x51b721,_0x4d91e2[_0x6219('0x3d')]);var _0x53a526={'where':_0x51b721[_0x6219('0x39')]};return db[_0x6219('0x29')][_0x6219('0x1a')](_0x53a526)[_0x6219('0x22')](function(_0x58766f){_0x5ed9bf[_0x6219('0x1a')]=_0x58766f;if(_0x4d91e2[_0x6219('0x30')][_0x6219('0x3e')]){_0x51b721[_0x6219('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x6219('0x40')](_0x51b721);})[_0x6219('0x22')](function(_0x1d5de2){_0x5ed9bf[_0x6219('0x41')]=_0x1d5de2;return _0x5ed9bf;})[_0x6219('0x22')](respondWithFilteredResult(_0x7a8a91,_0x51b721))['catch'](handleError(_0x7a8a91,null));};exports[_0x6219('0x42')]=function(_0x208a34,_0x119d8c){var _0x4ed0db={'raw':!![],'where':{'id':_0x208a34[_0x6219('0x43')]['id']}},_0x250b8a={};_0x250b8a[_0x6219('0x2e')]=_[_0x6219('0x2f')](db[_0x6219('0x29')][_0x6219('0x2a')]);_0x250b8a[_0x6219('0x30')]=_[_0x6219('0x2f')](_0x208a34['query']);_0x250b8a[_0x6219('0x3a')]=_[_0x6219('0x31')](_0x250b8a[_0x6219('0x2e')],_0x250b8a[_0x6219('0x30')]);_0x4ed0db[_0x6219('0x33')]=_[_0x6219('0x31')](_0x250b8a[_0x6219('0x2e')],qs['fields'](_0x208a34[_0x6219('0x30')]['fields']));_0x4ed0db[_0x6219('0x33')]=_0x4ed0db[_0x6219('0x33')][_0x6219('0x34')]?_0x4ed0db[_0x6219('0x33')]:_0x250b8a[_0x6219('0x2e')];if(_0x208a34[_0x6219('0x30')]['includeAll']){_0x4ed0db[_0x6219('0x3f')]=[{'all':!![]}];}_0x4ed0db=_[_0x6219('0x3c')]({},_0x4ed0db,_0x208a34['options']);return db[_0x6219('0x29')][_0x6219('0x44')](_0x4ed0db)[_0x6219('0x22')](handleEntityNotFound(_0x119d8c,null))[_0x6219('0x22')](respondWithResult(_0x119d8c,null))[_0x6219('0x45')](handleError(_0x119d8c,null));};exports[_0x6219('0x46')]=function(_0x26f055,_0x348365){return db[_0x6219('0x29')][_0x6219('0x46')](_0x26f055['body'],{})[_0x6219('0x22')](respondWithResult(_0x348365,0xc9))[_0x6219('0x45')](handleError(_0x348365,null));};exports[_0x6219('0x21')]=function(_0xa0b40e,_0x2a3523){if(_0xa0b40e[_0x6219('0x47')]['id']){delete _0xa0b40e[_0x6219('0x47')]['id'];}return db[_0x6219('0x29')][_0x6219('0x44')]({'where':{'id':_0xa0b40e[_0x6219('0x43')]['id']}})[_0x6219('0x22')](handleEntityNotFound(_0x2a3523,null))['then'](saveUpdates(_0xa0b40e[_0x6219('0x47')],null))[_0x6219('0x22')](respondWithResult(_0x2a3523,null))[_0x6219('0x45')](handleError(_0x2a3523,null));};exports[_0x6219('0x23')]=function(_0x4026cb,_0x2166be){return db['VoiceDialReport'][_0x6219('0x44')]({'where':{'id':_0x4026cb['params']['id']}})[_0x6219('0x22')](handleEntityNotFound(_0x2166be,null))[_0x6219('0x22')](removeEntity(_0x2166be,null))['catch'](handleError(_0x2166be,null));};exports['describe']=function(_0x5968ed,_0x1b2b36){return db[_0x6219('0x29')]['describe']()[_0x6219('0x22')](respondWithResult(_0x1b2b36,null))[_0x6219('0x45')](handleError(_0x1b2b36,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c22503d..0af2fa1 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 _0xcb30=['bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceDialReport','report_dial','lodash','util','api'];(function(_0xd2d0e2,_0x206b4d){var _0x3fa79b=function(_0xfd6eda){while(--_0xfd6eda){_0xd2d0e2['push'](_0xd2d0e2['shift']());}};_0x3fa79b(++_0x206b4d);}(_0xcb30,0xce));var _0x0cb3=function(_0x10eca9,_0x147bf8){_0x10eca9=_0x10eca9-0x0;var _0x17d5cf=_0xcb30[_0x10eca9];return _0x17d5cf;};'use strict';var _=require(_0x0cb3('0x0'));var util=require(_0x0cb3('0x1'));var logger=require('../../config/logger')(_0x0cb3('0x2'));var moment=require('moment');var BPromise=require(_0x0cb3('0x3'));var rp=require(_0x0cb3('0x4'));var fs=require('fs');var path=require(_0x0cb3('0x5'));var rimraf=require(_0x0cb3('0x6'));var config=require(_0x0cb3('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x2cd72d,_0x28defa){return _0x2cd72d[_0x0cb3('0x8')](_0x0cb3('0x9'),attributes,{'tableName':_0x0cb3('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc45f=['report_dial','uniqueid','lodash','util','api','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport'];(function(_0xa1cb00,_0x160c74){var _0x40e71f=function(_0x51b980){while(--_0x51b980){_0xa1cb00['push'](_0xa1cb00['shift']());}};_0x40e71f(++_0x160c74);}(_0xc45f,0x182));var _0xfc45=function(_0x207f76,_0x2b2ccc){_0x207f76=_0x207f76-0x0;var _0x1eab49=_0xc45f[_0x207f76];return _0x1eab49;};'use strict';var _=require(_0xfc45('0x0'));var util=require(_0xfc45('0x1'));var logger=require('../../config/logger')(_0xfc45('0x2'));var moment=require('moment');var BPromise=require(_0xfc45('0x3'));var rp=require(_0xfc45('0x4'));var fs=require('fs');var path=require(_0xfc45('0x5'));var rimraf=require('rimraf');var config=require(_0xfc45('0x6'));var attributes=require(_0xfc45('0x7'));module['exports']=function(_0x5c8378,_0x2d5e78){return _0x5c8378[_0xfc45('0x8')](_0xfc45('0x9'),attributes,{'tableName':_0xfc45('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfc45('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 febf542..a591609 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 _0x3aa5=['request\x20sent','stringify','error','message','info','result','CreateVoiceDialReport','VoiceDialReport','options','raw','catch','UpdateVoiceDialReport','update','body','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','debug'];(function(_0xc2f6df,_0x3d8598){var _0x5b427b=function(_0x26bdb7){while(--_0x26bdb7){_0xc2f6df['push'](_0xc2f6df['shift']());}};_0x5b427b(++_0x3d8598);}(_0x3aa5,0x1bd));var _0x53aa=function(_0xbb30f3,_0x203773){_0xbb30f3=_0xbb30f3-0x0;var _0x5f58ae=_0x3aa5[_0xbb30f3];return _0x5f58ae;};'use strict';var _=require(_0x53aa('0x0'));var util=require(_0x53aa('0x1'));var moment=require(_0x53aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x53aa('0x3'));var fs=require('fs');var Redis=require(_0x53aa('0x4'));var db=require(_0x53aa('0x5'))['db'];var utils=require(_0x53aa('0x6'));var logger=require(_0x53aa('0x7'))(_0x53aa('0x8'));var config=require(_0x53aa('0x9'));var jayson=require(_0x53aa('0xa'));var client=jayson[_0x53aa('0xb')][_0x53aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x439542,_0x38efe0,_0x5a4fbe){return new BPromise(function(_0x21e750,_0x3c9f6a){return client[_0x53aa('0xd')](_0x439542,_0x5a4fbe)[_0x53aa('0xe')](function(_0x3d215d){logger['info'](_0x53aa('0xf'),_0x38efe0,'request\x20sent');logger[_0x53aa('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x38efe0,_0x53aa('0x11'),JSON[_0x53aa('0x12')](_0x3d215d));if(_0x3d215d[_0x53aa('0x13')]){if(_0x3d215d['error']['code']===0x1f4){logger[_0x53aa('0x13')](_0x53aa('0xf'),_0x38efe0,_0x3d215d[_0x53aa('0x13')][_0x53aa('0x14')]);return _0x3c9f6a(_0x3d215d['error'][_0x53aa('0x14')]);}logger[_0x53aa('0x13')](_0x53aa('0xf'),_0x38efe0,_0x3d215d[_0x53aa('0x13')][_0x53aa('0x14')]);return _0x21e750(_0x3d215d[_0x53aa('0x13')][_0x53aa('0x14')]);}else{logger[_0x53aa('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x38efe0,'request\x20sent');_0x21e750(_0x3d215d[_0x53aa('0x16')][_0x53aa('0x14')]);}})['catch'](function(_0x116f5){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x38efe0,_0x116f5);_0x3c9f6a(_0x116f5);});});}exports[_0x53aa('0x17')]=function(_0x1e70f4){var _0x3aec70=this;return new Promise(function(_0x3af864,_0x4ecda2){return db[_0x53aa('0x18')]['create'](_0x1e70f4['body'],{'raw':_0x1e70f4[_0x53aa('0x19')]?_0x1e70f4[_0x53aa('0x19')][_0x53aa('0x1a')]===undefined?!![]:![]:!![]})[_0x53aa('0xe')](function(_0x5edeac){logger[_0x53aa('0x15')](_0x53aa('0x17'),_0x1e70f4);logger[_0x53aa('0x10')](_0x53aa('0x17'),_0x1e70f4,JSON[_0x53aa('0x12')](_0x5edeac));_0x3af864(_0x5edeac);})[_0x53aa('0x1b')](function(_0x2c949d){logger[_0x53aa('0x13')](_0x53aa('0x17'),_0x2c949d['message'],_0x1e70f4);_0x4ecda2(_0x3aec70[_0x53aa('0x13')](0x1f4,_0x2c949d[_0x53aa('0x14')]));});});};exports[_0x53aa('0x1c')]=function(_0x370eff){var _0x292482=this;return new Promise(function(_0x278f27,_0x51dfa1){return db[_0x53aa('0x18')][_0x53aa('0x1d')](_0x370eff[_0x53aa('0x1e')],{'raw':_0x370eff[_0x53aa('0x19')]?_0x370eff['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x370eff['options']?_0x370eff[_0x53aa('0x19')][_0x53aa('0x1f')]||null:null,'attributes':_0x370eff['options']?_0x370eff[_0x53aa('0x19')]['attributes']||null:null,'limit':_0x370eff[_0x53aa('0x19')]?_0x370eff['options'][_0x53aa('0x20')]||null:null})[_0x53aa('0xe')](function(_0x4a51f2){logger[_0x53aa('0x15')](_0x53aa('0x1c'),_0x370eff);logger[_0x53aa('0x10')](_0x53aa('0x1c'),_0x370eff,JSON[_0x53aa('0x12')](_0x4a51f2));_0x278f27(_0x4a51f2);})[_0x53aa('0x1b')](function(_0x2af533){logger[_0x53aa('0x13')](_0x53aa('0x1c'),_0x2af533['message'],_0x370eff);_0x51dfa1(_0x292482[_0x53aa('0x13')](0x1f4,_0x2af533['message']));});});}; \ No newline at end of file +var _0x9100=['limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','create','body','options','raw','then','catch','where'];(function(_0x1d35bc,_0x2c9c04){var _0x2a5a36=function(_0x379e55){while(--_0x379e55){_0x1d35bc['push'](_0x1d35bc['shift']());}};_0x2a5a36(++_0x2c9c04);}(_0x9100,0x1a2));var _0x0910=function(_0x551daa,_0x454aed){_0x551daa=_0x551daa-0x0;var _0x2f8e29=_0x9100[_0x551daa];return _0x2f8e29;};'use strict';var _=require(_0x0910('0x0'));var util=require(_0x0910('0x1'));var moment=require(_0x0910('0x2'));var BPromise=require(_0x0910('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0910('0x4'));var db=require(_0x0910('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0910('0x6'))(_0x0910('0x7'));var config=require(_0x0910('0x8'));var jayson=require(_0x0910('0x9'));var client=jayson[_0x0910('0xa')][_0x0910('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48c51e,_0x198d0b,_0x34d57e){return new BPromise(function(_0x690641,_0x27f372){return client[_0x0910('0xc')](_0x48c51e,_0x34d57e)['then'](function(_0x4e90ad){logger[_0x0910('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x198d0b,_0x0910('0xe'));logger[_0x0910('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x198d0b,_0x0910('0xe'),JSON[_0x0910('0x10')](_0x4e90ad));if(_0x4e90ad[_0x0910('0x11')]){if(_0x4e90ad['error'][_0x0910('0x12')]===0x1f4){logger[_0x0910('0x11')](_0x0910('0x13'),_0x198d0b,_0x4e90ad[_0x0910('0x11')][_0x0910('0x14')]);return _0x27f372(_0x4e90ad[_0x0910('0x11')][_0x0910('0x14')]);}logger[_0x0910('0x11')](_0x0910('0x13'),_0x198d0b,_0x4e90ad['error'][_0x0910('0x14')]);return _0x690641(_0x4e90ad[_0x0910('0x11')][_0x0910('0x14')]);}else{logger[_0x0910('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x198d0b,'request\x20sent');_0x690641(_0x4e90ad[_0x0910('0x15')][_0x0910('0x14')]);}})['catch'](function(_0xaa1dd5){logger[_0x0910('0x11')](_0x0910('0x13'),_0x198d0b,_0xaa1dd5);_0x27f372(_0xaa1dd5);});});}exports[_0x0910('0x16')]=function(_0x259e94){var _0x537706=this;return new Promise(function(_0x78f5c7,_0x3b27ec){return db['VoiceDialReport'][_0x0910('0x17')](_0x259e94[_0x0910('0x18')],{'raw':_0x259e94[_0x0910('0x19')]?_0x259e94[_0x0910('0x19')][_0x0910('0x1a')]===undefined?!![]:![]:!![]})[_0x0910('0x1b')](function(_0x4566fb){logger[_0x0910('0xd')](_0x0910('0x16'),_0x259e94);logger[_0x0910('0xf')]('CreateVoiceDialReport',_0x259e94,JSON[_0x0910('0x10')](_0x4566fb));_0x78f5c7(_0x4566fb);})[_0x0910('0x1c')](function(_0x47b942){logger[_0x0910('0x11')](_0x0910('0x16'),_0x47b942[_0x0910('0x14')],_0x259e94);_0x3b27ec(_0x537706[_0x0910('0x11')](0x1f4,_0x47b942['message']));});});};exports['UpdateVoiceDialReport']=function(_0x52062e){var _0xa9c8d=this;return new Promise(function(_0x598730,_0xeb190c){return db['VoiceDialReport']['update'](_0x52062e['body'],{'raw':_0x52062e['options']?_0x52062e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52062e[_0x0910('0x19')]?_0x52062e['options'][_0x0910('0x1d')]||null:null,'attributes':_0x52062e['options']?_0x52062e[_0x0910('0x19')]['attributes']||null:null,'limit':_0x52062e['options']?_0x52062e[_0x0910('0x19')][_0x0910('0x1e')]||null:null})[_0x0910('0x1b')](function(_0x1b5296){logger[_0x0910('0xd')](_0x0910('0x1f'),_0x52062e);logger[_0x0910('0xf')](_0x0910('0x1f'),_0x52062e,JSON[_0x0910('0x10')](_0x1b5296));_0x598730(_0x1b5296);})[_0x0910('0x1c')](function(_0x230186){logger[_0x0910('0x11')](_0x0910('0x1f'),_0x230186['message'],_0x52062e);_0xeb190c(_0xa9c8d[_0x0910('0x11')](0x1f4,_0x230186[_0x0910('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c905b84..e5d393a 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 _0x392a=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create','/:id/applications','addApplications','put','update','/:id','destroy','exports'];(function(_0x470d82,_0x2fb808){var _0x121f86=function(_0x5dc702){while(--_0x5dc702){_0x470d82['push'](_0x470d82['shift']());}};_0x121f86(++_0x2fb808);}(_0x392a,0x11d));var _0xa392=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x392a[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xa392('0x0'));var util=require('util');var path=require(_0xa392('0x1'));var timeout=require(_0xa392('0x2'));var express=require(_0xa392('0x3'));var router=express[_0xa392('0x4')]();var auth=require(_0xa392('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa392('0x6'));var controller=require('./voiceExtension.controller');router[_0xa392('0x7')]('/',auth[_0xa392('0x8')](),controller['index']);router[_0xa392('0x7')]('/:id',auth[_0xa392('0x8')](),controller[_0xa392('0x9')]);router[_0xa392('0xa')]('/',auth[_0xa392('0x8')](),controller[_0xa392('0xb')]);router[_0xa392('0xa')](_0xa392('0xc'),auth[_0xa392('0x8')](),controller[_0xa392('0xd')]);router[_0xa392('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa392('0xf')]);router['delete'](_0xa392('0x10'),auth[_0xa392('0x8')](),controller[_0xa392('0x11')]);module[_0xa392('0x12')]=router; \ No newline at end of file +var _0x78a7=['delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','update'];(function(_0x384255,_0x15bf92){var _0x45f84f=function(_0x32f7e8){while(--_0x32f7e8){_0x384255['push'](_0x384255['shift']());}};_0x45f84f(++_0x15bf92);}(_0x78a7,0x80));var _0x778a=function(_0x24fc2c,_0x47b500){_0x24fc2c=_0x24fc2c-0x0;var _0x483de4=_0x78a7[_0x24fc2c];return _0x483de4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x778a('0x0'));var timeout=require(_0x778a('0x1'));var express=require(_0x778a('0x2'));var router=express[_0x778a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x778a('0x4'));var config=require(_0x778a('0x5'));var controller=require(_0x778a('0x6'));router[_0x778a('0x7')]('/',auth[_0x778a('0x8')](),controller[_0x778a('0x9')]);router['get'](_0x778a('0xa'),auth[_0x778a('0x8')](),controller[_0x778a('0xb')]);router[_0x778a('0xc')]('/',auth[_0x778a('0x8')](),controller['create']);router[_0x778a('0xc')](_0x778a('0xd'),auth[_0x778a('0x8')](),controller[_0x778a('0xe')]);router['put']('/:id',auth[_0x778a('0x8')](),controller[_0x778a('0xf')]);router[_0x778a('0x10')](_0x778a('0xa'),auth[_0x778a('0x8')](),controller['destroy']);module[_0x778a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 57febe6..6fec339 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(_0xac4b31,_0x4403cc){var _0x4370ea=function(_0x480b01){while(--_0x480b01){_0xac4b31['push'](_0xac4b31['shift']());}};_0x4370ea(++_0x4403cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x322929,_0x2978d8){var _0x437bb3=function(_0x36b246){while(--_0x36b246){_0x322929['push'](_0x322929['shift']());}};_0x437bb3(++_0x2978d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 4bbb966..6d5ef0e 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 _0x27be=['context','description','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','offset','set','apply','reject','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','internal','map','value','includes','type','find','name','UserProfileResource','error','stack','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','create','body','startsWith','exten','concat','user','inbound','InternalRoutes','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x5f483c,_0x436f4d){var _0x23c745=function(_0x15d4fd){while(--_0x15d4fd){_0x5f483c['push'](_0x5f483c['shift']());}};_0x23c745(++_0x436f4d);}(_0x27be,0x74));var _0xe27b=function(_0x231397,_0x45ad7c){_0x231397=_0x231397-0x0;var _0x586b4b=_0x27be[_0x231397];return _0x586b4b;};'use strict';var pdf=require(_0xe27b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe27b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe27b('0x2'));var rp=require(_0xe27b('0x3'));var moment=require(_0xe27b('0x4'));var BPromise=require(_0xe27b('0x5'));var Mustache=require(_0xe27b('0x6'));var util=require('util');var path=require(_0xe27b('0x7'));var sox=require(_0xe27b('0x8'));var csv=require('to-csv');var ejs=require(_0xe27b('0x9'));var fs=require('fs');var _=require(_0xe27b('0xa'));var squel=require(_0xe27b('0xb'));var crypto=require(_0xe27b('0xc'));var jsforce=require(_0xe27b('0xd'));var deskjs=require(_0xe27b('0xe'));var toCsv=require(_0xe27b('0xf'));var querystring=require('querystring');var Papa=require(_0xe27b('0x10'));var Redis=require(_0xe27b('0x11'));var authService=require(_0xe27b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe27b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe27b('0x14'))(_0xe27b('0x15'));var utils=require(_0xe27b('0x16'));var config=require(_0xe27b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe27b('0x18'))['db'];config[_0xe27b('0x19')]=_[_0xe27b('0x1a')](config[_0xe27b('0x19')],{'host':_0xe27b('0x1b'),'port':0x18eb});var socket=require(_0xe27b('0x1c'))(new Redis(config[_0xe27b('0x19')]));require(_0xe27b('0x1d'))[_0xe27b('0x1e')](socket);function respondWithStatusCode(_0x4515db,_0x98f149){_0x98f149=_0x98f149||0xcc;return function(_0xed550a){if(_0xed550a){return _0x4515db[_0xe27b('0x1f')](_0x98f149);}return _0x4515db['status'](_0x98f149)[_0xe27b('0x20')]();};}function respondWithResult(_0x42e5f0,_0x32e2c0){_0x32e2c0=_0x32e2c0||0xc8;return function(_0x1399fc){if(_0x1399fc){return _0x42e5f0[_0xe27b('0x21')](_0x32e2c0)[_0xe27b('0x22')](_0x1399fc);}};}function respondWithFilteredResult(_0x6a90b3,_0x312575){return function(_0x9cf3a7){if(_0x9cf3a7){var _0x32eaeb=_0x9cf3a7[_0xe27b('0x23')],_0x2ddc3c=_0x312575[_0xe27b('0x24')],_0x54b3f4=_0x312575[_0xe27b('0x24')]+_0x312575['limit'],_0x4e660e;if(_0x54b3f4>=_0x32eaeb){_0x54b3f4=_0x32eaeb;_0x4e660e=0xc8;}else{_0x4e660e=0xce;}_0x6a90b3[_0xe27b('0x21')](_0x4e660e);return _0x6a90b3[_0xe27b('0x25')]('Content-Range',_0x2ddc3c+'-'+_0x54b3f4+'/'+_0x32eaeb)[_0xe27b('0x22')](_0x9cf3a7);}return null;};}function patchUpdates(_0xc6cd25){return function(_0x2e8bd6){try{jsonpatch[_0xe27b('0x26')](_0x2e8bd6,_0xc6cd25,!![]);}catch(_0x235ede){return BPromise[_0xe27b('0x27')](_0x235ede);}return _0x2e8bd6['save']();};}function saveUpdates(_0x27ddb1,_0x37ee3b){return function(_0x5d5fa3){if(_0x5d5fa3){return _0x5d5fa3['update'](_0x27ddb1)[_0xe27b('0x28')](function(_0x5ef12d){return _0x5ef12d;});}return null;};}function removeEntity(_0x57ed6a,_0x47e966){return function(_0x10c940){if(_0x10c940){return _0x10c940[_0xe27b('0x29')]()[_0xe27b('0x28')](function(){var _0x5268a6=_0x10c940[_0xe27b('0x2a')]({'plain':!![]});var _0x1edf73=[{'name':_0xe27b('0x2b'),'value':'inbound','ignore':![]},{'name':_0xe27b('0x2c'),'value':_0xe27b('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':_0xe27b('0x2e'),'ignore':![]}];var _0x142a5c=_(_0x1edf73)['filter']('ignore')[_0xe27b('0x2f')]('value')[_0xe27b('0x30')]();if(_[_0xe27b('0x31')](_0x142a5c,_0x5268a6[_0xe27b('0x32')])){return;}var _0x36ae44=_[_0xe27b('0x33')](_0x1edf73,[_0xe27b('0x30'),_0x5268a6[_0xe27b('0x32')]])[_0xe27b('0x34')];return db[_0xe27b('0x35')][_0xe27b('0x29')]({'where':{'type':_0x36ae44,'resourceId':_0x5268a6['id']}})[_0xe27b('0x28')](function(){return _0x10c940;});})['then'](function(){_0x57ed6a['status'](0xcc)[_0xe27b('0x20')]();});}};}function handleEntityNotFound(_0x136b72,_0x38390c){return function(_0xe3451a){if(!_0xe3451a){_0x136b72[_0xe27b('0x1f')](0x194);}return _0xe3451a;};}function handleError(_0x47742c,_0x5780aa){_0x5780aa=_0x5780aa||0x1f4;return function(_0x2cfa18){logger[_0xe27b('0x36')](_0x2cfa18[_0xe27b('0x37')]);if(_0x2cfa18['name']){delete _0x2cfa18[_0xe27b('0x34')];}_0x47742c[_0xe27b('0x21')](_0x5780aa)['send'](_0x2cfa18);};}exports[_0xe27b('0x38')]=function(_0x2b947b,_0x5f54e4){var _0x3b3806={},_0x908c21={},_0x6b933e={'count':0x0,'rows':[]};var _0x3ceacc=_[_0xe27b('0x2f')](db[_0xe27b('0x39')][_0xe27b('0x3a')],function(_0x2c1f80){return{'name':_0x2c1f80['fieldName'],'type':_0x2c1f80[_0xe27b('0x32')][_0xe27b('0x3b')]};});_0x908c21[_0xe27b('0x3c')]=_[_0xe27b('0x2f')](_0x3ceacc,_0xe27b('0x34'));_0x908c21[_0xe27b('0x3d')]=_[_0xe27b('0x3e')](_0x2b947b[_0xe27b('0x3d')]);_0x908c21[_0xe27b('0x3f')]=_[_0xe27b('0x40')](_0x908c21[_0xe27b('0x3c')],_0x908c21[_0xe27b('0x3d')]);_0x3b3806[_0xe27b('0x41')]=_[_0xe27b('0x40')](_0x908c21[_0xe27b('0x3c')],qs[_0xe27b('0x42')](_0x2b947b['query']['fields']));_0x3b3806[_0xe27b('0x41')]=_0x3b3806[_0xe27b('0x41')][_0xe27b('0x43')]?_0x3b3806[_0xe27b('0x41')]:_0x908c21[_0xe27b('0x3c')];if(!_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x44')](_0xe27b('0x45'))){_0x3b3806[_0xe27b('0x46')]=qs[_0xe27b('0x46')](_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x46')]);_0x3b3806[_0xe27b('0x24')]=qs[_0xe27b('0x24')](_0x2b947b['query']['offset']);}_0x3b3806[_0xe27b('0x47')]=qs[_0xe27b('0x48')](_0x2b947b[_0xe27b('0x3d')]['sort']);_0x3b3806[_0xe27b('0x49')]=qs[_0xe27b('0x3f')](_[_0xe27b('0x4a')](_0x2b947b[_0xe27b('0x3d')],_0x908c21[_0xe27b('0x3f')]),_0x3ceacc);if(_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x4b')]){_0x3b3806[_0xe27b('0x49')]=_['merge'](_0x3b3806[_0xe27b('0x49')],{'$or':_['map'](_0x3ceacc,function(_0x4c1e2d){if(_0x4c1e2d['type']!==_0xe27b('0x4c')){var _0x3faa9d={};_0x3faa9d[_0x4c1e2d[_0xe27b('0x34')]]={'$like':'%'+_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x4b')]+'%'};return _0x3faa9d;}})});}_0x3b3806=_[_0xe27b('0x4d')]({},_0x3b3806,_0x2b947b['options']);var _0x553c85={'where':_0x3b3806[_0xe27b('0x49')]};return db[_0xe27b('0x39')][_0xe27b('0x23')](_0x553c85)[_0xe27b('0x28')](function(_0x5d9f00){_0x6b933e[_0xe27b('0x23')]=_0x5d9f00;if(_0x2b947b['query']['includeAll']){_0x3b3806[_0xe27b('0x4e')]=[{'all':!![]}];}return db[_0xe27b('0x39')][_0xe27b('0x4f')](_0x3b3806);})['then'](function(_0x5d0e81){_0x6b933e['rows']=_0x5d0e81;return _0x6b933e;})[_0xe27b('0x28')](respondWithFilteredResult(_0x5f54e4,_0x3b3806))[_0xe27b('0x50')](handleError(_0x5f54e4,null));};exports[_0xe27b('0x51')]=function(_0x13f056,_0x2b6ebd){var _0xd05050={'raw':![],'where':{'id':_0x13f056[_0xe27b('0x52')]['id']}},_0x429d23={};_0x429d23[_0xe27b('0x3c')]=_['keys'](db[_0xe27b('0x39')]['rawAttributes']);_0x429d23['query']=_['keys'](_0x13f056['query']);_0x429d23['filters']=_['intersection'](_0x429d23['model'],_0x429d23['query']);_0xd05050[_0xe27b('0x41')]=_[_0xe27b('0x40')](_0x429d23[_0xe27b('0x3c')],qs[_0xe27b('0x42')](_0x13f056[_0xe27b('0x3d')]['fields']));_0xd05050[_0xe27b('0x41')]=_0xd05050[_0xe27b('0x41')]['length']?_0xd05050[_0xe27b('0x41')]:_0x429d23['model'];if(_0x13f056[_0xe27b('0x3d')][_0xe27b('0x53')]){_0xd05050[_0xe27b('0x4e')]=[{'all':!![]}];}_0xd05050=_[_0xe27b('0x4d')]({},_0xd05050,_0x13f056['options']);return db['VoiceExtension'][_0xe27b('0x33')](_0xd05050)[_0xe27b('0x28')](handleEntityNotFound(_0x2b6ebd,null))[_0xe27b('0x28')](respondWithResult(_0x2b6ebd,null))[_0xe27b('0x50')](handleError(_0x2b6ebd,null));};exports['destroy']=function(_0x35e24f,_0x28dc36){return db[_0xe27b('0x39')][_0xe27b('0x33')]({'where':{'id':_0x35e24f[_0xe27b('0x52')]['id']}})[_0xe27b('0x28')](handleEntityNotFound(_0x28dc36,null))[_0xe27b('0x28')](removeEntity(_0x28dc36,null))[_0xe27b('0x50')](handleError(_0x28dc36,null));};exports[_0xe27b('0x54')]=function(_0x15aa35,_0x3e048e){if(_0x15aa35[_0xe27b('0x55')][_0xe27b('0x32')]===_0xe27b('0x2d')&&!_[_0xe27b('0x56')](_0x15aa35[_0xe27b('0x55')][_0xe27b('0x57')],'_')){_0x15aa35[_0xe27b('0x55')]['exten']='_'[_0xe27b('0x58')](_0x15aa35[_0xe27b('0x55')][_0xe27b('0x57')]);}return db[_0xe27b('0x39')][_0xe27b('0x54')](_0x15aa35[_0xe27b('0x55')],{'raw':![]})['then'](function(_0x2f7c5c){var _0x4b2ee9=_0x15aa35[_0xe27b('0x59')][_0xe27b('0x2a')]({'plain':!![]});if(!_0x4b2ee9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2ee9['role']==='user'){var _0x2cb6e9=_0x2f7c5c[_0xe27b('0x2a')]({'plain':!![]});var _0x5ba15d=[{'name':_0xe27b('0x2b'),'value':_0xe27b('0x5a')},{'name':_0xe27b('0x2c'),'value':'outbound'},{'name':_0xe27b('0x5b'),'value':_0xe27b('0x2e')}];var _0x30fe28=_['find'](_0x5ba15d,[_0xe27b('0x30'),_0x2cb6e9[_0xe27b('0x32')]])['name'];return db[_0xe27b('0x5c')][_0xe27b('0x33')]({'where':{'name':_0x30fe28,'userProfileId':_0x4b2ee9[_0xe27b('0x5d')]},'raw':!![]})[_0xe27b('0x28')](function(_0x8d0dcb){if(_0x8d0dcb&&_0x8d0dcb['autoAssociation']===0x0){return db[_0xe27b('0x35')]['create']({'name':_0x2cb6e9[_0xe27b('0x34')],'resourceId':_0x2cb6e9['id'],'type':_0x8d0dcb['name'],'sectionId':_0x8d0dcb['id']},{})['then'](function(){return _0x2f7c5c;});}else{return _0x2f7c5c;}})[_0xe27b('0x50')](function(_0x152441){logger['error'](_0xe27b('0x5e'),_0x152441);throw _0x152441;});}return _0x2f7c5c;})['then'](respondWithResult(_0x3e048e,0xc9))['catch'](handleError(_0x3e048e,null));};exports['update']=function(_0x3af835,_0x488cb6){if(_0x3af835['body']['id']){delete _0x3af835[_0xe27b('0x55')]['id'];}return db[_0xe27b('0x39')][_0xe27b('0x33')]({'where':{'id':_0x3af835[_0xe27b('0x52')]['id']}})[_0xe27b('0x28')](handleEntityNotFound(_0x488cb6,null))[_0xe27b('0x28')](function(_0xc8be05){if(_0xc8be05){return db['VoiceExtension'][_0xe27b('0x5f')](_[_0xe27b('0x4a')](_0x3af835[_0xe27b('0x55')],[_0xe27b('0x57'),_0xe27b('0x60'),_0xe27b('0x61'),'recordingFormat',_0xe27b('0x62'),_0xe27b('0x63')]),{'where':{'context':_0xc8be05[_0xe27b('0x60')],'exten':_0xc8be05[_0xe27b('0x57')]},'individualHooks':!![]})[_0xe27b('0x28')](function(_0x3e8bd8){return _0x3e8bd8;});}return null;})[_0xe27b('0x28')](respondWithStatusCode(_0x488cb6,null))[_0xe27b('0x50')](handleError(_0x488cb6,null));};exports['addApplications']=function(_0x41bc6b,_0x4cf4e7,_0x2b4fd4){return db['VoiceExtension'][_0xe27b('0x64')]({'where':{'id':_0x41bc6b[_0xe27b('0x52')]['id']}})[_0xe27b('0x28')](handleEntityNotFound(_0x4cf4e7,null))[_0xe27b('0x28')](function(_0xef495d){if(_0xef495d){return db[_0xe27b('0x65')][_0xe27b('0x66')](function(_0x314b71){return db[_0xe27b('0x39')][_0xe27b('0x29')]({'where':{'VoiceExtensionId':_0x41bc6b[_0xe27b('0x52')]['id']},'transaction':_0x314b71})[_0xe27b('0x28')](function(_0x37ca41){var _0x4b4de8=_['map'](_0x41bc6b[_0xe27b('0x55')],function(_0x3248b0){_0x3248b0[_0xe27b('0x67')]=_0x41bc6b[_0xe27b('0x52')]['id'];return _0x3248b0;});return db[_0xe27b('0x39')][_0xe27b('0x68')](_0x4b4de8,{'transaction':_0x314b71});});})[_0xe27b('0x28')](function(){return db[_0xe27b('0x39')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x41bc6b['params']['id']},'order':_0xe27b('0x69')});});}})[_0xe27b('0x28')](respondWithResult(_0x4cf4e7,null))[_0xe27b('0x50')](handleError(_0x4cf4e7,null));}; \ No newline at end of file +var _0xa9c4=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','InboundRoutes','inbound','internal','filter','ignore','map','value','includes','type','name','stack','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','catch','body','startsWith','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','InternalRoutes','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','sequelize','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x7c7af9,_0x1f699b){var _0x3c14f3=function(_0x138a49){while(--_0x138a49){_0x7c7af9['push'](_0x7c7af9['shift']());}};_0x3c14f3(++_0x1f699b);}(_0xa9c4,0xcd));var _0x4a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4a9c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4a9c('0x1'));var jsonpatch=require(_0x4a9c('0x2'));var rp=require('request-promise');var moment=require(_0x4a9c('0x3'));var BPromise=require(_0x4a9c('0x4'));var Mustache=require(_0x4a9c('0x5'));var util=require(_0x4a9c('0x6'));var path=require('path');var sox=require(_0x4a9c('0x7'));var csv=require(_0x4a9c('0x8'));var ejs=require(_0x4a9c('0x9'));var fs=require('fs');var _=require(_0x4a9c('0xa'));var squel=require(_0x4a9c('0xb'));var crypto=require(_0x4a9c('0xc'));var jsforce=require(_0x4a9c('0xd'));var deskjs=require(_0x4a9c('0xe'));var toCsv=require(_0x4a9c('0x8'));var querystring=require(_0x4a9c('0xf'));var Papa=require('papaparse');var Redis=require(_0x4a9c('0x10'));var authService=require(_0x4a9c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4a9c('0x12'));var hardwareService=require(_0x4a9c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4a9c('0x14'));var config=require(_0x4a9c('0x15'));var licenseUtil=require(_0x4a9c('0x16'));var db=require(_0x4a9c('0x17'))['db'];config[_0x4a9c('0x18')]=_['defaults'](config[_0x4a9c('0x18')],{'host':_0x4a9c('0x19'),'port':0x18eb});var socket=require(_0x4a9c('0x1a'))(new Redis(config[_0x4a9c('0x18')]));require('./voiceExtension.socket')[_0x4a9c('0x1b')](socket);function respondWithStatusCode(_0x125993,_0x526e1b){_0x526e1b=_0x526e1b||0xcc;return function(_0x1250b0){if(_0x1250b0){return _0x125993['sendStatus'](_0x526e1b);}return _0x125993[_0x4a9c('0x1c')](_0x526e1b)[_0x4a9c('0x1d')]();};}function respondWithResult(_0x4beb91,_0x486e2a){_0x486e2a=_0x486e2a||0xc8;return function(_0x228379){if(_0x228379){return _0x4beb91['status'](_0x486e2a)[_0x4a9c('0x1e')](_0x228379);}};}function respondWithFilteredResult(_0x599698,_0x472710){return function(_0x3653dc){if(_0x3653dc){var _0xd418ad=_0x3653dc[_0x4a9c('0x1f')],_0x57ac6e=_0x472710[_0x4a9c('0x20')],_0x7a0b1f=_0x472710[_0x4a9c('0x20')]+_0x472710[_0x4a9c('0x21')],_0x41b9ca;if(_0x7a0b1f>=_0xd418ad){_0x7a0b1f=_0xd418ad;_0x41b9ca=0xc8;}else{_0x41b9ca=0xce;}_0x599698['status'](_0x41b9ca);return _0x599698[_0x4a9c('0x22')](_0x4a9c('0x23'),_0x57ac6e+'-'+_0x7a0b1f+'/'+_0xd418ad)['json'](_0x3653dc);}return null;};}function patchUpdates(_0x47e945){return function(_0x3ef473){try{jsonpatch[_0x4a9c('0x24')](_0x3ef473,_0x47e945,!![]);}catch(_0x4a5242){return BPromise[_0x4a9c('0x25')](_0x4a5242);}return _0x3ef473['save']();};}function saveUpdates(_0x435eae,_0x4cd00c){return function(_0x44be69){if(_0x44be69){return _0x44be69[_0x4a9c('0x26')](_0x435eae)[_0x4a9c('0x27')](function(_0x2958c9){return _0x2958c9;});}return null;};}function removeEntity(_0x227382,_0x173421){return function(_0x4316d3){if(_0x4316d3){return _0x4316d3[_0x4a9c('0x28')]()[_0x4a9c('0x27')](function(){var _0x3c9798=_0x4316d3['get']({'plain':!![]});var _0x3b410f=[{'name':_0x4a9c('0x29'),'value':_0x4a9c('0x2a'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x4a9c('0x2b'),'ignore':![]}];var _0x2f7ec2=_(_0x3b410f)[_0x4a9c('0x2c')](_0x4a9c('0x2d'))[_0x4a9c('0x2e')](_0x4a9c('0x2f'))[_0x4a9c('0x2f')]();if(_[_0x4a9c('0x30')](_0x2f7ec2,_0x3c9798[_0x4a9c('0x31')])){return;}var _0x16e3ee=_['find'](_0x3b410f,[_0x4a9c('0x2f'),_0x3c9798['type']])[_0x4a9c('0x32')];return db['UserProfileResource']['destroy']({'where':{'type':_0x16e3ee,'resourceId':_0x3c9798['id']}})[_0x4a9c('0x27')](function(){return _0x4316d3;});})[_0x4a9c('0x27')](function(){_0x227382[_0x4a9c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e3795,_0x306755){return function(_0x19acea){if(!_0x19acea){_0x5e3795['sendStatus'](0x194);}return _0x19acea;};}function handleError(_0x5ed524,_0x46911f){_0x46911f=_0x46911f||0x1f4;return function(_0xa549a9){logger['error'](_0xa549a9[_0x4a9c('0x33')]);if(_0xa549a9[_0x4a9c('0x32')]){delete _0xa549a9[_0x4a9c('0x32')];}_0x5ed524[_0x4a9c('0x1c')](_0x46911f)[_0x4a9c('0x34')](_0xa549a9);};}exports[_0x4a9c('0x35')]=function(_0x6e7b4,_0x101e38){var _0x73483c={},_0x5ac61a={},_0x268a90={'count':0x0,'rows':[]};var _0x96619b=_['map'](db[_0x4a9c('0x36')]['rawAttributes'],function(_0x67678e){return{'name':_0x67678e[_0x4a9c('0x37')],'type':_0x67678e['type'][_0x4a9c('0x38')]};});_0x5ac61a[_0x4a9c('0x39')]=_['map'](_0x96619b,_0x4a9c('0x32'));_0x5ac61a[_0x4a9c('0x3a')]=_[_0x4a9c('0x3b')](_0x6e7b4[_0x4a9c('0x3a')]);_0x5ac61a[_0x4a9c('0x3c')]=_[_0x4a9c('0x3d')](_0x5ac61a[_0x4a9c('0x39')],_0x5ac61a['query']);_0x73483c[_0x4a9c('0x3e')]=_[_0x4a9c('0x3d')](_0x5ac61a[_0x4a9c('0x39')],qs[_0x4a9c('0x3f')](_0x6e7b4[_0x4a9c('0x3a')][_0x4a9c('0x3f')]));_0x73483c[_0x4a9c('0x3e')]=_0x73483c[_0x4a9c('0x3e')][_0x4a9c('0x40')]?_0x73483c[_0x4a9c('0x3e')]:_0x5ac61a[_0x4a9c('0x39')];if(!_0x6e7b4[_0x4a9c('0x3a')][_0x4a9c('0x41')](_0x4a9c('0x42'))){_0x73483c[_0x4a9c('0x21')]=qs['limit'](_0x6e7b4[_0x4a9c('0x3a')][_0x4a9c('0x21')]);_0x73483c[_0x4a9c('0x20')]=qs[_0x4a9c('0x20')](_0x6e7b4[_0x4a9c('0x3a')][_0x4a9c('0x20')]);}_0x73483c[_0x4a9c('0x43')]=qs[_0x4a9c('0x44')](_0x6e7b4[_0x4a9c('0x3a')][_0x4a9c('0x44')]);_0x73483c['where']=qs['filters'](_[_0x4a9c('0x45')](_0x6e7b4[_0x4a9c('0x3a')],_0x5ac61a[_0x4a9c('0x3c')]),_0x96619b);if(_0x6e7b4[_0x4a9c('0x3a')][_0x4a9c('0x2c')]){_0x73483c[_0x4a9c('0x46')]=_[_0x4a9c('0x47')](_0x73483c[_0x4a9c('0x46')],{'$or':_[_0x4a9c('0x2e')](_0x96619b,function(_0xb89065){if(_0xb89065[_0x4a9c('0x31')]!==_0x4a9c('0x48')){var _0x28cca5={};_0x28cca5[_0xb89065[_0x4a9c('0x32')]]={'$like':'%'+_0x6e7b4[_0x4a9c('0x3a')][_0x4a9c('0x2c')]+'%'};return _0x28cca5;}})});}_0x73483c=_[_0x4a9c('0x47')]({},_0x73483c,_0x6e7b4[_0x4a9c('0x49')]);var _0x51d02b={'where':_0x73483c[_0x4a9c('0x46')]};return db['VoiceExtension'][_0x4a9c('0x1f')](_0x51d02b)['then'](function(_0x431ec8){_0x268a90[_0x4a9c('0x1f')]=_0x431ec8;if(_0x6e7b4['query'][_0x4a9c('0x4a')]){_0x73483c[_0x4a9c('0x4b')]=[{'all':!![]}];}return db[_0x4a9c('0x36')]['findAll'](_0x73483c);})[_0x4a9c('0x27')](function(_0x505cfd){_0x268a90[_0x4a9c('0x4c')]=_0x505cfd;return _0x268a90;})[_0x4a9c('0x27')](respondWithFilteredResult(_0x101e38,_0x73483c))['catch'](handleError(_0x101e38,null));};exports[_0x4a9c('0x4d')]=function(_0xff15d1,_0x22a1d3){var _0x26bf79={'raw':![],'where':{'id':_0xff15d1[_0x4a9c('0x4e')]['id']}},_0x511aa6={};_0x511aa6[_0x4a9c('0x39')]=_['keys'](db[_0x4a9c('0x36')][_0x4a9c('0x4f')]);_0x511aa6[_0x4a9c('0x3a')]=_['keys'](_0xff15d1[_0x4a9c('0x3a')]);_0x511aa6[_0x4a9c('0x3c')]=_[_0x4a9c('0x3d')](_0x511aa6[_0x4a9c('0x39')],_0x511aa6[_0x4a9c('0x3a')]);_0x26bf79['attributes']=_[_0x4a9c('0x3d')](_0x511aa6[_0x4a9c('0x39')],qs['fields'](_0xff15d1[_0x4a9c('0x3a')][_0x4a9c('0x3f')]));_0x26bf79[_0x4a9c('0x3e')]=_0x26bf79[_0x4a9c('0x3e')][_0x4a9c('0x40')]?_0x26bf79['attributes']:_0x511aa6[_0x4a9c('0x39')];if(_0xff15d1['query'][_0x4a9c('0x4a')]){_0x26bf79[_0x4a9c('0x4b')]=[{'all':!![]}];}_0x26bf79=_[_0x4a9c('0x47')]({},_0x26bf79,_0xff15d1[_0x4a9c('0x49')]);return db[_0x4a9c('0x36')][_0x4a9c('0x50')](_0x26bf79)[_0x4a9c('0x27')](handleEntityNotFound(_0x22a1d3,null))[_0x4a9c('0x27')](respondWithResult(_0x22a1d3,null))[_0x4a9c('0x51')](handleError(_0x22a1d3,null));};exports[_0x4a9c('0x28')]=function(_0x154493,_0x1e7546){return db['VoiceExtension']['find']({'where':{'id':_0x154493[_0x4a9c('0x4e')]['id']}})[_0x4a9c('0x27')](handleEntityNotFound(_0x1e7546,null))[_0x4a9c('0x27')](removeEntity(_0x1e7546,null))[_0x4a9c('0x51')](handleError(_0x1e7546,null));};exports['create']=function(_0x3fd1e2,_0x10b31c){if(_0x3fd1e2[_0x4a9c('0x52')][_0x4a9c('0x31')]==='outbound'&&!_[_0x4a9c('0x53')](_0x3fd1e2[_0x4a9c('0x52')]['exten'],'_')){_0x3fd1e2[_0x4a9c('0x52')][_0x4a9c('0x54')]='_'[_0x4a9c('0x55')](_0x3fd1e2[_0x4a9c('0x52')][_0x4a9c('0x54')]);}return db['VoiceExtension'][_0x4a9c('0x56')](_0x3fd1e2[_0x4a9c('0x52')],{'raw':![]})['then'](function(_0x3f2605){var _0x12015b=_0x3fd1e2[_0x4a9c('0x57')][_0x4a9c('0x58')]({'plain':!![]});if(!_0x12015b)throw new Error(_0x4a9c('0x59'));if(_0x12015b[_0x4a9c('0x5a')]===_0x4a9c('0x57')){var _0x23d348=_0x3f2605[_0x4a9c('0x58')]({'plain':!![]});var _0x2ae50f=[{'name':_0x4a9c('0x29'),'value':_0x4a9c('0x2a')},{'name':'OutboundRoutes','value':_0x4a9c('0x5b')},{'name':_0x4a9c('0x5c'),'value':_0x4a9c('0x2b')}];var _0x354091=_[_0x4a9c('0x50')](_0x2ae50f,[_0x4a9c('0x2f'),_0x23d348[_0x4a9c('0x31')]])[_0x4a9c('0x32')];return db[_0x4a9c('0x5d')][_0x4a9c('0x50')]({'where':{'name':_0x354091,'userProfileId':_0x12015b[_0x4a9c('0x5e')]},'raw':!![]})[_0x4a9c('0x27')](function(_0xebfe07){if(_0xebfe07&&_0xebfe07['autoAssociation']===0x0){return db[_0x4a9c('0x5f')]['create']({'name':_0x23d348[_0x4a9c('0x32')],'resourceId':_0x23d348['id'],'type':_0xebfe07['name'],'sectionId':_0xebfe07['id']},{})[_0x4a9c('0x27')](function(){return _0x3f2605;});}else{return _0x3f2605;}})[_0x4a9c('0x51')](function(_0x3d8c69){logger[_0x4a9c('0x60')](_0x4a9c('0x61'),_0x3d8c69);throw _0x3d8c69;});}return _0x3f2605;})[_0x4a9c('0x27')](respondWithResult(_0x10b31c,0xc9))[_0x4a9c('0x51')](handleError(_0x10b31c,null));};exports[_0x4a9c('0x26')]=function(_0x1b3717,_0x2f2454){if(_0x1b3717['body']['id']){delete _0x1b3717[_0x4a9c('0x52')]['id'];}return db[_0x4a9c('0x36')][_0x4a9c('0x50')]({'where':{'id':_0x1b3717[_0x4a9c('0x4e')]['id']}})[_0x4a9c('0x27')](handleEntityNotFound(_0x2f2454,null))['then'](function(_0x58009c){if(_0x58009c){return db[_0x4a9c('0x36')]['update'](_[_0x4a9c('0x45')](_0x1b3717[_0x4a9c('0x52')],[_0x4a9c('0x54'),_0x4a9c('0x62'),_0x4a9c('0x63'),_0x4a9c('0x64'),_0x4a9c('0x65'),_0x4a9c('0x66')]),{'where':{'context':_0x58009c['context'],'exten':_0x58009c[_0x4a9c('0x54')]},'individualHooks':!![]})['then'](function(_0xd2aa04){return _0xd2aa04;});}return null;})['then'](respondWithStatusCode(_0x2f2454,null))[_0x4a9c('0x51')](handleError(_0x2f2454,null));};exports['addApplications']=function(_0x333380,_0x58e893,_0x3b4517){return db['VoiceExtension']['findOne']({'where':{'id':_0x333380[_0x4a9c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x58e893,null))[_0x4a9c('0x27')](function(_0x550ab2){if(_0x550ab2){return db[_0x4a9c('0x67')]['transaction'](function(_0x5f2ad8){return db[_0x4a9c('0x36')][_0x4a9c('0x28')]({'where':{'VoiceExtensionId':_0x333380['params']['id']},'transaction':_0x5f2ad8})[_0x4a9c('0x27')](function(_0x1f084a){var _0x31f962=_[_0x4a9c('0x2e')](_0x333380[_0x4a9c('0x52')],function(_0x43fe28){_0x43fe28[_0x4a9c('0x68')]=_0x333380[_0x4a9c('0x4e')]['id'];return _0x43fe28;});return db[_0x4a9c('0x36')][_0x4a9c('0x69')](_0x31f962,{'transaction':_0x5f2ad8});});})['then'](function(){return db[_0x4a9c('0x36')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x333380[_0x4a9c('0x4e')]['id']},'order':_0x4a9c('0x6a')});});}})[_0x4a9c('0x27')](respondWithResult(_0x58e893,null))[_0x4a9c('0x51')](handleError(_0x58e893,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f4e7907..2e7f48d 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 _0x6bd6=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x6bd6,0x17d));var _0x66bd=function(_0x194618,_0x2b8535){_0x194618=_0x194618-0x0;var _0x3a6638=_0x6bd6[_0x194618];return _0x3a6638;};'use strict';var EventEmitter=require(_0x66bd('0x0'));var VoiceExtension=require(_0x66bd('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x66bd('0x2')](0x0);var events={'afterCreate':_0x66bd('0x3'),'afterUpdate':_0x66bd('0x4'),'afterDestroy':_0x66bd('0x5')};function emitEvent(_0x39447a){return function(_0x40115e,_0x5b8843,_0x4609c1){VoiceExtensionEvents[_0x66bd('0x6')](_0x39447a+':'+_0x40115e['id'],_0x40115e);VoiceExtensionEvents['emit'](_0x39447a,_0x40115e);_0x4609c1(null);};}for(var e in events){if(events[_0x66bd('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x66bd('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x86d9=['hasOwnProperty','hook','exports','events','VoiceExtension','update','remove','emit'];(function(_0x108784,_0x2b89ef){var _0x537bf0=function(_0x1f18f5){while(--_0x1f18f5){_0x108784['push'](_0x108784['shift']());}};_0x537bf0(++_0x2b89ef);}(_0x86d9,0x1ab));var _0x986d=function(_0x3dd8e5,_0x11e835){_0x3dd8e5=_0x3dd8e5-0x0;var _0x3c091b=_0x86d9[_0x3dd8e5];return _0x3c091b;};'use strict';var EventEmitter=require(_0x986d('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x986d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x986d('0x2'),'afterDestroy':_0x986d('0x3')};function emitEvent(_0x548e9a){return function(_0x43f0ed,_0x4f3134,_0x23fb56){VoiceExtensionEvents['emit'](_0x548e9a+':'+_0x43f0ed['id'],_0x43f0ed);VoiceExtensionEvents[_0x986d('0x4')](_0x548e9a,_0x43f0ed);_0x23fb56(null);};}for(var e in events){if(events[_0x986d('0x5')](e)){var event=events[e];VoiceExtension[_0x986d('0x6')](e,emitEvent(event));}}module[_0x986d('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e4ee131..5c08fe0 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 _0xa9b2=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','lodash'];(function(_0x410a16,_0x5655c4){var _0x1d67b8=function(_0x14bcf6){while(--_0x14bcf6){_0x410a16['push'](_0x410a16['shift']());}};_0x1d67b8(++_0x5655c4);}(_0xa9b2,0xbf));var _0x2a9b=function(_0x404b9a,_0xca0480){_0x404b9a=_0x404b9a-0x0;var _0x30ba61=_0xa9b2[_0x404b9a];return _0x30ba61;};'use strict';var _=require(_0x2a9b('0x0'));var util=require(_0x2a9b('0x1'));var logger=require(_0x2a9b('0x2'))('api');var moment=require(_0x2a9b('0x3'));var BPromise=require(_0x2a9b('0x4'));var rp=require(_0x2a9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a9b('0x6'));var config=require(_0x2a9b('0x7'));var attributes=require(_0x2a9b('0x8'));module[_0x2a9b('0x9')]=function(_0x495b73,_0x345b91){return _0x495b73[_0x2a9b('0xa')](_0x2a9b('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x413f=['bluebird','request-promise','path','rimraf','./voiceExtension.attributes','exports','VoiceExtension','util','../../config/logger','api','moment'];(function(_0x1a5707,_0x1ac420){var _0x3ce4a1=function(_0x491428){while(--_0x491428){_0x1a5707['push'](_0x1a5707['shift']());}};_0x3ce4a1(++_0x1ac420);}(_0x413f,0x151));var _0xf413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x413f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xf413('0x0'));var logger=require(_0xf413('0x1'))(_0xf413('0x2'));var moment=require(_0xf413('0x3'));var BPromise=require(_0xf413('0x4'));var rp=require(_0xf413('0x5'));var fs=require('fs');var path=require(_0xf413('0x6'));var rimraf=require(_0xf413('0x7'));var config=require('../../config/environment');var attributes=require(_0xf413('0x8'));module[_0xf413('0x9')]=function(_0x3a3abb,_0x5ba469){return _0x3a3abb['define'](_0xf413('0xa'),attributes,{'tableName':'voice_extensions','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 eaf007b..346ff0d 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 _0xc628=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xc628,0x196));var _0x8c62=function(_0x461c63,_0x38147e){_0x461c63=_0x461c63-0x0;var _0x29c6f1=_0xc628[_0x461c63];return _0x29c6f1;};'use strict';var _=require(_0x8c62('0x0'));var util=require(_0x8c62('0x1'));var moment=require(_0x8c62('0x2'));var BPromise=require(_0x8c62('0x3'));var rs=require(_0x8c62('0x4'));var fs=require('fs');var Redis=require(_0x8c62('0x5'));var db=require(_0x8c62('0x6'))['db'];var utils=require(_0x8c62('0x7'));var logger=require(_0x8c62('0x8'))(_0x8c62('0x9'));var config=require(_0x8c62('0xa'));var jayson=require(_0x8c62('0xb'));var client=jayson[_0x8c62('0xc')][_0x8c62('0xd')]({'port':0x232a});config[_0x8c62('0xe')]=_['defaults'](config[_0x8c62('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c62('0xf'))(new Redis(config[_0x8c62('0xe')]));require(_0x8c62('0x10'))[_0x8c62('0x11')](socket);function respondWithRpcPromise(_0x19acfc,_0x112704,_0x234a22){return new BPromise(function(_0x55f926,_0x1d3538){return client[_0x8c62('0x12')](_0x19acfc,_0x234a22)[_0x8c62('0x13')](function(_0x1c852a){logger['info'](_0x8c62('0x14'),_0x112704,_0x8c62('0x15'));logger['debug'](_0x8c62('0x16'),_0x112704,_0x8c62('0x15'),JSON[_0x8c62('0x17')](_0x1c852a));if(_0x1c852a['error']){if(_0x1c852a[_0x8c62('0x18')][_0x8c62('0x19')]===0x1f4){logger[_0x8c62('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x112704,_0x1c852a[_0x8c62('0x18')][_0x8c62('0x1a')]);return _0x1d3538(_0x1c852a[_0x8c62('0x18')]['message']);}logger[_0x8c62('0x18')](_0x8c62('0x14'),_0x112704,_0x1c852a[_0x8c62('0x18')][_0x8c62('0x1a')]);return _0x55f926(_0x1c852a['error'][_0x8c62('0x1a')]);}else{logger[_0x8c62('0x1b')](_0x8c62('0x14'),_0x112704,_0x8c62('0x15'));_0x55f926(_0x1c852a[_0x8c62('0x1c')][_0x8c62('0x1a')]);}})[_0x8c62('0x1d')](function(_0x3d865a){logger['error'](_0x8c62('0x14'),_0x112704,_0x3d865a);_0x1d3538(_0x3d865a);});});}exports[_0x8c62('0x1e')]=function(_0xb9caea){var _0x7744c2=this;return new Promise(function(_0x39794e,_0x43d7be){return db[_0x8c62('0x1f')][_0x8c62('0x20')]({'raw':_0xb9caea['options']?_0xb9caea['options']['raw']===undefined?!![]:![]:!![],'where':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x22')]||null:null,'attributes':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x23')]||null:null,'limit':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x24')]||null:null,'include':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x25')]?_[_0x8c62('0x26')](_0xb9caea[_0x8c62('0x21')]['include'],function(_0x5eaca1){return{'model':db[_0x5eaca1[_0x8c62('0x27')]],'as':_0x5eaca1['as'],'attributes':_0x5eaca1['attributes'],'include':_0x5eaca1['include']?_[_0x8c62('0x26')](_0x5eaca1['include'],function(_0x1ffc50){return{'model':db[_0x1ffc50[_0x8c62('0x27')]],'as':_0x1ffc50['as'],'attributes':_0x1ffc50[_0x8c62('0x23')],'include':_0x1ffc50[_0x8c62('0x25')]?_[_0x8c62('0x26')](_0x1ffc50[_0x8c62('0x25')],function(_0x18d3a1){return{'model':db[_0x18d3a1['model']],'as':_0x18d3a1['as'],'attributes':_0x18d3a1[_0x8c62('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8c62('0x13')](function(_0x175b7a){logger[_0x8c62('0x1b')](_0x8c62('0x1e'),_0xb9caea);logger[_0x8c62('0x28')](_0x8c62('0x1e'),_0xb9caea,JSON['stringify'](_0x175b7a));_0x39794e(_0x175b7a);})[_0x8c62('0x1d')](function(_0x20d7ca){logger[_0x8c62('0x18')]('GetVoiceExtension',_0x20d7ca['message'],_0xb9caea);_0x43d7be(_0x7744c2[_0x8c62('0x18')](0x1f4,_0x20d7ca[_0x8c62('0x1a')]));});});}; \ No newline at end of file +var _0xb80d=['model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1c9fff,_0x4181f6){var _0x484008=function(_0x44647f){while(--_0x44647f){_0x1c9fff['push'](_0x1c9fff['shift']());}};_0x484008(++_0x4181f6);}(_0xb80d,0x142));var _0xdb80=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xb80d[_0x455c6c];return _0x488242;};'use strict';var _=require(_0xdb80('0x0'));var util=require(_0xdb80('0x1'));var moment=require('moment');var BPromise=require(_0xdb80('0x2'));var rs=require(_0xdb80('0x3'));var fs=require('fs');var Redis=require(_0xdb80('0x4'));var db=require(_0xdb80('0x5'))['db'];var utils=require(_0xdb80('0x6'));var logger=require(_0xdb80('0x7'))(_0xdb80('0x8'));var config=require('../../config/environment');var jayson=require(_0xdb80('0x9'));var client=jayson[_0xdb80('0xa')]['http']({'port':0x232a});config[_0xdb80('0xb')]=_[_0xdb80('0xc')](config[_0xdb80('0xb')],{'host':_0xdb80('0xd'),'port':0x18eb});var socket=require(_0xdb80('0xe'))(new Redis(config[_0xdb80('0xb')]));require('./voiceExtension.socket')[_0xdb80('0xf')](socket);function respondWithRpcPromise(_0x589cb4,_0x3ead00,_0x46f0cc){return new BPromise(function(_0x1f0552,_0x5493da){return client[_0xdb80('0x10')](_0x589cb4,_0x46f0cc)[_0xdb80('0x11')](function(_0x157752){logger[_0xdb80('0x12')](_0xdb80('0x13'),_0x3ead00,_0xdb80('0x14'));logger[_0xdb80('0x15')](_0xdb80('0x16'),_0x3ead00,_0xdb80('0x14'),JSON[_0xdb80('0x17')](_0x157752));if(_0x157752[_0xdb80('0x18')]){if(_0x157752[_0xdb80('0x18')][_0xdb80('0x19')]===0x1f4){logger[_0xdb80('0x18')](_0xdb80('0x13'),_0x3ead00,_0x157752[_0xdb80('0x18')]['message']);return _0x5493da(_0x157752['error'][_0xdb80('0x1a')]);}logger[_0xdb80('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3ead00,_0x157752[_0xdb80('0x18')]['message']);return _0x1f0552(_0x157752[_0xdb80('0x18')][_0xdb80('0x1a')]);}else{logger[_0xdb80('0x12')](_0xdb80('0x13'),_0x3ead00,_0xdb80('0x14'));_0x1f0552(_0x157752[_0xdb80('0x1b')][_0xdb80('0x1a')]);}})['catch'](function(_0x52d798){logger['error'](_0xdb80('0x13'),_0x3ead00,_0x52d798);_0x5493da(_0x52d798);});});}exports[_0xdb80('0x1c')]=function(_0x412747){var _0x405454=this;return new Promise(function(_0x36404e,_0x58203d){return db[_0xdb80('0x1d')][_0xdb80('0x1e')]({'raw':_0x412747[_0xdb80('0x1f')]?_0x412747['options'][_0xdb80('0x20')]===undefined?!![]:![]:!![],'where':_0x412747[_0xdb80('0x1f')]?_0x412747[_0xdb80('0x1f')][_0xdb80('0x21')]||null:null,'attributes':_0x412747[_0xdb80('0x1f')]?_0x412747[_0xdb80('0x1f')][_0xdb80('0x22')]||null:null,'limit':_0x412747['options']?_0x412747[_0xdb80('0x1f')][_0xdb80('0x23')]||null:null,'include':_0x412747[_0xdb80('0x1f')]?_0x412747[_0xdb80('0x1f')][_0xdb80('0x24')]?_[_0xdb80('0x25')](_0x412747['options']['include'],function(_0x2e5fa5){return{'model':db[_0x2e5fa5[_0xdb80('0x26')]],'as':_0x2e5fa5['as'],'attributes':_0x2e5fa5[_0xdb80('0x22')],'include':_0x2e5fa5[_0xdb80('0x24')]?_[_0xdb80('0x25')](_0x2e5fa5[_0xdb80('0x24')],function(_0xdb2b55){return{'model':db[_0xdb2b55['model']],'as':_0xdb2b55['as'],'attributes':_0xdb2b55['attributes'],'include':_0xdb2b55[_0xdb80('0x24')]?_[_0xdb80('0x25')](_0xdb2b55[_0xdb80('0x24')],function(_0x2c9cda){return{'model':db[_0x2c9cda[_0xdb80('0x26')]],'as':_0x2c9cda['as'],'attributes':_0x2c9cda[_0xdb80('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d9ab1){logger[_0xdb80('0x12')](_0xdb80('0x1c'),_0x412747);logger['debug'](_0xdb80('0x1c'),_0x412747,JSON['stringify'](_0x3d9ab1));_0x36404e(_0x3d9ab1);})[_0xdb80('0x27')](function(_0xb24170){logger[_0xdb80('0x18')](_0xdb80('0x1c'),_0xb24170[_0xdb80('0x1a')],_0x412747);_0x58203d(_0x405454[_0xdb80('0x18')](0x1f4,_0xb24170[_0xdb80('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f246c97..2797f63 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 _0x18ed=['./voiceExtension.events','remove','update','emit','removeListener','length'];(function(_0x46f1fa,_0x1b583f){var _0x2e4360=function(_0x262dcb){while(--_0x262dcb){_0x46f1fa['push'](_0x46f1fa['shift']());}};_0x2e4360(++_0x1b583f);}(_0x18ed,0x1e0));var _0xd18e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x18ed[_0x565c49];return _0x20ca34;};'use strict';var VoiceExtensionEvents=require(_0xd18e('0x0'));var events=['save',_0xd18e('0x1'),_0xd18e('0x2')];function createListener(_0x576bf4,_0x44b1c5){return function(_0x30082a){_0x44b1c5[_0xd18e('0x3')](_0x576bf4,_0x30082a);};}function removeListener(_0x1edb5f,_0x3539fb){return function(){VoiceExtensionEvents[_0xd18e('0x4')](_0x1edb5f,_0x3539fb);};}exports['register']=function(_0x415056){for(var _0x3bd967=0x0,_0x543743=events[_0xd18e('0x5')];_0x3bd967<_0x543743;_0x3bd967++){var _0x189035=events[_0x3bd967];var _0x3f80a3=createListener('voiceExtension:'+_0x189035,_0x415056);VoiceExtensionEvents['on'](_0x189035,_0x3f80a3);}}; \ No newline at end of file +var _0x47cc=['./voiceExtension.events','save','update','emit','register','length','voiceExtension:'];(function(_0x133311,_0x545ca1){var _0x56bbf0=function(_0x1464ce){while(--_0x1464ce){_0x133311['push'](_0x133311['shift']());}};_0x56bbf0(++_0x545ca1);}(_0x47cc,0x134));var _0xc47c=function(_0x2bf38c,_0x554355){_0x2bf38c=_0x2bf38c-0x0;var _0x540ef6=_0x47cc[_0x2bf38c];return _0x540ef6;};'use strict';var VoiceExtensionEvents=require(_0xc47c('0x0'));var events=[_0xc47c('0x1'),'remove',_0xc47c('0x2')];function createListener(_0x5a3f24,_0x34cf60){return function(_0x53479d){_0x34cf60[_0xc47c('0x3')](_0x5a3f24,_0x53479d);};}function removeListener(_0x4dbf8d,_0x44cd78){return function(){VoiceExtensionEvents['removeListener'](_0x4dbf8d,_0x44cd78);};}exports[_0xc47c('0x4')]=function(_0x2bb0ae){for(var _0x5d33fe=0x0,_0x294e7c=events[_0xc47c('0x5')];_0x5d33fe<_0x294e7c;_0x5d33fe++){var _0x39d141=events[_0x5d33fe];var _0x26aba4=createListener(_0xc47c('0x6')+_0x39d141,_0x2bb0ae);VoiceExtensionEvents['on'](_0x39d141,_0x26aba4);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d2b3688..318fee8 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 _0x3690=['isAuthenticated','index','/:id/messages','post','create','put','/:id','update','delete','multer','path','express','../../components/interaction/service','./voiceMail.controller'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3690,0x1c9));var _0x0369=function(_0x867c94,_0x44ec82){_0x867c94=_0x867c94-0x0;var _0x5a51a4=_0x3690[_0x867c94];return _0x5a51a4;};'use strict';var multer=require(_0x0369('0x0'));var util=require('util');var path=require(_0x0369('0x1'));var timeout=require('connect-timeout');var express=require(_0x0369('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0369('0x3'));var config=require('../../config/environment');var controller=require(_0x0369('0x4'));router['get']('/',auth[_0x0369('0x5')](),controller[_0x0369('0x6')]);router['get']('/:id',auth[_0x0369('0x5')](),controller['show']);router['get'](_0x0369('0x7'),auth[_0x0369('0x5')](),controller['getMessages']);router[_0x0369('0x8')]('/',auth[_0x0369('0x5')](),controller[_0x0369('0x9')]);router[_0x0369('0xa')](_0x0369('0xb'),auth['isAuthenticated'](),controller[_0x0369('0xc')]);router[_0x0369('0xd')](_0x0369('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x343e=['express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','show','/:id/messages','getMessages','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x343e,0xec));var _0xe343=function(_0x55989,_0x2382dd){_0x55989=_0x55989-0x0;var _0x20eeeb=_0x343e[_0x55989];return _0x20eeeb;};'use strict';var multer=require(_0xe343('0x0'));var util=require(_0xe343('0x1'));var path=require(_0xe343('0x2'));var timeout=require(_0xe343('0x3'));var express=require(_0xe343('0x4'));var router=express[_0xe343('0x5')]();var auth=require(_0xe343('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe343('0x7'));var controller=require(_0xe343('0x8'));router[_0xe343('0x9')]('/',auth[_0xe343('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe343('0xb')]);router[_0xe343('0x9')](_0xe343('0xc'),auth[_0xe343('0xa')](),controller[_0xe343('0xd')]);router[_0xe343('0xe')]('/',auth[_0xe343('0xa')](),controller['create']);router[_0xe343('0xf')](_0xe343('0x10'),auth[_0xe343('0xa')](),controller['update']);router[_0xe343('0x11')](_0xe343('0x10'),auth[_0xe343('0xa')](),controller[_0xe343('0x12')]);module[_0xe343('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d2ea113..113114a 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 _0x80ed=['setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox'];(function(_0x2ba807,_0x8e028f){var _0x2acc06=function(_0x147100){while(--_0x147100){_0x2ba807['push'](_0x2ba807['shift']());}};_0x2acc06(++_0x8e028f);}(_0x80ed,0x11c));var _0xd80e=function(_0x32de1e,_0x5c3d68){_0x32de1e=_0x32de1e-0x0;var _0x5301f8=_0x80ed[_0x32de1e];return _0x5301f8;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xd80e('0x1')]},'context':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'','allowNull':![],'unique':_0xd80e('0x3')},'password':{'type':Sequelize[_0xd80e('0x1')]},'fullname':{'type':Sequelize[_0xd80e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x26e6ff){this[_0xd80e('0x4')](_0xd80e('0x5'),typeof _0x26e6ff==='string'&&_0x26e6ff[_0xd80e('0x6')]()?_0x26e6ff[_0xd80e('0x6')]():null);}},'pager':{'type':Sequelize[_0xd80e('0x1')]},'tz':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x7')},'attach':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xd80e('0x1')]},'callback':{'type':Sequelize[_0xd80e('0x1')]},'review':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd80e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'stamp':{'type':_0xd80e('0xa')},'emailsubject':{'type':Sequelize[_0xd80e('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd80e('0xc')],'get':function(){return this[_0xd80e('0xd')]('fullname')+_0xd80e('0xe')+this[_0xd80e('0xd')](_0xd80e('0xf'));}}}; \ No newline at end of file +var _0xd7d1=['\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xbda4f4,_0x15bbcf){_0xbda4f4=_0xbda4f4-0x0;var _0x35442f=_0xd7d1[_0xbda4f4];return _0x35442f;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'customer_id':{'type':Sequelize[_0x1d7d('0x2')]},'context':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':_0x1d7d('0x3'),'unique':_0x1d7d('0x4')},'mailbox':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':'','allowNull':![],'unique':_0x1d7d('0x4')},'password':{'type':Sequelize[_0x1d7d('0x2')]},'fullname':{'type':Sequelize[_0x1d7d('0x2')]},'email':{'type':Sequelize[_0x1d7d('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1a2564){this[_0x1d7d('0x5')]('email',typeof _0x1a2564===_0x1d7d('0x6')&&_0x1a2564[_0x1d7d('0x7')]()?_0x1a2564[_0x1d7d('0x7')]():null);}},'pager':{'type':Sequelize[_0x1d7d('0x2')]},'tz':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':_0x1d7d('0x8')},'attach':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':_0x1d7d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x1d7d('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1d7d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1d7d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':_0x1d7d('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1d7d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1d7d('0x9')](_0x1d7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x1d7d('0xa'),'no'),'defaultValue':_0x1d7d('0xa'),'allowNull':![]},'stamp':{'type':_0x1d7d('0xc')},'emailsubject':{'type':Sequelize[_0x1d7d('0x2')]},'emailbody':{'type':Sequelize[_0x1d7d('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1d7d('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1d7d('0xe')],'get':function(){return this['getDataValue']('fullname')+_0x1d7d('0xf')+this[_0x1d7d('0x10')](_0x1d7d('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3499be4..d17f353 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 _0x0a93=['findAll','catch','params','options','create','role','user','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','update','body','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','count','include'];(function(_0x28a286,_0x1617aa){var _0x1859d4=function(_0x510854){while(--_0x510854){_0x28a286['push'](_0x28a286['shift']());}};_0x1859d4(++_0x1617aa);}(_0x0a93,0x6a));var _0x30a9=function(_0x2ec4bf,_0x402cff){_0x2ec4bf=_0x2ec4bf-0x0;var _0x5b965f=_0x0a93[_0x2ec4bf];return _0x5b965f;};'use strict';var pdf=require(_0x30a9('0x0'));var emlformat=require(_0x30a9('0x1'));var rimraf=require(_0x30a9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30a9('0x3'));var rp=require(_0x30a9('0x4'));var moment=require(_0x30a9('0x5'));var BPromise=require(_0x30a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30a9('0x7'));var fs=require('fs');var _=require(_0x30a9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x30a9('0x9'));var deskjs=require(_0x30a9('0xa'));var toCsv=require(_0x30a9('0xb'));var querystring=require('querystring');var Papa=require(_0x30a9('0xc'));var Redis=require(_0x30a9('0xd'));var authService=require(_0x30a9('0xe'));var qs=require(_0x30a9('0xf'));var as=require(_0x30a9('0x10'));var hardwareService=require(_0x30a9('0x11'));var logger=require(_0x30a9('0x12'))(_0x30a9('0x13'));var utils=require(_0x30a9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x30a9('0x15'));var db=require(_0x30a9('0x16'))['db'];function respondWithStatusCode(_0x2a0a7a,_0x37c981){_0x37c981=_0x37c981||0xcc;return function(_0x49c22c){if(_0x49c22c){return _0x2a0a7a[_0x30a9('0x17')](_0x37c981);}return _0x2a0a7a['status'](_0x37c981)[_0x30a9('0x18')]();};}function respondWithResult(_0x3f641d,_0x5912b6){_0x5912b6=_0x5912b6||0xc8;return function(_0x58a4f3){if(_0x58a4f3){return _0x3f641d[_0x30a9('0x19')](_0x5912b6)[_0x30a9('0x1a')](_0x58a4f3);}};}function respondWithFilteredResult(_0x4b9f6e,_0x3230fe){return function(_0x2d007d){if(_0x2d007d){var _0x3c50d1=_0x2d007d['count'],_0x17fec2=_0x3230fe[_0x30a9('0x1b')],_0x39cee7=_0x3230fe[_0x30a9('0x1b')]+_0x3230fe[_0x30a9('0x1c')],_0x1e7927;if(_0x39cee7>=_0x3c50d1){_0x39cee7=_0x3c50d1;_0x1e7927=0xc8;}else{_0x1e7927=0xce;}_0x4b9f6e[_0x30a9('0x19')](_0x1e7927);return _0x4b9f6e[_0x30a9('0x1d')](_0x30a9('0x1e'),_0x17fec2+'-'+_0x39cee7+'/'+_0x3c50d1)[_0x30a9('0x1a')](_0x2d007d);}return null;};}function patchUpdates(_0x29e1e9){return function(_0x1c412c){try{jsonpatch[_0x30a9('0x1f')](_0x1c412c,_0x29e1e9,!![]);}catch(_0x5129cc){return BPromise[_0x30a9('0x20')](_0x5129cc);}return _0x1c412c[_0x30a9('0x21')]();};}function saveUpdates(_0x465581,_0x117d4f){return function(_0x553532){if(_0x553532){return _0x553532['update'](_0x465581)[_0x30a9('0x22')](function(_0x2f2cc9){return _0x2f2cc9;});}return null;};}function removeEntity(_0x541b86,_0x3408f4){return function(_0x4c92e8){if(_0x4c92e8){return _0x4c92e8[_0x30a9('0x23')]()[_0x30a9('0x22')](function(){var _0x5a6e49=_0x4c92e8[_0x30a9('0x24')]({'plain':!![]});var _0x41792d='Voicemails';return db[_0x30a9('0x25')]['destroy']({'where':{'type':_0x41792d,'resourceId':_0x5a6e49['id']}})[_0x30a9('0x22')](function(){return _0x4c92e8;});})[_0x30a9('0x22')](function(){_0x541b86[_0x30a9('0x19')](0xcc)[_0x30a9('0x18')]();});}};}function handleEntityNotFound(_0x405744,_0x45cfc3){return function(_0x3e216f){if(!_0x3e216f){_0x405744['sendStatus'](0x194);}return _0x3e216f;};}function handleError(_0x4146c9,_0x234926){_0x234926=_0x234926||0x1f4;return function(_0x1bf9a3){logger[_0x30a9('0x26')](_0x1bf9a3[_0x30a9('0x27')]);if(_0x1bf9a3[_0x30a9('0x28')]){delete _0x1bf9a3[_0x30a9('0x28')];}_0x4146c9[_0x30a9('0x19')](_0x234926)[_0x30a9('0x29')](_0x1bf9a3);};}exports[_0x30a9('0x2a')]=function(_0x4e124c,_0x41fb30){var _0x5810a0={},_0x3f9102={},_0x3724da={'count':0x0,'rows':[]};var _0x23d7ef=_[_0x30a9('0x2b')](db[_0x30a9('0x2c')][_0x30a9('0x2d')],function(_0x2f9a5c){return{'name':_0x2f9a5c[_0x30a9('0x2e')],'type':_0x2f9a5c[_0x30a9('0x2f')][_0x30a9('0x30')]};});_0x3f9102['model']=_[_0x30a9('0x2b')](_0x23d7ef,'name');_0x3f9102[_0x30a9('0x31')]=_[_0x30a9('0x32')](_0x4e124c[_0x30a9('0x31')]);_0x3f9102['filters']=_[_0x30a9('0x33')](_0x3f9102[_0x30a9('0x34')],_0x3f9102[_0x30a9('0x31')]);_0x5810a0[_0x30a9('0x35')]=_['intersection'](_0x3f9102[_0x30a9('0x34')],qs['fields'](_0x4e124c['query'][_0x30a9('0x36')]));_0x5810a0['attributes']=_0x5810a0[_0x30a9('0x35')][_0x30a9('0x37')]?_0x5810a0[_0x30a9('0x35')]:_0x3f9102['model'];if(!_0x4e124c[_0x30a9('0x31')][_0x30a9('0x38')](_0x30a9('0x39'))){_0x5810a0[_0x30a9('0x1c')]=qs['limit'](_0x4e124c[_0x30a9('0x31')][_0x30a9('0x1c')]);_0x5810a0['offset']=qs[_0x30a9('0x1b')](_0x4e124c[_0x30a9('0x31')][_0x30a9('0x1b')]);}_0x5810a0['order']=qs[_0x30a9('0x3a')](_0x4e124c['query'][_0x30a9('0x3a')]);_0x5810a0[_0x30a9('0x3b')]=qs[_0x30a9('0x3c')](_[_0x30a9('0x3d')](_0x4e124c[_0x30a9('0x31')],_0x3f9102['filters']),_0x23d7ef);if(_0x4e124c[_0x30a9('0x31')][_0x30a9('0x3e')]){_0x5810a0['where']=_[_0x30a9('0x3f')](_0x5810a0[_0x30a9('0x3b')],{'$or':_[_0x30a9('0x2b')](_0x23d7ef,function(_0x2791db){if(_0x2791db[_0x30a9('0x2f')]!=='VIRTUAL'){var _0x351c26={};_0x351c26[_0x2791db[_0x30a9('0x28')]]={'$like':'%'+_0x4e124c['query'][_0x30a9('0x3e')]+'%'};return _0x351c26;}})});}_0x5810a0=_['merge']({},_0x5810a0,_0x4e124c['options']);var _0x204879={'where':_0x5810a0[_0x30a9('0x3b')]};return db[_0x30a9('0x2c')]['count'](_0x204879)[_0x30a9('0x22')](function(_0x5aff76){_0x3724da[_0x30a9('0x40')]=_0x5aff76;if(_0x4e124c[_0x30a9('0x31')]['includeAll']){_0x5810a0[_0x30a9('0x41')]=[{'all':!![]}];}return db[_0x30a9('0x2c')][_0x30a9('0x42')](_0x5810a0);})[_0x30a9('0x22')](function(_0x3defb5){_0x3724da['rows']=_0x3defb5;return _0x3724da;})[_0x30a9('0x22')](respondWithFilteredResult(_0x41fb30,_0x5810a0))[_0x30a9('0x43')](handleError(_0x41fb30,null));};exports['show']=function(_0x425c72,_0x210085){var _0x3dfb6d={'raw':!![],'where':{'id':_0x425c72[_0x30a9('0x44')]['id']}},_0x1fead1={};_0x1fead1['model']=_['keys'](db[_0x30a9('0x2c')]['rawAttributes']);_0x1fead1[_0x30a9('0x31')]=_[_0x30a9('0x32')](_0x425c72[_0x30a9('0x31')]);_0x1fead1[_0x30a9('0x3c')]=_[_0x30a9('0x33')](_0x1fead1[_0x30a9('0x34')],_0x1fead1[_0x30a9('0x31')]);_0x3dfb6d[_0x30a9('0x35')]=_[_0x30a9('0x33')](_0x1fead1[_0x30a9('0x34')],qs[_0x30a9('0x36')](_0x425c72[_0x30a9('0x31')][_0x30a9('0x36')]));_0x3dfb6d[_0x30a9('0x35')]=_0x3dfb6d[_0x30a9('0x35')]['length']?_0x3dfb6d[_0x30a9('0x35')]:_0x1fead1[_0x30a9('0x34')];if(_0x425c72[_0x30a9('0x31')]['includeAll']){_0x3dfb6d[_0x30a9('0x41')]=[{'all':!![]}];}_0x3dfb6d=_[_0x30a9('0x3f')]({},_0x3dfb6d,_0x425c72[_0x30a9('0x45')]);return db[_0x30a9('0x2c')]['find'](_0x3dfb6d)[_0x30a9('0x22')](handleEntityNotFound(_0x210085,null))[_0x30a9('0x22')](respondWithResult(_0x210085,null))['catch'](handleError(_0x210085,null));};exports[_0x30a9('0x46')]=function(_0x3b054f,_0x29df86){return db[_0x30a9('0x2c')][_0x30a9('0x46')](_0x3b054f['body'],{})['then'](function(_0x2d902b){var _0x3fa36c=_0x3b054f['user'][_0x30a9('0x24')]({'plain':!![]});if(!_0x3fa36c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fa36c[_0x30a9('0x47')]===_0x30a9('0x48')){var _0x1a45ec=_0x2d902b['get']({'plain':!![]});var _0x4ce93e=_0x30a9('0x49');return db[_0x30a9('0x4a')][_0x30a9('0x4b')]({'where':{'name':_0x4ce93e,'userProfileId':_0x3fa36c[_0x30a9('0x4c')]},'raw':!![]})[_0x30a9('0x22')](function(_0x41b5cf){if(_0x41b5cf&&_0x41b5cf[_0x30a9('0x4d')]===0x0){return db[_0x30a9('0x25')]['create']({'name':_0x1a45ec['name'],'resourceId':_0x1a45ec['id'],'type':_0x41b5cf[_0x30a9('0x28')],'sectionId':_0x41b5cf['id']},{})['then'](function(){return _0x2d902b;});}else{return _0x2d902b;}})[_0x30a9('0x43')](function(_0x56c2e2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56c2e2);throw _0x56c2e2;});}return _0x2d902b;})[_0x30a9('0x22')](respondWithResult(_0x29df86,0xc9))[_0x30a9('0x43')](handleError(_0x29df86,null));};exports[_0x30a9('0x4e')]=function(_0x468051,_0x3a7bbd){if(_0x468051['body']['id']){delete _0x468051[_0x30a9('0x4f')]['id'];}return db[_0x30a9('0x2c')][_0x30a9('0x4b')]({'where':{'id':_0x468051[_0x30a9('0x44')]['id']}})[_0x30a9('0x22')](handleEntityNotFound(_0x3a7bbd,null))[_0x30a9('0x22')](saveUpdates(_0x468051[_0x30a9('0x4f')],null))[_0x30a9('0x22')](respondWithResult(_0x3a7bbd,null))[_0x30a9('0x43')](handleError(_0x3a7bbd,null));};exports[_0x30a9('0x23')]=function(_0x3f6537,_0x48ba49){return db[_0x30a9('0x2c')]['find']({'where':{'id':_0x3f6537[_0x30a9('0x44')]['id']}})[_0x30a9('0x22')](handleEntityNotFound(_0x48ba49,null))[_0x30a9('0x22')](removeEntity(_0x48ba49,null))[_0x30a9('0x43')](handleError(_0x48ba49,null));};exports[_0x30a9('0x50')]=function(_0x535344,_0x1c0e74,_0x430f0b){return db['VoiceMail'][_0x30a9('0x51')]({'where':{'id':_0x535344[_0x30a9('0x44')]['id']}})[_0x30a9('0x22')](handleEntityNotFound(_0x1c0e74,null))[_0x30a9('0x22')](function(_0x401397){var _0x114a63;var _0x1b7e9a={},_0x3b7174={};_0x3b7174[_0x30a9('0x34')]=_[_0x30a9('0x32')](db[_0x30a9('0x52')][_0x30a9('0x2d')]);_0x3b7174['query']=_['keys'](_0x535344['query']);_0x3b7174[_0x30a9('0x3c')]=_[_0x30a9('0x33')](_0x3b7174[_0x30a9('0x34')],_0x3b7174[_0x30a9('0x31')]);_0x1b7e9a[_0x30a9('0x35')]=_[_0x30a9('0x33')](_0x3b7174['model'],qs['fields'](_0x535344[_0x30a9('0x31')][_0x30a9('0x36')]));_0x1b7e9a[_0x30a9('0x35')]=_0x1b7e9a[_0x30a9('0x35')][_0x30a9('0x37')]?_0x1b7e9a[_0x30a9('0x35')]:_0x3b7174[_0x30a9('0x34')];if(!_0x535344[_0x30a9('0x31')][_0x30a9('0x38')](_0x30a9('0x39'))){_0x1b7e9a[_0x30a9('0x1c')]=qs[_0x30a9('0x1c')](_0x535344['query'][_0x30a9('0x1c')]);_0x1b7e9a[_0x30a9('0x1b')]=qs['offset'](_0x535344[_0x30a9('0x31')][_0x30a9('0x1b')]);}_0x1b7e9a[_0x30a9('0x53')]=qs[_0x30a9('0x3a')](_0x535344['query'][_0x30a9('0x3a')]);_0x1b7e9a[_0x30a9('0x3b')]=qs[_0x30a9('0x3c')](_['pick'](_0x535344['query'],_0x3b7174[_0x30a9('0x3c')]));if(_0x535344[_0x30a9('0x31')]['filter']){_0x1b7e9a[_0x30a9('0x3b')]=_['merge'](_0x1b7e9a[_0x30a9('0x3b')],{'$or':_[_0x30a9('0x2b')](_0x1b7e9a[_0x30a9('0x35')],function(_0x414512){var _0x1209eb={};_0x1209eb[_0x414512]={'$like':'%'+_0x535344['query'][_0x30a9('0x3e')]+'%'};return _0x1209eb;})});}_0x1b7e9a[_0x30a9('0x3b')]=_[_0x30a9('0x3f')](_0x1b7e9a[_0x30a9('0x3b')],{'mailboxuser':_0x401397[_0x30a9('0x54')]});_0x1b7e9a=_[_0x30a9('0x3f')]({},_0x1b7e9a,_0x535344[_0x30a9('0x45')]);return db['VoiceMailMessage'][_0x30a9('0x55')](_0x1b7e9a)['then'](respondWithFilteredResult(_0x1c0e74,_0x1b7e9a));})[_0x30a9('0x43')](handleError(_0x1c0e74,null));}; \ No newline at end of file +var _0xd945=['index','map','VoiceMail','rawAttributes','fieldName','model','filters','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','order','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','stack','name'];(function(_0x400aa0,_0x3a058a){var _0x3ddc7f=function(_0x47d025){while(--_0x47d025){_0x400aa0['push'](_0x400aa0['shift']());}};_0x3ddc7f(++_0x3a058a);}(_0xd945,0x84));var _0x5d94=function(_0x20fce8,_0x1851d3){_0x20fce8=_0x20fce8-0x0;var _0x18b72c=_0xd945[_0x20fce8];return _0x18b72c;};'use strict';var pdf=require(_0x5d94('0x0'));var emlformat=require(_0x5d94('0x1'));var rimraf=require(_0x5d94('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d94('0x3'));var rp=require(_0x5d94('0x4'));var moment=require(_0x5d94('0x5'));var BPromise=require(_0x5d94('0x6'));var Mustache=require(_0x5d94('0x7'));var util=require('util');var path=require(_0x5d94('0x8'));var sox=require(_0x5d94('0x9'));var csv=require(_0x5d94('0xa'));var ejs=require(_0x5d94('0xb'));var fs=require('fs');var _=require(_0x5d94('0xc'));var squel=require('squel');var crypto=require(_0x5d94('0xd'));var jsforce=require(_0x5d94('0xe'));var deskjs=require(_0x5d94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d94('0x10'));var Papa=require(_0x5d94('0x11'));var Redis=require(_0x5d94('0x12'));var authService=require(_0x5d94('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d94('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d94('0x15'))(_0x5d94('0x16'));var utils=require(_0x5d94('0x17'));var config=require(_0x5d94('0x18'));var licenseUtil=require(_0x5d94('0x19'));var db=require(_0x5d94('0x1a'))['db'];function respondWithStatusCode(_0x3451fc,_0x42641b){_0x42641b=_0x42641b||0xcc;return function(_0x1aed99){if(_0x1aed99){return _0x3451fc[_0x5d94('0x1b')](_0x42641b);}return _0x3451fc['status'](_0x42641b)[_0x5d94('0x1c')]();};}function respondWithResult(_0x47616b,_0x592b93){_0x592b93=_0x592b93||0xc8;return function(_0x1d8291){if(_0x1d8291){return _0x47616b[_0x5d94('0x1d')](_0x592b93)[_0x5d94('0x1e')](_0x1d8291);}};}function respondWithFilteredResult(_0x10867c,_0x1a0011){return function(_0x452a88){if(_0x452a88){var _0x5c4d65=_0x452a88[_0x5d94('0x1f')],_0x555419=_0x1a0011[_0x5d94('0x20')],_0x541ef1=_0x1a0011[_0x5d94('0x20')]+_0x1a0011[_0x5d94('0x21')],_0x38d3c7;if(_0x541ef1>=_0x5c4d65){_0x541ef1=_0x5c4d65;_0x38d3c7=0xc8;}else{_0x38d3c7=0xce;}_0x10867c['status'](_0x38d3c7);return _0x10867c[_0x5d94('0x22')](_0x5d94('0x23'),_0x555419+'-'+_0x541ef1+'/'+_0x5c4d65)[_0x5d94('0x1e')](_0x452a88);}return null;};}function patchUpdates(_0x6c8f02){return function(_0x176f5c){try{jsonpatch[_0x5d94('0x24')](_0x176f5c,_0x6c8f02,!![]);}catch(_0x66be60){return BPromise[_0x5d94('0x25')](_0x66be60);}return _0x176f5c[_0x5d94('0x26')]();};}function saveUpdates(_0x141783,_0x1e9524){return function(_0x1a0bd5){if(_0x1a0bd5){return _0x1a0bd5[_0x5d94('0x27')](_0x141783)['then'](function(_0x2da8ba){return _0x2da8ba;});}return null;};}function removeEntity(_0x255e3f,_0x15f9b4){return function(_0x2a643f){if(_0x2a643f){return _0x2a643f[_0x5d94('0x28')]()[_0x5d94('0x29')](function(){var _0xd0fbf0=_0x2a643f[_0x5d94('0x2a')]({'plain':!![]});var _0x2f12d9=_0x5d94('0x2b');return db[_0x5d94('0x2c')][_0x5d94('0x28')]({'where':{'type':_0x2f12d9,'resourceId':_0xd0fbf0['id']}})[_0x5d94('0x29')](function(){return _0x2a643f;});})[_0x5d94('0x29')](function(){_0x255e3f[_0x5d94('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374c3f,_0x452ad7){return function(_0x3c8cc2){if(!_0x3c8cc2){_0x374c3f[_0x5d94('0x1b')](0x194);}return _0x3c8cc2;};}function handleError(_0x3241a7,_0x3a84e5){_0x3a84e5=_0x3a84e5||0x1f4;return function(_0x27426f){logger[_0x5d94('0x2d')](_0x27426f[_0x5d94('0x2e')]);if(_0x27426f[_0x5d94('0x2f')]){delete _0x27426f[_0x5d94('0x2f')];}_0x3241a7['status'](_0x3a84e5)['send'](_0x27426f);};}exports[_0x5d94('0x30')]=function(_0x54d4df,_0x19ef72){var _0x43ef7f={},_0x1bdfc5={},_0x43ee02={'count':0x0,'rows':[]};var _0x2d90f4=_[_0x5d94('0x31')](db[_0x5d94('0x32')][_0x5d94('0x33')],function(_0x20f6ba){return{'name':_0x20f6ba[_0x5d94('0x34')],'type':_0x20f6ba['type']['key']};});_0x1bdfc5[_0x5d94('0x35')]=_[_0x5d94('0x31')](_0x2d90f4,_0x5d94('0x2f'));_0x1bdfc5['query']=_['keys'](_0x54d4df['query']);_0x1bdfc5[_0x5d94('0x36')]=_['intersection'](_0x1bdfc5[_0x5d94('0x35')],_0x1bdfc5[_0x5d94('0x37')]);_0x43ef7f[_0x5d94('0x38')]=_[_0x5d94('0x39')](_0x1bdfc5[_0x5d94('0x35')],qs[_0x5d94('0x3a')](_0x54d4df[_0x5d94('0x37')][_0x5d94('0x3a')]));_0x43ef7f['attributes']=_0x43ef7f[_0x5d94('0x38')][_0x5d94('0x3b')]?_0x43ef7f[_0x5d94('0x38')]:_0x1bdfc5[_0x5d94('0x35')];if(!_0x54d4df['query']['hasOwnProperty'](_0x5d94('0x3c'))){_0x43ef7f['limit']=qs['limit'](_0x54d4df[_0x5d94('0x37')][_0x5d94('0x21')]);_0x43ef7f['offset']=qs['offset'](_0x54d4df[_0x5d94('0x37')][_0x5d94('0x20')]);}_0x43ef7f['order']=qs[_0x5d94('0x3d')](_0x54d4df[_0x5d94('0x37')][_0x5d94('0x3d')]);_0x43ef7f[_0x5d94('0x3e')]=qs[_0x5d94('0x36')](_[_0x5d94('0x3f')](_0x54d4df[_0x5d94('0x37')],_0x1bdfc5[_0x5d94('0x36')]),_0x2d90f4);if(_0x54d4df[_0x5d94('0x37')][_0x5d94('0x40')]){_0x43ef7f['where']=_[_0x5d94('0x41')](_0x43ef7f[_0x5d94('0x3e')],{'$or':_[_0x5d94('0x31')](_0x2d90f4,function(_0x240777){if(_0x240777['type']!==_0x5d94('0x42')){var _0x4688a6={};_0x4688a6[_0x240777['name']]={'$like':'%'+_0x54d4df['query'][_0x5d94('0x40')]+'%'};return _0x4688a6;}})});}_0x43ef7f=_[_0x5d94('0x41')]({},_0x43ef7f,_0x54d4df[_0x5d94('0x43')]);var _0x42f130={'where':_0x43ef7f[_0x5d94('0x3e')]};return db['VoiceMail'][_0x5d94('0x1f')](_0x42f130)[_0x5d94('0x29')](function(_0xdaf7f8){_0x43ee02[_0x5d94('0x1f')]=_0xdaf7f8;if(_0x54d4df['query'][_0x5d94('0x44')]){_0x43ef7f[_0x5d94('0x45')]=[{'all':!![]}];}return db[_0x5d94('0x32')]['findAll'](_0x43ef7f);})[_0x5d94('0x29')](function(_0x4b7617){_0x43ee02['rows']=_0x4b7617;return _0x43ee02;})['then'](respondWithFilteredResult(_0x19ef72,_0x43ef7f))[_0x5d94('0x46')](handleError(_0x19ef72,null));};exports[_0x5d94('0x47')]=function(_0x11203e,_0x1822ad){var _0x4a7cb1={'raw':!![],'where':{'id':_0x11203e[_0x5d94('0x48')]['id']}},_0xa901c={};_0xa901c['model']=_['keys'](db[_0x5d94('0x32')][_0x5d94('0x33')]);_0xa901c['query']=_[_0x5d94('0x49')](_0x11203e['query']);_0xa901c[_0x5d94('0x36')]=_['intersection'](_0xa901c[_0x5d94('0x35')],_0xa901c[_0x5d94('0x37')]);_0x4a7cb1[_0x5d94('0x38')]=_[_0x5d94('0x39')](_0xa901c[_0x5d94('0x35')],qs[_0x5d94('0x3a')](_0x11203e['query'][_0x5d94('0x3a')]));_0x4a7cb1[_0x5d94('0x38')]=_0x4a7cb1[_0x5d94('0x38')][_0x5d94('0x3b')]?_0x4a7cb1['attributes']:_0xa901c[_0x5d94('0x35')];if(_0x11203e['query']['includeAll']){_0x4a7cb1[_0x5d94('0x45')]=[{'all':!![]}];}_0x4a7cb1=_[_0x5d94('0x41')]({},_0x4a7cb1,_0x11203e[_0x5d94('0x43')]);return db[_0x5d94('0x32')][_0x5d94('0x4a')](_0x4a7cb1)[_0x5d94('0x29')](handleEntityNotFound(_0x1822ad,null))['then'](respondWithResult(_0x1822ad,null))['catch'](handleError(_0x1822ad,null));};exports[_0x5d94('0x4b')]=function(_0x400759,_0x12f893){return db[_0x5d94('0x32')][_0x5d94('0x4b')](_0x400759[_0x5d94('0x4c')],{})[_0x5d94('0x29')](function(_0x5ce78c){var _0x45a6c9=_0x400759[_0x5d94('0x4d')]['get']({'plain':!![]});if(!_0x45a6c9)throw new Error(_0x5d94('0x4e'));if(_0x45a6c9[_0x5d94('0x4f')]===_0x5d94('0x4d')){var _0x20b2bc=_0x5ce78c[_0x5d94('0x2a')]({'plain':!![]});var _0x12e049=_0x5d94('0x2b');return db[_0x5d94('0x50')]['find']({'where':{'name':_0x12e049,'userProfileId':_0x45a6c9['userProfileId']},'raw':!![]})[_0x5d94('0x29')](function(_0x38d21a){if(_0x38d21a&&_0x38d21a[_0x5d94('0x51')]===0x0){return db[_0x5d94('0x2c')]['create']({'name':_0x20b2bc[_0x5d94('0x2f')],'resourceId':_0x20b2bc['id'],'type':_0x38d21a[_0x5d94('0x2f')],'sectionId':_0x38d21a['id']},{})[_0x5d94('0x29')](function(){return _0x5ce78c;});}else{return _0x5ce78c;}})['catch'](function(_0x3178e0){logger[_0x5d94('0x2d')](_0x5d94('0x52'),_0x3178e0);throw _0x3178e0;});}return _0x5ce78c;})[_0x5d94('0x29')](respondWithResult(_0x12f893,0xc9))['catch'](handleError(_0x12f893,null));};exports[_0x5d94('0x27')]=function(_0x10c7cd,_0x3fb5e1){if(_0x10c7cd['body']['id']){delete _0x10c7cd[_0x5d94('0x4c')]['id'];}return db[_0x5d94('0x32')][_0x5d94('0x4a')]({'where':{'id':_0x10c7cd['params']['id']}})[_0x5d94('0x29')](handleEntityNotFound(_0x3fb5e1,null))[_0x5d94('0x29')](saveUpdates(_0x10c7cd[_0x5d94('0x4c')],null))[_0x5d94('0x29')](respondWithResult(_0x3fb5e1,null))[_0x5d94('0x46')](handleError(_0x3fb5e1,null));};exports[_0x5d94('0x28')]=function(_0x318659,_0xd5cbd6){return db[_0x5d94('0x32')][_0x5d94('0x4a')]({'where':{'id':_0x318659['params']['id']}})[_0x5d94('0x29')](handleEntityNotFound(_0xd5cbd6,null))[_0x5d94('0x29')](removeEntity(_0xd5cbd6,null))[_0x5d94('0x46')](handleError(_0xd5cbd6,null));};exports[_0x5d94('0x53')]=function(_0x32944c,_0x2ba161,_0x576a68){return db[_0x5d94('0x32')][_0x5d94('0x54')]({'where':{'id':_0x32944c[_0x5d94('0x48')]['id']}})[_0x5d94('0x29')](handleEntityNotFound(_0x2ba161,null))[_0x5d94('0x29')](function(_0x330698){var _0x5ddd2e;var _0x3a497f={},_0x30e28d={};_0x30e28d['model']=_['keys'](db[_0x5d94('0x55')]['rawAttributes']);_0x30e28d[_0x5d94('0x37')]=_[_0x5d94('0x49')](_0x32944c[_0x5d94('0x37')]);_0x30e28d[_0x5d94('0x36')]=_[_0x5d94('0x39')](_0x30e28d['model'],_0x30e28d['query']);_0x3a497f[_0x5d94('0x38')]=_['intersection'](_0x30e28d[_0x5d94('0x35')],qs[_0x5d94('0x3a')](_0x32944c[_0x5d94('0x37')][_0x5d94('0x3a')]));_0x3a497f[_0x5d94('0x38')]=_0x3a497f['attributes'][_0x5d94('0x3b')]?_0x3a497f['attributes']:_0x30e28d[_0x5d94('0x35')];if(!_0x32944c[_0x5d94('0x37')][_0x5d94('0x56')](_0x5d94('0x3c'))){_0x3a497f[_0x5d94('0x21')]=qs[_0x5d94('0x21')](_0x32944c[_0x5d94('0x37')][_0x5d94('0x21')]);_0x3a497f[_0x5d94('0x20')]=qs[_0x5d94('0x20')](_0x32944c[_0x5d94('0x37')][_0x5d94('0x20')]);}_0x3a497f[_0x5d94('0x57')]=qs[_0x5d94('0x3d')](_0x32944c[_0x5d94('0x37')][_0x5d94('0x3d')]);_0x3a497f[_0x5d94('0x3e')]=qs[_0x5d94('0x36')](_[_0x5d94('0x3f')](_0x32944c[_0x5d94('0x37')],_0x30e28d[_0x5d94('0x36')]));if(_0x32944c[_0x5d94('0x37')]['filter']){_0x3a497f[_0x5d94('0x3e')]=_['merge'](_0x3a497f['where'],{'$or':_[_0x5d94('0x31')](_0x3a497f[_0x5d94('0x38')],function(_0x571ce7){var _0x56149a={};_0x56149a[_0x571ce7]={'$like':'%'+_0x32944c[_0x5d94('0x37')][_0x5d94('0x40')]+'%'};return _0x56149a;})});}_0x3a497f[_0x5d94('0x3e')]=_[_0x5d94('0x41')](_0x3a497f[_0x5d94('0x3e')],{'mailboxuser':_0x330698[_0x5d94('0x58')]});_0x3a497f=_[_0x5d94('0x41')]({},_0x3a497f,_0x32944c[_0x5d94('0x43')]);return db[_0x5d94('0x55')][_0x5d94('0x59')](_0x3a497f)['then'](respondWithFilteredResult(_0x2ba161,_0x3a497f));})[_0x5d94('0x46')](handleError(_0x2ba161,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a1ca9f8..5487a84 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 _0x5522=['api','moment','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x363560,_0x156d88){var _0x18a1a2=function(_0x21456c){while(--_0x21456c){_0x363560['push'](_0x363560['shift']());}};_0x18a1a2(++_0x156d88);}(_0x5522,0x1bd));var _0x2552=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5522[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x2552('0x0'));var util=require(_0x2552('0x1'));var logger=require(_0x2552('0x2'))(_0x2552('0x3'));var moment=require(_0x2552('0x4'));var BPromise=require('bluebird');var rp=require(_0x2552('0x5'));var fs=require('fs');var path=require(_0x2552('0x6'));var rimraf=require(_0x2552('0x7'));var config=require('../../config/environment');var attributes=require(_0x2552('0x8'));module[_0x2552('0x9')]=function(_0x53db98,_0x45dbe9){return _0x53db98[_0x2552('0xa')](_0x2552('0xb'),attributes,{'tableName':_0x2552('0xc'),'paranoid':![],'indexes':[{'name':_0x2552('0xd'),'fields':[_0x2552('0xe'),_0x2552('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4186=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','context','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x499efa,_0x3f6afe){var _0xec7912=function(_0x4de33d){while(--_0x4de33d){_0x499efa['push'](_0x499efa['shift']());}};_0xec7912(++_0x3f6afe);}(_0x4186,0x11f));var _0x6418=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x4186[_0x35af23];return _0x340506;};'use strict';var _=require(_0x6418('0x0'));var util=require(_0x6418('0x1'));var logger=require(_0x6418('0x2'))(_0x6418('0x3'));var moment=require(_0x6418('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6418('0x5'));var rimraf=require(_0x6418('0x6'));var config=require(_0x6418('0x7'));var attributes=require(_0x6418('0x8'));module[_0x6418('0x9')]=function(_0x5e1be7,_0x136cdc){return _0x5e1be7[_0x6418('0xa')](_0x6418('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x6418('0xc'),'fields':['mailbox',_0x6418('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index cbe144a..cdfa7fd 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 _0x13ff=['jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x465b6f,_0x252683){var _0x4b2193=function(_0x368e28){while(--_0x368e28){_0x465b6f['push'](_0x465b6f['shift']());}};_0x4b2193(++_0x252683);}(_0x13ff,0xa7));var _0xf13f=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x13ff[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xf13f('0x0'));var util=require(_0xf13f('0x1'));var moment=require(_0xf13f('0x2'));var BPromise=require(_0xf13f('0x3'));var rs=require(_0xf13f('0x4'));var fs=require('fs');var Redis=require(_0xf13f('0x5'));var db=require(_0xf13f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf13f('0x7'));var config=require(_0xf13f('0x8'));var jayson=require(_0xf13f('0x9'));var client=jayson[_0xf13f('0xa')][_0xf13f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab6aa4,_0xa4bcfd,_0xc5f8f6){return new BPromise(function(_0xfd75ab,_0x12d81f){return client[_0xf13f('0xc')](_0xab6aa4,_0xc5f8f6)[_0xf13f('0xd')](function(_0x2f111f){logger[_0xf13f('0xe')]('VoiceMail,\x20%s,\x20%s',_0xa4bcfd,'request\x20sent');logger['debug'](_0xf13f('0xf'),_0xa4bcfd,_0xf13f('0x10'),JSON[_0xf13f('0x11')](_0x2f111f));if(_0x2f111f[_0xf13f('0x12')]){if(_0x2f111f[_0xf13f('0x12')][_0xf13f('0x13')]===0x1f4){logger[_0xf13f('0x12')](_0xf13f('0x14'),_0xa4bcfd,_0x2f111f[_0xf13f('0x12')][_0xf13f('0x15')]);return _0x12d81f(_0x2f111f[_0xf13f('0x12')]['message']);}logger[_0xf13f('0x12')]('VoiceMail,\x20%s,\x20%s',_0xa4bcfd,_0x2f111f['error'][_0xf13f('0x15')]);return _0xfd75ab(_0x2f111f['error'][_0xf13f('0x15')]);}else{logger[_0xf13f('0xe')](_0xf13f('0x14'),_0xa4bcfd,_0xf13f('0x10'));_0xfd75ab(_0x2f111f['result'][_0xf13f('0x15')]);}})['catch'](function(_0x24adb6){logger[_0xf13f('0x12')](_0xf13f('0x14'),_0xa4bcfd,_0x24adb6);_0x12d81f(_0x24adb6);});});} \ No newline at end of file +var _0x1829=['error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f4e26,_0x1eb400){var _0x23d8ec=function(_0x20d95d){while(--_0x20d95d){_0x5f4e26['push'](_0x5f4e26['shift']());}};_0x23d8ec(++_0x1eb400);}(_0x1829,0x13f));var _0x9182=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x1829[_0x20a558];return _0x53d3f7;};'use strict';var _=require('lodash');var util=require(_0x9182('0x0'));var moment=require(_0x9182('0x1'));var BPromise=require(_0x9182('0x2'));var rs=require(_0x9182('0x3'));var fs=require('fs');var Redis=require(_0x9182('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9182('0x5'));var logger=require('../../config/logger')(_0x9182('0x6'));var config=require(_0x9182('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9182('0x8')][_0x9182('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31dd0b,_0x183bf0,_0xb2839d){return new BPromise(function(_0x1687a8,_0x3c34d8){return client[_0x9182('0xa')](_0x31dd0b,_0xb2839d)[_0x9182('0xb')](function(_0x3e7ae6){logger[_0x9182('0xc')](_0x9182('0xd'),_0x183bf0,_0x9182('0xe'));logger[_0x9182('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x183bf0,_0x9182('0xe'),JSON[_0x9182('0x10')](_0x3e7ae6));if(_0x3e7ae6[_0x9182('0x11')]){if(_0x3e7ae6['error'][_0x9182('0x12')]===0x1f4){logger[_0x9182('0x11')](_0x9182('0xd'),_0x183bf0,_0x3e7ae6[_0x9182('0x11')]['message']);return _0x3c34d8(_0x3e7ae6[_0x9182('0x11')][_0x9182('0x13')]);}logger['error'](_0x9182('0xd'),_0x183bf0,_0x3e7ae6[_0x9182('0x11')][_0x9182('0x13')]);return _0x1687a8(_0x3e7ae6[_0x9182('0x11')]['message']);}else{logger[_0x9182('0xc')](_0x9182('0xd'),_0x183bf0,_0x9182('0xe'));_0x1687a8(_0x3e7ae6['result'][_0x9182('0x13')]);}})[_0x9182('0x14')](function(_0x19826e){logger['error'](_0x9182('0xd'),_0x183bf0,_0x19826e);_0x3c34d8(_0x19826e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 49fcff0..5d5a139 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 _0x1cb9=['../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4debdd,_0x114aab){var _0x4a83e6=function(_0x4e8ed8){while(--_0x4e8ed8){_0x4debdd['push'](_0x4debdd['shift']());}};_0x4a83e6(++_0x114aab);}(_0x1cb9,0x14e));var _0x91cb=function(_0x173d83,_0x3b596d){_0x173d83=_0x173d83-0x0;var _0x31272b=_0x1cb9[_0x173d83];return _0x31272b;};'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('./voiceMailMessage.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0x7')]('/:id/download',auth[_0x91cb('0x8')](),controller['download']);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0xc')]);router[_0x91cb('0xd')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['destroy']);module[_0x91cb('0x10')]=router; \ No newline at end of file +var _0xba34=['express','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x5a58db,_0x2d7f41){var _0x42dd9a=function(_0x52d814){while(--_0x52d814){_0x5a58db['push'](_0x5a58db['shift']());}};_0x42dd9a(++_0x2d7f41);}(_0xba34,0x119));var _0x4ba3=function(_0x3150f0,_0x132d5e){_0x3150f0=_0x3150f0-0x0;var _0x18d4ba=_0xba34[_0x3150f0];return _0x18d4ba;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x7')](_0x4ba3('0xc'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['update']);router[_0x4ba3('0x11')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index fa5e940..75499bb 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 _0x8e76=['exports','VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','sequelize'];(function(_0x113c26,_0x5bf13c){var _0x565778=function(_0x322345){while(--_0x322345){_0x113c26['push'](_0x113c26['shift']());}};_0x565778(++_0x5bf13c);}(_0x8e76,0x157));var _0x68e7=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8e76[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x68e7('0x0'));module[_0x68e7('0x1')]={'name':{'type':Sequelize[_0x68e7('0x2')],'get':function(_0x518a82){return this[_0x68e7('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x68e7('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x68e7('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'stamp':{'type':_0x68e7('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0xd032=['TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x445676,_0x8937a0){var _0x1b46f7=function(_0x5c53e9){while(--_0x5c53e9){_0x445676['push'](_0x445676['shift']());}};_0x1b46f7(++_0x8937a0);}(_0xd032,0x112));var _0x2d03=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xd032[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x2d03('0x0'));module[_0x2d03('0x1')]={'name':{'type':Sequelize[_0x2d03('0x2')],'get':function(_0x334b1e){return this[_0x2d03('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x2d03('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2d03('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x2d03('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x2d03('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x2d03('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x2d03('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x2d03('0x5')],'defaultValue':''},'stamp':{'type':_0x2d03('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 4985967..0a936f4 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 _0x3c42=['../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','apply','save','destroy','then','end','error','name','index','fieldName','type','key','model','differenceBy','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','include','findAll','rows','catch','show','params','includeAll','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','send','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c42,0xe2));var _0x23c4=function(_0x209aae,_0x25b88a){_0x209aae=_0x209aae-0x0;var _0x128793=_0x3c42[_0x209aae];return _0x128793;};'use strict';var pdf=require(_0x23c4('0x0'));var emlformat=require(_0x23c4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x23c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23c4('0x3'));var moment=require('moment');var BPromise=require(_0x23c4('0x4'));var Mustache=require('mustache');var util=require(_0x23c4('0x5'));var path=require(_0x23c4('0x6'));var sox=require('sox');var csv=require(_0x23c4('0x7'));var ejs=require(_0x23c4('0x8'));var fs=require('fs');var _=require(_0x23c4('0x9'));var squel=require(_0x23c4('0xa'));var crypto=require(_0x23c4('0xb'));var jsforce=require(_0x23c4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x23c4('0x7'));var querystring=require(_0x23c4('0xd'));var Papa=require(_0x23c4('0xe'));var Redis=require(_0x23c4('0xf'));var authService=require(_0x23c4('0x10'));var qs=require(_0x23c4('0x11'));var as=require(_0x23c4('0x12'));var hardwareService=require(_0x23c4('0x13'));var logger=require(_0x23c4('0x14'))(_0x23c4('0x15'));var utils=require(_0x23c4('0x16'));var config=require(_0x23c4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x23c4('0x18'))['db'];function respondWithStatusCode(_0x23ccde,_0x4b978c){_0x4b978c=_0x4b978c||0xcc;return function(_0x1ecf4c){if(_0x1ecf4c){return _0x23ccde[_0x23c4('0x19')](_0x4b978c);}return _0x23ccde[_0x23c4('0x1a')](_0x4b978c)['end']();};}function respondWithResult(_0x29a8c9,_0x587ef7){_0x587ef7=_0x587ef7||0xc8;return function(_0x28ebca){if(_0x28ebca){return _0x29a8c9[_0x23c4('0x1a')](_0x587ef7)['json'](_0x28ebca);}};}function respondWithFilteredResult(_0x5dc768,_0x37ef78){return function(_0x4c58c1){if(_0x4c58c1){var _0x44bcf7=_0x4c58c1[_0x23c4('0x1b')],_0x148d0f=_0x37ef78['offset'],_0x40a307=_0x37ef78[_0x23c4('0x1c')]+_0x37ef78['limit'],_0x366111;if(_0x40a307>=_0x44bcf7){_0x40a307=_0x44bcf7;_0x366111=0xc8;}else{_0x366111=0xce;}_0x5dc768[_0x23c4('0x1a')](_0x366111);return _0x5dc768[_0x23c4('0x1d')](_0x23c4('0x1e'),_0x148d0f+'-'+_0x40a307+'/'+_0x44bcf7)['json'](_0x4c58c1);}return null;};}function patchUpdates(_0x28adba){return function(_0x5eaa33){try{jsonpatch[_0x23c4('0x1f')](_0x5eaa33,_0x28adba,!![]);}catch(_0x48b4ac){return BPromise['reject'](_0x48b4ac);}return _0x5eaa33[_0x23c4('0x20')]();};}function saveUpdates(_0x274e27,_0x52928f){return function(_0x2fd15d){if(_0x2fd15d){return _0x2fd15d['update'](_0x274e27)['then'](function(_0xe54709){return _0xe54709;});}return null;};}function removeEntity(_0x453ba2,_0xa11304){return function(_0x3e41aa){if(_0x3e41aa){return _0x3e41aa[_0x23c4('0x21')]()[_0x23c4('0x22')](function(){_0x453ba2[_0x23c4('0x1a')](0xcc)[_0x23c4('0x23')]();});}};}function handleEntityNotFound(_0x471c77,_0x2f1abf){return function(_0x599b0d){if(!_0x599b0d){_0x471c77['sendStatus'](0x194);}return _0x599b0d;};}function handleError(_0x3a6eac,_0x1fc29a){_0x1fc29a=_0x1fc29a||0x1f4;return function(_0x4d0580){logger[_0x23c4('0x24')](_0x4d0580['stack']);if(_0x4d0580[_0x23c4('0x25')]){delete _0x4d0580[_0x23c4('0x25')];}_0x3a6eac['status'](_0x1fc29a)['send'](_0x4d0580);};}exports[_0x23c4('0x26')]=function(_0x257465,_0x5a07c7){var _0xaaf104={},_0x5354b9={},_0x465934={'count':0x0,'rows':[]};var _0x351ae9=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x13f3f8){return{'name':_0x13f3f8[_0x23c4('0x27')],'type':_0x13f3f8[_0x23c4('0x28')][_0x23c4('0x29')]};});_0x5354b9[_0x23c4('0x2a')]=_[_0x23c4('0x2b')](_[_0x23c4('0x2c')](_0x351ae9,'name'),[_0x23c4('0x25')]);_0x5354b9[_0x23c4('0x2d')]=_[_0x23c4('0x2e')](_0x257465[_0x23c4('0x2d')]);_0x5354b9[_0x23c4('0x2f')]=_['intersection'](_0x5354b9[_0x23c4('0x2a')],_0x5354b9[_0x23c4('0x2d')]);_0xaaf104[_0x23c4('0x30')]=_[_0x23c4('0x31')](_0x5354b9[_0x23c4('0x2a')],qs[_0x23c4('0x32')](_0x257465['query'][_0x23c4('0x32')]));_0xaaf104['attributes']=_0xaaf104['attributes'][_0x23c4('0x33')]?_0xaaf104[_0x23c4('0x30')]:_0x5354b9['model'];if(!_0x257465[_0x23c4('0x2d')][_0x23c4('0x34')]('nolimit')){_0xaaf104[_0x23c4('0x35')]=qs[_0x23c4('0x35')](_0x257465[_0x23c4('0x2d')][_0x23c4('0x35')]);_0xaaf104[_0x23c4('0x1c')]=qs[_0x23c4('0x1c')](_0x257465[_0x23c4('0x2d')][_0x23c4('0x1c')]);}_0xaaf104[_0x23c4('0x36')]=qs[_0x23c4('0x37')](_0x257465['query'][_0x23c4('0x37')]);_0xaaf104[_0x23c4('0x38')]=qs[_0x23c4('0x2f')](_[_0x23c4('0x39')](_0x257465[_0x23c4('0x2d')],_0x5354b9[_0x23c4('0x2f')]),_0x351ae9);if(_0x257465[_0x23c4('0x2d')][_0x23c4('0x3a')]){_0xaaf104[_0x23c4('0x38')]=_[_0x23c4('0x3b')](_0xaaf104[_0x23c4('0x38')],{'$or':_[_0x23c4('0x2c')](_0x351ae9,function(_0x4d9341){if(_0x4d9341['type']!==_0x23c4('0x3c')){var _0x38a813={};_0x38a813[_0x4d9341[_0x23c4('0x25')]]={'$like':'%'+_0x257465['query'][_0x23c4('0x3a')]+'%'};return _0x38a813;}})});}_0xaaf104=_[_0x23c4('0x3b')]({},_0xaaf104,_0x257465[_0x23c4('0x3d')]);var _0x10f868={'where':_0xaaf104[_0x23c4('0x38')]};return db[_0x23c4('0x3e')][_0x23c4('0x1b')](_0x10f868)[_0x23c4('0x22')](function(_0x430eed){_0x465934[_0x23c4('0x1b')]=_0x430eed;if(_0x257465[_0x23c4('0x2d')]['includeAll']){_0xaaf104[_0x23c4('0x3f')]=[{'all':!![]}];}return db[_0x23c4('0x3e')][_0x23c4('0x40')](_0xaaf104);})['then'](function(_0x1cad4c){_0x465934[_0x23c4('0x41')]=_0x1cad4c;return _0x465934;})[_0x23c4('0x22')](respondWithFilteredResult(_0x5a07c7,_0xaaf104))[_0x23c4('0x42')](handleError(_0x5a07c7,null));};exports[_0x23c4('0x43')]=function(_0x13f75b,_0x174aea){var _0x49672c={'raw':!![],'where':{'id':_0x13f75b[_0x23c4('0x44')]['id']}},_0x4f0fa5={};_0x4f0fa5['model']=_['keys'](db[_0x23c4('0x3e')]['rawAttributes']);_0x4f0fa5['query']=_[_0x23c4('0x2e')](_0x13f75b[_0x23c4('0x2d')]);_0x4f0fa5['filters']=_[_0x23c4('0x31')](_0x4f0fa5[_0x23c4('0x2a')],_0x4f0fa5[_0x23c4('0x2d')]);_0x49672c[_0x23c4('0x30')]=_[_0x23c4('0x31')](_0x4f0fa5[_0x23c4('0x2a')],qs[_0x23c4('0x32')](_0x13f75b[_0x23c4('0x2d')]['fields']));_0x49672c[_0x23c4('0x30')]=_0x49672c[_0x23c4('0x30')][_0x23c4('0x33')]?_0x49672c[_0x23c4('0x30')]:_0x4f0fa5[_0x23c4('0x2a')];if(_0x13f75b['query'][_0x23c4('0x45')]){_0x49672c[_0x23c4('0x3f')]=[{'all':!![]}];}_0x49672c=_['merge']({},_0x49672c,_0x13f75b[_0x23c4('0x3d')]);return db[_0x23c4('0x3e')]['find'](_0x49672c)['then'](handleEntityNotFound(_0x174aea,null))[_0x23c4('0x22')](respondWithResult(_0x174aea,null))[_0x23c4('0x42')](handleError(_0x174aea,null));};exports[_0x23c4('0x46')]=function(_0x3aa5f6,_0x44ad4c){return db[_0x23c4('0x3e')][_0x23c4('0x46')](_0x3aa5f6[_0x23c4('0x47')],{})[_0x23c4('0x22')](respondWithResult(_0x44ad4c,0xc9))[_0x23c4('0x42')](handleError(_0x44ad4c,null));};exports['update']=function(_0x50528f,_0x4de5d2){if(_0x50528f['body']['id']){delete _0x50528f['body']['id'];}return db[_0x23c4('0x3e')]['find']({'where':{'id':_0x50528f[_0x23c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x4de5d2,null))[_0x23c4('0x22')](saveUpdates(_0x50528f[_0x23c4('0x47')],null))['then'](respondWithResult(_0x4de5d2,null))[_0x23c4('0x42')](handleError(_0x4de5d2,null));};exports[_0x23c4('0x21')]=function(_0x5be171,_0x7fcd3e){return db[_0x23c4('0x3e')][_0x23c4('0x48')]({'where':{'id':_0x5be171[_0x23c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x7fcd3e,null))[_0x23c4('0x22')](removeEntity(_0x7fcd3e,null))['catch'](handleError(_0x7fcd3e,null));};exports[_0x23c4('0x49')]=function(_0x5cbd2f,_0x42684c,_0x4eea6d){return db['VoiceMailMessage']['find']({'where':{'id':_0x5cbd2f['params']['id']},'attributes':['id',_0x23c4('0x4a'),_0x23c4('0x4b')]})['then'](handleEntityNotFound(_0x42684c,null))[_0x23c4('0x22')](function(_0xb9f83){if(_0xb9f83){if(!_0xb9f83[_0x23c4('0x4a')]){throw new db[(_0x23c4('0x4c'))][(_0x23c4('0x4d'))](_0x23c4('0x4e'));}var _0x69fadc={'Content-Type':'audio/wav','Content-Disposition':_0x23c4('0x4f')};if(_0xb9f83[_0x23c4('0x4b')]){_0x69fadc[_0x23c4('0x50')]='attachment;\x20filename=\x22'+_0xb9f83[_0x23c4('0x4b')]+_0x23c4('0x51');}_0x42684c['set'](_0x69fadc);return _0x42684c[_0x23c4('0x52')](new Buffer(_0xb9f83[_0x23c4('0x4a')]));}})[_0x23c4('0x42')](handleError(_0x42684c,null));}; \ No newline at end of file +var _0xb805=['sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set','send','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','then','destroy','end','error','stack','name','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x34c0f7,_0x519917){var _0x399e4c=function(_0x527937){while(--_0x527937){_0x34c0f7['push'](_0x34c0f7['shift']());}};_0x399e4c(++_0x519917);}(_0xb805,0xb9));var _0x5b80=function(_0xa449df,_0x5b32af){_0xa449df=_0xa449df-0x0;var _0x4bb97d=_0xb805[_0xa449df];return _0x4bb97d;};'use strict';var pdf=require(_0x5b80('0x0'));var emlformat=require(_0x5b80('0x1'));var rimraf=require(_0x5b80('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b80('0x3'));var rp=require('request-promise');var moment=require(_0x5b80('0x4'));var BPromise=require(_0x5b80('0x5'));var Mustache=require(_0x5b80('0x6'));var util=require(_0x5b80('0x7'));var path=require(_0x5b80('0x8'));var sox=require('sox');var csv=require(_0x5b80('0x9'));var ejs=require(_0x5b80('0xa'));var fs=require('fs');var _=require(_0x5b80('0xb'));var squel=require(_0x5b80('0xc'));var crypto=require(_0x5b80('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5b80('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5b80('0xf'));var Papa=require(_0x5b80('0x10'));var Redis=require(_0x5b80('0x11'));var authService=require(_0x5b80('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5b80('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b80('0x14'))(_0x5b80('0x15'));var utils=require(_0x5b80('0x16'));var config=require(_0x5b80('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b80('0x18'))['db'];function respondWithStatusCode(_0x3250ef,_0x1275d0){_0x1275d0=_0x1275d0||0xcc;return function(_0x594c56){if(_0x594c56){return _0x3250ef[_0x5b80('0x19')](_0x1275d0);}return _0x3250ef[_0x5b80('0x1a')](_0x1275d0)['end']();};}function respondWithResult(_0x141a1f,_0x4404c6){_0x4404c6=_0x4404c6||0xc8;return function(_0x552c3d){if(_0x552c3d){return _0x141a1f[_0x5b80('0x1a')](_0x4404c6)['json'](_0x552c3d);}};}function respondWithFilteredResult(_0x323e97,_0xda1b9b){return function(_0x4a7ef3){if(_0x4a7ef3){var _0x2e394b=_0x4a7ef3[_0x5b80('0x1b')],_0x4ed24b=_0xda1b9b['offset'],_0x4e0da8=_0xda1b9b[_0x5b80('0x1c')]+_0xda1b9b[_0x5b80('0x1d')],_0xe591fd;if(_0x4e0da8>=_0x2e394b){_0x4e0da8=_0x2e394b;_0xe591fd=0xc8;}else{_0xe591fd=0xce;}_0x323e97[_0x5b80('0x1a')](_0xe591fd);return _0x323e97['set']('Content-Range',_0x4ed24b+'-'+_0x4e0da8+'/'+_0x2e394b)['json'](_0x4a7ef3);}return null;};}function patchUpdates(_0x2d862e){return function(_0xca0533){try{jsonpatch['apply'](_0xca0533,_0x2d862e,!![]);}catch(_0x4d21c7){return BPromise['reject'](_0x4d21c7);}return _0xca0533['save']();};}function saveUpdates(_0xad3558,_0x4128fc){return function(_0x5979d3){if(_0x5979d3){return _0x5979d3['update'](_0xad3558)[_0x5b80('0x1e')](function(_0x290314){return _0x290314;});}return null;};}function removeEntity(_0x798bc6,_0x59411e){return function(_0x4c1189){if(_0x4c1189){return _0x4c1189[_0x5b80('0x1f')]()['then'](function(){_0x798bc6[_0x5b80('0x1a')](0xcc)[_0x5b80('0x20')]();});}};}function handleEntityNotFound(_0xbd45a4,_0xf5d908){return function(_0x1dfaca){if(!_0x1dfaca){_0xbd45a4[_0x5b80('0x19')](0x194);}return _0x1dfaca;};}function handleError(_0x2c08a5,_0x50dd56){_0x50dd56=_0x50dd56||0x1f4;return function(_0x4ba624){logger[_0x5b80('0x21')](_0x4ba624[_0x5b80('0x22')]);if(_0x4ba624[_0x5b80('0x23')]){delete _0x4ba624[_0x5b80('0x23')];}_0x2c08a5[_0x5b80('0x1a')](_0x50dd56)['send'](_0x4ba624);};}exports['index']=function(_0x381ea4,_0x77dac3){var _0x50642b={},_0x1c5d0e={},_0x268af1={'count':0x0,'rows':[]};var _0x176200=_[_0x5b80('0x24')](db[_0x5b80('0x25')]['rawAttributes'],function(_0x28d2ff){return{'name':_0x28d2ff[_0x5b80('0x26')],'type':_0x28d2ff[_0x5b80('0x27')]['key']};});_0x1c5d0e[_0x5b80('0x28')]=_[_0x5b80('0x29')](_[_0x5b80('0x24')](_0x176200,_0x5b80('0x23')),[_0x5b80('0x23')]);_0x1c5d0e[_0x5b80('0x2a')]=_[_0x5b80('0x2b')](_0x381ea4['query']);_0x1c5d0e[_0x5b80('0x2c')]=_[_0x5b80('0x2d')](_0x1c5d0e[_0x5b80('0x28')],_0x1c5d0e[_0x5b80('0x2a')]);_0x50642b[_0x5b80('0x2e')]=_[_0x5b80('0x2d')](_0x1c5d0e[_0x5b80('0x28')],qs[_0x5b80('0x2f')](_0x381ea4['query'][_0x5b80('0x2f')]));_0x50642b[_0x5b80('0x2e')]=_0x50642b[_0x5b80('0x2e')][_0x5b80('0x30')]?_0x50642b[_0x5b80('0x2e')]:_0x1c5d0e[_0x5b80('0x28')];if(!_0x381ea4[_0x5b80('0x2a')][_0x5b80('0x31')](_0x5b80('0x32'))){_0x50642b[_0x5b80('0x1d')]=qs[_0x5b80('0x1d')](_0x381ea4[_0x5b80('0x2a')][_0x5b80('0x1d')]);_0x50642b['offset']=qs[_0x5b80('0x1c')](_0x381ea4[_0x5b80('0x2a')]['offset']);}_0x50642b[_0x5b80('0x33')]=qs[_0x5b80('0x34')](_0x381ea4[_0x5b80('0x2a')][_0x5b80('0x34')]);_0x50642b[_0x5b80('0x35')]=qs[_0x5b80('0x2c')](_[_0x5b80('0x36')](_0x381ea4['query'],_0x1c5d0e['filters']),_0x176200);if(_0x381ea4[_0x5b80('0x2a')]['filter']){_0x50642b[_0x5b80('0x35')]=_[_0x5b80('0x37')](_0x50642b[_0x5b80('0x35')],{'$or':_[_0x5b80('0x24')](_0x176200,function(_0x50e56b){if(_0x50e56b[_0x5b80('0x27')]!==_0x5b80('0x38')){var _0xda6e90={};_0xda6e90[_0x50e56b['name']]={'$like':'%'+_0x381ea4[_0x5b80('0x2a')]['filter']+'%'};return _0xda6e90;}})});}_0x50642b=_[_0x5b80('0x37')]({},_0x50642b,_0x381ea4[_0x5b80('0x39')]);var _0x772328={'where':_0x50642b[_0x5b80('0x35')]};return db[_0x5b80('0x25')][_0x5b80('0x1b')](_0x772328)[_0x5b80('0x1e')](function(_0x22ee72){_0x268af1[_0x5b80('0x1b')]=_0x22ee72;if(_0x381ea4['query'][_0x5b80('0x3a')]){_0x50642b[_0x5b80('0x3b')]=[{'all':!![]}];}return db[_0x5b80('0x25')]['findAll'](_0x50642b);})['then'](function(_0x4aa7f5){_0x268af1[_0x5b80('0x3c')]=_0x4aa7f5;return _0x268af1;})[_0x5b80('0x1e')](respondWithFilteredResult(_0x77dac3,_0x50642b))[_0x5b80('0x3d')](handleError(_0x77dac3,null));};exports['show']=function(_0x265399,_0x49a1df){var _0x25f61f={'raw':!![],'where':{'id':_0x265399[_0x5b80('0x3e')]['id']}},_0x30fb83={};_0x30fb83['model']=_[_0x5b80('0x2b')](db['VoiceMailMessage'][_0x5b80('0x3f')]);_0x30fb83[_0x5b80('0x2a')]=_['keys'](_0x265399[_0x5b80('0x2a')]);_0x30fb83[_0x5b80('0x2c')]=_[_0x5b80('0x2d')](_0x30fb83[_0x5b80('0x28')],_0x30fb83['query']);_0x25f61f[_0x5b80('0x2e')]=_[_0x5b80('0x2d')](_0x30fb83[_0x5b80('0x28')],qs['fields'](_0x265399[_0x5b80('0x2a')][_0x5b80('0x2f')]));_0x25f61f['attributes']=_0x25f61f[_0x5b80('0x2e')][_0x5b80('0x30')]?_0x25f61f[_0x5b80('0x2e')]:_0x30fb83[_0x5b80('0x28')];if(_0x265399[_0x5b80('0x2a')][_0x5b80('0x3a')]){_0x25f61f[_0x5b80('0x3b')]=[{'all':!![]}];}_0x25f61f=_['merge']({},_0x25f61f,_0x265399['options']);return db[_0x5b80('0x25')][_0x5b80('0x40')](_0x25f61f)['then'](handleEntityNotFound(_0x49a1df,null))[_0x5b80('0x1e')](respondWithResult(_0x49a1df,null))[_0x5b80('0x3d')](handleError(_0x49a1df,null));};exports['create']=function(_0x3e1e8a,_0x5451ea){return db[_0x5b80('0x25')][_0x5b80('0x41')](_0x3e1e8a[_0x5b80('0x42')],{})[_0x5b80('0x1e')](respondWithResult(_0x5451ea,0xc9))[_0x5b80('0x3d')](handleError(_0x5451ea,null));};exports['update']=function(_0x88f99d,_0x25600a){if(_0x88f99d['body']['id']){delete _0x88f99d[_0x5b80('0x42')]['id'];}return db[_0x5b80('0x25')]['find']({'where':{'id':_0x88f99d['params']['id']}})[_0x5b80('0x1e')](handleEntityNotFound(_0x25600a,null))['then'](saveUpdates(_0x88f99d[_0x5b80('0x42')],null))[_0x5b80('0x1e')](respondWithResult(_0x25600a,null))[_0x5b80('0x3d')](handleError(_0x25600a,null));};exports['destroy']=function(_0x5368e8,_0x176000){return db[_0x5b80('0x25')][_0x5b80('0x40')]({'where':{'id':_0x5368e8[_0x5b80('0x3e')]['id']}})[_0x5b80('0x1e')](handleEntityNotFound(_0x176000,null))[_0x5b80('0x1e')](removeEntity(_0x176000,null))['catch'](handleError(_0x176000,null));};exports[_0x5b80('0x43')]=function(_0x164ff5,_0x228074,_0x20581b){return db[_0x5b80('0x25')][_0x5b80('0x40')]({'where':{'id':_0x164ff5[_0x5b80('0x3e')]['id']},'attributes':['id',_0x5b80('0x44'),_0x5b80('0x45')]})[_0x5b80('0x1e')](handleEntityNotFound(_0x228074,null))[_0x5b80('0x1e')](function(_0x2f8b88){if(_0x2f8b88){if(!_0x2f8b88[_0x5b80('0x44')]){throw new db[(_0x5b80('0x46'))][(_0x5b80('0x47'))](_0x5b80('0x48'));}var _0x405f99={'Content-Type':_0x5b80('0x49'),'Content-Disposition':_0x5b80('0x4a')};if(_0x2f8b88[_0x5b80('0x45')]){_0x405f99[_0x5b80('0x4b')]=_0x5b80('0x4c')+_0x2f8b88[_0x5b80('0x45')]+'.wav\x22';}_0x228074[_0x5b80('0x4d')](_0x405f99);return _0x228074[_0x5b80('0x4e')](new Buffer(_0x2f8b88[_0x5b80('0x44')]));}})[_0x5b80('0x3d')](handleError(_0x228074,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b9d344c..b790e40 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 _0x4ab3=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x7e6cf7,_0x4c8e23){var _0x18d4ee=function(_0x14b2fc){while(--_0x14b2fc){_0x7e6cf7['push'](_0x7e6cf7['shift']());}};_0x18d4ee(++_0x4c8e23);}(_0x4ab3,0x14a));var _0x34ab=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x4ab3[_0xad57ee];return _0x3eaea9;};'use strict';var _=require(_0x34ab('0x0'));var util=require(_0x34ab('0x1'));var logger=require(_0x34ab('0x2'))('api');var moment=require(_0x34ab('0x3'));var BPromise=require(_0x34ab('0x4'));var rp=require(_0x34ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ab('0x6'));module[_0x34ab('0x7')]=function(_0x25430d,_0x14eb14){return _0x25430d[_0x34ab('0x8')](_0x34ab('0x9'),attributes,{'tableName':_0x34ab('0xa'),'paranoid':![],'indexes':[{'name':_0x34ab('0xb'),'fields':[_0x34ab('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1fac=['exports','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1fac,0xb9));var _0xc1fa=function(_0x526815,_0x1c5629){_0x526815=_0x526815-0x0;var _0x2ffcd5=_0x1fac[_0x526815];return _0x2ffcd5;};'use strict';var _=require(_0xc1fa('0x0'));var util=require(_0xc1fa('0x1'));var logger=require(_0xc1fa('0x2'))(_0xc1fa('0x3'));var moment=require(_0xc1fa('0x4'));var BPromise=require(_0xc1fa('0x5'));var rp=require(_0xc1fa('0x6'));var fs=require('fs');var path=require(_0xc1fa('0x7'));var rimraf=require(_0xc1fa('0x8'));var config=require('../../config/environment');var attributes=require(_0xc1fa('0x9'));module[_0xc1fa('0xa')]=function(_0x4fab18,_0x3fbff1){return _0x4fab18['define']('VoiceMailMessage',attributes,{'tableName':_0xc1fa('0xb'),'paranoid':![],'indexes':[{'name':_0xc1fa('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c781708..096e3ef 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(_0x4050a2,_0x185d9d){var _0x2fea5c=function(_0x1e778d){while(--_0x1e778d){_0x4050a2['push'](_0x4050a2['shift']());}};_0x2fea5c(++_0x185d9d);}(_0x14a0,0x8e));var _0x014a=function(_0xe256de,_0x8cd3f3){_0xe256de=_0xe256de-0x0;var _0x4f67b8=_0x14a0[_0xe256de];return _0x4f67b8;};'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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x511d01,_0x3cc55c){var _0x250b5c=function(_0x4522ca){while(--_0x4522ca){_0x511d01['push'](_0x511d01['shift']());}};_0x250b5c(++_0x3cc55c);}(_0xdb28,0x106));var _0x8db2=function(_0x342a78,_0x5e9ffa){_0x342a78=_0x342a78-0x0;var _0x133f0a=_0xdb28[_0x342a78];return _0x133f0a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 64fec4e..1873bcc 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 _0x78ca=['/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','index','get'];(function(_0x1a7630,_0x32cf65){var _0x3148db=function(_0x4f55f5){while(--_0x4f55f5){_0x1a7630['push'](_0x1a7630['shift']());}};_0x3148db(++_0x32cf65);}(_0x78ca,0xee));var _0xa78c=function(_0x45c9c3,_0x19d602){_0x45c9c3=_0x45c9c3-0x0;var _0x1f5f1d=_0x78ca[_0x45c9c3];return _0x1f5f1d;};'use strict';var multer=require(_0xa78c('0x0'));var util=require(_0xa78c('0x1'));var path=require(_0xa78c('0x2'));var timeout=require(_0xa78c('0x3'));var express=require(_0xa78c('0x4'));var router=express[_0xa78c('0x5')]();var auth=require(_0xa78c('0x6'));var interaction=require(_0xa78c('0x7'));var config=require('../../config/environment');var controller=require(_0xa78c('0x8'));router['get']('/',auth[_0xa78c('0x9')](),controller[_0xa78c('0xa')]);router[_0xa78c('0xb')](_0xa78c('0xc'),auth['isAuthenticated'](),controller[_0xa78c('0xd')]);router[_0xa78c('0xb')](_0xa78c('0xe'),auth[_0xa78c('0x9')](),controller[_0xa78c('0xf')]);router[_0xa78c('0x10')]('/',auth[_0xa78c('0x9')](),controller[_0xa78c('0x11')]);router[_0xa78c('0x10')](_0xa78c('0xe'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x12')]);router[_0xa78c('0x13')](_0xa78c('0xc'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x14')]);router[_0xa78c('0x15')](_0xa78c('0xc'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x16')]);router[_0xa78c('0x15')](_0xa78c('0x17'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x18')]);module['exports']=router; \ No newline at end of file +var _0xae35=['get','index','/:id/sounds','isAuthenticated','getSounds','post','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xae35,0x7b));var _0x5ae3=function(_0x225d39,_0x33afac){_0x225d39=_0x225d39-0x0;var _0x1a62cd=_0xae35[_0x225d39];return _0x1a62cd;};'use strict';var multer=require(_0x5ae3('0x0'));var util=require(_0x5ae3('0x1'));var path=require(_0x5ae3('0x2'));var timeout=require(_0x5ae3('0x3'));var express=require(_0x5ae3('0x4'));var router=express[_0x5ae3('0x5')]();var auth=require(_0x5ae3('0x6'));var interaction=require(_0x5ae3('0x7'));var config=require(_0x5ae3('0x8'));var controller=require(_0x5ae3('0x9'));router[_0x5ae3('0xa')]('/',auth['isAuthenticated'](),controller[_0x5ae3('0xb')]);router[_0x5ae3('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5ae3('0xa')](_0x5ae3('0xc'),auth[_0x5ae3('0xd')](),controller[_0x5ae3('0xe')]);router[_0x5ae3('0xf')]('/',auth[_0x5ae3('0xd')](),controller['create']);router[_0x5ae3('0xf')]('/:id/sounds',auth[_0x5ae3('0xd')](),controller['addSound']);router['put'](_0x5ae3('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x5ae3('0xd')](),controller['destroy']);router[_0x5ae3('0x11')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller['removeSound']);module[_0x5ae3('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4e1bada..6e53c2b 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 _0x94b9=['sequelize','exports','STRING','name','ENUM','mp3nb','quietmp3nb','quietmp3','files','alpha','TIMESTAMP','BOOLEAN'];(function(_0x13d9ac,_0x193a78){var _0x348a17=function(_0x5625a2){while(--_0x5625a2){_0x13d9ac['push'](_0x13d9ac['shift']());}};_0x348a17(++_0x193a78);}(_0x94b9,0xe4));var _0x994b=function(_0x561663,_0x760489){_0x561663=_0x561663-0x0;var _0x1f6580=_0x94b9[_0x561663];return _0x1f6580;};'use strict';var Sequelize=require(_0x994b('0x0'));module[_0x994b('0x1')]={'name':{'type':Sequelize[_0x994b('0x2')],'allowNull':![],'unique':_0x994b('0x3')},'mode':{'type':Sequelize[_0x994b('0x4')]('custom','files',_0x994b('0x5'),_0x994b('0x6'),_0x994b('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x994b('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x994b('0x2')],'allowNull':!![],'defaultValue':_0x994b('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x994b('0xa')},'defaultEntry':{'type':Sequelize[_0x994b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0045=['custom','quietmp3nb','quietmp3','mp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','exports','ENUM'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x0045,0x1ab));var _0x5004=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0045[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x5004('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x5004('0x1')](_0x5004('0x2'),'files','mp3nb',_0x5004('0x3'),_0x5004('0x4'),_0x5004('0x5')),'allowNull':!![],'defaultValue':_0x5004('0x6')},'directory':{'type':Sequelize[_0x5004('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x5004('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5004('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5004('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x5004('0x9')},'defaultEntry':{'type':Sequelize[_0x5004('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 e6a77fd..67708f7 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 _0xc188=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','update','destroy','then','end','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','ValidationError','message','addSound','sequelize','Sound','findOne','save_name','converted_format','createdAt','format','extname','%s.%s','symlinkSync','Sequelize','removeSound','id2','length','html-pdf','fast-json-patch','bluebird','util','path','to-csv','lodash','squel'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc188,0x1ec));var _0x8c18=function(_0x1caa5e,_0x228179){_0x1caa5e=_0x1caa5e-0x0;var _0x4bf1ea=_0xc188[_0x1caa5e];return _0x4bf1ea;};'use strict';var pdf=require(_0x8c18('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c18('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8c18('0x2'));var Mustache=require('mustache');var util=require(_0x8c18('0x3'));var path=require(_0x8c18('0x4'));var sox=require('sox');var csv=require(_0x8c18('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c18('0x6'));var squel=require(_0x8c18('0x7'));var crypto=require(_0x8c18('0x8'));var jsforce=require(_0x8c18('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8c18('0x5'));var querystring=require(_0x8c18('0xa'));var Papa=require('papaparse');var Redis=require(_0x8c18('0xb'));var authService=require(_0x8c18('0xc'));var qs=require(_0x8c18('0xd'));var as=require(_0x8c18('0xe'));var hardwareService=require(_0x8c18('0xf'));var logger=require('../../config/logger')(_0x8c18('0x10'));var utils=require(_0x8c18('0x11'));var config=require(_0x8c18('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e1e4,_0xa6061d){_0xa6061d=_0xa6061d||0xcc;return function(_0x16025b){if(_0x16025b){return _0x23e1e4[_0x8c18('0x13')](_0xa6061d);}return _0x23e1e4[_0x8c18('0x14')](_0xa6061d)['end']();};}function respondWithResult(_0xf3f140,_0x57b715){_0x57b715=_0x57b715||0xc8;return function(_0x2683eb){if(_0x2683eb){return _0xf3f140[_0x8c18('0x14')](_0x57b715)[_0x8c18('0x15')](_0x2683eb);}};}function respondWithFilteredResult(_0x32a92e,_0x16c49e){return function(_0x4a4b9d){if(_0x4a4b9d){var _0x345a55=_0x4a4b9d[_0x8c18('0x16')],_0x1cc01c=_0x16c49e[_0x8c18('0x17')],_0x2d7a55=_0x16c49e[_0x8c18('0x17')]+_0x16c49e[_0x8c18('0x18')],_0x38f70b;if(_0x2d7a55>=_0x345a55){_0x2d7a55=_0x345a55;_0x38f70b=0xc8;}else{_0x38f70b=0xce;}_0x32a92e[_0x8c18('0x14')](_0x38f70b);return _0x32a92e[_0x8c18('0x19')](_0x8c18('0x1a'),_0x1cc01c+'-'+_0x2d7a55+'/'+_0x345a55)[_0x8c18('0x15')](_0x4a4b9d);}return null;};}function patchUpdates(_0x82a713){return function(_0x396606){try{jsonpatch['apply'](_0x396606,_0x82a713,!![]);}catch(_0x35e564){return BPromise['reject'](_0x35e564);}return _0x396606['save']();};}function saveUpdates(_0x585aba,_0x51a895){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0x8c18('0x1b')](_0x585aba)['then'](function(_0x1730bd){return _0x1730bd;});}return null;};}function removeEntity(_0x3df6c1,_0x10a647){return function(_0xe8ca04){if(_0xe8ca04){return _0xe8ca04[_0x8c18('0x1c')]()[_0x8c18('0x1d')](function(){var _0x395992=_0xe8ca04['get']({'plain':!![]});var _0x3aa12c='MusicOnHolds';return db['UserProfileResource']['destroy']({'where':{'type':_0x3aa12c,'resourceId':_0x395992['id']}})[_0x8c18('0x1d')](function(){return _0xe8ca04;});})[_0x8c18('0x1d')](function(){_0x3df6c1[_0x8c18('0x14')](0xcc)[_0x8c18('0x1e')]();});}};}function handleEntityNotFound(_0x27c1dc,_0x313efe){return function(_0x4c1737){if(!_0x4c1737){_0x27c1dc[_0x8c18('0x13')](0x194);}return _0x4c1737;};}function handleError(_0x560027,_0x2f5eb9){_0x2f5eb9=_0x2f5eb9||0x1f4;return function(_0x183d09){logger[_0x8c18('0x1f')](_0x183d09[_0x8c18('0x20')]);if(_0x183d09[_0x8c18('0x21')]){delete _0x183d09[_0x8c18('0x21')];}_0x560027[_0x8c18('0x14')](_0x2f5eb9)['send'](_0x183d09);};}exports[_0x8c18('0x22')]=function(_0x426223,_0xf8d97d){var _0xe113de={},_0x39132a={},_0x38ecfd={'count':0x0,'rows':[]};var _0x40fb24=_['map'](db[_0x8c18('0x23')][_0x8c18('0x24')],function(_0x429e34){return{'name':_0x429e34[_0x8c18('0x25')],'type':_0x429e34[_0x8c18('0x26')]['key']};});_0x39132a['model']=_[_0x8c18('0x27')](_0x40fb24,_0x8c18('0x21'));_0x39132a[_0x8c18('0x28')]=_[_0x8c18('0x29')](_0x426223[_0x8c18('0x28')]);_0x39132a[_0x8c18('0x2a')]=_[_0x8c18('0x2b')](_0x39132a[_0x8c18('0x2c')],_0x39132a[_0x8c18('0x28')]);_0xe113de['attributes']=_['intersection'](_0x39132a[_0x8c18('0x2c')],qs[_0x8c18('0x2d')](_0x426223[_0x8c18('0x28')]['fields']));_0xe113de[_0x8c18('0x2e')]=_0xe113de[_0x8c18('0x2e')]['length']?_0xe113de[_0x8c18('0x2e')]:_0x39132a[_0x8c18('0x2c')];if(!_0x426223['query'][_0x8c18('0x2f')](_0x8c18('0x30'))){_0xe113de[_0x8c18('0x18')]=qs['limit'](_0x426223['query'][_0x8c18('0x18')]);_0xe113de[_0x8c18('0x17')]=qs[_0x8c18('0x17')](_0x426223[_0x8c18('0x28')]['offset']);}_0xe113de[_0x8c18('0x31')]=qs[_0x8c18('0x32')](_0x426223[_0x8c18('0x28')][_0x8c18('0x32')]);_0xe113de[_0x8c18('0x33')]=qs[_0x8c18('0x2a')](_[_0x8c18('0x34')](_0x426223[_0x8c18('0x28')],_0x39132a[_0x8c18('0x2a')]),_0x40fb24);if(_0x426223[_0x8c18('0x28')][_0x8c18('0x35')]){_0xe113de[_0x8c18('0x33')]=_[_0x8c18('0x36')](_0xe113de['where'],{'$or':_[_0x8c18('0x27')](_0x40fb24,function(_0x22ef00){if(_0x22ef00[_0x8c18('0x26')]!=='VIRTUAL'){var _0x363c81={};_0x363c81[_0x22ef00[_0x8c18('0x21')]]={'$like':'%'+_0x426223[_0x8c18('0x28')]['filter']+'%'};return _0x363c81;}})});}_0xe113de=_['merge']({},_0xe113de,_0x426223[_0x8c18('0x37')]);var _0x3185c5={'where':_0xe113de[_0x8c18('0x33')]};return db[_0x8c18('0x23')][_0x8c18('0x16')](_0x3185c5)[_0x8c18('0x1d')](function(_0x3594d1){_0x38ecfd[_0x8c18('0x16')]=_0x3594d1;if(_0x426223[_0x8c18('0x28')][_0x8c18('0x38')]){_0xe113de[_0x8c18('0x39')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x8c18('0x3a')](_0xe113de);})[_0x8c18('0x1d')](function(_0x4eabd5){_0x38ecfd[_0x8c18('0x3b')]=_0x4eabd5;return _0x38ecfd;})[_0x8c18('0x1d')](respondWithFilteredResult(_0xf8d97d,_0xe113de))[_0x8c18('0x3c')](handleError(_0xf8d97d,null));};exports[_0x8c18('0x3d')]=function(_0x2fa2f7,_0x241e31){var _0xacbd23={'raw':![],'where':{'id':_0x2fa2f7[_0x8c18('0x3e')]['id']}},_0x401020={};_0x401020[_0x8c18('0x2c')]=_['keys'](db['VoiceMusicOnHold']['rawAttributes']);_0x401020['query']=_[_0x8c18('0x29')](_0x2fa2f7[_0x8c18('0x28')]);_0x401020[_0x8c18('0x2a')]=_['intersection'](_0x401020[_0x8c18('0x2c')],_0x401020['query']);_0xacbd23['attributes']=_[_0x8c18('0x2b')](_0x401020[_0x8c18('0x2c')],qs[_0x8c18('0x2d')](_0x2fa2f7[_0x8c18('0x28')]['fields']));_0xacbd23[_0x8c18('0x2e')]=_0xacbd23[_0x8c18('0x2e')]['length']?_0xacbd23[_0x8c18('0x2e')]:_0x401020[_0x8c18('0x2c')];if(_0x2fa2f7[_0x8c18('0x28')]['includeAll']){_0xacbd23[_0x8c18('0x39')]=[{'all':!![]}];}_0xacbd23=_[_0x8c18('0x36')]({},_0xacbd23,_0x2fa2f7[_0x8c18('0x37')]);return db['VoiceMusicOnHold'][_0x8c18('0x3f')](_0xacbd23)['then'](handleEntityNotFound(_0x241e31,null))[_0x8c18('0x1d')](respondWithResult(_0x241e31,null))[_0x8c18('0x3c')](handleError(_0x241e31,null));};exports[_0x8c18('0x1b')]=function(_0x976d0d,_0x4c963d){if(_0x976d0d[_0x8c18('0x40')]['id']){delete _0x976d0d['body']['id'];}return db[_0x8c18('0x23')][_0x8c18('0x3f')]({'where':{'id':_0x976d0d['params']['id']}})[_0x8c18('0x1d')](handleEntityNotFound(_0x4c963d,null))[_0x8c18('0x1d')](saveUpdates(_0x976d0d['body'],null))[_0x8c18('0x1d')](respondWithResult(_0x4c963d,null))['catch'](handleError(_0x4c963d,null));};exports[_0x8c18('0x41')]=function(_0x5bbf03,_0x32b4ce,_0x2a8bf1){return db['sequelize'][_0x8c18('0x42')](function(_0x24977b){if(_0x5bbf03[_0x8c18('0x40')]['mode']===_0x8c18('0x43')){_0x5bbf03['body']['directory']=path[_0x8c18('0x44')](config[_0x8c18('0x45')],_0x8c18('0x46'),_0x5bbf03[_0x8c18('0x40')][_0x8c18('0x21')]);}return db['VoiceMusicOnHold'][_0x8c18('0x41')](_0x5bbf03[_0x8c18('0x40')],{'transaction':_0x24977b})[_0x8c18('0x1d')](function(_0x2d0a1e){if(_0x5bbf03[_0x8c18('0x40')][_0x8c18('0x47')]===_0x8c18('0x43')){fs[_0x8c18('0x48')](_0x2d0a1e[_0x8c18('0x49')],parseInt(_0x8c18('0x4a'),0x8));}var _0x527b99=_0x5bbf03['user']['get']({'plain':!![]});if(!_0x527b99)throw new Error(_0x8c18('0x4b'));if(_0x527b99['role']==='user'){var _0x5457d2=_0x2d0a1e['get']({'plain':!![]});return db[_0x8c18('0x4c')][_0x8c18('0x3f')]({'where':{'name':_0x8c18('0x4d'),'userProfileId':_0x527b99[_0x8c18('0x4e')]},'raw':!![]})['then'](function(_0x48540e){if(_0x48540e&&_0x48540e[_0x8c18('0x4f')]===0x0){return db[_0x8c18('0x50')][_0x8c18('0x41')]({'name':_0x5457d2[_0x8c18('0x21')],'resourceId':_0x5457d2['id'],'type':_0x48540e['name'],'sectionId':_0x48540e['id']},{})[_0x8c18('0x1d')](function(){return _0x2d0a1e;});}else{return _0x2d0a1e;}})['catch'](function(_0x52bdf2){logger[_0x8c18('0x1f')](_0x8c18('0x51'),_0x52bdf2);});}return _0x2d0a1e;});})[_0x8c18('0x1d')](respondWithResult(_0x32b4ce,0xc9))[_0x8c18('0x3c')](handleError(_0x32b4ce,null));};exports[_0x8c18('0x1c')]=function(_0x10a1c6,_0x499628,_0x580a70){var _0x2a123d;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x10a1c6[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](function(_0x8a5c8f){if(_0x8a5c8f){return db['sequelize'][_0x8c18('0x42')](function(_0x182c83){return _0x8a5c8f['destroy']({'transaction':_0x182c83,'raw':!![]})[_0x8c18('0x1d')](function(_0x1c7d31){if(_0x1c7d31[_0x8c18('0x49')]){fs[_0x8c18('0x52')](_0x1c7d31[_0x8c18('0x49')])['forEach'](function(_0x3bee09){fs['unlinkSync'](path[_0x8c18('0x44')](_0x1c7d31[_0x8c18('0x49')],_0x3bee09));});fs['rmdirSync'](_0x1c7d31[_0x8c18('0x49')]);}return _0x1c7d31;});})['catch'](function(_0x3b5da9){throw new db['Sequelize'][(_0x8c18('0x53'))](_0x3b5da9[_0x8c18('0x54')]);});}})['then'](handleEntityNotFound(_0x499628,null))[_0x8c18('0x1d')](removeEntity(_0x499628,null))[_0x8c18('0x3c')](handleError(_0x499628,null));};exports[_0x8c18('0x55')]=function(_0x82111b,_0x23b07e,_0x24f907){return db[_0x8c18('0x56')][_0x8c18('0x42')](function(_0x484e4a){var _0x28cc1e;return db[_0x8c18('0x23')][_0x8c18('0x3f')]({'where':{'id':_0x82111b[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](function(_0x470ae0){if(_0x470ae0){_0x28cc1e=_0x470ae0;return _0x470ae0[_0x8c18('0x55')](_0x82111b[_0x8c18('0x40')]['id'],{'transaction':_0x484e4a});}})[_0x8c18('0x1d')](function(_0x6ec1f1){if(_0x6ec1f1){return db[_0x8c18('0x57')][_0x8c18('0x58')]({'where':{'id':_0x82111b['body']['id']},'attributes':['id','name',_0x8c18('0x59'),_0x8c18('0x5a'),_0x8c18('0x5b')],'raw':!![]});}})[_0x8c18('0x1d')](function(_0x126e59){if(_0x126e59){var _0x2952d8=path[_0x8c18('0x44')](config[_0x8c18('0x45')],'server/files/sounds/converted',util[_0x8c18('0x5c')]('%s.%s',path['basename'](_0x126e59[_0x8c18('0x59')],path[_0x8c18('0x5d')](_0x126e59[_0x8c18('0x59')])),_0x126e59[_0x8c18('0x5a')]));var _0x24f61c=path[_0x8c18('0x44')](config[_0x8c18('0x45')],'server/files/moh',_0x28cc1e[_0x8c18('0x21')],util[_0x8c18('0x5c')](_0x8c18('0x5e'),_0x126e59[_0x8c18('0x21')],_0x126e59[_0x8c18('0x5a')]));fs[_0x8c18('0x5f')](_0x2952d8,_0x24f61c);return _0x126e59;}})[_0x8c18('0x3c')](function(_0x215caf){throw new db[(_0x8c18('0x60'))][(_0x8c18('0x53'))](_0x215caf[_0x8c18('0x54')]);});})['then'](handleEntityNotFound(_0x23b07e,null))[_0x8c18('0x1d')](respondWithResult(_0x23b07e,0xc9))[_0x8c18('0x3c')](handleError(_0x23b07e,null));};exports[_0x8c18('0x61')]=function(_0x5edae4,_0x12a25c,_0x49730a){return db[_0x8c18('0x56')][_0x8c18('0x42')](function(_0x28fd6c){var _0x273f30;return db['VoiceMusicOnHold'][_0x8c18('0x58')]({'where':{'id':_0x5edae4[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](handleEntityNotFound(_0x12a25c,null))[_0x8c18('0x1d')](function(_0x421770){if(_0x421770){_0x273f30=_0x421770;return _0x421770[_0x8c18('0x61')](_0x5edae4['params'][_0x8c18('0x62')]);}})[_0x8c18('0x1d')](function(_0x382cf3){if(_0x382cf3){return db[_0x8c18('0x57')][_0x8c18('0x58')]({'where':{'id':_0x5edae4[_0x8c18('0x3e')]['id2']},'attributes':['id',_0x8c18('0x21'),'save_name',_0x8c18('0x5a'),'createdAt'],'raw':!![]});}})[_0x8c18('0x1d')](function(_0x41d141){if(_0x41d141){fs['unlinkSync'](path[_0x8c18('0x44')](_0x273f30['directory'],util['format'](_0x8c18('0x5e'),_0x41d141[_0x8c18('0x21')],_0x41d141['converted_format'])));return _0x41d141;}})[_0x8c18('0x3c')](function(_0x5a72ff){throw new db['Sequelize'][(_0x8c18('0x53'))](_0x5a72ff[_0x8c18('0x54')]);});})[_0x8c18('0x1d')](handleEntityNotFound(_0x12a25c,null))['then'](respondWithStatusCode(_0x12a25c,0xcc))[_0x8c18('0x3c')](handleError(_0x12a25c,null));};exports['getSounds']=function(_0x52281a,_0x5e3ed2,_0x57b28f){var _0x10c432={};var _0x1aa18b={};var _0x2a79d8;var _0xe19393;return db[_0x8c18('0x23')][_0x8c18('0x58')]({'where':{'id':_0x52281a[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](handleEntityNotFound(_0x5e3ed2,null))[_0x8c18('0x1d')](function(_0x1acf58){if(_0x1acf58){_0x2a79d8=_0x1acf58;_0x1aa18b['model']=_[_0x8c18('0x29')](db[_0x8c18('0x57')][_0x8c18('0x24')]);_0x1aa18b['query']=_[_0x8c18('0x29')](_0x52281a[_0x8c18('0x28')]);_0x1aa18b['filters']=_[_0x8c18('0x2b')](_0x1aa18b[_0x8c18('0x2c')],_0x1aa18b[_0x8c18('0x28')]);_0x10c432[_0x8c18('0x2e')]=_['intersection'](_0x1aa18b['model'],qs[_0x8c18('0x2d')](_0x52281a['query'][_0x8c18('0x2d')]));_0x10c432[_0x8c18('0x2e')]=_0x10c432[_0x8c18('0x2e')][_0x8c18('0x63')]?_0x10c432[_0x8c18('0x2e')]:_0x1aa18b[_0x8c18('0x2c')];_0x10c432[_0x8c18('0x31')]=qs[_0x8c18('0x32')](_0x52281a['query']['sort']);_0x10c432[_0x8c18('0x33')]=qs[_0x8c18('0x2a')](_['pick'](_0x52281a[_0x8c18('0x28')],_0x1aa18b['filters']));if(_0x52281a['query']['filter']){_0x10c432['where']=_[_0x8c18('0x36')](_0x10c432[_0x8c18('0x33')],{'$or':_[_0x8c18('0x27')](_0x10c432[_0x8c18('0x2e')],function(_0x44561d){var _0x274ffa={};_0x274ffa[_0x44561d]={'$like':'%'+_0x52281a[_0x8c18('0x28')][_0x8c18('0x35')]+'%'};return _0x274ffa;})});}_0x10c432=_[_0x8c18('0x36')]({},_0x10c432,_0x52281a['options']);return _0x2a79d8['getSounds'](_0x10c432);}})[_0x8c18('0x1d')](function(_0x2a0912){if(_0x2a0912){_0xe19393=_0x2a0912['length'];if(!_0x52281a[_0x8c18('0x28')][_0x8c18('0x2f')](_0x8c18('0x30'))){_0x10c432['limit']=qs['limit'](_0x52281a[_0x8c18('0x28')][_0x8c18('0x18')]);_0x10c432['offset']=qs[_0x8c18('0x17')](_0x52281a[_0x8c18('0x28')][_0x8c18('0x17')]);}return _0x2a79d8['getSounds'](_0x10c432);}})[_0x8c18('0x1d')](function(_0x17eb1f){if(_0x17eb1f){return _0x17eb1f?{'count':_0xe19393,'rows':_0x17eb1f}:null;}})[_0x8c18('0x1d')](respondWithResult(_0x5e3ed2,null))[_0x8c18('0x3c')](handleError(_0x5e3ed2,null));}; \ No newline at end of file +var _0xa989=['crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','VoiceMusicOnHold','findAll','rows','show','params','include','merge','find','catch','body','create','sequelize','mode','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','transaction','addSound','findOne','format','%s.%s','basename','save_name','extname','converted_format','symlinkSync','removeSound','Sound','id2','createdAt','pick','getSounds','html-pdf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash'];(function(_0x168e01,_0x463812){var _0x2c82d1=function(_0x5c6b32){while(--_0x5c6b32){_0x168e01['push'](_0x168e01['shift']());}};_0x2c82d1(++_0x463812);}(_0xa989,0xcf));var _0x9a98=function(_0x45d002,_0x437354){_0x45d002=_0x45d002-0x0;var _0x12e2cc=_0xa989[_0x45d002];return _0x12e2cc;};'use strict';var pdf=require(_0x9a98('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9a98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a98('0x2'));var moment=require(_0x9a98('0x3'));var BPromise=require(_0x9a98('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9a98('0x5'));var sox=require(_0x9a98('0x6'));var csv=require(_0x9a98('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a98('0x8'));var squel=require('squel');var crypto=require(_0x9a98('0x9'));var jsforce=require(_0x9a98('0xa'));var deskjs=require(_0x9a98('0xb'));var toCsv=require(_0x9a98('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9a98('0xc'));var authService=require(_0x9a98('0xd'));var qs=require(_0x9a98('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a98('0xf'));var logger=require(_0x9a98('0x10'))(_0x9a98('0x11'));var utils=require(_0x9a98('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9a98('0x13'));var db=require(_0x9a98('0x14'))['db'];function respondWithStatusCode(_0x47648f,_0x5c9068){_0x5c9068=_0x5c9068||0xcc;return function(_0x49b86e){if(_0x49b86e){return _0x47648f[_0x9a98('0x15')](_0x5c9068);}return _0x47648f[_0x9a98('0x16')](_0x5c9068)[_0x9a98('0x17')]();};}function respondWithResult(_0x5f547c,_0x49f62b){_0x49f62b=_0x49f62b||0xc8;return function(_0x5b922a){if(_0x5b922a){return _0x5f547c['status'](_0x49f62b)[_0x9a98('0x18')](_0x5b922a);}};}function respondWithFilteredResult(_0x304555,_0x504545){return function(_0x16477b){if(_0x16477b){var _0x314a3b=_0x16477b[_0x9a98('0x19')],_0x45d4eb=_0x504545['offset'],_0x4fd763=_0x504545[_0x9a98('0x1a')]+_0x504545[_0x9a98('0x1b')],_0x494ec4;if(_0x4fd763>=_0x314a3b){_0x4fd763=_0x314a3b;_0x494ec4=0xc8;}else{_0x494ec4=0xce;}_0x304555[_0x9a98('0x16')](_0x494ec4);return _0x304555['set']('Content-Range',_0x45d4eb+'-'+_0x4fd763+'/'+_0x314a3b)[_0x9a98('0x18')](_0x16477b);}return null;};}function patchUpdates(_0x21b962){return function(_0x1a8900){try{jsonpatch['apply'](_0x1a8900,_0x21b962,!![]);}catch(_0x289b56){return BPromise[_0x9a98('0x1c')](_0x289b56);}return _0x1a8900['save']();};}function saveUpdates(_0x275c5c,_0x1ebd3c){return function(_0x3f77a1){if(_0x3f77a1){return _0x3f77a1[_0x9a98('0x1d')](_0x275c5c)[_0x9a98('0x1e')](function(_0x10aa3f){return _0x10aa3f;});}return null;};}function removeEntity(_0x4325fb,_0x24d697){return function(_0x5bcbd9){if(_0x5bcbd9){return _0x5bcbd9[_0x9a98('0x1f')]()[_0x9a98('0x1e')](function(){var _0x442ad4=_0x5bcbd9[_0x9a98('0x20')]({'plain':!![]});var _0x21f085=_0x9a98('0x21');return db[_0x9a98('0x22')][_0x9a98('0x1f')]({'where':{'type':_0x21f085,'resourceId':_0x442ad4['id']}})[_0x9a98('0x1e')](function(){return _0x5bcbd9;});})['then'](function(){_0x4325fb[_0x9a98('0x16')](0xcc)[_0x9a98('0x17')]();});}};}function handleEntityNotFound(_0x1fe045,_0x3c6c10){return function(_0xe56caf){if(!_0xe56caf){_0x1fe045[_0x9a98('0x15')](0x194);}return _0xe56caf;};}function handleError(_0x325ed5,_0x55df2a){_0x55df2a=_0x55df2a||0x1f4;return function(_0x11d034){logger['error'](_0x11d034[_0x9a98('0x23')]);if(_0x11d034[_0x9a98('0x24')]){delete _0x11d034['name'];}_0x325ed5[_0x9a98('0x16')](_0x55df2a)[_0x9a98('0x25')](_0x11d034);};}exports[_0x9a98('0x26')]=function(_0x13032c,_0x34d844){var _0x4856ef={},_0x4d41e5={},_0x11a662={'count':0x0,'rows':[]};var _0x2d8318=_[_0x9a98('0x27')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x7a55f7){return{'name':_0x7a55f7[_0x9a98('0x28')],'type':_0x7a55f7[_0x9a98('0x29')][_0x9a98('0x2a')]};});_0x4d41e5[_0x9a98('0x2b')]=_[_0x9a98('0x27')](_0x2d8318,_0x9a98('0x24'));_0x4d41e5[_0x9a98('0x2c')]=_[_0x9a98('0x2d')](_0x13032c[_0x9a98('0x2c')]);_0x4d41e5[_0x9a98('0x2e')]=_['intersection'](_0x4d41e5[_0x9a98('0x2b')],_0x4d41e5[_0x9a98('0x2c')]);_0x4856ef[_0x9a98('0x2f')]=_[_0x9a98('0x30')](_0x4d41e5[_0x9a98('0x2b')],qs[_0x9a98('0x31')](_0x13032c[_0x9a98('0x2c')]['fields']));_0x4856ef['attributes']=_0x4856ef['attributes'][_0x9a98('0x32')]?_0x4856ef[_0x9a98('0x2f')]:_0x4d41e5[_0x9a98('0x2b')];if(!_0x13032c[_0x9a98('0x2c')][_0x9a98('0x33')](_0x9a98('0x34'))){_0x4856ef['limit']=qs[_0x9a98('0x1b')](_0x13032c['query']['limit']);_0x4856ef['offset']=qs[_0x9a98('0x1a')](_0x13032c[_0x9a98('0x2c')][_0x9a98('0x1a')]);}_0x4856ef[_0x9a98('0x35')]=qs[_0x9a98('0x36')](_0x13032c['query'][_0x9a98('0x36')]);_0x4856ef[_0x9a98('0x37')]=qs[_0x9a98('0x2e')](_['pick'](_0x13032c[_0x9a98('0x2c')],_0x4d41e5[_0x9a98('0x2e')]),_0x2d8318);if(_0x13032c[_0x9a98('0x2c')][_0x9a98('0x38')]){_0x4856ef[_0x9a98('0x37')]=_['merge'](_0x4856ef[_0x9a98('0x37')],{'$or':_[_0x9a98('0x27')](_0x2d8318,function(_0x58b540){if(_0x58b540[_0x9a98('0x29')]!==_0x9a98('0x39')){var _0x1d34b2={};_0x1d34b2[_0x58b540['name']]={'$like':'%'+_0x13032c['query'][_0x9a98('0x38')]+'%'};return _0x1d34b2;}})});}_0x4856ef=_['merge']({},_0x4856ef,_0x13032c[_0x9a98('0x3a')]);var _0x9901ac={'where':_0x4856ef['where']};return db['VoiceMusicOnHold'][_0x9a98('0x19')](_0x9901ac)[_0x9a98('0x1e')](function(_0x3dae19){_0x11a662[_0x9a98('0x19')]=_0x3dae19;if(_0x13032c['query']['includeAll']){_0x4856ef['include']=[{'all':!![]}];}return db[_0x9a98('0x3b')][_0x9a98('0x3c')](_0x4856ef);})[_0x9a98('0x1e')](function(_0x134227){_0x11a662[_0x9a98('0x3d')]=_0x134227;return _0x11a662;})['then'](respondWithFilteredResult(_0x34d844,_0x4856ef))['catch'](handleError(_0x34d844,null));};exports[_0x9a98('0x3e')]=function(_0x37b723,_0x1903f3){var _0x28e8f1={'raw':![],'where':{'id':_0x37b723[_0x9a98('0x3f')]['id']}},_0x5ede7b={};_0x5ede7b[_0x9a98('0x2b')]=_[_0x9a98('0x2d')](db[_0x9a98('0x3b')]['rawAttributes']);_0x5ede7b[_0x9a98('0x2c')]=_['keys'](_0x37b723[_0x9a98('0x2c')]);_0x5ede7b[_0x9a98('0x2e')]=_[_0x9a98('0x30')](_0x5ede7b[_0x9a98('0x2b')],_0x5ede7b[_0x9a98('0x2c')]);_0x28e8f1['attributes']=_[_0x9a98('0x30')](_0x5ede7b[_0x9a98('0x2b')],qs[_0x9a98('0x31')](_0x37b723[_0x9a98('0x2c')]['fields']));_0x28e8f1[_0x9a98('0x2f')]=_0x28e8f1[_0x9a98('0x2f')][_0x9a98('0x32')]?_0x28e8f1[_0x9a98('0x2f')]:_0x5ede7b[_0x9a98('0x2b')];if(_0x37b723['query']['includeAll']){_0x28e8f1[_0x9a98('0x40')]=[{'all':!![]}];}_0x28e8f1=_[_0x9a98('0x41')]({},_0x28e8f1,_0x37b723[_0x9a98('0x3a')]);return db[_0x9a98('0x3b')][_0x9a98('0x42')](_0x28e8f1)[_0x9a98('0x1e')](handleEntityNotFound(_0x1903f3,null))[_0x9a98('0x1e')](respondWithResult(_0x1903f3,null))[_0x9a98('0x43')](handleError(_0x1903f3,null));};exports[_0x9a98('0x1d')]=function(_0x37974e,_0x3661c9){if(_0x37974e['body']['id']){delete _0x37974e[_0x9a98('0x44')]['id'];}return db[_0x9a98('0x3b')][_0x9a98('0x42')]({'where':{'id':_0x37974e[_0x9a98('0x3f')]['id']}})[_0x9a98('0x1e')](handleEntityNotFound(_0x3661c9,null))['then'](saveUpdates(_0x37974e['body'],null))[_0x9a98('0x1e')](respondWithResult(_0x3661c9,null))[_0x9a98('0x43')](handleError(_0x3661c9,null));};exports[_0x9a98('0x45')]=function(_0x5219a6,_0x500a7a,_0x9ff0bd){return db[_0x9a98('0x46')]['transaction'](function(_0x463d5b){if(_0x5219a6[_0x9a98('0x44')][_0x9a98('0x47')]==='files'){_0x5219a6['body'][_0x9a98('0x48')]=path[_0x9a98('0x49')](config[_0x9a98('0x4a')],_0x9a98('0x4b'),_0x5219a6[_0x9a98('0x44')][_0x9a98('0x24')]);}return db[_0x9a98('0x3b')][_0x9a98('0x45')](_0x5219a6[_0x9a98('0x44')],{'transaction':_0x463d5b})['then'](function(_0x175d39){if(_0x5219a6[_0x9a98('0x44')]['mode']==='files'){fs[_0x9a98('0x4c')](_0x175d39[_0x9a98('0x48')],parseInt(_0x9a98('0x4d'),0x8));}var _0x2a89f7=_0x5219a6[_0x9a98('0x4e')][_0x9a98('0x20')]({'plain':!![]});if(!_0x2a89f7)throw new Error(_0x9a98('0x4f'));if(_0x2a89f7[_0x9a98('0x50')]===_0x9a98('0x4e')){var _0x35cfa6=_0x175d39[_0x9a98('0x20')]({'plain':!![]});return db[_0x9a98('0x51')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x2a89f7['userProfileId']},'raw':!![]})[_0x9a98('0x1e')](function(_0x99c7dc){if(_0x99c7dc&&_0x99c7dc[_0x9a98('0x52')]===0x0){return db[_0x9a98('0x22')][_0x9a98('0x45')]({'name':_0x35cfa6['name'],'resourceId':_0x35cfa6['id'],'type':_0x99c7dc['name'],'sectionId':_0x99c7dc['id']},{})['then'](function(){return _0x175d39;});}else{return _0x175d39;}})[_0x9a98('0x43')](function(_0x19d92e){logger[_0x9a98('0x53')](_0x9a98('0x54'),_0x19d92e);});}return _0x175d39;});})[_0x9a98('0x1e')](respondWithResult(_0x500a7a,0xc9))[_0x9a98('0x43')](handleError(_0x500a7a,null));};exports[_0x9a98('0x1f')]=function(_0x3956e8,_0x106e66,_0x3d30f0){var _0x3fd779;return db[_0x9a98('0x3b')][_0x9a98('0x42')]({'where':{'id':_0x3956e8[_0x9a98('0x3f')]['id']}})[_0x9a98('0x1e')](function(_0x5f25f9){if(_0x5f25f9){return db[_0x9a98('0x46')]['transaction'](function(_0x560aba){return _0x5f25f9[_0x9a98('0x1f')]({'transaction':_0x560aba,'raw':!![]})[_0x9a98('0x1e')](function(_0x2df68f){if(_0x2df68f[_0x9a98('0x48')]){fs[_0x9a98('0x55')](_0x2df68f['directory'])[_0x9a98('0x56')](function(_0x462902){fs[_0x9a98('0x57')](path[_0x9a98('0x49')](_0x2df68f[_0x9a98('0x48')],_0x462902));});fs[_0x9a98('0x58')](_0x2df68f['directory']);}return _0x2df68f;});})[_0x9a98('0x43')](function(_0x906b56){throw new db[(_0x9a98('0x59'))][(_0x9a98('0x5a'))](_0x906b56[_0x9a98('0x5b')]);});}})[_0x9a98('0x1e')](handleEntityNotFound(_0x106e66,null))['then'](removeEntity(_0x106e66,null))[_0x9a98('0x43')](handleError(_0x106e66,null));};exports['addSound']=function(_0x3817e7,_0x41601e,_0x2dab33){return db[_0x9a98('0x46')][_0x9a98('0x5c')](function(_0x4a7ca8){var _0x15a07a;return db[_0x9a98('0x3b')]['find']({'where':{'id':_0x3817e7['params']['id']}})['then'](function(_0x451f72){if(_0x451f72){_0x15a07a=_0x451f72;return _0x451f72[_0x9a98('0x5d')](_0x3817e7[_0x9a98('0x44')]['id'],{'transaction':_0x4a7ca8});}})[_0x9a98('0x1e')](function(_0x19c24d){if(_0x19c24d){return db['Sound'][_0x9a98('0x5e')]({'where':{'id':_0x3817e7['body']['id']},'attributes':['id','name','save_name','converted_format','createdAt'],'raw':!![]});}})[_0x9a98('0x1e')](function(_0x309443){if(_0x309443){var _0x120023=path[_0x9a98('0x49')](config[_0x9a98('0x4a')],'server/files/sounds/converted',util[_0x9a98('0x5f')](_0x9a98('0x60'),path[_0x9a98('0x61')](_0x309443[_0x9a98('0x62')],path[_0x9a98('0x63')](_0x309443[_0x9a98('0x62')])),_0x309443[_0x9a98('0x64')]));var _0x25a670=path[_0x9a98('0x49')](config[_0x9a98('0x4a')],_0x9a98('0x4b'),_0x15a07a[_0x9a98('0x24')],util['format'](_0x9a98('0x60'),_0x309443['name'],_0x309443['converted_format']));fs[_0x9a98('0x65')](_0x120023,_0x25a670);return _0x309443;}})[_0x9a98('0x43')](function(_0x2c0b6b){throw new db[(_0x9a98('0x59'))]['ValidationError'](_0x2c0b6b[_0x9a98('0x5b')]);});})['then'](handleEntityNotFound(_0x41601e,null))['then'](respondWithResult(_0x41601e,0xc9))[_0x9a98('0x43')](handleError(_0x41601e,null));};exports[_0x9a98('0x66')]=function(_0x148748,_0x3af4cb,_0x5171ca){return db[_0x9a98('0x46')][_0x9a98('0x5c')](function(_0x2337bd){var _0x51b2e2;return db['VoiceMusicOnHold'][_0x9a98('0x5e')]({'where':{'id':_0x148748[_0x9a98('0x3f')]['id']}})[_0x9a98('0x1e')](handleEntityNotFound(_0x3af4cb,null))[_0x9a98('0x1e')](function(_0xa0d5ae){if(_0xa0d5ae){_0x51b2e2=_0xa0d5ae;return _0xa0d5ae[_0x9a98('0x66')](_0x148748[_0x9a98('0x3f')]['id2']);}})[_0x9a98('0x1e')](function(_0x38e8e8){if(_0x38e8e8){return db[_0x9a98('0x67')]['findOne']({'where':{'id':_0x148748['params'][_0x9a98('0x68')]},'attributes':['id',_0x9a98('0x24'),_0x9a98('0x62'),_0x9a98('0x64'),_0x9a98('0x69')],'raw':!![]});}})[_0x9a98('0x1e')](function(_0x213316){if(_0x213316){fs[_0x9a98('0x57')](path[_0x9a98('0x49')](_0x51b2e2[_0x9a98('0x48')],util['format'](_0x9a98('0x60'),_0x213316[_0x9a98('0x24')],_0x213316[_0x9a98('0x64')])));return _0x213316;}})['catch'](function(_0x33aff1){throw new db[(_0x9a98('0x59'))]['ValidationError'](_0x33aff1[_0x9a98('0x5b')]);});})['then'](handleEntityNotFound(_0x3af4cb,null))[_0x9a98('0x1e')](respondWithStatusCode(_0x3af4cb,0xcc))[_0x9a98('0x43')](handleError(_0x3af4cb,null));};exports['getSounds']=function(_0x555b41,_0x309044,_0x58c5a5){var _0xd4d959={};var _0x1ab2ad={};var _0x5395be;var _0x4a9719;return db['VoiceMusicOnHold'][_0x9a98('0x5e')]({'where':{'id':_0x555b41[_0x9a98('0x3f')]['id']}})[_0x9a98('0x1e')](handleEntityNotFound(_0x309044,null))[_0x9a98('0x1e')](function(_0x2f8f5){if(_0x2f8f5){_0x5395be=_0x2f8f5;_0x1ab2ad[_0x9a98('0x2b')]=_['keys'](db[_0x9a98('0x67')]['rawAttributes']);_0x1ab2ad[_0x9a98('0x2c')]=_[_0x9a98('0x2d')](_0x555b41['query']);_0x1ab2ad[_0x9a98('0x2e')]=_['intersection'](_0x1ab2ad[_0x9a98('0x2b')],_0x1ab2ad[_0x9a98('0x2c')]);_0xd4d959[_0x9a98('0x2f')]=_[_0x9a98('0x30')](_0x1ab2ad[_0x9a98('0x2b')],qs[_0x9a98('0x31')](_0x555b41[_0x9a98('0x2c')]['fields']));_0xd4d959[_0x9a98('0x2f')]=_0xd4d959[_0x9a98('0x2f')][_0x9a98('0x32')]?_0xd4d959[_0x9a98('0x2f')]:_0x1ab2ad['model'];_0xd4d959[_0x9a98('0x35')]=qs[_0x9a98('0x36')](_0x555b41[_0x9a98('0x2c')][_0x9a98('0x36')]);_0xd4d959[_0x9a98('0x37')]=qs[_0x9a98('0x2e')](_[_0x9a98('0x6a')](_0x555b41[_0x9a98('0x2c')],_0x1ab2ad[_0x9a98('0x2e')]));if(_0x555b41['query'][_0x9a98('0x38')]){_0xd4d959['where']=_['merge'](_0xd4d959[_0x9a98('0x37')],{'$or':_[_0x9a98('0x27')](_0xd4d959[_0x9a98('0x2f')],function(_0x491a76){var _0x6707d9={};_0x6707d9[_0x491a76]={'$like':'%'+_0x555b41['query']['filter']+'%'};return _0x6707d9;})});}_0xd4d959=_[_0x9a98('0x41')]({},_0xd4d959,_0x555b41[_0x9a98('0x3a')]);return _0x5395be[_0x9a98('0x6b')](_0xd4d959);}})[_0x9a98('0x1e')](function(_0x24b22a){if(_0x24b22a){_0x4a9719=_0x24b22a['length'];if(!_0x555b41[_0x9a98('0x2c')][_0x9a98('0x33')](_0x9a98('0x34'))){_0xd4d959[_0x9a98('0x1b')]=qs[_0x9a98('0x1b')](_0x555b41[_0x9a98('0x2c')][_0x9a98('0x1b')]);_0xd4d959[_0x9a98('0x1a')]=qs['offset'](_0x555b41[_0x9a98('0x2c')][_0x9a98('0x1a')]);}return _0x5395be[_0x9a98('0x6b')](_0xd4d959);}})[_0x9a98('0x1e')](function(_0x23c806){if(_0x23c806){return _0x23c806?{'count':_0x4a9719,'rows':_0x23c806}:null;}})[_0x9a98('0x1e')](respondWithResult(_0x309044,null))['catch'](handleError(_0x309044,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c6c8ee8..d19e7d7 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 _0xbdd0=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1c0930,_0x5495ad){var _0x7ce376=function(_0x2a26f0){while(--_0x2a26f0){_0x1c0930['push'](_0x1c0930['shift']());}};_0x7ce376(++_0x5495ad);}(_0xbdd0,0x1cc));var _0x0bdd=function(_0x2c0b5c,_0x2de2b0){_0x2c0b5c=_0x2c0b5c-0x0;var _0x331c54=_0xbdd0[_0x2c0b5c];return _0x331c54;};'use strict';var _=require(_0x0bdd('0x0'));var util=require(_0x0bdd('0x1'));var logger=require(_0x0bdd('0x2'))(_0x0bdd('0x3'));var moment=require(_0x0bdd('0x4'));var BPromise=require(_0x0bdd('0x5'));var rp=require(_0x0bdd('0x6'));var fs=require('fs');var path=require(_0x0bdd('0x7'));var rimraf=require(_0x0bdd('0x8'));var config=require(_0x0bdd('0x9'));var attributes=require(_0x0bdd('0xa'));module['exports']=function(_0x1fc8b3,_0x34beb7){return _0x1fc8b3['define'](_0x0bdd('0xb'),attributes,{'tableName':_0x0bdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dc7=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5bc56e,_0x56ea64){var _0x381c08=function(_0x146bef){while(--_0x146bef){_0x5bc56e['push'](_0x5bc56e['shift']());}};_0x381c08(++_0x56ea64);}(_0x9dc7,0x1db));var _0x79dc=function(_0x16a4a9,_0x4a9dd9){_0x16a4a9=_0x16a4a9-0x0;var _0x28d629=_0x9dc7[_0x16a4a9];return _0x28d629;};'use strict';var _=require(_0x79dc('0x0'));var util=require(_0x79dc('0x1'));var logger=require(_0x79dc('0x2'))('api');var moment=require(_0x79dc('0x3'));var BPromise=require(_0x79dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79dc('0x5'));var config=require(_0x79dc('0x6'));var attributes=require(_0x79dc('0x7'));module[_0x79dc('0x8')]=function(_0x28e61e,_0x421c31){return _0x28e61e[_0x79dc('0x9')](_0x79dc('0xa'),attributes,{'tableName':_0x79dc('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 1aef401..508d641 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 _0x2711=['rpc','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x727f82,_0x29531d){var _0x324e51=function(_0x2f90a5){while(--_0x2f90a5){_0x727f82['push'](_0x727f82['shift']());}};_0x324e51(++_0x29531d);}(_0x2711,0xa2));var _0x1271=function(_0x2c3758,_0x2a1cd7){_0x2c3758=_0x2c3758-0x0;var _0x4bf3b7=_0x2711[_0x2c3758];return _0x4bf3b7;};'use strict';var _=require(_0x1271('0x0'));var util=require('util');var moment=require(_0x1271('0x1'));var BPromise=require('bluebird');var rs=require(_0x1271('0x2'));var fs=require('fs');var Redis=require(_0x1271('0x3'));var db=require(_0x1271('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1271('0x5'))(_0x1271('0x6'));var config=require('../../config/environment');var jayson=require(_0x1271('0x7'));var client=jayson['client'][_0x1271('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d4334,_0x47027f,_0x3c0c6a){return new BPromise(function(_0x69b472,_0x4c55c5){return client[_0x1271('0x9')](_0x1d4334,_0x3c0c6a)[_0x1271('0xa')](function(_0x4ba2dc){logger[_0x1271('0xb')](_0x1271('0xc'),_0x47027f,'request\x20sent');logger[_0x1271('0xd')](_0x1271('0xe'),_0x47027f,'request\x20sent',JSON[_0x1271('0xf')](_0x4ba2dc));if(_0x4ba2dc[_0x1271('0x10')]){if(_0x4ba2dc['error'][_0x1271('0x11')]===0x1f4){logger[_0x1271('0x10')](_0x1271('0xc'),_0x47027f,_0x4ba2dc['error'][_0x1271('0x12')]);return _0x4c55c5(_0x4ba2dc['error'][_0x1271('0x12')]);}logger[_0x1271('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x47027f,_0x4ba2dc[_0x1271('0x10')][_0x1271('0x12')]);return _0x69b472(_0x4ba2dc['error'][_0x1271('0x12')]);}else{logger['info'](_0x1271('0xc'),_0x47027f,_0x1271('0x13'));_0x69b472(_0x4ba2dc['result'][_0x1271('0x12')]);}})[_0x1271('0x14')](function(_0x2584ec){logger[_0x1271('0x10')](_0x1271('0xc'),_0x47027f,_0x2584ec);_0x4c55c5(_0x2584ec);});});} \ No newline at end of file +var _0xb26d=['client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb26d,0xe5));var _0xdb26=function(_0x2e13e8,_0x136499){_0x2e13e8=_0x2e13e8-0x0;var _0x2f1959=_0xb26d[_0x2e13e8];return _0x2f1959;};'use strict';var _=require(_0xdb26('0x0'));var util=require(_0xdb26('0x1'));var moment=require(_0xdb26('0x2'));var BPromise=require(_0xdb26('0x3'));var rs=require(_0xdb26('0x4'));var fs=require('fs');var Redis=require(_0xdb26('0x5'));var db=require(_0xdb26('0x6'))['db'];var utils=require(_0xdb26('0x7'));var logger=require('../../config/logger')(_0xdb26('0x8'));var config=require(_0xdb26('0x9'));var jayson=require(_0xdb26('0xa'));var client=jayson[_0xdb26('0xb')][_0xdb26('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3899a7,_0x4b5e1b,_0x5b82c3){return new BPromise(function(_0x5d33bf,_0xdc710b){return client[_0xdb26('0xd')](_0x3899a7,_0x5b82c3)[_0xdb26('0xe')](function(_0x501c86){logger[_0xdb26('0xf')](_0xdb26('0x10'),_0x4b5e1b,_0xdb26('0x11'));logger[_0xdb26('0x12')](_0xdb26('0x13'),_0x4b5e1b,_0xdb26('0x11'),JSON['stringify'](_0x501c86));if(_0x501c86[_0xdb26('0x14')]){if(_0x501c86[_0xdb26('0x14')][_0xdb26('0x15')]===0x1f4){logger[_0xdb26('0x14')](_0xdb26('0x10'),_0x4b5e1b,_0x501c86['error'][_0xdb26('0x16')]);return _0xdc710b(_0x501c86[_0xdb26('0x14')][_0xdb26('0x16')]);}logger['error'](_0xdb26('0x10'),_0x4b5e1b,_0x501c86[_0xdb26('0x14')][_0xdb26('0x16')]);return _0x5d33bf(_0x501c86[_0xdb26('0x14')][_0xdb26('0x16')]);}else{logger[_0xdb26('0xf')](_0xdb26('0x10'),_0x4b5e1b,_0xdb26('0x11'));_0x5d33bf(_0x501c86[_0xdb26('0x17')][_0xdb26('0x16')]);}})['catch'](function(_0x2f6092){logger[_0xdb26('0x14')](_0xdb26('0x10'),_0x4b5e1b,_0x2f6092);_0xdc710b(_0x2f6092);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index fd6ab82..138a489 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 _0x4e35=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','/:id','show','/:id/users','getAgents','post','create','addAgents','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x101646,_0x9bd8d8){var _0x2df860=function(_0x2bfdb9){while(--_0x2bfdb9){_0x101646['push'](_0x101646['shift']());}};_0x2df860(++_0x9bd8d8);}(_0x4e35,0x1f3));var _0x54e3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x4e35[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x54e3('0x0'));var util=require('util');var path=require(_0x54e3('0x1'));var timeout=require(_0x54e3('0x2'));var express=require(_0x54e3('0x3'));var router=express[_0x54e3('0x4')]();var auth=require(_0x54e3('0x5'));var interaction=require(_0x54e3('0x6'));var config=require(_0x54e3('0x7'));var controller=require(_0x54e3('0x8'));router[_0x54e3('0x9')]('/',auth[_0x54e3('0xa')](),controller['index']);router[_0x54e3('0x9')](_0x54e3('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x54e3('0xc'),auth[_0x54e3('0xa')](),controller[_0x54e3('0xd')]);router[_0x54e3('0x9')](_0x54e3('0xe'),auth[_0x54e3('0xa')](),controller[_0x54e3('0xf')]);router[_0x54e3('0x10')]('/',auth[_0x54e3('0xa')](),controller[_0x54e3('0x11')]);router[_0x54e3('0x10')]('/:id/users',auth[_0x54e3('0xa')](),controller[_0x54e3('0x12')]);router['put'](_0x54e3('0xc'),auth[_0x54e3('0xa')](),controller['update']);router[_0x54e3('0x13')]('/:id',auth[_0x54e3('0xa')](),controller[_0x54e3('0x14')]);router[_0x54e3('0x13')](_0x54e3('0xe'),auth[_0x54e3('0xa')](),controller[_0x54e3('0x15')]);module[_0x54e3('0x16')]=router; \ No newline at end of file +var _0x2623=['isAuthenticated','index','/describe','describe','show','/:id/users','addAgents','/:id','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x1001cb,_0x2eb11c){var _0xb6cdf3=function(_0x19f0a1){while(--_0x19f0a1){_0x1001cb['push'](_0x1001cb['shift']());}};_0xb6cdf3(++_0x2eb11c);}(_0x2623,0xe9));var _0x3262=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x2623[_0x29a29f];return _0x443ea3;};'use strict';var multer=require('multer');var util=require(_0x3262('0x0'));var path=require(_0x3262('0x1'));var timeout=require(_0x3262('0x2'));var express=require('express');var router=express[_0x3262('0x3')]();var auth=require(_0x3262('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3262('0x5'));var controller=require('./voicePrefix.controller');router[_0x3262('0x6')]('/',auth[_0x3262('0x7')](),controller[_0x3262('0x8')]);router[_0x3262('0x6')](_0x3262('0x9'),auth[_0x3262('0x7')](),controller[_0x3262('0xa')]);router[_0x3262('0x6')]('/:id',auth[_0x3262('0x7')](),controller[_0x3262('0xb')]);router[_0x3262('0x6')](_0x3262('0xc'),auth[_0x3262('0x7')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3262('0xc'),auth[_0x3262('0x7')](),controller[_0x3262('0xd')]);router['put'](_0x3262('0xe'),auth['isAuthenticated'](),controller[_0x3262('0xf')]);router[_0x3262('0x10')](_0x3262('0xe'),auth['isAuthenticated'](),controller[_0x3262('0x11')]);router['delete']('/:id/users',auth[_0x3262('0x7')](),controller[_0x3262('0x12')]);module[_0x3262('0x13')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6e07be5..37b2e58 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 _0x4274=['name','VIRTUAL','system-','INTEGER','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4274,0x94));var _0x4427=function(_0x189061,_0x21d774){_0x189061=_0x189061-0x0;var _0x257e15=_0x4274[_0x189061];return _0x257e15;};'use strict';var Sequelize=require('sequelize');module[_0x4427('0x0')]={'name':{'type':Sequelize[_0x4427('0x1')],'allowNull':![],'unique':_0x4427('0x2')},'prefix':{'type':Sequelize[_0x4427('0x3')],'get':function(_0x503079){return _0x4427('0x4')+this['getDataValue'](_0x4427('0x2'))+'-';}},'description':{'type':Sequelize[_0x4427('0x1')]},'callerIdAll':{'type':Sequelize[_0x4427('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x4427('0x5')]}}; \ No newline at end of file +var _0x09d7=['STRING','name','VIRTUAL','getDataValue','sequelize'];(function(_0x28db21,_0x6d6ed8){var _0x57f3e1=function(_0x9648bc){while(--_0x9648bc){_0x28db21['push'](_0x28db21['shift']());}};_0x57f3e1(++_0x6d6ed8);}(_0x09d7,0x18a));var _0x709d=function(_0x3fba9e,_0x104499){_0x3fba9e=_0x3fba9e-0x0;var _0x5b0ef0=_0x09d7[_0x3fba9e];return _0x5b0ef0;};'use strict';var Sequelize=require(_0x709d('0x0'));module['exports']={'name':{'type':Sequelize[_0x709d('0x1')],'allowNull':![],'unique':_0x709d('0x2')},'prefix':{'type':Sequelize[_0x709d('0x3')],'get':function(_0x5b32c8){return'system-'+this[_0x709d('0x4')](_0x709d('0x2'))+'-';}},'description':{'type':Sequelize[_0x709d('0x1')]},'callerIdAll':{'type':Sequelize[_0x709d('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index aed86d0..ef8e70e 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 _0x0c42=['NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','sequelize','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','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','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','type','VIRTUAL','filter','options','VoicePrefix','includeAll','include','rows','catch','show','params','merge','find','describe','create','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0c42,0x191));var _0x20c4=function(_0x3b3dca,_0x311836){_0x3b3dca=_0x3b3dca-0x0;var _0x47bf7f=_0x0c42[_0x3b3dca];return _0x47bf7f;};'use strict';var pdf=require(_0x20c4('0x0'));var emlformat=require(_0x20c4('0x1'));var rimraf=require(_0x20c4('0x2'));var zipdir=require(_0x20c4('0x3'));var jsonpatch=require(_0x20c4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x20c4('0x5'));var Mustache=require(_0x20c4('0x6'));var util=require(_0x20c4('0x7'));var path=require(_0x20c4('0x8'));var sox=require(_0x20c4('0x9'));var csv=require('to-csv');var ejs=require(_0x20c4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x20c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x20c4('0xc'));var deskjs=require(_0x20c4('0xd'));var toCsv=require(_0x20c4('0xe'));var querystring=require('querystring');var Papa=require(_0x20c4('0xf'));var Redis=require(_0x20c4('0x10'));var authService=require(_0x20c4('0x11'));var qs=require(_0x20c4('0x12'));var as=require(_0x20c4('0x13'));var hardwareService=require(_0x20c4('0x14'));var logger=require(_0x20c4('0x15'))(_0x20c4('0x16'));var utils=require(_0x20c4('0x17'));var config=require(_0x20c4('0x18'));var licenseUtil=require(_0x20c4('0x19'));var db=require(_0x20c4('0x1a'))['db'];config[_0x20c4('0x1b')]=_['defaults'](config[_0x20c4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x20c4('0x1c'))(new Redis(config[_0x20c4('0x1b')]));require('./voicePrefix.socket')[_0x20c4('0x1d')](socket);function respondWithStatusCode(_0x4c6dae,_0x13213d){_0x13213d=_0x13213d||0xcc;return function(_0x3b1399){if(_0x3b1399){return _0x4c6dae[_0x20c4('0x1e')](_0x13213d);}return _0x4c6dae['status'](_0x13213d)[_0x20c4('0x1f')]();};}function respondWithResult(_0x25b671,_0x3c989a){_0x3c989a=_0x3c989a||0xc8;return function(_0x3e7c5b){if(_0x3e7c5b){return _0x25b671[_0x20c4('0x20')](_0x3c989a)[_0x20c4('0x21')](_0x3e7c5b);}};}function respondWithFilteredResult(_0x2f79a0,_0x3fd9b7){return function(_0x3f9b92){if(_0x3f9b92){var _0x301ff1=_0x3f9b92[_0x20c4('0x22')],_0xda61dc=_0x3fd9b7['offset'],_0x542cb2=_0x3fd9b7[_0x20c4('0x23')]+_0x3fd9b7[_0x20c4('0x24')],_0x513dc7;if(_0x542cb2>=_0x301ff1){_0x542cb2=_0x301ff1;_0x513dc7=0xc8;}else{_0x513dc7=0xce;}_0x2f79a0[_0x20c4('0x20')](_0x513dc7);return _0x2f79a0[_0x20c4('0x25')](_0x20c4('0x26'),_0xda61dc+'-'+_0x542cb2+'/'+_0x301ff1)[_0x20c4('0x21')](_0x3f9b92);}return null;};}function patchUpdates(_0xac3dda){return function(_0x3fa1a5){try{jsonpatch[_0x20c4('0x27')](_0x3fa1a5,_0xac3dda,!![]);}catch(_0x1a2d2c){return BPromise[_0x20c4('0x28')](_0x1a2d2c);}return _0x3fa1a5[_0x20c4('0x29')]();};}function saveUpdates(_0xbe436d,_0x2d1eda){return function(_0x498d4){if(_0x498d4){return _0x498d4[_0x20c4('0x2a')](_0xbe436d)[_0x20c4('0x2b')](function(_0x287753){return _0x287753;});}return null;};}function removeEntity(_0x20e812,_0x3e4b27){return function(_0x11cc05){if(_0x11cc05){return _0x11cc05[_0x20c4('0x2c')]()[_0x20c4('0x2b')](function(){var _0x7c7d69=_0x11cc05['get']({'plain':!![]});var _0x5efa2b=_0x20c4('0x2d');return db[_0x20c4('0x2e')]['destroy']({'where':{'type':_0x5efa2b,'resourceId':_0x7c7d69['id']}})[_0x20c4('0x2b')](function(){return _0x11cc05;});})[_0x20c4('0x2b')](function(){_0x20e812['status'](0xcc)[_0x20c4('0x1f')]();});}};}function handleEntityNotFound(_0x12e4f5,_0x58af11){return function(_0x5592dd){if(!_0x5592dd){_0x12e4f5['sendStatus'](0x194);}return _0x5592dd;};}function handleError(_0x19907c,_0x5bbb21){_0x5bbb21=_0x5bbb21||0x1f4;return function(_0x341b66){logger[_0x20c4('0x2f')](_0x341b66[_0x20c4('0x30')]);if(_0x341b66[_0x20c4('0x31')]){delete _0x341b66[_0x20c4('0x31')];}_0x19907c[_0x20c4('0x20')](_0x5bbb21)['send'](_0x341b66);};}exports['index']=function(_0x2045ac,_0x1673ff){var _0x2b6f72={},_0x2f4a51={},_0x18b5a1={'count':0x0,'rows':[]};var _0x523412=_[_0x20c4('0x32')](db['VoicePrefix'][_0x20c4('0x33')],function(_0x5649c4){return{'name':_0x5649c4['fieldName'],'type':_0x5649c4['type']['key']};});_0x2f4a51[_0x20c4('0x34')]=_['map'](_0x523412,_0x20c4('0x31'));_0x2f4a51[_0x20c4('0x35')]=_[_0x20c4('0x36')](_0x2045ac['query']);_0x2f4a51[_0x20c4('0x37')]=_[_0x20c4('0x38')](_0x2f4a51[_0x20c4('0x34')],_0x2f4a51[_0x20c4('0x35')]);_0x2b6f72[_0x20c4('0x39')]=_['intersection'](_0x2f4a51['model'],qs['fields'](_0x2045ac['query'][_0x20c4('0x3a')]));_0x2b6f72[_0x20c4('0x39')]=_0x2b6f72[_0x20c4('0x39')][_0x20c4('0x3b')]?_0x2b6f72[_0x20c4('0x39')]:_0x2f4a51['model'];if(!_0x2045ac[_0x20c4('0x35')]['hasOwnProperty']('nolimit')){_0x2b6f72['limit']=qs[_0x20c4('0x24')](_0x2045ac[_0x20c4('0x35')][_0x20c4('0x24')]);_0x2b6f72[_0x20c4('0x23')]=qs[_0x20c4('0x23')](_0x2045ac['query'][_0x20c4('0x23')]);}_0x2b6f72[_0x20c4('0x3c')]=qs[_0x20c4('0x3d')](_0x2045ac[_0x20c4('0x35')][_0x20c4('0x3d')]);_0x2b6f72[_0x20c4('0x3e')]=qs[_0x20c4('0x37')](_[_0x20c4('0x3f')](_0x2045ac[_0x20c4('0x35')],_0x2f4a51[_0x20c4('0x37')]),_0x523412);if(_0x2045ac[_0x20c4('0x35')]['filter']){_0x2b6f72[_0x20c4('0x3e')]=_['merge'](_0x2b6f72[_0x20c4('0x3e')],{'$or':_[_0x20c4('0x32')](_0x523412,function(_0x32fdba){if(_0x32fdba[_0x20c4('0x40')]!==_0x20c4('0x41')){var _0x9d7cd5={};_0x9d7cd5[_0x32fdba[_0x20c4('0x31')]]={'$like':'%'+_0x2045ac[_0x20c4('0x35')][_0x20c4('0x42')]+'%'};return _0x9d7cd5;}})});}_0x2b6f72=_['merge']({},_0x2b6f72,_0x2045ac[_0x20c4('0x43')]);var _0x268683={'where':_0x2b6f72['where']};return db[_0x20c4('0x44')]['count'](_0x268683)[_0x20c4('0x2b')](function(_0x5c45ac){_0x18b5a1[_0x20c4('0x22')]=_0x5c45ac;if(_0x2045ac['query'][_0x20c4('0x45')]){_0x2b6f72[_0x20c4('0x46')]=[{'all':!![]}];}return db[_0x20c4('0x44')]['findAll'](_0x2b6f72);})['then'](function(_0x4c32b1){_0x18b5a1[_0x20c4('0x47')]=_0x4c32b1;return _0x18b5a1;})[_0x20c4('0x2b')](respondWithFilteredResult(_0x1673ff,_0x2b6f72))[_0x20c4('0x48')](handleError(_0x1673ff,null));};exports[_0x20c4('0x49')]=function(_0x252e9f,_0xdb39bc){var _0x332beb={'raw':![],'where':{'id':_0x252e9f[_0x20c4('0x4a')]['id']}},_0x40928b={};_0x40928b[_0x20c4('0x34')]=_[_0x20c4('0x36')](db[_0x20c4('0x44')][_0x20c4('0x33')]);_0x40928b['query']=_[_0x20c4('0x36')](_0x252e9f[_0x20c4('0x35')]);_0x40928b['filters']=_[_0x20c4('0x38')](_0x40928b[_0x20c4('0x34')],_0x40928b[_0x20c4('0x35')]);_0x332beb[_0x20c4('0x39')]=_[_0x20c4('0x38')](_0x40928b[_0x20c4('0x34')],qs['fields'](_0x252e9f[_0x20c4('0x35')][_0x20c4('0x3a')]));_0x332beb[_0x20c4('0x39')]=_0x332beb[_0x20c4('0x39')][_0x20c4('0x3b')]?_0x332beb[_0x20c4('0x39')]:_0x40928b[_0x20c4('0x34')];if(_0x252e9f[_0x20c4('0x35')][_0x20c4('0x45')]){_0x332beb['include']=[{'all':!![]}];}_0x332beb=_[_0x20c4('0x4b')]({},_0x332beb,_0x252e9f[_0x20c4('0x43')]);return db[_0x20c4('0x44')][_0x20c4('0x4c')](_0x332beb)[_0x20c4('0x2b')](handleEntityNotFound(_0xdb39bc,null))['then'](respondWithResult(_0xdb39bc,null))[_0x20c4('0x48')](handleError(_0xdb39bc,null));};exports['destroy']=function(_0x8c4b05,_0x472877){return db[_0x20c4('0x44')]['find']({'where':{'id':_0x8c4b05[_0x20c4('0x4a')]['id']}})[_0x20c4('0x2b')](handleEntityNotFound(_0x472877,null))[_0x20c4('0x2b')](removeEntity(_0x472877,null))[_0x20c4('0x48')](handleError(_0x472877,null));};exports[_0x20c4('0x4d')]=function(_0x1176d1,_0x5a5cea){return db[_0x20c4('0x44')][_0x20c4('0x4d')]()[_0x20c4('0x2b')](respondWithResult(_0x5a5cea,null))['catch'](handleError(_0x5a5cea,null));};exports[_0x20c4('0x4e')]=function(_0x14ee27,_0x34aa44){var _0x32c21f;return db['sequelize']['transaction'](function(_0x335fa8){return db[_0x20c4('0x44')][_0x20c4('0x4e')](_0x14ee27[_0x20c4('0x4f')],{'transaction':_0x335fa8})['then'](function(_0x316780){_0x32c21f=_0x316780[_0x20c4('0x50')]({'plain':!![]});return db[_0x20c4('0x51')][_0x20c4('0x4c')]({'where':{'id':_0x32c21f[_0x20c4('0x52')]},'raw':!![]})[_0x20c4('0x2b')](function(_0x393abf){return createVoicePrefixExtensions(_0x32c21f,_0x393abf,_0x335fa8);});});})['then'](function(){var _0x4ef3cc=_0x14ee27[_0x20c4('0x53')][_0x20c4('0x50')]({'plain':!![]});if(!_0x4ef3cc)throw new Error(_0x20c4('0x54'));if(_0x4ef3cc['role']===_0x20c4('0x53')){var _0x3553fd=_0x32c21f;return db['UserProfileSection'][_0x20c4('0x4c')]({'where':{'name':_0x20c4('0x2d'),'userProfileId':_0x4ef3cc['userProfileId']},'raw':!![]})[_0x20c4('0x2b')](function(_0x3a1174){if(_0x3a1174&&_0x3a1174[_0x20c4('0x55')]===0x0){return db[_0x20c4('0x2e')]['create']({'name':_0x3553fd[_0x20c4('0x31')],'resourceId':_0x3553fd['id'],'type':_0x3a1174[_0x20c4('0x31')],'sectionId':_0x3a1174['id']},{})[_0x20c4('0x2b')](function(){return _0x32c21f;});}else{return _0x32c21f;}})[_0x20c4('0x48')](function(_0x593a86){logger[_0x20c4('0x2f')](_0x20c4('0x56'),_0x593a86);throw _0x593a86;});}return _0x32c21f;})[_0x20c4('0x2b')](respondWithResult(_0x34aa44,null))['catch'](handleError(_0x34aa44,null));};function Extension(_0x3e3069,_0xa733eb,_0x4742f6,_0x5aef23){this[_0x20c4('0x57')]='from-sip';this[_0x20c4('0x58')]=_0x3e3069;this[_0x20c4('0x59')]=_0x4742f6;this[_0x20c4('0x40')]=_0x20c4('0x5a');this[_0x20c4('0x5b')]=_0x20c4('0x5c');this[_0x20c4('0x5d')]=_0xa733eb;this['appdata']=_0x5aef23;}function createVoicePrefixExtensions(_0xc8d8a,_0x51d204,_0x4ea16d){return new BPromise(function(_0x1f544f,_0x5b56ff){var _0xbe326c=new Extension(formatPrefixName(_0xc8d8a[_0x20c4('0x5e')]),0x1,_0x20c4('0x5f'),_0x20c4('0x60'));_0xbe326c[_0x20c4('0x61')]=_0xc8d8a['id'];return db[_0x20c4('0x51')][_0x20c4('0x4e')](_0xbe326c,{'transaction':_0x4ea16d})[_0x20c4('0x2b')](function(_0x7160ef){var _0x566251=_0x7160ef[_0x20c4('0x50')]({'plain':!![]});var _0x476448=_[_0x20c4('0x32')](addVoicePrefixExtensions(_0xc8d8a,_0x51d204),function(_0x6d14f3){_0x6d14f3[_0x20c4('0x52')]=_0x566251['id'];_0x6d14f3[_0x20c4('0x61')]=_0xc8d8a['id'];return _0x6d14f3;});return db['VoiceExtension'][_0x20c4('0x62')](_0x476448,{'transaction':_0x4ea16d})[_0x20c4('0x2b')](function(_0xe3bfbf){if(!_0xe3bfbf){return _0x5b56ff(_0x20c4('0x63'));}else{return _0x1f544f(_0xe3bfbf);}})[_0x20c4('0x48')](function(_0x45539d){return _0x5b56ff(_0x45539d);});});;});};function addVoicePrefixExtensions(_0x480ec5,_0x265210){var _0x41a829=[];var _0x414df9=formatPrefixName(_0x480ec5[_0x20c4('0x5e')]);_0x41a829[_0x20c4('0x64')](new Extension(_0x414df9,0x2,_0x20c4('0x65'),_0x20c4('0x66')+_0x480ec5[_0x20c4('0x31')]));if(_0x480ec5['callerIdAll']){_0x41a829[_0x20c4('0x64')](new Extension(_0x414df9,0x3,'Set',_0x20c4('0x67')+_0x480ec5[_0x20c4('0x68')]));}else{_0x41a829[_0x20c4('0x64')](new Extension(_0x414df9,0x3,_0x20c4('0x5f'),_0x20c4('0x69')));}_0x41a829['push'](new Extension(_0x414df9,0x4,_0x20c4('0x6a'),_0x265210['context']+','+'${EXTEN:'+(0x8+_0x480ec5['name'][_0x20c4('0x3b')])+'}'+','+0x1));return _0x41a829;}function formatPrefixName(_0x28af33){var _0x1d210e='_';for(var _0x488dde=0x0;_0x488dde<_0x28af33[_0x20c4('0x3b')];_0x488dde++){if(_0x28af33[_0x20c4('0x6b')](_0x488dde)=='-'){_0x1d210e+=_0x28af33['charAt'](_0x488dde);}else{_0x1d210e+='['+_0x28af33[_0x20c4('0x6b')](_0x488dde)+']';}}_0x1d210e+='.';return _0x1d210e;}exports[_0x20c4('0x2a')]=function(_0x557da6,_0x49905a,_0x213a23){var _0x1b0b97=_0x557da6[_0x20c4('0x4f')];_0x1b0b97[_0x20c4('0x5e')]=_0x20c4('0x6c')+_0x1b0b97[_0x20c4('0x31')]+'-';return db[_0x20c4('0x6d')][_0x20c4('0x6e')](function(_0x252a77){return db['VoicePrefix'][_0x20c4('0x2a')](_0x1b0b97,{'where':{'id':_0x1b0b97['id']},'transaction':_0x252a77})['then'](function(){return db['VoiceExtension'][_0x20c4('0x2c')]({'where':{'VoicePrefixId':_0x1b0b97['id']},'transaction':_0x252a77})['then'](function(){return db[_0x20c4('0x51')][_0x20c4('0x4c')]({'where':{'id':_0x1b0b97[_0x20c4('0x52')]},'raw':!![]})[_0x20c4('0x2b')](function(_0x3f60e5){return createVoicePrefixExtensions(_0x1b0b97,_0x3f60e5,_0x252a77);});});});})[_0x20c4('0x2b')](function(){return db[_0x20c4('0x44')][_0x20c4('0x6f')](_0x1b0b97['id']);})['then'](respondWithResult(_0x49905a,null))[_0x20c4('0x48')](handleError(_0x49905a,null));};exports['addAgents']=function(_0x474784,_0x6ddc06,_0x21e70e){return db[_0x20c4('0x44')]['find']({'where':{'id':_0x474784[_0x20c4('0x4a')]['id']}})[_0x20c4('0x2b')](handleEntityNotFound(_0x6ddc06,null))[_0x20c4('0x2b')](function(_0x42156e){if(_0x42156e){return _0x42156e[_0x20c4('0x70')](_0x474784[_0x20c4('0x4f')]['ids'],_[_0x20c4('0x71')](_0x474784['body'],[_0x20c4('0x72'),'id'])||{})[_0x20c4('0x73')](function(_0x42dab7){for(var _0x3caafe=0x0;_0x3caafe<_0x474784[_0x20c4('0x4f')]['ids']['length'];_0x3caafe+=0x1){socket[_0x20c4('0x74')](_0x20c4('0x75'),{'UserId':_0x474784[_0x20c4('0x4f')][_0x20c4('0x72')][_0x3caafe],'VoicePrefixId':_0x474784[_0x20c4('0x4a')]['id']});}return _0x42dab7;});}})[_0x20c4('0x2b')](respondWithResult(_0x6ddc06,null))['catch'](handleError(_0x6ddc06,null));};exports[_0x20c4('0x76')]=function(_0x5be032,_0x5a15f6,_0x395105){return db[_0x20c4('0x44')]['find']({'where':{'id':_0x5be032['params']['id']}})['then'](handleEntityNotFound(_0x5a15f6,null))['then'](function(_0x268910){if(_0x268910){return _0x268910[_0x20c4('0x76')](_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')])[_0x20c4('0x2b')](function(){if(_['isArray'](_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')])){for(var _0x29b4e1=0x0;_0x29b4e1<_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')][_0x20c4('0x3b')];_0x29b4e1+=0x1){socket[_0x20c4('0x74')](_0x20c4('0x77'),{'UserId':Number(_0x5be032['query'][_0x20c4('0x72')][_0x29b4e1]),'VoicePrefixId':Number(_0x5be032[_0x20c4('0x4a')]['id'])});}}else{socket[_0x20c4('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')]),'VoicePrefixId':Number(_0x5be032[_0x20c4('0x4a')]['id'])});}});}})[_0x20c4('0x2b')](respondWithStatusCode(_0x5a15f6,null))['catch'](handleError(_0x5a15f6,null));};exports[_0x20c4('0x78')]=function(_0x353ec0,_0x2abcb9,_0x3036bc){var _0x161cf9={};var _0x741bc8={};var _0x4bbd7a;var _0x3707fb;return db[_0x20c4('0x44')][_0x20c4('0x79')]({'where':{'id':_0x353ec0[_0x20c4('0x4a')]['id']}})[_0x20c4('0x2b')](handleEntityNotFound(_0x2abcb9,null))[_0x20c4('0x2b')](function(_0x48bd36){if(_0x48bd36){_0x4bbd7a=_0x48bd36;_0x741bc8[_0x20c4('0x34')]=_[_0x20c4('0x36')](db[_0x20c4('0x7a')][_0x20c4('0x33')]);_0x741bc8[_0x20c4('0x35')]=_[_0x20c4('0x36')](_0x353ec0[_0x20c4('0x35')]);_0x741bc8[_0x20c4('0x37')]=_[_0x20c4('0x38')](_0x741bc8[_0x20c4('0x34')],_0x741bc8[_0x20c4('0x35')]);_0x161cf9['attributes']=_[_0x20c4('0x38')](_0x741bc8[_0x20c4('0x34')],qs[_0x20c4('0x3a')](_0x353ec0[_0x20c4('0x35')][_0x20c4('0x3a')]));_0x161cf9[_0x20c4('0x39')]=_0x161cf9[_0x20c4('0x39')][_0x20c4('0x3b')]?_0x161cf9[_0x20c4('0x39')]:_0x741bc8[_0x20c4('0x34')];_0x161cf9[_0x20c4('0x3c')]=qs[_0x20c4('0x3d')](_0x353ec0[_0x20c4('0x35')][_0x20c4('0x3d')]);_0x161cf9['where']=qs['filters'](_['pick'](_0x353ec0[_0x20c4('0x35')],_0x741bc8[_0x20c4('0x37')]));if(_0x353ec0[_0x20c4('0x35')][_0x20c4('0x42')]){_0x161cf9['where']=_[_0x20c4('0x4b')](_0x161cf9[_0x20c4('0x3e')],{'$or':_[_0x20c4('0x32')](_0x161cf9[_0x20c4('0x39')],function(_0x5ebf1b){var _0x239a4f={};_0x239a4f[_0x5ebf1b]={'$like':'%'+_0x353ec0[_0x20c4('0x35')]['filter']+'%'};return _0x239a4f;})});}_0x161cf9=_[_0x20c4('0x4b')]({},_0x161cf9,_0x353ec0[_0x20c4('0x43')]);return _0x4bbd7a[_0x20c4('0x78')](_0x161cf9);}})[_0x20c4('0x2b')](function(_0xa77b3a){if(_0xa77b3a){_0x3707fb=_0xa77b3a['length'];if(!_0x353ec0['query'][_0x20c4('0x7b')]('nolimit')){_0x161cf9[_0x20c4('0x24')]=qs[_0x20c4('0x24')](_0x353ec0[_0x20c4('0x35')][_0x20c4('0x24')]);_0x161cf9['offset']=qs[_0x20c4('0x23')](_0x353ec0[_0x20c4('0x35')]['offset']);}return _0x4bbd7a[_0x20c4('0x78')](_0x161cf9);}})['then'](function(_0x13a1cc){if(_0x13a1cc){return _0x13a1cc?{'count':_0x3707fb,'rows':_0x13a1cc}:null;}})[_0x20c4('0x2b')](respondWithResult(_0x2abcb9,null))[_0x20c4('0x48')](handleError(_0x2abcb9,null));}; \ No newline at end of file +var _0x1115=['fieldName','type','model','name','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','keys','find','describe','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','${EXTEN:','length','charAt','sequelize','transaction','update','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','User','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','end','error','stack','index','map','VoicePrefix','rawAttributes'];(function(_0x4a9a17,_0x273a09){var _0x30e831=function(_0xabbcbd){while(--_0xabbcbd){_0x4a9a17['push'](_0x4a9a17['shift']());}};_0x30e831(++_0x273a09);}(_0x1115,0x1b6));var _0x5111=function(_0x5001fc,_0xafd65d){_0x5001fc=_0x5001fc-0x0;var _0x510463=_0x1115[_0x5001fc];return _0x510463;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5111('0x0'));var rimraf=require(_0x5111('0x1'));var zipdir=require(_0x5111('0x2'));var jsonpatch=require(_0x5111('0x3'));var rp=require(_0x5111('0x4'));var moment=require(_0x5111('0x5'));var BPromise=require(_0x5111('0x6'));var Mustache=require(_0x5111('0x7'));var util=require(_0x5111('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5111('0x9'));var ejs=require(_0x5111('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5111('0xb'));var crypto=require(_0x5111('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5111('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5111('0xe'));var Papa=require(_0x5111('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5111('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5111('0x11'));var logger=require('../../config/logger')(_0x5111('0x12'));var utils=require(_0x5111('0x13'));var config=require(_0x5111('0x14'));var licenseUtil=require(_0x5111('0x15'));var db=require(_0x5111('0x16'))['db'];config[_0x5111('0x17')]=_[_0x5111('0x18')](config[_0x5111('0x17')],{'host':_0x5111('0x19'),'port':0x18eb});var socket=require(_0x5111('0x1a'))(new Redis(config[_0x5111('0x17')]));require(_0x5111('0x1b'))[_0x5111('0x1c')](socket);function respondWithStatusCode(_0x3e60b5,_0x3721d5){_0x3721d5=_0x3721d5||0xcc;return function(_0x291d54){if(_0x291d54){return _0x3e60b5[_0x5111('0x1d')](_0x3721d5);}return _0x3e60b5[_0x5111('0x1e')](_0x3721d5)['end']();};}function respondWithResult(_0x1ac606,_0x54e2b7){_0x54e2b7=_0x54e2b7||0xc8;return function(_0x5ba7b1){if(_0x5ba7b1){return _0x1ac606[_0x5111('0x1e')](_0x54e2b7)[_0x5111('0x1f')](_0x5ba7b1);}};}function respondWithFilteredResult(_0x638470,_0x51ce4a){return function(_0x367f8d){if(_0x367f8d){var _0xa3f4ba=_0x367f8d[_0x5111('0x20')],_0x52c614=_0x51ce4a[_0x5111('0x21')],_0x204c4f=_0x51ce4a['offset']+_0x51ce4a[_0x5111('0x22')],_0x10110b;if(_0x204c4f>=_0xa3f4ba){_0x204c4f=_0xa3f4ba;_0x10110b=0xc8;}else{_0x10110b=0xce;}_0x638470[_0x5111('0x1e')](_0x10110b);return _0x638470[_0x5111('0x23')](_0x5111('0x24'),_0x52c614+'-'+_0x204c4f+'/'+_0xa3f4ba)[_0x5111('0x1f')](_0x367f8d);}return null;};}function patchUpdates(_0x32bc98){return function(_0x3e8de1){try{jsonpatch[_0x5111('0x25')](_0x3e8de1,_0x32bc98,!![]);}catch(_0x6a1158){return BPromise[_0x5111('0x26')](_0x6a1158);}return _0x3e8de1['save']();};}function saveUpdates(_0x3f462d,_0x162ff9){return function(_0xc5fe04){if(_0xc5fe04){return _0xc5fe04['update'](_0x3f462d)[_0x5111('0x27')](function(_0x20a4f7){return _0x20a4f7;});}return null;};}function removeEntity(_0x2d9446,_0x268070){return function(_0x10a3fe){if(_0x10a3fe){return _0x10a3fe[_0x5111('0x28')]()[_0x5111('0x27')](function(){var _0x316b39=_0x10a3fe[_0x5111('0x29')]({'plain':!![]});var _0x1a5793='VoicePrefixes';return db[_0x5111('0x2a')][_0x5111('0x28')]({'where':{'type':_0x1a5793,'resourceId':_0x316b39['id']}})[_0x5111('0x27')](function(){return _0x10a3fe;});})[_0x5111('0x27')](function(){_0x2d9446[_0x5111('0x1e')](0xcc)[_0x5111('0x2b')]();});}};}function handleEntityNotFound(_0x2e24ed,_0x4be100){return function(_0x1ce17f){if(!_0x1ce17f){_0x2e24ed[_0x5111('0x1d')](0x194);}return _0x1ce17f;};}function handleError(_0x25a75a,_0x5efec6){_0x5efec6=_0x5efec6||0x1f4;return function(_0xdf9031){logger[_0x5111('0x2c')](_0xdf9031[_0x5111('0x2d')]);if(_0xdf9031['name']){delete _0xdf9031['name'];}_0x25a75a[_0x5111('0x1e')](_0x5efec6)['send'](_0xdf9031);};}exports[_0x5111('0x2e')]=function(_0x5b5a6d,_0x35ed41){var _0x5a433c={},_0x4bb7e2={},_0x5315ed={'count':0x0,'rows':[]};var _0x36d86c=_[_0x5111('0x2f')](db[_0x5111('0x30')][_0x5111('0x31')],function(_0x13fafe){return{'name':_0x13fafe[_0x5111('0x32')],'type':_0x13fafe[_0x5111('0x33')]['key']};});_0x4bb7e2[_0x5111('0x34')]=_[_0x5111('0x2f')](_0x36d86c,_0x5111('0x35'));_0x4bb7e2[_0x5111('0x36')]=_['keys'](_0x5b5a6d['query']);_0x4bb7e2[_0x5111('0x37')]=_[_0x5111('0x38')](_0x4bb7e2[_0x5111('0x34')],_0x4bb7e2[_0x5111('0x36')]);_0x5a433c[_0x5111('0x39')]=_[_0x5111('0x38')](_0x4bb7e2[_0x5111('0x34')],qs[_0x5111('0x3a')](_0x5b5a6d['query'][_0x5111('0x3a')]));_0x5a433c[_0x5111('0x39')]=_0x5a433c[_0x5111('0x39')]['length']?_0x5a433c[_0x5111('0x39')]:_0x4bb7e2[_0x5111('0x34')];if(!_0x5b5a6d[_0x5111('0x36')]['hasOwnProperty']('nolimit')){_0x5a433c['limit']=qs[_0x5111('0x22')](_0x5b5a6d[_0x5111('0x36')][_0x5111('0x22')]);_0x5a433c[_0x5111('0x21')]=qs[_0x5111('0x21')](_0x5b5a6d['query'][_0x5111('0x21')]);}_0x5a433c[_0x5111('0x3b')]=qs[_0x5111('0x3c')](_0x5b5a6d[_0x5111('0x36')]['sort']);_0x5a433c[_0x5111('0x3d')]=qs[_0x5111('0x37')](_[_0x5111('0x3e')](_0x5b5a6d[_0x5111('0x36')],_0x4bb7e2[_0x5111('0x37')]),_0x36d86c);if(_0x5b5a6d[_0x5111('0x36')][_0x5111('0x3f')]){_0x5a433c[_0x5111('0x3d')]=_[_0x5111('0x40')](_0x5a433c[_0x5111('0x3d')],{'$or':_[_0x5111('0x2f')](_0x36d86c,function(_0x37bac1){if(_0x37bac1[_0x5111('0x33')]!=='VIRTUAL'){var _0x352de9={};_0x352de9[_0x37bac1[_0x5111('0x35')]]={'$like':'%'+_0x5b5a6d['query'][_0x5111('0x3f')]+'%'};return _0x352de9;}})});}_0x5a433c=_[_0x5111('0x40')]({},_0x5a433c,_0x5b5a6d[_0x5111('0x41')]);var _0x41005f={'where':_0x5a433c[_0x5111('0x3d')]};return db[_0x5111('0x30')][_0x5111('0x20')](_0x41005f)['then'](function(_0x36bd18){_0x5315ed[_0x5111('0x20')]=_0x36bd18;if(_0x5b5a6d[_0x5111('0x36')][_0x5111('0x42')]){_0x5a433c[_0x5111('0x43')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x5a433c);})[_0x5111('0x27')](function(_0x373f14){_0x5315ed['rows']=_0x373f14;return _0x5315ed;})[_0x5111('0x27')](respondWithFilteredResult(_0x35ed41,_0x5a433c))[_0x5111('0x44')](handleError(_0x35ed41,null));};exports[_0x5111('0x45')]=function(_0x45a400,_0x20cdf8){var _0x89b3f2={'raw':![],'where':{'id':_0x45a400[_0x5111('0x46')]['id']}},_0x194546={};_0x194546[_0x5111('0x34')]=_[_0x5111('0x47')](db['VoicePrefix']['rawAttributes']);_0x194546[_0x5111('0x36')]=_[_0x5111('0x47')](_0x45a400[_0x5111('0x36')]);_0x194546[_0x5111('0x37')]=_[_0x5111('0x38')](_0x194546[_0x5111('0x34')],_0x194546['query']);_0x89b3f2[_0x5111('0x39')]=_[_0x5111('0x38')](_0x194546[_0x5111('0x34')],qs[_0x5111('0x3a')](_0x45a400['query'][_0x5111('0x3a')]));_0x89b3f2[_0x5111('0x39')]=_0x89b3f2[_0x5111('0x39')]['length']?_0x89b3f2[_0x5111('0x39')]:_0x194546[_0x5111('0x34')];if(_0x45a400[_0x5111('0x36')][_0x5111('0x42')]){_0x89b3f2['include']=[{'all':!![]}];}_0x89b3f2=_['merge']({},_0x89b3f2,_0x45a400[_0x5111('0x41')]);return db['VoicePrefix']['find'](_0x89b3f2)[_0x5111('0x27')](handleEntityNotFound(_0x20cdf8,null))[_0x5111('0x27')](respondWithResult(_0x20cdf8,null))['catch'](handleError(_0x20cdf8,null));};exports[_0x5111('0x28')]=function(_0x3e1a2e,_0x1676f9){return db[_0x5111('0x30')][_0x5111('0x48')]({'where':{'id':_0x3e1a2e[_0x5111('0x46')]['id']}})[_0x5111('0x27')](handleEntityNotFound(_0x1676f9,null))[_0x5111('0x27')](removeEntity(_0x1676f9,null))[_0x5111('0x44')](handleError(_0x1676f9,null));};exports[_0x5111('0x49')]=function(_0x1660d4,_0x2fcc3f){return db['VoicePrefix'][_0x5111('0x49')]()[_0x5111('0x27')](respondWithResult(_0x2fcc3f,null))[_0x5111('0x44')](handleError(_0x2fcc3f,null));};exports[_0x5111('0x4a')]=function(_0x3ad945,_0x16facd){var _0x358dfa;return db['sequelize']['transaction'](function(_0x13fe1b){return db['VoicePrefix'][_0x5111('0x4a')](_0x3ad945[_0x5111('0x4b')],{'transaction':_0x13fe1b})[_0x5111('0x27')](function(_0x45eb8d){_0x358dfa=_0x45eb8d[_0x5111('0x29')]({'plain':!![]});return db[_0x5111('0x4c')][_0x5111('0x48')]({'where':{'id':_0x358dfa['VoiceExtensionId']},'raw':!![]})[_0x5111('0x27')](function(_0x30ffcd){return createVoicePrefixExtensions(_0x358dfa,_0x30ffcd,_0x13fe1b);});});})['then'](function(){var _0x408397=_0x3ad945[_0x5111('0x4d')]['get']({'plain':!![]});if(!_0x408397)throw new Error(_0x5111('0x4e'));if(_0x408397['role']==='user'){var _0x57ac2b=_0x358dfa;return db[_0x5111('0x4f')][_0x5111('0x48')]({'where':{'name':_0x5111('0x50'),'userProfileId':_0x408397[_0x5111('0x51')]},'raw':!![]})['then'](function(_0x14a940){if(_0x14a940&&_0x14a940[_0x5111('0x52')]===0x0){return db[_0x5111('0x2a')]['create']({'name':_0x57ac2b[_0x5111('0x35')],'resourceId':_0x57ac2b['id'],'type':_0x14a940[_0x5111('0x35')],'sectionId':_0x14a940['id']},{})[_0x5111('0x27')](function(){return _0x358dfa;});}else{return _0x358dfa;}})['catch'](function(_0x11413a){logger['error'](_0x5111('0x53'),_0x11413a);throw _0x11413a;});}return _0x358dfa;})[_0x5111('0x27')](respondWithResult(_0x16facd,null))[_0x5111('0x44')](handleError(_0x16facd,null));};function Extension(_0x1e3be2,_0x5defd4,_0x10f551,_0x1a11bb){this[_0x5111('0x54')]=_0x5111('0x55');this[_0x5111('0x56')]=_0x1e3be2;this[_0x5111('0x57')]=_0x10f551;this[_0x5111('0x33')]='system';this[_0x5111('0x58')]='Voice\x20Prefix\x20Extension';this[_0x5111('0x59')]=_0x5defd4;this[_0x5111('0x5a')]=_0x1a11bb;}function createVoicePrefixExtensions(_0xf8f4b5,_0x1a3bfb,_0x1b13f4){return new BPromise(function(_0x3a7d48,_0x5018c0){var _0x3a630b=new Extension(formatPrefixName(_0xf8f4b5[_0x5111('0x5b')]),0x1,_0x5111('0x5c'),_0x5111('0x5d'));_0x3a630b[_0x5111('0x5e')]=_0xf8f4b5['id'];return db[_0x5111('0x4c')]['create'](_0x3a630b,{'transaction':_0x1b13f4})[_0x5111('0x27')](function(_0x13ce00){var _0x40d206=_0x13ce00[_0x5111('0x29')]({'plain':!![]});var _0x16805c=_['map'](addVoicePrefixExtensions(_0xf8f4b5,_0x1a3bfb),function(_0x2d0e25){_0x2d0e25[_0x5111('0x5f')]=_0x40d206['id'];_0x2d0e25[_0x5111('0x5e')]=_0xf8f4b5['id'];return _0x2d0e25;});return db[_0x5111('0x4c')][_0x5111('0x60')](_0x16805c,{'transaction':_0x1b13f4})[_0x5111('0x27')](function(_0x32235d){if(!_0x32235d){return _0x5018c0('Extensions\x20creation\x20failed');}else{return _0x3a7d48(_0x32235d);}})['catch'](function(_0x4eaed9){return _0x5018c0(_0x4eaed9);});});;});};function addVoicePrefixExtensions(_0x37c44b,_0x36d533){var _0x1674d6=[];var _0x3fb713=formatPrefixName(_0x37c44b[_0x5111('0x5b')]);_0x1674d6['push'](new Extension(_0x3fb713,0x2,_0x5111('0x61'),_0x5111('0x62')+_0x37c44b[_0x5111('0x35')]));if(_0x37c44b[_0x5111('0x63')]){_0x1674d6[_0x5111('0x64')](new Extension(_0x3fb713,0x3,_0x5111('0x61'),_0x5111('0x65')+_0x37c44b[_0x5111('0x63')]));}else{_0x1674d6[_0x5111('0x64')](new Extension(_0x3fb713,0x3,_0x5111('0x5c'),'No\x20callerid\x20available'));}_0x1674d6[_0x5111('0x64')](new Extension(_0x3fb713,0x4,_0x5111('0x66'),_0x36d533['context']+','+_0x5111('0x67')+(0x8+_0x37c44b[_0x5111('0x35')]['length'])+'}'+','+0x1));return _0x1674d6;}function formatPrefixName(_0x4ea9bf){var _0x3aaecb='_';for(var _0x1db9a3=0x0;_0x1db9a3<_0x4ea9bf[_0x5111('0x68')];_0x1db9a3++){if(_0x4ea9bf[_0x5111('0x69')](_0x1db9a3)=='-'){_0x3aaecb+=_0x4ea9bf[_0x5111('0x69')](_0x1db9a3);}else{_0x3aaecb+='['+_0x4ea9bf[_0x5111('0x69')](_0x1db9a3)+']';}}_0x3aaecb+='.';return _0x3aaecb;}exports['update']=function(_0x72cc93,_0x56c89c,_0x5c381e){var _0x3e2585=_0x72cc93['body'];_0x3e2585[_0x5111('0x5b')]='system-'+_0x3e2585[_0x5111('0x35')]+'-';return db[_0x5111('0x6a')][_0x5111('0x6b')](function(_0x2fa175){return db[_0x5111('0x30')][_0x5111('0x6c')](_0x3e2585,{'where':{'id':_0x3e2585['id']},'transaction':_0x2fa175})[_0x5111('0x27')](function(){return db[_0x5111('0x4c')][_0x5111('0x28')]({'where':{'VoicePrefixId':_0x3e2585['id']},'transaction':_0x2fa175})[_0x5111('0x27')](function(){return db[_0x5111('0x4c')][_0x5111('0x48')]({'where':{'id':_0x3e2585[_0x5111('0x5f')]},'raw':!![]})['then'](function(_0x3486ea){return createVoicePrefixExtensions(_0x3e2585,_0x3486ea,_0x2fa175);});});});})['then'](function(){return db[_0x5111('0x30')]['findById'](_0x3e2585['id']);})[_0x5111('0x27')](respondWithResult(_0x56c89c,null))[_0x5111('0x44')](handleError(_0x56c89c,null));};exports[_0x5111('0x6d')]=function(_0x140cad,_0x30d604,_0x5d520f){return db['VoicePrefix'][_0x5111('0x48')]({'where':{'id':_0x140cad['params']['id']}})['then'](handleEntityNotFound(_0x30d604,null))[_0x5111('0x27')](function(_0x432290){if(_0x432290){return _0x432290[_0x5111('0x6d')](_0x140cad[_0x5111('0x4b')][_0x5111('0x6e')],_[_0x5111('0x6f')](_0x140cad['body'],[_0x5111('0x6e'),'id'])||{})[_0x5111('0x70')](function(_0x5add8f){for(var _0x435e72=0x0;_0x435e72<_0x140cad['body'][_0x5111('0x6e')][_0x5111('0x68')];_0x435e72+=0x1){socket[_0x5111('0x71')](_0x5111('0x72'),{'UserId':_0x140cad['body'][_0x5111('0x6e')][_0x435e72],'VoicePrefixId':_0x140cad['params']['id']});}return _0x5add8f;});}})[_0x5111('0x27')](respondWithResult(_0x30d604,null))['catch'](handleError(_0x30d604,null));};exports[_0x5111('0x73')]=function(_0x335919,_0x3a8130,_0x199dbb){return db[_0x5111('0x30')][_0x5111('0x48')]({'where':{'id':_0x335919[_0x5111('0x46')]['id']}})[_0x5111('0x27')](handleEntityNotFound(_0x3a8130,null))['then'](function(_0x97815f){if(_0x97815f){return _0x97815f[_0x5111('0x73')](_0x335919[_0x5111('0x36')][_0x5111('0x6e')])[_0x5111('0x27')](function(){if(_['isArray'](_0x335919[_0x5111('0x36')][_0x5111('0x6e')])){for(var _0x5d2772=0x0;_0x5d2772<_0x335919[_0x5111('0x36')][_0x5111('0x6e')][_0x5111('0x68')];_0x5d2772+=0x1){socket['emit'](_0x5111('0x74'),{'UserId':Number(_0x335919[_0x5111('0x36')]['ids'][_0x5d2772]),'VoicePrefixId':Number(_0x335919[_0x5111('0x46')]['id'])});}}else{socket['emit'](_0x5111('0x74'),{'UserId':Number(_0x335919['query'][_0x5111('0x6e')]),'VoicePrefixId':Number(_0x335919[_0x5111('0x46')]['id'])});}});}})[_0x5111('0x27')](respondWithStatusCode(_0x3a8130,null))[_0x5111('0x44')](handleError(_0x3a8130,null));};exports['getAgents']=function(_0x235426,_0x1062a2,_0x1438f0){var _0x3c9759={};var _0x1c0e60={};var _0xa08b98;var _0x2229c8;return db[_0x5111('0x30')][_0x5111('0x75')]({'where':{'id':_0x235426[_0x5111('0x46')]['id']}})['then'](handleEntityNotFound(_0x1062a2,null))[_0x5111('0x27')](function(_0x6a544c){if(_0x6a544c){_0xa08b98=_0x6a544c;_0x1c0e60['model']=_[_0x5111('0x47')](db[_0x5111('0x76')]['rawAttributes']);_0x1c0e60['query']=_['keys'](_0x235426[_0x5111('0x36')]);_0x1c0e60[_0x5111('0x37')]=_['intersection'](_0x1c0e60[_0x5111('0x34')],_0x1c0e60[_0x5111('0x36')]);_0x3c9759['attributes']=_[_0x5111('0x38')](_0x1c0e60[_0x5111('0x34')],qs[_0x5111('0x3a')](_0x235426[_0x5111('0x36')][_0x5111('0x3a')]));_0x3c9759[_0x5111('0x39')]=_0x3c9759['attributes'][_0x5111('0x68')]?_0x3c9759[_0x5111('0x39')]:_0x1c0e60[_0x5111('0x34')];_0x3c9759[_0x5111('0x3b')]=qs[_0x5111('0x3c')](_0x235426['query'][_0x5111('0x3c')]);_0x3c9759[_0x5111('0x3d')]=qs[_0x5111('0x37')](_[_0x5111('0x3e')](_0x235426[_0x5111('0x36')],_0x1c0e60[_0x5111('0x37')]));if(_0x235426[_0x5111('0x36')]['filter']){_0x3c9759['where']=_[_0x5111('0x40')](_0x3c9759[_0x5111('0x3d')],{'$or':_[_0x5111('0x2f')](_0x3c9759[_0x5111('0x39')],function(_0x19b43f){var _0x1c09a2={};_0x1c09a2[_0x19b43f]={'$like':'%'+_0x235426[_0x5111('0x36')][_0x5111('0x3f')]+'%'};return _0x1c09a2;})});}_0x3c9759=_[_0x5111('0x40')]({},_0x3c9759,_0x235426[_0x5111('0x41')]);return _0xa08b98[_0x5111('0x77')](_0x3c9759);}})['then'](function(_0x1f9d67){if(_0x1f9d67){_0x2229c8=_0x1f9d67[_0x5111('0x68')];if(!_0x235426['query'][_0x5111('0x78')](_0x5111('0x79'))){_0x3c9759[_0x5111('0x22')]=qs[_0x5111('0x22')](_0x235426['query'][_0x5111('0x22')]);_0x3c9759[_0x5111('0x21')]=qs['offset'](_0x235426['query'][_0x5111('0x21')]);}return _0xa08b98[_0x5111('0x77')](_0x3c9759);}})[_0x5111('0x27')](function(_0x22a4c9){if(_0x22a4c9){return _0x22a4c9?{'count':_0x2229c8,'rows':_0x22a4c9}:null;}})['then'](respondWithResult(_0x1062a2,null))[_0x5111('0x44')](handleError(_0x1062a2,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index dbfe277..dd3c483 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 _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0xd1c88a,_0x4eaf97){var _0x12272e=function(_0x1faf63){while(--_0x1faf63){_0xd1c88a['push'](_0xd1c88a['shift']());}};_0x12272e(++_0x4eaf97);}(_0x70e0,0x17b));var _0x070e=function(_0x50273d,_0x174732){_0x50273d=_0x50273d-0x0;var _0x3d3feb=_0x70e0[_0x50273d];return _0x3d3feb;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x30dc1a,_0x43ff3a){var _0xc54364=function(_0x24fd58){while(--_0x24fd58){_0x30dc1a['push'](_0x30dc1a['shift']());}};_0xc54364(++_0x43ff3a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xcb91[_0x46ae5a];return _0x434986;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](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 a7dfe69..880810d 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 _0x5a4f=['VoicePrefix','voice_prefixes','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x1523f2,_0x1e4e92){var _0x5a4770=function(_0x138c85){while(--_0x138c85){_0x1523f2['push'](_0x1523f2['shift']());}};_0x5a4770(++_0x1e4e92);}(_0x5a4f,0xa7));var _0xf5a4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5a4f[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xf5a4('0x0'));var util=require(_0xf5a4('0x1'));var logger=require('../../config/logger')(_0xf5a4('0x2'));var moment=require(_0xf5a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5a4('0x4'));var fs=require('fs');var path=require(_0xf5a4('0x5'));var rimraf=require('rimraf');var config=require(_0xf5a4('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xf5a4('0x7')]=function(_0x1d5db4,_0x116556){return _0x1d5db4[_0xf5a4('0x8')](_0xf5a4('0x9'),attributes,{'tableName':_0xf5a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba1e=['../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','util','api','bluebird','request-promise'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xba1e,0x148));var _0xeba1=function(_0x452b46,_0xd2de13){_0x452b46=_0x452b46-0x0;var _0x6c98dc=_0xba1e[_0x452b46];return _0x6c98dc;};'use strict';var _=require(_0xeba1('0x0'));var util=require(_0xeba1('0x1'));var logger=require('../../config/logger')(_0xeba1('0x2'));var moment=require('moment');var BPromise=require(_0xeba1('0x3'));var rp=require(_0xeba1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeba1('0x5'));var attributes=require(_0xeba1('0x6'));module['exports']=function(_0x567794,_0x24ca31){return _0x567794[_0xeba1('0x7')]('VoicePrefix',attributes,{'tableName':_0xeba1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 59927c8..6000851 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 _0x9d5b=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','info','request\x20sent','debug','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9d5b,0x12d));var _0xb9d5=function(_0x421ac9,_0x4ca2af){_0x421ac9=_0x421ac9-0x0;var _0x1037f0=_0x9d5b[_0x421ac9];return _0x1037f0;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require(_0xb9d5('0x6'))(_0xb9d5('0x7'));var config=require('../../config/environment');var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});config[_0xb9d5('0xb')]=_[_0xb9d5('0xc')](config['redis'],{'host':_0xb9d5('0xd'),'port':0x18eb});var socket=require(_0xb9d5('0xe'))(new Redis(config[_0xb9d5('0xb')]));require(_0xb9d5('0xf'))['register'](socket);function respondWithRpcPromise(_0x4f6d7b,_0x273dcf,_0x528602){return new BPromise(function(_0x5908cf,_0x54593a){return client['request'](_0x4f6d7b,_0x528602)['then'](function(_0x41a955){logger[_0xb9d5('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x273dcf,_0xb9d5('0x11'));logger[_0xb9d5('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x273dcf,_0xb9d5('0x11'),JSON[_0xb9d5('0x13')](_0x41a955));if(_0x41a955[_0xb9d5('0x14')]){if(_0x41a955[_0xb9d5('0x14')][_0xb9d5('0x15')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x273dcf,_0x41a955['error'][_0xb9d5('0x16')]);return _0x54593a(_0x41a955['error'][_0xb9d5('0x16')]);}logger[_0xb9d5('0x14')](_0xb9d5('0x17'),_0x273dcf,_0x41a955[_0xb9d5('0x14')][_0xb9d5('0x16')]);return _0x5908cf(_0x41a955['error'][_0xb9d5('0x16')]);}else{logger['info'](_0xb9d5('0x17'),_0x273dcf,_0xb9d5('0x11'));_0x5908cf(_0x41a955[_0xb9d5('0x18')]['message']);}})[_0xb9d5('0x19')](function(_0x2b6b72){logger[_0xb9d5('0x14')](_0xb9d5('0x17'),_0x273dcf,_0x2b6b72);_0x54593a(_0x2b6b72);});});} \ No newline at end of file +var _0xe49a=['../../config/logger','jayson/promise','client','http','redis','defaults','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1aa516,_0x3b1a8){var _0x224472=function(_0x57c81c){while(--_0x57c81c){_0x1aa516['push'](_0x1aa516['shift']());}};_0x224472(++_0x3b1a8);}(_0xe49a,0x6f));var _0xae49=function(_0x198480,_0x574b93){_0x198480=_0x198480-0x0;var _0x58dff5=_0xe49a[_0x198480];return _0x58dff5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xae49('0x0'));var rs=require(_0xae49('0x1'));var fs=require('fs');var Redis=require(_0xae49('0x2'));var db=require(_0xae49('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xae49('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae49('0x5'));var client=jayson[_0xae49('0x6')][_0xae49('0x7')]({'port':0x232a});config[_0xae49('0x8')]=_[_0xae49('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae49('0x8')]));require(_0xae49('0xa'))[_0xae49('0xb')](socket);function respondWithRpcPromise(_0x114417,_0x5184fb,_0x145cee){return new BPromise(function(_0x1e9b66,_0xdddf05){return client[_0xae49('0xc')](_0x114417,_0x145cee)[_0xae49('0xd')](function(_0x39b932){logger[_0xae49('0xe')](_0xae49('0xf'),_0x5184fb,_0xae49('0x10'));logger[_0xae49('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5184fb,'request\x20sent',JSON[_0xae49('0x12')](_0x39b932));if(_0x39b932[_0xae49('0x13')]){if(_0x39b932[_0xae49('0x13')][_0xae49('0x14')]===0x1f4){logger[_0xae49('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x5184fb,_0x39b932[_0xae49('0x13')][_0xae49('0x15')]);return _0xdddf05(_0x39b932['error'][_0xae49('0x15')]);}logger[_0xae49('0x13')](_0xae49('0xf'),_0x5184fb,_0x39b932['error'][_0xae49('0x15')]);return _0x1e9b66(_0x39b932[_0xae49('0x13')][_0xae49('0x15')]);}else{logger[_0xae49('0xe')](_0xae49('0xf'),_0x5184fb,_0xae49('0x10'));_0x1e9b66(_0x39b932[_0xae49('0x16')][_0xae49('0x15')]);}})['catch'](function(_0x4729dd){logger[_0xae49('0x13')](_0xae49('0xf'),_0x5184fb,_0x4729dd);_0xdddf05(_0x4729dd);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3334d8e..963ffda 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 _0x3a9f=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x513516,_0x522cc6){var _0x4abdc5=function(_0x2ab357){while(--_0x2ab357){_0x513516['push'](_0x513516['shift']());}};_0x4abdc5(++_0x522cc6);}(_0x3a9f,0x1ef));var _0xf3a9=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x3a9f[_0x54eab6];return _0x1e7435;};'use strict';var VoicePrefixEvents=require(_0xf3a9('0x0'));var events=[_0xf3a9('0x1'),_0xf3a9('0x2'),_0xf3a9('0x3')];function createListener(_0x54c07e,_0x20bb8b){return function(_0x55b054){_0x20bb8b[_0xf3a9('0x4')](_0x54c07e,_0x55b054);};}function removeListener(_0x2f4341,_0x2caa06){return function(){VoicePrefixEvents[_0xf3a9('0x5')](_0x2f4341,_0x2caa06);};}exports[_0xf3a9('0x6')]=function(_0x40e06b){for(var _0x2c154f=0x0,_0x129263=events[_0xf3a9('0x7')];_0x2c154f<_0x129263;_0x2c154f++){var _0x3797a3=events[_0x2c154f];var _0xac15a9=createListener(_0xf3a9('0x8')+_0x3797a3,_0x40e06b);VoicePrefixEvents['on'](_0x3797a3,_0xac15a9);}}; \ No newline at end of file +var _0x43dc=['length','save','remove','update','emit','register'];(function(_0x59ab8b,_0x9f364a){var _0x2048ec=function(_0x32eb9b){while(--_0x32eb9b){_0x59ab8b['push'](_0x59ab8b['shift']());}};_0x2048ec(++_0x9f364a);}(_0x43dc,0x13f));var _0xc43d=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x43dc[_0x45b034];return _0x509cb0;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc43d('0x0'),_0xc43d('0x1'),_0xc43d('0x2')];function createListener(_0x3581a7,_0x4b2ba5){return function(_0x48fe38){_0x4b2ba5[_0xc43d('0x3')](_0x3581a7,_0x48fe38);};}function removeListener(_0x201197,_0x4f6262){return function(){VoicePrefixEvents['removeListener'](_0x201197,_0x4f6262);};}exports[_0xc43d('0x4')]=function(_0x30bca9){for(var _0x4b620a=0x0,_0x1011c3=events[_0xc43d('0x5')];_0x4b620a<_0x1011c3;_0x4b620a++){var _0x59786a=events[_0x4b620a];var _0x387bef=createListener('voicePrefix:'+_0x59786a,_0x30bca9);VoicePrefixEvents['on'](_0x59786a,_0x387bef);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 757f742..3c4ef81 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 _0x345b=['/:id/members','getMembers','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x166acc,_0x111e4e){var _0x209f4d=function(_0x354b62){while(--_0x354b62){_0x166acc['push'](_0x166acc['shift']());}};_0x209f4d(++_0x111e4e);}(_0x345b,0x93));var _0xb345=function(_0x2c9928,_0x3015ef){_0x2c9928=_0x2c9928-0x0;var _0x12dd4d=_0x345b[_0x2c9928];return _0x12dd4d;};'use strict';var multer=require(_0xb345('0x0'));var util=require(_0xb345('0x1'));var path=require('path');var timeout=require(_0xb345('0x2'));var express=require(_0xb345('0x3'));var router=express[_0xb345('0x4')]();var auth=require(_0xb345('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb345('0x6'));var controller=require(_0xb345('0x7'));router[_0xb345('0x8')]('/',auth[_0xb345('0x9')](),controller[_0xb345('0xa')]);router['get'](_0xb345('0xb'),auth[_0xb345('0x9')](),controller[_0xb345('0xc')]);router[_0xb345('0x8')](_0xb345('0xd'),auth[_0xb345('0x9')](),controller[_0xb345('0xe')]);router['get'](_0xb345('0xf'),auth[_0xb345('0x9')](),controller[_0xb345('0x10')]);router['get']('/:id/hopper_finals',auth[_0xb345('0x9')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xb345('0x9')](),controller['getHopperBlacks']);router[_0xb345('0x8')](_0xb345('0x11'),auth['isAuthenticated'](),controller[_0xb345('0x12')]);router[_0xb345('0x8')](_0xb345('0x13'),auth[_0xb345('0x9')](),controller[_0xb345('0x14')]);router[_0xb345('0x8')](_0xb345('0x15'),auth[_0xb345('0x9')](),controller[_0xb345('0x16')]);router[_0xb345('0x8')]('/:id/lists',auth[_0xb345('0x9')](),controller['getLists']);router[_0xb345('0x8')](_0xb345('0x17'),auth['isAuthenticated'](),controller[_0xb345('0x18')]);router[_0xb345('0x19')]('/',auth[_0xb345('0x9')](),controller[_0xb345('0x1a')]);router[_0xb345('0x19')](_0xb345('0x1b'),auth['isAuthenticated'](),controller[_0xb345('0x1c')]);router[_0xb345('0x19')](_0xb345('0x11'),auth[_0xb345('0x9')](),controller[_0xb345('0x1d')]);router[_0xb345('0x19')](_0xb345('0x13'),auth[_0xb345('0x9')](),controller[_0xb345('0x1e')]);router['post'](_0xb345('0x1f'),auth[_0xb345('0x9')](),controller[_0xb345('0x20')]);router[_0xb345('0x19')](_0xb345('0x17'),auth[_0xb345('0x9')](),controller[_0xb345('0x21')]);router[_0xb345('0x22')]('/:id',auth[_0xb345('0x9')](),controller[_0xb345('0x23')]);router[_0xb345('0x24')](_0xb345('0xb'),auth[_0xb345('0x9')](),controller[_0xb345('0x25')]);router[_0xb345('0x24')](_0xb345('0x11'),auth['isAuthenticated'](),controller[_0xb345('0x26')]);router[_0xb345('0x24')](_0xb345('0x13'),auth['isAuthenticated'](),controller[_0xb345('0x27')]);router[_0xb345('0x24')](_0xb345('0x1f'),auth[_0xb345('0x9')](),controller[_0xb345('0x28')]);router[_0xb345('0x24')](_0xb345('0x17'),auth[_0xb345('0x9')](),controller['removeBlackLists']);module[_0xb345('0x29')]=router; \ No newline at end of file +var _0x9636=['clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/blacklists','getBlackLists','post','create'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9636,0xdf));var _0x6963=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x9636[_0x266618];return _0x54dbf5;};'use strict';var multer=require(_0x6963('0x0'));var util=require(_0x6963('0x1'));var path=require(_0x6963('0x2'));var timeout=require(_0x6963('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6963('0x4'));var interaction=require(_0x6963('0x5'));var config=require(_0x6963('0x6'));var controller=require(_0x6963('0x7'));router[_0x6963('0x8')]('/',auth[_0x6963('0x9')](),controller[_0x6963('0xa')]);router[_0x6963('0x8')](_0x6963('0xb'),auth[_0x6963('0x9')](),controller[_0x6963('0xc')]);router[_0x6963('0x8')](_0x6963('0xd'),auth[_0x6963('0x9')](),controller['getHoppers']);router[_0x6963('0x8')](_0x6963('0xe'),auth[_0x6963('0x9')](),controller[_0x6963('0xf')]);router['get'](_0x6963('0x10'),auth['isAuthenticated'](),controller[_0x6963('0x11')]);router[_0x6963('0x8')](_0x6963('0x12'),auth[_0x6963('0x9')](),controller[_0x6963('0x13')]);router[_0x6963('0x8')](_0x6963('0x14'),auth[_0x6963('0x9')](),controller[_0x6963('0x15')]);router[_0x6963('0x8')](_0x6963('0x16'),auth[_0x6963('0x9')](),controller[_0x6963('0x17')]);router[_0x6963('0x8')]('/:id/members',auth[_0x6963('0x9')](),controller[_0x6963('0x18')]);router[_0x6963('0x8')]('/:id/lists',auth[_0x6963('0x9')](),controller['getLists']);router[_0x6963('0x8')](_0x6963('0x19'),auth[_0x6963('0x9')](),controller[_0x6963('0x1a')]);router[_0x6963('0x1b')]('/',auth['isAuthenticated'](),controller[_0x6963('0x1c')]);router[_0x6963('0x1b')]('/:id/clone',auth[_0x6963('0x9')](),controller[_0x6963('0x1d')]);router[_0x6963('0x1b')](_0x6963('0x14'),auth[_0x6963('0x9')](),controller[_0x6963('0x1e')]);router[_0x6963('0x1b')](_0x6963('0x16'),auth['isAuthenticated'](),controller[_0x6963('0x1f')]);router['post'](_0x6963('0x20'),auth[_0x6963('0x9')](),controller[_0x6963('0x21')]);router[_0x6963('0x1b')](_0x6963('0x19'),auth[_0x6963('0x9')](),controller[_0x6963('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6963('0x23')]);router[_0x6963('0x24')](_0x6963('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x6963('0x24')](_0x6963('0x14'),auth['isAuthenticated'](),controller[_0x6963('0x25')]);router[_0x6963('0x24')](_0x6963('0x16'),auth['isAuthenticated'](),controller[_0x6963('0x26')]);router['delete'](_0x6963('0x20'),auth[_0x6963('0x9')](),controller[_0x6963('0x27')]);router[_0x6963('0x24')]('/:id/blacklists',auth[_0x6963('0x9')](),controller[_0x6963('0x28')]);module[_0x6963('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 986a170..ede2c47 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(_0x26db15,_0x50daec){var _0x31f013=function(_0x2b71fe){while(--_0x2b71fe){_0x26db15['push'](_0x26db15['shift']());}};_0x31f013(++_0x50daec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x186780,_0x144f34){var _0x307c3c=function(_0x4503a6){while(--_0x4503a6){_0x186780['push'](_0x186780['shift']());}};_0x307c3c(++_0x144f34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 ce2c8ad..7759012 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 _0x28b1=['isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','ids','spread','userVoiceQueue:save','SIP/%s','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','field','NOW()','toString','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','CmListId','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','value','includes','type','find','UserProfileResource','sendStatus','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','options','includeAll','include','findAll','rows','catch','show','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','order','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','addTeams','each','UserVoiceQueueRt','upsert','isNil','format','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','compact','removeTeams'];(function(_0x6373ae,_0x58b42e){var _0x1ba442=function(_0x412261){while(--_0x412261){_0x6373ae['push'](_0x6373ae['shift']());}};_0x1ba442(++_0x58b42e);}(_0x28b1,0x19a));var _0x128b=function(_0x19ce74,_0xe23ac0){_0x19ce74=_0x19ce74-0x0;var _0x1c465d=_0x28b1[_0x19ce74];return _0x1c465d;};'use strict';var pdf=require(_0x128b('0x0'));var emlformat=require(_0x128b('0x1'));var rimraf=require(_0x128b('0x2'));var zipdir=require(_0x128b('0x3'));var jsonpatch=require(_0x128b('0x4'));var rp=require('request-promise');var moment=require(_0x128b('0x5'));var BPromise=require(_0x128b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x128b('0x7'));var sox=require('sox');var csv=require(_0x128b('0x8'));var ejs=require(_0x128b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x128b('0xa'));var crypto=require(_0x128b('0xb'));var jsforce=require(_0x128b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x128b('0x8'));var querystring=require(_0x128b('0xd'));var Papa=require(_0x128b('0xe'));var Redis=require(_0x128b('0xf'));var authService=require(_0x128b('0x10'));var qs=require(_0x128b('0x11'));var as=require(_0x128b('0x12'));var hardwareService=require(_0x128b('0x13'));var logger=require(_0x128b('0x14'))(_0x128b('0x15'));var utils=require('../../config/utils');var config=require(_0x128b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x128b('0x17'))['db'];config[_0x128b('0x18')]=_[_0x128b('0x19')](config[_0x128b('0x18')],{'host':_0x128b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x128b('0x18')]));require(_0x128b('0x1b'))['register'](socket);function respondWithStatusCode(_0xc3e541,_0x2537f8){_0x2537f8=_0x2537f8||0xcc;return function(_0x175b61){if(_0x175b61){return _0xc3e541['sendStatus'](_0x2537f8);}return _0xc3e541[_0x128b('0x1c')](_0x2537f8)[_0x128b('0x1d')]();};}function respondWithResult(_0x449a7b,_0x1b8fd7){_0x1b8fd7=_0x1b8fd7||0xc8;return function(_0x51084f){if(_0x51084f){return _0x449a7b[_0x128b('0x1c')](_0x1b8fd7)[_0x128b('0x1e')](_0x51084f);}};}function respondWithFilteredResult(_0x287baa,_0xbda825){return function(_0x2d0faf){if(_0x2d0faf){var _0x37c4a0=_0x2d0faf[_0x128b('0x1f')],_0x15ed8f=_0xbda825['offset'],_0x69636a=_0xbda825[_0x128b('0x20')]+_0xbda825[_0x128b('0x21')],_0xf95705;if(_0x69636a>=_0x37c4a0){_0x69636a=_0x37c4a0;_0xf95705=0xc8;}else{_0xf95705=0xce;}_0x287baa['status'](_0xf95705);return _0x287baa[_0x128b('0x22')]('Content-Range',_0x15ed8f+'-'+_0x69636a+'/'+_0x37c4a0)[_0x128b('0x1e')](_0x2d0faf);}return null;};}function patchUpdates(_0x9bda55){return function(_0x3e5297){try{jsonpatch['apply'](_0x3e5297,_0x9bda55,!![]);}catch(_0x455e30){return BPromise[_0x128b('0x23')](_0x455e30);}return _0x3e5297[_0x128b('0x24')]();};}function saveUpdates(_0x2b97d0,_0x10ac01){return function(_0x46700c){if(_0x46700c){return _0x46700c[_0x128b('0x25')](_0x2b97d0)[_0x128b('0x26')](function(_0x3ae990){return _0x3ae990;});}return null;};}function removeEntity(_0x5d089d,_0xbcb9e8){return function(_0x2a32e8){if(_0x2a32e8){return _0x2a32e8[_0x128b('0x27')]()[_0x128b('0x26')](function(){var _0x23e274=_0x2a32e8['get']({'plain':!![]});var _0x5c2a4a=[{'name':_0x128b('0x28'),'value':_0x128b('0x29'),'ignore':![]},{'name':_0x128b('0x2a'),'value':_0x128b('0x2b'),'ignore':![]}];var _0x277115=_(_0x5c2a4a)[_0x128b('0x2c')]('ignore')['map'](_0x128b('0x2d'))[_0x128b('0x2d')]();if(_[_0x128b('0x2e')](_0x277115,_0x23e274[_0x128b('0x2f')])){return;}var _0x8e7236=_[_0x128b('0x30')](_0x5c2a4a,['value',_0x23e274[_0x128b('0x2f')]])['name'];return db[_0x128b('0x31')][_0x128b('0x27')]({'where':{'type':_0x8e7236,'resourceId':_0x23e274['id']}})['then'](function(){return _0x2a32e8;});})[_0x128b('0x26')](function(){_0x5d089d[_0x128b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1076c9,_0x45e27f){return function(_0x145cb8){if(!_0x145cb8){_0x1076c9[_0x128b('0x32')](0x194);}return _0x145cb8;};}function handleError(_0x43ef7e,_0x32ec05){_0x32ec05=_0x32ec05||0x1f4;return function(_0xda152d){logger[_0x128b('0x33')](_0xda152d['stack']);if(_0xda152d['name']){delete _0xda152d[_0x128b('0x34')];}_0x43ef7e['status'](_0x32ec05)[_0x128b('0x35')](_0xda152d);};}exports[_0x128b('0x36')]=function(_0x265355,_0x261b60){var _0x19801b={},_0x192d8f={},_0x1b0832={'count':0x0,'rows':[]};var _0x1696aa=_['map'](db[_0x128b('0x37')][_0x128b('0x38')],function(_0x2909a9){return{'name':_0x2909a9[_0x128b('0x39')],'type':_0x2909a9['type'][_0x128b('0x3a')]};});_0x192d8f[_0x128b('0x3b')]=_[_0x128b('0x3c')](_0x1696aa,'name');_0x192d8f[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x265355[_0x128b('0x3d')]);_0x192d8f['filters']=_[_0x128b('0x3f')](_0x192d8f[_0x128b('0x3b')],_0x192d8f[_0x128b('0x3d')]);_0x19801b['attributes']=_['intersection'](_0x192d8f[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x265355[_0x128b('0x3d')]['fields']));_0x19801b[_0x128b('0x41')]=_0x19801b[_0x128b('0x41')][_0x128b('0x42')]?_0x19801b['attributes']:_0x192d8f['model'];if(!_0x265355[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x19801b['limit']=qs[_0x128b('0x21')](_0x265355[_0x128b('0x3d')]['limit']);_0x19801b[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x265355[_0x128b('0x3d')][_0x128b('0x20')]);}_0x19801b['order']=qs[_0x128b('0x45')](_0x265355[_0x128b('0x3d')]['sort']);_0x19801b[_0x128b('0x46')]=qs[_0x128b('0x47')](_['pick'](_0x265355[_0x128b('0x3d')],_0x192d8f[_0x128b('0x47')]),_0x1696aa);if(_0x265355['query'][_0x128b('0x2c')]){_0x19801b[_0x128b('0x46')]=_['merge'](_0x19801b[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x1696aa,function(_0x4d2c77){if(_0x4d2c77['type']!=='VIRTUAL'){var _0x3f0aa2={};_0x3f0aa2[_0x4d2c77[_0x128b('0x34')]]={'$like':'%'+_0x265355[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x3f0aa2;}})});}_0x19801b=_[_0x128b('0x48')]({},_0x19801b,_0x265355[_0x128b('0x49')]);var _0x5700ea={'where':_0x19801b[_0x128b('0x46')]};return db[_0x128b('0x37')]['count'](_0x5700ea)[_0x128b('0x26')](function(_0x54b82e){_0x1b0832[_0x128b('0x1f')]=_0x54b82e;if(_0x265355[_0x128b('0x3d')][_0x128b('0x4a')]){_0x19801b[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x37')][_0x128b('0x4c')](_0x19801b);})['then'](function(_0x1fa058){_0x1b0832[_0x128b('0x4d')]=_0x1fa058;return _0x1b0832;})['then'](respondWithFilteredResult(_0x261b60,_0x19801b))[_0x128b('0x4e')](handleError(_0x261b60,null));};exports[_0x128b('0x4f')]=function(_0x4f2a83,_0x32af81){var _0x4da9c0={'raw':![],'where':{'id':_0x4f2a83['params']['id']}},_0x1bc4b8={};_0x1bc4b8[_0x128b('0x3b')]=_['keys'](db[_0x128b('0x37')]['rawAttributes']);_0x1bc4b8[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x4f2a83[_0x128b('0x3d')]);_0x1bc4b8[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x1bc4b8[_0x128b('0x3b')],_0x1bc4b8[_0x128b('0x3d')]);_0x4da9c0['attributes']=_[_0x128b('0x3f')](_0x1bc4b8[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x4f2a83['query']['fields']));_0x4da9c0[_0x128b('0x41')]=_0x4da9c0[_0x128b('0x41')][_0x128b('0x42')]?_0x4da9c0[_0x128b('0x41')]:_0x1bc4b8[_0x128b('0x3b')];if(_0x4f2a83[_0x128b('0x3d')]['includeAll']){_0x4da9c0[_0x128b('0x4b')]=[{'all':!![]}];}_0x4da9c0=_[_0x128b('0x48')]({},_0x4da9c0,_0x4f2a83[_0x128b('0x49')]);return db[_0x128b('0x37')]['find'](_0x4da9c0)[_0x128b('0x26')](handleEntityNotFound(_0x32af81,null))[_0x128b('0x26')](respondWithResult(_0x32af81,null))[_0x128b('0x4e')](handleError(_0x32af81,null));};exports['create']=function(_0x55a9e4,_0x1c56ca){return db[_0x128b('0x37')][_0x128b('0x50')](_0x55a9e4[_0x128b('0x51')],{})[_0x128b('0x26')](function(_0x7789de){var _0x57fbc9=_0x55a9e4['user'][_0x128b('0x52')]({'plain':!![]});if(!_0x57fbc9)throw new Error(_0x128b('0x53'));if(_0x57fbc9[_0x128b('0x54')]==='user'){var _0x5e5a8c=_0x7789de[_0x128b('0x52')]({'plain':!![]});var _0x6f2ab8=[{'name':_0x128b('0x28'),'value':_0x128b('0x29')},{'name':_0x128b('0x2a'),'value':_0x128b('0x2b')}];var _0x5e55f4=_['find'](_0x6f2ab8,[_0x128b('0x2d'),_0x5e5a8c['type']])[_0x128b('0x34')];return db[_0x128b('0x55')]['find']({'where':{'name':_0x5e55f4,'userProfileId':_0x57fbc9[_0x128b('0x56')]},'raw':!![]})[_0x128b('0x26')](function(_0x2f6e78){if(_0x2f6e78&&_0x2f6e78[_0x128b('0x57')]===0x0){return db['UserProfileResource'][_0x128b('0x50')]({'name':_0x5e5a8c[_0x128b('0x34')],'resourceId':_0x5e5a8c['id'],'type':_0x2f6e78[_0x128b('0x34')],'sectionId':_0x2f6e78['id']},{})[_0x128b('0x26')](function(){return _0x7789de;});}else{return _0x7789de;}})[_0x128b('0x4e')](function(_0x3a06aa){logger[_0x128b('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a06aa);throw _0x3a06aa;});}return _0x7789de;})['then'](respondWithResult(_0x1c56ca,0xc9))[_0x128b('0x4e')](handleError(_0x1c56ca,null));};exports[_0x128b('0x58')]=function(_0x394512,_0x44a643){var _0xf7ae23={'where':{'id':_0x394512[_0x128b('0x59')]['id']}},_0x5a4398={};_0x5a4398[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x37')]['rawAttributes']);_0xf7ae23[_0x128b('0x41')]=_[_0x128b('0x3f')](_0x5a4398[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x394512[_0x128b('0x3d')][_0x128b('0x40')]));_0xf7ae23[_0x128b('0x41')]=_0xf7ae23[_0x128b('0x41')]['length']?_0xf7ae23[_0x128b('0x41')]:_0x5a4398[_0x128b('0x3b')];if(_0x394512[_0x128b('0x3d')]['includeAll']){_0xf7ae23[_0x128b('0x4b')]=[{'all':!![]}];}_0xf7ae23=_[_0x128b('0x48')]({},_0xf7ae23,_0x394512['options']);return db[_0x128b('0x37')][_0x128b('0x30')](_0xf7ae23)[_0x128b('0x26')](handleEntityNotFound(_0x44a643,null))[_0x128b('0x26')](function(_0x50a70e){if(_0x50a70e){var _0x11c683=_0x50a70e['get']({'plain':!![]});_0x11c683=qs[_0x128b('0x5a')](_0x11c683,['id',_0x128b('0x5b'),_0x128b('0x5c')]);_0x394512[_0x128b('0x51')]=_[_0x128b('0x5a')](_0x394512['body'],['id','createdAt',_0x128b('0x5c')]);return db[_0x128b('0x37')][_0x128b('0x50')](_[_0x128b('0x48')](_0x11c683,_0x394512[_0x128b('0x51')]),{'include':_0x394512[_0x128b('0x3d')][_0x128b('0x4a')]?[{'all':!![]}]:undefined})[_0x128b('0x26')](function(_0x8d51c7){var _0x5861ec=_0x394512[_0x128b('0x5d')]['get']({'plain':!![]});if(!_0x5861ec)throw new Error(_0x128b('0x53'));if(_0x5861ec['role']===_0x128b('0x5d')){var _0x31758a=_0x8d51c7['get']({'plain':!![]});var _0x12f993=[{'name':'VoiceQueues','value':_0x128b('0x29')},{'name':_0x128b('0x2a'),'value':_0x128b('0x2b')}];var _0x370937=_[_0x128b('0x30')](_0x12f993,['value',_0x31758a['type']])[_0x128b('0x34')];return db['UserProfileSection'][_0x128b('0x30')]({'where':{'name':_0x370937,'userProfileId':_0x5861ec[_0x128b('0x56')]},'raw':!![]})[_0x128b('0x26')](function(_0xfc05a){if(_0xfc05a&&_0xfc05a[_0x128b('0x57')]===0x0){return db[_0x128b('0x31')][_0x128b('0x50')]({'name':_0x31758a['name'],'resourceId':_0x31758a['id'],'type':_0xfc05a[_0x128b('0x34')],'sectionId':_0xfc05a['id']},{})['then'](function(){return _0x8d51c7;});}else{return _0x8d51c7;}})[_0x128b('0x4e')](function(_0x4c31dc){logger['error'](_0x128b('0x5e'),_0x4c31dc);throw _0x4c31dc;});}return _0x8d51c7;});}})[_0x128b('0x26')](respondWithResult(_0x44a643,0xc9))[_0x128b('0x4e')](handleError(_0x44a643,null));};exports['update']=function(_0x4a71c5,_0x203a25){if(_0x4a71c5['body']['id']){delete _0x4a71c5[_0x128b('0x51')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x4a71c5[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x203a25,null))[_0x128b('0x26')](saveUpdates(_0x4a71c5[_0x128b('0x51')],null))[_0x128b('0x26')](respondWithResult(_0x203a25,null))['catch'](handleError(_0x203a25,null));};exports[_0x128b('0x27')]=function(_0x32819e,_0x38fa81){return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x32819e[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x38fa81,null))[_0x128b('0x26')](removeEntity(_0x38fa81,null))[_0x128b('0x4e')](handleError(_0x38fa81,null));};exports['getHoppers']=function(_0x2eeb17,_0x5e9ed8,_0x42375d){var _0x7aef81={'raw':![],'where':{}};var _0x5e28df={};var _0x253712={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x2eeb17['params']['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x5e9ed8,null))['then'](function(_0x48d3c6){if(_0x48d3c6){_0x5e28df[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x60')]['rawAttributes']);_0x5e28df['query']=_[_0x128b('0x3e')](_0x2eeb17[_0x128b('0x3d')]);_0x5e28df['filters']=_[_0x128b('0x3f')](_0x5e28df[_0x128b('0x3b')],_0x5e28df[_0x128b('0x3d')]);_0x7aef81[_0x128b('0x41')]=_[_0x128b('0x3f')](_0x5e28df[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x2eeb17['query'][_0x128b('0x40')]));_0x7aef81[_0x128b('0x41')]=_0x7aef81['attributes'][_0x128b('0x42')]?_0x7aef81[_0x128b('0x41')]:_0x5e28df['model'];if(!_0x2eeb17[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x7aef81[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x2eeb17[_0x128b('0x3d')][_0x128b('0x21')]);_0x7aef81[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x2eeb17['query'][_0x128b('0x20')]);}_0x7aef81[_0x128b('0x61')]=qs['sort'](_0x2eeb17[_0x128b('0x3d')][_0x128b('0x45')]);_0x7aef81['where']=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x2eeb17[_0x128b('0x3d')],_0x5e28df[_0x128b('0x47')]));_0x7aef81['where'][_0x128b('0x63')]=_0x48d3c6['id'];if(_0x2eeb17[_0x128b('0x3d')][_0x128b('0x2c')]){_0x7aef81['where']=_['merge'](_0x7aef81['where'],{'$or':_['map'](_0x7aef81[_0x128b('0x41')],function(_0xdf2a61){var _0x105125={};_0x105125[_0xdf2a61]={'$like':'%'+_0x2eeb17['query'][_0x128b('0x2c')]+'%'};return _0x105125;})});}_0x7aef81=_[_0x128b('0x48')]({},_0x7aef81,_0x2eeb17[_0x128b('0x49')]);return db[_0x128b('0x60')][_0x128b('0x1f')]({'where':_0x7aef81[_0x128b('0x46')]})[_0x128b('0x26')](function(_0x5220a9){_0x253712['count']=_0x5220a9;if(_0x2eeb17[_0x128b('0x3d')][_0x128b('0x4a')]){_0x7aef81['include']=[{'all':!![]}];}return db['CmHopper'][_0x128b('0x4c')](_0x7aef81);})[_0x128b('0x26')](function(_0x12eb40){_0x253712[_0x128b('0x4d')]=_0x12eb40;return _0x253712;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x5e9ed8,_0x7aef81))[_0x128b('0x4e')](handleError(_0x5e9ed8,null));};exports[_0x128b('0x64')]=function(_0x5d52a2,_0x3ff32e,_0x4e53b3){var _0x20def5={'raw':!![],'where':{}};var _0x3b1630={};var _0x4af006={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x5d52a2[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ff32e,null))['then'](function(_0x655cb3){if(_0x655cb3){_0x3b1630[_0x128b('0x3b')]=_['keys'](db[_0x128b('0x65')]['rawAttributes']);_0x3b1630[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x5d52a2[_0x128b('0x3d')]);_0x3b1630[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x3b1630[_0x128b('0x3b')],_0x3b1630[_0x128b('0x3d')]);_0x20def5[_0x128b('0x41')]=_['intersection'](_0x3b1630[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x5d52a2['query'][_0x128b('0x40')]));_0x20def5[_0x128b('0x41')]=_0x20def5[_0x128b('0x41')][_0x128b('0x42')]?_0x20def5[_0x128b('0x41')]:_0x3b1630[_0x128b('0x3b')];if(!_0x5d52a2[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x20def5['limit']=qs[_0x128b('0x21')](_0x5d52a2[_0x128b('0x3d')]['limit']);_0x20def5[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x5d52a2['query']['offset']);}_0x20def5[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x5d52a2[_0x128b('0x3d')]['sort']);_0x20def5[_0x128b('0x46')]=qs['filters'](_[_0x128b('0x62')](_0x5d52a2[_0x128b('0x3d')],_0x3b1630[_0x128b('0x47')]));_0x20def5[_0x128b('0x46')][_0x128b('0x63')]=_0x655cb3['id'];if(_0x5d52a2[_0x128b('0x3d')][_0x128b('0x2c')]){_0x20def5[_0x128b('0x46')]=_[_0x128b('0x48')](_0x20def5[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x20def5['attributes'],function(_0xcc46f9){var _0x5b18a6={};_0x5b18a6[_0xcc46f9]={'$like':'%'+_0x5d52a2['query'][_0x128b('0x2c')]+'%'};return _0x5b18a6;})});}_0x20def5=_[_0x128b('0x48')]({},_0x20def5,_0x5d52a2[_0x128b('0x49')]);return db[_0x128b('0x65')][_0x128b('0x1f')]({'where':_0x20def5['where']})[_0x128b('0x26')](function(_0x221cf7){_0x4af006['count']=_0x221cf7;if(_0x5d52a2[_0x128b('0x3d')]['includeAll']){_0x20def5[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x65')][_0x128b('0x4c')](_0x20def5);})[_0x128b('0x26')](function(_0x19fd82){_0x4af006[_0x128b('0x4d')]=_0x19fd82;return _0x4af006;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x3ff32e,_0x20def5))['catch'](handleError(_0x3ff32e,null));};exports[_0x128b('0x66')]=function(_0xfd7a0b,_0x26cc99,_0xc6c42f){var _0x1d1b27={'raw':!![],'where':{}};var _0x5b6fa7={};var _0x21ffba={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0xfd7a0b[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x26cc99,null))[_0x128b('0x26')](function(_0x42e130){if(_0x42e130){_0x5b6fa7[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x67')][_0x128b('0x38')]);_0x5b6fa7[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0xfd7a0b[_0x128b('0x3d')]);_0x5b6fa7[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x5b6fa7[_0x128b('0x3b')],_0x5b6fa7[_0x128b('0x3d')]);_0x1d1b27['attributes']=_[_0x128b('0x3f')](_0x5b6fa7[_0x128b('0x3b')],qs[_0x128b('0x40')](_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x40')]));_0x1d1b27['attributes']=_0x1d1b27[_0x128b('0x41')][_0x128b('0x42')]?_0x1d1b27[_0x128b('0x41')]:_0x5b6fa7[_0x128b('0x3b')];if(!_0xfd7a0b[_0x128b('0x3d')]['hasOwnProperty'](_0x128b('0x44'))){_0x1d1b27[_0x128b('0x21')]=qs[_0x128b('0x21')](_0xfd7a0b[_0x128b('0x3d')]['limit']);_0x1d1b27[_0x128b('0x20')]=qs[_0x128b('0x20')](_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x20')]);}_0x1d1b27[_0x128b('0x61')]=qs[_0x128b('0x45')](_0xfd7a0b[_0x128b('0x3d')]['sort']);_0x1d1b27[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0xfd7a0b[_0x128b('0x3d')],_0x5b6fa7[_0x128b('0x47')]));_0x1d1b27[_0x128b('0x46')][_0x128b('0x63')]=_0x42e130['id'];if(_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x2c')]){_0x1d1b27[_0x128b('0x46')]=_[_0x128b('0x48')](_0x1d1b27[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x1d1b27[_0x128b('0x41')],function(_0x406b55){var _0x17b381={};_0x17b381[_0x406b55]={'$like':'%'+_0xfd7a0b['query'][_0x128b('0x2c')]+'%'};return _0x17b381;})});}_0x1d1b27=_[_0x128b('0x48')]({},_0x1d1b27,_0xfd7a0b[_0x128b('0x49')]);return db[_0x128b('0x67')][_0x128b('0x1f')]({'where':_0x1d1b27['where']})['then'](function(_0x598b45){_0x21ffba[_0x128b('0x1f')]=_0x598b45;if(_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x4a')]){_0x1d1b27[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x67')]['findAll'](_0x1d1b27);})[_0x128b('0x26')](function(_0x395984){_0x21ffba[_0x128b('0x4d')]=_0x395984;return _0x21ffba;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x26cc99,_0x1d1b27))[_0x128b('0x4e')](handleError(_0x26cc99,null));};exports[_0x128b('0x68')]=function(_0x42cd72,_0x3b02fb,_0x42455e){var _0x3fda92={'raw':!![],'where':{}};var _0x4bcea1={};var _0x378b1={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x42cd72[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x3b02fb,null))[_0x128b('0x26')](function(_0x26a332){if(_0x26a332){_0x4bcea1[_0x128b('0x3b')]=_[_0x128b('0x3e')](db['CmHopperBlack']['rawAttributes']);_0x4bcea1['query']=_[_0x128b('0x3e')](_0x42cd72[_0x128b('0x3d')]);_0x4bcea1['filters']=_['intersection'](_0x4bcea1['model'],_0x4bcea1[_0x128b('0x3d')]);_0x3fda92[_0x128b('0x41')]=_['intersection'](_0x4bcea1['model'],qs[_0x128b('0x40')](_0x42cd72['query'][_0x128b('0x40')]));_0x3fda92['attributes']=_0x3fda92[_0x128b('0x41')][_0x128b('0x42')]?_0x3fda92[_0x128b('0x41')]:_0x4bcea1['model'];if(!_0x42cd72[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x3fda92[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x42cd72['query'][_0x128b('0x21')]);_0x3fda92['offset']=qs[_0x128b('0x20')](_0x42cd72[_0x128b('0x3d')][_0x128b('0x20')]);}_0x3fda92[_0x128b('0x61')]=qs['sort'](_0x42cd72[_0x128b('0x3d')][_0x128b('0x45')]);_0x3fda92[_0x128b('0x46')]=qs[_0x128b('0x47')](_['pick'](_0x42cd72[_0x128b('0x3d')],_0x4bcea1['filters']));_0x3fda92['where']['VoiceQueueId']=_0x26a332['id'];if(_0x42cd72[_0x128b('0x3d')][_0x128b('0x2c')]){_0x3fda92[_0x128b('0x46')]=_[_0x128b('0x48')](_0x3fda92[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x3fda92[_0x128b('0x41')],function(_0x1f0cc2){var _0x54c246={};_0x54c246[_0x1f0cc2]={'$like':'%'+_0x42cd72[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x54c246;})});}_0x3fda92=_['merge']({},_0x3fda92,_0x42cd72[_0x128b('0x49')]);return db['CmHopperBlack']['count']({'where':_0x3fda92[_0x128b('0x46')]})['then'](function(_0x2193e5){_0x378b1['count']=_0x2193e5;if(_0x42cd72[_0x128b('0x3d')][_0x128b('0x4a')]){_0x3fda92[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x69')]['findAll'](_0x3fda92);})[_0x128b('0x26')](function(_0x2c6f4b){_0x378b1[_0x128b('0x4d')]=_0x2c6f4b;return _0x378b1;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x3b02fb,_0x3fda92))[_0x128b('0x4e')](handleError(_0x3b02fb,null));};exports[_0x128b('0x6a')]=function(_0x4773c8,_0x4d1bf3,_0x25d3fd){var _0xa226fc={};var _0x315f82={};var _0x2784fa;var _0x3cfe0e;return db['VoiceQueue'][_0x128b('0x5f')]({'where':{'id':_0x4773c8[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x4d1bf3,null))['then'](function(_0x3090b7){if(_0x3090b7){_0x2784fa=_0x3090b7;_0x315f82[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x6b')][_0x128b('0x38')]);_0x315f82[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x4773c8[_0x128b('0x3d')]);_0x315f82[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x315f82[_0x128b('0x3b')],_0x315f82[_0x128b('0x3d')]);_0xa226fc[_0x128b('0x41')]=_[_0x128b('0x3f')](_0x315f82['model'],qs['fields'](_0x4773c8[_0x128b('0x3d')][_0x128b('0x40')]));_0xa226fc['attributes']=_0xa226fc[_0x128b('0x41')][_0x128b('0x42')]?_0xa226fc[_0x128b('0x41')]:_0x315f82[_0x128b('0x3b')];_0xa226fc[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x4773c8[_0x128b('0x3d')][_0x128b('0x45')]);_0xa226fc[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x4773c8[_0x128b('0x3d')],_0x315f82[_0x128b('0x47')]));if(_0x4773c8[_0x128b('0x3d')][_0x128b('0x2c')]){_0xa226fc['where']=_[_0x128b('0x48')](_0xa226fc[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0xa226fc[_0x128b('0x41')],function(_0x28d48e){var _0x5a367f={};_0x5a367f[_0x28d48e]={'$like':'%'+_0x4773c8[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x5a367f;})});}_0xa226fc=_[_0x128b('0x48')]({},_0xa226fc,_0x4773c8[_0x128b('0x49')]);return _0x2784fa[_0x128b('0x6a')](_0xa226fc);}})[_0x128b('0x26')](function(_0x272ed9){if(_0x272ed9){_0x3cfe0e=_0x272ed9[_0x128b('0x42')];if(!_0x4773c8[_0x128b('0x3d')]['hasOwnProperty'](_0x128b('0x44'))){_0xa226fc[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x4773c8[_0x128b('0x3d')][_0x128b('0x21')]);_0xa226fc[_0x128b('0x20')]=qs['offset'](_0x4773c8[_0x128b('0x3d')]['offset']);}return _0x2784fa['getTeams'](_0xa226fc);}})[_0x128b('0x26')](function(_0x55d463){if(_0x55d463){return _0x55d463?{'count':_0x3cfe0e,'rows':_0x55d463}:null;}})[_0x128b('0x26')](respondWithResult(_0x4d1bf3,null))[_0x128b('0x4e')](handleError(_0x4d1bf3,null));};exports['addTeams']=function(_0x29a8cc,_0x3a08bc,_0x1985fe){var _0x501652=_0x29a8cc[_0x128b('0x51')][_0x128b('0x6c')];var _0x1f7b96=_['map'](_0x501652,'id');return db[_0x128b('0x6b')]['findAll']({'where':{'id':_0x1f7b96},'attributes':['id'],'include':[{'model':db[_0x128b('0x6d')],'as':'Agents','attributes':['id',_0x128b('0x34'),_0x128b('0x6e'),_0x128b('0x6f'),_0x128b('0x70')],'raw':!![]}]})[_0x128b('0x26')](function(_0xb4cb90){if(_0xb4cb90){var _0x73ebe=_[_0x128b('0x71')](_0xb4cb90,function(_0x15cebb){var _0xa0e8c1=_0x15cebb[_0x128b('0x52')]({'plain':!![]});_0xa0e8c1['Agents'][_0x128b('0x72')](function(_0x1dd1ff){_0x1dd1ff[_0x128b('0x73')]=_['find'](_0x501652,{'id':_0xa0e8c1['id']})[_0x128b('0x73')];});return _0xa0e8c1[_0x128b('0x74')];});return db[_0x128b('0x37')]['find']({'where':{'id':_0x29a8cc[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(_0xe11802){return db[_0x128b('0x75')][_0x128b('0x76')](function(_0x3d08fc){return _0xe11802[_0x128b('0x77')](_0x1f7b96,{'transaction':_0x3d08fc})['then'](function(){return BPromise[_0x128b('0x78')](_0x73ebe,function(_0x3cc2a1){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3cc2a1['id'],'VoiceQueueId':_0x29a8cc[_0x128b('0x59')]['id']},'defaults':{'penalty':_0x3cc2a1[_0x128b('0x73')]},'transaction':_0x3d08fc});});})[_0x128b('0x26')](function(){return BPromise['each'](_['filter'](_0x73ebe,{'online':!![]}),function(_0x1f0c19){return db[_0x128b('0x79')][_0x128b('0x7a')]({'membername':_0x1f0c19[_0x128b('0x34')],'UserId':_0x1f0c19['id'],'queue_name':_0xe11802[_0x128b('0x34')],'VoiceQueueId':_0xe11802['id'],'interface':_[_0x128b('0x7b')](_0x1f0c19['interface'])?util[_0x128b('0x7c')]('SIP/%s',_0x1f0c19[_0x128b('0x34')]):_0x1f0c19[_0x128b('0x70')],'paused':_0x1f0c19[_0x128b('0x6f')]||![],'penalty':_0x1f0c19[_0x128b('0x73')]},{'transaction':_0x3d08fc});});})[_0x128b('0x26')](function(){_0x73ebe[_0x128b('0x72')](function(_0x55b9df){socket['emit']('userVoiceQueue:save',{'UserId':_0x55b9df['id'],'VoiceQueueId':_0xe11802['id']});});});});});}})[_0x128b('0x26')](respondWithStatusCode(_0x3a08bc,null))[_0x128b('0x4e')](handleError(_0x3a08bc,null));};exports['removeTeams']=function(_0x561782,_0xabfbff,_0x26e7e2){return db[_0x128b('0x6b')][_0x128b('0x4c')]({'where':{'id':_0x561782[_0x128b('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x128b('0x6d')],'as':_0x128b('0x74'),'attributes':['id'],'raw':!![]}]})[_0x128b('0x26')](handleEntityNotFound(_0xabfbff,null))['then'](function(_0x515239){var _0x4808e7=_[_0x128b('0x3c')](_0x515239,'id');var _0x270bc2=[];var _0x3832d2=[];var _0x5aa21a=squel[_0x128b('0x7d')]();_0x5aa21a['field'](_0x128b('0x7e'))[_0x128b('0x7f')](_0x128b('0x80'),'tq')[_0x128b('0x81')](_0x128b('0x82'),'ut',_0x128b('0x83'))[_0x128b('0x46')](_0x128b('0x84'),_0x561782['params']['id']);for(var _0x58aeaf=0x0;_0x58aeaf<_0x515239[_0x128b('0x42')];_0x58aeaf+=0x1){let _0x4c4de6=_0x515239[_0x58aeaf];for(var _0x3dc7e9=0x0;_0x3dc7e9<_0x4c4de6[_0x128b('0x74')][_0x128b('0x42')];_0x3dc7e9+=0x1){let _0x1e3c8e=_0x4c4de6[_0x128b('0x74')][_0x3dc7e9];var _0x470ebb=_0x5aa21a[_0x128b('0x58')]();_0x470ebb[_0x128b('0x46')](_0x128b('0x85'),_0x1e3c8e['id']);_0x3832d2[_0x128b('0x86')](db['sequelize']['query'](_0x470ebb['toString'](),{'type':db['sequelize'][_0x128b('0x87')][_0x128b('0x88')]})[_0x128b('0x26')](function(_0x5751f6){if(_0x5751f6['length']===0x1){return _0x1e3c8e['id'];}else{var _0x3ce92b=_[_0x128b('0x89')](_[_0x128b('0x3c')](_0x5751f6,_0x128b('0x8a')),function(_0x3dc232){return _[_0x128b('0x2e')](_0x4808e7,_0x3dc232);});if(_0x3ce92b){return _0x1e3c8e['id'];}}}));}}return BPromise[_0x128b('0x8b')](_0x3832d2)[_0x128b('0x26')](function(_0x29fe04){_0x270bc2=_(_0x270bc2)['union'](_0x29fe04)[_0x128b('0x8c')]()[_0x128b('0x2d')]();return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x561782[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(_0x1fe425){return db['sequelize'][_0x128b('0x76')](function(_0x2561b7){return _0x1fe425[_0x128b('0x8d')](_0x561782[_0x128b('0x3d')]['ids'],{'transaction':_0x2561b7})[_0x128b('0x26')](function(){if(!_[_0x128b('0x8e')](_0x270bc2)){return _0x1fe425[_0x128b('0x8f')](_0x270bc2,{'transaction':_0x2561b7})['then'](function(){return db[_0x128b('0x79')][_0x128b('0x27')]({'where':{'VoiceQueueId':_0x561782['params']['id'],'UserId':_0x270bc2},'transaction':_0x2561b7});});}})[_0x128b('0x26')](function(){_0x270bc2['forEach'](function(_0x45a3f4){socket[_0x128b('0x90')](_0x128b('0x91'),{'UserId':_0x45a3f4,'VoiceQueueId':_0x1fe425['id']});});});});});});})[_0x128b('0x26')](respondWithStatusCode(_0xabfbff,null))['catch'](handleError(_0xabfbff,null));};exports[_0x128b('0x92')]=function(_0xf181b2,_0xdbee2c,_0x3e7e1b){var _0x2837c8,_0x3e4a54;return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0xf181b2['params']['id']}})['then'](handleEntityNotFound(_0xdbee2c,null))[_0x128b('0x26')](function(_0xd9c243){if(_0xd9c243){_0x3e4a54=_0xd9c243;return _0xd9c243[_0x128b('0x92')](_0xf181b2['body'][_0x128b('0x93')],_[_0x128b('0x5a')](_0xf181b2[_0x128b('0x51')],[_0x128b('0x93'),'id'])||{})[_0x128b('0x94')](function(_0x2cb251){for(var _0x587528=0x0;_0x587528<_0xf181b2[_0x128b('0x51')][_0x128b('0x93')][_0x128b('0x42')];_0x587528+=0x1){socket[_0x128b('0x90')](_0x128b('0x95'),{'UserId':_0xf181b2[_0x128b('0x51')][_0x128b('0x93')][_0x587528],'VoiceQueueId':_0xf181b2['params']['id']});}return _0x2cb251;});}})['then'](function(_0x4966bc){_0x2837c8=_0x4966bc||[];if(_0x3e4a54){return db[_0x128b('0x6d')][_0x128b('0x4c')]({'where':{'id':_0xf181b2[_0x128b('0x51')][_0x128b('0x93')]},'attributes':['id',_0x128b('0x34'),_0x128b('0x6e'),_0x128b('0x6f'),'interface'],'raw':!![]});}})['then'](function(_0x4d9317){if(!_['isEmpty'](_0x4d9317)){var _0x4d32a0=[];for(var _0x1c0392=0x0;_0x1c0392<_0x4d9317[_0x128b('0x42')];_0x1c0392++){if(_0x4d9317[_0x1c0392]['online']){_0x4d32a0[_0x128b('0x86')](db[_0x128b('0x79')]['upsert']({'membername':_0x4d9317[_0x1c0392]['name'],'UserId':_0x4d9317[_0x1c0392]['id'],'queue_name':_0x3e4a54[_0x128b('0x34')],'VoiceQueueId':_0x3e4a54['id'],'interface':_['isNil'](_0x4d9317[_0x1c0392][_0x128b('0x70')])?util['format'](_0x128b('0x96'),_0x4d9317[_0x1c0392][_0x128b('0x34')]):_0x4d9317[_0x1c0392][_0x128b('0x70')],'paused':_0x4d9317[_0x1c0392][_0x128b('0x6f')]||![],'penalty':_0xf181b2[_0x128b('0x51')]['penalty']||0x0}));}}return BPromise[_0x128b('0x8b')](_0x4d32a0);}})[_0x128b('0x26')](function(){return _0x2837c8;})[_0x128b('0x26')](respondWithResult(_0xdbee2c,null))[_0x128b('0x4e')](handleError(_0xdbee2c,null));};exports[_0x128b('0x8f')]=function(_0x44b575,_0x5ca226,_0x57d81f){return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x44b575[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x5ca226,null))[_0x128b('0x26')](function(_0x15f3f1){if(_0x15f3f1){return _0x15f3f1[_0x128b('0x8f')](_0x44b575['query'][_0x128b('0x93')])['then'](function(){if(_['isArray'](_0x44b575[_0x128b('0x3d')][_0x128b('0x93')])){for(var _0x187ef8=0x0;_0x187ef8<_0x44b575[_0x128b('0x3d')]['ids'][_0x128b('0x42')];_0x187ef8+=0x1){socket[_0x128b('0x90')]('userVoiceQueue:remove',{'UserId':Number(_0x44b575['query'][_0x128b('0x93')][_0x187ef8]),'VoiceQueueId':Number(_0x44b575[_0x128b('0x59')]['id'])});}}else{socket[_0x128b('0x90')](_0x128b('0x91'),{'UserId':Number(_0x44b575[_0x128b('0x3d')][_0x128b('0x93')]),'VoiceQueueId':Number(_0x44b575[_0x128b('0x59')]['id'])});}});}})[_0x128b('0x26')](function(_0x4cbf01){return db[_0x128b('0x79')][_0x128b('0x27')]({'where':{'VoiceQueueId':_0x44b575[_0x128b('0x59')]['id'],'UserId':_0x44b575[_0x128b('0x3d')][_0x128b('0x93')]}})[_0x128b('0x26')](function(){return _0x4cbf01;});})[_0x128b('0x26')](respondWithStatusCode(_0x5ca226,null))['catch'](handleError(_0x5ca226,null));};exports[_0x128b('0x97')]=function(_0x4a8c25,_0x345866,_0x250f2f){var _0x408cea={};var _0x2678f3={};var _0x2d1956;var _0x5cb244;return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x4a8c25[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x345866,null))[_0x128b('0x26')](function(_0x3cbc72){if(_0x3cbc72){_0x2d1956=_0x3cbc72;_0x2678f3[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x6d')][_0x128b('0x38')]);_0x2678f3['query']=_[_0x128b('0x3e')](_0x4a8c25[_0x128b('0x3d')]);_0x2678f3[_0x128b('0x47')]=_['intersection'](_0x2678f3[_0x128b('0x3b')],_0x2678f3['query']);_0x408cea['attributes']=_[_0x128b('0x3f')](_0x2678f3[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x4a8c25[_0x128b('0x3d')][_0x128b('0x40')]));_0x408cea[_0x128b('0x41')]=_0x408cea[_0x128b('0x41')][_0x128b('0x42')]?_0x408cea['attributes']:_0x2678f3[_0x128b('0x3b')];_0x408cea['order']=qs[_0x128b('0x45')](_0x4a8c25['query'][_0x128b('0x45')]);_0x408cea['where']=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x4a8c25[_0x128b('0x3d')],_0x2678f3[_0x128b('0x47')]));if(_0x4a8c25[_0x128b('0x3d')][_0x128b('0x2c')]){_0x408cea['where']=_[_0x128b('0x48')](_0x408cea[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x408cea[_0x128b('0x41')],function(_0x2205fc){var _0xa2cdf8={};_0xa2cdf8[_0x2205fc]={'$like':'%'+_0x4a8c25[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0xa2cdf8;})});}_0x408cea=_[_0x128b('0x48')]({},_0x408cea,_0x4a8c25[_0x128b('0x49')]);return _0x2d1956[_0x128b('0x97')](_0x408cea);}})[_0x128b('0x26')](function(_0xb5847c){if(_0xb5847c){_0x5cb244=_0xb5847c[_0x128b('0x42')];if(!_0x4a8c25[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x408cea[_0x128b('0x21')]=qs['limit'](_0x4a8c25[_0x128b('0x3d')][_0x128b('0x21')]);_0x408cea['offset']=qs[_0x128b('0x20')](_0x4a8c25[_0x128b('0x3d')][_0x128b('0x20')]);}return _0x2d1956[_0x128b('0x97')](_0x408cea);}})[_0x128b('0x26')](function(_0xbb6b93){if(_0xbb6b93){return _0xbb6b93?{'count':_0x5cb244,'rows':_0xbb6b93}:null;}})[_0x128b('0x26')](respondWithResult(_0x345866,null))[_0x128b('0x4e')](handleError(_0x345866,null));};exports['getMembers']=function(_0x2a663a,_0x4a7715,_0x10a2e0){var _0x49e238={};var _0x1b0e55={};var _0x212711;var _0x4beb17;return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x2a663a['params']['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x4a7715,null))['then'](function(_0x9c82c3){if(_0x9c82c3){_0x212711=_0x9c82c3;_0x1b0e55[_0x128b('0x3b')]=_['keys'](db[_0x128b('0x79')][_0x128b('0x38')]);_0x1b0e55[_0x128b('0x3d')]=_['keys'](_0x2a663a[_0x128b('0x3d')]);_0x1b0e55[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x1b0e55[_0x128b('0x3b')],_0x1b0e55[_0x128b('0x3d')]);_0x49e238['attributes']=_['intersection'](_0x1b0e55[_0x128b('0x3b')],qs['fields'](_0x2a663a[_0x128b('0x3d')][_0x128b('0x40')]));_0x49e238['attributes']=_0x49e238['attributes'][_0x128b('0x42')]?_0x49e238['attributes']:_0x1b0e55[_0x128b('0x3b')];_0x49e238[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x2a663a[_0x128b('0x3d')][_0x128b('0x45')]);_0x49e238[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x2a663a['query'],_0x1b0e55[_0x128b('0x47')]));if(_0x2a663a[_0x128b('0x3d')][_0x128b('0x2c')]){_0x49e238[_0x128b('0x46')]=_['merge'](_0x49e238[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x49e238[_0x128b('0x41')],function(_0x119d25){var _0x3e50d9={};_0x3e50d9[_0x119d25]={'$like':'%'+_0x2a663a[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x3e50d9;})});}_0x49e238=_['merge']({},_0x49e238,_0x2a663a['options']);return _0x212711[_0x128b('0x98')](_0x49e238);}})[_0x128b('0x26')](function(_0x386c5e){if(_0x386c5e){_0x4beb17=_0x386c5e['length'];if(!_0x2a663a[_0x128b('0x3d')][_0x128b('0x43')]('nolimit')){_0x49e238[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x2a663a[_0x128b('0x3d')]['limit']);_0x49e238[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x2a663a[_0x128b('0x3d')][_0x128b('0x20')]);}return _0x212711['getMembers'](_0x49e238);}})['then'](function(_0x59e355){return _0x59e355?{'count':_0x4beb17,'rows':_0x59e355}:null;})[_0x128b('0x26')](respondWithResult(_0x4a7715,null))[_0x128b('0x4e')](handleError(_0x4a7715,null));};exports['getLists']=function(_0x5edc7a,_0x5682b3,_0x8a370b){var _0x2d5a20={};var _0x3f5922={};var _0x4518fc;var _0x2249f3;return db['VoiceQueue'][_0x128b('0x5f')]({'where':{'id':_0x5edc7a[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x5682b3,null))['then'](function(_0x414f3f){if(_0x414f3f){_0x4518fc=_0x414f3f;_0x3f5922['model']=_[_0x128b('0x3e')](db[_0x128b('0x99')][_0x128b('0x38')]);_0x3f5922[_0x128b('0x3d')]=_['keys'](_0x5edc7a[_0x128b('0x3d')]);_0x3f5922[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x3f5922[_0x128b('0x3b')],_0x3f5922[_0x128b('0x3d')]);_0x2d5a20[_0x128b('0x41')]=_['intersection'](_0x3f5922[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x5edc7a['query'][_0x128b('0x40')]));_0x2d5a20['attributes']=_0x2d5a20['attributes'][_0x128b('0x42')]?_0x2d5a20[_0x128b('0x41')]:_0x3f5922[_0x128b('0x3b')];_0x2d5a20[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x5edc7a[_0x128b('0x3d')][_0x128b('0x45')]);_0x2d5a20[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x5edc7a[_0x128b('0x3d')],_0x3f5922[_0x128b('0x47')]));if(_0x5edc7a[_0x128b('0x3d')][_0x128b('0x2c')]){_0x2d5a20[_0x128b('0x46')]=_[_0x128b('0x48')](_0x2d5a20[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x2d5a20[_0x128b('0x41')],function(_0x257ea7){var _0x281a9d={};_0x281a9d[_0x257ea7]={'$like':'%'+_0x5edc7a['query'][_0x128b('0x2c')]+'%'};return _0x281a9d;})});}_0x2d5a20=_[_0x128b('0x48')]({},_0x2d5a20,_0x5edc7a[_0x128b('0x49')]);return _0x4518fc['getLists'](_0x2d5a20);}})[_0x128b('0x26')](function(_0x36ebf1){if(_0x36ebf1){_0x2249f3=_0x36ebf1[_0x128b('0x42')];if(!_0x5edc7a[_0x128b('0x3d')][_0x128b('0x43')]('nolimit')){_0x2d5a20['limit']=qs[_0x128b('0x21')](_0x5edc7a[_0x128b('0x3d')][_0x128b('0x21')]);_0x2d5a20['offset']=qs[_0x128b('0x20')](_0x5edc7a['query'][_0x128b('0x20')]);}return _0x4518fc[_0x128b('0x9a')](_0x2d5a20);}})[_0x128b('0x26')](function(_0x1244e4){if(_0x1244e4){return _0x1244e4?{'count':_0x2249f3,'rows':_0x1244e4}:null;}})['then'](respondWithResult(_0x5682b3,null))[_0x128b('0x4e')](handleError(_0x5682b3,null));};exports[_0x128b('0x9b')]=function(_0x5913ee,_0x621568,_0x58b307){var _0x588a9c,_0x206d00;return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x5913ee[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x621568,null))[_0x128b('0x26')](function(_0x3d068f){if(_0x3d068f){_0x206d00=_0x3d068f;return _0x3d068f['addLists'](_0x5913ee[_0x128b('0x51')][_0x128b('0x93')],_[_0x128b('0x5a')](_0x5913ee[_0x128b('0x51')],['ids','id'])||{});}return null;})[_0x128b('0x94')](function(_0x20cd37){var _0x30fe12;_0x588a9c=_0x20cd37||[];var _0xac06e3=[];if(_0x20cd37){for(var _0x5e4c24=0x0;_0x5e4c24<_0x20cd37[_0x128b('0x42')];_0x5e4c24+=0x1){var _0x4391cb=_0x20cd37[_0x5e4c24][_0x128b('0x52')]({'plain':!![]});_0x206d00['dialCheckDuplicateType']=_0x5913ee[_0x128b('0x51')][_0x128b('0x9c')]?_0x5913ee['body'][_0x128b('0x9c')]:_0x206d00[_0x128b('0x9c')];switch(_0x206d00[_0x128b('0x9c')]){case _0x128b('0x9d'):_0x30fe12=squel[_0x128b('0x9e')]()[_0x128b('0x9f')](_0x128b('0xa0'))[_0x128b('0xa1')](['phone',_0x128b('0xa2'),_0x128b('0xa3'),_0x128b('0xa4'),_0x128b('0x63'),_0x128b('0x5b'),_0x128b('0x5c')],squel['select']()['field'](_0x128b('0xa5'),'phone')[_0x128b('0xa6')](_0x128b('0xa7'),'scheduledAt')['field']('id',_0x128b('0xa3'))[_0x128b('0xa6')](_0x4391cb['CmListId']['toString'](),_0x128b('0xa4'))['field'](_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')](),_0x128b('0x63'))[_0x128b('0xa6')](_0x128b('0xa7'),'createdAt')[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5c'))[_0x128b('0x7f')]('cm_contacts')['where'](_0x128b('0xa9'))['where'](_0x128b('0xaa'),_0x4391cb['CmListId'][_0x128b('0xa8')]())[_0x128b('0x46')](_0x128b('0xab'))['where'](_0x128b('0xac'),squel[_0x128b('0x7d')]()['field'](_0x128b('0xad'))['from'](_0x128b('0xae'))['where'](_0x128b('0x84'),_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')]()))[_0x128b('0x46')](_0x128b('0xac'),squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xaf'))['from']('cm_hopper')['where'](_0x128b('0x84'),_0x5913ee['params']['id'][_0x128b('0xa8')]())))['toString']();break;case _0x128b('0xb0'):_0x30fe12=squel['insert']()[_0x128b('0x9f')]('cm_hopper')[_0x128b('0xa1')]([_0x128b('0xa5'),_0x128b('0xa2'),'ContactId',_0x128b('0xa4'),_0x128b('0x63'),_0x128b('0x5b'),_0x128b('0x5c')],squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xa5'),'phone')[_0x128b('0xa6')](_0x128b('0xa7'),'scheduledAt')[_0x128b('0xa6')]('id',_0x128b('0xa3'))[_0x128b('0xa6')](_0x4391cb[_0x128b('0xb1')][_0x128b('0xa8')](),_0x128b('0xa4'))['field'](_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')](),_0x128b('0x63'))[_0x128b('0xa6')](_0x128b('0xa7'),'createdAt')[_0x128b('0xa6')]('NOW()',_0x128b('0x5c'))['from'](_0x128b('0xb2'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x128b('0xaa'),_0x4391cb[_0x128b('0xb1')][_0x128b('0xa8')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x128b('0xac'),squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xaf'))['from'](_0x128b('0xa0'))['where'](_0x128b('0x84'),_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')]())))[_0x128b('0xa8')]();break;default:_0x30fe12=squel[_0x128b('0x9e')]()[_0x128b('0x9f')]('cm_hopper')[_0x128b('0xa1')]([_0x128b('0xa5'),_0x128b('0xa2'),_0x128b('0xa3'),'ListId',_0x128b('0x63'),_0x128b('0x5b'),_0x128b('0x5c')],squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xa5'),_0x128b('0xa5'))['field'](_0x128b('0xa7'),_0x128b('0xa2'))[_0x128b('0xa6')]('id',_0x128b('0xa3'))['field'](_0x4391cb[_0x128b('0xb1')][_0x128b('0xa8')](),_0x128b('0xa4'))[_0x128b('0xa6')](_0x5913ee[_0x128b('0x59')]['id']['toString'](),'VoiceQueueId')['field'](_0x128b('0xa7'),_0x128b('0x5b'))[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5c'))['from']('cm_contacts')[_0x128b('0x46')](_0x128b('0xa9'))[_0x128b('0x46')](_0x128b('0xaa'),_0x4391cb['CmListId'][_0x128b('0xa8')]())[_0x128b('0x46')](_0x128b('0xab')))[_0x128b('0xa8')]();}_0xac06e3[_0x128b('0x86')](db[_0x128b('0x75')][_0x128b('0x3d')](_0x30fe12));}return BPromise['all'](_0xac06e3);}})[_0x128b('0x26')](function(){return _0x588a9c;})[_0x128b('0x26')](respondWithResult(_0x621568,null))[_0x128b('0x4e')](handleError(_0x621568,null));};exports[_0x128b('0xb3')]=function(_0x209176,_0x2e8a57,_0x4f68a3){return db[_0x128b('0x37')]['find']({'where':{'id':_0x209176[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x2e8a57,null))[_0x128b('0x26')](function(_0x21540e){if(_0x21540e){return _0x21540e[_0x128b('0xb3')](_0x209176[_0x128b('0x3d')][_0x128b('0x93')]);}})[_0x128b('0x26')](function(_0x3ce20a){if(_0x3ce20a){return db[_0x128b('0x60')][_0x128b('0x27')]({'where':{'ListId':_0x209176[_0x128b('0x3d')][_0x128b('0x93')],'VoiceQueueId':_0x209176[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(){return _0x3ce20a;});}})[_0x128b('0x26')](respondWithStatusCode(_0x2e8a57,null))[_0x128b('0x4e')](handleError(_0x2e8a57,null));};exports[_0x128b('0xb4')]=function(_0x115390,_0x158fed,_0x28c3ee){var _0x5c9cb5={};var _0x308288={};var _0x2b002d;var _0x834f5f;return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x115390[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x158fed,null))[_0x128b('0x26')](function(_0x4c2b14){if(_0x4c2b14){_0x2b002d=_0x4c2b14;_0x308288[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x99')][_0x128b('0x38')]);_0x308288[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x115390[_0x128b('0x3d')]);_0x308288[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x308288[_0x128b('0x3b')],_0x308288[_0x128b('0x3d')]);_0x5c9cb5['attributes']=_['intersection'](_0x308288[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x115390['query'][_0x128b('0x40')]));_0x5c9cb5[_0x128b('0x41')]=_0x5c9cb5[_0x128b('0x41')][_0x128b('0x42')]?_0x5c9cb5[_0x128b('0x41')]:_0x308288[_0x128b('0x3b')];_0x5c9cb5[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x115390[_0x128b('0x3d')][_0x128b('0x45')]);_0x5c9cb5['where']=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x115390[_0x128b('0x3d')],_0x308288['filters']));if(_0x115390['query'][_0x128b('0x2c')]){_0x5c9cb5[_0x128b('0x46')]=_[_0x128b('0x48')](_0x5c9cb5[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x5c9cb5[_0x128b('0x41')],function(_0x16a746){var _0x297f68={};_0x297f68[_0x16a746]={'$like':'%'+_0x115390['query'][_0x128b('0x2c')]+'%'};return _0x297f68;})});}_0x5c9cb5=_['merge']({},_0x5c9cb5,_0x115390[_0x128b('0x49')]);return _0x2b002d[_0x128b('0xb4')](_0x5c9cb5);}})[_0x128b('0x26')](function(_0x499a13){if(_0x499a13){_0x834f5f=_0x499a13['length'];if(!_0x115390[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x5c9cb5[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x115390[_0x128b('0x3d')][_0x128b('0x21')]);_0x5c9cb5[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x115390[_0x128b('0x3d')]['offset']);}return _0x2b002d[_0x128b('0xb4')](_0x5c9cb5);}})[_0x128b('0x26')](function(_0x2ef2a2){if(_0x2ef2a2){return _0x2ef2a2?{'count':_0x834f5f,'rows':_0x2ef2a2}:null;}})['then'](respondWithResult(_0x158fed,null))['catch'](handleError(_0x158fed,null));};exports[_0x128b('0xb5')]=function(_0x1ee231,_0x529be3,_0x264424){var _0x5a5654,_0x424450;return db['VoiceQueue']['find']({'where':{'id':_0x1ee231[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x529be3,null))[_0x128b('0x26')](function(_0x5e9174){if(_0x5e9174){_0x424450=_0x5e9174;return _0x5e9174[_0x128b('0xb5')](_0x1ee231[_0x128b('0x51')][_0x128b('0x93')],_[_0x128b('0x5a')](_0x1ee231['body'],[_0x128b('0x93'),'id'])||{});}return null;})[_0x128b('0x94')](function(_0x38de5f){var _0x406581;_0x5a5654=_0x38de5f||[];var _0x4c8317=[];if(_0x38de5f){for(var _0xc9eee2=0x0;_0xc9eee2<_0x38de5f[_0x128b('0x42')];_0xc9eee2+=0x1){var _0xe90ffa=_0x38de5f[_0xc9eee2][_0x128b('0x52')]({'plain':!![]});_0x406581=squel[_0x128b('0x9e')]()['into'](_0x128b('0xb6'))[_0x128b('0xa1')]([_0x128b('0xa5'),'ContactId','ListId','VoiceQueueId',_0x128b('0x5b'),_0x128b('0x5c')],squel[_0x128b('0x7d')]()['field'](_0x128b('0xa5'),_0x128b('0xa5'))[_0x128b('0xa6')]('id','ContactId')[_0x128b('0xa6')](_0xe90ffa['CmListId'][_0x128b('0xa8')](),_0x128b('0xa4'))[_0x128b('0xa6')](_0x1ee231[_0x128b('0x59')]['id'][_0x128b('0xa8')](),_0x128b('0x63'))[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5b'))[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5c'))['from'](_0x128b('0xb2'))[_0x128b('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x128b('0xaa'),_0xe90ffa[_0x128b('0xb1')][_0x128b('0xa8')]())[_0x128b('0x46')](_0x128b('0xab')))[_0x128b('0xa8')]();_0x4c8317[_0x128b('0x86')](db[_0x128b('0x75')]['query'](_0x406581));}return BPromise['all'](_0x4c8317);}})['then'](function(){return _0x5a5654;})[_0x128b('0x26')](respondWithResult(_0x529be3,null))[_0x128b('0x4e')](handleError(_0x529be3,null));};exports[_0x128b('0xb7')]=function(_0x42d8d0,_0x382779,_0x5eba0f){return db[_0x128b('0x37')]['find']({'where':{'id':_0x42d8d0[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x382779,null))['then'](function(_0x511ad5){if(_0x511ad5){return _0x511ad5['removeBlackLists'](_0x42d8d0[_0x128b('0x3d')][_0x128b('0x93')]);}})[_0x128b('0x26')](function(_0x1fd096){if(_0x1fd096){return db[_0x128b('0x69')][_0x128b('0x27')]({'where':{'ListId':_0x42d8d0[_0x128b('0x3d')]['ids'],'VoiceQueueId':_0x42d8d0[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(){return _0x1fd096;});}})[_0x128b('0x26')](respondWithStatusCode(_0x382779,null))['catch'](handleError(_0x382779,null));}; \ No newline at end of file +var _0xc63b=['includeAll','include','options','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','pick','CmHopperBlack','getTeams','addTeams','teams','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','online','voicePause','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','into','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueue.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','destroy','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','findAll','rows','catch','show','params','length'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xc63b,0x1d4));var _0xbc63=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xc63b[_0x1e4150];return _0x1ce3ee;};'use strict';var pdf=require(_0xbc63('0x0'));var emlformat=require(_0xbc63('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc63('0x2'));var rp=require('request-promise');var moment=require(_0xbc63('0x3'));var BPromise=require(_0xbc63('0x4'));var Mustache=require(_0xbc63('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbc63('0x6'));var csv=require(_0xbc63('0x7'));var ejs=require(_0xbc63('0x8'));var fs=require('fs');var _=require(_0xbc63('0x9'));var squel=require('squel');var crypto=require(_0xbc63('0xa'));var jsforce=require(_0xbc63('0xb'));var deskjs=require(_0xbc63('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbc63('0xd'));var Papa=require(_0xbc63('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc63('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc63('0x10'));var logger=require(_0xbc63('0x11'))(_0xbc63('0x12'));var utils=require(_0xbc63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbc63('0x14'));var db=require(_0xbc63('0x15'))['db'];config['redis']=_['defaults'](config[_0xbc63('0x16')],{'host':_0xbc63('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc63('0x18'))['register'](socket);function respondWithStatusCode(_0x5a55f4,_0x2936ad){_0x2936ad=_0x2936ad||0xcc;return function(_0x3f35f9){if(_0x3f35f9){return _0x5a55f4['sendStatus'](_0x2936ad);}return _0x5a55f4[_0xbc63('0x19')](_0x2936ad)[_0xbc63('0x1a')]();};}function respondWithResult(_0x38004f,_0x10af19){_0x10af19=_0x10af19||0xc8;return function(_0x373ad1){if(_0x373ad1){return _0x38004f[_0xbc63('0x19')](_0x10af19)[_0xbc63('0x1b')](_0x373ad1);}};}function respondWithFilteredResult(_0x26f4ab,_0x495ccd){return function(_0xa7836){if(_0xa7836){var _0x5adc5b=_0xa7836[_0xbc63('0x1c')],_0x56a4f5=_0x495ccd[_0xbc63('0x1d')],_0x4b6d62=_0x495ccd['offset']+_0x495ccd[_0xbc63('0x1e')],_0x5bbece;if(_0x4b6d62>=_0x5adc5b){_0x4b6d62=_0x5adc5b;_0x5bbece=0xc8;}else{_0x5bbece=0xce;}_0x26f4ab[_0xbc63('0x19')](_0x5bbece);return _0x26f4ab[_0xbc63('0x1f')](_0xbc63('0x20'),_0x56a4f5+'-'+_0x4b6d62+'/'+_0x5adc5b)[_0xbc63('0x1b')](_0xa7836);}return null;};}function patchUpdates(_0x2dfa02){return function(_0x40acba){try{jsonpatch[_0xbc63('0x21')](_0x40acba,_0x2dfa02,!![]);}catch(_0x269d79){return BPromise[_0xbc63('0x22')](_0x269d79);}return _0x40acba['save']();};}function saveUpdates(_0x53f935,_0x2eb533){return function(_0x390601){if(_0x390601){return _0x390601[_0xbc63('0x23')](_0x53f935)[_0xbc63('0x24')](function(_0x391c3d){return _0x391c3d;});}return null;};}function removeEntity(_0xf0349e,_0x2b5e17){return function(_0x1aa1f6){if(_0x1aa1f6){return _0x1aa1f6['destroy']()['then'](function(){var _0x2224f1=_0x1aa1f6[_0xbc63('0x25')]({'plain':!![]});var _0x5d61df=[{'name':_0xbc63('0x26'),'value':_0xbc63('0x27'),'ignore':![]},{'name':_0xbc63('0x28'),'value':_0xbc63('0x29'),'ignore':![]}];var _0x34c2e7=_(_0x5d61df)[_0xbc63('0x2a')](_0xbc63('0x2b'))[_0xbc63('0x2c')](_0xbc63('0x2d'))[_0xbc63('0x2d')]();if(_[_0xbc63('0x2e')](_0x34c2e7,_0x2224f1[_0xbc63('0x2f')])){return;}var _0x4a09d5=_['find'](_0x5d61df,[_0xbc63('0x2d'),_0x2224f1['type']])[_0xbc63('0x30')];return db['UserProfileResource'][_0xbc63('0x31')]({'where':{'type':_0x4a09d5,'resourceId':_0x2224f1['id']}})[_0xbc63('0x24')](function(){return _0x1aa1f6;});})['then'](function(){_0xf0349e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39060e,_0x5c6b8a){return function(_0x5bc11f){if(!_0x5bc11f){_0x39060e[_0xbc63('0x32')](0x194);}return _0x5bc11f;};}function handleError(_0x4eeb72,_0x42eb23){_0x42eb23=_0x42eb23||0x1f4;return function(_0x50b864){logger[_0xbc63('0x33')](_0x50b864[_0xbc63('0x34')]);if(_0x50b864[_0xbc63('0x30')]){delete _0x50b864[_0xbc63('0x30')];}_0x4eeb72['status'](_0x42eb23)[_0xbc63('0x35')](_0x50b864);};}exports[_0xbc63('0x36')]=function(_0x28082a,_0xd47054){var _0x1c9974={},_0x141dfc={},_0x4f4355={'count':0x0,'rows':[]};var _0xe0ef66=_[_0xbc63('0x2c')](db[_0xbc63('0x37')][_0xbc63('0x38')],function(_0x4ded91){return{'name':_0x4ded91['fieldName'],'type':_0x4ded91[_0xbc63('0x2f')][_0xbc63('0x39')]};});_0x141dfc[_0xbc63('0x3a')]=_[_0xbc63('0x2c')](_0xe0ef66,_0xbc63('0x30'));_0x141dfc[_0xbc63('0x3b')]=_[_0xbc63('0x3c')](_0x28082a['query']);_0x141dfc[_0xbc63('0x3d')]=_[_0xbc63('0x3e')](_0x141dfc['model'],_0x141dfc[_0xbc63('0x3b')]);_0x1c9974['attributes']=_[_0xbc63('0x3e')](_0x141dfc[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x28082a[_0xbc63('0x3b')]['fields']));_0x1c9974[_0xbc63('0x40')]=_0x1c9974[_0xbc63('0x40')]['length']?_0x1c9974[_0xbc63('0x40')]:_0x141dfc[_0xbc63('0x3a')];if(!_0x28082a[_0xbc63('0x3b')][_0xbc63('0x41')](_0xbc63('0x42'))){_0x1c9974[_0xbc63('0x1e')]=qs[_0xbc63('0x1e')](_0x28082a[_0xbc63('0x3b')][_0xbc63('0x1e')]);_0x1c9974[_0xbc63('0x1d')]=qs[_0xbc63('0x1d')](_0x28082a['query'][_0xbc63('0x1d')]);}_0x1c9974[_0xbc63('0x43')]=qs['sort'](_0x28082a[_0xbc63('0x3b')][_0xbc63('0x44')]);_0x1c9974[_0xbc63('0x45')]=qs[_0xbc63('0x3d')](_['pick'](_0x28082a[_0xbc63('0x3b')],_0x141dfc[_0xbc63('0x3d')]),_0xe0ef66);if(_0x28082a[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0x1c9974[_0xbc63('0x45')]=_[_0xbc63('0x46')](_0x1c9974[_0xbc63('0x45')],{'$or':_[_0xbc63('0x2c')](_0xe0ef66,function(_0x355c95){if(_0x355c95[_0xbc63('0x2f')]!==_0xbc63('0x47')){var _0x2b3010={};_0x2b3010[_0x355c95[_0xbc63('0x30')]]={'$like':'%'+_0x28082a[_0xbc63('0x3b')][_0xbc63('0x2a')]+'%'};return _0x2b3010;}})});}_0x1c9974=_['merge']({},_0x1c9974,_0x28082a['options']);var _0xd0fc43={'where':_0x1c9974[_0xbc63('0x45')]};return db[_0xbc63('0x37')][_0xbc63('0x1c')](_0xd0fc43)[_0xbc63('0x24')](function(_0x201a1a){_0x4f4355[_0xbc63('0x1c')]=_0x201a1a;if(_0x28082a['query']['includeAll']){_0x1c9974['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xbc63('0x48')](_0x1c9974);})[_0xbc63('0x24')](function(_0x58c659){_0x4f4355[_0xbc63('0x49')]=_0x58c659;return _0x4f4355;})[_0xbc63('0x24')](respondWithFilteredResult(_0xd47054,_0x1c9974))[_0xbc63('0x4a')](handleError(_0xd47054,null));};exports[_0xbc63('0x4b')]=function(_0x1464fd,_0x5d4c38){var _0x1166e4={'raw':![],'where':{'id':_0x1464fd[_0xbc63('0x4c')]['id']}},_0x529b6f={};_0x529b6f['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0x529b6f[_0xbc63('0x3b')]=_['keys'](_0x1464fd['query']);_0x529b6f['filters']=_[_0xbc63('0x3e')](_0x529b6f[_0xbc63('0x3a')],_0x529b6f[_0xbc63('0x3b')]);_0x1166e4[_0xbc63('0x40')]=_[_0xbc63('0x3e')](_0x529b6f[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x1464fd[_0xbc63('0x3b')][_0xbc63('0x3f')]));_0x1166e4[_0xbc63('0x40')]=_0x1166e4[_0xbc63('0x40')][_0xbc63('0x4d')]?_0x1166e4[_0xbc63('0x40')]:_0x529b6f[_0xbc63('0x3a')];if(_0x1464fd[_0xbc63('0x3b')][_0xbc63('0x4e')]){_0x1166e4[_0xbc63('0x4f')]=[{'all':!![]}];}_0x1166e4=_[_0xbc63('0x46')]({},_0x1166e4,_0x1464fd[_0xbc63('0x50')]);return db['VoiceQueue'][_0xbc63('0x51')](_0x1166e4)[_0xbc63('0x24')](handleEntityNotFound(_0x5d4c38,null))[_0xbc63('0x24')](respondWithResult(_0x5d4c38,null))[_0xbc63('0x4a')](handleError(_0x5d4c38,null));};exports['create']=function(_0x4b2d2f,_0x1cc9b2){return db[_0xbc63('0x37')][_0xbc63('0x52')](_0x4b2d2f['body'],{})['then'](function(_0x39cb19){var _0x571985=_0x4b2d2f[_0xbc63('0x53')][_0xbc63('0x25')]({'plain':!![]});if(!_0x571985)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x571985[_0xbc63('0x54')]===_0xbc63('0x53')){var _0x3a6836=_0x39cb19['get']({'plain':!![]});var _0x782492=[{'name':_0xbc63('0x26'),'value':_0xbc63('0x27')},{'name':_0xbc63('0x28'),'value':_0xbc63('0x29')}];var _0x463dcd=_[_0xbc63('0x51')](_0x782492,['value',_0x3a6836[_0xbc63('0x2f')]])[_0xbc63('0x30')];return db['UserProfileSection'][_0xbc63('0x51')]({'where':{'name':_0x463dcd,'userProfileId':_0x571985[_0xbc63('0x55')]},'raw':!![]})['then'](function(_0x52f36b){if(_0x52f36b&&_0x52f36b[_0xbc63('0x56')]===0x0){return db[_0xbc63('0x57')]['create']({'name':_0x3a6836['name'],'resourceId':_0x3a6836['id'],'type':_0x52f36b[_0xbc63('0x30')],'sectionId':_0x52f36b['id']},{})[_0xbc63('0x24')](function(){return _0x39cb19;});}else{return _0x39cb19;}})[_0xbc63('0x4a')](function(_0x185e36){logger[_0xbc63('0x33')](_0xbc63('0x58'),_0x185e36);throw _0x185e36;});}return _0x39cb19;})[_0xbc63('0x24')](respondWithResult(_0x1cc9b2,0xc9))[_0xbc63('0x4a')](handleError(_0x1cc9b2,null));};exports[_0xbc63('0x59')]=function(_0xbc9459,_0x93c455){var _0x36bb53={'where':{'id':_0xbc9459[_0xbc63('0x4c')]['id']}},_0x229dc6={};_0x229dc6[_0xbc63('0x3a')]=_['keys'](db[_0xbc63('0x37')][_0xbc63('0x38')]);_0x36bb53['attributes']=_[_0xbc63('0x3e')](_0x229dc6[_0xbc63('0x3a')],qs['fields'](_0xbc9459['query'][_0xbc63('0x3f')]));_0x36bb53['attributes']=_0x36bb53['attributes']['length']?_0x36bb53[_0xbc63('0x40')]:_0x229dc6[_0xbc63('0x3a')];if(_0xbc9459[_0xbc63('0x3b')][_0xbc63('0x4e')]){_0x36bb53[_0xbc63('0x4f')]=[{'all':!![]}];}_0x36bb53=_[_0xbc63('0x46')]({},_0x36bb53,_0xbc9459[_0xbc63('0x50')]);return db[_0xbc63('0x37')][_0xbc63('0x51')](_0x36bb53)['then'](handleEntityNotFound(_0x93c455,null))[_0xbc63('0x24')](function(_0x117979){if(_0x117979){var _0x5dca47=_0x117979[_0xbc63('0x25')]({'plain':!![]});_0x5dca47=qs[_0xbc63('0x5a')](_0x5dca47,['id',_0xbc63('0x5b'),'updatedAt']);_0xbc9459[_0xbc63('0x5c')]=_[_0xbc63('0x5a')](_0xbc9459[_0xbc63('0x5c')],['id',_0xbc63('0x5b'),_0xbc63('0x5d')]);return db['VoiceQueue'][_0xbc63('0x52')](_[_0xbc63('0x46')](_0x5dca47,_0xbc9459[_0xbc63('0x5c')]),{'include':_0xbc9459['query'][_0xbc63('0x4e')]?[{'all':!![]}]:undefined})[_0xbc63('0x24')](function(_0x30930f){var _0x118a63=_0xbc9459['user']['get']({'plain':!![]});if(!_0x118a63)throw new Error(_0xbc63('0x5e'));if(_0x118a63[_0xbc63('0x54')]===_0xbc63('0x53')){var _0x477724=_0x30930f[_0xbc63('0x25')]({'plain':!![]});var _0x284fc5=[{'name':_0xbc63('0x26'),'value':'inbound'},{'name':_0xbc63('0x28'),'value':_0xbc63('0x29')}];var _0x2ae7a9=_[_0xbc63('0x51')](_0x284fc5,[_0xbc63('0x2d'),_0x477724[_0xbc63('0x2f')]])['name'];return db[_0xbc63('0x5f')][_0xbc63('0x51')]({'where':{'name':_0x2ae7a9,'userProfileId':_0x118a63[_0xbc63('0x55')]},'raw':!![]})[_0xbc63('0x24')](function(_0x18e2ff){if(_0x18e2ff&&_0x18e2ff[_0xbc63('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x477724['name'],'resourceId':_0x477724['id'],'type':_0x18e2ff[_0xbc63('0x30')],'sectionId':_0x18e2ff['id']},{})[_0xbc63('0x24')](function(){return _0x30930f;});}else{return _0x30930f;}})['catch'](function(_0x201c5c){logger[_0xbc63('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x201c5c);throw _0x201c5c;});}return _0x30930f;});}})[_0xbc63('0x24')](respondWithResult(_0x93c455,0xc9))[_0xbc63('0x4a')](handleError(_0x93c455,null));};exports['update']=function(_0x1d627b,_0x26c64d){if(_0x1d627b[_0xbc63('0x5c')]['id']){delete _0x1d627b['body']['id'];}return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x1d627b[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x26c64d,null))[_0xbc63('0x24')](saveUpdates(_0x1d627b[_0xbc63('0x5c')],null))[_0xbc63('0x24')](respondWithResult(_0x26c64d,null))[_0xbc63('0x4a')](handleError(_0x26c64d,null));};exports[_0xbc63('0x31')]=function(_0x17d5c9,_0x50b04a){return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x17d5c9['params']['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x50b04a,null))[_0xbc63('0x24')](removeEntity(_0x50b04a,null))[_0xbc63('0x4a')](handleError(_0x50b04a,null));};exports[_0xbc63('0x60')]=function(_0x4f2b82,_0xd6f919,_0x2ed27e){var _0x1fcf10={'raw':![],'where':{}};var _0x10e8a4={};var _0x2fd49e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbc63('0x61')]({'where':{'id':_0x4f2b82[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0xd6f919,null))[_0xbc63('0x24')](function(_0x1fdef1){if(_0x1fdef1){_0x10e8a4[_0xbc63('0x3a')]=_[_0xbc63('0x3c')](db[_0xbc63('0x62')][_0xbc63('0x38')]);_0x10e8a4[_0xbc63('0x3b')]=_[_0xbc63('0x3c')](_0x4f2b82['query']);_0x10e8a4[_0xbc63('0x3d')]=_[_0xbc63('0x3e')](_0x10e8a4[_0xbc63('0x3a')],_0x10e8a4['query']);_0x1fcf10['attributes']=_[_0xbc63('0x3e')](_0x10e8a4[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x4f2b82[_0xbc63('0x3b')][_0xbc63('0x3f')]));_0x1fcf10[_0xbc63('0x40')]=_0x1fcf10['attributes'][_0xbc63('0x4d')]?_0x1fcf10['attributes']:_0x10e8a4[_0xbc63('0x3a')];if(!_0x4f2b82[_0xbc63('0x3b')][_0xbc63('0x41')](_0xbc63('0x42'))){_0x1fcf10['limit']=qs[_0xbc63('0x1e')](_0x4f2b82[_0xbc63('0x3b')][_0xbc63('0x1e')]);_0x1fcf10[_0xbc63('0x1d')]=qs['offset'](_0x4f2b82['query']['offset']);}_0x1fcf10[_0xbc63('0x43')]=qs[_0xbc63('0x44')](_0x4f2b82['query']['sort']);_0x1fcf10['where']=qs['filters'](_['pick'](_0x4f2b82['query'],_0x10e8a4['filters']));_0x1fcf10['where'][_0xbc63('0x63')]=_0x1fdef1['id'];if(_0x4f2b82[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0x1fcf10[_0xbc63('0x45')]=_['merge'](_0x1fcf10[_0xbc63('0x45')],{'$or':_['map'](_0x1fcf10['attributes'],function(_0x88bb80){var _0xffefd6={};_0xffefd6[_0x88bb80]={'$like':'%'+_0x4f2b82[_0xbc63('0x3b')][_0xbc63('0x2a')]+'%'};return _0xffefd6;})});}_0x1fcf10=_[_0xbc63('0x46')]({},_0x1fcf10,_0x4f2b82[_0xbc63('0x50')]);return db['CmHopper'][_0xbc63('0x1c')]({'where':_0x1fcf10[_0xbc63('0x45')]})['then'](function(_0x59d75f){_0x2fd49e['count']=_0x59d75f;if(_0x4f2b82[_0xbc63('0x3b')]['includeAll']){_0x1fcf10[_0xbc63('0x4f')]=[{'all':!![]}];}return db[_0xbc63('0x62')][_0xbc63('0x48')](_0x1fcf10);})[_0xbc63('0x24')](function(_0x2eadc2){_0x2fd49e[_0xbc63('0x49')]=_0x2eadc2;return _0x2fd49e;});}})['then'](respondWithFilteredResult(_0xd6f919,_0x1fcf10))['catch'](handleError(_0xd6f919,null));};exports['getHopperHistories']=function(_0x9a4361,_0x1b699f,_0x49feeb){var _0x5bef5c={'raw':!![],'where':{}};var _0x5cc26a={};var _0x338c4a={'count':0x0,'rows':[]};return db[_0xbc63('0x37')][_0xbc63('0x61')]({'where':{'id':_0x9a4361['params']['id']}})['then'](handleEntityNotFound(_0x1b699f,null))[_0xbc63('0x24')](function(_0x123c38){if(_0x123c38){_0x5cc26a['model']=_['keys'](db['CmHopperHistory'][_0xbc63('0x38')]);_0x5cc26a['query']=_[_0xbc63('0x3c')](_0x9a4361['query']);_0x5cc26a[_0xbc63('0x3d')]=_[_0xbc63('0x3e')](_0x5cc26a[_0xbc63('0x3a')],_0x5cc26a[_0xbc63('0x3b')]);_0x5bef5c[_0xbc63('0x40')]=_[_0xbc63('0x3e')](_0x5cc26a[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x9a4361['query'][_0xbc63('0x3f')]));_0x5bef5c['attributes']=_0x5bef5c['attributes']['length']?_0x5bef5c[_0xbc63('0x40')]:_0x5cc26a[_0xbc63('0x3a')];if(!_0x9a4361[_0xbc63('0x3b')]['hasOwnProperty'](_0xbc63('0x42'))){_0x5bef5c[_0xbc63('0x1e')]=qs[_0xbc63('0x1e')](_0x9a4361[_0xbc63('0x3b')]['limit']);_0x5bef5c[_0xbc63('0x1d')]=qs[_0xbc63('0x1d')](_0x9a4361[_0xbc63('0x3b')][_0xbc63('0x1d')]);}_0x5bef5c[_0xbc63('0x43')]=qs['sort'](_0x9a4361[_0xbc63('0x3b')][_0xbc63('0x44')]);_0x5bef5c[_0xbc63('0x45')]=qs['filters'](_['pick'](_0x9a4361[_0xbc63('0x3b')],_0x5cc26a['filters']));_0x5bef5c[_0xbc63('0x45')][_0xbc63('0x63')]=_0x123c38['id'];if(_0x9a4361[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0x5bef5c[_0xbc63('0x45')]=_[_0xbc63('0x46')](_0x5bef5c['where'],{'$or':_[_0xbc63('0x2c')](_0x5bef5c[_0xbc63('0x40')],function(_0x1e16d0){var _0x507f97={};_0x507f97[_0x1e16d0]={'$like':'%'+_0x9a4361[_0xbc63('0x3b')][_0xbc63('0x2a')]+'%'};return _0x507f97;})});}_0x5bef5c=_[_0xbc63('0x46')]({},_0x5bef5c,_0x9a4361[_0xbc63('0x50')]);return db[_0xbc63('0x64')][_0xbc63('0x1c')]({'where':_0x5bef5c['where']})['then'](function(_0x35876c){_0x338c4a[_0xbc63('0x1c')]=_0x35876c;if(_0x9a4361[_0xbc63('0x3b')]['includeAll']){_0x5bef5c['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xbc63('0x48')](_0x5bef5c);})['then'](function(_0x12f869){_0x338c4a[_0xbc63('0x49')]=_0x12f869;return _0x338c4a;});}})[_0xbc63('0x24')](respondWithFilteredResult(_0x1b699f,_0x5bef5c))['catch'](handleError(_0x1b699f,null));};exports[_0xbc63('0x65')]=function(_0x50c952,_0x507ee1,_0x5bf23f){var _0x285c29={'raw':!![],'where':{}};var _0x54be2a={};var _0x5a01d2={'count':0x0,'rows':[]};return db[_0xbc63('0x37')][_0xbc63('0x61')]({'where':{'id':_0x50c952[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x507ee1,null))[_0xbc63('0x24')](function(_0x53bd07){if(_0x53bd07){_0x54be2a[_0xbc63('0x3a')]=_['keys'](db[_0xbc63('0x66')][_0xbc63('0x38')]);_0x54be2a['query']=_[_0xbc63('0x3c')](_0x50c952[_0xbc63('0x3b')]);_0x54be2a['filters']=_[_0xbc63('0x3e')](_0x54be2a[_0xbc63('0x3a')],_0x54be2a[_0xbc63('0x3b')]);_0x285c29['attributes']=_[_0xbc63('0x3e')](_0x54be2a['model'],qs[_0xbc63('0x3f')](_0x50c952[_0xbc63('0x3b')][_0xbc63('0x3f')]));_0x285c29['attributes']=_0x285c29[_0xbc63('0x40')][_0xbc63('0x4d')]?_0x285c29[_0xbc63('0x40')]:_0x54be2a[_0xbc63('0x3a')];if(!_0x50c952[_0xbc63('0x3b')]['hasOwnProperty'](_0xbc63('0x42'))){_0x285c29[_0xbc63('0x1e')]=qs['limit'](_0x50c952[_0xbc63('0x3b')]['limit']);_0x285c29[_0xbc63('0x1d')]=qs[_0xbc63('0x1d')](_0x50c952[_0xbc63('0x3b')][_0xbc63('0x1d')]);}_0x285c29[_0xbc63('0x43')]=qs[_0xbc63('0x44')](_0x50c952[_0xbc63('0x3b')][_0xbc63('0x44')]);_0x285c29[_0xbc63('0x45')]=qs[_0xbc63('0x3d')](_['pick'](_0x50c952[_0xbc63('0x3b')],_0x54be2a['filters']));_0x285c29[_0xbc63('0x45')]['VoiceQueueId']=_0x53bd07['id'];if(_0x50c952[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0x285c29[_0xbc63('0x45')]=_[_0xbc63('0x46')](_0x285c29[_0xbc63('0x45')],{'$or':_[_0xbc63('0x2c')](_0x285c29[_0xbc63('0x40')],function(_0x2945f8){var _0x2161e4={};_0x2161e4[_0x2945f8]={'$like':'%'+_0x50c952['query'][_0xbc63('0x2a')]+'%'};return _0x2161e4;})});}_0x285c29=_[_0xbc63('0x46')]({},_0x285c29,_0x50c952['options']);return db[_0xbc63('0x66')][_0xbc63('0x1c')]({'where':_0x285c29[_0xbc63('0x45')]})['then'](function(_0x470210){_0x5a01d2['count']=_0x470210;if(_0x50c952[_0xbc63('0x3b')][_0xbc63('0x4e')]){_0x285c29[_0xbc63('0x4f')]=[{'all':!![]}];}return db[_0xbc63('0x66')][_0xbc63('0x48')](_0x285c29);})[_0xbc63('0x24')](function(_0x182b56){_0x5a01d2[_0xbc63('0x49')]=_0x182b56;return _0x5a01d2;});}})[_0xbc63('0x24')](respondWithFilteredResult(_0x507ee1,_0x285c29))['catch'](handleError(_0x507ee1,null));};exports[_0xbc63('0x67')]=function(_0x39df3b,_0x9857ec,_0x8170a){var _0x36e91b={'raw':!![],'where':{}};var _0x4bb8ef={};var _0x958ea={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbc63('0x61')]({'where':{'id':_0x39df3b[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x9857ec,null))[_0xbc63('0x24')](function(_0x4bbab2){if(_0x4bbab2){_0x4bb8ef[_0xbc63('0x3a')]=_[_0xbc63('0x3c')](db['CmHopperBlack'][_0xbc63('0x38')]);_0x4bb8ef[_0xbc63('0x3b')]=_[_0xbc63('0x3c')](_0x39df3b[_0xbc63('0x3b')]);_0x4bb8ef[_0xbc63('0x3d')]=_['intersection'](_0x4bb8ef[_0xbc63('0x3a')],_0x4bb8ef['query']);_0x36e91b[_0xbc63('0x40')]=_[_0xbc63('0x3e')](_0x4bb8ef[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x39df3b[_0xbc63('0x3b')]['fields']));_0x36e91b[_0xbc63('0x40')]=_0x36e91b[_0xbc63('0x40')][_0xbc63('0x4d')]?_0x36e91b['attributes']:_0x4bb8ef['model'];if(!_0x39df3b[_0xbc63('0x3b')][_0xbc63('0x41')]('nolimit')){_0x36e91b[_0xbc63('0x1e')]=qs[_0xbc63('0x1e')](_0x39df3b['query'][_0xbc63('0x1e')]);_0x36e91b[_0xbc63('0x1d')]=qs[_0xbc63('0x1d')](_0x39df3b['query']['offset']);}_0x36e91b['order']=qs[_0xbc63('0x44')](_0x39df3b['query']['sort']);_0x36e91b[_0xbc63('0x45')]=qs[_0xbc63('0x3d')](_[_0xbc63('0x68')](_0x39df3b[_0xbc63('0x3b')],_0x4bb8ef[_0xbc63('0x3d')]));_0x36e91b[_0xbc63('0x45')][_0xbc63('0x63')]=_0x4bbab2['id'];if(_0x39df3b['query']['filter']){_0x36e91b[_0xbc63('0x45')]=_['merge'](_0x36e91b[_0xbc63('0x45')],{'$or':_['map'](_0x36e91b['attributes'],function(_0x32e523){var _0x2c20b8={};_0x2c20b8[_0x32e523]={'$like':'%'+_0x39df3b['query'][_0xbc63('0x2a')]+'%'};return _0x2c20b8;})});}_0x36e91b=_[_0xbc63('0x46')]({},_0x36e91b,_0x39df3b[_0xbc63('0x50')]);return db[_0xbc63('0x69')][_0xbc63('0x1c')]({'where':_0x36e91b['where']})[_0xbc63('0x24')](function(_0x4b1fb8){_0x958ea[_0xbc63('0x1c')]=_0x4b1fb8;if(_0x39df3b[_0xbc63('0x3b')][_0xbc63('0x4e')]){_0x36e91b[_0xbc63('0x4f')]=[{'all':!![]}];}return db[_0xbc63('0x69')][_0xbc63('0x48')](_0x36e91b);})[_0xbc63('0x24')](function(_0x14c595){_0x958ea[_0xbc63('0x49')]=_0x14c595;return _0x958ea;});}})[_0xbc63('0x24')](respondWithFilteredResult(_0x9857ec,_0x36e91b))[_0xbc63('0x4a')](handleError(_0x9857ec,null));};exports['getTeams']=function(_0x326041,_0x440011,_0x34ce32){var _0x2022e8={};var _0x11588b={};var _0x409ef5;var _0x18fdfc;return db[_0xbc63('0x37')]['findOne']({'where':{'id':_0x326041[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x440011,null))['then'](function(_0x34ec99){if(_0x34ec99){_0x409ef5=_0x34ec99;_0x11588b[_0xbc63('0x3a')]=_[_0xbc63('0x3c')](db['Team']['rawAttributes']);_0x11588b[_0xbc63('0x3b')]=_[_0xbc63('0x3c')](_0x326041[_0xbc63('0x3b')]);_0x11588b[_0xbc63('0x3d')]=_[_0xbc63('0x3e')](_0x11588b[_0xbc63('0x3a')],_0x11588b[_0xbc63('0x3b')]);_0x2022e8[_0xbc63('0x40')]=_[_0xbc63('0x3e')](_0x11588b[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x326041[_0xbc63('0x3b')]['fields']));_0x2022e8[_0xbc63('0x40')]=_0x2022e8[_0xbc63('0x40')][_0xbc63('0x4d')]?_0x2022e8[_0xbc63('0x40')]:_0x11588b[_0xbc63('0x3a')];_0x2022e8[_0xbc63('0x43')]=qs[_0xbc63('0x44')](_0x326041['query'][_0xbc63('0x44')]);_0x2022e8['where']=qs[_0xbc63('0x3d')](_['pick'](_0x326041[_0xbc63('0x3b')],_0x11588b[_0xbc63('0x3d')]));if(_0x326041[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0x2022e8[_0xbc63('0x45')]=_[_0xbc63('0x46')](_0x2022e8[_0xbc63('0x45')],{'$or':_[_0xbc63('0x2c')](_0x2022e8[_0xbc63('0x40')],function(_0x3783c5){var _0x3a6e8c={};_0x3a6e8c[_0x3783c5]={'$like':'%'+_0x326041[_0xbc63('0x3b')][_0xbc63('0x2a')]+'%'};return _0x3a6e8c;})});}_0x2022e8=_[_0xbc63('0x46')]({},_0x2022e8,_0x326041[_0xbc63('0x50')]);return _0x409ef5[_0xbc63('0x6a')](_0x2022e8);}})[_0xbc63('0x24')](function(_0x18ad96){if(_0x18ad96){_0x18fdfc=_0x18ad96[_0xbc63('0x4d')];if(!_0x326041[_0xbc63('0x3b')][_0xbc63('0x41')](_0xbc63('0x42'))){_0x2022e8['limit']=qs['limit'](_0x326041[_0xbc63('0x3b')][_0xbc63('0x1e')]);_0x2022e8['offset']=qs['offset'](_0x326041[_0xbc63('0x3b')][_0xbc63('0x1d')]);}return _0x409ef5[_0xbc63('0x6a')](_0x2022e8);}})['then'](function(_0x445c0e){if(_0x445c0e){return _0x445c0e?{'count':_0x18fdfc,'rows':_0x445c0e}:null;}})[_0xbc63('0x24')](respondWithResult(_0x440011,null))[_0xbc63('0x4a')](handleError(_0x440011,null));};exports[_0xbc63('0x6b')]=function(_0x4b4d49,_0x431c69,_0x2f2a13){var _0x51db74=_0x4b4d49[_0xbc63('0x5c')][_0xbc63('0x6c')];var _0x344a0a=_[_0xbc63('0x2c')](_0x51db74,'id');return db['Team'][_0xbc63('0x48')]({'where':{'id':_0x344a0a},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbc63('0x6d'),'attributes':['id',_0xbc63('0x30'),'online','voicePause',_0xbc63('0x6e')],'raw':!![]}]})[_0xbc63('0x24')](function(_0x4df130){if(_0x4df130){var _0x48f0b6=_[_0xbc63('0x6f')](_0x4df130,function(_0x21a0fb){var _0x3d5415=_0x21a0fb['get']({'plain':!![]});_0x3d5415[_0xbc63('0x6d')][_0xbc63('0x70')](function(_0x1eee30){_0x1eee30[_0xbc63('0x71')]=_['find'](_0x51db74,{'id':_0x3d5415['id']})[_0xbc63('0x71')];});return _0x3d5415[_0xbc63('0x6d')];});return db['VoiceQueue']['find']({'where':{'id':_0x4b4d49[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](function(_0x58b693){return db[_0xbc63('0x72')][_0xbc63('0x73')](function(_0x4d0a78){return _0x58b693[_0xbc63('0x6b')](_0x344a0a,{'transaction':_0x4d0a78})[_0xbc63('0x24')](function(){return BPromise[_0xbc63('0x74')](_0x48f0b6,function(_0xa49ba7){return db[_0xbc63('0x75')][_0xbc63('0x76')]({'where':{'UserId':_0xa49ba7['id'],'VoiceQueueId':_0x4b4d49[_0xbc63('0x4c')]['id']},'defaults':{'penalty':_0xa49ba7[_0xbc63('0x71')]},'transaction':_0x4d0a78});});})[_0xbc63('0x24')](function(){return BPromise[_0xbc63('0x74')](_['filter'](_0x48f0b6,{'online':!![]}),function(_0xe6e9b6){return db[_0xbc63('0x77')][_0xbc63('0x78')]({'membername':_0xe6e9b6['name'],'UserId':_0xe6e9b6['id'],'queue_name':_0x58b693[_0xbc63('0x30')],'VoiceQueueId':_0x58b693['id'],'interface':_[_0xbc63('0x79')](_0xe6e9b6[_0xbc63('0x6e')])?util[_0xbc63('0x7a')](_0xbc63('0x7b'),_0xe6e9b6[_0xbc63('0x30')]):_0xe6e9b6[_0xbc63('0x6e')],'paused':_0xe6e9b6['voicePause']||![],'penalty':_0xe6e9b6[_0xbc63('0x71')]},{'transaction':_0x4d0a78});});})[_0xbc63('0x24')](function(){_0x48f0b6[_0xbc63('0x70')](function(_0x33bed8){socket[_0xbc63('0x7c')](_0xbc63('0x7d'),{'UserId':_0x33bed8['id'],'VoiceQueueId':_0x58b693['id']});});});});});}})[_0xbc63('0x24')](respondWithStatusCode(_0x431c69,null))[_0xbc63('0x4a')](handleError(_0x431c69,null));};exports[_0xbc63('0x7e')]=function(_0x3307ab,_0x345ddb,_0x4557bb){return db['Team'][_0xbc63('0x48')]({'where':{'id':_0x3307ab['query'][_0xbc63('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xbc63('0x80')],'as':_0xbc63('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xbc63('0x24')](handleEntityNotFound(_0x345ddb,null))[_0xbc63('0x24')](function(_0x24e7c5){var _0x398224=_['map'](_0x24e7c5,'id');var _0x3672d9=[];var _0x267119=[];var _0x124fc6=squel[_0xbc63('0x81')]();_0x124fc6[_0xbc63('0x82')](_0xbc63('0x83'))[_0xbc63('0x84')](_0xbc63('0x85'),'tq')[_0xbc63('0x86')](_0xbc63('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoiceQueueId\x20=\x20?',_0x3307ab['params']['id']);for(var _0x2615d7=0x0;_0x2615d7<_0x24e7c5[_0xbc63('0x4d')];_0x2615d7+=0x1){let _0x50734c=_0x24e7c5[_0x2615d7];for(var _0x7e6d5a=0x0;_0x7e6d5a<_0x50734c[_0xbc63('0x6d')][_0xbc63('0x4d')];_0x7e6d5a+=0x1){let _0x36c495=_0x50734c[_0xbc63('0x6d')][_0x7e6d5a];var _0x3b6c87=_0x124fc6[_0xbc63('0x59')]();_0x3b6c87['where'](_0xbc63('0x88'),_0x36c495['id']);_0x267119[_0xbc63('0x89')](db[_0xbc63('0x72')][_0xbc63('0x3b')](_0x3b6c87[_0xbc63('0x8a')](),{'type':db[_0xbc63('0x72')][_0xbc63('0x8b')][_0xbc63('0x8c')]})['then'](function(_0xe62ba8){if(_0xe62ba8[_0xbc63('0x4d')]===0x1){return _0x36c495['id'];}else{var _0x549199=_['every'](_[_0xbc63('0x2c')](_0xe62ba8,_0xbc63('0x8d')),function(_0x2397bd){return _[_0xbc63('0x2e')](_0x398224,_0x2397bd);});if(_0x549199){return _0x36c495['id'];}}}));}}return BPromise[_0xbc63('0x8e')](_0x267119)[_0xbc63('0x24')](function(_0xda4ecf){_0x3672d9=_(_0x3672d9)[_0xbc63('0x8f')](_0xda4ecf)[_0xbc63('0x90')]()[_0xbc63('0x2d')]();return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x3307ab[_0xbc63('0x4c')]['id']}})['then'](function(_0x542787){return db[_0xbc63('0x72')][_0xbc63('0x73')](function(_0x5440a0){return _0x542787[_0xbc63('0x7e')](_0x3307ab['query'][_0xbc63('0x7f')],{'transaction':_0x5440a0})[_0xbc63('0x24')](function(){if(!_[_0xbc63('0x91')](_0x3672d9)){return _0x542787[_0xbc63('0x92')](_0x3672d9,{'transaction':_0x5440a0})[_0xbc63('0x24')](function(){return db[_0xbc63('0x77')][_0xbc63('0x31')]({'where':{'VoiceQueueId':_0x3307ab[_0xbc63('0x4c')]['id'],'UserId':_0x3672d9},'transaction':_0x5440a0});});}})[_0xbc63('0x24')](function(){_0x3672d9[_0xbc63('0x70')](function(_0x1be208){socket[_0xbc63('0x7c')](_0xbc63('0x93'),{'UserId':_0x1be208,'VoiceQueueId':_0x542787['id']});});});});});});})['then'](respondWithStatusCode(_0x345ddb,null))['catch'](handleError(_0x345ddb,null));};exports[_0xbc63('0x94')]=function(_0x47af3d,_0xfc570b,_0x66ea53){var _0x2a4664,_0x1c8ff7;return db[_0xbc63('0x37')]['find']({'where':{'id':_0x47af3d[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0xfc570b,null))[_0xbc63('0x24')](function(_0x47769b){if(_0x47769b){_0x1c8ff7=_0x47769b;return _0x47769b[_0xbc63('0x94')](_0x47af3d[_0xbc63('0x5c')][_0xbc63('0x7f')],_[_0xbc63('0x5a')](_0x47af3d[_0xbc63('0x5c')],[_0xbc63('0x7f'),'id'])||{})['spread'](function(_0x40c307){for(var _0x556647=0x0;_0x556647<_0x47af3d[_0xbc63('0x5c')][_0xbc63('0x7f')]['length'];_0x556647+=0x1){socket[_0xbc63('0x7c')](_0xbc63('0x7d'),{'UserId':_0x47af3d['body'][_0xbc63('0x7f')][_0x556647],'VoiceQueueId':_0x47af3d[_0xbc63('0x4c')]['id']});}return _0x40c307;});}})[_0xbc63('0x24')](function(_0x138eaa){_0x2a4664=_0x138eaa||[];if(_0x1c8ff7){return db[_0xbc63('0x80')][_0xbc63('0x48')]({'where':{'id':_0x47af3d[_0xbc63('0x5c')]['ids']},'attributes':['id',_0xbc63('0x30'),_0xbc63('0x95'),_0xbc63('0x96'),_0xbc63('0x6e')],'raw':!![]});}})[_0xbc63('0x24')](function(_0x5af271){if(!_[_0xbc63('0x91')](_0x5af271)){var _0x48bdbe=[];for(var _0x245a0a=0x0;_0x245a0a<_0x5af271[_0xbc63('0x4d')];_0x245a0a++){if(_0x5af271[_0x245a0a][_0xbc63('0x95')]){_0x48bdbe[_0xbc63('0x89')](db['UserVoiceQueueRt']['upsert']({'membername':_0x5af271[_0x245a0a][_0xbc63('0x30')],'UserId':_0x5af271[_0x245a0a]['id'],'queue_name':_0x1c8ff7[_0xbc63('0x30')],'VoiceQueueId':_0x1c8ff7['id'],'interface':_[_0xbc63('0x79')](_0x5af271[_0x245a0a][_0xbc63('0x6e')])?util[_0xbc63('0x7a')]('SIP/%s',_0x5af271[_0x245a0a][_0xbc63('0x30')]):_0x5af271[_0x245a0a][_0xbc63('0x6e')],'paused':_0x5af271[_0x245a0a][_0xbc63('0x96')]||![],'penalty':_0x47af3d['body'][_0xbc63('0x71')]||0x0}));}}return BPromise[_0xbc63('0x8e')](_0x48bdbe);}})['then'](function(){return _0x2a4664;})[_0xbc63('0x24')](respondWithResult(_0xfc570b,null))[_0xbc63('0x4a')](handleError(_0xfc570b,null));};exports[_0xbc63('0x92')]=function(_0x2e37d7,_0x24bdb1,_0x566268){return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x2e37d7[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x24bdb1,null))[_0xbc63('0x24')](function(_0x34f803){if(_0x34f803){return _0x34f803[_0xbc63('0x92')](_0x2e37d7[_0xbc63('0x3b')][_0xbc63('0x7f')])['then'](function(){if(_['isArray'](_0x2e37d7[_0xbc63('0x3b')][_0xbc63('0x7f')])){for(var _0x4268ac=0x0;_0x4268ac<_0x2e37d7[_0xbc63('0x3b')][_0xbc63('0x7f')]['length'];_0x4268ac+=0x1){socket[_0xbc63('0x7c')](_0xbc63('0x93'),{'UserId':Number(_0x2e37d7[_0xbc63('0x3b')][_0xbc63('0x7f')][_0x4268ac]),'VoiceQueueId':Number(_0x2e37d7[_0xbc63('0x4c')]['id'])});}}else{socket[_0xbc63('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x2e37d7[_0xbc63('0x3b')][_0xbc63('0x7f')]),'VoiceQueueId':Number(_0x2e37d7['params']['id'])});}});}})[_0xbc63('0x24')](function(_0x17efb6){return db[_0xbc63('0x77')][_0xbc63('0x31')]({'where':{'VoiceQueueId':_0x2e37d7[_0xbc63('0x4c')]['id'],'UserId':_0x2e37d7[_0xbc63('0x3b')][_0xbc63('0x7f')]}})[_0xbc63('0x24')](function(){return _0x17efb6;});})[_0xbc63('0x24')](respondWithStatusCode(_0x24bdb1,null))['catch'](handleError(_0x24bdb1,null));};exports['getAgents']=function(_0x4cb9df,_0x477df9,_0x43304b){var _0x518fdc={};var _0x48aa9a={};var _0x3d184f;var _0x1d2cd3;return db[_0xbc63('0x37')][_0xbc63('0x61')]({'where':{'id':_0x4cb9df[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x477df9,null))[_0xbc63('0x24')](function(_0x51c380){if(_0x51c380){_0x3d184f=_0x51c380;_0x48aa9a[_0xbc63('0x3a')]=_['keys'](db['User'][_0xbc63('0x38')]);_0x48aa9a['query']=_[_0xbc63('0x3c')](_0x4cb9df[_0xbc63('0x3b')]);_0x48aa9a['filters']=_[_0xbc63('0x3e')](_0x48aa9a[_0xbc63('0x3a')],_0x48aa9a[_0xbc63('0x3b')]);_0x518fdc[_0xbc63('0x40')]=_[_0xbc63('0x3e')](_0x48aa9a[_0xbc63('0x3a')],qs['fields'](_0x4cb9df[_0xbc63('0x3b')]['fields']));_0x518fdc['attributes']=_0x518fdc[_0xbc63('0x40')][_0xbc63('0x4d')]?_0x518fdc['attributes']:_0x48aa9a[_0xbc63('0x3a')];_0x518fdc['order']=qs[_0xbc63('0x44')](_0x4cb9df[_0xbc63('0x3b')]['sort']);_0x518fdc[_0xbc63('0x45')]=qs['filters'](_[_0xbc63('0x68')](_0x4cb9df[_0xbc63('0x3b')],_0x48aa9a[_0xbc63('0x3d')]));if(_0x4cb9df[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0x518fdc[_0xbc63('0x45')]=_[_0xbc63('0x46')](_0x518fdc['where'],{'$or':_[_0xbc63('0x2c')](_0x518fdc[_0xbc63('0x40')],function(_0x369957){var _0x268b69={};_0x268b69[_0x369957]={'$like':'%'+_0x4cb9df[_0xbc63('0x3b')][_0xbc63('0x2a')]+'%'};return _0x268b69;})});}_0x518fdc=_['merge']({},_0x518fdc,_0x4cb9df['options']);return _0x3d184f[_0xbc63('0x97')](_0x518fdc);}})[_0xbc63('0x24')](function(_0x4c7e0c){if(_0x4c7e0c){_0x1d2cd3=_0x4c7e0c[_0xbc63('0x4d')];if(!_0x4cb9df['query'][_0xbc63('0x41')](_0xbc63('0x42'))){_0x518fdc[_0xbc63('0x1e')]=qs[_0xbc63('0x1e')](_0x4cb9df[_0xbc63('0x3b')][_0xbc63('0x1e')]);_0x518fdc[_0xbc63('0x1d')]=qs[_0xbc63('0x1d')](_0x4cb9df[_0xbc63('0x3b')][_0xbc63('0x1d')]);}return _0x3d184f['getAgents'](_0x518fdc);}})['then'](function(_0x22b8ac){if(_0x22b8ac){return _0x22b8ac?{'count':_0x1d2cd3,'rows':_0x22b8ac}:null;}})[_0xbc63('0x24')](respondWithResult(_0x477df9,null))['catch'](handleError(_0x477df9,null));};exports[_0xbc63('0x98')]=function(_0x1ce519,_0x145f11,_0x4a367c){var _0x12c903={};var _0x27a71e={};var _0xfbb3e8;var _0x4d62d4;return db[_0xbc63('0x37')][_0xbc63('0x61')]({'where':{'id':_0x1ce519[_0xbc63('0x4c')]['id']}})['then'](handleEntityNotFound(_0x145f11,null))[_0xbc63('0x24')](function(_0x360050){if(_0x360050){_0xfbb3e8=_0x360050;_0x27a71e[_0xbc63('0x3a')]=_['keys'](db[_0xbc63('0x77')][_0xbc63('0x38')]);_0x27a71e[_0xbc63('0x3b')]=_[_0xbc63('0x3c')](_0x1ce519[_0xbc63('0x3b')]);_0x27a71e[_0xbc63('0x3d')]=_[_0xbc63('0x3e')](_0x27a71e[_0xbc63('0x3a')],_0x27a71e['query']);_0x12c903['attributes']=_[_0xbc63('0x3e')](_0x27a71e[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x1ce519[_0xbc63('0x3b')][_0xbc63('0x3f')]));_0x12c903[_0xbc63('0x40')]=_0x12c903['attributes'][_0xbc63('0x4d')]?_0x12c903['attributes']:_0x27a71e[_0xbc63('0x3a')];_0x12c903[_0xbc63('0x43')]=qs['sort'](_0x1ce519[_0xbc63('0x3b')]['sort']);_0x12c903['where']=qs[_0xbc63('0x3d')](_[_0xbc63('0x68')](_0x1ce519[_0xbc63('0x3b')],_0x27a71e[_0xbc63('0x3d')]));if(_0x1ce519['query']['filter']){_0x12c903['where']=_[_0xbc63('0x46')](_0x12c903[_0xbc63('0x45')],{'$or':_[_0xbc63('0x2c')](_0x12c903[_0xbc63('0x40')],function(_0x1184a5){var _0x82eea9={};_0x82eea9[_0x1184a5]={'$like':'%'+_0x1ce519['query'][_0xbc63('0x2a')]+'%'};return _0x82eea9;})});}_0x12c903=_[_0xbc63('0x46')]({},_0x12c903,_0x1ce519[_0xbc63('0x50')]);return _0xfbb3e8[_0xbc63('0x98')](_0x12c903);}})[_0xbc63('0x24')](function(_0x7e2eab){if(_0x7e2eab){_0x4d62d4=_0x7e2eab[_0xbc63('0x4d')];if(!_0x1ce519[_0xbc63('0x3b')]['hasOwnProperty'](_0xbc63('0x42'))){_0x12c903[_0xbc63('0x1e')]=qs[_0xbc63('0x1e')](_0x1ce519['query'][_0xbc63('0x1e')]);_0x12c903[_0xbc63('0x1d')]=qs[_0xbc63('0x1d')](_0x1ce519[_0xbc63('0x3b')][_0xbc63('0x1d')]);}return _0xfbb3e8[_0xbc63('0x98')](_0x12c903);}})['then'](function(_0x1916a8){return _0x1916a8?{'count':_0x4d62d4,'rows':_0x1916a8}:null;})[_0xbc63('0x24')](respondWithResult(_0x145f11,null))['catch'](handleError(_0x145f11,null));};exports[_0xbc63('0x99')]=function(_0x25f851,_0x5f299b,_0x18248d){var _0xd900f7={};var _0x19317e={};var _0x3bb05a;var _0x3c9d2f;return db['VoiceQueue']['findOne']({'where':{'id':_0x25f851[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x5f299b,null))[_0xbc63('0x24')](function(_0x1e170a){if(_0x1e170a){_0x3bb05a=_0x1e170a;_0x19317e[_0xbc63('0x3a')]=_[_0xbc63('0x3c')](db[_0xbc63('0x9a')]['rawAttributes']);_0x19317e[_0xbc63('0x3b')]=_[_0xbc63('0x3c')](_0x25f851[_0xbc63('0x3b')]);_0x19317e[_0xbc63('0x3d')]=_[_0xbc63('0x3e')](_0x19317e[_0xbc63('0x3a')],_0x19317e[_0xbc63('0x3b')]);_0xd900f7[_0xbc63('0x40')]=_[_0xbc63('0x3e')](_0x19317e[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x25f851[_0xbc63('0x3b')][_0xbc63('0x3f')]));_0xd900f7[_0xbc63('0x40')]=_0xd900f7[_0xbc63('0x40')][_0xbc63('0x4d')]?_0xd900f7[_0xbc63('0x40')]:_0x19317e[_0xbc63('0x3a')];_0xd900f7[_0xbc63('0x43')]=qs[_0xbc63('0x44')](_0x25f851[_0xbc63('0x3b')][_0xbc63('0x44')]);_0xd900f7[_0xbc63('0x45')]=qs['filters'](_[_0xbc63('0x68')](_0x25f851['query'],_0x19317e[_0xbc63('0x3d')]));if(_0x25f851[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0xd900f7[_0xbc63('0x45')]=_[_0xbc63('0x46')](_0xd900f7[_0xbc63('0x45')],{'$or':_[_0xbc63('0x2c')](_0xd900f7[_0xbc63('0x40')],function(_0x256793){var _0x389fa2={};_0x389fa2[_0x256793]={'$like':'%'+_0x25f851[_0xbc63('0x3b')][_0xbc63('0x2a')]+'%'};return _0x389fa2;})});}_0xd900f7=_['merge']({},_0xd900f7,_0x25f851[_0xbc63('0x50')]);return _0x3bb05a[_0xbc63('0x99')](_0xd900f7);}})['then'](function(_0x3ec888){if(_0x3ec888){_0x3c9d2f=_0x3ec888['length'];if(!_0x25f851[_0xbc63('0x3b')][_0xbc63('0x41')](_0xbc63('0x42'))){_0xd900f7[_0xbc63('0x1e')]=qs[_0xbc63('0x1e')](_0x25f851[_0xbc63('0x3b')]['limit']);_0xd900f7['offset']=qs[_0xbc63('0x1d')](_0x25f851[_0xbc63('0x3b')][_0xbc63('0x1d')]);}return _0x3bb05a[_0xbc63('0x99')](_0xd900f7);}})[_0xbc63('0x24')](function(_0x556977){if(_0x556977){return _0x556977?{'count':_0x3c9d2f,'rows':_0x556977}:null;}})[_0xbc63('0x24')](respondWithResult(_0x5f299b,null))[_0xbc63('0x4a')](handleError(_0x5f299b,null));};exports[_0xbc63('0x9b')]=function(_0x2c8ff0,_0x32fb8c,_0x17771f){var _0x20241b,_0x3e5fcd;return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x2c8ff0['params']['id']}})['then'](handleEntityNotFound(_0x32fb8c,null))[_0xbc63('0x24')](function(_0x334123){if(_0x334123){_0x3e5fcd=_0x334123;return _0x334123[_0xbc63('0x9b')](_0x2c8ff0['body'][_0xbc63('0x7f')],_[_0xbc63('0x5a')](_0x2c8ff0[_0xbc63('0x5c')],['ids','id'])||{});}return null;})[_0xbc63('0x9c')](function(_0x48d6ed){var _0x54605f;_0x20241b=_0x48d6ed||[];var _0x40dd0a=[];if(_0x48d6ed){for(var _0x42b5ec=0x0;_0x42b5ec<_0x48d6ed[_0xbc63('0x4d')];_0x42b5ec+=0x1){var _0x44fd6b=_0x48d6ed[_0x42b5ec][_0xbc63('0x25')]({'plain':!![]});_0x3e5fcd[_0xbc63('0x9d')]=_0x2c8ff0[_0xbc63('0x5c')][_0xbc63('0x9d')]?_0x2c8ff0[_0xbc63('0x5c')]['dialCheckDuplicateType']:_0x3e5fcd[_0xbc63('0x9d')];switch(_0x3e5fcd['dialCheckDuplicateType']){case'always':_0x54605f=squel[_0xbc63('0x9e')]()['into'](_0xbc63('0x9f'))[_0xbc63('0xa0')]([_0xbc63('0xa1'),_0xbc63('0xa2'),_0xbc63('0xa3'),_0xbc63('0xa4'),_0xbc63('0x63'),'createdAt',_0xbc63('0x5d')],squel[_0xbc63('0x81')]()['field'](_0xbc63('0xa1'),_0xbc63('0xa1'))['field'](_0xbc63('0xa5'),_0xbc63('0xa2'))['field']('id','ContactId')['field'](_0x44fd6b[_0xbc63('0xa6')][_0xbc63('0x8a')](),_0xbc63('0xa4'))[_0xbc63('0x82')](_0x2c8ff0[_0xbc63('0x4c')]['id'][_0xbc63('0x8a')](),_0xbc63('0x63'))[_0xbc63('0x82')](_0xbc63('0xa5'),_0xbc63('0x5b'))[_0xbc63('0x82')](_0xbc63('0xa5'),_0xbc63('0x5d'))['from'](_0xbc63('0xa7'))[_0xbc63('0x45')](_0xbc63('0xa8'))['where']('ListId\x20=\x20?',_0x44fd6b['CmListId']['toString']())['where'](_0xbc63('0xa9'))[_0xbc63('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbc63('0x81')]()[_0xbc63('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0xbc63('0x84')](_0xbc63('0xaa'))['where'](_0xbc63('0xab'),_0x2c8ff0[_0xbc63('0x4c')]['id'][_0xbc63('0x8a')]()))[_0xbc63('0x45')](_0xbc63('0xac'),squel[_0xbc63('0x81')]()['field']('COALESCE(phone,\x27\x27)')[_0xbc63('0x84')](_0xbc63('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0x2c8ff0['params']['id']['toString']())))[_0xbc63('0x8a')]();break;case _0xbc63('0xad'):_0x54605f=squel[_0xbc63('0x9e')]()[_0xbc63('0xae')]('cm_hopper')[_0xbc63('0xa0')]([_0xbc63('0xa1'),_0xbc63('0xa2'),_0xbc63('0xa3'),_0xbc63('0xa4'),'VoiceQueueId',_0xbc63('0x5b'),_0xbc63('0x5d')],squel['select']()[_0xbc63('0x82')](_0xbc63('0xa1'),'phone')[_0xbc63('0x82')]('NOW()',_0xbc63('0xa2'))[_0xbc63('0x82')]('id','ContactId')[_0xbc63('0x82')](_0x44fd6b[_0xbc63('0xa6')][_0xbc63('0x8a')](),'ListId')['field'](_0x2c8ff0['params']['id'][_0xbc63('0x8a')](),_0xbc63('0x63'))[_0xbc63('0x82')](_0xbc63('0xa5'),'createdAt')['field'](_0xbc63('0xa5'),_0xbc63('0x5d'))[_0xbc63('0x84')](_0xbc63('0xa7'))[_0xbc63('0x45')]('deletedAt\x20IS\x20NULL')[_0xbc63('0x45')]('ListId\x20=\x20?',_0x44fd6b['CmListId'][_0xbc63('0x8a')]())[_0xbc63('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xbc63('0x45')](_0xbc63('0xac'),squel[_0xbc63('0x81')]()[_0xbc63('0x82')](_0xbc63('0xaf'))['from'](_0xbc63('0x9f'))[_0xbc63('0x45')](_0xbc63('0xab'),_0x2c8ff0[_0xbc63('0x4c')]['id'][_0xbc63('0x8a')]())))['toString']();break;default:_0x54605f=squel['insert']()[_0xbc63('0xae')](_0xbc63('0x9f'))[_0xbc63('0xa0')]([_0xbc63('0xa1'),_0xbc63('0xa2'),_0xbc63('0xa3'),_0xbc63('0xa4'),_0xbc63('0x63'),_0xbc63('0x5b'),_0xbc63('0x5d')],squel['select']()[_0xbc63('0x82')](_0xbc63('0xa1'),_0xbc63('0xa1'))[_0xbc63('0x82')](_0xbc63('0xa5'),'scheduledAt')[_0xbc63('0x82')]('id',_0xbc63('0xa3'))[_0xbc63('0x82')](_0x44fd6b[_0xbc63('0xa6')]['toString'](),_0xbc63('0xa4'))[_0xbc63('0x82')](_0x2c8ff0[_0xbc63('0x4c')]['id'][_0xbc63('0x8a')](),_0xbc63('0x63'))[_0xbc63('0x82')](_0xbc63('0xa5'),'createdAt')[_0xbc63('0x82')](_0xbc63('0xa5'),_0xbc63('0x5d'))[_0xbc63('0x84')]('cm_contacts')[_0xbc63('0x45')](_0xbc63('0xa8'))[_0xbc63('0x45')](_0xbc63('0xb0'),_0x44fd6b[_0xbc63('0xa6')][_0xbc63('0x8a')]())[_0xbc63('0x45')](_0xbc63('0xa9')))[_0xbc63('0x8a')]();}_0x40dd0a['push'](db[_0xbc63('0x72')][_0xbc63('0x3b')](_0x54605f));}return BPromise['all'](_0x40dd0a);}})['then'](function(){return _0x20241b;})[_0xbc63('0x24')](respondWithResult(_0x32fb8c,null))['catch'](handleError(_0x32fb8c,null));};exports[_0xbc63('0xb1')]=function(_0x41fc6c,_0x311fda,_0x2d71c4){return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x41fc6c[_0xbc63('0x4c')]['id']}})['then'](handleEntityNotFound(_0x311fda,null))[_0xbc63('0x24')](function(_0x58a5d9){if(_0x58a5d9){return _0x58a5d9[_0xbc63('0xb1')](_0x41fc6c[_0xbc63('0x3b')][_0xbc63('0x7f')]);}})[_0xbc63('0x24')](function(_0x108c9a){if(_0x108c9a){return db[_0xbc63('0x62')][_0xbc63('0x31')]({'where':{'ListId':_0x41fc6c[_0xbc63('0x3b')]['ids'],'VoiceQueueId':_0x41fc6c[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](function(){return _0x108c9a;});}})['then'](respondWithStatusCode(_0x311fda,null))[_0xbc63('0x4a')](handleError(_0x311fda,null));};exports[_0xbc63('0xb2')]=function(_0x2ac9aa,_0xf18653,_0x5d1305){var _0x1f135f={};var _0x2d795d={};var _0x56582c;var _0x2d69dc;return db[_0xbc63('0x37')][_0xbc63('0x61')]({'where':{'id':_0x2ac9aa[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0xf18653,null))[_0xbc63('0x24')](function(_0x2a3b27){if(_0x2a3b27){_0x56582c=_0x2a3b27;_0x2d795d['model']=_[_0xbc63('0x3c')](db[_0xbc63('0x9a')]['rawAttributes']);_0x2d795d['query']=_[_0xbc63('0x3c')](_0x2ac9aa[_0xbc63('0x3b')]);_0x2d795d[_0xbc63('0x3d')]=_[_0xbc63('0x3e')](_0x2d795d['model'],_0x2d795d[_0xbc63('0x3b')]);_0x1f135f[_0xbc63('0x40')]=_[_0xbc63('0x3e')](_0x2d795d[_0xbc63('0x3a')],qs[_0xbc63('0x3f')](_0x2ac9aa[_0xbc63('0x3b')][_0xbc63('0x3f')]));_0x1f135f[_0xbc63('0x40')]=_0x1f135f[_0xbc63('0x40')][_0xbc63('0x4d')]?_0x1f135f[_0xbc63('0x40')]:_0x2d795d[_0xbc63('0x3a')];_0x1f135f[_0xbc63('0x43')]=qs[_0xbc63('0x44')](_0x2ac9aa[_0xbc63('0x3b')][_0xbc63('0x44')]);_0x1f135f[_0xbc63('0x45')]=qs[_0xbc63('0x3d')](_[_0xbc63('0x68')](_0x2ac9aa[_0xbc63('0x3b')],_0x2d795d[_0xbc63('0x3d')]));if(_0x2ac9aa[_0xbc63('0x3b')][_0xbc63('0x2a')]){_0x1f135f['where']=_[_0xbc63('0x46')](_0x1f135f[_0xbc63('0x45')],{'$or':_[_0xbc63('0x2c')](_0x1f135f[_0xbc63('0x40')],function(_0x1be7b9){var _0x2f89ac={};_0x2f89ac[_0x1be7b9]={'$like':'%'+_0x2ac9aa['query'][_0xbc63('0x2a')]+'%'};return _0x2f89ac;})});}_0x1f135f=_[_0xbc63('0x46')]({},_0x1f135f,_0x2ac9aa[_0xbc63('0x50')]);return _0x56582c[_0xbc63('0xb2')](_0x1f135f);}})[_0xbc63('0x24')](function(_0x5602f0){if(_0x5602f0){_0x2d69dc=_0x5602f0[_0xbc63('0x4d')];if(!_0x2ac9aa[_0xbc63('0x3b')][_0xbc63('0x41')](_0xbc63('0x42'))){_0x1f135f[_0xbc63('0x1e')]=qs['limit'](_0x2ac9aa[_0xbc63('0x3b')][_0xbc63('0x1e')]);_0x1f135f[_0xbc63('0x1d')]=qs[_0xbc63('0x1d')](_0x2ac9aa[_0xbc63('0x3b')]['offset']);}return _0x56582c[_0xbc63('0xb2')](_0x1f135f);}})[_0xbc63('0x24')](function(_0x27839c){if(_0x27839c){return _0x27839c?{'count':_0x2d69dc,'rows':_0x27839c}:null;}})['then'](respondWithResult(_0xf18653,null))[_0xbc63('0x4a')](handleError(_0xf18653,null));};exports[_0xbc63('0xb3')]=function(_0x399e33,_0x41c427,_0x2f1762){var _0xa651c4,_0x12f11d;return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x399e33[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x41c427,null))[_0xbc63('0x24')](function(_0x3884e4){if(_0x3884e4){_0x12f11d=_0x3884e4;return _0x3884e4[_0xbc63('0xb3')](_0x399e33[_0xbc63('0x5c')][_0xbc63('0x7f')],_[_0xbc63('0x5a')](_0x399e33[_0xbc63('0x5c')],[_0xbc63('0x7f'),'id'])||{});}return null;})[_0xbc63('0x9c')](function(_0x4095e2){var _0x5b01d1;_0xa651c4=_0x4095e2||[];var _0x434121=[];if(_0x4095e2){for(var _0x292899=0x0;_0x292899<_0x4095e2[_0xbc63('0x4d')];_0x292899+=0x1){var _0x5b85e7=_0x4095e2[_0x292899][_0xbc63('0x25')]({'plain':!![]});_0x5b01d1=squel['insert']()[_0xbc63('0xae')](_0xbc63('0xb4'))[_0xbc63('0xa0')](['phone',_0xbc63('0xa3'),'ListId',_0xbc63('0x63'),_0xbc63('0x5b'),_0xbc63('0x5d')],squel['select']()[_0xbc63('0x82')](_0xbc63('0xa1'),_0xbc63('0xa1'))['field']('id','ContactId')[_0xbc63('0x82')](_0x5b85e7[_0xbc63('0xa6')]['toString'](),_0xbc63('0xa4'))[_0xbc63('0x82')](_0x399e33[_0xbc63('0x4c')]['id'][_0xbc63('0x8a')](),_0xbc63('0x63'))[_0xbc63('0x82')]('NOW()','createdAt')[_0xbc63('0x82')]('NOW()',_0xbc63('0x5d'))[_0xbc63('0x84')]('cm_contacts')['where'](_0xbc63('0xa8'))[_0xbc63('0x45')](_0xbc63('0xb0'),_0x5b85e7['CmListId'][_0xbc63('0x8a')]())['where'](_0xbc63('0xa9')))[_0xbc63('0x8a')]();_0x434121[_0xbc63('0x89')](db[_0xbc63('0x72')][_0xbc63('0x3b')](_0x5b01d1));}return BPromise[_0xbc63('0x8e')](_0x434121);}})['then'](function(){return _0xa651c4;})[_0xbc63('0x24')](respondWithResult(_0x41c427,null))[_0xbc63('0x4a')](handleError(_0x41c427,null));};exports[_0xbc63('0xb5')]=function(_0x4b6582,_0x4e8e30,_0x3c207e){return db[_0xbc63('0x37')][_0xbc63('0x51')]({'where':{'id':_0x4b6582[_0xbc63('0x4c')]['id']}})[_0xbc63('0x24')](handleEntityNotFound(_0x4e8e30,null))[_0xbc63('0x24')](function(_0x47e0ad){if(_0x47e0ad){return _0x47e0ad['removeBlackLists'](_0x4b6582['query'][_0xbc63('0x7f')]);}})[_0xbc63('0x24')](function(_0x48d2dc){if(_0x48d2dc){return db['CmHopperBlack'][_0xbc63('0x31')]({'where':{'ListId':_0x4b6582[_0xbc63('0x3b')]['ids'],'VoiceQueueId':_0x4b6582['params']['id']}})[_0xbc63('0x24')](function(){return _0x48d2dc;});}})['then'](respondWithStatusCode(_0x4e8e30,null))['catch'](handleError(_0x4e8e30,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 142411d..b3cc13a 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 _0x65d9=['../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x48d5eb,_0x3535cd){var _0x316f9e=function(_0x5dd6c5){while(--_0x5dd6c5){_0x48d5eb['push'](_0x48d5eb['shift']());}};_0x316f9e(++_0x3535cd);}(_0x65d9,0x10d));var _0x965d=function(_0x4598d8,_0xebcd05){_0x4598d8=_0x4598d8-0x0;var _0x57b16f=_0x65d9[_0x4598d8];return _0x57b16f;};'use strict';var EventEmitter=require(_0x965d('0x0'));var VoiceQueue=require(_0x965d('0x1'))['db'][_0x965d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x965d('0x3')](0x0);var events={'afterCreate':_0x965d('0x4'),'afterUpdate':'update','afterDestroy':_0x965d('0x5')};function emitEvent(_0x4f5fea){return function(_0x4ec404,_0x4c58cc,_0x219c4e){VoiceQueueEvents[_0x965d('0x6')](_0x4f5fea+':'+_0x4ec404['id'],_0x4ec404);VoiceQueueEvents[_0x965d('0x6')](_0x4f5fea,_0x4ec404);_0x219c4e(null);};}for(var e in events){if(events[_0x965d('0x7')](e)){var event=events[e];VoiceQueue[_0x965d('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xce90=['emit','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0xce90,0x113));var _0x0ce9=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xce90[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require(_0x0ce9('0x0'));var VoiceQueue=require(_0x0ce9('0x1'))['db'][_0x0ce9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0ce9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0ce9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43f1c7){return function(_0x4c0da1,_0x441c3d,_0xad7b07){VoiceQueueEvents[_0x0ce9('0x5')](_0x43f1c7+':'+_0x4c0da1['id'],_0x4c0da1);VoiceQueueEvents['emit'](_0x43f1c7,_0x4c0da1);_0xad7b07(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x0ce9('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b04c0f5..5f24aa7 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 _0x925f=['bluebird','request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x925f,0xa0));var _0xf925=function(_0x1f6fd5,_0x399cb0){_0x1f6fd5=_0x1f6fd5-0x0;var _0x587d12=_0x925f[_0x1f6fd5];return _0x587d12;};'use strict';var _=require('lodash');var util=require(_0xf925('0x0'));var logger=require('../../config/logger')(_0xf925('0x1'));var moment=require('moment');var BPromise=require(_0xf925('0x2'));var rp=require(_0xf925('0x3'));var fs=require('fs');var path=require(_0xf925('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf925('0x5'));module['exports']=function(_0xfa30c5,_0x369940){return _0xfa30c5[_0xf925('0x6')](_0xf925('0x7'),attributes,{'tableName':_0xf925('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3847=['VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x5d4c0e,_0x1a427b){var _0x14df10=function(_0x19504f){while(--_0x19504f){_0x5d4c0e['push'](_0x5d4c0e['shift']());}};_0x14df10(++_0x1a427b);}(_0x3847,0x84));var _0x7384=function(_0x57c06c,_0x461eb1){_0x57c06c=_0x57c06c-0x0;var _0x17c918=_0x3847[_0x57c06c];return _0x17c918;};'use strict';var _=require(_0x7384('0x0'));var util=require(_0x7384('0x1'));var logger=require(_0x7384('0x2'))(_0x7384('0x3'));var moment=require(_0x7384('0x4'));var BPromise=require(_0x7384('0x5'));var rp=require(_0x7384('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7384('0x7'));var config=require(_0x7384('0x8'));var attributes=require('./voiceQueue.attributes');module[_0x7384('0x9')]=function(_0x181687,_0x343209){return _0x181687[_0x7384('0xa')](_0x7384('0xb'),attributes,{'tableName':_0x7384('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 622ddda..3a455fe 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 _0x65a2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','info','ShowVoiceQueue','VoiceQueue','lodash','util'];(function(_0x3a82f5,_0x37805a){var _0x1fa056=function(_0x22f83c){while(--_0x22f83c){_0x3a82f5['push'](_0x3a82f5['shift']());}};_0x1fa056(++_0x37805a);}(_0x65a2,0x15d));var _0x265a=function(_0x433e7e,_0xdd0075){_0x433e7e=_0x433e7e-0x0;var _0x145278=_0x65a2[_0x433e7e];return _0x145278;};'use strict';var _=require(_0x265a('0x0'));var util=require(_0x265a('0x1'));var moment=require(_0x265a('0x2'));var BPromise=require(_0x265a('0x3'));var rs=require(_0x265a('0x4'));var fs=require('fs');var Redis=require(_0x265a('0x5'));var db=require(_0x265a('0x6'))['db'];var utils=require(_0x265a('0x7'));var logger=require('../../config/logger')(_0x265a('0x8'));var config=require(_0x265a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x265a('0xa')][_0x265a('0xb')]({'port':0x232a});config[_0x265a('0xc')]=_[_0x265a('0xd')](config['redis'],{'host':_0x265a('0xe'),'port':0x18eb});var socket=require(_0x265a('0xf'))(new Redis(config[_0x265a('0xc')]));require(_0x265a('0x10'))[_0x265a('0x11')](socket);function respondWithRpcPromise(_0x31e969,_0x5145bc,_0x88e820){return new BPromise(function(_0x499ecd,_0x53f29b){return client[_0x265a('0x12')](_0x31e969,_0x88e820)[_0x265a('0x13')](function(_0x21a7ea){logger['info'](_0x265a('0x14'),_0x5145bc,_0x265a('0x15'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5145bc,_0x265a('0x15'),JSON['stringify'](_0x21a7ea));if(_0x21a7ea[_0x265a('0x16')]){if(_0x21a7ea[_0x265a('0x16')]['code']===0x1f4){logger['error'](_0x265a('0x14'),_0x5145bc,_0x21a7ea['error'][_0x265a('0x17')]);return _0x53f29b(_0x21a7ea[_0x265a('0x16')][_0x265a('0x17')]);}logger[_0x265a('0x16')](_0x265a('0x14'),_0x5145bc,_0x21a7ea[_0x265a('0x16')][_0x265a('0x17')]);return _0x499ecd(_0x21a7ea[_0x265a('0x16')]['message']);}else{logger['info'](_0x265a('0x14'),_0x5145bc,_0x265a('0x15'));_0x499ecd(_0x21a7ea[_0x265a('0x18')][_0x265a('0x17')]);}})[_0x265a('0x19')](function(_0x858a0c){logger[_0x265a('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x5145bc,_0x858a0c);_0x53f29b(_0x858a0c);});});}exports[_0x265a('0x1a')]=function(_0x1f4de4){var _0x2bd581=this;return new Promise(function(_0x48d202,_0x232bf0){return db['VoiceQueue'][_0x265a('0x1b')]({'raw':_0x1f4de4['options']?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x1e')]||null:null,'attributes':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x1f')]||null:null,'limit':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x20')]||null:null,'include':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')]['include']?_[_0x265a('0x21')](_0x1f4de4[_0x265a('0x1c')][_0x265a('0x22')],function(_0x3ce20d){return{'model':db[_0x3ce20d['model']],'as':_0x3ce20d['as'],'attributes':_0x3ce20d[_0x265a('0x1f')],'include':_0x3ce20d[_0x265a('0x22')]?_['map'](_0x3ce20d[_0x265a('0x22')],function(_0x528890){return{'model':db[_0x528890[_0x265a('0x23')]],'as':_0x528890['as'],'attributes':_0x528890[_0x265a('0x1f')],'include':_0x528890[_0x265a('0x22')]?_[_0x265a('0x21')](_0x528890[_0x265a('0x22')],function(_0x324132){return{'model':db[_0x324132[_0x265a('0x23')]],'as':_0x324132['as'],'attributes':_0x324132[_0x265a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x265a('0x13')](function(_0x5c4d01){logger[_0x265a('0x24')](_0x265a('0x1a'),_0x1f4de4);logger['debug']('GetVoiceQueue',_0x1f4de4,JSON['stringify'](_0x5c4d01));_0x48d202(_0x5c4d01);})['catch'](function(_0x40cf60){logger[_0x265a('0x16')](_0x265a('0x1a'),_0x40cf60[_0x265a('0x17')],_0x1f4de4);_0x232bf0(_0x2bd581['error'](0x1f4,_0x40cf60[_0x265a('0x17')]));});});};exports[_0x265a('0x25')]=function(_0x45782d){var _0x306f8a=this;return new Promise(function(_0x2b5933,_0x31b081){return db[_0x265a('0x26')]['find']({'raw':_0x45782d[_0x265a('0x1c')]?_0x45782d[_0x265a('0x1c')][_0x265a('0x1d')]===undefined?!![]:![]:!![],'where':_0x45782d['options']?_0x45782d['options'][_0x265a('0x1e')]||null:null,'attributes':_0x45782d['options']?_0x45782d[_0x265a('0x1c')][_0x265a('0x1f')]||null:null,'include':_0x45782d[_0x265a('0x1c')]?_0x45782d[_0x265a('0x1c')][_0x265a('0x22')]?_[_0x265a('0x21')](_0x45782d[_0x265a('0x1c')]['include'],function(_0x5a0d26){return{'model':db[_0x5a0d26['model']],'as':_0x5a0d26['as'],'attributes':_0x5a0d26[_0x265a('0x1f')],'include':_0x5a0d26[_0x265a('0x22')]?_[_0x265a('0x21')](_0x5a0d26[_0x265a('0x22')],function(_0x3220c0){return{'model':db[_0x3220c0[_0x265a('0x23')]],'as':_0x3220c0['as'],'attributes':_0x3220c0['attributes'],'include':_0x3220c0[_0x265a('0x22')]?_[_0x265a('0x21')](_0x3220c0[_0x265a('0x22')],function(_0x510c0a){return{'model':db[_0x510c0a[_0x265a('0x23')]],'as':_0x510c0a['as'],'attributes':_0x510c0a['attributes']};}):[]};}):[]};}):[]:[]})[_0x265a('0x13')](function(_0x447186){logger['info'](_0x265a('0x25'),_0x45782d);logger['debug'](_0x265a('0x25'),_0x45782d,JSON['stringify'](_0x447186));_0x2b5933(_0x447186);})['catch'](function(_0xf5b998){logger['error'](_0x265a('0x25'),_0xf5b998[_0x265a('0x17')],_0x45782d);_0x31b081(_0x306f8a[_0x265a('0x16')](0x1f4,_0xf5b998['message']));});});}; \ No newline at end of file +var _0xf2b4=['VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x262c1a,_0x58f480){var _0x50bd34=function(_0x344a17){while(--_0x344a17){_0x262c1a['push'](_0x262c1a['shift']());}};_0x50bd34(++_0x58f480);}(_0xf2b4,0xbd));var _0x4f2b=function(_0x4d1245,_0x2b89cc){_0x4d1245=_0x4d1245-0x0;var _0xacb38f=_0xf2b4[_0x4d1245];return _0xacb38f;};'use strict';var _=require(_0x4f2b('0x0'));var util=require(_0x4f2b('0x1'));var moment=require('moment');var BPromise=require(_0x4f2b('0x2'));var rs=require(_0x4f2b('0x3'));var fs=require('fs');var Redis=require(_0x4f2b('0x4'));var db=require(_0x4f2b('0x5'))['db'];var utils=require(_0x4f2b('0x6'));var logger=require('../../config/logger')(_0x4f2b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4f2b('0x8')][_0x4f2b('0x9')]({'port':0x232a});config[_0x4f2b('0xa')]=_[_0x4f2b('0xb')](config[_0x4f2b('0xa')],{'host':_0x4f2b('0xc'),'port':0x18eb});var socket=require(_0x4f2b('0xd'))(new Redis(config[_0x4f2b('0xa')]));require(_0x4f2b('0xe'))[_0x4f2b('0xf')](socket);function respondWithRpcPromise(_0x59b529,_0x167501,_0x36d7be){return new BPromise(function(_0x7d4176,_0x536cb8){return client[_0x4f2b('0x10')](_0x59b529,_0x36d7be)['then'](function(_0x31e033){logger[_0x4f2b('0x11')](_0x4f2b('0x12'),_0x167501,_0x4f2b('0x13'));logger[_0x4f2b('0x14')](_0x4f2b('0x15'),_0x167501,_0x4f2b('0x13'),JSON[_0x4f2b('0x16')](_0x31e033));if(_0x31e033['error']){if(_0x31e033[_0x4f2b('0x17')][_0x4f2b('0x18')]===0x1f4){logger['error'](_0x4f2b('0x12'),_0x167501,_0x31e033[_0x4f2b('0x17')][_0x4f2b('0x19')]);return _0x536cb8(_0x31e033[_0x4f2b('0x17')][_0x4f2b('0x19')]);}logger[_0x4f2b('0x17')](_0x4f2b('0x12'),_0x167501,_0x31e033[_0x4f2b('0x17')][_0x4f2b('0x19')]);return _0x7d4176(_0x31e033[_0x4f2b('0x17')]['message']);}else{logger[_0x4f2b('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x167501,_0x4f2b('0x13'));_0x7d4176(_0x31e033[_0x4f2b('0x1a')]['message']);}})[_0x4f2b('0x1b')](function(_0x2aaa1a){logger[_0x4f2b('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x167501,_0x2aaa1a);_0x536cb8(_0x2aaa1a);});});}exports[_0x4f2b('0x1c')]=function(_0x525457){var _0x53293f=this;return new Promise(function(_0x24c7f0,_0x12a34a){return db[_0x4f2b('0x1d')][_0x4f2b('0x1e')]({'raw':_0x525457[_0x4f2b('0x1f')]?_0x525457['options'][_0x4f2b('0x20')]===undefined?!![]:![]:!![],'where':_0x525457[_0x4f2b('0x1f')]?_0x525457[_0x4f2b('0x1f')][_0x4f2b('0x21')]||null:null,'attributes':_0x525457[_0x4f2b('0x1f')]?_0x525457['options'][_0x4f2b('0x22')]||null:null,'limit':_0x525457[_0x4f2b('0x1f')]?_0x525457['options'][_0x4f2b('0x23')]||null:null,'include':_0x525457[_0x4f2b('0x1f')]?_0x525457[_0x4f2b('0x1f')][_0x4f2b('0x24')]?_[_0x4f2b('0x25')](_0x525457[_0x4f2b('0x1f')][_0x4f2b('0x24')],function(_0x51c37a){return{'model':db[_0x51c37a[_0x4f2b('0x26')]],'as':_0x51c37a['as'],'attributes':_0x51c37a[_0x4f2b('0x22')],'include':_0x51c37a[_0x4f2b('0x24')]?_[_0x4f2b('0x25')](_0x51c37a[_0x4f2b('0x24')],function(_0x487ca3){return{'model':db[_0x487ca3[_0x4f2b('0x26')]],'as':_0x487ca3['as'],'attributes':_0x487ca3[_0x4f2b('0x22')],'include':_0x487ca3[_0x4f2b('0x24')]?_['map'](_0x487ca3[_0x4f2b('0x24')],function(_0x8b8418){return{'model':db[_0x8b8418[_0x4f2b('0x26')]],'as':_0x8b8418['as'],'attributes':_0x8b8418[_0x4f2b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e84ef){logger[_0x4f2b('0x11')](_0x4f2b('0x1c'),_0x525457);logger[_0x4f2b('0x14')](_0x4f2b('0x1c'),_0x525457,JSON[_0x4f2b('0x16')](_0x1e84ef));_0x24c7f0(_0x1e84ef);})[_0x4f2b('0x1b')](function(_0x14fc45){logger[_0x4f2b('0x17')]('GetVoiceQueue',_0x14fc45[_0x4f2b('0x19')],_0x525457);_0x12a34a(_0x53293f[_0x4f2b('0x17')](0x1f4,_0x14fc45[_0x4f2b('0x19')]));});});};exports[_0x4f2b('0x27')]=function(_0x34b22f){var _0x58fa9b=this;return new Promise(function(_0x5e41b2,_0x5b39aa){return db['VoiceQueue'][_0x4f2b('0x28')]({'raw':_0x34b22f['options']?_0x34b22f[_0x4f2b('0x1f')][_0x4f2b('0x20')]===undefined?!![]:![]:!![],'where':_0x34b22f[_0x4f2b('0x1f')]?_0x34b22f[_0x4f2b('0x1f')][_0x4f2b('0x21')]||null:null,'attributes':_0x34b22f[_0x4f2b('0x1f')]?_0x34b22f[_0x4f2b('0x1f')]['attributes']||null:null,'include':_0x34b22f[_0x4f2b('0x1f')]?_0x34b22f[_0x4f2b('0x1f')][_0x4f2b('0x24')]?_[_0x4f2b('0x25')](_0x34b22f[_0x4f2b('0x1f')][_0x4f2b('0x24')],function(_0x23f8ad){return{'model':db[_0x23f8ad[_0x4f2b('0x26')]],'as':_0x23f8ad['as'],'attributes':_0x23f8ad[_0x4f2b('0x22')],'include':_0x23f8ad[_0x4f2b('0x24')]?_[_0x4f2b('0x25')](_0x23f8ad[_0x4f2b('0x24')],function(_0x6e580a){return{'model':db[_0x6e580a[_0x4f2b('0x26')]],'as':_0x6e580a['as'],'attributes':_0x6e580a[_0x4f2b('0x22')],'include':_0x6e580a[_0x4f2b('0x24')]?_['map'](_0x6e580a[_0x4f2b('0x24')],function(_0x1d523b){return{'model':db[_0x1d523b[_0x4f2b('0x26')]],'as':_0x1d523b['as'],'attributes':_0x1d523b[_0x4f2b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4f2b('0x29')](function(_0x50ad6a){logger[_0x4f2b('0x11')](_0x4f2b('0x27'),_0x34b22f);logger[_0x4f2b('0x14')](_0x4f2b('0x27'),_0x34b22f,JSON['stringify'](_0x50ad6a));_0x5e41b2(_0x50ad6a);})[_0x4f2b('0x1b')](function(_0x1c6d4f){logger[_0x4f2b('0x17')](_0x4f2b('0x27'),_0x1c6d4f[_0x4f2b('0x19')],_0x34b22f);_0x5b39aa(_0x58fa9b[_0x4f2b('0x17')](0x1f4,_0x1c6d4f[_0x4f2b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7fafb79..fbba401 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 _0xb74d=['length','voiceQueue:','./voiceQueue.events','remove','emit','removeListener','register'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xb74d,0x16e));var _0xdb74=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xb74d[_0x52e68e];return _0x3211a4;};'use strict';var VoiceQueueEvents=require(_0xdb74('0x0'));var events=['save',_0xdb74('0x1'),'update'];function createListener(_0x3f540e,_0x5700f0){return function(_0x1ba155){_0x5700f0[_0xdb74('0x2')](_0x3f540e,_0x1ba155);};}function removeListener(_0x61bd15,_0x4b3b06){return function(){VoiceQueueEvents[_0xdb74('0x3')](_0x61bd15,_0x4b3b06);};}exports[_0xdb74('0x4')]=function(_0xd2d2f0){for(var _0x4dbe91=0x0,_0x5183ae=events[_0xdb74('0x5')];_0x4dbe91<_0x5183ae;_0x4dbe91++){var _0x4bf15e=events[_0x4dbe91];var _0x3e44b7=createListener(_0xdb74('0x6')+_0x4bf15e,_0xd2d2f0);VoiceQueueEvents['on'](_0x4bf15e,_0x3e44b7);}}; \ No newline at end of file +var _0xbb18=['voiceQueue:','./voiceQueue.events','save','remove','update','removeListener','register','length'];(function(_0x52535f,_0x118bc2){var _0x3187d1=function(_0x2d8185){while(--_0x2d8185){_0x52535f['push'](_0x52535f['shift']());}};_0x3187d1(++_0x118bc2);}(_0xbb18,0xb1));var _0x8bb1=function(_0x342136,_0x55dab7){_0x342136=_0x342136-0x0;var _0x194c7f=_0xbb18[_0x342136];return _0x194c7f;};'use strict';var VoiceQueueEvents=require(_0x8bb1('0x0'));var events=[_0x8bb1('0x1'),_0x8bb1('0x2'),_0x8bb1('0x3')];function createListener(_0x1a1808,_0x253337){return function(_0x20d182){_0x253337['emit'](_0x1a1808,_0x20d182);};}function removeListener(_0x3c5511,_0x1a0141){return function(){VoiceQueueEvents[_0x8bb1('0x4')](_0x3c5511,_0x1a0141);};}exports[_0x8bb1('0x5')]=function(_0x2cf483){for(var _0x285512=0x0,_0x563865=events[_0x8bb1('0x6')];_0x285512<_0x563865;_0x285512++){var _0x3a0219=events[_0x285512];var _0x5f09ed=createListener(_0x8bb1('0x7')+_0x3a0219,_0x2cf483);VoiceQueueEvents['on'](_0x3a0219,_0x5f09ed);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9e530ed..5705f1c 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ee1=['getVoiceQueuesReport','show','create','put','/:id','update','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index'];(function(_0x48fff1,_0x50c537){var _0x127a1d=function(_0x2abe66){while(--_0x2abe66){_0x48fff1['push'](_0x48fff1['shift']());}};_0x127a1d(++_0x50c537);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2980b6,_0x10f1a7){_0x2980b6=_0x2980b6-0x0;var _0x3c3338=_0x7ee1[_0x2980b6];return _0x3c3338;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var auth=require(_0x17ee('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x17ee('0x4'));var controller=require(_0x17ee('0x5'));router[_0x17ee('0x6')]('/',auth[_0x17ee('0x7')](),controller['index']);router[_0x17ee('0x6')](_0x17ee('0x8'),auth['isAuthenticated'](),controller[_0x17ee('0x9')]);router['get'](_0x17ee('0xa'),auth[_0x17ee('0x7')](),controller[_0x17ee('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x17ee('0xc')]);router['post']('/',auth[_0x17ee('0x7')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')](_0x17ee('0xf'),auth['isAuthenticated'](),controller[_0x17ee('0x10')]);router['delete'](_0x17ee('0xf'),auth[_0x17ee('0x7')](),controller[_0x17ee('0x11')]);module[_0x17ee('0x12')]=router; \ No newline at end of file +var _0x5162=['show','post','update','delete','/:id','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','/index','getVoiceQueuesReport'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x5162,0x103));var _0x2516=function(_0x1d0458,_0x4ed6d4){_0x1d0458=_0x1d0458-0x0;var _0x2fad3c=_0x5162[_0x1d0458];return _0x2fad3c;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var auth=require(_0x2516('0x2'));var interaction=require(_0x2516('0x3'));var config=require(_0x2516('0x4'));var controller=require(_0x2516('0x5'));router[_0x2516('0x6')]('/',auth[_0x2516('0x7')](),controller['index']);router['get']('/describe',auth[_0x2516('0x7')](),controller[_0x2516('0x8')]);router[_0x2516('0x6')](_0x2516('0x9'),auth[_0x2516('0x7')](),controller[_0x2516('0xa')]);router[_0x2516('0x6')]('/:id',auth[_0x2516('0x7')](),controller[_0x2516('0xb')]);router[_0x2516('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x2516('0x7')](),controller[_0x2516('0xd')]);router[_0x2516('0xe')](_0x2516('0xf'),auth['isAuthenticated'](),controller[_0x2516('0x10')]);module[_0x2516('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 6d0775a..c04495c 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 _0xe706=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x53e4f8,_0x574f8e){var _0x2549fa=function(_0x3ffaf0){while(--_0x3ffaf0){_0x53e4f8['push'](_0x53e4f8['shift']());}};_0x2549fa(++_0x574f8e);}(_0xe706,0xa3));var _0x6e70=function(_0x1acf4d,_0x271e6b){_0x1acf4d=_0x1acf4d-0x0;var _0x2880a0=_0xe706[_0x1acf4d];return _0x2880a0;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e70('0x3')]},'calleridnum':{'type':Sequelize[_0x6e70('0x3')]},'calleridname':{'type':Sequelize[_0x6e70('0x3')]},'queue':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e70('0x4')],'set':function(_0x376a8d){var _0x506db9=moment(_0x376a8d);var _0x1b0389=moment(this[_0x6e70('0x5')](_0x6e70('0x6')))[_0x6e70('0x7')](_0x6e70('0x8'));var _0x188ed3=_0x506db9[_0x6e70('0x9')](_0x1b0389,_0x6e70('0xa'));this[_0x6e70('0xb')](_0x6e70('0xc'),_0x376a8d);this[_0x6e70('0xb')](_0x6e70('0xd'),_0x188ed3||null);}},'position':{'type':Sequelize[_0x6e70('0xe')]},'count':{'type':Sequelize[_0x6e70('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6e70('0x3')],'comment':_0x6e70('0x10')},'originalposition':{'type':Sequelize[_0x6e70('0xe')]},'channel':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinename':{'type':Sequelize[_0x6e70('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6e70('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6e70('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e70('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6e70('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','DATE','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x49c4('0x0')]={'type':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x1')]},'calleridnum':{'type':Sequelize[_0x49c4('0x1')]},'calleridname':{'type':Sequelize[_0x49c4('0x1')]},'queue':{'type':Sequelize[_0x49c4('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x41a183){var _0x57effd=moment(_0x41a183);var _0xc1278f=moment(this[_0x49c4('0x2')](_0x49c4('0x3')))[_0x49c4('0x4')](_0x49c4('0x5'));var _0x511d53=_0x57effd[_0x49c4('0x6')](_0xc1278f,_0x49c4('0x7'));this[_0x49c4('0x8')](_0x49c4('0x9'),_0x41a183);this['setDataValue']('holdtime',_0x511d53||null);}},'position':{'type':Sequelize[_0x49c4('0xa')]},'count':{'type':Sequelize[_0x49c4('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x49c4('0xb')]},'queuecallercomplete':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x49c4('0xb')]},'queuecallerexitreason':{'type':Sequelize[_0x49c4('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x49c4('0xa')]},'channel':{'type':Sequelize[_0x49c4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x49c4('0x1')]},'accountcode':{'type':Sequelize[_0x49c4('0x1')]},'context':{'type':Sequelize[_0x49c4('0x1')]},'exten':{'type':Sequelize[_0x49c4('0x1')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0xa')]},'mohtime':{'type':Sequelize[_0x49c4('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x49c4('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x49c4('0x1')],'comment':_0x49c4('0xd')},'transferexten':{'type':Sequelize[_0x49c4('0x1')]},'transferuniqueid':{'type':Sequelize[_0x49c4('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x49c4('0x1')]},'thirdDisposition':{'type':Sequelize[_0x49c4('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 43ef934..1068b4f 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(_0xe2684e,_0x457bd7){var _0x4e4668=function(_0x49131c){while(--_0x49131c){_0xe2684e['push'](_0xe2684e['shift']());}};_0x4e4668(++_0x457bd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x4fcfb8,_0x1dc56a){var _0x1e03ef=function(_0x40d85f){while(--_0x40d85f){_0x4fcfb8['push'](_0x4fcfb8['shift']());}};_0x1e03ef(++_0x1dc56a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 7be1b59..9a1fe67 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 _0x3882=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','remove'];(function(_0x208718,_0x5cbbc0){var _0x3280e5=function(_0x2fc869){while(--_0x2fc869){_0x208718['push'](_0x208718['shift']());}};_0x3280e5(++_0x5cbbc0);}(_0x3882,0x69));var _0x2388=function(_0x2265c0,_0x24881e){_0x2265c0=_0x2265c0-0x0;var _0x27a246=_0x3882[_0x2265c0];return _0x27a246;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x2388('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2388('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2388('0x2')};function emitEvent(_0x77f567){return function(_0x5542ae,_0x4b0685,_0x388941){VoiceQueueReportEvents[_0x2388('0x3')](_0x77f567+':'+_0x5542ae['id'],_0x5542ae);VoiceQueueReportEvents[_0x2388('0x3')](_0x77f567,_0x5542ae);_0x388941(null);};}for(var e in events){if(events[_0x2388('0x4')](e)){var event=events[e];VoiceQueueReport[_0x2388('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xb5ea=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0xed0649,_0x5b2af2){var _0x4720b6=function(_0x251e15){while(--_0x251e15){_0xed0649['push'](_0xed0649['shift']());}};_0x4720b6(++_0x5b2af2);}(_0xb5ea,0x168));var _0xab5e=function(_0x4db5e8,_0x483e73){_0x4db5e8=_0x4db5e8-0x0;var _0x3f900b=_0xb5ea[_0x4db5e8];return _0x3f900b;};'use strict';var EventEmitter=require(_0xab5e('0x0'));var VoiceQueueReport=require(_0xab5e('0x1'))['db'][_0xab5e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xab5e('0x3')](0x0);var events={'afterCreate':_0xab5e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3049fc){return function(_0xd64877,_0x941800,_0x3cfb6c){VoiceQueueReportEvents[_0xab5e('0x5')](_0x3049fc+':'+_0xd64877['id'],_0xd64877);VoiceQueueReportEvents[_0xab5e('0x5')](_0x3049fc,_0xd64877);_0x3cfb6c(null);};}for(var e in events){if(events[_0xab5e('0x6')](e)){var event=events[e];VoiceQueueReport[_0xab5e('0x7')](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 6d512f5..ea52669 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x1c4e15,_0x1a29b4){var _0x475431=function(_0xad5d66){while(--_0xad5d66){_0x1c4e15['push'](_0x1c4e15['shift']());}};_0x475431(++_0x1a29b4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x2032,0xd9));var _0x2203=function(_0x4d5df3,_0x1f57a0){_0x4d5df3=_0x4d5df3-0x0;var _0x444f51=_0x2032[_0x4d5df3];return _0x444f51;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index bcdc639..92d2bd7 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 _0x8296=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','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','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring'];(function(_0x186847,_0x4b823a){var _0x57e29d=function(_0x155ca5){while(--_0x155ca5){_0x186847['push'](_0x186847['shift']());}};_0x57e29d(++_0x4b823a);}(_0x8296,0x1a9));var _0x6829=function(_0x4e806d,_0x4cc01d){_0x4e806d=_0x4e806d-0x0;var _0x20821f=_0x8296[_0x4e806d];return _0x20821f;};'use strict';var _=require(_0x6829('0x0'));var util=require(_0x6829('0x1'));var moment=require(_0x6829('0x2'));var BPromise=require(_0x6829('0x3'));var rs=require(_0x6829('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6829('0x5'))['db'];var utils=require(_0x6829('0x6'));var logger=require(_0x6829('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6829('0x8'));var client=jayson['client'][_0x6829('0x9')]({'port':0x232a});config['redis']=_[_0x6829('0xa')](config[_0x6829('0xb')],{'host':_0x6829('0xc'),'port':0x18eb});var socket=require(_0x6829('0xd'))(new Redis(config[_0x6829('0xb')]));require('./voiceQueueReport.socket')[_0x6829('0xe')](socket);function respondWithRpcPromise(_0x319f48,_0x31b77c,_0x373752){return new BPromise(function(_0x513c13,_0x114f56){return client[_0x6829('0xf')](_0x319f48,_0x373752)[_0x6829('0x10')](function(_0x427b5e){logger[_0x6829('0x11')](_0x6829('0x12'),_0x31b77c,_0x6829('0x13'));logger[_0x6829('0x14')](_0x6829('0x15'),_0x31b77c,_0x6829('0x13'),JSON[_0x6829('0x16')](_0x427b5e));if(_0x427b5e[_0x6829('0x17')]){if(_0x427b5e['error'][_0x6829('0x18')]===0x1f4){logger[_0x6829('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x31b77c,_0x427b5e['error'][_0x6829('0x19')]);return _0x114f56(_0x427b5e[_0x6829('0x17')][_0x6829('0x19')]);}logger[_0x6829('0x17')](_0x6829('0x12'),_0x31b77c,_0x427b5e[_0x6829('0x17')]['message']);return _0x513c13(_0x427b5e[_0x6829('0x17')][_0x6829('0x19')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x31b77c,_0x6829('0x13'));_0x513c13(_0x427b5e[_0x6829('0x1a')][_0x6829('0x19')]);}})[_0x6829('0x1b')](function(_0x3e9686){logger[_0x6829('0x17')](_0x6829('0x12'),_0x31b77c,_0x3e9686);_0x114f56(_0x3e9686);});});}exports[_0x6829('0x1c')]=function(_0x63f4c5){var _0x1f4d36=this;return new Promise(function(_0x36253e,_0x55dbe3){return db[_0x6829('0x1d')][_0x6829('0x1e')]({'raw':_0x63f4c5[_0x6829('0x1f')]?_0x63f4c5[_0x6829('0x1f')][_0x6829('0x20')]===undefined?!![]:![]:!![],'where':_0x63f4c5[_0x6829('0x1f')]?_0x63f4c5[_0x6829('0x1f')][_0x6829('0x21')]||null:null,'attributes':_0x63f4c5['options']?_0x63f4c5['options']['attributes']||null:null,'limit':_0x63f4c5['options']?_0x63f4c5['options'][_0x6829('0x22')]||null:null,'include':_0x63f4c5[_0x6829('0x1f')]?_0x63f4c5[_0x6829('0x1f')][_0x6829('0x23')]?_[_0x6829('0x24')](_0x63f4c5[_0x6829('0x1f')]['include'],function(_0x181894){return{'model':db[_0x181894[_0x6829('0x25')]],'as':_0x181894['as'],'attributes':_0x181894[_0x6829('0x26')],'include':_0x181894[_0x6829('0x23')]?_[_0x6829('0x24')](_0x181894['include'],function(_0x300c4e){return{'model':db[_0x300c4e[_0x6829('0x25')]],'as':_0x300c4e['as'],'attributes':_0x300c4e[_0x6829('0x26')],'include':_0x300c4e[_0x6829('0x23')]?_[_0x6829('0x24')](_0x300c4e[_0x6829('0x23')],function(_0x27004b){return{'model':db[_0x27004b[_0x6829('0x25')]],'as':_0x27004b['as'],'attributes':_0x27004b[_0x6829('0x26')]};}):[]};}):[]};}):[]:[]})[_0x6829('0x10')](function(_0x32a932){logger[_0x6829('0x11')](_0x6829('0x1c'),_0x63f4c5);logger[_0x6829('0x14')](_0x6829('0x1c'),_0x63f4c5,JSON['stringify'](_0x32a932));_0x36253e(_0x32a932);})[_0x6829('0x1b')](function(_0x2c0d2c){logger['error'](_0x6829('0x1c'),_0x2c0d2c[_0x6829('0x19')],_0x63f4c5);_0x55dbe3(_0x1f4d36['error'](0x1f4,_0x2c0d2c[_0x6829('0x19')]));});});};exports[_0x6829('0x27')]=function(_0x28980e){var _0x3c0cb8=this;return new Promise(function(_0x529e82,_0x5d62e5){return db['VoiceQueueReport']['create'](_0x28980e[_0x6829('0x28')],{'raw':_0x28980e['options']?_0x28980e[_0x6829('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x6829('0x10')](function(_0x4bed89){logger['info'](_0x6829('0x27'),_0x28980e);logger[_0x6829('0x14')](_0x6829('0x27'),_0x28980e,JSON['stringify'](_0x4bed89));_0x529e82(_0x4bed89);})[_0x6829('0x1b')](function(_0x37ccbf){logger[_0x6829('0x17')]('CreateVoiceQueueReport',_0x37ccbf['message'],_0x28980e);_0x5d62e5(_0x3c0cb8[_0x6829('0x17')](0x1f4,_0x37ccbf[_0x6829('0x19')]));});});};exports[_0x6829('0x29')]=function(_0x3e6513){var _0x4a56a3=this;return new Promise(function(_0x48e5f8,_0x2d206e){return db[_0x6829('0x1d')][_0x6829('0x2a')](_0x3e6513[_0x6829('0x28')],{'raw':_0x3e6513[_0x6829('0x1f')]?_0x3e6513['options'][_0x6829('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6513[_0x6829('0x1f')]?_0x3e6513['options']['where']||null:null,'attributes':_0x3e6513['options']?_0x3e6513[_0x6829('0x1f')]['attributes']||null:null,'limit':_0x3e6513[_0x6829('0x1f')]?_0x3e6513[_0x6829('0x1f')][_0x6829('0x22')]||null:null})[_0x6829('0x10')](function(_0x29f84a){logger[_0x6829('0x11')](_0x6829('0x29'),_0x3e6513);logger[_0x6829('0x14')](_0x6829('0x29'),_0x3e6513,JSON[_0x6829('0x16')](_0x29f84a));_0x48e5f8(_0x29f84a);})['catch'](function(_0x47ebde){logger[_0x6829('0x17')](_0x6829('0x29'),_0x47ebde['message'],_0x3e6513);_0x2d206e(_0x4a56a3[_0x6829('0x17')](0x1f4,_0x47ebde['message']));});});}; \ No newline at end of file +var _0x873a=['register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','stringify','update','body','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','./voiceQueueReport.socket'];(function(_0x2ed8fe,_0x237497){var _0x1ca92d=function(_0xf2f15c){while(--_0xf2f15c){_0x2ed8fe['push'](_0x2ed8fe['shift']());}};_0x1ca92d(++_0x237497);}(_0x873a,0x154));var _0xa873=function(_0xee0966,_0x2d49d2){_0xee0966=_0xee0966-0x0;var _0x39ef54=_0x873a[_0xee0966];return _0x39ef54;};'use strict';var _=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa873('0x2'));var fs=require('fs');var Redis=require(_0xa873('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa873('0x4'));var logger=require(_0xa873('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa873('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xa873('0x7')]=_[_0xa873('0x8')](config[_0xa873('0x7')],{'host':_0xa873('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa873('0xa'))[_0xa873('0xb')](socket);function respondWithRpcPromise(_0x1ca8f0,_0x2960d1,_0x578858){return new BPromise(function(_0x25d30d,_0xb7f917){return client[_0xa873('0xc')](_0x1ca8f0,_0x578858)[_0xa873('0xd')](function(_0x382390){logger[_0xa873('0xe')](_0xa873('0xf'),_0x2960d1,_0xa873('0x10'));logger['debug'](_0xa873('0x11'),_0x2960d1,_0xa873('0x10'),JSON['stringify'](_0x382390));if(_0x382390[_0xa873('0x12')]){if(_0x382390[_0xa873('0x12')][_0xa873('0x13')]===0x1f4){logger[_0xa873('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x2960d1,_0x382390[_0xa873('0x12')][_0xa873('0x14')]);return _0xb7f917(_0x382390[_0xa873('0x12')][_0xa873('0x14')]);}logger[_0xa873('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x2960d1,_0x382390[_0xa873('0x12')][_0xa873('0x14')]);return _0x25d30d(_0x382390['error'][_0xa873('0x14')]);}else{logger[_0xa873('0xe')](_0xa873('0xf'),_0x2960d1,_0xa873('0x10'));_0x25d30d(_0x382390[_0xa873('0x15')]['message']);}})[_0xa873('0x16')](function(_0x426ffd){logger['error'](_0xa873('0xf'),_0x2960d1,_0x426ffd);_0xb7f917(_0x426ffd);});});}exports[_0xa873('0x17')]=function(_0x5155ba){var _0x149433=this;return new Promise(function(_0x391466,_0x444a35){return db[_0xa873('0x18')]['findAll']({'raw':_0x5155ba[_0xa873('0x19')]?_0x5155ba[_0xa873('0x19')][_0xa873('0x1a')]===undefined?!![]:![]:!![],'where':_0x5155ba['options']?_0x5155ba[_0xa873('0x19')][_0xa873('0x1b')]||null:null,'attributes':_0x5155ba[_0xa873('0x19')]?_0x5155ba[_0xa873('0x19')][_0xa873('0x1c')]||null:null,'limit':_0x5155ba['options']?_0x5155ba[_0xa873('0x19')][_0xa873('0x1d')]||null:null,'include':_0x5155ba[_0xa873('0x19')]?_0x5155ba[_0xa873('0x19')]['include']?_[_0xa873('0x1e')](_0x5155ba[_0xa873('0x19')][_0xa873('0x1f')],function(_0x3d0b0a){return{'model':db[_0x3d0b0a[_0xa873('0x20')]],'as':_0x3d0b0a['as'],'attributes':_0x3d0b0a[_0xa873('0x1c')],'include':_0x3d0b0a[_0xa873('0x1f')]?_['map'](_0x3d0b0a[_0xa873('0x1f')],function(_0x33cbd7){return{'model':db[_0x33cbd7[_0xa873('0x20')]],'as':_0x33cbd7['as'],'attributes':_0x33cbd7[_0xa873('0x1c')],'include':_0x33cbd7[_0xa873('0x1f')]?_[_0xa873('0x1e')](_0x33cbd7[_0xa873('0x1f')],function(_0x9ea420){return{'model':db[_0x9ea420[_0xa873('0x20')]],'as':_0x9ea420['as'],'attributes':_0x9ea420[_0xa873('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa873('0xd')](function(_0x3a47a1){logger[_0xa873('0xe')]('GetVoiceQueueReport',_0x5155ba);logger[_0xa873('0x21')]('GetVoiceQueueReport',_0x5155ba,JSON['stringify'](_0x3a47a1));_0x391466(_0x3a47a1);})[_0xa873('0x16')](function(_0x274b2d){logger['error']('GetVoiceQueueReport',_0x274b2d['message'],_0x5155ba);_0x444a35(_0x149433[_0xa873('0x12')](0x1f4,_0x274b2d['message']));});});};exports[_0xa873('0x22')]=function(_0x570d76){var _0x1227b7=this;return new Promise(function(_0x2ae6ba,_0x5a61d3){return db['VoiceQueueReport']['create'](_0x570d76['body'],{'raw':_0x570d76[_0xa873('0x19')]?_0x570d76[_0xa873('0x19')][_0xa873('0x1a')]===undefined?!![]:![]:!![]})[_0xa873('0xd')](function(_0x41ea58){logger['info'](_0xa873('0x22'),_0x570d76);logger[_0xa873('0x21')](_0xa873('0x22'),_0x570d76,JSON[_0xa873('0x23')](_0x41ea58));_0x2ae6ba(_0x41ea58);})[_0xa873('0x16')](function(_0x18fd30){logger['error'](_0xa873('0x22'),_0x18fd30[_0xa873('0x14')],_0x570d76);_0x5a61d3(_0x1227b7[_0xa873('0x12')](0x1f4,_0x18fd30['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x314c5a){var _0x360db0=this;return new Promise(function(_0xbaebb4,_0x119415){return db[_0xa873('0x18')][_0xa873('0x24')](_0x314c5a[_0xa873('0x25')],{'raw':_0x314c5a[_0xa873('0x19')]?_0x314c5a[_0xa873('0x19')][_0xa873('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x314c5a['options']?_0x314c5a['options']['where']||null:null,'attributes':_0x314c5a['options']?_0x314c5a[_0xa873('0x19')][_0xa873('0x1c')]||null:null,'limit':_0x314c5a[_0xa873('0x19')]?_0x314c5a['options']['limit']||null:null})['then'](function(_0x428ef2){logger['info']('UpdateVoiceQueueReport',_0x314c5a);logger[_0xa873('0x21')](_0xa873('0x26'),_0x314c5a,JSON[_0xa873('0x23')](_0x428ef2));_0xbaebb4(_0x428ef2);})[_0xa873('0x16')](function(_0x130dcc){logger['error'](_0xa873('0x26'),_0x130dcc[_0xa873('0x14')],_0x314c5a);_0x119415(_0x360db0['error'](0x1f4,_0x130dcc[_0xa873('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 69f1939..6987385 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 _0x1931=['update','emit','removeListener','length','voiceQueueReport:'];(function(_0x7bfab4,_0x92e7b0){var _0x2df1bd=function(_0x2d85f6){while(--_0x2d85f6){_0x7bfab4['push'](_0x7bfab4['shift']());}};_0x2df1bd(++_0x92e7b0);}(_0x1931,0x6e));var _0x1193=function(_0x48ddba,_0x4344c9){_0x48ddba=_0x48ddba-0x0;var _0x260f2f=_0x1931[_0x48ddba];return _0x260f2f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove',_0x1193('0x0')];function createListener(_0x483b55,_0x52d8a4){return function(_0x46c6de){_0x52d8a4[_0x1193('0x1')](_0x483b55,_0x46c6de);};}function removeListener(_0x594fc5,_0x2dab83){return function(){VoiceQueueReportEvents[_0x1193('0x2')](_0x594fc5,_0x2dab83);};}exports['register']=function(_0x16c761){for(var _0x63eaf3=0x0,_0x4eb90d=events[_0x1193('0x3')];_0x63eaf3<_0x4eb90d;_0x63eaf3++){var _0x57b0f8=events[_0x63eaf3];var _0x3ca344=createListener(_0x1193('0x4')+_0x57b0f8,_0x16c761);VoiceQueueReportEvents['on'](_0x57b0f8,_0x3ca344);}}; \ No newline at end of file +var _0xd2b6=['remove','update','emit','removeListener','register','length','save'];(function(_0x1d895d,_0x3e5c93){var _0x2dae23=function(_0x443cd0){while(--_0x443cd0){_0x1d895d['push'](_0x1d895d['shift']());}};_0x2dae23(++_0x3e5c93);}(_0xd2b6,0xb5));var _0x6d2b=function(_0x17bf8c,_0x2a85ca){_0x17bf8c=_0x17bf8c-0x0;var _0x377466=_0xd2b6[_0x17bf8c];return _0x377466;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x6d2b('0x0'),_0x6d2b('0x1'),_0x6d2b('0x2')];function createListener(_0x258970,_0x3fc861){return function(_0x481101){_0x3fc861[_0x6d2b('0x3')](_0x258970,_0x481101);};}function removeListener(_0x217555,_0x2f623f){return function(){VoiceQueueReportEvents[_0x6d2b('0x4')](_0x217555,_0x2f623f);};}exports[_0x6d2b('0x5')]=function(_0xb92944){for(var _0x1646d0=0x0,_0x595bc6=events[_0x6d2b('0x6')];_0x1646d0<_0x595bc6;_0x1646d0++){var _0x43d9db=events[_0x1646d0];var _0x3f1ad1=createListener('voiceQueueReport:'+_0x43d9db,_0xb92944);VoiceQueueReportEvents['on'](_0x43d9db,_0x3f1ad1);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6b7e8cc..755b0e0 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 _0xf2ee=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','multer','util','express','Router','../../components/auth/service'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xf2ee,0x182));var _0xef2e=function(_0x3144d5,_0x56d504){_0x3144d5=_0x3144d5-0x0;var _0x4c0db2=_0xf2ee[_0x3144d5];return _0x4c0db2;};'use strict';var multer=require(_0xef2e('0x0'));var util=require(_0xef2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xef2e('0x2'));var router=express[_0xef2e('0x3')]();var auth=require(_0xef2e('0x4'));var interaction=require(_0xef2e('0x5'));var config=require(_0xef2e('0x6'));var controller=require(_0xef2e('0x7'));router['get']('/',auth[_0xef2e('0x8')](),controller[_0xef2e('0x9')]);router[_0xef2e('0xa')](_0xef2e('0xb'),auth['isAuthenticated'](),controller[_0xef2e('0xc')]);router['post']('/',auth[_0xef2e('0x8')](),controller[_0xef2e('0xd')]);router[_0xef2e('0xe')](_0xef2e('0xb'),auth['isAuthenticated'](),controller[_0xef2e('0xf')]);router[_0xef2e('0x10')]('/:id',auth[_0xef2e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0ef1=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x110a73,_0x5ce71b){var _0x359e2a=function(_0xf31e52){while(--_0xf31e52){_0x110a73['push'](_0x110a73['shift']());}};_0x359e2a(++_0x5ce71b);}(_0x0ef1,0xa9));var _0x10ef=function(_0xdb7497,_0x3d5729){_0xdb7497=_0xdb7497-0x0;var _0x1defb1=_0x0ef1[_0xdb7497];return _0x1defb1;};'use strict';var multer=require(_0x10ef('0x0'));var util=require(_0x10ef('0x1'));var path=require(_0x10ef('0x2'));var timeout=require(_0x10ef('0x3'));var express=require(_0x10ef('0x4'));var router=express[_0x10ef('0x5')]();var auth=require(_0x10ef('0x6'));var interaction=require(_0x10ef('0x7'));var config=require(_0x10ef('0x8'));var controller=require(_0x10ef('0x9'));router[_0x10ef('0xa')]('/',auth[_0x10ef('0xb')](),controller[_0x10ef('0xc')]);router['get'](_0x10ef('0xd'),auth['isAuthenticated'](),controller[_0x10ef('0xe')]);router[_0x10ef('0xf')]('/',auth[_0x10ef('0xb')](),controller[_0x10ef('0x10')]);router['put'](_0x10ef('0xd'),auth[_0x10ef('0xb')](),controller[_0x10ef('0x11')]);router[_0x10ef('0x12')](_0x10ef('0xd'),auth[_0x10ef('0xb')](),controller[_0x10ef('0x13')]);module[_0x10ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3ec3f53..fff6d6f 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 _0x07ba=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','DATE'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0x07ba,0x1ba));var _0xa07b=function(_0x1fe1fe,_0x20f8e5){_0x1fe1fe=_0x1fe1fe-0x0;var _0x574788=_0x07ba[_0x1fe1fe];return _0x574788;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xa07b('0x0')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa07b('0x1')],'allowNull':![],'defaultValue':moment()[_0xa07b('0x2')](_0xa07b('0x3'))}}; \ No newline at end of file +var _0x31ad=['sequelize','moment','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3d71ba,_0x49a38b){var _0x5e0ed0=function(_0x4d0bfb){while(--_0x4d0bfb){_0x3d71ba['push'](_0x3d71ba['shift']());}};_0x5e0ed0(++_0x49a38b);}(_0x31ad,0xd2));var _0xd31a=function(_0x2a6139,_0x52b544){_0x2a6139=_0x2a6139-0x0;var _0x1f7400=_0x31ad[_0x2a6139];return _0x1f7400;};'use strict';var Sequelize=require(_0xd31a('0x0'));var moment=require(_0xd31a('0x1'));module['exports']={'time':{'type':Sequelize[_0xd31a('0x2')]},'callid':{'type':Sequelize[_0xd31a('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd31a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd31a('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd31a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd31a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd31a('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd31a('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd31a('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0xd31a('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c191ff1..af883d6 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 _0xae5a=['hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1b6264,_0x492f31){var _0x356918=function(_0x2c489d){while(--_0x2c489d){_0x1b6264['push'](_0x1b6264['shift']());}};_0x356918(++_0x492f31);}(_0xae5a,0x189));var _0xaae5=function(_0x2bcf12,_0x4d34d0){_0x2bcf12=_0x2bcf12-0x0;var _0x355afc=_0xae5a[_0x2bcf12];return _0x355afc;};'use strict';var pdf=require(_0xaae5('0x0'));var emlformat=require(_0xaae5('0x1'));var rimraf=require(_0xaae5('0x2'));var zipdir=require(_0xaae5('0x3'));var jsonpatch=require(_0xaae5('0x4'));var rp=require(_0xaae5('0x5'));var moment=require(_0xaae5('0x6'));var BPromise=require(_0xaae5('0x7'));var Mustache=require(_0xaae5('0x8'));var util=require(_0xaae5('0x9'));var path=require('path');var sox=require(_0xaae5('0xa'));var csv=require(_0xaae5('0xb'));var ejs=require(_0xaae5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaae5('0xd'));var crypto=require(_0xaae5('0xe'));var jsforce=require(_0xaae5('0xf'));var deskjs=require(_0xaae5('0x10'));var toCsv=require(_0xaae5('0xb'));var querystring=require(_0xaae5('0x11'));var Papa=require('papaparse');var Redis=require(_0xaae5('0x12'));var authService=require(_0xaae5('0x13'));var qs=require(_0xaae5('0x14'));var as=require(_0xaae5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaae5('0x16'));var utils=require(_0xaae5('0x17'));var config=require(_0xaae5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaae5('0x19'))['db'];function respondWithStatusCode(_0x5bb109,_0x4ae09d){_0x4ae09d=_0x4ae09d||0xcc;return function(_0x29f82c){if(_0x29f82c){return _0x5bb109['sendStatus'](_0x4ae09d);}return _0x5bb109[_0xaae5('0x1a')](_0x4ae09d)['end']();};}function respondWithResult(_0x18f1e3,_0x59eaa1){_0x59eaa1=_0x59eaa1||0xc8;return function(_0x4bd46a){if(_0x4bd46a){return _0x18f1e3['status'](_0x59eaa1)['json'](_0x4bd46a);}};}function respondWithFilteredResult(_0x4c19f1,_0x1311d8){return function(_0x11e53c){if(_0x11e53c){var _0x30e86f=_0x11e53c[_0xaae5('0x1b')],_0x4d9daa=_0x1311d8[_0xaae5('0x1c')],_0x22a759=_0x1311d8[_0xaae5('0x1c')]+_0x1311d8[_0xaae5('0x1d')],_0x4bd879;if(_0x22a759>=_0x30e86f){_0x22a759=_0x30e86f;_0x4bd879=0xc8;}else{_0x4bd879=0xce;}_0x4c19f1[_0xaae5('0x1a')](_0x4bd879);return _0x4c19f1[_0xaae5('0x1e')](_0xaae5('0x1f'),_0x4d9daa+'-'+_0x22a759+'/'+_0x30e86f)['json'](_0x11e53c);}return null;};}function patchUpdates(_0x14b2f2){return function(_0x416829){try{jsonpatch[_0xaae5('0x20')](_0x416829,_0x14b2f2,!![]);}catch(_0x369b92){return BPromise[_0xaae5('0x21')](_0x369b92);}return _0x416829[_0xaae5('0x22')]();};}function saveUpdates(_0x28f04a,_0x6c9048){return function(_0xcb8e47){if(_0xcb8e47){return _0xcb8e47[_0xaae5('0x23')](_0x28f04a)[_0xaae5('0x24')](function(_0x57808d){return _0x57808d;});}return null;};}function removeEntity(_0x5afe4c,_0x126292){return function(_0x569d3b){if(_0x569d3b){return _0x569d3b['destroy']()[_0xaae5('0x24')](function(){_0x5afe4c[_0xaae5('0x1a')](0xcc)[_0xaae5('0x25')]();});}};}function handleEntityNotFound(_0x2c5ce9,_0x125613){return function(_0x3c0575){if(!_0x3c0575){_0x2c5ce9[_0xaae5('0x26')](0x194);}return _0x3c0575;};}function handleError(_0x129185,_0x277b1f){_0x277b1f=_0x277b1f||0x1f4;return function(_0x493593){logger[_0xaae5('0x27')](_0x493593[_0xaae5('0x28')]);if(_0x493593['name']){delete _0x493593[_0xaae5('0x29')];}_0x129185[_0xaae5('0x1a')](_0x277b1f)[_0xaae5('0x2a')](_0x493593);};}exports[_0xaae5('0x2b')]=function(_0xcd6855,_0x3336ee){var _0x115220={},_0x29c324={},_0x17594f={'count':0x0,'rows':[]};var _0x434d34=_[_0xaae5('0x2c')](db[_0xaae5('0x2d')][_0xaae5('0x2e')],function(_0x416145){return{'name':_0x416145['fieldName'],'type':_0x416145[_0xaae5('0x2f')][_0xaae5('0x30')]};});_0x29c324[_0xaae5('0x31')]=_[_0xaae5('0x2c')](_0x434d34,_0xaae5('0x29'));_0x29c324[_0xaae5('0x32')]=_[_0xaae5('0x33')](_0xcd6855[_0xaae5('0x32')]);_0x29c324[_0xaae5('0x34')]=_[_0xaae5('0x35')](_0x29c324[_0xaae5('0x31')],_0x29c324[_0xaae5('0x32')]);_0x115220[_0xaae5('0x36')]=_[_0xaae5('0x35')](_0x29c324[_0xaae5('0x31')],qs['fields'](_0xcd6855[_0xaae5('0x32')][_0xaae5('0x37')]));_0x115220[_0xaae5('0x36')]=_0x115220[_0xaae5('0x36')][_0xaae5('0x38')]?_0x115220[_0xaae5('0x36')]:_0x29c324['model'];if(!_0xcd6855[_0xaae5('0x32')][_0xaae5('0x39')](_0xaae5('0x3a'))){_0x115220[_0xaae5('0x1d')]=qs[_0xaae5('0x1d')](_0xcd6855[_0xaae5('0x32')][_0xaae5('0x1d')]);_0x115220['offset']=qs[_0xaae5('0x1c')](_0xcd6855[_0xaae5('0x32')][_0xaae5('0x1c')]);}_0x115220[_0xaae5('0x3b')]=qs['sort'](_0xcd6855['query']['sort']);_0x115220['where']=qs[_0xaae5('0x34')](_['pick'](_0xcd6855[_0xaae5('0x32')],_0x29c324[_0xaae5('0x34')]),_0x434d34);if(_0xcd6855[_0xaae5('0x32')][_0xaae5('0x3c')]){_0x115220[_0xaae5('0x3d')]=_['merge'](_0x115220[_0xaae5('0x3d')],{'$or':_[_0xaae5('0x2c')](_0x434d34,function(_0x3fe572){if(_0x3fe572[_0xaae5('0x2f')]!==_0xaae5('0x3e')){var _0x229ee4={};_0x229ee4[_0x3fe572[_0xaae5('0x29')]]={'$like':'%'+_0xcd6855[_0xaae5('0x32')][_0xaae5('0x3c')]+'%'};return _0x229ee4;}})});}_0x115220=_[_0xaae5('0x3f')]({},_0x115220,_0xcd6855[_0xaae5('0x40')]);var _0x2b8f24={'where':_0x115220[_0xaae5('0x3d')]};return db[_0xaae5('0x2d')][_0xaae5('0x1b')](_0x2b8f24)['then'](function(_0x5a7379){_0x17594f['count']=_0x5a7379;if(_0xcd6855['query'][_0xaae5('0x41')]){_0x115220['include']=[{'all':!![]}];}return db[_0xaae5('0x2d')][_0xaae5('0x42')](_0x115220);})['then'](function(_0x1a3bd4){_0x17594f[_0xaae5('0x43')]=_0x1a3bd4;return _0x17594f;})[_0xaae5('0x24')](respondWithFilteredResult(_0x3336ee,_0x115220))[_0xaae5('0x44')](handleError(_0x3336ee,null));};exports[_0xaae5('0x45')]=function(_0x64fb8e,_0x893716){var _0x4f8566={'raw':!![],'where':{'id':_0x64fb8e[_0xaae5('0x46')]['id']}},_0x875c96={};_0x875c96[_0xaae5('0x31')]=_['keys'](db[_0xaae5('0x2d')][_0xaae5('0x2e')]);_0x875c96[_0xaae5('0x32')]=_[_0xaae5('0x33')](_0x64fb8e[_0xaae5('0x32')]);_0x875c96[_0xaae5('0x34')]=_[_0xaae5('0x35')](_0x875c96[_0xaae5('0x31')],_0x875c96[_0xaae5('0x32')]);_0x4f8566[_0xaae5('0x36')]=_[_0xaae5('0x35')](_0x875c96[_0xaae5('0x31')],qs['fields'](_0x64fb8e[_0xaae5('0x32')]['fields']));_0x4f8566['attributes']=_0x4f8566['attributes'][_0xaae5('0x38')]?_0x4f8566['attributes']:_0x875c96[_0xaae5('0x31')];if(_0x64fb8e[_0xaae5('0x32')][_0xaae5('0x41')]){_0x4f8566[_0xaae5('0x47')]=[{'all':!![]}];}_0x4f8566=_[_0xaae5('0x3f')]({},_0x4f8566,_0x64fb8e[_0xaae5('0x40')]);return db[_0xaae5('0x2d')][_0xaae5('0x48')](_0x4f8566)[_0xaae5('0x24')](handleEntityNotFound(_0x893716,null))[_0xaae5('0x24')](respondWithResult(_0x893716,null))[_0xaae5('0x44')](handleError(_0x893716,null));};exports['create']=function(_0x2f4b49,_0x36950f){return db[_0xaae5('0x2d')][_0xaae5('0x49')](_0x2f4b49[_0xaae5('0x4a')],{})[_0xaae5('0x24')](respondWithResult(_0x36950f,0xc9))[_0xaae5('0x44')](handleError(_0x36950f,null));};exports[_0xaae5('0x23')]=function(_0x51f273,_0x3b911a){if(_0x51f273[_0xaae5('0x4a')]['id']){delete _0x51f273[_0xaae5('0x4a')]['id'];}return db[_0xaae5('0x2d')][_0xaae5('0x48')]({'where':{'id':_0x51f273['params']['id']}})[_0xaae5('0x24')](handleEntityNotFound(_0x3b911a,null))['then'](saveUpdates(_0x51f273[_0xaae5('0x4a')],null))[_0xaae5('0x24')](respondWithResult(_0x3b911a,null))[_0xaae5('0x44')](handleError(_0x3b911a,null));};exports['destroy']=function(_0x25a908,_0x2fe1e4){return db[_0xaae5('0x2d')]['find']({'where':{'id':_0x25a908[_0xaae5('0x46')]['id']}})[_0xaae5('0x24')](handleEntityNotFound(_0x2fe1e4,null))['then'](removeEntity(_0x2fe1e4,null))[_0xaae5('0x44')](handleError(_0x2fe1e4,null));}; \ No newline at end of file +var _0x2d83=['filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','VoiceQueuesLog','fieldName','type','key','map','query','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2d83,0x1ca));var _0x32d8=function(_0x3e386d,_0x1a23a3){_0x3e386d=_0x3e386d-0x0;var _0x1f43a4=_0x2d83[_0x3e386d];return _0x1f43a4;};'use strict';var pdf=require(_0x32d8('0x0'));var emlformat=require(_0x32d8('0x1'));var rimraf=require(_0x32d8('0x2'));var zipdir=require(_0x32d8('0x3'));var jsonpatch=require(_0x32d8('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x32d8('0x5'));var Mustache=require(_0x32d8('0x6'));var util=require(_0x32d8('0x7'));var path=require(_0x32d8('0x8'));var sox=require(_0x32d8('0x9'));var csv=require(_0x32d8('0xa'));var ejs=require(_0x32d8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32d8('0xc'));var crypto=require(_0x32d8('0xd'));var jsforce=require(_0x32d8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x32d8('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x32d8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32d8('0x10'));var hardwareService=require(_0x32d8('0x11'));var logger=require(_0x32d8('0x12'))(_0x32d8('0x13'));var utils=require('../../config/utils');var config=require(_0x32d8('0x14'));var licenseUtil=require(_0x32d8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x400f66,_0x100557){_0x100557=_0x100557||0xcc;return function(_0x38adaf){if(_0x38adaf){return _0x400f66[_0x32d8('0x16')](_0x100557);}return _0x400f66[_0x32d8('0x17')](_0x100557)[_0x32d8('0x18')]();};}function respondWithResult(_0x5df4fb,_0x522d14){_0x522d14=_0x522d14||0xc8;return function(_0x1c5104){if(_0x1c5104){return _0x5df4fb[_0x32d8('0x17')](_0x522d14)[_0x32d8('0x19')](_0x1c5104);}};}function respondWithFilteredResult(_0x300e26,_0x3430e6){return function(_0x155fbd){if(_0x155fbd){var _0x34ab37=_0x155fbd[_0x32d8('0x1a')],_0x28a1f8=_0x3430e6[_0x32d8('0x1b')],_0x16d993=_0x3430e6[_0x32d8('0x1b')]+_0x3430e6[_0x32d8('0x1c')],_0x50fb6a;if(_0x16d993>=_0x34ab37){_0x16d993=_0x34ab37;_0x50fb6a=0xc8;}else{_0x50fb6a=0xce;}_0x300e26[_0x32d8('0x17')](_0x50fb6a);return _0x300e26[_0x32d8('0x1d')](_0x32d8('0x1e'),_0x28a1f8+'-'+_0x16d993+'/'+_0x34ab37)['json'](_0x155fbd);}return null;};}function patchUpdates(_0x3f7850){return function(_0x3ccab2){try{jsonpatch[_0x32d8('0x1f')](_0x3ccab2,_0x3f7850,!![]);}catch(_0x58d382){return BPromise[_0x32d8('0x20')](_0x58d382);}return _0x3ccab2['save']();};}function saveUpdates(_0x46d916,_0x1b66c0){return function(_0x52c782){if(_0x52c782){return _0x52c782[_0x32d8('0x21')](_0x46d916)[_0x32d8('0x22')](function(_0x4bd13c){return _0x4bd13c;});}return null;};}function removeEntity(_0xd952ed,_0x5e1997){return function(_0x2251ff){if(_0x2251ff){return _0x2251ff[_0x32d8('0x23')]()[_0x32d8('0x22')](function(){_0xd952ed[_0x32d8('0x17')](0xcc)[_0x32d8('0x18')]();});}};}function handleEntityNotFound(_0x3dda83,_0x37bddd){return function(_0x18abba){if(!_0x18abba){_0x3dda83[_0x32d8('0x16')](0x194);}return _0x18abba;};}function handleError(_0x108861,_0x2e90aa){_0x2e90aa=_0x2e90aa||0x1f4;return function(_0x339ea8){logger['error'](_0x339ea8[_0x32d8('0x24')]);if(_0x339ea8[_0x32d8('0x25')]){delete _0x339ea8[_0x32d8('0x25')];}_0x108861[_0x32d8('0x17')](_0x2e90aa)[_0x32d8('0x26')](_0x339ea8);};}exports['index']=function(_0x26fe5b,_0x18abec){var _0xdf714={},_0x16c4ad={},_0x621ef5={'count':0x0,'rows':[]};var _0x56c863=_['map'](db[_0x32d8('0x27')]['rawAttributes'],function(_0xb4e6b7){return{'name':_0xb4e6b7[_0x32d8('0x28')],'type':_0xb4e6b7[_0x32d8('0x29')][_0x32d8('0x2a')]};});_0x16c4ad['model']=_[_0x32d8('0x2b')](_0x56c863,_0x32d8('0x25'));_0x16c4ad[_0x32d8('0x2c')]=_[_0x32d8('0x2d')](_0x26fe5b[_0x32d8('0x2c')]);_0x16c4ad[_0x32d8('0x2e')]=_[_0x32d8('0x2f')](_0x16c4ad['model'],_0x16c4ad['query']);_0xdf714[_0x32d8('0x30')]=_[_0x32d8('0x2f')](_0x16c4ad[_0x32d8('0x31')],qs[_0x32d8('0x32')](_0x26fe5b[_0x32d8('0x2c')][_0x32d8('0x32')]));_0xdf714[_0x32d8('0x30')]=_0xdf714[_0x32d8('0x30')][_0x32d8('0x33')]?_0xdf714[_0x32d8('0x30')]:_0x16c4ad[_0x32d8('0x31')];if(!_0x26fe5b[_0x32d8('0x2c')][_0x32d8('0x34')](_0x32d8('0x35'))){_0xdf714[_0x32d8('0x1c')]=qs[_0x32d8('0x1c')](_0x26fe5b[_0x32d8('0x2c')][_0x32d8('0x1c')]);_0xdf714[_0x32d8('0x1b')]=qs[_0x32d8('0x1b')](_0x26fe5b[_0x32d8('0x2c')]['offset']);}_0xdf714[_0x32d8('0x36')]=qs[_0x32d8('0x37')](_0x26fe5b[_0x32d8('0x2c')][_0x32d8('0x37')]);_0xdf714[_0x32d8('0x38')]=qs[_0x32d8('0x2e')](_[_0x32d8('0x39')](_0x26fe5b[_0x32d8('0x2c')],_0x16c4ad[_0x32d8('0x2e')]),_0x56c863);if(_0x26fe5b[_0x32d8('0x2c')][_0x32d8('0x3a')]){_0xdf714['where']=_[_0x32d8('0x3b')](_0xdf714[_0x32d8('0x38')],{'$or':_[_0x32d8('0x2b')](_0x56c863,function(_0x3187d6){if(_0x3187d6[_0x32d8('0x29')]!==_0x32d8('0x3c')){var _0x43a140={};_0x43a140[_0x3187d6[_0x32d8('0x25')]]={'$like':'%'+_0x26fe5b[_0x32d8('0x2c')][_0x32d8('0x3a')]+'%'};return _0x43a140;}})});}_0xdf714=_[_0x32d8('0x3b')]({},_0xdf714,_0x26fe5b[_0x32d8('0x3d')]);var _0x81151e={'where':_0xdf714[_0x32d8('0x38')]};return db[_0x32d8('0x27')][_0x32d8('0x1a')](_0x81151e)[_0x32d8('0x22')](function(_0x405312){_0x621ef5[_0x32d8('0x1a')]=_0x405312;if(_0x26fe5b[_0x32d8('0x2c')]['includeAll']){_0xdf714[_0x32d8('0x3e')]=[{'all':!![]}];}return db[_0x32d8('0x27')][_0x32d8('0x3f')](_0xdf714);})[_0x32d8('0x22')](function(_0xf3393a){_0x621ef5[_0x32d8('0x40')]=_0xf3393a;return _0x621ef5;})[_0x32d8('0x22')](respondWithFilteredResult(_0x18abec,_0xdf714))[_0x32d8('0x41')](handleError(_0x18abec,null));};exports[_0x32d8('0x42')]=function(_0x42db02,_0x59cd7b){var _0x23e055={'raw':!![],'where':{'id':_0x42db02[_0x32d8('0x43')]['id']}},_0x2a52cb={};_0x2a52cb['model']=_[_0x32d8('0x2d')](db['VoiceQueuesLog']['rawAttributes']);_0x2a52cb[_0x32d8('0x2c')]=_['keys'](_0x42db02[_0x32d8('0x2c')]);_0x2a52cb['filters']=_[_0x32d8('0x2f')](_0x2a52cb['model'],_0x2a52cb[_0x32d8('0x2c')]);_0x23e055[_0x32d8('0x30')]=_[_0x32d8('0x2f')](_0x2a52cb[_0x32d8('0x31')],qs[_0x32d8('0x32')](_0x42db02[_0x32d8('0x2c')][_0x32d8('0x32')]));_0x23e055['attributes']=_0x23e055[_0x32d8('0x30')][_0x32d8('0x33')]?_0x23e055['attributes']:_0x2a52cb[_0x32d8('0x31')];if(_0x42db02[_0x32d8('0x2c')][_0x32d8('0x44')]){_0x23e055[_0x32d8('0x3e')]=[{'all':!![]}];}_0x23e055=_['merge']({},_0x23e055,_0x42db02[_0x32d8('0x3d')]);return db[_0x32d8('0x27')][_0x32d8('0x45')](_0x23e055)[_0x32d8('0x22')](handleEntityNotFound(_0x59cd7b,null))[_0x32d8('0x22')](respondWithResult(_0x59cd7b,null))[_0x32d8('0x41')](handleError(_0x59cd7b,null));};exports[_0x32d8('0x46')]=function(_0x1718af,_0xccb426){return db[_0x32d8('0x27')][_0x32d8('0x46')](_0x1718af[_0x32d8('0x47')],{})[_0x32d8('0x22')](respondWithResult(_0xccb426,0xc9))['catch'](handleError(_0xccb426,null));};exports[_0x32d8('0x21')]=function(_0x323682,_0x3ab035){if(_0x323682[_0x32d8('0x47')]['id']){delete _0x323682[_0x32d8('0x47')]['id'];}return db[_0x32d8('0x27')][_0x32d8('0x45')]({'where':{'id':_0x323682[_0x32d8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ab035,null))[_0x32d8('0x22')](saveUpdates(_0x323682['body'],null))[_0x32d8('0x22')](respondWithResult(_0x3ab035,null))['catch'](handleError(_0x3ab035,null));};exports['destroy']=function(_0x18b169,_0x3877f3){return db[_0x32d8('0x27')]['find']({'where':{'id':_0x18b169[_0x32d8('0x43')]['id']}})[_0x32d8('0x22')](handleEntityNotFound(_0x3877f3,null))[_0x32d8('0x22')](removeEntity(_0x3877f3,null))['catch'](handleError(_0x3877f3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9ad66f7..7a67147 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 _0x9f06=['util','api','moment','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','dtm'];(function(_0x459349,_0x2e6797){var _0x35de00=function(_0x1f5a19){while(--_0x1f5a19){_0x459349['push'](_0x459349['shift']());}};_0x35de00(++_0x2e6797);}(_0x9f06,0x6c));var _0x69f0=function(_0x1a68dd,_0x30475d){_0x1a68dd=_0x1a68dd-0x0;var _0x45b421=_0x9f06[_0x1a68dd];return _0x45b421;};'use strict';var _=require('lodash');var util=require(_0x69f0('0x0'));var logger=require('../../config/logger')(_0x69f0('0x1'));var moment=require(_0x69f0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x69f0('0x3'));var rimraf=require(_0x69f0('0x4'));var config=require(_0x69f0('0x5'));var attributes=require(_0x69f0('0x6'));module[_0x69f0('0x7')]=function(_0x1a4cca,_0x2e5695){return _0x1a4cca['define'](_0x69f0('0x8'),attributes,{'tableName':_0x69f0('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x69f0('0xa'),_0x69f0('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd508=['event_dtm','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog'];(function(_0x84a51,_0x1a5d00){var _0x2f4a8f=function(_0x3fa29d){while(--_0x3fa29d){_0x84a51['push'](_0x84a51['shift']());}};_0x2f4a8f(++_0x1a5d00);}(_0xd508,0x15b));var _0x8d50=function(_0x563b69,_0x37121a){_0x563b69=_0x563b69-0x0;var _0x29060b=_0xd508[_0x563b69];return _0x29060b;};'use strict';var _=require(_0x8d50('0x0'));var util=require(_0x8d50('0x1'));var logger=require(_0x8d50('0x2'))('api');var moment=require(_0x8d50('0x3'));var BPromise=require(_0x8d50('0x4'));var rp=require(_0x8d50('0x5'));var fs=require('fs');var path=require(_0x8d50('0x6'));var rimraf=require(_0x8d50('0x7'));var config=require(_0x8d50('0x8'));var attributes=require(_0x8d50('0x9'));module[_0x8d50('0xa')]=function(_0x1d35aa,_0x1090a0){return _0x1d35aa[_0x8d50('0xb')](_0x8d50('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x8d50('0xd'),'fields':['event',_0x8d50('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9f89034..5b44005 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 _0x3de3=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x406ae7,_0x12181b){var _0x5a5b9d=function(_0x3f20c2){while(--_0x3f20c2){_0x406ae7['push'](_0x406ae7['shift']());}};_0x5a5b9d(++_0x12181b);}(_0x3de3,0x1ce));var _0x33de=function(_0x2fcb41,_0x213d5c){_0x2fcb41=_0x2fcb41-0x0;var _0x511678=_0x3de3[_0x2fcb41];return _0x511678;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});} \ No newline at end of file +var _0x6cb4=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x3a8551,_0x4c3a72){var _0x38fdb7=function(_0xc2a359){while(--_0xc2a359){_0x3a8551['push'](_0x3a8551['shift']());}};_0x38fdb7(++_0x4c3a72);}(_0x6cb4,0xff));var _0x46cb=function(_0x21ce71,_0x31d9c1){_0x21ce71=_0x21ce71-0x0;var _0xe1ae7b=_0x6cb4[_0x21ce71];return _0xe1ae7b;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 08db049..c274d1a 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 _0xb81f=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id/download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe'];(function(_0x3ae4dc,_0x38dc2e){var _0x24bc2a=function(_0x93c78f){while(--_0x93c78f){_0x3ae4dc['push'](_0x3ae4dc['shift']());}};_0x24bc2a(++_0x38dc2e);}(_0xb81f,0x1e0));var _0xfb81=function(_0x1080a7,_0xf71d1f){_0x1080a7=_0x1080a7-0x0;var _0x42e2fe=_0xb81f[_0x1080a7];return _0x42e2fe;};'use strict';var multer=require(_0xfb81('0x0'));var util=require(_0xfb81('0x1'));var path=require(_0xfb81('0x2'));var timeout=require(_0xfb81('0x3'));var express=require(_0xfb81('0x4'));var router=express[_0xfb81('0x5')]();var auth=require(_0xfb81('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb81('0x7'));var controller=require(_0xfb81('0x8'));router[_0xfb81('0x9')]('/',auth[_0xfb81('0xa')](),controller['index']);router[_0xfb81('0x9')](_0xfb81('0xb'),auth['isAuthenticated'](),controller[_0xfb81('0xc')]);router['get']('/:id',auth[_0xfb81('0xa')](),controller['show']);router[_0xfb81('0x9')](_0xfb81('0xd'),auth[_0xfb81('0xa')](),controller['download']);router[_0xfb81('0x9')](_0xfb81('0xe'),controller[_0xfb81('0xf')]);router['get'](_0xfb81('0x10'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xfb81('0x11')]('/',auth[_0xfb81('0xa')](),controller[_0xfb81('0x12')]);router[_0xfb81('0x11')](_0xfb81('0x10'),auth[_0xfb81('0xa')](),controller[_0xfb81('0x13')]);router[_0xfb81('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfb81('0x15')](_0xfb81('0x16'),auth[_0xfb81('0xa')](),controller[_0xfb81('0x17')]);module[_0xfb81('0x18')]=router; \ No newline at end of file +var _0x0bfc=['put','delete','destroy','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','create','post','runTranscribe'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0bfc,0x1e8));var _0xc0bf=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x0bfc[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0bf('0x0'));var timeout=require('connect-timeout');var express=require(_0xc0bf('0x1'));var router=express['Router']();var auth=require(_0xc0bf('0x2'));var interaction=require(_0xc0bf('0x3'));var config=require(_0xc0bf('0x4'));var controller=require('./voiceRecording.controller');router[_0xc0bf('0x5')]('/',auth[_0xc0bf('0x6')](),controller[_0xc0bf('0x7')]);router[_0xc0bf('0x5')]('/describe',auth[_0xc0bf('0x6')](),controller[_0xc0bf('0x8')]);router[_0xc0bf('0x5')](_0xc0bf('0x9'),auth[_0xc0bf('0x6')](),controller['show']);router[_0xc0bf('0x5')](_0xc0bf('0xa'),auth['isAuthenticated'](),controller[_0xc0bf('0xb')]);router['get'](_0xc0bf('0xc'),controller[_0xc0bf('0xd')]);router[_0xc0bf('0x5')](_0xc0bf('0xe'),auth['isAuthenticated'](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0xc0bf('0xf')]);router[_0xc0bf('0x10')](_0xc0bf('0xe'),auth[_0xc0bf('0x6')](),controller[_0xc0bf('0x11')]);router[_0xc0bf('0x12')](_0xc0bf('0x9'),auth[_0xc0bf('0x6')](),controller['update']);router[_0xc0bf('0x13')](_0xc0bf('0x9'),auth['isAuthenticated'](),controller[_0xc0bf('0x14')]);module[_0xc0bf('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 16268e7..73175ff 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 _0xe427=['TEXT','FLOAT','DATE','createdAt','format','toString','MM-DD-YYYY\x20HH:mm','sequelize','exports','VIRTUAL','extname','getDataValue','value','STRING','setDataValue','channel','membername'];(function(_0x3b0295,_0x218b0b){var _0x2cdd32=function(_0x266ba0){while(--_0x266ba0){_0x3b0295['push'](_0x3b0295['shift']());}};_0x2cdd32(++_0x218b0b);}(_0xe427,0x1e3));var _0x7e42=function(_0xeaf2ab,_0x59c9b8){_0xeaf2ab=_0xeaf2ab-0x0;var _0x33422a=_0xe427[_0xeaf2ab];return _0x33422a;};'use strict';var Sequelize=require(_0x7e42('0x0'));var moment=require('moment');var path=require('path');module[_0x7e42('0x1')]={'format':{'type':Sequelize[_0x7e42('0x2')],'get':function(){return this['getDataValue']('value')?path[_0x7e42('0x3')](this[_0x7e42('0x4')](_0x7e42('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x7e42('0x6')]},'channel':{'type':Sequelize[_0x7e42('0x6')],'set':function(_0x4861ab){if(_0x4861ab){this[_0x7e42('0x7')](_0x7e42('0x8'),_0x4861ab);this['setDataValue'](_0x7e42('0x9'),_0x4861ab['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7e42('0x6')]},'calleridnum':{'type':Sequelize[_0x7e42('0x6')]},'calleridname':{'type':Sequelize[_0x7e42('0x6')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7e42('0x6')]},'accountcode':{'type':Sequelize[_0x7e42('0x6')]},'context':{'type':Sequelize[_0x7e42('0x6')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7e42('0x6')]},'type':{'type':Sequelize[_0x7e42('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x7e42('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x7e42('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x7e42('0x6')]},'location':{'type':Sequelize[_0x7e42('0xa')]},'transcribeName':{'type':Sequelize[_0x7e42('0x6')]},'transcribeStatus':{'type':Sequelize[_0x7e42('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x7e42('0xa')]},'fileText':{'type':Sequelize[_0x7e42('0xa')]},'failureReason':{'type':Sequelize[_0x7e42('0xa')]},'sentiment':{'type':Sequelize[_0x7e42('0x6')]},'sPositive':{'type':Sequelize[_0x7e42('0xb')]},'sNegative':{'type':Sequelize[_0x7e42('0xb')]},'sNeutral':{'type':Sequelize[_0x7e42('0xb')]},'sMixed':{'type':Sequelize[_0x7e42('0xb')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x7e42('0xc')],'get':function(){return moment(this['getDataValue'](_0x7e42('0xd')))[_0x7e42('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7e42('0xf')]();}},'updatedAt':{'type':Sequelize[_0x7e42('0xc')],'get':function(){return moment(this[_0x7e42('0x4')]('updatedAt'))[_0x7e42('0xe')](_0x7e42('0x10'))[_0x7e42('0xf')]();}}}; \ No newline at end of file +var _0x5653=['path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment'];(function(_0x132bc3,_0x4cb988){var _0x5a6c16=function(_0x5ec040){while(--_0x5ec040){_0x132bc3['push'](_0x132bc3['shift']());}};_0x5a6c16(++_0x4cb988);}(_0x5653,0x16e));var _0x3565=function(_0x12c55c,_0x5061e6){_0x12c55c=_0x12c55c-0x0;var _0x206731=_0x5653[_0x12c55c];return _0x206731;};'use strict';var Sequelize=require(_0x3565('0x0'));var moment=require(_0x3565('0x1'));var path=require(_0x3565('0x2'));module['exports']={'format':{'type':Sequelize[_0x3565('0x3')],'get':function(){return this[_0x3565('0x4')](_0x3565('0x5'))?path[_0x3565('0x6')](this[_0x3565('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x3565('0x7')]},'channel':{'type':Sequelize[_0x3565('0x7')],'set':function(_0xf6c7b4){if(_0xf6c7b4){this[_0x3565('0x8')](_0x3565('0x9'),_0xf6c7b4);this[_0x3565('0x8')](_0x3565('0xa'),_0xf6c7b4[_0x3565('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x3565('0x7')]},'calleridnum':{'type':Sequelize[_0x3565('0x7')]},'calleridname':{'type':Sequelize[_0x3565('0x7')]},'connectedlinenum':{'type':Sequelize[_0x3565('0x7')]},'connectedlinename':{'type':Sequelize[_0x3565('0x7')]},'accountcode':{'type':Sequelize[_0x3565('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3565('0x7')]},'value':{'type':Sequelize[_0x3565('0x7')]},'type':{'type':Sequelize[_0x3565('0x7')]},'rating':{'type':Sequelize[_0x3565('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x3565('0x7')]},'userDisposition':{'type':Sequelize[_0x3565('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x3565('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x3565('0x7')]},'location':{'type':Sequelize[_0x3565('0xd')]},'transcribeName':{'type':Sequelize[_0x3565('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x3565('0xe')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x3565('0xd')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x3565('0xf')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x3565('0xf')]},'tempSentiment':{'type':Sequelize[_0x3565('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x3565('0x11')],'get':function(){return moment(this[_0x3565('0x4')](_0x3565('0x12')))[_0x3565('0x13')](_0x3565('0x14'))[_0x3565('0x15')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x3565('0x16')))[_0x3565('0x13')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 1516cee..fc45397 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 _0x5d81=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','name','send','index','VoiceRecording','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','length','find','create','update','body','describe','catch','download','../../components/encryptor','type','uniqueid','value','format','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','MD5','$and','push','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5d81,0x1b1));var _0x15d8=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x5d81[_0xa60623];return _0x4a6487;};'use strict';var pdf=require(_0x15d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15d8('0x1'));var zipdir=require(_0x15d8('0x2'));var jsonpatch=require(_0x15d8('0x3'));var rp=require('request-promise');var moment=require(_0x15d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15d8('0x5'));var util=require(_0x15d8('0x6'));var path=require(_0x15d8('0x7'));var sox=require(_0x15d8('0x8'));var csv=require(_0x15d8('0x9'));var ejs=require(_0x15d8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x15d8('0xb'));var crypto=require(_0x15d8('0xc'));var jsforce=require(_0x15d8('0xd'));var deskjs=require(_0x15d8('0xe'));var toCsv=require(_0x15d8('0x9'));var querystring=require('querystring');var Papa=require(_0x15d8('0xf'));var AWS=require(_0x15d8('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x15d8('0x11'));var authService=require(_0x15d8('0x12'));var qs=require(_0x15d8('0x13'));var as=require(_0x15d8('0x14'));var hardwareService=require(_0x15d8('0x15'));var logger=require(_0x15d8('0x16'))(_0x15d8('0x17'));var utils=require(_0x15d8('0x18'));var config=require(_0x15d8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x15d8('0x1a'))['db'];function respondWithStatusCode(_0x35e663,_0xd9f0e2){_0xd9f0e2=_0xd9f0e2||0xcc;return function(_0x469727){if(_0x469727){return _0x35e663['sendStatus'](_0xd9f0e2);}return _0x35e663[_0x15d8('0x1b')](_0xd9f0e2)[_0x15d8('0x1c')]();};}function respondWithResult(_0x6f8afe,_0x2a8f15){_0x2a8f15=_0x2a8f15||0xc8;return function(_0x58d6b9){if(_0x58d6b9){return _0x6f8afe['status'](_0x2a8f15)['json'](_0x58d6b9);}};}function respondWithFilteredResult(_0x2ab224,_0xcc8cff){return function(_0x2129ca){if(_0x2129ca){var _0x5cd2dd=_0x2129ca[_0x15d8('0x1d')],_0x49f3d9=_0xcc8cff['offset'],_0x1011fd=_0xcc8cff[_0x15d8('0x1e')]+_0xcc8cff[_0x15d8('0x1f')],_0x2f20a7;if(_0x1011fd>=_0x5cd2dd){_0x1011fd=_0x5cd2dd;_0x2f20a7=0xc8;}else{_0x2f20a7=0xce;}_0x2ab224[_0x15d8('0x1b')](_0x2f20a7);return _0x2ab224[_0x15d8('0x20')](_0x15d8('0x21'),_0x49f3d9+'-'+_0x1011fd+'/'+_0x5cd2dd)[_0x15d8('0x22')](_0x2129ca);}return null;};}function patchUpdates(_0xa1e774){return function(_0xb42889){try{jsonpatch[_0x15d8('0x23')](_0xb42889,_0xa1e774,!![]);}catch(_0x1723ca){return BPromise[_0x15d8('0x24')](_0x1723ca);}return _0xb42889[_0x15d8('0x25')]();};}function saveUpdates(_0x553362,_0x188196){return function(_0xcbfa7b){if(_0xcbfa7b){return _0xcbfa7b['update'](_0x553362)['then'](function(_0x216bd3){return _0x216bd3;});}return null;};}function removeEntity(_0x2fbc60,_0x1a56fb){return function(_0x24fd5d){if(_0x24fd5d){return _0x24fd5d[_0x15d8('0x26')]()[_0x15d8('0x27')](function(){_0x2fbc60[_0x15d8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x239f36,_0x28e6b7){return function(_0x27035a){if(!_0x27035a){_0x239f36[_0x15d8('0x28')](0x194);}return _0x27035a;};}function handleError(_0x32b195,_0x34521c){_0x34521c=_0x34521c||0x1f4;return function(_0x1c8c00){logger['error'](_0x1c8c00[_0x15d8('0x29')]);if(_0x1c8c00[_0x15d8('0x2a')]){delete _0x1c8c00[_0x15d8('0x2a')];}_0x32b195[_0x15d8('0x1b')](_0x34521c)[_0x15d8('0x2b')](_0x1c8c00);};}exports[_0x15d8('0x2c')]=function(_0x498621,_0x11e6f5){var _0x58b72e={},_0xd0a896={},_0x3d5220={'count':0x0,'rows':[]};var _0x38a1eb=_['map'](db[_0x15d8('0x2d')][_0x15d8('0x2e')],function(_0x20e1dd){return{'name':_0x20e1dd['fieldName'],'type':_0x20e1dd['type'][_0x15d8('0x2f')]};});_0xd0a896[_0x15d8('0x30')]=_['differenceBy'](_[_0x15d8('0x31')](_0x38a1eb,_0x15d8('0x2a')),['format']);_0xd0a896['query']=_['keys'](_0x498621[_0x15d8('0x32')]);_0xd0a896[_0x15d8('0x33')]=_[_0x15d8('0x34')](_0xd0a896[_0x15d8('0x30')],_0xd0a896[_0x15d8('0x32')]);_0x58b72e['attributes']=_[_0x15d8('0x34')](_0xd0a896[_0x15d8('0x30')],qs[_0x15d8('0x35')](_0x498621[_0x15d8('0x32')][_0x15d8('0x35')]));_0x58b72e[_0x15d8('0x36')]=_0x58b72e['attributes']['length']?_0x58b72e[_0x15d8('0x36')]:_0xd0a896[_0x15d8('0x30')];if(!_0x498621[_0x15d8('0x32')][_0x15d8('0x37')](_0x15d8('0x38'))){_0x58b72e[_0x15d8('0x1f')]=qs[_0x15d8('0x1f')](_0x498621[_0x15d8('0x32')][_0x15d8('0x1f')]);_0x58b72e[_0x15d8('0x1e')]=qs['offset'](_0x498621['query'][_0x15d8('0x1e')]);}_0x58b72e[_0x15d8('0x39')]=qs[_0x15d8('0x3a')](_0x498621[_0x15d8('0x32')]['sort']);_0x58b72e[_0x15d8('0x3b')]=qs[_0x15d8('0x33')](_[_0x15d8('0x3c')](_0x498621[_0x15d8('0x32')],_0xd0a896[_0x15d8('0x33')]),_0x38a1eb);if(_0x498621[_0x15d8('0x32')][_0x15d8('0x3d')]){_0x58b72e[_0x15d8('0x3b')]=_[_0x15d8('0x3e')](_0x58b72e[_0x15d8('0x3b')],{'$or':_['map'](_0x38a1eb,function(_0x2baf45){if(_0x2baf45['type']!==_0x15d8('0x3f')){var _0x2692ff={};_0x2692ff[_0x2baf45['name']]={'$like':'%'+_0x498621[_0x15d8('0x32')]['filter']+'%'};return _0x2692ff;}})});}_0x58b72e=_[_0x15d8('0x3e')]({},_0x58b72e,_0x498621[_0x15d8('0x40')]);var _0x40c2c5={'where':_0x58b72e['where']};return db['VoiceRecording'][_0x15d8('0x1d')](_0x40c2c5)[_0x15d8('0x27')](function(_0x9d1204){_0x3d5220[_0x15d8('0x1d')]=_0x9d1204;if(_0x498621[_0x15d8('0x32')][_0x15d8('0x41')]){_0x58b72e[_0x15d8('0x42')]=[{'all':!![]}];}return db[_0x15d8('0x2d')]['findAll'](_0x58b72e);})[_0x15d8('0x27')](function(_0x108b20){_0x3d5220[_0x15d8('0x43')]=_0x108b20;return _0x3d5220;})[_0x15d8('0x27')](respondWithFilteredResult(_0x11e6f5,_0x58b72e))['catch'](handleError(_0x11e6f5,null));};exports['show']=function(_0x540b19,_0x2d812a){var _0xbf57b8={'raw':![],'where':{'id':_0x540b19[_0x15d8('0x44')]['id']}},_0x5857ce={};_0x5857ce[_0x15d8('0x30')]=_[_0x15d8('0x45')](db[_0x15d8('0x2d')][_0x15d8('0x2e')]);_0x5857ce[_0x15d8('0x32')]=_[_0x15d8('0x45')](_0x540b19['query']);_0x5857ce[_0x15d8('0x33')]=_['intersection'](_0x5857ce[_0x15d8('0x30')],_0x5857ce[_0x15d8('0x32')]);_0xbf57b8[_0x15d8('0x36')]=_['intersection'](_0x5857ce[_0x15d8('0x30')],qs[_0x15d8('0x35')](_0x540b19[_0x15d8('0x32')][_0x15d8('0x35')]));_0xbf57b8['attributes']=_0xbf57b8[_0x15d8('0x36')][_0x15d8('0x46')]?_0xbf57b8['attributes']:_0x5857ce[_0x15d8('0x30')];if(_0x540b19['query']['includeAll']){_0xbf57b8[_0x15d8('0x42')]=[{'all':!![]}];}_0xbf57b8=_[_0x15d8('0x3e')]({},_0xbf57b8,_0x540b19['options']);return db[_0x15d8('0x2d')][_0x15d8('0x47')](_0xbf57b8)[_0x15d8('0x27')](handleEntityNotFound(_0x2d812a,null))[_0x15d8('0x27')](respondWithResult(_0x2d812a,null))['catch'](handleError(_0x2d812a,null));};exports[_0x15d8('0x48')]=function(_0x1402d6,_0x572646){return db['VoiceRecording'][_0x15d8('0x48')](_0x1402d6['body'],{})['then'](respondWithResult(_0x572646,0xc9))['catch'](handleError(_0x572646,null));};exports[_0x15d8('0x49')]=function(_0x159a3e,_0x264fb6){if(_0x159a3e[_0x15d8('0x4a')]['id']){delete _0x159a3e[_0x15d8('0x4a')]['id'];}return db[_0x15d8('0x2d')][_0x15d8('0x47')]({'where':{'id':_0x159a3e[_0x15d8('0x44')]['id']}})[_0x15d8('0x27')](handleEntityNotFound(_0x264fb6,null))[_0x15d8('0x27')](saveUpdates(_0x159a3e[_0x15d8('0x4a')],null))[_0x15d8('0x27')](respondWithResult(_0x264fb6,null))['catch'](handleError(_0x264fb6,null));};exports[_0x15d8('0x4b')]=function(_0x245efc,_0x176cc9){return db[_0x15d8('0x2d')][_0x15d8('0x4b')]()['then'](respondWithResult(_0x176cc9,null))[_0x15d8('0x4c')](handleError(_0x176cc9,null));};exports[_0x15d8('0x4d')]=function(_0x1f390b,_0x3791aa,_0x241669){var _0x311d7f=require(_0x15d8('0x4e'));var _0x56055c=![];var _0x47b23f={};if(_0x1f390b[_0x15d8('0x32')][_0x15d8('0x4f')]&&_0x1f390b['query'][_0x15d8('0x4f')]==='uniqueid'){_0x47b23f[_0x15d8('0x50')]=_0x1f390b[_0x15d8('0x44')]['id'];}else{_0x47b23f['id']=_0x1f390b[_0x15d8('0x44')]['id'];}return db['VoiceRecording']['find']({'where':_0x47b23f,'attributes':['id',_0x15d8('0x51')],'raw':!![]})[_0x15d8('0x27')](handleEntityNotFound(_0x3791aa,null))[_0x15d8('0x27')](function(_0x4352a9){if(_0x4352a9){var _0xeb90a1=_0x4352a9[_0x15d8('0x51')];var _0x384693=util[_0x15d8('0x52')]('%s.cypher',_0xeb90a1);if(fs[_0x15d8('0x53')](_0x384693)){_0x56055c=!![];return _0x311d7f[_0x15d8('0x54')](_0x384693,_0xeb90a1,config[_0x15d8('0x55')][_0x15d8('0x56')])[_0x15d8('0x27')](function(){return _0x4352a9;});}return _0x4352a9;}})['then'](function(_0x42ab26){if(_0x42ab26){var _0x1dd182=_0x42ab26['value'];if(!fs[_0x15d8('0x53')](_0x1dd182)){throw new db[(_0x15d8('0x57'))]['ValidationError'](_0x15d8('0x58'));}if(_0x42ab26[_0x15d8('0x59')]){return _0x3791aa[_0x15d8('0x4d')](_0x1dd182,_0x42ab26[_0x15d8('0x59')]+path[_0x15d8('0x5a')](_0x1dd182),function(){if(_0x56055c){fs[_0x15d8('0x5b')](_0x1dd182);}});}else{return _0x3791aa[_0x15d8('0x4d')](_0x1dd182,function(_0x26ed7f){if(_0x56055c){fs[_0x15d8('0x5b')](_0x1dd182);}});}}})[_0x15d8('0x4c')](function(_0x3b7afd){if(_0x3b7afd['message']==='VoiceRecording\x20not\x20found'){_0x3791aa[_0x15d8('0x1b')](0x194)[_0x15d8('0x2b')](_0x15d8('0x5c'));}else{return handleError(_0x3791aa,null);}});};exports['downloads']=function(_0x3de990,_0x142c7f,_0x2b7bfa){var _0x620355=require(_0x15d8('0x4e'));var _0x5550ce=![];var _0x4cd273={'$and':[db['sequelize'][_0x15d8('0x3b')](db['sequelize']['fn'](_0x15d8('0x5d'),db['sequelize']['col']('uniqueid')),_0x3de990[_0x15d8('0x32')]['token'])]};if(_0x3de990[_0x15d8('0x32')][_0x15d8('0x4f')]&&_0x3de990['query'][_0x15d8('0x4f')]===_0x15d8('0x50')){_0x4cd273[_0x15d8('0x5e')][_0x15d8('0x5f')]({'uniqueid':_0x3de990[_0x15d8('0x44')]['id']});}else{_0x4cd273[_0x15d8('0x5e')][_0x15d8('0x5f')]({'id':_0x3de990[_0x15d8('0x44')]['id']});}return db[_0x15d8('0x2d')]['find']({'where':_0x4cd273,'attributes':['id',_0x15d8('0x51')],'raw':!![]})[_0x15d8('0x27')](handleEntityNotFound(_0x142c7f,null))['then'](function(_0x452fc7){if(_0x452fc7){var _0x2a51ff=util[_0x15d8('0x52')]('%s.cypher',_0x452fc7['value']);if(fs[_0x15d8('0x53')](_0x2a51ff)){_0x5550ce=!![];return _0x620355['decryptFile'](_0x2a51ff,_0x452fc7[_0x15d8('0x51')],config[_0x15d8('0x55')]['recording'])[_0x15d8('0x27')](function(){return _0x452fc7;});}return _0x452fc7;}})[_0x15d8('0x27')](function(_0x43b57d){if(_0x43b57d){if(!fs[_0x15d8('0x53')](_0x43b57d[_0x15d8('0x51')])){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x58'));}if(_0x43b57d[_0x15d8('0x59')]){return _0x142c7f[_0x15d8('0x4d')](_0x43b57d[_0x15d8('0x51')],_0x43b57d[_0x15d8('0x59')]+path[_0x15d8('0x5a')](_0x43b57d[_0x15d8('0x51')]),function(){if(_0x5550ce){fs[_0x15d8('0x5b')](_0x43b57d['value']);}});}else{return _0x142c7f[_0x15d8('0x4d')](_0x43b57d[_0x15d8('0x51')],function(_0x3e2ab9){if(_0x5550ce){fs[_0x15d8('0x5b')](_0x43b57d[_0x15d8('0x51')]);}});}}})[_0x15d8('0x4c')](handleError(_0x142c7f,null));};exports['destroy']=function(_0x41f391,_0x4902ec){return db[_0x15d8('0x2d')]['find']({'where':{'id':_0x41f391[_0x15d8('0x44')]['id']}})[_0x15d8('0x27')](function(_0x56ac41){if(!_0x56ac41)throw new ReferenceError(_0x15d8('0x61'));return _0x56ac41;})['then'](function(_0x5657ff){var _0x96030f=_0x5657ff['value'];logger[_0x15d8('0x62')](_0x15d8('0x63'),_0x96030f);if(!_[_0x15d8('0x64')](_0x5657ff[_0x15d8('0x51')])&&fs[_0x15d8('0x53')](_0x96030f)){logger[_0x15d8('0x62')](_0x15d8('0x65')+_0x96030f+_0x15d8('0x66'));fs[_0x15d8('0x67')](_0x96030f);}_0x96030f=_0x96030f+_0x15d8('0x68');if(!_[_0x15d8('0x64')](_0x5657ff[_0x15d8('0x51')])&&fs[_0x15d8('0x53')](_0x96030f)){logger['info'](_0x15d8('0x65')+_0x96030f+_0x15d8('0x66'));fs[_0x15d8('0x67')](_0x96030f);}return _0x5657ff;})[_0x15d8('0x27')](function(_0x3e37c2){if(!_0x3e37c2)throw new InternalError();return _0x3e37c2[_0x15d8('0x26')]();})[_0x15d8('0x27')](function(){_0x4902ec[_0x15d8('0x1b')](0xcc)['end']();})[_0x15d8('0x4c')](handleError(_0x4902ec,null));};function getBucketslist(_0x3d39cc,_0x2013b5,_0x116b89){return new Promise(function(_0x47f245,_0x5c3022){var _0x3c8f1f=new AWS['S3']({'accessKeyId':_0x2013b5,'secretAccessKey':_0x3d39cc,'region':_0x116b89});_0x3c8f1f[_0x15d8('0x69')]({},function(_0x19670a,_0x2f94cd){if(_0x19670a){return _0x5c3022(_0x19670a);}else{return _0x47f245(_0x2f94cd);}});});}function createBucket(_0x54467c,_0x138879,_0x25e62c,_0x569671){return new Promise(function(_0x689bbc,_0x5b457e){var _0x4a1fca=new AWS['S3']({'accessKeyId':_0x138879,'secretAccessKey':_0x54467c,'region':_0x25e62c});_0x4a1fca[_0x15d8('0x6a')]({'Bucket':_0x569671},function(_0x5f049c,_0x26b993){if(_0x5f049c){return _0x5b457e(_0x5f049c);}else{return _0x689bbc(_0x26b993);}});});}function uploadFile(_0x41821f,_0x325cb5,_0x1dcfec,_0x475c85,_0x35dd0f,_0xebb2e1){return new Promise(function(_0x5cc402,_0x2cea22){var _0x553536=new AWS['S3']({'accessKeyId':_0x325cb5,'secretAccessKey':_0x41821f,'region':_0x1dcfec});_0x553536[_0x15d8('0x6b')]({'Bucket':_0x475c85,'Key':_0x35dd0f,'Body':_0xebb2e1},function(_0x23823e,_0x26f082){if(_0x23823e){return _0x2cea22(_0x23823e);}else{return _0x5cc402(_0x26f082);}});});}function startTranscribe(_0x10db40,_0x1b0843,_0x29c6fb,_0x3934a5,_0x71384e,_0x2d8236){return new Promise(function(_0x4f58a2,_0x226a14){var _0x4990b7=new AWS[(_0x15d8('0x6c'))]({'accessKeyId':_0x1b0843,'secretAccessKey':_0x10db40,'region':_0x29c6fb});_0x4990b7[_0x15d8('0x6d')]({'TranscriptionJobName':_0x3934a5,'LanguageCode':_0x71384e,'Media':{'MediaFileUri':_0x2d8236}},function(_0x1e2241,_0x1f3981){if(_0x1e2241){return _0x226a14(_0x1e2241);}else{return _0x4f58a2(_0x1f3981);}});});}function transcribe(_0x3cd595,_0x1e367e,_0x48d3af,_0x5e8fa7,_0x1f1b87,_0x167c5e,_0x14fd95){return new Promise(function(_0x322d72,_0x3d3ae4){var _0x41069d={};logger[_0x15d8('0x62')](util[_0x15d8('0x52')](_0x15d8('0x6e'),_0x3cd595,_0x1f1b87));return uploadFile(_0x1e367e,_0x48d3af,_0x5e8fa7,_0x1f1b87,path['basename'](_0x167c5e),fs[_0x15d8('0x6f')](_0x167c5e))['then'](function(_0x2bf324){logger[_0x15d8('0x62')](util[_0x15d8('0x52')](_0x15d8('0x70'),_0x3cd595,_0x1f1b87,_0x2bf324['Location']));_0x41069d[_0x15d8('0x71')]=_0x2bf324['Bucket'];_0x41069d[_0x15d8('0x72')]=_0x2bf324[_0x15d8('0x73')];logger[_0x15d8('0x62')](util[_0x15d8('0x52')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3cd595));return startTranscribe(_0x1e367e,_0x48d3af,_0x5e8fa7,uuidv4(),_0x14fd95,_0x2bf324['Location']);})[_0x15d8('0x27')](function(_0x50b258){logger[_0x15d8('0x62')](util[_0x15d8('0x52')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x3cd595,_0x50b258[_0x15d8('0x74')][_0x15d8('0x75')]));_0x41069d[_0x15d8('0x76')]=_0x50b258[_0x15d8('0x74')][_0x15d8('0x75')];_0x41069d[_0x15d8('0x77')]=_0x50b258['TranscriptionJob'][_0x15d8('0x78')];return _0x322d72(_0x41069d);})[_0x15d8('0x4c')](function(_0x1c1fde){return _0x3d3ae4(_0x1c1fde);});});}exports[_0x15d8('0x79')]=function(_0x129698,_0x3a2711,_0x4549d7){var _0x3edd29;var _0x56ebe2;var _0x245a70;var _0x4d5433=require(_0x15d8('0x4e'));return db[_0x15d8('0x2d')][_0x15d8('0x7a')]({'where':{'id':_0x129698[_0x15d8('0x44')]['id']}})['then'](function(_0x516791){if(_0x516791){var _0x3c299f=util[_0x15d8('0x52')]('%s.cypher',_0x516791['value']);if(fs[_0x15d8('0x53')](_0x3c299f)){cypher=!![];return _0x4d5433[_0x15d8('0x54')](_0x3c299f,_0x516791[_0x15d8('0x51')],config[_0x15d8('0x55')]['recording'])[_0x15d8('0x27')](function(){return _0x516791;});}return _0x516791;}})[_0x15d8('0x27')](function(_0x50f016){if(!_0x50f016){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x7b'));}_0x56ebe2=_0x50f016;return db[_0x15d8('0x7c')]['findOne']({'where':{'id':0x1}});})[_0x15d8('0x27')](handleEntityNotFound(_0x3a2711,null))[_0x15d8('0x27')](function(_0x2d1a1b){if(_0x2d1a1b){_0x3edd29=_0x2d1a1b;if(!_0x3edd29[_0x15d8('0x7d')]||!_0x3edd29[_0x15d8('0x7e')]||!_0x3edd29[_0x15d8('0x7f')]||!_0x3edd29[_0x15d8('0x80')]||!_0x3edd29[_0x15d8('0x71')]){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x81'));}if(_0x129698[_0x15d8('0x4a')][_0x15d8('0x82')]&&(!_0x3edd29['sentiment']||!_0x3edd29[_0x15d8('0x83')]||!_0x3edd29['sentimentRegion']||!_0x3edd29[_0x15d8('0x80')]||!_0x3edd29['bucket'])){throw new db['Sequelize']['ValidationError'](_0x15d8('0x84'));}return db[_0x15d8('0x85')][_0x15d8('0x7a')]({'where':{'id':_0x3edd29['transcribeAccountId']}});}})['then'](function(_0x15cfc5){if(!_0x15cfc5){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x86'));}if(!_0x15cfc5[_0x15d8('0x87')]||!_0x15cfc5[_0x15d8('0x88')]){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x89'));}_0x245a70=_0x15cfc5;return getBucketslist(_0x245a70[_0x15d8('0x87')],_0x245a70[_0x15d8('0x88')],_0x3edd29['transcribeRegion']);})['then'](function(_0x4137be){if(_0x4137be&&_0x4137be[_0x15d8('0x8a')]){var _0x3475d1=_['find'](_0x4137be[_0x15d8('0x8a')],function(_0x582365){return _0x582365[_0x15d8('0x8b')]===_0x3edd29['bucket'];});if(!_0x3475d1){logger[_0x15d8('0x62')](util['format'](_0x15d8('0x8c'),_0x129698['params']['id'],_0x3edd29[_0x15d8('0x71')]));return createBucket(_0x245a70[_0x15d8('0x87')],_0x245a70[_0x15d8('0x88')],_0x3edd29[_0x15d8('0x7f')],_0x3edd29['bucket']);}logger[_0x15d8('0x62')](util[_0x15d8('0x52')](_0x15d8('0x8d'),_0x129698[_0x15d8('0x44')]['id'],_0x3edd29[_0x15d8('0x71')]));return;}})[_0x15d8('0x27')](function(_0x3d20ca){if(_0x56ebe2['transcribeStatus']===_0x15d8('0x8e')){return transcribe(_0x129698[_0x15d8('0x44')]['id'],_0x245a70['data1'],_0x245a70[_0x15d8('0x88')],_0x3edd29[_0x15d8('0x7f')],_0x3edd29[_0x15d8('0x71')],_0x56ebe2[_0x15d8('0x51')],_0x3edd29[_0x15d8('0x80')]);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x129698[_0x15d8('0x44')]['id']));return{'transcribeStatus':_0x15d8('0x8f')};}})[_0x15d8('0x27')](function(_0x58b79b){if(_0x58b79b){_0x58b79b[_0x15d8('0x90')]=_0x129698[_0x15d8('0x4a')]['runSentiment'];return _0x56ebe2[_0x15d8('0x91')](_0x58b79b);}})[_0x15d8('0x27')](respondWithResult(_0x3a2711,null))['catch'](handleError(_0x3a2711,null));};function writeFile(_0x208f6c,_0x366fa2){return new Promise(function(_0x6c640,_0x39b212){fs['writeFile'](_0x366fa2,_0x208f6c,function(_0x57ab3a,_0x47a398){if(_0x57ab3a){return _0x39b212(_0x57ab3a);}else{return _0x6c640(_0x47a398);}});});}exports[_0x15d8('0x92')]=function(_0x46ba7,_0xc8c28c,_0x1c874e){return db[_0x15d8('0x2d')][_0x15d8('0x7a')]({'where':{'id':_0x46ba7['params']['id']}})['then'](handleEntityNotFound(_0xc8c28c))['then'](function(_0x447063){if(_0x447063&&_0x447063[_0x15d8('0x93')]){var _0x4de948=_0x447063[_0x15d8('0x93')];var _0x3a79b2=config[_0x15d8('0x94')]+_0x15d8('0x95')+_0x447063['id']+_0x15d8('0x96');if(fs[_0x15d8('0x53')](_0x3a79b2)){return _0x3a79b2;}return writeFile(_0x4de948,_0x3a79b2)[_0x15d8('0x27')](function(){return _0x3a79b2;});}else{throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x97'));}})[_0x15d8('0x27')](function(_0x406dbf){return _0xc8c28c[_0x15d8('0x4d')](_0x406dbf);})[_0x15d8('0x4c')](handleError(_0xc8c28c));}; \ No newline at end of file +var _0xfe08=['rows','catch','show','keys','find','create','body','describe','download','uniqueid','params','value','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','Sequelize','ValidationError','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','listBuckets','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','aws-sdk','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0xb7ea31,_0x101f01){var _0xaa1ad0=function(_0x1aec60){while(--_0x1aec60){_0xb7ea31['push'](_0xb7ea31['shift']());}};_0xaa1ad0(++_0x101f01);}(_0xfe08,0xeb));var _0x8fe0=function(_0x459240,_0x4c7c29){_0x459240=_0x459240-0x0;var _0x2b9388=_0xfe08[_0x459240];return _0x2b9388;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8fe0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fe0('0x1'));var jsonpatch=require(_0x8fe0('0x2'));var rp=require(_0x8fe0('0x3'));var moment=require(_0x8fe0('0x4'));var BPromise=require(_0x8fe0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8fe0('0x6'));var sox=require(_0x8fe0('0x7'));var csv=require(_0x8fe0('0x8'));var ejs=require(_0x8fe0('0x9'));var fs=require('fs');var _=require(_0x8fe0('0xa'));var squel=require(_0x8fe0('0xb'));var crypto=require('crypto');var jsforce=require(_0x8fe0('0xc'));var deskjs=require(_0x8fe0('0xd'));var toCsv=require(_0x8fe0('0x8'));var querystring=require('querystring');var Papa=require(_0x8fe0('0xe'));var AWS=require(_0x8fe0('0xf'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8fe0('0x10'));var as=require(_0x8fe0('0x11'));var hardwareService=require(_0x8fe0('0x12'));var logger=require(_0x8fe0('0x13'))(_0x8fe0('0x14'));var utils=require(_0x8fe0('0x15'));var config=require(_0x8fe0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8fe0('0x17'))['db'];function respondWithStatusCode(_0x41ca1f,_0x2559da){_0x2559da=_0x2559da||0xcc;return function(_0xad5c81){if(_0xad5c81){return _0x41ca1f[_0x8fe0('0x18')](_0x2559da);}return _0x41ca1f[_0x8fe0('0x19')](_0x2559da)['end']();};}function respondWithResult(_0xee741d,_0x53e91e){_0x53e91e=_0x53e91e||0xc8;return function(_0x540d30){if(_0x540d30){return _0xee741d[_0x8fe0('0x19')](_0x53e91e)[_0x8fe0('0x1a')](_0x540d30);}};}function respondWithFilteredResult(_0x363603,_0x20d681){return function(_0x36a513){if(_0x36a513){var _0x4ad03a=_0x36a513[_0x8fe0('0x1b')],_0x10f852=_0x20d681[_0x8fe0('0x1c')],_0x15f99c=_0x20d681['offset']+_0x20d681[_0x8fe0('0x1d')],_0x1ef3d8;if(_0x15f99c>=_0x4ad03a){_0x15f99c=_0x4ad03a;_0x1ef3d8=0xc8;}else{_0x1ef3d8=0xce;}_0x363603[_0x8fe0('0x19')](_0x1ef3d8);return _0x363603['set'](_0x8fe0('0x1e'),_0x10f852+'-'+_0x15f99c+'/'+_0x4ad03a)[_0x8fe0('0x1a')](_0x36a513);}return null;};}function patchUpdates(_0xd4cb2f){return function(_0x2e48c5){try{jsonpatch['apply'](_0x2e48c5,_0xd4cb2f,!![]);}catch(_0x1fa627){return BPromise[_0x8fe0('0x1f')](_0x1fa627);}return _0x2e48c5[_0x8fe0('0x20')]();};}function saveUpdates(_0x2eba04,_0x3cb9ec){return function(_0x15828b){if(_0x15828b){return _0x15828b[_0x8fe0('0x21')](_0x2eba04)[_0x8fe0('0x22')](function(_0x1c5697){return _0x1c5697;});}return null;};}function removeEntity(_0x4865f0,_0x3a626e){return function(_0x4e66a2){if(_0x4e66a2){return _0x4e66a2[_0x8fe0('0x23')]()[_0x8fe0('0x22')](function(){_0x4865f0[_0x8fe0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34a834,_0x30fe6f){return function(_0x1101d6){if(!_0x1101d6){_0x34a834[_0x8fe0('0x18')](0x194);}return _0x1101d6;};}function handleError(_0xf69d9d,_0x4cef1b){_0x4cef1b=_0x4cef1b||0x1f4;return function(_0xf2bfd9){logger[_0x8fe0('0x24')](_0xf2bfd9[_0x8fe0('0x25')]);if(_0xf2bfd9[_0x8fe0('0x26')]){delete _0xf2bfd9['name'];}_0xf69d9d[_0x8fe0('0x19')](_0x4cef1b)[_0x8fe0('0x27')](_0xf2bfd9);};}exports['index']=function(_0x3528e0,_0x518e4f){var _0x5df38f={},_0x590e58={},_0x289de9={'count':0x0,'rows':[]};var _0x4c0c50=_[_0x8fe0('0x28')](db[_0x8fe0('0x29')][_0x8fe0('0x2a')],function(_0x447848){return{'name':_0x447848[_0x8fe0('0x2b')],'type':_0x447848['type'][_0x8fe0('0x2c')]};});_0x590e58[_0x8fe0('0x2d')]=_[_0x8fe0('0x2e')](_[_0x8fe0('0x28')](_0x4c0c50,_0x8fe0('0x26')),[_0x8fe0('0x2f')]);_0x590e58['query']=_['keys'](_0x3528e0[_0x8fe0('0x30')]);_0x590e58[_0x8fe0('0x31')]=_[_0x8fe0('0x32')](_0x590e58[_0x8fe0('0x2d')],_0x590e58[_0x8fe0('0x30')]);_0x5df38f['attributes']=_[_0x8fe0('0x32')](_0x590e58['model'],qs[_0x8fe0('0x33')](_0x3528e0[_0x8fe0('0x30')][_0x8fe0('0x33')]));_0x5df38f[_0x8fe0('0x34')]=_0x5df38f['attributes'][_0x8fe0('0x35')]?_0x5df38f[_0x8fe0('0x34')]:_0x590e58[_0x8fe0('0x2d')];if(!_0x3528e0['query'][_0x8fe0('0x36')](_0x8fe0('0x37'))){_0x5df38f[_0x8fe0('0x1d')]=qs[_0x8fe0('0x1d')](_0x3528e0['query'][_0x8fe0('0x1d')]);_0x5df38f['offset']=qs[_0x8fe0('0x1c')](_0x3528e0['query'][_0x8fe0('0x1c')]);}_0x5df38f[_0x8fe0('0x38')]=qs[_0x8fe0('0x39')](_0x3528e0['query'][_0x8fe0('0x39')]);_0x5df38f['where']=qs[_0x8fe0('0x31')](_[_0x8fe0('0x3a')](_0x3528e0[_0x8fe0('0x30')],_0x590e58[_0x8fe0('0x31')]),_0x4c0c50);if(_0x3528e0[_0x8fe0('0x30')]['filter']){_0x5df38f[_0x8fe0('0x3b')]=_[_0x8fe0('0x3c')](_0x5df38f[_0x8fe0('0x3b')],{'$or':_[_0x8fe0('0x28')](_0x4c0c50,function(_0x419ee9){if(_0x419ee9[_0x8fe0('0x3d')]!==_0x8fe0('0x3e')){var _0x4d9a94={};_0x4d9a94[_0x419ee9[_0x8fe0('0x26')]]={'$like':'%'+_0x3528e0['query']['filter']+'%'};return _0x4d9a94;}})});}_0x5df38f=_[_0x8fe0('0x3c')]({},_0x5df38f,_0x3528e0[_0x8fe0('0x3f')]);var _0x665dd9={'where':_0x5df38f[_0x8fe0('0x3b')]};return db[_0x8fe0('0x29')][_0x8fe0('0x1b')](_0x665dd9)['then'](function(_0x316770){_0x289de9[_0x8fe0('0x1b')]=_0x316770;if(_0x3528e0['query'][_0x8fe0('0x40')]){_0x5df38f[_0x8fe0('0x41')]=[{'all':!![]}];}return db[_0x8fe0('0x29')][_0x8fe0('0x42')](_0x5df38f);})[_0x8fe0('0x22')](function(_0x59b216){_0x289de9[_0x8fe0('0x43')]=_0x59b216;return _0x289de9;})[_0x8fe0('0x22')](respondWithFilteredResult(_0x518e4f,_0x5df38f))[_0x8fe0('0x44')](handleError(_0x518e4f,null));};exports[_0x8fe0('0x45')]=function(_0x5a3c9b,_0x23e8ae){var _0x530aba={'raw':![],'where':{'id':_0x5a3c9b['params']['id']}},_0x4ca678={};_0x4ca678[_0x8fe0('0x2d')]=_[_0x8fe0('0x46')](db[_0x8fe0('0x29')][_0x8fe0('0x2a')]);_0x4ca678[_0x8fe0('0x30')]=_[_0x8fe0('0x46')](_0x5a3c9b[_0x8fe0('0x30')]);_0x4ca678[_0x8fe0('0x31')]=_[_0x8fe0('0x32')](_0x4ca678[_0x8fe0('0x2d')],_0x4ca678['query']);_0x530aba[_0x8fe0('0x34')]=_[_0x8fe0('0x32')](_0x4ca678[_0x8fe0('0x2d')],qs[_0x8fe0('0x33')](_0x5a3c9b[_0x8fe0('0x30')]['fields']));_0x530aba[_0x8fe0('0x34')]=_0x530aba[_0x8fe0('0x34')][_0x8fe0('0x35')]?_0x530aba[_0x8fe0('0x34')]:_0x4ca678[_0x8fe0('0x2d')];if(_0x5a3c9b[_0x8fe0('0x30')][_0x8fe0('0x40')]){_0x530aba[_0x8fe0('0x41')]=[{'all':!![]}];}_0x530aba=_['merge']({},_0x530aba,_0x5a3c9b[_0x8fe0('0x3f')]);return db[_0x8fe0('0x29')][_0x8fe0('0x47')](_0x530aba)['then'](handleEntityNotFound(_0x23e8ae,null))[_0x8fe0('0x22')](respondWithResult(_0x23e8ae,null))[_0x8fe0('0x44')](handleError(_0x23e8ae,null));};exports[_0x8fe0('0x48')]=function(_0x37b793,_0x3f5981){return db['VoiceRecording'][_0x8fe0('0x48')](_0x37b793[_0x8fe0('0x49')],{})[_0x8fe0('0x22')](respondWithResult(_0x3f5981,0xc9))[_0x8fe0('0x44')](handleError(_0x3f5981,null));};exports['update']=function(_0x3ef792,_0x2aa7cd){if(_0x3ef792[_0x8fe0('0x49')]['id']){delete _0x3ef792[_0x8fe0('0x49')]['id'];}return db[_0x8fe0('0x29')][_0x8fe0('0x47')]({'where':{'id':_0x3ef792['params']['id']}})[_0x8fe0('0x22')](handleEntityNotFound(_0x2aa7cd,null))['then'](saveUpdates(_0x3ef792['body'],null))[_0x8fe0('0x22')](respondWithResult(_0x2aa7cd,null))[_0x8fe0('0x44')](handleError(_0x2aa7cd,null));};exports[_0x8fe0('0x4a')]=function(_0x22c9e1,_0x4bd04b){return db[_0x8fe0('0x29')][_0x8fe0('0x4a')]()[_0x8fe0('0x22')](respondWithResult(_0x4bd04b,null))[_0x8fe0('0x44')](handleError(_0x4bd04b,null));};exports[_0x8fe0('0x4b')]=function(_0x319a53,_0x1b2ecd,_0x315a1c){var _0x426f93=require('../../components/encryptor');var _0x32390c=![];var _0x1c7bde={};if(_0x319a53[_0x8fe0('0x30')][_0x8fe0('0x3d')]&&_0x319a53[_0x8fe0('0x30')]['type']===_0x8fe0('0x4c')){_0x1c7bde[_0x8fe0('0x4c')]=_0x319a53[_0x8fe0('0x4d')]['id'];}else{_0x1c7bde['id']=_0x319a53[_0x8fe0('0x4d')]['id'];}return db[_0x8fe0('0x29')][_0x8fe0('0x47')]({'where':_0x1c7bde,'attributes':['id',_0x8fe0('0x4e')],'raw':!![]})[_0x8fe0('0x22')](handleEntityNotFound(_0x1b2ecd,null))[_0x8fe0('0x22')](function(_0x3f507d){if(_0x3f507d){var _0x56f40a=_0x3f507d['value'];var _0x54dcff=util[_0x8fe0('0x2f')]('%s.cypher',_0x56f40a);if(fs[_0x8fe0('0x4f')](_0x54dcff)){_0x32390c=!![];return _0x426f93[_0x8fe0('0x50')](_0x54dcff,_0x56f40a,config[_0x8fe0('0x51')][_0x8fe0('0x52')])[_0x8fe0('0x22')](function(){return _0x3f507d;});}return _0x3f507d;}})[_0x8fe0('0x22')](function(_0xd6e8d1){if(_0xd6e8d1){var _0x1b7afb=_0xd6e8d1[_0x8fe0('0x4e')];if(!fs['existsSync'](_0x1b7afb)){throw new db['Sequelize']['ValidationError'](_0x8fe0('0x53'));}if(_0xd6e8d1[_0x8fe0('0x54')]){return _0x1b2ecd['download'](_0x1b7afb,_0xd6e8d1[_0x8fe0('0x54')]+path[_0x8fe0('0x55')](_0x1b7afb),function(){if(_0x32390c){fs[_0x8fe0('0x56')](_0x1b7afb);}});}else{return _0x1b2ecd[_0x8fe0('0x4b')](_0x1b7afb,function(_0x4f2b70){if(_0x32390c){fs[_0x8fe0('0x56')](_0x1b7afb);}});}}})['catch'](function(_0x23a66f){if(_0x23a66f[_0x8fe0('0x57')]===_0x8fe0('0x53')){_0x1b2ecd[_0x8fe0('0x19')](0x194)[_0x8fe0('0x27')](_0x8fe0('0x58'));}else{return handleError(_0x1b2ecd,null);}});};exports['downloads']=function(_0x51215a,_0x3c0ef6,_0x574723){var _0x5d19b7=require('../../components/encryptor');var _0x2e6fd8=![];var _0x4dbd9e={'$and':[db[_0x8fe0('0x59')]['where'](db[_0x8fe0('0x59')]['fn'](_0x8fe0('0x5a'),db['sequelize'][_0x8fe0('0x5b')](_0x8fe0('0x4c'))),_0x51215a[_0x8fe0('0x30')][_0x8fe0('0x5c')])]};if(_0x51215a[_0x8fe0('0x30')][_0x8fe0('0x3d')]&&_0x51215a[_0x8fe0('0x30')][_0x8fe0('0x3d')]===_0x8fe0('0x4c')){_0x4dbd9e[_0x8fe0('0x5d')][_0x8fe0('0x5e')]({'uniqueid':_0x51215a['params']['id']});}else{_0x4dbd9e[_0x8fe0('0x5d')][_0x8fe0('0x5e')]({'id':_0x51215a[_0x8fe0('0x4d')]['id']});}return db[_0x8fe0('0x29')][_0x8fe0('0x47')]({'where':_0x4dbd9e,'attributes':['id',_0x8fe0('0x4e')],'raw':!![]})[_0x8fe0('0x22')](handleEntityNotFound(_0x3c0ef6,null))[_0x8fe0('0x22')](function(_0x2d916a){if(_0x2d916a){var _0x291b32=util[_0x8fe0('0x2f')](_0x8fe0('0x5f'),_0x2d916a[_0x8fe0('0x4e')]);if(fs[_0x8fe0('0x4f')](_0x291b32)){_0x2e6fd8=!![];return _0x5d19b7[_0x8fe0('0x50')](_0x291b32,_0x2d916a[_0x8fe0('0x4e')],config[_0x8fe0('0x51')][_0x8fe0('0x52')])[_0x8fe0('0x22')](function(){return _0x2d916a;});}return _0x2d916a;}})[_0x8fe0('0x22')](function(_0x2f307b){if(_0x2f307b){if(!fs[_0x8fe0('0x4f')](_0x2f307b[_0x8fe0('0x4e')])){throw new db[(_0x8fe0('0x60'))][(_0x8fe0('0x61'))](_0x8fe0('0x53'));}if(_0x2f307b['filename']){return _0x3c0ef6[_0x8fe0('0x4b')](_0x2f307b[_0x8fe0('0x4e')],_0x2f307b[_0x8fe0('0x54')]+path[_0x8fe0('0x55')](_0x2f307b[_0x8fe0('0x4e')]),function(){if(_0x2e6fd8){fs[_0x8fe0('0x56')](_0x2f307b[_0x8fe0('0x4e')]);}});}else{return _0x3c0ef6[_0x8fe0('0x4b')](_0x2f307b[_0x8fe0('0x4e')],function(_0x4c6a40){if(_0x2e6fd8){fs['unlink'](_0x2f307b[_0x8fe0('0x4e')]);}});}}})[_0x8fe0('0x44')](handleError(_0x3c0ef6,null));};exports[_0x8fe0('0x23')]=function(_0x5d68f2,_0x47b224){return db[_0x8fe0('0x29')][_0x8fe0('0x47')]({'where':{'id':_0x5d68f2[_0x8fe0('0x4d')]['id']}})['then'](function(_0x527775){if(!_0x527775)throw new ReferenceError(_0x8fe0('0x62'));return _0x527775;})[_0x8fe0('0x22')](function(_0x8ff48b){var _0x5e567f=_0x8ff48b[_0x8fe0('0x4e')];logger['info'](_0x8fe0('0x63'),_0x5e567f);if(!_[_0x8fe0('0x64')](_0x8ff48b[_0x8fe0('0x4e')])&&fs[_0x8fe0('0x4f')](_0x5e567f)){logger[_0x8fe0('0x65')](_0x8fe0('0x66')+_0x5e567f+_0x8fe0('0x67'));fs[_0x8fe0('0x68')](_0x5e567f);}_0x5e567f=_0x5e567f+'.cypher';if(!_[_0x8fe0('0x64')](_0x8ff48b[_0x8fe0('0x4e')])&&fs[_0x8fe0('0x4f')](_0x5e567f)){logger[_0x8fe0('0x65')]('File:\x20\x22'+_0x5e567f+_0x8fe0('0x67'));fs[_0x8fe0('0x68')](_0x5e567f);}return _0x8ff48b;})[_0x8fe0('0x22')](function(_0x2d30dd){if(!_0x2d30dd)throw new InternalError();return _0x2d30dd['destroy']();})[_0x8fe0('0x22')](function(){_0x47b224[_0x8fe0('0x19')](0xcc)[_0x8fe0('0x69')]();})[_0x8fe0('0x44')](handleError(_0x47b224,null));};function getBucketslist(_0x558e8c,_0x35eff6,_0x3d5b2d){return new Promise(function(_0x501575,_0x3b3404){var _0x518ff8=new AWS['S3']({'accessKeyId':_0x35eff6,'secretAccessKey':_0x558e8c,'region':_0x3d5b2d});_0x518ff8[_0x8fe0('0x6a')]({},function(_0x32f46d,_0x1d62ec){if(_0x32f46d){return _0x3b3404(_0x32f46d);}else{return _0x501575(_0x1d62ec);}});});}function createBucket(_0x2a3533,_0x4703d9,_0x3ce3c1,_0x2d1f85){return new Promise(function(_0x3cd23c,_0x1c475d){var _0x59b186=new AWS['S3']({'accessKeyId':_0x4703d9,'secretAccessKey':_0x2a3533,'region':_0x3ce3c1});_0x59b186[_0x8fe0('0x6b')]({'Bucket':_0x2d1f85},function(_0x2aa5c3,_0x19949e){if(_0x2aa5c3){return _0x1c475d(_0x2aa5c3);}else{return _0x3cd23c(_0x19949e);}});});}function uploadFile(_0x363074,_0x3eedd6,_0x2c88f6,_0x3c7ff3,_0xe1f905,_0x43b4da){return new Promise(function(_0x29a7b9,_0x3f014f){var _0x29d0a5=new AWS['S3']({'accessKeyId':_0x3eedd6,'secretAccessKey':_0x363074,'region':_0x2c88f6});_0x29d0a5[_0x8fe0('0x6c')]({'Bucket':_0x3c7ff3,'Key':_0xe1f905,'Body':_0x43b4da},function(_0x43bd7a,_0x652645){if(_0x43bd7a){return _0x3f014f(_0x43bd7a);}else{return _0x29a7b9(_0x652645);}});});}function startTranscribe(_0x2e6487,_0x54c75b,_0x3c4a9e,_0xafc39e,_0x32509b,_0x5aad22){return new Promise(function(_0x2967d9,_0x30ac7b){var _0x4ab72a=new AWS['TranscribeService']({'accessKeyId':_0x54c75b,'secretAccessKey':_0x2e6487,'region':_0x3c4a9e});_0x4ab72a[_0x8fe0('0x6d')]({'TranscriptionJobName':_0xafc39e,'LanguageCode':_0x32509b,'Media':{'MediaFileUri':_0x5aad22}},function(_0x632f8d,_0x437fb1){if(_0x632f8d){return _0x30ac7b(_0x632f8d);}else{return _0x2967d9(_0x437fb1);}});});}function transcribe(_0x1bd502,_0x1a3b16,_0xec979,_0x36884d,_0x40116a,_0x4cc3f2,_0x1c87af){return new Promise(function(_0x7bd6a6,_0x1e81bb){var _0x1094a3={};logger[_0x8fe0('0x65')](util[_0x8fe0('0x2f')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1bd502,_0x40116a));return uploadFile(_0x1a3b16,_0xec979,_0x36884d,_0x40116a,path[_0x8fe0('0x6e')](_0x4cc3f2),fs[_0x8fe0('0x6f')](_0x4cc3f2))[_0x8fe0('0x22')](function(_0x4de06f){logger[_0x8fe0('0x65')](util[_0x8fe0('0x2f')](_0x8fe0('0x70'),_0x1bd502,_0x40116a,_0x4de06f[_0x8fe0('0x71')]));_0x1094a3[_0x8fe0('0x72')]=_0x4de06f[_0x8fe0('0x73')];_0x1094a3[_0x8fe0('0x74')]=_0x4de06f[_0x8fe0('0x71')];logger['info'](util[_0x8fe0('0x2f')](_0x8fe0('0x75'),_0x1bd502));return startTranscribe(_0x1a3b16,_0xec979,_0x36884d,uuidv4(),_0x1c87af,_0x4de06f[_0x8fe0('0x71')]);})['then'](function(_0x45c63e){logger[_0x8fe0('0x65')](util[_0x8fe0('0x2f')](_0x8fe0('0x76'),_0x1bd502,_0x45c63e[_0x8fe0('0x77')][_0x8fe0('0x78')]));_0x1094a3['transcribeName']=_0x45c63e['TranscriptionJob'][_0x8fe0('0x78')];_0x1094a3[_0x8fe0('0x79')]=_0x45c63e[_0x8fe0('0x77')][_0x8fe0('0x7a')];return _0x7bd6a6(_0x1094a3);})[_0x8fe0('0x44')](function(_0x33e93c){return _0x1e81bb(_0x33e93c);});});}exports[_0x8fe0('0x7b')]=function(_0x4a8c47,_0x399d4a,_0x5cdca5){var _0x125e95;var _0x2c487c;var _0x21da75;var _0x319489=require(_0x8fe0('0x7c'));return db['VoiceRecording'][_0x8fe0('0x7d')]({'where':{'id':_0x4a8c47['params']['id']}})[_0x8fe0('0x22')](function(_0x5b06f6){if(_0x5b06f6){var _0x20afae=util['format']('%s.cypher',_0x5b06f6[_0x8fe0('0x4e')]);if(fs['existsSync'](_0x20afae)){cypher=!![];return _0x319489[_0x8fe0('0x50')](_0x20afae,_0x5b06f6[_0x8fe0('0x4e')],config[_0x8fe0('0x51')]['recording'])[_0x8fe0('0x22')](function(){return _0x5b06f6;});}return _0x5b06f6;}})['then'](function(_0x1cd18d){if(!_0x1cd18d){throw new db['Sequelize'][(_0x8fe0('0x61'))](_0x8fe0('0x7e'));}_0x2c487c=_0x1cd18d;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x8fe0('0x22')](handleEntityNotFound(_0x399d4a,null))[_0x8fe0('0x22')](function(_0x5ca361){if(_0x5ca361){_0x125e95=_0x5ca361;if(!_0x125e95['transcribe']||!_0x125e95[_0x8fe0('0x7f')]||!_0x125e95[_0x8fe0('0x80')]||!_0x125e95[_0x8fe0('0x81')]||!_0x125e95[_0x8fe0('0x72')]){throw new db[(_0x8fe0('0x60'))][(_0x8fe0('0x61'))](_0x8fe0('0x82'));}if(_0x4a8c47['body'][_0x8fe0('0x83')]&&(!_0x125e95[_0x8fe0('0x84')]||!_0x125e95[_0x8fe0('0x85')]||!_0x125e95[_0x8fe0('0x86')]||!_0x125e95['language']||!_0x125e95[_0x8fe0('0x72')])){throw new db[(_0x8fe0('0x60'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x8fe0('0x7d')]({'where':{'id':_0x125e95[_0x8fe0('0x7f')]}});}})['then'](function(_0x1e3f5f){if(!_0x1e3f5f){throw new db['Sequelize'][(_0x8fe0('0x61'))](_0x8fe0('0x87'));}if(!_0x1e3f5f[_0x8fe0('0x88')]||!_0x1e3f5f[_0x8fe0('0x89')]){throw new db['Sequelize']['ValidationError'](_0x8fe0('0x8a'));}_0x21da75=_0x1e3f5f;return getBucketslist(_0x21da75['data1'],_0x21da75[_0x8fe0('0x89')],_0x125e95['transcribeRegion']);})[_0x8fe0('0x22')](function(_0x496bc9){if(_0x496bc9&&_0x496bc9[_0x8fe0('0x8b')]){var _0x1df3fc=_['find'](_0x496bc9[_0x8fe0('0x8b')],function(_0x55ddc7){return _0x55ddc7['Name']===_0x125e95[_0x8fe0('0x72')];});if(!_0x1df3fc){logger[_0x8fe0('0x65')](util[_0x8fe0('0x2f')](_0x8fe0('0x8c'),_0x4a8c47[_0x8fe0('0x4d')]['id'],_0x125e95[_0x8fe0('0x72')]));return createBucket(_0x21da75[_0x8fe0('0x88')],_0x21da75[_0x8fe0('0x89')],_0x125e95['transcribeRegion'],_0x125e95[_0x8fe0('0x72')]);}logger[_0x8fe0('0x65')](util[_0x8fe0('0x2f')](_0x8fe0('0x8d'),_0x4a8c47[_0x8fe0('0x4d')]['id'],_0x125e95[_0x8fe0('0x72')]));return;}})[_0x8fe0('0x22')](function(_0x1bc341){if(_0x2c487c[_0x8fe0('0x79')]==='NEW'){return transcribe(_0x4a8c47[_0x8fe0('0x4d')]['id'],_0x21da75[_0x8fe0('0x88')],_0x21da75['data2'],_0x125e95[_0x8fe0('0x80')],_0x125e95[_0x8fe0('0x72')],_0x2c487c[_0x8fe0('0x4e')],_0x125e95[_0x8fe0('0x81')]);}else{logger['info'](util[_0x8fe0('0x2f')](_0x8fe0('0x8e'),_0x4a8c47[_0x8fe0('0x4d')]['id']));return{'transcribeStatus':_0x8fe0('0x8f')};}})[_0x8fe0('0x22')](function(_0x4187b2){if(_0x4187b2){_0x4187b2[_0x8fe0('0x90')]=_0x4a8c47[_0x8fe0('0x49')][_0x8fe0('0x83')];return _0x2c487c['updateAttributes'](_0x4187b2);}})[_0x8fe0('0x22')](respondWithResult(_0x399d4a,null))[_0x8fe0('0x44')](handleError(_0x399d4a,null));};function writeFile(_0x385b86,_0x3f3094){return new Promise(function(_0x337e19,_0x51d037){fs[_0x8fe0('0x91')](_0x3f3094,_0x385b86,function(_0x31cfd9,_0x11e3c0){if(_0x31cfd9){return _0x51d037(_0x31cfd9);}else{return _0x337e19(_0x11e3c0);}});});}exports[_0x8fe0('0x92')]=function(_0x321563,_0x38891f,_0x43ad32){return db[_0x8fe0('0x29')][_0x8fe0('0x7d')]({'where':{'id':_0x321563['params']['id']}})['then'](handleEntityNotFound(_0x38891f))['then'](function(_0x2e470d){if(_0x2e470d&&_0x2e470d[_0x8fe0('0x93')]){var _0x4abe8d=_0x2e470d['fileText'];var _0x121d71=config['root']+_0x8fe0('0x94')+_0x2e470d['id']+_0x8fe0('0x95');if(fs[_0x8fe0('0x4f')](_0x121d71)){return _0x121d71;}return writeFile(_0x4abe8d,_0x121d71)[_0x8fe0('0x22')](function(){return _0x121d71;});}else{throw new db[(_0x8fe0('0x60'))][(_0x8fe0('0x61'))](_0x8fe0('0x96'));}})[_0x8fe0('0x22')](function(_0x1a563c){return _0x38891f['download'](_0x1a563c);})[_0x8fe0('0x44')](handleError(_0x38891f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3ca2e08..e789c38 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 _0x9c57=['moment','bluebird','request-promise','path','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api'];(function(_0x289765,_0x304e33){var _0x10e2df=function(_0x4d3e97){while(--_0x4d3e97){_0x289765['push'](_0x289765['shift']());}};_0x10e2df(++_0x304e33);}(_0x9c57,0x142));var _0x79c5=function(_0x356727,_0x572778){_0x356727=_0x356727-0x0;var _0x10e739=_0x9c57[_0x356727];return _0x10e739;};'use strict';var _=require('lodash');var util=require(_0x79c5('0x0'));var logger=require(_0x79c5('0x1'))(_0x79c5('0x2'));var moment=require(_0x79c5('0x3'));var BPromise=require(_0x79c5('0x4'));var rp=require(_0x79c5('0x5'));var fs=require('fs');var path=require(_0x79c5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79c5('0x7'));module[_0x79c5('0x8')]=function(_0x4a6826,_0x34343c){return _0x4a6826[_0x79c5('0x9')](_0x79c5('0xa'),attributes,{'tableName':_0x79c5('0xb'),'paranoid':![],'indexes':[{'name':_0x79c5('0xc'),'fields':[_0x79c5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac26=['./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x596716,_0x5a52db){var _0x202aec=function(_0x147f69){while(--_0x147f69){_0x596716['push'](_0x596716['shift']());}};_0x202aec(++_0x5a52db);}(_0xac26,0x79));var _0x6ac2=function(_0x33f339,_0x175848){_0x33f339=_0x33f339-0x0;var _0x1cb059=_0xac26[_0x33f339];return _0x1cb059;};'use strict';var _=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var logger=require(_0x6ac2('0x2'))(_0x6ac2('0x3'));var moment=require(_0x6ac2('0x4'));var BPromise=require('bluebird');var rp=require(_0x6ac2('0x5'));var fs=require('fs');var path=require(_0x6ac2('0x6'));var rimraf=require(_0x6ac2('0x7'));var config=require(_0x6ac2('0x8'));var attributes=require(_0x6ac2('0x9'));module[_0x6ac2('0xa')]=function(_0x29238d,_0x1e7972){return _0x29238d['define']('VoiceRecording',attributes,{'tableName':_0x6ac2('0xb'),'paranoid':![],'indexes':[{'name':_0x6ac2('0xc'),'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 f1b90ce..7b4c7fb 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(_0x511d17,_0x9ad3ba){var _0x4f42e3=function(_0x5cc40f){while(--_0x5cc40f){_0x511d17['push'](_0x511d17['shift']());}};_0x4f42e3(++_0x9ad3ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x3f32ca,_0x2212f2){var _0xf444d=function(_0x4b5b04){while(--_0x4b5b04){_0x3f32ca['push'](_0x3f32ca['shift']());}};_0xf444d(++_0x2212f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 e467669..b140f71 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 _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x50fa6b,_0x576b70){var _0x295dfa=function(_0x46d878){while(--_0x46d878){_0x50fa6b['push'](_0x50fa6b['shift']());}};_0x295dfa(++_0x576b70);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x306fc7,_0x574e48){_0x306fc7=_0x306fc7-0x0;var _0x1d2f0f=_0xbd51[_0x306fc7];return _0x1d2f0f;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x6751fa,_0x410198){var _0x3f24c1=function(_0x2fbcf4){while(--_0x2fbcf4){_0x6751fa['push'](_0x6751fa['shift']());}};_0x3f24c1(++_0x410198);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xe56865,_0x125547){_0xe56865=_0xe56865-0x0;var _0x3376ae=_0x3f8a[_0xe56865];return _0x3376ae;};'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('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5321629..2f76daa 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 _0x914f=['ENUM','blind','STRING','Yes','moment','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x914f,0x166));var _0xf914=function(_0x2ebeab,_0x2ffe2b){_0x2ebeab=_0x2ebeab-0x0;var _0x2daebd=_0x914f[_0x2ebeab];return _0x2daebd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf914('0x0'));module[_0xf914('0x1')]={'type':{'type':Sequelize[_0xf914('0x2')](_0xf914('0x3'),'attended')},'result':{'type':Sequelize[_0xf914('0x4')]},'transfererchannel':{'type':Sequelize[_0xf914('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf914('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf914('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf914('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xf914('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xf914('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xf914('0x4')]},'transfereechannel':{'type':Sequelize[_0xf914('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xf914('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xf914('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xf914('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xf914('0x4')]},'transfereecontext':{'type':Sequelize[_0xf914('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf914('0x2')](_0xf914('0x5'),'No')},'context':{'type':Sequelize[_0xf914('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaeef=['Yes','sequelize','moment','exports','ENUM','attended','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaeef,0x94));var _0xfaee=function(_0xf0122,_0x239494){_0xf0122=_0xf0122-0x0;var _0x56bf47=_0xaeef[_0xf0122];return _0x56bf47;};'use strict';var Sequelize=require(_0xfaee('0x0'));var moment=require(_0xfaee('0x1'));module[_0xfaee('0x2')]={'type':{'type':Sequelize[_0xfaee('0x3')]('blind',_0xfaee('0x4'))},'result':{'type':Sequelize[_0xfaee('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xfaee('0x5')]},'transferercalleridname':{'type':Sequelize[_0xfaee('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfaee('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xfaee('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xfaee('0x5')]},'transferercontext':{'type':Sequelize[_0xfaee('0x5')]},'transfererexten':{'type':Sequelize[_0xfaee('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xfaee('0x5')]},'transfereechannel':{'type':Sequelize[_0xfaee('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xfaee('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfaee('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfaee('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xfaee('0x5')]},'transfereeexten':{'type':Sequelize[_0xfaee('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xfaee('0x5')]},'isexternal':{'type':Sequelize[_0xfaee('0x3')](_0xfaee('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xfaee('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 10ff46c..83bfc16 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 _0x9040=['mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','then','stack','name','send','index','VoiceTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x29bc3a,_0x2904e3){var _0x5677e2=function(_0x5ba99e){while(--_0x5ba99e){_0x29bc3a['push'](_0x29bc3a['shift']());}};_0x5677e2(++_0x2904e3);}(_0x9040,0x170));var _0x0904=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x9040[_0xd1d19a];return _0x52a79d;};'use strict';var pdf=require(_0x0904('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0904('0x1'));var zipdir=require(_0x0904('0x2'));var jsonpatch=require(_0x0904('0x3'));var rp=require(_0x0904('0x4'));var moment=require(_0x0904('0x5'));var BPromise=require(_0x0904('0x6'));var Mustache=require(_0x0904('0x7'));var util=require('util');var path=require(_0x0904('0x8'));var sox=require(_0x0904('0x9'));var csv=require('to-csv');var ejs=require(_0x0904('0xa'));var fs=require('fs');var _=require(_0x0904('0xb'));var squel=require(_0x0904('0xc'));var crypto=require(_0x0904('0xd'));var jsforce=require(_0x0904('0xe'));var deskjs=require(_0x0904('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0904('0x10'));var Papa=require(_0x0904('0x11'));var Redis=require(_0x0904('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0904('0x13'));var as=require(_0x0904('0x14'));var hardwareService=require(_0x0904('0x15'));var logger=require('../../config/logger')(_0x0904('0x16'));var utils=require(_0x0904('0x17'));var config=require(_0x0904('0x18'));var licenseUtil=require(_0x0904('0x19'));var db=require(_0x0904('0x1a'))['db'];function respondWithStatusCode(_0x3b2239,_0x46435b){_0x46435b=_0x46435b||0xcc;return function(_0x4fc04b){if(_0x4fc04b){return _0x3b2239[_0x0904('0x1b')](_0x46435b);}return _0x3b2239['status'](_0x46435b)[_0x0904('0x1c')]();};}function respondWithResult(_0x497ab9,_0x5b1895){_0x5b1895=_0x5b1895||0xc8;return function(_0x4cc898){if(_0x4cc898){return _0x497ab9[_0x0904('0x1d')](_0x5b1895)[_0x0904('0x1e')](_0x4cc898);}};}function respondWithFilteredResult(_0x1a6180,_0x59b77e){return function(_0x2af569){if(_0x2af569){var _0x4f7cb7=_0x2af569[_0x0904('0x1f')],_0x3e47c8=_0x59b77e[_0x0904('0x20')],_0x5302e6=_0x59b77e[_0x0904('0x20')]+_0x59b77e['limit'],_0x27d7c1;if(_0x5302e6>=_0x4f7cb7){_0x5302e6=_0x4f7cb7;_0x27d7c1=0xc8;}else{_0x27d7c1=0xce;}_0x1a6180[_0x0904('0x1d')](_0x27d7c1);return _0x1a6180[_0x0904('0x21')](_0x0904('0x22'),_0x3e47c8+'-'+_0x5302e6+'/'+_0x4f7cb7)[_0x0904('0x1e')](_0x2af569);}return null;};}function patchUpdates(_0x32c44b){return function(_0x102854){try{jsonpatch[_0x0904('0x23')](_0x102854,_0x32c44b,!![]);}catch(_0x454a23){return BPromise['reject'](_0x454a23);}return _0x102854['save']();};}function saveUpdates(_0x39298e,_0x2c1750){return function(_0xd00c64){if(_0xd00c64){return _0xd00c64[_0x0904('0x24')](_0x39298e)[_0x0904('0x25')](function(_0x598b65){return _0x598b65;});}return null;};}function removeEntity(_0x37ba56,_0x62e5f2){return function(_0x5b4923){if(_0x5b4923){return _0x5b4923['destroy']()[_0x0904('0x25')](function(){_0x37ba56[_0x0904('0x1d')](0xcc)[_0x0904('0x1c')]();});}};}function handleEntityNotFound(_0x2f607b,_0x3d6b82){return function(_0xee0aa3){if(!_0xee0aa3){_0x2f607b[_0x0904('0x1b')](0x194);}return _0xee0aa3;};}function handleError(_0x53d652,_0x44d434){_0x44d434=_0x44d434||0x1f4;return function(_0x4695de){logger['error'](_0x4695de[_0x0904('0x26')]);if(_0x4695de[_0x0904('0x27')]){delete _0x4695de['name'];}_0x53d652[_0x0904('0x1d')](_0x44d434)[_0x0904('0x28')](_0x4695de);};}exports[_0x0904('0x29')]=function(_0x2de494,_0xfb9863){var _0x589606={},_0x363d17={},_0x2de817={'count':0x0,'rows':[]};var _0x499b70=_['map'](db[_0x0904('0x2a')]['rawAttributes'],function(_0x5134ab){return{'name':_0x5134ab[_0x0904('0x2b')],'type':_0x5134ab[_0x0904('0x2c')][_0x0904('0x2d')]};});_0x363d17[_0x0904('0x2e')]=_[_0x0904('0x2f')](_0x499b70,_0x0904('0x27'));_0x363d17[_0x0904('0x30')]=_[_0x0904('0x31')](_0x2de494[_0x0904('0x30')]);_0x363d17[_0x0904('0x32')]=_[_0x0904('0x33')](_0x363d17[_0x0904('0x2e')],_0x363d17[_0x0904('0x30')]);_0x589606[_0x0904('0x34')]=_[_0x0904('0x33')](_0x363d17[_0x0904('0x2e')],qs[_0x0904('0x35')](_0x2de494[_0x0904('0x30')][_0x0904('0x35')]));_0x589606['attributes']=_0x589606[_0x0904('0x34')][_0x0904('0x36')]?_0x589606[_0x0904('0x34')]:_0x363d17[_0x0904('0x2e')];if(!_0x2de494['query'][_0x0904('0x37')]('nolimit')){_0x589606['limit']=qs[_0x0904('0x38')](_0x2de494[_0x0904('0x30')][_0x0904('0x38')]);_0x589606['offset']=qs[_0x0904('0x20')](_0x2de494[_0x0904('0x30')][_0x0904('0x20')]);}_0x589606[_0x0904('0x39')]=qs[_0x0904('0x3a')](_0x2de494['query'][_0x0904('0x3a')]);_0x589606[_0x0904('0x3b')]=qs['filters'](_[_0x0904('0x3c')](_0x2de494[_0x0904('0x30')],_0x363d17['filters']),_0x499b70);if(_0x2de494[_0x0904('0x30')][_0x0904('0x3d')]){_0x589606[_0x0904('0x3b')]=_['merge'](_0x589606[_0x0904('0x3b')],{'$or':_[_0x0904('0x2f')](_0x499b70,function(_0x345b30){if(_0x345b30[_0x0904('0x2c')]!==_0x0904('0x3e')){var _0x4d553d={};_0x4d553d[_0x345b30[_0x0904('0x27')]]={'$like':'%'+_0x2de494['query']['filter']+'%'};return _0x4d553d;}})});}_0x589606=_[_0x0904('0x3f')]({},_0x589606,_0x2de494[_0x0904('0x40')]);var _0x2d01c4={'where':_0x589606[_0x0904('0x3b')]};return db[_0x0904('0x2a')][_0x0904('0x1f')](_0x2d01c4)[_0x0904('0x25')](function(_0x44dd6a){_0x2de817[_0x0904('0x1f')]=_0x44dd6a;if(_0x2de494[_0x0904('0x30')][_0x0904('0x41')]){_0x589606[_0x0904('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x0904('0x43')](_0x589606);})[_0x0904('0x25')](function(_0x421881){_0x2de817['rows']=_0x421881;return _0x2de817;})[_0x0904('0x25')](respondWithFilteredResult(_0xfb9863,_0x589606))[_0x0904('0x44')](handleError(_0xfb9863,null));};exports[_0x0904('0x45')]=function(_0x3e23ef,_0x1b17dd){var _0x2ffe76={'raw':!![],'where':{'id':_0x3e23ef['params']['id']}},_0x2d9285={};_0x2d9285['model']=_[_0x0904('0x31')](db['VoiceTransferReport'][_0x0904('0x46')]);_0x2d9285[_0x0904('0x30')]=_[_0x0904('0x31')](_0x3e23ef['query']);_0x2d9285[_0x0904('0x32')]=_[_0x0904('0x33')](_0x2d9285['model'],_0x2d9285[_0x0904('0x30')]);_0x2ffe76[_0x0904('0x34')]=_[_0x0904('0x33')](_0x2d9285[_0x0904('0x2e')],qs[_0x0904('0x35')](_0x3e23ef[_0x0904('0x30')][_0x0904('0x35')]));_0x2ffe76['attributes']=_0x2ffe76[_0x0904('0x34')][_0x0904('0x36')]?_0x2ffe76['attributes']:_0x2d9285[_0x0904('0x2e')];if(_0x3e23ef[_0x0904('0x30')][_0x0904('0x41')]){_0x2ffe76[_0x0904('0x42')]=[{'all':!![]}];}_0x2ffe76=_['merge']({},_0x2ffe76,_0x3e23ef['options']);return db[_0x0904('0x2a')][_0x0904('0x47')](_0x2ffe76)[_0x0904('0x25')](handleEntityNotFound(_0x1b17dd,null))[_0x0904('0x25')](respondWithResult(_0x1b17dd,null))[_0x0904('0x44')](handleError(_0x1b17dd,null));};exports[_0x0904('0x48')]=function(_0x101a16,_0x2d6e4b){return db[_0x0904('0x2a')][_0x0904('0x48')](_0x101a16[_0x0904('0x49')],{})[_0x0904('0x25')](respondWithResult(_0x2d6e4b,0xc9))[_0x0904('0x44')](handleError(_0x2d6e4b,null));};exports['update']=function(_0x13f729,_0x2631b7){if(_0x13f729['body']['id']){delete _0x13f729[_0x0904('0x49')]['id'];}return db[_0x0904('0x2a')][_0x0904('0x47')]({'where':{'id':_0x13f729['params']['id']}})[_0x0904('0x25')](handleEntityNotFound(_0x2631b7,null))['then'](saveUpdates(_0x13f729[_0x0904('0x49')],null))[_0x0904('0x25')](respondWithResult(_0x2631b7,null))[_0x0904('0x44')](handleError(_0x2631b7,null));};exports['destroy']=function(_0x4f8812,_0x1ea521){return db[_0x0904('0x2a')][_0x0904('0x47')]({'where':{'id':_0x4f8812[_0x0904('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ea521,null))['then'](removeEntity(_0x1ea521,null))[_0x0904('0x44')](handleError(_0x1ea521,null));}; \ No newline at end of file +var _0xdddd=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key'];(function(_0x4beb94,_0x2af459){var _0x2da163=function(_0x1df694){while(--_0x1df694){_0x4beb94['push'](_0x4beb94['shift']());}};_0x2da163(++_0x2af459);}(_0xdddd,0xed));var _0xdddd=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0xdddd[_0x4bb2b9];return _0x40e2a2;};'use strict';var pdf=require(_0xdddd('0x0'));var emlformat=require(_0xdddd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdddd('0x2'));var jsonpatch=require(_0xdddd('0x3'));var rp=require(_0xdddd('0x4'));var moment=require(_0xdddd('0x5'));var BPromise=require(_0xdddd('0x6'));var Mustache=require(_0xdddd('0x7'));var util=require(_0xdddd('0x8'));var path=require(_0xdddd('0x9'));var sox=require(_0xdddd('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdddd('0xb'));var squel=require(_0xdddd('0xc'));var crypto=require('crypto');var jsforce=require(_0xdddd('0xd'));var deskjs=require(_0xdddd('0xe'));var toCsv=require(_0xdddd('0xf'));var querystring=require(_0xdddd('0x10'));var Papa=require(_0xdddd('0x11'));var Redis=require('ioredis');var authService=require(_0xdddd('0x12'));var qs=require(_0xdddd('0x13'));var as=require(_0xdddd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdddd('0x15'))(_0xdddd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdddd('0x17'))['db'];function respondWithStatusCode(_0x4bdad8,_0x5e967b){_0x5e967b=_0x5e967b||0xcc;return function(_0x4d4898){if(_0x4d4898){return _0x4bdad8[_0xdddd('0x18')](_0x5e967b);}return _0x4bdad8[_0xdddd('0x19')](_0x5e967b)[_0xdddd('0x1a')]();};}function respondWithResult(_0x3044ca,_0x2da256){_0x2da256=_0x2da256||0xc8;return function(_0x51269c){if(_0x51269c){return _0x3044ca[_0xdddd('0x19')](_0x2da256)[_0xdddd('0x1b')](_0x51269c);}};}function respondWithFilteredResult(_0x2b2b62,_0x14dbb1){return function(_0x52f89e){if(_0x52f89e){var _0x93fefa=_0x52f89e[_0xdddd('0x1c')],_0x5e966e=_0x14dbb1[_0xdddd('0x1d')],_0x3d26bf=_0x14dbb1['offset']+_0x14dbb1[_0xdddd('0x1e')],_0x24a611;if(_0x3d26bf>=_0x93fefa){_0x3d26bf=_0x93fefa;_0x24a611=0xc8;}else{_0x24a611=0xce;}_0x2b2b62[_0xdddd('0x19')](_0x24a611);return _0x2b2b62['set'](_0xdddd('0x1f'),_0x5e966e+'-'+_0x3d26bf+'/'+_0x93fefa)[_0xdddd('0x1b')](_0x52f89e);}return null;};}function patchUpdates(_0x1c1193){return function(_0x3d47d5){try{jsonpatch[_0xdddd('0x20')](_0x3d47d5,_0x1c1193,!![]);}catch(_0x7e144e){return BPromise['reject'](_0x7e144e);}return _0x3d47d5[_0xdddd('0x21')]();};}function saveUpdates(_0x4f23fb,_0x5ef64b){return function(_0x4655e1){if(_0x4655e1){return _0x4655e1[_0xdddd('0x22')](_0x4f23fb)['then'](function(_0x2eb417){return _0x2eb417;});}return null;};}function removeEntity(_0x317cb3,_0x2e2756){return function(_0x608ba4){if(_0x608ba4){return _0x608ba4[_0xdddd('0x23')]()[_0xdddd('0x24')](function(){_0x317cb3['status'](0xcc)[_0xdddd('0x1a')]();});}};}function handleEntityNotFound(_0x454db4,_0x27dd4c){return function(_0x462c4e){if(!_0x462c4e){_0x454db4[_0xdddd('0x18')](0x194);}return _0x462c4e;};}function handleError(_0xd91e37,_0x4a68e5){_0x4a68e5=_0x4a68e5||0x1f4;return function(_0x58f0a6){logger[_0xdddd('0x25')](_0x58f0a6['stack']);if(_0x58f0a6['name']){delete _0x58f0a6[_0xdddd('0x26')];}_0xd91e37['status'](_0x4a68e5)[_0xdddd('0x27')](_0x58f0a6);};}exports[_0xdddd('0x28')]=function(_0x2f2066,_0x48373b){var _0x494455={},_0x500883={},_0x2b521a={'count':0x0,'rows':[]};var _0x32ad31=_[_0xdddd('0x29')](db[_0xdddd('0x2a')][_0xdddd('0x2b')],function(_0x370c93){return{'name':_0x370c93[_0xdddd('0x2c')],'type':_0x370c93[_0xdddd('0x2d')][_0xdddd('0x2e')]};});_0x500883[_0xdddd('0x2f')]=_[_0xdddd('0x29')](_0x32ad31,_0xdddd('0x26'));_0x500883[_0xdddd('0x30')]=_[_0xdddd('0x31')](_0x2f2066[_0xdddd('0x30')]);_0x500883[_0xdddd('0x32')]=_[_0xdddd('0x33')](_0x500883[_0xdddd('0x2f')],_0x500883[_0xdddd('0x30')]);_0x494455[_0xdddd('0x34')]=_[_0xdddd('0x33')](_0x500883[_0xdddd('0x2f')],qs[_0xdddd('0x35')](_0x2f2066[_0xdddd('0x30')][_0xdddd('0x35')]));_0x494455[_0xdddd('0x34')]=_0x494455[_0xdddd('0x34')]['length']?_0x494455[_0xdddd('0x34')]:_0x500883['model'];if(!_0x2f2066[_0xdddd('0x30')][_0xdddd('0x36')](_0xdddd('0x37'))){_0x494455['limit']=qs[_0xdddd('0x1e')](_0x2f2066[_0xdddd('0x30')][_0xdddd('0x1e')]);_0x494455['offset']=qs[_0xdddd('0x1d')](_0x2f2066[_0xdddd('0x30')]['offset']);}_0x494455['order']=qs['sort'](_0x2f2066['query']['sort']);_0x494455[_0xdddd('0x38')]=qs[_0xdddd('0x32')](_['pick'](_0x2f2066[_0xdddd('0x30')],_0x500883[_0xdddd('0x32')]),_0x32ad31);if(_0x2f2066[_0xdddd('0x30')][_0xdddd('0x39')]){_0x494455[_0xdddd('0x38')]=_[_0xdddd('0x3a')](_0x494455[_0xdddd('0x38')],{'$or':_[_0xdddd('0x29')](_0x32ad31,function(_0x3030be){if(_0x3030be[_0xdddd('0x2d')]!==_0xdddd('0x3b')){var _0x32da2c={};_0x32da2c[_0x3030be[_0xdddd('0x26')]]={'$like':'%'+_0x2f2066[_0xdddd('0x30')][_0xdddd('0x39')]+'%'};return _0x32da2c;}})});}_0x494455=_[_0xdddd('0x3a')]({},_0x494455,_0x2f2066[_0xdddd('0x3c')]);var _0x1f9801={'where':_0x494455[_0xdddd('0x38')]};return db[_0xdddd('0x2a')][_0xdddd('0x1c')](_0x1f9801)[_0xdddd('0x24')](function(_0x2cf001){_0x2b521a[_0xdddd('0x1c')]=_0x2cf001;if(_0x2f2066[_0xdddd('0x30')][_0xdddd('0x3d')]){_0x494455[_0xdddd('0x3e')]=[{'all':!![]}];}return db[_0xdddd('0x2a')][_0xdddd('0x3f')](_0x494455);})[_0xdddd('0x24')](function(_0x43471a){_0x2b521a[_0xdddd('0x40')]=_0x43471a;return _0x2b521a;})[_0xdddd('0x24')](respondWithFilteredResult(_0x48373b,_0x494455))[_0xdddd('0x41')](handleError(_0x48373b,null));};exports[_0xdddd('0x42')]=function(_0x1fb89b,_0x454d5b){var _0x18e376={'raw':!![],'where':{'id':_0x1fb89b[_0xdddd('0x43')]['id']}},_0x33a1a9={};_0x33a1a9[_0xdddd('0x2f')]=_[_0xdddd('0x31')](db[_0xdddd('0x2a')]['rawAttributes']);_0x33a1a9[_0xdddd('0x30')]=_[_0xdddd('0x31')](_0x1fb89b[_0xdddd('0x30')]);_0x33a1a9[_0xdddd('0x32')]=_[_0xdddd('0x33')](_0x33a1a9[_0xdddd('0x2f')],_0x33a1a9[_0xdddd('0x30')]);_0x18e376[_0xdddd('0x34')]=_[_0xdddd('0x33')](_0x33a1a9[_0xdddd('0x2f')],qs[_0xdddd('0x35')](_0x1fb89b[_0xdddd('0x30')][_0xdddd('0x35')]));_0x18e376[_0xdddd('0x34')]=_0x18e376[_0xdddd('0x34')]['length']?_0x18e376[_0xdddd('0x34')]:_0x33a1a9[_0xdddd('0x2f')];if(_0x1fb89b[_0xdddd('0x30')][_0xdddd('0x3d')]){_0x18e376['include']=[{'all':!![]}];}_0x18e376=_['merge']({},_0x18e376,_0x1fb89b[_0xdddd('0x3c')]);return db[_0xdddd('0x2a')][_0xdddd('0x44')](_0x18e376)[_0xdddd('0x24')](handleEntityNotFound(_0x454d5b,null))[_0xdddd('0x24')](respondWithResult(_0x454d5b,null))[_0xdddd('0x41')](handleError(_0x454d5b,null));};exports[_0xdddd('0x45')]=function(_0x5e68ea,_0x2382e7){return db[_0xdddd('0x2a')]['create'](_0x5e68ea[_0xdddd('0x46')],{})['then'](respondWithResult(_0x2382e7,0xc9))[_0xdddd('0x41')](handleError(_0x2382e7,null));};exports[_0xdddd('0x22')]=function(_0x598406,_0x42b637){if(_0x598406[_0xdddd('0x46')]['id']){delete _0x598406[_0xdddd('0x46')]['id'];}return db[_0xdddd('0x2a')][_0xdddd('0x44')]({'where':{'id':_0x598406['params']['id']}})[_0xdddd('0x24')](handleEntityNotFound(_0x42b637,null))[_0xdddd('0x24')](saveUpdates(_0x598406[_0xdddd('0x46')],null))[_0xdddd('0x24')](respondWithResult(_0x42b637,null))['catch'](handleError(_0x42b637,null));};exports[_0xdddd('0x23')]=function(_0x384e77,_0x35926f){return db[_0xdddd('0x2a')][_0xdddd('0x44')]({'where':{'id':_0x384e77['params']['id']}})[_0xdddd('0x24')](handleEntityNotFound(_0x35926f,null))['then'](removeEntity(_0x35926f,null))['catch'](handleError(_0x35926f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index cfb38b8..a0c3022 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 _0xe67e=['define','VoiceTransferReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x526d7d,_0x28fafa){var _0xca43d0=function(_0x23def5){while(--_0x23def5){_0x526d7d['push'](_0x526d7d['shift']());}};_0xca43d0(++_0x28fafa);}(_0xe67e,0x1ca));var _0xee67=function(_0x262243,_0x2cba17){_0x262243=_0x262243-0x0;var _0x469f8f=_0xe67e[_0x262243];return _0x469f8f;};'use strict';var _=require(_0xee67('0x0'));var util=require(_0xee67('0x1'));var logger=require(_0xee67('0x2'))('api');var moment=require(_0xee67('0x3'));var BPromise=require(_0xee67('0x4'));var rp=require(_0xee67('0x5'));var fs=require('fs');var path=require(_0xee67('0x6'));var rimraf=require(_0xee67('0x7'));var config=require(_0xee67('0x8'));var attributes=require(_0xee67('0x9'));module['exports']=function(_0x131dcb,_0x28b6e5){return _0x131dcb[_0xee67('0xa')](_0xee67('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70c5=['bluebird','request-promise','path','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x70c5,0x1bf));var _0x570c=function(_0x3fcdcd,_0x27af89){_0x3fcdcd=_0x3fcdcd-0x0;var _0x305d49=_0x70c5[_0x3fcdcd];return _0x305d49;};'use strict';var _=require(_0x570c('0x0'));var util=require(_0x570c('0x1'));var logger=require(_0x570c('0x2'))(_0x570c('0x3'));var moment=require('moment');var BPromise=require(_0x570c('0x4'));var rp=require(_0x570c('0x5'));var fs=require('fs');var path=require(_0x570c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x570c('0x7')]=function(_0x42f0f1,_0x4acf72){return _0x42f0f1[_0x570c('0x8')](_0x570c('0x9'),attributes,{'tableName':_0x570c('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 d0291a3..8d7af31 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 _0x5cad=['CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result'];(function(_0x314485,_0x447bd2){var _0x1c4c96=function(_0x535c4b){while(--_0x535c4b){_0x314485['push'](_0x314485['shift']());}};_0x1c4c96(++_0x447bd2);}(_0x5cad,0x8c));var _0xd5ca=function(_0x5636a5,_0x2bb5dc){_0x5636a5=_0x5636a5-0x0;var _0x32c581=_0x5cad[_0x5636a5];return _0x32c581;};'use strict';var _=require(_0xd5ca('0x0'));var util=require(_0xd5ca('0x1'));var moment=require(_0xd5ca('0x2'));var BPromise=require(_0xd5ca('0x3'));var rs=require(_0xd5ca('0x4'));var fs=require('fs');var Redis=require(_0xd5ca('0x5'));var db=require(_0xd5ca('0x6'))['db'];var utils=require(_0xd5ca('0x7'));var logger=require(_0xd5ca('0x8'))(_0xd5ca('0x9'));var config=require(_0xd5ca('0xa'));var jayson=require(_0xd5ca('0xb'));var client=jayson[_0xd5ca('0xc')][_0xd5ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x33574c,_0x213303,_0x9cc275){return new BPromise(function(_0x1aa01e,_0x332a9a){return client[_0xd5ca('0xe')](_0x33574c,_0x9cc275)[_0xd5ca('0xf')](function(_0x5cb395){logger[_0xd5ca('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x213303,_0xd5ca('0x11'));logger['debug'](_0xd5ca('0x12'),_0x213303,'request\x20sent',JSON[_0xd5ca('0x13')](_0x5cb395));if(_0x5cb395[_0xd5ca('0x14')]){if(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x15')]===0x1f4){logger[_0xd5ca('0x14')](_0xd5ca('0x16'),_0x213303,_0x5cb395[_0xd5ca('0x14')]['message']);return _0x332a9a(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x17')]);}logger[_0xd5ca('0x14')](_0xd5ca('0x16'),_0x213303,_0x5cb395['error'][_0xd5ca('0x17')]);return _0x1aa01e(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x17')]);}else{logger[_0xd5ca('0x10')](_0xd5ca('0x16'),_0x213303,_0xd5ca('0x11'));_0x1aa01e(_0x5cb395[_0xd5ca('0x18')][_0xd5ca('0x17')]);}})['catch'](function(_0x5dbcaf){logger[_0xd5ca('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x213303,_0x5dbcaf);_0x332a9a(_0x5dbcaf);});});}exports[_0xd5ca('0x19')]=function(_0x23c792){var _0x1d0f57=this;return new Promise(function(_0xdd80f6,_0xc1737c){return db[_0xd5ca('0x1a')][_0xd5ca('0x1b')](_0x23c792[_0xd5ca('0x1c')],{'raw':_0x23c792[_0xd5ca('0x1d')]?_0x23c792[_0xd5ca('0x1d')][_0xd5ca('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x221e5a){logger['info'](_0xd5ca('0x19'),_0x23c792);logger[_0xd5ca('0x1f')](_0xd5ca('0x19'),_0x23c792,JSON[_0xd5ca('0x13')](_0x221e5a));_0xdd80f6(_0x221e5a);})[_0xd5ca('0x20')](function(_0x475a44){logger['error']('CreateVoiceTransferReport',_0x475a44[_0xd5ca('0x17')],_0x23c792);_0xc1737c(_0x1d0f57[_0xd5ca('0x14')](0x1f4,_0x475a44[_0xd5ca('0x17')]));});});}; \ No newline at end of file +var _0x257e=['CreateVoiceTransferReport','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','request\x20sent','result','VoiceTransferReport','body','options'];(function(_0x2b55a6,_0x1e31c6){var _0x9c169e=function(_0x265153){while(--_0x265153){_0x2b55a6['push'](_0x2b55a6['shift']());}};_0x9c169e(++_0x1e31c6);}(_0x257e,0x1dc));var _0xe257=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x257e[_0x220afa];return _0x1b79d1;};'use strict';var _=require('lodash');var util=require(_0xe257('0x0'));var moment=require(_0xe257('0x1'));var BPromise=require('bluebird');var rs=require(_0xe257('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe257('0x3'))['db'];var utils=require(_0xe257('0x4'));var logger=require(_0xe257('0x5'))(_0xe257('0x6'));var config=require('../../config/environment');var jayson=require(_0xe257('0x7'));var client=jayson[_0xe257('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278e88,_0x3313e5,_0x28b35c){return new BPromise(function(_0x558a9e,_0x1e839a){return client[_0xe257('0x9')](_0x278e88,_0x28b35c)[_0xe257('0xa')](function(_0x3fe0e1){logger[_0xe257('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x3313e5,'request\x20sent');logger[_0xe257('0xc')](_0xe257('0xd'),_0x3313e5,'request\x20sent',JSON[_0xe257('0xe')](_0x3fe0e1));if(_0x3fe0e1[_0xe257('0xf')]){if(_0x3fe0e1['error'][_0xe257('0x10')]===0x1f4){logger[_0xe257('0xf')](_0xe257('0x11'),_0x3313e5,_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);return _0x1e839a(_0x3fe0e1['error'][_0xe257('0x12')]);}logger[_0xe257('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x3313e5,_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);return _0x558a9e(_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);}else{logger[_0xe257('0xb')](_0xe257('0x11'),_0x3313e5,_0xe257('0x13'));_0x558a9e(_0x3fe0e1[_0xe257('0x14')][_0xe257('0x12')]);}})['catch'](function(_0x9df9de){logger['error'](_0xe257('0x11'),_0x3313e5,_0x9df9de);_0x1e839a(_0x9df9de);});});}exports['CreateVoiceTransferReport']=function(_0x481419){var _0x3189b3=this;return new Promise(function(_0x56f1dc,_0x49e150){return db[_0xe257('0x15')]['create'](_0x481419[_0xe257('0x16')],{'raw':_0x481419[_0xe257('0x17')]?_0x481419['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x34033d){logger['info']('CreateVoiceTransferReport',_0x481419);logger['debug']('CreateVoiceTransferReport',_0x481419,JSON[_0xe257('0xe')](_0x34033d));_0x56f1dc(_0x34033d);})['catch'](function(_0x2a2816){logger[_0xe257('0xf')](_0xe257('0x18'),_0x2a2816[_0xe257('0x12')],_0x481419);_0x49e150(_0x3189b3['error'](0x1f4,_0x2a2816['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5ee7af2..6420542 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 _0xaefc=['transfer','exports','express','Router','../../components/auth/service','post','/originate','originate','canUpdate','hangup','/answer','answer','isAuthenticated','/unhold','unhold','/calls','calls','/transfer'];(function(_0x51734f,_0x139dd4){var _0x5979b4=function(_0x143de6){while(--_0x143de6){_0x51734f['push'](_0x51734f['shift']());}};_0x5979b4(++_0x139dd4);}(_0xaefc,0xc8));var _0xcaef=function(_0x4b8037,_0x42fe4a){_0x4b8037=_0x4b8037-0x0;var _0x121747=_0xaefc[_0x4b8037];return _0x121747;};'use strict';var express=require(_0xcaef('0x0'));var router=express[_0xcaef('0x1')]();var auth=require(_0xcaef('0x2'));var controller=require('./webbar.controller');router[_0xcaef('0x3')](_0xcaef('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xcaef('0x5')]);router[_0xcaef('0x3')]('/hangup',auth['isAuthenticated'](),auth[_0xcaef('0x6')](),controller[_0xcaef('0x7')]);router['post'](_0xcaef('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xcaef('0x9')]);router[_0xcaef('0x3')]('/hold',auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller['hold']);router[_0xcaef('0x3')](_0xcaef('0xb'),auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller[_0xcaef('0xc')]);router[_0xcaef('0x3')](_0xcaef('0xd'),auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller[_0xcaef('0xe')]);router['post'](_0xcaef('0xf'),auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller[_0xcaef('0x10')]);module[_0xcaef('0x11')]=router; \ No newline at end of file +var _0x6953=['post','isAuthenticated','hangup','/answer','unhold','/calls','calls','/transfer','transfer','exports','express','Router','/originate','canUpdate','originate'];(function(_0x22908f,_0x764a4e){var _0x424530=function(_0x575380){while(--_0x575380){_0x22908f['push'](_0x22908f['shift']());}};_0x424530(++_0x764a4e);}(_0x6953,0x91));var _0x3695=function(_0xdd3ba3,_0x320c25){_0xdd3ba3=_0xdd3ba3-0x0;var _0x2f0791=_0x6953[_0xdd3ba3];return _0x2f0791;};'use strict';var express=require(_0x3695('0x0'));var router=express[_0x3695('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0x3695('0x2'),auth['isAuthenticated'](),auth[_0x3695('0x3')](),controller[_0x3695('0x4')]);router[_0x3695('0x5')]('/hangup',auth[_0x3695('0x6')](),auth['canUpdate'](),controller[_0x3695('0x7')]);router[_0x3695('0x5')](_0x3695('0x8'),auth[_0x3695('0x6')](),auth[_0x3695('0x3')](),controller['answer']);router[_0x3695('0x5')]('/hold',auth[_0x3695('0x6')](),auth['canUpdate'](),controller['hold']);router[_0x3695('0x5')]('/unhold',auth[_0x3695('0x6')](),auth[_0x3695('0x3')](),controller[_0x3695('0x9')]);router[_0x3695('0x5')](_0x3695('0xa'),auth[_0x3695('0x6')](),auth['canUpdate'](),controller[_0x3695('0xb')]);router[_0x3695('0x5')](_0x3695('0xc'),auth[_0x3695('0x6')](),auth[_0x3695('0x3')](),controller[_0x3695('0xd')]);module[_0x3695('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b0c2934..e3cb52f 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 _0x44ae=['sessionId','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold\x20fired:','unhold\x20executed!','calls','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','handleError:','error','stack','name','status','send','NotFound','then','code','message','result','catch','User','agent','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','body','json','userId','callNumber','callerId','callbackUrl','info','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','validate','user:%s','answer','answer\x20fired:'];(function(_0x4f8f18,_0x1a6ab0){var _0x331d0b=function(_0x510c5e){while(--_0x510c5e){_0x4f8f18['push'](_0x4f8f18['shift']());}};_0x331d0b(++_0x1a6ab0);}(_0x44ae,0x17d));var _0xe44a=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x44ae[_0x4164f2];return _0x2575c7;};'use strict';var path=require(_0xe44a('0x0'));var fs=require('fs');var _=require(_0xe44a('0x1'));var db=require(_0xe44a('0x2'))['db'];var config=require(_0xe44a('0x3'));var util=require('util');var BPromise=require(_0xe44a('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xe44a('0x5')][_0xe44a('0x6')]({'port':0x232a});var logger=require(_0xe44a('0x7'))(_0xe44a('0x8'));var Redis=require(_0xe44a('0x9'));config[_0xe44a('0xa')]=_['defaults'](config[_0xe44a('0xa')],{'host':_0xe44a('0xb'),'port':0x18eb});var io=require(_0xe44a('0xc'))(new Redis(config[_0xe44a('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'callNumber':{'type':_0xe44a('0xf'),'required':[!![],_0xe44a('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe44a('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0xe44a('0x11')]},'transferNumber':{'type':_0xe44a('0xf'),'required':[!![],_0xe44a('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe44a('0xe')]}});function emit(_0x96dee,_0x51a060,_0x550491){logger['info'](_0x96dee,_0x51a060,JSON['stringify'](_0x550491));io['to'](_0x96dee)[_0xe44a('0x13')](_0x51a060,_0x550491);}function handleError(_0x1b943e){return function(_0x2a33b6){console['log'](_0xe44a('0x14'),_0x2a33b6,_0x2a33b6 instanceof RangeError);logger[_0xe44a('0x15')](_0x2a33b6[_0xe44a('0x16')]);if(_0x2a33b6 instanceof RangeError){if(_0x2a33b6[_0xe44a('0x17')]){delete _0x2a33b6[_0xe44a('0x17')];}_0x1b943e[_0xe44a('0x18')](0x194)['send'](_0x2a33b6);}else{if(_0x2a33b6[_0xe44a('0x17')]){delete _0x2a33b6['name'];}_0x1b943e[_0xe44a('0x18')](0x1f4)[_0xe44a('0x19')](_0x2a33b6);}};}function checkError(){return function(_0x35f878){if(!_0x35f878){throw new RangeError(_0xe44a('0x1a'));}return _0x35f878;};}function respondWithRpcPromise(_0x2e7cb7,_0x333d2d){return new BPromise(function(_0x37992e,_0x4e9bab){var _0x203889=amiClient;return _0x203889['request'](_0x2e7cb7,_0x333d2d)[_0xe44a('0x1b')](function(_0x2b53b9){if(_0x2b53b9[_0xe44a('0x15')]){if(_0x2b53b9[_0xe44a('0x15')][_0xe44a('0x1c')]===0x1f4){return _0x4e9bab(_0x2b53b9[_0xe44a('0x15')][_0xe44a('0x1d')]);}return _0x37992e(_0x2b53b9[_0xe44a('0x15')][_0xe44a('0x1d')]);}else{_0x37992e(_0x2b53b9[_0xe44a('0x1e')]);}})[_0xe44a('0x1f')](function(_0x46c16b){_0x4e9bab(_0x46c16b);});});}function getAgent(_0x12bf7c){return db[_0xe44a('0x20')]['findOne']({'where':{'id':_0x12bf7c,'role':_0xe44a('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x3bed81,_0x18acb6){return new BPromise(function(_0x4910a0,_0x552e3f){var _0x3fc048=respondWithRpcPromise(_0xe44a('0x22'));var _0x4c6690=getAgent(_0x3bed81);Promise[_0xe44a('0x23')]([_0x3fc048,_0x4c6690])['then'](function(_0x1cb6c7){var _0x5e0768=_0x1cb6c7[0x0];var _0x5a57a1=_0x1cb6c7[0x1];var _0x4b436b=_['filter'](_0x5e0768[_0xe44a('0x24')],function(_0x5e00f7){return _0x5e00f7[_0xe44a('0x25')]==_0x5a57a1['id']&&_0x5e00f7['sessionId']==_0x18acb6;});if(_0x4b436b[_0xe44a('0x26')]==0x1){_0x4910a0(_0x5a57a1);}else{_0x552e3f(new RangeError(_0xe44a('0x27')+_0x18acb6+_0xe44a('0x28')));}});});}exports['originate']=function(_0x12af37,_0x98e147){logger['info']('originate\x20fired:',_0x12af37[_0xe44a('0x29')]);var _0x5d102f=originateValidation['validate'](_0x12af37[_0xe44a('0x29')]);if(_0x5d102f[_0xe44a('0x26')]>0x0){return _0x98e147[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x5d102f);}var _0x1cc637=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2b')];var _0x42b698=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2c')];var _0x2ace0f=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2d')];var _0x41aa31=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2e')];return getAgent(_0x1cc637)['then'](function(_0x19e6e8){logger[_0xe44a('0x2f')]('entityFound:',_0x19e6e8[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')]('user:%s',_0x19e6e8['name']),_0xe44a('0x31'),{'callNumber':_0x42b698,'callerId':_0x2ace0f,'callbackUrl':_0x41aa31});return _0x98e147[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':_0xe44a('0x32')});})[_0xe44a('0x1f')](handleError(_0x98e147));};exports[_0xe44a('0x33')]=function(_0x49881c,_0x237502){logger[_0xe44a('0x2f')](_0xe44a('0x34'),_0x49881c[_0xe44a('0x29')]);var _0x44cf8b=hangupValidation[_0xe44a('0x35')](_0x49881c['body']);if(_0x44cf8b[_0xe44a('0x26')]>0x0){return _0x237502['status'](0x190)[_0xe44a('0x2a')](_0x44cf8b);}var _0x152ece=_0x49881c[_0xe44a('0x29')]['userId'];var _0x2c08d7=_0x49881c['body']['sessionId'];return getAgent(_0x152ece)[_0xe44a('0x1b')](function(_0x20a20d){logger['info']('entityFound:',_0x20a20d[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x20a20d[_0xe44a('0x17')]),'webbar:hangup',{'sessionId':_0x2c08d7});return _0x237502['status'](0xc8)[_0xe44a('0x2a')]({'error':![],'message':'hangup\x20executed!'});})[_0xe44a('0x1f')](handleError(_0x237502));};exports[_0xe44a('0x37')]=function(_0x1f6ac4,_0x367dda){logger[_0xe44a('0x2f')](_0xe44a('0x38'),_0x1f6ac4[_0xe44a('0x29')]);var _0x2048a3=answerValidation['validate'](_0x1f6ac4[_0xe44a('0x29')]);if(_0x2048a3['length']>0x0){return _0x367dda[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x2048a3);}var _0x5e66db=_0x1f6ac4['body'][_0xe44a('0x2b')];var _0x380833=_0x1f6ac4[_0xe44a('0x29')][_0xe44a('0x39')];return getAgent(_0x5e66db)['then'](function(_0x49c4ea){logger['info'](_0xe44a('0x3a'),_0x49c4ea[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x49c4ea[_0xe44a('0x17')]),_0xe44a('0x3b'),{'sessionId':_0x380833});return _0x367dda[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':_0xe44a('0x3c')});})[_0xe44a('0x1f')](handleError(_0x367dda));};exports[_0xe44a('0x3d')]=function(_0x3b06d8,_0x1bc7ac){logger[_0xe44a('0x2f')](_0xe44a('0x3e'),_0x3b06d8['body']);var _0x17e4a0=holdValidation[_0xe44a('0x35')](_0x3b06d8[_0xe44a('0x29')]);if(_0x17e4a0[_0xe44a('0x26')]>0x0){return _0x1bc7ac['status'](0x190)['json'](_0x17e4a0);}var _0x760a30=_0x3b06d8[_0xe44a('0x29')][_0xe44a('0x2b')];var _0x33862e=_0x3b06d8['body']['sessionId'];return getAgent(_0x760a30)['then'](function(_0x216344){logger[_0xe44a('0x2f')](_0xe44a('0x3a'),_0x216344[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x216344[_0xe44a('0x17')]),_0xe44a('0x3f'),{'sessionId':_0x33862e});return _0x1bc7ac[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x1bc7ac));};exports['unhold']=function(_0x370347,_0x3843fc){logger['info'](_0xe44a('0x40'),_0x370347[_0xe44a('0x29')]);var _0x348644=unholdValidation[_0xe44a('0x35')](_0x370347[_0xe44a('0x29')]);if(_0x348644[_0xe44a('0x26')]>0x0){return _0x3843fc[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x348644);}var _0x1cd90d=_0x370347['body']['userId'];var _0xef56cf=_0x370347[_0xe44a('0x29')]['sessionId'];return getAgent(_0x1cd90d)[_0xe44a('0x1b')](function(_0x84cf3e){logger['info'](_0xe44a('0x3a'),_0x84cf3e[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')]('user:%s',_0x84cf3e['name']),'webbar:unhold',{'sessionId':_0xef56cf});return _0x3843fc[_0xe44a('0x18')](0xc8)['json']({'error':![],'message':_0xe44a('0x41')});})[_0xe44a('0x1f')](handleError(_0x3843fc));};exports[_0xe44a('0x42')]=function(_0x5c9aab,_0x39513f){logger[_0xe44a('0x2f')]('calls\x20fired:',_0x39513f[_0xe44a('0x29')]);var _0x36b4e6=callsValidation['validate'](_0x5c9aab[_0xe44a('0x29')]);if(_0x36b4e6[_0xe44a('0x26')]>0x0){return _0x39513f['status'](0x190)[_0xe44a('0x2a')](_0x36b4e6);}var _0x22a58c=_0x5c9aab['body'][_0xe44a('0x2b')];var _0x3e0616=respondWithRpcPromise(_0xe44a('0x22'));var _0x4fbfd5=getAgent(_0x22a58c);return Promise[_0xe44a('0x23')]([_0x3e0616,_0x4fbfd5])[_0xe44a('0x1b')](function(_0xe4296){var _0x2055e4=_0xe4296[0x0];var _0x255123=_0xe4296[0x1];var _0x39c5d8=_['filter'](_0x2055e4[_0xe44a('0x24')],function(_0x156b49){return _0x156b49[_0xe44a('0x25')]==_0x255123['id'];});return _0x39513f['status'](0xc8)[_0xe44a('0x2a')]({'count':_0x39c5d8[_0xe44a('0x26')],'rows':_0x39c5d8});})[_0xe44a('0x1f')](handleError(_0x39513f));};exports['conference']=function(_0x4ce388,_0xbfef35){logger[_0xe44a('0x2f')](_0xe44a('0x43'),_0x4ce388[_0xe44a('0x29')]);var _0x1895e4=conferenceValidation[_0xe44a('0x35')](_0x4ce388[_0xe44a('0x29')]);if(_0x1895e4[_0xe44a('0x26')]>0x0){return _0xbfef35['status'](0x190)[_0xe44a('0x2a')](_0x1895e4);}var _0x75a578=_0x4ce388[_0xe44a('0x29')]['userId'];return getAgent(_0x75a578)[_0xe44a('0x1b')](function(_0x417976){logger['info'](_0xe44a('0x3a'),_0x417976[_0xe44a('0x17')]);emit(util['format'](_0xe44a('0x36'),_0x417976[_0xe44a('0x17')]),_0xe44a('0x44'));return _0xbfef35[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0xe44a('0x1f')](handleError(_0xbfef35));};exports['transfer']=function(_0x1010b2,_0x193ebd){logger['info'](_0xe44a('0x45'),_0x1010b2['body']);var _0x5d61f9=transferValidation[_0xe44a('0x35')](_0x1010b2[_0xe44a('0x29')]);if(_0x5d61f9[_0xe44a('0x26')]>0x0){return _0x193ebd[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x5d61f9);}var _0x1f9739=_0x1010b2[_0xe44a('0x29')][_0xe44a('0x2b')];var _0x7d84d2=_0x1010b2[_0xe44a('0x29')][_0xe44a('0x39')];var _0x4f567c=_0x1010b2[_0xe44a('0x29')][_0xe44a('0x46')];return getAgent(_0x1f9739)[_0xe44a('0x1b')](function(_0x481646){logger[_0xe44a('0x2f')](_0xe44a('0x3a'),_0x481646[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x481646[_0xe44a('0x17')]),_0xe44a('0x47'),{'sessionId':_0x7d84d2,'transferNumber':_0x4f567c});return _0x193ebd[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':_0xe44a('0x48')});})[_0xe44a('0x1f')](handleError(_0x193ebd));}; \ No newline at end of file +var _0x9589=['\x20not\x20found!','info','originate\x20fired:','body','length','json','userId','callNumber','entityFound:','format','webbar:originate','originate\x20executed!','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','UserId','conference','webbar:conference','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','name','send','status','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','sessionId\x20'];(function(_0x12245e,_0x2c2323){var _0x1a9c95=function(_0x25bcef){while(--_0x25bcef){_0x12245e['push'](_0x12245e['shift']());}};_0x1a9c95(++_0x2c2323);}(_0x9589,0xbc));var _0x9958=function(_0x1ef73a,_0x3cf8c7){_0x1ef73a=_0x1ef73a-0x0;var _0x2c341b=_0x9589[_0x1ef73a];return _0x2c341b;};'use strict';var path=require(_0x9958('0x0'));var fs=require('fs');var _=require(_0x9958('0x1'));var db=require(_0x9958('0x2'))['db'];var config=require(_0x9958('0x3'));var util=require(_0x9958('0x4'));var BPromise=require('bluebird');var jayson=require(_0x9958('0x5'));var amiClient=jayson[_0x9958('0x6')][_0x9958('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0x9958('0x8'));var Redis=require(_0x9958('0x9'));config[_0x9958('0xa')]=_[_0x9958('0xb')](config[_0x9958('0xa')],{'host':_0x9958('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9958('0xa')]));var Schema=require(_0x9958('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9958('0xe'),'required':[!![],_0x9958('0xf')]},'callNumber':{'type':_0x9958('0x10'),'required':[!![],_0x9958('0x11')]},'callerId':{'type':_0x9958('0x10')},'callbackUrl':{'type':_0x9958('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x9958('0xe'),'required':[!![],_0x9958('0xf')]},'sessionId':{'type':_0x9958('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9958('0xe'),'required':[!![],_0x9958('0xf')]},'sessionId':{'type':_0x9958('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9958('0xe'),'required':[!![],_0x9958('0xf')]},'sessionId':{'type':_0x9958('0x10'),'required':[!![],_0x9958('0x12')]},'transferNumber':{'type':'string','required':[!![],_0x9958('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9958('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9958('0xe'),'required':[!![],_0x9958('0xf')]},'sessionId':{'type':_0x9958('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9958('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x9958('0xe'),'required':[!![],_0x9958('0xf')]}});function emit(_0x5caedb,_0x5638c5,_0x1e3397){logger['info'](_0x5caedb,_0x5638c5,JSON[_0x9958('0x14')](_0x1e3397));io['to'](_0x5caedb)[_0x9958('0x15')](_0x5638c5,_0x1e3397);}function handleError(_0x3c0b8b){return function(_0x33b903){console[_0x9958('0x16')](_0x9958('0x17'),_0x33b903,_0x33b903 instanceof RangeError);logger['error'](_0x33b903['stack']);if(_0x33b903 instanceof RangeError){if(_0x33b903[_0x9958('0x18')]){delete _0x33b903['name'];}_0x3c0b8b['status'](0x194)[_0x9958('0x19')](_0x33b903);}else{if(_0x33b903['name']){delete _0x33b903['name'];}_0x3c0b8b[_0x9958('0x1a')](0x1f4)[_0x9958('0x19')](_0x33b903);}};}function checkError(){return function(_0x1a9a31){if(!_0x1a9a31){throw new RangeError('NotFound');}return _0x1a9a31;};}function respondWithRpcPromise(_0x196ee1,_0x43cde6){return new BPromise(function(_0xb6be59,_0x31130c){var _0x65d7e1=amiClient;return _0x65d7e1[_0x9958('0x1b')](_0x196ee1,_0x43cde6)[_0x9958('0x1c')](function(_0x9b6fc2){if(_0x9b6fc2[_0x9958('0x1d')]){if(_0x9b6fc2[_0x9958('0x1d')][_0x9958('0x1e')]===0x1f4){return _0x31130c(_0x9b6fc2[_0x9958('0x1d')][_0x9958('0x1f')]);}return _0xb6be59(_0x9b6fc2['error'][_0x9958('0x1f')]);}else{_0xb6be59(_0x9b6fc2[_0x9958('0x20')]);}})[_0x9958('0x21')](function(_0x4a3f5f){_0x31130c(_0x4a3f5f);});});}function getAgent(_0x3ff265){return db[_0x9958('0x22')][_0x9958('0x23')]({'where':{'id':_0x3ff265,'role':_0x9958('0x24')}})[_0x9958('0x1c')](checkError());}function getAgentCheckSession(_0x575a82,_0x3cf2ca){return new BPromise(function(_0x2b7cb4,_0x11477b){var _0x5ae3a7=respondWithRpcPromise(_0x9958('0x25'));var _0x6c701a=getAgent(_0x575a82);Promise[_0x9958('0x26')]([_0x5ae3a7,_0x6c701a])[_0x9958('0x1c')](function(_0x8f4016){var _0x5dcdc9=_0x8f4016[0x0];var _0x1171bb=_0x8f4016[0x1];var _0xf02a22=_[_0x9958('0x27')](_0x5dcdc9[_0x9958('0x28')],function(_0x60f289){return _0x60f289['UserId']==_0x1171bb['id']&&_0x60f289[_0x9958('0x29')]==_0x3cf2ca;});if(_0xf02a22['length']==0x1){_0x2b7cb4(_0x1171bb);}else{_0x11477b(new RangeError(_0x9958('0x2a')+_0x3cf2ca+_0x9958('0x2b')));}});});}exports['originate']=function(_0x2fb388,_0x3301e6){logger[_0x9958('0x2c')](_0x9958('0x2d'),_0x2fb388[_0x9958('0x2e')]);var _0x9b9e50=originateValidation[_0x9958('0xd')](_0x2fb388[_0x9958('0x2e')]);if(_0x9b9e50[_0x9958('0x2f')]>0x0){return _0x3301e6['status'](0x190)[_0x9958('0x30')](_0x9b9e50);}var _0x52a306=_0x2fb388[_0x9958('0x2e')][_0x9958('0x31')];var _0x185d07=_0x2fb388['body'][_0x9958('0x32')];var _0x299443=_0x2fb388['body']['callerId'];var _0x2e6fe6=_0x2fb388[_0x9958('0x2e')]['callbackUrl'];return getAgent(_0x52a306)[_0x9958('0x1c')](function(_0x3d1260){logger[_0x9958('0x2c')](_0x9958('0x33'),_0x3d1260[_0x9958('0x18')]);emit(util[_0x9958('0x34')]('user:%s',_0x3d1260[_0x9958('0x18')]),_0x9958('0x35'),{'callNumber':_0x185d07,'callerId':_0x299443,'callbackUrl':_0x2e6fe6});return _0x3301e6[_0x9958('0x1a')](0xc8)[_0x9958('0x30')]({'error':![],'message':_0x9958('0x36')});})['catch'](handleError(_0x3301e6));};exports['hangup']=function(_0x4cd578,_0x5e06b7){logger['info'](_0x9958('0x37'),_0x4cd578[_0x9958('0x2e')]);var _0x2cb578=hangupValidation[_0x9958('0xd')](_0x4cd578[_0x9958('0x2e')]);if(_0x2cb578[_0x9958('0x2f')]>0x0){return _0x5e06b7[_0x9958('0x1a')](0x190)['json'](_0x2cb578);}var _0x395920=_0x4cd578[_0x9958('0x2e')][_0x9958('0x31')];var _0x3ef45f=_0x4cd578['body']['sessionId'];return getAgent(_0x395920)[_0x9958('0x1c')](function(_0x25e948){logger[_0x9958('0x2c')](_0x9958('0x33'),_0x25e948[_0x9958('0x18')]);emit(util[_0x9958('0x34')](_0x9958('0x38'),_0x25e948[_0x9958('0x18')]),_0x9958('0x39'),{'sessionId':_0x3ef45f});return _0x5e06b7['status'](0xc8)[_0x9958('0x30')]({'error':![],'message':_0x9958('0x3a')});})[_0x9958('0x21')](handleError(_0x5e06b7));};exports[_0x9958('0x3b')]=function(_0x25998c,_0x2a1f70){logger['info'](_0x9958('0x3c'),_0x25998c['body']);var _0x5ea07e=answerValidation[_0x9958('0xd')](_0x25998c[_0x9958('0x2e')]);if(_0x5ea07e[_0x9958('0x2f')]>0x0){return _0x2a1f70[_0x9958('0x1a')](0x190)[_0x9958('0x30')](_0x5ea07e);}var _0x39beee=_0x25998c[_0x9958('0x2e')][_0x9958('0x31')];var _0x25aa2e=_0x25998c[_0x9958('0x2e')][_0x9958('0x29')];return getAgent(_0x39beee)[_0x9958('0x1c')](function(_0x136cb9){logger[_0x9958('0x2c')](_0x9958('0x33'),_0x136cb9['name']);emit(util[_0x9958('0x34')](_0x9958('0x38'),_0x136cb9[_0x9958('0x18')]),_0x9958('0x3d'),{'sessionId':_0x25aa2e});return _0x2a1f70[_0x9958('0x1a')](0xc8)[_0x9958('0x30')]({'error':![],'message':_0x9958('0x3e')});})[_0x9958('0x21')](handleError(_0x2a1f70));};exports[_0x9958('0x3f')]=function(_0x25095a,_0x556c18){logger[_0x9958('0x2c')](_0x9958('0x40'),_0x25095a[_0x9958('0x2e')]);var _0x32eb58=holdValidation['validate'](_0x25095a[_0x9958('0x2e')]);if(_0x32eb58[_0x9958('0x2f')]>0x0){return _0x556c18['status'](0x190)['json'](_0x32eb58);}var _0x5eff0e=_0x25095a['body'][_0x9958('0x31')];var _0x570f9c=_0x25095a[_0x9958('0x2e')][_0x9958('0x29')];return getAgent(_0x5eff0e)['then'](function(_0x387a00){logger[_0x9958('0x2c')](_0x9958('0x33'),_0x387a00[_0x9958('0x18')]);emit(util[_0x9958('0x34')](_0x9958('0x38'),_0x387a00[_0x9958('0x18')]),_0x9958('0x41'),{'sessionId':_0x570f9c});return _0x556c18[_0x9958('0x1a')](0xc8)[_0x9958('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0x9958('0x21')](handleError(_0x556c18));};exports[_0x9958('0x42')]=function(_0x2634e6,_0xfbf634){logger[_0x9958('0x2c')](_0x9958('0x43'),_0x2634e6[_0x9958('0x2e')]);var _0x425d2a=unholdValidation[_0x9958('0xd')](_0x2634e6[_0x9958('0x2e')]);if(_0x425d2a[_0x9958('0x2f')]>0x0){return _0xfbf634[_0x9958('0x1a')](0x190)[_0x9958('0x30')](_0x425d2a);}var _0x132ea4=_0x2634e6[_0x9958('0x2e')][_0x9958('0x31')];var _0x362533=_0x2634e6[_0x9958('0x2e')][_0x9958('0x29')];return getAgent(_0x132ea4)[_0x9958('0x1c')](function(_0x29fcfc){logger[_0x9958('0x2c')](_0x9958('0x33'),_0x29fcfc['name']);emit(util[_0x9958('0x34')](_0x9958('0x38'),_0x29fcfc[_0x9958('0x18')]),'webbar:unhold',{'sessionId':_0x362533});return _0xfbf634[_0x9958('0x1a')](0xc8)[_0x9958('0x30')]({'error':![],'message':_0x9958('0x44')});})[_0x9958('0x21')](handleError(_0xfbf634));};exports['calls']=function(_0x23744c,_0x44c79e){logger[_0x9958('0x2c')](_0x9958('0x45'),_0x44c79e[_0x9958('0x2e')]);var _0x1a53ec=callsValidation[_0x9958('0xd')](_0x23744c['body']);if(_0x1a53ec[_0x9958('0x2f')]>0x0){return _0x44c79e[_0x9958('0x1a')](0x190)[_0x9958('0x30')](_0x1a53ec);}var _0x252cca=_0x23744c['body'][_0x9958('0x31')];var _0x54b17b=respondWithRpcPromise('VoiceChannels');var _0x24a479=getAgent(_0x252cca);return Promise[_0x9958('0x26')]([_0x54b17b,_0x24a479])[_0x9958('0x1c')](function(_0x499141){var _0x29de50=_0x499141[0x0];var _0x309a7f=_0x499141[0x1];var _0x34803a=_['filter'](_0x29de50[_0x9958('0x28')],function(_0x1e1fe8){return _0x1e1fe8[_0x9958('0x46')]==_0x309a7f['id'];});return _0x44c79e[_0x9958('0x1a')](0xc8)[_0x9958('0x30')]({'count':_0x34803a[_0x9958('0x2f')],'rows':_0x34803a});})[_0x9958('0x21')](handleError(_0x44c79e));};exports[_0x9958('0x47')]=function(_0x472ec6,_0x41eba8){logger['info']('conference\x20fired:',_0x472ec6[_0x9958('0x2e')]);var _0x564e3b=conferenceValidation['validate'](_0x472ec6[_0x9958('0x2e')]);if(_0x564e3b[_0x9958('0x2f')]>0x0){return _0x41eba8[_0x9958('0x1a')](0x190)[_0x9958('0x30')](_0x564e3b);}var _0x150c55=_0x472ec6['body'][_0x9958('0x31')];return getAgent(_0x150c55)[_0x9958('0x1c')](function(_0x25af8a){logger[_0x9958('0x2c')](_0x9958('0x33'),_0x25af8a['name']);emit(util[_0x9958('0x34')](_0x9958('0x38'),_0x25af8a[_0x9958('0x18')]),_0x9958('0x48'));return _0x41eba8['status'](0xc8)[_0x9958('0x30')]({'error':![],'message':_0x9958('0x49')});})['catch'](handleError(_0x41eba8));};exports[_0x9958('0x4a')]=function(_0x445dcc,_0xe96b11){logger[_0x9958('0x2c')]('transfer\x20fired:',_0x445dcc[_0x9958('0x2e')]);var _0x16a224=transferValidation['validate'](_0x445dcc[_0x9958('0x2e')]);if(_0x16a224[_0x9958('0x2f')]>0x0){return _0xe96b11[_0x9958('0x1a')](0x190)[_0x9958('0x30')](_0x16a224);}var _0x4b4781=_0x445dcc[_0x9958('0x2e')][_0x9958('0x31')];var _0xdb0621=_0x445dcc[_0x9958('0x2e')][_0x9958('0x29')];var _0xd2e9b5=_0x445dcc[_0x9958('0x2e')]['transferNumber'];return getAgent(_0x4b4781)[_0x9958('0x1c')](function(_0x3c5938){logger[_0x9958('0x2c')](_0x9958('0x33'),_0x3c5938[_0x9958('0x18')]);emit(util[_0x9958('0x34')](_0x9958('0x38'),_0x3c5938[_0x9958('0x18')]),_0x9958('0x4b'),{'sessionId':_0xdb0621,'transferNumber':_0xd2e9b5});return _0xe96b11['status'](0xc8)['json']({'error':![],'message':_0x9958('0x4c')});})['catch'](handleError(_0xe96b11));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 441de8f..6fd6011 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 _0xf4f4=['/:id/notify','notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','create','addAgents','addApplications'];(function(_0x475c1e,_0x49835e){var _0x15aad7=function(_0x296585){while(--_0x296585){_0x475c1e['push'](_0x475c1e['shift']());}};_0x15aad7(++_0x49835e);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x485f43,_0x174272){_0x485f43=_0x485f43-0x0;var _0x34f68e=_0xf4f4[_0x485f43];return _0x34f68e;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xa')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0xa')](_0x4f4f('0x11'),auth[_0x4f4f('0x8')](),controller['getAnswers']);router['get'](_0x4f4f('0x12'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);router[_0x4f4f('0xa')](_0x4f4f('0x14'),auth[_0x4f4f('0x8')](),controller['getApplications']);router[_0x4f4f('0x15')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0x16')]);router[_0x4f4f('0x15')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller['addDisposition']);router[_0x4f4f('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x4f4f('0x15')](_0x4f4f('0x12'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x17')]);router[_0x4f4f('0x15')](_0x4f4f('0x14'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x15')](_0x4f4f('0x19'),controller[_0x4f4f('0x1a')]);router[_0x4f4f('0x15')]('/:id/send',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1b')]);router[_0x4f4f('0x1c')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1d')]);router[_0x4f4f('0x1e')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1f')]);router[_0x4f4f('0x1e')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x20')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4f4f('0x21')]);router[_0x4f4f('0x1e')]('/:id/users',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x22')]);module[_0x4f4f('0x23')]=router; \ No newline at end of file +var _0x958a=['isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller'];(function(_0x55dc22,_0x391f3e){var _0x2dd8a8=function(_0x3f6150){while(--_0x3f6150){_0x55dc22['push'](_0x55dc22['shift']());}};_0x2dd8a8(++_0x391f3e);}(_0x958a,0x128));var _0xa958=function(_0x27c86e,_0x196af7){_0x27c86e=_0x27c86e-0x0;var _0x34ffec=_0x958a[_0x27c86e];return _0x34ffec;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var auth=require(_0xa958('0x5'));var interaction=require(_0xa958('0x6'));var config=require('../../config/environment');var controller=require(_0xa958('0x7'));router['get']('/',auth[_0xa958('0x8')](),controller[_0xa958('0x9')]);router[_0xa958('0xa')](_0xa958('0xb'),auth[_0xa958('0x8')](),controller[_0xa958('0xc')]);router[_0xa958('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa958('0xd')]);router[_0xa958('0xa')](_0xa958('0xe'),auth[_0xa958('0x8')](),controller[_0xa958('0xf')]);router[_0xa958('0xa')](_0xa958('0x10'),auth[_0xa958('0x8')](),controller[_0xa958('0x11')]);router[_0xa958('0xa')](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x13')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xa958('0x14')]);router[_0xa958('0x15')]('/',auth[_0xa958('0x8')](),controller['create']);router[_0xa958('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xa958('0x15')](_0xa958('0x10'),auth[_0xa958('0x8')](),controller[_0xa958('0x16')]);router[_0xa958('0x15')](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x17')]);router['post'](_0xa958('0x18'),auth['isAuthenticated'](),controller[_0xa958('0x19')]);router[_0xa958('0x15')]('/:id/notify',controller[_0xa958('0x1a')]);router[_0xa958('0x15')](_0xa958('0x1b'),auth[_0xa958('0x8')](),controller[_0xa958('0x1c')]);router[_0xa958('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xa958('0x1e')]);router[_0xa958('0x1f')](_0xa958('0x20'),auth['isAuthenticated'](),controller[_0xa958('0x21')]);router[_0xa958('0x1f')]('/:id/dispositions',auth[_0xa958('0x8')](),controller[_0xa958('0x22')]);router['delete']('/:id/canned_answers',auth[_0xa958('0x8')](),controller[_0xa958('0x23')]);router['delete'](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x24')]);module[_0xa958('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 32d40ab..b8aab31 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 _0x8e64=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','twilio'];(function(_0x431aa0,_0x38a17c){var _0x50a459=function(_0xfe761b){while(--_0xfe761b){_0x431aa0['push'](_0x431aa0['shift']());}};_0x50a459(++_0x38a17c);}(_0x8e64,0x193));var _0x48e6=function(_0x117f69,_0x89f2e3){_0x117f69=_0x117f69-0x0;var _0x3cece9=_0x8e64[_0x117f69];return _0x3cece9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x48e6('0x0'));module[_0x48e6('0x1')]={'name':{'type':Sequelize[_0x48e6('0x2')],'unique':_0x48e6('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x48e6('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x48e6('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x48e6('0x2')]},'type':{'type':Sequelize['ENUM'](_0x48e6('0x4'))},'accountSid':{'type':Sequelize[_0x48e6('0x2')]},'authToken':{'type':Sequelize[_0x48e6('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x48e6('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x48e6('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x48e6('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x48e6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x48e6('0x7')],'comment':_0x48e6('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x48e6('0x9'),'set':function(_0x190910){if(!_0x190910){this[_0x48e6('0xa')](_0x48e6('0xb'),null);}this[_0x48e6('0xa')]('mandatoryDisposition',_0x190910);}},'description':{'type':Sequelize[_0x48e6('0x2')]}}; \ No newline at end of file +var _0x8197=['sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x8197,0x190));var _0x7819=function(_0x271fa1,_0xf96af4){_0x271fa1=_0x271fa1-0x0;var _0x43b197=_0x8197[_0x271fa1];return _0x43b197;};'use strict';var Sequelize=require(_0x7819('0x0'));var rs=require(_0x7819('0x1'));module[_0x7819('0x2')]={'name':{'type':Sequelize[_0x7819('0x3')],'unique':_0x7819('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7819('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7819('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7819('0x3')],'defaultValue':function(){return rs[_0x7819('0x5')]();}},'phone':{'type':Sequelize[_0x7819('0x3')]},'type':{'type':Sequelize[_0x7819('0x6')](_0x7819('0x7'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7819('0x8')],'defaultValue':function(){return _0x7819('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7819('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7819('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7819('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7819('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7819('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7819('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7819('0xa')],'defaultValue':![],'comment':_0x7819('0xc'),'set':function(_0xd8f615){if(!_0xd8f615){this[_0x7819('0xd')](_0x7819('0xe'),null);}this[_0x7819('0xd')](_0x7819('0xf'),_0xd8f615);}},'description':{'type':Sequelize[_0x7819('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5836a11..31ada34 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 _0x0050=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','spread','emit','removeAgents','isArray','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','account','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','whatsapp:','MessageSid','isNil','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','limit','set','reject','destroy','get','WhatsappAccounts','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x5546dc,_0x51c095){var _0x2a3142=function(_0x393910){while(--_0x393910){_0x5546dc['push'](_0x5546dc['shift']());}};_0x2a3142(++_0x51c095);}(_0x0050,0x1cd));var _0x0005=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0050[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0x0005('0x0'));var emlformat=require(_0x0005('0x1'));var rimraf=require(_0x0005('0x2'));var zipdir=require(_0x0005('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0005('0x4'));var moment=require(_0x0005('0x5'));var BPromise=require(_0x0005('0x6'));var Mustache=require(_0x0005('0x7'));var util=require(_0x0005('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0005('0x9'));var ejs=require(_0x0005('0xa'));var fs=require('fs');var _=require(_0x0005('0xb'));var squel=require('squel');var crypto=require(_0x0005('0xc'));var jsforce=require(_0x0005('0xd'));var deskjs=require(_0x0005('0xe'));var toCsv=require(_0x0005('0x9'));var querystring=require(_0x0005('0xf'));var Papa=require('papaparse');var Redis=require(_0x0005('0x10'));var authService=require(_0x0005('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0005('0x12'));var hardwareService=require(_0x0005('0x13'));var logger=require(_0x0005('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0005('0x15'));var licenseUtil=require(_0x0005('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0005('0x17')](config[_0x0005('0x18')],{'host':_0x0005('0x19'),'port':0x18eb});var socket=require(_0x0005('0x1a'))(new Redis(config[_0x0005('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x0005('0x1b'));var client=jayson[_0x0005('0x1c')][_0x0005('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x46bc75,_0x5bf4b7,_0x26a37a,_0xa4bd69){return new BPromise(function(_0x1e177d,_0x51fef1){var _0x56b258=_0xa4bd69||client;return _0x56b258[_0x0005('0x1e')](_0x46bc75,_0x26a37a)[_0x0005('0x1f')](function(_0x48209a){logger[_0x0005('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x5bf4b7,_0x0005('0x21'));logger['debug'](_0x0005('0x22'),_0x5bf4b7,_0x0005('0x21'),JSON[_0x0005('0x23')](_0x48209a));if(_0x48209a[_0x0005('0x24')]){if(_0x48209a[_0x0005('0x24')][_0x0005('0x25')]===0x1f4){logger[_0x0005('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5bf4b7,_0x48209a['error']['message']);return _0x51fef1(_0x48209a['error'][_0x0005('0x26')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5bf4b7,_0x48209a[_0x0005('0x24')]['message']);return _0x1e177d(_0x48209a[_0x0005('0x24')][_0x0005('0x26')]);}else{logger[_0x0005('0x20')](_0x0005('0x27'),_0x5bf4b7,_0x0005('0x21'));_0x1e177d(_0x48209a[_0x0005('0x28')][_0x0005('0x26')]);}})[_0x0005('0x29')](function(_0x9ae35e){logger[_0x0005('0x24')](_0x0005('0x27'),_0x5bf4b7,_0x9ae35e);_0x51fef1(_0x9ae35e);});});}function respondWithStatusCode(_0x39b9e0,_0x4dd3b1){_0x4dd3b1=_0x4dd3b1||0xcc;return function(_0x381aad){if(_0x381aad){return _0x39b9e0[_0x0005('0x2a')](_0x4dd3b1);}return _0x39b9e0['status'](_0x4dd3b1)[_0x0005('0x2b')]();};}function respondWithResult(_0x169aaa,_0x566bec){_0x566bec=_0x566bec||0xc8;return function(_0x1c2528){if(_0x1c2528){return _0x169aaa[_0x0005('0x2c')](_0x566bec)[_0x0005('0x2d')](_0x1c2528);}};}function respondWithFilteredResult(_0xa6f8c3,_0x9df985){return function(_0x4fe38d){if(_0x4fe38d){var _0xee0d07=_0x4fe38d['count'],_0x635f7c=_0x9df985['offset'],_0x160c16=_0x9df985['offset']+_0x9df985[_0x0005('0x2e')],_0x4b85f8;if(_0x160c16>=_0xee0d07){_0x160c16=_0xee0d07;_0x4b85f8=0xc8;}else{_0x4b85f8=0xce;}_0xa6f8c3[_0x0005('0x2c')](_0x4b85f8);return _0xa6f8c3[_0x0005('0x2f')]('Content-Range',_0x635f7c+'-'+_0x160c16+'/'+_0xee0d07)['json'](_0x4fe38d);}return null;};}function patchUpdates(_0x55c33c){return function(_0x1c6abb){try{jsonpatch['apply'](_0x1c6abb,_0x55c33c,!![]);}catch(_0x37ee39){return BPromise[_0x0005('0x30')](_0x37ee39);}return _0x1c6abb['save']();};}function saveUpdates(_0x9617b0,_0x307692){return function(_0x4fb8e2){if(_0x4fb8e2){return _0x4fb8e2['update'](_0x9617b0)['then'](function(_0x46b487){return _0x46b487;});}return null;};}function removeEntity(_0x1cb4bb,_0x118132){return function(_0x25ae4d){if(_0x25ae4d){return _0x25ae4d[_0x0005('0x31')]()[_0x0005('0x1f')](function(){var _0x286714=_0x25ae4d[_0x0005('0x32')]({'plain':!![]});var _0x293f28=_0x0005('0x33');return db['UserProfileResource'][_0x0005('0x31')]({'where':{'type':_0x293f28,'resourceId':_0x286714['id']}})['then'](function(){return _0x25ae4d;});})['then'](function(){_0x1cb4bb[_0x0005('0x2c')](0xcc)[_0x0005('0x2b')]();});}};}function handleEntityNotFound(_0x15f0d0,_0x3405cf){return function(_0x59cd33){if(!_0x59cd33){_0x15f0d0[_0x0005('0x2a')](0x194);}return _0x59cd33;};}function handleError(_0x353d76,_0x9cddb){_0x9cddb=_0x9cddb||0x1f4;return function(_0x2e9062){logger[_0x0005('0x24')](_0x2e9062['stack']);if(_0x2e9062['name']){delete _0x2e9062['name'];}_0x353d76[_0x0005('0x2c')](_0x9cddb)[_0x0005('0x34')](_0x2e9062);};}exports[_0x0005('0x35')]=function(_0x25312e,_0x5b8c6c){var _0x4165b7={'include':[{'model':db['Pause'],'as':_0x0005('0x36')}]},_0x18e074={},_0xa2315c={'count':0x0,'rows':[]};var _0x30982e=_[_0x0005('0x37')](db[_0x0005('0x38')][_0x0005('0x39')],function(_0x418eff){return{'name':_0x418eff[_0x0005('0x3a')],'type':_0x418eff[_0x0005('0x3b')][_0x0005('0x3c')]};});_0x18e074[_0x0005('0x3d')]=_[_0x0005('0x37')](_0x30982e,_0x0005('0x3e'));_0x18e074[_0x0005('0x3f')]=_[_0x0005('0x40')](_0x25312e['query']);_0x18e074[_0x0005('0x41')]=_[_0x0005('0x42')](_0x18e074[_0x0005('0x3d')],_0x18e074['query']);_0x4165b7[_0x0005('0x43')]=_[_0x0005('0x42')](_0x18e074[_0x0005('0x3d')],qs[_0x0005('0x44')](_0x25312e[_0x0005('0x3f')][_0x0005('0x44')]));_0x4165b7[_0x0005('0x43')]=_0x4165b7[_0x0005('0x43')][_0x0005('0x45')]?_0x4165b7['attributes']:_0x18e074['model'];if(!_0x25312e[_0x0005('0x3f')][_0x0005('0x46')](_0x0005('0x47'))){_0x4165b7['limit']=qs[_0x0005('0x2e')](_0x25312e['query']['limit']);_0x4165b7[_0x0005('0x48')]=qs[_0x0005('0x48')](_0x25312e[_0x0005('0x3f')][_0x0005('0x48')]);}_0x4165b7[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x25312e[_0x0005('0x3f')][_0x0005('0x4a')]);_0x4165b7[_0x0005('0x4b')]=qs['filters'](_[_0x0005('0x4c')](_0x25312e[_0x0005('0x3f')],_0x18e074[_0x0005('0x41')]),_0x30982e);if(_0x25312e[_0x0005('0x3f')][_0x0005('0x4d')]){_0x4165b7[_0x0005('0x4b')]=_['merge'](_0x4165b7[_0x0005('0x4b')],{'$or':_[_0x0005('0x37')](_0x30982e,function(_0x10d184){if(_0x10d184[_0x0005('0x3b')]!==_0x0005('0x4e')){var _0x531de5={};_0x531de5[_0x10d184[_0x0005('0x3e')]]={'$like':'%'+_0x25312e[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x531de5;}})});}_0x4165b7=_[_0x0005('0x4f')]({},_0x4165b7,_0x25312e[_0x0005('0x50')]);var _0x751a57={'where':_0x4165b7[_0x0005('0x4b')]};return db[_0x0005('0x38')][_0x0005('0x51')](_0x751a57)[_0x0005('0x1f')](function(_0x3e1a6d){_0xa2315c['count']=_0x3e1a6d;if(_0x25312e['query'][_0x0005('0x52')]){_0x4165b7[_0x0005('0x53')]=[{'all':!![]}];}return db[_0x0005('0x38')][_0x0005('0x54')](_0x4165b7);})[_0x0005('0x1f')](function(_0x5bd947){_0xa2315c[_0x0005('0x55')]=_0x5bd947;return _0xa2315c;})['then'](respondWithFilteredResult(_0x5b8c6c,_0x4165b7))['catch'](handleError(_0x5b8c6c,null));};exports[_0x0005('0x56')]=function(_0x2e1d31,_0x8900b8){var _0x4974e3={'raw':![],'where':{'id':_0x2e1d31[_0x0005('0x57')]['id']},'include':[{'model':db[_0x0005('0x58')],'as':_0x0005('0x36')}]},_0x7833b5={};_0x7833b5[_0x0005('0x3d')]=_[_0x0005('0x40')](db[_0x0005('0x38')][_0x0005('0x39')]);_0x7833b5[_0x0005('0x3f')]=_['keys'](_0x2e1d31['query']);_0x7833b5[_0x0005('0x41')]=_[_0x0005('0x42')](_0x7833b5[_0x0005('0x3d')],_0x7833b5[_0x0005('0x3f')]);_0x4974e3[_0x0005('0x43')]=_[_0x0005('0x42')](_0x7833b5['model'],qs[_0x0005('0x44')](_0x2e1d31['query'][_0x0005('0x44')]));_0x4974e3['attributes']=_0x4974e3[_0x0005('0x43')][_0x0005('0x45')]?_0x4974e3[_0x0005('0x43')]:_0x7833b5[_0x0005('0x3d')];if(_0x2e1d31[_0x0005('0x3f')][_0x0005('0x52')]){_0x4974e3[_0x0005('0x53')]=[{'all':!![]}];}_0x4974e3=_[_0x0005('0x4f')]({},_0x4974e3,_0x2e1d31[_0x0005('0x50')]);return db['WhatsappAccount'][_0x0005('0x59')](_0x4974e3)[_0x0005('0x1f')](handleEntityNotFound(_0x8900b8,null))[_0x0005('0x1f')](respondWithResult(_0x8900b8,null))[_0x0005('0x29')](handleError(_0x8900b8,null));};exports['create']=function(_0x5d7005,_0xf64eac){return db[_0x0005('0x38')][_0x0005('0x5a')](_0x5d7005[_0x0005('0x5b')],{})['then'](function(_0x3a6499){var _0xe6c3ec=_0x5d7005[_0x0005('0x5c')][_0x0005('0x32')]({'plain':!![]});if(!_0xe6c3ec)throw new Error(_0x0005('0x5d'));if(_0xe6c3ec['role']===_0x0005('0x5c')){var _0x4c09d4=_0x3a6499['get']({'plain':!![]});var _0x1284ee=_0x0005('0x33');return db['UserProfileSection']['find']({'where':{'name':_0x1284ee,'userProfileId':_0xe6c3ec['userProfileId']},'raw':!![]})[_0x0005('0x1f')](function(_0x575a3b){if(_0x575a3b&&_0x575a3b[_0x0005('0x5e')]===0x0){return db[_0x0005('0x5f')][_0x0005('0x5a')]({'name':_0x4c09d4[_0x0005('0x3e')],'resourceId':_0x4c09d4['id'],'type':_0x575a3b[_0x0005('0x3e')],'sectionId':_0x575a3b['id']},{})[_0x0005('0x1f')](function(){return _0x3a6499;});}else{return _0x3a6499;}})[_0x0005('0x29')](function(_0x15be96){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15be96);throw _0x15be96;});}return _0x3a6499;})[_0x0005('0x1f')](respondWithResult(_0xf64eac,0xc9))[_0x0005('0x29')](handleError(_0xf64eac,null));};exports[_0x0005('0x60')]=function(_0x4777a8,_0x1f2b68){if(_0x4777a8[_0x0005('0x5b')]['id']){delete _0x4777a8[_0x0005('0x5b')]['id'];}return db[_0x0005('0x38')]['find']({'where':{'id':_0x4777a8[_0x0005('0x57')]['id']},'include':[{'model':db[_0x0005('0x58')],'as':_0x0005('0x36')}]})[_0x0005('0x1f')](handleEntityNotFound(_0x1f2b68,null))[_0x0005('0x1f')](saveUpdates(_0x4777a8['body'],null))['then'](respondWithResult(_0x1f2b68,null))[_0x0005('0x29')](handleError(_0x1f2b68,null));};exports[_0x0005('0x31')]=function(_0x49d45f,_0x42df44){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x49d45f['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x42df44,null))[_0x0005('0x1f')](removeEntity(_0x42df44,null))[_0x0005('0x29')](handleError(_0x42df44,null));};exports[_0x0005('0x61')]=function(_0x96253f,_0x585b7a){return db[_0x0005('0x38')]['describe']()[_0x0005('0x1f')](respondWithResult(_0x585b7a,null))[_0x0005('0x29')](handleError(_0x585b7a,null));};exports[_0x0005('0x62')]=function(_0x83fcbd,_0x1fb187,_0x2b7c08){if(_0x83fcbd['body']['id']){delete _0x83fcbd[_0x0005('0x5b')]['id'];}return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x83fcbd[_0x0005('0x57')]['id']}})['then'](handleEntityNotFound(_0x1fb187,null))[_0x0005('0x1f')](function(_0x577970){if(_0x577970){_0x83fcbd['body'][_0x0005('0x63')]=_0x577970['id'];return db[_0x0005('0x64')][_0x0005('0x5a')](_0x83fcbd[_0x0005('0x5b')]);}})['then'](respondWithResult(_0x1fb187,null))[_0x0005('0x29')](handleError(_0x1fb187,null));};exports[_0x0005('0x65')]=function(_0x20edb2,_0x531df7,_0x63bdc1){var _0x133178={'raw':![],'where':{}};var _0x266aac={};var _0x5798ad={'count':0x0,'rows':[]};return db[_0x0005('0x38')]['findOne']({'where':{'id':_0x20edb2[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x531df7,null))[_0x0005('0x1f')](function(_0x4b7c7d){if(_0x4b7c7d){_0x266aac[_0x0005('0x3d')]=_[_0x0005('0x40')](db['Disposition'][_0x0005('0x39')]);_0x266aac[_0x0005('0x3f')]=_[_0x0005('0x40')](_0x20edb2[_0x0005('0x3f')]);_0x266aac[_0x0005('0x41')]=_[_0x0005('0x42')](_0x266aac[_0x0005('0x3d')],_0x266aac['query']);_0x133178[_0x0005('0x43')]=_['intersection'](_0x266aac[_0x0005('0x3d')],qs[_0x0005('0x44')](_0x20edb2['query']['fields']));_0x133178['attributes']=_0x133178[_0x0005('0x43')][_0x0005('0x45')]?_0x133178[_0x0005('0x43')]:_0x266aac['model'];if(!_0x20edb2[_0x0005('0x3f')]['hasOwnProperty'](_0x0005('0x47'))){_0x133178[_0x0005('0x2e')]=qs[_0x0005('0x2e')](_0x20edb2[_0x0005('0x3f')][_0x0005('0x2e')]);_0x133178[_0x0005('0x48')]=qs[_0x0005('0x48')](_0x20edb2[_0x0005('0x3f')][_0x0005('0x48')]);}_0x133178[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x20edb2['query'][_0x0005('0x4a')]);_0x133178[_0x0005('0x4b')]=qs[_0x0005('0x41')](_[_0x0005('0x4c')](_0x20edb2[_0x0005('0x3f')],_0x266aac[_0x0005('0x41')]));_0x133178[_0x0005('0x4b')]['WhatsappAccountId']=_0x4b7c7d['id'];if(_0x20edb2['query'][_0x0005('0x4d')]){_0x133178[_0x0005('0x4b')]=_[_0x0005('0x4f')](_0x133178['where'],{'$or':_[_0x0005('0x37')](_0x133178['attributes'],function(_0x284db1){var _0x3ee7e3={};_0x3ee7e3[_0x284db1]={'$like':'%'+_0x20edb2[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x3ee7e3;})});}_0x133178=_['merge']({},_0x133178,_0x20edb2[_0x0005('0x50')]);return db['Disposition']['count']({'where':_0x133178[_0x0005('0x4b')]})[_0x0005('0x1f')](function(_0x120ce0){_0x5798ad['count']=_0x120ce0;if(_0x20edb2[_0x0005('0x3f')][_0x0005('0x52')]){_0x133178['include']=[{'all':!![]}];}return db[_0x0005('0x64')][_0x0005('0x54')](_0x133178);})[_0x0005('0x1f')](function(_0x3ca909){_0x5798ad[_0x0005('0x55')]=_0x3ca909;return _0x5798ad;});}})[_0x0005('0x1f')](respondWithFilteredResult(_0x531df7,_0x133178))[_0x0005('0x29')](handleError(_0x531df7,null));};exports[_0x0005('0x66')]=function(_0x182e85,_0xd20afe,_0x3a4a90){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x182e85[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0xd20afe,null))['then'](function(_0x32cd62){if(_0x32cd62){return _0x32cd62['removeDispositions'](_0x182e85[_0x0005('0x3f')][_0x0005('0x67')]);}})[_0x0005('0x1f')](respondWithStatusCode(_0xd20afe,null))[_0x0005('0x29')](handleError(_0xd20afe,null));};exports[_0x0005('0x68')]=function(_0x3819b5,_0x56b5ef,_0x4621af){if(_0x3819b5[_0x0005('0x5b')]['id']){delete _0x3819b5['body']['id'];}return db[_0x0005('0x38')]['find']({'where':{'id':_0x3819b5[_0x0005('0x57')]['id']}})['then'](handleEntityNotFound(_0x56b5ef,null))[_0x0005('0x1f')](function(_0x595b25){if(_0x595b25){_0x3819b5['body'][_0x0005('0x63')]=_0x595b25['id'];return db[_0x0005('0x69')][_0x0005('0x5a')](_0x3819b5['body']);}})[_0x0005('0x1f')](respondWithResult(_0x56b5ef,null))[_0x0005('0x29')](handleError(_0x56b5ef,null));};exports['getAnswers']=function(_0x450e85,_0x45dcfe,_0x3a9d77){var _0x500aa7={'raw':![],'where':{}};var _0x495cce={};var _0x1be09e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x0005('0x6a')]({'where':{'id':_0x450e85['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x45dcfe,null))[_0x0005('0x1f')](function(_0x312d5f){if(_0x312d5f){_0x495cce[_0x0005('0x3d')]=_[_0x0005('0x40')](db[_0x0005('0x69')]['rawAttributes']);_0x495cce['query']=_[_0x0005('0x40')](_0x450e85[_0x0005('0x3f')]);_0x495cce[_0x0005('0x41')]=_[_0x0005('0x42')](_0x495cce[_0x0005('0x3d')],_0x495cce[_0x0005('0x3f')]);_0x500aa7['attributes']=_['intersection'](_0x495cce[_0x0005('0x3d')],qs['fields'](_0x450e85[_0x0005('0x3f')][_0x0005('0x44')]));_0x500aa7[_0x0005('0x43')]=_0x500aa7[_0x0005('0x43')][_0x0005('0x45')]?_0x500aa7[_0x0005('0x43')]:_0x495cce[_0x0005('0x3d')];if(!_0x450e85['query'][_0x0005('0x46')](_0x0005('0x47'))){_0x500aa7[_0x0005('0x2e')]=qs[_0x0005('0x2e')](_0x450e85[_0x0005('0x3f')][_0x0005('0x2e')]);_0x500aa7[_0x0005('0x48')]=qs['offset'](_0x450e85[_0x0005('0x3f')][_0x0005('0x48')]);}_0x500aa7[_0x0005('0x49')]=qs['sort'](_0x450e85[_0x0005('0x3f')][_0x0005('0x4a')]);_0x500aa7[_0x0005('0x4b')]=qs[_0x0005('0x41')](_[_0x0005('0x4c')](_0x450e85['query'],_0x495cce[_0x0005('0x41')]));_0x500aa7[_0x0005('0x4b')]['WhatsappAccountId']=_0x312d5f['id'];if(_0x450e85['query'][_0x0005('0x4d')]){_0x500aa7[_0x0005('0x4b')]=_[_0x0005('0x4f')](_0x500aa7['where'],{'$or':_[_0x0005('0x37')](_0x500aa7[_0x0005('0x43')],function(_0x1cfa08){var _0x5c820d={};_0x5c820d[_0x1cfa08]={'$like':'%'+_0x450e85[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x5c820d;})});}_0x500aa7=_['merge']({},_0x500aa7,_0x450e85[_0x0005('0x50')]);return db[_0x0005('0x69')][_0x0005('0x51')]({'where':_0x500aa7[_0x0005('0x4b')]})[_0x0005('0x1f')](function(_0x3e033b){_0x1be09e['count']=_0x3e033b;if(_0x450e85['query'][_0x0005('0x52')]){_0x500aa7[_0x0005('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x500aa7);})[_0x0005('0x1f')](function(_0x18d408){_0x1be09e[_0x0005('0x55')]=_0x18d408;return _0x1be09e;});}})[_0x0005('0x1f')](respondWithFilteredResult(_0x45dcfe,_0x500aa7))[_0x0005('0x29')](handleError(_0x45dcfe,null));};exports[_0x0005('0x6b')]=function(_0x477412,_0x1aad1c,_0x7db9f1){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x477412[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x1aad1c,null))[_0x0005('0x1f')](function(_0x52a2f1){if(_0x52a2f1){return _0x52a2f1[_0x0005('0x6b')](_0x477412[_0x0005('0x3f')][_0x0005('0x67')]);}})[_0x0005('0x1f')](respondWithStatusCode(_0x1aad1c,null))[_0x0005('0x29')](handleError(_0x1aad1c,null));};exports['addAgents']=function(_0x104317,_0x479cf9,_0x442f3a){return db['WhatsappAccount'][_0x0005('0x59')]({'where':{'id':_0x104317['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x479cf9,null))[_0x0005('0x1f')](function(_0x30d1f5){if(_0x30d1f5){return _0x30d1f5['addAgents'](_0x104317[_0x0005('0x5b')][_0x0005('0x67')],_['omit'](_0x104317[_0x0005('0x5b')],['ids','id'])||{})[_0x0005('0x6c')](function(_0x24be35){for(var _0x2d46f5=0x0;_0x2d46f5<_0x104317[_0x0005('0x5b')][_0x0005('0x67')][_0x0005('0x45')];_0x2d46f5+=0x1){socket[_0x0005('0x6d')]('userWhatsappAccount:save',{'UserId':_0x104317[_0x0005('0x5b')][_0x0005('0x67')][_0x2d46f5],'WhatsappAccountId':_0x104317[_0x0005('0x57')]['id']});}return _0x24be35;});}})[_0x0005('0x1f')](respondWithResult(_0x479cf9,null))[_0x0005('0x29')](handleError(_0x479cf9,null));};exports[_0x0005('0x6e')]=function(_0x43b494,_0x19f022,_0x3d79a1){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x43b494['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x19f022,null))[_0x0005('0x1f')](function(_0x5a1bbb){if(_0x5a1bbb){return _0x5a1bbb[_0x0005('0x6e')](_0x43b494[_0x0005('0x3f')]['ids'])[_0x0005('0x1f')](function(){if(_[_0x0005('0x6f')](_0x43b494[_0x0005('0x3f')][_0x0005('0x67')])){for(var _0x247953=0x0;_0x247953<_0x43b494[_0x0005('0x3f')]['ids']['length'];_0x247953+=0x1){socket[_0x0005('0x6d')]('userWhatsappAccount:remove',{'UserId':Number(_0x43b494[_0x0005('0x3f')][_0x0005('0x67')][_0x247953]),'WhatsappAccountId':Number(_0x43b494['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x43b494[_0x0005('0x3f')][_0x0005('0x67')]),'WhatsappAccountId':Number(_0x43b494[_0x0005('0x57')]['id'])});}});}})[_0x0005('0x1f')](respondWithStatusCode(_0x19f022,null))['catch'](handleError(_0x19f022,null));};exports[_0x0005('0x70')]=function(_0x4dea2b,_0x3ca63b,_0x4f44de){var _0x213d4b={};var _0x229d9d={};var _0x4d4c65;var _0x3a9717;return db[_0x0005('0x38')][_0x0005('0x6a')]({'where':{'id':_0x4dea2b[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x3ca63b,null))['then'](function(_0x134f42){if(_0x134f42){_0x4d4c65=_0x134f42;_0x229d9d[_0x0005('0x3d')]=_['keys'](db['User'][_0x0005('0x39')]);_0x229d9d['query']=_[_0x0005('0x40')](_0x4dea2b[_0x0005('0x3f')]);_0x229d9d[_0x0005('0x41')]=_['intersection'](_0x229d9d[_0x0005('0x3d')],_0x229d9d[_0x0005('0x3f')]);_0x213d4b[_0x0005('0x43')]=_[_0x0005('0x42')](_0x229d9d[_0x0005('0x3d')],qs['fields'](_0x4dea2b['query']['fields']));_0x213d4b[_0x0005('0x43')]=_0x213d4b[_0x0005('0x43')][_0x0005('0x45')]?_0x213d4b[_0x0005('0x43')]:_0x229d9d[_0x0005('0x3d')];_0x213d4b[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x4dea2b[_0x0005('0x3f')][_0x0005('0x4a')]);_0x213d4b[_0x0005('0x4b')]=qs[_0x0005('0x41')](_[_0x0005('0x4c')](_0x4dea2b[_0x0005('0x3f')],_0x229d9d[_0x0005('0x41')]));if(_0x4dea2b['query'][_0x0005('0x4d')]){_0x213d4b[_0x0005('0x4b')]=_[_0x0005('0x4f')](_0x213d4b[_0x0005('0x4b')],{'$or':_['map'](_0x213d4b[_0x0005('0x43')],function(_0x1a876a){var _0x493e0a={};_0x493e0a[_0x1a876a]={'$like':'%'+_0x4dea2b[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x493e0a;})});}_0x213d4b=_['merge']({},_0x213d4b,_0x4dea2b[_0x0005('0x50')]);return _0x4d4c65[_0x0005('0x70')](_0x213d4b);}})[_0x0005('0x1f')](function(_0x42dd21){if(_0x42dd21){_0x3a9717=_0x42dd21[_0x0005('0x45')];if(!_0x4dea2b[_0x0005('0x3f')][_0x0005('0x46')](_0x0005('0x47'))){_0x213d4b[_0x0005('0x2e')]=qs[_0x0005('0x2e')](_0x4dea2b[_0x0005('0x3f')][_0x0005('0x2e')]);_0x213d4b[_0x0005('0x48')]=qs[_0x0005('0x48')](_0x4dea2b['query'][_0x0005('0x48')]);}return _0x4d4c65['getAgents'](_0x213d4b);}})[_0x0005('0x1f')](function(_0x4fafd2){if(_0x4fafd2){return _0x4fafd2?{'count':_0x3a9717,'rows':_0x4fafd2}:null;}})[_0x0005('0x1f')](respondWithResult(_0x3ca63b,null))['catch'](handleError(_0x3ca63b,null));};exports[_0x0005('0x71')]=function(_0xf25395,_0x322033,_0x476314){return db['WhatsappAccount']['findOne']({'where':{'id':_0xf25395[_0x0005('0x57')]['id']}})['then'](handleEntityNotFound(_0x322033,null))['then'](function(_0x2aaffd){if(_0x2aaffd){return db[_0x0005('0x72')][_0x0005('0x73')](function(_0x4e7855){return db[_0x0005('0x74')][_0x0005('0x31')]({'where':{'WhatsappAccountId':_0xf25395['params']['id']},'transaction':_0x4e7855})[_0x0005('0x1f')](function(_0x3d58d9){var _0x34fe53=_[_0x0005('0x37')](_0xf25395[_0x0005('0x5b')],function(_0x244edd){_0x244edd[_0x0005('0x63')]=_0xf25395[_0x0005('0x57')]['id'];return _0x244edd;});return db[_0x0005('0x74')]['bulkCreate'](_0x34fe53,{'transaction':_0x4e7855});});})[_0x0005('0x1f')](function(){return db[_0x0005('0x74')][_0x0005('0x75')]({'where':{'WhatsappAccountId':_0xf25395[_0x0005('0x57')]['id']},'order':_0x0005('0x76')});});}})[_0x0005('0x1f')](respondWithResult(_0x322033,null))['catch'](handleError(_0x322033,null));};exports['getApplications']=function(_0x23d1bf,_0x3f305c,_0x386a20){var _0x4141fd={};var _0x692431={};var _0x1c92be;var _0x5ca434;return db[_0x0005('0x38')][_0x0005('0x6a')]({'where':{'id':_0x23d1bf['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x3f305c,null))[_0x0005('0x1f')](function(_0x2c3f18){if(_0x2c3f18){_0x1c92be=_0x2c3f18;_0x692431[_0x0005('0x3d')]=_[_0x0005('0x40')](db[_0x0005('0x74')][_0x0005('0x39')]);_0x692431[_0x0005('0x3f')]=_[_0x0005('0x40')](_0x23d1bf['query']);_0x692431[_0x0005('0x41')]=_['intersection'](_0x692431[_0x0005('0x3d')],_0x692431['query']);_0x4141fd[_0x0005('0x43')]=_[_0x0005('0x42')](_0x692431[_0x0005('0x3d')],qs[_0x0005('0x44')](_0x23d1bf[_0x0005('0x3f')]['fields']));_0x4141fd[_0x0005('0x43')]=_0x4141fd['attributes'][_0x0005('0x45')]?_0x4141fd[_0x0005('0x43')]:_0x692431[_0x0005('0x3d')];_0x4141fd[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x23d1bf[_0x0005('0x3f')][_0x0005('0x4a')]);_0x4141fd[_0x0005('0x4b')]=qs[_0x0005('0x41')](_['pick'](_0x23d1bf['query'],_0x692431['filters']));if(_0x23d1bf['query']['filter']){_0x4141fd['where']=_[_0x0005('0x4f')](_0x4141fd['where'],{'$or':_[_0x0005('0x37')](_0x4141fd['attributes'],function(_0x19f760){var _0x47c1b2={};_0x47c1b2[_0x19f760]={'$like':'%'+_0x23d1bf[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x47c1b2;})});}_0x4141fd=_['merge']({},_0x4141fd,_0x23d1bf[_0x0005('0x50')]);return _0x1c92be['getApplications'](_0x4141fd);}})['then'](function(_0x5afd0e){if(_0x5afd0e){_0x5ca434=_0x5afd0e[_0x0005('0x45')];if(!_0x23d1bf['query'][_0x0005('0x46')](_0x0005('0x47'))){_0x4141fd['limit']=qs['limit'](_0x23d1bf['query'][_0x0005('0x2e')]);_0x4141fd['offset']=qs[_0x0005('0x48')](_0x23d1bf[_0x0005('0x3f')][_0x0005('0x48')]);}return _0x1c92be[_0x0005('0x77')](_0x4141fd);}})[_0x0005('0x1f')](function(_0x50159a){if(_0x50159a){return _0x50159a?{'count':_0x5ca434,'rows':_0x50159a}:null;}})[_0x0005('0x1f')](respondWithResult(_0x3f305c,null))[_0x0005('0x29')](handleError(_0x3f305c,null));};exports[_0x0005('0x78')]=function(_0x3153de,_0x560207,_0x4da3a8){var _0x18c75b={'channel':'whatsapp'};var _0x40507f=[];var _0x41a3b8=[];var _0x1f3d27={};return db[_0x0005('0x38')]['find']({'where':{'id':_0x3153de['params']['id']},'include':[{'model':db[_0x0005('0x74')],'as':_0x0005('0x79')}]})[_0x0005('0x1f')](handleEntityNotFound(_0x560207,null))[_0x0005('0x1f')](function(_0x45c2cb){_0x18c75b['account']=_0x45c2cb;_0x18c75b[_0x0005('0x7a')]=_[_0x0005('0x7b')](_0x45c2cb[_0x0005('0x79')],['priority'],['asc']);if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x79')]){delete _0x18c75b[_0x0005('0x7c')]['Applications'];}return db[_0x0005('0x7d')]['describe']();})['then'](function(_0x4ee08f){if(!_0x4ee08f){throw new db['Sequelize']['ValidationError'](_0x0005('0x7e'));}_0x40507f=_[_0x0005('0x7f')](_[_0x0005('0x40')](_0x4ee08f),[_0x0005('0x80'),_0x0005('0x81')]);_0x41a3b8=_['difference'](_[_0x0005('0x40')](_0x4ee08f),[_0x0005('0x80'),_0x0005('0x81'),'CompanyId',_0x0005('0x82')]);_0x18c75b['body']={'mapKey':_0x0005('0x83')};if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x3b')]&&_0x18c75b[_0x0005('0x7c')][_0x0005('0x3b')]==='twilio'){_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')]=_0x3153de[_0x0005('0x5b')]['From']['replace'](_0x0005('0x85'),'');_0x18c75b['body'][_0x0005('0x5b')]=_0x3153de[_0x0005('0x5b')]['Body'];_0x18c75b[_0x0005('0x5b')]['messageId']=_0x3153de[_0x0005('0x5b')][_0x0005('0x86')];}if(_0x18c75b[_0x0005('0x5b')]['id']){delete _0x18c75b[_0x0005('0x5b')]['id'];}if(_[_0x0005('0x87')](_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')])){throw new db[(_0x0005('0x88'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x18c75b[_0x0005('0x5b')][_0x0005('0x5b')])||_0x18c75b[_0x0005('0x5b')][_0x0005('0x5b')]===''){throw new db[(_0x0005('0x88'))][(_0x0005('0x89'))](_0x0005('0x8a'));}if(_[_0x0005('0x87')](_0x18c75b['body'][_0x0005('0x8b')])){throw new db[(_0x0005('0x88'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41a3b8);}if(!_[_0x0005('0x8c')](_0x41a3b8,_0x18c75b[_0x0005('0x5b')][_0x0005('0x8b')])){throw new db[(_0x0005('0x88'))][(_0x0005('0x89'))](_0x0005('0x8d')+_0x41a3b8);}_0x1f3d27[_0x18c75b[_0x0005('0x5b')][_0x0005('0x8b')]]=_0x18c75b['body'][_0x0005('0x84')];return db[_0x0005('0x8e')][_0x0005('0x59')]({'where':{'id':_0x18c75b['account'][_0x0005('0x82')]},'include':[{'model':db[_0x0005('0x7d')],'as':_0x0005('0x8f'),'where':_0x1f3d27,'limit':0x1,'order':[['updatedAt',_0x0005('0x90')]]}]});})[_0x0005('0x1f')](handleEntityNotFound(_0x560207,null))['then'](function(_0x2a78a9){if(_0x2a78a9){_0x18c75b[_0x0005('0x91')]=_[_0x0005('0x92')](_0x2a78a9,[_0x0005('0x8f')]);if(_0x2a78a9['Contacts'][_0x0005('0x45')]){return _0x2a78a9[_0x0005('0x8f')][0x0];}var _0x4005ae=_[_0x0005('0x17')](_0x18c75b['body'],{'firstName':_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')],'ListId':_0x2a78a9['id']});_0x4005ae[_0x18c75b[_0x0005('0x5b')]['mapKey']]=_0x18c75b['body']['from'];return db[_0x0005('0x7d')][_0x0005('0x5a')](_0x4005ae,{'fields':_0x40507f,'raw':!![]});}})['then'](handleEntityNotFound(_0x560207,null))[_0x0005('0x1f')](function(_0x5bc445){if(_0x5bc445){_0x18c75b['contact']=_0x5bc445;var _0x4036d7={'ContactId':_0x5bc445['id'],'phone':_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')],'WhatsappAccountId':_0x3153de[_0x0005('0x57')]['id']};var _0x219320={'ContactId':_0x5bc445['id'],'WhatsappAccountId':_0x3153de[_0x0005('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x0005('0x59')]({'where':_0x219320})[_0x0005('0x1f')](function(_0x385d42){if(_0x385d42){return[_0x385d42,![]];}return db['WhatsappInteraction']['create'](_0x4036d7)[_0x0005('0x1f')](function(_0x5d9f3d){return[_0x5d9f3d,!![]];});});}})['spread'](function(_0x2d7db1,_0x249ee8){_0x18c75b[_0x0005('0x93')]=_0x2d7db1[_0x0005('0x32')]({'plain':!![]});_0x18c75b[_0x0005('0x93')][_0x0005('0x94')]=![];if(_0x249ee8){if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x95')]){_0x18c75b[_0x0005('0x7a')][_0x0005('0x96')]({'id':0x0,'priority':_0x18c75b[_0x0005('0x7a')][_0x0005('0x45')]+0x1,'app':_0x0005('0x97'),'appdata':_0x0005('0x98'),'interval':_0x0005('0x99')});}_0x18c75b[_0x0005('0x93')][_0x0005('0x94')]=!![];}return db[_0x0005('0x9a')][_0x0005('0x5a')]({'phone':_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')],'messageId':_0x18c75b[_0x0005('0x5b')][_0x0005('0x9b')],'body':_0x18c75b[_0x0005('0x5b')][_0x0005('0x5b')],'WhatsappAccountId':_0x3153de[_0x0005('0x57')]['id'],'WhatsappInteractionId':_0x2d7db1['id'],'direction':'in','ContactId':_0x2d7db1[_0x0005('0x9c')],'AttachmentId':_0x18c75b[_0x0005('0x5b')]['AttachmentId']});})[_0x0005('0x1f')](function(_0x386ad1){_0x18c75b[_0x0005('0x26')]=_0x386ad1;if(_0x18c75b['interaction']['UserId']){return db[_0x0005('0x9d')]['find']({'attributes':['id',_0x0005('0x3e')],'where':{'id':_0x18c75b[_0x0005('0x93')][_0x0005('0x9e')]}})[_0x0005('0x1f')](function(_0x11f799){if(_0x11f799){_0x18c75b[_0x0005('0x7a')][_0x0005('0x9f')]({'id':0x0,'priority':0x0,'app':_0x0005('0xa0'),'appdata':_0x11f799[_0x0005('0x3e')]+','+(_0x18c75b[_0x0005('0x7c')][_0x0005('0xa1')]||0xa),'interval':_0x0005('0x99')});}return respondWithRpcPromise(_0x0005('0xa2'),'startRouting',_0x18c75b);});}return respondWithRpcPromise(_0x0005('0xa2'),_0x0005('0xa3'),_0x18c75b);})[_0x0005('0x1f')](function(_0x365933){if(_0x365933){var _0x57e101=0xc8;var _0x152f23='receiveMessage';logger[_0x0005('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x152f23,_0x57e101,_0x0005('0xa4'));logger[_0x0005('0xa5')](_0x0005('0xa6'),_0x152f23,_0x57e101,_0x0005('0xa4'),JSON[_0x0005('0x23')](_0x365933));if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x3b')]===_0x0005('0xa7')){return _0x560207[_0x0005('0x2c')](_0x57e101)[_0x0005('0x2f')](_0x0005('0xa8'),_0x0005('0xa9'))[_0x0005('0x34')](_0x0005('0xaa'));}else{return _0x560207[_0x0005('0x2c')](_0x57e101)[_0x0005('0x2d')](_0x365933);}}})[_0x0005('0x29')](handleError(_0x560207,null));};exports[_0x0005('0x34')]=function(_0x412659,_0xbaa3ed,_0x3bc863){var _0x34356d,_0x25c1ad,_0x3c8096;if(_['isNil'](_0x412659[_0x0005('0x5b')][_0x0005('0x5b')])||_0x412659[_0x0005('0x5b')][_0x0005('0x5b')]===''){throw new db[(_0x0005('0x88'))][(_0x0005('0x89'))](_0x0005('0x8a'));}if(_[_0x0005('0x87')](_0x412659['body']['to'])){throw new db['Sequelize'][(_0x0005('0x89'))](_0x0005('0xab'));}_0x34356d=_0x412659['body']['to'];return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x412659['params']['id']},'include':[{'model':db[_0x0005('0x8e')],'as':_0x0005('0xac'),'include':[{'model':db['CmContact'],'as':_0x0005('0x8f'),'where':{'mobile':_0x34356d},'limit':0x1,'order':[[_0x0005('0x81'),_0x0005('0x90')]]}]}]})['then'](handleEntityNotFound(_0xbaa3ed,null))[_0x0005('0x1f')](function(_0x45116f){if(_0x45116f&&_0x45116f[_0x0005('0xac')]){_0x25c1ad=_0x45116f[_0x0005('0x32')]({'plain':!![]});if(_0x25c1ad['List']&&_0x25c1ad[_0x0005('0xac')][_0x0005('0x8f')][_0x0005('0x45')]){return _0x25c1ad['List'][_0x0005('0x8f')][0x0];}return db['CmContact']['create'](_[_0x0005('0x17')](_0x412659[_0x0005('0x5b')],{'firstName':_0x34356d,'mobile':_0x34356d,'phone':_0x34356d,'ListId':_0x25c1ad[_0x0005('0x82')]}));}})['then'](handleEntityNotFound(_0xbaa3ed,null))[_0x0005('0x1f')](function(_0x33483b){if(_0x33483b){_0x3c8096=_0x33483b;return db[_0x0005('0xad')][_0x0005('0x59')]({'where':{'ContactId':_0x3c8096['id'],'closed':![],'WhatsappAccountId':_0x25c1ad['id']}})[_0x0005('0x1f')](function(_0x13cb6e){if(_0x13cb6e){return[_0x13cb6e,![]];}return db[_0x0005('0xad')][_0x0005('0x5a')]({'UserId':_0x412659[_0x0005('0x5c')]['id'],'ContactId':_0x3c8096['id'],'WhatsappAccountId':_0x25c1ad['id'],'phone':_0x34356d,'firstMsgDirection':'out','Messages':[_['merge'](_0x412659[_0x0005('0x5b')],{'read':![],'body':_0x412659[_0x0005('0x5b')][_0x0005('0x5b')],'phone':_0x34356d,'WhatsappAccountId':_0x25c1ad['id'],'UserId':_0x412659['user']['id'],'ContactId':_0x3c8096['id']})]},{'include':[{'model':db[_0x0005('0x9a')],'as':'Messages'}]})['then'](function(_0x18e7c4){return[_0x18e7c4,!![]];});});}})['spread'](function(_0x22fb5a,_0x585804){if(_0x585804){return _0x22fb5a;}return db[_0x0005('0x9a')][_0x0005('0x5a')](_[_0x0005('0x4f')](_0x412659[_0x0005('0x5b')],{'read':![],'body':_0x412659['body']['body'],'phone':_0x34356d,'WhatsappAccountId':_0x25c1ad['id'],'WhatsappInteractionId':_0x22fb5a['id'],'UserId':_0x412659[_0x0005('0x5c')]['id'],'ContactId':_0x3c8096['id']}))[_0x0005('0x1f')](function(_0x352663){_0x22fb5a[_0x0005('0xae')]['Messages']=[];_0x22fb5a[_0x0005('0xae')]['Messages'][_0x0005('0x96')](_0x352663[_0x0005('0xae')]);return _0x22fb5a;});})[_0x0005('0x1f')](respondWithResult(_0xbaa3ed,null))[_0x0005('0x29')](handleError(_0xbaa3ed,null));}; \ No newline at end of file +var _0xe2b1=['messageId','MessageSid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','WhatsappMessage','ContactId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','send','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','stack','name','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','addAgents','spread','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','Applications','account','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body'];(function(_0x4145ed,_0x1965e3){var _0x2294a6=function(_0x21c3bb){while(--_0x21c3bb){_0x4145ed['push'](_0x4145ed['shift']());}};_0x2294a6(++_0x1965e3);}(_0xe2b1,0xde));var _0x1e2b=function(_0x1d4cd5,_0x119d19){_0x1d4cd5=_0x1d4cd5-0x0;var _0x4d5fbc=_0xe2b1[_0x1d4cd5];return _0x4d5fbc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e2b('0x0'));var rimraf=require(_0x1e2b('0x1'));var zipdir=require(_0x1e2b('0x2'));var jsonpatch=require(_0x1e2b('0x3'));var rp=require(_0x1e2b('0x4'));var moment=require(_0x1e2b('0x5'));var BPromise=require(_0x1e2b('0x6'));var Mustache=require('mustache');var util=require(_0x1e2b('0x7'));var path=require(_0x1e2b('0x8'));var sox=require(_0x1e2b('0x9'));var csv=require(_0x1e2b('0xa'));var ejs=require(_0x1e2b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e2b('0xc'));var crypto=require(_0x1e2b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1e2b('0xe'));var toCsv=require(_0x1e2b('0xa'));var querystring=require(_0x1e2b('0xf'));var Papa=require(_0x1e2b('0x10'));var Redis=require(_0x1e2b('0x11'));var authService=require(_0x1e2b('0x12'));var qs=require(_0x1e2b('0x13'));var as=require(_0x1e2b('0x14'));var hardwareService=require(_0x1e2b('0x15'));var logger=require('../../config/logger')(_0x1e2b('0x16'));var utils=require('../../config/utils');var config=require(_0x1e2b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e2b('0x18'))['db'];config[_0x1e2b('0x19')]=_[_0x1e2b('0x1a')](config[_0x1e2b('0x19')],{'host':_0x1e2b('0x1b'),'port':0x18eb});var socket=require(_0x1e2b('0x1c'))(new Redis(config['redis']));require(_0x1e2b('0x1d'))[_0x1e2b('0x1e')](socket);var jayson=require(_0x1e2b('0x1f'));var client=jayson['client'][_0x1e2b('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x202173,_0x12a4d1,_0x357d24,_0x598293){return new BPromise(function(_0x4e2a19,_0x33af5c){var _0x457886=_0x598293||client;return _0x457886['request'](_0x202173,_0x357d24)[_0x1e2b('0x21')](function(_0x5ee39b){logger[_0x1e2b('0x22')](_0x1e2b('0x23'),_0x12a4d1,_0x1e2b('0x24'));logger[_0x1e2b('0x25')](_0x1e2b('0x26'),_0x12a4d1,'request\x20sent',JSON[_0x1e2b('0x27')](_0x5ee39b));if(_0x5ee39b[_0x1e2b('0x28')]){if(_0x5ee39b[_0x1e2b('0x28')]['code']===0x1f4){logger[_0x1e2b('0x28')](_0x1e2b('0x23'),_0x12a4d1,_0x5ee39b['error'][_0x1e2b('0x29')]);return _0x33af5c(_0x5ee39b[_0x1e2b('0x28')][_0x1e2b('0x29')]);}logger[_0x1e2b('0x28')](_0x1e2b('0x23'),_0x12a4d1,_0x5ee39b['error'][_0x1e2b('0x29')]);return _0x4e2a19(_0x5ee39b[_0x1e2b('0x28')]['message']);}else{logger[_0x1e2b('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x12a4d1,_0x1e2b('0x24'));_0x4e2a19(_0x5ee39b[_0x1e2b('0x2a')][_0x1e2b('0x29')]);}})[_0x1e2b('0x2b')](function(_0x4e5672){logger[_0x1e2b('0x28')](_0x1e2b('0x23'),_0x12a4d1,_0x4e5672);_0x33af5c(_0x4e5672);});});}function respondWithStatusCode(_0x41bf5e,_0x2f782f){_0x2f782f=_0x2f782f||0xcc;return function(_0x4bd5a6){if(_0x4bd5a6){return _0x41bf5e[_0x1e2b('0x2c')](_0x2f782f);}return _0x41bf5e[_0x1e2b('0x2d')](_0x2f782f)[_0x1e2b('0x2e')]();};}function respondWithResult(_0x2ad865,_0x132d6e){_0x132d6e=_0x132d6e||0xc8;return function(_0x546f27){if(_0x546f27){return _0x2ad865[_0x1e2b('0x2d')](_0x132d6e)[_0x1e2b('0x2f')](_0x546f27);}};}function respondWithFilteredResult(_0x5f068a,_0xbef9d4){return function(_0x11513a){if(_0x11513a){var _0x4e942e=_0x11513a[_0x1e2b('0x30')],_0x5b2639=_0xbef9d4[_0x1e2b('0x31')],_0xc90ee4=_0xbef9d4[_0x1e2b('0x31')]+_0xbef9d4[_0x1e2b('0x32')],_0x475025;if(_0xc90ee4>=_0x4e942e){_0xc90ee4=_0x4e942e;_0x475025=0xc8;}else{_0x475025=0xce;}_0x5f068a[_0x1e2b('0x2d')](_0x475025);return _0x5f068a[_0x1e2b('0x33')](_0x1e2b('0x34'),_0x5b2639+'-'+_0xc90ee4+'/'+_0x4e942e)['json'](_0x11513a);}return null;};}function patchUpdates(_0x54aee6){return function(_0x3dcadd){try{jsonpatch['apply'](_0x3dcadd,_0x54aee6,!![]);}catch(_0x350642){return BPromise[_0x1e2b('0x35')](_0x350642);}return _0x3dcadd[_0x1e2b('0x36')]();};}function saveUpdates(_0x500afa,_0x459a2b){return function(_0x3bb935){if(_0x3bb935){return _0x3bb935[_0x1e2b('0x37')](_0x500afa)[_0x1e2b('0x21')](function(_0xce04b){return _0xce04b;});}return null;};}function removeEntity(_0x5b562f,_0x35aa0e){return function(_0xb40648){if(_0xb40648){return _0xb40648[_0x1e2b('0x38')]()[_0x1e2b('0x21')](function(){var _0x4b84aa=_0xb40648[_0x1e2b('0x39')]({'plain':!![]});var _0x3e7069=_0x1e2b('0x3a');return db['UserProfileResource'][_0x1e2b('0x38')]({'where':{'type':_0x3e7069,'resourceId':_0x4b84aa['id']}})[_0x1e2b('0x21')](function(){return _0xb40648;});})['then'](function(){_0x5b562f[_0x1e2b('0x2d')](0xcc)[_0x1e2b('0x2e')]();});}};}function handleEntityNotFound(_0x5c62b2,_0x2c5fca){return function(_0x4d4778){if(!_0x4d4778){_0x5c62b2[_0x1e2b('0x2c')](0x194);}return _0x4d4778;};}function handleError(_0x4c76de,_0x19e203){_0x19e203=_0x19e203||0x1f4;return function(_0xcd2abe){logger[_0x1e2b('0x28')](_0xcd2abe[_0x1e2b('0x3b')]);if(_0xcd2abe[_0x1e2b('0x3c')]){delete _0xcd2abe[_0x1e2b('0x3c')];}_0x4c76de[_0x1e2b('0x2d')](_0x19e203)['send'](_0xcd2abe);};}exports['index']=function(_0x40b0b1,_0xd28ccb){var _0x210675={'include':[{'model':db[_0x1e2b('0x3d')],'as':_0x1e2b('0x3e')}]},_0xf85662={},_0x391edb={'count':0x0,'rows':[]};var _0x14f0d6=_['map'](db[_0x1e2b('0x3f')][_0x1e2b('0x40')],function(_0x3aa203){return{'name':_0x3aa203['fieldName'],'type':_0x3aa203[_0x1e2b('0x41')][_0x1e2b('0x42')]};});_0xf85662[_0x1e2b('0x43')]=_[_0x1e2b('0x44')](_0x14f0d6,_0x1e2b('0x3c'));_0xf85662[_0x1e2b('0x45')]=_[_0x1e2b('0x46')](_0x40b0b1['query']);_0xf85662[_0x1e2b('0x47')]=_[_0x1e2b('0x48')](_0xf85662[_0x1e2b('0x43')],_0xf85662[_0x1e2b('0x45')]);_0x210675['attributes']=_[_0x1e2b('0x48')](_0xf85662[_0x1e2b('0x43')],qs[_0x1e2b('0x49')](_0x40b0b1['query'][_0x1e2b('0x49')]));_0x210675[_0x1e2b('0x4a')]=_0x210675[_0x1e2b('0x4a')][_0x1e2b('0x4b')]?_0x210675[_0x1e2b('0x4a')]:_0xf85662[_0x1e2b('0x43')];if(!_0x40b0b1[_0x1e2b('0x45')][_0x1e2b('0x4c')](_0x1e2b('0x4d'))){_0x210675[_0x1e2b('0x32')]=qs[_0x1e2b('0x32')](_0x40b0b1['query'][_0x1e2b('0x32')]);_0x210675[_0x1e2b('0x31')]=qs[_0x1e2b('0x31')](_0x40b0b1[_0x1e2b('0x45')]['offset']);}_0x210675['order']=qs[_0x1e2b('0x4e')](_0x40b0b1[_0x1e2b('0x45')]['sort']);_0x210675[_0x1e2b('0x4f')]=qs['filters'](_['pick'](_0x40b0b1[_0x1e2b('0x45')],_0xf85662[_0x1e2b('0x47')]),_0x14f0d6);if(_0x40b0b1[_0x1e2b('0x45')][_0x1e2b('0x50')]){_0x210675['where']=_[_0x1e2b('0x51')](_0x210675['where'],{'$or':_[_0x1e2b('0x44')](_0x14f0d6,function(_0x5eebe6){if(_0x5eebe6['type']!=='VIRTUAL'){var _0x5177df={};_0x5177df[_0x5eebe6[_0x1e2b('0x3c')]]={'$like':'%'+_0x40b0b1[_0x1e2b('0x45')][_0x1e2b('0x50')]+'%'};return _0x5177df;}})});}_0x210675=_[_0x1e2b('0x51')]({},_0x210675,_0x40b0b1[_0x1e2b('0x52')]);var _0x3cf25d={'where':_0x210675[_0x1e2b('0x4f')]};return db['WhatsappAccount'][_0x1e2b('0x30')](_0x3cf25d)[_0x1e2b('0x21')](function(_0xaf90b8){_0x391edb[_0x1e2b('0x30')]=_0xaf90b8;if(_0x40b0b1['query'][_0x1e2b('0x53')]){_0x210675['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x1e2b('0x54')](_0x210675);})[_0x1e2b('0x21')](function(_0xe408d9){_0x391edb[_0x1e2b('0x55')]=_0xe408d9;return _0x391edb;})[_0x1e2b('0x21')](respondWithFilteredResult(_0xd28ccb,_0x210675))[_0x1e2b('0x2b')](handleError(_0xd28ccb,null));};exports[_0x1e2b('0x56')]=function(_0x54255e,_0x49c290){var _0x2e6057={'raw':![],'where':{'id':_0x54255e[_0x1e2b('0x57')]['id']},'include':[{'model':db[_0x1e2b('0x3d')],'as':_0x1e2b('0x3e')}]},_0x237467={};_0x237467[_0x1e2b('0x43')]=_[_0x1e2b('0x46')](db[_0x1e2b('0x3f')][_0x1e2b('0x40')]);_0x237467['query']=_[_0x1e2b('0x46')](_0x54255e[_0x1e2b('0x45')]);_0x237467[_0x1e2b('0x47')]=_[_0x1e2b('0x48')](_0x237467['model'],_0x237467['query']);_0x2e6057[_0x1e2b('0x4a')]=_['intersection'](_0x237467[_0x1e2b('0x43')],qs[_0x1e2b('0x49')](_0x54255e[_0x1e2b('0x45')][_0x1e2b('0x49')]));_0x2e6057[_0x1e2b('0x4a')]=_0x2e6057['attributes'][_0x1e2b('0x4b')]?_0x2e6057[_0x1e2b('0x4a')]:_0x237467[_0x1e2b('0x43')];if(_0x54255e[_0x1e2b('0x45')][_0x1e2b('0x53')]){_0x2e6057[_0x1e2b('0x58')]=[{'all':!![]}];}_0x2e6057=_[_0x1e2b('0x51')]({},_0x2e6057,_0x54255e[_0x1e2b('0x52')]);return db[_0x1e2b('0x3f')][_0x1e2b('0x59')](_0x2e6057)[_0x1e2b('0x21')](handleEntityNotFound(_0x49c290,null))[_0x1e2b('0x21')](respondWithResult(_0x49c290,null))[_0x1e2b('0x2b')](handleError(_0x49c290,null));};exports['create']=function(_0x53eb47,_0x47572f){return db[_0x1e2b('0x3f')][_0x1e2b('0x5a')](_0x53eb47[_0x1e2b('0x5b')],{})['then'](function(_0x3dd1a6){var _0x2c5dfa=_0x53eb47[_0x1e2b('0x5c')][_0x1e2b('0x39')]({'plain':!![]});if(!_0x2c5dfa)throw new Error(_0x1e2b('0x5d'));if(_0x2c5dfa[_0x1e2b('0x5e')]===_0x1e2b('0x5c')){var _0x45832b=_0x3dd1a6['get']({'plain':!![]});var _0x555ed9='WhatsappAccounts';return db[_0x1e2b('0x5f')][_0x1e2b('0x59')]({'where':{'name':_0x555ed9,'userProfileId':_0x2c5dfa['userProfileId']},'raw':!![]})['then'](function(_0x9116ca){if(_0x9116ca&&_0x9116ca['autoAssociation']===0x0){return db[_0x1e2b('0x60')][_0x1e2b('0x5a')]({'name':_0x45832b[_0x1e2b('0x3c')],'resourceId':_0x45832b['id'],'type':_0x9116ca[_0x1e2b('0x3c')],'sectionId':_0x9116ca['id']},{})[_0x1e2b('0x21')](function(){return _0x3dd1a6;});}else{return _0x3dd1a6;}})[_0x1e2b('0x2b')](function(_0x52693f){logger[_0x1e2b('0x28')](_0x1e2b('0x61'),_0x52693f);throw _0x52693f;});}return _0x3dd1a6;})['then'](respondWithResult(_0x47572f,0xc9))['catch'](handleError(_0x47572f,null));};exports[_0x1e2b('0x37')]=function(_0x49ea95,_0x183ebb){if(_0x49ea95[_0x1e2b('0x5b')]['id']){delete _0x49ea95['body']['id'];}return db[_0x1e2b('0x3f')]['find']({'where':{'id':_0x49ea95[_0x1e2b('0x57')]['id']},'include':[{'model':db[_0x1e2b('0x3d')],'as':_0x1e2b('0x3e')}]})[_0x1e2b('0x21')](handleEntityNotFound(_0x183ebb,null))['then'](saveUpdates(_0x49ea95[_0x1e2b('0x5b')],null))[_0x1e2b('0x21')](respondWithResult(_0x183ebb,null))[_0x1e2b('0x2b')](handleError(_0x183ebb,null));};exports[_0x1e2b('0x38')]=function(_0x115c9d,_0x469a33){return db['WhatsappAccount'][_0x1e2b('0x59')]({'where':{'id':_0x115c9d['params']['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x469a33,null))[_0x1e2b('0x21')](removeEntity(_0x469a33,null))[_0x1e2b('0x2b')](handleError(_0x469a33,null));};exports[_0x1e2b('0x62')]=function(_0x297d9e,_0x4c4ad0){return db['WhatsappAccount'][_0x1e2b('0x62')]()[_0x1e2b('0x21')](respondWithResult(_0x4c4ad0,null))['catch'](handleError(_0x4c4ad0,null));};exports[_0x1e2b('0x63')]=function(_0x47c885,_0x37035d,_0x50f3da){if(_0x47c885[_0x1e2b('0x5b')]['id']){delete _0x47c885[_0x1e2b('0x5b')]['id'];}return db[_0x1e2b('0x3f')]['find']({'where':{'id':_0x47c885['params']['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x37035d,null))[_0x1e2b('0x21')](function(_0x194a27){if(_0x194a27){_0x47c885['body'][_0x1e2b('0x64')]=_0x194a27['id'];return db['Disposition']['create'](_0x47c885['body']);}})[_0x1e2b('0x21')](respondWithResult(_0x37035d,null))[_0x1e2b('0x2b')](handleError(_0x37035d,null));};exports[_0x1e2b('0x65')]=function(_0x4932de,_0x5edc1a,_0x4ed628){var _0x17fcb3={'raw':![],'where':{}};var _0x17e854={};var _0x43a5f1={'count':0x0,'rows':[]};return db[_0x1e2b('0x3f')][_0x1e2b('0x66')]({'where':{'id':_0x4932de[_0x1e2b('0x57')]['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x5edc1a,null))[_0x1e2b('0x21')](function(_0x51b87a){if(_0x51b87a){_0x17e854['model']=_[_0x1e2b('0x46')](db['Disposition']['rawAttributes']);_0x17e854[_0x1e2b('0x45')]=_['keys'](_0x4932de[_0x1e2b('0x45')]);_0x17e854[_0x1e2b('0x47')]=_[_0x1e2b('0x48')](_0x17e854['model'],_0x17e854[_0x1e2b('0x45')]);_0x17fcb3[_0x1e2b('0x4a')]=_['intersection'](_0x17e854[_0x1e2b('0x43')],qs[_0x1e2b('0x49')](_0x4932de[_0x1e2b('0x45')]['fields']));_0x17fcb3[_0x1e2b('0x4a')]=_0x17fcb3[_0x1e2b('0x4a')][_0x1e2b('0x4b')]?_0x17fcb3[_0x1e2b('0x4a')]:_0x17e854[_0x1e2b('0x43')];if(!_0x4932de[_0x1e2b('0x45')][_0x1e2b('0x4c')](_0x1e2b('0x4d'))){_0x17fcb3[_0x1e2b('0x32')]=qs[_0x1e2b('0x32')](_0x4932de[_0x1e2b('0x45')]['limit']);_0x17fcb3['offset']=qs['offset'](_0x4932de[_0x1e2b('0x45')][_0x1e2b('0x31')]);}_0x17fcb3[_0x1e2b('0x67')]=qs[_0x1e2b('0x4e')](_0x4932de[_0x1e2b('0x45')][_0x1e2b('0x4e')]);_0x17fcb3[_0x1e2b('0x4f')]=qs[_0x1e2b('0x47')](_['pick'](_0x4932de['query'],_0x17e854['filters']));_0x17fcb3[_0x1e2b('0x4f')]['WhatsappAccountId']=_0x51b87a['id'];if(_0x4932de[_0x1e2b('0x45')][_0x1e2b('0x50')]){_0x17fcb3[_0x1e2b('0x4f')]=_['merge'](_0x17fcb3[_0x1e2b('0x4f')],{'$or':_[_0x1e2b('0x44')](_0x17fcb3[_0x1e2b('0x4a')],function(_0x4d6796){var _0x5b54a1={};_0x5b54a1[_0x4d6796]={'$like':'%'+_0x4932de[_0x1e2b('0x45')][_0x1e2b('0x50')]+'%'};return _0x5b54a1;})});}_0x17fcb3=_[_0x1e2b('0x51')]({},_0x17fcb3,_0x4932de[_0x1e2b('0x52')]);return db[_0x1e2b('0x68')][_0x1e2b('0x30')]({'where':_0x17fcb3[_0x1e2b('0x4f')]})['then'](function(_0x12da62){_0x43a5f1['count']=_0x12da62;if(_0x4932de['query']['includeAll']){_0x17fcb3[_0x1e2b('0x58')]=[{'all':!![]}];}return db[_0x1e2b('0x68')][_0x1e2b('0x54')](_0x17fcb3);})[_0x1e2b('0x21')](function(_0x53b79c){_0x43a5f1['rows']=_0x53b79c;return _0x43a5f1;});}})[_0x1e2b('0x21')](respondWithFilteredResult(_0x5edc1a,_0x17fcb3))[_0x1e2b('0x2b')](handleError(_0x5edc1a,null));};exports[_0x1e2b('0x69')]=function(_0x582073,_0x3fb74d,_0x16350e){return db[_0x1e2b('0x3f')][_0x1e2b('0x59')]({'where':{'id':_0x582073[_0x1e2b('0x57')]['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x3fb74d,null))[_0x1e2b('0x21')](function(_0x18b95f){if(_0x18b95f){return _0x18b95f['removeDispositions'](_0x582073[_0x1e2b('0x45')][_0x1e2b('0x6a')]);}})['then'](respondWithStatusCode(_0x3fb74d,null))['catch'](handleError(_0x3fb74d,null));};exports[_0x1e2b('0x6b')]=function(_0x20b820,_0xbb127e,_0x69e4b6){if(_0x20b820['body']['id']){delete _0x20b820[_0x1e2b('0x5b')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x20b820[_0x1e2b('0x57')]['id']}})['then'](handleEntityNotFound(_0xbb127e,null))['then'](function(_0x40d76a){if(_0x40d76a){_0x20b820[_0x1e2b('0x5b')][_0x1e2b('0x64')]=_0x40d76a['id'];return db['CannedAnswer'][_0x1e2b('0x5a')](_0x20b820['body']);}})['then'](respondWithResult(_0xbb127e,null))[_0x1e2b('0x2b')](handleError(_0xbb127e,null));};exports['getAnswers']=function(_0x1f88ac,_0x11a184,_0x25dd0e){var _0x116b56={'raw':![],'where':{}};var _0x1cd319={};var _0x144971={'count':0x0,'rows':[]};return db[_0x1e2b('0x3f')]['findOne']({'where':{'id':_0x1f88ac['params']['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x11a184,null))[_0x1e2b('0x21')](function(_0x549711){if(_0x549711){_0x1cd319['model']=_[_0x1e2b('0x46')](db[_0x1e2b('0x6c')][_0x1e2b('0x40')]);_0x1cd319[_0x1e2b('0x45')]=_[_0x1e2b('0x46')](_0x1f88ac[_0x1e2b('0x45')]);_0x1cd319[_0x1e2b('0x47')]=_['intersection'](_0x1cd319[_0x1e2b('0x43')],_0x1cd319[_0x1e2b('0x45')]);_0x116b56[_0x1e2b('0x4a')]=_['intersection'](_0x1cd319['model'],qs[_0x1e2b('0x49')](_0x1f88ac[_0x1e2b('0x45')][_0x1e2b('0x49')]));_0x116b56[_0x1e2b('0x4a')]=_0x116b56[_0x1e2b('0x4a')][_0x1e2b('0x4b')]?_0x116b56[_0x1e2b('0x4a')]:_0x1cd319[_0x1e2b('0x43')];if(!_0x1f88ac[_0x1e2b('0x45')][_0x1e2b('0x4c')]('nolimit')){_0x116b56[_0x1e2b('0x32')]=qs[_0x1e2b('0x32')](_0x1f88ac['query']['limit']);_0x116b56['offset']=qs['offset'](_0x1f88ac['query'][_0x1e2b('0x31')]);}_0x116b56['order']=qs['sort'](_0x1f88ac[_0x1e2b('0x45')][_0x1e2b('0x4e')]);_0x116b56[_0x1e2b('0x4f')]=qs['filters'](_[_0x1e2b('0x6d')](_0x1f88ac['query'],_0x1cd319[_0x1e2b('0x47')]));_0x116b56['where']['WhatsappAccountId']=_0x549711['id'];if(_0x1f88ac[_0x1e2b('0x45')]['filter']){_0x116b56[_0x1e2b('0x4f')]=_[_0x1e2b('0x51')](_0x116b56[_0x1e2b('0x4f')],{'$or':_[_0x1e2b('0x44')](_0x116b56[_0x1e2b('0x4a')],function(_0x30945c){var _0x392413={};_0x392413[_0x30945c]={'$like':'%'+_0x1f88ac[_0x1e2b('0x45')][_0x1e2b('0x50')]+'%'};return _0x392413;})});}_0x116b56=_['merge']({},_0x116b56,_0x1f88ac[_0x1e2b('0x52')]);return db[_0x1e2b('0x6c')][_0x1e2b('0x30')]({'where':_0x116b56[_0x1e2b('0x4f')]})[_0x1e2b('0x21')](function(_0xc71cc5){_0x144971['count']=_0xc71cc5;if(_0x1f88ac[_0x1e2b('0x45')][_0x1e2b('0x53')]){_0x116b56['include']=[{'all':!![]}];}return db[_0x1e2b('0x6c')][_0x1e2b('0x54')](_0x116b56);})[_0x1e2b('0x21')](function(_0xd0a276){_0x144971[_0x1e2b('0x55')]=_0xd0a276;return _0x144971;});}})[_0x1e2b('0x21')](respondWithFilteredResult(_0x11a184,_0x116b56))[_0x1e2b('0x2b')](handleError(_0x11a184,null));};exports[_0x1e2b('0x6e')]=function(_0x3d35aa,_0x2f25d4,_0x4aa0ba){return db['WhatsappAccount'][_0x1e2b('0x59')]({'where':{'id':_0x3d35aa[_0x1e2b('0x57')]['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x2f25d4,null))[_0x1e2b('0x21')](function(_0x59cc9a){if(_0x59cc9a){return _0x59cc9a[_0x1e2b('0x6e')](_0x3d35aa['query']['ids']);}})[_0x1e2b('0x21')](respondWithStatusCode(_0x2f25d4,null))[_0x1e2b('0x2b')](handleError(_0x2f25d4,null));};exports['addAgents']=function(_0x537b69,_0x2faa80,_0x1a3e70){return db['WhatsappAccount'][_0x1e2b('0x59')]({'where':{'id':_0x537b69['params']['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x2faa80,null))[_0x1e2b('0x21')](function(_0x1c6b84){if(_0x1c6b84){return _0x1c6b84[_0x1e2b('0x6f')](_0x537b69[_0x1e2b('0x5b')][_0x1e2b('0x6a')],_['omit'](_0x537b69['body'],[_0x1e2b('0x6a'),'id'])||{})[_0x1e2b('0x70')](function(_0x30f34c){for(var _0x6469d0=0x0;_0x6469d0<_0x537b69[_0x1e2b('0x5b')][_0x1e2b('0x6a')][_0x1e2b('0x4b')];_0x6469d0+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x537b69[_0x1e2b('0x5b')][_0x1e2b('0x6a')][_0x6469d0],'WhatsappAccountId':_0x537b69[_0x1e2b('0x57')]['id']});}return _0x30f34c;});}})['then'](respondWithResult(_0x2faa80,null))[_0x1e2b('0x2b')](handleError(_0x2faa80,null));};exports[_0x1e2b('0x71')]=function(_0x3ccfa3,_0x273226,_0x36fa4b){return db[_0x1e2b('0x3f')][_0x1e2b('0x59')]({'where':{'id':_0x3ccfa3[_0x1e2b('0x57')]['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x273226,null))[_0x1e2b('0x21')](function(_0x1eb6dd){if(_0x1eb6dd){return _0x1eb6dd[_0x1e2b('0x71')](_0x3ccfa3[_0x1e2b('0x45')][_0x1e2b('0x6a')])[_0x1e2b('0x21')](function(){if(_[_0x1e2b('0x72')](_0x3ccfa3['query'][_0x1e2b('0x6a')])){for(var _0x5aafb0=0x0;_0x5aafb0<_0x3ccfa3[_0x1e2b('0x45')]['ids'][_0x1e2b('0x4b')];_0x5aafb0+=0x1){socket['emit'](_0x1e2b('0x73'),{'UserId':Number(_0x3ccfa3[_0x1e2b('0x45')][_0x1e2b('0x6a')][_0x5aafb0]),'WhatsappAccountId':Number(_0x3ccfa3[_0x1e2b('0x57')]['id'])});}}else{socket['emit'](_0x1e2b('0x73'),{'UserId':Number(_0x3ccfa3[_0x1e2b('0x45')][_0x1e2b('0x6a')]),'WhatsappAccountId':Number(_0x3ccfa3[_0x1e2b('0x57')]['id'])});}});}})[_0x1e2b('0x21')](respondWithStatusCode(_0x273226,null))['catch'](handleError(_0x273226,null));};exports[_0x1e2b('0x74')]=function(_0x59ab75,_0x9885c1,_0x2d6fa9){var _0x115a72={};var _0x41be74={};var _0x2f7272;var _0x47af45;return db['WhatsappAccount'][_0x1e2b('0x66')]({'where':{'id':_0x59ab75[_0x1e2b('0x57')]['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x9885c1,null))[_0x1e2b('0x21')](function(_0x107a94){if(_0x107a94){_0x2f7272=_0x107a94;_0x41be74[_0x1e2b('0x43')]=_[_0x1e2b('0x46')](db['User'][_0x1e2b('0x40')]);_0x41be74[_0x1e2b('0x45')]=_['keys'](_0x59ab75[_0x1e2b('0x45')]);_0x41be74[_0x1e2b('0x47')]=_[_0x1e2b('0x48')](_0x41be74[_0x1e2b('0x43')],_0x41be74['query']);_0x115a72[_0x1e2b('0x4a')]=_['intersection'](_0x41be74[_0x1e2b('0x43')],qs[_0x1e2b('0x49')](_0x59ab75[_0x1e2b('0x45')][_0x1e2b('0x49')]));_0x115a72[_0x1e2b('0x4a')]=_0x115a72[_0x1e2b('0x4a')][_0x1e2b('0x4b')]?_0x115a72['attributes']:_0x41be74[_0x1e2b('0x43')];_0x115a72[_0x1e2b('0x67')]=qs[_0x1e2b('0x4e')](_0x59ab75[_0x1e2b('0x45')]['sort']);_0x115a72[_0x1e2b('0x4f')]=qs[_0x1e2b('0x47')](_['pick'](_0x59ab75[_0x1e2b('0x45')],_0x41be74[_0x1e2b('0x47')]));if(_0x59ab75[_0x1e2b('0x45')][_0x1e2b('0x50')]){_0x115a72['where']=_[_0x1e2b('0x51')](_0x115a72[_0x1e2b('0x4f')],{'$or':_[_0x1e2b('0x44')](_0x115a72[_0x1e2b('0x4a')],function(_0x41a623){var _0x5090fb={};_0x5090fb[_0x41a623]={'$like':'%'+_0x59ab75['query']['filter']+'%'};return _0x5090fb;})});}_0x115a72=_[_0x1e2b('0x51')]({},_0x115a72,_0x59ab75[_0x1e2b('0x52')]);return _0x2f7272[_0x1e2b('0x74')](_0x115a72);}})[_0x1e2b('0x21')](function(_0x19ed3f){if(_0x19ed3f){_0x47af45=_0x19ed3f['length'];if(!_0x59ab75[_0x1e2b('0x45')][_0x1e2b('0x4c')](_0x1e2b('0x4d'))){_0x115a72[_0x1e2b('0x32')]=qs[_0x1e2b('0x32')](_0x59ab75[_0x1e2b('0x45')]['limit']);_0x115a72['offset']=qs[_0x1e2b('0x31')](_0x59ab75['query'][_0x1e2b('0x31')]);}return _0x2f7272['getAgents'](_0x115a72);}})['then'](function(_0x1ceb0f){if(_0x1ceb0f){return _0x1ceb0f?{'count':_0x47af45,'rows':_0x1ceb0f}:null;}})[_0x1e2b('0x21')](respondWithResult(_0x9885c1,null))[_0x1e2b('0x2b')](handleError(_0x9885c1,null));};exports['addApplications']=function(_0x579dff,_0x1af58e,_0x297b6a){return db[_0x1e2b('0x3f')]['findOne']({'where':{'id':_0x579dff['params']['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x1af58e,null))[_0x1e2b('0x21')](function(_0x2aab69){if(_0x2aab69){return db[_0x1e2b('0x75')][_0x1e2b('0x76')](function(_0x5f45c7){return db[_0x1e2b('0x77')]['destroy']({'where':{'WhatsappAccountId':_0x579dff[_0x1e2b('0x57')]['id']},'transaction':_0x5f45c7})[_0x1e2b('0x21')](function(_0x45356c){var _0x5eca0b=_[_0x1e2b('0x44')](_0x579dff[_0x1e2b('0x5b')],function(_0x264e2f){_0x264e2f[_0x1e2b('0x64')]=_0x579dff[_0x1e2b('0x57')]['id'];return _0x264e2f;});return db[_0x1e2b('0x77')][_0x1e2b('0x78')](_0x5eca0b,{'transaction':_0x5f45c7});});})['then'](function(){return db[_0x1e2b('0x77')][_0x1e2b('0x79')]({'where':{'WhatsappAccountId':_0x579dff[_0x1e2b('0x57')]['id']},'order':'priority'});});}})[_0x1e2b('0x21')](respondWithResult(_0x1af58e,null))['catch'](handleError(_0x1af58e,null));};exports[_0x1e2b('0x7a')]=function(_0x5b4caa,_0x3b8b28,_0x593b7b){var _0x4bd5aa={};var _0x1a4a20={};var _0x3c94a6;var _0x5230da;return db[_0x1e2b('0x3f')][_0x1e2b('0x66')]({'where':{'id':_0x5b4caa[_0x1e2b('0x57')]['id']}})[_0x1e2b('0x21')](handleEntityNotFound(_0x3b8b28,null))[_0x1e2b('0x21')](function(_0x2d15f8){if(_0x2d15f8){_0x3c94a6=_0x2d15f8;_0x1a4a20[_0x1e2b('0x43')]=_[_0x1e2b('0x46')](db[_0x1e2b('0x77')][_0x1e2b('0x40')]);_0x1a4a20[_0x1e2b('0x45')]=_[_0x1e2b('0x46')](_0x5b4caa['query']);_0x1a4a20[_0x1e2b('0x47')]=_['intersection'](_0x1a4a20[_0x1e2b('0x43')],_0x1a4a20[_0x1e2b('0x45')]);_0x4bd5aa[_0x1e2b('0x4a')]=_['intersection'](_0x1a4a20['model'],qs[_0x1e2b('0x49')](_0x5b4caa[_0x1e2b('0x45')][_0x1e2b('0x49')]));_0x4bd5aa['attributes']=_0x4bd5aa[_0x1e2b('0x4a')][_0x1e2b('0x4b')]?_0x4bd5aa[_0x1e2b('0x4a')]:_0x1a4a20[_0x1e2b('0x43')];_0x4bd5aa[_0x1e2b('0x67')]=qs[_0x1e2b('0x4e')](_0x5b4caa[_0x1e2b('0x45')]['sort']);_0x4bd5aa[_0x1e2b('0x4f')]=qs[_0x1e2b('0x47')](_[_0x1e2b('0x6d')](_0x5b4caa[_0x1e2b('0x45')],_0x1a4a20[_0x1e2b('0x47')]));if(_0x5b4caa[_0x1e2b('0x45')][_0x1e2b('0x50')]){_0x4bd5aa[_0x1e2b('0x4f')]=_[_0x1e2b('0x51')](_0x4bd5aa[_0x1e2b('0x4f')],{'$or':_['map'](_0x4bd5aa[_0x1e2b('0x4a')],function(_0x1c9962){var _0x2a6fa2={};_0x2a6fa2[_0x1c9962]={'$like':'%'+_0x5b4caa[_0x1e2b('0x45')]['filter']+'%'};return _0x2a6fa2;})});}_0x4bd5aa=_[_0x1e2b('0x51')]({},_0x4bd5aa,_0x5b4caa[_0x1e2b('0x52')]);return _0x3c94a6[_0x1e2b('0x7a')](_0x4bd5aa);}})['then'](function(_0x20802a){if(_0x20802a){_0x5230da=_0x20802a[_0x1e2b('0x4b')];if(!_0x5b4caa[_0x1e2b('0x45')]['hasOwnProperty'](_0x1e2b('0x4d'))){_0x4bd5aa[_0x1e2b('0x32')]=qs[_0x1e2b('0x32')](_0x5b4caa[_0x1e2b('0x45')][_0x1e2b('0x32')]);_0x4bd5aa[_0x1e2b('0x31')]=qs['offset'](_0x5b4caa[_0x1e2b('0x45')]['offset']);}return _0x3c94a6[_0x1e2b('0x7a')](_0x4bd5aa);}})[_0x1e2b('0x21')](function(_0x31739b){if(_0x31739b){return _0x31739b?{'count':_0x5230da,'rows':_0x31739b}:null;}})['then'](respondWithResult(_0x3b8b28,null))[_0x1e2b('0x2b')](handleError(_0x3b8b28,null));};exports[_0x1e2b('0x7b')]=function(_0x1dba4c,_0x652e39,_0x44b8bd){var _0x1c6cc7={'channel':'whatsapp'};var _0x14613b=[];var _0x22ff71=[];var _0xc6a314={};return db[_0x1e2b('0x3f')]['find']({'where':{'id':_0x1dba4c['params']['id']},'include':[{'model':db[_0x1e2b('0x77')],'as':_0x1e2b('0x7c')}]})[_0x1e2b('0x21')](handleEntityNotFound(_0x652e39,null))['then'](function(_0x139d7b){_0x1c6cc7[_0x1e2b('0x7d')]=_0x139d7b;_0x1c6cc7['applications']=_['orderBy'](_0x139d7b[_0x1e2b('0x7c')],[_0x1e2b('0x7e')],[_0x1e2b('0x7f')]);if(_0x1c6cc7[_0x1e2b('0x7d')]['Applications']){delete _0x1c6cc7['account'][_0x1e2b('0x7c')];}return db[_0x1e2b('0x80')]['describe']();})[_0x1e2b('0x21')](function(_0x39d418){if(!_0x39d418){throw new db['Sequelize'][(_0x1e2b('0x81'))](_0x1e2b('0x82'));}_0x14613b=_[_0x1e2b('0x83')](_['keys'](_0x39d418),[_0x1e2b('0x84'),_0x1e2b('0x85')]);_0x22ff71=_[_0x1e2b('0x83')](_[_0x1e2b('0x46')](_0x39d418),[_0x1e2b('0x84'),'updatedAt',_0x1e2b('0x86'),_0x1e2b('0x87')]);_0x1c6cc7[_0x1e2b('0x5b')]={'mapKey':_0x1e2b('0x88')};if(_0x1c6cc7[_0x1e2b('0x7d')]['type']&&_0x1c6cc7[_0x1e2b('0x7d')][_0x1e2b('0x41')]===_0x1e2b('0x89')){_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x8a')]=_0x1dba4c[_0x1e2b('0x5b')][_0x1e2b('0x8b')][_0x1e2b('0x8c')]('whatsapp:','');_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x5b')]=_0x1dba4c[_0x1e2b('0x5b')][_0x1e2b('0x8d')];_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x8e')]=_0x1dba4c[_0x1e2b('0x5b')][_0x1e2b('0x8f')];}if(_0x1c6cc7[_0x1e2b('0x5b')]['id']){delete _0x1c6cc7[_0x1e2b('0x5b')]['id'];}if(_[_0x1e2b('0x90')](_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x8a')])){throw new db[(_0x1e2b('0x91'))]['ValidationError'](_0x1e2b('0x92'));}if(_[_0x1e2b('0x90')](_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x5b')])||_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x5b')]===''){throw new db[(_0x1e2b('0x91'))]['ValidationError'](_0x1e2b('0x93'));}if(_[_0x1e2b('0x90')](_0x1c6cc7[_0x1e2b('0x5b')]['mapKey'])){throw new db[(_0x1e2b('0x91'))][(_0x1e2b('0x81'))](_0x1e2b('0x94')+_0x22ff71);}if(!_[_0x1e2b('0x95')](_0x22ff71,_0x1c6cc7['body'][_0x1e2b('0x96')])){throw new db[(_0x1e2b('0x91'))][(_0x1e2b('0x81'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22ff71);}_0xc6a314[_0x1c6cc7[_0x1e2b('0x5b')]['mapKey']]=_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x8a')];return db[_0x1e2b('0x97')][_0x1e2b('0x59')]({'where':{'id':_0x1c6cc7[_0x1e2b('0x7d')]['ListId']},'include':[{'model':db[_0x1e2b('0x80')],'as':'Contacts','where':_0xc6a314,'limit':0x1,'order':[[_0x1e2b('0x85'),'DESC']]}]});})[_0x1e2b('0x21')](handleEntityNotFound(_0x652e39,null))[_0x1e2b('0x21')](function(_0x4174b8){if(_0x4174b8){_0x1c6cc7[_0x1e2b('0x98')]=_[_0x1e2b('0x99')](_0x4174b8,[_0x1e2b('0x9a')]);if(_0x4174b8[_0x1e2b('0x9a')]['length']){return _0x4174b8[_0x1e2b('0x9a')][0x0];}var _0x4631f2=_['defaults'](_0x1c6cc7[_0x1e2b('0x5b')],{'firstName':_0x1c6cc7['body']['from'],'ListId':_0x4174b8['id']});_0x4631f2[_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x96')]]=_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x8a')];return db['CmContact'][_0x1e2b('0x5a')](_0x4631f2,{'fields':_0x14613b,'raw':!![]});}})['then'](handleEntityNotFound(_0x652e39,null))[_0x1e2b('0x21')](function(_0x530c08){if(_0x530c08){_0x1c6cc7[_0x1e2b('0x9b')]=_0x530c08;var _0x24d562={'ContactId':_0x530c08['id'],'phone':_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x8a')],'WhatsappAccountId':_0x1dba4c['params']['id']};var _0x55f835={'ContactId':_0x530c08['id'],'WhatsappAccountId':_0x1dba4c[_0x1e2b('0x57')]['id'],'closed':![]};return db[_0x1e2b('0x9c')][_0x1e2b('0x59')]({'where':_0x55f835})[_0x1e2b('0x21')](function(_0x137b0a){if(_0x137b0a){return[_0x137b0a,![]];}return db[_0x1e2b('0x9c')]['create'](_0x24d562)[_0x1e2b('0x21')](function(_0x1eaca0){return[_0x1eaca0,!![]];});});}})['spread'](function(_0xeeca2d,_0x113470){_0x1c6cc7[_0x1e2b('0x9d')]=_0xeeca2d[_0x1e2b('0x39')]({'plain':!![]});_0x1c6cc7['interaction'][_0x1e2b('0x9e')]=![];if(_0x113470){if(_0x1c6cc7[_0x1e2b('0x7d')][_0x1e2b('0x9f')]){_0x1c6cc7[_0x1e2b('0xa0')][_0x1e2b('0xa1')]({'id':0x0,'priority':_0x1c6cc7['applications'][_0x1e2b('0x4b')]+0x1,'app':_0x1e2b('0xa2'),'appdata':_0x1e2b('0xa3'),'interval':'*,*,*,*'});}_0x1c6cc7[_0x1e2b('0x9d')][_0x1e2b('0x9e')]=!![];}return db[_0x1e2b('0xa4')]['create']({'phone':_0x1c6cc7[_0x1e2b('0x5b')]['from'],'messageId':_0x1c6cc7[_0x1e2b('0x5b')][_0x1e2b('0x8e')],'body':_0x1c6cc7[_0x1e2b('0x5b')]['body'],'WhatsappAccountId':_0x1dba4c['params']['id'],'WhatsappInteractionId':_0xeeca2d['id'],'direction':'in','ContactId':_0xeeca2d[_0x1e2b('0xa5')],'AttachmentId':_0x1c6cc7[_0x1e2b('0x5b')]['AttachmentId']});})['then'](function(_0x413a30){_0x1c6cc7[_0x1e2b('0x29')]=_0x413a30;if(_0x1c6cc7[_0x1e2b('0x9d')][_0x1e2b('0xa6')]){return db['User'][_0x1e2b('0x59')]({'attributes':['id',_0x1e2b('0x3c')],'where':{'id':_0x1c6cc7['interaction']['UserId']}})[_0x1e2b('0x21')](function(_0x325efe){if(_0x325efe){_0x1c6cc7[_0x1e2b('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1e2b('0xa7'),'appdata':_0x325efe[_0x1e2b('0x3c')]+','+(_0x1c6cc7[_0x1e2b('0x7d')][_0x1e2b('0xa8')]||0xa),'interval':_0x1e2b('0xa9')});}return respondWithRpcPromise(_0x1e2b('0xaa'),_0x1e2b('0xab'),_0x1c6cc7);});}return respondWithRpcPromise(_0x1e2b('0xaa'),_0x1e2b('0xab'),_0x1c6cc7);})['then'](function(_0xb3d486){if(_0xb3d486){var _0x2d4d78=0xc8;var _0x2a7383=_0x1e2b('0xac');logger[_0x1e2b('0x22')](_0x1e2b('0x26'),_0x2a7383,_0x2d4d78,_0x1e2b('0xad'));logger[_0x1e2b('0x25')](_0x1e2b('0xae'),_0x2a7383,_0x2d4d78,_0x1e2b('0xad'),JSON['stringify'](_0xb3d486));if(_0x1c6cc7[_0x1e2b('0x7d')][_0x1e2b('0x41')]===_0x1e2b('0x89')){return _0x652e39[_0x1e2b('0x2d')](_0x2d4d78)[_0x1e2b('0x33')]('Content-Type','text/xml')[_0x1e2b('0xaf')]('\x0a');}else{return _0x652e39[_0x1e2b('0x2d')](_0x2d4d78)['json'](_0xb3d486);}}})['catch'](handleError(_0x652e39,null));};exports[_0x1e2b('0xaf')]=function(_0x4c32d1,_0x27e0de,_0x4c347c){var _0x3f2e96,_0x4082cd,_0x498658;if(_['isNil'](_0x4c32d1[_0x1e2b('0x5b')][_0x1e2b('0x5b')])||_0x4c32d1[_0x1e2b('0x5b')][_0x1e2b('0x5b')]===''){throw new db[(_0x1e2b('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1e2b('0x90')](_0x4c32d1[_0x1e2b('0x5b')]['to'])){throw new db[(_0x1e2b('0x91'))][(_0x1e2b('0x81'))](_0x1e2b('0xb0'));}_0x3f2e96=_0x4c32d1['body']['to'];return db[_0x1e2b('0x3f')]['find']({'where':{'id':_0x4c32d1[_0x1e2b('0x57')]['id']},'include':[{'model':db[_0x1e2b('0x97')],'as':_0x1e2b('0xb1'),'include':[{'model':db['CmContact'],'as':_0x1e2b('0x9a'),'where':{'mobile':_0x3f2e96},'limit':0x1,'order':[[_0x1e2b('0x85'),_0x1e2b('0xb2')]]}]}]})[_0x1e2b('0x21')](handleEntityNotFound(_0x27e0de,null))[_0x1e2b('0x21')](function(_0x43fd31){if(_0x43fd31&&_0x43fd31[_0x1e2b('0xb1')]){_0x4082cd=_0x43fd31[_0x1e2b('0x39')]({'plain':!![]});if(_0x4082cd[_0x1e2b('0xb1')]&&_0x4082cd[_0x1e2b('0xb1')][_0x1e2b('0x9a')][_0x1e2b('0x4b')]){return _0x4082cd[_0x1e2b('0xb1')][_0x1e2b('0x9a')][0x0];}return db[_0x1e2b('0x80')]['create'](_[_0x1e2b('0x1a')](_0x4c32d1[_0x1e2b('0x5b')],{'firstName':_0x3f2e96,'mobile':_0x3f2e96,'phone':_0x3f2e96,'ListId':_0x4082cd[_0x1e2b('0x87')]}));}})['then'](handleEntityNotFound(_0x27e0de,null))[_0x1e2b('0x21')](function(_0x3243a6){if(_0x3243a6){_0x498658=_0x3243a6;return db[_0x1e2b('0x9c')]['find']({'where':{'ContactId':_0x498658['id'],'closed':![],'WhatsappAccountId':_0x4082cd['id']}})[_0x1e2b('0x21')](function(_0x171e67){if(_0x171e67){return[_0x171e67,![]];}return db['WhatsappInteraction'][_0x1e2b('0x5a')]({'UserId':_0x4c32d1[_0x1e2b('0x5c')]['id'],'ContactId':_0x498658['id'],'WhatsappAccountId':_0x4082cd['id'],'phone':_0x3f2e96,'firstMsgDirection':_0x1e2b('0xb3'),'Messages':[_[_0x1e2b('0x51')](_0x4c32d1[_0x1e2b('0x5b')],{'read':![],'body':_0x4c32d1[_0x1e2b('0x5b')][_0x1e2b('0x5b')],'phone':_0x3f2e96,'WhatsappAccountId':_0x4082cd['id'],'UserId':_0x4c32d1[_0x1e2b('0x5c')]['id'],'ContactId':_0x498658['id']})]},{'include':[{'model':db[_0x1e2b('0xa4')],'as':_0x1e2b('0xb4')}]})['then'](function(_0x2cd8e0){return[_0x2cd8e0,!![]];});});}})[_0x1e2b('0x70')](function(_0x484724,_0x1eb668){if(_0x1eb668){return _0x484724;}return db[_0x1e2b('0xa4')][_0x1e2b('0x5a')](_[_0x1e2b('0x51')](_0x4c32d1[_0x1e2b('0x5b')],{'read':![],'body':_0x4c32d1[_0x1e2b('0x5b')]['body'],'phone':_0x3f2e96,'WhatsappAccountId':_0x4082cd['id'],'WhatsappInteractionId':_0x484724['id'],'UserId':_0x4c32d1[_0x1e2b('0x5c')]['id'],'ContactId':_0x498658['id']}))[_0x1e2b('0x21')](function(_0x3ead34){_0x484724[_0x1e2b('0xb5')][_0x1e2b('0xb4')]=[];_0x484724['dataValues'][_0x1e2b('0xb4')]['push'](_0x3ead34['dataValues']);return _0x484724;});})[_0x1e2b('0x21')](respondWithResult(_0x27e0de,null))[_0x1e2b('0x2b')](handleError(_0x27e0de,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b30bfe2..a296a18 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 _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x53b30b,_0x4240cd){var _0xec1d7c=function(_0x8359ae){while(--_0x8359ae){_0x53b30b['push'](_0x53b30b['shift']());}};_0xec1d7c(++_0x4240cd);}(_0x4888,0x198));var _0x8488=function(_0x211158,_0x5edf3c){_0x211158=_0x211158-0x0;var _0x197bef=_0x4888[_0x211158];return _0x197bef;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){WhatsappAccountEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);WhatsappAccountEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];WhatsappAccount[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x1261=['update','remove','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x35d294,_0x3a9b4){var _0xb9ae9a=function(_0x3c08ce){while(--_0x3c08ce){_0x35d294['push'](_0x35d294['shift']());}};_0xb9ae9a(++_0x3a9b4);}(_0x1261,0x144));var _0x1126=function(_0x1eb82d,_0x1e23cb){_0x1eb82d=_0x1eb82d-0x0;var _0x2c9502=_0x1261[_0x1eb82d];return _0x2c9502;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1126('0x2')](0x0);var events={'afterCreate':_0x1126('0x3'),'afterUpdate':_0x1126('0x4'),'afterDestroy':_0x1126('0x5')};function emitEvent(_0x3cc93f){return function(_0x4245ca,_0x21a480,_0x75a851){WhatsappAccountEvents['emit'](_0x3cc93f+':'+_0x4245ca['id'],_0x4245ca);WhatsappAccountEvents['emit'](_0x3cc93f,_0x4245ca);_0x75a851(null);};}for(var e in events){if(events[_0x1126('0x6')](e)){var event=events[e];WhatsappAccount[_0x1126('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f6cef47..612700c 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 _0x3d2b=['request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','moment','bluebird'];(function(_0x2a99e2,_0x1803e4){var _0x23fb5f=function(_0x568ec9){while(--_0x568ec9){_0x2a99e2['push'](_0x2a99e2['shift']());}};_0x23fb5f(++_0x1803e4);}(_0x3d2b,0x13c));var _0xb3d2=function(_0xe58e7c,_0x2de554){_0xe58e7c=_0xe58e7c-0x0;var _0x423cc2=_0x3d2b[_0xe58e7c];return _0x423cc2;};'use strict';var _=require(_0xb3d2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb3d2('0x1'));var BPromise=require(_0xb3d2('0x2'));var rp=require(_0xb3d2('0x3'));var fs=require('fs');var path=require(_0xb3d2('0x4'));var rimraf=require('rimraf');var config=require(_0xb3d2('0x5'));var attributes=require(_0xb3d2('0x6'));module[_0xb3d2('0x7')]=function(_0x58bd98,_0x1805fb){return _0x58bd98[_0xb3d2('0x8')](_0xb3d2('0x9'),attributes,{'tableName':_0xb3d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed69=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3e59bf,_0x83d069){var _0x576676=function(_0x31b7f5){while(--_0x31b7f5){_0x3e59bf['push'](_0x3e59bf['shift']());}};_0x576676(++_0x83d069);}(_0xed69,0xd6));var _0x9ed6=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0xed69[_0x404957];return _0x4e0365;};'use strict';var _=require(_0x9ed6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9ed6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9ed6('0x2'));var fs=require('fs');var path=require(_0x9ed6('0x3'));var rimraf=require(_0x9ed6('0x4'));var config=require(_0x9ed6('0x5'));var attributes=require(_0x9ed6('0x6'));module[_0x9ed6('0x7')]=function(_0x43893d,_0x1d98b6){return _0x43893d[_0x9ed6('0x8')](_0x9ed6('0x9'),attributes,{'tableName':_0x9ed6('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 f5d9eba..102260d 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 _0xe285=['http','redis','defaults','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','model','include','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe285,0xe5));var _0x5e28=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe285[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5e28('0x0'));var util=require(_0x5e28('0x1'));var moment=require(_0x5e28('0x2'));var BPromise=require(_0x5e28('0x3'));var rs=require(_0x5e28('0x4'));var fs=require('fs');var Redis=require(_0x5e28('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e28('0x6'));var config=require(_0x5e28('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5e28('0x8')][_0x5e28('0x9')]({'port':0x232a});config[_0x5e28('0xa')]=_[_0x5e28('0xb')](config[_0x5e28('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e28('0xa')]));require(_0x5e28('0xc'))['register'](socket);function respondWithRpcPromise(_0x12d02c,_0x9d40bf,_0x8cc84d){return new BPromise(function(_0x5e8aa9,_0x7bb983){return client['request'](_0x12d02c,_0x8cc84d)[_0x5e28('0xd')](function(_0x3657a5){logger[_0x5e28('0xe')](_0x5e28('0xf'),_0x9d40bf,_0x5e28('0x10'));logger['debug'](_0x5e28('0x11'),_0x9d40bf,_0x5e28('0x10'),JSON['stringify'](_0x3657a5));if(_0x3657a5[_0x5e28('0x12')]){if(_0x3657a5[_0x5e28('0x12')][_0x5e28('0x13')]===0x1f4){logger[_0x5e28('0x12')](_0x5e28('0xf'),_0x9d40bf,_0x3657a5[_0x5e28('0x12')][_0x5e28('0x14')]);return _0x7bb983(_0x3657a5['error'][_0x5e28('0x14')]);}logger[_0x5e28('0x12')](_0x5e28('0xf'),_0x9d40bf,_0x3657a5[_0x5e28('0x12')][_0x5e28('0x14')]);return _0x5e8aa9(_0x3657a5[_0x5e28('0x12')]['message']);}else{logger[_0x5e28('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x9d40bf,_0x5e28('0x10'));_0x5e8aa9(_0x3657a5['result']['message']);}})['catch'](function(_0x3a83fc){logger[_0x5e28('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x9d40bf,_0x3a83fc);_0x7bb983(_0x3a83fc);});});}exports[_0x5e28('0x15')]=function(_0x47dc98){var _0x3190e7=this;return new Promise(function(_0x3301ba,_0x515233){return db[_0x5e28('0x16')][_0x5e28('0x17')]({'raw':_0x47dc98['options']?_0x47dc98[_0x5e28('0x18')][_0x5e28('0x19')]===undefined?!![]:![]:!![],'where':_0x47dc98['options']?_0x47dc98[_0x5e28('0x18')][_0x5e28('0x1a')]||null:null,'attributes':_0x47dc98['options']?_0x47dc98[_0x5e28('0x18')][_0x5e28('0x1b')]||null:null,'include':_0x47dc98[_0x5e28('0x18')]?_0x47dc98[_0x5e28('0x18')]['include']?_[_0x5e28('0x1c')](_0x47dc98['options']['include'],function(_0x45ee0c){return{'model':db[_0x45ee0c[_0x5e28('0x1d')]],'as':_0x45ee0c['as'],'attributes':_0x45ee0c[_0x5e28('0x1b')],'include':_0x45ee0c[_0x5e28('0x1e')]?_[_0x5e28('0x1c')](_0x45ee0c[_0x5e28('0x1e')],function(_0x46e0f7){return{'model':db[_0x46e0f7[_0x5e28('0x1d')]],'as':_0x46e0f7['as'],'attributes':_0x46e0f7[_0x5e28('0x1b')],'include':_0x46e0f7[_0x5e28('0x1e')]?_[_0x5e28('0x1c')](_0x46e0f7['include'],function(_0xdfe827){return{'model':db[_0xdfe827[_0x5e28('0x1d')]],'as':_0xdfe827['as'],'attributes':_0xdfe827[_0x5e28('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5e28('0xd')](function(_0x4f9f82){logger[_0x5e28('0xe')](_0x5e28('0x15'),_0x47dc98);logger[_0x5e28('0x1f')](_0x5e28('0x15'),_0x47dc98,JSON[_0x5e28('0x20')](_0x4f9f82));_0x3301ba(_0x4f9f82);})[_0x5e28('0x21')](function(_0x56d127){logger[_0x5e28('0x12')](_0x5e28('0x15'),_0x56d127[_0x5e28('0x14')],_0x47dc98);_0x515233(_0x3190e7[_0x5e28('0x12')](0x1f4,_0x56d127[_0x5e28('0x14')]));});});}; \ No newline at end of file +var _0x34cf=['raw','where','attributes','include','model','map','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','options'];(function(_0x551f20,_0x539c90){var _0x31fb90=function(_0x5f1662){while(--_0x5f1662){_0x551f20['push'](_0x551f20['shift']());}};_0x31fb90(++_0x539c90);}(_0x34cf,0xd8));var _0xf34c=function(_0x12275d,_0x57a2c9){_0x12275d=_0x12275d-0x0;var _0x142fd=_0x34cf[_0x12275d];return _0x142fd;};'use strict';var _=require('lodash');var util=require(_0xf34c('0x0'));var moment=require(_0xf34c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf34c('0x2'));var fs=require('fs');var Redis=require(_0xf34c('0x3'));var db=require(_0xf34c('0x4'))['db'];var utils=require(_0xf34c('0x5'));var logger=require(_0xf34c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf34c('0x7')][_0xf34c('0x8')]({'port':0x232a});config[_0xf34c('0x9')]=_[_0xf34c('0xa')](config[_0xf34c('0x9')],{'host':_0xf34c('0xb'),'port':0x18eb});var socket=require(_0xf34c('0xc'))(new Redis(config[_0xf34c('0x9')]));require(_0xf34c('0xd'))[_0xf34c('0xe')](socket);function respondWithRpcPromise(_0x55c5d0,_0x2f3a5f,_0x44f724){return new BPromise(function(_0x3f75d8,_0x25005b){return client['request'](_0x55c5d0,_0x44f724)[_0xf34c('0xf')](function(_0x5d78cc){logger[_0xf34c('0x10')](_0xf34c('0x11'),_0x2f3a5f,'request\x20sent');logger[_0xf34c('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2f3a5f,'request\x20sent',JSON[_0xf34c('0x13')](_0x5d78cc));if(_0x5d78cc[_0xf34c('0x14')]){if(_0x5d78cc[_0xf34c('0x14')][_0xf34c('0x15')]===0x1f4){logger[_0xf34c('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x2f3a5f,_0x5d78cc[_0xf34c('0x14')]['message']);return _0x25005b(_0x5d78cc['error'][_0xf34c('0x16')]);}logger[_0xf34c('0x14')](_0xf34c('0x11'),_0x2f3a5f,_0x5d78cc['error']['message']);return _0x3f75d8(_0x5d78cc['error'][_0xf34c('0x16')]);}else{logger['info'](_0xf34c('0x11'),_0x2f3a5f,_0xf34c('0x17'));_0x3f75d8(_0x5d78cc[_0xf34c('0x18')][_0xf34c('0x16')]);}})[_0xf34c('0x19')](function(_0x214c38){logger[_0xf34c('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x2f3a5f,_0x214c38);_0x25005b(_0x214c38);});});}exports[_0xf34c('0x1a')]=function(_0x7bbaa3){var _0x1bc459=this;return new Promise(function(_0x4532f4,_0x1f2f80){return db[_0xf34c('0x1b')]['find']({'raw':_0x7bbaa3['options']?_0x7bbaa3[_0xf34c('0x1c')][_0xf34c('0x1d')]===undefined?!![]:![]:!![],'where':_0x7bbaa3[_0xf34c('0x1c')]?_0x7bbaa3['options'][_0xf34c('0x1e')]||null:null,'attributes':_0x7bbaa3['options']?_0x7bbaa3[_0xf34c('0x1c')][_0xf34c('0x1f')]||null:null,'include':_0x7bbaa3[_0xf34c('0x1c')]?_0x7bbaa3['options'][_0xf34c('0x20')]?_['map'](_0x7bbaa3[_0xf34c('0x1c')][_0xf34c('0x20')],function(_0x1902b8){return{'model':db[_0x1902b8[_0xf34c('0x21')]],'as':_0x1902b8['as'],'attributes':_0x1902b8[_0xf34c('0x1f')],'include':_0x1902b8[_0xf34c('0x20')]?_[_0xf34c('0x22')](_0x1902b8[_0xf34c('0x20')],function(_0x24adf9){return{'model':db[_0x24adf9[_0xf34c('0x21')]],'as':_0x24adf9['as'],'attributes':_0x24adf9[_0xf34c('0x1f')],'include':_0x24adf9[_0xf34c('0x20')]?_[_0xf34c('0x22')](_0x24adf9[_0xf34c('0x20')],function(_0x5d5acc){return{'model':db[_0x5d5acc[_0xf34c('0x21')]],'as':_0x5d5acc['as'],'attributes':_0x5d5acc[_0xf34c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf34c('0xf')](function(_0x3c2909){logger[_0xf34c('0x10')](_0xf34c('0x1a'),_0x7bbaa3);logger[_0xf34c('0x12')](_0xf34c('0x1a'),_0x7bbaa3,JSON['stringify'](_0x3c2909));_0x4532f4(_0x3c2909);})[_0xf34c('0x19')](function(_0x1af008){logger[_0xf34c('0x14')](_0xf34c('0x1a'),_0x1af008[_0xf34c('0x16')],_0x7bbaa3);_0x1f2f80(_0x1bc459['error'](0x1f4,_0x1af008[_0xf34c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0e5c74d..cc19fab 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 _0x932d=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x932d,0x1bb));var _0xd932=function(_0x275cc2,_0x3189e6){_0x275cc2=_0x275cc2-0x0;var _0x1e787d=_0x932d[_0x275cc2];return _0x1e787d;};'use strict';var WhatsappAccountEvents=require(_0xd932('0x0'));var events=[_0xd932('0x1'),_0xd932('0x2'),_0xd932('0x3')];function createListener(_0x4c0e46,_0x4398e7){return function(_0xe04174){_0x4398e7[_0xd932('0x4')](_0x4c0e46,_0xe04174);};}function removeListener(_0x87d6ad,_0x3756f1){return function(){WhatsappAccountEvents[_0xd932('0x5')](_0x87d6ad,_0x3756f1);};}exports[_0xd932('0x6')]=function(_0x7574e){for(var _0xe4dd63=0x0,_0x4e184b=events[_0xd932('0x7')];_0xe4dd63<_0x4e184b;_0xe4dd63++){var _0x57a4f5=events[_0xe4dd63];var _0x174867=createListener(_0xd932('0x8')+_0x57a4f5,_0x7574e);WhatsappAccountEvents['on'](_0x57a4f5,_0x174867);}}; \ No newline at end of file +var _0x67d8=['removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x1d18ed,_0xcdc45b){var _0x197425=function(_0x9a09b0){while(--_0x9a09b0){_0x1d18ed['push'](_0x1d18ed['shift']());}};_0x197425(++_0xcdc45b);}(_0x67d8,0x1a0));var _0x867d=function(_0x4826ff,_0x3f40d4){_0x4826ff=_0x4826ff-0x0;var _0x6bb022=_0x67d8[_0x4826ff];return _0x6bb022;};'use strict';var WhatsappAccountEvents=require(_0x867d('0x0'));var events=[_0x867d('0x1'),_0x867d('0x2'),'update'];function createListener(_0x1a22f6,_0x308d9e){return function(_0x212b0b){_0x308d9e[_0x867d('0x3')](_0x1a22f6,_0x212b0b);};}function removeListener(_0x5e6d8c,_0x120b61){return function(){WhatsappAccountEvents[_0x867d('0x4')](_0x5e6d8c,_0x120b61);};}exports[_0x867d('0x5')]=function(_0x217cc2){for(var _0x4f0e84=0x0,_0x52f5a8=events['length'];_0x4f0e84<_0x52f5a8;_0x4f0e84++){var _0x3028bd=events[_0x4f0e84];var _0x2e2894=createListener(_0x867d('0x6')+_0x3028bd,_0x217cc2);WhatsappAccountEvents['on'](_0x3028bd,_0x2e2894);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 201dbf7..4728071 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 _0xb200=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','/:id'];(function(_0x3f4585,_0x2e4839){var _0x46a32d=function(_0x4d007f){while(--_0x4d007f){_0x3f4585['push'](_0x3f4585['shift']());}};_0x46a32d(++_0x2e4839);}(_0xb200,0x1ce));var _0x0b20=function(_0x498834,_0x57c709){_0x498834=_0x498834-0x0;var _0x2fc7ef=_0xb200[_0x498834];return _0x2fc7ef;};'use strict';var multer=require(_0x0b20('0x0'));var util=require(_0x0b20('0x1'));var path=require(_0x0b20('0x2'));var timeout=require(_0x0b20('0x3'));var express=require(_0x0b20('0x4'));var router=express[_0x0b20('0x5')]();var auth=require(_0x0b20('0x6'));var interaction=require(_0x0b20('0x7'));var config=require('../../config/environment');var controller=require(_0x0b20('0x8'));router['get']('/',auth[_0x0b20('0x9')](),controller[_0x0b20('0xa')]);router[_0x0b20('0xb')](_0x0b20('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0b20('0xd')]('/',auth[_0x0b20('0x9')](),controller[_0x0b20('0xe')]);router[_0x0b20('0xf')](_0x0b20('0xc'),auth['isAuthenticated'](),controller[_0x0b20('0x10')]);router[_0x0b20('0x11')](_0x0b20('0xc'),auth[_0x0b20('0x9')](),controller[_0x0b20('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1132=['path','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util'];(function(_0x1df4ff,_0x45b1b5){var _0x5135fd=function(_0x4d0f6f){while(--_0x4d0f6f){_0x1df4ff['push'](_0x1df4ff['shift']());}};_0x5135fd(++_0x45b1b5);}(_0x1132,0x163));var _0x2113=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1132[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x2113('0x0'));var util=require(_0x2113('0x1'));var path=require(_0x2113('0x2'));var timeout=require(_0x2113('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2113('0x4'));var config=require(_0x2113('0x5'));var controller=require(_0x2113('0x6'));router[_0x2113('0x7')]('/',auth[_0x2113('0x8')](),controller[_0x2113('0x9')]);router['get'](_0x2113('0xa'),auth['isAuthenticated'](),controller[_0x2113('0xb')]);router[_0x2113('0xc')]('/',auth[_0x2113('0x8')](),controller[_0x2113('0xd')]);router['put'](_0x2113('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2113('0xe')](_0x2113('0xa'),auth[_0x2113('0x8')](),controller[_0x2113('0xf')]);module[_0x2113('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 833a1fa..6ddcee4 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 _0x0d2b=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x2e0ab3,_0x160d5b){var _0x5f0f46=function(_0x2743ba){while(--_0x2743ba){_0x2e0ab3['push'](_0x2e0ab3['shift']());}};_0x5f0f46(++_0x160d5b);}(_0x0d2b,0x159));var _0xb0d2=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x0d2b[_0x5c5c52];return _0x4229ff;};'use strict';var Sequelize=require(_0xb0d2('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb0d2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb0d2('0x2')],'allowNull':![],'defaultValue':_0xb0d2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb0d2('0x2')],'defaultValue':_0xb0d2('0x4')}}; \ No newline at end of file +var _0xdf0d=['INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x10b71c,_0x11f0ed){var _0x46aa13=function(_0x117a12){while(--_0x117a12){_0x10b71c['push'](_0x10b71c['shift']());}};_0x46aa13(++_0x11f0ed);}(_0xdf0d,0x88));var _0xddf0=function(_0x1b43ed,_0x4f4a52){_0x1b43ed=_0x1b43ed-0x0;var _0x271419=_0xdf0d[_0x1b43ed];return _0x271419;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xddf0('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xddf0('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xddf0('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xddf0('0x1')],'defaultValue':_0xddf0('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a7e00f0..49f7d7b 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 _0xd22d=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','merge','create','update','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type'];(function(_0x3f408c,_0x3a6723){var _0x141fd5=function(_0x5ba674){while(--_0x5ba674){_0x3f408c['push'](_0x3f408c['shift']());}};_0x141fd5(++_0x3a6723);}(_0xd22d,0xb2));var _0xdd22=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xd22d[_0x24fa1a];return _0xc5621f;};'use strict';var pdf=require(_0xdd22('0x0'));var emlformat=require(_0xdd22('0x1'));var rimraf=require(_0xdd22('0x2'));var zipdir=require(_0xdd22('0x3'));var jsonpatch=require(_0xdd22('0x4'));var rp=require(_0xdd22('0x5'));var moment=require(_0xdd22('0x6'));var BPromise=require(_0xdd22('0x7'));var Mustache=require(_0xdd22('0x8'));var util=require(_0xdd22('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xdd22('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd22('0xb'));var squel=require(_0xdd22('0xc'));var crypto=require(_0xdd22('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdd22('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd22('0xf'));var authService=require(_0xdd22('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd22('0x11'))(_0xdd22('0x12'));var utils=require('../../config/utils');var config=require(_0xdd22('0x13'));var licenseUtil=require(_0xdd22('0x14'));var db=require(_0xdd22('0x15'))['db'];function respondWithStatusCode(_0x1d9c53,_0x1db482){_0x1db482=_0x1db482||0xcc;return function(_0x54f8fd){if(_0x54f8fd){return _0x1d9c53['sendStatus'](_0x1db482);}return _0x1d9c53['status'](_0x1db482)[_0xdd22('0x16')]();};}function respondWithResult(_0x5db761,_0x57c235){_0x57c235=_0x57c235||0xc8;return function(_0x1bda75){if(_0x1bda75){return _0x5db761[_0xdd22('0x17')](_0x57c235)['json'](_0x1bda75);}};}function respondWithFilteredResult(_0x96540e,_0x220634){return function(_0x58610e){if(_0x58610e){var _0x1344d0=_0x58610e['count'],_0x460c67=_0x220634[_0xdd22('0x18')],_0x24f399=_0x220634[_0xdd22('0x18')]+_0x220634[_0xdd22('0x19')],_0x58cac1;if(_0x24f399>=_0x1344d0){_0x24f399=_0x1344d0;_0x58cac1=0xc8;}else{_0x58cac1=0xce;}_0x96540e[_0xdd22('0x17')](_0x58cac1);return _0x96540e[_0xdd22('0x1a')](_0xdd22('0x1b'),_0x460c67+'-'+_0x24f399+'/'+_0x1344d0)[_0xdd22('0x1c')](_0x58610e);}return null;};}function patchUpdates(_0x5658ee){return function(_0x577834){try{jsonpatch[_0xdd22('0x1d')](_0x577834,_0x5658ee,!![]);}catch(_0x82d810){return BPromise[_0xdd22('0x1e')](_0x82d810);}return _0x577834[_0xdd22('0x1f')]();};}function saveUpdates(_0x10278d,_0x35126d){return function(_0x5da791){if(_0x5da791){return _0x5da791['update'](_0x10278d)[_0xdd22('0x20')](function(_0x2f5d56){return _0x2f5d56;});}return null;};}function removeEntity(_0x50c03d,_0x263a16){return function(_0x4671a8){if(_0x4671a8){return _0x4671a8[_0xdd22('0x21')]()[_0xdd22('0x20')](function(){_0x50c03d[_0xdd22('0x17')](0xcc)[_0xdd22('0x16')]();});}};}function handleEntityNotFound(_0x37aa36,_0x18abde){return function(_0x5cf407){if(!_0x5cf407){_0x37aa36[_0xdd22('0x22')](0x194);}return _0x5cf407;};}function handleError(_0x10b9b5,_0xb90b1d){_0xb90b1d=_0xb90b1d||0x1f4;return function(_0x542e8c){logger['error'](_0x542e8c[_0xdd22('0x23')]);if(_0x542e8c[_0xdd22('0x24')]){delete _0x542e8c[_0xdd22('0x24')];}_0x10b9b5[_0xdd22('0x17')](_0xb90b1d)[_0xdd22('0x25')](_0x542e8c);};}exports[_0xdd22('0x26')]=function(_0x1f69e2,_0x50fe0d){var _0x1c966d={},_0x370652={},_0x4f14b0={'count':0x0,'rows':[]};var _0x28d572=_[_0xdd22('0x27')](db[_0xdd22('0x28')][_0xdd22('0x29')],function(_0x1b0f8b){return{'name':_0x1b0f8b[_0xdd22('0x2a')],'type':_0x1b0f8b[_0xdd22('0x2b')][_0xdd22('0x2c')]};});_0x370652[_0xdd22('0x2d')]=_[_0xdd22('0x27')](_0x28d572,_0xdd22('0x24'));_0x370652['query']=_[_0xdd22('0x2e')](_0x1f69e2[_0xdd22('0x2f')]);_0x370652[_0xdd22('0x30')]=_[_0xdd22('0x31')](_0x370652[_0xdd22('0x2d')],_0x370652['query']);_0x1c966d[_0xdd22('0x32')]=_[_0xdd22('0x31')](_0x370652['model'],qs[_0xdd22('0x33')](_0x1f69e2['query'][_0xdd22('0x33')]));_0x1c966d[_0xdd22('0x32')]=_0x1c966d[_0xdd22('0x32')][_0xdd22('0x34')]?_0x1c966d[_0xdd22('0x32')]:_0x370652[_0xdd22('0x2d')];if(!_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x35')]('nolimit')){_0x1c966d[_0xdd22('0x19')]=qs[_0xdd22('0x19')](_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x19')]);_0x1c966d[_0xdd22('0x18')]=qs['offset'](_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x18')]);}_0x1c966d[_0xdd22('0x36')]=qs['sort'](_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x37')]);_0x1c966d[_0xdd22('0x38')]=qs[_0xdd22('0x30')](_[_0xdd22('0x39')](_0x1f69e2[_0xdd22('0x2f')],_0x370652[_0xdd22('0x30')]),_0x28d572);if(_0x1f69e2[_0xdd22('0x2f')]['filter']){_0x1c966d['where']=_['merge'](_0x1c966d[_0xdd22('0x38')],{'$or':_['map'](_0x28d572,function(_0x5c5327){if(_0x5c5327[_0xdd22('0x2b')]!==_0xdd22('0x3a')){var _0x42700a={};_0x42700a[_0x5c5327[_0xdd22('0x24')]]={'$like':'%'+_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x3b')]+'%'};return _0x42700a;}})});}_0x1c966d=_['merge']({},_0x1c966d,_0x1f69e2[_0xdd22('0x3c')]);var _0x3440c5={'where':_0x1c966d[_0xdd22('0x38')]};return db['WhatsappApplication'][_0xdd22('0x3d')](_0x3440c5)[_0xdd22('0x20')](function(_0x12dc6b){_0x4f14b0[_0xdd22('0x3d')]=_0x12dc6b;if(_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x3e')]){_0x1c966d[_0xdd22('0x3f')]=[{'all':!![]}];}return db[_0xdd22('0x28')][_0xdd22('0x40')](_0x1c966d);})['then'](function(_0x503914){_0x4f14b0[_0xdd22('0x41')]=_0x503914;return _0x4f14b0;})[_0xdd22('0x20')](respondWithFilteredResult(_0x50fe0d,_0x1c966d))[_0xdd22('0x42')](handleError(_0x50fe0d,null));};exports[_0xdd22('0x43')]=function(_0x1e3ff2,_0x3a5cd6){var _0x3ec0f1={'raw':!![],'where':{'id':_0x1e3ff2[_0xdd22('0x44')]['id']}},_0x1f3a0b={};_0x1f3a0b['model']=_[_0xdd22('0x2e')](db['WhatsappApplication'][_0xdd22('0x29')]);_0x1f3a0b['query']=_[_0xdd22('0x2e')](_0x1e3ff2[_0xdd22('0x2f')]);_0x1f3a0b[_0xdd22('0x30')]=_[_0xdd22('0x31')](_0x1f3a0b[_0xdd22('0x2d')],_0x1f3a0b['query']);_0x3ec0f1['attributes']=_['intersection'](_0x1f3a0b[_0xdd22('0x2d')],qs[_0xdd22('0x33')](_0x1e3ff2[_0xdd22('0x2f')][_0xdd22('0x33')]));_0x3ec0f1[_0xdd22('0x32')]=_0x3ec0f1[_0xdd22('0x32')][_0xdd22('0x34')]?_0x3ec0f1['attributes']:_0x1f3a0b[_0xdd22('0x2d')];if(_0x1e3ff2[_0xdd22('0x2f')]['includeAll']){_0x3ec0f1['include']=[{'all':!![]}];}_0x3ec0f1=_[_0xdd22('0x45')]({},_0x3ec0f1,_0x1e3ff2[_0xdd22('0x3c')]);return db[_0xdd22('0x28')]['find'](_0x3ec0f1)[_0xdd22('0x20')](handleEntityNotFound(_0x3a5cd6,null))['then'](respondWithResult(_0x3a5cd6,null))[_0xdd22('0x42')](handleError(_0x3a5cd6,null));};exports[_0xdd22('0x46')]=function(_0x2fa2c0,_0x37e92e){return db[_0xdd22('0x28')][_0xdd22('0x46')](_0x2fa2c0['body'],{})[_0xdd22('0x20')](respondWithResult(_0x37e92e,0xc9))['catch'](handleError(_0x37e92e,null));};exports[_0xdd22('0x47')]=function(_0x2ab438,_0x3bf82e){if(_0x2ab438[_0xdd22('0x48')]['id']){delete _0x2ab438['body']['id'];}return db[_0xdd22('0x28')][_0xdd22('0x49')]({'where':{'id':_0x2ab438[_0xdd22('0x44')]['id']}})[_0xdd22('0x20')](handleEntityNotFound(_0x3bf82e,null))['then'](saveUpdates(_0x2ab438[_0xdd22('0x48')],null))[_0xdd22('0x20')](respondWithResult(_0x3bf82e,null))[_0xdd22('0x42')](handleError(_0x3bf82e,null));};exports['destroy']=function(_0x393a88,_0x54e3d2){return db[_0xdd22('0x28')][_0xdd22('0x49')]({'where':{'id':_0x393a88['params']['id']}})[_0xdd22('0x20')](handleEntityNotFound(_0x54e3d2,null))[_0xdd22('0x20')](removeEntity(_0x54e3d2,null))[_0xdd22('0x42')](handleError(_0x54e3d2,null));}; \ No newline at end of file +var _0x6cac=['keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','options','include','catch','show','fields','includeAll','WhatsappApplication','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x2b47ad,_0x55c7cc){var _0x1a2426=function(_0x47285b){while(--_0x47285b){_0x2b47ad['push'](_0x2b47ad['shift']());}};_0x1a2426(++_0x55c7cc);}(_0x6cac,0xf3));var _0xc6ca=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6cac[_0x465028];return _0xb783d4;};'use strict';var pdf=require(_0xc6ca('0x0'));var emlformat=require(_0xc6ca('0x1'));var rimraf=require(_0xc6ca('0x2'));var zipdir=require(_0xc6ca('0x3'));var jsonpatch=require(_0xc6ca('0x4'));var rp=require('request-promise');var moment=require(_0xc6ca('0x5'));var BPromise=require(_0xc6ca('0x6'));var Mustache=require(_0xc6ca('0x7'));var util=require(_0xc6ca('0x8'));var path=require('path');var sox=require(_0xc6ca('0x9'));var csv=require(_0xc6ca('0xa'));var ejs=require(_0xc6ca('0xb'));var fs=require('fs');var _=require(_0xc6ca('0xc'));var squel=require(_0xc6ca('0xd'));var crypto=require('crypto');var jsforce=require(_0xc6ca('0xe'));var deskjs=require(_0xc6ca('0xf'));var toCsv=require(_0xc6ca('0xa'));var querystring=require(_0xc6ca('0x10'));var Papa=require(_0xc6ca('0x11'));var Redis=require(_0xc6ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc6ca('0x13'));var as=require(_0xc6ca('0x14'));var hardwareService=require(_0xc6ca('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc6ca('0x16'));var config=require(_0xc6ca('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6ca('0x18'))['db'];function respondWithStatusCode(_0x4d7b93,_0x16279b){_0x16279b=_0x16279b||0xcc;return function(_0x253a16){if(_0x253a16){return _0x4d7b93['sendStatus'](_0x16279b);}return _0x4d7b93['status'](_0x16279b)[_0xc6ca('0x19')]();};}function respondWithResult(_0x102fce,_0x2d67da){_0x2d67da=_0x2d67da||0xc8;return function(_0x8214a3){if(_0x8214a3){return _0x102fce[_0xc6ca('0x1a')](_0x2d67da)['json'](_0x8214a3);}};}function respondWithFilteredResult(_0x1f6b65,_0xaf7a26){return function(_0x27bf52){if(_0x27bf52){var _0x2be724=_0x27bf52[_0xc6ca('0x1b')],_0x5cd9b7=_0xaf7a26['offset'],_0x408206=_0xaf7a26[_0xc6ca('0x1c')]+_0xaf7a26['limit'],_0x20aef7;if(_0x408206>=_0x2be724){_0x408206=_0x2be724;_0x20aef7=0xc8;}else{_0x20aef7=0xce;}_0x1f6b65[_0xc6ca('0x1a')](_0x20aef7);return _0x1f6b65[_0xc6ca('0x1d')](_0xc6ca('0x1e'),_0x5cd9b7+'-'+_0x408206+'/'+_0x2be724)[_0xc6ca('0x1f')](_0x27bf52);}return null;};}function patchUpdates(_0x180f63){return function(_0x2e95bb){try{jsonpatch[_0xc6ca('0x20')](_0x2e95bb,_0x180f63,!![]);}catch(_0x4408ea){return BPromise[_0xc6ca('0x21')](_0x4408ea);}return _0x2e95bb[_0xc6ca('0x22')]();};}function saveUpdates(_0x2a923f,_0x3f0f72){return function(_0x1b19f1){if(_0x1b19f1){return _0x1b19f1['update'](_0x2a923f)['then'](function(_0x2ba5c6){return _0x2ba5c6;});}return null;};}function removeEntity(_0x531c87,_0x8bd48f){return function(_0x441efa){if(_0x441efa){return _0x441efa[_0xc6ca('0x23')]()[_0xc6ca('0x24')](function(){_0x531c87['status'](0xcc)[_0xc6ca('0x19')]();});}};}function handleEntityNotFound(_0x7a9d77,_0x3cafa7){return function(_0x26ca47){if(!_0x26ca47){_0x7a9d77[_0xc6ca('0x25')](0x194);}return _0x26ca47;};}function handleError(_0x1e8a38,_0xb92069){_0xb92069=_0xb92069||0x1f4;return function(_0x263384){logger[_0xc6ca('0x26')](_0x263384[_0xc6ca('0x27')]);if(_0x263384[_0xc6ca('0x28')]){delete _0x263384[_0xc6ca('0x28')];}_0x1e8a38[_0xc6ca('0x1a')](_0xb92069)[_0xc6ca('0x29')](_0x263384);};}exports[_0xc6ca('0x2a')]=function(_0x9e633,_0x58ed6b){var _0x39af1f={},_0x5d7e25={},_0x16a29b={'count':0x0,'rows':[]};var _0x22815e=_[_0xc6ca('0x2b')](db['WhatsappApplication'][_0xc6ca('0x2c')],function(_0x4db655){return{'name':_0x4db655[_0xc6ca('0x2d')],'type':_0x4db655['type'][_0xc6ca('0x2e')]};});_0x5d7e25[_0xc6ca('0x2f')]=_[_0xc6ca('0x2b')](_0x22815e,_0xc6ca('0x28'));_0x5d7e25[_0xc6ca('0x30')]=_[_0xc6ca('0x31')](_0x9e633[_0xc6ca('0x30')]);_0x5d7e25[_0xc6ca('0x32')]=_[_0xc6ca('0x33')](_0x5d7e25['model'],_0x5d7e25['query']);_0x39af1f[_0xc6ca('0x34')]=_[_0xc6ca('0x33')](_0x5d7e25[_0xc6ca('0x2f')],qs['fields'](_0x9e633[_0xc6ca('0x30')]['fields']));_0x39af1f[_0xc6ca('0x34')]=_0x39af1f[_0xc6ca('0x34')]['length']?_0x39af1f[_0xc6ca('0x34')]:_0x5d7e25['model'];if(!_0x9e633[_0xc6ca('0x30')][_0xc6ca('0x35')](_0xc6ca('0x36'))){_0x39af1f[_0xc6ca('0x37')]=qs[_0xc6ca('0x37')](_0x9e633[_0xc6ca('0x30')][_0xc6ca('0x37')]);_0x39af1f['offset']=qs[_0xc6ca('0x1c')](_0x9e633[_0xc6ca('0x30')][_0xc6ca('0x1c')]);}_0x39af1f['order']=qs[_0xc6ca('0x38')](_0x9e633[_0xc6ca('0x30')][_0xc6ca('0x38')]);_0x39af1f[_0xc6ca('0x39')]=qs[_0xc6ca('0x32')](_['pick'](_0x9e633[_0xc6ca('0x30')],_0x5d7e25[_0xc6ca('0x32')]),_0x22815e);if(_0x9e633[_0xc6ca('0x30')][_0xc6ca('0x3a')]){_0x39af1f['where']=_[_0xc6ca('0x3b')](_0x39af1f[_0xc6ca('0x39')],{'$or':_[_0xc6ca('0x2b')](_0x22815e,function(_0xb3f087){if(_0xb3f087[_0xc6ca('0x3c')]!=='VIRTUAL'){var _0x2f246a={};_0x2f246a[_0xb3f087[_0xc6ca('0x28')]]={'$like':'%'+_0x9e633[_0xc6ca('0x30')][_0xc6ca('0x3a')]+'%'};return _0x2f246a;}})});}_0x39af1f=_[_0xc6ca('0x3b')]({},_0x39af1f,_0x9e633[_0xc6ca('0x3d')]);var _0x126a97={'where':_0x39af1f[_0xc6ca('0x39')]};return db['WhatsappApplication']['count'](_0x126a97)[_0xc6ca('0x24')](function(_0x5dd8d6){_0x16a29b[_0xc6ca('0x1b')]=_0x5dd8d6;if(_0x9e633[_0xc6ca('0x30')]['includeAll']){_0x39af1f[_0xc6ca('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x39af1f);})[_0xc6ca('0x24')](function(_0x40b26b){_0x16a29b['rows']=_0x40b26b;return _0x16a29b;})[_0xc6ca('0x24')](respondWithFilteredResult(_0x58ed6b,_0x39af1f))[_0xc6ca('0x3f')](handleError(_0x58ed6b,null));};exports[_0xc6ca('0x40')]=function(_0x4a4571,_0x47c926){var _0x878ce7={'raw':!![],'where':{'id':_0x4a4571['params']['id']}},_0x326e9d={};_0x326e9d[_0xc6ca('0x2f')]=_[_0xc6ca('0x31')](db['WhatsappApplication'][_0xc6ca('0x2c')]);_0x326e9d[_0xc6ca('0x30')]=_[_0xc6ca('0x31')](_0x4a4571[_0xc6ca('0x30')]);_0x326e9d[_0xc6ca('0x32')]=_['intersection'](_0x326e9d[_0xc6ca('0x2f')],_0x326e9d[_0xc6ca('0x30')]);_0x878ce7[_0xc6ca('0x34')]=_[_0xc6ca('0x33')](_0x326e9d['model'],qs[_0xc6ca('0x41')](_0x4a4571['query']['fields']));_0x878ce7[_0xc6ca('0x34')]=_0x878ce7[_0xc6ca('0x34')]['length']?_0x878ce7['attributes']:_0x326e9d[_0xc6ca('0x2f')];if(_0x4a4571[_0xc6ca('0x30')][_0xc6ca('0x42')]){_0x878ce7[_0xc6ca('0x3e')]=[{'all':!![]}];}_0x878ce7=_[_0xc6ca('0x3b')]({},_0x878ce7,_0x4a4571[_0xc6ca('0x3d')]);return db[_0xc6ca('0x43')][_0xc6ca('0x44')](_0x878ce7)[_0xc6ca('0x24')](handleEntityNotFound(_0x47c926,null))['then'](respondWithResult(_0x47c926,null))[_0xc6ca('0x3f')](handleError(_0x47c926,null));};exports[_0xc6ca('0x45')]=function(_0x4bd235,_0xb6cd7f){return db[_0xc6ca('0x43')][_0xc6ca('0x45')](_0x4bd235[_0xc6ca('0x46')],{})['then'](respondWithResult(_0xb6cd7f,0xc9))[_0xc6ca('0x3f')](handleError(_0xb6cd7f,null));};exports[_0xc6ca('0x47')]=function(_0x42c84b,_0x2ae16a){if(_0x42c84b[_0xc6ca('0x46')]['id']){delete _0x42c84b[_0xc6ca('0x46')]['id'];}return db['WhatsappApplication'][_0xc6ca('0x44')]({'where':{'id':_0x42c84b[_0xc6ca('0x48')]['id']}})[_0xc6ca('0x24')](handleEntityNotFound(_0x2ae16a,null))[_0xc6ca('0x24')](saveUpdates(_0x42c84b['body'],null))[_0xc6ca('0x24')](respondWithResult(_0x2ae16a,null))[_0xc6ca('0x3f')](handleError(_0x2ae16a,null));};exports[_0xc6ca('0x23')]=function(_0x407c3a,_0x58a6b0){return db['WhatsappApplication'][_0xc6ca('0x44')]({'where':{'id':_0x407c3a[_0xc6ca('0x48')]['id']}})[_0xc6ca('0x24')](handleEntityNotFound(_0x58a6b0,null))[_0xc6ca('0x24')](removeEntity(_0x58a6b0,null))[_0xc6ca('0x3f')](handleError(_0x58a6b0,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2b26b31..a538a85 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 _0x131c=['moment','bluebird','request-promise','path','exports','whatsapp_applications','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x131c,0x19c));var _0xc131=function(_0x2d5ea2,_0x1b319e){_0x2d5ea2=_0x2d5ea2-0x0;var _0x3e2ecb=_0x131c[_0x2d5ea2];return _0x3e2ecb;};'use strict';var _=require(_0xc131('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc131('0x1'));var BPromise=require(_0xc131('0x2'));var rp=require(_0xc131('0x3'));var fs=require('fs');var path=require(_0xc131('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xc131('0x5')]=function(_0x405c79,_0x275b4e){return _0x405c79['define']('WhatsappApplication',attributes,{'tableName':_0xc131('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x53ee=['moment','bluebird','request-promise','path','../../config/environment','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3c98e1,_0x10667f){var _0x507fe9=function(_0x16cc60){while(--_0x16cc60){_0x3c98e1['push'](_0x3c98e1['shift']());}};_0x507fe9(++_0x10667f);}(_0x53ee,0x140));var _0xe53e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x53ee[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xe53e('0x0'));var util=require(_0xe53e('0x1'));var logger=require(_0xe53e('0x2'))(_0xe53e('0x3'));var moment=require(_0xe53e('0x4'));var BPromise=require(_0xe53e('0x5'));var rp=require(_0xe53e('0x6'));var fs=require('fs');var path=require(_0xe53e('0x7'));var rimraf=require('rimraf');var config=require(_0xe53e('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x53949c,_0x34bb86){return _0x53949c['define'](_0xe53e('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe53e('0xa'),'collate':_0xe53e('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index fa48246..6d13e20 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 _0xfc65=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x135096,_0x186606){var _0x3b91f0=function(_0x59cc84){while(--_0x59cc84){_0x135096['push'](_0x135096['shift']());}};_0x3b91f0(++_0x186606);}(_0xfc65,0x1e1));var _0x5fc6=function(_0xecac70,_0x5f13a4){_0xecac70=_0xecac70-0x0;var _0x967ee5=_0xfc65[_0xecac70];return _0x967ee5;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5fc6('0x1'));var rs=require(_0x5fc6('0x2'));var fs=require('fs');var Redis=require(_0x5fc6('0x3'));var db=require(_0x5fc6('0x4'))['db'];var utils=require(_0x5fc6('0x5'));var logger=require(_0x5fc6('0x6'))(_0x5fc6('0x7'));var config=require(_0x5fc6('0x8'));var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409c5f,_0x1a9600,_0x572941){return new BPromise(function(_0x3921c5,_0x1f1409){return client[_0x5fc6('0xc')](_0x409c5f,_0x572941)[_0x5fc6('0xd')](function(_0x16c285){logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1a9600,_0x5fc6('0x10'));logger[_0x5fc6('0x11')](_0x5fc6('0x12'),_0x1a9600,'request\x20sent',JSON[_0x5fc6('0x13')](_0x16c285));if(_0x16c285['error']){if(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x15')]===0x1f4){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285['error'][_0x5fc6('0x16')]);return _0x1f1409(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);return _0x3921c5(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}else{logger[_0x5fc6('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1a9600,'request\x20sent');_0x3921c5(_0x16c285[_0x5fc6('0x17')][_0x5fc6('0x16')]);}})['catch'](function(_0x26d2ba){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x26d2ba);_0x1f1409(_0x26d2ba);});});} \ No newline at end of file +var _0x4074=['jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4074,0xf0));var _0x4407=function(_0x4f2065,_0x36f02e){_0x4f2065=_0x4f2065-0x0;var _0x78fd67=_0x4074[_0x4f2065];return _0x78fd67;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var moment=require(_0x4407('0x2'));var BPromise=require('bluebird');var rs=require(_0x4407('0x3'));var fs=require('fs');var Redis=require(_0x4407('0x4'));var db=require(_0x4407('0x5'))['db'];var utils=require(_0x4407('0x6'));var logger=require(_0x4407('0x7'))(_0x4407('0x8'));var config=require(_0x4407('0x9'));var jayson=require(_0x4407('0xa'));var client=jayson[_0x4407('0xb')][_0x4407('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4933cf,_0x988538,_0x5f0699){return new BPromise(function(_0x414f0a,_0x3c1aee){return client[_0x4407('0xd')](_0x4933cf,_0x5f0699)['then'](function(_0x5e70a5){logger['info'](_0x4407('0xe'),_0x988538,_0x4407('0xf'));logger[_0x4407('0x10')](_0x4407('0x11'),_0x988538,_0x4407('0xf'),JSON[_0x4407('0x12')](_0x5e70a5));if(_0x5e70a5[_0x4407('0x13')]){if(_0x5e70a5[_0x4407('0x13')][_0x4407('0x14')]===0x1f4){logger[_0x4407('0x13')](_0x4407('0xe'),_0x988538,_0x5e70a5['error'][_0x4407('0x15')]);return _0x3c1aee(_0x5e70a5[_0x4407('0x13')]['message']);}logger[_0x4407('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x988538,_0x5e70a5[_0x4407('0x13')][_0x4407('0x15')]);return _0x414f0a(_0x5e70a5[_0x4407('0x13')][_0x4407('0x15')]);}else{logger[_0x4407('0x16')](_0x4407('0xe'),_0x988538,_0x4407('0xf'));_0x414f0a(_0x5e70a5[_0x4407('0x17')]['message']);}})[_0x4407('0x18')](function(_0x65b20b){logger[_0x4407('0x13')](_0x4407('0xe'),_0x988538,_0x65b20b);_0x3c1aee(_0x65b20b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 5a23599..d708449 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 _0x9734=['/:id/messages','getMessages','post','create','addMessage','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','whatsappinteraction:destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x29c98c,_0x4780bb){var _0x1da0ef=function(_0x3c270f){while(--_0x3c270f){_0x29c98c['push'](_0x29c98c['shift']());}};_0x1da0ef(++_0x4780bb);}(_0x9734,0x144));var _0x4973=function(_0x3d3842,_0x3965d6){_0x3d3842=_0x3d3842-0x0;var _0x580931=_0x9734[_0x3d3842];return _0x580931;};'use strict';var multer=require(_0x4973('0x0'));var util=require(_0x4973('0x1'));var path=require(_0x4973('0x2'));var timeout=require(_0x4973('0x3'));var express=require(_0x4973('0x4'));var router=express[_0x4973('0x5')]();var auth=require(_0x4973('0x6'));var interaction=require(_0x4973('0x7'));var config=require(_0x4973('0x8'));var controller=require(_0x4973('0x9'));router[_0x4973('0xa')]('/',auth[_0x4973('0xb')](),controller[_0x4973('0xc')]);router[_0x4973('0xa')](_0x4973('0xd'),auth[_0x4973('0xb')](),controller[_0x4973('0xe')]);router[_0x4973('0xa')](_0x4973('0xf'),auth[_0x4973('0xb')](),controller[_0x4973('0x10')]);router[_0x4973('0xa')](_0x4973('0x11'),auth['isAuthenticated'](),controller[_0x4973('0x12')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x4973('0x13')]('/',auth[_0x4973('0xb')](),controller[_0x4973('0x14')]);router[_0x4973('0x13')](_0x4973('0x11'),auth[_0x4973('0xb')](),controller[_0x4973('0x15')]);router[_0x4973('0x13')]('/:id/tags',auth[_0x4973('0xb')](),interaction[_0x4973('0x16')]('whatsapp',_0x4973('0x17')),controller[_0x4973('0x18')]);router[_0x4973('0x19')](_0x4973('0xf'),auth['isAuthenticated'](),interaction[_0x4973('0x16')](_0x4973('0x1a'),_0x4973('0x1b')),controller['update']);router['delete'](_0x4973('0xf'),auth[_0x4973('0xb')](),interaction[_0x4973('0x16')]('whatsapp',_0x4973('0x1c')),controller['destroy']);router[_0x4973('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0x4973('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xa8f7=['removeTags','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','whatsapp','addTags','put','tracked','whatsappinteraction:update','update','delete','destroy','/:id/tags'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xa8f7,0x195));var _0x7a8f=function(_0x15e922,_0x26e102){_0x15e922=_0x15e922-0x0;var _0x5d2293=_0xa8f7[_0x15e922];return _0x5d2293;};'use strict';var multer=require('multer');var util=require(_0x7a8f('0x0'));var path=require('path');var timeout=require(_0x7a8f('0x1'));var express=require('express');var router=express[_0x7a8f('0x2')]();var auth=require(_0x7a8f('0x3'));var interaction=require(_0x7a8f('0x4'));var config=require(_0x7a8f('0x5'));var controller=require(_0x7a8f('0x6'));router[_0x7a8f('0x7')]('/',auth['isAuthenticated'](),controller[_0x7a8f('0x8')]);router[_0x7a8f('0x7')](_0x7a8f('0x9'),auth[_0x7a8f('0xa')](),controller['describe']);router['get'](_0x7a8f('0xb'),auth[_0x7a8f('0xa')](),controller[_0x7a8f('0xc')]);router['get'](_0x7a8f('0xd'),auth[_0x7a8f('0xa')](),controller[_0x7a8f('0xe')]);router[_0x7a8f('0x7')](_0x7a8f('0xf'),auth[_0x7a8f('0xa')](),controller[_0x7a8f('0x10')]);router[_0x7a8f('0x11')]('/',auth[_0x7a8f('0xa')](),controller[_0x7a8f('0x12')]);router[_0x7a8f('0x11')](_0x7a8f('0xd'),auth['isAuthenticated'](),controller[_0x7a8f('0x13')]);router[_0x7a8f('0x11')]('/:id/tags',auth[_0x7a8f('0xa')](),interaction['tracked'](_0x7a8f('0x14'),'whatsappinteraction:addtags'),controller[_0x7a8f('0x15')]);router[_0x7a8f('0x16')](_0x7a8f('0xb'),auth['isAuthenticated'](),interaction[_0x7a8f('0x17')](_0x7a8f('0x14'),_0x7a8f('0x18')),controller[_0x7a8f('0x19')]);router[_0x7a8f('0x1a')](_0x7a8f('0xb'),auth[_0x7a8f('0xa')](),interaction[_0x7a8f('0x17')]('whatsapp','whatsappinteraction:destroy'),controller[_0x7a8f('0x1b')]);router[_0x7a8f('0x1a')](_0x7a8f('0x1c'),auth[_0x7a8f('0xa')](),controller[_0x7a8f('0x1d')]);module[_0x7a8f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 206ca3d..af31fcb 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 _0x3a61=['ENUM','out','BOOLEAN','DATE','STRING'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x3a61,0xd4));var _0x13a6=function(_0x258d81,_0x41ebde){_0x258d81=_0x258d81-0x0;var _0x7d0e3c=_0x3a61[_0x258d81];return _0x7d0e3c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x13a6('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x13a6('0x1')]},'disposition':{'type':Sequelize[_0x13a6('0x2')]},'secondDisposition':{'type':Sequelize[_0x13a6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x13a6('0x2')]},'note':{'type':Sequelize[_0x13a6('0x2')]},'phone':{'type':Sequelize[_0x13a6('0x2')]},'read1stAt':{'type':Sequelize[_0x13a6('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x13a6('0x3')]('in',_0x13a6('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x13a6('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x13a6('0x3')]('in',_0x13a6('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x365a=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','moment','exports'];(function(_0x4df11d,_0x1d8a8d){var _0x153c92=function(_0x21b85a){while(--_0x21b85a){_0x4df11d['push'](_0x4df11d['shift']());}};_0x153c92(++_0x1d8a8d);}(_0x365a,0x18d));var _0xa365=function(_0x54f74f,_0x172a13){_0x54f74f=_0x54f74f-0x0;var _0x2d4cba=_0x365a[_0x54f74f];return _0x2d4cba;};'use strict';var Sequelize=require(_0xa365('0x0'));var moment=require(_0xa365('0x1'));module[_0xa365('0x2')]={'closed':{'type':Sequelize[_0xa365('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa365('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa365('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa365('0x4')]},'read1stAt':{'type':Sequelize[_0xa365('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xa365('0x6')]('in',_0xa365('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa365('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 3c9194b..bd5e677 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 _0x8e36=['40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Whatsapp','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','existsSync','pipe','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','status','json','count','apply','reject','save','update','then','sendStatus','error','stack','name','send','Users','TagIds','Tags','split','forEach','push','catch','map','WhatsappInteraction','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','merge','options','create','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','fullname','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','10px'];(function(_0x43f585,_0x3f8ba8){var _0x399005=function(_0x1e0027){while(--_0x1e0027){_0x43f585['push'](_0x43f585['shift']());}};_0x399005(++_0x3f8ba8);}(_0x8e36,0x10c));var _0x68e3=function(_0x17e682,_0x37c2bb){_0x17e682=_0x17e682-0x0;var _0x46d026=_0x8e36[_0x17e682];return _0x46d026;};'use strict';var pdf=require(_0x68e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x68e3('0x1'));var zipdir=require(_0x68e3('0x2'));var jsonpatch=require(_0x68e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68e3('0x4'));var Mustache=require(_0x68e3('0x5'));var util=require('util');var path=require(_0x68e3('0x6'));var sox=require('sox');var csv=require(_0x68e3('0x7'));var ejs=require(_0x68e3('0x8'));var fs=require('fs');var _=require(_0x68e3('0x9'));var squel=require('squel');var crypto=require(_0x68e3('0xa'));var jsforce=require(_0x68e3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x68e3('0x7'));var querystring=require(_0x68e3('0xc'));var Papa=require(_0x68e3('0xd'));var Redis=require(_0x68e3('0xe'));var authService=require(_0x68e3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x68e3('0x10'));var hardwareService=require(_0x68e3('0x11'));var logger=require(_0x68e3('0x12'))(_0x68e3('0x13'));var utils=require('../../config/utils');var config=require(_0x68e3('0x14'));var licenseUtil=require(_0x68e3('0x15'));var db=require(_0x68e3('0x16'))['db'];config[_0x68e3('0x17')]=_[_0x68e3('0x18')](config['redis'],{'host':_0x68e3('0x19'),'port':0x18eb});var socket=require(_0x68e3('0x1a'))(new Redis(config[_0x68e3('0x17')]));require(_0x68e3('0x1b'))[_0x68e3('0x1c')](socket);function respondWithStatusCode(_0x42c28c,_0x17c7a5){_0x17c7a5=_0x17c7a5||0xcc;return function(_0x3d9d04){if(_0x3d9d04){return _0x42c28c['sendStatus'](_0x17c7a5);}return _0x42c28c['status'](_0x17c7a5)[_0x68e3('0x1d')]();};}function respondWithResult(_0xd80fcf,_0x36a47c){_0x36a47c=_0x36a47c||0xc8;return function(_0xf6ae1f){if(_0xf6ae1f){return _0xd80fcf[_0x68e3('0x1e')](_0x36a47c)[_0x68e3('0x1f')](_0xf6ae1f);}};}function respondWithFilteredResult(_0x5b9250,_0xed3a55){return function(_0x47d8eb){if(_0x47d8eb){var _0x45d5d9=_0x47d8eb[_0x68e3('0x20')],_0x11ae98=_0xed3a55['offset'],_0x19d768=_0xed3a55['offset']+_0xed3a55['limit'],_0x12c48e;if(_0x19d768>=_0x45d5d9){_0x19d768=_0x45d5d9;_0x12c48e=0xc8;}else{_0x12c48e=0xce;}_0x5b9250[_0x68e3('0x1e')](_0x12c48e);return _0x5b9250['set']('Content-Range',_0x11ae98+'-'+_0x19d768+'/'+_0x45d5d9)['json'](_0x47d8eb);}return null;};}function patchUpdates(_0x58e52b){return function(_0x1e0ddc){try{jsonpatch[_0x68e3('0x21')](_0x1e0ddc,_0x58e52b,!![]);}catch(_0x4cd901){return BPromise[_0x68e3('0x22')](_0x4cd901);}return _0x1e0ddc[_0x68e3('0x23')]();};}function saveUpdates(_0x1091e6,_0x4cdd5e){return function(_0x51f690){if(_0x51f690){return _0x51f690[_0x68e3('0x24')](_0x1091e6)[_0x68e3('0x25')](function(_0x3b8606){return _0x3b8606;});}return null;};}function removeEntity(_0x18dcea,_0x20f3f1){return function(_0x130f2d){if(_0x130f2d){return _0x130f2d['destroy']()['then'](function(){_0x18dcea[_0x68e3('0x1e')](0xcc)[_0x68e3('0x1d')]();});}};}function handleEntityNotFound(_0xc09cd0,_0x44bbdd){return function(_0x4d4cd5){if(!_0x4d4cd5){_0xc09cd0[_0x68e3('0x26')](0x194);}return _0x4d4cd5;};}function handleError(_0x4d4c5b,_0xd66631){_0xd66631=_0xd66631||0x1f4;return function(_0x3ebcdd){logger[_0x68e3('0x27')](_0x3ebcdd[_0x68e3('0x28')]);if(_0x3ebcdd[_0x68e3('0x29')]){delete _0x3ebcdd['name'];}_0x4d4c5b['status'](_0xd66631)[_0x68e3('0x2a')](_0x3ebcdd);};}function getInteractionUsers(_0xe77eb7,_0x2ee36a){return new BPromise(function(_0x4427af,_0x9ae7e0){try{if(_0x2ee36a[_0xe77eb7['id']]){_0xe77eb7[_0x68e3('0x2b')]=_['map'](_0x2ee36a[_0xe77eb7['id']],function(_0x4d5183){return{'id':_0x4d5183['id'],'fullname':_0x4d5183['fullname']};});}}catch(_0x1300be){_0x9ae7e0(_0x1300be);}_0x4427af(_0xe77eb7);});}function getInteractionTags(_0x4de523,_0x1e7a14){return new BPromise(function(_0x1ae085,_0x2d19ca){try{if(_0x4de523[_0x68e3('0x2c')]){_0x4de523[_0x68e3('0x2d')]=[];_0x4de523['TagIds'][_0x68e3('0x2e')](',')[_0x68e3('0x2f')](function(_0x1d7b7b){_0x4de523['Tags'][_0x68e3('0x30')](_0x1e7a14[_0x1d7b7b]);});}delete _0x4de523[_0x68e3('0x2c')];}catch(_0x42e70e){_0x2d19ca(_0x42e70e);}_0x1ae085(_0x4de523);});}function updateWhatsappInteraction(_0x43e6cc,_0x3e87e9,_0x2f830f){return new BPromise(function(_0x6776a6,_0x5a4d10){return getInteractionUsers(_0x43e6cc,_0x2f830f)['then'](function(_0x1cd774){return getInteractionTags(_0x1cd774,_0x3e87e9);})[_0x68e3('0x25')](function(_0x1feeeb){_0x6776a6(_0x1feeeb);})[_0x68e3('0x31')](function(_0x553544){_0x5a4d10(_0x553544);});});}exports['index']=function(_0x7f6714,_0x54cd58){var _0x5e1208={},_0x3a9a33={},_0x1fce33={'count':0x0,'rows':[]};var _0x5d5325=_[_0x68e3('0x32')](db[_0x68e3('0x33')]['rawAttributes'],function(_0x286af0){return{'name':_0x286af0['fieldName'],'type':_0x286af0[_0x68e3('0x34')][_0x68e3('0x35')]};});_0x3a9a33[_0x68e3('0x36')]=_['map'](_0x5d5325,'name');_0x3a9a33[_0x68e3('0x37')]=_[_0x68e3('0x38')](_0x7f6714[_0x68e3('0x37')]);_0x3a9a33[_0x68e3('0x39')]=_['intersection'](_0x3a9a33['model'],_0x3a9a33[_0x68e3('0x37')]);_0x5e1208[_0x68e3('0x3a')]=_[_0x68e3('0x3b')](_0x3a9a33['model'],qs['fields'](_0x7f6714[_0x68e3('0x37')][_0x68e3('0x3c')]));_0x5e1208[_0x68e3('0x3a')]=_0x5e1208[_0x68e3('0x3a')][_0x68e3('0x3d')]?_0x5e1208['attributes']:_0x3a9a33[_0x68e3('0x36')];if(!_0x7f6714[_0x68e3('0x37')][_0x68e3('0x3e')]('nolimit')){_0x5e1208[_0x68e3('0x3f')]=qs[_0x68e3('0x3f')](_0x7f6714['query'][_0x68e3('0x3f')]);_0x5e1208['offset']=qs[_0x68e3('0x40')](_0x7f6714[_0x68e3('0x37')]['offset']);}_0x5e1208[_0x68e3('0x41')]=qs[_0x68e3('0x42')](_0x7f6714[_0x68e3('0x37')][_0x68e3('0x42')]);_0x5e1208[_0x68e3('0x43')]=qs[_0x68e3('0x39')](_[_0x68e3('0x44')](_0x7f6714[_0x68e3('0x37')],_0x3a9a33['filters']),_0x5d5325);var _0x1f1a62=[];var _0x25cd36=squel[_0x68e3('0x45')]()[_0x68e3('0x46')]('id')[_0x68e3('0x46')]('name')[_0x68e3('0x46')](_0x68e3('0x47'))[_0x68e3('0x48')](_0x68e3('0x49'));var _0x1995f6=squel[_0x68e3('0x45')]()['field'](_0x68e3('0x4a'))[_0x68e3('0x46')]('u.fullname')[_0x68e3('0x46')](_0x68e3('0x4b'))[_0x68e3('0x48')](_0x68e3('0x4c'),'ui')[_0x68e3('0x4d')]('users','u',_0x68e3('0x4e'));var _0xddf46=squel['select']()[_0x68e3('0x48')](_0x68e3('0x4f'),'i')[_0x68e3('0x4d')](_0x68e3('0x50'),'c',_0x68e3('0x51'))['left_join'](_0x68e3('0x52'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x68e3('0x53'),'a',_0x68e3('0x54'))['left_join']('whatsapp_messages','me',_0x68e3('0x55'))['left_join'](_0x68e3('0x56'),'it',_0x68e3('0x57'))[_0x68e3('0x4d')](_0x68e3('0x49'),'t',_0x68e3('0x58'));var _0x573d3e=squel[_0x68e3('0x59')]();var _0x3e614c=[];var _0x32156b=squel[_0x68e3('0x59')]();var _0x893ab9;if(_0x7f6714['query']['search']){_0x893ab9=as['parseSearch'](_0x7f6714['query'][_0x68e3('0x5a')]);var _0x5b8a6e=_0x893ab9[_0x68e3('0x5b')];for(var _0x48dfcd=0x0;_0x48dfcd<_0x893ab9[_0x68e3('0x5c')][_0x68e3('0x3d')];_0x48dfcd++){var _0x3e2102=_0x893ab9[_0x68e3('0x5c')][_0x48dfcd];var _0x50198b='i';var _0x11b64f=_[_0x68e3('0x5d')](_0x5d5325,[_0x68e3('0x29'),_0x3e2102[_0x68e3('0x46')]]);if(!_0x11b64f){switch(_0x3e2102['field']){case _0x68e3('0x5e'):if(_0x3e2102[_0x68e3('0x5f')]==0x1){_0xddf46[_0x68e3('0x60')]('`'+_0x3e2102[_0x68e3('0x46')]+_0x68e3('0x61'));}else{_0xddf46[_0x68e3('0x60')]('`'+_0x3e2102[_0x68e3('0x46')]+_0x68e3('0x62'));}break;case _0x68e3('0x63'):if(_0x3e2102[_0x68e3('0x64')]===_0x68e3('0x65')){if(_0x3e2102[_0x68e3('0x5f')]['split']('\x20')[_0x68e3('0x3d')]>0x1){_0x573d3e[_0x5b8a6e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x68e3('0x66')](_0x3e2102[_0x68e3('0x5f')]),null);}else{var _0x4af9d0='%'+_0x3e2102[_0x68e3('0x5f')]+'%';_0x573d3e[_0x5b8a6e](_0x68e3('0x67'),_0x4af9d0,_0x4af9d0,_0x4af9d0);}}else{_0x11b64f=_[_0x68e3('0x5d')](_0x5d5325,[_0x68e3('0x29'),_0x68e3('0x68')]);_0x3e2102[_0x68e3('0x46')]=_0x68e3('0x68');_0x471ff9=as[_0x68e3('0x69')](_0x50198b,_0x11b64f[_0x68e3('0x34')],_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9[_0x68e3('0x6a')],_0x471ff9['value'][_0x68e3('0x6b')],_0x471ff9['value']['end']);}break;case _0x68e3('0x6c'):var _0x2723ba=_0x3e2102[_0x68e3('0x5f')][_0x68e3('0x2e')](',')[_0x68e3('0x32')](function(_0x15ea82){return Number(_0x15ea82);});_0x2723ba['forEach'](function(_0x41846b){_0x32156b['or'](_0x68e3('0x6d'),'%,'+_0x41846b+',%');});_0x3e614c=_[_0x68e3('0x6e')](_0x3e614c,_0x2723ba);break;case _0x68e3('0x6f'):if(_0x3e2102[_0x68e3('0x64')]===_0x68e3('0x65')){_0x573d3e[_0x5b8a6e](_0x68e3('0x70'),'%'+_0x3e2102[_0x68e3('0x5f')]+'%',null);}else{_0x11b64f=_['find'](_0x5d5325,[_0x68e3('0x29'),_0x68e3('0x71')]);_0x3e2102[_0x68e3('0x46')]='UserId';_0x471ff9=as[_0x68e3('0x69')](_0x50198b,_0x11b64f[_0x68e3('0x34')],_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9[_0x68e3('0x6a')],_0x471ff9[_0x68e3('0x5f')]['start'],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x1d')]);}break;case _0x68e3('0x72'):_0x471ff9=as[_0x68e3('0x69')]('me',null,_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9['text'],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x6b')],_0x471ff9[_0x68e3('0x5f')]['end']);break;}}else{var _0x471ff9=as[_0x68e3('0x69')](_0x50198b,_0x11b64f[_0x68e3('0x34')],_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9[_0x68e3('0x6a')],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x6b')],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x1d')]);}}}else{var _0x31f0ac=_(_0x7f6714[_0x68e3('0x37')])[_0x68e3('0x38')]()[_0x68e3('0x32')](function(_0x50d908){return _[_0x68e3('0x73')](_0x5d5325,['name',_0x50d908])?_0x50d908:undefined;})[_0x68e3('0x74')]()[_0x68e3('0x5f')]();if(!_[_0x68e3('0x75')](_0x31f0ac)){_0x31f0ac[_0x68e3('0x2f')](function(_0x525548){if(_0x525548===_0x68e3('0x76')){_0xddf46[_0x68e3('0x43')](_0x68e3('0x77'),[][_0x68e3('0x78')](_0x7f6714['query'][_0x525548]));}else if(_0x525548===_0x68e3('0x79')){var _0x27d42b=JSON[_0x68e3('0x7a')](_0x7f6714['query'][_0x525548])[_0x68e3('0x7b')];var _0x2ad8c7=JSON[_0x68e3('0x7a')](_0x7f6714[_0x68e3('0x37')][_0x525548])[_0x68e3('0x7c')];_0xddf46['where'](_0x68e3('0x7d'),_0x27d42b,_0x2ad8c7);}else{if(_0x7f6714[_0x68e3('0x37')][_0x525548]==='null'){_0xddf46['where']('i.'+_0x525548+_0x68e3('0x7e'));}else{_0xddf46['where']('i.'+_0x525548+_0x68e3('0x7f'),_0x7f6714[_0x68e3('0x37')][_0x525548]);}}});}if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x80')]){if(_0x7f6714['query'][_0x68e3('0x80')]==0x1){_0xddf46['having'](_0x68e3('0x81'));}else{_0xddf46['having'](_0x68e3('0x82'));}}if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x83')]){_0x3e614c=_['isArray'](_0x7f6714[_0x68e3('0x37')][_0x68e3('0x83')])?_0x7f6714['query'][_0x68e3('0x83')]:new Array(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x83')]);_0x3e614c['forEach'](function(_0x46de8d){_0x32156b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46de8d+',%');});}if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x84')]){var _0x5ee511=_0x7f6714[_0x68e3('0x37')][_0x68e3('0x84')][_0x68e3('0x85')]('\x5c','\x5c\x5c')[_0x68e3('0x85')](/'/g,'\x27\x27');if(qs[_0x68e3('0x86')](_0x5ee511)){_0x573d3e['or']('i.id\x20LIKE\x20?',_0x5ee511+'%')['or']('i.phone\x20LIKE\x20?',_0x5ee511+'%');}else{_0x573d3e['or'](_0x68e3('0x87'),qs[_0x68e3('0x66')](_0x5ee511))['or'](_0x68e3('0x88'),_0x5ee511+'%');}}}_0xddf46[_0x68e3('0x43')](_0x573d3e);_0xddf46[_0x68e3('0x89')](_0x68e3('0x8a'));var _0x5bd49a={'type':db[_0x68e3('0x8b')][_0x68e3('0x8c')][_0x68e3('0x8d')],'raw':!![]};var _0xd64dfb=_0xddf46[_0x68e3('0x8e')]();_0xd64dfb[_0x68e3('0x46')]('i.id');_0xd64dfb[_0x68e3('0x46')](_0x68e3('0x8f'),_0x68e3('0x5e'));if(_0x5e1208[_0x68e3('0x41')]){_0x5e1208['order']['forEach'](function(_0x5c0065){var _0x298029=_0x5c0065[0x0]===_0x68e3('0x90')?_0x5c0065[0x0]:'i.'+_0x5c0065[0x0];_0xddf46['order'](_0x298029,_0x5c0065[0x1]===_0x68e3('0x91')?![]:!![]);});}if(!_[_0x68e3('0x75')](_0x3e614c)){_0xddf46[_0x68e3('0x60')](_0x32156b);_0xd64dfb[_0x68e3('0x43')]('t.id\x20IN\x20?',_0x3e614c);}BPromise[_0x68e3('0x92')]()[_0x68e3('0x25')](function(){if(!_0x893ab9){if(_0x7f6714['query']['WhatsappAccountId']||_0x7f6714[_0x68e3('0x37')][_0x68e3('0x93')])return;_0xd64dfb[_0x68e3('0x43')](_0x68e3('0x94'));_0xddf46[_0x68e3('0x43')](_0x68e3('0x94'));return;}if(_0x7f6714[_0x68e3('0x95')][_0x68e3('0x96')]!=='agent')return;return _0x7f6714[_0x68e3('0x95')][_0x68e3('0x97')]({'attributes':['id'],'raw':!![]})[_0x68e3('0x25')](function(_0x46f3a2){if(_[_0x68e3('0x75')](_0x46f3a2)){_0xd64dfb[_0x68e3('0x43')](_0x68e3('0x98'));_0xddf46[_0x68e3('0x43')](_0x68e3('0x98'));}else{_0xd64dfb['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x46f3a2,'id'));_0xddf46[_0x68e3('0x43')](_0x68e3('0x77'),_[_0x68e3('0x32')](_0x46f3a2,'id'));}});})[_0x68e3('0x25')](function(){if(_0x7f6714['user'][_0x68e3('0x96')]===_0x68e3('0x99')&&!_0x893ab9&&!_0x7f6714[_0x68e3('0x37')]['WhatsappAccountId'])return[];return db[_0x68e3('0x9a')][_0x68e3('0x37')](_0xd64dfb[_0x68e3('0x9b')](),_0x5bd49a);})[_0x68e3('0x25')](function(_0x2b71af){_0x1fce33[_0x68e3('0x20')]=_0x2b71af[_0x68e3('0x3d')];if(_0x1fce33[_0x68e3('0x20')]===0x0)return[];return db['sequelize'][_0x68e3('0x37')](_0x25cd36[_0x68e3('0x9b')](),_0x5bd49a)['then'](function(_0x45a9f2){_0x1f1a62=_[_0x68e3('0x9c')](_0x45a9f2,'id');_0x5bd49a=_['merge'](_0x5bd49a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x3c')]){_0x5e1208[_0x68e3('0x3a')][_0x68e3('0x2f')](function(_0xa2eaab){_0xddf46[_0x68e3('0x46')]('i.'+_0xa2eaab);});}else{_0xddf46['field'](_0x68e3('0x8f'),_0x68e3('0x5e'));_0xddf46[_0x68e3('0x46')](_0x68e3('0x9d'),'Account.key');_0xddf46[_0x68e3('0x46')](_0x68e3('0x9e'),_0x68e3('0x9f'));_0xddf46[_0x68e3('0x46')]('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');_0xddf46[_0x68e3('0x46')](_0x68e3('0xa0'));_0xddf46[_0x68e3('0x46')]('c.firstName','Contact.firstName');_0xddf46['field'](_0x68e3('0xa1'),'Contact.lastName');_0xddf46[_0x68e3('0x46')](_0x68e3('0xa2'),_0x68e3('0xa3'));_0xddf46[_0x68e3('0x46')](_0x68e3('0xa4'),'Contact.phone');_0xddf46[_0x68e3('0x46')](_0x68e3('0xa5'),'Contact.mobile');_0xddf46[_0x68e3('0x46')]('c.fax',_0x68e3('0xa6'));_0xddf46[_0x68e3('0x46')](_0x68e3('0xa7'),'Owner.fullname');_0xddf46['field'](_0x68e3('0xa8'),_0x68e3('0xa9'));_0xddf46[_0x68e3('0x46')](_0x68e3('0xaa'),_0x68e3('0x2c'));}if(_0x5e1208['limit'])_0xddf46[_0x68e3('0x3f')](_0x5e1208[_0x68e3('0x3f')]);if(_0x5e1208[_0x68e3('0x40')])_0xddf46[_0x68e3('0x40')](_0x5e1208[_0x68e3('0x40')]);return db['sequelize'][_0x68e3('0x37')](_0xddf46[_0x68e3('0x9b')](),_0x5bd49a);})[_0x68e3('0x25')](function(_0x21afa0){_0x1995f6[_0x68e3('0x43')](_0x68e3('0xab'),_[_0x68e3('0x32')](_0x21afa0,'id'));return db[_0x68e3('0x9a')][_0x68e3('0x37')](_0x1995f6[_0x68e3('0x9b')](),_0x5bd49a)[_0x68e3('0x25')](function(_0x48acee){var _0x4aed84=_[_0x68e3('0xac')](_0x48acee,_0x68e3('0xad'));var _0x2a190a=[];_0x21afa0[_0x68e3('0x2f')](function(_0x3be9d5){_0x2a190a[_0x68e3('0x30')](updateWhatsappInteraction(_0x3be9d5,_0x1f1a62,_0x4aed84));});return BPromise[_0x68e3('0xae')](_0x2a190a);});});})[_0x68e3('0x25')](function(_0x37aa2a){_0x1fce33[_0x68e3('0xaf')]=_0x37aa2a;return _0x1fce33;})[_0x68e3('0x25')](respondWithFilteredResult(_0x54cd58,_0x5e1208))['catch'](handleError(_0x54cd58,null));};exports[_0x68e3('0xb0')]=function(_0x20e7ee,_0x3c0eb3){var _0x235074={'raw':![],'where':{'id':_0x20e7ee[_0x68e3('0xb1')]['id']}},_0x38084f={};_0x38084f['model']=_[_0x68e3('0x38')](db[_0x68e3('0x33')]['rawAttributes']);_0x38084f[_0x68e3('0x37')]=_[_0x68e3('0x38')](_0x20e7ee[_0x68e3('0x37')]);_0x38084f[_0x68e3('0x39')]=_[_0x68e3('0x3b')](_0x38084f[_0x68e3('0x36')],_0x38084f[_0x68e3('0x37')]);_0x235074['attributes']=_[_0x68e3('0x3b')](_0x38084f[_0x68e3('0x36')],qs[_0x68e3('0x3c')](_0x20e7ee[_0x68e3('0x37')][_0x68e3('0x3c')]));_0x235074[_0x68e3('0x3a')]=_0x235074['attributes'][_0x68e3('0x3d')]?_0x235074[_0x68e3('0x3a')]:_0x38084f['model'];if(_0x20e7ee[_0x68e3('0x37')][_0x68e3('0xb2')]){_0x235074[_0x68e3('0xb3')]=[{'all':!![]}];}_0x235074=_[_0x68e3('0xb4')]({},_0x235074,_0x20e7ee[_0x68e3('0xb5')]);return db['WhatsappInteraction'][_0x68e3('0x5d')](_0x235074)[_0x68e3('0x25')](handleEntityNotFound(_0x3c0eb3,null))[_0x68e3('0x25')](respondWithResult(_0x3c0eb3,null))['catch'](handleError(_0x3c0eb3,null));};exports[_0x68e3('0xb6')]=function(_0x50ae6b,_0x5bca9e){return db[_0x68e3('0x33')][_0x68e3('0xb6')](_0x50ae6b[_0x68e3('0x72')],{})[_0x68e3('0x25')](respondWithResult(_0x5bca9e,0xc9))[_0x68e3('0x31')](handleError(_0x5bca9e,null));};exports[_0x68e3('0x24')]=function(_0xd53302,_0x5baeb7){if(_0xd53302[_0x68e3('0x72')]['id']){delete _0xd53302['body']['id'];}return db[_0x68e3('0x33')]['find']({'where':{'id':_0xd53302[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x5baeb7,null))[_0x68e3('0x25')](saveUpdates(_0xd53302[_0x68e3('0x72')],null))[_0x68e3('0x25')](respondWithResult(_0x5baeb7,null))['catch'](handleError(_0x5baeb7,null));};exports[_0x68e3('0xb7')]=function(_0x4ad71b,_0x33b000){return db[_0x68e3('0x33')][_0x68e3('0x5d')]({'where':{'id':_0x4ad71b[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x33b000,null))[_0x68e3('0x25')](removeEntity(_0x33b000,null))[_0x68e3('0x31')](handleError(_0x33b000,null));};exports[_0x68e3('0xb8')]=function(_0x272392,_0x1275e9){return db['WhatsappInteraction'][_0x68e3('0xb8')]()['then'](respondWithResult(_0x1275e9,null))['catch'](handleError(_0x1275e9,null));};exports[_0x68e3('0xb9')]=function(_0x2e74e6,_0x271118,_0x1ffbb9){return db[_0x68e3('0xba')][_0x68e3('0x5d')]({'where':{'id':_0x2e74e6[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x271118,null))[_0x68e3('0x25')](function(_0x425494){if(_0x425494){return _0x425494[_0x68e3('0xb9')](_0x2e74e6['body'][_0x68e3('0xbb')],_[_0x68e3('0xbc')](_0x2e74e6[_0x68e3('0x72')],[_0x68e3('0xbb'),'id'])||{});}})[_0x68e3('0x25')](respondWithResult(_0x271118,null))['catch'](handleError(_0x271118,null));};exports[_0x68e3('0xbd')]=function(_0x4e8b4e,_0x339ca7,_0x4fd40c){var _0x26f88a={'raw':![],'where':{}};var _0x38677b={};var _0x1c07ba={'count':0x0,'rows':[]};return db[_0x68e3('0x33')][_0x68e3('0xbe')]({'where':{'id':_0x4e8b4e['params']['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x339ca7,null))[_0x68e3('0x25')](function(_0x58d079){if(_0x58d079){_0x38677b[_0x68e3('0x36')]=_[_0x68e3('0x38')](db['WhatsappMessage']['rawAttributes']);_0x38677b['query']=_[_0x68e3('0x38')](_0x4e8b4e[_0x68e3('0x37')]);_0x38677b[_0x68e3('0x39')]=_[_0x68e3('0x3b')](_0x38677b[_0x68e3('0x36')],_0x38677b['query']);_0x26f88a['attributes']=_['intersection'](_0x38677b[_0x68e3('0x36')],qs[_0x68e3('0x3c')](_0x4e8b4e[_0x68e3('0x37')]['fields']));_0x26f88a[_0x68e3('0x3a')]=_0x26f88a[_0x68e3('0x3a')][_0x68e3('0x3d')]?_0x26f88a[_0x68e3('0x3a')]:_0x38677b[_0x68e3('0x36')];if(!_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x3e')](_0x68e3('0xbf'))){_0x26f88a[_0x68e3('0x3f')]=qs[_0x68e3('0x3f')](_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x3f')]);_0x26f88a[_0x68e3('0x40')]=qs[_0x68e3('0x40')](_0x4e8b4e[_0x68e3('0x37')]['offset']);}_0x26f88a[_0x68e3('0x41')]=qs[_0x68e3('0x42')](_0x4e8b4e['query'][_0x68e3('0x42')]);_0x26f88a[_0x68e3('0x43')]=qs[_0x68e3('0x39')](_['pick'](_0x4e8b4e['query'],_0x38677b[_0x68e3('0x39')]));_0x26f88a[_0x68e3('0x43')][_0x68e3('0xad')]=_0x58d079['id'];if(_0x4e8b4e[_0x68e3('0x37')]['filter']){_0x26f88a['where']=_[_0x68e3('0xb4')](_0x26f88a[_0x68e3('0x43')],{'$or':_['map'](_0x26f88a['attributes'],function(_0x3f4c55){var _0x1e8b36={};_0x1e8b36[_0x3f4c55]={'$like':'%'+_0x4e8b4e['query']['filter']+'%'};return _0x1e8b36;})});}if(_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x7b')]){var _0x4c2625=_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x7b')][_0x68e3('0x2e')](',');var _0x517c06={};_0x517c06[_0x4c2625[0x0]]={'$gte':moment(_0x4c2625[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x26f88a[_0x68e3('0x43')]=_['merge'](_0x26f88a[_0x68e3('0x43')],_0x517c06);}_0x26f88a=_[_0x68e3('0xb4')]({},_0x26f88a,_0x4e8b4e[_0x68e3('0xb5')]);return db['WhatsappMessage'][_0x68e3('0x20')]({'where':_0x26f88a[_0x68e3('0x43')]})[_0x68e3('0x25')](function(_0x1ca027){_0x1c07ba[_0x68e3('0x20')]=_0x1ca027;if(_0x4e8b4e[_0x68e3('0x37')]['includeAll']){_0x26f88a[_0x68e3('0xb3')]=[{'all':!![]}];}return db[_0x68e3('0xba')][_0x68e3('0xc0')](_0x26f88a);})[_0x68e3('0x25')](function(_0x114cb2){_0x1c07ba[_0x68e3('0xaf')]=_0x114cb2;return _0x1c07ba;});}})[_0x68e3('0x25')](respondWithFilteredResult(_0x339ca7,_0x26f88a))[_0x68e3('0x31')](handleError(_0x339ca7,null));};exports[_0x68e3('0xc1')]=function(_0x30b9c4,_0x387d42,_0x1faee9){return db[_0x68e3('0x33')][_0x68e3('0x5d')]({'where':{'id':_0x30b9c4[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x387d42,null))[_0x68e3('0x25')](function(_0x161443){if(_0x161443){return _0x161443['setTags'](_0x30b9c4[_0x68e3('0x72')][_0x68e3('0xbb')],_[_0x68e3('0xbc')](_0x30b9c4[_0x68e3('0x72')],[_0x68e3('0xbb'),'id'])||{})[_0x68e3('0xc2')](function(){return db[_0x68e3('0x6c')][_0x68e3('0xc0')]({'attributes':['id','name',_0x68e3('0x47')],'where':{'id':_0x30b9c4[_0x68e3('0x72')]['ids']}});})[_0x68e3('0x25')](function(_0x342f3f){socket[_0x68e3('0xc3')](_0x68e3('0xc4'),{'id':Number(_0x30b9c4['params']['id']),'tags':_0x342f3f||[]});return{'id':Number(_0x30b9c4['params']['id']),'tags':_0x342f3f||[]};});}})['then'](respondWithResult(_0x387d42,null))[_0x68e3('0x31')](handleError(_0x387d42,null));};exports[_0x68e3('0xc5')]=function(_0x1851fe,_0x2fd4c7,_0x57624c){return db[_0x68e3('0x33')][_0x68e3('0x5d')]({'where':{'id':_0x1851fe[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x2fd4c7,null))[_0x68e3('0x25')](function(_0x674a9a){if(_0x674a9a){return _0x674a9a['removeTags'](_0x1851fe['query']['ids']);}})[_0x68e3('0x25')](respondWithStatusCode(_0x2fd4c7,null))['catch'](handleError(_0x2fd4c7,null));};exports[_0x68e3('0xc6')]=function(_0x50a3ae,_0x397d73){var _0x5a8fc3=moment()[_0x68e3('0xc7')]()[_0x68e3('0x9b')]();var _0xab93e0=path[_0x68e3('0xc8')](config[_0x68e3('0xc9')],_0x68e3('0xca'),_0x68e3('0xcb'),_0x68e3('0xcc'));var _0x5c6d95=path[_0x68e3('0xc8')](config[_0x68e3('0xc9')],_0x68e3('0xca'),_0x68e3('0xcb'),'attachments');var _0x55b140=path['join'](_0xab93e0,_0x5a8fc3);var _0x5d3c93=util[_0x68e3('0xcd')]('transcript-%d-%s.zip',_0x50a3ae[_0x68e3('0xb1')]['id'],_0x5a8fc3);var _0x1930bc=path[_0x68e3('0xc8')](_0xab93e0,_0x5d3c93);var _0x3d5d14=[];_0x3d5d14[_0x68e3('0x30')]({'model':db['User'],'as':'User','attributes':['id',_0x68e3('0xce')],'raw':!![]});_0x3d5d14[_0x68e3('0x30')]({'model':db[_0x68e3('0xcf')],'as':_0x68e3('0x63'),'attributes':['id',_0x68e3('0xd0'),_0x68e3('0xd1')],'raw':!![]});if(_0x50a3ae['query'][_0x68e3('0xd2')]){_0x3d5d14[_0x68e3('0x30')]({'model':db[_0x68e3('0xd3')],'as':_0x68e3('0xd3'),'raw':!![]});}var _0x35a519=[{'model':db['WhatsappMessage'],'as':_0x68e3('0xd4'),'attributes':['id','body',_0x68e3('0x79'),_0x68e3('0xd5'),_0x68e3('0xd6'),_0x68e3('0x80')],'include':_0x3d5d14}];_0x35a519['push']({'model':db[_0x68e3('0xd7')],'as':_0x68e3('0xd8'),'attributes':['id',_0x68e3('0x29')]});_0x35a519[_0x68e3('0x30')]({'model':db['User'],'as':_0x68e3('0xd9'),'attributes':['id',_0x68e3('0xce')]});return db['WhatsappInteraction'][_0x68e3('0x5d')]({'where':{'id':_0x50a3ae[_0x68e3('0xb1')]['id']},'include':_0x35a519})[_0x68e3('0x25')](handleEntityNotFound(_0x397d73,null))[_0x68e3('0x25')](function(_0x3aeb6d){if(_0x3aeb6d){var _0xd209e2=_0x3aeb6d[_0x68e3('0xda')]({'plain':!![]});fs['mkdirSync'](_0x55b140);var _0x4ba68f={'format':'A4','border':_0x68e3('0xdb'),'header':{'height':_0x68e3('0xdc'),'contents':{'first':_0x68e3('0xdd')}},'footer':{'height':_0x68e3('0xde'),'contents':{'default':util[_0x68e3('0xcd')](_0x68e3('0xdf'),util['format'](_0x68e3('0xe0'),'Whatsapp',_0xd209e2['id']),moment()['format'](_0x68e3('0xe1'))[_0x68e3('0x9b')]())}}};var _0x4c254f={'channel':_0x68e3('0xe2'),'account':_0xd209e2[_0x68e3('0xd8')][_0x68e3('0x29')],'agent':_0xd209e2[_0x68e3('0xd9')]?_0xd209e2[_0x68e3('0xd9')]['fullname']:_0x68e3('0xe3'),'createdAt':moment(_0xd209e2[_0x68e3('0x79')])[_0x68e3('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x68e3('0x9b')](),'closedAt':_0xd209e2[_0x68e3('0xe4')]?moment(_0xd209e2['closedAt'])[_0x68e3('0xcd')](_0x68e3('0xe5'))['toString']():'','disposition':_0xd209e2[_0x68e3('0xe6')],'messages':_(_0xd209e2[_0x68e3('0xd4')])[_0x68e3('0x84')]({'secret':![]})['map'](function(_0x194edd){if(_0x194edd[_0x68e3('0xd3')]){var _0x28737c=path[_0x68e3('0xc8')](_0x5c6d95,_0x194edd[_0x68e3('0xd3')][_0x68e3('0xe7')]);if(fs[_0x68e3('0xe8')](_0x28737c)){fs['createReadStream'](_0x28737c)[_0x68e3('0xe9')](fs['createWriteStream'](path['join'](_0x55b140,_0x194edd[_0x68e3('0xd3')][_0x68e3('0xe7')])));}}return{'date':moment(_0x194edd[_0x68e3('0x79')])[_0x68e3('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x194edd[_0x68e3('0xd5')]===_0x68e3('0xea')?_0x194edd[_0x68e3('0x6f')]?_0x194edd[_0x68e3('0x6f')][_0x68e3('0xce')]:_0x68e3('0xeb'):_0x194edd['Contact'][_0x68e3('0xd0')]+(_0x194edd[_0x68e3('0x63')][_0x68e3('0xd1')]?'\x20'+_0x194edd[_0x68e3('0x63')][_0x68e3('0xd1')]:''),'body':_0x194edd[_0x68e3('0xd3')]?_0x194edd[_0x68e3('0xd3')][_0x68e3('0xe7')]:_0x194edd['body'],'direction':_0x194edd[_0x68e3('0xd5')]==='out'?'A':'C','secret':_0x194edd['secret'],'read':_0x194edd['read'],'attachment':_0x194edd[_0x68e3('0xd3')]};})[_0x68e3('0x5f')]()};return ejs[_0x68e3('0xec')](path[_0x68e3('0xc8')](config['root'],_0x68e3('0xca'),'views',_0x68e3('0xed')),{'interaction':_0x4c254f})[_0x68e3('0x25')](function(_0x6b469f){return new BPromise(function(_0x291835,_0x50dc19){pdf[_0x68e3('0xb6')](_0x6b469f,_0x4ba68f)[_0x68e3('0xee')](path['join'](_0x55b140,_0x68e3('0xef')+_0xd209e2['id']+'-'+_0x5a8fc3+_0x68e3('0xf0')),function(_0x5e0ebf,_0x507408){if(_0x5e0ebf)return _0x50dc19(_0x5e0ebf);_0x291835(_0x507408);});});})['then'](function(){return new BPromise(function(_0x7c4f3,_0x422f00){zipdir(_0x55b140,{'saveTo':_0x1930bc},function(_0x1117b9,_0xe95731){if(_0x1117b9)return _0x422f00(_0x1117b9);return _0x7c4f3(_0xe95731);});})['then'](function(){return new BPromise(function(_0x41cdd0,_0x22d4e2){rimraf(_0x55b140,function(_0x15be09){if(_0x15be09)_0x22d4e2(_0x15be09);return _0x41cdd0();});});})[_0x68e3('0x25')](function(){return _0x397d73[_0x68e3('0xc6')](_0x1930bc,_0x5d3c93,function(_0x5939b8){if(_0x5939b8){console[_0x68e3('0xf1')](_0x68e3('0xf2'),_0x5939b8);}else{fs[_0x68e3('0xf3')](_0x1930bc);}});});});}else{return _0x397d73['sendStatus'](0xc8);}})[_0x68e3('0x31')](handleError(_0x397d73,null));}; \ No newline at end of file +var _0x855d=['query','filters','intersection','attributes','fields','length','nolimit','pick','field','color','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','compact','isEmpty','WhatsappAccountId','where','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','params','include','merge','options','create','body','describe','WhatsappMessage','addMessage','ids','omit','findOne','sort','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','removeTags','download','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','toFile','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','./whatsappInteraction.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','Users','map','TagIds','forEach','Tags','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys'];(function(_0x45423d,_0x5b9263){var _0x2085d6=function(_0x4d4f86){while(--_0x4d4f86){_0x45423d['push'](_0x45423d['shift']());}};_0x2085d6(++_0x5b9263);}(_0x855d,0x19f));var _0xd855=function(_0x3a221d,_0x442ce){_0x3a221d=_0x3a221d-0x0;var _0x1b18df=_0x855d[_0x3a221d];return _0x1b18df;};'use strict';var pdf=require(_0xd855('0x0'));var emlformat=require(_0xd855('0x1'));var rimraf=require(_0xd855('0x2'));var zipdir=require(_0xd855('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd855('0x4'));var sox=require('sox');var csv=require(_0xd855('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd855('0x6'));var squel=require(_0xd855('0x7'));var crypto=require(_0xd855('0x8'));var jsforce=require(_0xd855('0x9'));var deskjs=require(_0xd855('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd855('0xb'));var Redis=require(_0xd855('0xc'));var authService=require(_0xd855('0xd'));var qs=require(_0xd855('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd855('0xf'));var logger=require(_0xd855('0x10'))(_0xd855('0x11'));var utils=require(_0xd855('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd855('0x13'));var db=require('../../mysqldb')['db'];config[_0xd855('0x14')]=_[_0xd855('0x15')](config[_0xd855('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd855('0x14')]));require(_0xd855('0x16'))[_0xd855('0x17')](socket);function respondWithStatusCode(_0x179e2f,_0x4d3c25){_0x4d3c25=_0x4d3c25||0xcc;return function(_0x167aaf){if(_0x167aaf){return _0x179e2f['sendStatus'](_0x4d3c25);}return _0x179e2f['status'](_0x4d3c25)[_0xd855('0x18')]();};}function respondWithResult(_0x2d3b10,_0x528bc4){_0x528bc4=_0x528bc4||0xc8;return function(_0x5871b7){if(_0x5871b7){return _0x2d3b10[_0xd855('0x19')](_0x528bc4)[_0xd855('0x1a')](_0x5871b7);}};}function respondWithFilteredResult(_0x37e09c,_0x2d8b62){return function(_0x58feac){if(_0x58feac){var _0x2462d4=_0x58feac[_0xd855('0x1b')],_0x569b1e=_0x2d8b62['offset'],_0xeafd0=_0x2d8b62[_0xd855('0x1c')]+_0x2d8b62[_0xd855('0x1d')],_0x109498;if(_0xeafd0>=_0x2462d4){_0xeafd0=_0x2462d4;_0x109498=0xc8;}else{_0x109498=0xce;}_0x37e09c[_0xd855('0x19')](_0x109498);return _0x37e09c[_0xd855('0x1e')](_0xd855('0x1f'),_0x569b1e+'-'+_0xeafd0+'/'+_0x2462d4)[_0xd855('0x1a')](_0x58feac);}return null;};}function patchUpdates(_0x41e763){return function(_0x69f448){try{jsonpatch[_0xd855('0x20')](_0x69f448,_0x41e763,!![]);}catch(_0x3298fb){return BPromise[_0xd855('0x21')](_0x3298fb);}return _0x69f448['save']();};}function saveUpdates(_0x5b4e8a,_0x24e3a8){return function(_0x13db1a){if(_0x13db1a){return _0x13db1a['update'](_0x5b4e8a)[_0xd855('0x22')](function(_0x164a73){return _0x164a73;});}return null;};}function removeEntity(_0x46b373,_0x3dacec){return function(_0x3a96c4){if(_0x3a96c4){return _0x3a96c4[_0xd855('0x23')]()[_0xd855('0x22')](function(){_0x46b373[_0xd855('0x19')](0xcc)[_0xd855('0x18')]();});}};}function handleEntityNotFound(_0x32f6df,_0x37863d){return function(_0x1b813e){if(!_0x1b813e){_0x32f6df[_0xd855('0x24')](0x194);}return _0x1b813e;};}function handleError(_0x2d4846,_0x170a0b){_0x170a0b=_0x170a0b||0x1f4;return function(_0xc8f1a9){logger[_0xd855('0x25')](_0xc8f1a9['stack']);if(_0xc8f1a9[_0xd855('0x26')]){delete _0xc8f1a9[_0xd855('0x26')];}_0x2d4846['status'](_0x170a0b)[_0xd855('0x27')](_0xc8f1a9);};}function getInteractionUsers(_0x5ec312,_0x1f8d11){return new BPromise(function(_0x4d8f60,_0x389067){try{if(_0x1f8d11[_0x5ec312['id']]){_0x5ec312[_0xd855('0x28')]=_[_0xd855('0x29')](_0x1f8d11[_0x5ec312['id']],function(_0x52f6bf){return{'id':_0x52f6bf['id'],'fullname':_0x52f6bf['fullname']};});}}catch(_0x331578){_0x389067(_0x331578);}_0x4d8f60(_0x5ec312);});}function getInteractionTags(_0x498601,_0x1e8f71){return new BPromise(function(_0x7804bc,_0x275b8e){try{if(_0x498601[_0xd855('0x2a')]){_0x498601['Tags']=[];_0x498601[_0xd855('0x2a')]['split'](',')[_0xd855('0x2b')](function(_0x51afa8){_0x498601[_0xd855('0x2c')][_0xd855('0x2d')](_0x1e8f71[_0x51afa8]);});}delete _0x498601[_0xd855('0x2a')];}catch(_0x2ac3c7){_0x275b8e(_0x2ac3c7);}_0x7804bc(_0x498601);});}function updateWhatsappInteraction(_0x4d788c,_0x5bd968,_0x231881){return new BPromise(function(_0x19aeaf,_0x359ff1){return getInteractionUsers(_0x4d788c,_0x231881)[_0xd855('0x22')](function(_0x5460a){return getInteractionTags(_0x5460a,_0x5bd968);})[_0xd855('0x22')](function(_0x1621c0){_0x19aeaf(_0x1621c0);})[_0xd855('0x2e')](function(_0x3dcb55){_0x359ff1(_0x3dcb55);});});}exports[_0xd855('0x2f')]=function(_0x559515,_0x2e35ca){var _0x1698ea={},_0x474410={},_0x3a4fe6={'count':0x0,'rows':[]};var _0xc1f1db=_[_0xd855('0x29')](db[_0xd855('0x30')][_0xd855('0x31')],function(_0xfc95ec){return{'name':_0xfc95ec[_0xd855('0x32')],'type':_0xfc95ec[_0xd855('0x33')][_0xd855('0x34')]};});_0x474410[_0xd855('0x35')]=_['map'](_0xc1f1db,_0xd855('0x26'));_0x474410['query']=_[_0xd855('0x36')](_0x559515[_0xd855('0x37')]);_0x474410[_0xd855('0x38')]=_[_0xd855('0x39')](_0x474410['model'],_0x474410[_0xd855('0x37')]);_0x1698ea[_0xd855('0x3a')]=_[_0xd855('0x39')](_0x474410['model'],qs[_0xd855('0x3b')](_0x559515[_0xd855('0x37')][_0xd855('0x3b')]));_0x1698ea['attributes']=_0x1698ea[_0xd855('0x3a')][_0xd855('0x3c')]?_0x1698ea[_0xd855('0x3a')]:_0x474410[_0xd855('0x35')];if(!_0x559515[_0xd855('0x37')]['hasOwnProperty'](_0xd855('0x3d'))){_0x1698ea[_0xd855('0x1d')]=qs[_0xd855('0x1d')](_0x559515['query'][_0xd855('0x1d')]);_0x1698ea[_0xd855('0x1c')]=qs[_0xd855('0x1c')](_0x559515['query']['offset']);}_0x1698ea['order']=qs['sort'](_0x559515[_0xd855('0x37')]['sort']);_0x1698ea['where']=qs[_0xd855('0x38')](_[_0xd855('0x3e')](_0x559515[_0xd855('0x37')],_0x474410[_0xd855('0x38')]),_0xc1f1db);var _0x1f878b=[];var _0x33e457=squel['select']()['field']('id')[_0xd855('0x3f')](_0xd855('0x26'))[_0xd855('0x3f')](_0xd855('0x40'))['from'](_0xd855('0x41'));var _0x2b8edc=squel[_0xd855('0x42')]()[_0xd855('0x3f')](_0xd855('0x43'))['field'](_0xd855('0x44'))[_0xd855('0x3f')](_0xd855('0x45'))[_0xd855('0x46')](_0xd855('0x47'),'ui')[_0xd855('0x48')](_0xd855('0x49'),'u',_0xd855('0x4a'));var _0x4d2b81=squel['select']()[_0xd855('0x46')]('whatsapp_interactions','i')['left_join'](_0xd855('0x4b'),'c',_0xd855('0x4c'))[_0xd855('0x48')]('users','o',_0xd855('0x4d'))[_0xd855('0x48')](_0xd855('0x4e'),'a',_0xd855('0x4f'))[_0xd855('0x48')](_0xd855('0x50'),'me',_0xd855('0x51'))[_0xd855('0x48')](_0xd855('0x52'),'it',_0xd855('0x53'))[_0xd855('0x48')](_0xd855('0x41'),'t',_0xd855('0x54'));var _0x109fe3=squel[_0xd855('0x55')]();var _0x19c00a=[];var _0x4bba3d=squel[_0xd855('0x55')]();var _0x5f2e09;if(_0x559515[_0xd855('0x37')][_0xd855('0x56')]){_0x5f2e09=as[_0xd855('0x57')](_0x559515[_0xd855('0x37')][_0xd855('0x56')]);var _0x52f65c=_0x5f2e09[_0xd855('0x58')];for(var _0x3a4bc2=0x0;_0x3a4bc2<_0x5f2e09['conditions'][_0xd855('0x3c')];_0x3a4bc2++){var _0xd0bed6=_0x5f2e09[_0xd855('0x59')][_0x3a4bc2];var _0x28230e='i';var _0x1d4d28=_[_0xd855('0x5a')](_0xc1f1db,['name',_0xd0bed6[_0xd855('0x3f')]]);if(!_0x1d4d28){switch(_0xd0bed6[_0xd855('0x3f')]){case _0xd855('0x5b'):if(_0xd0bed6['value']==0x1){_0x4d2b81[_0xd855('0x5c')]('`'+_0xd0bed6[_0xd855('0x3f')]+_0xd855('0x5d'));}else{_0x4d2b81[_0xd855('0x5c')]('`'+_0xd0bed6[_0xd855('0x3f')]+_0xd855('0x5e'));}break;case'Contact':if(_0xd0bed6['operator']===_0xd855('0x5f')){if(_0xd0bed6['value']['split']('\x20')['length']>0x1){_0x109fe3[_0x52f65c](_0xd855('0x60'),qs['getFullTextValue'](_0xd0bed6[_0xd855('0x61')]),null);}else{var _0x5c5653='%'+_0xd0bed6[_0xd855('0x61')]+'%';_0x109fe3[_0x52f65c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5c5653,_0x5c5653,_0x5c5653);}}else{_0x1d4d28=_[_0xd855('0x5a')](_0xc1f1db,[_0xd855('0x26'),'ContactId']);_0xd0bed6[_0xd855('0x3f')]=_0xd855('0x62');_0x56eeda=as['buildExpression'](_0x28230e,_0x1d4d28['type'],_0xd0bed6);_0x109fe3[_0x52f65c](_0x56eeda[_0xd855('0x63')],_0x56eeda[_0xd855('0x61')][_0xd855('0x64')],_0x56eeda[_0xd855('0x61')][_0xd855('0x18')]);}break;case _0xd855('0x65'):var _0x1debdf=_0xd0bed6[_0xd855('0x61')][_0xd855('0x66')](',')[_0xd855('0x29')](function(_0x462767){return Number(_0x462767);});_0x1debdf[_0xd855('0x2b')](function(_0x2529ca){_0x4bba3d['or'](_0xd855('0x67'),'%,'+_0x2529ca+',%');});_0x19c00a=_['union'](_0x19c00a,_0x1debdf);break;case _0xd855('0x68'):if(_0xd0bed6['operator']===_0xd855('0x5f')){_0x109fe3[_0x52f65c](_0xd855('0x69'),'%'+_0xd0bed6['value']+'%',null);}else{_0x1d4d28=_['find'](_0xc1f1db,[_0xd855('0x26'),_0xd855('0x6a')]);_0xd0bed6[_0xd855('0x3f')]=_0xd855('0x6a');_0x56eeda=as[_0xd855('0x6b')](_0x28230e,_0x1d4d28['type'],_0xd0bed6);_0x109fe3[_0x52f65c](_0x56eeda['text'],_0x56eeda[_0xd855('0x61')][_0xd855('0x64')],_0x56eeda[_0xd855('0x61')][_0xd855('0x18')]);}break;case'body':_0x56eeda=as[_0xd855('0x6b')]('me',null,_0xd0bed6);_0x109fe3[_0x52f65c](_0x56eeda[_0xd855('0x63')],_0x56eeda[_0xd855('0x61')]['start'],_0x56eeda[_0xd855('0x61')][_0xd855('0x18')]);break;}}else{var _0x56eeda=as[_0xd855('0x6b')](_0x28230e,_0x1d4d28[_0xd855('0x33')],_0xd0bed6);_0x109fe3[_0x52f65c](_0x56eeda[_0xd855('0x63')],_0x56eeda[_0xd855('0x61')]['start'],_0x56eeda['value'][_0xd855('0x18')]);}}}else{var _0x5b2a79=_(_0x559515[_0xd855('0x37')])['keys']()[_0xd855('0x29')](function(_0x5bcfab){return _['some'](_0xc1f1db,[_0xd855('0x26'),_0x5bcfab])?_0x5bcfab:undefined;})[_0xd855('0x6c')]()[_0xd855('0x61')]();if(!_[_0xd855('0x6d')](_0x5b2a79)){_0x5b2a79[_0xd855('0x2b')](function(_0x261f9d){if(_0x261f9d===_0xd855('0x6e')){_0x4d2b81[_0xd855('0x6f')]('i.WhatsappAccountId\x20IN\x20?',[][_0xd855('0x70')](_0x559515[_0xd855('0x37')][_0x261f9d]));}else if(_0x261f9d==='createdAt'){var _0x395b32=JSON[_0xd855('0x71')](_0x559515[_0xd855('0x37')][_0x261f9d])['$gte'];var _0x3f01cb=JSON[_0xd855('0x71')](_0x559515[_0xd855('0x37')][_0x261f9d])['$lte'];_0x4d2b81[_0xd855('0x6f')](_0xd855('0x72'),_0x395b32,_0x3f01cb);}else{if(_0x559515[_0xd855('0x37')][_0x261f9d]===_0xd855('0x73')){_0x4d2b81[_0xd855('0x6f')]('i.'+_0x261f9d+_0xd855('0x74'));}else{_0x4d2b81[_0xd855('0x6f')]('i.'+_0x261f9d+_0xd855('0x75'),_0x559515['query'][_0x261f9d]);}}});}if(_0x559515[_0xd855('0x37')]['read']){if(_0x559515[_0xd855('0x37')][_0xd855('0x76')]==0x1){_0x4d2b81[_0xd855('0x5c')](_0xd855('0x77'));}else{_0x4d2b81[_0xd855('0x5c')](_0xd855('0x78'));}}if(_0x559515[_0xd855('0x37')][_0xd855('0x79')]){_0x19c00a=_[_0xd855('0x7a')](_0x559515[_0xd855('0x37')][_0xd855('0x79')])?_0x559515[_0xd855('0x37')][_0xd855('0x79')]:new Array(_0x559515[_0xd855('0x37')][_0xd855('0x79')]);_0x19c00a[_0xd855('0x2b')](function(_0x442dfe){_0x4bba3d['or'](_0xd855('0x67'),'%,'+_0x442dfe+',%');});}if(_0x559515[_0xd855('0x37')]['filter']){var _0x3b450f=_0x559515[_0xd855('0x37')]['filter'][_0xd855('0x7b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3b450f)){_0x109fe3['or'](_0xd855('0x7c'),_0x3b450f+'%')['or']('i.phone\x20LIKE\x20?',_0x3b450f+'%');}else{_0x109fe3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3b450f))['or'](_0xd855('0x7d'),_0x3b450f+'%');}}}_0x4d2b81['where'](_0x109fe3);_0x4d2b81[_0xd855('0x7e')](_0xd855('0x7f'));var _0x7da46d={'type':db['Sequelize'][_0xd855('0x80')][_0xd855('0x81')],'raw':!![]};var _0x3abeb6=_0x4d2b81[_0xd855('0x82')]();_0x3abeb6[_0xd855('0x3f')](_0xd855('0x7f'));_0x3abeb6['field'](_0xd855('0x83'),_0xd855('0x5b'));if(_0x1698ea['order']){_0x1698ea[_0xd855('0x84')]['forEach'](function(_0x1ddc39){var _0xdb3564=_0x1ddc39[0x0]===_0xd855('0x85')?_0x1ddc39[0x0]:'i.'+_0x1ddc39[0x0];_0x4d2b81[_0xd855('0x84')](_0xdb3564,_0x1ddc39[0x1]===_0xd855('0x86')?![]:!![]);});}if(!_['isEmpty'](_0x19c00a)){_0x4d2b81[_0xd855('0x5c')](_0x4bba3d);_0x3abeb6['where'](_0xd855('0x87'),_0x19c00a);}BPromise[_0xd855('0x88')]()[_0xd855('0x22')](function(){if(!_0x5f2e09){if(_0x559515[_0xd855('0x37')][_0xd855('0x6e')]||_0x559515['query'][_0xd855('0x89')])return;_0x3abeb6[_0xd855('0x6f')](_0xd855('0x8a'));_0x4d2b81[_0xd855('0x6f')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x559515['user'][_0xd855('0x8b')]!==_0xd855('0x8c'))return;return _0x559515[_0xd855('0x8d')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xd855('0x22')](function(_0xa641ea){if(_['isEmpty'](_0xa641ea)){_0x3abeb6['where'](_0xd855('0x8e'));_0x4d2b81[_0xd855('0x6f')](_0xd855('0x8e'));}else{_0x3abeb6[_0xd855('0x6f')](_0xd855('0x8f'),_[_0xd855('0x29')](_0xa641ea,'id'));_0x4d2b81[_0xd855('0x6f')](_0xd855('0x8f'),_[_0xd855('0x29')](_0xa641ea,'id'));}});})[_0xd855('0x22')](function(){if(_0x559515['user'][_0xd855('0x8b')]===_0xd855('0x8c')&&!_0x5f2e09&&!_0x559515[_0xd855('0x37')][_0xd855('0x6e')])return[];return db[_0xd855('0x90')][_0xd855('0x37')](_0x3abeb6[_0xd855('0x91')](),_0x7da46d);})[_0xd855('0x22')](function(_0x4febf4){_0x3a4fe6[_0xd855('0x1b')]=_0x4febf4['length'];if(_0x3a4fe6[_0xd855('0x1b')]===0x0)return[];return db[_0xd855('0x90')]['query'](_0x33e457[_0xd855('0x91')](),_0x7da46d)[_0xd855('0x22')](function(_0x343b0d){_0x1f878b=_[_0xd855('0x92')](_0x343b0d,'id');_0x7da46d=_['merge'](_0x7da46d,{'model':db[_0xd855('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x559515[_0xd855('0x37')][_0xd855('0x3b')]){_0x1698ea[_0xd855('0x3a')]['forEach'](function(_0x4b790d){_0x4d2b81[_0xd855('0x3f')]('i.'+_0x4b790d);});}else{_0x4d2b81[_0xd855('0x3f')](_0xd855('0x83'),_0xd855('0x5b'));_0x4d2b81[_0xd855('0x3f')](_0xd855('0x93'),_0xd855('0x94'));_0x4d2b81['field']('a.mandatoryDisposition',_0xd855('0x95'));_0x4d2b81['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',_0xd855('0x85'));_0x4d2b81[_0xd855('0x3f')]('i.*');_0x4d2b81[_0xd855('0x3f')](_0xd855('0x96'),'Contact.firstName');_0x4d2b81[_0xd855('0x3f')](_0xd855('0x97'),'Contact.lastName');_0x4d2b81['field'](_0xd855('0x98'),_0xd855('0x99'));_0x4d2b81[_0xd855('0x3f')](_0xd855('0x9a'),_0xd855('0x9b'));_0x4d2b81[_0xd855('0x3f')]('c.mobile',_0xd855('0x9c'));_0x4d2b81['field'](_0xd855('0x9d'),'Contact.fax');_0x4d2b81[_0xd855('0x3f')](_0xd855('0x9e'),_0xd855('0x9f'));_0x4d2b81['field'](_0xd855('0xa0'),'Owner.internal');_0x4d2b81[_0xd855('0x3f')](_0xd855('0xa1'),_0xd855('0x2a'));}if(_0x1698ea[_0xd855('0x1d')])_0x4d2b81[_0xd855('0x1d')](_0x1698ea[_0xd855('0x1d')]);if(_0x1698ea['offset'])_0x4d2b81[_0xd855('0x1c')](_0x1698ea['offset']);return db[_0xd855('0x90')][_0xd855('0x37')](_0x4d2b81[_0xd855('0x91')](),_0x7da46d);})[_0xd855('0x22')](function(_0x397bf7){_0x2b8edc[_0xd855('0x6f')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xd855('0x29')](_0x397bf7,'id'));return db['sequelize'][_0xd855('0x37')](_0x2b8edc[_0xd855('0x91')](),_0x7da46d)[_0xd855('0x22')](function(_0x56012e){var _0x4c956f=_[_0xd855('0xa2')](_0x56012e,_0xd855('0xa3'));var _0x50160f=[];_0x397bf7[_0xd855('0x2b')](function(_0x1de0ef){_0x50160f['push'](updateWhatsappInteraction(_0x1de0ef,_0x1f878b,_0x4c956f));});return BPromise[_0xd855('0xa4')](_0x50160f);});});})['then'](function(_0x17a13c){_0x3a4fe6['rows']=_0x17a13c;return _0x3a4fe6;})[_0xd855('0x22')](respondWithFilteredResult(_0x2e35ca,_0x1698ea))[_0xd855('0x2e')](handleError(_0x2e35ca,null));};exports['show']=function(_0x1f3ed0,_0xbf295d){var _0x58cda3={'raw':![],'where':{'id':_0x1f3ed0[_0xd855('0xa5')]['id']}},_0x495a40={};_0x495a40[_0xd855('0x35')]=_['keys'](db['WhatsappInteraction'][_0xd855('0x31')]);_0x495a40[_0xd855('0x37')]=_[_0xd855('0x36')](_0x1f3ed0[_0xd855('0x37')]);_0x495a40[_0xd855('0x38')]=_['intersection'](_0x495a40[_0xd855('0x35')],_0x495a40[_0xd855('0x37')]);_0x58cda3['attributes']=_['intersection'](_0x495a40[_0xd855('0x35')],qs[_0xd855('0x3b')](_0x1f3ed0[_0xd855('0x37')][_0xd855('0x3b')]));_0x58cda3['attributes']=_0x58cda3['attributes']['length']?_0x58cda3[_0xd855('0x3a')]:_0x495a40['model'];if(_0x1f3ed0[_0xd855('0x37')]['includeAll']){_0x58cda3[_0xd855('0xa6')]=[{'all':!![]}];}_0x58cda3=_[_0xd855('0xa7')]({},_0x58cda3,_0x1f3ed0[_0xd855('0xa8')]);return db['WhatsappInteraction'][_0xd855('0x5a')](_0x58cda3)[_0xd855('0x22')](handleEntityNotFound(_0xbf295d,null))[_0xd855('0x22')](respondWithResult(_0xbf295d,null))[_0xd855('0x2e')](handleError(_0xbf295d,null));};exports[_0xd855('0xa9')]=function(_0x259f02,_0x2bf37f){return db[_0xd855('0x30')][_0xd855('0xa9')](_0x259f02[_0xd855('0xaa')],{})['then'](respondWithResult(_0x2bf37f,0xc9))[_0xd855('0x2e')](handleError(_0x2bf37f,null));};exports['update']=function(_0x50e54e,_0x583194){if(_0x50e54e[_0xd855('0xaa')]['id']){delete _0x50e54e['body']['id'];}return db[_0xd855('0x30')][_0xd855('0x5a')]({'where':{'id':_0x50e54e[_0xd855('0xa5')]['id']}})['then'](handleEntityNotFound(_0x583194,null))['then'](saveUpdates(_0x50e54e['body'],null))[_0xd855('0x22')](respondWithResult(_0x583194,null))[_0xd855('0x2e')](handleError(_0x583194,null));};exports[_0xd855('0x23')]=function(_0x1704f6,_0x52c09c){return db['WhatsappInteraction'][_0xd855('0x5a')]({'where':{'id':_0x1704f6[_0xd855('0xa5')]['id']}})['then'](handleEntityNotFound(_0x52c09c,null))['then'](removeEntity(_0x52c09c,null))[_0xd855('0x2e')](handleError(_0x52c09c,null));};exports[_0xd855('0xab')]=function(_0xfe3323,_0xe63c97){return db[_0xd855('0x30')]['describe']()[_0xd855('0x22')](respondWithResult(_0xe63c97,null))['catch'](handleError(_0xe63c97,null));};exports['addMessage']=function(_0xb3576c,_0x52ec29,_0xd51b1c){return db[_0xd855('0xac')][_0xd855('0x5a')]({'where':{'id':_0xb3576c[_0xd855('0xa5')]['id']}})['then'](handleEntityNotFound(_0x52ec29,null))[_0xd855('0x22')](function(_0x5004f6){if(_0x5004f6){return _0x5004f6[_0xd855('0xad')](_0xb3576c[_0xd855('0xaa')][_0xd855('0xae')],_[_0xd855('0xaf')](_0xb3576c[_0xd855('0xaa')],[_0xd855('0xae'),'id'])||{});}})[_0xd855('0x22')](respondWithResult(_0x52ec29,null))['catch'](handleError(_0x52ec29,null));};exports['getMessages']=function(_0x173499,_0x9a2f48,_0x4cf087){var _0xc7c632={'raw':![],'where':{}};var _0x6da302={};var _0x12f4b3={'count':0x0,'rows':[]};return db[_0xd855('0x30')][_0xd855('0xb0')]({'where':{'id':_0x173499[_0xd855('0xa5')]['id']}})['then'](handleEntityNotFound(_0x9a2f48,null))[_0xd855('0x22')](function(_0x21d701){if(_0x21d701){_0x6da302[_0xd855('0x35')]=_['keys'](db[_0xd855('0xac')][_0xd855('0x31')]);_0x6da302[_0xd855('0x37')]=_[_0xd855('0x36')](_0x173499[_0xd855('0x37')]);_0x6da302['filters']=_[_0xd855('0x39')](_0x6da302[_0xd855('0x35')],_0x6da302[_0xd855('0x37')]);_0xc7c632[_0xd855('0x3a')]=_[_0xd855('0x39')](_0x6da302[_0xd855('0x35')],qs[_0xd855('0x3b')](_0x173499[_0xd855('0x37')]['fields']));_0xc7c632['attributes']=_0xc7c632[_0xd855('0x3a')]['length']?_0xc7c632[_0xd855('0x3a')]:_0x6da302['model'];if(!_0x173499[_0xd855('0x37')]['hasOwnProperty']('nolimit')){_0xc7c632[_0xd855('0x1d')]=qs['limit'](_0x173499[_0xd855('0x37')][_0xd855('0x1d')]);_0xc7c632[_0xd855('0x1c')]=qs[_0xd855('0x1c')](_0x173499[_0xd855('0x37')][_0xd855('0x1c')]);}_0xc7c632[_0xd855('0x84')]=qs[_0xd855('0xb1')](_0x173499['query'][_0xd855('0xb1')]);_0xc7c632[_0xd855('0x6f')]=qs[_0xd855('0x38')](_[_0xd855('0x3e')](_0x173499[_0xd855('0x37')],_0x6da302['filters']));_0xc7c632[_0xd855('0x6f')][_0xd855('0xa3')]=_0x21d701['id'];if(_0x173499[_0xd855('0x37')][_0xd855('0xb2')]){_0xc7c632[_0xd855('0x6f')]=_[_0xd855('0xa7')](_0xc7c632[_0xd855('0x6f')],{'$or':_[_0xd855('0x29')](_0xc7c632[_0xd855('0x3a')],function(_0x5ecee8){var _0x1f1a6e={};_0x1f1a6e[_0x5ecee8]={'$like':'%'+_0x173499[_0xd855('0x37')][_0xd855('0xb2')]+'%'};return _0x1f1a6e;})});}if(_0x173499[_0xd855('0x37')][_0xd855('0xb3')]){var _0xbd6ac6=_0x173499[_0xd855('0x37')][_0xd855('0xb3')][_0xd855('0x66')](',');var _0x2587b7={};_0x2587b7[_0xbd6ac6[0x0]]={'$gte':moment(_0xbd6ac6[0x1])[_0xd855('0xb4')](_0xd855('0xb5'))};_0xc7c632['where']=_[_0xd855('0xa7')](_0xc7c632[_0xd855('0x6f')],_0x2587b7);}_0xc7c632=_['merge']({},_0xc7c632,_0x173499[_0xd855('0xa8')]);return db[_0xd855('0xac')]['count']({'where':_0xc7c632['where']})['then'](function(_0x55c537){_0x12f4b3['count']=_0x55c537;if(_0x173499['query']['includeAll']){_0xc7c632['include']=[{'all':!![]}];}return db[_0xd855('0xac')][_0xd855('0xb6')](_0xc7c632);})['then'](function(_0x11d64c){_0x12f4b3['rows']=_0x11d64c;return _0x12f4b3;});}})['then'](respondWithFilteredResult(_0x9a2f48,_0xc7c632))['catch'](handleError(_0x9a2f48,null));};exports['addTags']=function(_0x775f08,_0xbdacb5,_0x32d128){return db['WhatsappInteraction'][_0xd855('0x5a')]({'where':{'id':_0x775f08[_0xd855('0xa5')]['id']}})['then'](handleEntityNotFound(_0xbdacb5,null))[_0xd855('0x22')](function(_0x9d1b2a){if(_0x9d1b2a){return _0x9d1b2a[_0xd855('0xb7')](_0x775f08[_0xd855('0xaa')][_0xd855('0xae')],_[_0xd855('0xaf')](_0x775f08[_0xd855('0xaa')],[_0xd855('0xae'),'id'])||{})[_0xd855('0xb8')](function(){return db['Tag'][_0xd855('0xb6')]({'attributes':['id',_0xd855('0x26'),_0xd855('0x40')],'where':{'id':_0x775f08['body'][_0xd855('0xae')]}});})[_0xd855('0x22')](function(_0x5c47a2){socket[_0xd855('0xb9')]('whatsappInteractionTags:save',{'id':Number(_0x775f08[_0xd855('0xa5')]['id']),'tags':_0x5c47a2||[]});return{'id':Number(_0x775f08[_0xd855('0xa5')]['id']),'tags':_0x5c47a2||[]};});}})[_0xd855('0x22')](respondWithResult(_0xbdacb5,null))[_0xd855('0x2e')](handleError(_0xbdacb5,null));};exports[_0xd855('0xba')]=function(_0x23f604,_0x51ce26,_0x42c104){return db['WhatsappInteraction'][_0xd855('0x5a')]({'where':{'id':_0x23f604[_0xd855('0xa5')]['id']}})[_0xd855('0x22')](handleEntityNotFound(_0x51ce26,null))[_0xd855('0x22')](function(_0x2185d3){if(_0x2185d3){return _0x2185d3[_0xd855('0xba')](_0x23f604['query']['ids']);}})[_0xd855('0x22')](respondWithStatusCode(_0x51ce26,null))['catch'](handleError(_0x51ce26,null));};exports[_0xd855('0xbb')]=function(_0x5763ac,_0x576cb3){var _0x233b42=moment()[_0xd855('0xbc')]()['toString']();var _0x5038bd=path['join'](config[_0xd855('0xbd')],_0xd855('0xbe'),_0xd855('0xbf'),_0xd855('0xc0'));var _0x4c8943=path['join'](config[_0xd855('0xbd')],_0xd855('0xbe'),_0xd855('0xbf'),_0xd855('0xc1'));var _0x297ce1=path[_0xd855('0xc2')](_0x5038bd,_0x233b42);var _0x3fee32=util[_0xd855('0xb4')](_0xd855('0xc3'),_0x5763ac[_0xd855('0xa5')]['id'],_0x233b42);var _0x2adb92=path[_0xd855('0xc2')](_0x5038bd,_0x3fee32);var _0xce4d0b=[];_0xce4d0b[_0xd855('0x2d')]({'model':db[_0xd855('0x68')],'as':_0xd855('0x68'),'attributes':['id',_0xd855('0xc4')],'raw':!![]});_0xce4d0b[_0xd855('0x2d')]({'model':db[_0xd855('0xc5')],'as':_0xd855('0xc6'),'attributes':['id',_0xd855('0xc7'),'lastName'],'raw':!![]});if(_0x5763ac['query'][_0xd855('0xc1')]){_0xce4d0b['push']({'model':db[_0xd855('0xc8')],'as':_0xd855('0xc8'),'raw':!![]});}var _0x4bc782=[{'model':db[_0xd855('0xac')],'as':_0xd855('0xc9'),'attributes':['id',_0xd855('0xaa'),_0xd855('0xca'),_0xd855('0xcb'),_0xd855('0xcc'),'read'],'include':_0xce4d0b}];_0x4bc782[_0xd855('0x2d')]({'model':db[_0xd855('0xcd')],'as':_0xd855('0xce'),'attributes':['id',_0xd855('0x26')]});_0x4bc782[_0xd855('0x2d')]({'model':db[_0xd855('0x68')],'as':_0xd855('0xcf'),'attributes':['id',_0xd855('0xc4')]});return db['WhatsappInteraction'][_0xd855('0x5a')]({'where':{'id':_0x5763ac[_0xd855('0xa5')]['id']},'include':_0x4bc782})[_0xd855('0x22')](handleEntityNotFound(_0x576cb3,null))['then'](function(_0x394597){if(_0x394597){var _0x57004d=_0x394597[_0xd855('0xd0')]({'plain':!![]});fs[_0xd855('0xd1')](_0x297ce1);var _0x2baed4={'format':'A4','border':_0xd855('0xd2'),'header':{'height':_0xd855('0xd3'),'contents':{'first':_0xd855('0xd4')}},'footer':{'height':_0xd855('0xd5'),'contents':{'default':util[_0xd855('0xb4')](_0xd855('0xd6'),util['format']('%s\x20#%d','Whatsapp',_0x57004d['id']),moment()[_0xd855('0xb4')](_0xd855('0xd7'))[_0xd855('0x91')]())}}};var _0x3737c6={'channel':_0xd855('0xd8'),'account':_0x57004d['Account'][_0xd855('0x26')],'agent':_0x57004d['Owner']?_0x57004d[_0xd855('0xcf')]['fullname']:_0xd855('0xd9'),'createdAt':moment(_0x57004d['createdAt'])[_0xd855('0xb4')](_0xd855('0xb5'))['toString'](),'closedAt':_0x57004d[_0xd855('0xda')]?moment(_0x57004d[_0xd855('0xdb')])['format'](_0xd855('0xb5'))['toString']():'','disposition':_0x57004d[_0xd855('0xdc')],'messages':_(_0x57004d['Messages'])['filter']({'secret':![]})[_0xd855('0x29')](function(_0x199b7d){if(_0x199b7d['Attachment']){var _0x2988e8=path[_0xd855('0xc2')](_0x4c8943,_0x199b7d['Attachment'][_0xd855('0xdd')]);if(fs[_0xd855('0xde')](_0x2988e8)){fs[_0xd855('0xdf')](_0x2988e8)[_0xd855('0xe0')](fs[_0xd855('0xe1')](path['join'](_0x297ce1,_0x199b7d[_0xd855('0xc8')][_0xd855('0xdd')])));}}return{'date':moment(_0x199b7d[_0xd855('0xca')])[_0xd855('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x199b7d[_0xd855('0xcb')]===_0xd855('0xe2')?_0x199b7d['User']?_0x199b7d['User']['fullname']:_0xd855('0xe3'):_0x199b7d[_0xd855('0xc6')][_0xd855('0xc7')]+(_0x199b7d['Contact'][_0xd855('0xe4')]?'\x20'+_0x199b7d[_0xd855('0xc6')][_0xd855('0xe4')]:''),'body':_0x199b7d[_0xd855('0xc8')]?_0x199b7d[_0xd855('0xc8')][_0xd855('0xdd')]:_0x199b7d[_0xd855('0xaa')],'direction':_0x199b7d['direction']==='out'?'A':'C','secret':_0x199b7d[_0xd855('0xcc')],'read':_0x199b7d[_0xd855('0x76')],'attachment':_0x199b7d[_0xd855('0xc8')]};})[_0xd855('0x61')]()};return ejs[_0xd855('0xe5')](path[_0xd855('0xc2')](config[_0xd855('0xbd')],_0xd855('0xbe'),_0xd855('0xe6'),'downloadInteraction.html'),{'interaction':_0x3737c6})['then'](function(_0x88016f){return new BPromise(function(_0x1378cb,_0xaf3485){pdf[_0xd855('0xa9')](_0x88016f,_0x2baed4)[_0xd855('0xe7')](path[_0xd855('0xc2')](_0x297ce1,'transcript-'+_0x57004d['id']+'-'+_0x233b42+'.pdf'),function(_0x1118ae,_0x568d6d){if(_0x1118ae)return _0xaf3485(_0x1118ae);_0x1378cb(_0x568d6d);});});})[_0xd855('0x22')](function(){return new BPromise(function(_0x4b384a,_0x3d23dc){zipdir(_0x297ce1,{'saveTo':_0x2adb92},function(_0x50c369,_0x27ea8e){if(_0x50c369)return _0x3d23dc(_0x50c369);return _0x4b384a(_0x27ea8e);});})[_0xd855('0x22')](function(){return new BPromise(function(_0x551a04,_0x2954e8){rimraf(_0x297ce1,function(_0x15e338){if(_0x15e338)_0x2954e8(_0x15e338);return _0x551a04();});});})[_0xd855('0x22')](function(){return _0x576cb3[_0xd855('0xbb')](_0x2adb92,_0x3fee32,function(_0x25a9ef){if(_0x25a9ef){console[_0xd855('0xe8')](_0xd855('0xe9'),_0x25a9ef);}else{fs[_0xd855('0xea')](_0x2adb92);}});});});}else{return _0x576cb3[_0xd855('0x24')](0xc8);}})['catch'](handleError(_0x576cb3,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 84e8ba5..7dfb98b 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 _0x8600=['length','emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x38c6a5,_0x3e31fb){var _0x2a841e=function(_0x24bd13){while(--_0x24bd13){_0x38c6a5['push'](_0x38c6a5['shift']());}};_0x2a841e(++_0x3e31fb);}(_0x8600,0xc3));var _0x0860=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0x8600[_0x595604];return _0x1466f3;};'use strict';var EventEmitter=require(_0x0860('0x0'));var WhatsappInteraction=require(_0x0860('0x1'))['db'][_0x0860('0x2')];var WhatsappMessage=require(_0x0860('0x1'))['db'][_0x0860('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0860('0x4')](0x0);var events={'afterCreate':_0x0860('0x5'),'afterUpdate':_0x0860('0x6'),'afterDestroy':_0x0860('0x7')};function emitEvent(_0x10a42e){return function(_0x54bf31,_0x529da6,_0x1d4f43){_0x54bf31[_0x0860('0x8')]({'attributes':['id'],'raw':!![]})[_0x0860('0x9')](function(_0x208047){_0x54bf31[_0x0860('0xa')](_0x0860('0xb'),_0x208047[_0x0860('0xc')](function(_0x428c78){return{'id':_0x428c78['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x54bf31['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0860('0x9')](function(_0x729dc3){_0x54bf31[_0x0860('0xa')](_0x0860('0xd'),_0x729dc3[_0x0860('0xe')]);WhatsappInteractionEvents['emit'](_0x10a42e+':'+_0x54bf31['id'],_0x54bf31);WhatsappInteractionEvents[_0x0860('0xf')](_0x10a42e,_0x54bf31);_0x1d4f43(null);})[_0x0860('0x10')](_0x1d4f43(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x0860('0x11')](e,emitEvent(event));}}module[_0x0860('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x280a=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x923991,_0x481465){var _0x191cfc=function(_0x6412e1){while(--_0x6412e1){_0x923991['push'](_0x923991['shift']());}};_0x191cfc(++_0x481465);}(_0x280a,0x199));var _0xa280=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x280a[_0x176317];return _0xef2759;};'use strict';var EventEmitter=require(_0xa280('0x0'));var WhatsappInteraction=require(_0xa280('0x1'))['db'][_0xa280('0x2')];var WhatsappMessage=require(_0xa280('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa280('0x3')](0x0);var events={'afterCreate':_0xa280('0x4'),'afterUpdate':_0xa280('0x5'),'afterDestroy':_0xa280('0x6')};function emitEvent(_0x309236){return function(_0x4b9bce,_0x485003,_0x1168e8){_0x4b9bce[_0xa280('0x7')]({'attributes':['id'],'raw':!![]})[_0xa280('0x8')](function(_0x56260b){_0x4b9bce[_0xa280('0x9')](_0xa280('0xa'),_0x56260b[_0xa280('0xb')](function(_0x577b36){return{'id':_0x577b36['id']};}));return WhatsappMessage[_0xa280('0xc')]({'where':{'WhatsappInteractionId':_0x4b9bce['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa280('0x8')](function(_0x4e44f5){_0x4b9bce[_0xa280('0x9')](_0xa280('0xd'),_0x4e44f5['length']);WhatsappInteractionEvents[_0xa280('0xe')](_0x309236+':'+_0x4b9bce['id'],_0x4b9bce);WhatsappInteractionEvents[_0xa280('0xe')](_0x309236,_0x4b9bce);_0x1168e8(null);})[_0xa280('0xf')](_0x1168e8(null));};}for(var e in events){if(events[_0xa280('0x10')](e)){var event=events[e];WhatsappInteraction[_0xa280('0x11')](e,emitEvent(event));}}module[_0xa280('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index cdf5298..ed21372 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 _0xedb4=['changed','closed','closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','whatsapp_interactions'];(function(_0x5ba4be,_0x1810be){var _0x2e6862=function(_0x9d1bbd){while(--_0x9d1bbd){_0x5ba4be['push'](_0x5ba4be['shift']());}};_0x2e6862(++_0x1810be);}(_0xedb4,0x1c3));var _0x4edb=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xedb4[_0x4c2dfc];return _0xfd728d;};'use strict';var _=require(_0x4edb('0x0'));var util=require('util');var logger=require(_0x4edb('0x1'))(_0x4edb('0x2'));var moment=require(_0x4edb('0x3'));var BPromise=require(_0x4edb('0x4'));var rp=require(_0x4edb('0x5'));var fs=require('fs');var path=require(_0x4edb('0x6'));var rimraf=require(_0x4edb('0x7'));var config=require(_0x4edb('0x8'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x7dd1b4,_0x265fea){return _0x7dd1b4[_0x4edb('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x4edb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bfcdf,_0x4016fe,_0x46f9e0){if(_0x4bfcdf[_0x4edb('0xb')](_0x4edb('0xc'))){_0x4bfcdf[_0x4edb('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x46f9e0(null,_0x4bfcdf);}}});}; \ No newline at end of file +var _0xc8f7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x511004,_0x81d70b){var _0x2d37d2=function(_0x1df300){while(--_0x1df300){_0x511004['push'](_0x511004['shift']());}};_0x2d37d2(++_0x81d70b);}(_0xc8f7,0x9e));var _0x7c8f=function(_0x45a4d6,_0x530fd7){_0x45a4d6=_0x45a4d6-0x0;var _0x32737c=_0xc8f7[_0x45a4d6];return _0x32737c;};'use strict';var _=require(_0x7c8f('0x0'));var util=require('util');var logger=require(_0x7c8f('0x1'))(_0x7c8f('0x2'));var moment=require(_0x7c8f('0x3'));var BPromise=require(_0x7c8f('0x4'));var rp=require(_0x7c8f('0x5'));var fs=require('fs');var path=require(_0x7c8f('0x6'));var rimraf=require(_0x7c8f('0x7'));var config=require(_0x7c8f('0x8'));var attributes=require(_0x7c8f('0x9'));module['exports']=function(_0x4c3ae6,_0x241aa0){return _0x4c3ae6[_0x7c8f('0xa')](_0x7c8f('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f0e0f,_0x1a27f2,_0x330591){if(_0x5f0e0f[_0x7c8f('0xc')]('closed')){_0x5f0e0f[_0x7c8f('0xd')]=moment()[_0x7c8f('0xe')](_0x7c8f('0xf'));}_0x330591(null,_0x5f0e0f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 37d8876..d736640 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 _0x40a3=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','limit','debug','AddTagsToWhatsappInteraction','find','where','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x40a3,0x1c3));var _0x340a=function(_0x3803dc,_0xd6fee0){_0x3803dc=_0x3803dc-0x0;var _0x1eb3e0=_0x40a3[_0x3803dc];return _0x1eb3e0;};'use strict';var _=require(_0x340a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x340a('0x1'));var rs=require(_0x340a('0x2'));var fs=require('fs');var Redis=require(_0x340a('0x3'));var db=require(_0x340a('0x4'))['db'];var utils=require(_0x340a('0x5'));var logger=require(_0x340a('0x6'))('rpc');var config=require(_0x340a('0x7'));var jayson=require(_0x340a('0x8'));var client=jayson[_0x340a('0x9')][_0x340a('0xa')]({'port':0x232a});config[_0x340a('0xb')]=_[_0x340a('0xc')](config[_0x340a('0xb')],{'host':_0x340a('0xd'),'port':0x18eb});var socket=require(_0x340a('0xe'))(new Redis(config[_0x340a('0xb')]));require('./whatsappInteraction.socket')[_0x340a('0xf')](socket);function respondWithRpcPromise(_0x40804f,_0x5c2abd,_0x59817f){return new BPromise(function(_0x2cc3cc,_0x257fce){return client[_0x340a('0x10')](_0x40804f,_0x59817f)[_0x340a('0x11')](function(_0x59b182){logger[_0x340a('0x12')](_0x340a('0x13'),_0x5c2abd,_0x340a('0x14'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5c2abd,'request\x20sent',JSON[_0x340a('0x15')](_0x59b182));if(_0x59b182['error']){if(_0x59b182[_0x340a('0x16')][_0x340a('0x17')]===0x1f4){logger[_0x340a('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x5c2abd,_0x59b182[_0x340a('0x16')][_0x340a('0x18')]);return _0x257fce(_0x59b182[_0x340a('0x16')][_0x340a('0x18')]);}logger[_0x340a('0x16')](_0x340a('0x13'),_0x5c2abd,_0x59b182[_0x340a('0x16')]['message']);return _0x2cc3cc(_0x59b182[_0x340a('0x16')]['message']);}else{logger[_0x340a('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5c2abd,_0x340a('0x14'));_0x2cc3cc(_0x59b182[_0x340a('0x19')][_0x340a('0x18')]);}})[_0x340a('0x1a')](function(_0x30fe77){logger['error'](_0x340a('0x13'),_0x5c2abd,_0x30fe77);_0x257fce(_0x30fe77);});});}exports[_0x340a('0x1b')]=function(_0x574b11){var _0x5df964=this;return new Promise(function(_0x5d6433,_0x2df38f){return db[_0x340a('0x1c')][_0x340a('0x1d')](_0x574b11[_0x340a('0x1e')],{'raw':_0x574b11[_0x340a('0x1f')]?_0x574b11[_0x340a('0x1f')][_0x340a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x574b11[_0x340a('0x1f')]?_0x574b11['options']['where']||null:null,'attributes':_0x574b11[_0x340a('0x1f')]?_0x574b11['options']['attributes']||null:null,'limit':_0x574b11[_0x340a('0x1f')]?_0x574b11[_0x340a('0x1f')][_0x340a('0x21')]||null:null})[_0x340a('0x11')](function(_0x370c25){logger['info'](_0x340a('0x1b'),_0x574b11);logger[_0x340a('0x22')]('UpdateWhatsappInteraction',_0x574b11,JSON['stringify'](_0x370c25));_0x5d6433(_0x370c25);})['catch'](function(_0x66cab4){logger[_0x340a('0x16')](_0x340a('0x1b'),_0x66cab4[_0x340a('0x18')],_0x574b11);_0x2df38f(_0x5df964[_0x340a('0x16')](0x1f4,_0x66cab4[_0x340a('0x18')]));});});};exports[_0x340a('0x23')]=function(_0x1f9716){return new Promise(function(_0xc54979,_0x366691){return db[_0x340a('0x1c')][_0x340a('0x24')]({'where':_0x1f9716[_0x340a('0x1f')]?_0x1f9716['options'][_0x340a('0x25')]||null:null})[_0x340a('0x11')](function(_0x5f6d66){if(_0x5f6d66){return _0x5f6d66['addTags'](_0x1f9716[_0x340a('0x1e')][_0x340a('0x26')],_[_0x340a('0x27')](_0x1f9716['body'],[_0x340a('0x26'),'id'])||{});}})[_0x340a('0x28')](function(_0xce036b){logger[_0x340a('0x12')]('AddTags',_0x1f9716);logger[_0x340a('0x22')](_0x340a('0x29'),_0x1f9716,JSON[_0x340a('0x15')](_0xce036b));_0xc54979(_0xce036b);})[_0x340a('0x1a')](function(_0x378ab7){logger[_0x340a('0x16')](_0x340a('0x29'),_0x378ab7[_0x340a('0x18')],_0x1f9716);_0x366691(_this[_0x340a('0x16')](0x1f4,_0x378ab7[_0x340a('0x18')]));});});}; \ No newline at end of file +var _0xde78=['stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','info','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','attributes','limit','catch','AddTagsToWhatsappInteraction','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x104639,_0x58124d){var _0x5c5b0b=function(_0x44b70a){while(--_0x44b70a){_0x104639['push'](_0x104639['shift']());}};_0x5c5b0b(++_0x58124d);}(_0xde78,0x8e));var _0x8de7=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0xde78[_0x308374];return _0x1f71e0;};'use strict';var _=require(_0x8de7('0x0'));var util=require(_0x8de7('0x1'));var moment=require('moment');var BPromise=require(_0x8de7('0x2'));var rs=require(_0x8de7('0x3'));var fs=require('fs');var Redis=require(_0x8de7('0x4'));var db=require(_0x8de7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8de7('0x6'))(_0x8de7('0x7'));var config=require(_0x8de7('0x8'));var jayson=require(_0x8de7('0x9'));var client=jayson[_0x8de7('0xa')][_0x8de7('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8de7('0xc')],{'host':_0x8de7('0xd'),'port':0x18eb});var socket=require(_0x8de7('0xe'))(new Redis(config[_0x8de7('0xc')]));require(_0x8de7('0xf'))[_0x8de7('0x10')](socket);function respondWithRpcPromise(_0x4d7dff,_0x32e7fe,_0x23637e){return new BPromise(function(_0x137b05,_0x5e86fd){return client[_0x8de7('0x11')](_0x4d7dff,_0x23637e)[_0x8de7('0x12')](function(_0x23c610){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x32e7fe,_0x8de7('0x13'));logger[_0x8de7('0x14')](_0x8de7('0x15'),_0x32e7fe,_0x8de7('0x13'),JSON[_0x8de7('0x16')](_0x23c610));if(_0x23c610[_0x8de7('0x17')]){if(_0x23c610[_0x8de7('0x17')]['code']===0x1f4){logger['error'](_0x8de7('0x18'),_0x32e7fe,_0x23c610[_0x8de7('0x17')][_0x8de7('0x19')]);return _0x5e86fd(_0x23c610[_0x8de7('0x17')][_0x8de7('0x19')]);}logger[_0x8de7('0x17')](_0x8de7('0x18'),_0x32e7fe,_0x23c610[_0x8de7('0x17')][_0x8de7('0x19')]);return _0x137b05(_0x23c610[_0x8de7('0x17')]['message']);}else{logger[_0x8de7('0x1a')](_0x8de7('0x18'),_0x32e7fe,_0x8de7('0x13'));_0x137b05(_0x23c610[_0x8de7('0x1b')][_0x8de7('0x19')]);}})['catch'](function(_0x5da280){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x32e7fe,_0x5da280);_0x5e86fd(_0x5da280);});});}exports[_0x8de7('0x1c')]=function(_0x908d73){var _0x4ddead=this;return new Promise(function(_0x5348cf,_0x2189d4){return db[_0x8de7('0x1d')]['update'](_0x908d73[_0x8de7('0x1e')],{'raw':_0x908d73[_0x8de7('0x1f')]?_0x908d73[_0x8de7('0x1f')][_0x8de7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x908d73[_0x8de7('0x1f')]?_0x908d73[_0x8de7('0x1f')]['where']||null:null,'attributes':_0x908d73[_0x8de7('0x1f')]?_0x908d73[_0x8de7('0x1f')][_0x8de7('0x21')]||null:null,'limit':_0x908d73[_0x8de7('0x1f')]?_0x908d73['options'][_0x8de7('0x22')]||null:null})[_0x8de7('0x12')](function(_0x3f73a0){logger[_0x8de7('0x1a')](_0x8de7('0x1c'),_0x908d73);logger[_0x8de7('0x14')](_0x8de7('0x1c'),_0x908d73,JSON[_0x8de7('0x16')](_0x3f73a0));_0x5348cf(_0x3f73a0);})[_0x8de7('0x23')](function(_0x30c6d3){logger['error'](_0x8de7('0x1c'),_0x30c6d3[_0x8de7('0x19')],_0x908d73);_0x2189d4(_0x4ddead[_0x8de7('0x17')](0x1f4,_0x30c6d3[_0x8de7('0x19')]));});});};exports[_0x8de7('0x24')]=function(_0x2827cd){return new Promise(function(_0x24fc43,_0x416ecd){return db[_0x8de7('0x1d')]['find']({'where':_0x2827cd['options']?_0x2827cd[_0x8de7('0x1f')]['where']||null:null})['then'](function(_0x59553f){if(_0x59553f){return _0x59553f[_0x8de7('0x25')](_0x2827cd[_0x8de7('0x1e')][_0x8de7('0x26')],_[_0x8de7('0x27')](_0x2827cd[_0x8de7('0x1e')],[_0x8de7('0x26'),'id'])||{});}})['spread'](function(_0x5b3dad){logger[_0x8de7('0x1a')](_0x8de7('0x28'),_0x2827cd);logger[_0x8de7('0x14')]('AddTags',_0x2827cd,JSON[_0x8de7('0x16')](_0x5b3dad));_0x24fc43(_0x5b3dad);})['catch'](function(_0x8e35cc){logger[_0x8de7('0x17')](_0x8de7('0x28'),_0x8e35cc[_0x8de7('0x19')],_0x2827cd);_0x416ecd(_this[_0x8de7('0x17')](0x1f4,_0x8e35cc[_0x8de7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a4c3322..ea5e18c 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 _0x37de=['length','./whatsappInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x37de,0x1c9));var _0xe37d=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x37de[_0x2b31a8];return _0x1175a5;};'use strict';var WhatsappInteractionEvents=require(_0xe37d('0x0'));var events=[_0xe37d('0x1'),_0xe37d('0x2'),_0xe37d('0x3')];function createListener(_0x2a6e4c,_0x1a61ac){return function(_0x203a9c){_0x1a61ac[_0xe37d('0x4')](_0x2a6e4c,_0x203a9c);};}function removeListener(_0xc0f355,_0x20f07f){return function(){WhatsappInteractionEvents[_0xe37d('0x5')](_0xc0f355,_0x20f07f);};}exports[_0xe37d('0x6')]=function(_0x11989e){for(var _0x403a7f=0x0,_0x5549d4=events[_0xe37d('0x7')];_0x403a7f<_0x5549d4;_0x403a7f++){var _0x323f4b=events[_0x403a7f];var _0x28a255=createListener('whatsappInteraction:'+_0x323f4b,_0x11989e);WhatsappInteractionEvents['on'](_0x323f4b,_0x28a255);}}; \ No newline at end of file +var _0x94af=['whatsappInteraction:','./whatsappInteraction.events','remove','removeListener','length'];(function(_0x3e067a,_0x3b6173){var _0xf3cc1b=function(_0x262a4d){while(--_0x262a4d){_0x3e067a['push'](_0x3e067a['shift']());}};_0xf3cc1b(++_0x3b6173);}(_0x94af,0x1d7));var _0xf94a=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x94af[_0x3c4737];return _0x2bb926;};'use strict';var WhatsappInteractionEvents=require(_0xf94a('0x0'));var events=['save',_0xf94a('0x1'),'update'];function createListener(_0x2d1c3e,_0x24fe4f){return function(_0x14cd15){_0x24fe4f['emit'](_0x2d1c3e,_0x14cd15);};}function removeListener(_0x472527,_0x48406a){return function(){WhatsappInteractionEvents[_0xf94a('0x2')](_0x472527,_0x48406a);};}exports['register']=function(_0x57d4a5){for(var _0x2b85ab=0x0,_0x5d5ffc=events[_0xf94a('0x3')];_0x2b85ab<_0x5d5ffc;_0x2b85ab++){var _0x55680a=events[_0x2b85ab];var _0x524da1=createListener(_0xf94a('0x4')+_0x55680a,_0x57d4a5);WhatsappInteractionEvents['on'](_0x55680a,_0x524da1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 7f5d0af..415c89d 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 _0x9be7=['/describe','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3d6bd3,_0x1ea55d){var _0x106abe=function(_0x125f4d){while(--_0x125f4d){_0x3d6bd3['push'](_0x3d6bd3['shift']());}};_0x106abe(++_0x1ea55d);}(_0x9be7,0x12b));var _0x79be=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x9be7[_0x86b219];return _0x1f320c;};'use strict';var multer=require(_0x79be('0x0'));var util=require(_0x79be('0x1'));var path=require(_0x79be('0x2'));var timeout=require(_0x79be('0x3'));var express=require(_0x79be('0x4'));var router=express[_0x79be('0x5')]();var auth=require(_0x79be('0x6'));var interaction=require(_0x79be('0x7'));var config=require(_0x79be('0x8'));var controller=require('./whatsappMessage.controller');router[_0x79be('0x9')]('/',auth['isAuthenticated'](),controller[_0x79be('0xa')]);router[_0x79be('0x9')](_0x79be('0xb'),auth[_0x79be('0xc')](),controller[_0x79be('0xd')]);router[_0x79be('0x9')](_0x79be('0xe'),auth[_0x79be('0xc')](),controller[_0x79be('0xf')]);router['post']('/',auth[_0x79be('0xc')](),interaction[_0x79be('0x10')](_0x79be('0x11'),_0x79be('0x12')),controller[_0x79be('0x13')]);router[_0x79be('0x14')](_0x79be('0x15'),controller[_0x79be('0x16')]);router['put'](_0x79be('0xe'),auth[_0x79be('0xc')](),controller[_0x79be('0x17')]);router[_0x79be('0x18')](_0x79be('0x19'),auth[_0x79be('0xc')](),controller[_0x79be('0x1a')]);router[_0x79be('0x18')](_0x79be('0x1b'),auth[_0x79be('0xc')](),controller['reject']);router[_0x79be('0x1c')](_0x79be('0xe'),auth[_0x79be('0xc')](),controller[_0x79be('0x1d')]);module[_0x79be('0x1e')]=router; \ No newline at end of file +var _0x76ec=['../../config/environment','isAuthenticated','index','get','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3c7748,_0x1d83b7){var _0x37d7f0=function(_0x4c433c){while(--_0x4c433c){_0x3c7748['push'](_0x3c7748['shift']());}};_0x37d7f0(++_0x1d83b7);}(_0x76ec,0x1a3));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc76e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc76e('0x1'));var express=require(_0xc76e('0x2'));var router=express[_0xc76e('0x3')]();var auth=require(_0xc76e('0x4'));var interaction=require(_0xc76e('0x5'));var config=require(_0xc76e('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xc76e('0x7')](),controller[_0xc76e('0x8')]);router[_0xc76e('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc76e('0x9')](_0xc76e('0xa'),auth[_0xc76e('0x7')](),controller[_0xc76e('0xb')]);router[_0xc76e('0xc')]('/',auth[_0xc76e('0x7')](),interaction[_0xc76e('0xd')](_0xc76e('0xe'),_0xc76e('0xf')),controller[_0xc76e('0x10')]);router[_0xc76e('0xc')](_0xc76e('0x11'),controller['status']);router['put'](_0xc76e('0xa'),auth[_0xc76e('0x7')](),controller['update']);router[_0xc76e('0x12')](_0xc76e('0x13'),auth[_0xc76e('0x7')](),controller[_0xc76e('0x14')]);router[_0xc76e('0x12')](_0xc76e('0x15'),auth[_0xc76e('0x7')](),controller[_0xc76e('0x16')]);router[_0xc76e('0x17')](_0xc76e('0xa'),auth[_0xc76e('0x7')](),controller['destroy']);module[_0xc76e('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6e1a67f..2ef5587 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 _0xd84d=['DATE','sequelize','exports','TEXT','medium','out','STRING'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0xd84d,0x1eb));var _0xdd84=function(_0x24c9f6,_0x471429){_0x24c9f6=_0x24c9f6-0x0;var _0x1495f0=_0xd84d[_0x24c9f6];return _0x1495f0;};'use strict';var Sequelize=require(_0xdd84('0x0'));module[_0xdd84('0x1')]={'body':{'type':Sequelize[_0xdd84('0x2')](_0xdd84('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdd84('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdd84('0x5')](0xbe)},'phone':{'type':Sequelize[_0xdd84('0x5')]},'readAt':{'type':Sequelize[_0xdd84('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9237=['exports','medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x9237,0x128));var _0x7923=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0x9237[_0xd8a8af];return _0x5b7278;};'use strict';var Sequelize=require('sequelize');module[_0x7923('0x0')]={'body':{'type':Sequelize['TEXT'](_0x7923('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7923('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7923('0x3')]('in',_0x7923('0x4')),'defaultValue':_0x7923('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7923('0x5')](0xbe)},'phone':{'type':Sequelize[_0x7923('0x5')]},'readAt':{'type':Sequelize[_0x7923('0x6')]},'secret':{'type':Sequelize[_0x7923('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7923('0x5')]},'providerResponse':{'type':Sequelize[_0x7923('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index f68d467..a03a8a0 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 _0x0b0e=['UserId','user','Contact','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','channel','event','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','request\x20sent','sendStatus','status','end','json','count','offset','limit','apply','save','update','destroy','then','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','rawAttributes','create','body','find','params','describe','../../config/logger','whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x0b0e[_0x469a3c];return _0x968f4;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];config[_0xe0b0('0x18')]=_[_0xe0b0('0x19')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0x18')]));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);var jayson=require(_0xe0b0('0x1d'));var client=jayson[_0xe0b0('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xe0b0('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35cb40,_0xadee6e,_0x519ae8,_0x11fdca){return new BPromise(function(_0x4a4cc0,_0x2d6fb6){var _0x100204=_0x11fdca||client;return _0x100204['request'](_0x35cb40,_0x519ae8)['then'](function(_0x46bb44){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xadee6e,'request\x20sent');logger[_0xe0b0('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xadee6e,'request\x20sent',JSON[_0xe0b0('0x20')](_0x46bb44));if(_0x46bb44['error']){if(_0x46bb44[_0xe0b0('0x21')]['code']===0x1f4){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xadee6e,_0x46bb44[_0xe0b0('0x21')][_0xe0b0('0x23')]);return _0x2d6fb6(_0x46bb44[_0xe0b0('0x21')]['message']);}logger['error'](_0xe0b0('0x22'),_0xadee6e,_0x46bb44['error'][_0xe0b0('0x23')]);return _0x4a4cc0(_0x46bb44[_0xe0b0('0x21')]['message']);}else{logger[_0xe0b0('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0xadee6e,_0xe0b0('0x25'));_0x4a4cc0(_0x46bb44['result'][_0xe0b0('0x23')]);}})['catch'](function(_0x3e5c88){logger['error'](_0xe0b0('0x22'),_0xadee6e,_0x3e5c88);_0x2d6fb6(_0x3e5c88);});});}function respondWithStatusCode(_0x4aafbe,_0x3c221d){_0x3c221d=_0x3c221d||0xcc;return function(_0x5c5317){if(_0x5c5317){return _0x4aafbe[_0xe0b0('0x26')](_0x3c221d);}return _0x4aafbe[_0xe0b0('0x27')](_0x3c221d)[_0xe0b0('0x28')]();};}function respondWithResult(_0x1d91ad,_0x3ec2){_0x3ec2=_0x3ec2||0xc8;return function(_0x10745d){if(_0x10745d){return _0x1d91ad['status'](_0x3ec2)[_0xe0b0('0x29')](_0x10745d);}};}function respondWithFilteredResult(_0x1b8aa8,_0x5b7a64){return function(_0x15e13b){if(_0x15e13b){var _0x419b1f=_0x15e13b[_0xe0b0('0x2a')],_0x36d137=_0x5b7a64[_0xe0b0('0x2b')],_0x1d5759=_0x5b7a64['offset']+_0x5b7a64[_0xe0b0('0x2c')],_0x3cdbd5;if(_0x1d5759>=_0x419b1f){_0x1d5759=_0x419b1f;_0x3cdbd5=0xc8;}else{_0x3cdbd5=0xce;}_0x1b8aa8[_0xe0b0('0x27')](_0x3cdbd5);return _0x1b8aa8['set']('Content-Range',_0x36d137+'-'+_0x1d5759+'/'+_0x419b1f)[_0xe0b0('0x29')](_0x15e13b);}return null;};}function patchUpdates(_0x33e672){return function(_0x422575){try{jsonpatch[_0xe0b0('0x2d')](_0x422575,_0x33e672,!![]);}catch(_0x2ab1b1){return BPromise['reject'](_0x2ab1b1);}return _0x422575[_0xe0b0('0x2e')]();};}function saveUpdates(_0x3231fc,_0x7867c4){return function(_0x29d725){if(_0x29d725){return _0x29d725[_0xe0b0('0x2f')](_0x3231fc)['then'](function(_0x3ebf2a){return _0x3ebf2a;});}return null;};}function removeEntity(_0x208945,_0xfc51d3){return function(_0x31c6f5){if(_0x31c6f5){return _0x31c6f5[_0xe0b0('0x30')]()[_0xe0b0('0x31')](function(){_0x208945[_0xe0b0('0x27')](0xcc)[_0xe0b0('0x28')]();});}};}function handleEntityNotFound(_0x2125d5,_0x1dd010){return function(_0xd56467){if(!_0xd56467){_0x2125d5[_0xe0b0('0x26')](0x194);}return _0xd56467;};}function handleError(_0x1d35bc,_0x2a1c44){_0x2a1c44=_0x2a1c44||0x1f4;return function(_0xca25d){logger['error'](_0xca25d[_0xe0b0('0x32')]);if(_0xca25d[_0xe0b0('0x33')]){delete _0xca25d[_0xe0b0('0x33')];}_0x1d35bc[_0xe0b0('0x27')](_0x2a1c44)[_0xe0b0('0x34')](_0xca25d);};}exports[_0xe0b0('0x35')]=function(_0x12024d,_0x533fc7){var _0x521243={},_0x549d9a={},_0x5317df={'count':0x0,'rows':[]};var _0x26137c=_[_0xe0b0('0x36')](db[_0xe0b0('0x37')]['rawAttributes'],function(_0x2dd7e1){return{'name':_0x2dd7e1[_0xe0b0('0x38')],'type':_0x2dd7e1[_0xe0b0('0x39')][_0xe0b0('0x3a')]};});_0x549d9a['model']=_[_0xe0b0('0x36')](_0x26137c,_0xe0b0('0x33'));_0x549d9a[_0xe0b0('0x3b')]=_[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x3b')]);_0x549d9a[_0xe0b0('0x3d')]=_[_0xe0b0('0x3e')](_0x549d9a[_0xe0b0('0x3f')],_0x549d9a[_0xe0b0('0x3b')]);_0x521243['attributes']=_[_0xe0b0('0x3e')](_0x549d9a['model'],qs[_0xe0b0('0x40')](_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x40')]));_0x521243[_0xe0b0('0x41')]=_0x521243['attributes'][_0xe0b0('0x42')]?_0x521243[_0xe0b0('0x41')]:_0x549d9a[_0xe0b0('0x3f')];if(!_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x43')](_0xe0b0('0x44'))){_0x521243[_0xe0b0('0x2c')]=qs[_0xe0b0('0x2c')](_0x12024d['query'][_0xe0b0('0x2c')]);_0x521243[_0xe0b0('0x2b')]=qs['offset'](_0x12024d['query'][_0xe0b0('0x2b')]);}_0x521243[_0xe0b0('0x45')]=qs['sort'](_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x46')]);_0x521243[_0xe0b0('0x47')]=qs[_0xe0b0('0x3d')](_[_0xe0b0('0x48')](_0x12024d['query'],_0x549d9a['filters']),_0x26137c);if(_0x12024d['query'][_0xe0b0('0x49')]){_0x521243[_0xe0b0('0x47')]=_['merge'](_0x521243[_0xe0b0('0x47')],{'$or':_[_0xe0b0('0x36')](_0x26137c,function(_0x14197b){if(_0x14197b[_0xe0b0('0x39')]!==_0xe0b0('0x4a')){var _0x5c6f94={};_0x5c6f94[_0x14197b['name']]={'$like':'%'+_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x49')]+'%'};return _0x5c6f94;}})});}_0x521243=_[_0xe0b0('0x4b')]({},_0x521243,_0x12024d[_0xe0b0('0x4c')]);var _0x1bf77d={'where':_0x521243['where']};return db[_0xe0b0('0x37')][_0xe0b0('0x2a')](_0x1bf77d)['then'](function(_0x50c805){_0x5317df['count']=_0x50c805;if(_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x4d')]){_0x521243[_0xe0b0('0x4e')]=[{'all':!![]}];}return db[_0xe0b0('0x37')]['findAll'](_0x521243);})[_0xe0b0('0x31')](function(_0x87d8f3){_0x5317df['rows']=_0x87d8f3;return _0x5317df;})['then'](respondWithFilteredResult(_0x533fc7,_0x521243))[_0xe0b0('0x4f')](handleError(_0x533fc7,null));};exports[_0xe0b0('0x50')]=function(_0x497f4f,_0x2b1917){var _0x27fd31={'raw':!![],'where':{'id':_0x497f4f['params']['id']}},_0x504284={};_0x504284[_0xe0b0('0x3f')]=_['keys'](db[_0xe0b0('0x37')][_0xe0b0('0x51')]);_0x504284[_0xe0b0('0x3b')]=_[_0xe0b0('0x3c')](_0x497f4f[_0xe0b0('0x3b')]);_0x504284[_0xe0b0('0x3d')]=_['intersection'](_0x504284['model'],_0x504284[_0xe0b0('0x3b')]);_0x27fd31['attributes']=_['intersection'](_0x504284[_0xe0b0('0x3f')],qs[_0xe0b0('0x40')](_0x497f4f['query']['fields']));_0x27fd31[_0xe0b0('0x41')]=_0x27fd31[_0xe0b0('0x41')][_0xe0b0('0x42')]?_0x27fd31[_0xe0b0('0x41')]:_0x504284[_0xe0b0('0x3f')];if(_0x497f4f[_0xe0b0('0x3b')][_0xe0b0('0x4d')]){_0x27fd31['include']=[{'all':!![]}];}_0x27fd31=_[_0xe0b0('0x4b')]({},_0x27fd31,_0x497f4f['options']);return db[_0xe0b0('0x37')]['find'](_0x27fd31)['then'](handleEntityNotFound(_0x2b1917,null))[_0xe0b0('0x31')](respondWithResult(_0x2b1917,null))[_0xe0b0('0x4f')](handleError(_0x2b1917,null));};exports[_0xe0b0('0x52')]=function(_0x2f1712,_0x3d8013){return db[_0xe0b0('0x37')][_0xe0b0('0x52')](_0x2f1712[_0xe0b0('0x53')],{})[_0xe0b0('0x31')](respondWithResult(_0x3d8013,0xc9))['catch'](handleError(_0x3d8013,null));};exports[_0xe0b0('0x2f')]=function(_0x57ccc9,_0x2b5553){if(_0x57ccc9[_0xe0b0('0x53')]['id']){delete _0x57ccc9[_0xe0b0('0x53')]['id'];}return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x57ccc9[_0xe0b0('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b5553,null))[_0xe0b0('0x31')](saveUpdates(_0x57ccc9[_0xe0b0('0x53')],null))[_0xe0b0('0x31')](respondWithResult(_0x2b5553,null))[_0xe0b0('0x4f')](handleError(_0x2b5553,null));};exports[_0xe0b0('0x30')]=function(_0x3b015e,_0x234cb7){return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x3b015e[_0xe0b0('0x55')]['id']}})[_0xe0b0('0x31')](handleEntityNotFound(_0x234cb7,null))[_0xe0b0('0x31')](removeEntity(_0x234cb7,null))[_0xe0b0('0x4f')](handleError(_0x234cb7,null));};exports[_0xe0b0('0x56')]=function(_0xcdf97,_0x34c642){return db[_0xe0b0('0x37')][_0xe0b0('0x56')]()['then'](respondWithResult(_0x34c642,null))[_0xe0b0('0x4f')](handleError(_0x34c642,null));};var interaction_log=require(_0xe0b0('0x57'))(_0xe0b0('0x58'));exports[_0xe0b0('0x59')]=function(_0x3916ab,_0x405d7e,_0x2bdb59){var _0x4f818b={'channel':'whatsapp'};if(_0x3916ab[_0xe0b0('0x53')]['id']){delete _0x3916ab[_0xe0b0('0x53')]['id'];}_0x3916ab[_0xe0b0('0x53')]['read']=!![];_0x3916ab[_0xe0b0('0x53')][_0xe0b0('0x5a')]=moment()[_0xe0b0('0x5b')](_0xe0b0('0x5c'));_0x3916ab[_0xe0b0('0x53')]['UserId']=_0x3916ab[_0xe0b0('0x53')][_0xe0b0('0x5d')]||_0x3916ab[_0xe0b0('0x5e')]['id'];return db['WhatsappMessage'][_0xe0b0('0x54')]({'where':{'id':_0x3916ab[_0xe0b0('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xe0b0('0x5f')}]})['then'](handleEntityNotFound(_0x405d7e,null))['then'](saveUpdates(_0x3916ab[_0xe0b0('0x53')],null))['then'](function(_0x4d75e4){if(_0x4d75e4){_0x4f818b[_0xe0b0('0x23')]=_0x4d75e4[_0xe0b0('0x60')]({'plain':!![]});return db[_0xe0b0('0x61')][_0xe0b0('0x54')]({'where':{'id':_0x4d75e4['WhatsappInteractionId']}});}return null;})[_0xe0b0('0x31')](handleEntityNotFound(_0x405d7e,null))[_0xe0b0('0x31')](function(_0x3e7fb4){if(_0x3e7fb4){return _0x3e7fb4[_0xe0b0('0x2f')]({'UserId':_0x3916ab[_0xe0b0('0x53')][_0xe0b0('0x5d')],'read1stAt':_[_0xe0b0('0x62')](_0x3e7fb4[_0xe0b0('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe0b0('0x31')](function(_0x35144f){if(_0x35144f){_0x4f818b[_0xe0b0('0x64')]=_0x35144f['get']({'plain':!![]});interaction_log['info'](_0xe0b0('0x65'),_0x3916ab[_0xe0b0('0x5e')]['id'],_0x3916ab['user']['name'],_0x3916ab[_0xe0b0('0x5e')][_0xe0b0('0x66')],_0x4f818b[_0xe0b0('0x64')]['id'],_0x3916ab[_0xe0b0('0x53')]?JSON[_0xe0b0('0x20')](_0x3916ab[_0xe0b0('0x53')]):_0xe0b0('0x67'));return respondWithRpcPromise(_0xe0b0('0x68'),'acceptMessage',_0x4f818b);}return null;})[_0xe0b0('0x31')](function(_0x12e245){if(_0x12e245){if(_0x3916ab[_0xe0b0('0x53')]['manual']){_0x4f818b['message']['interface']=util['format']('SIP/%s',_0x3916ab['user'][_0xe0b0('0x33')]);_0x4f818b['message']['channel']=_0x4f818b[_0xe0b0('0x69')];_0x4f818b[_0xe0b0('0x23')][_0xe0b0('0x6a')]=_0xe0b0('0x59');return respondWithRpcPromise(_0xe0b0('0x6b'),_0xe0b0('0x6b'),{'event':_0xe0b0('0x6c'),'message':_0x4f818b[_0xe0b0('0x23')]},client9002)['then'](function(){return _0x4f818b;});}return _0x4f818b;}return null;})[_0xe0b0('0x31')](respondWithResult(_0x405d7e,null))[_0xe0b0('0x4f')](handleError(_0x405d7e,null));};var interaction_log=require(_0xe0b0('0x57'))(_0xe0b0('0x58'));exports[_0xe0b0('0x6d')]=function(_0x1f70fb,_0x16a2ae,_0x5e3e28){var _0xaf2607={'agent':{},'channel':'whatsapp'};if(_0x1f70fb[_0xe0b0('0x53')]['id']){delete _0x1f70fb[_0xe0b0('0x53')]['id'];}_0x1f70fb[_0xe0b0('0x53')][_0xe0b0('0x5d')]=_0x1f70fb['body'][_0xe0b0('0x5d')]||_0x1f70fb[_0xe0b0('0x5e')]['id'];_0xaf2607['agent']['id']=_0x1f70fb['body'][_0xe0b0('0x5d')];return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x1f70fb[_0xe0b0('0x55')]['id'],'UserId':null}})[_0xe0b0('0x31')](handleEntityNotFound(_0x16a2ae,null))[_0xe0b0('0x31')](function(_0x34f4ff){if(_0x34f4ff){_0xaf2607[_0xe0b0('0x23')]=_0x34f4ff[_0xe0b0('0x60')]({'plain':!![]});return db[_0xe0b0('0x61')]['find']({'where':{'id':_0x34f4ff['WhatsappInteractionId']}});}return null;})[_0xe0b0('0x31')](handleEntityNotFound(_0x16a2ae,null))['then'](function(_0x57d19e){if(_0x57d19e){_0xaf2607['interaction']=_0x57d19e['get']({'plain':!![]});interaction_log[_0xe0b0('0x24')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f70fb[_0xe0b0('0x5e')]['id'],_0x1f70fb[_0xe0b0('0x5e')][_0xe0b0('0x33')],_0x1f70fb[_0xe0b0('0x5e')]['role'],_0xaf2607[_0xe0b0('0x64')]['id'],_0x1f70fb[_0xe0b0('0x53')]?JSON['stringify'](_0x1f70fb[_0xe0b0('0x53')]):_0xe0b0('0x67'));return respondWithRpcPromise(_0xe0b0('0x6e'),_0xe0b0('0x6f'),_0xaf2607);}return null;})[_0xe0b0('0x31')](function(_0x5cc4fc){if(_0x5cc4fc){_0x5cc4fc['message']['interface']=util['format']('SIP/%s',_0x1f70fb[_0xe0b0('0x5e')]['name']);_0x5cc4fc[_0xe0b0('0x23')]['channel']=_0xaf2607[_0xe0b0('0x69')];_0x5cc4fc[_0xe0b0('0x23')][_0xe0b0('0x6a')]=_0xe0b0('0x6d');respondWithRpcPromise(_0xe0b0('0x6b'),_0xe0b0('0x6b'),{'event':'rejectmessage','message':_0x5cc4fc['message']},client9002);return _0xaf2607;}return null;})['then'](respondWithResult(_0x16a2ae,null))['catch'](handleError(_0x16a2ae,null));};exports[_0xe0b0('0x27')]=function(_0x261381,_0x264363,_0x4377f7){if(_0x261381[_0xe0b0('0x53')]['id']){delete _0x261381['body']['id'];}var _0x234716;return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x261381[_0xe0b0('0x55')]['id']}})[_0xe0b0('0x31')](handleEntityNotFound(_0x264363,null))[_0xe0b0('0x31')](function(_0x3ef24a){if(_0x3ef24a){_0x234716=_0x3ef24a;return db[_0xe0b0('0x70')][_0xe0b0('0x54')]({'where':{'id':_0x3ef24a['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x264363,null))[_0xe0b0('0x31')](function(_0x1f15e4){if(_0x1f15e4){logger['debug'](_0xe0b0('0x71'),_0xe0b0('0x27'),_0xe0b0('0x72'),_0x1f15e4[_0xe0b0('0x39')],util[_0xe0b0('0x73')](_0x261381[_0xe0b0('0x53')],{'showHidden':![],'depth':null}));switch(_0x1f15e4[_0xe0b0('0x39')]){case _0xe0b0('0x74'):if(_0x261381['body']['MessageSid']&&_0x261381['body'][_0xe0b0('0x75')]===_0x234716[_0xe0b0('0x76')]&&_0x261381['body'][_0xe0b0('0x77')]&&_0x261381[_0xe0b0('0x53')][_0xe0b0('0x77')]===_0xe0b0('0x78')){return _0x234716['update']({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe0b0('0x27'),_0xe0b0('0x74'),util['inspect'](_0x261381[_0xe0b0('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x234716;}})[_0xe0b0('0x31')](respondWithResult(_0x264363,null))['catch'](handleError(_0x264363,null));}; \ No newline at end of file +var _0x4975=['MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','VIRTUAL','count','includeAll','include','rows','params','options','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','WhatsappInteraction','isNil','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect'];(function(_0x15e32e,_0x23dd2c){var _0x392d17=function(_0x58b2de){while(--_0x58b2de){_0x15e32e['push'](_0x15e32e['shift']());}};_0x392d17(++_0x23dd2c);}(_0x4975,0x86));var _0x5497=function(_0x30c27b,_0xf11fb0){_0x30c27b=_0x30c27b-0x0;var _0x37fcdd=_0x4975[_0x30c27b];return _0x37fcdd;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x18'))['db'];config[_0x5497('0x19')]=_[_0x5497('0x1a')](config[_0x5497('0x19')],{'host':_0x5497('0x1b'),'port':0x18eb});var socket=require(_0x5497('0x1c'))(new Redis(config[_0x5497('0x19')]));require(_0x5497('0x1d'))[_0x5497('0x1e')](socket);var jayson=require(_0x5497('0x1f'));var client=jayson['client'][_0x5497('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x5497('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2bfd8a,_0x19e5f3,_0x3ce50b,_0x37c18e){return new BPromise(function(_0x4073e6,_0x2f2997){var _0x575f6b=_0x37c18e||client;return _0x575f6b['request'](_0x2bfd8a,_0x3ce50b)[_0x5497('0x21')](function(_0x1bf442){logger[_0x5497('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x19e5f3,_0x5497('0x23'));logger[_0x5497('0x24')](_0x5497('0x25'),_0x19e5f3,_0x5497('0x23'),JSON[_0x5497('0x26')](_0x1bf442));if(_0x1bf442[_0x5497('0x27')]){if(_0x1bf442[_0x5497('0x27')][_0x5497('0x28')]===0x1f4){logger[_0x5497('0x27')](_0x5497('0x29'),_0x19e5f3,_0x1bf442[_0x5497('0x27')]['message']);return _0x2f2997(_0x1bf442[_0x5497('0x27')]['message']);}logger[_0x5497('0x27')](_0x5497('0x29'),_0x19e5f3,_0x1bf442[_0x5497('0x27')][_0x5497('0x2a')]);return _0x4073e6(_0x1bf442[_0x5497('0x27')][_0x5497('0x2a')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x19e5f3,_0x5497('0x23'));_0x4073e6(_0x1bf442[_0x5497('0x2b')][_0x5497('0x2a')]);}})[_0x5497('0x2c')](function(_0x5223b5){logger[_0x5497('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x19e5f3,_0x5223b5);_0x2f2997(_0x5223b5);});});}function respondWithStatusCode(_0x1f3198,_0x16a2b4){_0x16a2b4=_0x16a2b4||0xcc;return function(_0x429d36){if(_0x429d36){return _0x1f3198[_0x5497('0x2d')](_0x16a2b4);}return _0x1f3198[_0x5497('0x2e')](_0x16a2b4)[_0x5497('0x2f')]();};}function respondWithResult(_0x48b835,_0x4af5f4){_0x4af5f4=_0x4af5f4||0xc8;return function(_0x5406e2){if(_0x5406e2){return _0x48b835['status'](_0x4af5f4)['json'](_0x5406e2);}};}function respondWithFilteredResult(_0x39a2b7,_0x48d146){return function(_0x5e9356){if(_0x5e9356){var _0xc3465=_0x5e9356['count'],_0xb14593=_0x48d146['offset'],_0x1cf908=_0x48d146[_0x5497('0x30')]+_0x48d146[_0x5497('0x31')],_0x4c442a;if(_0x1cf908>=_0xc3465){_0x1cf908=_0xc3465;_0x4c442a=0xc8;}else{_0x4c442a=0xce;}_0x39a2b7[_0x5497('0x2e')](_0x4c442a);return _0x39a2b7['set']('Content-Range',_0xb14593+'-'+_0x1cf908+'/'+_0xc3465)['json'](_0x5e9356);}return null;};}function patchUpdates(_0xa28dd8){return function(_0x572460){try{jsonpatch[_0x5497('0x32')](_0x572460,_0xa28dd8,!![]);}catch(_0x258c2d){return BPromise[_0x5497('0x33')](_0x258c2d);}return _0x572460['save']();};}function saveUpdates(_0x1d208f,_0x32aba1){return function(_0x592c00){if(_0x592c00){return _0x592c00[_0x5497('0x34')](_0x1d208f)[_0x5497('0x21')](function(_0x331dfc){return _0x331dfc;});}return null;};}function removeEntity(_0x489fbd,_0x3395f6){return function(_0x2fe1f2){if(_0x2fe1f2){return _0x2fe1f2[_0x5497('0x35')]()[_0x5497('0x21')](function(){_0x489fbd[_0x5497('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x386845,_0x31ae43){return function(_0x558a70){if(!_0x558a70){_0x386845[_0x5497('0x2d')](0x194);}return _0x558a70;};}function handleError(_0x44299b,_0xc7730){_0xc7730=_0xc7730||0x1f4;return function(_0x1b9cd8){logger[_0x5497('0x27')](_0x1b9cd8[_0x5497('0x36')]);if(_0x1b9cd8['name']){delete _0x1b9cd8[_0x5497('0x37')];}_0x44299b['status'](_0xc7730)[_0x5497('0x38')](_0x1b9cd8);};}exports[_0x5497('0x39')]=function(_0x2751f5,_0x5ab18c){var _0x4ec5f7={},_0x396a9f={},_0x36b13d={'count':0x0,'rows':[]};var _0x326d48=_[_0x5497('0x3a')](db[_0x5497('0x3b')][_0x5497('0x3c')],function(_0x4f53c1){return{'name':_0x4f53c1[_0x5497('0x3d')],'type':_0x4f53c1[_0x5497('0x3e')][_0x5497('0x3f')]};});_0x396a9f[_0x5497('0x40')]=_[_0x5497('0x3a')](_0x326d48,_0x5497('0x37'));_0x396a9f[_0x5497('0x41')]=_[_0x5497('0x42')](_0x2751f5[_0x5497('0x41')]);_0x396a9f['filters']=_[_0x5497('0x43')](_0x396a9f[_0x5497('0x40')],_0x396a9f[_0x5497('0x41')]);_0x4ec5f7[_0x5497('0x44')]=_[_0x5497('0x43')](_0x396a9f[_0x5497('0x40')],qs[_0x5497('0x45')](_0x2751f5['query'][_0x5497('0x45')]));_0x4ec5f7[_0x5497('0x44')]=_0x4ec5f7[_0x5497('0x44')][_0x5497('0x46')]?_0x4ec5f7[_0x5497('0x44')]:_0x396a9f[_0x5497('0x40')];if(!_0x2751f5[_0x5497('0x41')]['hasOwnProperty'](_0x5497('0x47'))){_0x4ec5f7[_0x5497('0x31')]=qs[_0x5497('0x31')](_0x2751f5[_0x5497('0x41')][_0x5497('0x31')]);_0x4ec5f7[_0x5497('0x30')]=qs[_0x5497('0x30')](_0x2751f5[_0x5497('0x41')][_0x5497('0x30')]);}_0x4ec5f7[_0x5497('0x48')]=qs['sort'](_0x2751f5[_0x5497('0x41')]['sort']);_0x4ec5f7[_0x5497('0x49')]=qs[_0x5497('0x4a')](_[_0x5497('0x4b')](_0x2751f5[_0x5497('0x41')],_0x396a9f[_0x5497('0x4a')]),_0x326d48);if(_0x2751f5['query'][_0x5497('0x4c')]){_0x4ec5f7[_0x5497('0x49')]=_['merge'](_0x4ec5f7[_0x5497('0x49')],{'$or':_['map'](_0x326d48,function(_0x590f2c){if(_0x590f2c['type']!==_0x5497('0x4d')){var _0x1a0df5={};_0x1a0df5[_0x590f2c[_0x5497('0x37')]]={'$like':'%'+_0x2751f5[_0x5497('0x41')][_0x5497('0x4c')]+'%'};return _0x1a0df5;}})});}_0x4ec5f7=_['merge']({},_0x4ec5f7,_0x2751f5['options']);var _0x498de5={'where':_0x4ec5f7['where']};return db[_0x5497('0x3b')][_0x5497('0x4e')](_0x498de5)[_0x5497('0x21')](function(_0x185512){_0x36b13d[_0x5497('0x4e')]=_0x185512;if(_0x2751f5[_0x5497('0x41')][_0x5497('0x4f')]){_0x4ec5f7[_0x5497('0x50')]=[{'all':!![]}];}return db[_0x5497('0x3b')]['findAll'](_0x4ec5f7);})[_0x5497('0x21')](function(_0x18db5b){_0x36b13d[_0x5497('0x51')]=_0x18db5b;return _0x36b13d;})['then'](respondWithFilteredResult(_0x5ab18c,_0x4ec5f7))[_0x5497('0x2c')](handleError(_0x5ab18c,null));};exports['show']=function(_0x12ffbc,_0x31f1ba){var _0x4290f5={'raw':!![],'where':{'id':_0x12ffbc[_0x5497('0x52')]['id']}},_0x5580cf={};_0x5580cf[_0x5497('0x40')]=_['keys'](db[_0x5497('0x3b')]['rawAttributes']);_0x5580cf[_0x5497('0x41')]=_['keys'](_0x12ffbc[_0x5497('0x41')]);_0x5580cf[_0x5497('0x4a')]=_[_0x5497('0x43')](_0x5580cf[_0x5497('0x40')],_0x5580cf[_0x5497('0x41')]);_0x4290f5[_0x5497('0x44')]=_[_0x5497('0x43')](_0x5580cf[_0x5497('0x40')],qs['fields'](_0x12ffbc[_0x5497('0x41')]['fields']));_0x4290f5['attributes']=_0x4290f5[_0x5497('0x44')][_0x5497('0x46')]?_0x4290f5['attributes']:_0x5580cf[_0x5497('0x40')];if(_0x12ffbc[_0x5497('0x41')][_0x5497('0x4f')]){_0x4290f5[_0x5497('0x50')]=[{'all':!![]}];}_0x4290f5=_['merge']({},_0x4290f5,_0x12ffbc[_0x5497('0x53')]);return db['WhatsappMessage']['find'](_0x4290f5)[_0x5497('0x21')](handleEntityNotFound(_0x31f1ba,null))[_0x5497('0x21')](respondWithResult(_0x31f1ba,null))[_0x5497('0x2c')](handleError(_0x31f1ba,null));};exports['create']=function(_0x4b37d2,_0x2e2ac9){return db['WhatsappMessage'][_0x5497('0x54')](_0x4b37d2['body'],{})[_0x5497('0x21')](respondWithResult(_0x2e2ac9,0xc9))['catch'](handleError(_0x2e2ac9,null));};exports[_0x5497('0x34')]=function(_0x41138e,_0x5e08df){if(_0x41138e[_0x5497('0x55')]['id']){delete _0x41138e['body']['id'];}return db['WhatsappMessage'][_0x5497('0x56')]({'where':{'id':_0x41138e[_0x5497('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e08df,null))[_0x5497('0x21')](saveUpdates(_0x41138e[_0x5497('0x55')],null))[_0x5497('0x21')](respondWithResult(_0x5e08df,null))[_0x5497('0x2c')](handleError(_0x5e08df,null));};exports[_0x5497('0x35')]=function(_0x25c75e,_0x590be7){return db[_0x5497('0x3b')]['find']({'where':{'id':_0x25c75e['params']['id']}})['then'](handleEntityNotFound(_0x590be7,null))[_0x5497('0x21')](removeEntity(_0x590be7,null))[_0x5497('0x2c')](handleError(_0x590be7,null));};exports[_0x5497('0x57')]=function(_0x544085,_0x53eafd){return db['WhatsappMessage']['describe']()[_0x5497('0x21')](respondWithResult(_0x53eafd,null))[_0x5497('0x2c')](handleError(_0x53eafd,null));};var interaction_log=require(_0x5497('0x16'))(_0x5497('0x58'));exports[_0x5497('0x59')]=function(_0x45e622,_0x573f93,_0x18b30c){var _0x3b0350={'channel':_0x5497('0x5a')};if(_0x45e622[_0x5497('0x55')]['id']){delete _0x45e622['body']['id'];}_0x45e622[_0x5497('0x55')][_0x5497('0x5b')]=!![];_0x45e622[_0x5497('0x55')][_0x5497('0x5c')]=moment()['format'](_0x5497('0x5d'));_0x45e622[_0x5497('0x55')][_0x5497('0x5e')]=_0x45e622['body'][_0x5497('0x5e')]||_0x45e622['user']['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x45e622[_0x5497('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x5497('0x5f')],'as':_0x5497('0x60')}]})['then'](handleEntityNotFound(_0x573f93,null))[_0x5497('0x21')](saveUpdates(_0x45e622[_0x5497('0x55')],null))[_0x5497('0x21')](function(_0x35e75a){if(_0x35e75a){_0x3b0350['message']=_0x35e75a[_0x5497('0x61')]({'plain':!![]});return db[_0x5497('0x62')][_0x5497('0x56')]({'where':{'id':_0x35e75a['WhatsappInteractionId']}});}return null;})[_0x5497('0x21')](handleEntityNotFound(_0x573f93,null))[_0x5497('0x21')](function(_0xb3eec2){if(_0xb3eec2){return _0xb3eec2[_0x5497('0x34')]({'UserId':_0x45e622[_0x5497('0x55')][_0x5497('0x5e')],'read1stAt':_[_0x5497('0x63')](_0xb3eec2['read1stAt'])?moment()[_0x5497('0x64')](_0x5497('0x5d')):undefined});}return null;})[_0x5497('0x21')](function(_0x20efea){if(_0x20efea){_0x3b0350['interaction']=_0x20efea['get']({'plain':!![]});interaction_log['info'](_0x5497('0x65'),_0x45e622[_0x5497('0x66')]['id'],_0x45e622[_0x5497('0x66')]['name'],_0x45e622[_0x5497('0x66')][_0x5497('0x67')],_0x3b0350[_0x5497('0x68')]['id'],_0x45e622[_0x5497('0x55')]?JSON[_0x5497('0x26')](_0x45e622[_0x5497('0x55')]):_0x5497('0x69'));return respondWithRpcPromise(_0x5497('0x6a'),_0x5497('0x6b'),_0x3b0350);}return null;})[_0x5497('0x21')](function(_0x1fc6ad){if(_0x1fc6ad){if(_0x45e622['body'][_0x5497('0x6c')]){_0x3b0350[_0x5497('0x2a')][_0x5497('0x6d')]=util['format'](_0x5497('0x6e'),_0x45e622['user'][_0x5497('0x37')]);_0x3b0350[_0x5497('0x2a')]['channel']=_0x3b0350[_0x5497('0x6f')];_0x3b0350[_0x5497('0x2a')][_0x5497('0x70')]=_0x5497('0x59');return respondWithRpcPromise('EventManager',_0x5497('0x71'),{'event':_0x5497('0x72'),'message':_0x3b0350[_0x5497('0x2a')]},client9002)['then'](function(){return _0x3b0350;});}return _0x3b0350;}return null;})[_0x5497('0x21')](respondWithResult(_0x573f93,null))[_0x5497('0x2c')](handleError(_0x573f93,null));};var interaction_log=require('../../config/logger')(_0x5497('0x58'));exports[_0x5497('0x33')]=function(_0x6c9547,_0x560c15,_0x4dbd4e){var _0x3cc968={'agent':{},'channel':_0x5497('0x5a')};if(_0x6c9547[_0x5497('0x55')]['id']){delete _0x6c9547[_0x5497('0x55')]['id'];}_0x6c9547[_0x5497('0x55')][_0x5497('0x5e')]=_0x6c9547[_0x5497('0x55')]['UserId']||_0x6c9547['user']['id'];_0x3cc968[_0x5497('0x73')]['id']=_0x6c9547[_0x5497('0x55')]['UserId'];return db[_0x5497('0x3b')][_0x5497('0x56')]({'where':{'id':_0x6c9547[_0x5497('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x560c15,null))[_0x5497('0x21')](function(_0x3e1e7f){if(_0x3e1e7f){_0x3cc968['message']=_0x3e1e7f[_0x5497('0x61')]({'plain':!![]});return db[_0x5497('0x62')][_0x5497('0x56')]({'where':{'id':_0x3e1e7f[_0x5497('0x74')]}});}return null;})[_0x5497('0x21')](handleEntityNotFound(_0x560c15,null))['then'](function(_0x2bad48){if(_0x2bad48){_0x3cc968[_0x5497('0x68')]=_0x2bad48[_0x5497('0x61')]({'plain':!![]});interaction_log[_0x5497('0x22')](_0x5497('0x75'),_0x6c9547['user']['id'],_0x6c9547[_0x5497('0x66')][_0x5497('0x37')],_0x6c9547[_0x5497('0x66')][_0x5497('0x67')],_0x3cc968['interaction']['id'],_0x6c9547[_0x5497('0x55')]?JSON[_0x5497('0x26')](_0x6c9547['body']):_0x5497('0x69'));return respondWithRpcPromise(_0x5497('0x76'),_0x5497('0x77'),_0x3cc968);}return null;})[_0x5497('0x21')](function(_0x53b1b7){if(_0x53b1b7){_0x53b1b7['message']['interface']=util['format']('SIP/%s',_0x6c9547[_0x5497('0x66')][_0x5497('0x37')]);_0x53b1b7[_0x5497('0x2a')][_0x5497('0x6f')]=_0x3cc968[_0x5497('0x6f')];_0x53b1b7['message']['event']=_0x5497('0x33');respondWithRpcPromise(_0x5497('0x71'),_0x5497('0x71'),{'event':_0x5497('0x78'),'message':_0x53b1b7[_0x5497('0x2a')]},client9002);return _0x3cc968;}return null;})[_0x5497('0x21')](respondWithResult(_0x560c15,null))[_0x5497('0x2c')](handleError(_0x560c15,null));};exports[_0x5497('0x2e')]=function(_0x2aae94,_0x1bb9c1,_0x4c41c4){if(_0x2aae94[_0x5497('0x55')]['id']){delete _0x2aae94[_0x5497('0x55')]['id'];}var _0x2868b1;return db[_0x5497('0x3b')][_0x5497('0x56')]({'where':{'id':_0x2aae94[_0x5497('0x52')]['id']}})['then'](handleEntityNotFound(_0x1bb9c1,null))[_0x5497('0x21')](function(_0x5903b7){if(_0x5903b7){_0x2868b1=_0x5903b7;return db[_0x5497('0x79')][_0x5497('0x56')]({'where':{'id':_0x5903b7[_0x5497('0x7a')]}});}})['then'](handleEntityNotFound(_0x1bb9c1,null))['then'](function(_0xa6af36){if(_0xa6af36){logger[_0x5497('0x24')](_0x5497('0x7b'),_0x5497('0x2e'),_0x5497('0x7c'),_0xa6af36[_0x5497('0x3e')],util[_0x5497('0x7d')](_0x2aae94[_0x5497('0x55')],{'showHidden':![],'depth':null}));switch(_0xa6af36['type']){case'twilio':if(_0x2aae94['body'][_0x5497('0x7e')]&&_0x2aae94[_0x5497('0x55')][_0x5497('0x7e')]===_0x2868b1[_0x5497('0x7f')]&&_0x2aae94['body']['MessageStatus']&&_0x2aae94[_0x5497('0x55')][_0x5497('0x80')]==='read'){return _0x2868b1[_0x5497('0x34')]({'read':!![]});}else{logger[_0x5497('0x27')](_0x5497('0x81'),_0x5497('0x2e'),'twilio',util['inspect'](_0x2aae94['body'],{'showHidden':![],'depth':null}));}break;}return _0x2868b1;}})['then'](respondWithResult(_0x1bb9c1,null))['catch'](handleError(_0x1bb9c1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c0fc779..8aaeac1 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5af300,_0x23d6de){var _0x1feb54=function(_0x3c31aa){while(--_0x3c31aa){_0x5af300['push'](_0x5af300['shift']());}};_0x1feb54(++_0x23d6de);}(_0x7a54,0x106));var _0x47a5=function(_0x27a8e3,_0x3e67bd){_0x27a8e3=_0x27a8e3-0x0;var _0x4451f8=_0x7a54[_0x27a8e3];return _0x4451f8;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x359f95,_0x156e3d){var _0x24711a=function(_0x49c156){while(--_0x49c156){_0x359f95['push'](_0x359f95['shift']());}};_0x24711a(++_0x156e3d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x218dd4,_0x3f8280){_0x218dd4=_0x218dd4-0x0;var _0x43d7e0=_0x5f2f[_0x218dd4];return _0x43d7e0;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 18bc26b..e6ccfaf 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 _0xe40f=['WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','secret','UserId','WhatsappInteractionId','then','update','createdAt','catch','error','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','inspect'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe40f,0x11f));var _0xfe40=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe40f[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xfe40('0x0'));var util=require(_0xfe40('0x1'));var logger=require(_0xfe40('0x2'))(_0xfe40('0x3'));var moment=require(_0xfe40('0x4'));var BPromise=require(_0xfe40('0x5'));var rp=require(_0xfe40('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe40('0x7'));var config=require(_0xfe40('0x8'));var attributes=require(_0xfe40('0x9'));module[_0xfe40('0xa')]=function(_0x451d37,_0x1e0df2){return _0x451d37[_0xfe40('0xb')](_0xfe40('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xfe40('0xd'),'fields':[_0xfe40('0xd')]},{'name':_0xfe40('0xe'),'fields':[_0xfe40('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4033a3,_0x59018b,_0x2d58d5){var _0x2b977c=_0x451d37['models'];var _0x146b4b=_0x4033a3[_0xfe40('0x10')]({'plain':!![]});if(_0x146b4b[_0xfe40('0x11')][_0xfe40('0x12')]()==='in'||_0x146b4b[_0xfe40('0x11')][_0xfe40('0x12')]()===_0xfe40('0x13')&&!_0x146b4b[_0xfe40('0x14')]&&!_['isNil'](_0x146b4b[_0xfe40('0x15')])){_0x2b977c['WhatsappInteraction']['findOne']({'where':{'id':_0x146b4b[_0xfe40('0x16')]}})[_0xfe40('0x17')](function(_0x2726ad){if(_0x2726ad){_0x2726ad[_0xfe40('0x18')]({'lastMsgAt':_0x146b4b[_0xfe40('0x19')],'lastMsgDirection':_0x146b4b[_0xfe40('0x11')][_0xfe40('0x12')]()});}})[_0xfe40('0x1a')](function(_0x891a82){console[_0xfe40('0x1b')](_0x891a82);});}if(_0x146b4b[_0xfe40('0x11')]==='out'&&!_0x146b4b[_0xfe40('0x14')]){var _0x2fa3ea;_0x2b977c['WhatsappAccount']['find']({'where':{'id':_0x146b4b['WhatsappAccountId']},'raw':!![]})[_0xfe40('0x17')](function(_0x4df390){_0x2fa3ea=_0x4df390;if(_0x2fa3ea&&_0x2fa3ea[_0xfe40('0x1c')]){switch(_0x2fa3ea[_0xfe40('0x1c')]){case _0xfe40('0x1d'):var _0x2a7d78=require(_0xfe40('0x1d'));if(_0x2fa3ea[_0xfe40('0x1e')]&&_0x2fa3ea[_0xfe40('0x1f')]&&_0x2fa3ea[_0xfe40('0x20')]){var _0x2ab936=new _0x2a7d78(_0x2fa3ea[_0xfe40('0x1e')],_0x2fa3ea['authToken']);_0x2ab936[_0xfe40('0x21')][_0xfe40('0x22')]({'body':_0x146b4b[_0xfe40('0xf')],'to':_0xfe40('0x23')+_0x146b4b[_0xfe40('0x20')],'from':_0xfe40('0x23')+_0x2fa3ea[_0xfe40('0x20')],'statusCallback':_0x2fa3ea[_0xfe40('0x24')]+_0xfe40('0x25')+_0x146b4b['id']+_0xfe40('0x26')+_0x2fa3ea['token']})[_0xfe40('0x17')](function(_0x22ba2f){if(_0x22ba2f[_0xfe40('0x27')]){return _0x4033a3[_0xfe40('0x18')]({'messageId':_0x22ba2f['sid']});}})['catch'](function(_0x43f85d){logger[_0xfe40('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfe40('0x28'),'twilio',util[_0xfe40('0x29')](_0x43f85d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfe40('0x2a'),_0xfe40('0x28'),_0xfe40('0x1d'),_0xfe40('0x2b'));}break;}}})[_0xfe40('0x2c')](function(){_0x2d58d5();});}else{_0x2d58d5();}}},'charset':_0xfe40('0x2d'),'collate':_0xfe40('0x2e')});}; \ No newline at end of file +var _0x01b1=['WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','body','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','then','sid','catch','error'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0x01b1,0x1db));var _0x101b=function(_0x3b626c,_0x59535b){_0x3b626c=_0x3b626c-0x0;var _0x5274ef=_0x01b1[_0x3b626c];return _0x5274ef;};'use strict';var _=require('lodash');var util=require(_0x101b('0x0'));var logger=require(_0x101b('0x1'))(_0x101b('0x2'));var moment=require(_0x101b('0x3'));var BPromise=require(_0x101b('0x4'));var rp=require(_0x101b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x101b('0x6'));var config=require(_0x101b('0x7'));var attributes=require(_0x101b('0x8'));module['exports']=function(_0x237dc8,_0xbd1591){return _0x237dc8[_0x101b('0x9')](_0x101b('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x101b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cccbd,_0x563b43,_0x1b07da){var _0x4c127b=_0x237dc8[_0x101b('0xc')];var _0x43f608=_0x3cccbd[_0x101b('0xd')]({'plain':!![]});if(_0x43f608[_0x101b('0xe')][_0x101b('0xf')]()==='in'||_0x43f608['direction'][_0x101b('0xf')]()===_0x101b('0x10')&&!_0x43f608['secret']&&!_[_0x101b('0x11')](_0x43f608[_0x101b('0x12')])){_0x4c127b[_0x101b('0x13')][_0x101b('0x14')]({'where':{'id':_0x43f608[_0x101b('0x15')]}})['then'](function(_0x308528){if(_0x308528){_0x308528[_0x101b('0x16')]({'lastMsgAt':_0x43f608[_0x101b('0x17')],'lastMsgDirection':_0x43f608[_0x101b('0xe')][_0x101b('0xf')]()});}})['catch'](function(_0x294693){console['error'](_0x294693);});}if(_0x43f608[_0x101b('0xe')]===_0x101b('0x10')&&!_0x43f608['secret']){var _0x505826;_0x4c127b[_0x101b('0x18')][_0x101b('0x19')]({'where':{'id':_0x43f608[_0x101b('0x1a')]},'raw':!![]})['then'](function(_0x3dd481){_0x505826=_0x3dd481;if(_0x505826&&_0x505826['type']){switch(_0x505826['type']){case _0x101b('0x1b'):var _0x1ef84f=require(_0x101b('0x1b'));if(_0x505826[_0x101b('0x1c')]&&_0x505826['authToken']&&_0x505826[_0x101b('0x1d')]){var _0x18ede1=new _0x1ef84f(_0x505826[_0x101b('0x1c')],_0x505826[_0x101b('0x1e')]);_0x18ede1[_0x101b('0x1f')][_0x101b('0x20')]({'body':_0x43f608[_0x101b('0xb')],'to':_0x101b('0x21')+_0x43f608[_0x101b('0x1d')],'from':_0x101b('0x21')+_0x505826[_0x101b('0x1d')],'statusCallback':_0x505826[_0x101b('0x22')]+_0x101b('0x23')+_0x43f608['id']+_0x101b('0x24')+_0x505826[_0x101b('0x25')]})[_0x101b('0x26')](function(_0xc01dbf){if(_0xc01dbf[_0x101b('0x27')]){return _0x3cccbd[_0x101b('0x16')]({'messageId':_0xc01dbf[_0x101b('0x27')]});}})[_0x101b('0x28')](function(_0x4995dd){logger[_0x101b('0x29')](_0x101b('0x2a'),_0x101b('0x2b'),'twilio',util['inspect'](_0x4995dd,{'showHidden':![],'depth':null}));});}else{logger[_0x101b('0x29')](_0x101b('0x2a'),_0x101b('0x2b'),_0x101b('0x1b'),_0x101b('0x2c'));}break;}}})[_0x101b('0x2d')](function(){_0x1b07da();});}else{_0x1b07da();}}},'charset':_0x101b('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 92bd03b..68e4f0f 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 _0x8ca4=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','redis','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca4,0x1ba));var _0x48ca=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x8ca4[_0x447ef1];return _0x3d72ec;};'use strict';var _=require(_0x48ca('0x0'));var util=require(_0x48ca('0x1'));var moment=require('moment');var BPromise=require(_0x48ca('0x2'));var rs=require(_0x48ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48ca('0x4'))['db'];var utils=require(_0x48ca('0x5'));var logger=require(_0x48ca('0x6'))(_0x48ca('0x7'));var config=require(_0x48ca('0x8'));var jayson=require(_0x48ca('0x9'));var client=jayson['client'][_0x48ca('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x48ca('0xb'))(new Redis(config[_0x48ca('0xc')]));require(_0x48ca('0xd'))[_0x48ca('0xe')](socket);function respondWithRpcPromise(_0x17c23e,_0x2ae5cd,_0x24214d){return new BPromise(function(_0x4035dc,_0x263101){return client[_0x48ca('0xf')](_0x17c23e,_0x24214d)[_0x48ca('0x10')](function(_0x5e57d9){logger[_0x48ca('0x11')](_0x48ca('0x12'),_0x2ae5cd,_0x48ca('0x13'));logger[_0x48ca('0x14')](_0x48ca('0x15'),_0x2ae5cd,_0x48ca('0x13'),JSON[_0x48ca('0x16')](_0x5e57d9));if(_0x5e57d9[_0x48ca('0x17')]){if(_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x18')]===0x1f4){logger[_0x48ca('0x17')](_0x48ca('0x12'),_0x2ae5cd,_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);return _0x263101(_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);}logger['error'](_0x48ca('0x12'),_0x2ae5cd,_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);return _0x4035dc(_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);}else{logger[_0x48ca('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2ae5cd,_0x48ca('0x13'));_0x4035dc(_0x5e57d9[_0x48ca('0x1a')]['message']);}})[_0x48ca('0x1b')](function(_0x1fb69d){logger['error'](_0x48ca('0x12'),_0x2ae5cd,_0x1fb69d);_0x263101(_0x1fb69d);});});}exports[_0x48ca('0x1c')]=function(_0x1aae47){var _0x455601=this;return new Promise(function(_0x4eb25f,_0x18946d){return db['WhatsappMessage'][_0x48ca('0x1d')](_0x1aae47[_0x48ca('0x1e')],{'raw':_0x1aae47[_0x48ca('0x1f')]?_0x1aae47[_0x48ca('0x1f')][_0x48ca('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1b95df){logger['info'](_0x48ca('0x1c'),_0x1aae47);logger[_0x48ca('0x14')](_0x48ca('0x1c'),_0x1aae47,JSON['stringify'](_0x1b95df));_0x4eb25f(_0x1b95df);})[_0x48ca('0x1b')](function(_0x1a6d47){logger[_0x48ca('0x17')](_0x48ca('0x1c'),_0x1a6d47[_0x48ca('0x19')],_0x1aae47);_0x18946d(_0x455601[_0x48ca('0x17')](0x1f4,_0x1a6d47['message']));});});}; \ No newline at end of file +var _0x65e3=['stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','request\x20sent','debug'];(function(_0xfbf499,_0x3a2f64){var _0x3b9abd=function(_0x2666ad){while(--_0x2666ad){_0xfbf499['push'](_0xfbf499['shift']());}};_0x3b9abd(++_0x3a2f64);}(_0x65e3,0x178));var _0x365e=function(_0x5b2d8f,_0x53f9d4){_0x5b2d8f=_0x5b2d8f-0x0;var _0x2f1fdf=_0x65e3[_0x5b2d8f];return _0x2f1fdf;};'use strict';var _=require(_0x365e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x365e('0x1'));var rs=require(_0x365e('0x2'));var fs=require('fs');var Redis=require(_0x365e('0x3'));var db=require(_0x365e('0x4'))['db'];var utils=require(_0x365e('0x5'));var logger=require(_0x365e('0x6'))(_0x365e('0x7'));var config=require(_0x365e('0x8'));var jayson=require(_0x365e('0x9'));var client=jayson['client'][_0x365e('0xa')]({'port':0x232a});config[_0x365e('0xb')]=_[_0x365e('0xc')](config[_0x365e('0xb')],{'host':_0x365e('0xd'),'port':0x18eb});var socket=require(_0x365e('0xe'))(new Redis(config[_0x365e('0xb')]));require(_0x365e('0xf'))['register'](socket);function respondWithRpcPromise(_0x25fab1,_0x47d328,_0x5acffe){return new BPromise(function(_0xf86fa0,_0x5a1ea7){return client[_0x365e('0x10')](_0x25fab1,_0x5acffe)[_0x365e('0x11')](function(_0x30af71){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x47d328,_0x365e('0x12'));logger[_0x365e('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x47d328,_0x365e('0x12'),JSON[_0x365e('0x14')](_0x30af71));if(_0x30af71['error']){if(_0x30af71[_0x365e('0x15')][_0x365e('0x16')]===0x1f4){logger[_0x365e('0x15')](_0x365e('0x17'),_0x47d328,_0x30af71[_0x365e('0x15')][_0x365e('0x18')]);return _0x5a1ea7(_0x30af71['error']['message']);}logger[_0x365e('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x47d328,_0x30af71[_0x365e('0x15')][_0x365e('0x18')]);return _0xf86fa0(_0x30af71['error'][_0x365e('0x18')]);}else{logger['info'](_0x365e('0x17'),_0x47d328,_0x365e('0x12'));_0xf86fa0(_0x30af71['result'][_0x365e('0x18')]);}})[_0x365e('0x19')](function(_0x5e7502){logger[_0x365e('0x15')](_0x365e('0x17'),_0x47d328,_0x5e7502);_0x5a1ea7(_0x5e7502);});});}exports[_0x365e('0x1a')]=function(_0x47e3ce){var _0x11df57=this;return new Promise(function(_0x56e414,_0x3a4a54){return db[_0x365e('0x1b')][_0x365e('0x1c')](_0x47e3ce[_0x365e('0x1d')],{'raw':_0x47e3ce[_0x365e('0x1e')]?_0x47e3ce[_0x365e('0x1e')][_0x365e('0x1f')]===undefined?!![]:![]:!![]})[_0x365e('0x11')](function(_0x28e085){logger[_0x365e('0x20')]('CreateWhatsappMessage',_0x47e3ce);logger[_0x365e('0x13')](_0x365e('0x1a'),_0x47e3ce,JSON[_0x365e('0x14')](_0x28e085));_0x56e414(_0x28e085);})[_0x365e('0x19')](function(_0x520b7e){logger[_0x365e('0x15')](_0x365e('0x1a'),_0x520b7e[_0x365e('0x18')],_0x47e3ce);_0x3a4a54(_0x11df57[_0x365e('0x15')](0x1f4,_0x520b7e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 24b9c48..e57f113 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 _0x08b3=['emit','register','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x08b3,0x1e3));var _0x308b=function(_0x4602bc,_0x41c46e){_0x4602bc=_0x4602bc-0x0;var _0x2c231f=_0x08b3[_0x4602bc];return _0x2c231f;};'use strict';var WhatsappMessageEvents=require(_0x308b('0x0'));var events=['save',_0x308b('0x1'),_0x308b('0x2')];function createListener(_0x3b68f7,_0x161c61){return function(_0x1d7581){_0x161c61[_0x308b('0x3')](_0x3b68f7,_0x1d7581);};}function removeListener(_0x10e3f4,_0x573544){return function(){WhatsappMessageEvents['removeListener'](_0x10e3f4,_0x573544);};}exports[_0x308b('0x4')]=function(_0x2abc81){for(var _0x3faed4=0x0,_0xedc45c=events['length'];_0x3faed4<_0xedc45c;_0x3faed4++){var _0x47ac2f=events[_0x3faed4];var _0x17d634=createListener(_0x308b('0x5')+_0x47ac2f,_0x2abc81);WhatsappMessageEvents['on'](_0x47ac2f,_0x17d634);}}; \ No newline at end of file +var _0x1138=['removeListener','register','./whatsappMessage.events','save','remove','update','emit'];(function(_0x1a20ac,_0xcc1ac7){var _0x58f07b=function(_0x1ede7b){while(--_0x1ede7b){_0x1a20ac['push'](_0x1a20ac['shift']());}};_0x58f07b(++_0xcc1ac7);}(_0x1138,0x9c));var _0x8113=function(_0x76a7ae,_0x490d47){_0x76a7ae=_0x76a7ae-0x0;var _0x12eeb4=_0x1138[_0x76a7ae];return _0x12eeb4;};'use strict';var WhatsappMessageEvents=require(_0x8113('0x0'));var events=[_0x8113('0x1'),_0x8113('0x2'),_0x8113('0x3')];function createListener(_0x2963c4,_0x3199d0){return function(_0x263679){_0x3199d0[_0x8113('0x4')](_0x2963c4,_0x263679);};}function removeListener(_0x3a99f3,_0x3307b4){return function(){WhatsappMessageEvents[_0x8113('0x5')](_0x3a99f3,_0x3307b4);};}exports[_0x8113('0x6')]=function(_0x26cc5c){for(var _0x5929fe=0x0,_0x54ca0f=events['length'];_0x5929fe<_0x54ca0f;_0x5929fe++){var _0x1e920d=events[_0x5929fe];var _0x49ae17=createListener('whatsappMessage:'+_0x1e920d,_0x26cc5c);WhatsappMessageEvents['on'](_0x1e920d,_0x49ae17);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index bc90301..b28fd67 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 _0xb75d=['post','put','update','delete','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x28b19f,_0x3c3092){var _0x3e6243=function(_0x4c2aae){while(--_0x4c2aae){_0x28b19f['push'](_0x28b19f['shift']());}};_0x3e6243(++_0x3c3092);}(_0xb75d,0x66));var _0xdb75=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xb75d[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0xdb75('0x0'));var util=require('util');var path=require(_0xdb75('0x1'));var timeout=require(_0xdb75('0x2'));var express=require(_0xdb75('0x3'));var router=express[_0xdb75('0x4')]();var auth=require(_0xdb75('0x5'));var interaction=require(_0xdb75('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xdb75('0x7')]('/',auth[_0xdb75('0x8')](),controller['index']);router[_0xdb75('0x7')](_0xdb75('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xdb75('0x7')](_0xdb75('0xa'),auth[_0xdb75('0x8')](),controller[_0xdb75('0xb')]);router[_0xdb75('0x7')](_0xdb75('0xc'),auth[_0xdb75('0x8')](),controller[_0xdb75('0xd')]);router['get'](_0xdb75('0xe'),auth['isAuthenticated'](),controller[_0xdb75('0xf')]);router['get'](_0xdb75('0x10'),auth[_0xdb75('0x8')](),controller[_0xdb75('0x11')]);router[_0xdb75('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdb75('0x12')](_0xdb75('0xe'),auth[_0xdb75('0x8')](),controller['addTeams']);router[_0xdb75('0x12')](_0xdb75('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xdb75('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xdb75('0x14')]);router[_0xdb75('0x15')](_0xdb75('0xa'),auth[_0xdb75('0x8')](),controller['destroy']);router['delete'](_0xdb75('0xe'),auth['isAuthenticated'](),controller[_0xdb75('0x16')]);router['delete'](_0xdb75('0x10'),auth[_0xdb75('0x8')](),controller[_0xdb75('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe96b=['addAgents','/:id','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','isAuthenticated','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x28c2fc,_0x5f2c2f){var _0x4795a8=function(_0x40c4e2){while(--_0x40c4e2){_0x28c2fc['push'](_0x28c2fc['shift']());}};_0x4795a8(++_0x5f2c2f);}(_0xe96b,0x114));var _0xbe96=function(_0x49395c,_0x4996d0){_0x49395c=_0x49395c-0x0;var _0x4d9d52=_0xe96b[_0x49395c];return _0x4d9d52;};'use strict';var multer=require(_0xbe96('0x0'));var util=require(_0xbe96('0x1'));var path=require('path');var timeout=require(_0xbe96('0x2'));var express=require('express');var router=express[_0xbe96('0x3')]();var auth=require(_0xbe96('0x4'));var interaction=require(_0xbe96('0x5'));var config=require(_0xbe96('0x6'));var controller=require(_0xbe96('0x7'));router[_0xbe96('0x8')]('/',auth['isAuthenticated'](),controller[_0xbe96('0x9')]);router[_0xbe96('0x8')]('/describe',auth[_0xbe96('0xa')](),controller[_0xbe96('0xb')]);router[_0xbe96('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbe96('0xc')]);router['get'](_0xbe96('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe96('0x8')](_0xbe96('0xe'),auth[_0xbe96('0xa')](),controller[_0xbe96('0xf')]);router[_0xbe96('0x8')](_0xbe96('0x10'),auth[_0xbe96('0xa')](),controller[_0xbe96('0x11')]);router[_0xbe96('0x12')]('/',auth[_0xbe96('0xa')](),controller[_0xbe96('0x13')]);router[_0xbe96('0x12')]('/:id/teams',auth[_0xbe96('0xa')](),controller[_0xbe96('0x14')]);router[_0xbe96('0x12')](_0xbe96('0x10'),auth[_0xbe96('0xa')](),controller[_0xbe96('0x15')]);router['put'](_0xbe96('0x16'),auth[_0xbe96('0xa')](),controller['update']);router[_0xbe96('0x17')](_0xbe96('0x16'),auth[_0xbe96('0xa')](),controller['destroy']);router[_0xbe96('0x17')](_0xbe96('0xe'),auth[_0xbe96('0xa')](),controller[_0xbe96('0x18')]);router[_0xbe96('0x17')](_0xbe96('0x10'),auth['isAuthenticated'](),controller[_0xbe96('0x19')]);module[_0xbe96('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 20f449d..6f8e50c 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 _0xd217=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5bd2f4,_0x55b797){var _0x4412c0=function(_0x2a3c26){while(--_0x2a3c26){_0x5bd2f4['push'](_0x5bd2f4['shift']());}};_0x4412c0(++_0x55b797);}(_0xd217,0xfd));var _0x7d21=function(_0x230591,_0x4a5f2c){_0x230591=_0x230591-0x0;var _0x45db9e=_0xd217[_0x230591];return _0x45db9e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7d21('0x0')],'unique':_0x7d21('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7d21('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d21('0x3')](_0x7d21('0x4'),_0x7d21('0x5'),_0x7d21('0x6'))},'description':{'type':Sequelize[_0x7d21('0x0')]}}; \ No newline at end of file +var _0xb3db=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','exports'];(function(_0x469d16,_0x2facc2){var _0x44a2a4=function(_0x13a834){while(--_0x13a834){_0x469d16['push'](_0x469d16['shift']());}};_0x44a2a4(++_0x2facc2);}(_0xb3db,0xbb));var _0xbb3d=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0xb3db[_0x1cb0b4];return _0x525b60;};'use strict';var Sequelize=require(_0xbb3d('0x0'));module[_0xbb3d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbb3d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbb3d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb3d('0x4')](_0xbb3d('0x5'),_0xbb3d('0x6'),_0xbb3d('0x7'))},'description':{'type':Sequelize[_0xbb3d('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b6fd164..1793673 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 _0x277d=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','WhatsappQueues','UserProfileResource','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','WhatsappQueue','findAll','rows','rawAttributes','find','catch','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','update','describe','findOne','params','UserWhatsappQueue','hasOwnProperty','order','WhatsappQueueId','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeAgents','userWhatsappQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch'];(function(_0x48d704,_0x4a8f22){var _0x37be5c=function(_0x40b2e1){while(--_0x40b2e1){_0x48d704['push'](_0x48d704['shift']());}};_0x37be5c(++_0x4a8f22);}(_0x277d,0x195));var _0xd277=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x277d[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd277('0x0'));var rimraf=require(_0xd277('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd277('0x2'));var rp=require(_0xd277('0x3'));var moment=require(_0xd277('0x4'));var BPromise=require(_0xd277('0x5'));var Mustache=require(_0xd277('0x6'));var util=require(_0xd277('0x7'));var path=require(_0xd277('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd277('0x9'));var fs=require('fs');var _=require(_0xd277('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd277('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd277('0xc'));var querystring=require(_0xd277('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd277('0xe'));var as=require(_0xd277('0xf'));var hardwareService=require(_0xd277('0x10'));var logger=require(_0xd277('0x11'))(_0xd277('0x12'));var utils=require(_0xd277('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd277('0x14'))['db'];config[_0xd277('0x15')]=_[_0xd277('0x16')](config[_0xd277('0x15')],{'host':_0xd277('0x17'),'port':0x18eb});var socket=require(_0xd277('0x18'))(new Redis(config[_0xd277('0x15')]));require(_0xd277('0x19'))[_0xd277('0x1a')](socket);function respondWithStatusCode(_0x4b7cdc,_0x10f969){_0x10f969=_0x10f969||0xcc;return function(_0x3085eb){if(_0x3085eb){return _0x4b7cdc[_0xd277('0x1b')](_0x10f969);}return _0x4b7cdc[_0xd277('0x1c')](_0x10f969)[_0xd277('0x1d')]();};}function respondWithResult(_0x1eb6c9,_0x17e101){_0x17e101=_0x17e101||0xc8;return function(_0x26e587){if(_0x26e587){return _0x1eb6c9['status'](_0x17e101)[_0xd277('0x1e')](_0x26e587);}};}function respondWithFilteredResult(_0x2293f8,_0x40efee){return function(_0x9749d0){if(_0x9749d0){var _0x3cbb77=_0x9749d0[_0xd277('0x1f')],_0x15efc7=_0x40efee[_0xd277('0x20')],_0x89fdeb=_0x40efee[_0xd277('0x20')]+_0x40efee[_0xd277('0x21')],_0xcad62f;if(_0x89fdeb>=_0x3cbb77){_0x89fdeb=_0x3cbb77;_0xcad62f=0xc8;}else{_0xcad62f=0xce;}_0x2293f8['status'](_0xcad62f);return _0x2293f8[_0xd277('0x22')](_0xd277('0x23'),_0x15efc7+'-'+_0x89fdeb+'/'+_0x3cbb77)[_0xd277('0x1e')](_0x9749d0);}return null;};}function patchUpdates(_0xb727f1){return function(_0x22bbec){try{jsonpatch['apply'](_0x22bbec,_0xb727f1,!![]);}catch(_0x377526){return BPromise[_0xd277('0x24')](_0x377526);}return _0x22bbec['save']();};}function saveUpdates(_0x249214,_0x61a44b){return function(_0x5f1b8a){if(_0x5f1b8a){return _0x5f1b8a['update'](_0x249214)[_0xd277('0x25')](function(_0x1d851e){return _0x1d851e;});}return null;};}function removeEntity(_0x297d9a,_0x3e69fc){return function(_0x1a8b9a){if(_0x1a8b9a){return _0x1a8b9a[_0xd277('0x26')]()['then'](function(){var _0x9c23a6=_0x1a8b9a['get']({'plain':!![]});var _0x44ece1=_0xd277('0x27');return db[_0xd277('0x28')][_0xd277('0x26')]({'where':{'type':_0x44ece1,'resourceId':_0x9c23a6['id']}})[_0xd277('0x25')](function(){return _0x1a8b9a;});})[_0xd277('0x25')](function(){_0x297d9a['status'](0xcc)[_0xd277('0x1d')]();});}};}function handleEntityNotFound(_0x4971a3,_0x272f18){return function(_0x3d5fd5){if(!_0x3d5fd5){_0x4971a3[_0xd277('0x1b')](0x194);}return _0x3d5fd5;};}function handleError(_0x453998,_0x48464a){_0x48464a=_0x48464a||0x1f4;return function(_0x2040c1){logger['error'](_0x2040c1[_0xd277('0x29')]);if(_0x2040c1[_0xd277('0x2a')]){delete _0x2040c1[_0xd277('0x2a')];}_0x453998[_0xd277('0x1c')](_0x48464a)[_0xd277('0x2b')](_0x2040c1);};}exports['index']=function(_0x415487,_0x2f3f5e){var _0x2397a1={},_0x361d49={},_0x58f5a7={'count':0x0,'rows':[]};var _0x16379b=_[_0xd277('0x2c')](db['WhatsappQueue']['rawAttributes'],function(_0x39534d){return{'name':_0x39534d[_0xd277('0x2d')],'type':_0x39534d[_0xd277('0x2e')][_0xd277('0x2f')]};});_0x361d49[_0xd277('0x30')]=_['map'](_0x16379b,_0xd277('0x2a'));_0x361d49[_0xd277('0x31')]=_[_0xd277('0x32')](_0x415487['query']);_0x361d49['filters']=_[_0xd277('0x33')](_0x361d49[_0xd277('0x30')],_0x361d49[_0xd277('0x31')]);_0x2397a1['attributes']=_[_0xd277('0x33')](_0x361d49[_0xd277('0x30')],qs[_0xd277('0x34')](_0x415487[_0xd277('0x31')]['fields']));_0x2397a1[_0xd277('0x35')]=_0x2397a1[_0xd277('0x35')][_0xd277('0x36')]?_0x2397a1[_0xd277('0x35')]:_0x361d49['model'];if(!_0x415487[_0xd277('0x31')]['hasOwnProperty'](_0xd277('0x37'))){_0x2397a1[_0xd277('0x21')]=qs[_0xd277('0x21')](_0x415487[_0xd277('0x31')][_0xd277('0x21')]);_0x2397a1[_0xd277('0x20')]=qs[_0xd277('0x20')](_0x415487[_0xd277('0x31')]['offset']);}_0x2397a1['order']=qs[_0xd277('0x38')](_0x415487[_0xd277('0x31')][_0xd277('0x38')]);_0x2397a1[_0xd277('0x39')]=qs['filters'](_[_0xd277('0x3a')](_0x415487['query'],_0x361d49[_0xd277('0x3b')]),_0x16379b);if(_0x415487['query'][_0xd277('0x3c')]){_0x2397a1['where']=_['merge'](_0x2397a1[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x16379b,function(_0x30c5d2){if(_0x30c5d2[_0xd277('0x2e')]!==_0xd277('0x3d')){var _0x1b7f51={};_0x1b7f51[_0x30c5d2[_0xd277('0x2a')]]={'$like':'%'+_0x415487[_0xd277('0x31')][_0xd277('0x3c')]+'%'};return _0x1b7f51;}})});}_0x2397a1=_[_0xd277('0x3e')]({},_0x2397a1,_0x415487[_0xd277('0x3f')]);var _0x346fd9={'where':_0x2397a1[_0xd277('0x39')]};return db['WhatsappQueue'][_0xd277('0x1f')](_0x346fd9)[_0xd277('0x25')](function(_0x2a64d8){_0x58f5a7['count']=_0x2a64d8;if(_0x415487[_0xd277('0x31')][_0xd277('0x40')]){_0x2397a1[_0xd277('0x41')]=[{'all':!![]}];}return db[_0xd277('0x42')][_0xd277('0x43')](_0x2397a1);})[_0xd277('0x25')](function(_0x301f0d){_0x58f5a7[_0xd277('0x44')]=_0x301f0d;return _0x58f5a7;})[_0xd277('0x25')](respondWithFilteredResult(_0x2f3f5e,_0x2397a1))['catch'](handleError(_0x2f3f5e,null));};exports['show']=function(_0x5c12c9,_0x42431c){var _0x3d05e6={'raw':!![],'where':{'id':_0x5c12c9['params']['id']}},_0x33ad51={};_0x33ad51[_0xd277('0x30')]=_[_0xd277('0x32')](db[_0xd277('0x42')][_0xd277('0x45')]);_0x33ad51[_0xd277('0x31')]=_[_0xd277('0x32')](_0x5c12c9[_0xd277('0x31')]);_0x33ad51[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x33ad51[_0xd277('0x30')],_0x33ad51[_0xd277('0x31')]);_0x3d05e6[_0xd277('0x35')]=_[_0xd277('0x33')](_0x33ad51[_0xd277('0x30')],qs[_0xd277('0x34')](_0x5c12c9[_0xd277('0x31')]['fields']));_0x3d05e6[_0xd277('0x35')]=_0x3d05e6[_0xd277('0x35')][_0xd277('0x36')]?_0x3d05e6[_0xd277('0x35')]:_0x33ad51['model'];if(_0x5c12c9[_0xd277('0x31')][_0xd277('0x40')]){_0x3d05e6['include']=[{'all':!![]}];}_0x3d05e6=_['merge']({},_0x3d05e6,_0x5c12c9[_0xd277('0x3f')]);return db[_0xd277('0x42')][_0xd277('0x46')](_0x3d05e6)[_0xd277('0x25')](handleEntityNotFound(_0x42431c,null))[_0xd277('0x25')](respondWithResult(_0x42431c,null))[_0xd277('0x47')](handleError(_0x42431c,null));};exports[_0xd277('0x48')]=function(_0x5d1a6f,_0x1bef2b){return db['WhatsappQueue']['create'](_0x5d1a6f[_0xd277('0x49')],{})[_0xd277('0x25')](function(_0x368e8d){var _0x2b2daf=_0x5d1a6f[_0xd277('0x4a')][_0xd277('0x4b')]({'plain':!![]});if(!_0x2b2daf)throw new Error(_0xd277('0x4c'));if(_0x2b2daf[_0xd277('0x4d')]===_0xd277('0x4a')){var _0x31bf5a=_0x368e8d[_0xd277('0x4b')]({'plain':!![]});var _0x19c81d=_0xd277('0x27');return db[_0xd277('0x4e')][_0xd277('0x46')]({'where':{'name':_0x19c81d,'userProfileId':_0x2b2daf[_0xd277('0x4f')]},'raw':!![]})[_0xd277('0x25')](function(_0x4bbd86){if(_0x4bbd86&&_0x4bbd86[_0xd277('0x50')]===0x0){return db[_0xd277('0x28')][_0xd277('0x48')]({'name':_0x31bf5a[_0xd277('0x2a')],'resourceId':_0x31bf5a['id'],'type':_0x4bbd86['name'],'sectionId':_0x4bbd86['id']},{})['then'](function(){return _0x368e8d;});}else{return _0x368e8d;}})['catch'](function(_0x2a6147){logger[_0xd277('0x51')](_0xd277('0x52'),_0x2a6147);throw _0x2a6147;});}return _0x368e8d;})[_0xd277('0x25')](respondWithResult(_0x1bef2b,0xc9))[_0xd277('0x47')](handleError(_0x1bef2b,null));};exports[_0xd277('0x53')]=function(_0x2ac4aa,_0x4ac32a){if(_0x2ac4aa[_0xd277('0x49')]['id']){delete _0x2ac4aa[_0xd277('0x49')]['id'];}return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x2ac4aa['params']['id']}})['then'](handleEntityNotFound(_0x4ac32a,null))[_0xd277('0x25')](saveUpdates(_0x2ac4aa[_0xd277('0x49')],null))[_0xd277('0x25')](respondWithResult(_0x4ac32a,null))[_0xd277('0x47')](handleError(_0x4ac32a,null));};exports['destroy']=function(_0x4ae4d1,_0x4a6ce4){return db['WhatsappQueue'][_0xd277('0x46')]({'where':{'id':_0x4ae4d1['params']['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x4a6ce4,null))['then'](removeEntity(_0x4a6ce4,null))['catch'](handleError(_0x4a6ce4,null));};exports['describe']=function(_0x5c0862,_0x5edd7a){return db['WhatsappQueue'][_0xd277('0x54')]()[_0xd277('0x25')](respondWithResult(_0x5edd7a,null))[_0xd277('0x47')](handleError(_0x5edd7a,null));};exports['getMembers']=function(_0x3b6c37,_0x4a5159,_0x478e8a){var _0x25e2af={'raw':!![],'where':{}},_0x4f349e={},_0x4bba3f;return db[_0xd277('0x42')][_0xd277('0x55')]({'where':{'id':_0x3b6c37[_0xd277('0x56')]['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x4a5159,null))['then'](function(_0x547994){if(_0x547994){_0x4bba3f=_0x547994[_0xd277('0x4b')]({'plain':!![]});_0x4f349e[_0xd277('0x30')]=_[_0xd277('0x32')](db[_0xd277('0x57')][_0xd277('0x45')]);_0x4f349e['query']=_[_0xd277('0x32')](_0x3b6c37[_0xd277('0x31')]);_0x4f349e[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x4f349e[_0xd277('0x30')],_0x4f349e[_0xd277('0x31')]);_0x25e2af[_0xd277('0x35')]=_[_0xd277('0x33')](_0x4f349e['model'],qs[_0xd277('0x34')](_0x3b6c37[_0xd277('0x31')][_0xd277('0x34')]));_0x25e2af[_0xd277('0x35')]=_0x25e2af['attributes'][_0xd277('0x36')]?_0x25e2af[_0xd277('0x35')]:_0x4f349e[_0xd277('0x30')];if(!_0x3b6c37[_0xd277('0x31')][_0xd277('0x58')](_0xd277('0x37'))){_0x25e2af[_0xd277('0x21')]=qs['limit'](_0x3b6c37[_0xd277('0x31')][_0xd277('0x21')]);_0x25e2af[_0xd277('0x20')]=qs[_0xd277('0x20')](_0x3b6c37[_0xd277('0x31')][_0xd277('0x20')]);}_0x25e2af[_0xd277('0x59')]=qs[_0xd277('0x38')](_0x3b6c37[_0xd277('0x31')]['sort']);_0x25e2af[_0xd277('0x39')]=qs[_0xd277('0x3b')](_[_0xd277('0x3a')](_0x3b6c37[_0xd277('0x31')],_0x4f349e[_0xd277('0x3b')]));_0x25e2af[_0xd277('0x39')][_0xd277('0x5a')]=_0x547994['id'];if(_0x3b6c37[_0xd277('0x31')][_0xd277('0x3c')]){_0x25e2af[_0xd277('0x39')]=_['merge'](_0x25e2af[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x25e2af[_0xd277('0x35')],function(_0x587f9a){var _0x5e2f1a={};_0x5e2f1a[_0x587f9a]={'$like':'%'+_0x3b6c37[_0xd277('0x31')][_0xd277('0x3c')]+'%'};return _0x5e2f1a;})});}_0x25e2af=_[_0xd277('0x3e')]({},_0x25e2af,_0x3b6c37[_0xd277('0x3f')]);return db[_0xd277('0x57')][_0xd277('0x43')](_0x25e2af);}})['then'](function(_0x4b7615){if(_0x4b7615){return db['User'][_0xd277('0x5b')]({'where':{'id':_['map'](_0x4b7615,_0xd277('0x5c')),'role':'agent'},'attributes':['id','name',_0xd277('0x5d'),_0xd277('0x5e'),'createdAt']});}})['then'](function(_0x4191a1){if(_0x4191a1){return{'count':_0x4191a1[_0xd277('0x1f')],'rows':_[_0xd277('0x2c')](_0x4191a1[_0xd277('0x44')],function(_0xcb3fe0){return{'membername':_0xcb3fe0['name'],'UserId':_0xcb3fe0['id'],'queue_name':_0x4bba3f[_0xd277('0x2a')],'WhatsappQueueId':_0x4bba3f['id'],'interface':util[_0xd277('0x5f')](_0xd277('0x60'),_0xd277('0x61'),_0xcb3fe0[_0xd277('0x2a')]),'penalty':0x0,'paused':_0xcb3fe0[_0xd277('0x5d')],'createdAt':_0xcb3fe0[_0xd277('0x62')],'updatedAt':_0xcb3fe0[_0xd277('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd277('0x25')](respondWithFilteredResult(_0x4a5159,_0x25e2af))[_0xd277('0x47')](handleError(_0x4a5159,null));};exports['getTeams']=function(_0x1cd5e1,_0x5c4c4f,_0x302d0d){var _0x5bdb83={};var _0x3ee4fd={};var _0x1c5767;var _0x56c80b;return db[_0xd277('0x42')][_0xd277('0x55')]({'where':{'id':_0x1cd5e1[_0xd277('0x56')]['id']}})['then'](handleEntityNotFound(_0x5c4c4f,null))[_0xd277('0x25')](function(_0x475320){if(_0x475320){_0x1c5767=_0x475320;_0x3ee4fd[_0xd277('0x30')]=_[_0xd277('0x32')](db[_0xd277('0x63')][_0xd277('0x45')]);_0x3ee4fd['query']=_[_0xd277('0x32')](_0x1cd5e1[_0xd277('0x31')]);_0x3ee4fd[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x3ee4fd['model'],_0x3ee4fd[_0xd277('0x31')]);_0x5bdb83['attributes']=_['intersection'](_0x3ee4fd[_0xd277('0x30')],qs[_0xd277('0x34')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x34')]));_0x5bdb83[_0xd277('0x35')]=_0x5bdb83[_0xd277('0x35')][_0xd277('0x36')]?_0x5bdb83[_0xd277('0x35')]:_0x3ee4fd['model'];_0x5bdb83[_0xd277('0x59')]=qs[_0xd277('0x38')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x38')]);_0x5bdb83[_0xd277('0x39')]=qs['filters'](_[_0xd277('0x3a')](_0x1cd5e1[_0xd277('0x31')],_0x3ee4fd[_0xd277('0x3b')]));if(_0x1cd5e1[_0xd277('0x31')]['filter']){_0x5bdb83[_0xd277('0x39')]=_[_0xd277('0x3e')](_0x5bdb83[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x5bdb83[_0xd277('0x35')],function(_0x514115){var _0x3951b5={};_0x3951b5[_0x514115]={'$like':'%'+_0x1cd5e1[_0xd277('0x31')]['filter']+'%'};return _0x3951b5;})});}_0x5bdb83=_[_0xd277('0x3e')]({},_0x5bdb83,_0x1cd5e1[_0xd277('0x3f')]);return _0x1c5767[_0xd277('0x64')](_0x5bdb83);}})[_0xd277('0x25')](function(_0x5a1cc6){if(_0x5a1cc6){_0x56c80b=_0x5a1cc6['length'];if(!_0x1cd5e1[_0xd277('0x31')][_0xd277('0x58')](_0xd277('0x37'))){_0x5bdb83['limit']=qs[_0xd277('0x21')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x21')]);_0x5bdb83[_0xd277('0x20')]=qs[_0xd277('0x20')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x20')]);}return _0x1c5767[_0xd277('0x64')](_0x5bdb83);}})[_0xd277('0x25')](function(_0x1c389a){if(_0x1c389a){return _0x1c389a?{'count':_0x56c80b,'rows':_0x1c389a}:null;}})[_0xd277('0x25')](respondWithResult(_0x5c4c4f,null))[_0xd277('0x47')](handleError(_0x5c4c4f,null));};exports[_0xd277('0x65')]=function(_0x361365,_0x2b6165,_0x55b450){var _0x5bc51d=_0x361365['body'][_0xd277('0x66')];return db[_0xd277('0x63')][_0xd277('0x43')]({'where':{'id':_0x5bc51d},'attributes':['id'],'include':[{'model':db[_0xd277('0x67')],'as':_0xd277('0x68'),'attributes':['id',_0xd277('0x2a'),_0xd277('0x69'),_0xd277('0x6a'),'interface'],'raw':!![]}]})['then'](function(_0x591cb8){if(_0x591cb8){var _0x176da5=_[_0xd277('0x6b')](_0x591cb8,function(_0x532cc8){var _0x5feb15=_0x532cc8[_0xd277('0x4b')]({'plain':!![]});return _0x5feb15[_0xd277('0x68')];});return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x361365['params']['id']}})[_0xd277('0x25')](function(_0x21c9b6){return db[_0xd277('0x6c')][_0xd277('0x6d')](function(_0x7c5553){return _0x21c9b6[_0xd277('0x65')](_0x5bc51d,{'transaction':_0x7c5553})[_0xd277('0x25')](function(){return BPromise[_0xd277('0x6e')](_0x176da5,function(_0x5e7743){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x5e7743['id'],'WhatsappQueueId':_0x361365[_0xd277('0x56')]['id']},'transaction':_0x7c5553});});})['then'](function(){_0x176da5[_0xd277('0x6f')](function(_0x1c6674){socket[_0xd277('0x70')](_0xd277('0x71'),{'UserId':_0x1c6674['id'],'WhatsappQueueId':_0x21c9b6['id']});});});});});}})[_0xd277('0x25')](respondWithStatusCode(_0x2b6165,null))['catch'](handleError(_0x2b6165,null));};exports[_0xd277('0x72')]=function(_0x12e353,_0x4f08a2,_0x45cb20){return db[_0xd277('0x63')][_0xd277('0x43')]({'where':{'id':_0x12e353[_0xd277('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd277('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4f08a2,null))[_0xd277('0x25')](function(_0x327db9){var _0x25a54b=_[_0xd277('0x2c')](_0x327db9,'id');var _0x36c8f4=[];var _0x34bf95=[];var _0x50447a=squel[_0xd277('0x73')]();_0x50447a[_0xd277('0x74')]('tq.TeamId')[_0xd277('0x75')](_0xd277('0x76'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd277('0x39')]('WhatsappQueueId\x20=\x20?',_0x12e353[_0xd277('0x56')]['id']);for(var _0x2f3b42=0x0;_0x2f3b42<_0x327db9['length'];_0x2f3b42+=0x1){let _0x4d659f=_0x327db9[_0x2f3b42];for(var _0x251f29=0x0;_0x251f29<_0x4d659f[_0xd277('0x68')][_0xd277('0x36')];_0x251f29+=0x1){let _0x458861=_0x4d659f[_0xd277('0x68')][_0x251f29];var _0x3c525f=_0x50447a[_0xd277('0x77')]();_0x3c525f[_0xd277('0x39')](_0xd277('0x78'),_0x458861['id']);_0x34bf95[_0xd277('0x79')](db[_0xd277('0x6c')][_0xd277('0x31')](_0x3c525f[_0xd277('0x7a')](),{'type':db[_0xd277('0x6c')][_0xd277('0x7b')][_0xd277('0x7c')]})['then'](function(_0x123583){if(_0x123583['length']===0x1){return _0x458861['id'];}else{var _0x2638a8=_[_0xd277('0x7d')](_[_0xd277('0x2c')](_0x123583,'TeamId'),function(_0x1e299c){return _[_0xd277('0x7e')](_0x25a54b,_0x1e299c);});if(_0x2638a8){return _0x458861['id'];}}}));}}return BPromise['all'](_0x34bf95)[_0xd277('0x25')](function(_0x490bcb){_0x36c8f4=_(_0x36c8f4)[_0xd277('0x7f')](_0x490bcb)[_0xd277('0x80')]()[_0xd277('0x81')]();return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x12e353[_0xd277('0x56')]['id']}})[_0xd277('0x25')](function(_0x5ca501){return db[_0xd277('0x6c')][_0xd277('0x6d')](function(_0x3586fc){return _0x5ca501[_0xd277('0x72')](_0x12e353[_0xd277('0x31')][_0xd277('0x66')],{'transaction':_0x3586fc})[_0xd277('0x25')](function(){if(!_['isEmpty'](_0x36c8f4)){return _0x5ca501[_0xd277('0x82')](_0x36c8f4,{'transaction':_0x3586fc});}})['then'](function(){_0x36c8f4[_0xd277('0x6f')](function(_0x48ee74){socket['emit'](_0xd277('0x83'),{'UserId':_0x48ee74,'WhatsappQueueId':_0x5ca501['id']});});});});});});})[_0xd277('0x25')](respondWithStatusCode(_0x4f08a2,null))['catch'](handleError(_0x4f08a2,null));};exports['addAgents']=function(_0x3cb993,_0x25b14d,_0x120216){return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x3cb993['params']['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x25b14d,null))[_0xd277('0x25')](function(_0x56a148){if(_0x56a148){return _0x56a148['addAgents'](_0x3cb993['body']['ids'],_[_0xd277('0x84')](_0x3cb993['body'],[_0xd277('0x66'),'id'])||{})[_0xd277('0x85')](function(_0x883f6a){for(var _0x4c78dc=0x0;_0x4c78dc<_0x3cb993['body'][_0xd277('0x66')][_0xd277('0x36')];_0x4c78dc+=0x1){socket[_0xd277('0x70')](_0xd277('0x71'),{'UserId':_0x3cb993[_0xd277('0x49')][_0xd277('0x66')][_0x4c78dc],'WhatsappQueueId':_0x3cb993[_0xd277('0x56')]['id']});}return _0x883f6a;});}})[_0xd277('0x25')](respondWithResult(_0x25b14d,null))['catch'](handleError(_0x25b14d,null));};exports['removeAgents']=function(_0x3b3723,_0x51bac5,_0x5cd38a){return db[_0xd277('0x42')]['find']({'where':{'id':_0x3b3723[_0xd277('0x56')]['id']}})['then'](handleEntityNotFound(_0x51bac5,null))[_0xd277('0x25')](function(_0x4659c1){if(_0x4659c1){return _0x4659c1[_0xd277('0x82')](_0x3b3723[_0xd277('0x31')][_0xd277('0x66')])['then'](function(){if(_[_0xd277('0x86')](_0x3b3723[_0xd277('0x31')][_0xd277('0x66')])){for(var _0x2b86d6=0x0;_0x2b86d6<_0x3b3723[_0xd277('0x31')][_0xd277('0x66')][_0xd277('0x36')];_0x2b86d6+=0x1){socket[_0xd277('0x70')](_0xd277('0x83'),{'UserId':Number(_0x3b3723[_0xd277('0x31')][_0xd277('0x66')][_0x2b86d6]),'WhatsappQueueId':Number(_0x3b3723[_0xd277('0x56')]['id'])});}}else{socket[_0xd277('0x70')](_0xd277('0x83'),{'UserId':Number(_0x3b3723[_0xd277('0x31')][_0xd277('0x66')]),'WhatsappQueueId':Number(_0x3b3723['params']['id'])});}});}})['then'](respondWithStatusCode(_0x51bac5,null))[_0xd277('0x47')](handleError(_0x51bac5,null));};exports[_0xd277('0x87')]=function(_0x4c21ea,_0x3e3b58,_0x5ba86f){var _0x406b0d={};var _0x20b314={};var _0x4e654b;var _0x780380;return db[_0xd277('0x42')][_0xd277('0x55')]({'where':{'id':_0x4c21ea[_0xd277('0x56')]['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x3e3b58,null))[_0xd277('0x25')](function(_0x5b69d){if(_0x5b69d){_0x4e654b=_0x5b69d;_0x20b314['model']=_[_0xd277('0x32')](db['User'][_0xd277('0x45')]);_0x20b314[_0xd277('0x31')]=_[_0xd277('0x32')](_0x4c21ea[_0xd277('0x31')]);_0x20b314[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x20b314[_0xd277('0x30')],_0x20b314[_0xd277('0x31')]);_0x406b0d['attributes']=_[_0xd277('0x33')](_0x20b314['model'],qs[_0xd277('0x34')](_0x4c21ea[_0xd277('0x31')][_0xd277('0x34')]));_0x406b0d[_0xd277('0x35')]=_0x406b0d[_0xd277('0x35')][_0xd277('0x36')]?_0x406b0d[_0xd277('0x35')]:_0x20b314['model'];_0x406b0d[_0xd277('0x59')]=qs[_0xd277('0x38')](_0x4c21ea[_0xd277('0x31')][_0xd277('0x38')]);_0x406b0d['where']=qs[_0xd277('0x3b')](_[_0xd277('0x3a')](_0x4c21ea[_0xd277('0x31')],_0x20b314[_0xd277('0x3b')]));if(_0x4c21ea[_0xd277('0x31')][_0xd277('0x3c')]){_0x406b0d[_0xd277('0x39')]=_[_0xd277('0x3e')](_0x406b0d[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x406b0d['attributes'],function(_0x586c32){var _0x273234={};_0x273234[_0x586c32]={'$like':'%'+_0x4c21ea[_0xd277('0x31')]['filter']+'%'};return _0x273234;})});}_0x406b0d=_[_0xd277('0x3e')]({},_0x406b0d,_0x4c21ea[_0xd277('0x3f')]);return _0x4e654b[_0xd277('0x87')](_0x406b0d);}})[_0xd277('0x25')](function(_0x2269bf){if(_0x2269bf){_0x780380=_0x2269bf[_0xd277('0x36')];if(!_0x4c21ea[_0xd277('0x31')][_0xd277('0x58')](_0xd277('0x37'))){_0x406b0d[_0xd277('0x21')]=qs[_0xd277('0x21')](_0x4c21ea[_0xd277('0x31')]['limit']);_0x406b0d['offset']=qs[_0xd277('0x20')](_0x4c21ea[_0xd277('0x31')]['offset']);}return _0x4e654b[_0xd277('0x87')](_0x406b0d);}})[_0xd277('0x25')](function(_0x2f3940){if(_0x2f3940){return _0x2f3940?{'count':_0x780380,'rows':_0x2f3940}:null;}})[_0xd277('0x25')](respondWithResult(_0x3e3b58,null))[_0xd277('0x47')](handleError(_0x3e3b58,null));}; \ No newline at end of file +var _0xbe79=['interface','Agents','sequelize','forEach','emit','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','isArray','getAgents','html-pdf','rimraf','moment','bluebird','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','offset','limit','Content-Range','json','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAll','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','User','online'];(function(_0x5f0b86,_0x141de0){var _0x186f61=function(_0x13c6e0){while(--_0x13c6e0){_0x5f0b86['push'](_0x5f0b86['shift']());}};_0x186f61(++_0x141de0);}(_0xbe79,0x12a));var _0x9be7=function(_0xc2e39f,_0x11d2c4){_0xc2e39f=_0xc2e39f-0x0;var _0x179006=_0xbe79[_0xc2e39f];return _0x179006;};'use strict';var pdf=require(_0x9be7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9be7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9be7('0x2'));var BPromise=require(_0x9be7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9be7('0x4'));var sox=require(_0x9be7('0x5'));var csv=require(_0x9be7('0x6'));var ejs=require(_0x9be7('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9be7('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x9be7('0x9'));var toCsv=require(_0x9be7('0x6'));var querystring=require(_0x9be7('0xa'));var Papa=require(_0x9be7('0xb'));var Redis=require('ioredis');var authService=require(_0x9be7('0xc'));var qs=require(_0x9be7('0xd'));var as=require(_0x9be7('0xe'));var hardwareService=require(_0x9be7('0xf'));var logger=require(_0x9be7('0x10'))('api');var utils=require(_0x9be7('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9be7('0x12'))['db'];config[_0x9be7('0x13')]=_[_0x9be7('0x14')](config['redis'],{'host':_0x9be7('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9be7('0x16'))[_0x9be7('0x17')](socket);function respondWithStatusCode(_0x51f395,_0x3943cb){_0x3943cb=_0x3943cb||0xcc;return function(_0x2f50b2){if(_0x2f50b2){return _0x51f395[_0x9be7('0x18')](_0x3943cb);}return _0x51f395[_0x9be7('0x19')](_0x3943cb)['end']();};}function respondWithResult(_0x2244ed,_0x4b2c56){_0x4b2c56=_0x4b2c56||0xc8;return function(_0x1a9d0d){if(_0x1a9d0d){return _0x2244ed[_0x9be7('0x19')](_0x4b2c56)['json'](_0x1a9d0d);}};}function respondWithFilteredResult(_0x1fbb89,_0x5ca0e5){return function(_0x52e9bb){if(_0x52e9bb){var _0x4758a3=_0x52e9bb['count'],_0x3f6dfb=_0x5ca0e5[_0x9be7('0x1a')],_0x5a6a53=_0x5ca0e5[_0x9be7('0x1a')]+_0x5ca0e5[_0x9be7('0x1b')],_0x5e731e;if(_0x5a6a53>=_0x4758a3){_0x5a6a53=_0x4758a3;_0x5e731e=0xc8;}else{_0x5e731e=0xce;}_0x1fbb89['status'](_0x5e731e);return _0x1fbb89['set'](_0x9be7('0x1c'),_0x3f6dfb+'-'+_0x5a6a53+'/'+_0x4758a3)[_0x9be7('0x1d')](_0x52e9bb);}return null;};}function patchUpdates(_0x3a3448){return function(_0x1c4081){try{jsonpatch[_0x9be7('0x1e')](_0x1c4081,_0x3a3448,!![]);}catch(_0x16eccd){return BPromise[_0x9be7('0x1f')](_0x16eccd);}return _0x1c4081['save']();};}function saveUpdates(_0x47da54,_0x41d8d7){return function(_0x1762c4){if(_0x1762c4){return _0x1762c4[_0x9be7('0x20')](_0x47da54)[_0x9be7('0x21')](function(_0x4a808e){return _0x4a808e;});}return null;};}function removeEntity(_0x296c02,_0x4f66d6){return function(_0xe38439){if(_0xe38439){return _0xe38439['destroy']()[_0x9be7('0x21')](function(){var _0x186e51=_0xe38439[_0x9be7('0x22')]({'plain':!![]});var _0x1c0499=_0x9be7('0x23');return db[_0x9be7('0x24')][_0x9be7('0x25')]({'where':{'type':_0x1c0499,'resourceId':_0x186e51['id']}})[_0x9be7('0x21')](function(){return _0xe38439;});})[_0x9be7('0x21')](function(){_0x296c02[_0x9be7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2972f0,_0x2be47e){return function(_0x2bae71){if(!_0x2bae71){_0x2972f0[_0x9be7('0x18')](0x194);}return _0x2bae71;};}function handleError(_0x7f9eb5,_0x3c04f2){_0x3c04f2=_0x3c04f2||0x1f4;return function(_0x560275){logger[_0x9be7('0x26')](_0x560275[_0x9be7('0x27')]);if(_0x560275[_0x9be7('0x28')]){delete _0x560275['name'];}_0x7f9eb5[_0x9be7('0x19')](_0x3c04f2)[_0x9be7('0x29')](_0x560275);};}exports[_0x9be7('0x2a')]=function(_0xc36887,_0x2d4613){var _0x52b33d={},_0x32745a={},_0x29a9a6={'count':0x0,'rows':[]};var _0x3a4e40=_[_0x9be7('0x2b')](db[_0x9be7('0x2c')][_0x9be7('0x2d')],function(_0x307e9d){return{'name':_0x307e9d[_0x9be7('0x2e')],'type':_0x307e9d['type'][_0x9be7('0x2f')]};});_0x32745a[_0x9be7('0x30')]=_[_0x9be7('0x2b')](_0x3a4e40,_0x9be7('0x28'));_0x32745a[_0x9be7('0x31')]=_[_0x9be7('0x32')](_0xc36887[_0x9be7('0x31')]);_0x32745a[_0x9be7('0x33')]=_[_0x9be7('0x34')](_0x32745a[_0x9be7('0x30')],_0x32745a[_0x9be7('0x31')]);_0x52b33d['attributes']=_[_0x9be7('0x34')](_0x32745a[_0x9be7('0x30')],qs[_0x9be7('0x35')](_0xc36887[_0x9be7('0x31')]['fields']));_0x52b33d[_0x9be7('0x36')]=_0x52b33d[_0x9be7('0x36')][_0x9be7('0x37')]?_0x52b33d[_0x9be7('0x36')]:_0x32745a['model'];if(!_0xc36887[_0x9be7('0x31')][_0x9be7('0x38')](_0x9be7('0x39'))){_0x52b33d[_0x9be7('0x1b')]=qs[_0x9be7('0x1b')](_0xc36887[_0x9be7('0x31')]['limit']);_0x52b33d[_0x9be7('0x1a')]=qs['offset'](_0xc36887[_0x9be7('0x31')][_0x9be7('0x1a')]);}_0x52b33d[_0x9be7('0x3a')]=qs['sort'](_0xc36887[_0x9be7('0x31')][_0x9be7('0x3b')]);_0x52b33d[_0x9be7('0x3c')]=qs[_0x9be7('0x33')](_[_0x9be7('0x3d')](_0xc36887['query'],_0x32745a[_0x9be7('0x33')]),_0x3a4e40);if(_0xc36887[_0x9be7('0x31')][_0x9be7('0x3e')]){_0x52b33d[_0x9be7('0x3c')]=_['merge'](_0x52b33d[_0x9be7('0x3c')],{'$or':_[_0x9be7('0x2b')](_0x3a4e40,function(_0xb8411c){if(_0xb8411c[_0x9be7('0x3f')]!==_0x9be7('0x40')){var _0x126937={};_0x126937[_0xb8411c[_0x9be7('0x28')]]={'$like':'%'+_0xc36887['query']['filter']+'%'};return _0x126937;}})});}_0x52b33d=_[_0x9be7('0x41')]({},_0x52b33d,_0xc36887[_0x9be7('0x42')]);var _0x23f38d={'where':_0x52b33d[_0x9be7('0x3c')]};return db[_0x9be7('0x2c')][_0x9be7('0x43')](_0x23f38d)[_0x9be7('0x21')](function(_0xd2142c){_0x29a9a6['count']=_0xd2142c;if(_0xc36887[_0x9be7('0x31')][_0x9be7('0x44')]){_0x52b33d[_0x9be7('0x45')]=[{'all':!![]}];}return db[_0x9be7('0x2c')]['findAll'](_0x52b33d);})[_0x9be7('0x21')](function(_0xa8f4fc){_0x29a9a6[_0x9be7('0x46')]=_0xa8f4fc;return _0x29a9a6;})[_0x9be7('0x21')](respondWithFilteredResult(_0x2d4613,_0x52b33d))[_0x9be7('0x47')](handleError(_0x2d4613,null));};exports[_0x9be7('0x48')]=function(_0x446f3d,_0x43ac6a){var _0x2bb0d7={'raw':!![],'where':{'id':_0x446f3d[_0x9be7('0x49')]['id']}},_0x1ed708={};_0x1ed708[_0x9be7('0x30')]=_[_0x9be7('0x32')](db[_0x9be7('0x2c')][_0x9be7('0x2d')]);_0x1ed708[_0x9be7('0x31')]=_[_0x9be7('0x32')](_0x446f3d[_0x9be7('0x31')]);_0x1ed708[_0x9be7('0x33')]=_[_0x9be7('0x34')](_0x1ed708[_0x9be7('0x30')],_0x1ed708['query']);_0x2bb0d7['attributes']=_[_0x9be7('0x34')](_0x1ed708[_0x9be7('0x30')],qs[_0x9be7('0x35')](_0x446f3d[_0x9be7('0x31')][_0x9be7('0x35')]));_0x2bb0d7[_0x9be7('0x36')]=_0x2bb0d7[_0x9be7('0x36')][_0x9be7('0x37')]?_0x2bb0d7['attributes']:_0x1ed708['model'];if(_0x446f3d[_0x9be7('0x31')][_0x9be7('0x44')]){_0x2bb0d7[_0x9be7('0x45')]=[{'all':!![]}];}_0x2bb0d7=_[_0x9be7('0x41')]({},_0x2bb0d7,_0x446f3d[_0x9be7('0x42')]);return db[_0x9be7('0x2c')][_0x9be7('0x4a')](_0x2bb0d7)[_0x9be7('0x21')](handleEntityNotFound(_0x43ac6a,null))[_0x9be7('0x21')](respondWithResult(_0x43ac6a,null))[_0x9be7('0x47')](handleError(_0x43ac6a,null));};exports[_0x9be7('0x4b')]=function(_0x3837b8,_0x1a3a15){return db[_0x9be7('0x2c')][_0x9be7('0x4b')](_0x3837b8['body'],{})['then'](function(_0x49982b){var _0x44c283=_0x3837b8['user']['get']({'plain':!![]});if(!_0x44c283)throw new Error(_0x9be7('0x4c'));if(_0x44c283[_0x9be7('0x4d')]===_0x9be7('0x4e')){var _0x4aa6ad=_0x49982b[_0x9be7('0x22')]({'plain':!![]});var _0x37a0f0=_0x9be7('0x23');return db[_0x9be7('0x4f')][_0x9be7('0x4a')]({'where':{'name':_0x37a0f0,'userProfileId':_0x44c283[_0x9be7('0x50')]},'raw':!![]})[_0x9be7('0x21')](function(_0x1d5263){if(_0x1d5263&&_0x1d5263['autoAssociation']===0x0){return db[_0x9be7('0x24')][_0x9be7('0x4b')]({'name':_0x4aa6ad[_0x9be7('0x28')],'resourceId':_0x4aa6ad['id'],'type':_0x1d5263['name'],'sectionId':_0x1d5263['id']},{})[_0x9be7('0x21')](function(){return _0x49982b;});}else{return _0x49982b;}})[_0x9be7('0x47')](function(_0x2820a2){logger[_0x9be7('0x26')](_0x9be7('0x51'),_0x2820a2);throw _0x2820a2;});}return _0x49982b;})[_0x9be7('0x21')](respondWithResult(_0x1a3a15,0xc9))[_0x9be7('0x47')](handleError(_0x1a3a15,null));};exports[_0x9be7('0x20')]=function(_0x5c22d9,_0x442246){if(_0x5c22d9['body']['id']){delete _0x5c22d9[_0x9be7('0x52')]['id'];}return db[_0x9be7('0x2c')]['find']({'where':{'id':_0x5c22d9['params']['id']}})[_0x9be7('0x21')](handleEntityNotFound(_0x442246,null))[_0x9be7('0x21')](saveUpdates(_0x5c22d9[_0x9be7('0x52')],null))[_0x9be7('0x21')](respondWithResult(_0x442246,null))['catch'](handleError(_0x442246,null));};exports[_0x9be7('0x25')]=function(_0xf408b2,_0x1038ed){return db['WhatsappQueue']['find']({'where':{'id':_0xf408b2[_0x9be7('0x49')]['id']}})[_0x9be7('0x21')](handleEntityNotFound(_0x1038ed,null))[_0x9be7('0x21')](removeEntity(_0x1038ed,null))[_0x9be7('0x47')](handleError(_0x1038ed,null));};exports[_0x9be7('0x53')]=function(_0x15fbe3,_0x5b4a56){return db[_0x9be7('0x2c')][_0x9be7('0x53')]()[_0x9be7('0x21')](respondWithResult(_0x5b4a56,null))[_0x9be7('0x47')](handleError(_0x5b4a56,null));};exports[_0x9be7('0x54')]=function(_0x104351,_0x260304,_0x1b414a){var _0x4cbde7={'raw':!![],'where':{}},_0x43fab8={},_0x55295e;return db['WhatsappQueue'][_0x9be7('0x55')]({'where':{'id':_0x104351['params']['id']}})[_0x9be7('0x21')](handleEntityNotFound(_0x260304,null))['then'](function(_0x21e45c){if(_0x21e45c){_0x55295e=_0x21e45c['get']({'plain':!![]});_0x43fab8[_0x9be7('0x30')]=_['keys'](db[_0x9be7('0x56')][_0x9be7('0x2d')]);_0x43fab8[_0x9be7('0x31')]=_[_0x9be7('0x32')](_0x104351[_0x9be7('0x31')]);_0x43fab8['filters']=_[_0x9be7('0x34')](_0x43fab8[_0x9be7('0x30')],_0x43fab8[_0x9be7('0x31')]);_0x4cbde7[_0x9be7('0x36')]=_[_0x9be7('0x34')](_0x43fab8[_0x9be7('0x30')],qs[_0x9be7('0x35')](_0x104351['query'][_0x9be7('0x35')]));_0x4cbde7[_0x9be7('0x36')]=_0x4cbde7[_0x9be7('0x36')][_0x9be7('0x37')]?_0x4cbde7[_0x9be7('0x36')]:_0x43fab8[_0x9be7('0x30')];if(!_0x104351[_0x9be7('0x31')]['hasOwnProperty'](_0x9be7('0x39'))){_0x4cbde7[_0x9be7('0x1b')]=qs[_0x9be7('0x1b')](_0x104351[_0x9be7('0x31')]['limit']);_0x4cbde7[_0x9be7('0x1a')]=qs[_0x9be7('0x1a')](_0x104351[_0x9be7('0x31')][_0x9be7('0x1a')]);}_0x4cbde7[_0x9be7('0x3a')]=qs[_0x9be7('0x3b')](_0x104351['query']['sort']);_0x4cbde7[_0x9be7('0x3c')]=qs[_0x9be7('0x33')](_['pick'](_0x104351['query'],_0x43fab8[_0x9be7('0x33')]));_0x4cbde7['where'][_0x9be7('0x57')]=_0x21e45c['id'];if(_0x104351['query'][_0x9be7('0x3e')]){_0x4cbde7[_0x9be7('0x3c')]=_['merge'](_0x4cbde7[_0x9be7('0x3c')],{'$or':_[_0x9be7('0x2b')](_0x4cbde7[_0x9be7('0x36')],function(_0x1ae468){var _0x53fa72={};_0x53fa72[_0x1ae468]={'$like':'%'+_0x104351[_0x9be7('0x31')][_0x9be7('0x3e')]+'%'};return _0x53fa72;})});}_0x4cbde7=_[_0x9be7('0x41')]({},_0x4cbde7,_0x104351['options']);return db[_0x9be7('0x56')][_0x9be7('0x58')](_0x4cbde7);}})['then'](function(_0x2fe723){if(_0x2fe723){return db['User'][_0x9be7('0x59')]({'where':{'id':_[_0x9be7('0x2b')](_0x2fe723,_0x9be7('0x5a')),'role':_0x9be7('0x5b')},'attributes':['id',_0x9be7('0x28'),_0x9be7('0x5c'),'updatedAt',_0x9be7('0x5d')]});}})[_0x9be7('0x21')](function(_0x5bdc09){if(_0x5bdc09){return{'count':_0x5bdc09[_0x9be7('0x43')],'rows':_['map'](_0x5bdc09[_0x9be7('0x46')],function(_0x817479){return{'membername':_0x817479['name'],'UserId':_0x817479['id'],'queue_name':_0x55295e[_0x9be7('0x28')],'WhatsappQueueId':_0x55295e['id'],'interface':util[_0x9be7('0x5e')](_0x9be7('0x5f'),_0x9be7('0x60'),_0x817479[_0x9be7('0x28')]),'penalty':0x0,'paused':_0x817479[_0x9be7('0x5c')],'createdAt':_0x817479[_0x9be7('0x5d')],'updatedAt':_0x817479[_0x9be7('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x260304,_0x4cbde7))[_0x9be7('0x47')](handleError(_0x260304,null));};exports[_0x9be7('0x62')]=function(_0x1917a0,_0x3a473e,_0x5884b5){var _0x4b32a9={};var _0x1b8a41={};var _0x4ecb3a;var _0x11678a;return db[_0x9be7('0x2c')][_0x9be7('0x55')]({'where':{'id':_0x1917a0[_0x9be7('0x49')]['id']}})[_0x9be7('0x21')](handleEntityNotFound(_0x3a473e,null))[_0x9be7('0x21')](function(_0x1763bb){if(_0x1763bb){_0x4ecb3a=_0x1763bb;_0x1b8a41[_0x9be7('0x30')]=_[_0x9be7('0x32')](db[_0x9be7('0x63')]['rawAttributes']);_0x1b8a41[_0x9be7('0x31')]=_[_0x9be7('0x32')](_0x1917a0[_0x9be7('0x31')]);_0x1b8a41[_0x9be7('0x33')]=_[_0x9be7('0x34')](_0x1b8a41[_0x9be7('0x30')],_0x1b8a41[_0x9be7('0x31')]);_0x4b32a9[_0x9be7('0x36')]=_[_0x9be7('0x34')](_0x1b8a41['model'],qs[_0x9be7('0x35')](_0x1917a0['query'][_0x9be7('0x35')]));_0x4b32a9[_0x9be7('0x36')]=_0x4b32a9['attributes'][_0x9be7('0x37')]?_0x4b32a9[_0x9be7('0x36')]:_0x1b8a41[_0x9be7('0x30')];_0x4b32a9[_0x9be7('0x3a')]=qs['sort'](_0x1917a0[_0x9be7('0x31')][_0x9be7('0x3b')]);_0x4b32a9[_0x9be7('0x3c')]=qs[_0x9be7('0x33')](_['pick'](_0x1917a0[_0x9be7('0x31')],_0x1b8a41['filters']));if(_0x1917a0[_0x9be7('0x31')][_0x9be7('0x3e')]){_0x4b32a9[_0x9be7('0x3c')]=_[_0x9be7('0x41')](_0x4b32a9[_0x9be7('0x3c')],{'$or':_['map'](_0x4b32a9[_0x9be7('0x36')],function(_0x2e97c1){var _0x465935={};_0x465935[_0x2e97c1]={'$like':'%'+_0x1917a0[_0x9be7('0x31')][_0x9be7('0x3e')]+'%'};return _0x465935;})});}_0x4b32a9=_[_0x9be7('0x41')]({},_0x4b32a9,_0x1917a0[_0x9be7('0x42')]);return _0x4ecb3a[_0x9be7('0x62')](_0x4b32a9);}})[_0x9be7('0x21')](function(_0x1d21d){if(_0x1d21d){_0x11678a=_0x1d21d['length'];if(!_0x1917a0[_0x9be7('0x31')][_0x9be7('0x38')]('nolimit')){_0x4b32a9['limit']=qs[_0x9be7('0x1b')](_0x1917a0[_0x9be7('0x31')][_0x9be7('0x1b')]);_0x4b32a9[_0x9be7('0x1a')]=qs[_0x9be7('0x1a')](_0x1917a0['query'][_0x9be7('0x1a')]);}return _0x4ecb3a[_0x9be7('0x62')](_0x4b32a9);}})['then'](function(_0x3f81cb){if(_0x3f81cb){return _0x3f81cb?{'count':_0x11678a,'rows':_0x3f81cb}:null;}})[_0x9be7('0x21')](respondWithResult(_0x3a473e,null))[_0x9be7('0x47')](handleError(_0x3a473e,null));};exports[_0x9be7('0x64')]=function(_0x5dcfee,_0x3726ae,_0x549aa4){var _0x478f24=_0x5dcfee['body'][_0x9be7('0x65')];return db[_0x9be7('0x63')][_0x9be7('0x58')]({'where':{'id':_0x478f24},'attributes':['id'],'include':[{'model':db[_0x9be7('0x66')],'as':'Agents','attributes':['id','name',_0x9be7('0x67'),'voicePause',_0x9be7('0x68')],'raw':!![]}]})[_0x9be7('0x21')](function(_0x451d1a){if(_0x451d1a){var _0xf2f48e=_['flatMap'](_0x451d1a,function(_0x9d25d2){var _0x15c122=_0x9d25d2[_0x9be7('0x22')]({'plain':!![]});return _0x15c122[_0x9be7('0x69')];});return db[_0x9be7('0x2c')][_0x9be7('0x4a')]({'where':{'id':_0x5dcfee['params']['id']}})[_0x9be7('0x21')](function(_0xc78f9){return db[_0x9be7('0x6a')]['transaction'](function(_0x326dc9){return _0xc78f9['addTeams'](_0x478f24,{'transaction':_0x326dc9})[_0x9be7('0x21')](function(){return BPromise['each'](_0xf2f48e,function(_0x7841e2){return db[_0x9be7('0x56')]['findOrCreate']({'where':{'UserId':_0x7841e2['id'],'WhatsappQueueId':_0x5dcfee['params']['id']},'transaction':_0x326dc9});});})[_0x9be7('0x21')](function(){_0xf2f48e[_0x9be7('0x6b')](function(_0x379789){socket[_0x9be7('0x6c')]('userWhatsappQueue:save',{'UserId':_0x379789['id'],'WhatsappQueueId':_0xc78f9['id']});});});});});}})[_0x9be7('0x21')](respondWithStatusCode(_0x3726ae,null))[_0x9be7('0x47')](handleError(_0x3726ae,null));};exports[_0x9be7('0x6d')]=function(_0x45bb92,_0x366e4d,_0x11a2a5){return db['Team'][_0x9be7('0x58')]({'where':{'id':_0x45bb92[_0x9be7('0x31')][_0x9be7('0x65')]},'attributes':['id'],'include':[{'model':db[_0x9be7('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9be7('0x21')](handleEntityNotFound(_0x366e4d,null))[_0x9be7('0x21')](function(_0x1db319){var _0x58ba7c=_[_0x9be7('0x2b')](_0x1db319,'id');var _0x15c45c=[];var _0x3e197d=[];var _0xcaccd=squel['select']();_0xcaccd['field'](_0x9be7('0x6e'))[_0x9be7('0x6f')]('team_has_whatsapp_queues','tq')[_0x9be7('0x70')](_0x9be7('0x71'),'ut',_0x9be7('0x72'))[_0x9be7('0x3c')]('WhatsappQueueId\x20=\x20?',_0x45bb92[_0x9be7('0x49')]['id']);for(var _0x41b454=0x0;_0x41b454<_0x1db319['length'];_0x41b454+=0x1){let _0x43f775=_0x1db319[_0x41b454];for(var _0x5d596d=0x0;_0x5d596d<_0x43f775[_0x9be7('0x69')][_0x9be7('0x37')];_0x5d596d+=0x1){let _0x1eb059=_0x43f775[_0x9be7('0x69')][_0x5d596d];var _0x29c202=_0xcaccd['clone']();_0x29c202[_0x9be7('0x3c')](_0x9be7('0x73'),_0x1eb059['id']);_0x3e197d[_0x9be7('0x74')](db[_0x9be7('0x6a')][_0x9be7('0x31')](_0x29c202[_0x9be7('0x75')](),{'type':db[_0x9be7('0x6a')][_0x9be7('0x76')][_0x9be7('0x77')]})[_0x9be7('0x21')](function(_0x3a6c8a){if(_0x3a6c8a[_0x9be7('0x37')]===0x1){return _0x1eb059['id'];}else{var _0x3f94dc=_['every'](_[_0x9be7('0x2b')](_0x3a6c8a,_0x9be7('0x78')),function(_0x452d10){return _[_0x9be7('0x79')](_0x58ba7c,_0x452d10);});if(_0x3f94dc){return _0x1eb059['id'];}}}));}}return BPromise[_0x9be7('0x7a')](_0x3e197d)[_0x9be7('0x21')](function(_0x432c28){_0x15c45c=_(_0x15c45c)[_0x9be7('0x7b')](_0x432c28)[_0x9be7('0x7c')]()[_0x9be7('0x7d')]();return db[_0x9be7('0x2c')]['find']({'where':{'id':_0x45bb92['params']['id']}})['then'](function(_0x446841){return db[_0x9be7('0x6a')][_0x9be7('0x7e')](function(_0x429d5f){return _0x446841[_0x9be7('0x6d')](_0x45bb92[_0x9be7('0x31')][_0x9be7('0x65')],{'transaction':_0x429d5f})['then'](function(){if(!_['isEmpty'](_0x15c45c)){return _0x446841[_0x9be7('0x7f')](_0x15c45c,{'transaction':_0x429d5f});}})['then'](function(){_0x15c45c[_0x9be7('0x6b')](function(_0x2b1310){socket[_0x9be7('0x6c')](_0x9be7('0x80'),{'UserId':_0x2b1310,'WhatsappQueueId':_0x446841['id']});});});});});});})[_0x9be7('0x21')](respondWithStatusCode(_0x366e4d,null))[_0x9be7('0x47')](handleError(_0x366e4d,null));};exports[_0x9be7('0x81')]=function(_0x4fadaf,_0x17f225,_0x949d20){return db['WhatsappQueue'][_0x9be7('0x4a')]({'where':{'id':_0x4fadaf['params']['id']}})['then'](handleEntityNotFound(_0x17f225,null))[_0x9be7('0x21')](function(_0x480295){if(_0x480295){return _0x480295['addAgents'](_0x4fadaf[_0x9be7('0x52')][_0x9be7('0x65')],_['omit'](_0x4fadaf[_0x9be7('0x52')],[_0x9be7('0x65'),'id'])||{})[_0x9be7('0x82')](function(_0x2e1d3b){for(var _0x3eddf2=0x0;_0x3eddf2<_0x4fadaf[_0x9be7('0x52')][_0x9be7('0x65')]['length'];_0x3eddf2+=0x1){socket[_0x9be7('0x6c')](_0x9be7('0x83'),{'UserId':_0x4fadaf[_0x9be7('0x52')][_0x9be7('0x65')][_0x3eddf2],'WhatsappQueueId':_0x4fadaf[_0x9be7('0x49')]['id']});}return _0x2e1d3b;});}})[_0x9be7('0x21')](respondWithResult(_0x17f225,null))[_0x9be7('0x47')](handleError(_0x17f225,null));};exports[_0x9be7('0x7f')]=function(_0x260e8c,_0x1ab219,_0x599ff1){return db[_0x9be7('0x2c')][_0x9be7('0x4a')]({'where':{'id':_0x260e8c[_0x9be7('0x49')]['id']}})[_0x9be7('0x21')](handleEntityNotFound(_0x1ab219,null))['then'](function(_0xfde8d4){if(_0xfde8d4){return _0xfde8d4[_0x9be7('0x7f')](_0x260e8c[_0x9be7('0x31')]['ids'])[_0x9be7('0x21')](function(){if(_[_0x9be7('0x84')](_0x260e8c[_0x9be7('0x31')]['ids'])){for(var _0x2bd762=0x0;_0x2bd762<_0x260e8c['query'][_0x9be7('0x65')][_0x9be7('0x37')];_0x2bd762+=0x1){socket['emit'](_0x9be7('0x80'),{'UserId':Number(_0x260e8c[_0x9be7('0x31')][_0x9be7('0x65')][_0x2bd762]),'WhatsappQueueId':Number(_0x260e8c[_0x9be7('0x49')]['id'])});}}else{socket[_0x9be7('0x6c')]('userWhatsappQueue:remove',{'UserId':Number(_0x260e8c['query'][_0x9be7('0x65')]),'WhatsappQueueId':Number(_0x260e8c['params']['id'])});}});}})[_0x9be7('0x21')](respondWithStatusCode(_0x1ab219,null))[_0x9be7('0x47')](handleError(_0x1ab219,null));};exports[_0x9be7('0x85')]=function(_0x116995,_0xa45e3f,_0x55f592){var _0x39940d={};var _0x1ae4cc={};var _0x118e59;var _0x4688ea;return db['WhatsappQueue'][_0x9be7('0x55')]({'where':{'id':_0x116995['params']['id']}})[_0x9be7('0x21')](handleEntityNotFound(_0xa45e3f,null))[_0x9be7('0x21')](function(_0x58b57f){if(_0x58b57f){_0x118e59=_0x58b57f;_0x1ae4cc[_0x9be7('0x30')]=_['keys'](db[_0x9be7('0x66')][_0x9be7('0x2d')]);_0x1ae4cc[_0x9be7('0x31')]=_['keys'](_0x116995['query']);_0x1ae4cc[_0x9be7('0x33')]=_['intersection'](_0x1ae4cc['model'],_0x1ae4cc[_0x9be7('0x31')]);_0x39940d[_0x9be7('0x36')]=_[_0x9be7('0x34')](_0x1ae4cc['model'],qs['fields'](_0x116995[_0x9be7('0x31')]['fields']));_0x39940d['attributes']=_0x39940d[_0x9be7('0x36')][_0x9be7('0x37')]?_0x39940d[_0x9be7('0x36')]:_0x1ae4cc[_0x9be7('0x30')];_0x39940d[_0x9be7('0x3a')]=qs[_0x9be7('0x3b')](_0x116995['query'][_0x9be7('0x3b')]);_0x39940d[_0x9be7('0x3c')]=qs[_0x9be7('0x33')](_[_0x9be7('0x3d')](_0x116995[_0x9be7('0x31')],_0x1ae4cc[_0x9be7('0x33')]));if(_0x116995['query'][_0x9be7('0x3e')]){_0x39940d[_0x9be7('0x3c')]=_[_0x9be7('0x41')](_0x39940d[_0x9be7('0x3c')],{'$or':_[_0x9be7('0x2b')](_0x39940d[_0x9be7('0x36')],function(_0x29a43a){var _0x2244ee={};_0x2244ee[_0x29a43a]={'$like':'%'+_0x116995[_0x9be7('0x31')][_0x9be7('0x3e')]+'%'};return _0x2244ee;})});}_0x39940d=_[_0x9be7('0x41')]({},_0x39940d,_0x116995[_0x9be7('0x42')]);return _0x118e59[_0x9be7('0x85')](_0x39940d);}})[_0x9be7('0x21')](function(_0xd89784){if(_0xd89784){_0x4688ea=_0xd89784[_0x9be7('0x37')];if(!_0x116995['query'][_0x9be7('0x38')](_0x9be7('0x39'))){_0x39940d[_0x9be7('0x1b')]=qs['limit'](_0x116995[_0x9be7('0x31')][_0x9be7('0x1b')]);_0x39940d[_0x9be7('0x1a')]=qs[_0x9be7('0x1a')](_0x116995[_0x9be7('0x31')][_0x9be7('0x1a')]);}return _0x118e59[_0x9be7('0x85')](_0x39940d);}})['then'](function(_0x2ae051){if(_0x2ae051){return _0x2ae051?{'count':_0x4688ea,'rows':_0x2ae051}:null;}})[_0x9be7('0x21')](respondWithResult(_0xa45e3f,null))['catch'](handleError(_0xa45e3f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index bcd708a..c4bac98 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 _0xfb48=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update','remove'];(function(_0x2ac622,_0x5a31b9){var _0x500fce=function(_0x18b7ef){while(--_0x18b7ef){_0x2ac622['push'](_0x2ac622['shift']());}};_0x500fce(++_0x5a31b9);}(_0xfb48,0x1f4));var _0x8fb4=function(_0x13b666,_0x2c793e){_0x13b666=_0x13b666-0x0;var _0x5b2273=_0xfb48[_0x13b666];return _0x5b2273;};'use strict';var EventEmitter=require(_0x8fb4('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8fb4('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8fb4('0x2'),'afterDestroy':_0x8fb4('0x3')};function emitEvent(_0x7a7f4e){return function(_0x428170,_0x1442b9,_0x316502){WhatsappQueueEvents[_0x8fb4('0x4')](_0x7a7f4e+':'+_0x428170['id'],_0x428170);WhatsappQueueEvents[_0x8fb4('0x4')](_0x7a7f4e,_0x428170);_0x316502(null);};}for(var e in events){if(events[_0x8fb4('0x5')](e)){var event=events[e];WhatsappQueue[_0x8fb4('0x6')](e,emitEvent(event));}}module[_0x8fb4('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4f4c=['WhatsappQueue','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x768554,_0x5e2c25){var _0x2340ea=function(_0x3d80b3){while(--_0x3d80b3){_0x768554['push'](_0x768554['shift']());}};_0x2340ea(++_0x5e2c25);}(_0x4f4c,0x103));var _0xc4f4=function(_0x4f463f,_0x13c8d8){_0x4f463f=_0x4f463f-0x0;var _0xebd94a=_0x4f4c[_0x4f463f];return _0xebd94a;};'use strict';var EventEmitter=require(_0xc4f4('0x0'));var WhatsappQueue=require(_0xc4f4('0x1'))['db'][_0xc4f4('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc4f4('0x3')](0x0);var events={'afterCreate':_0xc4f4('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x230786){return function(_0x332788,_0x3ca72b,_0x1c05ae){WhatsappQueueEvents[_0xc4f4('0x5')](_0x230786+':'+_0x332788['id'],_0x332788);WhatsappQueueEvents['emit'](_0x230786,_0x332788);_0x1c05ae(null);};}for(var e in events){if(events[_0xc4f4('0x6')](e)){var event=events[e];WhatsappQueue[_0xc4f4('0x7')](e,emitEvent(event));}}module[_0xc4f4('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f71014a..4a8f80a 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 _0x6f2c=['request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x335c46,_0x2e3773){var _0x11c433=function(_0x4752d0){while(--_0x4752d0){_0x335c46['push'](_0x335c46['shift']());}};_0x11c433(++_0x2e3773);}(_0x6f2c,0x1e7));var _0xc6f2=function(_0x35e535,_0x4382fc){_0x35e535=_0x35e535-0x0;var _0xbd0a98=_0x6f2c[_0x35e535];return _0xbd0a98;};'use strict';var _=require(_0xc6f2('0x0'));var util=require('util');var logger=require(_0xc6f2('0x1'))(_0xc6f2('0x2'));var moment=require(_0xc6f2('0x3'));var BPromise=require(_0xc6f2('0x4'));var rp=require(_0xc6f2('0x5'));var fs=require('fs');var path=require(_0xc6f2('0x6'));var rimraf=require(_0xc6f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xc6f2('0x8'));module[_0xc6f2('0x9')]=function(_0x4d8cbb,_0x2899e5){return _0x4d8cbb[_0xc6f2('0xa')](_0xc6f2('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb765=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x11b92f,_0x8041a7){var _0x21fdfa=function(_0xd6c98d){while(--_0xd6c98d){_0x11b92f['push'](_0x11b92f['shift']());}};_0x21fdfa(++_0x8041a7);}(_0xb765,0x7b));var _0x5b76=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb765[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5b76('0x0'));var util=require('util');var logger=require(_0x5b76('0x1'))(_0x5b76('0x2'));var moment=require(_0x5b76('0x3'));var BPromise=require(_0x5b76('0x4'));var rp=require(_0x5b76('0x5'));var fs=require('fs');var path=require(_0x5b76('0x6'));var rimraf=require('rimraf');var config=require(_0x5b76('0x7'));var attributes=require(_0x5b76('0x8'));module[_0x5b76('0x9')]=function(_0x47b612,_0x31c78d){return _0x47b612[_0x5b76('0xa')](_0x5b76('0xb'),attributes,{'tableName':_0x5b76('0xc'),'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 07a213e..f0351e1 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 _0xbcaa=['message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7f30ae,_0xcaeaf3){var _0x4ec1fc=function(_0x550619){while(--_0x550619){_0x7f30ae['push'](_0x7f30ae['shift']());}};_0x4ec1fc(++_0xcaeaf3);}(_0xbcaa,0xb3));var _0xabca=function(_0x305e25,_0x47f621){_0x305e25=_0x305e25-0x0;var _0x1c0b23=_0xbcaa[_0x305e25];return _0x1c0b23;};'use strict';var _=require(_0xabca('0x0'));var util=require(_0xabca('0x1'));var moment=require(_0xabca('0x2'));var BPromise=require('bluebird');var rs=require(_0xabca('0x3'));var fs=require('fs');var Redis=require(_0xabca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xabca('0x5'));var logger=require(_0xabca('0x6'))(_0xabca('0x7'));var config=require(_0xabca('0x8'));var jayson=require(_0xabca('0x9'));var client=jayson[_0xabca('0xa')][_0xabca('0xb')]({'port':0x232a});config[_0xabca('0xc')]=_['defaults'](config[_0xabca('0xc')],{'host':_0xabca('0xd'),'port':0x18eb});var socket=require(_0xabca('0xe'))(new Redis(config[_0xabca('0xc')]));require(_0xabca('0xf'))['register'](socket);function respondWithRpcPromise(_0x590f22,_0x3dac51,_0x22b08b){return new BPromise(function(_0x20b7e5,_0x3915c3){return client[_0xabca('0x10')](_0x590f22,_0x22b08b)[_0xabca('0x11')](function(_0x928ad5){logger[_0xabca('0x12')](_0xabca('0x13'),_0x3dac51,_0xabca('0x14'));logger[_0xabca('0x15')](_0xabca('0x16'),_0x3dac51,_0xabca('0x14'),JSON[_0xabca('0x17')](_0x928ad5));if(_0x928ad5[_0xabca('0x18')]){if(_0x928ad5['error'][_0xabca('0x19')]===0x1f4){logger[_0xabca('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x3dac51,_0x928ad5['error'][_0xabca('0x1a')]);return _0x3915c3(_0x928ad5[_0xabca('0x18')][_0xabca('0x1a')]);}logger[_0xabca('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x3dac51,_0x928ad5[_0xabca('0x18')]['message']);return _0x20b7e5(_0x928ad5['error']['message']);}else{logger[_0xabca('0x12')](_0xabca('0x13'),_0x3dac51,_0xabca('0x14'));_0x20b7e5(_0x928ad5[_0xabca('0x1b')][_0xabca('0x1a')]);}})[_0xabca('0x1c')](function(_0x8bd56b){logger['error'](_0xabca('0x13'),_0x3dac51,_0x8bd56b);_0x3915c3(_0x8bd56b);});});}exports[_0xabca('0x1d')]=function(_0x5a054c){var _0x43079a=this;return new Promise(function(_0x4a4c48,_0x425a3a){return db['WhatsappQueue'][_0xabca('0x1e')]({'raw':_0x5a054c['options']?_0x5a054c[_0xabca('0x1f')][_0xabca('0x20')]===undefined?!![]:![]:!![],'where':_0x5a054c[_0xabca('0x1f')]?_0x5a054c['options'][_0xabca('0x21')]||null:null,'attributes':_0x5a054c[_0xabca('0x1f')]?_0x5a054c[_0xabca('0x1f')][_0xabca('0x22')]||null:null,'limit':_0x5a054c[_0xabca('0x1f')]?_0x5a054c[_0xabca('0x1f')][_0xabca('0x23')]||null:null,'include':_0x5a054c[_0xabca('0x1f')]?_0x5a054c[_0xabca('0x1f')][_0xabca('0x24')]?_[_0xabca('0x25')](_0x5a054c[_0xabca('0x1f')][_0xabca('0x24')],function(_0x44ad07){return{'model':db[_0x44ad07['model']],'as':_0x44ad07['as'],'attributes':_0x44ad07[_0xabca('0x22')],'include':_0x44ad07[_0xabca('0x24')]?_['map'](_0x44ad07[_0xabca('0x24')],function(_0x2a005b){return{'model':db[_0x2a005b['model']],'as':_0x2a005b['as'],'attributes':_0x2a005b[_0xabca('0x22')],'include':_0x2a005b[_0xabca('0x24')]?_[_0xabca('0x25')](_0x2a005b[_0xabca('0x24')],function(_0x4595b2){return{'model':db[_0x4595b2[_0xabca('0x26')]],'as':_0x4595b2['as'],'attributes':_0x4595b2[_0xabca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xabca('0x11')](function(_0xe71eb6){logger['info'](_0xabca('0x1d'),_0x5a054c);logger[_0xabca('0x15')](_0xabca('0x1d'),_0x5a054c,JSON['stringify'](_0xe71eb6));_0x4a4c48(_0xe71eb6);})[_0xabca('0x1c')](function(_0x1e6f68){logger[_0xabca('0x18')](_0xabca('0x1d'),_0x1e6f68[_0xabca('0x1a')],_0x5a054c);_0x425a3a(_0x43079a['error'](0x1f4,_0x1e6f68[_0xabca('0x1a')]));});});};exports[_0xabca('0x27')]=function(_0x467906){var _0x46c71b=this;return new Promise(function(_0x589b5f,_0x1bbe67){return db['WhatsappQueue'][_0xabca('0x28')]({'raw':_0x467906['options']?_0x467906[_0xabca('0x1f')][_0xabca('0x20')]===undefined?!![]:![]:!![],'where':_0x467906['options']?_0x467906[_0xabca('0x1f')][_0xabca('0x21')]||null:null,'attributes':_0x467906[_0xabca('0x1f')]?_0x467906[_0xabca('0x1f')][_0xabca('0x22')]||null:null,'include':_0x467906[_0xabca('0x1f')]?_0x467906[_0xabca('0x1f')][_0xabca('0x24')]?_[_0xabca('0x25')](_0x467906[_0xabca('0x1f')][_0xabca('0x24')],function(_0x163f16){return{'model':db[_0x163f16['model']],'as':_0x163f16['as'],'attributes':_0x163f16[_0xabca('0x22')],'include':_0x163f16['include']?_[_0xabca('0x25')](_0x163f16[_0xabca('0x24')],function(_0xc7f5ae){return{'model':db[_0xc7f5ae[_0xabca('0x26')]],'as':_0xc7f5ae['as'],'attributes':_0xc7f5ae[_0xabca('0x22')],'include':_0xc7f5ae[_0xabca('0x24')]?_[_0xabca('0x25')](_0xc7f5ae[_0xabca('0x24')],function(_0x3eab24){return{'model':db[_0x3eab24[_0xabca('0x26')]],'as':_0x3eab24['as'],'attributes':_0x3eab24[_0xabca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xabca('0x11')](function(_0x59a9c6){logger[_0xabca('0x12')](_0xabca('0x27'),_0x467906);logger[_0xabca('0x15')](_0xabca('0x27'),_0x467906,JSON['stringify'](_0x59a9c6));_0x589b5f(_0x59a9c6);})[_0xabca('0x1c')](function(_0x293281){logger[_0xabca('0x18')](_0xabca('0x27'),_0x293281[_0xabca('0x1a')],_0x467906);_0x1bbe67(_0x46c71b[_0xabca('0x18')](0x1f4,_0x293281['message']));});});}; \ No newline at end of file +var _0xa697=['model','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','options','raw','where','attributes','limit','include','map'];(function(_0x28720e,_0x4e63aa){var _0x48dc87=function(_0x3f6bcd){while(--_0x3f6bcd){_0x28720e['push'](_0x28720e['shift']());}};_0x48dc87(++_0x4e63aa);}(_0xa697,0x16c));var _0x7a69=function(_0x4bedeb,_0x5f7e32){_0x4bedeb=_0x4bedeb-0x0;var _0x1516eb=_0xa697[_0x4bedeb];return _0x1516eb;};'use strict';var _=require(_0x7a69('0x0'));var util=require(_0x7a69('0x1'));var moment=require(_0x7a69('0x2'));var BPromise=require(_0x7a69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a69('0x4'));var db=require(_0x7a69('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a69('0x6'))('rpc');var config=require(_0x7a69('0x7'));var jayson=require(_0x7a69('0x8'));var client=jayson['client'][_0x7a69('0x9')]({'port':0x232a});config[_0x7a69('0xa')]=_[_0x7a69('0xb')](config[_0x7a69('0xa')],{'host':_0x7a69('0xc'),'port':0x18eb});var socket=require(_0x7a69('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x7a69('0xe')](socket);function respondWithRpcPromise(_0x3fa782,_0x34ddc5,_0x2c78cc){return new BPromise(function(_0x169197,_0x45c4d){return client[_0x7a69('0xf')](_0x3fa782,_0x2c78cc)[_0x7a69('0x10')](function(_0x675cc7){logger[_0x7a69('0x11')](_0x7a69('0x12'),_0x34ddc5,_0x7a69('0x13'));logger[_0x7a69('0x14')](_0x7a69('0x15'),_0x34ddc5,_0x7a69('0x13'),JSON[_0x7a69('0x16')](_0x675cc7));if(_0x675cc7[_0x7a69('0x17')]){if(_0x675cc7[_0x7a69('0x17')][_0x7a69('0x18')]===0x1f4){logger[_0x7a69('0x17')](_0x7a69('0x12'),_0x34ddc5,_0x675cc7[_0x7a69('0x17')][_0x7a69('0x19')]);return _0x45c4d(_0x675cc7[_0x7a69('0x17')]['message']);}logger[_0x7a69('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x34ddc5,_0x675cc7[_0x7a69('0x17')][_0x7a69('0x19')]);return _0x169197(_0x675cc7[_0x7a69('0x17')]['message']);}else{logger[_0x7a69('0x11')](_0x7a69('0x12'),_0x34ddc5,_0x7a69('0x13'));_0x169197(_0x675cc7[_0x7a69('0x1a')][_0x7a69('0x19')]);}})[_0x7a69('0x1b')](function(_0x1f70e1){logger[_0x7a69('0x17')](_0x7a69('0x12'),_0x34ddc5,_0x1f70e1);_0x45c4d(_0x1f70e1);});});}exports[_0x7a69('0x1c')]=function(_0x8a378){var _0x1bf766=this;return new Promise(function(_0x311e2b,_0x2d2df7){return db['WhatsappQueue']['findAll']({'raw':_0x8a378[_0x7a69('0x1d')]?_0x8a378[_0x7a69('0x1d')][_0x7a69('0x1e')]===undefined?!![]:![]:!![],'where':_0x8a378[_0x7a69('0x1d')]?_0x8a378[_0x7a69('0x1d')][_0x7a69('0x1f')]||null:null,'attributes':_0x8a378[_0x7a69('0x1d')]?_0x8a378[_0x7a69('0x1d')][_0x7a69('0x20')]||null:null,'limit':_0x8a378[_0x7a69('0x1d')]?_0x8a378['options'][_0x7a69('0x21')]||null:null,'include':_0x8a378[_0x7a69('0x1d')]?_0x8a378[_0x7a69('0x1d')][_0x7a69('0x22')]?_[_0x7a69('0x23')](_0x8a378['options'][_0x7a69('0x22')],function(_0x215f1b){return{'model':db[_0x215f1b[_0x7a69('0x24')]],'as':_0x215f1b['as'],'attributes':_0x215f1b[_0x7a69('0x20')],'include':_0x215f1b[_0x7a69('0x22')]?_[_0x7a69('0x23')](_0x215f1b['include'],function(_0x82a2ca){return{'model':db[_0x82a2ca[_0x7a69('0x24')]],'as':_0x82a2ca['as'],'attributes':_0x82a2ca[_0x7a69('0x20')],'include':_0x82a2ca[_0x7a69('0x22')]?_['map'](_0x82a2ca[_0x7a69('0x22')],function(_0x1fa721){return{'model':db[_0x1fa721['model']],'as':_0x1fa721['as'],'attributes':_0x1fa721['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a69('0x10')](function(_0x2cda87){logger['info'](_0x7a69('0x1c'),_0x8a378);logger[_0x7a69('0x14')](_0x7a69('0x1c'),_0x8a378,JSON['stringify'](_0x2cda87));_0x311e2b(_0x2cda87);})['catch'](function(_0x5e5f2d){logger[_0x7a69('0x17')](_0x7a69('0x1c'),_0x5e5f2d[_0x7a69('0x19')],_0x8a378);_0x2d2df7(_0x1bf766[_0x7a69('0x17')](0x1f4,_0x5e5f2d[_0x7a69('0x19')]));});});};exports[_0x7a69('0x25')]=function(_0x5ba4a8){var _0x482c45=this;return new Promise(function(_0x1e27a2,_0x180454){return db[_0x7a69('0x26')][_0x7a69('0x27')]({'raw':_0x5ba4a8[_0x7a69('0x1d')]?_0x5ba4a8[_0x7a69('0x1d')][_0x7a69('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ba4a8[_0x7a69('0x1d')]?_0x5ba4a8[_0x7a69('0x1d')][_0x7a69('0x1f')]||null:null,'attributes':_0x5ba4a8[_0x7a69('0x1d')]?_0x5ba4a8[_0x7a69('0x1d')][_0x7a69('0x20')]||null:null,'include':_0x5ba4a8['options']?_0x5ba4a8[_0x7a69('0x1d')][_0x7a69('0x22')]?_[_0x7a69('0x23')](_0x5ba4a8[_0x7a69('0x1d')]['include'],function(_0x2c2d22){return{'model':db[_0x2c2d22[_0x7a69('0x24')]],'as':_0x2c2d22['as'],'attributes':_0x2c2d22[_0x7a69('0x20')],'include':_0x2c2d22[_0x7a69('0x22')]?_[_0x7a69('0x23')](_0x2c2d22[_0x7a69('0x22')],function(_0x517363){return{'model':db[_0x517363[_0x7a69('0x24')]],'as':_0x517363['as'],'attributes':_0x517363[_0x7a69('0x20')],'include':_0x517363[_0x7a69('0x22')]?_[_0x7a69('0x23')](_0x517363[_0x7a69('0x22')],function(_0x17b2e9){return{'model':db[_0x17b2e9[_0x7a69('0x24')]],'as':_0x17b2e9['as'],'attributes':_0x17b2e9[_0x7a69('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7a69('0x10')](function(_0x4e6f06){logger[_0x7a69('0x11')](_0x7a69('0x25'),_0x5ba4a8);logger[_0x7a69('0x14')](_0x7a69('0x25'),_0x5ba4a8,JSON[_0x7a69('0x16')](_0x4e6f06));_0x1e27a2(_0x4e6f06);})[_0x7a69('0x1b')](function(_0x1e6e05){logger[_0x7a69('0x17')]('ShowWhatsappQueue',_0x1e6e05[_0x7a69('0x19')],_0x5ba4a8);_0x180454(_0x482c45[_0x7a69('0x17')](0x1f4,_0x1e6e05[_0x7a69('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ac738ff..e04a366 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 _0xb5f8=['emit','removeListener','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb5f8,0x88));var _0x8b5f=function(_0x4d2767,_0x2ea50a){_0x4d2767=_0x4d2767-0x0;var _0x481f13=_0xb5f8[_0x4d2767];return _0x481f13;};'use strict';var WhatsappQueueEvents=require(_0x8b5f('0x0'));var events=[_0x8b5f('0x1'),_0x8b5f('0x2'),_0x8b5f('0x3')];function createListener(_0x3dd835,_0x5ad302){return function(_0x143dc5){_0x5ad302[_0x8b5f('0x4')](_0x3dd835,_0x143dc5);};}function removeListener(_0x4d24c6,_0x3d1094){return function(){WhatsappQueueEvents[_0x8b5f('0x5')](_0x4d24c6,_0x3d1094);};}exports['register']=function(_0x437371){for(var _0x3f6cc9=0x0,_0x4d3b72=events['length'];_0x3f6cc9<_0x4d3b72;_0x3f6cc9++){var _0x25111a=events[_0x3f6cc9];var _0x1b48e1=createListener(_0x8b5f('0x6')+_0x25111a,_0x437371);WhatsappQueueEvents['on'](_0x25111a,_0x1b48e1);}}; \ No newline at end of file +var _0xd932=['length','whatsappQueue:','save','remove','update','emit','removeListener'];(function(_0x264e7f,_0x4b8f91){var _0x173e6e=function(_0x525cfc){while(--_0x525cfc){_0x264e7f['push'](_0x264e7f['shift']());}};_0x173e6e(++_0x4b8f91);}(_0xd932,0x1c2));var _0x2d93=function(_0x11fa91,_0x17fc61){_0x11fa91=_0x11fa91-0x0;var _0xf72542=_0xd932[_0x11fa91];return _0xf72542;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x2d93('0x0'),_0x2d93('0x1'),_0x2d93('0x2')];function createListener(_0x108065,_0x33e9ee){return function(_0xbddf65){_0x33e9ee[_0x2d93('0x3')](_0x108065,_0xbddf65);};}function removeListener(_0x255589,_0x17248d){return function(){WhatsappQueueEvents[_0x2d93('0x4')](_0x255589,_0x17248d);};}exports['register']=function(_0x3c987e){for(var _0x2cc890=0x0,_0x54ad6d=events[_0x2d93('0x5')];_0x2cc890<_0x54ad6d;_0x2cc890++){var _0xfe0694=events[_0x2cc890];var _0x5b1d80=createListener(_0x2d93('0x6')+_0xfe0694,_0x3c987e);WhatsappQueueEvents['on'](_0xfe0694,_0x5b1d80);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index fbab88e..a29fb17 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 _0x2687=['Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x24d22f,_0xfa6241){var _0x33b153=function(_0x28caa6){while(--_0x28caa6){_0x24d22f['push'](_0x24d22f['shift']());}};_0x33b153(++_0xfa6241);}(_0x2687,0x8f));var _0x7268=function(_0x28acd0,_0x387a42){_0x28acd0=_0x28acd0-0x0;var _0x848823=_0x2687[_0x28acd0];return _0x848823;};'use strict';var multer=require(_0x7268('0x0'));var util=require(_0x7268('0x1'));var path=require('path');var timeout=require(_0x7268('0x2'));var express=require(_0x7268('0x3'));var router=express[_0x7268('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7268('0x5'));var config=require(_0x7268('0x6'));var controller=require(_0x7268('0x7'));router['get']('/',auth[_0x7268('0x8')](),controller[_0x7268('0x9')]);router[_0x7268('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x7268('0xb')]);router[_0x7268('0xa')](_0x7268('0xc'),auth[_0x7268('0x8')](),controller[_0x7268('0xd')]);router[_0x7268('0xe')]('/',auth[_0x7268('0x8')](),controller[_0x7268('0xf')]);router[_0x7268('0x10')](_0x7268('0xc'),auth[_0x7268('0x8')](),controller[_0x7268('0x11')]);router[_0x7268('0x12')](_0x7268('0xc'),auth['isAuthenticated'](),controller[_0x7268('0x13')]);module[_0x7268('0x14')]=router; \ No newline at end of file +var _0xe797=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0xd00ca0,_0xfc9fa0){var _0x5a2c81=function(_0x480f24){while(--_0x480f24){_0xd00ca0['push'](_0xd00ca0['shift']());}};_0x5a2c81(++_0xfc9fa0);}(_0xe797,0x12a));var _0x7e79=function(_0x16f06d,_0x3b6459){_0x16f06d=_0x16f06d-0x0;var _0x1b5260=_0xe797[_0x16f06d];return _0x1b5260;};'use strict';var multer=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var path=require(_0x7e79('0x2'));var timeout=require(_0x7e79('0x3'));var express=require(_0x7e79('0x4'));var router=express[_0x7e79('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e79('0x6'));var config=require(_0x7e79('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x7e79('0x8')]('/',auth[_0x7e79('0x9')](),controller[_0x7e79('0xa')]);router['get']('/describe',auth[_0x7e79('0x9')](),controller[_0x7e79('0xb')]);router['get']('/:id',auth[_0x7e79('0x9')](),controller[_0x7e79('0xc')]);router[_0x7e79('0xd')]('/',auth['isAuthenticated'](),controller[_0x7e79('0xe')]);router[_0x7e79('0xf')](_0x7e79('0x10'),auth[_0x7e79('0x9')](),controller[_0x7e79('0x11')]);router[_0x7e79('0x12')](_0x7e79('0x10'),auth[_0x7e79('0x9')](),controller[_0x7e79('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5d3420f..6087c7f 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 _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x4bf095,_0x5b48da){var _0x2c3f7a=function(_0x33239c){while(--_0x33239c){_0x4bf095['push'](_0x4bf095['shift']());}};_0x2c3f7a(++_0x5b48da);}(_0x55ca,0x126));var _0xa55c=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0x55ca[_0x403115];return _0x596ef3;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x7fbe=['STRING','DATE'];(function(_0x29417f,_0x59c19b){var _0x154243=function(_0x408c08){while(--_0x408c08){_0x29417f['push'](_0x29417f['shift']());}};_0x154243(++_0x59c19b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5690a4,_0x572d64){_0x5690a4=_0x5690a4-0x0;var _0x170f91=_0x7fbe[_0x5690a4];return _0x170f91;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe7fb('0x0')]},'joinAt':{'type':Sequelize[_0xe7fb('0x1')]},'leaveAt':{'type':Sequelize[_0xe7fb('0x1')]},'acceptAt':{'type':Sequelize[_0xe7fb('0x1')]},'exitAt':{'type':Sequelize[_0xe7fb('0x1')]},'reason':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 936abee..5b15b2c 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 _0x492d=['util','path','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5f1f6c,_0x52664d){var _0x5c3492=function(_0x24282c){while(--_0x24282c){_0x5f1f6c['push'](_0x5f1f6c['shift']());}};_0x5c3492(++_0x52664d);}(_0x492d,0x11e));var _0xd492=function(_0x4d92a7,_0x24c6b3){_0x4d92a7=_0x4d92a7-0x0;var _0x360cc9=_0x492d[_0x4d92a7];return _0x360cc9;};'use strict';var pdf=require(_0xd492('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd492('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd492('0x2'));var moment=require(_0xd492('0x3'));var BPromise=require(_0xd492('0x4'));var Mustache=require(_0xd492('0x5'));var util=require(_0xd492('0x6'));var path=require(_0xd492('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd492('0x8'));var crypto=require(_0xd492('0x9'));var jsforce=require(_0xd492('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd492('0xb'));var querystring=require(_0xd492('0xc'));var Papa=require('papaparse');var Redis=require(_0xd492('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd492('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd492('0xf'));var logger=require(_0xd492('0x10'))(_0xd492('0x11'));var utils=require('../../config/utils');var config=require(_0xd492('0x12'));var licenseUtil=require(_0xd492('0x13'));var db=require(_0xd492('0x14'))['db'];function respondWithStatusCode(_0x49bd06,_0x2c1cb5){_0x2c1cb5=_0x2c1cb5||0xcc;return function(_0x5dab0f){if(_0x5dab0f){return _0x49bd06[_0xd492('0x15')](_0x2c1cb5);}return _0x49bd06['status'](_0x2c1cb5)[_0xd492('0x16')]();};}function respondWithResult(_0x9cc966,_0x461f3a){_0x461f3a=_0x461f3a||0xc8;return function(_0x9f996d){if(_0x9f996d){return _0x9cc966[_0xd492('0x17')](_0x461f3a)[_0xd492('0x18')](_0x9f996d);}};}function respondWithFilteredResult(_0x45adf4,_0x2d4b43){return function(_0x4e72fe){if(_0x4e72fe){var _0x2ec0a6=_0x4e72fe['count'],_0x9d41af=_0x2d4b43[_0xd492('0x19')],_0x2dcf51=_0x2d4b43[_0xd492('0x19')]+_0x2d4b43[_0xd492('0x1a')],_0x52045c;if(_0x2dcf51>=_0x2ec0a6){_0x2dcf51=_0x2ec0a6;_0x52045c=0xc8;}else{_0x52045c=0xce;}_0x45adf4[_0xd492('0x17')](_0x52045c);return _0x45adf4[_0xd492('0x1b')](_0xd492('0x1c'),_0x9d41af+'-'+_0x2dcf51+'/'+_0x2ec0a6)[_0xd492('0x18')](_0x4e72fe);}return null;};}function patchUpdates(_0x4e729b){return function(_0x1031da){try{jsonpatch[_0xd492('0x1d')](_0x1031da,_0x4e729b,!![]);}catch(_0x2de30f){return BPromise[_0xd492('0x1e')](_0x2de30f);}return _0x1031da['save']();};}function saveUpdates(_0x3d63d9,_0x5602d3){return function(_0x6ad730){if(_0x6ad730){return _0x6ad730[_0xd492('0x1f')](_0x3d63d9)['then'](function(_0x4d9e12){return _0x4d9e12;});}return null;};}function removeEntity(_0x30ff6d,_0x7a4b26){return function(_0x28af25){if(_0x28af25){return _0x28af25[_0xd492('0x20')]()[_0xd492('0x21')](function(){_0x30ff6d[_0xd492('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38148f,_0x12bae1){return function(_0x23b948){if(!_0x23b948){_0x38148f[_0xd492('0x15')](0x194);}return _0x23b948;};}function handleError(_0x23357f,_0x4c4a9b){_0x4c4a9b=_0x4c4a9b||0x1f4;return function(_0xfbada2){logger[_0xd492('0x22')](_0xfbada2['stack']);if(_0xfbada2[_0xd492('0x23')]){delete _0xfbada2[_0xd492('0x23')];}_0x23357f[_0xd492('0x17')](_0x4c4a9b)[_0xd492('0x24')](_0xfbada2);};}exports[_0xd492('0x25')]=function(_0xd3ef02,_0x28ec41){var _0x4d4dd3={},_0x57f6f0={},_0x6da835={'count':0x0,'rows':[]};var _0x3ec2ba=_['map'](db[_0xd492('0x26')][_0xd492('0x27')],function(_0x492aa4){return{'name':_0x492aa4[_0xd492('0x28')],'type':_0x492aa4[_0xd492('0x29')][_0xd492('0x2a')]};});_0x57f6f0['model']=_[_0xd492('0x2b')](_0x3ec2ba,_0xd492('0x23'));_0x57f6f0['query']=_[_0xd492('0x2c')](_0xd3ef02['query']);_0x57f6f0[_0xd492('0x2d')]=_[_0xd492('0x2e')](_0x57f6f0[_0xd492('0x2f')],_0x57f6f0[_0xd492('0x30')]);_0x4d4dd3['attributes']=_[_0xd492('0x2e')](_0x57f6f0[_0xd492('0x2f')],qs[_0xd492('0x31')](_0xd3ef02[_0xd492('0x30')][_0xd492('0x31')]));_0x4d4dd3[_0xd492('0x32')]=_0x4d4dd3['attributes'][_0xd492('0x33')]?_0x4d4dd3[_0xd492('0x32')]:_0x57f6f0[_0xd492('0x2f')];if(!_0xd3ef02['query'][_0xd492('0x34')]('nolimit')){_0x4d4dd3['limit']=qs[_0xd492('0x1a')](_0xd3ef02['query'][_0xd492('0x1a')]);_0x4d4dd3[_0xd492('0x19')]=qs['offset'](_0xd3ef02[_0xd492('0x30')][_0xd492('0x19')]);}_0x4d4dd3[_0xd492('0x35')]=qs[_0xd492('0x36')](_0xd3ef02[_0xd492('0x30')]['sort']);_0x4d4dd3['where']=qs[_0xd492('0x2d')](_[_0xd492('0x37')](_0xd3ef02['query'],_0x57f6f0['filters']),_0x3ec2ba);if(_0xd3ef02[_0xd492('0x30')][_0xd492('0x38')]){_0x4d4dd3[_0xd492('0x39')]=_['merge'](_0x4d4dd3[_0xd492('0x39')],{'$or':_[_0xd492('0x2b')](_0x3ec2ba,function(_0x1db996){if(_0x1db996[_0xd492('0x29')]!==_0xd492('0x3a')){var _0x3cf0d6={};_0x3cf0d6[_0x1db996[_0xd492('0x23')]]={'$like':'%'+_0xd3ef02[_0xd492('0x30')][_0xd492('0x38')]+'%'};return _0x3cf0d6;}})});}_0x4d4dd3=_[_0xd492('0x3b')]({},_0x4d4dd3,_0xd3ef02[_0xd492('0x3c')]);var _0x2354d0={'where':_0x4d4dd3[_0xd492('0x39')]};return db['WhatsappQueueReport'][_0xd492('0x3d')](_0x2354d0)[_0xd492('0x21')](function(_0x4e8a0b){_0x6da835['count']=_0x4e8a0b;if(_0xd3ef02[_0xd492('0x30')]['includeAll']){_0x4d4dd3[_0xd492('0x3e')]=[{'all':!![]}];}return db[_0xd492('0x26')][_0xd492('0x3f')](_0x4d4dd3);})[_0xd492('0x21')](function(_0x5c9de3){_0x6da835[_0xd492('0x40')]=_0x5c9de3;return _0x6da835;})[_0xd492('0x21')](respondWithFilteredResult(_0x28ec41,_0x4d4dd3))[_0xd492('0x41')](handleError(_0x28ec41,null));};exports[_0xd492('0x42')]=function(_0x23edc4,_0x262613){var _0x20571c={'raw':!![],'where':{'id':_0x23edc4['params']['id']}},_0x5bee3b={};_0x5bee3b[_0xd492('0x2f')]=_[_0xd492('0x2c')](db['WhatsappQueueReport'][_0xd492('0x27')]);_0x5bee3b[_0xd492('0x30')]=_[_0xd492('0x2c')](_0x23edc4[_0xd492('0x30')]);_0x5bee3b[_0xd492('0x2d')]=_[_0xd492('0x2e')](_0x5bee3b[_0xd492('0x2f')],_0x5bee3b[_0xd492('0x30')]);_0x20571c['attributes']=_[_0xd492('0x2e')](_0x5bee3b[_0xd492('0x2f')],qs[_0xd492('0x31')](_0x23edc4['query']['fields']));_0x20571c[_0xd492('0x32')]=_0x20571c[_0xd492('0x32')][_0xd492('0x33')]?_0x20571c[_0xd492('0x32')]:_0x5bee3b[_0xd492('0x2f')];if(_0x23edc4[_0xd492('0x30')][_0xd492('0x43')]){_0x20571c['include']=[{'all':!![]}];}_0x20571c=_[_0xd492('0x3b')]({},_0x20571c,_0x23edc4['options']);return db[_0xd492('0x26')][_0xd492('0x44')](_0x20571c)[_0xd492('0x21')](handleEntityNotFound(_0x262613,null))['then'](respondWithResult(_0x262613,null))[_0xd492('0x41')](handleError(_0x262613,null));};exports[_0xd492('0x45')]=function(_0x2a3910,_0xcbdc9a){return db['WhatsappQueueReport']['create'](_0x2a3910[_0xd492('0x46')],{})[_0xd492('0x21')](respondWithResult(_0xcbdc9a,0xc9))[_0xd492('0x41')](handleError(_0xcbdc9a,null));};exports[_0xd492('0x1f')]=function(_0x10d7aa,_0x10eda7){if(_0x10d7aa[_0xd492('0x46')]['id']){delete _0x10d7aa[_0xd492('0x46')]['id'];}return db[_0xd492('0x26')]['find']({'where':{'id':_0x10d7aa[_0xd492('0x47')]['id']}})['then'](handleEntityNotFound(_0x10eda7,null))['then'](saveUpdates(_0x10d7aa[_0xd492('0x46')],null))[_0xd492('0x21')](respondWithResult(_0x10eda7,null))['catch'](handleError(_0x10eda7,null));};exports[_0xd492('0x20')]=function(_0x43563f,_0x49909d){return db[_0xd492('0x26')][_0xd492('0x44')]({'where':{'id':_0x43563f[_0xd492('0x47')]['id']}})[_0xd492('0x21')](handleEntityNotFound(_0x49909d,null))['then'](removeEntity(_0x49909d,null))[_0xd492('0x41')](handleError(_0x49909d,null));};exports['describe']=function(_0x1ef710,_0x571ca6){return db['WhatsappQueueReport'][_0xd492('0x48')]()[_0xd492('0x21')](respondWithResult(_0x571ca6,null))['catch'](handleError(_0x571ca6,null));}; \ No newline at end of file +var _0x85a8=['fields','length','nolimit','order','sort','where','filter','merge','map','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','include','find','create','body','update','params','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x85a8,0x137));var _0x885a=function(_0x572fbd,_0xf44e39){_0x572fbd=_0x572fbd-0x0;var _0x6667a4=_0x85a8[_0x572fbd];return _0x6667a4;};'use strict';var pdf=require(_0x885a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x885a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x885a('0x2'));var moment=require(_0x885a('0x3'));var BPromise=require(_0x885a('0x4'));var Mustache=require(_0x885a('0x5'));var util=require(_0x885a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x885a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x885a('0x8'));var jsforce=require(_0x885a('0x9'));var deskjs=require(_0x885a('0xa'));var toCsv=require(_0x885a('0x7'));var querystring=require(_0x885a('0xb'));var Papa=require(_0x885a('0xc'));var Redis=require(_0x885a('0xd'));var authService=require(_0x885a('0xe'));var qs=require(_0x885a('0xf'));var as=require(_0x885a('0x10'));var hardwareService=require(_0x885a('0x11'));var logger=require('../../config/logger')(_0x885a('0x12'));var utils=require(_0x885a('0x13'));var config=require(_0x885a('0x14'));var licenseUtil=require(_0x885a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2906b6,_0x583177){_0x583177=_0x583177||0xcc;return function(_0x714dab){if(_0x714dab){return _0x2906b6['sendStatus'](_0x583177);}return _0x2906b6[_0x885a('0x16')](_0x583177)['end']();};}function respondWithResult(_0x205bf2,_0x2c76c9){_0x2c76c9=_0x2c76c9||0xc8;return function(_0x2c6a5b){if(_0x2c6a5b){return _0x205bf2[_0x885a('0x16')](_0x2c76c9)[_0x885a('0x17')](_0x2c6a5b);}};}function respondWithFilteredResult(_0x509213,_0x37ba71){return function(_0x2d3685){if(_0x2d3685){var _0x39da21=_0x2d3685[_0x885a('0x18')],_0x124d8c=_0x37ba71[_0x885a('0x19')],_0x16dc95=_0x37ba71['offset']+_0x37ba71[_0x885a('0x1a')],_0xaf69eb;if(_0x16dc95>=_0x39da21){_0x16dc95=_0x39da21;_0xaf69eb=0xc8;}else{_0xaf69eb=0xce;}_0x509213[_0x885a('0x16')](_0xaf69eb);return _0x509213[_0x885a('0x1b')](_0x885a('0x1c'),_0x124d8c+'-'+_0x16dc95+'/'+_0x39da21)['json'](_0x2d3685);}return null;};}function patchUpdates(_0x3f3fbe){return function(_0x5040e7){try{jsonpatch[_0x885a('0x1d')](_0x5040e7,_0x3f3fbe,!![]);}catch(_0x2e6b71){return BPromise[_0x885a('0x1e')](_0x2e6b71);}return _0x5040e7[_0x885a('0x1f')]();};}function saveUpdates(_0x2bbfb2,_0x15dfad){return function(_0x10e7a3){if(_0x10e7a3){return _0x10e7a3['update'](_0x2bbfb2)[_0x885a('0x20')](function(_0x3ae64d){return _0x3ae64d;});}return null;};}function removeEntity(_0x351224,_0x145e09){return function(_0x27126d){if(_0x27126d){return _0x27126d[_0x885a('0x21')]()['then'](function(){_0x351224[_0x885a('0x16')](0xcc)[_0x885a('0x22')]();});}};}function handleEntityNotFound(_0x542247,_0x38734b){return function(_0x23a252){if(!_0x23a252){_0x542247[_0x885a('0x23')](0x194);}return _0x23a252;};}function handleError(_0x205174,_0xcac5cd){_0xcac5cd=_0xcac5cd||0x1f4;return function(_0x1c261e){logger[_0x885a('0x24')](_0x1c261e[_0x885a('0x25')]);if(_0x1c261e[_0x885a('0x26')]){delete _0x1c261e[_0x885a('0x26')];}_0x205174[_0x885a('0x16')](_0xcac5cd)['send'](_0x1c261e);};}exports[_0x885a('0x27')]=function(_0x37cbbb,_0x45d094){var _0x3a4350={},_0x362735={},_0x2faa9d={'count':0x0,'rows':[]};var _0xf723ea=_['map'](db['WhatsappQueueReport'][_0x885a('0x28')],function(_0x3a7c02){return{'name':_0x3a7c02['fieldName'],'type':_0x3a7c02[_0x885a('0x29')][_0x885a('0x2a')]};});_0x362735[_0x885a('0x2b')]=_['map'](_0xf723ea,'name');_0x362735[_0x885a('0x2c')]=_[_0x885a('0x2d')](_0x37cbbb[_0x885a('0x2c')]);_0x362735[_0x885a('0x2e')]=_[_0x885a('0x2f')](_0x362735[_0x885a('0x2b')],_0x362735[_0x885a('0x2c')]);_0x3a4350[_0x885a('0x30')]=_[_0x885a('0x2f')](_0x362735[_0x885a('0x2b')],qs[_0x885a('0x31')](_0x37cbbb['query']['fields']));_0x3a4350[_0x885a('0x30')]=_0x3a4350[_0x885a('0x30')][_0x885a('0x32')]?_0x3a4350[_0x885a('0x30')]:_0x362735['model'];if(!_0x37cbbb['query']['hasOwnProperty'](_0x885a('0x33'))){_0x3a4350[_0x885a('0x1a')]=qs[_0x885a('0x1a')](_0x37cbbb[_0x885a('0x2c')][_0x885a('0x1a')]);_0x3a4350[_0x885a('0x19')]=qs[_0x885a('0x19')](_0x37cbbb[_0x885a('0x2c')][_0x885a('0x19')]);}_0x3a4350[_0x885a('0x34')]=qs[_0x885a('0x35')](_0x37cbbb[_0x885a('0x2c')]['sort']);_0x3a4350[_0x885a('0x36')]=qs['filters'](_['pick'](_0x37cbbb[_0x885a('0x2c')],_0x362735['filters']),_0xf723ea);if(_0x37cbbb[_0x885a('0x2c')][_0x885a('0x37')]){_0x3a4350[_0x885a('0x36')]=_[_0x885a('0x38')](_0x3a4350[_0x885a('0x36')],{'$or':_[_0x885a('0x39')](_0xf723ea,function(_0x51b2c1){if(_0x51b2c1['type']!=='VIRTUAL'){var _0x4a1252={};_0x4a1252[_0x51b2c1[_0x885a('0x26')]]={'$like':'%'+_0x37cbbb[_0x885a('0x2c')]['filter']+'%'};return _0x4a1252;}})});}_0x3a4350=_[_0x885a('0x38')]({},_0x3a4350,_0x37cbbb[_0x885a('0x3a')]);var _0x3e74a5={'where':_0x3a4350['where']};return db[_0x885a('0x3b')][_0x885a('0x18')](_0x3e74a5)[_0x885a('0x20')](function(_0x4af14e){_0x2faa9d[_0x885a('0x18')]=_0x4af14e;if(_0x37cbbb[_0x885a('0x2c')][_0x885a('0x3c')]){_0x3a4350['include']=[{'all':!![]}];}return db[_0x885a('0x3b')][_0x885a('0x3d')](_0x3a4350);})[_0x885a('0x20')](function(_0x588d74){_0x2faa9d[_0x885a('0x3e')]=_0x588d74;return _0x2faa9d;})[_0x885a('0x20')](respondWithFilteredResult(_0x45d094,_0x3a4350))[_0x885a('0x3f')](handleError(_0x45d094,null));};exports[_0x885a('0x40')]=function(_0x5d772c,_0x4bd978){var _0x231c67={'raw':!![],'where':{'id':_0x5d772c['params']['id']}},_0x6a33cf={};_0x6a33cf[_0x885a('0x2b')]=_[_0x885a('0x2d')](db[_0x885a('0x3b')][_0x885a('0x28')]);_0x6a33cf[_0x885a('0x2c')]=_[_0x885a('0x2d')](_0x5d772c['query']);_0x6a33cf[_0x885a('0x2e')]=_[_0x885a('0x2f')](_0x6a33cf['model'],_0x6a33cf['query']);_0x231c67[_0x885a('0x30')]=_[_0x885a('0x2f')](_0x6a33cf[_0x885a('0x2b')],qs[_0x885a('0x31')](_0x5d772c[_0x885a('0x2c')][_0x885a('0x31')]));_0x231c67[_0x885a('0x30')]=_0x231c67[_0x885a('0x30')][_0x885a('0x32')]?_0x231c67[_0x885a('0x30')]:_0x6a33cf['model'];if(_0x5d772c[_0x885a('0x2c')][_0x885a('0x3c')]){_0x231c67[_0x885a('0x41')]=[{'all':!![]}];}_0x231c67=_[_0x885a('0x38')]({},_0x231c67,_0x5d772c[_0x885a('0x3a')]);return db[_0x885a('0x3b')][_0x885a('0x42')](_0x231c67)[_0x885a('0x20')](handleEntityNotFound(_0x4bd978,null))['then'](respondWithResult(_0x4bd978,null))[_0x885a('0x3f')](handleError(_0x4bd978,null));};exports['create']=function(_0x5b2388,_0x372462){return db['WhatsappQueueReport'][_0x885a('0x43')](_0x5b2388[_0x885a('0x44')],{})[_0x885a('0x20')](respondWithResult(_0x372462,0xc9))[_0x885a('0x3f')](handleError(_0x372462,null));};exports[_0x885a('0x45')]=function(_0x37453e,_0x195630){if(_0x37453e['body']['id']){delete _0x37453e[_0x885a('0x44')]['id'];}return db[_0x885a('0x3b')][_0x885a('0x42')]({'where':{'id':_0x37453e['params']['id']}})[_0x885a('0x20')](handleEntityNotFound(_0x195630,null))[_0x885a('0x20')](saveUpdates(_0x37453e[_0x885a('0x44')],null))[_0x885a('0x20')](respondWithResult(_0x195630,null))[_0x885a('0x3f')](handleError(_0x195630,null));};exports[_0x885a('0x21')]=function(_0x470058,_0x493296){return db[_0x885a('0x3b')][_0x885a('0x42')]({'where':{'id':_0x470058[_0x885a('0x46')]['id']}})[_0x885a('0x20')](handleEntityNotFound(_0x493296,null))[_0x885a('0x20')](removeEntity(_0x493296,null))['catch'](handleError(_0x493296,null));};exports[_0x885a('0x47')]=function(_0x2dc048,_0x6f095f){return db['WhatsappQueueReport'][_0x885a('0x47')]()[_0x885a('0x20')](respondWithResult(_0x6f095f,null))['catch'](handleError(_0x6f095f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4467218..4b811e0 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 _0xf2b1=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x27ea64,_0x4a42a6){var _0x51c81d=function(_0x521372){while(--_0x521372){_0x27ea64['push'](_0x27ea64['shift']());}};_0x51c81d(++_0x4a42a6);}(_0xf2b1,0x90));var _0x1f2b=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xf2b1[_0x379799];return _0x46e431;};'use strict';var _=require(_0x1f2b('0x0'));var util=require(_0x1f2b('0x1'));var logger=require(_0x1f2b('0x2'))(_0x1f2b('0x3'));var moment=require(_0x1f2b('0x4'));var BPromise=require(_0x1f2b('0x5'));var rp=require(_0x1f2b('0x6'));var fs=require('fs');var path=require(_0x1f2b('0x7'));var rimraf=require(_0x1f2b('0x8'));var config=require(_0x1f2b('0x9'));var attributes=require(_0x1f2b('0xa'));module[_0x1f2b('0xb')]=function(_0x19bfb0,_0x32f6b3){return _0x19bfb0[_0x1f2b('0xc')]('WhatsappQueueReport',attributes,{'tableName':_0x1f2b('0xd'),'paranoid':![],'indexes':[{'name':_0x1f2b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd1=['request-promise','path','rimraf','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x2b13e6,_0x13ee55){var _0x3a75e0=function(_0x80f187){while(--_0x80f187){_0x2b13e6['push'](_0x2b13e6['shift']());}};_0x3a75e0(++_0x13ee55);}(_0x9dd1,0x126));var _0x19dd=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x9dd1[_0x1a1b6e];return _0x571e2c;};'use strict';var _=require(_0x19dd('0x0'));var util=require(_0x19dd('0x1'));var logger=require('../../config/logger')(_0x19dd('0x2'));var moment=require(_0x19dd('0x3'));var BPromise=require(_0x19dd('0x4'));var rp=require(_0x19dd('0x5'));var fs=require('fs');var path=require(_0x19dd('0x6'));var rimraf=require(_0x19dd('0x7'));var config=require('../../config/environment');var attributes=require(_0x19dd('0x8'));module['exports']=function(_0x323768,_0x2b5052){return _0x323768[_0x19dd('0x9')](_0x19dd('0xa'),attributes,{'tableName':_0x19dd('0xb'),'paranoid':![],'indexes':[{'name':_0x19dd('0xc'),'fields':[_0x19dd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4bd2193..f520690 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 _0x3f99=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','debug','lodash','util'];(function(_0x1d3e43,_0x2502d6){var _0x39e13e=function(_0x111d54){while(--_0x111d54){_0x1d3e43['push'](_0x1d3e43['shift']());}};_0x39e13e(++_0x2502d6);}(_0x3f99,0xa3));var _0x93f9=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x3f99[_0x4605dc];return _0x5d3e81;};'use strict';var _=require(_0x93f9('0x0'));var util=require(_0x93f9('0x1'));var moment=require(_0x93f9('0x2'));var BPromise=require(_0x93f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93f9('0x4'));var db=require(_0x93f9('0x5'))['db'];var utils=require(_0x93f9('0x6'));var logger=require(_0x93f9('0x7'))('rpc');var config=require(_0x93f9('0x8'));var jayson=require(_0x93f9('0x9'));var client=jayson[_0x93f9('0xa')][_0x93f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2739e5,_0x24cf6a,_0x50517b){return new BPromise(function(_0x3355e1,_0xfbc98){return client[_0x93f9('0xc')](_0x2739e5,_0x50517b)[_0x93f9('0xd')](function(_0xbe8599){logger[_0x93f9('0xe')](_0x93f9('0xf'),_0x24cf6a,_0x93f9('0x10'));logger['debug'](_0x93f9('0x11'),_0x24cf6a,_0x93f9('0x10'),JSON[_0x93f9('0x12')](_0xbe8599));if(_0xbe8599[_0x93f9('0x13')]){if(_0xbe8599['error'][_0x93f9('0x14')]===0x1f4){logger[_0x93f9('0x13')](_0x93f9('0xf'),_0x24cf6a,_0xbe8599[_0x93f9('0x13')][_0x93f9('0x15')]);return _0xfbc98(_0xbe8599[_0x93f9('0x13')]['message']);}logger['error'](_0x93f9('0xf'),_0x24cf6a,_0xbe8599['error']['message']);return _0x3355e1(_0xbe8599[_0x93f9('0x13')][_0x93f9('0x15')]);}else{logger[_0x93f9('0xe')](_0x93f9('0xf'),_0x24cf6a,_0x93f9('0x10'));_0x3355e1(_0xbe8599[_0x93f9('0x16')][_0x93f9('0x15')]);}})[_0x93f9('0x17')](function(_0x4bbcb9){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x24cf6a,_0x4bbcb9);_0xfbc98(_0x4bbcb9);});});}exports[_0x93f9('0x18')]=function(_0x2a837b){var _0x2f83bf=this;return new Promise(function(_0x14a91d,_0x883132){return db['WhatsappQueueReport']['create'](_0x2a837b[_0x93f9('0x19')],{'raw':_0x2a837b[_0x93f9('0x1a')]?_0x2a837b[_0x93f9('0x1a')][_0x93f9('0x1b')]===undefined?!![]:![]:!![]})[_0x93f9('0xd')](function(_0x509834){logger[_0x93f9('0xe')]('CreateWhatsappQueueReport',_0x2a837b);logger['debug'](_0x93f9('0x18'),_0x2a837b,JSON[_0x93f9('0x12')](_0x509834));_0x14a91d(_0x509834);})['catch'](function(_0x224f95){logger[_0x93f9('0x13')](_0x93f9('0x18'),_0x224f95[_0x93f9('0x15')],_0x2a837b);_0x883132(_0x2f83bf[_0x93f9('0x13')](0x1f4,_0x224f95['message']));});});};exports[_0x93f9('0x1c')]=function(_0x328baf){var _0x40f0c3=this;return new Promise(function(_0x394efb,_0x4ef728){return db['WhatsappQueueReport'][_0x93f9('0x1d')](_0x328baf['body'],{'raw':_0x328baf[_0x93f9('0x1a')]?_0x328baf[_0x93f9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x328baf[_0x93f9('0x1a')]?_0x328baf[_0x93f9('0x1a')][_0x93f9('0x1e')]||null:null,'attributes':_0x328baf[_0x93f9('0x1a')]?_0x328baf['options'][_0x93f9('0x1f')]||null:null,'limit':_0x328baf[_0x93f9('0x1a')]?_0x328baf[_0x93f9('0x1a')]['limit']||null:null})[_0x93f9('0xd')](function(_0x5b153f){logger[_0x93f9('0xe')](_0x93f9('0x1c'),_0x328baf);logger[_0x93f9('0x20')]('UpdateWhatsappQueueReport',_0x328baf,JSON[_0x93f9('0x12')](_0x5b153f));_0x394efb(_0x5b153f);})[_0x93f9('0x17')](function(_0x3d14f7){logger[_0x93f9('0x13')](_0x93f9('0x1c'),_0x3d14f7[_0x93f9('0x15')],_0x328baf);_0x4ef728(_0x40f0c3[_0x93f9('0x13')](0x1f4,_0x3d14f7[_0x93f9('0x15')]));});});}; \ No newline at end of file +var _0xa504=['where','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','body'];(function(_0x33fe48,_0x515886){var _0x3a32e5=function(_0x12c1b5){while(--_0x12c1b5){_0x33fe48['push'](_0x33fe48['shift']());}};_0x3a32e5(++_0x515886);}(_0xa504,0x1c2));var _0x4a50=function(_0x10f936,_0x229008){_0x10f936=_0x10f936-0x0;var _0x3f3d19=_0xa504[_0x10f936];return _0x3f3d19;};'use strict';var _=require(_0x4a50('0x0'));var util=require('util');var moment=require(_0x4a50('0x1'));var BPromise=require(_0x4a50('0x2'));var rs=require(_0x4a50('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a50('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a50('0x5'))(_0x4a50('0x6'));var config=require(_0x4a50('0x7'));var jayson=require(_0x4a50('0x8'));var client=jayson[_0x4a50('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39781c,_0x3cbbd7,_0x5ecd6d){return new BPromise(function(_0x35b606,_0x55ca17){return client[_0x4a50('0xa')](_0x39781c,_0x5ecd6d)[_0x4a50('0xb')](function(_0x511be5){logger[_0x4a50('0xc')](_0x4a50('0xd'),_0x3cbbd7,_0x4a50('0xe'));logger[_0x4a50('0xf')](_0x4a50('0x10'),_0x3cbbd7,_0x4a50('0xe'),JSON[_0x4a50('0x11')](_0x511be5));if(_0x511be5['error']){if(_0x511be5[_0x4a50('0x12')][_0x4a50('0x13')]===0x1f4){logger[_0x4a50('0x12')](_0x4a50('0xd'),_0x3cbbd7,_0x511be5['error']['message']);return _0x55ca17(_0x511be5[_0x4a50('0x12')][_0x4a50('0x14')]);}logger[_0x4a50('0x12')](_0x4a50('0xd'),_0x3cbbd7,_0x511be5[_0x4a50('0x12')][_0x4a50('0x14')]);return _0x35b606(_0x511be5[_0x4a50('0x12')]['message']);}else{logger[_0x4a50('0xc')](_0x4a50('0xd'),_0x3cbbd7,_0x4a50('0xe'));_0x35b606(_0x511be5[_0x4a50('0x15')]['message']);}})[_0x4a50('0x16')](function(_0x179d92){logger[_0x4a50('0x12')](_0x4a50('0xd'),_0x3cbbd7,_0x179d92);_0x55ca17(_0x179d92);});});}exports['CreateWhatsappQueueReport']=function(_0x206e6b){var _0xaa0162=this;return new Promise(function(_0x351f54,_0x533c9e){return db[_0x4a50('0x17')][_0x4a50('0x18')](_0x206e6b['body'],{'raw':_0x206e6b[_0x4a50('0x19')]?_0x206e6b[_0x4a50('0x19')][_0x4a50('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x28b12c){logger[_0x4a50('0xc')](_0x4a50('0x1b'),_0x206e6b);logger[_0x4a50('0xf')](_0x4a50('0x1b'),_0x206e6b,JSON[_0x4a50('0x11')](_0x28b12c));_0x351f54(_0x28b12c);})[_0x4a50('0x16')](function(_0x5ce9be){logger[_0x4a50('0x12')](_0x4a50('0x1b'),_0x5ce9be[_0x4a50('0x14')],_0x206e6b);_0x533c9e(_0xaa0162[_0x4a50('0x12')](0x1f4,_0x5ce9be[_0x4a50('0x14')]));});});};exports[_0x4a50('0x1c')]=function(_0x1b4297){var _0x2b63fa=this;return new Promise(function(_0x124935,_0x2977db){return db['WhatsappQueueReport']['update'](_0x1b4297[_0x4a50('0x1d')],{'raw':_0x1b4297[_0x4a50('0x19')]?_0x1b4297[_0x4a50('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b4297[_0x4a50('0x19')]?_0x1b4297[_0x4a50('0x19')][_0x4a50('0x1e')]||null:null,'attributes':_0x1b4297['options']?_0x1b4297[_0x4a50('0x19')]['attributes']||null:null,'limit':_0x1b4297[_0x4a50('0x19')]?_0x1b4297[_0x4a50('0x19')][_0x4a50('0x1f')]||null:null})[_0x4a50('0xb')](function(_0xed4640){logger[_0x4a50('0xc')](_0x4a50('0x1c'),_0x1b4297);logger[_0x4a50('0xf')](_0x4a50('0x1c'),_0x1b4297,JSON[_0x4a50('0x11')](_0xed4640));_0x124935(_0xed4640);})[_0x4a50('0x16')](function(_0x4ea49a){logger[_0x4a50('0x12')]('UpdateWhatsappQueueReport',_0x4ea49a['message'],_0x1b4297);_0x2977db(_0x2b63fa[_0x4a50('0x12')](0x1f4,_0x4ea49a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 524a49b..a3a26e2 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 _0xe1c0=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe1c0,0x120));var _0x0e1c=function(_0x1029d4,_0x20aa9f){_0x1029d4=_0x1029d4-0x0;var _0x168198=_0xe1c0[_0x1029d4];return _0x168198;};'use strict';var multer=require(_0x0e1c('0x0'));var util=require(_0x0e1c('0x1'));var path=require(_0x0e1c('0x2'));var timeout=require(_0x0e1c('0x3'));var express=require(_0x0e1c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e1c('0x5'));var controller=require(_0x0e1c('0x6'));router[_0x0e1c('0x7')]('/',auth[_0x0e1c('0x8')](),controller[_0x0e1c('0x9')]);router['get']('/describe',auth[_0x0e1c('0x8')](),controller[_0x0e1c('0xa')]);router[_0x0e1c('0x7')](_0x0e1c('0xb'),auth[_0x0e1c('0x8')](),controller[_0x0e1c('0xc')]);router[_0x0e1c('0xd')]('/',auth['isAuthenticated'](),controller[_0x0e1c('0xe')]);router[_0x0e1c('0xf')](_0x0e1c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0e1c('0x10')](_0x0e1c('0xb'),auth[_0x0e1c('0x8')](),controller[_0x0e1c('0x11')]);module[_0x0e1c('0x12')]=router; \ No newline at end of file +var _0xd72d=['delete','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update'];(function(_0x23d50e,_0x378059){var _0x1ce88f=function(_0x33ea5b){while(--_0x33ea5b){_0x23d50e['push'](_0x23d50e['shift']());}};_0x1ce88f(++_0x378059);}(_0xd72d,0x17e));var _0xdd72=function(_0x41f396,_0xfece16){_0x41f396=_0x41f396-0x0;var _0x165320=_0xd72d[_0x41f396];return _0x165320;};'use strict';var multer=require(_0xdd72('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd72('0x1'));var router=express[_0xdd72('0x2')]();var auth=require(_0xdd72('0x3'));var interaction=require(_0xdd72('0x4'));var config=require(_0xdd72('0x5'));var controller=require(_0xdd72('0x6'));router[_0xdd72('0x7')]('/',auth[_0xdd72('0x8')](),controller['index']);router[_0xdd72('0x7')](_0xdd72('0x9'),auth['isAuthenticated'](),controller[_0xdd72('0xa')]);router[_0xdd72('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdd72('0xb')]);router[_0xdd72('0xc')]('/',auth[_0xdd72('0x8')](),controller[_0xdd72('0xd')]);router[_0xdd72('0xe')](_0xdd72('0xf'),auth[_0xdd72('0x8')](),controller[_0xdd72('0x10')]);router[_0xdd72('0x11')](_0xdd72('0xf'),auth[_0xdd72('0x8')](),controller[_0xdd72('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5e90597..dd94384 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 _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x171c66,_0x2d0c23){var _0x5142f9=function(_0x7b354b){while(--_0x7b354b){_0x171c66['push'](_0x171c66['shift']());}};_0x5142f9(++_0x2d0c23);}(_0x2032,0xd9));var _0x2203=function(_0x10d6ee,_0xca51c){_0x10d6ee=_0x10d6ee-0x0;var _0x36f2d8=_0x2032[_0x10d6ee];return _0x36f2d8;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x224090,_0x38f7e4){_0x224090=_0x224090-0x0;var _0xd97361=_0xb10b[_0x224090];return _0xd97361;};'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 67ccc79..1f5bae5 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 _0xa8d3=['rows','show','params','include','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll'];(function(_0x1efa5c,_0x4deafb){var _0x4f8376=function(_0x132a82){while(--_0x132a82){_0x1efa5c['push'](_0x1efa5c['shift']());}};_0x4f8376(++_0x4deafb);}(_0xa8d3,0x121));var _0x3a8d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa8d3[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x3a8d('0x0'));var emlformat=require(_0x3a8d('0x1'));var rimraf=require(_0x3a8d('0x2'));var zipdir=require(_0x3a8d('0x3'));var jsonpatch=require(_0x3a8d('0x4'));var rp=require(_0x3a8d('0x5'));var moment=require(_0x3a8d('0x6'));var BPromise=require(_0x3a8d('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3a8d('0x8'));var sox=require('sox');var csv=require(_0x3a8d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a8d('0xa'));var squel=require(_0x3a8d('0xb'));var crypto=require(_0x3a8d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3a8d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3a8d('0xe'));var Redis=require('ioredis');var authService=require(_0x3a8d('0xf'));var qs=require(_0x3a8d('0x10'));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(_0x3a8d('0x11'));var licenseUtil=require(_0x3a8d('0x12'));var db=require(_0x3a8d('0x13'))['db'];function respondWithStatusCode(_0x7f8e2f,_0x475911){_0x475911=_0x475911||0xcc;return function(_0x23b057){if(_0x23b057){return _0x7f8e2f[_0x3a8d('0x14')](_0x475911);}return _0x7f8e2f[_0x3a8d('0x15')](_0x475911)['end']();};}function respondWithResult(_0x3a73a7,_0x3daa33){_0x3daa33=_0x3daa33||0xc8;return function(_0x2ed069){if(_0x2ed069){return _0x3a73a7[_0x3a8d('0x15')](_0x3daa33)[_0x3a8d('0x16')](_0x2ed069);}};}function respondWithFilteredResult(_0x2473b4,_0x25ebec){return function(_0x8caf7){if(_0x8caf7){var _0x5c376d=_0x8caf7[_0x3a8d('0x17')],_0xaab36a=_0x25ebec['offset'],_0x15639a=_0x25ebec[_0x3a8d('0x18')]+_0x25ebec[_0x3a8d('0x19')],_0x5b8115;if(_0x15639a>=_0x5c376d){_0x15639a=_0x5c376d;_0x5b8115=0xc8;}else{_0x5b8115=0xce;}_0x2473b4[_0x3a8d('0x15')](_0x5b8115);return _0x2473b4[_0x3a8d('0x1a')](_0x3a8d('0x1b'),_0xaab36a+'-'+_0x15639a+'/'+_0x5c376d)['json'](_0x8caf7);}return null;};}function patchUpdates(_0x5bfac5){return function(_0x490a1f){try{jsonpatch[_0x3a8d('0x1c')](_0x490a1f,_0x5bfac5,!![]);}catch(_0x3870dd){return BPromise[_0x3a8d('0x1d')](_0x3870dd);}return _0x490a1f['save']();};}function saveUpdates(_0x359620,_0x31653a){return function(_0xc910cf){if(_0xc910cf){return _0xc910cf[_0x3a8d('0x1e')](_0x359620)['then'](function(_0x3384de){return _0x3384de;});}return null;};}function removeEntity(_0xa196a0,_0x32aaed){return function(_0x9c978e){if(_0x9c978e){return _0x9c978e['destroy']()[_0x3a8d('0x1f')](function(){_0xa196a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa45a,_0x5f19e9){return function(_0x311e96){if(!_0x311e96){_0x3aa45a['sendStatus'](0x194);}return _0x311e96;};}function handleError(_0x2344c0,_0x5ef07b){_0x5ef07b=_0x5ef07b||0x1f4;return function(_0x15179d){logger[_0x3a8d('0x20')](_0x15179d['stack']);if(_0x15179d[_0x3a8d('0x21')]){delete _0x15179d[_0x3a8d('0x21')];}_0x2344c0[_0x3a8d('0x15')](_0x5ef07b)[_0x3a8d('0x22')](_0x15179d);};}exports[_0x3a8d('0x23')]=function(_0x59d864,_0x43e414){var _0x5b6256={},_0x2b56b4={},_0x35dbf8={'count':0x0,'rows':[]};var _0xe2ca02=_[_0x3a8d('0x24')](db[_0x3a8d('0x25')][_0x3a8d('0x26')],function(_0x62b638){return{'name':_0x62b638[_0x3a8d('0x27')],'type':_0x62b638[_0x3a8d('0x28')][_0x3a8d('0x29')]};});_0x2b56b4['model']=_[_0x3a8d('0x24')](_0xe2ca02,_0x3a8d('0x21'));_0x2b56b4[_0x3a8d('0x2a')]=_[_0x3a8d('0x2b')](_0x59d864[_0x3a8d('0x2a')]);_0x2b56b4[_0x3a8d('0x2c')]=_[_0x3a8d('0x2d')](_0x2b56b4[_0x3a8d('0x2e')],_0x2b56b4['query']);_0x5b6256[_0x3a8d('0x2f')]=_[_0x3a8d('0x2d')](_0x2b56b4['model'],qs[_0x3a8d('0x30')](_0x59d864[_0x3a8d('0x2a')]['fields']));_0x5b6256[_0x3a8d('0x2f')]=_0x5b6256['attributes'][_0x3a8d('0x31')]?_0x5b6256[_0x3a8d('0x2f')]:_0x2b56b4[_0x3a8d('0x2e')];if(!_0x59d864['query'][_0x3a8d('0x32')](_0x3a8d('0x33'))){_0x5b6256[_0x3a8d('0x19')]=qs[_0x3a8d('0x19')](_0x59d864['query'][_0x3a8d('0x19')]);_0x5b6256[_0x3a8d('0x18')]=qs[_0x3a8d('0x18')](_0x59d864[_0x3a8d('0x2a')]['offset']);}_0x5b6256[_0x3a8d('0x34')]=qs[_0x3a8d('0x35')](_0x59d864[_0x3a8d('0x2a')][_0x3a8d('0x35')]);_0x5b6256[_0x3a8d('0x36')]=qs[_0x3a8d('0x2c')](_[_0x3a8d('0x37')](_0x59d864[_0x3a8d('0x2a')],_0x2b56b4['filters']),_0xe2ca02);if(_0x59d864[_0x3a8d('0x2a')]['filter']){_0x5b6256[_0x3a8d('0x36')]=_['merge'](_0x5b6256['where'],{'$or':_[_0x3a8d('0x24')](_0xe2ca02,function(_0x3b32af){if(_0x3b32af[_0x3a8d('0x28')]!==_0x3a8d('0x38')){var _0x519493={};_0x519493[_0x3b32af[_0x3a8d('0x21')]]={'$like':'%'+_0x59d864[_0x3a8d('0x2a')]['filter']+'%'};return _0x519493;}})});}_0x5b6256=_[_0x3a8d('0x39')]({},_0x5b6256,_0x59d864[_0x3a8d('0x3a')]);var _0x55cd6b={'where':_0x5b6256[_0x3a8d('0x36')]};return db[_0x3a8d('0x25')][_0x3a8d('0x17')](_0x55cd6b)[_0x3a8d('0x1f')](function(_0x24c0e0){_0x35dbf8['count']=_0x24c0e0;if(_0x59d864['query'][_0x3a8d('0x3b')]){_0x5b6256['include']=[{'all':!![]}];}return db[_0x3a8d('0x25')][_0x3a8d('0x3c')](_0x5b6256);})[_0x3a8d('0x1f')](function(_0x2a8055){_0x35dbf8[_0x3a8d('0x3d')]=_0x2a8055;return _0x35dbf8;})[_0x3a8d('0x1f')](respondWithFilteredResult(_0x43e414,_0x5b6256))['catch'](handleError(_0x43e414,null));};exports[_0x3a8d('0x3e')]=function(_0x206de5,_0x4ef74c){var _0x41dbba={'raw':!![],'where':{'id':_0x206de5[_0x3a8d('0x3f')]['id']}},_0x105546={};_0x105546[_0x3a8d('0x2e')]=_[_0x3a8d('0x2b')](db[_0x3a8d('0x25')][_0x3a8d('0x26')]);_0x105546['query']=_[_0x3a8d('0x2b')](_0x206de5['query']);_0x105546['filters']=_[_0x3a8d('0x2d')](_0x105546[_0x3a8d('0x2e')],_0x105546['query']);_0x41dbba[_0x3a8d('0x2f')]=_[_0x3a8d('0x2d')](_0x105546[_0x3a8d('0x2e')],qs[_0x3a8d('0x30')](_0x206de5[_0x3a8d('0x2a')]['fields']));_0x41dbba['attributes']=_0x41dbba['attributes'][_0x3a8d('0x31')]?_0x41dbba[_0x3a8d('0x2f')]:_0x105546['model'];if(_0x206de5[_0x3a8d('0x2a')]['includeAll']){_0x41dbba[_0x3a8d('0x40')]=[{'all':!![]}];}_0x41dbba=_['merge']({},_0x41dbba,_0x206de5[_0x3a8d('0x3a')]);return db['WhatsappTransferReport'][_0x3a8d('0x41')](_0x41dbba)[_0x3a8d('0x1f')](handleEntityNotFound(_0x4ef74c,null))[_0x3a8d('0x1f')](respondWithResult(_0x4ef74c,null))[_0x3a8d('0x42')](handleError(_0x4ef74c,null));};exports[_0x3a8d('0x43')]=function(_0x2fed08,_0x1911a7){return db[_0x3a8d('0x25')][_0x3a8d('0x43')](_0x2fed08[_0x3a8d('0x44')],{})['then'](respondWithResult(_0x1911a7,0xc9))[_0x3a8d('0x42')](handleError(_0x1911a7,null));};exports[_0x3a8d('0x1e')]=function(_0x4913be,_0x3d8505){if(_0x4913be[_0x3a8d('0x44')]['id']){delete _0x4913be[_0x3a8d('0x44')]['id'];}return db[_0x3a8d('0x25')][_0x3a8d('0x41')]({'where':{'id':_0x4913be['params']['id']}})[_0x3a8d('0x1f')](handleEntityNotFound(_0x3d8505,null))[_0x3a8d('0x1f')](saveUpdates(_0x4913be[_0x3a8d('0x44')],null))[_0x3a8d('0x1f')](respondWithResult(_0x3d8505,null))['catch'](handleError(_0x3d8505,null));};exports['destroy']=function(_0xb52dd5,_0x4fcd17){return db['WhatsappTransferReport'][_0x3a8d('0x41')]({'where':{'id':_0xb52dd5[_0x3a8d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4fcd17,null))['then'](removeEntity(_0x4fcd17,null))[_0x3a8d('0x42')](handleError(_0x4fcd17,null));};exports[_0x3a8d('0x45')]=function(_0x3c8bdc,_0x551a73){return db[_0x3a8d('0x25')]['describe']()[_0x3a8d('0x1f')](respondWithResult(_0x551a73,null))['catch'](handleError(_0x551a73,null));}; \ No newline at end of file +var _0xc663=['params','length','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','reject','save','then','destroy','sendStatus','error','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','show'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xc663,0xe3));var _0x3c66=function(_0x67f65f,_0x541c1a){_0x67f65f=_0x67f65f-0x0;var _0x124a3e=_0xc663[_0x67f65f];return _0x124a3e;};'use strict';var pdf=require(_0x3c66('0x0'));var emlformat=require(_0x3c66('0x1'));var rimraf=require(_0x3c66('0x2'));var zipdir=require(_0x3c66('0x3'));var jsonpatch=require(_0x3c66('0x4'));var rp=require(_0x3c66('0x5'));var moment=require('moment');var BPromise=require(_0x3c66('0x6'));var Mustache=require(_0x3c66('0x7'));var util=require('util');var path=require(_0x3c66('0x8'));var sox=require('sox');var csv=require(_0x3c66('0x9'));var ejs=require(_0x3c66('0xa'));var fs=require('fs');var _=require(_0x3c66('0xb'));var squel=require('squel');var crypto=require(_0x3c66('0xc'));var jsforce=require(_0x3c66('0xd'));var deskjs=require(_0x3c66('0xe'));var toCsv=require(_0x3c66('0x9'));var querystring=require(_0x3c66('0xf'));var Papa=require(_0x3c66('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c66('0x11'));var as=require(_0x3c66('0x12'));var hardwareService=require(_0x3c66('0x13'));var logger=require('../../config/logger')(_0x3c66('0x14'));var utils=require(_0x3c66('0x15'));var config=require(_0x3c66('0x16'));var licenseUtil=require(_0x3c66('0x17'));var db=require(_0x3c66('0x18'))['db'];function respondWithStatusCode(_0x4a9c15,_0x4b1df5){_0x4b1df5=_0x4b1df5||0xcc;return function(_0x30b4c2){if(_0x30b4c2){return _0x4a9c15['sendStatus'](_0x4b1df5);}return _0x4a9c15[_0x3c66('0x19')](_0x4b1df5)[_0x3c66('0x1a')]();};}function respondWithResult(_0x2689c9,_0x5a48b8){_0x5a48b8=_0x5a48b8||0xc8;return function(_0x28eef0){if(_0x28eef0){return _0x2689c9['status'](_0x5a48b8)[_0x3c66('0x1b')](_0x28eef0);}};}function respondWithFilteredResult(_0x3f50a4,_0x19be51){return function(_0x23dbdf){if(_0x23dbdf){var _0x1ce81c=_0x23dbdf[_0x3c66('0x1c')],_0x281779=_0x19be51[_0x3c66('0x1d')],_0x1ccebb=_0x19be51['offset']+_0x19be51['limit'],_0x28f30e;if(_0x1ccebb>=_0x1ce81c){_0x1ccebb=_0x1ce81c;_0x28f30e=0xc8;}else{_0x28f30e=0xce;}_0x3f50a4[_0x3c66('0x19')](_0x28f30e);return _0x3f50a4[_0x3c66('0x1e')]('Content-Range',_0x281779+'-'+_0x1ccebb+'/'+_0x1ce81c)[_0x3c66('0x1b')](_0x23dbdf);}return null;};}function patchUpdates(_0x3d6265){return function(_0x3181a6){try{jsonpatch['apply'](_0x3181a6,_0x3d6265,!![]);}catch(_0x3ac388){return BPromise[_0x3c66('0x1f')](_0x3ac388);}return _0x3181a6[_0x3c66('0x20')]();};}function saveUpdates(_0x414738,_0x5c94f5){return function(_0x40802e){if(_0x40802e){return _0x40802e['update'](_0x414738)[_0x3c66('0x21')](function(_0x3794e0){return _0x3794e0;});}return null;};}function removeEntity(_0x51cb5e,_0x2887ca){return function(_0x5cd1bf){if(_0x5cd1bf){return _0x5cd1bf[_0x3c66('0x22')]()[_0x3c66('0x21')](function(){_0x51cb5e['status'](0xcc)[_0x3c66('0x1a')]();});}};}function handleEntityNotFound(_0x12813d,_0x47f1f3){return function(_0x3b46d6){if(!_0x3b46d6){_0x12813d[_0x3c66('0x23')](0x194);}return _0x3b46d6;};}function handleError(_0x1903ce,_0x929722){_0x929722=_0x929722||0x1f4;return function(_0x2ed0dc){logger[_0x3c66('0x24')](_0x2ed0dc['stack']);if(_0x2ed0dc[_0x3c66('0x25')]){delete _0x2ed0dc[_0x3c66('0x25')];}_0x1903ce[_0x3c66('0x19')](_0x929722)[_0x3c66('0x26')](_0x2ed0dc);};}exports[_0x3c66('0x27')]=function(_0x5ca216,_0x10c2c6){var _0x26d8a8={},_0x359ab8={},_0x423da2={'count':0x0,'rows':[]};var _0x3fb1db=_[_0x3c66('0x28')](db[_0x3c66('0x29')][_0x3c66('0x2a')],function(_0x339afc){return{'name':_0x339afc['fieldName'],'type':_0x339afc[_0x3c66('0x2b')][_0x3c66('0x2c')]};});_0x359ab8[_0x3c66('0x2d')]=_[_0x3c66('0x28')](_0x3fb1db,_0x3c66('0x25'));_0x359ab8[_0x3c66('0x2e')]=_[_0x3c66('0x2f')](_0x5ca216[_0x3c66('0x2e')]);_0x359ab8[_0x3c66('0x30')]=_[_0x3c66('0x31')](_0x359ab8['model'],_0x359ab8[_0x3c66('0x2e')]);_0x26d8a8['attributes']=_[_0x3c66('0x31')](_0x359ab8[_0x3c66('0x2d')],qs[_0x3c66('0x32')](_0x5ca216[_0x3c66('0x2e')]['fields']));_0x26d8a8[_0x3c66('0x33')]=_0x26d8a8[_0x3c66('0x33')]['length']?_0x26d8a8[_0x3c66('0x33')]:_0x359ab8['model'];if(!_0x5ca216[_0x3c66('0x2e')][_0x3c66('0x34')](_0x3c66('0x35'))){_0x26d8a8[_0x3c66('0x36')]=qs['limit'](_0x5ca216['query']['limit']);_0x26d8a8['offset']=qs[_0x3c66('0x1d')](_0x5ca216[_0x3c66('0x2e')]['offset']);}_0x26d8a8[_0x3c66('0x37')]=qs[_0x3c66('0x38')](_0x5ca216[_0x3c66('0x2e')][_0x3c66('0x38')]);_0x26d8a8['where']=qs[_0x3c66('0x30')](_['pick'](_0x5ca216[_0x3c66('0x2e')],_0x359ab8[_0x3c66('0x30')]),_0x3fb1db);if(_0x5ca216[_0x3c66('0x2e')][_0x3c66('0x39')]){_0x26d8a8[_0x3c66('0x3a')]=_[_0x3c66('0x3b')](_0x26d8a8[_0x3c66('0x3a')],{'$or':_[_0x3c66('0x28')](_0x3fb1db,function(_0x235172){if(_0x235172[_0x3c66('0x2b')]!==_0x3c66('0x3c')){var _0x2dbfc9={};_0x2dbfc9[_0x235172[_0x3c66('0x25')]]={'$like':'%'+_0x5ca216[_0x3c66('0x2e')]['filter']+'%'};return _0x2dbfc9;}})});}_0x26d8a8=_[_0x3c66('0x3b')]({},_0x26d8a8,_0x5ca216[_0x3c66('0x3d')]);var _0x21aa34={'where':_0x26d8a8[_0x3c66('0x3a')]};return db[_0x3c66('0x29')][_0x3c66('0x1c')](_0x21aa34)[_0x3c66('0x21')](function(_0x4eed53){_0x423da2['count']=_0x4eed53;if(_0x5ca216['query'][_0x3c66('0x3e')]){_0x26d8a8[_0x3c66('0x3f')]=[{'all':!![]}];}return db[_0x3c66('0x29')]['findAll'](_0x26d8a8);})['then'](function(_0x1886b4){_0x423da2['rows']=_0x1886b4;return _0x423da2;})['then'](respondWithFilteredResult(_0x10c2c6,_0x26d8a8))['catch'](handleError(_0x10c2c6,null));};exports[_0x3c66('0x40')]=function(_0x4c50c4,_0x4f52a0){var _0x57d8b0={'raw':!![],'where':{'id':_0x4c50c4[_0x3c66('0x41')]['id']}},_0x1c8d54={};_0x1c8d54[_0x3c66('0x2d')]=_[_0x3c66('0x2f')](db[_0x3c66('0x29')][_0x3c66('0x2a')]);_0x1c8d54[_0x3c66('0x2e')]=_['keys'](_0x4c50c4[_0x3c66('0x2e')]);_0x1c8d54[_0x3c66('0x30')]=_[_0x3c66('0x31')](_0x1c8d54[_0x3c66('0x2d')],_0x1c8d54[_0x3c66('0x2e')]);_0x57d8b0[_0x3c66('0x33')]=_['intersection'](_0x1c8d54['model'],qs[_0x3c66('0x32')](_0x4c50c4[_0x3c66('0x2e')][_0x3c66('0x32')]));_0x57d8b0[_0x3c66('0x33')]=_0x57d8b0[_0x3c66('0x33')][_0x3c66('0x42')]?_0x57d8b0[_0x3c66('0x33')]:_0x1c8d54['model'];if(_0x4c50c4[_0x3c66('0x2e')][_0x3c66('0x3e')]){_0x57d8b0['include']=[{'all':!![]}];}_0x57d8b0=_['merge']({},_0x57d8b0,_0x4c50c4[_0x3c66('0x3d')]);return db[_0x3c66('0x29')][_0x3c66('0x43')](_0x57d8b0)[_0x3c66('0x21')](handleEntityNotFound(_0x4f52a0,null))[_0x3c66('0x21')](respondWithResult(_0x4f52a0,null))[_0x3c66('0x44')](handleError(_0x4f52a0,null));};exports[_0x3c66('0x45')]=function(_0x1c0d70,_0x4971f4){return db[_0x3c66('0x29')][_0x3c66('0x45')](_0x1c0d70[_0x3c66('0x46')],{})[_0x3c66('0x21')](respondWithResult(_0x4971f4,0xc9))[_0x3c66('0x44')](handleError(_0x4971f4,null));};exports[_0x3c66('0x47')]=function(_0x4b07dc,_0x518d15){if(_0x4b07dc['body']['id']){delete _0x4b07dc[_0x3c66('0x46')]['id'];}return db['WhatsappTransferReport'][_0x3c66('0x43')]({'where':{'id':_0x4b07dc[_0x3c66('0x41')]['id']}})[_0x3c66('0x21')](handleEntityNotFound(_0x518d15,null))[_0x3c66('0x21')](saveUpdates(_0x4b07dc['body'],null))[_0x3c66('0x21')](respondWithResult(_0x518d15,null))[_0x3c66('0x44')](handleError(_0x518d15,null));};exports['destroy']=function(_0x451586,_0x45d008){return db[_0x3c66('0x29')][_0x3c66('0x43')]({'where':{'id':_0x451586[_0x3c66('0x41')]['id']}})['then'](handleEntityNotFound(_0x45d008,null))['then'](removeEntity(_0x45d008,null))[_0x3c66('0x44')](handleError(_0x45d008,null));};exports['describe']=function(_0x22771c,_0x2942a6){return db[_0x3c66('0x29')][_0x3c66('0x48')]()['then'](respondWithResult(_0x2942a6,null))[_0x3c66('0x44')](handleError(_0x2942a6,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2956737..50c83ef 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 _0x7130=['rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','moment','bluebird','request-promise','path'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x7130,0x74));var _0x0713=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7130[_0x4c445a];return _0x2f611c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0713('0x0'));var BPromise=require(_0x0713('0x1'));var rp=require(_0x0713('0x2'));var fs=require('fs');var path=require(_0x0713('0x3'));var rimraf=require(_0x0713('0x4'));var config=require(_0x0713('0x5'));var attributes=require(_0x0713('0x6'));module['exports']=function(_0x25def6,_0x5cf187){return _0x25def6[_0x0713('0x7')](_0x0713('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0713('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf18a=['api','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0xf18a,0x14f));var _0xaf18=function(_0x9eba70,_0x5378a7){_0x9eba70=_0x9eba70-0x0;var _0x2a8583=_0xf18a[_0x9eba70];return _0x2a8583;};'use strict';var _=require(_0xaf18('0x0'));var util=require(_0xaf18('0x1'));var logger=require(_0xaf18('0x2'))(_0xaf18('0x3'));var moment=require(_0xaf18('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf18('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf18('0x6'));var config=require(_0xaf18('0x7'));var attributes=require(_0xaf18('0x8'));module[_0xaf18('0x9')]=function(_0x463241,_0x2ac78d){return _0x463241[_0xaf18('0xa')](_0xaf18('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xaf18('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c24dfe5..458f046 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(_0x2b8fb8,_0x473b5d){var _0x2eef36=function(_0xe27821){while(--_0xe27821){_0x2b8fb8['push'](_0x2b8fb8['shift']());}};_0x2eef36(++_0x473b5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x25a797,_0x2fca1c){var _0x1b5712=function(_0x1a0900){while(--_0x1a0900){_0x25a797['push'](_0x25a797['shift']());}};_0x1b5712(++_0x2fca1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 8d798c8..d1fbe58 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc36=['map','online','join','status','name','None','seedDB','./config/seedDB','./config/license','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','listen','then','start','info'];(function(_0x368741,_0x50dd8b){var _0x463dc5=function(_0x5d4761){while(--_0x5d4761){_0x368741['push'](_0x368741['shift']());}};_0x463dc5(++_0x50dd8b);}(_0xbc36,0x169));var _0x6bc3=function(_0x552097,_0x225983){_0x552097=_0x552097-0x0;var _0x2a98a0=_0xbc36[_0x552097];return _0x2a98a0;};'use strict';var _=require(_0x6bc3('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x6bc3('0x1'));var config=require(_0x6bc3('0x2'));var logger=require(_0x6bc3('0x3'))(_0x6bc3('0x4'));var pm2=require(_0x6bc3('0x5'));var pm2Config=require(_0x6bc3('0x6'));var schedule=require(_0x6bc3('0x7'));var chat=require(_0x6bc3('0x8'));var whatsapp=require(_0x6bc3('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x6bc3('0xa')][_0x6bc3('0xb')]()['then'](function(){return rpc[_0x6bc3('0xc')]();})[_0x6bc3('0xd')](function(_0xf07594){logger['info'](_0xf07594);return chat[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(){return whatsapp[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(){return schedule['start']();})[_0x6bc3('0xd')](function(){return transcribe[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(_0x3269c2){logger[_0x6bc3('0xf')](_0x3269c2);return pm2[_0x6bc3('0xe')](pm2Config);})[_0x6bc3('0xd')](function(_0x58f5ab){logger[_0x6bc3('0xf')]('Online\x20apps:',_[_0x6bc3('0x10')](_['filter'](_0x58f5ab,{'status':_0x6bc3('0x11')}),'name')[_0x6bc3('0x12')]());logger[_0x6bc3('0xf')]('Offline\x20apps:',_[_0x6bc3('0x10')](_['filter'](_0x58f5ab,function(_0x5872e1){return _0x5872e1[_0x6bc3('0x13')]!==_0x6bc3('0x11');}),_0x6bc3('0x14'))[_0x6bc3('0x12')]()||_0x6bc3('0x15'));config[_0x6bc3('0x16')]&&require(_0x6bc3('0x17'))['default']();require(_0x6bc3('0x18'))[_0x6bc3('0x19')]();})['catch'](function(_0x426a16){logger[_0x6bc3('0x1a')](_0x6bc3('0x1b'),_0x426a16);process[_0x6bc3('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x23bb=['./config/pm2/config','./config/schedule','./config/schedule/chat','sync','start','then','info','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/environment','./config/logger','app'];(function(_0x2ab06a,_0x251476){var _0x18c5e9=function(_0x47c55f){while(--_0x47c55f){_0x2ab06a['push'](_0x2ab06a['shift']());}};_0x18c5e9(++_0x251476);}(_0x23bb,0x79));var _0xb23b=function(_0x13033f,_0x2045af){_0x13033f=_0x13033f-0x0;var _0x2ed576=_0x23bb[_0x13033f];return _0x2ed576;};'use strict';var _=require(_0xb23b('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0xb23b('0x1'));var logger=require(_0xb23b('0x2'))(_0xb23b('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xb23b('0x4'));var schedule=require(_0xb23b('0x5'));var chat=require(_0xb23b('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0xb23b('0x7')]()['then'](function(){return rpc['listen']();})['then'](function(_0x29e8e9){logger['info'](_0x29e8e9);return chat[_0xb23b('0x8')]();})['then'](function(){return whatsapp[_0xb23b('0x8')]();})[_0xb23b('0x9')](function(){return schedule['start']();})[_0xb23b('0x9')](function(){return transcribe[_0xb23b('0x8')]();})['then'](function(_0x4517ca){logger[_0xb23b('0xa')](_0x4517ca);return pm2[_0xb23b('0x8')](pm2Config);})['then'](function(_0x1048f2){logger[_0xb23b('0xa')](_0xb23b('0xb'),_[_0xb23b('0xc')](_[_0xb23b('0xd')](_0x1048f2,{'status':_0xb23b('0xe')}),_0xb23b('0xf'))[_0xb23b('0x10')]());logger[_0xb23b('0xa')](_0xb23b('0x11'),_[_0xb23b('0xc')](_[_0xb23b('0xd')](_0x1048f2,function(_0x2e4897){return _0x2e4897[_0xb23b('0x12')]!==_0xb23b('0xe');}),_0xb23b('0xf'))[_0xb23b('0x10')]()||'None');config[_0xb23b('0x13')]&&require(_0xb23b('0x14'))[_0xb23b('0x15')]();require(_0xb23b('0x16'))[_0xb23b('0x15')]();})['catch'](function(_0x1db9a7){logger['error'](_0xb23b('0x17'),_0x1db9a7);process[_0xb23b('0x18')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 51a08fd..d1cda1b 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 _0x2cc9=['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','split','length','splice','unshift','join','promisify','sign','secret','payload','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','chatPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','then','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','catch','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','signToken','cookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString'];(function(_0x2d7fa1,_0x4cca90){var _0x4dc8cc=function(_0x4bd463){while(--_0x4bd463){_0x2d7fa1['push'](_0x2d7fa1['shift']());}};_0x4dc8cc(++_0x4cca90);}(_0x2cc9,0x176));var _0x92cc=function(_0x53a647,_0x1b9d72){_0x53a647=_0x53a647-0x0;var _0x33dfc6=_0x2cc9[_0x53a647];return _0x33dfc6;};'use strict';var db=require(_0x92cc('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x92cc('0x1'));var licenseUtil=require(_0x92cc('0x2'));var encryptor=require('../encryptor');var _=require(_0x92cc('0x3'));var jwt=require(_0x92cc('0x4'));var expressJwt=require(_0x92cc('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x92cc('0x6'));var crypto=require(_0x92cc('0x7'));var BPromise=require(_0x92cc('0x8'));var util=require(_0x92cc('0x9'));var moment=require(_0x92cc('0xa'));var validateJwt=expressJwt({'secret':config[_0x92cc('0xb')][_0x92cc('0xc')]});var userAttributes=['id',_0x92cc('0xd'),_0x92cc('0xe'),_0x92cc('0xf'),'internal',_0x92cc('0x10'),_0x92cc('0x11'),'permissions','md5secret','voicePause',_0x92cc('0x12'),'mailPause','faxPause','smsPause',_0x92cc('0x13'),_0x92cc('0x14'),_0x92cc('0x15'),_0x92cc('0x16'),_0x92cc('0x17'),'crudPermissions',_0x92cc('0x18'),_0x92cc('0x19'),_0x92cc('0x1a'),_0x92cc('0x1b'),_0x92cc('0x1c'),_0x92cc('0x1d'),_0x92cc('0x1e'),_0x92cc('0x1f'),_0x92cc('0x20'),_0x92cc('0x21'),_0x92cc('0x22'),'phoneBarRemoteControl',_0x92cc('0x23'),_0x92cc('0x24'),'interface',_0x92cc('0x25'),_0x92cc('0x26')];exports[_0x92cc('0x27')]=function(){return this[_0x92cc('0x28')](!![])[_0x92cc('0x29')](function(_0x3b9661,_0x29df7d,_0x5eb250){if(_0x3b9661[_0x92cc('0x2a')]){_0x5eb250();}else{return db[_0x92cc('0x2b')][_0x92cc('0x2c')]({'where':{'id':_0x3b9661[_0x92cc('0x2d')]['id']},'attributes':['id',_0x92cc('0x2e'),_0x92cc('0x2f')],'raw':!![]})['then'](function(_0x16585b){if(_0x16585b&&_0x16585b[_0x92cc('0x2e')]){return _0x29df7d[_0x92cc('0x30')](_0x16585b['disposition']===_0x92cc('0x31')?0x195:0x193)[_0x92cc('0x32')]({'message':_0x16585b[_0x92cc('0x2f')]==='unmanaged'?_0x92cc('0x33'):_0x92cc('0x34')});}else{_0x5eb250();}})['catch'](function(_0x381482){_0x5eb250(_0x381482);});}});};exports[_0x92cc('0x28')]=function isAuthenticated(_0x40f3a0){return compose()[_0x92cc('0x29')](function(_0x4cb0cd,_0x509bc8,_0x26ce28){var _0x12c0ab;if(_0x4cb0cd[_0x92cc('0x35')][_0x92cc('0x36')]){if(_[_0x92cc('0x37')](_0x4cb0cd[_0x92cc('0x35')][_0x92cc('0x36')],_0x92cc('0x38'))){var _0x5e42dc=basicAuth(_0x4cb0cd);db[_0x92cc('0x39')][_0x92cc('0x3a')]({'where':{'name':_0x5e42dc['name']}})[_0x92cc('0x3b')](function(_0x4ed3b0){if(!_0x4ed3b0||!_0x4ed3b0[_0x92cc('0x3c')](_0x5e42dc[_0x92cc('0x3d')])){return _0x509bc8[_0x92cc('0x30')](0x191)[_0x92cc('0x32')]({'message':_0x92cc('0x3e')});}_0x4cb0cd[_0x92cc('0x2a')]={'id':_0x4ed3b0['id']};_0x26ce28();})['catch'](function(_0x21a4cb){_0x26ce28(_0x21a4cb);});}else if(_['startsWith'](_0x4cb0cd['headers']['authorization'],_0x92cc('0x3f'))){validateJwt(_0x4cb0cd,_0x509bc8,_0x26ce28);}else{if(_0x40f3a0){_0x26ce28();}else{return _0x509bc8['status'](0x193)[_0x92cc('0x32')]({'message':_0x92cc('0x40')});}}}else if(_0x4cb0cd[_0x92cc('0x41')][_0x92cc('0x42')]){try{var _0x84c6ed={'audience':hardwareConf[_0x92cc('0x43')](),'issuer':hardwareConf[_0x92cc('0x43')]()};verifyJwt(_0x4cb0cd[_0x92cc('0x41')][_0x92cc('0x42')],_0x84c6ed)['then'](function(_0x13ce7c){return db[_0x92cc('0x39')][_0x92cc('0x3a')]({'where':{'id':_0x13ce7c['sub']}})[_0x92cc('0x3b')](function(_0x806b44){_0x12c0ab=_0x806b44;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x92cc('0x44'),_0x92cc('0x45')],'raw':!![]});})[_0x92cc('0x3b')](function(_0x1e6f17){if(!_0x12c0ab||!_['isEqual'](_0x12c0ab[_0x92cc('0x46')],_0x13ce7c[_0x92cc('0x47')])){return _0x509bc8[_0x92cc('0x30')](0x191)['json']({'message':_0x92cc('0x48')});}if(_0x12c0ab[_0x92cc('0x49')]){return _0x509bc8['status'](0x191)['json']({'message':_0x92cc('0x4a')});}if(_0x12c0ab[_0x92cc('0x4b')]){if(_0x1e6f17[_0x92cc('0x45')]>0x0){if(moment(_0x12c0ab['blockedAt'])[_0x92cc('0x4c')](_0x1e6f17[_0x92cc('0x45')],_0x92cc('0x4d'))>moment()){return _0x509bc8['status'](0x191)['json']({'message':_0x92cc('0x4a')});}}else{return _0x509bc8[_0x92cc('0x30')](0x191)[_0x92cc('0x32')]({'message':_0x92cc('0x4a')});}}_0x4cb0cd[_0x92cc('0x2a')]={'id':_0x12c0ab['id']};_0x26ce28();});})[_0x92cc('0x4e')](function(){return _0x509bc8[_0x92cc('0x30')](0x191)['json']({'message':_0x92cc('0x4a')});});}catch(_0x29356a){_0x26ce28(_0x29356a);}}else if(_0x40f3a0){_0x26ce28();}else{return _0x509bc8[_0x92cc('0x30')](0x193)[_0x92cc('0x32')]({'message':_0x92cc('0x40')});}})[_0x92cc('0x29')](function(_0x3ce211,_0x101501,_0x92d767){if(_0x3ce211['user']){db[_0x92cc('0x39')][_0x92cc('0x3a')]({'where':{'id':_0x3ce211['user']['id']},'attributes':userAttributes})[_0x92cc('0x3b')](function(_0x37fa03){if(!_0x37fa03){return _0x101501['status'](0x194)['json']({'message':_0x92cc('0x4f')});}_0x3ce211[_0x92cc('0x2a')]=_0x37fa03;_0x92d767();})[_0x92cc('0x4e')](function(_0x223894){_0x92d767(_0x223894);});}else if(_0x40f3a0){_0x92d767();}else{return _0x101501[_0x92cc('0x30')](0x194)['json']({'message':_0x92cc('0x50')});}});};exports[_0x92cc('0x51')]=function canUpdate(){return compose()[_0x92cc('0x29')](function(_0x2088fe,_0x2bedd8,_0x150606){return licenseUtil[_0x92cc('0x52')]()[_0x92cc('0x3b')](function(_0x44968a){if(_0x44968a['update']){_0x150606();}else{return _0x2bedd8['status'](0x193)[_0x92cc('0x32')]({'message':'Forbidden'});}})[_0x92cc('0x4e')](function(_0x2a100a){_0x150606(_0x2a100a);});});};exports['isMiddleware']=function(_0x492e6d,_0x18409e,_0x255995){_0x492e6d['isMiddleware']=!![];return _0x255995();};exports[_0x92cc('0x53')]=function signToken(_0x47df3b){return signJwt(_0x47df3b);};exports['setTokenCookie']=function(_0x5359fd,_0x33220d){if(!_0x5359fd['user']){return _0x33220d[_0x92cc('0x30')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x17dd6f={'payload':{'id':_0x5359fd[_0x92cc('0x2a')]['id'],'role':_0x5359fd[_0x92cc('0x2a')][_0x92cc('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x17dd6f)[_0x92cc('0x3b')](function(_0x3e9524){_0x33220d[_0x92cc('0x54')](_0x92cc('0x55'),_0x3e9524);_0x33220d['redirect'](_0x92cc('0x56'));})[_0x92cc('0x4e')](function(_0x294c3c){return _0x33220d[_0x92cc('0x30')](0x1f4)[_0x92cc('0x57')](_0x294c3c);});};exports['retrieveApiKey']=function(_0xc23bbd){if(_[_0x92cc('0x58')](_0xc23bbd[_0x92cc('0x46')])||_[_0x92cc('0x58')](_0xc23bbd[_0x92cc('0x59')])){return null;}else{return createJwt(_0xc23bbd);}};exports[_0x92cc('0x5a')]=function(_0x3ff4e0){_0x3ff4e0[_0x92cc('0x46')]=generateNonce();_0x3ff4e0[_0x92cc('0x59')]=generateIssuedAt();return createJwt(_0x3ff4e0);};exports[_0x92cc('0x5b')]=function(_0x28ca62,_0x4ed590){var _0x19b4e8=_0x28ca62[_0x92cc('0x41')][_0x92cc('0x42')];if(_0x19b4e8){var _0x4335f2={'nonce':_0x4ed590['apiKeyNonce'],'iat':_0x4ed590[_0x92cc('0x59')],'audience':hardwareConf[_0x92cc('0x43')](),'issuer':hardwareConf[_0x92cc('0x43')]()};return verifyJwt(_0x19b4e8,_0x4335f2)['then'](function(){return generateApiKey(_0x4ed590);});}else{throw{'message':_0x92cc('0x5c')};}};exports[_0x92cc('0x5d')]=function(_0x1496b9){var _0xe05dd9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xe05dd9[_0x92cc('0x5e')](_0x1496b9))throw new db[(_0x92cc('0x5f'))][(_0x92cc('0x60'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x379bd7,_0x3f383e,_0x17c2f4){var _0x3c2a79=encryptor[_0x92cc('0x61')](_0x3f383e)['split'](',');for(var _0x1b5275=0x0;_0x1b5275<_0x17c2f4;_0x1b5275++){if(!_0x3c2a79[_0x1b5275])break;if(_0x379bd7[_0x92cc('0x62')]()===_0x3c2a79[_0x1b5275]['toLowerCase']()){var _0x133234=util[_0x92cc('0x63')](_0x92cc('0x64'),_0x17c2f4);if(_0x17c2f4===0x1){_0x133234=_0x92cc('0x65');}throw new db[(_0x92cc('0x5f'))]['ValidationError'](_0x133234);}}return;};exports[_0x92cc('0x66')]=function(_0x117078,_0xec1be8){var _0x356f9b=_0xec1be8?encryptor[_0x92cc('0x61')](_0xec1be8)[_0x92cc('0x67')](','):[];if(_0x356f9b[_0x92cc('0x68')]===0x5){_0x356f9b[_0x92cc('0x69')](-0x1,0x1);}_0x356f9b[_0x92cc('0x6a')](_0x117078);return encryptor['encryptString'](_0x356f9b[_0x92cc('0x6b')](','));};function signJwt(_0x5677e1){var _0x2d0cab=BPromise[_0x92cc('0x6c')](jwt[_0x92cc('0x6d')],{'context':jwt});var _0x47e4fb=_0x5677e1[_0x92cc('0x6e')]||config['secrets'][_0x92cc('0xc')];return new BPromise(function(_0x4ec0e9,_0x159dc6){_0x2d0cab(_0x5677e1[_0x92cc('0x6f')],_0x47e4fb,_0x5677e1['options'])['then'](function(_0x5d4ecc){_0x4ec0e9(_0x5d4ecc);})[_0x92cc('0x4e')](function(_0x580ad2){_0x159dc6(_0x580ad2);});});}function verifyJwt(_0x2b3455,_0x134523,_0x3e0f4a){var _0x333af6=BPromise[_0x92cc('0x6c')](jwt[_0x92cc('0x70')],{'context':jwt});var _0x3d2088=_0x3e0f4a||config[_0x92cc('0xb')][_0x92cc('0xc')];return new BPromise(function(_0x21851a,_0xbe6842){_0x333af6(_0x2b3455,_0x3d2088,_0x134523)['then'](function(_0x25b189){_0x21851a(_0x25b189);})['catch'](function(_0x699ae2){_0xbe6842(_0x699ae2);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x92cc('0x71')](_0x92cc('0x72'));}function generateIssuedAt(){return Math[_0x92cc('0x73')](Date[_0x92cc('0x74')]()/0x3e8)[_0x92cc('0x71')]();}function createJwt(_0x1537ea){var _0x1dd95e={'payload':{'iat':_0x1537ea[_0x92cc('0x59')],'nonce':_0x1537ea[_0x92cc('0x46')]},'options':{'algorithm':_0x92cc('0x75'),'subject':_0x1537ea['id']['toString'](),'issuer':hardwareConf[_0x92cc('0x43')](),'audience':hardwareConf[_0x92cc('0x43')]()}};return signJwt(_0x1dd95e)['then'](function(_0x417cf2){return{'iat':_0x1537ea[_0x92cc('0x59')],'nonce':_0x1537ea['apiKeyNonce'],'token':_0x417cf2};});} \ No newline at end of file +var _0x166e=['Forbidden','isMiddleware','signToken','setTokenCookie','role','cookie','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','verify','secrets','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','session','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','interface','settingsEnabled','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Unmanaged.','isAuthenticated','authorization','startsWith','headers','find','authenticate','pass','json','Wrong\x20credentials.','catch','Bearer','query','apikey','getUuid','sub','findOne','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','minutes','Unknown\x20authorization\x20format','use','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense'];(function(_0x2015bb,_0x57f6e4){var _0xbff116=function(_0x1ba993){while(--_0x1ba993){_0x2015bb['push'](_0x2015bb['shift']());}};_0xbff116(++_0x57f6e4);}(_0x166e,0x1f4));var _0xe166=function(_0x22501c,_0x541ca6){_0x22501c=_0x22501c-0x0;var _0x37046c=_0x166e[_0x22501c];return _0x37046c;};'use strict';var db=require(_0xe166('0x0'))['db'];var config=require(_0xe166('0x1'));var hardwareConf=require(_0xe166('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xe166('0x3'));var _=require(_0xe166('0x4'));var jwt=require(_0xe166('0x5'));var expressJwt=require(_0xe166('0x6'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0xe166('0x7'));var BPromise=require('bluebird');var util=require(_0xe166('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0xe166('0x9')]});var userAttributes=['id','role',_0xe166('0xa'),_0xe166('0xb'),_0xe166('0xc'),_0xe166('0xd'),_0xe166('0xe'),_0xe166('0xf'),_0xe166('0x10'),'voicePause',_0xe166('0x11'),_0xe166('0x12'),_0xe166('0x13'),_0xe166('0x14'),_0xe166('0x15'),_0xe166('0x16'),_0xe166('0x17'),'lastLoginAt','lastPauseAt',_0xe166('0x18'),_0xe166('0x19'),'passwordResetAt',_0xe166('0x1a'),'phoneBarAutoAnswer',_0xe166('0x1b'),_0xe166('0x1c'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xe166('0x1d'),_0xe166('0x1e'),'phoneBarPrefixRequired',_0xe166('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0xe166('0x20'),'userProfileId',_0xe166('0x21')];exports[_0xe166('0x22')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x16da55,_0x4238a8,_0x152607){if(_0x16da55[_0xe166('0x23')]){_0x152607();}else{return db[_0xe166('0x24')]['findOne']({'where':{'id':_0x16da55[_0xe166('0x25')]['id']},'attributes':['id',_0xe166('0x26'),_0xe166('0x27')],'raw':!![]})[_0xe166('0x28')](function(_0x34f5fd){if(_0x34f5fd&&_0x34f5fd['closed']){return _0x4238a8[_0xe166('0x29')](_0x34f5fd['disposition']===_0xe166('0x2a')?0x195:0x193)['json']({'message':_0x34f5fd[_0xe166('0x27')]===_0xe166('0x2a')?_0xe166('0x2b'):'Forbidden.'});}else{_0x152607();}})['catch'](function(_0x5b6548){_0x152607(_0x5b6548);});}});};exports[_0xe166('0x2c')]=function isAuthenticated(_0x8ee5e9){return compose()['use'](function(_0x2296cf,_0x31ddf2,_0xb9fdc3){var _0x6ab7a8;if(_0x2296cf['headers'][_0xe166('0x2d')]){if(_[_0xe166('0x2e')](_0x2296cf[_0xe166('0x2f')]['authorization'],'Basic')){var _0xc57443=basicAuth(_0x2296cf);db['User'][_0xe166('0x30')]({'where':{'name':_0xc57443[_0xe166('0xb')]}})[_0xe166('0x28')](function(_0x56b7bf){if(!_0x56b7bf||!_0x56b7bf[_0xe166('0x31')](_0xc57443[_0xe166('0x32')])){return _0x31ddf2[_0xe166('0x29')](0x191)[_0xe166('0x33')]({'message':_0xe166('0x34')});}_0x2296cf[_0xe166('0x23')]={'id':_0x56b7bf['id']};_0xb9fdc3();})[_0xe166('0x35')](function(_0x1899e6){_0xb9fdc3(_0x1899e6);});}else if(_[_0xe166('0x2e')](_0x2296cf[_0xe166('0x2f')][_0xe166('0x2d')],_0xe166('0x36'))){validateJwt(_0x2296cf,_0x31ddf2,_0xb9fdc3);}else{if(_0x8ee5e9){_0xb9fdc3();}else{return _0x31ddf2[_0xe166('0x29')](0x193)[_0xe166('0x33')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2296cf[_0xe166('0x37')][_0xe166('0x38')]){try{var _0x2f133e={'audience':hardwareConf[_0xe166('0x39')](),'issuer':hardwareConf[_0xe166('0x39')]()};verifyJwt(_0x2296cf['query'][_0xe166('0x38')],_0x2f133e)[_0xe166('0x28')](function(_0x2c2a11){return db['User']['find']({'where':{'id':_0x2c2a11[_0xe166('0x3a')]}})[_0xe166('0x28')](function(_0x44cd69){_0x6ab7a8=_0x44cd69;return db['Setting'][_0xe166('0x3b')]({'where':{'id':0x1},'attributes':[_0xe166('0x3c'),'blockDuration'],'raw':!![]});})[_0xe166('0x28')](function(_0x2ec639){if(!_0x6ab7a8||!_[_0xe166('0x3d')](_0x6ab7a8[_0xe166('0x3e')],_0x2c2a11[_0xe166('0x3f')])){return _0x31ddf2['status'](0x191)[_0xe166('0x33')]({'message':_0xe166('0x40')});}if(_0x6ab7a8['disabled']){return _0x31ddf2['status'](0x191)[_0xe166('0x33')]({'message':_0xe166('0x41')});}if(_0x6ab7a8['blocked']){if(_0x2ec639[_0xe166('0x42')]>0x0){if(moment(_0x6ab7a8['blockedAt'])['add'](_0x2ec639[_0xe166('0x42')],_0xe166('0x43'))>moment()){return _0x31ddf2['status'](0x191)['json']({'message':_0xe166('0x41')});}}else{return _0x31ddf2[_0xe166('0x29')](0x191)[_0xe166('0x33')]({'message':_0xe166('0x41')});}}_0x2296cf[_0xe166('0x23')]={'id':_0x6ab7a8['id']};_0xb9fdc3();});})[_0xe166('0x35')](function(){return _0x31ddf2[_0xe166('0x29')](0x191)['json']({'message':_0xe166('0x41')});});}catch(_0x5a6bd7){_0xb9fdc3(_0x5a6bd7);}}else if(_0x8ee5e9){_0xb9fdc3();}else{return _0x31ddf2[_0xe166('0x29')](0x193)[_0xe166('0x33')]({'message':_0xe166('0x44')});}})[_0xe166('0x45')](function(_0x29e78e,_0x433d48,_0x398c17){if(_0x29e78e['user']){db[_0xe166('0x46')][_0xe166('0x30')]({'where':{'id':_0x29e78e[_0xe166('0x23')]['id']},'attributes':userAttributes})[_0xe166('0x28')](function(_0x2140b9){if(!_0x2140b9){return _0x433d48[_0xe166('0x29')](0x194)['json']({'message':_0xe166('0x47')});}_0x29e78e[_0xe166('0x23')]=_0x2140b9;_0x398c17();})['catch'](function(_0x556f2c){_0x398c17(_0x556f2c);});}else if(_0x8ee5e9){_0x398c17();}else{return _0x433d48[_0xe166('0x29')](0x194)[_0xe166('0x33')]({'message':_0xe166('0x48')});}});};exports[_0xe166('0x49')]=function canUpdate(){return compose()['use'](function(_0x60d9a5,_0x3ebb98,_0x4b8d64){return licenseUtil[_0xe166('0x4a')]()['then'](function(_0x28160a){if(_0x28160a['update']){_0x4b8d64();}else{return _0x3ebb98[_0xe166('0x29')](0x193)[_0xe166('0x33')]({'message':_0xe166('0x4b')});}})[_0xe166('0x35')](function(_0x1a0bf7){_0x4b8d64(_0x1a0bf7);});});};exports[_0xe166('0x4c')]=function(_0x5c0857,_0x27a1d2,_0x4287d1){_0x5c0857[_0xe166('0x4c')]=!![];return _0x4287d1();};exports[_0xe166('0x4d')]=function signToken(_0x2d3416){return signJwt(_0x2d3416);};exports[_0xe166('0x4e')]=function(_0x220493,_0x3273e5){if(!_0x220493[_0xe166('0x23')]){return _0x3273e5[_0xe166('0x29')](0x194)[_0xe166('0x33')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x51e413={'payload':{'id':_0x220493['user']['id'],'role':_0x220493[_0xe166('0x23')][_0xe166('0x4f')]},'options':{'expiresIn':0x15180}};return signJwt(_0x51e413)['then'](function(_0x5a361f){_0x3273e5[_0xe166('0x50')]('motion.token',_0x5a361f);_0x3273e5[_0xe166('0x51')]('/dashboards/general');})[_0xe166('0x35')](function(_0x2d0282){return _0x3273e5[_0xe166('0x29')](0x1f4)[_0xe166('0x52')](_0x2d0282);});};exports[_0xe166('0x53')]=function(_0x54f51e){if(_['isNil'](_0x54f51e[_0xe166('0x3e')])||_[_0xe166('0x54')](_0x54f51e['apiKeyIat'])){return null;}else{return createJwt(_0x54f51e);}};exports[_0xe166('0x55')]=function(_0x3e7e02){_0x3e7e02[_0xe166('0x3e')]=generateNonce();_0x3e7e02[_0xe166('0x56')]=generateIssuedAt();return createJwt(_0x3e7e02);};exports[_0xe166('0x57')]=function(_0x4f1217,_0x40a124){var _0x46a32d=_0x4f1217[_0xe166('0x37')][_0xe166('0x38')];if(_0x46a32d){var _0x55170e={'nonce':_0x40a124['apiKeyNonce'],'iat':_0x40a124['apiKeyIat'],'audience':hardwareConf[_0xe166('0x39')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x46a32d,_0x55170e)['then'](function(){return generateApiKey(_0x40a124);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xe166('0x58')]=function(_0x11a9e0){var _0x3f02a4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3f02a4['test'](_0x11a9e0))throw new db[(_0xe166('0x59'))][(_0xe166('0x5a'))](_0xe166('0x5b'));return;};exports[_0xe166('0x5c')]=function(_0x4ece3a,_0x1a2d0f,_0x1826e3){var _0x1c3d34=encryptor['decryptString'](_0x1a2d0f)[_0xe166('0x5d')](',');for(var _0x368ecf=0x0;_0x368ecf<_0x1826e3;_0x368ecf++){if(!_0x1c3d34[_0x368ecf])break;if(_0x4ece3a[_0xe166('0x5e')]()===_0x1c3d34[_0x368ecf][_0xe166('0x5e')]()){var _0x3a1902=util[_0xe166('0x5f')](_0xe166('0x60'),_0x1826e3);if(_0x1826e3===0x1){_0x3a1902='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xe166('0x59'))][(_0xe166('0x5a'))](_0x3a1902);}}return;};exports[_0xe166('0x61')]=function(_0x42ccf4,_0x1b48f1){var _0x49e956=_0x1b48f1?encryptor[_0xe166('0x62')](_0x1b48f1)[_0xe166('0x5d')](','):[];if(_0x49e956[_0xe166('0x63')]===0x5){_0x49e956['splice'](-0x1,0x1);}_0x49e956[_0xe166('0x64')](_0x42ccf4);return encryptor[_0xe166('0x65')](_0x49e956[_0xe166('0x66')](','));};function signJwt(_0x3b932a){var _0x3b3b69=BPromise[_0xe166('0x67')](jwt[_0xe166('0x68')],{'context':jwt});var _0x5c0e41=_0x3b932a[_0xe166('0x69')]||config['secrets'][_0xe166('0x9')];return new BPromise(function(_0x38188f,_0x4fa5f2){_0x3b3b69(_0x3b932a[_0xe166('0x6a')],_0x5c0e41,_0x3b932a['options'])[_0xe166('0x28')](function(_0x18dad9){_0x38188f(_0x18dad9);})[_0xe166('0x35')](function(_0x4af9b1){_0x4fa5f2(_0x4af9b1);});});}function verifyJwt(_0x2fe476,_0x37c0e5,_0x20e351){var _0x35af36=BPromise[_0xe166('0x67')](jwt[_0xe166('0x6b')],{'context':jwt});var _0xc0cd4a=_0x20e351||config[_0xe166('0x6c')][_0xe166('0x9')];return new BPromise(function(_0x3915e0,_0xea6edc){_0x35af36(_0x2fe476,_0xc0cd4a,_0x37c0e5)[_0xe166('0x28')](function(_0x253947){_0x3915e0(_0x253947);})['catch'](function(_0xc8502b){_0xea6edc(_0xc8502b);});});}function generateNonce(){return crypto[_0xe166('0x6d')](0x10)[_0xe166('0x6e')](_0xe166('0x6f'));}function generateIssuedAt(){return Math[_0xe166('0x70')](Date[_0xe166('0x71')]()/0x3e8)[_0xe166('0x6e')]();}function createJwt(_0x4f2d75){var _0x2c4734={'payload':{'iat':_0x4f2d75[_0xe166('0x56')],'nonce':_0x4f2d75[_0xe166('0x3e')]},'options':{'algorithm':_0xe166('0x72'),'subject':_0x4f2d75['id'][_0xe166('0x6e')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xe166('0x39')]()}};return signJwt(_0x2c4734)['then'](function(_0x562427){return{'iat':_0x4f2d75[_0xe166('0x56')],'nonce':_0x4f2d75['apiKeyNonce'],'token':_0x562427};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 1e07b01..edb1aef 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 _0x3c6c=['secrets','session','aes-256-ctr','aes192','encryptFile','createReadStream','createWriteStream','algorithm','data','binary','write','end','final','close','unlink','decryptFile','createDecipher','update','secret','createCipher','base64','decryptString','utf8','crypto','../../config/environment'];(function(_0x4c9142,_0x54d7bb){var _0x14f35a=function(_0x344e25){while(--_0x344e25){_0x4c9142['push'](_0x4c9142['shift']());}};_0x14f35a(++_0x54d7bb);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x40a5c9,_0x49a914){_0x40a5c9=_0x40a5c9-0x0;var _0x231d05=_0x3c6c[_0x40a5c9];return _0x231d05;};'use strict';var crypto=require(_0xc3c6('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0xc3c6('0x1'));const stringOptions={'secret':config[_0xc3c6('0x2')][_0xc3c6('0x3')],'algorithm':_0xc3c6('0x4')};const fileOptions={'algorithm':_0xc3c6('0x5')};function combineOptions(_0x37f15a){var _0x65a78={};for(var _0x34db2e in fileOptions){if(fileOptions['hasOwnProperty'](_0x34db2e)){_0x65a78[_0x34db2e]=fileOptions[_0x34db2e];}}if(_0x37f15a){for(var _0x3c630b in _0x37f15a){if(_0x37f15a['hasOwnProperty'](_0x3c630b)){_0x65a78[_0x3c630b]=_0x37f15a[_0x3c630b];}}}return _0x65a78;}exports[_0xc3c6('0x6')]=function(_0x4d7ae6,_0x50cd05,_0x4aed87,_0x5185c3){return new BPromise(function(_0x4f39dd,_0x12fabf){_0x5185c3=combineOptions(_0x5185c3);var _0x1c04d4=new Buffer(_0x4aed87);var _0x5bc1c1=fs[_0xc3c6('0x7')](_0x4d7ae6);var _0x1ba453=fs[_0xc3c6('0x8')](_0x50cd05);var _0x377311=crypto['createCipher'](_0x5185c3[_0xc3c6('0x9')],_0x1c04d4);_0x5bc1c1['on'](_0xc3c6('0xa'),function(_0x1b78ca){var _0x516612=new Buffer(_0x377311['update'](_0x1b78ca),_0xc3c6('0xb'));_0x1ba453[_0xc3c6('0xc')](_0x516612);});_0x5bc1c1['on'](_0xc3c6('0xd'),function(){try{var _0x648a0=new Buffer(_0x377311[_0xc3c6('0xe')](_0xc3c6('0xb')),_0xc3c6('0xb'));_0x1ba453[_0xc3c6('0xc')](_0x648a0);_0x1ba453[_0xc3c6('0xd')]();_0x1ba453['on'](_0xc3c6('0xf'),function(){return _0x4f39dd(_0x50cd05);});}catch(_0x5e42b8){fs[_0xc3c6('0x10')](_0x50cd05);return _0x12fabf(_0x5e42b8);}});});};exports[_0xc3c6('0x11')]=function(_0x25d2bd,_0x283506,_0x42c631,_0x32c52f){return new BPromise(function(_0x181b3b,_0x33920c){_0x32c52f=combineOptions(_0x32c52f);var _0x2d4b3d=new Buffer(_0x42c631);var _0x64c62a=fs[_0xc3c6('0x7')](_0x25d2bd);var _0x26c9b0=fs[_0xc3c6('0x8')](_0x283506);var _0x3003e1=crypto[_0xc3c6('0x12')](_0x32c52f['algorithm'],_0x2d4b3d);_0x64c62a['on'](_0xc3c6('0xa'),function(_0x5a2456){var _0x2150e0=new Buffer(_0x3003e1[_0xc3c6('0x13')](_0x5a2456),_0xc3c6('0xb'));_0x26c9b0[_0xc3c6('0xc')](_0x2150e0);});_0x64c62a['on'](_0xc3c6('0xd'),function(){try{var _0x3490a2=new Buffer(_0x3003e1[_0xc3c6('0xe')](_0xc3c6('0xb')),_0xc3c6('0xb'));_0x26c9b0[_0xc3c6('0xc')](_0x3490a2);_0x26c9b0[_0xc3c6('0xd')]();_0x26c9b0['on'](_0xc3c6('0xf'),function(){return _0x181b3b(_0x283506);});}catch(_0x3d03b0){fs[_0xc3c6('0x10')](_0x283506);return _0x33920c(_0x3d03b0);}});});};exports['encryptString']=function(_0x24fb2d,_0x40893b,_0x2bced6){var _0x565a86=_0x2bced6||stringOptions[_0xc3c6('0x9')];var _0x42438d=_0x40893b||stringOptions[_0xc3c6('0x14')];var _0xfc19be=crypto[_0xc3c6('0x15')](_0x565a86,_0x42438d);var _0x47808f=_0xfc19be[_0xc3c6('0x13')](_0x24fb2d,'utf8',_0xc3c6('0x16'));_0x47808f+=_0xfc19be[_0xc3c6('0xe')]('base64');return _0x47808f;};exports[_0xc3c6('0x17')]=function(_0x3358db,_0x1457f7,_0xdad009){var _0x312539=_0xdad009||stringOptions[_0xc3c6('0x9')];var _0x2b1ae0=_0x1457f7||stringOptions[_0xc3c6('0x14')];var _0x1f1d36=crypto['createDecipher'](_0x312539,_0x2b1ae0);var _0xb047b1=_0x1f1d36[_0xc3c6('0x13')](_0x3358db,_0xc3c6('0x16'),_0xc3c6('0x18'));_0xb047b1+=_0x1f1d36['final'](_0xc3c6('0x18'));return _0xb047b1;}; \ No newline at end of file +var _0x4975=['final','close','unlink','update','encryptString','secret','utf8','base64','decryptString','crypto','../../config/environment','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4975,0x86));var _0x5497=function(_0x1937a9,_0x15c2d1){_0x1937a9=_0x1937a9-0x0;var _0x7fdd39=_0x4975[_0x1937a9];return _0x7fdd39;};'use strict';var crypto=require(_0x5497('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x5497('0x1'));const stringOptions={'secret':config[_0x5497('0x2')][_0x5497('0x3')],'algorithm':_0x5497('0x4')};const fileOptions={'algorithm':_0x5497('0x5')};function combineOptions(_0x235986){var _0x14cecb={};for(var _0xeb31af in fileOptions){if(fileOptions[_0x5497('0x6')](_0xeb31af)){_0x14cecb[_0xeb31af]=fileOptions[_0xeb31af];}}if(_0x235986){for(var _0x5d5272 in _0x235986){if(_0x235986['hasOwnProperty'](_0x5d5272)){_0x14cecb[_0x5d5272]=_0x235986[_0x5d5272];}}}return _0x14cecb;}exports[_0x5497('0x7')]=function(_0x4f563d,_0x1d0019,_0x674a2a,_0x368e8b){return new BPromise(function(_0x57f930,_0x42af11){_0x368e8b=combineOptions(_0x368e8b);var _0x49d94b=new Buffer(_0x674a2a);var _0x1f63d8=fs[_0x5497('0x8')](_0x4f563d);var _0x2ec5a4=fs[_0x5497('0x9')](_0x1d0019);var _0x131627=crypto[_0x5497('0xa')](_0x368e8b[_0x5497('0xb')],_0x49d94b);_0x1f63d8['on'](_0x5497('0xc'),function(_0x50d716){var _0x5874ef=new Buffer(_0x131627['update'](_0x50d716),_0x5497('0xd'));_0x2ec5a4[_0x5497('0xe')](_0x5874ef);});_0x1f63d8['on'](_0x5497('0xf'),function(){try{var _0x984990=new Buffer(_0x131627[_0x5497('0x10')](_0x5497('0xd')),_0x5497('0xd'));_0x2ec5a4[_0x5497('0xe')](_0x984990);_0x2ec5a4[_0x5497('0xf')]();_0x2ec5a4['on'](_0x5497('0x11'),function(){return _0x57f930(_0x1d0019);});}catch(_0x55f590){fs[_0x5497('0x12')](_0x1d0019);return _0x42af11(_0x55f590);}});});};exports['decryptFile']=function(_0x4237a9,_0x2bfd8a,_0x19e5f3,_0x3ce50b){return new BPromise(function(_0x37c18e,_0x4073e6){_0x3ce50b=combineOptions(_0x3ce50b);var _0x2f2997=new Buffer(_0x19e5f3);var _0x575f6b=fs['createReadStream'](_0x4237a9);var _0x3f4d20=fs[_0x5497('0x9')](_0x2bfd8a);var _0x3a47fd=crypto['createDecipher'](_0x3ce50b[_0x5497('0xb')],_0x2f2997);_0x575f6b['on'](_0x5497('0xc'),function(_0x18e8a8){var _0x43da2c=new Buffer(_0x3a47fd[_0x5497('0x13')](_0x18e8a8),_0x5497('0xd'));_0x3f4d20[_0x5497('0xe')](_0x43da2c);});_0x575f6b['on'](_0x5497('0xf'),function(){try{var _0x2e3960=new Buffer(_0x3a47fd[_0x5497('0x10')](_0x5497('0xd')),'binary');_0x3f4d20[_0x5497('0xe')](_0x2e3960);_0x3f4d20['end']();_0x3f4d20['on'](_0x5497('0x11'),function(){return _0x37c18e(_0x2bfd8a);});}catch(_0xd0868d){fs[_0x5497('0x12')](_0x2bfd8a);return _0x4073e6(_0xd0868d);}});});};exports[_0x5497('0x14')]=function(_0x35ecd9,_0x3b2fbc,_0x5018fa){var _0x54043a=_0x5018fa||stringOptions[_0x5497('0xb')];var _0x34b97f=_0x3b2fbc||stringOptions[_0x5497('0x15')];var _0x281155=crypto['createCipher'](_0x54043a,_0x34b97f);var _0x13b7a4=_0x281155['update'](_0x35ecd9,_0x5497('0x16'),_0x5497('0x17'));_0x13b7a4+=_0x281155[_0x5497('0x10')](_0x5497('0x17'));return _0x13b7a4;};exports[_0x5497('0x18')]=function(_0x31cd01,_0x48b835,_0x4af5f4){var _0x5406e2=_0x4af5f4||stringOptions['algorithm'];var _0x498f15=_0x48b835||stringOptions[_0x5497('0x15')];var _0x48d146=crypto['createDecipher'](_0x5406e2,_0x498f15);var _0xc3465=_0x48d146[_0x5497('0x13')](_0x31cd01,_0x5497('0x17'),'utf8');_0xc3465+=_0x48d146['final']('utf8');return _0xc3465;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 8f64ef7..661036f 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 _0xda55=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','split','push'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xda55,0x6d));var _0x5da5=function(_0x73865a,_0x451e72){_0x73865a=_0x73865a-0x0;var _0x47767f=_0xda55[_0x73865a];return _0x47767f;};'use strict';var util=require(_0x5da5('0x0'));var path=require(_0x5da5('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x5da5('0x2'));var zipdir=require(_0x5da5('0x3'));var rimraf=require(_0x5da5('0x4'));var db=require(_0x5da5('0x5'))['db'];var dbH=require(_0x5da5('0x5'))['dbH'];var logger=require(_0x5da5('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5da5('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x5da5('0x7')][0x4];function analyticExtractedReport(_0x267469,_0x71b187){var _0x46290d={'status':_0x267469};var _0x3debdf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x71b187){_0x46290d[_0x5da5('0x8')]=_0x71b187;}return db[_0x5da5('0x9')][_0x5da5('0xa')](_0x46290d,_0x3debdf);}function main(){var _0x5c056f=0x1388;var _0x3ed24c;logger[_0x5da5('0xb')](util[_0x5da5('0xc')](_0x5da5('0xd'),EXTRACTED_REPORT_ID,_0x5da5('0xe')));return db[_0x5da5('0xf')][_0x5da5('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5da5('0x11')]})[_0x5da5('0x12')](function(_0x4f813b){if(_0x4f813b){_0x3ed24c=_0x4f813b;_0x5c056f=_0x3ed24c[_0x5da5('0x11')]||0x1388;}})[_0x5da5('0x12')](function(){return dbH[_0x5da5('0x13')][_0x5da5('0x14')](util[_0x5da5('0xc')](_0x5da5('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x5da5('0x12')](function(_0x126fc8){if(!_0x126fc8[0x0][_0x5da5('0x16')]){return analyticExtractedReport(_0x5da5('0x17'));}var _0x11bd3=[];var _0x134afa=0x0;var _0x3aff51=!![];if(_0x126fc8&&_0x126fc8['length']){var _0x124dc5=_0x126fc8[0x0][_0x5da5('0x16')]%(_0x134afa+_0x5c056f);if(_0x3ed24c[_0x5da5('0x18')]){for(;_0x3aff51;_0x134afa+=_0x5c056f,_0x124dc5=_0x126fc8[0x0][_0x5da5('0x16')]%(_0x134afa+_0x5c056f)){if(_0x124dc5==0x0||_0x124dc5==_0x126fc8[0x0][_0x5da5('0x16')]){_0x3aff51=![];}_0x11bd3[_0x5da5('0x19')](dbH['sequelize'][_0x5da5('0x14')](util[_0x5da5('0xc')](_0x5da5('0x1a'),QUERY,_0x5c056f,_0x134afa),{'type':dbH[_0x5da5('0x13')][_0x5da5('0x1b')]['SELECT']}));}}else{_0x11bd3[_0x5da5('0x19')](dbH[_0x5da5('0x13')][_0x5da5('0x14')](QUERY,{'type':dbH['sequelize'][_0x5da5('0x1b')][_0x5da5('0x1c')]}));}}var _0x20c8a6=path[_0x5da5('0x1d')](PATH);var _0xec69f2=path[_0x5da5('0x1e')](PATH,'.csv');var _0x1a6bd7=_0x3ed24c['split']&&_0x11bd3[_0x5da5('0x1f')]>0x1;var _0x716ab7=[];if(!fs[_0x5da5('0x20')](path['join'](_0x20c8a6,_0xec69f2))&&_0x1a6bd7){fs[_0x5da5('0x21')](path[_0x5da5('0x22')](_0x20c8a6,_0xec69f2));}return BPromise[_0x5da5('0x23')](_0x11bd3,function(_0x21e795){_0x716ab7['push'](_0x21e795);})['then'](function(){for(var _0x50aadc=0x0;_0x50aadc<_0x716ab7[_0x5da5('0x1f')];_0x50aadc+=0x1){var _0x56d509;var _0x4e8890=_0x716ab7[_0x50aadc];if(_0x1a6bd7){_0x56d509=path[_0x5da5('0x22')](_0x20c8a6,_0xec69f2,util[_0x5da5('0xc')]('%s%d.%s',_0xec69f2,_0x50aadc,_0x5da5('0x24')));}else{_0x56d509=path[_0x5da5('0x22')](_0x20c8a6,util['format'](_0x5da5('0x25'),_0xec69f2,_0x5da5('0x24')));}fs[_0x5da5('0x26')](_0x56d509,csv(_0x4e8890));}})[_0x5da5('0x12')](function(){if(_0x1a6bd7){zipdir(path[_0x5da5('0x22')](_0x20c8a6,_0xec69f2),{'saveTo':path['join'](_0x20c8a6,util[_0x5da5('0xc')](_0x5da5('0x25'),_0xec69f2,_0x5da5('0x27')))},function(_0x15a0c0,_0x55e2bf){});rimraf(path['join'](_0x20c8a6,_0xec69f2),function(){});}})['then'](function(){logger[_0x5da5('0xb')](util[_0x5da5('0xc')](_0x5da5('0x28'),EXTRACTED_REPORT_ID,_0x5da5('0xe')));return analyticExtractedReport('Completed',_0x1a6bd7?util['format'](_0x5da5('0x25'),_0xec69f2,_0x1a6bd7?'zip':'csv'):null);});})[_0x5da5('0x29')](function(_0x4c6cce){logger[_0x5da5('0xb')](util[_0x5da5('0xc')](_0x5da5('0x2a'),EXTRACTED_REPORT_ID,_0x5da5('0xe')),util[_0x5da5('0x2b')](_0x4c6cce,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x5da5('0x2c'));});}main(); \ No newline at end of file +var _0xe5b3=['lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path'];(function(_0x3193d2,_0x563846){var _0x2b086c=function(_0x2b7c99){while(--_0x2b7c99){_0x3193d2['push'](_0x3193d2['shift']());}};_0x2b086c(++_0x563846);}(_0xe5b3,0x133));var _0x3e5b=function(_0x73865a,_0x451e72){_0x73865a=_0x73865a-0x0;var _0x47767f=_0xe5b3[_0x73865a];return _0x47767f;};'use strict';var util=require('util');var path=require(_0x3e5b('0x0'));var _=require(_0x3e5b('0x1'));var csv=require(_0x3e5b('0x2'));var fs=require('fs');var BPromise=require(_0x3e5b('0x3'));var zipdir=require(_0x3e5b('0x4'));var rimraf=require(_0x3e5b('0x5'));var db=require(_0x3e5b('0x6'))['db'];var dbH=require(_0x3e5b('0x6'))[_0x3e5b('0x7')];var logger=require(_0x3e5b('0x8'))(_0x3e5b('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3e5b('0xa')][0x3];var PATH=process[_0x3e5b('0xa')][0x4];function analyticExtractedReport(_0x534e7d,_0x41d46f){var _0x3901c2={'status':_0x534e7d};var _0x3c7c2e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x41d46f){_0x3901c2[_0x3e5b('0xb')]=_0x41d46f;}return db['AnalyticExtractedReport']['update'](_0x3901c2,_0x3c7c2e);}function main(){var _0x1fef54=0x1388;var _0x3d3b6e;logger[_0x3e5b('0xc')](util[_0x3e5b('0xd')](_0x3e5b('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x3e5b('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e5b('0x10'),_0x3e5b('0x11')]})[_0x3e5b('0x12')](function(_0x374068){if(_0x374068){_0x3d3b6e=_0x374068;_0x1fef54=_0x3d3b6e[_0x3e5b('0x11')]||0x1388;}})[_0x3e5b('0x12')](function(){return dbH[_0x3e5b('0x13')]['query'](util[_0x3e5b('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x3e5b('0x14')]});})[_0x3e5b('0x12')](function(_0x17aaa3){if(!_0x17aaa3[0x0]['num']){return analyticExtractedReport(_0x3e5b('0x15'));}var _0x59ddc0=[];var _0x56a453=0x0;var _0x258d6a=!![];if(_0x17aaa3&&_0x17aaa3[_0x3e5b('0x16')]){var _0x5e2f83=_0x17aaa3[0x0][_0x3e5b('0x17')]%(_0x56a453+_0x1fef54);if(_0x3d3b6e[_0x3e5b('0x10')]){for(;_0x258d6a;_0x56a453+=_0x1fef54,_0x5e2f83=_0x17aaa3[0x0]['num']%(_0x56a453+_0x1fef54)){if(_0x5e2f83==0x0||_0x5e2f83==_0x17aaa3[0x0][_0x3e5b('0x17')]){_0x258d6a=![];}_0x59ddc0[_0x3e5b('0x18')](dbH['sequelize']['query'](util[_0x3e5b('0xd')](_0x3e5b('0x19'),QUERY,_0x1fef54,_0x56a453),{'type':dbH[_0x3e5b('0x13')][_0x3e5b('0x1a')][_0x3e5b('0x14')]}));}}else{_0x59ddc0[_0x3e5b('0x18')](dbH[_0x3e5b('0x13')][_0x3e5b('0x1b')](QUERY,{'type':dbH[_0x3e5b('0x13')][_0x3e5b('0x1a')][_0x3e5b('0x14')]}));}}var _0x11e5cf=path[_0x3e5b('0x1c')](PATH);var _0x402873=path['basename'](PATH,_0x3e5b('0x1d'));var _0x86f19c=_0x3d3b6e[_0x3e5b('0x10')]&&_0x59ddc0[_0x3e5b('0x16')]>0x1;var _0x50039b=[];if(!fs[_0x3e5b('0x1e')](path['join'](_0x11e5cf,_0x402873))&&_0x86f19c){fs[_0x3e5b('0x1f')](path[_0x3e5b('0x20')](_0x11e5cf,_0x402873));}return BPromise['each'](_0x59ddc0,function(_0x41b684){_0x50039b[_0x3e5b('0x18')](_0x41b684);})[_0x3e5b('0x12')](function(){for(var _0x3c8965=0x0;_0x3c8965<_0x50039b[_0x3e5b('0x16')];_0x3c8965+=0x1){var _0x26c7f2;var _0x160e87=_0x50039b[_0x3c8965];if(_0x86f19c){_0x26c7f2=path[_0x3e5b('0x20')](_0x11e5cf,_0x402873,util['format'](_0x3e5b('0x21'),_0x402873,_0x3c8965,'csv'));}else{_0x26c7f2=path[_0x3e5b('0x20')](_0x11e5cf,util['format'](_0x3e5b('0x22'),_0x402873,_0x3e5b('0x23')));}fs[_0x3e5b('0x24')](_0x26c7f2,csv(_0x160e87));}})[_0x3e5b('0x12')](function(){if(_0x86f19c){zipdir(path[_0x3e5b('0x20')](_0x11e5cf,_0x402873),{'saveTo':path[_0x3e5b('0x20')](_0x11e5cf,util[_0x3e5b('0xd')](_0x3e5b('0x22'),_0x402873,_0x3e5b('0x25')))},function(_0x112dc0,_0x1e1565){});rimraf(path['join'](_0x11e5cf,_0x402873),function(){});}})[_0x3e5b('0x12')](function(){logger[_0x3e5b('0xc')](util[_0x3e5b('0xd')](_0x3e5b('0x26'),EXTRACTED_REPORT_ID,_0x3e5b('0x27')));return analyticExtractedReport(_0x3e5b('0x28'),_0x86f19c?util[_0x3e5b('0xd')]('%s.%s',_0x402873,_0x86f19c?_0x3e5b('0x25'):'csv'):null);});})['catch'](function(_0x32c6b0){logger[_0x3e5b('0xc')](util['format'](_0x3e5b('0x29'),EXTRACTED_REPORT_ID,_0x3e5b('0x27')),util[_0x3e5b('0x2a')](_0x32c6b0,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3e5b('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5ff34b9..f6039b5 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x48153d,_0x2c95ca){var _0x78b11d=function(_0xc7dd70){while(--_0xc7dd70){_0x48153d['push'](_0x48153d['shift']());}};_0x78b11d(++_0x2c95ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x24d92a,_0x5dcc4d){_0x24d92a=_0x24d92a-0x0;var _0x2d5aed=_0xb10b[_0x24d92a];return _0x2d5aed;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x4297a8,_0x1389a6){var _0x41eda3=function(_0x577ca2){while(--_0x577ca2){_0x4297a8['push'](_0x4297a8['shift']());}};_0x41eda3(++_0x1389a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x40f5b7,_0xb3243e){_0x40f5b7=_0x40f5b7-0x0;var _0x3c884a=_0xb10b[_0x40f5b7];return _0x3c884a;};'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 8d089b5..acf374a 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 _0x35ec=['analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Failed','util','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x1568bd,_0x2559e0){var _0x1be0e1=function(_0x37c405){while(--_0x37c405){_0x1568bd['push'](_0x1568bd['shift']());}};_0x1be0e1(++_0x2559e0);}(_0x35ec,0xde));var _0xc35e=function(_0x504a09,_0x8e6e45){_0x504a09=_0x504a09-0x0;var _0x1ae7d8=_0x35ec[_0x504a09];return _0x1ae7d8;};'use strict';var util=require(_0xc35e('0x0'));var path=require('path');var _=require(_0xc35e('0x1'));var fs=require('fs');var json2xls=require(_0xc35e('0x2'));var BPromise=require(_0xc35e('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xc35e('0x4'));var db=require(_0xc35e('0x5'))['db'];var dbH=require(_0xc35e('0x5'))[_0xc35e('0x6')];var logger=require(_0xc35e('0x7'))(_0xc35e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xc35e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0xde4328,_0x438ba0){var _0xb0de51={'status':_0xde4328};var _0x3faca9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x438ba0){_0xb0de51[_0xc35e('0xa')]=_0x438ba0;}return db[_0xc35e('0xb')]['update'](_0xb0de51,_0x3faca9);}function main(){var _0x61f872=0x1388;var _0x50dd02;logger[_0xc35e('0xc')](util['format'](_0xc35e('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xc35e('0xe')][_0xc35e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc35e('0x10'),_0xc35e('0x11')]})[_0xc35e('0x12')](function(_0x8049eb){if(_0x8049eb){_0x50dd02=_0x8049eb;_0x61f872=_0x50dd02[_0xc35e('0x11')]||0x1388;}})[_0xc35e('0x12')](function(){return dbH[_0xc35e('0x13')]['query'](util[_0xc35e('0x14')](_0xc35e('0x15'),QUERY),{'type':dbH[_0xc35e('0x13')][_0xc35e('0x16')][_0xc35e('0x17')]});})[_0xc35e('0x12')](function(_0x131836){if(!_0x131836[0x0][_0xc35e('0x18')]){return analyticExtractedReport(_0xc35e('0x19'));}var _0x13a6ab=[];var _0x509710=0x0;var _0x377a1c=!![];if(_0x50dd02[_0xc35e('0x10')]){if(_0x131836&&_0x131836[_0xc35e('0x1a')]){var _0x5894a8=_0x131836[0x0][_0xc35e('0x18')]%(_0x509710+_0x61f872);for(;_0x377a1c;_0x509710+=_0x61f872,_0x5894a8=_0x131836[0x0][_0xc35e('0x18')]%(_0x509710+_0x61f872)){if(_0x5894a8==0x0||_0x5894a8==_0x131836[0x0][_0xc35e('0x18')]){_0x377a1c=![];}_0x13a6ab[_0xc35e('0x1b')](dbH['sequelize']['query'](util['format'](_0xc35e('0x1c'),QUERY,_0x61f872,_0x509710),{'type':dbH[_0xc35e('0x13')][_0xc35e('0x16')]['SELECT']}));}}}else{_0x13a6ab[_0xc35e('0x1b')](dbH[_0xc35e('0x13')][_0xc35e('0x1d')](QUERY,{'type':dbH[_0xc35e('0x13')][_0xc35e('0x16')][_0xc35e('0x17')]}));}var _0x5d67fc=path[_0xc35e('0x1e')](PATH);var _0x4fb00b=path[_0xc35e('0x1f')](PATH,_0xc35e('0x20'));var _0xa8641=_0x50dd02[_0xc35e('0x10')]&&_0x13a6ab[_0xc35e('0x1a')]>0x1;var _0x17b2ee=[];if(!fs['existsSync'](path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b))&&_0xa8641){fs[_0xc35e('0x22')](path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b));}return BPromise[_0xc35e('0x23')](_0x13a6ab,function(_0x24571c){_0x17b2ee[_0xc35e('0x1b')](_0x24571c);})[_0xc35e('0x12')](function(){for(var _0x6e11c3=0x0;_0x6e11c3<_0x17b2ee[_0xc35e('0x1a')];_0x6e11c3+=0x1){var _0x257b96;var _0x3b1551=_0x17b2ee[_0x6e11c3];if(_0xa8641){_0x257b96=path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b,util[_0xc35e('0x14')](_0xc35e('0x24'),_0x4fb00b,_0x6e11c3,_0xc35e('0x25')));}else{_0x257b96=path[_0xc35e('0x21')](_0x5d67fc,util[_0xc35e('0x14')]('%s.%s',_0x4fb00b,_0xc35e('0x25')));}fs[_0xc35e('0x26')](_0x257b96,json2xls(_0x3b1551),'binary');}})[_0xc35e('0x12')](function(){if(_0xa8641){zipdir(path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b),{'saveTo':path[_0xc35e('0x21')](_0x5d67fc,util[_0xc35e('0x14')](_0xc35e('0x27'),_0x4fb00b,_0xc35e('0x28')))},function(_0x3e4bc1,_0x21d6e5){});rimraf(path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b),function(){});}})[_0xc35e('0x12')](function(){logger['info'](util[_0xc35e('0x14')](_0xc35e('0x29'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0xa8641?util[_0xc35e('0x14')](_0xc35e('0x27'),_0x4fb00b,_0xa8641?_0xc35e('0x28'):_0xc35e('0x25')):null);});})[_0xc35e('0x2a')](function(_0x4da543){logger[_0xc35e('0xc')](util[_0xc35e('0x14')](_0xc35e('0x2b'),EXTRACTED_REPORT_ID,_0xc35e('0x2c')),util['inspect'](_0x4da543,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xc35e('0x2d'));});}main(); \ No newline at end of file +var _0xd641=['catch','inspect','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','split','length','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','each','%s.%s','xlsx','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX'];(function(_0x37f417,_0x15a08a){var _0x57d810=function(_0x562b55){while(--_0x562b55){_0x37f417['push'](_0x37f417['shift']());}};_0x57d810(++_0x15a08a);}(_0xd641,0xd9));var _0x1d64=function(_0x4ac0bc,_0x3a3224){_0x4ac0bc=_0x4ac0bc-0x0;var _0x34893e=_0xd641[_0x4ac0bc];return _0x34893e;};'use strict';var util=require(_0x1d64('0x0'));var path=require(_0x1d64('0x1'));var _=require(_0x1d64('0x2'));var fs=require('fs');var json2xls=require(_0x1d64('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x1d64('0x4'));var rimraf=require(_0x1d64('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1d64('0x6'))[_0x1d64('0x7')];var logger=require(_0x1d64('0x8'))(_0x1d64('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x1d64('0xa')][0x2]);var QUERY=process[_0x1d64('0xa')][0x3];var PATH=process[_0x1d64('0xa')][0x4];function analyticExtractedReport(_0x516b7b,_0x129bb3){var _0xc4cdb3={'status':_0x516b7b};var _0x8c82c5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129bb3){_0xc4cdb3['savename']=_0x129bb3;}return db[_0x1d64('0xb')][_0x1d64('0xc')](_0xc4cdb3,_0x8c82c5);}function main(){var _0x30ab55=0x1388;var _0x6dee96;logger[_0x1d64('0xd')](util[_0x1d64('0xe')](_0x1d64('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1d64('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1d64('0x11')]})['then'](function(_0x5073f2){if(_0x5073f2){_0x6dee96=_0x5073f2;_0x30ab55=_0x6dee96[_0x1d64('0x11')]||0x1388;}})[_0x1d64('0x12')](function(){return dbH[_0x1d64('0x13')]['query'](util['format'](_0x1d64('0x14'),QUERY),{'type':dbH[_0x1d64('0x13')][_0x1d64('0x15')][_0x1d64('0x16')]});})['then'](function(_0xfbf7e5){if(!_0xfbf7e5[0x0]['num']){return analyticExtractedReport(_0x1d64('0x17'));}var _0x1ebc03=[];var _0x28a0a2=0x0;var _0x1d33d6=!![];if(_0x6dee96[_0x1d64('0x18')]){if(_0xfbf7e5&&_0xfbf7e5[_0x1d64('0x19')]){var _0x403bf0=_0xfbf7e5[0x0]['num']%(_0x28a0a2+_0x30ab55);for(;_0x1d33d6;_0x28a0a2+=_0x30ab55,_0x403bf0=_0xfbf7e5[0x0][_0x1d64('0x1a')]%(_0x28a0a2+_0x30ab55)){if(_0x403bf0==0x0||_0x403bf0==_0xfbf7e5[0x0][_0x1d64('0x1a')]){_0x1d33d6=![];}_0x1ebc03['push'](dbH[_0x1d64('0x13')][_0x1d64('0x1b')](util[_0x1d64('0xe')](_0x1d64('0x1c'),QUERY,_0x30ab55,_0x28a0a2),{'type':dbH[_0x1d64('0x13')][_0x1d64('0x15')]['SELECT']}));}}}else{_0x1ebc03['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x1d64('0x13')][_0x1d64('0x15')][_0x1d64('0x16')]}));}var _0x25f216=path[_0x1d64('0x1d')](PATH);var _0x3a7347=path[_0x1d64('0x1e')](PATH,_0x1d64('0x1f'));var _0xb79c4d=_0x6dee96[_0x1d64('0x18')]&&_0x1ebc03[_0x1d64('0x19')]>0x1;var _0x4a1c53=[];if(!fs[_0x1d64('0x20')](path[_0x1d64('0x21')](_0x25f216,_0x3a7347))&&_0xb79c4d){fs['mkdirSync'](path[_0x1d64('0x21')](_0x25f216,_0x3a7347));}return BPromise[_0x1d64('0x22')](_0x1ebc03,function(_0x1e8b69){_0x4a1c53['push'](_0x1e8b69);})['then'](function(){for(var _0x444aa1=0x0;_0x444aa1<_0x4a1c53['length'];_0x444aa1+=0x1){var _0x5eaa31;var _0x303ae7=_0x4a1c53[_0x444aa1];if(_0xb79c4d){_0x5eaa31=path[_0x1d64('0x21')](_0x25f216,_0x3a7347,util[_0x1d64('0xe')]('%s%d.%s',_0x3a7347,_0x444aa1,'xlsx'));}else{_0x5eaa31=path[_0x1d64('0x21')](_0x25f216,util[_0x1d64('0xe')](_0x1d64('0x23'),_0x3a7347,_0x1d64('0x24')));}fs['writeFileSync'](_0x5eaa31,json2xls(_0x303ae7),_0x1d64('0x25'));}})[_0x1d64('0x12')](function(){if(_0xb79c4d){zipdir(path[_0x1d64('0x21')](_0x25f216,_0x3a7347),{'saveTo':path[_0x1d64('0x21')](_0x25f216,util['format'](_0x1d64('0x23'),_0x3a7347,_0x1d64('0x26')))},function(_0x2e34aa,_0x48ef4f){});rimraf(path[_0x1d64('0x21')](_0x25f216,_0x3a7347),function(){});}})[_0x1d64('0x12')](function(){logger[_0x1d64('0xd')](util[_0x1d64('0xe')](_0x1d64('0x27'),EXTRACTED_REPORT_ID,_0x1d64('0x28')));return analyticExtractedReport('Completed',_0xb79c4d?util[_0x1d64('0xe')](_0x1d64('0x23'),_0x3a7347,_0xb79c4d?_0x1d64('0x26'):_0x1d64('0x24')):null);});})[_0x1d64('0x29')](function(_0x5ba4a5){logger[_0x1d64('0xd')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x1d64('0x2a')](_0x5ba4a5,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 87af9e0..84e6ff4 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 _0x9c54=['XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','then','intervals','findAll','IntervalId','VoiceExtension','uniq','map','exten','filter','playback','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','hasOwnProperty','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)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x9c54,0x120));var _0x49c5=function(_0x5bfc7a,_0x279099){_0x5bfc7a=_0x5bfc7a-0x0;var _0x129876=_0x9c54[_0x5bfc7a];return _0x129876;};'use strict';var _=require(_0x49c5('0x0'));var util=require('util');function rewrite(_0x5392b1,_0x483d8d){var _0x5518b1=this;return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x2')]['findAll']({'raw':!![]})[_0x49c5('0x3')](function(_0x1bc477){_0x5518b1[_0x49c5('0x4')]=_0x1bc477;return _0x5392b1['models']['VoiceExtension'][_0x49c5('0x5')]({'where':{'IntervalId':_0x483d8d[_0x49c5('0x6')]},'raw':!![]});})[_0x49c5('0x3')](function(_0x1072c5){return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x49c5('0x8')](_[_0x49c5('0x9')](_0x1072c5,_0x49c5('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x2dcce5){var _0x49d5c7=_[_0x49c5('0xb')](_0x2dcce5,{'priority':'1'});var _0x39584f=_[_0x49c5('0xb')](_0x2dcce5,{'isApp':0x1});var _0x39d9b9=_['groupBy'](_0x39584f,_0x49c5('0xa'));var _0x999d43=['queue',_0x49c5('0xc')];var _0x144ef9=[];var _0x5e9898=[];for(var _0x39c82d in _0x39d9b9){if(_0x39d9b9['hasOwnProperty'](_0x39c82d)){_0x5518b1[_0x49c5('0xd')]=0x2;_0x5518b1[_0x49c5('0xe')]=[];_0x5518b1[_0x49c5('0xf')]=_[_0x49c5('0x10')](_0x49d5c7,{'exten':_0x39d9b9[_0x39c82d][0x0]['exten']});_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':util[_0x49c5('0x13')](_0x49c5('0x14'),_0x39d9b9[_0x39c82d][0x0]['type']),'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});if(_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')]==='outbound'){if(_0x5518b1[_0x49c5('0xf')]){_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0]['type'],'app':_0x49c5('0x17'),'appdata':_0x49c5('0x18')+(_0x5518b1[_0x49c5('0xf')][_0x49c5('0x19')]?'${EXTEN:'+_0x5518b1['extension'][_0x49c5('0x19')]+'}':_0x49c5('0x1a')),'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});}_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0]['type'],'app':_0x49c5('0x17'),'appdata':'CDR(routeid)='+_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')],'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});var _0x59e7bc=_0x5518b1[_0x49c5('0xd')]++;_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0]['type'],'app':_0x49c5('0x1b'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x59e7bc+0x2)+_0x49c5('0x1c')+(_0x59e7bc+0x1)+')','context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x59e7bc,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});if(_0x5518b1[_0x49c5('0xf')]){_0x5518b1[_0x49c5('0xe')]['push']({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':_0x5518b1['extension']['cutdigits']?_0x49c5('0x1d')+_0x5518b1[_0x49c5('0xf')]['cutdigits']+'}':_0x49c5('0x1e'),'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});}_0x5518b1['extensions'][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x1f')+_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')],'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1['priority']++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});if(_0x5518b1[_0x49c5('0xf')]&&_0x5518b1['extension']['hasOwnProperty']('recordingFormat')&&_0x5518b1[_0x49c5('0xf')][_0x49c5('0x20')]!==_0x49c5('0x21')){_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x22'),'context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x23')+_0x5518b1['extension']['recordingFormat']||'wav','context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0]['VoiceExtensionId']});}}_0x5518b1['extensions'][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0]['exten'],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0]['VoiceExtensionId']});_0x5518b1[_0x49c5('0xe')]['push']({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0]['exten'],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});_0x5518b1[_0x49c5('0xe')]['push']({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':_0x49c5('0x24'),'context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});for(var _0x2fdcfc=0x0,_0x1ae3d0=0x0;_0x2fdcfc<_0x39d9b9[_0x39c82d][_0x49c5('0x25')];_0x2fdcfc+=0x1,_0x1ae3d0=0x0){var _0x3b384d=_0x39d9b9[_0x39c82d][_0x2fdcfc];if(_0x3b384d[_0x49c5('0x12')]){_0x3b384d[_0x49c5('0x12')]=_0x3b384d[_0x49c5('0x12')][_0x49c5('0x26')]();}var _0x34778d=[];var _0x3b7291=[];delete _0x3b384d['id'];delete _0x3b384d[_0x49c5('0x27')];delete _0x3b384d['updatedAt'];var _0x480a72=_0x3b384d[_0x49c5('0x28')]!==_0x49c5('0x29')?[_0x3b384d[_0x49c5('0x28')]]:_0x3b384d[_0x49c5('0x6')]?_[_0x49c5('0x9')](_[_0x49c5('0xb')](_0x5518b1[_0x49c5('0x4')],{'IntervalId':_0x3b384d['IntervalId']}),_0x49c5('0x28')):[];if(_0x3b384d['hasOwnProperty']('tag')){if(_0x3b384d[_0x49c5('0x2a')]&&_0x3b384d['tag']!=='--'){_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x2b')+_0x3b384d[_0x49c5('0x2a')],'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72[_0x49c5('0x25')]+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}}if(_0x3b384d['type']===_0x49c5('0x2c')&&_0x3b384d[_0x49c5('0x2d')](_0x49c5('0x2e'))){if(_0x3b384d['callerID']){_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x2f')+_0x3b384d[_0x49c5('0x2e')]+')','context':_0x3b384d['context'],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d[_0x49c5('0x16')]});}else{_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x30'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d['exten'],'priority':_0x480a72[_0x49c5('0x25')]+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}}if(_0x3b384d[_0x49c5('0x2d')](_0x49c5('0x31'))){if(_0x999d43[_0x49c5('0x32')](_0x3b384d[_0x49c5('0x33')][_0x49c5('0x26')]())>=0x0&&_0x3b384d[_0x49c5('0x34')]!==_0x49c5('0x35')){if(_0x3b384d[_0x49c5('0x31')]){_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x36'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d['exten'],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d['type'],'app':'Set','appdata':_0x49c5('0x37'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}else{_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x38'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d['exten'],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d[_0x49c5('0x16')]});_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':_0x49c5('0x39'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72[_0x49c5('0x25')]+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}}}for(var _0xe635c8=0x0;_0xe635c8<_0x480a72['length'];_0xe635c8+=0x1){var _0x542e5a=_0x5518b1[_0x49c5('0xd')]+_0x480a72[_0x49c5('0x25')];var _0x395fc2=_0xe635c8===_0x480a72[_0x49c5('0x25')]-0x1?_0x5518b1[_0x49c5('0xd')]+_0x34778d[_0x49c5('0x25')]+_0x3b7291['length']+0x2:_0x5518b1[_0x49c5('0xd')]+_0xe635c8+0x1;_0x34778d[_0x49c5('0x3a')](_0xe635c8,0x0,{'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x3b'),'appdata':_0x480a72[_0xe635c8]+'?'+_0x3b384d['context']+',${EXTEN},'+_0x542e5a+':'+_0x3b384d[_0x49c5('0x15')]+_0x49c5('0x3c')+_0x395fc2,'exten':_0x3b384d['exten'],'context':_0x3b384d[_0x49c5('0x15')],'priority':_0x5518b1[_0x49c5('0xd')]+_0xe635c8,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0]['VoiceExtensionId']});}_0x3b384d[_0x49c5('0xd')]=_0x34778d[_0x49c5('0x25')]?_[_0x49c5('0x3d')](_0x34778d)['priority']+0x1:_0x5518b1['priority'];_0x5518b1[_0x49c5('0xd')]=(_0x3b7291[_0x49c5('0x25')]?_[_0x49c5('0x3d')](_0x3b7291)['priority']:_0x3b384d[_0x49c5('0xd')])+0x1;_0x5518b1[_0x49c5('0xe')]=_['concat'](_0x5518b1[_0x49c5('0xe')],_0x34778d,[_0x3b384d],_0x3b7291);}_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x3e'),'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'priority':_0x5518b1[_0x49c5('0xd')],'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});_0x144ef9[_0x49c5('0x11')](_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]);_0x5e9898=_[_0x49c5('0x3f')](_0x5e9898,_0x5518b1['extensions']);}}return _0x5392b1['transaction'](function(_0x3ac812){return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x144ef9}},'transaction':_0x3ac812})['then'](function(_0x39775f){return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x7')][_0x49c5('0x40')](_[_0x49c5('0x41')](_0x5e9898,_0x49c5('0xd')),{'transaction':_0x3ac812});});});})[_0x49c5('0x42')](function(_0xd37baa){console[_0x49c5('0x43')](_0xd37baa);});}exports[_0x49c5('0x44')]=rewrite; \ No newline at end of file +var _0x3c8e=['_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','hasOwnProperty','tag','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','context','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0xd5b8d4,_0x84559e){var _0x5b7314=function(_0x5322b7){while(--_0x5322b7){_0xd5b8d4['push'](_0xd5b8d4['shift']());}};_0x5b7314(++_0x84559e);}(_0x3c8e,0x65));var _0xe3c8=function(_0x251892,_0x3357ad){_0x251892=_0x251892-0x0;var _0x40e718=_0x3c8e[_0x251892];return _0x40e718;};'use strict';var _=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));function rewrite(_0x166090,_0x117b59){var _0x4839bf=this;return _0x166090['models'][_0xe3c8('0x2')][_0xe3c8('0x3')]({'raw':!![]})['then'](function(_0x520c40){_0x4839bf['intervals']=_0x520c40;return _0x166090[_0xe3c8('0x4')][_0xe3c8('0x5')][_0xe3c8('0x3')]({'where':{'IntervalId':_0x117b59[_0xe3c8('0x6')]},'raw':!![]});})[_0xe3c8('0x7')](function(_0x505744){return _0x166090[_0xe3c8('0x4')][_0xe3c8('0x5')]['findAll']({'where':{'exten':{'$in':_[_0xe3c8('0x8')](_[_0xe3c8('0x9')](_0x505744,_0xe3c8('0xa')))}},'order':[{'raw':_0xe3c8('0xb')}],'raw':!![]});})[_0xe3c8('0x7')](function(_0x50f612){var _0x18e5ea=_['filter'](_0x50f612,{'priority':'1'});var _0x1189b8=_[_0xe3c8('0xc')](_0x50f612,{'isApp':0x1});var _0x2d29eb=_[_0xe3c8('0xd')](_0x1189b8,'exten');var _0x29d174=[_0xe3c8('0xe'),'playback'];var _0x28f419=[];var _0x561eb4=[];for(var _0x40751c in _0x2d29eb){if(_0x2d29eb['hasOwnProperty'](_0x40751c)){_0x4839bf[_0xe3c8('0xf')]=0x2;_0x4839bf[_0xe3c8('0x10')]=[];_0x4839bf[_0xe3c8('0x11')]=_[_0xe3c8('0x12')](_0x18e5ea,{'exten':_0x2d29eb[_0x40751c][0x0]['exten']});_0x4839bf[_0xe3c8('0x10')][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':_0xe3c8('0x15'),'appdata':util[_0xe3c8('0x16')](_0xe3c8('0x17'),_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')]),'context':_0x2d29eb[_0x40751c][0x0]['context'],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf['priority']++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});if(_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')]===_0xe3c8('0x19')){if(_0x4839bf['extension']){_0x4839bf['extensions'][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':'Set','appdata':_0xe3c8('0x1a')+(_0x4839bf[_0xe3c8('0x11')][_0xe3c8('0x1b')]?'${EXTEN:'+_0x4839bf[_0xe3c8('0x11')][_0xe3c8('0x1b')]+'}':'${EXTEN}'),'context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf[_0xe3c8('0xf')]++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});}_0x4839bf['extensions'][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':_0xe3c8('0x15'),'appdata':_0xe3c8('0x1d')+_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')],'context':_0x2d29eb[_0x40751c][0x0]['context'],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf[_0xe3c8('0xf')]++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0]['VoiceExtensionId']});var _0x5ef5a3=_0x4839bf['priority']++;_0x4839bf['extensions']['push']({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':'ExecIf','appdata':_0xe3c8('0x1e')+(_0x5ef5a3+0x2)+_0xe3c8('0x1f')+(_0x5ef5a3+0x1)+')','context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x5ef5a3,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});if(_0x4839bf[_0xe3c8('0x11')]){_0x4839bf[_0xe3c8('0x10')]['push']({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':'Set','appdata':_0x4839bf['extension'][_0xe3c8('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x4839bf[_0xe3c8('0x11')]['cutdigits']+'}':_0xe3c8('0x20'),'context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf['priority']++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});}_0x4839bf['extensions'][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':_0xe3c8('0x15'),'appdata':_0xe3c8('0x21')+_0x2d29eb[_0x40751c][0x0]['VoiceExtensionId'],'context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf['priority']++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});if(_0x4839bf[_0xe3c8('0x11')]&&_0x4839bf[_0xe3c8('0x11')]['hasOwnProperty'](_0xe3c8('0x22'))&&_0x4839bf[_0xe3c8('0x11')][_0xe3c8('0x22')]!==_0xe3c8('0x23')){_0x4839bf[_0xe3c8('0x10')][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0]['type'],'app':_0xe3c8('0x15'),'appdata':_0xe3c8('0x24'),'context':_0x2d29eb[_0x40751c][0x0]['context'],'exten':_0x2d29eb[_0x40751c][0x0]['exten'],'priority':_0x4839bf[_0xe3c8('0xf')]++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});_0x4839bf['extensions'][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0]['type'],'app':_0xe3c8('0x15'),'appdata':_0xe3c8('0x25')+_0x4839bf[_0xe3c8('0x11')][_0xe3c8('0x22')]||'wav','context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf[_0xe3c8('0xf')]++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});}}_0x4839bf[_0xe3c8('0x10')]['push']({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':_0xe3c8('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0]['exten'],'priority':_0x4839bf[_0xe3c8('0xf')]++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});_0x4839bf[_0xe3c8('0x10')][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0]['type'],'app':'Set','appdata':_0xe3c8('0x26'),'context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf[_0xe3c8('0xf')]++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});_0x4839bf['extensions'][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0]['type'],'app':_0xe3c8('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x1c')],'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'priority':_0x4839bf[_0xe3c8('0xf')]++,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0]['VoiceExtensionId']});for(var _0x3aca6c=0x0,_0x54e4e4=0x0;_0x3aca6c<_0x2d29eb[_0x40751c]['length'];_0x3aca6c+=0x1,_0x54e4e4=0x0){var _0x5d30f0=_0x2d29eb[_0x40751c][_0x3aca6c];if(_0x5d30f0[_0xe3c8('0x14')]){_0x5d30f0[_0xe3c8('0x14')]=_0x5d30f0[_0xe3c8('0x14')][_0xe3c8('0x27')]();}var _0x20fde5=[];var _0x24266e=[];delete _0x5d30f0['id'];delete _0x5d30f0[_0xe3c8('0x28')];delete _0x5d30f0[_0xe3c8('0x29')];var _0x18fdc8=_0x5d30f0[_0xe3c8('0x2a')]!==_0xe3c8('0x2b')?[_0x5d30f0[_0xe3c8('0x2a')]]:_0x5d30f0[_0xe3c8('0x6')]?_[_0xe3c8('0x9')](_[_0xe3c8('0xc')](_0x4839bf[_0xe3c8('0x2c')],{'IntervalId':_0x5d30f0['IntervalId']}),'interval'):[];if(_0x5d30f0[_0xe3c8('0x2d')]('tag')){if(_0x5d30f0[_0xe3c8('0x2e')]&&_0x5d30f0['tag']!=='--'){_0x20fde5['push']({'type':_0x5d30f0[_0xe3c8('0x14')],'app':_0xe3c8('0x15'),'appdata':'CDR(tag)='+_0x5d30f0[_0xe3c8('0x2e')],'context':_0x5d30f0[_0xe3c8('0x1c')],'exten':_0x5d30f0[_0xe3c8('0xa')],'priority':_0x18fdc8[_0xe3c8('0x2f')]+_0x4839bf[_0xe3c8('0xf')]+_0x54e4e4++,'VoiceExtensionId':_0x5d30f0['VoiceExtensionId']});}}if(_0x5d30f0[_0xe3c8('0x14')]===_0xe3c8('0x19')&&_0x5d30f0[_0xe3c8('0x2d')](_0xe3c8('0x30'))){if(_0x5d30f0['callerID']){_0x20fde5[_0xe3c8('0x13')]({'type':_0x5d30f0[_0xe3c8('0x14')],'app':_0xe3c8('0x31'),'appdata':_0xe3c8('0x32')+_0x5d30f0[_0xe3c8('0x30')]+')','context':_0x5d30f0['context'],'exten':_0x5d30f0['exten'],'priority':_0x18fdc8[_0xe3c8('0x2f')]+_0x4839bf[_0xe3c8('0xf')]+_0x54e4e4++,'VoiceExtensionId':_0x5d30f0[_0xe3c8('0x18')]});}else{_0x20fde5[_0xe3c8('0x13')]({'type':_0x5d30f0[_0xe3c8('0x14')],'app':_0xe3c8('0x31'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5d30f0[_0xe3c8('0x1c')],'exten':_0x5d30f0[_0xe3c8('0xa')],'priority':_0x18fdc8['length']+_0x4839bf[_0xe3c8('0xf')]+_0x54e4e4++,'VoiceExtensionId':_0x5d30f0[_0xe3c8('0x18')]});}}if(_0x5d30f0['hasOwnProperty'](_0xe3c8('0x33'))){if(_0x29d174[_0xe3c8('0x34')](_0x5d30f0[_0xe3c8('0x35')][_0xe3c8('0x27')]())>=0x0&&_0x5d30f0['appType']!==_0xe3c8('0x36')){if(_0x5d30f0[_0xe3c8('0x33')]){_0x20fde5[_0xe3c8('0x13')]({'type':_0x5d30f0[_0xe3c8('0x14')],'app':_0xe3c8('0x31'),'appdata':_0xe3c8('0x37'),'context':_0x5d30f0[_0xe3c8('0x1c')],'exten':_0x5d30f0[_0xe3c8('0xa')],'priority':_0x18fdc8[_0xe3c8('0x2f')]+_0x4839bf[_0xe3c8('0xf')]+_0x54e4e4++,'VoiceExtensionId':_0x5d30f0['VoiceExtensionId']});_0x20fde5['push']({'type':_0x5d30f0[_0xe3c8('0x14')],'app':_0xe3c8('0x15'),'appdata':_0xe3c8('0x38'),'context':_0x5d30f0[_0xe3c8('0x1c')],'exten':_0x5d30f0[_0xe3c8('0xa')],'priority':_0x18fdc8[_0xe3c8('0x2f')]+_0x4839bf[_0xe3c8('0xf')]+_0x54e4e4++,'VoiceExtensionId':_0x5d30f0['VoiceExtensionId']});}else{_0x20fde5[_0xe3c8('0x13')]({'type':_0x5d30f0[_0xe3c8('0x14')],'app':_0xe3c8('0x31'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5d30f0[_0xe3c8('0x1c')],'exten':_0x5d30f0[_0xe3c8('0xa')],'priority':_0x18fdc8['length']+_0x4839bf['priority']+_0x54e4e4++,'VoiceExtensionId':_0x5d30f0[_0xe3c8('0x18')]});_0x20fde5[_0xe3c8('0x13')]({'type':_0x5d30f0['type'],'app':_0xe3c8('0x15'),'appdata':_0xe3c8('0x39'),'context':_0x5d30f0[_0xe3c8('0x1c')],'exten':_0x5d30f0[_0xe3c8('0xa')],'priority':_0x18fdc8[_0xe3c8('0x2f')]+_0x4839bf[_0xe3c8('0xf')]+_0x54e4e4++,'VoiceExtensionId':_0x5d30f0[_0xe3c8('0x18')]});}}}for(var _0x285841=0x0;_0x285841<_0x18fdc8[_0xe3c8('0x2f')];_0x285841+=0x1){var _0x195076=_0x4839bf['priority']+_0x18fdc8['length'];var _0x5aa6ad=_0x285841===_0x18fdc8[_0xe3c8('0x2f')]-0x1?_0x4839bf['priority']+_0x20fde5[_0xe3c8('0x2f')]+_0x24266e[_0xe3c8('0x2f')]+0x2:_0x4839bf[_0xe3c8('0xf')]+_0x285841+0x1;_0x20fde5[_0xe3c8('0x3a')](_0x285841,0x0,{'type':_0x5d30f0[_0xe3c8('0x14')],'app':'GotoIfTime','appdata':_0x18fdc8[_0x285841]+'?'+_0x5d30f0[_0xe3c8('0x1c')]+_0xe3c8('0x3b')+_0x195076+':'+_0x5d30f0[_0xe3c8('0x1c')]+_0xe3c8('0x3b')+_0x5aa6ad,'exten':_0x5d30f0[_0xe3c8('0xa')],'context':_0x5d30f0[_0xe3c8('0x1c')],'priority':_0x4839bf['priority']+_0x285841,'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]});}_0x5d30f0['priority']=_0x20fde5[_0xe3c8('0x2f')]?_[_0xe3c8('0x3c')](_0x20fde5)['priority']+0x1:_0x4839bf['priority'];_0x4839bf[_0xe3c8('0xf')]=(_0x24266e['length']?_[_0xe3c8('0x3c')](_0x24266e)[_0xe3c8('0xf')]:_0x5d30f0[_0xe3c8('0xf')])+0x1;_0x4839bf['extensions']=_[_0xe3c8('0x3d')](_0x4839bf[_0xe3c8('0x10')],_0x20fde5,[_0x5d30f0],_0x24266e);}_0x4839bf[_0xe3c8('0x10')][_0xe3c8('0x13')]({'type':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x14')],'app':_0xe3c8('0x3e'),'exten':_0x2d29eb[_0x40751c][0x0][_0xe3c8('0xa')],'context':_0x2d29eb[_0x40751c][0x0]['context'],'priority':_0x4839bf['priority'],'VoiceExtensionId':_0x2d29eb[_0x40751c][0x0]['VoiceExtensionId']});_0x28f419['push'](_0x2d29eb[_0x40751c][0x0][_0xe3c8('0x18')]);_0x561eb4=_[_0xe3c8('0x3d')](_0x561eb4,_0x4839bf[_0xe3c8('0x10')]);}}return _0x166090[_0xe3c8('0x3f')](function(_0x1b33b0){return _0x166090[_0xe3c8('0x4')]['VoiceExtension'][_0xe3c8('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x28f419}},'transaction':_0x1b33b0})[_0xe3c8('0x7')](function(_0x2b6cd5){return _0x166090[_0xe3c8('0x4')]['VoiceExtension'][_0xe3c8('0x41')](_[_0xe3c8('0x42')](_0x561eb4,_0xe3c8('0xf')),{'transaction':_0x1b33b0});});});})[_0xe3c8('0x43')](function(_0x4b438c){console['error'](_0x4b438c);});}exports[_0xe3c8('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 26a6b02..c1c8fd7 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(_0x491213,_0x5f0d00){var _0x1a912c=function(_0x5dce1e){while(--_0x5dce1e){_0x491213['push'](_0x491213['shift']());}};_0x1a912c(++_0x5f0d00);}(_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(_0x49c512,_0x424e73){var _0x128c9e=function(_0x29c5f3){while(--_0x29c5f3){_0x49c512['push'](_0x49c512['shift']());}};_0x128c9e(++_0x424e73);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xcb91[_0x111e94];return _0x3de107;};'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 80d86ce..ed3f7dc 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 _0xd0d1=['affectedRows','unlink','complete','argv','existsSync','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','cm_contacts',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','error','exit','errors','push','message','sequelize','query','spread','catch','main','stringify','send','start','root','server/files/tmp','.csv','header','writeFileSync','parse','length','rows','data','hasOwnProperty','trim','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','format','isNil','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish'];(function(_0xc6afa9,_0x3d98ca){var _0x3085db=function(_0xb36ba9){while(--_0xb36ba9){_0xc6afa9['push'](_0xc6afa9['shift']());}};_0x3085db(++_0x3d98ca);}(_0xd0d1,0x10e));var _0x1d0d=function(_0x34a30c,_0x4adf02){_0x34a30c=_0x34a30c-0x0;var _0x489bc7=_0xd0d1[_0x34a30c];return _0x489bc7;};'use strict';var fs=require('fs');var path=require(_0x1d0d('0x0'));var _=require(_0x1d0d('0x1'));var Papa=require(_0x1d0d('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x1d0d('0x3'));var Redis=require(_0x1d0d('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x1d0d('0x5'));var logger=require(_0x1d0d('0x6'))(_0x1d0d('0x7'));config[_0x1d0d('0x8')]=_[_0x1d0d('0x9')](config[_0x1d0d('0x8')],{'host':_0x1d0d('0xa'),'port':0x18eb});var socket=require(_0x1d0d('0xb'))(new Redis(config[_0x1d0d('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x1d0d('0xc'));function isEmail(_0x292bce){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))*$/[_0x1d0d('0xd')](_0x292bce);}function selectNotIn(_0x19a39e,_0x4ba2f1,_0xd42da6,_0x4b6771,_0x206554){return squel[_0x1d0d('0xe')]()[_0x1d0d('0xf')](_0x1d0d('0x10'))[_0x1d0d('0x11')](_0x4b6771)[_0x1d0d('0x12')](_0x4ba2f1,null,_0x4ba2f1+_0x1d0d('0x13')+_0x4b6771+'.'+_0xd42da6)[_0x1d0d('0x14')](_0x4b6771+'.'+_0xd42da6+_0x1d0d('0x15')+_0x19a39e+'.'+_0xd42da6)['where'](_0x4ba2f1+_0x1d0d('0x16')+_0x206554[_0x1d0d('0x12')]()+')');}function insertCmHopper(_0x4f4043,_0x8e63b9,_0x2741d4,_0x1a2c86,_0x534c98){var _0x4c900c=['cm_contacts.phone',_0x1d0d('0x17'),_0x1d0d('0x18'),_0x1d0d('0x19'),_0x8e63b9+'.'+_0x1a2c86,_0x1d0d('0x1a'),_0x1d0d('0x1b'),_0x1d0d('0x1c'),_0x1d0d('0x1d'),'\x22'+_0x534c98+'\x22'];return squel[_0x1d0d('0x1e')]()[_0x1d0d('0x1f')]('cm_hopper')[_0x1d0d('0x20')]([_0x1d0d('0x10'),_0x1d0d('0x21'),_0x1d0d('0x22'),_0x1d0d('0x23'),_0x1a2c86,_0x1d0d('0x24'),_0x1d0d('0x25'),_0x1d0d('0x26'),_0x1d0d('0x27'),_0x1d0d('0x28')],squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x4c900c)[_0x1d0d('0x11')](_0x8e63b9)[_0x1d0d('0x12')]('cm_contacts',null,_0x1d0d('0x2a')+_0x8e63b9+'.CmListId')[_0x1d0d('0x12')](_0x2741d4,null,_0x2741d4+_0x1d0d('0x13')+_0x8e63b9+'.'+_0x1a2c86)[_0x1d0d('0x14')](_0x8e63b9+_0x1d0d('0x2b'),_0x4f4043)[_0x1d0d('0x14')](_0x1d0d('0x2c'),NOW)['where'](_0x1d0d('0x2d'),selectNotIn(_0x8e63b9,_0x2741d4,_0x1a2c86,_0x1d0d('0x2e'),[_0x1d0d('0x2f'),_0x1d0d('0x30')]))['where'](_0x1d0d('0x2d'),selectNotIn(_0x8e63b9,_0x2741d4,_0x1a2c86,_0x1d0d('0x2e'),[_0x1d0d('0x2f')])))[_0x1d0d('0x31')]();}function insertCmHopperBlack(_0x514176,_0x5c4cd5,_0x264c29,_0x18494b){var _0x14a11f=[_0x1d0d('0x32'),_0x1d0d('0x18'),_0x1d0d('0x19'),_0x5c4cd5+'.'+_0x18494b,_0x1d0d('0x1a'),_0x1d0d('0x1b')];return squel[_0x1d0d('0x1e')]()[_0x1d0d('0x1f')](_0x1d0d('0x33'))[_0x1d0d('0x20')](['phone',_0x1d0d('0x22'),'ListId',_0x18494b,_0x1d0d('0x24'),'updatedAt'],squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x14a11f)[_0x1d0d('0x11')](_0x5c4cd5)[_0x1d0d('0x12')]('cm_contacts',null,_0x1d0d('0x2a')+_0x5c4cd5+'.CmListId')[_0x1d0d('0x12')](_0x264c29,null,_0x264c29+'.id\x20=\x20'+_0x5c4cd5+'.'+_0x18494b)['where'](_0x5c4cd5+_0x1d0d('0x2b'),_0x514176)[_0x1d0d('0x14')](_0x1d0d('0x2c'),NOW)[_0x1d0d('0x14')](_0x1d0d('0x2d'),squel[_0x1d0d('0xe')]()['field'](_0x1d0d('0x10'))[_0x1d0d('0x11')](_0x1d0d('0x33'))[_0x1d0d('0x14')](_0x1d0d('0x34'),_0x514176)[_0x1d0d('0x14')](_0x18494b+_0x1d0d('0x35'),_0x5c4cd5+'.'+_0x18494b)))[_0x1d0d('0x31')]();}function insertCmContact(_0x1ecea5,_0x253eae,_0x4d9d37,_0x51a7a0){var _0x486344=_['concat'](_[_0x1d0d('0x36')](_0x51a7a0),[_0x1d0d('0x23'),_0x1d0d('0x37'),_0x1d0d('0x24'),_0x1d0d('0x25')]);return squel[_0x1d0d('0x1e')]()['into'](_0x1d0d('0x38'))['fromQuery'](_0x486344,squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x486344)['from'](_0x253eae)[_0x1d0d('0x14')]('('+_0x4d9d37['join'](',')+_0x1d0d('0x39'),squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x4d9d37)[_0x1d0d('0x11')](_0x1d0d('0x38'))['where'](_0x1d0d('0x34'),_0x1ecea5)[_0x1d0d('0x14')](_0x1d0d('0x3a')))[_0x1d0d('0x14')](_0x1d0d('0x3b'),squel[_0x1d0d('0xe')]()[_0x1d0d('0xf')]('MIN(id)',_0x1d0d('0x3c'))[_0x1d0d('0x11')](_0x253eae)['group'](_0x4d9d37['join'](','))))[_0x1d0d('0x31')]();}function handleStop(){logger[_0x1d0d('0x3d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5eeacc){logger[_0x1d0d('0x3e')](_0x5eeacc['message']);process[_0x1d0d('0x3f')](0x1);}function handleError(_0x3b35b2,_0x49fef8){stats[_0x1d0d('0x40')][_0x1d0d('0x41')]({'name':_0x49fef8['code'],'message':_0x49fef8[_0x1d0d('0x42')],'row':_0x3b35b2});}function handleQuery(_0x3d5418){logger['info'](_0x3d5418);return db[_0x1d0d('0x43')][_0x1d0d('0x44')](_0x3d5418)[_0x1d0d('0x45')](function(_0x160b99){results[_0x1d0d('0x41')](_0x160b99);})[_0x1d0d('0x46')](function(_0x3b3084){logger[_0x1d0d('0x3e')](_0x3b3084[_0x1d0d('0x42')]);});}function main(_0x3191ab,_0x18cd97,_0x43d6d7,_0x2ec020){logger['info'](_0x1d0d('0x47'),_0x3191ab,JSON[_0x1d0d('0x48')](_0x18cd97));process[_0x1d0d('0x49')](_0x1d0d('0x4a'));var _0x24f077=_0x18cd97['binding'];var _0x3942b6=_0x18cd97['socket_timestamp'];var _0x19b99c=path[_0x1d0d('0x12')](config[_0x1d0d('0x4b')],_0x1d0d('0x4c'),_0x3942b6+_0x1d0d('0x4d'));var _0x1a6f7b=_[_0x1d0d('0x36')](_0x24f077)['join']();logger[_0x1d0d('0x3d')](_0x1d0d('0x4e'),_0x1a6f7b);fs[_0x1d0d('0x4f')](_0x19b99c,_0x1a6f7b+'\x0a');Papa[_0x1d0d('0x50')](fs['createReadStream'](_0x3191ab),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ed5d6,_0x3f2ebd){try{for(var _0x4b7612=0x0,_0x1265d2=[];_0x4b7612<_0x5ed5d6['data'][_0x1d0d('0x51')];_0x4b7612++){stats[_0x1d0d('0x52')]+=0x1;if(_0x5ed5d6['errors'][_0x4b7612]){handleError(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612],_0x5ed5d6[_0x1d0d('0x40')][_0x4b7612]);}else{var _0x192e88=[];for(var _0x5eb28a in _0x24f077){if(_0x24f077[_0x1d0d('0x54')](_0x5eb28a)){if(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612][_0x24f077[_0x5eb28a]]){var _0x327f11=_[_0x1d0d('0x55')](_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612][_0x24f077[_0x5eb28a]]['replace'](/"/g,'\x27'));switch(_0x5eb28a){case _0x1d0d('0x21'):var _0x3bdca6=moment(_0x327f11,_0x1d0d('0xc'),!![]);if(_0x3bdca6[_0x1d0d('0x56')]()){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}else{_0x192e88[_0x1d0d('0x41')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3a5a7d=parseInt(_0x327f11);_0x327f11=_[_0x1d0d('0x57')](_0x3a5a7d)||_0x3a5a7d<0x0||_0x3a5a7d>0x4?_0x2ec020?0x3:0x2:_0x3a5a7d;_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');break;case _0x1d0d('0x27'):var _0x3ca315=parseInt(_0x327f11);if(_[_0x1d0d('0x58')](_0x3ca315)&&_[_0x1d0d('0x59')](_0x43d6d7,_0x3ca315)){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x3ca315+'\x22');}else{_0x192e88[_0x1d0d('0x41')](_0x1d0d('0x5a'));}break;case _0x1d0d('0x5b'):if(isEmail(_0x327f11)){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}else{_0x192e88['push'](_0x1d0d('0x5c'));}break;case'dateOfBirth':var _0x4b7d7=moment(_0x327f11,_0x1d0d('0x5d'),!![]);if(_0x4b7d7[_0x1d0d('0x56')]()){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}else{_0x192e88['push'](_0x1d0d('0x5e'));}break;default:_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}}else{switch(_0x5eb28a){case'firstName':case'phone':_0x192e88['push'](_0x5eb28a+'\x20not\x20specified');break;default:_0x1265d2[_0x1d0d('0x41')]('\x22\x22');}}}}if(_0x192e88[_0x1d0d('0x51')]){handleError(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612],{'code':'SystemRow','message':_0x192e88[_0x1d0d('0x12')]()});}else{fs[_0x1d0d('0x5f')](_0x19b99c,_0x1265d2[_0x1d0d('0x12')]()+'\x0a');}_0x1265d2=[];}if(!(stats['rows']%0xc8)){socket[_0x1d0d('0x60')](_0x1d0d('0x61')+_0x3942b6,stats);stats[_0x1d0d('0x40')]=[];}}if(stopped){logger[_0x1d0d('0x3d')](_0x1d0d('0x62'));_0x3f2ebd['abort']();}}catch(_0x5d4e6e){handleError(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612],{'code':_0x1d0d('0x63'),'message':_0x5d4e6e['message']});logger[_0x1d0d('0x3e')](_0x1d0d('0x64'),_0x5d4e6e[_0x1d0d('0x42')]);}},'complete':function(){try{var _0x4dfb45=[];var _0x45f035=_0x1d0d('0x38');if(_0x18cd97['duplicates']&&_0x18cd97[_0x1d0d('0x65')]['length']){_0x45f035=_0x1d0d('0x66')+_0x3942b6;_0x4dfb45[_0x1d0d('0x41')](_0x1d0d('0x67')+_0x45f035+'\x20LIKE\x20cm_contacts;');}var _0x3d499f=util[_0x1d0d('0x68')]('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',_0x19b99c,_0x45f035,_0x1a6f7b,_0x18cd97[_0x1d0d('0x23')],_0x18cd97[_0x1d0d('0x37')]||null,NOW,NOW);if(_[_0x1d0d('0x69')](_0x24f077['scheduledat'])){_0x3d499f+=',\x20scheduledAt\x20=\x20NOW()';}_0x4dfb45[_0x1d0d('0x41')](_0x3d499f);if(_0x18cd97[_0x1d0d('0x65')]&&_0x18cd97[_0x1d0d('0x65')][_0x1d0d('0x51')]){_0x4dfb45[_0x1d0d('0x41')](insertCmContact(_0x18cd97[_0x1d0d('0x23')],_0x45f035,_0x18cd97[_0x1d0d('0x65')],_0x24f077));_0x4dfb45['push']('DROP\x20TABLE\x20'+_0x45f035+';');}_0x4dfb45[_0x1d0d('0x41')](insertCmHopper(_0x18cd97[_0x1d0d('0x23')],_0x1d0d('0x6a'),_0x1d0d('0x6b'),_0x1d0d('0x6c'),_0x2ec020));_0x4dfb45['push'](insertCmHopperBlack(_0x18cd97[_0x1d0d('0x23')],_0x1d0d('0x6d'),_0x1d0d('0x6b'),_0x1d0d('0x6c')));_0x4dfb45[_0x1d0d('0x41')](insertCmHopper(_0x18cd97['ListId'],_0x1d0d('0x6e'),_0x1d0d('0x6f'),_0x1d0d('0x70'),_0x2ec020));_0x4dfb45[_0x1d0d('0x41')](insertCmHopperBlack(_0x18cd97[_0x1d0d('0x23')],_0x1d0d('0x71'),_0x1d0d('0x6f'),_0x1d0d('0x70')));BPromise[_0x1d0d('0x72')](_0x4dfb45,handleQuery)[_0x1d0d('0x73')](function(_0x4dbc38){stats[_0x1d0d('0x74')]=!![];stats[_0x1d0d('0x75')]=_0x18cd97[_0x1d0d('0x65')]&&_0x18cd97['duplicates'][_0x1d0d('0x51')]?results[0x2][_0x1d0d('0x75')]:results[0x0][_0x1d0d('0x75')];socket[_0x1d0d('0x60')]('contact:import:'+_0x3942b6,stats);fs[_0x1d0d('0x76')](_0x3191ab);fs[_0x1d0d('0x76')](_0x19b99c);process[_0x1d0d('0x3f')](0x0);})[_0x1d0d('0x46')](function(_0x5cb9b4){logger[_0x1d0d('0x3e')](_0x5cb9b4[_0x1d0d('0x42')]);process[_0x1d0d('0x3f')](0x1);});}catch(_0x4ab86a){logger[_0x1d0d('0x3e')](_0x1d0d('0x77'),_0x4ab86a[_0x1d0d('0x42')]);process[_0x1d0d('0x3f')](0x1);}},'error':function(_0x52ba2e,_0x453cff,_0x23c8be,_0x47cc79){throw new Error(_0x47cc79);}});}function validate(){if(process[_0x1d0d('0x78')]&&process[_0x1d0d('0x78')][_0x1d0d('0x51')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0xf237db=path[_0x1d0d('0x12')](config[_0x1d0d('0x4b')],_0x1d0d('0x4c'),process[_0x1d0d('0x78')][0x2]);if(!fs[_0x1d0d('0x79')](_0xf237db)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1a81a4={};try{_0x1a81a4=JSON[_0x1d0d('0x50')](process['argv'][0x3]);if(!_0x1a81a4[_0x1d0d('0x7a')]){throw new Error(_0x1d0d('0x7b'));}if(!_0x1a81a4['binding'][_0x1d0d('0x10')]){throw new Error(_0x1d0d('0x7c'));}if(!_0x1a81a4[_0x1d0d('0x7a')][_0x1d0d('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x385872=0x0;if(_0x1a81a4['binding'][_0x1d0d('0x27')]){_0x385872=0x1;}if(!_0x1a81a4[_0x1d0d('0x23')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0xc0c9d){throw new Error(_0x1d0d('0x7e'));}var _0x38433e=[];try{_0x38433e=_['map'](JSON[_0x1d0d('0x50')](process[_0x1d0d('0x78')][0x4]),'id');}catch(_0x2f470a){logger[_0x1d0d('0x3d')](_0x1d0d('0x7f'));}main(_0xf237db,_0x1a81a4,_0x38433e,_0x385872);}validate();process['on']('SIGINT',handleStop);process['on'](_0x1d0d('0x80'),handleUncaughtException); \ No newline at end of file +var _0x0407=['ContactId','ListId','createdAt','ListId\x20=\x20?','\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','push','code','sequelize','catch','error','main','stringify','send','start','binding','socket_timestamp','root','header','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','emit','contact:import:','Abort\x20parser','SystemError','duplicates','cm_contacts_','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns','each','then','finish','affectedRows','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','cm_hopper_black','fromQuery'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0407,0xd5));var _0x7040=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0x0407[_0x1bc762];return _0x40f70c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x7040('0x0'));var Papa=require(_0x7040('0x1'));var util=require(_0x7040('0x2'));var BPromise=require(_0x7040('0x3'));var moment=require(_0x7040('0x4'));var squel=require(_0x7040('0x5'));var Redis=require('ioredis');var db=require(_0x7040('0x6'))['db'];var config=require(_0x7040('0x7'));var logger=require('../../../config/logger')(_0x7040('0x8'));config[_0x7040('0x9')]=_[_0x7040('0xa')](config['redis'],{'host':_0x7040('0xb'),'port':0x18eb});var socket=require(_0x7040('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7040('0xd')](_0x7040('0xe'));function isEmail(_0x129ed7){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x129ed7);}function selectNotIn(_0x56d974,_0x202b5e,_0x30e4a0,_0x3fceeb,_0x246c88){return squel[_0x7040('0xf')]()[_0x7040('0x10')](_0x7040('0x11'))[_0x7040('0x12')](_0x3fceeb)[_0x7040('0x13')](_0x202b5e,null,_0x202b5e+_0x7040('0x14')+_0x3fceeb+'.'+_0x30e4a0)[_0x7040('0x15')](_0x3fceeb+'.'+_0x30e4a0+_0x7040('0x16')+_0x56d974+'.'+_0x30e4a0)[_0x7040('0x15')](_0x202b5e+'.dialCheckDuplicateType\x20IN\x20('+_0x246c88[_0x7040('0x13')]()+')');}function insertCmHopper(_0x10aaa2,_0x45f8d1,_0x1ab2b6,_0x5dee60,_0x43aa42){var _0x24920f=['cm_contacts.phone',_0x7040('0x17'),_0x7040('0x18'),_0x7040('0x19'),_0x45f8d1+'.'+_0x5dee60,_0x7040('0x1a'),'cm_contacts.updatedAt',_0x7040('0x1b'),_0x7040('0x1c'),'\x22'+_0x43aa42+'\x22'];return squel[_0x7040('0x1d')]()[_0x7040('0x1e')](_0x7040('0x1f'))['fromQuery']([_0x7040('0x11'),_0x7040('0x20'),'ContactId','ListId',_0x5dee60,'createdAt',_0x7040('0x21'),_0x7040('0x22'),'UserId',_0x7040('0x23')],squel[_0x7040('0xf')]()[_0x7040('0x24')](_0x24920f)[_0x7040('0x12')](_0x45f8d1)[_0x7040('0x13')](_0x7040('0x25'),null,_0x7040('0x26')+_0x45f8d1+_0x7040('0x27'))[_0x7040('0x13')](_0x1ab2b6,null,_0x1ab2b6+_0x7040('0x14')+_0x45f8d1+'.'+_0x5dee60)['where'](_0x45f8d1+'.CmListId\x20=\x20?',_0x10aaa2)[_0x7040('0x15')](_0x7040('0x28'),NOW)[_0x7040('0x15')](_0x7040('0x29'),selectNotIn(_0x45f8d1,_0x1ab2b6,_0x5dee60,_0x7040('0x1f'),[_0x7040('0x2a'),_0x7040('0x2b')]))[_0x7040('0x15')](_0x7040('0x29'),selectNotIn(_0x45f8d1,_0x1ab2b6,_0x5dee60,_0x7040('0x1f'),['\x22always\x22'])))[_0x7040('0x2c')]();}function insertCmHopperBlack(_0x1b4747,_0x1cfc01,_0x501c37,_0x22a796){var _0x2ea2c2=[_0x7040('0x2d'),_0x7040('0x18'),_0x7040('0x19'),_0x1cfc01+'.'+_0x22a796,'cm_contacts.createdAt',_0x7040('0x2e')];return squel['insert']()['into'](_0x7040('0x2f'))[_0x7040('0x30')]([_0x7040('0x11'),_0x7040('0x31'),_0x7040('0x32'),_0x22a796,_0x7040('0x33'),_0x7040('0x21')],squel['select']()[_0x7040('0x24')](_0x2ea2c2)[_0x7040('0x12')](_0x1cfc01)[_0x7040('0x13')](_0x7040('0x25'),null,_0x7040('0x26')+_0x1cfc01+'.CmListId')[_0x7040('0x13')](_0x501c37,null,_0x501c37+_0x7040('0x14')+_0x1cfc01+'.'+_0x22a796)[_0x7040('0x15')](_0x1cfc01+'.CmListId\x20=\x20?',_0x1b4747)[_0x7040('0x15')](_0x7040('0x28'),NOW)[_0x7040('0x15')](_0x7040('0x29'),squel[_0x7040('0xf')]()[_0x7040('0x10')](_0x7040('0x11'))[_0x7040('0x12')](_0x7040('0x2f'))[_0x7040('0x15')](_0x7040('0x34'),_0x1b4747)[_0x7040('0x15')](_0x22a796+_0x7040('0x35'),_0x1cfc01+'.'+_0x22a796)))[_0x7040('0x2c')]();}function insertCmContact(_0x34a587,_0x511a8a,_0x523de4,_0x1e8295){var _0x2df3f7=_['concat'](_[_0x7040('0x36')](_0x1e8295),['ListId','CompanyId',_0x7040('0x33'),'updatedAt']);return squel['insert']()[_0x7040('0x1e')](_0x7040('0x25'))[_0x7040('0x30')](_0x2df3f7,squel['select']()[_0x7040('0x24')](_0x2df3f7)[_0x7040('0x12')](_0x511a8a)['where']('('+_0x523de4[_0x7040('0x13')](',')+_0x7040('0x37'),squel[_0x7040('0xf')]()[_0x7040('0x24')](_0x523de4)[_0x7040('0x12')](_0x7040('0x25'))[_0x7040('0x15')]('ListId\x20=\x20?',_0x34a587)['where'](_0x7040('0x38')))[_0x7040('0x15')]('id\x20IN\x20?',squel['select']()[_0x7040('0x10')](_0x7040('0x39'),_0x7040('0x3a'))[_0x7040('0x12')](_0x511a8a)[_0x7040('0x3b')](_0x523de4[_0x7040('0x13')](','))))[_0x7040('0x2c')]();}function handleStop(){logger[_0x7040('0x3c')](_0x7040('0x3d'));stopped=!![];}function handleUncaughtException(_0x39b544){logger['error'](_0x39b544[_0x7040('0x3e')]);process[_0x7040('0x3f')](0x1);}function handleError(_0x37b7be,_0x529a4b){stats[_0x7040('0x40')][_0x7040('0x41')]({'name':_0x529a4b[_0x7040('0x42')],'message':_0x529a4b[_0x7040('0x3e')],'row':_0x37b7be});}function handleQuery(_0xc6ebba){logger[_0x7040('0x3c')](_0xc6ebba);return db[_0x7040('0x43')]['query'](_0xc6ebba)['spread'](function(_0x51b275){results[_0x7040('0x41')](_0x51b275);})[_0x7040('0x44')](function(_0x33006d){logger[_0x7040('0x45')](_0x33006d[_0x7040('0x3e')]);});}function main(_0x500078,_0xfe65b8,_0x12af08,_0x29c33f){logger[_0x7040('0x3c')](_0x7040('0x46'),_0x500078,JSON[_0x7040('0x47')](_0xfe65b8));process[_0x7040('0x48')](_0x7040('0x49'));var _0x70c916=_0xfe65b8[_0x7040('0x4a')];var _0x221394=_0xfe65b8[_0x7040('0x4b')];var _0x3f1b5f=path[_0x7040('0x13')](config[_0x7040('0x4c')],'server/files/tmp',_0x221394+'.csv');var _0x3f49c6=_[_0x7040('0x36')](_0x70c916)['join']();logger[_0x7040('0x3c')](_0x7040('0x4d'),_0x3f49c6);fs[_0x7040('0x4e')](_0x3f1b5f,_0x3f49c6+'\x0a');Papa[_0x7040('0x4f')](fs[_0x7040('0x50')](_0x500078),{'header':!![],'skipEmptyLines':!![],'step':function(_0x48a8ab,_0x242090){try{for(var _0x315cee=0x0,_0x36923d=[];_0x315cee<_0x48a8ab[_0x7040('0x51')]['length'];_0x315cee++){stats[_0x7040('0x52')]+=0x1;if(_0x48a8ab['errors'][_0x315cee]){handleError(_0x48a8ab['data'][_0x315cee],_0x48a8ab[_0x7040('0x40')][_0x315cee]);}else{var _0x13562f=[];for(var _0x40204 in _0x70c916){if(_0x70c916[_0x7040('0x53')](_0x40204)){if(_0x48a8ab[_0x7040('0x51')][_0x315cee][_0x70c916[_0x40204]]){var _0x53b03a=_[_0x7040('0x54')](_0x48a8ab[_0x7040('0x51')][_0x315cee][_0x70c916[_0x40204]][_0x7040('0x55')](/"/g,'\x27'));switch(_0x40204){case _0x7040('0x20'):var _0x3181e2=moment(_0x53b03a,_0x7040('0xe'),!![]);if(_0x3181e2[_0x7040('0x56')]()){_0x36923d[_0x7040('0x41')]('\x22'+_0x53b03a+'\x22');}else{_0x13562f[_0x7040('0x41')](_0x7040('0x57'));}break;case'priority':var _0x5d9892=parseInt(_0x53b03a);_0x53b03a=_[_0x7040('0x58')](_0x5d9892)||_0x5d9892<0x0||_0x5d9892>0x4?_0x29c33f?0x3:0x2:_0x5d9892;_0x36923d[_0x7040('0x41')]('\x22'+_0x53b03a+'\x22');break;case _0x7040('0x59'):var _0x10f4c2=parseInt(_0x53b03a);if(_['isNumber'](_0x10f4c2)&&_[_0x7040('0x5a')](_0x12af08,_0x10f4c2)){_0x36923d[_0x7040('0x41')]('\x22'+_0x10f4c2+'\x22');}else{_0x13562f['push']('agent\x20not\x20exists');}break;case _0x7040('0x5b'):if(isEmail(_0x53b03a)){_0x36923d[_0x7040('0x41')]('\x22'+_0x53b03a+'\x22');}else{_0x13562f[_0x7040('0x41')](_0x7040('0x5c'));}break;case'dateOfBirth':var _0x5e218f=moment(_0x53b03a,'YYYY-MM-DD',!![]);if(_0x5e218f[_0x7040('0x56')]()){_0x36923d['push']('\x22'+_0x53b03a+'\x22');}else{_0x13562f['push'](_0x7040('0x5d'));}break;default:_0x36923d[_0x7040('0x41')]('\x22'+_0x53b03a+'\x22');}}else{switch(_0x40204){case _0x7040('0x5e'):case _0x7040('0x11'):_0x13562f[_0x7040('0x41')](_0x40204+_0x7040('0x5f'));break;default:_0x36923d['push']('\x22\x22');}}}}if(_0x13562f[_0x7040('0x60')]){handleError(_0x48a8ab[_0x7040('0x51')][_0x315cee],{'code':_0x7040('0x61'),'message':_0x13562f[_0x7040('0x13')]()});}else{fs['appendFileSync'](_0x3f1b5f,_0x36923d[_0x7040('0x13')]()+'\x0a');}_0x36923d=[];}if(!(stats[_0x7040('0x52')]%0xc8)){socket[_0x7040('0x62')](_0x7040('0x63')+_0x221394,stats);stats[_0x7040('0x40')]=[];}}if(stopped){logger[_0x7040('0x3c')](_0x7040('0x64'));_0x242090['abort']();}}catch(_0x3bc89e){handleError(_0x48a8ab[_0x7040('0x51')][_0x315cee],{'code':_0x7040('0x65'),'message':_0x3bc89e[_0x7040('0x3e')]});logger['error']('step',_0x3bc89e[_0x7040('0x3e')]);}},'complete':function(){try{var _0x30f576=[];var _0x120731=_0x7040('0x25');if(_0xfe65b8[_0x7040('0x66')]&&_0xfe65b8[_0x7040('0x66')]['length']){_0x120731=_0x7040('0x67')+_0x221394;_0x30f576[_0x7040('0x41')]('CREATE\x20TABLE\x20'+_0x120731+'\x20LIKE\x20cm_contacts;');}var _0x57ec63=util[_0x7040('0xd')](_0x7040('0x68'),_0x3f1b5f,_0x120731,_0x3f49c6,_0xfe65b8[_0x7040('0x32')],_0xfe65b8['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x70c916[_0x7040('0x20')])){_0x57ec63+=_0x7040('0x69');}_0x30f576[_0x7040('0x41')](_0x57ec63);if(_0xfe65b8[_0x7040('0x66')]&&_0xfe65b8['duplicates'][_0x7040('0x60')]){_0x30f576['push'](insertCmContact(_0xfe65b8['ListId'],_0x120731,_0xfe65b8[_0x7040('0x66')],_0x70c916));_0x30f576[_0x7040('0x41')](_0x7040('0x6a')+_0x120731+';');}_0x30f576[_0x7040('0x41')](insertCmHopper(_0xfe65b8[_0x7040('0x32')],_0x7040('0x6b'),_0x7040('0x6c'),'VoiceQueueId',_0x29c33f));_0x30f576[_0x7040('0x41')](insertCmHopperBlack(_0xfe65b8[_0x7040('0x32')],_0x7040('0x6d'),_0x7040('0x6c'),_0x7040('0x6e')));_0x30f576[_0x7040('0x41')](insertCmHopper(_0xfe65b8['ListId'],'campaigns_has_cm_lists','campaigns',_0x7040('0x6f'),_0x29c33f));_0x30f576[_0x7040('0x41')](insertCmHopperBlack(_0xfe65b8[_0x7040('0x32')],'campaigns_has_cm_blacklists',_0x7040('0x70'),_0x7040('0x6f')));BPromise[_0x7040('0x71')](_0x30f576,handleQuery)[_0x7040('0x72')](function(_0x56795a){stats[_0x7040('0x73')]=!![];stats[_0x7040('0x74')]=_0xfe65b8[_0x7040('0x66')]&&_0xfe65b8[_0x7040('0x66')][_0x7040('0x60')]?results[0x2][_0x7040('0x74')]:results[0x0][_0x7040('0x74')];socket['emit'](_0x7040('0x63')+_0x221394,stats);fs['unlink'](_0x500078);fs[_0x7040('0x75')](_0x3f1b5f);process[_0x7040('0x3f')](0x0);})[_0x7040('0x44')](function(_0x2f4043){logger['error'](_0x2f4043['message']);process[_0x7040('0x3f')](0x1);});}catch(_0x47df93){logger[_0x7040('0x45')](_0x7040('0x76'),_0x47df93[_0x7040('0x3e')]);process['exit'](0x1);}},'error':function(_0x2ae487,_0x353d76,_0x2d1283,_0x8b1d1c){throw new Error(_0x8b1d1c);}});}function validate(){if(process[_0x7040('0x77')]&&process['argv'][_0x7040('0x60')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x9030e3=path[_0x7040('0x13')](config[_0x7040('0x4c')],_0x7040('0x78'),process[_0x7040('0x77')][0x2]);if(!fs[_0x7040('0x79')](_0x9030e3)){throw new Error(_0x7040('0x7a'));}var _0x17ec8b={};try{_0x17ec8b=JSON[_0x7040('0x4f')](process[_0x7040('0x77')][0x3]);if(!_0x17ec8b[_0x7040('0x4a')]){throw new Error(_0x7040('0x7b'));}if(!_0x17ec8b[_0x7040('0x4a')][_0x7040('0x11')]){throw new Error(_0x7040('0x7c'));}if(!_0x17ec8b[_0x7040('0x4a')][_0x7040('0x5e')]){throw new Error(_0x7040('0x7d'));}var _0x5c298e=0x0;if(_0x17ec8b[_0x7040('0x4a')]['UserId']){_0x5c298e=0x1;}if(!_0x17ec8b[_0x7040('0x32')]){throw new Error(_0x7040('0x7e'));}}catch(_0x3c6e0c){throw new Error(_0x7040('0x7f'));}var _0x51a542=[];try{_0x51a542=_['map'](JSON[_0x7040('0x4f')](process[_0x7040('0x77')][0x4]),'id');}catch(_0x414034){logger[_0x7040('0x3c')](_0x7040('0x80'));}main(_0x9030e3,_0x17ec8b,_0x51a542,_0x5c298e);}validate();process['on'](_0x7040('0x81'),handleStop);process['on'](_0x7040('0x82'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index c83367f..db08128 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 _0xd5a7=['unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','phone','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.createdAt','insert','fromQuery','updatedAt','cm_contacts','.CmListId','field','cm_hopper_black','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','message','exit','errors','code','spread','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','name','writeFileSync','parse','data','find','trim','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','each','contact','contactId','contactTypeId','DROP\x20TABLE\x20','finish'];(function(_0x2e9ac6,_0x3533bb){var _0x4de1ad=function(_0x296370){while(--_0x296370){_0x2e9ac6['push'](_0x2e9ac6['shift']());}};_0x4de1ad(++_0x3533bb);}(_0xd5a7,0x13a));var _0x7d5a=function(_0xc0997a,_0x208380){_0xc0997a=_0xc0997a-0x0;var _0xb9770d=_0xd5a7[_0xc0997a];return _0xb9770d;};'use strict';var fs=require('fs');var path=require(_0x7d5a('0x0'));var _=require(_0x7d5a('0x1'));var Papa=require(_0x7d5a('0x2'));var util=require(_0x7d5a('0x3'));var BPromise=require(_0x7d5a('0x4'));var moment=require(_0x7d5a('0x5'));var squel=require(_0x7d5a('0x6'));var Redis=require(_0x7d5a('0x7'));var db=require(_0x7d5a('0x8'))['db'];var config=require(_0x7d5a('0x9'));var logger=require('../../../config/logger')('import');config[_0x7d5a('0xa')]=_[_0x7d5a('0xb')](config[_0x7d5a('0xa')],{'host':_0x7d5a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d5a('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x7d5a('0xd')+moment()[_0x7d5a('0xe')](_0x7d5a('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x21d1c9){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))*$/[_0x7d5a('0x10')](_0x21d1c9);}function selectNotIn(_0x2706e0,_0xa99fe9,_0x404c01,_0x174bf3,_0x9d1d51){return squel[_0x7d5a('0x11')]()['field'](_0x7d5a('0x12'))[_0x7d5a('0x13')](_0x174bf3)['join'](_0xa99fe9,null,_0xa99fe9+_0x7d5a('0x14')+_0x174bf3+'.'+_0x404c01)['where'](_0x174bf3+'.'+_0x404c01+_0x7d5a('0x15')+_0x2706e0+'.'+_0x404c01)[_0x7d5a('0x16')](_0xa99fe9+_0x7d5a('0x17')+_0x9d1d51[_0x7d5a('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x328fe7,_0x45f45f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7d5a('0x19')][_0x7d5a('0x1a')](_0x7d5a('0x1b')+tempTableName)['spread'](function(_0x10dc38){if(_0x10dc38!==null){var _0x16a6d8=[];for(var _0x31d36c=0x0;_0x31d36c<_0x10dc38[_0x7d5a('0x1c')];_0x31d36c++){var _0x983929=_0x10dc38[_0x31d36c];if(!_[_0x7d5a('0x1d')](_0x983929[_0x7d5a('0x12')])){if(!_[_0x7d5a('0x1d')](_0x983929[_0x7d5a('0x1e')]))_0x16a6d8['push'](insertAdditionalPhones(_0x983929));promisesContact[_0x7d5a('0x1f')]({'contact':_0x983929});}}}Promise[_0x7d5a('0x20')](_0x16a6d8)[_0x7d5a('0x21')](function(){_0x328fe7({'val':0x1});});})[_0x7d5a('0x22')](function(_0x56aead){logger[_0x7d5a('0x23')](_0x56aead['message']);});});}function insertAdditionalPhones(_0x4bba2b){return new Promise(function(_0x515a3c,_0x4e350d){var _0x5f1ed3=_0x4bba2b[_0x7d5a('0x1e')];if(_[_0x7d5a('0x1d')](_0x5f1ed3))_0x4e350d({'val':0x0});else{var _0x521a7b=_0x5f1ed3[_0x7d5a('0x24')](';');var _0x1dfbd7=[];orderBy=0x0;for(var _0x1a20fa=0x0;_0x1a20fa<_0x521a7b[_0x7d5a('0x1c')];_0x1a20fa++){_0x1dfbd7['push'](splitAdditionalPhone(_0x4bba2b['id'],_0x521a7b[_0x1a20fa]));}Promise[_0x7d5a('0x20')](_0x1dfbd7)['then'](function(){_0x515a3c({'val':_0x521a7b[_0x7d5a('0x1c')]});});}});}function splitAdditionalPhone(_0x54e1b6,_0xe97454){return new Promise(function(_0x28613e,_0xcfd72d){var _0x4a77e6=_0xe97454[_0x7d5a('0x24')](':');var _0x192195=_0x4a77e6[0x0];var _0x12ec3a=_0x4a77e6[0x1];if(_0x12ec3a!==''){var _0x38c0c3=_0x12ec3a['split']('|');var _0x3e1345=[];for(var _0x199d6f=0x0;_0x199d6f<_0x38c0c3[_0x7d5a('0x1c')];_0x199d6f++){if(_0x38c0c3[_0x199d6f]!==''){var _0x32946a=_[_0x7d5a('0x25')](promisesAdditionalPhones,{'contactId':_0x54e1b6,'phone':_0x38c0c3[_0x199d6f]});if(_0x32946a[_0x7d5a('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x7d5a('0x1f')]({'contactId':_0x54e1b6,'contactTypeId':_0x192195,'phone':_0x38c0c3[_0x199d6f],'orderBy':orderBy});}}}_0x28613e({'ok':0x1});}else _0x28613e({'res':0x0});});}function createAdditionalPhone(_0x5e10ae,_0x249913,_0x9449c8,_0x10c9ff){return new Promise(function(_0x3c2133,_0x264e65){return db[_0x7d5a('0x26')]['findOne']({'where':{'CmContactId':_0x5e10ae,'item':_0x9449c8}})[_0x7d5a('0x21')](function(_0x3bad0f){if(_0x3bad0f){return db[_0x7d5a('0x26')][_0x7d5a('0x27')]({'ItemTypeId':_0x249913,'OrderBy':_0x10c9ff},{'where':{'CmContactId':_0x5e10ae,'item':_0x9449c8}})[_0x7d5a('0x21')](function(_0x444ce3){_0x3c2133({'res':_0x7d5a('0x28')});});}else{return db['CmContactHasItem'][_0x7d5a('0x29')]({'CmContactId':_0x5e10ae,'item':_0x9449c8,'ItemTypeId':_0x249913,'OrderBy':_0x10c9ff,'ItemClass':_0x7d5a('0x2a')})[_0x7d5a('0x21')](function(_0x3d8d25){_0x3c2133({'res':_0x7d5a('0x2b')});});}});});}function updateContact(_0x19d82e){return new Promise(function(_0x23382e,_0x52550d){var _0x1c77c8=_0x19d82e['id'];delete _0x19d82e['id'];return db[_0x7d5a('0x2c')][_0x7d5a('0x27')](_0x19d82e,{'where':{'id':_0x1c77c8}})[_0x7d5a('0x21')](function(_0xede688){updatedRows+=0x1;return db[_0x7d5a('0x2d')][_0x7d5a('0x27')]({'phone':_0x19d82e['phone']},{'where':{'ContactId':_0x1c77c8}})[_0x7d5a('0x21')](function(_0x38b7c9){_0x23382e({'ret':'OK'});});});});}function insertCmHopper(_0x397826,_0xdcca51,_0x2560d1,_0x177a56,_0x1e471a){var _0x51af78=[_0x7d5a('0x2e'),_0x7d5a('0x2f'),_0x7d5a('0x30'),_0x7d5a('0x31'),_0xdcca51+'.'+_0x177a56,'cm_contacts.createdAt',_0x7d5a('0x32'),_0x7d5a('0x33'),'cm_contacts.UserId','\x22'+_0x1e471a+'\x22'];return squel['insert']()[_0x7d5a('0x34')](_0x7d5a('0x35'))['fromQuery']([_0x7d5a('0x12'),'scheduledat',_0x7d5a('0x36'),_0x7d5a('0x37'),_0x177a56,_0x7d5a('0x38'),'updatedAt',_0x7d5a('0x39'),_0x7d5a('0x3a'),_0x7d5a('0x3b')],squel[_0x7d5a('0x11')]()[_0x7d5a('0x3c')](_0x51af78)[_0x7d5a('0x13')](_0xdcca51)[_0x7d5a('0x18')]('cm_contacts',null,_0x7d5a('0x3d')+_0xdcca51+'.CmListId')[_0x7d5a('0x18')](_0x2560d1,null,_0x2560d1+'.id\x20=\x20'+_0xdcca51+'.'+_0x177a56)[_0x7d5a('0x16')](_0xdcca51+_0x7d5a('0x3e'),_0x397826)[_0x7d5a('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xdcca51,_0x2560d1,_0x177a56,_0x7d5a('0x35'),[_0x7d5a('0x3f'),_0x7d5a('0x40')]))[_0x7d5a('0x16')](_0x7d5a('0x41'),selectNotIn(_0xdcca51,_0x2560d1,_0x177a56,_0x7d5a('0x35'),[_0x7d5a('0x3f')])))[_0x7d5a('0x42')]();}function insertCmHopperBlack(_0x590045,_0x1edf20,_0x23a294,_0x591be2){var _0x191809=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x1edf20+'.'+_0x591be2,_0x7d5a('0x43'),'cm_contacts.updatedAt'];return squel[_0x7d5a('0x44')]()[_0x7d5a('0x34')]('cm_hopper_black')[_0x7d5a('0x45')]([_0x7d5a('0x12'),_0x7d5a('0x36'),'ListId',_0x591be2,_0x7d5a('0x38'),_0x7d5a('0x46')],squel[_0x7d5a('0x11')]()[_0x7d5a('0x3c')](_0x191809)[_0x7d5a('0x13')](_0x1edf20)[_0x7d5a('0x18')](_0x7d5a('0x47'),null,_0x7d5a('0x3d')+_0x1edf20+_0x7d5a('0x48'))['join'](_0x23a294,null,_0x23a294+'.id\x20=\x20'+_0x1edf20+'.'+_0x591be2)[_0x7d5a('0x16')](_0x1edf20+_0x7d5a('0x3e'),_0x590045)[_0x7d5a('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7d5a('0x16')](_0x7d5a('0x41'),squel[_0x7d5a('0x11')]()[_0x7d5a('0x49')](_0x7d5a('0x12'))[_0x7d5a('0x13')](_0x7d5a('0x4a'))[_0x7d5a('0x16')](_0x7d5a('0x4b'),_0x590045)[_0x7d5a('0x16')](_0x591be2+'\x20=\x20?',_0x1edf20+'.'+_0x591be2)))[_0x7d5a('0x42')]();}function insertCmHopperAdditionalPhones(_0x5b7dd8){var _0x5584f8=['cm_hopper.id',_0x7d5a('0x4c'),_0x7d5a('0x4d'),_0x7d5a('0x4e'),'cm_contact_has_items.updatedAt'];return squel[_0x7d5a('0x44')]()[_0x7d5a('0x34')](_0x7d5a('0x4f'))['fromQuery'](['CmHopperId',_0x7d5a('0x12'),_0x7d5a('0x50'),_0x7d5a('0x38'),_0x7d5a('0x46')],squel[_0x7d5a('0x11')]()[_0x7d5a('0x3c')](_0x5584f8)[_0x7d5a('0x13')](_0x7d5a('0x35'))[_0x7d5a('0x18')](_0x7d5a('0x47'),null,_0x7d5a('0x51'))[_0x7d5a('0x18')]('cm_contact_has_items',null,_0x7d5a('0x52'))[_0x7d5a('0x16')](_0x7d5a('0x53'),_0x5b7dd8)[_0x7d5a('0x16')](_0x7d5a('0x54'),NOW))[_0x7d5a('0x42')]();}function insertCmContact(_0x42f6a2,_0x2527d8,_0x59e4fb,_0x43ca5b){var _0x5510d4=_['concat'](_[_0x7d5a('0x55')](_0x43ca5b),[_0x7d5a('0x37'),_0x7d5a('0x56'),_0x7d5a('0x38'),'updatedAt']);return squel[_0x7d5a('0x44')]()['into'](_0x7d5a('0x47'))[_0x7d5a('0x45')](_0x5510d4,squel['select']()['fields'](_0x5510d4)[_0x7d5a('0x13')](_0x2527d8)[_0x7d5a('0x16')]('('+_0x59e4fb[_0x7d5a('0x18')](',')+_0x7d5a('0x57'),squel['select']()[_0x7d5a('0x3c')](_0x59e4fb)[_0x7d5a('0x13')](_0x7d5a('0x47'))[_0x7d5a('0x16')](_0x7d5a('0x4b'),_0x42f6a2))[_0x7d5a('0x16')](_0x7d5a('0x58'),squel[_0x7d5a('0x11')]()['field'](_0x7d5a('0x59'),'min_id')[_0x7d5a('0x13')](_0x2527d8)[_0x7d5a('0x5a')](_0x59e4fb['join'](','))))['toString']();}function handleStop(){logger[_0x7d5a('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x27f509){logger[_0x7d5a('0x23')](_0x27f509[_0x7d5a('0x5c')]);process[_0x7d5a('0x5d')](0x1);}function handleError(_0x5d52b0,_0x2e2953){stats[_0x7d5a('0x5e')][_0x7d5a('0x1f')]({'name':_0x2e2953[_0x7d5a('0x5f')],'message':_0x2e2953[_0x7d5a('0x5c')],'row':_0x5d52b0});}function handleQuery(_0x303255){logger[_0x7d5a('0x5b')](_0x303255);return db[_0x7d5a('0x19')][_0x7d5a('0x1a')](_0x303255)[_0x7d5a('0x60')](function(_0x13d767){results[_0x7d5a('0x1f')](_0x13d767);})[_0x7d5a('0x22')](function(_0xc305a3){logger[_0x7d5a('0x23')](_0xc305a3[_0x7d5a('0x5c')]);});}function main(_0x3708e4,_0x272623,_0xb564f2,_0x446002){logger[_0x7d5a('0x5b')]('main',_0x3708e4,JSON[_0x7d5a('0x61')](_0x272623));process[_0x7d5a('0x62')](_0x7d5a('0x63'));var _0x53f112=_0x272623[_0x7d5a('0x64')];var _0x297d99=_['clone'](_0x53f112);var _0x592e00=_0x272623[_0x7d5a('0x65')];var _0xb0e1bb=path['join'](config['root'],_0x7d5a('0x66'),_0x592e00+_0x7d5a('0x67'));logger[_0x7d5a('0x5b')](_0x7d5a('0x68'),_0x272623);db[_0x7d5a('0x69')]['findAll']({'raw':!![],'attributes':['id',_0x7d5a('0x6a')]})['then'](function(_0x1deeb3){for(var _0x5a0bba=0x0;_0x5a0bba<_0x1deeb3['length'];_0x5a0bba++){if(_0x1deeb3[_0x5a0bba][_0x7d5a('0x6a')]in _0x53f112){contactItemTypes['push'](_0x1deeb3[_0x5a0bba]);delete _0x297d99[_0x1deeb3[_0x5a0bba][_0x7d5a('0x6a')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x297d99['AdditionalPhones']='';var _0x221578=_[_0x7d5a('0x55')](_0x297d99)[_0x7d5a('0x18')]();logger[_0x7d5a('0x5b')]('header',_0x221578);fs[_0x7d5a('0x6b')](_0xb0e1bb,_0x221578+'\x0a');Papa[_0x7d5a('0x6c')](fs['createReadStream'](_0x3708e4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x9378a5,_0x17f1c7){try{for(var _0x47f5f8=0x0,_0x19173a=[];_0x47f5f8<_0x9378a5[_0x7d5a('0x6d')][_0x7d5a('0x1c')];_0x47f5f8++){stats['rows']+=0x1;if(_0x9378a5['errors'][_0x47f5f8]){handleError(_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8],_0x9378a5[_0x7d5a('0x5e')][_0x47f5f8]);}else{var _0x207f3d=[];var _0x187108=[];for(var _0x291432 in _0x53f112){let _0x421949=contactItemTypes[_0x7d5a('0x6e')](_0x2b5cac=>_0x2b5cac[_0x7d5a('0x6a')]===_0x291432);if(_[_0x7d5a('0x1d')](_0x421949)){if(_0x53f112['hasOwnProperty'](_0x291432)){if(_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8][_0x53f112[_0x291432]]){var _0x4ba7b8=_[_0x7d5a('0x6f')](_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8][_0x53f112[_0x291432]]['replace'](/"/g,'\x27'));switch(_0x291432){case _0x7d5a('0x70'):var _0x33c916=moment(_0x4ba7b8,_0x7d5a('0x71'),!![]);if(_0x33c916[_0x7d5a('0x72')]()){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x4ba7b8+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7d5a('0x39'):var _0x135fc2=parseInt(_0x4ba7b8);_0x4ba7b8=_[_0x7d5a('0x73')](_0x135fc2)||_0x135fc2<0x0||_0x135fc2>0x4?_0x446002?0x3:0x2:_0x135fc2;_0x19173a['push']('\x22'+_0x4ba7b8+'\x22');break;case _0x7d5a('0x3a'):var _0x1c7964=parseInt(_0x4ba7b8);if(_[_0x7d5a('0x74')](_0x1c7964)&&_['includes'](_0xb564f2,_0x1c7964)){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x1c7964+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')](_0x7d5a('0x75'));}break;case _0x7d5a('0x76'):if(isEmail(_0x4ba7b8)){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x4ba7b8+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')](_0x7d5a('0x77'));}break;case _0x7d5a('0x78'):var _0x3bd9ea=moment(_0x4ba7b8,_0x7d5a('0x79'),!![]);if(_0x3bd9ea[_0x7d5a('0x72')]()){_0x19173a['push']('\x22'+_0x4ba7b8+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')](_0x7d5a('0x7a'));}break;default:_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x4ba7b8+'\x22');}}else{switch(_0x291432){case _0x7d5a('0x7b'):case _0x7d5a('0x12'):_0x207f3d[_0x7d5a('0x1f')](_0x291432+_0x7d5a('0x7c'));break;default:_0x19173a[_0x7d5a('0x1f')]('\x22\x22');}}}}else{var _0x51a9ae='';for(var _0x7d5c0b=0x0;_0x7d5c0b<_0x53f112[_0x291432][_0x7d5a('0x1c')];_0x7d5c0b++){var _0x4ba7b8=_[_0x7d5a('0x6f')](_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8][_0x53f112[_0x291432][_0x7d5c0b]]['replace'](/"/g,'\x27'));if(_0x51a9ae=='')_0x51a9ae=_0x4ba7b8;else _0x51a9ae+='|'+_0x4ba7b8;}_0x187108[_0x7d5a('0x1f')](_0x421949['id']+':'+_0x51a9ae);}}if(hasAdditionalPhones){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x187108[_0x7d5a('0x18')](';')+'\x22');}if(_0x207f3d[_0x7d5a('0x1c')]){handleError(_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8],{'code':_0x7d5a('0x7d'),'message':_0x207f3d['join']()});}else{fs[_0x7d5a('0x7e')](_0xb0e1bb,_0x19173a[_0x7d5a('0x18')]()+'\x0a');}_0x19173a=[];}if(!(stats['rows']%0xc8)){socket[_0x7d5a('0x7f')](_0x7d5a('0x80')+_0x592e00,stats);stats['errors']=[];}}if(stopped){logger[_0x7d5a('0x5b')](_0x7d5a('0x81'));_0x17f1c7['abort']();}}catch(_0x374200){handleError(_0x9378a5['data'][_0x47f5f8],{'code':_0x7d5a('0x82'),'message':_0x374200[_0x7d5a('0x5c')]});logger[_0x7d5a('0x23')]('step',_0x374200[_0x7d5a('0x5c')]);}},'complete':function(){try{var _0x18564b=[];var _0x12b9ce=tempTableName;_0x18564b[_0x7d5a('0x1f')](_0x7d5a('0x83')+_0x12b9ce+_0x7d5a('0x84'));logger['info']('CIS\x20len',contactItemTypes[_0x7d5a('0x1c')]);var _0x394636=util[_0x7d5a('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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0xb0e1bb,_0x12b9ce,_0x221578,_0x272623['ListId'],_0x272623[_0x7d5a('0x56')]||null,NOW,NOW);if(_[_0x7d5a('0x1d')](_0x53f112[_0x7d5a('0x70')])){_0x394636+=',\x20scheduledAt\x20=\x20NOW()';}_0x18564b['push'](_0x394636);BPromise[_0x7d5a('0x85')](_0x18564b,handleQuery)[_0x7d5a('0x21')](function(_0x4cf183){BPromise[_0x7d5a('0x20')]([handleAdditionalPhones()])[_0x7d5a('0x21')](function(){_0x18564b=[];for(var _0x3f02a7=0x0;_0x3f02a7\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','argv','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException'];(function(_0x59b99f,_0x2d1bf1){var _0x12c6b1=function(_0x2f68bc){while(--_0x2f68bc){_0x59b99f['push'](_0x59b99f['shift']());}};_0x12c6b1(++_0x2d1bf1);}(_0x9601,0x1e0));var _0x1960=function(_0x4cb358,_0xab63ff){_0x4cb358=_0x4cb358-0x0;var _0x14cc1f=_0x9601[_0x4cb358];return _0x14cc1f;};'use strict';var fs=require('fs');var path=require(_0x1960('0x0'));var _=require(_0x1960('0x1'));var Papa=require(_0x1960('0x2'));var util=require('util');var BPromise=require(_0x1960('0x3'));var moment=require('moment');var squel=require(_0x1960('0x4'));var Redis=require(_0x1960('0x5'));var db=require(_0x1960('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x1960('0x7'))(_0x1960('0x8'));config[_0x1960('0x9')]=_[_0x1960('0xa')](config['redis'],{'host':_0x1960('0xb'),'port':0x18eb});var socket=require(_0x1960('0xc'))(new Redis(config[_0x1960('0x9')]));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()[_0x1960('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x1960('0xe')+moment()[_0x1960('0xd')](_0x1960('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x3b9bfd){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))*$/[_0x1960('0x10')](_0x3b9bfd);}function selectNotIn(_0x1f8cb8,_0x21a1e7,_0x396829,_0x47dce9,_0x44ca5f){return squel['select']()[_0x1960('0x11')](_0x1960('0x12'))[_0x1960('0x13')](_0x47dce9)['join'](_0x21a1e7,null,_0x21a1e7+_0x1960('0x14')+_0x47dce9+'.'+_0x396829)['where'](_0x47dce9+'.'+_0x396829+_0x1960('0x15')+_0x1f8cb8+'.'+_0x396829)[_0x1960('0x16')](_0x21a1e7+_0x1960('0x17')+_0x44ca5f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x36211c,_0x4ed355){promisesAdditionalPhones=[];promisesContact=[];return db[_0x1960('0x18')]['query'](_0x1960('0x19')+tempTableName)[_0x1960('0x1a')](function(_0x398605){if(_0x398605!==null){var _0xfe0d06=[];for(var _0x3088cf=0x0;_0x3088cf<_0x398605['length'];_0x3088cf++){var _0x327293=_0x398605[_0x3088cf];if(!_[_0x1960('0x1b')](_0x327293[_0x1960('0x12')])){if(!_[_0x1960('0x1b')](_0x327293[_0x1960('0x1c')]))_0xfe0d06[_0x1960('0x1d')](insertAdditionalPhones(_0x327293));promisesContact[_0x1960('0x1d')]({'contact':_0x327293});}}}Promise['all'](_0xfe0d06)[_0x1960('0x1e')](function(){_0x36211c({'val':0x1});});})[_0x1960('0x1f')](function(_0x8aa56e){logger[_0x1960('0x20')](_0x8aa56e['message']);});});}function insertAdditionalPhones(_0x31afe3){return new Promise(function(_0x11e5b5,_0x526bd5){var _0x281a70=_0x31afe3[_0x1960('0x1c')];if(_[_0x1960('0x1b')](_0x281a70))_0x526bd5({'val':0x0});else{var _0xfcbe89=_0x281a70[_0x1960('0x21')](';');var _0x280b9a=[];orderBy=0x0;for(var _0x3a3bb7=0x0;_0x3a3bb7<_0xfcbe89[_0x1960('0x22')];_0x3a3bb7++){_0x280b9a[_0x1960('0x1d')](splitAdditionalPhone(_0x31afe3['id'],_0xfcbe89[_0x3a3bb7]));}Promise['all'](_0x280b9a)[_0x1960('0x1e')](function(){_0x11e5b5({'val':_0xfcbe89[_0x1960('0x22')]});});}});}function splitAdditionalPhone(_0x7d9d6,_0x128a7c){return new Promise(function(_0x2c33a5,_0x3deb31){var _0x5b62c0=_0x128a7c[_0x1960('0x21')](':');var _0x4ef27a=_0x5b62c0[0x0];var _0x316e6c=_0x5b62c0[0x1];if(_0x316e6c!==''){var _0x360d0d=_0x316e6c[_0x1960('0x21')]('|');var _0x1f1a0b=[];for(var _0x1814f0=0x0;_0x1814f0<_0x360d0d[_0x1960('0x22')];_0x1814f0++){if(_0x360d0d[_0x1814f0]!==''){var _0xee2794=_[_0x1960('0x23')](promisesAdditionalPhones,{'contactId':_0x7d9d6,'phone':_0x360d0d[_0x1814f0]});if(_0xee2794[_0x1960('0x22')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x7d9d6,'contactTypeId':_0x4ef27a,'phone':_0x360d0d[_0x1814f0],'orderBy':orderBy});}}}_0x2c33a5({'ok':0x1});}else _0x2c33a5({'res':0x0});});}function createAdditionalPhone(_0x51f345,_0x4a20ff,_0x51e8d3,_0x307850){return new Promise(function(_0xd8b4a8,_0x4d7ade){return db[_0x1960('0x24')]['findOne']({'where':{'CmContactId':_0x51f345,'item':_0x51e8d3}})[_0x1960('0x1e')](function(_0x306c43){if(_0x306c43){return db[_0x1960('0x24')]['update']({'ItemTypeId':_0x4a20ff,'OrderBy':_0x307850},{'where':{'CmContactId':_0x51f345,'item':_0x51e8d3}})['then'](function(_0x579c03){_0xd8b4a8({'res':_0x1960('0x25')});});}else{return db[_0x1960('0x24')][_0x1960('0x26')]({'CmContactId':_0x51f345,'item':_0x51e8d3,'ItemTypeId':_0x4a20ff,'OrderBy':_0x307850,'ItemClass':_0x1960('0x27')})[_0x1960('0x1e')](function(_0x5576ae){_0xd8b4a8({'res':'inserted'});});}});});}function updateContact(_0x13daf4){return new Promise(function(_0x43de84,_0x199722){var _0x5f492c=_0x13daf4['id'];delete _0x13daf4['id'];return db[_0x1960('0x28')]['update'](_0x13daf4,{'where':{'id':_0x5f492c}})[_0x1960('0x1e')](function(_0x1d4200){updatedRows+=0x1;return db[_0x1960('0x29')][_0x1960('0x2a')]({'phone':_0x13daf4[_0x1960('0x12')]},{'where':{'ContactId':_0x5f492c}})['then'](function(_0x1614ea){_0x43de84({'ret':'OK'});});});});}function insertCmHopper(_0x1dd2f0,_0x263b71,_0x269db1,_0xfac4be,_0x2d7152){var _0x3d5c24=['cm_contacts.phone',_0x1960('0x2b'),_0x1960('0x2c'),'cm_contacts.ListId',_0x263b71+'.'+_0xfac4be,_0x1960('0x2d'),_0x1960('0x2e'),_0x1960('0x2f'),_0x1960('0x30'),'\x22'+_0x2d7152+'\x22'];return squel[_0x1960('0x31')]()[_0x1960('0x32')]('cm_hopper')[_0x1960('0x33')]([_0x1960('0x12'),_0x1960('0x34'),_0x1960('0x35'),_0x1960('0x36'),_0xfac4be,_0x1960('0x37'),_0x1960('0x38'),_0x1960('0x39'),_0x1960('0x3a'),_0x1960('0x3b')],squel[_0x1960('0x3c')]()[_0x1960('0x3d')](_0x3d5c24)[_0x1960('0x13')](_0x263b71)[_0x1960('0x3e')](_0x1960('0x3f'),null,_0x1960('0x40')+_0x263b71+_0x1960('0x41'))['join'](_0x269db1,null,_0x269db1+_0x1960('0x14')+_0x263b71+'.'+_0xfac4be)[_0x1960('0x16')](_0x263b71+_0x1960('0x42'),_0x1dd2f0)[_0x1960('0x16')](_0x1960('0x43'),NOW)[_0x1960('0x16')](_0x1960('0x44'),selectNotIn(_0x263b71,_0x269db1,_0xfac4be,_0x1960('0x45'),[_0x1960('0x46'),'\x22onlyIfOpen\x22']))[_0x1960('0x16')](_0x1960('0x44'),selectNotIn(_0x263b71,_0x269db1,_0xfac4be,_0x1960('0x45'),[_0x1960('0x46')])))[_0x1960('0x47')]();}function insertCmHopperBlack(_0x21cce0,_0x99aa26,_0x19e271,_0x4a8b4f){var _0xd8c845=[_0x1960('0x48'),_0x1960('0x2c'),_0x1960('0x49'),_0x99aa26+'.'+_0x4a8b4f,_0x1960('0x2d'),_0x1960('0x2e')];return squel[_0x1960('0x31')]()[_0x1960('0x32')]('cm_hopper_black')[_0x1960('0x33')]([_0x1960('0x12'),'ContactId',_0x1960('0x36'),_0x4a8b4f,'createdAt','updatedAt'],squel[_0x1960('0x3c')]()['fields'](_0xd8c845)[_0x1960('0x13')](_0x99aa26)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x99aa26+'.CmListId')[_0x1960('0x3e')](_0x19e271,null,_0x19e271+_0x1960('0x14')+_0x99aa26+'.'+_0x4a8b4f)['where'](_0x99aa26+'.CmListId\x20=\x20?',_0x21cce0)[_0x1960('0x16')](_0x1960('0x43'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x1960('0x12'))['from']('cm_hopper_black')[_0x1960('0x16')](_0x1960('0x4a'),_0x21cce0)['where'](_0x4a8b4f+_0x1960('0x4b'),_0x99aa26+'.'+_0x4a8b4f)))['toString']();}function insertCmHopperAdditionalPhones(_0x43f1e6){var _0x3a791a=[_0x1960('0x4c'),_0x1960('0x4d'),_0x1960('0x4e'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x1960('0x31')]()[_0x1960('0x32')](_0x1960('0x4f'))[_0x1960('0x33')]([_0x1960('0x50'),'phone',_0x1960('0x51'),'createdAt','updatedAt'],squel[_0x1960('0x3c')]()[_0x1960('0x3d')](_0x3a791a)['from'](_0x1960('0x45'))[_0x1960('0x3e')](_0x1960('0x3f'),null,_0x1960('0x52'))[_0x1960('0x3e')](_0x1960('0x53'),null,_0x1960('0x54'))[_0x1960('0x16')](_0x1960('0x55'),_0x43f1e6)['where'](_0x1960('0x43'),NOW))['toString']();}function insertCmContact(_0x1c23b2,_0x487c49,_0x3808d1,_0x14334a){var _0x203608=_[_0x1960('0x56')](_[_0x1960('0x57')](_0x14334a),[_0x1960('0x36'),_0x1960('0x58'),'createdAt',_0x1960('0x38')]);return squel['insert']()[_0x1960('0x32')]('cm_contacts')[_0x1960('0x33')](_0x203608,squel[_0x1960('0x3c')]()[_0x1960('0x3d')](_0x203608)[_0x1960('0x13')](_0x487c49)[_0x1960('0x16')]('('+_0x3808d1[_0x1960('0x3e')](',')+')\x20NOT\x20IN\x20?',squel[_0x1960('0x3c')]()[_0x1960('0x3d')](_0x3808d1)['from'](_0x1960('0x3f'))[_0x1960('0x16')](_0x1960('0x4a'),_0x1c23b2))[_0x1960('0x16')](_0x1960('0x59'),squel[_0x1960('0x3c')]()[_0x1960('0x11')](_0x1960('0x5a'),_0x1960('0x5b'))['from'](_0x487c49)[_0x1960('0x5c')](_0x3808d1[_0x1960('0x3e')](','))))[_0x1960('0x47')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5786f0){logger[_0x1960('0x20')](_0x5786f0['message']);process[_0x1960('0x5d')](0x1);}function handleError(_0x5bd629,_0x2561cc){stats[_0x1960('0x5e')][_0x1960('0x1d')]({'name':_0x2561cc['code'],'message':_0x2561cc['message'],'row':_0x5bd629});}function handleQuery(_0x576819){logger[_0x1960('0x5f')](_0x576819);return db[_0x1960('0x18')][_0x1960('0x60')](_0x576819)[_0x1960('0x1a')](function(_0x51aedd){results['push'](_0x51aedd);})['catch'](function(_0x2dc7d8){logger['error'](_0x2dc7d8[_0x1960('0x61')]);});}function main(_0x31911e,_0x5af0ac,_0x557d99,_0x5c52bb){logger['info'](_0x1960('0x62'),_0x31911e,JSON[_0x1960('0x63')](_0x5af0ac));process[_0x1960('0x64')]('start');var _0x252ee1=_0x5af0ac['binding'];var _0x3a5dd3=_[_0x1960('0x65')](_0x252ee1);var _0x5dd710=_0x5af0ac['socket_timestamp'];var _0x5855a4=path[_0x1960('0x3e')](config[_0x1960('0x66')],'server/files/tmp',_0x5dd710+_0x1960('0x67'));logger[_0x1960('0x5f')](_0x1960('0x68'),_0x5af0ac);db[_0x1960('0x69')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x1960('0x1e')](function(_0x15700e){for(var _0x4ffdb3=0x0;_0x4ffdb3<_0x15700e[_0x1960('0x22')];_0x4ffdb3++){if(_0x15700e[_0x4ffdb3][_0x1960('0x6a')]in _0x252ee1){contactItemTypes[_0x1960('0x1d')](_0x15700e[_0x4ffdb3]);delete _0x3a5dd3[_0x15700e[_0x4ffdb3]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x3a5dd3[_0x1960('0x1c')]='';var _0x28f707=_[_0x1960('0x57')](_0x3a5dd3)[_0x1960('0x3e')]();logger[_0x1960('0x5f')](_0x1960('0x6b'),_0x28f707);fs[_0x1960('0x6c')](_0x5855a4,_0x28f707+'\x0a');Papa['parse'](fs[_0x1960('0x6d')](_0x31911e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c537d,_0x139492){try{for(var _0x18ee21=0x0,_0x2fc72b=[];_0x18ee21<_0x5c537d['data'][_0x1960('0x22')];_0x18ee21++){stats['rows']+=0x1;if(_0x5c537d['errors'][_0x18ee21]){handleError(_0x5c537d[_0x1960('0x6e')][_0x18ee21],_0x5c537d['errors'][_0x18ee21]);}else{var _0x29f5bf=[];var _0x4e90db=[];for(var _0x58978d in _0x252ee1){let _0x2c8360=contactItemTypes[_0x1960('0x6f')](_0x4b4724=>_0x4b4724['name']===_0x58978d);if(_[_0x1960('0x1b')](_0x2c8360)){if(_0x252ee1[_0x1960('0x70')](_0x58978d)){if(_0x5c537d[_0x1960('0x6e')][_0x18ee21][_0x252ee1[_0x58978d]]){var _0x665612=_[_0x1960('0x71')](_0x5c537d[_0x1960('0x6e')][_0x18ee21][_0x252ee1[_0x58978d]]['replace'](/"/g,'\x27'));switch(_0x58978d){case _0x1960('0x34'):var _0x36465e=moment(_0x665612,_0x1960('0x72'),!![]);if(_0x36465e['isValid']()){_0x2fc72b[_0x1960('0x1d')]('\x22'+_0x665612+'\x22');}else{_0x29f5bf[_0x1960('0x1d')](_0x1960('0x73'));}break;case _0x1960('0x39'):var _0x27808f=parseInt(_0x665612);_0x665612=_[_0x1960('0x74')](_0x27808f)||_0x27808f<0x0||_0x27808f>0x4?_0x5c52bb?0x3:0x2:_0x27808f;_0x2fc72b[_0x1960('0x1d')]('\x22'+_0x665612+'\x22');break;case _0x1960('0x3a'):var _0x12518b=parseInt(_0x665612);if(_[_0x1960('0x75')](_0x12518b)&&_[_0x1960('0x76')](_0x557d99,_0x12518b)){_0x2fc72b[_0x1960('0x1d')]('\x22'+_0x12518b+'\x22');}else{_0x29f5bf[_0x1960('0x1d')](_0x1960('0x77'));}break;case _0x1960('0x78'):if(isEmail(_0x665612)){_0x2fc72b[_0x1960('0x1d')]('\x22'+_0x665612+'\x22');}else{_0x29f5bf['push'](_0x1960('0x79'));}break;case'dateOfBirth':var _0x1a159a=moment(_0x665612,'YYYY-MM-DD',!![]);if(_0x1a159a[_0x1960('0x7a')]()){_0x2fc72b[_0x1960('0x1d')]('\x22'+_0x665612+'\x22');}else{_0x29f5bf[_0x1960('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2fc72b[_0x1960('0x1d')]('\x22'+_0x665612+'\x22');}}else{switch(_0x58978d){case _0x1960('0x7b'):case _0x1960('0x12'):_0x29f5bf['push'](_0x58978d+_0x1960('0x7c'));break;default:_0x2fc72b[_0x1960('0x1d')]('\x22\x22');}}}}else{var _0x564907='';for(var _0x240cd4=0x0;_0x240cd4<_0x252ee1[_0x58978d][_0x1960('0x22')];_0x240cd4++){var _0x665612=_[_0x1960('0x71')](_0x5c537d[_0x1960('0x6e')][_0x18ee21][_0x252ee1[_0x58978d][_0x240cd4]][_0x1960('0x7d')](/"/g,'\x27'));if(_0x564907=='')_0x564907=_0x665612;else _0x564907+='|'+_0x665612;}_0x4e90db[_0x1960('0x1d')](_0x2c8360['id']+':'+_0x564907);}}if(hasAdditionalPhones){_0x2fc72b[_0x1960('0x1d')]('\x22'+_0x4e90db[_0x1960('0x3e')](';')+'\x22');}if(_0x29f5bf['length']){handleError(_0x5c537d[_0x1960('0x6e')][_0x18ee21],{'code':_0x1960('0x7e'),'message':_0x29f5bf[_0x1960('0x3e')]()});}else{fs['appendFileSync'](_0x5855a4,_0x2fc72b['join']()+'\x0a');}_0x2fc72b=[];}if(!(stats[_0x1960('0x7f')]%0xc8)){socket['emit'](_0x1960('0x80')+_0x5dd710,stats);stats['errors']=[];}}if(stopped){logger[_0x1960('0x5f')](_0x1960('0x81'));_0x139492[_0x1960('0x82')]();}}catch(_0x20e034){handleError(_0x5c537d[_0x1960('0x6e')][_0x18ee21],{'code':_0x1960('0x83'),'message':_0x20e034[_0x1960('0x61')]});logger[_0x1960('0x20')](_0x1960('0x84'),_0x20e034[_0x1960('0x61')]);}},'complete':function(){try{var _0xa416e7=[];var _0xc1816d=tempTableName;_0xa416e7['push'](_0x1960('0x85')+_0xc1816d+_0x1960('0x86'));logger['info'](_0x1960('0x87'),contactItemTypes[_0x1960('0x22')]);var _0x532ce4=util[_0x1960('0xd')](_0x1960('0x88'),_0x5855a4,_0xc1816d,_0x28f707,_0x5af0ac['ListId'],_0x5af0ac[_0x1960('0x58')]||null,NOW,NOW);if(_[_0x1960('0x1b')](_0x252ee1[_0x1960('0x34')])){_0x532ce4+=_0x1960('0x89');}_0xa416e7['push'](_0x532ce4);BPromise[_0x1960('0x8a')](_0xa416e7,handleQuery)[_0x1960('0x1e')](function(_0x402933){BPromise[_0x1960('0x8b')]([handleAdditionalPhones()])['then'](function(){_0xa416e7=[];for(var _0x2f2805=0x0;_0x2f2805=_0x140ec7){return _0x4869d7[_0xcd1a('0x13')](0x193)[_0xcd1a('0x14')]({'message':util[_0xcd1a('0x8')](_0xcd1a('0x15'),_0x3ed894)});}_0x5ebecb();})[_0xcd1a('0x16')](function(_0x438f62){_0x5ebecb(_0x438f62);});});}function isUserLimit(){return isLimit(_0xcd1a('0x17'),0x1,db[_0xcd1a('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0xcd1a('0x19')}]}});}exports[_0xcd1a('0x1a')]=isUserLimit; \ No newline at end of file +var _0x582a=['parse','hasOwnProperty','use','License','findOne','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','user','crypto','composable-middleware','../../mysqldb','../../config/environment','license','split','format','%s:%s:%s','update','final','utf8'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x582a,0x1ef));var _0xa582=function(_0x41f3c8,_0x5976b4){_0x41f3c8=_0x41f3c8-0x0;var _0x58d4f7=_0x582a[_0x41f3c8];return _0x58d4f7;};'use strict';var crypto=require(_0xa582('0x0'));var util=require('util');var compose=require(_0xa582('0x1'));var db=require(_0xa582('0x2'))['db'];var config=require(_0xa582('0x3'));function getValueFromLicense(_0x536c2f,_0x98af6d){if(_0x536c2f&&_0x98af6d){if(_0x98af6d['data1']&&_0x98af6d['license']){var _0x32964a=_0x98af6d['data1'];var _0x533b1f=_0x98af6d[_0xa582('0x4')];var _0x4227e8=_0x32964a[_0xa582('0x5')]('-')[0x4];var _0x3181e=_0x32964a[_0xa582('0x5')]('-')[0x0];var _0x53f2f7=crypto['createDecipher']('aes-256-ctr',util[_0xa582('0x6')](_0xa582('0x7'),_0x4227e8,_0x32964a,_0x3181e));var _0x144525=_0x53f2f7[_0xa582('0x8')](_0x533b1f,'base64','utf8');_0x144525+=_0x53f2f7[_0xa582('0x9')](_0xa582('0xa'));var _0x1099f2=JSON[_0xa582('0xb')](_0x144525);return _0x1099f2[_0xa582('0xc')](_0x536c2f)?_0x1099f2[_0x536c2f]:null;}}return null;}function isLimit(_0x5df4a1,_0x47cd56,_0xcc2113,_0x46a804){var _0x5d3136=_0x47cd56;return compose()[_0xa582('0xd')](function(_0x468fd3,_0x42bd47,_0x1602ef){return db[_0xa582('0xe')][_0xa582('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1ba338){var _0xc93c96=getValueFromLicense(_0x5df4a1,_0x1ba338);return _0xc93c96?_0xc93c96:_0x5d3136;})['then'](function(_0x3e3f01){_0x5d3136=_0x3e3f01;return _0xcc2113[_0xa582('0x10')](_0x46a804);})['then'](function(_0x2df7f9){if(_0x2df7f9>=_0x5d3136){return _0x42bd47[_0xa582('0x11')](0x193)[_0xa582('0x12')]({'message':util[_0xa582('0x6')](_0xa582('0x13'),_0x5df4a1)});}_0x1602ef();})['catch'](function(_0x47eaeb){_0x1602ef(_0x47eaeb);});});}function isUserLimit(){return isLimit(_0xa582('0x14'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xa582('0x15')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f62cb3b..b84d46a 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 _0x1ea9=['$in','IN\x20?','$notIn','NOT\x20IN\x20?','$substring','$startsWith','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','add','hours','lodash','moment','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','$gt','$lte','operator','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ea9,0x7a));var _0x91ea=function(_0x43a74f,_0x37376a){_0x43a74f=_0x43a74f-0x0;var _0xe84cb=_0x1ea9[_0x43a74f];return _0xe84cb;};'use strict';var _=require(_0x91ea('0x0'));var moment=require(_0x91ea('0x1'));exports['parseSearch']=function(_0x18a14d){var _0x5cd335={'conditions':[]};_0x5cd335[_0x91ea('0x2')]=_[_0x91ea('0x3')](_0x18a14d,_0x91ea('0x4'))?'or':_0x91ea('0x5');var _0x20a391=_0x18a14d['replace'](_0x91ea('0x6'),'')[_0x91ea('0x7')](_0x91ea('0x4'),'')[_0x91ea('0x8')]('||');for(var _0x34e194=0x0;_0x34e194<_0x20a391['length'];_0x34e194++){var _0x2c33e0=_0x20a391[_0x34e194][_0x91ea('0x8')](':=');var _0x2470c0=_0x2c33e0[0x0];var _0x1c16cc=_0x2c33e0[_0x91ea('0x9')](0x1);_0x1c16cc[_0x91ea('0xa')](function(_0x57b12f){var _0x18b3f6=_0x57b12f['split']('[')[_0x91ea('0xb')]();var _0x3363d8=_0x57b12f[_0x91ea('0xc')](/\[(.*?)\]/g);_0x3363d8[_0x91ea('0xa')](function(_0x46668e){var _0xff7b5=_0x46668e[_0x91ea('0x8')]('[')['filter'](function(_0x54a10e){return _0x54a10e[_0x91ea('0xd')](']')>-0x1;})[_0x91ea('0xe')](function(_0xc1e816){return _0xc1e816[_0x91ea('0x8')](']')[0x0];})[0x0];_0x5cd335[_0x91ea('0xf')][_0x91ea('0x10')]({'field':_0x2470c0,'operator':_0x18b3f6,'value':_0xff7b5});});});}return _0x5cd335;};exports[_0x91ea('0x11')]=function(_0xce2d43,_0x5c1146,_0x3e66ba){var _0x3bc18d={};if(_0x5c1146===_0x91ea('0x12')){if(_0x3e66ba['operator']===_0x91ea('0x13')){_0x3e66ba['operator']=_0x91ea('0x14');_0x3e66ba[_0x91ea('0x15')]+=','+_0x3e66ba[_0x91ea('0x15')];}else if(_[_0x91ea('0x16')]([_0x91ea('0x17'),_0x91ea('0x18')],_0x3e66ba[_0x91ea('0x19')])){_0x3e66ba[_0x91ea('0x15')]=moment(_0x3e66ba[_0x91ea('0x15')])['add'](0x1,_0x91ea('0x1a'))[_0x91ea('0x1b')](_0x91ea('0x1c'));}}if(_0x3e66ba[_0x91ea('0x1d')]){_0x5c1146=_0x3e66ba['castTo'];_0x3bc18d[_0x91ea('0x1e')]=_0x91ea('0x1f')+_0xce2d43+'.'+_0x3e66ba[_0x91ea('0x20')]+_0x91ea('0x21')+_0x3e66ba[_0x91ea('0x1d')]+')\x20'+parseOperator(_0x3e66ba[_0x91ea('0x19')]);}else{_0x3bc18d[_0x91ea('0x1e')]=_0xce2d43+'.'+_0x3e66ba[_0x91ea('0x20')]+'\x20'+parseOperator(_0x3e66ba['operator']);}if(_['includes']([_0x91ea('0x22'),'$notIn'],_0x3e66ba[_0x91ea('0x19')]))_0x3bc18d['text']='('+_0x3bc18d['text']+_0x91ea('0x23')+_0xce2d43+'.'+_0x3e66ba['field']+_0x91ea('0x24');_0x3bc18d[_0x91ea('0x15')]=parseValue(_0x5c1146,_0x3e66ba[_0x91ea('0x19')],_0x3e66ba[_0x91ea('0x15')]);return _0x3bc18d;};function parseOperator(_0x4603c8){var _0x2f304f;switch(_0x4603c8){case _0x91ea('0x25'):_0x2f304f=_0x91ea('0x26');break;case _0x91ea('0x27'):_0x2f304f=_0x91ea('0x28');break;case'$eq':_0x2f304f='=\x20?';break;case _0x91ea('0x22'):_0x2f304f='<>\x20?';break;case _0x91ea('0x29'):case _0x91ea('0x2a'):case'$endsWith':_0x2f304f='LIKE\x20?';break;case'$lt':_0x2f304f='<\x20?';break;case _0x91ea('0x17'):_0x2f304f='>\x20?';break;case _0x91ea('0x18'):_0x2f304f=_0x91ea('0x2b');break;case _0x91ea('0x2c'):_0x2f304f=_0x91ea('0x2d');break;case'$between':_0x2f304f=_0x91ea('0x2e');break;}return _0x2f304f;}function parseValue(_0x16a2c5,_0x5d914e,_0xac1b51){var _0x5ae92e={'start':undefined,'end':undefined};switch(_0x5d914e){case _0x91ea('0x25'):case _0x91ea('0x27'):_0x5ae92e[_0x91ea('0x2f')]=_0xac1b51['split'](',');break;case _0x91ea('0x29'):_0x5ae92e['start']='%'+_0xac1b51+'%';break;case _0x91ea('0x2a'):_0x5ae92e['start']=_0xac1b51+'%';break;case _0x91ea('0x30'):_0x5ae92e[_0x91ea('0x2f')]='%'+_0xac1b51;break;case'$between':var _0x16ecb8=_0xac1b51[_0x91ea('0x8')](',');var _0xac1b51=_0x16ecb8[_0x91ea('0xb')]();var _0x142386=_0x16ecb8[_0x91ea('0x31')]();if(_0x16a2c5===_0x91ea('0x12')){_0xac1b51=moment(_0xac1b51)[_0x91ea('0x32')](0x0,!![])[_0x91ea('0x1b')]();_0x142386=moment(_0x142386)[_0x91ea('0x32')](0x0,!![])[_0x91ea('0x33')](0x17,_0x91ea('0x34'))[_0x91ea('0x33')](0x3b,'minutes')['add'](0x3b,'seconds')[_0x91ea('0x1b')]();}_0x5ae92e={'start':_0xac1b51,'end':_0x142386};break;default:_0x5ae92e[_0x91ea('0x2f')]=_0xac1b51;break;}return _0x5ae92e;} \ No newline at end of file +var _0x1fd8=['hours','minutes','lodash','moment','parseSearch','sqlOperator','[$or]','split','length','slice','forEach','match','filter','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset'];(function(_0x57a749,_0xbeb6a1){var _0x140804=function(_0x28aec0){while(--_0x28aec0){_0x57a749['push'](_0x57a749['shift']());}};_0x140804(++_0xbeb6a1);}(_0x1fd8,0x66));var _0x81fd=function(_0x2b2642,_0x368f21){_0x2b2642=_0x2b2642-0x0;var _0x3e8807=_0x1fd8[_0x2b2642];return _0x3e8807;};'use strict';var _=require(_0x81fd('0x0'));var moment=require(_0x81fd('0x1'));exports[_0x81fd('0x2')]=function(_0x1be25c){var _0x2d005e={'conditions':[]};_0x2d005e[_0x81fd('0x3')]=_['startsWith'](_0x1be25c,_0x81fd('0x4'))?'or':'and';var _0x139688=_0x1be25c['replace']('[$and]','')['replace']('[$or]','')[_0x81fd('0x5')]('||');for(var _0x30a71d=0x0;_0x30a71d<_0x139688[_0x81fd('0x6')];_0x30a71d++){var _0x61e583=_0x139688[_0x30a71d]['split'](':=');var _0x266e12=_0x61e583[0x0];var _0x5bd0f1=_0x61e583[_0x81fd('0x7')](0x1);_0x5bd0f1[_0x81fd('0x8')](function(_0x4d77bc){var _0x278803=_0x4d77bc[_0x81fd('0x5')]('[')['shift']();var _0x10e335=_0x4d77bc[_0x81fd('0x9')](/\[(.*?)\]/g);_0x10e335[_0x81fd('0x8')](function(_0x5c68d4){var _0x203d84=_0x5c68d4['split']('[')[_0x81fd('0xa')](function(_0x2c7759){return _0x2c7759['indexOf'](']')>-0x1;})['map'](function(_0x400fb6){return _0x400fb6[_0x81fd('0x5')](']')[0x0];})[0x0];_0x2d005e['conditions']['push']({'field':_0x266e12,'operator':_0x278803,'value':_0x203d84});});});}return _0x2d005e;};exports[_0x81fd('0xb')]=function(_0x364ba9,_0x4b16ef,_0x58b104){var _0x741766={};if(_0x4b16ef===_0x81fd('0xc')){if(_0x58b104[_0x81fd('0xd')]===_0x81fd('0xe')){_0x58b104[_0x81fd('0xd')]=_0x81fd('0xf');_0x58b104[_0x81fd('0x10')]+=','+_0x58b104[_0x81fd('0x10')];}else if(_[_0x81fd('0x11')]([_0x81fd('0x12'),'$lte'],_0x58b104[_0x81fd('0xd')])){_0x58b104['value']=moment(_0x58b104[_0x81fd('0x10')])[_0x81fd('0x13')](0x1,_0x81fd('0x14'))[_0x81fd('0x15')](_0x81fd('0x16'));}}if(_0x58b104[_0x81fd('0x17')]){_0x4b16ef=_0x58b104['castTo'];_0x741766[_0x81fd('0x18')]=_0x81fd('0x19')+_0x364ba9+'.'+_0x58b104['field']+_0x81fd('0x1a')+_0x58b104['castTo']+')\x20'+parseOperator(_0x58b104[_0x81fd('0xd')]);}else{_0x741766[_0x81fd('0x18')]=_0x364ba9+'.'+_0x58b104['field']+'\x20'+parseOperator(_0x58b104['operator']);}if(_[_0x81fd('0x11')]([_0x81fd('0x1b'),_0x81fd('0x1c')],_0x58b104['operator']))_0x741766[_0x81fd('0x18')]='('+_0x741766[_0x81fd('0x18')]+_0x81fd('0x1d')+_0x364ba9+'.'+_0x58b104[_0x81fd('0x1e')]+_0x81fd('0x1f');_0x741766[_0x81fd('0x10')]=parseValue(_0x4b16ef,_0x58b104[_0x81fd('0xd')],_0x58b104[_0x81fd('0x10')]);return _0x741766;};function parseOperator(_0x113d81){var _0x2d9fa6;switch(_0x113d81){case'$in':_0x2d9fa6='IN\x20?';break;case _0x81fd('0x1c'):_0x2d9fa6=_0x81fd('0x20');break;case _0x81fd('0xe'):_0x2d9fa6=_0x81fd('0x21');break;case'$ne':_0x2d9fa6=_0x81fd('0x22');break;case _0x81fd('0x23'):case'$startsWith':case _0x81fd('0x24'):_0x2d9fa6='LIKE\x20?';break;case _0x81fd('0x25'):_0x2d9fa6=_0x81fd('0x26');break;case'$gt':_0x2d9fa6=_0x81fd('0x27');break;case _0x81fd('0x28'):_0x2d9fa6=_0x81fd('0x29');break;case _0x81fd('0x2a'):_0x2d9fa6='>=\x20?';break;case _0x81fd('0xf'):_0x2d9fa6=_0x81fd('0x2b');break;}return _0x2d9fa6;}function parseValue(_0x2cdbfc,_0x374ff2,_0x3aa161){var _0x4fb40d={'start':undefined,'end':undefined};switch(_0x374ff2){case _0x81fd('0x2c'):case _0x81fd('0x1c'):_0x4fb40d[_0x81fd('0x2d')]=_0x3aa161[_0x81fd('0x5')](',');break;case _0x81fd('0x23'):_0x4fb40d[_0x81fd('0x2d')]='%'+_0x3aa161+'%';break;case'$startsWith':_0x4fb40d[_0x81fd('0x2d')]=_0x3aa161+'%';break;case'$endsWith':_0x4fb40d[_0x81fd('0x2d')]='%'+_0x3aa161;break;case _0x81fd('0xf'):var _0x219b25=_0x3aa161[_0x81fd('0x5')](',');var _0x3aa161=_0x219b25['shift']();var _0x440436=_0x219b25[_0x81fd('0x2e')]();if(_0x2cdbfc===_0x81fd('0xc')){_0x3aa161=moment(_0x3aa161)[_0x81fd('0x2f')](0x0,!![])[_0x81fd('0x15')]();_0x440436=moment(_0x440436)[_0x81fd('0x2f')](0x0,!![])[_0x81fd('0x13')](0x17,_0x81fd('0x30'))[_0x81fd('0x13')](0x3b,_0x81fd('0x31'))[_0x81fd('0x13')](0x3b,'seconds')[_0x81fd('0x15')]();}_0x4fb40d={'start':_0x3aa161,'end':_0x440436};break;default:_0x4fb40d[_0x81fd('0x2d')]=_0x3aa161;break;}return _0x4fb40d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c38c32d..bfc04d6 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 _0x8d19=['isEmail','forEach','replace','includes','push','lodash','sequelize','moment','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','parse','isArray','limit','offset','sort','indexOf','priority','cast','col','substr','DESC','unsigned','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x8d19,0x80));var _0x98d1=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x8d19[_0x149083];return _0x4dc74e;};'use strict';var _=require(_0x98d1('0x0'));var sequelize=require(_0x98d1('0x1'));var moment=require(_0x98d1('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x4dfd23){var _0x393edb=null;if(_0x4dfd23){_0x393edb=_0x4dfd23['split'](',');}return _0x393edb;};exports[_0x98d1('0x3')]=function(_0x1430ae,_0x3f4f3e){var _0x3c467d={};if(!_[_0x98d1('0x4')](_0x1430ae)){_[_0x98d1('0x5')](_0x1430ae,function(_0x2cd366,_0x3808f6){try{if(_0x3f4f3e){var _0x22228f=_[_0x98d1('0x6')](_0x3f4f3e,{'name':_0x3808f6})||{};if(_0x22228f[_0x98d1('0x7')]===_0x98d1('0x8')&&_[_0x98d1('0x9')](_0x2cd366)){var _0x40a6d9=JSON['parse'](_0x2cd366);var _0x369a04={'$gte':moment(moment(_0x40a6d9[_0x98d1('0xa')])[_0x98d1('0xb')](_0x98d1('0xc')))[_0x98d1('0xd')]()[_0x98d1('0xb')](),'$lte':moment(moment(_0x40a6d9[_0x98d1('0xe')])[_0x98d1('0xb')](_0x98d1('0xc')))[_0x98d1('0xd')]()[_0x98d1('0xf')](0x1,'s')['format']()};_0x3c467d[_0x3808f6]=_0x369a04;}else{_0x3c467d[_0x3808f6]=_['isArray'](_0x2cd366)?_0x2cd366:JSON[_0x98d1('0x10')](_0x2cd366);}}else{_0x3c467d[_0x3808f6]=_[_0x98d1('0x11')](_0x2cd366)?_0x2cd366:JSON['parse'](_0x2cd366);}}catch(_0x10c6fc){_0x3c467d[_0x3808f6]=_0x2cd366['split'](',');}});}return _0x3c467d;};exports[_0x98d1('0x12')]=function(_0x4e6dc5){_0x4e6dc5=parseInt(_0x4e6dc5,0xa);if(!_0x4e6dc5||_0x4e6dc5<0x0){_0x4e6dc5=LIMIT_VALUE;}return _0x4e6dc5;};exports[_0x98d1('0x13')]=function(_0x2fc057){_0x2fc057=parseInt(_0x2fc057,0xa);if(!_0x2fc057||_0x2fc057<0x0){_0x2fc057=0x0;}return _0x2fc057;};exports[_0x98d1('0x14')]=function(_0x314d8b){var _0xe1429c,_0x467366=null;if(_0x314d8b){_0xe1429c=_0x314d8b['split'](',');_0x467366=_['map'](_0xe1429c,function(_0x3bae0d){if(_0x3bae0d[_0x98d1('0x15')]('-')===0x0){return[_0x3bae0d===_0x98d1('0x16')?sequelize[_0x98d1('0x17')](sequelize[_0x98d1('0x18')](_0x98d1('0x16')),'unsigned'):_0x3bae0d[_0x98d1('0x19')](0x1),_0x98d1('0x1a')];}else{return[_0x3bae0d==='priority'?sequelize[_0x98d1('0x17')](sequelize['col'](_0x98d1('0x16')),_0x98d1('0x1b')):_0x3bae0d,'ASC'];}});}return _0x467366;};exports[_0x98d1('0x1c')]=function(_0x2261ef,_0x22a1ab){if(_['isEmpty'](_0x2261ef)){return _0x2261ef;}if(_[_0x98d1('0x11')](_0x2261ef)){for(var _0x3ef1b0=0x0;_0x3ef1b0<_0x2261ef[_0x98d1('0x1d')];_0x3ef1b0+=0x1){_0x2261ef[_0x3ef1b0]=this['omit'](_0x2261ef[_0x3ef1b0],_0x22a1ab);}return _0x2261ef;}if(!_[_0x98d1('0x1e')](_0x2261ef)){return _0x2261ef;}if(_[_0x98d1('0x1f')](_0x22a1ab)){_0x22a1ab=[_0x22a1ab];}if(!_['isArray'](_0x22a1ab)){return _0x2261ef;}for(var _0x3a581f=0x0;_0x3a581f<_0x22a1ab['length'];_0x3a581f+=0x1){_[_0x98d1('0x20')](_0x2261ef,_0x22a1ab[_0x3a581f]);}for(var _0x395656 in _0x2261ef){if(_0x2261ef[_0x98d1('0x21')](_0x395656)){_0x2261ef[_0x395656]=this[_0x98d1('0x1c')](_0x2261ef[_0x395656],_0x22a1ab);}}return _0x2261ef;};exports[_0x98d1('0x22')]=function(_0x5dd058){return _0x5dd058['match'](RegExp(_0x98d1('0x23')))?!![]:![];};exports[_0x98d1('0x24')]=function(_0x3cffc2){return _0x3cffc2['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x29b68e){var _0x46b8a3=[];_0x29b68e['split'](/[ ,]+/)[_0x98d1('0x25')](function(_0x3e1242){_0x3e1242=_0x3e1242[_0x98d1('0x26')](/([^:]")"+/g,'$1');_0x3e1242='+'+_0x3e1242+'*';if(_0x3e1242[_0x98d1('0x27')]('@'))_0x3e1242='\x22'+_0x3e1242+'\x22';_0x46b8a3[_0x98d1('0x28')](_0x3e1242);});return _0x46b8a3['join']('\x20');}; \ No newline at end of file +var _0x583b=['sequelize','moment','split','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','subtract','isArray','offset','sort','map','priority','cast','unsigned','DESC','col','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','push','join','lodash'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x583b,0x117));var _0xb583=function(_0x51cdb6,_0x2ed470){_0x51cdb6=_0x51cdb6-0x0;var _0x5f4128=_0x583b[_0x51cdb6];return _0x5f4128;};'use strict';var _=require(_0xb583('0x0'));var sequelize=require(_0xb583('0x1'));var moment=require(_0xb583('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x3bb344){var _0x381f22=null;if(_0x3bb344){_0x381f22=_0x3bb344[_0xb583('0x3')](',');}return _0x381f22;};exports['filters']=function(_0x540cce,_0x55d25c){var _0xde808d={};if(!_[_0xb583('0x4')](_0x540cce)){_[_0xb583('0x5')](_0x540cce,function(_0x50887c,_0xa4292a){try{if(_0x55d25c){var _0x43cf6e=_['find'](_0x55d25c,{'name':_0xa4292a})||{};if(_0x43cf6e[_0xb583('0x6')]===_0xb583('0x7')&&_[_0xb583('0x8')](_0x50887c)){var _0xd7d22c=JSON[_0xb583('0x9')](_0x50887c);var _0x5067da={'$gte':moment(moment(_0xd7d22c[_0xb583('0xa')])[_0xb583('0xb')](_0xb583('0xc')))[_0xb583('0xd')]()[_0xb583('0xb')](),'$lte':moment(moment(_0xd7d22c['$lte'])[_0xb583('0xb')]('YYYY-MM-DD'))[_0xb583('0xd')]()[_0xb583('0xe')](0x1,'s')['format']()};_0xde808d[_0xa4292a]=_0x5067da;}else{_0xde808d[_0xa4292a]=_[_0xb583('0xf')](_0x50887c)?_0x50887c:JSON[_0xb583('0x9')](_0x50887c);}}else{_0xde808d[_0xa4292a]=_[_0xb583('0xf')](_0x50887c)?_0x50887c:JSON[_0xb583('0x9')](_0x50887c);}}catch(_0x4df71c){_0xde808d[_0xa4292a]=_0x50887c[_0xb583('0x3')](',');}});}return _0xde808d;};exports['limit']=function(_0x2af05e){_0x2af05e=parseInt(_0x2af05e,0xa);if(!_0x2af05e||_0x2af05e<0x0){_0x2af05e=LIMIT_VALUE;}return _0x2af05e;};exports[_0xb583('0x10')]=function(_0xc92324){_0xc92324=parseInt(_0xc92324,0xa);if(!_0xc92324||_0xc92324<0x0){_0xc92324=0x0;}return _0xc92324;};exports[_0xb583('0x11')]=function(_0x3bce74){var _0x4bec84,_0x2892fe=null;if(_0x3bce74){_0x4bec84=_0x3bce74['split'](',');_0x2892fe=_[_0xb583('0x12')](_0x4bec84,function(_0x3ac632){if(_0x3ac632['indexOf']('-')===0x0){return[_0x3ac632===_0xb583('0x13')?sequelize[_0xb583('0x14')](sequelize['col']('priority'),_0xb583('0x15')):_0x3ac632['substr'](0x1),_0xb583('0x16')];}else{return[_0x3ac632===_0xb583('0x13')?sequelize[_0xb583('0x14')](sequelize[_0xb583('0x17')](_0xb583('0x13')),'unsigned'):_0x3ac632,_0xb583('0x18')];}});}return _0x2892fe;};exports[_0xb583('0x19')]=function(_0xe30393,_0x472e67){if(_[_0xb583('0x4')](_0xe30393)){return _0xe30393;}if(_[_0xb583('0xf')](_0xe30393)){for(var _0x3875c3=0x0;_0x3875c3<_0xe30393[_0xb583('0x1a')];_0x3875c3+=0x1){_0xe30393[_0x3875c3]=this['omit'](_0xe30393[_0x3875c3],_0x472e67);}return _0xe30393;}if(!_[_0xb583('0x1b')](_0xe30393)){return _0xe30393;}if(_['isString'](_0x472e67)){_0x472e67=[_0x472e67];}if(!_[_0xb583('0xf')](_0x472e67)){return _0xe30393;}for(var _0x518040=0x0;_0x518040<_0x472e67[_0xb583('0x1a')];_0x518040+=0x1){_[_0xb583('0x1c')](_0xe30393,_0x472e67[_0x518040]);}for(var _0x394f28 in _0xe30393){if(_0xe30393[_0xb583('0x1d')](_0x394f28)){_0xe30393[_0x394f28]=this[_0xb583('0x19')](_0xe30393[_0x394f28],_0x472e67);}}return _0xe30393;};exports[_0xb583('0x1e')]=function(_0x538b1d){return _0x538b1d[_0xb583('0x1f')](RegExp(_0xb583('0x20')))?!![]:![];};exports[_0xb583('0x21')]=function(_0x3608a4){return _0x3608a4[_0xb583('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0xb583('0x22')]=function(_0x199ed1){var _0x38ea5a=[];_0x199ed1[_0xb583('0x3')](/[ ,]+/)[_0xb583('0x23')](function(_0x1e4bfb){_0x1e4bfb=_0x1e4bfb[_0xb583('0x24')](/([^:]")"+/g,'$1');_0x1e4bfb='+'+_0x1e4bfb+'*';if(_0x1e4bfb[_0xb583('0x25')]('@'))_0x1e4bfb='\x22'+_0x1e4bfb+'\x22';_0x38ea5a[_0xb583('0x26')](_0x1e4bfb);});return _0x38ea5a[_0xb583('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 64bce27..295da98 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e57=['moment','./environment','../mysqldb','default','get','production','appPath','join','root','public','development','test','set','use','json\x20replacer','toISOString','split','static','views','engine','renderFile','view\x20engine','html','urlencoded','json','initialize','serve-favicon','body-parser','method-override','path','passport'];(function(_0x36267b,_0x32b9a3){var _0x10b3ea=function(_0x3d83e3){while(--_0x3d83e3){_0x36267b['push'](_0x36267b['shift']());}};_0x10b3ea(++_0x32b9a3);}(_0x2e57,0x1ad));var _0x72e5=function(_0xdb0885,_0x4bb553){_0xdb0885=_0xdb0885-0x0;var _0x15238c=_0x2e57[_0xdb0885];return _0x15238c;};'use strict';var express=require('express');var favicon=require(_0x72e5('0x0'));var bodyParser=require(_0x72e5('0x1'));var methodOverride=require(_0x72e5('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x72e5('0x3'));var passport=require(_0x72e5('0x4'));var cors=require('cors');var moment=require(_0x72e5('0x5'));var config=require(_0x72e5('0x6'));var db=require(_0x72e5('0x7'))['db'];exports[_0x72e5('0x8')]=function(_0x4d3ec4){var _0x553a10=_0x4d3ec4[_0x72e5('0x9')]('env');if(_0x553a10===_0x72e5('0xa')){_0x4d3ec4['set'](_0x72e5('0xb'),path[_0x72e5('0xc')](config[_0x72e5('0xd')],_0x72e5('0xe')));}if(_0x553a10===_0x72e5('0xf')||_0x553a10===_0x72e5('0x10')){_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0xb'),path[_0x72e5('0xc')](config[_0x72e5('0xd')],'client'));_0x4d3ec4[_0x72e5('0x12')](errorHandler());}_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0x13'),function(_0x15e1f6,_0x25246d){if(this[_0x15e1f6]instanceof Date){_0x25246d=this[_0x15e1f6][_0x72e5('0x14')]()[_0x72e5('0x15')]('.')[0x0]+'Z';}return _0x25246d;});_0x4d3ec4[_0x72e5('0x12')](express[_0x72e5('0x16')](_0x4d3ec4[_0x72e5('0x9')](_0x72e5('0xb'))));_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0x17'),config[_0x72e5('0xd')]+'/server/views');_0x4d3ec4[_0x72e5('0x18')]('html',require('ejs')[_0x72e5('0x19')]);_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0x1a'),_0x72e5('0x1b'));_0x4d3ec4[_0x72e5('0x12')](bodyParser[_0x72e5('0x1c')]({'limit':'50mb','extended':!![]}));_0x4d3ec4[_0x72e5('0x12')](bodyParser[_0x72e5('0x1d')]({'limit':'50mb'}));_0x4d3ec4[_0x72e5('0x12')](cors());_0x4d3ec4['use'](methodOverride());_0x4d3ec4[_0x72e5('0x12')](cookieParser());_0x4d3ec4[_0x72e5('0x12')](passport[_0x72e5('0x1e')]());}; \ No newline at end of file +var _0x815b=['initialize','serve-favicon','method-override','cookie-parser','cors','moment','./environment','../mysqldb','default','get','production','set','appPath','join','root','public','development','test','client','use','toISOString','split','static','/server/views','engine','renderFile','html','urlencoded','50mb'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x815b,0xaf));var _0xb815=function(_0x23eb80,_0x46f38a){_0x23eb80=_0x23eb80-0x0;var _0x49d4e2=_0x815b[_0x23eb80];return _0x49d4e2;};'use strict';var express=require('express');var favicon=require(_0xb815('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0xb815('0x1'));var cookieParser=require(_0xb815('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require('passport');var cors=require(_0xb815('0x3'));var moment=require(_0xb815('0x4'));var config=require(_0xb815('0x5'));var db=require(_0xb815('0x6'))['db'];exports[_0xb815('0x7')]=function(_0x8f1bba){var _0x582ee5=_0x8f1bba[_0xb815('0x8')]('env');if(_0x582ee5===_0xb815('0x9')){_0x8f1bba[_0xb815('0xa')](_0xb815('0xb'),path[_0xb815('0xc')](config[_0xb815('0xd')],_0xb815('0xe')));}if(_0x582ee5===_0xb815('0xf')||_0x582ee5===_0xb815('0x10')){_0x8f1bba[_0xb815('0xa')]('appPath',path[_0xb815('0xc')](config['root'],_0xb815('0x11')));_0x8f1bba[_0xb815('0x12')](errorHandler());}_0x8f1bba['set']('json\x20replacer',function(_0x13e886,_0x4b4eb2){if(this[_0x13e886]instanceof Date){_0x4b4eb2=this[_0x13e886][_0xb815('0x13')]()[_0xb815('0x14')]('.')[0x0]+'Z';}return _0x4b4eb2;});_0x8f1bba[_0xb815('0x12')](express[_0xb815('0x15')](_0x8f1bba[_0xb815('0x8')]('appPath')));_0x8f1bba[_0xb815('0xa')]('views',config[_0xb815('0xd')]+_0xb815('0x16'));_0x8f1bba[_0xb815('0x17')]('html',require('ejs')[_0xb815('0x18')]);_0x8f1bba[_0xb815('0xa')]('view\x20engine',_0xb815('0x19'));_0x8f1bba[_0xb815('0x12')](bodyParser[_0xb815('0x1a')]({'limit':_0xb815('0x1b'),'extended':!![]}));_0x8f1bba[_0xb815('0x12')](bodyParser['json']({'limit':_0xb815('0x1b')}));_0x8f1bba['use'](cors());_0x8f1bba[_0xb815('0x12')](methodOverride());_0x8f1bba['use'](cookieParser());_0x8f1bba[_0xb815('0x12')](passport[_0xb815('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 293559b..71ebd12 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 _0xdb94=['createHash','md5','digest','hex','getUuid','platform','win32','utf8','replace','hostname','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','networkInterfaces','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join'];(function(_0x3f512b,_0x1b68f4){var _0x473acb=function(_0x28d346){while(--_0x28d346){_0x3f512b['push'](_0x3f512b['shift']());}};_0x473acb(++_0x1b68f4);}(_0xdb94,0xe5));var _0x4db9=function(_0x21dc06,_0x18a2c6){_0x21dc06=_0x21dc06-0x0;var _0x247a91=_0xdb94[_0x21dc06];return _0x247a91;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x4db9('0x0'));var machine=require(_0x4db9('0x1'));var exec=require('child_process')[_0x4db9('0x2')];function getInterfaces(){var _0x3b24a6=[];var _0x25b510=os[_0x4db9('0x3')]();var _0x1f05d4=_['orderBy'](_[_0x4db9('0x4')](_0x25b510));for(var _0x541226=0x0;_0x541226<_0x1f05d4[_0x4db9('0x5')];_0x541226++){var _0xc76bc1=_0x25b510[_0x1f05d4[_0x541226]][_0x4db9('0x6')](function(_0x3404f6){return _0x3404f6[_0x4db9('0x7')]==='IPv4'&&_0x3404f6[_0x4db9('0x8')]===![];});_0x3b24a6=_0x3b24a6[_0x4db9('0x9')](_0xc76bc1);}return _0x3b24a6;}function getFirstInterface(){var _0x2d1d38=_[_0x4db9('0xa')](getInterfaces());return{'macAddress':_0x2d1d38&&_0x2d1d38[_0x4db9('0xb')]?_0x2d1d38['mac']:_0x4db9('0xc'),'ipAddress':_0x2d1d38&&_0x2d1d38[_0x4db9('0xd')]?_0x2d1d38[_0x4db9('0xd')]:_0x4db9('0xe')};}exports[_0x4db9('0xf')]=getFirstInterface;function getCPUhash(){var _0x3d1b96=_['orderBy'](os[_0x4db9('0x10')]()[_0x4db9('0x11')](function(_0x59f01c){return _0x59f01c['model'];}))[_0x4db9('0x12')](':');return crypto[_0x4db9('0x13')](_0x4db9('0x14'))['update'](_0x3d1b96)[_0x4db9('0x15')](_0x4db9('0x16'));}exports[_0x4db9('0x17')]=function(){switch(os[_0x4db9('0x18')]()){case _0x4db9('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4db9('0x1a')})[_0x4db9('0x1b')]('\x0d\x0a','');default:var _0x5d4d70=getFirstInterface();var _0x27b387=getCPUhash();var _0x7df575=_0x27b387+'|'+os[_0x4db9('0x1c')]()+'|'+_0x5d4d70['macAddress']+'|'+_0x5d4d70[_0x4db9('0x1d')];var _0x3b0863=crypto['createHash']('md5')['update'](_0x7df575)[_0x4db9('0x15')](_0x4db9('0x16'));return _0x3b0863['substring'](0x0,0x8)+'-'+_0x3b0863[_0x4db9('0x1e')](0x8,0xc)+'-'+_0x3b0863[_0x4db9('0x1e')](0xc,0x10)+'-'+_0x3b0863[_0x4db9('0x1e')](0x10,0x14)+'-'+_0x3b0863[_0x4db9('0x1e')](0x14);}}; \ No newline at end of file +var _0x3edc=['orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','getUuid','replace','hostname','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x3cb09b,_0x31c2a5){_0x3cb09b=_0x3cb09b-0x0;var _0x242048=_0x3edc[_0x3cb09b];return _0x242048;};'use strict';var _=require(_0xc3ed('0x0'));var os=require('os');var crypto=require(_0xc3ed('0x1'));var machine=require(_0xc3ed('0x2'));var exec=require(_0xc3ed('0x3'))[_0xc3ed('0x4')];function getInterfaces(){var _0x47a242=[];var _0x2a8714=os['networkInterfaces']();var _0x3519ab=_[_0xc3ed('0x5')](_[_0xc3ed('0x6')](_0x2a8714));for(var _0x4183c5=0x0;_0x4183c5<_0x3519ab[_0xc3ed('0x7')];_0x4183c5++){var _0x50b95c=_0x2a8714[_0x3519ab[_0x4183c5]][_0xc3ed('0x8')](function(_0x323058){return _0x323058[_0xc3ed('0x9')]===_0xc3ed('0xa')&&_0x323058[_0xc3ed('0xb')]===![];});_0x47a242=_0x47a242[_0xc3ed('0xc')](_0x50b95c);}return _0x47a242;}function getFirstInterface(){var _0x552284=_[_0xc3ed('0xd')](getInterfaces());return{'macAddress':_0x552284&&_0x552284[_0xc3ed('0xe')]?_0x552284[_0xc3ed('0xe')]:'00:00:00:00:00:00','ipAddress':_0x552284&&_0x552284['address']?_0x552284['address']:_0xc3ed('0xf')};}exports[_0xc3ed('0x10')]=getFirstInterface;function getCPUhash(){var _0x1eb94b=_[_0xc3ed('0x5')](os[_0xc3ed('0x11')]()[_0xc3ed('0x12')](function(_0x430db2){return _0x430db2[_0xc3ed('0x13')];}))[_0xc3ed('0x14')](':');return crypto[_0xc3ed('0x15')]('md5')[_0xc3ed('0x16')](_0x1eb94b)[_0xc3ed('0x17')](_0xc3ed('0x18'));}exports[_0xc3ed('0x19')]=function(){switch(os['platform']()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xc3ed('0x1a')]('\x0d\x0a','');default:var _0x15a654=getFirstInterface();var _0x55ff63=getCPUhash();var _0x25c7fb=_0x55ff63+'|'+os[_0xc3ed('0x1b')]()+'|'+_0x15a654['macAddress']+'|'+_0x15a654['ipAddress'];var _0x3132ad=crypto[_0xc3ed('0x15')]('md5')[_0xc3ed('0x16')](_0x25c7fb)[_0xc3ed('0x17')](_0xc3ed('0x18'));return _0x3132ad[_0xc3ed('0x1c')](0x0,0x8)+'-'+_0x3132ad[_0xc3ed('0x1c')](0x8,0xc)+'-'+_0x3132ad['substring'](0xc,0x10)+'-'+_0x3132ad[_0xc3ed('0x1c')](0x10,0x14)+'-'+_0x3132ad[_0xc3ed('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 123b9f7..61d7f4a 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 _0xa8c5=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','update','error','message','finally','getUuid','License','findOrCreate','default','util','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','|reason|','|machineUuid|','|name|','fullname','|email|','email','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa8c5,0x165));var _0x5a8c=function(_0x24c9d0,_0x4967b6){_0x24c9d0=_0x24c9d0-0x0;var _0x58c87f=_0xa8c5[_0x24c9d0];return _0x58c87f;};'use strict';var util=require(_0x5a8c('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x5a8c('0x1'))(module,_0x5a8c('0x2'));var db=require(_0x5a8c('0x3'))['db'];var encryptor=require(_0x5a8c('0x4'));var hardware=require(_0x5a8c('0x5'));var logger=require(_0x5a8c('0x6'))(_0x5a8c('0x7'));var jira=require(_0x5a8c('0x8'));const {config}=require('process');var HOST=_0x5a8c('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x64165c){return new BPromise(function(_0x1f4e0c,_0x139916){var _0x3d4c17=util[_0x5a8c('0xa')](_0x5a8c('0xb'),HOST,_0x64165c,module[_0x5a8c('0xc')]['version']);if(oldToken){_0x3d4c17=util['format'](_0x5a8c('0xd'),HOST,_0x64165c,module[_0x5a8c('0xc')]['version'],oldToken);}var _0xfd9db4={'uri':_0x3d4c17,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xfd9db4)[_0x5a8c('0xe')](function(_0xfe1176){_0x1f4e0c(_0xfe1176);})[_0x5a8c('0xf')](function(_0x3687c2){_0x139916(_0x3687c2);});});}function sendJiraAlert(_0x44372c,_0x171a95,_0x3003fe){var _0x8eb601=_0x5a8c('0x10');return db[_0x5a8c('0x11')][_0x5a8c('0x12')]({'where':{'role':_0x5a8c('0x13')},'attributes':['fullname','email'],'raw':!![]})[_0x5a8c('0xe')](function(_0x30d25e){ADMIN=_0x30d25e;_0x8eb601+=_0x5a8c('0x14')+_0x3003fe+'|\x0a';_0x8eb601+='|uuid|'+_0x44372c+'|\x0a';_0x8eb601+=_0x5a8c('0x15')+_0x171a95+'|\x0a';_0x8eb601+=_0x5a8c('0x16')+ADMIN[_0x5a8c('0x17')]+'|\x0a';_0x8eb601+=_0x5a8c('0x18')+ADMIN[_0x5a8c('0x19')]+'|\x0a';return _0x8eb601;})[_0x5a8c('0xe')](function(_0xcdf5d0){var _0x529fda=hardware[_0x5a8c('0x1a')]()[_0x5a8c('0x1b')];return jira[_0x5a8c('0x1c')]({'key':_0x5a8c('0x1d'),'summary':_0x5a8c('0x1e'),'description':_0xcdf5d0,'issuetype':_0x5a8c('0x1f'),'oldToken':_0x44372c,'newToken':_0x171a95,'email':ADMIN[_0x5a8c('0x19')],'name':ADMIN[_0x5a8c('0x17')],'reason':GRAY_PERIOD_REASON,'ip':_0x529fda});});}function manageLicense(_0x206c0e,_0x517110){var _0x2e2bdd=_0x517110[_0x5a8c('0x20')]({'plain':!![]});httpRequest(_0x206c0e)[_0x5a8c('0xe')](function(_0x493f37){if(oldToken){oldToken=undefined;}if(_0x493f37[_0x5a8c('0x21')]){if(!_0x2e2bdd[_0x5a8c('0x7')]&&_0x2e2bdd[_0x5a8c('0x7')]!=_0x493f37[_0x5a8c('0x7')]||_0x2e2bdd[_0x5a8c('0x7')]&&_0x2e2bdd[_0x5a8c('0x22')]){logger['info'](_0x5a8c('0x23'));}if(_0x2e2bdd[_0x5a8c('0x7')]&&!_0x2e2bdd[_0x5a8c('0x22')]&&_0x2e2bdd[_0x5a8c('0x7')]!=_0x493f37[_0x5a8c('0x7')]){logger[_0x5a8c('0x24')](_0x5a8c('0x25'));}if(_0x2e2bdd[_0x5a8c('0x7')]&&!_0x2e2bdd[_0x5a8c('0x22')]&&_0x2e2bdd[_0x5a8c('0x7')]==_0x493f37[_0x5a8c('0x7')]){return _0x517110;}return _0x517110['update']({'data1':_0x206c0e,'data2':null,'license':_0x493f37[_0x5a8c('0x7')]});}else{if(_0x493f37[_0x5a8c('0x7')]||_0x2e2bdd[_0x5a8c('0x7')]){if(!_0x2e2bdd[_0x5a8c('0x22')]){if(_0x2e2bdd[_0x5a8c('0x26')]==_0x206c0e){GRAY_PERIOD_REASON=_0x5a8c('0x27');logger[_0x5a8c('0x24')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x5a8c('0x28');oldToken=_0x2e2bdd['data1'];logger[_0x5a8c('0x24')](_0x5a8c('0x29'),_0x2e2bdd[_0x5a8c('0x26')],_0x206c0e);}sendJiraAlert(_0x2e2bdd[_0x5a8c('0x26')],_0x493f37['uuid'],GRAY_PERIOD_REASON);logger[_0x5a8c('0x24')](_0x5a8c('0x2a'),GRAY_PERIOD_REASON[_0x5a8c('0x2b')](),moment()['format'](_0x5a8c('0x2c')));return _0x517110['update']({'data2':encryptor[_0x5a8c('0x2d')](moment()[_0x5a8c('0xa')](_0x5a8c('0x2c')))});}else{if(moment()['diff'](encryptor[_0x5a8c('0x2e')](_0x2e2bdd[_0x5a8c('0x22')]),_0x5a8c('0x2f'))>DAYS){logger[_0x5a8c('0x24')]('DEMO\x20START\x20AT\x20%s',moment()[_0x5a8c('0xa')](_0x5a8c('0x2c')));return _0x517110[_0x5a8c('0x30')]({'data1':_0x206c0e,'data2':null,'license':null});}}}else{if(_0x2e2bdd[_0x5a8c('0x26')]!=_0x206c0e){logger[_0x5a8c('0x24')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2e2bdd[_0x5a8c('0x26')],_0x206c0e);return _0x517110['update']({'data1':_0x206c0e,'data2':null,'license':null});}}}return _0x517110;})[_0x5a8c('0xe')](function(_0xaf0fd1){_0x517110=_0xaf0fd1;})['catch'](function(_0x32220a){logger[_0x5a8c('0x31')](_0x32220a[_0x5a8c('0x32')]);})[_0x5a8c('0x33')](function(){setTimeout(function(){manageLicense(hardware[_0x5a8c('0x34')](),_0x517110);},TIME);});}function defaultLicense(){var _0x431a29=hardware[_0x5a8c('0x34')]();if(_0x431a29){return db[_0x5a8c('0x35')][_0x5a8c('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x431a29}})['spread'](function(_0x4a2f66,_0x48b51e){logger[_0x5a8c('0x24')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x431a29);manageLicense(_0x431a29,_0x4a2f66);})[_0x5a8c('0xf')](function(_0x42a40c){logger[_0x5a8c('0x31')](_0x42a40c[_0x5a8c('0x32')]);});}}exports[_0x5a8c('0x37')]=defaultLicense; \ No newline at end of file +var _0x29c6=['catch','||FIELD||VALUE||\x0a','User','findOne','fullname','email','then','|reason|','|machineUuid|','|email|','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','default','util','moment','request-promise','bluebird','version','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET'];(function(_0x17838e,_0xa5f526){var _0xe3e1c=function(_0x2084d4){while(--_0x2084d4){_0x17838e['push'](_0x17838e['shift']());}};_0xe3e1c(++_0xa5f526);}(_0x29c6,0x67));var _0x629c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29c6[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x629c('0x0'));var moment=require(_0x629c('0x1'));var rp=require(_0x629c('0x2'));var BPromise=require(_0x629c('0x3'));var pkginfo=require('pkginfo')(module,_0x629c('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x629c('0x5'));var hardware=require(_0x629c('0x6'));var logger=require(_0x629c('0x7'))(_0x629c('0x8'));var jira=require(_0x629c('0x9'));const {config}=require(_0x629c('0xa'));var HOST=_0x629c('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xc8c9de){return new BPromise(function(_0x5eaade,_0x2c27fb){var _0x2bdf0d=util[_0x629c('0xc')](_0x629c('0xd'),HOST,_0xc8c9de,module['exports'][_0x629c('0x4')]);if(oldToken){_0x2bdf0d=util['format'](_0x629c('0xe'),HOST,_0xc8c9de,module[_0x629c('0xf')][_0x629c('0x4')],oldToken);}var _0xc50ea8={'uri':_0x2bdf0d,'method':_0x629c('0x10'),'timeout':0xea60,'json':!![]};return rp(_0xc50ea8)['then'](function(_0x1c32b6){_0x5eaade(_0x1c32b6);})[_0x629c('0x11')](function(_0x59f599){_0x2c27fb(_0x59f599);});});}function sendJiraAlert(_0x2a0a2d,_0x23dce4,_0x19b9db){var _0xdbbe5e=_0x629c('0x12');return db[_0x629c('0x13')][_0x629c('0x14')]({'where':{'role':'admin'},'attributes':[_0x629c('0x15'),_0x629c('0x16')],'raw':!![]})[_0x629c('0x17')](function(_0x45005f){ADMIN=_0x45005f;_0xdbbe5e+=_0x629c('0x18')+_0x19b9db+'|\x0a';_0xdbbe5e+='|uuid|'+_0x2a0a2d+'|\x0a';_0xdbbe5e+=_0x629c('0x19')+_0x23dce4+'|\x0a';_0xdbbe5e+='|name|'+ADMIN['fullname']+'|\x0a';_0xdbbe5e+=_0x629c('0x1a')+ADMIN[_0x629c('0x16')]+'|\x0a';return _0xdbbe5e;})[_0x629c('0x17')](function(_0xe4bbe5){var _0x1a5252=hardware[_0x629c('0x1b')]()[_0x629c('0x1c')];return jira['openIssue']({'key':_0x629c('0x1d'),'summary':_0x629c('0x1e'),'description':_0xe4bbe5,'issuetype':_0x629c('0x1f'),'oldToken':_0x2a0a2d,'newToken':_0x23dce4,'email':ADMIN[_0x629c('0x16')],'name':ADMIN[_0x629c('0x15')],'reason':GRAY_PERIOD_REASON,'ip':_0x1a5252});});}function manageLicense(_0x3a8699,_0x47dcd2){var _0x47765b=_0x47dcd2[_0x629c('0x20')]({'plain':!![]});httpRequest(_0x3a8699)[_0x629c('0x17')](function(_0x185c9a){if(oldToken){oldToken=undefined;}if(_0x185c9a[_0x629c('0x21')]){if(!_0x47765b[_0x629c('0x8')]&&_0x47765b[_0x629c('0x8')]!=_0x185c9a[_0x629c('0x8')]||_0x47765b['license']&&_0x47765b[_0x629c('0x22')]){logger[_0x629c('0x23')](_0x629c('0x24'));}if(_0x47765b[_0x629c('0x8')]&&!_0x47765b[_0x629c('0x22')]&&_0x47765b[_0x629c('0x8')]!=_0x185c9a['license']){logger['info'](_0x629c('0x25'));}if(_0x47765b['license']&&!_0x47765b[_0x629c('0x22')]&&_0x47765b[_0x629c('0x8')]==_0x185c9a[_0x629c('0x8')]){return _0x47dcd2;}return _0x47dcd2[_0x629c('0x26')]({'data1':_0x3a8699,'data2':null,'license':_0x185c9a[_0x629c('0x8')]});}else{if(_0x185c9a['license']||_0x47765b[_0x629c('0x8')]){if(!_0x47765b['data2']){if(_0x47765b[_0x629c('0x27')]==_0x3a8699){GRAY_PERIOD_REASON=_0x629c('0x28');logger[_0x629c('0x23')](_0x629c('0x29'));}else{GRAY_PERIOD_REASON=_0x629c('0x2a');oldToken=_0x47765b[_0x629c('0x27')];logger[_0x629c('0x23')](_0x629c('0x2b'),_0x47765b[_0x629c('0x27')],_0x3a8699);}sendJiraAlert(_0x47765b[_0x629c('0x27')],_0x185c9a[_0x629c('0x2c')],GRAY_PERIOD_REASON);logger[_0x629c('0x23')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x629c('0x2d')](),moment()[_0x629c('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x47dcd2[_0x629c('0x26')]({'data2':encryptor[_0x629c('0x2e')](moment()['format'](_0x629c('0x2f')))});}else{if(moment()[_0x629c('0x30')](encryptor[_0x629c('0x31')](_0x47765b[_0x629c('0x22')]),_0x629c('0x32'))>DAYS){logger[_0x629c('0x23')](_0x629c('0x33'),moment()[_0x629c('0xc')](_0x629c('0x2f')));return _0x47dcd2[_0x629c('0x26')]({'data1':_0x3a8699,'data2':null,'license':null});}}}else{if(_0x47765b[_0x629c('0x27')]!=_0x3a8699){logger['info'](_0x629c('0x2b'),_0x47765b[_0x629c('0x27')],_0x3a8699);return _0x47dcd2[_0x629c('0x26')]({'data1':_0x3a8699,'data2':null,'license':null});}}}return _0x47dcd2;})[_0x629c('0x17')](function(_0x59a4cc){_0x47dcd2=_0x59a4cc;})[_0x629c('0x11')](function(_0x37ceab){logger[_0x629c('0x34')](_0x37ceab[_0x629c('0x35')]);})[_0x629c('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0x629c('0x37')](),_0x47dcd2);},TIME);});}function defaultLicense(){var _0xe4457d=hardware[_0x629c('0x37')]();if(_0xe4457d){return db[_0x629c('0x38')][_0x629c('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0xe4457d}})[_0x629c('0x3a')](function(_0x7a1ed2,_0x111660){logger[_0x629c('0x23')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xe4457d);manageLicense(_0xe4457d,_0x7a1ed2);})[_0x629c('0x11')](function(_0x40c8b7){logger[_0x629c('0x34')](_0x40c8b7[_0x629c('0x35')]);});}}exports[_0x629c('0x3b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 00a05fc..08d14e2 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 _0xb3dc=['../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','format','grayReason','uuid','machineUuid','changed','disabled','message','User','findAll','role','COUNT','col','count','admin','user','telephone','users','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor'];(function(_0x20d75f,_0x377791){var _0x44d60e=function(_0x3ef1aa){while(--_0x3ef1aa){_0x20d75f['push'](_0x20d75f['shift']());}};_0x44d60e(++_0x377791);}(_0xb3dc,0x8b));var _0xcb3d=function(_0xb200f0,_0x5d9c21){_0xb200f0=_0xb200f0-0x0;var _0x4a699e=_0xb3dc[_0xb200f0];return _0x4a699e;};'use strict';var util=require('util');var _=require(_0xcb3d('0x0'));var moment=require(_0xcb3d('0x1'));var BPromise=require(_0xcb3d('0x2'));var hardware=require(_0xcb3d('0x3'));var encryptor=require(_0xcb3d('0x4'));var db=require(_0xcb3d('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':_0xcb3d('0x6'),'machineUuid':hardware[_0xcb3d('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcb3d('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcb3d('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4a974b){return new BPromise(function(_0x2b0b28,_0x24890e){return db[_0xcb3d('0xa')][_0xcb3d('0xb')](_['defaults'](_0x4a974b,{'raw':!![],'where':{'id':0x1}}))[_0xcb3d('0xc')](function(_0x4552e1){return checkLicense(_0x4552e1,null);})[_0xcb3d('0xc')](function(_0x17c6f9){_0x2b0b28(_0x17c6f9);return;})[_0xcb3d('0xd')](function(_0x13a7d9){_0x24890e(_0x13a7d9);});});}function checkLicense(_0x5a680d,_0x3365d4){if(!_0x5a680d){demoLicense['uuid']=_0x5a680d[_0xcb3d('0xe')];return demoLicense;}try{var _0x5e8d5e=_0x3365d4||_0x5a680d['license'];if(_[_0xcb3d('0xf')](_0x5e8d5e)){throw new Error(_0xcb3d('0x10'));}var _0x3be594=_0x5a680d['data1'];var _0x4be291=_0x5a680d['data2'];var _0x422ac1=_0x3be594[_0xcb3d('0x11')]('-')[0x4];var _0x1809fd=_0x3be594[_0xcb3d('0x11')]('-')[0x0];var _0x473b04=encryptor[_0xcb3d('0x12')](_0x5e8d5e,util['format'](_0xcb3d('0x13'),_0x422ac1,_0x3be594,_0x1809fd));var _0x479491=JSON[_0xcb3d('0x14')](_0x473b04);_0x479491[_0xcb3d('0x15')]=![];_0x479491['uuid']=_0x3be594;_0x479491['machineUuid']=hardware[_0xcb3d('0x7')]();if(_0x4be291){var _0x64436d=encryptor[_0xcb3d('0x12')](_0x4be291);_0x479491[_0xcb3d('0x16')]=_0x64436d;_0x479491[_0xcb3d('0x17')]=moment(_0x64436d)[_0xcb3d('0x18')](0x7,'days')[_0xcb3d('0x19')]();_0x479491[_0xcb3d('0x1a')]=_0x479491[_0xcb3d('0x1b')]!=_0x479491[_0xcb3d('0x1c')]?_0xcb3d('0x1d'):_0xcb3d('0x1e');}return _0x479491;}catch(_0xf5d6a6){breakingLicense['uuid']=_0x5a680d[_0xcb3d('0xe')];breakingLicense[_0xcb3d('0x1f')]=_0xf5d6a6[_0xcb3d('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x46d098,_0x5dbf3c){getLicense()[_0xcb3d('0xc')](function(_0x4663d4){return db[_0xcb3d('0x20')][_0xcb3d('0x21')]({'attributes':[_0xcb3d('0x22'),[db['sequelize']['fn'](_0xcb3d('0x23'),db['sequelize'][_0xcb3d('0x24')]('role')),_0xcb3d('0x25')]],'group':_0xcb3d('0x22'),'where':{'role':{'$or':[_0xcb3d('0x26'),_0xcb3d('0x27'),_0xcb3d('0x28')]}},'raw':!![]})[_0xcb3d('0xc')](function(_0x315ed6){var _0x19835a={'user':_0x4663d4[_0xcb3d('0x29')]||0x0,'telephone':_0x4663d4['telephones']||0x0};_0x315ed6[_0xcb3d('0x2a')](function(_0x17dcb7){var _0x2d1044=_0x17dcb7[_0xcb3d('0x22')]===_0xcb3d('0x26')?_0xcb3d('0x27'):_0x17dcb7[_0xcb3d('0x22')];_0x19835a[_0x2d1044]-=_0x17dcb7['count'];if(_0x19835a[_0x2d1044]<0x0)_0x19835a[_0x2d1044]=0x0;});_0x46d098(_0x19835a);return;});})[_0xcb3d('0xd')](function(_0x3bee9a){_0x5dbf3c(_0x3bee9a);});});}function checkUserLimits(_0x4c9df1){return new BPromise(function(_0x574106,_0x2525d3){getLimits()['then'](function(_0x2cf172){var _0x373c21=_[_0xcb3d('0x2b')](_[_0xcb3d('0x2c')](_0x4c9df1,_0xcb3d('0x22')),[_0xcb3d('0x26'),_0xcb3d('0x27'),_0xcb3d('0x28')]);var _0x236481=(_0x373c21[_0xcb3d('0x26')]||0x0)+(_0x373c21[_0xcb3d('0x27')]||0x0);var _0x42dd41=_0x373c21[_0xcb3d('0x28')]||0x0;if(_0x236481>_0x2cf172[_0xcb3d('0x27')])return _0x2525d3(_0xcb3d('0x2d'));if(_0x42dd41>_0x2cf172[_0xcb3d('0x28')])return _0x2525d3(_0xcb3d('0x2e'));return _0x574106();})[_0xcb3d('0xd')](function(_0x1fb0b6){_0x2525d3(_0x1fb0b6);});});}module[_0xcb3d('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0872=['data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','disabled','User','role','sequelize','count','admin','user','users','telephones','forEach','pick','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','uuid','license','isEmpty'];(function(_0x1b4841,_0x5257ab){var _0x1bace3=function(_0x4f48ff){while(--_0x4f48ff){_0x1b4841['push'](_0x1b4841['shift']());}};_0x1bace3(++_0x5257ab);}(_0x0872,0x74));var _0x2087=function(_0x2685c5,_0x4876c5){_0x2685c5=_0x2685c5-0x0;var _0x5775ec=_0x0872[_0x2685c5];return _0x5775ec;};'use strict';var util=require(_0x2087('0x0'));var _=require(_0x2087('0x1'));var moment=require(_0x2087('0x2'));var BPromise=require(_0x2087('0x3'));var hardware=require('./hardware');var encryptor=require(_0x2087('0x4'));var db=require(_0x2087('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2087('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2087('0x7'),'machineUuid':hardware[_0x2087('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2087('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x2087('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x42eab7){return new BPromise(function(_0x5a0fdf,_0x2f6c61){return db['License'][_0x2087('0x9')](_[_0x2087('0xa')](_0x42eab7,{'raw':!![],'where':{'id':0x1}}))[_0x2087('0xb')](function(_0x474004){return checkLicense(_0x474004,null);})[_0x2087('0xb')](function(_0x1e1eb2){_0x5a0fdf(_0x1e1eb2);return;})[_0x2087('0xc')](function(_0x5b4e30){_0x2f6c61(_0x5b4e30);});});}function checkLicense(_0x5e8b3b,_0x22d13e){if(!_0x5e8b3b){demoLicense[_0x2087('0xd')]=_0x5e8b3b['data1'];return demoLicense;}try{var _0x3335e3=_0x22d13e||_0x5e8b3b[_0x2087('0xe')];if(_[_0x2087('0xf')](_0x3335e3)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5e4bc7=_0x5e8b3b[_0x2087('0x10')];var _0x12dd2b=_0x5e8b3b[_0x2087('0x11')];var _0x3dfecc=_0x5e4bc7[_0x2087('0x12')]('-')[0x4];var _0x558441=_0x5e4bc7[_0x2087('0x12')]('-')[0x0];var _0x4eb69c=encryptor[_0x2087('0x13')](_0x3335e3,util[_0x2087('0x14')](_0x2087('0x15'),_0x3dfecc,_0x5e4bc7,_0x558441));var _0x48a4b8=JSON[_0x2087('0x16')](_0x4eb69c);_0x48a4b8[_0x2087('0x17')]=![];_0x48a4b8['uuid']=_0x5e4bc7;_0x48a4b8[_0x2087('0x18')]=hardware[_0x2087('0x8')]();if(_0x12dd2b){var _0x3e2450=encryptor['decryptString'](_0x12dd2b);_0x48a4b8['gray']=_0x3e2450;_0x48a4b8[_0x2087('0x19')]=moment(_0x3e2450)[_0x2087('0x1a')](0x7,_0x2087('0x1b'))[_0x2087('0x14')]();_0x48a4b8[_0x2087('0x1c')]=_0x48a4b8[_0x2087('0xd')]!=_0x48a4b8[_0x2087('0x18')]?'changed':_0x2087('0x1d');}return _0x48a4b8;}catch(_0x5ca2ae){breakingLicense[_0x2087('0xd')]=_0x5e8b3b['data1'];breakingLicense['message']=_0x5ca2ae['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1b051c,_0x328f63){getLicense()['then'](function(_0xb76a58){return db[_0x2087('0x1e')]['findAll']({'attributes':[_0x2087('0x1f'),[db[_0x2087('0x20')]['fn']('COUNT',db[_0x2087('0x20')]['col']('role')),_0x2087('0x21')]],'group':_0x2087('0x1f'),'where':{'role':{'$or':[_0x2087('0x22'),_0x2087('0x23'),'telephone']}},'raw':!![]})[_0x2087('0xb')](function(_0x420d97){var _0x3fe075={'user':_0xb76a58[_0x2087('0x24')]||0x0,'telephone':_0xb76a58[_0x2087('0x25')]||0x0};_0x420d97[_0x2087('0x26')](function(_0x1a2ea5){var _0x37a715=_0x1a2ea5['role']==='admin'?_0x2087('0x23'):_0x1a2ea5[_0x2087('0x1f')];_0x3fe075[_0x37a715]-=_0x1a2ea5[_0x2087('0x21')];if(_0x3fe075[_0x37a715]<0x0)_0x3fe075[_0x37a715]=0x0;});_0x1b051c(_0x3fe075);return;});})['catch'](function(_0x4ad50a){_0x328f63(_0x4ad50a);});});}function checkUserLimits(_0x4f8022){return new BPromise(function(_0x161ab0,_0x12b153){getLimits()[_0x2087('0xb')](function(_0x200e08){var _0x217ea3=_[_0x2087('0x27')](_['countBy'](_0x4f8022,_0x2087('0x1f')),[_0x2087('0x22'),_0x2087('0x23'),_0x2087('0x28')]);var _0x13b860=(_0x217ea3['admin']||0x0)+(_0x217ea3[_0x2087('0x23')]||0x0);var _0x594a28=_0x217ea3[_0x2087('0x28')]||0x0;if(_0x13b860>_0x200e08[_0x2087('0x23')])return _0x12b153(_0x2087('0x29'));if(_0x594a28>_0x200e08['telephone'])return _0x12b153(_0x2087('0x2a'));return _0x161ab0();})[_0x2087('0xc')](function(_0x430c52){_0x12b153(_0x430c52);});});}module[_0x2087('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 235be0a..562dcfb 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 _0x2edc=['secret','exports','myappanuglar-secret','app-id'];(function(_0x275c2b,_0x36eb55){var _0xb9ec67=function(_0x1147b0){while(--_0x1147b0){_0x275c2b['push'](_0x275c2b['shift']());}};_0xb9ec67(++_0x36eb55);}(_0x2edc,0x1d5));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xc2ed('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xc2ed('0x1'),'GOOGLE_ID':_0xc2ed('0x2'),'GOOGLE_SECRET':_0xc2ed('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x553d=['app-id','secret','exports','myappanuglar-secret'];(function(_0x356b1e,_0x16e9fe){var _0x31719b=function(_0x861e61){while(--_0x861e61){_0x356b1e['push'](_0x356b1e['shift']());}};_0x31719b(++_0x16e9fe);}(_0x553d,0x192));var _0xd553=function(_0x5b1d52,_0x3fb8a9){_0x5b1d52=_0x5b1d52-0x0;var _0x4f6759=_0x553d[_0x5b1d52];return _0x4f6759;};'use strict';module[_0xd553('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xd553('0x1'),'GOOGLE_ID':_0xd553('0x2'),'GOOGLE_SECRET':_0xd553('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 4cd2415..de7d881 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae3c=['File','%s-%s','error','info','env','winston','util','path','INFO','join','/var','log','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports'];(function(_0x533bd4,_0x2826d4){var _0x3089f7=function(_0x510a52){while(--_0x510a52){_0x533bd4['push'](_0x533bd4['shift']());}};_0x3089f7(++_0x2826d4);}(_0xae3c,0x8f));var _0xcae3=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xae3c[_0x602ca8];return _0x26e8ab;};'use strict';var moment=require('moment');var winston=require(_0xcae3('0x0'));var util=require(_0xcae3('0x1'));var path=require(_0xcae3('0x2'));var debugLevel=_0xcae3('0x3');function filename(_0x227b6d,_0x279f88){return path[_0xcae3('0x4')](_0xcae3('0x5'),_0xcae3('0x6'),'xcally',util['format'](_0xcae3('0x7'),_0x227b6d,_0x279f88));}function formatter(_0x56de99,_0x2fe7db){_0x2fe7db[_0xcae3('0x8')]=_0x2fe7db[_0xcae3('0x8')][_0xcae3('0x9')](/@@{/g,'{{{')[_0xcae3('0x9')](/}@@/g,'}}}')[_0xcae3('0x9')](/@{/g,'{{')[_0xcae3('0x9')](/}@/g,'}}');return util['format'](_0xcae3('0xa'),moment()[_0xcae3('0xb')](_0xcae3('0xc')),_0x2fe7db[_0xcae3('0xd')][_0xcae3('0xe')](),_0x56de99,_0x2fe7db['message']);}module[_0xcae3('0xf')]=function(_0x3675dc){return new winston[(_0xcae3('0x10'))]({'transports':[new winston[(_0xcae3('0x11'))][(_0xcae3('0x12'))]({'name':util[_0xcae3('0xb')](_0xcae3('0x13'),_0x3675dc,'error'),'filename':filename(_0x3675dc,_0xcae3('0x14')),'level':_0xcae3('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x41a58c){return formatter(_0x3675dc,_0x41a58c);}}),new winston[(_0xcae3('0x11'))][(_0xcae3('0x12'))]({'name':util['format'](_0xcae3('0x13'),_0x3675dc,_0xcae3('0x15')),'filename':filename(_0x3675dc,_0xcae3('0x15')),'level':_0xcae3('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5efb5b){return formatter(_0x3675dc,_0x5efb5b);}}),new winston['transports']['Console']({'level':process[_0xcae3('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x20fbac){return formatter(_0x3675dc,_0x20fbac);}})]});}; \ No newline at end of file +var _0xf93f=['error','info','Console','env','moment','winston','path','INFO','join','log','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File'];(function(_0x39c7eb,_0x4e4d57){var _0x74c7af=function(_0xd8d704){while(--_0xd8d704){_0x39c7eb['push'](_0x39c7eb['shift']());}};_0x74c7af(++_0x4e4d57);}(_0xf93f,0x19c));var _0xff93=function(_0x56f7b5,_0x3441e8){_0x56f7b5=_0x56f7b5-0x0;var _0x27f3d5=_0xf93f[_0x56f7b5];return _0x27f3d5;};'use strict';var moment=require(_0xff93('0x0'));var winston=require(_0xff93('0x1'));var util=require('util');var path=require(_0xff93('0x2'));var debugLevel=_0xff93('0x3');function filename(_0xc9cc8,_0xb6365a){return path[_0xff93('0x4')]('/var',_0xff93('0x5'),'xcally',util[_0xff93('0x6')](_0xff93('0x7'),_0xc9cc8,_0xb6365a));}function formatter(_0x319d56,_0x526987){_0x526987[_0xff93('0x8')]=_0x526987[_0xff93('0x8')][_0xff93('0x9')](/@@{/g,_0xff93('0xa'))[_0xff93('0x9')](/}@@/g,_0xff93('0xb'))[_0xff93('0x9')](/@{/g,'{{')[_0xff93('0x9')](/}@/g,'}}');return util[_0xff93('0x6')](_0xff93('0xc'),moment()[_0xff93('0x6')](_0xff93('0xd')),_0x526987[_0xff93('0xe')][_0xff93('0xf')](),_0x319d56,_0x526987[_0xff93('0x8')]);}module[_0xff93('0x10')]=function(_0x528e87){return new winston[(_0xff93('0x11'))]({'transports':[new winston[(_0xff93('0x12'))][(_0xff93('0x13'))]({'name':util['format']('%s-%s',_0x528e87,_0xff93('0x14')),'filename':filename(_0x528e87,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x329999){return formatter(_0x528e87,_0x329999);}}),new winston[(_0xff93('0x12'))]['File']({'name':util[_0xff93('0x6')]('%s-%s',_0x528e87,'info'),'filename':filename(_0x528e87,_0xff93('0x15')),'level':_0xff93('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x89cb1e){return formatter(_0x528e87,_0x89cb1e);}}),new winston['transports'][(_0xff93('0x16'))]({'level':process[_0xff93('0x17')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x298724){return formatter(_0x528e87,_0x298724);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e7674e4..94f308e 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 _0x27f9=['xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0x27f9,0x73));var _0x927f=function(_0x295c29,_0xe406c7){_0x295c29=_0x295c29-0x0;var _0x515488=_0x27f9[_0x295c29];return _0x515488;};'use strict';var path=require(_0x927f('0x0'));var os=require('os');var config={'apps':[{'name':_0x927f('0x1'),'script':path['join'](__dirname,_0x927f('0x2'))},{'name':_0x927f('0x3'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0x5'))},{'name':_0x927f('0x6'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0x7'))},{'name':_0x927f('0x8'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0x9'))},{'name':'routing','script':path[_0x927f('0x4')](__dirname,_0x927f('0xa'))},{'name':_0x927f('0xb'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0xc'))}]};module[_0x927f('0xd')]=config; \ No newline at end of file +var _0xaf73=['../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x47ae42,_0x545f7b){var _0x2db4a4=function(_0x21d715){while(--_0x21d715){_0x47ae42['push'](_0x47ae42['shift']());}};_0x2db4a4(++_0x545f7b);}(_0xaf73,0x1ec));var _0x3af7=function(_0xc71238,_0x6d0834){_0xc71238=_0xc71238-0x0;var _0x3bc59b=_0xaf73[_0xc71238];return _0x3bc59b;};'use strict';var path=require(_0x3af7('0x0'));var os=require('os');var config={'apps':[{'name':_0x3af7('0x1'),'script':path[_0x3af7('0x2')](__dirname,_0x3af7('0x3'))},{'name':'ami','script':path[_0x3af7('0x2')](__dirname,_0x3af7('0x4'))},{'name':_0x3af7('0x5'),'script':path['join'](__dirname,_0x3af7('0x6'))},{'name':_0x3af7('0x7'),'script':path[_0x3af7('0x2')](__dirname,_0x3af7('0x8'))},{'name':_0x3af7('0x9'),'script':path[_0x3af7('0x2')](__dirname,_0x3af7('0xa'))},{'name':_0x3af7('0xb'),'script':path['join'](__dirname,_0x3af7('0xc'))}]};module[_0x3af7('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2ea5746..b4c57b8 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 _0xbe2a=['restart','list','describe','delete','saved','pm2','bluebird','./config','connect','start','then','stop','disconnect'];(function(_0x29d750,_0x5cf499){var _0xaa8783=function(_0x1657db){while(--_0x1657db){_0x29d750['push'](_0x29d750['shift']());}};_0xaa8783(++_0x5cf499);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x339594,_0x4a6501){_0x339594=_0x339594-0x0;var _0x105d62=_0xbe2a[_0x339594];return _0x105d62;};'use strict';var pm2=require(_0xabe2('0x0'));var BPromise=require(_0xabe2('0x1'));var config=require(_0xabe2('0x2'));function connect(){return new BPromise(function(_0x101aac,_0x29d9a3){return pm2[_0xabe2('0x3')](function(_0x21e3ad){if(_0x21e3ad){return _0x29d9a3(_0x21e3ad);}return _0x101aac('connected');});});};exports[_0xabe2('0x4')]=function(_0x4f80bf){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x349bfd,_0x2ddf42){return pm2[_0xabe2('0x4')](_0x4f80bf,function(_0x3538a0,_0x138e22){if(_0x3538a0){return _0x2ddf42(_0x3538a0);}pm2['disconnect']();return _0x349bfd(_0x138e22);});});});};exports[_0xabe2('0x6')]=function(_0x1f10d7){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x432061,_0x229ac0){return pm2[_0xabe2('0x6')](_0x1f10d7,function(_0x53a91f,_0x27fbaa){if(_0x53a91f){return _0x229ac0(_0x53a91f);}pm2[_0xabe2('0x7')]();return _0x432061(_0x27fbaa);});});});};exports[_0xabe2('0x8')]=function(_0x546445){return connect()['then'](function(){return new BPromise(function(_0x5742c5,_0x33f1ac){return pm2['restart'](_0x546445,function(_0x10c3f3,_0x26febe){if(_0x10c3f3){return _0x33f1ac(_0x10c3f3);}pm2['disconnect']();return _0x5742c5(_0x26febe);});});});};exports['list']=function(){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x4303eb,_0xc8d55d){return pm2[_0xabe2('0x9')](function(_0x7aaa50,_0xb8343d){if(_0x7aaa50){return _0xc8d55d(_0x7aaa50);}pm2[_0xabe2('0x7')]();return _0x4303eb(_0xb8343d);});});});};exports[_0xabe2('0xa')]=function(_0x4196fd){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x5320d9,_0x3dd6d9){return pm2[_0xabe2('0xa')](_0x4196fd,function(_0x3eb2b2,_0x50f335){if(_0x3eb2b2){return _0x3dd6d9(_0x3eb2b2);}pm2[_0xabe2('0x7')]();return _0x5320d9(_0x50f335);});});});};exports[_0xabe2('0xb')]=function(_0x90ee5e){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x49c4c3,_0x190b08){return pm2[_0xabe2('0xb')](_0x90ee5e,function(_0x50a49a,_0x3e4c85){if(_0x50a49a){return _0x190b08(_0x50a49a);}pm2[_0xabe2('0x7')]();return _0x49c4c3(_0x3e4c85);});});});};exports['dump']=function(){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x3efadc,_0x2906f4){return pm2['dump'](function(_0x2004d4){if(_0x2004d4){return _0x2906f4(_0x2004d4);}return _0x3efadc(_0xabe2('0xc'));});});});}; \ No newline at end of file +var _0x3f27=['disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connected','start','then','stop'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x3f27,0x1f4));var _0x73f2=function(_0x44845c,_0x2a62f8){_0x44845c=_0x44845c-0x0;var _0xd38a03=_0x3f27[_0x44845c];return _0xd38a03;};'use strict';var pm2=require(_0x73f2('0x0'));var BPromise=require(_0x73f2('0x1'));var config=require(_0x73f2('0x2'));function connect(){return new BPromise(function(_0x833cdd,_0x329305){return pm2['connect'](function(_0x22480a){if(_0x22480a){return _0x329305(_0x22480a);}return _0x833cdd(_0x73f2('0x3'));});});};exports['start']=function(_0x56d5f3){return connect()['then'](function(){return new BPromise(function(_0x3adbeb,_0x54631b){return pm2[_0x73f2('0x4')](_0x56d5f3,function(_0x4aa8ec,_0x10af7a){if(_0x4aa8ec){return _0x54631b(_0x4aa8ec);}pm2['disconnect']();return _0x3adbeb(_0x10af7a);});});});};exports['stop']=function(_0xa2ea48){return connect()[_0x73f2('0x5')](function(){return new BPromise(function(_0x222576,_0x3bf117){return pm2[_0x73f2('0x6')](_0xa2ea48,function(_0x47195c,_0x5af532){if(_0x47195c){return _0x3bf117(_0x47195c);}pm2[_0x73f2('0x7')]();return _0x222576(_0x5af532);});});});};exports[_0x73f2('0x8')]=function(_0x397596){return connect()['then'](function(){return new BPromise(function(_0x48e825,_0x50ee1f){return pm2[_0x73f2('0x8')](_0x397596,function(_0x3a9d06,_0x20d4f3){if(_0x3a9d06){return _0x50ee1f(_0x3a9d06);}pm2[_0x73f2('0x7')]();return _0x48e825(_0x20d4f3);});});});};exports[_0x73f2('0x9')]=function(){return connect()[_0x73f2('0x5')](function(){return new BPromise(function(_0x41f588,_0x481776){return pm2['list'](function(_0x469686,_0x45e8e0){if(_0x469686){return _0x481776(_0x469686);}pm2['disconnect']();return _0x41f588(_0x45e8e0);});});});};exports['describe']=function(_0x2c0720){return connect()[_0x73f2('0x5')](function(){return new BPromise(function(_0x2a1ac6,_0x262f51){return pm2[_0x73f2('0xa')](_0x2c0720,function(_0x32ed42,_0x32e9c6){if(_0x32ed42){return _0x262f51(_0x32ed42);}pm2[_0x73f2('0x7')]();return _0x2a1ac6(_0x32e9c6);});});});};exports[_0x73f2('0xb')]=function(_0x178633){return connect()[_0x73f2('0x5')](function(){return new BPromise(function(_0x16183f,_0x2546a0){return pm2['delete'](_0x178633,function(_0x33c0f1,_0x34b11e){if(_0x33c0f1){return _0x2546a0(_0x33c0f1);}pm2[_0x73f2('0x7')]();return _0x16183f(_0x34b11e);});});});};exports[_0x73f2('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1a75d3,_0x35c21d){return pm2[_0x73f2('0xc')](function(_0x2ae791){if(_0x2ae791){return _0x35c21d(_0x2ae791);}return _0x1a75d3('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 261827c..70ddf37 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 _0xd4c5=['schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','inspect','start','lodash','ioredis','util','../../mysqldb','../logger'];(function(_0x490d5d,_0x40616d){var _0x4ff3b8=function(_0x845278){while(--_0x845278){_0x490d5d['push'](_0x490d5d['shift']());}};_0x4ff3b8(++_0x40616d);}(_0xd4c5,0x83));var _0x5d4c=function(_0x314aec,_0x5e4fdf){_0x314aec=_0x314aec-0x0;var _0x2e334f=_0xd4c5[_0x314aec];return _0x2e334f;};'use strict';var _=require(_0x5d4c('0x0'));var moment=require('moment');var Redis=require(_0x5d4c('0x1'));var util=require(_0x5d4c('0x2'));var config=require('../../config/environment');var db=require(_0x5d4c('0x3'))['db'];var logger=require(_0x5d4c('0x4'))(_0x5d4c('0x5'));config[_0x5d4c('0x6')]=_[_0x5d4c('0x7')](config[_0x5d4c('0x6')],{'host':_0x5d4c('0x8'),'port':0x18eb});var io=require(_0x5d4c('0x9'))(new Redis(config[_0x5d4c('0x6')]));function closeInteractions(){var _0x12300b=0x0;var _0x1f7a66=[];return db[_0x5d4c('0xa')][_0x5d4c('0xb')]({'raw':!![],'attributes':['id',_0x5d4c('0xc')],'where':{'id':0x1}})[_0x5d4c('0xd')](function(_0x5a79ec){_0x12300b=_0x5a79ec[_0x5d4c('0xc')];if(_0x12300b){return db['ChatInteraction'][_0x5d4c('0xe')]({'raw':!![],'attributes':['id',_0x5d4c('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5d4c('0x10')](_0x5a79ec[_0x5d4c('0xc')],_0x5d4c('0x11'))}}});}else{return[];}})[_0x5d4c('0xd')](function(_0x1c028d){if(_0x1c028d&&_0x1c028d[_0x5d4c('0x12')]){_0x1f7a66=_['map'](_0x1c028d||[],'id');logger[_0x5d4c('0x13')](_0x5d4c('0x14'),_0x1f7a66['join']());return db[_0x5d4c('0x15')][_0x5d4c('0x16')]({'closeReason':_0x5d4c('0x17'),'disposition':_0x5d4c('0x18'),'closed':!![],'closedAt':moment()['format'](_0x5d4c('0x19'))},{'where':{'id':_0x1f7a66}});}})[_0x5d4c('0xd')](function(){if(_0x1f7a66&&_0x1f7a66[_0x5d4c('0x12')]){logger[_0x5d4c('0x13')](_0x5d4c('0x1a'),_0x1f7a66[_0x5d4c('0x1b')]());for(var _0x20ce44=0x0;_0x20ce44<_0x1f7a66[_0x5d4c('0x12')];_0x20ce44++){io[_0x5d4c('0x1c')](_0x5d4c('0x1d'),{'id':_0x1f7a66[_0x20ce44],'closed':!![]});}}})[_0x5d4c('0x1e')](function(_0xfbf03f){logger[_0x5d4c('0x1f')]('[CHAT]\x20Error\x20closing\x20interactions',_0xfbf03f?util[_0x5d4c('0x20')](_0xfbf03f,{'showHidden':![],'depth':null}):'');});}exports[_0x5d4c('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7eb8=['redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','info','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','length','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x3db17b,_0x154758){var _0x40035f=function(_0x58853c){while(--_0x58853c){_0x3db17b['push'](_0x3db17b['shift']());}};_0x40035f(++_0x154758);}(_0x7eb8,0x1cc));var _0x87eb=function(_0x4ab028,_0x5a3ac4){_0x4ab028=_0x4ab028-0x0;var _0x4930ec=_0x7eb8[_0x4ab028];return _0x4930ec;};'use strict';var _=require(_0x87eb('0x0'));var moment=require(_0x87eb('0x1'));var Redis=require(_0x87eb('0x2'));var util=require(_0x87eb('0x3'));var config=require(_0x87eb('0x4'));var db=require(_0x87eb('0x5'))['db'];var logger=require(_0x87eb('0x6'))(_0x87eb('0x7'));config[_0x87eb('0x8')]=_[_0x87eb('0x9')](config[_0x87eb('0x8')],{'host':_0x87eb('0xa'),'port':0x18eb});var io=require(_0x87eb('0xb'))(new Redis(config[_0x87eb('0x8')]));function closeInteractions(){var _0x397a0d=0x0;var _0x4b24ed=[];return db[_0x87eb('0xc')][_0x87eb('0xd')]({'raw':!![],'attributes':['id',_0x87eb('0xe')],'where':{'id':0x1}})['then'](function(_0x440c9f){_0x397a0d=_0x440c9f[_0x87eb('0xe')];if(_0x397a0d){return db[_0x87eb('0xf')][_0x87eb('0x10')]({'raw':!![],'attributes':['id',_0x87eb('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x87eb('0x12')](_0x440c9f[_0x87eb('0xe')],_0x87eb('0x13'))}}});}else{return[];}})[_0x87eb('0x14')](function(_0x41aaab){if(_0x41aaab&&_0x41aaab['length']){_0x4b24ed=_[_0x87eb('0x15')](_0x41aaab||[],'id');logger[_0x87eb('0x16')]('[CHAT]\x20Interactions\x20to\x20close:',_0x4b24ed['join']());return db[_0x87eb('0xf')][_0x87eb('0x17')]({'closeReason':'system','disposition':_0x87eb('0x18'),'closed':!![],'closedAt':moment()[_0x87eb('0x19')](_0x87eb('0x1a'))},{'where':{'id':_0x4b24ed}});}})[_0x87eb('0x14')](function(){if(_0x4b24ed&&_0x4b24ed['length']){logger['info'](_0x87eb('0x1b'),_0x4b24ed[_0x87eb('0x1c')]());for(var _0x371b6c=0x0;_0x371b6c<_0x4b24ed[_0x87eb('0x1d')];_0x371b6c++){io[_0x87eb('0x1e')](_0x87eb('0x1f'),{'id':_0x4b24ed[_0x371b6c],'closed':!![]});}}})['catch'](function(_0x5760c2){logger[_0x87eb('0x20')](_0x87eb('0x21'),_0x5760c2?util[_0x87eb('0x22')](_0x5760c2,{'showHidden':![],'depth':null}):'');});}exports[_0x87eb('0x23')]=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 96f9700..c4914eb 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 _0x4378=['runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','add','start','add\x20cron','stop','length','endAt','update','update\x20cron','stop\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','MailAccount','service','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','status','message','attachments','text','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s'];(function(_0x5e4b35,_0x4d0efd){var _0x220bde=function(_0xa4f167){while(--_0xa4f167){_0x5e4b35['push'](_0x5e4b35['shift']());}};_0x220bde(++_0x4d0efd);}(_0x4378,0x7d));var _0x8437=function(_0x25a6c4,_0x13ab61){_0x25a6c4=_0x25a6c4-0x0;var _0x9ae4b4=_0x4378[_0x25a6c4];return _0x9ae4b4;};'use strict';var fs=require('fs');var util=require(_0x8437('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x8437('0x1'));var CronJobManager=require(_0x8437('0x2'));var jayson=require(_0x8437('0x3'));var BPromise=require(_0x8437('0x4'));var logger=require(_0x8437('0x5'))(_0x8437('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x8437('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x8437('0x8')][_0x8437('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x504b7f,_0xf613e){return function(){logger['info'](_0x8437('0xa'),_0x504b7f[_0x8437('0xb')]);var _0x4e1942=!![];var _0x5924a4={'tls':{'rejectUnauthorized':![]}};if(_0x504b7f['MailAccount'][_0x8437('0xc')]['service']){_0x5924a4['service']=_0x504b7f[_0x8437('0xd')]['Smtp'][_0x8437('0xe')];}else{_0x5924a4['host']=_0x504b7f[_0x8437('0xd')]['Smtp']['host'];_0x5924a4['port']=_0x504b7f[_0x8437('0xd')][_0x8437('0xc')][_0x8437('0xf')];_0x5924a4[_0x8437('0x10')]=_0x504b7f['MailAccount'][_0x8437('0xc')][_0x8437('0x10')];}if(_0x504b7f[_0x8437('0xd')][_0x8437('0xc')][_0x8437('0x11')]){_0x5924a4[_0x8437('0x12')]={'user':_0x504b7f[_0x8437('0xd')][_0x8437('0xc')][_0x8437('0x13')],'pass':_0x504b7f[_0x8437('0xd')]['Smtp'][_0x8437('0x14')]};}var _0x185bba={'account':_0x5924a4,'message':{'from':util[_0x8437('0x15')](_0x8437('0x16'),_0x504b7f[_0x8437('0xd')][_0x8437('0x17')],_0x504b7f[_0x8437('0xd')]['email']||_0x504b7f[_0x8437('0xd')]['Smtp'][_0x8437('0x13')]),'to':_0x504b7f[_0x8437('0xb')],'cc':_0x504b7f['cc'],'bcc':_0x504b7f['bcc'],'subject':util[_0x8437('0x15')](_0x8437('0x18'),_0xf613e['name'],_0x504b7f['subtractNumber'],_0x504b7f[_0x8437('0x19')])}};var _0x592264=path[_0x8437('0x1a')](__dirname,_0x8437('0x1b'));var _0x275872=_0xf613e[_0x8437('0x1c')];var _0x4b4263=util[_0x8437('0x15')](_0x8437('0x1d'),path['basename'](_0xf613e[_0x8437('0x1c')],path[_0x8437('0x1e')](_0xf613e[_0x8437('0x1c')])),'zip');var _0x1043ed=path['join'](_0x592264,_0x275872);var _0x373e1d=path[_0x8437('0x1a')](_0x592264,_0x4b4263);if(fs['existsSync'](_0x1043ed)){_0xf613e[_0x8437('0x1f')]='Sent';_0x185bba[_0x8437('0x20')][_0x8437('0x21')]=[{'filename':_0x275872,'path':_0x1043ed}];_0x185bba[_0x8437('0x20')][_0x8437('0x22')]=util[_0x8437('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0xf613e,null,0x2));}else if(fs['existsSync'](_0x373e1d)){_0xf613e['status']=_0x8437('0x23');_0x185bba[_0x8437('0x20')][_0x8437('0x21')]=[{'filename':_0x4b4263,'path':_0x373e1d}];}else{_0x185bba[_0x8437('0x20')]['text']=_0x8437('0x24');if(!_0x504b7f[_0x8437('0x25')]){_0x4e1942=![];logger[_0x8437('0x26')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x4e1942){return client[_0x8437('0x27')](_0x8437('0x28'),_0x185bba)[_0x8437('0x29')](function(_0x13d9cc){if(_0x13d9cc[_0x8437('0x2a')]){return logger[_0x8437('0x2a')](_0x8437('0x2b'),JSON[_0x8437('0x2c')](_0x13d9cc));}return logger[_0x8437('0x26')](_0x8437('0x2d'));})[_0x8437('0x2e')](function(_0x3d65f6){return logger[_0x8437('0x2a')]('error\x20mail',JSON[_0x8437('0x2c')](_0x3d65f6));});}};}function handleError(){return function(_0x39c694){return logger[_0x8437('0x2a')](JSON[_0x8437('0x2c')](_0x39c694));};}function handleResult(_0x5dfa2e){return function(_0x30bc01){logger[_0x8437('0x26')](_0x8437('0x2f'),JSON[_0x8437('0x2c')](_0x30bc01));if(_0x5dfa2e[_0x8437('0xd')]&&_0x5dfa2e['MailAccount'][_0x8437('0xc')]&&!_[_0x8437('0x30')](_0x5dfa2e[_0x8437('0xb')])){setTimeout(handleSendEmail(_0x5dfa2e,_0x30bc01),0x3c*0x3e8);}};}function handleJob(_0x4da334){return function(){try{if(_[_0x8437('0x30')](_0x4da334['subtractNumber'])){return logger[_0x8437('0x26')](_0x8437('0x31'));}if(_[_0x8437('0x30')](_0x4da334['subtractUnit'])){return logger[_0x8437('0x26')](_0x8437('0x32'));}var _0x10cf99={'startDate':moment()[_0x8437('0x33')](_0x4da334[_0x8437('0x34')],_0x4da334[_0x8437('0x19')])[_0x8437('0x15')](_0x8437('0x35')),'endDate':moment()[_0x8437('0x15')](_0x8437('0x35')),'type':_0x8437('0x36'),'output':_0x4da334['output'],'name':_0x4da334[_0x8437('0x17')]};if(!_[_0x8437('0x30')](_0x4da334[_0x8437('0x37')])){logger[_0x8437('0x26')](_0x8437('0x38'),_0x4da334[_0x8437('0x37')]);return analyticDefaultReportController[_0x8437('0x39')]({'id':_0x4da334[_0x8437('0x37')]},_0x10cf99)[_0x8437('0x29')](handleResult(_0x4da334))[_0x8437('0x2e')](handleError());}if(!_[_0x8437('0x30')](_0x4da334[_0x8437('0x3a')])){logger[_0x8437('0x26')](_0x8437('0x3b'),_0x4da334[_0x8437('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x4da334[_0x8437('0x3a')]},_0x10cf99)[_0x8437('0x29')](handleResult(_0x4da334))[_0x8437('0x2e')](handleError());}}catch(_0x38be87){logger['error'](JSON['stringify'](_0x38be87));}return logger['info'](_0x8437('0x3c'));};}function getJobs(_0x2d27dc){var _0x31fce={};if(_0x2d27dc){_0x31fce['id']=_0x2d27dc;}return db[_0x8437('0x3d')][_0x8437('0x3e')]({'where':_0x31fce,'include':[{'model':db['MailAccount'],'attributes':['id',_0x8437('0x17'),_0x8437('0xb')],'include':[{'model':db[_0x8437('0x3f')],'as':'Smtp'}]}]})[_0x8437('0x29')](function(_0x7465b){var _0x1aabf0=_[_0x8437('0x40')](manager[_0x8437('0x41')]);var _0x7792db=_[_0x8437('0x42')](_0x7465b,function(_0x12577b){return _0x12577b['id'][_0x8437('0x43')]();});var _0x1144cc=_[_0x8437('0x44')](_0x7465b,function(_0x2659cc){return _0x2659cc['id']['toString']();});var _0xdcb7e9=_0x2d27dc?_0x7792db:_[_0x8437('0x45')](_0x7792db,_0x1aabf0);var _0x3233df=_[_0x8437('0x46')](_0x7792db,_0x1aabf0);var _0x31ad78=_[_0x8437('0x45')](_0x1aabf0,_0x7792db);var _0xd78456;var _0x4e5c82;for(_0xd78456=0x0;_0xd78456<_0x31ad78['length']&&!_0x2d27dc;_0xd78456+=0x1){_0x4e5c82=_0x31ad78[_0xd78456][_0x8437('0x43')]();if(manager[_0x8437('0x47')](_0x4e5c82)){manager['stop'](_0x4e5c82);manager[_0x8437('0x48')](_0x4e5c82);logger[_0x8437('0x26')](_0x8437('0x49'),_0x4e5c82);}}logger['info'](_0x8437('0x4a'),JSON[_0x8437('0x2c')](_0xdcb7e9));for(_0xd78456=0x0;_0xd78456<_0xdcb7e9['length'];_0xd78456+=0x1){_0x4e5c82=_0xdcb7e9[_0xd78456]['toString']();logger[_0x8437('0x26')](_0x8437('0x4b'),_0x4e5c82);if(_0x2d27dc){logger['info'](_0x8437('0x4c'),_0x2d27dc);logger[_0x8437('0x26')](JSON['stringify'](_0x1144cc[_0x4e5c82]));BPromise[_0x8437('0x4d')]()[_0x8437('0x29')](handleJob(_0x1144cc[_0x4e5c82]));logger[_0x8437('0x26')]('run\x20job',_0x1144cc[_0x4e5c82]['name'],_0x1144cc[_0x4e5c82]['cron']);}else if(_0x1144cc[_0x4e5c82][_0x8437('0x4e')]&&_0x1144cc[_0x4e5c82][_0x8437('0x4f')]&&moment()[_0x8437('0x50')](_0x1144cc[_0x4e5c82]['startAt'],_0x1144cc[_0x4e5c82]['endAt'])){manager[_0x8437('0x51')](_0x4e5c82,_0x1144cc[_0x4e5c82][_0x8437('0x4e')],handleJob(_0x1144cc[_0x4e5c82]));manager[_0x8437('0x52')](_0x4e5c82);logger['info'](_0x8437('0x53'),_0x1144cc[_0x4e5c82]['name'],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}else if(manager[_0x8437('0x47')](_0x4e5c82)){manager[_0x8437('0x54')](_0x4e5c82);manager[_0x8437('0x48')](_0x4e5c82);logger['info']('stop\x20cron',_0x1144cc[_0x4e5c82][_0x8437('0x17')],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}}for(_0xd78456=0x0,_0x4e5c82;_0xd78456<_0x3233df[_0x8437('0x55')]&&!_0x2d27dc;_0xd78456+=0x1){_0x4e5c82=_0x3233df[_0xd78456][_0x8437('0x43')]();if(manager[_0x8437('0x47')](_0x4e5c82)){if(_0x1144cc[_0x4e5c82]['cron']&&_0x1144cc[_0x4e5c82][_0x8437('0x4f')]&&moment()[_0x8437('0x50')](_0x1144cc[_0x4e5c82]['startAt'],_0x1144cc[_0x4e5c82][_0x8437('0x56')])){manager[_0x8437('0x57')](_0x4e5c82,_0x1144cc[_0x4e5c82]['cron'],handleJob(_0x1144cc[_0x4e5c82]));logger[_0x8437('0x26')](_0x8437('0x58'),_0x1144cc[_0x4e5c82][_0x8437('0x17')],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}else{manager[_0x8437('0x54')](_0x4e5c82);manager['deleteJob'](_0x4e5c82);logger[_0x8437('0x26')](_0x8437('0x59'),_0x1144cc[_0x4e5c82][_0x8437('0x17')],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}}}})['catch'](function(_0x13c67a){logger[_0x8437('0x2a')](JSON[_0x8437('0x2c')](_0x13c67a));});}exports[_0x8437('0x5a')]=function(_0x2e5058){return getJobs(_0x2e5058);};exports[_0x8437('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x256a=['add','start','add\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','index','resolve','run\x20job','cron','isBetween','startAt','endAt'];(function(_0x2c46cf,_0x214bfe){var _0x301a2b=function(_0x4f9798){while(--_0x4f9798){_0x2c46cf['push'](_0x2c46cf['shift']());}};_0x301a2b(++_0x214bfe);}(_0x256a,0x174));var _0xa256=function(_0x530cf2,_0x1ea0b4){_0x530cf2=_0x530cf2-0x0;var _0x488ae5=_0x256a[_0x530cf2];return _0x488ae5;};'use strict';var fs=require('fs');var util=require(_0xa256('0x0'));var path=require(_0xa256('0x1'));var _=require('lodash');var moment=require(_0xa256('0x2'));var CronJobManager=require(_0xa256('0x3'));var jayson=require(_0xa256('0x4'));var BPromise=require(_0xa256('0x5'));var logger=require(_0xa256('0x6'))('schedule');var db=require(_0xa256('0x7'))['db'];var analyticCustomReportController=require(_0xa256('0x8'));var analyticDefaultReportController=require(_0xa256('0x9'));var client=jayson[_0xa256('0xa')][_0xa256('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1a0ab3,_0x5357e6){return function(){logger[_0xa256('0xc')](_0xa256('0xd'),_0x1a0ab3[_0xa256('0xe')]);var _0x2e8c1a=!![];var _0x3d22d6={'tls':{'rejectUnauthorized':![]}};if(_0x1a0ab3['MailAccount']['Smtp'][_0xa256('0xf')]){_0x3d22d6[_0xa256('0xf')]=_0x1a0ab3[_0xa256('0x10')][_0xa256('0x11')][_0xa256('0xf')];}else{_0x3d22d6[_0xa256('0x12')]=_0x1a0ab3['MailAccount']['Smtp'][_0xa256('0x12')];_0x3d22d6['port']=_0x1a0ab3[_0xa256('0x10')][_0xa256('0x11')]['port'];_0x3d22d6[_0xa256('0x13')]=_0x1a0ab3[_0xa256('0x10')][_0xa256('0x11')][_0xa256('0x13')];}if(_0x1a0ab3[_0xa256('0x10')][_0xa256('0x11')][_0xa256('0x14')]){_0x3d22d6[_0xa256('0x15')]={'user':_0x1a0ab3[_0xa256('0x10')][_0xa256('0x11')][_0xa256('0x16')],'pass':_0x1a0ab3[_0xa256('0x10')][_0xa256('0x11')][_0xa256('0x17')]};}var _0x6e0be4={'account':_0x3d22d6,'message':{'from':util['format'](_0xa256('0x18'),_0x1a0ab3[_0xa256('0x10')][_0xa256('0x19')],_0x1a0ab3[_0xa256('0x10')]['email']||_0x1a0ab3[_0xa256('0x10')]['Smtp'][_0xa256('0x16')]),'to':_0x1a0ab3[_0xa256('0xe')],'cc':_0x1a0ab3['cc'],'bcc':_0x1a0ab3[_0xa256('0x1a')],'subject':util[_0xa256('0x1b')](_0xa256('0x1c'),_0x5357e6[_0xa256('0x19')],_0x1a0ab3[_0xa256('0x1d')],_0x1a0ab3[_0xa256('0x1e')])}};var _0x16a28b=path[_0xa256('0x1f')](__dirname,'../../files/reports');var _0x364984=_0x5357e6[_0xa256('0x20')];var _0x4b8bb0=util[_0xa256('0x1b')](_0xa256('0x21'),path[_0xa256('0x22')](_0x5357e6[_0xa256('0x20')],path[_0xa256('0x23')](_0x5357e6[_0xa256('0x20')])),'zip');var _0x56c3a1=path[_0xa256('0x1f')](_0x16a28b,_0x364984);var _0x3e8632=path['join'](_0x16a28b,_0x4b8bb0);if(fs[_0xa256('0x24')](_0x56c3a1)){_0x5357e6[_0xa256('0x25')]=_0xa256('0x26');_0x6e0be4[_0xa256('0x27')][_0xa256('0x28')]=[{'filename':_0x364984,'path':_0x56c3a1}];_0x6e0be4[_0xa256('0x27')][_0xa256('0x29')]=util[_0xa256('0x1b')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xa256('0x2a')](_0x5357e6,null,0x2));}else if(fs['existsSync'](_0x3e8632)){_0x5357e6[_0xa256('0x25')]=_0xa256('0x26');_0x6e0be4[_0xa256('0x27')]['attachments']=[{'filename':_0x4b8bb0,'path':_0x3e8632}];}else{_0x6e0be4[_0xa256('0x27')][_0xa256('0x29')]=_0xa256('0x2b');if(!_0x1a0ab3[_0xa256('0x2c')]){_0x2e8c1a=![];logger[_0xa256('0xc')](_0xa256('0x2d'));}}if(_0x2e8c1a){return client[_0xa256('0x2e')](_0xa256('0x2f'),_0x6e0be4)[_0xa256('0x30')](function(_0x1f4671){if(_0x1f4671[_0xa256('0x31')]){return logger[_0xa256('0x31')](_0xa256('0x32'),JSON['stringify'](_0x1f4671));}return logger['info'](_0xa256('0x33'));})[_0xa256('0x34')](function(_0x24064f){return logger[_0xa256('0x31')](_0xa256('0x32'),JSON[_0xa256('0x2a')](_0x24064f));});}};}function handleError(){return function(_0x246e87){return logger[_0xa256('0x31')](JSON[_0xa256('0x2a')](_0x246e87));};}function handleResult(_0x1d978b){return function(_0x3fc67b){logger[_0xa256('0xc')](_0xa256('0x35'),JSON[_0xa256('0x2a')](_0x3fc67b));if(_0x1d978b[_0xa256('0x10')]&&_0x1d978b['MailAccount'][_0xa256('0x11')]&&!_[_0xa256('0x36')](_0x1d978b[_0xa256('0xe')])){setTimeout(handleSendEmail(_0x1d978b,_0x3fc67b),0x3c*0x3e8);}};}function handleJob(_0x2d3e05){return function(){try{if(_[_0xa256('0x36')](_0x2d3e05[_0xa256('0x1d')])){return logger[_0xa256('0xc')](_0xa256('0x37'));}if(_['isNil'](_0x2d3e05[_0xa256('0x1e')])){return logger[_0xa256('0xc')](_0xa256('0x38'));}var _0x5247ad={'startDate':moment()[_0xa256('0x39')](_0x2d3e05[_0xa256('0x1d')],_0x2d3e05[_0xa256('0x1e')])['format'](_0xa256('0x3a')),'endDate':moment()['format'](_0xa256('0x3a')),'type':_0xa256('0x3b'),'output':_0x2d3e05[_0xa256('0x3c')],'name':_0x2d3e05[_0xa256('0x19')]};if(!_[_0xa256('0x36')](_0x2d3e05[_0xa256('0x3d')])){logger[_0xa256('0xc')](_0xa256('0x3e'),_0x2d3e05['DefaultReportId']);return analyticDefaultReportController[_0xa256('0x3f')]({'id':_0x2d3e05[_0xa256('0x3d')]},_0x5247ad)[_0xa256('0x30')](handleResult(_0x2d3e05))['catch'](handleError());}if(!_[_0xa256('0x36')](_0x2d3e05['CustomReportId'])){logger[_0xa256('0xc')](_0xa256('0x40'),_0x2d3e05['CustomReportId']);return analyticCustomReportController[_0xa256('0x3f')]({'id':_0x2d3e05[_0xa256('0x41')]},_0x5247ad)[_0xa256('0x30')](handleResult(_0x2d3e05))[_0xa256('0x34')](handleError());}}catch(_0x2fcde7){logger[_0xa256('0x31')](JSON[_0xa256('0x2a')](_0x2fcde7));}return logger[_0xa256('0xc')](_0xa256('0x42'));};}function getJobs(_0x51d1fb){var _0x59018c={};if(_0x51d1fb){_0x59018c['id']=_0x51d1fb;}return db[_0xa256('0x43')][_0xa256('0x44')]({'where':_0x59018c,'include':[{'model':db[_0xa256('0x10')],'attributes':['id',_0xa256('0x19'),_0xa256('0xe')],'include':[{'model':db['MailServerOut'],'as':_0xa256('0x11')}]}]})[_0xa256('0x30')](function(_0x3cdc09){var _0x24f320=_[_0xa256('0x45')](manager[_0xa256('0x46')]);var _0x4793be=_[_0xa256('0x47')](_0x3cdc09,function(_0x2a1bd1){return _0x2a1bd1['id'][_0xa256('0x48')]();});var _0x110f0e=_[_0xa256('0x49')](_0x3cdc09,function(_0x1ef4a9){return _0x1ef4a9['id'][_0xa256('0x48')]();});var _0x5da8eb=_0x51d1fb?_0x4793be:_[_0xa256('0x4a')](_0x4793be,_0x24f320);var _0x9e2b15=_[_0xa256('0x4b')](_0x4793be,_0x24f320);var _0x4b134d=_['difference'](_0x24f320,_0x4793be);var _0x31fb4f;var _0x38b58a;for(_0x31fb4f=0x0;_0x31fb4f<_0x4b134d[_0xa256('0x4c')]&&!_0x51d1fb;_0x31fb4f+=0x1){_0x38b58a=_0x4b134d[_0x31fb4f][_0xa256('0x48')]();if(manager[_0xa256('0x4d')](_0x38b58a)){manager[_0xa256('0x4e')](_0x38b58a);manager[_0xa256('0x4f')](_0x38b58a);logger['info'](_0xa256('0x50'),_0x38b58a);}}logger[_0xa256('0xc')]('toRun',JSON[_0xa256('0x2a')](_0x5da8eb));for(_0x31fb4f=0x0;_0x31fb4f<_0x5da8eb[_0xa256('0x4c')];_0x31fb4f+=0x1){_0x38b58a=_0x5da8eb[_0x31fb4f][_0xa256('0x48')]();logger[_0xa256('0xc')](_0xa256('0x51'),_0x38b58a);if(_0x51d1fb){logger[_0xa256('0xc')]('my\x20id',_0x51d1fb);logger[_0xa256('0xc')](JSON[_0xa256('0x2a')](_0x110f0e[_0x38b58a]));BPromise[_0xa256('0x52')]()[_0xa256('0x30')](handleJob(_0x110f0e[_0x38b58a]));logger[_0xa256('0xc')](_0xa256('0x53'),_0x110f0e[_0x38b58a]['name'],_0x110f0e[_0x38b58a][_0xa256('0x54')]);}else if(_0x110f0e[_0x38b58a][_0xa256('0x54')]&&_0x110f0e[_0x38b58a]['active']&&moment()[_0xa256('0x55')](_0x110f0e[_0x38b58a][_0xa256('0x56')],_0x110f0e[_0x38b58a][_0xa256('0x57')])){manager[_0xa256('0x58')](_0x38b58a,_0x110f0e[_0x38b58a][_0xa256('0x54')],handleJob(_0x110f0e[_0x38b58a]));manager[_0xa256('0x59')](_0x38b58a);logger['info'](_0xa256('0x5a'),_0x110f0e[_0x38b58a][_0xa256('0x19')],_0x110f0e[_0x38b58a][_0xa256('0x54')]);}else if(manager['exists'](_0x38b58a)){manager[_0xa256('0x4e')](_0x38b58a);manager['deleteJob'](_0x38b58a);logger['info']('stop\x20cron',_0x110f0e[_0x38b58a][_0xa256('0x19')],_0x110f0e[_0x38b58a]['cron']);}}for(_0x31fb4f=0x0,_0x38b58a;_0x31fb4f<_0x9e2b15[_0xa256('0x4c')]&&!_0x51d1fb;_0x31fb4f+=0x1){_0x38b58a=_0x9e2b15[_0x31fb4f][_0xa256('0x48')]();if(manager[_0xa256('0x4d')](_0x38b58a)){if(_0x110f0e[_0x38b58a][_0xa256('0x54')]&&_0x110f0e[_0x38b58a]['active']&&moment()[_0xa256('0x55')](_0x110f0e[_0x38b58a][_0xa256('0x56')],_0x110f0e[_0x38b58a]['endAt'])){manager['update'](_0x38b58a,_0x110f0e[_0x38b58a][_0xa256('0x54')],handleJob(_0x110f0e[_0x38b58a]));logger[_0xa256('0xc')]('update\x20cron',_0x110f0e[_0x38b58a][_0xa256('0x19')],_0x110f0e[_0x38b58a][_0xa256('0x54')]);}else{manager[_0xa256('0x4e')](_0x38b58a);manager['deleteJob'](_0x38b58a);logger[_0xa256('0xc')]('stop\x20cron',_0x110f0e[_0x38b58a]['name'],_0x110f0e[_0x38b58a][_0xa256('0x54')]);}}}})[_0xa256('0x34')](function(_0x2bc638){logger[_0xa256('0x31')](JSON[_0xa256('0x2a')](_0x2bc638));});}exports[_0xa256('0x5b')]=function(_0x20cf6b){return getJobs(_0x20cf6b);};exports[_0xa256('0x59')]=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 9d3431b..2f8c012 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 _0x6791=['[RECORDING:%d]\x20Get\x20transcript','Transcript','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentimentAccountId','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Negative','Neutral','catch','name','SequelizeValidationError','error','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','inspect','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','TranscriptFileUri'];(function(_0x29c550,_0x23b16d){var _0x347cd1=function(_0x200f91){while(--_0x200f91){_0x29c550['push'](_0x29c550['shift']());}};_0x347cd1(++_0x23b16d);}(_0x6791,0x15b));var _0x1679=function(_0x1ec8f9,_0x22f5e7){_0x1ec8f9=_0x1ec8f9-0x0;var _0x17cd3d=_0x6791[_0x1ec8f9];return _0x17cd3d;};var _=require('lodash');var AWS=require(_0x1679('0x0'));var rp=require(_0x1679('0x1'));var util=require(_0x1679('0x2'));var BPromise=require(_0x1679('0x3'));var db=require(_0x1679('0x4'))['db'];var logger=require(_0x1679('0x5'))('transcribe');function getTranscriptionJob(_0x3106d0,_0x5b68dd,_0x5c8343,_0x59256c){return new Promise(function(_0xb2683c,_0x1552ca){var _0x40bdc1=new AWS[(_0x1679('0x6'))]({'accessKeyId':_0x5b68dd,'secretAccessKey':_0x3106d0,'region':_0x5c8343});_0x40bdc1[_0x1679('0x7')]({'TranscriptionJobName':_0x59256c},function(_0x495b62,_0x3bac96){if(_0x495b62){return _0x1552ca(_0x495b62);}else{return _0xb2683c(_0x3bac96);}});});}function sentiment(_0x37f26f,_0x5c133a,_0x3d2d70,_0x5a99a8,_0x5cc62f){return new Promise(function(_0x456b0b,_0x391cc2){var _0x2433f3=new AWS['Comprehend']({'accessKeyId':_0x5c133a,'secretAccessKey':_0x37f26f,'region':_0x3d2d70});_0x2433f3[_0x1679('0x8')]({'Text':_0x5a99a8,'LanguageCode':_0x5cc62f[_0x1679('0x9')](0x0,0x2)},function(_0x58320b,_0x1e0814){if(_0x58320b){return _0x391cc2(_0x58320b);}else{return _0x456b0b(_0x1e0814);}});});}function checkTranscribeJob(_0xc85967,_0x5d0394,_0x1a22cd){var _0x3a547f;return new BPromise(function(_0x4856a4,_0x293c8e){logger[_0x1679('0xa')](util['format'](_0x1679('0xb'),_0xc85967['id'],_0xc85967[_0x1679('0xc')]));return getTranscriptionJob(_0x1a22cd[_0x1679('0xd')],_0x1a22cd[_0x1679('0xe')],_0x5d0394[_0x1679('0xf')],_0xc85967[_0x1679('0xc')])[_0x1679('0x10')](function(_0x32a8b8){logger[_0x1679('0xa')](util['format'](_0x1679('0x11'),_0xc85967['id'],_0xc85967[_0x1679('0xc')],_0x32a8b8[_0x1679('0x12')]['TranscriptionJobStatus']));if(!_0xc85967[_0x1679('0x13')]){switch(_0x32a8b8[_0x1679('0x12')][_0x1679('0x14')]){case _0x1679('0x15'):var _0x41df77={'transcribeStatus':_0x32a8b8[_0x1679('0x12')]['TranscriptionJobStatus'],'fileUri':_0x32a8b8[_0x1679('0x12')]['Transcript'][_0x1679('0x16')]};logger[_0x1679('0xa')](util['format'](_0x1679('0x17'),_0xc85967['id']));return rp({'uri':_0x32a8b8[_0x1679('0x12')][_0x1679('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x278df7){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x1a'),_0xc85967['id']));if(_0x278df7&&_0x278df7[_0x1679('0x1b')]&&_0x278df7[_0x1679('0x1b')]['transcripts']&&_0x278df7[_0x1679('0x1b')][_0x1679('0x1c')][_0x1679('0x1d')]){_0x41df77[_0x1679('0x13')]='';for(var _0x58e296=0x0;_0x58e296<_0x278df7[_0x1679('0x1b')][_0x1679('0x1c')][_0x1679('0x1d')];_0x58e296++){_0x41df77['fileText']+=_0x278df7[_0x1679('0x1b')][_0x1679('0x1c')][_0x58e296][_0x1679('0x1e')]+'';}}return _0xc85967[_0x1679('0x1f')](_0x41df77);})[_0x1679('0x10')](function(){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));if(!_0xc85967[_0x1679('0x21')]){throw new db[(_0x1679('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5d0394['sentiment']||!_0x5d0394[_0x1679('0x23')]||!_0x5d0394['sentimentRegion']||!_0x5d0394[_0x1679('0x24')]||!_0x5d0394[_0x1679('0x25')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x41df77[_0x1679('0x13')]){throw new Error(_0x1679('0x27'));}if(_0x5d0394[_0x1679('0x23')]===_0x1a22cd['id']){return _0x1a22cd;}else{return db[_0x1679('0x28')][_0x1679('0x29')]({'where':{'id':_settings[_0x1679('0x23')]}});}})['then'](function(_0x571f42){if(!_0x571f42){throw new db['Sequelize'][(_0x1679('0x26'))](_0x1679('0x2a'));}if(!_0x571f42['data1']||!_0x571f42[_0x1679('0xe')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a547f=_0x571f42;logger[_0x1679('0xa')](util['format'](_0x1679('0x2b'),_0xc85967['id']));return sentiment(_0x3a547f['data1'],_0x3a547f[_0x1679('0xe')],_0x5d0394[_0x1679('0x2c')],_0x41df77[_0x1679('0x13')],_0x5d0394['language']);})['then'](function(_0x585549){logger[_0x1679('0xa')](util['format'](_0x1679('0x2d'),_0xc85967['id']));return _0xc85967[_0x1679('0x1f')]({'sentiment':_0x585549[_0x1679('0x2e')],'sPositive':_0x585549[_0x1679('0x2f')][_0x1679('0x30')],'sNegative':_0x585549[_0x1679('0x2f')]['Negative'],'sMixed':_0x585549[_0x1679('0x2f')][_0x1679('0x31')],'sNeutral':_0x585549['SentimentScore']['Neutral']});})[_0x1679('0x10')](function(){logger['info'](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));_0x4856a4();});case'FAILED':return _0xc85967[_0x1679('0x1f')]({'transcribeStatus':_0x1679('0x32'),'failureReason':_0x32a8b8[_0x1679('0x12')][_0x1679('0x33')]})[_0x1679('0x10')](function(){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));_0x4856a4();});default:logger['info'](util[_0x1679('0x19')](_0x1679('0x34'),_0xc85967['id']));break;}}else{return BPromise[_0x1679('0x35')]()[_0x1679('0x10')](function(){if(!_0xc85967[_0x1679('0x21')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x36'));}if(!_0x5d0394[_0x1679('0x37')]||!_0x5d0394[_0x1679('0x23')]||!_0x5d0394[_0x1679('0x2c')]||!_0x5d0394['language']||!_0x5d0394[_0x1679('0x25')]){throw new db[(_0x1679('0x22'))]['ValidationError'](_0x1679('0x38'));}if(!_0xc85967[_0x1679('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x5d0394[_0x1679('0x23')]===_0x1a22cd['id']){return _0x1a22cd;}else{return db['CloudProvider'][_0x1679('0x29')]({'where':{'id':_settings[_0x1679('0x23')]}});}})[_0x1679('0x10')](function(_0x1ec3ff){if(!_0x1ec3ff){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x2a'));}if(!_0x1ec3ff[_0x1679('0xd')]||!_0x1ec3ff['data2']){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x39'));}_0x3a547f=_0x1ec3ff;logger[_0x1679('0xa')](util['format'](_0x1679('0x2b'),_0xc85967['id']));return sentiment(_0x3a547f['data1'],_0x3a547f[_0x1679('0xe')],_0x5d0394[_0x1679('0x2c')],_0xc85967[_0x1679('0x13')],_0x5d0394['language']);})[_0x1679('0x10')](function(_0x390314){logger[_0x1679('0xa')](util['format'](_0x1679('0x2d'),_0xc85967['id']));return _0xc85967[_0x1679('0x1f')]({'sentiment':_0x390314[_0x1679('0x2e')],'sPositive':_0x390314[_0x1679('0x2f')]['Positive'],'sNegative':_0x390314[_0x1679('0x2f')][_0x1679('0x3a')],'sMixed':_0x390314['SentimentScore']['Mixed'],'sNeutral':_0x390314[_0x1679('0x2f')][_0x1679('0x3b')],'transcribeStatus':'COMPLETED'});})[_0x1679('0x10')](function(){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));_0x4856a4();});}})[_0x1679('0x3c')](function(_0x2b2661){if(_0x2b2661){if(!_0x2b2661[_0x1679('0x3d')]||_0x2b2661['name']!==_0x1679('0x3e')){logger[_0x1679('0x3f')](util[_0x1679('0x19')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0xc85967['id']),util['inspect'](_0x2b2661,{'showHidden':![],'depth':null}));}}_0x4856a4();});});}function checkTranscribe(){var _0xd2aab0;var _0x238e82;var _0x3b429d;return db['VoiceRecording'][_0x1679('0x40')]({'where':{'transcribeStatus':_0x1679('0x41')}})[_0x1679('0x10')](function(_0x514132){if(!_0x514132||!_0x514132[_0x1679('0x1d')]){throw new db[(_0x1679('0x22'))]['ValidationError'](_0x1679('0x42'));}_0xd2aab0=_0x514132;return db['Setting'][_0x1679('0x29')]({'where':{'id':0x1}});})[_0x1679('0x10')](function(_0x2f54db){if(!_0x2f54db){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))]('Settings\x20not\x20available');}_0x238e82=_0x2f54db;if(!_0x238e82[_0x1679('0x43')]||!_0x238e82['transcribeAccountId']||!_0x238e82['transcribeRegion']||!_0x238e82[_0x1679('0x24')]||!_0x238e82[_0x1679('0x25')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x44'));}return db[_0x1679('0x28')]['findOne']({'where':{'id':_0x238e82[_0x1679('0x45')]}});})[_0x1679('0x10')](function(_0x380a69){if(!_0x380a69){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x2a'));}if(!_0x380a69[_0x1679('0xd')]||!_0x380a69[_0x1679('0xe')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x3b429d=_0x380a69;var _0x4e2c26=[];_0xd2aab0[_0x1679('0x46')](function(_0x148aea){_0x4e2c26[_0x1679('0x47')](checkTranscribeJob(_0x148aea,_0x238e82,_0x3b429d));});return BPromise['all'](_0x4e2c26);})[_0x1679('0x3c')](function(_0x19dae4){if(_0x19dae4){if(!_0x19dae4[_0x1679('0x3d')]||_0x19dae4[_0x1679('0x3d')]!==_0x1679('0x3e')){logger[_0x1679('0x3f')](util[_0x1679('0x48')](_0x19dae4,{'showHidden':![],'depth':null}));}}});}exports[_0x1679('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x81ed=['Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','findOne','Positive','Negative','Neutral','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','transcripts','results','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment'];(function(_0x231cee,_0x4a022b){var _0x58c128=function(_0x316c30){while(--_0x316c30){_0x231cee['push'](_0x231cee['shift']());}};_0x58c128(++_0x4a022b);}(_0x81ed,0x1e1));var _0xd81e=function(_0x1e5220,_0x577465){_0x1e5220=_0x1e5220-0x0;var _0x1d56e3=_0x81ed[_0x1e5220];return _0x1d56e3;};var _=require(_0xd81e('0x0'));var AWS=require(_0xd81e('0x1'));var rp=require(_0xd81e('0x2'));var util=require('util');var BPromise=require(_0xd81e('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xd81e('0x4'))('transcribe');function getTranscriptionJob(_0x51ceeb,_0x379d2a,_0x3fb946,_0x319510){return new Promise(function(_0x40057a,_0x4fa5d5){var _0x3443d8=new AWS[(_0xd81e('0x5'))]({'accessKeyId':_0x379d2a,'secretAccessKey':_0x51ceeb,'region':_0x3fb946});_0x3443d8[_0xd81e('0x6')]({'TranscriptionJobName':_0x319510},function(_0x3ee85b,_0x372f15){if(_0x3ee85b){return _0x4fa5d5(_0x3ee85b);}else{return _0x40057a(_0x372f15);}});});}function sentiment(_0x521298,_0xaca5ea,_0x4f3e85,_0xc1f015,_0x1de2da){return new Promise(function(_0x335f65,_0x1dc458){var _0x334d4f=new AWS[(_0xd81e('0x7'))]({'accessKeyId':_0xaca5ea,'secretAccessKey':_0x521298,'region':_0x4f3e85});_0x334d4f[_0xd81e('0x8')]({'Text':_0xc1f015,'LanguageCode':_0x1de2da['substring'](0x0,0x2)},function(_0x230409,_0x4312a4){if(_0x230409){return _0x1dc458(_0x230409);}else{return _0x335f65(_0x4312a4);}});});}function checkTranscribeJob(_0x5892cc,_0x4f6597,_0x4b9556){var _0x408041;return new BPromise(function(_0x2688df,_0x302bc6){logger[_0xd81e('0x9')](util['format'](_0xd81e('0xa'),_0x5892cc['id'],_0x5892cc['transcribeName']));return getTranscriptionJob(_0x4b9556[_0xd81e('0xb')],_0x4b9556[_0xd81e('0xc')],_0x4f6597[_0xd81e('0xd')],_0x5892cc['transcribeName'])[_0xd81e('0xe')](function(_0x16c443){logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x10'),_0x5892cc['id'],_0x5892cc['transcribeName'],_0x16c443[_0xd81e('0x11')][_0xd81e('0x12')]));if(!_0x5892cc[_0xd81e('0x13')]){switch(_0x16c443[_0xd81e('0x11')][_0xd81e('0x12')]){case _0xd81e('0x14'):var _0xc9a559={'transcribeStatus':_0x16c443['TranscriptionJob'][_0xd81e('0x12')],'fileUri':_0x16c443[_0xd81e('0x11')]['Transcript'][_0xd81e('0x15')]};logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x16'),_0x5892cc['id']));return rp({'uri':_0x16c443['TranscriptionJob'][_0xd81e('0x17')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x4c95e8){logger[_0xd81e('0x9')](util[_0xd81e('0xf')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x5892cc['id']));if(_0x4c95e8&&_0x4c95e8['results']&&_0x4c95e8['results'][_0xd81e('0x18')]&&_0x4c95e8[_0xd81e('0x19')][_0xd81e('0x18')]['length']){_0xc9a559[_0xd81e('0x13')]='';for(var _0x93cfd3=0x0;_0x93cfd3<_0x4c95e8[_0xd81e('0x19')][_0xd81e('0x18')][_0xd81e('0x1a')];_0x93cfd3++){_0xc9a559[_0xd81e('0x13')]+=_0x4c95e8[_0xd81e('0x19')][_0xd81e('0x18')][_0x93cfd3]['transcript']+'';}}return _0x5892cc[_0xd81e('0x1b')](_0xc9a559);})[_0xd81e('0xe')](function(){logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x1c'),_0x5892cc['id']));if(!_0x5892cc[_0xd81e('0x1d')]){throw new db[(_0xd81e('0x1e'))]['ValidationError'](_0xd81e('0x1f'));}if(!_0x4f6597[_0xd81e('0x20')]||!_0x4f6597[_0xd81e('0x21')]||!_0x4f6597[_0xd81e('0x22')]||!_0x4f6597[_0xd81e('0x23')]||!_0x4f6597['bucket']){throw new db[(_0xd81e('0x1e'))][(_0xd81e('0x24'))](_0xd81e('0x25'));}if(!_0xc9a559[_0xd81e('0x13')]){throw new Error(_0xd81e('0x26'));}if(_0x4f6597[_0xd81e('0x21')]===_0x4b9556['id']){return _0x4b9556;}else{return db[_0xd81e('0x27')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd81e('0xe')](function(_0x7f24aa){if(!_0x7f24aa){throw new db['Sequelize'][(_0xd81e('0x24'))](_0xd81e('0x28'));}if(!_0x7f24aa['data1']||!_0x7f24aa['data2']){throw new db[(_0xd81e('0x1e'))][(_0xd81e('0x24'))](_0xd81e('0x29'));}_0x408041=_0x7f24aa;logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x2a'),_0x5892cc['id']));return sentiment(_0x408041[_0xd81e('0xb')],_0x408041[_0xd81e('0xc')],_0x4f6597[_0xd81e('0x22')],_0xc9a559[_0xd81e('0x13')],_0x4f6597['language']);})['then'](function(_0x3dd938){logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x2b'),_0x5892cc['id']));return _0x5892cc['update']({'sentiment':_0x3dd938[_0xd81e('0x2c')],'sPositive':_0x3dd938[_0xd81e('0x2d')]['Positive'],'sNegative':_0x3dd938[_0xd81e('0x2d')]['Negative'],'sMixed':_0x3dd938[_0xd81e('0x2d')][_0xd81e('0x2e')],'sNeutral':_0x3dd938['SentimentScore']['Neutral']});})[_0xd81e('0xe')](function(){logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x1c'),_0x5892cc['id']));_0x2688df();});case _0xd81e('0x2f'):return _0x5892cc[_0xd81e('0x1b')]({'transcribeStatus':_0xd81e('0x2f'),'failureReason':_0x16c443[_0xd81e('0x11')][_0xd81e('0x30')]})['then'](function(){logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x1c'),_0x5892cc['id']));_0x2688df();});default:logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x31'),_0x5892cc['id']));break;}}else{return BPromise[_0xd81e('0x32')]()[_0xd81e('0xe')](function(){if(!_0x5892cc[_0xd81e('0x1d')]){throw new db['Sequelize'][(_0xd81e('0x24'))](_0xd81e('0x1f'));}if(!_0x4f6597['sentiment']||!_0x4f6597[_0xd81e('0x21')]||!_0x4f6597[_0xd81e('0x22')]||!_0x4f6597['language']||!_0x4f6597[_0xd81e('0x33')]){throw new db[(_0xd81e('0x1e'))][(_0xd81e('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5892cc[_0xd81e('0x13')]){throw new Error(_0xd81e('0x26'));}if(_0x4f6597[_0xd81e('0x21')]===_0x4b9556['id']){return _0x4b9556;}else{return db[_0xd81e('0x27')][_0xd81e('0x34')]({'where':{'id':_settings[_0xd81e('0x21')]}});}})['then'](function(_0x412155){if(!_0x412155){throw new db[(_0xd81e('0x1e'))][(_0xd81e('0x24'))](_0xd81e('0x28'));}if(!_0x412155[_0xd81e('0xb')]||!_0x412155[_0xd81e('0xc')]){throw new db[(_0xd81e('0x1e'))][(_0xd81e('0x24'))](_0xd81e('0x29'));}_0x408041=_0x412155;logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x2a'),_0x5892cc['id']));return sentiment(_0x408041['data1'],_0x408041[_0xd81e('0xc')],_0x4f6597[_0xd81e('0x22')],_0x5892cc['fileText'],_0x4f6597[_0xd81e('0x23')]);})[_0xd81e('0xe')](function(_0x764500){logger[_0xd81e('0x9')](util[_0xd81e('0xf')](_0xd81e('0x2b'),_0x5892cc['id']));return _0x5892cc[_0xd81e('0x1b')]({'sentiment':_0x764500[_0xd81e('0x2c')],'sPositive':_0x764500['SentimentScore'][_0xd81e('0x35')],'sNegative':_0x764500[_0xd81e('0x2d')][_0xd81e('0x36')],'sMixed':_0x764500[_0xd81e('0x2d')]['Mixed'],'sNeutral':_0x764500[_0xd81e('0x2d')][_0xd81e('0x37')],'transcribeStatus':_0xd81e('0x14')});})[_0xd81e('0xe')](function(){logger['info'](util[_0xd81e('0xf')](_0xd81e('0x1c'),_0x5892cc['id']));_0x2688df();});}})[_0xd81e('0x38')](function(_0xd9b2c){if(_0xd9b2c){if(!_0xd9b2c['name']||_0xd9b2c[_0xd81e('0x39')]!=='SequelizeValidationError'){logger[_0xd81e('0x3a')](util['format'](_0xd81e('0x3b'),_0x5892cc['id']),util['inspect'](_0xd9b2c,{'showHidden':![],'depth':null}));}}_0x2688df();});});}function checkTranscribe(){var _0x13d846;var _0x484a08;var _0x33eaf9;return db[_0xd81e('0x3c')][_0xd81e('0x3d')]({'where':{'transcribeStatus':_0xd81e('0x3e')}})['then'](function(_0x21ce2f){if(!_0x21ce2f||!_0x21ce2f['length']){throw new db['Sequelize'][(_0xd81e('0x24'))](_0xd81e('0x3f'));}_0x13d846=_0x21ce2f;return db[_0xd81e('0x40')][_0xd81e('0x34')]({'where':{'id':0x1}});})[_0xd81e('0xe')](function(_0x30ee4f){if(!_0x30ee4f){throw new db[(_0xd81e('0x1e'))]['ValidationError'](_0xd81e('0x41'));}_0x484a08=_0x30ee4f;if(!_0x484a08[_0xd81e('0x42')]||!_0x484a08[_0xd81e('0x43')]||!_0x484a08[_0xd81e('0xd')]||!_0x484a08['language']||!_0x484a08[_0xd81e('0x33')]){throw new db[(_0xd81e('0x1e'))]['ValidationError'](_0xd81e('0x44'));}return db[_0xd81e('0x27')][_0xd81e('0x34')]({'where':{'id':_0x484a08[_0xd81e('0x43')]}});})['then'](function(_0x2bd79f){if(!_0x2bd79f){throw new db[(_0xd81e('0x1e'))]['ValidationError'](_0xd81e('0x28'));}if(!_0x2bd79f[_0xd81e('0xb')]||!_0x2bd79f[_0xd81e('0xc')]){throw new db[(_0xd81e('0x1e'))][(_0xd81e('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x33eaf9=_0x2bd79f;var _0xb64c22=[];_0x13d846[_0xd81e('0x45')](function(_0x440820){_0xb64c22[_0xd81e('0x46')](checkTranscribeJob(_0x440820,_0x484a08,_0x33eaf9));});return BPromise[_0xd81e('0x47')](_0xb64c22);})['catch'](function(_0x3585a2){if(_0x3585a2){if(!_0x3585a2[_0xd81e('0x39')]||_0x3585a2[_0xd81e('0x39')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x3585a2,{'showHidden':![],'depth':null}));}}});}exports[_0xd81e('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 8d315d2..7b37e94 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 _0xb4d7=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update'];(function(_0x5b9ba9,_0x9a608c){var _0x326373=function(_0x107b07){while(--_0x107b07){_0x5b9ba9['push'](_0x5b9ba9['shift']());}};_0x326373(++_0x9a608c);}(_0xb4d7,0x64));var _0x7b4d=function(_0x2d5493,_0x2b87ee){_0x2d5493=_0x2d5493-0x0;var _0x82d3f=_0xb4d7[_0x2d5493];return _0x82d3f;};'use strict';var _=require(_0x7b4d('0x0'));var moment=require(_0x7b4d('0x1'));var Redis=require(_0x7b4d('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x7b4d('0x3'))['db'];var logger=require(_0x7b4d('0x4'))('schedule');config[_0x7b4d('0x5')]=_[_0x7b4d('0x6')](config[_0x7b4d('0x5')],{'host':_0x7b4d('0x7'),'port':0x18eb});var io=require(_0x7b4d('0x8'))(new Redis(config[_0x7b4d('0x5')]));function closeInteractions(){var _0x40a6e1=[];return db[_0x7b4d('0x9')][_0x7b4d('0xa')]({'raw':!![],'attributes':['id',_0x7b4d('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7b4d('0xc')](0x18,'hours')}}})[_0x7b4d('0xd')](function(_0x2b0b79){if(_0x2b0b79&&_0x2b0b79[_0x7b4d('0xe')]){_0x40a6e1=_[_0x7b4d('0xf')](_0x2b0b79||[],'id');logger[_0x7b4d('0x10')](_0x7b4d('0x11'),_0x40a6e1[_0x7b4d('0x12')]());return db['WhatsappInteraction'][_0x7b4d('0x13')]({'closeReason':'system','disposition':_0x7b4d('0x14'),'closed':!![],'closedAt':moment()[_0x7b4d('0x15')](_0x7b4d('0x16'))},{'where':{'id':_0x40a6e1}});}})[_0x7b4d('0xd')](function(){if(_0x40a6e1&&_0x40a6e1[_0x7b4d('0xe')]){logger['info'](_0x7b4d('0x17'),_0x40a6e1[_0x7b4d('0x12')]());for(var _0x48c304=0x0;_0x48c304<_0x40a6e1[_0x7b4d('0xe')];_0x48c304++){io[_0x7b4d('0x18')](_0x7b4d('0x19'),{'id':_0x40a6e1[_0x48c304],'closed':!![]});}}})[_0x7b4d('0x1a')](function(_0x34d03b){logger[_0x7b4d('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x34d03b?util[_0x7b4d('0x1c')](_0x34d03b,{'showHidden':![],'depth':null}):'');});}exports[_0x7b4d('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfa64=['../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','format','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util'];(function(_0xb9fcba,_0x19a3b0){var _0xb7a60=function(_0x339bab){while(--_0x339bab){_0xb9fcba['push'](_0xb9fcba['shift']());}};_0xb7a60(++_0x19a3b0);}(_0xfa64,0x1dc));var _0x4fa6=function(_0x1a7194,_0x3187ce){_0x1a7194=_0x1a7194-0x0;var _0x31915b=_0xfa64[_0x1a7194];return _0x31915b;};'use strict';var _=require(_0x4fa6('0x0'));var moment=require(_0x4fa6('0x1'));var Redis=require(_0x4fa6('0x2'));var util=require(_0x4fa6('0x3'));var config=require(_0x4fa6('0x4'));var db=require(_0x4fa6('0x5'))['db'];var logger=require('../logger')(_0x4fa6('0x6'));config[_0x4fa6('0x7')]=_['defaults'](config['redis'],{'host':_0x4fa6('0x8'),'port':0x18eb});var io=require(_0x4fa6('0x9'))(new Redis(config[_0x4fa6('0x7')]));function closeInteractions(){var _0x32fb70=[];return db[_0x4fa6('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x4fa6('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4fa6('0xc')](0x18,_0x4fa6('0xd'))}}})['then'](function(_0x5081f9){if(_0x5081f9&&_0x5081f9['length']){_0x32fb70=_[_0x4fa6('0xe')](_0x5081f9||[],'id');logger[_0x4fa6('0xf')](_0x4fa6('0x10'),_0x32fb70[_0x4fa6('0x11')]());return db['WhatsappInteraction']['update']({'closeReason':_0x4fa6('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4fa6('0x13')](_0x4fa6('0x14'))},{'where':{'id':_0x32fb70}});}})[_0x4fa6('0x15')](function(){if(_0x32fb70&&_0x32fb70[_0x4fa6('0x16')]){logger['info'](_0x4fa6('0x17'),_0x32fb70[_0x4fa6('0x11')]());for(var _0x1ebc05=0x0;_0x1ebc05<_0x32fb70[_0x4fa6('0x16')];_0x1ebc05++){io[_0x4fa6('0x18')](_0x4fa6('0x19'),{'id':_0x32fb70[_0x1ebc05],'closed':!![]});}}})[_0x4fa6('0x1a')](function(_0x5e8a54){logger[_0x4fa6('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x5e8a54?util[_0x4fa6('0x1c')](_0x5e8a54,{'showHidden':![],'depth':null}):'');});}exports[_0x4fa6('0x1d')]=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 65bc6f3..292aa3b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc1=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','../mysqldb','Innocenzo','innocenzo.biondo','push','now','Biondo','@xcally.com','CmContact','destroy','then'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0xafc1,0xf2));var _0x1afc=function(_0x279e1f,_0x2369e9){_0x279e1f=_0x279e1f-0x0;var _0x4360bc=_0xafc1[_0x279e1f];return _0x4360bc;};'use strict';var util=require('util');var db=require(_0x1afc('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1afc('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x1afc('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1afc('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x1afc('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1afc('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1afc('0x3')]({'id':i,'firstName':_0x1afc('0x1')+i,'lastName':_0x1afc('0x5')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1afc('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1afc('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x1afc('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1afc('0x4')](),'updatedAt':Date['now']()});}db[_0x1afc('0x7')][_0x1afc('0x8')]({'where':{}})[_0x1afc('0x9')](function(){return db[_0x1afc('0x7')][_0x1afc('0xa')](contacts);})[_0x1afc('0x9')](function(){console[_0x1afc('0xb')](_0x1afc('0xc'),_0x1afc('0xd'));return db[_0x1afc('0xe')][_0x1afc('0x8')]({'where':{}});})[_0x1afc('0x9')](function(){return db[_0x1afc('0xe')][_0x1afc('0xa')](hopper);})['then'](function(){console[_0x1afc('0xb')](_0x1afc('0xc'),_0x1afc('0xf'));return db['CmContact'][_0x1afc('0xa')](contacts2);})[_0x1afc('0x9')](function(){console[_0x1afc('0xb')](_0x1afc('0xc'),'contacts2');return db['CmHopper'][_0x1afc('0xa')](hopper2);})['then'](function(){console[_0x1afc('0xb')]('finished\x20populating',_0x1afc('0x10'));})[_0x1afc('0x11')](function(_0x1adf8a){console[_0x1afc('0xb')](_0x1adf8a);}); \ No newline at end of file +var _0xe745=['Innocenzo','Biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','../mysqldb','push'];(function(_0x980374,_0x1e0751){var _0x402d6a=function(_0x5d9a7d){while(--_0x5d9a7d){_0x980374['push'](_0x980374['shift']());}};_0x402d6a(++_0x1e0751);}(_0xe745,0x130));var _0x5e74=function(_0x1ae336,_0x2f3a00){_0x1ae336=_0x1ae336-0x0;var _0x1673de=_0xe745[_0x1ae336];return _0x1673de;};'use strict';var util=require('util');var db=require(_0x5e74('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5e74('0x1')]({'id':i,'firstName':_0x5e74('0x2')+i,'lastName':_0x5e74('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x5e74('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5e74('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x5e74('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x5e74('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5e74('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5e74('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x5e74('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5e74('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x5e74('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5e74('0x5')](),'updatedAt':Date[_0x5e74('0x5')]()});}db[_0x5e74('0x6')][_0x5e74('0x7')]({'where':{}})[_0x5e74('0x8')](function(){return db[_0x5e74('0x6')][_0x5e74('0x9')](contacts);})[_0x5e74('0x8')](function(){console[_0x5e74('0xa')](_0x5e74('0xb'),_0x5e74('0xc'));return db[_0x5e74('0xd')][_0x5e74('0x7')]({'where':{}});})[_0x5e74('0x8')](function(){return db[_0x5e74('0xd')]['bulkCreate'](hopper);})[_0x5e74('0x8')](function(){console[_0x5e74('0xa')](_0x5e74('0xb'),_0x5e74('0xe'));return db[_0x5e74('0x6')][_0x5e74('0x9')](contacts2);})[_0x5e74('0x8')](function(){console[_0x5e74('0xa')](_0x5e74('0xb'),_0x5e74('0xf'));return db['CmHopper'][_0x5e74('0x9')](hopper2);})[_0x5e74('0x8')](function(){console[_0x5e74('0xa')](_0x5e74('0xb'),_0x5e74('0x10'));})[_0x5e74('0x11')](function(_0x10b53e){console[_0x5e74('0xa')](_0x10b53e);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index beac784..a6267c6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5161=['friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','util','../mysqldb','format','agent','%s%s','password'];(function(_0x4badf2,_0x31af5b){var _0x1c9657=function(_0x139c59){while(--_0x139c59){_0x4badf2['push'](_0x4badf2['shift']());}};_0x1c9657(++_0x31af5b);}(_0x5161,0x92));var _0x1516=function(_0x1f8abb,_0x2b232e){_0x1f8abb=_0x1f8abb-0x0;var _0x1b9297=_0x5161[_0x1f8abb];return _0x1b9297;};'use strict';var util=require(_0x1516('0x0'));var db=require(_0x1516('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x1516('0x2')]('%s%s',_0x1516('0x3'),i),'fullname':util['format'](_0x1516('0x4'),_0x1516('0x3'),i),'email':util[_0x1516('0x2')]('%s%s@xcally.com','agent',i),'role':_0x1516('0x3'),'password':_0x1516('0x5'),'internal':0xfa0+i,'type':_0x1516('0x6'),'transport':[_0x1516('0x7'),'ws',_0x1516('0x8')],'disallow':['all'],'allow':[_0x1516('0x9')],'defaultuser':util[_0x1516('0x2')](_0x1516('0x4'),'agent',i),'encryption':'yes','avpf':_0x1516('0xa'),'force_avp':_0x1516('0xa'),'icesupport':_0x1516('0xa'),'dtlsenable':_0x1516('0xa'),'dtlsverify':'no','dtlscertfile':_0x1516('0xb'),'dtlsprivatekey':_0x1516('0xc'),'dtlssetup':_0x1516('0xd'),'callerid':util['format'](_0x1516('0xe'),util['format'](_0x1516('0x4'),'agent',i),0xfa0+i)});}db[_0x1516('0xf')][_0x1516('0x10')](users)['then'](function(){console[_0x1516('0x11')](_0x1516('0x12'));})['catch'](function(_0x2153b6){console[_0x1516('0x11')](_0x2153b6);}); \ No newline at end of file +var _0x494f=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','udp','wss'];(function(_0x4f5991,_0x3c6e45){var _0x319332=function(_0x550325){while(--_0x550325){_0x4f5991['push'](_0x4f5991['shift']());}};_0x319332(++_0x3c6e45);}(_0x494f,0x1ee));var _0xf494=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x494f[_0x4099ee];return _0x1b7bfc;};'use strict';var util=require(_0xf494('0x0'));var db=require(_0xf494('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf494('0x2')]({'name':util['format'](_0xf494('0x3'),_0xf494('0x4'),i),'fullname':util[_0xf494('0x5')]('%s%s',_0xf494('0x4'),i),'email':util[_0xf494('0x5')](_0xf494('0x6'),_0xf494('0x4'),i),'role':_0xf494('0x4'),'password':_0xf494('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0xf494('0x8'),'ws',_0xf494('0x9')],'disallow':[_0xf494('0xa')],'allow':[_0xf494('0xb')],'defaultuser':util['format'](_0xf494('0x3'),_0xf494('0x4'),i),'encryption':_0xf494('0xc'),'avpf':_0xf494('0xc'),'force_avp':_0xf494('0xc'),'icesupport':'yes','dtlsenable':_0xf494('0xc'),'dtlsverify':'no','dtlscertfile':_0xf494('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xf494('0xe'),'callerid':util[_0xf494('0x5')](_0xf494('0xf'),util[_0xf494('0x5')](_0xf494('0x3'),'agent',i),0xfa0+i)});}db['User'][_0xf494('0x10')](users)[_0xf494('0x11')](function(){console[_0xf494('0x12')](_0xf494('0x13'));})[_0xf494('0x14')](function(_0x4b3098){console[_0xf494('0x12')](_0x4b3098);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 371d20e..b6a38a9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cd8=['SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:outbound','VoiceQueues','ChatQueues','Trunk','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','type','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x54c0fd,_0x2b2747){_0x54c0fd=_0x54c0fd-0x0;var _0x35fe6b=_0x5cd8[_0x54c0fd];return _0x35fe6b;};'use strict';var _=require(_0x85cd('0x0'));var util=require('util');var BPromise=require(_0x85cd('0x1'));var db=require(_0x85cd('0x2'))['db'];var config=require(_0x85cd('0x3'));var queryQueues={'attributes':['id',_0x85cd('0x4')],'include':[{'as':'Agents','model':db[_0x85cd('0x5')],'attributes':['id','name',_0x85cd('0x6')],'raw':!![],'where':{'role':_0x85cd('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x85cd('0x4')],'where':{'role':_0x85cd('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x85cd('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x85cd('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x85cd('0x4'),'type'],'where':{'type':_0x85cd('0x9')}};function getAssociatedResources(_0x138cf9,_0x318aa7,_0x30204b){return db[_0x85cd('0xa')][_0x85cd('0xb')]({'where':{'name':_0x138cf9,'userProfileId':_0x318aa7},'raw':!![]})[_0x85cd('0xc')](function(_0x13d545){if(_0x13d545){if(_0x13d545[_0x85cd('0xd')]){switch(_0x138cf9){case'VoiceQueues':case'ChatQueues':case _0x85cd('0xe'):case _0x85cd('0xf'):case _0x85cd('0x10'):case _0x85cd('0x11'):case'WhatsappQueues':return db[_0x30204b][_0x85cd('0x12')](queryQueues);case _0x85cd('0x13'):return db[_0x30204b][_0x85cd('0x12')](queryTelephones);case _0x85cd('0x14'):return db[_0x30204b][_0x85cd('0x12')](queryTrunks);case _0x85cd('0x15'):return db[_0x30204b][_0x85cd('0x12')](queryCampaigns);}}else{return db[_0x85cd('0x16')]['findAll']({'attributes':[_0x85cd('0x17')],'where':{'sectionId':_0x13d545['id']},'raw':!![]})[_0x85cd('0xc')](function(_0x208490){if(_0x208490){var _0x424a01={'where':{'id':_[_0x85cd('0x18')](_0x208490,'resourceId')},'raw':!![]};switch(_0x30204b){case _0x85cd('0x5'):_0x424a01['where'][_0x85cd('0x6')]='telephone';break;case _0x85cd('0x19'):_0x424a01['where'][_0x85cd('0x1a')]=_0x85cd('0x9');break;}return db[_0x30204b][_0x85cd('0x12')](_0x424a01);}else{return[];}});}}else{return[];}})[_0x85cd('0xc')](function(_0x23695f){return _0x23695f;});}function joinOrLeaveQueues(_0x1123c0,_0x290ca9,_0x44ba80,_0x515ce1){_0x1123c0[_0x290ca9](util[_0x85cd('0x1b')](_0x85cd('0x1c'),_0x44ba80,_0x515ce1['name']));if(_0x515ce1['Agents']){for(var _0x5c268f=0x0;_0x5c268f<_0x515ce1['Agents'][_0x85cd('0x1d')];_0x5c268f+=0x1){_0x1123c0[_0x290ca9](util['format'](_0x85cd('0x1e'),_0x515ce1[_0x85cd('0x1f')][_0x5c268f][_0x85cd('0x4')]));}}}function joinOrLeave(_0x14ab80,_0x592b77,_0x290b57){var _0x2b00a8;if(_0x14ab80[_0x85cd('0x20')][_0x85cd('0x21')]['id']){db[_0x85cd('0x5')][_0x85cd('0x22')]({'attributes':['id','name',_0x85cd('0x6'),_0x85cd('0x23')],'where':{'id':_0x14ab80[_0x85cd('0x20')][_0x85cd('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x85cd('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x25')],'as':_0x85cd('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x28')],'as':_0x85cd('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x2a')],'as':_0x85cd('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x225802){if(_0x225802){_0x2b00a8=_0x225802;_0x14ab80[_0x592b77](util[_0x85cd('0x1b')](_0x85cd('0x1e'),_0x225802[_0x85cd('0x4')]));var _0x587f02=[];switch(_0x225802[_0x85cd('0x6')]){case _0x85cd('0x2c'):_0x14ab80[_0x592b77](_0x85cd('0x2d'));_0x14ab80[_0x592b77]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x85cd('0x2e'))){delete queryQueues[_0x85cd('0x2e')];}_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x30')][_0x85cd('0x12')](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x31')][_0x85cd('0x12')](queryQueues));_0x587f02['push'](db[_0x85cd('0x32')][_0x85cd('0x12')](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x33')]['findAll'](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x34')][_0x85cd('0x12')](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x35')]['findAll'](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x36')]['findAll'](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x5')][_0x85cd('0x12')](queryTelephones));_0x587f02['push'](db['Trunk'][_0x85cd('0x12')](queryTrunks));_0x587f02[_0x85cd('0x2f')](db['Campaign']['findAll'](queryCampaigns));_0x587f02[_0x85cd('0x2f')](db['User']['findAll'](queryAgents));break;case _0x85cd('0x37'):_0x14ab80[_0x592b77](_0x85cd('0x2d'));_0x14ab80[_0x592b77](_0x85cd('0x38'));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x39'),_0x225802[_0x85cd('0x23')],_0x85cd('0x30')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x3a'),_0x225802[_0x85cd('0x23')],_0x85cd('0x31')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0xe'),_0x225802[_0x85cd('0x23')],_0x85cd('0x32')));_0x587f02['push'](getAssociatedResources(_0x85cd('0xf'),_0x225802[_0x85cd('0x23')],_0x85cd('0x33')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x10'),_0x225802[_0x85cd('0x23')],_0x85cd('0x34')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x11'),_0x225802[_0x85cd('0x23')],_0x85cd('0x35')));_0x587f02['push'](getAssociatedResources('WhatsappQueues',_0x225802[_0x85cd('0x23')],_0x85cd('0x36')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x13'),_0x225802['userProfileId'],_0x85cd('0x5')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x14'),_0x225802['userProfileId'],_0x85cd('0x3b')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x15'),_0x225802[_0x85cd('0x23')],_0x85cd('0x19')));_0x587f02[_0x85cd('0x2f')](db['User']['findAll'](queryAgents));break;case _0x85cd('0x7'):_0x14ab80[_0x592b77](_0x85cd('0x2d'));_0x14ab80[_0x592b77](_0x85cd('0x38'));_0x587f02['push'](_0x225802[_0x85cd('0x3c')]({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802['getChatQueues']({'attributes':['id',_0x85cd('0x4')]}));_0x587f02['push'](_0x225802['getFaxQueues']({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x3d')]({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x3e')]({'attributes':['id','name']}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x3f')]({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x40')]({'attributes':['id',_0x85cd('0x4')]}));break;}return BPromise[_0x85cd('0x41')](_0x587f02);}})[_0x85cd('0xc')](function(_0x511b2a){if(_0x511b2a&&_0x511b2a['length']){for(var _0x2ae134=0x0;_0x2ae134<_0x511b2a[_0x85cd('0x1d')];_0x2ae134+=0x1){for(var _0x3d7af4=0x0;_0x3d7af4<_0x511b2a[_0x2ae134][_0x85cd('0x1d')];_0x3d7af4+=0x1){switch(_0x2ae134){case 0x0:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x42'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x1:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x43'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x2:joinOrLeaveQueues(_0x14ab80,_0x592b77,'fax',_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x3:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x44'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x4:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x45'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x5:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x46'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x6:joinOrLeaveQueues(_0x14ab80,_0x592b77,'whatsapp',_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x7:_0x14ab80[_0x592b77](util['format']('telephone:%s',_0x511b2a[_0x2ae134][_0x3d7af4]['name']));break;case 0x8:_0x14ab80[_0x592b77](util['format'](_0x85cd('0x47'),_0x511b2a[_0x2ae134][_0x3d7af4]['name']));break;case 0x9:_0x14ab80[_0x592b77](util['format'](_0x85cd('0x48'),_0x511b2a[_0x2ae134][_0x3d7af4][_0x85cd('0x1a')],_0x511b2a[_0x2ae134][_0x3d7af4][_0x85cd('0x4')]));break;case 0xa:_0x14ab80[_0x592b77](util[_0x85cd('0x1b')]('user:%s',_0x511b2a[_0x2ae134][_0x3d7af4][_0x85cd('0x4')]));break;}}}}})[_0x85cd('0xc')](function(){if(_0x592b77==='leave'){var _0x58f5ce=_[_0x85cd('0x18')](_0x2b00a8['ChatInteractions'],'id');return _0x2b00a8[_0x85cd('0x49')](_0x58f5ce)['then'](function(){for(var _0x79f956=0x0;_0x79f956<_0x58f5ce[_0x85cd('0x1d')];_0x79f956+=0x1){_0x290b57[_0x85cd('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x58f5ce[_0x79f956]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0xc')](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x36c146=_[_0x85cd('0x18')](_0x2b00a8['MailInteractions'],'id');return _0x2b00a8[_0x85cd('0x4c')](_0x36c146)[_0x85cd('0xc')](function(){for(var _0x4d6aeb=0x0;_0x4d6aeb<_0x36c146[_0x85cd('0x1d')];_0x4d6aeb+=0x1){_0x290b57['emit'](_0x85cd('0x4d'),{'MailInteractionId':Number(_0x36c146[_0x4d6aeb]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0xc')](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x42cf1a=_[_0x85cd('0x18')](_0x2b00a8[_0x85cd('0x4e')],'id');return _0x2b00a8['removeFaxInteractions'](_0x42cf1a)['then'](function(){for(var _0x35b575=0x0;_0x35b575<_0x42cf1a[_0x85cd('0x1d')];_0x35b575+=0x1){_0x290b57[_0x85cd('0x4a')](_0x85cd('0x4f'),{'FaxInteractionId':Number(_0x42cf1a[_0x35b575]),'UserId':Number(_0x2b00a8['id'])});}});}})['then'](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x1afbff=_[_0x85cd('0x18')](_0x2b00a8[_0x85cd('0x50')],'id');return _0x2b00a8[_0x85cd('0x51')](_0x1afbff)[_0x85cd('0xc')](function(){for(var _0x3ab6d4=0x0;_0x3ab6d4<_0x1afbff['length'];_0x3ab6d4+=0x1){_0x290b57['emit'](_0x85cd('0x52'),{'SmsInteractionId':Number(_0x1afbff[_0x3ab6d4]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0xc')](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x349208=_['map'](_0x2b00a8[_0x85cd('0x29')],'id');return _0x2b00a8[_0x85cd('0x53')](_0x349208)['then'](function(){for(var _0x395b9a=0x0;_0x395b9a<_0x349208[_0x85cd('0x1d')];_0x395b9a+=0x1){_0x290b57['emit'](_0x85cd('0x54'),{'OpenchannelInteractionId':Number(_0x349208[_0x395b9a]),'UserId':Number(_0x2b00a8['id'])});}});}})['then'](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x56e747=_[_0x85cd('0x18')](_0x2b00a8[_0x85cd('0x2b')],'id');return _0x2b00a8[_0x85cd('0x55')](_0x56e747)[_0x85cd('0xc')](function(){for(var _0x14179b=0x0;_0x14179b<_0x56e747['length'];_0x14179b+=0x1){_0x290b57['emit'](_0x85cd('0x56'),{'WhatsappInteractionId':Number(_0x56e747[_0x14179b]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0x57')](function(_0x5b1c19){_0x14ab80[_0x85cd('0x58')](_0x5b1c19);});}}function onDisconnect(_0x461038,_0xe1f0bb){joinOrLeave(_0x461038,_0x85cd('0x4b'),_0xe1f0bb);}function onConnect(_0x1f6f18){joinOrLeave(_0x1f6f18,'join');}exports[_0x85cd('0x59')]=function(_0x2c669c){_0x2c669c['on'](_0x85cd('0x5a'),function(_0x680dc9){_0x680dc9[_0x85cd('0x5b')](0x0);_0x680dc9[_0x85cd('0x5c')]=_0x680dc9[_0x85cd('0x5d')][_0x85cd('0x5a')][_0x85cd('0x5e')]+':'+_0x680dc9['request']['connection'][_0x85cd('0x5f')];_0x680dc9[_0x85cd('0x60')]=new Date();_0x680dc9[_0x85cd('0x58')]=function(_0x4525f8){console[_0x85cd('0x58')](_0x85cd('0x61')+_0x680dc9['nsp'][_0x85cd('0x4')]+'['+_0x680dc9[_0x85cd('0x5c')]+']',_0x4525f8);};_0x680dc9['on'](_0x85cd('0x62'),function(){onDisconnect(_0x680dc9,_0x2c669c);_0x680dc9['log'](_0x85cd('0x63'));});onConnect(_0x680dc9);_0x680dc9['log'](_0x85cd('0x64'));});}; \ No newline at end of file +var _0x899a=['getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','Agents','User','name','role','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','Campaign','where','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','VoiceQueue','push','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','userProfileId','FaxQueues','SmsQueues','MailQueues','MailQueue','getChatQueues','getFaxQueues'];(function(_0x422bdd,_0x4ac57b){var _0x2fa155=function(_0x127ced){while(--_0x127ced){_0x422bdd['push'](_0x422bdd['shift']());}};_0x2fa155(++_0x4ac57b);}(_0x899a,0x1b6));var _0xa899=function(_0x599c83,_0x1f7a0a){_0x599c83=_0x599c83-0x0;var _0x14d112=_0x899a[_0x599c83];return _0x14d112;};'use strict';var _=require(_0xa899('0x0'));var util=require(_0xa899('0x1'));var BPromise=require('bluebird');var db=require(_0xa899('0x2'))['db'];var config=require(_0xa899('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xa899('0x4'),'model':db[_0xa899('0x5')],'attributes':['id',_0xa899('0x6'),_0xa899('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa899('0x6')],'where':{'role':_0xa899('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa899('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xa899('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa899('0x6'),_0xa899('0x9')],'where':{'type':_0xa899('0xa')}};function getAssociatedResources(_0x13781f,_0xaf0068,_0x242afe){return db[_0xa899('0xb')][_0xa899('0xc')]({'where':{'name':_0x13781f,'userProfileId':_0xaf0068},'raw':!![]})[_0xa899('0xd')](function(_0x34282a){if(_0x34282a){if(_0x34282a['autoAssociation']){switch(_0x13781f){case _0xa899('0xe'):case'ChatQueues':case'FaxQueues':case'SmsQueues':case'MailQueues':case _0xa899('0xf'):case _0xa899('0x10'):return db[_0x242afe][_0xa899('0x11')](queryQueues);case'Telephones':return db[_0x242afe][_0xa899('0x11')](queryTelephones);case _0xa899('0x12'):return db[_0x242afe]['findAll'](queryTrunks);case _0xa899('0x13'):return db[_0x242afe][_0xa899('0x11')](queryCampaigns);}}else{return db[_0xa899('0x14')][_0xa899('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x34282a['id']},'raw':!![]})[_0xa899('0xd')](function(_0x205601){if(_0x205601){var _0x4c08cc={'where':{'id':_[_0xa899('0x15')](_0x205601,_0xa899('0x16'))},'raw':!![]};switch(_0x242afe){case _0xa899('0x5'):_0x4c08cc['where']['role']=_0xa899('0x8');break;case _0xa899('0x17'):_0x4c08cc[_0xa899('0x18')][_0xa899('0x9')]=_0xa899('0xa');break;}return db[_0x242afe]['findAll'](_0x4c08cc);}else{return[];}});}}else{return[];}})[_0xa899('0xd')](function(_0x4fd924){return _0x4fd924;});}function joinOrLeaveQueues(_0x32882d,_0x3d5078,_0x57a2b1,_0x43574d){_0x32882d[_0x3d5078](util[_0xa899('0x19')](_0xa899('0x1a'),_0x57a2b1,_0x43574d[_0xa899('0x6')]));if(_0x43574d[_0xa899('0x4')]){for(var _0x5d7269=0x0;_0x5d7269<_0x43574d[_0xa899('0x4')][_0xa899('0x1b')];_0x5d7269+=0x1){_0x32882d[_0x3d5078](util['format'](_0xa899('0x1c'),_0x43574d[_0xa899('0x4')][_0x5d7269][_0xa899('0x6')]));}}}function joinOrLeave(_0x238fd2,_0x3453cd,_0x4c0a44){var _0xc83b7f;if(_0x238fd2[_0xa899('0x1d')][_0xa899('0x1e')]['id']){db['User'][_0xa899('0x1f')]({'attributes':['id',_0xa899('0x6'),_0xa899('0x7'),'userProfileId'],'where':{'id':_0x238fd2[_0xa899('0x1d')][_0xa899('0x1e')]['id']},'include':[{'model':db[_0xa899('0x20')],'as':_0xa899('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xa899('0x22')],'as':_0xa899('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa899('0x24')],'as':_0xa899('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xa899('0x26')],'as':_0xa899('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa899('0x28')],'as':_0xa899('0x29'),'attributes':['id'],'raw':!![]}]})[_0xa899('0xd')](function(_0x5d0362){if(_0x5d0362){_0xc83b7f=_0x5d0362;_0x238fd2[_0x3453cd](util[_0xa899('0x19')](_0xa899('0x1c'),_0x5d0362['name']));var _0x3591fa=[];switch(_0x5d0362[_0xa899('0x7')]){case _0xa899('0x2a'):_0x238fd2[_0x3453cd](_0xa899('0x2b'));_0x238fd2[_0x3453cd](_0xa899('0x2c'));if(queryQueues[_0xa899('0x2d')]('include')){delete queryQueues['include'];}_0x3591fa['push'](db[_0xa899('0x2e')][_0xa899('0x11')](queryQueues));_0x3591fa[_0xa899('0x2f')](db[_0xa899('0x30')][_0xa899('0x11')](queryQueues));_0x3591fa[_0xa899('0x2f')](db[_0xa899('0x31')]['findAll'](queryQueues));_0x3591fa[_0xa899('0x2f')](db['SmsQueue'][_0xa899('0x11')](queryQueues));_0x3591fa[_0xa899('0x2f')](db['MailQueue'][_0xa899('0x11')](queryQueues));_0x3591fa['push'](db[_0xa899('0x32')][_0xa899('0x11')](queryQueues));_0x3591fa[_0xa899('0x2f')](db[_0xa899('0x33')][_0xa899('0x11')](queryQueues));_0x3591fa[_0xa899('0x2f')](db[_0xa899('0x5')][_0xa899('0x11')](queryTelephones));_0x3591fa[_0xa899('0x2f')](db[_0xa899('0x34')]['findAll'](queryTrunks));_0x3591fa[_0xa899('0x2f')](db[_0xa899('0x17')][_0xa899('0x11')](queryCampaigns));_0x3591fa['push'](db[_0xa899('0x5')][_0xa899('0x11')](queryAgents));break;case _0xa899('0x35'):_0x238fd2[_0x3453cd]('voice:inbound');_0x238fd2[_0x3453cd](_0xa899('0x2c'));_0x3591fa[_0xa899('0x2f')](getAssociatedResources(_0xa899('0xe'),_0x5d0362['userProfileId'],_0xa899('0x2e')));_0x3591fa[_0xa899('0x2f')](getAssociatedResources(_0xa899('0x36'),_0x5d0362[_0xa899('0x37')],_0xa899('0x30')));_0x3591fa[_0xa899('0x2f')](getAssociatedResources(_0xa899('0x38'),_0x5d0362[_0xa899('0x37')],_0xa899('0x31')));_0x3591fa[_0xa899('0x2f')](getAssociatedResources(_0xa899('0x39'),_0x5d0362['userProfileId'],'SmsQueue'));_0x3591fa[_0xa899('0x2f')](getAssociatedResources(_0xa899('0x3a'),_0x5d0362[_0xa899('0x37')],_0xa899('0x3b')));_0x3591fa['push'](getAssociatedResources(_0xa899('0xf'),_0x5d0362[_0xa899('0x37')],_0xa899('0x32')));_0x3591fa[_0xa899('0x2f')](getAssociatedResources(_0xa899('0x10'),_0x5d0362[_0xa899('0x37')],'WhatsappQueue'));_0x3591fa['push'](getAssociatedResources('Telephones',_0x5d0362[_0xa899('0x37')],_0xa899('0x5')));_0x3591fa[_0xa899('0x2f')](getAssociatedResources(_0xa899('0x12'),_0x5d0362[_0xa899('0x37')],'Trunk'));_0x3591fa['push'](getAssociatedResources(_0xa899('0x13'),_0x5d0362[_0xa899('0x37')],'Campaign'));_0x3591fa[_0xa899('0x2f')](db[_0xa899('0x5')][_0xa899('0x11')](queryAgents));break;case'agent':_0x238fd2[_0x3453cd](_0xa899('0x2b'));_0x238fd2[_0x3453cd](_0xa899('0x2c'));_0x3591fa[_0xa899('0x2f')](_0x5d0362['getVoiceQueues']({'attributes':['id',_0xa899('0x6')]}));_0x3591fa['push'](_0x5d0362[_0xa899('0x3c')]({'attributes':['id',_0xa899('0x6')]}));_0x3591fa[_0xa899('0x2f')](_0x5d0362[_0xa899('0x3d')]({'attributes':['id',_0xa899('0x6')]}));_0x3591fa[_0xa899('0x2f')](_0x5d0362[_0xa899('0x3e')]({'attributes':['id',_0xa899('0x6')]}));_0x3591fa[_0xa899('0x2f')](_0x5d0362[_0xa899('0x3f')]({'attributes':['id',_0xa899('0x6')]}));_0x3591fa[_0xa899('0x2f')](_0x5d0362[_0xa899('0x40')]({'attributes':['id',_0xa899('0x6')]}));_0x3591fa[_0xa899('0x2f')](_0x5d0362[_0xa899('0x41')]({'attributes':['id',_0xa899('0x6')]}));break;}return BPromise['all'](_0x3591fa);}})['then'](function(_0x2e31a1){if(_0x2e31a1&&_0x2e31a1[_0xa899('0x1b')]){for(var _0x2d47c6=0x0;_0x2d47c6<_0x2e31a1[_0xa899('0x1b')];_0x2d47c6+=0x1){for(var _0x28b06e=0x0;_0x28b06e<_0x2e31a1[_0x2d47c6][_0xa899('0x1b')];_0x28b06e+=0x1){switch(_0x2d47c6){case 0x0:joinOrLeaveQueues(_0x238fd2,_0x3453cd,_0xa899('0x42'),_0x2e31a1[_0x2d47c6][_0x28b06e]);break;case 0x1:joinOrLeaveQueues(_0x238fd2,_0x3453cd,_0xa899('0x43'),_0x2e31a1[_0x2d47c6][_0x28b06e]);break;case 0x2:joinOrLeaveQueues(_0x238fd2,_0x3453cd,'fax',_0x2e31a1[_0x2d47c6][_0x28b06e]);break;case 0x3:joinOrLeaveQueues(_0x238fd2,_0x3453cd,_0xa899('0x44'),_0x2e31a1[_0x2d47c6][_0x28b06e]);break;case 0x4:joinOrLeaveQueues(_0x238fd2,_0x3453cd,_0xa899('0x45'),_0x2e31a1[_0x2d47c6][_0x28b06e]);break;case 0x5:joinOrLeaveQueues(_0x238fd2,_0x3453cd,_0xa899('0x46'),_0x2e31a1[_0x2d47c6][_0x28b06e]);break;case 0x6:joinOrLeaveQueues(_0x238fd2,_0x3453cd,'whatsapp',_0x2e31a1[_0x2d47c6][_0x28b06e]);break;case 0x7:_0x238fd2[_0x3453cd](util[_0xa899('0x19')](_0xa899('0x47'),_0x2e31a1[_0x2d47c6][_0x28b06e][_0xa899('0x6')]));break;case 0x8:_0x238fd2[_0x3453cd](util[_0xa899('0x19')](_0xa899('0x48'),_0x2e31a1[_0x2d47c6][_0x28b06e]['name']));break;case 0x9:_0x238fd2[_0x3453cd](util[_0xa899('0x19')](_0xa899('0x49'),_0x2e31a1[_0x2d47c6][_0x28b06e][_0xa899('0x9')],_0x2e31a1[_0x2d47c6][_0x28b06e]['name']));break;case 0xa:_0x238fd2[_0x3453cd](util['format'](_0xa899('0x1c'),_0x2e31a1[_0x2d47c6][_0x28b06e][_0xa899('0x6')]));break;}}}}})[_0xa899('0xd')](function(){if(_0x3453cd===_0xa899('0x4a')){var _0x10c347=_['map'](_0xc83b7f[_0xa899('0x21')],'id');return _0xc83b7f[_0xa899('0x4b')](_0x10c347)[_0xa899('0xd')](function(){for(var _0x4a629d=0x0;_0x4a629d<_0x10c347['length'];_0x4a629d+=0x1){_0x4c0a44[_0xa899('0x4c')](_0xa899('0x4d'),{'ChatInteractionId':Number(_0x10c347[_0x4a629d]),'UserId':Number(_0xc83b7f['id'])});}});}})[_0xa899('0xd')](function(){if(_0x3453cd==='leave'){var _0x245d8d=_[_0xa899('0x15')](_0xc83b7f[_0xa899('0x23')],'id');return _0xc83b7f['removeMailInteractions'](_0x245d8d)['then'](function(){for(var _0x200116=0x0;_0x200116<_0x245d8d['length'];_0x200116+=0x1){_0x4c0a44[_0xa899('0x4c')](_0xa899('0x4e'),{'MailInteractionId':Number(_0x245d8d[_0x200116]),'UserId':Number(_0xc83b7f['id'])});}});}})['then'](function(){if(_0x3453cd===_0xa899('0x4a')){var _0x1a8b1b=_[_0xa899('0x15')](_0xc83b7f[_0xa899('0x25')],'id');return _0xc83b7f[_0xa899('0x4f')](_0x1a8b1b)[_0xa899('0xd')](function(){for(var _0x71b54f=0x0;_0x71b54f<_0x1a8b1b[_0xa899('0x1b')];_0x71b54f+=0x1){_0x4c0a44[_0xa899('0x4c')](_0xa899('0x50'),{'FaxInteractionId':Number(_0x1a8b1b[_0x71b54f]),'UserId':Number(_0xc83b7f['id'])});}});}})[_0xa899('0xd')](function(){if(_0x3453cd===_0xa899('0x4a')){var _0x7edfc7=_[_0xa899('0x15')](_0xc83b7f[_0xa899('0x27')],'id');return _0xc83b7f[_0xa899('0x51')](_0x7edfc7)[_0xa899('0xd')](function(){for(var _0x3b07db=0x0;_0x3b07db<_0x7edfc7[_0xa899('0x1b')];_0x3b07db+=0x1){_0x4c0a44[_0xa899('0x4c')](_0xa899('0x52'),{'SmsInteractionId':Number(_0x7edfc7[_0x3b07db]),'UserId':Number(_0xc83b7f['id'])});}});}})[_0xa899('0xd')](function(){if(_0x3453cd===_0xa899('0x4a')){var _0x1607b9=_[_0xa899('0x15')](_0xc83b7f[_0xa899('0x53')],'id');return _0xc83b7f['removeOpenchannelInteractions'](_0x1607b9)['then'](function(){for(var _0x145503=0x0;_0x145503<_0x1607b9[_0xa899('0x1b')];_0x145503+=0x1){_0x4c0a44['emit'](_0xa899('0x54'),{'OpenchannelInteractionId':Number(_0x1607b9[_0x145503]),'UserId':Number(_0xc83b7f['id'])});}});}})[_0xa899('0xd')](function(){if(_0x3453cd===_0xa899('0x4a')){var _0xbbca13=_[_0xa899('0x15')](_0xc83b7f[_0xa899('0x29')],'id');return _0xc83b7f[_0xa899('0x55')](_0xbbca13)[_0xa899('0xd')](function(){for(var _0x47f7c0=0x0;_0x47f7c0<_0xbbca13[_0xa899('0x1b')];_0x47f7c0+=0x1){_0x4c0a44[_0xa899('0x4c')](_0xa899('0x56'),{'WhatsappInteractionId':Number(_0xbbca13[_0x47f7c0]),'UserId':Number(_0xc83b7f['id'])});}});}})['catch'](function(_0x4035d8){_0x238fd2[_0xa899('0x57')](_0x4035d8);});}}function onDisconnect(_0x4037ef,_0x36dc4a){joinOrLeave(_0x4037ef,_0xa899('0x4a'),_0x36dc4a);}function onConnect(_0x37e695){joinOrLeave(_0x37e695,_0xa899('0x58'));}exports[_0xa899('0x59')]=function(_0x526070){_0x526070['on'](_0xa899('0x5a'),function(_0x5641ee){_0x5641ee[_0xa899('0x5b')](0x0);_0x5641ee[_0xa899('0x5c')]=_0x5641ee['request'][_0xa899('0x5a')][_0xa899('0x5d')]+':'+_0x5641ee['request'][_0xa899('0x5a')][_0xa899('0x5e')];_0x5641ee[_0xa899('0x5f')]=new Date();_0x5641ee[_0xa899('0x57')]=function(_0x1a3572){console[_0xa899('0x57')](_0xa899('0x60')+_0x5641ee[_0xa899('0x61')][_0xa899('0x6')]+'['+_0x5641ee[_0xa899('0x5c')]+']',_0x1a3572);};_0x5641ee['on']('disconnect',function(){onDisconnect(_0x5641ee,_0x526070);_0x5641ee[_0xa899('0x57')](_0xa899('0x62'));});onConnect(_0x5641ee);_0x5641ee[_0xa899('0x57')](_0xa899('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 74a90d5..840eb58 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 _0xada6=['Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','info','error','code','Trigger,\x20%s','get','channel','event','UserId','find','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','User','then','catch','hasOwnProperty','model','callback','toLowerCase','condition','../../mysqldb','jayson/promise','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','SmsInteraction','Sms','newmessage','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xada6,0x1b0));var _0x6ada=function(_0x3d518c,_0x35b953){_0x3d518c=_0x3d518c-0x0;var _0xf32bf0=_0xada6[_0x3d518c];return _0xf32bf0;};'use strict';var util=require('util');var db=require(_0x6ada('0x0'))['db'];var jayson=require(_0x6ada('0x1'));var logger=require('../logger')(_0x6ada('0x2'));var client=jayson['client'][_0x6ada('0x3')]({'port':0x232a});var triggers=[{'channel':_0x6ada('0x4'),'model':_0x6ada('0x5'),'event':_0x6ada('0x6'),'condition':_0x6ada('0x7'),'callback':afterCreate},{'channel':_0x6ada('0x4'),'model':_0x6ada('0x5'),'event':_0x6ada('0x8'),'condition':_0x6ada('0x9'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':_0x6ada('0xa'),'event':_0x6ada('0x6'),'condition':_0x6ada('0x7'),'callback':afterCreate},{'channel':_0x6ada('0xb'),'model':_0x6ada('0xa'),'event':_0x6ada('0x8'),'condition':_0x6ada('0x9'),'callback':afterUpdate},{'channel':_0x6ada('0xb'),'model':'SmsMessage','event':'afterCreate','condition':_0x6ada('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':'afterCreate','condition':_0x6ada('0x7'),'callback':afterCreate},{'channel':_0x6ada('0xd'),'model':'WhatsappInteraction','event':_0x6ada('0x8'),'condition':_0x6ada('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x6ada('0xe'),'event':_0x6ada('0x6'),'condition':_0x6ada('0xc'),'callback':afterCreateMessage},{'channel':_0x6ada('0xf'),'model':_0x6ada('0x10'),'event':'afterCreate','condition':_0x6ada('0x7'),'callback':afterCreate},{'channel':_0x6ada('0xf'),'model':_0x6ada('0x10'),'event':_0x6ada('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6ada('0xf'),'model':_0x6ada('0x11'),'event':_0x6ada('0x6'),'condition':_0x6ada('0xc'),'callback':afterCreateMessage},{'channel':_0x6ada('0x12'),'model':_0x6ada('0x13'),'event':_0x6ada('0x6'),'condition':_0x6ada('0x7'),'callback':afterCreate},{'channel':_0x6ada('0x12'),'model':_0x6ada('0x13'),'event':_0x6ada('0x8'),'condition':_0x6ada('0x9'),'callback':afterUpdate},{'channel':_0x6ada('0x12'),'model':'MailMessage','event':_0x6ada('0x6'),'condition':_0x6ada('0xc'),'callback':afterCreateMessage},{'channel':_0x6ada('0x14'),'model':_0x6ada('0x15'),'event':_0x6ada('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x6ada('0x15'),'event':_0x6ada('0x8'),'condition':_0x6ada('0x9'),'callback':afterUpdate},{'channel':_0x6ada('0x14'),'model':_0x6ada('0x16'),'event':_0x6ada('0x6'),'condition':_0x6ada('0xc'),'callback':afterCreateMessage}];function request(_0x47ae8c){return client['request'](_0x6ada('0x17'),_0x47ae8c)['then'](function(_0x275fba){logger[_0x6ada('0x18')]('Trigger,\x20%s',_0x6ada('0x17'),_0x275fba);if(_0x275fba[_0x6ada('0x19')]){if(_0x275fba['error'][_0x6ada('0x1a')]===0x1f4){logger[_0x6ada('0x19')](_0x6ada('0x1b'),_0x6ada('0x17'),_0x275fba[_0x6ada('0x19')]);}}})['catch'](function(_0x23fa77){logger[_0x6ada('0x19')](_0x6ada('0x1b'),_0x6ada('0x17'),_0x23fa77);});}function afterCreateMessage(_0x42cfd4,_0x2256da){return function(_0x19ae4c,_0x5325b4){_0x19ae4c=_0x19ae4c[_0x6ada('0x1c')]({'plain':!![]});_0x19ae4c[_0x6ada('0x1d')]=_0x42cfd4;_0x19ae4c[_0x6ada('0x1e')]=_0x19ae4c['direction'];if(_0x19ae4c[_0x6ada('0x1f')]){return db['User'][_0x6ada('0x20')]({'where':{'id':_0x19ae4c[_0x6ada('0x1f')]},'attributes':['id',_0x6ada('0x21')],'raw':!![]})['then'](function(_0x31beb1){_0x19ae4c[_0x6ada('0x22')]=util[_0x6ada('0x23')](_0x6ada('0x24'),_0x31beb1[_0x6ada('0x21')]);_0x19ae4c[_0x6ada('0x1d')]=_0x42cfd4;return request({'event':_0x6ada('0x25'),'message':_0x19ae4c});})['catch'](function(_0x48f515){console[_0x6ada('0x19')](_0x48f515);});}else{return request({'event':_0x6ada('0x26'),'message':_0x19ae4c});}};}function afterCreate(_0x41d170,_0x3370fc){return function(_0x307ff9,_0x12ba89){_0x307ff9=_0x307ff9[_0x6ada('0x1c')]({'plain':!![]});_0x307ff9[_0x6ada('0x1d')]=_0x41d170;_0x307ff9[_0x6ada('0x1e')]=_0x6ada('0x27');return request({'event':_0x3370fc,'message':_0x307ff9});};}function afterUpdate(_0x2a2fe0,_0x29829f){return function(_0x158d4e,_0x27a301){if(_0x158d4e[_0x6ada('0x28')](_0x6ada('0x29'))&&_0x158d4e[_0x6ada('0x29')]){_0x158d4e=_0x158d4e['get']({'plain':!![]});_0x158d4e[_0x6ada('0x1d')]=_0x2a2fe0;_0x158d4e['event']=_0x6ada('0x29');if(_0x158d4e[_0x6ada('0x1f')]){return db[_0x6ada('0x2a')][_0x6ada('0x20')]({'where':{'id':_0x158d4e[_0x6ada('0x1f')]},'attributes':['id',_0x6ada('0x21')],'raw':!![]})[_0x6ada('0x2b')](function(_0x1cb806){_0x158d4e[_0x6ada('0x22')]=util[_0x6ada('0x23')](_0x6ada('0x24'),_0x1cb806[_0x6ada('0x21')]);return request({'event':_0x29829f,'message':_0x158d4e});})[_0x6ada('0x2c')](function(_0x256d2f){console['error'](_0x256d2f);});}else{return request({'event':_0x29829f,'message':_0x158d4e});}}};}exports['default']=function(){for(var _0xe23587=0x0;_0xe23587=_0x3891df[_0x6095('0xf')]){throw Error(_0x6095('0x10'));}_0x2d3a10(_0x2a3fbf);})[_0x6095('0x11')](function(_0x3ef4be){_0x4e037b(_0x3ef4be);});});}; \ No newline at end of file +var _0xc635=['whatsapp','openchannel','isValidChannel','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','./license/util','voice','mail','chat','fax','sms'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xc635,0x135));var _0x5c63=function(_0x23f18a,_0x1e8c60){_0x23f18a=_0x23f18a-0x0;var _0x2c9f08=_0xc635[_0x23f18a];return _0x2c9f08;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x5c63('0x0'));var channels=[_0x5c63('0x1'),_0x5c63('0x2'),_0x5c63('0x3'),_0x5c63('0x4'),_0x5c63('0x5'),_0x5c63('0x6'),_0x5c63('0x7')];exports['getChannels']=function(){return channels;};exports[_0x5c63('0x8')]=function(_0x6d4e9b){_0x6d4e9b=_0x6d4e9b['toLowerCase']();return _['includes'](channels,_0x6d4e9b);};exports[_0x5c63('0x9')]=function(_0x54b817,_0x40b422,_0xfaf386,_0x41040a){var _0x3f658a={'loginAttempts':_0x40b422,'blocked':_0xfaf386};if(!_[_0x5c63('0xa')](_0x41040a)){_0x3f658a[_0x5c63('0xb')]=_0x41040a;}return _0x54b817[_0x5c63('0xc')](_0x3f658a);};exports[_0x5c63('0xd')]=function(_0x532e5c){return new BPromise(function(_0x1fb777,_0x53ad5a){var _0x5dca2a=0x0;if(_0x532e5c[_0x5c63('0xe')]!==_0x5c63('0xf')){_0x1fb777(_0x532e5c);}db[_0x5c63('0x10')]['count']({'where':{'role':_0x5c63('0xf'),'online':!![],'id':{'$ne':_0x532e5c['id']}}})['then'](function(_0x805004){_0x5dca2a=_0x805004;return util['getLicense']();})[_0x5c63('0x11')](function(_0x435021){if(_0x435021&&_0x435021[_0x5c63('0x12')]&&_0x5dca2a>=_0x435021[_0x5c63('0x12')]){throw Error(_0x5c63('0x13'));}_0x1fb777(_0x532e5c);})[_0x5c63('0x14')](function(_0x27829e){_0x53ad5a(_0x27829e);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index fa442c2..8a8127d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x762f=['send','exports','404','status','render','json'];(function(_0xdb42a7,_0x3ab4d6){var _0x3af197=function(_0x344acd){while(--_0x344acd){_0xdb42a7['push'](_0xdb42a7['shift']());}};_0x3af197(++_0x3ab4d6);}(_0x762f,0x109));var _0xf762=function(_0x21b4a3,_0x41cac8){_0x21b4a3=_0x21b4a3-0x0;var _0x8f6385=_0x762f[_0x21b4a3];return _0x8f6385;};'use strict';module[_0xf762('0x0')][0x194]=function pageNotFound(_0x3f84c2,_0x1adc2){var _0x4af322=_0xf762('0x1');var _0x46c1f2=0x194;var _0x170109={'status':_0x46c1f2};_0x1adc2[_0xf762('0x2')](_0x170109['status']);_0x1adc2[_0xf762('0x3')](_0x4af322,{},function(_0x135af8,_0x2ed7dc){if(_0x135af8){return _0x1adc2[_0xf762('0x2')](_0x170109[_0xf762('0x2')])[_0xf762('0x4')](_0x170109);}_0x1adc2[_0xf762('0x5')](_0x2ed7dc);});}; \ No newline at end of file +var _0xc209=['404','render','status','exports'];(function(_0x583794,_0x7bb56b){var _0x3f4c77=function(_0x18b1ee){while(--_0x18b1ee){_0x583794['push'](_0x583794['shift']());}};_0x3f4c77(++_0x7bb56b);}(_0xc209,0x15f));var _0x9c20=function(_0x44d4a3,_0x5cce9a){_0x44d4a3=_0x44d4a3-0x0;var _0x3a6a93=_0xc209[_0x44d4a3];return _0x3a6a93;};'use strict';module[_0x9c20('0x0')][0x194]=function pageNotFound(_0x427fd1,_0x366c96){var _0x1dfb60=_0x9c20('0x1');var _0xe9d0e5=0x194;var _0x5f329f={'status':_0xe9d0e5};_0x366c96['status'](_0x5f329f['status']);_0x366c96[_0x9c20('0x2')](_0x1dfb60,{},function(_0x54d0e2,_0xab8ed2){if(_0x54d0e2){return _0x366c96[_0x9c20('0x3')](_0x5f329f['status'])['json'](_0x5f329f);}_0x366c96['send'](_0xab8ed2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index adb14dc..6afd76f 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3fe=['../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','Migration','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','VoiceMail','cascade','hasMany','UserVoiceQueueRt','VoiceQueuesRt','UserId','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteraction','MailInteractions','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','hasOne','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','restrict','Dashboard','DashboardItem','Items','FaxAccountId','Exntensions','Agents','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','CompanyId','JscriptySessions','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','CustomReportId','MetricId','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','Variable','VariableId','Configurations','Subjects','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','ServicenowConfiguration','Dynamics365Configuration','ChatQueueReport','ToId','SmsQueueReport','ProjectId','user_has_square_projects','user_has_teams','team_has_voice_queues','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','path','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','xC@LL1234','mysql','database','username','password','options','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0xa3fe,0x1b0));var _0xea3f=function(_0x5b8e42,_0x31ced4){_0x5b8e42=_0x5b8e42-0x0;var _0x5f1376=_0xa3fe[_0x5b8e42];return _0x5f1376;};'use strict';var path=require(_0xea3f('0x0'));var config=require('../config/environment');var Sequelize=require(_0xea3f('0x1'));var _=require(_0xea3f('0x2'));var jstz=require(_0xea3f('0x3'));var timezone=jstz['determine']();config[_0xea3f('0x1')]=_[_0xea3f('0x4')](config['sequelize'],{'database':_0xea3f('0x5'),'username':_0xea3f('0x6'),'password':'xC@LL1234','options':{'host':_0xea3f('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xea3f('0x8')},'logging':![],'timezone':timezone[_0xea3f('0x9')](),'define':{'charset':_0xea3f('0xa'),'collate':_0xea3f('0xb')}}});config['sequelizeHistory']=_[_0xea3f('0x4')](config['sequelizeHistory'],{'database':_0xea3f('0x5'),'username':_0xea3f('0x6'),'password':_0xea3f('0xc'),'options':{'host':_0xea3f('0x7'),'port':0xcea,'dialect':_0xea3f('0xd'),'dialectOptions':{'charset':_0xea3f('0x8')},'logging':![],'timezone':timezone[_0xea3f('0x9')](),'define':{'charset':_0xea3f('0xa'),'collate':_0xea3f('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xea3f('0x1')][_0xea3f('0xe')],config[_0xea3f('0x1')][_0xea3f('0xf')],config[_0xea3f('0x1')][_0xea3f('0x10')],config[_0xea3f('0x1')][_0xea3f('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xea3f('0x12')][_0xea3f('0xe')],config[_0xea3f('0x12')][_0xea3f('0xf')],config['sequelizeHistory'][_0xea3f('0x10')],config[_0xea3f('0x12')]['options'])};db[_0xea3f('0x13')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x15'));db[_0xea3f('0x16')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x17'));db[_0xea3f('0x18')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x19'));db[_0xea3f('0x1a')]=db['sequelize']['import'](_0xea3f('0x1b'));db[_0xea3f('0x1c')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x1d'));db[_0xea3f('0x1e')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x1f'));db[_0xea3f('0x20')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x21'));db['ScreenRecording']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x22'));db['VoiceMail']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x23'));db[_0xea3f('0x24')]=db['sequelize'][_0xea3f('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xea3f('0x25')]=db[_0xea3f('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xea3f('0x26')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x27'));db[_0xea3f('0x28')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x29'));db[_0xea3f('0x2a')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x2b'));db[_0xea3f('0x2c')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/memberReport/memberReport.model');db[_0xea3f('0x2d')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x2e'));db['UserVoiceQueueRt']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x2f'));db[_0xea3f('0x30')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x31'));db[_0xea3f('0x32')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x33'));db[_0xea3f('0x34')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x35'));db[_0xea3f('0x36')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0xea3f('0x37')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x38'));db[_0xea3f('0x39')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xea3f('0x3a')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x3b'));db[_0xea3f('0x3c')]=db[_0xea3f('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0xea3f('0x3d')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x3e'));db[_0xea3f('0x3f')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x40'));db[_0xea3f('0x41')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x42'));db[_0xea3f('0x43')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x44'));db[_0xea3f('0x45')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x46'));db[_0xea3f('0x47')]=db['sequelize']['import'](_0xea3f('0x48'));db['Dashboard']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x49'));db['DashboardItem']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x4a'));db[_0xea3f('0x4b')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x4c'));db[_0xea3f('0x4d')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x4e'));db['FaxInteraction']=db['sequelize']['import'](_0xea3f('0x4f'));db[_0xea3f('0x50')]=db[_0xea3f('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0xea3f('0x51')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/faxQueue/faxQueue.model');db[_0xea3f('0x52')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x53'));db[_0xea3f('0x54')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/smsAccount/smsAccount.model');db[_0xea3f('0x55')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x56'));db['SmsInteraction']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x57'));db[_0xea3f('0x58')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x59'));db[_0xea3f('0x5a')]=db['sequelize']['import'](_0xea3f('0x5b'));db[_0xea3f('0x5c')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x5d'));db[_0xea3f('0x5e')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x5f'));db['OpenchannelInteraction']=db['sequelize'][_0xea3f('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x60'));db[_0xea3f('0x61')]=db['sequelize']['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xea3f('0x62')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x63'));db[_0xea3f('0x64')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x65'));db[_0xea3f('0x66')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x67'));db[_0xea3f('0x68')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0xea3f('0x69')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x6a'));db['ChatOfflineMessage']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x6b'));db[_0xea3f('0x6c')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x6d'));db[_0xea3f('0x6e')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x6f'));db[_0xea3f('0x70')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x71'));db[_0xea3f('0x72')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x73'));db[_0xea3f('0x74')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x75'));db[_0xea3f('0x76')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xea3f('0x77')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x78'));db[_0xea3f('0x79')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x7a'));db[_0xea3f('0x7b')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x7c'));db[_0xea3f('0x7d')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x7e'));db['CannedAnswer']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x7f'));db[_0xea3f('0x80')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x81'));db[_0xea3f('0x82')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x83'));db[_0xea3f('0x84')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x85'));db[_0xea3f('0x86')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x87'));db['Cdr']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x88'));db[_0xea3f('0x89')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xea3f('0x8a')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x8b'));db[_0xea3f('0x8c')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x8d'));db['Tag']=db[_0xea3f('0x1')]['import']('../api/tag/tag.model');db['Template']=db[_0xea3f('0x1')]['import'](_0xea3f('0x8e'));db[_0xea3f('0x8f')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x90'));db['Variable']=db[_0xea3f('0x1')]['import'](_0xea3f('0x91'));db['Integration']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x92'));db['IntegrationReport']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x93'));db[_0xea3f('0x94')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x95'));db['AnalyticDefaultReport']=db['sequelize']['import'](_0xea3f('0x96'));db[_0xea3f('0x97')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x98'));db[_0xea3f('0x99')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9a'));db[_0xea3f('0x9b')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9c'));db['AnalyticTreeReport']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9d'));db[_0xea3f('0x9e')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9f'));db[_0xea3f('0xa0')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xa1'));db[_0xea3f('0xa2')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xa3'));db[_0xea3f('0xa4')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xa5'));db[_0xea3f('0xa6')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xa7'));db[_0xea3f('0xa8')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xa9'));db[_0xea3f('0xaa')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xab'));db[_0xea3f('0xac')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xad'));db[_0xea3f('0xae')]=db['sequelize'][_0xea3f('0x14')]('../api/intDeskField/intDeskField.model');db[_0xea3f('0xaf')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xb0'));db[_0xea3f('0xb1')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xea3f('0xb2')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xb3'));db['ZendeskAccount']=db['sequelize'][_0xea3f('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xea3f('0xb4')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xb5'));db[_0xea3f('0xb6')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xb7'));db['FreshdeskAccount']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xea3f('0xb8')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xb9'));db[_0xea3f('0xba')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xbb'));db['VtigerAccount']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xbc'));db['VtigerConfiguration']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xbd'));db[_0xea3f('0xbe')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0xea3f('0xbf')]=db['sequelize'][_0xea3f('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xc0'));db[_0xea3f('0xc1')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xc2'));db['Dynamics365Account']=db['sequelize']['import'](_0xea3f('0xc3'));db['Dynamics365Configuration']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xea3f('0xc4')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xc5'));db[_0xea3f('0xc6')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xc7'));db[_0xea3f('0xc8')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xc9'));db[_0xea3f('0xca')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xcb'));db['Integration']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/integration/integration.model');db['Network']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xcc'));db['ChatQueueReport']=db[_0xea3f('0x1')]['import'](_0xea3f('0xcd'));db[_0xea3f('0xce')]=db[_0xea3f('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xea3f('0xcf')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xd0'));db[_0xea3f('0xd1')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xd2'));db[_0xea3f('0xd3')]=db['sequelize'][_0xea3f('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xea3f('0xd4')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xd5'));db[_0xea3f('0xd6')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xd7'));db[_0xea3f('0xd8')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xd9'));db[_0xea3f('0xda')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xdb'));db[_0xea3f('0xdc')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xdd'));db['SquareProject']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xde'));db['SquareRecording']=db[_0xea3f('0x1')]['import']('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xdf'));db[_0xea3f('0xe0')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe1'));db[_0xea3f('0xe2')]=db[_0xea3f('0x1')]['import']('../api/license/license.model');db[_0xea3f('0xe3')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/campaign/campaign.model');db[_0xea3f('0xe4')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/migration/migration.model');db['Attachment']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe5'));db['Plugin']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe6'));db[_0xea3f('0xe7')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe8'));db[_0xea3f('0xe9')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0xea3f('0xea')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xeb'));db[_0xea3f('0xec')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xed'));db[_0xea3f('0xee')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xef'));db[_0xea3f('0xf0')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0xea3f('0xf1')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userProfile/userProfile.model');db[_0xea3f('0xf2')]=db['sequelize'][_0xea3f('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0xea3f('0xf3')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xf4'));db[_0xea3f('0xf5')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xf6'));db[_0xea3f('0xf7')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0xea3f('0xf8')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xf9'));db[_0xea3f('0xfa')]=db['sequelize']['import'](_0xea3f('0xfb'));db[_0xea3f('0xfc')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xfd'));db[_0xea3f('0xfe')]=db['sequelize'][_0xea3f('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xff'));db[_0xea3f('0x100')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0xea3f('0x101')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cloudProvider/cloudProvider.model');db[_0xea3f('0x13')]['hasOne'](db[_0xea3f('0x102')],{'as':_0xea3f('0x102'),'onDelete':_0xea3f('0x103'),'foreignKey':'UserId'});db['User'][_0xea3f('0x104')](db[_0xea3f('0x20')],{'as':'Recordings','foreignKey':'UserId'});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x105')],{'as':_0xea3f('0x106'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x108'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x13')]['hasMany'](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':_0xea3f('0x107')});db['User']['hasMany'](db[_0xea3f('0x77')],{'as':_0xea3f('0x10a'),'foreignKey':'UserId'});db[_0xea3f('0x13')][_0xea3f('0x104')](db['ReportAgentPreview'],{'as':_0xea3f('0x79'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x10b')],{'as':'OpenchannelInteractions','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db['ChatInteraction'],{'as':_0xea3f('0x10c'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x10e'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')]['hasMany'](db[_0xea3f('0x10f')],{'as':'FaxInteractions','foreignKey':'UserId'});db['User']['hasMany'](db[_0xea3f('0x41')],{'as':_0xea3f('0x110'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0xfa')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0xf5')],{'as':'Notifications','foreignKey':'SenderId'});db[_0xea3f('0x13')][_0xea3f('0x111')](db[_0xea3f('0xf1')],{'as':_0xea3f('0xf1'),'foreignKey':_0xea3f('0x112')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x6e')],{'as':_0xea3f('0x114'),'through':_0xea3f('0x115')});db['User'][_0xea3f('0x113')](db[_0xea3f('0x116')],{'as':_0xea3f('0x117'),'through':_0xea3f('0x118')});db['User'][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x119'),'through':_0xea3f('0x11a')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':'user_has_teams'});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x41')],{'as':_0xea3f('0x110'),'through':_0xea3f('0x11b')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x68')],{'as':'ChatInteractions','through':_0xea3f('0x11c')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x10f')],{'as':_0xea3f('0x11d'),'through':_0xea3f('0x11e')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x10e'),'through':'user_has_sms_interactions'});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x10b')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db['User'][_0xea3f('0x113')](db[_0xea3f('0xfa')],{'as':_0xea3f('0x11f'),'through':_0xea3f('0x120')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x1e')],{'as':_0xea3f('0x121'),'through':_0xea3f('0x30'),'required':![]});db['User'][_0xea3f('0x113')](db[_0xea3f('0x3f')],{'as':'MailQueues','through':_0xea3f('0x34'),'required':![]});db['User'][_0xea3f('0x113')](db[_0xea3f('0x6c')],{'as':_0xea3f('0x122'),'through':_0xea3f('0x32'),'required':![],'hooks':!![]});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x51')],{'as':_0xea3f('0x123'),'through':'UserFaxQueue','required':![]});db['User']['belongsToMany'](db[_0xea3f('0x5a')],{'as':_0xea3f('0x124'),'through':_0xea3f('0x125'),'required':![]});db['User'][_0xea3f('0x113')](db[_0xea3f('0x61')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x100')],{'as':_0xea3f('0x126'),'through':'UserWhatsappQueue','required':![]});db[_0xea3f('0x13')][_0xea3f('0x113')](db['CmList'],{'through':_0xea3f('0x11a')});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x127')],{'as':_0xea3f('0x128'),'through':_0xea3f('0x129'),'required':![]});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x62')],{'as':'ChatWebsites','through':_0xea3f('0x12a')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x4b')],{'as':_0xea3f('0x12b'),'through':'user_has_fax_accounts'});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x3d')],{'as':_0xea3f('0x12c'),'through':_0xea3f('0x12d')});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x5c')],{'as':_0xea3f('0x12e'),'through':'user_has_openchannel_accounts'});db[_0xea3f('0x13')][_0xea3f('0x113')](db['SmsAccount'],{'as':'SmsAccounts','through':_0xea3f('0x12f')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0xf7')],{'as':_0xea3f('0x130'),'through':_0xea3f('0x131')});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x132')],{'as':_0xea3f('0x133'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x134'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x135')});db[_0xea3f('0x18')]['hasMany'](db[_0xea3f('0x1a')],{'onDelete':_0xea3f('0x103')});db[_0xea3f('0x1a')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x136'),'onDelete':_0xea3f('0x103')});db['VoiceMusicOnHold'][_0xea3f('0x113')](db[_0xea3f('0x8c')],{'as':_0xea3f('0x137'),'through':_0xea3f('0x138')});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x105')],{'as':_0xea3f('0x139'),'foreignKey':_0xea3f('0x13a')});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x13b')],{'as':_0xea3f('0x13c'),'foreignKey':_0xea3f('0x13a')});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':'VoiceQueueId'});db[_0xea3f('0x1e')][_0xea3f('0x104')](db['CmHopperHistory'],{'as':_0xea3f('0x13d'),'foreignKey':'VoiceQueueId'});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x79')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x74')],{'as':_0xea3f('0x13e'),'foreignKey':_0xea3f('0x13a')});db[_0xea3f('0x1e')]['hasMany'](db[_0xea3f('0xd3')],{'as':'JscriptySessions','foreignKey':_0xea3f('0x13a')});db['VoiceQueue'][_0xea3f('0x111')](db[_0xea3f('0x2d')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xea3f('0x1e')][_0xea3f('0x111')](db[_0xea3f('0x2d')],{'as':_0xea3f('0x13f'),'foreignKey':_0xea3f('0x140')});db['VoiceQueue'][_0xea3f('0x111')](db[_0xea3f('0x84')],{'as':'Interval','foreignKey':_0xea3f('0x141')});db[_0xea3f('0x1e')]['belongsTo'](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':_0xea3f('0x143')});db[_0xea3f('0x1e')]['belongsToMany'](db[_0xea3f('0xf0')],{'as':'Lists','through':_0xea3f('0x144')});db[_0xea3f('0x1e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xea3f('0x30')});db[_0xea3f('0x1e')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'as':_0xea3f('0x145'),'through':'team_has_voice_queues'});db[_0xea3f('0x1e')][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':'User','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x146')]['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x13'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x102')][_0xea3f('0x104')](db[_0xea3f('0x24')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x148'),'sourceKey':_0xea3f('0x149')});db[_0xea3f('0x24')][_0xea3f('0x111')](db[_0xea3f('0x102')],{'foreignKey':_0xea3f('0x148'),'targetKey':_0xea3f('0x149')});db[_0xea3f('0x25')]['hasMany'](db[_0xea3f('0x2a')],{'as':_0xea3f('0x14a'),'foreignKey':_0xea3f('0x14b'),'constraints':![]});db[_0xea3f('0x25')][_0xea3f('0x104')](db[_0xea3f('0x28')],{'as':_0xea3f('0x14c'),'foreignKey':_0xea3f('0x14b'),'constraints':![]});db['VoiceCallReport'][_0xea3f('0x111')](db['User'],{'as':'User','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x25')][_0xea3f('0x111')](db['CmContact'],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x3a')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'as':_0xea3f('0x3d'),'foreignKey':_0xea3f('0x14f')});db['MailServerOut'][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'as':_0xea3f('0x3d'),'foreignKey':_0xea3f('0x14f')});db['MailAccount'][_0xea3f('0x150')](db[_0xea3f('0x3a')],{'as':_0xea3f('0x151'),'onDelete':'cascade'});db[_0xea3f('0x3d')][_0xea3f('0x150')](db[_0xea3f('0x3c')],{'as':_0xea3f('0x152'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':_0xea3f('0x14f')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x14f')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x43')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x14f')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x41')],{'as':_0xea3f('0x156')});db['MailAccount'][_0xea3f('0x104')](db['MailApplication'],{'as':_0xea3f('0x136')});db[_0xea3f('0x3d')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x3d')][_0xea3f('0x111')](db[_0xea3f('0x159')],{'as':_0xea3f('0x159'),'foreignKey':_0xea3f('0x15a')});db['MailAccount'][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xea3f('0x143')});db[_0xea3f('0x3d')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xea3f('0x3f')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':'UserMailQueue'});db[_0xea3f('0x3f')][_0xea3f('0x113')](db['Team'],{'through':_0xea3f('0x15b'),'as':_0xea3f('0x145')});db[_0xea3f('0x41')]['hasMany'](db[_0xea3f('0x43')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x15c')});db[_0xea3f('0x41')][_0xea3f('0x111')](db['MailAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x14f')});db['MailInteraction']['belongsTo'](db[_0xea3f('0x116')],{'as':'Contact','foreignKey':_0xea3f('0x14e')});db['MailInteraction'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db['MailInteraction'][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x160'),'as':_0xea3f('0x161')});db[_0xea3f('0x41')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':'mail_interaction_has_tags','as':_0xea3f('0x162')});db['MailInteraction'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x11b'),'foreignKey':_0xea3f('0x15c')});db['MailMessage'][_0xea3f('0x104')](db[_0xea3f('0x164')],{'as':_0xea3f('0x165'),'onDelete':_0xea3f('0x103')});db['MailMessage']['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x13')});db[_0xea3f('0x43')][_0xea3f('0x111')](db['CmContact'],{'onDelete':'cascade','as':_0xea3f('0x14d')});db[_0xea3f('0x43')]['belongsTo'](db['MailInteraction'],{'as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x15c')});db[_0xea3f('0x43')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'as':_0xea3f('0x15d'),'foreignKey':'MailAccountId'});db['MailApplication'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x45')][_0xea3f('0x111')](db[_0xea3f('0x3f')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x45')][_0xea3f('0x111')](db['MailAccount'],{'onDelete':'restrict'});db[_0xea3f('0x45')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x45')][_0xea3f('0x111')](db[_0xea3f('0x15f')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xea3f('0x47')][_0xea3f('0x111')](db['MailAccount'],{});db['MailQueueReport'][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':'ListId'});db[_0xea3f('0x47')]['belongsTo'](db['CmContact'],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x47')][_0xea3f('0x111')](db[_0xea3f('0x41')],{});db[_0xea3f('0x47')][_0xea3f('0x111')](db['MailMessage'],{});db[_0xea3f('0x47')][_0xea3f('0x111')](db['User'],{});db[_0xea3f('0x47')][_0xea3f('0x111')](db[_0xea3f('0x3f')],{});db[_0xea3f('0x168')][_0xea3f('0x104')](db[_0xea3f('0x169')],{'as':_0xea3f('0x16a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x4b')]['hasMany'](db[_0xea3f('0x80')],{'as':'Dispositions','foreignKey':_0xea3f('0x16b')});db[_0xea3f('0x4b')]['hasMany'](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x16b')});db[_0xea3f('0x4b')][_0xea3f('0x104')](db['FaxInteraction'],{'as':_0xea3f('0x156')});db[_0xea3f('0x4b')]['hasMany'](db[_0xea3f('0x4d')],{'as':_0xea3f('0x136')});db[_0xea3f('0x4b')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x16c'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x4b')][_0xea3f('0x104')](db['FaxMessage'],{'as':_0xea3f('0x147')});db[_0xea3f('0x4b')]['belongsTo'](db['Trunk'],{'as':_0xea3f('0x2d')});db[_0xea3f('0x4b')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':'List','foreignKey':'ListId'});db[_0xea3f('0x4b')][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':_0xea3f('0x143')});db[_0xea3f('0x4b')][_0xea3f('0x113')](db['User'],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x16e')});db[_0xea3f('0x4d')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db['FaxApplication'][_0xea3f('0x111')](db[_0xea3f('0x51')],{'onDelete':_0xea3f('0x167')});db['FaxApplication'][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x4d')][_0xea3f('0x111')](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db['FaxInteraction'][_0xea3f('0x104')](db[_0xea3f('0x50')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x170')});db[_0xea3f('0x10f')][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x16b')});db[_0xea3f('0x10f')]['belongsTo'](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x10f')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':'UserId'});db[_0xea3f('0x10f')]['belongsToMany'](db[_0xea3f('0x15f')],{'through':_0xea3f('0x171'),'as':_0xea3f('0x161')});db[_0xea3f('0x10f')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x171'),'as':'ThroughTags'});db[_0xea3f('0x10f')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x11e'),'foreignKey':'FaxInteractionId'});db[_0xea3f('0x50')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x13')});db['FaxMessage'][_0xea3f('0x111')](db[_0xea3f('0x10f')],{'as':'Interaction','foreignKey':_0xea3f('0x170')});db[_0xea3f('0x50')][_0xea3f('0x111')](db['CmContact'],{'onDelete':_0xea3f('0x103'),'as':'Contact'});db[_0xea3f('0x50')][_0xea3f('0x111')](db['Attachment'],{'as':_0xea3f('0x164'),'foreignKey':_0xea3f('0x172')});db['FaxMessage'][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'as':_0xea3f('0x15d'),'foreignKey':'FaxAccountId'});db[_0xea3f('0x51')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x36')});db[_0xea3f('0x51')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':'team_has_fax_queues','as':_0xea3f('0x145')});db[_0xea3f('0x52')][_0xea3f('0x111')](db['FaxAccount'],{});db[_0xea3f('0x52')]['belongsTo'](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x52')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x52')]['belongsTo'](db[_0xea3f('0x10f')],{});db[_0xea3f('0x52')][_0xea3f('0x111')](db[_0xea3f('0x50')],{});db['FaxQueueReport']['belongsTo'](db[_0xea3f('0x13')],{});db[_0xea3f('0x52')][_0xea3f('0x111')](db[_0xea3f('0x51')],{});db[_0xea3f('0x54')][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':'SmsAccountId'});db[_0xea3f('0x54')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x173')});db[_0xea3f('0x54')]['hasMany'](db[_0xea3f('0x58')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x173')});db[_0xea3f('0x54')][_0xea3f('0x104')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x156')});db[_0xea3f('0x54')]['hasMany'](db[_0xea3f('0x55')],{'as':_0xea3f('0x136')});db['SmsAccount'][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x54')][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xea3f('0x143')});db[_0xea3f('0x54')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x12f')});db[_0xea3f('0x55')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0xea3f('0x55')][_0xea3f('0x111')](db[_0xea3f('0x5a')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x55')]['belongsTo'](db[_0xea3f('0x54')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x55')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x141')});db['SmsApplication']['belongsTo'](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':'TagId'});db[_0xea3f('0x10d')][_0xea3f('0x104')](db[_0xea3f('0x58')],{'as':_0xea3f('0x147'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction']['belongsTo'](db[_0xea3f('0x54')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x173')});db[_0xea3f('0x10d')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x10d')]['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x10d')]['belongsToMany'](db['Tag'],{'through':_0xea3f('0x174'),'as':_0xea3f('0x161')});db[_0xea3f('0x10d')][_0xea3f('0x113')](db['Tag'],{'through':_0xea3f('0x174'),'as':_0xea3f('0x162')});db[_0xea3f('0x10d')]['belongsToMany'](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x175'),'foreignKey':'SmsInteractionId'});db[_0xea3f('0x58')][_0xea3f('0x111')](db['User'],{'as':_0xea3f('0x13')});db[_0xea3f('0x58')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x14d')});db[_0xea3f('0x58')]['belongsTo'](db[_0xea3f('0x10d')],{'onDelete':_0xea3f('0x103'),'as':'Interaction','foreignKey':_0xea3f('0x176')});db[_0xea3f('0x58')][_0xea3f('0x111')](db['SmsAccount'],{'as':_0xea3f('0x15d'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x125'),'foreignKey':_0xea3f('0x177')});db[_0xea3f('0x5a')]['belongsToMany'](db[_0xea3f('0xe0')],{'through':_0xea3f('0x178'),'as':_0xea3f('0x145')});db[_0xea3f('0x5c')]['hasMany'](db[_0xea3f('0x80')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db[_0xea3f('0x5c')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x179')});db['OpenchannelAccount']['hasMany'](db[_0xea3f('0x10b')],{'as':_0xea3f('0x156'),'foreignKey':_0xea3f('0x179')});db[_0xea3f('0x5c')][_0xea3f('0x104')](db[_0xea3f('0x17a')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x179')});db['OpenchannelAccount'][_0xea3f('0x104')](db[_0xea3f('0x5e')],{'as':_0xea3f('0x136'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':_0xea3f('0x143')});db[_0xea3f('0x5c')]['belongsToMany'](db['User'],{'as':_0xea3f('0x16d'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x5e')][_0xea3f('0x111')](db[_0xea3f('0x61')],{'onDelete':'restrict','foreignKey':_0xea3f('0x17b')});db[_0xea3f('0x5e')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'onDelete':'restrict','foreignKey':_0xea3f('0x179')});db[_0xea3f('0x5e')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0xea3f('0x111')](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db[_0xea3f('0x10b')][_0xea3f('0x104')](db[_0xea3f('0x17a')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x17c')});db[_0xea3f('0x10b')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x179')});db[_0xea3f('0x10b')][_0xea3f('0x111')](db['CmContact'],{'as':'Contact','foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x10b')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x10b')][_0xea3f('0x113')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xea3f('0x161')});db[_0xea3f('0x10b')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x17d'),'as':_0xea3f('0x162')});db[_0xea3f('0x10b')]['belongsToMany'](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x17e'),'foreignKey':_0xea3f('0x17c')});db['OpenchannelMessage'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x13')});db[_0xea3f('0x17a')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'onDelete':'cascade','as':'Contact'});db[_0xea3f('0x17a')][_0xea3f('0x111')](db[_0xea3f('0x10b')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x17c')});db['OpenchannelMessage'][_0xea3f('0x111')](db[_0xea3f('0x164')],{'as':_0xea3f('0x164'),'foreignKey':_0xea3f('0x172')});db[_0xea3f('0x17a')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'as':_0xea3f('0x15d'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':'UserOpenchannelQueue','foreignKey':_0xea3f('0x17b')});db[_0xea3f('0x61')]['belongsToMany'](db[_0xea3f('0xe0')],{'through':_0xea3f('0x17f'),'as':'Teams'});db[_0xea3f('0x62')]['hasMany'](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':_0xea3f('0x180')});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x180')});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x70')],{'as':_0xea3f('0x181')});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x68')],{'as':'Interactions'});db[_0xea3f('0x62')][_0xea3f('0x104')](db['ChatApplication'],{'as':'Applications'});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x69')],{'as':_0xea3f('0x147')});db[_0xea3f('0x62')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':'ListId'});db[_0xea3f('0x62')][_0xea3f('0x111')](db['Interval'],{'as':'Interval','foreignKey':_0xea3f('0x141')});db['ChatWebsite'][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xea3f('0x113')](db['User'],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x12a')});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':'Contact','foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x64')]['belongsTo'](db[_0xea3f('0x10b')],{});db['OpenchannelQueueReport'][_0xea3f('0x111')](db[_0xea3f('0x17a')],{});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x61')],{});db['ChatApplication'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x182'),'foreignKey':'UserId','onDelete':_0xea3f('0x167')});db[_0xea3f('0x66')][_0xea3f('0x111')](db['ChatQueue'],{'as':_0xea3f('0x183'),'foreignKey':_0xea3f('0x184'),'onDelete':'restrict'});db[_0xea3f('0x66')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x185'),'foreignKey':_0xea3f('0x180'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db['ChatInteraction'][_0xea3f('0x104')](db[_0xea3f('0x69')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x186')});db[_0xea3f('0x68')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x180')});db[_0xea3f('0x68')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':'ContactId'});db[_0xea3f('0x68')][_0xea3f('0x111')](db['User'],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db['ChatInteraction'][_0xea3f('0x113')](db['Tag'],{'through':_0xea3f('0x187'),'as':_0xea3f('0x161')});db['ChatInteraction'][_0xea3f('0x113')](db['Tag'],{'through':_0xea3f('0x187'),'as':_0xea3f('0x162')});db[_0xea3f('0x68')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':'user_has_chat_interactions','foreignKey':_0xea3f('0x186')});db[_0xea3f('0x69')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x13')});db[_0xea3f('0x69')]['belongsTo'](db['CmContact'],{'onDelete':_0xea3f('0x103'),'as':'Contact','foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x69')][_0xea3f('0x111')](db['ChatInteraction'],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x186')});db[_0xea3f('0x69')][_0xea3f('0x111')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xea3f('0x69')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':'Account','foreignKey':_0xea3f('0x180')});db[_0xea3f('0x188')][_0xea3f('0x111')](db['CmContact'],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x14d'),'foreignKey':'ContactId'});db[_0xea3f('0x188')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x180')});db['ChatQueue'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x32'),'hooks':!![]});db['ChatQueue'][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':_0xea3f('0x189'),'as':'Teams'});db[_0xea3f('0x6e')]['hasMany'](db[_0xea3f('0xce')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x18a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x6e')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x139'),'through':_0xea3f('0x115')});db['ChatProactiveAction'][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x185'),'foreignKey':_0xea3f('0x180')});db['CmCompany'][_0xea3f('0x104')](db[_0xea3f('0x116')],{'as':_0xea3f('0x117'),'foreignKey':_0xea3f('0x18b')});db['CmContact'][_0xea3f('0x104')](db[_0xea3f('0x13b')],{'as':_0xea3f('0x13c'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x77')],{'as':_0xea3f('0x13d'),'foreignKey':'ContactId'});db[_0xea3f('0x116')][_0xea3f('0x104')](db['ReportAgentPreview'],{'as':_0xea3f('0x79'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db['JscriptySessionReport'],{'as':_0xea3f('0x18c'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x10b')],{'as':'OpenchannelInteractions','foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x68')],{'as':'ChatInteractions','foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x10e'),'foreignKey':'ContactId','onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x10f')],{'as':_0xea3f('0x11d'),'foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')]['hasMany'](db[_0xea3f('0x41')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xea3f('0x167')});db['CmContact'][_0xea3f('0x111')](db[_0xea3f('0x72')],{'as':_0xea3f('0x18d'),'foreignKey':'CompanyId'});db[_0xea3f('0x116')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158'),'onDelete':_0xea3f('0x103')});db['CmContact'][_0xea3f('0x113')](db['User'],{'as':_0xea3f('0x163'),'through':_0xea3f('0x118')});db[_0xea3f('0x116')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'as':_0xea3f('0x161'),'through':_0xea3f('0x18e')});db[_0xea3f('0x116')]['belongsToMany'](db[_0xea3f('0x15f')],{'through':_0xea3f('0x18e'),'as':_0xea3f('0x162')});db[_0xea3f('0x13b')][_0xea3f('0x111')](db['CmContact'],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x103')});db['CmHopper'][_0xea3f('0x111')](db['CmList'],{'as':_0xea3f('0x157'),'foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0xea3f('0x111')](db['User'],{'as':'Agent','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13b')]['belongsTo'](db[_0xea3f('0x1e')],{'as':'Queue','foreignKey':_0xea3f('0x13a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x13b')]['belongsTo'](db[_0xea3f('0xe3')],{'as':'Campaign','foreignKey':_0xea3f('0x18f'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x13b')]['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x190')});db[_0xea3f('0x74')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0xea3f('0x111')](db['CmList'],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158'),'onDelete':_0xea3f('0x103')});db['CmHopperBlack'][_0xea3f('0x111')](db[_0xea3f('0x1e')],{'as':'Queue','foreignKey':_0xea3f('0x13a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x74')]['belongsTo'](db[_0xea3f('0xe3')],{'as':_0xea3f('0xe3'),'foreignKey':_0xea3f('0x18f'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x7d')][_0xea3f('0x104')](db[_0xea3f('0x82')],{'as':{'plural':_0xea3f('0x191'),'singular':_0xea3f('0x192')},'foreignKey':_0xea3f('0x193'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x7d')][_0xea3f('0x104')](db[_0xea3f('0x82')],{'as':{'plural':_0xea3f('0x194'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x7d')][_0xea3f('0x104')](db[_0xea3f('0x7b')],{'as':'Actions','foreignKey':_0xea3f('0x195'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x80')][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':_0xea3f('0x196'),'onDelete':'cascade'});db[_0xea3f('0x84')]['hasMany'](db[_0xea3f('0x84')],{'as':_0xea3f('0x197'),'foreignKey':'IntervalId','onDelete':_0xea3f('0x103'),'hooks':!![],'required':![]});db[_0xea3f('0x84')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x108'),'foreignKey':_0xea3f('0x141'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x84')]['hasMany'](db[_0xea3f('0x45')],{'as':_0xea3f('0x198'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x84')][_0xea3f('0x104')](db['ChatApplication'],{'as':_0xea3f('0x199'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x84')]['hasMany'](db['FaxApplication'],{'as':_0xea3f('0x19a'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x84')][_0xea3f('0x104')](db['SmsApplication'],{'as':_0xea3f('0x19b'),'foreignKey':_0xea3f('0x141')});db['Schedule']['belongsTo'](db[_0xea3f('0x3d')],{});db[_0xea3f('0x8a')]['belongsTo'](db[_0xea3f('0x19c')],{'foreignKey':_0xea3f('0x19d')});db[_0xea3f('0x8a')]['belongsTo'](db[_0xea3f('0x94')],{'foreignKey':'CustomReportId'});db[_0xea3f('0x8c')][_0xea3f('0x113')](db[_0xea3f('0x1c')],{'as':_0xea3f('0x19e'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0xea3f('0x15f')][_0xea3f('0x113')](db[_0xea3f('0x116')],{'through':'cm_contact_has_tags'});db[_0xea3f('0x15f')][_0xea3f('0x113')](db[_0xea3f('0x68')],{'through':_0xea3f('0x187')});db[_0xea3f('0x15f')][_0xea3f('0x113')](db[_0xea3f('0x41')],{'through':_0xea3f('0x160')});db['Tag'][_0xea3f('0x113')](db['SmsInteraction'],{'through':_0xea3f('0x174')});db[_0xea3f('0x15f')]['belongsToMany'](db[_0xea3f('0x10f')],{'through':_0xea3f('0x171')});db[_0xea3f('0x15f')][_0xea3f('0x113')](db['OpenchannelInteraction'],{'through':_0xea3f('0x17d')});db['Tag']['belongsToMany'](db[_0xea3f('0xfa')],{'through':_0xea3f('0x19f')});db['Trigger'][_0xea3f('0x104')](db['Condition'],{'as':{'plural':_0xea3f('0x1a0'),'singular':_0xea3f('0x1a1')},'foreignKey':_0xea3f('0x1a2'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x8f')][_0xea3f('0x104')](db[_0xea3f('0x82')],{'as':{'plural':_0xea3f('0x1a3'),'singular':_0xea3f('0x1a4')},'foreignKey':_0xea3f('0x1a5'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x8f')][_0xea3f('0x104')](db['Action'],{'as':_0xea3f('0x1a6'),'foreignKey':_0xea3f('0x1a7'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xea3f('0x9b')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1a9'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0xea3f('0x9b')],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x19d')});db[_0xea3f('0x99')][_0xea3f('0x104')](db[_0xea3f('0x9b')],{'as':_0xea3f('0x1a8'),'onDelete':'cascade','foreignKey':_0xea3f('0x1aa')});db[_0xea3f('0x9b')][_0xea3f('0x111')](db['AnalyticMetric'],{'foreignKey':_0xea3f('0x1aa')});db[_0xea3f('0x9e')][_0xea3f('0x104')](db[_0xea3f('0xa0')],{'as':'Configurations','onDelete':_0xea3f('0x103'),'foreignKey':'AccountId'});db[_0xea3f('0xa0')][_0xea3f('0x104')](db['SalesforceField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xa0')][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1ac'),'onDelete':'cascade','foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xa0')][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa0')][_0xea3f('0x111')](db['SalesforceAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xa2')][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db['SalesforceField'][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xa2')]['hasMany'](db['SalesforceField'],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa2')]['belongsTo'](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xa4')][_0xea3f('0x104')](db[_0xea3f('0xa6')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xa6')][_0xea3f('0x104')](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b6'),'onDelete':_0xea3f('0x103'),'foreignKey':'SubjectId'});db[_0xea3f('0xa6')]['hasMany'](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1ac'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xa6')]['hasMany'](db[_0xea3f('0xa8')],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa6')]['belongsTo'](db[_0xea3f('0xa4')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xa8')]['hasMany'](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xa8')][_0xea3f('0x104')](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b1'),'foreignKey':'DescriptionId'});db[_0xea3f('0xa8')][_0xea3f('0x104')](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa8')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xaa')]['hasMany'](db[_0xea3f('0xac')],{'as':'Configurations','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xac')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':_0xea3f('0x1b6'),'onDelete':'cascade','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xac')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':_0xea3f('0x1ac'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xac')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db['DeskConfiguration'][_0xea3f('0x111')](db[_0xea3f('0xaa')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xac')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x1b7')});db[_0xea3f('0xae')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':'Subject','foreignKey':_0xea3f('0x1ab')});db['DeskField'][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db['DeskField'][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':'Field','foreignKey':_0xea3f('0x1ae')});db['DeskField'][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xaf')][_0xea3f('0x104')](db['ZohoConfiguration'],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xb1')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ab')});db['ZohoConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xb2')],{'as':'Descriptions','onDelete':_0xea3f('0x103'),'foreignKey':'DescriptionId'});db[_0xea3f('0xb1')][_0xea3f('0x104')](db['ZohoField'],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db['ZohoConfiguration']['belongsTo'](db[_0xea3f('0xaf')],{'as':_0xea3f('0x15d'),'foreignKey':'AccountId'});db[_0xea3f('0xb2')][_0xea3f('0x104')](db[_0xea3f('0xb2')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xb2')]['hasMany'](db[_0xea3f('0xb2')],{'as':'Description','foreignKey':_0xea3f('0x1ad')});db['ZohoField'][_0xea3f('0x104')](db['ZohoField'],{'as':_0xea3f('0x1b2'),'foreignKey':'FieldId'});db[_0xea3f('0xb2')]['belongsTo'](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0x1b8')][_0xea3f('0x104')](db[_0xea3f('0xb4')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b6'),'foreignKey':'SubjectId'});db[_0xea3f('0xb4')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1ac'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xb4')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':'Fields','foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xb4')][_0xea3f('0x111')](db[_0xea3f('0x1b8')],{'as':'Account','foreignKey':_0xea3f('0x1af')});db['ZendeskConfiguration']['belongsToMany'](db[_0xea3f('0x15f')],{'through':_0xea3f('0x1b9')});db[_0xea3f('0xb6')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b0'),'foreignKey':'SubjectId'});db[_0xea3f('0xb6')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b1'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xb6')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':'VariableId'});db['FreshdeskAccount']['hasMany'](db['FreshdeskConfiguration'],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xb8')]['hasMany'](db[_0xea3f('0xba')],{'as':'Subjects','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xb8')]['hasMany'](db[_0xea3f('0xba')],{'as':'Descriptions','onDelete':_0xea3f('0x103'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db[_0xea3f('0xba')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':'FieldId'});db[_0xea3f('0xb8')][_0xea3f('0x111')](db['FreshdeskAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db['FreshdeskConfiguration'][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xea3f('0xba')][_0xea3f('0x104')](db[_0xea3f('0xba')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xba')][_0xea3f('0x104')](db[_0xea3f('0xba')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xba')]['hasMany'](db[_0xea3f('0xba')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xba')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0x1ba')][_0xea3f('0x104')](db['VtigerConfiguration'],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db['VtigerConfiguration'][_0xea3f('0x104')](db['VtigerField'],{'as':_0xea3f('0x1b6'),'foreignKey':'SubjectId'});db[_0xea3f('0x1bb')][_0xea3f('0x104')](db[_0xea3f('0xbe')],{'as':_0xea3f('0x1ac'),'foreignKey':_0xea3f('0x1ad')});db['VtigerConfiguration']['hasMany'](db[_0xea3f('0xbe')],{'as':'Fields','foreignKey':_0xea3f('0x1ae')});db['VtigerConfiguration'][_0xea3f('0x111')](db[_0xea3f('0x1ba')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xbe')][_0xea3f('0x104')](db[_0xea3f('0xbe')],{'as':_0xea3f('0x1b0'),'foreignKey':'SubjectId'});db[_0xea3f('0xbe')][_0xea3f('0x104')](db['VtigerField'],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db['VtigerField']['hasMany'](db[_0xea3f('0xbe')],{'as':_0xea3f('0x1b2'),'foreignKey':'FieldId'});db[_0xea3f('0xbe')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':'VariableId'});db[_0xea3f('0xbf')][_0xea3f('0x104')](db[_0xea3f('0x1bc')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0x1bc')]['hasMany'](db[_0xea3f('0xc1')],{'as':'Subjects','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0x1bc')]['hasMany'](db[_0xea3f('0xc1')],{'as':'Descriptions','foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0x1bc')][_0xea3f('0x104')](db[_0xea3f('0xc1')],{'as':'Fields','foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0x1bc')][_0xea3f('0x111')](db[_0xea3f('0xbf')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db['ServicenowField'][_0xea3f('0x104')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xc1')][_0xea3f('0x104')](db[_0xea3f('0xc1')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xc1')]['hasMany'](db[_0xea3f('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0xea3f('0xc1')]['belongsTo'](db['Variable'],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db['Dynamics365Account'][_0xea3f('0x104')](db[_0xea3f('0x1bd')],{'as':'Configurations','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0x1bd')][_0xea3f('0x104')](db[_0xea3f('0xc4')],{'as':_0xea3f('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0xea3f('0x1ac'),'onDelete':'cascade','foreignKey':_0xea3f('0x1ad')});db['Dynamics365Configuration'][_0xea3f('0x104')](db[_0xea3f('0xc4')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0x1bd')]['belongsTo'](db['Dynamics365Account'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xc4')]['hasMany'](db[_0xea3f('0xc4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xea3f('0xc4')][_0xea3f('0x104')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0xea3f('0x1ad')});db['Dynamics365Field']['hasMany'](db[_0xea3f('0xc4')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xc4')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xc6')][_0xea3f('0x104')](db[_0xea3f('0xc8')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xc8')]['hasMany'](db[_0xea3f('0xca')],{'as':'Subjects','foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xca')],{'as':_0xea3f('0x1ac'),'foreignKey':_0xea3f('0x1ad')});db['FreshsalesConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xca')],{'as':_0xea3f('0x1a8'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xc8')][_0xea3f('0x111')](db['FreshsalesAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db['FreshsalesField'][_0xea3f('0x104')](db[_0xea3f('0xca')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db['FreshsalesField'][_0xea3f('0x104')](db['FreshsalesField'],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xca')][_0xea3f('0x111')](db['Variable'],{'as':_0xea3f('0x1b3'),'foreignKey':'VariableId'});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x62')],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x1be')]['belongsTo'](db['ChatInteraction'],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x69')],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x6c')],{});db[_0xea3f('0xce')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'foreignKey':'FromId'});db[_0xea3f('0xce')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':'cascade','foreignKey':_0xea3f('0x1bf')});db[_0xea3f('0xd3')][_0xea3f('0x104')](db[_0xea3f('0xd1')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xea3f('0xd3')][_0xea3f('0x104')](db[_0xea3f('0xcf')],{'foreignKey':'SessionId','onDelete':_0xea3f('0x103')});db['SmsQueueReport'][_0xea3f('0x111')](db[_0xea3f('0x54')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':'List','foreignKey':_0xea3f('0x158')});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x1c0')]['belongsTo'](db[_0xea3f('0x10d')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x58')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x5a')],{});db[_0xea3f('0xd8')][_0xea3f('0x104')](db[_0xea3f('0xd3')],{'foreignKey':_0xea3f('0x1c1')});db[_0xea3f('0xd8')][_0xea3f('0x104')](db[_0xea3f('0xd1')],{'foreignKey':_0xea3f('0x1c1')});db[_0xea3f('0xd8')][_0xea3f('0x104')](db[_0xea3f('0xcf')],{'foreignKey':_0xea3f('0x1c1')});db[_0xea3f('0x132')]['belongsToMany'](db[_0xea3f('0x13')],{'as':'Users','through':_0xea3f('0x1c2')});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x1c3')});db['Team'][_0xea3f('0x113')](db[_0xea3f('0x1e')],{'through':_0xea3f('0x1c4'),'as':_0xea3f('0x121')});db[_0xea3f('0xe0')]['belongsToMany'](db[_0xea3f('0x3f')],{'through':_0xea3f('0x15b'),'as':_0xea3f('0x1c5')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0xea3f('0x189'),'as':_0xea3f('0x122')});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x51')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x5a')],{'through':_0xea3f('0x178'),'as':_0xea3f('0x124')});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x61')],{'through':'team_has_openchannel_queues','as':_0xea3f('0x1c6')});db['Team'][_0xea3f('0x113')](db['WhatsappQueue'],{'through':_0xea3f('0x1c7'),'as':_0xea3f('0x126')});db['Campaign'][_0xea3f('0x104')](db[_0xea3f('0x13b')],{'as':'Hoppers','foreignKey':_0xea3f('0x18f')});db[_0xea3f('0xe3')]['hasMany'](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':_0xea3f('0x18f')});db[_0xea3f('0xe3')][_0xea3f('0x104')](db[_0xea3f('0x77')],{'as':_0xea3f('0x13d'),'foreignKey':'CampaignId'});db[_0xea3f('0xe3')][_0xea3f('0x104')](db[_0xea3f('0x74')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0xea3f('0x1c8')});db[_0xea3f('0xe3')][_0xea3f('0x111')](db['Trunk'],{'as':_0xea3f('0x13f'),'foreignKey':_0xea3f('0x140')});db[_0xea3f('0xe3')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'as':_0xea3f('0x84'),'foreignKey':'IntervalId'});db['Campaign'][_0xea3f('0x111')](db[_0xea3f('0x132')],{'as':_0xea3f('0x132'),'foreignKey':_0xea3f('0x1c9')});db[_0xea3f('0xe3')][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x119'),'through':_0xea3f('0x1ca')});db[_0xea3f('0xe3')][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x1cb'),'through':_0xea3f('0x1cc')});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x43')],{});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x41')],{});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'foreignKey':'FromMailAccountId','as':_0xea3f('0x1cd')});db[_0xea3f('0xe7')]['belongsTo'](db['User'],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db[_0xea3f('0xe7')][_0xea3f('0x111')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x3f')],{'foreignKey':_0xea3f('0x1d0'),'as':_0xea3f('0x1d1')});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'foreignKey':'ToMailAccountId','as':_0xea3f('0x1d2')});db['ChatTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x69')],{});db['ChatTransferReport'][_0xea3f('0x111')](db['ChatInteraction'],{});db['ChatTransferReport']['belongsTo'](db[_0xea3f('0x62')],{'foreignKey':_0xea3f('0x1d3'),'as':_0xea3f('0x1cd')});db[_0xea3f('0xe9')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db['ChatTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':'ToUserId','as':_0xea3f('0x1d4')});db[_0xea3f('0xe9')][_0xea3f('0x111')](db[_0xea3f('0x6c')],{'foreignKey':_0xea3f('0x1d5'),'as':'ToQueue'});db[_0xea3f('0xe9')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'foreignKey':_0xea3f('0x1d6'),'as':'ToAccount'});db[_0xea3f('0xea')]['belongsTo'](db[_0xea3f('0x50')],{});db[_0xea3f('0xea')][_0xea3f('0x111')](db[_0xea3f('0x10f')],{});db[_0xea3f('0xea')][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'foreignKey':_0xea3f('0x1d7'),'as':'FromAccount'});db[_0xea3f('0xea')][_0xea3f('0x111')](db['User'],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db['FaxTransferReport'][_0xea3f('0x111')](db['User'],{'foreignKey':_0xea3f('0x1d8'),'as':_0xea3f('0x1d4')});db[_0xea3f('0xea')]['belongsTo'](db[_0xea3f('0x51')],{'foreignKey':'ToFaxQueueId','as':_0xea3f('0x1d1')});db[_0xea3f('0xea')]['belongsTo'](db[_0xea3f('0x4b')],{'foreignKey':'ToFaxAccountId','as':_0xea3f('0x1d2')});db['OpenchannelTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x17a')],{});db[_0xea3f('0xec')][_0xea3f('0x111')](db[_0xea3f('0x10b')],{});db[_0xea3f('0xec')]['belongsTo'](db[_0xea3f('0x5c')],{'foreignKey':'FromOpenchannelAccountId','as':_0xea3f('0x1cd')});db[_0xea3f('0xec')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db['OpenchannelTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':'ToUserId','as':_0xea3f('0x1d4')});db['OpenchannelTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x61')],{'foreignKey':_0xea3f('0x1d9'),'as':_0xea3f('0x1d1')});db[_0xea3f('0xec')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'foreignKey':_0xea3f('0x1da'),'as':_0xea3f('0x1d2')});db[_0xea3f('0xee')]['belongsTo'](db[_0xea3f('0x58')],{});db['SmsTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x10d')],{});db['SmsTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x54')],{'foreignKey':_0xea3f('0x1db'),'as':_0xea3f('0x1cd')});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1ce'),'as':'FromAgent'});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':'ToUserId','as':_0xea3f('0x1d4')});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x5a')],{'foreignKey':'ToSmsQueueId','as':_0xea3f('0x1d1')});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':'ListId'});db[_0xea3f('0xf0')][_0xea3f('0x104')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0xea3f('0x158')});db['CmList'][_0xea3f('0x104')](db['CmContact'],{'as':_0xea3f('0x117'),'onDelete':_0xea3f('0x103'),'foreignKey':'ListId'});db[_0xea3f('0xf0')]['hasMany'](db['CmHopperFinal'],{'as':_0xea3f('0x109'),'foreignKey':'ListId'});db[_0xea3f('0xf0')][_0xea3f('0x104')](db[_0xea3f('0x77')],{'as':_0xea3f('0x10a'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0xf0')][_0xea3f('0x104')](db[_0xea3f('0x79')],{'as':_0xea3f('0x79'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0xf0')][_0xea3f('0x113')](db[_0xea3f('0x1e')],{'as':'Queues','through':_0xea3f('0x144')});db['CmList'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':_0xea3f('0x11a')});db[_0xea3f('0x127')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':'Extensions','onDelete':'cascade'});db[_0xea3f('0x127')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':'user_has_voice_prefixes'});db['UserProfile'][_0xea3f('0x104')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'foreignKey':_0xea3f('0x112')});db['UserProfile'][_0xea3f('0x104')](db[_0xea3f('0xf2')],{'as':'UserProfileSections','foreignKey':_0xea3f('0x112'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0xf2')][_0xea3f('0x104')](db[_0xea3f('0xf3')],{'as':'Resources','foreignKey':_0xea3f('0x1dc'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0xf7')]['hasMany'](db[_0xea3f('0x80')],{'as':'Dispositions','foreignKey':_0xea3f('0x1dd')});db[_0xea3f('0xf7')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xea3f('0x104')](db[_0xea3f('0xfc')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x1dd')});db[_0xea3f('0xf7')][_0xea3f('0x104')](db[_0xea3f('0xfa')],{'as':_0xea3f('0x156')});db[_0xea3f('0xf7')]['hasMany'](db['WhatsappApplication'],{'as':_0xea3f('0x136')});db[_0xea3f('0xf7')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':'List','foreignKey':_0xea3f('0x158')});db[_0xea3f('0xf7')][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xea3f('0xf7')]['belongsToMany'](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':'user_has_whatsapp_accounts'});db[_0xea3f('0xf8')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0xf8')][_0xea3f('0x111')](db[_0xea3f('0x100')],{'onDelete':'restrict'});db[_0xea3f('0xf8')][_0xea3f('0x111')](db[_0xea3f('0xf7')],{'onDelete':_0xea3f('0x167')});db['WhatsappApplication']['belongsTo'](db[_0xea3f('0x84')],{'onDelete':_0xea3f('0x167'),'foreignKey':'IntervalId'});db[_0xea3f('0xf8')]['belongsTo'](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db[_0xea3f('0xfa')][_0xea3f('0x104')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xea3f('0x1de')});db[_0xea3f('0xfa')]['belongsTo'](db['WhatsappAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1dd')});db['WhatsappInteraction']['belongsTo'](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0xfa')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x19f'),'as':'Tags'});db[_0xea3f('0xfa')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x19f'),'as':_0xea3f('0x162')});db[_0xea3f('0xfa')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x120'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xea3f('0x111')](db['User'],{'as':_0xea3f('0x13')});db[_0xea3f('0xfc')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'onDelete':'cascade','as':'Contact'});db[_0xea3f('0xfc')][_0xea3f('0x111')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x1de')});db[_0xea3f('0xfc')][_0xea3f('0x111')](db[_0xea3f('0xf7')],{'as':_0xea3f('0x15d'),'foreignKey':'WhatsappAccountId'});db[_0xea3f('0xfe')][_0xea3f('0x111')](db['WhatsappAccount'],{});db[_0xea3f('0xfe')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db['WhatsappQueueReport']['belongsTo'](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db['WhatsappQueueReport'][_0xea3f('0x111')](db[_0xea3f('0xfa')],{});db[_0xea3f('0xfe')]['belongsTo'](db['WhatsappQueue'],{});db[_0xea3f('0xfe')][_0xea3f('0x111')](db[_0xea3f('0xfc')],{});db['WhatsappQueueReport'][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0xfc')],{});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0xfa')],{});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0xf7')],{'foreignKey':_0xea3f('0x1e0'),'as':_0xea3f('0x1cd')});db['WhatsappTransferReport']['belongsTo'](db[_0xea3f('0xf7')],{'foreignKey':_0xea3f('0x1e1'),'as':_0xea3f('0x1d2')});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0x100')],{'foreignKey':'ToQueueId','as':_0xea3f('0x1d1')});db['WhatsappTransferReport'][_0xea3f('0x111')](db['User'],{'foreignKey':_0xea3f('0x1ce'),'as':'FromAgent'});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1d8'),'as':'ToAgent'});db[_0xea3f('0x100')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x39'),'foreignKey':_0xea3f('0x1e2')});db[_0xea3f('0x100')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':'team_has_whatsapp_queues','as':_0xea3f('0x145')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x5d4f=['Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','Members','Company','CompanyId','cm_contact_has_tags','CampaignId','Queue','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','Fields','MetricId','AccountId','Subjects','SubjectId','Subject','Description','DescriptionId','Field','FieldId','VariableId','Configurations','SugarcrmField','Descriptions','DeskAccount','ZohoConfiguration','ZohoField','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesConfiguration','FreshsalesField','ToId','SessionId','ProjectId','team_has_mail_queues','SmsQueues','team_has_whatsapp_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','Queues','voice_queues_has_cm_lists','UserProfileResource','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappMessage','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','defaultsDeep','xcall','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','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','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','Variable','Integration','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../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','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','CmList','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueue','MailQueues','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','cm_user_has_lists','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','VoiceContext','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','team_has_voice_queues','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Imap','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','Agents','Teams','Account','Owner','Tags','mail_interaction_has_tags','Users','MailInteractionId','Attachments','Interaction','restrict','IntervalId','TagId','Items','FaxAccountId'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x5d4f,0x79));var _0xf5d4=function(_0x1eeb6f,_0x553f91){_0x1eeb6f=_0x1eeb6f-0x0;var _0x22f991=_0x5d4f[_0x1eeb6f];return _0x22f991;};'use strict';var path=require('path');var config=require(_0xf5d4('0x0'));var Sequelize=require(_0xf5d4('0x1'));var _=require(_0xf5d4('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xf5d4('0x1')]=_[_0xf5d4('0x3')](config[_0xf5d4('0x1')],{'database':'motion2','username':_0xf5d4('0x4'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xf5d4('0x5')](),'define':{'charset':_0xf5d4('0x6'),'collate':_0xf5d4('0x7')}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0xf5d4('0x8')],{'database':_0xf5d4('0x9'),'username':'xcall','password':_0xf5d4('0xa'),'options':{'host':_0xf5d4('0xb'),'port':0xcea,'dialect':_0xf5d4('0xc'),'dialectOptions':{'charset':_0xf5d4('0xd')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xf5d4('0x6'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xf5d4('0xe')],config['sequelize'][_0xf5d4('0xf')],config['sequelize'][_0xf5d4('0x10')],config[_0xf5d4('0x1')][_0xf5d4('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf5d4('0x8')][_0xf5d4('0xe')],config['sequelizeHistory'][_0xf5d4('0xf')],config['sequelizeHistory'][_0xf5d4('0x10')],config['sequelizeHistory'][_0xf5d4('0x11')])};db[_0xf5d4('0x12')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x14'));db[_0xf5d4('0x15')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x16'));db['VoiceContext']=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/voiceContext/voiceContext.model');db[_0xf5d4('0x17')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0xf5d4('0x18')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x19'));db['VoiceQueue']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x1a'));db[_0xf5d4('0x1b')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x1c'));db[_0xf5d4('0x1d')]=db['sequelize']['import'](_0xf5d4('0x1e'));db[_0xf5d4('0x1f')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x20'));db[_0xf5d4('0x21')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x22'));db[_0xf5d4('0x23')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x24'));db[_0xf5d4('0x25')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x26'));db['VoiceAgentReport']=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x27'));db[_0xf5d4('0x28')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x29'));db['MemberReport']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x2a'));db['Trunk']=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x2b'));db['VoiceTransferReport']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x2c'));db[_0xf5d4('0x2d')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x2e'));db[_0xf5d4('0x2f')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x30'));db[_0xf5d4('0x31')]=db['sequelize']['import'](_0xf5d4('0x32'));db[_0xf5d4('0x33')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x34'));db[_0xf5d4('0x35')]=db['sequelize'][_0xf5d4('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0xf5d4('0x36')]=db[_0xf5d4('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xf5d4('0x37')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x38'));db['UserWhatsappQueue']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x39'));db[_0xf5d4('0x3a')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x3b'));db[_0xf5d4('0x3c')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x3d'));db[_0xf5d4('0x3e')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db['sequelize'][_0xf5d4('0x13')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x3f'));db[_0xf5d4('0x40')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x41'));db[_0xf5d4('0x42')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x43'));db[_0xf5d4('0x44')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/mailApplication/mailApplication.model');db[_0xf5d4('0x45')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x46'));db[_0xf5d4('0x47')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x48'));db[_0xf5d4('0x49')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x4a'));db[_0xf5d4('0x4b')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/faxAccount/faxAccount.model');db[_0xf5d4('0x4c')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x4d'));db[_0xf5d4('0x4e')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x4f'));db['FaxMessage']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x50'));db[_0xf5d4('0x51')]=db['sequelize'][_0xf5d4('0x13')]('../api/faxQueue/faxQueue.model');db[_0xf5d4('0x52')]=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db[_0xf5d4('0x53')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/smsAccount/smsAccount.model');db[_0xf5d4('0x54')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x55'));db[_0xf5d4('0x56')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x57'));db[_0xf5d4('0x58')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x59'));db[_0xf5d4('0x5a')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x5b'));db[_0xf5d4('0x5c')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x5d'));db['OpenchannelApplication']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x5e'));db[_0xf5d4('0x5f')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x60'));db[_0xf5d4('0x61')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x62'));db[_0xf5d4('0x63')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x64'));db['ChatWebsite']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x65'));db[_0xf5d4('0x66')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x67'));db[_0xf5d4('0x68')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x69'));db[_0xf5d4('0x6a')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x6b'));db[_0xf5d4('0x6c')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x6d'));db['ChatOfflineMessage']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x6e'));db[_0xf5d4('0x6f')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x70'));db[_0xf5d4('0x71')]=db['sequelize']['import'](_0xf5d4('0x72'));db[_0xf5d4('0x73')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x74'));db[_0xf5d4('0x75')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x76'));db[_0xf5d4('0x77')]=db['sequelize'][_0xf5d4('0x13')]('../api/cmContact/cmContact.model');db[_0xf5d4('0x78')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x79'));db[_0xf5d4('0x7a')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x7b'));db['CmHopperFinal']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x7c'));db['CmHopperHistory']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x7d'));db[_0xf5d4('0x7e')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x7f'));db[_0xf5d4('0x80')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x81'));db[_0xf5d4('0x82')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x83'));db[_0xf5d4('0x84')]=db['sequelize']['import']('../api/automation/automation.model');db[_0xf5d4('0x85')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x86'));db[_0xf5d4('0x87')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x88'));db[_0xf5d4('0x89')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x8a'));db[_0xf5d4('0x8b')]=db['sequelize']['import'](_0xf5d4('0x8c'));db[_0xf5d4('0x8d')]=db[_0xf5d4('0x1')]['import']('../api/pause/pause.model');db[_0xf5d4('0x8e')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x8f'));db[_0xf5d4('0x90')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x91'));db['Schedule']=db['sequelize'][_0xf5d4('0x13')]('../api/schedule/schedule.model');db[_0xf5d4('0x92')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x93'));db[_0xf5d4('0x94')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x95'));db['Template']=db['sequelize']['import'](_0xf5d4('0x96'));db[_0xf5d4('0x97')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/trigger/trigger.model');db[_0xf5d4('0x98')]=db['sequelize'][_0xf5d4('0x13')]('../api/variable/variable.model');db[_0xf5d4('0x99')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/integration/integration.model');db['IntegrationReport']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x9a'));db['AnalyticCustomReport']=db[_0xf5d4('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0xf5d4('0x9b')]=db['sequelize']['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xf5d4('0x9c')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x9d'));db[_0xf5d4('0x9e')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xf5d4('0x9f')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xa0'));db['AnalyticTreeReport']=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xa1'));db[_0xf5d4('0xa2')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xf5d4('0xa3')]=db[_0xf5d4('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xf5d4('0xa4')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xa5'));db[_0xf5d4('0xa6')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xa7'));db[_0xf5d4('0xa8')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xa9'));db['SugarcrmField']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xaa'));db['DeskAccount']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xab'));db[_0xf5d4('0xac')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xad'));db[_0xf5d4('0xae')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xaf'));db[_0xf5d4('0xb0')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xb1'));db['ZohoConfiguration']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xb2'));db['ZohoField']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0xb3'));db[_0xf5d4('0xb4')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xb5'));db['ZendeskConfiguration']=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xb6'));db['ZendeskField']=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xf5d4('0xb7')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0xb8'));db[_0xf5d4('0xb9')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xba'));db[_0xf5d4('0xbb')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xbc'));db[_0xf5d4('0xbd')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0xbe'));db[_0xf5d4('0xbf')]=db['sequelize']['import'](_0xf5d4('0xc0'));db[_0xf5d4('0xc1')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xc2'));db[_0xf5d4('0xc3')]=db['sequelize'][_0xf5d4('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xf5d4('0xc4')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xf5d4('0xc5')]=db['sequelize'][_0xf5d4('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xf5d4('0xc6')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xc7'));db[_0xf5d4('0xc8')]=db[_0xf5d4('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xf5d4('0xc9')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0xca'));db[_0xf5d4('0xcb')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xcc'));db['FreshsalesConfiguration']=db[_0xf5d4('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0xcd'));db[_0xf5d4('0x99')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xce'));db[_0xf5d4('0xcf')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xd0'));db[_0xf5d4('0xd1')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xd2'));db[_0xf5d4('0xd3')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xf5d4('0xd4')]=db['sequelize'][_0xf5d4('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xf5d4('0xd5')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xd6'));db[_0xf5d4('0xd7')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xd8'));db[_0xf5d4('0xd9')]=db[_0xf5d4('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0xf5d4('0xda')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/squareReport/squareReport.model');db[_0xf5d4('0xdb')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xdc'));db[_0xf5d4('0xdd')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xde'));db[_0xf5d4('0xdf')]=db['sequelize']['import'](_0xf5d4('0xe0'));db[_0xf5d4('0xe1')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xe2'));db[_0xf5d4('0xe3')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0xe4'));db['SquareRecording']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xe5'));db[_0xf5d4('0xe6')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xe7'));db[_0xf5d4('0xe8')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xe9'));db[_0xf5d4('0xea')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xeb'));db[_0xf5d4('0xec')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xed'));db[_0xf5d4('0xee')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xef'));db[_0xf5d4('0xf0')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/attachment/attachment.model');db[_0xf5d4('0xf1')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xf2'));db[_0xf5d4('0xf3')]=db[_0xf5d4('0x1')]['import'](_0xf5d4('0xf4'));db['ChatTransferReport']=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0xf5d4('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xf5d4('0xf5')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0xf6'));db[_0xf5d4('0xf7')]=db['sequelize']['import'](_0xf5d4('0xf8'));db['CmList']=db[_0xf5d4('0x1')]['import']('../api/cmList/cmList.model');db[_0xf5d4('0xf9')]=db['sequelize']['import'](_0xf5d4('0xfa'));db[_0xf5d4('0xfb')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xfc'));db[_0xf5d4('0xfd')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0xfe'));db['UserProfileResource']=db[_0xf5d4('0x1')][_0xf5d4('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0xf5d4('0xff')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x100'));db['WhatsappAccount']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x101'));db[_0xf5d4('0x102')]=db['sequelize']['import'](_0xf5d4('0x103'));db[_0xf5d4('0x104')]=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x105'));db['WhatsappMessage']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x106'));db[_0xf5d4('0x107')]=db['sequelize'][_0xf5d4('0x13')](_0xf5d4('0x108'));db['WhatsappTransferReport']=db[_0xf5d4('0x1')][_0xf5d4('0x13')](_0xf5d4('0x109'));db['WhatsappQueue']=db[_0xf5d4('0x1')]['import'](_0xf5d4('0x10a'));db['CloudProvider']=db['sequelize']['import'](_0xf5d4('0x10b'));db[_0xf5d4('0x12')][_0xf5d4('0x10c')](db[_0xf5d4('0x1f')],{'as':'VoiceMail','onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db[_0xf5d4('0x1b')],{'as':'Recordings','foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db['UserVoiceQueueRt'],{'as':_0xf5d4('0x110'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db[_0xf5d4('0x17')],{'as':_0xf5d4('0x111'),'onDelete':_0xf5d4('0x10d'),'hooks':!![]});db[_0xf5d4('0x12')]['hasMany'](db[_0xf5d4('0x112')],{'as':_0xf5d4('0x113'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db['CmHopperHistory'],{'as':_0xf5d4('0x114'),'foreignKey':_0xf5d4('0x10e')});db['User'][_0xf5d4('0x10f')](db[_0xf5d4('0x7e')],{'as':_0xf5d4('0x7e'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')]['hasMany'](db[_0xf5d4('0x5f')],{'as':_0xf5d4('0x115'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')]['hasMany'](db[_0xf5d4('0x6a')],{'as':_0xf5d4('0x116'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db['SmsInteraction'],{'as':_0xf5d4('0x117'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db[_0xf5d4('0x4e')],{'as':_0xf5d4('0x118'),'foreignKey':_0xf5d4('0x10e')});db['User'][_0xf5d4('0x10f')](db[_0xf5d4('0x40')],{'as':_0xf5d4('0x119'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db[_0xf5d4('0x104')],{'as':_0xf5d4('0x11a'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x12')][_0xf5d4('0x10f')](db[_0xf5d4('0xff')],{'as':_0xf5d4('0x11b'),'foreignKey':_0xf5d4('0x11c')});db[_0xf5d4('0x12')][_0xf5d4('0x11d')](db[_0xf5d4('0xfb')],{'as':_0xf5d4('0xfb'),'foreignKey':_0xf5d4('0x11e')});db[_0xf5d4('0x12')]['belongsToMany'](db['ChatGroup'],{'as':_0xf5d4('0x11f'),'through':_0xf5d4('0x120')});db['User'][_0xf5d4('0x121')](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x122'),'through':_0xf5d4('0x123')});db[_0xf5d4('0x12')]['belongsToMany'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x125'),'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0xf5d4('0xe8')],{'through':_0xf5d4('0x126')});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db[_0xf5d4('0x40')],{'as':'MailInteractions','through':_0xf5d4('0x127')});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db[_0xf5d4('0x6a')],{'as':_0xf5d4('0x116'),'through':_0xf5d4('0x128')});db['User'][_0xf5d4('0x121')](db[_0xf5d4('0x4e')],{'as':_0xf5d4('0x118'),'through':_0xf5d4('0x129')});db['User'][_0xf5d4('0x121')](db['SmsInteraction'],{'as':_0xf5d4('0x117'),'through':_0xf5d4('0x12a')});db[_0xf5d4('0x12')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0xf5d4('0x115'),'through':'user_has_openchannel_interactions'});db['User']['belongsToMany'](db[_0xf5d4('0x104')],{'as':_0xf5d4('0x11a'),'through':_0xf5d4('0x12b')});db['User']['belongsToMany'](db[_0xf5d4('0x12c')],{'as':_0xf5d4('0x12d'),'through':'UserVoiceQueue','required':![]});db['User'][_0xf5d4('0x121')](db[_0xf5d4('0x12e')],{'as':_0xf5d4('0x12f'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0xf5d4('0x6f')],{'as':_0xf5d4('0x130'),'through':_0xf5d4('0x31'),'required':![],'hooks':!![]});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db['FaxQueue'],{'as':_0xf5d4('0x131'),'through':_0xf5d4('0x35'),'required':![]});db['User'][_0xf5d4('0x121')](db[_0xf5d4('0x5a')],{'as':'SmsQueues','through':_0xf5d4('0x36'),'required':![]});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db[_0xf5d4('0x63')],{'as':_0xf5d4('0x132'),'through':_0xf5d4('0x37'),'required':![]});db[_0xf5d4('0x12')]['belongsToMany'](db[_0xf5d4('0x133')],{'as':'WhatsappQueues','through':_0xf5d4('0x134'),'required':![]});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db[_0xf5d4('0x124')],{'through':_0xf5d4('0x135')});db['User']['belongsToMany'](db[_0xf5d4('0xf9')],{'as':'VoicePrefixes','through':_0xf5d4('0x136'),'required':![]});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db[_0xf5d4('0x137')],{'as':_0xf5d4('0x138'),'through':_0xf5d4('0x139')});db['User'][_0xf5d4('0x121')](db[_0xf5d4('0x4b')],{'as':_0xf5d4('0x13a'),'through':_0xf5d4('0x13b')});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db[_0xf5d4('0x3e')],{'as':_0xf5d4('0x13c'),'through':_0xf5d4('0x13d')});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db[_0xf5d4('0x5c')],{'as':_0xf5d4('0x13e'),'through':_0xf5d4('0x13f')});db[_0xf5d4('0x12')][_0xf5d4('0x121')](db['SmsAccount'],{'as':_0xf5d4('0x140'),'through':_0xf5d4('0x141')});db[_0xf5d4('0x12')]['belongsToMany'](db[_0xf5d4('0x142')],{'as':_0xf5d4('0x143'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db[_0xf5d4('0xe3')],{'as':_0xf5d4('0x144'),'through':_0xf5d4('0x145')});db[_0xf5d4('0x15')]['hasMany'](db[_0xf5d4('0x17')],{'as':_0xf5d4('0x146'),'onDelete':_0xf5d4('0x10d'),'foreignKey':'ChanSpyId'});db[_0xf5d4('0x147')][_0xf5d4('0x10f')](db[_0xf5d4('0x17')],{'onDelete':'cascade'});db[_0xf5d4('0x17')][_0xf5d4('0x10f')](db[_0xf5d4('0x17')],{'as':_0xf5d4('0x148'),'onDelete':'cascade'});db[_0xf5d4('0x18')][_0xf5d4('0x121')](db[_0xf5d4('0x92')],{'as':_0xf5d4('0x149'),'through':_0xf5d4('0x14a')});db[_0xf5d4('0x12c')]['hasMany'](db[_0xf5d4('0x2d')],{'as':'Members','foreignKey':_0xf5d4('0x14b')});db[_0xf5d4('0x12c')][_0xf5d4('0x10f')](db[_0xf5d4('0x78')],{'as':_0xf5d4('0x14c'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xf5d4('0x10f')](db[_0xf5d4('0x112')],{'as':_0xf5d4('0x113'),'foreignKey':'VoiceQueueId'});db[_0xf5d4('0x12c')][_0xf5d4('0x10f')](db[_0xf5d4('0x14d')],{'as':_0xf5d4('0x14e'),'foreignKey':_0xf5d4('0x14b')});db['VoiceQueue'][_0xf5d4('0x10f')](db[_0xf5d4('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0xf5d4('0x14b')});db[_0xf5d4('0x12c')][_0xf5d4('0x10f')](db[_0xf5d4('0x7a')],{'as':_0xf5d4('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xf5d4('0x10f')](db[_0xf5d4('0xd7')],{'as':_0xf5d4('0x150'),'foreignKey':_0xf5d4('0x14b')});db[_0xf5d4('0x12c')][_0xf5d4('0x11d')](db[_0xf5d4('0x151')],{'as':_0xf5d4('0x151'),'foreignKey':'TrunkId'});db[_0xf5d4('0x12c')][_0xf5d4('0x11d')](db[_0xf5d4('0x151')],{'as':_0xf5d4('0x152'),'foreignKey':_0xf5d4('0x153')});db[_0xf5d4('0x12c')][_0xf5d4('0x11d')](db[_0xf5d4('0x8b')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xf5d4('0x12c')][_0xf5d4('0x11d')](db[_0xf5d4('0x8d')],{'as':_0xf5d4('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf5d4('0x12c')][_0xf5d4('0x121')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x125'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':'Agents','through':_0xf5d4('0x2f')});db[_0xf5d4('0x12c')]['belongsToMany'](db[_0xf5d4('0xe8')],{'as':'Teams','through':_0xf5d4('0x155')});db[_0xf5d4('0x12c')][_0xf5d4('0x121')](db[_0xf5d4('0x124')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xf5d4('0x1b')][_0xf5d4('0x11d')](db['User'],{'as':_0xf5d4('0x12'),'foreignKey':'UserId'});db[_0xf5d4('0x1d')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x12'),'foreignKey':_0xf5d4('0x10e')});db['VoiceMail']['hasMany'](db[_0xf5d4('0x21')],{'as':_0xf5d4('0x156'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x157'),'sourceKey':_0xf5d4('0x158')});db[_0xf5d4('0x21')][_0xf5d4('0x11d')](db[_0xf5d4('0x1f')],{'foreignKey':_0xf5d4('0x157'),'targetKey':_0xf5d4('0x158')});db[_0xf5d4('0x23')][_0xf5d4('0x10f')](db[_0xf5d4('0x28')],{'as':_0xf5d4('0x159'),'foreignKey':_0xf5d4('0x15a'),'constraints':![]});db[_0xf5d4('0x23')][_0xf5d4('0x10f')](db[_0xf5d4('0x15b')],{'as':_0xf5d4('0x15c'),'foreignKey':_0xf5d4('0x15a'),'constraints':![]});db['VoiceCallReport'][_0xf5d4('0x11d')](db['User'],{'as':_0xf5d4('0x12'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x23')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x3a')][_0xf5d4('0x11d')](db[_0xf5d4('0x3e')],{'as':_0xf5d4('0x3e'),'foreignKey':'MailAccountId'});db[_0xf5d4('0x3c')][_0xf5d4('0x11d')](db[_0xf5d4('0x3e')],{'as':'MailAccount','foreignKey':_0xf5d4('0x15f')});db[_0xf5d4('0x3e')][_0xf5d4('0x10c')](db[_0xf5d4('0x3a')],{'as':_0xf5d4('0x160'),'onDelete':'cascade'});db[_0xf5d4('0x3e')][_0xf5d4('0x10c')](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db[_0xf5d4('0x3e')][_0xf5d4('0x10f')](db['Disposition'],{'as':_0xf5d4('0x161'),'foreignKey':'MailAccountId'});db[_0xf5d4('0x3e')][_0xf5d4('0x10f')](db[_0xf5d4('0x85')],{'as':_0xf5d4('0x162'),'foreignKey':_0xf5d4('0x15f')});db[_0xf5d4('0x3e')]['hasMany'](db[_0xf5d4('0x42')],{'as':_0xf5d4('0x156'),'foreignKey':'MailAccountId'});db[_0xf5d4('0x3e')][_0xf5d4('0x10f')](db['MailInteraction'],{'as':_0xf5d4('0x163')});db[_0xf5d4('0x3e')][_0xf5d4('0x10f')](db[_0xf5d4('0x44')],{'as':'Applications'});db['MailAccount']['belongsTo'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db['MailAccount'][_0xf5d4('0x11d')](db['Template'],{'as':'Template','foreignKey':_0xf5d4('0x166')});db[_0xf5d4('0x3e')][_0xf5d4('0x11d')](db['Pause'],{'as':_0xf5d4('0x154'),'foreignKey':_0xf5d4('0x167')});db[_0xf5d4('0x3e')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xf5d4('0x12e')][_0xf5d4('0x121')](db['User'],{'as':_0xf5d4('0x168'),'through':'UserMailQueue'});db[_0xf5d4('0x12e')][_0xf5d4('0x121')](db['Team'],{'through':'team_has_mail_queues','as':_0xf5d4('0x169')});db[_0xf5d4('0x40')][_0xf5d4('0x10f')](db[_0xf5d4('0x42')],{'as':_0xf5d4('0x156'),'onDelete':_0xf5d4('0x10d'),'foreignKey':'MailInteractionId'});db[_0xf5d4('0x40')]['belongsTo'](db[_0xf5d4('0x3e')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x15f')});db[_0xf5d4('0x40')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x40')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16b'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x40')][_0xf5d4('0x121')](db[_0xf5d4('0x94')],{'through':'mail_interaction_has_tags','as':_0xf5d4('0x16c')});db['MailInteraction']['belongsToMany'](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x16d'),'as':'ThroughTags'});db['MailInteraction'][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16e'),'through':_0xf5d4('0x127'),'foreignKey':_0xf5d4('0x16f')});db[_0xf5d4('0x42')][_0xf5d4('0x10f')](db['Attachment'],{'as':_0xf5d4('0x170'),'onDelete':_0xf5d4('0x10d')});db['MailMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x12')});db[_0xf5d4('0x42')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'onDelete':'cascade','as':'Contact'});db[_0xf5d4('0x42')]['belongsTo'](db[_0xf5d4('0x40')],{'as':_0xf5d4('0x171'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x3e')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x15f')});db[_0xf5d4('0x44')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x44')][_0xf5d4('0x11d')](db[_0xf5d4('0x12e')],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x44')]['belongsTo'](db[_0xf5d4('0x3e')],{'onDelete':_0xf5d4('0x172')});db['MailApplication'][_0xf5d4('0x11d')](db[_0xf5d4('0x8b')],{'onDelete':'restrict','foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0x44')][_0xf5d4('0x11d')](db[_0xf5d4('0x94')],{'onDelete':'restrict','foreignKey':_0xf5d4('0x174')});db[_0xf5d4('0x45')][_0xf5d4('0x11d')](db['MailAccount'],{});db[_0xf5d4('0x45')][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x45')][_0xf5d4('0x11d')](db['CmContact'],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x45')][_0xf5d4('0x11d')](db[_0xf5d4('0x40')],{});db[_0xf5d4('0x45')][_0xf5d4('0x11d')](db[_0xf5d4('0x42')],{});db[_0xf5d4('0x45')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{});db[_0xf5d4('0x45')]['belongsTo'](db['MailQueue'],{});db[_0xf5d4('0x47')][_0xf5d4('0x10f')](db[_0xf5d4('0x49')],{'as':_0xf5d4('0x175'),'onDelete':_0xf5d4('0x10d')});db['FaxAccount'][_0xf5d4('0x10f')](db['Disposition'],{'as':_0xf5d4('0x161'),'foreignKey':'FaxAccountId'});db[_0xf5d4('0x4b')]['hasMany'](db[_0xf5d4('0x85')],{'as':_0xf5d4('0x162'),'foreignKey':_0xf5d4('0x176')});db[_0xf5d4('0x4b')][_0xf5d4('0x10f')](db['FaxInteraction'],{'as':'Interactions'});db[_0xf5d4('0x4b')][_0xf5d4('0x10f')](db[_0xf5d4('0x4c')],{'as':_0xf5d4('0x148')});db[_0xf5d4('0x4b')][_0xf5d4('0x10f')](db[_0xf5d4('0x17')],{'as':_0xf5d4('0x177'),'onDelete':_0xf5d4('0x10d')});db['FaxAccount'][_0xf5d4('0x10f')](db[_0xf5d4('0x178')],{'as':_0xf5d4('0x156')});db[_0xf5d4('0x4b')][_0xf5d4('0x11d')](db[_0xf5d4('0x151')],{'as':_0xf5d4('0x151')});db[_0xf5d4('0x4b')]['belongsTo'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x4b')]['belongsTo'](db[_0xf5d4('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf5d4('0x167')});db['FaxAccount'][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x13b')});db[_0xf5d4('0x4c')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x4c')][_0xf5d4('0x11d')](db[_0xf5d4('0x51')],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x4c')][_0xf5d4('0x11d')](db[_0xf5d4('0x4b')],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x4c')][_0xf5d4('0x11d')](db['Tag'],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x174')});db[_0xf5d4('0x4e')][_0xf5d4('0x10f')](db[_0xf5d4('0x178')],{'as':'Messages','onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x179')});db[_0xf5d4('0x4e')][_0xf5d4('0x11d')](db[_0xf5d4('0x4b')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x176')});db[_0xf5d4('0x4e')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'as':'Contact','foreignKey':_0xf5d4('0x15e')});db['FaxInteraction'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16b'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x4e')][_0xf5d4('0x121')](db['Tag'],{'through':_0xf5d4('0x17a'),'as':_0xf5d4('0x16c')});db['FaxInteraction'][_0xf5d4('0x121')](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x17a'),'as':'ThroughTags'});db['FaxInteraction'][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16e'),'through':_0xf5d4('0x129'),'foreignKey':_0xf5d4('0x179')});db[_0xf5d4('0x178')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':_0xf5d4('0x10d'),'as':_0xf5d4('0x12')});db[_0xf5d4('0x178')]['belongsTo'](db[_0xf5d4('0x4e')],{'as':_0xf5d4('0x171'),'foreignKey':_0xf5d4('0x179')});db[_0xf5d4('0x178')][_0xf5d4('0x11d')](db['CmContact'],{'onDelete':'cascade','as':_0xf5d4('0x15d')});db[_0xf5d4('0x178')][_0xf5d4('0x11d')](db['Attachment'],{'as':_0xf5d4('0xf0'),'foreignKey':_0xf5d4('0x17b')});db['FaxMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x4b')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x176')});db['FaxQueue'][_0xf5d4('0x121')](db['User'],{'as':'Agents','through':_0xf5d4('0x35')});db[_0xf5d4('0x51')][_0xf5d4('0x121')](db[_0xf5d4('0xe8')],{'through':_0xf5d4('0x17c'),'as':'Teams'});db['FaxQueueReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x4b')],{});db[_0xf5d4('0x52')][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x52')]['belongsTo'](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':'ContactId'});db[_0xf5d4('0x52')][_0xf5d4('0x11d')](db[_0xf5d4('0x4e')],{});db[_0xf5d4('0x52')]['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{});db['FaxQueueReport'][_0xf5d4('0x11d')](db['FaxQueue'],{});db[_0xf5d4('0x53')][_0xf5d4('0x10f')](db[_0xf5d4('0x87')],{'as':_0xf5d4('0x161'),'foreignKey':'SmsAccountId'});db[_0xf5d4('0x53')][_0xf5d4('0x10f')](db[_0xf5d4('0x85')],{'as':'Answers','foreignKey':_0xf5d4('0x17d')});db[_0xf5d4('0x53')][_0xf5d4('0x10f')](db[_0xf5d4('0x58')],{'as':_0xf5d4('0x156'),'foreignKey':'SmsAccountId'});db[_0xf5d4('0x53')][_0xf5d4('0x10f')](db[_0xf5d4('0x56')],{'as':_0xf5d4('0x163')});db[_0xf5d4('0x53')][_0xf5d4('0x10f')](db[_0xf5d4('0x54')],{'as':_0xf5d4('0x148')});db['SmsAccount']['belongsTo'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x53')]['belongsTo'](db['Pause'],{'as':_0xf5d4('0x154'),'foreignKey':_0xf5d4('0x167')});db[_0xf5d4('0x53')][_0xf5d4('0x121')](db['User'],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x141')});db[_0xf5d4('0x54')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x54')]['belongsTo'](db[_0xf5d4('0x5a')],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x54')][_0xf5d4('0x11d')](db[_0xf5d4('0x53')],{'onDelete':_0xf5d4('0x172')});db['SmsApplication'][_0xf5d4('0x11d')](db[_0xf5d4('0x8b')],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0x54')]['belongsTo'](db['Tag'],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x174')});db[_0xf5d4('0x56')][_0xf5d4('0x10f')](db['SmsMessage'],{'as':_0xf5d4('0x156'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x17e')});db[_0xf5d4('0x56')]['belongsTo'](db[_0xf5d4('0x53')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xf5d4('0x56')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x56')]['belongsTo'](db['User'],{'as':_0xf5d4('0x16b'),'foreignKey':_0xf5d4('0x10e')});db['SmsInteraction'][_0xf5d4('0x121')](db['Tag'],{'through':_0xf5d4('0x17f'),'as':'Tags'});db[_0xf5d4('0x56')][_0xf5d4('0x121')](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x17f'),'as':_0xf5d4('0x180')});db[_0xf5d4('0x56')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16e'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0xf5d4('0x58')][_0xf5d4('0x11d')](db['User'],{'as':_0xf5d4('0x12')});db[_0xf5d4('0x58')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'onDelete':_0xf5d4('0x10d'),'as':_0xf5d4('0x15d')});db['SmsMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x56')],{'onDelete':_0xf5d4('0x10d'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0xf5d4('0x58')][_0xf5d4('0x11d')](db['SmsAccount'],{'as':'Account','foreignKey':_0xf5d4('0x17d')});db[_0xf5d4('0x5a')]['belongsToMany'](db['User'],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x36'),'foreignKey':_0xf5d4('0x181')});db[_0xf5d4('0x5a')][_0xf5d4('0x121')](db[_0xf5d4('0xe8')],{'through':_0xf5d4('0x182'),'as':_0xf5d4('0x169')});db[_0xf5d4('0x5c')][_0xf5d4('0x10f')](db[_0xf5d4('0x87')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db[_0xf5d4('0x5c')][_0xf5d4('0x10f')](db[_0xf5d4('0x85')],{'as':'Answers','foreignKey':_0xf5d4('0x183')});db[_0xf5d4('0x5c')][_0xf5d4('0x10f')](db['OpenchannelInteraction'],{'as':_0xf5d4('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xf5d4('0x5c')][_0xf5d4('0x10f')](db[_0xf5d4('0x61')],{'as':_0xf5d4('0x156'),'foreignKey':_0xf5d4('0x183')});db['OpenchannelAccount'][_0xf5d4('0x10f')](db[_0xf5d4('0x184')],{'as':_0xf5d4('0x148'),'foreignKey':_0xf5d4('0x183')});db['OpenchannelAccount'][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x5c')][_0xf5d4('0x11d')](db[_0xf5d4('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf5d4('0x167')});db[_0xf5d4('0x5c')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':_0xf5d4('0x172')});db['OpenchannelApplication']['belongsTo'](db[_0xf5d4('0x63')],{'onDelete':_0xf5d4('0x172'),'foreignKey':'OpenchannelQueueId'});db[_0xf5d4('0x184')][_0xf5d4('0x11d')](db['OpenchannelAccount'],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x183')});db[_0xf5d4('0x184')][_0xf5d4('0x11d')](db[_0xf5d4('0x8b')],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0x184')][_0xf5d4('0x11d')](db[_0xf5d4('0x94')],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x174')});db[_0xf5d4('0x5f')]['hasMany'](db[_0xf5d4('0x61')],{'as':_0xf5d4('0x156'),'onDelete':'cascade','foreignKey':_0xf5d4('0x185')});db[_0xf5d4('0x5f')][_0xf5d4('0x11d')](db[_0xf5d4('0x5c')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x183')});db['OpenchannelInteraction'][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x5f')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16b'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x5f')][_0xf5d4('0x121')](db['Tag'],{'through':_0xf5d4('0x186'),'as':'Tags'});db[_0xf5d4('0x5f')][_0xf5d4('0x121')](db[_0xf5d4('0x94')],{'through':'openchannel_interaction_has_tags','as':_0xf5d4('0x180')});db[_0xf5d4('0x5f')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16e'),'through':_0xf5d4('0x187'),'foreignKey':'OpenchannelInteractionId'});db[_0xf5d4('0x61')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':_0xf5d4('0x10d'),'as':'User'});db[_0xf5d4('0x61')]['belongsTo'](db['CmContact'],{'onDelete':_0xf5d4('0x10d'),'as':'Contact'});db['OpenchannelMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x5f')],{'onDelete':'cascade','as':_0xf5d4('0x171'),'foreignKey':_0xf5d4('0x185')});db[_0xf5d4('0x61')]['belongsTo'](db[_0xf5d4('0xf0')],{'as':_0xf5d4('0xf0'),'foreignKey':'AttachmentId'});db[_0xf5d4('0x61')][_0xf5d4('0x11d')](db[_0xf5d4('0x5c')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x183')});db[_0xf5d4('0x63')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0xf5d4('0x121')](db[_0xf5d4('0xe8')],{'through':_0xf5d4('0x188'),'as':_0xf5d4('0x169')});db[_0xf5d4('0x137')][_0xf5d4('0x10f')](db[_0xf5d4('0x87')],{'as':_0xf5d4('0x161'),'foreignKey':'ChatWebsiteId'});db[_0xf5d4('0x137')]['hasMany'](db[_0xf5d4('0x85')],{'as':'Answers','foreignKey':_0xf5d4('0x189')});db[_0xf5d4('0x137')]['hasMany'](db[_0xf5d4('0x73')],{'as':'ProactiveActions'});db[_0xf5d4('0x137')][_0xf5d4('0x10f')](db[_0xf5d4('0x6a')],{'as':_0xf5d4('0x163')});db[_0xf5d4('0x137')][_0xf5d4('0x10f')](db['ChatApplication'],{'as':_0xf5d4('0x148')});db[_0xf5d4('0x137')]['hasMany'](db[_0xf5d4('0x6c')],{'as':_0xf5d4('0x156')});db[_0xf5d4('0x137')][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':'ListId'});db[_0xf5d4('0x137')][_0xf5d4('0x11d')](db[_0xf5d4('0x8b')],{'as':'Interval','foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0x137')][_0xf5d4('0x11d')](db[_0xf5d4('0x8d')],{'as':_0xf5d4('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf5d4('0x137')][_0xf5d4('0x121')](db['User'],{'as':_0xf5d4('0x168'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x5c')],{});db[_0xf5d4('0x66')][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x66')]['belongsTo'](db[_0xf5d4('0x77')],{'as':'Contact','foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x66')][_0xf5d4('0x11d')](db[_0xf5d4('0x5f')],{});db[_0xf5d4('0x66')][_0xf5d4('0x11d')](db[_0xf5d4('0x61')],{});db[_0xf5d4('0x66')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{});db[_0xf5d4('0x66')]['belongsTo'](db[_0xf5d4('0x63')],{});db['ChatApplication'][_0xf5d4('0x11d')](db['User'],{'as':_0xf5d4('0x18a'),'foreignKey':_0xf5d4('0x10e'),'onDelete':_0xf5d4('0x172')});db['ChatApplication'][_0xf5d4('0x11d')](db[_0xf5d4('0x6f')],{'as':'Queue','foreignKey':_0xf5d4('0x18b'),'onDelete':'restrict'});db[_0xf5d4('0x68')][_0xf5d4('0x11d')](db['ChatWebsite'],{'as':_0xf5d4('0x18c'),'foreignKey':_0xf5d4('0x189'),'onDelete':_0xf5d4('0x172')});db['ChatApplication']['belongsTo'](db[_0xf5d4('0x94')],{'onDelete':'restrict','foreignKey':_0xf5d4('0x174')});db['ChatInteraction'][_0xf5d4('0x10f')](db[_0xf5d4('0x6c')],{'as':_0xf5d4('0x156'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x18d')});db['ChatInteraction']['belongsTo'](db[_0xf5d4('0x137')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x189')});db[_0xf5d4('0x6a')]['belongsTo'](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':'ContactId'});db['ChatInteraction'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16b'),'foreignKey':_0xf5d4('0x10e')});db[_0xf5d4('0x6a')]['belongsToMany'](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x18e'),'as':_0xf5d4('0x16c')});db[_0xf5d4('0x6a')][_0xf5d4('0x121')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xf5d4('0x180')});db[_0xf5d4('0x6a')]['belongsToMany'](db['User'],{'as':_0xf5d4('0x16e'),'through':_0xf5d4('0x128'),'foreignKey':'ChatInteractionId'});db[_0xf5d4('0x6c')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':'cascade','as':_0xf5d4('0x12')});db[_0xf5d4('0x6c')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'onDelete':_0xf5d4('0x10d'),'as':_0xf5d4('0x15d'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0xf5d4('0x171'),'foreignKey':_0xf5d4('0x18d')});db['ChatMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0xf0')],{'as':'Attachment','foreignKey':_0xf5d4('0x17b')});db['ChatMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x137')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xf5d4('0x18f')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'onDelete':_0xf5d4('0x10d'),'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x18f')]['belongsTo'](db[_0xf5d4('0x137')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x189')});db[_0xf5d4('0x6f')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x31'),'hooks':!![]});db[_0xf5d4('0x6f')]['belongsToMany'](db[_0xf5d4('0xe8')],{'through':_0xf5d4('0x190'),'as':'Teams'});db[_0xf5d4('0x71')]['hasMany'](db[_0xf5d4('0xd3')],{'as':_0xf5d4('0x156'),'foreignKey':_0xf5d4('0x191'),'onDelete':_0xf5d4('0x10d')});db['ChatGroup'][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x192'),'through':_0xf5d4('0x120')});db[_0xf5d4('0x73')][_0xf5d4('0x11d')](db[_0xf5d4('0x137')],{'as':_0xf5d4('0x18c'),'foreignKey':_0xf5d4('0x189')});db[_0xf5d4('0x75')]['hasMany'](db[_0xf5d4('0x77')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xf5d4('0x77')]['hasMany'](db[_0xf5d4('0x78')],{'as':_0xf5d4('0x14c'),'foreignKey':'ContactId'});db[_0xf5d4('0x77')][_0xf5d4('0x10f')](db[_0xf5d4('0x112')],{'as':_0xf5d4('0x113'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x77')]['hasMany'](db[_0xf5d4('0x14d')],{'as':_0xf5d4('0x14e'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0x77')][_0xf5d4('0x10f')](db[_0xf5d4('0x7e')],{'as':_0xf5d4('0x7e'),'foreignKey':'ContactId'});db['CmContact'][_0xf5d4('0x10f')](db[_0xf5d4('0xd7')],{'as':'JscriptySessions','foreignKey':_0xf5d4('0x15e')});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0xf5d4('0x115'),'foreignKey':_0xf5d4('0x15e'),'onDelete':_0xf5d4('0x172')});db['CmContact']['hasMany'](db['ChatInteraction'],{'as':_0xf5d4('0x116'),'foreignKey':_0xf5d4('0x15e'),'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x77')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xf5d4('0x15e'),'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x77')][_0xf5d4('0x10f')](db['FaxInteraction'],{'as':_0xf5d4('0x118'),'foreignKey':_0xf5d4('0x15e'),'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x77')][_0xf5d4('0x10f')](db['MailInteraction'],{'as':_0xf5d4('0x119'),'foreignKey':_0xf5d4('0x15e'),'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x77')]['belongsTo'](db['CmCompany'],{'as':_0xf5d4('0x193'),'foreignKey':_0xf5d4('0x194')});db[_0xf5d4('0x77')][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':'List','foreignKey':_0xf5d4('0x165'),'onDelete':'cascade'});db[_0xf5d4('0x77')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16e'),'through':_0xf5d4('0x123')});db[_0xf5d4('0x77')]['belongsToMany'](db[_0xf5d4('0x94')],{'as':_0xf5d4('0x16c'),'through':_0xf5d4('0x195')});db[_0xf5d4('0x77')]['belongsToMany'](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x195'),'as':_0xf5d4('0x180')});db['CmHopper'][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e'),'onDelete':_0xf5d4('0x10d')});db[_0xf5d4('0x78')][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165'),'onDelete':_0xf5d4('0x10d')});db[_0xf5d4('0x78')]['belongsTo'](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x18a'),'foreignKey':'UserId'});db['CmHopper']['belongsTo'](db[_0xf5d4('0x12c')],{'as':'Queue','foreignKey':_0xf5d4('0x14b'),'onDelete':'cascade'});db['CmHopper'][_0xf5d4('0x11d')](db['Campaign'],{'as':'Campaign','foreignKey':_0xf5d4('0x196'),'onDelete':'cascade'});db[_0xf5d4('0x78')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16b'),'foreignKey':'OwnerId'});db[_0xf5d4('0x7a')]['belongsTo'](db[_0xf5d4('0x77')],{'as':'Contact','foreignKey':_0xf5d4('0x15e'),'onDelete':'cascade'});db[_0xf5d4('0x7a')]['belongsTo'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':'ListId','onDelete':_0xf5d4('0x10d')});db[_0xf5d4('0x7a')][_0xf5d4('0x11d')](db[_0xf5d4('0x12c')],{'as':_0xf5d4('0x197'),'foreignKey':_0xf5d4('0x14b'),'onDelete':_0xf5d4('0x10d')});db['CmHopperBlack'][_0xf5d4('0x11d')](db[_0xf5d4('0xec')],{'as':_0xf5d4('0xec'),'foreignKey':_0xf5d4('0x196'),'onDelete':_0xf5d4('0x10d')});db[_0xf5d4('0x84')]['hasMany'](db['Condition'],{'as':{'plural':_0xf5d4('0x198'),'singular':'OneAll'},'foreignKey':_0xf5d4('0x199'),'onDelete':'cascade','hooks':!![]});db[_0xf5d4('0x84')][_0xf5d4('0x10f')](db[_0xf5d4('0x89')],{'as':{'plural':_0xf5d4('0x19a'),'singular':_0xf5d4('0x19b')},'foreignKey':_0xf5d4('0x19c'),'onDelete':_0xf5d4('0x10d'),'hooks':!![]});db[_0xf5d4('0x84')][_0xf5d4('0x10f')](db[_0xf5d4('0x82')],{'as':_0xf5d4('0x19d'),'foreignKey':_0xf5d4('0x19e'),'onDelete':_0xf5d4('0x10d'),'hooks':!![]});db[_0xf5d4('0x87')][_0xf5d4('0x10f')](db[_0xf5d4('0x87')],{'as':_0xf5d4('0x161'),'foreignKey':'ParentId','onDelete':_0xf5d4('0x10d')});db['Interval']['hasMany'](db[_0xf5d4('0x8b')],{'as':_0xf5d4('0x19f'),'foreignKey':_0xf5d4('0x173'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xf5d4('0x8b')][_0xf5d4('0x10f')](db[_0xf5d4('0x17')],{'as':_0xf5d4('0x111'),'foreignKey':_0xf5d4('0x173'),'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x8b')][_0xf5d4('0x10f')](db[_0xf5d4('0x44')],{'as':_0xf5d4('0x1a0'),'foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0x8b')][_0xf5d4('0x10f')](db[_0xf5d4('0x68')],{'as':_0xf5d4('0x1a1'),'foreignKey':_0xf5d4('0x173')});db['Interval']['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0x8b')][_0xf5d4('0x10f')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0xf5d4('0x11d')](db[_0xf5d4('0x3e')],{});db[_0xf5d4('0x1a2')][_0xf5d4('0x11d')](db[_0xf5d4('0x9b')],{'foreignKey':_0xf5d4('0x1a3')});db[_0xf5d4('0x1a2')]['belongsTo'](db[_0xf5d4('0x1a4')],{'foreignKey':_0xf5d4('0x1a5')});db[_0xf5d4('0x92')][_0xf5d4('0x121')](db[_0xf5d4('0x18')],{'as':_0xf5d4('0x1a6'),'through':_0xf5d4('0x14a'),'onDelete':_0xf5d4('0x172')});db['Tag'][_0xf5d4('0x121')](db[_0xf5d4('0x77')],{'through':_0xf5d4('0x195')});db[_0xf5d4('0x94')]['belongsToMany'](db[_0xf5d4('0x6a')],{'through':_0xf5d4('0x18e')});db['Tag'][_0xf5d4('0x121')](db[_0xf5d4('0x40')],{'through':_0xf5d4('0x16d')});db[_0xf5d4('0x94')][_0xf5d4('0x121')](db[_0xf5d4('0x56')],{'through':_0xf5d4('0x17f')});db[_0xf5d4('0x94')][_0xf5d4('0x121')](db[_0xf5d4('0x4e')],{'through':_0xf5d4('0x17a')});db[_0xf5d4('0x94')]['belongsToMany'](db[_0xf5d4('0x5f')],{'through':_0xf5d4('0x186')});db[_0xf5d4('0x94')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xf5d4('0x1a7')});db[_0xf5d4('0x97')]['hasMany'](db[_0xf5d4('0x89')],{'as':{'plural':_0xf5d4('0x1a8'),'singular':'AllCondition'},'foreignKey':_0xf5d4('0x1a9'),'onDelete':_0xf5d4('0x10d'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xf5d4('0x89')],{'as':{'plural':'AnyConditions','singular':_0xf5d4('0x1aa')},'foreignKey':_0xf5d4('0x1ab'),'onDelete':_0xf5d4('0x10d'),'hooks':!![]});db[_0xf5d4('0x97')][_0xf5d4('0x10f')](db[_0xf5d4('0x82')],{'as':_0xf5d4('0x19d'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0xf5d4('0x1a4')][_0xf5d4('0x10f')](db[_0xf5d4('0x9f')],{'as':_0xf5d4('0x1ac'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1a5'),'hooks':!![]});db[_0xf5d4('0x9b')]['hasMany'](db[_0xf5d4('0x9f')],{'as':_0xf5d4('0x1ac'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xf5d4('0x9e')][_0xf5d4('0x10f')](db[_0xf5d4('0x9f')],{'as':_0xf5d4('0x1ac'),'onDelete':'cascade','foreignKey':_0xf5d4('0x1ad')});db[_0xf5d4('0x9f')]['belongsTo'](db[_0xf5d4('0x9e')],{'foreignKey':_0xf5d4('0x1ad')});db['SalesforceAccount'][_0xf5d4('0x10f')](db[_0xf5d4('0xa3')],{'as':'Configurations','onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1ae')});db['SalesforceConfiguration'][_0xf5d4('0x10f')](db['SalesforceField'],{'as':_0xf5d4('0x1af'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0xa3')][_0xf5d4('0x10f')](db[_0xf5d4('0xa4')],{'as':'Descriptions','onDelete':_0xf5d4('0x10d'),'foreignKey':'DescriptionId'});db[_0xf5d4('0xa3')][_0xf5d4('0x10f')](db['SalesforceField'],{'as':_0xf5d4('0x1ac'),'onDelete':_0xf5d4('0x10d'),'foreignKey':'FieldId'});db[_0xf5d4('0xa3')][_0xf5d4('0x11d')](db['SalesforceAccount'],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0xa4')][_0xf5d4('0x10f')](db[_0xf5d4('0xa4')],{'as':_0xf5d4('0x1b1'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0xa4')][_0xf5d4('0x10f')](db[_0xf5d4('0xa4')],{'as':_0xf5d4('0x1b2'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0xa4')]['hasMany'](db[_0xf5d4('0xa4')],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0xa4')][_0xf5d4('0x11d')](db['Variable'],{'as':_0xf5d4('0x98'),'foreignKey':_0xf5d4('0x1b6')});db[_0xf5d4('0xa6')][_0xf5d4('0x10f')](db[_0xf5d4('0xa8')],{'as':_0xf5d4('0x1b7'),'onDelete':'cascade','foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0xa8')][_0xf5d4('0x10f')](db['SugarcrmField'],{'as':_0xf5d4('0x1af'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0xa8')]['hasMany'](db[_0xf5d4('0x1b8')],{'as':_0xf5d4('0x1b9'),'onDelete':'cascade','foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0xa8')][_0xf5d4('0x10f')](db[_0xf5d4('0x1b8')],{'as':_0xf5d4('0x1ac'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xf5d4('0xa8')][_0xf5d4('0x11d')](db[_0xf5d4('0xa6')],{'as':_0xf5d4('0x16a'),'foreignKey':'AccountId'});db[_0xf5d4('0x1b8')][_0xf5d4('0x10f')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0x1b8')][_0xf5d4('0x10f')](db[_0xf5d4('0x1b8')],{'as':'Description','foreignKey':_0xf5d4('0x1b3')});db['SugarcrmField'][_0xf5d4('0x10f')](db[_0xf5d4('0x1b8')],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db['SugarcrmField']['belongsTo'](db[_0xf5d4('0x98')],{'as':_0xf5d4('0x98'),'foreignKey':_0xf5d4('0x1b6')});db[_0xf5d4('0x1ba')][_0xf5d4('0x10f')](db[_0xf5d4('0xac')],{'as':'Configurations','onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1ae')});db['DeskConfiguration'][_0xf5d4('0x10f')](db['DeskField'],{'as':_0xf5d4('0x1af'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0xac')][_0xf5d4('0x10f')](db[_0xf5d4('0xae')],{'as':_0xf5d4('0x1b9'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0xac')]['hasMany'](db[_0xf5d4('0xae')],{'as':'Fields','onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0xac')][_0xf5d4('0x11d')](db[_0xf5d4('0x1ba')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0xac')]['belongsToMany'](db[_0xf5d4('0x94')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0xf5d4('0x10f')](db[_0xf5d4('0xae')],{'as':_0xf5d4('0x1b1'),'foreignKey':'SubjectId'});db['DeskField'][_0xf5d4('0x10f')](db[_0xf5d4('0xae')],{'as':_0xf5d4('0x1b2'),'foreignKey':_0xf5d4('0x1b3')});db['DeskField'][_0xf5d4('0x10f')](db[_0xf5d4('0xae')],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0xae')][_0xf5d4('0x11d')](db[_0xf5d4('0x98')],{'as':_0xf5d4('0x98'),'foreignKey':_0xf5d4('0x1b6')});db[_0xf5d4('0xb0')][_0xf5d4('0x10f')](db[_0xf5d4('0x1bb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0x1bb')][_0xf5d4('0x10f')](db[_0xf5d4('0x1bc')],{'as':'Subjects','onDelete':_0xf5d4('0x10d'),'foreignKey':'SubjectId'});db[_0xf5d4('0x1bb')][_0xf5d4('0x10f')](db[_0xf5d4('0x1bc')],{'as':_0xf5d4('0x1b9'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0x1bb')][_0xf5d4('0x10f')](db[_0xf5d4('0x1bc')],{'as':_0xf5d4('0x1ac'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b5')});db['ZohoConfiguration'][_0xf5d4('0x11d')](db['ZohoAccount'],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x1ae')});db['ZohoField'][_0xf5d4('0x10f')](db[_0xf5d4('0x1bc')],{'as':_0xf5d4('0x1b1'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0x1bc')][_0xf5d4('0x10f')](db[_0xf5d4('0x1bc')],{'as':_0xf5d4('0x1b2'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0x1bc')][_0xf5d4('0x10f')](db['ZohoField'],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db['ZohoField']['belongsTo'](db[_0xf5d4('0x98')],{'as':_0xf5d4('0x98'),'foreignKey':_0xf5d4('0x1b6')});db[_0xf5d4('0xb4')][_0xf5d4('0x10f')](db[_0xf5d4('0x1bd')],{'as':_0xf5d4('0x1b7'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0x1bd')][_0xf5d4('0x10f')](db[_0xf5d4('0x1be')],{'as':_0xf5d4('0x1af'),'foreignKey':'SubjectId'});db[_0xf5d4('0x1bd')]['hasMany'](db['ZendeskField'],{'as':_0xf5d4('0x1b9'),'foreignKey':_0xf5d4('0x1b3')});db['ZendeskConfiguration'][_0xf5d4('0x10f')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xf5d4('0x1b5')});db['ZendeskConfiguration'][_0xf5d4('0x11d')](db['ZendeskAccount'],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0x1bd')][_0xf5d4('0x121')](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x1bf')});db['ZendeskField'][_0xf5d4('0x10f')](db[_0xf5d4('0x1be')],{'as':'Subject','foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0x1be')][_0xf5d4('0x10f')](db[_0xf5d4('0x1be')],{'as':_0xf5d4('0x1b2'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0x1be')][_0xf5d4('0x10f')](db[_0xf5d4('0x1be')],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db['ZendeskField'][_0xf5d4('0x11d')](db['Variable'],{'as':_0xf5d4('0x98'),'foreignKey':_0xf5d4('0x1b6')});db[_0xf5d4('0xb7')]['hasMany'](db[_0xf5d4('0xb9')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xf5d4('0x1af'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0xb9')][_0xf5d4('0x10f')](db[_0xf5d4('0xbb')],{'as':_0xf5d4('0x1b9'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0xb9')][_0xf5d4('0x10f')](db[_0xf5d4('0xbb')],{'as':_0xf5d4('0x1ac'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0xb9')]['belongsTo'](db[_0xf5d4('0xb7')],{'as':'Account','foreignKey':'AccountId'});db[_0xf5d4('0xb9')]['belongsToMany'](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x1c0')});db[_0xf5d4('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0xf5d4('0x1b1'),'foreignKey':_0xf5d4('0x1b0')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0xf5d4('0x1b2'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0xf5d4('0x10f')](db[_0xf5d4('0xbb')],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0xbb')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xf5d4('0xbd')][_0xf5d4('0x10f')](db[_0xf5d4('0xbf')],{'as':_0xf5d4('0x1b7'),'onDelete':'cascade','foreignKey':_0xf5d4('0x1ae')});db['VtigerConfiguration'][_0xf5d4('0x10f')](db[_0xf5d4('0xc1')],{'as':_0xf5d4('0x1af'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0xbf')][_0xf5d4('0x10f')](db[_0xf5d4('0xc1')],{'as':_0xf5d4('0x1b9'),'foreignKey':_0xf5d4('0x1b3')});db['VtigerConfiguration'][_0xf5d4('0x10f')](db[_0xf5d4('0xc1')],{'as':_0xf5d4('0x1ac'),'foreignKey':'FieldId'});db[_0xf5d4('0xbf')][_0xf5d4('0x11d')](db[_0xf5d4('0xbd')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0xc1')][_0xf5d4('0x10f')](db[_0xf5d4('0xc1')],{'as':_0xf5d4('0x1b1'),'foreignKey':'SubjectId'});db[_0xf5d4('0xc1')][_0xf5d4('0x10f')](db[_0xf5d4('0xc1')],{'as':'Description','foreignKey':_0xf5d4('0x1b3')});db['VtigerField']['hasMany'](db[_0xf5d4('0xc1')],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db['VtigerField']['belongsTo'](db[_0xf5d4('0x98')],{'as':'Variable','foreignKey':_0xf5d4('0x1b6')});db['ServicenowAccount'][_0xf5d4('0x10f')](db[_0xf5d4('0xc4')],{'as':_0xf5d4('0x1b7'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0xc4')][_0xf5d4('0x10f')](db[_0xf5d4('0xc5')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xf5d4('0xc4')][_0xf5d4('0x10f')](db[_0xf5d4('0xc5')],{'as':_0xf5d4('0x1b9'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0xc4')][_0xf5d4('0x10f')](db[_0xf5d4('0xc5')],{'as':'Fields','foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0xc4')][_0xf5d4('0x11d')](db[_0xf5d4('0xc3')],{'as':'Account','foreignKey':'AccountId'});db[_0xf5d4('0xc5')][_0xf5d4('0x10f')](db[_0xf5d4('0xc5')],{'as':_0xf5d4('0x1b1'),'foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0xc5')]['hasMany'](db[_0xf5d4('0xc5')],{'as':'Description','foreignKey':_0xf5d4('0x1b3')});db['ServicenowField'][_0xf5d4('0x10f')](db[_0xf5d4('0xc5')],{'as':_0xf5d4('0x1b4'),'foreignKey':'FieldId'});db[_0xf5d4('0xc5')][_0xf5d4('0x11d')](db[_0xf5d4('0x98')],{'as':'Variable','foreignKey':'VariableId'});db[_0xf5d4('0xc6')][_0xf5d4('0x10f')](db[_0xf5d4('0xc8')],{'as':'Configurations','onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0xc8')][_0xf5d4('0x10f')](db[_0xf5d4('0xc9')],{'as':'Subjects','onDelete':_0xf5d4('0x10d'),'foreignKey':'SubjectId'});db[_0xf5d4('0xc8')]['hasMany'](db[_0xf5d4('0xc9')],{'as':_0xf5d4('0x1b9'),'onDelete':_0xf5d4('0x10d'),'foreignKey':'DescriptionId'});db[_0xf5d4('0xc8')][_0xf5d4('0x10f')](db[_0xf5d4('0xc9')],{'as':_0xf5d4('0x1ac'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0xc8')][_0xf5d4('0x11d')](db[_0xf5d4('0xc6')],{'as':'Account','foreignKey':_0xf5d4('0x1ae')});db[_0xf5d4('0xc9')][_0xf5d4('0x10f')](db[_0xf5d4('0xc9')],{'as':_0xf5d4('0x1b1'),'foreignKey':'SubjectId'});db[_0xf5d4('0xc9')][_0xf5d4('0x10f')](db[_0xf5d4('0xc9')],{'as':_0xf5d4('0x1b2'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0xc9')][_0xf5d4('0x10f')](db['Dynamics365Field'],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db['Dynamics365Field'][_0xf5d4('0x11d')](db[_0xf5d4('0x98')],{'as':_0xf5d4('0x98'),'foreignKey':_0xf5d4('0x1b6')});db[_0xf5d4('0xcb')][_0xf5d4('0x10f')](db[_0xf5d4('0x1c1')],{'as':_0xf5d4('0x1b7'),'onDelete':'cascade','foreignKey':_0xf5d4('0x1ae')});db['FreshsalesConfiguration'][_0xf5d4('0x10f')](db[_0xf5d4('0x1c2')],{'as':_0xf5d4('0x1af'),'foreignKey':_0xf5d4('0x1b0')});db['FreshsalesConfiguration'][_0xf5d4('0x10f')](db[_0xf5d4('0x1c2')],{'as':'Descriptions','foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0x1c1')][_0xf5d4('0x10f')](db[_0xf5d4('0x1c2')],{'as':_0xf5d4('0x1ac'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0x1c1')][_0xf5d4('0x11d')](db[_0xf5d4('0xcb')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x1ae')});db['FreshsalesField'][_0xf5d4('0x10f')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xf5d4('0x1b0')});db[_0xf5d4('0x1c2')][_0xf5d4('0x10f')](db[_0xf5d4('0x1c2')],{'as':_0xf5d4('0x1b2'),'foreignKey':_0xf5d4('0x1b3')});db[_0xf5d4('0x1c2')][_0xf5d4('0x10f')](db[_0xf5d4('0x1c2')],{'as':_0xf5d4('0x1b4'),'foreignKey':_0xf5d4('0x1b5')});db[_0xf5d4('0x1c2')][_0xf5d4('0x11d')](db[_0xf5d4('0x98')],{'as':_0xf5d4('0x98'),'foreignKey':_0xf5d4('0x1b6')});db[_0xf5d4('0xd1')]['belongsTo'](db[_0xf5d4('0x137')],{});db[_0xf5d4('0xd1')][_0xf5d4('0x11d')](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0xd1')][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0xd1')][_0xf5d4('0x11d')](db[_0xf5d4('0x6a')],{});db[_0xf5d4('0xd1')][_0xf5d4('0x11d')](db[_0xf5d4('0x6c')],{});db[_0xf5d4('0xd1')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{});db[_0xf5d4('0xd1')][_0xf5d4('0x11d')](db[_0xf5d4('0x6f')],{});db[_0xf5d4('0xd3')][_0xf5d4('0x11d')](db['User'],{'onDelete':_0xf5d4('0x10d'),'foreignKey':'FromId'});db[_0xf5d4('0xd3')][_0xf5d4('0x11d')](db['User'],{'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1c3')});db[_0xf5d4('0xd7')]['hasMany'](db[_0xf5d4('0xd5')],{'foreignKey':_0xf5d4('0x1c4'),'onDelete':'cascade'});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xf5d4('0x1c4'),'onDelete':'cascade'});db[_0xf5d4('0xd9')][_0xf5d4('0x11d')](db[_0xf5d4('0x53')],{});db[_0xf5d4('0xd9')]['belongsTo'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':'ListId'});db[_0xf5d4('0xd9')]['belongsTo'](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db[_0xf5d4('0xd9')][_0xf5d4('0x11d')](db[_0xf5d4('0x56')],{});db['SmsQueueReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x58')],{});db[_0xf5d4('0xd9')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{});db[_0xf5d4('0xd9')][_0xf5d4('0x11d')](db[_0xf5d4('0x5a')],{});db[_0xf5d4('0xdd')][_0xf5d4('0x10f')](db[_0xf5d4('0xd7')],{'foreignKey':_0xf5d4('0x1c5')});db[_0xf5d4('0xdd')][_0xf5d4('0x10f')](db[_0xf5d4('0xd5')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0xf5d4('0xd4')],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db['User'],{'as':'Users','through':'user_has_square_projects'});db['Team'][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x126')});db['Team'][_0xf5d4('0x121')](db['VoiceQueue'],{'through':_0xf5d4('0x155'),'as':'VoiceQueues'});db[_0xf5d4('0xe8')][_0xf5d4('0x121')](db[_0xf5d4('0x12e')],{'through':_0xf5d4('0x1c6'),'as':_0xf5d4('0x12f')});db[_0xf5d4('0xe8')][_0xf5d4('0x121')](db[_0xf5d4('0x6f')],{'through':_0xf5d4('0x190'),'as':_0xf5d4('0x130')});db['Team'][_0xf5d4('0x121')](db[_0xf5d4('0x51')],{'through':_0xf5d4('0x17c'),'as':_0xf5d4('0x131')});db['Team'][_0xf5d4('0x121')](db[_0xf5d4('0x5a')],{'through':_0xf5d4('0x182'),'as':_0xf5d4('0x1c7')});db[_0xf5d4('0xe8')][_0xf5d4('0x121')](db[_0xf5d4('0x63')],{'through':_0xf5d4('0x188'),'as':_0xf5d4('0x132')});db[_0xf5d4('0xe8')][_0xf5d4('0x121')](db[_0xf5d4('0x133')],{'through':_0xf5d4('0x1c8'),'as':'WhatsappQueues'});db[_0xf5d4('0xec')]['hasMany'](db[_0xf5d4('0x78')],{'as':_0xf5d4('0x14c'),'foreignKey':_0xf5d4('0x196')});db['Campaign'][_0xf5d4('0x10f')](db['CmHopperFinal'],{'as':_0xf5d4('0x113'),'foreignKey':_0xf5d4('0x196')});db[_0xf5d4('0xec')][_0xf5d4('0x10f')](db[_0xf5d4('0x14d')],{'as':_0xf5d4('0x14e'),'foreignKey':_0xf5d4('0x196')});db[_0xf5d4('0xec')][_0xf5d4('0x10f')](db[_0xf5d4('0x7a')],{'as':_0xf5d4('0x14f'),'foreignKey':_0xf5d4('0x196')});db['Campaign'][_0xf5d4('0x11d')](db[_0xf5d4('0x151')],{'as':_0xf5d4('0x151'),'foreignKey':_0xf5d4('0x1c9')});db['Campaign'][_0xf5d4('0x11d')](db[_0xf5d4('0x151')],{'as':_0xf5d4('0x152'),'foreignKey':_0xf5d4('0x153')});db[_0xf5d4('0xec')][_0xf5d4('0x11d')](db[_0xf5d4('0x8b')],{'as':_0xf5d4('0x8b'),'foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0xec')][_0xf5d4('0x11d')](db[_0xf5d4('0xe3')],{'as':_0xf5d4('0xe3'),'foreignKey':_0xf5d4('0x1ca')});db[_0xf5d4('0xec')][_0xf5d4('0x121')](db['CmList'],{'as':_0xf5d4('0x125'),'through':_0xf5d4('0x1cb')});db[_0xf5d4('0xec')]['belongsToMany'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x1cc'),'through':'campaigns_has_cm_blacklists'});db[_0xf5d4('0xf3')][_0xf5d4('0x11d')](db[_0xf5d4('0x42')],{});db[_0xf5d4('0xf3')][_0xf5d4('0x11d')](db[_0xf5d4('0x40')],{});db[_0xf5d4('0xf3')]['belongsTo'](db[_0xf5d4('0x3e')],{'foreignKey':_0xf5d4('0x1cd'),'as':_0xf5d4('0x1ce')});db[_0xf5d4('0xf3')]['belongsTo'](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1cf'),'as':_0xf5d4('0x1d0')});db[_0xf5d4('0xf3')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1d1'),'as':_0xf5d4('0x1d2')});db[_0xf5d4('0xf3')][_0xf5d4('0x11d')](db[_0xf5d4('0x12e')],{'foreignKey':_0xf5d4('0x1d3'),'as':_0xf5d4('0x1d4')});db[_0xf5d4('0xf3')][_0xf5d4('0x11d')](db['MailAccount'],{'foreignKey':_0xf5d4('0x1d5'),'as':_0xf5d4('0x1d6')});db['ChatTransferReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x6c')],{});db[_0xf5d4('0x1d7')][_0xf5d4('0x11d')](db[_0xf5d4('0x6a')],{});db[_0xf5d4('0x1d7')]['belongsTo'](db[_0xf5d4('0x137')],{'foreignKey':_0xf5d4('0x1d8'),'as':_0xf5d4('0x1ce')});db[_0xf5d4('0x1d7')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1cf'),'as':_0xf5d4('0x1d0')});db[_0xf5d4('0x1d7')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf5d4('0x1d7')][_0xf5d4('0x11d')](db[_0xf5d4('0x6f')],{'foreignKey':_0xf5d4('0x1d9'),'as':'ToQueue'});db['ChatTransferReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x137')],{'foreignKey':_0xf5d4('0x1da'),'as':_0xf5d4('0x1d6')});db[_0xf5d4('0x1db')][_0xf5d4('0x11d')](db['FaxMessage'],{});db[_0xf5d4('0x1db')][_0xf5d4('0x11d')](db['FaxInteraction'],{});db[_0xf5d4('0x1db')][_0xf5d4('0x11d')](db[_0xf5d4('0x4b')],{'foreignKey':'FromFaxAccountId','as':_0xf5d4('0x1ce')});db[_0xf5d4('0x1db')]['belongsTo'](db[_0xf5d4('0x12')],{'foreignKey':'FromUserId','as':_0xf5d4('0x1d0')});db[_0xf5d4('0x1db')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1d1'),'as':'ToAgent'});db[_0xf5d4('0x1db')][_0xf5d4('0x11d')](db[_0xf5d4('0x51')],{'foreignKey':_0xf5d4('0x1dc'),'as':_0xf5d4('0x1d4')});db['FaxTransferReport']['belongsTo'](db[_0xf5d4('0x4b')],{'foreignKey':'ToFaxAccountId','as':_0xf5d4('0x1d6')});db[_0xf5d4('0xf5')][_0xf5d4('0x11d')](db[_0xf5d4('0x61')],{});db['OpenchannelTransferReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x5f')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xf5d4('0x5c')],{'foreignKey':_0xf5d4('0x1dd'),'as':_0xf5d4('0x1ce')});db[_0xf5d4('0xf5')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1cf'),'as':_0xf5d4('0x1d0')});db['OpenchannelTransferReport'][_0xf5d4('0x11d')](db['User'],{'foreignKey':_0xf5d4('0x1d1'),'as':'ToAgent'});db[_0xf5d4('0xf5')][_0xf5d4('0x11d')](db['OpenchannelQueue'],{'foreignKey':_0xf5d4('0x1de'),'as':_0xf5d4('0x1d4')});db['OpenchannelTransferReport'][_0xf5d4('0x11d')](db['OpenchannelAccount'],{'foreignKey':_0xf5d4('0x1df'),'as':_0xf5d4('0x1d6')});db[_0xf5d4('0xf7')][_0xf5d4('0x11d')](db['SmsMessage'],{});db['SmsTransferReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x56')],{});db[_0xf5d4('0xf7')][_0xf5d4('0x11d')](db[_0xf5d4('0x53')],{'foreignKey':'FromSmsAccountId','as':_0xf5d4('0x1ce')});db['SmsTransferReport'][_0xf5d4('0x11d')](db['User'],{'foreignKey':_0xf5d4('0x1cf'),'as':_0xf5d4('0x1d0')});db[_0xf5d4('0xf7')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1d1'),'as':'ToAgent'});db['SmsTransferReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x5a')],{'foreignKey':_0xf5d4('0x1e0'),'as':_0xf5d4('0x1d4')});db[_0xf5d4('0xf7')][_0xf5d4('0x11d')](db[_0xf5d4('0x53')],{'foreignKey':'ToSmsAccountId','as':_0xf5d4('0x1d6')});db[_0xf5d4('0x124')][_0xf5d4('0x10f')](db[_0xf5d4('0x87')],{'as':_0xf5d4('0x161'),'foreignKey':_0xf5d4('0x165')});db['CmList'][_0xf5d4('0x10f')](db[_0xf5d4('0x80')],{'as':'CustomFields','foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x124')]['hasMany'](db[_0xf5d4('0x77')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x124')]['hasMany'](db['CmHopperFinal'],{'as':_0xf5d4('0x113'),'foreignKey':_0xf5d4('0x165')});db[_0xf5d4('0x124')][_0xf5d4('0x10f')](db[_0xf5d4('0x14d')],{'as':_0xf5d4('0x114'),'foreignKey':'ListId'});db[_0xf5d4('0x124')]['hasMany'](db[_0xf5d4('0x7e')],{'as':_0xf5d4('0x7e'),'foreignKey':'ListId'});db[_0xf5d4('0x124')][_0xf5d4('0x121')](db[_0xf5d4('0x12c')],{'as':_0xf5d4('0x1e1'),'through':_0xf5d4('0x1e2')});db[_0xf5d4('0x124')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x135')});db[_0xf5d4('0xf9')]['hasMany'](db[_0xf5d4('0x17')],{'as':_0xf5d4('0x111'),'onDelete':'cascade'});db[_0xf5d4('0xf9')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x136')});db[_0xf5d4('0xfb')]['hasMany'](db['User'],{'as':_0xf5d4('0x16e'),'foreignKey':'userProfileId'});db['UserProfile']['hasMany'](db[_0xf5d4('0xfd')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xf5d4('0x10d')});db[_0xf5d4('0xfd')][_0xf5d4('0x10f')](db[_0xf5d4('0x1e3')],{'as':_0xf5d4('0x1e4'),'foreignKey':_0xf5d4('0x1e5'),'onDelete':_0xf5d4('0x10d')});db[_0xf5d4('0x142')][_0xf5d4('0x10f')](db['Disposition'],{'as':_0xf5d4('0x161'),'foreignKey':_0xf5d4('0x1e6')});db[_0xf5d4('0x142')][_0xf5d4('0x10f')](db[_0xf5d4('0x85')],{'as':_0xf5d4('0x162'),'foreignKey':_0xf5d4('0x1e6')});db['WhatsappAccount']['hasMany'](db['WhatsappMessage'],{'as':_0xf5d4('0x156'),'foreignKey':_0xf5d4('0x1e6')});db['WhatsappAccount'][_0xf5d4('0x10f')](db[_0xf5d4('0x104')],{'as':_0xf5d4('0x163')});db[_0xf5d4('0x142')][_0xf5d4('0x10f')](db[_0xf5d4('0x102')],{'as':_0xf5d4('0x148')});db[_0xf5d4('0x142')]['belongsTo'](db[_0xf5d4('0x124')],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db['WhatsappAccount'][_0xf5d4('0x11d')](db[_0xf5d4('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf5d4('0x167')});db[_0xf5d4('0x142')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x1e7')});db['WhatsappApplication'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xf5d4('0x11d')](db['WhatsappQueue'],{'onDelete':_0xf5d4('0x172')});db[_0xf5d4('0x102')][_0xf5d4('0x11d')](db[_0xf5d4('0x142')],{'onDelete':_0xf5d4('0x172')});db['WhatsappApplication'][_0xf5d4('0x11d')](db['Interval'],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x173')});db[_0xf5d4('0x102')][_0xf5d4('0x11d')](db[_0xf5d4('0x94')],{'onDelete':_0xf5d4('0x172'),'foreignKey':_0xf5d4('0x174')});db[_0xf5d4('0x104')]['hasMany'](db['WhatsappMessage'],{'as':_0xf5d4('0x156'),'onDelete':_0xf5d4('0x10d'),'foreignKey':_0xf5d4('0x1e8')});db[_0xf5d4('0x104')]['belongsTo'](db[_0xf5d4('0x142')],{'as':_0xf5d4('0x16a'),'foreignKey':_0xf5d4('0x1e6')});db['WhatsappInteraction'][_0xf5d4('0x11d')](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':_0xf5d4('0x15e')});db['WhatsappInteraction'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':'Owner','foreignKey':_0xf5d4('0x10e')});db['WhatsappInteraction'][_0xf5d4('0x121')](db[_0xf5d4('0x94')],{'through':_0xf5d4('0x1a7'),'as':_0xf5d4('0x16c')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0xf5d4('0x1a7'),'as':_0xf5d4('0x180')});db[_0xf5d4('0x104')][_0xf5d4('0x121')](db[_0xf5d4('0x12')],{'as':_0xf5d4('0x16e'),'through':_0xf5d4('0x12b'),'foreignKey':_0xf5d4('0x1e8')});db['WhatsappMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xf5d4('0x10d'),'as':'Contact'});db[_0xf5d4('0x1e9')][_0xf5d4('0x11d')](db['WhatsappInteraction'],{'onDelete':_0xf5d4('0x10d'),'as':_0xf5d4('0x171'),'foreignKey':_0xf5d4('0x1e8')});db['WhatsappMessage'][_0xf5d4('0x11d')](db[_0xf5d4('0x142')],{'as':'Account','foreignKey':_0xf5d4('0x1e6')});db[_0xf5d4('0x107')][_0xf5d4('0x11d')](db['WhatsappAccount'],{});db[_0xf5d4('0x107')][_0xf5d4('0x11d')](db['CmList'],{'as':_0xf5d4('0x164'),'foreignKey':_0xf5d4('0x165')});db['WhatsappQueueReport']['belongsTo'](db[_0xf5d4('0x77')],{'as':_0xf5d4('0x15d'),'foreignKey':'ContactId'});db[_0xf5d4('0x107')]['belongsTo'](db[_0xf5d4('0x104')],{});db[_0xf5d4('0x107')][_0xf5d4('0x11d')](db[_0xf5d4('0x133')],{});db['WhatsappQueueReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x1e9')],{});db[_0xf5d4('0x107')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{});db['WhatsappTransferReport'][_0xf5d4('0x11d')](db['WhatsappMessage'],{});db[_0xf5d4('0x1ea')][_0xf5d4('0x11d')](db[_0xf5d4('0x104')],{});db[_0xf5d4('0x1ea')][_0xf5d4('0x11d')](db[_0xf5d4('0x142')],{'foreignKey':_0xf5d4('0x1eb'),'as':_0xf5d4('0x1ce')});db[_0xf5d4('0x1ea')][_0xf5d4('0x11d')](db['WhatsappAccount'],{'foreignKey':_0xf5d4('0x1ec'),'as':_0xf5d4('0x1d6')});db['WhatsappTransferReport'][_0xf5d4('0x11d')](db[_0xf5d4('0x133')],{'foreignKey':_0xf5d4('0x1ed'),'as':'ToQueue'});db[_0xf5d4('0x1ea')][_0xf5d4('0x11d')](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1cf'),'as':_0xf5d4('0x1d0')});db[_0xf5d4('0x1ea')]['belongsTo'](db[_0xf5d4('0x12')],{'foreignKey':_0xf5d4('0x1d1'),'as':_0xf5d4('0x1d2')});db[_0xf5d4('0x133')][_0xf5d4('0x121')](db['User'],{'as':_0xf5d4('0x168'),'through':_0xf5d4('0x134'),'foreignKey':_0xf5d4('0x1ee')});db[_0xf5d4('0x133')][_0xf5d4('0x121')](db[_0xf5d4('0xe8')],{'through':_0xf5d4('0x1c8'),'as':_0xf5d4('0x169')});module[_0xf5d4('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5eaed3e..1a890fb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','password','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','role','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xe706,0xa3));var _0x6e70=function(_0x26462e,_0x416ff7){_0x26462e=_0x26462e-0x0;var _0x31c3f0=_0xe706[_0x26462e];return _0x31c3f0;};'use strict';var _=require(_0x6e70('0x0'));var path=require(_0x6e70('0x1'));var express=require(_0x6e70('0x2'));var ewinston=require('express-winston');var util=require(_0x6e70('0x3'));var errors=require(_0x6e70('0x4'));var config=require(_0x6e70('0x5'));var logger=require(_0x6e70('0x6'))(_0x6e70('0x7'));var authLogger=require(_0x6e70('0x6'))(_0x6e70('0x8'));exports[_0x6e70('0x9')]=function(_0x1b0389){_0x1b0389[_0x6e70('0xa')](ewinston[_0x6e70('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x293ce7,_0x45a2d4){var _0x188ed3=_0x6e70('0xc');if(!_[_0x6e70('0xd')](_0x293ce7[_0x6e70('0xe')])){_0x188ed3+=_0x6e70('0xf');var _0x100eb7=_0x293ce7[_0x6e70('0xe')];maskSensitiveData(_0x100eb7);}return util[_0x6e70('0x10')](_0x188ed3,_0x293ce7[_0x6e70('0x11')],_0x293ce7[_0x6e70('0x12')][_0x6e70('0x13')]?_0x293ce7['headers']['x-forwarded-for']:_0x293ce7[_0x6e70('0x14')][_0x6e70('0x15')]||_0x293ce7['ip'],_0x293ce7[_0x6e70('0x16')],_0x45a2d4[_0x6e70('0x17')],_0x45a2d4[_0x6e70('0x18')],_0x293ce7[_0x6e70('0x19')]?_0x293ce7[_0x6e70('0x19')]['id']:null,_0x293ce7[_0x6e70('0x19')]?_0x293ce7['user']['name']:null,_0x293ce7['user']?_0x293ce7[_0x6e70('0x19')]['role']:null,_0x100eb7?util['inspect'](_0x100eb7,![],null):'');}}));_0x1b0389[_0x6e70('0xa')](ewinston[_0x6e70('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5d9263,_0x24f3ac){var _0x5c3fe7=_0x6e70('0x1a');if(_0x5d9263[_0x6e70('0xe')]&&_0x5d9263['body']['device']&&_0x5d9263[_0x6e70('0xe')]['agent_id']){_0x5c3fe7=_0x6e70('0x1b');}return util[_0x6e70('0x10')](_0x5c3fe7,_0x5d9263['method'],_0x5d9263['headers'][_0x6e70('0x13')]?_0x5d9263[_0x6e70('0x12')][_0x6e70('0x13')]:_0x5d9263[_0x6e70('0x14')][_0x6e70('0x15')]||_0x5d9263['ip'],_0x5d9263[_0x6e70('0x16')],_0x24f3ac[_0x6e70('0x17')],_0x24f3ac[_0x6e70('0x18')],_0x5d9263[_0x6e70('0x19')]?_0x5d9263[_0x6e70('0x19')]['id']:null,_0x5d9263['user']?_0x5d9263[_0x6e70('0x19')][_0x6e70('0x1c')]:null,_0x5d9263[_0x6e70('0x19')]?_0x5d9263['user'][_0x6e70('0x1d')]:null,_0x5d9263[_0x6e70('0xe')]&&_0x5d9263[_0x6e70('0xe')]['device']?_0x5d9263[_0x6e70('0xe')]['device']:'other',_0x5d9263['body']&&_0x5d9263[_0x6e70('0xe')][_0x6e70('0x1e')]?_0x5d9263['body'][_0x6e70('0x1e')]:'',_0x5d9263[_0x6e70('0xe')]&&_0x5d9263['body'][_0x6e70('0x1f')]?_0x5d9263[_0x6e70('0xe')][_0x6e70('0x1f')]:'');},'ignoreRoute':function(_0x4a67ac){var _0x54a5fe=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x54a5fe[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x16')]);}}));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x21'),require(_0x6e70('0x22')));_0x1b0389['use'](_0x6e70('0x23'),require(_0x6e70('0x24')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x25'),require(_0x6e70('0x26')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x27'),require(_0x6e70('0x28')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x29'),require('./api/voiceMusicOnHold'));_0x1b0389[_0x6e70('0xa')]('/api/voice/queues',require(_0x6e70('0x2a')));_0x1b0389['use'](_0x6e70('0x2b'),require(_0x6e70('0x2c')));_0x1b0389[_0x6e70('0xa')]('/api/screen/recordings',require(_0x6e70('0x2d')));_0x1b0389[_0x6e70('0xa')]('/api/voice/mails',require(_0x6e70('0x2e')));_0x1b0389[_0x6e70('0xa')]('/api/voice/mails/messages',require(_0x6e70('0x2f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x30'),require(_0x6e70('0x31')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x32'),require(_0x6e70('0x33')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x34'),require(_0x6e70('0x35')));_0x1b0389['use'](_0x6e70('0x36'),require('./api/voiceQueueReport'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x37'),require(_0x6e70('0x38')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x39'),require(_0x6e70('0x3a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x3b'),require(_0x6e70('0x3c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x3d'),require(_0x6e70('0x3e')));_0x1b0389[_0x6e70('0xa')]('/api/mail/accounts',require('./api/mailAccount'));_0x1b0389['use'](_0x6e70('0x3f'),require(_0x6e70('0x40')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x41'),require(_0x6e70('0x42')));_0x1b0389[_0x6e70('0xa')]('/api/mail/interactions',require(_0x6e70('0x43')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x44'),require(_0x6e70('0x45')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x46'),require(_0x6e70('0x47')));_0x1b0389[_0x6e70('0xa')]('/api/mail/reports/queue',require(_0x6e70('0x48')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x49'),require(_0x6e70('0x4a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4b'),require(_0x6e70('0x4c')));_0x1b0389['use']('/api/fax/accounts',require('./api/faxAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4d'),require(_0x6e70('0x4e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4f'),require('./api/faxInteraction'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x50'),require(_0x6e70('0x51')));_0x1b0389['use']('/api/fax/queues',require('./api/faxQueue'));_0x1b0389[_0x6e70('0xa')]('/api/fax/reports/queue',require(_0x6e70('0x52')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x53'),require(_0x6e70('0x54')));_0x1b0389['use'](_0x6e70('0x55'),require('./api/smsApplication'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x56'),require(_0x6e70('0x57')));_0x1b0389[_0x6e70('0xa')]('/api/sms/messages',require(_0x6e70('0x58')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x59'),require(_0x6e70('0x5a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x5b'),require(_0x6e70('0x5c')));_0x1b0389['use'](_0x6e70('0x5d'),require(_0x6e70('0x5e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x5f'),require(_0x6e70('0x60')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x61'),require('./api/openchannelMessage'));_0x1b0389[_0x6e70('0xa')]('/api/openchannel/queues',require(_0x6e70('0x62')));_0x1b0389[_0x6e70('0xa')]('/api/chat/websites',require('./api/chatWebsite'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x63'),require(_0x6e70('0x64')));_0x1b0389['use']('/api/chat/applications',require(_0x6e70('0x65')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x66'),require(_0x6e70('0x67')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x68'),require('./api/chatMessage'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x69'),require(_0x6e70('0x6a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x6b'),require('./api/chatQueue'));_0x1b0389['use'](_0x6e70('0x6c'),require(_0x6e70('0x6d')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x6e'),require(_0x6e70('0x6f')));_0x1b0389['use'](_0x6e70('0x70'),require(_0x6e70('0x71')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x72'),require(_0x6e70('0x73')));_0x1b0389['use'](_0x6e70('0x74'),require(_0x6e70('0x75')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x76'),require(_0x6e70('0x77')));_0x1b0389[_0x6e70('0xa')]('/api/cm/hopper_final',require(_0x6e70('0x78')));_0x1b0389[_0x6e70('0xa')]('/api/cm/hopper_history',require(_0x6e70('0x79')));_0x1b0389[_0x6e70('0xa')]('/api/cm/custom_fields',require(_0x6e70('0x7a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x7b'),require(_0x6e70('0x7c')));_0x1b0389[_0x6e70('0xa')]('/api/automations',require(_0x6e70('0x7d')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x7e'),require(_0x6e70('0x7f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x80'),require(_0x6e70('0x81')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x82'),require(_0x6e70('0x83')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x84'),require(_0x6e70('0x85')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x86'),require(_0x6e70('0x87')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x88'),require(_0x6e70('0x89')));_0x1b0389[_0x6e70('0xa')]('/api/voiceQueuesLog',require(_0x6e70('0x8a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8b'),require(_0x6e70('0x8c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8d'),require('./api/sound'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8e'),require('./api/tag'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8f'),require(_0x6e70('0x90')));_0x1b0389['use']('/api/triggers',require(_0x6e70('0x91')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x92'),require(_0x6e70('0x93')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x94'),require(_0x6e70('0x95')));_0x1b0389['use']('/api/integrations/reports',require(_0x6e70('0x96')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x97'),require(_0x6e70('0x98')));_0x1b0389['use']('/api/analytics/default_reports',require(_0x6e70('0x99')));_0x1b0389[_0x6e70('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x1b0389[_0x6e70('0xa')]('/api/analytics/metrics',require(_0x6e70('0x9a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x9b'),require(_0x6e70('0x9c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x9d'),require(_0x6e70('0x9e')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/salesforce/accounts',require(_0x6e70('0x9f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa0'),require(_0x6e70('0xa1')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x1b0389['use'](_0x6e70('0xa2'),require(_0x6e70('0xa3')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa4'),require(_0x6e70('0xa5')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa6'),require(_0x6e70('0xa7')));_0x1b0389['use'](_0x6e70('0xa8'),require(_0x6e70('0xa9')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xaa'),require('./api/intDeskField'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xab'),require(_0x6e70('0xac')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xad'),require(_0x6e70('0xae')));_0x1b0389['use'](_0x6e70('0xaf'),require(_0x6e70('0xb0')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb1'),require(_0x6e70('0xb2')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb3'),require(_0x6e70('0xb4')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb5'),require('./api/intFreshdeskAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb6'),require(_0x6e70('0xb7')));_0x1b0389['use']('/api/integrations/freshdesk/fields',require(_0x6e70('0xb8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb9'),require(_0x6e70('0xba')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbb'),require('./api/intVtigerField'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbc'),require(_0x6e70('0xbd')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbe'),require(_0x6e70('0xbf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc0'),require(_0x6e70('0xc1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc2'),require(_0x6e70('0xc3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc4'),require('./api/intDynamics365Configuration'));_0x1b0389['use'](_0x6e70('0xc5'),require('./api/intDynamics365Field'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc6'),require(_0x6e70('0xc7')));_0x1b0389['use']('/api/networks',require('./api/network'));_0x1b0389[_0x6e70('0xa')]('/api/chat/reports/queue',require(_0x6e70('0xc8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc9'),require(_0x6e70('0xca')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xcb'),require(_0x6e70('0xcc')));_0x1b0389['use'](_0x6e70('0xcd'),require(_0x6e70('0xce')));_0x1b0389[_0x6e70('0xa')]('/api/jscripty/sessions/reports',require(_0x6e70('0xcf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd0'),require(_0x6e70('0xd1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd2'),require(_0x6e70('0xd3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd4'),require('./api/squareReportDetail'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd5'),require('./api/jscriptyProject'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd6'),require('./api/setting'));_0x1b0389['use'](_0x6e70('0xd7'),require('./api/squareOdbc'));_0x1b0389[_0x6e70('0xa')]('/api/square/projects',require(_0x6e70('0xd8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd9'),require(_0x6e70('0xda')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xdb'),require(_0x6e70('0xdc')));_0x1b0389['use']('/api/teams',require(_0x6e70('0xdd')));_0x1b0389['use'](_0x6e70('0xde'),require(_0x6e70('0xdf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe0'),require('./api/campaign'));_0x1b0389[_0x6e70('0xa')]('/api/migrations',require(_0x6e70('0xe1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe2'),require(_0x6e70('0xe3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe4'),require(_0x6e70('0xe5')));_0x1b0389['use'](_0x6e70('0xe6'),require('./api/mailTransferReport'));_0x1b0389[_0x6e70('0xa')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1b0389['use'](_0x6e70('0xe7'),require(_0x6e70('0xe8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe9'),require(_0x6e70('0xea')));_0x1b0389['use'](_0x6e70('0xeb'),require(_0x6e70('0xec')));_0x1b0389['use'](_0x6e70('0xed'),require('./api/cmList'));_0x1b0389[_0x6e70('0xa')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xee'),require(_0x6e70('0xef')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf0'),require(_0x6e70('0xf1')));_0x1b0389[_0x6e70('0xa')]('/api/userProfile/resources',require(_0x6e70('0xf2')));_0x1b0389['use'](_0x6e70('0xf3'),require(_0x6e70('0xf4')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf5'),require(_0x6e70('0xf6')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf7'),require('./api/whatsappApplication'));_0x1b0389[_0x6e70('0xa')]('/api/whatsapp/interactions',require(_0x6e70('0xf8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf9'),require(_0x6e70('0xfa')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xfb'),require(_0x6e70('0xfc')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xfd'),require(_0x6e70('0xfe')));_0x1b0389['use'](_0x6e70('0xff'),require(_0x6e70('0x100')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x101'),require(_0x6e70('0x102')));_0x1b0389['use']('/api/auth/local',require('./api/authLocal'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x103'),require(_0x6e70('0x104')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x105'),require(_0x6e70('0x106')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x107'),require(_0x6e70('0x108')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x109'),require(_0x6e70('0x10a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x10b'),require(_0x6e70('0x10c')));_0x1b0389['use'](_0x6e70('0x10d'),require(_0x6e70('0x10e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x10f'),require(_0x6e70('0x110')));_0x1b0389[_0x6e70('0xa')]('/apidoc',express['static'](path[_0x6e70('0x111')](config[_0x6e70('0x112')],_0x6e70('0x113'))));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x114'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config['root'],_0x6e70('0x114'))));_0x1b0389['use'](_0x6e70('0x116'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config[_0x6e70('0x112')],'/demo')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x117'),express['static'](path[_0x6e70('0x111')](config['root'],_0x6e70('0x118'),'1.0.16')));_0x1b0389['use'](_0x6e70('0x119'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config['root'],_0x6e70('0x11a'))));_0x1b0389[_0x6e70('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6e70('0x11c')](errors[0x194]);_0x1b0389[_0x6e70('0x11b')]('/*')[_0x6e70('0x11c')](function(_0x2d08f2,_0xb2d064){_0xb2d064[_0x6e70('0x11d')](path[_0x6e70('0x11e')](_0x1b0389[_0x6e70('0x11c')](_0x6e70('0x11f'))+'/index.html'));});};var sensitiveFields=['username',_0x6e70('0x120'),'newPassword',_0x6e70('0x121'),_0x6e70('0x122'),'lastName',_0x6e70('0x123'),_0x6e70('0x124'),_0x6e70('0x125'),'fax',_0x6e70('0x126'),_0x6e70('0x127'),_0x6e70('0x128'),_0x6e70('0x129'),_0x6e70('0x12a'),_0x6e70('0x12b'),_0x6e70('0x12c'),_0x6e70('0x12d'),_0x6e70('0x12e'),_0x6e70('0x12f'),_0x6e70('0x130'),_0x6e70('0x131'),_0x6e70('0x132'),'consumerSecret',_0x6e70('0x133'),_0x6e70('0x134'),_0x6e70('0x135'),_0x6e70('0x136'),_0x6e70('0x137'),'clientEmail',_0x6e70('0x138'),_0x6e70('0x139'),_0x6e70('0x13a'),'key',_0x6e70('0x19'),'pass','accountSid',_0x6e70('0x13b'),_0x6e70('0x13c'),_0x6e70('0x13d'),_0x6e70('0x13e'),'oldPassword'];function maskSensitiveData(_0x39e14f){var _0x41bd51=/(?!^)[\s\S](?!$)/g;for(var _0x5a20ac in _0x39e14f){if(_['isArray'](_0x39e14f[_0x5a20ac])){for(var _0x48571f=0x0;_0x48571f<_0x39e14f[_0x5a20ac][_0x6e70('0x13f')];_0x48571f++){maskSensitiveData(_0x39e14f[_0x5a20ac][_0x48571f]);}}else if(_[_0x6e70('0x140')](_0x39e14f[_0x5a20ac])){maskSensitiveData(_0x39e14f[_0x5a20ac]);}else if(_[_0x6e70('0x141')](_0x39e14f[_0x5a20ac])){_0x39e14f[_0x5a20ac]=_0x39e14f[_0x5a20ac][_0x6e70('0x142')](/{{{/g,_0x6e70('0x143'))[_0x6e70('0x142')](/}}}/g,_0x6e70('0x144'))['replace'](/{{/g,'@{')[_0x6e70('0x142')](/}}/g,'}@');if(_[_0x6e70('0x145')](sensitiveFields,_0x5a20ac)){_0x39e14f[_0x5a20ac]=_0x39e14f[_0x5a20ac][_0x6e70('0x142')](_0x41bd51,'*');}}}} \ No newline at end of file +var _0xbaf0=['name','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','root','/apidoc','join','/www','/demo','1.0.16','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','newPassword','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','oldPassword','isArray','isPlainObject','replace','}@@','includes','path','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','statusCode','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','url'];(function(_0x399bfc,_0x36d4b0){var _0x36846d=function(_0x1465bc){while(--_0x1465bc){_0x399bfc['push'](_0x399bfc['shift']());}};_0x36846d(++_0x36d4b0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var path=require(_0x0baf('0x0'));var express=require(_0x0baf('0x1'));var ewinston=require(_0x0baf('0x2'));var util=require(_0x0baf('0x3'));var errors=require(_0x0baf('0x4'));var config=require(_0x0baf('0x5'));var logger=require('./config/logger')(_0x0baf('0x6'));var authLogger=require(_0x0baf('0x7'))(_0x0baf('0x8'));exports[_0x0baf('0x9')]=function(_0xe4c3c4){_0xe4c3c4[_0x0baf('0xa')](ewinston[_0x0baf('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2dcaac,_0x1d0a0d){var _0x5f5030=_0x0baf('0xc');if(!_['isEmpty'](_0x2dcaac[_0x0baf('0xd')])){_0x5f5030+=_0x0baf('0xe');var _0x465528=_0x2dcaac[_0x0baf('0xd')];maskSensitiveData(_0x465528);}return util[_0x0baf('0xf')](_0x5f5030,_0x2dcaac[_0x0baf('0x10')],_0x2dcaac[_0x0baf('0x11')][_0x0baf('0x12')]?_0x2dcaac[_0x0baf('0x11')][_0x0baf('0x12')]:_0x2dcaac[_0x0baf('0x13')]['remoteAddress']||_0x2dcaac['ip'],_0x2dcaac['url'],_0x1d0a0d[_0x0baf('0x14')],_0x1d0a0d[_0x0baf('0x15')],_0x2dcaac[_0x0baf('0x16')]?_0x2dcaac[_0x0baf('0x16')]['id']:null,_0x2dcaac['user']?_0x2dcaac[_0x0baf('0x16')]['name']:null,_0x2dcaac[_0x0baf('0x16')]?_0x2dcaac[_0x0baf('0x16')][_0x0baf('0x17')]:null,_0x465528?util[_0x0baf('0x18')](_0x465528,![],null):'');}}));_0xe4c3c4[_0x0baf('0xa')](ewinston[_0x0baf('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4f80a8,_0x4cd79d){var _0x2312c7=_0x0baf('0x19');if(_0x4f80a8[_0x0baf('0xd')]&&_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x1a')]&&_0x4f80a8[_0x0baf('0xd')]['agent_id']){_0x2312c7=_0x0baf('0x1b');}return util[_0x0baf('0xf')](_0x2312c7,_0x4f80a8[_0x0baf('0x10')],_0x4f80a8[_0x0baf('0x11')][_0x0baf('0x12')]?_0x4f80a8[_0x0baf('0x11')]['x-forwarded-for']:_0x4f80a8['connection'][_0x0baf('0x1c')]||_0x4f80a8['ip'],_0x4f80a8[_0x0baf('0x1d')],_0x4cd79d[_0x0baf('0x14')],_0x4cd79d[_0x0baf('0x15')],_0x4f80a8[_0x0baf('0x16')]?_0x4f80a8[_0x0baf('0x16')]['id']:null,_0x4f80a8[_0x0baf('0x16')]?_0x4f80a8[_0x0baf('0x16')][_0x0baf('0x1e')]:null,_0x4f80a8[_0x0baf('0x16')]?_0x4f80a8['user'][_0x0baf('0x17')]:null,_0x4f80a8['body']&&_0x4f80a8[_0x0baf('0xd')]['device']?_0x4f80a8['body'][_0x0baf('0x1a')]:'other',_0x4f80a8['body']&&_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x1f')]?_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x1f')]:'',_0x4f80a8[_0x0baf('0xd')]&&_0x4f80a8['body'][_0x0baf('0x20')]?_0x4f80a8[_0x0baf('0xd')][_0x0baf('0x20')]:'');},'ignoreRoute':function(_0x366e71){var _0x3843b8=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3843b8[_0x0baf('0x21')](_0x366e71[_0x0baf('0x1d')]);}}));_0xe4c3c4['use'](_0x0baf('0x22'),require(_0x0baf('0x23')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x24'),require('./api/voiceChanSpy'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x25'),require('./api/voiceContext'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x26'),require(_0x0baf('0x27')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x28'),require(_0x0baf('0x29')));_0xe4c3c4[_0x0baf('0xa')]('/api/voice/queues',require(_0x0baf('0x2a')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x2b'),require(_0x0baf('0x2c')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x2d'),require(_0x0baf('0x2e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x2f'),require(_0x0baf('0x30')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x31'),require(_0x0baf('0x32')));_0xe4c3c4[_0x0baf('0xa')]('/api/voice/calls/reports',require(_0x0baf('0x33')));_0xe4c3c4['use'](_0x0baf('0x34'),require(_0x0baf('0x35')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x36'),require('./api/voiceAgentReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x37'),require('./api/voiceQueueReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x38'),require(_0x0baf('0x39')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3a'),require(_0x0baf('0x3b')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3c'),require('./api/voiceTransferReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3d'),require('./api/mailServerOut'));_0xe4c3c4[_0x0baf('0xa')]('/api/mail/accounts',require('./api/mailAccount'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x3e'),require('./api/mailQueue'));_0xe4c3c4['use'](_0x0baf('0x3f'),require(_0x0baf('0x40')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x41'),require(_0x0baf('0x42')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x43'),require(_0x0baf('0x44')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x45'),require(_0x0baf('0x46')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x47'),require(_0x0baf('0x48')));_0xe4c3c4['use'](_0x0baf('0x49'),require(_0x0baf('0x4a')));_0xe4c3c4['use'](_0x0baf('0x4b'),require(_0x0baf('0x4c')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x4d'),require(_0x0baf('0x4e')));_0xe4c3c4[_0x0baf('0xa')]('/api/fax/applications',require(_0x0baf('0x4f')));_0xe4c3c4[_0x0baf('0xa')]('/api/fax/interactions',require(_0x0baf('0x50')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x51'),require(_0x0baf('0x52')));_0xe4c3c4['use'](_0x0baf('0x53'),require(_0x0baf('0x54')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x55'),require(_0x0baf('0x56')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x57'),require(_0x0baf('0x58')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x59'),require('./api/smsApplication'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5a'),require(_0x0baf('0x5b')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5c'),require('./api/smsMessage'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5d'),require(_0x0baf('0x5e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x5f'),require('./api/openchannelAccount'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x60'),require(_0x0baf('0x61')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x62'),require(_0x0baf('0x63')));_0xe4c3c4[_0x0baf('0xa')]('/api/openchannel/messages',require(_0x0baf('0x64')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x65'),require('./api/openchannelQueue'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x66'),require(_0x0baf('0x67')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x68'),require(_0x0baf('0x69')));_0xe4c3c4[_0x0baf('0xa')]('/api/chat/applications',require(_0x0baf('0x6a')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x6b'),require(_0x0baf('0x6c')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x6d'),require(_0x0baf('0x6e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x6f'),require(_0x0baf('0x70')));_0xe4c3c4[_0x0baf('0xa')]('/api/chat/queues',require('./api/chatQueue'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x71'),require(_0x0baf('0x72')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x73'),require(_0x0baf('0x74')));_0xe4c3c4[_0x0baf('0xa')]('/api/cm/companies',require(_0x0baf('0x75')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x76'),require(_0x0baf('0x77')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x78'),require('./api/cmHopper'));_0xe4c3c4[_0x0baf('0xa')]('/api/cm/hopper_black',require(_0x0baf('0x79')));_0xe4c3c4['use'](_0x0baf('0x7a'),require('./api/cmHopperFinal'));_0xe4c3c4[_0x0baf('0xa')]('/api/cm/hopper_history',require(_0x0baf('0x7b')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x7c'),require(_0x0baf('0x7d')));_0xe4c3c4[_0x0baf('0xa')]('/api/actions',require(_0x0baf('0x7e')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x7f'),require(_0x0baf('0x80')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x81'),require('./api/cannedAnswer'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x82'),require(_0x0baf('0x83')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x84'),require(_0x0baf('0x85')));_0xe4c3c4[_0x0baf('0xa')]('/api/intervals',require('./api/interval'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x86'),require(_0x0baf('0x87')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x88'),require(_0x0baf('0x89')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x8a'),require(_0x0baf('0x8b')));_0xe4c3c4['use'](_0x0baf('0x8c'),require(_0x0baf('0x8d')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x8e'),require(_0x0baf('0x8f')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x90'),require('./api/tag'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x91'),require(_0x0baf('0x92')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x93'),require(_0x0baf('0x94')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x95'),require('./api/variable'));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations',require(_0x0baf('0x96')));_0xe4c3c4['use']('/api/integrations/reports',require(_0x0baf('0x97')));_0xe4c3c4['use'](_0x0baf('0x98'),require(_0x0baf('0x99')));_0xe4c3c4['use'](_0x0baf('0x9a'),require(_0x0baf('0x9b')));_0xe4c3c4[_0x0baf('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x9c'),require(_0x0baf('0x9d')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x9e'),require('./api/analyticFieldReport'));_0xe4c3c4[_0x0baf('0xa')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0xe4c3c4['use'](_0x0baf('0x9f'),require('./api/intSalesforceAccount'));_0xe4c3c4['use'](_0x0baf('0xa0'),require(_0x0baf('0xa1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa2'),require(_0x0baf('0xa3')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/sugarcrm/accounts',require(_0x0baf('0xa4')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa5'),require(_0x0baf('0xa6')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa7'),require('./api/intSugarcrmField'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xa8'),require(_0x0baf('0xa9')));_0xe4c3c4['use'](_0x0baf('0xaa'),require(_0x0baf('0xab')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xac'),require(_0x0baf('0xad')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xae'),require('./api/intZohoAccount'));_0xe4c3c4['use']('/api/integrations/zoho/configurations',require(_0x0baf('0xaf')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb0'),require(_0x0baf('0xb1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb2'),require('./api/intZendeskAccount'));_0xe4c3c4['use'](_0x0baf('0xb3'),require('./api/intZendeskConfiguration'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb4'),require('./api/intZendeskField'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb5'),require(_0x0baf('0xb6')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb7'),require(_0x0baf('0xb8')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb9'),require(_0x0baf('0xba')));_0xe4c3c4['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0xe4c3c4['use']('/api/integrations/vtiger/configurations',require(_0x0baf('0xbb')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xbc'),require(_0x0baf('0xbd')));_0xe4c3c4['use'](_0x0baf('0xbe'),require(_0x0baf('0xbf')));_0xe4c3c4['use']('/api/integrations/servicenow/configurations',require(_0x0baf('0xc0')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xc1'),require(_0x0baf('0xc2')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xc3'),require(_0x0baf('0xc4')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/dynamics365/configurations',require(_0x0baf('0xc5')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/dynamics365/fields',require(_0x0baf('0xc6')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/freshsales/accounts',require(_0x0baf('0xc7')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xc8'),require(_0x0baf('0xc9')));_0xe4c3c4[_0x0baf('0xa')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xca'),require('./api/network'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xcb'),require(_0x0baf('0xcc')));_0xe4c3c4['use'](_0x0baf('0xcd'),require(_0x0baf('0xce')));_0xe4c3c4[_0x0baf('0xa')]('/api/jscripty/answers/reports',require(_0x0baf('0xcf')));_0xe4c3c4['use'](_0x0baf('0xd0'),require(_0x0baf('0xd1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xd2'),require(_0x0baf('0xd3')));_0xe4c3c4['use'](_0x0baf('0xd4'),require(_0x0baf('0xd5')));_0xe4c3c4['use'](_0x0baf('0xd6'),require(_0x0baf('0xd7')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xd8'),require(_0x0baf('0xd9')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xda'),require(_0x0baf('0xdb')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xdc'),require(_0x0baf('0xdd')));_0xe4c3c4[_0x0baf('0xa')]('/api/square/odbc',require('./api/squareOdbc'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xde'),require(_0x0baf('0xdf')));_0xe4c3c4['use']('/api/square/recordings',require(_0x0baf('0xe0')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe1'),require(_0x0baf('0xe2')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe3'),require(_0x0baf('0xe4')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe5'),require('./api/license'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xe6'),require(_0x0baf('0xe7')));_0xe4c3c4[_0x0baf('0xa')]('/api/migrations',require('./api/migration'));_0xe4c3c4['use'](_0x0baf('0xe8'),require(_0x0baf('0xe9')));_0xe4c3c4['use']('/api/plugins',require(_0x0baf('0xea')));_0xe4c3c4[_0x0baf('0xa')]('/api/mail/reports/transfer',require(_0x0baf('0xeb')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xec'),require(_0x0baf('0xed')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xee'),require(_0x0baf('0xef')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf0'),require(_0x0baf('0xf1')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf2'),require('./api/smsTransferReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf3'),require(_0x0baf('0xf4')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf5'),require(_0x0baf('0xf6')));_0xe4c3c4['use'](_0x0baf('0xf7'),require(_0x0baf('0xf8')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xf9'),require(_0x0baf('0xfa')));_0xe4c3c4['use'](_0x0baf('0xfb'),require(_0x0baf('0xfc')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xfd'),require(_0x0baf('0xfe')));_0xe4c3c4['use']('/api/whatsapp/accounts',require(_0x0baf('0xff')));_0xe4c3c4['use'](_0x0baf('0x100'),require('./api/whatsappApplication'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x101'),require(_0x0baf('0x102')));_0xe4c3c4[_0x0baf('0xa')]('/api/whatsapp/messages',require(_0x0baf('0x103')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x104'),require('./api/whatsappQueueReport'));_0xe4c3c4['use']('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x105'),require(_0x0baf('0x106')));_0xe4c3c4[_0x0baf('0xa')]('/api/cloudProviders',require(_0x0baf('0x107')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x108'),require('./api/authLocal'));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x109'),require('./api/authGoogle'));_0xe4c3c4[_0x0baf('0xa')]('/api/jira',require(_0x0baf('0x10a')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x10b'),require(_0x0baf('0x10c')));_0xe4c3c4['use']('/api/version',require(_0x0baf('0x10d')));_0xe4c3c4['use'](_0x0baf('0x10e'),require(_0x0baf('0x10f')));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x110'),require(_0x0baf('0x111')));_0xe4c3c4['use'](_0x0baf('0x112'),require('./api/webbar'));_0xe4c3c4[_0x0baf('0xa')]('/apidoc',express[_0x0baf('0x113')](path['join'](config[_0x0baf('0x114')],_0x0baf('0x115'))));_0xe4c3c4[_0x0baf('0xa')]('/www',express['static'](path[_0x0baf('0x116')](config[_0x0baf('0x114')],_0x0baf('0x117'))));_0xe4c3c4[_0x0baf('0xa')](_0x0baf('0x118'),express[_0x0baf('0x113')](path['join'](config[_0x0baf('0x114')],'/demo')));_0xe4c3c4[_0x0baf('0xa')]('/snippet',express[_0x0baf('0x113')](path[_0x0baf('0x116')](config[_0x0baf('0x114')],'snippet',_0x0baf('0x119'))));_0xe4c3c4[_0x0baf('0xa')]('/plugins',express['static'](path[_0x0baf('0x116')](config[_0x0baf('0x114')],_0x0baf('0x11a'))));_0xe4c3c4[_0x0baf('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0xe4c3c4[_0x0baf('0x11b')]('/*')[_0x0baf('0x11c')](function(_0x116d52,_0x2c7417){_0x2c7417[_0x0baf('0x11d')](path[_0x0baf('0x11e')](_0xe4c3c4[_0x0baf('0x11c')](_0x0baf('0x11f'))+_0x0baf('0x120')));});};var sensitiveFields=[_0x0baf('0x121'),'password',_0x0baf('0x122'),'apiKey',_0x0baf('0x123'),_0x0baf('0x124'),_0x0baf('0x125'),_0x0baf('0x126'),'mobile',_0x0baf('0x127'),_0x0baf('0x128'),_0x0baf('0x129'),_0x0baf('0x12a'),_0x0baf('0x12b'),_0x0baf('0x12c'),_0x0baf('0x12d'),_0x0baf('0x12e'),_0x0baf('0x12f'),'channelSecret',_0x0baf('0x130'),_0x0baf('0x131'),'authToken',_0x0baf('0x132'),_0x0baf('0x133'),_0x0baf('0x134'),_0x0baf('0x135'),_0x0baf('0x136'),_0x0baf('0x137'),_0x0baf('0x138'),_0x0baf('0x139'),_0x0baf('0x13a'),'accesskeyid',_0x0baf('0x13b'),_0x0baf('0x13c'),_0x0baf('0x16'),_0x0baf('0x13d'),_0x0baf('0x13e'),_0x0baf('0x13f'),'dsn',_0x0baf('0x140'),_0x0baf('0x141'),_0x0baf('0x142')];function maskSensitiveData(_0x5c1760){var _0x49855a=/(?!^)[\s\S](?!$)/g;for(var _0x5adbd9 in _0x5c1760){if(_[_0x0baf('0x143')](_0x5c1760[_0x5adbd9])){for(var _0x30896e=0x0;_0x30896e<_0x5c1760[_0x5adbd9]['length'];_0x30896e++){maskSensitiveData(_0x5c1760[_0x5adbd9][_0x30896e]);}}else if(_[_0x0baf('0x144')](_0x5c1760[_0x5adbd9])){maskSensitiveData(_0x5c1760[_0x5adbd9]);}else if(_['isString'](_0x5c1760[_0x5adbd9])){_0x5c1760[_0x5adbd9]=_0x5c1760[_0x5adbd9][_0x0baf('0x145')](/{{{/g,'@@{')[_0x0baf('0x145')](/}}}/g,_0x0baf('0x146'))['replace'](/{{/g,'@{')[_0x0baf('0x145')](/}}/g,'}@');if(_[_0x0baf('0x147')](sensitiveFields,_0x5adbd9)){_0x5c1760[_0x5adbd9]=_0x5c1760[_0x5adbd9][_0x0baf('0x145')](_0x49855a,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 600e48f..23d7095 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x254d=['default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','../config/triggers'];(function(_0x4a4843,_0xc50562){var _0x53a3e8=function(_0x17de51){while(--_0x17de51){_0x4a4843['push'](_0x4a4843['shift']());}};_0x53a3e8(++_0xc50562);}(_0x254d,0x174));var _0xd254=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x254d[_0x12b683];return _0xfb150b;};'use strict';var jayson=require(_0xd254('0x0'));var BPromise=require(_0xd254('0x1'));var _=require('lodash');var config=require(_0xd254('0x2'));exports[_0xd254('0x3')]=function(){return new BPromise(function(_0x49dc80,_0x5267e2){var _0x43569c={};_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x5')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x6')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/voiceQueue/voiceQueue.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x7')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x8')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x9')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xa')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0xb')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xc')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xd')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xe')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xf')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x10')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/mailQueue/mailQueue.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x11')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x12')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x13')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x14')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x15')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x16')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/faxInteraction/faxInteraction.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x17')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x18')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x19')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1a')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1b')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/smsMessage/smsMessage.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1c')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1d')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x1e')));_0x43569c=_['merge'](_0x43569c,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1f')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x20')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/chatMessage/chatMessage.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x21')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x22')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/cmHopper/cmHopper.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x23')));_0x43569c=_['merge'](_0x43569c,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x24')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x25')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x26')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x27')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/sound/sound.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x28')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x29')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/variable/variable.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2a')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2b')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2c')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2d')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2e')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2f')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x30')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x31')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x32')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x33')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x34')));_0x43569c=_['merge'](_0x43569c,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x35')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x36')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x37')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x38')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x39')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3a')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x3b')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3c')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3d')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3e')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3f')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x40')));var _0x2372a5=jayson[_0xd254('0x41')](_0x43569c)[_0xd254('0x42')]();var _0x37166a=config[_0xd254('0x43')][_0xd254('0x44')]||config['port']+0x1;var _0x797485=config[_0xd254('0x43')]['ip']||_0xd254('0x45');_0x2372a5['on']('error',function(_0x462be5){return _0x5267e2(_0x462be5);});_0x2372a5[_0xd254('0x3')](_0x37166a,_0x797485,function(){console[_0xd254('0x46')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x797485,_0x37166a);require(_0xd254('0x47'))[_0xd254('0x48')]();return _0x49dc80(_0xd254('0x49')+_0x797485+':'+_0x37166a);});});}; \ No newline at end of file +var _0x5ca6=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x5ca6,0xbe));var _0x65ca=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x5ca6[_0x585d81];return _0x1aca0d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x65ca('0x0'));var _=require(_0x65ca('0x1'));var config=require(_0x65ca('0x2'));exports[_0x65ca('0x3')]=function(){return new BPromise(function(_0x27c4ac,_0xfff78e){var _0x10f5b8={};_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x5')));_0x10f5b8=_['merge'](_0x10f5b8,require('../api/voiceExtension/voiceExtension.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x6')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x7')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x8')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x9')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0xa')));_0x10f5b8=_['merge'](_0x10f5b8,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0xb')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0xc')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0xd')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0xe')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0xf')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x10')));_0x10f5b8=_['merge'](_0x10f5b8,require('../api/mailQueue/mailQueue.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x11')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x12')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/mailApplication/mailApplication.rpc'));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x13')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x14')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x15')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x16')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x17')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x18')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x19')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/smsAccount/smsAccount.rpc'));_0x10f5b8=_['merge'](_0x10f5b8,require('../api/smsInteraction/smsInteraction.rpc'));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x1a')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x1b')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x1c')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x1d')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x1e')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x1f')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x20')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x21')));_0x10f5b8=_['merge'](_0x10f5b8,require('../api/chatQueue/chatQueue.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x22')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x23')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x24')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x25')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x26')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/pause/pause.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x27')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/template/template.rpc'));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x28')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x29')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x2a')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x2b')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x2c')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x2d')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x2e')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x2f')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x30')));_0x10f5b8=_['merge'](_0x10f5b8,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x31')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x32')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x33')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x34')));_0x10f5b8=_['merge'](_0x10f5b8,require('../api/squareOdbc/squareOdbc.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x35')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x36')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x37')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x38')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x39')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require('../api/plugin/plugin.rpc'));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x3a')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x3b')));_0x10f5b8=_['merge'](_0x10f5b8,require(_0x65ca('0x3c')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x3d')));_0x10f5b8=_[_0x65ca('0x4')](_0x10f5b8,require(_0x65ca('0x3e')));var _0x183f3a=jayson[_0x65ca('0x3f')](_0x10f5b8)[_0x65ca('0x40')]();var _0x1ee48b=config[_0x65ca('0x41')]['port']||config[_0x65ca('0x42')]+0x1;var _0x4531aa=config[_0x65ca('0x41')]['ip']||_0x65ca('0x43');_0x183f3a['on'](_0x65ca('0x44'),function(_0x1936a8){return _0xfff78e(_0x1936a8);});_0x183f3a['listen'](_0x1ee48b,_0x4531aa,function(){console['log'](_0x65ca('0x45'),_0x4531aa,_0x1ee48b);require(_0x65ca('0x46'))[_0x65ca('0x47')]();return _0x27c4ac(_0x65ca('0x48')+_0x4531aa+':'+_0x1ee48b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 15c3b91..712ea97 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(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xcb91[_0x29e35f];return _0x266b74;};'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 _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x3a4106,_0x4f3e6a){var _0x5ec264=function(_0x4f1aa2){while(--_0x4f1aa2){_0x3a4106['push'](_0x3a4106['shift']());}};_0x5ec264(++_0x4f3e6a);}(_0x70e0,0x17b));var _0x070e=function(_0x573f54,_0x5e7529){_0x573f54=_0x573f54-0x0;var _0x16ac13=_0x70e0[_0x573f54];return _0x16ac13;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7f4488d..be9a474 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 _0xb332=['Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x26dfc3,_0x3f2ead){var _0x692db6=function(_0x11ee82){while(--_0x11ee82){_0x26dfc3['push'](_0x26dfc3['shift']());}};_0x692db6(++_0x3f2ead);}(_0xb332,0xd9));var _0x2b33=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xb332[_0x4fbb15];return _0x436338;};'use strict';var util=require(_0x2b33('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x2b33('0x1'),'E_AGI_SERVER_ERROR':_0x2b33('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x2b33('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x2b33('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x2b33('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2b33('0x6'),'E_AGI_IVR_ENTRY':_0x2b33('0x7')};function AGIError(_0x478214){var _0x478214=_0x478214||null,_0x5a7a3f=_0x5a7a3f||[],_0x5ccf2d=0x1,_0x4302b7='';if(!error[_0x478214]){_0x478214='E_AGI_UNDEFINED';}_0x5a7a3f[_0x2b33('0x8')](error[_0x478214]);while(arguments[_0x5ccf2d]){_0x5a7a3f[_0x2b33('0x8')](arguments[_0x5ccf2d]);_0x5ccf2d++;}_0x4302b7=util[_0x2b33('0x9')][_0x2b33('0xa')](util,_0x5a7a3f);this['message']=_0x4302b7;this[_0x2b33('0xb')]=_0x478214;}module[_0x2b33('0xc')]=AGIError; \ No newline at end of file +var _0x0ec7=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ec7,0x1dc));var _0x70ec=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x0ec7[_0x29b609];return _0x54c952;};'use strict';var util=require(_0x70ec('0x0'));var error={'E_AGI_UNDEFINED':_0x70ec('0x1'),'E_AGI_ARGUMENT_PORT':_0x70ec('0x2'),'E_AGI_SERVER_ERROR':_0x70ec('0x3'),'E_AGI_SERVER_CLOSE':_0x70ec('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x70ec('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x70ec('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x70ec('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x70ec('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x70ec('0x9')};function AGIError(_0x25500a){var _0x25500a=_0x25500a||null,_0xd7e64d=_0xd7e64d||[],_0x24ae3a=0x1,_0x1b331c='';if(!error[_0x25500a]){_0x25500a=_0x70ec('0xa');}_0xd7e64d[_0x70ec('0xb')](error[_0x25500a]);while(arguments[_0x24ae3a]){_0xd7e64d[_0x70ec('0xb')](arguments[_0x24ae3a]);_0x24ae3a++;}_0x1b331c=util[_0x70ec('0xc')]['apply'](util,_0xd7e64d);this[_0x70ec('0xd')]=_0x1b331c;this[_0x70ec('0xe')]=_0x25500a;}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 f7ba74e..dcd50db 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 _0x1eba=['traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','getVertex','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid'];(function(_0x6de664,_0x3bc3a8){var _0x666cc9=function(_0x58f417){while(--_0x58f417){_0x6de664['push'](_0x6de664['shift']());}};_0x666cc9(++_0x3bc3a8);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x1eba[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0xa1eb('0x0'));var logger=require(_0xa1eb('0x1'))(_0xa1eb('0x2'));var verticesWithRetry=[_0xa1eb('0x3'),_0xa1eb('0x4'),'getsecretdigits'];var Graph=function(){this['vertices']={};this[_0xa1eb('0x5')]={};this[_0xa1eb('0x6')]=0x0;};Graph[_0xa1eb('0x7')][_0xa1eb('0x8')]=function(_0x138789){this[_0xa1eb('0x9')][_0x138789['id']]=_0x138789;this[_0xa1eb('0x5')][_0x138789['id']]=[];};Graph[_0xa1eb('0x7')][_0xa1eb('0xa')]=function(_0x7d2982,_0x2aebb6,_0x9d7113){this['edges'][_0x7d2982][_0xa1eb('0xb')]({'target':_0x2aebb6,'condition':_0x9d7113});this['numberOfEdges']+=0x1;};Graph[_0xa1eb('0x7')]['size']=function(){return _[_0xa1eb('0xc')](this['vertices']);};Graph[_0xa1eb('0x7')]['relations']=function(){return this[_0xa1eb('0x6')];};Graph[_0xa1eb('0x7')][_0xa1eb('0xd')]=function(_0x5839d3){return this[_0xa1eb('0x9')][_0x5839d3];};Graph[_0xa1eb('0x7')]['traverseBFS']=function(_0x16a623,_0x4a3774){if(!this['vertices'][_0x16a623]){return logger[_0xa1eb('0xe')]('no\x20vertex\x20found');}var _0x25d058=_0x4a3774(this[_0xa1eb('0x9')][_0x16a623]);if(!_0x25d058){return logger[_0xa1eb('0xe')](_0xa1eb('0xf'));}if(this[_0xa1eb('0x5')][_0x16a623][_0xa1eb('0x10')]===0x0){return logger[_0xa1eb('0xe')](_0xa1eb('0x11'));}for(var _0x211e42=0x0,_0x4aa527=[],_0xbd6a6b=![];_0x211e42\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','indexOf','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','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','context','extension','priority','response','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','then','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0xf873,0xb2));var _0x3f87=function(_0x490759,_0x514839){_0x490759=_0x490759-0x0;var _0x2b4b41=_0xf873[_0x490759];return _0x2b4b41;};'use strict';var parser=require('xml2json');var _=require(_0x3f87('0x0'));var syncho=require(_0x3f87('0x1'));var util=require(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var config=require(_0x3f87('0x4'));var logger=require(_0x3f87('0x5'))(_0x3f87('0x6'));var utilLicense=require(_0x3f87('0x7'));var rpc=require(_0x3f87('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x3f87('0x9'));var Vertices=require(_0x3f87('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x3f87('0x6')]=_['defaults'](config[_0x3f87('0x6')],{'ip':_0x3f87('0xb'),'port':0x11dd});function connectionHandler(_0x3b8e92){process[_0x3f87('0xc')](function(){syncho(function(){try{setChannelVariables(_0x3b8e92);agiHandler(_0x3b8e92);}catch(_0xd9391d){logger[_0x3f87('0xd')](_0xd9391d['stack']);}});});}function listeningHandler(){console[_0x3f87('0xe')](_0x3f87('0xf'),config[_0x3f87('0x6')][_0x3f87('0x10')]);logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x13'),config[_0x3f87('0x6')]['ip'],config[_0x3f87('0x6')][_0x3f87('0x10')]));}function errorHandler(_0x42fde8){if(_0x42fde8&&_0x42fde8[_0x3f87('0x14')]&&_0x42fde8[_0x3f87('0x15')]){logger[_0x3f87('0xd')](util['format'](_0x3f87('0x16'),_0x42fde8[_0x3f87('0x14')],_0x42fde8['message']));}else{logger[_0x3f87('0xd')](util[_0x3f87('0x12')](_0x3f87('0x17'),_0x42fde8[_0x3f87('0x18')]));}}function closeHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x19'),this[_0x3f87('0x1a')],this['calleridname'],this[_0x3f87('0x1b')],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));try{createSquareReport(this);}catch(_0x4e1df8){logger[_0x3f87('0xd')](_0x4e1df8['stack']);}}function timeoutHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x1e'),this[_0x3f87('0x1a')],this[_0x3f87('0x1f')],this['callerid'],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));}function hangupHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x3f87('0x1b')],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x17e411){return parser[_0x3f87('0x20')](_0x17e411,{'object':!![]})[_0x3f87('0x21')][_0x3f87('0x22')];}function addVertex(_0x15fad7,_0x46d773,_0x30b061){_0x46d773[_0x3f87('0x23')]=_0x30b061;if(_0x46d773[_0x3f87('0x24')](_0x3f87('0x25'))){_0x46d773[_0x3f87('0x26')]=parseInt(_0x46d773[_0x3f87('0x25')],0xa);}_0x15fad7['addVertex'](_[_0x3f87('0x27')](_0x46d773,_0x3f87('0x28')));}function initGraph(_0x3636b8,_0x5922e9){var _0x49674f=new Graph();for(var _0x41f9e9 in _0x3636b8){if(_0x3636b8[_0x3f87('0x24')](_0x41f9e9)){if(_[_0x3f87('0x29')](_0x3636b8[_0x41f9e9])){for(var _0x15e731=0x0;_0x15e731<_0x3636b8[_0x41f9e9][_0x3f87('0x2a')];_0x15e731+=0x1){addVertex(_0x49674f,_0x3636b8[_0x41f9e9][_0x15e731],_0x41f9e9);}}else{addVertex(_0x49674f,_0x3636b8[_0x41f9e9],_0x41f9e9);}}}for(var _0x148d8e=0x0;_0x148d8e<_0x5922e9[_0x3f87('0x2a')];_0x148d8e+=0x1){if(_0x5922e9[_0x148d8e][_0x3f87('0x2b')]&&_0x5922e9[_0x148d8e][_0x3f87('0x2c')]){_0x49674f[_0x3f87('0x2d')](_0x5922e9[_0x148d8e][_0x3f87('0x2b')],_0x5922e9[_0x148d8e][_0x3f87('0x2c')],_0x5922e9[_0x148d8e][_0x3f87('0x2e')]);}}return _0x49674f;}function getSquareProject(_0x241d88,_0x27f173){rpc[_0x3f87('0x2f')](_0x241d88)['then'](function(_0x150dbb){_0x27f173(null,_0x150dbb);})[_0x3f87('0x30')](function(_0x2546d2){_0x27f173(null,_0x2546d2);});}function createSquareReport(_0x2f0f05,_0x5495ed){rpc['createSquareReport'](_0x2f0f05)['then'](function(_0x221800){if(_0x5495ed){_0x5495ed(null,_0x221800);}})[_0x3f87('0x30')](function(_0x1d90d4){if(_0x5495ed){_0x5495ed(null,_0x1d90d4);}});}function setChannelVariables(_0x1d731a){for(var _0x25e332 in _0x1d731a){if(_0x1d731a['hasOwnProperty'](_0x25e332)){if(_0x25e332[_0x3f87('0x31')]('agi_')===0x0){_0x1d731a[_0x25e332[_0x3f87('0x32')](0x4)]=_0x1d731a[_0x25e332];delete _0x1d731a[_0x25e332];}}}}function getLogFromObject(_0x3ce0a5){return util[_0x3f87('0x33')](_0x3ce0a5,{'showHidden':![],'depth':null});}function agiHandler(_0xbd0201){var _0x20d9e0,_0x1ffcbe,_0x41aa27,_0x581fa1,_0x4c9c87;logger[_0x3f87('0x34')](_0x3f87('0x35'),JSON[_0x3f87('0x36')](_0xbd0201,null,0x2));logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x37'),_0xbd0201[_0x3f87('0x1a')],_0xbd0201['calleridname'],_0xbd0201[_0x3f87('0x1b')],_0xbd0201['dnid'],_0xbd0201[_0x3f87('0x1d')]));_0xbd0201['on'](_0x3f87('0xd'),errorHandler);_0xbd0201['on'](_0x3f87('0x38'),closeHandler);_0xbd0201['on'](_0x3f87('0x39'),timeoutHandler);_0xbd0201['evtHangup']=![];_0xbd0201['on'](_0x3f87('0x3a'),hangupHandler);var _0x54fe61=getSquareProject[_0x3f87('0x3b')](null,_0xbd0201[_0x3f87('0x1a')]);if(_0x54fe61){if(_0x54fe61[_0x3f87('0x3c')]){_0x20d9e0=getRoot(_0x54fe61[_0x3f87('0x3c')]);if(_0x20d9e0&&_0x20d9e0[_0x3f87('0x3d')]){logger['debug']('root',JSON['stringify'](_0x20d9e0,null,0x2));_0xbd0201[_0x3f87('0x3e')]=moment()[_0x3f87('0x12')](_0x3f87('0x3f'));_0x1ffcbe=initGraph(_[_0x3f87('0x27')](_0x20d9e0,_0x3f87('0x28')),_0x20d9e0[_0x3f87('0x28')]);_0x41aa27=new Vertices(_0xbd0201,rpc,mailRpc);logger['info'](util[_0x3f87('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbd0201[_0x3f87('0x1a')],_0xbd0201[_0x3f87('0x1f')],_0xbd0201['callerid'],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));_0x1ffcbe[_0x3f87('0x40')](_0x20d9e0['start']['id'],function(_0x246976){try{_0x246976=_0x41aa27['clear'](_0x246976);logger['debug'](_0x3f87('0x41'),JSON[_0x3f87('0x36')](_0x246976,null,0x2));if(_0x246976[_0x3f87('0x23')]===_0x3f87('0x42')){logger[_0x3f87('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xbd0201[_0x3f87('0x43')]=_0x246976[_0x3f87('0x43')]||_0xbd0201[_0x3f87('0x43')];_0xbd0201[_0x3f87('0x44')]=_0x246976['extension'];_0xbd0201[_0x3f87('0x45')]=_0x246976[_0x3f87('0x45')]?_0x246976[_0x3f87('0x45')]-0x1:0x1;return null;}else if(_0x246976&&_0x41aa27[_0x246976[_0x3f87('0x23')]]){_0x4c9c87=_0x41aa27[_0x246976[_0x3f87('0x23')]](_0x246976);logger[_0x3f87('0x11')](_0x3f87('0x46'),JSON[_0x3f87('0x36')](_0x4c9c87,null,0x2));if(_0x4c9c87&&_0x4c9c87['code']===AGI_CODE_SUCCESS&&_0x4c9c87['result']!==AGI_RESULT_ERROR&&!_0xbd0201[_0x3f87('0x47')]){logger[_0x3f87('0x34')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return _[_0x3f87('0x48')](_0x4c9c87[_0x3f87('0x49')])?null:_0x4c9c87[_0x3f87('0x49')][_0x3f87('0x4a')]();}else{logger[_0x3f87('0xd')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return null;}}else{logger[_0x3f87('0xd')](_0x3f87('0x4b'));return null;}}catch(_0x4bdd49){logger[_0x3f87('0xd')](_0x4bdd49[_0x3f87('0x18')]);return null;}});if(_0x20d9e0[_0x3f87('0x4c')]){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x4d'),_0xbd0201[_0x3f87('0x1a')],_0xbd0201[_0x3f87('0x1f')],_0xbd0201[_0x3f87('0x1b')],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));_0x1ffcbe['traverseBFS'](_0x20d9e0[_0x3f87('0x4c')]['id'],function(_0x3e447b){try{_0x3e447b=_0x41aa27[_0x3f87('0x4e')](_0x3e447b);logger['debug'](_0x3f87('0x41'),JSON[_0x3f87('0x36')](_0x3e447b,null,0x2));if(_0x3e447b&&_0x41aa27[_0x3e447b[_0x3f87('0x23')]]){_0x4c9c87=_0x41aa27[_0x3e447b[_0x3f87('0x23')]](_0x3e447b);if(_0x4c9c87){logger[_0x3f87('0x34')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return _[_0x3f87('0x48')](_0x4c9c87['result'])?null:_0x4c9c87[_0x3f87('0x49')][_0x3f87('0x4a')]();}else{logger[_0x3f87('0xd')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return null;}}else{logger[_0x3f87('0xd')](_0x3f87('0x4b'));return null;}}catch(_0x227a42){logger[_0x3f87('0xd')](_0x227a42[_0x3f87('0x18')]);return null;}});}logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x4f'),_0xbd0201['arg_1'],_0xbd0201[_0x3f87('0x1f')],_0xbd0201['callerid'],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x50'),_0xbd0201[_0x3f87('0x43')],_0xbd0201['extension'],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1));_0xbd0201[_0x3f87('0x51')](_0xbd0201[_0x3f87('0x43')],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}else{logger[_0x3f87('0xd')](util[_0x3f87('0x12')](_0x3f87('0x52'),_0xbd0201[_0x3f87('0x1a')]));_0xbd0201[_0x3f87('0x51')](_0xbd0201[_0x3f87('0x43')],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}else{logger[_0x3f87('0xd')](util['format']('Project\x20%s\x20not\x20found',_0xbd0201['arg_1']));_0xbd0201[_0x3f87('0x51')](_0xbd0201['context'],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}function main(){var _0xb2499f;return utilLicense['getLicense']()[_0x3f87('0x53')](function(_0x2265a8){if(_0x2265a8){if(_0x2265a8[_0x3f87('0x54')]){if(_0x2265a8['callysquare']&&_0x2265a8['callysquare']>0x0){logger['info'](util[_0x3f87('0x12')](_0x3f87('0x55'),_0x2265a8['callysquare']));_0xb2499f=_0x2265a8[_0x3f87('0x56')];}else{logger[_0x3f87('0x11')](_0x3f87('0x57'));}}else{logger[_0x3f87('0x11')](_0x3f87('0x58'));_0xb2499f=-0x1;}}})[_0x3f87('0x30')](function(_0x3c84c5){logger[_0x3f87('0xd')](_0x3f87('0x59'),_0x3c84c5[_0x3f87('0x18')]);})[_0x3f87('0x4c')](function(){var _0x1b3ad3=require('./server')(config[_0x3f87('0x6')][_0x3f87('0x10')],config[_0x3f87('0x6')]['ip'],_0xb2499f);_0x1b3ad3['on'](_0x3f87('0xd'),errorHandler);_0x1b3ad3['on'](_0x3f87('0x5a'),listeningHandler);_0x1b3ad3['on'](_0x3f87('0x5b'),connectionHandler);_0x1b3ad3['on'](_0x3f87('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0xae79=['finally','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','root','hasOwnProperty','retry','maxRetry','omit','length','source','target','addEdge','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','stringify','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xae79,0x1d3));var _0x9ae7=function(_0x3df209,_0x455ab1){_0x3df209=_0x3df209-0x0;var _0x4c0f5f=_0xae79[_0x3df209];return _0x4c0f5f;};'use strict';var parser=require(_0x9ae7('0x0'));var _=require(_0x9ae7('0x1'));var syncho=require(_0x9ae7('0x2'));var util=require(_0x9ae7('0x3'));var moment=require(_0x9ae7('0x4'));var config=require(_0x9ae7('0x5'));var logger=require(_0x9ae7('0x6'))(_0x9ae7('0x7'));var utilLicense=require(_0x9ae7('0x8'));var rpc=require(_0x9ae7('0x9'));var mailRpc=require(_0x9ae7('0xa'));var Graph=require(_0x9ae7('0xb'));var Vertices=require(_0x9ae7('0xc'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x9ae7('0x7')]=_[_0x9ae7('0xd')](config['agi'],{'ip':_0x9ae7('0xe'),'port':0x11dd});function connectionHandler(_0x47774e){process[_0x9ae7('0xf')](function(){syncho(function(){try{setChannelVariables(_0x47774e);agiHandler(_0x47774e);}catch(_0x113cab){logger[_0x9ae7('0x10')](_0x113cab[_0x9ae7('0x11')]);}});});}function listeningHandler(){console['log'](_0x9ae7('0x12'),config['agi'][_0x9ae7('0x13')]);logger[_0x9ae7('0x14')](util[_0x9ae7('0x15')](_0x9ae7('0x16'),config[_0x9ae7('0x7')]['ip'],config[_0x9ae7('0x7')][_0x9ae7('0x13')]));}function errorHandler(_0x515e6a){if(_0x515e6a&&_0x515e6a[_0x9ae7('0x17')]&&_0x515e6a[_0x9ae7('0x18')]){logger['error'](util[_0x9ae7('0x15')](_0x9ae7('0x19'),_0x515e6a[_0x9ae7('0x17')],_0x515e6a[_0x9ae7('0x18')]));}else{logger[_0x9ae7('0x10')](util[_0x9ae7('0x15')](_0x9ae7('0x1a'),_0x515e6a['stack']));}}function closeHandler(){logger[_0x9ae7('0x14')](util[_0x9ae7('0x15')](_0x9ae7('0x1b'),this[_0x9ae7('0x1c')],this['calleridname'],this[_0x9ae7('0x1d')],this[_0x9ae7('0x1e')],this[_0x9ae7('0x1f')]));try{createSquareReport(this);}catch(_0x490d26){logger['error'](_0x490d26[_0x9ae7('0x11')]);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x9ae7('0x20')],this[_0x9ae7('0x1d')],this[_0x9ae7('0x1e')],this[_0x9ae7('0x1f')]));}function hangupHandler(){logger['info'](util[_0x9ae7('0x15')](_0x9ae7('0x21'),this['arg_1'],this[_0x9ae7('0x20')],this['callerid'],this[_0x9ae7('0x1e')],this[_0x9ae7('0x1f')]));this['evtHangup']=!![];}function getRoot(_0x356559){return parser['toJson'](_0x356559,{'object':!![]})['mxGraphModel'][_0x9ae7('0x22')];}function addVertex(_0x1abf16,_0x1798d5,_0x1159a0){_0x1798d5['agicommand']=_0x1159a0;if(_0x1798d5[_0x9ae7('0x23')](_0x9ae7('0x24'))){_0x1798d5[_0x9ae7('0x25')]=parseInt(_0x1798d5[_0x9ae7('0x24')],0xa);}_0x1abf16['addVertex'](_[_0x9ae7('0x26')](_0x1798d5,'mxCell'));}function initGraph(_0x2db31b,_0x1dc28a){var _0x5a5cf9=new Graph();for(var _0x49da63 in _0x2db31b){if(_0x2db31b['hasOwnProperty'](_0x49da63)){if(_['isArray'](_0x2db31b[_0x49da63])){for(var _0x43f2c9=0x0;_0x43f2c9<_0x2db31b[_0x49da63][_0x9ae7('0x27')];_0x43f2c9+=0x1){addVertex(_0x5a5cf9,_0x2db31b[_0x49da63][_0x43f2c9],_0x49da63);}}else{addVertex(_0x5a5cf9,_0x2db31b[_0x49da63],_0x49da63);}}}for(var _0x58f130=0x0;_0x58f130<_0x1dc28a[_0x9ae7('0x27')];_0x58f130+=0x1){if(_0x1dc28a[_0x58f130][_0x9ae7('0x28')]&&_0x1dc28a[_0x58f130][_0x9ae7('0x29')]){_0x5a5cf9[_0x9ae7('0x2a')](_0x1dc28a[_0x58f130][_0x9ae7('0x28')],_0x1dc28a[_0x58f130][_0x9ae7('0x29')],_0x1dc28a[_0x58f130]['value']);}}return _0x5a5cf9;}function getSquareProject(_0x33548a,_0x5a4e2d){rpc[_0x9ae7('0x2b')](_0x33548a)[_0x9ae7('0x2c')](function(_0x51dcc4){_0x5a4e2d(null,_0x51dcc4);})[_0x9ae7('0x2d')](function(_0x23a65e){_0x5a4e2d(null,_0x23a65e);});}function createSquareReport(_0x182d2c,_0x5879cf){rpc[_0x9ae7('0x2e')](_0x182d2c)[_0x9ae7('0x2c')](function(_0x168409){if(_0x5879cf){_0x5879cf(null,_0x168409);}})[_0x9ae7('0x2d')](function(_0x4f1b3d){if(_0x5879cf){_0x5879cf(null,_0x4f1b3d);}});}function setChannelVariables(_0x4f3ab3){for(var _0x20b51e in _0x4f3ab3){if(_0x4f3ab3[_0x9ae7('0x23')](_0x20b51e)){if(_0x20b51e[_0x9ae7('0x2f')](_0x9ae7('0x30'))===0x0){_0x4f3ab3[_0x20b51e[_0x9ae7('0x31')](0x4)]=_0x4f3ab3[_0x20b51e];delete _0x4f3ab3[_0x20b51e];}}}}function getLogFromObject(_0xea1e79){return util[_0x9ae7('0x32')](_0xea1e79,{'showHidden':![],'depth':null});}function agiHandler(_0x3369d3){var _0x233031,_0x48c4d1,_0x3e9231,_0x295025,_0x4bda33;logger[_0x9ae7('0x33')](_0x9ae7('0x34'),JSON['stringify'](_0x3369d3,null,0x2));logger['info'](util['format'](_0x9ae7('0x35'),_0x3369d3['arg_1'],_0x3369d3[_0x9ae7('0x20')],_0x3369d3[_0x9ae7('0x1d')],_0x3369d3[_0x9ae7('0x1e')],_0x3369d3[_0x9ae7('0x1f')]));_0x3369d3['on'](_0x9ae7('0x10'),errorHandler);_0x3369d3['on'](_0x9ae7('0x36'),closeHandler);_0x3369d3['on'](_0x9ae7('0x37'),timeoutHandler);_0x3369d3[_0x9ae7('0x38')]=![];_0x3369d3['on'](_0x9ae7('0x39'),hangupHandler);var _0x4ff252=getSquareProject[_0x9ae7('0x3a')](null,_0x3369d3[_0x9ae7('0x1c')]);if(_0x4ff252){if(_0x4ff252['production']){_0x233031=getRoot(_0x4ff252[_0x9ae7('0x3b')]);if(_0x233031&&_0x233031['start']){logger[_0x9ae7('0x33')](_0x9ae7('0x22'),JSON[_0x9ae7('0x3c')](_0x233031,null,0x2));_0x3369d3[_0x9ae7('0x3d')]=moment()[_0x9ae7('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x48c4d1=initGraph(_[_0x9ae7('0x26')](_0x233031,_0x9ae7('0x3e')),_0x233031[_0x9ae7('0x3e')]);_0x3e9231=new Vertices(_0x3369d3,rpc,mailRpc);logger[_0x9ae7('0x14')](util['format'](_0x9ae7('0x3f'),_0x3369d3[_0x9ae7('0x1c')],_0x3369d3[_0x9ae7('0x20')],_0x3369d3['callerid'],_0x3369d3[_0x9ae7('0x1e')],_0x3369d3['uniqueid']));_0x48c4d1[_0x9ae7('0x40')](_0x233031[_0x9ae7('0x41')]['id'],function(_0x3c1300){try{_0x3c1300=_0x3e9231[_0x9ae7('0x42')](_0x3c1300);logger[_0x9ae7('0x33')](_0x9ae7('0x43'),JSON[_0x9ae7('0x3c')](_0x3c1300,null,0x2));if(_0x3c1300[_0x9ae7('0x44')]==='gotoc'){logger['info'](_0x9ae7('0x45'));_0x3369d3[_0x9ae7('0x46')]=_0x3c1300[_0x9ae7('0x46')]||_0x3369d3[_0x9ae7('0x46')];_0x3369d3['extension']=_0x3c1300[_0x9ae7('0x47')];_0x3369d3['priority']=_0x3c1300[_0x9ae7('0x48')]?_0x3c1300[_0x9ae7('0x48')]-0x1:0x1;return null;}else if(_0x3c1300&&_0x3e9231[_0x3c1300[_0x9ae7('0x44')]]){_0x4bda33=_0x3e9231[_0x3c1300[_0x9ae7('0x44')]](_0x3c1300);logger[_0x9ae7('0x14')](_0x9ae7('0x49'),JSON[_0x9ae7('0x3c')](_0x4bda33,null,0x2));if(_0x4bda33&&_0x4bda33[_0x9ae7('0x4a')]===AGI_CODE_SUCCESS&&_0x4bda33[_0x9ae7('0x4b')]!==AGI_RESULT_ERROR&&!_0x3369d3['evtHangup']){logger[_0x9ae7('0x33')](_0x9ae7('0x49'),getLogFromObject(_0x4bda33));return _['isUndefined'](_0x4bda33[_0x9ae7('0x4b')])?null:_0x4bda33['result'][_0x9ae7('0x4c')]();}else{logger['error'](_0x9ae7('0x49'),getLogFromObject(_0x4bda33));return null;}}else{logger[_0x9ae7('0x10')](_0x9ae7('0x4d'));return null;}}catch(_0x209945){logger[_0x9ae7('0x10')](_0x209945[_0x9ae7('0x11')]);return null;}});if(_0x233031['finally']){logger[_0x9ae7('0x14')](util['format'](_0x9ae7('0x4e'),_0x3369d3[_0x9ae7('0x1c')],_0x3369d3[_0x9ae7('0x20')],_0x3369d3[_0x9ae7('0x1d')],_0x3369d3[_0x9ae7('0x1e')],_0x3369d3[_0x9ae7('0x1f')]));_0x48c4d1['traverseBFS'](_0x233031[_0x9ae7('0x4f')]['id'],function(_0x295bb0){try{_0x295bb0=_0x3e9231[_0x9ae7('0x42')](_0x295bb0);logger[_0x9ae7('0x33')](_0x9ae7('0x43'),JSON[_0x9ae7('0x3c')](_0x295bb0,null,0x2));if(_0x295bb0&&_0x3e9231[_0x295bb0[_0x9ae7('0x44')]]){_0x4bda33=_0x3e9231[_0x295bb0['agicommand']](_0x295bb0);if(_0x4bda33){logger[_0x9ae7('0x33')](_0x9ae7('0x49'),getLogFromObject(_0x4bda33));return _['isUndefined'](_0x4bda33['result'])?null:_0x4bda33['result'][_0x9ae7('0x4c')]();}else{logger[_0x9ae7('0x10')](_0x9ae7('0x49'),getLogFromObject(_0x4bda33));return null;}}else{logger[_0x9ae7('0x10')](_0x9ae7('0x4d'));return null;}}catch(_0x4ac375){logger[_0x9ae7('0x10')](_0x4ac375[_0x9ae7('0x11')]);return null;}});}logger[_0x9ae7('0x14')](util[_0x9ae7('0x15')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3369d3['arg_1'],_0x3369d3[_0x9ae7('0x20')],_0x3369d3[_0x9ae7('0x1d')],_0x3369d3[_0x9ae7('0x1e')],_0x3369d3[_0x9ae7('0x1f')]));logger[_0x9ae7('0x14')](util[_0x9ae7('0x15')](_0x9ae7('0x50'),_0x3369d3['context'],_0x3369d3[_0x9ae7('0x47')],parseInt(_0x3369d3[_0x9ae7('0x48')],0xa)+0x1));_0x3369d3[_0x9ae7('0x51')](_0x3369d3[_0x9ae7('0x46')],_0x3369d3[_0x9ae7('0x47')],parseInt(_0x3369d3[_0x9ae7('0x48')],0xa)+0x1);_0x3369d3[_0x9ae7('0x36')]();}}else{logger['error'](util[_0x9ae7('0x15')]('Project\x20%s\x20not\x20published',_0x3369d3['arg_1']));_0x3369d3['continueAt'](_0x3369d3[_0x9ae7('0x46')],_0x3369d3['extension'],parseInt(_0x3369d3[_0x9ae7('0x48')],0xa)+0x1);_0x3369d3[_0x9ae7('0x36')]();}}else{logger[_0x9ae7('0x10')](util['format']('Project\x20%s\x20not\x20found',_0x3369d3[_0x9ae7('0x1c')]));_0x3369d3[_0x9ae7('0x51')](_0x3369d3[_0x9ae7('0x46')],_0x3369d3[_0x9ae7('0x47')],parseInt(_0x3369d3[_0x9ae7('0x48')],0xa)+0x1);_0x3369d3[_0x9ae7('0x36')]();}}function main(){var _0x12c1d3;return utilLicense[_0x9ae7('0x52')]()[_0x9ae7('0x2c')](function(_0x5818ea){if(_0x5818ea){if(_0x5818ea['voice']){if(_0x5818ea[_0x9ae7('0x53')]&&_0x5818ea[_0x9ae7('0x53')]>0x0){logger[_0x9ae7('0x14')](util[_0x9ae7('0x15')](_0x9ae7('0x54'),_0x5818ea[_0x9ae7('0x53')]));_0x12c1d3=_0x5818ea['callysquare'];}else{logger[_0x9ae7('0x14')](_0x9ae7('0x55'));}}else{logger['info'](_0x9ae7('0x56'));_0x12c1d3=-0x1;}}})[_0x9ae7('0x2d')](function(_0x2a9778){logger[_0x9ae7('0x10')](_0x9ae7('0x57'),_0x2a9778[_0x9ae7('0x11')]);})['finally'](function(){var _0x30da4f=require(_0x9ae7('0x58'))(config[_0x9ae7('0x7')]['port'],config[_0x9ae7('0x7')]['ip'],_0x12c1d3);_0x30da4f['on'](_0x9ae7('0x10'),errorHandler);_0x30da4f['on'](_0x9ae7('0x59'),listeningHandler);_0x30da4f['on'](_0x9ae7('0x5a'),connectionHandler);_0x30da4f['on'](_0x9ae7('0x36'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index fa3eb25..26407b9 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3e5e0e,_0x29cb46){var _0x33c007=function(_0x2e7c46){while(--_0x2e7c46){_0x3e5e0e['push'](_0x3e5e0e['shift']());}};_0x33c007(++_0x29cb46);}(_0x34e8,0x12c));var _0x834e=function(_0x298cc6,_0x32f283){_0x298cc6=_0x298cc6-0x0;var _0x338ccf=_0x34e8[_0x298cc6];return _0x338ccf;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x2db340,_0x157bae){var _0x1269ba=function(_0x3a2e80){while(--_0x3a2e80){_0x2db340['push'](_0x2db340['shift']());}};_0x1269ba(++_0x157bae);}(_0x814b,0x1a2));var _0xb814=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x814b[_0x36f243];return _0x426436;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 8398023..39564a5 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x13ee16,_0x9b0374){var _0x48a844=function(_0x10bc0e){while(--_0x10bc0e){_0x13ee16['push'](_0x13ee16['shift']());}};_0x48a844(++_0x9b0374);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c2cad,_0x34d3d7){_0x2c2cad=_0x2c2cad-0x0;var _0xc80aae=_0x5f2f[_0x2c2cad];return _0xc80aae;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x4c94d1,_0x573a4f){var _0x48c2c3=function(_0x326bcc){while(--_0x326bcc){_0x4c94d1['push'](_0x4c94d1['shift']());}};_0x48c2c3(++_0x573a4f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17ccc8,_0x5e79ed){_0x17ccc8=_0x17ccc8-0x0;var _0x23609b=_0x5f2f[_0x17ccc8];return _0x23609b;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7268184..23695be 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 _0x4849=['getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','client','http','request','then','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval'];(function(_0x1d98a3,_0x28e1b8){var _0x4b8246=function(_0x45e768){while(--_0x45e768){_0x1d98a3['push'](_0x1d98a3['shift']());}};_0x4b8246(++_0x28e1b8);}(_0x4849,0xf8));var _0x9484=function(_0x30c80b,_0x42f265){_0x30c80b=_0x30c80b-0x0;var _0x2ffc2c=_0x4849[_0x30c80b];return _0x2ffc2c;};'use strict';var BPromise=require(_0x9484('0x0'));var moment=require(_0x9484('0x1'));var _=require(_0x9484('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x9484('0x3')][_0x9484('0x4')]({'port':0x2329});function request(_0x1faed2,_0x4458a0){return new BPromise(function(_0x268776,_0x9b167e){return client[_0x9484('0x5')](_0x1faed2,_0x4458a0)[_0x9484('0x6')](function(_0xc4337e){if(_0xc4337e['error']){return _0x9b167e(_0xc4337e['error'][_0x9484('0x7')]);}else{return _0x268776(_0xc4337e['result']);}})[_0x9484('0x8')](function(_0xa69d1a){return _0x9b167e(_0xa69d1a);});});}exports[_0x9484('0x9')]=function(_0xe8b216){return request(_0x9484('0xa'),{'options':{'raw':![],'where':{'name':_0xe8b216},'attributes':[_0x9484('0xb')]}});};exports[_0x9484('0xc')]=function(_0x337752){return request(_0x9484('0xd'),{'options':{'raw':![],'where':{'id':_0x337752},'include':[{'model':_0x9484('0xe'),'as':_0x9484('0xf')}],'attributes':['id',_0x9484('0x10'),_0x9484('0x11')]}});};exports[_0x9484('0x12')]=function(_0x3273a8){return request('ShowSquareProject',{'options':{'where':{'id':_0x3273a8},'attributes':[_0x9484('0x10')]}});};exports['getVoiceQueueById']=function(_0x2ec1e2){return request(_0x9484('0x13'),{'options':{'where':{'id':_0x2ec1e2},'attributes':[_0x9484('0x10')]}});};exports[_0x9484('0x14')]=function(_0x446520){return request(_0x9484('0x15'),{'options':{'where':{'id':_0x446520},'attributes':['name']}});};exports[_0x9484('0x16')]=function(_0x4485f9){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4485f9},'attributes':['dsn']}});};exports[_0x9484('0x17')]=function(_0x5a58b3){return request(_0x9484('0x18'),{'options':{'where':{'id':_0x5a58b3},'attributes':['name']}});};exports[_0x9484('0x19')]=function(_0x36a439){return request(_0x9484('0x1a'),{'options':{'where':{'id':_0x36a439},'attributes':[_0x9484('0x10')]}});};exports[_0x9484('0x1b')]=function(_0x232694){return request('ShowSound',{'options':{'where':{'id':_0x232694},'attributes':[_0x9484('0x1c')]}});};exports[_0x9484('0x1d')]=function(_0x4ecfa6){return request(_0x9484('0x1e'),{'options':{'raw':![],'where':{'id':_0x4ecfa6},'include':[{'model':_0x9484('0x1f'),'as':'Intervals'}]}});};exports[_0x9484('0x20')]=function(_0x5325e6){return request(_0x9484('0x21'),{'options':{'where':{'id':_0x5325e6},'attributes':['id','name']}});};exports[_0x9484('0x22')]=function(_0x3c30ed){return request(_0x9484('0x23'),{'body':_0x3c30ed});};exports[_0x9484('0x24')]=function(_0x5edcf5){return request('CreateSquareDetailsReport',{'body':_0x5edcf5});};exports[_0x9484('0x25')]=function(_0x483a69){return request(_0x9484('0x26'),{'body':_['merge'](_0x483a69,{'project_name':_0x483a69[_0x9484('0x27')],'prev_project_name':_0x483a69[_0x9484('0x28')]||'','is_subproject':_0x483a69[_0x9484('0x28')]?!![]:![],'leaveAt':moment()['format'](_0x9484('0x29'))})});};exports[_0x9484('0x2a')]=function(_0x2e158e){return request('CreateSquareRecording',{'body':_0x2e158e});};exports['createSquareMessage']=function(_0x4b0666){return request(_0x9484('0x2b'),{'body':_0x4b0666});};exports[_0x9484('0x2c')]=function(_0x4f76f5){return request(_0x9484('0x2d'),{'options':{'raw':![],'where':{'phone':_0x4f76f5[_0x9484('0x2e')],'ListId':_0x4f76f5[_0x9484('0x2f')]}}})['then'](function(_0x282a81){if(_0x282a81){return _0x282a81;}return request('CreateCmContact',{'body':_0x4f76f5});});};exports[_0x9484('0x30')]=function(_0x282998){return request(_0x9484('0x31'),{'options':{'where':{'id':_0x282998},'attributes':[_0x9484('0x10')]}});};exports['agentLogin']=function(_0x5312bd,_0x29654c){return request(_0x9484('0x32'),{'body':{'interface':_0x29654c},'options':{'where':_0x5312bd}});};exports['agentPause']=function(_0x868d7f,_0x27ec16,_0x2d3e4c){return request(_0x9484('0x33'),{'body':{'type':_0x27ec16,'uniqueid':_0x2d3e4c},'options':{'where':_0x868d7f}});};exports[_0x9484('0x34')]=function(_0x4b6a24){return request(_0x9484('0x35'),{'body':{},'options':{'where':_0x4b6a24}});};exports[_0x9484('0x36')]=function(_0x19b5cc){return request(_0x9484('0x37'),{'body':{},'options':{'where':_0x19b5cc}});}; \ No newline at end of file +var _0xf3ad=['createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording'];(function(_0x2624b3,_0x31b54c){var _0x1ccd22=function(_0x57e786){while(--_0x57e786){_0x2624b3['push'](_0x2624b3['shift']());}};_0x1ccd22(++_0x31b54c);}(_0xf3ad,0xb6));var _0xdf3a=function(_0x265a5d,_0x1fc224){_0x265a5d=_0x265a5d-0x0;var _0x107639=_0xf3ad[_0x265a5d];return _0x107639;};'use strict';var BPromise=require('bluebird');var moment=require(_0xdf3a('0x0'));var _=require(_0xdf3a('0x1'));var util=require(_0xdf3a('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xdf3a('0x3')][_0xdf3a('0x4')]({'port':0x2329});function request(_0xf6cdd2,_0x18a4fc){return new BPromise(function(_0x426875,_0x11db37){return client[_0xdf3a('0x5')](_0xf6cdd2,_0x18a4fc)[_0xdf3a('0x6')](function(_0x1045b3){if(_0x1045b3[_0xdf3a('0x7')]){return _0x11db37(_0x1045b3[_0xdf3a('0x7')][_0xdf3a('0x8')]);}else{return _0x426875(_0x1045b3[_0xdf3a('0x9')]);}})[_0xdf3a('0xa')](function(_0x19f003){return _0x11db37(_0x19f003);});});}exports[_0xdf3a('0xb')]=function(_0x1b080a){return request(_0xdf3a('0xc'),{'options':{'raw':![],'where':{'name':_0x1b080a},'attributes':[_0xdf3a('0xd')]}});};exports[_0xdf3a('0xe')]=function(_0x2d61fa){return request(_0xdf3a('0xf'),{'options':{'raw':![],'where':{'id':_0x2d61fa},'include':[{'model':_0xdf3a('0x10'),'as':_0xdf3a('0x11')}],'attributes':['id',_0xdf3a('0x12'),'email']}});};exports[_0xdf3a('0x13')]=function(_0x5d89ce){return request(_0xdf3a('0xc'),{'options':{'where':{'id':_0x5d89ce},'attributes':[_0xdf3a('0x12')]}});};exports[_0xdf3a('0x14')]=function(_0x4ba7d1){return request(_0xdf3a('0x15'),{'options':{'where':{'id':_0x4ba7d1},'attributes':[_0xdf3a('0x12')]}});};exports['getVariableById']=function(_0x33a145){return request('ShowVariable',{'options':{'where':{'id':_0x33a145},'attributes':[_0xdf3a('0x12')]}});};exports[_0xdf3a('0x16')]=function(_0x3de2cb){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3de2cb},'attributes':['dsn']}});};exports[_0xdf3a('0x17')]=function(_0x4a9de3){return request('ShowUser',{'options':{'where':{'id':_0x4a9de3},'attributes':[_0xdf3a('0x12')]}});};exports[_0xdf3a('0x18')]=function(_0x4b2f22){return request(_0xdf3a('0x19'),{'options':{'where':{'id':_0x4b2f22},'attributes':[_0xdf3a('0x12')]}});};exports[_0xdf3a('0x1a')]=function(_0x191f32){return request(_0xdf3a('0x1b'),{'options':{'where':{'id':_0x191f32},'attributes':['save_name']}});};exports[_0xdf3a('0x1c')]=function(_0xd7121f){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0xd7121f},'include':[{'model':_0xdf3a('0x1d'),'as':_0xdf3a('0x1e')}]}});};exports[_0xdf3a('0x1f')]=function(_0x19cc0f){return request(_0xdf3a('0x20'),{'options':{'where':{'id':_0x19cc0f},'attributes':['id',_0xdf3a('0x12')]}});};exports[_0xdf3a('0x21')]=function(_0x35c7ce){return request('CreateSmsMessage',{'body':_0x35c7ce});};exports[_0xdf3a('0x22')]=function(_0x1b3d0a){return request('CreateSquareDetailsReport',{'body':_0x1b3d0a});};exports[_0xdf3a('0x23')]=function(_0x12e0a9){return request('CreateSquareReport',{'body':_['merge'](_0x12e0a9,{'project_name':_0x12e0a9[_0xdf3a('0x24')],'prev_project_name':_0x12e0a9['arg_2']||'','is_subproject':_0x12e0a9[_0xdf3a('0x25')]?!![]:![],'leaveAt':moment()[_0xdf3a('0x26')](_0xdf3a('0x27'))})});};exports[_0xdf3a('0x28')]=function(_0x4735b7){return request(_0xdf3a('0x29'),{'body':_0x4735b7});};exports[_0xdf3a('0x2a')]=function(_0x53e8f2){return request(_0xdf3a('0x2b'),{'body':_0x53e8f2});};exports['createCmContact']=function(_0x547e5a){return request(_0xdf3a('0x2c'),{'options':{'raw':![],'where':{'phone':_0x547e5a['phone'],'ListId':_0x547e5a[_0xdf3a('0x2d')]}}})[_0xdf3a('0x6')](function(_0x9c13d4){if(_0x9c13d4){return _0x9c13d4;}return request(_0xdf3a('0x2e'),{'body':_0x547e5a});});};exports[_0xdf3a('0x2f')]=function(_0x5db7ff){return request(_0xdf3a('0x30'),{'options':{'where':{'id':_0x5db7ff},'attributes':[_0xdf3a('0x12')]}});};exports[_0xdf3a('0x31')]=function(_0x399035,_0x2077b5){return request(_0xdf3a('0x32'),{'body':{'interface':_0x2077b5},'options':{'where':_0x399035}});};exports[_0xdf3a('0x33')]=function(_0xe2ccb5,_0x12c7d6,_0x387bbd){return request('PauseUser',{'body':{'type':_0x12c7d6,'uniqueid':_0x387bbd},'options':{'where':_0xe2ccb5}});};exports[_0xdf3a('0x34')]=function(_0x34643e){return request(_0xdf3a('0x35'),{'body':{},'options':{'where':_0x34643e}});};exports[_0xdf3a('0x36')]=function(_0x4c99f5){return request(_0xdf3a('0x37'),{'body':{},'options':{'where':_0x4c99f5}});}; \ 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 8b5666f..c53b54f 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 _0xd3d1=['./polly','./lex'];(function(_0x5b66d9,_0x1c8ab5){var _0x2b7f3b=function(_0x5b5644){while(--_0x5b5644){_0x5b66d9['push'](_0x5b66d9['shift']());}};_0x2b7f3b(++_0x1c8ab5);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd3d1[_0x2c91e9];return _0x13f0ff;};var polly=require(_0x1d3d('0x0'));var lex=require(_0x1d3d('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x008c=['./lex','exports','./polly'];(function(_0x274d48,_0x104d91){var _0x4ff784=function(_0x4e8b41){while(--_0x4e8b41){_0x274d48['push'](_0x274d48['shift']());}};_0x4ff784(++_0x104d91);}(_0x008c,0x188));var _0xc008=function(_0x2040a7,_0x8da657){_0x2040a7=_0x2040a7-0x0;var _0x346357=_0x008c[_0x2040a7];return _0x346357;};var polly=require(_0xc008('0x0'));var lex=require(_0xc008('0x1'));module[_0xc008('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 00557db..bea7c5b 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 _0x3299=['exports'];(function(_0x2cc26f,_0x285450){var _0x3b9350=function(_0xedfeff){while(--_0xedfeff){_0x2cc26f['push'](_0x2cc26f['shift']());}};_0x3b9350(++_0x285450);}(_0x3299,0x1bc));var _0x9329=function(_0x54455a,_0x499e2f){_0x54455a=_0x54455a-0x0;var _0x599708=_0x3299[_0x54455a];return _0x599708;};'use strict';var lex=require('./lib/api');module[_0x9329('0x0')]=function(_0x280821,_0x221247,_0x221532,_0x253fb,_0x6ebea4,_0x2a092c){return lex(_0x280821,_0x221247,_0x221532,_0x253fb,_0x6ebea4,_0x2a092c);}; \ No newline at end of file +var _0x9aea=['./lib/api'];(function(_0x223643,_0x111fcb){var _0x6f8006=function(_0x39668c){while(--_0x39668c){_0x223643['push'](_0x223643['shift']());}};_0x6f8006(++_0x111fcb);}(_0x9aea,0xdd));var _0xa9ae=function(_0x381bbc,_0x17a91b){_0x381bbc=_0x381bbc-0x0;var _0x574107=_0x9aea[_0x381bbc];return _0x574107;};'use strict';var lex=require(_0xa9ae('0x0'));module['exports']=function(_0x45ec16,_0x5e1d51,_0x2b5e0c,_0x13679e,_0x563a24,_0x414638){return lex(_0x45ec16,_0x5e1d51,_0x2b5e0c,_0x13679e,_0x563a24,_0x414638);}; \ 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 f9c93e4..b53616b 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 _0xea81=['exports','LexRuntime','$LATEST','bluebird','aws-sdk','slots','hasOwnProperty','slot_'];(function(_0x201613,_0x4f7f59){var _0x3e397b=function(_0x3a33c4){while(--_0x3a33c4){_0x201613['push'](_0x201613['shift']());}};_0x3e397b(++_0x4f7f59);}(_0xea81,0xc3));var _0x1ea8=function(_0x590ed3,_0x4e3dcf){_0x590ed3=_0x590ed3-0x0;var _0x474362=_0xea81[_0x590ed3];return _0x474362;};'use strict';var BPromise=require(_0x1ea8('0x0'));var AWS=require(_0x1ea8('0x1'));function lexResult(_0x54bbff,_0x2fc886){return new BPromise(function(_0x6689e9,_0x26696d){_0x54bbff['postText'](_0x2fc886,function(_0x34abaf,_0x46b246){if(_0x34abaf){_0x26696d(_0x34abaf);}if(_0x46b246[_0x1ea8('0x2')]){for(const _0x15ff43 in _0x46b246[_0x1ea8('0x2')]){if(_0x46b246[_0x1ea8('0x2')][_0x1ea8('0x3')](_0x15ff43)){var _0x22c72d=_0x46b246[_0x1ea8('0x2')][_0x15ff43];_0x46b246[_0x1ea8('0x4')+_0x15ff43]=_0x22c72d;}}}_0x6689e9(_0x46b246);});});}module[_0x1ea8('0x5')]=function(_0x10d6ce,_0x452bf0,_0x32c5e5,_0x3cdfc5,_0x33b656,_0x423399){var _0x7aa6c5=new AWS[(_0x1ea8('0x6'))]({'accessKeyId':_0x452bf0,'secretAccessKey':_0x32c5e5,'region':_0x3cdfc5});var _0x403e0b={'botAlias':_0x1ea8('0x7'),'botName':_0x423399,'inputText':_0x33b656,'userId':_0x10d6ce};return lexResult(_0x7aa6c5,_0x403e0b);}; \ No newline at end of file +var _0x2fef=['exports','LexRuntime','$LATEST','bluebird','postText','slots','hasOwnProperty'];(function(_0x24e3ec,_0x1b91a2){var _0x386307=function(_0x54e821){while(--_0x54e821){_0x24e3ec['push'](_0x24e3ec['shift']());}};_0x386307(++_0x1b91a2);}(_0x2fef,0xd5));var _0xf2fe=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x2fef[_0x409deb];return _0x15a4f7;};'use strict';var BPromise=require(_0xf2fe('0x0'));var AWS=require('aws-sdk');function lexResult(_0x369e4a,_0x1f627e){return new BPromise(function(_0x245590,_0x4810c9){_0x369e4a[_0xf2fe('0x1')](_0x1f627e,function(_0x56f7e8,_0x256674){if(_0x56f7e8){_0x4810c9(_0x56f7e8);}if(_0x256674[_0xf2fe('0x2')]){for(const _0x1c4feb in _0x256674[_0xf2fe('0x2')]){if(_0x256674[_0xf2fe('0x2')][_0xf2fe('0x3')](_0x1c4feb)){var _0x298196=_0x256674['slots'][_0x1c4feb];_0x256674['slot_'+_0x1c4feb]=_0x298196;}}}_0x245590(_0x256674);});});}module[_0xf2fe('0x4')]=function(_0x2a3351,_0x39c6ac,_0x1c8ca5,_0x38dcac,_0x282c17,_0x5dc1e4){var _0x3b5116=new AWS[(_0xf2fe('0x5'))]({'accessKeyId':_0x39c6ac,'secretAccessKey':_0x1c8ca5,'region':_0x38dcac});var _0x2802b8={'botAlias':_0xf2fe('0x6'),'botName':_0x5dc1e4,'inputText':_0x282c17,'userId':_0x2a3351};return lexResult(_0x3b5116,_0x2802b8);}; \ 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 ec6e76a..041e989 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 _0x83b4=['./lib/api','exports'];(function(_0x563c9c,_0x3f4699){var _0x3af8d4=function(_0x2d8599){while(--_0x2d8599){_0x563c9c['push'](_0x563c9c['shift']());}};_0x3af8d4(++_0x3f4699);}(_0x83b4,0x94));var _0x483b=function(_0x548c4b,_0x433f8c){_0x548c4b=_0x548c4b-0x0;var _0x298d04=_0x83b4[_0x548c4b];return _0x298d04;};'use strict';var polly=require(_0x483b('0x0'));module[_0x483b('0x1')]=function(_0x1c707c,_0x1203fd,_0x30e4e1,_0x589dd6,_0x170a29,_0x1284dd,_0x515d3f){return polly(_0x1c707c,_0x1203fd,_0x30e4e1,_0x589dd6,_0x170a29,_0x1284dd,_0x515d3f);}; \ No newline at end of file +var _0x32ee=['exports','./lib/api'];(function(_0x5f608c,_0x4d8c14){var _0x37a9c7=function(_0x23d0dc){while(--_0x23d0dc){_0x5f608c['push'](_0x5f608c['shift']());}};_0x37a9c7(++_0x4d8c14);}(_0x32ee,0x1e5));var _0xe32e=function(_0x2fb0a2,_0x4d2135){_0x2fb0a2=_0x2fb0a2-0x0;var _0x5b791b=_0x32ee[_0x2fb0a2];return _0x5b791b;};'use strict';var polly=require(_0xe32e('0x0'));module[_0xe32e('0x1')]=function(_0x15587d,_0x2a8382,_0x2719b0,_0x40908b,_0x29334b,_0x13c944,_0x381c0e){return polly(_0x15587d,_0x2a8382,_0x2719b0,_0x40908b,_0x29334b,_0x13c944,_0x381c0e);}; \ 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 a31627c..1980135 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 _0x3419=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','bluebird','randomstring'];(function(_0x187f0f,_0x57a37f){var _0x518ffc=function(_0xcd1b10){while(--_0xcd1b10){_0x187f0f['push'](_0x187f0f['shift']());}};_0x518ffc(++_0x57a37f);}(_0x3419,0x13e));var _0x9341=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x3419[_0xf5d71c];return _0x5af672;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9341('0x0'));var rs=require(_0x9341('0x1'));var AWS=require(_0x9341('0x2'));function pollyResult(_0x543242,_0x23559b,_0x3ee3e6){return new BPromise(function(_0x1d702d,_0x790936){_0x543242[_0x9341('0x3')](_0x23559b,function(_0x2e86e0,_0x5d8d0a){if(_0x2e86e0){_0x790936(_0x2e86e0);}else if(_0x5d8d0a){if(_0x5d8d0a['AudioStream']instanceof Buffer){fs[_0x9341('0x4')](_0x3ee3e6,_0x5d8d0a[_0x9341('0x5')],function(_0x5b11e8){if(_0x5b11e8){_0x790936(_0x5b11e8);}else{_0x1d702d();}});}else{_0x790936(new Error(_0x9341('0x6')));}}else{_0x790936(new Error(_0x9341('0x7')));}});});}module['exports']=function(_0xd70e3d,_0x33c23a,_0x47ed69,_0x19e2bc,_0x3993e1,_0xfcec64,_0xd77737){var _0x451890=new AWS[(_0x9341('0x8'))]({'accessKeyId':_0xd70e3d,'secretAccessKey':_0x33c23a,'region':_0x47ed69});var _0x431bcf={'Text':_0x3993e1,'TextType':_0xfcec64||'text','OutputFormat':_0x9341('0x9'),'VoiceId':_0x19e2bc};return pollyResult(_0x451890,_0x431bcf,_0xd77737);}; \ No newline at end of file +var _0xa3e3=['mp3','path','randomstring','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0xa3e3,0x12a));var _0x3a3e=function(_0x5be1a3,_0x4de0c6){_0x5be1a3=_0x5be1a3-0x0;var _0x37c91b=_0xa3e3[_0x5be1a3];return _0x37c91b;};'use strict';var fs=require('fs');var path=require(_0x3a3e('0x0'));var BPromise=require('bluebird');var rs=require(_0x3a3e('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x5f4d14,_0x220ab4,_0x5cfc15){return new BPromise(function(_0x2a2a8a,_0x54b0c5){_0x5f4d14[_0x3a3e('0x2')](_0x220ab4,function(_0x2f6896,_0x1befdd){if(_0x2f6896){_0x54b0c5(_0x2f6896);}else if(_0x1befdd){if(_0x1befdd[_0x3a3e('0x3')]instanceof Buffer){fs['writeFile'](_0x5cfc15,_0x1befdd['AudioStream'],function(_0x553987){if(_0x553987){_0x54b0c5(_0x553987);}else{_0x2a2a8a();}});}else{_0x54b0c5(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x54b0c5(new Error(_0x3a3e('0x4')));}});});}module[_0x3a3e('0x5')]=function(_0x149326,_0x431c9f,_0x4f0c86,_0x2fe39a,_0x971fbd,_0x75b438,_0xcecb24){var _0x430314=new AWS[(_0x3a3e('0x6'))]({'accessKeyId':_0x149326,'secretAccessKey':_0x431c9f,'region':_0x4f0c86});var _0x1a68ac={'Text':_0x971fbd,'TextType':_0x75b438||_0x3a3e('0x7'),'OutputFormat':_0x3a3e('0x8'),'VoiceId':_0x2fe39a};return pollyResult(_0x430314,_0x1a68ac,_0xcecb24);}; \ 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 965ef2c..ff410e0 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 _0xa50a=['exports','./lib/api'];(function(_0x292f35,_0x72e859){var _0x288e75=function(_0x1bba68){while(--_0x1bba68){_0x292f35['push'](_0x292f35['shift']());}};_0x288e75(++_0x72e859);}(_0xa50a,0x13b));var _0xaa50=function(_0x3ae516,_0x4b97c5){_0x3ae516=_0x3ae516-0x0;var _0x2b257a=_0xa50a[_0x3ae516];return _0x2b257a;};'use strict';var asr=require(_0xaa50('0x0'));module[_0xaa50('0x1')]=function(_0x5ebea7,_0x38fd81,_0xf8f6e0,_0xb5d891){return asr(_0x5ebea7,_0x38fd81,_0xf8f6e0);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x164127,_0x1f890e,_0x48a56e,_0x24199e){return asr(_0x164127,_0x1f890e,_0x48a56e);}; \ 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 c8632b8..c6d8638 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 _0xed7f=['https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xed7f,0x8e));var _0xfed7=function(_0x8fb092,_0x883290){_0x8fb092=_0x8fb092-0x0;var _0xd63883=_0xed7f[_0x8fb092];return _0xd63883;};'use strict';var url=require('url');var BPromise=require(_0xfed7('0x0'));var fs=require('fs');var host=_0xfed7('0x1');module['exports']=function(_0x294b31,_0xb6bac0,_0x5a594a){return new BPromise(function(_0x386209,_0x23286b){var _0xf4941b;if(typeof _0x294b31!=='string'||_0x294b31[_0xfed7('0x2')]===0x0){return _0x23286b(_0xfed7('0x3'));}if(typeof _0xb6bac0!==_0xfed7('0x4')||_0xb6bac0[_0xfed7('0x2')]===0x0){return _0x23286b(_0xfed7('0x5'));}if(typeof _0x5a594a!=='undefined'&&(typeof _0x5a594a!==_0xfed7('0x4')||_0x5a594a[_0xfed7('0x2')]===0x0)){return _0x23286b('lang\x20should\x20be\x20a\x20string');}try{_0xf4941b=fs[_0xfed7('0x6')](_0x294b31)['toString'](_0xfed7('0x7'));}catch(_0x12effe){return _0x23286b(_0x12effe);}return _0x386209({'method':_0xfed7('0x8'),'uri':host+_0xfed7('0x9')+_0xb6bac0,'body':{'config':{'encoding':_0xfed7('0xa'),'sampleRateHertz':'8000','languageCode':_0x5a594a},'audio':{'content':_0xf4941b}},'json':!![]});});}; \ No newline at end of file +var _0x2a10=['url','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key='];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x2a10,0x108));var _0x02a1=function(_0x53b50e,_0xc49361){_0x53b50e=_0x53b50e-0x0;var _0x3f8625=_0x2a10[_0x53b50e];return _0x3f8625;};'use strict';var url=require(_0x02a1('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x02a1('0x1')]=function(_0x467a16,_0x5ea835,_0x4e120a){return new BPromise(function(_0x1b9a0d,_0x262413){var _0x48142a;if(typeof _0x467a16!==_0x02a1('0x2')||_0x467a16[_0x02a1('0x3')]===0x0){return _0x262413(_0x02a1('0x4'));}if(typeof _0x5ea835!==_0x02a1('0x2')||_0x5ea835[_0x02a1('0x3')]===0x0){return _0x262413(_0x02a1('0x5'));}if(typeof _0x4e120a!==_0x02a1('0x6')&&(typeof _0x4e120a!=='string'||_0x4e120a[_0x02a1('0x3')]===0x0)){return _0x262413(_0x02a1('0x7'));}try{_0x48142a=fs[_0x02a1('0x8')](_0x467a16)['toString'](_0x02a1('0x9'));}catch(_0x219bbd){return _0x262413(_0x219bbd);}return _0x1b9a0d({'method':_0x02a1('0xa'),'uri':host+_0x02a1('0xb')+_0x5ea835,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x4e120a},'audio':{'content':_0x48142a}},'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 a79d4a7..8c3617f 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 _0x9bca=['./asr','exports'];(function(_0x489d12,_0x5baaf4){var _0x27a102=function(_0x29475c){while(--_0x29475c){_0x489d12['push'](_0x489d12['shift']());}};_0x27a102(++_0x5baaf4);}(_0x9bca,0x8c));var _0xa9bc=function(_0x798084,_0x566195){_0x798084=_0x798084-0x0;var _0x4f1484=_0x9bca[_0x798084];return _0x4f1484;};var asr=require(_0xa9bc('0x0'));module[_0xa9bc('0x1')]={'asr':asr}; \ No newline at end of file +var _0xdac8=['./asr'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdac8,0x74));var _0x8dac=function(_0x43aded,_0x395b7e){_0x43aded=_0x43aded-0x0;var _0x38c5ea=_0xdac8[_0x43aded];return _0x38c5ea;};var asr=require(_0x8dac('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index d3aa91b..4892cd0 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 _0xf81b=['score','metadata','endConversation','googleDialogflowV2','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','protocol','data','end','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','POST','generate','from','writeFile','chmodSync','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','log','TRY\x20TO\x20GET2','RET:','RET\x20slic:','slice','eval\x20RET\x20slic:','AFTER\x20SLICE','ERR','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','buffer2','.mp3','filepath','desdt','goggleTTS\x20path','destination\x20ended\x202\x20da\x20gen','googleASR','asr','results','map','alternatives','transcript','join','confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech'];(function(_0x5b73af,_0x493a6b){var _0x353b8b=function(_0xa34258){while(--_0xa34258){_0x5b73af['push'](_0x5b73af['shift']());}};_0x353b8b(++_0x493a6b);}(_0xf81b,0x1cc));var _0xbf81=function(_0x5c6e86,_0x527295){_0x5c6e86=_0x5c6e86-0x0;var _0x473974=_0xf81b[_0x5c6e86];return _0x473974;};'use strict';var apiai=require(_0xbf81('0x0'));var BPromise=require(_0xbf81('0x1'));var dialogflow=require(_0xbf81('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xbf81('0x3'));var md5=require('md5');var path=require(_0xbf81('0x4'));var querystring=require(_0xbf81('0x5'));var rp=require(_0xbf81('0x6'));var rs=require(_0xbf81('0x7'));var sox=require(_0xbf81('0x8'));var tts=require(_0xbf81('0x9'));var urlParse=require(_0xbf81('0xa'))[_0xbf81('0xb')];var util=require('util');var aws=require(_0xbf81('0xc'));var google=require(_0xbf81('0xd'));var sestek=require(_0xbf81('0xe'));var tilde=require('./tilde');var logger=require('../../../config/logger')('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xc9c979,_0x5e2502){return new BPromise(function(_0x595537,_0x5cfa5e){var _0x5375ea=urlParse(_0xc9c979);var _0x19da0c=_0x5375ea['protocol']===_0xbf81('0xf')?https:http;var _0x2516a8={'host':_0x5375ea[_0xbf81('0x10')],'path':_0x5375ea[_0xbf81('0x4')],'headers':{'user-agent':_0xbf81('0x11')}};_0x19da0c[_0xbf81('0x12')](_0x2516a8,function(_0x394222){if(_0x394222['statusCode']!==0xc8){logger[_0xbf81('0x13')](_0xbf81('0x14')+_0xc9c979+_0xbf81('0x15')+_0x394222[_0xbf81('0x16')]+'\x20('+_0x394222[_0xbf81('0x17')]+')');_0x5cfa5e(new Error(_0xbf81('0x14')+_0xc9c979+_0xbf81('0x15')+_0x394222[_0xbf81('0x16')]+'\x20('+_0x394222[_0xbf81('0x17')]+')'));return;}var _0x5461c2=fs[_0xbf81('0x18')](_0x5e2502);_0x5461c2['on'](_0xbf81('0x19'),function(){logger[_0xbf81('0x1a')](_0xbf81('0x1b'));_0x5461c2[_0xbf81('0x1c')](_0x595537);});_0x5461c2['on'](_0xbf81('0x13'),function(_0x426877){fs[_0xbf81('0x1d')](_0x5e2502);logger[_0xbf81('0x13')](_0xbf81('0x1e'),_0x426877);_0x5cfa5e(_0x426877);});_0x394222[_0xbf81('0x1f')](_0x5461c2);})['on'](_0xbf81('0x13'),function(_0x3be07f){logger['error'](_0x3be07f);_0x5cfa5e(_0x3be07f);})['end']();});}function uploadFile(_0x53da67){return new BPromise(function(_0x55873a,_0x3e4e43){var _0x10e17e=urlParse(_0x53da67);var _0x55a973=_0x10e17e[_0xbf81('0x20')]===_0xbf81('0xf')?https:http;var _0x1df76f={'host':_0x10e17e['host'],'path':_0x10e17e[_0xbf81('0x4')],'headers':{'user-agent':_0xbf81('0x11')}};_0x55a973[_0xbf81('0x12')](_0x1df76f,function(_0x3b6b96){if(_0x3b6b96[_0xbf81('0x16')]!==0xc8){_0x3e4e43(new Error(_0xbf81('0x14')+_0x53da67+_0xbf81('0x15')+_0x3b6b96[_0xbf81('0x16')]+'\x20('+_0x3b6b96[_0xbf81('0x17')]+')'));return;}var _0x1425f0='';_0x3b6b96['on'](_0xbf81('0x21'),function(_0x3130d8){_0x1425f0+=_0x3130d8;});_0x3b6b96['on'](_0xbf81('0x22'),function(){_0x55873a(_0x1425f0);});})['on']('error',function(_0x1d070e){_0x3e4e43(_0x1d070e);})[_0xbf81('0x22')]();});}function convertFile(_0x4263af,_0x2f637c){return new BPromise(function(_0x38f6fb,_0x4f7e61){var _0x488d3f=sox[_0xbf81('0x23')](_0x4263af,_0x2f637c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x488d3f['on']('error',function(_0x311ab5){logger[_0xbf81('0x13')](_0xbf81('0x24'),_0x311ab5);_0x4f7e61(_0x311ab5);});_0x488d3f['on']('end',function(){logger[_0xbf81('0x1a')](_0xbf81('0x25'));_0x38f6fb();});_0x488d3f['start']();});}function base64Decode(_0x183258,_0x4ec0ce){var _0x46c037=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs['generate'](0x4)+_0xbf81('0x28'));fs[_0xbf81('0x29')](_0x46c037,_0x183258,_0xbf81('0x2a'));return convertFile(_0x46c037,_0x4ec0ce)[_0xbf81('0x2b')](function(){try{fs[_0xbf81('0x1d')](_0x46c037);fs['chmodSync'](_0x4ec0ce,_0xbf81('0x2c'));}catch(_0x1cb38d){logger[_0xbf81('0x13')](_0x1cb38d);}return _0x4ec0ce[_0xbf81('0x2d')]('.')[0x0];});}function base64Encode(_0x4b7551){var _0x57940f=fs[_0xbf81('0x2e')](_0x4b7551);return new Buffer(_0x57940f)['toString'](_0xbf81('0x2a'));}exports[_0xbf81('0x2f')]=function(_0x10c6ee,_0x474cd4,_0x5b091e,_0x1e2f81,_0x3e1beb,_0x20dbc6){var _0x12abda,_0x41c4e7;var _0x1883cb='https://texttospeech.googleapis.com/v1/';var _0x5d2031=_0xbf81('0x30')+_0x10c6ee;var _0x3fc662={};if(_0x474cd4===_0xbf81('0x31')){_0x3fc662[_0xbf81('0x32')]={'ssml':_0x5b091e};}else{_0x3fc662['input']={'text':_0x5b091e};};_0x3fc662[_0xbf81('0x33')]={'languageCode':_0x1e2f81,'ssmlGender':_0x3e1beb};_0x3fc662[_0xbf81('0x34')]={'audioEncoding':_0xbf81('0x35'),'sampleRateHertz':0x1f40};var _0x5cba65={'url':_0x1883cb+'text:synthesize'+_0x5d2031,'method':_0xbf81('0x36'),'json':!![],'body':_0x3fc662};return rp(_0x5cba65)['then'](function(_0x350f1c){return new BPromise(function(_0x54de33,_0x9ba861){_0x12abda=path['resolve'](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+'.mp3');var _0x3e6392=Buffer[_0xbf81('0x38')](_0x350f1c['audioContent'],'base64');return fs[_0xbf81('0x39')](_0x12abda,_0x3e6392,function(_0x1c4891){_0x9ba861(_0x1c4891);},function(_0x2d65bb){fs[_0xbf81('0x3a')](_0x12abda,_0xbf81('0x2c'));_0x54de33(_0x2d65bb);});});})['then'](function(_0x1f313a){_0x41c4e7=path['resolve'](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+'.wav');return convertFile(_0x12abda,_0x41c4e7);})[_0xbf81('0x2b')](function(){try{fs[_0xbf81('0x1d')](_0x12abda);fs[_0xbf81('0x3a')](_0x41c4e7,_0xbf81('0x2c'));}catch(_0x4890ed){logger[_0xbf81('0x13')](_0x4890ed);}logger['info']('googleCloudTTS\x20path',_0x41c4e7[_0xbf81('0x2d')]('.')[0x0]);return _0x41c4e7[_0xbf81('0x2d')]('.')[0x0];});};exports[_0xbf81('0x3b')]=function(_0x34d56f,_0x3d9b8d){var _0x5dbf88,_0x165c4b;var _0x598dc6;var _0x4a318f={'encoding':'utf8','method':_0xbf81('0x36'),'timeout':0x2710,'url':_0xbf81('0x3c'),'headers':{'Content-Type':_0xbf81('0x3d')},'body':_0xbf81('0x3e')+encodeURIComponent(JSON['stringify']([[[_0xbf81('0x3f'),JSON[_0xbf81('0x40')]([_0x34d56f,_0x3d9b8d||'en-US',![],'null']),null,'generic']]]))};console[_0xbf81('0x41')](_0xbf81('0x42'),_0x4a318f);return rp(_0x4a318f)[_0xbf81('0x2b')](function(_0x313a4f){console[_0xbf81('0x41')](_0xbf81('0x43'),_0x313a4f);try{console[_0xbf81('0x41')](_0xbf81('0x44'),_0x313a4f[_0xbf81('0x45')](0x5));console[_0xbf81('0x41')](_0xbf81('0x46'),eval(_0x313a4f[_0xbf81('0x45')](0x5))[0x0][0x2]);_0x598dc6=eval(_0x313a4f[_0xbf81('0x45')](0x5))[0x0][0x2];console[_0xbf81('0x41')](_0xbf81('0x47'),_0x598dc6);}catch(_0x5b8864){console[_0xbf81('0x41')](_0xbf81('0x48'),_0x5b8864);throw new Error(_0xbf81('0x49')+res[_0xbf81('0x21')]);}if(!_0x598dc6){throw new Error(_0xbf81('0x4a')+lang+_0xbf81('0x4b'));}try{_0x598dc6=eval(_0x598dc6)[0x0];}catch(_0x2a204c){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xbf81('0x21')]);}console[_0xbf81('0x41')]('REPONSE2',_0x598dc6);const _0x291be6=_0x598dc6;console['log'](_0xbf81('0x4c'),_0x291be6);_0x5dbf88=path[_0xbf81('0x26')](__dirname,'tmp',rs[_0xbf81('0x37')](0x4)+_0xbf81('0x4d'));console['log'](_0xbf81('0x4e'),_0x5dbf88);fs[_0xbf81('0x29')](_0x5dbf88,_0x598dc6,{'encoding':'base64'});_0x165c4b=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+'.wav');console['log'](_0xbf81('0x4f'),_0x165c4b);return convertFile(_0x5dbf88,_0x165c4b);})[_0xbf81('0x2b')](function(){try{console[_0xbf81('0x41')]('desdt',_0x165c4b);fs['chmodSync'](_0x165c4b,'777');}catch(_0x2a7d62){logger['error'](_0x2a7d62);}logger[_0xbf81('0x1a')](_0xbf81('0x50'),_0x165c4b[_0xbf81('0x2d')]('.')[0x0]);console['log'](_0xbf81('0x51'),_0x165c4b[_0xbf81('0x2d')]('.')[0x0]);return _0x165c4b['split']('.')[0x0];});};exports[_0xbf81('0x52')]=function(_0x8af1b3,_0x1dcdc2,_0x376e4d){return google[_0xbf81('0x53')](_0x8af1b3,_0x1dcdc2,_0x376e4d)[_0xbf81('0x2b')](function(_0xc78be4){logger['info'](_0xc78be4['uri']);return rp(_0xc78be4);})['then'](function(_0x327daf){var _0x3c985c='';var _0x24592b=0x0;try{fs[_0xbf81('0x1d')](_0x8af1b3);}catch(_0x41d4bd){logger[_0xbf81('0x13')](_0x41d4bd);}if(_0x327daf&&_0x327daf[_0xbf81('0x54')]){_0x3c985c=_0x327daf[_0xbf81('0x54')][_0xbf81('0x55')](function(_0x1de0df){return _0x1de0df&&_0x1de0df['alternatives'][0x0]&&_0x1de0df[_0xbf81('0x56')][0x0][_0xbf81('0x57')]?_0x1de0df['alternatives'][0x0]['transcript']:'';})[_0xbf81('0x58')]('\x0a');_0x24592b=_0x327daf['results']['map'](function(_0x46e5a9){return _0x46e5a9&&_0x46e5a9['alternatives'][0x0]&&_0x46e5a9['alternatives'][0x0][_0xbf81('0x59')]?_0x46e5a9['alternatives'][0x0]['confidence']:0x0;})[_0xbf81('0x58')]('\x0a');}logger[_0xbf81('0x1a')]('googleASR\x20transcription',_0x3c985c);logger[_0xbf81('0x1a')]('googleASR\x20confidence',_0x24592b);return{'transcript':_0x3c985c,'confidence':_0x24592b};})['catch'](function(_0x39fbd2){logger[_0xbf81('0x13')](_0xbf81('0x5a'),_0x39fbd2[_0xbf81('0x16')],_0x39fbd2[_0xbf81('0x5b')],_0x39fbd2[_0xbf81('0x5c')]);});};exports[_0xbf81('0x5d')]=function(_0x2df6b9,_0x503b06,_0x9c2c9d,_0x3dc7d8){var _0x30a381=apiai(_0x503b06,{'language':_0x3dc7d8||'en'});return _0x30a381[_0xbf81('0x5e')](_0x9c2c9d,{'sessionId':md5(_0x2df6b9)})[_0xbf81('0x2b')](function(_0x1bdae0){logger[_0xbf81('0x1a')](JSON[_0xbf81('0x40')](_0x1bdae0));return{'source':_0x1bdae0[_0xbf81('0x5f')]['source'],'resolvedQuery':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x60')],'action':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x61')],'actionIncomplete':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x62')],'speech':_0x1bdae0['result']['fulfillment'][_0xbf81('0x63')],'score':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x64')],'statusCode':_0x1bdae0['status']['code'],'endConversation':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x65')][_0xbf81('0x66')]||![],'isFallbackIntent':_0x1bdae0[_0xbf81('0x5f')]['metadata']['isFallbackIntent']};});};exports[_0xbf81('0x67')]=function(_0x123b16,_0x15259c,_0x43f4f5,_0x50ce97,_0x518757,_0x2077f6){var _0x2a8772=_0x50ce97['replace'](/\\n/g,'\x0a');var _0x551ad2={'credentials':{'private_key':_0x2a8772,'client_email':_0x43f4f5}};var _0x2a40e0=new dialogflow['SessionsClient'](_0x551ad2);var _0x146573=_0x2a40e0[_0xbf81('0x68')](_0x15259c,md5(_0x123b16));var _0x443f7e={'session':_0x146573,'queryInput':{'text':{'text':_0x518757,'languageCode':_0x2077f6}}};return _0x2a40e0[_0xbf81('0x69')](_0x443f7e)[_0xbf81('0x2b')](function(_0xcf47ee){if(_0xcf47ee&&_0xcf47ee[_0xbf81('0x6a')]){logger[_0xbf81('0x1a')]('Dialogflow\x20V2\x20response:',JSON[_0xbf81('0x40')](_0xcf47ee));var _0x5fc19b=_0xcf47ee[0x0];if(_0x5fc19b){var _0x988b1b={'action':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x61')],'allRequiredParamsPresent':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x6c')],'endConversation':_0x5fc19b[_0xbf81('0x6b')]['diagnosticInfo']&&_0x5fc19b[_0xbf81('0x6b')]['diagnosticInfo'][_0xbf81('0x6d')]?_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x6e')][_0xbf81('0x6d')][_0xbf81('0x6f')][_0xbf81('0x70')]:![],'fulfillmentText':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x71')],'intentName':_0x5fc19b[_0xbf81('0x6b')]['intent'][_0xbf81('0x5b')],'intentDisplayName':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x72')][_0xbf81('0x73')],'isFallbackIntent':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x72')][_0xbf81('0x74')],'languageCode':_0x5fc19b['queryResult']['languageCode'],'queryText':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x75')],'responseId':_0x5fc19b[_0xbf81('0x76')],'score':_0x5fc19b['queryResult']['intentDetectionConfidence'],'speech':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x71')],'providerResponse':JSON[_0xbf81('0x40')](_0xcf47ee)};return _0x988b1b;}}});};exports[_0xbf81('0x77')]=function(_0xfddf3c,_0x4578c2,_0x588594,_0x30f902){return tilde[_0xbf81('0x53')](_0xfddf3c,_0x4578c2,_0x588594,_0x30f902)[_0xbf81('0x2b')](function(_0x4eaeed){try{fs[_0xbf81('0x1d')](_0xfddf3c);}catch(_0x5aeec2){logger[_0xbf81('0x13')](_0x5aeec2);}logger['info']('Tilde\x20ASR\x20transcription',_0x4eaeed[_0xbf81('0x57')]);logger[_0xbf81('0x1a')](_0xbf81('0x78'),_0x4eaeed[_0xbf81('0x59')]);return _0x4eaeed;});};exports[_0xbf81('0x79')]=function(_0x3a3768,_0x5d5202,_0x494ac7,_0xabd852,_0x118d88,_0x5eb36d){var _0x3b39dc=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x4d'));var _0xafd356;return aws[_0xbf81('0x7a')](_0x3a3768,_0x5d5202,_0x494ac7,_0xabd852,_0x118d88,_0x5eb36d,_0x3b39dc)[_0xbf81('0x2b')](function(){_0xafd356=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x28'));return convertFile(_0x3b39dc,_0xafd356);})['then'](function(){try{fs[_0xbf81('0x1d')](_0x3b39dc);fs[_0xbf81('0x3a')](_0xafd356,_0xbf81('0x2c'));}catch(_0x2787a3){logger[_0xbf81('0x13')](_0x2787a3);}return _0xafd356[_0xbf81('0x2d')]('.')[0x0];});};exports[_0xbf81('0x7b')]=function(_0xa8c980,_0x45ba4f,_0x3da0c2,_0x13bb58,_0x31e31f,_0x1f7ac7){return aws[_0xbf81('0x7c')](_0xa8c980,_0x45ba4f,_0x3da0c2,_0x13bb58,_0x31e31f,_0x1f7ac7)[_0xbf81('0x2b')](function(_0x5431c7){logger[_0xbf81('0x1a')](JSON[_0xbf81('0x40')](_0x5431c7));return _0x5431c7;});};exports[_0xbf81('0x7d')]=function(_0x2e3975,_0x1476c9,_0x2c1d64,_0xec8c1a){var _0xc81d56=util['format'](_0xbf81('0x7e'),ISPEECH_API,_0x2e3975,encodeURIComponent(_0x1476c9),_0x2c1d64,_0xec8c1a);var _0x31555d=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs['generate'](0x4)+'.mp3');var _0x14286c;return downloadFile(_0xc81d56,_0x31555d)['then'](function(){_0x14286c=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x28'));return convertFile(_0x31555d,_0x14286c);})[_0xbf81('0x2b')](function(){try{fs[_0xbf81('0x1d')](_0x31555d);fs['chmodSync'](_0x14286c,_0xbf81('0x2c'));}catch(_0x316724){logger[_0xbf81('0x13')](_0x316724);}return _0x14286c[_0xbf81('0x2d')]('.')[0x0];});};exports[_0xbf81('0x7f')]=function(_0x5d9d33,_0x47d5bd,_0x2cb53a,_0x18e858){var _0x1189c3=util[_0xbf81('0x80')](_0xbf81('0x81'),ISPEECH_API,_0x47d5bd,_0x2cb53a,base64Encode(_0x5d9d33),_0x18e858?util[_0xbf81('0x80')](_0xbf81('0x82'),encodeURIComponent(_0x18e858)):_0xbf81('0x83'));return uploadFile(_0x1189c3)[_0xbf81('0x2b')](function(_0x4b25c6){return querystring[_0xbf81('0xb')](_0x4b25c6);});};exports[_0xbf81('0x84')]=function(_0x92625d,_0x36bb63){return sestek['nda'](_0x92625d,_0x36bb63)['then'](function(_0x111191){logger[_0xbf81('0x1a')](JSON[_0xbf81('0x40')](_0x111191));var _0x23fbc7={'speech':_0x111191[_0xbf81('0x85')],'action':_0x111191[_0xbf81('0x86')]?_0x111191[_0xbf81('0x86')][_0xbf81('0x87')]:undefined,'actiondata':_0x111191[_0xbf81('0x86')]?_0x111191[_0xbf81('0x86')][_0xbf81('0x88')]:undefined};if(_0x111191['channelData']&&_0x111191[_0xbf81('0x86')][_0xbf81('0x89')]){return base64Decode(_0x111191[_0xbf81('0x86')]['AudioFromTts']['Data'],path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x28')))['then'](function(_0x2f3de9){_0x23fbc7[_0xbf81('0x8a')]=_0x2f3de9;return _0x23fbc7;});}return _0x23fbc7;});};exports[_0xbf81('0x8b')]=function(){return __dirname;}; \ No newline at end of file +var _0x0036=['createWriteStream','info','finish\x20download\x20file','close','error','download\x20error','pipe','end','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','generate','.wav','writeFileSync','base64','then','777','split','toString','googleCloudTTS','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','tmp','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','en-US','null','generic','TRY\x20TO\x20GET2','log','RET:','RET\x20slic:','slice','eval\x20RET\x20slic:','ERR','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','REPONSE2','filepath','desdt','destination\x20ended\x202\x20da\x20gen','googleASR','asr','uri','unlink','results','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','source','resolvedQuery','result','action','actionIncomplete','fulfillment','score','status','metadata','googleDialogflowV2','SessionsClient','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage'];(function(_0x56f065,_0x3287ad){var _0xc1ee9b=function(_0x3b3ece){while(--_0x3b3ece){_0x56f065['push'](_0x56f065['shift']());}};_0xc1ee9b(++_0x3287ad);}(_0x0036,0x73));var _0x6003=function(_0x17a185,_0x468a5b){_0x17a185=_0x17a185-0x0;var _0x26e222=_0x0036[_0x17a185];return _0x26e222;};'use strict';var apiai=require(_0x6003('0x0'));var BPromise=require(_0x6003('0x1'));var dialogflow=require(_0x6003('0x2'));var fs=require('fs');var http=require(_0x6003('0x3'));var https=require(_0x6003('0x4'));var md5=require(_0x6003('0x5'));var path=require(_0x6003('0x6'));var querystring=require(_0x6003('0x7'));var rp=require(_0x6003('0x8'));var rs=require(_0x6003('0x9'));var sox=require(_0x6003('0xa'));var tts=require(_0x6003('0xb'));var urlParse=require(_0x6003('0xc'))[_0x6003('0xd')];var util=require(_0x6003('0xe'));var aws=require('./aws');var google=require(_0x6003('0xf'));var sestek=require(_0x6003('0x10'));var tilde=require(_0x6003('0x11'));var logger=require(_0x6003('0x12'))(_0x6003('0x13'));var ISPEECH_API=_0x6003('0x14');function downloadFile(_0x5eefbe,_0x49c7f5){return new BPromise(function(_0x4487d6,_0x49c2c0){var _0x576af2=urlParse(_0x5eefbe);var _0x4350e=_0x576af2[_0x6003('0x15')]===_0x6003('0x16')?https:http;var _0x2ce5c7={'host':_0x576af2[_0x6003('0x17')],'path':_0x576af2[_0x6003('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x4350e[_0x6003('0x18')](_0x2ce5c7,function(_0x5475fb){if(_0x5475fb[_0x6003('0x19')]!==0xc8){logger['error'](_0x6003('0x1a')+_0x5eefbe+_0x6003('0x1b')+_0x5475fb[_0x6003('0x19')]+'\x20('+_0x5475fb[_0x6003('0x1c')]+')');_0x49c2c0(new Error(_0x6003('0x1a')+_0x5eefbe+_0x6003('0x1b')+_0x5475fb[_0x6003('0x19')]+'\x20('+_0x5475fb['statusMessage']+')'));return;}var _0x1cbf3d=fs[_0x6003('0x1d')](_0x49c7f5);_0x1cbf3d['on']('finish',function(){logger[_0x6003('0x1e')](_0x6003('0x1f'));_0x1cbf3d[_0x6003('0x20')](_0x4487d6);});_0x1cbf3d['on']('error',function(_0x335f8c){fs['unlink'](_0x49c7f5);logger[_0x6003('0x21')](_0x6003('0x22'),_0x335f8c);_0x49c2c0(_0x335f8c);});_0x5475fb[_0x6003('0x23')](_0x1cbf3d);})['on'](_0x6003('0x21'),function(_0x1c2512){logger[_0x6003('0x21')](_0x1c2512);_0x49c2c0(_0x1c2512);})[_0x6003('0x24')]();});}function uploadFile(_0x397cd6){return new BPromise(function(_0x5d08a3,_0x4e71ec){var _0x25ead1=urlParse(_0x397cd6);var _0x451b9f=_0x25ead1[_0x6003('0x15')]===_0x6003('0x16')?https:http;var _0x4a6508={'host':_0x25ead1[_0x6003('0x17')],'path':_0x25ead1['path'],'headers':{'user-agent':_0x6003('0x25')}};_0x451b9f[_0x6003('0x18')](_0x4a6508,function(_0x2e85d6){if(_0x2e85d6[_0x6003('0x19')]!==0xc8){_0x4e71ec(new Error(_0x6003('0x1a')+_0x397cd6+_0x6003('0x1b')+_0x2e85d6[_0x6003('0x19')]+'\x20('+_0x2e85d6[_0x6003('0x1c')]+')'));return;}var _0x2a4559='';_0x2e85d6['on'](_0x6003('0x26'),function(_0x34aff7){_0x2a4559+=_0x34aff7;});_0x2e85d6['on']('end',function(){_0x5d08a3(_0x2a4559);});})['on'](_0x6003('0x21'),function(_0x1d7bdd){_0x4e71ec(_0x1d7bdd);})[_0x6003('0x24')]();});}function convertFile(_0x40288f,_0x2d12ae){return new BPromise(function(_0x3c4476,_0x290b37){var _0x2033fb=sox[_0x6003('0x27')](_0x40288f,_0x2d12ae,{'sampleRate':0x1f40,'format':_0x6003('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2033fb['on'](_0x6003('0x21'),function(_0x161a36){logger[_0x6003('0x21')](_0x6003('0x29'),_0x161a36);_0x290b37(_0x161a36);});_0x2033fb['on'](_0x6003('0x24'),function(){logger[_0x6003('0x1e')](_0x6003('0x2a'));_0x3c4476();});_0x2033fb[_0x6003('0x2b')]();});}function base64Decode(_0x4b7cb5,_0x18af3e){var _0x4e85f3=path['resolve'](__dirname,'tmp',rs[_0x6003('0x2c')](0x4)+_0x6003('0x2d'));fs[_0x6003('0x2e')](_0x4e85f3,_0x4b7cb5,_0x6003('0x2f'));return convertFile(_0x4e85f3,_0x18af3e)[_0x6003('0x30')](function(){try{fs['unlink'](_0x4e85f3);fs['chmodSync'](_0x18af3e,_0x6003('0x31'));}catch(_0x31e817){logger[_0x6003('0x21')](_0x31e817);}return _0x18af3e[_0x6003('0x32')]('.')[0x0];});}function base64Encode(_0x29486d){var _0x4a65b1=fs['readFileSync'](_0x29486d);return new Buffer(_0x4a65b1)[_0x6003('0x33')](_0x6003('0x2f'));}exports[_0x6003('0x34')]=function(_0x9cefa8,_0x310683,_0x422f8a,_0x4920df,_0x46d30d,_0x4f1fd7){var _0x35d066,_0x440edc;var _0x51f7b2='https://texttospeech.googleapis.com/v1/';var _0x46d937=_0x6003('0x35')+_0x9cefa8;var _0x56a4b2={};if(_0x310683==='ssml'){_0x56a4b2[_0x6003('0x36')]={'ssml':_0x422f8a};}else{_0x56a4b2[_0x6003('0x36')]={'text':_0x422f8a};};_0x56a4b2[_0x6003('0x37')]={'languageCode':_0x4920df,'ssmlGender':_0x46d30d};_0x56a4b2[_0x6003('0x38')]={'audioEncoding':_0x6003('0x39'),'sampleRateHertz':0x1f40};var _0xa9eed1={'url':_0x51f7b2+_0x6003('0x3a')+_0x46d937,'method':_0x6003('0x3b'),'json':!![],'body':_0x56a4b2};return rp(_0xa9eed1)['then'](function(_0x446341){return new BPromise(function(_0x149399,_0x4fa8e7){_0x35d066=path[_0x6003('0x3c')](__dirname,_0x6003('0x3d'),rs['generate'](0x4)+_0x6003('0x3e'));var _0x52dda9=Buffer[_0x6003('0x3f')](_0x446341[_0x6003('0x40')],_0x6003('0x2f'));return fs[_0x6003('0x41')](_0x35d066,_0x52dda9,function(_0xa4379e){_0x4fa8e7(_0xa4379e);},function(_0xa6946f){fs[_0x6003('0x42')](_0x35d066,_0x6003('0x31'));_0x149399(_0xa6946f);});});})[_0x6003('0x30')](function(_0x1b3ac8){_0x440edc=path['resolve'](__dirname,_0x6003('0x3d'),rs[_0x6003('0x2c')](0x4)+'.wav');return convertFile(_0x35d066,_0x440edc);})[_0x6003('0x30')](function(){try{fs['unlink'](_0x35d066);fs[_0x6003('0x42')](_0x440edc,'777');}catch(_0x52e20f){logger[_0x6003('0x21')](_0x52e20f);}logger[_0x6003('0x1e')](_0x6003('0x43'),_0x440edc[_0x6003('0x32')]('.')[0x0]);return _0x440edc[_0x6003('0x32')]('.')[0x0];});};exports['googleTTS']=function(_0x401df6,_0x545243){var _0x42723a,_0xcd87e8;var _0x32e67a;var _0x3f3031={'encoding':_0x6003('0x44'),'method':_0x6003('0x3b'),'timeout':0x2710,'url':'https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','headers':{'Content-Type':_0x6003('0x45')},'body':_0x6003('0x46')+encodeURIComponent(JSON[_0x6003('0x47')]([[[_0x6003('0x48'),JSON['stringify']([_0x401df6,_0x545243||_0x6003('0x49'),![],_0x6003('0x4a')]),null,_0x6003('0x4b')]]]))};console['log'](_0x6003('0x4c'),_0x3f3031);return rp(_0x3f3031)[_0x6003('0x30')](function(_0x487fe7){console[_0x6003('0x4d')](_0x6003('0x4e'),_0x487fe7);try{console[_0x6003('0x4d')](_0x6003('0x4f'),_0x487fe7[_0x6003('0x50')](0x5));console[_0x6003('0x4d')](_0x6003('0x51'),eval(_0x487fe7[_0x6003('0x50')](0x5))[0x0][0x2]);_0x32e67a=eval(_0x487fe7[_0x6003('0x50')](0x5))[0x0][0x2];console[_0x6003('0x4d')]('AFTER\x20SLICE',_0x32e67a);}catch(_0x5f9f0c){console[_0x6003('0x4d')](_0x6003('0x52'),_0x5f9f0c);throw new Error(_0x6003('0x53')+res['data']);}if(!_0x32e67a){throw new Error(_0x6003('0x54')+lang+_0x6003('0x55'));}try{_0x32e67a=eval(_0x32e67a)[0x0];}catch(_0x5509fa){throw new Error(_0x6003('0x53')+res['data']);}console['log'](_0x6003('0x56'),_0x32e67a);const _0x4d174e=_0x32e67a;console['log']('buffer2',_0x4d174e);_0x42723a=path[_0x6003('0x3c')](__dirname,_0x6003('0x3d'),rs['generate'](0x4)+'.mp3');console['log'](_0x6003('0x57'),_0x42723a);fs[_0x6003('0x2e')](_0x42723a,_0x32e67a,{'encoding':_0x6003('0x2f')});_0xcd87e8=path[_0x6003('0x3c')](__dirname,_0x6003('0x3d'),rs[_0x6003('0x2c')](0x4)+_0x6003('0x2d'));console['log'](_0x6003('0x58'),_0xcd87e8);return convertFile(_0x42723a,_0xcd87e8);})['then'](function(){try{console[_0x6003('0x4d')]('desdt',_0xcd87e8);fs[_0x6003('0x42')](_0xcd87e8,'777');}catch(_0x271010){logger[_0x6003('0x21')](_0x271010);}logger[_0x6003('0x1e')]('goggleTTS\x20path',_0xcd87e8['split']('.')[0x0]);console['log'](_0x6003('0x59'),_0xcd87e8[_0x6003('0x32')]('.')[0x0]);return _0xcd87e8['split']('.')[0x0];});};exports[_0x6003('0x5a')]=function(_0xf8af50,_0x1856d6,_0x4604b5){return google[_0x6003('0x5b')](_0xf8af50,_0x1856d6,_0x4604b5)['then'](function(_0x7ea4ce){logger[_0x6003('0x1e')](_0x7ea4ce[_0x6003('0x5c')]);return rp(_0x7ea4ce);})[_0x6003('0x30')](function(_0x57aa0c){var _0x3acf2f='';var _0x535e06=0x0;try{fs[_0x6003('0x5d')](_0xf8af50);}catch(_0x2df334){logger['error'](_0x2df334);}if(_0x57aa0c&&_0x57aa0c[_0x6003('0x5e')]){_0x3acf2f=_0x57aa0c['results']['map'](function(_0x41d204){return _0x41d204&&_0x41d204[_0x6003('0x5f')][0x0]&&_0x41d204[_0x6003('0x5f')][0x0][_0x6003('0x60')]?_0x41d204[_0x6003('0x5f')][0x0]['transcript']:'';})[_0x6003('0x61')]('\x0a');_0x535e06=_0x57aa0c[_0x6003('0x5e')]['map'](function(_0x28c1a5){return _0x28c1a5&&_0x28c1a5[_0x6003('0x5f')][0x0]&&_0x28c1a5['alternatives'][0x0]['confidence']?_0x28c1a5[_0x6003('0x5f')][0x0][_0x6003('0x62')]:0x0;})[_0x6003('0x61')]('\x0a');}logger[_0x6003('0x1e')]('googleASR\x20transcription',_0x3acf2f);logger['info'](_0x6003('0x63'),_0x535e06);return{'transcript':_0x3acf2f,'confidence':_0x535e06};})['catch'](function(_0x241c3c){logger[_0x6003('0x21')](_0x6003('0x64'),_0x241c3c[_0x6003('0x19')],_0x241c3c[_0x6003('0x65')],_0x241c3c[_0x6003('0x66')]);});};exports['googleDialogflow']=function(_0x18d66e,_0x9182b2,_0x3a3dbb,_0x54118e){var _0x17b486=apiai(_0x9182b2,{'language':_0x54118e||'en'});return _0x17b486[_0x6003('0x67')](_0x3a3dbb,{'sessionId':md5(_0x18d66e)})[_0x6003('0x30')](function(_0x1f80a2){logger[_0x6003('0x1e')](JSON[_0x6003('0x47')](_0x1f80a2));return{'source':_0x1f80a2['result'][_0x6003('0x68')],'resolvedQuery':_0x1f80a2['result'][_0x6003('0x69')],'action':_0x1f80a2[_0x6003('0x6a')][_0x6003('0x6b')],'actionIncomplete':_0x1f80a2[_0x6003('0x6a')][_0x6003('0x6c')],'speech':_0x1f80a2[_0x6003('0x6a')][_0x6003('0x6d')]['speech'],'score':_0x1f80a2[_0x6003('0x6a')][_0x6003('0x6e')],'statusCode':_0x1f80a2[_0x6003('0x6f')]['code'],'endConversation':_0x1f80a2[_0x6003('0x6a')][_0x6003('0x70')]['endConversation']||![],'isFallbackIntent':_0x1f80a2[_0x6003('0x6a')][_0x6003('0x70')]['isFallbackIntent']};});};exports[_0x6003('0x71')]=function(_0x25b73f,_0x57947f,_0x3801a4,_0x111ae9,_0x55362e,_0x2ca73d){var _0x4f3781=_0x111ae9['replace'](/\\n/g,'\x0a');var _0x200823={'credentials':{'private_key':_0x4f3781,'client_email':_0x3801a4}};var _0x7e161=new dialogflow[(_0x6003('0x72'))](_0x200823);var _0x10a9f1=_0x7e161['sessionPath'](_0x57947f,md5(_0x25b73f));var _0x186b0f={'session':_0x10a9f1,'queryInput':{'text':{'text':_0x55362e,'languageCode':_0x2ca73d}}};return _0x7e161['detectIntent'](_0x186b0f)[_0x6003('0x30')](function(_0x2bc0ef){if(_0x2bc0ef&&_0x2bc0ef[_0x6003('0x73')]){logger['info'](_0x6003('0x74'),JSON[_0x6003('0x47')](_0x2bc0ef));var _0x5c68b1=_0x2bc0ef[0x0];if(_0x5c68b1){var _0xb5d979={'action':_0x5c68b1[_0x6003('0x75')][_0x6003('0x6b')],'allRequiredParamsPresent':_0x5c68b1['queryResult']['allRequiredParamsPresent'],'endConversation':_0x5c68b1[_0x6003('0x75')][_0x6003('0x76')]&&_0x5c68b1[_0x6003('0x75')][_0x6003('0x76')]['fields']?_0x5c68b1['queryResult']['diagnosticInfo']['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x5c68b1[_0x6003('0x75')][_0x6003('0x77')],'intentName':_0x5c68b1[_0x6003('0x75')][_0x6003('0x78')][_0x6003('0x65')],'intentDisplayName':_0x5c68b1[_0x6003('0x75')][_0x6003('0x78')][_0x6003('0x79')],'isFallbackIntent':_0x5c68b1['queryResult'][_0x6003('0x78')][_0x6003('0x7a')],'languageCode':_0x5c68b1['queryResult'][_0x6003('0x7b')],'queryText':_0x5c68b1[_0x6003('0x75')][_0x6003('0x7c')],'responseId':_0x5c68b1[_0x6003('0x7d')],'score':_0x5c68b1[_0x6003('0x75')]['intentDetectionConfidence'],'speech':_0x5c68b1[_0x6003('0x75')][_0x6003('0x77')],'providerResponse':JSON['stringify'](_0x2bc0ef)};return _0xb5d979;}}});};exports[_0x6003('0x7e')]=function(_0x4ad696,_0x186d6c,_0xc0e826,_0x558df2){return tilde[_0x6003('0x5b')](_0x4ad696,_0x186d6c,_0xc0e826,_0x558df2)[_0x6003('0x30')](function(_0x55c8c4){try{fs[_0x6003('0x5d')](_0x4ad696);}catch(_0x19b8ab){logger[_0x6003('0x21')](_0x19b8ab);}logger[_0x6003('0x1e')]('Tilde\x20ASR\x20transcription',_0x55c8c4[_0x6003('0x60')]);logger['info']('Tilde\x20ASR\x20confidence',_0x55c8c4[_0x6003('0x62')]);return _0x55c8c4;});};exports[_0x6003('0x7f')]=function(_0x496a59,_0xfdb86e,_0x25b180,_0x58f7de,_0x380863,_0x38e969){var _0x2fb5de=path[_0x6003('0x3c')](__dirname,_0x6003('0x3d'),rs[_0x6003('0x2c')](0x4)+_0x6003('0x3e'));var _0x2050ad;return aws[_0x6003('0x80')](_0x496a59,_0xfdb86e,_0x25b180,_0x58f7de,_0x380863,_0x38e969,_0x2fb5de)['then'](function(){_0x2050ad=path[_0x6003('0x3c')](__dirname,_0x6003('0x3d'),rs['generate'](0x4)+'.wav');return convertFile(_0x2fb5de,_0x2050ad);})[_0x6003('0x30')](function(){try{fs[_0x6003('0x5d')](_0x2fb5de);fs[_0x6003('0x42')](_0x2050ad,_0x6003('0x31'));}catch(_0x5c3aac){logger[_0x6003('0x21')](_0x5c3aac);}return _0x2050ad['split']('.')[0x0];});};exports[_0x6003('0x81')]=function(_0x14a6cd,_0x35a312,_0xc89edb,_0x15fdc2,_0x43ba19,_0x5544cb){return aws[_0x6003('0x82')](_0x14a6cd,_0x35a312,_0xc89edb,_0x15fdc2,_0x43ba19,_0x5544cb)['then'](function(_0x380bf6){logger[_0x6003('0x1e')](JSON['stringify'](_0x380bf6));return _0x380bf6;});};exports['ispeechTTS']=function(_0x1026bf,_0x26d2e7,_0x39357f,_0x465285){var _0x269239=util['format'](_0x6003('0x83'),ISPEECH_API,_0x1026bf,encodeURIComponent(_0x26d2e7),_0x39357f,_0x465285);var _0x3c98c4=path['resolve'](__dirname,'tmp',rs[_0x6003('0x2c')](0x4)+'.mp3');var _0x4a25dc;return downloadFile(_0x269239,_0x3c98c4)[_0x6003('0x30')](function(){_0x4a25dc=path[_0x6003('0x3c')](__dirname,_0x6003('0x3d'),rs['generate'](0x4)+_0x6003('0x2d'));return convertFile(_0x3c98c4,_0x4a25dc);})[_0x6003('0x30')](function(){try{fs[_0x6003('0x5d')](_0x3c98c4);fs['chmodSync'](_0x4a25dc,_0x6003('0x31'));}catch(_0x3c0a07){logger[_0x6003('0x21')](_0x3c0a07);}return _0x4a25dc['split']('.')[0x0];});};exports[_0x6003('0x84')]=function(_0x299b26,_0x19cbab,_0xab0ba4,_0x35e9c9){var _0x19ff38=util[_0x6003('0x85')](_0x6003('0x86'),ISPEECH_API,_0x19cbab,_0xab0ba4,base64Encode(_0x299b26),_0x35e9c9?util['format'](_0x6003('0x87'),encodeURIComponent(_0x35e9c9)):'freeform=3');return uploadFile(_0x19ff38)[_0x6003('0x30')](function(_0x492f5a){return querystring['parse'](_0x492f5a);});};exports['sestekNDA']=function(_0x506a34,_0x16711d){return sestek[_0x6003('0x88')](_0x506a34,_0x16711d)[_0x6003('0x30')](function(_0xb2fc56){logger[_0x6003('0x1e')](JSON[_0x6003('0x47')](_0xb2fc56));var _0x54f09d={'speech':_0xb2fc56[_0x6003('0x89')],'action':_0xb2fc56['channelData']?_0xb2fc56[_0x6003('0x8a')][_0x6003('0x8b')]:undefined,'actiondata':_0xb2fc56[_0x6003('0x8a')]?_0xb2fc56[_0x6003('0x8a')][_0x6003('0x8c')]:undefined};if(_0xb2fc56[_0x6003('0x8a')]&&_0xb2fc56['channelData'][_0x6003('0x8d')]){return base64Decode(_0xb2fc56['channelData'][_0x6003('0x8d')]['Data'],path['resolve'](__dirname,_0x6003('0x3d'),rs[_0x6003('0x2c')](0x4)+_0x6003('0x2d')))[_0x6003('0x30')](function(_0x141c5f){_0x54f09d[_0x6003('0x8e')]=_0x141c5f;return _0x54f09d;});}return _0x54f09d;});};exports[_0x6003('0x8f')]=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 0f77053..9abe4c4 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 _0x6fcf=['exports'];(function(_0x24fa3b,_0x307995){var _0x13ce62=function(_0x128eb5){while(--_0x128eb5){_0x24fa3b['push'](_0x24fa3b['shift']());}};_0x13ce62(++_0x307995);}(_0x6fcf,0x14b));var _0xf6fc=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x6fcf[_0x46a3ff];return _0x404bc2;};var nda=require('./nda');module[_0xf6fc('0x0')]={'nda':nda}; \ No newline at end of file +var _0x076e=['./nda'];(function(_0xb41127,_0x5a16ad){var _0x5b66a7=function(_0x5acbe4){while(--_0x5acbe4){_0xb41127['push'](_0xb41127['shift']());}};_0x5b66a7(++_0x5a16ad);}(_0x076e,0x1cf));var _0xe076=function(_0x1a1952,_0x49ac3e){_0x1a1952=_0x1a1952-0x0;var _0x35edd9=_0x076e[_0x1a1952];return _0x35edd9;};var nda=require(_0xe076('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 1d699b6..836b501 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 _0x3cbb=['password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','agi','exports','POST','ndauth_url'];(function(_0x2729a0,_0x37c7f1){var _0x512139=function(_0x3ae933){while(--_0x3ae933){_0x2729a0['push'](_0x2729a0['shift']());}};_0x512139(++_0x37c7f1);}(_0x3cbb,0xeb));var _0xb3cb=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x3cbb[_0x2576d7];return _0x16a08c;};'use strict';var rp=require('request-promise');var url=require(_0xb3cb('0x0'));var logger=require('../../../../../config/logger')(_0xb3cb('0x1'));module[_0xb3cb('0x2')]=function(_0x4b02a3,_0x1f8205){var _0x1a64ff={'method':_0xb3cb('0x3'),'uri':url['resolve'](_0x1f8205[_0xb3cb('0x4')],'/token'),'form':{'grant_type':'password','username':_0x1f8205['username'],'password':_0x1f8205[_0xb3cb('0x5')]},'json':!![]};return rp(_0x1a64ff)[_0xb3cb('0x6')](function(_0x153702){var _0x2a7c73={'method':_0xb3cb('0x3'),'uri':url[_0xb3cb('0x7')](_0x1f8205[_0xb3cb('0x8')],_0xb3cb('0x9')),'body':{'type':_0x1f8205[_0xb3cb('0xa')]||_0xb3cb('0xb'),'channelId':_0xb3cb('0xc'),'conversation':{'id':_0x4b02a3[_0xb3cb('0xd')]},'from':{'id':_0x4b02a3[_0xb3cb('0xe')],'name':_0x4b02a3['calleridname']},'recipient':{'id':_0x4b02a3[_0xb3cb('0xf')],'name':_0x4b02a3['extension']},'text':_0x1f8205[_0xb3cb('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x153702[_0xb3cb('0x11')]},'json':!![]};if(_0x1f8205[_0xb3cb('0x12')]){_0x2a7c73['body'][_0xb3cb('0x13')][_0xb3cb('0x14')]=_0x1f8205['project'];}if(_0x1f8205[_0xb3cb('0x15')]=='1'){_0x2a7c73[_0xb3cb('0x16')][_0xb3cb('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb3cb('0x17')};}if(_0x1f8205[_0xb3cb('0x18')]){_0x2a7c73[_0xb3cb('0x16')][_0xb3cb('0x13')][_0xb3cb('0x19')]=_0x1f8205[_0xb3cb('0x18')];if(_0x1f8205[_0xb3cb('0x1a')]){_0x2a7c73[_0xb3cb('0x16')][_0xb3cb('0x13')][_0xb3cb('0x1b')]=_0x1f8205[_0xb3cb('0x1a')];}}logger[_0xb3cb('0x1c')](JSON[_0xb3cb('0x1d')](_0x2a7c73));return rp(_0x2a7c73);});}; \ No newline at end of file +var _0xe813=['info','stringify','url','../../../../../config/logger','agi','POST','resolve','/token','password','username','ndaactivity_type','message','Nda','calleridname','dnid','extension','Bearer\x20','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData'];(function(_0x57060e,_0x5531b9){var _0x4a1b3f=function(_0x9907c8){while(--_0x9907c8){_0x57060e['push'](_0x57060e['shift']());}};_0x4a1b3f(++_0x5531b9);}(_0xe813,0x1b2));var _0x3e81=function(_0x4347cd,_0x562582){_0x4347cd=_0x4347cd-0x0;var _0x40c6d7=_0xe813[_0x4347cd];return _0x40c6d7;};'use strict';var rp=require('request-promise');var url=require(_0x3e81('0x0'));var logger=require(_0x3e81('0x1'))(_0x3e81('0x2'));module['exports']=function(_0x167644,_0x402ec5){var _0x332edf={'method':_0x3e81('0x3'),'uri':url[_0x3e81('0x4')](_0x402ec5['ndauth_url'],_0x3e81('0x5')),'form':{'grant_type':_0x3e81('0x6'),'username':_0x402ec5[_0x3e81('0x7')],'password':_0x402ec5[_0x3e81('0x6')]},'json':!![]};return rp(_0x332edf)['then'](function(_0x1919bc){var _0x32bdc1={'method':_0x3e81('0x3'),'uri':url[_0x3e81('0x4')](_0x402ec5['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x402ec5[_0x3e81('0x8')]||_0x3e81('0x9'),'channelId':_0x3e81('0xa'),'conversation':{'id':_0x167644['uniqueid']},'from':{'id':_0x167644['callerid'],'name':_0x167644[_0x3e81('0xb')]},'recipient':{'id':_0x167644[_0x3e81('0xc')],'name':_0x167644[_0x3e81('0xd')]},'text':_0x402ec5['text'],'channelData':{}},'headers':{'Authorization':_0x3e81('0xe')+_0x1919bc['access_token']},'json':!![]};if(_0x402ec5[_0x3e81('0xf')]){_0x32bdc1['body'][_0x3e81('0x10')][_0x3e81('0x11')]=_0x402ec5[_0x3e81('0xf')];}if(_0x402ec5[_0x3e81('0x12')]=='1'){_0x32bdc1[_0x3e81('0x13')][_0x3e81('0x10')][_0x3e81('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x402ec5[_0x3e81('0x15')]){_0x32bdc1[_0x3e81('0x13')][_0x3e81('0x10')][_0x3e81('0x16')]=_0x402ec5[_0x3e81('0x15')];if(_0x402ec5[_0x3e81('0x17')]){_0x32bdc1['body'][_0x3e81('0x10')][_0x3e81('0x18')]=_0x402ec5[_0x3e81('0x17')];}}logger[_0x3e81('0x19')](JSON[_0x3e81('0x1a')](_0x32bdc1));return rp(_0x32bdc1);});}; \ 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 6f3eff1..26c8d1b 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 _0x0094=['./lib/api'];(function(_0x10637e,_0x1e935f){var _0x2b2ec5=function(_0x14ac84){while(--_0x14ac84){_0x10637e['push'](_0x10637e['shift']());}};_0x2b2ec5(++_0x1e935f);}(_0x0094,0x82));var _0x4009=function(_0x4aa6bc,_0x150a86){_0x4aa6bc=_0x4aa6bc-0x0;var _0x3d86a9=_0x0094[_0x4aa6bc];return _0x3d86a9;};'use strict';var asr=require(_0x4009('0x0'));module['exports']=function(_0x345d84,_0x259827,_0x342c10,_0x465f80){return asr(_0x345d84,_0x259827,_0x342c10,_0x465f80);}; \ No newline at end of file +var _0xbb03=['exports'];(function(_0x2f2c68,_0x213586){var _0x6e98f0=function(_0x45112e){while(--_0x45112e){_0x2f2c68['push'](_0x2f2c68['shift']());}};_0x6e98f0(++_0x213586);}(_0xbb03,0x10c));var _0x3bb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbb03[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require('./lib/api');module[_0x3bb0('0x0')]=function(_0x414b00,_0x3bede3,_0x3e44ed,_0x14f898){return asr(_0x414b00,_0x3bede3,_0x3e44ed,_0x14f898);}; \ 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 e8cc1e0..084493b 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 _0xb255=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','hypotheses','transcript','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','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb255,0x79));var _0x5b25=function(_0xf00579,_0x52840d){_0xf00579=_0xf00579-0x0;var _0x318821=_0xb255[_0xf00579];return _0x318821;};'use strict';var BPromise=require(_0x5b25('0x0'));var _=require(_0x5b25('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5b25('0x2'));var crypto=require(_0x5b25('0x3'));var logger=require(_0x5b25('0x4'))('agi');module[_0x5b25('0x5')]=function(_0x3dfb61,_0x682809,_0x55dc83,_0x1b93f6){return new BPromise(function(_0x212b08,_0x3f8b6f){logger[_0x5b25('0x6')](_0x5b25('0x7'),_0x1b93f6||_0x5b25('0x8'));var _0x115943=new WebSocket(_0x1b93f6||_0x5b25('0x8'),{'perMessageDeflate':![]});var _0x5d32dc='';var _0x306a9b='0';var _0x203d6e='1';var _0x10ce87='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x37d6b3(_0x34f3d2){var _0x5175ea=crypto[_0x5b25('0x9')](_0x5b25('0xa'));_0x5175ea[_0x5b25('0xb')](_0x34f3d2);return _0x5175ea[_0x5b25('0xc')](_0x5b25('0xd'));}function _0x498feb(){try{logger['info'](_0x5b25('0xe'));var _0x31ac32=moment()[_0x5b25('0xf')]();var _0x49401=_0x37d6b3(_0x31ac32+_0x682809+_0x55dc83);_0x115943[_0x5b25('0x10')](JSON[_0x5b25('0x11')]({'appID':_0x682809,'timestamp':_0x31ac32,'appKey':_0x49401}));var _0x502b69=fs[_0x5b25('0x12')](_0x3dfb61);_0x502b69['on'](_0x5b25('0x13'),function(_0x7564b9){_0x115943[_0x5b25('0x10')](_0x7564b9);});_0x502b69['on'](_0x5b25('0x14'),function(){_0x115943[_0x5b25('0x10')](_0x5b25('0x15'));});}catch(_0x16f3d3){logger[_0x5b25('0x16')](_0x5b25('0x17'),JSON['stringify'](_0x16f3d3));_0x115943[_0x5b25('0x18')]();}}function _0x8e00a8(_0x2c64f4){try{if(_0x2c64f4){var _0x1c0345=JSON[_0x5b25('0x19')](_0x2c64f4);switch(_0x1c0345[_0x5b25('0x1a')]){case 0x0:if(_0x1c0345['result']){if(_0x1c0345[_0x5b25('0x1b')]['final']){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x5b25('0x11')](_0x1c0345[_0x5b25('0x1b')][_0x5b25('0x1c')]));_0x5d32dc=_0x1c0345[_0x5b25('0x1b')][_0x5b25('0x1c')][0x0][_0x5b25('0x1d')];_0x306a9b=_0x1c0345['result'][_0x5b25('0x1c')][0x0][_0x5b25('0x1e')];_0x203d6e='0';_0x10ce87=_0x5b25('0x1f');_0x115943[_0x5b25('0x18')]();}}break;case 0x1:logger['info'](_0x5b25('0x20'));_0x203d6e='1';_0x10ce87=_0x5b25('0x20');break;case 0x2:logger[_0x5b25('0x6')](_0x5b25('0x21'));_0x203d6e='2';_0x10ce87=_0x5b25('0x21');break;case 0x9:logger[_0x5b25('0x6')](_0x5b25('0x22'));_0x203d6e='9';_0x10ce87=_0x5b25('0x22');break;case 0xa:logger[_0x5b25('0x6')]('Authentication\x20failed.');_0x203d6e='10';_0x10ce87=_0x5b25('0x23');break;case 0xb:logger['info'](_0x5b25('0x24'));_0x203d6e='11';_0x10ce87='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5a8944){logger['error'](_0x5b25('0x25'),JSON['stringify'](_0x5a8944));_0x115943[_0x5b25('0x18')]();}}function _0x6c39aa(){logger[_0x5b25('0x6')](_0x5b25('0x26'));_0x212b08({'transcript':_0x5d32dc,'confidence':_0x306a9b,'status':_0x203d6e,'status_message':_0x10ce87});}function _0x3465f4(_0x41ebfe){logger['error'](_0x5b25('0x27'));if(!_[_0x5b25('0x28')](_0x41ebfe)){logger[_0x5b25('0x16')](_[_0x5b25('0x29')](_0x41ebfe)?JSON[_0x5b25('0x11')](_0x41ebfe):_0x41ebfe);}}_0x115943['on'](_0x5b25('0x2a'),_0x498feb);_0x115943['on']('message',_0x8e00a8);_0x115943['on']('close',_0x6c39aa);_0x115943['on'](_0x5b25('0x16'),_0x3465f4);});}; \ No newline at end of file +var _0xe82f=['send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','crypto','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x529a6d,_0x5e1354){var _0x43430=function(_0x3b551e){while(--_0x3b551e){_0x529a6d['push'](_0x529a6d['shift']());}};_0x43430(++_0x5e1354);}(_0xe82f,0x68));var _0xfe82=function(_0x107ce5,_0x273534){_0x107ce5=_0x107ce5-0x0;var _0x5030c9=_0xe82f[_0x107ce5];return _0x5030c9;};'use strict';var BPromise=require(_0xfe82('0x0'));var _=require(_0xfe82('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xfe82('0x2'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x6b9441,_0x558934,_0x3d5fb9,_0x44dcce){return new BPromise(function(_0x521d60,_0x361f19){logger[_0xfe82('0x3')](_0xfe82('0x4'),_0x44dcce||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x5dae40=new WebSocket(_0x44dcce||_0xfe82('0x5'),{'perMessageDeflate':![]});var _0x2b3d95='';var _0x29b418='0';var _0x19974a='1';var _0x73b045=_0xfe82('0x6');function _0x4e6ecf(_0x321c7b){var _0x476d65=crypto[_0xfe82('0x7')](_0xfe82('0x8'));_0x476d65[_0xfe82('0x9')](_0x321c7b);return _0x476d65[_0xfe82('0xa')](_0xfe82('0xb'));}function _0x24d752(){try{logger['info'](_0xfe82('0xc'));var _0x3301f9=moment()['unix']();var _0xf5da11=_0x4e6ecf(_0x3301f9+_0x558934+_0x3d5fb9);_0x5dae40[_0xfe82('0xd')](JSON[_0xfe82('0xe')]({'appID':_0x558934,'timestamp':_0x3301f9,'appKey':_0xf5da11}));var _0x487ca6=fs[_0xfe82('0xf')](_0x6b9441);_0x487ca6['on'](_0xfe82('0x10'),function(_0x2d6a1d){_0x5dae40['send'](_0x2d6a1d);});_0x487ca6['on'](_0xfe82('0x11'),function(){_0x5dae40['send'](_0xfe82('0x12'));});}catch(_0x4906c9){logger[_0xfe82('0x13')](_0xfe82('0x14'),JSON['stringify'](_0x4906c9));_0x5dae40[_0xfe82('0x15')]();}}function _0x556ee6(_0x5403ef){try{if(_0x5403ef){var _0x5844ad=JSON[_0xfe82('0x16')](_0x5403ef);switch(_0x5844ad[_0xfe82('0x17')]){case 0x0:if(_0x5844ad[_0xfe82('0x18')]){if(_0x5844ad['result'][_0xfe82('0x19')]){logger[_0xfe82('0x3')]('Tilde\x20ASR\x20hypoteses',JSON[_0xfe82('0xe')](_0x5844ad[_0xfe82('0x18')]['hypotheses']));_0x2b3d95=_0x5844ad[_0xfe82('0x18')][_0xfe82('0x1a')][0x0]['transcript'];_0x29b418=_0x5844ad[_0xfe82('0x18')][_0xfe82('0x1a')][0x0][_0xfe82('0x1b')];_0x19974a='0';_0x73b045=_0xfe82('0x1c');_0x5dae40[_0xfe82('0x15')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x19974a='1';_0x73b045=_0xfe82('0x6');break;case 0x2:logger[_0xfe82('0x3')](_0xfe82('0x1d'));_0x19974a='2';_0x73b045=_0xfe82('0x1d');break;case 0x9:logger[_0xfe82('0x3')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x19974a='9';_0x73b045=_0xfe82('0x1e');break;case 0xa:logger[_0xfe82('0x3')](_0xfe82('0x1f'));_0x19974a='10';_0x73b045=_0xfe82('0x1f');break;case 0xb:logger[_0xfe82('0x3')](_0xfe82('0x20'));_0x19974a='11';_0x73b045=_0xfe82('0x20');}}}catch(_0x2897b5){logger[_0xfe82('0x13')](_0xfe82('0x21'),JSON[_0xfe82('0xe')](_0x2897b5));_0x5dae40[_0xfe82('0x15')]();}}function _0x3f144d(){logger['info'](_0xfe82('0x22'));_0x521d60({'transcript':_0x2b3d95,'confidence':_0x29b418,'status':_0x19974a,'status_message':_0x73b045});}function _0xeb101(_0x53d07b){logger[_0xfe82('0x13')](_0xfe82('0x23'));if(!_[_0xfe82('0x24')](_0x53d07b)){logger[_0xfe82('0x13')](_['isObject'](_0x53d07b)?JSON[_0xfe82('0xe')](_0x53d07b):_0x53d07b);}}_0x5dae40['on'](_0xfe82('0x25'),_0x24d752);_0x5dae40['on'](_0xfe82('0x26'),_0x556ee6);_0x5dae40['on'](_0xfe82('0x11'),_0x3f144d);_0x5dae40['on']('error',_0xeb101);});}; \ 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 3796bb7..92f007e 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 _0x2802=['exports','./asr'];(function(_0x4ade33,_0x103537){var _0x162cc1=function(_0x1c52ab){while(--_0x1c52ab){_0x4ade33['push'](_0x4ade33['shift']());}};_0x162cc1(++_0x103537);}(_0x2802,0x1b5));var _0x2280=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x2802[_0x47a40b];return _0x19610c;};var asr=require(_0x2280('0x0'));module[_0x2280('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0d62=['./asr'];(function(_0x1bd122,_0x2993aa){var _0x2e3aa5=function(_0x5c9a6e){while(--_0x5c9a6e){_0x1bd122['push'](_0x1bd122['shift']());}};_0x2e3aa5(++_0x2993aa);}(_0x0d62,0x1df));var _0x20d6=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x0d62[_0x55d58f];return _0x1ad6e6;};var asr=require(_0x20d6('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e1f4d75..dbc60fe 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 _0xa854=['ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events','EventEmitter','./error','127.0.0.1','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x11da3b,_0x3c073a){var _0x30fefc=function(_0x1ce7f4){while(--_0x1ce7f4){_0x11da3b['push'](_0x11da3b['shift']());}};_0x30fefc(++_0x3c073a);}(_0xa854,0x103));var _0x4a85=function(_0x58c257,_0x18bc49){_0x58c257=_0x58c257-0x0;var _0x1b8cd1=_0xa854[_0x58c257];return _0x1b8cd1;};'use strict';var util=require(_0x4a85('0x0'));var net=require(_0x4a85('0x1'));var EventEmitter=require(_0x4a85('0x2'))[_0x4a85('0x3')];var AGIError=require(_0x4a85('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x135ea5,_0x498101,_0x388052){var _0x5bd2dd=this,_0x135ea5=_0x135ea5||0x11dd,_0x498101=_0x498101||_0x4a85('0x5'),_0x494d91=null,_0x445a95=0x0;EventEmitter['call'](_0x5bd2dd);function _0xb1605c(){if(!_0x135ea5){_0x5bd2dd['emit'](_0x4a85('0x6'),new AGIError(_0x4a85('0x7')));return![];}_0x494d91=net[_0x4a85('0x8')]();_0x494d91[_0x4a85('0x9')](_0x135ea5,_0x498101);_0x494d91['on'](_0x4a85('0xa'),function(){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0xa'));});_0x494d91['on'](_0x4a85('0xc'),function(_0x95de02){_0x494d91['getConnections'](function(_0x45cff9,_0x2232dd){if(_0x45cff9){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0x6'),new AGIError(_0x4a85('0xd'),_0x45cff9));}else if(_0x388052&&_0x388052<0x0){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0x6'),new AGIError(_0x4a85('0xe')));_0x95de02[_0x4a85('0xf')]();}else if(_0x388052&&_0x388052>0x0&&_0x388052<_0x2232dd){_0x445a95+=0x1;_0x5bd2dd['emit'](_0x4a85('0x6'),new AGIError(_0x4a85('0x10'),_0x445a95));_0x95de02[_0x4a85('0xf')]();}else{var _0x153d39=new AGIChannel(_0x95de02);_0x153d39['on'](_0x4a85('0x11'),function(){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0xc'),_0x153d39);});}});});_0x494d91['on'](_0x4a85('0x6'),function(_0x1922cb){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x1922cb[_0x4a85('0x12')]));});_0x494d91['on'](_0x4a85('0x13'),function(){_0x5bd2dd['emit'](_0x4a85('0x13'),new AGIError(_0x4a85('0x14')));});}process[_0x4a85('0x15')](function(){_0xb1605c();});};util['inherits'](AGIServer,EventEmitter);module[_0x4a85('0x16')]=function(_0x2eb00a,_0x457739,_0x496b8a){return new AGIServer(_0x2eb00a,_0x457739,_0x496b8a);}; \ No newline at end of file +var _0x7dc2=['error','E_AGI_ARGUMENT_PORT','createServer','listen','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','nextTick','inherits','exports','events','EventEmitter','./error','./channel','call'];(function(_0x44dcad,_0x2d1b9c){var _0x3cdc33=function(_0x21228b){while(--_0x21228b){_0x44dcad['push'](_0x44dcad['shift']());}};_0x3cdc33(++_0x2d1b9c);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x27dc('0x0'))[_0x27dc('0x1')];var AGIError=require(_0x27dc('0x2'));var AGIChannel=require(_0x27dc('0x3'));var AGIServer=function(_0x57d4b4,_0x15d70c,_0x29ba23){var _0x52337b=this,_0x57d4b4=_0x57d4b4||0x11dd,_0x15d70c=_0x15d70c||'127.0.0.1',_0x5a442a=null,_0x29eaac=0x0;EventEmitter[_0x27dc('0x4')](_0x52337b);function _0x3b3eee(){if(!_0x57d4b4){_0x52337b['emit'](_0x27dc('0x5'),new AGIError(_0x27dc('0x6')));return![];}_0x5a442a=net[_0x27dc('0x7')]();_0x5a442a[_0x27dc('0x8')](_0x57d4b4,_0x15d70c);_0x5a442a['on']('listening',function(){_0x52337b[_0x27dc('0x9')]('listening');});_0x5a442a['on'](_0x27dc('0xa'),function(_0x187853){_0x5a442a[_0x27dc('0xb')](function(_0x54c533,_0x5cd8a5){if(_0x54c533){_0x52337b[_0x27dc('0x9')](_0x27dc('0x5'),new AGIError(_0x27dc('0xc'),_0x54c533));}else if(_0x29ba23&&_0x29ba23<0x0){_0x52337b[_0x27dc('0x9')]('error',new AGIError(_0x27dc('0xd')));_0x187853['destroy']();}else if(_0x29ba23&&_0x29ba23>0x0&&_0x29ba23<_0x5cd8a5){_0x29eaac+=0x1;_0x52337b[_0x27dc('0x9')]('error',new AGIError(_0x27dc('0xe'),_0x29eaac));_0x187853[_0x27dc('0xf')]();}else{var _0x7972d8=new AGIChannel(_0x187853);_0x7972d8['on'](_0x27dc('0x10'),function(){_0x52337b['emit'](_0x27dc('0xa'),_0x7972d8);});}});});_0x5a442a['on'](_0x27dc('0x5'),function(_0x798f50){_0x52337b[_0x27dc('0x9')](_0x27dc('0x5'),new AGIError('E_AGI_SERVER_ERROR',_0x798f50[_0x27dc('0x11')]));});_0x5a442a['on'](_0x27dc('0x12'),function(){_0x52337b[_0x27dc('0x9')](_0x27dc('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x27dc('0x13')](function(){_0x3b3eee();});};util[_0x27dc('0x14')](AGIServer,EventEmitter);module[_0x27dc('0x15')]=function(_0x2c8c68,_0x31fb67,_0x3dcfca){return new AGIServer(_0x2c8c68,_0x31fb67,_0x3dcfca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 320ed84..685287d 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 _0x8ebe=['aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','getAndSetVariable','result','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','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','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','host','Smtp','secure','auth','user','pass','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','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','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','lodash','shelljs','odbc','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','getVariableById','then','name','getVoiceQueue','rpc','getVoiceQueueById','catch','prototype','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','text','google_tts_language','restAPI','url','method','timeout','number','POST','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly'];(function(_0x3a4a84,_0x5c612a){var _0x245112=function(_0xd5f6a0){while(--_0xd5f6a0){_0x3a4a84['push'](_0x3a4a84['shift']());}};_0x245112(++_0x5c612a);}(_0x8ebe,0x145));var _0xe8eb=function(_0x44a329,_0x45f280){_0x44a329=_0x44a329-0x0;var _0x45f2a3=_0x8ebe[_0x44a329];return _0x45f2a3;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0xe8eb('0x0'));var sh=require(_0xe8eb('0x1'));var odbc=require(_0xe8eb('0x2'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xe8eb('0x3'));var logger=require(_0xe8eb('0x4'))(_0xe8eb('0x5'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0xe8eb('0x6');var recursiveMapAttributes=[_0xe8eb('0x7'),_0xe8eb('0x8')];var verticesWithRetry=[_0xe8eb('0x9'),_0xe8eb('0xa'),_0xe8eb('0xb')];var AGIVertices=function(_0x5b3378,_0x5c3d83,_0x51e301){this[_0xe8eb('0xc')]=_0x5b3378;this['rpc']=_0x5c3d83;this[_0xe8eb('0xd')]=_0x51e301;};AGIVertices['prototype'][_0xe8eb('0xe')]=function(_0x3c7a00,_0x56285f){this['rpc'][_0xe8eb('0xf')](_0x3c7a00)[_0xe8eb('0x10')](function(_0x4b435d){_0x56285f(null,_0x4b435d?_0x4b435d[_0xe8eb('0x11')]:![]);})['catch'](function(_0x6aebfd){_0x56285f(_0x6aebfd);});};AGIVertices['prototype'][_0xe8eb('0x12')]=function(_0x33f45e,_0x55e59d){this[_0xe8eb('0x13')][_0xe8eb('0x14')](_0x33f45e)[_0xe8eb('0x10')](function(_0x443cd4){_0x55e59d(null,_0x443cd4?_0x443cd4[_0xe8eb('0x11')]:![]);})[_0xe8eb('0x15')](function(_0x162a00){_0x55e59d(_0x162a00);});};AGIVertices[_0xe8eb('0x16')]['getSquareProject']=function(_0x591c6f,_0x3e0e9){this[_0xe8eb('0x13')][_0xe8eb('0x17')](_0x591c6f)['then'](function(_0x492305){_0x3e0e9(null,_0x492305?_0x492305['name']:![]);})[_0xe8eb('0x15')](function(_0x2c2f4c){_0x3e0e9(_0x2c2f4c);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x18')]=function(_0x1ca72a,_0x297526){this['rpc'][_0xe8eb('0x19')](_0x1ca72a)[_0xe8eb('0x10')](function(_0x9cc501){_0x297526(null,_0x9cc501?_0x9cc501[_0xe8eb('0x1a')]:![]);})[_0xe8eb('0x15')](function(_0x3f1a4c){_0x297526(_0x3f1a4c);});};AGIVertices['prototype'][_0xe8eb('0x1b')]=function(_0xf33cf9,_0x4c3bff){this['rpc'][_0xe8eb('0x1c')](_0xf33cf9)[_0xe8eb('0x10')](function(_0x41867e){_0x4c3bff(null,_0x41867e?_0x41867e[_0xe8eb('0x11')]:![]);})['catch'](function(_0x41aa88){_0x4c3bff(_0x41aa88);});};AGIVertices[_0xe8eb('0x16')]['getTrunk']=function(_0x3a93c8,_0x826760){this[_0xe8eb('0x13')]['getTrunkById'](_0x3a93c8)[_0xe8eb('0x10')](function(_0x406a84){_0x826760(null,_0x406a84?_0x406a84['name']:![]);})['catch'](function(_0xa6a32f){_0x826760(_0xa6a32f);});};AGIVertices['prototype'][_0xe8eb('0x1d')]=function(_0xcb15b6,_0x524a33){var _0x3db027=this;this['rpc']['getSoundById'](_0xcb15b6)[_0xe8eb('0x10')](function(_0x1890d0){_0x524a33(null,_0x1890d0?_0x3db027[_0xe8eb('0x1e')](_0x1890d0['save_name']):![]);})[_0xe8eb('0x15')](function(_0x29e8e4){_0x524a33(_0x29e8e4);});};AGIVertices['prototype'][_0xe8eb('0x1f')]=function(_0xd563ea,_0x38887d){this[_0xe8eb('0x13')][_0xe8eb('0x20')](_0xd563ea)[_0xe8eb('0x10')](function(_0x2c40a4){_0x38887d(null,_0x2c40a4?_0x2c40a4:![]);})[_0xe8eb('0x15')](function(_0x2f65d6){_0x38887d(_0x2f65d6);});};AGIVertices['prototype'][_0xe8eb('0x21')]=function(_0x30ab40,_0x7a3302,_0x5ec750){this[_0xe8eb('0xd')][_0xe8eb('0x21')](_0x30ab40,_0x7a3302)[_0xe8eb('0x10')](function(){_0x5ec750(null);})['catch'](function(_0x5c23c8){_0x5ec750(_0x5c23c8);});};AGIVertices['prototype']['getIntervals']=function(_0x302704,_0x2df79b){this['rpc'][_0xe8eb('0x22')](_0x302704)[_0xe8eb('0x10')](function(_0x346955){if(_0x346955){if(_0x346955[_0xe8eb('0x23')]){_0x2df79b(null,[_0x346955[_0xe8eb('0x24')]]);}else{_0x2df79b(null,_[_0xe8eb('0x25')](_0x346955['Intervals'],_0xe8eb('0x24')));}}else{_0x2df79b(null,![]);}})[_0xe8eb('0x15')](function(_0x39fe3c){_0x2df79b(_0x39fe3c);});};AGIVertices[_0xe8eb('0x16')]['getSoundPath']=function(_0x477574){return util[_0xe8eb('0x26')](_0xe8eb('0x27'),FILES_PATH,_0x477574);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x28')]=function(_0xed2123,_0x55880b,_0x249898){odbc['open'](_0xed2123,function(_0x59522c){if(_0x59522c){logger[_0xe8eb('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x59522c);_0x249898(_0x59522c);}else{logger[_0xe8eb('0x2a')](_0xe8eb('0x2b'));odbc[_0xe8eb('0x2c')](_0x55880b,function(_0x3371c3,_0x345d83){if(_0x3371c3){logger['info'](_0xe8eb('0x2d'),_0x55880b);_0x249898(_0x3371c3);}else{logger[_0xe8eb('0x2a')](_0xe8eb('0x2e'),_0x55880b);odbc[_0xe8eb('0x2f')](function(_0x28cacc){if(_0x28cacc){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x28cacc);}_0x249898(null,_0x345d83);});}});}});};AGIVertices[_0xe8eb('0x16')]['getSmsAccount']=function(_0x24a02f,_0x25298b){this[_0xe8eb('0x13')]['getSmsAccountById'](_0x24a02f)[_0xe8eb('0x10')](function(_0x1b9061){_0x25298b(null,_0x1b9061?_0x1b9061:![]);})[_0xe8eb('0x15')](function(_0x9de97){_0x25298b(_0x9de97);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x30')]=function(_0x481be1,_0x295d50){this[_0xe8eb('0x13')][_0xe8eb('0x30')](_0x481be1)['then'](function(_0x3fdcd2){_0x295d50(null,_0x3fdcd2);})[_0xe8eb('0x15')](function(_0x8a5376){_0x295d50(_0x8a5376);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x31')]=function(_0x16182e,_0x1546bf,_0x22f2b1){this[_0xe8eb('0x13')][_0xe8eb('0x31')]({'uniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'node':_0x16182e[_0xe8eb('0x33')],'application':_0x16182e[_0xe8eb('0x34')],'data':_0x1546bf||null,'project_name':this[_0xe8eb('0xc')][_0xe8eb('0x35')],'callerid':this['channel'][_0xe8eb('0x36')]})[_0xe8eb('0x10')](function(_0x2e8747){if(_0x22f2b1){_0x22f2b1(null,_0x2e8747);}})['catch'](function(_0x39cb01){if(_0x22f2b1){_0x22f2b1(_0x39cb01);}});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x37')]=function(_0x2eeaad,_0x761992,_0x45ee60,_0x27250d){this['rpc'][_0xe8eb('0x37')]({'uniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'callerid':this[_0xe8eb('0xc')]['callerid'],'calleridname':this['channel'][_0xe8eb('0x38')],'context':this['channel'][_0xe8eb('0x39')],'extension':this[_0xe8eb('0xc')][_0xe8eb('0x3a')],'priority':this['channel'][_0xe8eb('0x3b')],'accountcode':this[_0xe8eb('0xc')][_0xe8eb('0x3c')],'dnid':this[_0xe8eb('0xc')][_0xe8eb('0x3d')],'projectName':this[_0xe8eb('0xc')][_0xe8eb('0x35')],'saveName':_0x761992,'filename':_0x2eeaad[_0xe8eb('0x3e')]||_0x761992,'savePath':_0x45ee60})[_0xe8eb('0x10')](function(_0xf3c5c1){_0x27250d(null,_0xf3c5c1);})['catch'](function(_0x442225){_0x27250d(_0x442225);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x3f')]=function(_0x4309d2,_0x526c0a,_0xbf92c9,_0x35f679,_0x361776){this[_0xe8eb('0x13')]['createSquareMessage']({'uniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'body':_0x4309d2,'direction':_0x526c0a,'providerName':_0xbf92c9,'providerResponse':_0x35f679})['then'](function(_0x384411){if(_0x361776){_0x361776(null,_0x384411);}})[_0xe8eb('0x15')](function(_0x37fd9c){if(_0x361776){_0x361776(_0x37fd9c);}});};AGIVertices[_0xe8eb('0x16')]['createCmContact']=function(_0x480c59,_0x69fb7b){this[_0xe8eb('0x13')][_0xe8eb('0x40')]({'firstName':_[_0xe8eb('0x41')](_0x480c59['name'])||_[_0xe8eb('0x42')](_0x480c59[_0xe8eb('0x11')])?'callback_'+Math[_0xe8eb('0x43')]():_0x480c59[_0xe8eb('0x11')],'lastName':_[_0xe8eb('0x41')](_0x480c59[_0xe8eb('0x44')])||_[_0xe8eb('0x42')](_0x480c59[_0xe8eb('0x44')])?null:_0x480c59[_0xe8eb('0x44')],'phone':_0x480c59[_0xe8eb('0x45')],'ListId':_0x480c59[_0xe8eb('0x46')],'scheduledat':_0x480c59['scheduledAt'],'callbackUniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'tags':_0xe8eb('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x480c59[_0xe8eb('0x48')][_0xe8eb('0x49')](),'priority':_0x480c59[_0xe8eb('0x4a')]})[_0xe8eb('0x10')](function(_0x364f13){_0x69fb7b(null,_0x364f13);})[_0xe8eb('0x15')](function(_0x34f4fe){_0x69fb7b(_0x34f4fe);});};AGIVertices['prototype']['getPause']=function(_0xba79d8,_0x20a80a){this['rpc'][_0xe8eb('0x4b')](_0xba79d8)[_0xe8eb('0x10')](function(_0x40eb97){_0x20a80a(null,_0x40eb97?_0x40eb97[_0xe8eb('0x11')]:![]);})['catch'](function(_0x37142b){_0x20a80a(_0x37142b);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x4c')]=function(_0x2c9744,_0x7d6b95,_0x4677f6){var _0xd3c01e={'role':_0xe8eb('0x4d')};_0xd3c01e[_0x2c9744]=this[_0xe8eb('0xc')][_0xe8eb('0x36')];this[_0xe8eb('0x13')]['agentPause'](_0xd3c01e,_0x7d6b95,this[_0xe8eb('0xc')]['uniqueid'])[_0xe8eb('0x10')](function(_0x3511ac){_0x4677f6(null,_['isNil'](_0x3511ac)?![]:!![]);})[_0xe8eb('0x15')](function(_0x531ce0){logger[_0xe8eb('0x29')](_0x531ce0);_0x4677f6(null,![]);});};AGIVertices['prototype'][_0xe8eb('0x4e')]=function(_0x1b935e,_0x6cd9ed){var _0x493bee={'role':_0xe8eb('0x4d')};_0x493bee[_0x1b935e]=this[_0xe8eb('0xc')][_0xe8eb('0x36')];this['rpc']['agentUnpause'](_0x493bee)[_0xe8eb('0x10')](function(_0x3c2297){_0x6cd9ed(null,_[_0xe8eb('0x42')](_0x3c2297)?![]:!![]);})[_0xe8eb('0x15')](function(_0xa60489){logger['error'](_0xa60489);_0x6cd9ed(null,![]);});};AGIVertices[_0xe8eb('0x16')]['agentLogout']=function(_0x2ca12f,_0x508a25){var _0x380877={'role':_0xe8eb('0x4d')};_0x380877[_0x2ca12f]=this['channel'][_0xe8eb('0x36')];this[_0xe8eb('0x13')][_0xe8eb('0x4f')](_0x380877)[_0xe8eb('0x10')](function(_0x31b01b){_0x508a25(null,_[_0xe8eb('0x42')](_0x31b01b)?![]:!![]);})['catch'](function(_0x20158a){logger[_0xe8eb('0x29')](_0x20158a);_0x508a25(null,![]);});};AGIVertices[_0xe8eb('0x16')]['agentLogin']=function(_0x4bc9e0,_0x35d248){var _0x1ee4d7={'role':_0xe8eb('0x4d')};_0x1ee4d7[_0x4bc9e0]=this[_0xe8eb('0xc')]['callerid'];var _0x1bf90d=_0x4bc9e0!=_0xe8eb('0x50')?util['format'](_0xe8eb('0x51'),_0xe8eb('0x52'),this[_0xe8eb('0xc')]['callerid']):undefined;this['rpc'][_0xe8eb('0x53')](_0x1ee4d7,_0x1bf90d)[_0xe8eb('0x10')](function(_0x43c221){_0x35d248(null,_[_0xe8eb('0x42')](_0x43c221)?![]:!![]);})[_0xe8eb('0x15')](function(_0x11500b){logger[_0xe8eb('0x29')](_0x11500b);_0x35d248(null,![]);});};AGIVertices['prototype'][_0xe8eb('0x54')]=function(_0x2456e2,_0x3816b7){sh[_0xe8eb('0x55')](_[_0xe8eb('0x56')](_0x2456e2),function(_0xbde611,_0x87464e){var _0xa9e6d2=_0x87464e[_0xe8eb('0x57')](/(\r\n|\n|\r)/gm,'');_0x3816b7(null,_0xa9e6d2);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x58')]=function(_0x343987,_0x3aa243){scripts[_0xe8eb('0x58')](_0x343987[_0xe8eb('0x59')],_0x343987[_0xe8eb('0x5a')]||'text',_0x343987['text'],_0x343987[_0xe8eb('0x5b')]||_0xe8eb('0x5c'),_0x343987[_0xe8eb('0x5d')]||_0xe8eb('0x5e'),_0x343987[_0xe8eb('0x5f')]||'MP3')[_0xe8eb('0x10')](function(_0x258f95){_0x3aa243(null,_0x258f95);})[_0xe8eb('0x15')](function(_0x41c8fe){_0x3aa243(_0x41c8fe);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x60')]=function(_0x3736e7,_0x38f339){scripts['googleTTS'](_0x3736e7[_0xe8eb('0x61')],_0x3736e7[_0xe8eb('0x62')]||'en',0x1)['then'](function(_0x42d6cd){_0x38f339(null,_0x42d6cd);})['catch'](function(_0x5940f7){_0x38f339(_0x5940f7);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x63')]=function(_0xc0e30f,_0x1c7324){var _0xdfd61a={'uri':_0xc0e30f[_0xe8eb('0x64')],'method':_0xc0e30f[_0xe8eb('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xc0e30f[_0xe8eb('0x66')])===_0xe8eb('0x67')&&parseInt(_0xc0e30f[_0xe8eb('0x66')])>=0x1?parseInt(_0xc0e30f['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xe8eb('0x68'),'PUT'],_0xdfd61a[_0xe8eb('0x65')][_0xe8eb('0x69')]())){try{_0xdfd61a['body']=_0xc0e30f[_0xe8eb('0x8')]?JSON[_0xe8eb('0x6a')](_0xc0e30f[_0xe8eb('0x8')]):{};}catch(_0x2e5dc4){logger[_0xe8eb('0x29')](_0xe8eb('0x6b'),_0x2e5dc4);}}try{_0xdfd61a[_0xe8eb('0x6c')]=_0xc0e30f['rawHeaders']?JSON[_0xe8eb('0x6a')](_0xc0e30f[_0xe8eb('0x7')]):{};}catch(_0x1a7e07){logger[_0xe8eb('0x29')](_0xe8eb('0x6d'),_0x1a7e07);}if(_0xc0e30f[_0xe8eb('0x6e')]){try{var _0x5101c3=require(_0xc0e30f[_0xe8eb('0x6e')])[_0xe8eb('0x6f')](this,_0xdfd61a);_0xdfd61a[_0xe8eb('0x70')]=Mustache[_0xe8eb('0x71')](_0xc0e30f[_0xe8eb('0x64')],_0x5101c3,{},['$$','$$']);if(_0xdfd61a[_0xe8eb('0x6c')]){_0xdfd61a[_0xe8eb('0x6c')]=JSON['parse'](Mustache[_0xe8eb('0x71')](JSON['stringify'](_0xdfd61a[_0xe8eb('0x6c')]),_0x5101c3,{},['$$','$$']));}if(_0xdfd61a['body']){_0xdfd61a[_0xe8eb('0x72')]=JSON['parse'](Mustache[_0xe8eb('0x71')](JSON[_0xe8eb('0x73')](_0xdfd61a[_0xe8eb('0x72')]),_0x5101c3,{},['$$','$$']));}}catch(_0x3788b4){logger[_0xe8eb('0x29')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3788b4);}}rp(_0xdfd61a)[_0xe8eb('0x10')](function(_0x5d8552){var _0x49da50={'statusCode':_0x5d8552[_0xe8eb('0x74')]||0xc8,'statusMessage':_0x5d8552[_0xe8eb('0x75')]||'OK','headers':_0x5d8552[_0xe8eb('0x6c')]||{},'body':_0x5d8552['body']||{}};_0x1c7324(null,_0x49da50);})[_0xe8eb('0x15')](function(_0x1017f1){var _0x21128a={'statusCode':_0x1017f1[_0xe8eb('0x74')]||0x1f4,'statusMessage':_0x1017f1[_0xe8eb('0x76')]||_0xe8eb('0x77'),'headers':_0x1017f1[_0xe8eb('0x78')][_0xe8eb('0x6c')]||{},'body':_0x1017f1[_0xe8eb('0x78')][_0xe8eb('0x72')]||{}};_0x1c7324(null,_0x21128a);});};AGIVertices['prototype'][_0xe8eb('0x79')]=function(_0x5248b6,_0x3deeb6){scripts[_0xe8eb('0x79')](this[_0xe8eb('0xc')][_0xe8eb('0x32')],_0x5248b6[_0xe8eb('0x7a')],_0x5248b6['text'],_0x5248b6[_0xe8eb('0x7b')]||'en')['then'](function(_0x41f0fc){_0x3deeb6(null,_0x41f0fc);})[_0xe8eb('0x15')](function(_0x1fc761){_0x3deeb6(_0x1fc761);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x7c')]=function(_0x48c99d,_0x29f88a){scripts[_0xe8eb('0x7c')](this[_0xe8eb('0xc')][_0xe8eb('0x32')],_0x48c99d['dialogflowV2_project_id'],_0x48c99d[_0xe8eb('0x7d')],_0x48c99d[_0xe8eb('0x7e')],_0x48c99d[_0xe8eb('0x61')],_0x48c99d[_0xe8eb('0x7f')]||'en')['then'](function(_0x35a38e){_0x29f88a(null,_0x35a38e);})['catch'](function(_0x1777df){_0x29f88a(_0x1777df);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x80')]=function(_0x4207d6,_0xea8491){scripts[_0xe8eb('0x80')](this[_0xe8eb('0xc')],_0x4207d6)[_0xe8eb('0x10')](function(_0x2b016e){_0xea8491(null,_0x2b016e);})[_0xe8eb('0x15')](function(_0x140e5e){_0xea8491(_0x140e5e);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x81')]=function(_0x342e2e,_0x5b2caa){scripts[_0xe8eb('0x81')](_0x342e2e['key'],_0x342e2e[_0xe8eb('0x61')],_0x342e2e['ispeech_tts_language']||_0xe8eb('0x5c'),_0x342e2e[_0xe8eb('0x82')])['then'](function(_0x448e52){_0x5b2caa(null,_0x448e52);})[_0xe8eb('0x15')](function(_0x1d8577){_0x5b2caa(_0x1d8577);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x83')]=function(_0xa6d79e,_0x148158,_0x15fe31){scripts[_0xe8eb('0x83')](_0x148158,_0xa6d79e[_0xe8eb('0x7a')],_0xa6d79e['ispeech_asr_language']||_0xe8eb('0x5c'),this['isConfigured'](_0xa6d79e[_0xe8eb('0x84')])?_0xa6d79e[_0xe8eb('0x84')]:undefined)[_0xe8eb('0x10')](function(_0x51d37a){_0x15fe31(null,_0x51d37a);})[_0xe8eb('0x15')](function(_0x1f8d5c){_0x15fe31(_0x1f8d5c);});};AGIVertices[_0xe8eb('0x16')]['awsPolly']=function(_0xf552e,_0x5e28ab){scripts[_0xe8eb('0x85')](_0xf552e[_0xe8eb('0x86')],_0xf552e[_0xe8eb('0x87')],_0xf552e[_0xe8eb('0x88')],_0xf552e['aws_polly_voice']||_0xe8eb('0x89'),_0xf552e[_0xe8eb('0x61')],_0xf552e['aws_text_type']||_0xe8eb('0x61'))[_0xe8eb('0x10')](function(_0x1377ee){_0x5e28ab(null,_0x1377ee);})['catch'](function(_0x166f20){_0x5e28ab(_0x166f20);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x8a')]=function(_0x558e6a,_0x1a575f){scripts['awsLex'](this[_0xe8eb('0xc')][_0xe8eb('0x32')],_0x558e6a[_0xe8eb('0x86')],_0x558e6a[_0xe8eb('0x87')],_0x558e6a[_0xe8eb('0x8b')],_0x558e6a[_0xe8eb('0x61')],_0x558e6a[_0xe8eb('0x8c')])[_0xe8eb('0x10')](function(_0x23e2ea){_0x1a575f(null,_0x23e2ea);})[_0xe8eb('0x15')](function(_0x304cb3){_0x1a575f(_0x304cb3);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x8d')]=function(_0x329c79,_0x430a76,_0x358dbf){scripts[_0xe8eb('0x8d')](_0x430a76,_0x329c79['key'],_0x329c79[_0xe8eb('0x8e')]||_0xe8eb('0x5c'))['then'](function(_0x19318b){_0x358dbf(null,_0x19318b);})[_0xe8eb('0x15')](function(_0x576a97){_0x358dbf(_0x576a97);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x8f')]=function(_0x5bce77,_0x2d134e,_0x561907){scripts[_0xe8eb('0x8f')](_0x2d134e,_0x5bce77[_0xe8eb('0x90')],_0x5bce77['appsecret'],_0x5bce77[_0xe8eb('0x70')])[_0xe8eb('0x10')](function(_0x409bfa){_0x561907(null,_0x409bfa);})['catch'](function(_0x2b96ce){_0x561907(_0x2b96ce);});};AGIVertices['prototype'][_0xe8eb('0x91')]=function(_0x13c917){var _0x69bc8=_[_0xe8eb('0x92')](verticesWithRetry,_0x13c917[_0xe8eb('0x34')])?_0x13c917:_[_0xe8eb('0x93')](_0x13c917);for(var _0x35c94b in _0x69bc8){if(_0x69bc8[_0xe8eb('0x94')](_0x35c94b)){if(_0x69bc8[_0x35c94b]&&_['isString'](_0x69bc8[_0x35c94b])){if(_['includes'](recursiveMapAttributes,_0x35c94b)){_0x69bc8[_0x35c94b]=this[_0xe8eb('0x95')](_0x69bc8[_0x35c94b]);}else{_0x69bc8[_0x35c94b]=this[_0xe8eb('0x96')](_0x69bc8[_0x35c94b]);}}}}return _0x69bc8;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x97')]=function(_0x729b76){for(var _0x4919a1 in _0x729b76){if(_0x729b76['hasOwnProperty'](_0x4919a1)){if(_['isPlainObject'](_0x729b76[_0x4919a1])){this['recursiveNodeIndex'](_0x729b76[_0x4919a1]);}else if(_[_0xe8eb('0x98')](_0x729b76[_0x4919a1])){for(var _0x4d708b=0x0;_0x4d708b<_0x729b76[_0x4919a1][_0xe8eb('0x99')];_0x4d708b++){this['recursiveNodeIndex'](_0x729b76[_0x4919a1][_0x4d708b]);}}else if(_[_0xe8eb('0x9a')](_0x729b76[_0x4919a1])){_0x729b76[_0x4919a1]=this[_0xe8eb('0x96')](_0x729b76[_0x4919a1]);}}}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x9b')]=function(_0x5d491f,_0x31f040){for(var _0x194838 in _0x5d491f){if(_0x5d491f[_0xe8eb('0x94')](_0x194838)){if(_['isPlainObject'](_0x5d491f[_0x194838])){if(!_[_0xe8eb('0x41')](_0x5d491f[_0x194838])){this[_0xe8eb('0x9b')](_0x5d491f[_0x194838],util[_0xe8eb('0x26')](_0xe8eb('0x9c'),_0x31f040,_0x194838));}}else if(_[_0xe8eb('0x98')](_0x5d491f[_0x194838])){for(var _0x5f04e0=0x0;_0x5f04e0<_0x5d491f[_0x194838]['length'];_0x5f04e0++){this['saveRestApiResult'](_0x5d491f[_0x194838][_0x5f04e0],util[_0xe8eb('0x26')](_0xe8eb('0x9c'),_0x31f040,_0x194838+'['+_0x5f04e0+']'));}}else{if(!_[_0xe8eb('0x42')](_0x5d491f[_0x194838])){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')]('%s.%s',_0x31f040,_0x194838),_0x5d491f[_0x194838]);}}}}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x95')]=function(_0x51b259){try{var _0xa07a82=JSON[_0xe8eb('0x6a')](_0x51b259);this['recursiveNodeIndex'](_0xa07a82);return JSON['stringify'](_0xa07a82);}catch(_0x4e93d2){return this['replaceAllVariables'](_0x51b259);}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x96')]=function(_0x34ab78){var _0x29972f=_0x34ab78['split']('{');for(var _0x58985d=0x1;_0x58985d<_0x29972f[_0xe8eb('0x99')];_0x58985d+=0x1){var _0x45da39=_0x29972f[_0x58985d]['split']('}');if(_0x45da39[_0xe8eb('0x99')]>0x1){_0x34ab78=_0x34ab78[_0xe8eb('0x9e')]('{'+_0x45da39[0x0]+'}',this['channel']['getVariable'](_0x45da39[0x0])[_0xe8eb('0x9f')]||_0x45da39[0x0]);}}if(_0x29972f['length']===0x1){return _0x34ab78[_0xe8eb('0x49')]();}return this[_0xe8eb('0x96')](_0x34ab78);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa0')]=function(_0x1a5bbe,_0x421c98){var _0x8f2e0=this[_0xe8eb('0xc')][_0xe8eb('0xe')](_0x1a5bbe);if(_0x8f2e0[_0xe8eb('0xa1')]===-0x1){return _0x8f2e0;}logger[_0xe8eb('0x2a')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x421c98,_0x8f2e0[_0xe8eb('0x9f')]));return this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x421c98,_0x8f2e0[_0xe8eb('0x9f')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa2')]=function(_0x333e3a){return _0x333e3a&&_0x333e3a!=='0'&&_0x333e3a!=='-1'&&_0x333e3a!=='';};AGIVertices['prototype'][_0xe8eb('0xa3')]=function(_0x54293f){this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x54293f,'-');_0x54293f[_0xe8eb('0xa4')]=_0x54293f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa5')]=function(_0x1ceffd){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0xa6'),_0x1ceffd[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x1ceffd[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')]['noop']('no\x20text\x20configured');}var _0x3c3ea3='\x22'+_0x1ceffd['text']+'\x22';if(this[_0xe8eb('0xa2')](_0x1ceffd[_0xe8eb('0x78')])){_0x3c3ea3+=','+_0x1ceffd[_0xe8eb('0x78')];}var _0x28514e=this[_0xe8eb('0xc')][_0xe8eb('0x55')]('MRCPSynth',_0x3c3ea3);if(_0x28514e[_0xe8eb('0xa1')]===-0x1){return _0x28514e;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xa8'),_0x3c3ea3));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa9')]=function(_0x23d848){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x23d848[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x23d848['grammar'])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0xaa'));}var _0x4f9b1b=_0x23d848[_0xe8eb('0xab')];if(this['isConfigured'](_0x23d848[_0xe8eb('0x78')])){_0x4f9b1b+=','+_0x23d848[_0xe8eb('0x78')];}var _0x351cb9=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xac'),_0x4f9b1b);if(_0x351cb9[_0xe8eb('0xa1')]===-0x1){return _0x351cb9;}var _0x3987d8=this[_0xe8eb('0xa0')](_0xe8eb('0xad'),'MRCP_RECOG_CONFIDENCE');if(_0x3987d8[_0xe8eb('0xa1')]===-0x1){return _0x3987d8;}var _0x52bdd7=this[_0xe8eb('0xa0')]('RECOG_INPUT()',_0xe8eb('0xae'));if(_0x52bdd7['result']===-0x1){return _0x52bdd7;}var _0x31309a=this[_0xe8eb('0xa0')](_0xe8eb('0xaf'),_0xe8eb('0xb0'));if(_0x31309a['result']===-0x1){return _0x31309a;}return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4f9b1b));};AGIVertices[_0xe8eb('0x16')]['agi']=function(_0x267613){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0xb1'),_0x267613[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0x5')]([_0x267613[_0xe8eb('0xb2')],_0x267613[_0xe8eb('0xb3')]]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xb4')]=function(_0xa5b2ea){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0xb5'),_0xa5b2ea[_0xe8eb('0x33')]));if(this[_0xe8eb('0xa2')](_0xa5b2ea['timeout'])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0xa5b2ea['timeout']));var _0x86b17d=this[_0xe8eb('0xc')][_0xe8eb('0xb6')](_0xa5b2ea[_0xe8eb('0x66')]);if(_0x86b17d[_0xe8eb('0xa1')]===-0x1){return _0x86b17d;}}return this['channel'][_0xe8eb('0xb4')]();};AGIVertices['prototype'][_0xe8eb('0x47')]=function(_0x2d593a){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0xb7'),_0x2d593a['label']));if(!this['isConfigured'](_0x2d593a[_0xe8eb('0x46')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x2d593a,_0xe8eb('0xb8'));}_0x2d593a[_0xe8eb('0x48')]=moment();if(this[_0xe8eb('0xa2')](_0x2d593a[_0xe8eb('0xb9')])){_0x2d593a['scheduledAt']=moment()[_0xe8eb('0xba')](_0x2d593a[_0xe8eb('0xb9')],_0xe8eb('0xbb'));}if(!this[_0xe8eb('0xa2')](_0x2d593a[_0xe8eb('0x4a')])){_0x2d593a[_0xe8eb('0x4a')]=0x2;}this['createCmContact'][_0xe8eb('0x6f')](this,_0x2d593a);return this['channel']['noop'](util[_0xe8eb('0x26')](_0xe8eb('0xbc'),_0x2d593a['phone'],_0x2d593a[_0xe8eb('0x46')],_0x2d593a[_0xe8eb('0x48')]));};AGIVertices[_0xe8eb('0x16')]['custom_app']=function(_0x5122e5){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0xbd'),_0x5122e5[_0xe8eb('0x33')]));var _0x22e9cd=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0x5122e5[_0xe8eb('0xbe')],_0x5122e5[_0xe8eb('0x78')]);if(_0x22e9cd[_0xe8eb('0xa1')]===-0x1){return _0x22e9cd;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Executed\x20command\x20%s\x20%s',_0x5122e5[_0xe8eb('0xbe')],_0x5122e5['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x42201f){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x42201f[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x42201f['text'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}var _0x17fb85='\x22'+_0x42201f['text']+'\x22';if(this['isConfigured'](_0x42201f['options'])){_0x17fb85+=','+_0x42201f[_0xe8eb('0x78')];}var _0x26b2c2=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xc0'),_0x17fb85);if(_0x26b2c2[_0xe8eb('0xa1')]===-0x1){return _0x26b2c2;}return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xa8'),_0x17fb85));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xc1')]=function(_0x60355b){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xc2'),_0x60355b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x60355b['text'])){return this['channel'][_0xe8eb('0xa7')]('no\x20text\x20configured');}var _0x52f22b='\x22'+_0x60355b[_0xe8eb('0x61')]+'\x22';if(this[_0xe8eb('0xa2')](_0x60355b[_0xe8eb('0x78')])){_0x52f22b+=','+_0x60355b[_0xe8eb('0x78')];}var _0x1a9978=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xc0'),_0x52f22b);if(_0x1a9978[_0xe8eb('0xa1')]===-0x1){return _0x1a9978;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xa8'),_0x52f22b));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xc3')]=function(_0x5be623){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xc4'),_0x5be623[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5be623[_0xe8eb('0xab')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xaa'));}var _0x279274=_0x5be623['grammar'];if(this[_0xe8eb('0xa2')](_0x5be623[_0xe8eb('0x78')])){_0x279274+=','+_0x5be623[_0xe8eb('0x78')];}var _0x33b536=this['channel']['exec'](_0xe8eb('0xac'),_0x279274);if(_0x33b536[_0xe8eb('0xa1')]===-0x1){return _0x33b536;}var _0x319a83=this[_0xe8eb('0xa0')](_0xe8eb('0xad'),_0xe8eb('0xc5'));if(_0x319a83[_0xe8eb('0xa1')]===-0x1){return _0x319a83;}var _0xd85b47=this[_0xe8eb('0xa0')](_0xe8eb('0xc6'),_0xe8eb('0xc7'));if(_0xd85b47[_0xe8eb('0xa1')]===-0x1){return _0xd85b47;}var _0x2df7ac=this[_0xe8eb('0xa0')](_0xe8eb('0xaf'),_0xe8eb('0xc8'));if(_0x2df7ac[_0xe8eb('0xa1')]===-0x1){return _0x2df7ac;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xc9'),_0x279274));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xca')]=function(_0x31fe5b){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xcb'),_0x31fe5b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x31fe5b['grammar'])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xaa'));}var _0x8b33fa=_0x31fe5b[_0xe8eb('0xab')];if(this[_0xe8eb('0xa2')](_0x31fe5b[_0xe8eb('0x78')])){_0x8b33fa+=','+_0x31fe5b['options'];}var _0x54d687=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xac'),_0x8b33fa);if(_0x54d687[_0xe8eb('0xa1')]===-0x1){return _0x54d687;}var _0x448f2c=this[_0xe8eb('0xa0')](_0xe8eb('0xad'),_0xe8eb('0xcc'));if(_0x448f2c[_0xe8eb('0xa1')]===-0x1){return _0x448f2c;}var _0x2039aa=this[_0xe8eb('0xa0')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x2039aa[_0xe8eb('0xa1')]===-0x1){return _0x2039aa;}var _0x4bb07d=this[_0xe8eb('0xa0')](_0xe8eb('0xaf'),_0xe8eb('0xcd'));if(_0x4bb07d['result']===-0x1){return _0x4bb07d;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0xc9'),_0x8b33fa));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xce')]=function(_0x5c4533){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xcf'),_0x5c4533[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x5c4533[_0xe8eb('0xd0')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c4533,'no\x20database\x20selected');}var _0x5c6347=this[_0xe8eb('0x18')][_0xe8eb('0x6f')](this,_0x5c4533[_0xe8eb('0xd0')]);if(!_0x5c6347){return this['channel'][_0xe8eb('0x29')](_0x5c4533,_0xe8eb('0xd1'));}if(!this[_0xe8eb('0xa2')](_0x5c4533[_0xe8eb('0x2c')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c4533,_0xe8eb('0xd2'));}var _0x517858=_0x5c4533['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xd3'),_0x517858));var _0x4eb8a9=this[_0xe8eb('0x28')]['sync'](this,_0x5c6347,_0x517858);this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x5c4533,_0x517858);if(!this[_0xe8eb('0xa2')](_0x5c4533[_0xe8eb('0xd4')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xd5'));}var _0x1e72f4=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x5c4533['variable_id']);if(!_0x1e72f4){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c4533,_0xe8eb('0xd6'));}var _0x3ef0e0=this;_0x4eb8a9['forEach'](function(_0x4d089f,_0x46a4d1){Object[_0xe8eb('0xd7')](_0x4d089f)[_0xe8eb('0xd8')](function(_0x3490cb){_0x3ef0e0[_0xe8eb('0xc')][_0xe8eb('0x9d')](util['format']('%s[%s][%s]',_0x1e72f4,_0x46a4d1,_0x3490cb),_0x4d089f[_0x3490cb]);});});this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0xd9'),_0x1e72f4),_0x4eb8a9[_0xe8eb('0x99')]);return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xda'),_0x1e72f4));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xdb')]=function(_0x323c87){logger[_0xe8eb('0xdc')](util[_0xe8eb('0x26')](_0xe8eb('0xdd'),_0x323c87[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x323c87[_0xe8eb('0xde')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x323c87,'no\x20user\x20selected');}var _0x4c52fd=this['getUser'][_0xe8eb('0x6f')](this,_0x323c87[_0xe8eb('0xde')]);if(!_0x4c52fd){return this[_0xe8eb('0xc')]['error'](_0x323c87,'no\x20user\x20found');}var _0x16b994=this['channel']['exec']('DIAL',[util[_0xe8eb('0x26')](_0xe8eb('0xdf'),_0x4c52fd),_0x323c87[_0xe8eb('0x66')],_0x323c87['opts'],_0x323c87['url']]);if(_0x16b994[_0xe8eb('0xa1')]===-0x1){return _0x16b994;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0xe0'),_0xe8eb('0xe1')));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xe2')]=function(_0x5b4d6b){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xe3'),_0x5b4d6b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5b4d6b[_0xe8eb('0x7a')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x5b4d6b[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this['channel'][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0x5b4d6b);this[_0xe8eb('0x3f')](_0x5b4d6b['text'],'in','','');this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xe5'),_0x5b4d6b['text']));var _0x3593e9=this[_0xe8eb('0x79')]['sync'](this,_0x5b4d6b);if(_0x3593e9){for(var _0x2483d6 in _0x3593e9){if(_0x3593e9[_0xe8eb('0x94')](_0x2483d6)){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0xe6'),_0x2483d6[_0xe8eb('0x69')]()),_0x3593e9[_0x2483d6]);}}this['createSquareMessage'](_0x3593e9[_0xe8eb('0xe7')],_0xe8eb('0xe8'),_0xe8eb('0xe2'),'');return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Dialogflow\x20Result\x20%s',_0x3593e9[_0xe8eb('0xe7')]));}return this['channel'][_0xe8eb('0x29')](_0x5b4d6b,_0xe8eb('0xe9'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xea')]=function(_0x3f6632){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0xeb'),_0x3f6632[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x3f6632[_0xe8eb('0xec')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xed'));}if(!this[_0xe8eb('0xa2')](_0x3f6632[_0xe8eb('0x7d')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20client_email\x20configured');}if(!this[_0xe8eb('0xa2')](_0x3f6632[_0xe8eb('0x7e')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3f6632['dialogflowV2_language'])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0xee'));}if(!this[_0xe8eb('0xa2')](_0x3f6632[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0x3f6632);this[_0xe8eb('0x3f')](_0x3f6632[_0xe8eb('0x61')],'in','','');this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xef'),_0x3f6632[_0xe8eb('0x61')]));var _0x33edae=this[_0xe8eb('0x7c')][_0xe8eb('0x6f')](this,_0x3f6632);if(_0x33edae){for(var _0x56a788 in _0x33edae){if(_0x33edae[_0xe8eb('0x94')](_0x56a788)){if(_0x56a788!==_0xe8eb('0xf0')){this['channel']['setVariable'](util[_0xe8eb('0x26')](_0xe8eb('0xe6'),_0x56a788[_0xe8eb('0x69')]()),_0x33edae[_0x56a788]);}}}this['createSquareMessage'](_0x33edae[_0xe8eb('0xe7')],_0xe8eb('0xe8'),_0xe8eb('0xea'),_0x33edae[_0xe8eb('0xf0')]);return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('DialogflowV2\x20Result\x20%s',_0x33edae['speech']));}return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x3f6632,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xe8eb('0x16')]['sesteknda']=function(_0x5d474d){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xf1'),_0x5d474d['label']));if(!this[_0xe8eb('0xa2')](_0x5d474d[_0xe8eb('0xf2')])){return this['channel']['noop'](_0xe8eb('0xf3'));}if(!this[_0xe8eb('0xa2')](_0x5d474d['username'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xf4'));}if(!this['isConfigured'](_0x5d474d[_0xe8eb('0xf5')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x5d474d[_0xe8eb('0xf6')])){return this['channel']['noop'](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0x5d474d);this['createSquareMessage'](_0x5d474d[_0xe8eb('0x61')],'in','','');this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xf7'),_0x5d474d[_0xe8eb('0x61')]));var _0x14fd52=this['sestekNDA'][_0xe8eb('0x6f')](this,_0x5d474d);if(_0x14fd52){for(var _0x53d56e in _0x14fd52){if(_0x14fd52[_0xe8eb('0x94')](_0x53d56e)){this[_0xe8eb('0xc')]['setVariable'](util[_0xe8eb('0x26')](_0xe8eb('0xf8'),_0x53d56e[_0xe8eb('0x69')]()),_0x14fd52[_0x53d56e]);}}this[_0xe8eb('0x3f')](_0x14fd52['speech'],'out',_0xe8eb('0xf9'),'');if(_0x14fd52[_0xe8eb('0xfa')]){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x14fd52[_0xe8eb('0xfa')]));var _0x2b8358=this[_0xe8eb('0xc')]['streamFile'](_0x14fd52[_0xe8eb('0xfa')]);try{fs[_0xe8eb('0xfb')](_0x14fd52['audiofile']+_0xe8eb('0xfc'));}catch(_0x31b7e0){logger[_0xe8eb('0x29')](_0x31b7e0);}return _0x2b8358;}else{return this[_0xe8eb('0xc')]['noop'](util['format'](_0xe8eb('0xfd'),_0x14fd52[_0xe8eb('0xe7')]));}}return this['channel']['error'](_0x5d474d,_0xe8eb('0xfe'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xff')]=function(_0x1fbc0a){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x100'),_0x1fbc0a[_0xe8eb('0x33')]));return this['channel']['noop'](_0xe8eb('0xff'));};AGIVertices['prototype'][_0xe8eb('0x101')]=function(_0x59af0f){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x59af0f[_0xe8eb('0x33')]));var _0x12637e='';if(_0x59af0f[_0xe8eb('0x102')]){if(!this['isConfigured'](_0x59af0f[_0xe8eb('0x102')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x59af0f,_0xe8eb('0x103'));}else{var _0x18b6e9=parseInt(_0x59af0f[_0xe8eb('0x102')],0xa);if(isNaN(_0x18b6e9)){_0x12637e=_0x59af0f[_0xe8eb('0x102')];}else{_0x12637e=this[_0xe8eb('0x104')][_0xe8eb('0x6f')](this,_0x59af0f['trunk_id']);if(!_0x12637e){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x59af0f,_0xe8eb('0x105'));}}}}else if(_0x59af0f[_0xe8eb('0x106')]){_0x12637e=_0x59af0f[_0xe8eb('0x106')];}else{return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x59af0f,_0xe8eb('0x103'));}var _0x3281de=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xe1'),[util['format']('SIP/%s/%s',_0x12637e,_0x59af0f[_0xe8eb('0x45')]),_0x59af0f['timeout'],_0x59af0f[_0xe8eb('0x107')],_0x59af0f[_0xe8eb('0x64')]]);if(_0x3281de[_0xe8eb('0xa1')]===-0x1){return _0x3281de;}return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0xe0'),_0xe8eb('0xe1')));};AGIVertices['prototype'][_0xe8eb('0x108')]=function(_0x5cb089){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x109'),_0x5cb089['label']));return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x108'));};AGIVertices['prototype'][_0xe8eb('0xa')]=function(_0x216fb6){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x10a'),_0x216fb6[_0xe8eb('0x33')]));if(_0x216fb6[_0xe8eb('0xa4')]===0x0){return this['maxRetry'](_0x216fb6);}_0x216fb6[_0xe8eb('0xa4')]-=0x1;if(!this[_0xe8eb('0xa2')](_0x216fb6[_0xe8eb('0x10b')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x216fb6,_0xe8eb('0x10c'));}var _0x457ffa=this[_0xe8eb('0x1d')]['sync'](this,_0x216fb6[_0xe8eb('0x10b')]);if(!_0x457ffa){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x216fb6,'no\x20file\x20audio\x20found');}if(!this[_0xe8eb('0xa2')](_0x216fb6['variable_id'])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xe8eb('0xd5'));}var _0x4b7757=this[_0xe8eb('0xc')][_0xe8eb('0x10d')](_0x457ffa,_0x216fb6['response'],_0x216fb6[_0xe8eb('0x10e')]);var _0x1dd088=_0x4b7757[_0xe8eb('0xa1')]?_0x4b7757['result'][_0xe8eb('0x49')]():'';logger[_0xe8eb('0x2a')]('test',JSON[_0xe8eb('0x73')](_0x4b7757));if(_0x4b7757[_0xe8eb('0xa1')]===-0x1){this[_0xe8eb('0x31')]['sync'](this,_0x216fb6,_0x1dd088);return _0x4b7757;}else if(_0x4b7757[_0xe8eb('0x9f')]===_0xe8eb('0x66')){_0x4b7757[_0xe8eb('0xa1')]=_0x1dd088['length']>=parseInt(_0x216fb6['mindigit'])?'x':'i';}else{_0x4b7757[_0xe8eb('0xa1')]=_0x1dd088['length']>=parseInt(_0x216fb6[_0xe8eb('0x10f')])&&_0x1dd088[_0xe8eb('0x99')]<=parseInt(_0x216fb6['maxdigit'])?'x':'i';}var _0x145b2b=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x216fb6[_0xe8eb('0xd4')]);if(!_0x145b2b){return this['channel'][_0xe8eb('0x29')](_0x216fb6,'no\x20variable\x20found');}this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x145b2b,_0x1dd088);if(this[_0xe8eb('0xa2')](_0x216fb6[_0xe8eb('0x110')])){var _0x5d9a7e=parseInt(_0x216fb6[_0xe8eb('0x110')],0xa);var _0x3966dd=rs[_0xe8eb('0x111')]({'charset':'*','length':_0x5d9a7e});var _0x360723=_0x1dd088['length'];if(_0x360723>0x0){if(_0x360723>_0x5d9a7e){this['createSquareDetailsReport'][_0xe8eb('0x6f')](this,_0x216fb6,_0x216fb6[_0xe8eb('0x112')]===_0xe8eb('0x113')?_0x3966dd+_0x1dd088['substr'](_0x5d9a7e):_0x1dd088['substr'](0x0,_0x360723-_0x5d9a7e)+_0x3966dd);}else{this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x216fb6,rs[_0xe8eb('0x111')]({'charset':'*','length':_0x360723}));}}else{this['createSquareDetailsReport'][_0xe8eb('0x6f')](this,_0x216fb6,'');}}else{this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x216fb6,_0x1dd088);}return _0x4b7757;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xb')]=function(_0x4be9ec){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x114'),_0x4be9ec[_0xe8eb('0x33')]));return this[_0xe8eb('0xa')](_0x4be9ec);};AGIVertices['prototype'][_0xe8eb('0x115')]=function(_0x40109a){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x116'),_0x40109a[_0xe8eb('0x33')]));this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x40109a,_0x40109a[_0xe8eb('0x117')]);return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0x118'),_0x40109a[_0xe8eb('0x117')]));};AGIVertices['prototype'][_0xe8eb('0x119')]=function(_0x411031){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x11a'),_0x411031[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x411031[_0xe8eb('0x86')])||!this[_0xe8eb('0xa2')](_0x411031[_0xe8eb('0x87')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x11b'));}if(!this[_0xe8eb('0xa2')](_0x411031[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x11c'),_0x411031[_0xe8eb('0x61')]));var _0x50f955=this[_0xe8eb('0x85')]['sync'](this,_0x411031);if(_0x50f955){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0x11d'),_0x50f955));var _0x2670dd=this[_0xe8eb('0xc')][_0xe8eb('0x11e')](_0x50f955);try{fs['unlink'](_0x50f955+_0xe8eb('0xfc'));}catch(_0x35d144){logger[_0xe8eb('0x29')](_0x35d144);}return _0x2670dd;}return this['channel'][_0xe8eb('0x29')](_0x411031,_0xe8eb('0x11f'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x120')]=function(_0xeb65e6){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x121'),_0xeb65e6['label']));if(!this[_0xe8eb('0xa2')](_0xeb65e6[_0xe8eb('0x86')])||!this[_0xe8eb('0xa2')](_0xeb65e6[_0xe8eb('0x87')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe8eb('0xa2')](_0xeb65e6['aws_bot_name'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0xe8eb('0xa2')](_0xeb65e6[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20text\x20configured');}this[_0xe8eb('0xc')][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0xeb65e6);this[_0xe8eb('0x3f')](_0xeb65e6[_0xe8eb('0x61')],'in','','');this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x122'),_0xeb65e6[_0xe8eb('0x61')]));var _0x55b1d5=this['awsLex']['sync'](this,_0xeb65e6);if(_0x55b1d5){for(var _0x51a37a in _0x55b1d5){if(_0x55b1d5[_0xe8eb('0x94')](_0x51a37a)&&_[_0xe8eb('0x9a')](_0x55b1d5[_0x51a37a])){this[_0xe8eb('0xc')]['setVariable'](util['format'](_0xe8eb('0x123'),_0x51a37a[_0xe8eb('0x69')]()),_0x55b1d5[_0x51a37a]);}}if(_[_0xe8eb('0x42')](_0x55b1d5['message'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xe8eb('0x3f')](_0x55b1d5[_0xe8eb('0x76')],_0xe8eb('0xe8'),_0xe8eb('0x124'),'');return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x125'),_0x55b1d5['message']));}}return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xeb65e6,_0xe8eb('0x126'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x127')]=function(_0x458055){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x128'),_0x458055[_0xe8eb('0x33')],_0x458055[_0xe8eb('0x66')]));if(!this[_0xe8eb('0xa2')](_0x458055[_0xe8eb('0x7a')])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x129'));}var _0x24972e=_0xe8eb('0x12a');var _0x5697f0=util[_0xe8eb('0x26')](_0xe8eb('0x12b'),FILES_PATH,rs[_0xe8eb('0x111')](0x4));var _0x4599af=util[_0xe8eb('0x26')](_0xe8eb('0x9c'),_0x5697f0,_0x24972e);var _0x251e53=!![];if(_0x458055['beep']===_0xe8eb('0x12c')){_0x251e53=![];}var _0x4e0b68=this[_0xe8eb('0xc')][_0xe8eb('0x12d')](_0x5697f0,_0x24972e,_0x458055[_0xe8eb('0x12e')],_0x458055[_0xe8eb('0x66')],undefined,_0x251e53);if(_0x4e0b68[_0xe8eb('0xa1')]!==-0x1){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('google\x20%s\x20file\x20created',_0x4599af));var _0xc891e9=this[_0xe8eb('0x8d')][_0xe8eb('0x6f')](this,_0x458055,_0x4599af);if(_0xc891e9){for(var _0x2edf56 in _0xc891e9){if(_0xc891e9[_0xe8eb('0x94')](_0x2edf56)){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')]('GOOGLE_ASR_%s',_0x2edf56[_0xe8eb('0x69')]()),_0xc891e9[_0x2edf56]);}}return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x12f'),JSON[_0xe8eb('0x73')](_0xc891e9)));}}return _0x4e0b68;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x130')]=function(_0x463242){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x131'),_0x463242[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x463242[_0xe8eb('0x90')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20appid\x20configured');}if(!this[_0xe8eb('0xa2')](_0x463242[_0xe8eb('0x132')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x133'));}var _0xb90909='wav';var _0xddfd18=util[_0xe8eb('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0xe8eb('0x111')](0x4));var _0x355868=util[_0xe8eb('0x26')]('%s.%s',_0xddfd18,_0xb90909);var _0x34fff2=!![];if(_0x463242[_0xe8eb('0x134')]===_0xe8eb('0x12c')){_0x34fff2=![];}var _0x2b1c92=this['channel'][_0xe8eb('0x12d')](_0xddfd18,_0xb90909,_0x463242[_0xe8eb('0x12e')],_0x463242['timeout'],undefined,_0x34fff2);if(_0x2b1c92['result']!==-0x1){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x135'),_0x355868));var _0x4a31b8=this['tildeASR'][_0xe8eb('0x6f')](this,_0x463242,_0x355868);if(_0x4a31b8){for(var _0x596a39 in _0x4a31b8){if(_0x4a31b8[_0xe8eb('0x94')](_0x596a39)){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0x136'),_0x596a39[_0xe8eb('0x69')]()),_0x4a31b8[_0x596a39]);}}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x137'),JSON['stringify'](_0x4a31b8)));}}return _0x2b1c92;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x138')]=function(_0x2caac2){logger['info'](util['format'](_0xe8eb('0x139'),_0x2caac2[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0x13a')](_0x2caac2['context'],_0x2caac2[_0xe8eb('0x3a')],_0x2caac2[_0xe8eb('0x3b')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x13b')]=function(_0x4477ad){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x13c'),_0x4477ad[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x4477ad[_0xe8eb('0x13d')])){return this['channel'][_0xe8eb('0x29')](_0x4477ad,_0xe8eb('0x13e'));}try{var _0x39cacf=eval(_0x4477ad[_0xe8eb('0x13d')])?'true':_0xe8eb('0x13f');this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4477ad['condition'],_0x39cacf));return{'code':0xc8,'result':_0x39cacf};}catch(_0x5b7853){return{'code':0xc8,'result':_0xe8eb('0x13f')};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x140')]=function(_0xe14ed4){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x141'),_0xe14ed4['label']));if(!this[_0xe8eb('0xa2')](_0xe14ed4[_0xe8eb('0x142')])){return this['channel'][_0xe8eb('0x29')](_0xe14ed4,_0xe8eb('0x143'));}var _0x39ef23=this[_0xe8eb('0x144')][_0xe8eb('0x6f')](this,_0xe14ed4[_0xe8eb('0x142')]);if(!_0x39ef23){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xe14ed4,_0xe8eb('0x145'));}for(var _0x45f53b=0x0;_0x45f53b<_0x39ef23[_0xe8eb('0x99')];_0x45f53b+=0x1){var _0x5c2971=this[_0xe8eb('0xc')][_0xe8eb('0xe')](util[_0xe8eb('0x26')](_0xe8eb('0x146'),_0x39ef23[_0x45f53b]));if(_0x5c2971[_0xe8eb('0xa1')]===-0x1){return _0x5c2971;}logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0x5c2971[_0xe8eb('0x9f')]));if(_0x5c2971[_0xe8eb('0x9f')]==='true'){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('IFTIME\x20%s\x20%s',_0x39ef23[_0x45f53b],_0xe8eb('0x148')));this['channel']['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0xe8eb('0x148')));return{'code':0xc8,'result':_0xe8eb('0x148')};}else{logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0xe8eb('0x13f')));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0xe8eb('0x13f')));}}return{'code':0xc8,'result':_0xe8eb('0x13f')};};AGIVertices[_0xe8eb('0x16')]['hangup']=function(_0x3b0cfb){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x149'),_0x3b0cfb['label']));return this[_0xe8eb('0xc')]['hangup']();};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x14a')]=function(_0x316041){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x14b'),_0x316041[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x316041[_0xe8eb('0x7a')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0x129'));}var _0x374bd6=_0xe8eb('0x12a');var _0x2337d3=util[_0xe8eb('0x26')](_0xe8eb('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x5217dc=util[_0xe8eb('0x26')]('%s.%s',_0x2337d3,_0x374bd6);var _0x5844b3=!![];if(_0x316041[_0xe8eb('0x134')]===_0xe8eb('0x12c')){_0x5844b3=![];}var _0x517f5c=this[_0xe8eb('0xc')][_0xe8eb('0x12d')](_0x2337d3,_0x374bd6,_0x316041['intKey'],_0x316041['timeout'],undefined,_0x5844b3);if(_0x517f5c[_0xe8eb('0xa1')]!==-0x1){this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x14c'),_0x5217dc));var _0x52f1d6=this['ispeechASR'][_0xe8eb('0x6f')](this,_0x316041,_0x5217dc);if(_0x52f1d6){for(var _0x44fcf9 in _0x52f1d6){if(_0x52f1d6[_0xe8eb('0x94')](_0x44fcf9)){this['channel'][_0xe8eb('0x9d')](util[_0xe8eb('0x26')]('ISPEECH_ASR_%s',_0x44fcf9['toUpperCase']()),_0x52f1d6[_0x44fcf9]);}}return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x14d'),JSON[_0xe8eb('0x73')](_0x52f1d6)));}}return _0x517f5c;};AGIVertices[_0xe8eb('0x16')]['ispeechtts']=function(_0x41f425){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x41f425[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x41f425['key'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x129'));}if(!this['isConfigured'](_0x41f425[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x14e'),_0x41f425[_0xe8eb('0x61')]));var _0x3548db=this['ispeechTTS']['sync'](this,_0x41f425);if(_0x3548db){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x14c'),_0x3548db));var _0x1e1ca7=this[_0xe8eb('0xc')][_0xe8eb('0x11e')](_0x3548db,_0x41f425[_0xe8eb('0x12e')]);try{fs['unlink'](_0x3548db+_0xe8eb('0xfc'));}catch(_0x47337c){logger[_0xe8eb('0x29')](_0x47337c);}return _0x1e1ca7;}return this['channel'][_0xe8eb('0x29')](_0x41f425,_0xe8eb('0x14f'));};AGIVertices[_0xe8eb('0x16')]['login']=function(_0x28f84a){logger['info'](util['format'](_0xe8eb('0x150'),_0x28f84a[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x28f84a[_0xe8eb('0x151')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x28f84a,_0xe8eb('0x152'));}logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x153'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));var _0x4f950d=this[_0xe8eb('0x53')]['sync'](this,_0x28f84a[_0xe8eb('0x151')]);if(_0x4f950d){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x155')};}else{logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this[_0xe8eb('0xc')]['callerid'],_0x28f84a[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x157')};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x158')]=function(_0x44e13b){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x159'),_0x44e13b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x44e13b[_0xe8eb('0x151')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x44e13b,_0xe8eb('0x152'));}logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x153'),this['channel'][_0xe8eb('0x36')],_0x44e13b[_0xe8eb('0x151')]));var _0x2970c1=this[_0xe8eb('0x4f')][_0xe8eb('0x6f')](this,_0x44e13b[_0xe8eb('0x151')]);if(_0x2970c1){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x44e13b[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this['channel'][_0xe8eb('0x36')],_0x44e13b['findBy']));return{'code':0xc8,'result':_0xe8eb('0x155')};}else{logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x156'),this[_0xe8eb('0xc')]['callerid'],_0x44e13b[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x44e13b[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x157')};}};AGIVertices['prototype'][_0xe8eb('0x15a')]=function(_0x4f91cf){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4f91cf['label']));if(!this[_0xe8eb('0xa2')](_0x4f91cf[_0xe8eb('0x15b')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x4f91cf,_0xe8eb('0x15c'));}this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x15d'),_0x4f91cf[_0xe8eb('0x15b')]));var _0xfc8b67=eval(_0x4f91cf[_0xe8eb('0x15b')]);if(!this['isConfigured'](_0x4f91cf[_0xe8eb('0xd4')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xd5'));}var _0x14465c=this['getVariable'][_0xe8eb('0x6f')](this,_0x4f91cf[_0xe8eb('0xd4')]);if(!_0x14465c){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x4f91cf,_0xe8eb('0xd6'));}if(_[_0xe8eb('0x98')](_0xfc8b67)){var _0xaa34b9=this;_0xfc8b67[_0xe8eb('0xd8')](function(_0x5b7886,_0x20feff){_0xaa34b9[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0x15e'),_0x14465c,_0x20feff),_0x5b7886);});return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')]('variable\x20%s[key]\x20set',_0x14465c));}else{return this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x14465c,_0xfc8b67);}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x9')]=function(_0xadf9cb){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x15f'),_0xadf9cb[_0xe8eb('0x33')]));if(_0xadf9cb[_0xe8eb('0xa4')]===0x0){return this['maxRetry'](_0xadf9cb);}_0xadf9cb['retry']-=0x1;if(!this[_0xe8eb('0xa2')](_0xadf9cb[_0xe8eb('0x10b')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xadf9cb,_0xe8eb('0x10c'));}var _0x4a157f=this[_0xe8eb('0x1d')][_0xe8eb('0x6f')](this,_0xadf9cb[_0xe8eb('0x10b')]);if(!_0x4a157f){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xadf9cb,'no\x20file\x20audio\x20found');}var _0x3077d8=this[_0xe8eb('0xc')][_0xe8eb('0x10d')](_0x4a157f,_0xadf9cb[_0xe8eb('0x160')],_0xadf9cb[_0xe8eb('0x161')]);var _0x3948d2=_0x3077d8[_0xe8eb('0xa1')];if(_0x3077d8[_0xe8eb('0xa1')]===-0x1){this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0xadf9cb,'-1');return _0x3077d8;}else if(_0x3077d8[_0xe8eb('0x9f')]==='timeout'){_0x3077d8[_0xe8eb('0xa1')]=_0x3077d8[_0xe8eb('0xa1')][_0xe8eb('0x99')]>0x0?_0x3077d8[_0xe8eb('0xa1')]:'t';}else if(_['isEmpty'](_0x3077d8[_0xe8eb('0xa1')])){_0x3077d8[_0xe8eb('0xa1')]='#';_0x3948d2='#';}if(!this[_0xe8eb('0xa2')](_0xadf9cb[_0xe8eb('0xd4')])){this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xd5'));}else{var _0x218845=this[_0xe8eb('0xe')]['sync'](this,_0xadf9cb['variable_id']);if(!_0x218845){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xadf9cb,'no\x20variable\x20found');}this[_0xe8eb('0xc')]['setVariable'](_0x218845,_0x3948d2);}this['createSquareDetailsReport'][_0xe8eb('0x6f')](this,_0xadf9cb,_0x3948d2);return _0x3077d8;};AGIVertices['prototype'][_0xe8eb('0xa7')]=function(_0x4b6f5f){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4b6f5f[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0x4b6f5f[_0xe8eb('0x162')]||_0x4b6f5f[_0xe8eb('0x33')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x163')]=function(_0x3c4f3a){logger['info'](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3c4f3a[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x3c4f3a[_0xe8eb('0x151')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x3c4f3a,'no\x20find\x20by\x20configured');}logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x153'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x3c4f3a['findBy']));var _0x2b2972=this[_0xe8eb('0x164')][_0xe8eb('0x6f')](this,_0x3c4f3a[_0xe8eb('0x165')]);var _0x56a5ca=this[_0xe8eb('0x4c')][_0xe8eb('0x6f')](this,_0x3c4f3a[_0xe8eb('0x151')],_0x2b2972);if(_0x56a5ca){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x3c4f3a[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe8eb('0xc')]['callerid'],_0x3c4f3a[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x155')};}else{logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this['channel'][_0xe8eb('0x36')],_0x3c4f3a[_0xe8eb('0x151')]));this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe8eb('0xc')]['callerid'],_0x3c4f3a['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x166')]=function(_0x3be43c){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x167'),_0x3be43c[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x3be43c['file_id'])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x3be43c,_0xe8eb('0x10c'));}var _0x5c01ad=this[_0xe8eb('0x1d')][_0xe8eb('0x6f')](this,_0x3be43c['file_id']);if(!_0x5c01ad){return this[_0xe8eb('0xc')]['error'](_0x3be43c,_0xe8eb('0x168'));}var _0x59d759=this[_0xe8eb('0xc')]['exec']('PLAYBACK',[_0x5c01ad,_0x3be43c['opts']]);if(_0x59d759[_0xe8eb('0xa1')]===-0x1){return _0x59d759;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x169'),_0xe8eb('0x16a'),_0x5c01ad));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x16b')]=function(_0x3c66b0){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x16c'),_0x3c66b0['label']));if(!this['isConfigured'](_0x3c66b0[_0xe8eb('0x16d')])){return this[_0xe8eb('0xc')]['error'](_0x3c66b0,_0xe8eb('0x16e'));}var _0x352ffc='';var _0x5146d4=parseInt(_0x3c66b0[_0xe8eb('0x16d')],0xa);if(isNaN(_0x5146d4)){_0x352ffc=_0x3c66b0[_0xe8eb('0x16d')];}else{_0x352ffc=this[_0xe8eb('0x12')][_0xe8eb('0x6f')](this,_0x3c66b0['queue_id']);if(!_0x352ffc){return this['channel'][_0xe8eb('0x29')](_0x3c66b0,_0xe8eb('0x16f'));}}var _0x59a93e='';if(this[_0xe8eb('0xa2')](_0x3c66b0[_0xe8eb('0x10b')])){var _0x1ebadc=this['getSound'][_0xe8eb('0x6f')](this,_0x3c66b0[_0xe8eb('0x10b')]);if(_0x1ebadc){_0x59a93e=_0x1ebadc;}}this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x3c66b0,_0x352ffc);if(_0x3c66b0[_0xe8eb('0x107')]['indexOf']('x')<0x0){_0x3c66b0[_0xe8eb('0x107')]+='x';}if(_0x3c66b0['opts'][_0xe8eb('0x170')]('X')<0x0){_0x3c66b0[_0xe8eb('0x107')]+='X';}this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0xe8eb('0x171'),_0x352ffc?_0x352ffc[_0xe8eb('0x172')]():'');var _0x4dce55=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0x173'),[_0x352ffc,_0x3c66b0[_0xe8eb('0x107')],_0x3c66b0[_0xe8eb('0x64')],_0x59a93e,_0x3c66b0[_0xe8eb('0x66')],_0x3c66b0[_0xe8eb('0x5')],_0x3c66b0[_0xe8eb('0x174')],_0x3c66b0['gosub'],'',_0x3c66b0[_0xe8eb('0x175')]]);if(_0x4dce55[_0xe8eb('0xa1')]===-0x1){return _0x4dce55;}return this['channel']['noop'](util[_0xe8eb('0x26')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x352ffc));};AGIVertices['prototype']['record']=function(_0x23caac){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x23caac[_0xe8eb('0x33')]));var _0x4945a8=_0x23caac[_0xe8eb('0x176')]||_0xe8eb('0x12a');var _0x26c424=util['format'](_0xe8eb('0x177'),this[_0xe8eb('0xc')][_0xe8eb('0x32')],rs['generate'](0x5));var _0xc165a8=util[_0xe8eb('0x26')](_0xe8eb('0x178'),FILES_PATH,_0x26c424,_0x4945a8);var _0x7803a6=util['format'](_0xe8eb('0x12b'),FILES_PATH,_0x26c424);this[_0xe8eb('0x37')]['sync'](this,_0x23caac,_0x26c424,_0xc165a8);this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0xe8eb('0x179'),_0x26c424);logger['info'](_0xe8eb('0x17a'),_0x7803a6,_0x4945a8,_0x23caac['escape_digits'],_0x23caac[_0xe8eb('0x66')]);return this[_0xe8eb('0xc')][_0xe8eb('0x12d')](_0x7803a6,_0x4945a8,_0x23caac[_0xe8eb('0x17b')],_0x23caac['timeout'],undefined,!![]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x17c')]=function(_0x270a90){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x270a90['label']));if(!this['isConfigured'](_0x270a90[_0xe8eb('0x64')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0x17d'));}var _0x7d48a0=this[_0xe8eb('0x63')][_0xe8eb('0x6f')](this,_0x270a90);logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Response:',util['inspect'](_0x7d48a0,{'showHidden':![],'depth':null})));if(!this[_0xe8eb('0xa2')](_0x270a90['variable_id'])){return this[_0xe8eb('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x16ebb8=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x270a90[_0xe8eb('0xd4')]);if(!_0x16ebb8){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x270a90,_0xe8eb('0xd6'));}this['channel']['setVariable'](util[_0xe8eb('0x26')](_0xe8eb('0x17e'),_0x16ebb8),_0x7d48a0[_0xe8eb('0x74')]?_0x7d48a0[_0xe8eb('0x74')]:_0xe8eb('0x17f'));this['channel'][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0x180'),_0x16ebb8),_0x7d48a0[_0xe8eb('0x75')]?_0x7d48a0[_0xe8eb('0x75')]:'OK');if(_0x7d48a0['body']){try{this[_0xe8eb('0x9b')](_0x7d48a0[_0xe8eb('0x72')],_0x16ebb8);}catch(_0x5848e5){logger[_0xe8eb('0x29')](util[_0xe8eb('0x26')](_0xe8eb('0x181'),_0x16ebb8));}}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xda'),_0x16ebb8));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x182')]=function(_0x3e4e71){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x183'),_0x3e4e71['label']));return this[_0xe8eb('0xc')][_0xe8eb('0x184')](_0x3e4e71[_0xe8eb('0x185')][_0xe8eb('0x57')](/\s+/g,''),_0x3e4e71[_0xe8eb('0x17b')]);};AGIVertices[_0xe8eb('0x16')]['saynumber']=function(_0x1113cb){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x186'),_0x1113cb['label']));return this[_0xe8eb('0xc')][_0xe8eb('0x187')](_0x1113cb[_0xe8eb('0x67')][_0xe8eb('0x57')](/\s+/g,''),_0x1113cb[_0xe8eb('0x17b')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x188')]=function(_0x40276c){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x189'),_0x40276c[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0x18a')](_0x40276c[_0xe8eb('0x61')],_0x40276c[_0xe8eb('0x17b')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x18b')]=function(_0x581faa){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x581faa[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x581faa['account_id'])){return this['channel'][_0xe8eb('0xa7')]('no\x20mail\x20account\x20configured');}var _0x20fe9f=this[_0xe8eb('0x1f')][_0xe8eb('0x6f')](this,_0x581faa['account_id']);if(!_0x20fe9f||!_0x20fe9f['Smtp']){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x581faa,_0xe8eb('0x18c'));}var _0x28b4e0={'from':util['format'](_0xe8eb('0x18d'),_0x20fe9f[_0xe8eb('0x11')],_0x20fe9f[_0xe8eb('0x18e')]||_0x20fe9f['Smtp']['user']),'to':_0x581faa['to']||'','cc':_0x581faa['cc']||'','bcc':_0x581faa[_0xe8eb('0x18f')]||'','subject':_0x581faa[_0xe8eb('0x190')],'html':_0x581faa['text'],'text':_0x581faa[_0xe8eb('0x61')]};var _0x1f8124={'tls':{'rejectUnauthorized':![]}};if(_0x20fe9f['Smtp']['service']){_0x1f8124['service']=_0x20fe9f['Smtp']['service'];}else{_0x1f8124[_0xe8eb('0x191')]=_0x20fe9f[_0xe8eb('0x192')]['host'];_0x1f8124['port']=_0x20fe9f[_0xe8eb('0x192')]['port'];_0x1f8124[_0xe8eb('0x193')]=_0x20fe9f[_0xe8eb('0x192')][_0xe8eb('0x193')];}if(_0x20fe9f['Smtp']['authentication']){_0x1f8124[_0xe8eb('0x194')]={'user':_0x20fe9f['Smtp'][_0xe8eb('0x195')],'pass':_0x20fe9f[_0xe8eb('0x192')][_0xe8eb('0x196')]};}if(this[_0xe8eb('0xa2')](_0x581faa[_0xe8eb('0x197')])){}logger[_0xe8eb('0xdc')](_0xe8eb('0x198'),JSON['stringify'](_0x28b4e0));this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x581faa,_0x581faa[_0xe8eb('0x199')]);this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x19a'),_0x20fe9f['name']));this[_0xe8eb('0x21')]['sync'](this,_0x1f8124,_0x28b4e0);return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x19b'));};AGIVertices['prototype']['sendFax']=function(_0x2c0204){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2c0204[_0xe8eb('0x33')]));return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x19c'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x19d')]=function(_0x5da528){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x19e'),_0x5da528[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5da528[_0xe8eb('0x19f')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x1a0'));}var _0xd6b5a0=this[_0xe8eb('0x1a1')][_0xe8eb('0x6f')](this,_0x5da528[_0xe8eb('0x19f')]);if(!_0xd6b5a0){return this['channel'][_0xe8eb('0x29')](_0x5da528,_0xe8eb('0x1a2'));}var _0x38560e={'body':_0x5da528[_0xe8eb('0x1a3')],'phone':_0x5da528['to']||'','SmsAccountId':_0xd6b5a0['id']};logger['debug'](_0xe8eb('0x1a4'),JSON[_0xe8eb('0x73')](_0x38560e));this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x5da528,_0x5da528[_0xe8eb('0x19f')]);this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1a5'),_0xd6b5a0[_0xe8eb('0x11')]));this[_0xe8eb('0x30')]['sync'](this,_0x38560e);return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0x1a6'));};AGIVertices['prototype']['set']=function(_0x4d4cc8){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x1a7'),_0x4d4cc8['label']));if(!this[_0xe8eb('0xa2')](_0x4d4cc8['variable_id'])){return this['channel'][_0xe8eb('0x29')](_0x4d4cc8,_0xe8eb('0x1a8'));}var _0x4c414d=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x4d4cc8[_0xe8eb('0xd4')]);if(!_0x4c414d){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x4d4cc8,_0xe8eb('0xd6'));}return this[_0xe8eb('0xc')]['setVariable'](_0x4c414d,_0x4d4cc8[_0xe8eb('0x1a9')]);};AGIVertices['prototype'][_0xe8eb('0x1aa')]=function(_0x2e6d5f){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1ab'),_0x2e6d5f[_0xe8eb('0x33')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('START\x20CALLY\x20SQUARE');if(_0x2e6d5f[_0xe8eb('0xb4')]==='yes'){this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x1ac'));return this['channel']['answer']();}return this['channel'][_0xe8eb('0xa7')]('Skipped\x20Answer');};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1ad')]=function(_0x587b59){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x1ae'),_0x587b59[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x587b59['project_id'])){return this['channel'][_0xe8eb('0x29')](_0x587b59,'no\x20subproject\x20selected');}var _0x60b18f=this[_0xe8eb('0x1af')][_0xe8eb('0x6f')](this,_0x587b59['project_id']);if(!this['isConfigured'](_0x60b18f)){return this['channel'][_0xe8eb('0x29')](_0x587b59,util[_0xe8eb('0x26')](_0xe8eb('0x1b0'),_0x587b59[_0xe8eb('0x1b1')]));}if(_0x60b18f===this[_0xe8eb('0xc')]['arg_1']){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x587b59,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x587b59,_0x60b18f);var _0x12c1ad=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0x1b2'),util[_0xe8eb('0x26')](_0xe8eb('0x1b3'),config[_0xe8eb('0x5')][_0xe8eb('0x191')]||_0xe8eb('0x1b4'),_0x60b18f,this[_0xe8eb('0xc')][_0xe8eb('0x35')]));if(_0x12c1ad['result']===-0x1){return _0x12c1ad;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x60b18f));};AGIVertices['prototype'][_0xe8eb('0x1b5')]=function(_0x4f2a87){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x1b6'),_0x4f2a87[_0xe8eb('0x33')]));var _0x3e7ec8=this[_0xe8eb('0x54')][_0xe8eb('0x6f')](this,_0x4f2a87['command']);this[_0xe8eb('0x31')]['sync'](this,_0x4f2a87,_0x4f2a87['command']);if(this[_0xe8eb('0xa2')](_0x4f2a87[_0xe8eb('0xd4')])){var _0x51893c=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x4f2a87['variable_id']);if(_0x51893c){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x51893c,_0x3e7ec8);return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x1b7'),_0x4f2a87[_0xe8eb('0xb2')],_0x51893c));}}return this[_0xe8eb('0xc')]['noop'](util['format'](_0xe8eb('0x1b8'),_0x4f2a87['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x11a3bd){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1b9'),_0x11a3bd[_0xe8eb('0x33')]));_0x11a3bd[_0xe8eb('0x61')]=_0x11a3bd[_0xe8eb('0x61')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x11a3bd[_0xe8eb('0x59')])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x1ba'));}if(!this['isConfigured'](_0x11a3bd[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xbf'));}this['channel']['noop'](util[_0xe8eb('0x26')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x11a3bd[_0xe8eb('0x61')]));var _0x2df377=this[_0xe8eb('0x58')]['sync'](this,_0x11a3bd);if(_0x2df377){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1bb'),_0x2df377));var _0x49f397=this['channel'][_0xe8eb('0x11e')](_0x2df377);try{fs[_0xe8eb('0xfb')](_0x2df377+_0xe8eb('0xfc'));}catch(_0x5de451){logger['error'](_0x5de451);}return _0x49f397;}return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x11a3bd,_0xe8eb('0x1bc'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1bd')]=function(_0x10dbe0){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1be'),_0x10dbe0['label']));_0x10dbe0[_0xe8eb('0x61')]=_0x10dbe0[_0xe8eb('0x61')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x10dbe0[_0xe8eb('0x61')])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1bf'),_0x10dbe0[_0xe8eb('0x61')]));var _0x12e184=this[_0xe8eb('0x60')]['sync'](this,_0x10dbe0);if(_0x12e184){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1c0'),_0x12e184));var _0x232af8=this[_0xe8eb('0xc')][_0xe8eb('0x11e')](_0x12e184);try{}catch(_0x219971){logger[_0xe8eb('0x29')](_0x219971);}return _0x232af8;}return this['channel']['error'](_0x10dbe0,_0xe8eb('0x1c1'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1c2')]=function(_0x428b8c){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x428b8c['label']));if(!this[_0xe8eb('0xa2')](_0x428b8c[_0xe8eb('0x151')])){return this['channel'][_0xe8eb('0x29')](_0x428b8c,_0xe8eb('0x152'));}logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));var _0x1a437a=this['agentUnpause'][_0xe8eb('0x6f')](this,_0x428b8c[_0xe8eb('0x151')]);if(_0x1a437a){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this['channel'][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x156'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this['channel'][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1c3')]=function(_0x40b02){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1c4'),_0x40b02[_0xe8eb('0x33')]));var _0x7ae919=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0x1c5'),[_0x40b02['mailbox'],_0x40b02[_0xe8eb('0x78')]]);if(_0x7ae919[_0xe8eb('0xa1')]===-0x1){return _0x7ae919;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x169'),'VOICEMAIL',_0x40b02[_0xe8eb('0x1c6')]));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1c7')]=function(_0x5c94a3){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x1c8'),_0x5c94a3[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5c94a3[_0xe8eb('0xd4')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c94a3,_0xe8eb('0x1a8'));}var _0x1a6525=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x5c94a3[_0xe8eb('0xd4')]);if(!_0x1a6525){return this[_0xe8eb('0xc')]['error'](_0x5c94a3,_0xe8eb('0xd6'));}var _0x120111=this[_0xe8eb('0xc')][_0xe8eb('0xe')](_0x1a6525);return{'code':0xc8,'result':_0x120111[_0xe8eb('0x9f')]?_0x120111[_0xe8eb('0x9f')]:'-'};};String[_0xe8eb('0x16')][_0xe8eb('0x9e')]=function(_0x26d8af,_0x3c089e){return this[_0xe8eb('0x1c9')](_0x26d8af)[_0xe8eb('0x1ca')](_0x3c089e);};module['exports']=AGIVertices; \ No newline at end of file +var _0x4ccb=['Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','getVariable','rpc','getVariableById','name','catch','getVoiceQueueById','then','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccountById','mailRpc','getIntervals','getIntervalById','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','stringify','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','split','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','setVariable','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','dialogflow','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20anguage\x20configured','bot','providerResponse','toUpperCase','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','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\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','sendFax','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts'];(function(_0x52e33c,_0xe10046){var _0x450503=function(_0x4436c9){while(--_0x4436c9){_0x52e33c['push'](_0x52e33c['shift']());}};_0x450503(++_0xe10046);}(_0x4ccb,0x1db));var _0xb4cc=function(_0x42e1e4,_0x355e50){_0x42e1e4=_0x42e1e4-0x0;var _0x357b9c=_0x4ccb[_0x42e1e4];return _0x357b9c;};'use strict';var fs=require('fs');var path=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var _=require(_0xb4cc('0x2'));var sh=require(_0xb4cc('0x3'));var odbc=require(_0xb4cc('0x4'))();var rs=require(_0xb4cc('0x5'));var moment=require(_0xb4cc('0x6'));var Mustache=require(_0xb4cc('0x7'));var rp=require(_0xb4cc('0x8'));var logger=require(_0xb4cc('0x9'))(_0xb4cc('0xa'));var config=require(_0xb4cc('0xb'));var scripts=require('./scripts');var FILES_PATH=_0xb4cc('0xc');var recursiveMapAttributes=[_0xb4cc('0xd'),_0xb4cc('0xe')];var verticesWithRetry=[_0xb4cc('0xf'),_0xb4cc('0x10'),_0xb4cc('0x11')];var AGIVertices=function(_0x5391c6,_0x46b79f,_0x69cb8c){this[_0xb4cc('0x12')]=_0x5391c6;this['rpc']=_0x46b79f;this['mailRpc']=_0x69cb8c;};AGIVertices['prototype'][_0xb4cc('0x13')]=function(_0x1cffdc,_0xfcbede){this[_0xb4cc('0x14')][_0xb4cc('0x15')](_0x1cffdc)['then'](function(_0x15f7ba){_0xfcbede(null,_0x15f7ba?_0x15f7ba[_0xb4cc('0x16')]:![]);})[_0xb4cc('0x17')](function(_0x7c6c15){_0xfcbede(_0x7c6c15);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x484146,_0x444c93){this[_0xb4cc('0x14')][_0xb4cc('0x18')](_0x484146)[_0xb4cc('0x19')](function(_0xb2acbd){_0x444c93(null,_0xb2acbd?_0xb2acbd[_0xb4cc('0x16')]:![]);})[_0xb4cc('0x17')](function(_0x43321f){_0x444c93(_0x43321f);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1b')]=function(_0x391e61,_0x25c366){this['rpc'][_0xb4cc('0x1c')](_0x391e61)[_0xb4cc('0x19')](function(_0x20215a){_0x25c366(null,_0x20215a?_0x20215a['name']:![]);})[_0xb4cc('0x17')](function(_0x4a7294){_0x25c366(_0x4a7294);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1d')]=function(_0x1f910f,_0x25cf66){this[_0xb4cc('0x14')][_0xb4cc('0x1e')](_0x1f910f)['then'](function(_0x18ea1c){_0x25cf66(null,_0x18ea1c?_0x18ea1c[_0xb4cc('0x1f')]:![]);})[_0xb4cc('0x17')](function(_0x19c570){_0x25cf66(_0x19c570);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x20')]=function(_0x3e7a9d,_0x2de528){this['rpc'][_0xb4cc('0x21')](_0x3e7a9d)[_0xb4cc('0x19')](function(_0x3ef865){_0x2de528(null,_0x3ef865?_0x3ef865[_0xb4cc('0x16')]:![]);})['catch'](function(_0x207065){_0x2de528(_0x207065);});};AGIVertices['prototype']['getTrunk']=function(_0x43c912,_0x165647){this[_0xb4cc('0x14')][_0xb4cc('0x22')](_0x43c912)[_0xb4cc('0x19')](function(_0x37843d){_0x165647(null,_0x37843d?_0x37843d[_0xb4cc('0x16')]:![]);})[_0xb4cc('0x17')](function(_0x3d37da){_0x165647(_0x3d37da);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x23')]=function(_0x3fe4b0,_0x3099fb){var _0x4dc35e=this;this['rpc']['getSoundById'](_0x3fe4b0)[_0xb4cc('0x19')](function(_0x43c64d){_0x3099fb(null,_0x43c64d?_0x4dc35e[_0xb4cc('0x24')](_0x43c64d[_0xb4cc('0x25')]):![]);})[_0xb4cc('0x17')](function(_0x7a53b7){_0x3099fb(_0x7a53b7);});};AGIVertices['prototype']['getMailAccount']=function(_0x5dccd1,_0x80ef6c){this['rpc'][_0xb4cc('0x26')](_0x5dccd1)[_0xb4cc('0x19')](function(_0xafc32b){_0x80ef6c(null,_0xafc32b?_0xafc32b:![]);})[_0xb4cc('0x17')](function(_0x5545a2){_0x80ef6c(_0x5545a2);});};AGIVertices[_0xb4cc('0x1a')]['sendMailMessage']=function(_0x406b20,_0x46a7e7,_0xae7b85){this[_0xb4cc('0x27')]['sendMailMessage'](_0x406b20,_0x46a7e7)[_0xb4cc('0x19')](function(){_0xae7b85(null);})[_0xb4cc('0x17')](function(_0x318505){_0xae7b85(_0x318505);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x28')]=function(_0x3ed095,_0x27e231){this[_0xb4cc('0x14')][_0xb4cc('0x29')](_0x3ed095)[_0xb4cc('0x19')](function(_0x3b65ec){if(_0x3b65ec){if(_0x3b65ec['IntervalId']){_0x27e231(null,[_0x3b65ec[_0xb4cc('0x2a')]]);}else{_0x27e231(null,_[_0xb4cc('0x2b')](_0x3b65ec[_0xb4cc('0x2c')],'interval'));}}else{_0x27e231(null,![]);}})[_0xb4cc('0x17')](function(_0x5cb8fb){_0x27e231(_0x5cb8fb);});};AGIVertices['prototype'][_0xb4cc('0x24')]=function(_0x2186e8){return util[_0xb4cc('0x2d')]('%s/sounds/converted/%s',FILES_PATH,_0x2186e8);};AGIVertices['prototype'][_0xb4cc('0x2e')]=function(_0x45d674,_0x5ac5c5,_0x245ac5){odbc[_0xb4cc('0x2f')](_0x45d674,function(_0x3fa216){if(_0x3fa216){logger[_0xb4cc('0x30')](_0xb4cc('0x31'),_0x3fa216);_0x245ac5(_0x3fa216);}else{logger[_0xb4cc('0x32')](_0xb4cc('0x33'));odbc[_0xb4cc('0x34')](_0x5ac5c5,function(_0xfeb423,_0x58bccf){if(_0xfeb423){logger[_0xb4cc('0x32')](_0xb4cc('0x35'),_0x5ac5c5);_0x245ac5(_0xfeb423);}else{logger[_0xb4cc('0x32')](_0xb4cc('0x36'),_0x5ac5c5);odbc[_0xb4cc('0x37')](function(_0x1cdb21){if(_0x1cdb21){logger['error'](_0xb4cc('0x38'),_0x1cdb21);}_0x245ac5(null,_0x58bccf);});}});}});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x39')]=function(_0x2a4b06,_0x2fad49){this[_0xb4cc('0x14')]['getSmsAccountById'](_0x2a4b06)[_0xb4cc('0x19')](function(_0x3d44ff){_0x2fad49(null,_0x3d44ff?_0x3d44ff:![]);})[_0xb4cc('0x17')](function(_0x57609c){_0x2fad49(_0x57609c);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x3a')]=function(_0x36f7a6,_0x2b3001){this[_0xb4cc('0x14')]['createSmsMessage'](_0x36f7a6)['then'](function(_0x8e9a95){_0x2b3001(null,_0x8e9a95);})[_0xb4cc('0x17')](function(_0x2e4d58){_0x2b3001(_0x2e4d58);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x3b')]=function(_0x42fb4e,_0x57785c,_0xbb95a0){this['rpc'][_0xb4cc('0x3b')]({'uniqueid':this[_0xb4cc('0x12')][_0xb4cc('0x3c')],'node':_0x42fb4e[_0xb4cc('0x3d')],'application':_0x42fb4e['agicommand'],'data':_0x57785c||null,'project_name':this['channel'][_0xb4cc('0x3e')],'callerid':this['channel']['callerid']})[_0xb4cc('0x19')](function(_0x4a2cbf){if(_0xbb95a0){_0xbb95a0(null,_0x4a2cbf);}})[_0xb4cc('0x17')](function(_0x1147ed){if(_0xbb95a0){_0xbb95a0(_0x1147ed);}});};AGIVertices[_0xb4cc('0x1a')]['createSquareRecording']=function(_0x3b0255,_0x3238f4,_0x5226f1,_0x45f954){this[_0xb4cc('0x14')][_0xb4cc('0x3f')]({'uniqueid':this['channel']['uniqueid'],'callerid':this['channel'][_0xb4cc('0x40')],'calleridname':this[_0xb4cc('0x12')][_0xb4cc('0x41')],'context':this[_0xb4cc('0x12')][_0xb4cc('0x42')],'extension':this[_0xb4cc('0x12')]['extension'],'priority':this[_0xb4cc('0x12')]['priority'],'accountcode':this[_0xb4cc('0x12')][_0xb4cc('0x43')],'dnid':this[_0xb4cc('0x12')][_0xb4cc('0x44')],'projectName':this[_0xb4cc('0x12')][_0xb4cc('0x3e')],'saveName':_0x3238f4,'filename':_0x3b0255[_0xb4cc('0x45')]||_0x3238f4,'savePath':_0x5226f1})[_0xb4cc('0x19')](function(_0x54bf3d){_0x45f954(null,_0x54bf3d);})[_0xb4cc('0x17')](function(_0x381d5c){_0x45f954(_0x381d5c);});};AGIVertices[_0xb4cc('0x1a')]['createSquareMessage']=function(_0xdd649,_0x3b3955,_0x7cb826,_0x4a027e,_0x3d4710){this[_0xb4cc('0x14')][_0xb4cc('0x46')]({'uniqueid':this[_0xb4cc('0x12')][_0xb4cc('0x3c')],'body':_0xdd649,'direction':_0x3b3955,'providerName':_0x7cb826,'providerResponse':_0x4a027e})[_0xb4cc('0x19')](function(_0x2fdf00){if(_0x3d4710){_0x3d4710(null,_0x2fdf00);}})[_0xb4cc('0x17')](function(_0x1e7b71){if(_0x3d4710){_0x3d4710(_0x1e7b71);}});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x47')]=function(_0x2325b8,_0x36afe5){this[_0xb4cc('0x14')][_0xb4cc('0x47')]({'firstName':_[_0xb4cc('0x48')](_0x2325b8[_0xb4cc('0x16')])||_[_0xb4cc('0x49')](_0x2325b8['name'])?_0xb4cc('0x4a')+Math[_0xb4cc('0x4b')]():_0x2325b8[_0xb4cc('0x16')],'lastName':_['isEmpty'](_0x2325b8[_0xb4cc('0x4c')])||_[_0xb4cc('0x49')](_0x2325b8[_0xb4cc('0x4c')])?null:_0x2325b8[_0xb4cc('0x4c')],'phone':_0x2325b8[_0xb4cc('0x4d')],'ListId':_0x2325b8[_0xb4cc('0x4e')],'scheduledat':_0x2325b8[_0xb4cc('0x4f')],'callbackUniqueid':this[_0xb4cc('0x12')][_0xb4cc('0x3c')],'tags':_0xb4cc('0x50'),'description':_0xb4cc('0x51')+_0x2325b8[_0xb4cc('0x4f')]['toString'](),'priority':_0x2325b8[_0xb4cc('0x52')]})[_0xb4cc('0x19')](function(_0x1b1a68){_0x36afe5(null,_0x1b1a68);})['catch'](function(_0x9e5195){_0x36afe5(_0x9e5195);});};AGIVertices['prototype']['getPause']=function(_0x397016,_0x32fb8f){this[_0xb4cc('0x14')][_0xb4cc('0x53')](_0x397016)[_0xb4cc('0x19')](function(_0x10b1b7){_0x32fb8f(null,_0x10b1b7?_0x10b1b7['name']:![]);})[_0xb4cc('0x17')](function(_0x1f675f){_0x32fb8f(_0x1f675f);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x54')]=function(_0x488a7d,_0x27894c,_0x314fd7){var _0x4d8e82={'role':'agent'};_0x4d8e82[_0x488a7d]=this[_0xb4cc('0x12')]['callerid'];this['rpc'][_0xb4cc('0x54')](_0x4d8e82,_0x27894c,this[_0xb4cc('0x12')][_0xb4cc('0x3c')])[_0xb4cc('0x19')](function(_0xd127a4){_0x314fd7(null,_['isNil'](_0xd127a4)?![]:!![]);})[_0xb4cc('0x17')](function(_0x37e4f8){logger[_0xb4cc('0x30')](_0x37e4f8);_0x314fd7(null,![]);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x55')]=function(_0x2ab564,_0x2413e3){var _0x2bf24b={'role':_0xb4cc('0x56')};_0x2bf24b[_0x2ab564]=this[_0xb4cc('0x12')]['callerid'];this['rpc']['agentUnpause'](_0x2bf24b)['then'](function(_0x19e7fc){_0x2413e3(null,_['isNil'](_0x19e7fc)?![]:!![]);})['catch'](function(_0x64fee3){logger[_0xb4cc('0x30')](_0x64fee3);_0x2413e3(null,![]);});};AGIVertices[_0xb4cc('0x1a')]['agentLogout']=function(_0x5ca3b5,_0x388065){var _0x502f32={'role':'agent'};_0x502f32[_0x5ca3b5]=this['channel'][_0xb4cc('0x40')];this[_0xb4cc('0x14')][_0xb4cc('0x57')](_0x502f32)[_0xb4cc('0x19')](function(_0x29e91b){_0x388065(null,_[_0xb4cc('0x49')](_0x29e91b)?![]:!![]);})[_0xb4cc('0x17')](function(_0xbe2dd9){logger[_0xb4cc('0x30')](_0xbe2dd9);_0x388065(null,![]);});};AGIVertices[_0xb4cc('0x1a')]['agentLogin']=function(_0x47291f,_0x4449ca){var _0x397858={'role':_0xb4cc('0x56')};_0x397858[_0x47291f]=this[_0xb4cc('0x12')][_0xb4cc('0x40')];var _0x6fa25f=_0x47291f!=_0xb4cc('0x58')?util[_0xb4cc('0x2d')](_0xb4cc('0x59'),'LOCAL',this[_0xb4cc('0x12')]['callerid']):undefined;this[_0xb4cc('0x14')][_0xb4cc('0x5a')](_0x397858,_0x6fa25f)[_0xb4cc('0x19')](function(_0x6d0d17){_0x4449ca(null,_[_0xb4cc('0x49')](_0x6d0d17)?![]:!![]);})[_0xb4cc('0x17')](function(_0x5270ed){logger['error'](_0x5270ed);_0x4449ca(null,![]);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x5b')]=function(_0x11a530,_0x1deddf){sh[_0xb4cc('0x5c')](_[_0xb4cc('0x5d')](_0x11a530),function(_0x18b473,_0x1c22eb){var _0x3d3732=_0x1c22eb[_0xb4cc('0x5e')](/(\r\n|\n|\r)/gm,'');_0x1deddf(null,_0x3d3732);});};AGIVertices[_0xb4cc('0x1a')]['googleCloudTTS']=function(_0x3b9634,_0x19bb43){scripts[_0xb4cc('0x5f')](_0x3b9634[_0xb4cc('0x60')],_0x3b9634[_0xb4cc('0x61')]||'text',_0x3b9634[_0xb4cc('0x62')],_0x3b9634[_0xb4cc('0x63')]||_0xb4cc('0x64'),_0x3b9634[_0xb4cc('0x65')]||_0xb4cc('0x66'),_0x3b9634['audioEncoding']||_0xb4cc('0x67'))[_0xb4cc('0x19')](function(_0x5e2ccd){_0x19bb43(null,_0x5e2ccd);})[_0xb4cc('0x17')](function(_0x57a980){_0x19bb43(_0x57a980);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x68')]=function(_0x2e5577,_0x6e49e){scripts['googleTTS'](_0x2e5577[_0xb4cc('0x62')],_0x2e5577[_0xb4cc('0x69')]||'en',0x1)[_0xb4cc('0x19')](function(_0x4c5390){_0x6e49e(null,_0x4c5390);})[_0xb4cc('0x17')](function(_0x47a10b){_0x6e49e(_0x47a10b);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x6a')]=function(_0x580b53,_0xe8cb6b){var _0x5f2098={'uri':_0x580b53[_0xb4cc('0x6b')],'method':_0x580b53[_0xb4cc('0x6c')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x580b53[_0xb4cc('0x6d')])===_0xb4cc('0x6e')&&parseInt(_0x580b53[_0xb4cc('0x6d')])>=0x1?parseInt(_0x580b53['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xb4cc('0x6f')]([_0xb4cc('0x70'),_0xb4cc('0x71')],_0x5f2098[_0xb4cc('0x6c')]['toUpperCase']())){try{_0x5f2098[_0xb4cc('0x72')]=_0x580b53[_0xb4cc('0xe')]?JSON[_0xb4cc('0x73')](_0x580b53['rawBody']):{};}catch(_0x6df534){logger[_0xb4cc('0x30')](_0xb4cc('0x74'),_0x6df534);}}try{_0x5f2098[_0xb4cc('0x75')]=_0x580b53['rawHeaders']?JSON[_0xb4cc('0x73')](_0x580b53[_0xb4cc('0xd')]):{};}catch(_0x7a7898){logger[_0xb4cc('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x7a7898);}if(_0x580b53[_0xb4cc('0x76')]){try{var _0x478810=require(_0x580b53[_0xb4cc('0x76')])[_0xb4cc('0x77')](this,_0x5f2098);_0x5f2098[_0xb4cc('0x78')]=Mustache['render'](_0x580b53[_0xb4cc('0x6b')],_0x478810,{},['$$','$$']);if(_0x5f2098['headers']){_0x5f2098[_0xb4cc('0x75')]=JSON['parse'](Mustache['render'](JSON[_0xb4cc('0x79')](_0x5f2098['headers']),_0x478810,{},['$$','$$']));}if(_0x5f2098['body']){_0x5f2098[_0xb4cc('0x72')]=JSON[_0xb4cc('0x73')](Mustache['render'](JSON[_0xb4cc('0x79')](_0x5f2098[_0xb4cc('0x72')]),_0x478810,{},['$$','$$']));}}catch(_0x1c31e0){logger[_0xb4cc('0x30')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1c31e0);}}rp(_0x5f2098)[_0xb4cc('0x19')](function(_0x26951c){var _0x58d54d={'statusCode':_0x26951c['statusCode']||0xc8,'statusMessage':_0x26951c['statusMessage']||'OK','headers':_0x26951c['headers']||{},'body':_0x26951c[_0xb4cc('0x72')]||{}};_0xe8cb6b(null,_0x58d54d);})[_0xb4cc('0x17')](function(_0x57e083){var _0x38393b={'statusCode':_0x57e083['statusCode']||0x1f4,'statusMessage':_0x57e083[_0xb4cc('0x7a')]||_0xb4cc('0x7b'),'headers':_0x57e083[_0xb4cc('0x7c')]['headers']||{},'body':_0x57e083['options'][_0xb4cc('0x72')]||{}};_0xe8cb6b(null,_0x38393b);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x7d')]=function(_0xcf98b8,_0x453d85){scripts[_0xb4cc('0x7d')](this[_0xb4cc('0x12')][_0xb4cc('0x3c')],_0xcf98b8[_0xb4cc('0x7e')],_0xcf98b8[_0xb4cc('0x62')],_0xcf98b8[_0xb4cc('0x7f')]||'en')['then'](function(_0x5da19f){_0x453d85(null,_0x5da19f);})[_0xb4cc('0x17')](function(_0x15584d){_0x453d85(_0x15584d);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x80')]=function(_0xfcad46,_0x4c02ec){scripts[_0xb4cc('0x80')](this[_0xb4cc('0x12')][_0xb4cc('0x3c')],_0xfcad46[_0xb4cc('0x81')],_0xfcad46[_0xb4cc('0x82')],_0xfcad46[_0xb4cc('0x83')],_0xfcad46['text'],_0xfcad46[_0xb4cc('0x84')]||'en')['then'](function(_0xc24ac0){_0x4c02ec(null,_0xc24ac0);})[_0xb4cc('0x17')](function(_0x328523){_0x4c02ec(_0x328523);});};AGIVertices[_0xb4cc('0x1a')]['sestekNDA']=function(_0x58cedb,_0x550ec7){scripts[_0xb4cc('0x85')](this[_0xb4cc('0x12')],_0x58cedb)[_0xb4cc('0x19')](function(_0x23bd43){_0x550ec7(null,_0x23bd43);})[_0xb4cc('0x17')](function(_0x56648a){_0x550ec7(_0x56648a);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x86')]=function(_0x3ef327,_0x29bb5f){scripts[_0xb4cc('0x86')](_0x3ef327['key'],_0x3ef327[_0xb4cc('0x62')],_0x3ef327[_0xb4cc('0x87')]||_0xb4cc('0x64'),_0x3ef327[_0xb4cc('0x88')])[_0xb4cc('0x19')](function(_0x52e932){_0x29bb5f(null,_0x52e932);})[_0xb4cc('0x17')](function(_0x277006){_0x29bb5f(_0x277006);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x89')]=function(_0xdd199e,_0x7aac74,_0x3d9efe){scripts[_0xb4cc('0x89')](_0x7aac74,_0xdd199e[_0xb4cc('0x7e')],_0xdd199e[_0xb4cc('0x8a')]||_0xb4cc('0x64'),this[_0xb4cc('0x8b')](_0xdd199e[_0xb4cc('0x8c')])?_0xdd199e[_0xb4cc('0x8c')]:undefined)[_0xb4cc('0x19')](function(_0x3c9264){_0x3d9efe(null,_0x3c9264);})[_0xb4cc('0x17')](function(_0x1a3ec4){_0x3d9efe(_0x1a3ec4);});};AGIVertices['prototype']['awsPolly']=function(_0x31fc3d,_0x4a730b){scripts[_0xb4cc('0x8d')](_0x31fc3d[_0xb4cc('0x8e')],_0x31fc3d[_0xb4cc('0x8f')],_0x31fc3d['aws_polly_region'],_0x31fc3d['aws_polly_voice']||'Amy',_0x31fc3d[_0xb4cc('0x62')],_0x31fc3d[_0xb4cc('0x90')]||_0xb4cc('0x62'))[_0xb4cc('0x19')](function(_0x413011){_0x4a730b(null,_0x413011);})[_0xb4cc('0x17')](function(_0x2cb400){_0x4a730b(_0x2cb400);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x91')]=function(_0xe38028,_0x59b207){scripts[_0xb4cc('0x91')](this[_0xb4cc('0x12')][_0xb4cc('0x3c')],_0xe38028['aws_access_key_id'],_0xe38028[_0xb4cc('0x8f')],_0xe38028[_0xb4cc('0x92')],_0xe38028[_0xb4cc('0x62')],_0xe38028[_0xb4cc('0x93')])[_0xb4cc('0x19')](function(_0x5a1eed){_0x59b207(null,_0x5a1eed);})[_0xb4cc('0x17')](function(_0x4a710e){_0x59b207(_0x4a710e);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x94')]=function(_0x1c6e25,_0x1749dc,_0x5d9095){scripts[_0xb4cc('0x94')](_0x1749dc,_0x1c6e25[_0xb4cc('0x7e')],_0x1c6e25[_0xb4cc('0x95')]||_0xb4cc('0x64'))[_0xb4cc('0x19')](function(_0xd631e){_0x5d9095(null,_0xd631e);})[_0xb4cc('0x17')](function(_0x471568){_0x5d9095(_0x471568);});};AGIVertices[_0xb4cc('0x1a')]['tildeASR']=function(_0x56a92c,_0x3c7d8b,_0x146d03){scripts[_0xb4cc('0x96')](_0x3c7d8b,_0x56a92c['appid'],_0x56a92c[_0xb4cc('0x97')],_0x56a92c['uri'])[_0xb4cc('0x19')](function(_0x2aa368){_0x146d03(null,_0x2aa368);})[_0xb4cc('0x17')](function(_0x4e663c){_0x146d03(_0x4e663c);});};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x98')]=function(_0x24fd8f){var _0x1707eb=_['includes'](verticesWithRetry,_0x24fd8f[_0xb4cc('0x99')])?_0x24fd8f:_[_0xb4cc('0x9a')](_0x24fd8f);for(var _0x3756bf in _0x1707eb){if(_0x1707eb[_0xb4cc('0x9b')](_0x3756bf)){if(_0x1707eb[_0x3756bf]&&_['isString'](_0x1707eb[_0x3756bf])){if(_[_0xb4cc('0x6f')](recursiveMapAttributes,_0x3756bf)){_0x1707eb[_0x3756bf]=this[_0xb4cc('0x9c')](_0x1707eb[_0x3756bf]);}else{_0x1707eb[_0x3756bf]=this[_0xb4cc('0x9d')](_0x1707eb[_0x3756bf]);}}}}return _0x1707eb;};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x9e')]=function(_0x28f685){for(var _0x2e3a43 in _0x28f685){if(_0x28f685[_0xb4cc('0x9b')](_0x2e3a43)){if(_[_0xb4cc('0x9f')](_0x28f685[_0x2e3a43])){this['recursiveNodeIndex'](_0x28f685[_0x2e3a43]);}else if(_[_0xb4cc('0xa0')](_0x28f685[_0x2e3a43])){for(var _0xcf4291=0x0;_0xcf4291<_0x28f685[_0x2e3a43][_0xb4cc('0xa1')];_0xcf4291++){this[_0xb4cc('0x9e')](_0x28f685[_0x2e3a43][_0xcf4291]);}}else if(_[_0xb4cc('0xa2')](_0x28f685[_0x2e3a43])){_0x28f685[_0x2e3a43]=this['replaceAllVariables'](_0x28f685[_0x2e3a43]);}}}};AGIVertices['prototype'][_0xb4cc('0xa3')]=function(_0x16842e,_0x4bfbb8){for(var _0x11ae75 in _0x16842e){if(_0x16842e[_0xb4cc('0x9b')](_0x11ae75)){if(_[_0xb4cc('0x9f')](_0x16842e[_0x11ae75])){if(!_[_0xb4cc('0x48')](_0x16842e[_0x11ae75])){this['saveRestApiResult'](_0x16842e[_0x11ae75],util[_0xb4cc('0x2d')](_0xb4cc('0xa4'),_0x4bfbb8,_0x11ae75));}}else if(_[_0xb4cc('0xa0')](_0x16842e[_0x11ae75])){for(var _0x44c223=0x0;_0x44c223<_0x16842e[_0x11ae75][_0xb4cc('0xa1')];_0x44c223++){this[_0xb4cc('0xa3')](_0x16842e[_0x11ae75][_0x44c223],util[_0xb4cc('0x2d')](_0xb4cc('0xa4'),_0x4bfbb8,_0x11ae75+'['+_0x44c223+']'));}}else{if(!_['isNil'](_0x16842e[_0x11ae75])){this[_0xb4cc('0x12')]['setVariable'](util[_0xb4cc('0x2d')]('%s.%s',_0x4bfbb8,_0x11ae75),_0x16842e[_0x11ae75]);}}}}};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x9c')]=function(_0x2ea107){try{var _0x25ad5e=JSON['parse'](_0x2ea107);this[_0xb4cc('0x9e')](_0x25ad5e);return JSON[_0xb4cc('0x79')](_0x25ad5e);}catch(_0x48c0e6){return this[_0xb4cc('0x9d')](_0x2ea107);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x1e25dc){var _0x1b031d=_0x1e25dc[_0xb4cc('0xa5')]('{');for(var _0x23b1fc=0x1;_0x23b1fc<_0x1b031d[_0xb4cc('0xa1')];_0x23b1fc+=0x1){var _0xefcc8d=_0x1b031d[_0x23b1fc][_0xb4cc('0xa5')]('}');if(_0xefcc8d[_0xb4cc('0xa1')]>0x1){_0x1e25dc=_0x1e25dc['replaceAll']('{'+_0xefcc8d[0x0]+'}',this[_0xb4cc('0x12')]['getVariable'](_0xefcc8d[0x0])['extra']||_0xefcc8d[0x0]);}}if(_0x1b031d[_0xb4cc('0xa1')]===0x1){return _0x1e25dc['toString']();}return this[_0xb4cc('0x9d')](_0x1e25dc);};AGIVertices[_0xb4cc('0x1a')]['getAndSetVariable']=function(_0x2814d2,_0x325703){var _0x402902=this[_0xb4cc('0x12')]['getVariable'](_0x2814d2);if(_0x402902['result']===-0x1){return _0x402902;}logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0xa6'),_0x325703,_0x402902['extra']));return this[_0xb4cc('0x12')]['setVariable'](_0x325703,_0x402902[_0xb4cc('0xa7')]);};AGIVertices[_0xb4cc('0x1a')]['isConfigured']=function(_0x204f30){return _0x204f30&&_0x204f30!=='0'&&_0x204f30!=='-1'&&_0x204f30!=='';};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xa8')]=function(_0x3486de){this['createSquareDetailsReport'][_0xb4cc('0x77')](this,_0x3486de,'-');_0x3486de['retry']=_0x3486de['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xa9')]=function(_0x396ebf){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0xaa'),_0x396ebf['label']));if(!this[_0xb4cc('0x8b')](_0x396ebf['text'])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xac'));}var _0x171fdb='\x22'+_0x396ebf[_0xb4cc('0x62')]+'\x22';if(this[_0xb4cc('0x8b')](_0x396ebf['options'])){_0x171fdb+=','+_0x396ebf['options'];}var _0x308ae6=this['channel'][_0xb4cc('0x5c')](_0xb4cc('0xad'),_0x171fdb);if(_0x308ae6[_0xb4cc('0xae')]===-0x1){return _0x308ae6;}return this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0xaf'),_0x171fdb));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xb0')]=function(_0x257ad4){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0xb1'),_0x257ad4[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x257ad4[_0xb4cc('0xb2')])){return this['channel'][_0xb4cc('0xab')](_0xb4cc('0xb3'));}var _0x25bbb7=_0x257ad4['grammar'];if(this['isConfigured'](_0x257ad4[_0xb4cc('0x7c')])){_0x25bbb7+=','+_0x257ad4['options'];}var _0x452771=this['channel'][_0xb4cc('0x5c')]('MRCPRecog',_0x25bbb7);if(_0x452771['result']===-0x1){return _0x452771;}var _0x326227=this[_0xb4cc('0xb4')](_0xb4cc('0xb5'),'MRCP_RECOG_CONFIDENCE');if(_0x326227[_0xb4cc('0xae')]===-0x1){return _0x326227;}var _0x5aece1=this[_0xb4cc('0xb4')]('RECOG_INPUT()',_0xb4cc('0xb6'));if(_0x5aece1[_0xb4cc('0xae')]===-0x1){return _0x5aece1;}var _0x26390c=this[_0xb4cc('0xb4')](_0xb4cc('0xb7'),_0xb4cc('0xb8'));if(_0x26390c[_0xb4cc('0xae')]===-0x1){return _0x26390c;}return this['channel']['noop'](util[_0xb4cc('0x2d')](_0xb4cc('0xb9'),_0x25bbb7));};AGIVertices[_0xb4cc('0x1a')]['agi']=function(_0xff4575){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xba'),_0xff4575['label']));return this[_0xb4cc('0x12')]['agi']([_0xff4575[_0xb4cc('0xbb')],_0xff4575[_0xb4cc('0xbc')]]);};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xbd')]=function(_0x41449b){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x41449b[_0xb4cc('0x3d')]));if(this[_0xb4cc('0x8b')](_0x41449b['timeout'])){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xbe'),_0x41449b[_0xb4cc('0x6d')]));var _0x1f4044=this['channel'][_0xb4cc('0xbf')](_0x41449b[_0xb4cc('0x6d')]);if(_0x1f4044[_0xb4cc('0xae')]===-0x1){return _0x1f4044;}}return this['channel'][_0xb4cc('0xbd')]();};AGIVertices[_0xb4cc('0x1a')]['callback']=function(_0x71b110){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xc0'),_0x71b110[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x71b110[_0xb4cc('0x4e')])){return this['channel'][_0xb4cc('0x30')](_0x71b110,_0xb4cc('0xc1'));}_0x71b110[_0xb4cc('0x4f')]=moment();if(this[_0xb4cc('0x8b')](_0x71b110[_0xb4cc('0xc2')])){_0x71b110['scheduledAt']=moment()[_0xb4cc('0xc3')](_0x71b110['delay'],_0xb4cc('0xc4'));}if(!this[_0xb4cc('0x8b')](_0x71b110['callback_priority'])){_0x71b110[_0xb4cc('0x52')]=0x2;}this[_0xb4cc('0x47')][_0xb4cc('0x77')](this,_0x71b110);return this[_0xb4cc('0x12')]['noop'](util[_0xb4cc('0x2d')](_0xb4cc('0xc5'),_0x71b110['phone'],_0x71b110['list_id'],_0x71b110[_0xb4cc('0x4f')]));};AGIVertices[_0xb4cc('0x1a')]['custom_app']=function(_0x1c80f8){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1c80f8[_0xb4cc('0x3d')]));var _0x2aff3a=this['channel'][_0xb4cc('0x5c')](_0x1c80f8['application'],_0x1c80f8[_0xb4cc('0x7c')]);if(_0x2aff3a[_0xb4cc('0xae')]===-0x1){return _0x2aff3a;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format']('Executed\x20command\x20%s\x20%s',_0x1c80f8['application'],_0x1c80f8[_0xb4cc('0x7c')]));};AGIVertices['prototype'][_0xb4cc('0xc6')]=function(_0x16a76b){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xc7'),_0x16a76b[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x16a76b['text'])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xac'));}var _0x2a593b='\x22'+_0x16a76b[_0xb4cc('0x62')]+'\x22';if(this[_0xb4cc('0x8b')](_0x16a76b[_0xb4cc('0x7c')])){_0x2a593b+=','+_0x16a76b['options'];}var _0x11f02d=this[_0xb4cc('0x12')]['exec']('MRCPSynth',_0x2a593b);if(_0x11f02d[_0xb4cc('0xae')]===-0x1){return _0x11f02d;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0xaf'),_0x2a593b));};AGIVertices['prototype'][_0xb4cc('0xc8')]=function(_0x459672){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xc9'),_0x459672[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x459672[_0xb4cc('0x62')])){return this['channel'][_0xb4cc('0xab')](_0xb4cc('0xac'));}var _0x502e3d='\x22'+_0x459672['text']+'\x22';if(this[_0xb4cc('0x8b')](_0x459672[_0xb4cc('0x7c')])){_0x502e3d+=','+_0x459672[_0xb4cc('0x7c')];}var _0x36345f=this[_0xb4cc('0x12')]['exec'](_0xb4cc('0xad'),_0x502e3d);if(_0x36345f[_0xb4cc('0xae')]===-0x1){return _0x36345f;}return this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0xaf'),_0x502e3d));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xca')]=function(_0x5edaab){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xcb'),_0x5edaab[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x5edaab[_0xb4cc('0xb2')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xb3'));}var _0x3040fc=_0x5edaab['grammar'];if(this[_0xb4cc('0x8b')](_0x5edaab[_0xb4cc('0x7c')])){_0x3040fc+=','+_0x5edaab[_0xb4cc('0x7c')];}var _0x5d5b9f=this[_0xb4cc('0x12')][_0xb4cc('0x5c')]('MRCPRecog',_0x3040fc);if(_0x5d5b9f['result']===-0x1){return _0x5d5b9f;}var _0xcd5d64=this[_0xb4cc('0xb4')](_0xb4cc('0xb5'),_0xb4cc('0xcc'));if(_0xcd5d64[_0xb4cc('0xae')]===-0x1){return _0xcd5d64;}var _0x27bfc8=this['getAndSetVariable'](_0xb4cc('0xcd'),_0xb4cc('0xce'));if(_0x27bfc8[_0xb4cc('0xae')]===-0x1){return _0x27bfc8;}var _0x315a71=this[_0xb4cc('0xb4')]('RECOG_INSTANCE()',_0xb4cc('0xcf'));if(_0x315a71[_0xb4cc('0xae')]===-0x1){return _0x315a71;}return this['channel']['noop'](util[_0xb4cc('0x2d')](_0xb4cc('0xb9'),_0x3040fc));};AGIVertices['prototype'][_0xb4cc('0xd0')]=function(_0x258e12){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xd1'),_0x258e12[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x258e12[_0xb4cc('0xb2')])){return this['channel'][_0xb4cc('0xab')]('no\x20grammar\x20configured');}var _0x3ba399=_0x258e12[_0xb4cc('0xb2')];if(this['isConfigured'](_0x258e12['options'])){_0x3ba399+=','+_0x258e12[_0xb4cc('0x7c')];}var _0x1337d1=this['channel'][_0xb4cc('0x5c')](_0xb4cc('0xd2'),_0x3ba399);if(_0x1337d1[_0xb4cc('0xae')]===-0x1){return _0x1337d1;}var _0x1b1234=this[_0xb4cc('0xb4')](_0xb4cc('0xb5'),'SESTEK_ASR_CONFIDENCE');if(_0x1b1234[_0xb4cc('0xae')]===-0x1){return _0x1b1234;}var _0x38281b=this['getAndSetVariable'](_0xb4cc('0xcd'),_0xb4cc('0xd3'));if(_0x38281b[_0xb4cc('0xae')]===-0x1){return _0x38281b;}var _0x137f4b=this[_0xb4cc('0xb4')](_0xb4cc('0xb7'),'SESTEK_ASR_INSTANCE');if(_0x137f4b[_0xb4cc('0xae')]===-0x1){return _0x137f4b;}return this[_0xb4cc('0x12')]['noop'](util[_0xb4cc('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3ba399));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xd4')]=function(_0x5340fd){logger['info'](util['format'](_0xb4cc('0xd5'),_0x5340fd[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x5340fd['odbc_id'])){return this[_0xb4cc('0x12')]['error'](_0x5340fd,_0xb4cc('0xd6'));}var _0x42826c=this[_0xb4cc('0x1d')][_0xb4cc('0x77')](this,_0x5340fd[_0xb4cc('0xd7')]);if(!_0x42826c){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x5340fd,'no\x20odbc\x20database\x20found');}if(!this[_0xb4cc('0x8b')](_0x5340fd[_0xb4cc('0x34')])){return this['channel'][_0xb4cc('0x30')](_0x5340fd,_0xb4cc('0xd8'));}var _0x10f751=_0x5340fd[_0xb4cc('0x34')][_0xb4cc('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0xd9'),_0x10f751));var _0x530a26=this['getQueryOdbc'][_0xb4cc('0x77')](this,_0x42826c,_0x10f751);this['createSquareDetailsReport'][_0xb4cc('0x77')](this,_0x5340fd,_0x10f751);if(!this[_0xb4cc('0x8b')](_0x5340fd['variable_id'])){return this['channel'][_0xb4cc('0xab')](_0xb4cc('0xda'));}var _0x222437=this[_0xb4cc('0x13')][_0xb4cc('0x77')](this,_0x5340fd[_0xb4cc('0xdb')]);if(!_0x222437){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x5340fd,'no\x20variable\x20found');}var _0x2611cb=this;_0x530a26['forEach'](function(_0x2b9e0a,_0x4ac391){Object[_0xb4cc('0xdc')](_0x2b9e0a)['forEach'](function(_0x13058c){_0x2611cb[_0xb4cc('0x12')][_0xb4cc('0xdd')](util[_0xb4cc('0x2d')]('%s[%s][%s]',_0x222437,_0x4ac391,_0x13058c),_0x2b9e0a[_0x13058c]);});});this[_0xb4cc('0x12')][_0xb4cc('0xdd')](util[_0xb4cc('0x2d')](_0xb4cc('0xde'),_0x222437),_0x530a26['length']);return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format'](_0xb4cc('0xdf'),_0x222437));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xe0')]=function(_0x149ce6){logger['debug'](util[_0xb4cc('0x2d')](_0xb4cc('0xe1'),_0x149ce6['label']));if(!this['isConfigured'](_0x149ce6[_0xb4cc('0xe2')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x149ce6,'no\x20user\x20selected');}var _0x85938=this['getUser'][_0xb4cc('0x77')](this,_0x149ce6['sip_id']);if(!_0x85938){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x149ce6,'no\x20user\x20found');}var _0x8ec29f=this[_0xb4cc('0x12')][_0xb4cc('0x5c')](_0xb4cc('0xe3'),[util[_0xb4cc('0x2d')]('SIP/%s',_0x85938),_0x149ce6[_0xb4cc('0x6d')],_0x149ce6[_0xb4cc('0xe4')],_0x149ce6[_0xb4cc('0x6b')]]);if(_0x8ec29f[_0xb4cc('0xae')]===-0x1){return _0x8ec29f;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('Executed\x20command\x20%s',_0xb4cc('0xe3')));};AGIVertices['prototype'][_0xb4cc('0xe5')]=function(_0x429d9c){logger[_0xb4cc('0x32')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x429d9c[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x429d9c[_0xb4cc('0x7e')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x429d9c[_0xb4cc('0x62')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xac'));}this['channel']['bot']=!![];this[_0xb4cc('0x3b')](_0x429d9c);this['createSquareMessage'](_0x429d9c['text'],'in','','');this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0xe6'),_0x429d9c['text']));var _0x5aa5dc=this[_0xb4cc('0x7d')][_0xb4cc('0x77')](this,_0x429d9c);if(_0x5aa5dc){for(var _0xeb19c5 in _0x5aa5dc){if(_0x5aa5dc[_0xb4cc('0x9b')](_0xeb19c5)){this[_0xb4cc('0x12')]['setVariable'](util[_0xb4cc('0x2d')](_0xb4cc('0xe7'),_0xeb19c5['toUpperCase']()),_0x5aa5dc[_0xeb19c5]);}}this['createSquareMessage'](_0x5aa5dc[_0xb4cc('0xe8')],_0xb4cc('0xe9'),'dialogflow','');return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format'](_0xb4cc('0xea'),_0x5aa5dc[_0xb4cc('0xe8')]));}return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x429d9c,_0xb4cc('0xeb'));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xec')]=function(_0x12d9c6){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xed'),_0x12d9c6[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x12d9c6['dialogflowV2_project_id'])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xee'));}if(!this[_0xb4cc('0x8b')](_0x12d9c6[_0xb4cc('0x82')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x12d9c6['private_key'])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')]('no\x20private_key\x20configured');}if(!this[_0xb4cc('0x8b')](_0x12d9c6['dialogflowV2_language'])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xef'));}if(!this[_0xb4cc('0x8b')](_0x12d9c6[_0xb4cc('0x62')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xac'));}this[_0xb4cc('0x12')][_0xb4cc('0xf0')]=!![];this[_0xb4cc('0x3b')](_0x12d9c6);this['createSquareMessage'](_0x12d9c6['text'],'in','','');this[_0xb4cc('0x12')]['noop'](util[_0xb4cc('0x2d')]('Trying\x20DialogflowV2:\x20%s',_0x12d9c6['text']));var _0x498330=this[_0xb4cc('0x80')][_0xb4cc('0x77')](this,_0x12d9c6);if(_0x498330){for(var _0xf45f85 in _0x498330){if(_0x498330[_0xb4cc('0x9b')](_0xf45f85)){if(_0xf45f85!==_0xb4cc('0xf1')){this[_0xb4cc('0x12')][_0xb4cc('0xdd')](util['format'](_0xb4cc('0xe7'),_0xf45f85[_0xb4cc('0xf2')]()),_0x498330[_0xf45f85]);}}}this['createSquareMessage'](_0x498330['speech'],_0xb4cc('0xe9'),'dialogflowV2',_0x498330[_0xb4cc('0xf1')]);return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0xf3'),_0x498330[_0xb4cc('0xe8')]));}return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x12d9c6,_0xb4cc('0xf4'));};AGIVertices['prototype'][_0xb4cc('0xf5')]=function(_0xaf5b8b){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0xf6'),_0xaf5b8b['label']));if(!this[_0xb4cc('0x8b')](_0xaf5b8b[_0xb4cc('0xf7')])){return this[_0xb4cc('0x12')]['noop'](_0xb4cc('0xf8'));}if(!this['isConfigured'](_0xaf5b8b[_0xb4cc('0xf9')])){return this['channel'][_0xb4cc('0xab')](_0xb4cc('0xfa'));}if(!this[_0xb4cc('0x8b')](_0xaf5b8b[_0xb4cc('0xfb')])){return this['channel']['noop'](_0xb4cc('0xfc'));}if(!this[_0xb4cc('0x8b')](_0xaf5b8b['ndassistant_url'])){return this['channel'][_0xb4cc('0xab')](_0xb4cc('0xac'));}this[_0xb4cc('0x12')][_0xb4cc('0xf0')]=!![];this[_0xb4cc('0x3b')](_0xaf5b8b);this[_0xb4cc('0x46')](_0xaf5b8b['text'],'in','','');this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0xfd'),_0xaf5b8b[_0xb4cc('0x62')]));var _0x36b8f3=this[_0xb4cc('0x85')][_0xb4cc('0x77')](this,_0xaf5b8b);if(_0x36b8f3){for(var _0x50ee94 in _0x36b8f3){if(_0x36b8f3['hasOwnProperty'](_0x50ee94)){this[_0xb4cc('0x12')]['setVariable'](util[_0xb4cc('0x2d')](_0xb4cc('0xfe'),_0x50ee94[_0xb4cc('0xf2')]()),_0x36b8f3[_0x50ee94]);}}this['createSquareMessage'](_0x36b8f3['speech'],'out',_0xb4cc('0xf5'),'');if(_0x36b8f3[_0xb4cc('0xff')]){this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x100'),_0x36b8f3[_0xb4cc('0xff')]));var _0x30be36=this[_0xb4cc('0x12')]['streamFile'](_0x36b8f3[_0xb4cc('0xff')]);try{fs[_0xb4cc('0x101')](_0x36b8f3['audiofile']+_0xb4cc('0x102'));}catch(_0x28e3e0){logger[_0xb4cc('0x30')](_0x28e3e0);}return _0x30be36;}else{return this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x103'),_0x36b8f3[_0xb4cc('0xe8')]));}}return this[_0xb4cc('0x12')]['error'](_0xaf5b8b,_0xb4cc('0x104'));};AGIVertices['prototype'][_0xb4cc('0x105')]=function(_0x4e7007){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')]('Enter\x20in\x20END\x20(%s)\x20block',_0x4e7007[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')]['noop'](_0xb4cc('0x105'));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x106')]=function(_0x2d8892){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x107'),_0x2d8892[_0xb4cc('0x3d')]));var _0x5a9ac='';if(_0x2d8892[_0xb4cc('0x108')]){if(!this['isConfigured'](_0x2d8892[_0xb4cc('0x108')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x2d8892,'no\x20trunk\x20selected');}else{var _0x9d8412=parseInt(_0x2d8892[_0xb4cc('0x108')],0xa);if(isNaN(_0x9d8412)){_0x5a9ac=_0x2d8892[_0xb4cc('0x108')];}else{_0x5a9ac=this[_0xb4cc('0x109')][_0xb4cc('0x77')](this,_0x2d8892[_0xb4cc('0x108')]);if(!_0x5a9ac){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x2d8892,_0xb4cc('0x10a'));}}}}else if(_0x2d8892[_0xb4cc('0x10b')]){_0x5a9ac=_0x2d8892['trunk_name'];}else{return this[_0xb4cc('0x12')]['error'](_0x2d8892,_0xb4cc('0x10c'));}var _0x33a54f=this[_0xb4cc('0x12')][_0xb4cc('0x5c')](_0xb4cc('0xe3'),[util[_0xb4cc('0x2d')]('SIP/%s/%s',_0x5a9ac,_0x2d8892[_0xb4cc('0x4d')]),_0x2d8892['timeout'],_0x2d8892[_0xb4cc('0xe4')],_0x2d8892[_0xb4cc('0x6b')]]);if(_0x33a54f[_0xb4cc('0xae')]===-0x1){return _0x33a54f;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x10d'),_0xb4cc('0xe3')));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x10e')]=function(_0x26548b){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x10f'),_0x26548b[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x10e'));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x10')]=function(_0x362bed){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x110'),_0x362bed[_0xb4cc('0x3d')]));if(_0x362bed[_0xb4cc('0x111')]===0x0){return this[_0xb4cc('0xa8')](_0x362bed);}_0x362bed[_0xb4cc('0x111')]-=0x1;if(!this[_0xb4cc('0x8b')](_0x362bed[_0xb4cc('0x112')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x362bed,_0xb4cc('0x113'));}var _0x2eb700=this[_0xb4cc('0x23')][_0xb4cc('0x77')](this,_0x362bed['file_id']);if(!_0x2eb700){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x362bed,_0xb4cc('0x114'));}if(!this[_0xb4cc('0x8b')](_0x362bed[_0xb4cc('0xdb')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0xb4cc('0xda'));}var _0x533e2b=this[_0xb4cc('0x12')][_0xb4cc('0x115')](_0x2eb700,_0x362bed[_0xb4cc('0x116')],_0x362bed[_0xb4cc('0x117')]);var _0x4b0af4=_0x533e2b[_0xb4cc('0xae')]?_0x533e2b[_0xb4cc('0xae')]['toString']():'';logger['info'](_0xb4cc('0x118'),JSON[_0xb4cc('0x79')](_0x533e2b));if(_0x533e2b[_0xb4cc('0xae')]===-0x1){this[_0xb4cc('0x3b')][_0xb4cc('0x77')](this,_0x362bed,_0x4b0af4);return _0x533e2b;}else if(_0x533e2b[_0xb4cc('0xa7')]===_0xb4cc('0x6d')){_0x533e2b[_0xb4cc('0xae')]=_0x4b0af4[_0xb4cc('0xa1')]>=parseInt(_0x362bed[_0xb4cc('0x119')])?'x':'i';}else{_0x533e2b[_0xb4cc('0xae')]=_0x4b0af4[_0xb4cc('0xa1')]>=parseInt(_0x362bed[_0xb4cc('0x119')])&&_0x4b0af4[_0xb4cc('0xa1')]<=parseInt(_0x362bed[_0xb4cc('0x117')])?'x':'i';}var _0x471680=this[_0xb4cc('0x13')][_0xb4cc('0x77')](this,_0x362bed['variable_id']);if(!_0x471680){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x362bed,_0xb4cc('0x11a'));}this['channel']['setVariable'](_0x471680,_0x4b0af4);if(this['isConfigured'](_0x362bed[_0xb4cc('0x11b')])){var _0x10c85f=parseInt(_0x362bed[_0xb4cc('0x11b')],0xa);var _0x92822a=rs[_0xb4cc('0x11c')]({'charset':'*','length':_0x10c85f});var _0x379ec9=_0x4b0af4[_0xb4cc('0xa1')];if(_0x379ec9>0x0){if(_0x379ec9>_0x10c85f){this[_0xb4cc('0x3b')]['sync'](this,_0x362bed,_0x362bed[_0xb4cc('0x11d')]===_0xb4cc('0x11e')?_0x92822a+_0x4b0af4[_0xb4cc('0x11f')](_0x10c85f):_0x4b0af4[_0xb4cc('0x11f')](0x0,_0x379ec9-_0x10c85f)+_0x92822a);}else{this[_0xb4cc('0x3b')][_0xb4cc('0x77')](this,_0x362bed,rs['generate']({'charset':'*','length':_0x379ec9}));}}else{this[_0xb4cc('0x3b')][_0xb4cc('0x77')](this,_0x362bed,'');}}else{this['createSquareDetailsReport'][_0xb4cc('0x77')](this,_0x362bed,_0x4b0af4);}return _0x533e2b;};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x11')]=function(_0x122105){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x120'),_0x122105[_0xb4cc('0x3d')]));return this[_0xb4cc('0x10')](_0x122105);};AGIVertices['prototype']['goal']=function(_0x3b8968){logger[_0xb4cc('0x32')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3b8968['label']));this[_0xb4cc('0x3b')][_0xb4cc('0x77')](this,_0x3b8968,_0x3b8968[_0xb4cc('0x121')]);return this['channel'][_0xb4cc('0xab')](util['format'](_0xb4cc('0x122'),_0x3b8968['goalname']));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x123')]=function(_0x2ac032){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x124'),_0x2ac032[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x2ac032[_0xb4cc('0x8e')])||!this[_0xb4cc('0x8b')](_0x2ac032[_0xb4cc('0x8f')])){return this[_0xb4cc('0x12')]['noop'](_0xb4cc('0x125'));}if(!this[_0xb4cc('0x8b')](_0x2ac032[_0xb4cc('0x62')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xac'));}this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('Trying\x20aws\x20Polly\x20%s',_0x2ac032[_0xb4cc('0x62')]));var _0xc83ffa=this[_0xb4cc('0x8d')][_0xb4cc('0x77')](this,_0x2ac032);if(_0xc83ffa){this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x126'),_0xc83ffa));var _0x484cab=this['channel'][_0xb4cc('0x127')](_0xc83ffa);try{fs[_0xb4cc('0x101')](_0xc83ffa+_0xb4cc('0x102'));}catch(_0x1a5768){logger[_0xb4cc('0x30')](_0x1a5768);}return _0x484cab;}return this['channel'][_0xb4cc('0x30')](_0x2ac032,_0xb4cc('0x128'));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x129')]=function(_0x37da96){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x12a'),_0x37da96[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x37da96[_0xb4cc('0x8e')])||!this['isConfigured'](_0x37da96[_0xb4cc('0x8f')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x125'));}if(!this[_0xb4cc('0x8b')](_0x37da96[_0xb4cc('0x93')])){return this['channel']['noop'](_0xb4cc('0x12b'));}if(!this['isConfigured'](_0x37da96[_0xb4cc('0x62')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xac'));}this['channel'][_0xb4cc('0xf0')]=!![];this[_0xb4cc('0x3b')](_0x37da96);this[_0xb4cc('0x46')](_0x37da96[_0xb4cc('0x62')],'in','','');this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x12c'),_0x37da96[_0xb4cc('0x62')]));var _0x4f85ba=this[_0xb4cc('0x91')][_0xb4cc('0x77')](this,_0x37da96);if(_0x4f85ba){for(var _0x9368d in _0x4f85ba){if(_0x4f85ba['hasOwnProperty'](_0x9368d)&&_['isString'](_0x4f85ba[_0x9368d])){this[_0xb4cc('0x12')][_0xb4cc('0xdd')](util[_0xb4cc('0x2d')](_0xb4cc('0x12d'),_0x9368d['toUpperCase']()),_0x4f85ba[_0x9368d]);}}if(_[_0xb4cc('0x49')](_0x4f85ba['message'])){return this['channel'][_0xb4cc('0xab')](_0xb4cc('0x12e'));}else{this[_0xb4cc('0x46')](_0x4f85ba[_0xb4cc('0x7a')],_0xb4cc('0xe9'),_0xb4cc('0x12f'),'');return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x4f85ba[_0xb4cc('0x7a')]));}}return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x37da96,_0xb4cc('0x130'));};AGIVertices['prototype']['googleasr']=function(_0x92ca52){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x131'),_0x92ca52['label'],_0x92ca52[_0xb4cc('0x6d')]));if(!this['isConfigured'](_0x92ca52[_0xb4cc('0x7e')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x132'));}var _0x143078=_0xb4cc('0x133');var _0x5f219f=util[_0xb4cc('0x2d')](_0xb4cc('0x134'),FILES_PATH,rs[_0xb4cc('0x11c')](0x4));var _0x21ad82=util[_0xb4cc('0x2d')](_0xb4cc('0xa4'),_0x5f219f,_0x143078);var _0x4f16e3=!![];if(_0x92ca52[_0xb4cc('0x135')]===_0xb4cc('0x136')){_0x4f16e3=![];}var _0x6b7409=this[_0xb4cc('0x12')][_0xb4cc('0x137')](_0x5f219f,_0x143078,_0x92ca52[_0xb4cc('0x138')],_0x92ca52[_0xb4cc('0x6d')],undefined,_0x4f16e3);if(_0x6b7409[_0xb4cc('0xae')]!==-0x1){this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format']('google\x20%s\x20file\x20created',_0x21ad82));var _0x1d2bfb=this[_0xb4cc('0x94')][_0xb4cc('0x77')](this,_0x92ca52,_0x21ad82);if(_0x1d2bfb){for(var _0x9641ee in _0x1d2bfb){if(_0x1d2bfb['hasOwnProperty'](_0x9641ee)){this['channel'][_0xb4cc('0xdd')](util[_0xb4cc('0x2d')](_0xb4cc('0x139'),_0x9641ee[_0xb4cc('0xf2')]()),_0x1d2bfb[_0x9641ee]);}}return this[_0xb4cc('0x12')]['noop'](util[_0xb4cc('0x2d')]('GoogleASR\x20Result\x20%s',JSON[_0xb4cc('0x79')](_0x1d2bfb)));}}return _0x6b7409;};AGIVertices[_0xb4cc('0x1a')]['tildeasr']=function(_0x5f08bd){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x13a'),_0x5f08bd[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x5f08bd['appid'])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')]('no\x20appid\x20configured');}if(!this[_0xb4cc('0x8b')](_0x5f08bd[_0xb4cc('0x97')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x13b'));}var _0x130412=_0xb4cc('0x133');var _0x31721f=util[_0xb4cc('0x2d')](_0xb4cc('0x134'),FILES_PATH,rs['generate'](0x4));var _0x2c63d3=util[_0xb4cc('0x2d')](_0xb4cc('0xa4'),_0x31721f,_0x130412);var _0x22991a=!![];if(_0x5f08bd[_0xb4cc('0x135')]===_0xb4cc('0x136')){_0x22991a=![];}var _0x12a036=this[_0xb4cc('0x12')][_0xb4cc('0x137')](_0x31721f,_0x130412,_0x5f08bd['intKey'],_0x5f08bd[_0xb4cc('0x6d')],undefined,_0x22991a);if(_0x12a036[_0xb4cc('0xae')]!==-0x1){this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x13c'),_0x2c63d3));var _0xe2d4e7=this[_0xb4cc('0x96')][_0xb4cc('0x77')](this,_0x5f08bd,_0x2c63d3);if(_0xe2d4e7){for(var _0x18586d in _0xe2d4e7){if(_0xe2d4e7['hasOwnProperty'](_0x18586d)){this[_0xb4cc('0x12')][_0xb4cc('0xdd')](util[_0xb4cc('0x2d')](_0xb4cc('0x13d'),_0x18586d['toUpperCase']()),_0xe2d4e7[_0x18586d]);}}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x13e'),JSON[_0xb4cc('0x79')](_0xe2d4e7)));}}return _0x12a036;};AGIVertices['prototype'][_0xb4cc('0x13f')]=function(_0x25dcd){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x140'),_0x25dcd['label']));return this[_0xb4cc('0x12')]['continueAt'](_0x25dcd[_0xb4cc('0x42')],_0x25dcd[_0xb4cc('0x141')],_0x25dcd[_0xb4cc('0x142')]);};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x143')]=function(_0x17667b){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x144'),_0x17667b[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x17667b[_0xb4cc('0x145')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x17667b,_0xb4cc('0x146'));}try{var _0x329316=eval(_0x17667b[_0xb4cc('0x145')])?'true':_0xb4cc('0x147');this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('EVAL\x20CONDITION\x20%s\x20%s',_0x17667b[_0xb4cc('0x145')],_0x329316));return{'code':0xc8,'result':_0x329316};}catch(_0x18a372){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x148')]=function(_0x5ded1e){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x149'),_0x5ded1e[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x5ded1e[_0xb4cc('0x14a')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x5ded1e,_0xb4cc('0x14b'));}var _0x4a2f3d=this['getIntervals'][_0xb4cc('0x77')](this,_0x5ded1e[_0xb4cc('0x14a')]);if(!_0x4a2f3d){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x5ded1e,'no\x20intervals\x20found');}for(var _0x26c532=0x0;_0x26c532<_0x4a2f3d[_0xb4cc('0xa1')];_0x26c532+=0x1){var _0x3fad8d=this[_0xb4cc('0x12')][_0xb4cc('0x13')](util['format'](_0xb4cc('0x14c'),_0x4a2f3d[_0x26c532]));if(_0x3fad8d[_0xb4cc('0xae')]===-0x1){return _0x3fad8d;}logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x14d'),_0x4a2f3d[_0x26c532],_0x3fad8d[_0xb4cc('0xa7')]));if(_0x3fad8d[_0xb4cc('0xa7')]===_0xb4cc('0x14e')){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x14d'),_0x4a2f3d[_0x26c532],_0xb4cc('0x14e')));this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x14d'),_0x4a2f3d[_0x26c532],'true'));return{'code':0xc8,'result':_0xb4cc('0x14e')};}else{logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x14d'),_0x4a2f3d[_0x26c532],_0xb4cc('0x147')));this[_0xb4cc('0x12')]['noop'](util['format'](_0xb4cc('0x14d'),_0x4a2f3d[_0x26c532],_0xb4cc('0x147')));}}return{'code':0xc8,'result':_0xb4cc('0x147')};};AGIVertices[_0xb4cc('0x1a')]['hangup']=function(_0x42d1e8){logger[_0xb4cc('0x32')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x42d1e8[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')]['hangup']();};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x14f')]=function(_0x29ebbc){logger['info'](util[_0xb4cc('0x2d')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x29ebbc[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x29ebbc[_0xb4cc('0x7e')])){return this[_0xb4cc('0x12')]['noop']('no\x20key\x20configured');}var _0x202318=_0xb4cc('0x133');var _0x216eec=util[_0xb4cc('0x2d')](_0xb4cc('0x134'),FILES_PATH,rs['generate'](0x4));var _0x56d1a1=util['format'](_0xb4cc('0xa4'),_0x216eec,_0x202318);var _0x4bb380=!![];if(_0x29ebbc[_0xb4cc('0x135')]===_0xb4cc('0x136')){_0x4bb380=![];}var _0x459cfa=this[_0xb4cc('0x12')]['recordFile'](_0x216eec,_0x202318,_0x29ebbc[_0xb4cc('0x138')],_0x29ebbc[_0xb4cc('0x6d')],undefined,_0x4bb380);if(_0x459cfa[_0xb4cc('0xae')]!==-0x1){this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('ispeech\x20%s\x20file\x20created',_0x56d1a1));var _0x3b4184=this[_0xb4cc('0x89')][_0xb4cc('0x77')](this,_0x29ebbc,_0x56d1a1);if(_0x3b4184){for(var _0x3dd894 in _0x3b4184){if(_0x3b4184[_0xb4cc('0x9b')](_0x3dd894)){this['channel']['setVariable'](util['format'](_0xb4cc('0x150'),_0x3dd894[_0xb4cc('0xf2')]()),_0x3b4184[_0x3dd894]);}}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format'](_0xb4cc('0x151'),JSON['stringify'](_0x3b4184)));}}return _0x459cfa;};AGIVertices[_0xb4cc('0x1a')]['ispeechtts']=function(_0x657971){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x152'),_0x657971[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x657971['key'])){return this['channel'][_0xb4cc('0xab')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x657971[_0xb4cc('0x62')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0xac'));}this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x153'),_0x657971['text']));var _0x35f5e6=this[_0xb4cc('0x86')]['sync'](this,_0x657971);if(_0x35f5e6){this[_0xb4cc('0x12')]['noop'](util[_0xb4cc('0x2d')](_0xb4cc('0x154'),_0x35f5e6));var _0xe2b09e=this[_0xb4cc('0x12')][_0xb4cc('0x127')](_0x35f5e6,_0x657971[_0xb4cc('0x138')]);try{fs[_0xb4cc('0x101')](_0x35f5e6+_0xb4cc('0x102'));}catch(_0x576d1d){logger[_0xb4cc('0x30')](_0x576d1d);}return _0xe2b09e;}return this['channel']['error'](_0x657971,_0xb4cc('0x155'));};AGIVertices[_0xb4cc('0x1a')]['login']=function(_0x457b8c){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x156'),_0x457b8c[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x457b8c[_0xb4cc('0x157')])){return this['channel'][_0xb4cc('0x30')](_0x457b8c,_0xb4cc('0x158'));}logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x159'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x457b8c[_0xb4cc('0x157')]));var _0x4514bb=this[_0xb4cc('0x5a')]['sync'](this,_0x457b8c[_0xb4cc('0x157')]);if(_0x4514bb){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x15a'),this[_0xb4cc('0x12')]['callerid'],_0x457b8c[_0xb4cc('0x157')]));this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x15a'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x457b8c[_0xb4cc('0x157')]));return{'code':0xc8,'result':_0xb4cc('0x15b')};}else{logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x15c'),this['channel']['callerid'],_0x457b8c[_0xb4cc('0x157')]));this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x15c'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x457b8c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x15d')]=function(_0x46e8b9){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x15e'),_0x46e8b9[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x46e8b9['findBy'])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x46e8b9,_0xb4cc('0x158'));}logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x46e8b9[_0xb4cc('0x157')]));var _0x2581fd=this['agentLogout'][_0xb4cc('0x77')](this,_0x46e8b9['findBy']);if(_0x2581fd){logger[_0xb4cc('0x32')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x46e8b9[_0xb4cc('0x157')]));this[_0xb4cc('0x12')]['noop'](util[_0xb4cc('0x2d')](_0xb4cc('0x15a'),this['channel'][_0xb4cc('0x40')],_0x46e8b9[_0xb4cc('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x15c'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x46e8b9[_0xb4cc('0x157')]));this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x46e8b9[_0xb4cc('0x157')]));return{'code':0xc8,'result':_0xb4cc('0x15f')};}};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x160')]=function(_0x2e5bff){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x161'),_0x2e5bff[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x2e5bff[_0xb4cc('0x162')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x2e5bff,_0xb4cc('0x163'));}this['channel']['noop'](util[_0xb4cc('0x2d')](_0xb4cc('0x164'),_0x2e5bff['operation']));var _0x511746=eval(_0x2e5bff[_0xb4cc('0x162')]);if(!this[_0xb4cc('0x8b')](_0x2e5bff[_0xb4cc('0xdb')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4b1912=this[_0xb4cc('0x13')]['sync'](this,_0x2e5bff[_0xb4cc('0xdb')]);if(!_0x4b1912){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x2e5bff,_0xb4cc('0x11a'));}if(_[_0xb4cc('0xa0')](_0x511746)){var _0x4afd41=this;_0x511746[_0xb4cc('0x165')](function(_0x2f1e47,_0x308ffa){_0x4afd41[_0xb4cc('0x12')][_0xb4cc('0xdd')](util['format'](_0xb4cc('0x166'),_0x4b1912,_0x308ffa),_0x2f1e47);});return this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x167'),_0x4b1912));}else{return this[_0xb4cc('0x12')][_0xb4cc('0xdd')](_0x4b1912,_0x511746);}};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0xf')]=function(_0x2d3fcb){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x168'),_0x2d3fcb[_0xb4cc('0x3d')]));if(_0x2d3fcb[_0xb4cc('0x111')]===0x0){return this[_0xb4cc('0xa8')](_0x2d3fcb);}_0x2d3fcb['retry']-=0x1;if(!this[_0xb4cc('0x8b')](_0x2d3fcb['file_id'])){return this['channel'][_0xb4cc('0x30')](_0x2d3fcb,_0xb4cc('0x113'));}var _0x169747=this[_0xb4cc('0x23')][_0xb4cc('0x77')](this,_0x2d3fcb[_0xb4cc('0x112')]);if(!_0x169747){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x2d3fcb,'no\x20file\x20audio\x20found');}var _0xc3b096=this[_0xb4cc('0x12')]['getData'](_0x169747,_0x2d3fcb[_0xb4cc('0x116')],_0x2d3fcb[_0xb4cc('0x169')]);var _0x59f5c2=_0xc3b096['result'];if(_0xc3b096['result']===-0x1){this[_0xb4cc('0x3b')]['sync'](this,_0x2d3fcb,'-1');return _0xc3b096;}else if(_0xc3b096[_0xb4cc('0xa7')]===_0xb4cc('0x6d')){_0xc3b096['result']=_0xc3b096[_0xb4cc('0xae')][_0xb4cc('0xa1')]>0x0?_0xc3b096[_0xb4cc('0xae')]:'t';}else if(_[_0xb4cc('0x48')](_0xc3b096[_0xb4cc('0xae')])){_0xc3b096['result']='#';_0x59f5c2='#';}if(!this[_0xb4cc('0x8b')](_0x2d3fcb[_0xb4cc('0xdb')])){this[_0xb4cc('0x12')]['noop'](_0xb4cc('0xda'));}else{var _0x2a342e=this[_0xb4cc('0x13')][_0xb4cc('0x77')](this,_0x2d3fcb[_0xb4cc('0xdb')]);if(!_0x2a342e){return this[_0xb4cc('0x12')]['error'](_0x2d3fcb,_0xb4cc('0x11a'));}this[_0xb4cc('0x12')][_0xb4cc('0xdd')](_0x2a342e,_0x59f5c2);}this['createSquareDetailsReport'][_0xb4cc('0x77')](this,_0x2d3fcb,_0x59f5c2);return _0xc3b096;};AGIVertices[_0xb4cc('0x1a')]['noop']=function(_0xaa08e8){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x16a'),_0xaa08e8[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')]['noop'](_0xaa08e8[_0xb4cc('0x16b')]||_0xaa08e8['label']);};AGIVertices[_0xb4cc('0x1a')]['pause']=function(_0x1719ba){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x16c'),_0x1719ba[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x1719ba[_0xb4cc('0x157')])){return this['channel'][_0xb4cc('0x30')](_0x1719ba,'no\x20find\x20by\x20configured');}logger[_0xb4cc('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x1719ba[_0xb4cc('0x157')]));var _0x835739=this['getPause'][_0xb4cc('0x77')](this,_0x1719ba['pause_id']);var _0x5ba82f=this[_0xb4cc('0x54')][_0xb4cc('0x77')](this,_0x1719ba[_0xb4cc('0x157')],_0x835739);if(_0x5ba82f){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x15a'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x1719ba[_0xb4cc('0x157')]));this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x15a'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x1719ba[_0xb4cc('0x157')]));return{'code':0xc8,'result':_0xb4cc('0x15b')};}else{logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x15c'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x1719ba[_0xb4cc('0x157')]));this[_0xb4cc('0x12')]['noop'](util[_0xb4cc('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x1719ba[_0xb4cc('0x157')]));return{'code':0xc8,'result':_0xb4cc('0x15f')};}};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x16d')]=function(_0x1af111){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x16e'),_0x1af111[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x1af111['file_id'])){return this['channel'][_0xb4cc('0x30')](_0x1af111,_0xb4cc('0x113'));}var _0x1e3211=this[_0xb4cc('0x23')][_0xb4cc('0x77')](this,_0x1af111['file_id']);if(!_0x1e3211){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x1af111,_0xb4cc('0x114'));}var _0x16004b=this[_0xb4cc('0x12')][_0xb4cc('0x5c')](_0xb4cc('0x16f'),[_0x1e3211,_0x1af111[_0xb4cc('0xe4')]]);if(_0x16004b[_0xb4cc('0xae')]===-0x1){return _0x16004b;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format'](_0xb4cc('0x170'),_0xb4cc('0x16f'),_0x1e3211));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x171')]=function(_0x3dc76d){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x172'),_0x3dc76d['label']));if(!this[_0xb4cc('0x8b')](_0x3dc76d[_0xb4cc('0x173')])){return this[_0xb4cc('0x12')]['error'](_0x3dc76d,_0xb4cc('0x174'));}var _0x2a6d17='';var _0x4cab05=parseInt(_0x3dc76d['queue_id'],0xa);if(isNaN(_0x4cab05)){_0x2a6d17=_0x3dc76d[_0xb4cc('0x173')];}else{_0x2a6d17=this[_0xb4cc('0x175')][_0xb4cc('0x77')](this,_0x3dc76d[_0xb4cc('0x173')]);if(!_0x2a6d17){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x3dc76d,'no\x20queue\x20found');}}var _0x3134e7='';if(this[_0xb4cc('0x8b')](_0x3dc76d[_0xb4cc('0x112')])){var _0x2dcd82=this[_0xb4cc('0x23')][_0xb4cc('0x77')](this,_0x3dc76d[_0xb4cc('0x112')]);if(_0x2dcd82){_0x3134e7=_0x2dcd82;}}this[_0xb4cc('0x3b')]['sync'](this,_0x3dc76d,_0x2a6d17);if(_0x3dc76d[_0xb4cc('0xe4')][_0xb4cc('0x176')]('x')<0x0){_0x3dc76d['opts']+='x';}if(_0x3dc76d['opts'][_0xb4cc('0x176')]('X')<0x0){_0x3dc76d[_0xb4cc('0xe4')]+='X';}this[_0xb4cc('0x12')]['setVariable'](_0xb4cc('0x177'),_0x2a6d17?_0x2a6d17['toLowerCase']():'');var _0x53f83f=this[_0xb4cc('0x12')][_0xb4cc('0x5c')]('QUEUE',[_0x2a6d17,_0x3dc76d[_0xb4cc('0xe4')],_0x3dc76d[_0xb4cc('0x6b')],_0x3134e7,_0x3dc76d[_0xb4cc('0x6d')],_0x3dc76d[_0xb4cc('0xa')],_0x3dc76d[_0xb4cc('0x178')],_0x3dc76d[_0xb4cc('0x179')],'',_0x3dc76d[_0xb4cc('0x17a')]]);if(_0x53f83f['result']===-0x1){return _0x53f83f;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x170'),'QUEUE',_0x2a6d17));};AGIVertices['prototype'][_0xb4cc('0x17b')]=function(_0x176940){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x17c'),_0x176940[_0xb4cc('0x3d')]));var _0x14ae19=_0x176940['recordingFormat']||'wav';var _0x4d1452=util[_0xb4cc('0x2d')](_0xb4cc('0x17d'),this[_0xb4cc('0x12')]['uniqueid'],rs['generate'](0x5));var _0x1051dd=util[_0xb4cc('0x2d')](_0xb4cc('0x17e'),FILES_PATH,_0x4d1452,_0x14ae19);var _0x2d4912=util[_0xb4cc('0x2d')](_0xb4cc('0x134'),FILES_PATH,_0x4d1452);this[_0xb4cc('0x3f')][_0xb4cc('0x77')](this,_0x176940,_0x4d1452,_0x1051dd);this['channel'][_0xb4cc('0xdd')]('RECORDING_SAVENAME',_0x4d1452);logger['info'](_0xb4cc('0x17f'),_0x2d4912,_0x14ae19,_0x176940[_0xb4cc('0x180')],_0x176940[_0xb4cc('0x6d')]);return this[_0xb4cc('0x12')]['recordFile'](_0x2d4912,_0x14ae19,_0x176940[_0xb4cc('0x180')],_0x176940[_0xb4cc('0x6d')],undefined,!![]);};AGIVertices[_0xb4cc('0x1a')]['restapi']=function(_0x74a90e){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x181'),_0x74a90e[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x74a90e[_0xb4cc('0x6b')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x182'));}var _0x514c55=this[_0xb4cc('0x6a')]['sync'](this,_0x74a90e);logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x183'),util[_0xb4cc('0x184')](_0x514c55,{'showHidden':![],'depth':null})));if(!this[_0xb4cc('0x8b')](_0x74a90e[_0xb4cc('0xdb')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x185'));}var _0x44280a=this['getVariable']['sync'](this,_0x74a90e[_0xb4cc('0xdb')]);if(!_0x44280a){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x74a90e,_0xb4cc('0x11a'));}this['channel']['setVariable'](util[_0xb4cc('0x2d')](_0xb4cc('0x186'),_0x44280a),_0x514c55[_0xb4cc('0x187')]?_0x514c55['statusCode']:'200');this[_0xb4cc('0x12')][_0xb4cc('0xdd')](util[_0xb4cc('0x2d')]('%s_STATUS_MESSAGE',_0x44280a),_0x514c55[_0xb4cc('0x188')]?_0x514c55[_0xb4cc('0x188')]:'OK');if(_0x514c55[_0xb4cc('0x72')]){try{this[_0xb4cc('0xa3')](_0x514c55[_0xb4cc('0x72')],_0x44280a);}catch(_0x4fd355){logger[_0xb4cc('0x30')](util[_0xb4cc('0x2d')](_0xb4cc('0x189'),_0x44280a));}}return this['channel'][_0xb4cc('0xab')](util['format'](_0xb4cc('0xdf'),_0x44280a));};AGIVertices[_0xb4cc('0x1a')]['saydigits']=function(_0x912058){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x912058[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')]['sayDigits'](_0x912058[_0xb4cc('0x18a')][_0xb4cc('0x5e')](/\s+/g,''),_0x912058[_0xb4cc('0x180')]);};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x18b')]=function(_0x1cbdd1){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x18c'),_0x1cbdd1[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')]['sayNumber'](_0x1cbdd1['number'][_0xb4cc('0x5e')](/\s+/g,''),_0x1cbdd1['escape_digits']);};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x18d')]=function(_0x448e27){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x18e'),_0x448e27[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')][_0xb4cc('0x18f')](_0x448e27[_0xb4cc('0x62')],_0x448e27['escape_digits']);};AGIVertices[_0xb4cc('0x1a')]['sendMail']=function(_0x213a33){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x190'),_0x213a33[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x213a33[_0xb4cc('0x191')])){return this[_0xb4cc('0x12')]['noop'](_0xb4cc('0x192'));}var _0x1f5dd2=this[_0xb4cc('0x193')]['sync'](this,_0x213a33[_0xb4cc('0x191')]);if(!_0x1f5dd2||!_0x1f5dd2[_0xb4cc('0x194')]){return this[_0xb4cc('0x12')]['error'](_0x213a33,_0xb4cc('0x195'));}var _0xa29e43={'from':util[_0xb4cc('0x2d')](_0xb4cc('0x196'),_0x1f5dd2[_0xb4cc('0x16')],_0x1f5dd2[_0xb4cc('0x197')]||_0x1f5dd2['Smtp'][_0xb4cc('0x198')]),'to':_0x213a33['to']||'','cc':_0x213a33['cc']||'','bcc':_0x213a33[_0xb4cc('0x199')]||'','subject':_0x213a33['subject'],'html':_0x213a33[_0xb4cc('0x62')],'text':_0x213a33[_0xb4cc('0x62')]};var _0x3ef167={'tls':{'rejectUnauthorized':![]}};if(_0x1f5dd2['Smtp']['service']){_0x3ef167[_0xb4cc('0x19a')]=_0x1f5dd2['Smtp'][_0xb4cc('0x19a')];}else{_0x3ef167[_0xb4cc('0x19b')]=_0x1f5dd2[_0xb4cc('0x194')][_0xb4cc('0x19b')];_0x3ef167[_0xb4cc('0x19c')]=_0x1f5dd2[_0xb4cc('0x194')][_0xb4cc('0x19c')];_0x3ef167[_0xb4cc('0x19d')]=_0x1f5dd2['Smtp'][_0xb4cc('0x19d')];}if(_0x1f5dd2[_0xb4cc('0x194')][_0xb4cc('0x19e')]){_0x3ef167['auth']={'user':_0x1f5dd2[_0xb4cc('0x194')]['user'],'pass':_0x1f5dd2[_0xb4cc('0x194')][_0xb4cc('0x19f')]};}if(this[_0xb4cc('0x8b')](_0x213a33[_0xb4cc('0x1a0')])){}logger['debug'](_0xb4cc('0x1a1'),JSON[_0xb4cc('0x79')](_0xa29e43));this[_0xb4cc('0x3b')][_0xb4cc('0x77')](this,_0x213a33,_0x213a33[_0xb4cc('0x191')]);this['channel'][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x1a2'),_0x1f5dd2[_0xb4cc('0x16')]));this[_0xb4cc('0x1a3')]['sync'](this,_0x3ef167,_0xa29e43);return this[_0xb4cc('0x12')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1a4')]=function(_0x4b72e8){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4b72e8[_0xb4cc('0x3d')]));return this[_0xb4cc('0x12')][_0xb4cc('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1a5')]=function(_0x3d8f73){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x1a6'),_0x3d8f73[_0xb4cc('0x3d')]));if(!this['isConfigured'](_0x3d8f73[_0xb4cc('0x1a7')])){return this[_0xb4cc('0x12')]['noop'](_0xb4cc('0x1a8'));}var _0x424bab=this[_0xb4cc('0x39')][_0xb4cc('0x77')](this,_0x3d8f73[_0xb4cc('0x1a7')]);if(!_0x424bab){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x3d8f73,_0xb4cc('0x1a9'));}var _0x337fa7={'body':_0x3d8f73[_0xb4cc('0x1aa')],'phone':_0x3d8f73['to']||'','SmsAccountId':_0x424bab['id']};logger[_0xb4cc('0x1ab')](_0xb4cc('0x1ac'),JSON[_0xb4cc('0x79')](_0x337fa7));this[_0xb4cc('0x3b')][_0xb4cc('0x77')](this,_0x3d8f73,_0x3d8f73[_0xb4cc('0x1a7')]);this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format'](_0xb4cc('0x1ad'),_0x424bab[_0xb4cc('0x16')]));this[_0xb4cc('0x3a')][_0xb4cc('0x77')](this,_0x337fa7);return this['channel']['noop'](_0xb4cc('0x1ae'));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1af')]=function(_0x3a331f){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x1b0'),_0x3a331f[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x3a331f['variable_id'])){return this[_0xb4cc('0x12')]['error'](_0x3a331f,_0xb4cc('0x1b1'));}var _0x552d14=this[_0xb4cc('0x13')]['sync'](this,_0x3a331f['variable_id']);if(!_0x552d14){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x3a331f,_0xb4cc('0x11a'));}return this[_0xb4cc('0x12')][_0xb4cc('0xdd')](_0x552d14,_0x3a331f[_0xb4cc('0x1b2')]);};AGIVertices[_0xb4cc('0x1a')]['start']=function(_0x4afc00){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x1b3'),_0x4afc00[_0xb4cc('0x3d')]));this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x1b4'));if(_0x4afc00[_0xb4cc('0xbd')]===_0xb4cc('0x1b5')){this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x1b6'));return this[_0xb4cc('0x12')][_0xb4cc('0xbd')]();}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x1b7'));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1b8')]=function(_0x2475da){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x1b9'),_0x2475da['label']));if(!this[_0xb4cc('0x8b')](_0x2475da['project_id'])){return this['channel'][_0xb4cc('0x30')](_0x2475da,_0xb4cc('0x1ba'));}var _0x4068ea=this[_0xb4cc('0x1b')][_0xb4cc('0x77')](this,_0x2475da[_0xb4cc('0x1bb')]);if(!this[_0xb4cc('0x8b')](_0x4068ea)){return this[_0xb4cc('0x12')]['error'](_0x2475da,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2475da[_0xb4cc('0x1bb')]));}if(_0x4068ea===this[_0xb4cc('0x12')][_0xb4cc('0x3e')]){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x2475da,_0xb4cc('0x1bc'));}this[_0xb4cc('0x3b')]['sync'](this,_0x2475da,_0x4068ea);var _0x331eb5=this[_0xb4cc('0x12')]['exec'](_0xb4cc('0x1bd'),util[_0xb4cc('0x2d')](_0xb4cc('0x1be'),config[_0xb4cc('0xa')][_0xb4cc('0x19b')]||_0xb4cc('0x1bf'),_0x4068ea,this[_0xb4cc('0x12')]['arg_1']));if(_0x331eb5[_0xb4cc('0xae')]===-0x1){return _0x331eb5;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('Executed\x20command\x20%s\x20%s',_0xb4cc('0x1bd'),_0x4068ea));};AGIVertices[_0xb4cc('0x1a')]['system']=function(_0xa527d1){logger['info'](util[_0xb4cc('0x2d')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xa527d1[_0xb4cc('0x3d')]));var _0x35ef7e=this[_0xb4cc('0x5b')][_0xb4cc('0x77')](this,_0xa527d1[_0xb4cc('0xbb')]);this[_0xb4cc('0x3b')][_0xb4cc('0x77')](this,_0xa527d1,_0xa527d1['command']);if(this[_0xb4cc('0x8b')](_0xa527d1['variable_id'])){var _0x31b449=this[_0xb4cc('0x13')][_0xb4cc('0x77')](this,_0xa527d1['variable_id']);if(_0x31b449){this[_0xb4cc('0x12')][_0xb4cc('0xdd')](_0x31b449,_0x35ef7e);return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format'](_0xb4cc('0x1c0'),_0xa527d1[_0xb4cc('0xbb')],_0x31b449));}}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xa527d1['command']));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1c1')]=function(_0x254594){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x1c2'),_0x254594[_0xb4cc('0x3d')]));_0x254594['text']=_0x254594[_0xb4cc('0x62')][_0xb4cc('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x254594[_0xb4cc('0x60')])){return this[_0xb4cc('0x12')][_0xb4cc('0xab')](_0xb4cc('0x1c3'));}if(!this[_0xb4cc('0x8b')](_0x254594[_0xb4cc('0x62')])){return this[_0xb4cc('0x12')]['noop'](_0xb4cc('0xac'));}this['channel'][_0xb4cc('0xab')](util['format'](_0xb4cc('0x1c4'),_0x254594[_0xb4cc('0x62')]));var _0x1d2e1b=this[_0xb4cc('0x5f')][_0xb4cc('0x77')](this,_0x254594);if(_0x1d2e1b){this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1d2e1b));var _0x347559=this['channel'][_0xb4cc('0x127')](_0x1d2e1b);try{fs[_0xb4cc('0x101')](_0x1d2e1b+_0xb4cc('0x102'));}catch(_0x45c614){logger[_0xb4cc('0x30')](_0x45c614);}return _0x347559;}return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x254594,_0xb4cc('0x1c5'));};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1c6')]=function(_0x84c575){logger['info'](util['format'](_0xb4cc('0x1c7'),_0x84c575[_0xb4cc('0x3d')]));_0x84c575[_0xb4cc('0x62')]=_0x84c575[_0xb4cc('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb4cc('0x8b')](_0x84c575[_0xb4cc('0x62')])){return this['channel'][_0xb4cc('0xab')]('no\x20text\x20configured');}this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x1c8'),_0x84c575['text']));var _0x578b02=this['googleTTS'][_0xb4cc('0x77')](this,_0x84c575);if(_0x578b02){this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')]('Google\x20TTS\x20%s\x20file\x20created',_0x578b02));var _0x3c2ee5=this['channel'][_0xb4cc('0x127')](_0x578b02);try{}catch(_0x524076){logger[_0xb4cc('0x30')](_0x524076);}return _0x3c2ee5;}return this[_0xb4cc('0x12')]['error'](_0x84c575,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1c9')]=function(_0x23b2ed){logger[_0xb4cc('0x32')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x23b2ed['label']));if(!this[_0xb4cc('0x8b')](_0x23b2ed[_0xb4cc('0x157')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x23b2ed,'no\x20find\x20by\x20configured');}logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x159'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x23b2ed[_0xb4cc('0x157')]));var _0x401fea=this[_0xb4cc('0x55')]['sync'](this,_0x23b2ed[_0xb4cc('0x157')]);if(_0x401fea){logger[_0xb4cc('0x32')](util['format'](_0xb4cc('0x15a'),this['channel'][_0xb4cc('0x40')],_0x23b2ed[_0xb4cc('0x157')]));this['channel']['noop'](util[_0xb4cc('0x2d')](_0xb4cc('0x15a'),this[_0xb4cc('0x12')]['callerid'],_0x23b2ed[_0xb4cc('0x157')]));return{'code':0xc8,'result':_0xb4cc('0x15b')};}else{logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x15c'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x23b2ed[_0xb4cc('0x157')]));this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x15c'),this[_0xb4cc('0x12')][_0xb4cc('0x40')],_0x23b2ed['findBy']));return{'code':0xc8,'result':_0xb4cc('0x15f')};}};AGIVertices[_0xb4cc('0x1a')][_0xb4cc('0x1ca')]=function(_0xfea7af){logger[_0xb4cc('0x32')](util[_0xb4cc('0x2d')](_0xb4cc('0x1cb'),_0xfea7af[_0xb4cc('0x3d')]));var _0x2f778f=this[_0xb4cc('0x12')][_0xb4cc('0x5c')](_0xb4cc('0x1cc'),[_0xfea7af[_0xb4cc('0x1cd')],_0xfea7af[_0xb4cc('0x7c')]]);if(_0x2f778f[_0xb4cc('0xae')]===-0x1){return _0x2f778f;}return this[_0xb4cc('0x12')][_0xb4cc('0xab')](util[_0xb4cc('0x2d')](_0xb4cc('0x170'),_0xb4cc('0x1cc'),_0xfea7af['mailbox']));};AGIVertices[_0xb4cc('0x1a')]['vswitch']=function(_0x3a64a3){logger['info'](util[_0xb4cc('0x2d')](_0xb4cc('0x1ce'),_0x3a64a3[_0xb4cc('0x3d')]));if(!this[_0xb4cc('0x8b')](_0x3a64a3[_0xb4cc('0xdb')])){return this[_0xb4cc('0x12')][_0xb4cc('0x30')](_0x3a64a3,_0xb4cc('0x1b1'));}var _0xde1d41=this[_0xb4cc('0x13')][_0xb4cc('0x77')](this,_0x3a64a3['variable_id']);if(!_0xde1d41){return this[_0xb4cc('0x12')]['error'](_0x3a64a3,_0xb4cc('0x11a'));}var _0x289d37=this[_0xb4cc('0x12')][_0xb4cc('0x13')](_0xde1d41);return{'code':0xc8,'result':_0x289d37[_0xb4cc('0xa7')]?_0x289d37[_0xb4cc('0xa7')]:'-'};};String[_0xb4cc('0x1a')]['replaceAll']=function(_0x192c82,_0x65721d){return this['split'](_0x192c82)[_0xb4cc('0x1cf')](_0x65721d);};module[_0xb4cc('0x1d0')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 17f0fbb..275ccae 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 _0xda55=['[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xda55,0x6d));var _0x5da5=function(_0xa62a6b,_0x50f390){_0xa62a6b=_0xa62a6b-0x0;var _0x57380b=_0xda55[_0xa62a6b];return _0x57380b;};'use strict';var util=require(_0x5da5('0x0'));var _=require(_0x5da5('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x5da5('0x2'))(_0x5da5('0x3'));var RpcUser=require(_0x5da5('0x4'));var RpcVoiceAgentReport=require(_0x5da5('0x5'));function Acw(_0x1c3afd){this['voiceQueues']=_0x1c3afd[_0x5da5('0x6')];this['agents']=_0x1c3afd[_0x5da5('0x7')];this['timers']=_0x1c3afd[_0x5da5('0x8')];this[_0x5da5('0x9')]={};ami['on'](_0x5da5('0xa'),this[_0x5da5('0xb')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0xd'),this[_0x5da5('0xe')][_0x5da5('0xc')](this));ami['on']('hangup',this[_0x5da5('0xf')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0x10'),this[_0x5da5('0x11')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0x12'),this[_0x5da5('0x13')]['bind'](this));ami['on'](_0x5da5('0x14'),this[_0x5da5('0x15')]['bind'](this));ami['on'](_0x5da5('0x16'),this[_0x5da5('0x17')][_0x5da5('0xc')](this));}function getDiff(_0x43d526){var _0x1877d4=moment()[_0x5da5('0x18')](0x0);var _0x481562=moment(_0x43d526)['milliseconds'](0x0);return _0x1877d4['diff'](_0x481562,_0x5da5('0x19'));}Acw[_0x5da5('0x1a')][_0x5da5('0x1b')]=function(_0x665ce8){try{var _0x11bd3=this;var _0x134afa=this[_0x5da5('0x9')][_0x665ce8]['interface'];var _0x124dc5=this[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x1c')];var _0x16b11f=this[_0x5da5('0x6')][_0x124dc5];var _0x428b07=![];var _0x547c58=_0x5da5('0x1d');if(_0x16b11f[_0x5da5('0x1e')]){if(_0x16b11f[_0x5da5('0x1f')][_0x5da5('0x20')]){_0x428b07=!![];_0x547c58=_0x16b11f[_0x5da5('0x1f')]['name'];}}ami[_0x5da5('0x21')]({'action':_0x5da5('0x22'),'interface':_0x134afa,'paused':!![],'reason':_0x547c58})[_0x5da5('0x23')](function(_0x560ea7){if(_0x11bd3[_0x5da5('0x7')][_0x134afa]){return RpcUser[_0x5da5('0x24')](_0x11bd3[_0x5da5('0x7')][_0x134afa]['id'])[_0x5da5('0x23')](function(_0xec69f2){if(_0xec69f2&&!_0xec69f2[_0x5da5('0x25')]){logger['info'](_0x5da5('0x26'),_0x665ce8,_0x134afa,_0x124dc5);var _0x568ddf=_0x11bd3[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x27')]&&_0x11bd3[_0x5da5('0x9')][_0x665ce8]['destlinkedid']?_0x11bd3[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x28')]:_0x665ce8;return RpcUser[_0x5da5('0x29')](_0x11bd3[_0x5da5('0x7')][_0x134afa],_0x547c58,_0x568ddf)['then'](function(_0x5b0b43){if(!_0x428b07){_0x11bd3['timers'][_0x134afa]={};logger[_0x5da5('0x2a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x665ce8,_0x11bd3['voiceQueues'][_0x124dc5][_0x5da5('0x2b')],_0x134afa,_0x124dc5);_0x11bd3[_0x5da5('0x8')][_0x134afa]['timer']=setTimeout(_0x11bd3[_0x5da5('0x2c')][_0x5da5('0xc')](_0x11bd3,_0x134afa),_0x11bd3['voiceQueues'][_0x124dc5][_0x5da5('0x2b')]*0x3e8);_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x2d')]=moment()[_0x5da5('0x2e')](_0x5da5('0x2f'));_0x11bd3['timers'][_0x134afa][_0x5da5('0x30')]=_0x665ce8;_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x1c')]=_0x124dc5;_0x11bd3[_0x5da5('0x8')][_0x134afa]['updateAcw']=function(){var _0x5ee7f2=getDiff(_0x11bd3['timers'][_0x134afa][_0x5da5('0x2d')]);clearTimeout(_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x31')]);_0x11bd3[_0x5da5('0x8')][_0x134afa]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x5ee7f2},_0x11bd3[_0x5da5('0x8')][_0x134afa]['uniqueid'],_0x134afa)['then'](function(_0x2dd4b6){logger['info'](_0x5da5('0x32'),_0x665ce8,_0x5ee7f2,_0x2dd4b6);})[_0x5da5('0x33')](function(_0x33f138){logger[_0x5da5('0x34')](_0x5da5('0x35'),_0x665ce8,_0x33f138);});delete _0x11bd3[_0x5da5('0x8')][_0x134afa];};}});}else{logger[_0x5da5('0x2a')](_0x5da5('0x36'),_0x665ce8,_0x134afa,_0x124dc5);}});}})['catch'](function(_0x231e8c){logger['error'](_0x5da5('0x37'),_0x665ce8,_0x11bd3[_0x5da5('0x6')][_0x124dc5][_0x5da5('0x2b')],_0x134afa,_0x124dc5);})[_0x5da5('0x38')](function(){delete _0x11bd3[_0x5da5('0x9')][_0x665ce8];});}catch(_0x9aba42){logger[_0x5da5('0x34')](_0x5da5('0x39'),_0x9aba42[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x2c')]=function(_0x33429f){try{var _0x3ba804=this;if(_0x3ba804['timers'][_0x33429f]){_0x3ba804[_0x5da5('0x8')][_0x33429f]['timer']=![];var _0x2d6280=_0x3ba804[_0x5da5('0x8')][_0x33429f][_0x5da5('0x30')];var _0x24842c=_0x3ba804['timers'][_0x33429f][_0x5da5('0x1c')];var _0x2f2596=_0x3ba804[_0x5da5('0x6')][_0x24842c]['acwTimeout'];logger[_0x5da5('0x2a')](_0x5da5('0x3b'),_0x33429f);RpcUser['saveUnpause'](this[_0x5da5('0x7')][_0x33429f]);RpcVoiceAgentReport[_0x5da5('0x3c')]({'acwtime':_0x2f2596,'agentacw':!![]},_0x2d6280,_0x33429f)[_0x5da5('0x23')](function(_0x38a974){logger[_0x5da5('0x2a')](_0x5da5('0x32'),_0x2d6280,_0x2f2596,_0x38a974);})['catch'](function(_0x1ab02){logger[_0x5da5('0x34')](_0x5da5('0x35'),_0x2d6280,_0x1ab02);});}else{logger[_0x5da5('0x34')](_0x5da5('0x3d'),_0x33429f);if(_0x3ba804['timers']){logger[_0x5da5('0x2a')](_0x5da5('0x3e'),JSON['stringify'](_0x3ba804[_0x5da5('0x8')]));}}}catch(_0x5643e7){logger['error'](_0x5da5('0x3f'),_0x5643e7[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0xb')]=function(_0x52b618){try{if(this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]]&&(this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]][_0x5da5('0x3')]||this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]][_0x5da5('0x1e')])){if(this[_0x5da5('0x7')][_0x52b618[_0x5da5('0x40')]]){this[_0x5da5('0x9')][_0x52b618[_0x5da5('0x30')]]={'queue':_0x52b618[_0x5da5('0x1c')],'interface':_0x52b618[_0x5da5('0x40')],'destlinkedid':_0x52b618[_0x5da5('0x28')]};}}}catch(_0x59acfe){logger['error'](_0x5da5('0x41'),_0x59acfe[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0x17')]=function(_0x1a188b){try{if(this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]]&&(this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]][_0x5da5('0x3')]||this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]][_0x5da5('0x1e')])){if(this['agents'][_0x1a188b[_0x5da5('0x40')]]){this['channels'][_0x1a188b['uniqueid']]={'queue':_0x1a188b[_0x5da5('0x1c')],'interface':_0x1a188b[_0x5da5('0x40')]};}}}catch(_0x455caf){logger[_0x5da5('0x34')](_0x5da5('0x42'),_0x455caf[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0xe')]=function(_0x536ca2){try{if(this['channels'][_0x536ca2[_0x5da5('0x30')]]&&_[_0x5da5('0x43')](this['channels'][_0x536ca2[_0x5da5('0x30')]][_0x5da5('0x27')])){logger[_0x5da5('0x2a')](_0x5da5('0x44'),_0x536ca2[_0x5da5('0x30')]);this['startAcw'](_0x536ca2[_0x5da5('0x30')]);}else if(this['channels'][_0x536ca2['linkedid']]&&_[_0x5da5('0x43')](this['channels'][_0x536ca2[_0x5da5('0x45')]][_0x5da5('0x27')])){logger[_0x5da5('0x2a')](_0x5da5('0x46'),_0x536ca2[_0x5da5('0x45')]);this[_0x5da5('0x1b')](_0x536ca2['linkedid']);}}catch(_0x5cb8d8){logger[_0x5da5('0x34')](_0x5da5('0x47'),_0x5cb8d8['message']);}};Acw['prototype'][_0x5da5('0xf')]=function(_0x4c1321){try{if(this[_0x5da5('0x9')][_0x4c1321['uniqueid']]&&this['channels'][_0x4c1321[_0x5da5('0x30')]][_0x5da5('0x27')]){logger[_0x5da5('0x2a')](_0x5da5('0x48'),_0x4c1321['uniqueid']);this[_0x5da5('0x1b')](_0x4c1321[_0x5da5('0x30')]);}else if(this[_0x5da5('0x9')][_0x4c1321['linkedid']]&&this[_0x5da5('0x9')][_0x4c1321[_0x5da5('0x45')]][_0x5da5('0x27')]){logger[_0x5da5('0x2a')](_0x5da5('0x49'),_0x4c1321[_0x5da5('0x45')]);this[_0x5da5('0x1b')](_0x4c1321[_0x5da5('0x45')]);}}catch(_0x3d1a54){logger[_0x5da5('0x34')](_0x5da5('0x4a'),_0x3d1a54[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x13')]=function(_0xb3a0b0){try{if(!_[_0x5da5('0x4b')](this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4c')]])){this[_0x5da5('0x1b')](_0xb3a0b0[_0x5da5('0x4c')]);if(this[_0x5da5('0x9')][_0xb3a0b0['secondtransfereruniqueid']]){this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4d')]]['attended']=!![];this['channels'][_0xb3a0b0['transfertargetuniqueid']]=this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4d')]];delete this[_0x5da5('0x9')][_0xb3a0b0['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4e')]])){this[_0x5da5('0x1b')](_0xb3a0b0[_0x5da5('0x4e')]);if(this['channels'][_0xb3a0b0[_0x5da5('0x4f')]]){this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]]['attended']=!![];this[_0x5da5('0x9')][_0xb3a0b0['transfereeuniqueid']]=this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]];delete this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]];}}}catch(_0x12c983){logger[_0x5da5('0x34')](_0x5da5('0x50'),_0x12c983[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x15')]=function(_0x2f9f72){try{if(this[_0x5da5('0x9')][_0x2f9f72[_0x5da5('0x51')]]){logger[_0x5da5('0x2a')](_0x5da5('0x52'),JSON[_0x5da5('0x53')](_0x2f9f72[_0x5da5('0x51')]));this[_0x5da5('0x1b')](_0x2f9f72[_0x5da5('0x51')]);}else if(this[_0x5da5('0x9')][_0x2f9f72[_0x5da5('0x54')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x5da5('0x53')](_0x2f9f72[_0x5da5('0x54')]));this[_0x5da5('0x1b')](_0x2f9f72['transfererlinkedid']);}}catch(_0x2ca7b9){logger[_0x5da5('0x34')](_0x5da5('0x55'),_0x2ca7b9[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0x11')]=function(_0x5f3753){try{if(this[_0x5da5('0x6')][_0x5f3753[_0x5da5('0x1c')]]&&this[_0x5da5('0x6')][_0x5f3753[_0x5da5('0x1c')]][_0x5da5('0x56')]===_0x5da5('0x57')){if(this[_0x5da5('0x7')][_0x5f3753['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5f3753[_0x5da5('0x30')],_0x5f3753[_0x5da5('0x40')],_0x5f3753[_0x5da5('0x1c')]);return RpcUser[_0x5da5('0x29')](this[_0x5da5('0x7')][_0x5f3753[_0x5da5('0x40')]],_0x5da5('0x58'),_0x5f3753[_0x5da5('0x30')]);}}}catch(_0x5f4529){logger[_0x5da5('0x34')](_0x5da5('0x59'),_0x5f4529['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xe5b3=['error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','message','stopAcw','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]'];(function(_0x2288fb,_0x40e7b1){var _0x49451e=function(_0x4240f8){while(--_0x4240f8){_0x2288fb['push'](_0x2288fb['shift']());}};_0x49451e(++_0x40e7b1);}(_0xe5b3,0x133));var _0x3e5b=function(_0x375b32,_0x5c19b9){_0x375b32=_0x375b32-0x0;var _0x4e6982=_0xe5b3[_0x375b32];return _0x4e6982;};'use strict';var util=require('util');var _=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var ami=require(_0x3e5b('0x2'));var logger=require(_0x3e5b('0x3'))(_0x3e5b('0x4'));var RpcUser=require(_0x3e5b('0x5'));var RpcVoiceAgentReport=require(_0x3e5b('0x6'));function Acw(_0x1e58ed){this[_0x3e5b('0x7')]=_0x1e58ed[_0x3e5b('0x7')];this[_0x3e5b('0x8')]=_0x1e58ed['agents'];this[_0x3e5b('0x9')]=_0x1e58ed[_0x3e5b('0x9')];this['channels']={};ami['on'](_0x3e5b('0xa'),this[_0x3e5b('0xb')][_0x3e5b('0xc')](this));ami['on'](_0x3e5b('0xd'),this['syncHangupRequest']['bind'](this));ami['on'](_0x3e5b('0xe'),this[_0x3e5b('0xf')][_0x3e5b('0xc')](this));ami['on'](_0x3e5b('0x10'),this[_0x3e5b('0x11')]['bind'](this));ami['on'](_0x3e5b('0x12'),this['syncAttendedTransfer'][_0x3e5b('0xc')](this));ami['on'](_0x3e5b('0x13'),this[_0x3e5b('0x14')][_0x3e5b('0xc')](this));ami['on'](_0x3e5b('0x15'),this[_0x3e5b('0x16')][_0x3e5b('0xc')](this));}function getDiff(_0x560010){var _0x39a2a1=moment()['milliseconds'](0x0);var _0x51a188=moment(_0x560010)['milliseconds'](0x0);return _0x39a2a1[_0x3e5b('0x17')](_0x51a188,_0x3e5b('0x18'));}Acw[_0x3e5b('0x19')]['startAcw']=function(_0x1f81a7){try{var _0x59ddc0=this;var _0x56a453=this[_0x3e5b('0x1a')][_0x1f81a7][_0x3e5b('0x1b')];var _0x5e2f83=this[_0x3e5b('0x1a')][_0x1f81a7][_0x3e5b('0x1c')];var _0x555002=this[_0x3e5b('0x7')][_0x5e2f83];var _0x3365dd=![];var _0x52696c='ACW';if(_0x555002[_0x3e5b('0x1d')]){if(_0x555002[_0x3e5b('0x1e')][_0x3e5b('0x1f')]){_0x3365dd=!![];_0x52696c=_0x555002[_0x3e5b('0x1e')][_0x3e5b('0x1f')];}}ami[_0x3e5b('0x20')]({'action':_0x3e5b('0x21'),'interface':_0x56a453,'paused':!![],'reason':_0x52696c})[_0x3e5b('0x22')](function(_0x36c988){if(_0x59ddc0[_0x3e5b('0x8')][_0x56a453]){return RpcUser[_0x3e5b('0x23')](_0x59ddc0[_0x3e5b('0x8')][_0x56a453]['id'])[_0x3e5b('0x22')](function(_0x402873){if(_0x402873&&!_0x402873['voicePause']){logger[_0x3e5b('0x24')](_0x3e5b('0x25'),_0x1f81a7,_0x56a453,_0x5e2f83);var _0x2146d4=_0x59ddc0[_0x3e5b('0x1a')][_0x1f81a7]['attended']&&_0x59ddc0[_0x3e5b('0x1a')][_0x1f81a7]['destlinkedid']?_0x59ddc0[_0x3e5b('0x1a')][_0x1f81a7][_0x3e5b('0x26')]:_0x1f81a7;return RpcUser['savePause'](_0x59ddc0[_0x3e5b('0x8')][_0x56a453],_0x52696c,_0x2146d4)[_0x3e5b('0x22')](function(_0x42d7e9){if(!_0x3365dd){_0x59ddc0[_0x3e5b('0x9')][_0x56a453]={};logger[_0x3e5b('0x24')](_0x3e5b('0x27'),_0x1f81a7,_0x59ddc0[_0x3e5b('0x7')][_0x5e2f83][_0x3e5b('0x28')],_0x56a453,_0x5e2f83);_0x59ddc0['timers'][_0x56a453][_0x3e5b('0x29')]=setTimeout(_0x59ddc0['stopAcw'][_0x3e5b('0xc')](_0x59ddc0,_0x56a453),_0x59ddc0['voiceQueues'][_0x5e2f83][_0x3e5b('0x28')]*0x3e8);_0x59ddc0[_0x3e5b('0x9')][_0x56a453][_0x3e5b('0x2a')]=moment()[_0x3e5b('0x2b')](_0x3e5b('0x2c'));_0x59ddc0[_0x3e5b('0x9')][_0x56a453][_0x3e5b('0x2d')]=_0x1f81a7;_0x59ddc0[_0x3e5b('0x9')][_0x56a453][_0x3e5b('0x1c')]=_0x5e2f83;_0x59ddc0[_0x3e5b('0x9')][_0x56a453][_0x3e5b('0x2e')]=function(){var _0x489221=getDiff(_0x59ddc0[_0x3e5b('0x9')][_0x56a453][_0x3e5b('0x2a')]);clearTimeout(_0x59ddc0[_0x3e5b('0x9')][_0x56a453][_0x3e5b('0x29')]);_0x59ddc0[_0x3e5b('0x9')][_0x56a453][_0x3e5b('0x29')]=![];RpcVoiceAgentReport[_0x3e5b('0x2f')]({'acwtime':_0x489221},_0x59ddc0['timers'][_0x56a453][_0x3e5b('0x2d')],_0x56a453)['then'](function(_0x5b9ba3){logger[_0x3e5b('0x24')](_0x3e5b('0x30'),_0x1f81a7,_0x489221,_0x5b9ba3);})['catch'](function(_0x40e37d){logger[_0x3e5b('0x31')](_0x3e5b('0x32'),_0x1f81a7,_0x40e37d);});delete _0x59ddc0[_0x3e5b('0x9')][_0x56a453];};}});}else{logger[_0x3e5b('0x24')](_0x3e5b('0x33'),_0x1f81a7,_0x56a453,_0x5e2f83);}});}})[_0x3e5b('0x34')](function(_0x26c9ab){logger[_0x3e5b('0x31')](_0x3e5b('0x27'),_0x1f81a7,_0x59ddc0[_0x3e5b('0x7')][_0x5e2f83][_0x3e5b('0x28')],_0x56a453,_0x5e2f83);})['finally'](function(){delete _0x59ddc0[_0x3e5b('0x1a')][_0x1f81a7];});}catch(_0xec45c5){logger['error']('[ACW][START]\x20%s',_0xec45c5[_0x3e5b('0x35')]);}};Acw['prototype'][_0x3e5b('0x36')]=function(_0x3f68c6){try{var _0xb2349c=this;if(_0xb2349c[_0x3e5b('0x9')][_0x3f68c6]){_0xb2349c['timers'][_0x3f68c6][_0x3e5b('0x29')]=![];var _0x4cdcb1=_0xb2349c[_0x3e5b('0x9')][_0x3f68c6]['uniqueid'];var _0x47f7c8=_0xb2349c['timers'][_0x3f68c6][_0x3e5b('0x1c')];var _0x174ebf=_0xb2349c[_0x3e5b('0x7')][_0x47f7c8][_0x3e5b('0x28')];logger[_0x3e5b('0x24')](_0x3e5b('0x37'),_0x3f68c6);RpcUser['saveUnpause'](this['agents'][_0x3f68c6]);RpcVoiceAgentReport['update']({'acwtime':_0x174ebf,'agentacw':!![]},_0x4cdcb1,_0x3f68c6)['then'](function(_0x5f0271){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4cdcb1,_0x174ebf,_0x5f0271);})[_0x3e5b('0x34')](function(_0x349de0){logger[_0x3e5b('0x31')](_0x3e5b('0x32'),_0x4cdcb1,_0x349de0);});}else{logger[_0x3e5b('0x31')](_0x3e5b('0x38'),_0x3f68c6);if(_0xb2349c[_0x3e5b('0x9')]){logger[_0x3e5b('0x24')](_0x3e5b('0x39'),JSON[_0x3e5b('0x3a')](_0xb2349c[_0x3e5b('0x9')]));}}}catch(_0x4ee160){logger[_0x3e5b('0x31')](_0x3e5b('0x3b'),_0x4ee160[_0x3e5b('0x35')]);}};Acw[_0x3e5b('0x19')][_0x3e5b('0xb')]=function(_0xc69499){try{if(this[_0x3e5b('0x7')][_0xc69499[_0x3e5b('0x1c')]]&&(this[_0x3e5b('0x7')][_0xc69499[_0x3e5b('0x1c')]][_0x3e5b('0x4')]||this['voiceQueues'][_0xc69499['queue']]['mandatoryDisposition'])){if(this['agents'][_0xc69499[_0x3e5b('0x1b')]]){this[_0x3e5b('0x1a')][_0xc69499[_0x3e5b('0x2d')]]={'queue':_0xc69499[_0x3e5b('0x1c')],'interface':_0xc69499[_0x3e5b('0x1b')],'destlinkedid':_0xc69499[_0x3e5b('0x26')]};}}}catch(_0x12b486){logger[_0x3e5b('0x31')](_0x3e5b('0x3c'),_0x12b486[_0x3e5b('0x35')]);}};Acw['prototype'][_0x3e5b('0x16')]=function(_0x28a105){try{if(this[_0x3e5b('0x7')][_0x28a105[_0x3e5b('0x1c')]]&&(this[_0x3e5b('0x7')][_0x28a105['queue']]['acw']||this['voiceQueues'][_0x28a105[_0x3e5b('0x1c')]][_0x3e5b('0x1d')])){if(this[_0x3e5b('0x8')][_0x28a105['interface']]){this['channels'][_0x28a105[_0x3e5b('0x2d')]]={'queue':_0x28a105[_0x3e5b('0x1c')],'interface':_0x28a105[_0x3e5b('0x1b')]};}}}catch(_0x5acf51){logger['error'](_0x3e5b('0x3d'),_0x5acf51['message']);}};Acw[_0x3e5b('0x19')][_0x3e5b('0x3e')]=function(_0x3f5835){try{if(this[_0x3e5b('0x1a')][_0x3f5835[_0x3e5b('0x2d')]]&&_[_0x3e5b('0x3f')](this[_0x3e5b('0x1a')][_0x3f5835[_0x3e5b('0x2d')]][_0x3e5b('0x40')])){logger['info'](_0x3e5b('0x41'),_0x3f5835['uniqueid']);this[_0x3e5b('0x42')](_0x3f5835[_0x3e5b('0x2d')]);}else if(this[_0x3e5b('0x1a')][_0x3f5835[_0x3e5b('0x43')]]&&_[_0x3e5b('0x3f')](this[_0x3e5b('0x1a')][_0x3f5835[_0x3e5b('0x43')]][_0x3e5b('0x40')])){logger[_0x3e5b('0x24')](_0x3e5b('0x44'),_0x3f5835[_0x3e5b('0x43')]);this[_0x3e5b('0x42')](_0x3f5835[_0x3e5b('0x43')]);}}catch(_0x59d311){logger[_0x3e5b('0x31')](_0x3e5b('0x45'),_0x59d311[_0x3e5b('0x35')]);}};Acw[_0x3e5b('0x19')][_0x3e5b('0xf')]=function(_0x2cecd3){try{if(this['channels'][_0x2cecd3[_0x3e5b('0x2d')]]&&this[_0x3e5b('0x1a')][_0x2cecd3[_0x3e5b('0x2d')]][_0x3e5b('0x40')]){logger[_0x3e5b('0x24')](_0x3e5b('0x46'),_0x2cecd3[_0x3e5b('0x2d')]);this[_0x3e5b('0x42')](_0x2cecd3['uniqueid']);}else if(this[_0x3e5b('0x1a')][_0x2cecd3['linkedid']]&&this['channels'][_0x2cecd3[_0x3e5b('0x43')]]['attended']){logger[_0x3e5b('0x24')](_0x3e5b('0x47'),_0x2cecd3[_0x3e5b('0x43')]);this[_0x3e5b('0x42')](_0x2cecd3['linkedid']);}}catch(_0x5ddeee){logger['error']('[ACW][syncHangup]\x20%s',_0x5ddeee[_0x3e5b('0x35')]);}};Acw[_0x3e5b('0x19')][_0x3e5b('0x48')]=function(_0x4149c8){try{if(!_[_0x3e5b('0x49')](this['channels'][_0x4149c8['transfereeuniqueid']])){this[_0x3e5b('0x42')](_0x4149c8[_0x3e5b('0x4a')]);if(this[_0x3e5b('0x1a')][_0x4149c8[_0x3e5b('0x4b')]]){this[_0x3e5b('0x1a')][_0x4149c8['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x4149c8['transfertargetuniqueid']]=this[_0x3e5b('0x1a')][_0x4149c8[_0x3e5b('0x4b')]];delete this[_0x3e5b('0x1a')][_0x4149c8[_0x3e5b('0x4b')]];}}else if(!_[_0x3e5b('0x49')](this[_0x3e5b('0x1a')][_0x4149c8[_0x3e5b('0x4c')]])){this[_0x3e5b('0x42')](_0x4149c8['transfertargetuniqueid']);if(this[_0x3e5b('0x1a')][_0x4149c8[_0x3e5b('0x4d')]]){this[_0x3e5b('0x1a')][_0x4149c8[_0x3e5b('0x4d')]][_0x3e5b('0x40')]=!![];this['channels'][_0x4149c8[_0x3e5b('0x4a')]]=this['channels'][_0x4149c8[_0x3e5b('0x4d')]];delete this[_0x3e5b('0x1a')][_0x4149c8['origtransfereruniqueid']];}}}catch(_0x4a7d8e){logger['error'](_0x3e5b('0x4e'),_0x4a7d8e['message']);}};Acw[_0x3e5b('0x19')][_0x3e5b('0x14')]=function(_0x1af190){try{if(this[_0x3e5b('0x1a')][_0x1af190[_0x3e5b('0x4f')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x3e5b('0x3a')](_0x1af190[_0x3e5b('0x4f')]));this[_0x3e5b('0x42')](_0x1af190['transfereruniqueid']);}else if(this[_0x3e5b('0x1a')][_0x1af190[_0x3e5b('0x50')]]){logger[_0x3e5b('0x24')](_0x3e5b('0x51'),JSON[_0x3e5b('0x3a')](_0x1af190[_0x3e5b('0x50')]));this[_0x3e5b('0x42')](_0x1af190[_0x3e5b('0x50')]);}}catch(_0x3a11a8){logger[_0x3e5b('0x31')](_0x3e5b('0x52'),_0x3a11a8[_0x3e5b('0x35')]);}};Acw[_0x3e5b('0x19')][_0x3e5b('0x11')]=function(_0x13204a){try{if(this[_0x3e5b('0x7')][_0x13204a[_0x3e5b('0x1c')]]&&this[_0x3e5b('0x7')][_0x13204a['queue']][_0x3e5b('0x53')]===_0x3e5b('0x54')){if(this['agents'][_0x13204a[_0x3e5b('0x1b')]]){logger[_0x3e5b('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x13204a['uniqueid'],_0x13204a['interface'],_0x13204a[_0x3e5b('0x1c')]);return RpcUser[_0x3e5b('0x55')](this['agents'][_0x13204a[_0x3e5b('0x1b')]],_0x3e5b('0x56'),_0x13204a['uniqueid']);}}}catch(_0x3d3bf2){logger[_0x3e5b('0x31')](_0x3e5b('0x57'),_0x3d3bf2[_0x3e5b('0x35')]);}};module[_0x3e5b('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f39a5ad..06d088a 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 _0xfaa6=['moment','util','../../config/logger','ami','asterisk','port','username','Action','promisify','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','exports','asterisk-manager','bluebird'];(function(_0x3e2ea4,_0xa590b3){var _0x3369ac=function(_0x24df0c){while(--_0x24df0c){_0x3e2ea4['push'](_0x3e2ea4['shift']());}};_0x3369ac(++_0xa590b3);}(_0xfaa6,0xad));var _0x6faa=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0xfaa6[_0x2f0057];return _0x17f2c3;};'use strict';var Manager=require(_0x6faa('0x0'));var BPromise=require(_0x6faa('0x1'));var moment=require(_0x6faa('0x2'));var util=require(_0x6faa('0x3'));var _=require('lodash');var logger=require(_0x6faa('0x4'))(_0x6faa('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x6faa('0x6')][_0x6faa('0x7')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')][_0x6faa('0x8')],config['asterisk']['password'],!![]);ami['keepConnected']();ami[_0x6faa('0x9')]=BPromise[_0x6faa('0xa')](ami[_0x6faa('0xb')]);function error(_0x3b7b9f){logger[_0x6faa('0xc')](util[_0x6faa('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x6faa('0x6')][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config['asterisk'][_0x6faa('0x7')],util[_0x6faa('0xe')](_0x3b7b9f,![],null)));}function close(){logger[_0x6faa('0xc')](util[_0x6faa('0xd')](_0x6faa('0xf'),config['asterisk'][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')][_0x6faa('0x7')]));}ami[_0x6faa('0x10')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x6faa('0x11')]=function(){return function(){return ami[_0x6faa('0x9')]({'action':_0x6faa('0x12')});};};ami[_0x6faa('0x13')]=function(){return function(){return ami[_0x6faa('0x9')]({'action':_0x6faa('0x14')});};};ami[_0x6faa('0x15')]=function(){return function(){return ami[_0x6faa('0x9')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x6faa('0x9')]({'action':_0x6faa('0x16')});};};function connect(_0x127d28){logger[_0x6faa('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6faa('0x6')][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')]['port']));ami[_0x6faa('0x18')](_0x6faa('0xc'),error);ami[_0x6faa('0x18')]('close',close);}ami['on'](_0x6faa('0x19'),connect);ami['on'](_0x6faa('0x1a'),function(_0x3d73d8){logger[_0x6faa('0x17')](util[_0x6faa('0xd')](_0x6faa('0x1b'),config[_0x6faa('0x6')][_0x6faa('0x8')],config['asterisk']['ip'],config['asterisk'][_0x6faa('0x7')],util[_0x6faa('0xe')](_0x3d73d8,![],null)));});ami['on'](_0x6faa('0x1c'),function(_0x48388c){logger[_0x6faa('0x17')](util[_0x6faa('0xd')](_0x6faa('0x1d'),config['asterisk'][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')][_0x6faa('0x7')]));return BPromise[_0x6faa('0x1e')]()[_0x6faa('0x1f')](ami[_0x6faa('0x10')]())['then'](ami['actionDeviceStateList']())[_0x6faa('0x1f')](ami['actionSipPeerStatus']())['then'](ami[_0x6faa('0x15')]())[_0x6faa('0x1f')](ami[_0x6faa('0x20')]())[_0x6faa('0x21')](function(_0x25b99b){console['log'](_0x25b99b);});});ami['once'](_0x6faa('0xc'),error);ami[_0x6faa('0x18')]('close',close);module[_0x6faa('0x22')]=ami; \ No newline at end of file +var _0x91ce=['username','keepConnected','Action','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','once','error','close','connect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','exports','asterisk-manager','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0x91ce,0x10f));var _0xe91c=function(_0x33670a,_0x55e188){_0x33670a=_0x33670a-0x0;var _0x36ad1d=_0x91ce[_0x33670a];return _0x36ad1d;};'use strict';var Manager=require(_0xe91c('0x0'));var BPromise=require('bluebird');var moment=require(_0xe91c('0x1'));var util=require(_0xe91c('0x2'));var _=require(_0xe91c('0x3'));var logger=require(_0xe91c('0x4'))(_0xe91c('0x5'));var config=require(_0xe91c('0x6'));var ami=new Manager(config[_0xe91c('0x7')][_0xe91c('0x8')],config[_0xe91c('0x7')]['ip'],config[_0xe91c('0x7')][_0xe91c('0x9')],config[_0xe91c('0x7')]['password'],!![]);ami[_0xe91c('0xa')]();ami[_0xe91c('0xb')]=BPromise['promisify'](ami[_0xe91c('0xc')]);function error(_0xcb4b63){logger['error'](util[_0xe91c('0xd')](_0xe91c('0xe'),config[_0xe91c('0x7')]['username'],config[_0xe91c('0x7')]['ip'],config[_0xe91c('0x7')][_0xe91c('0x8')],util[_0xe91c('0xf')](_0xcb4b63,![],null)));}function close(){logger['error'](util[_0xe91c('0xd')](_0xe91c('0x10'),config['asterisk']['username'],config[_0xe91c('0x7')]['ip'],config[_0xe91c('0x7')][_0xe91c('0x8')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe91c('0xb')]({'action':_0xe91c('0x11')});};};ami[_0xe91c('0x12')]=function(){return function(){return ami[_0xe91c('0xb')]({'action':_0xe91c('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe91c('0xb')]({'action':_0xe91c('0x14')});};};ami[_0xe91c('0x15')]=function(){return function(){return ami['Action']({'action':_0xe91c('0x16')});};};ami[_0xe91c('0x17')]=function(){return function(){return ami[_0xe91c('0xb')]({'action':'coreshowchannels'});};};function connect(_0x11d9e7){logger[_0xe91c('0x18')](util[_0xe91c('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0xe91c('0x9')],config[_0xe91c('0x7')]['ip'],config['asterisk'][_0xe91c('0x8')]));ami[_0xe91c('0x19')](_0xe91c('0x1a'),error);ami[_0xe91c('0x19')](_0xe91c('0x1b'),close);}ami['on'](_0xe91c('0x1c'),connect);ami['on']('shutdown',function(_0x1f4183){logger[_0xe91c('0x18')](util[_0xe91c('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xe91c('0x7')][_0xe91c('0x9')],config['asterisk']['ip'],config[_0xe91c('0x7')]['port'],util['inspect'](_0x1f4183,![],null)));});ami['on'](_0xe91c('0x1d'),function(_0x209504){logger[_0xe91c('0x18')](util[_0xe91c('0xd')](_0xe91c('0x1e'),config[_0xe91c('0x7')]['username'],config['asterisk']['ip'],config['asterisk'][_0xe91c('0x8')]));return BPromise[_0xe91c('0x1f')]()[_0xe91c('0x20')](ami[_0xe91c('0x21')]())[_0xe91c('0x20')](ami[_0xe91c('0x12')]())[_0xe91c('0x20')](ami['actionSipPeerStatus']())[_0xe91c('0x20')](ami[_0xe91c('0x15')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x57706b){console['log'](_0x57706b);});});ami[_0xe91c('0x19')](_0xe91c('0x1a'),error);ami[_0xe91c('0x19')](_0xe91c('0x1b'),close);module[_0xe91c('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 445fbdd..e335e6e 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 _0x1ee5=['message','catch','exports','jayson/promise','bluebird','../../config/logger','ami','then','rpc','memberReport','error'];(function(_0x2e74b6,_0x2cc27d){var _0x19af77=function(_0xcc7b2f){while(--_0xcc7b2f){_0x2e74b6['push'](_0x2e74b6['shift']());}};_0x19af77(++_0x2cc27d);}(_0x1ee5,0xc9));var _0x51ee=function(_0x12e60a,_0x46a07f){_0x12e60a=_0x12e60a-0x0;var _0x15d093=_0x1ee5[_0x12e60a];return _0x15d093;};'use strict';var jayson=require(_0x51ee('0x0'));var BPromise=require(_0x51ee('0x1'));var logger=require(_0x51ee('0x2'))(_0x51ee('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x554fe9,_0x302eef){return new BPromise(function(_0x4e2e8f,_0x52cebb){return client['request'](_0x554fe9,_0x302eef)[_0x51ee('0x4')](function(_0x4632ea){logger['debug'](_0x51ee('0x5'),_0x51ee('0x6'),_0x554fe9,_0x302eef,_0x4632ea);if(_0x4632ea['error']){logger['error'](_0x51ee('0x5'),'memberReport',_0x554fe9,_0x4632ea[_0x51ee('0x7')][_0x51ee('0x8')],_0x302eef);return _0x52cebb(_0x4632ea[_0x51ee('0x7')][_0x51ee('0x8')]);}else{return _0x4e2e8f(_0x4632ea['result']);}})[_0x51ee('0x9')](function(_0x38c052){logger[_0x51ee('0x7')](_0x51ee('0x5'),_0x51ee('0x6'),_0x554fe9,_0x38c052,_0x302eef);return _0x52cebb(_0x38c052);});});};module[_0x51ee('0xa')]=client; \ No newline at end of file +var _0x2e12=['then','debug','rpc','memberReport','error','message','exports','jayson/promise','bluebird','../../config/logger','ami','http','Request','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2e12,0x13b));var _0x22e1=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2e12[_0x42245d];return _0x4b211a;};'use strict';var jayson=require(_0x22e1('0x0'));var BPromise=require(_0x22e1('0x1'));var logger=require(_0x22e1('0x2'))(_0x22e1('0x3'));var client=jayson['client'][_0x22e1('0x4')]({'port':0x2329});client[_0x22e1('0x5')]=function(_0x405d17,_0x35190d){return new BPromise(function(_0x5d8987,_0xc05678){return client[_0x22e1('0x6')](_0x405d17,_0x35190d)[_0x22e1('0x7')](function(_0x2d15af){logger[_0x22e1('0x8')](_0x22e1('0x9'),_0x22e1('0xa'),_0x405d17,_0x35190d,_0x2d15af);if(_0x2d15af[_0x22e1('0xb')]){logger[_0x22e1('0xb')]('rpc',_0x22e1('0xa'),_0x405d17,_0x2d15af[_0x22e1('0xb')][_0x22e1('0xc')],_0x35190d);return _0xc05678(_0x2d15af['error'][_0x22e1('0xc')]);}else{return _0x5d8987(_0x2d15af['result']);}})['catch'](function(_0x1f4bf){logger[_0x22e1('0xb')](_0x22e1('0x9'),_0x22e1('0xa'),_0x405d17,_0x1f4bf,_0x35190d);return _0xc05678(_0x1f4bf);});});};module[_0x22e1('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 385c0cd..bbc7bff 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 _0x52c1=['callback','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','isNil','voiceQueue','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1c8255,_0x1ee6b){var _0x13d0e1=function(_0x323623){while(--_0x323623){_0x1c8255['push'](_0x1c8255['shift']());}};_0x13d0e1(++_0x1ee6b);}(_0x52c1,0x1ce));var _0x152c=function(_0x3a2bd4,_0xe533d8){_0x3a2bd4=_0x3a2bd4-0x0;var _0x28f4a8=_0x52c1[_0x3a2bd4];return _0x28f4a8;};'use strict';var util=require(_0x152c('0x0'));var _=require(_0x152c('0x1'));var moment=require(_0x152c('0x2'));function checkNameSurname(_0x11ca60,_0x46fa33,_0x22092b){var _0x521699='';if(!_[_0x152c('0x3')](_0x46fa33)&&'string'===typeof _0x46fa33){_0x521699+=_0x46fa33;}if(!_[_0x152c('0x3')](_0x22092b)&&'string'===typeof _0x22092b){_0x521699+='\x20'+_0x22092b;}if(_0x521699!==''){return _0x521699;}return _0x11ca60;}function Action(_0x17c5f5,_0x56b4d0,_0x58fb2e){this[_0x152c('0x4')]=_0x17c5f5;this['uniqueid']=_0x58fb2e||undefined;this[_0x152c('0x5')]=checkNameSurname(_0x56b4d0[_0x152c('0x6')][_0x152c('0x7')],_0x56b4d0[_0x152c('0x6')]['firstName'],_0x56b4d0[_0x152c('0x6')][_0x152c('0x8')]);this['number']=_0x56b4d0[_0x152c('0x6')][_0x152c('0x7')];this[_0x152c('0x9')]=_0x17c5f5[_0x152c('0x5')];this[_0x152c('0xa')]=_0x56b4d0[_0x152c('0xa')]||![];this[_0x152c('0xb')]=_0x17c5f5[_0x152c('0xb')];this[_0x152c('0xc')]=_0x17c5f5[_0x152c('0xc')]||0x3;this[_0x152c('0xd')]=_0x56b4d0['scheduledat'];this[_0x152c('0xe')]=_0x56b4d0[_0x152c('0xe')];this[_0x152c('0xf')]=_0x56b4d0[_0x152c('0xf')];this[_0x152c('0x10')]=_0x56b4d0[_0x152c('0x10')];this[_0x152c('0x11')]=_0x56b4d0[_0x152c('0x11')];this['countdropretry']=_0x56b4d0[_0x152c('0x12')];this[_0x152c('0x13')]=_0x56b4d0[_0x152c('0x13')];this[_0x152c('0x14')]=_0x56b4d0['countmachineretry'];this[_0x152c('0x15')]=_0x56b4d0[_0x152c('0x15')];this[_0x152c('0x16')]=_0x56b4d0[_0x152c('0x16')];this[_0x152c('0x17')]=_0x56b4d0['ListId'];this[_0x152c('0x18')]=_0x56b4d0[_0x152c('0x18')];this[_0x152c('0x19')]=_0x56b4d0[_0x152c('0x19')];this[_0x152c('0x1a')]=_0x56b4d0[_0x152c('0x1a')];this[_0x152c('0x1b')]=_0x56b4d0['id'];this[_0x152c('0x1c')]=_0x56b4d0[_0x152c('0x6')][_0x152c('0x1d')]||'';this[_0x152c('0x1e')]=moment()[_0x152c('0x1f')](_0x152c('0x20'));this['callback']=_0x56b4d0[_0x152c('0x21')];this['callbackuniqueid']=_0x56b4d0['callbackuniqueid'];this['callbackat']=_0x56b4d0['callbackat'];this[_0x152c('0x22')]=_0x56b4d0[_0x152c('0x22')];this[_0x152c('0x23')]='';this[_0x152c('0x24')]='';}Action[_0x152c('0x25')][_0x152c('0x26')]=function(){return util[_0x152c('0x1f')](_0x152c('0x27'),this['name'],this['voiceQueue'][_0x152c('0x28')]>0x0?this[_0x152c('0x29')][_0x152c('0x2a')](this[_0x152c('0x4')][_0x152c('0x28')]):this[_0x152c('0x29')]);};Action[_0x152c('0x25')][_0x152c('0x2b')]=function(){return this['queue'];};module[_0x152c('0x2c')]=Action; \ No newline at end of file +var _0x0b96=['VoiceQueueId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0xd84566,_0x4d8b67){var _0x28d6e7=function(_0x5234fd){while(--_0x5234fd){_0xd84566['push'](_0xd84566['shift']());}};_0x28d6e7(++_0x4d8b67);}(_0x0b96,0xa5));var _0x60b9=function(_0x57cc7a,_0x1e738d){_0x57cc7a=_0x57cc7a-0x0;var _0x5d6159=_0x0b96[_0x57cc7a];return _0x5d6159;};'use strict';var util=require(_0x60b9('0x0'));var _=require(_0x60b9('0x1'));var moment=require(_0x60b9('0x2'));function checkNameSurname(_0x54ced4,_0xbe4f47,_0x13616a){var _0x23a080='';if(!_['isNil'](_0xbe4f47)&&_0x60b9('0x3')===typeof _0xbe4f47){_0x23a080+=_0xbe4f47;}if(!_[_0x60b9('0x4')](_0x13616a)&&'string'===typeof _0x13616a){_0x23a080+='\x20'+_0x13616a;}if(_0x23a080!==''){return _0x23a080;}return _0x54ced4;}function Action(_0x393671,_0x443326,_0x40e534){this[_0x60b9('0x5')]=_0x393671;this[_0x60b9('0x6')]=_0x40e534||undefined;this[_0x60b9('0x7')]=checkNameSurname(_0x443326[_0x60b9('0x8')]['phone'],_0x443326[_0x60b9('0x8')]['firstName'],_0x443326['Contact'][_0x60b9('0x9')]);this[_0x60b9('0xa')]=_0x443326[_0x60b9('0x8')][_0x60b9('0xb')];this['queue']=_0x393671[_0x60b9('0x7')];this[_0x60b9('0xc')]=_0x443326[_0x60b9('0xc')]||![];this['type']=_0x393671[_0x60b9('0xd')];this[_0x60b9('0xe')]=_0x393671[_0x60b9('0xe')]||0x3;this[_0x60b9('0xf')]=_0x443326[_0x60b9('0xf')];this[_0x60b9('0x10')]=_0x443326[_0x60b9('0x10')];this[_0x60b9('0x11')]=_0x443326[_0x60b9('0x11')];this[_0x60b9('0x12')]=_0x443326[_0x60b9('0x12')];this['countnosuchnumberretry']=_0x443326[_0x60b9('0x13')];this[_0x60b9('0x14')]=_0x443326[_0x60b9('0x14')];this[_0x60b9('0x15')]=_0x443326[_0x60b9('0x15')];this['countmachineretry']=_0x443326[_0x60b9('0x16')];this[_0x60b9('0x17')]=_0x443326[_0x60b9('0x17')];this[_0x60b9('0x18')]=_0x443326['ContactId'];this['ListId']=_0x443326[_0x60b9('0x19')];this[_0x60b9('0x1a')]=_0x443326[_0x60b9('0x1a')];this[_0x60b9('0x1b')]=_0x443326[_0x60b9('0x1b')];this[_0x60b9('0x1c')]=_0x443326[_0x60b9('0x1c')];this['idHopper']=_0x443326['id'];this[_0x60b9('0x1d')]=_0x443326['Contact'][_0x60b9('0x1e')]||'';this[_0x60b9('0x1f')]=moment()[_0x60b9('0x20')](_0x60b9('0x21'));this['callback']=_0x443326[_0x60b9('0x22')];this[_0x60b9('0x23')]=_0x443326[_0x60b9('0x23')];this['callbackat']=_0x443326[_0x60b9('0x24')];this['recallme']=_0x443326[_0x60b9('0x25')];this[_0x60b9('0x26')]='';this[_0x60b9('0x27')]='';}Action[_0x60b9('0x28')][_0x60b9('0x29')]=function(){return util['format'](_0x60b9('0x2a'),this[_0x60b9('0x7')],this[_0x60b9('0x5')][_0x60b9('0x2b')]>0x0?this['number'][_0x60b9('0x2c')](this['voiceQueue'][_0x60b9('0x2b')]):this[_0x60b9('0xa')]);};Action[_0x60b9('0x28')][_0x60b9('0x2d')]=function(){return this[_0x60b9('0x2e')];};module[_0x60b9('0x2f')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index b8e7a2f..e46b7eb 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 _0xb5b8=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridnum','number','starttime','responsetime','endtime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x41bd6d,_0x4cba8d){var _0x11d5a5=function(_0x223921){while(--_0x223921){_0x41bd6d['push'](_0x41bd6d['shift']());}};_0x11d5a5(++_0x4cba8d);}(_0xb5b8,0x103));var _0x8b5b=function(_0x16a062,_0xaa8f04){_0x16a062=_0x16a062-0x0;var _0xdc417b=_0xb5b8[_0x16a062];return _0xdc417b;};'use strict';var util=require(_0x8b5b('0x0'));var _=require('lodash');var moment=require(_0x8b5b('0x1'));function getSeconds(_0x443b74,_0x464ecc){var _0x328f51=moment(_0x443b74)[_0x8b5b('0x2')](0x0);var _0x29b475=moment(_0x464ecc)[_0x8b5b('0x2')](0x0);return _0x328f51['diff'](_0x29b475,_0x8b5b('0x3'));}function AdditionalPhone(_0x1509a4){this[_0x8b5b('0x4')]=_0x1509a4['uniqueid'];this[_0x8b5b('0x5')]=_0x1509a4[_0x8b5b('0x5')]||undefined;this['type']=_0x1509a4['type'];this['campaigntype']=_0x1509a4[_0x8b5b('0x6')]===_0x8b5b('0x7')?'queue':_0x1509a4['type'];this[_0x8b5b('0x8')]=_0x1509a4[_0x8b5b('0x8')];this[_0x8b5b('0x9')]=_0x1509a4['countcongestionretry'];this['countnoanswerretry']=_0x1509a4[_0x8b5b('0xa')];this[_0x8b5b('0xb')]=_0x1509a4[_0x8b5b('0x8')]+_0x1509a4[_0x8b5b('0x9')]+_0x1509a4['countnoanswerretry']+_0x1509a4[_0x8b5b('0xc')]+_0x1509a4[_0x8b5b('0xd')]+_0x1509a4[_0x8b5b('0xe')]+_0x1509a4['countmachineretry']+_0x1509a4[_0x8b5b('0xf')];this[_0x8b5b('0xc')]=_0x1509a4[_0x8b5b('0xc')];this[_0x8b5b('0xd')]=_0x1509a4[_0x8b5b('0xd')];this[_0x8b5b('0xe')]=_0x1509a4[_0x8b5b('0xe')];this['countmachineretry']=_0x1509a4[_0x8b5b('0x10')];this[_0x8b5b('0xf')]=_0x1509a4[_0x8b5b('0xf')];this[_0x8b5b('0x11')]=_0x1509a4[_0x8b5b('0x11')];this['calleridname']=_0x1509a4['name'];this[_0x8b5b('0x12')]=_0x1509a4[_0x8b5b('0x13')];this[_0x8b5b('0x14')]=_0x1509a4[_0x8b5b('0x14')];this['responsetime']=_0x1509a4[_0x8b5b('0x15')];this[_0x8b5b('0x16')]=_0x1509a4[_0x8b5b('0x15')];this['ringtime']=getSeconds(_0x1509a4[_0x8b5b('0x15')],_0x1509a4[_0x8b5b('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x8b5b('0x17')]=_0x1509a4[_0x8b5b('0x17')];this[_0x8b5b('0x18')]=_0x1509a4['callbackuniqueid'];this[_0x8b5b('0x19')]=_0x1509a4[_0x8b5b('0x19')];this['recallme']=_0x1509a4['recallme'];this[_0x8b5b('0x1a')]=_0x1509a4[_0x8b5b('0x1a')];this[_0x8b5b('0x1b')]=_0x1509a4[_0x8b5b('0x1b')];this['UserId']=_0x1509a4[_0x8b5b('0x1c')];this[_0x8b5b('0x1d')]=_0x1509a4[_0x8b5b('0x1d')];this[_0x8b5b('0x1e')]=_0x1509a4[_0x8b5b('0x1e')];this[_0x8b5b('0x1f')]=_0x1509a4[_0x8b5b('0x1f')]||'';this[_0x8b5b('0x20')]=_0x1509a4['originatecalleridname']||'';}module[_0x8b5b('0x21')]=History; \ No newline at end of file +var _0x0084=['countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','number','starttime','responsetime','ringtime','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'];(function(_0xca2d19,_0x1028d1){var _0x1851ee=function(_0x268d23){while(--_0x268d23){_0xca2d19['push'](_0xca2d19['shift']());}};_0x1851ee(++_0x1028d1);}(_0x0084,0x140));var _0x4008=function(_0x173336,_0x3f98c4){_0x173336=_0x173336-0x0;var _0x12dc79=_0x0084[_0x173336];return _0x12dc79;};'use strict';var util=require(_0x4008('0x0'));var _=require(_0x4008('0x1'));var moment=require('moment');function getSeconds(_0x336dac,_0x127514){var _0x116edb=moment(_0x336dac)[_0x4008('0x2')](0x0);var _0x3f40f7=moment(_0x127514)[_0x4008('0x2')](0x0);return _0x116edb[_0x4008('0x3')](_0x3f40f7,_0x4008('0x4'));}function AdditionalPhone(_0x3a0f72){this['uniqueid']=_0x3a0f72[_0x4008('0x5')];this[_0x4008('0x6')]=_0x3a0f72[_0x4008('0x6')]||undefined;this[_0x4008('0x7')]=_0x3a0f72[_0x4008('0x7')];this[_0x4008('0x8')]=_0x3a0f72[_0x4008('0x7')]===_0x4008('0x9')?_0x4008('0xa'):_0x3a0f72['type'];this[_0x4008('0xb')]=_0x3a0f72[_0x4008('0xb')];this['countcongestionretry']=_0x3a0f72[_0x4008('0xc')];this[_0x4008('0xd')]=_0x3a0f72['countnoanswerretry'];this[_0x4008('0xe')]=_0x3a0f72['countbusyretry']+_0x3a0f72[_0x4008('0xc')]+_0x3a0f72[_0x4008('0xd')]+_0x3a0f72['countnosuchnumberretry']+_0x3a0f72[_0x4008('0xf')]+_0x3a0f72['countabandonedretry']+_0x3a0f72[_0x4008('0x10')]+_0x3a0f72[_0x4008('0x11')];this[_0x4008('0x12')]=_0x3a0f72['countnosuchnumberretry'];this[_0x4008('0xf')]=_0x3a0f72['countdropretry'];this[_0x4008('0x13')]=_0x3a0f72[_0x4008('0x13')];this[_0x4008('0x10')]=_0x3a0f72[_0x4008('0x10')];this[_0x4008('0x11')]=_0x3a0f72[_0x4008('0x11')];this[_0x4008('0xa')]=_0x3a0f72[_0x4008('0xa')];this['calleridname']=_0x3a0f72['name'];this['calleridnum']=_0x3a0f72[_0x4008('0x14')];this[_0x4008('0x15')]=_0x3a0f72[_0x4008('0x15')];this[_0x4008('0x16')]=_0x3a0f72['responsetime'];this['endtime']=_0x3a0f72[_0x4008('0x16')];this[_0x4008('0x17')]=getSeconds(_0x3a0f72[_0x4008('0x16')],_0x3a0f72[_0x4008('0x15')]);this['holdtime']=0x0;this[_0x4008('0x18')]=0x0;this[_0x4008('0x19')]=_0x3a0f72[_0x4008('0x19')];this[_0x4008('0x1a')]=_0x3a0f72['callbackuniqueid'];this[_0x4008('0x1b')]=_0x3a0f72[_0x4008('0x1b')];this[_0x4008('0x1c')]=_0x3a0f72[_0x4008('0x1c')];this[_0x4008('0x1d')]=_0x3a0f72[_0x4008('0x1d')];this[_0x4008('0x1e')]=_0x3a0f72[_0x4008('0x1e')];this[_0x4008('0x1f')]=_0x3a0f72[_0x4008('0x1f')];this['VoiceQueueId']=_0x3a0f72[_0x4008('0x20')];this[_0x4008('0x21')]=_0x3a0f72[_0x4008('0x21')];this[_0x4008('0x22')]=_0x3a0f72['originatecalleridnum']||'';this[_0x4008('0x23')]=_0x3a0f72[_0x4008('0x23')]||'';}module[_0x4008('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index d43aa62..e47f6c5 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 _0x5d60=['statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x5d60,0xf7));var _0x05d6=function(_0x43ab69,_0x528f47){_0x43ab69=_0x43ab69-0x0;var _0x5a5975=_0x5d60[_0x43ab69];return _0x5a5975;};'use strict';var util=require(_0x05d6('0x0'));var _=require(_0x05d6('0x1'));var moment=require('moment');function getSeconds(_0x297ef4,_0x455328){var _0x45c37e=moment(_0x297ef4)[_0x05d6('0x2')](0x0);var _0x3bb31d=moment(_0x455328)[_0x05d6('0x2')](0x0);return _0x45c37e[_0x05d6('0x3')](_0x3bb31d,_0x05d6('0x4'));}function AgentComplete(_0x224b6f,_0x45fb0b){this['state']=0x4;this[_0x05d6('0x5')]=_0x05d6('0x6');this[_0x05d6('0x7')]=_0x224b6f[_0x05d6('0x7')];this[_0x05d6('0x8')]=_0x224b6f[_0x05d6('0x8')];this[_0x05d6('0x9')]=_0x224b6f[_0x05d6('0x8')]===_0x05d6('0xa')?'queue':_0x224b6f[_0x05d6('0x8')];this[_0x05d6('0xb')]=_0x224b6f['countbusyretry'];this['countcongestionretry']=_0x224b6f['countcongestionretry'];this[_0x05d6('0xc')]=_0x224b6f[_0x05d6('0xc')];this[_0x05d6('0xd')]=_0x224b6f[_0x05d6('0xb')]+_0x224b6f['countcongestionretry']+_0x224b6f[_0x05d6('0xc')]+_0x224b6f[_0x05d6('0xe')]+_0x224b6f[_0x05d6('0xf')]+_0x224b6f[_0x05d6('0x10')]+_0x224b6f[_0x05d6('0x11')]+_0x224b6f[_0x05d6('0x12')];this[_0x05d6('0xe')]=_0x224b6f['countnosuchnumberretry'];this['countdropretry']=_0x224b6f[_0x05d6('0xf')];this[_0x05d6('0x10')]=_0x224b6f[_0x05d6('0x10')];this[_0x05d6('0x11')]=_0x224b6f['countmachineretry'];this['countagentrejectretry']=_0x224b6f[_0x05d6('0x12')];this[_0x05d6('0x13')]=_0x45fb0b['uniqueid'];this['calleridname']=_0x224b6f[_0x05d6('0x14')];this['calleridnum']=_0x224b6f['number'];this[_0x05d6('0x15')]=_0x224b6f['starttime'];this[_0x05d6('0x16')]=_0x224b6f['responsetime'];this[_0x05d6('0x17')]=_0x224b6f[_0x05d6('0x17')];this[_0x05d6('0x18')]=moment()['format'](_0x05d6('0x19'));this[_0x05d6('0x1a')]=getSeconds(_0x224b6f[_0x05d6('0x16')],_0x224b6f[_0x05d6('0x15')]);this['holdtime']=getSeconds(_0x224b6f[_0x05d6('0x17')],_0x224b6f[_0x05d6('0x16')]);this[_0x05d6('0x1b')]=getSeconds(this[_0x05d6('0x18')],_0x224b6f['answertime']);this[_0x05d6('0x1c')]=_0x45fb0b[_0x05d6('0x1c')];this[_0x05d6('0x1d')]=_0x45fb0b[_0x05d6('0x1d')];this['reason']=_0x45fb0b['reason'];this[_0x05d6('0x1e')]=_0x224b6f[_0x05d6('0x1e')];this[_0x05d6('0x1f')]=_0x224b6f[_0x05d6('0x1f')];this[_0x05d6('0x20')]=_0x224b6f[_0x05d6('0x20')];this[_0x05d6('0x21')]=_0x224b6f['recallme'];this[_0x05d6('0x22')]=_0x224b6f['ContactId'];this[_0x05d6('0x23')]=_0x224b6f[_0x05d6('0x23')];this['UserId']=_0x224b6f[_0x05d6('0x24')];this[_0x05d6('0x25')]=_0x224b6f[_0x05d6('0x25')];this[_0x05d6('0x26')]=_0x224b6f[_0x05d6('0x26')];this[_0x05d6('0x27')]=_0x224b6f[_0x05d6('0x27')]||'';this[_0x05d6('0x28')]=_0x224b6f[_0x05d6('0x28')]||'';}module[_0x05d6('0x29')]=AgentComplete; \ No newline at end of file +var _0x56f9=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x535c2b,_0x13368b){var _0x347f9d=function(_0x1c3b4d){while(--_0x1c3b4d){_0x535c2b['push'](_0x535c2b['shift']());}};_0x347f9d(++_0x13368b);}(_0x56f9,0x19c));var _0x956f=function(_0x12d362,_0x4d99d9){_0x12d362=_0x12d362-0x0;var _0x1153e4=_0x56f9[_0x12d362];return _0x1153e4;};'use strict';var util=require('util');var _=require(_0x956f('0x0'));var moment=require(_0x956f('0x1'));function getSeconds(_0x1fdd1d,_0x53bff5){var _0x2884d7=moment(_0x1fdd1d)[_0x956f('0x2')](0x0);var _0x372a00=moment(_0x53bff5)['milliseconds'](0x0);return _0x2884d7[_0x956f('0x3')](_0x372a00,'seconds');}function AgentComplete(_0x870d94,_0x429715){this[_0x956f('0x4')]=0x4;this[_0x956f('0x5')]=_0x956f('0x6');this[_0x956f('0x7')]=_0x870d94[_0x956f('0x7')];this['type']=_0x870d94['type'];this['campaigntype']=_0x870d94['type']===_0x956f('0x8')?_0x956f('0x9'):_0x870d94[_0x956f('0xa')];this[_0x956f('0xb')]=_0x870d94[_0x956f('0xb')];this['countcongestionretry']=_0x870d94[_0x956f('0xc')];this[_0x956f('0xd')]=_0x870d94[_0x956f('0xd')];this[_0x956f('0xe')]=_0x870d94[_0x956f('0xb')]+_0x870d94[_0x956f('0xc')]+_0x870d94[_0x956f('0xd')]+_0x870d94[_0x956f('0xf')]+_0x870d94[_0x956f('0x10')]+_0x870d94[_0x956f('0x11')]+_0x870d94['countmachineretry']+_0x870d94[_0x956f('0x12')];this[_0x956f('0xf')]=_0x870d94['countnosuchnumberretry'];this[_0x956f('0x10')]=_0x870d94[_0x956f('0x10')];this[_0x956f('0x11')]=_0x870d94[_0x956f('0x11')];this['countmachineretry']=_0x870d94[_0x956f('0x13')];this[_0x956f('0x12')]=_0x870d94[_0x956f('0x12')];this[_0x956f('0x14')]=_0x429715[_0x956f('0x14')];this[_0x956f('0x15')]=_0x870d94[_0x956f('0x16')];this[_0x956f('0x17')]=_0x870d94[_0x956f('0x18')];this['starttime']=_0x870d94[_0x956f('0x19')];this[_0x956f('0x1a')]=_0x870d94[_0x956f('0x1a')];this['answertime']=_0x870d94[_0x956f('0x1b')];this['endtime']=moment()['format'](_0x956f('0x1c'));this[_0x956f('0x1d')]=getSeconds(_0x870d94['responsetime'],_0x870d94[_0x956f('0x19')]);this[_0x956f('0x1e')]=getSeconds(_0x870d94[_0x956f('0x1b')],_0x870d94[_0x956f('0x1a')]);this[_0x956f('0x1f')]=getSeconds(this[_0x956f('0x20')],_0x870d94[_0x956f('0x1b')]);this['queue']=_0x429715[_0x956f('0x9')];this[_0x956f('0x21')]=_0x429715[_0x956f('0x21')];this[_0x956f('0x22')]=_0x429715[_0x956f('0x22')];this['callback']=_0x870d94[_0x956f('0x23')];this[_0x956f('0x24')]=_0x870d94[_0x956f('0x24')];this[_0x956f('0x25')]=_0x870d94[_0x956f('0x25')];this['recallme']=_0x870d94[_0x956f('0x26')];this[_0x956f('0x27')]=_0x870d94[_0x956f('0x27')];this[_0x956f('0x28')]=_0x870d94[_0x956f('0x28')];this[_0x956f('0x29')]=_0x870d94[_0x956f('0x29')];this[_0x956f('0x2a')]=_0x870d94[_0x956f('0x2a')];this[_0x956f('0x2b')]=_0x870d94['CampaignId'];this['originatecalleridnum']=_0x870d94['originatecalleridnum']||'';this['originatecalleridname']=_0x870d94['originatecalleridname']||'';}module[_0x956f('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 7d3d329..013cdc5 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 _0x5212=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x5052c8,_0x54d98d){var _0xaeb572=function(_0x1cb450){while(--_0x1cb450){_0x5052c8['push'](_0x5052c8['shift']());}};_0xaeb572(++_0x54d98d);}(_0x5212,0x1b0));var _0x2521=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5212[_0x2e4e19];return _0x9ba20b;};'use strict';var util=require(_0x2521('0x0'));var _=require(_0x2521('0x1'));var moment=require(_0x2521('0x2'));function getSeconds(_0x46a362,_0xc7f5e0){var _0x318471=moment(_0x46a362)[_0x2521('0x3')](0x0);var _0x18f11f=moment(_0xc7f5e0)[_0x2521('0x3')](0x0);return _0x318471['diff'](_0x18f11f,_0x2521('0x4'));}function Final(_0x3501cb){this[_0x2521('0x5')]=_0x3501cb[_0x2521('0x5')];this[_0x2521('0x6')]=_0x3501cb[_0x2521('0x6')];this[_0x2521('0x7')]=_0x3501cb[_0x2521('0x7')];this['campaigntype']=_0x3501cb[_0x2521('0x7')]===_0x2521('0x8')?_0x2521('0x9'):_0x3501cb[_0x2521('0x7')];this['countbusyretry']=_0x3501cb['countbusyretry'];this[_0x2521('0xa')]=_0x3501cb[_0x2521('0xa')];this[_0x2521('0xb')]=_0x3501cb[_0x2521('0xb')];this[_0x2521('0xc')]=_0x3501cb[_0x2521('0xd')]+_0x3501cb[_0x2521('0xa')]+_0x3501cb['countnoanswerretry']+_0x3501cb[_0x2521('0xe')]+_0x3501cb[_0x2521('0xf')]+_0x3501cb[_0x2521('0x10')]+_0x3501cb[_0x2521('0x11')]+_0x3501cb[_0x2521('0x12')];this[_0x2521('0xe')]=_0x3501cb[_0x2521('0xe')];this[_0x2521('0xf')]=_0x3501cb['countdropretry'];this[_0x2521('0x10')]=_0x3501cb[_0x2521('0x10')];this[_0x2521('0x11')]=_0x3501cb['countmachineretry'];this[_0x2521('0x12')]=_0x3501cb[_0x2521('0x12')];this[_0x2521('0x9')]=_0x3501cb[_0x2521('0x9')];this[_0x2521('0x13')]=_0x3501cb['calleridname'];this[_0x2521('0x14')]=_0x3501cb[_0x2521('0x14')];this[_0x2521('0x15')]=_0x3501cb[_0x2521('0x15')];this[_0x2521('0x16')]=_0x3501cb[_0x2521('0x16')];this[_0x2521('0x17')]=_0x3501cb[_0x2521('0x16')];this[_0x2521('0x18')]=_0x3501cb[_0x2521('0x18')]||0x0;this[_0x2521('0x19')]=_0x3501cb[_0x2521('0x19')]||0x0;this[_0x2521('0x1a')]=_0x3501cb[_0x2521('0x1a')]||0x0;this[_0x2521('0x1b')]=_0x3501cb[_0x2521('0x1b')];this[_0x2521('0x1c')]=_0x3501cb[_0x2521('0x1c')];this['callbackat']=_0x3501cb[_0x2521('0x1d')];this[_0x2521('0x1e')]=_0x3501cb[_0x2521('0x1e')];this[_0x2521('0x1f')]=_0x3501cb[_0x2521('0x1f')];this[_0x2521('0x20')]=_0x3501cb[_0x2521('0x20')];this[_0x2521('0x21')]=_0x3501cb[_0x2521('0x21')];this[_0x2521('0x22')]=_0x3501cb['VoiceQueueId'];this[_0x2521('0x23')]=_0x3501cb[_0x2521('0x23')];this[_0x2521('0x24')]=_0x3501cb[_0x2521('0x24')]||'';this[_0x2521('0x25')]=_0x3501cb[_0x2521('0x25')]||'';}module[_0x2521('0x26')]=Final; \ No newline at end of file +var _0x15ed=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x1a9d5a,_0x3161e8){var _0x59f53f=function(_0x5547c6){while(--_0x5547c6){_0x1a9d5a['push'](_0x1a9d5a['shift']());}};_0x59f53f(++_0x3161e8);}(_0x15ed,0xdb));var _0xd15e=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0x15ed[_0x3d2012];return _0x53d542;};'use strict';var util=require(_0xd15e('0x0'));var _=require(_0xd15e('0x1'));var moment=require(_0xd15e('0x2'));function getSeconds(_0x47183c,_0x1ac4d4){var _0x18528a=moment(_0x47183c)[_0xd15e('0x3')](0x0);var _0x124ba2=moment(_0x1ac4d4)[_0xd15e('0x3')](0x0);return _0x18528a[_0xd15e('0x4')](_0x124ba2,_0xd15e('0x5'));}function Final(_0x5d936e){this[_0xd15e('0x6')]=_0x5d936e[_0xd15e('0x6')];this[_0xd15e('0x7')]=_0x5d936e['scheduledat'];this['type']=_0x5d936e[_0xd15e('0x8')];this['campaigntype']=_0x5d936e['type']===_0xd15e('0x9')?_0xd15e('0xa'):_0x5d936e[_0xd15e('0x8')];this[_0xd15e('0xb')]=_0x5d936e['countbusyretry'];this[_0xd15e('0xc')]=_0x5d936e['countcongestionretry'];this['countnoanswerretry']=_0x5d936e[_0xd15e('0xd')];this[_0xd15e('0xe')]=_0x5d936e[_0xd15e('0xb')]+_0x5d936e[_0xd15e('0xc')]+_0x5d936e[_0xd15e('0xd')]+_0x5d936e[_0xd15e('0xf')]+_0x5d936e[_0xd15e('0x10')]+_0x5d936e[_0xd15e('0x11')]+_0x5d936e[_0xd15e('0x12')]+_0x5d936e['countagentrejectretry'];this[_0xd15e('0xf')]=_0x5d936e[_0xd15e('0xf')];this['countdropretry']=_0x5d936e[_0xd15e('0x10')];this[_0xd15e('0x11')]=_0x5d936e[_0xd15e('0x11')];this[_0xd15e('0x12')]=_0x5d936e[_0xd15e('0x12')];this[_0xd15e('0x13')]=_0x5d936e['countagentrejectretry'];this['queue']=_0x5d936e[_0xd15e('0xa')];this[_0xd15e('0x14')]=_0x5d936e[_0xd15e('0x14')];this['calleridnum']=_0x5d936e[_0xd15e('0x15')];this[_0xd15e('0x16')]=_0x5d936e[_0xd15e('0x16')];this[_0xd15e('0x17')]=_0x5d936e[_0xd15e('0x17')];this['endtime']=_0x5d936e[_0xd15e('0x17')];this[_0xd15e('0x18')]=_0x5d936e[_0xd15e('0x18')]||0x0;this[_0xd15e('0x19')]=_0x5d936e[_0xd15e('0x19')]||0x0;this['talktime']=_0x5d936e[_0xd15e('0x1a')]||0x0;this[_0xd15e('0x1b')]=_0x5d936e[_0xd15e('0x1b')];this[_0xd15e('0x1c')]=_0x5d936e['callbackuniqueid'];this[_0xd15e('0x1d')]=_0x5d936e['callbackat'];this[_0xd15e('0x1e')]=_0x5d936e['recallme'];this[_0xd15e('0x1f')]=_0x5d936e[_0xd15e('0x1f')];this['ListId']=_0x5d936e[_0xd15e('0x20')];this[_0xd15e('0x21')]=_0x5d936e['UserId'];this[_0xd15e('0x22')]=_0x5d936e['VoiceQueueId'];this[_0xd15e('0x23')]=_0x5d936e['CampaignId'];this['originatecalleridnum']=_0x5d936e[_0xd15e('0x24')]||'';this['originatecalleridname']=_0x5d936e['originatecalleridname']||'';}module[_0xd15e('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 6f471af..9a689f0 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 _0xad65=['VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x517c7d,_0x3af8b){var _0x3f64e8=function(_0x6dfe4d){while(--_0x6dfe4d){_0x517c7d['push'](_0x517c7d['shift']());}};_0x3f64e8(++_0x3af8b);}(_0xad65,0x87));var _0x5ad6=function(_0x5e2ffc,_0x167c1e){_0x5e2ffc=_0x5e2ffc-0x0;var _0x499d72=_0xad65[_0x5e2ffc];return _0x499d72;};'use strict';var util=require(_0x5ad6('0x0'));var _=require(_0x5ad6('0x1'));var moment=require(_0x5ad6('0x2'));function getSeconds(_0x3b5a97,_0x299562){var _0x3ed122=moment(_0x3b5a97)[_0x5ad6('0x3')](0x0);var _0x2d0d3a=moment(_0x299562)[_0x5ad6('0x3')](0x0);return _0x3ed122[_0x5ad6('0x4')](_0x2d0d3a,_0x5ad6('0x5'));}function Hangup(_0x561792,_0x2221ca){this[_0x5ad6('0x6')]=0x4;this['statedesc']=_0x5ad6('0x7');this['scheduledat']=_0x561792[_0x5ad6('0x8')];this[_0x5ad6('0x9')]=_0x561792[_0x5ad6('0x9')];this['campaigntype']=_0x561792[_0x5ad6('0x9')]===_0x5ad6('0xa')?_0x5ad6('0xb'):_0x561792[_0x5ad6('0x9')];this[_0x5ad6('0xc')]=_0x561792[_0x5ad6('0xc')];this[_0x5ad6('0xd')]=_0x561792[_0x5ad6('0xd')];this[_0x5ad6('0xe')]=_0x561792['countnoanswerretry'];this[_0x5ad6('0xf')]=_0x561792[_0x5ad6('0xc')]+_0x561792['countcongestionretry']+_0x561792['countnoanswerretry']+_0x561792['countnosuchnumberretry']+_0x561792[_0x5ad6('0x10')]+_0x561792[_0x5ad6('0x11')]+_0x561792[_0x5ad6('0x12')]+_0x561792[_0x5ad6('0x13')];this['countnosuchnumberretry']=_0x561792['countnosuchnumberretry'];this['countdropretry']=_0x561792[_0x5ad6('0x10')];this['countabandonedretry']=_0x561792[_0x5ad6('0x11')];this[_0x5ad6('0x12')]=_0x561792[_0x5ad6('0x12')];this[_0x5ad6('0x13')]=_0x561792[_0x5ad6('0x13')];this[_0x5ad6('0x14')]=_0x2221ca[_0x5ad6('0x14')];this[_0x5ad6('0x15')]=_0x561792['name'];this[_0x5ad6('0x16')]=_0x561792[_0x5ad6('0x17')];this[_0x5ad6('0x18')]=_0x561792[_0x5ad6('0x18')];this[_0x5ad6('0x19')]=_0x561792[_0x5ad6('0x19')];this[_0x5ad6('0x1a')]=moment()[_0x5ad6('0x1b')](_0x5ad6('0x1c'));this['ringtime']=getSeconds(_0x561792[_0x5ad6('0x19')],_0x561792[_0x5ad6('0x18')]);this[_0x5ad6('0x1d')]=0x0;this[_0x5ad6('0x1e')]=getSeconds(this[_0x5ad6('0x1a')],_0x561792[_0x5ad6('0x19')]);this['queue']=_0x561792['queue'];this['membername']=_0x5ad6('0x1f');this[_0x5ad6('0x20')]=_0x2221ca[_0x5ad6('0x21')];this['callback']=_0x561792[_0x5ad6('0x22')];this[_0x5ad6('0x23')]=_0x561792[_0x5ad6('0x23')];this[_0x5ad6('0x24')]=_0x561792['callbackat'];this[_0x5ad6('0x25')]=_0x561792[_0x5ad6('0x25')];this[_0x5ad6('0x26')]=_0x561792[_0x5ad6('0x26')];this[_0x5ad6('0x27')]=_0x561792[_0x5ad6('0x27')];this[_0x5ad6('0x28')]=_0x561792[_0x5ad6('0x28')];this['VoiceQueueId']=_0x561792[_0x5ad6('0x29')];this[_0x5ad6('0x2a')]=_0x561792[_0x5ad6('0x2a')];}module[_0x5ad6('0x2b')]=Hangup; \ No newline at end of file +var _0x2119=['milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2119,0x1a2));var _0x9211=function(_0xef9865,_0x1e82bc){_0xef9865=_0xef9865-0x0;var _0x57848=_0x2119[_0xef9865];return _0x57848;};'use strict';var util=require(_0x9211('0x0'));var _=require(_0x9211('0x1'));var moment=require('moment');function getSeconds(_0x2f5b0b,_0x4b30bf){var _0x5b2c34=moment(_0x2f5b0b)[_0x9211('0x2')](0x0);var _0x51ed58=moment(_0x4b30bf)['milliseconds'](0x0);return _0x5b2c34['diff'](_0x51ed58,'seconds');}function Hangup(_0x2ba6a7,_0x283ce0){this[_0x9211('0x3')]=0x4;this[_0x9211('0x4')]=_0x9211('0x5');this[_0x9211('0x6')]=_0x2ba6a7[_0x9211('0x6')];this[_0x9211('0x7')]=_0x2ba6a7['type'];this[_0x9211('0x8')]=_0x2ba6a7[_0x9211('0x7')]==='outbound'?_0x9211('0x9'):_0x2ba6a7[_0x9211('0x7')];this[_0x9211('0xa')]=_0x2ba6a7['countbusyretry'];this[_0x9211('0xb')]=_0x2ba6a7['countcongestionretry'];this[_0x9211('0xc')]=_0x2ba6a7[_0x9211('0xc')];this[_0x9211('0xd')]=_0x2ba6a7[_0x9211('0xa')]+_0x2ba6a7[_0x9211('0xb')]+_0x2ba6a7[_0x9211('0xc')]+_0x2ba6a7[_0x9211('0xe')]+_0x2ba6a7[_0x9211('0xf')]+_0x2ba6a7['countabandonedretry']+_0x2ba6a7[_0x9211('0x10')]+_0x2ba6a7[_0x9211('0x11')];this[_0x9211('0xe')]=_0x2ba6a7[_0x9211('0xe')];this[_0x9211('0xf')]=_0x2ba6a7[_0x9211('0xf')];this['countabandonedretry']=_0x2ba6a7['countabandonedretry'];this[_0x9211('0x10')]=_0x2ba6a7[_0x9211('0x10')];this[_0x9211('0x11')]=_0x2ba6a7[_0x9211('0x11')];this['uniqueid']=_0x283ce0[_0x9211('0x12')];this[_0x9211('0x13')]=_0x2ba6a7[_0x9211('0x14')];this[_0x9211('0x15')]=_0x2ba6a7[_0x9211('0x16')];this[_0x9211('0x17')]=_0x2ba6a7[_0x9211('0x17')];this[_0x9211('0x18')]=_0x2ba6a7[_0x9211('0x18')];this[_0x9211('0x19')]=moment()[_0x9211('0x1a')](_0x9211('0x1b'));this[_0x9211('0x1c')]=getSeconds(_0x2ba6a7[_0x9211('0x18')],_0x2ba6a7['starttime']);this[_0x9211('0x1d')]=0x0;this[_0x9211('0x1e')]=getSeconds(this[_0x9211('0x19')],_0x2ba6a7[_0x9211('0x18')]);this['queue']=_0x2ba6a7[_0x9211('0x9')];this['membername']=_0x9211('0x1f');this['reason']=_0x283ce0[_0x9211('0x20')];this[_0x9211('0x21')]=_0x2ba6a7[_0x9211('0x21')];this[_0x9211('0x22')]=_0x2ba6a7['callbackuniqueid'];this['callbackat']=_0x2ba6a7[_0x9211('0x23')];this[_0x9211('0x24')]=_0x2ba6a7[_0x9211('0x24')];this[_0x9211('0x25')]=_0x2ba6a7[_0x9211('0x25')];this['ListId']=_0x2ba6a7['ListId'];this[_0x9211('0x26')]=_0x2ba6a7[_0x9211('0x26')];this[_0x9211('0x27')]=_0x2ba6a7['VoiceQueueId'];this[_0x9211('0x28')]=_0x2ba6a7[_0x9211('0x28')];}module[_0x9211('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index fee6606..ce37afa 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 _0x0dd9=['util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dd9,0x78));var _0x90dd=function(_0x44424a,_0x47a34f){_0x44424a=_0x44424a-0x0;var _0x173e65=_0x0dd9[_0x44424a];return _0x173e65;};'use strict';var util=require(_0x90dd('0x0'));var _=require(_0x90dd('0x1'));var moment=require('moment');function getSeconds(_0x4afbda,_0x3da182){var _0x4381dc=moment(_0x4afbda)[_0x90dd('0x2')](0x0);var _0x4dd1e5=moment(_0x3da182)[_0x90dd('0x2')](0x0);return _0x4381dc['diff'](_0x4dd1e5,_0x90dd('0x3'));}function History(_0x452506){this[_0x90dd('0x4')]=_0x452506[_0x90dd('0x4')];this[_0x90dd('0x5')]=_0x452506['scheduledat']||undefined;this[_0x90dd('0x6')]=_0x452506[_0x90dd('0x6')];this[_0x90dd('0x7')]=_0x452506[_0x90dd('0x6')]===_0x90dd('0x8')?_0x90dd('0x9'):_0x452506[_0x90dd('0x6')];this[_0x90dd('0xa')]=_0x452506[_0x90dd('0xa')];this[_0x90dd('0xb')]=_0x452506[_0x90dd('0xb')];this[_0x90dd('0xc')]=_0x452506['countnoanswerretry'];this[_0x90dd('0xd')]=_0x452506[_0x90dd('0xa')]+_0x452506[_0x90dd('0xb')]+_0x452506[_0x90dd('0xc')]+_0x452506[_0x90dd('0xe')]+_0x452506[_0x90dd('0xf')]+_0x452506['countabandonedretry']+_0x452506[_0x90dd('0x10')]+_0x452506[_0x90dd('0x11')];this[_0x90dd('0xe')]=_0x452506[_0x90dd('0xe')];this['countdropretry']=_0x452506[_0x90dd('0xf')];this['countabandonedretry']=_0x452506[_0x90dd('0x12')];this[_0x90dd('0x10')]=_0x452506[_0x90dd('0x10')];this[_0x90dd('0x11')]=_0x452506['countagentrejectretry'];this[_0x90dd('0x9')]=_0x452506[_0x90dd('0x9')];this[_0x90dd('0x13')]=_0x452506['name'];this[_0x90dd('0x14')]=_0x452506[_0x90dd('0x15')];this['starttime']=_0x452506[_0x90dd('0x16')];this[_0x90dd('0x17')]=_0x452506[_0x90dd('0x17')];this[_0x90dd('0x18')]=_0x452506[_0x90dd('0x17')];this[_0x90dd('0x19')]=getSeconds(_0x452506[_0x90dd('0x17')],_0x452506[_0x90dd('0x16')]);this[_0x90dd('0x1a')]=0x0;this[_0x90dd('0x1b')]=0x0;this[_0x90dd('0x1c')]=_0x452506[_0x90dd('0x1c')];this[_0x90dd('0x1d')]=_0x452506['callbackuniqueid'];this[_0x90dd('0x1e')]=_0x452506[_0x90dd('0x1e')];this[_0x90dd('0x1f')]=_0x452506[_0x90dd('0x1f')];this[_0x90dd('0x20')]=_0x452506[_0x90dd('0x20')];this[_0x90dd('0x21')]=_0x452506[_0x90dd('0x21')];this[_0x90dd('0x22')]=_0x452506[_0x90dd('0x22')];this[_0x90dd('0x23')]=_0x452506[_0x90dd('0x23')];this[_0x90dd('0x24')]=_0x452506['CampaignId'];this[_0x90dd('0x25')]=_0x452506[_0x90dd('0x25')]||'';this[_0x90dd('0x26')]=_0x452506['originatecalleridname']||'';}module[_0x90dd('0x27')]=History; \ No newline at end of file +var _0xb770=['name','number','starttime','responsetime','ringtime','talktime','callback','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname'];(function(_0x63bc3e,_0x2aeead){var _0x5063fa=function(_0x579d6){while(--_0x579d6){_0x63bc3e['push'](_0x63bc3e['shift']());}};_0x5063fa(++_0x2aeead);}(_0xb770,0x191));var _0x0b77=function(_0x379f6f,_0x467d99){_0x379f6f=_0x379f6f-0x0;var _0x240bc8=_0xb770[_0x379f6f];return _0x240bc8;};'use strict';var util=require(_0x0b77('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0xd44d4f,_0x7564bf){var _0x1dc3d5=moment(_0xd44d4f)[_0x0b77('0x1')](0x0);var _0x40b44e=moment(_0x7564bf)['milliseconds'](0x0);return _0x1dc3d5[_0x0b77('0x2')](_0x40b44e,_0x0b77('0x3'));}function History(_0x39c49b){this[_0x0b77('0x4')]=_0x39c49b['uniqueid'];this['scheduledat']=_0x39c49b['scheduledat']||undefined;this[_0x0b77('0x5')]=_0x39c49b[_0x0b77('0x5')];this[_0x0b77('0x6')]=_0x39c49b['type']===_0x0b77('0x7')?_0x0b77('0x8'):_0x39c49b[_0x0b77('0x5')];this['countbusyretry']=_0x39c49b['countbusyretry'];this[_0x0b77('0x9')]=_0x39c49b[_0x0b77('0x9')];this[_0x0b77('0xa')]=_0x39c49b['countnoanswerretry'];this[_0x0b77('0xb')]=_0x39c49b[_0x0b77('0xc')]+_0x39c49b[_0x0b77('0x9')]+_0x39c49b[_0x0b77('0xa')]+_0x39c49b[_0x0b77('0xd')]+_0x39c49b[_0x0b77('0xe')]+_0x39c49b[_0x0b77('0xf')]+_0x39c49b[_0x0b77('0x10')]+_0x39c49b['countagentrejectretry'];this[_0x0b77('0xd')]=_0x39c49b[_0x0b77('0xd')];this['countdropretry']=_0x39c49b[_0x0b77('0xe')];this['countabandonedretry']=_0x39c49b[_0x0b77('0xf')];this[_0x0b77('0x10')]=_0x39c49b[_0x0b77('0x10')];this[_0x0b77('0x11')]=_0x39c49b['countagentrejectretry'];this[_0x0b77('0x8')]=_0x39c49b[_0x0b77('0x8')];this[_0x0b77('0x12')]=_0x39c49b[_0x0b77('0x13')];this['calleridnum']=_0x39c49b[_0x0b77('0x14')];this[_0x0b77('0x15')]=_0x39c49b[_0x0b77('0x15')];this[_0x0b77('0x16')]=_0x39c49b[_0x0b77('0x16')];this['endtime']=_0x39c49b['responsetime'];this[_0x0b77('0x17')]=getSeconds(_0x39c49b[_0x0b77('0x16')],_0x39c49b[_0x0b77('0x15')]);this['holdtime']=0x0;this[_0x0b77('0x18')]=0x0;this[_0x0b77('0x19')]=_0x39c49b[_0x0b77('0x19')];this['callbackuniqueid']=_0x39c49b['callbackuniqueid'];this['callbackat']=_0x39c49b[_0x0b77('0x1a')];this[_0x0b77('0x1b')]=_0x39c49b['recallme'];this[_0x0b77('0x1c')]=_0x39c49b[_0x0b77('0x1c')];this['ListId']=_0x39c49b['ListId'];this[_0x0b77('0x1d')]=_0x39c49b[_0x0b77('0x1d')];this[_0x0b77('0x1e')]=_0x39c49b[_0x0b77('0x1e')];this[_0x0b77('0x1f')]=_0x39c49b[_0x0b77('0x1f')];this[_0x0b77('0x20')]=_0x39c49b['originatecalleridnum']||'';this[_0x0b77('0x21')]=_0x39c49b[_0x0b77('0x21')]||'';}module[_0x0b77('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 4d57d72..7b415e9 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 _0x8563=['isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','uniqueid','statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[syncHangupInAMDIvr]','countabandonedretry','stateGlobal','add','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','agiafterat','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','length','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','Queue','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','Predictive\x20after\x20first\x20interval','getDataPredictive','startMethodPredictive','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]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkIsBlackListIvr','Contact.phone','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','reachable','dialOrderByScheduledAt','[countReScheduled]\x20','RUNNING','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','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','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','voice_queue:save','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','[uniqueid]','clearZombieChannels','prototype','undefined','Action','status','channel','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','catch','checkIsBlackList','then','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8563,0x138));var _0x3856=function(_0x52ea2e,_0x5b7160){_0x52ea2e=_0x52ea2e-0x0;var _0x188189=_0x8563[_0x52ea2e];return _0x188189;};'use strict';var util=require(_0x3856('0x0'));var _=require('lodash');var BPromise=require(_0x3856('0x1'));var uuid=require(_0x3856('0x2'));var moment=require(_0x3856('0x3'));var rr=require('rr');var md5=require(_0x3856('0x4'));var Redis=require(_0x3856('0x5'));var ut=require('../preview/util/util');var config=require(_0x3856('0x6'));var logger=require(_0x3856('0x7'))(_0x3856('0x8'));var loggerBooked=require(_0x3856('0x7'))(_0x3856('0x9'));var loggerPredictive=require(_0x3856('0x7'))(_0x3856('0xa'));var loggerPredictiveCalls=require(_0x3856('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x3856('0x7'))(_0x3856('0xb'));var ami=require(_0x3856('0xc'));config[_0x3856('0xd')]=_[_0x3856('0xe')](config[_0x3856('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3856('0xd')]));var cmHopper=require(_0x3856('0xf'));var cmHopperHistory=require(_0x3856('0x10'));var cmHopperBlack=require(_0x3856('0x11'));var voiceQueueRt=require(_0x3856('0x12'));var Action=require(_0x3856('0x13'));var History=require(_0x3856('0x14'));var Final=require(_0x3856('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x3856('0x16'));var Hangup=require('./hangup');var ipAgi=process['env'][_0x3856('0x17')]||'127.0.0.1';var strategy={'rrmemory':_0x3856('0x18'),'roundrobin':_0x3856('0x19')};var Sequence=function(){};Sequence['prototype'][_0x3856('0x1a')]=function(_0x10547e){this['tail']=this['tail']?this['tail'][_0x3856('0x1b')](_0x10547e):_0x10547e();};function Dialer(_0x32ffe8,_0x392921){this[_0x3856('0x1c')]=new Sequence();this[_0x3856('0x1d')]=_0x392921;this[_0x3856('0x1e')]=_0x32ffe8[_0x3856('0x1e')];this[_0x3856('0x1f')]=_0x32ffe8[_0x3856('0x1f')];this[_0x3856('0x20')]=_0x32ffe8[_0x3856('0x20')];this['trunks']=_0x32ffe8[_0x3856('0x21')];this[_0x3856('0x22')]=config['maxNumberOriginate']||0x2;this[_0x3856('0x23')]={};this[_0x3856('0x24')]={};this[_0x3856('0x25')]={};this[_0x3856('0x26')]={};this['optionPredictive']={};this[_0x3856('0x27')]={};this[_0x3856('0x28')]={};this[_0x3856('0x29')]={};this[_0x3856('0x2a')]={};this[_0x3856('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x3856('0x2c')](this));ami['on'](_0x3856('0x2d'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x3856('0x2e')][_0x3856('0x2c')](this));ami['on'](_0x3856('0x2f'),this[_0x3856('0x30')][_0x3856('0x2c')](this));ami['on'](_0x3856('0x31'),this[_0x3856('0xb')][_0x3856('0x2c')](this));ami['on']('hangup',this[_0x3856('0x32')]['bind'](this));ami['on'](_0x3856('0x33'),this['syncNewExten']['bind'](this));ami['on'](_0x3856('0x34'),this['syncVarSet'][_0x3856('0x2c')](this));ami['on']('queuemember',this[_0x3856('0x35')][_0x3856('0x2c')](this));ami['on'](_0x3856('0x36'),this[_0x3856('0x37')][_0x3856('0x2c')](this));this[_0x3856('0x38')]();this[_0x3856('0x39')]();}function isNotNull(_0xbbf624){return _0xbbf624!==null&&!_[_0x3856('0x3a')](_0xbbf624);}function checkIsLoggedIn(_0x1e0e26,_0x4467d5){return function(){if(_0x4467d5<=0x0){_0x1e0e26[_0x3856('0x3b')]=_0x3856('0x3c');throw _0x1e0e26[_0x3856('0x3d')]+_0x3856('0x3e');}};}function isActive(_0x243c49){return _0x243c49;}function checkIsActive(_0x2dc1b0,_0x162ce4){return function(){if(!isActive(_0x162ce4)){_0x2dc1b0['message']=_0x3856('0x3f');throw _0x2dc1b0[_0x3856('0x3d')]+_0x3856('0x40');}};}function checkInterval(_0x26b7a2){return function(){if(!isNotNull(_0x26b7a2[_0x3856('0x41')])){_0x26b7a2[_0x3856('0x3b')]=_0x3856('0x42');throw _0x26b7a2[_0x3856('0x3d')]+_0x3856('0x43');}if(!isNotNull(_0x26b7a2[_0x3856('0x41')][_0x3856('0x44')])){_0x26b7a2[_0x3856('0x3b')]=_0x3856('0x42');throw _0x26b7a2['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x3856('0x45')](_0x26b7a2[_0x3856('0x41')][_0x3856('0x44')]))){_0x26b7a2[_0x3856('0x3b')]=_0x3856('0x42');throw _0x26b7a2[_0x3856('0x3d')]+_0x3856('0x43');}};}function msgResponse(_0x6d05c3,_0x586b06,_0x3c2546){return{'action':_0x6d05c3,'response':_0x586b06,'message':_0x3c2546,'stack':_0x3c2546};}function myreject(_0x26544b){return function(_0x24262d){return _0x26544b(msgResponse(_0x3856('0x46'),_0x3856('0x47'),JSON[_0x3856('0x48')](_0x24262d)));};}function getSeconds(_0x5381a9,_0x181090){var _0xca08f3=moment(_0x5381a9)['milliseconds'](0x0);var _0x51114c=moment(_0x181090)[_0x3856('0x49')](0x0);return _0xca08f3[_0x3856('0x4a')](_0x51114c,'seconds');}function emit(_0x4d2881,_0x25846b,_0x2af329){io['to'](_0x4d2881)['emit'](_0x25846b,_0x2af329);}function emitVoiceQueueSummary(_0x238aac){if(_0x238aac[_0x3856('0x4b')]===_0x3856('0x4c')){var _0xd45d7b={'id':_0x238aac['id'],'name':_0x238aac['name'],'strategy':_0x238aac[_0x3856('0x4d')],'answered':_0x238aac[_0x3856('0x4e')],'available':_0x238aac['available'],'loggedIn':_0x238aac[_0x3856('0x4f')],'pTalking':_0x238aac[_0x3856('0x50')],'sumBillable':_0x238aac['sumBillable'],'sumDuration':_0x238aac[_0x3856('0x51')],'sumHoldTime':_0x238aac[_0x3856('0x52')]||0x0,'talking':_0x238aac[_0x3856('0x53')],'total':_0x238aac[_0x3856('0x54')],'type':_0x238aac[_0x3856('0x4b')],'unmanaged':_0x238aac['unmanaged'],'abandoned':_0x238aac['abandoned'],'waiting':_0x238aac[_0x3856('0x55')],'loggedInDb':_0x238aac[_0x3856('0x56')],'dialActive':_0x238aac[_0x3856('0x57')],'dialMethod':_0x238aac[_0x3856('0x58')],'dialOriginateCallerIdName':_0x238aac[_0x3856('0x59')],'dialOriginateCallerIdNumber':_0x238aac[_0x3856('0x5a')],'dialOriginateTimeout':_0x238aac['dialOriginateTimeout'],'dialPrefix':_0x238aac[_0x3856('0x5b')],'outboundAnswerAgiCallsDay':_0x238aac[_0x3856('0x5c')],'outboundAnswerCallsDay':_0x238aac[_0x3856('0x5d')],'outboundBlacklistCallsDay':_0x238aac['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x238aac[_0x3856('0x5e')],'outboundCongestionCallsDay':_0x238aac['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x238aac[_0x3856('0x5f')],'outboundDropCallsDayCallersExit':_0x238aac[_0x3856('0x60')],'outboundDropCallsDayTimeout':_0x238aac[_0x3856('0x61')],'outboundNoAnswerCallsDay':_0x238aac[_0x3856('0x62')],'outboundNoSuchCallsDay':_0x238aac['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x238aac[_0x3856('0x63')],'outboundReCallsDay':_0x238aac[_0x3856('0x64')],'outboundRejectCallsDay':_0x238aac[_0x3856('0x65')],'outboundUnknownCallsDay':_0x238aac[_0x3856('0x66')],'predictiveIntervalAnsweredCalls':_0x238aac['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x238aac[_0x3856('0x67')],'predictiveIntervalAvgTalktime':_0x238aac[_0x3856('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x238aac[_0x3856('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x238aac['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x238aac[_0x3856('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x238aac['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x238aac[_0x3856('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x238aac[_0x3856('0x6c')],'predictiveIntervalPauses':_0x238aac[_0x3856('0x6d')],'predictiveIntervalAvailable':_0x238aac[_0x3856('0x6e')],'predictiveIntervalTotalCalls':_0x238aac[_0x3856('0x6f')],'message':_0x238aac[_0x3856('0x3b')],'originated':_0x238aac[_0x3856('0x70')],'erlangCalls':_0x238aac['erlangCalls'],'erlangCallToSecond':_0x238aac[_0x3856('0x71')],'erlangAbandonmentRate':_0x238aac[_0x3856('0x72')],'erlangBusyFactor':_0x238aac['erlangBusyFactor'],'startPredictive':_0x238aac[_0x3856('0x27')],'startProgressive':_0x238aac[_0x3856('0x28')]};if(_0x238aac['Trunk']){_0xd45d7b['Trunk']={'id':_0x238aac[_0x3856('0x73')]['id'],'name':_0x238aac['Trunk'][_0x3856('0x3d')],'active':_0x238aac[_0x3856('0x73')][_0x3856('0x74')],'callerid':_0x238aac['Trunk'][_0x3856('0x75')]};}if(_0x238aac[_0x3856('0x41')]){_0xd45d7b['Interval']={'id':_0x238aac[_0x3856('0x41')]['id'],'name':_0x238aac[_0x3856('0x41')]['name']};}var _0x1ccd4a=md5(JSON['stringify'](_0xd45d7b));if(_0x238aac[_0x3856('0x4')]!==_0x1ccd4a){_0x238aac[_0x3856('0x4')]=_0x1ccd4a;emit(util['format']('voice:queue:%s',_0xd45d7b[_0x3856('0x3d')]),_0x3856('0x76'),_0xd45d7b);}}}function emitCampaignSummary(_0x42cf68){if(_0x42cf68[_0x3856('0x4b')]==='ivr'){emit(util[_0x3856('0x77')](_0x3856('0x78'),_0x42cf68[_0x3856('0x3d')]),_0x3856('0x79'),_0x42cf68);}}function checkGetDataPredictive(_0x43c231){if(isNotNull(_0x43c231)&&!_[_0x3856('0x45')](_0x43c231)){loggerPredictive[_0x3856('0x7a')](_0x3856('0x7b'));loggerPredictive[_0x3856('0x7a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43c231[_0x3856('0x6f')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43c231[_0x3856('0x7c')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43c231['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x7d'),_0x43c231['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x7e'),_0x43c231[_0x3856('0x67')]);loggerPredictive[_0x3856('0x7a')](_0x3856('0x7f'),_0x43c231['predictiveIntervalAvgTalktime']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x80'));if(_0x43c231[_0x3856('0x6f')]>0x0){if(!_['isUndefined'](_0x43c231[_0x3856('0x68')])&&_0x43c231[_0x3856('0x68')]>0x0){return!![];}loggerPredictive[_0x3856('0x7a')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x3856('0x3a')](_0x43c231[_0x3856('0x67')])&&_0x43c231[_0x3856('0x67')]>0x0){return!![];}loggerPredictive[_0x3856('0x7a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x3856('0x81'));}}else{loggerPredictive[_0x3856('0x7a')](_0x3856('0x82'));}return![];}function mergeDataErlangB(_0x1d6cf0){return function(_0xca2d98){loggerPredictive[_0x3856('0x7a')](_0x3856('0x83'));loggerPredictive[_0x3856('0x7a')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xca2d98[_0x3856('0x84')]);loggerPredictive[_0x3856('0x7a')](_0x3856('0x85'),_0xca2d98['erlangCallToSecond']);loggerPredictive[_0x3856('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xca2d98[_0x3856('0x72')]);loggerPredictive[_0x3856('0x7a')](_0x3856('0x86'),_0xca2d98['erlangBusyFactor']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x87'),_0xca2d98[_0x3856('0x72')]);loggerPredictive['info'](_0x3856('0x80'));_[_0x3856('0x88')](_0x1d6cf0,_0xca2d98);};}function getDiff(_0x5ca49d){var _0x53bcbd=moment()[_0x3856('0x49')](0x0);var _0x48d0c3=moment(_0x5ca49d)['milliseconds'](0x0);return _0x53bcbd[_0x3856('0x4a')](_0x48d0c3,'seconds');}function ifInterval(_0x4ec083,_0x55f321){if(_[_0x3856('0x3a')](_0x55f321)){return![];}return getDiff(_0x55f321)<_0x4ec083*0x3c;}function freeVariablesPredictive(_0x394a36){if(isNotNull(_0x394a36)){if(!_[_0x3856('0x3a')](_0x394a36['startProgressive'])){_0x394a36['startProgressive']=undefined;loggerPredictive['info'](_0x394a36[_0x3856('0x3d')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x3856('0x3a')](_0x394a36[_0x3856('0x27')])){_0x394a36[_0x3856('0x27')]=undefined;loggerPredictive[_0x3856('0x7a')](_0x394a36[_0x3856('0x3d')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x394a36[_0x3856('0x89')])){clearInterval(_0x394a36[_0x3856('0x89')]);_0x394a36[_0x3856('0x89')]=undefined;loggerPredictive[_0x3856('0x7a')](_0x394a36[_0x3856('0x3d')],_0x3856('0x8a'));}}}function erlangb(_0x167db3,_0x343385){if(_0x343385===0x0){return 0x0;}var _0x104b60=0x1;for(var _0x4ae10b=0x1;_0x4ae10b<=_0x343385;_0x4ae10b+=0x1){_0x104b60=0x1+_0x104b60*_0x4ae10b/_0x167db3;}return 0x1/_0x104b60;}function isVoiceQueueOutbound(_0x1b141e){return _0x1b141e===_0x3856('0x4c');}function isNotPreview(_0x29f9d7){return _0x29f9d7!==_0x3856('0x1d');}function isCampaignIvr(_0x5ef101){return _0x5ef101==='ivr';}function getCallerId(_0x1dc4c,_0x27e5dd,_0x2a0d30){if(!_[_0x3856('0x3a')](_0x2a0d30)&&typeof _0x2a0d30===_0x3856('0x8b')&&!_[_0x3856('0x45')](_0x2a0d30)){if(!_['isUndefined'](_0x27e5dd)&&typeof _0x27e5dd===_0x3856('0x8b')&&!_[_0x3856('0x45')](_0x27e5dd)){return util[_0x3856('0x77')](_0x3856('0x8c'),_0x27e5dd,_0x2a0d30);}return util[_0x3856('0x77')](_0x3856('0x8c'),_0x2a0d30,_0x2a0d30);}if(!_[_0x3856('0x3a')](_0x1dc4c)&&typeof _0x1dc4c===_0x3856('0x8b')&&!_[_0x3856('0x45')](_0x1dc4c)){return _0x1dc4c;}return _0x3856('0x8d');}function loggerCatchQueueSummary(_0x48a3cc,_0x5e8b61){return function(_0x2e8c44){freeVariablesPredictive(_0x5e8b61);emitVoiceQueueSummary(_0x5e8b61);emitCampaignSummary(_0x5e8b61);loggerSyncQueueSummary['error'](_0x48a3cc,util['inspect'](_0x2e8c44,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2ddb5d,_0xb0fd3){return function(_0x15ceb7){loggerPredictive['error'](_0xb0fd3[_0x3856('0x3d')],_0x2ddb5d);loggerPredictive[_0x3856('0x8e')](_0x15ceb7['stack']);freeVariablesPredictive(_0xb0fd3);};}function loggerCatch(_0x499749){return function(_0x59d330){logger[_0x3856('0x8e')](_0x499749,util[_0x3856('0x8f')](_0x59d330,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x355afb){return _0x355afb&&!_[_0x3856('0x3a')](_0x355afb)&&_0x355afb['length']>0x0;}function decremetOriginate(_0x37f6f5){if(!_[_0x3856('0x3a')](_0x37f6f5)&&_0x37f6f5!==null){if(typeof _0x37f6f5[_0x3856('0x70')]!=='undefined'){if(_0x37f6f5['originated']>0x0){_0x37f6f5[_0x3856('0x70')]-=0x1;}else{logger['error'](_0x3856('0x90'));}}}else{logger['error'](_0x3856('0x91'));}}function checkContactLowerLimitOriginate(_0xe743a3,_0x3f354a,_0x3a8145){if(_0x3f354a>_0x3a8145){for(var _0x515595=0x0;_0x515595<_0x3f354a-_0x3a8145;_0x515595+=0x1){decremetOriginate(_0xe743a3);}}}function loggerGetContactDialer(_0x119cd1,_0x29c454,_0x30c88f){return function(_0x5e2744){checkContactLowerLimitOriginate(_0x29c454,_0x30c88f,0x0);logger[_0x3856('0x8e')](_0x119cd1,util[_0x3856('0x8f')](_0x5e2744,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x44299b){return function(_0x132ce7){if(isNotNull(_0x132ce7)&&isNotNull(_0x132ce7[0x0])){if(_0x132ce7[0x0][_0x3856('0x92')]>0x0){_0x44299b[_0x3856('0x3b')]=_0x3856('0x93');logger[_0x3856('0x7a')](_0x3856('0x94')+_0x44299b[_0x3856('0x3d')],_0x132ce7[0x0][_0x3856('0x92')],_0x3856('0x95'));}else{_0x44299b['message']=_0x3856('0x96');logger[_0x3856('0x7a')]('[getContactDialer2][Empty]'+_0x44299b[_0x3856('0x3d')]);}}};}function notSendMessagesQueue(_0x298924){if(_0x298924[_0x3856('0x97')]){freeVariablesPredictive(_0x298924);if(_0x298924[_0x3856('0x70')]===0x0&&_0x298924[_0x3856('0x53')]===0x0&&_0x298924[_0x3856('0x55')]===0x0&&(_0x298924['pTalking']||0x0)===0x0){_0x298924[_0x3856('0x97')]=![];_0x298924[_0x3856('0x98')]=0x0;_0x298924[_0x3856('0x3b')]=_0x3856('0x3f');loggerSyncQueueSummary[_0x3856('0x8e')](_0x3856('0x99'),_0x298924[_0x3856('0x3d')],_0x3856('0x9a'));}else{_0x298924[_0x3856('0x3b')]=_0x3856('0x9b');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x298924[_0x3856('0x3d')],'is\x20disactive');}emitVoiceQueueSummary(_0x298924);}}function notSendMessagesCampaign(_0x345249){if(_0x345249['sendMessageOneNotActive']){if(_0x345249['originated']===0x0){_0x345249[_0x3856('0x97')]=![];_0x345249['message']=_0x3856('0x3f');loggerSyncQueueSummary[_0x3856('0x8e')](_0x3856('0x9c'),_0x345249['name'],'is\x20not\x20active');}else{_0x345249['message']=_0x3856('0x9b');loggerSyncQueueSummary[_0x3856('0x8e')](_0x3856('0x9c'),_0x345249[_0x3856('0x3d')],_0x3856('0x9d'));}emitCampaignSummary(_0x345249);}}function createObjHistory(_0x39fac8,_0x1b2f89,_0x918cfb,_0x261a63,_0x3ac85b){_0x39fac8[_0x3856('0x3b')]=_0x918cfb;var _0x5d2024=new Action(_0x39fac8,_0x1b2f89);var _0xe89038=new History(_0x5d2024);_0xe89038[_0x3856('0x9e')]=_0x261a63;_0xe89038['statedesc']=_0x3ac85b;_0xe89038['endtime']=_0x5d2024['starttime'];return _0xe89038;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x50168a=this;setInterval(function(){_0x50168a['clearZombieChannels'](_0x50168a[_0x3856('0x26')],_0x3856('0x9f'));_0x50168a[_0x3856('0xa0')](_0x50168a[_0x3856('0x24')],'[actions]');},0x32c8);};Dialer[_0x3856('0xa1')]['clearZombieChannels']=function(_0x45df67,_0x3a512d){var _0x18dc83=this;for(var _0x1b81c2 in _0x45df67){if(typeof _0x45df67[_0x1b81c2]!==_0x3856('0xa2')){this[_0x3856('0x1c')][_0x3856('0x1a')](function(){if(!_['isNil'](_0x45df67[_0x1b81c2])){return ami[_0x3856('0xa3')]({'action':_0x3856('0xa4'),'channel':_0x45df67[_0x1b81c2][_0x3856('0xa5')]})['catch'](function(_0x335085){if(_0x335085['message']===_0x3856('0xa6')){setTimeout(function(){if(_0x45df67[_0x1b81c2]&&_0x45df67[_0x1b81c2]['type']!==_0x3856('0xa7')){_0x18dc83[_0x3856('0xa8')](_0x18dc83[_0x3856('0x1e')][_0x45df67[_0x1b81c2][_0x3856('0xa9')]]);logger['error'](_0x3856('0xaa'),_0x3a512d,_0x1b81c2,_0x45df67[_0x1b81c2][_0x3856('0xa9')]);delete _0x45df67[_0x1b81c2];}if(_0x45df67[_0x1b81c2]&&_0x45df67[_0x1b81c2][_0x3856('0x4b')]===_0x3856('0xa7')){_0x18dc83[_0x3856('0xa8')](_0x18dc83[_0x3856('0x1f')][_0x45df67[_0x1b81c2][_0x3856('0xa9')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x3a512d,_0x1b81c2,_0x45df67[_0x1b81c2][_0x3856('0xa9')]);delete _0x45df67[_0x1b81c2];}},0x2328);}});}});}}};Dialer['prototype'][_0x3856('0xab')]=function(_0x286801){return BPromise[_0x3856('0xac')]()['then'](cmHopper['countReScheduled'](_0x286801))[_0x3856('0xad')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x3856('0xa1')][_0x3856('0xae')]=function(_0x3108ca){return BPromise['resolve']()[_0x3856('0xaf')](cmHopperBlack[_0x3856('0xae')](_0x3108ca))[_0x3856('0xad')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x3856('0xa1')]['checkIsBlackListIvr']=function(_0x2fef3f){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](cmHopperBlack['checkIsBlackListIvr'](_0x2fef3f))[_0x3856('0xad')](loggerCatch(_0x3856('0xb0')));};Dialer[_0x3856('0xa1')][_0x3856('0xb1')]=function(_0x44f24a){return BPromise[_0x3856('0xac')]()['then'](cmHopperHistory[_0x3856('0xb2')](_0x44f24a))[_0x3856('0xad')](loggerCatch(_0x3856('0xb3')));};Dialer[_0x3856('0xa1')][_0x3856('0xb4')]=function(_0x504340){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](cmHopper['rescheduleContact'](_0x504340))[_0x3856('0xad')](loggerCatch(_0x3856('0xb5')));};Dialer[_0x3856('0xa1')]['unlockContact']=function(_0x416e4c,_0x406992,_0x3f77e4){return BPromise['resolve']()[_0x3856('0xaf')](cmHopper[_0x3856('0xb6')](_0x416e4c,_0x406992,_0x3f77e4))[_0x3856('0xad')](loggerCatch(_0x3856('0xb7')));};Dialer[_0x3856('0xa1')][_0x3856('0xb8')]=function(_0x22b593,_0x343b8c,_0x5893f1,_0x1039ca){return BPromise[_0x3856('0xac')]()['then'](cmHopper[_0x3856('0xb8')](_0x22b593,_0x343b8c,_0x5893f1,_0x1039ca))[_0x3856('0xad')](loggerCatch(_0x3856('0xb9')));};Dialer[_0x3856('0xa1')][_0x3856('0xba')]=function(_0x35a6be,_0x419b10,_0x4ce9d0){return BPromise[_0x3856('0xac')]()['then'](cmHopper[_0x3856('0xba')](_0x35a6be,_0x419b10,_0x4ce9d0))[_0x3856('0xad')](loggerCatch(_0x3856('0xb9')));};Dialer[_0x3856('0xa1')][_0x3856('0xbb')]=function(_0x5f50b){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](voiceQueueRt[_0x3856('0xbb')](_0x5f50b))['catch'](loggerCatch(_0x3856('0xbc')));};Dialer[_0x3856('0xa1')][_0x3856('0xbd')]=function(_0xd97b01){return BPromise[_0x3856('0xac')]()['then'](cmHopper[_0x3856('0xbd')](_0xd97b01))[_0x3856('0xad')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x3856('0xa1')][_0x3856('0xbe')]=function(_0x585a01){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](cmHopperHistory[_0x3856('0xbe')](_0x585a01))[_0x3856('0xad')](loggerCatch(_0x3856('0xbf')));};Dialer[_0x3856('0xa1')][_0x3856('0xa8')]=function(_0x3f1ee5){if(!_['isUndefined'](_0x3f1ee5)&&_0x3f1ee5!==null){if(typeof _0x3f1ee5[_0x3856('0x70')]!==_0x3856('0xa2')){if(_0x3f1ee5[_0x3856('0x70')]>0x0){_0x3f1ee5[_0x3856('0x70')]-=0x1;}else{logger[_0x3856('0x8e')](_0x3856('0xc0'));}}}else{logger[_0x3856('0x8e')](_0x3856('0xc1'));}};Dialer[_0x3856('0xa1')][_0x3856('0xc2')]=function(_0x312cbe,_0x5ed4fe){var _0x3b270f=this;return function(_0x43ab6d){_0x3b270f['updateOriginated'](_0x5ed4fe);logger['error'](_0x312cbe,util[_0x3856('0x8f')](_0x43ab6d,{'showHidden':![],'depth':null}));};};Dialer[_0x3856('0xa1')][_0x3856('0xc3')]=function(_0x4ca49d,_0x2518cd,_0x2a1283){var _0x429c41={'state':0x19,'statedesc':_0x3856('0xc4')};this['updateOriginated'](_0x2518cd);this[_0x3856('0xc5')](_[_0x3856('0x88')](_0x429c41,_[_0x3856('0xc6')](_0x2a1283,[_0x3856('0xc7'),_0x3856('0xc8'),_0x3856('0xc9'),_0x3856('0xca'),_0x3856('0xcb')])),_0x3856('0xcc'),'[emptyContact]');logger[_0x3856('0x8e')](_0x4ca49d);};Dialer[_0x3856('0xa1')][_0x3856('0xcd')]=function(_0x52ecdd){return _0x52ecdd===_0x3856('0xce');};Dialer[_0x3856('0xa1')][_0x3856('0xcf')]=function(_0x28b6c9){return!_[_0x3856('0x3a')](_0x28b6c9)&&_0x28b6c9&&!_[_0x3856('0x3a')](_0x28b6c9[_0x3856('0x3d')])&&!_[_0x3856('0x3a')](_0x28b6c9[_0x3856('0x74')])&&_0x28b6c9[_0x3856('0x74')]&&(this[_0x3856('0x21')][util[_0x3856('0x77')](_0x3856('0xd0'),_0x28b6c9[_0x3856('0x3d')])]['status']==='reachable'||this[_0x3856('0x21')][util[_0x3856('0x77')](_0x3856('0xd0'),_0x28b6c9['name'])][_0x3856('0xa4')]===_0x3856('0xd1'));};Dialer[_0x3856('0xa1')]['saveInDb']=function(_0x500eff,_0x545f98,_0x180b21){this[_0x3856('0xbe')](_0x500eff)[_0x3856('0xad')](loggerCatch(_0x545f98));this['moveContactManagedDialer'](_0x500eff)[_0x3856('0xad')](loggerCatch(_0x180b21));};Dialer[_0x3856('0xa1')]['syncVarSet']=function(_0x43f1e6){var _0x2ed96b=this['uniqueId'][_0x43f1e6['uniqueid']];var _0x319b50;if(!_['isNil'](_0x43f1e6)&&!_[_0x3856('0xd2')](_0x43f1e6[_0x3856('0xd3')])&&!_[_0x3856('0xd2')](_0x43f1e6[_0x3856('0xd3')][_0x3856('0xd4')])&&_0x43f1e6[_0x3856('0xd5')]===_0x3856('0xd6')&&_0x2ed96b){if(_0x2ed96b[_0x3856('0x4b')]!==_0x3856('0xa7')&&this[_0x3856('0x1e')][_0x2ed96b['queue']][_0x3856('0xd7')]&&_0x43f1e6[_0x3856('0xd8')]==='HANGUP'){delete this[_0x3856('0x26')][_0x43f1e6[_0x3856('0xd9')]];this[_0x3856('0xa8')](this['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]);this[_0x3856('0x1e')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0x5d')]+=0x1;this['voiceQueues'][_0x2ed96b['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x319b50=new Hangup(_0x2ed96b,_0x43f1e6);_0x319b50['state']=0x12;_0x319b50[_0x3856('0xda')]=_0x3856('0xdb');_0x319b50['membername']=_0x3856('0xdc');this[_0x3856('0xc5')](_0x319b50,_0x3856('0xdd'),_0x3856('0xde'));}if(_0x2ed96b[_0x3856('0x4b')]!=='ivr'&&this[_0x3856('0x1e')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0xd7')]&&_0x43f1e6['value']===_0x3856('0xdf')){var _0x34dfaf=this;return new BPromise(function(_0x5275a9,_0x117d3f){delete _0x34dfaf[_0x3856('0x26')][_0x43f1e6[_0x3856('0xd9')]];_0x34dfaf[_0x3856('0xa8')](_0x34dfaf['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]);_0x34dfaf['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]['outboundAnswerCallsDay']+=0x1;_0x34dfaf['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x12f990=_0x34dfaf[_0x3856('0x1e')][_0x2ed96b[_0x3856('0xa9')]];var _0x4c7ad1=new Hangup(_0x2ed96b,_0x43f1e6);_0x4c7ad1[_0x3856('0x9e')]=0x13;_0x4c7ad1[_0x3856('0xda')]=_0x3856('0xe0');_0x4c7ad1[_0x3856('0xe1')]=_0x3856('0xdc');_0x4c7ad1[_0x3856('0xe2')]+=0x1;_0x4c7ad1[_0x3856('0xe3')]+=0x1;_0x4c7ad1[_0x3856('0xe4')]=!![];_0x34dfaf[_0x3856('0xbe')](_0x4c7ad1)[_0x3856('0xad')](loggerCatch(_0x3856('0xe5')));if(_0x4c7ad1[_0x3856('0xe6')]+_0x4c7ad1[_0x3856('0xe7')]+_0x4c7ad1[_0x3856('0xe8')]+_0x4c7ad1[_0x3856('0xe9')]+_0x4c7ad1[_0x3856('0xea')]+_0x4c7ad1['countabandonedretry']+_0x4c7ad1['countmachineretry']+_0x4c7ad1[_0x3856('0xeb')]>=_0x12f990[_0x3856('0xec')]){_0x34dfaf['stateGlobal'](_0x4c7ad1,_0x5275a9,_0x117d3f,_0x3856('0xed'));}else{if(_0x4c7ad1[_0x3856('0xe2')]>=_0x12f990[_0x3856('0xee')]){_0x34dfaf[_0x3856('0xef')](_0x4c7ad1,_0x5275a9,_0x117d3f,_0x3856('0xf0'));}else{_0x34dfaf[_0x3856('0xb4')]({'active':![],'countmachineretry':_0x4c7ad1[_0x3856('0xe2')],'scheduledat':moment()['add'](_0x12f990[_0x3856('0xf1')],_0x3856('0xf2'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c7ad1[_0x3856('0xc7')],'ListId':_0x4c7ad1['ListId'],'VoiceQueueId':_0x4c7ad1[_0x3856('0xca')]||undefined,'CampaignId':_0x4c7ad1[_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x5275a9({'reschedule':0x1});}}});}if(_0x2ed96b['type']===_0x3856('0xa7')&&this[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0xd7')]&&_0x43f1e6['value']==='HANGUP'){delete this['uniqueId'][_0x43f1e6[_0x3856('0xd9')]];this[_0x3856('0xa8')](this['campaigns'][_0x2ed96b[_0x3856('0xa9')]]);_0x319b50=new Hangup(_0x2ed96b,_0x43f1e6);_0x319b50[_0x3856('0x9e')]=0x12;_0x319b50['statedesc']=_0x3856('0xdb');_0x319b50[_0x3856('0xe1')]=_0x3856('0xdc');this[_0x3856('0xc5')](_0x319b50,'[syncHangupInAMDIvr][createHistory]',_0x3856('0xf3'));}if(_0x2ed96b[_0x3856('0x4b')]==='ivr'&&this[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0xd7')]&&_0x43f1e6[_0x3856('0xd8')]==='MACHINE'){var _0x34dfaf=this;return new BPromise(function(_0x320f88,_0x1cc1a3){delete _0x34dfaf[_0x3856('0x26')][_0x43f1e6[_0x3856('0xd9')]];_0x34dfaf[_0x3856('0xa8')](_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]]);_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]]['outboundAnswerCallsDay']+=0x1;_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0x5c')]+=0x1;var _0x228251=_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]];var _0x569293=new Hangup(_0x2ed96b,_0x43f1e6);_0x569293[_0x3856('0x9e')]=0x13;_0x569293[_0x3856('0xda')]=_0x3856('0xe0');_0x569293[_0x3856('0xe1')]='AMD';_0x569293[_0x3856('0xe2')]+=0x1;_0x569293[_0x3856('0xe3')]+=0x1;_0x569293[_0x3856('0xe4')]=!![];_0x34dfaf[_0x3856('0xbe')](_0x569293)[_0x3856('0xad')](loggerCatch(_0x3856('0xe5')));if(_0x569293['countbusyretry']+_0x569293[_0x3856('0xe7')]+_0x569293[_0x3856('0xe8')]+_0x569293[_0x3856('0xe9')]+_0x569293['countdropretry']+_0x569293[_0x3856('0xf4')]+_0x569293['countmachineretry']+_0x569293[_0x3856('0xeb')]>=_0x228251[_0x3856('0xec')]){_0x34dfaf[_0x3856('0xf5')](_0x569293,_0x320f88,_0x1cc1a3,_0x3856('0xed'));}else{if(_0x569293['countmachineretry']>=_0x228251[_0x3856('0xee')]){_0x34dfaf[_0x3856('0xef')](_0x569293,_0x320f88,_0x1cc1a3,_0x3856('0xf0'));}else{_0x34dfaf[_0x3856('0xb4')]({'active':![],'countmachineretry':_0x569293[_0x3856('0xe2')],'scheduledat':moment()[_0x3856('0xf6')](_0x228251[_0x3856('0xf1')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x569293[_0x3856('0xc7')],'ListId':_0x569293['ListId'],'VoiceQueueId':_0x569293[_0x3856('0xca')]||undefined,'CampaignId':_0x569293[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0xf8')));_0x320f88({'reschedule':0x1});}}});}}};Dialer[_0x3856('0xa1')][_0x3856('0x32')]=function(_0x20cfc3){var _0x2ef860=this[_0x3856('0x26')][_0x20cfc3[_0x3856('0xd9')]];var _0x3da3c9=this;var _0x52d747;if(_0x2ef860&&_0x2ef860[_0x3856('0x4b')]===_0x3856('0xa7')){delete this[_0x3856('0x26')][_0x20cfc3[_0x3856('0xd9')]];this[_0x3856('0xa8')](this[_0x3856('0x1f')][_0x2ef860[_0x3856('0xa9')]]);this[_0x3856('0x1f')][_0x2ef860['queue']][_0x3856('0xf9')]+=0x1;_0x52d747=new Hangup(_0x2ef860,_0x20cfc3);this['createHistory'](_0x52d747)['catch'](loggerCatch(_0x3856('0xfa')));this['moveContactManagedDialer'](_0x52d747)['catch'](loggerCatch(_0x3856('0xfb')));}if(_0x2ef860&&_0x2ef860[_0x3856('0x4b')]!==_0x3856('0xa7')&&isNotNull(this[_0x3856('0x1e')][_0x2ef860[_0x3856('0xa9')]][_0x3856('0xfc')])){delete this[_0x3856('0x26')][_0x20cfc3[_0x3856('0xd9')]];this[_0x3856('0xa8')](this['voiceQueues'][_0x2ef860[_0x3856('0xa9')]]);this['voiceQueues'][_0x2ef860['queue']][_0x3856('0x5d')]+=0x1;this['voiceQueues'][_0x2ef860[_0x3856('0xa9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x52d747=new Hangup(_0x2ef860,_0x20cfc3);_0x52d747[_0x3856('0x9e')]=0x10;_0x52d747['statedesc']=_0x3856('0xfd');_0x52d747[_0x3856('0xe1')]=_0x3856('0xfe');this['createHistory'](_0x52d747)[_0x3856('0xad')](loggerCatch(_0x3856('0xfa')));this['moveContactManagedDialer'](_0x52d747)[_0x3856('0xad')](loggerCatch('[syncHangupIvr]'));}if(_0x2ef860&&_0x2ef860[_0x3856('0x4b')]!==_0x3856('0xa7')&&!isNotNull(this[_0x3856('0x1e')][_0x2ef860[_0x3856('0xa9')]][_0x3856('0xfc')])){delete this['uniqueId'][_0x20cfc3[_0x3856('0xd9')]];this[_0x3856('0xa8')](this[_0x3856('0x1e')][_0x2ef860[_0x3856('0xa9')]]);this['voiceQueues'][_0x2ef860[_0x3856('0xa9')]][_0x3856('0x66')]+=0x1;_0x52d747=new Hangup(_0x2ef860,_0x20cfc3);_0x52d747[_0x3856('0x9e')]=0xc;_0x52d747[_0x3856('0xda')]=_0x20cfc3['cause-txt'];_0x52d747[_0x3856('0xe1')]='Unknow';this['createHistory'](_0x52d747)[_0x3856('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3856('0xbd')](_0x52d747)['catch'](loggerCatch(_0x3856('0xfb')));}};Dialer[_0x3856('0xa1')][_0x3856('0x30')]=function(_0x1ef470){var _0x34aa8a=this[_0x3856('0x26')][_0x1ef470[_0x3856('0xd9')]];var _0x10d483=this;if(this[_0x3856('0x1e')][_0x1ef470[_0x3856('0xa9')]]){if(_0x34aa8a&&_0x34aa8a[_0x3856('0x4b')]!==_0x3856('0xa7')){delete this[_0x3856('0x26')][_0x1ef470[_0x3856('0xd9')]];this[_0x3856('0x1e')][_0x1ef470[_0x3856('0xa9')]][_0x3856('0x5d')]+=0x1;var _0x23030c=new AgentComplete(_0x34aa8a,_0x1ef470);if(_0x1ef470['reason']==='agent'){_0x23030c['agiafterat']=this[_0x3856('0x1e')][_0x1ef470[_0x3856('0xa9')]]['dialQueueProject2']&&this['voiceQueues'][_0x1ef470[_0x3856('0xa9')]][_0x3856('0xff')]?moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x23030c)['catch'](loggerCatch(_0x3856('0x100')));this[_0x3856('0xbd')](_0x23030c)[_0x3856('0xad')](loggerCatch(_0x3856('0x101')));}}};Dialer[_0x3856('0xa1')][_0x3856('0x102')]=function(_0x1c16f1){if(this['voiceQueues'][_0x1c16f1[_0x3856('0xa9')]]){if(this[_0x3856('0x26')][_0x1c16f1[_0x3856('0xd9')]]&&this[_0x3856('0x26')][_0x1c16f1['uniqueid']][_0x3856('0x4b')]!==_0x3856('0xa7')){this[_0x3856('0xa8')](this[_0x3856('0x1e')][_0x1c16f1[_0x3856('0xa9')]]);this[_0x3856('0x26')][_0x1c16f1[_0x3856('0xd9')]][_0x3856('0x103')]=moment()[_0x3856('0x77')](_0x3856('0xf7'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x45a5e5){this[_0x3856('0xbe')](_0x45a5e5)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x3856('0xbd')](_0x45a5e5)[_0x3856('0xad')](loggerCatch(_0x3856('0x104')));};Dialer[_0x3856('0xa1')][_0x3856('0x105')]=function(_0xdb90e5){var _0x460f56=this[_0x3856('0x26')][_0xdb90e5[_0x3856('0xd9')]];var _0xb63834=this;if(this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]]){if(_0x460f56&&_0x460f56['type']!=='ivr'){delete this[_0x3856('0x26')][_0xdb90e5['uniqueid']];this[_0x3856('0xa8')](this[_0x3856('0x1e')][_0xdb90e5['queue']]);_0x460f56[_0x3856('0x106')]=moment()['format'](_0x3856('0xf7'));var _0x2c87ce=new QueueCallerAbandon(_0x460f56,_0xdb90e5);if(getSeconds(_0x460f56['droptime'],_0x460f56['responsetime'])>=_0x460f56['dialQueueTimeout']){this[_0x3856('0x1e')][_0xdb90e5['queue']][_0x3856('0x107')]+=0x1;this['voiceQueues'][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x61')]+=0x1;this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x108')]+=0x1;_0x2c87ce[_0x3856('0x9e')]=0xa;_0x2c87ce[_0x3856('0xda')]=_0x3856('0x109');_0x2c87ce['dropreason']=_0x3856('0x10a');_0x2c87ce[_0x3856('0x10b')]=this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]]['dialQueueProject2']?moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2c87ce[_0x3856('0xea')]+=0x1;_0x2c87ce[_0x3856('0xe3')]+=0x1;if(_0x2c87ce[_0x3856('0xea')]>=this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x10c')]){this[_0x3856('0x10d')](_0x2c87ce);}else{this[_0x3856('0xb4')]({'active':![],'countdropretry':_0x2c87ce[_0x3856('0xea')],'scheduledat':moment()[_0x3856('0xf6')](this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x10e')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x460f56[_0x3856('0xc7')],'ListId':_0x460f56['ListId'],'VoiceQueueId':_0x460f56[_0x3856('0xca')]||undefined,'CampaignId':_0x460f56[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x10f')));var _0x5dbade=new History(_0x2c87ce);_0x5dbade[_0x3856('0x9e')]=0xa;_0x5dbade[_0x3856('0xda')]='Drop';_0x5dbade[_0x3856('0x110')]=moment()['format'](_0x3856('0xf7'));_0x5dbade[_0x3856('0x111')]=_0x5dbade[_0x3856('0x110')];_0x5dbade[_0x3856('0x112')]=_0x2c87ce[_0x3856('0x112')];_0x5dbade[_0x3856('0x113')]=_0x2c87ce[_0x3856('0x113')];this[_0x3856('0xbe')](_0x5dbade)[_0x3856('0xad')](loggerCatch(_0x3856('0x114')));}}else{this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x69')]+=0x1;this[_0x3856('0x1e')][_0xdb90e5['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x2c87ce['state']=0xb;_0x2c87ce[_0x3856('0xda')]='Abandoned';_0x2c87ce['dropreason']=_0x3856('0x115');_0x2c87ce[_0x3856('0xf4')]+=0x1;_0x2c87ce[_0x3856('0xe3')]+=0x1;if(_0x2c87ce[_0x3856('0xf4')]>=this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x116')]){this[_0x3856('0x10d')](_0x2c87ce);}else{this[_0x3856('0xb4')]({'active':![],'countabandonedretry':_0x2c87ce['countabandonedretry'],'scheduledat':moment()[_0x3856('0xf6')](this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x117')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x460f56[_0x3856('0xc7')],'ListId':_0x460f56[_0x3856('0xc8')],'VoiceQueueId':_0x460f56[_0x3856('0xca')]||undefined,'CampaignId':_0x460f56[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x118')));var _0x5dbade=new History(_0x2c87ce);_0x5dbade['state']=0xb;_0x5dbade[_0x3856('0xda')]=_0x3856('0x119');_0x5dbade[_0x3856('0x110')]=moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dbade['endtime']=_0x5dbade[_0x3856('0x110')];_0x5dbade[_0x3856('0x112')]=_0x2c87ce[_0x3856('0x112')];_0x5dbade['calleridnum']=_0x2c87ce[_0x3856('0x113')];this[_0x3856('0xbe')](_0x5dbade)[_0x3856('0xad')](loggerCatch(_0x3856('0x11a')));}}}}};Dialer['prototype'][_0x3856('0x11b')]=function(_0x15ebf3){if(this[_0x3856('0x24')][_0x15ebf3[_0x3856('0xd9')]]){this['actions'][_0x15ebf3['uniqueid']][_0x3856('0xa5')]=_0x15ebf3['channel'];}if(this[_0x3856('0x26')][_0x15ebf3[_0x3856('0xd9')]]){this[_0x3856('0x26')][_0x15ebf3[_0x3856('0xd9')]]['channel']=_0x15ebf3[_0x3856('0xa5')];}};Dialer['prototype'][_0x3856('0x35')]=function(_0x58763d){if(strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]['queue']][_0x3856('0x4d')]]===_0x3856('0x19')){if(this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]&&_[_0x3856('0xd2')](this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]['locked'])&&_0x58763d['status']==='1'&&_0x58763d[_0x3856('0x11d')]==='0'){if(this['agents'][_0x58763d[_0x3856('0x11e')]]){if(!this[_0x3856('0x20')][_0x58763d[_0x3856('0x11e')]][_0x3856('0x11f')]){this[_0x3856('0x20')][_0x58763d['stateinterface']][_0x3856('0x11f')]=!![];this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]][_0x3856('0x11f')]=!![];this[_0x3856('0x24')][_0x58763d['actionid']][_0x3856('0x11e')]=_0x58763d['stateinterface'];}}}}else if((strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x58763d['actionid']][_0x3856('0xa9')]][_0x3856('0x4d')]]||_0x3856('0x18'))===_0x3856('0x18')){if(this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]){if(this[_0x3856('0x20')][_0x58763d['stateinterface']]){this['actions'][_0x58763d[_0x3856('0x11c')]]['stateinterface']=_0x58763d[_0x3856('0x11e')];if(_[_0x3856('0xd2')](this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x58763d['actionid']]['queue']])){this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]][_0x3856('0xa9')]]=[];}this[_0x3856('0x2a')][this['actions'][_0x58763d[_0x3856('0x11c')]][_0x3856('0xa9')]][_0x3856('0x120')](_[_0x3856('0x88')](_[_0x3856('0xc6')](this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]],[_0x3856('0x121'),_0x3856('0x11e')]),{'status':_0x58763d[_0x3856('0xa4')],'paused':_0x58763d[_0x3856('0x11d')]}));}}}};function unlockQueueStatus(_0x2da965,_0x2b110a){setTimeout(function(){if(_['isUndefined'](_0x2da965['queueStatusComplete'])){loggerBooked[_0x3856('0x8e')]('[unlockQueueStatus][undefined]',_0x2b110a);}_0x2da965[_0x3856('0x122')]=!![];loggerBooked[_0x3856('0x7a')](_0x3856('0x123'),_0x2b110a,JSON[_0x3856('0x48')](_[_0x3856('0xc6')](_0x2da965,['name',_0x3856('0x122')])));},0x1f3);}Dialer[_0x3856('0xa1')][_0x3856('0x37')]=function(_0x316c43){var _0x5e8f0e=this;var _0x1ca7a6=_0x5e8f0e[_0x3856('0x1e')][_0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['queue']];if(strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x316c43['actionid']][_0x3856('0xa9')]][_0x3856('0x4d')]]===_0x3856('0x19')){if(this[_0x3856('0x24')][_0x316c43['actionid']]&&this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['stateinterface']){this[_0x3856('0x1d')]['run'](this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['idHopper'],this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0x11e')])[_0x3856('0xad')](function(_0x449ea3){logger[_0x3856('0x8e')](_0x3856('0x124'),util[_0x3856('0x8f')](_0x449ea3,{'showHidden':![],'depth':null}));})[_0x3856('0x1b')](function(){_0x5e8f0e[_0x3856('0xa8')](_0x5e8f0e[_0x3856('0x1e')][_0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]);_0x5e8f0e[_0x3856('0x20')][_0x5e8f0e['actions'][_0x316c43[_0x3856('0x11c')]][_0x3856('0x11e')]][_0x3856('0x11f')]=![];delete _0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]];unlockQueueStatus(_0x1ca7a6);});}else{this[_0x3856('0xa8')](this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]);this[_0x3856('0xb4')]({'active':![],'ContactId':this['actions'][_0x316c43[_0x3856('0x11c')]][_0x3856('0xc7')],'ListId':this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xc8')],'VoiceQueueId':this['actions'][_0x316c43[_0x3856('0x11c')]][_0x3856('0xca')]||undefined,'CampaignId':this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]];unlockQueueStatus(_0x1ca7a6);}}else if((strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]][_0x3856('0x4d')]]||'rrmemory')===_0x3856('0x18')){var _0x51c102;if(this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]&&!_[_0x3856('0x45')](this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]])){if(this['queueBookedRR'][_0x5e8f0e[_0x3856('0x24')][_0x316c43['actionid']][_0x3856('0xa9')]]){this[_0x3856('0x2b')][_0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['queue']]=this['queueBookedRR'][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]?this[_0x3856('0x2b')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]:this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x316c43['actionid']][_0x3856('0xa9')]]?this[_0x3856('0x2a')][this['actions'][_0x316c43['actionid']][_0x3856('0xa9')]]['_rr']||0x0:0x0;}this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]['_rr']=this[_0x3856('0x2b')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['queue']];for(var _0x54715c=0x0;_0x54715c=0x0;})[_0x3856('0xad')](myreject(_0x46fe00)));}}else{_0x4b6f13[_0x3856('0x120')](ami[_0x3856('0xa3')]({'action':_0x3856('0x139'),'command':util['format']('iftime\x20%s,%s',_0x4f179f,!_[_0x3856('0x3a')](config[_0x3856('0x137')][_0x52108c])?_0x52108c:'')})[_0x3856('0xaf')](function(_0x25fb95){return _0x25fb95[_0x3856('0x13c')][_0x3856('0x13d')](_0x3856('0x13e'))>=0x0;})[_0x3856('0xad')](myreject(_0x46fe00)));}BPromise['all'](_0x4b6f13)[_0x3856('0xaf')](function(_0x5aba35){var _0x5e0ae5=_[_0x3856('0x13f')](_0x5aba35);if(_0x5e0ae5){return _0x934911(_0x5e0ae5);}else{_0x3e8a22['message']=_0x127fbc?_0x3856('0x140'):_0x3856('0x141');return _0x46fe00(msgResponse(_0x3856('0x142'),_0x3856('0x134'),'Global:\x20'+_0x127fbc+'\x20'+_0x5c921a+_0x3856('0x143')+util[_0x3856('0x8f')](_0x4f179f,{'showHidden':![],'depth':null})+_0x3856('0x144')+_0x52108c));}})[_0x3856('0xad')](function(_0x4b2ed8){return _0x46fe00(msgResponse(_0x3856('0x133'),_0x3856('0x134'),JSON[_0x3856('0x48')](_0x4b2ed8)));});});};Dialer['prototype'][_0x3856('0x145')]=function(_0x4489e0){var _0x337b26=this;return function(){switch(_0x4489e0[_0x3856('0x58')]){case _0x3856('0x146'):freeVariablesPredictive(_0x4489e0);_0x337b26['handlePower'](_0x4489e0,0x1);break;case _0x3856('0x147'):freeVariablesPredictive(_0x4489e0);_0x337b26[_0x3856('0x148')](_0x4489e0,_0x4489e0['dialPowerLevel']);break;case'predictive':_0x337b26[_0x3856('0xa')](_0x4489e0);break;case _0x3856('0x9'):freeVariablesPredictive(_0x4489e0);_0x337b26[_0x3856('0x148')](_0x4489e0,0x1);break;default:freeVariablesPredictive(_0x4489e0);logger['error'](_0x3856('0x149'),_0x4489e0[_0x3856('0x3d')],'method\x20not\x20recognized');}};};Dialer[_0x3856('0xa1')][_0x3856('0x14a')]=function(_0x34ec05){var _0x180a87=this;return function(){_0x180a87['handleIvr'](_0x34ec05);};};Dialer['prototype'][_0x3856('0xb')]=function(_0x111ba9){var _0x44a04c=this;if(isNotPreview(_0x111ba9[_0x3856('0x58')])){if(isVoiceQueueOutbound(_0x111ba9['type'])&&isActive(_0x111ba9[_0x3856('0x57')])){_0x111ba9[_0x3856('0x97')]=!![];BPromise[_0x3856('0xac')]()['then'](checkIsLoggedIn(_0x111ba9,_0x111ba9[_0x3856('0x4f')]))[_0x3856('0xaf')](checkIsActive(_0x111ba9,_0x111ba9[_0x3856('0x57')]))['then'](checkInterval(_0x111ba9))[_0x3856('0xaf')](_0x44a04c[_0x3856('0x12e')](_0x111ba9))[_0x3856('0xaf')](_0x44a04c['checkIfTime'](_0x111ba9[_0x3856('0x14b')],_0x111ba9[_0x3856('0x14c')],_0x111ba9['name'],_0x111ba9))[_0x3856('0xaf')](_0x44a04c['checkIfTimeIntervals'](_0x111ba9[_0x3856('0x41')],_0x111ba9[_0x3856('0x14c')],_0x111ba9[_0x3856('0x3d')],_0x111ba9))[_0x3856('0xaf')](_0x44a04c[_0x3856('0x145')](_0x111ba9))[_0x3856('0xad')](loggerCatchQueueSummary(_0x3856('0x14d'),_0x111ba9));}else{notSendMessagesQueue(_0x111ba9);}}else{freeVariablesPredictive(_0x111ba9);}};Dialer['prototype'][_0x3856('0x12d')]=function(){var _0x369503=this;var _0x232a05;for(var _0x507395 in this['campaigns']){if(typeof this[_0x3856('0x1f')][_0x507395]!==_0x3856('0xa2')){_0x232a05=this[_0x3856('0x1f')][_0x507395];if(isCampaignIvr(_0x232a05[_0x3856('0x4b')])&&isActive(_0x232a05[_0x3856('0x74')])){_0x232a05[_0x3856('0x97')]=!![];BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](checkIsActive(_0x232a05,_0x232a05[_0x3856('0x74')]))['then'](checkInterval(_0x232a05))[_0x3856('0xaf')](_0x369503[_0x3856('0x12e')](_0x232a05))[_0x3856('0xaf')](_0x369503[_0x3856('0x132')](_0x232a05['dialGlobalInterval'],_0x232a05[_0x3856('0x14c')],_0x232a05[_0x3856('0x3d')],_0x232a05))[_0x3856('0xaf')](_0x369503[_0x3856('0x14e')](_0x232a05[_0x3856('0x41')],_0x232a05['dialTimezone'],_0x232a05['name'],_0x232a05))['then'](_0x369503[_0x3856('0x14a')](_0x232a05))[_0x3856('0xad')](loggerCatchQueueSummary(_0x3856('0x14f'),_0x232a05));}else{notSendMessagesCampaign(_0x232a05);}}}};function getCallerIdRandom(_0x1153e3,_0x56cd29){var _0x2d2787;var _0x386e40;var _0x1edff1;if(_0x56cd29<=0x0){_0x56cd29=0x1;}_0x2d2787=new RegExp(_0x3856('0x150')+_0x56cd29+'}$');_0x386e40=Math[_0x3856('0x151')](0xa,_0x56cd29-0x1);_0x1edff1=Math[_0x3856('0x151')](0xa,_0x56cd29)-0x1;return util[_0x3856('0x77')]('%s',_[_0x3856('0x152')](_0x1153e3,_0x2d2787,_[_0x3856('0x153')](_0x386e40,_0x1edff1)));}function extractCalleridName(_0x4ffa4c){var _0x488788=_0x4ffa4c[_0x3856('0x154')](/"(.*?)"/);return _0x488788?_0x488788[0x1]:_0x4ffa4c;}function extractCalleridNumber(_0x35fe27){var _0x5b0fd3=_0x35fe27[_0x3856('0x154')](/<(.*?)>/);return _0x5b0fd3?_0x5b0fd3[0x1]:_0x35fe27;}Dialer[_0x3856('0xa1')][_0x3856('0x155')]=function(_0x3cbf12,_0x555f53){var _0x43962f=this;var _0xfddbeb=uuid['v4']();this[_0x3856('0x24')][_0xfddbeb]=new Action(_0x3cbf12,_0x555f53,_0xfddbeb);return new BPromise(function(_0x40731e,_0x2736a4){if(_['isUndefined'](_0x3cbf12)&&typeof _0x3cbf12!==_0x3856('0x156')){return _0x2736a4(msgResponse(_0x3856('0x157'),_0x3856('0x134'),_0x3856('0x158')));}if(_['isUndefined'](_0x555f53['Contact']['phone'])||_0x555f53[_0x3856('0x159')][_0x3856('0x15a')]===null){return _0x2736a4(msgResponse('originate',_0x3856('0x134'),_0x3856('0x15b')));}var _0x523bd5={'XMD-CALLERID':_0x43962f[_0x3856('0x24')][_0xfddbeb][_0x3856('0x15c')](),'XMD-AGI':_0x3cbf12[_0x3856('0xfc')]?util['format'](_0x3856('0x15d'),ipAgi,_0x3cbf12[_0x3856('0xfc')]):_0x3856('0x15e'),'XMD-AGIAFTER':_0x3cbf12[_0x3856('0x15f')]?util['format'](_0x3856('0x15d'),ipAgi,_0x3cbf12[_0x3856('0x15f')]):_0x3856('0x15e'),'XMD-QUEUE':_0x3cbf12['type']==='outbound'?util[_0x3856('0x77')](_0x3856('0x160'),_0x3cbf12[_0x3856('0x3d')],_0x3cbf12[_0x3856('0x161')]||'',_0x3cbf12[_0x3856('0xff')]?'c':'',_0x3cbf12[_0x3856('0x162')]||0x3):_0x3856('0x15e'),'XMD-CONTACTID':_0x555f53[_0x3856('0xc7')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x43962f[_0x3856('0x24')][_0xfddbeb][_0x3856('0x15c')](),'XMD-AMD':_0x3cbf12[_0x3856('0xd7')]?_0x3856('0x163'):_0x3856('0x15e'),'XMD-DESTINATION':_0x3856('0xd6')};if(_0x3cbf12['dialAMDActive']){_0x523bd5[_0x3856('0x164')]=_0x3cbf12[_0x3856('0x165')]||0x9c4;_0x523bd5[_0x3856('0x166')]=_0x3cbf12[_0x3856('0x167')]||0x5dc;_0x523bd5[_0x3856('0x168')]=_0x3cbf12[_0x3856('0x169')]||0x320;_0x523bd5['XMD-AMDTOTALANALYSISTIME']=_0x3cbf12[_0x3856('0x16a')]||0x1388;_0x523bd5[_0x3856('0x16b')]=_0x3cbf12[_0x3856('0x16c')]||0x64;_0x523bd5[_0x3856('0x16d')]=_0x3cbf12[_0x3856('0x16e')]||0x32;_0x523bd5[_0x3856('0x16f')]=_0x3cbf12[_0x3856('0x170')]||0x3;_0x523bd5[_0x3856('0x171')]=_0x3cbf12[_0x3856('0x172')]||0x100;_0x523bd5[_0x3856('0x173')]=_0x3cbf12[_0x3856('0x174')]||0x1388;}if(_0x3cbf12['type']==='outbound'){_0x523bd5[_0x3856('0x175')]=_0x555f53[_0x3856('0xca')];}else{_0x523bd5[_0x3856('0x176')]=_0x555f53[_0x3856('0xcb')];}for(var _0x493e40 in _0x555f53[_0x3856('0x159')]){if(typeof _0x555f53[_0x3856('0x159')][_0x493e40]!=='undefined'){if(isNotNull(_0x555f53['Contact'][_0x493e40])&&_0x493e40!=='id'&&_0x493e40!==_0x3856('0x177')&&_0x493e40!=='createdAt'&&_0x493e40!==_0x3856('0x178')){_0x523bd5[util[_0x3856('0x77')](_0x3856('0x179'),_0x3856('0x17a'),_[_0x3856('0x17b')](_0x493e40))]=_0x555f53[_0x3856('0x159')][_0x493e40];}}}var _0x58a0c6=_0x43962f[_0x3856('0xcf')](_0x3cbf12[_0x3856('0x73')])?getCallerId(_0x3cbf12[_0x3856('0x73')][_0x3856('0x75')],_0x3cbf12[_0x3856('0x59')],_0x3cbf12['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3cbf12['dialOriginateCallerIdNumber'],_0x3cbf12['dialRandomLastDigitCallerIdNumber']):_0x3cbf12[_0x3856('0x5a')]):getCallerId(_[_0x3856('0xd2')](_0x3cbf12['TrunkBackup'])?_0x3cbf12[_0x3856('0x73')][_0x3856('0x75')]:_0x3cbf12[_0x3856('0x12f')][_0x3856('0x75')],_0x3cbf12['dialOriginateCallerIdName'],_0x3cbf12[_0x3856('0x17c')]>0x0?getCallerIdRandom(_0x3cbf12[_0x3856('0x5a')],_0x3cbf12[_0x3856('0x17c')]):_0x3cbf12[_0x3856('0x5a')]);if(_0x58a0c6){_0x523bd5[_0x3856('0x17d')]=_0x43962f[_0x3856('0x24')][_0xfddbeb]['originatecalleridname']=extractCalleridName(_0x58a0c6);_0x523bd5[_0x3856('0x17e')]=_0x43962f[_0x3856('0x24')][_0xfddbeb][_0x3856('0x17f')]=extractCalleridNumber(_0x58a0c6);}return ami[_0x3856('0xa3')]({'actionid':_0xfddbeb,'action':'originate','channel':_0x43962f[_0x3856('0xcf')](_0x3cbf12[_0x3856('0x73')])?util[_0x3856('0x77')](_0x3856('0x180'),_0x3cbf12[_0x3856('0x73')][_0x3856('0x3d')],isNotNull(_0x3cbf12[_0x3856('0x5b')])?_0x3cbf12['dialPrefix']['trim']()||'':'',_0x3cbf12[_0x3856('0x181')]>0x0?_0x555f53[_0x3856('0x159')][_0x3856('0x15a')]['substring'](_0x3cbf12[_0x3856('0x181')]):_0x555f53[_0x3856('0x159')][_0x3856('0x15a')]):util[_0x3856('0x77')](_0x3856('0x180'),_['isNil'](_0x3cbf12[_0x3856('0x12f')])?_0x3cbf12[_0x3856('0x73')][_0x3856('0x3d')]:_0x3cbf12[_0x3856('0x12f')][_0x3856('0x3d')],isNotNull(_0x3cbf12[_0x3856('0x5b')])?_0x3cbf12[_0x3856('0x5b')][_0x3856('0x182')]()||'':'',_0x3cbf12[_0x3856('0x181')]>0x0?_0x555f53['Contact']['phone'][_0x3856('0x183')](_0x3cbf12[_0x3856('0x181')]):_0x555f53['Contact']['phone']),'callerid':_0x58a0c6,'Exten':_0x3856('0xd6'),'Context':'from-sip','Priority':'1','variable':_0x523bd5,'timeout':(_0x3cbf12['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xfddbeb})[_0x3856('0xaf')](function(_0x239c96){return _0x40731e(_0x239c96);})['catch'](function(_0x491e21){_0x3cbf12[_0x3856('0x63')]+=0x1;var _0x468f32=new History(_0x43962f['actions'][_0xfddbeb]);logger['error'](util[_0x3856('0x77')]('[originateError]:\x20%s',JSON['stringify'](_0x491e21)));_0x468f32[_0x3856('0x9e')]=0xe;_0x468f32[_0x3856('0xda')]=_0x3856('0x184');_0x468f32[_0x3856('0x110')]=moment()[_0x3856('0x77')](_0x3856('0xf7'));_0x468f32[_0x3856('0x111')]=_0x468f32[_0x3856('0x110')];_0x43962f['createHistory'](_0x468f32)[_0x3856('0xad')](loggerCatch(_0x3856('0x185')));_0x43962f[_0x3856('0xbd')](_0x468f32)['catch'](loggerCatch('[originate][error]'))[_0x3856('0x1b')](function(){delete _0x43962f[_0x3856('0x24')][_0xfddbeb];return _0x2736a4(msgResponse(_0x3856('0x157'),_0x3856('0x47'),_0x3856('0x186')));});});});};Dialer[_0x3856('0xa1')][_0x3856('0x2e')]=function(_0x3cd670){var _0x2d1002=this['actions'][_0x3cd670[_0x3856('0x11c')]];if(_0x2d1002){delete this['actions'][_0x3cd670['actionid']];_0x2d1002[_0x3856('0x187')]=moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1c544a=_0x2d1002[_0x3856('0x4b')]==='ivr'?this[_0x3856('0x1f')][_0x2d1002[_0x3856('0xa9')]]:this['voiceQueues'][_0x2d1002[_0x3856('0x188')]()];if(!this[_0x3856('0xcd')](_0x3cd670[_0x3856('0x189')])){this[_0x3856('0xa8')](_0x1c544a);return this['callProgressDetecting'](_0x2d1002,_0x1c544a,_0x3cd670)['catch'](loggerCatch(_0x3856('0x18a')));}this[_0x3856('0x26')][_0x3cd670[_0x3856('0xd9')]]=_0x2d1002;}};Dialer[_0x3856('0xa1')][_0x3856('0x18b')]=function(_0x41fe50,_0x560ab1,_0x3634f1){var _0x588fba=new History(_0x560ab1);if(_0x588fba[_0x3856('0xe6')]+_0x588fba[_0x3856('0xe7')]+_0x588fba[_0x3856('0xe8')]+_0x588fba[_0x3856('0xe9')]+_0x588fba[_0x3856('0xea')]+_0x588fba[_0x3856('0xf4')]+_0x588fba['countmachineretry']+_0x588fba[_0x3856('0xeb')]>=_0x3634f1[_0x3856('0xec')]-0x1){return!![];}switch(_0x41fe50){case 0x3:if(_0x588fba['countnoanswerretry']>=_0x3634f1[_0x3856('0x18c')]-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countnoanswerretry':_0x588fba[_0x3856('0xe8')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1['dialNoAnswerRetryFrequency'],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x18d')));break;case 0x5:if(_0x588fba['countbusyretry']>=_0x3634f1['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x588fba[_0x3856('0xe6')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1[_0x3856('0x18e')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x18f')));break;case 0x8:if(_0x588fba[_0x3856('0xe7')]>=_0x3634f1['dialCongestionMaxRetry']-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countcongestionretry':_0x588fba[_0x3856('0xe7')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1[_0x3856('0x190')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x588fba['countnosuchnumberretry']>=_0x3634f1[_0x3856('0x191')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x588fba[_0x3856('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x3634f1[_0x3856('0x192')],'minutes')['format'](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x193')));}break;case 0xa:if(_0x588fba['countdropretry']>=_0x3634f1[_0x3856('0x10c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x588fba['countdropretry']+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1['dialDropRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x10f')));break;case 0xb:if(_0x588fba[_0x3856('0xf4')]>=_0x3634f1[_0x3856('0x116')]-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countabandonedretry':_0x588fba[_0x3856('0xf4')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1[_0x3856('0x117')],_0x3856('0xf2'))['format'](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x118')));break;case 0x13:if(_0x588fba[_0x3856('0xe2')]>=_0x3634f1[_0x3856('0xee')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x588fba[_0x3856('0xe2')]+=0x1,'scheduledat':moment()['add'](_0x3634f1[_0x3856('0xf1')],'minutes')[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x588fba['countagentrejectretry']>=_0x3634f1[_0x3856('0x194')]-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countagentrejectretry':_0x588fba[_0x3856('0xeb')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1['dialAgentRejectRetryFrequency'],_0x3856('0xf2'))[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x195')));break;default:return!![];}};Dialer['prototype'][_0x3856('0x196')]=function(_0x5afc3a,_0x160779,_0xa70cda){var _0x2f67cf=this;var _0x2f6294=new History(_0x5afc3a);return new BPromise(function(_0x33aeb7,_0x3dbc15){if(_[_0x3856('0x3a')](_0x160779)&&typeof _0x160779!==_0x3856('0x156')){return _0x3dbc15(msgResponse('[callProgressDetecting]',_0x3856('0x134'),_0x3856('0x197')));}if(_[_0x3856('0x3a')](_0xa70cda)&&typeof _0xa70cda!==_0x3856('0x156')){return _0x3dbc15(msgResponse('[callProgressDetecting]',_0x3856('0x134'),_0x3856('0x198')));}switch(_0xa70cda[_0x3856('0x199')]){case'0':_0x160779[_0x3856('0x19a')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x0;_0x2f6294[_0x3856('0xda')]=_0x3856('0x19b');_0x2f6294['countnosuchnumberretry']+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami[_0x3856('0x19c')](_0x3856('0x19d'),ut[_0x3856('0x19e')](_0x5afc3a,'nosuchnumber'));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0xe5')));if(_0x2f67cf[_0x3856('0x18b')](0x0,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe9')]>=_0x160779[_0x3856('0x191')]){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x19f'));}else{_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x19f'));}}break;case'3':_0x160779[_0x3856('0x62')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x3;_0x2f6294['statedesc']='NoAnswer';_0x2f6294[_0x3856('0xe8')]+=0x1;_0x2f6294['countglobal']+=0x1;ami[_0x3856('0x19c')](_0x3856('0x1a0'),ut[_0x3856('0x19e')](_0x5afc3a,_0x3856('0x1a1')));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2f67cf[_0x3856('0x18b')](0x3,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe8')]>=_0x160779['dialNoAnswerMaxRetry']){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a2'));}else{_0x2f67cf[_0x3856('0xf5')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a2'));}}break;case'5':_0x160779[_0x3856('0x5e')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x5;_0x2f6294[_0x3856('0xda')]=_0x3856('0x1a3');_0x2f6294[_0x3856('0xe6')]+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami['emit'](_0x3856('0x1a4'),ut[_0x3856('0x19e')](_0x5afc3a,'busy'));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2f67cf['checkRetriveMax'](0x5,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe6')]>=_0x160779['dialBusyMaxRetry']){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a5'));}else{_0x2f67cf[_0x3856('0xf5')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a5'));}}break;case'8':_0x160779[_0x3856('0x1a6')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x8;_0x2f6294[_0x3856('0xda')]=_0x3856('0x1a7');_0x2f6294['countcongestionretry']+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami['emit'](_0x3856('0x1a8'),ut[_0x3856('0x19e')](_0x5afc3a,_0x3856('0x1a9')));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0x1aa')));if(_0x2f67cf[_0x3856('0x18b')](0x8,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe7')]>=_0x160779[_0x3856('0x1ab')]){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1ac'));}else{_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1ac'));}}break;case'11':_0x160779[_0x3856('0x1ad')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0xb;_0x2f6294['statedesc']='Abandoned';_0x2f6294['countabandonedretry']+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0x11a')));if(_0x2f67cf[_0x3856('0x18b')](0xb,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xf4')]>=_0x160779[_0x3856('0x116')]){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,'reason\x2011\x20abandoned');}else{_0x2f67cf[_0x3856('0xf5')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1ae'));}}break;case'20':_0x160779[_0x3856('0x65')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x14;_0x2f6294[_0x3856('0xda')]=_0x3856('0x1af');_0x2f6294[_0x3856('0xeb')]+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami['emit'](_0x3856('0x1b0'),ut[_0x3856('0x19e')](_0x5afc3a,_0x3856('0x1b1')));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2f67cf['checkRetriveMax'](0x14,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xeb')]>=_0x160779['dialAgentRejectMaxRetry']){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,'reason\x2020\x20agentreject');}else{_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1b2'));}}break;default:_0x160779['outboundUnknownCallsDay']+=0x1;_0x2f6294[_0x3856('0x9e')]=0xc;_0x2f6294['statedesc']=_0xa70cda[_0x3856('0x199')];_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0x1b3')));if(_0x2f67cf['checkRetriveMax'](_0xa70cda[_0x3856('0x199')],_0x5afc3a,_0x160779)){if(_0x2f6294['countbusyretry']+_0x2f6294[_0x3856('0xe7')]+_0x2f6294[_0x3856('0xe8')]+_0x2f6294[_0x3856('0xe9')]+_0x2f6294[_0x3856('0xea')]+_0x2f6294['countabandonedretry']+_0x2f6294[_0x3856('0xe2')]+_0x2f6294[_0x3856('0xeb')]>=_0x160779[_0x3856('0xec')]){_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0xa70cda[_0x3856('0x199')]);}else{_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0xa70cda[_0x3856('0x199')]);}}}});};Dialer[_0x3856('0xa1')]['stateGlobal']=function(_0x1a8d17,_0x49ac92,_0x59092f,_0x3f84a8){var _0x5ca7a7=new Final(_0x1a8d17);_0x5ca7a7['state']=0xf;_0x5ca7a7[_0x3856('0xda')]=_0x3856('0x1b4');this[_0x3856('0xef')](_0x5ca7a7,_0x49ac92,_0x59092f,_0x3f84a8);};Dialer[_0x3856('0xa1')][_0x3856('0xef')]=function(_0x160a4a,_0x4783ea,_0x33b407,_0x4d8ca0){this[_0x3856('0xbd')](_0x160a4a)[_0x3856('0xaf')](function(){return _0x4783ea(msgResponse(_0x3856('0x1b5'),_0x3856('0xce'),_0x4d8ca0));})['catch'](function(){return _0x33b407(msgResponse(_0x3856('0x1b6'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0x3856('0xa')]=function(_0x1dde63){var _0x538730=_0x1dde63[_0x3856('0x1b7')]/0x64;var _0x48bc33=_0x1dde63[_0x3856('0x61')]/(_0x1dde63['outboundDropCallsDayTimeout']+_0x1dde63[_0x3856('0x5d')]);var _0x46be83=Math[_0x3856('0x1b8')](_0x1dde63['predictiveIntervalAvailable']*(_0x1dde63[_0x3856('0x1b9')]/0x64));var _0x5934cd=Math[_0x3856('0x1b8')](_0x1dde63[_0x3856('0x6e')]*(_0x1dde63['predictiveIntervalMinThreshold']/0x64));var _0x22324b=_0x1dde63['available']+_0x1dde63[_0x3856('0x53')];var _0x421b0e=Math['floor'](_0x1dde63[_0x3856('0x84')]*_0x1dde63[_0x3856('0x72')]*_0x1dde63[_0x3856('0x6b')]*_0x1dde63['predictiveIntervalMultiplicativeFactor']);if(_[_0x3856('0x3a')](_0x1dde63['startProgressive'])){if(!_[_0x3856('0x3a')](_0x1dde63[_0x3856('0x27')])){_0x1dde63[_0x3856('0x27')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x3856('0x1ba'));}if(!_['isUndefined'](_0x1dde63['handlePredictive'])){loggerPredictive[_0x3856('0x8e')](_0x3856('0x1bb'),_0x3856('0x1bc'));clearInterval(_0x1dde63[_0x3856('0x89')]);_0x1dde63['handlePredictive']=undefined;}_0x1dde63[_0x3856('0x28')]=moment()[_0x3856('0x77')](_0x3856('0xf7'));loggerPredictive[_0x3856('0x7a')](_0x1dde63['name'],'collection\x20data\x20in\x20progressive\x20at',_0x1dde63['startProgressive']);this[_0x3856('0x148')](_0x1dde63,0x1);}else if(ifInterval(_0x1dde63[_0x3856('0x1bd')],_0x1dde63[_0x3856('0x28')])){this[_0x3856('0x148')](_0x1dde63,0x1);loggerPredictiveCalls['info'](_0x3856('0x1be'),_0x1dde63[_0x3856('0x28')],_0x1dde63['name']);_0x1dde63[_0x3856('0x84')]=0x0;_0x1dde63[_0x3856('0x108')]=0x0;}else if(_0x538730<_0x48bc33&&_0x1dde63[_0x3856('0x1bf')]==='dropRate'){freeVariablesPredictive(_0x1dde63);loggerPredictive['info'](_0x3856('0x1c0'),'Dropped\x20calls\x20day',_0x48bc33,_0x3856('0x28'),_0x1dde63[_0x3856('0x3d')]);}else if(_0x421b0e<_0x1dde63[_0x3856('0x108')]&&_0x1dde63['dialPredictiveOptimization']===_0x3856('0x1c1')){freeVariablesPredictive(_0x1dde63);loggerPredictive[_0x3856('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x3856('0x1c2'),_0x421b0e,_0x3856('0x1c3'),_0x1dde63['predictiveIntervalErlangCallsDroppedCalls'],_0x3856('0x28'),_0x1dde63[_0x3856('0x3d')]);}else if(!ifInterval(_0x1dde63[_0x3856('0x1bd')],_0x1dde63['startProgressive'])&&_[_0x3856('0x3a')](_0x1dde63[_0x3856('0x27')])&&!_[_0x3856('0x3a')](_0x1dde63[_0x3856('0x28')])){_0x1dde63['startPredictive']=moment()['format'](_0x3856('0xf7'));loggerPredictive[_0x3856('0x7a')](_0x1dde63[_0x3856('0x3d')],'started\x20in\x20predictive\x20at',_0x1dde63[_0x3856('0x27')]);this['averageHandleTime'](_0x1dde63[_0x3856('0x1bd')])[_0x3856('0xaf')](this['getDataPredictive'](_0x1dde63))[_0x3856('0xaf')](mergeDataErlangB(_0x1dde63))[_0x3856('0xaf')](this['startMethodPredictive'](_0x1dde63))['catch'](loggerCatchPredictive(_0x3856('0x1c4'),_0x1dde63));}else if(!ifInterval(_0x1dde63[_0x3856('0x1bd')],_0x1dde63[_0x3856('0x27')])){_0x1dde63[_0x3856('0x108')]=0x0;_0x1dde63[_0x3856('0x27')]=moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3856('0x7a')](_0x1dde63['name'],'recalculate\x20predictive\x20at',_0x1dde63['startPredictive']);clearInterval(_0x1dde63[_0x3856('0x89')]);_0x1dde63[_0x3856('0x89')]=undefined;this[_0x3856('0xb1')](_0x1dde63[_0x3856('0x1bd')])['then'](this[_0x3856('0x1c5')](_0x1dde63))[_0x3856('0xaf')](mergeDataErlangB(_0x1dde63))[_0x3856('0xaf')](this[_0x3856('0x1c6')](_0x1dde63))[_0x3856('0xad')](loggerCatchPredictive(_0x3856('0x1c7'),_0x1dde63));}else if(_0x1dde63[_0x3856('0x6e')]&&_0x22324b<_0x1dde63['predictiveIntervalAvailable']-_0x5934cd){freeVariablesPredictive(_0x1dde63);loggerPredictive['info'](_0x1dde63[_0x3856('0x3d')],_0x3856('0x1c8'),_0x22324b,_0x3856('0x1c9'),_0x1dde63['predictiveIntervalAvailable'],'-',_0x5934cd,'=',_0x1dde63[_0x3856('0x6e')]-_0x5934cd,')');}else if(_0x1dde63[_0x3856('0x6e')]&&_0x22324b>_0x1dde63['predictiveIntervalAvailable']+_0x46be83){freeVariablesPredictive(_0x1dde63);loggerPredictive[_0x3856('0x7a')](_0x1dde63[_0x3856('0x3d')],_0x3856('0x1c8'),_0x22324b,_0x3856('0x1ca'),_0x1dde63['predictiveIntervalAvailable'],'+',_0x46be83,'=',_0x1dde63[_0x3856('0x6e')]+_0x46be83,')');}};Dialer[_0x3856('0xa1')][_0x3856('0x1c5')]=function(_0x3d9a02){var _0x5b84c1=this;return function(_0x501d96){return new BPromise(function(_0xc14a6a,_0x59b2a3){_['merge'](_0x3d9a02,_0x501d96[0x0]);if(checkGetDataPredictive(_0x501d96[0x0])){var _0x22dd9a=_0x3d9a02[_0x3856('0x6e')]=_0x3d9a02[_0x3856('0x53')]+_0x3d9a02[_0x3856('0x98')];var _0x486232=_0x3d9a02[_0x3856('0x1bd')]*0x3c;var _0x3302cb=_0x501d96[0x0]['predictiveIntervalAvgTalktime']+_0x501d96[0x0]['predictiveIntervalAvgHoldtime'];var _0x5584c3=(_0x501d96[0x0]['predictiveIntervalAnsweredCalls']+_0x501d96[0x0][_0x3856('0x107')]+_0x501d96[0x0][_0x3856('0x69')])/_0x501d96[0x0][_0x3856('0x6f')];_0x3d9a02[_0x3856('0x6b')]=_0x5584c3>0x0?_0x5584c3:0x1;switch(_0x3d9a02[_0x3856('0x1bf')]){case _0x3856('0x1c1'):var _0x3daf1d=_0x3d9a02[_0x3856('0x1b7')]/0x64;return _0x5b84c1[_0x3856('0x1cb')](_0x22dd9a,_0x486232,_0x3302cb,_0x5584c3,_0x3daf1d)['then'](function(_0x53909e){return _0xc14a6a(_0x53909e);});case _0x3856('0x1cc'):var _0x288a16=_0x3d9a02['dialPredictiveOptimizationPercentage']/0x64;return _0x5b84c1[_0x3856('0x1cd')](_0x22dd9a,_0x486232,_0x3302cb,_0x5584c3,_0x288a16)[_0x3856('0xaf')](function(_0xa4b15){return _0xc14a6a(_0xa4b15);});default:return _0x59b2a3(msgResponse(_0x3856('0x1ce'),_0x3856('0x134'),_0x3856('0x1cf')));}}else{return _0x59b2a3(msgResponse(_0x3856('0x1ce'),_0x3856('0x134'),_0x3856('0x1d0')));}});};};Dialer[_0x3856('0xa1')]['getDataPredictiveOld']=function(_0x56668d){var _0xbff33e=this;return function(_0x141a3a){return new BPromise(function(_0x2f23e8,_0x33b4a1){_[_0x3856('0x88')](_0x56668d,_0x141a3a[0x0]);if(checkGetDataPredictive(_0x141a3a[0x0])){loggerPredictive['info'](JSON[_0x3856('0x48')](_0x141a3a[0x0]));if(_0x56668d[_0x3856('0x1bf')]===_0x3856('0x1c1')){return _0xbff33e[_0x3856('0xbb')](_0x56668d['id'])['then'](function(_0x30f21e){var _0x11c0d1=_0x56668d[_0x3856('0x4f')]-_0x30f21e[0x0][_0x3856('0x1d1')];var _0x2ac03d=_0x56668d[_0x3856('0x1bd')]*0x3c;var _0x42e9aa=_0x141a3a[0x0][_0x3856('0x68')]+_0x141a3a[0x0]['predictiveIntervalAvgHoldtime'];var _0x252cb0=(_0x141a3a[0x0][_0x3856('0x7c')]+_0x141a3a[0x0][_0x3856('0x107')]+_0x141a3a[0x0][_0x3856('0x69')])/_0x141a3a[0x0][_0x3856('0x6f')];var _0x5caf95=_0x56668d[_0x3856('0x1b7')]/0x64;_0x56668d['predictiveIntervalPauses']=_0x30f21e[0x0][_0x3856('0x1d1')]||0x0;_0x56668d['predictiveIntervalHitRate']=_0x252cb0>0x0?_0x252cb0:0x1;return _0xbff33e[_0x3856('0x1cb')](_0x11c0d1,_0x2ac03d,_0x42e9aa,_0x252cb0,_0x5caf95);})[_0x3856('0xaf')](function(_0x442b3d){return _0x2f23e8(_0x442b3d);})[_0x3856('0xad')](function(_0x1f4ce9){return _0x33b4a1(msgResponse(_0x3856('0x1d2'),'Failure',JSON[_0x3856('0x48')](_0x1f4ce9)));});}if(_0x56668d[_0x3856('0x1bf')]===_0x3856('0x1cc')){return _0xbff33e[_0x3856('0xbb')](_0x56668d['id'])['then'](function(_0x4091b2){var _0x279f69=_0x56668d['loggedIn']-_0x4091b2[0x0][_0x3856('0x1d1')];var _0x338c15=_0x56668d[_0x3856('0x1bd')]*0x3c;var _0x589e34=_0x141a3a[0x0][_0x3856('0x68')]+_0x141a3a[0x0][_0x3856('0x67')];var _0x468071=(_0x141a3a[0x0]['predictiveIntervalAnsweredCalls']+_0x141a3a[0x0][_0x3856('0x107')]+_0x141a3a[0x0][_0x3856('0x69')])/_0x141a3a[0x0][_0x3856('0x6f')];var _0x3ed27c=_0x56668d[_0x3856('0x1b7')]/0x64;_0x56668d[_0x3856('0x6d')]=_0x4091b2[0x0]['outboundQueuePauses']||0x0;_0x56668d[_0x3856('0x6b')]=_0x468071>0x0?_0x468071:0x1;return _0xbff33e['busyFactor'](_0x279f69,_0x338c15,_0x589e34,_0x468071,_0x3ed27c);})[_0x3856('0xaf')](function(_0x27841b){return _0x2f23e8(_0x27841b);})[_0x3856('0xad')](function(_0x1e420c){return _0x33b4a1(msgResponse('[CatchErlangB]',_0x3856('0x134'),JSON['stringify'](_0x1e420c)));});}}else{return _0x33b4a1(msgResponse(_0x3856('0x1ce'),_0x3856('0x134'),_0x3856('0x1d0')));}});};};Dialer[_0x3856('0xa1')][_0x3856('0x1c6')]=function(_0xdb1231){var _0x1c3c7f=this;return function(){var _0x521084=0x0;var _0x596b95=Math['floor'](_0xdb1231[_0x3856('0x71')]*0x3e8);if(_0x596b95>0x0){_0x596b95=_0x596b95<0x64?0x64:_0x596b95;loggerPredictive[_0x3856('0x7a')](_0xdb1231[_0x3856('0x3d')],'one\x20call\x20every:',_0x596b95,_0x3856('0x49'));_0xdb1231['handlePredictive']=setInterval(function(){_0x1c3c7f[_0x3856('0x89')](_0xdb1231);loggerPredictiveCalls['info']('[handlePredictive]',_0x521084+=0x1);},_0x596b95);}else{loggerPredictive[_0x3856('0x7a')](_0xdb1231[_0x3856('0x3d')],_0x3856('0x1d3'));}};};Dialer[_0x3856('0xa1')][_0x3856('0x1d4')]=function(_0x468a77,_0x4e214e){var _0x332a7c=this;return function(_0xecf191){if(_[_0x3856('0x45')](_0xecf191)){if(_[_0x3856('0xd2')](_0x4e214e[_0x3856('0xc9')])||!_0x4e214e[_0x3856('0x1d5')]){if(_0x468a77[_0x3856('0x58')]==='booked'){_0x468a77[_0x3856('0x122')]=_[_0x3856('0x3a')](_0x468a77[_0x3856('0x122')])?!![]:_0x468a77['queueStatusComplete'];var _0x1eda2f=uuid['v4']();_0x332a7c[_0x3856('0x24')][_0x1eda2f]=new Action(_0x468a77,_0x4e214e,_0x1eda2f);loggerBooked[_0x3856('0x7a')](_0x3856('0x1d6'),_0x1eda2f,_0x3856('0x1d7'),JSON[_0x3856('0x48')](_0x468a77[_0x3856('0x122')]),_0x3856('0x1d8'),_0x468a77[_0x3856('0x3d')]);if(_0x468a77[_0x3856('0x122')]){_0x468a77[_0x3856('0x122')]=![];_0x332a7c[_0x3856('0x2a')][_0x332a7c['actions'][_0x1eda2f][_0x3856('0xa9')]]=[];ami[_0x3856('0xa3')]({'actionid':_0x1eda2f,'action':'queuestatus','queue':_0x468a77['name']})[_0x3856('0xad')](function(){_0x332a7c[_0x3856('0xa8')](_0x468a77);_0x332a7c[_0x3856('0xb4')]({'active':![],'ContactId':_0x332a7c[_0x3856('0x24')][_0x1eda2f][_0x3856('0xc7')],'ListId':_0x332a7c['actions'][_0x1eda2f][_0x3856('0xc8')],'VoiceQueueId':_0x332a7c['actions'][_0x1eda2f]['VoiceQueueId']||undefined,'CampaignId':_0x332a7c[_0x3856('0x24')][_0x1eda2f][_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x332a7c[_0x3856('0x24')][_0x1eda2f];});}else{loggerBooked[_0x3856('0x7a')]('[booked][checkContactBlack][else]',JSON[_0x3856('0x48')](_0x468a77['queueStatusComplete']),_0x3856('0x1d8'),_0x468a77[_0x3856('0x3d')]);_0x332a7c[_0x3856('0xa8')](_0x468a77);_0x332a7c['rescheduleContact']({'active':![],'ContactId':_0x332a7c['actions'][_0x1eda2f][_0x3856('0xc7')],'ListId':_0x332a7c[_0x3856('0x24')][_0x1eda2f][_0x3856('0xc8')],'VoiceQueueId':_0x332a7c['actions'][_0x1eda2f][_0x3856('0xca')]||undefined,'CampaignId':_0x332a7c[_0x3856('0x24')][_0x1eda2f]['CampaignId']||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x1d9')));delete _0x332a7c[_0x3856('0x24')][_0x1eda2f];}}else{return _0x332a7c[_0x3856('0x155')](_0x468a77,_0x4e214e);}}else{if(getDiff(_0x4e214e[_0x3856('0x1da')])<_0x468a77[_0x3856('0x1db')]*0x3c){if(_0x4e214e[_0x3856('0x1dc')]&&!_0x4e214e[_0x3856('0x1dc')]['voicePause']){_0x332a7c[_0x3856('0x1d')][_0x3856('0x12b')](_0x4e214e['id'])[_0x3856('0x1b')](function(){_0x332a7c[_0x3856('0xa8')](_0x468a77);});}else{_0x332a7c[_0x3856('0xb6')]({'active':![]},_0x4e214e['id'],0x1)[_0x3856('0x1b')](function(){_0x332a7c[_0x3856('0xa8')](_0x468a77);});}}else{_0x468a77['outboundReCallsDay']+=0x1;_0x332a7c[_0x3856('0xa8')](_0x468a77);if(_0x468a77[_0x3856('0x1dd')]){_0x332a7c[_0x3856('0xb4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e214e['ContactId'],'ListId':_0x4e214e[_0x3856('0xc8')],'VoiceQueueId':_0x4e214e[_0x3856('0xca')]||undefined,'CampaignId':_0x4e214e[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x1de')));_0x332a7c[_0x3856('0xbe')](createObjHistory(_0x468a77,_0x4e214e,'RECALLINQUEUE',0x17,_0x3856('0x1df')))['catch'](loggerCatch(_0x3856('0x1e0')));}else{_0x332a7c[_0x3856('0xc5')](createObjHistory(_0x468a77,_0x4e214e,'RECALLFAILEDTIMEOUT',0x16,_0x3856('0x1e1')),'[Originate][HistoryRecallClose][historyCatch]',_0x3856('0x1e2'));}}}}else{_0x468a77[_0x3856('0x1e3')]+=0x1;_0x332a7c[_0x3856('0xc5')](createObjHistory(_0x468a77,_0x4e214e,'BLACKLIST',0xd,_0x3856('0x1e4')),_0x3856('0x1e5'),_0x3856('0x1e6'));throw _0x3856('0x1e7');}};};Dialer['prototype'][_0x3856('0x1e8')]=function(_0x3e441f){var _0x506a47=this;var _0x4698c3=_0x3e441f['limitCalls']-_0x3e441f[_0x3856('0x70')]-_0x3e441f[_0x3856('0x1e9')];emitCampaignSummary(_0x3e441f);if(_0x4698c3>0x0){if(_0x4698c3>this[_0x3856('0x22')]){_0x4698c3=this[_0x3856('0x22')];}_0x3e441f[_0x3856('0x1e9')]+=_0x4698c3;this[_0x3856('0xba')](_0x3e441f['id'],_0x4698c3,_0x3e441f['dialOrderByScheduledAt'])[_0x3856('0xaf')](function(_0x31a82b){_0x3e441f['temp']-=_0x4698c3;_0x3e441f[_0x3856('0x1e9')]=_0x3e441f['temp']>0x0?_0x3e441f['temp']:0x0;if(!checkContactEmpty(_0x31a82b)){_0x3e441f['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x3856('0x1ea')+_0x3e441f[_0x3856('0x3d')]);}else{_0x3e441f[_0x3856('0x70')]+=_0x31a82b[_0x3856('0x125')];_0x3e441f[_0x3856('0x3b')]='RUNNING';for(var _0x475c93=0x0;_0x475c93<_0x31a82b[_0x3856('0x125')];_0x475c93+=0x1){_0x3e441f[_0x3856('0x1eb')]+=0x1;if(_['isNil'](_0x31a82b[_0x475c93])||_[_0x3856('0xd2')](_0x31a82b[_0x475c93][_0x3856('0x159')])||_[_0x3856('0xd2')](_0x31a82b[_0x475c93]['Contact'][_0x3856('0x15a')])){_0x506a47['emptyContact']('[actionOriginate]\x20',_0x3e441f,_0x31a82b[_0x475c93]);}else{_0x506a47[_0x3856('0x1ec')](_[_0x3856('0xc6')](_0x31a82b[_0x475c93],[_0x3856('0xcb'),_0x3856('0x1ed')]))[_0x3856('0xaf')](_0x506a47['checkContactBlack'](_0x3e441f,_0x31a82b[_0x475c93]))[_0x3856('0xad')](_0x506a47[_0x3856('0xc2')]('[actionOriginateIvr]\x20',_0x3e441f));}}}})[_0x3856('0xad')](loggerGetContactDialer(_0x3856('0x1ee'),_0x3e441f,_0x4698c3));}};Dialer[_0x3856('0xa1')]['handlePower']=function(_0x5b629e,_0x700a6d){var _0x365099=this;var _0x3151a2=[];var _0x4ce706=_0x700a6d>=0x1?_0x700a6d:0x1;if(_0x5b629e[_0x3856('0x58')]===_0x3856('0x9')){_0x4ce706=0x1;}var _0x23c38d=Math[_0x3856('0x1ef')](_0x5b629e['available']*_0x4ce706)-_0x5b629e[_0x3856('0x70')]-_0x5b629e['temp'];emitVoiceQueueSummary(_0x5b629e);if(_0x5b629e[_0x3856('0x1f0')]>0x0){var _0x10c781=_0x5b629e[_0x3856('0x1f0')]-_0x5b629e['originated']-_0x5b629e[_0x3856('0x53')]-_0x5b629e[_0x3856('0x1e9')]-_0x5b629e[_0x3856('0x50')];if(_0x23c38d>_0x10c781){_0x23c38d=_0x10c781;}}if(_0x23c38d>0x0){if(_0x5b629e[_0x3856('0x58')]===_0x3856('0x9')){_0x23c38d=0x1;}if(_0x23c38d>this[_0x3856('0x22')]){_0x23c38d=this[_0x3856('0x22')];}_0x5b629e['temp']+=_0x23c38d;for(var _0x2a889c in this[_0x3856('0x20')]){if(typeof this[_0x3856('0x20')][_0x2a889c]!==_0x3856('0xa2')){if(this[_0x3856('0x20')][_0x2a889c][_0x3856('0x9e')]===_0x3856('0x1f1')&&this[_0x3856('0x20')][_0x2a889c]['status']===_0x3856('0x1f2')){_0x3151a2['push'](this['agents'][_0x2a889c]['id']);}}}this[_0x3856('0xb8')](_0x5b629e['id'],_0x3151a2,_0x23c38d,_0x5b629e[_0x3856('0x1f3')])[_0x3856('0xaf')](function(_0x222bee){_0x5b629e['temp']-=_0x23c38d;_0x5b629e[_0x3856('0x1e9')]=_0x5b629e[_0x3856('0x1e9')]>0x0?_0x5b629e[_0x3856('0x1e9')]:0x0;if(!checkContactEmpty(_0x222bee)){_0x365099[_0x3856('0xab')](_0x5b629e)[_0x3856('0xaf')](sendMessageReschedule(_0x5b629e))[_0x3856('0xad')](loggerCatch(_0x3856('0x1f4')));}else{_0x5b629e[_0x3856('0x70')]+=_0x222bee[_0x3856('0x125')];_0x5b629e[_0x3856('0x3b')]=_0x5b629e['dialMethod']===_0x3856('0x9')?_0x3856('0x163'):_0x3856('0x1f5');for(var _0x18c3c3=0x0;_0x18c3c3<_0x222bee[_0x3856('0x125')];_0x18c3c3+=0x1){if(_['isNil'](_0x222bee[_0x18c3c3])||_['isNil'](_0x222bee[_0x18c3c3][_0x3856('0x159')])||_['isNil'](_0x222bee[_0x18c3c3][_0x3856('0x159')][_0x3856('0x15a')])){_0x365099[_0x3856('0xc3')](_0x3856('0x1f6'),_0x5b629e,_0x222bee[_0x18c3c3]);}else{_0x365099[_0x3856('0xae')](_['pick'](_0x222bee[_0x18c3c3],[_0x3856('0xca'),_0x3856('0x1ed')]))['then'](_0x365099[_0x3856('0x1d4')](_0x5b629e,_0x222bee[_0x18c3c3]))[_0x3856('0xad')](_0x365099['loggerHandler'](_0x3856('0x1f6'),_0x5b629e));}}}})[_0x3856('0xad')](loggerGetContactDialer('[getContactDialer2]',_0x5b629e,_0x23c38d));}};Dialer['prototype']['handlePredictive']=function(_0x47f13f){if(_0x47f13f['dialLimitQueue']>0x0){var _0x579cdf=_0x47f13f[_0x3856('0x1f0')]-_0x47f13f['originated']-_0x47f13f['talking'];if(_0x579cdf>0x0){this[_0x3856('0x1f7')](_0x47f13f);}else{loggerPredictiveCalls[_0x3856('0x7a')](_0x3856('0x1f8'));}}else{this[_0x3856('0x1f7')](_0x47f13f);}};Dialer[_0x3856('0xa1')]['tryOriginatePredictive']=function(_0x2adc4a){var _0x4fc9de=this;var _0x157518=[];_0x2adc4a['originated']+=0x1;for(var _0x3704f0 in this['agents']){if(typeof this['agents'][_0x3704f0]!=='undefined'){if(this[_0x3856('0x20')][_0x3704f0][_0x3856('0x9e')]===_0x3856('0x1f1')&&this[_0x3856('0x20')][_0x3704f0][_0x3856('0xa4')]===_0x3856('0x1f2')){_0x157518[_0x3856('0x120')](this['agents'][_0x3704f0]['id']);}}}this[_0x3856('0xb8')](_0x2adc4a['id'],_0x157518,0x1,_0x2adc4a[_0x3856('0x1f3')])[_0x3856('0xaf')](function(_0x19e337){if(!checkContactEmpty(_0x19e337)){checkContactLowerLimitOriginate(_0x2adc4a,0x1,0x0);_0x4fc9de[_0x3856('0xab')](_0x2adc4a)[_0x3856('0xaf')](sendMessageReschedule(_0x2adc4a))[_0x3856('0xad')](loggerCatch(_0x3856('0x1f4')));}else{_0x2adc4a[_0x3856('0x3b')]=_0x3856('0x1f5');if(_[_0x3856('0xd2')](_0x19e337[0x0])||_[_0x3856('0xd2')](_0x19e337[0x0]['Contact'])||_[_0x3856('0xd2')](_0x19e337[0x0][_0x3856('0x159')][_0x3856('0x15a')])){_0x4fc9de[_0x3856('0xc3')](_0x3856('0x1f6'),_0x2adc4a,_0x19e337[0x0]);}else{_0x4fc9de['checkIsBlackList'](_[_0x3856('0xc6')](_0x19e337[0x0],[_0x3856('0xca'),'Contact.phone']))['then'](_0x4fc9de['checkContactBlack'](_0x2adc4a,_0x19e337[0x0]))[_0x3856('0xad')](_0x4fc9de[_0x3856('0xc2')](_0x3856('0x1f9'),_0x2adc4a));}}})[_0x3856('0xad')](loggerGetContactDialer(_0x3856('0x1fa'),_0x2adc4a,0x1));emitVoiceQueueSummary(_0x2adc4a);};Dialer[_0x3856('0xa1')][_0x3856('0x1cb')]=function(_0x50bc88,_0x8d7af5,_0x20e27e,_0x260a77,_0x2e4895,_0xa00c81){loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fb'));loggerPredictive['info'](_0x3856('0x1fc'),_0x50bc88);loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fd'),_0x8d7af5);loggerPredictive[_0x3856('0x7a')]('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',_0x20e27e);loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fe'),_0x260a77);loggerPredictive[_0x3856('0x7a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e4895);loggerPredictive['info'](_0x3856('0x80'));return new BPromise(function(_0x3e4800,_0x344f47){if(_0x50bc88<=0x0||isNaN(_0x50bc88)){return _0x344f47(msgResponse(_0x3856('0x1ff'),_0x3856('0x47'),'m\x20=\x20'+_0x50bc88));}if(_0x20e27e<=0x0||isNaN(_0x20e27e)){return _0x344f47(msgResponse(_0x3856('0x1ff'),_0x3856('0x47'),_0x3856('0x200')+_0x20e27e));}if(_0x260a77<=0x0||isNaN(_0x260a77)){return _0x344f47(msgResponse(_0x3856('0x1ff'),_0x3856('0x47'),_0x3856('0x201')+_0x260a77));}if(_0x8d7af5<=0x0||isNaN(_0x8d7af5)){return _0x344f47(msgResponse('[abandonmentRate]',_0x3856('0x47'),'interval\x20=\x20'+_0x8d7af5));}if(_0x2e4895<=0x0||isNaN(_0x2e4895)){return _0x344f47(msgResponse('[abandonmentRate]',_0x3856('0x47'),_0x3856('0x202')+_0x2e4895));}_0xa00c81=_0xa00c81||0x0;var _0x3c865b=0x1/_0x20e27e;var _0x406be6=0x0;var _0x45db9c=0x0;var _0x42dda6=0x0;var _0xf8da6e=0x0;for(var _0x580a7e=0x0;_0x42dda6<_0x2e4895;_0x580a7e+=0x1){_0x45db9c=_0x580a7e/_0x8d7af5;_0x406be6=(_0x260a77*_0x45db9c+_0xa00c81)/_0x3c865b;_0x42dda6=erlangb(_0x406be6,_0x50bc88);_0xf8da6e=_0x406be6/_0x50bc88*(0x1-erlangb(_0x406be6,_0x50bc88));}return _0x3e4800({'erlangCalls':_0x580a7e,'erlangCallToSecond':_0x8d7af5/_0x580a7e,'erlangAbandonmentRate':_0x42dda6,'erlangBusyFactor':_0xf8da6e});});};Dialer[_0x3856('0xa1')][_0x3856('0x1cd')]=function(_0x37070f,_0x5b5627,_0x444f6d,_0x244214,_0x1f3477,_0x2a5d6b){loggerPredictive[_0x3856('0x7a')](_0x3856('0x203'));loggerPredictive['info'](_0x3856('0x1fc'),_0x37070f);loggerPredictive[_0x3856('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5627);loggerPredictive[_0x3856('0x7a')](_0x3856('0x204'),_0x444f6d);loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fe'),_0x244214);loggerPredictive[_0x3856('0x7a')](_0x3856('0x205'),_0x1f3477);loggerPredictive[_0x3856('0x7a')]('---------------------------');return new BPromise(function(_0x13432d,_0x456415){if(_0x37070f<=0x0||isNaN(_0x37070f)){return _0x456415(msgResponse(_0x3856('0x206'),_0x3856('0x47'),_0x3856('0x207')+_0x37070f));}if(_0x444f6d<=0x0||isNaN(_0x444f6d)){return _0x456415(msgResponse(_0x3856('0x206'),_0x3856('0x47'),'Ts\x20=\x20'+_0x444f6d));}if(_0x244214<=0x0||isNaN(_0x244214)){return _0x456415(msgResponse(_0x3856('0x206'),'Error','p\x20=\x20'+_0x244214));}if(_0x5b5627<=0x0||isNaN(_0x5b5627)){return _0x456415(msgResponse('[busyFactor]',_0x3856('0x47'),_0x3856('0x208')+_0x5b5627));}if(_0x1f3477<=0x0||isNaN(_0x1f3477)){return _0x456415(msgResponse(_0x3856('0x206'),_0x3856('0x47'),_0x3856('0x209')+_0x1f3477));}_0x2a5d6b=_0x2a5d6b||0x0;var _0x477a36=0x1/_0x444f6d;var _0x47d34a=0x0;var _0x484543=0x0;var _0x5c553f=0x0;var _0x7c5612=0x0;for(var _0xaeffcc=0x0;_0x7c5612<_0x1f3477;_0xaeffcc+=0x1){_0x484543=_0xaeffcc/_0x5b5627;_0x47d34a=(_0x244214*_0x484543+_0x2a5d6b)/_0x477a36;_0x5c553f=erlangb(_0x47d34a,_0x37070f);_0x7c5612=_0x47d34a/_0x37070f*(0x1-erlangb(_0x47d34a,_0x37070f));}return _0x13432d({'erlangCalls':_0xaeffcc,'erlangCallToSecond':_0x5b5627/_0xaeffcc,'erlangAbandonmentRate':_0x5c553f,'erlangBusyFactor':_0x7c5612});});};module['exports']=Dialer; \ No newline at end of file +var _0x1ee4=['launchHandleIvr','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','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','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','ioredis','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','127.0.0.1','rrmemory','roundrobin','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','diff','seconds','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','voice:queue:%s','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','prototype','[uniqueid]','clearZombieChannels','[actions]','undefined','enqueue','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','isNil','variable','amdstatus','exten','dialAMDActive','value','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','uniqueid','Machine','countglobal','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','reason19\x20machine....','dialMachineMaxRetry','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','countabandonedretry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actions','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized'];(function(_0x18a16d,_0x199976){var _0x21cf0c=function(_0x2717d1){while(--_0x2717d1){_0x18a16d['push'](_0x18a16d['shift']());}};_0x21cf0c(++_0x199976);}(_0x1ee4,0xbe));var _0x41ee=function(_0x39092d,_0x590ed8){_0x39092d=_0x39092d-0x0;var _0x4eb0ad=_0x1ee4[_0x39092d];return _0x4eb0ad;};'use strict';var util=require(_0x41ee('0x0'));var _=require(_0x41ee('0x1'));var BPromise=require(_0x41ee('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x41ee('0x3'));var ut=require(_0x41ee('0x4'));var config=require('../../../config/environment/');var logger=require(_0x41ee('0x5'))(_0x41ee('0x6'));var loggerBooked=require(_0x41ee('0x5'))('booked');var loggerPredictive=require(_0x41ee('0x5'))(_0x41ee('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x41ee('0x8'));var loggerSyncQueueSummary=require(_0x41ee('0x5'))(_0x41ee('0x9'));var ami=require(_0x41ee('0xa'));config[_0x41ee('0xb')]=_['defaults'](config['redis'],{'host':_0x41ee('0xc'),'port':0x18eb});var io=require(_0x41ee('0xd'))(new Redis(config[_0x41ee('0xb')]));var cmHopper=require(_0x41ee('0xe'));var cmHopperHistory=require(_0x41ee('0xf'));var cmHopperBlack=require(_0x41ee('0x10'));var voiceQueueRt=require(_0x41ee('0x11'));var Action=require(_0x41ee('0x12'));var History=require(_0x41ee('0x13'));var Final=require(_0x41ee('0x14'));var AgentComplete=require(_0x41ee('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x41ee('0x16'));var ipAgi=process[_0x41ee('0x17')]['XCALLY_IP_AGI']||_0x41ee('0x18');var strategy={'rrmemory':_0x41ee('0x19'),'roundrobin':_0x41ee('0x1a')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x52247f){this[_0x41ee('0x1b')]=this[_0x41ee('0x1b')]?this[_0x41ee('0x1b')][_0x41ee('0x1c')](_0x52247f):_0x52247f();};function Dialer(_0x2ee998,_0xc97249){this[_0x41ee('0x1d')]=new Sequence();this[_0x41ee('0x1e')]=_0xc97249;this[_0x41ee('0x1f')]=_0x2ee998[_0x41ee('0x1f')];this[_0x41ee('0x20')]=_0x2ee998[_0x41ee('0x20')];this['agents']=_0x2ee998[_0x41ee('0x21')];this[_0x41ee('0x22')]=_0x2ee998[_0x41ee('0x22')];this[_0x41ee('0x23')]=config[_0x41ee('0x23')]||0x2;this[_0x41ee('0x24')]={};this['actions']={};this[_0x41ee('0x25')]={};this[_0x41ee('0x26')]={};this['optionPredictive']={};this[_0x41ee('0x27')]={};this[_0x41ee('0x28')]={};this[_0x41ee('0x29')]={};this[_0x41ee('0x2a')]={};this[_0x41ee('0x2b')]={};ami['on'](_0x41ee('0x2c'),this[_0x41ee('0x2d')][_0x41ee('0x2e')](this));ami['on']('queuecallerabandon',this[_0x41ee('0x2f')][_0x41ee('0x2e')](this));ami['on'](_0x41ee('0x30'),this[_0x41ee('0x31')]['bind'](this));ami['on'](_0x41ee('0x32'),this[_0x41ee('0x33')][_0x41ee('0x2e')](this));ami['on']('custom:queuesummary',this[_0x41ee('0x9')][_0x41ee('0x2e')](this));ami['on'](_0x41ee('0x34'),this[_0x41ee('0x35')][_0x41ee('0x2e')](this));ami['on'](_0x41ee('0x36'),this['syncNewExten'][_0x41ee('0x2e')](this));ami['on'](_0x41ee('0x37'),this[_0x41ee('0x38')]['bind'](this));ami['on'](_0x41ee('0x39'),this[_0x41ee('0x3a')][_0x41ee('0x2e')](this));ami['on'](_0x41ee('0x3b'),this[_0x41ee('0x3c')][_0x41ee('0x2e')](this));this['loopCampaigns']();this[_0x41ee('0x3d')]();}function isNotNull(_0x4e7ba5){return _0x4e7ba5!==null&&!_[_0x41ee('0x3e')](_0x4e7ba5);}function checkIsLoggedIn(_0x8fa1e9,_0x72023f){return function(){if(_0x72023f<=0x0){_0x8fa1e9[_0x41ee('0x3f')]=_0x41ee('0x40');throw _0x8fa1e9[_0x41ee('0x41')]+_0x41ee('0x42');}};}function isActive(_0x1b1f2d){return _0x1b1f2d;}function checkIsActive(_0x5ac644,_0x53724f){return function(){if(!isActive(_0x53724f)){_0x5ac644[_0x41ee('0x3f')]=_0x41ee('0x43');throw _0x5ac644[_0x41ee('0x41')]+_0x41ee('0x44');}};}function checkInterval(_0x240b03){return function(){if(!isNotNull(_0x240b03[_0x41ee('0x45')])){_0x240b03['message']=_0x41ee('0x46');throw _0x240b03['name']+_0x41ee('0x47');}if(!isNotNull(_0x240b03[_0x41ee('0x45')][_0x41ee('0x48')])){_0x240b03[_0x41ee('0x3f')]='INTERVAL_IS_NULL';throw _0x240b03[_0x41ee('0x41')]+_0x41ee('0x47');}if(!isNotNull(_['isEmpty'](_0x240b03[_0x41ee('0x45')]['Intervals']))){_0x240b03[_0x41ee('0x3f')]=_0x41ee('0x46');throw _0x240b03[_0x41ee('0x41')]+_0x41ee('0x47');}};}function msgResponse(_0x3fc07f,_0x3d0644,_0x1b1328){return{'action':_0x3fc07f,'response':_0x3d0644,'message':_0x1b1328,'stack':_0x1b1328};}function myreject(_0x104ff1){return function(_0x3365a1){return _0x104ff1(msgResponse('[ifTime][Action]',_0x41ee('0x49'),JSON[_0x41ee('0x4a')](_0x3365a1)));};}function getSeconds(_0x92bba2,_0x410128){var _0x3315c5=moment(_0x92bba2)[_0x41ee('0x4b')](0x0);var _0x5bb7b=moment(_0x410128)[_0x41ee('0x4b')](0x0);return _0x3315c5[_0x41ee('0x4c')](_0x5bb7b,_0x41ee('0x4d'));}function emit(_0x9ce67e,_0x155bbb,_0xa18199){io['to'](_0x9ce67e)['emit'](_0x155bbb,_0xa18199);}function emitVoiceQueueSummary(_0x1b5dce){if(_0x1b5dce['type']===_0x41ee('0x4e')){var _0x5b66e2={'id':_0x1b5dce['id'],'name':_0x1b5dce[_0x41ee('0x41')],'strategy':_0x1b5dce[_0x41ee('0x4f')],'answered':_0x1b5dce['answered'],'available':_0x1b5dce[_0x41ee('0x50')],'loggedIn':_0x1b5dce[_0x41ee('0x51')],'pTalking':_0x1b5dce[_0x41ee('0x52')],'sumBillable':_0x1b5dce[_0x41ee('0x53')],'sumDuration':_0x1b5dce[_0x41ee('0x54')],'sumHoldTime':_0x1b5dce[_0x41ee('0x55')]||0x0,'talking':_0x1b5dce[_0x41ee('0x56')],'total':_0x1b5dce['total'],'type':_0x1b5dce[_0x41ee('0x57')],'unmanaged':_0x1b5dce[_0x41ee('0x58')],'abandoned':_0x1b5dce[_0x41ee('0x59')],'waiting':_0x1b5dce[_0x41ee('0x5a')],'loggedInDb':_0x1b5dce[_0x41ee('0x5b')],'dialActive':_0x1b5dce[_0x41ee('0x5c')],'dialMethod':_0x1b5dce[_0x41ee('0x5d')],'dialOriginateCallerIdName':_0x1b5dce[_0x41ee('0x5e')],'dialOriginateCallerIdNumber':_0x1b5dce[_0x41ee('0x5f')],'dialOriginateTimeout':_0x1b5dce[_0x41ee('0x60')],'dialPrefix':_0x1b5dce[_0x41ee('0x61')],'outboundAnswerAgiCallsDay':_0x1b5dce[_0x41ee('0x62')],'outboundAnswerCallsDay':_0x1b5dce[_0x41ee('0x63')],'outboundBlacklistCallsDay':_0x1b5dce[_0x41ee('0x64')],'outboundBusyCallsDay':_0x1b5dce['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1b5dce[_0x41ee('0x65')],'outboundDropCallsDayACS':_0x1b5dce[_0x41ee('0x66')],'outboundDropCallsDayCallersExit':_0x1b5dce[_0x41ee('0x67')],'outboundDropCallsDayTimeout':_0x1b5dce['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1b5dce['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1b5dce['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1b5dce[_0x41ee('0x68')],'outboundReCallsDay':_0x1b5dce[_0x41ee('0x69')],'outboundRejectCallsDay':_0x1b5dce[_0x41ee('0x6a')],'outboundUnknownCallsDay':_0x1b5dce[_0x41ee('0x6b')],'predictiveIntervalAnsweredCalls':_0x1b5dce['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1b5dce[_0x41ee('0x6c')],'predictiveIntervalAvgTalktime':_0x1b5dce[_0x41ee('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x1b5dce['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1b5dce[_0x41ee('0x6e')],'predictiveIntervalErlangCalls':_0x1b5dce[_0x41ee('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x1b5dce[_0x41ee('0x70')],'predictiveIntervalHitRate':_0x1b5dce[_0x41ee('0x71')],'predictiveIntervalMultiplicativeFactor':_0x1b5dce[_0x41ee('0x72')],'predictiveIntervalPauses':_0x1b5dce[_0x41ee('0x73')],'predictiveIntervalAvailable':_0x1b5dce[_0x41ee('0x74')],'predictiveIntervalTotalCalls':_0x1b5dce[_0x41ee('0x75')],'message':_0x1b5dce[_0x41ee('0x3f')],'originated':_0x1b5dce[_0x41ee('0x76')],'erlangCalls':_0x1b5dce[_0x41ee('0x77')],'erlangCallToSecond':_0x1b5dce['erlangCallToSecond'],'erlangAbandonmentRate':_0x1b5dce[_0x41ee('0x78')],'erlangBusyFactor':_0x1b5dce[_0x41ee('0x79')],'startPredictive':_0x1b5dce[_0x41ee('0x27')],'startProgressive':_0x1b5dce[_0x41ee('0x28')]};if(_0x1b5dce['Trunk']){_0x5b66e2['Trunk']={'id':_0x1b5dce[_0x41ee('0x7a')]['id'],'name':_0x1b5dce[_0x41ee('0x7a')][_0x41ee('0x41')],'active':_0x1b5dce[_0x41ee('0x7a')][_0x41ee('0x7b')],'callerid':_0x1b5dce[_0x41ee('0x7a')][_0x41ee('0x7c')]};}if(_0x1b5dce[_0x41ee('0x45')]){_0x5b66e2[_0x41ee('0x45')]={'id':_0x1b5dce[_0x41ee('0x45')]['id'],'name':_0x1b5dce[_0x41ee('0x45')][_0x41ee('0x41')]};}var _0x590736=md5(JSON[_0x41ee('0x4a')](_0x5b66e2));if(_0x1b5dce[_0x41ee('0x7d')]!==_0x590736){_0x1b5dce[_0x41ee('0x7d')]=_0x590736;emit(util['format'](_0x41ee('0x7e'),_0x5b66e2[_0x41ee('0x41')]),'voice_queue:save',_0x5b66e2);}}}function emitCampaignSummary(_0x289dae){if(_0x289dae[_0x41ee('0x57')]===_0x41ee('0x7f')){emit(util[_0x41ee('0x80')](_0x41ee('0x81'),_0x289dae[_0x41ee('0x41')]),_0x41ee('0x82'),_0x289dae);}}function checkGetDataPredictive(_0x15c450){if(isNotNull(_0x15c450)&&!_['isEmpty'](_0x15c450)){loggerPredictive[_0x41ee('0x83')](_0x41ee('0x84'));loggerPredictive[_0x41ee('0x83')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x15c450[_0x41ee('0x75')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x85'),_0x15c450[_0x41ee('0x86')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x87'),_0x15c450[_0x41ee('0x6e')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x88'),_0x15c450[_0x41ee('0x89')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x15c450[_0x41ee('0x6c')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x8a'),_0x15c450[_0x41ee('0x6d')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x8b'));if(_0x15c450[_0x41ee('0x75')]>0x0){if(!_[_0x41ee('0x3e')](_0x15c450['predictiveIntervalAvgTalktime'])&&_0x15c450[_0x41ee('0x6d')]>0x0){return!![];}loggerPredictive['info'](_0x41ee('0x8c'));if(!_[_0x41ee('0x3e')](_0x15c450[_0x41ee('0x6c')])&&_0x15c450['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x41ee('0x83')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x41ee('0x83')](_0x41ee('0x8d'));}}else{loggerPredictive[_0x41ee('0x83')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2fb669){return function(_0x41af8e){loggerPredictive['info'](_0x41ee('0x8e'));loggerPredictive['info'](_0x41ee('0x8f'),_0x41af8e[_0x41ee('0x77')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x90'),_0x41af8e[_0x41ee('0x91')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x92'),_0x41af8e[_0x41ee('0x78')]);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x93'),_0x41af8e['erlangBusyFactor']);loggerPredictive[_0x41ee('0x83')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41af8e[_0x41ee('0x78')]);loggerPredictive[_0x41ee('0x83')]('---------------------------');_[_0x41ee('0x94')](_0x2fb669,_0x41af8e);};}function getDiff(_0x629fa0){var _0x2e7421=moment()[_0x41ee('0x4b')](0x0);var _0x37f0e3=moment(_0x629fa0)[_0x41ee('0x4b')](0x0);return _0x2e7421[_0x41ee('0x4c')](_0x37f0e3,_0x41ee('0x4d'));}function ifInterval(_0x25ed71,_0x46c894){if(_[_0x41ee('0x3e')](_0x46c894)){return![];}return getDiff(_0x46c894)<_0x25ed71*0x3c;}function freeVariablesPredictive(_0x23c9a6){if(isNotNull(_0x23c9a6)){if(!_[_0x41ee('0x3e')](_0x23c9a6[_0x41ee('0x28')])){_0x23c9a6[_0x41ee('0x28')]=undefined;loggerPredictive[_0x41ee('0x83')](_0x23c9a6['name'],_0x41ee('0x95'));}if(!_['isUndefined'](_0x23c9a6[_0x41ee('0x27')])){_0x23c9a6[_0x41ee('0x27')]=undefined;loggerPredictive[_0x41ee('0x83')](_0x23c9a6[_0x41ee('0x41')],_0x41ee('0x96'));}if(!_[_0x41ee('0x3e')](_0x23c9a6['handlePredictive'])){clearInterval(_0x23c9a6['handlePredictive']);_0x23c9a6[_0x41ee('0x97')]=undefined;loggerPredictive[_0x41ee('0x83')](_0x23c9a6[_0x41ee('0x41')],_0x41ee('0x98'));}}}function erlangb(_0x23f31,_0x56e6ec){if(_0x56e6ec===0x0){return 0x0;}var _0x605026=0x1;for(var _0x54a890=0x1;_0x54a890<=_0x56e6ec;_0x54a890+=0x1){_0x605026=0x1+_0x605026*_0x54a890/_0x23f31;}return 0x1/_0x605026;}function isVoiceQueueOutbound(_0x810418){return _0x810418==='outbound';}function isNotPreview(_0x393f25){return _0x393f25!=='preview';}function isCampaignIvr(_0x4cba6a){return _0x4cba6a===_0x41ee('0x7f');}function getCallerId(_0x4622d4,_0x5131fd,_0x44066d){if(!_[_0x41ee('0x3e')](_0x44066d)&&typeof _0x44066d===_0x41ee('0x99')&&!_[_0x41ee('0x9a')](_0x44066d)){if(!_[_0x41ee('0x3e')](_0x5131fd)&&typeof _0x5131fd==='string'&&!_[_0x41ee('0x9a')](_0x5131fd)){return util[_0x41ee('0x80')]('\x22%s\x22\x20<%s>',_0x5131fd,_0x44066d);}return util[_0x41ee('0x80')](_0x41ee('0x9b'),_0x44066d,_0x44066d);}if(!_[_0x41ee('0x3e')](_0x4622d4)&&typeof _0x4622d4==='string'&&!_[_0x41ee('0x9a')](_0x4622d4)){return _0x4622d4;}return _0x41ee('0x9c');}function loggerCatchQueueSummary(_0x3791b5,_0x9214f4){return function(_0x3064a2){freeVariablesPredictive(_0x9214f4);emitVoiceQueueSummary(_0x9214f4);emitCampaignSummary(_0x9214f4);loggerSyncQueueSummary[_0x41ee('0x9d')](_0x3791b5,util[_0x41ee('0x9e')](_0x3064a2,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3a7239,_0x313dee){return function(_0x232516){loggerPredictive['error'](_0x313dee[_0x41ee('0x41')],_0x3a7239);loggerPredictive['error'](_0x232516[_0x41ee('0x9f')]);freeVariablesPredictive(_0x313dee);};}function loggerCatch(_0x3e3291){return function(_0x62ebab){logger[_0x41ee('0x9d')](_0x3e3291,util[_0x41ee('0x9e')](_0x62ebab,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x569440){return _0x569440&&!_[_0x41ee('0x3e')](_0x569440)&&_0x569440[_0x41ee('0xa0')]>0x0;}function decremetOriginate(_0x5a0c78){if(!_['isUndefined'](_0x5a0c78)&&_0x5a0c78!==null){if(typeof _0x5a0c78['originated']!=='undefined'){if(_0x5a0c78[_0x41ee('0x76')]>0x0){_0x5a0c78[_0x41ee('0x76')]-=0x1;}else{logger[_0x41ee('0x9d')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x41ee('0x9d')](_0x41ee('0xa1'));}}function checkContactLowerLimitOriginate(_0x3f418b,_0x421850,_0x326a8e){if(_0x421850>_0x326a8e){for(var _0xb6a4c5=0x0;_0xb6a4c5<_0x421850-_0x326a8e;_0xb6a4c5+=0x1){decremetOriginate(_0x3f418b);}}}function loggerGetContactDialer(_0xf2777d,_0x4e8090,_0xe47a5b){return function(_0x477607){checkContactLowerLimitOriginate(_0x4e8090,_0xe47a5b,0x0);logger[_0x41ee('0x9d')](_0xf2777d,util[_0x41ee('0x9e')](_0x477607,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x6fa8a8){return function(_0xd05094){if(isNotNull(_0xd05094)&&isNotNull(_0xd05094[0x0])){if(_0xd05094[0x0]['contactsRescheduled']>0x0){_0x6fa8a8[_0x41ee('0x3f')]=_0x41ee('0xa2');logger[_0x41ee('0x83')](_0x41ee('0xa3')+_0x6fa8a8[_0x41ee('0x41')],_0xd05094[0x0][_0x41ee('0xa4')],'contacts');}else{_0x6fa8a8[_0x41ee('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x41ee('0x83')](_0x41ee('0xa5')+_0x6fa8a8[_0x41ee('0x41')]);}}};}function notSendMessagesQueue(_0xed45fb){if(_0xed45fb['sendMessageOneNotActive']){freeVariablesPredictive(_0xed45fb);if(_0xed45fb[_0x41ee('0x76')]===0x0&&_0xed45fb[_0x41ee('0x56')]===0x0&&_0xed45fb[_0x41ee('0x5a')]===0x0&&(_0xed45fb['pTalking']||0x0)===0x0){_0xed45fb[_0x41ee('0xa6')]=![];_0xed45fb[_0x41ee('0x50')]=0x0;_0xed45fb[_0x41ee('0x3f')]=_0x41ee('0x43');loggerSyncQueueSummary[_0x41ee('0x9d')](_0x41ee('0xa7'),_0xed45fb[_0x41ee('0x41')],_0x41ee('0xa8'));}else{_0xed45fb[_0x41ee('0x3f')]=_0x41ee('0xa9');loggerSyncQueueSummary[_0x41ee('0x9d')](_0x41ee('0xa7'),_0xed45fb[_0x41ee('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0xed45fb);}}function notSendMessagesCampaign(_0xbc53ba){if(_0xbc53ba[_0x41ee('0xa6')]){if(_0xbc53ba[_0x41ee('0x76')]===0x0){_0xbc53ba[_0x41ee('0xa6')]=![];_0xbc53ba['message']=_0x41ee('0x43');loggerSyncQueueSummary[_0x41ee('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xbc53ba[_0x41ee('0x41')],_0x41ee('0xa8'));}else{_0xbc53ba[_0x41ee('0x3f')]=_0x41ee('0xa9');loggerSyncQueueSummary[_0x41ee('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xbc53ba[_0x41ee('0x41')],_0x41ee('0xaa'));}emitCampaignSummary(_0xbc53ba);}}function createObjHistory(_0x3633e1,_0x4587cc,_0x5ad34a,_0x274fe6,_0x57998d){_0x3633e1[_0x41ee('0x3f')]=_0x5ad34a;var _0x2ae748=new Action(_0x3633e1,_0x4587cc);var _0x30b443=new History(_0x2ae748);_0x30b443[_0x41ee('0xab')]=_0x274fe6;_0x30b443[_0x41ee('0xac')]=_0x57998d;_0x30b443[_0x41ee('0xad')]=_0x2ae748[_0x41ee('0xae')];return _0x30b443;}Dialer[_0x41ee('0xaf')][_0x41ee('0x3d')]=function(){var _0x4001be=this;setInterval(function(){_0x4001be['clearZombieChannels'](_0x4001be[_0x41ee('0x26')],_0x41ee('0xb0'));_0x4001be[_0x41ee('0xb1')](_0x4001be['actions'],_0x41ee('0xb2'));},0x32c8);};Dialer[_0x41ee('0xaf')][_0x41ee('0xb1')]=function(_0x3afe55,_0x5ce4d6){var _0x1ad428=this;for(var _0x238495 in _0x3afe55){if(typeof _0x3afe55[_0x238495]!==_0x41ee('0xb3')){this[_0x41ee('0x1d')][_0x41ee('0xb4')](function(){if(!_['isNil'](_0x3afe55[_0x238495])){return ami[_0x41ee('0xb5')]({'action':_0x41ee('0xb6'),'channel':_0x3afe55[_0x238495][_0x41ee('0xb7')]})[_0x41ee('0xb8')](function(_0x8847b7){if(_0x8847b7['message']===_0x41ee('0xb9')){setTimeout(function(){if(_0x3afe55[_0x238495]&&_0x3afe55[_0x238495][_0x41ee('0x57')]!==_0x41ee('0x7f')){_0x1ad428[_0x41ee('0xba')](_0x1ad428[_0x41ee('0x1f')][_0x3afe55[_0x238495][_0x41ee('0xbb')]]);logger[_0x41ee('0x9d')](_0x41ee('0xbc'),_0x5ce4d6,_0x238495,_0x3afe55[_0x238495][_0x41ee('0xbb')]);delete _0x3afe55[_0x238495];}if(_0x3afe55[_0x238495]&&_0x3afe55[_0x238495][_0x41ee('0x57')]===_0x41ee('0x7f')){_0x1ad428[_0x41ee('0xba')](_0x1ad428['campaigns'][_0x3afe55[_0x238495][_0x41ee('0xbb')]]);logger[_0x41ee('0x9d')](_0x41ee('0xbd'),_0x5ce4d6,_0x238495,_0x3afe55[_0x238495]['queue']);delete _0x3afe55[_0x238495];}},0x2328);}});}});}}};Dialer[_0x41ee('0xaf')]['countReScheduled']=function(_0x216386){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopper[_0x41ee('0xc0')](_0x216386))['catch'](loggerCatch(_0x41ee('0xc1')));};Dialer[_0x41ee('0xaf')][_0x41ee('0xc2')]=function(_0x138bf3){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopperBlack[_0x41ee('0xc2')](_0x138bf3))[_0x41ee('0xb8')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x41ee('0xaf')][_0x41ee('0xc3')]=function(_0x2594c4){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x2594c4))['catch'](loggerCatch(_0x41ee('0xc4')));};Dialer['prototype']['averageHandleTime']=function(_0x2c7b2a){return BPromise[_0x41ee('0xbe')]()['then'](cmHopperHistory['avgHandleTime'](_0x2c7b2a))[_0x41ee('0xb8')](loggerCatch(_0x41ee('0xc5')));};Dialer[_0x41ee('0xaf')][_0x41ee('0xc6')]=function(_0x2f073e){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopper[_0x41ee('0xc6')](_0x2f073e))[_0x41ee('0xb8')](loggerCatch(_0x41ee('0xc7')));};Dialer['prototype'][_0x41ee('0xc8')]=function(_0x2bf67a,_0x5d64c9,_0xa0669c){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopper[_0x41ee('0xc8')](_0x2bf67a,_0x5d64c9,_0xa0669c))[_0x41ee('0xb8')](loggerCatch(_0x41ee('0xc9')));};Dialer[_0x41ee('0xaf')][_0x41ee('0xca')]=function(_0x3294c4,_0x3abc70,_0x25b96a,_0x472457){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopper[_0x41ee('0xca')](_0x3294c4,_0x3abc70,_0x25b96a,_0x472457))['catch'](loggerCatch(_0x41ee('0xcb')));};Dialer[_0x41ee('0xaf')][_0x41ee('0xcc')]=function(_0x3b4f23,_0x49e21c,_0x5a23c5){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopper['getContactDialerIvr'](_0x3b4f23,_0x49e21c,_0x5a23c5))['catch'](loggerCatch(_0x41ee('0xcb')));};Dialer[_0x41ee('0xaf')][_0x41ee('0xcd')]=function(_0x286a9d){return BPromise['resolve']()[_0x41ee('0xbf')](voiceQueueRt[_0x41ee('0xcd')](_0x286a9d))[_0x41ee('0xb8')](loggerCatch(_0x41ee('0xce')));};Dialer[_0x41ee('0xaf')][_0x41ee('0xcf')]=function(_0x5e2272){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopper[_0x41ee('0xcf')](_0x5e2272))['catch'](loggerCatch(_0x41ee('0xd0')));};Dialer[_0x41ee('0xaf')][_0x41ee('0xd1')]=function(_0x5e41bd){return BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](cmHopperHistory[_0x41ee('0xd1')](_0x5e41bd))[_0x41ee('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer[_0x41ee('0xaf')][_0x41ee('0xba')]=function(_0x2e7d8f){if(!_[_0x41ee('0x3e')](_0x2e7d8f)&&_0x2e7d8f!==null){if(typeof _0x2e7d8f['originated']!==_0x41ee('0xb3')){if(_0x2e7d8f[_0x41ee('0x76')]>0x0){_0x2e7d8f['originated']-=0x1;}else{logger[_0x41ee('0x9d')](_0x41ee('0xd2'));}}}else{logger['error'](_0x41ee('0xd3'));}};Dialer[_0x41ee('0xaf')]['loggerHandler']=function(_0x5a5d7e,_0x12ae6c){var _0xc10636=this;return function(_0x3293c6){_0xc10636['updateOriginated'](_0x12ae6c);logger[_0x41ee('0x9d')](_0x5a5d7e,util[_0x41ee('0x9e')](_0x3293c6,{'showHidden':![],'depth':null}));};};Dialer[_0x41ee('0xaf')][_0x41ee('0xd4')]=function(_0x281df5,_0x4eba3e,_0x48b066){var _0x387d79={'state':0x19,'statedesc':'notFound'};this[_0x41ee('0xba')](_0x4eba3e);this[_0x41ee('0xd5')](_['merge'](_0x387d79,_[_0x41ee('0xd6')](_0x48b066,[_0x41ee('0xd7'),_0x41ee('0xd8'),_0x41ee('0xd9'),_0x41ee('0xda'),_0x41ee('0xdb')])),_0x41ee('0xdc'),_0x41ee('0xdd'));logger[_0x41ee('0x9d')](_0x281df5);};Dialer['prototype'][_0x41ee('0xde')]=function(_0x2eaa9f){return _0x2eaa9f===_0x41ee('0xdf');};Dialer['prototype'][_0x41ee('0xe0')]=function(_0x16a83f){return!_[_0x41ee('0x3e')](_0x16a83f)&&_0x16a83f&&!_[_0x41ee('0x3e')](_0x16a83f[_0x41ee('0x41')])&&!_[_0x41ee('0x3e')](_0x16a83f[_0x41ee('0x7b')])&&_0x16a83f[_0x41ee('0x7b')]&&(this[_0x41ee('0x22')][util[_0x41ee('0x80')](_0x41ee('0xe1'),_0x16a83f['name'])][_0x41ee('0xb6')]===_0x41ee('0xe2')||this['trunks'][util[_0x41ee('0x80')]('SIP/%s',_0x16a83f[_0x41ee('0x41')])][_0x41ee('0xb6')]==='unmonitored');};Dialer['prototype']['saveInDb']=function(_0x21a406,_0x3fceba,_0x19b33d){this[_0x41ee('0xd1')](_0x21a406)['catch'](loggerCatch(_0x3fceba));this[_0x41ee('0xcf')](_0x21a406)[_0x41ee('0xb8')](loggerCatch(_0x19b33d));};Dialer[_0x41ee('0xaf')][_0x41ee('0x38')]=function(_0x138de2){var _0x481720=this[_0x41ee('0x26')][_0x138de2['uniqueid']];var _0x243392;if(!_['isNil'](_0x138de2)&&!_[_0x41ee('0xe3')](_0x138de2[_0x41ee('0xe4')])&&!_[_0x41ee('0xe3')](_0x138de2[_0x41ee('0xe4')][_0x41ee('0xe5')])&&_0x138de2[_0x41ee('0xe6')]==='xcally-motion-dialer'&&_0x481720){if(_0x481720['type']!==_0x41ee('0x7f')&&this[_0x41ee('0x1f')][_0x481720[_0x41ee('0xbb')]][_0x41ee('0xe7')]&&_0x138de2[_0x41ee('0xe8')]==='HANGUP'){delete this[_0x41ee('0x26')][_0x138de2['uniqueid']];this['updateOriginated'](this[_0x41ee('0x1f')][_0x481720['queue']]);this[_0x41ee('0x1f')][_0x481720['queue']][_0x41ee('0x63')]+=0x1;this[_0x41ee('0x1f')][_0x481720[_0x41ee('0xbb')]][_0x41ee('0x62')]+=0x1;_0x243392=new Hangup(_0x481720,_0x138de2);_0x243392[_0x41ee('0xab')]=0x12;_0x243392[_0x41ee('0xac')]='HangupInAMD';_0x243392[_0x41ee('0xe9')]=_0x41ee('0xea');this[_0x41ee('0xd5')](_0x243392,_0x41ee('0xeb'),_0x41ee('0xec'));}if(_0x481720[_0x41ee('0x57')]!==_0x41ee('0x7f')&&this[_0x41ee('0x1f')][_0x481720[_0x41ee('0xbb')]][_0x41ee('0xe7')]&&_0x138de2['value']===_0x41ee('0xed')){var _0x5c6646=this;return new BPromise(function(_0x4be6d8,_0x4f68de){delete _0x5c6646[_0x41ee('0x26')][_0x138de2[_0x41ee('0xee')]];_0x5c6646[_0x41ee('0xba')](_0x5c6646[_0x41ee('0x1f')][_0x481720[_0x41ee('0xbb')]]);_0x5c6646[_0x41ee('0x1f')][_0x481720[_0x41ee('0xbb')]][_0x41ee('0x63')]+=0x1;_0x5c6646[_0x41ee('0x1f')][_0x481720[_0x41ee('0xbb')]][_0x41ee('0x62')]+=0x1;var _0x287d0e=_0x5c6646[_0x41ee('0x1f')][_0x481720[_0x41ee('0xbb')]];var _0x1dcbe4=new Hangup(_0x481720,_0x138de2);_0x1dcbe4[_0x41ee('0xab')]=0x13;_0x1dcbe4[_0x41ee('0xac')]=_0x41ee('0xef');_0x1dcbe4['membername']=_0x41ee('0xea');_0x1dcbe4['countmachineretry']+=0x1;_0x1dcbe4[_0x41ee('0xf0')]+=0x1;_0x1dcbe4[_0x41ee('0xf1')]=!![];_0x5c6646[_0x41ee('0xd1')](_0x1dcbe4)[_0x41ee('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1dcbe4[_0x41ee('0xf2')]+_0x1dcbe4[_0x41ee('0xf3')]+_0x1dcbe4[_0x41ee('0xf4')]+_0x1dcbe4[_0x41ee('0xf5')]+_0x1dcbe4[_0x41ee('0xf6')]+_0x1dcbe4['countabandonedretry']+_0x1dcbe4[_0x41ee('0xf7')]+_0x1dcbe4[_0x41ee('0xf8')]>=_0x287d0e[_0x41ee('0xf9')]){_0x5c6646[_0x41ee('0xfa')](_0x1dcbe4,_0x4be6d8,_0x4f68de,'reason19\x20machine....');}else{if(_0x1dcbe4[_0x41ee('0xf7')]>=_0x287d0e['dialMachineMaxRetry']){_0x5c6646[_0x41ee('0xfb')](_0x1dcbe4,_0x4be6d8,_0x4f68de,_0x41ee('0xfc'));}else{_0x5c6646[_0x41ee('0xc6')]({'active':![],'countmachineretry':_0x1dcbe4[_0x41ee('0xf7')],'scheduledat':moment()[_0x41ee('0xfd')](_0x287d0e[_0x41ee('0xfe')],_0x41ee('0xff'))[_0x41ee('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1dcbe4[_0x41ee('0xd7')],'ListId':_0x1dcbe4[_0x41ee('0xd8')],'VoiceQueueId':_0x1dcbe4[_0x41ee('0xda')]||undefined,'CampaignId':_0x1dcbe4[_0x41ee('0xdb')]||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x100')));_0x4be6d8({'reschedule':0x1});}}});}if(_0x481720['type']===_0x41ee('0x7f')&&this[_0x41ee('0x20')][_0x481720[_0x41ee('0xbb')]]['dialAMDActive']&&_0x138de2[_0x41ee('0xe8')]===_0x41ee('0x101')){delete this[_0x41ee('0x26')][_0x138de2[_0x41ee('0xee')]];this[_0x41ee('0xba')](this[_0x41ee('0x20')][_0x481720[_0x41ee('0xbb')]]);_0x243392=new Hangup(_0x481720,_0x138de2);_0x243392[_0x41ee('0xab')]=0x12;_0x243392[_0x41ee('0xac')]='HangupInAMD';_0x243392[_0x41ee('0xe9')]=_0x41ee('0xea');this[_0x41ee('0xd5')](_0x243392,_0x41ee('0x102'),_0x41ee('0x103'));}if(_0x481720['type']===_0x41ee('0x7f')&&this[_0x41ee('0x20')][_0x481720[_0x41ee('0xbb')]][_0x41ee('0xe7')]&&_0x138de2[_0x41ee('0xe8')]===_0x41ee('0xed')){var _0x5c6646=this;return new BPromise(function(_0x5a6cff,_0x53a8d9){delete _0x5c6646[_0x41ee('0x26')][_0x138de2[_0x41ee('0xee')]];_0x5c6646[_0x41ee('0xba')](_0x5c6646['campaigns'][_0x481720[_0x41ee('0xbb')]]);_0x5c6646[_0x41ee('0x20')][_0x481720['queue']][_0x41ee('0x63')]+=0x1;_0x5c6646['campaigns'][_0x481720[_0x41ee('0xbb')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x59c57e=_0x5c6646['campaigns'][_0x481720[_0x41ee('0xbb')]];var _0x386b3a=new Hangup(_0x481720,_0x138de2);_0x386b3a['state']=0x13;_0x386b3a['statedesc']=_0x41ee('0xef');_0x386b3a['membername']=_0x41ee('0xea');_0x386b3a['countmachineretry']+=0x1;_0x386b3a[_0x41ee('0xf0')]+=0x1;_0x386b3a['amd']=!![];_0x5c6646[_0x41ee('0xd1')](_0x386b3a)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x104')));if(_0x386b3a[_0x41ee('0xf2')]+_0x386b3a[_0x41ee('0xf3')]+_0x386b3a['countnoanswerretry']+_0x386b3a[_0x41ee('0xf5')]+_0x386b3a[_0x41ee('0xf6')]+_0x386b3a['countabandonedretry']+_0x386b3a['countmachineretry']+_0x386b3a[_0x41ee('0xf8')]>=_0x59c57e[_0x41ee('0xf9')]){_0x5c6646[_0x41ee('0xfa')](_0x386b3a,_0x5a6cff,_0x53a8d9,_0x41ee('0x105'));}else{if(_0x386b3a[_0x41ee('0xf7')]>=_0x59c57e[_0x41ee('0x106')]){_0x5c6646[_0x41ee('0xfb')](_0x386b3a,_0x5a6cff,_0x53a8d9,_0x41ee('0xfc'));}else{_0x5c6646[_0x41ee('0xc6')]({'active':![],'countmachineretry':_0x386b3a[_0x41ee('0xf7')],'scheduledat':moment()['add'](_0x59c57e[_0x41ee('0xfe')],'minutes')[_0x41ee('0x80')](_0x41ee('0x107')),'ContactId':_0x386b3a['ContactId'],'ListId':_0x386b3a[_0x41ee('0xd8')],'VoiceQueueId':_0x386b3a[_0x41ee('0xda')]||undefined,'CampaignId':_0x386b3a[_0x41ee('0xdb')]||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x100')));_0x5a6cff({'reschedule':0x1});}}});}}};Dialer[_0x41ee('0xaf')][_0x41ee('0x35')]=function(_0x550529){var _0xa3896e=this[_0x41ee('0x26')][_0x550529['uniqueid']];var _0x409ed0=this;var _0x1d40dc;if(_0xa3896e&&_0xa3896e[_0x41ee('0x57')]==='ivr'){delete this[_0x41ee('0x26')][_0x550529[_0x41ee('0xee')]];this[_0x41ee('0xba')](this[_0x41ee('0x20')][_0xa3896e[_0x41ee('0xbb')]]);this[_0x41ee('0x20')][_0xa3896e[_0x41ee('0xbb')]][_0x41ee('0x108')]+=0x1;_0x1d40dc=new Hangup(_0xa3896e,_0x550529);this[_0x41ee('0xd1')](_0x1d40dc)['catch'](loggerCatch(_0x41ee('0x109')));this[_0x41ee('0xcf')](_0x1d40dc)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x10a')));}if(_0xa3896e&&_0xa3896e[_0x41ee('0x57')]!=='ivr'&&isNotNull(this[_0x41ee('0x1f')][_0xa3896e[_0x41ee('0xbb')]][_0x41ee('0x10b')])){delete this[_0x41ee('0x26')][_0x550529['uniqueid']];this[_0x41ee('0xba')](this['voiceQueues'][_0xa3896e[_0x41ee('0xbb')]]);this[_0x41ee('0x1f')][_0xa3896e['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x41ee('0x1f')][_0xa3896e['queue']][_0x41ee('0x62')]+=0x1;_0x1d40dc=new Hangup(_0xa3896e,_0x550529);_0x1d40dc[_0x41ee('0xab')]=0x10;_0x1d40dc[_0x41ee('0xac')]=_0x41ee('0x10c');_0x1d40dc['membername']=_0x41ee('0x10d');this[_0x41ee('0xd1')](_0x1d40dc)['catch'](loggerCatch(_0x41ee('0x109')));this[_0x41ee('0xcf')](_0x1d40dc)[_0x41ee('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0xa3896e&&_0xa3896e[_0x41ee('0x57')]!==_0x41ee('0x7f')&&!isNotNull(this[_0x41ee('0x1f')][_0xa3896e[_0x41ee('0xbb')]][_0x41ee('0x10b')])){delete this['uniqueId'][_0x550529[_0x41ee('0xee')]];this[_0x41ee('0xba')](this[_0x41ee('0x1f')][_0xa3896e[_0x41ee('0xbb')]]);this['voiceQueues'][_0xa3896e['queue']]['outboundUnknownCallsDay']+=0x1;_0x1d40dc=new Hangup(_0xa3896e,_0x550529);_0x1d40dc[_0x41ee('0xab')]=0xc;_0x1d40dc['statedesc']=_0x550529[_0x41ee('0x10e')];_0x1d40dc[_0x41ee('0xe9')]=_0x41ee('0x10f');this['createHistory'](_0x1d40dc)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x109')));this['moveContactManagedDialer'](_0x1d40dc)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x10a')));}};Dialer['prototype']['syncAgentComplete']=function(_0x5eace8){var _0x1ff17b=this[_0x41ee('0x26')][_0x5eace8['uniqueid']];var _0x3b4b42=this;if(this[_0x41ee('0x1f')][_0x5eace8['queue']]){if(_0x1ff17b&&_0x1ff17b['type']!==_0x41ee('0x7f')){delete this[_0x41ee('0x26')][_0x5eace8[_0x41ee('0xee')]];this[_0x41ee('0x1f')][_0x5eace8[_0x41ee('0xbb')]][_0x41ee('0x63')]+=0x1;var _0x33b8d0=new AgentComplete(_0x1ff17b,_0x5eace8);if(_0x5eace8['reason']===_0x41ee('0x110')){_0x33b8d0[_0x41ee('0x111')]=this[_0x41ee('0x1f')][_0x5eace8[_0x41ee('0xbb')]][_0x41ee('0x112')]&&this[_0x41ee('0x1f')][_0x5eace8[_0x41ee('0xbb')]][_0x41ee('0x113')]?moment()[_0x41ee('0x80')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x33b8d0)[_0x41ee('0xb8')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x41ee('0xcf')](_0x33b8d0)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x114')));}}};Dialer[_0x41ee('0xaf')][_0x41ee('0x2d')]=function(_0x521a3){if(this[_0x41ee('0x1f')][_0x521a3[_0x41ee('0xbb')]]){if(this['uniqueId'][_0x521a3['uniqueid']]&&this[_0x41ee('0x26')][_0x521a3[_0x41ee('0xee')]][_0x41ee('0x57')]!==_0x41ee('0x7f')){this['updateOriginated'](this[_0x41ee('0x1f')][_0x521a3[_0x41ee('0xbb')]]);this[_0x41ee('0x26')][_0x521a3[_0x41ee('0xee')]]['answertime']=moment()[_0x41ee('0x80')](_0x41ee('0x107'));}}};Dialer[_0x41ee('0xaf')][_0x41ee('0x115')]=function(_0x257d09){this[_0x41ee('0xd1')](_0x257d09)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x116')));this[_0x41ee('0xcf')](_0x257d09)[_0x41ee('0xb8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x41ee('0xaf')]['syncQueueCallerAbandon']=function(_0x2355c2){var _0x2b9199=this[_0x41ee('0x26')][_0x2355c2[_0x41ee('0xee')]];var _0x1bb79a=this;if(this[_0x41ee('0x1f')][_0x2355c2['queue']]){if(_0x2b9199&&_0x2b9199['type']!=='ivr'){delete this[_0x41ee('0x26')][_0x2355c2[_0x41ee('0xee')]];this[_0x41ee('0xba')](this[_0x41ee('0x1f')][_0x2355c2[_0x41ee('0xbb')]]);_0x2b9199[_0x41ee('0x117')]=moment()['format'](_0x41ee('0x107'));var _0x32c827=new QueueCallerAbandon(_0x2b9199,_0x2355c2);if(getSeconds(_0x2b9199[_0x41ee('0x117')],_0x2b9199[_0x41ee('0x118')])>=_0x2b9199[_0x41ee('0x119')]){this[_0x41ee('0x1f')][_0x2355c2['queue']][_0x41ee('0x6e')]+=0x1;this[_0x41ee('0x1f')][_0x2355c2['queue']][_0x41ee('0x11a')]+=0x1;this[_0x41ee('0x1f')][_0x2355c2[_0x41ee('0xbb')]][_0x41ee('0x70')]+=0x1;_0x32c827[_0x41ee('0xab')]=0xa;_0x32c827['statedesc']=_0x41ee('0x11b');_0x32c827[_0x41ee('0x11c')]=_0x41ee('0x11d');_0x32c827['agiafterat']=this['voiceQueues'][_0x2355c2[_0x41ee('0xbb')]][_0x41ee('0x112')]?moment()[_0x41ee('0x80')](_0x41ee('0x107')):undefined;_0x32c827[_0x41ee('0xf6')]+=0x1;_0x32c827['countglobal']+=0x1;if(_0x32c827['countdropretry']>=this[_0x41ee('0x1f')][_0x2355c2[_0x41ee('0xbb')]][_0x41ee('0x11e')]){this['queueCallerAbandonCreateState'](_0x32c827);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x32c827[_0x41ee('0xf6')],'scheduledat':moment()['add'](this[_0x41ee('0x1f')][_0x2355c2[_0x41ee('0xbb')]]['dialDropRetryFrequency'],'minutes')[_0x41ee('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b9199[_0x41ee('0xd7')],'ListId':_0x2b9199['ListId'],'VoiceQueueId':_0x2b9199[_0x41ee('0xda')]||undefined,'CampaignId':_0x2b9199['CampaignId']||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x11f')));var _0xfde11=new History(_0x32c827);_0xfde11[_0x41ee('0xab')]=0xa;_0xfde11['statedesc']=_0x41ee('0x11b');_0xfde11[_0x41ee('0xae')]=moment()[_0x41ee('0x80')](_0x41ee('0x107'));_0xfde11['endtime']=_0xfde11[_0x41ee('0xae')];_0xfde11[_0x41ee('0x120')]=_0x32c827[_0x41ee('0x120')];_0xfde11[_0x41ee('0x121')]=_0x32c827[_0x41ee('0x121')];this[_0x41ee('0xd1')](_0xfde11)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x122')));}}else{this[_0x41ee('0x1f')][_0x2355c2['queue']][_0x41ee('0x89')]+=0x1;this[_0x41ee('0x1f')][_0x2355c2[_0x41ee('0xbb')]][_0x41ee('0x67')]+=0x1;_0x32c827[_0x41ee('0xab')]=0xb;_0x32c827[_0x41ee('0xac')]='Abandoned';_0x32c827[_0x41ee('0x11c')]='CALLEREXIT';_0x32c827[_0x41ee('0x123')]+=0x1;_0x32c827['countglobal']+=0x1;if(_0x32c827[_0x41ee('0x123')]>=this[_0x41ee('0x1f')][_0x2355c2[_0x41ee('0xbb')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x32c827);}else{this[_0x41ee('0xc6')]({'active':![],'countabandonedretry':_0x32c827[_0x41ee('0x123')],'scheduledat':moment()['add'](this[_0x41ee('0x1f')][_0x2355c2[_0x41ee('0xbb')]][_0x41ee('0x124')],_0x41ee('0xff'))[_0x41ee('0x80')](_0x41ee('0x107')),'ContactId':_0x2b9199[_0x41ee('0xd7')],'ListId':_0x2b9199[_0x41ee('0xd8')],'VoiceQueueId':_0x2b9199['VoiceQueueId']||undefined,'CampaignId':_0x2b9199['CampaignId']||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x125')));var _0xfde11=new History(_0x32c827);_0xfde11['state']=0xb;_0xfde11[_0x41ee('0xac')]=_0x41ee('0x126');_0xfde11[_0x41ee('0xae')]=moment()['format'](_0x41ee('0x107'));_0xfde11['endtime']=_0xfde11[_0x41ee('0xae')];_0xfde11['calleridname']=_0x32c827[_0x41ee('0x120')];_0xfde11['calleridnum']=_0x32c827[_0x41ee('0x121')];this[_0x41ee('0xd1')](_0xfde11)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x127')));}}}}};Dialer[_0x41ee('0xaf')][_0x41ee('0x128')]=function(_0x32b1f5){if(this[_0x41ee('0x129')][_0x32b1f5['uniqueid']]){this['actions'][_0x32b1f5[_0x41ee('0xee')]][_0x41ee('0xb7')]=_0x32b1f5[_0x41ee('0xb7')];}if(this['uniqueId'][_0x32b1f5[_0x41ee('0xee')]]){this[_0x41ee('0x26')][_0x32b1f5[_0x41ee('0xee')]][_0x41ee('0xb7')]=_0x32b1f5['channel'];}};Dialer[_0x41ee('0xaf')][_0x41ee('0x3a')]=function(_0x5dc5d4){if(strategy[this[_0x41ee('0x1f')][this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0xbb')]][_0x41ee('0x4f')]]===_0x41ee('0x1a')){if(this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]]&&_[_0x41ee('0xe3')](this['actions'][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0x12b')])&&_0x5dc5d4[_0x41ee('0xb6')]==='1'&&_0x5dc5d4[_0x41ee('0x12c')]==='0'){if(this['agents'][_0x5dc5d4[_0x41ee('0x12d')]]){if(!this[_0x41ee('0x21')][_0x5dc5d4[_0x41ee('0x12d')]]['locked']){this[_0x41ee('0x21')][_0x5dc5d4['stateinterface']][_0x41ee('0x12b')]=!![];this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0x12b')]=!![];this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0x12d')]=_0x5dc5d4[_0x41ee('0x12d')];}}}}else if((strategy[this[_0x41ee('0x1f')][this['actions'][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0xbb')]][_0x41ee('0x4f')]]||'rrmemory')===_0x41ee('0x19')){if(this['actions'][_0x5dc5d4['actionid']]){if(this[_0x41ee('0x21')][_0x5dc5d4['stateinterface']]){this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0x12d')]=_0x5dc5d4[_0x41ee('0x12d')];if(_[_0x41ee('0xe3')](this[_0x41ee('0x2a')][this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0xbb')]])){this[_0x41ee('0x2a')][this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]][_0x41ee('0xbb')]]=[];}this[_0x41ee('0x2a')][this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]]['queue']]['push'](_['merge'](_[_0x41ee('0xd6')](this[_0x41ee('0x129')][_0x5dc5d4[_0x41ee('0x12a')]],[_0x41ee('0x12e'),_0x41ee('0x12d')]),{'status':_0x5dc5d4[_0x41ee('0xb6')],'paused':_0x5dc5d4['paused']}));}}}};function unlockQueueStatus(_0x399e0f,_0x638313){setTimeout(function(){if(_[_0x41ee('0x3e')](_0x399e0f[_0x41ee('0x12f')])){loggerBooked['error'](_0x41ee('0x130'),_0x638313);}_0x399e0f[_0x41ee('0x12f')]=!![];loggerBooked['info'](_0x41ee('0x131'),_0x638313,JSON[_0x41ee('0x4a')](_[_0x41ee('0xd6')](_0x399e0f,[_0x41ee('0x41'),_0x41ee('0x12f')])));},0x1f3);}Dialer[_0x41ee('0xaf')][_0x41ee('0x3c')]=function(_0x11291c){var _0x3d7157=this;var _0x560388=_0x3d7157['voiceQueues'][_0x3d7157[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]];if(strategy[this[_0x41ee('0x1f')][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]][_0x41ee('0x4f')]]==='roundrobin'){if(this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]]&&this['actions'][_0x11291c['actionid']][_0x41ee('0x12d')]){this[_0x41ee('0x1e')][_0x41ee('0x132')](this['actions'][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0x12e')],this['actions'][_0x11291c['actionid']][_0x41ee('0x12d')])[_0x41ee('0xb8')](function(_0x2a261f){logger[_0x41ee('0x9d')](_0x41ee('0x133'),util[_0x41ee('0x9e')](_0x2a261f,{'showHidden':![],'depth':null}));})[_0x41ee('0x1c')](function(){_0x3d7157[_0x41ee('0xba')](_0x3d7157[_0x41ee('0x1f')][_0x3d7157[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]]);_0x3d7157[_0x41ee('0x21')][_0x3d7157[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]]['stateinterface']][_0x41ee('0x12b')]=![];delete _0x3d7157[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]];unlockQueueStatus(_0x560388);});}else{this[_0x41ee('0xba')](this['voiceQueues'][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]]);this[_0x41ee('0xc6')]({'active':![],'ContactId':this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]]['ContactId'],'ListId':this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xd8')],'VoiceQueueId':this['actions'][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xda')]||undefined,'CampaignId':this['actions'][_0x11291c[_0x41ee('0x12a')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x41ee('0x134')));delete this[_0x41ee('0x129')][_0x11291c['actionid']];unlockQueueStatus(_0x560388);}}else if((strategy[this[_0x41ee('0x1f')][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]][_0x41ee('0x4f')]]||_0x41ee('0x19'))===_0x41ee('0x19')){var _0x3ac2ed;if(this['actions'][_0x11291c['actionid']]&&!_['isEmpty'](this['queueBooked'][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]])){if(this['queueBookedRR'][_0x3d7157['actions'][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]]){this[_0x41ee('0x2b')][_0x3d7157['actions'][_0x11291c[_0x41ee('0x12a')]]['queue']]=this['queueBookedRR'][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]]?this['queueBookedRR'][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]]['queue']]:this[_0x41ee('0x2a')][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]]?this[_0x41ee('0x2a')][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]]['_rr']||0x0:0x0;}this[_0x41ee('0x2a')][this['actions'][_0x11291c[_0x41ee('0x12a')]][_0x41ee('0xbb')]]['_rr']=this[_0x41ee('0x2b')][this[_0x41ee('0x129')][_0x11291c[_0x41ee('0x12a')]]['queue']];for(var _0x111381=0x0;_0x111381=0x0;})[_0x41ee('0xb8')](myreject(_0x48f139)));}}else{_0x44df6f['push'](ami['Action']({'action':'command','command':util[_0x41ee('0x80')](_0x41ee('0x14a'),_0x442433,!_[_0x41ee('0x3e')](config[_0x41ee('0x144')][_0x109acd])?_0x109acd:'')})['then'](function(_0x3040d9){return _0x3040d9[_0x41ee('0x14c')][_0x41ee('0x14d')](_0x41ee('0x14e'))>=0x0;})[_0x41ee('0xb8')](myreject(_0x48f139)));}BPromise['all'](_0x44df6f)[_0x41ee('0xbf')](function(_0x4c7735){var _0x32e8bb=_[_0x41ee('0x14f')](_0x4c7735);if(_0x32e8bb){return _0x34dd3d(_0x32e8bb);}else{_0x8ec887['message']=_0x50af0e?_0x41ee('0x150'):'INTERVAL_IS_OVERTIME';return _0x48f139(msgResponse(_0x41ee('0x151'),'Failure',_0x41ee('0x152')+_0x50af0e+'\x20'+_0x12ed5a+_0x41ee('0x153')+util['inspect'](_0x442433,{'showHidden':![],'depth':null})+_0x41ee('0x154')+_0x109acd));}})['catch'](function(_0x43b460){return _0x48f139(msgResponse(_0x41ee('0x140'),_0x41ee('0x142'),JSON[_0x41ee('0x4a')](_0x43b460)));});});};Dialer['prototype'][_0x41ee('0x155')]=function(_0x1c3a45){var _0x100265=this;return function(){switch(_0x1c3a45[_0x41ee('0x5d')]){case'progressive':freeVariablesPredictive(_0x1c3a45);_0x100265[_0x41ee('0x156')](_0x1c3a45,0x1);break;case'power':freeVariablesPredictive(_0x1c3a45);_0x100265[_0x41ee('0x156')](_0x1c3a45,_0x1c3a45[_0x41ee('0x157')]);break;case _0x41ee('0x7'):_0x100265['predictive'](_0x1c3a45);break;case _0x41ee('0x158'):freeVariablesPredictive(_0x1c3a45);_0x100265[_0x41ee('0x156')](_0x1c3a45,0x1);break;default:freeVariablesPredictive(_0x1c3a45);logger[_0x41ee('0x9d')](_0x41ee('0x159'),_0x1c3a45[_0x41ee('0x41')],_0x41ee('0x15a'));}};};Dialer['prototype'][_0x41ee('0x15b')]=function(_0x3ebedd){var _0x18a713=this;return function(){_0x18a713[_0x41ee('0x15c')](_0x3ebedd);};};Dialer[_0x41ee('0xaf')][_0x41ee('0x9')]=function(_0x1b1bd8){var _0x31bff1=this;if(isNotPreview(_0x1b1bd8[_0x41ee('0x5d')])){if(isVoiceQueueOutbound(_0x1b1bd8[_0x41ee('0x57')])&&isActive(_0x1b1bd8[_0x41ee('0x5c')])){_0x1b1bd8[_0x41ee('0xa6')]=!![];BPromise[_0x41ee('0xbe')]()[_0x41ee('0xbf')](checkIsLoggedIn(_0x1b1bd8,_0x1b1bd8[_0x41ee('0x51')]))[_0x41ee('0xbf')](checkIsActive(_0x1b1bd8,_0x1b1bd8[_0x41ee('0x5c')]))[_0x41ee('0xbf')](checkInterval(_0x1b1bd8))[_0x41ee('0xbf')](_0x31bff1['checkIsTrunkReachable'](_0x1b1bd8))['then'](_0x31bff1[_0x41ee('0x15d')](_0x1b1bd8[_0x41ee('0x15e')],_0x1b1bd8[_0x41ee('0x15f')],_0x1b1bd8[_0x41ee('0x41')],_0x1b1bd8))[_0x41ee('0xbf')](_0x31bff1[_0x41ee('0x141')](_0x1b1bd8[_0x41ee('0x45')],_0x1b1bd8[_0x41ee('0x15f')],_0x1b1bd8['name'],_0x1b1bd8))[_0x41ee('0xbf')](_0x31bff1[_0x41ee('0x155')](_0x1b1bd8))[_0x41ee('0xb8')](loggerCatchQueueSummary(_0x41ee('0x160'),_0x1b1bd8));}else{notSendMessagesQueue(_0x1b1bd8);}}else{freeVariablesPredictive(_0x1b1bd8);}};Dialer[_0x41ee('0xaf')][_0x41ee('0x13c')]=function(){var _0x7807b4=this;var _0x51a8c0;for(var _0x15bdd0 in this['campaigns']){if(typeof this['campaigns'][_0x15bdd0]!==_0x41ee('0xb3')){_0x51a8c0=this[_0x41ee('0x20')][_0x15bdd0];if(isCampaignIvr(_0x51a8c0[_0x41ee('0x57')])&&isActive(_0x51a8c0['active'])){_0x51a8c0[_0x41ee('0xa6')]=!![];BPromise['resolve']()[_0x41ee('0xbf')](checkIsActive(_0x51a8c0,_0x51a8c0[_0x41ee('0x7b')]))[_0x41ee('0xbf')](checkInterval(_0x51a8c0))[_0x41ee('0xbf')](_0x7807b4['checkIsTrunkReachable'](_0x51a8c0))[_0x41ee('0xbf')](_0x7807b4[_0x41ee('0x15d')](_0x51a8c0['dialGlobalInterval'],_0x51a8c0['dialTimezone'],_0x51a8c0['name'],_0x51a8c0))[_0x41ee('0xbf')](_0x7807b4[_0x41ee('0x141')](_0x51a8c0['Interval'],_0x51a8c0[_0x41ee('0x15f')],_0x51a8c0['name'],_0x51a8c0))[_0x41ee('0xbf')](_0x7807b4[_0x41ee('0x15b')](_0x51a8c0))['catch'](loggerCatchQueueSummary(_0x41ee('0x161'),_0x51a8c0));}else{notSendMessagesCampaign(_0x51a8c0);}}}};function getCallerIdRandom(_0x2645ae,_0x424cf9){var _0x1df681;var _0xe8220d;var _0x365540;if(_0x424cf9<=0x0){_0x424cf9=0x1;}_0x1df681=new RegExp(_0x41ee('0x162')+_0x424cf9+'}$');_0xe8220d=Math[_0x41ee('0x163')](0xa,_0x424cf9-0x1);_0x365540=Math[_0x41ee('0x163')](0xa,_0x424cf9)-0x1;return util[_0x41ee('0x80')]('%s',_['replace'](_0x2645ae,_0x1df681,_[_0x41ee('0x164')](_0xe8220d,_0x365540)));}function extractCalleridName(_0x5dedbe){var _0x4c0494=_0x5dedbe[_0x41ee('0x165')](/"(.*?)"/);return _0x4c0494?_0x4c0494[0x1]:_0x5dedbe;}function extractCalleridNumber(_0x55cd0e){var _0x3739b2=_0x55cd0e[_0x41ee('0x165')](/<(.*?)>/);return _0x3739b2?_0x3739b2[0x1]:_0x55cd0e;}Dialer[_0x41ee('0xaf')][_0x41ee('0x166')]=function(_0x2d8e8b,_0x47105a){var _0x26633b=this;var _0x10761d=uuid['v4']();this[_0x41ee('0x129')][_0x10761d]=new Action(_0x2d8e8b,_0x47105a,_0x10761d);return new BPromise(function(_0x50d8b5,_0xedd434){if(_[_0x41ee('0x3e')](_0x2d8e8b)&&typeof _0x2d8e8b!==_0x41ee('0x167')){return _0xedd434(msgResponse('originate',_0x41ee('0x142'),_0x41ee('0x168')));}if(_['isUndefined'](_0x47105a[_0x41ee('0x169')][_0x41ee('0x16a')])||_0x47105a[_0x41ee('0x169')][_0x41ee('0x16a')]===null){return _0xedd434(msgResponse(_0x41ee('0x16b'),_0x41ee('0x142'),'contact\x20is\x20undefine'));}var _0x2c6d24={'XMD-CALLERID':_0x26633b[_0x41ee('0x129')][_0x10761d][_0x41ee('0x16c')](),'XMD-AGI':_0x2d8e8b[_0x41ee('0x10b')]?util[_0x41ee('0x80')](_0x41ee('0x16d'),ipAgi,_0x2d8e8b[_0x41ee('0x10b')]):_0x41ee('0x16e'),'XMD-AGIAFTER':_0x2d8e8b[_0x41ee('0x112')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2d8e8b['dialQueueProject2']):_0x41ee('0x16e'),'XMD-QUEUE':_0x2d8e8b['type']===_0x41ee('0x4e')?util['format']('\x22%s,%s%s,,,%s\x22',_0x2d8e8b['name'],_0x2d8e8b['dialQueueOptions']||'',_0x2d8e8b['dialAgiAfterHangupAgent']?'c':'',_0x2d8e8b[_0x41ee('0x119')]||0x3):_0x41ee('0x16e'),'XMD-CONTACTID':_0x47105a[_0x41ee('0xd7')],'XMD-CDRTYPE':_0x41ee('0x6'),'CALLERID(all)':_0x26633b[_0x41ee('0x129')][_0x10761d][_0x41ee('0x16c')](),'XMD-AMD':_0x2d8e8b[_0x41ee('0xe7')]?_0x41ee('0x16f'):_0x41ee('0x16e'),'XMD-DESTINATION':_0x41ee('0x170')};if(_0x2d8e8b[_0x41ee('0xe7')]){_0x2c6d24[_0x41ee('0x171')]=_0x2d8e8b['dialAMDInitialSilence']||0x9c4;_0x2c6d24['XMD-AMDGREETING']=_0x2d8e8b[_0x41ee('0x172')]||0x5dc;_0x2c6d24[_0x41ee('0x173')]=_0x2d8e8b[_0x41ee('0x174')]||0x320;_0x2c6d24[_0x41ee('0x175')]=_0x2d8e8b[_0x41ee('0x176')]||0x1388;_0x2c6d24[_0x41ee('0x177')]=_0x2d8e8b[_0x41ee('0x178')]||0x64;_0x2c6d24[_0x41ee('0x179')]=_0x2d8e8b[_0x41ee('0x17a')]||0x32;_0x2c6d24[_0x41ee('0x17b')]=_0x2d8e8b[_0x41ee('0x17c')]||0x3;_0x2c6d24[_0x41ee('0x17d')]=_0x2d8e8b['dialAMDSilenceThreshold']||0x100;_0x2c6d24[_0x41ee('0x17e')]=_0x2d8e8b[_0x41ee('0x17f')]||0x1388;}if(_0x2d8e8b['type']==='outbound'){_0x2c6d24[_0x41ee('0x180')]=_0x47105a[_0x41ee('0xda')];}else{_0x2c6d24[_0x41ee('0x181')]=_0x47105a[_0x41ee('0xdb')];}for(var _0x469c8b in _0x47105a[_0x41ee('0x169')]){if(typeof _0x47105a[_0x41ee('0x169')][_0x469c8b]!=='undefined'){if(isNotNull(_0x47105a[_0x41ee('0x169')][_0x469c8b])&&_0x469c8b!=='id'&&_0x469c8b!=='tags'&&_0x469c8b!==_0x41ee('0x182')&&_0x469c8b!=='updatedAt'){_0x2c6d24[util[_0x41ee('0x80')]('%s%s','XMD-',_['toUpper'](_0x469c8b))]=_0x47105a['Contact'][_0x469c8b];}}}var _0x1cbe0f=_0x26633b[_0x41ee('0xe0')](_0x2d8e8b[_0x41ee('0x7a')])?getCallerId(_0x2d8e8b[_0x41ee('0x7a')][_0x41ee('0x7c')],_0x2d8e8b['dialOriginateCallerIdName'],_0x2d8e8b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2d8e8b[_0x41ee('0x5f')],_0x2d8e8b['dialRandomLastDigitCallerIdNumber']):_0x2d8e8b[_0x41ee('0x5f')]):getCallerId(_[_0x41ee('0xe3')](_0x2d8e8b['TrunkBackup'])?_0x2d8e8b[_0x41ee('0x7a')][_0x41ee('0x7c')]:_0x2d8e8b[_0x41ee('0x13e')][_0x41ee('0x7c')],_0x2d8e8b['dialOriginateCallerIdName'],_0x2d8e8b[_0x41ee('0x183')]>0x0?getCallerIdRandom(_0x2d8e8b[_0x41ee('0x5f')],_0x2d8e8b[_0x41ee('0x183')]):_0x2d8e8b['dialOriginateCallerIdNumber']);if(_0x1cbe0f){_0x2c6d24[_0x41ee('0x184')]=_0x26633b[_0x41ee('0x129')][_0x10761d][_0x41ee('0x185')]=extractCalleridName(_0x1cbe0f);_0x2c6d24[_0x41ee('0x186')]=_0x26633b['actions'][_0x10761d][_0x41ee('0x187')]=extractCalleridNumber(_0x1cbe0f);}return ami[_0x41ee('0xb5')]({'actionid':_0x10761d,'action':_0x41ee('0x16b'),'channel':_0x26633b['isTrunkReachable'](_0x2d8e8b[_0x41ee('0x7a')])?util[_0x41ee('0x80')](_0x41ee('0x188'),_0x2d8e8b[_0x41ee('0x7a')]['name'],isNotNull(_0x2d8e8b['dialPrefix'])?_0x2d8e8b[_0x41ee('0x61')][_0x41ee('0x189')]()||'':'',_0x2d8e8b['dialCutDigit']>0x0?_0x47105a[_0x41ee('0x169')]['phone'][_0x41ee('0x18a')](_0x2d8e8b[_0x41ee('0x18b')]):_0x47105a['Contact'][_0x41ee('0x16a')]):util[_0x41ee('0x80')](_0x41ee('0x188'),_[_0x41ee('0xe3')](_0x2d8e8b[_0x41ee('0x13e')])?_0x2d8e8b['Trunk'][_0x41ee('0x41')]:_0x2d8e8b[_0x41ee('0x13e')]['name'],isNotNull(_0x2d8e8b[_0x41ee('0x61')])?_0x2d8e8b[_0x41ee('0x61')][_0x41ee('0x189')]()||'':'',_0x2d8e8b['dialCutDigit']>0x0?_0x47105a[_0x41ee('0x169')]['phone'][_0x41ee('0x18a')](_0x2d8e8b[_0x41ee('0x18b')]):_0x47105a[_0x41ee('0x169')][_0x41ee('0x16a')]),'callerid':_0x1cbe0f,'Exten':_0x41ee('0x170'),'Context':'from-sip','Priority':'1','variable':_0x2c6d24,'timeout':(_0x2d8e8b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x10761d})[_0x41ee('0xbf')](function(_0x2a5cc7){return _0x50d8b5(_0x2a5cc7);})[_0x41ee('0xb8')](function(_0x1d9887){_0x2d8e8b[_0x41ee('0x68')]+=0x1;var _0x375ac3=new History(_0x26633b[_0x41ee('0x129')][_0x10761d]);logger['error'](util[_0x41ee('0x80')](_0x41ee('0x18c'),JSON['stringify'](_0x1d9887)));_0x375ac3['state']=0xe;_0x375ac3[_0x41ee('0xac')]=_0x41ee('0x18d');_0x375ac3[_0x41ee('0xae')]=moment()[_0x41ee('0x80')](_0x41ee('0x107'));_0x375ac3['endtime']=_0x375ac3[_0x41ee('0xae')];_0x26633b[_0x41ee('0xd1')](_0x375ac3)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x18e')));_0x26633b[_0x41ee('0xcf')](_0x375ac3)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x18e')))['finally'](function(){delete _0x26633b[_0x41ee('0x129')][_0x10761d];return _0xedd434(msgResponse(_0x41ee('0x16b'),_0x41ee('0x49'),_0x41ee('0x18f')));});});});};Dialer[_0x41ee('0xaf')][_0x41ee('0x31')]=function(_0x35790f){var _0x3f6dcf=this[_0x41ee('0x129')][_0x35790f[_0x41ee('0x12a')]];if(_0x3f6dcf){delete this[_0x41ee('0x129')][_0x35790f[_0x41ee('0x12a')]];_0x3f6dcf[_0x41ee('0x118')]=moment()['format'](_0x41ee('0x107'));var _0x18c687=_0x3f6dcf['type']===_0x41ee('0x7f')?this[_0x41ee('0x20')][_0x3f6dcf[_0x41ee('0xbb')]]:this[_0x41ee('0x1f')][_0x3f6dcf[_0x41ee('0x190')]()];if(!this[_0x41ee('0xde')](_0x35790f[_0x41ee('0x191')])){this[_0x41ee('0xba')](_0x18c687);return this[_0x41ee('0x192')](_0x3f6dcf,_0x18c687,_0x35790f)[_0x41ee('0xb8')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x41ee('0x26')][_0x35790f['uniqueid']]=_0x3f6dcf;}};Dialer[_0x41ee('0xaf')][_0x41ee('0x193')]=function(_0x454a41,_0x31bc48,_0x4d01d1){var _0x404d82=new History(_0x31bc48);if(_0x404d82[_0x41ee('0xf2')]+_0x404d82[_0x41ee('0xf3')]+_0x404d82[_0x41ee('0xf4')]+_0x404d82[_0x41ee('0xf5')]+_0x404d82[_0x41ee('0xf6')]+_0x404d82['countabandonedretry']+_0x404d82[_0x41ee('0xf7')]+_0x404d82['countagentrejectretry']>=_0x4d01d1[_0x41ee('0xf9')]-0x1){return!![];}switch(_0x454a41){case 0x3:if(_0x404d82[_0x41ee('0xf4')]>=_0x4d01d1[_0x41ee('0x194')]-0x1){return!![];}this[_0x41ee('0xc6')]({'active':![],'countnoanswerretry':_0x404d82['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x41ee('0xfd')](_0x4d01d1[_0x41ee('0x195')],_0x41ee('0xff'))['format'](_0x41ee('0x107')),'ContactId':_0x404d82['ContactId'],'ListId':_0x404d82[_0x41ee('0xd8')],'VoiceQueueId':_0x404d82[_0x41ee('0xda')]||undefined,'CampaignId':_0x404d82['CampaignId']||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x196')));break;case 0x5:if(_0x404d82[_0x41ee('0xf2')]>=_0x4d01d1['dialBusyMaxRetry']-0x1){return!![];}this[_0x41ee('0xc6')]({'active':![],'countbusyretry':_0x404d82[_0x41ee('0xf2')]+=0x1,'scheduledat':moment()[_0x41ee('0xfd')](_0x4d01d1[_0x41ee('0x197')],_0x41ee('0xff'))[_0x41ee('0x80')](_0x41ee('0x107')),'ContactId':_0x404d82[_0x41ee('0xd7')],'ListId':_0x404d82[_0x41ee('0xd8')],'VoiceQueueId':_0x404d82[_0x41ee('0xda')]||undefined,'CampaignId':_0x404d82[_0x41ee('0xdb')]||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x198')));break;case 0x8:if(_0x404d82['countcongestionretry']>=_0x4d01d1[_0x41ee('0x199')]-0x1){return!![];}this[_0x41ee('0xc6')]({'active':![],'countcongestionretry':_0x404d82[_0x41ee('0xf3')]+=0x1,'scheduledat':moment()[_0x41ee('0xfd')](_0x4d01d1[_0x41ee('0x19a')],_0x41ee('0xff'))[_0x41ee('0x80')](_0x41ee('0x107')),'ContactId':_0x404d82[_0x41ee('0xd7')],'ListId':_0x404d82[_0x41ee('0xd8')],'VoiceQueueId':_0x404d82[_0x41ee('0xda')]||undefined,'CampaignId':_0x404d82[_0x41ee('0xdb')]||undefined})['catch'](loggerCatch(_0x41ee('0x19b')));break;case 0x0:if(_0x404d82[_0x41ee('0xf5')]>=_0x4d01d1[_0x41ee('0x19c')]-0x1){return!![];}else{this[_0x41ee('0xc6')]({'active':![],'countnosuchnumberretry':_0x404d82[_0x41ee('0xf5')]+=0x1,'scheduledat':moment()[_0x41ee('0xfd')](_0x4d01d1[_0x41ee('0x19d')],_0x41ee('0xff'))[_0x41ee('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x404d82[_0x41ee('0xd7')],'ListId':_0x404d82['ListId'],'VoiceQueueId':_0x404d82[_0x41ee('0xda')]||undefined,'CampaignId':_0x404d82[_0x41ee('0xdb')]||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x19e')));}break;case 0xa:if(_0x404d82[_0x41ee('0xf6')]>=_0x4d01d1[_0x41ee('0x11e')]-0x1){return!![];}this[_0x41ee('0xc6')]({'active':![],'countdropretry':_0x404d82[_0x41ee('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x4d01d1[_0x41ee('0x19f')],_0x41ee('0xff'))[_0x41ee('0x80')](_0x41ee('0x107')),'ContactId':_0x404d82[_0x41ee('0xd7')],'ListId':_0x404d82[_0x41ee('0xd8')],'VoiceQueueId':_0x404d82[_0x41ee('0xda')]||undefined,'CampaignId':_0x404d82['CampaignId']||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x11f')));break;case 0xb:if(_0x404d82[_0x41ee('0x123')]>=_0x4d01d1[_0x41ee('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x404d82[_0x41ee('0x123')]+=0x1,'scheduledat':moment()[_0x41ee('0xfd')](_0x4d01d1['dialAbandonedRetryFrequency'],'minutes')['format'](_0x41ee('0x107')),'ContactId':_0x404d82[_0x41ee('0xd7')],'ListId':_0x404d82[_0x41ee('0xd8')],'VoiceQueueId':_0x404d82['VoiceQueueId']||undefined,'CampaignId':_0x404d82[_0x41ee('0xdb')]||undefined})[_0x41ee('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x404d82[_0x41ee('0xf7')]>=_0x4d01d1[_0x41ee('0x106')]-0x1){return!![];}this[_0x41ee('0xc6')]({'active':![],'countmachineretry':_0x404d82[_0x41ee('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x4d01d1[_0x41ee('0xfe')],_0x41ee('0xff'))[_0x41ee('0x80')](_0x41ee('0x107')),'ContactId':_0x404d82[_0x41ee('0xd7')],'ListId':_0x404d82['ListId'],'VoiceQueueId':_0x404d82['VoiceQueueId']||undefined,'CampaignId':_0x404d82[_0x41ee('0xdb')]||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x100')));break;case 0x14:if(_0x404d82[_0x41ee('0xf8')]>=_0x4d01d1['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x41ee('0xc6')]({'active':![],'countagentrejectretry':_0x404d82['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x4d01d1[_0x41ee('0x1a1')],'minutes')[_0x41ee('0x80')](_0x41ee('0x107')),'ContactId':_0x404d82[_0x41ee('0xd7')],'ListId':_0x404d82[_0x41ee('0xd8')],'VoiceQueueId':_0x404d82[_0x41ee('0xda')]||undefined,'CampaignId':_0x404d82[_0x41ee('0xdb')]||undefined})[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x1a2')));break;default:return!![];}};Dialer[_0x41ee('0xaf')][_0x41ee('0x192')]=function(_0x3dee38,_0x13983b,_0x8cbeeb){var _0xbba4a7=this;var _0xa5589f=new History(_0x3dee38);return new BPromise(function(_0x4562ff,_0x24de3d){if(_[_0x41ee('0x3e')](_0x13983b)&&typeof _0x13983b!==_0x41ee('0x167')){return _0x24de3d(msgResponse(_0x41ee('0x1a3'),_0x41ee('0x142'),_0x41ee('0x1a4')));}if(_[_0x41ee('0x3e')](_0x8cbeeb)&&typeof _0x8cbeeb!==_0x41ee('0x167')){return _0x24de3d(msgResponse('[callProgressDetecting]',_0x41ee('0x142'),_0x41ee('0x1a5')));}switch(_0x8cbeeb[_0x41ee('0x1a6')]){case'0':_0x13983b[_0x41ee('0x1a7')]+=0x1;_0xa5589f[_0x41ee('0xab')]=0x0;_0xa5589f['statedesc']=_0x41ee('0x1a8');_0xa5589f[_0x41ee('0xf5')]+=0x1;_0xa5589f[_0x41ee('0xf0')]+=0x1;ami[_0x41ee('0x1a9')](_0x41ee('0x1aa'),ut[_0x41ee('0x1ab')](_0x3dee38,_0x41ee('0x1ac')));_0xbba4a7[_0x41ee('0xd1')](_0xa5589f)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x104')));if(_0xbba4a7[_0x41ee('0x193')](0x0,_0x3dee38,_0x13983b)){if(_0xa5589f[_0x41ee('0xf5')]>=_0x13983b[_0x41ee('0x19c')]){_0xbba4a7[_0x41ee('0xfb')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1ad'));}else{_0xbba4a7['stateGlobal'](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1ad'));}}break;case'3':_0x13983b[_0x41ee('0x1ae')]+=0x1;_0xa5589f[_0x41ee('0xab')]=0x3;_0xa5589f['statedesc']=_0x41ee('0x1af');_0xa5589f['countnoanswerretry']+=0x1;_0xa5589f[_0x41ee('0xf0')]+=0x1;ami[_0x41ee('0x1a9')](_0x41ee('0x1b0'),ut[_0x41ee('0x1ab')](_0x3dee38,'noanswer'));_0xbba4a7[_0x41ee('0xd1')](_0xa5589f)['catch'](loggerCatch(_0x41ee('0x1b1')));if(_0xbba4a7[_0x41ee('0x193')](0x3,_0x3dee38,_0x13983b)){if(_0xa5589f[_0x41ee('0xf4')]>=_0x13983b['dialNoAnswerMaxRetry']){_0xbba4a7[_0x41ee('0xfb')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1b2'));}else{_0xbba4a7[_0x41ee('0xfa')](_0xa5589f,_0x4562ff,_0x24de3d,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x13983b[_0x41ee('0x1b3')]+=0x1;_0xa5589f[_0x41ee('0xab')]=0x5;_0xa5589f[_0x41ee('0xac')]='Busy';_0xa5589f['countbusyretry']+=0x1;_0xa5589f[_0x41ee('0xf0')]+=0x1;ami[_0x41ee('0x1a9')](_0x41ee('0x1b4'),ut[_0x41ee('0x1ab')](_0x3dee38,'busy'));_0xbba4a7[_0x41ee('0xd1')](_0xa5589f)['catch'](loggerCatch(_0x41ee('0x1b5')));if(_0xbba4a7['checkRetriveMax'](0x5,_0x3dee38,_0x13983b)){if(_0xa5589f['countbusyretry']>=_0x13983b[_0x41ee('0x1b6')]){_0xbba4a7[_0x41ee('0xfb')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1b7'));}else{_0xbba4a7[_0x41ee('0xfa')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1b7'));}}break;case'8':_0x13983b[_0x41ee('0x65')]+=0x1;_0xa5589f[_0x41ee('0xab')]=0x8;_0xa5589f[_0x41ee('0xac')]=_0x41ee('0x1b8');_0xa5589f['countcongestionretry']+=0x1;_0xa5589f[_0x41ee('0xf0')]+=0x1;ami['emit'](_0x41ee('0x1b9'),ut['buildObj'](_0x3dee38,'congestion'));_0xbba4a7[_0x41ee('0xd1')](_0xa5589f)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x1ba')));if(_0xbba4a7[_0x41ee('0x193')](0x8,_0x3dee38,_0x13983b)){if(_0xa5589f['countcongestionretry']>=_0x13983b[_0x41ee('0x199')]){_0xbba4a7[_0x41ee('0xfb')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1bb'));}else{_0xbba4a7[_0x41ee('0xfa')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1bb'));}}break;case'11':_0x13983b['outboundAbandonedCallsDay']+=0x1;_0xa5589f[_0x41ee('0xab')]=0xb;_0xa5589f[_0x41ee('0xac')]=_0x41ee('0x126');_0xa5589f['countabandonedretry']+=0x1;_0xa5589f['countglobal']+=0x1;_0xbba4a7[_0x41ee('0xd1')](_0xa5589f)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x127')));if(_0xbba4a7[_0x41ee('0x193')](0xb,_0x3dee38,_0x13983b)){if(_0xa5589f['countabandonedretry']>=_0x13983b[_0x41ee('0x1a0')]){_0xbba4a7[_0x41ee('0xfb')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1bc'));}else{_0xbba4a7[_0x41ee('0xfa')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1bc'));}}break;case'20':_0x13983b['outboundRejectCallsDay']+=0x1;_0xa5589f[_0x41ee('0xab')]=0x14;_0xa5589f[_0x41ee('0xac')]=_0x41ee('0x1bd');_0xa5589f[_0x41ee('0xf8')]+=0x1;_0xa5589f[_0x41ee('0xf0')]+=0x1;ami[_0x41ee('0x1a9')]('custom:agentreject',ut[_0x41ee('0x1ab')](_0x3dee38,_0x41ee('0x1be')));_0xbba4a7[_0x41ee('0xd1')](_0xa5589f)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x1bf')));if(_0xbba4a7[_0x41ee('0x193')](0x14,_0x3dee38,_0x13983b)){if(_0xa5589f['countagentrejectretry']>=_0x13983b[_0x41ee('0x1c0')]){_0xbba4a7[_0x41ee('0xfb')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1c1'));}else{_0xbba4a7[_0x41ee('0xfa')](_0xa5589f,_0x4562ff,_0x24de3d,_0x41ee('0x1c1'));}}break;default:_0x13983b[_0x41ee('0x6b')]+=0x1;_0xa5589f['state']=0xc;_0xa5589f[_0x41ee('0xac')]=_0x8cbeeb[_0x41ee('0x1a6')];_0xbba4a7['createHistory'](_0xa5589f)[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x1c2')));if(_0xbba4a7['checkRetriveMax'](_0x8cbeeb[_0x41ee('0x1a6')],_0x3dee38,_0x13983b)){if(_0xa5589f[_0x41ee('0xf2')]+_0xa5589f[_0x41ee('0xf3')]+_0xa5589f[_0x41ee('0xf4')]+_0xa5589f[_0x41ee('0xf5')]+_0xa5589f[_0x41ee('0xf6')]+_0xa5589f[_0x41ee('0x123')]+_0xa5589f[_0x41ee('0xf7')]+_0xa5589f[_0x41ee('0xf8')]>=_0x13983b[_0x41ee('0xf9')]){_0xbba4a7['stateGlobal'](_0xa5589f,_0x4562ff,_0x24de3d,_0x8cbeeb[_0x41ee('0x1a6')]);}else{_0xbba4a7['createStateFinal'](_0xa5589f,_0x4562ff,_0x24de3d,_0x8cbeeb['reason']);}}}});};Dialer[_0x41ee('0xaf')][_0x41ee('0xfa')]=function(_0x342f0f,_0x322586,_0x218baf,_0x1b72c4){var _0x4da5f3=new Final(_0x342f0f);_0x4da5f3[_0x41ee('0xab')]=0xf;_0x4da5f3[_0x41ee('0xac')]=_0x41ee('0x1c3');this[_0x41ee('0xfb')](_0x4da5f3,_0x322586,_0x218baf,_0x1b72c4);};Dialer['prototype']['createStateFinal']=function(_0x29542f,_0x42b3fb,_0x5f4c04,_0x5f272c){this[_0x41ee('0xcf')](_0x29542f)['then'](function(){return _0x42b3fb(msgResponse(_0x41ee('0x1a3'),_0x41ee('0xdf'),_0x5f272c));})[_0x41ee('0xb8')](function(){return _0x5f4c04(msgResponse('[moveContactManagedDialer][0]',_0x41ee('0x142'),_0x41ee('0x1c4')));});};Dialer[_0x41ee('0xaf')][_0x41ee('0x7')]=function(_0x1cd494){var _0x4cb36a=_0x1cd494[_0x41ee('0x1c5')]/0x64;var _0x4d8ff3=_0x1cd494['outboundDropCallsDayTimeout']/(_0x1cd494[_0x41ee('0x11a')]+_0x1cd494[_0x41ee('0x63')]);var _0x1eddbe=Math[_0x41ee('0x1c6')](_0x1cd494[_0x41ee('0x74')]*(_0x1cd494[_0x41ee('0x1c7')]/0x64));var _0x36f660=Math[_0x41ee('0x1c6')](_0x1cd494['predictiveIntervalAvailable']*(_0x1cd494['predictiveIntervalMinThreshold']/0x64));var _0x4a7873=_0x1cd494['available']+_0x1cd494[_0x41ee('0x56')];var _0x390739=Math[_0x41ee('0x1c8')](_0x1cd494[_0x41ee('0x77')]*_0x1cd494[_0x41ee('0x78')]*_0x1cd494['predictiveIntervalHitRate']*_0x1cd494[_0x41ee('0x72')]);if(_[_0x41ee('0x3e')](_0x1cd494[_0x41ee('0x28')])){if(!_[_0x41ee('0x3e')](_0x1cd494[_0x41ee('0x27')])){_0x1cd494[_0x41ee('0x27')]=undefined;loggerPredictive[_0x41ee('0x9d')](_0x41ee('0x1c9'),_0x41ee('0x1ca'));}if(!_[_0x41ee('0x3e')](_0x1cd494['handlePredictive'])){loggerPredictive[_0x41ee('0x9d')](_0x41ee('0x1c9'),_0x41ee('0x1cb'));clearInterval(_0x1cd494[_0x41ee('0x97')]);_0x1cd494[_0x41ee('0x97')]=undefined;}_0x1cd494['startProgressive']=moment()[_0x41ee('0x80')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x41ee('0x83')](_0x1cd494[_0x41ee('0x41')],'collection\x20data\x20in\x20progressive\x20at',_0x1cd494[_0x41ee('0x28')]);this['handlePower'](_0x1cd494,0x1);}else if(ifInterval(_0x1cd494[_0x41ee('0x1cc')],_0x1cd494[_0x41ee('0x28')])){this[_0x41ee('0x156')](_0x1cd494,0x1);loggerPredictiveCalls[_0x41ee('0x83')](_0x41ee('0x1cd'),_0x1cd494[_0x41ee('0x28')],_0x1cd494[_0x41ee('0x41')]);_0x1cd494[_0x41ee('0x77')]=0x0;_0x1cd494[_0x41ee('0x70')]=0x0;}else if(_0x4cb36a<_0x4d8ff3&&_0x1cd494[_0x41ee('0x1ce')]===_0x41ee('0x1cf')){freeVariablesPredictive(_0x1cd494);loggerPredictive['info'](_0x41ee('0x1d0'),'Dropped\x20calls\x20day',_0x4d8ff3,_0x41ee('0x28'),_0x1cd494[_0x41ee('0x41')]);}else if(_0x390739<_0x1cd494['predictiveIntervalErlangCallsDroppedCalls']&&_0x1cd494[_0x41ee('0x1ce')]===_0x41ee('0x1cf')){freeVariablesPredictive(_0x1cd494);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x1d1'),'Max\x20Drop\x20',_0x390739,_0x41ee('0x1d2'),_0x1cd494['predictiveIntervalErlangCallsDroppedCalls'],_0x41ee('0x28'),_0x1cd494[_0x41ee('0x41')]);}else if(!ifInterval(_0x1cd494[_0x41ee('0x1cc')],_0x1cd494[_0x41ee('0x28')])&&_[_0x41ee('0x3e')](_0x1cd494[_0x41ee('0x27')])&&!_[_0x41ee('0x3e')](_0x1cd494[_0x41ee('0x28')])){_0x1cd494[_0x41ee('0x27')]=moment()['format'](_0x41ee('0x107'));loggerPredictive[_0x41ee('0x83')](_0x1cd494['name'],_0x41ee('0x1d3'),_0x1cd494[_0x41ee('0x27')]);this[_0x41ee('0x1d4')](_0x1cd494[_0x41ee('0x1cc')])['then'](this[_0x41ee('0x1d5')](_0x1cd494))[_0x41ee('0xbf')](mergeDataErlangB(_0x1cd494))['then'](this[_0x41ee('0x1d6')](_0x1cd494))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1cd494));}else if(!ifInterval(_0x1cd494[_0x41ee('0x1cc')],_0x1cd494[_0x41ee('0x27')])){_0x1cd494[_0x41ee('0x70')]=0x0;_0x1cd494[_0x41ee('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x41ee('0x83')](_0x1cd494[_0x41ee('0x41')],_0x41ee('0x1d7'),_0x1cd494['startPredictive']);clearInterval(_0x1cd494[_0x41ee('0x97')]);_0x1cd494[_0x41ee('0x97')]=undefined;this[_0x41ee('0x1d4')](_0x1cd494[_0x41ee('0x1cc')])['then'](this['getDataPredictive'](_0x1cd494))[_0x41ee('0xbf')](mergeDataErlangB(_0x1cd494))[_0x41ee('0xbf')](this[_0x41ee('0x1d6')](_0x1cd494))[_0x41ee('0xb8')](loggerCatchPredictive(_0x41ee('0x1d8'),_0x1cd494));}else if(_0x1cd494[_0x41ee('0x74')]&&_0x4a7873<_0x1cd494['predictiveIntervalAvailable']-_0x36f660){freeVariablesPredictive(_0x1cd494);loggerPredictive[_0x41ee('0x83')](_0x1cd494[_0x41ee('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4a7873,_0x41ee('0x1d9'),_0x1cd494[_0x41ee('0x74')],'-',_0x36f660,'=',_0x1cd494['predictiveIntervalAvailable']-_0x36f660,')');}else if(_0x1cd494[_0x41ee('0x74')]&&_0x4a7873>_0x1cd494['predictiveIntervalAvailable']+_0x1eddbe){freeVariablesPredictive(_0x1cd494);loggerPredictive[_0x41ee('0x83')](_0x1cd494[_0x41ee('0x41')],_0x41ee('0x1da'),_0x4a7873,')\x20are\x20more\x20than\x20threshold\x20(',_0x1cd494['predictiveIntervalAvailable'],'+',_0x1eddbe,'=',_0x1cd494[_0x41ee('0x74')]+_0x1eddbe,')');}};Dialer[_0x41ee('0xaf')][_0x41ee('0x1d5')]=function(_0x5dcc91){var _0x387fe9=this;return function(_0x2d0f62){return new BPromise(function(_0x3c745e,_0x502583){_[_0x41ee('0x94')](_0x5dcc91,_0x2d0f62[0x0]);if(checkGetDataPredictive(_0x2d0f62[0x0])){var _0x3a0b1=_0x5dcc91['predictiveIntervalAvailable']=_0x5dcc91[_0x41ee('0x56')]+_0x5dcc91['available'];var _0x38f975=_0x5dcc91[_0x41ee('0x1cc')]*0x3c;var _0x4db7b9=_0x2d0f62[0x0]['predictiveIntervalAvgTalktime']+_0x2d0f62[0x0]['predictiveIntervalAvgHoldtime'];var _0x1dfc26=(_0x2d0f62[0x0]['predictiveIntervalAnsweredCalls']+_0x2d0f62[0x0][_0x41ee('0x6e')]+_0x2d0f62[0x0][_0x41ee('0x89')])/_0x2d0f62[0x0][_0x41ee('0x75')];_0x5dcc91[_0x41ee('0x71')]=_0x1dfc26>0x0?_0x1dfc26:0x1;switch(_0x5dcc91[_0x41ee('0x1ce')]){case _0x41ee('0x1cf'):var _0x5d433f=_0x5dcc91[_0x41ee('0x1c5')]/0x64;return _0x387fe9['abandonmentRate'](_0x3a0b1,_0x38f975,_0x4db7b9,_0x1dfc26,_0x5d433f)['then'](function(_0x23770d){return _0x3c745e(_0x23770d);});case _0x41ee('0x1db'):var _0x41177c=_0x5dcc91[_0x41ee('0x1c5')]/0x64;return _0x387fe9[_0x41ee('0x1dc')](_0x3a0b1,_0x38f975,_0x4db7b9,_0x1dfc26,_0x41177c)['then'](function(_0xb8f45a){return _0x3c745e(_0xb8f45a);});default:return _0x502583(msgResponse(_0x41ee('0x1dd'),_0x41ee('0x142'),_0x41ee('0x1de')));}}else{return _0x502583(msgResponse(_0x41ee('0x1dd'),_0x41ee('0x142'),_0x41ee('0x1df')));}});};};Dialer['prototype'][_0x41ee('0x1e0')]=function(_0x2300e2){var _0x1bc70a=this;return function(_0x2e3072){return new BPromise(function(_0x1af73a,_0x37ce09){_[_0x41ee('0x94')](_0x2300e2,_0x2e3072[0x0]);if(checkGetDataPredictive(_0x2e3072[0x0])){loggerPredictive[_0x41ee('0x83')](JSON[_0x41ee('0x4a')](_0x2e3072[0x0]));if(_0x2300e2[_0x41ee('0x1ce')]===_0x41ee('0x1cf')){return _0x1bc70a['getVoiceQueueRtPauses'](_0x2300e2['id'])[_0x41ee('0xbf')](function(_0x16a49f){var _0x285e7c=_0x2300e2[_0x41ee('0x51')]-_0x16a49f[0x0][_0x41ee('0x1e1')];var _0x3d05df=_0x2300e2[_0x41ee('0x1cc')]*0x3c;var _0x9faa15=_0x2e3072[0x0][_0x41ee('0x6d')]+_0x2e3072[0x0]['predictiveIntervalAvgHoldtime'];var _0x482d65=(_0x2e3072[0x0]['predictiveIntervalAnsweredCalls']+_0x2e3072[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2e3072[0x0][_0x41ee('0x89')])/_0x2e3072[0x0][_0x41ee('0x75')];var _0x2264ef=_0x2300e2[_0x41ee('0x1c5')]/0x64;_0x2300e2['predictiveIntervalPauses']=_0x16a49f[0x0]['outboundQueuePauses']||0x0;_0x2300e2[_0x41ee('0x71')]=_0x482d65>0x0?_0x482d65:0x1;return _0x1bc70a[_0x41ee('0x1e2')](_0x285e7c,_0x3d05df,_0x9faa15,_0x482d65,_0x2264ef);})['then'](function(_0x544829){return _0x1af73a(_0x544829);})[_0x41ee('0xb8')](function(_0x2fbd4d){return _0x37ce09(msgResponse(_0x41ee('0x1e3'),_0x41ee('0x142'),JSON[_0x41ee('0x4a')](_0x2fbd4d)));});}if(_0x2300e2[_0x41ee('0x1ce')]===_0x41ee('0x1db')){return _0x1bc70a[_0x41ee('0xcd')](_0x2300e2['id'])[_0x41ee('0xbf')](function(_0x26898a){var _0x5d7626=_0x2300e2['loggedIn']-_0x26898a[0x0][_0x41ee('0x1e1')];var _0x2e0f01=_0x2300e2['dialPredictiveInterval']*0x3c;var _0x25b66f=_0x2e3072[0x0][_0x41ee('0x6d')]+_0x2e3072[0x0][_0x41ee('0x6c')];var _0x41ca65=(_0x2e3072[0x0]['predictiveIntervalAnsweredCalls']+_0x2e3072[0x0][_0x41ee('0x6e')]+_0x2e3072[0x0][_0x41ee('0x89')])/_0x2e3072[0x0][_0x41ee('0x75')];var _0x103292=_0x2300e2[_0x41ee('0x1c5')]/0x64;_0x2300e2[_0x41ee('0x73')]=_0x26898a[0x0][_0x41ee('0x1e1')]||0x0;_0x2300e2['predictiveIntervalHitRate']=_0x41ca65>0x0?_0x41ca65:0x1;return _0x1bc70a[_0x41ee('0x1dc')](_0x5d7626,_0x2e0f01,_0x25b66f,_0x41ca65,_0x103292);})[_0x41ee('0xbf')](function(_0x2643f3){return _0x1af73a(_0x2643f3);})[_0x41ee('0xb8')](function(_0x3cf6c4){return _0x37ce09(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x3cf6c4)));});}}else{return _0x37ce09(msgResponse('[getDataPredictive]',_0x41ee('0x142'),_0x41ee('0x1df')));}});};};Dialer[_0x41ee('0xaf')][_0x41ee('0x1d6')]=function(_0x25fdfb){var _0x339281=this;return function(){var _0x116aa8=0x0;var _0x2621a1=Math[_0x41ee('0x1c8')](_0x25fdfb[_0x41ee('0x91')]*0x3e8);if(_0x2621a1>0x0){_0x2621a1=_0x2621a1<0x64?0x64:_0x2621a1;loggerPredictive['info'](_0x25fdfb[_0x41ee('0x41')],_0x41ee('0x1e4'),_0x2621a1,_0x41ee('0x4b'));_0x25fdfb[_0x41ee('0x97')]=setInterval(function(){_0x339281[_0x41ee('0x97')](_0x25fdfb);loggerPredictiveCalls['info']('[handlePredictive]',_0x116aa8+=0x1);},_0x2621a1);}else{loggerPredictive[_0x41ee('0x83')](_0x25fdfb[_0x41ee('0x41')],_0x41ee('0x1e5'));}};};Dialer['prototype'][_0x41ee('0x1e6')]=function(_0x53a8a5,_0x1dda1f){var _0x58a04d=this;return function(_0x29aa5f){if(_[_0x41ee('0x9a')](_0x29aa5f)){if(_[_0x41ee('0xe3')](_0x1dda1f[_0x41ee('0xd9')])||!_0x1dda1f[_0x41ee('0x1e7')]){if(_0x53a8a5[_0x41ee('0x5d')]==='booked'){_0x53a8a5[_0x41ee('0x12f')]=_[_0x41ee('0x3e')](_0x53a8a5[_0x41ee('0x12f')])?!![]:_0x53a8a5[_0x41ee('0x12f')];var _0x1e640b=uuid['v4']();_0x58a04d[_0x41ee('0x129')][_0x1e640b]=new Action(_0x53a8a5,_0x1dda1f,_0x1e640b);loggerBooked[_0x41ee('0x83')](_0x41ee('0x1e8'),_0x1e640b,_0x41ee('0x1e9'),JSON[_0x41ee('0x4a')](_0x53a8a5['queueStatusComplete']),_0x41ee('0x1ea'),_0x53a8a5[_0x41ee('0x41')]);if(_0x53a8a5[_0x41ee('0x12f')]){_0x53a8a5[_0x41ee('0x12f')]=![];_0x58a04d[_0x41ee('0x2a')][_0x58a04d[_0x41ee('0x129')][_0x1e640b][_0x41ee('0xbb')]]=[];ami['Action']({'actionid':_0x1e640b,'action':'queuestatus','queue':_0x53a8a5[_0x41ee('0x41')]})[_0x41ee('0xb8')](function(){_0x58a04d[_0x41ee('0xba')](_0x53a8a5);_0x58a04d[_0x41ee('0xc6')]({'active':![],'ContactId':_0x58a04d[_0x41ee('0x129')][_0x1e640b][_0x41ee('0xd7')],'ListId':_0x58a04d[_0x41ee('0x129')][_0x1e640b][_0x41ee('0xd8')],'VoiceQueueId':_0x58a04d[_0x41ee('0x129')][_0x1e640b][_0x41ee('0xda')]||undefined,'CampaignId':_0x58a04d['actions'][_0x1e640b][_0x41ee('0xdb')]||undefined})['catch'](loggerCatch(_0x41ee('0x1eb')));delete _0x58a04d['actions'][_0x1e640b];});}else{loggerBooked[_0x41ee('0x83')](_0x41ee('0x1ec'),JSON['stringify'](_0x53a8a5[_0x41ee('0x12f')]),_0x41ee('0x1ea'),_0x53a8a5['name']);_0x58a04d[_0x41ee('0xba')](_0x53a8a5);_0x58a04d[_0x41ee('0xc6')]({'active':![],'ContactId':_0x58a04d[_0x41ee('0x129')][_0x1e640b][_0x41ee('0xd7')],'ListId':_0x58a04d['actions'][_0x1e640b]['ListId'],'VoiceQueueId':_0x58a04d[_0x41ee('0x129')][_0x1e640b]['VoiceQueueId']||undefined,'CampaignId':_0x58a04d[_0x41ee('0x129')][_0x1e640b]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x58a04d['actions'][_0x1e640b];}}else{return _0x58a04d[_0x41ee('0x166')](_0x53a8a5,_0x1dda1f);}}else{if(getDiff(_0x1dda1f[_0x41ee('0x1ed')])<_0x53a8a5[_0x41ee('0x1ee')]*0x3c){if(_0x1dda1f[_0x41ee('0x1ef')]&&!_0x1dda1f[_0x41ee('0x1ef')]['voicePause']){_0x58a04d[_0x41ee('0x1e')][_0x41ee('0x132')](_0x1dda1f['id'])[_0x41ee('0x1c')](function(){_0x58a04d[_0x41ee('0xba')](_0x53a8a5);});}else{_0x58a04d[_0x41ee('0xc8')]({'active':![]},_0x1dda1f['id'],0x1)[_0x41ee('0x1c')](function(){_0x58a04d[_0x41ee('0xba')](_0x53a8a5);});}}else{_0x53a8a5[_0x41ee('0x69')]+=0x1;_0x58a04d['updateOriginated'](_0x53a8a5);if(_0x53a8a5[_0x41ee('0x1f0')]){_0x58a04d[_0x41ee('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1dda1f[_0x41ee('0xd7')],'ListId':_0x1dda1f[_0x41ee('0xd8')],'VoiceQueueId':_0x1dda1f['VoiceQueueId']||undefined,'CampaignId':_0x1dda1f[_0x41ee('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x58a04d[_0x41ee('0xd1')](createObjHistory(_0x53a8a5,_0x1dda1f,_0x41ee('0x1f1'),0x17,_0x41ee('0x1f2')))[_0x41ee('0xb8')](loggerCatch(_0x41ee('0x1f3')));}else{_0x58a04d[_0x41ee('0xd5')](createObjHistory(_0x53a8a5,_0x1dda1f,'RECALLFAILEDTIMEOUT',0x16,_0x41ee('0x1f4')),_0x41ee('0x1f5'),'[Originate][HistoryRecallClose]');}}}}else{_0x53a8a5[_0x41ee('0x64')]+=0x1;_0x58a04d[_0x41ee('0xd5')](createObjHistory(_0x53a8a5,_0x1dda1f,_0x41ee('0x1f6'),0xd,_0x41ee('0x1f7')),'[Originate][historyBlacklist]',_0x41ee('0x1f8'));throw _0x41ee('0x1f9');}};};Dialer[_0x41ee('0xaf')]['handleIvr']=function(_0x318646){var _0x27f19e=this;var _0x36045c=_0x318646['limitCalls']-_0x318646[_0x41ee('0x76')]-_0x318646['temp'];emitCampaignSummary(_0x318646);if(_0x36045c>0x0){if(_0x36045c>this['maxNumberOriginate']){_0x36045c=this[_0x41ee('0x23')];}_0x318646[_0x41ee('0x1fa')]+=_0x36045c;this[_0x41ee('0xcc')](_0x318646['id'],_0x36045c,_0x318646[_0x41ee('0x1fb')])['then'](function(_0x3c0023){_0x318646['temp']-=_0x36045c;_0x318646[_0x41ee('0x1fa')]=_0x318646['temp']>0x0?_0x318646[_0x41ee('0x1fa')]:0x0;if(!checkContactEmpty(_0x3c0023)){_0x318646[_0x41ee('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x41ee('0x83')](_0x41ee('0x1fc')+_0x318646[_0x41ee('0x41')]);}else{_0x318646[_0x41ee('0x76')]+=_0x3c0023[_0x41ee('0xa0')];_0x318646['message']=_0x41ee('0x1fd');for(var _0x3dda84=0x0;_0x3dda84<_0x3c0023[_0x41ee('0xa0')];_0x3dda84+=0x1){_0x318646[_0x41ee('0x1fe')]+=0x1;if(_[_0x41ee('0xe3')](_0x3c0023[_0x3dda84])||_[_0x41ee('0xe3')](_0x3c0023[_0x3dda84][_0x41ee('0x169')])||_[_0x41ee('0xe3')](_0x3c0023[_0x3dda84][_0x41ee('0x169')][_0x41ee('0x16a')])){_0x27f19e[_0x41ee('0xd4')](_0x41ee('0x1ff'),_0x318646,_0x3c0023[_0x3dda84]);}else{_0x27f19e[_0x41ee('0xc3')](_[_0x41ee('0xd6')](_0x3c0023[_0x3dda84],[_0x41ee('0xdb'),_0x41ee('0x200')]))[_0x41ee('0xbf')](_0x27f19e[_0x41ee('0x1e6')](_0x318646,_0x3c0023[_0x3dda84]))[_0x41ee('0xb8')](_0x27f19e['loggerHandler'](_0x41ee('0x201'),_0x318646));}}}})[_0x41ee('0xb8')](loggerGetContactDialer(_0x41ee('0x202'),_0x318646,_0x36045c));}};Dialer[_0x41ee('0xaf')]['handlePower']=function(_0x2ddfdd,_0x5b453f){var _0x8118ac=this;var _0x380e52=[];var _0x44ac20=_0x5b453f>=0x1?_0x5b453f:0x1;if(_0x2ddfdd['dialMethod']===_0x41ee('0x158')){_0x44ac20=0x1;}var _0x459257=Math[_0x41ee('0x1c8')](_0x2ddfdd[_0x41ee('0x50')]*_0x44ac20)-_0x2ddfdd[_0x41ee('0x76')]-_0x2ddfdd[_0x41ee('0x1fa')];emitVoiceQueueSummary(_0x2ddfdd);if(_0x2ddfdd[_0x41ee('0x203')]>0x0){var _0x73670d=_0x2ddfdd[_0x41ee('0x203')]-_0x2ddfdd[_0x41ee('0x76')]-_0x2ddfdd['talking']-_0x2ddfdd[_0x41ee('0x1fa')]-_0x2ddfdd[_0x41ee('0x52')];if(_0x459257>_0x73670d){_0x459257=_0x73670d;}}if(_0x459257>0x0){if(_0x2ddfdd['dialMethod']===_0x41ee('0x158')){_0x459257=0x1;}if(_0x459257>this['maxNumberOriginate']){_0x459257=this['maxNumberOriginate'];}_0x2ddfdd[_0x41ee('0x1fa')]+=_0x459257;for(var _0x59a902 in this[_0x41ee('0x21')]){if(typeof this['agents'][_0x59a902]!=='undefined'){if(this[_0x41ee('0x21')][_0x59a902]['state']===_0x41ee('0x204')&&this[_0x41ee('0x21')][_0x59a902][_0x41ee('0xb6')]===_0x41ee('0xe2')){_0x380e52[_0x41ee('0x148')](this[_0x41ee('0x21')][_0x59a902]['id']);}}}this[_0x41ee('0xca')](_0x2ddfdd['id'],_0x380e52,_0x459257,_0x2ddfdd[_0x41ee('0x1fb')])['then'](function(_0x17682f){_0x2ddfdd[_0x41ee('0x1fa')]-=_0x459257;_0x2ddfdd[_0x41ee('0x1fa')]=_0x2ddfdd['temp']>0x0?_0x2ddfdd[_0x41ee('0x1fa')]:0x0;if(!checkContactEmpty(_0x17682f)){_0x8118ac['countReScheduled'](_0x2ddfdd)[_0x41ee('0xbf')](sendMessageReschedule(_0x2ddfdd))[_0x41ee('0xb8')](loggerCatch(_0x41ee('0xc1')));}else{_0x2ddfdd[_0x41ee('0x76')]+=_0x17682f[_0x41ee('0xa0')];_0x2ddfdd['message']=_0x2ddfdd['dialMethod']===_0x41ee('0x158')?'ACTIVE':_0x41ee('0x1fd');for(var _0x3e8977=0x0;_0x3e8977<_0x17682f[_0x41ee('0xa0')];_0x3e8977+=0x1){if(_[_0x41ee('0xe3')](_0x17682f[_0x3e8977])||_[_0x41ee('0xe3')](_0x17682f[_0x3e8977]['Contact'])||_[_0x41ee('0xe3')](_0x17682f[_0x3e8977][_0x41ee('0x169')][_0x41ee('0x16a')])){_0x8118ac['emptyContact'](_0x41ee('0x1ff'),_0x2ddfdd,_0x17682f[_0x3e8977]);}else{_0x8118ac[_0x41ee('0xc2')](_[_0x41ee('0xd6')](_0x17682f[_0x3e8977],['VoiceQueueId','Contact.phone']))[_0x41ee('0xbf')](_0x8118ac[_0x41ee('0x1e6')](_0x2ddfdd,_0x17682f[_0x3e8977]))[_0x41ee('0xb8')](_0x8118ac[_0x41ee('0x205')]('[actionOriginate]\x20',_0x2ddfdd));}}}})[_0x41ee('0xb8')](loggerGetContactDialer(_0x41ee('0x206'),_0x2ddfdd,_0x459257));}};Dialer[_0x41ee('0xaf')][_0x41ee('0x97')]=function(_0x174c93){if(_0x174c93[_0x41ee('0x203')]>0x0){var _0x5e6f69=_0x174c93[_0x41ee('0x203')]-_0x174c93[_0x41ee('0x76')]-_0x174c93['talking'];if(_0x5e6f69>0x0){this[_0x41ee('0x207')](_0x174c93);}else{loggerPredictiveCalls[_0x41ee('0x83')]('[handlePredictive][limitChannel]');}}else{this[_0x41ee('0x207')](_0x174c93);}};Dialer[_0x41ee('0xaf')][_0x41ee('0x207')]=function(_0xd7e106){var _0x380ab2=this;var _0x17c98c=[];_0xd7e106['originated']+=0x1;for(var _0x6ffc28 in this[_0x41ee('0x21')]){if(typeof this[_0x41ee('0x21')][_0x6ffc28]!==_0x41ee('0xb3')){if(this[_0x41ee('0x21')][_0x6ffc28][_0x41ee('0xab')]==='not_inuse'&&this['agents'][_0x6ffc28][_0x41ee('0xb6')]===_0x41ee('0xe2')){_0x17c98c['push'](this[_0x41ee('0x21')][_0x6ffc28]['id']);}}}this[_0x41ee('0xca')](_0xd7e106['id'],_0x17c98c,0x1,_0xd7e106[_0x41ee('0x1fb')])[_0x41ee('0xbf')](function(_0x1da70e){if(!checkContactEmpty(_0x1da70e)){checkContactLowerLimitOriginate(_0xd7e106,0x1,0x0);_0x380ab2[_0x41ee('0xc0')](_0xd7e106)[_0x41ee('0xbf')](sendMessageReschedule(_0xd7e106))[_0x41ee('0xb8')](loggerCatch('[countReScheduled]\x20'));}else{_0xd7e106[_0x41ee('0x3f')]='RUNNING';if(_[_0x41ee('0xe3')](_0x1da70e[0x0])||_[_0x41ee('0xe3')](_0x1da70e[0x0]['Contact'])||_['isNil'](_0x1da70e[0x0][_0x41ee('0x169')][_0x41ee('0x16a')])){_0x380ab2[_0x41ee('0xd4')](_0x41ee('0x1ff'),_0xd7e106,_0x1da70e[0x0]);}else{_0x380ab2[_0x41ee('0xc2')](_['pick'](_0x1da70e[0x0],[_0x41ee('0xda'),_0x41ee('0x200')]))['then'](_0x380ab2[_0x41ee('0x1e6')](_0xd7e106,_0x1da70e[0x0]))[_0x41ee('0xb8')](_0x380ab2[_0x41ee('0x205')](_0x41ee('0x208'),_0xd7e106));}}})[_0x41ee('0xb8')](loggerGetContactDialer(_0x41ee('0x209'),_0xd7e106,0x1));emitVoiceQueueSummary(_0xd7e106);};Dialer[_0x41ee('0xaf')][_0x41ee('0x1e2')]=function(_0x48e0ea,_0x3a417b,_0x934186,_0x36c2e0,_0x5824ee,_0x483236){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x41ee('0x83')](_0x41ee('0x20a'),_0x48e0ea);loggerPredictive[_0x41ee('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a417b);loggerPredictive[_0x41ee('0x83')]('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',_0x934186);loggerPredictive[_0x41ee('0x83')]('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',_0x36c2e0);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x20b'),_0x5824ee);loggerPredictive['info'](_0x41ee('0x8b'));return new BPromise(function(_0x602aea,_0x29aff9){if(_0x48e0ea<=0x0||isNaN(_0x48e0ea)){return _0x29aff9(msgResponse(_0x41ee('0x20c'),'Error',_0x41ee('0x20d')+_0x48e0ea));}if(_0x934186<=0x0||isNaN(_0x934186)){return _0x29aff9(msgResponse(_0x41ee('0x20c'),_0x41ee('0x49'),'Ts\x20=\x20'+_0x934186));}if(_0x36c2e0<=0x0||isNaN(_0x36c2e0)){return _0x29aff9(msgResponse('[abandonmentRate]','Error',_0x41ee('0x20e')+_0x36c2e0));}if(_0x3a417b<=0x0||isNaN(_0x3a417b)){return _0x29aff9(msgResponse(_0x41ee('0x20c'),_0x41ee('0x49'),'interval\x20=\x20'+_0x3a417b));}if(_0x5824ee<=0x0||isNaN(_0x5824ee)){return _0x29aff9(msgResponse(_0x41ee('0x20c'),'Error',_0x41ee('0x20f')+_0x5824ee));}_0x483236=_0x483236||0x0;var _0x15f9c7=0x1/_0x934186;var _0x2f94f6=0x0;var _0x405cbd=0x0;var _0xda4cb5=0x0;var _0x126c71=0x0;for(var _0x1a23d9=0x0;_0xda4cb5<_0x5824ee;_0x1a23d9+=0x1){_0x405cbd=_0x1a23d9/_0x3a417b;_0x2f94f6=(_0x36c2e0*_0x405cbd+_0x483236)/_0x15f9c7;_0xda4cb5=erlangb(_0x2f94f6,_0x48e0ea);_0x126c71=_0x2f94f6/_0x48e0ea*(0x1-erlangb(_0x2f94f6,_0x48e0ea));}return _0x602aea({'erlangCalls':_0x1a23d9,'erlangCallToSecond':_0x3a417b/_0x1a23d9,'erlangAbandonmentRate':_0xda4cb5,'erlangBusyFactor':_0x126c71});});};Dialer[_0x41ee('0xaf')][_0x41ee('0x1dc')]=function(_0x28d1e6,_0x3f4d0a,_0x2e1309,_0x52bada,_0x228ee4,_0x53e2dc){loggerPredictive[_0x41ee('0x83')](_0x41ee('0x210'));loggerPredictive['info'](_0x41ee('0x20a'),_0x28d1e6);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x211'),_0x3f4d0a);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x212'),_0x2e1309);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x213'),_0x52bada);loggerPredictive[_0x41ee('0x83')](_0x41ee('0x214'),_0x228ee4);loggerPredictive['info'](_0x41ee('0x8b'));return new BPromise(function(_0x4f10f9,_0x45fd57){if(_0x28d1e6<=0x0||isNaN(_0x28d1e6)){return _0x45fd57(msgResponse(_0x41ee('0x215'),_0x41ee('0x49'),_0x41ee('0x20d')+_0x28d1e6));}if(_0x2e1309<=0x0||isNaN(_0x2e1309)){return _0x45fd57(msgResponse(_0x41ee('0x215'),_0x41ee('0x49'),_0x41ee('0x216')+_0x2e1309));}if(_0x52bada<=0x0||isNaN(_0x52bada)){return _0x45fd57(msgResponse('[busyFactor]',_0x41ee('0x49'),'p\x20=\x20'+_0x52bada));}if(_0x3f4d0a<=0x0||isNaN(_0x3f4d0a)){return _0x45fd57(msgResponse(_0x41ee('0x215'),_0x41ee('0x49'),'interval\x20=\x20'+_0x3f4d0a));}if(_0x228ee4<=0x0||isNaN(_0x228ee4)){return _0x45fd57(msgResponse(_0x41ee('0x215'),_0x41ee('0x49'),_0x41ee('0x217')+_0x228ee4));}_0x53e2dc=_0x53e2dc||0x0;var _0x2fdc16=0x1/_0x2e1309;var _0xf87e58=0x0;var _0x43642a=0x0;var _0x463d94=0x0;var _0x112a57=0x0;for(var _0x26554e=0x0;_0x112a57<_0x228ee4;_0x26554e+=0x1){_0x43642a=_0x26554e/_0x3f4d0a;_0xf87e58=(_0x52bada*_0x43642a+_0x53e2dc)/_0x2fdc16;_0x463d94=erlangb(_0xf87e58,_0x28d1e6);_0x112a57=_0xf87e58/_0x28d1e6*(0x1-erlangb(_0xf87e58,_0x28d1e6));}return _0x4f10f9({'erlangCalls':_0x26554e,'erlangCallToSecond':_0x3f4d0a/_0x26554e,'erlangAbandonmentRate':_0x463d94,'erlangBusyFactor':_0x112a57});});};module[_0x41ee('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ded6399..05df9f7 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 _0xe41c=['countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','campaigntype','type','queue'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xe41c,0x6c));var _0xce41=function(_0x166da0,_0x394844){_0x166da0=_0x166da0-0x0;var _0x5c5717=_0xe41c[_0x166da0];return _0x5c5717;};'use strict';var util=require('util');var _=require(_0xce41('0x0'));var moment=require(_0xce41('0x1'));function getSeconds(_0x24cc0e,_0x517d42){var _0xee556a=moment(_0x24cc0e)[_0xce41('0x2')](0x0);var _0x56687f=moment(_0x517d42)[_0xce41('0x2')](0x0);return _0xee556a[_0xce41('0x3')](_0x56687f,_0xce41('0x4'));}function QueueCallerAbandon(_0x308359,_0x31d277){this[_0xce41('0x5')]=_0x308359[_0xce41('0x5')];this['type']=_0x308359['type'];this[_0xce41('0x6')]=_0x308359[_0xce41('0x7')]==='outbound'?_0xce41('0x8'):_0x308359[_0xce41('0x7')];this['countbusyretry']=_0x308359[_0xce41('0x9')];this[_0xce41('0xa')]=_0x308359[_0xce41('0xa')];this['countnoanswerretry']=_0x308359[_0xce41('0xb')];this['countglobal']=_0x308359[_0xce41('0x9')]+_0x308359[_0xce41('0xa')]+_0x308359[_0xce41('0xb')]+_0x308359['countnosuchnumberretry']+_0x308359[_0xce41('0xc')]+_0x308359[_0xce41('0xd')]+_0x308359[_0xce41('0xe')]+_0x308359[_0xce41('0xf')];this[_0xce41('0x10')]=_0x308359[_0xce41('0x10')];this[_0xce41('0xc')]=_0x308359[_0xce41('0xc')];this[_0xce41('0xd')]=_0x308359[_0xce41('0xd')];this[_0xce41('0xe')]=_0x308359[_0xce41('0xe')];this[_0xce41('0xf')]=_0x308359[_0xce41('0xf')];this[_0xce41('0x11')]=_0x31d277[_0xce41('0x11')];this['calleridname']=_0x308359['name'];this[_0xce41('0x12')]=_0x308359[_0xce41('0x13')];this['starttime']=_0x308359[_0xce41('0x14')];this['responsetime']=_0x308359[_0xce41('0x15')];this['droptime']=_0x308359[_0xce41('0x16')];this[_0xce41('0x17')]=this[_0xce41('0x16')];this['ringtime']=getSeconds(_0x308359['responsetime'],_0x308359[_0xce41('0x14')]);this['holdtime']=getSeconds(this['droptime'],_0x308359[_0xce41('0x15')]);this[_0xce41('0x18')]=0x0;this[_0xce41('0x8')]=_0x31d277[_0xce41('0x8')];this['membername']=_0x31d277[_0xce41('0x19')];this[_0xce41('0x1a')]=_0x31d277[_0xce41('0x1a')];this[_0xce41('0x1b')]=_0x308359['callback'];this['callbackuniqueid']=_0x308359[_0xce41('0x1c')];this[_0xce41('0x1d')]=_0x308359[_0xce41('0x1d')];this[_0xce41('0x1e')]=_0x308359[_0xce41('0x1e')];this[_0xce41('0x1f')]=_0x308359['ContactId'];this[_0xce41('0x20')]=_0x308359[_0xce41('0x20')];this[_0xce41('0x21')]=_0x308359[_0xce41('0x21')];this[_0xce41('0x22')]=_0x308359['VoiceQueueId'];this[_0xce41('0x23')]=_0x308359[_0xce41('0x23')];this['originatecalleridnum']=_0x308359[_0xce41('0x24')]||'';this['originatecalleridname']=_0x308359[_0xce41('0x25')]||'';}module[_0xce41('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0xf325=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5c936a,_0xe29226){var _0x58a8a0=function(_0x5f36fd){while(--_0x5f36fd){_0x5c936a['push'](_0x5c936a['shift']());}};_0x58a8a0(++_0xe29226);}(_0xf325,0x1b5));var _0x5f32=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xf325[_0x5d2803];return _0xdcad2c;};'use strict';var util=require('util');var _=require(_0x5f32('0x0'));var moment=require(_0x5f32('0x1'));function getSeconds(_0x589cdc,_0x34c5e4){var _0x1104b0=moment(_0x589cdc)[_0x5f32('0x2')](0x0);var _0x8f4712=moment(_0x34c5e4)[_0x5f32('0x2')](0x0);return _0x1104b0[_0x5f32('0x3')](_0x8f4712,_0x5f32('0x4'));}function QueueCallerAbandon(_0x3bcc1f,_0x399257){this[_0x5f32('0x5')]=_0x3bcc1f[_0x5f32('0x5')];this['type']=_0x3bcc1f[_0x5f32('0x6')];this[_0x5f32('0x7')]=_0x3bcc1f[_0x5f32('0x6')]===_0x5f32('0x8')?_0x5f32('0x9'):_0x3bcc1f['type'];this[_0x5f32('0xa')]=_0x3bcc1f[_0x5f32('0xa')];this[_0x5f32('0xb')]=_0x3bcc1f['countcongestionretry'];this['countnoanswerretry']=_0x3bcc1f[_0x5f32('0xc')];this[_0x5f32('0xd')]=_0x3bcc1f[_0x5f32('0xa')]+_0x3bcc1f[_0x5f32('0xb')]+_0x3bcc1f[_0x5f32('0xc')]+_0x3bcc1f[_0x5f32('0xe')]+_0x3bcc1f[_0x5f32('0xf')]+_0x3bcc1f['countabandonedretry']+_0x3bcc1f[_0x5f32('0x10')]+_0x3bcc1f[_0x5f32('0x11')];this[_0x5f32('0xe')]=_0x3bcc1f[_0x5f32('0xe')];this[_0x5f32('0xf')]=_0x3bcc1f[_0x5f32('0xf')];this[_0x5f32('0x12')]=_0x3bcc1f[_0x5f32('0x12')];this[_0x5f32('0x10')]=_0x3bcc1f[_0x5f32('0x10')];this[_0x5f32('0x11')]=_0x3bcc1f[_0x5f32('0x11')];this[_0x5f32('0x13')]=_0x399257[_0x5f32('0x13')];this[_0x5f32('0x14')]=_0x3bcc1f[_0x5f32('0x15')];this[_0x5f32('0x16')]=_0x3bcc1f[_0x5f32('0x17')];this[_0x5f32('0x18')]=_0x3bcc1f[_0x5f32('0x18')];this[_0x5f32('0x19')]=_0x3bcc1f[_0x5f32('0x19')];this[_0x5f32('0x1a')]=_0x3bcc1f[_0x5f32('0x1a')];this['endtime']=this['droptime'];this[_0x5f32('0x1b')]=getSeconds(_0x3bcc1f[_0x5f32('0x19')],_0x3bcc1f['starttime']);this['holdtime']=getSeconds(this[_0x5f32('0x1a')],_0x3bcc1f['responsetime']);this[_0x5f32('0x1c')]=0x0;this[_0x5f32('0x9')]=_0x399257[_0x5f32('0x9')];this['membername']=_0x399257['connectedlinename'];this['reason']=_0x399257[_0x5f32('0x1d')];this[_0x5f32('0x1e')]=_0x3bcc1f[_0x5f32('0x1e')];this[_0x5f32('0x1f')]=_0x3bcc1f[_0x5f32('0x1f')];this[_0x5f32('0x20')]=_0x3bcc1f['callbackat'];this[_0x5f32('0x21')]=_0x3bcc1f[_0x5f32('0x21')];this['ContactId']=_0x3bcc1f[_0x5f32('0x22')];this[_0x5f32('0x23')]=_0x3bcc1f[_0x5f32('0x23')];this[_0x5f32('0x24')]=_0x3bcc1f[_0x5f32('0x24')];this[_0x5f32('0x25')]=_0x3bcc1f[_0x5f32('0x25')];this[_0x5f32('0x26')]=_0x3bcc1f[_0x5f32('0x26')];this[_0x5f32('0x27')]=_0x3bcc1f[_0x5f32('0x27')]||'';this[_0x5f32('0x28')]=_0x3bcc1f[_0x5f32('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d1b589b..638f32c 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 _0xf9fd=['channel','format','%s/%s/%s','tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid'];(function(_0x3929f8,_0x16f421){var _0xe6a97f=function(_0x21c9a8){while(--_0x21c9a8){_0x3929f8['push'](_0x3929f8['shift']());}};_0xe6a97f(++_0x16f421);}(_0xf9fd,0xa1));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xdf9f('0x0'));var _=require(_0xdf9f('0x1'));var moment=require(_0xdf9f('0x2'));function Action(_0xc3ebc1,_0x1370be,_0x244129){this[_0xdf9f('0x3')]=_0xc3ebc1||undefined;this[_0xdf9f('0x4')]=util[_0xdf9f('0x5')](_0xdf9f('0x6'),_0x1370be[_0xdf9f('0x7')],_0x1370be['Trunk'][_0xdf9f('0x8')],_0x244129[_0xdf9f('0x9')]);this[_0xdf9f('0xa')]=_0x1370be[_0xdf9f('0xa')];this[_0xdf9f('0xb')]=_0x1370be['headerinfo'];this[_0xdf9f('0xc')]=_0x244129['path'];this[_0xdf9f('0xd')]=_0x244129['AttachmentId'];}module[_0xdf9f('0xe')]=Action; \ No newline at end of file +var _0x76ff=['AttachmentId','util','lodash','moment','uniqueid','channel','format','%s/%s/%s','tech','name','fax','localstationid','headerinfo','path'];(function(_0x3271c9,_0x48667a){var _0x204ac7=function(_0x493be7){while(--_0x493be7){_0x3271c9['push'](_0x3271c9['shift']());}};_0x204ac7(++_0x48667a);}(_0x76ff,0x197));var _0xf76f=function(_0x39cfad,_0x5d3d1b){_0x39cfad=_0x39cfad-0x0;var _0x1126ba=_0x76ff[_0x39cfad];return _0x1126ba;};'use strict';var util=require(_0xf76f('0x0'));var _=require(_0xf76f('0x1'));var moment=require(_0xf76f('0x2'));function Action(_0x2a9c03,_0x283c86,_0x4ca5b9){this[_0xf76f('0x3')]=_0x2a9c03||undefined;this[_0xf76f('0x4')]=util[_0xf76f('0x5')](_0xf76f('0x6'),_0x283c86[_0xf76f('0x7')],_0x283c86['Trunk'][_0xf76f('0x8')],_0x4ca5b9[_0xf76f('0x9')]);this[_0xf76f('0xa')]=_0x283c86[_0xf76f('0xa')];this[_0xf76f('0xb')]=_0x283c86['headerinfo'];this[_0xf76f('0xc')]=_0x4ca5b9['path'];this[_0xf76f('0xd')]=_0x4ca5b9[_0xf76f('0xd')];}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 2b00406..da7d785 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 _0xade2=['path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/faxMessage','channels','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','logger','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','moment'];(function(_0x540c78,_0x2127ab){var _0x28c0e2=function(_0xee7c7){while(--_0xee7c7){_0x540c78['push'](_0x540c78['shift']());}};_0x28c0e2(++_0x2127ab);}(_0xade2,0xe9));var _0x2ade=function(_0x4a2c1f,_0x594c92){_0x4a2c1f=_0x4a2c1f-0x0;var _0x2da097=_0xade2[_0x4a2c1f];return _0x2da097;};'use strict';var util=require(_0x2ade('0x0'));var _=require(_0x2ade('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x2ade('0x2'));var path=require(_0x2ade('0x3'));var tiff2pdf=require(_0x2ade('0x4'));var gs=require('./util/gs');var logger=require(_0x2ade('0x5'))(_0x2ade('0x6'));var ami=require(_0x2ade('0x7'));var rpcDb=require(_0x2ade('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x2ade('0x9'));var faxAccount=require(_0x2ade('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x2ade('0xb'));function Fax(_0x127f6a){this[_0x2ade('0xc')]={};this['faxAccounts']=_0x127f6a['faxAccounts'];this[_0x2ade('0xd')]=_0x127f6a[_0x2ade('0xd')];this['actions']={};ami['on'](_0x2ade('0xe'),this['syncNewchannel'][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x10'),this[_0x2ade('0x11')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x12'),this[_0x2ade('0x13')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x14'),this[_0x2ade('0x15')]['bind'](this));ami['on'](_0x2ade('0x16'),this[_0x2ade('0x17')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x18'),this[_0x2ade('0x19')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x1a'),this[_0x2ade('0x1b')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x1c'),this[_0x2ade('0x1d')]['bind'](this));}Fax[_0x2ade('0x1e')]['syncNewchannel']=function(_0x4bfaf2){if(_0x4bfaf2[_0x2ade('0x1f')]===_0x2ade('0x20')){for(var _0xb1b142 in this[_0x2ade('0x21')]){if(this['faxAccounts'][_0x2ade('0x22')](_0xb1b142)){if(_0x4bfaf2[_0x2ade('0x23')]===this[_0x2ade('0x21')][_0xb1b142][_0x2ade('0x24')]){this['channels'][_0x4bfaf2[_0x2ade('0x25')]]={};this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]][_0x2ade('0x26')]=_0x4bfaf2[_0x2ade('0x26')];this[_0x2ade('0xc')][_0x4bfaf2['uniqueid']]['id']=this[_0x2ade('0x21')][_0xb1b142]['id'];this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]][_0x2ade('0x27')]=this[_0x2ade('0x21')][_0xb1b142]['name'];logger[_0x2ade('0x28')](_0x4bfaf2['uniqueid'],_0x2ade('0x29'));}}}}if(this[_0x2ade('0x2a')][_0x4bfaf2['uniqueid']]){this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]]={};this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]][_0x2ade('0x26')]=_0x4bfaf2[_0x2ade('0x26')];logger[_0x2ade('0x28')](_0x4bfaf2[_0x2ade('0x25')],_0x2ade('0x29'));}};Fax[_0x2ade('0x1e')]['syncVarSet']=function(_0x44e94c){if(this[_0x2ade('0xc')][_0x44e94c['uniqueid']]){for(var _0x1ec295 in _0x44e94c['variable']){if(_0x44e94c[_0x2ade('0x2b')][_0x2ade('0x22')](_0x1ec295)){this[_0x2ade('0xc')][_0x44e94c[_0x2ade('0x25')]][_0x1ec295]=_0x44e94c[_0x2ade('0x2c')];}}}};Fax[_0x2ade('0x1e')]['syncNewState']=function(_0x2db88e){if(this[_0x2ade('0xc')][_0x2db88e['uniqueid']]){this[_0x2ade('0xc')][_0x2db88e['uniqueid']][_0x2ade('0x2d')]=_0x2db88e[_0x2ade('0x2d')];this[_0x2ade('0xc')][_0x2db88e[_0x2ade('0x25')]][_0x2ade('0x2e')]=_0x2db88e[_0x2ade('0x2e')];}};Fax[_0x2ade('0x1e')]['syncNewExten']=function(_0xa7218d){if(this[_0x2ade('0xc')][_0xa7218d[_0x2ade('0x25')]]){for(var _0x3940c8 in _0xa7218d[_0x2ade('0x2b')]){if(_0xa7218d[_0x2ade('0x2b')][_0x2ade('0x22')](_0x3940c8)){this['channels'][_0xa7218d[_0x2ade('0x25')]][_0x3940c8]=_0xa7218d[_0x2ade('0x2c')];}}}};Fax[_0x2ade('0x1e')]['syncFaxStatus']=function(_0x4f49e0){if(this['channels'][_0x4f49e0[_0x2ade('0x25')]]){this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x2f')]=_0x4f49e0[_0x2ade('0x2f')];this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x30')]=_0x4f49e0[_0x2ade('0x30')];this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x24')]=_0x4f49e0[_0x2ade('0x24')];this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x31')]=_0x4f49e0[_0x2ade('0x31')];logger[_0x2ade('0x28')](_0x4f49e0[_0x2ade('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0x2ade('0x1e')][_0x2ade('0x19')]=function(_0x3f4fc6){var _0x175f90=this;if(this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]]){var _0x39354d=this[_0x2ade('0xc')][_0x3f4fc6['uniqueid']]['id'];this['channels'][_0x3f4fc6[_0x2ade('0x25')]][_0x2ade('0x32')]=_0x3f4fc6['remotestationid'];this['channels'][_0x3f4fc6['uniqueid']][_0x2ade('0x33')]=_0x3f4fc6['pagestransferred'];this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]]['localstationid']=_0x3f4fc6[_0x2ade('0x24')];this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]][_0x2ade('0x34')]=_0x3f4fc6[_0x2ade('0x34')];this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]][_0x2ade('0x35')]=_0x3f4fc6[_0x2ade('0x35')];this['channels'][_0x3f4fc6['uniqueid']][_0x2ade('0x31')]=_0x3f4fc6[_0x2ade('0x31')];this['channels'][_0x3f4fc6['uniqueid']]['calleridnum']=_0x3f4fc6[_0x2ade('0x36')];if(this['channels'][_0x3f4fc6['uniqueid']][_0x2ade('0x33')]>0x0){tiff2pdf(_0x3f4fc6[_0x2ade('0x31')],_0x2ade('0x37'),function(_0x5a1ec4){logger[_0x2ade('0x28')](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x38'),_0x5a1ec4[_0x2ade('0x39')]);attachment['create']({'name':path[_0x2ade('0x3a')](_0x3f4fc6['filename'])[_0x2ade('0x27')],'basename':path['parse'](_0x3f4fc6[_0x2ade('0x31')])['name']+_0x2ade('0x3b'),'type':_0x2ade('0x3c')})[_0x2ade('0x3d')](function(_0xd055fa){faxAccount[_0x2ade('0x3e')](_0x39354d,{'from':_0x3f4fc6[_0x2ade('0x36')],'mapKey':_0x2ade('0x6'),'body':path[_0x2ade('0x3a')](_0x3f4fc6[_0x2ade('0x31')])[_0x2ade('0x27')]+'.pdf','AttachmentId':_0xd055fa['id']})['catch'](function(_0x3abc9c){logger[_0x2ade('0x3f')](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x40'),JSON['stringify'](_0x3abc9c));});})[_0x2ade('0x41')](function(_0x58cb8c){logger['error'](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x42'),JSON[_0x2ade('0x43')](_0x58cb8c));});});}logger[_0x2ade('0x28')](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x2b0a11){if(this['actions'][_0x2b0a11[_0x2ade('0x25')]]){_['merge'](this[_0x2ade('0xc')][_0x2b0a11[_0x2ade('0x25')]],_['pick'](_0x2b0a11,[_0x2ade('0x44'),_0x2ade('0x45')]));}};function updateStatus(_0xe2cde7){if(_0xe2cde7['AttachmentId']){faxMessage[_0x2ade('0x46')](_0xe2cde7[_0x2ade('0x47')],{'failMessage':_0x2ade('0x48')})[_0x2ade('0x3d')](function(_0x29407d){ut['logger'](_0x2ade('0x49'),_0x29407d);})[_0x2ade('0x41')](function(_0x534e08){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x534e08);});}else{ut['logger'](_0x2ade('0x4a'));}}Fax['prototype'][_0x2ade('0x4b')]=function(_0x46d4d1,_0x5dba60,_0x30675c){var _0x57c097=this;var _0x383510={};if(_0x5dba60){_0x383510={'read':_0x5dba60};}else{_0x383510={'failMessage':_0x30675c};}if(this[_0x2ade('0x2a')][_0x46d4d1][_0x2ade('0x47')]){faxMessage[_0x2ade('0x46')](this[_0x2ade('0x2a')][_0x46d4d1][_0x2ade('0x47')],_0x383510)['then'](function(_0x34e842){ut[_0x2ade('0x4c')](_0x2ade('0x4d'),_0x34e842);})[_0x2ade('0x41')](function(_0x521965){ut[_0x2ade('0x4c')](_0x2ade('0x4e'),_0x521965);})[_0x2ade('0x4f')](function(){delete _0x57c097[_0x2ade('0xc')][_0x46d4d1];delete _0x57c097['actions'][_0x46d4d1];});}else{ut[_0x2ade('0x4c')](_0x2ade('0x50'));delete this[_0x2ade('0xc')][_0x46d4d1];delete this[_0x2ade('0x2a')][_0x46d4d1];}};Fax[_0x2ade('0x1e')][_0x2ade('0x1b')]=function(_0x2cbdbb){var _0x3b8ae2=this;if(this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]]){if(this['actions'][_0x2cbdbb[_0x2ade('0x25')]]){this['channels'][_0x2cbdbb[_0x2ade('0x25')]]['id']=this[_0x2ade('0x2a')][_0x2cbdbb['uniqueid']]['id'];this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]][_0x2ade('0x27')]=this[_0x2ade('0x2a')][_0x2cbdbb['uniqueid']]['name'];}logger['info'](_0x2cbdbb[_0x2ade('0x25')],this[_0x2ade('0x2a')][_0x2cbdbb[_0x2ade('0x25')]]?_0x2ade('0x51'):_0x2ade('0x52'),JSON[_0x2ade('0x43')](this[_0x2ade('0xc')][_0x2cbdbb['uniqueid']]));if(this[_0x2ade('0x2a')][_0x2cbdbb[_0x2ade('0x25')]]){if(this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]][_0x2ade('0x53')]>0x0&&this['channels'][_0x2cbdbb[_0x2ade('0x25')]]['faxstatus']===_0x2ade('0x54')){this[_0x2ade('0x4b')](_0x2cbdbb['uniqueid'],!![]);}else{this[_0x2ade('0x4b')](_0x2cbdbb[_0x2ade('0x25')],![],this[_0x2ade('0xc')][_0x2cbdbb['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]][_0x2ade('0x55')]:_0x2ade('0x56'));}}}};Fax[_0x2ade('0x1e')]['send']=function(_0x52d11b){var _0x2e261d=this;return new BPromise(function(_0x4cab56,_0x154097){_0x2e261d['execOriginate'](_0x52d11b,_0x2e261d[_0x2ade('0x21')][_0x52d11b[_0x2ade('0x57')]])[_0x2ade('0x3d')](function(_0x3926e1){ut[_0x2ade('0x4c')](_0x2ade('0x58'),_0x3926e1);_0x4cab56(ut[_0x2ade('0x39')](_0x2ade('0x59')));})[_0x2ade('0x41')](function(_0x1786d5){ut[_0x2ade('0x4c')](_0x2ade('0x5a'),_0x1786d5);updateStatus(_0x52d11b);_0x154097(ut['message'](_0x2ade('0x5b')));});});};Fax[_0x2ade('0x1e')][_0x2ade('0x5c')]=function(_0x4a4880){var _0x5a88bd=this;return new BPromise(function(_0x7df9a0,_0x408e35){var _0x36097f=_0x5a88bd[_0x2ade('0x5d')](_0x5a88bd['faxAccounts'][_0x4a4880[_0x2ade('0x57')]][_0x2ade('0x5e')],_0x4a4880);if(_0x36097f[_0x2ade('0x5f')]){_0x7df9a0(ut[_0x2ade('0x39')](_0x2ade('0x60')));}else{_0x408e35(ut[_0x2ade('0x39')](_0x36097f['message']));}});};function originate(_0x3b3b35,_0x44c730,_0x4dc4c5){return new BPromise(function(_0x1d0ec4,_0x112f79){if(_0x4dc4c5){var _0x407bb6=util[_0x2ade('0x61')](_0x2ade('0x62'),path[_0x2ade('0x3a')](_0x3b3b35['path'])[_0x2ade('0x27')],_0x3b3b35['path']);gs[_0x2ade('0x63')](_0x407bb6)[_0x2ade('0x3d')](function(){_0x3b3b35[_0x2ade('0x3')]=util[_0x2ade('0x61')](_0x2ade('0x64'),path['parse'](_0x3b3b35[_0x2ade('0x3')])['dir'],path[_0x2ade('0x3a')](_0x3b3b35[_0x2ade('0x3')])[_0x2ade('0x27')]);_0x44c730[_0x2ade('0x65')]=_0x3b3b35[_0x2ade('0x3')];ut['logger'](_0x2ade('0x66'),'');ami[_0x2ade('0x67')](ut[_0x2ade('0x68')](_0x3b3b35,_0x44c730))[_0x2ade('0x3d')](function(_0x24aaad){_0x1d0ec4(_0x24aaad);})[_0x2ade('0x41')](function(_0x12f8be){_0x112f79(_0x12f8be);});})['catch'](function(_0x4c13da){_0x112f79(_0x4c13da);});}else{ami[_0x2ade('0x67')](ut[_0x2ade('0x68')](_0x3b3b35,_0x44c730))[_0x2ade('0x3d')](function(_0x4f52d7){_0x1d0ec4(_0x4f52d7);})['catch'](function(_0x1b42e9){_0x112f79(_0x1b42e9);});}});}Fax[_0x2ade('0x1e')][_0x2ade('0x69')]=function(_0x4b6fe4,_0x541098){var _0x11f637=this;return new BPromise(function(_0x3b49f7,_0x4fbf29){var _0x3e770e=uuid['v4']();var _0x33fa02=ut['addVariables'](_0x4b6fe4,_0x541098);_0x11f637[_0x2ade('0x2a')][_0x3e770e]=new Action(_0x3e770e,_0x541098,_0x4b6fe4);var _0x483a51=_0x11f637[_0x2ade('0x2a')][_0x3e770e];if(path['parse'](_0x4b6fe4[_0x2ade('0x3')])['ext']===_0x2ade('0x3b')){originate(_0x483a51,_0x33fa02,!![])['then'](function(_0x51e3df){_0x3b49f7(_0x51e3df);})['catch'](function(_0x20df67){_0x4fbf29(_0x20df67);});}else{originate(_0x483a51,_0x33fa02,![])[_0x2ade('0x3d')](function(_0x262bba){_0x3b49f7(_0x262bba);})[_0x2ade('0x41')](function(_0x167a3){_0x4fbf29(_0x167a3);});}});};Fax[_0x2ade('0x1e')][_0x2ade('0x6a')]=function(_0x5ab004){return!_[_0x2ade('0x6b')](_0x5ab004)&&!_[_0x2ade('0x6b')](_0x5ab004[_0x2ade('0x27')])&&!_[_0x2ade('0x6b')](_0x5ab004[_0x2ade('0x6c')])&&_0x5ab004[_0x2ade('0x6c')]&&!_[_0x2ade('0x6b')](this[_0x2ade('0xd')][util[_0x2ade('0x61')](_0x2ade('0x6d'),_0x5ab004[_0x2ade('0x27')])])&&!_['isNil'](this['trunks'][util[_0x2ade('0x61')](_0x2ade('0x6d'),_0x5ab004[_0x2ade('0x27')])][_0x2ade('0x30')])&&(this[_0x2ade('0xd')][util['format'](_0x2ade('0x6d'),_0x5ab004[_0x2ade('0x27')])][_0x2ade('0x30')]===_0x2ade('0x6e')||this[_0x2ade('0xd')][util[_0x2ade('0x61')]('SIP/%s',_0x5ab004[_0x2ade('0x27')])][_0x2ade('0x30')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x37accb,_0x35ee7a){if(!this[_0x2ade('0x6a')](_0x37accb)){ut['logger'](_0x2ade('0x6f'),_[_0x2ade('0x6b')](_0x37accb)?'':_0x37accb[_0x2ade('0x27')]+_0x2ade('0x70'));return{'isValid':![],'message':_0x2ade('0x71')};}if(_['isNil'](_0x35ee7a[_0x2ade('0x6')])){ut[_0x2ade('0x4c')](_0x2ade('0x72'),JSON['stringify'](_0x35ee7a));return{'isValid':![],'message':_0x2ade('0x73')};}if(_[_0x2ade('0x6b')](_0x35ee7a['path'])){ut['logger'](_0x2ade('0x74'),JSON[_0x2ade('0x43')](_0x35ee7a));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2ade('0x75')]=Fax; \ No newline at end of file +var _0x70a7=['create','parse','.pdf','notify','fax','catch','\x20notify\x20','error','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','actions','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','stringify','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x70a7,0x131));var _0x770a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x70a7[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x770a('0x0'));var _=require(_0x770a('0x1'));var BPromise=require(_0x770a('0x2'));var uuid=require('uuid');var moment=require(_0x770a('0x3'));var path=require(_0x770a('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x770a('0x5'));var logger=require('../../../config/logger')('fax');var ami=require(_0x770a('0x6'));var rpcDb=require(_0x770a('0x7'));var Channel=require(_0x770a('0x8'));var ut=require(_0x770a('0x9'));var Action=require(_0x770a('0xa'));var faxAccount=require(_0x770a('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x56430a){this['channels']={};this[_0x770a('0xc')]=_0x56430a[_0x770a('0xc')];this[_0x770a('0xd')]=_0x56430a[_0x770a('0xd')];this['actions']={};ami['on'](_0x770a('0xe'),this[_0x770a('0xf')]['bind'](this));ami['on'](_0x770a('0x10'),this[_0x770a('0x11')][_0x770a('0x12')](this));ami['on'](_0x770a('0x13'),this[_0x770a('0x14')][_0x770a('0x12')](this));ami['on'](_0x770a('0x15'),this[_0x770a('0x16')][_0x770a('0x12')](this));ami['on'](_0x770a('0x17'),this[_0x770a('0x18')]['bind'](this));ami['on'](_0x770a('0x19'),this[_0x770a('0x1a')]['bind'](this));ami['on']('hangup',this[_0x770a('0x1b')][_0x770a('0x12')](this));ami['on'](_0x770a('0x1c'),this[_0x770a('0x1d')]['bind'](this));}Fax[_0x770a('0x1e')]['syncNewchannel']=function(_0x28e532){if(_0x28e532[_0x770a('0x1f')]==='from-voip-provider'){for(var _0x2a0a1b in this[_0x770a('0xc')]){if(this[_0x770a('0xc')][_0x770a('0x20')](_0x2a0a1b)){if(_0x28e532[_0x770a('0x21')]===this[_0x770a('0xc')][_0x2a0a1b][_0x770a('0x22')]){this[_0x770a('0x23')][_0x28e532[_0x770a('0x24')]]={};this[_0x770a('0x23')][_0x28e532[_0x770a('0x24')]][_0x770a('0x25')]=_0x28e532['channel'];this[_0x770a('0x23')][_0x28e532['uniqueid']]['id']=this[_0x770a('0xc')][_0x2a0a1b]['id'];this[_0x770a('0x23')][_0x28e532[_0x770a('0x24')]][_0x770a('0x26')]=this[_0x770a('0xc')][_0x2a0a1b][_0x770a('0x26')];logger['info'](_0x28e532[_0x770a('0x24')],_0x770a('0x27'));}}}}if(this['actions'][_0x28e532[_0x770a('0x24')]]){this['channels'][_0x28e532['uniqueid']]={};this[_0x770a('0x23')][_0x28e532[_0x770a('0x24')]]['channel']=_0x28e532['channel'];logger[_0x770a('0x28')](_0x28e532['uniqueid'],_0x770a('0x27'));}};Fax[_0x770a('0x1e')]['syncVarSet']=function(_0x402642){if(this[_0x770a('0x23')][_0x402642[_0x770a('0x24')]]){for(var _0x5afbcf in _0x402642[_0x770a('0x29')]){if(_0x402642[_0x770a('0x29')][_0x770a('0x20')](_0x5afbcf)){this['channels'][_0x402642[_0x770a('0x24')]][_0x5afbcf]=_0x402642[_0x770a('0x2a')];}}}};Fax[_0x770a('0x1e')][_0x770a('0x14')]=function(_0x519cfd){if(this[_0x770a('0x23')][_0x519cfd['uniqueid']]){this['channels'][_0x519cfd[_0x770a('0x24')]][_0x770a('0x2b')]=_0x519cfd[_0x770a('0x2b')];this['channels'][_0x519cfd[_0x770a('0x24')]][_0x770a('0x2c')]=_0x519cfd[_0x770a('0x2c')];}};Fax[_0x770a('0x1e')][_0x770a('0x16')]=function(_0x5c8dd5){if(this[_0x770a('0x23')][_0x5c8dd5['uniqueid']]){for(var _0x1b53b2 in _0x5c8dd5[_0x770a('0x29')]){if(_0x5c8dd5[_0x770a('0x29')][_0x770a('0x20')](_0x1b53b2)){this[_0x770a('0x23')][_0x5c8dd5[_0x770a('0x24')]][_0x1b53b2]=_0x5c8dd5['value'];}}}};Fax[_0x770a('0x1e')][_0x770a('0x18')]=function(_0x528518){if(this[_0x770a('0x23')][_0x528518[_0x770a('0x24')]]){this['channels'][_0x528518[_0x770a('0x24')]][_0x770a('0x2d')]=_0x528518[_0x770a('0x2d')];this[_0x770a('0x23')][_0x528518[_0x770a('0x24')]][_0x770a('0x2e')]=_0x528518[_0x770a('0x2e')];this['channels'][_0x528518[_0x770a('0x24')]][_0x770a('0x22')]=_0x528518[_0x770a('0x22')];this[_0x770a('0x23')][_0x528518['uniqueid']][_0x770a('0x2f')]=_0x528518['filename'];logger[_0x770a('0x28')](_0x528518[_0x770a('0x24')],_0x770a('0x30'));}};Fax['prototype'][_0x770a('0x1a')]=function(_0x312a73){var _0x10f900=this;if(this['channels'][_0x312a73['uniqueid']]){var _0xd829=this[_0x770a('0x23')][_0x312a73[_0x770a('0x24')]]['id'];this[_0x770a('0x23')][_0x312a73[_0x770a('0x24')]]['remotestationid']=_0x312a73[_0x770a('0x31')];this[_0x770a('0x23')][_0x312a73['uniqueid']][_0x770a('0x32')]=_0x312a73[_0x770a('0x32')];this['channels'][_0x312a73[_0x770a('0x24')]][_0x770a('0x22')]=_0x312a73['localstationid'];this['channels'][_0x312a73[_0x770a('0x24')]][_0x770a('0x33')]=_0x312a73[_0x770a('0x33')];this[_0x770a('0x23')][_0x312a73['uniqueid']]['transferrate']=_0x312a73['transferrate'];this['channels'][_0x312a73[_0x770a('0x24')]]['filename']=_0x312a73[_0x770a('0x2f')];this[_0x770a('0x23')][_0x312a73[_0x770a('0x24')]][_0x770a('0x34')]=_0x312a73[_0x770a('0x34')];if(this[_0x770a('0x23')][_0x312a73['uniqueid']][_0x770a('0x32')]>0x0){tiff2pdf(_0x312a73[_0x770a('0x2f')],_0x770a('0x35'),function(_0x59b51a){logger[_0x770a('0x28')](_0x312a73['uniqueid'],_0x770a('0x36'),_0x59b51a['message']);attachment[_0x770a('0x37')]({'name':path[_0x770a('0x38')](_0x312a73[_0x770a('0x2f')])[_0x770a('0x26')],'basename':path[_0x770a('0x38')](_0x312a73[_0x770a('0x2f')])['name']+_0x770a('0x39'),'type':'application/pdf'})['then'](function(_0x3bf3d7){faxAccount[_0x770a('0x3a')](_0xd829,{'from':_0x312a73[_0x770a('0x34')],'mapKey':_0x770a('0x3b'),'body':path[_0x770a('0x38')](_0x312a73[_0x770a('0x2f')])['name']+_0x770a('0x39'),'AttachmentId':_0x3bf3d7['id']})[_0x770a('0x3c')](function(_0x542bfd){logger['error'](_0x312a73['uniqueid'],_0x770a('0x3d'),JSON['stringify'](_0x542bfd));});})[_0x770a('0x3c')](function(_0x3b30f0){logger[_0x770a('0x3e')](_0x312a73[_0x770a('0x24')],_0x770a('0x3f'),JSON['stringify'](_0x3b30f0));});});}logger[_0x770a('0x28')](_0x312a73[_0x770a('0x24')],_0x770a('0x3f'));}};Fax[_0x770a('0x1e')][_0x770a('0x1d')]=function(_0x327e00){if(this['actions'][_0x327e00[_0x770a('0x24')]]){_[_0x770a('0x40')](this[_0x770a('0x23')][_0x327e00[_0x770a('0x24')]],_[_0x770a('0x41')](_0x327e00,[_0x770a('0x42'),_0x770a('0x43')]));}};function updateStatus(_0x5cc84f){if(_0x5cc84f[_0x770a('0x44')]){faxMessage[_0x770a('0x45')](_0x5cc84f[_0x770a('0x44')],{'failMessage':_0x770a('0x46')})['then'](function(_0x574940){ut[_0x770a('0x47')](_0x770a('0x48'),_0x574940);})['catch'](function(_0x4d4990){ut[_0x770a('0x47')](_0x770a('0x49'),_0x4d4990);});}else{ut[_0x770a('0x47')](_0x770a('0x4a'));}}Fax[_0x770a('0x1e')]['updateStatus']=function(_0x574e0b,_0x52cefd,_0x13daf8){var _0x51c024=this;var _0x1aa87d={};if(_0x52cefd){_0x1aa87d={'read':_0x52cefd};}else{_0x1aa87d={'failMessage':_0x13daf8};}if(this[_0x770a('0x4b')][_0x574e0b]['AttachmentId']){faxMessage[_0x770a('0x45')](this[_0x770a('0x4b')][_0x574e0b][_0x770a('0x44')],_0x1aa87d)[_0x770a('0x4c')](function(_0x18fe81){ut[_0x770a('0x47')](_0x770a('0x4d'),_0x18fe81);})[_0x770a('0x3c')](function(_0x150de0){ut[_0x770a('0x47')](_0x770a('0x4e'),_0x150de0);})['finally'](function(){delete _0x51c024[_0x770a('0x23')][_0x574e0b];delete _0x51c024[_0x770a('0x4b')][_0x574e0b];});}else{ut[_0x770a('0x47')](_0x770a('0x4f'));delete this[_0x770a('0x23')][_0x574e0b];delete this[_0x770a('0x4b')][_0x574e0b];}};Fax[_0x770a('0x1e')][_0x770a('0x1b')]=function(_0x4fe6e9){var _0xad4f7c=this;if(this[_0x770a('0x23')][_0x4fe6e9[_0x770a('0x24')]]){if(this[_0x770a('0x4b')][_0x4fe6e9[_0x770a('0x24')]]){this['channels'][_0x4fe6e9['uniqueid']]['id']=this[_0x770a('0x4b')][_0x4fe6e9[_0x770a('0x24')]]['id'];this[_0x770a('0x23')][_0x4fe6e9[_0x770a('0x24')]][_0x770a('0x26')]=this[_0x770a('0x4b')][_0x4fe6e9['uniqueid']][_0x770a('0x26')];}logger['info'](_0x4fe6e9[_0x770a('0x24')],this[_0x770a('0x4b')][_0x4fe6e9['uniqueid']]?_0x770a('0x50'):'\x20hangup\x20faxRiceive\x20',JSON[_0x770a('0x51')](this[_0x770a('0x23')][_0x4fe6e9[_0x770a('0x24')]]));if(this[_0x770a('0x4b')][_0x4fe6e9[_0x770a('0x24')]]){if(this[_0x770a('0x23')][_0x4fe6e9[_0x770a('0x24')]][_0x770a('0x52')]>0x0&&this[_0x770a('0x23')][_0x4fe6e9[_0x770a('0x24')]][_0x770a('0x17')]===_0x770a('0x53')){this[_0x770a('0x54')](_0x4fe6e9['uniqueid'],!![]);}else{this[_0x770a('0x54')](_0x4fe6e9[_0x770a('0x24')],![],this[_0x770a('0x23')][_0x4fe6e9['uniqueid']][_0x770a('0x55')]?_0x770a('0x56')+this[_0x770a('0x23')][_0x4fe6e9[_0x770a('0x24')]][_0x770a('0x55')]:_0x770a('0x57'));}}}};Fax[_0x770a('0x1e')][_0x770a('0x58')]=function(_0x6225dd){var _0x5a384b=this;return new BPromise(function(_0x485d8a,_0x556bdd){_0x5a384b[_0x770a('0x59')](_0x6225dd,_0x5a384b[_0x770a('0xc')][_0x6225dd[_0x770a('0x5a')]])['then'](function(_0x5df2d6){ut['logger'](_0x770a('0x5b'),_0x5df2d6);_0x485d8a(ut[_0x770a('0x5c')]('Fax\x20received'));})[_0x770a('0x3c')](function(_0x35b253){ut['logger']('[Fax][execOriginate][failure]',_0x35b253);updateStatus(_0x6225dd);_0x556bdd(ut[_0x770a('0x5c')]('Fax\x20failed'));});});};Fax[_0x770a('0x1e')][_0x770a('0x5d')]=function(_0x49b15a){var _0x1c1281=this;return new BPromise(function(_0x18b914,_0x5f4683){var _0x5103bd=_0x1c1281['checkTrunk'](_0x1c1281[_0x770a('0xc')][_0x49b15a[_0x770a('0x5a')]][_0x770a('0x5e')],_0x49b15a);if(_0x5103bd[_0x770a('0x5f')]){_0x18b914(ut['message'](_0x770a('0x60')));}else{_0x5f4683(ut[_0x770a('0x5c')](_0x5103bd[_0x770a('0x5c')]));}});};function originate(_0x433866,_0x5c1318,_0x3c6e35){return new BPromise(function(_0xc8ce65,_0x167c66){if(_0x3c6e35){var _0x4861a2=util[_0x770a('0x61')](_0x770a('0x62'),path['parse'](_0x433866[_0x770a('0x4')])['name'],_0x433866[_0x770a('0x4')]);gs[_0x770a('0x63')](_0x4861a2)[_0x770a('0x4c')](function(){_0x433866['path']=util['format'](_0x770a('0x64'),path[_0x770a('0x38')](_0x433866[_0x770a('0x4')])['dir'],path['parse'](_0x433866[_0x770a('0x4')])[_0x770a('0x26')]);_0x5c1318[_0x770a('0x65')]=_0x433866[_0x770a('0x4')];ut[_0x770a('0x47')](_0x770a('0x66'),'');ami['Action'](ut['variablesAction'](_0x433866,_0x5c1318))[_0x770a('0x4c')](function(_0x19e5b3){_0xc8ce65(_0x19e5b3);})[_0x770a('0x3c')](function(_0x35c932){_0x167c66(_0x35c932);});})[_0x770a('0x3c')](function(_0x3216e4){_0x167c66(_0x3216e4);});}else{ami[_0x770a('0x67')](ut[_0x770a('0x68')](_0x433866,_0x5c1318))[_0x770a('0x4c')](function(_0x1ed666){_0xc8ce65(_0x1ed666);})[_0x770a('0x3c')](function(_0x478a0f){_0x167c66(_0x478a0f);});}});}Fax[_0x770a('0x1e')][_0x770a('0x59')]=function(_0x4aa6d2,_0x507268){var _0x3f508=this;return new BPromise(function(_0x5b1bce,_0x2b87ff){var _0x19125b=uuid['v4']();var _0x5b7a2c=ut[_0x770a('0x69')](_0x4aa6d2,_0x507268);_0x3f508[_0x770a('0x4b')][_0x19125b]=new Action(_0x19125b,_0x507268,_0x4aa6d2);var _0x503fdc=_0x3f508[_0x770a('0x4b')][_0x19125b];if(path[_0x770a('0x38')](_0x4aa6d2[_0x770a('0x4')])['ext']===_0x770a('0x39')){originate(_0x503fdc,_0x5b7a2c,!![])[_0x770a('0x4c')](function(_0x342a09){_0x5b1bce(_0x342a09);})[_0x770a('0x3c')](function(_0x3ba56d){_0x2b87ff(_0x3ba56d);});}else{originate(_0x503fdc,_0x5b7a2c,![])[_0x770a('0x4c')](function(_0x250e04){_0x5b1bce(_0x250e04);})[_0x770a('0x3c')](function(_0x5e64be){_0x2b87ff(_0x5e64be);});}});};Fax[_0x770a('0x1e')][_0x770a('0x6a')]=function(_0x50575f){return!_['isNil'](_0x50575f)&&!_['isNil'](_0x50575f[_0x770a('0x26')])&&!_[_0x770a('0x6b')](_0x50575f[_0x770a('0x6c')])&&_0x50575f[_0x770a('0x6c')]&&!_['isNil'](this[_0x770a('0xd')][util[_0x770a('0x61')]('SIP/%s',_0x50575f[_0x770a('0x26')])])&&!_['isNil'](this[_0x770a('0xd')][util[_0x770a('0x61')](_0x770a('0x6d'),_0x50575f['name'])][_0x770a('0x2e')])&&(this[_0x770a('0xd')][util[_0x770a('0x61')](_0x770a('0x6d'),_0x50575f['name'])]['status']==='reachable'||this[_0x770a('0xd')][util[_0x770a('0x61')](_0x770a('0x6d'),_0x50575f['name'])][_0x770a('0x2e')]===_0x770a('0x6e'));};Fax['prototype'][_0x770a('0x6f')]=function(_0x4d2230,_0x4e2545){if(!this['isTrunkReachable'](_0x4d2230)){ut[_0x770a('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x4d2230)?'':_0x4d2230[_0x770a('0x26')]+_0x770a('0x70'));return{'isValid':![],'message':_0x770a('0x71')};}if(_['isNil'](_0x4e2545[_0x770a('0x3b')])){ut['logger'](_0x770a('0x72'),JSON['stringify'](_0x4e2545));return{'isValid':![],'message':_0x770a('0x73')};}if(_[_0x770a('0x6b')](_0x4e2545[_0x770a('0x4')])){ut[_0x770a('0x47')](_0x770a('0x74'),JSON[_0x770a('0x51')](_0x4e2545));return{'isValid':![],'message':_0x770a('0x75')};}return{'isValid':!![],'message':_0x770a('0x76')};};module[_0x770a('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1bc2344..dc1d4ac 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 _0x6b49=['util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','catch','[Notify]\x20'];(function(_0x5bb0dd,_0x39ae3b){var _0x3c3df1=function(_0x545001){while(--_0x545001){_0x5bb0dd['push'](_0x5bb0dd['shift']());}};_0x3c3df1(++_0x39ae3b);}(_0x6b49,0xd8));var _0x96b4=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x6b49[_0x28947d];return _0x12d2ee;};'use strict';var util=require(_0x96b4('0x0'));var BPromise=require('bluebird');var logger=require(_0x96b4('0x1'))(_0x96b4('0x2'));var _=require(_0x96b4('0x3'));var faxAccount=require(_0x96b4('0x4'));function loggerCatch(_0x53deed){return function(_0x27b312){logger[_0x96b4('0x5')](_0x53deed,util['inspect'](_0x27b312,{'showHidden':![],'depth':null}));};}exports[_0x96b4('0x6')]=function(_0x542fc8,_0x566529){return BPromise['resolve']()['then'](faxAccount[_0x96b4('0x6')](_0x542fc8,_0x566529))[_0x96b4('0x7')](loggerCatch(_0x96b4('0x8')));}; \ No newline at end of file +var _0x716a=['inspect','notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x716a,0xde));var _0xa716=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x716a[_0x2ade6c];return _0x2cb372;};'use strict';var util=require(_0xa716('0x0'));var BPromise=require('bluebird');var logger=require(_0xa716('0x1'))(_0xa716('0x2'));var _=require(_0xa716('0x3'));var faxAccount=require(_0xa716('0x4'));function loggerCatch(_0x942dc1){return function(_0x12c9ce){logger[_0xa716('0x5')](_0x942dc1,util[_0xa716('0x6')](_0x12c9ce,{'showHidden':![],'depth':null}));};}exports[_0xa716('0x7')]=function(_0x30337b,_0x106fb9){return BPromise[_0xa716('0x8')]()[_0xa716('0x9')](faxAccount[_0xa716('0x7')](_0x30337b,_0x106fb9))[_0xa716('0xa')](loggerCatch(_0xa716('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index b0aacd1..3226275 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 _0x5c10=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0xd958e0,_0x54deea){var _0x7e2a6=function(_0x429692){while(--_0x429692){_0xd958e0['push'](_0xd958e0['shift']());}};_0x7e2a6(++_0x54deea);}(_0x5c10,0x8b));var _0x05c1=function(_0x36bd2b,_0x209ba6){_0x36bd2b=_0x36bd2b-0x0;var _0x131664=_0x5c10[_0x36bd2b];return _0x131664;};'use strict';var util=require(_0x05c1('0x0'));var logger=require(_0x05c1('0x1'))(_0x05c1('0x2'));var BPromise=require(_0x05c1('0x3'));var exec=require(_0x05c1('0x4'))[_0x05c1('0x5')];exports[_0x05c1('0x6')]=function(_0x28a77f){return new BPromise(function(_0x2d620a,_0xe56267){exec(_0x28a77f,function(_0x1f6ec1,_0x26d50b,_0x2aa419){logger[_0x05c1('0x7')](_0x05c1('0x8'),_0x26d50b);if(_0x1f6ec1){logger[_0x05c1('0x7')]('Exec\x20gs',_0x05c1('0x9'),util[_0x05c1('0xa')](_0x1f6ec1,{'showHidden':![],'depth':null}),_0x26d50b,_0x2aa419);_0xe56267(_0x1f6ec1);}_0x2d620a(_0x26d50b);});});}; \ No newline at end of file +var _0xed26=['../../../../config/logger','fax','bluebird','child_process','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0xeb296a,_0x4227e9){var _0x3cd49e=function(_0x132bd8){while(--_0x132bd8){_0xeb296a['push'](_0xeb296a['shift']());}};_0x3cd49e(++_0x4227e9);}(_0xed26,0x67));var _0x6ed2=function(_0x1c5bdd,_0x865bdd){_0x1c5bdd=_0x1c5bdd-0x0;var _0x3a5288=_0xed26[_0x1c5bdd];return _0x3a5288;};'use strict';var util=require(_0x6ed2('0x0'));var logger=require(_0x6ed2('0x1'))(_0x6ed2('0x2'));var BPromise=require(_0x6ed2('0x3'));var exec=require(_0x6ed2('0x4'))['exec'];exports['execute']=function(_0x2a2f2f){return new BPromise(function(_0x3dd1b,_0x4d9222){exec(_0x2a2f2f,function(_0xdc2ddf,_0x412129,_0x35db29){logger[_0x6ed2('0x5')](_0x6ed2('0x6'),_0x412129);if(_0xdc2ddf){logger[_0x6ed2('0x5')](_0x6ed2('0x6'),_0x6ed2('0x7'),util['inspect'](_0xdc2ddf,{'showHidden':![],'depth':null}),_0x412129,_0x35db29);_0x4d9222(_0xdc2ddf);}_0x3dd1b(_0x412129);});});}; \ 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 5b08e7c..b6c35d7 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 _0x16d2=['addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x16d2,0x123));var _0x216d=function(_0x4819f4,_0x5c3aac){_0x4819f4=_0x4819f4-0x0;var _0x135bf0=_0x16d2[_0x4819f4];return _0x135bf0;};'use strict';var util=require(_0x216d('0x0'));var _=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var logger=require(_0x216d('0x3'))(_0x216d('0x4'));exports[_0x216d('0x5')]=function(_0x34cf5b){return{'message':_0x34cf5b};};exports[_0x216d('0x6')]=function(_0xfd7306,_0x593bb0){logger[_0x216d('0x7')](_0xfd7306,util[_0x216d('0x8')](_0x593bb0,{'showHidden':![],'depth':null}));};exports[_0x216d('0x9')]=function(_0x205101,_0x1dd8e2){var _0x24c831={'XMF-ECM':_0x1dd8e2[_0x216d('0xa')],'XMF-HEADERINFO':_0x1dd8e2[_0x216d('0xb')],'XMF-MINRATE':_0x1dd8e2['minrate'],'XMF-MAXRATE':_0x1dd8e2[_0x216d('0xc')],'XMF-MODEM':util[_0x216d('0xd')](_0x216d('0xe'),_0x1dd8e2[_0x216d('0xf')]),'XMF-GATEWAY':_0x1dd8e2[_0x216d('0x10')],'XMF-FAXDETECT':_0x1dd8e2[_0x216d('0x11')],'XMF-T38TIMEOUT':_0x1dd8e2['t38timeout'],'XMF-LOCALSTATIONID':_0x1dd8e2[_0x216d('0x12')],'XMF-PATH':_0x205101['path']};return _0x24c831;};exports[_0x216d('0x13')]=function(_0x2e02ce,_0x332e30){return{'actionid':_0x2e02ce[_0x216d('0x14')],'action':_0x216d('0x15'),'channel':_0x2e02ce[_0x216d('0x16')],'Exten':'xcally-motion-fax','Context':_0x216d('0x17'),'Priority':'1','callerid':util['format'](_0x216d('0x18'),_0x2e02ce[_0x216d('0xb')]?_0x2e02ce['headerinfo']:'',_0x2e02ce[_0x216d('0x12')]),'variable':_0x332e30,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2e02ce[_0x216d('0x14')]};}; \ No newline at end of file +var _0xbb53=['modem','faxdetect','path','variablesAction','originate','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','addVariables','ecm','format','\x22%s\x22'];(function(_0x4940a1,_0x1568a0){var _0x4494d4=function(_0x5059f6){while(--_0x5059f6){_0x4940a1['push'](_0x4940a1['shift']());}};_0x4494d4(++_0x1568a0);}(_0xbb53,0x121));var _0x3bb5=function(_0x58675a,_0x3bac9c){_0x58675a=_0x58675a-0x0;var _0x480300=_0xbb53[_0x58675a];return _0x480300;};'use strict';var util=require(_0x3bb5('0x0'));var _=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var logger=require(_0x3bb5('0x3'))(_0x3bb5('0x4'));exports[_0x3bb5('0x5')]=function(_0x414da7){return{'message':_0x414da7};};exports[_0x3bb5('0x6')]=function(_0x83e44b,_0x450d9e){logger['info'](_0x83e44b,util['inspect'](_0x450d9e,{'showHidden':![],'depth':null}));};exports[_0x3bb5('0x7')]=function(_0x2460b0,_0x28aa7d){var _0x157e04={'XMF-ECM':_0x28aa7d[_0x3bb5('0x8')],'XMF-HEADERINFO':_0x28aa7d['headerinfo'],'XMF-MINRATE':_0x28aa7d['minrate'],'XMF-MAXRATE':_0x28aa7d['maxrate'],'XMF-MODEM':util[_0x3bb5('0x9')](_0x3bb5('0xa'),_0x28aa7d[_0x3bb5('0xb')]),'XMF-GATEWAY':_0x28aa7d['gateway'],'XMF-FAXDETECT':_0x28aa7d[_0x3bb5('0xc')],'XMF-T38TIMEOUT':_0x28aa7d['t38timeout'],'XMF-LOCALSTATIONID':_0x28aa7d['localstationid'],'XMF-PATH':_0x2460b0[_0x3bb5('0xd')]};return _0x157e04;};exports[_0x3bb5('0xe')]=function(_0x5cfc6b,_0xe00ace){return{'actionid':_0x5cfc6b['uniqueid'],'action':_0x3bb5('0xf'),'channel':_0x5cfc6b['channel'],'Exten':'xcally-motion-fax','Context':_0x3bb5('0x10'),'Priority':'1','callerid':util[_0x3bb5('0x9')](_0x3bb5('0x11'),_0x5cfc6b['headerinfo']?_0x5cfc6b[_0x3bb5('0x12')]:'',_0x5cfc6b[_0x3bb5('0x13')]),'variable':_0xe00ace,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5cfc6b['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 2c684c7..0591513 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 _0x7e81=['initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','sync','catch','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./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','initTrunks','getVoiceQueues','getTriggers','initTriggers','initTemplates'];(function(_0x2687ff,_0x190caf){var _0x5a4160=function(_0x2e0160){while(--_0x2e0160){_0x2687ff['push'](_0x2687ff['shift']());}};_0x5a4160(++_0x190caf);}(_0x7e81,0xf6));var _0x17e8=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7e81[_0x5783f4];return _0x28e380;};'use strict';var BPromise=require(_0x17e8('0x0'));var util=require(_0x17e8('0x1'));var moment=require('moment');var server=require(_0x17e8('0x2'));var Realtime=require(_0x17e8('0x3'));var Report=require(_0x17e8('0x4'));var Acw=require(_0x17e8('0x5'));var Trigger=require(_0x17e8('0x6'));var Dialer=require(_0x17e8('0x7'));var Preview=require(_0x17e8('0x8'));var Fax=require(_0x17e8('0x9'));var user=require(_0x17e8('0xa'));var voiceQueue=require(_0x17e8('0xb'));var voiceQueueReport=require(_0x17e8('0xc'));var voiceCallReport=require(_0x17e8('0xd'));var trunk=require('./rpc/trunk');var trigger=require(_0x17e8('0xe'));var template=require(_0x17e8('0xf'));var cmHopperHistory=require(_0x17e8('0x10'));var campaign=require(_0x17e8('0x11'));var voiceExtension=require(_0x17e8('0x12'));var faxAccount=require(_0x17e8('0x13'));var zendesk=require(_0x17e8('0x14'));var salesforce=require(_0x17e8('0x15'));var sugarcrm=require(_0x17e8('0x16'));var freshdesk=require(_0x17e8('0x17'));var desk=require(_0x17e8('0x18'));var zoho=require(_0x17e8('0x19'));var vtiger=require(_0x17e8('0x1a'));var freshsales=require(_0x17e8('0x1b'));var servicenow=require(_0x17e8('0x1c'));var dynamics365=require(_0x17e8('0x1d'));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()[_0x17e8('0x1e')](_0x17e8('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x17e8('0x1e')](_0x17e8('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x17e8('0x20')]()[_0x17e8('0x21')](user[_0x17e8('0x22')]())['then'](realtime[_0x17e8('0x23')]())['then'](user[_0x17e8('0x24')]())[_0x17e8('0x21')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x17e8('0x21')](realtime[_0x17e8('0x25')]())[_0x17e8('0x21')](voiceQueue[_0x17e8('0x26')]())['then'](realtime['initVoiceQueues']())[_0x17e8('0x21')](trigger[_0x17e8('0x27')]())[_0x17e8('0x21')](realtime[_0x17e8('0x28')]())['then'](template['getTemplates']())[_0x17e8('0x21')](realtime[_0x17e8('0x29')]())['then'](zendesk['getZendeskAccounts']())[_0x17e8('0x21')](realtime['initZendeskAccounts']())[_0x17e8('0x21')](salesforce['getSalesforceAccounts']())[_0x17e8('0x21')](realtime[_0x17e8('0x2a')]())['then'](sugarcrm[_0x17e8('0x2b')]())[_0x17e8('0x21')](realtime['initSugarcrmAccounts']())[_0x17e8('0x21')](freshdesk[_0x17e8('0x2c')]())[_0x17e8('0x21')](realtime[_0x17e8('0x2d')]())[_0x17e8('0x21')](desk[_0x17e8('0x2e')]())[_0x17e8('0x21')](realtime[_0x17e8('0x2f')]())[_0x17e8('0x21')](zoho[_0x17e8('0x30')]())['then'](realtime[_0x17e8('0x31')]())[_0x17e8('0x21')](vtiger[_0x17e8('0x32')]())[_0x17e8('0x21')](realtime[_0x17e8('0x33')]())[_0x17e8('0x21')](freshsales[_0x17e8('0x34')]())['then'](realtime[_0x17e8('0x35')]())['then'](servicenow[_0x17e8('0x36')]())[_0x17e8('0x21')](realtime['initServicenowAccounts']())[_0x17e8('0x21')](dynamics365[_0x17e8('0x37')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0x17e8('0x38')]())[_0x17e8('0x21')](realtime[_0x17e8('0x39')]())[_0x17e8('0x21')](voiceExtension[_0x17e8('0x3a')]())['then'](realtime['initVoiceExtensions']())[_0x17e8('0x21')](faxAccount[_0x17e8('0x3b')]())['then'](realtime[_0x17e8('0x3c')]())[_0x17e8('0x21')](function(){return realtime;});}function initParams(){return BPromise[_0x17e8('0x20')]()['then'](voiceQueueReport[_0x17e8('0x3d')]())[_0x17e8('0x21')](realtime[_0x17e8('0x3e')]())[_0x17e8('0x21')](cmHopperHistory[_0x17e8('0x3f')]())[_0x17e8('0x21')](realtime[_0x17e8('0x40')]())[_0x17e8('0x21')](cmHopperHistory[_0x17e8('0x41')]())[_0x17e8('0x21')](realtime[_0x17e8('0x42')]())[_0x17e8('0x21')](voiceCallReport[_0x17e8('0x43')]())[_0x17e8('0x21')](realtime[_0x17e8('0x44')]())[_0x17e8('0x21')](function(_0x2aae25){})['catch'](function(_0x43cbde){console[_0x17e8('0x45')](_0x43cbde);});}function main(){return server['listen'](realtime,preview,fax)[_0x17e8('0x21')](function(_0x43fe07){return initRealtime();})[_0x17e8('0x21')](function(){return initParams();})[_0x17e8('0x21')](function(){report[_0x17e8('0x46')]();setInterval(initRealtime,0x1388);})[_0x17e8('0x47')](function(_0x2769fd){console[_0x17e8('0x45')](_0x2769fd);});}main(); \ No newline at end of file +var _0xccdc=['getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./realtime','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','getAgents','then','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x39df29,_0x450cdc){var _0x4cecc6=function(_0x32c11d){while(--_0x32c11d){_0x39df29['push'](_0x39df29['shift']());}};_0x4cecc6(++_0x450cdc);}(_0xccdc,0x1e7));var _0xcccd=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xccdc[_0x18ab2a];return _0x16dcee;};'use strict';var BPromise=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var moment=require(_0xcccd('0x2'));var server=require('./server');var Realtime=require(_0xcccd('0x3'));var Report=require(_0xcccd('0x4'));var Acw=require(_0xcccd('0x5'));var Trigger=require(_0xcccd('0x6'));var Dialer=require('./dialer');var Preview=require(_0xcccd('0x7'));var Fax=require('./fax');var user=require(_0xcccd('0x8'));var voiceQueue=require(_0xcccd('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xcccd('0xa'));var trunk=require(_0xcccd('0xb'));var trigger=require(_0xcccd('0xc'));var template=require(_0xcccd('0xd'));var cmHopperHistory=require(_0xcccd('0xe'));var campaign=require(_0xcccd('0xf'));var voiceExtension=require(_0xcccd('0x10'));var faxAccount=require(_0xcccd('0x11'));var zendesk=require(_0xcccd('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xcccd('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xcccd('0x14'));var zoho=require(_0xcccd('0x15'));var vtiger=require(_0xcccd('0x16'));var freshsales=require(_0xcccd('0x17'));var servicenow=require(_0xcccd('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');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()[_0xcccd('0x19')](_0xcccd('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcccd('0x1b')]()['then'](user[_0xcccd('0x1c')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x1e')]())[_0xcccd('0x1d')](user[_0xcccd('0x1f')]())[_0xcccd('0x1d')](realtime['initTelephones']())[_0xcccd('0x1d')](trunk[_0xcccd('0x20')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x21')]())[_0xcccd('0x1d')](voiceQueue[_0xcccd('0x22')]())[_0xcccd('0x1d')](realtime['initVoiceQueues']())['then'](trigger[_0xcccd('0x23')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x24')]())[_0xcccd('0x1d')](template[_0xcccd('0x25')]())[_0xcccd('0x1d')](realtime['initTemplates']())[_0xcccd('0x1d')](zendesk[_0xcccd('0x26')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x27')]())[_0xcccd('0x1d')](salesforce[_0xcccd('0x28')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x29')]())[_0xcccd('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xcccd('0x1d')](realtime[_0xcccd('0x2a')]())['then'](freshdesk[_0xcccd('0x2b')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk[_0xcccd('0x2c')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x2d')]())[_0xcccd('0x1d')](zoho[_0xcccd('0x2e')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x2f')]())[_0xcccd('0x1d')](vtiger[_0xcccd('0x30')]())['then'](realtime[_0xcccd('0x31')]())[_0xcccd('0x1d')](freshsales['getFreshsalesAccounts']())[_0xcccd('0x1d')](realtime['initFreshsalesAccounts']())[_0xcccd('0x1d')](servicenow['getServicenowAccounts']())['then'](realtime[_0xcccd('0x32')]())[_0xcccd('0x1d')](dynamics365[_0xcccd('0x33')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x34')]())[_0xcccd('0x1d')](campaign[_0xcccd('0x35')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x36')]())['then'](voiceExtension[_0xcccd('0x37')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x38')]())[_0xcccd('0x1d')](faxAccount[_0xcccd('0x39')]())[_0xcccd('0x1d')](realtime[_0xcccd('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xcccd('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0xcccd('0x1d')](realtime[_0xcccd('0x3b')]())['then'](cmHopperHistory[_0xcccd('0x3c')]())['then'](realtime[_0xcccd('0x3d')]())[_0xcccd('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0xcccd('0x1d')](realtime[_0xcccd('0x3e')]())[_0xcccd('0x1d')](voiceCallReport['getVoiceCallReports']())[_0xcccd('0x1d')](realtime[_0xcccd('0x3f')]())[_0xcccd('0x1d')](function(_0x196b1b){})[_0xcccd('0x40')](function(_0x26641d){console[_0xcccd('0x41')](_0x26641d);});}function main(){return server[_0xcccd('0x42')](realtime,preview,fax)[_0xcccd('0x1d')](function(_0x5c7c83){return initRealtime();})[_0xcccd('0x1d')](function(){return initParams();})[_0xcccd('0x1d')](function(){report[_0xcccd('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2591e6){console[_0xcccd('0x41')](_0x2591e6);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 3880c97..d6bc784 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 _0x56c2=['local','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','statePause','format','stringify','emit','user:save','exports','lodash','util','moment','md5','ioredis','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x56c2,0x13d));var _0x256c=function(_0x19c829,_0x468e83){_0x19c829=_0x19c829-0x0;var _0x46be66=_0x56c2[_0x19c829];return _0x46be66;};'use strict';var _=require(_0x256c('0x0'));var util=require(_0x256c('0x1'));var moment=require(_0x256c('0x2'));var md5=require(_0x256c('0x3'));var Redis=require(_0x256c('0x4'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0x256c('0x5'),'port':0x18eb});var io=require(_0x256c('0x6'))(new Redis(config[_0x256c('0x7')]));function Agent(_0x3180c6){this['id']=_0x3180c6['id']||0x0;this[_0x256c('0x8')]=_0x3180c6[_0x256c('0x8')]||'';this['email']=_0x3180c6[_0x256c('0x9')]||'';this[_0x256c('0xa')]=_0x3180c6['accountcode']||'';this['fullname']=_0x3180c6[_0x256c('0xb')]||'';this[_0x256c('0xc')]=_0x256c('0xd');this[_0x256c('0xe')]=0x0;this[_0x256c('0xf')]=_0x256c('0xd');this['address']='';this[_0x256c('0x10')]='';this[_0x256c('0x11')]='';this[_0x256c('0x12')]='';this['online']=_0x3180c6[_0x256c('0x13')]||![];this[_0x256c('0x14')]=_0x256c('0xd');this[_0x256c('0x15')]=0x0;this[_0x256c('0x16')]='';this[_0x256c('0x17')]='';this[_0x256c('0x18')]=![];this[_0x256c('0x19')]=![];this['md5']='';}Agent[_0x256c('0x1a')][_0x256c('0x1b')]=function(_0xa1bcee){var _0x40547f;if(_0xa1bcee&&_0xa1bcee[_0x256c('0xc')]){_0x40547f=_0xa1bcee[_0x256c('0xc')][_0x256c('0x1c')]();switch(_0x40547f){case _0x256c('0x1d'):_0x40547f='idle';break;case _0x256c('0x1e'):_0x40547f=_0x256c('0x1f');break;}}if(_0x40547f&&this[_0x256c('0x14')]!==_0x40547f||_0xa1bcee[_0x256c('0x20')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x256c('0x21')]('x'));}if(_0x40547f){this[_0x256c('0x14')]=_0x40547f;}var _0x8f6732={'id':this['id'],'name':this[_0x256c('0x8')],'email':this[_0x256c('0x9')],'accountcode':this[_0x256c('0xa')],'fullname':this[_0x256c('0xb')],'state':this[_0x256c('0xc')],'stateTime':this[_0x256c('0xe')],'status':this[_0x256c('0xf')],'address':this['address'],'online':this[_0x256c('0x13')],'voiceStatus':this[_0x256c('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x256c('0x16')],'voiceStatusQueue':this[_0x256c('0x17')],'interface':this['interface'],'onhold':this[_0x256c('0x18')]};var _0x369322=md5(JSON[_0x256c('0x22')](_0x8f6732));if(this[_0x256c('0x3')]!==_0x369322){this[_0x256c('0x3')]=_0x369322;io['to'](util['format']('user:%s',_0x8f6732['name']))[_0x256c('0x23')](_0x256c('0x24'),_0x8f6732);}};module[_0x256c('0x25')]=Agent; \ No newline at end of file +var _0xb4b1=['voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','toLowerCase','not_inuse','idle','inuse','talking','statePause','format','fullname','status','stringify','user:%s','emit','user:save','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','state','stateTime','address','phone','mobile','interface','online','voiceStatus'];(function(_0x2a75a7,_0x3e506e){var _0x1a909d=function(_0x404b11){while(--_0x404b11){_0x2a75a7['push'](_0x2a75a7['shift']());}};_0x1a909d(++_0x3e506e);}(_0xb4b1,0x124));var _0x1b4b=function(_0x295727,_0x135c70){_0x295727=_0x295727-0x0;var _0xcda60=_0xb4b1[_0x295727];return _0xcda60;};'use strict';var _=require(_0x1b4b('0x0'));var util=require(_0x1b4b('0x1'));var moment=require(_0x1b4b('0x2'));var md5=require(_0x1b4b('0x3'));var Redis=require(_0x1b4b('0x4'));var config=require(_0x1b4b('0x5'));config[_0x1b4b('0x6')]=_[_0x1b4b('0x7')](config['redis'],{'host':_0x1b4b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x269e06){this['id']=_0x269e06['id']||0x0;this[_0x1b4b('0x9')]=_0x269e06[_0x1b4b('0x9')]||'';this[_0x1b4b('0xa')]=_0x269e06[_0x1b4b('0xa')]||'';this[_0x1b4b('0xb')]=_0x269e06[_0x1b4b('0xb')]||'';this['fullname']=_0x269e06['fullname']||'';this[_0x1b4b('0xc')]='unknown';this[_0x1b4b('0xd')]=0x0;this['status']='unknown';this[_0x1b4b('0xe')]='';this[_0x1b4b('0xf')]='';this[_0x1b4b('0x10')]='';this[_0x1b4b('0x11')]='';this['online']=_0x269e06[_0x1b4b('0x12')]||![];this[_0x1b4b('0x13')]='unknown';this[_0x1b4b('0x14')]=0x0;this[_0x1b4b('0x15')]='';this[_0x1b4b('0x16')]='';this[_0x1b4b('0x17')]=![];this[_0x1b4b('0x18')]=![];this['md5']='';}Agent[_0x1b4b('0x19')]['updateStatusRealtime']=function(_0x2058e9){var _0x4147e4;if(_0x2058e9&&_0x2058e9[_0x1b4b('0xc')]){_0x4147e4=_0x2058e9[_0x1b4b('0xc')][_0x1b4b('0x1a')]();switch(_0x4147e4){case _0x1b4b('0x1b'):_0x4147e4=_0x1b4b('0x1c');break;case _0x1b4b('0x1d'):_0x4147e4=_0x1b4b('0x1e');break;}}if(_0x4147e4&&this[_0x1b4b('0x13')]!==_0x4147e4||_0x2058e9[_0x1b4b('0x1f')]){this[_0x1b4b('0x14')]=_['toNumber'](moment()[_0x1b4b('0x20')]('x'));}if(_0x4147e4){this[_0x1b4b('0x13')]=_0x4147e4;}var _0x390c53={'id':this['id'],'name':this[_0x1b4b('0x9')],'email':this['email'],'accountcode':this[_0x1b4b('0xb')],'fullname':this[_0x1b4b('0x21')],'state':this[_0x1b4b('0xc')],'stateTime':this[_0x1b4b('0xd')],'status':this[_0x1b4b('0x22')],'address':this[_0x1b4b('0xe')],'online':this['online'],'voiceStatus':this[_0x1b4b('0x13')],'voiceStatusTime':this[_0x1b4b('0x14')],'voiceStatusCallerIdNumber':this[_0x1b4b('0x15')],'voiceStatusQueue':this[_0x1b4b('0x16')],'interface':this[_0x1b4b('0x11')],'onhold':this[_0x1b4b('0x17')]};var _0x41f863=md5(JSON[_0x1b4b('0x23')](_0x390c53));if(this[_0x1b4b('0x3')]!==_0x41f863){this[_0x1b4b('0x3')]=_0x41f863;io['to'](util[_0x1b4b('0x20')](_0x1b4b('0x24'),_0x390c53[_0x1b4b('0x9')]))[_0x1b4b('0x25')](_0x1b4b('0x26'),_0x390c53);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 09639bf..f33a287 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 _0xd6d5=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0xcaec2e,_0x2a2a04){var _0x26ec3d=function(_0x2b3ae7){while(--_0x2b3ae7){_0xcaec2e['push'](_0xcaec2e['shift']());}};_0x26ec3d(++_0x2a2a04);}(_0xd6d5,0x1de));var _0x5d6d=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0xd6d5[_0x1e05c1];return _0x15f1ca;};'use strict';function Campaign(_0x513f32){this['id']=_0x513f32['id']||0x0;this['name']=_0x513f32['name']||'';this[_0x5d6d('0x0')]=_0x513f32[_0x5d6d('0x0')]||'campaign';this[_0x5d6d('0x1')]=0x0;this[_0x5d6d('0x2')]=0x0;this[_0x5d6d('0x3')]=0x0;this[_0x5d6d('0x4')]=0x0;this[_0x5d6d('0x5')]='';this[_0x5d6d('0x6')]=!![];this[_0x5d6d('0x7')]=_0x513f32[_0x5d6d('0x7')];this[_0x5d6d('0x8')]=_0x513f32[_0x5d6d('0x8')];this[_0x5d6d('0x9')]=_0x513f32[_0x5d6d('0x9')]||null;this[_0x5d6d('0xa')]=_0x513f32[_0x5d6d('0xa')]?_0x513f32[_0x5d6d('0xa')]:null;this[_0x5d6d('0xb')]=_0x513f32[_0x5d6d('0xb')];this[_0x5d6d('0xc')]=_0x513f32['dialOriginateCallerIdNumber'];this[_0x5d6d('0xd')]=_0x513f32['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x513f32['dialCongestionMaxRetry'];this[_0x5d6d('0xe')]=_0x513f32[_0x5d6d('0xe')];this[_0x5d6d('0xf')]=_0x513f32[_0x5d6d('0xf')];this[_0x5d6d('0x10')]=_0x513f32[_0x5d6d('0x10')];this['dialNoAnswerMaxRetry']=_0x513f32['dialNoAnswerMaxRetry'];this[_0x5d6d('0x11')]=_0x513f32['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x513f32[_0x5d6d('0x12')];this[_0x5d6d('0x13')]=_0x513f32[_0x5d6d('0x13')]||0x3;this[_0x5d6d('0x14')]=_0x513f32[_0x5d6d('0x14')]||0x96;this[_0x5d6d('0x15')]=_0x513f32['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x513f32[_0x5d6d('0x16')]||0x96;this[_0x5d6d('0x17')]=_0x513f32[_0x5d6d('0x17')]||0x3;this[_0x5d6d('0x18')]=_0x513f32['dialAbandonedRetryFrequency']||0x96;this[_0x5d6d('0x19')]=_0x513f32[_0x5d6d('0x19')]||0x3;this[_0x5d6d('0x1a')]=_0x513f32[_0x5d6d('0x1a')]||0x96;this[_0x5d6d('0x1b')]=_0x513f32[_0x5d6d('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x513f32[_0x5d6d('0x1c')]||0x96;this[_0x5d6d('0x1d')]=_0x513f32[_0x5d6d('0x1d')]||_0x5d6d('0x1e');this[_0x5d6d('0x1f')]=_0x513f32['dialPrefix']||undefined;this[_0x5d6d('0x20')]=_0x513f32[_0x5d6d('0x20')]||undefined;this[_0x5d6d('0x21')]=_0x513f32['dialCutDigit']||undefined;this[_0x5d6d('0x22')]=_0x513f32['TrunkBackup']?_0x513f32[_0x5d6d('0x22')]:undefined;this[_0x5d6d('0x23')]=_0x513f32[_0x5d6d('0x23')]?_0x513f32[_0x5d6d('0x23')]:undefined;this[_0x5d6d('0x24')]=_0x513f32[_0x5d6d('0x24')]?_0x513f32[_0x5d6d('0x24')]:undefined;this['SquareProject']=_0x513f32[_0x5d6d('0x25')]?_0x513f32[_0x5d6d('0x25')]:undefined;this['dialQueueProject']=_0x513f32[_0x5d6d('0x25')]?_0x513f32[_0x5d6d('0x25')]['name']:undefined;this[_0x5d6d('0x26')]=_0x513f32[_0x5d6d('0x26')]||![];this[_0x5d6d('0x27')]=_0x513f32[_0x5d6d('0x27')];this['dialAMDGreeting']=_0x513f32[_0x5d6d('0x28')];this[_0x5d6d('0x29')]=_0x513f32[_0x5d6d('0x29')];this[_0x5d6d('0x2a')]=_0x513f32[_0x5d6d('0x2a')];this[_0x5d6d('0x2b')]=_0x513f32[_0x5d6d('0x2b')];this['dialAMDBetweenWordsSilence']=_0x513f32[_0x5d6d('0x2c')];this[_0x5d6d('0x2d')]=_0x513f32[_0x5d6d('0x2d')];this[_0x5d6d('0x2e')]=_0x513f32['dialAMDSilenceThreshold'];this[_0x5d6d('0x2f')]=_0x513f32[_0x5d6d('0x2f')];}module[_0x5d6d('0x30')]=Campaign; \ No newline at end of file +var _0x361d=['exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x5d4ca7,_0x19113b){var _0x3efc03=function(_0x59675b){while(--_0x59675b){_0x5d4ca7['push'](_0x5d4ca7['shift']());}};_0x3efc03(++_0x19113b);}(_0x361d,0x1ba));var _0xd361=function(_0x3291b3,_0x3bcd1b){_0x3291b3=_0x3291b3-0x0;var _0x4f2efd=_0x361d[_0x3291b3];return _0x4f2efd;};'use strict';function Campaign(_0x5b5512){this['id']=_0x5b5512['id']||0x0;this[_0xd361('0x0')]=_0x5b5512[_0xd361('0x0')]||'';this[_0xd361('0x1')]=_0x5b5512[_0xd361('0x1')]||_0xd361('0x2');this['originated']=0x0;this[_0xd361('0x3')]=0x0;this[_0xd361('0x4')]=0x0;this[_0xd361('0x5')]=0x0;this[_0xd361('0x6')]='';this[_0xd361('0x7')]=!![];this[_0xd361('0x8')]=_0x5b5512[_0xd361('0x8')];this[_0xd361('0x9')]=_0x5b5512[_0xd361('0x9')];this['dialTimezone']=_0x5b5512[_0xd361('0xa')]||null;this[_0xd361('0xb')]=_0x5b5512[_0xd361('0xb')]?_0x5b5512[_0xd361('0xb')]:null;this[_0xd361('0xc')]=_0x5b5512['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5b5512[_0xd361('0xd')];this['dialOriginateTimeout']=_0x5b5512[_0xd361('0xe')]||0x1e;this[_0xd361('0xf')]=_0x5b5512[_0xd361('0xf')];this[_0xd361('0x10')]=_0x5b5512[_0xd361('0x10')];this[_0xd361('0x11')]=_0x5b5512[_0xd361('0x11')];this['dialBusyRetryFrequency']=_0x5b5512[_0xd361('0x12')];this[_0xd361('0x13')]=_0x5b5512['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x5b5512[_0xd361('0x14')];this[_0xd361('0x15')]=_0x5b5512[_0xd361('0x15')];this[_0xd361('0x16')]=_0x5b5512[_0xd361('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5b5512[_0xd361('0x17')]||0x96;this[_0xd361('0x18')]=_0x5b5512['dialDropMaxRetry']||0x3;this[_0xd361('0x19')]=_0x5b5512[_0xd361('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x5b5512['dialAbandonedMaxRetry']||0x3;this[_0xd361('0x1a')]=_0x5b5512[_0xd361('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x5b5512['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x5b5512[_0xd361('0x1b')]||0x96;this[_0xd361('0x1c')]=_0x5b5512[_0xd361('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5b5512[_0xd361('0x1d')]||0x96;this[_0xd361('0x1e')]=_0x5b5512[_0xd361('0x1e')]||_0xd361('0x1f');this[_0xd361('0x20')]=_0x5b5512[_0xd361('0x20')]||undefined;this[_0xd361('0x21')]=_0x5b5512[_0xd361('0x21')]||undefined;this[_0xd361('0x22')]=_0x5b5512['dialCutDigit']||undefined;this[_0xd361('0x23')]=_0x5b5512[_0xd361('0x23')]?_0x5b5512[_0xd361('0x23')]:undefined;this['Trunk']=_0x5b5512['Trunk']?_0x5b5512[_0xd361('0x24')]:undefined;this[_0xd361('0x25')]=_0x5b5512[_0xd361('0x25')]?_0x5b5512[_0xd361('0x25')]:undefined;this[_0xd361('0x26')]=_0x5b5512[_0xd361('0x26')]?_0x5b5512[_0xd361('0x26')]:undefined;this['dialQueueProject']=_0x5b5512[_0xd361('0x26')]?_0x5b5512[_0xd361('0x26')][_0xd361('0x0')]:undefined;this[_0xd361('0x27')]=_0x5b5512[_0xd361('0x27')]||![];this['dialAMDInitialSilence']=_0x5b5512[_0xd361('0x28')];this['dialAMDGreeting']=_0x5b5512['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5b5512[_0xd361('0x29')];this[_0xd361('0x2a')]=_0x5b5512['dialAMDTotalAnalysisTime'];this[_0xd361('0x2b')]=_0x5b5512[_0xd361('0x2b')];this[_0xd361('0x2c')]=_0x5b5512['dialAMDBetweenWordsSilence'];this[_0xd361('0x2d')]=_0x5b5512[_0xd361('0x2d')];this[_0xd361('0x2e')]=_0x5b5512['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x5b5512[_0xd361('0x2f')];}module[_0xd361('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index eb6d9de..6bb9e4c 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 _0x8ac5=['starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','mohtime','exports'];(function(_0xadcf36,_0x3b68ec){var _0x59ae6c=function(_0x5ecf65){while(--_0x5ecf65){_0xadcf36['push'](_0xadcf36['shift']());}};_0x59ae6c(++_0x3b68ec);}(_0x8ac5,0x105));var _0x58ac=function(_0x219e3d,_0x5e287e){_0x219e3d=_0x219e3d-0x0;var _0x28474c=_0x8ac5[_0x219e3d];return _0x28474c;};'use strict';function Channel(){this[_0x58ac('0x0')]=null;this[_0x58ac('0x1')]='';this[_0x58ac('0x2')]='';this[_0x58ac('0x3')]=0x0;this[_0x58ac('0x4')]='';this[_0x58ac('0x5')]=undefined;this[_0x58ac('0x6')]=undefined;this[_0x58ac('0x7')]=0x0;this[_0x58ac('0x8')]='';this[_0x58ac('0x9')]=0x0;this['linkedid']=0x0;this[_0x58ac('0xa')]=0x0;this[_0x58ac('0xb')]=![];this[_0x58ac('0xc')]=null;this[_0x58ac('0xd')]=null;this[_0x58ac('0xe')]=![];this[_0x58ac('0xf')]=![];this[_0x58ac('0x10')]='';this[_0x58ac('0x11')]='';this[_0x58ac('0x12')]=0x0;this[_0x58ac('0x13')]=0x0;this[_0x58ac('0x14')]=0x0;this[_0x58ac('0x15')]=null;this[_0x58ac('0x16')]=null;this['disposition']=null;this[_0x58ac('0x17')]=![];this[_0x58ac('0x18')]=null;this['queue']=null;this['monitors']=[];this[_0x58ac('0x19')]=undefined;this[_0x58ac('0x1a')]=undefined;this[_0x58ac('0x1b')]=0x0;}module[_0x58ac('0x1c')]=Channel; \ No newline at end of file +var _0x531a=['abandoned','lastapplication','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answertime','endtime','unmanaged'];(function(_0x5c660a,_0x4b5262){var _0x3a77a4=function(_0x479c95){while(--_0x479c95){_0x5c660a['push'](_0x5c660a['shift']());}};_0x3a77a4(++_0x4b5262);}(_0x531a,0x100));var _0xa531=function(_0x378487,_0x1fdc2c){_0x378487=_0x378487-0x0;var _0x3bb63b=_0x531a[_0x378487];return _0x3bb63b;};'use strict';function Channel(){this[_0xa531('0x0')]=null;this[_0xa531('0x1')]='';this[_0xa531('0x2')]='';this[_0xa531('0x3')]=0x0;this[_0xa531('0x4')]='';this[_0xa531('0x5')]=undefined;this[_0xa531('0x6')]=undefined;this[_0xa531('0x7')]=0x0;this[_0xa531('0x8')]='';this[_0xa531('0x9')]=0x0;this['linkedid']=0x0;this[_0xa531('0xa')]=0x0;this['answered']=![];this[_0xa531('0xb')]=null;this[_0xa531('0xc')]=null;this[_0xa531('0xd')]=![];this[_0xa531('0xe')]=![];this[_0xa531('0xf')]='';this['lastdata']='';this[_0xa531('0x10')]=0x0;this[_0xa531('0x11')]=0x0;this['holdtime']=0x0;this[_0xa531('0x12')]=null;this[_0xa531('0x13')]=null;this[_0xa531('0x14')]=null;this[_0xa531('0x15')]=![];this[_0xa531('0x16')]=null;this['queue']=null;this[_0xa531('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xa531('0x18')]=undefined;this[_0xa531('0x19')]=0x0;}module[_0xa531('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f6f9ddd..04c3e26 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 _0x0734=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey'];(function(_0x166acc,_0x111e4e){var _0x209f4d=function(_0x354b62){while(--_0x354b62){_0x166acc['push'](_0x166acc['shift']());}};_0x209f4d(++_0x111e4e);}(_0x0734,0xba));var _0x4073=function(_0x38c730,_0x12d280){_0x38c730=_0x38c730-0x0;var _0x223cef=_0x0734[_0x38c730];return _0x223cef;};'use strict';function DeskAccount(_0x2f727f){this['id']=_0x2f727f['id']||0x0;this[_0x4073('0x0')]=_0x2f727f[_0x4073('0x0')]||'';this[_0x4073('0x1')]=_0x2f727f[_0x4073('0x1')]||'';this['remoteUri']=_0x2f727f[_0x4073('0x2')]||'';this[_0x4073('0x3')]=_0x2f727f[_0x4073('0x3')]||'';this[_0x4073('0x4')]=_0x2f727f['password']||'';this['consumerKey']=_0x2f727f[_0x4073('0x5')]||'';this['consumerSecret']=_0x2f727f[_0x4073('0x6')]||'';this[_0x4073('0x7')]=_0x2f727f[_0x4073('0x7')]||'';this[_0x4073('0x8')]=_0x2f727f['tokenSecret']||'';this[_0x4073('0x9')]=_0x2f727f['type']||'';this[_0x4073('0xa')]=_0x2f727f[_0x4073('0xa')]||'';this[_0x4073('0xb')]=_0x2f727f[_0x4073('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x938d=['serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x3d7ef8){this['id']=_0x3d7ef8['id']||0x0;this[_0xd938('0x0')]=_0x3d7ef8['name']||'';this[_0xd938('0x1')]=_0x3d7ef8[_0xd938('0x1')]||'';this[_0xd938('0x2')]=_0x3d7ef8['remoteUri']||'';this['authType']=_0x3d7ef8[_0xd938('0x3')]||'';this[_0xd938('0x4')]=_0x3d7ef8[_0xd938('0x4')]||'';this['consumerKey']=_0x3d7ef8[_0xd938('0x5')]||'';this[_0xd938('0x6')]=_0x3d7ef8[_0xd938('0x6')]||'';this[_0xd938('0x7')]=_0x3d7ef8[_0xd938('0x7')]||'';this[_0xd938('0x8')]=_0x3d7ef8['tokenSecret']||'';this[_0xd938('0x9')]=_0x3d7ef8[_0xd938('0x9')]||'';this[_0xd938('0xa')]=_0x3d7ef8[_0xd938('0xa')]||'';this[_0xd938('0xb')]=_0x3d7ef8[_0xd938('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index c22f4ed..0192175 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 _0x07eb=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0xe3b3dd,_0x527bb5){var _0x58a400=function(_0x50d950){while(--_0x50d950){_0xe3b3dd['push'](_0xe3b3dd['shift']());}};_0x58a400(++_0x527bb5);}(_0x07eb,0xb5));var _0xb07e=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x07eb[_0x31b5b2];return _0x364f13;};'use strict';function Dynamics365Account(_0x25b09f){this['id']=_0x25b09f['id']||0x0;this[_0xb07e('0x0')]=_0x25b09f[_0xb07e('0x0')]||'';this[_0xb07e('0x1')]=_0x25b09f[_0xb07e('0x1')]||'';this[_0xb07e('0x2')]=_0x25b09f[_0xb07e('0x2')]||'';this[_0xb07e('0x3')]=_0x25b09f[_0xb07e('0x3')]||'';this[_0xb07e('0x4')]=_0x25b09f[_0xb07e('0x4')]||'';this[_0xb07e('0x5')]=_0x25b09f['clientId']||'';this[_0xb07e('0x6')]=_0x25b09f['clientSecret']||{};this[_0xb07e('0x7')]=_0x25b09f['serverUrl']||'';this[_0xb07e('0x8')]=_0x25b09f[_0xb07e('0x8')]||{};}module[_0xb07e('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xf703=['name','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x310a54,_0x212d9a){var _0x4e4caa=function(_0x6baec9){while(--_0x6baec9){_0x310a54['push'](_0x310a54['shift']());}};_0x4e4caa(++_0x212d9a);}(_0xf703,0x1b9));var _0x3f70=function(_0x2dd29a,_0x5ad474){_0x2dd29a=_0x2dd29a-0x0;var _0x1b81e9=_0xf703[_0x2dd29a];return _0x1b81e9;};'use strict';function Dynamics365Account(_0x39a4ee){this['id']=_0x39a4ee['id']||0x0;this[_0x3f70('0x0')]=_0x39a4ee['name']||'';this['username']=_0x39a4ee[_0x3f70('0x1')]||'';this['password']=_0x39a4ee['password']||'';this['remoteUri']=_0x39a4ee[_0x3f70('0x2')]||'';this[_0x3f70('0x3')]=_0x39a4ee[_0x3f70('0x3')]||'';this[_0x3f70('0x4')]=_0x39a4ee['clientId']||'';this[_0x3f70('0x5')]=_0x39a4ee[_0x3f70('0x5')]||{};this[_0x3f70('0x6')]=_0x39a4ee['serverUrl']||'';this[_0x3f70('0x7')]=_0x39a4ee[_0x3f70('0x7')]||{};}module[_0x3f70('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f2b32dc..0caedc5 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 _0x9527=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','tech'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x9527,0x135));var _0x7952=function(_0x445a48,_0x4fa90b){_0x445a48=_0x445a48-0x0;var _0x3ada70=_0x9527[_0x445a48];return _0x3ada70;};'use strict';function FaxAccount(_0xd1912){this['id']=_0xd1912['id']||0x0;this[_0x7952('0x0')]=_0xd1912[_0x7952('0x0')]||'';this[_0x7952('0x1')]=_0xd1912['description'];this[_0x7952('0x2')]=_0xd1912[_0x7952('0x2')];this[_0x7952('0x3')]=_0xd1912[_0x7952('0x3')];this[_0x7952('0x4')]=_0xd1912['localstationid'];this[_0x7952('0x5')]=_0xd1912[_0x7952('0x5')]||0x960;this['maxrate']=_0xd1912['maxrate']||0x3840;this['modem']=_0xd1912[_0x7952('0x6')]||_0x7952('0x7');this[_0x7952('0x8')]=_0xd1912[_0x7952('0x8')]||'no';this[_0x7952('0x9')]=_0xd1912[_0x7952('0x9')]||'no';this['t38timeout']=_0xd1912['t38timeout']||0x1388;this['tech']=_0xd1912[_0x7952('0xa')]||_0x7952('0xb');this[_0x7952('0xc')]=_0xd1912[_0x7952('0xc')]?_0xd1912[_0x7952('0xc')]:undefined;this['ListId']=_0xd1912[_0x7952('0xd')];this[_0x7952('0xe')]=_0xd1912['key'];}module[_0x7952('0xf')]=FaxAccount; \ No newline at end of file +var _0xf5b1=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xf5b1,0xec));var _0x1f5b=function(_0x59d640,_0x285eab){_0x59d640=_0x59d640-0x0;var _0x54575e=_0xf5b1[_0x59d640];return _0x54575e;};'use strict';function FaxAccount(_0x42ad9d){this['id']=_0x42ad9d['id']||0x0;this[_0x1f5b('0x0')]=_0x42ad9d[_0x1f5b('0x0')]||'';this['description']=_0x42ad9d[_0x1f5b('0x1')];this[_0x1f5b('0x2')]=_0x42ad9d[_0x1f5b('0x2')];this['headerinfo']=_0x42ad9d[_0x1f5b('0x3')];this[_0x1f5b('0x4')]=_0x42ad9d[_0x1f5b('0x4')];this[_0x1f5b('0x5')]=_0x42ad9d[_0x1f5b('0x5')]||0x960;this['maxrate']=_0x42ad9d[_0x1f5b('0x6')]||0x3840;this[_0x1f5b('0x7')]=_0x42ad9d[_0x1f5b('0x7')]||_0x1f5b('0x8');this[_0x1f5b('0x9')]=_0x42ad9d[_0x1f5b('0x9')]||'no';this[_0x1f5b('0xa')]=_0x42ad9d[_0x1f5b('0xa')]||'no';this[_0x1f5b('0xb')]=_0x42ad9d[_0x1f5b('0xb')]||0x1388;this[_0x1f5b('0xc')]=_0x42ad9d[_0x1f5b('0xc')]||_0x1f5b('0xd');this[_0x1f5b('0xe')]=_0x42ad9d[_0x1f5b('0xe')]?_0x42ad9d[_0x1f5b('0xe')]:undefined;this[_0x1f5b('0xf')]=_0x42ad9d[_0x1f5b('0xf')];this['key']=_0x42ad9d[_0x1f5b('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 ca06950..eec93fc 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 _0x6cc5=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0xdf3fd0,_0x403c5f){var _0x2ff39e=function(_0x15ea33){while(--_0x15ea33){_0xdf3fd0['push'](_0xdf3fd0['shift']());}};_0x2ff39e(++_0x403c5f);}(_0x6cc5,0x1b0));var _0x56cc=function(_0x332d1e,_0x5f0588){_0x332d1e=_0x332d1e-0x0;var _0x416f93=_0x6cc5[_0x332d1e];return _0x416f93;};'use strict';function FreshdeskAccount(_0x3c8175){this['id']=_0x3c8175['id']||0x0;this[_0x56cc('0x0')]=_0x3c8175[_0x56cc('0x0')]||'';this[_0x56cc('0x1')]=_0x3c8175[_0x56cc('0x1')]||'';this[_0x56cc('0x2')]=_0x3c8175[_0x56cc('0x3')]||'';this[_0x56cc('0x4')]=_0x3c8175['remoteUri']||'';this[_0x56cc('0x5')]=_0x3c8175[_0x56cc('0x5')]||'';this['Configurations']=_0x3c8175[_0x56cc('0x6')]||{};}module[_0x56cc('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xf559=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x581168,_0x3919d1){var _0x501f90=function(_0x4f189c){while(--_0x4f189c){_0x581168['push'](_0x581168['shift']());}};_0x501f90(++_0x3919d1);}(_0xf559,0x12e));var _0x9f55=function(_0x26cbe5,_0x17c0ed){_0x26cbe5=_0x26cbe5-0x0;var _0x1f4da5=_0xf559[_0x26cbe5];return _0x1f4da5;};'use strict';function FreshdeskAccount(_0x42ff57){this['id']=_0x42ff57['id']||0x0;this[_0x9f55('0x0')]=_0x42ff57[_0x9f55('0x0')]||'';this[_0x9f55('0x1')]=_0x42ff57[_0x9f55('0x1')]||'';this['apiKey']=_0x42ff57[_0x9f55('0x2')]||'';this[_0x9f55('0x3')]=_0x42ff57[_0x9f55('0x3')]||'';this[_0x9f55('0x4')]=_0x42ff57['serverUrl']||'';this[_0x9f55('0x5')]=_0x42ff57[_0x9f55('0x5')]||{};}module[_0x9f55('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b68ed59..ffbb43e 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 _0xad4b=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xad4b,0x193));var _0xbad4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xad4b[_0x334841];return _0x5beb4b;};'use strict';function FreshsalesAccount(_0x33a655){this['id']=_0x33a655['id']||0x0;this[_0xbad4('0x0')]=_0x33a655['name']||'';this[_0xbad4('0x1')]=_0x33a655[_0xbad4('0x1')]||'';this[_0xbad4('0x2')]=_0x33a655[_0xbad4('0x3')]||'';this['remoteUri']=_0x33a655[_0xbad4('0x4')]||'';this['serverUrl']=_0x33a655[_0xbad4('0x5')]||'';this[_0xbad4('0x6')]=_0x33a655['Configurations']||{};}module[_0xbad4('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x1f96=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x1f96,0xd4));var _0x61f9=function(_0x5ec600,_0xb9bfa9){_0x5ec600=_0x5ec600-0x0;var _0x417693=_0x1f96[_0x5ec600];return _0x417693;};'use strict';function FreshsalesAccount(_0x39d2ed){this['id']=_0x39d2ed['id']||0x0;this[_0x61f9('0x0')]=_0x39d2ed[_0x61f9('0x0')]||'';this[_0x61f9('0x1')]=_0x39d2ed[_0x61f9('0x1')]||'';this[_0x61f9('0x2')]=_0x39d2ed[_0x61f9('0x3')]||'';this[_0x61f9('0x4')]=_0x39d2ed[_0x61f9('0x4')]||'';this[_0x61f9('0x5')]=_0x39d2ed[_0x61f9('0x5')]||'';this[_0x61f9('0x6')]=_0x39d2ed[_0x61f9('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ccaccde..78e83d2 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 _0x4c3e=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','variables','exports','inbound','calleridnum','calleridname','position'];(function(_0x5f0043,_0x249a1a){var _0x16b65a=function(_0xdd24ff){while(--_0xdd24ff){_0x5f0043['push'](_0x5f0043['shift']());}};_0x16b65a(++_0x249a1a);}(_0x4c3e,0x18b));var _0xe4c3=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4c3e[_0x40ac5e];return _0x2839d6;};'use strict';function QueueReport(){this['type']=_0xe4c3('0x0');this['uniqueid']='';this[_0xe4c3('0x1')]='';this[_0xe4c3('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xe4c3('0x3')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xe4c3('0x4')]=![];this[_0xe4c3('0x5')]=null;this[_0xe4c3('0x6')]=![];this['queuecallerexitAt']=null;this[_0xe4c3('0x7')]=0x1;this[_0xe4c3('0x8')]='';this[_0xe4c3('0x9')]='';this[_0xe4c3('0xa')]='';this[_0xe4c3('0xb')]='';this['context']='';this[_0xe4c3('0xc')]='';this[_0xe4c3('0xd')]='';this[_0xe4c3('0xe')]=0x0;this[_0xe4c3('0xf')]=![];this[_0xe4c3('0x10')]='';this['mohtime']=0x0;this[_0xe4c3('0x11')]={};}module[_0xe4c3('0x12')]=QueueReport; \ No newline at end of file +var _0x89ff=['calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum'];(function(_0x421a93,_0x36e0b0){var _0x3eeab8=function(_0x446ab4){while(--_0x446ab4){_0x421a93['push'](_0x421a93['shift']());}};_0x3eeab8(++_0x36e0b0);}(_0x89ff,0x1b7));var _0xf89f=function(_0x268319,_0x53fc42){_0x268319=_0x268319-0x0;var _0x1f9479=_0x89ff[_0x268319];return _0x1f9479;};'use strict';function QueueReport(){this['type']=_0xf89f('0x0');this[_0xf89f('0x1')]='';this[_0xf89f('0x2')]='';this[_0xf89f('0x3')]='';this[_0xf89f('0x4')]='';this[_0xf89f('0x5')]=null;this[_0xf89f('0x6')]=null;this['position']=0x1;this[_0xf89f('0x7')]=0x1;this[_0xf89f('0x8')]=![];this[_0xf89f('0x9')]=null;this[_0xf89f('0xa')]=![];this['queuecallercompleteAt']=null;this[_0xf89f('0xb')]=![];this[_0xf89f('0xc')]=null;this[_0xf89f('0xd')]=0x1;this[_0xf89f('0xe')]='';this['connectedlinenum']='';this[_0xf89f('0xf')]='';this[_0xf89f('0x10')]='';this[_0xf89f('0x11')]='';this[_0xf89f('0x12')]='';this[_0xf89f('0x13')]='';this[_0xf89f('0x14')]=0x0;this[_0xf89f('0x15')]=![];this[_0xf89f('0x16')]='';this[_0xf89f('0x17')]=0x0;this[_0xf89f('0x18')]={};}module[_0xf89f('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index df4084f..cab1587 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 _0x9f5e=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9f5e,0x149));var _0xe9f5=function(_0x4aaa91,_0x4fcbb1){_0x4aaa91=_0x4aaa91-0x0;var _0x17eb83=_0x9f5e[_0x4aaa91];return _0x17eb83;};'use strict';function SalesforceAccount(_0xf2d4e2){this['id']=_0xf2d4e2['id']||0x0;this[_0xe9f5('0x0')]=_0xf2d4e2[_0xe9f5('0x0')]||'';this[_0xe9f5('0x1')]=_0xf2d4e2[_0xe9f5('0x1')]||'';this[_0xe9f5('0x2')]=_0xf2d4e2['remoteUri']||'';this['password']=_0xf2d4e2[_0xe9f5('0x3')]||'';this['clientId']=_0xf2d4e2[_0xe9f5('0x4')]||'';this['clientSecret']=_0xf2d4e2[_0xe9f5('0x5')]||'';this['securityToken']=_0xf2d4e2[_0xe9f5('0x6')]||'';this[_0xe9f5('0x7')]=_0xf2d4e2[_0xe9f5('0x7')]||_0xe9f5('0x8');this[_0xe9f5('0x9')]=_0xf2d4e2[_0xe9f5('0x9')]||'';this[_0xe9f5('0xa')]=_0xf2d4e2[_0xe9f5('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x624e=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0xe43393,_0x4487b6){var _0x5e4a26=function(_0x4bd161){while(--_0x4bd161){_0xe43393['push'](_0xe43393['shift']());}};_0x5e4a26(++_0x4487b6);}(_0x624e,0x162));var _0xe624=function(_0x446e42,_0x5b7ee0){_0x446e42=_0x446e42-0x0;var _0x248ba9=_0x624e[_0x446e42];return _0x248ba9;};'use strict';function SalesforceAccount(_0x49c253){this['id']=_0x49c253['id']||0x0;this[_0xe624('0x0')]=_0x49c253['name']||'';this[_0xe624('0x1')]=_0x49c253[_0xe624('0x1')]||'';this[_0xe624('0x2')]=_0x49c253[_0xe624('0x2')]||'';this[_0xe624('0x3')]=_0x49c253['password']||'';this[_0xe624('0x4')]=_0x49c253[_0xe624('0x4')]||'';this[_0xe624('0x5')]=_0x49c253[_0xe624('0x5')]||'';this['securityToken']=_0x49c253[_0xe624('0x6')]||'';this[_0xe624('0x7')]=_0x49c253[_0xe624('0x7')]||'integrationTab';this[_0xe624('0x8')]=_0x49c253[_0xe624('0x8')]||'';this[_0xe624('0x9')]=_0x49c253[_0xe624('0x9')]||{};}module[_0xe624('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index c42c123..e85130e 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 _0x8cf2=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3bde7b,_0x1c1cfd){var _0x5b85d6=function(_0x566924){while(--_0x566924){_0x3bde7b['push'](_0x3bde7b['shift']());}};_0x5b85d6(++_0x1c1cfd);}(_0x8cf2,0x108));var _0x28cf=function(_0x1f477b,_0x59b018){_0x1f477b=_0x1f477b-0x0;var _0x2620d9=_0x8cf2[_0x1f477b];return _0x2620d9;};'use strict';function ServicenowAccount(_0x23f68d){this['id']=_0x23f68d['id']||0x0;this[_0x28cf('0x0')]=_0x23f68d[_0x28cf('0x0')]||'';this[_0x28cf('0x1')]=_0x23f68d[_0x28cf('0x1')]||'';this['password']=_0x23f68d[_0x28cf('0x2')]||'';this[_0x28cf('0x3')]=_0x23f68d[_0x28cf('0x3')]||'';this[_0x28cf('0x4')]=_0x23f68d[_0x28cf('0x4')]||'';this[_0x28cf('0x5')]=_0x23f68d[_0x28cf('0x5')]||{};}module[_0x28cf('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x4b3e=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x3956f4,_0x23ecfc){var _0x5bc0f9=function(_0x16c8c9){while(--_0x16c8c9){_0x3956f4['push'](_0x3956f4['shift']());}};_0x5bc0f9(++_0x23ecfc);}(_0x4b3e,0x129));var _0xe4b3=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x4b3e[_0x28d225];return _0x1f79e1;};'use strict';function ServicenowAccount(_0x540ccd){this['id']=_0x540ccd['id']||0x0;this['name']=_0x540ccd[_0xe4b3('0x0')]||'';this[_0xe4b3('0x1')]=_0x540ccd[_0xe4b3('0x1')]||'';this[_0xe4b3('0x2')]=_0x540ccd[_0xe4b3('0x2')]||'';this[_0xe4b3('0x3')]=_0x540ccd['remoteUri']||'';this[_0xe4b3('0x4')]=_0x540ccd[_0xe4b3('0x4')]||'';this[_0xe4b3('0x5')]=_0x540ccd[_0xe4b3('0x5')]||{};}module[_0xe4b3('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 63346dd..5bbbd78 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 _0x776e=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x3e4554,_0x27b9ca){var _0x37c433=function(_0x1a5eba){while(--_0x1a5eba){_0x3e4554['push'](_0x3e4554['shift']());}};_0x37c433(++_0x27b9ca);}(_0x776e,0xc9));var _0xe776=function(_0x2f7e50,_0x1053b8){_0x2f7e50=_0x2f7e50-0x0;var _0x59f3cd=_0x776e[_0x2f7e50];return _0x59f3cd;};'use strict';function SugarcrmAccount(_0x3bff96){this['id']=_0x3bff96['id']||0x0;this[_0xe776('0x0')]=_0x3bff96['name']||'';this['username']=_0x3bff96[_0xe776('0x1')]||'';this[_0xe776('0x2')]=_0x3bff96['password']||'';this['remoteUri']=_0x3bff96[_0xe776('0x3')]||'';this[_0xe776('0x4')]=_0x3bff96[_0xe776('0x4')]||'';this['Configurations']=_0x3bff96['Configurations']||{};}module[_0xe776('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x871f=['serverUrl','Configurations','name','password','remoteUri'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x871f,0xe8));var _0xf871=function(_0x126880,_0x10345c){_0x126880=_0x126880-0x0;var _0x19078d=_0x871f[_0x126880];return _0x19078d;};'use strict';function SugarcrmAccount(_0x590e61){this['id']=_0x590e61['id']||0x0;this[_0xf871('0x0')]=_0x590e61[_0xf871('0x0')]||'';this['username']=_0x590e61['username']||'';this[_0xf871('0x1')]=_0x590e61[_0xf871('0x1')]||'';this[_0xf871('0x2')]=_0x590e61[_0xf871('0x2')]||'';this[_0xf871('0x3')]=_0x590e61['serverUrl']||'';this[_0xf871('0x4')]=_0x590e61[_0xf871('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 54e49a2..ec8be77 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 _0xf2d4=['address','accountcode','state','unknown','stateTime','status'];(function(_0x365d3d,_0x2c1c9e){var _0x2fa91a=function(_0x231e41){while(--_0x231e41){_0x365d3d['push'](_0x365d3d['shift']());}};_0x2fa91a(++_0x2c1c9e);}(_0xf2d4,0xcd));var _0x4f2d=function(_0xf72ad4,_0x5721af){_0xf72ad4=_0xf72ad4-0x0;var _0x51d127=_0xf2d4[_0xf72ad4];return _0x51d127;};'use strict';function Telephone(_0x5c6186){this['id']=_0x5c6186['id']||0x0;this['name']=_0x5c6186['name']||'';this[_0x4f2d('0x0')]=_0x5c6186[_0x4f2d('0x0')]||'';this[_0x4f2d('0x1')]=_0x4f2d('0x2');this[_0x4f2d('0x3')]=0x0;this[_0x4f2d('0x4')]=_0x4f2d('0x2');this[_0x4f2d('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xa8d0=['address','exports','name','accountcode','unknown','stateTime','status'];(function(_0xb029f6,_0x44a4aa){var _0x8c553e=function(_0x1a7e26){while(--_0x1a7e26){_0xb029f6['push'](_0xb029f6['shift']());}};_0x8c553e(++_0x44a4aa);}(_0xa8d0,0x198));var _0x0a8d=function(_0x10b967,_0xb32c4d){_0x10b967=_0x10b967-0x0;var _0x264da2=_0xa8d0[_0x10b967];return _0x264da2;};'use strict';function Telephone(_0x5d92a5){this['id']=_0x5d92a5['id']||0x0;this[_0x0a8d('0x0')]=_0x5d92a5[_0x0a8d('0x0')]||'';this[_0x0a8d('0x1')]=_0x5d92a5[_0x0a8d('0x1')]||'';this['state']=_0x0a8d('0x2');this[_0x0a8d('0x3')]=0x0;this[_0x0a8d('0x4')]='unknown';this[_0x0a8d('0x5')]='';}module[_0x0a8d('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index aa71686..a1df870 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 _0x0a16=['name','html'];(function(_0x9f2d59,_0x4ca693){var _0x46a405=function(_0x515834){while(--_0x515834){_0x9f2d59['push'](_0x9f2d59['shift']());}};_0x46a405(++_0x4ca693);}(_0x0a16,0x10e));var _0x60a1=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0x0a16[_0x5ea2f9];return _0x36e586;};'use strict';function template(_0x36520e){this['id']=_0x36520e['id']||0x0;this[_0x60a1('0x0')]=_0x36520e[_0x60a1('0x0')]||'';this[_0x60a1('0x1')]=_0x36520e[_0x60a1('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x4984=['exports','name','html'];(function(_0x3dc5aa,_0x147a66){var _0xd4f35f=function(_0x4d4d70){while(--_0x4d4d70){_0x3dc5aa['push'](_0x3dc5aa['shift']());}};_0xd4f35f(++_0x147a66);}(_0x4984,0x154));var _0x4498=function(_0x17d952,_0x5bef11){_0x17d952=_0x17d952-0x0;var _0x375183=_0x4984[_0x17d952];return _0x375183;};'use strict';function template(_0x3aaf24){this['id']=_0x3aaf24['id']||0x0;this['name']=_0x3aaf24[_0x4498('0x0')]||'';this[_0x4498('0x1')]=_0x3aaf24[_0x4498('0x1')]||'';}module[_0x4498('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 aa12247..137ba08 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 _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x3379aa,_0x3aba7b){var _0x3da6ef=function(_0x82eda8){while(--_0x82eda8){_0x3379aa['push'](_0x3379aa['shift']());}};_0x3da6ef(++_0x3aba7b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x218c0c,_0x2b21e3){_0x218c0c=_0x218c0c-0x0;var _0xf0347d=_0xf3cd[_0x218c0c];return _0xf0347d;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file +var _0x34e8=['channel','voice','status','AllConditions','AnyConditions','Actions','name'];(function(_0x51eba4,_0x1ed011){var _0x3195ce=function(_0x26d099){while(--_0x26d099){_0x51eba4['push'](_0x51eba4['shift']());}};_0x3195ce(++_0x1ed011);}(_0x34e8,0x12c));var _0x834e=function(_0x2cd2bf,_0x101d17){_0x2cd2bf=_0x2cd2bf-0x0;var _0x5b8487=_0x34e8[_0x2cd2bf];return _0x5b8487;};'use strict';function Trigger(_0x26715f){this['id']=_0x26715f['id']||0x0;this[_0x834e('0x0')]=_0x26715f[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x26715f['channel']||_0x834e('0x2');this[_0x834e('0x3')]=_0x26715f[_0x834e('0x3')]||![];this[_0x834e('0x4')]=_0x26715f[_0x834e('0x4')]||[];this[_0x834e('0x5')]=_0x26715f[_0x834e('0x5')]||[];this['Actions']=_0x26715f[_0x834e('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4742207..5c62c5b 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 _0xcb95=['address','exports','active','state','unknown','stateTime','registry','host','port','domain','domainport','stateRegistry','registrationtime'];(function(_0x44ff41,_0x344caf){var _0x37a1bc=function(_0x42c148){while(--_0x42c148){_0x44ff41['push'](_0x44ff41['shift']());}};_0x37a1bc(++_0x344caf);}(_0xcb95,0xc5));var _0x5cb9=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xcb95[_0x5f0089];return _0x193892;};'use strict';function Trunk(_0x45e782){this['id']=_0x45e782['id']||0x0;this[_0x5cb9('0x0')]=_0x45e782[_0x5cb9('0x0')]||![];this['name']=_0x45e782['name']||'';this[_0x5cb9('0x1')]=_0x5cb9('0x2');this[_0x5cb9('0x3')]=0x0;this['status']=_0x5cb9('0x2');this[_0x5cb9('0x4')]=_0x45e782['registry']&&_0x45e782[_0x5cb9('0x4')]['indexOf'](':')?_0x45e782[_0x5cb9('0x4')]['split'](':')[0x0]:'';this[_0x5cb9('0x5')]='';this[_0x5cb9('0x6')]='';this[_0x5cb9('0x7')]='';this[_0x5cb9('0x8')]='';this['refresh']='';this[_0x5cb9('0x9')]=_0x5cb9('0x2');this[_0x5cb9('0xa')]='';this[_0x5cb9('0xb')]='';}module[_0x5cb9('0xc')]=Trunk; \ No newline at end of file +var _0x0879=['name','state','stateTime','status','unknown','registry','indexOf','split','host','port','domain','refresh','exports','active'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x0879,0x1e9));var _0x9087=function(_0x32171e,_0x2a2a78){_0x32171e=_0x32171e-0x0;var _0x396dd3=_0x0879[_0x32171e];return _0x396dd3;};'use strict';function Trunk(_0x462b55){this['id']=_0x462b55['id']||0x0;this[_0x9087('0x0')]=_0x462b55['active']||![];this[_0x9087('0x1')]=_0x462b55[_0x9087('0x1')]||'';this[_0x9087('0x2')]='unknown';this[_0x9087('0x3')]=0x0;this[_0x9087('0x4')]=_0x9087('0x5');this[_0x9087('0x6')]=_0x462b55['registry']&&_0x462b55[_0x9087('0x6')][_0x9087('0x7')](':')?_0x462b55[_0x9087('0x6')][_0x9087('0x8')](':')[0x0]:'';this[_0x9087('0x9')]='';this[_0x9087('0xa')]='';this[_0x9087('0xb')]='';this['domainport']='';this[_0x9087('0xc')]='';this['stateRegistry']=_0x9087('0x5');this['registrationtime']='';this['address']='';}module[_0x9087('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 621c063..f1fe669 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 _0xb3c7=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0xb3c7,0x1c9));var _0x7b3c=function(_0x4fce12,_0x47faae){_0x4fce12=_0x4fce12-0x0;var _0x3e95e6=_0xb3c7[_0x4fce12];return _0x3e95e6;};'use strict';function voiceExtension(_0x4c62e5){this['id']=_0x4c62e5['id']||0x0;this[_0x7b3c('0x0')]=_0x4c62e5['exten']||'';this[_0x7b3c('0x1')]=_0x4c62e5[_0x7b3c('0x1')]||_0x7b3c('0x2');this[_0x7b3c('0x3')]=_0x4c62e5[_0x7b3c('0x3')]||![];}module[_0x7b3c('0x4')]=voiceExtension; \ No newline at end of file +var _0x1c44=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x48e6c9,_0x46c2fd){var _0xf3f800=function(_0x4ce308){while(--_0x4ce308){_0x48e6c9['push'](_0x48e6c9['shift']());}};_0xf3f800(++_0x46c2fd);}(_0x1c44,0x181));var _0x41c4=function(_0x5a4dfc,_0x5a3b0c){_0x5a4dfc=_0x5a4dfc-0x0;var _0x127d2b=_0x1c44[_0x5a4dfc];return _0x127d2b;};'use strict';function voiceExtension(_0x472f7b){this['id']=_0x472f7b['id']||0x0;this[_0x41c4('0x0')]=_0x472f7b['exten']||'';this[_0x41c4('0x1')]=_0x472f7b[_0x41c4('0x1')]||_0x41c4('0x2');this[_0x41c4('0x3')]=_0x472f7b[_0x41c4('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c142cd6..5347b7f 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 _0xc9e5=['dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','unavailable','ringing','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x14a34f,_0x250eec){var _0x32676c=function(_0x414e9e){while(--_0x414e9e){_0x14a34f['push'](_0x14a34f['shift']());}};_0x32676c(++_0x250eec);}(_0xc9e5,0x1aa));var _0x5c9e=function(_0x256749,_0x58f2b8){_0x256749=_0x256749-0x0;var _0x5b3e19=_0xc9e5[_0x256749];return _0x5b3e19;};'use strict';var statusDesc=[_0x5c9e('0x0'),_0x5c9e('0x1'),'inuse','busy',_0x5c9e('0x2'),_0x5c9e('0x3'),_0x5c9e('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0x5c9e('0x5'),'wav49':_0x5c9e('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0x5c9e('0x7'),'roundrobin':'roundrobin'};function VoiceQueue(_0x4aa7f5){this['id']=_0x4aa7f5['id']||0x0;this[_0x5c9e('0x8')]=_0x4aa7f5[_0x5c9e('0x8')]||'';this[_0x5c9e('0x9')]=_0x4aa7f5[_0x5c9e('0x9')]||'';this[_0x5c9e('0xa')]=_0x4aa7f5[_0x5c9e('0xa')]||_0x5c9e('0xb');this[_0x5c9e('0xc')]=0x0;this[_0x5c9e('0xd')]=0x0;this[_0x5c9e('0xe')]=0x0;this[_0x5c9e('0xf')]=0x0;this[_0x5c9e('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x5c9e('0x11')]=0x0;this['unmanaged']=0x0;this[_0x5c9e('0x12')]=0x0;this['loggedIn']=0x0;this[_0x5c9e('0x13')]=0x0;this[_0x5c9e('0x14')]=_0x4aa7f5[_0x5c9e('0x14')]||![];this[_0x5c9e('0x15')]=_0x4aa7f5[_0x5c9e('0x15')]||0xa;this[_0x5c9e('0x16')]=_0x4aa7f5[_0x5c9e('0x16')]||'no';this[_0x5c9e('0x17')]=!![];this[_0x5c9e('0x18')]='';this[_0x5c9e('0x19')]=0x0;this['temp']=0x0;this[_0x5c9e('0x1a')]=_0x4aa7f5[_0x5c9e('0x1a')]||null;this[_0x5c9e('0x1b')]=_0x4aa7f5[_0x5c9e('0x1b')]?_0x4aa7f5[_0x5c9e('0x1b')]:null;this[_0x5c9e('0x1c')]=_0x4aa7f5['dialActive'];this['dialMethod']=_0x4aa7f5[_0x5c9e('0x1d')]||_0x5c9e('0x1e');this['dialLimitChannel']=_0x4aa7f5['dialLimitChannel']||0x0;this[_0x5c9e('0x1f')]=_0x4aa7f5[_0x5c9e('0x1f')]||0x0;this[_0x5c9e('0x20')]=_0x4aa7f5['dialPowerLevel']||0x1;this[_0x5c9e('0x21')]=_0x4aa7f5[_0x5c9e('0x21')]||_0x5c9e('0x22');this[_0x5c9e('0x23')]=_0x4aa7f5[_0x5c9e('0x23')]||0.03;this['dialPredictiveInterval']=_0x4aa7f5[_0x5c9e('0x24')]||0x258;this[_0x5c9e('0x25')]=_0x4aa7f5['dialOriginateCallerIdName']||_0x5c9e('0x26');this[_0x5c9e('0x27')]=_0x4aa7f5[_0x5c9e('0x27')]||'anonymous';this['dialOriginateTimeout']=_0x4aa7f5[_0x5c9e('0x28')]||0x1e;this[_0x5c9e('0x29')]=_0x4aa7f5[_0x5c9e('0x29')]||'tTxX';this['dialQueueTimeout']=_0x4aa7f5['dialQueueTimeout']||0x3;this[_0x5c9e('0x2a')]=_0x4aa7f5[_0x5c9e('0x2a')]||undefined;this['dialCongestionMaxRetry']=_0x4aa7f5[_0x5c9e('0x2b')]||0x3;this[_0x5c9e('0x2c')]=_0x4aa7f5[_0x5c9e('0x2c')]||0x96;this['dialBusyMaxRetry']=_0x4aa7f5[_0x5c9e('0x2d')]||0x3;this[_0x5c9e('0x2e')]=_0x4aa7f5[_0x5c9e('0x2e')]||0x96;this[_0x5c9e('0x2f')]=_0x4aa7f5['dialNoAnswerMaxRetry']||0x3;this[_0x5c9e('0x30')]=_0x4aa7f5[_0x5c9e('0x30')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4aa7f5['dialNoSuchNumberMaxRetry']||0x3;this[_0x5c9e('0x31')]=_0x4aa7f5[_0x5c9e('0x31')]||0x96;this[_0x5c9e('0x32')]=_0x4aa7f5[_0x5c9e('0x32')]||0x3;this[_0x5c9e('0x33')]=_0x4aa7f5[_0x5c9e('0x33')]||0x96;this['dialAbandonedMaxRetry']=_0x4aa7f5[_0x5c9e('0x34')]||0x3;this[_0x5c9e('0x35')]=_0x4aa7f5[_0x5c9e('0x35')]||0x96;this[_0x5c9e('0x36')]=_0x4aa7f5[_0x5c9e('0x36')]||0x3;this[_0x5c9e('0x37')]=_0x4aa7f5[_0x5c9e('0x37')]||0x96;this[_0x5c9e('0x38')]=_0x4aa7f5['dialAgentRejectMaxRetry']||0x3;this[_0x5c9e('0x39')]=_0x4aa7f5[_0x5c9e('0x39')]||0x96;this[_0x5c9e('0x3a')]=_0x4aa7f5[_0x5c9e('0x3a')]||0x4;this['Trunk']=_0x4aa7f5[_0x5c9e('0x3b')]?_0x4aa7f5['Trunk']:undefined;this['TrunkBackup']=_0x4aa7f5[_0x5c9e('0x3c')]?_0x4aa7f5['TrunkBackup']:undefined;this['dialPrefix']=_0x4aa7f5[_0x5c9e('0x3d')]||undefined;this['Interval']=_0x4aa7f5[_0x5c9e('0x3e')]?_0x4aa7f5[_0x5c9e('0x3e')]:undefined;this[_0x5c9e('0x3f')]=_0x4aa7f5['dialOrderByScheduledAt']||_0x5c9e('0x40');this[_0x5c9e('0x41')]=_0x4aa7f5[_0x5c9e('0x41')]||undefined;this[_0x5c9e('0x42')]=_0x4aa7f5[_0x5c9e('0x42')]||undefined;this[_0x5c9e('0x43')]=strategy[_0x4aa7f5[_0x5c9e('0x43')]]||'rrmemory';this[_0x5c9e('0x44')]=!![];this['dialAMDActive']=_0x4aa7f5[_0x5c9e('0x45')]||![];this[_0x5c9e('0x46')]=_0x4aa7f5['dialAMDInitialSilence'];this[_0x5c9e('0x47')]=_0x4aa7f5[_0x5c9e('0x47')];this[_0x5c9e('0x48')]=_0x4aa7f5['dialAMDAfterGreetingSilence'];this[_0x5c9e('0x49')]=_0x4aa7f5[_0x5c9e('0x49')];this[_0x5c9e('0x4a')]=_0x4aa7f5[_0x5c9e('0x4a')];this[_0x5c9e('0x4b')]=_0x4aa7f5[_0x5c9e('0x4b')];this[_0x5c9e('0x4c')]=_0x4aa7f5[_0x5c9e('0x4c')];this[_0x5c9e('0x4d')]=_0x4aa7f5[_0x5c9e('0x4d')];this[_0x5c9e('0x4e')]=_0x4aa7f5[_0x5c9e('0x4e')];this[_0x5c9e('0x4f')]=0x0;this[_0x5c9e('0x50')]=0x0;this['timeout']=_0x4aa7f5[_0x5c9e('0x51')];this['outboundAnswerCallsDay']=0x0;this[_0x5c9e('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x5c9e('0x53')]=0x0;this[_0x5c9e('0x54')]=0x0;this[_0x5c9e('0x55')]=0x0;this[_0x5c9e('0x56')]=0x0;this[_0x5c9e('0x57')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x5c9e('0x58')]=0x0;this[_0x5c9e('0x59')]=0x0;this[_0x5c9e('0x5a')]=0x0;this[_0x5c9e('0x5b')]=0x0;this[_0x5c9e('0x5c')]=0x0;this[_0x5c9e('0x5d')]=undefined;this[_0x5c9e('0x5e')]=undefined;this[_0x5c9e('0x5f')]=undefined;this[_0x5c9e('0x60')]=1.05;this[_0x5c9e('0x61')]=0x0;this[_0x5c9e('0x62')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x5c9e('0x63')]=0x0;this[_0x5c9e('0x64')]=0x0;this[_0x5c9e('0x65')]=0x0;this[_0x5c9e('0x66')]=0x0;this[_0x5c9e('0x67')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4aa7f5[_0x5c9e('0x68')]||0x14;this['predictiveIntervalMinThreshold']=_0x4aa7f5[_0x5c9e('0x68')]||0xa;this[_0x5c9e('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x5c9e('0x6a')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x5c9e('0x6b')]=_0x4aa7f5['dialRecallMeTimeout']||0x1e;this[_0x5c9e('0x6c')]=_0x4aa7f5[_0x5c9e('0x6c')]||![];this[_0x5c9e('0x6d')]=_0x4aa7f5[_0x5c9e('0x6d')]||undefined;this[_0x5c9e('0x6e')]=_0x4aa7f5[_0x5c9e('0x6e')]||![];this[_0x5c9e('0x6f')]=_0x4aa7f5[_0x5c9e('0x6f')]||![];this['monitor_format']=monitorFormat[_0x4aa7f5[_0x5c9e('0x9')]]?monitorFormat[_0x4aa7f5[_0x5c9e('0x9')]]:undefined;this[_0x5c9e('0x70')]=_0x4aa7f5[_0x5c9e('0x70')]||![];this[_0x5c9e('0x71')]=_0x4aa7f5[_0x5c9e('0x71')]?_0x4aa7f5[_0x5c9e('0x71')]:undefined;}module[_0x5c9e('0x72')]=VoiceQueue; \ No newline at end of file +var _0x212d=['dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue'];(function(_0x1bacb5,_0x9ba45a){var _0x5b4eea=function(_0x4f122a){while(--_0x4f122a){_0x1bacb5['push'](_0x1bacb5['shift']());}};_0x5b4eea(++_0x9ba45a);}(_0x212d,0x140));var _0xd212=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x212d[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=[_0xd212('0x0'),_0xd212('0x1'),_0xd212('0x2'),_0xd212('0x3'),_0xd212('0x4'),_0xd212('0x5'),_0xd212('0x6'),_0xd212('0x7'),_0xd212('0x8')];var monitorFormat={'wav':_0xd212('0x9'),'wav49':'wav49','gsm':_0xd212('0xa')};var strategy={'rrmemory':_0xd212('0xb'),'roundrobin':_0xd212('0xc')};function VoiceQueue(_0x2eb086){this['id']=_0x2eb086['id']||0x0;this[_0xd212('0xd')]=_0x2eb086[_0xd212('0xd')]||'';this[_0xd212('0xe')]=_0x2eb086[_0xd212('0xe')]||'';this[_0xd212('0xf')]=_0x2eb086[_0xd212('0xf')]||_0xd212('0x10');this[_0xd212('0x11')]=0x0;this[_0xd212('0x12')]=0x0;this[_0xd212('0x13')]=0x0;this[_0xd212('0x14')]=0x0;this['sumDuration']=0x0;this[_0xd212('0x15')]=0x0;this['sumBillable']=0x0;this[_0xd212('0x16')]=0x0;this[_0xd212('0x17')]=0x0;this['loggedIn']=0x0;this[_0xd212('0x18')]=0x0;this[_0xd212('0x19')]=_0x2eb086['acw']||![];this[_0xd212('0x1a')]=_0x2eb086['acwTimeout']||0xa;this[_0xd212('0x1b')]=_0x2eb086[_0xd212('0x1b')]||'no';this[_0xd212('0x1c')]=!![];this[_0xd212('0x1d')]='';this['originated']=0x0;this[_0xd212('0x1e')]=0x0;this[_0xd212('0x1f')]=_0x2eb086[_0xd212('0x1f')]||null;this[_0xd212('0x20')]=_0x2eb086[_0xd212('0x20')]?_0x2eb086[_0xd212('0x20')]:null;this[_0xd212('0x21')]=_0x2eb086['dialActive'];this['dialMethod']=_0x2eb086['dialMethod']||_0xd212('0x22');this[_0xd212('0x23')]=_0x2eb086[_0xd212('0x23')]||0x0;this[_0xd212('0x24')]=_0x2eb086[_0xd212('0x24')]||0x0;this[_0xd212('0x25')]=_0x2eb086[_0xd212('0x25')]||0x1;this[_0xd212('0x26')]=_0x2eb086['dialPredictiveOptimization']||_0xd212('0x27');this[_0xd212('0x28')]=_0x2eb086['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x2eb086[_0xd212('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x2eb086[_0xd212('0x2a')]||_0xd212('0x2b');this[_0xd212('0x2c')]=_0x2eb086['dialOriginateCallerIdNumber']||'anonymous';this[_0xd212('0x2d')]=_0x2eb086[_0xd212('0x2d')]||0x1e;this[_0xd212('0x2e')]=_0x2eb086[_0xd212('0x2e')]||'tTxX';this[_0xd212('0x2f')]=_0x2eb086[_0xd212('0x2f')]||0x3;this['dialQueueProject']=_0x2eb086['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x2eb086[_0xd212('0x30')]||0x3;this[_0xd212('0x31')]=_0x2eb086[_0xd212('0x31')]||0x96;this['dialBusyMaxRetry']=_0x2eb086[_0xd212('0x32')]||0x3;this[_0xd212('0x33')]=_0x2eb086[_0xd212('0x33')]||0x96;this[_0xd212('0x34')]=_0x2eb086[_0xd212('0x34')]||0x3;this[_0xd212('0x35')]=_0x2eb086[_0xd212('0x35')]||0x96;this[_0xd212('0x36')]=_0x2eb086[_0xd212('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2eb086['dialNoSuchNumberRetryFrequency']||0x96;this[_0xd212('0x37')]=_0x2eb086[_0xd212('0x37')]||0x3;this[_0xd212('0x38')]=_0x2eb086['dialDropRetryFrequency']||0x96;this[_0xd212('0x39')]=_0x2eb086[_0xd212('0x39')]||0x3;this[_0xd212('0x3a')]=_0x2eb086[_0xd212('0x3a')]||0x96;this[_0xd212('0x3b')]=_0x2eb086[_0xd212('0x3b')]||0x3;this[_0xd212('0x3c')]=_0x2eb086[_0xd212('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x2eb086[_0xd212('0x3d')]||0x3;this[_0xd212('0x3e')]=_0x2eb086[_0xd212('0x3e')]||0x96;this[_0xd212('0x3f')]=_0x2eb086[_0xd212('0x3f')]||0x4;this[_0xd212('0x40')]=_0x2eb086[_0xd212('0x40')]?_0x2eb086[_0xd212('0x40')]:undefined;this[_0xd212('0x41')]=_0x2eb086[_0xd212('0x41')]?_0x2eb086[_0xd212('0x41')]:undefined;this[_0xd212('0x42')]=_0x2eb086[_0xd212('0x42')]||undefined;this[_0xd212('0x43')]=_0x2eb086['Interval']?_0x2eb086[_0xd212('0x43')]:undefined;this[_0xd212('0x44')]=_0x2eb086['dialOrderByScheduledAt']||_0xd212('0x45');this[_0xd212('0x46')]=_0x2eb086['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd212('0x47')]=_0x2eb086[_0xd212('0x47')]||undefined;this[_0xd212('0x48')]=strategy[_0x2eb086[_0xd212('0x48')]]||'rrmemory';this[_0xd212('0x49')]=!![];this[_0xd212('0x4a')]=_0x2eb086[_0xd212('0x4a')]||![];this[_0xd212('0x4b')]=_0x2eb086[_0xd212('0x4b')];this['dialAMDGreeting']=_0x2eb086[_0xd212('0x4c')];this[_0xd212('0x4d')]=_0x2eb086[_0xd212('0x4d')];this[_0xd212('0x4e')]=_0x2eb086[_0xd212('0x4e')];this[_0xd212('0x4f')]=_0x2eb086[_0xd212('0x4f')];this[_0xd212('0x50')]=_0x2eb086[_0xd212('0x50')];this[_0xd212('0x51')]=_0x2eb086[_0xd212('0x51')];this['dialAMDSilenceThreshold']=_0x2eb086['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x2eb086['dialAMDMaximumWordLength'];this[_0xd212('0x52')]=0x0;this[_0xd212('0x53')]=0x0;this[_0xd212('0x54')]=_0x2eb086['timeout'];this[_0xd212('0x55')]=0x0;this[_0xd212('0x56')]=0x0;this[_0xd212('0x57')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xd212('0x58')]=0x0;this[_0xd212('0x59')]=0x0;this[_0xd212('0x5a')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xd212('0x5b')]=0x0;this[_0xd212('0x5c')]=0x0;this[_0xd212('0x5d')]=0x0;this[_0xd212('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this[_0xd212('0x5f')]=0x0;this[_0xd212('0x60')]=undefined;this[_0xd212('0x61')]=undefined;this[_0xd212('0x62')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xd212('0x63')]=0x0;this[_0xd212('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xd212('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xd212('0x66')]=0x0;this[_0xd212('0x67')]=0x0;this[_0xd212('0x68')]=_0x2eb086[_0xd212('0x69')]||0x14;this['predictiveIntervalMinThreshold']=_0x2eb086['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xd212('0x6a')]=0x0;this[_0xd212('0x6b')]=0x0;this[_0xd212('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0xd212('0x6d')]=0x0;this[_0xd212('0x6e')]=0x0;this[_0xd212('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x2eb086[_0xd212('0x70')]||0x1e;this[_0xd212('0x71')]=_0x2eb086[_0xd212('0x71')]||![];this[_0xd212('0x72')]=_0x2eb086[_0xd212('0x72')]||undefined;this[_0xd212('0x73')]=_0x2eb086[_0xd212('0x73')]||![];this[_0xd212('0x74')]=_0x2eb086['dialAgiAfterHangupAgent']||![];this[_0xd212('0xe')]=monitorFormat[_0x2eb086[_0xd212('0xe')]]?monitorFormat[_0x2eb086['monitor_format']]:undefined;this[_0xd212('0x75')]=_0x2eb086[_0xd212('0x75')]||![];this[_0xd212('0x76')]=_0x2eb086['mandatoryDispositionPause']?_0x2eb086['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 6190aa3..bbe21fd 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 _0x73ea=['remoteUri','serverUrl','Configurations','exports','username','accessKey'];(function(_0x2b3748,_0x4f26ab){var _0x28b3f8=function(_0x56a7d8){while(--_0x56a7d8){_0x2b3748['push'](_0x2b3748['shift']());}};_0x28b3f8(++_0x4f26ab);}(_0x73ea,0xf4));var _0xa73e=function(_0x28cf02,_0x4270c3){_0x28cf02=_0x28cf02-0x0;var _0x336313=_0x73ea[_0x28cf02];return _0x336313;};'use strict';function VtigerAccount(_0x1c14e5){this['id']=_0x1c14e5['id']||0x0;this['name']=_0x1c14e5['name']||'';this['username']=_0x1c14e5[_0xa73e('0x0')]||'';this[_0xa73e('0x1')]=_0x1c14e5['accessKey']||'';this['remoteUri']=_0x1c14e5[_0xa73e('0x2')]||'';this[_0xa73e('0x3')]=_0x1c14e5[_0xa73e('0x3')]||'';this[_0xa73e('0x4')]=_0x1c14e5['Configurations']||{};}module[_0xa73e('0x5')]=VtigerAccount; \ No newline at end of file +var _0xa7d6=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5208fc,_0x1a6c43){var _0xd4373d=function(_0x5b10b8){while(--_0x5b10b8){_0x5208fc['push'](_0x5208fc['shift']());}};_0xd4373d(++_0x1a6c43);}(_0xa7d6,0x12b));var _0x6a7d=function(_0x3fab72,_0x4bb04c){_0x3fab72=_0x3fab72-0x0;var _0xe3d647=_0xa7d6[_0x3fab72];return _0xe3d647;};'use strict';function VtigerAccount(_0x41f4cc){this['id']=_0x41f4cc['id']||0x0;this[_0x6a7d('0x0')]=_0x41f4cc[_0x6a7d('0x0')]||'';this[_0x6a7d('0x1')]=_0x41f4cc[_0x6a7d('0x1')]||'';this[_0x6a7d('0x2')]=_0x41f4cc['accessKey']||'';this['remoteUri']=_0x41f4cc[_0x6a7d('0x3')]||'';this[_0x6a7d('0x4')]=_0x41f4cc[_0x6a7d('0x4')]||'';this[_0x6a7d('0x5')]=_0x41f4cc[_0x6a7d('0x5')]||{};}module[_0x6a7d('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e36e825..7e4eca2 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 _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x16034b,_0x690b58){var _0x35fa63=function(_0x1d39b3){while(--_0x1d39b3){_0x16034b['push'](_0x16034b['shift']());}};_0x35fa63(++_0x690b58);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x0b0e[_0x3a3c17];return _0xd07f21;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('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 5e8ca50..461769f 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 _0x33d2=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x1c6e9e,_0xbe09c7){var _0x5cdfb1=function(_0x37c1b4){while(--_0x37c1b4){_0x1c6e9e['push'](_0x1c6e9e['shift']());}};_0x5cdfb1(++_0xbe09c7);}(_0x33d2,0x7f));var _0x233d=function(_0x593683,_0x2b3213){_0x593683=_0x593683-0x0;var _0x44cc39=_0x33d2[_0x593683];return _0x44cc39;};'use strict';function ZohoAccount(_0x328953){this['id']=_0x328953['id']||0x0;this[_0x233d('0x0')]=_0x328953[_0x233d('0x0')]||'';this['description']=_0x328953[_0x233d('0x1')]||'';this[_0x233d('0x2')]=_0x328953['host']||'';this[_0x233d('0x3')]=_0x328953[_0x233d('0x3')]||'';this[_0x233d('0x4')]=_0x328953[_0x233d('0x4')]||'';this[_0x233d('0x5')]=_0x328953[_0x233d('0x5')]||'';this[_0x233d('0x6')]=_0x328953[_0x233d('0x6')]||'';this['code']=_0x328953[_0x233d('0x7')]||'';this['refreshToken']=_0x328953[_0x233d('0x8')]||'';this[_0x233d('0x9')]=_0x328953[_0x233d('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x186d=['host','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x34fd3c,_0x50abef){var _0x44083=function(_0x380aa1){while(--_0x380aa1){_0x34fd3c['push'](_0x34fd3c['shift']());}};_0x44083(++_0x50abef);}(_0x186d,0x1ca));var _0xd186=function(_0xc9cd47,_0x35a546){_0xc9cd47=_0xc9cd47-0x0;var _0x26827e=_0x186d[_0xc9cd47];return _0x26827e;};'use strict';function ZohoAccount(_0x214549){this['id']=_0x214549['id']||0x0;this[_0xd186('0x0')]=_0x214549[_0xd186('0x0')]||'';this[_0xd186('0x1')]=_0x214549[_0xd186('0x1')]||'';this[_0xd186('0x2')]=_0x214549[_0xd186('0x2')]||'';this['zone']=_0x214549[_0xd186('0x3')]||'';this[_0xd186('0x4')]=_0x214549[_0xd186('0x4')]||'';this['clientSecret']=_0x214549['clientSecret']||'';this[_0xd186('0x5')]=_0x214549[_0xd186('0x5')]||'';this[_0xd186('0x6')]=_0x214549['code']||'';this[_0xd186('0x7')]=_0x214549[_0xd186('0x7')]||'';this[_0xd186('0x8')]=_0x214549['Configurations']||{};}module[_0xd186('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 54f8949..44418c8 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 _0x9f67=['util','lodash','moment','string','isNil','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','number'];(function(_0x43bb06,_0x2f904d){var _0xd1c829=function(_0x1fec8a){while(--_0x1fec8a){_0x43bb06['push'](_0x43bb06['shift']());}};_0xd1c829(++_0x2f904d);}(_0x9f67,0x19a));var _0x79f6=function(_0x550be7,_0x58d911){_0x550be7=_0x550be7-0x0;var _0x1d0b08=_0x9f67[_0x550be7];return _0x1d0b08;};'use strict';var util=require(_0x79f6('0x0'));var _=require(_0x79f6('0x1'));var moment=require(_0x79f6('0x2'));function checkNameSurname(_0x39992f,_0x5d2638,_0x5a07ba){var _0x4f4cd6='';if(!_['isNil'](_0x5d2638)&&_0x79f6('0x3')===typeof _0x5d2638){_0x4f4cd6+=_0x5d2638;}if(!_[_0x79f6('0x4')](_0x5a07ba)&&_0x79f6('0x3')===typeof _0x5a07ba){_0x4f4cd6+='\x20'+_0x5a07ba;}if(_0x4f4cd6!==''){return _0x4f4cd6;}return _0x39992f;}function Action(_0x3eaafe,_0x502cc7,_0x534cba,_0x2eb854,_0x66d93){this['uniqueid']=_0x534cba||undefined;this[_0x79f6('0x5')]=_0x3eaafe['id'];this['queue']=_0x502cc7[_0x79f6('0x6')];this[_0x79f6('0x7')]=_0x502cc7[_0x79f6('0x7')];this[_0x79f6('0x8')]=_0x79f6('0x9');this[_0x79f6('0xa')]=![];this[_0x79f6('0xb')]=_[_0x79f6('0x4')](_0x3eaafe[_0x79f6('0xc')])?undefined:_0x3eaafe[_0x79f6('0xc')]['name'];this[_0x79f6('0xd')]=this[_0x79f6('0xb')]?util[_0x79f6('0xe')]('SIP/%s',this['membername']):_0x2eb854||undefined;this[_0x79f6('0xf')]=checkNameSurname(_0x3eaafe[_0x79f6('0x10')][_0x79f6('0x11')],_0x3eaafe[_0x79f6('0x10')]['firstName'],_0x3eaafe[_0x79f6('0x10')][_0x79f6('0x12')]);this[_0x79f6('0x13')]=_0x3eaafe[_0x79f6('0x13')]||![];this[_0x79f6('0x14')]=_0x3eaafe['Contact'][_0x79f6('0x11')];this['scheduledat']=_0x3eaafe['scheduledat'];this[_0x79f6('0x15')]=_0x3eaafe[_0x79f6('0x15')]||0x0;this[_0x79f6('0x16')]=_0x3eaafe[_0x79f6('0x16')]||0x0;this['countnoanswerretry']=_0x3eaafe[_0x79f6('0x17')]||0x0;this[_0x79f6('0x18')]=(_0x3eaafe['countbusyretry']||0x0)+(_0x3eaafe[_0x79f6('0x16')]||0x0)+(_0x3eaafe[_0x79f6('0x17')]||0x0)+(_0x3eaafe[_0x79f6('0x19')]||0x0)+(_0x3eaafe[_0x79f6('0x1a')]||0x0)+(_0x3eaafe[_0x79f6('0x1b')]||0x0)+(_0x3eaafe[_0x79f6('0x1c')]||0x0)+(_0x3eaafe[_0x79f6('0x1d')]||0x0);this['countnosuchnumberretry']=_0x3eaafe[_0x79f6('0x19')]||0x0;this[_0x79f6('0x1a')]=_0x3eaafe[_0x79f6('0x1a')]||0x0;this['countabandonedretry']=_0x3eaafe[_0x79f6('0x1b')]||0x0;this['countmachineretry']=_0x3eaafe[_0x79f6('0x1c')]||0x0;this['countagentrejectretry']=_0x3eaafe[_0x79f6('0x1d')]||0x0;this[_0x79f6('0x1e')]=_0x3eaafe[_0x79f6('0x1e')];this[_0x79f6('0x1f')]=_0x3eaafe[_0x79f6('0x1f')];this[_0x79f6('0x20')]=_0x3eaafe[_0x79f6('0x20')];this[_0x79f6('0x21')]=_0x3eaafe['recallme'];this[_0x79f6('0x22')]=_0x3eaafe[_0x79f6('0x22')];this[_0x79f6('0x23')]=_0x3eaafe[_0x79f6('0x23')];this[_0x79f6('0x24')]=_['isNil'](_0x3eaafe[_0x79f6('0xc')])?_0x3eaafe[_0x79f6('0x24')]:_0x3eaafe[_0x79f6('0xc')]['id'];this[_0x79f6('0x25')]=_0x3eaafe['VoiceQueueId'];this[_0x79f6('0x26')]='';this[_0x79f6('0x27')]='';}Action['prototype']['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x79f6('0x28')]);};module['exports']=Action; \ No newline at end of file +var _0x2f00=['countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','isNil','string','uniqueid','idContact','type','queue','dialAnswer','membername','Agent','name','format','SIP/%s','Contact','firstName','active','countbusyretry','countcongestionretry','countglobal','countnoanswerretry'];(function(_0x4e8e08,_0x5b75a8){var _0x5460bc=function(_0x435d52){while(--_0x435d52){_0x4e8e08['push'](_0x4e8e08['shift']());}};_0x5460bc(++_0x5b75a8);}(_0x2f00,0x154));var _0x02f0=function(_0x3b4df6,_0x5b7340){_0x3b4df6=_0x3b4df6-0x0;var _0x38fe10=_0x2f00[_0x3b4df6];return _0x38fe10;};'use strict';var util=require(_0x02f0('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x470747,_0x28a5df,_0x532500){var _0x36a662='';if(!_[_0x02f0('0x1')](_0x28a5df)&&'string'===typeof _0x28a5df){_0x36a662+=_0x28a5df;}if(!_['isNil'](_0x532500)&&_0x02f0('0x2')===typeof _0x532500){_0x36a662+='\x20'+_0x532500;}if(_0x36a662!==''){return _0x36a662;}return _0x470747;}function Action(_0x53e2ca,_0x28e6e4,_0x9486dc,_0x304f14,_0x4a72fe){this[_0x02f0('0x3')]=_0x9486dc||undefined;this[_0x02f0('0x4')]=_0x53e2ca['id'];this['queue']=_0x28e6e4['name'];this[_0x02f0('0x5')]=_0x28e6e4[_0x02f0('0x5')];this['campaigntype']=_0x02f0('0x6');this[_0x02f0('0x7')]=![];this[_0x02f0('0x8')]=_[_0x02f0('0x1')](_0x53e2ca[_0x02f0('0x9')])?undefined:_0x53e2ca[_0x02f0('0x9')][_0x02f0('0xa')];this['channelAgent']=this[_0x02f0('0x8')]?util[_0x02f0('0xb')](_0x02f0('0xc'),this['membername']):_0x304f14||undefined;this['calleridname']=checkNameSurname(_0x53e2ca[_0x02f0('0xd')]['phone'],_0x53e2ca[_0x02f0('0xd')][_0x02f0('0xe')],_0x53e2ca[_0x02f0('0xd')]['lastName']);this[_0x02f0('0xf')]=_0x53e2ca[_0x02f0('0xf')]||![];this['calleridnum']=_0x53e2ca['Contact']['phone'];this['scheduledat']=_0x53e2ca['scheduledat'];this[_0x02f0('0x10')]=_0x53e2ca[_0x02f0('0x10')]||0x0;this[_0x02f0('0x11')]=_0x53e2ca[_0x02f0('0x11')]||0x0;this['countnoanswerretry']=_0x53e2ca['countnoanswerretry']||0x0;this[_0x02f0('0x12')]=(_0x53e2ca[_0x02f0('0x10')]||0x0)+(_0x53e2ca[_0x02f0('0x11')]||0x0)+(_0x53e2ca[_0x02f0('0x13')]||0x0)+(_0x53e2ca[_0x02f0('0x14')]||0x0)+(_0x53e2ca['countdropretry']||0x0)+(_0x53e2ca['countabandonedretry']||0x0)+(_0x53e2ca[_0x02f0('0x15')]||0x0)+(_0x53e2ca['countagentrejectretry']||0x0);this[_0x02f0('0x14')]=_0x53e2ca['countnosuchnumberretry']||0x0;this[_0x02f0('0x16')]=_0x53e2ca[_0x02f0('0x16')]||0x0;this['countabandonedretry']=_0x53e2ca[_0x02f0('0x17')]||0x0;this['countmachineretry']=_0x53e2ca['countmachineretry']||0x0;this[_0x02f0('0x18')]=_0x53e2ca['countagentrejectretry']||0x0;this[_0x02f0('0x19')]=_0x53e2ca[_0x02f0('0x19')];this[_0x02f0('0x1a')]=_0x53e2ca[_0x02f0('0x1a')];this[_0x02f0('0x1b')]=_0x53e2ca[_0x02f0('0x1b')];this['recallme']=_0x53e2ca['recallme'];this[_0x02f0('0x1c')]=_0x53e2ca[_0x02f0('0x1c')];this[_0x02f0('0x1d')]=_0x53e2ca[_0x02f0('0x1d')];this[_0x02f0('0x1e')]=_[_0x02f0('0x1')](_0x53e2ca[_0x02f0('0x9')])?_0x53e2ca[_0x02f0('0x1e')]:_0x53e2ca[_0x02f0('0x9')]['id'];this[_0x02f0('0x1f')]=_0x53e2ca[_0x02f0('0x1f')];this[_0x02f0('0x20')]='';this[_0x02f0('0x21')]='';}Action[_0x02f0('0x22')][_0x02f0('0x23')]=function(){return util[_0x02f0('0xb')](_0x02f0('0x24'),this[_0x02f0('0x25')],this[_0x02f0('0x26')]);};module[_0x02f0('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1f0ab0c..618ac7d 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','BUSY','outboundBusyCallsDay','countglobal','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','responsetime','isFailure','response','idContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','dialstatus','variables','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','hanguprequest','syncDialEnd','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','pTalking','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','originated','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','logger2','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]'];(function(_0x5ac2ff,_0xc342de){var _0x152512=function(_0x416a85){while(--_0x416a85){_0x5ac2ff['push'](_0x5ac2ff['shift']());}};_0x152512(++_0xc342de);}(_0xe706,0xa3));var _0x6e70=function(_0x625a73,_0x50ae08){_0x625a73=_0x625a73-0x0;var _0x3eceb5=_0xe706[_0x625a73];return _0x3eceb5;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var uuid=require('uuid');var moment=require(_0x6e70('0x3'));var md5=require(_0x6e70('0x4'));var Redis=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var loggerAction=require(_0x6e70('0x7'))(_0x6e70('0x9'));var ami=require(_0x6e70('0xa'));var rpcDb=require(_0x6e70('0xb'));var Action=require(_0x6e70('0xc'));var ut=require(_0x6e70('0xd'));config[_0x6e70('0xe')]=_[_0x6e70('0xf')](config[_0x6e70('0xe')],{'host':_0x6e70('0x10'),'port':0x18eb});var io=require(_0x6e70('0x11'))(new Redis(config[_0x6e70('0xe')]));var Sequence=function(){};Sequence[_0x6e70('0x12')][_0x6e70('0x13')]=function(_0x743eb5){this[_0x6e70('0x14')]=this[_0x6e70('0x14')]?this[_0x6e70('0x14')]['finally'](_0x743eb5):_0x743eb5();};function Preview(_0x47f6b2){this[_0x6e70('0x15')]=new Sequence();this[_0x6e70('0x16')]=_0x47f6b2[_0x6e70('0x17')];this[_0x6e70('0x18')]=_0x47f6b2[_0x6e70('0x18')];this[_0x6e70('0x19')]={};this[_0x6e70('0x1a')]=_0x47f6b2[_0x6e70('0x1a')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x6e70('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1c'),this['syncHangupRequest'][_0x6e70('0x1b')](this));ami['on']('dialend',this[_0x6e70('0x1d')][_0x6e70('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0x6e70('0x1b')](this));ami['on']('varset',this[_0x6e70('0x1e')][_0x6e70('0x1b')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1f'),this[_0x6e70('0x20')][_0x6e70('0x1b')](this));this[_0x6e70('0x21')](this[_0x6e70('0x16')]);}function emit(_0x1b2453,_0x44a49f,_0x29326f){io['to'](_0x1b2453)[_0x6e70('0x22')](_0x44a49f,_0x29326f);}function emitCampaignPreview(_0x4a0cfe){if(_0x4a0cfe[_0x6e70('0x23')]===_0x6e70('0x24')){var _0x27b294={'id':_0x4a0cfe['id'],'name':_0x4a0cfe['name'],'strategy':_0x4a0cfe[_0x6e70('0x25')],'answered':_0x4a0cfe[_0x6e70('0x26')],'available':_0x4a0cfe[_0x6e70('0x27')],'loggedIn':_0x4a0cfe['loggedIn'],'pTalking':_0x4a0cfe[_0x6e70('0x28')],'sumBillable':_0x4a0cfe['sumBillable'],'sumDuration':_0x4a0cfe['sumDuration'],'sumHoldTime':_0x4a0cfe['sumHoldTime']||0x0,'talking':_0x4a0cfe[_0x6e70('0x29')],'total':_0x4a0cfe[_0x6e70('0x2a')],'type':_0x4a0cfe['type'],'unmanaged':_0x4a0cfe[_0x6e70('0x2b')],'abandoned':_0x4a0cfe[_0x6e70('0x2c')],'waiting':_0x4a0cfe['waiting'],'loggedInDb':_0x4a0cfe[_0x6e70('0x2d')],'dialActive':_0x4a0cfe[_0x6e70('0x2e')],'dialMethod':_0x4a0cfe[_0x6e70('0x2f')],'dialOriginateCallerIdName':_0x4a0cfe['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4a0cfe['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4a0cfe[_0x6e70('0x30')],'dialPrefix':_0x4a0cfe[_0x6e70('0x31')],'outboundAnswerAgiCallsDay':_0x4a0cfe[_0x6e70('0x32')],'outboundAnswerCallsDay':_0x4a0cfe[_0x6e70('0x33')],'outboundBlacklistCallsDay':_0x4a0cfe[_0x6e70('0x34')],'outboundBusyCallsDay':_0x4a0cfe['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4a0cfe[_0x6e70('0x35')],'outboundDropCallsDayACS':_0x4a0cfe[_0x6e70('0x36')],'outboundDropCallsDayCallersExit':_0x4a0cfe[_0x6e70('0x37')],'outboundDropCallsDayTimeout':_0x4a0cfe[_0x6e70('0x38')],'outboundNoAnswerCallsDay':_0x4a0cfe[_0x6e70('0x39')],'outboundNoSuchCallsDay':_0x4a0cfe[_0x6e70('0x3a')],'outboundOriginateFailureCallsDay':_0x4a0cfe[_0x6e70('0x3b')],'outboundReCallsDay':_0x4a0cfe[_0x6e70('0x3c')],'outboundRejectCallsDay':_0x4a0cfe[_0x6e70('0x3d')],'outboundUnknownCallsDay':_0x4a0cfe[_0x6e70('0x3e')],'outboundAbandonedCallsDay':_0x4a0cfe['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4a0cfe[_0x6e70('0x3f')],'predictiveIntervalAvgHoldtime':_0x4a0cfe['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4a0cfe[_0x6e70('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x4a0cfe['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4a0cfe[_0x6e70('0x41')],'predictiveIntervalErlangCalls':_0x4a0cfe[_0x6e70('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a0cfe[_0x6e70('0x43')],'predictiveIntervalHitRate':_0x4a0cfe['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4a0cfe[_0x6e70('0x44')],'predictiveIntervalPauses':_0x4a0cfe[_0x6e70('0x45')],'predictiveIntervalAvailable':_0x4a0cfe['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4a0cfe[_0x6e70('0x46')],'message':_0x4a0cfe[_0x6e70('0x47')],'originated':_0x4a0cfe['originated'],'erlangCalls':_0x4a0cfe[_0x6e70('0x48')],'erlangCallToSecond':_0x4a0cfe[_0x6e70('0x49')],'erlangAbandonmentRate':_0x4a0cfe[_0x6e70('0x4a')],'erlangBusyFactor':_0x4a0cfe[_0x6e70('0x4b')],'startPredictive':_0x4a0cfe[_0x6e70('0x4c')],'startProgressive':_0x4a0cfe[_0x6e70('0x4d')]};if(_0x4a0cfe[_0x6e70('0x4e')]){_0x27b294[_0x6e70('0x4e')]={'id':_0x4a0cfe[_0x6e70('0x4e')]['id'],'name':_0x4a0cfe[_0x6e70('0x4e')]['name'],'active':_0x4a0cfe[_0x6e70('0x4e')]['active'],'callerid':_0x4a0cfe[_0x6e70('0x4e')][_0x6e70('0x4f')]};}if(_0x4a0cfe[_0x6e70('0x50')]){_0x27b294[_0x6e70('0x50')]={'id':_0x4a0cfe[_0x6e70('0x50')]['id'],'name':_0x4a0cfe[_0x6e70('0x50')][_0x6e70('0x51')]};}var _0xdd0bee=md5(JSON[_0x6e70('0x52')](_0x27b294));if(_0x4a0cfe[_0x6e70('0x4')]!==_0xdd0bee){_0x4a0cfe[_0x6e70('0x4')]=_0xdd0bee;emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x27b294['name']),'voice_queue:save',_0x27b294);}}}function emitVoiceQueueChannelRemove(_0x5424eb){logger[_0x6e70('0x55')](_0x6e70('0x56'),JSON[_0x6e70('0x52')](_0x5424eb));emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x5424eb[_0x6e70('0x51')]),'voice_queue_channel:remove',_0x5424eb);}function notSendMessagesQueue(_0x3b508c){if(_0x3b508c[_0x6e70('0x57')]){if(_0x3b508c[_0x6e70('0x58')]===0x0&&_0x3b508c[_0x6e70('0x28')]===0x0){_0x3b508c[_0x6e70('0x57')]=![];_0x3b508c[_0x6e70('0x27')]=0x0;_0x3b508c[_0x6e70('0x59')]=0x0;_0x3b508c[_0x6e70('0x47')]='NOT_ACTIVE';ut[_0x6e70('0x5a')](_0x6e70('0x5b'),_0x3b508c[_0x6e70('0x51')]+_0x6e70('0x5c'));}else{_0x3b508c[_0x6e70('0x47')]=_0x6e70('0x5d');ut[_0x6e70('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3b508c['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x3b508c);}}Preview[_0x6e70('0x12')][_0x6e70('0x21')]=function(){var _0x83847b=this;setInterval(function(){_0x83847b[_0x6e70('0x5e')]();},0x7cf);};Preview[_0x6e70('0x12')]['syncCampaigns']=function(){var _0x225d44=this[_0x6e70('0x16')];this[_0x6e70('0x5f')]+=0x1;for(var _0x52b197 in _0x225d44){if(_0x225d44['hasOwnProperty'](_0x52b197)&&(_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x8')||_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x60'))&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(this[_0x6e70('0x5f')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6e70('0x61')]();}}if(_0x225d44['hasOwnProperty'](_0x52b197)&&_0x225d44[_0x52b197][_0x6e70('0x2f')]===_0x6e70('0x8')&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(_0x225d44[_0x52b197]['dialActive']){this[_0x6e70('0x62')](_0x225d44[_0x52b197]);this[_0x6e70('0x63')](_0x225d44[_0x52b197]);}else{notSendMessagesQueue(_0x225d44[_0x52b197]);}}}};Preview[_0x6e70('0x12')][_0x6e70('0x64')]=function(_0x8f243d){var _0x3fcb2d=this;this[_0x6e70('0x15')]['enqueue'](function(){if(!_[_0x6e70('0x65')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d])){loggerAction[_0x6e70('0x55')](_0x6e70('0x66'),_0x8f243d,_0x6e70('0x67'),_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')],'originated:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d['campaignsPreview'][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]]['originated']),'pTalking:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']]['pTalking']),JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x69')]),JSON[_0x6e70('0x52')](_[_0x6e70('0x6a')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d],['contactId',_0x6e70('0x6b'),_0x6e70('0x6c'),_0x6e70('0x6d')])));return ami[_0x6e70('0x6e')]({'action':_0x6e70('0x6f'),'channel':_0x3fcb2d['actions'][_0x8f243d]['channel']})[_0x6e70('0x70')](function(_0x2e3ea6){if(_0x2e3ea6[_0x6e70('0x47')]===_0x6e70('0x71')){setTimeout(function(){if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]){ut['updateOriginated'](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['dialAnswer']===!![]){ut[_0x6e70('0x73')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));ut[_0x6e70('0x74')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]);}ut['loggerError'](_0x6e70('0x75')+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']);delete _0x3fcb2d[_0x6e70('0x19')][_0x8f243d];}},0x2328);}});}});};Preview[_0x6e70('0x12')][_0x6e70('0x61')]=function(){var _0x46d536=this;loggerAction[_0x6e70('0x55')]('[action]',_[_0x6e70('0x76')](this[_0x6e70('0x19')]));for(var _0x10d655 in this[_0x6e70('0x19')]){if(_0x46d536[_0x6e70('0x19')][_0x6e70('0x77')](_0x10d655)){_0x46d536[_0x6e70('0x64')](_0x10d655);}}};Preview[_0x6e70('0x12')][_0x6e70('0x63')]=function(_0x344676){var _0x13dd17=this;rpcDb[_0x6e70('0x78')](_0x344676['id'],ut[_0x6e70('0x79')](this[_0x6e70('0x1a')]))[_0x6e70('0x7a')](function(_0x2240a1){if(!_[_0x6e70('0x65')](_0x2240a1)){for(var _0x4329a6=0x0;_0x4329a6<_0x2240a1[_0x6e70('0x7b')];_0x4329a6+=0x1){if(ut[_0x6e70('0x7c')](_0x2240a1[_0x4329a6]['scheduledat'])<_0x344676[_0x6e70('0x7d')]*0x3c){if(_0x2240a1[_0x4329a6][_0x6e70('0x7e')]&&!_0x2240a1[_0x4329a6][_0x6e70('0x7e')][_0x6e70('0x7f')]){_0x13dd17[_0x6e70('0x80')](_0x2240a1[_0x4329a6]['id'])[_0x6e70('0x7a')](ut['logger2'](_0x6e70('0x81')))[_0x6e70('0x70')](ut['logger2'](_0x6e70('0x81')));}else{rpcDb[_0x6e70('0x82')](_0x2240a1[_0x4329a6]['id']);}}else{var _0x459a30=new Action(_0x2240a1[_0x4329a6],_0x344676);_0x459a30['starttime']=moment()['format'](_0x6e70('0x83'));_0x344676[_0x6e70('0x3c')]+=0x1;ut[_0x6e70('0x84')](_0x459a30,0x17,_0x6e70('0x85'));if(_0x344676[_0x6e70('0x86')]){rpcDb[_0x6e70('0x87')](ut[_0x6e70('0x88')](_0x2240a1[_0x4329a6]));rpcDb['createCustomerHistory'](_0x459a30,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6e70('0x84')](_0x459a30,0x16,_0x6e70('0x89'));rpcDb[_0x6e70('0x8a')](_0x459a30,_0x6e70('0x8b'));rpcDb['createCustomerFinal'](_0x459a30,'[HistoryRecallClose]');}}}}})[_0x6e70('0x70')](ut[_0x6e70('0x8c')]('[getContactRecallMe]'));};Preview['prototype'][_0x6e70('0x62')]=function(_0x47fbed){_0x47fbed[_0x6e70('0x57')]=!![];if(ut[_0x6e70('0x8d')](_0x47fbed[_0x6e70('0x8e')])){_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x8f');}else if(!ut[_0x6e70('0x90')](_0x47fbed[_0x6e70('0x2e')])){_0x47fbed[_0x6e70('0x47')]='NOT_ACTIVE';}else if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x4e')])){if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x92')])){_0x47fbed[_0x6e70('0x47')]='TRUNK_IS_NOT_REACHABLE';}else{_0x47fbed['message']='ACTIVE';}}else{_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x93');}emitCampaignPreview(_0x47fbed);};Preview[_0x6e70('0x12')]['callProgressDetectingCustomer']=function(_0x58cf1c,_0x2fc2a2,_0x3dae08){var _0x3c2830=this;var _0x195166=this[_0x6e70('0x19')][_0x2fc2a2];var _0x32b884=this['campaignsPreview'][_0x195166[_0x6e70('0x68')]];var _0x3f5896;if(_0x32b884){switch(_0x3dae08){case'1':_0x32b884[_0x6e70('0x3a')]+=0x1;_0x195166[_0x6e70('0x94')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x0,'NoSuchNumber');ami[_0x6e70('0x22')](_0x6e70('0x96'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0x98')));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0x99'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0x9e'));}else{if(_0x195166[_0x6e70('0x94')]>=_0x32b884[_0x6e70('0x9f')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0x9e'));}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0x94'),_0x32b884[_0x6e70('0xa1')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xa4'):var _0x25e685=moment()[_0x6e70('0x53')](_0x6e70('0x83'));_0x195166['responsetime']=_0x25e685;_0x195166['answertime']=_0x25e685;_0x195166[_0x6e70('0x69')]=!![];_0x32b884[_0x6e70('0x28')]+=0x1;logger['info'](_0x6e70('0xa5'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);ami[_0x6e70('0x22')](_0x6e70('0xa9'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0xaa'),this[_0x6e70('0x16')][_0x195166[_0x6e70('0x68')]]));if(_0x32b884[_0x6e70('0xab')]){ami[_0x6e70('0x22')]('custom:agentConnectPreview',ut['buildAcw'](_0x195166));}break;case'16':ami[_0x6e70('0x22')]('custom:agentcomplete',ut[_0x6e70('0x97')](_0x195166,'complete',this['campaignsPreview'][_0x195166[_0x6e70('0x68')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x195166,'complete'));_0x32b884[_0x6e70('0x33')]+=0x1;_0x32b884[_0x6e70('0x2a')]+=0x1;_0x32b884[_0x6e70('0x26')]+=0x1;ut['decrementTalkink'](_0x32b884,'[16]');_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xad'));rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xae'));rpcDb[_0x6e70('0xaf')](_0x195166);_0x32b884[_0x6e70('0xb0')]+=_0x195166['talktime'];_0x32b884[_0x6e70('0xb1')]+=_0x195166[_0x6e70('0xb2')];logger[_0x6e70('0x55')]('[syncHangup][talking][decrement]',_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xb3'):_0x32b884[_0x6e70('0xb4')]+=0x1;_0x195166['countbusyretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x5,_0x6e70('0xb6'));ami[_0x6e70('0x22')]('custom:agentbusy',ut['buildObj'](_0x195166,_0x6e70('0xb7')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xb8'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xb9'));}else{if(_0x195166[_0x6e70('0xba')]>=_0x32b884[_0x6e70('0xbb')]){rpcDb['createCustomerFinal'](_0x195166,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0xba'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case'NOANSWER':_0x32b884[_0x6e70('0x39')]+=0x1;_0x195166['countnoanswerretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x3,_0x6e70('0xbe'));ami[_0x6e70('0x22')](_0x6e70('0xbf'),ut[_0x6e70('0x97')](_0x195166,'noanswer'));rpcDb[_0x6e70('0x8a')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884['dialGlobalMaxRetry']){_0x3f5896=ut['cloneAction'](_0x195166,0xf,'Global');rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xc0'));}else{if(_0x195166[_0x6e70('0xc1')]>=_0x32b884[_0x6e70('0xc2')]){rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countnoanswerretry',_0x32b884[_0x6e70('0xc4')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case'CONGESTION':_0x32b884['outboundCongestionCallsDay']+=0x1;_0x195166[_0x6e70('0xc5')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x8,_0x6e70('0xc6'));ami[_0x6e70('0x22')](_0x6e70('0xc7'),ut['buildObj'](_0x195166,_0x6e70('0xc8')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xc9'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xca'));}else{if(_0x195166['countcongestionretry']>=_0x32b884[_0x6e70('0xcb')]){rpcDb['createCustomerFinal'](_0x195166,_0x6e70('0xc9'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xc5'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xcc'):_0x32b884[_0x6e70('0x3d')]+=0x1;_0x195166[_0x6e70('0xcd')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x14,_0x6e70('0xce'));ami[_0x6e70('0x22')](_0x6e70('0xcf'),ut['buildObj'](_0x195166,'agentreject'));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xd0'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0x14,_0x6e70('0xce'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xd1'));}else{if(_0x195166[_0x6e70('0xcd')]>=_0x32b884[_0x6e70('0xd2')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd1'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xcd'),_0x32b884[_0x6e70('0xd3')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xd4'):_0x32b884[_0x6e70('0xd5')]+=0x1;_0x195166[_0x6e70('0xd6')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0xb,'Abandoned');rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xd7'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x195166[_0x6e70('0xd8')]>=_0x32b884['dialAbandonedMaxRety']){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd7'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countabandonedretry',_0x32b884[_0x6e70('0xd9')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}break;default:if(_0x195166[_0x6e70('0x69')]){ut['decrementTalkink'](_0x32b884,_0x6e70('0xda'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x32b884[_0x6e70('0x51')],_0x58cf1c);}_0x32b884[_0x6e70('0x3e')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut['totalGlobal'](_0x195166);ut[_0x6e70('0x84')](_0x195166,0xc,_0x58cf1c[_0x6e70('0xdb')]||_0x58cf1c['dialstatus']);rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xdc'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xdd'));}else{rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];}if(!(_0x195166['dialAnswer']&&_0x3dae08==='16')){ut[_0x6e70('0xde')](_0x32b884,_0x6e70('0xdf'));logger['info'](_0x6e70('0xe0'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884['name'],_0x6e70('0xe1'),_0x32b884[_0x6e70('0x58')]);}if(_0x3dae08!==_0x6e70('0xa4')){delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xe2')]];}}};Preview[_0x6e70('0x12')][_0x6e70('0xe3')]=function(_0x33a93c,_0x273ed6,_0x41b70a){if(_[_0x6e70('0xe4')](_0x273ed6)&&'object'!==typeof _0x273ed6){return;}if(_[_0x6e70('0xe4')](_0x41b70a)&&_0x6e70('0xe5')!==typeof _0x41b70a){return;}switch(_0x41b70a[_0x6e70('0xe6')]){case'0':ut[_0x6e70('0xe7')](_0x33a93c,0x0,_0x6e70('0xe8'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xe9'));break;case'3':ut[_0x6e70('0xe7')](_0x33a93c,0x3,_0x6e70('0xbe'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xea'));break;case'5':ut['logAgent'](_0x33a93c,0x5,'Busy');rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xec'));break;case'8':ut[_0x6e70('0xe7')](_0x33a93c,0x8,_0x6e70('0xc6'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xed'));break;case'22':ut[_0x6e70('0xe7')](_0x33a93c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x33a93c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x6e70('0xe7')](_0x33a93c,0xc,_0x41b70a[_0x6e70('0xe6')]);rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xed'));}ut[_0x6e70('0xde')](_0x273ed6,_0x6e70('0xee'));logger[_0x6e70('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x33a93c[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x273ed6[_0x6e70('0x51')],_0x6e70('0xe1'),_0x273ed6[_0x6e70('0x58')]);delete this[_0x6e70('0x19')][_0x33a93c[_0x6e70('0xa6')]];};Preview[_0x6e70('0x12')][_0x6e70('0xef')]=function(_0x541c25,_0x1a2a44,_0x321da8,_0x5b4a66,_0x2a1205){var _0x1f1b96=this;return new BPromise(function(_0x397289,_0x551c7e){if(_[_0x6e70('0x65')](_0x1a2a44)||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')])||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')][_0x6e70('0xf1')])||_['isNil'](_0x1a2a44['VoiceQueueId'])){_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0xf2'),_0x5b4a66,_0x2a1205));return;}var _0xc93d60=uuid['v4']();var _0x432794=_0x1f1b96[_0x6e70('0x16')][_0x1a2a44[_0x6e70('0x67')]['name']];var _0x3df7bd=_0x321da8?_0x1f1b96[_0x6e70('0x1a')][_0x321da8]['id']:undefined;_0x1f1b96[_0x6e70('0x19')][_0xc93d60]=new Action(_0x1a2a44,_0x432794,_0xc93d60,_0x321da8,_0x3df7bd);var _0x154697=_0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x154697[_0x6e70('0xa2')]=_0x5b4a66;_0x154697[_0x6e70('0xbd')]=_0x2a1205;_0x154697[_0x6e70('0xf3')]=_0x321da8;if(_[_0x6e70('0xf4')](_0x541c25)){_0x1f1b96[_0x6e70('0xf5')](_0x154697,_0x432794,_0x1a2a44,_0x321da8)[_0x6e70('0x7a')](function(_0x8b237a){logger[_0x6e70('0x55')](_0x6e70('0xf6'),_0x6e70('0xf7')+_0x154697[_0x6e70('0x68')]+_0x6e70('0xf8')+_0x154697['idContact'],JSON['stringify'](_0x8b237a));ami[_0x6e70('0x22')](_0x6e70('0xf9'),ut[_0x6e70('0x97')](_0x154697,_0x6e70('0xfa'),_0x1f1b96[_0x6e70('0x16')][_0x154697[_0x6e70('0x68')]]));_0x397289(ut['message'](_0x6e70('0xfb')));})['catch'](function(_0x2f05b2){ut['logger'](_0x6e70('0xfc'),_0x2f05b2);_0x551c7e(ut['message'](_0x6e70('0xfd'),_0x5b4a66,_0x2a1205));});}else{_0x432794[_0x6e70('0x34')]+=0x1;ut[_0x6e70('0xfe')](_0x154697);rpcDb['createHistory'](_0x154697,_0x6e70('0xff'));delete _0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0x100'),_0x5b4a66,_0x2a1205));}});};Preview[_0x6e70('0x12')][_0x6e70('0x91')]=function(_0x1e8bfd){return!_['isNil'](_0x1e8bfd)&&!_[_0x6e70('0x65')](_0x1e8bfd[_0x6e70('0x51')])&&!_['isNil'](_0x1e8bfd[_0x6e70('0x101')])&&_0x1e8bfd[_0x6e70('0x101')]&&!_['isNil'](this['trunks'][util[_0x6e70('0x53')]('SIP/%s',_0x1e8bfd[_0x6e70('0x51')])])&&!_[_0x6e70('0x65')](this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')])&&(this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x103')||this['trunks'][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x104'));};Preview[_0x6e70('0x12')][_0x6e70('0x80')]=function(_0xac161,_0x44ebd6){var _0x568799=this;return new BPromise(function(_0x4bdcc,_0xa512d1){_0x568799[_0x6e70('0x105')](_0xac161,_0x44ebd6)['then'](function(_0x88522){_0x4bdcc(_[_0x6e70('0x6a')](_0x88522,[_0x6e70('0x47')]));})[_0x6e70('0x70')](function(_0x4af0bc){if(_0x4af0bc['unlock']){rpcDb[_0x6e70('0x106')](_0xac161);}if(_0x4af0bc['active']){rpcDb['disableContact'](_0xac161);}_0xa512d1(_[_0x6e70('0x6a')](_0x4af0bc,[_0x6e70('0x47')]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x105')]=function(_0x3bc12b,_0x22827){var _0xf7e813=this;return new BPromise(function(_0x3fef9d,_0x20fe70){var _0x41df1b,_0x484806;rpcDb[_0x6e70('0x107')](_0x3bc12b)[_0x6e70('0x7a')](function(_0xad1b46){if(!_[_0x6e70('0x65')](_0xad1b46[0x0])){_0x484806=_0xad1b46[0x0][_0x6e70('0x108')]?![]:!![];_0x41df1b=_0xad1b46[0x0][_0x6e70('0x108')]?!![]:![];_0x41df1b=_0x22827?!![]:_0x41df1b;}var _0x2033fa=_0xf7e813[_0x6e70('0x109')](_0xad1b46);if(_0x2033fa[_0x6e70('0x10a')]){rpcDb[_0x6e70('0x10b')](_['pick'](_0xad1b46[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x2198fa){_0xf7e813[_0x6e70('0xef')](_0x2198fa,_0xad1b46[0x0],_0x22827,_0x484806,_0x41df1b)[_0x6e70('0x7a')](function(_0x596bbd){_0x3fef9d(_0x596bbd);})[_0x6e70('0x70')](function(_0x5c8b78){_0x20fe70(_0x5c8b78);});})[_0x6e70('0x70')](function(_0x59e8bf){ut['logger'](_0x6e70('0x10c'),_0x59e8bf);_0x20fe70(ut[_0x6e70('0x47')](_0x6e70('0x10d'),_0x484806,_0x41df1b));});}else{_0x20fe70(ut[_0x6e70('0x47')](_0x2033fa[_0x6e70('0x47')],_0x484806,_0x41df1b));}})[_0x6e70('0x70')](function(_0x2cfb23){ut['logger'](_0x6e70('0x10e'),_0x2cfb23);_0x20fe70(ut[_0x6e70('0x47')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x109')]=function(_0x151c30){if(_['isNil'](_0x151c30)||_[_0x6e70('0xf4')](_0x151c30)||!_[_0x6e70('0x65')](_0x151c30[0x0]['Agent'])&&_['isNil'](_0x151c30[0x0][_0x6e70('0x7e')][_0x6e70('0x51')])){ut[_0x6e70('0x5a')](_0x6e70('0x10f'),_0x151c30);return{'isValid':![],'message':_0x6e70('0x110')};}var _0x48556b=this['campaignsPreview'][_0x151c30[0x0][_0x6e70('0x67')][_0x6e70('0x51')]];_0x48556b[_0x6e70('0x47')]='ACTIVE';if(_[_0x6e70('0x65')](_0x48556b)){ut[_0x6e70('0x5a')](_0x6e70('0x111'),_0x48556b);return{'isValid':![],'message':_0x6e70('0x112')};}if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x4e')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x6e70('0x114')+_0x48556b[_0x6e70('0x51')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x92')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x48556b['name']+_0x6e70('0x115'));return{'isValid':![],'message':_0x6e70('0x116')};}}if(!ut[_0x6e70('0x90')](_0x48556b['dialActive'])){ut[_0x6e70('0x5a')](_0x6e70('0x117'),_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118')};}return{'isValid':!![],'message':_0x6e70('0x119')};};Preview[_0x6e70('0x12')][_0x6e70('0xf5')]=function(_0x24ebf4,_0xa08f5,_0x28bc96,_0x2eb49f){var _0x46a4c2=this;return new BPromise(function(_0x4e0788,_0x53f283){var _0x11b784=_0x24ebf4[_0x6e70('0xa6')];var _0x323887=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?util[_0x6e70('0x53')](_0x6e70('0x11a'),_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x31')])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')]['phone'][_0x6e70('0x11d')](_0xa08f5[_0x6e70('0x11c')]):_0x28bc96[_0x6e70('0xf0')]['phone']):util[_0x6e70('0x53')](_0x6e70('0x11a'),_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')]:_0xa08f5['TrunkBackup'][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5['dialPrefix'])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')][_0x6e70('0xf1')]['substring'](_0xa08f5['dialCutDigit']):_0x28bc96[_0x6e70('0xf0')]['phone']);var _0x337b18=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?ut[_0x6e70('0x11e')](_0xa08f5[_0x6e70('0x4e')]['callerid'],_0xa08f5[_0x6e70('0x11f')],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5[_0x6e70('0x122')],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]):ut['getCallerId'](_['isNil'](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x4f')]:_0xa08f5[_0x6e70('0x92')]['callerid'],_0xa08f5['dialOriginateCallerIdName'],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5['dialOriginateCallerIdNumber'],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]);if(_0x337b18){_0x24ebf4[_0x6e70('0x123')]=ut['extractCalleridName'](_0x337b18);_0x24ebf4[_0x6e70('0x124')]=ut[_0x6e70('0x125')](_0x337b18);}var _0x4b28d2=ut[_0x6e70('0x126')](_0xa08f5,_0x28bc96,_0x323887,_0x337b18,_0x11b784,_0x24ebf4);_['merge'](_0x24ebf4,ut[_0x6e70('0x127')](_0x4b28d2));_0x24ebf4[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6e70('0x6e')](ut[_0x6e70('0x129')](_0x24ebf4,_0xa08f5,_0x4b28d2,_0x24ebf4[_0x6e70('0xbd')],_0x2eb49f))[_0x6e70('0x7a')](function(_0x1da95e){_0xa08f5['originated']+=0x1;logger[_0x6e70('0x55')]('[originated][increment]',_0x11b784,_0x6e70('0xa7'),_0xa08f5[_0x6e70('0x51')],_0x6e70('0xe1'),_0xa08f5[_0x6e70('0x58')]);_0x4e0788(_0x1da95e);})[_0x6e70('0x70')](function(_0x26a56c){ut[_0x6e70('0xe7')](_0x24ebf4,0xe,_0x6e70('0x12a'));rpcDb['createAgentHistory'](_0x24ebf4,_0x6e70('0x12b'));_0x53f283(_0x26a56c);});});};Preview['prototype'][_0x6e70('0x12c')]=function(_0x35e889){if(this[_0x6e70('0x19')][_0x35e889[_0x6e70('0xa3')]]){this['actions'][_0x35e889[_0x6e70('0xa3')]]['channel']=_0x35e889['channel'];}};Preview[_0x6e70('0x12')]['syncOriginateResponse']=function(_0x114df8){var _0x19cc83=this;var _0x14bdfb=this['actions'][_0x114df8['actionid']];if(_0x14bdfb){if(_0x14bdfb[_0x6e70('0xf3')]&&this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]){ut[_0x6e70('0x12d')](_0x14bdfb,this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]['name'],this[_0x6e70('0x1a')][_0x14bdfb['lookAgent']]['id']);}var _0x5771e5=_['clone'](_0x14bdfb);_0x5771e5[_0x6e70('0x12e')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e479d=_0x19cc83['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]];if(ut[_0x6e70('0x12f')](_0x114df8[_0x6e70('0x130')])){if(_0x14bdfb[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x14bdfb[_0x6e70('0x131')]);}if(_0x14bdfb[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x14bdfb[_0x6e70('0x131')]);}ami[_0x6e70('0x22')](_0x6e70('0x132'),ut[_0x6e70('0x97')](_0x14bdfb,'rejected',this['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]]));this[_0x6e70('0xe3')](_0x5771e5,_0x1e479d,_0x114df8);}else{_0x14bdfb[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x5771e5,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0xeb')](_0x5771e5,_0x6e70('0x133'));}}};Preview[_0x6e70('0x12')]['syncHangup']=function(_0x25b5ce){var _0x4a7ce3=this;var _0x44799d=this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]];var _0x4605e5;if(_0x44799d){_0x4605e5=this[_0x6e70('0x16')][_0x44799d['queue']];logger[_0x6e70('0x55')](_0x6e70('0x134'),_0x25b5ce[_0x6e70('0xa3')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);}if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]&&_0x25b5ce[_0x6e70('0xa3')]!==_0x25b5ce[_0x6e70('0xa6')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){this[_0x6e70('0x136')](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],'pTalking:\x20',_0x4605e5['pTalking']);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}}else if(_0x44799d&&_[_0x6e70('0x65')](_0x44799d[_0x6e70('0x138')])&&_0x4605e5[_0x6e70('0x139')]&&_0x25b5ce[_0x6e70('0xa3')]===_0x25b5ce[_0x6e70('0xa6')]&&_[_0x6e70('0x65')](_0x25b5ce['reason'])&&_0x25b5ce[_0x6e70('0x135')]==='16'&&_0x25b5ce[_0x6e70('0x13a')]==='6'&&_['isUndefined'](_0x44799d['transfer'])){if(_0x44799d[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x44799d[_0x6e70('0x131')]);}if(_0x44799d[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x44799d['idContact']);}_0x25b5ce['reason']='22';this[_0x6e70('0xe3')](_0x44799d,_0x4605e5,_0x25b5ce);}else if(_0x44799d&&_0x44799d[_0x6e70('0x13b')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this['actions'][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')]('[syncHangup][talking][transfer]',_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')],_0x6e70('0xa7'),_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]['dialAnswer']){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce['cause'],_0x6e70('0xa7'),_0x4605e5['name'],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}}};Preview['prototype'][_0x6e70('0x1d')]=function(_0x2e8a43){if(this[_0x6e70('0x19')][_0x2e8a43[_0x6e70('0xe2')]]&&_0x2e8a43[_0x6e70('0xe2')]!==_0x2e8a43[_0x6e70('0x13c')]){this[_0x6e70('0x136')](_0x2e8a43,_0x2e8a43[_0x6e70('0xe2')],_0x2e8a43[_0x6e70('0x13d')]);}};Preview[_0x6e70('0x12')]['syncHangupRequest']=function(_0x52ce1a){if(this[_0x6e70('0x19')][_0x52ce1a['linkedid']]&&_0x52ce1a[_0x6e70('0xa3')]!==_0x52ce1a[_0x6e70('0xa6')]&&!this[_0x6e70('0x19')][_0x52ce1a[_0x6e70('0xa3')]][_0x6e70('0x69')]){if(_0x52ce1a[_0x6e70('0x135')]==='1'){this[_0x6e70('0x136')](_0x52ce1a,_0x52ce1a[_0x6e70('0xa3')],_0x52ce1a[_0x6e70('0x135')]);}}};Preview['prototype']['addVariable']=function(_0x4f8e39,_0x2bab68,_0x5f208c){if(this[_0x6e70('0x19')][_0x4f8e39]){if(_[_0x6e70('0x65')](this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')])){this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')]={};}this['actions'][_0x4f8e39][_0x6e70('0x13e')][_0x2bab68]=_0x5f208c;}};Preview[_0x6e70('0x12')][_0x6e70('0x1e')]=function(_0x2bafad){try{if(!_[_0x6e70('0x65')](_0x2bafad)){if(ut[_0x6e70('0x13f')](_[_0x6e70('0x140')](_0x2bafad['variable'])[0x0])){this[_0x6e70('0x141')](_0x2bafad[_0x6e70('0xa6')],_['keys'](_0x2bafad[_0x6e70('0x142')])[0x0],_0x2bafad[_0x6e70('0x143')]);}}}catch(_0x5734d6){logger['error'](_0x6e70('0x144'),util[_0x6e70('0x145')](_0x5734d6,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x6e70('0x146')]=function(_0x1bc156){if(_0x1bc156){if(this[_0x6e70('0x19')][_0x1bc156[_0x6e70('0x147')]]){this[_0x6e70('0x19')][_0x1bc156['transfertargetlinkedid']][_0x6e70('0x13b')]=!![];}}};Preview[_0x6e70('0x12')]['syncBlindTransfer']=function(_0x2e7e4a){if(_0x2e7e4a){if(this['actions'][_0x2e7e4a['transfererlinkedid']]){this['actions'][_0x2e7e4a[_0x6e70('0x148')]][_0x6e70('0x13b')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x9c44=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','preview','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','scheduledAt','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','unlockAgent','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','Global','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','pick','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact'];(function(_0x3fbee1,_0x453e0e){var _0x33a9bb=function(_0x4814a3){while(--_0x4814a3){_0x3fbee1['push'](_0x3fbee1['shift']());}};_0x33a9bb(++_0x453e0e);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x49c4('0x0'));var uuid=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var md5=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x49c4('0x6'))('actionPreview');var ami=require(_0x49c4('0x7'));var rpcDb=require(_0x49c4('0x8'));var Action=require(_0x49c4('0x9'));var ut=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitCampaignPreview(_0x46e475){if(_0x46e475[_0x49c4('0x24')]==='outbound'){var _0x527126={'id':_0x46e475['id'],'name':_0x46e475['name'],'strategy':_0x46e475[_0x49c4('0x25')],'answered':_0x46e475['answered'],'available':_0x46e475['available'],'loggedIn':_0x46e475[_0x49c4('0x26')],'pTalking':_0x46e475[_0x49c4('0x27')],'sumBillable':_0x46e475[_0x49c4('0x28')],'sumDuration':_0x46e475[_0x49c4('0x29')],'sumHoldTime':_0x46e475['sumHoldTime']||0x0,'talking':_0x46e475['talking'],'total':_0x46e475[_0x49c4('0x2a')],'type':_0x46e475[_0x49c4('0x24')],'unmanaged':_0x46e475['unmanaged'],'abandoned':_0x46e475[_0x49c4('0x2b')],'waiting':_0x46e475[_0x49c4('0x2c')],'loggedInDb':_0x46e475[_0x49c4('0x2d')],'dialActive':_0x46e475[_0x49c4('0x2e')],'dialMethod':_0x46e475['dialMethod'],'dialOriginateCallerIdName':_0x46e475['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46e475[_0x49c4('0x2f')],'dialOriginateTimeout':_0x46e475['dialOriginateTimeout'],'dialPrefix':_0x46e475[_0x49c4('0x30')],'outboundAnswerAgiCallsDay':_0x46e475[_0x49c4('0x31')],'outboundAnswerCallsDay':_0x46e475[_0x49c4('0x32')],'outboundBlacklistCallsDay':_0x46e475[_0x49c4('0x33')],'outboundBusyCallsDay':_0x46e475['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x46e475[_0x49c4('0x34')],'outboundDropCallsDayACS':_0x46e475[_0x49c4('0x35')],'outboundDropCallsDayCallersExit':_0x46e475[_0x49c4('0x36')],'outboundDropCallsDayTimeout':_0x46e475[_0x49c4('0x37')],'outboundNoAnswerCallsDay':_0x46e475[_0x49c4('0x38')],'outboundNoSuchCallsDay':_0x46e475[_0x49c4('0x39')],'outboundOriginateFailureCallsDay':_0x46e475[_0x49c4('0x3a')],'outboundReCallsDay':_0x46e475[_0x49c4('0x3b')],'outboundRejectCallsDay':_0x46e475[_0x49c4('0x3c')],'outboundUnknownCallsDay':_0x46e475[_0x49c4('0x3d')],'outboundAbandonedCallsDay':_0x46e475[_0x49c4('0x3e')],'predictiveIntervalAnsweredCalls':_0x46e475['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46e475['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46e475['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46e475[_0x49c4('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x46e475[_0x49c4('0x40')],'predictiveIntervalErlangCalls':_0x46e475[_0x49c4('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x46e475[_0x49c4('0x42')],'predictiveIntervalHitRate':_0x46e475[_0x49c4('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46e475['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46e475[_0x49c4('0x44')],'predictiveIntervalAvailable':_0x46e475[_0x49c4('0x45')],'predictiveIntervalTotalCalls':_0x46e475[_0x49c4('0x46')],'message':_0x46e475[_0x49c4('0x47')],'originated':_0x46e475['originated'],'erlangCalls':_0x46e475['erlangCalls'],'erlangCallToSecond':_0x46e475[_0x49c4('0x48')],'erlangAbandonmentRate':_0x46e475[_0x49c4('0x49')],'erlangBusyFactor':_0x46e475[_0x49c4('0x4a')],'startPredictive':_0x46e475[_0x49c4('0x4b')],'startProgressive':_0x46e475[_0x49c4('0x4c')]};if(_0x46e475['Trunk']){_0x527126[_0x49c4('0x4d')]={'id':_0x46e475[_0x49c4('0x4d')]['id'],'name':_0x46e475[_0x49c4('0x4d')]['name'],'active':_0x46e475['Trunk'][_0x49c4('0x4e')],'callerid':_0x46e475[_0x49c4('0x4d')][_0x49c4('0x4f')]};}if(_0x46e475[_0x49c4('0x50')]){_0x527126[_0x49c4('0x50')]={'id':_0x46e475[_0x49c4('0x50')]['id'],'name':_0x46e475[_0x49c4('0x50')][_0x49c4('0x51')]};}var _0x3209cd=md5(JSON['stringify'](_0x527126));if(_0x46e475[_0x49c4('0x3')]!==_0x3209cd){_0x46e475['md5']=_0x3209cd;emit(util[_0x49c4('0x52')](_0x49c4('0x53'),_0x527126[_0x49c4('0x51')]),_0x49c4('0x54'),_0x527126);}}}function emitVoiceQueueChannelRemove(_0x4ed4f8){logger[_0x49c4('0x55')](_0x49c4('0x56'),JSON[_0x49c4('0x57')](_0x4ed4f8));emit(util['format'](_0x49c4('0x53'),_0x4ed4f8[_0x49c4('0x51')]),_0x49c4('0x58'),_0x4ed4f8);}function notSendMessagesQueue(_0x5e5366){if(_0x5e5366[_0x49c4('0x59')]){if(_0x5e5366[_0x49c4('0x5a')]===0x0&&_0x5e5366[_0x49c4('0x27')]===0x0){_0x5e5366[_0x49c4('0x59')]=![];_0x5e5366[_0x49c4('0x5b')]=0x0;_0x5e5366[_0x49c4('0x5c')]=0x0;_0x5e5366[_0x49c4('0x47')]='NOT_ACTIVE';ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x5f'));}else{_0x5e5366[_0x49c4('0x47')]=_0x49c4('0x60');ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x61'));}emitCampaignPreview(_0x5e5366);}}Preview[_0x49c4('0x62')][_0x49c4('0x22')]=function(){var _0x326142=this;setInterval(function(){_0x326142['syncCampaigns']();},0x7cf);};Preview[_0x49c4('0x62')]['syncCampaigns']=function(){var _0x104efb=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x1480da in _0x104efb){if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&(_0x104efb[_0x1480da][_0x49c4('0x64')]==='preview'||_0x104efb[_0x1480da]['dialMethod']===_0x49c4('0x65'))&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x67')]();}}if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&_0x104efb[_0x1480da][_0x49c4('0x64')]===_0x49c4('0x68')&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(_0x104efb[_0x1480da][_0x49c4('0x2e')]){this[_0x49c4('0x69')](_0x104efb[_0x1480da]);this[_0x49c4('0x6a')](_0x104efb[_0x1480da]);}else{notSendMessagesQueue(_0x104efb[_0x1480da]);}}}};Preview['prototype'][_0x49c4('0x6b')]=function(_0x4d27d0){var _0x33696e=this;this[_0x49c4('0x6c')][_0x49c4('0x6d')](function(){if(!_[_0x49c4('0x6e')](_0x33696e[_0x49c4('0x13')][_0x4d27d0])){loggerAction['info'](_0x49c4('0x6f'),_0x4d27d0,_0x49c4('0x70'),_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')],_0x49c4('0x72'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e['actions'][_0x4d27d0][_0x49c4('0x71')]]['originated']),_0x49c4('0x73'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]][_0x49c4('0x27')]),JSON[_0x49c4('0x57')](_0x33696e['actions'][_0x4d27d0][_0x49c4('0x74')]),JSON[_0x49c4('0x57')](_['pick'](_0x33696e[_0x49c4('0x13')][_0x4d27d0],[_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),'ListId'])));return ami['Action']({'action':_0x49c4('0x78'),'channel':_0x33696e['actions'][_0x4d27d0][_0x49c4('0x79')]})[_0x49c4('0x7a')](function(_0x3811b2){if(_0x3811b2[_0x49c4('0x47')]===_0x49c4('0x7b')){setTimeout(function(){if(_0x33696e[_0x49c4('0x13')][_0x4d27d0]){ut[_0x49c4('0x7c')](_0x33696e['campaignsPreview'][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));if(_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x74')]===!![]){ut[_0x49c4('0x7e')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0]['queue']);delete _0x33696e['actions'][_0x4d27d0];}},0x2328);}});}});};Preview[_0x49c4('0x62')][_0x49c4('0x67')]=function(){var _0x4a0a93=this;loggerAction[_0x49c4('0x55')](_0x49c4('0x7f'),_[_0x49c4('0x80')](this[_0x49c4('0x13')]));for(var _0x50798e in this[_0x49c4('0x13')]){if(_0x4a0a93[_0x49c4('0x13')][_0x49c4('0x63')](_0x50798e)){_0x4a0a93[_0x49c4('0x6b')](_0x50798e);}}};Preview[_0x49c4('0x62')][_0x49c4('0x6a')]=function(_0x5d24f3){var _0x5c7ddd=this;rpcDb[_0x49c4('0x81')](_0x5d24f3['id'],ut[_0x49c4('0x82')](this[_0x49c4('0x14')]))[_0x49c4('0x83')](function(_0x23288e){if(!_[_0x49c4('0x6e')](_0x23288e)){for(var _0xc2033f=0x0;_0xc2033f<_0x23288e['length'];_0xc2033f+=0x1){if(ut[_0x49c4('0x84')](_0x23288e[_0xc2033f][_0x49c4('0x85')])<_0x5d24f3['dialRecallMeTimeout']*0x3c){if(_0x23288e[_0xc2033f][_0x49c4('0x86')]&&!_0x23288e[_0xc2033f]['Agent'][_0x49c4('0x87')]){_0x5c7ddd[_0x49c4('0x88')](_0x23288e[_0xc2033f]['id'])[_0x49c4('0x83')](ut[_0x49c4('0x89')](_0x49c4('0x8a')))[_0x49c4('0x7a')](ut[_0x49c4('0x89')](_0x49c4('0x8a')));}else{rpcDb['disableContact'](_0x23288e[_0xc2033f]['id']);}}else{var _0x3894e0=new Action(_0x23288e[_0xc2033f],_0x5d24f3);_0x3894e0[_0x49c4('0x8b')]=moment()['format'](_0x49c4('0x8c'));_0x5d24f3[_0x49c4('0x3b')]+=0x1;ut['logCustomer'](_0x3894e0,0x17,_0x49c4('0x8d'));if(_0x5d24f3[_0x49c4('0x8e')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x23288e[_0xc2033f]));rpcDb['createCustomerHistory'](_0x3894e0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49c4('0x8f')](_0x3894e0,0x16,'RecallFailedTimeout');rpcDb[_0x49c4('0x90')](_0x3894e0,_0x49c4('0x91'));rpcDb['createCustomerFinal'](_0x3894e0,_0x49c4('0x91'));}}}}})[_0x49c4('0x7a')](ut['logger2'](_0x49c4('0x92')));};Preview[_0x49c4('0x62')][_0x49c4('0x69')]=function(_0x35f46f){_0x35f46f['sendMessageOneNotActive']=!![];if(ut[_0x49c4('0x93')](_0x35f46f[_0x49c4('0x26')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x94');}else if(!ut['isActive'](_0x35f46f[_0x49c4('0x2e')])){_0x35f46f['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x35f46f['Trunk'])){if(!this[_0x49c4('0x95')](_0x35f46f[_0x49c4('0x96')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x97');}else{_0x35f46f['message']='ACTIVE';}}else{_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x98');}emitCampaignPreview(_0x35f46f);};Preview[_0x49c4('0x62')][_0x49c4('0x99')]=function(_0x102c15,_0x404f98,_0x3ba0d6){var _0x3b949d=this;var _0x4d49e0=this[_0x49c4('0x13')][_0x404f98];var _0x55e2ba=this[_0x49c4('0x10')][_0x4d49e0[_0x49c4('0x71')]];var _0x1a5d4c;if(_0x55e2ba){switch(_0x3ba0d6){case'1':_0x55e2ba[_0x49c4('0x39')]+=0x1;_0x4d49e0[_0x49c4('0x9a')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x0,_0x49c4('0x9d'));ami[_0x49c4('0x23')](_0x49c4('0x9e'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xa0')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xa1'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xa4'));}else{if(_0x4d49e0[_0x49c4('0x9a')]>=_0x55e2ba['dialNoSuchNumberMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xa4'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countnosuchnumberretry',_0x55e2ba['dialNoSuchNumberRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case _0x49c4('0xaa'):var _0x118fc4=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));_0x4d49e0[_0x49c4('0xab')]=_0x118fc4;_0x4d49e0[_0x49c4('0xac')]=_0x118fc4;_0x4d49e0['dialAnswer']=!![];_0x55e2ba[_0x49c4('0x27')]+=0x1;logger[_0x49c4('0x55')](_0x49c4('0xad'),_0x4d49e0['uniqueid'],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba[_0x49c4('0x27')]);ami[_0x49c4('0x23')](_0x49c4('0xaf'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb0'),this['campaignsPreview'][_0x4d49e0[_0x49c4('0x71')]]));if(_0x55e2ba[_0x49c4('0xb1')]){ami[_0x49c4('0x23')](_0x49c4('0xb2'),ut[_0x49c4('0xb3')](_0x4d49e0));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x49c4('0x9f')](_0x4d49e0,'complete',this[_0x49c4('0x10')][_0x4d49e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb4')));_0x55e2ba[_0x49c4('0x32')]+=0x1;_0x55e2ba[_0x49c4('0x2a')]+=0x1;_0x55e2ba['answered']+=0x1;ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xb5'));_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xb7'));rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xb8'));rpcDb['crateCustomerReportQueue'](_0x4d49e0);_0x55e2ba[_0x49c4('0x29')]+=_0x4d49e0[_0x49c4('0xb9')];_0x55e2ba['sumBillable']+=_0x4d49e0[_0x49c4('0xb9')];logger['info'](_0x49c4('0xba'),_0x4d49e0[_0x49c4('0xbb')],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba['pTalking']);delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case'BUSY':_0x55e2ba[_0x49c4('0xbc')]+=0x1;_0x4d49e0[_0x49c4('0xbd')]+=0x1;_0x4d49e0['countglobal']=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x5,'Busy');ami[_0x49c4('0x23')](_0x49c4('0xbe'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xbf')));rpcDb['createCustomerHistory'](_0x4d49e0,_0x49c4('0xc0'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xc1'));}else{if(_0x4d49e0['countbusyretry']>=_0x55e2ba['dialBusyMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,'countbusyretry',_0x55e2ba['dialBusyRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc2'):_0x55e2ba[_0x49c4('0x38')]+=0x1;_0x4d49e0[_0x49c4('0xc3')]+=0x1;_0x4d49e0['countglobal']=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x3,'NoAnswer');ami[_0x49c4('0x23')]('custom:agentnoanswer',ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xc4')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xc5'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xc6'));}else{if(_0x4d49e0[_0x49c4('0xc3')]>=_0x55e2ba[_0x49c4('0xc7')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc3'),_0x55e2ba['dialNoAnswerRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc8'):_0x55e2ba[_0x49c4('0x34')]+=0x1;_0x4d49e0[_0x49c4('0xc9')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x8,_0x49c4('0xca'));ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut['buildObj'](_0x4d49e0,'congestion'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xcc'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xcd'));}else{if(_0x4d49e0[_0x49c4('0xc9')]>=_0x55e2ba[_0x49c4('0xce')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc9'),_0x55e2ba[_0x49c4('0xcf')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0['activeContact']);}}break;case'CANCEL':_0x55e2ba[_0x49c4('0x3c')]+=0x1;_0x4d49e0['countagentrejectretry']+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x14,_0x49c4('0xd1'));ami[_0x49c4('0x23')](_0x49c4('0xd2'),ut['buildObj'](_0x4d49e0,'agentreject'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xd3'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0x14,_0x49c4('0xd1'));rpcDb['createCustomerFinal'](_0x1a5d4c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d49e0[_0x49c4('0xd4')]>=_0x55e2ba['dialAgentRejectMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xd4'),_0x55e2ba['dialAgentRejectRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case'ABANDONED':_0x55e2ba[_0x49c4('0x3e')]+=0x1;_0x4d49e0[_0x49c4('0xd6')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xb,_0x49c4('0xd7'));rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,_0x49c4('0xd8'));rpcDb[_0x49c4('0xa5')](_0x1a5d4c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4d49e0[_0x49c4('0xd9')]>=_0x55e2ba['dialAbandonedMaxRety']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xda'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countabandonedretry',_0x55e2ba[_0x49c4('0xdb')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0[_0x49c4('0xa8')]);}}break;default:if(_0x4d49e0[_0x49c4('0x74')]){ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xdc'));ut['loggerError'](_0x49c4('0xdd')+_0x55e2ba['name'],_0x102c15);}_0x55e2ba[_0x49c4('0x3d')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xc,_0x102c15['cause-txt']||_0x102c15[_0x49c4('0xde')]);rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xdf'));}else{rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xdf'));}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];}if(!(_0x4d49e0[_0x49c4('0x74')]&&_0x3ba0d6==='16')){ut[_0x49c4('0x7c')](_0x55e2ba,_0x49c4('0xe0'));logger[_0x49c4('0x55')](_0x49c4('0xe1'),_0x4d49e0['uniqueid'],'\x20Queue',_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x72'),_0x55e2ba[_0x49c4('0x5a')]);}if(_0x3ba0d6!=='ANSWER'){delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];delete this['actions'][_0x102c15[_0x49c4('0xe2')]];}}};Preview['prototype'][_0x49c4('0xe3')]=function(_0x308b45,_0x2adf4f,_0x941b9d){if(_['isUndefined'](_0x2adf4f)&&_0x49c4('0xe4')!==typeof _0x2adf4f){return;}if(_[_0x49c4('0xe5')](_0x941b9d)&&_0x49c4('0xe4')!==typeof _0x941b9d){return;}switch(_0x941b9d[_0x49c4('0xe6')]){case'0':ut[_0x49c4('0xe7')](_0x308b45,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x308b45,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x49c4('0xe7')](_0x308b45,0x3,_0x49c4('0xe8'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xea'));break;case'5':ut[_0x49c4('0xe7')](_0x308b45,0x5,'Busy');rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xeb'));break;case'8':ut[_0x49c4('0xe7')](_0x308b45,0x8,_0x49c4('0xca'));rpcDb['createAgentHistory'](_0x308b45,_0x49c4('0xec'));break;case'22':ut[_0x49c4('0xe7')](_0x308b45,0x16,_0x49c4('0xed'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xee'));break;default:ut['logAgent'](_0x308b45,0xc,_0x941b9d[_0x49c4('0xe6')]);rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xec'));}ut['updateOriginated'](_0x2adf4f,_0x49c4('0xef'));logger[_0x49c4('0x55')](_0x49c4('0xf0'),_0x308b45['uniqueid'],_0x49c4('0xae'),_0x2adf4f['name'],'originated:\x20',_0x2adf4f[_0x49c4('0x5a')]);delete this[_0x49c4('0x13')][_0x308b45['uniqueid']];};Preview[_0x49c4('0x62')][_0x49c4('0xf1')]=function(_0xf0bb4f,_0x1ffc9a,_0x10f5fc,_0x3a7559,_0x148619){var _0x219133=this;return new BPromise(function(_0x59dbef,_0x56ed92){if(_[_0x49c4('0x6e')](_0x1ffc9a)||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0xf2')])||_['isNil'](_0x1ffc9a['Contact'][_0x49c4('0xf3')])||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0x77')])){_0x56ed92(ut[_0x49c4('0x47')](_0x49c4('0xf4'),_0x3a7559,_0x148619));return;}var _0x14f2fc=uuid['v4']();var _0xbabd3b=_0x219133[_0x49c4('0x10')][_0x1ffc9a[_0x49c4('0x70')][_0x49c4('0x51')]];var _0xa42e74=_0x10f5fc?_0x219133[_0x49c4('0x14')][_0x10f5fc]['id']:undefined;_0x219133[_0x49c4('0x13')][_0x14f2fc]=new Action(_0x1ffc9a,_0xbabd3b,_0x14f2fc,_0x10f5fc,_0xa42e74);var _0xbfb25b=_0x219133['actions'][_0x14f2fc];_0xbfb25b[_0x49c4('0xd0')]=_0x3a7559;_0xbfb25b[_0x49c4('0xa8')]=_0x148619;_0xbfb25b[_0x49c4('0xf5')]=_0x10f5fc;if(_[_0x49c4('0xf6')](_0xf0bb4f)){_0x219133['execCall'](_0xbfb25b,_0xbabd3b,_0x1ffc9a,_0x10f5fc)['then'](function(_0xb4a33d){logger['info'](_0x49c4('0xf7'),_0x49c4('0xf8')+_0xbfb25b[_0x49c4('0x71')]+_0x49c4('0xf9')+_0xbfb25b[_0x49c4('0xfa')],JSON[_0x49c4('0x57')](_0xb4a33d));ami[_0x49c4('0x23')](_0x49c4('0xfb'),ut[_0x49c4('0x9f')](_0xbfb25b,_0x49c4('0xfc'),_0x219133[_0x49c4('0x10')][_0xbfb25b[_0x49c4('0x71')]]));_0x59dbef(ut['message'](_0x49c4('0xfd')));})[_0x49c4('0x7a')](function(_0x405c63){ut['logger'](_0x49c4('0xfe'),_0x405c63);_0x56ed92(ut['message'](_0x49c4('0xff'),_0x3a7559,_0x148619));});}else{_0xbabd3b[_0x49c4('0x33')]+=0x1;ut[_0x49c4('0x100')](_0xbfb25b);rpcDb[_0x49c4('0x101')](_0xbfb25b,'[Blacklist][error]');delete _0x219133[_0x49c4('0x13')][_0x14f2fc];_0x56ed92(ut['message']('Contact\x20in\x20black\x20List',_0x3a7559,_0x148619));}});};Preview[_0x49c4('0x62')][_0x49c4('0x95')]=function(_0x1c38a5){return!_['isNil'](_0x1c38a5)&&!_['isNil'](_0x1c38a5[_0x49c4('0x51')])&&!_[_0x49c4('0x6e')](_0x1c38a5[_0x49c4('0x4e')])&&_0x1c38a5[_0x49c4('0x4e')]&&!_[_0x49c4('0x6e')](this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5[_0x49c4('0x51')])])&&!_['isNil'](this[_0x49c4('0x12')][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5['name'])][_0x49c4('0x78')])&&(this['trunks'][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5[_0x49c4('0x51')])]['status']===_0x49c4('0x103')||this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5['name'])]['status']===_0x49c4('0x104'));};Preview[_0x49c4('0x62')][_0x49c4('0x88')]=function(_0x5737b4,_0x367d3d){var _0x1814c4=this;return new BPromise(function(_0x5ae29d,_0x5f2411){_0x1814c4[_0x49c4('0x105')](_0x5737b4,_0x367d3d)[_0x49c4('0x83')](function(_0xa0698d){_0x5ae29d(_['pick'](_0xa0698d,[_0x49c4('0x47')]));})[_0x49c4('0x7a')](function(_0x278225){if(_0x278225[_0x49c4('0x106')]){rpcDb['unlockContact'](_0x5737b4);}if(_0x278225[_0x49c4('0x4e')]){rpcDb['disableContact'](_0x5737b4);}_0x5f2411(_['pick'](_0x278225,[_0x49c4('0x47')]));});});};Preview[_0x49c4('0x62')][_0x49c4('0x105')]=function(_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new BPromise(function(_0x947dd8,_0xa6f48){var _0x37dd25,_0x52a022;rpcDb[_0x49c4('0x107')](_0x24ff20)['then'](function(_0x54db51){if(!_[_0x49c4('0x6e')](_0x54db51[0x0])){_0x52a022=_0x54db51[0x0][_0x49c4('0x108')]?![]:!![];_0x37dd25=_0x54db51[0x0][_0x49c4('0x108')]?!![]:![];_0x37dd25=_0x5adb90?!![]:_0x37dd25;}var _0x56a631=_0x32b6e4[_0x49c4('0x109')](_0x54db51);if(_0x56a631['isValid']){rpcDb[_0x49c4('0x10a')](_[_0x49c4('0x10b')](_0x54db51[0x0],[_0x49c4('0x77'),_0x49c4('0x10c')]))[_0x49c4('0x83')](function(_0x2a5743){_0x32b6e4[_0x49c4('0xf1')](_0x2a5743,_0x54db51[0x0],_0x5adb90,_0x52a022,_0x37dd25)['then'](function(_0x3808e6){_0x947dd8(_0x3808e6);})[_0x49c4('0x7a')](function(_0x2f3c7e){_0xa6f48(_0x2f3c7e);});})[_0x49c4('0x7a')](function(_0x4f30d4){ut['logger']('[Preview][checkIsBlackList]',_0x4f30d4);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),_0x52a022,_0x37dd25));});}else{_0xa6f48(ut[_0x49c4('0x47')](_0x56a631[_0x49c4('0x47')],_0x52a022,_0x37dd25));}})[_0x49c4('0x7a')](function(_0x40c7ab){ut[_0x49c4('0x5d')]('[Preview][getContactPreview]',_0x40c7ab);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4dbb25){if(_[_0x49c4('0x6e')](_0x4dbb25)||_[_0x49c4('0xf6')](_0x4dbb25)||!_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')])&&_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')][_0x49c4('0x51')])){ut['logger'](_0x49c4('0x10e'),_0x4dbb25);return{'isValid':![],'message':_0x49c4('0x10f')};}var _0x2f8042=this[_0x49c4('0x10')][_0x4dbb25[0x0]['Queue'][_0x49c4('0x51')]];_0x2f8042[_0x49c4('0x47')]=_0x49c4('0x98');if(_[_0x49c4('0x6e')](_0x2f8042)){ut[_0x49c4('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f8042);return{'isValid':![],'message':_0x49c4('0x110')};}if(!this['isTrunkReachable'](_0x2f8042['Trunk'])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x113'));if(!this['isTrunkReachable'](_0x2f8042[_0x49c4('0x96')])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x2f8042['name']+_0x49c4('0x114'));return{'isValid':![],'message':_0x49c4('0x115')};}}if(!ut['isActive'](_0x2f8042[_0x49c4('0x2e')])){ut[_0x49c4('0x5d')](_0x49c4('0x116'),_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x117'));return{'isValid':![],'message':_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x49c4('0x118')};};Preview[_0x49c4('0x62')][_0x49c4('0x119')]=function(_0xc7501c,_0x3d9fa7,_0x49c583,_0x34ce60){var _0x39dc83=this;return new BPromise(function(_0x28b1d0,_0x3f62a2){var _0xa2c8cf=_0xc7501c['uniqueid'];var _0x2582e3=_0x39dc83[_0x49c4('0x95')](_0x3d9fa7[_0x49c4('0x4d')])?util[_0x49c4('0x52')](_0x49c4('0x11a'),_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x30')])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')][_0x49c4('0x11c')](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact']['phone']):util[_0x49c4('0x52')](_0x49c4('0x11a'),_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')]:_0x3d9fa7['TrunkBackup'][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7['dialPrefix'])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')]['substring'](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact'][_0x49c4('0xf3')]);var _0x5025ee=_0x39dc83['isTrunkReachable'](_0x3d9fa7[_0x49c4('0x4d')])?ut[_0x49c4('0x11d')](_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')],_0x3d9fa7[_0x49c4('0x11e')],_0x3d9fa7[_0x49c4('0x11f')]>0x0?ut['getCallerIdRandom'](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]):ut[_0x49c4('0x11d')](_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')]:_0x3d9fa7['TrunkBackup']['callerid'],_0x3d9fa7['dialOriginateCallerIdName'],_0x3d9fa7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49c4('0x120')](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]);if(_0x5025ee){_0xc7501c[_0x49c4('0x121')]=ut['extractCalleridName'](_0x5025ee);_0xc7501c['originatecalleridnum']=ut[_0x49c4('0x122')](_0x5025ee);}var _0x50088b=ut['addVariables'](_0x3d9fa7,_0x49c583,_0x2582e3,_0x5025ee,_0xa2c8cf,_0xc7501c);_[_0x49c4('0x123')](_0xc7501c,ut[_0x49c4('0x124')](_0x50088b));_0xc7501c[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));ami[_0x49c4('0x125')](ut['variablesAction'](_0xc7501c,_0x3d9fa7,_0x50088b,_0xc7501c[_0x49c4('0xa8')],_0x34ce60))[_0x49c4('0x83')](function(_0x234848){_0x3d9fa7['originated']+=0x1;logger[_0x49c4('0x55')](_0x49c4('0x126'),_0xa2c8cf,_0x49c4('0xae'),_0x3d9fa7[_0x49c4('0x51')],_0x49c4('0x72'),_0x3d9fa7[_0x49c4('0x5a')]);_0x28b1d0(_0x234848);})[_0x49c4('0x7a')](function(_0x414410){ut['logAgent'](_0xc7501c,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xe9')](_0xc7501c,_0x49c4('0x128'));_0x3f62a2(_0x414410);});});};Preview[_0x49c4('0x62')][_0x49c4('0x1e')]=function(_0x471ec6){if(this['actions'][_0x471ec6[_0x49c4('0xa9')]]){this[_0x49c4('0x13')][_0x471ec6[_0x49c4('0xa9')]][_0x49c4('0x79')]=_0x471ec6[_0x49c4('0x79')];}};Preview[_0x49c4('0x62')][_0x49c4('0x17')]=function(_0x1642fd){var _0x4806ac=this;var _0xc641bc=this[_0x49c4('0x13')][_0x1642fd[_0x49c4('0x129')]];if(_0xc641bc){if(_0xc641bc[_0x49c4('0xf5')]&&this[_0x49c4('0x14')][_0xc641bc['lookAgent']]){ut['logLookAgent'](_0xc641bc,this[_0x49c4('0x14')][_0xc641bc[_0x49c4('0xf5')]]['name'],this['agents'][_0xc641bc[_0x49c4('0xf5')]]['id']);}var _0x57062c=_[_0x49c4('0x12a')](_0xc641bc);_0x57062c[_0x49c4('0xab')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));var _0x2a24bf=_0x4806ac[_0x49c4('0x10')][_0xc641bc[_0x49c4('0x71')]];if(ut[_0x49c4('0x12b')](_0x1642fd['response'])){if(_0xc641bc[_0x49c4('0xd0')]){rpcDb[_0x49c4('0x12c')](_0xc641bc[_0x49c4('0xfa')]);}if(_0xc641bc[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0xc641bc['idContact']);}ami[_0x49c4('0x23')](_0x49c4('0x12e'),ut['buildObj'](_0xc641bc,_0x49c4('0x12f'),this[_0x49c4('0x10')][_0xc641bc['queue']]));this[_0x49c4('0xe3')](_0x57062c,_0x2a24bf,_0x1642fd);}else{_0xc641bc[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x49c4('0xe7')](_0x57062c,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0xe9')](_0x57062c,_0x49c4('0x130'));}}};Preview['prototype'][_0x49c4('0x1a')]=function(_0x5786a4){var _0x3508b7=this;var _0x20f67e=this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]];var _0x5a28cc;if(_0x20f67e){_0x5a28cc=this[_0x49c4('0x10')][_0x20f67e[_0x49c4('0x71')]];logger[_0x49c4('0x55')](_0x49c4('0x131'),_0x5786a4[_0x49c4('0xa9')],_0x49c4('0xae'),_0x5a28cc['name'],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);}if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]&&_0x5786a4[_0x49c4('0xa9')]!==_0x5786a4[_0x49c4('0xbb')]){if(_0x5786a4[_0x49c4('0x132')]==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this['actions'][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger['info'](_0x49c4('0x133'),_0x5786a4['linkedid'],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc['name'],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}}else if(_0x20f67e&&_['isNil'](_0x20f67e[_0x49c4('0x134')])&&_0x5a28cc['dialQueueProject']&&_0x5786a4[_0x49c4('0xa9')]===_0x5786a4[_0x49c4('0xbb')]&&_[_0x49c4('0x6e')](_0x5786a4['reason'])&&_0x5786a4[_0x49c4('0x132')]==='16'&&_0x5786a4[_0x49c4('0x135')]==='6'&&_[_0x49c4('0xe5')](_0x20f67e['transfer'])){if(_0x20f67e['unlockAgent']){rpcDb[_0x49c4('0x12c')](_0x20f67e[_0x49c4('0xfa')]);}if(_0x20f67e[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0x20f67e[_0x49c4('0xfa')]);}_0x5786a4[_0x49c4('0xe6')]='22';this['callProgressDetectingAgent'](_0x20f67e,_0x5a28cc,_0x5786a4);}else if(_0x20f67e&&_0x20f67e['transfer']){if(_0x5786a4['cause']==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger[_0x49c4('0x55')]('[syncHangup][talking][transfer]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]['dialAnswer']){logger[_0x49c4('0x55')]('[syncHangup][talking][cause]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);this['callProgressDetectingCustomer'](_0x5786a4,_0x5786a4['linkedid'],_0x5786a4['cause']);}}};Preview[_0x49c4('0x62')][_0x49c4('0x1d')]=function(_0x3f2b3a){if(this['actions'][_0x3f2b3a[_0x49c4('0xe2')]]&&_0x3f2b3a['destlinkedid']!==_0x3f2b3a[_0x49c4('0x136')]){this[_0x49c4('0x99')](_0x3f2b3a,_0x3f2b3a[_0x49c4('0xe2')],_0x3f2b3a['dialstatus']);}};Preview[_0x49c4('0x62')][_0x49c4('0x1b')]=function(_0x2028e5){if(this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]]&&_0x2028e5['linkedid']!==_0x2028e5[_0x49c4('0xbb')]&&!this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]][_0x49c4('0x74')]){if(_0x2028e5['cause']==='1'){this['callProgressDetectingCustomer'](_0x2028e5,_0x2028e5[_0x49c4('0xa9')],_0x2028e5[_0x49c4('0x132')]);}}};Preview['prototype'][_0x49c4('0x137')]=function(_0x2fd09b,_0x10a39c,_0x2e1a4e){if(this['actions'][_0x2fd09b]){if(_[_0x49c4('0x6e')](this[_0x49c4('0x13')][_0x2fd09b]['variables'])){this['actions'][_0x2fd09b][_0x49c4('0x138')]={};}this[_0x49c4('0x13')][_0x2fd09b][_0x49c4('0x138')][_0x10a39c]=_0x2e1a4e;}};Preview[_0x49c4('0x62')][_0x49c4('0x139')]=function(_0x5ee9f1){try{if(!_[_0x49c4('0x6e')](_0x5ee9f1)){if(ut['filterKey'](_[_0x49c4('0x13a')](_0x5ee9f1[_0x49c4('0x13b')])[0x0])){this[_0x49c4('0x137')](_0x5ee9f1[_0x49c4('0xbb')],_['keys'](_0x5ee9f1['variable'])[0x0],_0x5ee9f1['value']);}}}catch(_0x3ed327){logger[_0x49c4('0x13c')](_0x49c4('0x13d'),util[_0x49c4('0x13e')](_0x3ed327,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x7f9737){if(_0x7f9737){if(this['actions'][_0x7f9737[_0x49c4('0x13f')]]){this[_0x49c4('0x13')][_0x7f9737['transfertargetlinkedid']][_0x49c4('0x140')]=!![];}}};Preview[_0x49c4('0x62')][_0x49c4('0x141')]=function(_0x5529f6){if(_0x5529f6){if(this[_0x49c4('0x13')][_0x5529f6[_0x49c4('0x142')]]){this[_0x49c4('0x13')][_0x5529f6['transfererlinkedid']][_0x49c4('0x140')]=!![];}}};module[_0x49c4('0x143')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ecd716b..0a92d27 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 _0x9c5a=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten'];(function(_0x1422fd,_0x238c93){var _0x255c69=function(_0x473e58){while(--_0x473e58){_0x1422fd['push'](_0x1422fd['shift']());}};_0x255c69(++_0x238c93);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4ec76d,_0x274480){_0x4ec76d=_0x4ec76d-0x0;var _0xce7d64=_0x9c5a[_0x4ec76d];return _0xce7d64;};'use strict';var util=require(_0xa9c5('0x0'));var BPromise=require(_0xa9c5('0x1'));var logger=require('../../../config/logger')(_0xa9c5('0x2'));var _=require(_0xa9c5('0x3'));var cmHopper=require(_0xa9c5('0x4'));var cmHopperFinal=require(_0xa9c5('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa9c5('0x6'));var voiceQueueRt=require(_0xa9c5('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xa9c5('0x8'));function loggerCatch(_0x4d9c7a){return function(_0x394d84){logger[_0xa9c5('0x9')](_0x4d9c7a,util['inspect'](_0x394d84,{'showHidden':![],'depth':null}));};}function create(_0x4b6db6){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopperHistory['createHistory'](_0x4b6db6))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0xd')));}function createAgent(_0x51c14c){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](agentReportPreview['createHistory'](_0x51c14c))['catch'](loggerCatch(_0xa9c5('0xd')));}function moveContact(_0x11421c){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0xe')](_0x11421c,!![]))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0xf')));}exports[_0xa9c5('0x10')]=function(_0x3c5ac7){return BPromise[_0xa9c5('0xa')]()['then'](cmHopperBlack[_0xa9c5('0x10')](_0x3c5ac7))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x11')));};exports[_0xa9c5('0x12')]=function(_0x418ca5){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x12')](_0x418ca5))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x13')));};exports['createHistory']=function(_0x2b0d73,_0xd85c32){create(_0x2b0d73)[_0xa9c5('0xc')](loggerCatch(_0xd85c32));moveContact(_0x2b0d73)['catch'](loggerCatch(_0xd85c32));};exports[_0xa9c5('0x14')]=function(_0x1142d9,_0x2b9ac5){createAgent(_0x1142d9)[_0xa9c5('0xc')](loggerCatch(_0x2b9ac5));};exports[_0xa9c5('0x15')]=function(_0x349f27,_0x3b8d4d){create(_0x349f27)[_0xa9c5('0xc')](loggerCatch(_0x3b8d4d));};exports[_0xa9c5('0x16')]=function(_0x36c486,_0x113c8f){moveContact(_0x36c486)[_0xa9c5('0xc')](loggerCatch(_0x113c8f));};exports['rescheduleContact']=function(_0x1115ad,_0x21ab50,_0x541c77){if(_0x21ab50){_0x1115ad['UserId']=null;}if(_0x541c77){_0x1115ad[_0xa9c5('0x17')]=![];}return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x18')](_0x1115ad))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x19')));};exports['countReScheduled']=function(_0x4fa280){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper['countReScheduled'](_0x4fa280))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x1a')));};exports[_0xa9c5('0x1b')]=function(_0x32fc7d){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x1b')]({'UserId':null},_0x32fc7d,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xa9c5('0x1c')]=function(_0x4cd5e6){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper['unlockContact']({'active':![]},_0x4cd5e6,0x1))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x1d')));};exports['crateCustomerReportQueue']=function(_0x413edf){var _0x32baf9={};_0x32baf9[_0xa9c5('0x1e')]=_0x413edf[_0xa9c5('0x1e')];_0x32baf9[_0xa9c5('0x1f')]=_0x413edf['uniqueid'];_0x32baf9[_0xa9c5('0x20')]=_0x413edf['calleridnum'];_0x32baf9[_0xa9c5('0x21')]=_0x413edf[_0xa9c5('0x21')];_0x32baf9[_0xa9c5('0x22')]=_0x413edf['queue'];_0x32baf9[_0xa9c5('0x23')]=_0x413edf[_0xa9c5('0x24')];_0x32baf9['queuecallerleaveAt']=_0x413edf[_0xa9c5('0x24')];_0x32baf9[_0xa9c5('0x25')]=0x1;_0x32baf9[_0xa9c5('0x26')]=_0x413edf[_0xa9c5('0x27')];_0x32baf9[_0xa9c5('0x28')]=_0x413edf[_0xa9c5('0x29')];_0x32baf9[_0xa9c5('0x2a')]='from-sip';_0x32baf9[_0xa9c5('0x2b')]=_0xa9c5('0x2c');_0x32baf9[_0xa9c5('0x2d')]=0x0;_0x32baf9[_0xa9c5('0x2e')]=0x1;_0x32baf9[_0xa9c5('0x2f')]=_0x413edf[_0xa9c5('0x29')];_0x32baf9[_0xa9c5('0x30')]=_0xa9c5('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0xa9c5('0x32')](_0x32baf9))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x33')));};exports[_0xa9c5('0x34')]=function(_0x296116,_0x25121e){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x296116,_0x25121e))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x35')));};exports['rescheduleContactInQueue']=function(_0x13a1f5){return BPromise['resolve']()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x18')](_0x13a1f5,!![],!![]))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x36')));}; \ No newline at end of file +var _0x84e7=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','holdtime','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x84e7,0x122));var _0x784e=function(_0x18cbcc,_0x56a27e){_0x18cbcc=_0x18cbcc-0x0;var _0x58bd3b=_0x84e7[_0x18cbcc];return _0x58bd3b;};'use strict';var util=require('util');var BPromise=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('preview');var _=require(_0x784e('0x2'));var cmHopper=require(_0x784e('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x784e('0x4'));var cmHopperBlack=require(_0x784e('0x5'));var voiceQueueRt=require(_0x784e('0x6'));var agentReportPreview=require(_0x784e('0x7'));var voiceQueueReport=require(_0x784e('0x8'));function loggerCatch(_0x133296){return function(_0x48ed22){logger[_0x784e('0x9')](_0x133296,util['inspect'](_0x48ed22,{'showHidden':![],'depth':null}));};}function create(_0xfaa170){return BPromise[_0x784e('0xa')]()['then'](cmHopperHistory[_0x784e('0xb')](_0xfaa170))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function createAgent(_0x3ddd55){return BPromise['resolve']()['then'](agentReportPreview[_0x784e('0xb')](_0x3ddd55))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function moveContact(_0x2fd1b5){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0xf')](_0x2fd1b5,!![]))[_0x784e('0xc')](loggerCatch(_0x784e('0x10')));}exports[_0x784e('0x11')]=function(_0x208d24){return BPromise['resolve']()[_0x784e('0xe')](cmHopperBlack['checkIsBlackList'](_0x208d24))[_0x784e('0xc')](loggerCatch(_0x784e('0x12')));};exports[_0x784e('0x13')]=function(_0x21e844){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x13')](_0x21e844))[_0x784e('0xc')](loggerCatch(_0x784e('0x14')));};exports['createHistory']=function(_0x519059,_0x112ba1){create(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));moveContact(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));};exports[_0x784e('0x15')]=function(_0x3ac83,_0x19072b){createAgent(_0x3ac83)[_0x784e('0xc')](loggerCatch(_0x19072b));};exports['createCustomerHistory']=function(_0x2524d0,_0x285ddd){create(_0x2524d0)[_0x784e('0xc')](loggerCatch(_0x285ddd));};exports[_0x784e('0x16')]=function(_0x440cd6,_0x42f894){moveContact(_0x440cd6)[_0x784e('0xc')](loggerCatch(_0x42f894));};exports['rescheduleContact']=function(_0x5add8f,_0x12aacb,_0x52bc9d){if(_0x12aacb){_0x5add8f[_0x784e('0x17')]=null;}if(_0x52bc9d){_0x5add8f[_0x784e('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x784e('0x19')](_0x5add8f))[_0x784e('0xc')](loggerCatch(_0x784e('0x1a')));};exports[_0x784e('0x1b')]=function(_0x51f452){return BPromise['resolve']()['then'](cmHopper[_0x784e('0x1b')](_0x51f452))[_0x784e('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x784e('0x1c')]=function(_0x5e809a){return BPromise[_0x784e('0xa')]()['then'](cmHopper[_0x784e('0x1c')]({'UserId':null},_0x5e809a,0x1))[_0x784e('0xc')](loggerCatch(_0x784e('0x1d')));};exports[_0x784e('0x1e')]=function(_0x5cb14f){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x1c')]({'active':![]},_0x5cb14f,0x1))[_0x784e('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x784e('0x1f')]=function(_0xa3603f){var _0x5f3da2={};_0x5f3da2['type']=_0xa3603f[_0x784e('0x20')];_0x5f3da2[_0x784e('0x21')]=_0xa3603f[_0x784e('0x21')];_0x5f3da2[_0x784e('0x22')]=_0xa3603f[_0x784e('0x22')];_0x5f3da2[_0x784e('0x23')]=_0xa3603f[_0x784e('0x23')];_0x5f3da2[_0x784e('0x24')]=_0xa3603f[_0x784e('0x24')];_0x5f3da2[_0x784e('0x25')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x27')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x28')]=0x1;_0x5f3da2[_0x784e('0x29')]=_0xa3603f['endtime'];_0x5f3da2[_0x784e('0x2a')]=_0xa3603f['membername'];_0x5f3da2[_0x784e('0x2b')]=_0x784e('0x2c');_0x5f3da2[_0x784e('0x2d')]='xcally-motion-preview';_0x5f3da2[_0x784e('0x2e')]=0x0;_0x5f3da2['assigned']=0x1;_0x5f3da2[_0x784e('0x2f')]=_0xa3603f[_0x784e('0x30')];_0x5f3da2['queuecallerexitreason']=_0x784e('0x31');return BPromise[_0x784e('0xa')]()['then'](voiceQueueReport['create'](_0x5f3da2))[_0x784e('0xc')](loggerCatch(_0x784e('0x32')));};exports[_0x784e('0x33')]=function(_0x4724af,_0x33b2a6){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x33')](_0x4724af,_0x33b2a6))['catch'](loggerCatch(_0x784e('0x34')));};exports['rescheduleContactInQueue']=function(_0x4adb1f){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x19')](_0x4adb1f,!![],!![]))['catch'](loggerCatch(_0x784e('0x35')));}; \ 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 b7580f1..0bc3845 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 _0x5f97=['Queue','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','endtime','logAgent','statedesc','responsetime','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','originate','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','active','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','name','queue','mandatoryDisposition','interface','channelAgent','agentReadyId','not_inuse','status','reachable','push','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil'];(function(_0x3e6acc,_0x38bccc){var _0x115e08=function(_0x2e8661){while(--_0x2e8661){_0x3e6acc['push'](_0x3e6acc['shift']());}};_0x115e08(++_0x38bccc);}(_0x5f97,0x192));var _0x75f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f97[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x75f9('0x0'));var _=require(_0x75f9('0x1'));var moment=require(_0x75f9('0x2'));var logger=require(_0x75f9('0x3'))(_0x75f9('0x4'));var ipAgi=process[_0x75f9('0x5')][_0x75f9('0x6')]||_0x75f9('0x7');function getSeconds(_0x1fd101,_0x1d36df){var _0x318eb3=moment(_0x1fd101)['milliseconds'](0x0);var _0x72e216=moment(_0x1d36df)[_0x75f9('0x8')](0x0);return _0x318eb3['diff'](_0x72e216,_0x75f9('0x9'));}exports[_0x75f9('0xa')]=function(_0x4ccf46){return function(_0x32deb0){logger[_0x75f9('0xb')](_0x4ccf46,util[_0x75f9('0xc')](_0x32deb0,{'showHidden':![],'depth':null}));};};exports[_0x75f9('0xd')]=function(_0x43c67c,_0x170cd3){logger[_0x75f9('0xe')](_0x43c67c,util['inspect'](_0x170cd3,{'showHidden':![],'depth':null}));};exports[_0x75f9('0xf')]=function(_0x4f1e8f,_0x3b0474){logger[_0x75f9('0xb')](_0x4f1e8f,util[_0x75f9('0xc')](_0x3b0474,{'showHidden':![],'depth':null}));};exports[_0x75f9('0x10')]=function(_0x4710a9){return function(_0x505d12){logger[_0x75f9('0xe')](_0x4710a9,util[_0x75f9('0xc')](_0x505d12,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2d69d1,_0x434d6a,_0x180df0){return{'message':_0x2d69d1,'unlock':_0x434d6a,'active':_0x180df0};};exports[_0x75f9('0x11')]=function(_0x3ef52f,_0x46d179,_0x34ec83){if(!_['isUndefined'](_0x34ec83)&&_0x75f9('0x12')===typeof _0x34ec83&&!_['isEmpty'](_0x34ec83)){if(!_['isUndefined'](_0x46d179)&&_0x75f9('0x12')===typeof _0x46d179&&!_[_0x75f9('0x13')](_0x46d179)){return util[_0x75f9('0x14')](_0x75f9('0x15'),_0x46d179,_0x34ec83);}return util['format'](_0x75f9('0x15'),_0x34ec83,_0x34ec83);}if(!_['isUndefined'](_0x3ef52f)&&_0x75f9('0x12')===typeof _0x3ef52f&&!_[_0x75f9('0x13')](_0x3ef52f)){return _0x3ef52f;}return _0x75f9('0x16');};exports['isActive']=function(_0x470574){if(_[_0x75f9('0x17')](_0x470574)){return![];}return _0x470574;};exports['addVariables']=function(_0x27cbb1,_0x454fb0,_0x36101b,_0x16deb7,_0xe5e1,_0x30e5b9){var _0x2f61d3={'XMD-QUEUE':_0x454fb0[_0x75f9('0x18')]?_0x454fb0[_0x75f9('0x18')]['name']:'','XMD-CALLERID':_0x16deb7,'XMD-CALLERID-PREVIEW':_0x30e5b9?util['format'](_0x75f9('0x15'),_0x30e5b9['calleridname'],_0x30e5b9[_0x75f9('0x19')]):_0x16deb7,'XMD-DIALID':_0xe5e1,'XMD-CONTACTID':_0x454fb0['ContactId'],'XMD-CDRTYPE':_0x75f9('0x1a'),'CALLERID(all)':_0x16deb7,'XMD-VOICEQUEUEID':_0x454fb0[_0x75f9('0x1b')],'XMD-DIALCHANNEL':_0x36101b,'XMD-DIALTIMEOUT':_0x27cbb1['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x75f9('0x1c'),_0x27cbb1[_0x75f9('0x1d')]?'g':'',_['isEmpty'](_0x27cbb1[_0x75f9('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x27cbb1['dialPreviewUrl']||'','XMD-AGI':_0x27cbb1['dialQueueProject']?util['format'](_0x75f9('0x1f'),ipAgi,_0x27cbb1[_0x75f9('0x20')]):'NONE','XMD-AGIAFTER':_0x27cbb1['dialQueueProject2']?util[_0x75f9('0x14')](_0x75f9('0x1f'),ipAgi,_0x27cbb1[_0x75f9('0x1d')]):_0x75f9('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x30e5b9?_0x30e5b9[_0x75f9('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x30e5b9?_0x30e5b9[_0x75f9('0x23')]:'','XMD-DESTINATION':_0x75f9('0x24')};if(!_[_0x75f9('0x13')](_0x27cbb1[_0x75f9('0x1e')])){_0x2f61d3[util['format']('%s',_0x75f9('0x25'))]=_0x27cbb1[_0x75f9('0x1e')];_0x2f61d3[util[_0x75f9('0x14')]('%s',_0x75f9('0x26'))]=_0xe5e1;}if(_0x454fb0&&_0x454fb0[_0x75f9('0x27')]){for(var _0x1f2bde in _0x454fb0[_0x75f9('0x27')]){if(_0x454fb0['Contact'][_0x75f9('0x28')](_0x1f2bde)){if(!_[_0x75f9('0x17')](_0x454fb0[_0x75f9('0x27')][_0x1f2bde])&&_0x1f2bde!=='id'&&_0x1f2bde!==_0x75f9('0x29')&&_0x1f2bde!==_0x75f9('0x2a')&&_0x1f2bde!==_0x75f9('0x2b')){_0x2f61d3[util['format'](_0x75f9('0x2c'),_0x75f9('0x2d'),_[_0x75f9('0x2e')](_0x1f2bde))]=_0x454fb0[_0x75f9('0x27')][_0x1f2bde];}}}}return _0x2f61d3;};exports['toLowerVariables']=function(_0x1661d8){var _0x51d869={};for(var _0x159190 in _0x1661d8){if(_0x1661d8[_0x75f9('0x28')](_0x159190)){_0x51d869[util[_0x75f9('0x14')]('%s',_[_0x75f9('0x2f')](_0x159190))]=_0x1661d8[_0x159190];}}return{'variables':_0x51d869};};exports['updateOriginated']=function(_0x104fb8,_0x59e63b){if(!_['isNil'](_0x104fb8)){if(_0x104fb8[_0x75f9('0x28')](_0x75f9('0x30'))){if(_0x104fb8['originated']>0x0){_0x104fb8['originated']-=0x1;}else{logger[_0x75f9('0xb')](_0x75f9('0x31'),_0x59e63b);}}}else{logger[_0x75f9('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x59e63b);}};exports[_0x75f9('0x32')]=function(_0x35dca8){var _0x2427a7=moment()['format'](_0x75f9('0x33'));_0x35dca8[_0x75f9('0x34')]=0xd;_0x35dca8['statedesc']=_0x75f9('0x35');_0x35dca8[_0x75f9('0x36')]=_0x2427a7;_0x35dca8['responsetime']=_0x2427a7;_0x35dca8[_0x75f9('0x37')]=_0x2427a7;};exports[_0x75f9('0x38')]=function(_0x623a96,_0x129f1f,_0x44f459){var _0x121a08=moment()[_0x75f9('0x14')](_0x75f9('0x33'));_0x623a96[_0x75f9('0x34')]=_0x129f1f;_0x623a96[_0x75f9('0x39')]=_0x44f459;_0x623a96[_0x75f9('0x3a')]=_0x121a08;_0x623a96[_0x75f9('0x3b')]=getSeconds(_0x623a96['responsetime'],_0x623a96[_0x75f9('0x36')]);};exports[_0x75f9('0x3c')]=function(_0x5da9d9,_0x44b398,_0x4206c1){_0x5da9d9[_0x75f9('0x3d')]=_0x44b398;_0x5da9d9[_0x75f9('0x3e')]=_0x4206c1;};exports['logCustomer']=function(_0x4697bd,_0x144950,_0xb0203e){var _0x4d6992=moment()['format'](_0x75f9('0x33'));_0x4697bd[_0x75f9('0x34')]=_0x144950;_0x4697bd[_0x75f9('0x39')]=_0xb0203e;_0x4697bd[_0x75f9('0x3a')]=_0x4697bd['responsetime']?_0x4697bd['responsetime']:_0x4d6992;_0x4697bd[_0x75f9('0x37')]=_0x4697bd['endtime']?_0x4697bd[_0x75f9('0x37')]:_0x4d6992;_0x4697bd['ringtime']=getSeconds(_0x4697bd[_0x75f9('0x3a')]||0x0,_0x4697bd[_0x75f9('0x36')]||0x0);_0x4697bd[_0x75f9('0x3f')]=_0x4697bd[_0x75f9('0x40')]?getSeconds(_0x4697bd[_0x75f9('0x37')],_0x4697bd[_0x75f9('0x40')]):0x0;};exports[_0x75f9('0x41')]=function(_0x39665e){return _0x39665e===_0x75f9('0x42');};exports[_0x75f9('0x43')]=function(_0x35c6b8,_0x1f3189,_0x324d35,_0xa98c4b,_0x33960c){var _0x44a411=_0xa98c4b?'RECALL':_0x35c6b8[_0x75f9('0x44')];_0x44a411=_0x33960c?_0x75f9('0x45'):_0x44a411;return{'actionid':_0x35c6b8['uniqueid'],'action':_0x75f9('0x46'),'channel':_0x35c6b8['channelAgent'],'callerid':util[_0x75f9('0x14')](_0x75f9('0x15'),_0x44a411,_0x35c6b8['calleridnum']),'Exten':_0x75f9('0x24'),'Context':_0x75f9('0x47'),'Priority':'1','variable':_0x324d35,'timeout':(_0x1f3189[_0x75f9('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35c6b8[_0x75f9('0x49')]};};exports[_0x75f9('0x4a')]=function(_0x1382c9){return _0x1382c9[_0x75f9('0x4b')]+_0x1382c9[_0x75f9('0x4c')]+_0x1382c9[_0x75f9('0x4d')]+_0x1382c9[_0x75f9('0x4e')]+_0x1382c9[_0x75f9('0x4f')];};exports['cloneAction']=function(_0x112f80){var _0x41c7b0=_['clone'](_0x112f80);_0x41c7b0[_0x75f9('0x34')]=0xf;_0x41c7b0[_0x75f9('0x39')]=_0x75f9('0x50');return _0x41c7b0;};exports['scheduledAt']=function(_0x4ea836,_0x31c06f,_0x4dd721){var _0x26830c={};_0x26830c[_0x31c06f]=_0x4ea836[_0x31c06f];_0x26830c[_0x75f9('0x51')]=![];_0x26830c['scheduledat']=moment()[_0x75f9('0x52')](_0x4dd721,_0x75f9('0x53'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x26830c['ContactId']=_0x4ea836[_0x75f9('0x54')];_0x26830c[_0x75f9('0x55')]=_0x4ea836[_0x75f9('0x55')];_0x26830c[_0x75f9('0x1b')]=_0x4ea836[_0x75f9('0x1b')]||undefined;return _0x26830c;};exports['decrementTalkink']=function(_0x1ae6b2,_0x5808a9){if(!_['isNil'](_0x1ae6b2)){if(_0x1ae6b2[_0x75f9('0x56')]>0x0){_0x1ae6b2[_0x75f9('0x56')]-=0x1;}else{logger[_0x75f9('0xb')](_0x5808a9,_0x75f9('0x57'));}}else{logger[_0x75f9('0xb')](_0x5808a9,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x75f9('0x58')]=function(_0x244242){if(_0x244242<=0x0){return!![];}return![];};exports[_0x75f9('0x59')]=function(_0x525528,_0x1ea14c,_0x11653c){_0x525528[_0x75f9('0x5a')]=_0x1ea14c;_0x525528[_0x75f9('0x5b')]=_0x525528[_0x75f9('0x5c')];_0x525528['interface']=_0x525528['channelAgent'];if(_0x11653c){_0x525528[_0x75f9('0x5d')]=_0x11653c[_0x75f9('0x5d')];}return _0x525528;};exports['buildAcw']=function(_0x2a37c9){var _0x177133={};_0x177133['queue']=_0x2a37c9[_0x75f9('0x5c')];_0x177133[_0x75f9('0x5e')]=_0x2a37c9[_0x75f9('0x5f')];_0x177133[_0x75f9('0x49')]=_0x2a37c9[_0x75f9('0x49')];return _0x177133;};exports[_0x75f9('0x60')]=function(_0x38999d){var _0x14fdc6=[];for(var _0x21dd38 in _0x38999d){if(_0x38999d[_0x75f9('0x28')](_0x21dd38)){if(!_[_0x75f9('0x17')](_0x38999d[_0x21dd38])&&_0x38999d[_0x21dd38][_0x75f9('0x34')]===_0x75f9('0x61')&&_0x38999d[_0x21dd38][_0x75f9('0x62')]===_0x75f9('0x63')){_0x14fdc6[_0x75f9('0x64')](_0x38999d[_0x21dd38]['id']);}}}return _0x14fdc6;};exports['getDiff']=function(_0x143ffc){var _0x4f4d14=moment()[_0x75f9('0x8')](0x0);var _0x3f0970=moment(_0x143ffc)[_0x75f9('0x8')](0x0);return _0x4f4d14[_0x75f9('0x65')](_0x3f0970,_0x75f9('0x9'));};exports[_0x75f9('0x66')]=function(_0x1a0e70){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a0e70[_0x75f9('0x54')],'ListId':_0x1a0e70[_0x75f9('0x55')],'VoiceQueueId':_0x1a0e70[_0x75f9('0x1b')]||undefined,'CampaignId':_0x1a0e70[_0x75f9('0x67')]||undefined};};exports[_0x75f9('0x68')]=function(_0x765a3e){if(_0x765a3e===_0x75f9('0x49')||_0x765a3e===_0x75f9('0x69')||_0x765a3e==='queue'||_0x765a3e===_0x75f9('0x6a')||_0x765a3e===_0x75f9('0x6b')||_0x765a3e===_0x75f9('0x6c')||_0x765a3e==='membername'||_0x765a3e===_0x75f9('0x5f')||_0x765a3e===_0x75f9('0x44')||_0x765a3e==='active'||_0x765a3e===_0x75f9('0x19')||_0x765a3e===_0x75f9('0x6d')||_0x765a3e==='countbusyretry'||_0x765a3e===_0x75f9('0x4c')||_0x765a3e===_0x75f9('0x4d')||_0x765a3e===_0x75f9('0x6e')||_0x765a3e===_0x75f9('0x6f')||_0x765a3e===_0x75f9('0x70')||_0x765a3e===_0x75f9('0x71')||_0x765a3e===_0x75f9('0x72')||_0x765a3e===_0x75f9('0x54')||_0x765a3e==='ListId'||_0x765a3e===_0x75f9('0x3e')||_0x765a3e===_0x75f9('0x1b')||_0x765a3e===_0x75f9('0x73')||_0x765a3e===_0x75f9('0x74')||_0x765a3e==='xmd-queue'||_0x765a3e===_0x75f9('0x75')||_0x765a3e===_0x75f9('0x76')||_0x765a3e==='xmd-dialurl'||_0x765a3e===_0x75f9('0x77')||_0x765a3e===_0x75f9('0x78')||_0x765a3e===_0x75f9('0x79')||_0x765a3e===_0x75f9('0x7a')||_0x765a3e==='xmd-contactid'||_0x765a3e===_0x75f9('0x7b')||_0x765a3e===_0x75f9('0x7c')||_0x765a3e===_0x75f9('0x7d')||_0x765a3e===_0x75f9('0x7e')||_0x765a3e===_0x75f9('0x7f')||_0x765a3e==='rtpaudioqosbridged'||_0x765a3e===_0x75f9('0x80')||_0x765a3e===_0x75f9('0x81')||_0x765a3e==='rtpaudioqosloss'||_0x765a3e===_0x75f9('0x82')||_0x765a3e==='rtpaudioqosrtt'||_0x765a3e===_0x75f9('0x83')||_0x765a3e===_0x75f9('0x7f')||_0x765a3e==='rtpaudioqosbridged'||_0x765a3e===_0x75f9('0x80')||_0x765a3e===_0x75f9('0x81')||_0x765a3e===_0x75f9('0x84')||_0x765a3e===_0x75f9('0x82')||_0x765a3e===_0x75f9('0x85')||_0x765a3e===_0x75f9('0x83')||_0x765a3e===_0x75f9('0x86')||_0x765a3e===_0x75f9('0x87')||_0x765a3e===_0x75f9('0x34')||_0x765a3e===_0x75f9('0x39')){return![];}return!![];};exports[_0x75f9('0x88')]=function(_0x3a51b7,_0x23986f){var _0x793e4d,_0x4efb2b,_0x534907;if(_0x23986f<=0x0){_0x23986f=0x1;}_0x793e4d=new RegExp('\x5cw{0,'+_0x23986f+'}$');_0x4efb2b=Math[_0x75f9('0x89')](0xa,_0x23986f-0x1);_0x534907=Math['pow'](0xa,_0x23986f)-0x1;return util[_0x75f9('0x14')]('%s',_['replace'](_0x3a51b7,_0x793e4d,_[_0x75f9('0x8a')](_0x4efb2b,_0x534907)));};exports[_0x75f9('0x8b')]=function(_0xb74f73){var _0x3ecb56=_0xb74f73['match'](/"(.*?)"/);return _0x3ecb56?_0x3ecb56[0x1]:_0xb74f73;};exports[_0x75f9('0x8c')]=function(_0x491f0f){var _0x529f04=_0x491f0f[_0x75f9('0x8d')](/<(.*?)>/);return _0x529f04?_0x529f04[0x1]:_0x491f0f;}; \ No newline at end of file +var _0x3de5=['isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','channelAgent','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','createBody','filterKey','idContact','type','campaigntype','membername','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','endtime','logAgent','responsetime','ringtime','logLookAgent','UserId','logCustomer','starttime','talktime','answertime'];(function(_0x2f09dd,_0x5cbb24){var _0x13d121=function(_0x16d543){while(--_0x16d543){_0x2f09dd['push'](_0x2f09dd['shift']());}};_0x13d121(++_0x5cbb24);}(_0x3de5,0x164));var _0x53de=function(_0x390cc5,_0x1ca73e){_0x390cc5=_0x390cc5-0x0;var _0x6f58c3=_0x3de5[_0x390cc5];return _0x6f58c3;};'use strict';var util=require(_0x53de('0x0'));var _=require(_0x53de('0x1'));var moment=require(_0x53de('0x2'));var logger=require(_0x53de('0x3'))(_0x53de('0x4'));var ipAgi=process['env'][_0x53de('0x5')]||_0x53de('0x6');function getSeconds(_0x4143ea,_0x1e268b){var _0x5c570d=moment(_0x4143ea)[_0x53de('0x7')](0x0);var _0x37d8a4=moment(_0x1e268b)[_0x53de('0x7')](0x0);return _0x5c570d['diff'](_0x37d8a4,_0x53de('0x8'));}exports[_0x53de('0x9')]=function(_0x3ca57b){return function(_0x57cbad){logger[_0x53de('0xa')](_0x3ca57b,util[_0x53de('0xb')](_0x57cbad,{'showHidden':![],'depth':null}));};};exports[_0x53de('0xc')]=function(_0x306db4,_0x5ed9a4){logger[_0x53de('0xd')](_0x306db4,util[_0x53de('0xb')](_0x5ed9a4,{'showHidden':![],'depth':null}));};exports[_0x53de('0xe')]=function(_0xeaa4e3,_0x4d48fe){logger[_0x53de('0xa')](_0xeaa4e3,util[_0x53de('0xb')](_0x4d48fe,{'showHidden':![],'depth':null}));};exports[_0x53de('0xf')]=function(_0x108920){return function(_0x3d3e0d){logger[_0x53de('0xd')](_0x108920,util[_0x53de('0xb')](_0x3d3e0d,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1f200f,_0x4cac5d,_0xd02264){return{'message':_0x1f200f,'unlock':_0x4cac5d,'active':_0xd02264};};exports['getCallerId']=function(_0x46fab2,_0x12f722,_0x59b207){if(!_['isUndefined'](_0x59b207)&&'string'===typeof _0x59b207&&!_['isEmpty'](_0x59b207)){if(!_[_0x53de('0x10')](_0x12f722)&&_0x53de('0x11')===typeof _0x12f722&&!_[_0x53de('0x12')](_0x12f722)){return util[_0x53de('0x13')](_0x53de('0x14'),_0x12f722,_0x59b207);}return util[_0x53de('0x13')](_0x53de('0x14'),_0x59b207,_0x59b207);}if(!_[_0x53de('0x10')](_0x46fab2)&&_0x53de('0x11')===typeof _0x46fab2&&!_[_0x53de('0x12')](_0x46fab2)){return _0x46fab2;}return'\x22\x22\x20<>';};exports[_0x53de('0x15')]=function(_0x4642c6){if(_[_0x53de('0x16')](_0x4642c6)){return![];}return _0x4642c6;};exports[_0x53de('0x17')]=function(_0x1dd73c,_0x47b639,_0x223373,_0x14776b,_0x28d64e,_0x29c9f0){var _0x29bdcd={'XMD-QUEUE':_0x47b639['Queue']?_0x47b639[_0x53de('0x18')][_0x53de('0x19')]:'','XMD-CALLERID':_0x14776b,'XMD-CALLERID-PREVIEW':_0x29c9f0?util[_0x53de('0x13')](_0x53de('0x14'),_0x29c9f0[_0x53de('0x1a')],_0x29c9f0[_0x53de('0x1b')]):_0x14776b,'XMD-DIALID':_0x28d64e,'XMD-CONTACTID':_0x47b639[_0x53de('0x1c')],'XMD-CDRTYPE':_0x53de('0x1d'),'CALLERID(all)':_0x14776b,'XMD-VOICEQUEUEID':_0x47b639[_0x53de('0x1e')],'XMD-DIALCHANNEL':_0x223373,'XMD-DIALTIMEOUT':_0x1dd73c[_0x53de('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x53de('0x13')](_0x53de('0x20'),_0x1dd73c[_0x53de('0x21')]?'g':'',_['isEmpty'](_0x1dd73c['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1dd73c[_0x53de('0x22')]||'','XMD-AGI':_0x1dd73c[_0x53de('0x23')]?util[_0x53de('0x13')](_0x53de('0x24'),ipAgi,_0x1dd73c[_0x53de('0x23')]):_0x53de('0x25'),'XMD-AGIAFTER':_0x1dd73c[_0x53de('0x21')]?util[_0x53de('0x13')](_0x53de('0x24'),ipAgi,_0x1dd73c[_0x53de('0x21')]):_0x53de('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x29c9f0?_0x29c9f0[_0x53de('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x29c9f0?_0x29c9f0['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x53de('0x12')](_0x1dd73c['monitor_format'])){_0x29bdcd[util[_0x53de('0x13')]('%s',_0x53de('0x27'))]=_0x1dd73c['monitor_format'];_0x29bdcd[util[_0x53de('0x13')]('%s',_0x53de('0x28'))]=_0x28d64e;}if(_0x47b639&&_0x47b639[_0x53de('0x29')]){for(var _0x2b133c in _0x47b639[_0x53de('0x29')]){if(_0x47b639[_0x53de('0x29')][_0x53de('0x2a')](_0x2b133c)){if(!_[_0x53de('0x16')](_0x47b639[_0x53de('0x29')][_0x2b133c])&&_0x2b133c!=='id'&&_0x2b133c!==_0x53de('0x2b')&&_0x2b133c!==_0x53de('0x2c')&&_0x2b133c!==_0x53de('0x2d')){_0x29bdcd[util[_0x53de('0x13')](_0x53de('0x2e'),_0x53de('0x2f'),_[_0x53de('0x30')](_0x2b133c))]=_0x47b639[_0x53de('0x29')][_0x2b133c];}}}}return _0x29bdcd;};exports[_0x53de('0x31')]=function(_0x611e69){var _0x1a7a9e={};for(var _0x5a24ab in _0x611e69){if(_0x611e69['hasOwnProperty'](_0x5a24ab)){_0x1a7a9e[util[_0x53de('0x13')]('%s',_[_0x53de('0x32')](_0x5a24ab))]=_0x611e69[_0x5a24ab];}}return{'variables':_0x1a7a9e};};exports[_0x53de('0x33')]=function(_0x3cc835,_0x3f5440){if(!_['isNil'](_0x3cc835)){if(_0x3cc835[_0x53de('0x2a')](_0x53de('0x34'))){if(_0x3cc835[_0x53de('0x34')]>0x0){_0x3cc835[_0x53de('0x34')]-=0x1;}else{logger['error'](_0x53de('0x35'),_0x3f5440);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3f5440);}};exports[_0x53de('0x36')]=function(_0x463273){var _0x39000c=moment()[_0x53de('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x463273[_0x53de('0x37')]=0xd;_0x463273[_0x53de('0x38')]='Blacklist';_0x463273['starttime']=_0x39000c;_0x463273['responsetime']=_0x39000c;_0x463273[_0x53de('0x39')]=_0x39000c;};exports[_0x53de('0x3a')]=function(_0x3c8488,_0x1418e2,_0x1ada80){var _0x3db8af=moment()[_0x53de('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c8488[_0x53de('0x37')]=_0x1418e2;_0x3c8488[_0x53de('0x38')]=_0x1ada80;_0x3c8488[_0x53de('0x3b')]=_0x3db8af;_0x3c8488[_0x53de('0x3c')]=getSeconds(_0x3c8488[_0x53de('0x3b')],_0x3c8488['starttime']);};exports[_0x53de('0x3d')]=function(_0x3b5acb,_0x1f1691,_0x4d1fab){_0x3b5acb['membername']=_0x1f1691;_0x3b5acb[_0x53de('0x3e')]=_0x4d1fab;};exports[_0x53de('0x3f')]=function(_0x505120,_0x13ed8f,_0x5d4be9){var _0x4a8872=moment()[_0x53de('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x505120[_0x53de('0x37')]=_0x13ed8f;_0x505120[_0x53de('0x38')]=_0x5d4be9;_0x505120[_0x53de('0x3b')]=_0x505120['responsetime']?_0x505120['responsetime']:_0x4a8872;_0x505120[_0x53de('0x39')]=_0x505120[_0x53de('0x39')]?_0x505120[_0x53de('0x39')]:_0x4a8872;_0x505120[_0x53de('0x3c')]=getSeconds(_0x505120[_0x53de('0x3b')]||0x0,_0x505120[_0x53de('0x40')]||0x0);_0x505120[_0x53de('0x41')]=_0x505120['answertime']?getSeconds(_0x505120[_0x53de('0x39')],_0x505120[_0x53de('0x42')]):0x0;};exports[_0x53de('0x43')]=function(_0x1ce96e){return _0x1ce96e===_0x53de('0x44');};exports[_0x53de('0x45')]=function(_0x38db42,_0x4b0a2d,_0x29e393,_0x30e768,_0x50a67e){var _0x3df0d0=_0x30e768?_0x53de('0x46'):_0x38db42['calleridname'];_0x3df0d0=_0x50a67e?_0x53de('0x47'):_0x3df0d0;return{'actionid':_0x38db42[_0x53de('0x48')],'action':_0x53de('0x49'),'channel':_0x38db42['channelAgent'],'callerid':util[_0x53de('0x13')](_0x53de('0x14'),_0x3df0d0,_0x38db42[_0x53de('0x1b')]),'Exten':'xcally-motion-preview','Context':_0x53de('0x4a'),'Priority':'1','variable':_0x29e393,'timeout':(_0x4b0a2d[_0x53de('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x38db42[_0x53de('0x48')]};};exports[_0x53de('0x4c')]=function(_0x319d3b){return _0x319d3b[_0x53de('0x4d')]+_0x319d3b['countcongestionretry']+_0x319d3b[_0x53de('0x4e')]+_0x319d3b[_0x53de('0x4f')]+_0x319d3b[_0x53de('0x50')];};exports[_0x53de('0x51')]=function(_0xac91e0){var _0x21dc59=_[_0x53de('0x52')](_0xac91e0);_0x21dc59[_0x53de('0x37')]=0xf;_0x21dc59['statedesc']=_0x53de('0x53');return _0x21dc59;};exports[_0x53de('0x54')]=function(_0x4ba61b,_0x23c06e,_0x49314f){var _0x334324={};_0x334324[_0x23c06e]=_0x4ba61b[_0x23c06e];_0x334324['active']=![];_0x334324[_0x53de('0x55')]=moment()['add'](_0x49314f,_0x53de('0x56'))[_0x53de('0x13')](_0x53de('0x57'));_0x334324[_0x53de('0x1c')]=_0x4ba61b['ContactId'];_0x334324[_0x53de('0x58')]=_0x4ba61b[_0x53de('0x58')];_0x334324[_0x53de('0x1e')]=_0x4ba61b['VoiceQueueId']||undefined;return _0x334324;};exports['decrementTalkink']=function(_0x49db04,_0x147677){if(!_['isNil'](_0x49db04)){if(_0x49db04[_0x53de('0x59')]>0x0){_0x49db04['pTalking']-=0x1;}else{logger[_0x53de('0xa')](_0x147677,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x53de('0xa')](_0x147677,_0x53de('0x5a'));}};exports[_0x53de('0x5b')]=function(_0x11c38b){if(_0x11c38b<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3d93b4,_0x99c4d9,_0x496036){_0x3d93b4[_0x53de('0x5c')]=_0x99c4d9;_0x3d93b4[_0x53de('0x19')]=_0x3d93b4[_0x53de('0x5d')];_0x3d93b4['interface']=_0x3d93b4[_0x53de('0x5e')];if(_0x496036){_0x3d93b4[_0x53de('0x5f')]=_0x496036[_0x53de('0x5f')];}return _0x3d93b4;};exports[_0x53de('0x60')]=function(_0x23f9ee){var _0x44d001={};_0x44d001['queue']=_0x23f9ee[_0x53de('0x5d')];_0x44d001[_0x53de('0x61')]=_0x23f9ee[_0x53de('0x5e')];_0x44d001['uniqueid']=_0x23f9ee[_0x53de('0x48')];return _0x44d001;};exports[_0x53de('0x62')]=function(_0x361cde){var _0x1d1c4f=[];for(var _0x216526 in _0x361cde){if(_0x361cde[_0x53de('0x2a')](_0x216526)){if(!_[_0x53de('0x16')](_0x361cde[_0x216526])&&_0x361cde[_0x216526][_0x53de('0x37')]===_0x53de('0x63')&&_0x361cde[_0x216526][_0x53de('0x64')]===_0x53de('0x65')){_0x1d1c4f[_0x53de('0x66')](_0x361cde[_0x216526]['id']);}}}return _0x1d1c4f;};exports[_0x53de('0x67')]=function(_0x4ee684){var _0x5a0cea=moment()[_0x53de('0x7')](0x0);var _0xcd9a46=moment(_0x4ee684)['milliseconds'](0x0);return _0x5a0cea[_0x53de('0x68')](_0xcd9a46,'seconds');};exports[_0x53de('0x69')]=function(_0x3e1231){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3e1231['ContactId'],'ListId':_0x3e1231[_0x53de('0x58')],'VoiceQueueId':_0x3e1231['VoiceQueueId']||undefined,'CampaignId':_0x3e1231['CampaignId']||undefined};};exports[_0x53de('0x6a')]=function(_0x59089e){if(_0x59089e===_0x53de('0x48')||_0x59089e===_0x53de('0x6b')||_0x59089e===_0x53de('0x5d')||_0x59089e===_0x53de('0x6c')||_0x59089e===_0x53de('0x6d')||_0x59089e==='dialAnswer'||_0x59089e===_0x53de('0x6e')||_0x59089e==='channelAgent'||_0x59089e===_0x53de('0x1a')||_0x59089e==='active'||_0x59089e==='calleridnum'||_0x59089e===_0x53de('0x55')||_0x59089e===_0x53de('0x4d')||_0x59089e==='countcongestionretry'||_0x59089e===_0x53de('0x4e')||_0x59089e===_0x53de('0x6f')||_0x59089e===_0x53de('0x70')||_0x59089e===_0x53de('0x71')||_0x59089e===_0x53de('0x72')||_0x59089e==='recallme'||_0x59089e===_0x53de('0x1c')||_0x59089e===_0x53de('0x58')||_0x59089e===_0x53de('0x3e')||_0x59089e==='VoiceQueueId'||_0x59089e===_0x53de('0x73')||_0x59089e==='xmd-voicequeueid'||_0x59089e==='xmd-queue'||_0x59089e==='xmd-phone'||_0x59089e==='xmd-listid'||_0x59089e==='xmd-dialurl'||_0x59089e===_0x53de('0x74')||_0x59089e===_0x53de('0x75')||_0x59089e===_0x53de('0x76')||_0x59089e===_0x53de('0x77')||_0x59089e===_0x53de('0x78')||_0x59089e==='xmd-cdrtype'||_0x59089e===_0x53de('0x79')||_0x59089e===_0x53de('0x7a')||_0x59089e===_0x53de('0x7b')||_0x59089e===_0x53de('0x7c')||_0x59089e===_0x53de('0x7d')||_0x59089e===_0x53de('0x7e')||_0x59089e===_0x53de('0x7f')||_0x59089e===_0x53de('0x80')||_0x59089e===_0x53de('0x81')||_0x59089e===_0x53de('0x82')||_0x59089e===_0x53de('0x83')||_0x59089e===_0x53de('0x7c')||_0x59089e===_0x53de('0x7d')||_0x59089e==='rtpaudioqosjitter'||_0x59089e===_0x53de('0x7f')||_0x59089e===_0x53de('0x80')||_0x59089e===_0x53de('0x81')||_0x59089e===_0x53de('0x82')||_0x59089e===_0x53de('0x83')||_0x59089e===_0x53de('0x84')||_0x59089e==='bridgepvtcallid'||_0x59089e===_0x53de('0x37')||_0x59089e==='statedesc'){return![];}return!![];};exports[_0x53de('0x85')]=function(_0x1e8c40,_0x19a84d){var _0x45387c,_0x1319e9,_0x4f67c2;if(_0x19a84d<=0x0){_0x19a84d=0x1;}_0x45387c=new RegExp(_0x53de('0x86')+_0x19a84d+'}$');_0x1319e9=Math[_0x53de('0x87')](0xa,_0x19a84d-0x1);_0x4f67c2=Math[_0x53de('0x87')](0xa,_0x19a84d)-0x1;return util[_0x53de('0x13')]('%s',_[_0x53de('0x88')](_0x1e8c40,_0x45387c,_[_0x53de('0x89')](_0x1319e9,_0x4f67c2)));};exports[_0x53de('0x8a')]=function(_0x2ecf15){var _0x160da1=_0x2ecf15[_0x53de('0x8b')](/"(.*?)"/);return _0x160da1?_0x160da1[0x1]:_0x2ecf15;};exports[_0x53de('0x8c')]=function(_0x4c71e6){var _0x384a46=_0x4c71e6[_0x53de('0x8b')](/<(.*?)>/);return _0x384a46?_0x384a46[0x1]:_0x4c71e6;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 517885d..b370369 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(_0xb02dae,_0x313b4d){var _0x10bc17=function(_0x26fdcd){while(--_0x26fdcd){_0xb02dae['push'](_0xb02dae['shift']());}};_0x10bc17(++_0x313b4d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11e5ff,_0x411ff2){_0x11e5ff=_0x11e5ff-0x0;var _0x15a333=_0x5f2f[_0x11e5ff];return _0x15a333;};'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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x25b441,_0x366362){var _0x5e3cab=function(_0x4d85c7){while(--_0x4d85c7){_0x25b441['push'](_0x25b441['shift']());}};_0x5e3cab(++_0x366362);}(_0xb10b,0x12a));var _0xbb10=function(_0x38edc7,_0x5d0576){_0x38edc7=_0x38edc7-0x0;var _0x3eb41e=_0xb10b[_0x38edc7];return _0x3eb41e;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6a9e051..81f1b5a 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 _0x3233=['campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isUndefined','initTelephones','length','initTrunks','trunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','queuecallercompleteAt','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','triggers'];(function(_0x5bf241,_0x30c0b1){var _0x46c6de=function(_0x3e512a){while(--_0x3e512a){_0x5bf241['push'](_0x5bf241['shift']());}};_0x46c6de(++_0x30c0b1);}(_0x3233,0xc5));var _0x3323=function(_0x12e414,_0x4a9d37){_0x12e414=_0x12e414-0x0;var _0x32624d=_0x3233[_0x12e414];return _0x32624d;};'use strict';var BPromise=require(_0x3323('0x0'));var util=require(_0x3323('0x1'));var _=require(_0x3323('0x2'));var moment=require(_0x3323('0x3'));var Agent=require(_0x3323('0x4'));var Telephone=require(_0x3323('0x5'));var Trunk=require(_0x3323('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x3323('0x7'));var Template=require(_0x3323('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x3323('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x3323('0xa'));var FreshdeskAccount=require(_0x3323('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x3323('0xc'));var DeskAccount=require(_0x3323('0xd'));var VtigerAccount=require(_0x3323('0xe'));var ServicenowAccount=require(_0x3323('0xf'));var Dynamics365Account=require(_0x3323('0x10'));var FreshsalesAccount=require(_0x3323('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x3323('0x12')]={};this[_0x3323('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0x3323('0x14')]={};this[_0x3323('0x15')]={};this[_0x3323('0x16')]={};this[_0x3323('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3323('0x18')]={};this[_0x3323('0x19')]={};this[_0x3323('0x1a')]={};this['outboundChannels']={};this[_0x3323('0x1b')]={};this[_0x3323('0x1c')]={};this[_0x3323('0x1d')]={};this[_0x3323('0x1e')]={};this[_0x3323('0x1f')]={};this[_0x3323('0x20')]={};this[_0x3323('0x21')]={};this[_0x3323('0x22')]={};this[_0x3323('0x23')]={};this['dynamics365Accounts']={};this[_0x3323('0x24')]={};this[_0x3323('0x25')]={};};function freeIsNotKey(_0x45751a,_0x3e7d8b,_0x10f76e){var _0x5366ff=_[_0x3323('0x26')](_0x45751a,function(_0x18c5a9,_0x344c6b){return _0x18c5a9[_0x10f76e];});for(var _0x5e78a0 in _0x3e7d8b){if(_0x3e7d8b[_0x3323('0x27')](_0x5e78a0)){if(!_0x5366ff[_0x5e78a0]){delete _0x3e7d8b[_0x5e78a0];}}}}function freeIsNotKeySip(_0x5a6d14,_0x446b53){var _0x2b80a6=_[_0x3323('0x26')](_0x5a6d14,function(_0xd5fb2e,_0x161a87){return util[_0x3323('0x28')](_0x3323('0x29'),_0xd5fb2e['name']);});for(var _0x1778a0 in _0x446b53){if(_0x446b53[_0x3323('0x27')](_0x1778a0)){if(!_0x2b80a6[_0x1778a0]){delete _0x446b53[_0x1778a0];}}}}function freeIsNotKeyAgent(_0x5c476e,_0x43c348){var _0x32a9d6=_[_0x3323('0x26')](_0x5c476e,function(_0x1f8f13,_0x3fca35){var _0x4f236d=_['isNil'](_0x1f8f13['interface'])?util['format'](_0x3323('0x29'),_0x1f8f13[_0x3323('0x2a')]):_0x1f8f13[_0x3323('0x2b')];return _0x4f236d;});for(var _0x58b710 in _0x43c348){if(_0x43c348[_0x3323('0x27')](_0x58b710)){if(!_0x32a9d6[_0x58b710]){delete _0x43c348[_0x58b710];}}}}function clearVoiceCallReports(_0x4294b7){_0x4294b7[_0x3323('0x2c')]=0x0;_0x4294b7[_0x3323('0x2d')]=0x0;_0x4294b7[_0x3323('0x2e')]=0x0;_0x4294b7[_0x3323('0x2f')]=0x0;_0x4294b7['sumBillable']=0x0;}function clearCampaigns(_0x26edf5){if(!_[_0x3323('0x30')](_0x26edf5)){for(var _0x5e83f3 in _0x26edf5){if(_0x26edf5[_0x3323('0x27')](_0x5e83f3)){_0x26edf5[_0x5e83f3]['ivrTotalCallsDays']=0x0;_0x26edf5[_0x5e83f3][_0x3323('0x31')]=0x0;}}}}function clearVoiceQueues(_0x21bb53){if(!_[_0x3323('0x30')](_0x21bb53)){for(var _0x458775 in _0x21bb53){if(_0x21bb53['hasOwnProperty'](_0x458775)){_0x21bb53[_0x458775]['total']=0x0;_0x21bb53[_0x458775][_0x3323('0x2d')]=0x0;_0x21bb53[_0x458775][_0x3323('0x32')]=0x0;_0x21bb53[_0x458775]['abandoned']=0x0;_0x21bb53[_0x458775][_0x3323('0x2e')]=0x0;_0x21bb53[_0x458775]['sumDuration']=0x0;_0x21bb53[_0x458775]['sumBillable']=0x0;_0x21bb53[_0x458775][_0x3323('0x33')]=0x0;_0x21bb53[_0x458775]['outboundNoAnswerCallsDay']=0x0;_0x21bb53[_0x458775][_0x3323('0x34')]=0x0;_0x21bb53[_0x458775][_0x3323('0x35')]=0x0;_0x21bb53[_0x458775][_0x3323('0x36')]=0x0;_0x21bb53[_0x458775][_0x3323('0x37')]=0x0;_0x21bb53[_0x458775][_0x3323('0x38')]=0x0;_0x21bb53[_0x458775][_0x3323('0x39')]=0x0;_0x21bb53[_0x458775][_0x3323('0x3a')]=0x0;_0x21bb53[_0x458775]['outboundOriginateFailureCallsDay']=0x0;_0x21bb53[_0x458775][_0x3323('0x3b')]=0x0;_0x21bb53[_0x458775][_0x3323('0x3c')]=0x0;_0x21bb53[_0x458775][_0x3323('0x33')]=0x0;_0x21bb53[_0x458775]['outboundAnswerCallsDay']=0x0;_0x21bb53[_0x458775][_0x3323('0x3d')]=!![];}}}}Realtime[_0x3323('0x3e')][_0x3323('0x3f')]=function(_0x4b0408,_0x466a93){for(var _0x55ff11 in _0x466a93){if(_0x4b0408[_0x3323('0x27')](_0x55ff11)){_0x4b0408[_0x55ff11]=_0x466a93[_0x55ff11];}}};Realtime[_0x3323('0x3e')]['initAgents']=function(){var _0x27005e=this;return function(_0xfeba46){if(_0xfeba46){freeIsNotKeyAgent(_0xfeba46,_0x27005e['agents']);for(var _0x139fbe=0x0,_0x1de96f={},_0x25580f={};_0x139fbe<_0xfeba46['length'];_0x139fbe+=0x1){_0x1de96f=_0xfeba46[_0x139fbe];var _0x223154=_['isNil'](_0x1de96f[_0x3323('0x2b')])?util['format'](_0x3323('0x29'),_0x1de96f[_0x3323('0x2a')]):_0x1de96f[_0x3323('0x2b')];if(_[_0x3323('0x40')](_0x27005e[_0x3323('0x12')][_0x223154])){_0x27005e[_0x3323('0x12')][_0x223154]=new Agent(_0x1de96f);}else{_0x27005e[_0x3323('0x3f')](_0x27005e['agents'][_0x223154],_0x1de96f);}}}return _0x27005e[_0x3323('0x12')];};};Realtime[_0x3323('0x3e')][_0x3323('0x41')]=function(){var _0x476ded=this;return function(_0x248c54){if(_0x248c54){freeIsNotKeySip(_0x248c54,_0x476ded[_0x3323('0x13')]);for(var _0x48e38d=0x0,_0x3de42a={},_0x5c2343={};_0x48e38d<_0x248c54[_0x3323('0x42')];_0x48e38d+=0x1){_0x3de42a=_0x248c54[_0x48e38d];if(_[_0x3323('0x40')](_0x476ded[_0x3323('0x13')][util[_0x3323('0x28')](_0x3323('0x29'),_0x3de42a[_0x3323('0x2a')])])){_0x476ded[_0x3323('0x13')][util[_0x3323('0x28')](_0x3323('0x29'),_0x3de42a[_0x3323('0x2a')])]=new Telephone(_0x3de42a);}else{_0x476ded[_0x3323('0x3f')](_0x476ded[_0x3323('0x13')][util[_0x3323('0x28')](_0x3323('0x29'),_0x3de42a['name'])],_0x3de42a);}}}return _0x476ded[_0x3323('0x13')];};};Realtime[_0x3323('0x3e')][_0x3323('0x43')]=function(){var _0x3b5057=this;return function(_0x922c72){if(_0x922c72){freeIsNotKeySip(_0x922c72,_0x3b5057[_0x3323('0x44')]);for(var _0x4cec13=0x0,_0x3f371d={},_0xd4217b={};_0x4cec13<_0x922c72['length'];_0x4cec13+=0x1){_0x3f371d=_0x922c72[_0x4cec13];if(_['isUndefined'](_0x3b5057['trunks'][util[_0x3323('0x28')]('SIP/%s',_0x3f371d[_0x3323('0x2a')])])){_0x3b5057['trunks'][util[_0x3323('0x28')](_0x3323('0x29'),_0x3f371d['name'])]=new Trunk(_0x3f371d);}else{_0x3b5057[_0x3323('0x3f')](_0x3b5057['trunks'][util[_0x3323('0x28')](_0x3323('0x29'),_0x3f371d[_0x3323('0x2a')])],_0x3f371d);}}}return _0x3b5057[_0x3323('0x44')];};};Realtime['prototype'][_0x3323('0x45')]=function(){var _0x55d841=this;return function(_0x194365){if(_0x194365){freeIsNotKey(_0x194365,_0x55d841[_0x3323('0x46')],_0x3323('0x2a'));for(var _0xf25f80=0x0,_0x597744={},_0x5626c1={};_0xf25f80<_0x194365[_0x3323('0x42')];_0xf25f80+=0x1){_0x597744=_0x194365[_0xf25f80];if(_['isUndefined'](_0x55d841[_0x3323('0x46')][_0x597744['name']])){_0x55d841[_0x3323('0x46')][_0x597744[_0x3323('0x2a')]]=new VoiceQueue(_0x597744);}else{_0x55d841[_0x3323('0x3f')](_0x55d841[_0x3323('0x46')][_0x597744[_0x3323('0x2a')]],_0x597744);}}}return _0x55d841[_0x3323('0x46')];};};Realtime['prototype'][_0x3323('0x47')]=function(){var _0x33d093=this;return function(_0x57c167){if(_0x57c167){freeIsNotKey(_0x57c167,_0x33d093['triggers'],'id');for(var _0x331bce=0x0,_0x5570f3={},_0x506d3a={};_0x331bce<_0x57c167[_0x3323('0x42')];_0x331bce+=0x1){_0x5570f3=_0x57c167[_0x331bce];if(_[_0x3323('0x40')](_0x33d093['triggers'][_0x5570f3['id']])){_0x33d093['triggers'][_0x5570f3['id']]=new Trigger(_0x5570f3);}else{_0x33d093[_0x3323('0x3f')](_0x33d093[_0x3323('0x14')][_0x5570f3['id']],_0x5570f3);}}}return _0x33d093['triggers'];};};Realtime[_0x3323('0x3e')][_0x3323('0x48')]=function(){var _0x329658=this;return function(_0x5d79d3){if(_0x5d79d3){freeIsNotKey(_0x5d79d3,_0x329658['templates'],'id');for(var _0x3d7d93=0x0,_0x345b55={},_0x498d2e={};_0x3d7d93<_0x5d79d3[_0x3323('0x42')];_0x3d7d93+=0x1){_0x345b55=_0x5d79d3[_0x3d7d93];if(_[_0x3323('0x40')](_0x329658[_0x3323('0x16')][_0x345b55['id']])){_0x329658[_0x3323('0x16')][_0x345b55['id']]=new Template(_0x345b55);}else{_0x329658[_0x3323('0x3f')](_0x329658['templates'][_0x345b55['id']],_0x345b55);}}}return _0x329658[_0x3323('0x16')];};};Realtime[_0x3323('0x3e')][_0x3323('0x49')]=function(){var _0x1279c8=this;return function(_0x1a603a){if(_0x1a603a){freeIsNotKey(_0x1a603a,_0x1279c8[_0x3323('0x1c')],'id');for(var _0x10e51c=0x0,_0x2275e1={},_0x580dbc={};_0x10e51c<_0x1a603a[_0x3323('0x42')];_0x10e51c+=0x1){_0x2275e1=_0x1a603a[_0x10e51c];if(_['isUndefined'](_0x1279c8[_0x3323('0x1c')][_0x2275e1['id']])){_0x1279c8['zendeskAccounts'][_0x2275e1['id']]=new ZendeskAccount(_0x2275e1);}else{_0x1279c8['mergeFromDatabase'](_0x1279c8[_0x3323('0x1c')][_0x2275e1['id']],_0x2275e1);}}}return _0x1279c8[_0x3323('0x1c')];};};Realtime[_0x3323('0x3e')][_0x3323('0x4a')]=function(){var _0x1153de=this;return function(_0x2950d7){if(_0x2950d7){freeIsNotKey(_0x2950d7,_0x1153de[_0x3323('0x1d')],'id');for(var _0x3e8e76=0x0,_0x1e6276={},_0x61b621={};_0x3e8e76<_0x2950d7[_0x3323('0x42')];_0x3e8e76+=0x1){_0x1e6276=_0x2950d7[_0x3e8e76];if(_[_0x3323('0x40')](_0x1153de[_0x3323('0x1d')][_0x1e6276['id']])){_0x1153de['salesforceAccounts'][_0x1e6276['id']]=new SalesforceAccount(_0x1e6276);}else{_0x1153de['mergeFromDatabase'](_0x1153de[_0x3323('0x1d')][_0x1e6276['id']],_0x1e6276);}}}return _0x1153de[_0x3323('0x1d')];};};Realtime[_0x3323('0x3e')][_0x3323('0x4b')]=function(){var _0x45a658=this;return function(_0x1a0f39){if(_0x1a0f39){freeIsNotKey(_0x1a0f39,_0x45a658[_0x3323('0x1f')],'id');for(var _0x4171e1=0x0,_0x3c2c37={},_0x24b6bf={};_0x4171e1<_0x1a0f39[_0x3323('0x42')];_0x4171e1+=0x1){_0x3c2c37=_0x1a0f39[_0x4171e1];if(_[_0x3323('0x40')](_0x45a658[_0x3323('0x1f')][_0x3c2c37['id']])){_0x45a658['freshdeskAccounts'][_0x3c2c37['id']]=new FreshdeskAccount(_0x3c2c37);}else{_0x45a658[_0x3323('0x3f')](_0x45a658[_0x3323('0x1f')][_0x3c2c37['id']],_0x3c2c37);}}}return _0x45a658['freshdeskAccounts'];};};Realtime[_0x3323('0x3e')][_0x3323('0x4c')]=function(){var _0xbe6445=this;return function(_0x44440f){if(_0x44440f){freeIsNotKey(_0x44440f,_0xbe6445[_0x3323('0x20')],'id');for(var _0x35a041=0x0,_0x2af067={},_0x43c7f6={};_0x35a041<_0x44440f[_0x3323('0x42')];_0x35a041+=0x1){_0x2af067=_0x44440f[_0x35a041];if(_[_0x3323('0x40')](_0xbe6445[_0x3323('0x20')][_0x2af067['id']])){_0xbe6445[_0x3323('0x20')][_0x2af067['id']]=new ZohoAccount(_0x2af067);}else{_0xbe6445['mergeFromDatabase'](_0xbe6445['zohoAccounts'][_0x2af067['id']],_0x2af067);}}}return _0xbe6445[_0x3323('0x20')];};};Realtime['prototype'][_0x3323('0x4d')]=function(){var _0x5efff3=this;return function(_0x4d721c){if(_0x4d721c){freeIsNotKey(_0x4d721c,_0x5efff3[_0x3323('0x21')],'id');for(var _0x2cac7e=0x0,_0x2de73c={},_0x1b3478={};_0x2cac7e<_0x4d721c[_0x3323('0x42')];_0x2cac7e+=0x1){_0x2de73c=_0x4d721c[_0x2cac7e];if(_[_0x3323('0x40')](_0x5efff3[_0x3323('0x21')][_0x2de73c['id']])){_0x5efff3[_0x3323('0x21')][_0x2de73c['id']]=new DeskAccount(_0x2de73c);}else{_0x5efff3[_0x3323('0x3f')](_0x5efff3[_0x3323('0x21')][_0x2de73c['id']],_0x2de73c);}}}return _0x5efff3[_0x3323('0x21')];};};Realtime['prototype'][_0x3323('0x4e')]=function(){var _0x3623df=this;return function(_0x44e621){if(_0x44e621){freeIsNotKey(_0x44e621,_0x3623df[_0x3323('0x1e')],'id');for(var _0x5afa94=0x0,_0x4e407d={},_0x3a9b6b={};_0x5afa94<_0x44e621['length'];_0x5afa94+=0x1){_0x4e407d=_0x44e621[_0x5afa94];if(_[_0x3323('0x40')](_0x3623df[_0x3323('0x1e')][_0x4e407d['id']])){_0x3623df[_0x3323('0x1e')][_0x4e407d['id']]=new SugarcrmAccount(_0x4e407d);}else{_0x3623df[_0x3323('0x3f')](_0x3623df[_0x3323('0x1e')][_0x4e407d['id']],_0x4e407d);}}}return _0x3623df[_0x3323('0x1e')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x4691ac=this;return function(_0x3974a5){if(_0x3974a5){freeIsNotKey(_0x3974a5,_0x4691ac[_0x3323('0x22')],'id');for(var _0x579e2e=0x0,_0x4ef23c={},_0x5a9265={};_0x579e2e<_0x3974a5[_0x3323('0x42')];_0x579e2e+=0x1){_0x4ef23c=_0x3974a5[_0x579e2e];if(_[_0x3323('0x40')](_0x4691ac[_0x3323('0x22')][_0x4ef23c['id']])){_0x4691ac['vtigerAccounts'][_0x4ef23c['id']]=new VtigerAccount(_0x4ef23c);}else{_0x4691ac[_0x3323('0x3f')](_0x4691ac['vtigerAccounts'][_0x4ef23c['id']],_0x4ef23c);}}}return _0x4691ac[_0x3323('0x22')];};};Realtime[_0x3323('0x3e')][_0x3323('0x4f')]=function(){var _0x53f6ce=this;return function(_0x2436e3){if(_0x2436e3){freeIsNotKey(_0x2436e3,_0x53f6ce[_0x3323('0x23')],'id');for(var _0x1cf3ec=0x0,_0x25a66c={},_0x56657b={};_0x1cf3ec<_0x2436e3[_0x3323('0x42')];_0x1cf3ec+=0x1){_0x25a66c=_0x2436e3[_0x1cf3ec];if(_[_0x3323('0x40')](_0x53f6ce[_0x3323('0x23')][_0x25a66c['id']])){_0x53f6ce[_0x3323('0x23')][_0x25a66c['id']]=new ServicenowAccount(_0x25a66c);}else{_0x53f6ce['mergeFromDatabase'](_0x53f6ce[_0x3323('0x23')][_0x25a66c['id']],_0x25a66c);}}}return _0x53f6ce['servicenowAccounts'];};};Realtime[_0x3323('0x3e')][_0x3323('0x50')]=function(){var _0x53a046=this;return function(_0x52beb1){if(_0x52beb1){freeIsNotKey(_0x52beb1,_0x53a046[_0x3323('0x51')],'id');for(var _0x5700af=0x0,_0x3189a4={},_0x74df14={};_0x5700af<_0x52beb1[_0x3323('0x42')];_0x5700af+=0x1){_0x3189a4=_0x52beb1[_0x5700af];if(_[_0x3323('0x40')](_0x53a046[_0x3323('0x51')][_0x3189a4['id']])){_0x53a046[_0x3323('0x51')][_0x3189a4['id']]=new Dynamics365Account(_0x3189a4);}else{_0x53a046[_0x3323('0x3f')](_0x53a046[_0x3323('0x51')][_0x3189a4['id']],_0x3189a4);}}}return _0x53a046[_0x3323('0x51')];};};Realtime[_0x3323('0x3e')][_0x3323('0x52')]=function(){var _0x5baf86=this;return function(_0xb44442){if(_0xb44442){freeIsNotKey(_0xb44442,_0x5baf86['freshsalesAccounts'],'id');for(var _0x41b25d=0x0,_0x1dfb3d={},_0x446cd4={};_0x41b25d<_0xb44442['length'];_0x41b25d+=0x1){_0x1dfb3d=_0xb44442[_0x41b25d];if(_['isUndefined'](_0x5baf86[_0x3323('0x24')][_0x1dfb3d['id']])){_0x5baf86[_0x3323('0x24')][_0x1dfb3d['id']]=new FreshsalesAccount(_0x1dfb3d);}else{_0x5baf86[_0x3323('0x3f')](_0x5baf86[_0x3323('0x24')][_0x1dfb3d['id']],_0x1dfb3d);}}}return _0x5baf86[_0x3323('0x24')];};};Realtime[_0x3323('0x3e')][_0x3323('0x53')]=function(){var _0xb607c0=this;return function(_0x2934f8){for(var _0x9fe7e3=0x0;_0x9fe7e3<_0x2934f8[_0x3323('0x42')];_0x9fe7e3+=0x1){_['merge'](_0xb607c0[_0x3323('0x46')][_0x2934f8[_0x9fe7e3]['name']],_0x2934f8[_0x9fe7e3]);}return _0xb607c0[_0x3323('0x46')];};};Realtime[_0x3323('0x3e')]['initVoiceQueueReports']=function(){var _0x3abecb=this;return function(_0x1b4f2a){clearVoiceQueues(_0x3abecb[_0x3323('0x46')]);if(_0x1b4f2a){_0x1b4f2a=_[_0x3323('0x54')](_0x1b4f2a,_0x3323('0x55'));for(var _0x3c950c in _0x1b4f2a){if(_0x1b4f2a['hasOwnProperty'](_0x3c950c)){var _0xba4c18={};for(var _0x442975=0x0;_0x442975<_0x1b4f2a[_0x3c950c][_0x3323('0x42')];_0x442975+=0x1){var _0x16e517=_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x56')];if(_0x3abecb[_0x3323('0x46')][_0x16e517]){if(_0x1b4f2a[_0x3c950c][_0x442975]['queuecallerexit']){_0x3abecb[_0x3323('0x46')][_0x16e517]['unmanaged']+=0x1;}if(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x57')]){_0x3abecb['voiceQueues'][_0x16e517][_0x3323('0x58')]+=0x1;}_0x3abecb[_0x3323('0x46')][_0x16e517]['sumHoldTime']+=moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x59')])[_0x3323('0x5a')](moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5b')]),_0x3323('0x5c'))||0x0;if(_0x442975===_0x1b4f2a[_0x3c950c]['length']-0x1){_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2f')]+=moment(_0x1b4f2a[_0x3c950c][_0x442975]['queuecallercompleteAt']||_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5d')]||_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5e')])[_0x3323('0x5a')](moment(_0x1b4f2a[_0x3c950c][_0x442975]['queuecallerjoinAt']),'seconds')||0x0;_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2c')]+=0x1;if(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5f')]){_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2d')]+=0x1;_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x60')]+=moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x61')])[_0x3323('0x5a')](moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x59')]),'seconds')||0x0;}}else{_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2f')]+=_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2e')]||0x0;}}}}}}return _0x3abecb['voiceQueues'];};};Realtime[_0x3323('0x3e')]['initVoiceCallReports']=function(){var _0x3b9ac2=this;return function(_0x21f19a){clearVoiceCallReports(_0x3b9ac2['outbound']);if(_0x21f19a){for(var _0x44712d=0x0;_0x44712d<_0x21f19a[_0x3323('0x42')];_0x44712d+=0x1){_0x3b9ac2[_0x3323('0x17')]['total']+=0x1;_0x3b9ac2[_0x3323('0x17')][_0x3323('0x2f')]+=_0x21f19a[_0x44712d][_0x3323('0x62')];if(_0x21f19a[_0x44712d][_0x3323('0x63')]===_0x3323('0x64')){_0x3b9ac2[_0x3323('0x17')][_0x3323('0x2d')]+=0x1;_0x3b9ac2[_0x3323('0x17')][_0x3323('0x2e')]+=_0x21f19a[_0x44712d][_0x3323('0x62')]-_0x21f19a[_0x44712d][_0x3323('0x65')]||0x0;_0x3b9ac2['outbound'][_0x3323('0x60')]+=_0x21f19a[_0x44712d][_0x3323('0x65')];}}}return _0x3b9ac2[_0x3323('0x17')];};};Realtime[_0x3323('0x3e')][_0x3323('0x66')]=function(){var _0x47c2ed=this;return function(_0x1e444b){if(_0x1e444b){freeIsNotKey(_0x1e444b,_0x47c2ed[_0x3323('0x15')],'name');for(var _0x5259a4=0x0,_0x3d3963={};_0x5259a4<_0x1e444b['length'];_0x5259a4+=0x1){_0x3d3963=_0x1e444b[_0x5259a4];if(_[_0x3323('0x40')](_0x47c2ed['campaigns'][_0x3d3963[_0x3323('0x2a')]])){_0x47c2ed[_0x3323('0x15')][_0x3d3963['name']]=new Campaign(_0x3d3963);}else{_0x47c2ed[_0x3323('0x3f')](_0x47c2ed['campaigns'][_0x3d3963[_0x3323('0x2a')]],_0x3d3963);_0x47c2ed[_0x3323('0x15')][_0x3d3963[_0x3323('0x2a')]][_0x3323('0x67')]=_0x3d3963['SquareProject']?_0x3d3963[_0x3323('0x68')]['name']:undefined;}}}return _0x47c2ed[_0x3323('0x15')];};};Realtime[_0x3323('0x3e')]['initVoiceExtensions']=function(){var _0x17acce=this;return function(_0x49a034){if(_0x49a034){freeIsNotKey(_0x49a034,_0x17acce[_0x3323('0x18')],'id');for(var _0x1a4004=0x0,_0xaed88d={};_0x1a4004<_0x49a034[_0x3323('0x42')];_0x1a4004+=0x1){_0xaed88d=_0x49a034[_0x1a4004];if(_[_0x3323('0x40')](_0x17acce['voiceExtensions'][_0xaed88d['id']])){_0x17acce['voiceExtensions'][_0xaed88d['id']]=new VoiceExtension(_0xaed88d);}else{_0x17acce[_0x3323('0x3f')](_0x17acce[_0x3323('0x18')][_0xaed88d['id']],_0xaed88d);}}}return _0x17acce['voiceExtensions'];};};Realtime[_0x3323('0x3e')][_0x3323('0x69')]=function(){var _0x2648db=this;return function(_0x5abed0){clearCampaigns(_0x2648db[_0x3323('0x15')]);for(var _0xd591bb=0x0;_0xd591bb<_0x5abed0[_0x3323('0x42')];_0xd591bb+=0x1){_[_0x3323('0x6a')](_0x2648db[_0x3323('0x15')][_0x5abed0[_0xd591bb]['name']],_0x5abed0[_0xd591bb]);}return _0x2648db['campaigns'];};};Realtime[_0x3323('0x3e')][_0x3323('0x6b')]=function(){var _0x45b74b=this;return function(_0x1a781e){if(_0x1a781e){freeIsNotKey(_0x1a781e,_0x45b74b[_0x3323('0x25')],'id');for(var _0x777ff4=0x0,_0x1b1f29={},_0x3b4613={};_0x777ff4<_0x1a781e[_0x3323('0x42')];_0x777ff4+=0x1){_0x1b1f29=_0x1a781e[_0x777ff4];if(_[_0x3323('0x40')](_0x45b74b['faxAccounts'][_0x1b1f29['id']])){_0x45b74b[_0x3323('0x25')][_0x1b1f29['id']]=new FaxAccount(_0x1b1f29);}else{_0x45b74b[_0x3323('0x3f')](_0x45b74b[_0x3323('0x25')][_0x1b1f29['id']],_0x1b1f29);}}}return _0x45b74b[_0x3323('0x25')];};};module[_0x3323('0x6c')]=Realtime; \ No newline at end of file +var _0x2162=['sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','isUndefined','agents','initTelephones','initTrunks','initVoiceQueues','voiceQueues','length','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','telephones','trunks','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged'];(function(_0x3410f3,_0x516979){var _0x5f2755=function(_0x305883){while(--_0x305883){_0x3410f3['push'](_0x3410f3['shift']());}};_0x5f2755(++_0x516979);}(_0x2162,0x110));var _0x2216=function(_0x35fe8c,_0x2d5ac){_0x35fe8c=_0x35fe8c-0x0;var _0x346a2a=_0x2162[_0x35fe8c];return _0x346a2a;};'use strict';var BPromise=require('bluebird');var util=require(_0x2216('0x0'));var _=require('lodash');var moment=require(_0x2216('0x1'));var Agent=require(_0x2216('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2216('0x3'));var VoiceQueue=require(_0x2216('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2216('0x5'));var Campaign=require(_0x2216('0x6'));var VoiceExtension=require(_0x2216('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x2216('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x2216('0x9'));var DeskAccount=require(_0x2216('0xa'));var VtigerAccount=require(_0x2216('0xb'));var ServicenowAccount=require(_0x2216('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x2216('0xd')]={};this[_0x2216('0xe')]={};this['voiceQueues']={};this[_0x2216('0xf')]={};this[_0x2216('0x10')]={};this[_0x2216('0x11')]={};this[_0x2216('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2216('0x13')]={};this[_0x2216('0x14')]={};this[_0x2216('0x15')]={};this[_0x2216('0x16')]={};this[_0x2216('0x17')]={};this[_0x2216('0x18')]={};this[_0x2216('0x19')]={};this[_0x2216('0x1a')]={};this['zohoAccounts']={};this[_0x2216('0x1b')]={};this[_0x2216('0x1c')]={};this['servicenowAccounts']={};this[_0x2216('0x1d')]={};this['freshsalesAccounts']={};this[_0x2216('0x1e')]={};};function freeIsNotKey(_0x9e6c0b,_0x337fcf,_0x1048c8){var _0x219326=_[_0x2216('0x1f')](_0x9e6c0b,function(_0x1aa3c9,_0x1e0392){return _0x1aa3c9[_0x1048c8];});for(var _0x3d480f in _0x337fcf){if(_0x337fcf[_0x2216('0x20')](_0x3d480f)){if(!_0x219326[_0x3d480f]){delete _0x337fcf[_0x3d480f];}}}}function freeIsNotKeySip(_0x3bc0f5,_0x280c71){var _0x376a36=_[_0x2216('0x1f')](_0x3bc0f5,function(_0x15699a,_0x4ea6c6){return util[_0x2216('0x21')](_0x2216('0x22'),_0x15699a[_0x2216('0x23')]);});for(var _0x230faa in _0x280c71){if(_0x280c71['hasOwnProperty'](_0x230faa)){if(!_0x376a36[_0x230faa]){delete _0x280c71[_0x230faa];}}}}function freeIsNotKeyAgent(_0x24f6a4,_0x3ea24e){var _0x361c00=_[_0x2216('0x1f')](_0x24f6a4,function(_0x54538b,_0x5edf09){var _0x5a0881=_[_0x2216('0x24')](_0x54538b[_0x2216('0x25')])?util['format'](_0x2216('0x22'),_0x54538b[_0x2216('0x23')]):_0x54538b[_0x2216('0x25')];return _0x5a0881;});for(var _0x3935c3 in _0x3ea24e){if(_0x3ea24e[_0x2216('0x20')](_0x3935c3)){if(!_0x361c00[_0x3935c3]){delete _0x3ea24e[_0x3935c3];}}}}function clearVoiceCallReports(_0x4e730e){_0x4e730e[_0x2216('0x26')]=0x0;_0x4e730e[_0x2216('0x27')]=0x0;_0x4e730e[_0x2216('0x28')]=0x0;_0x4e730e[_0x2216('0x29')]=0x0;_0x4e730e['sumBillable']=0x0;}function clearCampaigns(_0x1ed9f4){if(!_[_0x2216('0x2a')](_0x1ed9f4)){for(var _0x23018d in _0x1ed9f4){if(_0x1ed9f4[_0x2216('0x20')](_0x23018d)){_0x1ed9f4[_0x23018d][_0x2216('0x2b')]=0x0;_0x1ed9f4[_0x23018d][_0x2216('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x22a6db){if(!_[_0x2216('0x2a')](_0x22a6db)){for(var _0x4d0ebc in _0x22a6db){if(_0x22a6db[_0x2216('0x20')](_0x4d0ebc)){_0x22a6db[_0x4d0ebc]['total']=0x0;_0x22a6db[_0x4d0ebc]['answered']=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x2d')]=0x0;_0x22a6db[_0x4d0ebc]['abandoned']=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x28')]=0x0;_0x22a6db[_0x4d0ebc]['sumDuration']=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x2e')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x2f')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x30')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x31')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x32')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x33')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x34')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x35')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x36')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x37')]=0x0;_0x22a6db[_0x4d0ebc]['outboundOriginateFailureCallsDay']=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x38')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x39')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x2f')]=0x0;_0x22a6db[_0x4d0ebc][_0x2216('0x3a')]=0x0;_0x22a6db[_0x4d0ebc]['queueStatusComplete']=!![];}}}}Realtime[_0x2216('0x3b')][_0x2216('0x3c')]=function(_0x696d31,_0x3e3d62){for(var _0x26b93b in _0x3e3d62){if(_0x696d31[_0x2216('0x20')](_0x26b93b)){_0x696d31[_0x26b93b]=_0x3e3d62[_0x26b93b];}}};Realtime[_0x2216('0x3b')][_0x2216('0x3d')]=function(){var _0x56dda9=this;return function(_0x2760ce){if(_0x2760ce){freeIsNotKeyAgent(_0x2760ce,_0x56dda9['agents']);for(var _0x647f2a=0x0,_0x102018={},_0x56d7c1={};_0x647f2a<_0x2760ce['length'];_0x647f2a+=0x1){_0x102018=_0x2760ce[_0x647f2a];var _0x45980a=_[_0x2216('0x24')](_0x102018[_0x2216('0x25')])?util[_0x2216('0x21')](_0x2216('0x22'),_0x102018[_0x2216('0x23')]):_0x102018[_0x2216('0x25')];if(_[_0x2216('0x3e')](_0x56dda9['agents'][_0x45980a])){_0x56dda9['agents'][_0x45980a]=new Agent(_0x102018);}else{_0x56dda9[_0x2216('0x3c')](_0x56dda9[_0x2216('0x3f')][_0x45980a],_0x102018);}}}return _0x56dda9[_0x2216('0x3f')];};};Realtime['prototype'][_0x2216('0x40')]=function(){var _0x2beefe=this;return function(_0x311f4a){if(_0x311f4a){freeIsNotKeySip(_0x311f4a,_0x2beefe[_0x2216('0xd')]);for(var _0x4eee0a=0x0,_0x3a9c6b={},_0x2f4e41={};_0x4eee0a<_0x311f4a['length'];_0x4eee0a+=0x1){_0x3a9c6b=_0x311f4a[_0x4eee0a];if(_[_0x2216('0x3e')](_0x2beefe[_0x2216('0xd')][util[_0x2216('0x21')]('SIP/%s',_0x3a9c6b[_0x2216('0x23')])])){_0x2beefe[_0x2216('0xd')][util[_0x2216('0x21')]('SIP/%s',_0x3a9c6b[_0x2216('0x23')])]=new Telephone(_0x3a9c6b);}else{_0x2beefe['mergeFromDatabase'](_0x2beefe[_0x2216('0xd')][util[_0x2216('0x21')](_0x2216('0x22'),_0x3a9c6b[_0x2216('0x23')])],_0x3a9c6b);}}}return _0x2beefe[_0x2216('0xd')];};};Realtime[_0x2216('0x3b')][_0x2216('0x41')]=function(){var _0x31d3d3=this;return function(_0x2041c5){if(_0x2041c5){freeIsNotKeySip(_0x2041c5,_0x31d3d3[_0x2216('0xe')]);for(var _0x17ca61=0x0,_0x23767c={},_0x568b05={};_0x17ca61<_0x2041c5['length'];_0x17ca61+=0x1){_0x23767c=_0x2041c5[_0x17ca61];if(_[_0x2216('0x3e')](_0x31d3d3['trunks'][util['format']('SIP/%s',_0x23767c[_0x2216('0x23')])])){_0x31d3d3[_0x2216('0xe')][util[_0x2216('0x21')](_0x2216('0x22'),_0x23767c[_0x2216('0x23')])]=new Trunk(_0x23767c);}else{_0x31d3d3[_0x2216('0x3c')](_0x31d3d3[_0x2216('0xe')][util[_0x2216('0x21')](_0x2216('0x22'),_0x23767c[_0x2216('0x23')])],_0x23767c);}}}return _0x31d3d3['trunks'];};};Realtime['prototype'][_0x2216('0x42')]=function(){var _0xb577b=this;return function(_0x34c190){if(_0x34c190){freeIsNotKey(_0x34c190,_0xb577b[_0x2216('0x43')],_0x2216('0x23'));for(var _0x6775f3=0x0,_0x3e4e15={},_0x24d0c2={};_0x6775f3<_0x34c190[_0x2216('0x44')];_0x6775f3+=0x1){_0x3e4e15=_0x34c190[_0x6775f3];if(_[_0x2216('0x3e')](_0xb577b[_0x2216('0x43')][_0x3e4e15[_0x2216('0x23')]])){_0xb577b[_0x2216('0x43')][_0x3e4e15[_0x2216('0x23')]]=new VoiceQueue(_0x3e4e15);}else{_0xb577b[_0x2216('0x3c')](_0xb577b[_0x2216('0x43')][_0x3e4e15[_0x2216('0x23')]],_0x3e4e15);}}}return _0xb577b['voiceQueues'];};};Realtime['prototype'][_0x2216('0x45')]=function(){var _0x5d100d=this;return function(_0x485d6d){if(_0x485d6d){freeIsNotKey(_0x485d6d,_0x5d100d[_0x2216('0xf')],'id');for(var _0x32a6d6=0x0,_0x3c17cd={},_0x2885ea={};_0x32a6d6<_0x485d6d[_0x2216('0x44')];_0x32a6d6+=0x1){_0x3c17cd=_0x485d6d[_0x32a6d6];if(_[_0x2216('0x3e')](_0x5d100d['triggers'][_0x3c17cd['id']])){_0x5d100d[_0x2216('0xf')][_0x3c17cd['id']]=new Trigger(_0x3c17cd);}else{_0x5d100d['mergeFromDatabase'](_0x5d100d[_0x2216('0xf')][_0x3c17cd['id']],_0x3c17cd);}}}return _0x5d100d[_0x2216('0xf')];};};Realtime[_0x2216('0x3b')][_0x2216('0x46')]=function(){var _0x5a8c62=this;return function(_0x32d133){if(_0x32d133){freeIsNotKey(_0x32d133,_0x5a8c62[_0x2216('0x11')],'id');for(var _0x1fa26d=0x0,_0x33397b={},_0x1dfc3c={};_0x1fa26d<_0x32d133[_0x2216('0x44')];_0x1fa26d+=0x1){_0x33397b=_0x32d133[_0x1fa26d];if(_[_0x2216('0x3e')](_0x5a8c62['templates'][_0x33397b['id']])){_0x5a8c62['templates'][_0x33397b['id']]=new Template(_0x33397b);}else{_0x5a8c62['mergeFromDatabase'](_0x5a8c62[_0x2216('0x11')][_0x33397b['id']],_0x33397b);}}}return _0x5a8c62[_0x2216('0x11')];};};Realtime[_0x2216('0x3b')][_0x2216('0x47')]=function(){var _0x5f09cb=this;return function(_0x4e2f27){if(_0x4e2f27){freeIsNotKey(_0x4e2f27,_0x5f09cb[_0x2216('0x17')],'id');for(var _0x3d4e2c=0x0,_0x239d0f={},_0x30552a={};_0x3d4e2c<_0x4e2f27[_0x2216('0x44')];_0x3d4e2c+=0x1){_0x239d0f=_0x4e2f27[_0x3d4e2c];if(_[_0x2216('0x3e')](_0x5f09cb[_0x2216('0x17')][_0x239d0f['id']])){_0x5f09cb[_0x2216('0x17')][_0x239d0f['id']]=new ZendeskAccount(_0x239d0f);}else{_0x5f09cb[_0x2216('0x3c')](_0x5f09cb['zendeskAccounts'][_0x239d0f['id']],_0x239d0f);}}}return _0x5f09cb[_0x2216('0x17')];};};Realtime[_0x2216('0x3b')][_0x2216('0x48')]=function(){var _0x29c41c=this;return function(_0x12d4fa){if(_0x12d4fa){freeIsNotKey(_0x12d4fa,_0x29c41c[_0x2216('0x18')],'id');for(var _0xdb6a6e=0x0,_0x396e82={},_0x2bd923={};_0xdb6a6e<_0x12d4fa[_0x2216('0x44')];_0xdb6a6e+=0x1){_0x396e82=_0x12d4fa[_0xdb6a6e];if(_[_0x2216('0x3e')](_0x29c41c['salesforceAccounts'][_0x396e82['id']])){_0x29c41c[_0x2216('0x18')][_0x396e82['id']]=new SalesforceAccount(_0x396e82);}else{_0x29c41c['mergeFromDatabase'](_0x29c41c['salesforceAccounts'][_0x396e82['id']],_0x396e82);}}}return _0x29c41c[_0x2216('0x18')];};};Realtime[_0x2216('0x3b')][_0x2216('0x49')]=function(){var _0x12dd81=this;return function(_0x40f0c8){if(_0x40f0c8){freeIsNotKey(_0x40f0c8,_0x12dd81[_0x2216('0x1a')],'id');for(var _0x1d5d73=0x0,_0x26af0c={},_0x3cdb91={};_0x1d5d73<_0x40f0c8[_0x2216('0x44')];_0x1d5d73+=0x1){_0x26af0c=_0x40f0c8[_0x1d5d73];if(_['isUndefined'](_0x12dd81[_0x2216('0x1a')][_0x26af0c['id']])){_0x12dd81[_0x2216('0x1a')][_0x26af0c['id']]=new FreshdeskAccount(_0x26af0c);}else{_0x12dd81[_0x2216('0x3c')](_0x12dd81[_0x2216('0x1a')][_0x26af0c['id']],_0x26af0c);}}}return _0x12dd81[_0x2216('0x1a')];};};Realtime[_0x2216('0x3b')]['initZohoAccounts']=function(){var _0x31c623=this;return function(_0x4dc8d4){if(_0x4dc8d4){freeIsNotKey(_0x4dc8d4,_0x31c623['zohoAccounts'],'id');for(var _0x22c985=0x0,_0x4bd5fd={},_0x3bf2d0={};_0x22c985<_0x4dc8d4[_0x2216('0x44')];_0x22c985+=0x1){_0x4bd5fd=_0x4dc8d4[_0x22c985];if(_[_0x2216('0x3e')](_0x31c623[_0x2216('0x4a')][_0x4bd5fd['id']])){_0x31c623['zohoAccounts'][_0x4bd5fd['id']]=new ZohoAccount(_0x4bd5fd);}else{_0x31c623[_0x2216('0x3c')](_0x31c623['zohoAccounts'][_0x4bd5fd['id']],_0x4bd5fd);}}}return _0x31c623[_0x2216('0x4a')];};};Realtime[_0x2216('0x3b')][_0x2216('0x4b')]=function(){var _0x16f121=this;return function(_0x4c495b){if(_0x4c495b){freeIsNotKey(_0x4c495b,_0x16f121[_0x2216('0x1b')],'id');for(var _0x539b08=0x0,_0x51b8ee={},_0x2ce7c1={};_0x539b08<_0x4c495b[_0x2216('0x44')];_0x539b08+=0x1){_0x51b8ee=_0x4c495b[_0x539b08];if(_['isUndefined'](_0x16f121['deskAccounts'][_0x51b8ee['id']])){_0x16f121[_0x2216('0x1b')][_0x51b8ee['id']]=new DeskAccount(_0x51b8ee);}else{_0x16f121['mergeFromDatabase'](_0x16f121['deskAccounts'][_0x51b8ee['id']],_0x51b8ee);}}}return _0x16f121[_0x2216('0x1b')];};};Realtime[_0x2216('0x3b')]['initSugarcrmAccounts']=function(){var _0x24463b=this;return function(_0x179f2d){if(_0x179f2d){freeIsNotKey(_0x179f2d,_0x24463b[_0x2216('0x19')],'id');for(var _0x162310=0x0,_0x4b4e24={},_0x41b657={};_0x162310<_0x179f2d[_0x2216('0x44')];_0x162310+=0x1){_0x4b4e24=_0x179f2d[_0x162310];if(_[_0x2216('0x3e')](_0x24463b['sugarcrmAccounts'][_0x4b4e24['id']])){_0x24463b[_0x2216('0x19')][_0x4b4e24['id']]=new SugarcrmAccount(_0x4b4e24);}else{_0x24463b[_0x2216('0x3c')](_0x24463b[_0x2216('0x19')][_0x4b4e24['id']],_0x4b4e24);}}}return _0x24463b[_0x2216('0x19')];};};Realtime[_0x2216('0x3b')]['initVtigerAccounts']=function(){var _0x506259=this;return function(_0x14caf5){if(_0x14caf5){freeIsNotKey(_0x14caf5,_0x506259[_0x2216('0x1c')],'id');for(var _0xc673e7=0x0,_0x3ca1d7={},_0x276d31={};_0xc673e7<_0x14caf5[_0x2216('0x44')];_0xc673e7+=0x1){_0x3ca1d7=_0x14caf5[_0xc673e7];if(_[_0x2216('0x3e')](_0x506259[_0x2216('0x1c')][_0x3ca1d7['id']])){_0x506259['vtigerAccounts'][_0x3ca1d7['id']]=new VtigerAccount(_0x3ca1d7);}else{_0x506259[_0x2216('0x3c')](_0x506259['vtigerAccounts'][_0x3ca1d7['id']],_0x3ca1d7);}}}return _0x506259[_0x2216('0x1c')];};};Realtime[_0x2216('0x3b')]['initServicenowAccounts']=function(){var _0x55ae02=this;return function(_0x148eb4){if(_0x148eb4){freeIsNotKey(_0x148eb4,_0x55ae02['servicenowAccounts'],'id');for(var _0x24ea79=0x0,_0x31b238={},_0x19648c={};_0x24ea79<_0x148eb4['length'];_0x24ea79+=0x1){_0x31b238=_0x148eb4[_0x24ea79];if(_[_0x2216('0x3e')](_0x55ae02[_0x2216('0x4c')][_0x31b238['id']])){_0x55ae02['servicenowAccounts'][_0x31b238['id']]=new ServicenowAccount(_0x31b238);}else{_0x55ae02[_0x2216('0x3c')](_0x55ae02['servicenowAccounts'][_0x31b238['id']],_0x31b238);}}}return _0x55ae02[_0x2216('0x4c')];};};Realtime[_0x2216('0x3b')][_0x2216('0x4d')]=function(){var _0x5abbeb=this;return function(_0x7e1589){if(_0x7e1589){freeIsNotKey(_0x7e1589,_0x5abbeb[_0x2216('0x1d')],'id');for(var _0x228ee9=0x0,_0x189833={},_0x3fdd26={};_0x228ee9<_0x7e1589[_0x2216('0x44')];_0x228ee9+=0x1){_0x189833=_0x7e1589[_0x228ee9];if(_[_0x2216('0x3e')](_0x5abbeb['dynamics365Accounts'][_0x189833['id']])){_0x5abbeb[_0x2216('0x1d')][_0x189833['id']]=new Dynamics365Account(_0x189833);}else{_0x5abbeb[_0x2216('0x3c')](_0x5abbeb[_0x2216('0x1d')][_0x189833['id']],_0x189833);}}}return _0x5abbeb[_0x2216('0x1d')];};};Realtime[_0x2216('0x3b')][_0x2216('0x4e')]=function(){var _0x1ef7a7=this;return function(_0x5baede){if(_0x5baede){freeIsNotKey(_0x5baede,_0x1ef7a7[_0x2216('0x4f')],'id');for(var _0x394c61=0x0,_0x259298={},_0x3d7d3f={};_0x394c61<_0x5baede[_0x2216('0x44')];_0x394c61+=0x1){_0x259298=_0x5baede[_0x394c61];if(_[_0x2216('0x3e')](_0x1ef7a7[_0x2216('0x4f')][_0x259298['id']])){_0x1ef7a7[_0x2216('0x4f')][_0x259298['id']]=new FreshsalesAccount(_0x259298);}else{_0x1ef7a7[_0x2216('0x3c')](_0x1ef7a7[_0x2216('0x4f')][_0x259298['id']],_0x259298);}}}return _0x1ef7a7[_0x2216('0x4f')];};};Realtime['prototype'][_0x2216('0x50')]=function(){var _0x4331a5=this;return function(_0x6b094){for(var _0x154254=0x0;_0x154254<_0x6b094['length'];_0x154254+=0x1){_[_0x2216('0x51')](_0x4331a5[_0x2216('0x43')][_0x6b094[_0x154254][_0x2216('0x23')]],_0x6b094[_0x154254]);}return _0x4331a5[_0x2216('0x43')];};};Realtime[_0x2216('0x3b')]['initVoiceQueueReports']=function(){var _0x3ee8b2=this;return function(_0x252b1a){clearVoiceQueues(_0x3ee8b2[_0x2216('0x43')]);if(_0x252b1a){_0x252b1a=_[_0x2216('0x52')](_0x252b1a,'uniqueid');for(var _0x1e238c in _0x252b1a){if(_0x252b1a[_0x2216('0x20')](_0x1e238c)){var _0x485b11={};for(var _0x4a74ad=0x0;_0x4a74ad<_0x252b1a[_0x1e238c]['length'];_0x4a74ad+=0x1){var _0x26bf17=_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x53')];if(_0x3ee8b2[_0x2216('0x43')][_0x26bf17]){if(_0x252b1a[_0x1e238c][_0x4a74ad]['queuecallerexit']){_0x3ee8b2['voiceQueues'][_0x26bf17][_0x2216('0x2d')]+=0x1;}if(_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x54')]){_0x3ee8b2['voiceQueues'][_0x26bf17][_0x2216('0x55')]+=0x1;}_0x3ee8b2[_0x2216('0x43')][_0x26bf17][_0x2216('0x28')]+=moment(_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x56')])[_0x2216('0x57')](moment(_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x58')]),_0x2216('0x59'))||0x0;if(_0x4a74ad===_0x252b1a[_0x1e238c][_0x2216('0x44')]-0x1){_0x3ee8b2[_0x2216('0x43')][_0x26bf17]['sumDuration']+=moment(_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x5a')]||_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x5b')]||_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x5c')])[_0x2216('0x57')](moment(_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x58')]),_0x2216('0x59'))||0x0;_0x3ee8b2['voiceQueues'][_0x26bf17][_0x2216('0x26')]+=0x1;if(_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x5d')]){_0x3ee8b2[_0x2216('0x43')][_0x26bf17][_0x2216('0x27')]+=0x1;_0x3ee8b2[_0x2216('0x43')][_0x26bf17][_0x2216('0x2e')]+=moment(_0x252b1a[_0x1e238c][_0x4a74ad]['queuecallercompleteAt'])['diff'](moment(_0x252b1a[_0x1e238c][_0x4a74ad][_0x2216('0x56')]),'seconds')||0x0;}}else{_0x3ee8b2[_0x2216('0x43')][_0x26bf17][_0x2216('0x29')]+=_0x3ee8b2['voiceQueues'][_0x26bf17][_0x2216('0x28')]||0x0;}}}}}}return _0x3ee8b2[_0x2216('0x43')];};};Realtime['prototype'][_0x2216('0x5e')]=function(){var _0x154c3b=this;return function(_0x32b894){clearVoiceCallReports(_0x154c3b[_0x2216('0x12')]);if(_0x32b894){for(var _0x33af27=0x0;_0x33af27<_0x32b894[_0x2216('0x44')];_0x33af27+=0x1){_0x154c3b['outbound'][_0x2216('0x26')]+=0x1;_0x154c3b['outbound'][_0x2216('0x29')]+=_0x32b894[_0x33af27][_0x2216('0x5f')];if(_0x32b894[_0x33af27][_0x2216('0x60')]===_0x2216('0x61')){_0x154c3b[_0x2216('0x12')][_0x2216('0x27')]+=0x1;_0x154c3b[_0x2216('0x12')][_0x2216('0x28')]+=_0x32b894[_0x33af27][_0x2216('0x5f')]-_0x32b894[_0x33af27][_0x2216('0x62')]||0x0;_0x154c3b[_0x2216('0x12')]['sumBillable']+=_0x32b894[_0x33af27][_0x2216('0x62')];}}}return _0x154c3b[_0x2216('0x12')];};};Realtime[_0x2216('0x3b')][_0x2216('0x63')]=function(){var _0x1c6b93=this;return function(_0x3c39f4){if(_0x3c39f4){freeIsNotKey(_0x3c39f4,_0x1c6b93[_0x2216('0x10')],'name');for(var _0xc278b6=0x0,_0x21114d={};_0xc278b6<_0x3c39f4[_0x2216('0x44')];_0xc278b6+=0x1){_0x21114d=_0x3c39f4[_0xc278b6];if(_[_0x2216('0x3e')](_0x1c6b93[_0x2216('0x10')][_0x21114d[_0x2216('0x23')]])){_0x1c6b93[_0x2216('0x10')][_0x21114d['name']]=new Campaign(_0x21114d);}else{_0x1c6b93[_0x2216('0x3c')](_0x1c6b93[_0x2216('0x10')][_0x21114d['name']],_0x21114d);_0x1c6b93[_0x2216('0x10')][_0x21114d[_0x2216('0x23')]][_0x2216('0x64')]=_0x21114d['SquareProject']?_0x21114d[_0x2216('0x65')][_0x2216('0x23')]:undefined;}}}return _0x1c6b93[_0x2216('0x10')];};};Realtime['prototype'][_0x2216('0x66')]=function(){var _0xd93ed8=this;return function(_0xdd45a){if(_0xdd45a){freeIsNotKey(_0xdd45a,_0xd93ed8[_0x2216('0x67')],'id');for(var _0x370a2b=0x0,_0x2a9e5c={};_0x370a2b<_0xdd45a[_0x2216('0x44')];_0x370a2b+=0x1){_0x2a9e5c=_0xdd45a[_0x370a2b];if(_[_0x2216('0x3e')](_0xd93ed8['voiceExtensions'][_0x2a9e5c['id']])){_0xd93ed8[_0x2216('0x67')][_0x2a9e5c['id']]=new VoiceExtension(_0x2a9e5c);}else{_0xd93ed8[_0x2216('0x3c')](_0xd93ed8[_0x2216('0x67')][_0x2a9e5c['id']],_0x2a9e5c);}}}return _0xd93ed8['voiceExtensions'];};};Realtime[_0x2216('0x3b')][_0x2216('0x68')]=function(){var _0xd03ae5=this;return function(_0x5d71a9){clearCampaigns(_0xd03ae5[_0x2216('0x10')]);for(var _0x4a3cd1=0x0;_0x4a3cd1<_0x5d71a9[_0x2216('0x44')];_0x4a3cd1+=0x1){_['merge'](_0xd03ae5[_0x2216('0x10')][_0x5d71a9[_0x4a3cd1][_0x2216('0x23')]],_0x5d71a9[_0x4a3cd1]);}return _0xd03ae5[_0x2216('0x10')];};};Realtime['prototype'][_0x2216('0x69')]=function(){var _0x2feeb3=this;return function(_0x38215c){if(_0x38215c){freeIsNotKey(_0x38215c,_0x2feeb3[_0x2216('0x1e')],'id');for(var _0x1e8b15=0x0,_0x43f73b={},_0x37d5fb={};_0x1e8b15<_0x38215c[_0x2216('0x44')];_0x1e8b15+=0x1){_0x43f73b=_0x38215c[_0x1e8b15];if(_[_0x2216('0x3e')](_0x2feeb3[_0x2216('0x1e')][_0x43f73b['id']])){_0x2feeb3[_0x2216('0x1e')][_0x43f73b['id']]=new FaxAccount(_0x43f73b);}else{_0x2feeb3[_0x2216('0x3c')](_0x2feeb3[_0x2216('0x1e')][_0x43f73b['id']],_0x43f73b);}}}return _0x2feeb3[_0x2216('0x1e')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b360588..a7dc9ba 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 _0x2b59=['lastAssignedTo','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceCallReport','exten','type','lastapplication','queue','lastdata','context','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','connectedlinenum','calleridname','transfers','linkedid','uniqueid','monitors','length','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','create','startsWith','indexOf','find','phone','substring','membername','transfererlinkedid','attendedTransfer','exports','util','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','prototype','sync','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','accountcode','isNil','name','interface','SIP/%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b59,0x1b5));var _0x92b5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b59[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x92b5('0x0'));var config=require('../../../config/environment');var ami=require(_0x92b5('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x92b5('0x2'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x92b5('0x3'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x92b5('0x4'));var RpcVoiceTransferReport=require(_0x92b5('0x5'));var VoiceQueueReport=require(_0x92b5('0x6'));var VoiceCallReport=require(_0x92b5('0x7'));var VoiceAgentReport=require(_0x92b5('0x8'));var VoiceDialReport=require(_0x92b5('0x9'));var UserReport=require(_0x92b5('0xa'));function Report(_0x712ce4){this['realtime']=_0x712ce4;this[_0x92b5('0xb')]=_0x712ce4[_0x92b5('0xb')];this['telephones']=_0x712ce4['telephones'];}Report[_0x92b5('0xc')][_0x92b5('0xd')]=function(_0x23b25b){var _0x130f54=new VoiceQueueReport(this[_0x92b5('0xe')]);var _0x47dc2f=new VoiceAgentReport(this[_0x92b5('0xe')]);var _0x1e0052=new VoiceDialReport(this[_0x92b5('0xe')]);var _0x374b9a=new VoiceCallReport(this[_0x92b5('0xe')]);var _0x408589=new UserReport(this[_0x92b5('0xe')]);if(config[_0x92b5('0xf')]&&config[_0x92b5('0xf')][_0x92b5('0x10')]){ami['on']('custom:voiceQueueReport',this[_0x92b5('0x11')][_0x92b5('0x12')](this));ami['on'](_0x92b5('0x13'),this['voiceCallReport'][_0x92b5('0x12')](this));ami['on']('custom:voiceAgentReport',this[_0x92b5('0x14')]['bind'](this));ami['on'](_0x92b5('0x15'),this[_0x92b5('0x16')][_0x92b5('0x12')](this));ami['on'](_0x92b5('0x17'),this[_0x92b5('0x18')][_0x92b5('0x12')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x92b5('0x12')](this));}};Report[_0x92b5('0xc')][_0x92b5('0x19')]=function(_0x50a9bc){var _0x4d621f;_0x4d621f=_['find'](this[_0x92b5('0xb')],function(_0x16b741){return _0x16b741[_0x92b5('0x1a')]==_0x50a9bc||_0x16b741['name']==_0x50a9bc;});if(_[_0x92b5('0x1b')](_0x4d621f)){var _0x4b51eb=_['find'](this['telephones'],function(_0x516086){return _0x516086['accountcode']==_0x50a9bc||_0x516086[_0x92b5('0x1c')]==_0x50a9bc;});if(_0x4b51eb){_0x4d621f=_['find'](this[_0x92b5('0xb')],function(_0x4d9cbc){return _0x4d9cbc[_0x92b5('0x1d')]==util['format'](_0x92b5('0x1e'),_0x4b51eb[_0x92b5('0x1c')]);});}}return _0x4d621f;};Report['prototype'][_0x92b5('0x11')]=function(_0x2a76b2){for(var _0x4a6414=0x0;_0x4a6414<_0x2a76b2['length'];_0x4a6414+=0x1){var _0x3f3e5b=this[_0x92b5('0x19')](_0x2a76b2[_0x4a6414]['connectedlinenum']);if(_0x3f3e5b){_0x2a76b2[_0x4a6414][_0x92b5('0x1a')]=_0x3f3e5b[_0x92b5('0x1a')];_0x2a76b2[_0x4a6414]['assigned']=!![];_0x2a76b2[_0x4a6414][_0x92b5('0x1f')]=_0x3f3e5b[_0x92b5('0x1c')];_0x2a76b2[_0x4a6414][_0x92b5('0x1d')]=_[_0x92b5('0x1b')](_0x3f3e5b[_0x92b5('0x1d')])?util[_0x92b5('0x20')]('SIP/%s',_0x3f3e5b[_0x92b5('0x1c')]):_0x3f3e5b['interface'];if(_0x2a76b2[_0x4a6414][_0x92b5('0x21')]){_0x2a76b2[_0x4a6414]['queuecallercompleteAt']=moment()[_0x92b5('0x20')](_0x92b5('0x22'));}if(_0x2a76b2[_0x4a6414][_0x92b5('0x23')]){_0x2a76b2[_0x4a6414][_0x92b5('0x24')]=moment()[_0x92b5('0x20')](_0x92b5('0x22'));}RpcMemberReport[_0x92b5('0x11')](_0x2a76b2[_0x4a6414]);}RpcVoiceQueueReport['create'](_0x2a76b2[_0x4a6414]);}};function extractCalleridNumber(_0x14dbe0){var _0x120864=_0x14dbe0['match'](/<(.*?)>/);return _0x120864?_0x120864[0x1]:_0x14dbe0;}Report[_0x92b5('0xc')][_0x92b5('0x25')]=function(_0x222f78){_0x222f78['destination']=_0x222f78['destination']||_0x222f78[_0x92b5('0x26')];if(_0x222f78[_0x92b5('0x27')]=='dialer'){_0x222f78[_0x92b5('0x28')]=_0x92b5('0x29');_0x222f78[_0x92b5('0x2a')]=_0x222f78[_0x92b5('0x29')];if(_0x222f78[_0x92b5('0x2b')]=='from-voip-provider'){_0x222f78['accountcode']='';_0x222f78[_0x92b5('0x2c')]=extractCalleridNumber(_0x222f78[_0x92b5('0x2d')]);}else if(_0x222f78[_0x92b5('0x2b')]==_0x92b5('0x2e')){if(_0x222f78['destination']==_0x92b5('0x2f')){_0x222f78['destination']=extractCalleridNumber(_0x222f78[_0x92b5('0x30')]);_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x32')];_0x222f78[_0x92b5('0x33')]=[_0x222f78[_0x92b5('0x34')],_0x222f78[_0x92b5('0x34')]=_0x222f78[_0x92b5('0x33')]][0x0];_0x222f78['callerid']=_0x222f78[_0x92b5('0x30')];}else{_0x222f78[_0x92b5('0x2c')]=_0x222f78[_0x92b5('0x31')];_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x32')];if(_0x222f78['disposition']==_0x92b5('0x35')){_0x222f78[_0x92b5('0x1a')]=_0x222f78[_0x92b5('0x36')];}else{_0x222f78['accountcode']='';}}}}else{_0x222f78[_0x92b5('0x2d')]=util[_0x92b5('0x20')]('\x22%s\x22\x20<%s>',_0x222f78[_0x92b5('0x37')],_0x222f78[_0x92b5('0x31')]);}if(RpcVoiceTransferReport[_0x92b5('0x38')][_0x222f78[_0x92b5('0x39')]]){var _0x3824c0=RpcVoiceTransferReport['transfers'][_0x222f78[_0x92b5('0x39')]];_0x3824c0['transfereelinkedid']=_0x222f78[_0x92b5('0x3a')];RpcVoiceTransferReport[_0x92b5('0x18')](_0x3824c0);delete RpcVoiceTransferReport[_0x92b5('0x38')][_0x222f78[_0x92b5('0x39')]];}RpcVoiceCallReport['create'](_0x222f78);if(_0x222f78['monitor']){for(var _0x545712=0x0;_0x545712<_0x222f78[_0x92b5('0x3b')][_0x92b5('0x3c')];_0x545712+=0x1){_0x222f78[_0x92b5('0x3d')]=_0x222f78[_0x92b5('0x3b')][_0x545712][_0x92b5('0x3e')];_0x222f78[_0x92b5('0x3f')]=_0x222f78['monitors'][_0x545712][_0x92b5('0x3f')];if(_0x222f78[_0x92b5('0x26')]==_0x92b5('0x2f')){_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x36')];_0x222f78[_0x92b5('0x37')]=_0x222f78[_0x92b5('0x40')];_0x222f78['connectedlinenum']=_0x222f78[_0x92b5('0x1a')];_0x222f78[_0x92b5('0x40')]=_0x222f78['membername'];_0x222f78[_0x92b5('0x26')]=_0x222f78['originatecalleridnum'];}else if(_0x222f78[_0x92b5('0x26')]==_0x92b5('0x41')){_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x2c')];_0x222f78['exten']=_0x222f78[_0x92b5('0x32')];}RpcVoiceRecording['create'](_0x222f78);}}};Report[_0x92b5('0xc')][_0x92b5('0x14')]=function(_0x2162e3){if(_[_0x92b5('0x42')](_0x2162e3)){_0x2162e3[_0x92b5('0x43')](function(_0x409986){RpcVoiceAgentReport[_0x92b5('0x44')](_0x409986);});}else{RpcVoiceAgentReport[_0x92b5('0x44')](_0x2162e3);}};Report['prototype']['voiceDialReport']=function(_0x5c2c89){RpcVoiceDialReport[_0x92b5('0x44')](_0x5c2c89);var _0x3b5ee3;var _0x36940b;var _0x11bb21=_0x5c2c89['channel'];if(_[_0x92b5('0x45')](_0x11bb21,'Local')){_0x36940b=_0x11bb21['substring'](_0x11bb21[_0x92b5('0x46')]('/')+0x1,_0x11bb21[_0x92b5('0x46')]('@'));_0x3b5ee3=_[_0x92b5('0x47')](this[_0x92b5('0xb')],function(_0x5e3913){return _0x5e3913['mobile']==_0x36940b||_0x5e3913[_0x92b5('0x48')]==_0x36940b||_0x5e3913[_0x92b5('0x1a')]==_0x36940b;});}else{_0x36940b=_0x11bb21[_0x92b5('0x49')](_0x11bb21['indexOf']('/')+0x1,_0x11bb21['lastIndexOf']('-'));_0x3b5ee3=this[_0x92b5('0x19')](_0x36940b);}if(_0x3b5ee3){_0x5c2c89[_0x92b5('0x1d')]=_[_0x92b5('0x1b')](_0x3b5ee3[_0x92b5('0x1d')])?util['format'](_0x92b5('0x1e'),_0x3b5ee3['name']):_0x3b5ee3['interface'];_0x5c2c89[_0x92b5('0x4a')]=_0x3b5ee3[_0x92b5('0x1c')];_0x5c2c89[_0x92b5('0x1a')]=_0x3b5ee3[_0x92b5('0x1a')];RpcMemberReport[_0x92b5('0x16')](_0x5c2c89);}};Report['prototype'][_0x92b5('0x18')]=function(_0x508aeb){RpcVoiceTransferReport[_0x92b5('0x38')][_0x508aeb[_0x92b5('0x4b')]]=_0x508aeb;};Report[_0x92b5('0xc')][_0x92b5('0x4c')]=function(_0x81882a){RpcVoiceTransferReport[_0x92b5('0x4c')](_0x81882a);};module[_0x92b5('0x4d')]=Report; \ No newline at end of file +var _0x16bf=['assigned','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','type','queue','lastdata','from-voip-provider','destination','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','isArray','forEach','voiceDialReport','create','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','moment','util','../ami','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','connectedlinenum'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x16bf,0x184));var _0xf16b=function(_0x164632,_0x3e8d96){_0x164632=_0x164632-0x0;var _0x3c0d90=_0x16bf[_0x164632];return _0x3c0d90;};'use strict';var _=require(_0xf16b('0x0'));var moment=require(_0xf16b('0x1'));var util=require(_0xf16b('0x2'));var config=require('../../../config/environment');var ami=require(_0xf16b('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xf16b('0x4'));var RpcVoiceQueueReport=require(_0xf16b('0x5'));var RpcVoiceRecording=require(_0xf16b('0x6'));var RpcVoiceTransferReport=require(_0xf16b('0x7'));var VoiceQueueReport=require(_0xf16b('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xf16b('0x9'));var VoiceDialReport=require(_0xf16b('0xa'));var UserReport=require(_0xf16b('0xb'));function Report(_0x5d84e4){this[_0xf16b('0xc')]=_0x5d84e4;this[_0xf16b('0xd')]=_0x5d84e4[_0xf16b('0xd')];this[_0xf16b('0xe')]=_0x5d84e4[_0xf16b('0xe')];}Report[_0xf16b('0xf')][_0xf16b('0x10')]=function(_0x1cc5ca){var _0x2081d2=new VoiceQueueReport(this[_0xf16b('0xc')]);var _0x528d29=new VoiceAgentReport(this[_0xf16b('0xc')]);var _0xf266ef=new VoiceDialReport(this[_0xf16b('0xc')]);var _0xbbd62c=new VoiceCallReport(this['realtime']);var _0x407baa=new UserReport(this[_0xf16b('0xc')]);if(config[_0xf16b('0x11')]&&config['xdr'][_0xf16b('0x12')]){ami['on'](_0xf16b('0x13'),this[_0xf16b('0x14')][_0xf16b('0x15')](this));ami['on']('custom:voiceCallReport',this[_0xf16b('0x16')][_0xf16b('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0xf16b('0x17')][_0xf16b('0x15')](this));ami['on'](_0xf16b('0x18'),this['voiceDialReport']['bind'](this));ami['on'](_0xf16b('0x19'),this[_0xf16b('0x1a')][_0xf16b('0x15')](this));ami['on'](_0xf16b('0x1b'),this[_0xf16b('0x1c')][_0xf16b('0x15')](this));}};Report[_0xf16b('0xf')][_0xf16b('0x1d')]=function(_0x11443e){var _0x565588;_0x565588=_[_0xf16b('0x1e')](this[_0xf16b('0xd')],function(_0x38febd){return _0x38febd[_0xf16b('0x1f')]==_0x11443e||_0x38febd[_0xf16b('0x20')]==_0x11443e;});if(_[_0xf16b('0x21')](_0x565588)){var _0x2ee66a=_[_0xf16b('0x1e')](this['telephones'],function(_0x56e512){return _0x56e512[_0xf16b('0x1f')]==_0x11443e||_0x56e512['name']==_0x11443e;});if(_0x2ee66a){_0x565588=_['find'](this[_0xf16b('0xd')],function(_0x249e9d){return _0x249e9d['interface']==util[_0xf16b('0x22')](_0xf16b('0x23'),_0x2ee66a[_0xf16b('0x20')]);});}}return _0x565588;};Report[_0xf16b('0xf')][_0xf16b('0x14')]=function(_0x30163f){for(var _0x43c399=0x0;_0x43c399<_0x30163f['length'];_0x43c399+=0x1){var _0x58c162=this[_0xf16b('0x1d')](_0x30163f[_0x43c399][_0xf16b('0x24')]);if(_0x58c162){_0x30163f[_0x43c399]['accountcode']=_0x58c162[_0xf16b('0x1f')];_0x30163f[_0x43c399][_0xf16b('0x25')]=!![];_0x30163f[_0x43c399]['lastAssignedTo']=_0x58c162[_0xf16b('0x20')];_0x30163f[_0x43c399][_0xf16b('0x26')]=_['isNil'](_0x58c162[_0xf16b('0x26')])?util['format'](_0xf16b('0x23'),_0x58c162[_0xf16b('0x20')]):_0x58c162['interface'];if(_0x30163f[_0x43c399][_0xf16b('0x27')]){_0x30163f[_0x43c399][_0xf16b('0x28')]=moment()['format'](_0xf16b('0x29'));}if(_0x30163f[_0x43c399]['queuecallerexit']){_0x30163f[_0x43c399][_0xf16b('0x2a')]=moment()[_0xf16b('0x22')](_0xf16b('0x29'));}RpcMemberReport[_0xf16b('0x14')](_0x30163f[_0x43c399]);}RpcVoiceQueueReport['create'](_0x30163f[_0x43c399]);}};function extractCalleridNumber(_0x2ad38d){var _0x4e53b6=_0x2ad38d[_0xf16b('0x2b')](/<(.*?)>/);return _0x4e53b6?_0x4e53b6[0x1]:_0x2ad38d;}Report[_0xf16b('0xf')][_0xf16b('0x16')]=function(_0x499bc0){_0x499bc0['destination']=_0x499bc0['destination']||_0x499bc0['exten'];if(_0x499bc0[_0xf16b('0x2c')]=='dialer'){_0x499bc0['lastapplication']=_0xf16b('0x2d');_0x499bc0[_0xf16b('0x2e')]=_0x499bc0[_0xf16b('0x2d')];if(_0x499bc0['context']==_0xf16b('0x2f')){_0x499bc0[_0xf16b('0x1f')]='';_0x499bc0[_0xf16b('0x30')]=extractCalleridNumber(_0x499bc0[_0xf16b('0x31')]);}else if(_0x499bc0[_0xf16b('0x32')]==_0xf16b('0x33')){if(_0x499bc0[_0xf16b('0x30')]==_0xf16b('0x34')){_0x499bc0[_0xf16b('0x30')]=extractCalleridNumber(_0x499bc0[_0xf16b('0x35')]);_0x499bc0[_0xf16b('0x36')]=_0x499bc0[_0xf16b('0x37')];_0x499bc0[_0xf16b('0x38')]=[_0x499bc0[_0xf16b('0x39')],_0x499bc0[_0xf16b('0x39')]=_0x499bc0['destinationchannel']][0x0];_0x499bc0['callerid']=_0x499bc0['calleridpreview'];}else{_0x499bc0['destination']=_0x499bc0['calleridnum'];_0x499bc0['calleridnum']=_0x499bc0[_0xf16b('0x37')];if(_0x499bc0[_0xf16b('0x3a')]=='ANSWERED'){_0x499bc0[_0xf16b('0x1f')]=_0x499bc0[_0xf16b('0x24')];}else{_0x499bc0[_0xf16b('0x1f')]='';}}}}else{_0x499bc0[_0xf16b('0x31')]=util[_0xf16b('0x22')](_0xf16b('0x3b'),_0x499bc0[_0xf16b('0x3c')],_0x499bc0[_0xf16b('0x36')]);}if(RpcVoiceTransferReport['transfers'][_0x499bc0['linkedid']]){var _0x3ecfd5=RpcVoiceTransferReport[_0xf16b('0x3d')][_0x499bc0[_0xf16b('0x3e')]];_0x3ecfd5[_0xf16b('0x3f')]=_0x499bc0[_0xf16b('0x40')];RpcVoiceTransferReport[_0xf16b('0x1a')](_0x3ecfd5);delete RpcVoiceTransferReport[_0xf16b('0x3d')][_0x499bc0['linkedid']];}RpcVoiceCallReport['create'](_0x499bc0);if(_0x499bc0[_0xf16b('0x41')]){for(var _0x4aeb6c=0x0;_0x4aeb6c<_0x499bc0[_0xf16b('0x42')]['length'];_0x4aeb6c+=0x1){_0x499bc0[_0xf16b('0x43')]=_0x499bc0[_0xf16b('0x42')][_0x4aeb6c][_0xf16b('0x44')];_0x499bc0[_0xf16b('0x45')]=_0x499bc0['monitors'][_0x4aeb6c]['createdAt'];if(_0x499bc0[_0xf16b('0x46')]==_0xf16b('0x34')){_0x499bc0[_0xf16b('0x36')]=_0x499bc0[_0xf16b('0x24')];_0x499bc0['calleridname']=_0x499bc0[_0xf16b('0x47')];_0x499bc0['connectedlinenum']=_0x499bc0['accountcode'];_0x499bc0['connectedlinename']=_0x499bc0[_0xf16b('0x48')];_0x499bc0[_0xf16b('0x46')]=_0x499bc0[_0xf16b('0x37')];}else if(_0x499bc0[_0xf16b('0x46')]=='xcally-motion-dialer'){_0x499bc0[_0xf16b('0x36')]=_0x499bc0['destination'];_0x499bc0[_0xf16b('0x46')]=_0x499bc0[_0xf16b('0x37')];}RpcVoiceRecording['create'](_0x499bc0);}}};Report[_0xf16b('0xf')][_0xf16b('0x17')]=function(_0x16197b){if(_[_0xf16b('0x49')](_0x16197b)){_0x16197b[_0xf16b('0x4a')](function(_0x29daa3){RpcVoiceAgentReport['create'](_0x29daa3);});}else{RpcVoiceAgentReport['create'](_0x16197b);}};Report[_0xf16b('0xf')][_0xf16b('0x4b')]=function(_0x5f1ba9){RpcVoiceDialReport[_0xf16b('0x4c')](_0x5f1ba9);var _0x1ffe0a;var _0x3dffbd;var _0x2dec10=_0x5f1ba9[_0xf16b('0x39')];if(_[_0xf16b('0x4d')](_0x2dec10,_0xf16b('0x4e'))){_0x3dffbd=_0x2dec10[_0xf16b('0x4f')](_0x2dec10['indexOf']('/')+0x1,_0x2dec10[_0xf16b('0x50')]('@'));_0x1ffe0a=_[_0xf16b('0x1e')](this[_0xf16b('0xd')],function(_0x44be5f){return _0x44be5f[_0xf16b('0x51')]==_0x3dffbd||_0x44be5f[_0xf16b('0x52')]==_0x3dffbd||_0x44be5f[_0xf16b('0x1f')]==_0x3dffbd;});}else{_0x3dffbd=_0x2dec10[_0xf16b('0x4f')](_0x2dec10[_0xf16b('0x50')]('/')+0x1,_0x2dec10[_0xf16b('0x53')]('-'));_0x1ffe0a=this[_0xf16b('0x1d')](_0x3dffbd);}if(_0x1ffe0a){_0x5f1ba9[_0xf16b('0x26')]=_[_0xf16b('0x21')](_0x1ffe0a['interface'])?util[_0xf16b('0x22')](_0xf16b('0x23'),_0x1ffe0a['name']):_0x1ffe0a[_0xf16b('0x26')];_0x5f1ba9['membername']=_0x1ffe0a['name'];_0x5f1ba9[_0xf16b('0x1f')]=_0x1ffe0a[_0xf16b('0x1f')];RpcMemberReport[_0xf16b('0x4b')](_0x5f1ba9);}};Report[_0xf16b('0xf')]['blindTransfer']=function(_0x1ffb84){RpcVoiceTransferReport[_0xf16b('0x3d')][_0x1ffb84[_0xf16b('0x54')]]=_0x1ffb84;};Report['prototype'][_0xf16b('0x1c')]=function(_0x1abfdb){RpcVoiceTransferReport[_0xf16b('0x1c')](_0x1abfdb);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 6f86c9a..38267b3 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 _0x7409=['[userReport][registry]','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','trunk:save','startsWith','Local','indexOf','find','mobile','accountcode','syncPeerStatus','peerstatus','[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:','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','catch','[userReport][sipshowregistry]','resolve','then','actionDeviceStateList','error','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug'];(function(_0x3be3f7,_0x22fff7){var _0x28205b=function(_0x35bc16){while(--_0x35bc16){_0x3be3f7['push'](_0x3be3f7['shift']());}};_0x28205b(++_0x22fff7);}(_0x7409,0x6e));var _0x9740=function(_0x3938d2,_0x8e9793){_0x3938d2=_0x3938d2-0x0;var _0x45513c=_0x7409[_0x3938d2];return _0x45513c;};'use strict';var _=require(_0x9740('0x0'));var moment=require(_0x9740('0x1'));var util=require('util');var Redis=require(_0x9740('0x2'));var BPromise=require(_0x9740('0x3'));var config=require(_0x9740('0x4'));var logger=require(_0x9740('0x5'))(_0x9740('0x6'));var ami=require(_0x9740('0x7'));config[_0x9740('0x8')]=_[_0x9740('0x9')](config[_0x9740('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9740('0xa'))(new Redis(config[_0x9740('0x8')]));function UserReport(_0x2929cd){this['trunks']=_0x2929cd[_0x9740('0xb')];this[_0x9740('0xc')]=_0x2929cd[_0x9740('0xc')];this['telephones']=_0x2929cd[_0x9740('0xd')];ami['on']('registryentry',this[_0x9740('0xe')][_0x9740('0xf')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0x9740('0x10'),this[_0x9740('0x11')][_0x9740('0xf')](this));ami['on']('peerstatus',this['syncPeerStatus']['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x9740('0x12')](function(_0x4d50ad){logger['error'](_0x9740('0x13'),util['inspect'](_0x4d50ad,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9740('0x14')]()[_0x9740('0x15')](ami[_0x9740('0x16')]())[_0x9740('0x12')](function(_0x480af9){logger[_0x9740('0x17')]('[userReport][devicestatelist]',util[_0x9740('0x18')](_0x480af9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9740('0x14')]()[_0x9740('0x15')](ami[_0x9740('0x19')]())[_0x9740('0x12')](function(_0xa6cedd){logger[_0x9740('0x17')](_0x9740('0x1a'),util[_0x9740('0x18')](_0xa6cedd,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x9740('0x1b')]=function(){setInterval(function(){BPromise[_0x9740('0x14')]()[_0x9740('0x15')](showSipRegistrations())[_0x9740('0x15')](listDeviceStates())[_0x9740('0x15')](showPeersStatus());},0x32c8);};UserReport[_0x9740('0x1c')][_0x9740('0x1d')]=function(_0x146070){return _0x146070!==null&&!_['isUndefined'](_0x146070);};UserReport[_0x9740('0x1c')]['emit']=function(_0x1f8a78,_0x46d768,_0x1af88e){io['to'](_0x1f8a78)[_0x9740('0x1e')](_0x46d768,_0x1af88e);};UserReport[_0x9740('0x1c')][_0x9740('0xe')]=function(_0x4e4627){try{if(this[_0x9740('0x1d')](_0x4e4627)){logger[_0x9740('0x1f')](_0x9740('0x20'),_0x4e4627[_0x9740('0x21')],_0x4e4627[_0x9740('0x22')]);logger[_0x9740('0x23')](_0x9740('0x24'),util[_0x9740('0x18')](_0x4e4627,{'showHidden':![],'depth':null}));var _0x11ee90=_['find'](this[_0x9740('0xb')],{'registry':_0x4e4627['username']});if(_0x11ee90){_0x4e4627['stateRegistry']=_0x4e4627['state'];_['merge'](_0x11ee90,_[_0x9740('0x25')](_0x4e4627,[_0x9740('0x26'),_0x9740('0x27'),'username',_0x9740('0x22')]));logger[_0x9740('0x23')](_0x9740('0x28'),util[_0x9740('0x18')](_0x11ee90,{'showHidden':![],'depth':null}));this['emit'](util[_0x9740('0x29')](_0x9740('0x2a'),_0x11ee90[_0x9740('0x2b')]),'trunk:save',_0x11ee90);}}}catch(_0x248577){logger[_0x9740('0x17')](_0x9740('0x24'),util[_0x9740('0x18')](_0x248577,{'showHidden':![],'depth':null}));}};UserReport[_0x9740('0x1c')][_0x9740('0x11')]=function(_0xe05d10){try{if(this[_0x9740('0x1d')](_0xe05d10)){logger[_0x9740('0x1f')](_0x9740('0x2c'),_0xe05d10['device'],_0xe05d10[_0x9740('0x22')]);logger[_0x9740('0x23')](_0x9740('0x2d'),util[_0x9740('0x18')](_0xe05d10,{'showHidden':![],'depth':null}));if(this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]]){if(!this['agents'][_0xe05d10[_0x9740('0x2e')]]['local']||_0xe05d10['state'][_0x9740('0x2f')]()==_0x9740('0x30')){this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x31')]=![];if(this['agents'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]!==_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]()){this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]=_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]();this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x34')](_0xe05d10);}}else if(this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]]){if(this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]!==_0xe05d10['state'][_0x9740('0x2f')]()){this['telephones'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]=_0xe05d10['state']['toLowerCase']();logger['debug'](_0x9740('0x35'),util[_0x9740('0x18')](this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]],{'showHidden':![],'depth':null}));this[_0x9740('0x1e')](util['format'](_0x9740('0x36'),this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x2b')]),_0x9740('0x37'),this[_0x9740('0xd')][_0xe05d10['device']]);}else if(this[_0x9740('0xb')][_0xe05d10[_0x9740('0x2e')]]){if(this[_0x9740('0xb')][_0xe05d10['device']]['state']!==_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]()){this[_0x9740('0xb')][_0xe05d10['device']][_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}this['trunks'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]=_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]();logger[_0x9740('0x23')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x9740('0x18')](this[_0x9740('0xb')][_0xe05d10[_0x9740('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9740('0x29')](_0x9740('0x2a'),this['trunks'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x2b')]),_0x9740('0x38'),this[_0x9740('0xb')][_0xe05d10['device']]);}else if(_[_0x9740('0x39')](_0xe05d10[_0x9740('0x2e')],_0x9740('0x3a'))){var _0xa7ee56=_0xe05d10[_0x9740('0x2e')];var _0x1141c3=_0xa7ee56['substring'](_0xa7ee56[_0x9740('0x3b')]('/')+0x1,_0xa7ee56[_0x9740('0x3b')]('@'));var _0x3a8935=_[_0x9740('0x3c')](this['agents'],function(_0x16d114){return _0x16d114[_0x9740('0x3d')]==_0x1141c3||_0x16d114['phone']==_0x1141c3||_0x16d114[_0x9740('0x3e')]==_0x1141c3;});if(_0x3a8935){if(_0x3a8935[_0x9740('0x22')]!==_0xe05d10[_0x9740('0x22')]['toLowerCase']()){_0x3a8935[_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}_0x3a8935[_0x9740('0x22')]=_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]();_0x3a8935['local']=!![];_0x3a8935[_0x9740('0x34')](_0xe05d10);}}}}catch(_0x373ecc){logger[_0x9740('0x17')](_0x9740('0x2d'),util['inspect'](_0x373ecc,{'showHidden':![],'depth':null}));}};UserReport[_0x9740('0x1c')][_0x9740('0x3f')]=function(_0x41f7cb){try{if(this['isNotNull'](_0x41f7cb)&&this['isNotNull'](_0x41f7cb[_0x9740('0x40')])){logger[_0x9740('0x1f')](_0x9740('0x41'),_0x41f7cb['peer'],_0x41f7cb[_0x9740('0x42')],_0x41f7cb['peerstatus']);logger[_0x9740('0x23')](_0x9740('0x43'),util[_0x9740('0x18')](_0x41f7cb,{'showHidden':![],'depth':null}));if(this[_0x9740('0xc')][_0x41f7cb[_0x9740('0x44')]]){if(!this[_0x9740('0xc')][_0x41f7cb['peer']][_0x9740('0x31')]||_0x41f7cb[_0x9740('0x40')][_0x9740('0x2f')]()==_0x9740('0x45')){this[_0x9740('0xc')][_0x41f7cb['peer']][_0x9740('0x31')]=![];this['agents'][_0x41f7cb['peer']]['status']=_0x41f7cb[_0x9740('0x40')][_0x9740('0x2f')]();this[_0x9740('0xc')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x42')]=_0x41f7cb[_0x9740('0x42')];this[_0x9740('0xc')][_0x41f7cb['peer']][_0x9740('0x34')](_0x41f7cb);}}else if(this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]]){this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x46')]=_0x41f7cb[_0x9740('0x40')]['toLowerCase']();this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]]['address']=_0x41f7cb[_0x9740('0x42')];logger['debug'](_0x9740('0x47'),util[_0x9740('0x18')](this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]],{'showHidden':![],'depth':null}));this[_0x9740('0x1e')](util['format'](_0x9740('0x36'),this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x2b')]),_0x9740('0x37'),this[_0x9740('0xd')][_0x41f7cb['peer']]);}else if(this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]]){this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x46')]=_0x41f7cb[_0x9740('0x40')][_0x9740('0x2f')]();this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x42')]=_0x41f7cb[_0x9740('0x42')];logger[_0x9740('0x23')](_0x9740('0x48'),util[_0x9740('0x18')](this['trunks'][_0x41f7cb['peer']],{'showHidden':![],'depth':null}));this[_0x9740('0x1e')](util[_0x9740('0x29')](_0x9740('0x2a'),this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]]['name']),'trunk:save',this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]]);}}}catch(_0x4daf9d){logger[_0x9740('0x17')](_0x9740('0x43'),util[_0x9740('0x18')](_0x4daf9d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x377e=['local','toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','lodash','util','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','catch','error','[userReport][sipshowregistry]','inspect','then','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','omit','event','actionid','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]'];(function(_0x38f285,_0x47aa5d){var _0x3952ab=function(_0x37cecf){while(--_0x37cecf){_0x38f285['push'](_0x38f285['shift']());}};_0x3952ab(++_0x47aa5d);}(_0x377e,0x1d9));var _0xe377=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0x377e[_0x260859];return _0x4b77f8;};'use strict';var _=require(_0xe377('0x0'));var moment=require('moment');var util=require(_0xe377('0x1'));var Redis=require('ioredis');var BPromise=require(_0xe377('0x2'));var config=require(_0xe377('0x3'));var logger=require(_0xe377('0x4'))(_0xe377('0x5'));var ami=require('../ami');config[_0xe377('0x6')]=_[_0xe377('0x7')](config['redis'],{'host':_0xe377('0x8'),'port':0x18eb});var io=require(_0xe377('0x9'))(new Redis(config[_0xe377('0x6')]));function UserReport(_0x4392dc){this['trunks']=_0x4392dc[_0xe377('0xa')];this[_0xe377('0xb')]=_0x4392dc[_0xe377('0xb')];this['telephones']=_0x4392dc[_0xe377('0xc')];ami['on'](_0xe377('0xd'),this[_0xe377('0xe')][_0xe377('0xf')](this));ami['on'](_0xe377('0x10'),this['syncRegistry'][_0xe377('0xf')](this));ami['on']('devicestatechange',this[_0xe377('0x11')][_0xe377('0xf')](this));ami['on'](_0xe377('0x12'),this[_0xe377('0x13')]['bind'](this));return this[_0xe377('0x14')]();}function showSipRegistrations(){Promise[_0xe377('0x15')]()['then'](ami['actionSipShowRegistry']())[_0xe377('0x16')](function(_0x1f4a95){logger[_0xe377('0x17')](_0xe377('0x18'),util[_0xe377('0x19')](_0x1f4a95,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe377('0x15')]()[_0xe377('0x1a')](ami['actionDeviceStateList']())[_0xe377('0x16')](function(_0x496405){logger[_0xe377('0x17')](_0xe377('0x1b'),util[_0xe377('0x19')](_0x496405,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe377('0x15')]()[_0xe377('0x1a')](ami[_0xe377('0x1c')]())['catch'](function(_0x490eed){logger['error'](_0xe377('0x1d'),util['inspect'](_0x490eed,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xe377('0x14')]=function(){setInterval(function(){BPromise['resolve']()[_0xe377('0x1a')](showSipRegistrations())[_0xe377('0x1a')](listDeviceStates())[_0xe377('0x1a')](showPeersStatus());},0x32c8);};UserReport[_0xe377('0x1e')][_0xe377('0x1f')]=function(_0x6b27f9){return _0x6b27f9!==null&&!_[_0xe377('0x20')](_0x6b27f9);};UserReport[_0xe377('0x1e')]['emit']=function(_0x4280a9,_0x180029,_0x508387){io['to'](_0x4280a9)[_0xe377('0x21')](_0x180029,_0x508387);};UserReport[_0xe377('0x1e')][_0xe377('0xe')]=function(_0xeefd86){try{if(this['isNotNull'](_0xeefd86)){logger[_0xe377('0x22')](_0xe377('0x23'),_0xeefd86['username'],_0xeefd86[_0xe377('0x24')]);logger[_0xe377('0x25')](_0xe377('0x26'),util[_0xe377('0x19')](_0xeefd86,{'showHidden':![],'depth':null}));var _0x49c108=_[_0xe377('0x27')](this[_0xe377('0xa')],{'registry':_0xeefd86[_0xe377('0x28')]});if(_0x49c108){_0xeefd86[_0xe377('0x29')]=_0xeefd86[_0xe377('0x24')];_['merge'](_0x49c108,_[_0xe377('0x2a')](_0xeefd86,[_0xe377('0x2b'),_0xe377('0x2c'),_0xe377('0x28'),_0xe377('0x24')]));logger[_0xe377('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xe377('0x19')](_0x49c108,{'showHidden':![],'depth':null}));this[_0xe377('0x21')](util[_0xe377('0x2d')](_0xe377('0x2e'),_0x49c108[_0xe377('0x2f')]),_0xe377('0x30'),_0x49c108);}}}catch(_0x27c934){logger['error'](_0xe377('0x26'),util[_0xe377('0x19')](_0x27c934,{'showHidden':![],'depth':null}));}};UserReport[_0xe377('0x1e')][_0xe377('0x11')]=function(_0x3513ae){try{if(this[_0xe377('0x1f')](_0x3513ae)){logger['info'](_0xe377('0x31'),_0x3513ae[_0xe377('0x32')],_0x3513ae[_0xe377('0x24')]);logger[_0xe377('0x25')](_0xe377('0x33'),util[_0xe377('0x19')](_0x3513ae,{'showHidden':![],'depth':null}));if(this['agents'][_0x3513ae[_0xe377('0x32')]]){if(!this[_0xe377('0xb')][_0x3513ae[_0xe377('0x32')]][_0xe377('0x34')]||_0x3513ae[_0xe377('0x24')][_0xe377('0x35')]()==_0xe377('0x36')){this['agents'][_0x3513ae[_0xe377('0x32')]]['local']=![];if(this[_0xe377('0xb')][_0x3513ae['device']][_0xe377('0x24')]!==_0x3513ae['state'][_0xe377('0x35')]()){this[_0xe377('0xb')][_0x3513ae['device']][_0xe377('0x37')]=_['toNumber'](moment()[_0xe377('0x2d')]('x'));}this['agents'][_0x3513ae['device']][_0xe377('0x24')]=_0x3513ae[_0xe377('0x24')]['toLowerCase']();this['agents'][_0x3513ae[_0xe377('0x32')]][_0xe377('0x38')](_0x3513ae);}}else if(this[_0xe377('0xc')][_0x3513ae['device']]){if(this[_0xe377('0xc')][_0x3513ae['device']][_0xe377('0x24')]!==_0x3513ae[_0xe377('0x24')][_0xe377('0x35')]()){this[_0xe377('0xc')][_0x3513ae['device']][_0xe377('0x37')]=_[_0xe377('0x39')](moment()[_0xe377('0x2d')]('x'));}this[_0xe377('0xc')][_0x3513ae[_0xe377('0x32')]]['state']=_0x3513ae[_0xe377('0x24')]['toLowerCase']();logger[_0xe377('0x25')](_0xe377('0x3a'),util[_0xe377('0x19')](this[_0xe377('0xc')][_0x3513ae[_0xe377('0x32')]],{'showHidden':![],'depth':null}));this[_0xe377('0x21')](util['format'](_0xe377('0x3b'),this['telephones'][_0x3513ae[_0xe377('0x32')]][_0xe377('0x2f')]),_0xe377('0x3c'),this[_0xe377('0xc')][_0x3513ae[_0xe377('0x32')]]);}else if(this['trunks'][_0x3513ae['device']]){if(this[_0xe377('0xa')][_0x3513ae['device']][_0xe377('0x24')]!==_0x3513ae[_0xe377('0x24')]['toLowerCase']()){this['trunks'][_0x3513ae[_0xe377('0x32')]][_0xe377('0x37')]=_[_0xe377('0x39')](moment()[_0xe377('0x2d')]('x'));}this[_0xe377('0xa')][_0x3513ae[_0xe377('0x32')]][_0xe377('0x24')]=_0x3513ae['state']['toLowerCase']();logger[_0xe377('0x25')](_0xe377('0x3d'),util[_0xe377('0x19')](this[_0xe377('0xa')][_0x3513ae[_0xe377('0x32')]],{'showHidden':![],'depth':null}));this[_0xe377('0x21')](util[_0xe377('0x2d')]('trunk:%s',this['trunks'][_0x3513ae[_0xe377('0x32')]]['name']),_0xe377('0x30'),this[_0xe377('0xa')][_0x3513ae['device']]);}else if(_['startsWith'](_0x3513ae[_0xe377('0x32')],'Local')){var _0xcd6460=_0x3513ae[_0xe377('0x32')];var _0x38e874=_0xcd6460[_0xe377('0x3e')](_0xcd6460['indexOf']('/')+0x1,_0xcd6460[_0xe377('0x3f')]('@'));var _0x29c8e8=_[_0xe377('0x27')](this[_0xe377('0xb')],function(_0x3e2667){return _0x3e2667[_0xe377('0x40')]==_0x38e874||_0x3e2667[_0xe377('0x41')]==_0x38e874||_0x3e2667[_0xe377('0x42')]==_0x38e874;});if(_0x29c8e8){if(_0x29c8e8[_0xe377('0x24')]!==_0x3513ae[_0xe377('0x24')][_0xe377('0x35')]()){_0x29c8e8['stateTime']=_[_0xe377('0x39')](moment()[_0xe377('0x2d')]('x'));}_0x29c8e8[_0xe377('0x24')]=_0x3513ae[_0xe377('0x24')][_0xe377('0x35')]();_0x29c8e8[_0xe377('0x34')]=!![];_0x29c8e8[_0xe377('0x38')](_0x3513ae);}}}}catch(_0x1e83a2){logger[_0xe377('0x17')](_0xe377('0x33'),util['inspect'](_0x1e83a2,{'showHidden':![],'depth':null}));}};UserReport[_0xe377('0x1e')][_0xe377('0x13')]=function(_0x5d0374){try{if(this[_0xe377('0x1f')](_0x5d0374)&&this[_0xe377('0x1f')](_0x5d0374[_0xe377('0x12')])){logger[_0xe377('0x22')](_0xe377('0x43'),_0x5d0374[_0xe377('0x44')],_0x5d0374[_0xe377('0x45')],_0x5d0374['peerstatus']);logger[_0xe377('0x25')]('[userReport][peerstatus]',util[_0xe377('0x19')](_0x5d0374,{'showHidden':![],'depth':null}));if(this[_0xe377('0xb')][_0x5d0374['peer']]){if(!this['agents'][_0x5d0374[_0xe377('0x44')]][_0xe377('0x34')]||_0x5d0374[_0xe377('0x12')][_0xe377('0x35')]()==_0xe377('0x46')){this[_0xe377('0xb')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x34')]=![];this[_0xe377('0xb')][_0x5d0374['peer']]['status']=_0x5d0374['peerstatus']['toLowerCase']();this[_0xe377('0xb')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x45')]=_0x5d0374['address'];this['agents'][_0x5d0374[_0xe377('0x44')]]['updateStatusRealtime'](_0x5d0374);}}else if(this[_0xe377('0xc')][_0x5d0374[_0xe377('0x44')]]){this[_0xe377('0xc')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x47')]=_0x5d0374['peerstatus']['toLowerCase']();this[_0xe377('0xc')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x45')]=_0x5d0374[_0xe377('0x45')];logger[_0xe377('0x25')](_0xe377('0x48'),util[_0xe377('0x19')](this[_0xe377('0xc')][_0x5d0374['peer']],{'showHidden':![],'depth':null}));this[_0xe377('0x21')](util[_0xe377('0x2d')](_0xe377('0x3b'),this[_0xe377('0xc')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x2f')]),_0xe377('0x3c'),this[_0xe377('0xc')][_0x5d0374[_0xe377('0x44')]]);}else if(this[_0xe377('0xa')][_0x5d0374[_0xe377('0x44')]]){this[_0xe377('0xa')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x47')]=_0x5d0374[_0xe377('0x12')]['toLowerCase']();this[_0xe377('0xa')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x45')]=_0x5d0374[_0xe377('0x45')];logger[_0xe377('0x25')](_0xe377('0x49'),util[_0xe377('0x19')](this['trunks'][_0x5d0374['peer']],{'showHidden':![],'depth':null}));this[_0xe377('0x21')](util[_0xe377('0x2d')](_0xe377('0x2e'),this[_0xe377('0xa')][_0x5d0374[_0xe377('0x44')]][_0xe377('0x2f')]),'trunk:save',this[_0xe377('0xa')][_0x5d0374['peer']]);}}}catch(_0x36cfb6){logger[_0xe377('0x17')](_0xe377('0x4a'),util[_0xe377('0x19')](_0x36cfb6,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d9a6c63..7914885 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 _0xb611=['agentringnoanswerAt','answeredelsewheredestinationuniqueid','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','transfereruniqueid','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','voiceQueues','agents','variables','agentcalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','called','queue','mandatoryDisposition','type','inbound','omit','privilege','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete'];(function(_0x2a1fd6,_0xc8e818){var _0x186896=function(_0x30bbd5){while(--_0x30bbd5){_0x2a1fd6['push'](_0x2a1fd6['shift']());}};_0x186896(++_0xc8e818);}(_0xb611,0x171));var _0x1b61=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0xb611[_0x209302];return _0x1df8e9;};'use strict';var _=require(_0x1b61('0x0'));var moment=require(_0x1b61('0x1'));var util=require(_0x1b61('0x2'));var Redis=require(_0x1b61('0x3'));var config=require(_0x1b61('0x4'));var logger=require(_0x1b61('0x5'))(_0x1b61('0x6'));var ami=require(_0x1b61('0x7'));config[_0x1b61('0x8')]=_[_0x1b61('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1b61('0xa'))(new Redis(config[_0x1b61('0x8')]));function VoiceAgentReport(_0x49e76d){this['channels']={};this[_0x1b61('0xb')]=_0x49e76d['voiceQueues'];this[_0x1b61('0xc')]=_0x49e76d['agents'];this[_0x1b61('0xd')]={};ami['on'](_0x1b61('0xe'),this['syncAgentCalled']['bind'](this));ami['on'](_0x1b61('0xf'),this[_0x1b61('0x10')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x12'),this[_0x1b61('0x13')][_0x1b61('0x11')](this));ami['on']('queuecallerabandon',this[_0x1b61('0x14')][_0x1b61('0x11')](this));ami['on']('agentcomplete',this[_0x1b61('0x15')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x16'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x1b61('0x17')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x18'),this[_0x1b61('0x19')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x1a'),this[_0x1b61('0x1b')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x1c'),this['syncAttendedTransfer'][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x1d'),this[_0x1b61('0x1e')][_0x1b61('0x11')](this));}VoiceAgentReport['prototype'][_0x1b61('0x1f')]=function(_0x5aad01,_0x3d1eca,_0x35aa3a){io['to'](_0x5aad01)[_0x1b61('0x1f')](_0x3d1eca,_0x35aa3a);};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x21')]=function(_0x4e69a0){return _0x4e69a0!==null&&!_[_0x1b61('0x22')](_0x4e69a0);};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x23')]=function(_0x1bbe4a){try{if(this[_0x1b61('0x21')](_0x1bbe4a)){logger[_0x1b61('0x24')](_0x1b61('0x25'),_0x1bbe4a[_0x1b61('0x26')],_0x1bbe4a[_0x1b61('0x27')],_0x1bbe4a[_0x1b61('0x28')]);logger[_0x1b61('0x29')](_0x1b61('0x2a'),_0x1bbe4a['uniqueid'],util[_0x1b61('0x2b')](_0x1bbe4a,{'showHidden':![],'depth':null}));if(_[_0x1b61('0x22')](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]])){this['channels'][_0x1bbe4a[_0x1b61('0x26')]]={};}if(_['isUndefined'](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a['destuniqueid']])){this['channels'][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x1b61('0x2d'),'mandatoryDisposition':this['voiceQueues'][_0x1bbe4a[_0x1b61('0x2e')]]?this[_0x1b61('0xb')][_0x1bbe4a[_0x1b61('0x2e')]][_0x1b61('0x2f')]||![]:![],'type':this[_0x1b61('0xb')][_0x1bbe4a[_0x1b61('0x2e')]]?this['voiceQueues'][_0x1bbe4a[_0x1b61('0x2e')]][_0x1b61('0x30')]||_0x1b61('0x31'):_0x1b61('0x31'),'variables':this[_0x1b61('0xd')][_0x1bbe4a['uniqueid']]};}_['merge'](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]],_[_0x1b61('0x32')](_0x1bbe4a,['event',_0x1b61('0x33')]));logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x1bbe4a[_0x1b61('0x26')],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x34'),this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]]);logger[_0x1b61('0x29')](_0x1b61('0x35'),_0x1bbe4a['uniqueid'],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0x1bbe4a['uniqueid']][_0x1bbe4a['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x1b61('0x1f')](util[_0x1b61('0x36')](_0x1b61('0x37'),_0x1bbe4a[_0x1b61('0x27')]),'user:called',this['channels'][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]]);}}catch(_0x1a8135){logger['error'](_0x1b61('0x38'),_0x1bbe4a[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x1a8135,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x10')]=function(_0x41256b){try{if(this[_0x1b61('0x21')](_0x41256b)){if(this['channels'][_0x41256b[_0x1b61('0x26')]]){logger[_0x1b61('0x29')](_0x1b61('0x39'),_0x41256b[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x41256b,{'showHidden':![],'depth':null}));for(var _0x5dae85 in this['channels'][_0x41256b[_0x1b61('0x26')]]){if(this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x1b61('0x3a')](_0x5dae85)){if(_0x41256b[_0x1b61('0x28')]===_0x5dae85){logger[_0x1b61('0x24')](_0x1b61('0x3b'),_0x41256b[_0x1b61('0x26')],_0x41256b['membername'],_0x41256b[_0x1b61('0x28')]);this[_0x1b61('0x2c')][_0x41256b['uniqueid']][_0x5dae85][_0x1b61('0x3c')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x3e')]=_0x41256b[_0x1b61('0x3e')];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x3f')]=_0x41256b[_0x1b61('0x3f')];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['destchannelstate']=_0x41256b[_0x1b61('0x40')];this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x41')]=_0x41256b['destchannelstatedesc'];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x42')]=_0x41256b['holdtime'];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['lastevent']=_0x1b61('0x43');_['merge'](this[_0x1b61('0xc')][_0x41256b[_0x1b61('0x44')]],_[_0x1b61('0x45')](_0x41256b,[_0x1b61('0x2e'),_0x1b61('0x46')]));logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x41256b['uniqueid'],util[_0x1b61('0x2b')](this['channels'][_0x41256b['uniqueid']][_0x41256b[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x47'),this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x41256b[_0x1b61('0x28')]]);logger[_0x1b61('0x29')](_0x1b61('0x48'),_0x41256b['uniqueid'],util['inspect'](this[_0x1b61('0x2c')][_0x41256b['uniqueid']][_0x41256b[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));this[_0x1b61('0x1f')](util[_0x1b61('0x36')](_0x1b61('0x37'),_0x41256b[_0x1b61('0x27')]),_0x1b61('0x49'),this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x41256b[_0x1b61('0x28')]]);}else if(!this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x12')]&&!this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x4a')]){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x41256b[_0x1b61('0x26')],this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['membername'],_0x5dae85);this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['agentringnoanswer']=!![];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x4b')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x4c')]=_0x41256b['destuniqueid'];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['answeredelsewheremembername']=_0x41256b[_0x1b61('0x27')];this[_0x1b61('0x2c')][_0x41256b['uniqueid']][_0x5dae85][_0x1b61('0x4d')]=_0x1b61('0x4e');this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['reason']=_0x1b61('0x4e');logger['debug'](_0x1b61('0x4f'),_0x41256b[_0x1b61('0x26')],util[_0x1b61('0x2b')](this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85],{'showHidden':![],'depth':null}));ami['emit'](_0x1b61('0x50'),this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85]);}}}}}}catch(_0x49389e){logger[_0x1b61('0x51')](_0x1b61('0x52'),_0x41256b['uniqueid'],util[_0x1b61('0x2b')](_0x49389e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')]['syncAgentRingNoAnswer']=function(_0xf414d5){try{if(this['isNotNull'](_0xf414d5)){logger[_0x1b61('0x29')](_0x1b61('0x53'),_0xf414d5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0xf414d5,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]]&&this['channels'][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]]){logger[_0x1b61('0x24')](_0x1b61('0x54'),_0xf414d5[_0x1b61('0x26')],_0xf414d5[_0x1b61('0x27')],_0xf414d5['destuniqueid']);this['channels'][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]][_0x1b61('0x12')]=!![];this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]][_0x1b61('0x4b')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]][_0x1b61('0x4d')]=_0x1b61('0x55');this[_0x1b61('0x2c')][_0xf414d5['uniqueid']][_0xf414d5['destuniqueid']][_0x1b61('0x56')]='rejected';logger[_0x1b61('0x29')](_0x1b61('0x57'),_0xf414d5[_0x1b61('0x26')],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x58'),this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]]);}}}catch(_0x256a5d){logger[_0x1b61('0x51')]('[%s][voiceAgentReport][agentringnoanswer]',_0xf414d5[_0x1b61('0x26')],util['inspect'](_0x256a5d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0xaba407){try{if(this[_0x1b61('0x21')](_0xaba407)){logger[_0x1b61('0x29')](_0x1b61('0x59'),_0xaba407[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0xaba407,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0xaba407[_0x1b61('0x26')]]){for(var _0x3c4f02 in this['channels'][_0xaba407[_0x1b61('0x26')]]){if(this['channels'][_0xaba407[_0x1b61('0x26')]][_0x1b61('0x3a')](_0x3c4f02)&&!this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x12')]&&!this[_0x1b61('0x2c')][_0xaba407[_0x1b61('0x26')]][_0x3c4f02][_0x1b61('0x4a')]){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xaba407['uniqueid'],this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x27')],_0x3c4f02);this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02][_0x1b61('0x12')]=!![];this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x4b')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02][_0x1b61('0x4d')]=_0x1b61('0x5a');this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x56')]='abandoned';logger[_0x1b61('0x29')](_0x1b61('0x5b'),_0xaba407[_0x1b61('0x26')],util[_0x1b61('0x2b')](this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')]('custom:agentqueuecallerabandon',this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02]);}}}}}catch(_0x51c06a){logger['error'](_0x1b61('0x5c'),_0xaba407[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x51c06a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x15')]=function(_0x2a5ec6){try{if(this[_0x1b61('0x21')](_0x2a5ec6)){logger['debug'](_0x1b61('0x5d'),_0x2a5ec6['uniqueid'],util[_0x1b61('0x2b')](_0x2a5ec6,{'showHidden':![],'depth':null}));if(this['channels'][_0x2a5ec6['uniqueid']]){for(var _0x24ff69 in this['channels'][_0x2a5ec6['uniqueid']]){if(this['channels'][_0x2a5ec6['uniqueid']][_0x1b61('0x3a')](_0x24ff69)){if(this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69]['agentconnectAt']&&!this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x4a')]){logger[_0x1b61('0x24')](_0x1b61('0x5e'),_0x2a5ec6[_0x1b61('0x26')],this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x27')],_0x24ff69);this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x4a')]=!![];this['channels'][_0x2a5ec6['uniqueid']][_0x24ff69][_0x1b61('0x5f')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x4d')]=_0x1b61('0x60');this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x56')]=_0x2a5ec6[_0x1b61('0x56')]==_0x1b61('0x61')?_0x1b61('0x62'):_0x2a5ec6[_0x1b61('0x56')];this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x63')]=_0x2a5ec6[_0x1b61('0x63')];if(this[_0x1b61('0xb')][_0x2a5ec6['queue']]&&this[_0x1b61('0xb')][_0x2a5ec6['queue']][_0x1b61('0x64')]){this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69]['acwtime']=this[_0x1b61('0xb')][_0x2a5ec6[_0x1b61('0x2e')]][_0x1b61('0x65')];this[_0x1b61('0x2c')][_0x2a5ec6['uniqueid']][_0x24ff69][_0x1b61('0x66')]=!![];}this[_0x1b61('0xc')][_0x2a5ec6[_0x1b61('0x44')]]=_[_0x1b61('0x32')](this[_0x1b61('0xc')][_0x2a5ec6[_0x1b61('0x44')]],[_0x1b61('0x2e'),_0x1b61('0x46')]);logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x2a5ec6[_0x1b61('0x26')],util[_0x1b61('0x2b')](this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x67'),this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69]);logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2a5ec6[_0x1b61('0x26')],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1b61('0x37'),_0x2a5ec6[_0x1b61('0x27')]),'user:agentcomplete',this[_0x1b61('0x2c')][_0x2a5ec6['uniqueid']][_0x24ff69]);}}}}}}catch(_0x51ece5){logger['error'](_0x1b61('0x68'),_0x2a5ec6['uniqueid'],util[_0x1b61('0x2b')](_0x51ece5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x69')]=function(_0x3d1d01){try{if(this[_0x1b61('0x21')](_0x3d1d01)){logger[_0x1b61('0x29')](_0x1b61('0x6a'),_0x3d1d01[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x3d1d01,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d1d01[_0x1b61('0x26')],_[_0x1b61('0x6b')](_0x3d1d01[_0x1b61('0x6c')])[0x0],_0x3d1d01[_0x1b61('0x6d')]);if(this[_0x1b61('0x2c')][_0x3d1d01[_0x1b61('0x26')]]){for(var _0x3acd44 in this['channels'][_0x3d1d01[_0x1b61('0x26')]]){if(this['channels'][_0x3d1d01[_0x1b61('0x26')]][_0x1b61('0x3a')](_0x3acd44)){logger[_0x1b61('0x24')](_0x1b61('0x6e'),_0x3d1d01[_0x1b61('0x26')],_0x3acd44,_[_0x1b61('0x6b')](_0x3d1d01['variable'])[0x0],_0x3d1d01[_0x1b61('0x6d')]);if(_[_0x1b61('0x22')](this[_0x1b61('0x2c')][_0x3d1d01[_0x1b61('0x26')]][_0x3acd44][_0x1b61('0xd')])){this[_0x1b61('0x2c')][_0x3d1d01['uniqueid']][_0x3acd44][_0x1b61('0xd')]={};}this[_0x1b61('0x2c')][_0x3d1d01[_0x1b61('0x26')]][_0x3acd44][_0x1b61('0xd')]=this[_0x1b61('0xd')][_0x3d1d01[_0x1b61('0x26')]];}}}}}catch(_0x4ee2a0){logger['error'](_0x1b61('0x6f'),_0x3d1d01[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x4ee2a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x70')]=function(_0x36a121,_0x57baee,_0x3a7456){var _0x1699b2=[_0x1b61('0x71'),'rtpaudioqosbridged',_0x1b61('0x72'),_0x1b61('0x73'),'rtpaudioqosloss',_0x1b61('0x74'),_0x1b61('0x75'),_0x1b61('0x76'),'sipcallid',_0x1b61('0x77'),'bridgepeer',_0x1b61('0x78'),'membercalls',_0x1b61('0x79'),_0x1b61('0x7a'),'memberlastcall',_0x1b61('0x27'),'memberpenalty',_0x1b61('0x7b')];if(!_[_0x1b61('0x7c')](_0x57baee)&&!_['includes'](_0x1699b2,_0x57baee)){if(_['isUndefined'](this[_0x1b61('0xd')][_0x36a121])){this[_0x1b61('0xd')][_0x36a121]={};}this[_0x1b61('0xd')][_0x36a121][_0x57baee]=_0x3a7456;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x464cd5){try{if(this[_0x1b61('0x21')](_0x464cd5)){logger[_0x1b61('0x29')](_0x1b61('0x7d'),_0x464cd5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x464cd5,{'showHidden':![],'depth':null}));if(this['channels'][_0x464cd5[_0x1b61('0x26')]]){for(var _0x538159 in this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]]){if(this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]]['hasOwnProperty'](_0x538159)){if(this[_0x1b61('0x2c')][_0x464cd5['uniqueid']][_0x538159][_0x1b61('0x56')]==_0x1b61('0x61')&&this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]][_0x538159]['agentcomplete']){logger[_0x1b61('0x24')](_0x1b61('0x7e'),_0x464cd5[_0x1b61('0x26')],_0x538159);this['channels'][_0x464cd5[_0x1b61('0x26')]][_0x538159]['agentcompleteAt']=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));}}}logger[_0x1b61('0x29')](_0x1b61('0x7f'),_0x464cd5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_[_0x1b61('0x80')](this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_[_0x1b61('0x80')](this['channels'][_0x464cd5[_0x1b61('0x26')]]));delete this['channels'][_0x464cd5[_0x1b61('0x26')]];}if(this[_0x1b61('0xd')][_0x464cd5['uniqueid']]){delete this['variables'][_0x464cd5[_0x1b61('0x26')]];}}}catch(_0x10eda8){logger[_0x1b61('0x51')]('[%s][voiceAgentReport][hangup]',_0x464cd5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x10eda8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x81')]=function(_0x2d8977){try{if(this[_0x1b61('0x21')](_0x2d8977)){logger[_0x1b61('0x29')](_0x1b61('0x82'),_0x2d8977[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x2d8977,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0x2d8977['transfereeuniqueid']]){for(var _0x485def in this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]]){if(this['channels'][_0x2d8977[_0x1b61('0x83')]]['hasOwnProperty'](_0x485def)){if(_0x2d8977[_0x1b61('0x84')]===_0x485def){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2d8977['uniqueid'],this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x27')],_0x485def);var _0x5e1e8f=moment();this['channels'][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x4a')]=!![];this[_0x1b61('0x2c')][_0x2d8977['transfereeuniqueid']][_0x485def]['agentcompleteAt']=moment()['format'](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x4d')]=_0x1b61('0x60');this[_0x1b61('0x2c')][_0x2d8977['transfereeuniqueid']][_0x485def][_0x1b61('0x56')]='transfer';this['channels'][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x63')]=_0x5e1e8f[_0x1b61('0x85')](this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x3c')],'seconds');}}}}if(this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x86')]]){var _0x417730=this['channels'][_0x2d8977[_0x1b61('0x86')]];this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x86')]]=this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]];this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]]=_0x417730;}}}catch(_0x5d89e7){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x2d8977[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x5d89e7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x4aa68b){try{if(this[_0x1b61('0x21')](_0x4aa68b)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x4aa68b[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x4aa68b,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]]){for(var _0x284175 in this[_0x1b61('0x2c')][_0x4aa68b['transfereeuniqueid']]){if(this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x1b61('0x3a')](_0x284175)){if(_0x4aa68b[_0x1b61('0x87')]===_0x284175){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4aa68b[_0x1b61('0x26')],this['channels'][_0x4aa68b['transfereeuniqueid']][_0x284175][_0x1b61('0x27')],_0x284175);var _0x5c5a6e=moment();this['channels'][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x4a')]=!![];this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x5f')]=_0x5c5a6e;this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175]['lastevent']='complete';this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x56')]=_0x1b61('0x61');this[_0x1b61('0x2c')][_0x4aa68b['transfereeuniqueid']][_0x284175]['talktime']=_0x5c5a6e[_0x1b61('0x85')](this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x3c')],_0x1b61('0x88'));}}}}}}catch(_0x57b64a){logger[_0x1b61('0x51')](_0x1b61('0x89'),_0x4aa68b[_0x1b61('0x26')],util['inspect'](_0x57b64a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x19')]=function(_0x1c3578){var _0x3e6151='';try{if(this['isNotNull'](_0x1c3578)){logger[_0x1b61('0x29')](_0x1b61('0x8a'),_0x1c3578[_0x1b61('0x26')],util['inspect'](_0x1c3578,{'showHidden':![],'depth':null}));if(_0x1c3578['channel']){_0x3e6151=_0x1c3578[_0x1b61('0x8b')][_0x1b61('0x8c')](0x0,_0x1c3578[_0x1b61('0x8b')][_0x1b61('0x8d')]('-'));if(this[_0x1b61('0xc')][_0x3e6151]){logger['info'](_0x1b61('0x8e'),_0x1c3578[_0x1b61('0x26')],_0x3e6151);this['agents'][_0x3e6151][_0x1b61('0x8f')]=!![];}}}}catch(_0x3f0d82){logger[_0x1b61('0x51')](_0x1b61('0x90'),_0x1c3578[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x3f0d82,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x1b')]=function(_0x1ab534){var _0x33912b='';try{if(this['isNotNull'](_0x1ab534)){logger[_0x1b61('0x29')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x1ab534[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x1ab534,{'showHidden':![],'depth':null}));if(_0x1ab534[_0x1b61('0x8b')]){_0x33912b=_0x1ab534[_0x1b61('0x8b')][_0x1b61('0x8c')](0x0,_0x1ab534[_0x1b61('0x8b')][_0x1b61('0x8d')]('-'));if(this[_0x1b61('0xc')][_0x33912b]){logger[_0x1b61('0x24')](_0x1b61('0x91'),_0x1ab534[_0x1b61('0x26')],_0x33912b);this[_0x1b61('0xc')][_0x33912b][_0x1b61('0x8f')]=![];}}}}catch(_0x54d210){logger[_0x1b61('0x51')](_0x1b61('0x92'),_0x1ab534['uniqueid'],util[_0x1b61('0x2b')](_0x54d210,{'showHidden':![],'depth':null}));}};module[_0x1b61('0x93')]=VoiceAgentReport; \ No newline at end of file +var _0xea17=['reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','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','agentcompleteAt','transfer','talktime','acw','acwTimeout','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','info','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','channels','isUndefined','format','called','queue','mandatoryDisposition','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','debug','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete','YYYY-MM-DD\x20HH:mm:ss','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere'];(function(_0x842858,_0x3a3ca0){var _0x46c2a2=function(_0x47f795){while(--_0x47f795){_0x842858['push'](_0x842858['shift']());}};_0x46c2a2(++_0x3a3ca0);}(_0xea17,0xe8));var _0x7ea1=function(_0x51481d,_0x38f48e){_0x51481d=_0x51481d-0x0;var _0x5208f8=_0xea17[_0x51481d];return _0x5208f8;};'use strict';var _=require(_0x7ea1('0x0'));var moment=require('moment');var util=require(_0x7ea1('0x1'));var Redis=require('ioredis');var config=require(_0x7ea1('0x2'));var logger=require(_0x7ea1('0x3'))(_0x7ea1('0x4'));var ami=require(_0x7ea1('0x5'));config[_0x7ea1('0x6')]=_[_0x7ea1('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x4055b8){this['channels']={};this[_0x7ea1('0x8')]=_0x4055b8[_0x7ea1('0x8')];this[_0x7ea1('0x9')]=_0x4055b8[_0x7ea1('0x9')];this[_0x7ea1('0xa')]={};ami['on'](_0x7ea1('0xb'),this[_0x7ea1('0xc')][_0x7ea1('0xd')](this));ami['on'](_0x7ea1('0xe'),this[_0x7ea1('0xf')][_0x7ea1('0xd')](this));ami['on'](_0x7ea1('0x10'),this[_0x7ea1('0x11')][_0x7ea1('0xd')](this));ami['on'](_0x7ea1('0x12'),this['syncQueueCallerAbandon'][_0x7ea1('0xd')](this));ami['on']('agentcomplete',this[_0x7ea1('0x13')]['bind'](this));ami['on'](_0x7ea1('0x14'),this['syncVarSet']['bind'](this));ami['on'](_0x7ea1('0x15'),this[_0x7ea1('0x16')][_0x7ea1('0xd')](this));ami['on'](_0x7ea1('0x17'),this[_0x7ea1('0x18')][_0x7ea1('0xd')](this));ami['on'](_0x7ea1('0x19'),this['syncMusicOnHoldStop'][_0x7ea1('0xd')](this));ami['on'](_0x7ea1('0x1a'),this[_0x7ea1('0x1b')][_0x7ea1('0xd')](this));ami['on'](_0x7ea1('0x1c'),this['syncBlindTransfer'][_0x7ea1('0xd')](this));}VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x1e')]=function(_0x49f656,_0x15eaa4,_0x1ff339){io['to'](_0x49f656)[_0x7ea1('0x1e')](_0x15eaa4,_0x1ff339);};VoiceAgentReport['prototype'][_0x7ea1('0x1f')]=function(_0x291852){return _0x291852!==null&&!_['isUndefined'](_0x291852);};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0xc')]=function(_0x1f7ca1){try{if(this[_0x7ea1('0x1f')](_0x1f7ca1)){logger[_0x7ea1('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x1f7ca1['uniqueid'],_0x1f7ca1[_0x7ea1('0x21')],_0x1f7ca1[_0x7ea1('0x22')]);logger['debug'](_0x7ea1('0x23'),_0x1f7ca1[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x1f7ca1,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x1f7ca1[_0x7ea1('0x24')]])){this[_0x7ea1('0x26')][_0x1f7ca1['uniqueid']]={};}if(_[_0x7ea1('0x27')](this['channels'][_0x1f7ca1[_0x7ea1('0x24')]][_0x1f7ca1[_0x7ea1('0x22')]])){this['channels'][_0x1f7ca1[_0x7ea1('0x24')]][_0x1f7ca1[_0x7ea1('0x22')]]={'agentcalledAt':moment()[_0x7ea1('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x7ea1('0x29'),'mandatoryDisposition':this[_0x7ea1('0x8')][_0x1f7ca1[_0x7ea1('0x2a')]]?this[_0x7ea1('0x8')][_0x1f7ca1[_0x7ea1('0x2a')]][_0x7ea1('0x2b')]||![]:![],'type':this[_0x7ea1('0x8')][_0x1f7ca1[_0x7ea1('0x2a')]]?this[_0x7ea1('0x8')][_0x1f7ca1['queue']]['type']||'inbound':'inbound','variables':this[_0x7ea1('0xa')][_0x1f7ca1[_0x7ea1('0x24')]]};}_['merge'](this['channels'][_0x1f7ca1[_0x7ea1('0x24')]][_0x1f7ca1[_0x7ea1('0x22')]],_['omit'](_0x1f7ca1,[_0x7ea1('0x2c'),_0x7ea1('0x2d')]));logger['debug'](_0x7ea1('0x2e'),_0x1f7ca1[_0x7ea1('0x24')],util['inspect'](this['channels'][_0x1f7ca1[_0x7ea1('0x24')]][_0x1f7ca1['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x7ea1('0x2f'),this[_0x7ea1('0x26')][_0x1f7ca1[_0x7ea1('0x24')]][_0x1f7ca1['destuniqueid']]);logger[_0x7ea1('0x30')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x1f7ca1['uniqueid'],util[_0x7ea1('0x25')](this[_0x7ea1('0x26')][_0x1f7ca1[_0x7ea1('0x24')]][_0x1f7ca1[_0x7ea1('0x22')]],{'showHidden':![],'depth':null}));this[_0x7ea1('0x1e')](util[_0x7ea1('0x28')](_0x7ea1('0x31'),_0x1f7ca1['membername']),_0x7ea1('0x32'),this[_0x7ea1('0x26')][_0x1f7ca1[_0x7ea1('0x24')]][_0x1f7ca1[_0x7ea1('0x22')]]);}}catch(_0x38e19f){logger[_0x7ea1('0x33')](_0x7ea1('0x34'),_0x1f7ca1['uniqueid'],util[_0x7ea1('0x25')](_0x38e19f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ea1('0x1d')]['syncAgentConnect']=function(_0x1d455a){try{if(this[_0x7ea1('0x1f')](_0x1d455a)){if(this['channels'][_0x1d455a['uniqueid']]){logger[_0x7ea1('0x30')](_0x7ea1('0x35'),_0x1d455a[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x1d455a,{'showHidden':![],'depth':null}));for(var _0x315a43 in this[_0x7ea1('0x26')][_0x1d455a['uniqueid']]){if(this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x7ea1('0x36')](_0x315a43)){if(_0x1d455a[_0x7ea1('0x22')]===_0x315a43){logger['info'](_0x7ea1('0x37'),_0x1d455a[_0x7ea1('0x24')],_0x1d455a[_0x7ea1('0x21')],_0x1d455a[_0x7ea1('0x22')]);this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x38')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43]['connectedlinename']=_0x1d455a[_0x7ea1('0x39')];this[_0x7ea1('0x26')][_0x1d455a['uniqueid']][_0x315a43]['connectedlinenum']=_0x1d455a[_0x7ea1('0x3a')];this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x3b')]=_0x1d455a[_0x7ea1('0x3b')];this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x3c')]=_0x1d455a['destchannelstatedesc'];this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x3d')]=_0x1d455a[_0x7ea1('0x3d')];this['channels'][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x3e')]=_0x7ea1('0x3f');_['merge'](this[_0x7ea1('0x9')][_0x1d455a[_0x7ea1('0x40')]],_[_0x7ea1('0x41')](_0x1d455a,[_0x7ea1('0x2a'),_0x7ea1('0x42')]));logger['debug'](_0x7ea1('0x43'),_0x1d455a[_0x7ea1('0x24')],util['inspect'](this[_0x7ea1('0x26')][_0x1d455a['uniqueid']][_0x1d455a[_0x7ea1('0x22')]],{'showHidden':![],'depth':null}));ami[_0x7ea1('0x1e')](_0x7ea1('0x44'),this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x1d455a[_0x7ea1('0x22')]]);logger[_0x7ea1('0x30')](_0x7ea1('0x45'),_0x1d455a[_0x7ea1('0x24')],util['inspect'](this[_0x7ea1('0x26')][_0x1d455a['uniqueid']][_0x1d455a[_0x7ea1('0x22')]],{'showHidden':![],'depth':null}));this[_0x7ea1('0x1e')](util['format'](_0x7ea1('0x31'),_0x1d455a[_0x7ea1('0x21')]),_0x7ea1('0x46'),this[_0x7ea1('0x26')][_0x1d455a['uniqueid']][_0x1d455a[_0x7ea1('0x22')]]);}else if(!this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x10')]&&!this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x47')]){logger[_0x7ea1('0x20')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x1d455a[_0x7ea1('0x24')],this['channels'][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x21')],_0x315a43);this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43]['agentringnoanswer']=!![];this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43]['agentringnoanswerAt']=moment()[_0x7ea1('0x28')](_0x7ea1('0x48'));this['channels'][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x49')]=_0x1d455a['destuniqueid'];this['channels'][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x4a')]=_0x1d455a[_0x7ea1('0x21')];this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x3e')]=_0x7ea1('0x4b');this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43][_0x7ea1('0x4c')]=_0x7ea1('0x4b');logger[_0x7ea1('0x30')](_0x7ea1('0x4d'),_0x1d455a['uniqueid'],util[_0x7ea1('0x25')](this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43],{'showHidden':![],'depth':null}));ami[_0x7ea1('0x1e')](_0x7ea1('0x4e'),this[_0x7ea1('0x26')][_0x1d455a[_0x7ea1('0x24')]][_0x315a43]);}}}}}}catch(_0x7ec581){logger[_0x7ea1('0x33')](_0x7ea1('0x4f'),_0x1d455a[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x7ec581,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x11')]=function(_0x2b9866){try{if(this[_0x7ea1('0x1f')](_0x2b9866)){logger[_0x7ea1('0x30')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x2b9866[_0x7ea1('0x24')],util['inspect'](_0x2b9866,{'showHidden':![],'depth':null}));if(this[_0x7ea1('0x26')][_0x2b9866[_0x7ea1('0x24')]]&&this[_0x7ea1('0x26')][_0x2b9866[_0x7ea1('0x24')]][_0x2b9866[_0x7ea1('0x22')]]){logger[_0x7ea1('0x20')](_0x7ea1('0x50'),_0x2b9866['uniqueid'],_0x2b9866[_0x7ea1('0x21')],_0x2b9866[_0x7ea1('0x22')]);this[_0x7ea1('0x26')][_0x2b9866[_0x7ea1('0x24')]][_0x2b9866['destuniqueid']][_0x7ea1('0x10')]=!![];this[_0x7ea1('0x26')][_0x2b9866[_0x7ea1('0x24')]][_0x2b9866['destuniqueid']][_0x7ea1('0x51')]=moment()[_0x7ea1('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ea1('0x26')][_0x2b9866[_0x7ea1('0x24')]][_0x2b9866[_0x7ea1('0x22')]]['lastevent']=_0x7ea1('0x52');this['channels'][_0x2b9866[_0x7ea1('0x24')]][_0x2b9866[_0x7ea1('0x22')]][_0x7ea1('0x4c')]=_0x7ea1('0x52');logger[_0x7ea1('0x30')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x2b9866[_0x7ea1('0x24')],util[_0x7ea1('0x25')](this['channels'][_0x2b9866[_0x7ea1('0x24')]][_0x2b9866[_0x7ea1('0x22')]],{'showHidden':![],'depth':null}));ami[_0x7ea1('0x1e')]('custom:agentringnoanswer',this[_0x7ea1('0x26')][_0x2b9866[_0x7ea1('0x24')]][_0x2b9866[_0x7ea1('0x22')]]);}}}catch(_0x1469c5){logger[_0x7ea1('0x33')](_0x7ea1('0x53'),_0x2b9866['uniqueid'],util['inspect'](_0x1469c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x54')]=function(_0x4086e2){try{if(this['isNotNull'](_0x4086e2)){logger[_0x7ea1('0x30')](_0x7ea1('0x55'),_0x4086e2[_0x7ea1('0x24')],util['inspect'](_0x4086e2,{'showHidden':![],'depth':null}));if(this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]]){for(var _0x2c09f1 in this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]]){if(this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x7ea1('0x36')](_0x2c09f1)&&!this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1][_0x7ea1('0x10')]&&!this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1][_0x7ea1('0x47')]){logger[_0x7ea1('0x20')](_0x7ea1('0x56'),_0x4086e2[_0x7ea1('0x24')],this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1][_0x7ea1('0x21')],_0x2c09f1);this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1][_0x7ea1('0x10')]=!![];this['channels'][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1][_0x7ea1('0x51')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1][_0x7ea1('0x3e')]=_0x7ea1('0x57');this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1][_0x7ea1('0x4c')]=_0x7ea1('0x57');logger[_0x7ea1('0x30')](_0x7ea1('0x58'),_0x4086e2[_0x7ea1('0x24')],util[_0x7ea1('0x25')](this[_0x7ea1('0x26')][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1],{'showHidden':![],'depth':null}));ami['emit'](_0x7ea1('0x59'),this['channels'][_0x4086e2[_0x7ea1('0x24')]][_0x2c09f1]);}}}}}catch(_0x306c7e){logger[_0x7ea1('0x33')](_0x7ea1('0x5a'),_0x4086e2['uniqueid'],util[_0x7ea1('0x25')](_0x306c7e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7ea1('0x13')]=function(_0x28e2e1){try{if(this[_0x7ea1('0x1f')](_0x28e2e1)){logger[_0x7ea1('0x30')](_0x7ea1('0x5b'),_0x28e2e1[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x28e2e1,{'showHidden':![],'depth':null}));if(this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]]){for(var _0x4dca01 in this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]]){if(this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x7ea1('0x36')](_0x4dca01)){if(this['channels'][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01][_0x7ea1('0x38')]&&!this[_0x7ea1('0x26')][_0x28e2e1['uniqueid']][_0x4dca01]['agentcomplete']){logger[_0x7ea1('0x20')](_0x7ea1('0x5c'),_0x28e2e1[_0x7ea1('0x24')],this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01][_0x7ea1('0x21')],_0x4dca01);this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01][_0x7ea1('0x47')]=!![];this[_0x7ea1('0x26')][_0x28e2e1['uniqueid']][_0x4dca01][_0x7ea1('0x5d')]=moment()[_0x7ea1('0x28')](_0x7ea1('0x48'));this['channels'][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01][_0x7ea1('0x3e')]='complete';this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01][_0x7ea1('0x4c')]=_0x28e2e1[_0x7ea1('0x4c')]==_0x7ea1('0x5e')?'agent':_0x28e2e1['reason'];this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01][_0x7ea1('0x5f')]=_0x28e2e1[_0x7ea1('0x5f')];if(this[_0x7ea1('0x8')][_0x28e2e1['queue']]&&this[_0x7ea1('0x8')][_0x28e2e1[_0x7ea1('0x2a')]][_0x7ea1('0x60')]){this[_0x7ea1('0x26')][_0x28e2e1['uniqueid']][_0x4dca01]['acwtime']=this[_0x7ea1('0x8')][_0x28e2e1[_0x7ea1('0x2a')]][_0x7ea1('0x61')];this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01][_0x7ea1('0x62')]=!![];}this[_0x7ea1('0x9')][_0x28e2e1['interface']]=_[_0x7ea1('0x63')](this[_0x7ea1('0x9')][_0x28e2e1[_0x7ea1('0x40')]],[_0x7ea1('0x2a'),'destconnectedlinenum']);logger['debug'](_0x7ea1('0x64'),_0x28e2e1['uniqueid'],util[_0x7ea1('0x25')](this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01],{'showHidden':![],'depth':null}));ami[_0x7ea1('0x1e')](_0x7ea1('0x65'),this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01]);logger[_0x7ea1('0x30')](_0x7ea1('0x66'),_0x28e2e1[_0x7ea1('0x24')],util[_0x7ea1('0x25')](this[_0x7ea1('0x26')][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01],{'showHidden':![],'depth':null}));this['emit'](util[_0x7ea1('0x28')]('user:%s',_0x28e2e1[_0x7ea1('0x21')]),'user:agentcomplete',this['channels'][_0x28e2e1[_0x7ea1('0x24')]][_0x4dca01]);}}}}}}catch(_0x5a4090){logger['error'](_0x7ea1('0x67'),_0x28e2e1[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x5a4090,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x68')]=function(_0x10886a){try{if(this[_0x7ea1('0x1f')](_0x10886a)){logger['debug'](_0x7ea1('0x69'),_0x10886a[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x10886a,{'showHidden':![],'depth':null}));this['addVariable'](_0x10886a[_0x7ea1('0x24')],_[_0x7ea1('0x6a')](_0x10886a[_0x7ea1('0x6b')])[0x0],_0x10886a[_0x7ea1('0x6c')]);if(this['channels'][_0x10886a['uniqueid']]){for(var _0x1b647e in this['channels'][_0x10886a[_0x7ea1('0x24')]]){if(this[_0x7ea1('0x26')][_0x10886a[_0x7ea1('0x24')]][_0x7ea1('0x36')](_0x1b647e)){logger[_0x7ea1('0x20')](_0x7ea1('0x6d'),_0x10886a[_0x7ea1('0x24')],_0x1b647e,_[_0x7ea1('0x6a')](_0x10886a[_0x7ea1('0x6b')])[0x0],_0x10886a[_0x7ea1('0x6c')]);if(_[_0x7ea1('0x27')](this[_0x7ea1('0x26')][_0x10886a[_0x7ea1('0x24')]][_0x1b647e][_0x7ea1('0xa')])){this['channels'][_0x10886a[_0x7ea1('0x24')]][_0x1b647e][_0x7ea1('0xa')]={};}this[_0x7ea1('0x26')][_0x10886a[_0x7ea1('0x24')]][_0x1b647e]['variables']=this[_0x7ea1('0xa')][_0x10886a[_0x7ea1('0x24')]];}}}}}catch(_0x53f311){logger['error']('[%s][voiceAgentReport][varset]',_0x10886a['uniqueid'],util['inspect'](_0x53f311,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x6e')]=function(_0x5f125b,_0x5e0cba,_0x549de8){var _0xa17f4=[_0x7ea1('0x6f'),_0x7ea1('0x70'),_0x7ea1('0x71'),_0x7ea1('0x72'),_0x7ea1('0x73'),_0x7ea1('0x74'),_0x7ea1('0x75'),_0x7ea1('0x76'),_0x7ea1('0x77'),'sipuri',_0x7ea1('0x78'),'bridgepvtcallid',_0x7ea1('0x79'),_0x7ea1('0x7a'),_0x7ea1('0x7b'),_0x7ea1('0x7c'),_0x7ea1('0x21'),_0x7ea1('0x7d'),_0x7ea1('0x7e')];if(!_[_0x7ea1('0x7f')](_0x5e0cba)&&!_[_0x7ea1('0x80')](_0xa17f4,_0x5e0cba)){if(_[_0x7ea1('0x27')](this[_0x7ea1('0xa')][_0x5f125b])){this[_0x7ea1('0xa')][_0x5f125b]={};}this[_0x7ea1('0xa')][_0x5f125b][_0x5e0cba]=_0x549de8;}};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x16')]=function(_0x361529){try{if(this[_0x7ea1('0x1f')](_0x361529)){logger[_0x7ea1('0x30')]('[%s][voiceAgentReport][hangup]\x20event:',_0x361529[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x361529,{'showHidden':![],'depth':null}));if(this[_0x7ea1('0x26')][_0x361529[_0x7ea1('0x24')]]){for(var _0x2937cc in this[_0x7ea1('0x26')][_0x361529[_0x7ea1('0x24')]]){if(this['channels'][_0x361529[_0x7ea1('0x24')]][_0x7ea1('0x36')](_0x2937cc)){if(this[_0x7ea1('0x26')][_0x361529[_0x7ea1('0x24')]][_0x2937cc][_0x7ea1('0x4c')]==_0x7ea1('0x5e')&&this[_0x7ea1('0x26')][_0x361529[_0x7ea1('0x24')]][_0x2937cc]['agentcomplete']){logger[_0x7ea1('0x20')](_0x7ea1('0x81'),_0x361529[_0x7ea1('0x24')],_0x2937cc);this[_0x7ea1('0x26')][_0x361529[_0x7ea1('0x24')]][_0x2937cc][_0x7ea1('0x5d')]=moment()[_0x7ea1('0x28')](_0x7ea1('0x48'));}}}logger[_0x7ea1('0x30')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x361529[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_[_0x7ea1('0x82')](this[_0x7ea1('0x26')][_0x361529[_0x7ea1('0x24')]]),{'showHidden':![],'depth':null}));ami[_0x7ea1('0x1e')](_0x7ea1('0x83'),_[_0x7ea1('0x82')](this['channels'][_0x361529[_0x7ea1('0x24')]]));delete this[_0x7ea1('0x26')][_0x361529[_0x7ea1('0x24')]];}if(this[_0x7ea1('0xa')][_0x361529[_0x7ea1('0x24')]]){delete this[_0x7ea1('0xa')][_0x361529[_0x7ea1('0x24')]];}}}catch(_0x430117){logger['error'](_0x7ea1('0x84'),_0x361529['uniqueid'],util[_0x7ea1('0x25')](_0x430117,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x1b')]=function(_0xf4b1b1){try{if(this[_0x7ea1('0x1f')](_0xf4b1b1)){logger[_0x7ea1('0x30')](_0x7ea1('0x85'),_0xf4b1b1[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0xf4b1b1,{'showHidden':![],'depth':null}));if(this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]]){for(var _0x39e6d0 in this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]]){if(this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]][_0x7ea1('0x36')](_0x39e6d0)){if(_0xf4b1b1[_0x7ea1('0x87')]===_0x39e6d0){logger['info'](_0x7ea1('0x88'),_0xf4b1b1[_0x7ea1('0x24')],this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]][_0x39e6d0][_0x7ea1('0x21')],_0x39e6d0);var _0x2306a2=moment();this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]][_0x39e6d0][_0x7ea1('0x47')]=!![];this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]][_0x39e6d0][_0x7ea1('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]][_0x39e6d0][_0x7ea1('0x3e')]=_0x7ea1('0x89');this['channels'][_0xf4b1b1[_0x7ea1('0x86')]][_0x39e6d0][_0x7ea1('0x4c')]=_0x7ea1('0x5e');this['channels'][_0xf4b1b1[_0x7ea1('0x86')]][_0x39e6d0][_0x7ea1('0x5f')]=_0x2306a2[_0x7ea1('0x8a')](this[_0x7ea1('0x26')][_0xf4b1b1['transfereeuniqueid']][_0x39e6d0][_0x7ea1('0x38')],'seconds');}}}}if(this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x8b')]]){var _0x5a6fa2=this[_0x7ea1('0x26')][_0xf4b1b1['secondtransfereruniqueid']];this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x8b')]]=this[_0x7ea1('0x26')][_0xf4b1b1[_0x7ea1('0x86')]];this[_0x7ea1('0x26')][_0xf4b1b1['transfereeuniqueid']]=_0x5a6fa2;}}}catch(_0x566568){logger['error'](_0x7ea1('0x8c'),_0xf4b1b1['uniqueid'],util[_0x7ea1('0x25')](_0x566568,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7ea1('0x1d')][_0x7ea1('0x8d')]=function(_0x3b026d){try{if(this[_0x7ea1('0x1f')](_0x3b026d)){logger[_0x7ea1('0x30')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x3b026d[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x3b026d,{'showHidden':![],'depth':null}));if(this['channels'][_0x3b026d[_0x7ea1('0x86')]]){for(var _0x541ad3 in this[_0x7ea1('0x26')][_0x3b026d['transfereeuniqueid']]){if(this[_0x7ea1('0x26')][_0x3b026d['transfereeuniqueid']]['hasOwnProperty'](_0x541ad3)){if(_0x3b026d[_0x7ea1('0x8e')]===_0x541ad3){logger[_0x7ea1('0x20')](_0x7ea1('0x8f'),_0x3b026d[_0x7ea1('0x24')],this[_0x7ea1('0x26')][_0x3b026d[_0x7ea1('0x86')]][_0x541ad3]['membername'],_0x541ad3);var _0x5d0a88=moment();this['channels'][_0x3b026d[_0x7ea1('0x86')]][_0x541ad3][_0x7ea1('0x47')]=!![];this[_0x7ea1('0x26')][_0x3b026d[_0x7ea1('0x86')]][_0x541ad3][_0x7ea1('0x5d')]=_0x5d0a88;this[_0x7ea1('0x26')][_0x3b026d[_0x7ea1('0x86')]][_0x541ad3][_0x7ea1('0x3e')]=_0x7ea1('0x89');this[_0x7ea1('0x26')][_0x3b026d['transfereeuniqueid']][_0x541ad3][_0x7ea1('0x4c')]=_0x7ea1('0x5e');this['channels'][_0x3b026d[_0x7ea1('0x86')]][_0x541ad3]['talktime']=_0x5d0a88[_0x7ea1('0x8a')](this['channels'][_0x3b026d[_0x7ea1('0x86')]][_0x541ad3][_0x7ea1('0x38')],'seconds');}}}}}}catch(_0x4a1f77){logger['error'](_0x7ea1('0x90'),_0x3b026d[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x4a1f77,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7ea1('0x18')]=function(_0x2cb93a){var _0x3736b2='';try{if(this[_0x7ea1('0x1f')](_0x2cb93a)){logger[_0x7ea1('0x30')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x2cb93a[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x2cb93a,{'showHidden':![],'depth':null}));if(_0x2cb93a['channel']){_0x3736b2=_0x2cb93a[_0x7ea1('0x91')][_0x7ea1('0x92')](0x0,_0x2cb93a['channel']['lastIndexOf']('-'));if(this['agents'][_0x3736b2]){logger['info'](_0x7ea1('0x93'),_0x2cb93a['uniqueid'],_0x3736b2);this[_0x7ea1('0x9')][_0x3736b2][_0x7ea1('0x94')]=!![];}}}}catch(_0x117642){logger['error'](_0x7ea1('0x95'),_0x2cb93a[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x117642,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7ea1('0x96')]=function(_0x4f82e0){var _0x1b4b15='';try{if(this[_0x7ea1('0x1f')](_0x4f82e0)){logger[_0x7ea1('0x30')](_0x7ea1('0x97'),_0x4f82e0[_0x7ea1('0x24')],util[_0x7ea1('0x25')](_0x4f82e0,{'showHidden':![],'depth':null}));if(_0x4f82e0[_0x7ea1('0x91')]){_0x1b4b15=_0x4f82e0['channel'][_0x7ea1('0x92')](0x0,_0x4f82e0[_0x7ea1('0x91')]['lastIndexOf']('-'));if(this[_0x7ea1('0x9')][_0x1b4b15]){logger[_0x7ea1('0x20')](_0x7ea1('0x98'),_0x4f82e0[_0x7ea1('0x24')],_0x1b4b15);this['agents'][_0x1b4b15][_0x7ea1('0x94')]=![];}}}}catch(_0x447548){logger[_0x7ea1('0x33')]('[%s][voiceAgentReport][musiconholdstop]',_0x4f82e0['uniqueid'],util[_0x7ea1('0x25')](_0x447548,{'showHidden':![],'depth':null}));}};module[_0x7ea1('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 819707b..176e312 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 _0x482d=['[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','blindTransfers','outbound','emit','[%s][voiceCallReport][hangup]','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','answertime','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','bluebird','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../model/channel','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newchannel','syncNewChannel','bind','newstate','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','keys','[%s][voiceCallReport][newcallerid]','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','application','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','duration','subtract','seconds','pick','includes','lastdata','set','startsWith','cdr('];(function(_0x373423,_0x3a67cd){var _0x59a10f=function(_0x2409da){while(--_0x2409da){_0x373423['push'](_0x373423['shift']());}};_0x59a10f(++_0x3a67cd);}(_0x482d,0x1b4));var _0xd482=function(_0x5a1ae8,_0x438c49){_0x5a1ae8=_0x5a1ae8-0x0;var _0x3fa1e6=_0x482d[_0x5a1ae8];return _0x3fa1e6;};'use strict';var BPromise=require(_0xd482('0x0'));var _=require(_0xd482('0x1'));var moment=require(_0xd482('0x2'));var util=require(_0xd482('0x3'));var path=require(_0xd482('0x4'));var Redis=require('ioredis');var config=require(_0xd482('0x5'));var logger=require(_0xd482('0x6'))(_0xd482('0x7'));var ami=require('../ami');var Channel=require(_0xd482('0x8'));var statusDesc=['unknown',_0xd482('0x9'),_0xd482('0xa'),'busy',_0xd482('0xb'),_0xd482('0xc'),_0xd482('0xd'),_0xd482('0xe'),_0xd482('0xf')];var applications=['set',_0xd482('0x10'),_0xd482('0x11'),_0xd482('0x12'),_0xd482('0x13'),_0xd482('0x14')];var dispositions=['NO\x20ANSWER',_0xd482('0x15'),'FAILED',_0xd482('0x16'),_0xd482('0x16'),_0xd482('0x16'),_0xd482('0x17'),'BUSY',_0xd482('0x15'),_0xd482('0x15'),_0xd482('0x15')];var actions={};config[_0xd482('0x18')]=_['defaults'](config[_0xd482('0x18')],{'host':'localhost','port':0x18eb});var io=require(_0xd482('0x19'))(new Redis(config[_0xd482('0x18')]));function VoiceCallReport(_0x39a316){this[_0xd482('0x1a')]=_0x39a316[_0xd482('0x1a')];this[_0xd482('0x1b')]=_0x39a316['agents'];this['blindTransfers']={};ami['on'](_0xd482('0x1c'),this[_0xd482('0x1d')]['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xd482('0x1e'),this[_0xd482('0x1f')][_0xd482('0x20')](this));ami['on'](_0xd482('0x21'),this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet'][_0xd482('0x20')](this));ami['on']('hangup',this[_0xd482('0x22')][_0xd482('0x20')](this));ami['on'](_0xd482('0x23'),this[_0xd482('0x24')][_0xd482('0x20')](this));ami['on'](_0xd482('0x25'),this[_0xd482('0x26')][_0xd482('0x20')](this));ami['on'](_0xd482('0x27'),this['syncBlindTransfer'][_0xd482('0x20')](this));ami['on'](_0xd482('0x28'),this[_0xd482('0x29')][_0xd482('0x20')](this));ami['on'](_0xd482('0x2a'),this[_0xd482('0x2b')][_0xd482('0x20')](this));try{logger[_0xd482('0x2c')](_0xd482('0x2d'));ami['actionCoreShowChannels']();}catch(_0x11f854){logger[_0xd482('0x2e')](_0xd482('0x2f'),util[_0xd482('0x30')](_0x11f854,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xd482('0x31')]=function(_0x2cf0ff){return _0x2cf0ff!==null&&!_[_0xd482('0x32')](_0x2cf0ff);};VoiceCallReport[_0xd482('0x33')]['emit']=function(_0x31e681,_0x5d1e4b,_0x3b7bc9){io['to'](_0x31e681)['emit'](_0x5d1e4b,_0x3b7bc9);};VoiceCallReport['prototype'][_0xd482('0x24')]=function(_0x489879){try{if(this[_0xd482('0x31')](_0x489879)){logger[_0xd482('0x2c')](_0xd482('0x34'),_0x489879['uniqueid'],_0x489879[_0xd482('0x35')],_0x489879[_0xd482('0x36')]);logger[_0xd482('0x37')](_0xd482('0x38'),_0x489879[_0xd482('0x39')],util['inspect'](_0x489879,{'showHidden':![],'depth':null}));if(_0x489879[_0xd482('0x39')]===_0x489879[_0xd482('0x3a')]){if(!_[_0xd482('0x32')](this[_0xd482('0x1a')][_0x489879['uniqueid']])){_[_0xd482('0x3b')](this['channels'][_0x489879[_0xd482('0x39')]],_['pick'](_0x489879,_[_0xd482('0x3c')](this[_0xd482('0x1a')][_0x489879[_0xd482('0x39')]])));}}}}catch(_0x566c44){logger[_0xd482('0x2e')](_0xd482('0x3d'),_0x489879[_0xd482('0x39')],util[_0xd482('0x30')](_0x566c44,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd482('0x1f')]=function(_0x2faff7){try{if(this['isNotNull'](_0x2faff7)){logger[_0xd482('0x37')]('[%s][voiceCallReport][newchannel]\x20event:',_0x2faff7[_0xd482('0x39')],util[_0xd482('0x30')](_0x2faff7,{'showHidden':![],'depth':null}));if(_0x2faff7[_0xd482('0x39')]===_0x2faff7['linkedid']&&_0x2faff7[_0xd482('0x3e')]!=_0xd482('0x3f')){if(_[_0xd482('0x32')](this[_0xd482('0x1a')][_0x2faff7[_0xd482('0x39')]])){logger[_0xd482('0x2c')](_0xd482('0x40'),_0x2faff7[_0xd482('0x39')],_0x2faff7[_0xd482('0x41')],_0x2faff7['exten']);this[_0xd482('0x1a')][_0x2faff7['uniqueid']]=new Channel();this[_0xd482('0x1a')][_0x2faff7[_0xd482('0x39')]][_0xd482('0x42')]=moment()[_0xd482('0x43')](_0xd482('0x44'));this[_0xd482('0x1a')][_0x2faff7['uniqueid']][_0xd482('0x45')]=dispositions[_[_0xd482('0x46')](_0x2faff7[_0xd482('0x47')])];_['merge'](this[_0xd482('0x1a')][_0x2faff7['uniqueid']],_['pick'](_0x2faff7,_[_0xd482('0x3c')](this['channels'][_0x2faff7[_0xd482('0x39')]])));if(_0x2faff7[_0xd482('0x41')]===_0xd482('0x48')){if(this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]){this['agents'][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]][_0xd482('0x4a')]=_0x2faff7[_0xd482('0x4b')];logger['debug'](_0xd482('0x4c'),_0x2faff7[_0xd482('0x39')],util['inspect']({'destaccountcode':this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2faff7[_0xd482('0x4b')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xd482('0x4d'),this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')]['split']('-')[0x0]][_0xd482('0x4e')]),_0xd482('0x4f'),{'destaccountcode':this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]][_0xd482('0x50')],'destconnectedlinenum':_0x2faff7[_0xd482('0x4b')]});}}}}}}catch(_0x2419e9){logger[_0xd482('0x2e')](_0xd482('0x51'),_0x2faff7[_0xd482('0x39')],util[_0xd482('0x30')](_0x2419e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x1d')]=function(_0x48d766){try{if(this[_0xd482('0x31')](_0x48d766)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x48d766[_0xd482('0x39')],util['inspect'](_0x48d766,{'showHidden':![],'depth':null}));if(_0x48d766[_0xd482('0x39')]===_0x48d766[_0xd482('0x3a')]&&_0x48d766[_0xd482('0x4b')]!='h'&&_0x48d766[_0xd482('0x3e')]!=_0xd482('0x3f')){_0x48d766[_0xd482('0x52')]=_0x48d766[_0xd482('0x52')]['toLowerCase']();_0x48d766['applicationdata']=(_0x48d766['appdata']||_0x48d766['applicationdata'])[_0xd482('0x53')]();logger['info'](_0xd482('0x54'),_0x48d766[_0xd482('0x39')],_0x48d766[_0xd482('0x52')],_0x48d766[_0xd482('0x55')]);if(_[_0xd482('0x32')](this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]])){this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]]=new Channel();this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0xd482('0x42')]=_0x48d766[_0xd482('0x56')]?moment()[_0xd482('0x57')](moment[_0xd482('0x56')](_0x48d766[_0xd482('0x56')])[_0xd482('0x58')](),_0xd482('0x58'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xd482('0x43')](_0xd482('0x44'));this['channels'][_0x48d766[_0xd482('0x39')]][_0xd482('0x45')]=_0xd482('0x16');}_[_0xd482('0x3b')](this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]],_[_0xd482('0x59')](_0x48d766,_[_0xd482('0x3c')](this['channels'][_0x48d766[_0xd482('0x39')]])));if(_[_0xd482('0x5a')](applications,_0x48d766['application'])){this['channels'][_0x48d766[_0xd482('0x39')]]['lastapplication']=_0x48d766['application'];this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0xd482('0x5b')]=_0x48d766['applicationdata'];if(_0x48d766[_0xd482('0x52')]===_0xd482('0x5c')&&_[_0xd482('0x5d')](_0x48d766[_0xd482('0x55')],_0xd482('0x5e'))){var _0x53fa29=_0x48d766[_0xd482('0x55')][_0xd482('0x49')]('=');var _0x45b498=_0x53fa29[0x0]['match'](/cdr\((.*)\)/);if(_0x45b498){this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0x45b498[0x1]]=_0x53fa29[0x1];}}else if(_0x48d766['application']===_0xd482('0x10')){this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0xd482('0x10')]=_0x48d766[_0xd482('0x55')]['split'](',')[0x0];}}}}}catch(_0x17ec54){logger[_0xd482('0x2e')](_0xd482('0x5f'),_0x48d766[_0xd482('0x39')],util[_0xd482('0x30')](_0x17ec54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x60')]=function(_0x3b7c78){try{if(this['isNotNull'](_0x3b7c78)){logger[_0xd482('0x2c')](_0xd482('0x61'),_0x3b7c78[_0xd482('0x39')],_0x3b7c78[_0xd482('0x3a')],_0x3b7c78[_0xd482('0x35')],_0x3b7c78['calleridnum']);logger[_0xd482('0x37')]('[%s][voiceCallReport][newstate]\x20event:',_0x3b7c78[_0xd482('0x39')],util[_0xd482('0x30')](_0x3b7c78,{'showHidden':![],'depth':null}));if(_0x3b7c78['uniqueid']!==_0x3b7c78[_0xd482('0x3a')]){if(this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]){if(_0x3b7c78['channelstate']==='6'){if(!this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x62')]){var _0xe2acc0=moment();this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['answered']=!![];this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['answertime']=_0xe2acc0[_0xd482('0x43')](_0xd482('0x44'));if(this[_0xd482('0x1a')][_0x3b7c78['linkedid']][_0xd482('0x42')]){this['channels'][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x63')]=_0xe2acc0[_0xd482('0x64')](this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['starttime'],_0xd482('0x58'));}}this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x3a')]=_0x3b7c78[_0xd482('0x39')];if(_0x3b7c78[_0xd482('0x36')]!=='xcally-motion-preview'){this['channels'][_0x3b7c78['linkedid']][_0xd482('0x65')]=_0x3b7c78[_0xd482('0x36')];}this['channels'][_0x3b7c78['linkedid']][_0xd482('0x66')]=_0x3b7c78[_0xd482('0x35')];this['channels'][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x67')]=_0x3b7c78[_0xd482('0x3e')];this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['disposition']=dispositions[_[_0xd482('0x46')](_0x3b7c78[_0xd482('0x47')])];if(this['agents'][_0x3b7c78['channel'][_0xd482('0x49')]('-')[0x0]]){this[_0xd482('0x1a')][_0x3b7c78['linkedid']][_0xd482('0x68')]=this[_0xd482('0x1b')][_0x3b7c78[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]['id'];this[_0xd482('0x1a')][_0x3b7c78['linkedid']][_0xd482('0x69')]=this['agents'][_0x3b7c78['channel']['split']('-')[0x0]][_0xd482('0x4e')];}}}}else{if(this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x39')]]){if(_0x3b7c78[_0xd482('0x47')]==='6'){if(this[_0xd482('0x1b')][_0x3b7c78[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]){this['channels'][_0x3b7c78[_0xd482('0x39')]]['UserId']=this[_0xd482('0x1b')][_0x3b7c78['channel']['split']('-')[0x0]]['id'];this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x39')]][_0xd482('0x69')]=this['agents'][_0x3b7c78['channel'][_0xd482('0x49')]('-')[0x0]]['name'];}}}}}}catch(_0x35d354){logger[_0xd482('0x2e')](_0xd482('0x6a'),_0x3b7c78[_0xd482('0x39')],util['inspect'](_0x35d354,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x6b')]=function(_0xad2e10,_0x1e864c){try{if(this[_0xd482('0x1a')][_0xad2e10]){logger[_0xd482('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0xad2e10,_0x1e864c);this['channels'][_0xad2e10][_0xd482('0x6c')]=!![];if(_[_0xd482('0x6d')](_0x1e864c,_0xd482('0x6e'))){_0x1e864c=_0x1e864c[_0xd482('0x6f')](_0xd482('0x6e'),'.WAV');}this[_0xd482('0x1a')][_0xad2e10][_0xd482('0x70')]=_0x1e864c;var _0x330c0e=_[_0xd482('0x71')](this[_0xd482('0x1a')][_0xad2e10][_0xd482('0x72')],{'filename':_0x1e864c});if(_['isNil'](_0x330c0e)){this[_0xd482('0x1a')][_0xad2e10][_0xd482('0x72')][_0xd482('0x73')]({'filename':_0x1e864c,'createdAt':moment()[_0xd482('0x43')](_0xd482('0x44')),'mixmonitorid':'','status':_0xd482('0x74')});}}}catch(_0x53537f){logger['error'](_0xd482('0x75'),_0xad2e10,util[_0xd482('0x30')](_0x53537f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd482('0x76')]=function(_0x4deb9f){try{if(this[_0xd482('0x31')](_0x4deb9f)){logger[_0xd482('0x37')]('[%s][voiceCallReport][varset]\x20event:',_0x4deb9f[_0xd482('0x39')],util['inspect'](_0x4deb9f,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]]&&_0x4deb9f[_0xd482('0x3e')]!=_0xd482('0x3f')){if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')])){if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x78')])){logger[_0xd482('0x2c')](_0xd482('0x79'),_0x4deb9f['uniqueid'],_0x4deb9f['value']);this[_0xd482('0x6b')](_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);}else if(this['isNotNull'](_0x4deb9f['variable'][_0xd482('0x7b')])){logger[_0xd482('0x2c')](_0xd482('0x7c'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x36')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')]['xmd-callerid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x7d')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x7e')])){logger[_0xd482('0x2c')](_0xd482('0x7f'),_0x4deb9f['uniqueid'],_0x4deb9f[_0xd482('0x7a')]);this['channels'][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x80')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x81')])){logger[_0xd482('0x2c')](_0xd482('0x82'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')][_0xd482('0x49')](',')[0x0]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x10')]=_0x4deb9f['value']['split'](',')[0x0];}else if(this['isNotNull'](_0x4deb9f[_0xd482('0x77')][_0xd482('0x83')])){logger[_0xd482('0x2c')](_0xd482('0x84'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]]['originatecalleridnum']=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f['variable'][_0xd482('0x85')])){logger['info'](_0xd482('0x86'),_0x4deb9f['uniqueid'],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]]['destination']=_0x4deb9f[_0xd482('0x7a')];}else if(this['isNotNull'](_0x4deb9f[_0xd482('0x77')][_0xd482('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x88')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x89')])){logger['info'](_0xd482('0x8a'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x10')]=_0x4deb9f['value'];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')]['sipcallid'])){logger[_0xd482('0x2c')](_0xd482('0x8b'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x8c')]=_0x4deb9f[_0xd482('0x7a')];}}}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x78')])){if(_0x4deb9f['value']){var _0x19ff0d=path[_0xd482('0x8d')](_0x4deb9f[_0xd482('0x7a')])['name'];logger[_0xd482('0x2c')](_0xd482('0x79'),_0x19ff0d,_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x6b')](_0x19ff0d,_0x4deb9f[_0xd482('0x7a')]);}}else if(this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x3a')]]){if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')])){if(this[_0xd482('0x31')](_0x4deb9f['variable'][_0xd482('0x8e')])){logger[_0xd482('0x2c')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4deb9f['linkedid'],_0x4deb9f[_0xd482('0x7a')]);this['channels'][_0x4deb9f['linkedid']][_0xd482('0x8f')]=_0x4deb9f[_0xd482('0x7a')];}}}}}catch(_0xecc8ee){logger['error'](_0xd482('0x90'),_0x4deb9f['uniqueid'],util[_0xd482('0x30')](_0xecc8ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')]['syncHangup']=function(_0x35a971){try{if(this[_0xd482('0x31')](_0x35a971)){logger[_0xd482('0x37')](_0xd482('0x91'),_0x35a971[_0xd482('0x39')],util['inspect'](_0x35a971,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]]){logger[_0xd482('0x2c')](_0xd482('0x92'),_0x35a971[_0xd482('0x39')],_0x35a971[_0xd482('0x93')]);var _0x249412=moment();this['channels'][_0x35a971[_0xd482('0x39')]]['endtime']=_0x249412[_0xd482('0x43')](_0xd482('0x44'));this['channels'][_0x35a971[_0xd482('0x39')]][_0xd482('0x56')]=_0x249412['diff'](this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x42')],_0xd482('0x58'));if(this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x62')]){this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x94')]=_0x249412['diff'](this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]]['answertime'],_0xd482('0x58'));this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x63')]=this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]]['duration']-this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x94')];}if(_0x35a971[_0xd482('0x41')]===_0xd482('0x48')){if(this['agents'][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]){this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]=_['omit'](this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]],[_0xd482('0x4a')]);logger[_0xd482('0x37')](_0xd482('0x95'),_0x35a971[_0xd482('0x39')],util[_0xd482('0x30')]({'destaccountcode':this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]][_0xd482('0x50')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xd482('0x43')](_0xd482('0x4d'),this['agents'][_0x35a971[_0xd482('0x3e')]['split']('-')[0x0]]['name']),_0xd482('0x96'),{'destaccountcode':this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')]['split']('-')[0x0]][_0xd482('0x50')]});}}if(_0x35a971['event']==='BlindTransfer'){this[_0xd482('0x97')][_0x35a971[_0xd482('0x39')]]=this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]];}else{if(this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x80')]===_0xd482('0x98')&&this['blindTransfers'][_0x35a971[_0xd482('0x39')]]){this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x39')]=[this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x3a')],this['channels'][_0x35a971[_0xd482('0x39')]][_0xd482('0x3a')]=this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x39')]][0x0];delete this['blindTransfers'][_0x35a971[_0xd482('0x39')]];}}logger[_0xd482('0x37')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x35a971[_0xd482('0x39')],util[_0xd482('0x30')](this[_0xd482('0x1a')][_0x35a971['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd482('0x99')]('custom:voiceCallReport',this[_0xd482('0x1a')][_0x35a971['uniqueid']]);delete this['channels'][_0x35a971['uniqueid']];}}}catch(_0x378fd1){logger[_0xd482('0x2e')](_0xd482('0x9a'),_0x35a971[_0xd482('0x39')],util[_0xd482('0x30')](_0x378fd1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd482('0x26')]=function(_0x5a9d07){try{if(this[_0xd482('0x31')](_0x5a9d07)){logger[_0xd482('0x2c')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5a9d07[_0xd482('0x39')],_0x5a9d07['origtransferercalleridnum'],_0x5a9d07[_0xd482('0x9b')]);logger[_0xd482('0x37')](_0xd482('0x9c'),_0x5a9d07[_0xd482('0x39')],util[_0xd482('0x30')](_0x5a9d07,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0x9d')]]){this[_0xd482('0x1a')][_0x5a9d07['transfereeuniqueid']][_0xd482('0x9e')]=_0x5a9d07[_0xd482('0x9f')];this['channels'][_0x5a9d07[_0xd482('0x9d')]][_0xd482('0xa0')]=_0x5a9d07[_0xd482('0x9b')];if(this['channels'][_0x5a9d07[_0xd482('0xa1')]]){var _0x5e3cfe=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa1')]];this[_0xd482('0x1a')][_0x5a9d07['secondtransfereruniqueid']]=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0x9d')]];this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0x9d')]]=_0x5e3cfe;}}else if(this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]]){this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]][_0xd482('0x9e')]=_0x5a9d07['origtransferercalleridnum'];this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]][_0xd482('0xa0')]=_0x5a9d07[_0xd482('0x9b')];if(this['channels'][_0x5a9d07[_0xd482('0xa3')]]){var _0x5e3cfe=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa3')]];this['channels'][_0x5a9d07[_0xd482('0xa3')]]=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]];this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]]=_0x5e3cfe;}}}}catch(_0x326755){logger[_0xd482('0x2e')](_0xd482('0xa4'),_0x5a9d07[_0xd482('0x39')],util[_0xd482('0x30')](_0x326755,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0xa5')]=function(_0x1017ed){try{if(this[_0xd482('0x31')](_0x1017ed)){logger[_0xd482('0x2c')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1017ed['uniqueid'],_0x1017ed['transfereecalleridnum'],_0x1017ed['extension']);logger[_0xd482('0x37')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1017ed[_0xd482('0x39')],util[_0xd482('0x30')](_0x1017ed,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x1017ed[_0xd482('0x9d')]]){this[_0xd482('0x1a')][_0x1017ed[_0xd482('0x9d')]]['transfercalleridnum']=_0x1017ed[_0xd482('0xa6')];this['channels'][_0x1017ed[_0xd482('0x9d')]][_0xd482('0xa0')]=_0x1017ed['extension'];this[_0xd482('0x22')]({'event':'BlindTransfer','uniqueid':_0x1017ed['transfereeuniqueid'],'context':_0x1017ed[_0xd482('0x41')],'channel':_0x1017ed['transfererchannel']});}}}catch(_0x224b3e){logger['error'](_0xd482('0xa7'),_0x1017ed[_0xd482('0x39')],util[_0xd482('0x30')](_0x224b3e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x29')]=function(_0x44ed3){try{if(this[_0xd482('0x31')](_0x44ed3)){logger['debug'](_0xd482('0xa8'),_0x44ed3[_0xd482('0x39')],util[_0xd482('0x30')](_0x44ed3,{'showHidden':![],'depth':null}));if(this['channels'][_0x44ed3[_0xd482('0x39')]]){if(!_[_0xd482('0xa9')](this[_0xd482('0x1a')][_0x44ed3[_0xd482('0x39')]][_0xd482('0xaa')])){this['channels'][_0x44ed3[_0xd482('0x39')]][_0xd482('0xab')]=moment()[_0xd482('0x43')](_0xd482('0x44'));logger[_0xd482('0x2c')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x44ed3[_0xd482('0x39')],this[_0xd482('0x1a')][_0x44ed3[_0xd482('0x39')]][_0xd482('0xab')]);}}}}catch(_0x3d5d60){logger[_0xd482('0x2e')]('[%s][voiceCallReport][musiconholdstart]',_0x44ed3[_0xd482('0x39')],util[_0xd482('0x30')](_0x3d5d60,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x2b')]=function(_0x166fe7){try{if(this[_0xd482('0x31')](_0x166fe7)){logger['debug'](_0xd482('0xac'),_0x166fe7[_0xd482('0x39')],util[_0xd482('0x30')](_0x166fe7,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x166fe7[_0xd482('0x39')]]){if(!_[_0xd482('0xa9')](this[_0xd482('0x1a')][_0x166fe7[_0xd482('0x39')]]['mohstarttime'])){this['channels'][_0x166fe7[_0xd482('0x39')]]['mohtime']+=moment()[_0xd482('0xad')](0x0)[_0xd482('0x64')](this[_0xd482('0x1a')][_0x166fe7[_0xd482('0x39')]][_0xd482('0xab')],_0xd482('0x58'));logger[_0xd482('0x2c')](_0xd482('0xae'),_0x166fe7[_0xd482('0x39')],this['channels'][_0x166fe7[_0xd482('0x39')]][_0xd482('0xaf')]);delete this[_0xd482('0x1a')][_0x166fe7['uniqueid']][_0xd482('0xab')];}}}}catch(_0x4c7516){logger[_0xd482('0x2e')]('[%s][voiceCallReport][musiconholdstop]',_0x166fe7[_0xd482('0x39')],util[_0xd482('0x30')](_0x4c7516,{'showHidden':![],'depth':null}));}};module[_0xd482('0xb0')]=VoiceCallReport; \ No newline at end of file +var _0xfb30=['billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','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','moment','util','ioredis','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isUndefined','emit','isNotNull','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','disposition','toNumber','channelstate','from-sip','channel','split','destconnectedlinenum','user:%s','name','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','lastdata','set','startsWith','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcalluniqueid','mixmonitor_filename','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfb30,0x195));var _0x0fb3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfb30[_0x21a9d9];return _0x46adce;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x0fb3('0x0'));var util=require(_0x0fb3('0x1'));var path=require('path');var Redis=require(_0x0fb3('0x2'));var config=require('../../../config/environment');var logger=require(_0x0fb3('0x3'))(_0x0fb3('0x4'));var ami=require(_0x0fb3('0x5'));var Channel=require(_0x0fb3('0x6'));var statusDesc=[_0x0fb3('0x7'),_0x0fb3('0x8'),_0x0fb3('0x9'),_0x0fb3('0xa'),_0x0fb3('0xb'),_0x0fb3('0xc'),_0x0fb3('0xd'),_0x0fb3('0xe'),'onhold'];var applications=['set','queue','agi',_0x0fb3('0xf'),_0x0fb3('0x10'),_0x0fb3('0x11')];var dispositions=[_0x0fb3('0x12'),'FAILED',_0x0fb3('0x13'),'NO\x20ANSWER',_0x0fb3('0x12'),_0x0fb3('0x12'),_0x0fb3('0x14'),_0x0fb3('0x15'),_0x0fb3('0x13'),'FAILED','FAILED'];var actions={};config[_0x0fb3('0x16')]=_[_0x0fb3('0x17')](config[_0x0fb3('0x16')],{'host':'localhost','port':0x18eb});var io=require(_0x0fb3('0x18'))(new Redis(config[_0x0fb3('0x16')]));function VoiceCallReport(_0x58461f){this[_0x0fb3('0x19')]=_0x58461f[_0x0fb3('0x19')];this[_0x0fb3('0x1a')]=_0x58461f[_0x0fb3('0x1a')];this[_0x0fb3('0x1b')]={};ami['on']('coreshowchannel',this[_0x0fb3('0x1c')][_0x0fb3('0x1d')](this));ami['on'](_0x0fb3('0x1e'),this[_0x0fb3('0x1c')]['bind'](this));ami['on'](_0x0fb3('0x1f'),this[_0x0fb3('0x20')][_0x0fb3('0x1d')](this));ami['on'](_0x0fb3('0x21'),this[_0x0fb3('0x22')][_0x0fb3('0x1d')](this));ami['on'](_0x0fb3('0x23'),this[_0x0fb3('0x24')][_0x0fb3('0x1d')](this));ami['on'](_0x0fb3('0x25'),this[_0x0fb3('0x26')][_0x0fb3('0x1d')](this));ami['on'](_0x0fb3('0x27'),this[_0x0fb3('0x28')]['bind'](this));ami['on'](_0x0fb3('0x29'),this[_0x0fb3('0x2a')][_0x0fb3('0x1d')](this));ami['on'](_0x0fb3('0x2b'),this[_0x0fb3('0x2c')][_0x0fb3('0x1d')](this));ami['on'](_0x0fb3('0x2d'),this[_0x0fb3('0x2e')][_0x0fb3('0x1d')](this));ami['on']('musiconholdstop',this[_0x0fb3('0x2f')][_0x0fb3('0x1d')](this));try{logger[_0x0fb3('0x30')](_0x0fb3('0x31'));ami[_0x0fb3('0x32')]();}catch(_0x58aebf){logger[_0x0fb3('0x33')]('[voiceCallReport][coreshowchannels]',util[_0x0fb3('0x34')](_0x58aebf,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0fb3('0x35')]['isNotNull']=function(_0x53d8cd){return _0x53d8cd!==null&&!_[_0x0fb3('0x36')](_0x53d8cd);};VoiceCallReport['prototype'][_0x0fb3('0x37')]=function(_0x89b53,_0x545341,_0x11f94e){io['to'](_0x89b53)[_0x0fb3('0x37')](_0x545341,_0x11f94e);};VoiceCallReport[_0x0fb3('0x35')][_0x0fb3('0x28')]=function(_0x3fc3d2){try{if(this[_0x0fb3('0x38')](_0x3fc3d2)){logger[_0x0fb3('0x30')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3fc3d2[_0x0fb3('0x39')],_0x3fc3d2[_0x0fb3('0x3a')],_0x3fc3d2[_0x0fb3('0x3b')]);logger[_0x0fb3('0x3c')](_0x0fb3('0x3d'),_0x3fc3d2[_0x0fb3('0x39')],util['inspect'](_0x3fc3d2,{'showHidden':![],'depth':null}));if(_0x3fc3d2[_0x0fb3('0x39')]===_0x3fc3d2[_0x0fb3('0x3e')]){if(!_[_0x0fb3('0x36')](this[_0x0fb3('0x19')][_0x3fc3d2[_0x0fb3('0x39')]])){_[_0x0fb3('0x3f')](this['channels'][_0x3fc3d2[_0x0fb3('0x39')]],_[_0x0fb3('0x40')](_0x3fc3d2,_[_0x0fb3('0x41')](this[_0x0fb3('0x19')][_0x3fc3d2['uniqueid']])));}}}}catch(_0x4a0cc8){logger[_0x0fb3('0x33')](_0x0fb3('0x42'),_0x3fc3d2[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x4a0cc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fb3('0x35')][_0x0fb3('0x20')]=function(_0x1af3dd){try{if(this['isNotNull'](_0x1af3dd)){logger[_0x0fb3('0x3c')](_0x0fb3('0x43'),_0x1af3dd[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x1af3dd,{'showHidden':![],'depth':null}));if(_0x1af3dd['uniqueid']===_0x1af3dd[_0x0fb3('0x3e')]&&_0x1af3dd['channel']!='OutgoingSpoolFailed'){if(_[_0x0fb3('0x36')](this[_0x0fb3('0x19')][_0x1af3dd[_0x0fb3('0x39')]])){logger[_0x0fb3('0x30')](_0x0fb3('0x44'),_0x1af3dd[_0x0fb3('0x39')],_0x1af3dd[_0x0fb3('0x45')],_0x1af3dd[_0x0fb3('0x46')]);this[_0x0fb3('0x19')][_0x1af3dd[_0x0fb3('0x39')]]=new Channel();this['channels'][_0x1af3dd[_0x0fb3('0x39')]][_0x0fb3('0x47')]=moment()[_0x0fb3('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0fb3('0x19')][_0x1af3dd['uniqueid']][_0x0fb3('0x49')]=dispositions[_[_0x0fb3('0x4a')](_0x1af3dd[_0x0fb3('0x4b')])];_[_0x0fb3('0x3f')](this[_0x0fb3('0x19')][_0x1af3dd['uniqueid']],_[_0x0fb3('0x40')](_0x1af3dd,_[_0x0fb3('0x41')](this['channels'][_0x1af3dd[_0x0fb3('0x39')]])));if(_0x1af3dd[_0x0fb3('0x45')]===_0x0fb3('0x4c')){if(this[_0x0fb3('0x1a')][_0x1af3dd[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]]){this[_0x0fb3('0x1a')][_0x1af3dd['channel'][_0x0fb3('0x4e')]('-')[0x0]][_0x0fb3('0x4f')]=_0x1af3dd[_0x0fb3('0x46')];logger[_0x0fb3('0x3c')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x1af3dd['uniqueid'],util[_0x0fb3('0x34')]({'destaccountcode':this['agents'][_0x1af3dd['channel'][_0x0fb3('0x4e')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1af3dd[_0x0fb3('0x46')]},{'showHidden':![],'depth':null}));this[_0x0fb3('0x37')](util['format'](_0x0fb3('0x50'),this[_0x0fb3('0x1a')][_0x1af3dd[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]][_0x0fb3('0x51')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x1af3dd[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]][_0x0fb3('0x52')],'destconnectedlinenum':_0x1af3dd[_0x0fb3('0x46')]});}}}}}}catch(_0x412914){logger['error'](_0x0fb3('0x53'),_0x1af3dd[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x412914,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0fb3('0x1c')]=function(_0x366c8e){try{if(this[_0x0fb3('0x38')](_0x366c8e)){logger[_0x0fb3('0x3c')](_0x0fb3('0x54'),_0x366c8e[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x366c8e,{'showHidden':![],'depth':null}));if(_0x366c8e['uniqueid']===_0x366c8e[_0x0fb3('0x3e')]&&_0x366c8e[_0x0fb3('0x46')]!='h'&&_0x366c8e[_0x0fb3('0x4d')]!=_0x0fb3('0x55')){_0x366c8e[_0x0fb3('0x56')]=_0x366c8e[_0x0fb3('0x56')][_0x0fb3('0x57')]();_0x366c8e[_0x0fb3('0x58')]=(_0x366c8e[_0x0fb3('0x59')]||_0x366c8e[_0x0fb3('0x58')])[_0x0fb3('0x57')]();logger[_0x0fb3('0x30')](_0x0fb3('0x5a'),_0x366c8e[_0x0fb3('0x39')],_0x366c8e[_0x0fb3('0x56')],_0x366c8e['applicationdata']);if(_[_0x0fb3('0x36')](this[_0x0fb3('0x19')][_0x366c8e[_0x0fb3('0x39')]])){this[_0x0fb3('0x19')][_0x366c8e[_0x0fb3('0x39')]]=new Channel();this[_0x0fb3('0x19')][_0x366c8e[_0x0fb3('0x39')]][_0x0fb3('0x47')]=_0x366c8e[_0x0fb3('0x5b')]?moment()[_0x0fb3('0x5c')](moment['duration'](_0x366c8e[_0x0fb3('0x5b')])[_0x0fb3('0x5d')](),_0x0fb3('0x5d'))[_0x0fb3('0x48')](_0x0fb3('0x5e')):moment()[_0x0fb3('0x48')](_0x0fb3('0x5e'));this[_0x0fb3('0x19')][_0x366c8e[_0x0fb3('0x39')]]['disposition']='NO\x20ANSWER';}_[_0x0fb3('0x3f')](this['channels'][_0x366c8e['uniqueid']],_[_0x0fb3('0x40')](_0x366c8e,_[_0x0fb3('0x41')](this['channels'][_0x366c8e[_0x0fb3('0x39')]])));if(_['includes'](applications,_0x366c8e[_0x0fb3('0x56')])){this[_0x0fb3('0x19')][_0x366c8e[_0x0fb3('0x39')]]['lastapplication']=_0x366c8e[_0x0fb3('0x56')];this[_0x0fb3('0x19')][_0x366c8e[_0x0fb3('0x39')]][_0x0fb3('0x5f')]=_0x366c8e[_0x0fb3('0x58')];if(_0x366c8e['application']===_0x0fb3('0x60')&&_[_0x0fb3('0x61')](_0x366c8e[_0x0fb3('0x58')],'cdr(')){var _0x39689e=_0x366c8e[_0x0fb3('0x58')][_0x0fb3('0x4e')]('=');var _0x422a1c=_0x39689e[0x0]['match'](/cdr\((.*)\)/);if(_0x422a1c){this[_0x0fb3('0x19')][_0x366c8e[_0x0fb3('0x39')]][_0x422a1c[0x1]]=_0x39689e[0x1];}}else if(_0x366c8e[_0x0fb3('0x56')]===_0x0fb3('0x62')){this[_0x0fb3('0x19')][_0x366c8e['uniqueid']][_0x0fb3('0x62')]=_0x366c8e[_0x0fb3('0x58')][_0x0fb3('0x4e')](',')[0x0];}}}}}catch(_0x1006e9){logger[_0x0fb3('0x33')](_0x0fb3('0x63'),_0x366c8e['uniqueid'],util[_0x0fb3('0x34')](_0x1006e9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0fb3('0x22')]=function(_0x12862f){try{if(this[_0x0fb3('0x38')](_0x12862f)){logger[_0x0fb3('0x30')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x12862f['uniqueid'],_0x12862f[_0x0fb3('0x3e')],_0x12862f[_0x0fb3('0x3a')],_0x12862f['calleridnum']);logger['debug'](_0x0fb3('0x64'),_0x12862f['uniqueid'],util[_0x0fb3('0x34')](_0x12862f,{'showHidden':![],'depth':null}));if(_0x12862f[_0x0fb3('0x39')]!==_0x12862f[_0x0fb3('0x3e')]){if(this['channels'][_0x12862f[_0x0fb3('0x3e')]]){if(_0x12862f[_0x0fb3('0x4b')]==='6'){if(!this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x65')]){var _0x2a2f0b=moment();this['channels'][_0x12862f[_0x0fb3('0x3e')]]['answered']=!![];this['channels'][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x66')]=_0x2a2f0b[_0x0fb3('0x48')](_0x0fb3('0x5e'));if(this['channels'][_0x12862f[_0x0fb3('0x3e')]]['starttime']){this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x67')]=_0x2a2f0b[_0x0fb3('0x68')](this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x47')],_0x0fb3('0x5d'));}}this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x3e')]=_0x12862f[_0x0fb3('0x39')];if(_0x12862f[_0x0fb3('0x3b')]!==_0x0fb3('0x69')){this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x6a')]=_0x12862f[_0x0fb3('0x3b')];}this['channels'][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x6b')]=_0x12862f[_0x0fb3('0x3a')];this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x6c')]=_0x12862f[_0x0fb3('0x4d')];this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x49')]=dispositions[_[_0x0fb3('0x4a')](_0x12862f[_0x0fb3('0x4b')])];if(this['agents'][_0x12862f[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]]){this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x6d')]=this[_0x0fb3('0x1a')][_0x12862f['channel']['split']('-')[0x0]]['id'];this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x3e')]][_0x0fb3('0x6e')]=this[_0x0fb3('0x1a')][_0x12862f[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]]['name'];}}}}else{if(this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x39')]]){if(_0x12862f[_0x0fb3('0x4b')]==='6'){if(this[_0x0fb3('0x1a')][_0x12862f[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]]){this[_0x0fb3('0x19')][_0x12862f[_0x0fb3('0x39')]][_0x0fb3('0x6d')]=this[_0x0fb3('0x1a')][_0x12862f[_0x0fb3('0x4d')]['split']('-')[0x0]]['id'];this['channels'][_0x12862f['uniqueid']]['membername']=this['agents'][_0x12862f[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]][_0x0fb3('0x51')];}}}}}}catch(_0x598b20){logger['error'](_0x0fb3('0x6f'),_0x12862f[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x598b20,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fb3('0x35')][_0x0fb3('0x70')]=function(_0xd1917c,_0x421b2b){try{if(this[_0x0fb3('0x19')][_0xd1917c]){logger['info'](_0x0fb3('0x71'),_0xd1917c,_0x421b2b);this[_0x0fb3('0x19')][_0xd1917c]['monitor']=!![];if(_[_0x0fb3('0x72')](_0x421b2b,_0x0fb3('0x73'))){_0x421b2b=_0x421b2b[_0x0fb3('0x74')]('.wav49',_0x0fb3('0x75'));}this['channels'][_0xd1917c]['monitorFilename']=_0x421b2b;var _0x4c7eb0=_[_0x0fb3('0x76')](this['channels'][_0xd1917c][_0x0fb3('0x77')],{'filename':_0x421b2b});if(_[_0x0fb3('0x78')](_0x4c7eb0)){this[_0x0fb3('0x19')][_0xd1917c][_0x0fb3('0x77')][_0x0fb3('0x79')]({'filename':_0x421b2b,'createdAt':moment()[_0x0fb3('0x48')](_0x0fb3('0x5e')),'mixmonitorid':'','status':_0x0fb3('0x7a')});}}}catch(_0x474465){logger[_0x0fb3('0x33')](_0x0fb3('0x7b'),_0xd1917c,util[_0x0fb3('0x34')](_0x474465,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fb3('0x35')][_0x0fb3('0x24')]=function(_0x411428){try{if(this[_0x0fb3('0x38')](_0x411428)){logger['debug'](_0x0fb3('0x7c'),_0x411428[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x411428,{'showHidden':![],'depth':null}));if(this['channels'][_0x411428[_0x0fb3('0x39')]]&&_0x411428[_0x0fb3('0x4d')]!=_0x0fb3('0x55')){if(this['isNotNull'](_0x411428[_0x0fb3('0x7d')])){if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')]['mixmonitor_filename'])){logger[_0x0fb3('0x30')](_0x0fb3('0x7e'),_0x411428[_0x0fb3('0x39')],_0x411428[_0x0fb3('0x7f')]);this[_0x0fb3('0x70')](_0x411428['uniqueid'],_0x411428['value']);}else if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')][_0x0fb3('0x80')])){logger[_0x0fb3('0x30')](_0x0fb3('0x81'),_0x411428[_0x0fb3('0x39')],_0x411428[_0x0fb3('0x7f')]);this[_0x0fb3('0x19')][_0x411428['uniqueid']][_0x0fb3('0x3b')]=_0x411428[_0x0fb3('0x7f')];}else if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')][_0x0fb3('0x82')])){logger[_0x0fb3('0x30')](_0x0fb3('0x83'),_0x411428['uniqueid'],_0x411428[_0x0fb3('0x7f')]);this[_0x0fb3('0x19')][_0x411428[_0x0fb3('0x39')]][_0x0fb3('0x84')]=_0x411428['value'];}else if(this['isNotNull'](_0x411428[_0x0fb3('0x7d')]['xmd-cdrtype'])){logger[_0x0fb3('0x30')](_0x0fb3('0x85'),_0x411428[_0x0fb3('0x39')],_0x411428['value']);this[_0x0fb3('0x19')][_0x411428[_0x0fb3('0x39')]][_0x0fb3('0x86')]=_0x411428['value'];}else if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x411428[_0x0fb3('0x39')],_0x411428[_0x0fb3('0x7f')][_0x0fb3('0x4e')](',')[0x0]);this[_0x0fb3('0x19')][_0x411428[_0x0fb3('0x39')]][_0x0fb3('0x62')]=_0x411428[_0x0fb3('0x7f')][_0x0fb3('0x4e')](',')[0x0];}else if(this['isNotNull'](_0x411428[_0x0fb3('0x7d')][_0x0fb3('0x87')])){logger['info'](_0x0fb3('0x88'),_0x411428[_0x0fb3('0x39')],_0x411428[_0x0fb3('0x7f')]);this[_0x0fb3('0x19')][_0x411428[_0x0fb3('0x39')]]['originatecalleridnum']=_0x411428[_0x0fb3('0x7f')];}else if(this['isNotNull'](_0x411428[_0x0fb3('0x7d')][_0x0fb3('0x89')])){logger[_0x0fb3('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x411428['uniqueid'],_0x411428['value']);this[_0x0fb3('0x19')][_0x411428[_0x0fb3('0x39')]][_0x0fb3('0x8a')]=_0x411428[_0x0fb3('0x7f')];}else if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')]['xmd-callerid-preview'])){logger[_0x0fb3('0x30')](_0x0fb3('0x8b'),_0x411428[_0x0fb3('0x39')],_0x411428[_0x0fb3('0x7f')]);this['channels'][_0x411428[_0x0fb3('0x39')]]['calleridpreview']=_0x411428[_0x0fb3('0x7f')];}else if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')][_0x0fb3('0x8c')])){logger[_0x0fb3('0x30')](_0x0fb3('0x8d'),_0x411428['uniqueid'],_0x411428[_0x0fb3('0x7f')]);this[_0x0fb3('0x19')][_0x411428[_0x0fb3('0x39')]][_0x0fb3('0x62')]=_0x411428[_0x0fb3('0x7f')];}else if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')]['sipcallid'])){logger[_0x0fb3('0x30')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x411428[_0x0fb3('0x39')],_0x411428[_0x0fb3('0x7f')]);this['channels'][_0x411428[_0x0fb3('0x39')]][_0x0fb3('0x8e')]=_0x411428['value'];}}}else if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')][_0x0fb3('0x8f')])){if(_0x411428[_0x0fb3('0x7f')]){var _0xf58376=path['parse'](_0x411428[_0x0fb3('0x7f')])['name'];logger[_0x0fb3('0x30')](_0x0fb3('0x7e'),_0xf58376,_0x411428[_0x0fb3('0x7f')]);this[_0x0fb3('0x70')](_0xf58376,_0x411428[_0x0fb3('0x7f')]);}}else if(this['channels'][_0x411428['linkedid']]){if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')])){if(this[_0x0fb3('0x38')](_0x411428[_0x0fb3('0x7d')][_0x0fb3('0x90')])){logger[_0x0fb3('0x30')](_0x0fb3('0x91'),_0x411428[_0x0fb3('0x3e')],_0x411428['value']);this['channels'][_0x411428[_0x0fb3('0x3e')]][_0x0fb3('0x92')]=_0x411428[_0x0fb3('0x7f')];}}}}}catch(_0x5e2a70){logger[_0x0fb3('0x33')](_0x0fb3('0x93'),_0x411428[_0x0fb3('0x39')],util['inspect'](_0x5e2a70,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fb3('0x35')]['syncHangup']=function(_0x36c8f3){try{if(this[_0x0fb3('0x38')](_0x36c8f3)){logger['debug'](_0x0fb3('0x94'),_0x36c8f3[_0x0fb3('0x39')],util['inspect'](_0x36c8f3,{'showHidden':![],'depth':null}));if(this[_0x0fb3('0x19')][_0x36c8f3['uniqueid']]){logger['info'](_0x0fb3('0x95'),_0x36c8f3['uniqueid'],_0x36c8f3['cause-txt']);var _0x5d61cf=moment();this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]]['endtime']=_0x5d61cf['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x5b')]=_0x5d61cf[_0x0fb3('0x68')](this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x47')],'seconds');if(this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]]['answered']){this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x96')]=_0x5d61cf[_0x0fb3('0x68')](this['channels'][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x66')],_0x0fb3('0x5d'));this[_0x0fb3('0x19')][_0x36c8f3['uniqueid']][_0x0fb3('0x67')]=this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x5b')]-this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x96')];}if(_0x36c8f3[_0x0fb3('0x45')]===_0x0fb3('0x4c')){if(this[_0x0fb3('0x1a')][_0x36c8f3['channel'][_0x0fb3('0x4e')]('-')[0x0]]){this['agents'][_0x36c8f3['channel'][_0x0fb3('0x4e')]('-')[0x0]]=_[_0x0fb3('0x97')](this['agents'][_0x36c8f3[_0x0fb3('0x4d')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x0fb3('0x3c')](_0x0fb3('0x98'),_0x36c8f3[_0x0fb3('0x39')],util[_0x0fb3('0x34')]({'destaccountcode':this[_0x0fb3('0x1a')][_0x36c8f3[_0x0fb3('0x4d')][_0x0fb3('0x4e')]('-')[0x0]][_0x0fb3('0x52')]},{'showHidden':![],'depth':null}));this[_0x0fb3('0x37')](util[_0x0fb3('0x48')]('user:%s',this[_0x0fb3('0x1a')][_0x36c8f3['channel'][_0x0fb3('0x4e')]('-')[0x0]][_0x0fb3('0x51')]),_0x0fb3('0x99'),{'destaccountcode':this[_0x0fb3('0x1a')][_0x36c8f3['channel'][_0x0fb3('0x4e')]('-')[0x0]]['accountcode']});}}if(_0x36c8f3[_0x0fb3('0x9a')]===_0x0fb3('0x9b')){this[_0x0fb3('0x1b')][_0x36c8f3[_0x0fb3('0x39')]]=this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]];}else{if(this['channels'][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x86')]===_0x0fb3('0x9c')&&this['blindTransfers'][_0x36c8f3[_0x0fb3('0x39')]]){this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x39')]=[this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]]['linkedid'],this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x3e')]=this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]][_0x0fb3('0x39')]][0x0];delete this[_0x0fb3('0x1b')][_0x36c8f3['uniqueid']];}}logger[_0x0fb3('0x3c')](_0x0fb3('0x9d'),_0x36c8f3['uniqueid'],util[_0x0fb3('0x34')](this['channels'][_0x36c8f3[_0x0fb3('0x39')]],{'showHidden':![],'depth':null}));ami[_0x0fb3('0x37')](_0x0fb3('0x9e'),this['channels'][_0x36c8f3[_0x0fb3('0x39')]]);delete this[_0x0fb3('0x19')][_0x36c8f3[_0x0fb3('0x39')]];}}}catch(_0x495468){logger['error']('[%s][voiceCallReport][hangup]',_0x36c8f3['uniqueid'],util[_0x0fb3('0x34')](_0x495468,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0fb3('0x2a')]=function(_0x4f6378){try{if(this[_0x0fb3('0x38')](_0x4f6378)){logger[_0x0fb3('0x30')](_0x0fb3('0x9f'),_0x4f6378[_0x0fb3('0x39')],_0x4f6378[_0x0fb3('0xa0')],_0x4f6378[_0x0fb3('0xa1')]);logger['debug'](_0x0fb3('0xa2'),_0x4f6378[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x4f6378,{'showHidden':![],'depth':null}));if(this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa3')]]){this[_0x0fb3('0x19')][_0x4f6378['transfereeuniqueid']][_0x0fb3('0xa4')]=_0x4f6378['origtransferercalleridnum'];this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa3')]][_0x0fb3('0xa5')]=_0x4f6378[_0x0fb3('0xa1')];if(this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa6')]]){var _0x442df7=this[_0x0fb3('0x19')][_0x4f6378['secondtransfereruniqueid']];this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa6')]]=this['channels'][_0x4f6378[_0x0fb3('0xa3')]];this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa3')]]=_0x442df7;}}else if(this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa7')]]){this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa7')]]['transfercalleridnum']=_0x4f6378[_0x0fb3('0xa0')];this['channels'][_0x4f6378[_0x0fb3('0xa7')]][_0x0fb3('0xa5')]=_0x4f6378[_0x0fb3('0xa1')];if(this[_0x0fb3('0x19')][_0x4f6378['origtransfereruniqueid']]){var _0x442df7=this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa8')]];this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa8')]]=this['channels'][_0x4f6378[_0x0fb3('0xa7')]];this[_0x0fb3('0x19')][_0x4f6378[_0x0fb3('0xa7')]]=_0x442df7;}}}}catch(_0x440e6a){logger[_0x0fb3('0x33')](_0x0fb3('0xa9'),_0x4f6378[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x440e6a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fb3('0x35')][_0x0fb3('0x2c')]=function(_0x4481f2){try{if(this[_0x0fb3('0x38')](_0x4481f2)){logger[_0x0fb3('0x30')](_0x0fb3('0xaa'),_0x4481f2[_0x0fb3('0x39')],_0x4481f2['transfereecalleridnum'],_0x4481f2[_0x0fb3('0xab')]);logger['debug'](_0x0fb3('0xac'),_0x4481f2[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x4481f2,{'showHidden':![],'depth':null}));if(this[_0x0fb3('0x19')][_0x4481f2[_0x0fb3('0xa3')]]){this[_0x0fb3('0x19')][_0x4481f2[_0x0fb3('0xa3')]][_0x0fb3('0xa4')]=_0x4481f2[_0x0fb3('0xad')];this[_0x0fb3('0x19')][_0x4481f2[_0x0fb3('0xa3')]][_0x0fb3('0xa5')]=_0x4481f2[_0x0fb3('0xab')];this['syncHangup']({'event':_0x0fb3('0x9b'),'uniqueid':_0x4481f2[_0x0fb3('0xa3')],'context':_0x4481f2[_0x0fb3('0x45')],'channel':_0x4481f2[_0x0fb3('0xae')]});}}}catch(_0x7c54a1){logger['error']('[%s][voiceCallReport][blindtransfer]',_0x4481f2['uniqueid'],util[_0x0fb3('0x34')](_0x7c54a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fb3('0x35')][_0x0fb3('0x2e')]=function(_0xff7fae){try{if(this['isNotNull'](_0xff7fae)){logger[_0x0fb3('0x3c')](_0x0fb3('0xaf'),_0xff7fae[_0x0fb3('0x39')],util['inspect'](_0xff7fae,{'showHidden':![],'depth':null}));if(this['channels'][_0xff7fae[_0x0fb3('0x39')]]){if(!_[_0x0fb3('0x78')](this[_0x0fb3('0x19')][_0xff7fae[_0x0fb3('0x39')]][_0x0fb3('0x66')])){this[_0x0fb3('0x19')][_0xff7fae[_0x0fb3('0x39')]][_0x0fb3('0xb0')]=moment()[_0x0fb3('0x48')](_0x0fb3('0x5e'));logger['info'](_0x0fb3('0xb1'),_0xff7fae[_0x0fb3('0x39')],this[_0x0fb3('0x19')][_0xff7fae[_0x0fb3('0x39')]][_0x0fb3('0xb0')]);}}}}catch(_0x5df5b1){logger[_0x0fb3('0x33')](_0x0fb3('0xb2'),_0xff7fae[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x5df5b1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fb3('0x35')][_0x0fb3('0x2f')]=function(_0x335356){try{if(this['isNotNull'](_0x335356)){logger[_0x0fb3('0x3c')](_0x0fb3('0xb3'),_0x335356[_0x0fb3('0x39')],util[_0x0fb3('0x34')](_0x335356,{'showHidden':![],'depth':null}));if(this['channels'][_0x335356[_0x0fb3('0x39')]]){if(!_[_0x0fb3('0x78')](this[_0x0fb3('0x19')][_0x335356[_0x0fb3('0x39')]][_0x0fb3('0xb0')])){this[_0x0fb3('0x19')][_0x335356[_0x0fb3('0x39')]][_0x0fb3('0xb4')]+=moment()[_0x0fb3('0xb5')](0x0)[_0x0fb3('0x68')](this[_0x0fb3('0x19')][_0x335356[_0x0fb3('0x39')]][_0x0fb3('0xb0')],_0x0fb3('0x5d'));logger[_0x0fb3('0x30')](_0x0fb3('0xb6'),_0x335356['uniqueid'],this[_0x0fb3('0x19')][_0x335356['uniqueid']][_0x0fb3('0xb4')]);delete this[_0x0fb3('0x19')][_0x335356[_0x0fb3('0x39')]][_0x0fb3('0xb0')];}}}}catch(_0x2daf4f){logger['error'](_0x0fb3('0xb7'),_0x335356['uniqueid'],util['inspect'](_0x2daf4f,{'showHidden':![],'depth':null}));}};module[_0x0fb3('0xb8')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index dac0ce4..257b52d 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 _0x07e7=['variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','includes','isUndefined','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','outbound','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','debug','uniqueid','merge','format','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','voice:outbound','[%s][voiceDialReport][varset]\x20event:','addVariable','keys'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x07e7,0x1e2));var _0x707e=function(_0x2b1a2b,_0x31cdda){_0x2b1a2b=_0x2b1a2b-0x0;var _0x31422a=_0x07e7[_0x2b1a2b];return _0x31422a;};'use strict';var _=require(_0x707e('0x0'));var moment=require(_0x707e('0x1'));var util=require(_0x707e('0x2'));var Redis=require(_0x707e('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x707e('0x4'));var ami=require(_0x707e('0x5'));config['redis']=_['defaults'](config[_0x707e('0x6')],{'host':_0x707e('0x7'),'port':0x18eb});var io=require(_0x707e('0x8'))(new Redis(config[_0x707e('0x6')]));function VoiceDialReport(_0x1ef2da){this[_0x707e('0x9')]=_0x1ef2da[_0x707e('0xa')];this['outbound']=_0x1ef2da['outbound'];this['variables']={};ami['on'](_0x707e('0xb'),this[_0x707e('0xc')][_0x707e('0xd')](this));ami['on'](_0x707e('0xe'),this['syncDialEnd']['bind'](this));ami['on'](_0x707e('0xf'),this[_0x707e('0x10')][_0x707e('0xd')](this));ami['on'](_0x707e('0x11'),this[_0x707e('0x12')][_0x707e('0xd')](this));}VoiceDialReport[_0x707e('0x13')][_0x707e('0x14')]=function(_0x33688c){return _0x33688c!==null&&!_['isUndefined'](_0x33688c);};VoiceDialReport[_0x707e('0x13')][_0x707e('0x15')]=function(_0xa15bc4,_0xd86f74,_0x4f09b5){io['to'](_0xa15bc4)[_0x707e('0x15')](_0xd86f74,_0x4f09b5);};VoiceDialReport[_0x707e('0x13')][_0x707e('0xc')]=function(_0x15cc02){try{if(this[_0x707e('0x14')](_0x15cc02)){logger[_0x707e('0x16')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x15cc02[_0x707e('0x17')],util['inspect'](_0x15cc02,{'showHidden':![],'depth':null}));if(this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]]){_[_0x707e('0x18')](this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]],{'starttime':moment()[_0x707e('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x15cc02[_0x707e('0x1a')][_0x707e('0x1b')](0x0,_0x15cc02[_0x707e('0x1a')][_0x707e('0x1c')]('-')),'membername':_0x15cc02[_0x707e('0x1a')]['substring'](_0x15cc02[_0x707e('0x1a')]['lastIndexOf']('/')+0x1,_0x15cc02[_0x707e('0x1a')][_0x707e('0x1c')]('-'))},_[_0x707e('0x1d')](_0x15cc02,[_0x707e('0x1e'),'privilege']));logger[_0x707e('0x1f')](_0x707e('0x20'),_0x15cc02['uniqueid'],this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]][_0x707e('0x21')],this[_0x707e('0x9')][_0x15cc02['uniqueid']][_0x707e('0x22')]);logger[_0x707e('0x16')](_0x707e('0x23'),_0x15cc02[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x15cc02['uniqueid']],{'showHidden':![],'depth':null}));this[_0x707e('0x15')]('voice:outbound','voice_outbound_channel:save',this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]]);logger[_0x707e('0x16')](_0x707e('0x25'),_0x15cc02[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]],{'showHidden':![],'depth':null}));ami['emit'](_0x707e('0x26'),this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]]);}}}catch(_0x3282bf){logger[_0x707e('0x27')](_0x707e('0x28'),_0x15cc02[_0x707e('0x17')],util[_0x707e('0x24')](_0x3282bf,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x707e('0x13')][_0x707e('0x29')]=function(_0x391eb6){try{if(this[_0x707e('0x14')](_0x391eb6)){logger[_0x707e('0x16')](_0x707e('0x2a'),_0x391eb6[_0x707e('0x17')],util[_0x707e('0x24')](_0x391eb6,{'showHidden':![],'depth':null}));if(this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]]){this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]][_0x707e('0x2b')]=_0x391eb6[_0x707e('0x2b')];if(_0x391eb6[_0x707e('0x2b')]===_0x707e('0x2c')){this['channels'][_0x391eb6[_0x707e('0x17')]][_0x707e('0x2d')]=_0x391eb6[_0x707e('0x2d')];this[_0x707e('0x9')][_0x391eb6['uniqueid']][_0x707e('0x2e')]=_0x391eb6[_0x707e('0x2e')];this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]][_0x707e('0x2f')]=moment()['format'](_0x707e('0x30'));this['channels'][_0x391eb6['uniqueid']][_0x707e('0x31')]=_0x707e('0x32');logger['info'](_0x707e('0x33'),_0x391eb6[_0x707e('0x17')],_0x391eb6[_0x707e('0x1a')]['substring'](_0x391eb6[_0x707e('0x1a')][_0x707e('0x1c')]('/')+0x1,_0x391eb6['channel'][_0x707e('0x1c')]('-')));logger[_0x707e('0x16')](_0x707e('0x34'),_0x391eb6[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x391eb6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x707e('0x15')](_0x707e('0x35'),this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]]);}logger[_0x707e('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x391eb6[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]],{'showHidden':![],'depth':null}));this[_0x707e('0x15')](_0x707e('0x36'),'voice_outbound_channel:save',this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]]);}}}catch(_0x142566){logger[_0x707e('0x27')]('[%s][voiceDialReport][dialend]',_0x391eb6['uniqueid'],util[_0x707e('0x24')](_0x142566,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x4d397d){try{if(this[_0x707e('0x14')](_0x4d397d)){logger[_0x707e('0x16')](_0x707e('0x37'),_0x4d397d[_0x707e('0x17')],util[_0x707e('0x24')](_0x4d397d,{'showHidden':![],'depth':null}));this[_0x707e('0x38')](_0x4d397d[_0x707e('0x17')],_[_0x707e('0x39')](_0x4d397d[_0x707e('0x3a')])[0x0],_0x4d397d[_0x707e('0x3b')]);if(this[_0x707e('0x14')](_0x4d397d[_0x707e('0x3a')])&&this[_0x707e('0x14')](_0x4d397d[_0x707e('0x3a')][_0x707e('0x3c')])){if(_['isUndefined'](this[_0x707e('0x9')][_0x4d397d[_0x707e('0x17')]])){this['channels'][_0x4d397d[_0x707e('0x17')]]={'routeId':_0x4d397d[_0x707e('0x3b')],'variables':this[_0x707e('0x3d')][_0x4d397d[_0x707e('0x17')]]};logger[_0x707e('0x1f')](_0x707e('0x3e'),_0x4d397d['uniqueid'],_0x4d397d[_0x707e('0x3a')][_0x707e('0x3c')],_['keys'](_0x4d397d[_0x707e('0x3a')])[0x0],_0x4d397d[_0x707e('0x3b')]);logger['debug'](_0x707e('0x3f'),_0x4d397d[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x4d397d[_0x707e('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x707e('0x36'),'voice_outbound_channel:save',this[_0x707e('0x9')][_0x4d397d[_0x707e('0x17')]]);}}}}catch(_0x52841f){logger['error'](_0x707e('0x40'),_0x4d397d[_0x707e('0x17')],util[_0x707e('0x24')](_0x52841f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x707e('0x13')][_0x707e('0x38')]=function(_0x5af60e,_0x324dfe,_0xa2792b){var _0x2f6e39=[_0x707e('0x41'),'rtpaudioqosbridged',_0x707e('0x42'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x707e('0x43'),_0x707e('0x44'),_0x707e('0x45'),_0x707e('0x46'),_0x707e('0x47'),'bridgepeer',_0x707e('0x48'),_0x707e('0x49'),_0x707e('0x4a'),_0x707e('0x4b'),'memberlastcall',_0x707e('0x21'),'memberpenalty',_0x707e('0x4c')];if(!_[_0x707e('0x4d')](_0x324dfe)&&!_[_0x707e('0x4e')](_0x2f6e39,_0x324dfe)){if(_[_0x707e('0x4f')](this['variables'][_0x5af60e])){this[_0x707e('0x3d')][_0x5af60e]={};}this[_0x707e('0x3d')][_0x5af60e][_0x324dfe]=_0xa2792b;}};VoiceDialReport['prototype'][_0x707e('0x12')]=function(_0x56a971){try{if(this[_0x707e('0x14')](_0x56a971)){logger[_0x707e('0x16')](_0x707e('0x50'),_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](_0x56a971,{'showHidden':![],'depth':null}));if(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]){logger['info'](_0x707e('0x51'),_0x56a971['uniqueid'],_0x56a971[_0x707e('0x52')]);this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x53')]=moment()[_0x707e('0x19')](_0x707e('0x30'));this[_0x707e('0x9')][_0x56a971['uniqueid']][_0x707e('0x54')]=moment(this[_0x707e('0x9')][_0x56a971['uniqueid']][_0x707e('0x53')])[_0x707e('0x55')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x56')],_0x707e('0x57'));this[_0x707e('0x9')][_0x56a971['uniqueid']]['lastevent']=_0x707e('0x58');this['outbound'][_0x707e('0x59')]+=0x1;if(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x2f')]){this[_0x707e('0x5a')]['answered']+=0x1;this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x5b')]=moment(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x2f')])[_0x707e('0x55')](this['channels'][_0x56a971[_0x707e('0x17')]][_0x707e('0x56')],_0x707e('0x57'));this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x5c')]=moment(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]['endtime'])[_0x707e('0x55')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x2f')],_0x707e('0x57'));this[_0x707e('0x5a')][_0x707e('0x5d')]+=this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]['holdtime']||0x0;this['outbound'][_0x707e('0x5e')]+=this[_0x707e('0x9')][_0x56a971['uniqueid']]['billableseconds'];}this[_0x707e('0x5a')][_0x707e('0x5f')]+=this[_0x707e('0x9')][_0x56a971['uniqueid']]['duration'];logger[_0x707e('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x56a971['uniqueid'],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]],{'showHidden':![],'depth':null}));ami[_0x707e('0x15')](_0x707e('0x60'),this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]);logger['debug'](_0x707e('0x61'),_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]],{'showHidden':![],'depth':null}));ami[_0x707e('0x15')](_0x707e('0x62'),this['channels'][_0x56a971[_0x707e('0x17')]]);logger[_0x707e('0x16')](_0x707e('0x63'),_0x56a971['uniqueid'],util[_0x707e('0x24')](this['channels'][_0x56a971[_0x707e('0x17')]],{'showHidden':![],'depth':null}));this[_0x707e('0x15')](_0x707e('0x36'),_0x707e('0x64'),this[_0x707e('0x5a')]);logger['info'](_0x707e('0x65'),JSON[_0x707e('0x66')](this[_0x707e('0x9')][_0x56a971['uniqueid']]));logger[_0x707e('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x56a971['uniqueid']],{'showHidden':![],'depth':null}));this[_0x707e('0x15')](_0x707e('0x36'),_0x707e('0x67'),this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]);delete this[_0x707e('0x9')][_0x56a971['uniqueid']];}else if(this['channels'][_0x56a971['linkedid']]){this[_0x707e('0x9')][_0x56a971[_0x707e('0x68')]][_0x707e('0x17')]=this[_0x707e('0x9')][_0x56a971['linkedid']][_0x707e('0x69')];}if(this[_0x707e('0x3d')][_0x56a971[_0x707e('0x17')]]){delete this[_0x707e('0x3d')][_0x56a971['uniqueid']];}}}catch(_0x31169a){logger['error'](_0x707e('0x6a'),_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](_0x31169a,{'showHidden':![],'depth':null}));}};module[_0x707e('0x6b')]=VoiceDialReport; \ No newline at end of file +var _0x2628=['../../../config/environment','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','syncDialBegin','dialend','bind','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','voice_outbound_channel:save','custom:dialbegin','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','syncVarSet','addVariable','keys','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','duration','endtime','diff','seconds','lastevent','complete','holdtime','starttime','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis'];(function(_0xab6a2b,_0x403a6b){var _0x33edba=function(_0x533c32){while(--_0x533c32){_0xab6a2b['push'](_0xab6a2b['shift']());}};_0x33edba(++_0x403a6b);}(_0x2628,0xc8));var _0x8262=function(_0x3849fd,_0x4b2039){_0x3849fd=_0x3849fd-0x0;var _0x3958af=_0x2628[_0x3849fd];return _0x3958af;};'use strict';var _=require(_0x8262('0x0'));var moment=require(_0x8262('0x1'));var util=require(_0x8262('0x2'));var Redis=require(_0x8262('0x3'));var config=require(_0x8262('0x4'));var logger=require('../../../config/logger')(_0x8262('0x5'));var ami=require(_0x8262('0x6'));config[_0x8262('0x7')]=_['defaults'](config[_0x8262('0x7')],{'host':_0x8262('0x8'),'port':0x18eb});var io=require(_0x8262('0x9'))(new Redis(config[_0x8262('0x7')]));function VoiceDialReport(_0x302048){this[_0x8262('0xa')]=_0x302048[_0x8262('0xb')];this['outbound']=_0x302048[_0x8262('0xc')];this[_0x8262('0xd')]={};ami['on']('dialbegin',this[_0x8262('0xe')]['bind'](this));ami['on'](_0x8262('0xf'),this['syncDialEnd'][_0x8262('0x10')](this));ami['on'](_0x8262('0x11'),this['syncVarSet'][_0x8262('0x10')](this));ami['on'](_0x8262('0x12'),this[_0x8262('0x13')][_0x8262('0x10')](this));}VoiceDialReport[_0x8262('0x14')][_0x8262('0x15')]=function(_0x37aa38){return _0x37aa38!==null&&!_[_0x8262('0x16')](_0x37aa38);};VoiceDialReport['prototype'][_0x8262('0x17')]=function(_0x577213,_0x3e4cc3,_0x1fa93){io['to'](_0x577213)[_0x8262('0x17')](_0x3e4cc3,_0x1fa93);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x17b30e){try{if(this[_0x8262('0x15')](_0x17b30e)){logger[_0x8262('0x18')](_0x8262('0x19'),_0x17b30e[_0x8262('0x1a')],util[_0x8262('0x1b')](_0x17b30e,{'showHidden':![],'depth':null}));if(this['channels'][_0x17b30e['uniqueid']]){_['merge'](this[_0x8262('0xa')][_0x17b30e[_0x8262('0x1a')]],{'starttime':moment()[_0x8262('0x1c')](_0x8262('0x1d')),'lastevent':_0x8262('0x1e'),'interface':_0x17b30e[_0x8262('0x1f')][_0x8262('0x20')](0x0,_0x17b30e[_0x8262('0x1f')]['lastIndexOf']('-')),'membername':_0x17b30e[_0x8262('0x1f')][_0x8262('0x20')](_0x17b30e['channel'][_0x8262('0x21')]('/')+0x1,_0x17b30e[_0x8262('0x1f')]['lastIndexOf']('-'))},_[_0x8262('0x22')](_0x17b30e,[_0x8262('0x23'),_0x8262('0x24')]));logger[_0x8262('0x25')](_0x8262('0x26'),_0x17b30e[_0x8262('0x1a')],this[_0x8262('0xa')][_0x17b30e[_0x8262('0x1a')]][_0x8262('0x27')],this[_0x8262('0xa')][_0x17b30e[_0x8262('0x1a')]][_0x8262('0x28')]);logger[_0x8262('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x17b30e[_0x8262('0x1a')],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x17b30e['uniqueid']],{'showHidden':![],'depth':null}));this[_0x8262('0x17')](_0x8262('0x29'),_0x8262('0x2a'),this['channels'][_0x17b30e[_0x8262('0x1a')]]);logger[_0x8262('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x17b30e['uniqueid'],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x17b30e[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x8262('0x17')](_0x8262('0x2b'),this['channels'][_0x17b30e[_0x8262('0x1a')]]);}}}catch(_0x44cbd8){logger['error']('[%s][voiceDialReport][dialbegin]',_0x17b30e['uniqueid'],util[_0x8262('0x1b')](_0x44cbd8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x1e4493){try{if(this[_0x8262('0x15')](_0x1e4493)){logger[_0x8262('0x18')](_0x8262('0x2c'),_0x1e4493[_0x8262('0x1a')],util['inspect'](_0x1e4493,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e4493[_0x8262('0x1a')]]){this[_0x8262('0xa')][_0x1e4493[_0x8262('0x1a')]][_0x8262('0x2d')]=_0x1e4493[_0x8262('0x2d')];if(_0x1e4493[_0x8262('0x2d')]===_0x8262('0x2e')){this[_0x8262('0xa')][_0x1e4493['uniqueid']][_0x8262('0x2f')]=_0x1e4493[_0x8262('0x2f')];this['channels'][_0x1e4493[_0x8262('0x1a')]][_0x8262('0x30')]=_0x1e4493[_0x8262('0x30')];this['channels'][_0x1e4493[_0x8262('0x1a')]][_0x8262('0x31')]=moment()[_0x8262('0x1c')](_0x8262('0x1d'));this[_0x8262('0xa')][_0x1e4493['uniqueid']]['lastevent']=_0x8262('0x32');logger['info'](_0x8262('0x33'),_0x1e4493[_0x8262('0x1a')],_0x1e4493[_0x8262('0x1f')][_0x8262('0x20')](_0x1e4493[_0x8262('0x1f')][_0x8262('0x21')]('/')+0x1,_0x1e4493['channel']['lastIndexOf']('-')));logger[_0x8262('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x1e4493[_0x8262('0x1a')],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x1e4493[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0x8262('0xa')][_0x1e4493['uniqueid']]);}logger[_0x8262('0x18')](_0x8262('0x34'),_0x1e4493[_0x8262('0x1a')],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x1e4493[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));this[_0x8262('0x17')]('voice:outbound',_0x8262('0x2a'),this['channels'][_0x1e4493[_0x8262('0x1a')]]);}}}catch(_0x278161){logger[_0x8262('0x35')](_0x8262('0x36'),_0x1e4493[_0x8262('0x1a')],util[_0x8262('0x1b')](_0x278161,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8262('0x14')][_0x8262('0x37')]=function(_0x460404){try{if(this[_0x8262('0x15')](_0x460404)){logger[_0x8262('0x18')]('[%s][voiceDialReport][varset]\x20event:',_0x460404[_0x8262('0x1a')],util[_0x8262('0x1b')](_0x460404,{'showHidden':![],'depth':null}));this[_0x8262('0x38')](_0x460404['uniqueid'],_[_0x8262('0x39')](_0x460404[_0x8262('0x3a')])[0x0],_0x460404[_0x8262('0x3b')]);if(this['isNotNull'](_0x460404[_0x8262('0x3a')])&&this['isNotNull'](_0x460404[_0x8262('0x3a')]['outboundrouteid'])){if(_[_0x8262('0x16')](this[_0x8262('0xa')][_0x460404[_0x8262('0x1a')]])){this[_0x8262('0xa')][_0x460404['uniqueid']]={'routeId':_0x460404[_0x8262('0x3b')],'variables':this[_0x8262('0xd')][_0x460404[_0x8262('0x1a')]]};logger[_0x8262('0x25')](_0x8262('0x3c'),_0x460404[_0x8262('0x1a')],_0x460404['variable'][_0x8262('0x3d')],_[_0x8262('0x39')](_0x460404[_0x8262('0x3a')])[0x0],_0x460404[_0x8262('0x3b')]);logger[_0x8262('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x460404[_0x8262('0x1a')],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x460404[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));this[_0x8262('0x17')](_0x8262('0x29'),_0x8262('0x2a'),this[_0x8262('0xa')][_0x460404[_0x8262('0x1a')]]);}}}}catch(_0xa281dc){logger[_0x8262('0x35')](_0x8262('0x3e'),_0x460404[_0x8262('0x1a')],util[_0x8262('0x1b')](_0xa281dc,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x8262('0x38')]=function(_0x352ce8,_0xd19d71,_0x4c72bf){var _0x381ea0=[_0x8262('0x3f'),_0x8262('0x40'),_0x8262('0x41'),'rtpaudioqosjitterbridged',_0x8262('0x42'),_0x8262('0x43'),_0x8262('0x44'),_0x8262('0x45'),_0x8262('0x46'),_0x8262('0x47'),'bridgepeer',_0x8262('0x48'),_0x8262('0x49'),'memberdynamic','memberinterface',_0x8262('0x4a'),_0x8262('0x27'),_0x8262('0x4b'),_0x8262('0x4c')];if(!_[_0x8262('0x4d')](_0xd19d71)&&!_[_0x8262('0x4e')](_0x381ea0,_0xd19d71)){if(_[_0x8262('0x16')](this[_0x8262('0xd')][_0x352ce8])){this[_0x8262('0xd')][_0x352ce8]={};}this['variables'][_0x352ce8][_0xd19d71]=_0x4c72bf;}};VoiceDialReport['prototype'][_0x8262('0x13')]=function(_0x458e0e){try{if(this[_0x8262('0x15')](_0x458e0e)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x458e0e[_0x8262('0x1a')],util[_0x8262('0x1b')](_0x458e0e,{'showHidden':![],'depth':null}));if(this['channels'][_0x458e0e[_0x8262('0x1a')]]){logger[_0x8262('0x25')](_0x8262('0x4f'),_0x458e0e[_0x8262('0x1a')],_0x458e0e['cause-txt']);this['channels'][_0x458e0e[_0x8262('0x1a')]]['endtime']=moment()[_0x8262('0x1c')](_0x8262('0x1d'));this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x50')]=moment(this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x51')])[_0x8262('0x52')](this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]]['starttime'],_0x8262('0x53'));this['channels'][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x54')]=_0x8262('0x55');this[_0x8262('0xc')]['total']+=0x1;if(this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x31')]){this['outbound']['answered']+=0x1;this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x56')]=moment(this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x31')])[_0x8262('0x52')](this['channels'][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x57')],'seconds');this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x58')]=moment(this['channels'][_0x458e0e['uniqueid']][_0x8262('0x51')])[_0x8262('0x52')](this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x31')],_0x8262('0x53'));this[_0x8262('0xc')][_0x8262('0x59')]+=this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x56')]||0x0;this[_0x8262('0xc')]['sumBillable']+=this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]][_0x8262('0x58')];}this['outbound'][_0x8262('0x5a')]+=this[_0x8262('0xa')][_0x458e0e['uniqueid']][_0x8262('0x50')];logger[_0x8262('0x18')](_0x8262('0x5b'),_0x458e0e[_0x8262('0x1a')],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8262('0x5c'),this['channels'][_0x458e0e['uniqueid']]);logger[_0x8262('0x18')](_0x8262('0x5d'),_0x458e0e[_0x8262('0x1a')],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x8262('0x17')](_0x8262('0x5e'),this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]]);logger[_0x8262('0x18')](_0x8262('0x5f'),_0x458e0e[_0x8262('0x1a')],util[_0x8262('0x1b')](this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));this[_0x8262('0x17')](_0x8262('0x29'),'voice_outbound:save',this[_0x8262('0xc')]);logger[_0x8262('0x25')](_0x8262('0x60'),JSON['stringify'](this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]]));logger[_0x8262('0x18')](_0x8262('0x61'),_0x458e0e['uniqueid'],util['inspect'](this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]],{'showHidden':![],'depth':null}));this[_0x8262('0x17')](_0x8262('0x29'),'voice_outbound_channel:remove',this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]]);delete this[_0x8262('0xa')][_0x458e0e[_0x8262('0x1a')]];}else if(this['channels'][_0x458e0e[_0x8262('0x62')]]){this[_0x8262('0xa')][_0x458e0e[_0x8262('0x62')]]['uniqueid']=this['channels'][_0x458e0e['linkedid']][_0x8262('0x63')];}if(this[_0x8262('0xd')][_0x458e0e[_0x8262('0x1a')]]){delete this[_0x8262('0xd')][_0x458e0e['uniqueid']];}}}catch(_0x36fe79){logger[_0x8262('0x35')](_0x8262('0x64'),_0x458e0e['uniqueid'],util['inspect'](_0x36fe79,{'showHidden':![],'depth':null}));}};module[_0x8262('0x65')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index ddc603a..5204db3 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 _0xdac7=['[%s][voiceQueueReport][checkVariables]','prototype','[FullyBooted]\x20clear\x20realtime','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_channel:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','name','strategy','answered','sumBillable','sumHoldTime','total','unmanaged','Trunk','active','callerid','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','queues','[voiceQueueReport][queues]','loopQueueSummary','[voiceQueueReport][queuesummary]','queue','info','countBy','callers','toNumber','loggedin','available','loggedIn','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','syncQueueCallerJoin','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','[%s][voiceQueueReport][queuecallerjoin]','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[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]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','add','seconds','transfertype','FORWARD','transferuniqueid','COMPLETEDBY','toUpperCase','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','abandoned','diff','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','exports','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','enqueue','tail','finally','sequence','queueReports','agents','channels','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncAttendedTransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','switch','isNil','Action','status','catch','message','No\x20such\x20channel','error','inspect','variables'];(function(_0x4d6a4d,_0x20c355){var _0x4292b7=function(_0x5d2ff5){while(--_0x5d2ff5){_0x4d6a4d['push'](_0x4d6a4d['shift']());}};_0x4292b7(++_0x20c355);}(_0xdac7,0x180));var _0x7dac=function(_0x838481,_0x1e885e){_0x838481=_0x838481-0x0;var _0x6cec86=_0xdac7[_0x838481];return _0x6cec86;};'use strict';var _=require(_0x7dac('0x0'));var moment=require(_0x7dac('0x1'));var util=require('util');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x7dac('0x2'));var logger=require(_0x7dac('0x3'))(_0x7dac('0x4'));var ami=require(_0x7dac('0x5'));var QueueReport=require('../model/queueReport');config['redis']=_['defaults'](config[_0x7dac('0x6')],{'host':_0x7dac('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7dac('0x6')]));var Sequence=function(){};Sequence['prototype'][_0x7dac('0x8')]=function(_0x5ccf75){this[_0x7dac('0x9')]=this[_0x7dac('0x9')]?this[_0x7dac('0x9')][_0x7dac('0xa')](_0x5ccf75):_0x5ccf75();};function VoiceQueueReport(_0x11b680){this[_0x7dac('0xb')]=new Sequence();this[_0x7dac('0xc')]={};this[_0x7dac('0xd')]=_0x11b680[_0x7dac('0xd')];this[_0x7dac('0xe')]=_0x11b680['queueChannels'];this['voiceQueues']=_0x11b680['voiceQueues'];this[_0x7dac('0xf')]=!![];this['campaigns']=_0x11b680[_0x7dac('0x10')];this['variables']={};ami['on'](_0x7dac('0x11'),this[_0x7dac('0x12')][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x14'),this[_0x7dac('0x15')][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x16'),this['syncQueueCallerJoin'][_0x7dac('0x13')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x17'),this[_0x7dac('0x18')][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x19'),this['syncAgentComplete'][_0x7dac('0x13')](this));ami['on']('agentconnect',this[_0x7dac('0x1a')][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x1b'),this[_0x7dac('0x1c')][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x1d'),this[_0x7dac('0x1e')][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x1f'),this[_0x7dac('0x20')][_0x7dac('0x13')](this));ami['on'](_0x7dac('0x21'),this[_0x7dac('0x22')][_0x7dac('0x13')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x7dac('0x13')](this));ami['on']('attendedtransfer',this[_0x7dac('0x23')][_0x7dac('0x13')](this));ami['on']('blindtransfer',this[_0x7dac('0x24')][_0x7dac('0x13')](this));this['loopQueueSummary']();this[_0x7dac('0x25')]();}function clearChannels(_0x41b3cd){if(!_[_0x7dac('0x26')](_0x41b3cd)){for(var _0x179881 in _0x41b3cd){if(_0x41b3cd[_0x7dac('0x27')](_0x179881)){delete _0x41b3cd[_0x179881];}}}}function clearCampaigns(_0x3c9967){if(!_[_0x7dac('0x26')](_0x3c9967)){for(var _0x4b5776 in _0x3c9967){if(_0x3c9967[_0x7dac('0x27')](_0x4b5776)){_0x3c9967[_0x4b5776][_0x7dac('0x28')]=0x0;}}}}function clearVoiceQueues(_0x329d14){if(!_['isEmpty'](_0x329d14)){for(var _0x5b41c9 in _0x329d14){if(_0x329d14[_0x7dac('0x27')](_0x5b41c9)){_0x329d14[_0x5b41c9][_0x7dac('0x28')]=0x0;_0x329d14[_0x5b41c9][_0x7dac('0x29')]=0x0;_0x329d14[_0x5b41c9][_0x7dac('0x2a')]=0x0;_0x329d14[_0x5b41c9][_0x7dac('0x2b')]=0x0;_0x329d14[_0x5b41c9][_0x7dac('0x2c')]=!![];}}}}function clearAgentBooked(_0x3f76fd){if(!_[_0x7dac('0x26')](_0x3f76fd)){for(var _0xdd98b1 in _0x3f76fd){if(_0x3f76fd[_0x7dac('0x27')](_0xdd98b1)){_0x3f76fd[_0xdd98b1][_0x7dac('0x2d')]=!![];}}}}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x3168f7=this;for(var _0xa92c4b in this[_0x7dac('0xe')]){if(this['channels'][_0x7dac('0x27')](_0xa92c4b)&&!this[_0x7dac('0xe')][_0xa92c4b][_0x7dac('0x2e')]){this[_0x7dac('0xb')]['enqueue'](function(){if(!_[_0x7dac('0x2f')](_0x3168f7['channels'][_0xa92c4b])){return ami[_0x7dac('0x30')]({'action':_0x7dac('0x31'),'channel':_0x3168f7[_0x7dac('0xe')][_0xa92c4b]['channel']})[_0x7dac('0x32')](function(_0x3b805b){if(_0x3b805b[_0x7dac('0x33')]===_0x7dac('0x34')){setTimeout(function(){if(_0x3168f7[_0x7dac('0xe')][_0xa92c4b]){delete _0x3168f7[_0x7dac('0xe')][_0xa92c4b];logger['error']('[%s][voiceQueueReport][checkChannel]',_0xa92c4b,util['inspect'](_0x3b805b,{'showHidden':![],'depth':null}));}if(_0x3168f7[_0x7dac('0xc')][_0xa92c4b]){delete _0x3168f7[_0x7dac('0xc')][_0xa92c4b];logger[_0x7dac('0x35')]('[%s][voiceQueueReport][checkQueueReport]',_0xa92c4b,util[_0x7dac('0x36')](_0x3b805b,{'showHidden':![],'depth':null}));}if(_0x3168f7[_0x7dac('0x37')][_0xa92c4b]){delete _0x3168f7[_0x7dac('0x37')][_0xa92c4b];logger['error'](_0x7dac('0x38'),_0xa92c4b,util[_0x7dac('0x36')](_0x3b805b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x20')]=function(){logger['error'](_0x7dac('0x3a'));clearChannels(this[_0x7dac('0xe')]);this[_0x7dac('0x3b')](this[_0x7dac('0xc')]);clearAgentBooked(this[_0x7dac('0xd')]);clearVoiceQueues(this[_0x7dac('0x3c')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x7dac('0x39')]['clearQueueReport']=function(_0x151623){var _0x49e8c1=this;if(!_[_0x7dac('0x26')](_0x151623)){for(var _0xbd62b5 in _0x151623){if(_0x151623[_0x7dac('0x27')](_0xbd62b5)){_0x49e8c1[_0x7dac('0x3d')](_0x151623[_0xbd62b5],_0x7dac('0x3e'));delete _0x151623[_0xbd62b5];}}}};VoiceQueueReport['prototype']['emit']=function(_0x1ba418,_0x4fbe2f,_0x489d44){io['to'](_0x1ba418)[_0x7dac('0x3f')](_0x4fbe2f,_0x489d44);};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x40')]=function(_0x20bd55,_0xeea728){logger['debug']('[%s][voiceQueueReport]['+_0xeea728+_0x7dac('0x41'),_0x20bd55[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x20bd55,{'showHidden':![],'depth':null}));this[_0x7dac('0x3f')](util[_0x7dac('0x43')](_0x7dac('0x44'),_0x20bd55['name']),_0x7dac('0x45'),_0x20bd55);};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x3d')]=function(_0x20346f,_0x58a422){logger[_0x7dac('0x46')]('[%s][voiceQueueReport]['+_0x58a422+_0x7dac('0x47'),_0x20346f[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x20346f,{'showHidden':![],'depth':null}));this[_0x7dac('0x3f')](util[_0x7dac('0x43')](_0x7dac('0x44'),_0x20346f['name']),_0x7dac('0x48'),_0x20346f);};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x49')]=function(_0x10c30c,_0x261d11){if(_0x10c30c[_0x7dac('0x4a')]===_0x7dac('0x4b')){var _0x43b426={'id':_0x10c30c['id'],'name':_0x10c30c[_0x7dac('0x4c')],'strategy':_0x10c30c[_0x7dac('0x4d')],'answered':_0x10c30c[_0x7dac('0x4e')],'available':_0x10c30c['available'],'loggedIn':_0x10c30c['loggedIn'],'pTalking':_0x10c30c[_0x7dac('0x2a')],'sumBillable':_0x10c30c[_0x7dac('0x4f')],'sumDuration':_0x10c30c['sumDuration'],'sumHoldTime':_0x10c30c[_0x7dac('0x50')]||0x0,'talking':_0x10c30c[_0x7dac('0x29')],'total':_0x10c30c[_0x7dac('0x51')],'type':_0x10c30c[_0x7dac('0x4a')],'unmanaged':_0x10c30c[_0x7dac('0x52')],'abandoned':_0x10c30c['abandoned'],'waiting':_0x10c30c[_0x7dac('0x2b')]};if(_0x10c30c[_0x7dac('0x53')]){_0x43b426['Trunk']={'id':_0x10c30c[_0x7dac('0x53')]['id'],'name':_0x10c30c[_0x7dac('0x53')]['name'],'active':_0x10c30c[_0x7dac('0x53')][_0x7dac('0x54')],'callerid':_0x10c30c[_0x7dac('0x53')][_0x7dac('0x55')]};}if(_0x10c30c[_0x7dac('0x56')]){_0x43b426[_0x7dac('0x56')]={'id':_0x10c30c[_0x7dac('0x56')]['id'],'name':_0x10c30c[_0x7dac('0x56')][_0x7dac('0x4c')]};}var _0x4be376=md5(JSON[_0x7dac('0x57')](_0x43b426));if(_0x10c30c[_0x7dac('0x58')]!==_0x4be376){_0x10c30c[_0x7dac('0x58')]=_0x4be376;logger[_0x7dac('0x46')](_0x7dac('0x59')+_0x261d11+_0x7dac('0x5a'),util[_0x7dac('0x36')](_0x43b426,{'showHidden':![],'depth':null}));this[_0x7dac('0x3f')](util[_0x7dac('0x43')](_0x7dac('0x44'),_0x43b426[_0x7dac('0x4c')]),_0x7dac('0x5b'),_0x43b426);}}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x5c')]=function(_0x382d02){return _0x382d02!==null&&!_[_0x7dac('0x5d')](_0x382d02);};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x25')]=function(){var _0x55324a=this;setInterval(function(){_0x55324a[_0x7dac('0x5e')]();ami['Action']({'action':_0x7dac('0x5f')})[_0x7dac('0x32')](function(_0x4dcd63){logger[_0x7dac('0x35')](_0x7dac('0x60'),util[_0x7dac('0x36')](_0x4dcd63,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x7dac('0x61')]=function(){var _0x9b8885=this;setInterval(function(){if(_0x9b8885[_0x7dac('0xf')]){return ami[_0x7dac('0x30')]({'action':_0x7dac('0x11')})['then'](function(_0x139cc7){_0x9b8885[_0x7dac('0xf')]=![];})['catch'](function(_0x23671f){logger[_0x7dac('0x35')](_0x7dac('0x62'),util['inspect'](_0x23671f,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x12')]=function(_0xbac1b){try{if(this[_0x7dac('0x5c')](_0xbac1b)&&this[_0x7dac('0x5c')](_0xbac1b[_0x7dac('0x63')])){logger[_0x7dac('0x46')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0xbac1b,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0xbac1b[_0x7dac('0x63')]]){logger[_0x7dac('0x64')]('[voiceQueueReport][queuesummary]\x20name:%s',_0xbac1b[_0x7dac('0x63')]);var _0x227a48=_[_0x7dac('0x65')](this[_0x7dac('0xe')],_0x7dac('0x63'))[_0xbac1b[_0x7dac('0x63')]]||0x0;var _0xad9e4a=_0x227a48-_0xbac1b[_0x7dac('0x66')];if(this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]][_0x7dac('0x2b')]!==_[_0x7dac('0x67')](_0xbac1b['callers'])||this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]]['loggedIn']!==_[_0x7dac('0x67')](_0xbac1b[_0x7dac('0x68')])||this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]]['available']!==_[_0x7dac('0x67')](_0xbac1b[_0x7dac('0x69')])||this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]][_0x7dac('0x29')]!==_0xad9e4a){this['voiceQueues'][_0xbac1b[_0x7dac('0x63')]][_0x7dac('0x2b')]=_[_0x7dac('0x67')](_0xbac1b['callers']);this['voiceQueues'][_0xbac1b[_0x7dac('0x63')]][_0x7dac('0x6a')]=_[_0x7dac('0x67')](_0xbac1b[_0x7dac('0x68')]);this[_0x7dac('0x3c')][_0xbac1b['queue']]['available']=_['toNumber'](_0xbac1b[_0x7dac('0x69')]);this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]][_0x7dac('0x29')]=_0xad9e4a>0x0?_0xad9e4a:0x0;this[_0x7dac('0x3c')][_0xbac1b['queue']]['talking']=this[_0x7dac('0x3c')][_0xbac1b['queue']]['talking']>_[_0x7dac('0x67')](_0xbac1b[_0x7dac('0x68')])?_[_0x7dac('0x67')](_0xbac1b[_0x7dac('0x68')]):this['voiceQueues'][_0xbac1b[_0x7dac('0x63')]]['talking'];this[_0x7dac('0x49')](this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]],_0x7dac('0x11'));}logger[_0x7dac('0x46')](_0x7dac('0x6b'),util['inspect'](this['voiceQueues'][_0xbac1b[_0x7dac('0x63')]],{'showHidden':![],'depth':null}));ami[_0x7dac('0x3f')](_0x7dac('0x6c'),this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]]);}}}catch(_0xb54ef9){logger[_0x7dac('0x35')]('[voiceQueueReport][queuesummary]',util[_0x7dac('0x36')](_0xb54ef9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x15')]=function(_0x30ca59){logger['debug'](_0x7dac('0x6d'),util[_0x7dac('0x36')](_0x30ca59,{'showHidden':![],'depth':null}));this[_0x7dac('0xf')]=!![];};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x6e')]=function(_0x215972){try{if(this['isNotNull'](_0x215972)){logger[_0x7dac('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x215972['uniqueid'],util[_0x7dac('0x36')](_0x215972,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7dac('0xc')][_0x215972['uniqueid']])){this['queueReports'][_0x215972[_0x7dac('0x42')]]=[];this[_0x7dac('0xe')][_0x215972[_0x7dac('0x42')]]={};}var _0xfe88bc=new QueueReport();_0xfe88bc[_0x7dac('0x4c')]=_0x215972['queue'];_0xfe88bc[_0x7dac('0x4a')]=this[_0x7dac('0x3c')][_0xfe88bc[_0x7dac('0x4c')]]&&this['voiceQueues'][_0xfe88bc[_0x7dac('0x4c')]][_0x7dac('0x4a')]?this[_0x7dac('0x3c')][_0xfe88bc[_0x7dac('0x4c')]]['type']||_0x7dac('0x4b'):_0x7dac('0x4b');_0xfe88bc[_0x7dac('0x63')]=_0x215972[_0x7dac('0x63')];_0xfe88bc[_0x7dac('0x6f')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0xfe88bc[_0x7dac('0x71')]=_0x215972['position'];_0xfe88bc[_0x7dac('0x72')]=_0x215972[_0x7dac('0x72')];_0xfe88bc[_0x7dac('0x42')]=_0x215972[_0x7dac('0x42')];logger[_0x7dac('0x64')](_0x7dac('0x73'),_0xfe88bc['name'],_0xfe88bc['type']);_[_0x7dac('0x74')](_0xfe88bc,_[_0x7dac('0x75')](_0x215972,_[_0x7dac('0x76')](_0xfe88bc)));this['queueReports'][_0x215972[_0x7dac('0x42')]]['push'](_0xfe88bc);this['channels'][_0x215972[_0x7dac('0x42')]]=_0xfe88bc;this[_0x7dac('0x40')](_0xfe88bc,_0x7dac('0x16'));}}catch(_0x42e988){logger[_0x7dac('0x35')](_0x7dac('0x77'),_0x215972[_0x7dac('0x42')],util['inspect'](_0x42e988,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x78')]=function(_0x2f48be){try{if(this['isNotNull'](_0x2f48be)){logger[_0x7dac('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2f48be['uniqueid'],util[_0x7dac('0x36')](_0x2f48be,{'showHidden':![],'depth':null}));if(this[_0x7dac('0xc')][_0x2f48be[_0x7dac('0x42')]]){var _0x2302e=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x2f48be['uniqueid']]);_0x2302e[_0x7dac('0x7a')]=![];_0x2302e[_0x7dac('0x7b')]=null;_0x2302e[_0x7dac('0x7c')]=_0x2f48be[_0x7dac('0x7c')];_0x2302e[_0x7dac('0x7d')]=_0x2f48be[_0x7dac('0x7d')];_0x2302e[_0x7dac('0x7e')]=!![];_0x2302e[_0x7dac('0x7f')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0x2302e[_0x7dac('0x80')]=_0x7dac('0x81');_0x2302e['lastAssignedTo']=null;logger[_0x7dac('0x64')](_0x7dac('0x82'),_0x2302e[_0x7dac('0x4c')],_0x2302e[_0x7dac('0x4a')]);this[_0x7dac('0xe')][_0x2f48be[_0x7dac('0x42')]]=_0x2302e;this[_0x7dac('0x3d')](_0x2302e,_0x7dac('0x7e'));}}}catch(_0x4eaf8f){logger[_0x7dac('0x35')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2f48be['uniqueid'],util['inspect'](_0x4eaf8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x18')]=function(_0x44da17){try{if(this[_0x7dac('0x5c')](_0x44da17)){logger[_0x7dac('0x46')](_0x7dac('0x83'),_0x44da17[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x44da17,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x44da17[_0x7dac('0x42')]]){var _0x440bf3=_['last'](this[_0x7dac('0xc')][_0x44da17[_0x7dac('0x42')]]);_0x440bf3[_0x7dac('0x84')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0x440bf3[_0x7dac('0x85')]=_0x44da17[_0x7dac('0x85')];_0x440bf3['connectedlinename']=_0x44da17[_0x7dac('0x86')];logger[_0x7dac('0x64')](_0x7dac('0x87'),_0x440bf3[_0x7dac('0x4c')],_0x440bf3['type'],_0x44da17[_0x7dac('0x85')],_0x44da17[_0x7dac('0x86')]);this['channels'][_0x44da17[_0x7dac('0x42')]]=_0x440bf3;this['emitVoiceQueueChannelSave'](_0x440bf3,_0x7dac('0x17'));}}}catch(_0x366a6a){logger[_0x7dac('0x35')]('[%s][voiceQueueReport][queuecallerleave]',_0x44da17[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x366a6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')]['syncAgentConnect']=function(_0x5cec6b){try{if(this[_0x7dac('0x5c')](_0x5cec6b)){logger[_0x7dac('0x46')](_0x7dac('0x88'),_0x5cec6b['uniqueid'],util[_0x7dac('0x36')](_0x5cec6b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5cec6b[_0x7dac('0x42')]]){var _0xd96311=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x5cec6b[_0x7dac('0x42')]]);_0xd96311[_0x7dac('0x7a')]=!![];_0xd96311[_0x7dac('0x80')]=_0x7dac('0x89');logger[_0x7dac('0x64')](_0x7dac('0x8a'),_0xd96311[_0x7dac('0x4c')],_0xd96311['type']);}}}catch(_0x8eea79){logger[_0x7dac('0x35')](_0x7dac('0x88'),_0x5cec6b[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x8eea79,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7dac('0x8b')]=function(_0x75dc3a){try{if(this[_0x7dac('0x5c')](_0x75dc3a)){logger[_0x7dac('0x46')](_0x7dac('0x8c'),_0x75dc3a[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x75dc3a,{'showHidden':![],'depth':null}));if(this[_0x7dac('0xc')][_0x75dc3a[_0x7dac('0x42')]]){var _0x4c3803=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x75dc3a['uniqueid']]);_0x4c3803[_0x7dac('0x7e')]=![];_0x4c3803[_0x7dac('0x7f')]=null;_0x4c3803[_0x7dac('0x8d')]=!![];_0x4c3803['lastAssignedTo']=_0x75dc3a[_0x7dac('0x8e')];_0x4c3803[_0x7dac('0x7c')]=_0x75dc3a[_0x7dac('0x7c')];_0x4c3803['queuecallercomplete']=!![];_0x4c3803[_0x7dac('0x8f')]=![];_0x4c3803[_0x7dac('0x90')]=null;if(!_0x4c3803[_0x7dac('0x91')]){if(_0x75dc3a[_0x7dac('0x92')]==_0x7dac('0x91')){_0x4c3803[_0x7dac('0x80')]='COMPLETED';logger[_0x7dac('0x64')](_0x7dac('0x93'),_0x4c3803[_0x7dac('0x4c')],_0x4c3803[_0x7dac('0x4a')]);}else{if(_[_0x7dac('0x94')](_0x75dc3a[_0x7dac('0x95')][_0x7dac('0x96')](),_0x7dac('0x97'))){if(this[_0x7dac('0xc')][_0x75dc3a['linkedid']]){var _0x25f93f=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x75dc3a[_0x7dac('0x98')]]);_0x25f93f['queuecallercomplete']=![];_0x25f93f['queuecallerexit']=!![];_0x25f93f[_0x7dac('0x90')]=moment(_0x4c3803['queuecallerjoinAt'])[_0x7dac('0x99')](_0x75dc3a[_0x7dac('0x7c')],_0x7dac('0x9a'))[_0x7dac('0x43')](_0x7dac('0x70'));_0x25f93f[_0x7dac('0x80')]='FORWARDTRANSFER';_0x25f93f[_0x7dac('0x91')]=!![];_0x25f93f[_0x7dac('0x9b')]=_0x7dac('0x9c');_0x25f93f['transferexten']=_0x75dc3a['destexten'];_0x25f93f[_0x7dac('0x9d')]=_0x75dc3a[_0x7dac('0x42')];logger[_0x7dac('0x64')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x25f93f['name'],_0x25f93f[_0x7dac('0x4a')]);var _0xc386b1=this['queueReports'][_0x75dc3a[_0x7dac('0x98')]];this[_0x7dac('0xc')][_0x75dc3a['linkedid']]=this[_0x7dac('0xc')][_0x75dc3a['uniqueid']];this[_0x7dac('0xc')][_0x75dc3a[_0x7dac('0x42')]]=_0xc386b1;}}else{_0x4c3803[_0x7dac('0x80')]=_0x7dac('0x9e')+_0x75dc3a[_0x7dac('0x92')][_0x7dac('0x9f')]();logger[_0x7dac('0x64')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4c3803[_0x7dac('0x4c')],_0x4c3803[_0x7dac('0x4a')],_0x4c3803[_0x7dac('0x80')]);}}}this['channels'][_0x75dc3a['uniqueid']]=_0x4c3803;this['emitVoiceQueueChannelRemove'](_0x4c3803,_0x7dac('0x19'));}}}catch(_0x385e0d){logger[_0x7dac('0x35')](_0x7dac('0x8c'),_0x75dc3a[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x385e0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')]['syncVarSet']=function(_0x38f35e){try{if(this[_0x7dac('0x5c')](_0x38f35e)){logger[_0x7dac('0x46')](_0x7dac('0xa0'),_0x38f35e[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x38f35e,{'showHidden':![],'depth':null}));this[_0x7dac('0xa1')](_0x38f35e[_0x7dac('0x42')],_[_0x7dac('0x76')](_0x38f35e[_0x7dac('0xa2')])[0x0],_0x38f35e[_0x7dac('0xa3')]);if(this['queueReports'][_0x38f35e[_0x7dac('0x42')]]){var _0x1cbb3f=_[_0x7dac('0x79')](this['queueReports'][_0x38f35e[_0x7dac('0x42')]]);if(_0x1cbb3f){if(this[_0x7dac('0x5c')](_0x38f35e['variable'])&&this[_0x7dac('0x5c')](_0x38f35e[_0x7dac('0xa2')]['queuestatus'])){switch(_0x38f35e[_0x7dac('0xa3')]){case _0x7dac('0xa4'):_0x1cbb3f['queuecallerexit']=![];_0x1cbb3f[_0x7dac('0x90')]=null;break;case'TIMEOUT':_0x1cbb3f[_0x7dac('0xa5')]=_0x7dac('0xa6');_0x1cbb3f[_0x7dac('0x8f')]=!![];_0x1cbb3f[_0x7dac('0x90')]=moment()[_0x7dac('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cbb3f['queuecallerleaveAt']=moment()[_0x7dac('0x43')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x7dac('0x46')](_0x7dac('0xa7'),_0x38f35e['uniqueid'],util[_0x7dac('0x36')](_0x1cbb3f,{'showHidden':![],'depth':null}));ami[_0x7dac('0x3f')]('custom:timeout',_0x1cbb3f);break;default:_0x1cbb3f[_0x7dac('0x8f')]=!![];_0x1cbb3f[_0x7dac('0x90')]=moment()[_0x7dac('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cbb3f[_0x7dac('0x84')]=moment()['format'](_0x7dac('0x70'));}_0x1cbb3f[_0x7dac('0x7e')]=![];_0x1cbb3f[_0x7dac('0x7f')]=null;_0x1cbb3f[_0x7dac('0x80')]=_0x38f35e[_0x7dac('0xa3')];this['channels'][_0x38f35e[_0x7dac('0x42')]]=_0x1cbb3f;this[_0x7dac('0x3d')](_0x1cbb3f,_0x7dac('0x1b'));}else if(this[_0x7dac('0x5c')](_0x38f35e[_0x7dac('0xa2')])&&this['isNotNull'](_0x38f35e[_0x7dac('0xa2')]['queueposition'])){if(!_0x1cbb3f[_0x7dac('0x7e')]){_0x1cbb3f[_0x7dac('0x8f')]=!![];_0x1cbb3f['queuecallerexitAt']=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0x1cbb3f['queuecallerexitreason']='EXITWITHKEY';_0x1cbb3f[_0x7dac('0x84')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));this[_0x7dac('0xe')][_0x38f35e[_0x7dac('0x42')]]=_0x1cbb3f;}}logger[_0x7dac('0x64')](_0x7dac('0xa8'),_0x38f35e[_0x7dac('0x42')],_0x1cbb3f[_0x7dac('0x4c')],_0x1cbb3f['type'],_[_0x7dac('0x76')](_0x38f35e[_0x7dac('0xa2')])[0x0],_0x38f35e['value']);_0x1cbb3f[_0x7dac('0x37')]=this['variables'][_0x38f35e[_0x7dac('0x42')]];}}}}catch(_0x541eca){logger['error'](_0x7dac('0xa0'),_0x38f35e[_0x7dac('0x42')],util['inspect'](_0x541eca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')]['addVariable']=function(_0x39d238,_0xff215,_0xf4dbe9){var _0xb4ade9=[_0x7dac('0xa9'),'rtpaudioqosbridged',_0x7dac('0xaa'),'rtpaudioqosjitterbridged',_0x7dac('0xab'),'rtpaudioqoslossbridged',_0x7dac('0xac'),'rtpaudioqosrttbridged','sipcallid',_0x7dac('0xad'),_0x7dac('0xae'),_0x7dac('0xaf'),'membercalls',_0x7dac('0xb0'),_0x7dac('0xb1'),_0x7dac('0xb2'),_0x7dac('0x8e'),_0x7dac('0xb3'),_0x7dac('0xb4')];if(!_[_0x7dac('0x2f')](_0xff215)&&!_[_0x7dac('0xb5')](_0xb4ade9,_0xff215)){if(_[_0x7dac('0x5d')](this[_0x7dac('0x37')][_0x39d238])){this[_0x7dac('0x37')][_0x39d238]={};}this[_0x7dac('0x37')][_0x39d238][_0xff215]=_0xf4dbe9;}};VoiceQueueReport['prototype'][_0x7dac('0x1e')]=function(_0x5d45a6){try{if(this[_0x7dac('0x5c')](_0x5d45a6)){logger['debug'](_0x7dac('0xb6'),_0x5d45a6[_0x7dac('0x42')],util['inspect'](_0x5d45a6,{'showHidden':![],'depth':null}));if(this[_0x7dac('0xc')][_0x5d45a6['uniqueid']]){for(var _0x596dc7=0x0,_0x5d6409={};_0x596dc70x0?_0x23bd14:0x0;this[_0xc4e5('0x11')][_0x38386f['queue']][_0xc4e5('0x28')]=this['voiceQueues'][_0x38386f[_0xc4e5('0x61')]][_0xc4e5('0x28')]>_[_0xc4e5('0x66')](_0x38386f['loggedin'])?_[_0xc4e5('0x66')](_0x38386f['loggedin']):this[_0xc4e5('0x11')][_0x38386f[_0xc4e5('0x61')]][_0xc4e5('0x28')];this[_0xc4e5('0x46')](this[_0xc4e5('0x11')][_0x38386f[_0xc4e5('0x61')]],'queuesummary');}logger[_0xc4e5('0x3f')](_0xc4e5('0x68'),util[_0xc4e5('0x35')](this[_0xc4e5('0x11')][_0x38386f[_0xc4e5('0x61')]],{'showHidden':![],'depth':null}));ami[_0xc4e5('0x3d')](_0xc4e5('0x69'),this[_0xc4e5('0x11')][_0x38386f[_0xc4e5('0x61')]]);}}}catch(_0xa4047a){logger[_0xc4e5('0x33')]('[voiceQueueReport][queuesummary]',util[_0xc4e5('0x35')](_0xa4047a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4e5('0x9')]['syncQueueSummaryComplete']=function(_0x3e81b8){logger[_0xc4e5('0x3f')](_0xc4e5('0x6a'),util[_0xc4e5('0x35')](_0x3e81b8,{'showHidden':![],'depth':null}));this[_0xc4e5('0x12')]=!![];};VoiceQueueReport[_0xc4e5('0x9')]['syncQueueCallerJoin']=function(_0x371199){try{if(this[_0xc4e5('0x60')](_0x371199)){logger['debug'](_0xc4e5('0x6b'),_0x371199[_0xc4e5('0x44')],util['inspect'](_0x371199,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xc4e5('0xd')][_0x371199[_0xc4e5('0x44')]])){this[_0xc4e5('0xd')][_0x371199[_0xc4e5('0x44')]]=[];this[_0xc4e5('0xf')][_0x371199[_0xc4e5('0x44')]]={};}var _0x4a602e=new QueueReport();_0x4a602e['name']=_0x371199[_0xc4e5('0x61')];_0x4a602e[_0xc4e5('0x47')]=this[_0xc4e5('0x11')][_0x4a602e[_0xc4e5('0x42')]]&&this[_0xc4e5('0x11')][_0x4a602e['name']][_0xc4e5('0x47')]?this[_0xc4e5('0x11')][_0x4a602e[_0xc4e5('0x42')]][_0xc4e5('0x47')]||'inbound':_0xc4e5('0x48');_0x4a602e['queue']=_0x371199[_0xc4e5('0x61')];_0x4a602e[_0xc4e5('0x6c')]=moment()[_0xc4e5('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a602e['position']=_0x371199['position'];_0x4a602e['count']=_0x371199[_0xc4e5('0x6d')];_0x4a602e[_0xc4e5('0x44')]=_0x371199['uniqueid'];logger['info'](_0xc4e5('0x6e'),_0x4a602e[_0xc4e5('0x42')],_0x4a602e['type']);_[_0xc4e5('0x6f')](_0x4a602e,_[_0xc4e5('0x70')](_0x371199,_[_0xc4e5('0x71')](_0x4a602e)));this[_0xc4e5('0xd')][_0x371199[_0xc4e5('0x44')]]['push'](_0x4a602e);this[_0xc4e5('0xf')][_0x371199[_0xc4e5('0x44')]]=_0x4a602e;this[_0xc4e5('0x3e')](_0x4a602e,_0xc4e5('0x18'));}}catch(_0x536a49){logger['error'](_0xc4e5('0x6b'),_0x371199[_0xc4e5('0x44')],util[_0xc4e5('0x35')](_0x536a49,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0xdfcbb0){try{if(this[_0xc4e5('0x60')](_0xdfcbb0)){logger['debug'](_0xc4e5('0x72'),_0xdfcbb0[_0xc4e5('0x44')],util['inspect'](_0xdfcbb0,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xdfcbb0[_0xc4e5('0x44')]]){var _0x213aa7=_[_0xc4e5('0x73')](this[_0xc4e5('0xd')][_0xdfcbb0[_0xc4e5('0x44')]]);_0x213aa7[_0xc4e5('0x74')]=![];_0x213aa7[_0xc4e5('0x75')]=null;_0x213aa7['holdtime']=_0xdfcbb0[_0xc4e5('0x76')];_0x213aa7[_0xc4e5('0x77')]=_0xdfcbb0['originalposition'];_0x213aa7[_0xc4e5('0x78')]=!![];_0x213aa7['queuecallerabandonAt']=moment()[_0xc4e5('0x40')](_0xc4e5('0x79'));_0x213aa7['queuecallerexitreason']=_0xc4e5('0x7a');_0x213aa7[_0xc4e5('0x7b')]=null;logger[_0xc4e5('0x63')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x213aa7['name'],_0x213aa7['type']);this[_0xc4e5('0xf')][_0xdfcbb0[_0xc4e5('0x44')]]=_0x213aa7;this[_0xc4e5('0x3b')](_0x213aa7,'queuecallerabandon');}}}catch(_0x23c577){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0xdfcbb0[_0xc4e5('0x44')],util[_0xc4e5('0x35')](_0x23c577,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x32360d){try{if(this[_0xc4e5('0x60')](_0x32360d)){logger[_0xc4e5('0x3f')](_0xc4e5('0x7c'),_0x32360d[_0xc4e5('0x44')],util['inspect'](_0x32360d,{'showHidden':![],'depth':null}));if(this[_0xc4e5('0xd')][_0x32360d[_0xc4e5('0x44')]]){var _0x424c2d=_[_0xc4e5('0x73')](this[_0xc4e5('0xd')][_0x32360d['uniqueid']]);_0x424c2d[_0xc4e5('0x7d')]=moment()['format'](_0xc4e5('0x79'));_0x424c2d[_0xc4e5('0x7e')]=_0x32360d[_0xc4e5('0x7e')];_0x424c2d[_0xc4e5('0x7f')]=_0x32360d[_0xc4e5('0x7f')];logger[_0xc4e5('0x63')](_0xc4e5('0x80'),_0x424c2d[_0xc4e5('0x42')],_0x424c2d['type'],_0x32360d[_0xc4e5('0x7e')],_0x32360d[_0xc4e5('0x7f')]);this[_0xc4e5('0xf')][_0x32360d[_0xc4e5('0x44')]]=_0x424c2d;this['emitVoiceQueueChannelSave'](_0x424c2d,_0xc4e5('0x1a'));}}}catch(_0x5af6e7){logger[_0xc4e5('0x33')]('[%s][voiceQueueReport][queuecallerleave]',_0x32360d[_0xc4e5('0x44')],util['inspect'](_0x5af6e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4e5('0x9')][_0xc4e5('0x81')]=function(_0x427659){try{if(this[_0xc4e5('0x60')](_0x427659)){logger[_0xc4e5('0x3f')](_0xc4e5('0x82'),_0x427659['uniqueid'],util[_0xc4e5('0x35')](_0x427659,{'showHidden':![],'depth':null}));if(this[_0xc4e5('0xd')][_0x427659[_0xc4e5('0x44')]]){var _0x53b026=_[_0xc4e5('0x73')](this[_0xc4e5('0xd')][_0x427659['uniqueid']]);_0x53b026[_0xc4e5('0x74')]=!![];_0x53b026[_0xc4e5('0x83')]=_0xc4e5('0x84');logger['info'](_0xc4e5('0x85'),_0x53b026[_0xc4e5('0x42')],_0x53b026[_0xc4e5('0x47')]);}}}catch(_0x21cb90){logger[_0xc4e5('0x33')]('[%s][voiceQueueReport][agentconnect]',_0x427659[_0xc4e5('0x44')],util[_0xc4e5('0x35')](_0x21cb90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4e5('0x9')][_0xc4e5('0x1d')]=function(_0x21d928){try{if(this['isNotNull'](_0x21d928)){logger[_0xc4e5('0x3f')](_0xc4e5('0x86'),_0x21d928[_0xc4e5('0x44')],util['inspect'](_0x21d928,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x21d928[_0xc4e5('0x44')]]){var _0x69f8ea=_[_0xc4e5('0x73')](this[_0xc4e5('0xd')][_0x21d928['uniqueid']]);_0x69f8ea['queuecallerabandon']=![];_0x69f8ea[_0xc4e5('0x87')]=null;_0x69f8ea[_0xc4e5('0x88')]=!![];_0x69f8ea[_0xc4e5('0x7b')]=_0x21d928[_0xc4e5('0x89')];_0x69f8ea[_0xc4e5('0x76')]=_0x21d928[_0xc4e5('0x76')];_0x69f8ea[_0xc4e5('0x74')]=!![];_0x69f8ea[_0xc4e5('0x8a')]=![];_0x69f8ea[_0xc4e5('0x8b')]=null;if(!_0x69f8ea[_0xc4e5('0x8c')]){if(_0x21d928[_0xc4e5('0x8d')]=='transfer'){_0x69f8ea[_0xc4e5('0x83')]=_0xc4e5('0x8e');logger['info'](_0xc4e5('0x8f'),_0x69f8ea['name'],_0x69f8ea[_0xc4e5('0x47')]);}else{if(_[_0xc4e5('0x90')](_0x21d928[_0xc4e5('0x30')][_0xc4e5('0x91')](),'local/')){if(this[_0xc4e5('0xd')][_0x21d928['linkedid']]){var _0x49afb1=_[_0xc4e5('0x73')](this[_0xc4e5('0xd')][_0x21d928[_0xc4e5('0x92')]]);_0x49afb1[_0xc4e5('0x74')]=![];_0x49afb1[_0xc4e5('0x8a')]=!![];_0x49afb1[_0xc4e5('0x8b')]=moment(_0x69f8ea[_0xc4e5('0x6c')])[_0xc4e5('0x93')](_0x21d928[_0xc4e5('0x76')],'seconds')[_0xc4e5('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0x49afb1[_0xc4e5('0x83')]=_0xc4e5('0x94');_0x49afb1['transfer']=!![];_0x49afb1[_0xc4e5('0x95')]=_0xc4e5('0x96');_0x49afb1[_0xc4e5('0x97')]=_0x21d928[_0xc4e5('0x98')];_0x49afb1['transferuniqueid']=_0x21d928['uniqueid'];logger['info'](_0xc4e5('0x99'),_0x49afb1['name'],_0x49afb1[_0xc4e5('0x47')]);var _0x2331c0=this['queueReports'][_0x21d928[_0xc4e5('0x92')]];this[_0xc4e5('0xd')][_0x21d928[_0xc4e5('0x92')]]=this['queueReports'][_0x21d928[_0xc4e5('0x44')]];this[_0xc4e5('0xd')][_0x21d928[_0xc4e5('0x44')]]=_0x2331c0;}}else{_0x69f8ea[_0xc4e5('0x83')]=_0xc4e5('0x9a')+_0x21d928['reason'][_0xc4e5('0x9b')]();logger[_0xc4e5('0x63')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x69f8ea[_0xc4e5('0x42')],_0x69f8ea['type'],_0x69f8ea[_0xc4e5('0x83')]);}}}this['channels'][_0x21d928[_0xc4e5('0x44')]]=_0x69f8ea;this['emitVoiceQueueChannelRemove'](_0x69f8ea,'agentcomplete');}}}catch(_0x3a3755){logger[_0xc4e5('0x33')](_0xc4e5('0x86'),_0x21d928[_0xc4e5('0x44')],util[_0xc4e5('0x35')](_0x3a3755,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4e5('0x9')][_0xc4e5('0x9c')]=function(_0x32e745){try{if(this[_0xc4e5('0x60')](_0x32e745)){logger[_0xc4e5('0x3f')](_0xc4e5('0x9d'),_0x32e745[_0xc4e5('0x44')],util[_0xc4e5('0x35')](_0x32e745,{'showHidden':![],'depth':null}));this['addVariable'](_0x32e745[_0xc4e5('0x44')],_[_0xc4e5('0x71')](_0x32e745[_0xc4e5('0x9e')])[0x0],_0x32e745[_0xc4e5('0x9f')]);if(this[_0xc4e5('0xd')][_0x32e745[_0xc4e5('0x44')]]){var _0x204e3f=_['last'](this[_0xc4e5('0xd')][_0x32e745['uniqueid']]);if(_0x204e3f){if(this[_0xc4e5('0x60')](_0x32e745['variable'])&&this[_0xc4e5('0x60')](_0x32e745[_0xc4e5('0x9e')][_0xc4e5('0xa0')])){switch(_0x32e745[_0xc4e5('0x9f')]){case _0xc4e5('0xa1'):_0x204e3f[_0xc4e5('0x8a')]=![];_0x204e3f[_0xc4e5('0x8b')]=null;break;case _0xc4e5('0xa2'):_0x204e3f[_0xc4e5('0xa3')]=_0xc4e5('0xa4');_0x204e3f[_0xc4e5('0x8a')]=!![];_0x204e3f[_0xc4e5('0x8b')]=moment()[_0xc4e5('0x40')](_0xc4e5('0x79'));_0x204e3f['queuecallerleaveAt']=moment()[_0xc4e5('0x40')](_0xc4e5('0x79'));logger['debug'](_0xc4e5('0xa5'),_0x32e745[_0xc4e5('0x44')],util[_0xc4e5('0x35')](_0x204e3f,{'showHidden':![],'depth':null}));ami[_0xc4e5('0x3d')](_0xc4e5('0xa6'),_0x204e3f);break;default:_0x204e3f[_0xc4e5('0x8a')]=!![];_0x204e3f[_0xc4e5('0x8b')]=moment()[_0xc4e5('0x40')](_0xc4e5('0x79'));_0x204e3f[_0xc4e5('0x7d')]=moment()[_0xc4e5('0x40')](_0xc4e5('0x79'));}_0x204e3f[_0xc4e5('0x78')]=![];_0x204e3f[_0xc4e5('0x87')]=null;_0x204e3f['queuecallerexitreason']=_0x32e745[_0xc4e5('0x9f')];this[_0xc4e5('0xf')][_0x32e745[_0xc4e5('0x44')]]=_0x204e3f;this[_0xc4e5('0x3b')](_0x204e3f,_0xc4e5('0x1f'));}else if(this['isNotNull'](_0x32e745[_0xc4e5('0x9e')])&&this['isNotNull'](_0x32e745[_0xc4e5('0x9e')][_0xc4e5('0xa7')])){if(!_0x204e3f['queuecallerabandon']){_0x204e3f[_0xc4e5('0x8a')]=!![];_0x204e3f[_0xc4e5('0x8b')]=moment()[_0xc4e5('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0x204e3f[_0xc4e5('0x83')]=_0xc4e5('0xa8');_0x204e3f[_0xc4e5('0x7d')]=moment()[_0xc4e5('0x40')](_0xc4e5('0x79'));this[_0xc4e5('0xf')][_0x32e745[_0xc4e5('0x44')]]=_0x204e3f;}}logger[_0xc4e5('0x63')](_0xc4e5('0xa9'),_0x32e745[_0xc4e5('0x44')],_0x204e3f[_0xc4e5('0x42')],_0x204e3f[_0xc4e5('0x47')],_[_0xc4e5('0x71')](_0x32e745['variable'])[0x0],_0x32e745[_0xc4e5('0x9f')]);_0x204e3f['variables']=this[_0xc4e5('0x37')][_0x32e745['uniqueid']];}}}}catch(_0x21a1ce){logger[_0xc4e5('0x33')](_0xc4e5('0x9d'),_0x32e745[_0xc4e5('0x44')],util[_0xc4e5('0x35')](_0x21a1ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4e5('0x9')]['addVariable']=function(_0x1cc96d,_0x1d4283,_0x5d50e4){var _0x3bead1=[_0xc4e5('0xaa'),'rtpaudioqosbridged',_0xc4e5('0xab'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xc4e5('0xac'),_0xc4e5('0xad'),_0xc4e5('0xae'),_0xc4e5('0xaf'),_0xc4e5('0xb0'),'bridgepeer',_0xc4e5('0xb1'),_0xc4e5('0xb2'),_0xc4e5('0xb3'),'memberinterface',_0xc4e5('0xb4'),_0xc4e5('0x89'),_0xc4e5('0xb5'),_0xc4e5('0xb6')];if(!_[_0xc4e5('0xb7')](_0x1d4283)&&!_[_0xc4e5('0xb8')](_0x3bead1,_0x1d4283)){if(_[_0xc4e5('0x58')](this['variables'][_0x1cc96d])){this[_0xc4e5('0x37')][_0x1cc96d]={};}this['variables'][_0x1cc96d][_0x1d4283]=_0x5d50e4;}};VoiceQueueReport['prototype'][_0xc4e5('0xb9')]=function(_0x4419a1){try{if(this[_0xc4e5('0x60')](_0x4419a1)){logger[_0xc4e5('0x3f')](_0xc4e5('0xba'),_0x4419a1['uniqueid'],util[_0xc4e5('0x35')](_0x4419a1,{'showHidden':![],'depth':null}));if(this[_0xc4e5('0xd')][_0x4419a1[_0xc4e5('0x44')]]){for(var _0x3079dc=0x0,_0x2bd32e={};_0x3079dc=0x0?moment(_0x5862a2[_0x9c0b('0x1a')])[_0x9c0b('0xe')](_0x5862a2['starttime'],'seconds'):null,'data1':'outbound','data2':_0x5862a2[_0x9c0b('0x14')],'data3':_0x5862a2['exten'],'data4':_0x5862a2[_0x9c0b('0x1b')]||null,'role':'agent','internal':_0x5862a2[_0x9c0b('0x14')]?_[_0x9c0b('0x15')](_0x5862a2[_0x9c0b('0x14')]):undefined,'uniqueid':_0x5862a2[_0x9c0b('0x16')]},'log':_0x9c0b('0x6')});}; \ No newline at end of file +var _0x8991=['outbound','dialstring','agent','moment','lodash','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','interface','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','diff','seconds'];(function(_0x543b33,_0x49be03){var _0x442720=function(_0x567b03){while(--_0x567b03){_0x543b33['push'](_0x543b33['shift']());}};_0x442720(++_0x49be03);}(_0x8991,0x17c));var _0x1899=function(_0x4fcb0f,_0x5e8627){_0x4fcb0f=_0x4fcb0f-0x0;var _0xf9107d=_0x8991[_0x4fcb0f];return _0xf9107d;};'use strict';var moment=require(_0x1899('0x0'));var _=require(_0x1899('0x1'));var util=require('util');var client=require(_0x1899('0x2'));exports['voiceQueueReport']=function(_0x524bc4){var _0x516cbc=_0x524bc4[_0x1899('0x3')]||_0x524bc4[_0x1899('0x4')];return client[_0x1899('0x5')](_0x1899('0x6'),{'body':{'channel':_0x1899('0x7'),'membername':_0x524bc4['lastAssignedTo'],'interface':_['isNil'](_0x524bc4[_0x1899('0x8')])?util['format'](_0x1899('0x9'),_0x524bc4[_0x1899('0xa')]):_0x524bc4[_0x1899('0x8')],'type':_0x1899('0xb'),'enterAt':_0x524bc4[_0x1899('0xc')],'exitAt':_0x516cbc,'duration':moment(_0x516cbc)['diff'](_0x524bc4['queuecallerleaveAt'],'seconds'),'data1':_0x1899('0xd'),'data2':_0x524bc4[_0x1899('0xe')],'data3':_0x524bc4[_0x1899('0xf')],'data4':null,'data5':_0x524bc4[_0x1899('0x10')],'role':'agent','internal':_0x524bc4[_0x1899('0x11')]?_[_0x1899('0x12')](_0x524bc4[_0x1899('0x11')]):undefined,'uniqueid':_0x524bc4[_0x1899('0x13')]},'log':_0x1899('0x6')});};exports[_0x1899('0x14')]=function(_0x1489cf){return client[_0x1899('0x5')](_0x1899('0x6'),{'body':{'channel':'voice','membername':_0x1489cf[_0x1899('0x15')],'interface':_0x1489cf['interface'],'type':_0x1899('0xb'),'enterAt':_0x1489cf[_0x1899('0x16')],'exitAt':_0x1489cf[_0x1899('0x17')],'duration':moment(_0x1489cf['endtime'])[_0x1899('0x18')](_0x1489cf[_0x1899('0x16')],_0x1899('0x19'))>=0x0?moment(_0x1489cf['endtime'])[_0x1899('0x18')](_0x1489cf['starttime'],'seconds'):null,'data1':_0x1899('0x1a'),'data2':_0x1489cf[_0x1899('0x11')],'data3':_0x1489cf[_0x1899('0xf')],'data4':_0x1489cf[_0x1899('0x1b')]||null,'role':_0x1899('0x1c'),'internal':_0x1489cf[_0x1899('0x11')]?_['toNumber'](_0x1489cf[_0x1899('0x11')]):undefined,'uniqueid':_0x1489cf[_0x1899('0x13')]},'log':_0x1899('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 08e400d..5a6b987 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 _0x34b7=['name','html','Request','GetTemplate'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x34b7,0x196));var _0x734b=function(_0x3055ab,_0x4d1f74){_0x3055ab=_0x3055ab-0x0;var _0x31d336=_0x34b7[_0x3055ab];return _0x31d336;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x43a5f1){return function(_0x1aedd0){return client[_0x734b('0x0')](_0x734b('0x1'),{'options':{'raw':!![],'attributes':['id',_0x734b('0x2'),_0x734b('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x823c=['GetTemplate','name','html','../client','Request'];(function(_0x416ca3,_0x22ed17){var _0x894f17=function(_0x4284df){while(--_0x4284df){_0x416ca3['push'](_0x416ca3['shift']());}};_0x894f17(++_0x22ed17);}(_0x823c,0x143));var _0xc823=function(_0x20f186,_0x3ae301){_0x20f186=_0x20f186-0x0;var _0x15a603=_0x823c[_0x20f186];return _0x15a603;};'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 diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e63ca83..d2c40c2 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 _0x0063=['data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','AnyConditions','field','Actions','data3','data4','data5'];(function(_0x207832,_0x2fbd09){var _0x57cfcb=function(_0x53bd96){while(--_0x53bd96){_0x207832['push'](_0x207832['shift']());}};_0x57cfcb(++_0x2fbd09);}(_0x0063,0x1d6));var _0x3006=function(_0x17f6c1,_0x26f300){_0x17f6c1=_0x17f6c1-0x0;var _0x1b7dcb=_0x0063[_0x17f6c1];return _0x1b7dcb;};'use strict';var client=require(_0x3006('0x0'));exports[_0x3006('0x1')]=function(_0x23a799){return function(_0x3d6f92){return client[_0x3006('0x2')](_0x3006('0x3'),{'options':{'raw':![],'attributes':['id',_0x3006('0x4'),_0x3006('0x5'),_0x3006('0x6')],'include':[{'model':_0x3006('0x7'),'as':_0x3006('0x8'),'attributes':['id','field',_0x3006('0x9'),'value']},{'model':_0x3006('0x7'),'as':_0x3006('0xa'),'attributes':['id',_0x3006('0xb'),_0x3006('0x9'),'value']},{'model':'Action','as':_0x3006('0xc'),'attributes':['id','action','data1','data2',_0x3006('0xd'),_0x3006('0xe'),_0x3006('0xf'),_0x3006('0x10'),_0x3006('0x11')]}]},'log':_0x3006('0x3')});};}; \ No newline at end of file +var _0xb805=['data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','status','AllConditions','operator','value','Condition','field','Action','Actions','data2','data3'];(function(_0x4727b7,_0x585a61){var _0xce9394=function(_0x179df4){while(--_0x179df4){_0x4727b7['push'](_0x4727b7['shift']());}};_0xce9394(++_0x585a61);}(_0xb805,0x1b3));var _0x5b80=function(_0x5b154e,_0x32a2f4){_0x5b154e=_0x5b154e-0x0;var _0x5357e6=_0xb805[_0x5b154e];return _0x5357e6;};'use strict';var client=require(_0x5b80('0x0'));exports[_0x5b80('0x1')]=function(_0xbd2239){return function(_0x51f2ca){return client[_0x5b80('0x2')](_0x5b80('0x3'),{'options':{'raw':![],'attributes':['id',_0x5b80('0x4'),'channel',_0x5b80('0x5')],'include':[{'model':'Condition','as':_0x5b80('0x6'),'attributes':['id','field',_0x5b80('0x7'),_0x5b80('0x8')]},{'model':_0x5b80('0x9'),'as':'AnyConditions','attributes':['id',_0x5b80('0xa'),_0x5b80('0x7'),'value']},{'model':_0x5b80('0xb'),'as':_0x5b80('0xc'),'attributes':['id','action','data1',_0x5b80('0xd'),_0x5b80('0xe'),'data4',_0x5b80('0xf'),_0x5b80('0x10'),_0x5b80('0x11')]}]},'log':_0x5b80('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 19e74e3..ff5e83a 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 _0xc9b6=['name','registry','../client','getTrunks','GetTrunk'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0xc9b6,0x6b));var _0x6c9b=function(_0x1b1c43,_0x3e14aa){_0x1b1c43=_0x1b1c43-0x0;var _0x1f199f=_0xc9b6[_0x1b1c43];return _0x1f199f;};'use strict';var client=require(_0x6c9b('0x0'));exports[_0x6c9b('0x1')]=function(_0xb0ba12){return function(_0x39a721){return client['Request'](_0x6c9b('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6c9b('0x3'),_0x6c9b('0x4')]},'log':_0x6c9b('0x2')});};}; \ No newline at end of file +var _0xa7fe=['GetTrunk','getTrunks','Request','name','registry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7fe,0x19b));var _0xea7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7fe[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xea7f('0x0')]=function(_0xa005d9){return function(_0xac7a74){return client[_0xea7f('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xea7f('0x2'),_0xea7f('0x3')]},'log':_0xea7f('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index eb99813..509030b 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 _0x6479=['phone','interface','getTelephones','Request','internal','savePause','PauseUser','saveUnpause','getAgent','email','../client','getAgents','GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5a2682,_0x4215e2){var _0x392e94=function(_0x328625){while(--_0x328625){_0x5a2682['push'](_0x5a2682['shift']());}};_0x392e94(++_0x4215e2);}(_0x6479,0xd0));var _0x9647=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x6479[_0x2dea24];return _0x309d58;};'use strict';var client=require(_0x9647('0x0'));exports[_0x9647('0x1')]=function(){return function(){return client['Request'](_0x9647('0x2'),{'options':{'raw':![],'where':{'role':_0x9647('0x3')},'attributes':['id',_0x9647('0x4'),'email',_0x9647('0x5'),_0x9647('0x6'),_0x9647('0x7'),_0x9647('0x8'),_0x9647('0x9'),_0x9647('0xa'),_0x9647('0xb'),_0x9647('0xc'),'mobile',_0x9647('0xd')]},'log':_0x9647('0x1')});};};exports[_0x9647('0xe')]=function(){return function(){return client[_0x9647('0xf')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9647('0x4'),'accountcode',_0x9647('0x10')]},'log':_0x9647('0xe')});};};exports[_0x9647('0x11')]=function(_0x1231b4,_0x225cff,_0x1bfaaa){return client[_0x9647('0xf')](_0x9647('0x12'),{'body':{'type':_0x225cff,'uniqueid':_0x1bfaaa},'options':{'where':{'id':_0x1231b4['id']}},'log':'savePause'});};exports[_0x9647('0x13')]=function(_0x2aa9ef){return client[_0x9647('0xf')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x2aa9ef['id']}},'log':_0x9647('0x11')});};exports[_0x9647('0x14')]=function(_0x3cf7b8){return client[_0x9647('0xf')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x3cf7b8},'attributes':['id',_0x9647('0x4'),_0x9647('0x15'),_0x9647('0x5'),_0x9647('0x6'),_0x9647('0x7'),'lastLoginAt',_0x9647('0x9'),'lastPauseAt',_0x9647('0xb'),_0x9647('0xd')]},'log':_0x9647('0x14')});}; \ No newline at end of file +var _0xf09d=['PauseUser','saveUnpause','UnpauseUser','ShowUser','agent','Request','GetUser','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','internal','savePause'];(function(_0x4e9c9d,_0x187890){var _0x51ee88=function(_0xc22796){while(--_0xc22796){_0x4e9c9d['push'](_0x4e9c9d['shift']());}};_0x51ee88(++_0x187890);}(_0xf09d,0x123));var _0xdf09=function(_0x15456c,_0x420b80){_0x15456c=_0x15456c-0x0;var _0x51849c=_0xf09d[_0x15456c];return _0x51849c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0xdf09('0x0')](_0xdf09('0x1'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name',_0xdf09('0x2'),_0xdf09('0x3'),_0xdf09('0x4'),_0xdf09('0x5'),_0xdf09('0x6'),_0xdf09('0x7'),_0xdf09('0x8'),_0xdf09('0x9'),_0xdf09('0xa'),_0xdf09('0xb'),_0xdf09('0xc')]},'log':_0xdf09('0xd')});};};exports[_0xdf09('0xe')]=function(){return function(){return client[_0xdf09('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id','name',_0xdf09('0x3'),_0xdf09('0xf')]},'log':_0xdf09('0xe')});};};exports[_0xdf09('0x10')]=function(_0x40ce99,_0x219be1,_0x3f7364){return client['Request'](_0xdf09('0x11'),{'body':{'type':_0x219be1,'uniqueid':_0x3f7364},'options':{'where':{'id':_0x40ce99['id']}},'log':_0xdf09('0x10')});};exports[_0xdf09('0x12')]=function(_0x59f54c){return client['Request'](_0xdf09('0x13'),{'body':{},'options':{'where':{'id':_0x59f54c['id']}},'log':_0xdf09('0x10')});};exports['getAgent']=function(_0x2e744b){return client['Request'](_0xdf09('0x14'),{'options':{'raw':![],'where':{'role':_0xdf09('0x15'),'id':_0x2e744b},'attributes':['id','name',_0xdf09('0x2'),_0xdf09('0x3'),'fullname',_0xdf09('0x5'),_0xdf09('0x6'),'pauseType','lastPauseAt',_0xdf09('0x9'),_0xdf09('0xc')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index e3a8652..a6f3588 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 _0x0601=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0601,0x140));var _0x1060=function(_0x56f0b2,_0xdcf225){_0x56f0b2=_0x56f0b2-0x0;var _0x194f36=_0x0601[_0x56f0b2];return _0x194f36;};'use strict';var client=require('../client');exports[_0x1060('0x0')]=function(_0x594be6){return client[_0x1060('0x1')](_0x1060('0x2'),{'body':_0x594be6,'log':'CreateVoiceAgentReport'});};exports[_0x1060('0x3')]=function(_0x20ae8b,_0x813daf,_0x25f840){return client['Request'](_0x1060('0x4'),{'body':_0x20ae8b,'options':{'where':{'uniqueid':_0x813daf,'interface':_0x25f840,'agentcomplete':!![]}},'log':_0x1060('0x4')});}; \ No newline at end of file +var _0x068e=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x068e,0x18a));var _0xe068=function(_0x4c80a4,_0x389e62){_0x4c80a4=_0x4c80a4-0x0;var _0x451dff=_0x068e[_0x4c80a4];return _0x451dff;};'use strict';var client=require(_0xe068('0x0'));exports[_0xe068('0x1')]=function(_0x39a27d){return client[_0xe068('0x2')]('CreateVoiceAgentReport',{'body':_0x39a27d,'log':_0xe068('0x3')});};exports['update']=function(_0x5f4dd6,_0x546c20,_0x528290){return client[_0xe068('0x2')](_0xe068('0x4'),{'body':_0x5f4dd6,'options':{'where':{'uniqueid':_0x546c20,'interface':_0x528290,'agentcomplete':!![]}},'log':_0xe068('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 942165e..e678307 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 _0xf4d4=['Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','util','lodash','create','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports'];(function(_0x1c78dd,_0x117d6e){var _0x927903=function(_0x464012){while(--_0x464012){_0x1c78dd['push'](_0x1c78dd['shift']());}};_0x927903(++_0x117d6e);}(_0xf4d4,0xbe));var _0x4f4d=function(_0x57d669,_0x4f5751){_0x57d669=_0x57d669-0x0;var _0x3e8cb8=_0xf4d4[_0x57d669];return _0x3e8cb8;};'use strict';var moment=require('moment');var util=require(_0x4f4d('0x0'));var _=require(_0x4f4d('0x1'));var client=require('../client');exports[_0x4f4d('0x2')]=function(_0x1589b5){return client['Request'](_0x4f4d('0x3'),{'body':_['merge'](_0x1589b5,{'source':_0x1589b5[_0x4f4d('0x4')],'destinationcontext':_0x1589b5[_0x4f4d('0x5')],'callerid':_0x1589b5[_0x4f4d('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x4f4d('0x3')});};exports[_0x4f4d('0x7')]=function(){return function(){return client[_0x4f4d('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x4f4d('0x9')],'createdAt':{'$between':[moment()[_0x4f4d('0xa')](_0x4f4d('0xb'))[_0x4f4d('0xc')](_0x4f4d('0xd')),moment()[_0x4f4d('0xe')](_0x4f4d('0xb'))[_0x4f4d('0xc')](_0x4f4d('0xd'))]}},'attributes':[_0x4f4d('0xf'),'disposition',_0x4f4d('0x10'),'billableseconds']},'log':_0x4f4d('0x11')});};}; \ No newline at end of file +var _0x5296=['disposition','duration','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x16272c,_0x31dc26){var _0x48412d=function(_0x97f298){while(--_0x97f298){_0x16272c['push'](_0x16272c['shift']());}};_0x48412d(++_0x31dc26);}(_0x5296,0x17c));var _0x6529=function(_0x56a791,_0x207bc1){_0x56a791=_0x56a791-0x0;var _0x515be7=_0x5296[_0x56a791];return _0x515be7;};'use strict';var moment=require(_0x6529('0x0'));var util=require(_0x6529('0x1'));var _=require(_0x6529('0x2'));var client=require(_0x6529('0x3'));exports[_0x6529('0x4')]=function(_0x55d43d){return client['Request'](_0x6529('0x5'),{'body':_[_0x6529('0x6')](_0x55d43d,{'source':_0x55d43d[_0x6529('0x7')],'destinationcontext':_0x55d43d[_0x6529('0x8')],'callerid':_0x55d43d[_0x6529('0x9')],'amaflags':_0x6529('0xa')}),'log':_0x6529('0x5')});};exports[_0x6529('0xb')]=function(){return function(){return client['Request'](_0x6529('0xc'),{'options':{'where':{'type':[_0x6529('0xd')],'createdAt':{'$between':[moment()[_0x6529('0xe')](_0x6529('0xf'))[_0x6529('0x10')](_0x6529('0x11')),moment()[_0x6529('0x12')](_0x6529('0xf'))[_0x6529('0x10')](_0x6529('0x11'))]}},'attributes':['type',_0x6529('0x13'),_0x6529('0x14'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a6b2f55..0446467 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 _0x502b=['Request','CreateVoiceDialReport','../client'];(function(_0x11fb41,_0x2249ed){var _0x37c53b=function(_0x40d7a7){while(--_0x40d7a7){_0x11fb41['push'](_0x11fb41['shift']());}};_0x37c53b(++_0x2249ed);}(_0x502b,0x113));var _0xb502=function(_0xe775be,_0x4822af){_0xe775be=_0xe775be-0x0;var _0x49e73c=_0x502b[_0xe775be];return _0x49e73c;};'use strict';var client=require(_0xb502('0x0'));exports['create']=function(_0x5037fa){return client[_0xb502('0x1')](_0xb502('0x2'),{'body':_0x5037fa,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x3187=['../client','Request','CreateVoiceDialReport'];(function(_0x3b535b,_0x3a8c40){var _0x172407=function(_0x37bf4a){while(--_0x37bf4a){_0x3b535b['push'](_0x3b535b['shift']());}};_0x172407(++_0x3a8c40);}(_0x3187,0x159));var _0x7318=function(_0x5e563f,_0x47b3ef){_0x5e563f=_0x5e563f-0x0;var _0x2c43c8=_0x3187[_0x5e563f];return _0x2c43c8;};'use strict';var client=require(_0x7318('0x0'));exports['create']=function(_0x15e8cb){return client[_0x7318('0x1')](_0x7318('0x2'),{'body':_0x15e8cb,'log':_0x7318('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e96bf75..e47234f 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 _0x0efe=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0x0efe,0x110));var _0xe0ef=function(_0x3424ba,_0x251691){_0x3424ba=_0x3424ba-0x0;var _0x1f5ccd=_0x0efe[_0x3424ba];return _0x1f5ccd;};'use strict';var client=require(_0xe0ef('0x0'));exports[_0xe0ef('0x1')]=function(){return function(){return client['Request'](_0xe0ef('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe0ef('0x3'),_0xe0ef('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xe0ef('0x1')});};}; \ No newline at end of file +var _0x4b96=['exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x4b96,0x12e));var _0x64b9=function(_0x42bde9,_0x16f120){_0x42bde9=_0x42bde9-0x0;var _0x186a60=_0x4b96[_0x42bde9];return _0x186a60;};'use strict';var client=require(_0x64b9('0x0'));exports[_0x64b9('0x1')]=function(){return function(){return client[_0x64b9('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x64b9('0x3'),_0x64b9('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 647db38..bfc2aa9 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 _0x62df=['dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x62df,0x15f));var _0xf62d=function(_0x27377a,_0x663966){_0x27377a=_0x27377a-0x0;var _0x298b4f=_0x62df[_0x27377a];return _0x298b4f;};'use strict';var client=require(_0xf62d('0x0'));exports[_0xf62d('0x1')]=function(){return function(){return client[_0xf62d('0x2')](_0xf62d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf62d('0x4'),'acwTimeout',_0xf62d('0x5'),_0xf62d('0x6'),_0xf62d('0x7'),_0xf62d('0x8'),_0xf62d('0x9'),_0xf62d('0xa'),_0xf62d('0xb'),_0xf62d('0xc'),_0xf62d('0xd'),_0xf62d('0xe'),_0xf62d('0xf'),_0xf62d('0x10'),_0xf62d('0x11'),_0xf62d('0x12'),_0xf62d('0x13'),_0xf62d('0x14'),_0xf62d('0x15'),'dialCongestionMaxRetry',_0xf62d('0x16'),'dialBusyMaxRetry',_0xf62d('0x17'),'dialNoAnswerMaxRetry',_0xf62d('0x18'),_0xf62d('0x19'),_0xf62d('0x1a'),_0xf62d('0x1b'),_0xf62d('0x1c'),'dialCheckDuplicateType',_0xf62d('0x1d'),_0xf62d('0x1e'),_0xf62d('0x1f'),_0xf62d('0x20'),_0xf62d('0x21'),_0xf62d('0x22'),_0xf62d('0x23'),_0xf62d('0x24'),_0xf62d('0x25'),_0xf62d('0x26'),_0xf62d('0x27'),_0xf62d('0x28'),_0xf62d('0x29'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xf62d('0x2a'),_0xf62d('0x6'),_0xf62d('0x2b'),_0xf62d('0x2c'),'dialCutDigit',_0xf62d('0x2d'),'dialNoSuchNumberRetryFrequency',_0xf62d('0x2e'),_0xf62d('0x2f'),_0xf62d('0x30'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xf62d('0x31'),'dialAgentRejectMaxRetry',_0xf62d('0x32'),_0xf62d('0x33'),_0xf62d('0x34'),_0xf62d('0x35')],'include':[{'model':'Trunk','as':_0xf62d('0x36'),'attributes':['id',_0xf62d('0x37'),_0xf62d('0x38'),_0xf62d('0x39')]},{'model':_0xf62d('0x3a'),'as':_0xf62d('0x3b'),'attributes':['id',_0xf62d('0x37')]},{'model':_0xf62d('0x36'),'as':'TrunkBackup','attributes':['id',_0xf62d('0x37'),'callerid',_0xf62d('0x39')]},{'model':_0xf62d('0x3c'),'as':_0xf62d('0x3c'),'attributes':['id',_0xf62d('0x37')],'include':[{'model':_0xf62d('0x3c'),'as':_0xf62d('0x3d'),'attributes':['id',_0xf62d('0x37'),_0xf62d('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x3648=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x3648,0xc4));var _0x8364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3648[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x8364('0x0')]=function(){return function(){return client[_0x8364('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8364('0x2'),_0x8364('0x3'),_0x8364('0x4'),'autopause',_0x8364('0x5'),_0x8364('0x6'),_0x8364('0x7'),'dialMethod',_0x8364('0x8'),_0x8364('0x9'),_0x8364('0xa'),_0x8364('0xb'),_0x8364('0xc'),_0x8364('0xd'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout',_0x8364('0xe'),_0x8364('0xf'),'dialQueueProject',_0x8364('0x10'),_0x8364('0x11'),_0x8364('0x12'),_0x8364('0x13'),_0x8364('0x14'),_0x8364('0x15'),_0x8364('0x16'),'dialTimezone',_0x8364('0x17'),_0x8364('0x18'),_0x8364('0x19'),_0x8364('0x1a'),'dialAMDInitialSilence',_0x8364('0x1b'),'dialAMDAfterGreetingSilence',_0x8364('0x1c'),_0x8364('0x1d'),'dialAMDBetweenWordsSilence',_0x8364('0x1e'),_0x8364('0x1f'),_0x8364('0x20'),_0x8364('0x21'),_0x8364('0x22'),_0x8364('0x23'),_0x8364('0x24'),_0x8364('0x25'),_0x8364('0x26'),'dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x8364('0x27'),_0x8364('0x28'),'dialDropMaxRetry',_0x8364('0x29'),_0x8364('0x2a'),_0x8364('0x2b'),_0x8364('0x2c'),_0x8364('0x2d'),_0x8364('0x2e'),_0x8364('0x2f'),_0x8364('0x30'),_0x8364('0x31'),_0x8364('0x32')],'include':[{'model':_0x8364('0x33'),'as':'Trunk','attributes':['id',_0x8364('0x2'),_0x8364('0x34'),'active']},{'model':_0x8364('0x35'),'as':_0x8364('0x36'),'attributes':['id',_0x8364('0x2')]},{'model':_0x8364('0x33'),'as':_0x8364('0x37'),'attributes':['id',_0x8364('0x2'),'callerid',_0x8364('0x38')]},{'model':_0x8364('0x39'),'as':'Interval','attributes':['id',_0x8364('0x2')],'include':[{'model':_0x8364('0x39'),'as':_0x8364('0x3a'),'attributes':['id',_0x8364('0x2'),_0x8364('0x3b')]}]}]},'log':_0x8364('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 21bbc33..1407350 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 _0x585f=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','create','Request','CreateVoiceQueueReport'];(function(_0x26cb3f,_0x3bca4d){var _0x5e0db3=function(_0x5160ed){while(--_0x5160ed){_0x26cb3f['push'](_0x26cb3f['shift']());}};_0x5e0db3(++_0x3bca4d);}(_0x585f,0x1f0));var _0xf585=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x585f[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require('moment');var _=require(_0xf585('0x0'));var client=require('../client');exports[_0xf585('0x1')]=function(_0x196e28){return client[_0xf585('0x2')](_0xf585('0x3'),{'body':_0x196e28,'log':_0xf585('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xf585('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xf585('0x4')](_0xf585('0x5'))[_0xf585('0x6')](_0xf585('0x7')),moment()[_0xf585('0x8')](_0xf585('0x5'))['format'](_0xf585('0x7'))]}},'attributes':[_0xf585('0x9'),_0xf585('0xa'),_0xf585('0xb'),_0xf585('0xc'),_0xf585('0xd'),_0xf585('0xe'),_0xf585('0xf'),_0xf585('0x10'),_0xf585('0x11'),_0xf585('0x12')]},'log':_0xf585('0x13')});};}; \ No newline at end of file +var _0x943a=['GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerabandon','queuecallerabandonAt'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x943a,0xfd));var _0xa943=function(_0x4d439b,_0x5b56ae){_0x4d439b=_0x4d439b-0x0;var _0x8931e5=_0x943a[_0x4d439b];return _0x8931e5;};'use strict';var moment=require(_0xa943('0x0'));var _=require(_0xa943('0x1'));var client=require(_0xa943('0x2'));exports[_0xa943('0x3')]=function(_0x249029){return client[_0xa943('0x4')](_0xa943('0x5'),{'body':_0x249029,'log':_0xa943('0x5')});};exports[_0xa943('0x6')]=function(){return function(){return client[_0xa943('0x4')](_0xa943('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xa943('0x8')](_0xa943('0x9'))[_0xa943('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')['format'](_0xa943('0xb'))]}},'attributes':[_0xa943('0xc'),_0xa943('0xd'),_0xa943('0xe'),_0xa943('0xf'),_0xa943('0x10'),'queuecallercompleteAt',_0xa943('0x11'),'queuecallerexitAt',_0xa943('0x12'),_0xa943('0x13')]},'log':_0xa943('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index c8f9f6c..352fd9c 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 _0x8b20=['getVoiceQueueRtPauses','Request'];(function(_0x28c969,_0x55afd5){var _0x4889ed=function(_0x156845){while(--_0x156845){_0x28c969['push'](_0x28c969['shift']());}};_0x4889ed(++_0x55afd5);}(_0x8b20,0xf4));var _0x08b2=function(_0x539a6f,_0x183236){_0x539a6f=_0x539a6f-0x0;var _0x258573=_0x8b20[_0x539a6f];return _0x258573;};'use strict';var client=require('../client');exports[_0x08b2('0x0')]=function(_0x4a6320){return function(){return client[_0x08b2('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4a6320,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x35cd=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x4c3593,_0x4ea381){var _0x1172d1=function(_0x434b93){while(--_0x434b93){_0x4c3593['push'](_0x4c3593['shift']());}};_0x1172d1(++_0x4ea381);}(_0x35cd,0x1ca));var _0xd35c=function(_0x191b2d,_0x15f3d9){_0x191b2d=_0x191b2d-0x0;var _0x364d36=_0x35cd[_0x191b2d];return _0x364d36;};'use strict';var client=require(_0xd35c('0x0'));exports[_0xd35c('0x1')]=function(_0x29c13a){return function(){return client[_0xd35c('0x2')](_0xd35c('0x3'),{'options':{'where':{'VoiceQueueId':_0x29c13a,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3dc8000..912f3d6 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 _0x9bc5=['CreateVoiceRecording','lodash','create','merge'];(function(_0x52706e,_0xd05528){var _0x57846f=function(_0x277b9e){while(--_0x277b9e){_0x52706e['push'](_0x52706e['shift']());}};_0x57846f(++_0xd05528);}(_0x9bc5,0x159));var _0x59bc=function(_0x4f018a,_0x350704){_0x4f018a=_0x4f018a-0x0;var _0x56f3a6=_0x9bc5[_0x4f018a];return _0x56f3a6;};'use strict';var _=require(_0x59bc('0x0'));var client=require('../client');exports[_0x59bc('0x1')]=function(_0x456891){return client['Request']('CreateVoiceRecording',{'body':_[_0x59bc('0x2')](_0x456891,{'value':_0x456891['monitorFilename']}),'log':_0x59bc('0x3')});}; \ No newline at end of file +var _0xb4d5=['../client','create','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x57af61,_0x4e8c18){var _0x22e291=function(_0x1f7ba7){while(--_0x1f7ba7){_0x57af61['push'](_0x57af61['shift']());}};_0x22e291(++_0x4e8c18);}(_0xb4d5,0x143));var _0x5b4d=function(_0x510c9e,_0x4e070f){_0x510c9e=_0x510c9e-0x0;var _0x359092=_0xb4d5[_0x510c9e];return _0x359092;};'use strict';var _=require(_0x5b4d('0x0'));var client=require(_0x5b4d('0x1'));exports[_0x5b4d('0x2')]=function(_0x1afa08){return client['Request'](_0x5b4d('0x3'),{'body':_[_0x5b4d('0x4')](_0x1afa08,{'value':_0x1afa08[_0x5b4d('0x5')]}),'log':_0x5b4d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d34a041..e853012 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 _0xf743=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x2ad36c,_0x4ca14c){var _0x8975bd=function(_0x297293){while(--_0x297293){_0x2ad36c['push'](_0x2ad36c['shift']());}};_0x8975bd(++_0x4ca14c);}(_0xf743,0x79));var _0x3f74=function(_0x25f339,_0x5ae993){_0x25f339=_0x25f339-0x0;var _0x36f502=_0xf743[_0x25f339];return _0x36f502;};'use strict';var client=require(_0x3f74('0x0'));exports[_0x3f74('0x1')]={};exports[_0x3f74('0x2')]=function(_0x77b2b0){return client[_0x3f74('0x3')](_0x3f74('0x4'),{'body':{'result':_0x77b2b0[_0x3f74('0x5')],'transfererchannel':_0x77b2b0['transfererchannel'],'transferercalleridnum':_0x77b2b0['transferercalleridnum'],'transferercalleridname':_0x77b2b0[_0x3f74('0x6')],'transfererconnectedlinenum':_0x77b2b0[_0x3f74('0x7')],'transfererconnectedlinename':_0x77b2b0['transfererconnectedlinename'],'transfereraccountcode':_0x77b2b0[_0x3f74('0x8')],'transferercontext':_0x77b2b0[_0x3f74('0x9')],'transfererexten':_0x77b2b0[_0x3f74('0xa')],'transfererlinkedid':_0x77b2b0['transfererlinkedid'],'transfereechannel':_0x77b2b0['transfereechannel'],'transfereecalleridnum':_0x77b2b0[_0x3f74('0xb')],'transfereecalleridname':_0x77b2b0[_0x3f74('0xc')],'transfereeconnectedlinenum':_0x77b2b0['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x77b2b0['transfereeconnectedlinename'],'transfereeaccountcode':_0x77b2b0[_0x3f74('0xd')],'transfereecontext':_0x77b2b0[_0x3f74('0xe')],'transfereeexten':_0x77b2b0[_0x3f74('0xf')],'transfereelinkedid':_0x77b2b0['transfereelinkedid'],'isexternal':_0x77b2b0[_0x3f74('0x10')],'context':_0x77b2b0[_0x3f74('0x11')],'extension':_0x77b2b0[_0x3f74('0x12')],'type':'blind'},'log':_0x3f74('0x4')});};exports[_0x3f74('0x13')]=function(_0x5020b5){return client[_0x3f74('0x3')](_0x3f74('0x4'),{'body':{'result':_0x5020b5[_0x3f74('0x5')],'transfererchannel':_0x5020b5[_0x3f74('0x14')],'transferercalleridnum':_0x5020b5['origtransferercalleridnum'],'transferercalleridname':_0x5020b5[_0x3f74('0x15')],'transfererconnectedlinenum':_0x5020b5[_0x3f74('0x16')],'transfererconnectedlinename':_0x5020b5[_0x3f74('0x17')],'transfereraccountcode':_0x5020b5['origtransfereraccountcode'],'transferercontext':_0x5020b5[_0x3f74('0x18')],'transfererexten':_0x5020b5[_0x3f74('0x19')],'transfererlinkedid':_0x5020b5[_0x3f74('0x1a')],'transfereechannel':_0x5020b5['transfertargetchannel'],'transfereecalleridnum':_0x5020b5[_0x3f74('0x1b')],'transfereecalleridname':_0x5020b5[_0x3f74('0x1c')],'transfereeconnectedlinenum':_0x5020b5[_0x3f74('0x1d')],'transfereeconnectedlinename':_0x5020b5[_0x3f74('0x1e')],'transfereeaccountcode':_0x5020b5[_0x3f74('0x1f')],'transfereecontext':_0x5020b5['transfertargetcontext'],'transfereeexten':_0x5020b5[_0x3f74('0x20')],'transfereelinkedid':_0x5020b5[_0x3f74('0x21')],'isexternal':_0x5020b5['isexternal'],'context':_0x5020b5[_0x3f74('0x22')],'extension':_0x5020b5[_0x3f74('0x23')],'type':_0x3f74('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x111d=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','Request','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x18d3ab,_0x16a62c){var _0x42972d=function(_0x555a0a){while(--_0x555a0a){_0x18d3ab['push'](_0x18d3ab['shift']());}};_0x42972d(++_0x16a62c);}(_0x111d,0xcd));var _0xd111=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x111d[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0xd111('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x3ed107){return client[_0xd111('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x3ed107[_0xd111('0x2')],'transfererchannel':_0x3ed107[_0xd111('0x3')],'transferercalleridnum':_0x3ed107[_0xd111('0x4')],'transferercalleridname':_0x3ed107['transferercalleridname'],'transfererconnectedlinenum':_0x3ed107[_0xd111('0x5')],'transfererconnectedlinename':_0x3ed107[_0xd111('0x6')],'transfereraccountcode':_0x3ed107[_0xd111('0x7')],'transferercontext':_0x3ed107['transferercontext'],'transfererexten':_0x3ed107[_0xd111('0x8')],'transfererlinkedid':_0x3ed107[_0xd111('0x9')],'transfereechannel':_0x3ed107['transfereechannel'],'transfereecalleridnum':_0x3ed107[_0xd111('0xa')],'transfereecalleridname':_0x3ed107[_0xd111('0xb')],'transfereeconnectedlinenum':_0x3ed107[_0xd111('0xc')],'transfereeconnectedlinename':_0x3ed107['transfereeconnectedlinename'],'transfereeaccountcode':_0x3ed107[_0xd111('0xd')],'transfereecontext':_0x3ed107[_0xd111('0xe')],'transfereeexten':_0x3ed107[_0xd111('0xf')],'transfereelinkedid':_0x3ed107['transfereelinkedid'],'isexternal':_0x3ed107[_0xd111('0x10')],'context':_0x3ed107[_0xd111('0x11')],'extension':_0x3ed107[_0xd111('0x12')],'type':_0xd111('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0xd111('0x14')]=function(_0x359727){return client[_0xd111('0x1')](_0xd111('0x15'),{'body':{'result':_0x359727[_0xd111('0x2')],'transfererchannel':_0x359727[_0xd111('0x16')],'transferercalleridnum':_0x359727[_0xd111('0x17')],'transferercalleridname':_0x359727[_0xd111('0x18')],'transfererconnectedlinenum':_0x359727[_0xd111('0x19')],'transfererconnectedlinename':_0x359727[_0xd111('0x1a')],'transfereraccountcode':_0x359727[_0xd111('0x1b')],'transferercontext':_0x359727[_0xd111('0x1c')],'transfererexten':_0x359727['secondtransfererexten'],'transfererlinkedid':_0x359727['origtransfererlinkedid'],'transfereechannel':_0x359727[_0xd111('0x1d')],'transfereecalleridnum':_0x359727[_0xd111('0x1e')],'transfereecalleridname':_0x359727[_0xd111('0x1f')],'transfereeconnectedlinenum':_0x359727[_0xd111('0x20')],'transfereeconnectedlinename':_0x359727[_0xd111('0x21')],'transfereeaccountcode':_0x359727[_0xd111('0x22')],'transfereecontext':_0x359727[_0xd111('0x23')],'transfereeexten':_0x359727[_0xd111('0x24')],'transfereelinkedid':_0x359727[_0xd111('0x25')],'isexternal':_0x359727['isexternal'],'context':_0x359727[_0xd111('0x26')],'extension':_0x359727[_0xd111('0x27')],'type':'attended'},'log':_0xd111('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b437372..a24790d 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 _0x3384=['../ami','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','message','command','Command','content','catch','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','values','channels','voicechannel','find','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','filename','StopMixMonitor\x20Success','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate'];(function(_0x501a04,_0xacaf19){var _0x69bf75=function(_0x11f5df){while(--_0x11f5df){_0x501a04['push'](_0x501a04['shift']());}};_0x69bf75(++_0xacaf19);}(_0x3384,0x10c));var _0x4338=function(_0x10cd68,_0x5e7125){_0x10cd68=_0x10cd68-0x0;var _0x5894e9=_0x3384[_0x10cd68];return _0x5894e9;};'use strict';var _=require(_0x4338('0x0'));var util=require(_0x4338('0x1'));var jayson=require(_0x4338('0x2'));var schema=require(_0x4338('0x3'));var BPromise=require('bluebird');var moment=require('moment');var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x4338('0x4'));exports[_0x4338('0x5')]=function(_0x780825,_0x17774f,_0x78533c){return new BPromise(function(_0x1c41cd,_0x55d571){var _0x238484={'QueuePause':function(_0x38f38a){return new Promise(function(_0x33ecd3,_0x58986c){var _0xc566cc=util[_0x4338('0x6')]('%s/%s',_0x4338('0x7'),_0x38f38a[_0x4338('0x8')]);if(_0x780825['timers']&&_0x780825[_0x4338('0x9')][_0xc566cc]&&_0x780825['timers'][_0xc566cc][_0x4338('0xa')]){_0x780825[_0x4338('0x9')][_0xc566cc][_0x4338('0xb')]();}if(_0x780825['agents'][_0xc566cc]){_0x780825[_0x4338('0xc')][_0xc566cc][_0x4338('0xd')]({'statePause':_0x38f38a[_0x4338('0xe')]?!![]:![]});}_0x33ecd3({'code':0xc8,'message':_0x4338('0xf')});});},'Reload':function(_0x402f01){var _0x2ba177=this;return new Promise(function(_0x239475,_0x4d83b7){if(ami[_0x4338('0x10')]()==![]){return _0x4d83b7(_0x2ba177[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}_0x402f01=_[_0x4338('0x16')](_0x402f01,_['keys'](properties[_0x4338('0x17')]));_0x402f01[_0x4338('0x18')]=_0x4338('0x19');return ami[_0x4338('0x1a')](_0x402f01)[_0x4338('0x1b')](function(_0x50894b){_0x239475({'code':0xc8,'message':_0x50894b['message']});})['catch'](function(_0x3f57f9){_0x4d83b7(_0x2ba177[_0x4338('0x11')](0x1f5,_0x3f57f9[_0x4338('0x1c')]));});});},'Command':function(_0x598c18){var _0x468d39=this;return new Promise(function(_0x3b3b28,_0x404826){if(ami[_0x4338('0x10')]()==![]){return _0x404826(_0x468d39['error'](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}_0x598c18=_[_0x4338('0x16')](_0x598c18,_0x4338('0x1d'));_0x598c18[_0x4338('0x18')]=_0x4338('0x1e');return ami[_0x4338('0x1a')](_0x598c18)['then'](function(_0x3c0bc6){_0x3b3b28({'code':0xc8,'message':_0x3c0bc6[_0x4338('0x1f')]});})[_0x4338('0x20')](function(_0xf7b008){_0x404826(_0x468d39['error'](0x1f5,_0xf7b008[_0x4338('0x1c')]));});});},'VoiceQueues':function(_0x1ace9c){return new Promise(function(_0x51f36e,_0x2dfe1c){var _0x2b57c4=[];for(var _0x327349 in _0x780825['voiceQueues']){if(_0x780825['voiceQueues'][_0x4338('0x21')](_0x327349)){var _0x4a77b2=_0x780825[_0x4338('0x22')][_0x327349];var _0x2f131f={'id':_0x4a77b2['id'],'name':_0x4a77b2[_0x4338('0x8')],'strategy':_0x4a77b2[_0x4338('0x23')],'answered':_0x4a77b2[_0x4338('0x24')],'available':_0x4a77b2[_0x4338('0x25')],'loggedIn':_0x4a77b2[_0x4338('0x26')],'pTalking':_0x4a77b2[_0x4338('0x27')],'sumBillable':_0x4a77b2['sumBillable'],'sumDuration':_0x4a77b2[_0x4338('0x28')],'sumHoldTime':_0x4a77b2[_0x4338('0x29')]||0x0,'talking':_0x4a77b2[_0x4338('0x2a')],'total':_0x4a77b2[_0x4338('0x2b')],'type':_0x4a77b2[_0x4338('0x2c')],'unmanaged':_0x4a77b2[_0x4338('0x2d')],'abandoned':_0x4a77b2['abandoned'],'waiting':_0x4a77b2[_0x4338('0x2e')],'loggedInDb':_0x4a77b2['loggedInDb']};if(_0x4a77b2[_0x4338('0x2c')]===_0x4338('0x2f')){_0x2f131f[_0x4338('0x30')]=_0x4a77b2[_0x4338('0x30')];_0x2f131f[_0x4338('0x31')]=_0x4a77b2[_0x4338('0x31')];_0x2f131f[_0x4338('0x32')]=_0x4a77b2[_0x4338('0x32')];_0x2f131f[_0x4338('0x33')]=_0x4a77b2[_0x4338('0x33')];_0x2f131f[_0x4338('0x34')]=_0x4a77b2['dialOriginateTimeout'];_0x2f131f[_0x4338('0x35')]=_0x4a77b2[_0x4338('0x35')];_0x2f131f['outboundAnswerAgiCallsDay']=_0x4a77b2[_0x4338('0x36')];_0x2f131f[_0x4338('0x37')]=_0x4a77b2['outboundAnswerCallsDay'];_0x2f131f['outboundBlacklistCallsDay']=_0x4a77b2['outboundBlacklistCallsDay'];_0x2f131f[_0x4338('0x38')]=_0x4a77b2[_0x4338('0x38')];_0x2f131f[_0x4338('0x39')]=_0x4a77b2[_0x4338('0x39')];_0x2f131f[_0x4338('0x3a')]=_0x4a77b2['outboundDropCallsDayACS'];_0x2f131f[_0x4338('0x3b')]=_0x4a77b2[_0x4338('0x3b')];_0x2f131f[_0x4338('0x3c')]=_0x4a77b2[_0x4338('0x3c')];_0x2f131f[_0x4338('0x3d')]=_0x4a77b2[_0x4338('0x3d')];_0x2f131f[_0x4338('0x3e')]=_0x4a77b2[_0x4338('0x3e')];_0x2f131f[_0x4338('0x3f')]=_0x4a77b2[_0x4338('0x3f')];_0x2f131f[_0x4338('0x40')]=_0x4a77b2[_0x4338('0x40')];_0x2f131f[_0x4338('0x41')]=_0x4a77b2[_0x4338('0x41')];_0x2f131f[_0x4338('0x42')]=_0x4a77b2[_0x4338('0x42')];_0x2f131f['predictiveIntervalAnsweredCalls']=_0x4a77b2[_0x4338('0x43')];_0x2f131f['predictiveIntervalAvgHoldtime']=_0x4a77b2[_0x4338('0x44')];_0x2f131f[_0x4338('0x45')]=_0x4a77b2[_0x4338('0x45')];_0x2f131f[_0x4338('0x46')]=_0x4a77b2[_0x4338('0x46')];_0x2f131f['predictiveIntervalDroppedCallsTimeout']=_0x4a77b2['predictiveIntervalDroppedCallsTimeout'];_0x2f131f[_0x4338('0x47')]=_0x4a77b2[_0x4338('0x47')];_0x2f131f[_0x4338('0x48')]=_0x4a77b2[_0x4338('0x48')];_0x2f131f[_0x4338('0x49')]=_0x4a77b2[_0x4338('0x49')];_0x2f131f[_0x4338('0x4a')]=_0x4a77b2[_0x4338('0x4a')];_0x2f131f[_0x4338('0x4b')]=_0x4a77b2[_0x4338('0x4b')];_0x2f131f[_0x4338('0x4c')]=_0x4a77b2[_0x4338('0x4c')];_0x2f131f['predictiveIntervalTotalCalls']=_0x4a77b2['predictiveIntervalTotalCalls'];_0x2f131f['message']=_0x4a77b2[_0x4338('0x1c')];_0x2f131f['originated']=_0x4a77b2[_0x4338('0x4d')];_0x2f131f[_0x4338('0x4e')]=_0x4a77b2[_0x4338('0x4e')];_0x2f131f[_0x4338('0x4f')]=_0x4a77b2[_0x4338('0x4f')];_0x2f131f[_0x4338('0x50')]=_0x4a77b2[_0x4338('0x50')];_0x2f131f['erlangBusyFactor']=_0x4a77b2[_0x4338('0x51')];_0x2f131f[_0x4338('0x52')]=_0x4a77b2['startPredictive'];_0x2f131f[_0x4338('0x53')]=_0x4a77b2['startProgressive'];}if(_0x4a77b2['Trunk']){_0x2f131f[_0x4338('0x54')]={'id':_0x4a77b2[_0x4338('0x54')]['id'],'name':_0x4a77b2[_0x4338('0x54')][_0x4338('0x8')],'active':_0x4a77b2[_0x4338('0x54')]['active'],'callerid':_0x4a77b2['Trunk'][_0x4338('0x55')]};}if(_0x4a77b2[_0x4338('0x56')]){_0x2f131f[_0x4338('0x56')]={'id':_0x4a77b2[_0x4338('0x56')]['id'],'name':_0x4a77b2[_0x4338('0x56')]['name']};}_0x2b57c4[_0x4338('0x57')](_0x2f131f);}}_0x51f36e({'count':_0x2b57c4[_0x4338('0x58')],'rows':_0x2b57c4});});},'VoiceChannels':function(_0x135fd9){return new Promise(function(_0x8d31f1,_0x292ba3){var _0x42bbc1=_[_0x4338('0x59')](_0x780825[_0x4338('0x5a')]);_0x8d31f1({'count':_0x42bbc1['length'],'rows':_0x42bbc1});});},'VoiceChannelMixMonitor':function(_0x375fac){var _0xdb8296=this;return new Promise(function(_0x54fd35,_0x1ce63e){if(ami[_0x4338('0x10')]()==![]){return _0x1ce63e(_0xdb8296[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config['asterisk'][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0x17fd01=schema(properties[_0x4338('0x5b')])[_0x4338('0x3')](_0x375fac);if(_0x17fd01[_0x4338('0x58')]>0x0){return _0x1ce63e(_0xdb8296[_0x4338('0x11')](0x1f4,_['map'](_0x17fd01,_0x4338('0x1c'))[_0x4338('0x15')](',\x20')));}var _0xf973f0=_[_0x4338('0x5c')](_0x780825[_0x4338('0x5a')],{'uniqueid':_0x375fac[_0x4338('0x5d')]});if(_0xf973f0&&_0xf973f0[_0x4338('0x5e')]){var _0x1fa46a=util[_0x4338('0x6')]('%s.%s',_0x375fac['filename']||_0x375fac['uniqueid'],_0x375fac[_0x4338('0x6')]||_0x4338('0x5f'));return ami[_0x4338('0x1a')]({'action':_0x4338('0x60'),'channel':_0xf973f0[_0x4338('0x5e')],'file':_0x1fa46a,'options':_0x4338('0x61')})[_0x4338('0x1b')](function(_0x3222cc){var _0x38d0ac=_[_0x4338('0x5c')](_0xf973f0[_0x4338('0x62')],{'filename':_0x4338('0x63')+_0x1fa46a[_0x4338('0x64')]()});if(_[_0x4338('0x65')](_0x38d0ac)){_0xf973f0['monitors'][_0x4338('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x1fa46a[_0x4338('0x64')](),'createdAt':moment()[_0x4338('0x6')](_0x4338('0x66')),'mixmonitorid':_0x3222cc[_0x4338('0x67')],'status':'rec'});}else{_0x38d0ac[_0x4338('0x67')]=_0x3222cc[_0x4338('0x67')];_0x38d0ac[_0x4338('0x68')]=_0x4338('0x69');}_0x54fd35({'code':0xc8,'message':[_0x375fac['uniqueid'],_0x4338('0x6a'),_0x3222cc[_0x4338('0x67')]][_0x4338('0x15')]('\x20'),'mixmonitorid':_0x3222cc['mixmonitorid']});})[_0x4338('0x20')](function(_0x195ac4){_0x1ce63e(_0xdb8296[_0x4338('0x11')](0x1f5,[_0x375fac[_0x4338('0x5d')],_0x195ac4[_0x4338('0x1c')][_0x4338('0x64')]()][_0x4338('0x15')]('\x20')));});}else{return _0x1ce63e(_0xdb8296['error'](0x1f5,_0x4338('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x382d23){var _0x5b406f=this;return new Promise(function(_0x46c18d,_0x56b3a0){if(ami[_0x4338('0x10')]()==![]){return _0x56b3a0(_0x5b406f[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0xc2b8a0=schema(properties['voicechannel'])[_0x4338('0x3')](_0x382d23);if(_0xc2b8a0['length']>0x0){return _0x56b3a0(_0x5b406f[_0x4338('0x11')](0x1f4,_[_0x4338('0x6c')](_0xc2b8a0,_0x4338('0x1c'))['join'](',\x20')));}var _0x24af69=_['find'](_0x780825['channels'],{'uniqueid':_0x382d23[_0x4338('0x5d')]});if(_0x24af69){return BPromise[_0x4338('0x6d')]()[_0x4338('0x1b')](function(){if(_0x24af69[_0x4338('0x5e')]){return ami[_0x4338('0x1a')]({'action':_0x4338('0x6e'),'channel':_0x24af69['channel'],'mixmonitorid':_0x382d23[_0x4338('0x67')]})[_0x4338('0x20')](function(_0x4f610a){});}})[_0x4338('0x1b')](function(){if(_0x24af69[_0x4338('0x6f')]){return ami[_0x4338('0x1a')]({'action':_0x4338('0x6e'),'channel':_0x24af69[_0x4338('0x6f')],'mixmonitorid':_0x382d23[_0x4338('0x67')]})[_0x4338('0x20')](function(_0x543bca){});}})[_0x4338('0x1b')](function(_0x1449ad){var _0x29f081=_[_0x4338('0x5c')](_0x24af69[_0x4338('0x62')],{'mixmonitorid':_0x382d23[_0x4338('0x67')]});if(_0x29f081){_0x29f081[_0x4338('0x68')]=_0x4338('0x70');}})[_0x4338('0x1b')](function(){var _0x279a02=util[_0x4338('0x6')](_0x4338('0x71'),_0x382d23[_0x4338('0x72')]||_0x382d23[_0x4338('0x5d')],_0x382d23[_0x4338('0x6')]||_0x4338('0x5f'));var _0x3d09c4=_[_0x4338('0x5c')](_0x24af69[_0x4338('0x62')],{'filename':_0x4338('0x63')+_0x279a02[_0x4338('0x64')]()});if(_0x3d09c4){_0x3d09c4[_0x4338('0x68')]=_0x4338('0x70');}})['then'](function(){_0x46c18d({'code':0xc8,'message':[_0x382d23[_0x4338('0x5d')],_0x4338('0x73')][_0x4338('0x15')]('\x20')});})[_0x4338('0x20')](function(_0x3a3a88){_0x56b3a0(_0x5b406f['error'](0x1f5,[_0x382d23[_0x4338('0x5d')],_0x3a3a88[_0x4338('0x1c')][_0x4338('0x64')]()]['join']('\x20')));});}else{return _0x56b3a0(_0x5b406f[_0x4338('0x11')](0x1f5,_0x4338('0x6b')));}});},'VoiceQueuesChannels':function(_0x237e8e){return new Promise(function(_0x50c573,_0x295a76){var _0x34bc87=_[_0x4338('0x59')](_0x780825['queueChannels']);_0x50c573({'count':_0x34bc87[_0x4338('0x58')],'rows':_0x34bc87});});},'VoiceQueuesChannel':function(_0x1c0a44){var _0x1214d9=this;return new Promise(function(_0x6ba716,_0x54b95e){var _0x2a144f=schema(properties['voicequeuechannel'])['validate'](_0x1c0a44);if(_0x2a144f[_0x4338('0x58')]>0x0){return _0x54b95e(_0x1214d9[_0x4338('0x11')](0x1f4,_['map'](_0x2a144f,_0x4338('0x1c'))[_0x4338('0x15')](',\x20')));}var _0x56d1d5=_['find'](_0x780825['queueChannels'],{'uniqueid':_0x1c0a44[_0x4338('0x5d')]});if(_0x56d1d5){_0x6ba716(_0x56d1d5);}else{return _0x54b95e(_0x1214d9[_0x4338('0x11')](0x1f5,_0x4338('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x3458f1){var _0x5eaf1f=this;return new Promise(function(_0x631fc4,_0x3fb37d){if(ami[_0x4338('0x10')]()==![]){return _0x3fb37d(_0x5eaf1f[_0x4338('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0x2d154e=schema(properties['voicequeuechannelhangup'])[_0x4338('0x3')](_0x3458f1);if(_0x2d154e[_0x4338('0x58')]>0x0){return _0x3fb37d(_0x5eaf1f[_0x4338('0x11')](0x1f4,_[_0x4338('0x6c')](_0x2d154e,_0x4338('0x1c'))['join'](',\x20')));}var _0x10512c=_['find'](_0x780825[_0x4338('0x74')],{'uniqueid':_0x3458f1[_0x4338('0x5d')]});if(_0x10512c&&_0x10512c['channel']){return ami[_0x4338('0x1a')]({'action':_0x4338('0x75'),'channel':_0x10512c['channel']})['then'](function(_0x31437a){_0x631fc4({'code':0xc8,'message':[_0x3458f1[_0x4338('0x5d')],_0x31437a['message'][_0x4338('0x64')]()]['join']('\x20')});})[_0x4338('0x20')](function(_0x2c6502){_0x3fb37d(_0x5eaf1f['error'](0x1f5,[_0x3458f1['uniqueid'],_0x2c6502[_0x4338('0x1c')][_0x4338('0x64')]()][_0x4338('0x15')]('\x20')));});}else{return _0x3fb37d(_0x5eaf1f[_0x4338('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x1dd7cf){var _0x135a03=this;return new Promise(function(_0x4ae1af,_0x3e3fdb){if(ami[_0x4338('0x10')]()==![]){return _0x3e3fdb(_0x135a03[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0x1a81ed=schema(properties[_0x4338('0x76')])[_0x4338('0x3')](_0x1dd7cf);if(_0x1a81ed[_0x4338('0x58')]>0x0){return _0x3e3fdb(_0x135a03[_0x4338('0x11')](0x1f4,_[_0x4338('0x6c')](_0x1a81ed,'message')[_0x4338('0x15')](',\x20')));}var _0x142944=_[_0x4338('0x5c')](_0x780825[_0x4338('0x74')],{'uniqueid':_0x1dd7cf['uniqueid']});if(_0x142944&&_0x142944[_0x4338('0x5e')]){return ami[_0x4338('0x1a')]({'action':_0x4338('0x77'),'channel':_0x142944[_0x4338('0x5e')],'exten':_0x1dd7cf[_0x4338('0x78')],'context':_0x1dd7cf[_0x4338('0x79')]||_0x142944['context'],'priority':0x1})[_0x4338('0x1b')](function(_0x161aef){_0x4ae1af({'code':0xc8,'message':[_0x1dd7cf[_0x4338('0x5d')],_0x161aef[_0x4338('0x1c')][_0x4338('0x64')]()]['join']('\x20')});})[_0x4338('0x20')](function(_0x25040d){_0x3e3fdb(_0x135a03[_0x4338('0x11')](0x1f5,[_0x1dd7cf[_0x4338('0x5d')],_0x25040d[_0x4338('0x1c')][_0x4338('0x64')]()][_0x4338('0x15')]('\x20')));});}else{return _0x3e3fdb(_0x135a03['error'](0x1f5,_0x4338('0x6b')));}});},'Agents':function(_0x5f144d){return new Promise(function(_0x4d1ae2,_0x3b2245){var _0x1cd30e=_[_0x4338('0x59')](_0x780825[_0x4338('0xc')]);_0x4d1ae2({'count':_0x1cd30e[_0x4338('0x58')],'rows':_0x1cd30e});});},'Telephones':function(_0x4666cb){return new Promise(function(_0x416902,_0x29d7b2){var _0x2d3d7e=_[_0x4338('0x59')](_0x780825[_0x4338('0x7a')]);_0x416902({'count':_0x2d3d7e['length'],'rows':_0x2d3d7e});});},'Trunks':function(_0x5f3bc8){return new Promise(function(_0x5a17fb,_0x32c034){var _0x492372=_[_0x4338('0x59')](_0x780825[_0x4338('0x7b')]);_0x5a17fb({'count':_0x492372[_0x4338('0x58')],'rows':_0x492372});});},'OutboundChannels':function(_0x46813c){return new Promise(function(_0x4d6eed,_0x1d93ba){var _0x4973c0=_[_0x4338('0x59')](_0x780825[_0x4338('0x7c')]);_0x4d6eed({'count':_0x4973c0[_0x4338('0x58')],'rows':_0x4973c0});});},'Outbound':function(_0x7b8ec){return new Promise(function(_0x3aae04,_0x3a3bf1){_0x3aae04(_0x780825[_0x4338('0x2f')]);});},'Campaigns':function(_0x3e5209){return new Promise(function(_0x1a3ea6,_0x4f715a){var _0x1fc5c4=_['values'](_0x780825[_0x4338('0x7d')]);_0x1a3ea6({'count':_0x1fc5c4[_0x4338('0x58')],'rows':_0x1fc5c4});});},'VoiceQueuesPreview':function(_0x42f8b8){var _0x5dbe65=this;return new Promise(function(_0x2f72c2,_0x3782bd){_0x17774f['run'](_0x42f8b8['id'])['then'](function(_0x100293){_0x2f72c2({'code':0xc8,'message':_0x100293[_0x4338('0x1c')]});})['catch'](function(_0x3e649e){_0x3782bd(_0x5dbe65[_0x4338('0x11')](0x1f4,_0x3e649e['message']));});});},'EventManager':function(_0xb776f6){var _0x3245c7=this;return new Promise(function(_0x5a77a1,_0x1e719c){if(!_0xb776f6[_0x4338('0x7e')]){return _0x1e719c(_0x3245c7[_0x4338('0x11')](0x1f4,_0x4338('0x7f')));}ami['emit'](_0x4338('0x80')+_0xb776f6[_0x4338('0x7e')],_0xb776f6['message']);_0x5a77a1({'code':0xc8,'message':_0xb776f6});});},'FaxAccounts':function(_0x1bd6a9){return new Promise(function(_0x365bf9,_0x928dd2){var _0x25a7a3=_[_0x4338('0x59')](_0x780825['faxAccounts']);_0x365bf9({'count':_0x25a7a3[_0x4338('0x58')],'rows':_0x25a7a3});});},'SendFax':function(_0x2cdef5){var _0x133024=this;return new Promise(function(_0x335bf6,_0x5bf201){_0x78533c['send'](_0x2cdef5)[_0x4338('0x1b')](function(_0x1928f6){_0x335bf6({'code':0xc8,'message':_0x1928f6['message']});})[_0x4338('0x20')](function(_0x2f228c){_0x5bf201(_0x133024[_0x4338('0x11')](0x1f4,_0x2f228c[_0x4338('0x1c')]));});});},'CheckAfterSend':function(_0x1cb3d9){var _0x42f5f3=this;return new Promise(function(_0x2993b0,_0x16dd8f){_0x78533c[_0x4338('0x81')](_0x1cb3d9)[_0x4338('0x1b')](function(_0x53f696){_0x2993b0({'code':0xc8,'message':_0x53f696[_0x4338('0x1c')]});})[_0x4338('0x20')](function(_0x2f0294){_0x16dd8f(_0x42f5f3[_0x4338('0x11')](0x1f4,_0x2f0294[_0x4338('0x1c')]));});});}};var _0x48b19f=jayson[_0x4338('0x82')](_0x238484)[_0x4338('0x83')]();_0x48b19f['on'](_0x4338('0x11'),function(_0x1345cb){return _0x55d571(_0x1345cb);});_0x48b19f[_0x4338('0x5')](0x232a,_0x4338('0x84'),function(){console[_0x4338('0x85')](_0x4338('0x86'),0x232a);return _0x1c41cd(_0x4338('0x87')+0x232a);});});}; \ No newline at end of file +var _0x6f31=['total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','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','Interval','length','values','channels','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','Channel\x20doesn\x27t\x20exist','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','emit','custom:','event','checkAfterSend','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','validate','../../../config/environment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','catch','command','Command','content','message','voiceQueues','hasOwnProperty','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking'];(function(_0x18090f,_0x18ca7f){var _0x416d5b=function(_0x2a817c){while(--_0x2a817c){_0x18090f['push'](_0x18090f['shift']());}};_0x416d5b(++_0x18ca7f);}(_0x6f31,0x168));var _0x16f3=function(_0x1f2034,_0x55e729){_0x1f2034=_0x1f2034-0x0;var _0xb7fa5d=_0x6f31[_0x1f2034];return _0xb7fa5d;};'use strict';var _=require('lodash');var util=require(_0x16f3('0x0'));var jayson=require('jayson/promise');var schema=require(_0x16f3('0x1'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x16f3('0x2'));var properties=require(_0x16f3('0x3'));var ami=require('../ami');exports[_0x16f3('0x4')]=function(_0x488ad1,_0x471f7c,_0x4d9973){return new BPromise(function(_0x3bd206,_0x168d3b){var _0x568ce0={'QueuePause':function(_0x489157){return new Promise(function(_0x340101,_0x468498){var _0x44f7c5=util[_0x16f3('0x5')]('%s/%s',_0x16f3('0x6'),_0x489157[_0x16f3('0x7')]);if(_0x488ad1['timers']&&_0x488ad1[_0x16f3('0x8')][_0x44f7c5]&&_0x488ad1['timers'][_0x44f7c5][_0x16f3('0x9')]){_0x488ad1[_0x16f3('0x8')][_0x44f7c5][_0x16f3('0xa')]();}if(_0x488ad1['agents'][_0x44f7c5]){_0x488ad1[_0x16f3('0xb')][_0x44f7c5][_0x16f3('0xc')]({'statePause':_0x489157['pause']?!![]:![]});}_0x340101({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x286067){var _0x542b0d=this;return new Promise(function(_0x551ffd,_0x40a2cd){if(ami[_0x16f3('0xd')]()==![]){return _0x40a2cd(_0x542b0d[_0x16f3('0xe')](0x1f4,[config[_0x16f3('0xf')]['ip'],config[_0x16f3('0xf')][_0x16f3('0x10')],_0x16f3('0x11')][_0x16f3('0x12')]('\x20')));}_0x286067=_[_0x16f3('0x13')](_0x286067,_['keys'](properties[_0x16f3('0x14')]));_0x286067[_0x16f3('0x15')]=_0x16f3('0x16');return ami[_0x16f3('0x17')](_0x286067)[_0x16f3('0x18')](function(_0x390500){_0x551ffd({'code':0xc8,'message':_0x390500['message']});})[_0x16f3('0x19')](function(_0x3a1cff){_0x40a2cd(_0x542b0d[_0x16f3('0xe')](0x1f5,_0x3a1cff['message']));});});},'Command':function(_0x99f659){var _0x1c0bdc=this;return new Promise(function(_0x318cf1,_0x2799df){if(ami[_0x16f3('0xd')]()==![]){return _0x2799df(_0x1c0bdc[_0x16f3('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x16f3('0xf')][_0x16f3('0x10')],_0x16f3('0x11')][_0x16f3('0x12')]('\x20')));}_0x99f659=_[_0x16f3('0x13')](_0x99f659,_0x16f3('0x1a'));_0x99f659[_0x16f3('0x15')]=_0x16f3('0x1b');return ami[_0x16f3('0x17')](_0x99f659)[_0x16f3('0x18')](function(_0x3ae325){_0x318cf1({'code':0xc8,'message':_0x3ae325[_0x16f3('0x1c')]});})['catch'](function(_0x3b81b5){_0x2799df(_0x1c0bdc[_0x16f3('0xe')](0x1f5,_0x3b81b5[_0x16f3('0x1d')]));});});},'VoiceQueues':function(_0x5ada4d){return new Promise(function(_0x301f68,_0x1627cf){var _0x1b0720=[];for(var _0x3166ec in _0x488ad1['voiceQueues']){if(_0x488ad1[_0x16f3('0x1e')][_0x16f3('0x1f')](_0x3166ec)){var _0x2f2c27=_0x488ad1['voiceQueues'][_0x3166ec];var _0x20f762={'id':_0x2f2c27['id'],'name':_0x2f2c27[_0x16f3('0x7')],'strategy':_0x2f2c27['strategy'],'answered':_0x2f2c27[_0x16f3('0x20')],'available':_0x2f2c27[_0x16f3('0x21')],'loggedIn':_0x2f2c27['loggedIn'],'pTalking':_0x2f2c27[_0x16f3('0x22')],'sumBillable':_0x2f2c27[_0x16f3('0x23')],'sumDuration':_0x2f2c27[_0x16f3('0x24')],'sumHoldTime':_0x2f2c27[_0x16f3('0x25')]||0x0,'talking':_0x2f2c27[_0x16f3('0x26')],'total':_0x2f2c27[_0x16f3('0x27')],'type':_0x2f2c27[_0x16f3('0x28')],'unmanaged':_0x2f2c27[_0x16f3('0x29')],'abandoned':_0x2f2c27[_0x16f3('0x2a')],'waiting':_0x2f2c27[_0x16f3('0x2b')],'loggedInDb':_0x2f2c27['loggedInDb']};if(_0x2f2c27['type']===_0x16f3('0x2c')){_0x20f762[_0x16f3('0x2d')]=_0x2f2c27[_0x16f3('0x2d')];_0x20f762['dialMethod']=_0x2f2c27[_0x16f3('0x2e')];_0x20f762['dialOriginateCallerIdName']=_0x2f2c27[_0x16f3('0x2f')];_0x20f762[_0x16f3('0x30')]=_0x2f2c27['dialOriginateCallerIdNumber'];_0x20f762[_0x16f3('0x31')]=_0x2f2c27['dialOriginateTimeout'];_0x20f762[_0x16f3('0x32')]=_0x2f2c27[_0x16f3('0x32')];_0x20f762['outboundAnswerAgiCallsDay']=_0x2f2c27[_0x16f3('0x33')];_0x20f762[_0x16f3('0x34')]=_0x2f2c27[_0x16f3('0x34')];_0x20f762[_0x16f3('0x35')]=_0x2f2c27['outboundBlacklistCallsDay'];_0x20f762[_0x16f3('0x36')]=_0x2f2c27[_0x16f3('0x36')];_0x20f762[_0x16f3('0x37')]=_0x2f2c27[_0x16f3('0x37')];_0x20f762['outboundDropCallsDayACS']=_0x2f2c27[_0x16f3('0x38')];_0x20f762[_0x16f3('0x39')]=_0x2f2c27['outboundDropCallsDayCallersExit'];_0x20f762[_0x16f3('0x3a')]=_0x2f2c27[_0x16f3('0x3a')];_0x20f762[_0x16f3('0x3b')]=_0x2f2c27['outboundNoAnswerCallsDay'];_0x20f762[_0x16f3('0x3c')]=_0x2f2c27[_0x16f3('0x3c')];_0x20f762[_0x16f3('0x3d')]=_0x2f2c27['outboundOriginateFailureCallsDay'];_0x20f762[_0x16f3('0x3e')]=_0x2f2c27['outboundReCallsDay'];_0x20f762[_0x16f3('0x3f')]=_0x2f2c27[_0x16f3('0x3f')];_0x20f762[_0x16f3('0x40')]=_0x2f2c27['outboundUnknownCallsDay'];_0x20f762[_0x16f3('0x41')]=_0x2f2c27[_0x16f3('0x41')];_0x20f762[_0x16f3('0x42')]=_0x2f2c27[_0x16f3('0x42')];_0x20f762[_0x16f3('0x43')]=_0x2f2c27['predictiveIntervalAvgTalktime'];_0x20f762[_0x16f3('0x44')]=_0x2f2c27[_0x16f3('0x44')];_0x20f762[_0x16f3('0x45')]=_0x2f2c27[_0x16f3('0x45')];_0x20f762['predictiveIntervalErlangCalls']=_0x2f2c27[_0x16f3('0x46')];_0x20f762['predictiveIntervalErlangCallsDroppedCalls']=_0x2f2c27[_0x16f3('0x47')];_0x20f762[_0x16f3('0x48')]=_0x2f2c27[_0x16f3('0x48')];_0x20f762[_0x16f3('0x49')]=_0x2f2c27[_0x16f3('0x49')];_0x20f762[_0x16f3('0x4a')]=_0x2f2c27[_0x16f3('0x4a')];_0x20f762['predictiveIntervalAvailable']=_0x2f2c27['predictiveIntervalAvailable'];_0x20f762[_0x16f3('0x4b')]=_0x2f2c27[_0x16f3('0x4b')];_0x20f762[_0x16f3('0x1d')]=_0x2f2c27[_0x16f3('0x1d')];_0x20f762[_0x16f3('0x4c')]=_0x2f2c27[_0x16f3('0x4c')];_0x20f762[_0x16f3('0x4d')]=_0x2f2c27[_0x16f3('0x4d')];_0x20f762['erlangCallToSecond']=_0x2f2c27[_0x16f3('0x4e')];_0x20f762[_0x16f3('0x4f')]=_0x2f2c27[_0x16f3('0x4f')];_0x20f762[_0x16f3('0x50')]=_0x2f2c27['erlangBusyFactor'];_0x20f762[_0x16f3('0x51')]=_0x2f2c27[_0x16f3('0x51')];_0x20f762[_0x16f3('0x52')]=_0x2f2c27[_0x16f3('0x52')];}if(_0x2f2c27['Trunk']){_0x20f762['Trunk']={'id':_0x2f2c27[_0x16f3('0x53')]['id'],'name':_0x2f2c27[_0x16f3('0x53')][_0x16f3('0x7')],'active':_0x2f2c27[_0x16f3('0x53')][_0x16f3('0x54')],'callerid':_0x2f2c27[_0x16f3('0x53')]['callerid']};}if(_0x2f2c27[_0x16f3('0x55')]){_0x20f762[_0x16f3('0x55')]={'id':_0x2f2c27[_0x16f3('0x55')]['id'],'name':_0x2f2c27['Interval'][_0x16f3('0x7')]};}_0x1b0720['push'](_0x20f762);}}_0x301f68({'count':_0x1b0720[_0x16f3('0x56')],'rows':_0x1b0720});});},'VoiceChannels':function(_0x1e62a9){return new Promise(function(_0xeb56d1,_0x2e5ffd){var _0x34f326=_[_0x16f3('0x57')](_0x488ad1[_0x16f3('0x58')]);_0xeb56d1({'count':_0x34f326['length'],'rows':_0x34f326});});},'VoiceChannelMixMonitor':function(_0x3dd458){var _0xdd31b9=this;return new Promise(function(_0x1a17a6,_0x220789){if(ami[_0x16f3('0xd')]()==![]){return _0x220789(_0xdd31b9[_0x16f3('0xe')](0x1f4,[config[_0x16f3('0xf')]['ip'],config[_0x16f3('0xf')][_0x16f3('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x29d46b=schema(properties[_0x16f3('0x59')])[_0x16f3('0x1')](_0x3dd458);if(_0x29d46b['length']>0x0){return _0x220789(_0xdd31b9[_0x16f3('0xe')](0x1f4,_[_0x16f3('0x5a')](_0x29d46b,'message')['join'](',\x20')));}var _0x1160f5=_[_0x16f3('0x5b')](_0x488ad1[_0x16f3('0x58')],{'uniqueid':_0x3dd458[_0x16f3('0x5c')]});if(_0x1160f5&&_0x1160f5[_0x16f3('0x5d')]){var _0x20be91=util[_0x16f3('0x5')](_0x16f3('0x5e'),_0x3dd458[_0x16f3('0x5f')]||_0x3dd458[_0x16f3('0x5c')],_0x3dd458[_0x16f3('0x5')]||_0x16f3('0x60'));return ami[_0x16f3('0x17')]({'action':'MixMonitor','channel':_0x1160f5[_0x16f3('0x5d')],'file':_0x20be91,'options':_0x16f3('0x61')})[_0x16f3('0x18')](function(_0xb09988){var _0x119eb3=_['find'](_0x1160f5[_0x16f3('0x62')],{'filename':_0x16f3('0x63')+_0x20be91[_0x16f3('0x64')]()});if(_[_0x16f3('0x65')](_0x119eb3)){_0x1160f5['monitors'][_0x16f3('0x66')]({'filename':_0x16f3('0x63')+_0x20be91[_0x16f3('0x64')](),'createdAt':moment()[_0x16f3('0x5')](_0x16f3('0x67')),'mixmonitorid':_0xb09988[_0x16f3('0x68')],'status':'rec'});}else{_0x119eb3[_0x16f3('0x68')]=_0xb09988[_0x16f3('0x68')];_0x119eb3[_0x16f3('0x69')]=_0x16f3('0x6a');}_0x1a17a6({'code':0xc8,'message':[_0x3dd458['uniqueid'],_0x16f3('0x6b'),_0xb09988[_0x16f3('0x68')]][_0x16f3('0x12')]('\x20'),'mixmonitorid':_0xb09988[_0x16f3('0x68')]});})[_0x16f3('0x19')](function(_0x401315){_0x220789(_0xdd31b9[_0x16f3('0xe')](0x1f5,[_0x3dd458['uniqueid'],_0x401315['message']['toLowerCase']()][_0x16f3('0x12')]('\x20')));});}else{return _0x220789(_0xdd31b9[_0x16f3('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4aad9a){var _0x22c4e8=this;return new Promise(function(_0x694d94,_0x302895){if(ami['isConnected']()==![]){return _0x302895(_0x22c4e8['error'](0x1f4,[config[_0x16f3('0xf')]['ip'],config[_0x16f3('0xf')][_0x16f3('0x10')],_0x16f3('0x11')]['join']('\x20')));}var _0x5ae5d7=schema(properties[_0x16f3('0x59')])[_0x16f3('0x1')](_0x4aad9a);if(_0x5ae5d7[_0x16f3('0x56')]>0x0){return _0x302895(_0x22c4e8[_0x16f3('0xe')](0x1f4,_[_0x16f3('0x5a')](_0x5ae5d7,_0x16f3('0x1d'))['join'](',\x20')));}var _0x5dd380=_['find'](_0x488ad1[_0x16f3('0x58')],{'uniqueid':_0x4aad9a[_0x16f3('0x5c')]});if(_0x5dd380){return BPromise[_0x16f3('0x6c')]()[_0x16f3('0x18')](function(){if(_0x5dd380[_0x16f3('0x5d')]){return ami[_0x16f3('0x17')]({'action':_0x16f3('0x6d'),'channel':_0x5dd380[_0x16f3('0x5d')],'mixmonitorid':_0x4aad9a[_0x16f3('0x68')]})['catch'](function(_0x1529af){});}})[_0x16f3('0x18')](function(){if(_0x5dd380[_0x16f3('0x6e')]){return ami[_0x16f3('0x17')]({'action':_0x16f3('0x6d'),'channel':_0x5dd380[_0x16f3('0x6e')],'mixmonitorid':_0x4aad9a['mixmonitorid']})['catch'](function(_0x4029d6){});}})[_0x16f3('0x18')](function(_0x5d7be1){var _0x43924a=_[_0x16f3('0x5b')](_0x5dd380['monitors'],{'mixmonitorid':_0x4aad9a[_0x16f3('0x68')]});if(_0x43924a){_0x43924a['status']=_0x16f3('0x6f');}})[_0x16f3('0x18')](function(){var _0xb4d8c1=util[_0x16f3('0x5')]('%s.%s',_0x4aad9a[_0x16f3('0x5f')]||_0x4aad9a['uniqueid'],_0x4aad9a[_0x16f3('0x5')]||'wav');var _0x18575e=_[_0x16f3('0x5b')](_0x5dd380[_0x16f3('0x62')],{'filename':'/var/spool/asterisk/monitor/'+_0xb4d8c1[_0x16f3('0x64')]()});if(_0x18575e){_0x18575e[_0x16f3('0x69')]=_0x16f3('0x6f');}})[_0x16f3('0x18')](function(){_0x694d94({'code':0xc8,'message':[_0x4aad9a[_0x16f3('0x5c')],'StopMixMonitor\x20Success'][_0x16f3('0x12')]('\x20')});})[_0x16f3('0x19')](function(_0x4a2914){_0x302895(_0x22c4e8['error'](0x1f5,[_0x4aad9a[_0x16f3('0x5c')],_0x4a2914[_0x16f3('0x1d')][_0x16f3('0x64')]()]['join']('\x20')));});}else{return _0x302895(_0x22c4e8[_0x16f3('0xe')](0x1f5,_0x16f3('0x70')));}});},'VoiceQueuesChannels':function(_0x3a1623){return new Promise(function(_0x279e53,_0x55c99a){var _0x240ba9=_[_0x16f3('0x57')](_0x488ad1['queueChannels']);_0x279e53({'count':_0x240ba9[_0x16f3('0x56')],'rows':_0x240ba9});});},'VoiceQueuesChannel':function(_0x236cf7){var _0x3d1d8f=this;return new Promise(function(_0x3853a2,_0x15c390){var _0x2bfe56=schema(properties[_0x16f3('0x71')])[_0x16f3('0x1')](_0x236cf7);if(_0x2bfe56[_0x16f3('0x56')]>0x0){return _0x15c390(_0x3d1d8f['error'](0x1f4,_[_0x16f3('0x5a')](_0x2bfe56,_0x16f3('0x1d'))[_0x16f3('0x12')](',\x20')));}var _0x4519d0=_[_0x16f3('0x5b')](_0x488ad1['queueChannels'],{'uniqueid':_0x236cf7[_0x16f3('0x5c')]});if(_0x4519d0){_0x3853a2(_0x4519d0);}else{return _0x15c390(_0x3d1d8f['error'](0x1f5,_0x16f3('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x5aae4e){var _0x3e96ff=this;return new Promise(function(_0x3c7967,_0xc1a1fc){if(ami[_0x16f3('0xd')]()==![]){return _0xc1a1fc(_0x3e96ff[_0x16f3('0xe')](0x1f4,[config[_0x16f3('0xf')]['ip'],config[_0x16f3('0xf')][_0x16f3('0x10')],_0x16f3('0x11')][_0x16f3('0x12')]('\x20')));}var _0x12dd98=schema(properties[_0x16f3('0x72')])[_0x16f3('0x1')](_0x5aae4e);if(_0x12dd98[_0x16f3('0x56')]>0x0){return _0xc1a1fc(_0x3e96ff[_0x16f3('0xe')](0x1f4,_['map'](_0x12dd98,_0x16f3('0x1d'))[_0x16f3('0x12')](',\x20')));}var _0x2da0ec=_[_0x16f3('0x5b')](_0x488ad1[_0x16f3('0x73')],{'uniqueid':_0x5aae4e[_0x16f3('0x5c')]});if(_0x2da0ec&&_0x2da0ec[_0x16f3('0x5d')]){return ami[_0x16f3('0x17')]({'action':_0x16f3('0x74'),'channel':_0x2da0ec[_0x16f3('0x5d')]})[_0x16f3('0x18')](function(_0x475495){_0x3c7967({'code':0xc8,'message':[_0x5aae4e[_0x16f3('0x5c')],_0x475495[_0x16f3('0x1d')][_0x16f3('0x64')]()][_0x16f3('0x12')]('\x20')});})['catch'](function(_0x385bbc){_0xc1a1fc(_0x3e96ff[_0x16f3('0xe')](0x1f5,[_0x5aae4e[_0x16f3('0x5c')],_0x385bbc['message'][_0x16f3('0x64')]()][_0x16f3('0x12')]('\x20')));});}else{return _0xc1a1fc(_0x3e96ff[_0x16f3('0xe')](0x1f5,_0x16f3('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x3eaee5){var _0x27f74b=this;return new Promise(function(_0x5d75cd,_0x171bdb){if(ami[_0x16f3('0xd')]()==![]){return _0x171bdb(_0x27f74b[_0x16f3('0xe')](0x1f4,[config[_0x16f3('0xf')]['ip'],config[_0x16f3('0xf')][_0x16f3('0x10')],_0x16f3('0x11')][_0x16f3('0x12')]('\x20')));}var _0x5c7997=schema(properties[_0x16f3('0x75')])[_0x16f3('0x1')](_0x3eaee5);if(_0x5c7997[_0x16f3('0x56')]>0x0){return _0x171bdb(_0x27f74b[_0x16f3('0xe')](0x1f4,_[_0x16f3('0x5a')](_0x5c7997,_0x16f3('0x1d'))[_0x16f3('0x12')](',\x20')));}var _0x25e0f2=_[_0x16f3('0x5b')](_0x488ad1['queueChannels'],{'uniqueid':_0x3eaee5['uniqueid']});if(_0x25e0f2&&_0x25e0f2[_0x16f3('0x5d')]){return ami[_0x16f3('0x17')]({'action':_0x16f3('0x76'),'channel':_0x25e0f2['channel'],'exten':_0x3eaee5[_0x16f3('0x77')],'context':_0x3eaee5[_0x16f3('0x78')]||_0x25e0f2['context'],'priority':0x1})['then'](function(_0x4d3b94){_0x5d75cd({'code':0xc8,'message':[_0x3eaee5['uniqueid'],_0x4d3b94[_0x16f3('0x1d')][_0x16f3('0x64')]()][_0x16f3('0x12')]('\x20')});})[_0x16f3('0x19')](function(_0x37e763){_0x171bdb(_0x27f74b[_0x16f3('0xe')](0x1f5,[_0x3eaee5[_0x16f3('0x5c')],_0x37e763[_0x16f3('0x1d')][_0x16f3('0x64')]()]['join']('\x20')));});}else{return _0x171bdb(_0x27f74b[_0x16f3('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x560af5){return new Promise(function(_0x18f817,_0x106971){var _0xf3b861=_[_0x16f3('0x57')](_0x488ad1['agents']);_0x18f817({'count':_0xf3b861[_0x16f3('0x56')],'rows':_0xf3b861});});},'Telephones':function(_0x336867){return new Promise(function(_0x121235,_0xd6d48f){var _0x520d09=_['values'](_0x488ad1['telephones']);_0x121235({'count':_0x520d09[_0x16f3('0x56')],'rows':_0x520d09});});},'Trunks':function(_0x593518){return new Promise(function(_0x5f0d29,_0x52b2f2){var _0x3b0d21=_[_0x16f3('0x57')](_0x488ad1[_0x16f3('0x79')]);_0x5f0d29({'count':_0x3b0d21[_0x16f3('0x56')],'rows':_0x3b0d21});});},'OutboundChannels':function(_0x98b821){return new Promise(function(_0x4b514f,_0x2c30ff){var _0x32a9c8=_[_0x16f3('0x57')](_0x488ad1[_0x16f3('0x7a')]);_0x4b514f({'count':_0x32a9c8[_0x16f3('0x56')],'rows':_0x32a9c8});});},'Outbound':function(_0x4097df){return new Promise(function(_0x5953df,_0x44e40e){_0x5953df(_0x488ad1['outbound']);});},'Campaigns':function(_0x48b626){return new Promise(function(_0x18ba28,_0x12ff6f){var _0x54e035=_[_0x16f3('0x57')](_0x488ad1[_0x16f3('0x7b')]);_0x18ba28({'count':_0x54e035['length'],'rows':_0x54e035});});},'VoiceQueuesPreview':function(_0x1d45e7){var _0x592839=this;return new Promise(function(_0x3878f0,_0xd2434a){_0x471f7c[_0x16f3('0x7c')](_0x1d45e7['id'])['then'](function(_0x12813b){_0x3878f0({'code':0xc8,'message':_0x12813b[_0x16f3('0x1d')]});})[_0x16f3('0x19')](function(_0x4ba17c){_0xd2434a(_0x592839['error'](0x1f4,_0x4ba17c[_0x16f3('0x1d')]));});});},'EventManager':function(_0x17f521){var _0x10e5f8=this;return new Promise(function(_0x547d47,_0x482608){if(!_0x17f521['event']){return _0x482608(_0x10e5f8['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x16f3('0x7d')](_0x16f3('0x7e')+_0x17f521[_0x16f3('0x7f')],_0x17f521[_0x16f3('0x1d')]);_0x547d47({'code':0xc8,'message':_0x17f521});});},'FaxAccounts':function(_0x2ec057){return new Promise(function(_0x3de667,_0x272a70){var _0x47969c=_[_0x16f3('0x57')](_0x488ad1['faxAccounts']);_0x3de667({'count':_0x47969c[_0x16f3('0x56')],'rows':_0x47969c});});},'SendFax':function(_0x53ba52){var _0x38bb88=this;return new Promise(function(_0x3d972a,_0x31da73){_0x4d9973['send'](_0x53ba52)[_0x16f3('0x18')](function(_0x31fa5){_0x3d972a({'code':0xc8,'message':_0x31fa5['message']});})[_0x16f3('0x19')](function(_0xfc7ecc){_0x31da73(_0x38bb88[_0x16f3('0xe')](0x1f4,_0xfc7ecc[_0x16f3('0x1d')]));});});},'CheckAfterSend':function(_0x36c533){var _0x42a18e=this;return new Promise(function(_0x12e99f,_0x18c745){_0x4d9973[_0x16f3('0x80')](_0x36c533)[_0x16f3('0x18')](function(_0x2bcfa1){_0x12e99f({'code':0xc8,'message':_0x2bcfa1[_0x16f3('0x1d')]});})[_0x16f3('0x19')](function(_0x12ee75){_0x18c745(_0x42a18e[_0x16f3('0xe')](0x1f4,_0x12ee75[_0x16f3('0x1d')]));});});}};var _0x29e80a=jayson[_0x16f3('0x81')](_0x568ce0)[_0x16f3('0x82')]();_0x29e80a['on'](_0x16f3('0xe'),function(_0x5669c1){return _0x168d3b(_0x5669c1);});_0x29e80a['listen'](0x232a,'127.0.0.1',function(){console['log'](_0x16f3('0x83'),0x232a);return _0x3bd206(_0x16f3('0x84')+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 5ca5afe..473d51a 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 _0x5427=['[CM][%s][%s]','exec','data1','xmd-contactid','ListId','data3','$or','map','routeId','destcalleridnum','firstName','phone','mobile','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','info'];(function(_0x4a86a0,_0xefcfc2){var _0x500eb0=function(_0x3415db){while(--_0x3415db){_0x4a86a0['push'](_0x4a86a0['shift']());}};_0x500eb0(++_0xefcfc2);}(_0x5427,0xbf));var _0x7542=function(_0x3c30be,_0x3a44df){_0x3c30be=_0x3c30be-0x0;var _0x241da5=_0x5427[_0x3c30be];return _0x241da5;};'use strict';var _=require('lodash');var BPromise=require(_0x7542('0x0'));var Redis=require(_0x7542('0x1'));var util=require('util');var config=require(_0x7542('0x2'));var logger=require(_0x7542('0x3'))('trigger');var cmContactRpc=require(_0x7542('0x4'));config[_0x7542('0x5')]=_[_0x7542('0x6')](config[_0x7542('0x5')],{'host':_0x7542('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7542('0x5')]));function emit(_0x52c496,_0x45588e,_0x7f1d24,_0x5785f8,_0x38f9a5){logger[_0x7542('0x8')](_0x7542('0x9'),_0x52c496,_0x45588e['id'],_0x7f1d24,_0x5785f8,JSON['stringify'](_0x38f9a5));io['to'](_0x7f1d24)['emit'](_0x5785f8,_0x38f9a5);}exports[_0x7542('0xa')]=function(_0x31cbfc,_0x3a4573,_0x3fa570,_0x1f60fc){var _0x40d882,_0x38f445;var _0x14f657={};var _0x3dab2a=Number(_0x3fa570[_0x7542('0xb')]);var _0x189eaf=_0x3fa570['data2']?Boolean(Number(_0x3fa570['data2'])):![];var _0x1f3e51;if(_0x1f60fc[_0x7542('0xc')]){_0x14f657['id']=_0x1f60fc[_0x7542('0xc')];}if(!_0x14f657['id']){_0x14f657[_0x7542('0xd')]=_0x3dab2a;_0x1f3e51=_0x3fa570[_0x7542('0xe')]&&_0x3fa570[_0x7542('0xe')]!=='0'?_0x3fa570[_0x7542('0xe')]['split'](','):['phone'];_0x14f657[_0x7542('0xf')]=_[_0x7542('0x10')](_0x1f3e51,function(_0x1dc0e4){var _0x798e20={};_0x798e20[_0x1dc0e4]=_0x1f60fc[_0x7542('0x11')]?_0x1f60fc[_0x7542('0x12')]:_0x1f60fc['calleridnum'];return _0x798e20;});}var _0x52dd78=['id',_0x7542('0x13'),'lastName',_0x7542('0x14'),_0x7542('0x15'),'fax',_0x7542('0xd'),'createdAt','scheduledAt',_0x7542('0x16')];var _0x48f4d9=_[_0x7542('0x17')](_0x52dd78,_0x1f3e51);BPromise[_0x7542('0x18')]()[_0x7542('0x19')](cmContactRpc['getContacts']({'attributes':_0x48f4d9,'where':_0x14f657}))[_0x7542('0x19')](function(_0x5c4400){_0x38f445=_0x5c4400;if(!_[_0x7542('0x1a')](_0x38f445)){if(_0x38f445[_0x7542('0x1b')]===0x1){_0x40d882=_0x38f445[0x0];logger[_0x7542('0x8')](_0x7542('0x1c'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id'],_0x40d882['id']);}else{logger[_0x7542('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id'],_[_0x7542('0x10')](_0x38f445,'id')[_0x7542('0x1e')](','));}return;}else{logger[_0x7542('0x8')](_0x7542('0x1f'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id']);var _0x1dcc2e={'ListId':_0x3dab2a};var _0x2958da=_0x3fa570[_0x7542('0x20')]&&_0x3fa570[_0x7542('0x20')]!=='0'?_0x3fa570[_0x7542('0x20')]:_0x7542('0x14');if(_0x189eaf){logger[_0x7542('0x8')](_0x7542('0x21'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id']);_0x1dcc2e[_0x2958da]=_[_0x7542('0x22')](_0x1f60fc['routeId'])?_0x1f60fc[_0x7542('0x23')]:_0x1f60fc[_0x7542('0x12')];if(_[_0x7542('0x22')](_0x1f60fc[_0x7542('0x11')])){_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x24')]&&_0x1f60fc[_0x7542('0x24')]!==_0x7542('0x25')?_0x1f60fc['calleridname']:_0x7542('0x26');}else{_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x27')]&&_0x1f60fc[_0x7542('0x27')]!==_0x7542('0x25')?_0x1f60fc[_0x7542('0x27')]:_0x7542('0x26');}return BPromise['resolve']()[_0x7542('0x19')](cmContactRpc[_0x7542('0x28')](_0x1dcc2e))[_0x7542('0x19')](function(_0x277cc0){_0x40d882=_0x277cc0;_0x38f445[_0x7542('0x29')](_0x277cc0);if(_0x40d882){logger[_0x7542('0x8')](_0x7542('0x2a'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id'],_0x40d882['id']);}return;});}else{logger[_0x7542('0x8')](_0x7542('0x2b'),_0x1f60fc['uniqueid'],_0x3a4573['id']);_0x1dcc2e[_0x2958da]=_[_0x7542('0x22')](_0x1f60fc[_0x7542('0x11')])?_0x1f60fc['calleridnum']:_0x1f60fc[_0x7542('0x12')];if(_[_0x7542('0x22')](_0x1f60fc[_0x7542('0x11')])){_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x24')]&&_0x1f60fc[_0x7542('0x24')]!==_0x7542('0x25')?_0x1f60fc[_0x7542('0x24')]:'Unknown';}else{_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x27')]&&_0x1f60fc['destcalleridname']!==_0x7542('0x25')?_0x1f60fc['destcalleridname']:_0x7542('0x26');}_0x40d882=_0x1dcc2e;_0x38f445[_0x7542('0x29')](_0x1dcc2e);return;}}})[_0x7542('0x19')](function(){if(_0x31cbfc){emit(_0x1f60fc[_0x7542('0x1d')],_0x3a4573,util['format']('user:%s',_0x31cbfc[_0x7542('0x2c')]),util[_0x7542('0x2d')](_0x7542('0x2e'),_0x3fa570[_0x7542('0x2f')][_0x7542('0x30')]()),{'evt':_[_0x7542('0x31')](_0x1f60fc,{'autoCreate':_0x189eaf}),'contact':_0x40d882===undefined?{}:_0x40d882,'contacts':_0x38f445[_0x7542('0x1b')]===0x0?undefined:_0x38f445});}});}; \ No newline at end of file +var _0x95c5=['defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','fax','resolve','then','getContacts','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis'];(function(_0x2bf4db,_0x137b0e){var _0x5a648d=function(_0x1d18cb){while(--_0x1d18cb){_0x2bf4db['push'](_0x2bf4db['shift']());}};_0x5a648d(++_0x137b0e);}(_0x95c5,0x1de));var _0x595c=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x95c5[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x595c('0x0'));var BPromise=require(_0x595c('0x1'));var Redis=require(_0x595c('0x2'));var util=require(_0x595c('0x3'));var config=require(_0x595c('0x4'));var logger=require(_0x595c('0x5'))(_0x595c('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x595c('0x7')]=_[_0x595c('0x8')](config[_0x595c('0x7')],{'host':_0x595c('0x9'),'port':0x18eb});var io=require(_0x595c('0xa'))(new Redis(config[_0x595c('0x7')]));function emit(_0xf607c7,_0x19a2c6,_0x57cdb6,_0x2ac510,_0x1e2e32){logger['info'](_0x595c('0xb'),_0xf607c7,_0x19a2c6['id'],_0x57cdb6,_0x2ac510,JSON[_0x595c('0xc')](_0x1e2e32));io['to'](_0x57cdb6)[_0x595c('0xd')](_0x2ac510,_0x1e2e32);}exports[_0x595c('0xe')]=function(_0xdbd1cd,_0x20f666,_0x3235b2,_0x46e4a9){var _0x1fd9af,_0x2ef08f;var _0x305a64={};var _0x43b40b=Number(_0x3235b2[_0x595c('0xf')]);var _0x485a28=_0x3235b2[_0x595c('0x10')]?Boolean(Number(_0x3235b2[_0x595c('0x10')])):![];var _0x482a8b;if(_0x46e4a9[_0x595c('0x11')]){_0x305a64['id']=_0x46e4a9[_0x595c('0x11')];}if(!_0x305a64['id']){_0x305a64[_0x595c('0x12')]=_0x43b40b;_0x482a8b=_0x3235b2[_0x595c('0x13')]&&_0x3235b2[_0x595c('0x13')]!=='0'?_0x3235b2[_0x595c('0x13')][_0x595c('0x14')](','):[_0x595c('0x15')];_0x305a64[_0x595c('0x16')]=_[_0x595c('0x17')](_0x482a8b,function(_0x1c2c1f){var _0x106144={};_0x106144[_0x1c2c1f]=_0x46e4a9['routeId']?_0x46e4a9[_0x595c('0x18')]:_0x46e4a9[_0x595c('0x19')];return _0x106144;});}var _0x511ad2=['id',_0x595c('0x1a'),'lastName',_0x595c('0x15'),'mobile',_0x595c('0x1b'),_0x595c('0x12'),'createdAt','scheduledAt','updatedAt'];var _0x5e95df=_['union'](_0x511ad2,_0x482a8b);BPromise[_0x595c('0x1c')]()[_0x595c('0x1d')](cmContactRpc[_0x595c('0x1e')]({'attributes':_0x5e95df,'where':_0x305a64}))[_0x595c('0x1d')](function(_0x28727e){_0x2ef08f=_0x28727e;if(!_[_0x595c('0x1f')](_0x2ef08f)){if(_0x2ef08f['length']===0x1){_0x1fd9af=_0x2ef08f[0x0];logger[_0x595c('0x20')](_0x595c('0x21'),_0x46e4a9[_0x595c('0x22')],_0x20f666['id'],_0x1fd9af['id']);}else{logger[_0x595c('0x20')](_0x595c('0x23'),_0x46e4a9[_0x595c('0x22')],_0x20f666['id'],_[_0x595c('0x17')](_0x2ef08f,'id')['join'](','));}return;}else{logger[_0x595c('0x20')](_0x595c('0x24'),_0x46e4a9['uniqueid'],_0x20f666['id']);var _0x31a003={'ListId':_0x43b40b};var _0x1c622c=_0x3235b2[_0x595c('0x25')]&&_0x3235b2[_0x595c('0x25')]!=='0'?_0x3235b2[_0x595c('0x25')]:_0x595c('0x15');if(_0x485a28){logger[_0x595c('0x20')](_0x595c('0x26'),_0x46e4a9[_0x595c('0x22')],_0x20f666['id']);_0x31a003[_0x1c622c]=_[_0x595c('0x27')](_0x46e4a9[_0x595c('0x28')])?_0x46e4a9[_0x595c('0x19')]:_0x46e4a9[_0x595c('0x18')];if(_[_0x595c('0x27')](_0x46e4a9[_0x595c('0x28')])){_0x31a003['firstName']=_0x46e4a9[_0x595c('0x29')]&&_0x46e4a9[_0x595c('0x29')]!==''?_0x46e4a9[_0x595c('0x29')]:_0x595c('0x2a');}else{_0x31a003[_0x595c('0x1a')]=_0x46e4a9['destcalleridname']&&_0x46e4a9[_0x595c('0x2b')]!==_0x595c('0x2c')?_0x46e4a9[_0x595c('0x2b')]:'Unknown';}return BPromise[_0x595c('0x1c')]()['then'](cmContactRpc[_0x595c('0x2d')](_0x31a003))[_0x595c('0x1d')](function(_0x581957){_0x1fd9af=_0x581957;_0x2ef08f[_0x595c('0x2e')](_0x581957);if(_0x1fd9af){logger[_0x595c('0x20')](_0x595c('0x2f'),_0x46e4a9[_0x595c('0x22')],_0x20f666['id'],_0x1fd9af['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x46e4a9[_0x595c('0x22')],_0x20f666['id']);_0x31a003[_0x1c622c]=_[_0x595c('0x27')](_0x46e4a9[_0x595c('0x28')])?_0x46e4a9[_0x595c('0x19')]:_0x46e4a9[_0x595c('0x18')];if(_[_0x595c('0x27')](_0x46e4a9[_0x595c('0x28')])){_0x31a003[_0x595c('0x1a')]=_0x46e4a9['calleridname']&&_0x46e4a9[_0x595c('0x29')]!==_0x595c('0x2c')?_0x46e4a9[_0x595c('0x29')]:_0x595c('0x2a');}else{_0x31a003['firstName']=_0x46e4a9[_0x595c('0x2b')]&&_0x46e4a9[_0x595c('0x2b')]!==_0x595c('0x2c')?_0x46e4a9[_0x595c('0x2b')]:_0x595c('0x2a');}_0x1fd9af=_0x31a003;_0x2ef08f['push'](_0x31a003);return;}}})[_0x595c('0x1d')](function(){if(_0xdbd1cd){emit(_0x46e4a9[_0x595c('0x22')],_0x20f666,util[_0x595c('0x30')]('user:%s',_0xdbd1cd['name']),util['format'](_0x595c('0x31'),_0x3235b2[_0x595c('0x32')][_0x595c('0x33')]()),{'evt':_[_0x595c('0x34')](_0x46e4a9,{'autoCreate':_0x485a28}),'contact':_0x1fd9af===undefined?{}:_0x1fd9af,'contacts':_0x2ef08f[_0x595c('0x35')]===0x0?undefined:_0x2ef08f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6f6d5aa..21fd58f 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 _0x0848=['AccountId','upperFirst','interaction','event','operator','membername','lastevent','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','trigger','redis','localhost','socket.io-emitter','popup','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','checkTriggers','agents','hasOwnProperty','status','checkTrigger','merge','Actions','length','interface','action','toLowerCase','contactmanager','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','data3','data4','location','uriLocation','windowWidth','isNil','data5','800','windowHeight','winapp','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','search','replace','AllConditions','every','AnyConditions','some','checkConditions','channel','field','ChatWebsiteId','value'];(function(_0x326e28,_0x2c3264){var _0x1f583a=function(_0x476af0){while(--_0x476af0){_0x326e28['push'](_0x326e28['shift']());}};_0x1f583a(++_0x2c3264);}(_0x0848,0x15d));var _0x8084=function(_0x5b0a8f,_0x573ed6){_0x5b0a8f=_0x5b0a8f-0x0;var _0x303e43=_0x0848[_0x5b0a8f];return _0x303e43;};'use strict';var util=require('util');var _=require(_0x8084('0x0'));var url=require(_0x8084('0x1'));var Mustache=require(_0x8084('0x2'));var Redis=require(_0x8084('0x3'));var urlforward=require(_0x8084('0x4'));var integration=require(_0x8084('0x5'));var cmContact=require(_0x8084('0x6'));var script=require('./script');var config=require(_0x8084('0x7'));var logger=require('../../../config/logger')(_0x8084('0x8'));var ami=require('../ami');config[_0x8084('0x9')]=_['defaults'](config[_0x8084('0x9')],{'host':_0x8084('0xa'),'port':0x18eb});var io=require(_0x8084('0xb'))(new Redis(config[_0x8084('0x9')]));var operators={'equals':function(_0x1034e9,_0x264f23){return _0x1034e9==_0x264f23;},'not_equals':function(_0x50b59a,_0x2ed29a){return _0x50b59a!=_0x2ed29a;}};var barAndWebActions=[_0x8084('0xc'),_0x8084('0x1'),'winapp'];function Trigger(_0x314420){this[_0x8084('0xd')]=_0x314420['triggers'];this['agents']=_0x314420['agents'];this[_0x8084('0xe')]=_0x314420['voiceQueues'];this[_0x8084('0xf')]=_0x314420['templates'];this[_0x8084('0x10')]=_0x314420['voiceExtensions'];this[_0x8084('0x11')]=_0x314420[_0x8084('0x11')];this[_0x8084('0x12')]=_0x314420[_0x8084('0x12')];this['salesforceAccounts']=_0x314420[_0x8084('0x13')];this['sugarcrmAccounts']=_0x314420[_0x8084('0x14')];this[_0x8084('0x15')]=_0x314420[_0x8084('0x15')];this['deskAccounts']=_0x314420[_0x8084('0x16')];this[_0x8084('0x17')]=_0x314420[_0x8084('0x17')];this[_0x8084('0x18')]=_0x314420[_0x8084('0x18')];this[_0x8084('0x19')]=_0x314420['dynamics365Accounts'];this[_0x8084('0x1a')]=_0x314420[_0x8084('0x1a')];this[_0x8084('0x1b')]={'zendesk':this[_0x8084('0x11')],'salesforce':this[_0x8084('0x13')],'freshdesk':this[_0x8084('0x12')],'sugarcrm':this[_0x8084('0x14')],'zoho':this[_0x8084('0x15')],'desk':this[_0x8084('0x16')],'vtiger':this[_0x8084('0x17')],'dynamics365':this[_0x8084('0x19')],'freshsales':this[_0x8084('0x1a')],'servicenow':this['servicenowAccounts']};ami['on'](_0x8084('0x1c'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x1f'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x20'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x21'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x22'),this[_0x8084('0x1d')]['bind'](this));ami['on'](_0x8084('0x23'),this['syncCustomEvent'][_0x8084('0x1e')](this));ami['on'](_0x8084('0x24'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x25'),this[_0x8084('0x1d')]['bind'](this));ami['on'](_0x8084('0x26'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x27'),this[_0x8084('0x1d')]['bind'](this));ami['on'](_0x8084('0x28'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x29'),this[_0x8084('0x2a')][_0x8084('0x1e')](this));ami['on']('custom:dialconnect',this[_0x8084('0x2a')][_0x8084('0x1e')](this));ami['on']('custom:dialend',this[_0x8084('0x2a')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x2b'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x2c'),this['syncCustomEvent'][_0x8084('0x1e')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x8084('0x2d'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x2e'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));ami['on'](_0x8084('0x2f'),this[_0x8084('0x1d')][_0x8084('0x1e')](this));}Trigger[_0x8084('0x30')][_0x8084('0x31')]=function(_0x251db7,_0x80d14a,_0x29cc64){logger[_0x8084('0x32')](_0x251db7,_0x80d14a,JSON[_0x8084('0x33')](_0x29cc64));io['to'](_0x251db7)[_0x8084('0x31')](_0x80d14a,_0x29cc64);};Trigger[_0x8084('0x30')][_0x8084('0x1d')]=function(_0x4195e6){var _0x3db43d=_['clone'](_0x4195e6);this[_0x8084('0x34')](_0x3db43d);};Trigger[_0x8084('0x30')]['syncAgentDial']=function(_0xdb5cba){if(this[_0x8084('0x35')][_0xdb5cba['interface']]){this['syncCustomEvent'](_0xdb5cba);}};Trigger[_0x8084('0x30')][_0x8084('0x34')]=function(_0x166c0d){var _0x484984;for(var _0x17dc53 in this[_0x8084('0xd')]){if(this[_0x8084('0xd')][_0x8084('0x36')](_0x17dc53)){if(this[_0x8084('0xd')][_0x17dc53][_0x8084('0x37')]){_0x484984=this[_0x8084('0x38')](this[_0x8084('0xd')][_0x17dc53],_0x166c0d);if(_0x484984){_[_0x8084('0x39')](_0x166c0d,_0x166c0d['variables']);for(var _0x1dd816=0x0,_0x56f695,_0x3c1d2a,_0x5135c9;_0x1dd8160x0){_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(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 6e518cc..54c99f5 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 _0xf782=[']\x20The\x20Enduser\x20phone\x20is:','calleridnum',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','value','destcalleridnum','telephone1',']\x20Enduser\x20created!','type','string','nameField','customField','idField','toLowerCase','indexOf','content','ticketType','incident','assign','getString','Descriptions','Fields','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:'];(function(_0x444127,_0x27d1e9){var _0x5855c0=function(_0x143f95){while(--_0x143f95){_0x444127['push'](_0x444127['shift']());}};_0x5855c0(++_0x27d1e9);}(_0xf782,0xcd));var _0x2f78=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xf782[_0x548627];return _0x844a84;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x2f78('0x0'));var util=require(_0x2f78('0x1'));var intUtil=require(_0x2f78('0x2'));var md5=require(_0x2f78('0x3'));var Redis=require(_0x2f78('0x4'));var logger=require(_0x2f78('0x5'))('dynamics365');var config=require(_0x2f78('0x6'));config['redis']=_[_0x2f78('0x7')](config[_0x2f78('0x8')],{'host':_0x2f78('0x9'),'port':0x18eb});var io=require(_0x2f78('0xa'))(new Redis(config[_0x2f78('0x8')]));function getAuthToken(_0x490418,_0x180f85,_0x5e6ee3){var _0x4f0c71={'method':_0x2f78('0xb'),'uri':_0x180f85,'form':{'client_id':_0x490418[_0x2f78('0xc')],'resource':_0x490418[_0x2f78('0xd')],'username':_0x490418[_0x2f78('0xe')],'password':_0x490418[_0x2f78('0xf')],'grant_type':_0x2f78('0xf'),'client_secret':_0x490418[_0x2f78('0x10')]},'json':!![]};return rp(_0x4f0c71)[_0x2f78('0x11')](function(_0x34e86d){return _0x34e86d[_0x2f78('0x12')];})[_0x2f78('0x13')](function(_0x4d35b9){logger['error']('['+[_0x5e6ee3[_0x2f78('0x14')]()]+_0x2f78('0x15'));return _0x4d35b9[_0x2f78('0x16')];});}function getUser(_0x5df4c7,_0x1b061d,_0x2f841a,_0x55e78b,_0x585652,_0x173f1e){return new BPromise(function(_0x44a25f,_0x75b6b7){return getAuthToken(_0x1b061d,_0x55e78b,_0x173f1e)[_0x2f78('0x11')](function(_0x44328c){var _0x20d79d={'method':'GET','uri':_0x585652+_0x2f78('0x17'),'headers':{'Authorization':_0x2f78('0x18')+_0x44328c,'OData-Version':_0x2f78('0x19')},'json':!![]};return rp(_0x20d79d);})['then'](function(_0x23cc5d){var _0x151d38=_0x23cc5d['value'];var _0x5457e2=![];var _0x2ba2d5=null;if(!_['isNil'](_0x2f841a)){if(intUtil[_0x2f78('0x1a')](_0x2f841a[_0x2f78('0x1b')])){_0x5df4c7[_0x2f78('0x1c')]=_0x2f841a['email'];for(_0x2ba2d5=0x0;_0x2ba2d5<_0x151d38[_0x2f78('0x1d')];_0x2ba2d5++){if(_0x151d38[_0x2ba2d5][_0x2f78('0x1e')]===_0x2f841a['email']&&!_0x151d38[_0x2ba2d5][_0x2f78('0x1f')]){_0x5457e2=!![];logger['info']('['+[_0x173f1e['toUpperCase']()]+_0x2f78('0x20')+_0x151d38[_0x2ba2d5][_0x2f78('0x21')]+'!');_0x5df4c7[_0x2f78('0x22')]=_0x151d38[_0x2ba2d5][_0x2f78('0x21')];}}}}if(!_0x5457e2){logger[_0x2f78('0x23')]('['+[_0x173f1e[_0x2f78('0x14')]()]+_0x2f78('0x24'));_0x5df4c7['userEmail']=_0x1b061d['username'];for(_0x2ba2d5=0x0;_0x2ba2d5<_0x151d38[_0x2f78('0x1d')];_0x2ba2d5++){if(_0x151d38[_0x2ba2d5][_0x2f78('0x1e')]===_0x1b061d[_0x2f78('0xe')]){_0x5df4c7[_0x2f78('0x22')]=_0x151d38[_0x2ba2d5][_0x2f78('0x21')];}}}_0x44a25f(_0x5df4c7);})[_0x2f78('0x13')](function(_0x323e9d){_0x75b6b7(_0x323e9d[_0x2f78('0x16')]);});});}function createEndUser(_0x59872f,_0x278ee7,_0x3ed5e4,_0x489cea,_0x16b2a4,_0x33ecab){return new BPromise(function(_0x3e8f0d,_0x42fcde){return getAuthToken(_0x278ee7,_0x3ed5e4,_0x33ecab)[_0x2f78('0x11')](function(_0x56551f){var _0x284706=_0x33ecab['toLowerCase']()===_0x2f78('0x25')?_0x16b2a4['destcalleridnum']:_0x16b2a4['calleridnum'];var _0x5569c1={'method':_0x2f78('0xb'),'uri':_0x489cea+_0x2f78('0x26'),'body':{'telephone1':_0x284706,'fullname':_0x284706,'firstname':_0x284706,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2f78('0x27')+_0x59872f[_0x2f78('0x22')]+')'},'headers':{'Authorization':_0x2f78('0x18')+_0x56551f,'OData-Version':_0x2f78('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5569c1);})[_0x2f78('0x11')](function(_0x2b46cc){var _0x2ffaa1=_0x2b46cc[_0x2f78('0x28')][_0x2f78('0x29')];var _0x48a352=_0x2ffaa1[_0x2f78('0x2a')](_0x2ffaa1[_0x2f78('0x2b')]('(')+0x1,_0x2ffaa1[_0x2f78('0x2b')](')'));_0x59872f[_0x2f78('0x2c')]=_0x48a352;_0x3e8f0d(_0x59872f);})[_0x2f78('0x13')](function(_0x3b6f43){_0x42fcde(_0x3b6f43[_0x2f78('0x16')]);});});}function getEndUser(_0x178df4,_0xef6081,_0x2a65f0,_0xdc208f,_0x24fba0,_0x2fac1c){return new BPromise(function(_0x578946,_0x1fe053){return getAuthToken(_0xef6081,_0x2a65f0,_0x2fac1c)[_0x2f78('0x11')](function(_0x20c63f){var _0x32592b={'method':'GET','uri':_0xdc208f+_0x2f78('0x2d'),'headers':{'Authorization':_0x2f78('0x18')+_0x20c63f,'If-None-Match':null,'OData-Version':_0x2f78('0x19')},'json':!![]};return rp(_0x32592b);})[_0x2f78('0x11')](function(_0x10e110){var _0x473cc1=null;if(_0x10e110){var _0x2d3367=_0x10e110[_0x2f78('0x2e')];var _0x8d5c4=![];for(_0x473cc1=0x0;_0x473cc1<_0x2d3367['length'];_0x473cc1++){var _0x20c465=_0x2fac1c['toLowerCase']()==='outbound'?_0x24fba0[_0x2f78('0x2f')]:_0x24fba0['calleridnum'];if(_0x2d3367[_0x473cc1][_0x2f78('0x30')]===_0x20c465){_0x8d5c4=!![];_0x178df4[_0x2f78('0x2c')]=_0x2d3367[_0x473cc1]['contactid'];}}if(_0x8d5c4){_0x578946(_0x178df4);}else{return createEndUser(_0x178df4,_0xef6081,_0x2a65f0,_0xdc208f,_0x24fba0,_0x2fac1c)['then'](function(_0x32d971){logger[_0x2f78('0x23')]('['+[_0x2fac1c['toUpperCase']()]+_0x2f78('0x31'),_0x32d971[_0x2f78('0x2c')]);_0x578946(_0x32d971);});}}else{return createEndUser(_0x178df4,_0xef6081,_0x2a65f0,_0xdc208f,_0x24fba0,_0x2fac1c)['then'](function(_0x385b46){logger[_0x2f78('0x23')]('['+[_0x2fac1c['toUpperCase']()]+']\x20Enduser\x20Created!',_0x385b46['enduserId']);_0x578946(_0x385b46);});}});});}function getCustomFields(_0x58c3c6,_0x290568,_0xca860d){var _0x4099e3={};if(_0x58c3c6['length']>0x0){_['forEach'](_0x58c3c6,function(_0x292e06){if(_0x292e06[_0x2f78('0x32')]===_0x2f78('0x33')&&_0x292e06[_0x2f78('0x34')]&&!_0x292e06[_0x2f78('0x35')]){var _0x1628a2=_0x292e06[_0x2f78('0x36')][_0x2f78('0x37')]();var _0x2e58a9=_0x1628a2[_0x2f78('0x2a')](0x0,_0x1628a2[_0x2f78('0x38')]('_'));var _0x353fa4=_0x1628a2[_0x2f78('0x2a')](_0x1628a2[_0x2f78('0x38')]('_')+0x1);if(_0x2e58a9===_0xca860d){_0x4099e3[_0x353fa4]=_0x292e06[_0x2f78('0x39')];}}});}return _0x4099e3;}function getTicket(_0xd18186,_0x5a8b28,_0x1bc103,_0xadd27c,_0x92033d,_0x338438,_0x14aebf){return new BPromise(function(_0x54bd73,_0x6f0dcc){var _0x3350d2;return getAuthToken(_0x5a8b28,_0x1bc103,_0x14aebf)[_0x2f78('0x11')](function(_0x18d784){if(_0x338438[_0x2f78('0x3a')]===_0x2f78('0x3b')){_0x3350d2={'method':'POST','uri':_0xadd27c+'incidents','body':Object[_0x2f78('0x3c')]({},{'title':intUtil[_0x2f78('0x3d')](_0x338438['Subjects'],_0x92033d,'\x20'),'description':intUtil[_0x2f78('0x3d')](_0x338438[_0x2f78('0x3e')],_0x92033d,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0xd18186['enduserId']+')','ownerid@odata.bind':_0x2f78('0x27')+_0xd18186[_0x2f78('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x338438[_0x2f78('0x3f')],_0x92033d,_0x338438[_0x2f78('0x3a')])),'headers':{'Authorization':_0x2f78('0x18')+_0x18d784,'OData-Version':_0x2f78('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x338438[_0x2f78('0x3a')]===_0x2f78('0x40')){_0x3350d2={'method':'POST','uri':_0xadd27c+_0x2f78('0x41'),'body':Object[_0x2f78('0x3c')]({},{'subject':intUtil[_0x2f78('0x3d')](_0x338438[_0x2f78('0x42')],_0x92033d,'\x20'),'phonenumber':String(_0x92033d['calleridnum']),'description':intUtil[_0x2f78('0x3d')](_0x338438[_0x2f78('0x3e')],_0x92033d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2f78('0x43')+_0xd18186[_0x2f78('0x2c')]+')','ownerid@odata.bind':_0x2f78('0x27')+_0xd18186[_0x2f78('0x22')]+')','directioncode':_0xd18186[_0x2f78('0x44')]===_0x2f78('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x2f78('0x27')+_0xd18186[_0x2f78('0x22')]+')','participationtypemask':_0xd18186[_0x2f78('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x2f78('0x43')+_0xd18186[_0x2f78('0x2c')]+')','participationtypemask':_0xd18186[_0x2f78('0x44')]===_0x2f78('0x45')?0x1:0x2}]},getCustomFields(_0x338438[_0x2f78('0x3f')],_0x92033d,_0x338438[_0x2f78('0x3a')])),'headers':{'Authorization':'Bearer\x20'+_0x18d784,'OData-Version':_0x2f78('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3350d2);})['then'](function(_0x300609){var _0x54c133=_0x300609[_0x2f78('0x28')][_0x2f78('0x29')];var _0x43abca=_0x54c133['substring'](_0x54c133['lastIndexOf']('(')+0x1,_0x54c133[_0x2f78('0x2b')](')'));_0xd18186[_0x2f78('0x46')]=_0x43abca;_0x54bd73(_0xd18186);})[_0x2f78('0x13')](function(_0x3d6794){_0x6f0dcc(_0x3d6794[_0x2f78('0x16')]);});});}function emit(_0x21540f,_0x233ef3,_0x2c275c,_0x3db8d6){var _0x2e2196={'uri':util[_0x2f78('0x47')](_0x2f78('0x48'),_0x21540f,_0x2c275c,_0x3db8d6)};io['to'](util[_0x2f78('0x47')](_0x2f78('0x49'),_0x233ef3))['emit'](_0x2f78('0x4a'),_0x2e2196);}exports['cs']=function(_0x9dfab3,_0x350cd7,_0xd5bd,_0x546cb8,_0x597b7a,_0x1e2123,_0x1322ad,_0x20ae84){var _0x3589c9={};_0x1e2123[_0x2f78('0xd')]=intUtil['stripTrailingSlash'](_0x1e2123[_0x2f78('0xd')]);_0x1e2123[_0x2f78('0x4b')]=intUtil['stripTrailingSlash'](_0x1e2123[_0x2f78('0x4b')]);_0x3589c9['callDirection']=_0x20ae84==='queue'||_0x20ae84===_0x2f78('0x4c')?_0x2f78('0x45'):_0x2f78('0x25');var _0x30a764=util[_0x2f78('0x47')](_0x2f78('0x4d'),_0x1e2123[_0x2f78('0xd')]);var _0x42d552=util[_0x2f78('0x47')](_0x2f78('0x4e'),_0x1e2123[_0x2f78('0x4f')]);var _0x1537d9=util['format'](_0x2f78('0x50'),_0x1e2123['serverUrl'],_0x350cd7[_0x2f78('0x51')],md5(_0x350cd7['uniqueid']));if(_0x597b7a&&_0x597b7a['monitor_format']){logger[_0x2f78('0x23')](_0x2f78('0x52'),_0x2f78('0x53'));_0x350cd7[_0x2f78('0x54')]=_0x1537d9;}else if(_0x1322ad&&_0x1322ad['recordingFormat']&&_0x1322ad['recordingFormat']!==_0x2f78('0x55')){logger[_0x2f78('0x23')](_0x2f78('0x56'),'Recording\x20is\x20enabled!');_0x350cd7[_0x2f78('0x54')]=_0x1537d9;}else{_0x350cd7[_0x2f78('0x54')]='';}return getUser(_0x3589c9,_0x1e2123,_0x546cb8,_0x42d552,_0x30a764,_0x20ae84)[_0x2f78('0x11')](function(_0x4b5ee5){logger[_0x2f78('0x23')]('['+_0x20ae84[_0x2f78('0x14')]()+_0x2f78('0x57'),_0x4b5ee5[_0x2f78('0x22')]);logger[_0x2f78('0x23')]('['+_0x20ae84['toUpperCase']()+_0x2f78('0x58'),_0x4b5ee5[_0x2f78('0x1c')]);return getEndUser(_0x4b5ee5,_0x1e2123,_0x42d552,_0x30a764,_0x350cd7,_0x20ae84);})[_0x2f78('0x11')](function(_0x538c18){logger[_0x2f78('0x23')]('['+_0x20ae84[_0x2f78('0x14')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x538c18[_0x2f78('0x2c')]);logger[_0x2f78('0x23')]('['+_0x20ae84[_0x2f78('0x14')]()+_0x2f78('0x59'),_0x350cd7[_0x2f78('0x5a')]);return getTicket(_0x538c18,_0x1e2123,_0x42d552,_0x30a764,_0x350cd7,_0xd5bd,_0x20ae84);})[_0x2f78('0x11')](function(_0xdca5a9){logger['info'](util['format']('['+_0x20ae84[_0x2f78('0x14')]()+_0x2f78('0x5b'),_0xd5bd[_0x2f78('0x3a')],_0xdca5a9[_0x2f78('0x46')]));logger[_0x2f78('0x23')](util[_0x2f78('0x47')]('['+_0x20ae84['toUpperCase']()+_0x2f78('0x5c'),_0x20ae84));if(_0x20ae84!==_0x2f78('0x4c')){logger[_0x2f78('0x23')]('['+_0x20ae84['toUpperCase']()+']',_0x2f78('0x5d'));emit(_0x1e2123['remoteUri'],_0x546cb8[_0x2f78('0x5e')],_0xd5bd[_0x2f78('0x3a')],_0xdca5a9['ticketId']);}})['catch'](function(_0x4d15ad){logger[_0x2f78('0x5f')]('['+_0x20ae84['toUpperCase']()+_0x2f78('0x60'),util[_0x2f78('0x61')](_0x4d15ad,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1e82=[']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','inspect','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','POST','remoteUri','username','password','clientSecret','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','then','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1','Bearer\x20','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','Fields','phonecalls','Descriptions','callDirection','queue','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','calleridnum'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e82,0x123));var _0x21e8=function(_0x1ff7a0,_0x126b4e){_0x1ff7a0=_0x1ff7a0-0x0;var _0x3b8399=_0x1e82[_0x1ff7a0];return _0x3b8399;};'use strict';var _=require(_0x21e8('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x21e8('0x1'));var intUtil=require(_0x21e8('0x2'));var md5=require(_0x21e8('0x3'));var Redis=require(_0x21e8('0x4'));var logger=require(_0x21e8('0x5'))(_0x21e8('0x6'));var config=require(_0x21e8('0x7'));config[_0x21e8('0x8')]=_['defaults'](config[_0x21e8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x21e8('0x9'))(new Redis(config[_0x21e8('0x8')]));function getAuthToken(_0x319e59,_0x4fc7fd,_0x5677dc){var _0x119269={'method':_0x21e8('0xa'),'uri':_0x4fc7fd,'form':{'client_id':_0x319e59['clientId'],'resource':_0x319e59[_0x21e8('0xb')],'username':_0x319e59[_0x21e8('0xc')],'password':_0x319e59[_0x21e8('0xd')],'grant_type':_0x21e8('0xd'),'client_secret':_0x319e59[_0x21e8('0xe')]},'json':!![]};return rp(_0x119269)['then'](function(_0x1c274c){return _0x1c274c[_0x21e8('0xf')];})['catch'](function(_0x657e1b){logger['error']('['+[_0x5677dc[_0x21e8('0x10')]()]+_0x21e8('0x11'));return _0x657e1b[_0x21e8('0x12')];});}function getUser(_0x33d942,_0x375bd1,_0x5e620c,_0x100a46,_0x416823,_0x40ffb1){return new BPromise(function(_0x11b3d8,_0x1a9ad8){return getAuthToken(_0x375bd1,_0x100a46,_0x40ffb1)['then'](function(_0x569612){var _0x1553b1={'method':_0x21e8('0x13'),'uri':_0x416823+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x569612,'OData-Version':_0x21e8('0x14')},'json':!![]};return rp(_0x1553b1);})[_0x21e8('0x15')](function(_0x5077c4){var _0x3155e5=_0x5077c4[_0x21e8('0x16')];var _0x25d3ee=![];var _0x4d5450=null;if(!_[_0x21e8('0x17')](_0x5e620c)){if(intUtil[_0x21e8('0x18')](_0x5e620c[_0x21e8('0x19')])){_0x33d942[_0x21e8('0x1a')]=_0x5e620c['email'];for(_0x4d5450=0x0;_0x4d5450<_0x3155e5[_0x21e8('0x1b')];_0x4d5450++){if(_0x3155e5[_0x4d5450][_0x21e8('0x1c')]===_0x5e620c[_0x21e8('0x19')]&&!_0x3155e5[_0x4d5450]['isdisabled']){_0x25d3ee=!![];logger[_0x21e8('0x1d')]('['+[_0x40ffb1[_0x21e8('0x10')]()]+_0x21e8('0x1e')+_0x3155e5[_0x4d5450][_0x21e8('0x1f')]+'!');_0x33d942[_0x21e8('0x20')]=_0x3155e5[_0x4d5450]['systemuserid'];}}}}if(!_0x25d3ee){logger[_0x21e8('0x1d')]('['+[_0x40ffb1[_0x21e8('0x10')]()]+_0x21e8('0x21'));_0x33d942[_0x21e8('0x1a')]=_0x375bd1['username'];for(_0x4d5450=0x0;_0x4d5450<_0x3155e5[_0x21e8('0x1b')];_0x4d5450++){if(_0x3155e5[_0x4d5450][_0x21e8('0x1c')]===_0x375bd1['username']){_0x33d942[_0x21e8('0x20')]=_0x3155e5[_0x4d5450][_0x21e8('0x1f')];}}}_0x11b3d8(_0x33d942);})[_0x21e8('0x22')](function(_0xb35fde){_0x1a9ad8(_0xb35fde[_0x21e8('0x12')]);});});}function createEndUser(_0x344f7d,_0xbf1246,_0x35ad0e,_0x1fae6d,_0x2fd354,_0x552048){return new BPromise(function(_0x116f9e,_0xa5beb2){return getAuthToken(_0xbf1246,_0x35ad0e,_0x552048)['then'](function(_0x27153a){var _0x5be25d=_0x552048[_0x21e8('0x23')]()===_0x21e8('0x24')?_0x2fd354[_0x21e8('0x25')]:_0x2fd354['calleridnum'];var _0x49215f={'method':_0x21e8('0xa'),'uri':_0x1fae6d+_0x21e8('0x26'),'body':{'telephone1':_0x5be25d,'fullname':_0x5be25d,'firstname':_0x5be25d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x21e8('0x27')+_0x344f7d[_0x21e8('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x27153a,'OData-Version':_0x21e8('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x49215f);})[_0x21e8('0x15')](function(_0x215a56){var _0x371f03=_0x215a56[_0x21e8('0x28')]['odata-entityid'];var _0x13c65a=_0x371f03[_0x21e8('0x29')](_0x371f03['lastIndexOf']('(')+0x1,_0x371f03[_0x21e8('0x2a')](')'));_0x344f7d[_0x21e8('0x2b')]=_0x13c65a;_0x116f9e(_0x344f7d);})[_0x21e8('0x22')](function(_0x5a07f1){_0xa5beb2(_0x5a07f1[_0x21e8('0x12')]);});});}function getEndUser(_0x1953b0,_0x1b1359,_0x146d98,_0x1f3b61,_0x4e3e16,_0x10fd62){return new BPromise(function(_0xb65022,_0x5e34d1){return getAuthToken(_0x1b1359,_0x146d98,_0x10fd62)[_0x21e8('0x15')](function(_0x2778f8){var _0x3d9d9d={'method':_0x21e8('0x13'),'uri':_0x1f3b61+_0x21e8('0x2c'),'headers':{'Authorization':_0x21e8('0x2d')+_0x2778f8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d9d9d);})[_0x21e8('0x15')](function(_0xe0fd6c){var _0x246a74=null;if(_0xe0fd6c){var _0x4e22bf=_0xe0fd6c[_0x21e8('0x16')];var _0x110cd5=![];for(_0x246a74=0x0;_0x246a74<_0x4e22bf['length'];_0x246a74++){var _0x53dae5=_0x10fd62[_0x21e8('0x23')]()===_0x21e8('0x24')?_0x4e3e16[_0x21e8('0x25')]:_0x4e3e16['calleridnum'];if(_0x4e22bf[_0x246a74][_0x21e8('0x2e')]===_0x53dae5){_0x110cd5=!![];_0x1953b0['enduserId']=_0x4e22bf[_0x246a74]['contactid'];}}if(_0x110cd5){_0xb65022(_0x1953b0);}else{return createEndUser(_0x1953b0,_0x1b1359,_0x146d98,_0x1f3b61,_0x4e3e16,_0x10fd62)['then'](function(_0x374340){logger['info']('['+[_0x10fd62[_0x21e8('0x10')]()]+_0x21e8('0x2f'),_0x374340[_0x21e8('0x2b')]);_0xb65022(_0x374340);});}}else{return createEndUser(_0x1953b0,_0x1b1359,_0x146d98,_0x1f3b61,_0x4e3e16,_0x10fd62)[_0x21e8('0x15')](function(_0x48d2f5){logger[_0x21e8('0x1d')]('['+[_0x10fd62[_0x21e8('0x10')]()]+_0x21e8('0x30'),_0x48d2f5[_0x21e8('0x2b')]);_0xb65022(_0x48d2f5);});}});});}function getCustomFields(_0x6a3995,_0x361b43,_0xefb0f2){var _0x2941d8={};if(_0x6a3995['length']>0x0){_[_0x21e8('0x31')](_0x6a3995,function(_0x1e6f0b){if(_0x1e6f0b[_0x21e8('0x32')]===_0x21e8('0x33')&&_0x1e6f0b['nameField']&&!_0x1e6f0b[_0x21e8('0x34')]){var _0x5a0bba=_0x1e6f0b[_0x21e8('0x35')][_0x21e8('0x23')]();var _0x2ce98d=_0x5a0bba['substring'](0x0,_0x5a0bba[_0x21e8('0x36')]('_'));var _0x3a9b57=_0x5a0bba['substring'](_0x5a0bba['indexOf']('_')+0x1);if(_0x2ce98d===_0xefb0f2){_0x2941d8[_0x3a9b57]=_0x1e6f0b[_0x21e8('0x37')];}}});}return _0x2941d8;}function getTicket(_0x488b31,_0x14aef8,_0x91883a,_0x2629fa,_0x39958f,_0x1d68dc,_0x2946a5){return new BPromise(function(_0x4ef882,_0xb71f53){var _0x4ff1e9;return getAuthToken(_0x14aef8,_0x91883a,_0x2946a5)[_0x21e8('0x15')](function(_0x4898c7){if(_0x1d68dc[_0x21e8('0x38')]===_0x21e8('0x39')){_0x4ff1e9={'method':_0x21e8('0xa'),'uri':_0x2629fa+_0x21e8('0x3a'),'body':Object[_0x21e8('0x3b')]({},{'title':intUtil[_0x21e8('0x3c')](_0x1d68dc[_0x21e8('0x3d')],_0x39958f,'\x20'),'description':intUtil[_0x21e8('0x3c')](_0x1d68dc['Descriptions'],_0x39958f,'\x0a'),'customerid_contact@odata.bind':_0x21e8('0x3e')+_0x488b31[_0x21e8('0x2b')]+')','ownerid@odata.bind':'/systemusers('+_0x488b31['userId']+')','caseorigincode':'1'},getCustomFields(_0x1d68dc[_0x21e8('0x3f')],_0x39958f,_0x1d68dc['ticketType'])),'headers':{'Authorization':_0x21e8('0x2d')+_0x4898c7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1d68dc['ticketType']==='phonecall'){_0x4ff1e9={'method':_0x21e8('0xa'),'uri':_0x2629fa+_0x21e8('0x40'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x1d68dc['Subjects'],_0x39958f,'\x20'),'phonenumber':String(_0x39958f['calleridnum']),'description':intUtil['getString'](_0x1d68dc[_0x21e8('0x41')],_0x39958f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x21e8('0x3e')+_0x488b31[_0x21e8('0x2b')]+')','ownerid@odata.bind':_0x21e8('0x27')+_0x488b31[_0x21e8('0x20')]+')','directioncode':_0x488b31[_0x21e8('0x42')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x21e8('0x27')+_0x488b31[_0x21e8('0x20')]+')','participationtypemask':_0x488b31[_0x21e8('0x42')]===_0x21e8('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x21e8('0x3e')+_0x488b31[_0x21e8('0x2b')]+')','participationtypemask':_0x488b31[_0x21e8('0x42')]===_0x21e8('0x43')?0x1:0x2}]},getCustomFields(_0x1d68dc[_0x21e8('0x3f')],_0x39958f,_0x1d68dc[_0x21e8('0x38')])),'headers':{'Authorization':_0x21e8('0x2d')+_0x4898c7,'OData-Version':_0x21e8('0x14')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4ff1e9);})['then'](function(_0x275895){var _0x5bfbb5=_0x275895['headers'][_0x21e8('0x44')];var _0x2307a8=_0x5bfbb5[_0x21e8('0x29')](_0x5bfbb5[_0x21e8('0x2a')]('(')+0x1,_0x5bfbb5['lastIndexOf'](')'));_0x488b31[_0x21e8('0x45')]=_0x2307a8;_0x4ef882(_0x488b31);})['catch'](function(_0x2964db){_0xb71f53(_0x2964db[_0x21e8('0x12')]);});});}function emit(_0x49f667,_0x3b9fb1,_0x4984c7,_0x4c3f26){var _0x1bc4f3={'uri':util[_0x21e8('0x46')](_0x21e8('0x47'),_0x49f667,_0x4984c7,_0x4c3f26)};io['to'](util['format'](_0x21e8('0x48'),_0x3b9fb1))[_0x21e8('0x49')](_0x21e8('0x4a'),_0x1bc4f3);}exports['cs']=function(_0x349533,_0x5ba936,_0x1139fb,_0xd879cd,_0x16bd7e,_0x84cffb,_0x134fbf,_0x294a48){var _0x4b2a1c={};_0x84cffb[_0x21e8('0xb')]=intUtil['stripTrailingSlash'](_0x84cffb[_0x21e8('0xb')]);_0x84cffb['serverUrl']=intUtil[_0x21e8('0x4b')](_0x84cffb['serverUrl']);_0x4b2a1c[_0x21e8('0x42')]=_0x294a48==='queue'||_0x294a48===_0x21e8('0x4c')?_0x21e8('0x43'):_0x21e8('0x24');var _0x15a95c=util['format'](_0x21e8('0x4d'),_0x84cffb[_0x21e8('0xb')]);var _0x13b104=util[_0x21e8('0x46')]('https://login.microsoftonline.com/%s/oauth2/token',_0x84cffb[_0x21e8('0x4e')]);var _0x439eca=util[_0x21e8('0x46')](_0x21e8('0x4f'),_0x84cffb[_0x21e8('0x50')],_0x5ba936[_0x21e8('0x51')],md5(_0x5ba936['uniqueid']));if(_0x16bd7e&&_0x16bd7e['monitor_format']){logger[_0x21e8('0x1d')]('[QUEUE]',_0x21e8('0x52'));_0x5ba936[_0x21e8('0x53')]=_0x439eca;}else if(_0x134fbf&&_0x134fbf[_0x21e8('0x54')]&&_0x134fbf['recordingFormat']!==_0x21e8('0x55')){logger[_0x21e8('0x1d')]('[OUTBOUND]',_0x21e8('0x52'));_0x5ba936[_0x21e8('0x53')]=_0x439eca;}else{_0x5ba936[_0x21e8('0x53')]='';}return getUser(_0x4b2a1c,_0x84cffb,_0xd879cd,_0x13b104,_0x15a95c,_0x294a48)[_0x21e8('0x15')](function(_0x3cf1fb){logger[_0x21e8('0x1d')]('['+_0x294a48['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x3cf1fb[_0x21e8('0x20')]);logger[_0x21e8('0x1d')]('['+_0x294a48[_0x21e8('0x10')]()+']\x20The\x20User\x20email\x20is:',_0x3cf1fb[_0x21e8('0x1a')]);return getEndUser(_0x3cf1fb,_0x84cffb,_0x13b104,_0x15a95c,_0x5ba936,_0x294a48);})['then'](function(_0x67024b){logger[_0x21e8('0x1d')]('['+_0x294a48[_0x21e8('0x10')]()+_0x21e8('0x56'),_0x67024b[_0x21e8('0x2b')]);logger[_0x21e8('0x1d')]('['+_0x294a48['toUpperCase']()+_0x21e8('0x57'),_0x5ba936[_0x21e8('0x58')]);return getTicket(_0x67024b,_0x84cffb,_0x13b104,_0x15a95c,_0x5ba936,_0x1139fb,_0x294a48);})[_0x21e8('0x15')](function(_0x1e95f6){logger[_0x21e8('0x1d')](util[_0x21e8('0x46')]('['+_0x294a48['toUpperCase']()+_0x21e8('0x59'),_0x1139fb[_0x21e8('0x38')],_0x1e95f6[_0x21e8('0x45')]));logger[_0x21e8('0x1d')](util[_0x21e8('0x46')]('['+_0x294a48[_0x21e8('0x10')]()+_0x21e8('0x5a'),_0x294a48));if(_0x294a48!==_0x21e8('0x4c')){logger[_0x21e8('0x1d')]('['+_0x294a48[_0x21e8('0x10')]()+']',_0x21e8('0x5b'));emit(_0x84cffb['remoteUri'],_0xd879cd[_0x21e8('0x5c')],_0x1139fb['ticketType'],_0x1e95f6[_0x21e8('0x45')]);}})[_0x21e8('0x22')](function(_0x245b7b){logger[_0x21e8('0x5d')]('['+_0x294a48['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x21e8('0x5e')](_0x245b7b,{'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 40a7aec..57c042b 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 _0xedcb=['length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','toString','[HTTP]','stringify','defaults','GET','map','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','Tags','Fields','custom_fields','keyBy','value','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xedcb,0x153));var _0xbedc=function(_0x110988,_0xcdd538){_0x110988=_0x110988-0x0;var _0x2e2b17=_0xedcb[_0x110988];return _0x2e2b17;};'use strict';var _=require(_0xbedc('0x0'));var rp=require(_0xbedc('0x1'));var md5=require(_0xbedc('0x2'));var util=require(_0xbedc('0x3'));var Redis=require(_0xbedc('0x4'));var intUtil=require(_0xbedc('0x5'));var config=require(_0xbedc('0x6'));var logger=require('../../../../config/logger')(_0xbedc('0x7'));config[_0xbedc('0x8')]=_['defaults'](config[_0xbedc('0x8')],{'host':_0xbedc('0x9'),'port':0x18eb});var io=require(_0xbedc('0xa'))(new Redis(config[_0xbedc('0x8')]));var headers={'Content-Type':_0xbedc('0xb'),'Accept':'application/json'};function emit(_0x125bf5,_0x2777f3,_0x1003f5){io['to'](_0x125bf5)[_0xbedc('0xc')](_0x2777f3,_0x1003f5);}function getTicket(_0x13db31,_0x438ee2,_0x280edd,_0x120d5d,_0x10abd8){logger[_0xbedc('0xd')](_0xbedc('0xe'));var _0x3dffa5=_[_0xbedc('0xf')]({'responder_id':_0x438ee2['id'],'requester_id':_0x280edd['id'],'name':util[_0xbedc('0x10')](_0xbedc('0x11'),_0x10abd8[_0xbedc('0x12')]),'phone':_0x10abd8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbedc('0x13')](_0x120d5d[_0xbedc('0x14')],_0x10abd8,'\x20'),'description':intUtil[_0xbedc('0x13')](_0x120d5d[_0xbedc('0x15')],_0x10abd8,'
'),'tags':getTags(_0x120d5d[_0xbedc('0x16')],'name')},getCustomFields(_0x120d5d[_0xbedc('0x17')],_0x10abd8));_0x3dffa5[_0xbedc('0x18')]=_['mapValues'](_[_0xbedc('0x19')](_0x3dffa5['custom_fields'],'id'),_0xbedc('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x13db31['remoteUri']),'method':_0xbedc('0x1b'),'body':_0x3dffa5})[_0xbedc('0x1c')](function(_0x31bcd8){logger['info'](_0xbedc('0x1d'));return _0x31bcd8;});}function getUser(_0x4f7602,_0x43670a){if(intUtil[_0xbedc('0x1e')](_0x43670a)){return request({'uri':util[_0xbedc('0x10')](_0xbedc('0x1f'),_0x4f7602[_0xbedc('0x20')]),'qs':{'email':_0x43670a}})[_0xbedc('0x1c')](function(_0x5d84ed){if(_0x5d84ed[_0xbedc('0x21')]){logger[_0xbedc('0xd')](_0xbedc('0x22'));return _[_0xbedc('0x23')](_0x5d84ed,function(_0x52777d){return _0x52777d[_0xbedc('0x24')][_0xbedc('0x25')]===_0x43670a;});}else{logger[_0xbedc('0xd')](_0xbedc('0x26'));return request({'uri':util['format'](_0xbedc('0x27'),_0x4f7602['remoteUri'])})[_0xbedc('0x1c')](function(_0x4f722c){logger[_0xbedc('0xd')](_0xbedc('0x28'));return _0x4f722c;});}});}else{logger['info'](_0xbedc('0x29'));return request({'uri':util[_0xbedc('0x10')](_0xbedc('0x27'),_0x4f7602[_0xbedc('0x20')])})[_0xbedc('0x1c')](function(_0x4d6dbb){logger[_0xbedc('0xd')](_0xbedc('0x28'));return _0x4d6dbb;});}}function getEndUser(_0x56e10d,_0x488831,_0x5a2b7c){logger[_0xbedc('0xd')](_0xbedc('0x2a'),_0x5a2b7c);return request({'uri':util['format']('%s/api/v2/contacts',_0x56e10d[_0xbedc('0x20')]),'qs':{'phone':_0x5a2b7c}})[_0xbedc('0x1c')](function(_0x119975){if(_0x119975[_0xbedc('0x21')]){logger[_0xbedc('0xd')](_0xbedc('0x2b'));return _['find'](_0x119975,{'phone':_0x5a2b7c});}else{logger['info'](_0xbedc('0x2c'));return request({'uri':util[_0xbedc('0x10')](_0xbedc('0x2d'),_0x56e10d[_0xbedc('0x20')]),'method':_0xbedc('0x1b'),'body':{'name':_0x488831,'phone':_0x5a2b7c}})[_0xbedc('0x1c')](function(_0x1bb82a){logger[_0xbedc('0xd')](_0xbedc('0x2e'));return _0x1bb82a;});}});}function getAuth(_0x23ed0c){return util[_0xbedc('0x10')]('Basic\x20%s',new Buffer(_0x23ed0c['apiKey']+':X')[_0xbedc('0x2f')]('base64'));}function request(_0x2537ad){logger['debug'](_0xbedc('0x30'),JSON[_0xbedc('0x31')](_0x2537ad));return rp(_[_0xbedc('0x32')](_0x2537ad,{'method':_0xbedc('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x446b9d,_0x53f5ec){var _0x2e0ba0=[];if(_0x446b9d&&_0x446b9d[_0xbedc('0x21')]>0x0){_0x2e0ba0=_[_0xbedc('0x34')](_0x446b9d,_0x53f5ec);}return _0x2e0ba0;}function getCustomFields(_0x539f30,_0x19843f){var _0xeb0d7c=[];var _0x297dcd={'custom_fields':[]};if(_0x539f30[_0xbedc('0x21')]>0x0){_['forEach'](_0x539f30,function(_0x126526){if(_0x126526[_0xbedc('0x35')]===_0xbedc('0x36')&&_0x126526[_0xbedc('0x37')]&&!_0x126526[_0xbedc('0x38')]){_0x297dcd[_0x126526[_0xbedc('0x37')][_0xbedc('0x39')]()]=_0x126526[_0xbedc('0x3a')][_0xbedc('0x2f')]();}else if(_0x126526[_0xbedc('0x35')]===_0xbedc('0x36')&&_0x126526[_0xbedc('0x3b')]&&_0x126526[_0xbedc('0x38')]){_0x297dcd[_0xbedc('0x18')][_0xbedc('0x3c')]({'id':_0x126526[_0xbedc('0x3b')],'value':_0x126526['content'][_0xbedc('0x2f')]()});}else if(_0x126526['type']===_0xbedc('0x3d')&&_0x126526[_0xbedc('0x3e')]&&_0x126526[_0xbedc('0x3b')]&&_0x126526[_0xbedc('0x38')]){_0x19843f[_0x126526[_0xbedc('0x3e')]]&&_0x297dcd[_0xbedc('0x18')][_0xbedc('0x3c')]({'id':_0x126526['idField'],'value':_0x19843f[_0x126526[_0xbedc('0x3e')]][_0xbedc('0x2f')]()});}else if(_0x126526['type']===_0xbedc('0x3f')&&_0x126526[_0xbedc('0x40')]&&_0x126526[_0xbedc('0x40')][_0xbedc('0x41')]&&_0x126526[_0xbedc('0x3b')]&&_0x126526['customField']){_0x19843f[_0x126526[_0xbedc('0x40')][_0xbedc('0x41')][_0xbedc('0x39')]()]&&_0x297dcd[_0xbedc('0x18')][_0xbedc('0x3c')]({'id':_0x126526[_0xbedc('0x3b')],'value':_0x19843f[_0x126526[_0xbedc('0x40')][_0xbedc('0x41')][_0xbedc('0x39')]()][_0xbedc('0x2f')]()});}});}return _0x297dcd;}exports[_0xbedc('0x42')]=function(_0x4dedc9,_0x3ca81f,_0x1d7d96,_0x4273af,_0x26e51e,_0xb2d6f0){var _0x5314ad,_0x594049;_0xb2d6f0[_0xbedc('0x20')]=intUtil[_0xbedc('0x43')](_0xb2d6f0['remoteUri']);_0xb2d6f0['serverUrl']=intUtil[_0xbedc('0x43')](_0xb2d6f0[_0xbedc('0x44')]);if(_0x26e51e&&_0x26e51e[_0xbedc('0x45')]){logger['info'](_0xbedc('0x46'),'Recording\x20is\x20enabled!');_0x3ca81f['recordingURL']=util[_0xbedc('0x10')](_0xbedc('0x47'),_0xb2d6f0[_0xbedc('0x44')],_0x3ca81f[_0xbedc('0x48')],md5(_0x3ca81f[_0xbedc('0x48')]));}else{_0x3ca81f[_0xbedc('0x49')]='';}headers[_0xbedc('0x4a')]=getAuth(_0xb2d6f0);return getUser(_0xb2d6f0,_0x4273af[_0xbedc('0x25')])[_0xbedc('0x1c')](function(_0x4f208a){_0x5314ad=_0x4f208a;logger['info'](_0xbedc('0x4b'),_0x5314ad['id']);return getEndUser(_0xb2d6f0,_0x3ca81f[_0xbedc('0x12')],_0x3ca81f[_0xbedc('0x4c')]);})['then'](function(_0x276729){_0x594049=_0x276729;logger[_0xbedc('0xd')](_0xbedc('0x4d'),_0x594049['id']);return getTicket(_0xb2d6f0,_0x5314ad,_0x594049,_0x1d7d96,_0x3ca81f);})[_0xbedc('0x1c')](function(_0x1fb561){if(_0x1fb561&&_0x1fb561['id']){logger[_0xbedc('0xd')](_0xbedc('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1fb561['id']);logger['info'](_0xbedc('0x46'),_0xbedc('0x4e'));emit(util['format'](_0xbedc('0x4f'),_0x4273af[_0xbedc('0x41')]),_0xbedc('0x50'),{'uri':util[_0xbedc('0x10')](_0xbedc('0x51'),_0xb2d6f0[_0xbedc('0x20')],_0x1fb561['id'])});}})[_0xbedc('0x52')](function(_0xbc713d){logger[_0xbedc('0x53')]('[QUEUE]',JSON['stringify'](_0xbc713d));});};exports[_0xbedc('0x54')]=function(_0x32f378,_0xdc0614,_0x5d805e,_0x3cd019,_0x161f3d,_0x320329,_0xaba44){var _0x3d580e,_0x407a6e;_0x320329[_0xbedc('0x20')]=intUtil[_0xbedc('0x43')](_0x320329[_0xbedc('0x20')]);_0x320329['serverUrl']=intUtil[_0xbedc('0x43')](_0x320329[_0xbedc('0x44')]);if(_0xaba44&&_0xaba44['recordingFormat']&&_0xaba44[_0xbedc('0x55')]!=='none'){logger[_0xbedc('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xdc0614[_0xbedc('0x49')]=util[_0xbedc('0x10')](_0xbedc('0x47'),_0x320329[_0xbedc('0x44')],_0xdc0614[_0xbedc('0x48')],md5(_0xdc0614['uniqueid']));}headers[_0xbedc('0x4a')]=getAuth(_0x320329);return getUser(_0x320329,_0x3cd019['email'])['then'](function(_0x200cff){_0x3d580e=_0x200cff;logger[_0xbedc('0xd')]('The\x20User\x20ID\x20is:',_0x3d580e['id']);return getEndUser(_0x320329,_0xdc0614['destcalleridname'],_0xdc0614[_0xbedc('0x56')]);})[_0xbedc('0x1c')](function(_0x3780f5){_0x407a6e=_0x3780f5;logger[_0xbedc('0xd')](_0xbedc('0x4d'),_0x407a6e['id']);return getTicket(_0x320329,_0x3d580e,_0x407a6e,_0x5d805e,_0xdc0614);})[_0xbedc('0x1c')](function(_0x55d382){if(_0x55d382&&_0x55d382['id']){logger['info'](_0xbedc('0x1d'));logger[_0xbedc('0xd')](_0xbedc('0x57'),_0x55d382['id']);logger[_0xbedc('0xd')](_0xbedc('0x58'),_0xbedc('0x4e'));emit(util[_0xbedc('0x10')](_0xbedc('0x4f'),_0x3cd019[_0xbedc('0x41')]),'trigger:browser:url',{'uri':util[_0xbedc('0x10')](_0xbedc('0x51'),_0x320329['remoteUri'],_0x55d382['id'])});}})[_0xbedc('0x52')](function(_0x34ecb9){logger[_0xbedc('0x53')](_0xbedc('0x58'),JSON[_0xbedc('0x31')](_0x34ecb9));});};exports[_0xbedc('0x59')]=function(_0x47cc14,_0x592c6f,_0x50ed9d,_0x2e08b9,_0x29c5c6,_0x2797b3){var _0x516793,_0x3358f9;_0x2797b3[_0xbedc('0x20')]=intUtil[_0xbedc('0x43')](_0x2797b3[_0xbedc('0x20')]);_0x2797b3[_0xbedc('0x44')]=intUtil['stripTrailingSlash'](_0x2797b3['serverUrl']);if(_0x29c5c6&&_0x29c5c6[_0xbedc('0x45')]){logger[_0xbedc('0xd')]('['+_0x592c6f[_0xbedc('0x5a')][_0xbedc('0x5b')]()+']',_0xbedc('0x5c'));_0x592c6f['recordingURL']=util[_0xbedc('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2797b3[_0xbedc('0x44')],_0x592c6f[_0xbedc('0x48')],md5(_0x592c6f[_0xbedc('0x48')]));}else{_0x592c6f[_0xbedc('0x49')]='';}headers['Authorization']=getAuth(_0x2797b3);return getUser(_0x2797b3,'')[_0xbedc('0x1c')](function(_0x36f2ca){_0x516793=_0x36f2ca;logger[_0xbedc('0xd')](_0xbedc('0x4b'),_0x516793['id']);return getEndUser(_0x2797b3,_0x592c6f[_0xbedc('0x12')],_0x592c6f['calleridnum']);})[_0xbedc('0x1c')](function(_0x4da5d0){_0x3358f9=_0x4da5d0;logger['info'](_0xbedc('0x4d'),_0x3358f9['id']);return getTicket(_0x2797b3,_0x516793,_0x3358f9,_0x50ed9d,_0x592c6f);})[_0xbedc('0x1c')](function(_0x390417){if(_0x390417){logger[_0xbedc('0xd')](_0xbedc('0x1d'));logger[_0xbedc('0xd')](_0xbedc('0x57'),_0x390417['id']);}})['catch'](function(_0x1d1d0d){logger['error']('['+_0x592c6f['lastevent'][_0xbedc('0x5b')]()+']',JSON['stringify'](_0x1d1d0d));});}; \ No newline at end of file +var _0xde34=['md5','util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','Creating\x20new\x20ticket...','calleridnum','getString','Subjects','Descriptions','
','name','custom_fields','mapValues','keyBy','value','format','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','nameField','toLowerCase','content','idField','customField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridnum','lastevent','toUpperCase','lodash'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xde34,0x101));var _0x4de3=function(_0x43a80d,_0x7bb8a5){_0x43a80d=_0x43a80d-0x0;var _0x49ccd2=_0xde34[_0x43a80d];return _0x49ccd2;};'use strict';var _=require(_0x4de3('0x0'));var rp=require('request-promise');var md5=require(_0x4de3('0x1'));var util=require(_0x4de3('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4de3('0x3'));var logger=require(_0x4de3('0x4'))(_0x4de3('0x5'));config[_0x4de3('0x6')]=_['defaults'](config[_0x4de3('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4de3('0x7'))(new Redis(config[_0x4de3('0x6')]));var headers={'Content-Type':_0x4de3('0x8'),'Accept':_0x4de3('0x8')};function emit(_0x2bad7c,_0x4269a8,_0x4021bf){io['to'](_0x2bad7c)['emit'](_0x4269a8,_0x4021bf);}function getTicket(_0x26546f,_0x4223f4,_0x22f849,_0x3f3a37,_0x112ccc){logger['info'](_0x4de3('0x9'));var _0x41e5c7=_['merge']({'responder_id':_0x4223f4['id'],'requester_id':_0x22f849['id'],'name':util['format']('Caller\x20-\x20%s',_0x112ccc['calleridname']),'phone':_0x112ccc[_0x4de3('0xa')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4de3('0xb')](_0x3f3a37[_0x4de3('0xc')],_0x112ccc,'\x20'),'description':intUtil[_0x4de3('0xb')](_0x3f3a37[_0x4de3('0xd')],_0x112ccc,_0x4de3('0xe')),'tags':getTags(_0x3f3a37['Tags'],_0x4de3('0xf'))},getCustomFields(_0x3f3a37['Fields'],_0x112ccc));_0x41e5c7[_0x4de3('0x10')]=_[_0x4de3('0x11')](_[_0x4de3('0x12')](_0x41e5c7[_0x4de3('0x10')],'id'),_0x4de3('0x13'));return request({'uri':util[_0x4de3('0x14')]('%s/api/v2/tickets',_0x26546f[_0x4de3('0x15')]),'method':_0x4de3('0x16'),'body':_0x41e5c7})[_0x4de3('0x17')](function(_0x104ac6){logger[_0x4de3('0x18')](_0x4de3('0x19'));return _0x104ac6;});}function getUser(_0x245e18,_0x4cf7ee){if(intUtil[_0x4de3('0x1a')](_0x4cf7ee)){return request({'uri':util['format'](_0x4de3('0x1b'),_0x245e18['remoteUri']),'qs':{'email':_0x4cf7ee}})[_0x4de3('0x17')](function(_0x3cc517){if(_0x3cc517[_0x4de3('0x1c')]){logger[_0x4de3('0x18')](_0x4de3('0x1d'));return _[_0x4de3('0x1e')](_0x3cc517,function(_0x1275c1){return _0x1275c1[_0x4de3('0x1f')][_0x4de3('0x20')]===_0x4cf7ee;});}else{logger['info'](_0x4de3('0x21'));return request({'uri':util[_0x4de3('0x14')](_0x4de3('0x22'),_0x245e18[_0x4de3('0x15')])})[_0x4de3('0x17')](function(_0x26791e){logger[_0x4de3('0x18')]('Admin\x20account\x20selected.');return _0x26791e;});}});}else{logger[_0x4de3('0x18')](_0x4de3('0x23'));return request({'uri':util[_0x4de3('0x14')](_0x4de3('0x22'),_0x245e18[_0x4de3('0x15')])})[_0x4de3('0x17')](function(_0x504f15){logger[_0x4de3('0x18')](_0x4de3('0x24'));return _0x504f15;});}}function getEndUser(_0x3c9dec,_0x2f0e5f,_0x3ddad3){logger[_0x4de3('0x18')]('Searching\x20enduser\x20with\x20phone',_0x3ddad3);return request({'uri':util[_0x4de3('0x14')]('%s/api/v2/contacts',_0x3c9dec[_0x4de3('0x15')]),'qs':{'phone':_0x3ddad3}})['then'](function(_0x29bcd6){if(_0x29bcd6[_0x4de3('0x1c')]){logger[_0x4de3('0x18')](_0x4de3('0x25'));return _[_0x4de3('0x1e')](_0x29bcd6,{'phone':_0x3ddad3});}else{logger[_0x4de3('0x18')](_0x4de3('0x26'));return request({'uri':util[_0x4de3('0x14')]('%s/api/v2/contacts',_0x3c9dec[_0x4de3('0x15')]),'method':'POST','body':{'name':_0x2f0e5f,'phone':_0x3ddad3}})[_0x4de3('0x17')](function(_0x52122c){logger[_0x4de3('0x18')](_0x4de3('0x27'));return _0x52122c;});}});}function getAuth(_0x425272){return util[_0x4de3('0x14')](_0x4de3('0x28'),new Buffer(_0x425272['apiKey']+':X')[_0x4de3('0x29')](_0x4de3('0x2a')));}function request(_0x41b44d){logger[_0x4de3('0x2b')](_0x4de3('0x2c'),JSON[_0x4de3('0x2d')](_0x41b44d));return rp(_[_0x4de3('0x2e')](_0x41b44d,{'method':_0x4de3('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x46fb01,_0x3a78c7){var _0xdbde01=[];if(_0x46fb01&&_0x46fb01[_0x4de3('0x1c')]>0x0){_0xdbde01=_[_0x4de3('0x30')](_0x46fb01,_0x3a78c7);}return _0xdbde01;}function getCustomFields(_0x11b77b,_0x5e4952){var _0x232d6d=[];var _0x8213ca={'custom_fields':[]};if(_0x11b77b[_0x4de3('0x1c')]>0x0){_[_0x4de3('0x31')](_0x11b77b,function(_0x2318ce){if(_0x2318ce[_0x4de3('0x32')]==='string'&&_0x2318ce[_0x4de3('0x33')]&&!_0x2318ce['customField']){_0x8213ca[_0x2318ce[_0x4de3('0x33')][_0x4de3('0x34')]()]=_0x2318ce[_0x4de3('0x35')][_0x4de3('0x29')]();}else if(_0x2318ce[_0x4de3('0x32')]==='string'&&_0x2318ce[_0x4de3('0x36')]&&_0x2318ce[_0x4de3('0x37')]){_0x8213ca['custom_fields'][_0x4de3('0x38')]({'id':_0x2318ce['idField'],'value':_0x2318ce[_0x4de3('0x35')][_0x4de3('0x29')]()});}else if(_0x2318ce[_0x4de3('0x32')]===_0x4de3('0x39')&&_0x2318ce[_0x4de3('0x3a')]&&_0x2318ce[_0x4de3('0x36')]&&_0x2318ce[_0x4de3('0x37')]){_0x5e4952[_0x2318ce[_0x4de3('0x3a')]]&&_0x8213ca[_0x4de3('0x10')][_0x4de3('0x38')]({'id':_0x2318ce[_0x4de3('0x36')],'value':_0x5e4952[_0x2318ce['variableName']][_0x4de3('0x29')]()});}else if(_0x2318ce['type']===_0x4de3('0x3b')&&_0x2318ce['Variable']&&_0x2318ce[_0x4de3('0x3c')][_0x4de3('0xf')]&&_0x2318ce[_0x4de3('0x36')]&&_0x2318ce[_0x4de3('0x37')]){_0x5e4952[_0x2318ce['Variable'][_0x4de3('0xf')][_0x4de3('0x34')]()]&&_0x8213ca[_0x4de3('0x10')]['push']({'id':_0x2318ce[_0x4de3('0x36')],'value':_0x5e4952[_0x2318ce['Variable']['name']['toLowerCase']()][_0x4de3('0x29')]()});}});}return _0x8213ca;}exports[_0x4de3('0x3d')]=function(_0x1ac7c3,_0x588fe0,_0x28d877,_0x234ab3,_0x2656db,_0x1e31f7){var _0x3949c8,_0x4f6d60;_0x1e31f7[_0x4de3('0x15')]=intUtil[_0x4de3('0x3e')](_0x1e31f7[_0x4de3('0x15')]);_0x1e31f7[_0x4de3('0x3f')]=intUtil[_0x4de3('0x3e')](_0x1e31f7[_0x4de3('0x3f')]);if(_0x2656db&&_0x2656db[_0x4de3('0x40')]){logger[_0x4de3('0x18')](_0x4de3('0x41'),_0x4de3('0x42'));_0x588fe0[_0x4de3('0x43')]=util['format'](_0x4de3('0x44'),_0x1e31f7[_0x4de3('0x3f')],_0x588fe0[_0x4de3('0x45')],md5(_0x588fe0[_0x4de3('0x45')]));}else{_0x588fe0[_0x4de3('0x43')]='';}headers['Authorization']=getAuth(_0x1e31f7);return getUser(_0x1e31f7,_0x234ab3[_0x4de3('0x20')])['then'](function(_0x1b0b2c){_0x3949c8=_0x1b0b2c;logger['info'](_0x4de3('0x46'),_0x3949c8['id']);return getEndUser(_0x1e31f7,_0x588fe0['calleridname'],_0x588fe0[_0x4de3('0xa')]);})[_0x4de3('0x17')](function(_0x3b6c56){_0x4f6d60=_0x3b6c56;logger[_0x4de3('0x18')](_0x4de3('0x47'),_0x4f6d60['id']);return getTicket(_0x1e31f7,_0x3949c8,_0x4f6d60,_0x28d877,_0x588fe0);})[_0x4de3('0x17')](function(_0x3d10e9){if(_0x3d10e9&&_0x3d10e9['id']){logger[_0x4de3('0x18')](_0x4de3('0x19'));logger['info'](_0x4de3('0x48'),_0x3d10e9['id']);logger[_0x4de3('0x18')]('[QUEUE]',_0x4de3('0x49'));emit(util['format'](_0x4de3('0x4a'),_0x234ab3[_0x4de3('0xf')]),_0x4de3('0x4b'),{'uri':util[_0x4de3('0x14')](_0x4de3('0x4c'),_0x1e31f7['remoteUri'],_0x3d10e9['id'])});}})[_0x4de3('0x4d')](function(_0x2a4c02){logger[_0x4de3('0x4e')](_0x4de3('0x41'),JSON['stringify'](_0x2a4c02));});};exports[_0x4de3('0x4f')]=function(_0x421068,_0xf25ed0,_0x1e6974,_0x2a064f,_0x45e46b,_0x4938ef,_0x5227b2){var _0x2f721b,_0x2e8fea;_0x4938ef[_0x4de3('0x15')]=intUtil[_0x4de3('0x3e')](_0x4938ef[_0x4de3('0x15')]);_0x4938ef[_0x4de3('0x3f')]=intUtil['stripTrailingSlash'](_0x4938ef[_0x4de3('0x3f')]);if(_0x5227b2&&_0x5227b2['recordingFormat']&&_0x5227b2[_0x4de3('0x50')]!=='none'){logger[_0x4de3('0x18')](_0x4de3('0x51'),_0x4de3('0x42'));_0xf25ed0['recordingURL']=util[_0x4de3('0x14')](_0x4de3('0x44'),_0x4938ef[_0x4de3('0x3f')],_0xf25ed0[_0x4de3('0x45')],md5(_0xf25ed0[_0x4de3('0x45')]));}headers[_0x4de3('0x52')]=getAuth(_0x4938ef);return getUser(_0x4938ef,_0x2a064f[_0x4de3('0x20')])[_0x4de3('0x17')](function(_0x1ee6cb){_0x2f721b=_0x1ee6cb;logger[_0x4de3('0x18')](_0x4de3('0x46'),_0x2f721b['id']);return getEndUser(_0x4938ef,_0xf25ed0['destcalleridname'],_0xf25ed0[_0x4de3('0x53')]);})['then'](function(_0x2c4486){_0x2e8fea=_0x2c4486;logger[_0x4de3('0x18')](_0x4de3('0x47'),_0x2e8fea['id']);return getTicket(_0x4938ef,_0x2f721b,_0x2e8fea,_0x1e6974,_0xf25ed0);})['then'](function(_0x5beb8f){if(_0x5beb8f&&_0x5beb8f['id']){logger[_0x4de3('0x18')](_0x4de3('0x19'));logger[_0x4de3('0x18')](_0x4de3('0x48'),_0x5beb8f['id']);logger[_0x4de3('0x18')](_0x4de3('0x51'),_0x4de3('0x49'));emit(util[_0x4de3('0x14')](_0x4de3('0x4a'),_0x2a064f[_0x4de3('0xf')]),_0x4de3('0x4b'),{'uri':util[_0x4de3('0x14')]('%s/helpdesk/tickets/%d',_0x4938ef[_0x4de3('0x15')],_0x5beb8f['id'])});}})[_0x4de3('0x4d')](function(_0x3462be){logger[_0x4de3('0x4e')]('[OUTBOUND]',JSON[_0x4de3('0x2d')](_0x3462be));});};exports['unmanaged']=function(_0x3588fc,_0x486599,_0x495416,_0x13c9fc,_0x2e2531,_0x1098ae){var _0x403ada,_0x52008c;_0x1098ae['remoteUri']=intUtil['stripTrailingSlash'](_0x1098ae[_0x4de3('0x15')]);_0x1098ae[_0x4de3('0x3f')]=intUtil['stripTrailingSlash'](_0x1098ae[_0x4de3('0x3f')]);if(_0x2e2531&&_0x2e2531[_0x4de3('0x40')]){logger[_0x4de3('0x18')]('['+_0x486599[_0x4de3('0x54')][_0x4de3('0x55')]()+']',_0x4de3('0x42'));_0x486599[_0x4de3('0x43')]=util[_0x4de3('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1098ae[_0x4de3('0x3f')],_0x486599[_0x4de3('0x45')],md5(_0x486599[_0x4de3('0x45')]));}else{_0x486599[_0x4de3('0x43')]='';}headers[_0x4de3('0x52')]=getAuth(_0x1098ae);return getUser(_0x1098ae,'')[_0x4de3('0x17')](function(_0x98bd1f){_0x403ada=_0x98bd1f;logger[_0x4de3('0x18')](_0x4de3('0x46'),_0x403ada['id']);return getEndUser(_0x1098ae,_0x486599['calleridname'],_0x486599[_0x4de3('0xa')]);})[_0x4de3('0x17')](function(_0x4076c7){_0x52008c=_0x4076c7;logger[_0x4de3('0x18')](_0x4de3('0x47'),_0x52008c['id']);return getTicket(_0x1098ae,_0x403ada,_0x52008c,_0x495416,_0x486599);})['then'](function(_0x3043cd){if(_0x3043cd){logger[_0x4de3('0x18')](_0x4de3('0x19'));logger[_0x4de3('0x18')](_0x4de3('0x48'),_0x3043cd['id']);}})[_0x4de3('0x4d')](function(_0x13186a){logger[_0x4de3('0x4e')]('['+_0x486599[_0x4de3('0x54')][_0x4de3('0x55')]()+']',JSON[_0x4de3('0x2d')](_0x13186a));});}; \ 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 14548f4..d87af7b 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 _0xaeab=['email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length'];(function(_0x5ce17e,_0xb0b208){var _0x6e971c=function(_0x441b8f){while(--_0x441b8f){_0x5ce17e['push'](_0x5ce17e['shift']());}};_0x6e971c(++_0xb0b208);}(_0xaeab,0x91));var _0xbaea=function(_0x584177,_0x46e23b){_0x584177=_0x584177-0x0;var _0x57f394=_0xaeab[_0x584177];return _0x57f394;};'use strict';var _=require(_0xbaea('0x0'));var rp=require('request-promise');var md5=require(_0xbaea('0x1'));var util=require('util');var moment=require(_0xbaea('0x2'));var Promise=require(_0xbaea('0x3'));var Redis=require(_0xbaea('0x4'));var intUtil=require(_0xbaea('0x5'));var config=require(_0xbaea('0x6'));var logger=require(_0xbaea('0x7'))(_0xbaea('0x8'));config[_0xbaea('0x9')]=_[_0xbaea('0xa')](config[_0xbaea('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbaea('0xb'))(new Redis(config[_0xbaea('0x9')]));function getAdminId(_0x202d96,_0x2136d5,_0x1340c7,_0x1031ad){return new Promise(function(_0x1439b0,_0x1ac9ba){var _0x57f8c1=![];var _0x1a7cde={'method':_0xbaea('0xc'),'uri':_0x1031ad+_0xbaea('0xd'),'json':!![]};_0x1a7cde[_0xbaea('0xe')]=_0x1340c7;logger[_0xbaea('0xf')]('Getting\x20admin\x20information');return rp(_0x1a7cde)[_0xbaea('0x10')](function(_0x264a7e){if(_0x264a7e){var _0x4c7215=_0x264a7e[_0xbaea('0x11')];var _0x3d85f5=null;for(_0x3d85f5=0x0;_0x3d85f5<_0x4c7215[_0xbaea('0x12')];_0x3d85f5++){if(_0x4c7215[_0x3d85f5][_0xbaea('0x13')]===_0x202d96[_0xbaea('0x14')]){_0x202d96[_0xbaea('0x15')]=_0x4c7215[_0x3d85f5]['id'];_0x57f8c1=!![];}}if(_0x57f8c1){logger['info']('Admin\x20found:',_0x202d96[_0xbaea('0x15')]);_0x1439b0(_0x202d96);}else{_0x1ac9ba({'statusCode':0x194,'message':_0xbaea('0x16')});}}else{_0x1ac9ba({'statusCode':0x194,'message':_0xbaea('0x16')});}})[_0xbaea('0x17')](function(_0x3c7ee7){logger['error']('['+[_0x2136d5['toUpperCase']()]+']',_0x3c7ee7[_0xbaea('0x18')]);_0x1ac9ba(_0x3c7ee7);});});}function getUser(_0x18c259,_0x550e66,_0xd90639){return function(_0x385382){return new Promise(function(_0x28e71c,_0x20078e){var _0x33fa58={'method':_0xbaea('0xc'),'uri':_0xd90639+'/api/selector/owners','json':!![]};_0x33fa58['headers']=_0x550e66;logger['info']('Getting\x20user\x20list');return rp(_0x33fa58)[_0xbaea('0x10')](function(_0x258498){if(_0x258498){var _0x114b7f=_0x258498[_0xbaea('0x11')];var _0x1962d9=![];var _0x57adc2=null;if(_0x385382[_0xbaea('0x19')]!==null){logger[_0xbaea('0xf')](_0xbaea('0x1a'),_0x385382[_0xbaea('0x19')]);_0x385382[_0xbaea('0x1b')]=_0x385382[_0xbaea('0x19')];for(_0x57adc2=0x0;_0x57adc2<_0x114b7f[_0xbaea('0x12')];_0x57adc2++){if(_0x114b7f[_0x57adc2][_0xbaea('0x13')]===_0x385382['agentEmail']){_0x1962d9=!![];_0x385382[_0xbaea('0x1c')]=_0x114b7f[_0x57adc2]['id'];logger['info'](_0xbaea('0x1d'),_0x385382[_0xbaea('0x1c')]);}}}if(!_0x1962d9){logger['info']('Admin\x20selected');_0x385382['userEmail']=_0x385382[_0xbaea('0x14')];_0x385382[_0xbaea('0x1c')]=_0x385382[_0xbaea('0x15')];_0x1962d9=!![];}if(_0x1962d9){_0x28e71c(_0x385382);}else{_0x20078e({'statusCode':0x194,'message':_0xbaea('0x16')});}}else{_0x20078e({'statusCode':0x194,'message':_0xbaea('0x16')});}})[_0xbaea('0x17')](function(_0x5c8e10){logger[_0xbaea('0x1e')]('['+[_0x18c259[_0xbaea('0x1f')]()]+']',_0x5c8e10['message']);_0x20078e(_0x5c8e10);});});};}function searchContact(_0x2785bb,_0x2378f8,_0x8566e8,_0x35db11){return new Promise(function(_0x2ad9c9,_0x2228c){var _0x86d381={'method':_0xbaea('0xc'),'headers':_0x2378f8,'uri':_0x2785bb+_0xbaea('0x20')+_0x35db11+_0xbaea('0x21')+_0x8566e8+_0xbaea('0x22'),'json':!![]};rp(_0x86d381)[_0xbaea('0x10')](function(_0x538112){var _0x2c3048=_[_0xbaea('0x23')](_0x538112[_0xbaea('0x24')][_0xbaea('0x24')],[_0x8566e8,_0x35db11]);_0x2ad9c9(_0x2c3048);})[_0xbaea('0x17')](function(_0x1553aa){_0x2228c(_0x1553aa);});});}function getEndUser(_0x4bb167,_0x2ec083,_0x47b18b){return function(_0x120b6a){return new Promise(function(_0xc6c0d,_0x44d4d4){logger[_0xbaea('0xf')](util[_0xbaea('0x25')](_0xbaea('0x26'),_0x120b6a[_0xbaea('0x27')]));searchContact(_0x47b18b,_0x2ec083,_0xbaea('0x28'),_0x120b6a[_0xbaea('0x27')])[_0xbaea('0x10')](function(_0x2bfff6){if(_0x2bfff6){_0x120b6a[_0xbaea('0x29')]=_0x2bfff6['id'];logger[_0xbaea('0xf')]('Contact\x20found\x20mobile_number:',_0x120b6a[_0xbaea('0x29')]);return _0xc6c0d(_0x120b6a);}searchContact(_0x47b18b,_0x2ec083,'work_number',_0x120b6a[_0xbaea('0x27')])[_0xbaea('0x10')](function(_0x4ed438){if(_0x4ed438){_0x120b6a[_0xbaea('0x29')]=_0x4ed438['id'];logger[_0xbaea('0xf')]('Contact\x20found\x20work_number:',_0x120b6a['endUserId']);return _0xc6c0d(_0x120b6a);}createEndUser(_0x120b6a,_0x4bb167,_0x2ec083,_0x47b18b)[_0xbaea('0x10')](function(_0x2b639d){logger[_0xbaea('0xf')](_0xbaea('0x2a'),_0x2b639d[_0xbaea('0x29')]);return _0xc6c0d(_0x2b639d);});});})[_0xbaea('0x17')](function(_0x55b8f8){_0x44d4d4(_0x55b8f8);});});};}function createEndUser(_0x5abda6,_0x6cc624,_0x14a3dd,_0x3a672f){return new Promise(function(_0x37b765,_0x7bd5af){var _0x58f138=moment();var _0x248b85={'method':_0xbaea('0x2b'),'uri':_0x3a672f+_0xbaea('0x2c'),'body':{'contact':{'last_name':_0x5abda6['contactNumber'],'work_number':_0x5abda6[_0xbaea('0x27')],'mobile_number':_0x5abda6[_0xbaea('0x27')],'owner_id':_0x5abda6[_0xbaea('0x1c')],'created_at':_0x58f138[_0xbaea('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x248b85[_0xbaea('0xe')]=_0x14a3dd;logger[_0xbaea('0xf')](_0xbaea('0x2d'));return rp(_0x248b85)[_0xbaea('0x10')](function(_0x526928){_0x5abda6[_0xbaea('0x29')]=_0x526928[_0xbaea('0x2e')]['id'];_0x37b765(_0x5abda6);})[_0xbaea('0x17')](function(_0x5925e1){logger[_0xbaea('0x1e')]('['+[_0x6cc624[_0xbaea('0x1f')]()]+']',_0x5925e1[_0xbaea('0x18')]);_0x7bd5af(_0x5925e1[_0xbaea('0x18')]);});});}function getTicket(_0x33b350,_0xfb2c85,_0x4efba4,_0x3703c9,_0x4ca155){return function(_0x100a5a){logger[_0xbaea('0xf')](_0xbaea('0x2f'));return new Promise(function(_0x3a60de,_0x126e4f){var _0x3b3ba7=moment();var _0x3b147c={'method':'POST','uri':_0x4efba4+_0xbaea('0x30'),'body':{'title':intUtil[_0xbaea('0x31')](_0x3703c9['Subjects'],_0x4ca155,'\x20'),'description':intUtil['getString'](_0x3703c9[_0xbaea('0x32')],_0x4ca155,'\x0a'),'owner_id':_0x100a5a[_0xbaea('0x1c')],'creater_id':_0x100a5a[_0xbaea('0x15')],'targetable_id':_0x100a5a[_0xbaea('0x29')],'targetable_type':_0xbaea('0x33'),'created_at':_0x3b3ba7[_0xbaea('0x25')](_0xbaea('0x34')),'due_date':_0x3b3ba7[_0xbaea('0x35')](0x1e,'m')[_0xbaea('0x25')](_0xbaea('0x34'))},'json':!![]};_0x3b147c[_0xbaea('0xe')]=_0xfb2c85;return rp(_0x3b147c)[_0xbaea('0x10')](function(_0x452a31){_0x100a5a[_0xbaea('0x36')]=_0x452a31['task']['id'];logger[_0xbaea('0xf')]('Task\x20created:',_0x100a5a['ticketId']);_0x3a60de(_0x100a5a);})[_0xbaea('0x17')](function(_0x574028){logger['error']('['+[_0x33b350['toUpperCase']()]+']',_0x574028[_0xbaea('0x18')]);_0x126e4f(_0x574028[_0xbaea('0x18')]);});});};}function emit(_0x464736,_0x3096e9,_0x39c2d4){var _0xc9f3a1={'uri':_0x464736+_0xbaea('0x37')+_0x39c2d4};io['to'](util[_0xbaea('0x25')](_0xbaea('0x38'),_0x3096e9))[_0xbaea('0x39')](_0xbaea('0x3a'),_0xc9f3a1);}exports['cs']=function(_0x52c096,_0x25e385,_0x1808f0,_0x98de1f,_0x3a393c,_0x2b6fa1,_0x16382a,_0x5e1efe){var _0x5f2e8d={};var _0x412595={'Authorization':_0xbaea('0x3b')+_0x2b6fa1[_0xbaea('0x3c')]};_0x2b6fa1[_0xbaea('0x3d')]=intUtil[_0xbaea('0x3e')](_0x2b6fa1[_0xbaea('0x3d')]);_0x2b6fa1[_0xbaea('0x3f')]=intUtil[_0xbaea('0x3e')](_0x2b6fa1['serverUrl']);var _0x32c96c=_0x2b6fa1[_0xbaea('0x3d')];_0x5f2e8d[_0xbaea('0x14')]=_0x2b6fa1['username'];_0x5f2e8d[_0xbaea('0x27')]=_0x5e1efe['toLowerCase']()===_0xbaea('0x40')?_0x25e385[_0xbaea('0x41')]:_0x25e385[_0xbaea('0x42')];_0x5f2e8d[_0xbaea('0x43')]=_0x5e1efe===_0xbaea('0x44')||_0x5e1efe==='unmanaged'?_0xbaea('0x44'):_0xbaea('0x40');if(_0x98de1f){_0x5f2e8d[_0xbaea('0x19')]=_0x98de1f['email'];}var _0x22d609=util[_0xbaea('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b6fa1['serverUrl'],_0x25e385[_0xbaea('0x45')],md5(_0x25e385[_0xbaea('0x45')]));if(_0x3a393c&&_0x3a393c[_0xbaea('0x46')]){logger[_0xbaea('0xf')](_0xbaea('0x47'),_0xbaea('0x48'));_0x25e385['recordingURL']=_0x22d609;}else if(_0x16382a&&_0x16382a[_0xbaea('0x49')]&&_0x16382a[_0xbaea('0x49')]!==_0xbaea('0x4a')){logger[_0xbaea('0xf')](_0xbaea('0x4b'),_0xbaea('0x48'));_0x25e385['recordingURL']=_0x22d609;}else{_0x25e385[_0xbaea('0x4c')]='';}return getAdminId(_0x5f2e8d,_0x5e1efe,_0x412595,_0x32c96c)[_0xbaea('0x10')](getUser(_0x5e1efe,_0x412595,_0x32c96c))[_0xbaea('0x10')](getEndUser(_0x5e1efe,_0x412595,_0x32c96c))[_0xbaea('0x10')](getTicket(_0x5e1efe,_0x412595,_0x32c96c,_0x1808f0,_0x25e385))[_0xbaea('0x10')](function(_0x53ec05){logger[_0xbaea('0xf')](util[_0xbaea('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x53ec05[_0xbaea('0x36')]));if(_0x5e1efe!==_0xbaea('0x4d')){logger['info']('['+[_0x5e1efe[_0xbaea('0x1f')]()]+']',_0xbaea('0x4e'));emit(_0x32c96c,_0x98de1f[_0xbaea('0x4f')],_0x53ec05[_0xbaea('0x29')]);}})['catch'](function(_0x3fce94){logger[_0xbaea('0x1e')]('['+[_0x5e1efe[_0xbaea('0x1f')]()]+_0xbaea('0x50'),util[_0xbaea('0x51')](_0x3fce94,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfdcd=['Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','error','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase'];(function(_0x2c8ca8,_0x1f2aae){var _0x2e30ed=function(_0x33e774){while(--_0x33e774){_0x2c8ca8['push'](_0x2c8ca8['shift']());}};_0x2e30ed(++_0x1f2aae);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdcd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xdfdc('0x0'));var md5=require(_0xdfdc('0x1'));var util=require(_0xdfdc('0x2'));var moment=require('moment');var Promise=require(_0xdfdc('0x3'));var Redis=require(_0xdfdc('0x4'));var intUtil=require(_0xdfdc('0x5'));var config=require(_0xdfdc('0x6'));var logger=require(_0xdfdc('0x7'))(_0xdfdc('0x8'));config[_0xdfdc('0x9')]=_[_0xdfdc('0xa')](config[_0xdfdc('0x9')],{'host':_0xdfdc('0xb'),'port':0x18eb});var io=require(_0xdfdc('0xc'))(new Redis(config[_0xdfdc('0x9')]));function getAdminId(_0xf45350,_0x580fc7,_0x417ad4,_0xe36cc6){return new Promise(function(_0x4fb1fd,_0x41c1d1){var _0x2c7216=![];var _0x452de2={'method':_0xdfdc('0xd'),'uri':_0xe36cc6+_0xdfdc('0xe'),'json':!![]};_0x452de2['headers']=_0x417ad4;logger[_0xdfdc('0xf')]('Getting\x20admin\x20information');return rp(_0x452de2)['then'](function(_0x29d282){if(_0x29d282){var _0x23a0cc=_0x29d282[_0xdfdc('0x10')];var _0x382a49=null;for(_0x382a49=0x0;_0x382a49<_0x23a0cc[_0xdfdc('0x11')];_0x382a49++){if(_0x23a0cc[_0x382a49][_0xdfdc('0x12')]===_0xf45350[_0xdfdc('0x13')]){_0xf45350['adminId']=_0x23a0cc[_0x382a49]['id'];_0x2c7216=!![];}}if(_0x2c7216){logger[_0xdfdc('0xf')](_0xdfdc('0x14'),_0xf45350[_0xdfdc('0x15')]);_0x4fb1fd(_0xf45350);}else{_0x41c1d1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x41c1d1({'statusCode':0x194,'message':_0xdfdc('0x16')});}})[_0xdfdc('0x17')](function(_0x2b29bc){logger['error']('['+[_0x580fc7[_0xdfdc('0x18')]()]+']',_0x2b29bc['message']);_0x41c1d1(_0x2b29bc);});});}function getUser(_0x30abc2,_0x36aae5,_0x4efb5a){return function(_0x137a48){return new Promise(function(_0x547d05,_0x32c616){var _0x100026={'method':_0xdfdc('0xd'),'uri':_0x4efb5a+_0xdfdc('0xe'),'json':!![]};_0x100026['headers']=_0x36aae5;logger[_0xdfdc('0xf')](_0xdfdc('0x19'));return rp(_0x100026)[_0xdfdc('0x1a')](function(_0x4b849e){if(_0x4b849e){var _0x19a957=_0x4b849e[_0xdfdc('0x10')];var _0x583c9d=![];var _0x4b0cb8=null;if(_0x137a48[_0xdfdc('0x1b')]!==null){logger[_0xdfdc('0xf')](_0xdfdc('0x1c'),_0x137a48[_0xdfdc('0x1b')]);_0x137a48[_0xdfdc('0x1d')]=_0x137a48[_0xdfdc('0x1b')];for(_0x4b0cb8=0x0;_0x4b0cb8<_0x19a957[_0xdfdc('0x11')];_0x4b0cb8++){if(_0x19a957[_0x4b0cb8][_0xdfdc('0x12')]===_0x137a48[_0xdfdc('0x1b')]){_0x583c9d=!![];_0x137a48[_0xdfdc('0x1e')]=_0x19a957[_0x4b0cb8]['id'];logger['info'](_0xdfdc('0x1f'),_0x137a48[_0xdfdc('0x1e')]);}}}if(!_0x583c9d){logger[_0xdfdc('0xf')](_0xdfdc('0x20'));_0x137a48[_0xdfdc('0x1d')]=_0x137a48['adminEmail'];_0x137a48['userId']=_0x137a48['adminId'];_0x583c9d=!![];}if(_0x583c9d){_0x547d05(_0x137a48);}else{_0x32c616({'statusCode':0x194,'message':_0xdfdc('0x16')});}}else{_0x32c616({'statusCode':0x194,'message':_0xdfdc('0x16')});}})[_0xdfdc('0x17')](function(_0x1f44f1){logger[_0xdfdc('0x21')]('['+[_0x30abc2['toUpperCase']()]+']',_0x1f44f1[_0xdfdc('0x22')]);_0x32c616(_0x1f44f1);});});};}function searchContact(_0x1a5d86,_0x8d1742,_0x4e7663,_0x54390f){return new Promise(function(_0x3e061a,_0xc27517){var _0x299528={'method':_0xdfdc('0xd'),'headers':_0x8d1742,'uri':_0x1a5d86+_0xdfdc('0x23')+_0x54390f+_0xdfdc('0x24')+_0x4e7663+_0xdfdc('0x25'),'json':!![]};rp(_0x299528)['then'](function(_0x13c12c){var _0x16e84d=_[_0xdfdc('0x26')](_0x13c12c[_0xdfdc('0x27')][_0xdfdc('0x27')],[_0x4e7663,_0x54390f]);_0x3e061a(_0x16e84d);})[_0xdfdc('0x17')](function(_0x10ed42){_0xc27517(_0x10ed42);});});}function getEndUser(_0xaac285,_0x253dbd,_0x135bdb){return function(_0x493ab4){return new Promise(function(_0x561972,_0x5da60c){logger[_0xdfdc('0xf')](util[_0xdfdc('0x28')](_0xdfdc('0x29'),_0x493ab4[_0xdfdc('0x2a')]));searchContact(_0x135bdb,_0x253dbd,_0xdfdc('0x2b'),_0x493ab4[_0xdfdc('0x2a')])[_0xdfdc('0x1a')](function(_0x2c2976){if(_0x2c2976){_0x493ab4[_0xdfdc('0x2c')]=_0x2c2976['id'];logger[_0xdfdc('0xf')](_0xdfdc('0x2d'),_0x493ab4[_0xdfdc('0x2c')]);return _0x561972(_0x493ab4);}searchContact(_0x135bdb,_0x253dbd,_0xdfdc('0x2e'),_0x493ab4['contactNumber'])[_0xdfdc('0x1a')](function(_0x3de298){if(_0x3de298){_0x493ab4[_0xdfdc('0x2c')]=_0x3de298['id'];logger[_0xdfdc('0xf')]('Contact\x20found\x20work_number:',_0x493ab4[_0xdfdc('0x2c')]);return _0x561972(_0x493ab4);}createEndUser(_0x493ab4,_0xaac285,_0x253dbd,_0x135bdb)[_0xdfdc('0x1a')](function(_0x3ab0dd){logger[_0xdfdc('0xf')]('Contact\x20created:',_0x3ab0dd[_0xdfdc('0x2c')]);return _0x561972(_0x3ab0dd);});});})[_0xdfdc('0x17')](function(_0x340234){_0x5da60c(_0x340234);});});};}function createEndUser(_0xcc37a8,_0x4d8fb4,_0x5ca6cf,_0x380fc7){return new Promise(function(_0x495e62,_0x472350){var _0x4c4fa9=moment();var _0x5c9dbf={'method':'POST','uri':_0x380fc7+_0xdfdc('0x2f'),'body':{'contact':{'last_name':_0xcc37a8['contactNumber'],'work_number':_0xcc37a8[_0xdfdc('0x2a')],'mobile_number':_0xcc37a8[_0xdfdc('0x2a')],'owner_id':_0xcc37a8[_0xdfdc('0x1e')],'created_at':_0x4c4fa9[_0xdfdc('0x28')](_0xdfdc('0x30'))}},'json':!![]};_0x5c9dbf['headers']=_0x5ca6cf;logger[_0xdfdc('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5c9dbf)[_0xdfdc('0x1a')](function(_0x5d45ff){_0xcc37a8['endUserId']=_0x5d45ff[_0xdfdc('0x31')]['id'];_0x495e62(_0xcc37a8);})['catch'](function(_0x4e999d){logger[_0xdfdc('0x21')]('['+[_0x4d8fb4[_0xdfdc('0x18')]()]+']',_0x4e999d[_0xdfdc('0x22')]);_0x472350(_0x4e999d[_0xdfdc('0x22')]);});});}function getTicket(_0xdc3fc2,_0x16270a,_0x4ce612,_0xe77641,_0x2dcdce){return function(_0x296084){logger[_0xdfdc('0xf')](_0xdfdc('0x32'));return new Promise(function(_0x4db402,_0x515eea){var _0x46ffed=moment();var _0x227309={'method':_0xdfdc('0x33'),'uri':_0x4ce612+_0xdfdc('0x34'),'body':{'title':intUtil[_0xdfdc('0x35')](_0xe77641['Subjects'],_0x2dcdce,'\x20'),'description':intUtil[_0xdfdc('0x35')](_0xe77641['Descriptions'],_0x2dcdce,'\x0a'),'owner_id':_0x296084[_0xdfdc('0x1e')],'creater_id':_0x296084[_0xdfdc('0x15')],'targetable_id':_0x296084[_0xdfdc('0x2c')],'targetable_type':_0xdfdc('0x36'),'created_at':_0x46ffed['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x46ffed[_0xdfdc('0x37')](0x1e,'m')[_0xdfdc('0x28')](_0xdfdc('0x30'))},'json':!![]};_0x227309['headers']=_0x16270a;return rp(_0x227309)['then'](function(_0x50f2da){_0x296084[_0xdfdc('0x38')]=_0x50f2da[_0xdfdc('0x39')]['id'];logger['info'](_0xdfdc('0x3a'),_0x296084[_0xdfdc('0x38')]);_0x4db402(_0x296084);})[_0xdfdc('0x17')](function(_0x29dcb6){logger[_0xdfdc('0x21')]('['+[_0xdc3fc2['toUpperCase']()]+']',_0x29dcb6[_0xdfdc('0x22')]);_0x515eea(_0x29dcb6[_0xdfdc('0x22')]);});});};}function emit(_0x390da4,_0xb65f88,_0x161103){var _0x5a8674={'uri':_0x390da4+_0xdfdc('0x3b')+_0x161103};io['to'](util[_0xdfdc('0x28')]('user:%s',_0xb65f88))[_0xdfdc('0x3c')](_0xdfdc('0x3d'),_0x5a8674);}exports['cs']=function(_0x5ee598,_0x36bd40,_0x1c95d8,_0xf1e1a8,_0xcecd00,_0x1b8e87,_0x434b9c,_0x1a1456){var _0x5e645c={};var _0x1207e4={'Authorization':_0xdfdc('0x3e')+_0x1b8e87[_0xdfdc('0x3f')]};_0x1b8e87[_0xdfdc('0x40')]=intUtil[_0xdfdc('0x41')](_0x1b8e87[_0xdfdc('0x40')]);_0x1b8e87[_0xdfdc('0x42')]=intUtil[_0xdfdc('0x41')](_0x1b8e87[_0xdfdc('0x42')]);var _0x126177=_0x1b8e87[_0xdfdc('0x40')];_0x5e645c[_0xdfdc('0x13')]=_0x1b8e87[_0xdfdc('0x43')];_0x5e645c['contactNumber']=_0x1a1456[_0xdfdc('0x44')]()===_0xdfdc('0x45')?_0x36bd40[_0xdfdc('0x46')]:_0x36bd40[_0xdfdc('0x47')];_0x5e645c[_0xdfdc('0x48')]=_0x1a1456===_0xdfdc('0x49')||_0x1a1456==='unmanaged'?_0xdfdc('0x49'):'outbound';if(_0xf1e1a8){_0x5e645c[_0xdfdc('0x1b')]=_0xf1e1a8[_0xdfdc('0x12')];}var _0x4bfe54=util[_0xdfdc('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b8e87[_0xdfdc('0x42')],_0x36bd40[_0xdfdc('0x4a')],md5(_0x36bd40['uniqueid']));if(_0xcecd00&&_0xcecd00[_0xdfdc('0x4b')]){logger[_0xdfdc('0xf')](_0xdfdc('0x4c'),_0xdfdc('0x4d'));_0x36bd40[_0xdfdc('0x4e')]=_0x4bfe54;}else if(_0x434b9c&&_0x434b9c[_0xdfdc('0x4f')]&&_0x434b9c[_0xdfdc('0x4f')]!==_0xdfdc('0x50')){logger[_0xdfdc('0xf')](_0xdfdc('0x51'),_0xdfdc('0x4d'));_0x36bd40[_0xdfdc('0x4e')]=_0x4bfe54;}else{_0x36bd40[_0xdfdc('0x4e')]='';}return getAdminId(_0x5e645c,_0x1a1456,_0x1207e4,_0x126177)['then'](getUser(_0x1a1456,_0x1207e4,_0x126177))[_0xdfdc('0x1a')](getEndUser(_0x1a1456,_0x1207e4,_0x126177))['then'](getTicket(_0x1a1456,_0x1207e4,_0x126177,_0x1c95d8,_0x36bd40))['then'](function(_0x4bc091){logger['info'](util[_0xdfdc('0x28')](_0xdfdc('0x52'),_0x4bc091[_0xdfdc('0x38')]));if(_0x1a1456!==_0xdfdc('0x53')){logger[_0xdfdc('0xf')]('['+[_0x1a1456[_0xdfdc('0x18')]()]+']',_0xdfdc('0x54'));emit(_0x126177,_0xf1e1a8[_0xdfdc('0x55')],_0x4bc091['endUserId']);}})[_0xdfdc('0x17')](function(_0x5450f7){logger[_0xdfdc('0x21')]('['+[_0x1a1456[_0xdfdc('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x5450f7,{'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 9c00897..17c0ee2 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 _0x8f4c=['zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','unmanaged','zendesk','salesforce','sugarcrm'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3be379,_0x3b33cf){_0x3be379=_0x3be379-0x0;var _0xf389d=_0x8f4c[_0x3be379];return _0xf389d;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var zendesk=require(_0xc8f4('0x2'));var salesforce=require(_0xc8f4('0x3'));var sugarcrm=require(_0xc8f4('0x4'));var freshdesk=require(_0xc8f4('0x5'));var zoho=require('./zoho');var desk=require(_0xc8f4('0x6'));var vtiger=require(_0xc8f4('0x7'));var servicenow=require(_0xc8f4('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc8f4('0x9'));var integrations=['zendesk','salesforce','sugarcrm',_0xc8f4('0xa'),'zoho',_0xc8f4('0xb'),_0xc8f4('0xc'),_0xc8f4('0xd'),_0xc8f4('0xe'),_0xc8f4('0xf')];exports['exec']=function(_0x38c41b,_0x191b92,_0x2fba62,_0x3a2f8a,_0x4fd453,_0x26f83){if(_0x2fba62){if(_['includes'](integrations,_0x38c41b[_0xc8f4('0x10')][_0xc8f4('0x11')]())){try{var _0x45ed6b=null;var _0x729f8f='';var _0x39b785=_0x2fba62[_0x38c41b['data1'][_0xc8f4('0x11')]()];if(_0x39b785){var _0x377c2b=_0x39b785[_0x38c41b[_0xc8f4('0x12')]];if(_0x377c2b){var _0x14bc11=_[_0xc8f4('0x13')](_0x377c2b[_0xc8f4('0x14')],{'id':parseInt(_0x38c41b['data3'],0xa)});if(_0x14bc11){if(_0x3a2f8a){if(_0x4fd453&&_0x191b92[_0xc8f4('0x15')]){_0x729f8f=_0xc8f4('0x15');}else if(_0x191b92[_0xc8f4('0x16')]){_0x729f8f=_0xc8f4('0x17');}else{console[_0xc8f4('0x18')]('EVENT\x20UNKNOWN',_0x191b92);}}else{_0x729f8f=_0xc8f4('0x19');}switch(_0x38c41b['data1']['toLowerCase']()){case _0xc8f4('0x1a'):zendesk[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0x1b'):salesforce[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0x1c'):sugarcrm[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xa'):freshdesk[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0x1d'):zoho[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xb'):desk[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xc'):vtiger[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xe'):freshsales['cs'](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83,_0x729f8f);break;case _0xc8f4('0xf'):servicenow['cs'](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83,_0x729f8f);break;case _0xc8f4('0xd'):dynamics365['cs'](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83,_0x729f8f);break;default:console[_0xc8f4('0x18')](_0xc8f4('0x1e'));}}else{_0x45ed6b=require(_0xc8f4('0x1f'))(_0x38c41b['data1'][_0xc8f4('0x11')]());_0x45ed6b[_0xc8f4('0x20')](_0xc8f4('0x21'),util[_0xc8f4('0x22')](_0xc8f4('0x23'),_0x38c41b[_0xc8f4('0x10')][_0xc8f4('0x11')](),_0x38c41b[_0xc8f4('0x24')]));}}else{_0x45ed6b=require('../../../../config/logger')(_0x38c41b[_0xc8f4('0x10')][_0xc8f4('0x11')]());_0x45ed6b[_0xc8f4('0x20')](_0xc8f4('0x21'),util['format'](_0xc8f4('0x25'),_0x38c41b['data1'][_0xc8f4('0x11')](),_0x38c41b['data2']));}}else{}}catch(_0x177a44){console[_0xc8f4('0x20')](_0x177a44);}}}}; \ No newline at end of file +var _0x4cf8=['./freshsales','sugarcrm','zoho','desk','dynamics365','freshsales','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce','freshdesk','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365'];(function(_0x13b67d,_0x4f4f16){var _0x49409b=function(_0x1ce917){while(--_0x1ce917){_0x13b67d['push'](_0x13b67d['shift']());}};_0x49409b(++_0x4f4f16);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x451d04,_0x999e7d){_0x451d04=_0x451d04-0x0;var _0x32c6fe=_0x4cf8[_0x451d04];return _0x32c6fe;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var zendesk=require(_0x84cf('0x2'));var salesforce=require(_0x84cf('0x3'));var sugarcrm=require(_0x84cf('0x4'));var freshdesk=require(_0x84cf('0x5'));var zoho=require(_0x84cf('0x6'));var desk=require(_0x84cf('0x7'));var vtiger=require(_0x84cf('0x8'));var servicenow=require(_0x84cf('0x9'));var dynamics365=require(_0x84cf('0xa'));var freshsales=require(_0x84cf('0xb'));var integrations=['zendesk','salesforce',_0x84cf('0xc'),'freshdesk',_0x84cf('0xd'),_0x84cf('0xe'),'vtiger',_0x84cf('0xf'),_0x84cf('0x10'),'servicenow'];exports[_0x84cf('0x11')]=function(_0x1b223d,_0x390ce9,_0x369ce6,_0x50d667,_0x5a8bb1,_0x137dd7){if(_0x369ce6){if(_['includes'](integrations,_0x1b223d['data1'][_0x84cf('0x12')]())){try{var _0x27efbf=null;var _0x35f852='';var _0x33f83e=_0x369ce6[_0x1b223d[_0x84cf('0x13')][_0x84cf('0x12')]()];if(_0x33f83e){var _0x1fd6cb=_0x33f83e[_0x1b223d[_0x84cf('0x14')]];if(_0x1fd6cb){var _0xced48=_[_0x84cf('0x15')](_0x1fd6cb[_0x84cf('0x16')],{'id':parseInt(_0x1b223d[_0x84cf('0x17')],0xa)});if(_0xced48){if(_0x50d667){if(_0x5a8bb1&&_0x390ce9[_0x84cf('0x18')]){_0x35f852=_0x84cf('0x18');}else if(_0x390ce9[_0x84cf('0x19')]){_0x35f852=_0x84cf('0x1a');}else{console[_0x84cf('0x1b')](_0x84cf('0x1c'),_0x390ce9);}}else{_0x35f852=_0x84cf('0x1d');}switch(_0x1b223d['data1'][_0x84cf('0x12')]()){case _0x84cf('0x1e'):zendesk[_0x35f852](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7);break;case _0x84cf('0x1f'):salesforce[_0x35f852](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7);break;case _0x84cf('0xc'):sugarcrm[_0x35f852](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7);break;case _0x84cf('0x20'):freshdesk[_0x35f852](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7);break;case _0x84cf('0xd'):zoho[_0x35f852](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7);break;case _0x84cf('0xe'):desk[_0x35f852](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7);break;case'vtiger':vtiger[_0x35f852](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7);break;case'freshsales':freshsales['cs'](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7,_0x35f852);break;case _0x84cf('0x21'):servicenow['cs'](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7,_0x35f852);break;case _0x84cf('0xf'):dynamics365['cs'](_0x1b223d,_0x390ce9,_0xced48,_0x50d667,_0x5a8bb1,_0x1fd6cb,_0x137dd7,_0x35f852);break;default:console[_0x84cf('0x1b')](_0x84cf('0x22'));}}else{_0x27efbf=require(_0x84cf('0x23'))(_0x1b223d['data1'][_0x84cf('0x12')]());_0x27efbf[_0x84cf('0x24')](_0x84cf('0x25'),util[_0x84cf('0x26')](_0x84cf('0x27'),_0x1b223d['data1'][_0x84cf('0x12')](),_0x1b223d[_0x84cf('0x17')]));}}else{_0x27efbf=require(_0x84cf('0x23'))(_0x1b223d[_0x84cf('0x13')][_0x84cf('0x12')]());_0x27efbf[_0x84cf('0x24')](_0x84cf('0x25'),util['format'](_0x84cf('0x28'),_0x1b223d[_0x84cf('0x13')][_0x84cf('0x12')](),_0x1b223d[_0x84cf('0x14')]));}}else{}}catch(_0x1d220a){console[_0x84cf('0x24')](_0x1d220a);}}}}; \ 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 9f14eb5..cd8542e 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 _0xc330=['request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','ticketType','assign','utc','getString','Subjects','Descriptions','Case','sobject','create','isNil','validateEmail','find','execute','length','Email','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','resolve','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','format','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.'];(function(_0x3c12f5,_0x2dd4b9){var _0x40fcad=function(_0x46b9f6){while(--_0x46b9f6){_0x3c12f5['push'](_0x3c12f5['shift']());}};_0x40fcad(++_0x2dd4b9);}(_0xc330,0xe2));var _0x0c33=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc330[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var rp=require(_0x0c33('0x0'));var moment=require(_0x0c33('0x1'));var BPromise=require(_0x0c33('0x2'));var md5=require('md5');var jsforce=require(_0x0c33('0x3'));var util=require('util');var Redis=require(_0x0c33('0x4'));var intUtil=require(_0x0c33('0x5'));var config=require(_0x0c33('0x6'));var logger=require(_0x0c33('0x7'))(_0x0c33('0x8'));config[_0x0c33('0x9')]=_['defaults'](config[_0x0c33('0x9')],{'host':_0x0c33('0xa'),'port':0x18eb});var io=require(_0x0c33('0xb'))(new Redis(config[_0x0c33('0x9')]));function emit(_0x36ad9f,_0x4e15c3,_0x308e32){io['to'](_0x36ad9f)[_0x0c33('0xc')](_0x4e15c3,_0x308e32);}function getTicket(_0x1befd2,_0x3dde79,_0x5a6bae,_0x2bf539,_0x5ef6c5,_0x5d3384,_0x4a0e6d,_0x268146){var _0x2f1273={};if(_0x2bf539[_0x0c33('0xd')]==='Task'){_0x2f1273=Object[_0x0c33('0xe')]({},{'OwnerId':_0x3dde79['id'],'ActivityDate':moment[_0x0c33('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0c33('0x10')](_0x2bf539[_0x0c33('0x11')],_0x5ef6c5,'\x20'),'Description':intUtil[_0x0c33('0x10')](_0x2bf539[_0x0c33('0x12')],_0x5ef6c5,'\x0a')},getCustomFields(_0x5d3384,_0x5ef6c5));if(_0x5a6bae){_0x2f1273['WhoId']=_0x5a6bae['id'];}}else if(_0x2bf539[_0x0c33('0xd')]===_0x0c33('0x13')){_0x2f1273=Object[_0x0c33('0xe')]({},{'OwnerId':_0x3dde79['id'],'Subject':intUtil['getString'](_0x2bf539[_0x0c33('0x11')],_0x5ef6c5,'\x20'),'Description':intUtil['getString'](_0x2bf539[_0x0c33('0x12')],_0x5ef6c5,'\x0a')},getCustomFields(_0x5d3384,_0x5ef6c5));if(_0x5a6bae){_0x2f1273['ContactId']=_0x5a6bae['id'];}}return _0x4a0e6d[_0x0c33('0x14')](_0x2bf539[_0x0c33('0xd')])[_0x0c33('0x15')](_0x2f1273);}function getUser(_0x55e995,_0x329a51,_0x45cc69){if(!_[_0x0c33('0x16')](_0x329a51)&&intUtil[_0x0c33('0x17')](_0x329a51)){var _0x30c059={'Email':_0x329a51};var _0x34ae47={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x45cc69[_0x0c33('0x14')]('User')[_0x0c33('0x18')](_0x30c059,_0x34ae47)[_0x0c33('0x19')]()['then'](function(_0x55af0e){if(_0x55af0e[_0x0c33('0x1a')]){var _0x395bf0=_['find'](_0x55af0e,function(_0x49d80a){return _0x49d80a[_0x0c33('0x1b')]===_0x329a51;});if(_0x395bf0){logger['info']('Agent\x20%s\x20found.',_0x329a51);return BPromise['resolve']({'id':_0x395bf0['Id'],'name':_0x395bf0[_0x0c33('0x1c')]});}}else{logger[_0x0c33('0x1d')](_0x0c33('0x1e'),_0x329a51);return _0x45cc69[_0x0c33('0x1f')]()[_0x0c33('0x20')](function(_0x247b9b){return BPromise['resolve']({'id':_0x247b9b[_0x0c33('0x21')],'name':_0x247b9b['display_name']});});}});}else{logger['info'](_0x0c33('0x1e'),_0x329a51);return _0x45cc69[_0x0c33('0x1f')]()['then'](function(_0x2a28b7){return BPromise[_0x0c33('0x22')]({'id':_0x2a28b7[_0x0c33('0x21')],'name':_0x2a28b7['display_name']});});}}function getEndUser(_0x1d12a8,_0x6582b7,_0x2c6fd1,_0x1db6bf,_0x517fba){var _0x36280f={'Phone':_0x1db6bf};var _0x5e821f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x0c33('0x20')](function(){if(_0x6582b7[_0x0c33('0xd')]===_0x0c33('0x23')){logger[_0x0c33('0x1d')](_0x0c33('0x24'),_0x1db6bf,_0x6582b7[_0x0c33('0x25')]);switch(_0x6582b7['moduleSearch']){case _0x0c33('0x26'):return _0x517fba['sobject'](_0x0c33('0x27'))['find'](_0x36280f,_0x5e821f)[_0x0c33('0x19')]()[_0x0c33('0x20')](function(_0x1c4485){if(_0x1c4485&&_0x1c4485[_0x0c33('0x1a')]){return _0x1c4485;}else{return _0x517fba['sobject'](_0x0c33('0x28'))['find'](_0x36280f,_0x5e821f);}});case _0x0c33('0x29'):return _0x517fba['sobject'](_0x0c33('0x27'))['find'](_0x36280f,_0x5e821f)[_0x0c33('0x19')]();case _0x0c33('0x2a'):return _0x517fba[_0x0c33('0x14')](_0x0c33('0x28'))[_0x0c33('0x18')](_0x36280f,_0x5e821f);default:return null;}}else if(_0x6582b7['ticketType']==='Case'){logger['info'](_0x0c33('0x24'),_0x1db6bf,_0x0c33('0x29'));return _0x517fba['sobject'](_0x0c33('0x27'))[_0x0c33('0x18')](_0x36280f,_0x5e821f)[_0x0c33('0x19')]();}})['then'](function(_0x17d3b7){if(_0x17d3b7&&_0x17d3b7['length']){var _0x4c931b=_['find'](_0x17d3b7,function(_0x2aee1a){return _0x2aee1a['Phone']===_0x1db6bf;});if(_0x4c931b){return BPromise['resolve']({'id':_0x4c931b['Id'],'name':_0x4c931b[_0x0c33('0x1c')],'phone':_0x4c931b[_0x0c33('0x2b')]});}}})[_0x0c33('0x20')](function(_0x254d9a){if(_0x254d9a){logger[_0x0c33('0x1d')](_0x0c33('0x2c'),_0x1db6bf);return BPromise[_0x0c33('0x22')](_0x254d9a);}else{logger[_0x0c33('0x1d')](_0x0c33('0x2d'),_0x1db6bf);var _0x4c4740={'LastName':_0x2c6fd1!==_0x0c33('0x2e')?_0x2c6fd1:util['format'](_0x0c33('0x2f'),_0x1db6bf),'Phone':_0x1db6bf};if(_0x6582b7[_0x0c33('0x30')]){if(_0x6582b7['moduleCreate']===_0x0c33('0x29')){logger['info'](_0x0c33('0x31'),_0x1db6bf,_0x6582b7[_0x0c33('0x30')]);}else if(_0x6582b7['moduleCreate']===_0x0c33('0x2a')&&_0x6582b7['ticketType']===_0x0c33('0x23')){logger[_0x0c33('0x1d')](_0x0c33('0x31'),_0x1db6bf,_0x6582b7[_0x0c33('0x30')]);_0x4c4740[_0x0c33('0x32')]=_0x0c33('0x33');}else{return null;}}return _0x517fba[_0x0c33('0x14')](_[_0x0c33('0x34')](_0x6582b7[_0x0c33('0x30')]))[_0x0c33('0x15')](_0x4c4740);}});}function getCustomFields(_0x52e4b4,_0x197655){var _0xed2a93={};if(_0x52e4b4[_0x0c33('0x1a')]>0x0){_[_0x0c33('0x35')](_0x52e4b4,function(_0x5c9559){if(_0x5c9559['type']===_0x0c33('0x36')&&_0x5c9559[_0x0c33('0x37')]){_0xed2a93[_0x5c9559['idField']]=_0x5c9559[_0x0c33('0x38')]['toString']();}else if(_0x5c9559[_0x0c33('0x39')]===_0x0c33('0x3a')&&_0x5c9559['variableName']&&_0x5c9559[_0x0c33('0x37')]){_0x197655[_0x5c9559[_0x0c33('0x3b')]]&&(_0xed2a93[_0x5c9559[_0x0c33('0x37')]]=_0x197655[_0x5c9559[_0x0c33('0x3b')]][_0x0c33('0x3c')]());}else if(_0x5c9559[_0x0c33('0x39')]===_0x0c33('0x3d')&&_0x5c9559[_0x0c33('0x3e')]&&_0x5c9559['Variable'][_0x0c33('0x3f')]&&_0x5c9559[_0x0c33('0x37')]){_0x197655[_0x5c9559[_0x0c33('0x3e')]['name'][_0x0c33('0x40')]()]&&(_0xed2a93[_0x5c9559['idField']]=_0x197655[_0x5c9559[_0x0c33('0x3e')][_0x0c33('0x3f')][_0x0c33('0x40')]()][_0x0c33('0x3c')]());}});}return _0xed2a93;}function getConnection(_0x29a28c){var _0x289115=_0x29a28c[_0x0c33('0x41')][_0x0c33('0x42')](_0x29a28c[_0x0c33('0x43')]);var _0x858649=new jsforce[(_0x0c33('0x44'))]({'oauth2':{'loginUrl':_0x29a28c[_0x0c33('0x45')]||_0x0c33('0x46'),'clientId':_0x29a28c[_0x0c33('0x47')],'clientSecret':_0x29a28c[_0x0c33('0x48')]}});return _0x858649[_0x0c33('0x49')](_0x29a28c['username'],_0x289115)[_0x0c33('0x20')](function(){logger['info'](_0x0c33('0x4a'));return _0x858649;});}exports[_0x0c33('0x4b')]=function(_0x12b21a,_0x5628da,_0xdaf425,_0x1e5e0a,_0x5648a0,_0x4607c6){var _0x2c7e9e,_0xbf2660,_0x355488,_0x5a77d8;_0x4607c6[_0x0c33('0x4c')]=intUtil[_0x0c33('0x4d')](_0x4607c6[_0x0c33('0x4c')]);_0x4607c6[_0x0c33('0x45')]=intUtil[_0x0c33('0x4d')](_0x4607c6[_0x0c33('0x45')]);if(_0x5648a0&&_0x5648a0[_0x0c33('0x4e')]){logger[_0x0c33('0x1d')](_0x0c33('0x4f'),_0x0c33('0x50'));_0x5628da['recordingURL']=util[_0x0c33('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4607c6[_0x0c33('0x4c')],_0x5628da['uniqueid'],md5(_0x5628da[_0x0c33('0x52')]));}else{_0x5628da[_0x0c33('0x53')]='';}return getConnection(_0x4607c6)['then'](function(_0x5f34f0){_0x5a77d8=_0x5f34f0;return getUser(_0x4607c6,_0x1e5e0a[_0x0c33('0x54')],_0x5a77d8);})[_0x0c33('0x20')](function(_0x1649d6){_0x2c7e9e=_0x1649d6;return getEndUser(_0x4607c6,_0xdaf425,_0x5628da[_0x0c33('0x55')],_0x5628da[_0x0c33('0x56')],_0x5a77d8);})[_0x0c33('0x20')](function(_0xe71fb8){_0xbf2660=_0xe71fb8;return getTicket(_0x4607c6,_0x2c7e9e,_0xbf2660,_0xdaf425,_0x5628da,_0xdaf425[_0x0c33('0x57')],_0x5a77d8,_0x0c33('0x4b'));})[_0x0c33('0x20')](function(_0xe80642){_0x355488=_0xe80642;logger['info'](_0x0c33('0x58'),_0x355488['id']);logger[_0x0c33('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x355488['id'],_0x1e5e0a['name'],_0x4607c6[_0x0c33('0x39')]);switch(_0x4607c6[_0x0c33('0x39')]){case'integrationTab':emit(util[_0x0c33('0x51')](_0x0c33('0x59'),_0x1e5e0a[_0x0c33('0x3f')]),_0x0c33('0x5a'),{'recordId':_0x355488['id']});break;case _0x0c33('0x5b'):emit(util[_0x0c33('0x51')](_0x0c33('0x59'),_0x1e5e0a[_0x0c33('0x3f')]),_0x0c33('0x5c'),{'uri':util['format'](_0x0c33('0x5d'),_0x5a77d8[_0x0c33('0x5e')],_0x355488['id'])});break;default:logger[_0x0c33('0x5f')](_0x0c33('0x60'));}})[_0x0c33('0x61')](function(_0x5cdaa4){logger[_0x0c33('0x5f')](_0x0c33('0x4f'),JSON[_0x0c33('0x62')](_0x5cdaa4));});};exports[_0x0c33('0x63')]=function(_0x2b999c,_0x479851,_0x40f44b,_0x359fb1,_0x330fec,_0x36b63f,_0x1daa51){var _0x464654,_0x43eb4e,_0x3ebc4b,_0x3d474e;_0x36b63f[_0x0c33('0x4c')]=intUtil['stripTrailingSlash'](_0x36b63f['serverUrl']);_0x36b63f[_0x0c33('0x45')]=intUtil['stripTrailingSlash'](_0x36b63f[_0x0c33('0x45')]);if(_0x1daa51&&_0x1daa51[_0x0c33('0x64')]&&_0x1daa51[_0x0c33('0x64')]!==_0x0c33('0x65')){logger[_0x0c33('0x1d')](_0x0c33('0x66'),_0x0c33('0x50'));_0x479851[_0x0c33('0x53')]=util[_0x0c33('0x51')](_0x0c33('0x67'),_0x36b63f[_0x0c33('0x4c')],_0x479851[_0x0c33('0x52')],md5(_0x479851[_0x0c33('0x52')]));}return getConnection(_0x36b63f)[_0x0c33('0x20')](function(_0x5e9f90){_0x3d474e=_0x5e9f90;return getUser(_0x36b63f,_0x359fb1[_0x0c33('0x54')],_0x3d474e);})[_0x0c33('0x20')](function(_0x36a38c){_0x464654=_0x36a38c;return getEndUser(_0x36b63f,_0x40f44b,_0x479851[_0x0c33('0x68')],_0x479851['destcalleridnum'],_0x3d474e);})['then'](function(_0x2b4ff1){_0x43eb4e=_0x2b4ff1;return getTicket(_0x36b63f,_0x464654,_0x43eb4e,_0x40f44b,_0x479851,_0x40f44b[_0x0c33('0x57')],_0x3d474e,_0x0c33('0x63'));})[_0x0c33('0x20')](function(_0x187906){_0x3ebc4b=_0x187906;logger[_0x0c33('0x1d')](_0x0c33('0x69'),_0x3ebc4b['id']);logger[_0x0c33('0x1d')](_0x0c33('0x6a'),_0x3ebc4b['id'],_0x359fb1[_0x0c33('0x3f')],_0x36b63f['type']);switch(_0x36b63f[_0x0c33('0x39')]){case _0x0c33('0x6b'):emit(util['format'](_0x0c33('0x59'),_0x359fb1[_0x0c33('0x3f')]),'trigger:salesforce:display',{'recordId':_0x3ebc4b['id']});break;case _0x0c33('0x5b'):emit(util[_0x0c33('0x51')]('user:%s',_0x359fb1[_0x0c33('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0x0c33('0x5d'),_0x3d474e[_0x0c33('0x5e')],_0x3ebc4b['id'])});break;default:logger[_0x0c33('0x5f')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x18a34c){logger[_0x0c33('0x5f')](_0x0c33('0x66'),JSON[_0x0c33('0x62')](_0x18a34c));});};exports[_0x0c33('0x6c')]=function(_0x2de199,_0x28b3c0,_0x28c2ee,_0x1ea193,_0x5aed99,_0x20b5de){var _0x182441,_0x2b5312,_0x374234,_0x4b093e;_0x20b5de[_0x0c33('0x4c')]=intUtil[_0x0c33('0x4d')](_0x20b5de[_0x0c33('0x4c')]);_0x20b5de['remoteUri']=intUtil['stripTrailingSlash'](_0x20b5de['remoteUri']);if(_0x5aed99&&_0x5aed99[_0x0c33('0x4e')]){logger[_0x0c33('0x1d')]('['+_0x28b3c0[_0x0c33('0x6d')][_0x0c33('0x6e')]()+']',_0x0c33('0x50'));_0x28b3c0[_0x0c33('0x53')]=util[_0x0c33('0x51')](_0x0c33('0x67'),_0x20b5de[_0x0c33('0x4c')],_0x28b3c0[_0x0c33('0x52')],md5(_0x28b3c0[_0x0c33('0x52')]));}else{_0x28b3c0[_0x0c33('0x53')]='';}return getConnection(_0x20b5de)[_0x0c33('0x20')](function(_0x4acd36){_0x4b093e=_0x4acd36;if(!_[_0x0c33('0x16')](_0x1ea193)){return getUser(_0x20b5de,_0x1ea193[_0x0c33('0x3f')],_0x4b093e);}else{return getUser(_0x20b5de,null,_0x4b093e);}})[_0x0c33('0x20')](function(_0x445a38){_0x182441=_0x445a38;return getEndUser(_0x20b5de,_0x28c2ee,_0x28b3c0['calleridname'],_0x28b3c0['calleridnum'],_0x4b093e);})[_0x0c33('0x20')](function(_0x5e2525){_0x2b5312=_0x5e2525;return getTicket(_0x20b5de,_0x182441,_0x2b5312,_0x28c2ee,_0x28b3c0,_0x28c2ee[_0x0c33('0x57')],_0x4b093e);})[_0x0c33('0x20')](function(_0x1c3674){_0x374234=_0x1c3674;logger[_0x0c33('0x1d')]('['+_0x28b3c0[_0x0c33('0x6d')][_0x0c33('0x6e')]()+_0x0c33('0x6f'),_0x374234['id']);logger[_0x0c33('0x1d')]('['+_0x28b3c0[_0x0c33('0x6d')][_0x0c33('0x6e')]()+_0x0c33('0x70'),_0x20b5de[_0x0c33('0x39')]);})[_0x0c33('0x61')](function(_0x135a10){logger[_0x0c33('0x5f')]('['+_0x28b3c0['lastevent'][_0x0c33('0x6e')]()+']',JSON[_0x0c33('0x62')](_0x135a10));});}; \ No newline at end of file +var _0xeaa3=['contact','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','create','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','utc','getString','Subjects','Descriptions','ticketType','Case','assign','ContactId','sobject','isNil','validateEmail','User','find','execute','then','Email','info','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','Contact','length','Lead'];(function(_0x7e6cf7,_0x4c8e23){var _0x18d4ee=function(_0x14b2fc){while(--_0x14b2fc){_0x7e6cf7['push'](_0x7e6cf7['shift']());}};_0x18d4ee(++_0x4c8e23);}(_0xeaa3,0x18b));var _0x3eaa=function(_0x46a3f3,_0x1c04a9){_0x46a3f3=_0x46a3f3-0x0;var _0x486e7b=_0xeaa3[_0x46a3f3];return _0x486e7b;};'use strict';var _=require(_0x3eaa('0x0'));var rp=require('request-promise');var moment=require(_0x3eaa('0x1'));var BPromise=require(_0x3eaa('0x2'));var md5=require(_0x3eaa('0x3'));var jsforce=require(_0x3eaa('0x4'));var util=require('util');var Redis=require(_0x3eaa('0x5'));var intUtil=require(_0x3eaa('0x6'));var config=require(_0x3eaa('0x7'));var logger=require(_0x3eaa('0x8'))(_0x3eaa('0x9'));config[_0x3eaa('0xa')]=_[_0x3eaa('0xb')](config[_0x3eaa('0xa')],{'host':_0x3eaa('0xc'),'port':0x18eb});var io=require(_0x3eaa('0xd'))(new Redis(config[_0x3eaa('0xa')]));function emit(_0x1582f8,_0x3f980a,_0x549c98){io['to'](_0x1582f8)['emit'](_0x3f980a,_0x549c98);}function getTicket(_0x4afa56,_0x34a8a2,_0x502a50,_0x3ca225,_0x3ba365,_0x4f5eb7,_0x2f7b60,_0x2f605e){var _0x3d62d3={};if(_0x3ca225['ticketType']==='Task'){_0x3d62d3=Object['assign']({},{'OwnerId':_0x34a8a2['id'],'ActivityDate':moment[_0x3eaa('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x3eaa('0xf')](_0x3ca225[_0x3eaa('0x10')],_0x3ba365,'\x20'),'Description':intUtil[_0x3eaa('0xf')](_0x3ca225[_0x3eaa('0x11')],_0x3ba365,'\x0a')},getCustomFields(_0x4f5eb7,_0x3ba365));if(_0x502a50){_0x3d62d3['WhoId']=_0x502a50['id'];}}else if(_0x3ca225[_0x3eaa('0x12')]===_0x3eaa('0x13')){_0x3d62d3=Object[_0x3eaa('0x14')]({},{'OwnerId':_0x34a8a2['id'],'Subject':intUtil[_0x3eaa('0xf')](_0x3ca225[_0x3eaa('0x10')],_0x3ba365,'\x20'),'Description':intUtil[_0x3eaa('0xf')](_0x3ca225['Descriptions'],_0x3ba365,'\x0a')},getCustomFields(_0x4f5eb7,_0x3ba365));if(_0x502a50){_0x3d62d3[_0x3eaa('0x15')]=_0x502a50['id'];}}return _0x2f7b60[_0x3eaa('0x16')](_0x3ca225[_0x3eaa('0x12')])['create'](_0x3d62d3);}function getUser(_0x34630d,_0x123d71,_0x591a3d){if(!_[_0x3eaa('0x17')](_0x123d71)&&intUtil[_0x3eaa('0x18')](_0x123d71)){var _0xb843d4={'Email':_0x123d71};var _0x57c25e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x591a3d['sobject'](_0x3eaa('0x19'))[_0x3eaa('0x1a')](_0xb843d4,_0x57c25e)[_0x3eaa('0x1b')]()[_0x3eaa('0x1c')](function(_0x36bf20){if(_0x36bf20['length']){var _0x405c4b=_['find'](_0x36bf20,function(_0x39ad06){return _0x39ad06[_0x3eaa('0x1d')]===_0x123d71;});if(_0x405c4b){logger[_0x3eaa('0x1e')]('Agent\x20%s\x20found.',_0x123d71);return BPromise[_0x3eaa('0x1f')]({'id':_0x405c4b['Id'],'name':_0x405c4b['Name']});}}else{logger[_0x3eaa('0x1e')](_0x3eaa('0x20'),_0x123d71);return _0x591a3d[_0x3eaa('0x21')]()[_0x3eaa('0x1c')](function(_0x2d1c45){return BPromise[_0x3eaa('0x1f')]({'id':_0x2d1c45[_0x3eaa('0x22')],'name':_0x2d1c45[_0x3eaa('0x23')]});});}});}else{logger[_0x3eaa('0x1e')](_0x3eaa('0x20'),_0x123d71);return _0x591a3d[_0x3eaa('0x21')]()[_0x3eaa('0x1c')](function(_0x389df1){return BPromise[_0x3eaa('0x1f')]({'id':_0x389df1['user_id'],'name':_0x389df1[_0x3eaa('0x23')]});});}}function getEndUser(_0x5d8ba8,_0x38f295,_0x199458,_0x1ec9c0,_0x355a24){var _0x34d238={'Phone':_0x1ec9c0};var _0x36a066={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3eaa('0x1f')]()[_0x3eaa('0x1c')](function(){if(_0x38f295['ticketType']==='Task'){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1ec9c0,_0x38f295[_0x3eaa('0x24')]);switch(_0x38f295[_0x3eaa('0x24')]){case _0x3eaa('0x25'):return _0x355a24[_0x3eaa('0x16')](_0x3eaa('0x26'))['find'](_0x34d238,_0x36a066)[_0x3eaa('0x1b')]()[_0x3eaa('0x1c')](function(_0x1b4518){if(_0x1b4518&&_0x1b4518[_0x3eaa('0x27')]){return _0x1b4518;}else{return _0x355a24[_0x3eaa('0x16')](_0x3eaa('0x28'))[_0x3eaa('0x1a')](_0x34d238,_0x36a066);}});case _0x3eaa('0x29'):return _0x355a24['sobject'](_0x3eaa('0x26'))[_0x3eaa('0x1a')](_0x34d238,_0x36a066)[_0x3eaa('0x1b')]();case'lead':return _0x355a24[_0x3eaa('0x16')]('Lead')[_0x3eaa('0x1a')](_0x34d238,_0x36a066);default:return null;}}else if(_0x38f295[_0x3eaa('0x12')]===_0x3eaa('0x13')){logger[_0x3eaa('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1ec9c0,'contact');return _0x355a24[_0x3eaa('0x16')](_0x3eaa('0x26'))[_0x3eaa('0x1a')](_0x34d238,_0x36a066)[_0x3eaa('0x1b')]();}})['then'](function(_0x161e7c){if(_0x161e7c&&_0x161e7c[_0x3eaa('0x27')]){var _0x3122a9=_[_0x3eaa('0x1a')](_0x161e7c,function(_0xb5b47f){return _0xb5b47f[_0x3eaa('0x2a')]===_0x1ec9c0;});if(_0x3122a9){return BPromise[_0x3eaa('0x1f')]({'id':_0x3122a9['Id'],'name':_0x3122a9[_0x3eaa('0x2b')],'phone':_0x3122a9['Phone']});}}})[_0x3eaa('0x1c')](function(_0x545737){if(_0x545737){logger[_0x3eaa('0x1e')](_0x3eaa('0x2c'),_0x1ec9c0);return BPromise['resolve'](_0x545737);}else{logger[_0x3eaa('0x1e')](_0x3eaa('0x2d'),_0x1ec9c0);var _0x43ff98={'LastName':_0x199458!==''?_0x199458:util[_0x3eaa('0x2e')]('Caller\x20-\x20%s',_0x1ec9c0),'Phone':_0x1ec9c0};if(_0x38f295[_0x3eaa('0x2f')]){if(_0x38f295[_0x3eaa('0x2f')]===_0x3eaa('0x29')){logger[_0x3eaa('0x1e')](_0x3eaa('0x30'),_0x1ec9c0,_0x38f295[_0x3eaa('0x2f')]);}else if(_0x38f295[_0x3eaa('0x2f')]==='lead'&&_0x38f295[_0x3eaa('0x12')]==='Task'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1ec9c0,_0x38f295[_0x3eaa('0x2f')]);_0x43ff98['Company']='No\x20Company';}else{return null;}}return _0x355a24[_0x3eaa('0x16')](_[_0x3eaa('0x31')](_0x38f295[_0x3eaa('0x2f')]))[_0x3eaa('0x32')](_0x43ff98);}});}function getCustomFields(_0xa74241,_0x272e6f){var _0x61defd={};if(_0xa74241[_0x3eaa('0x27')]>0x0){_[_0x3eaa('0x33')](_0xa74241,function(_0x285a0a){if(_0x285a0a[_0x3eaa('0x34')]===_0x3eaa('0x35')&&_0x285a0a['idField']){_0x61defd[_0x285a0a[_0x3eaa('0x36')]]=_0x285a0a[_0x3eaa('0x37')][_0x3eaa('0x38')]();}else if(_0x285a0a[_0x3eaa('0x34')]===_0x3eaa('0x39')&&_0x285a0a['variableName']&&_0x285a0a['idField']){_0x272e6f[_0x285a0a['variableName']]&&(_0x61defd[_0x285a0a[_0x3eaa('0x36')]]=_0x272e6f[_0x285a0a[_0x3eaa('0x3a')]][_0x3eaa('0x38')]());}else if(_0x285a0a[_0x3eaa('0x34')]===_0x3eaa('0x3b')&&_0x285a0a[_0x3eaa('0x3c')]&&_0x285a0a['Variable'][_0x3eaa('0x3d')]&&_0x285a0a[_0x3eaa('0x36')]){_0x272e6f[_0x285a0a[_0x3eaa('0x3c')][_0x3eaa('0x3d')][_0x3eaa('0x3e')]()]&&(_0x61defd[_0x285a0a[_0x3eaa('0x36')]]=_0x272e6f[_0x285a0a[_0x3eaa('0x3c')][_0x3eaa('0x3d')][_0x3eaa('0x3e')]()][_0x3eaa('0x38')]());}});}return _0x61defd;}function getConnection(_0x32b29a){var _0x4a09b3=_0x32b29a[_0x3eaa('0x3f')][_0x3eaa('0x40')](_0x32b29a[_0x3eaa('0x41')]);var _0x2c05a9=new jsforce[(_0x3eaa('0x42'))]({'oauth2':{'loginUrl':_0x32b29a[_0x3eaa('0x43')]||'https://login.salesforce.com','clientId':_0x32b29a[_0x3eaa('0x44')],'clientSecret':_0x32b29a['clientSecret']}});return _0x2c05a9[_0x3eaa('0x45')](_0x32b29a[_0x3eaa('0x46')],_0x4a09b3)[_0x3eaa('0x1c')](function(){logger['info'](_0x3eaa('0x47'));return _0x2c05a9;});}exports[_0x3eaa('0x48')]=function(_0x2538e8,_0x5ae623,_0x4c2dc7,_0x3a31f2,_0x4aab61,_0x410b88){var _0x571408,_0x5f2cc2,_0x45e84e,_0x20c989;_0x410b88[_0x3eaa('0x49')]=intUtil[_0x3eaa('0x4a')](_0x410b88['serverUrl']);_0x410b88[_0x3eaa('0x43')]=intUtil[_0x3eaa('0x4a')](_0x410b88[_0x3eaa('0x43')]);if(_0x4aab61&&_0x4aab61[_0x3eaa('0x4b')]){logger[_0x3eaa('0x1e')]('[QUEUE]',_0x3eaa('0x4c'));_0x5ae623['recordingURL']=util[_0x3eaa('0x2e')](_0x3eaa('0x4d'),_0x410b88[_0x3eaa('0x49')],_0x5ae623[_0x3eaa('0x4e')],md5(_0x5ae623[_0x3eaa('0x4e')]));}else{_0x5ae623[_0x3eaa('0x4f')]='';}return getConnection(_0x410b88)['then'](function(_0xbb99a){_0x20c989=_0xbb99a;return getUser(_0x410b88,_0x3a31f2[_0x3eaa('0x50')],_0x20c989);})[_0x3eaa('0x1c')](function(_0x2426d8){_0x571408=_0x2426d8;return getEndUser(_0x410b88,_0x4c2dc7,_0x5ae623['calleridname'],_0x5ae623[_0x3eaa('0x51')],_0x20c989);})[_0x3eaa('0x1c')](function(_0x1022c9){_0x5f2cc2=_0x1022c9;return getTicket(_0x410b88,_0x571408,_0x5f2cc2,_0x4c2dc7,_0x5ae623,_0x4c2dc7['Fields'],_0x20c989,_0x3eaa('0x48'));})[_0x3eaa('0x1c')](function(_0x48d3d2){_0x45e84e=_0x48d3d2;logger[_0x3eaa('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x45e84e['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x45e84e['id'],_0x3a31f2[_0x3eaa('0x3d')],_0x410b88['type']);switch(_0x410b88['type']){case _0x3eaa('0x52'):emit(util[_0x3eaa('0x2e')](_0x3eaa('0x53'),_0x3a31f2[_0x3eaa('0x3d')]),_0x3eaa('0x54'),{'recordId':_0x45e84e['id']});break;case _0x3eaa('0x55'):emit(util[_0x3eaa('0x2e')](_0x3eaa('0x53'),_0x3a31f2[_0x3eaa('0x3d')]),_0x3eaa('0x56'),{'uri':util[_0x3eaa('0x2e')]('%s/%s/e',_0x20c989['instanceUrl'],_0x45e84e['id'])});break;default:logger[_0x3eaa('0x57')](_0x3eaa('0x58'));}})[_0x3eaa('0x59')](function(_0x5eeef9){logger[_0x3eaa('0x57')](_0x3eaa('0x5a'),JSON['stringify'](_0x5eeef9));});};exports[_0x3eaa('0x5b')]=function(_0x5936ba,_0x66e44,_0xdc40c6,_0xe7a51e,_0x36ee64,_0x284166,_0xc0b7ba){var _0x33c60b,_0x5f2ba7,_0x3a93c1,_0x298886;_0x284166[_0x3eaa('0x49')]=intUtil[_0x3eaa('0x4a')](_0x284166[_0x3eaa('0x49')]);_0x284166[_0x3eaa('0x43')]=intUtil[_0x3eaa('0x4a')](_0x284166[_0x3eaa('0x43')]);if(_0xc0b7ba&&_0xc0b7ba[_0x3eaa('0x5c')]&&_0xc0b7ba[_0x3eaa('0x5c')]!==_0x3eaa('0x5d')){logger[_0x3eaa('0x1e')](_0x3eaa('0x5e'),_0x3eaa('0x4c'));_0x66e44[_0x3eaa('0x4f')]=util[_0x3eaa('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x284166[_0x3eaa('0x49')],_0x66e44[_0x3eaa('0x4e')],md5(_0x66e44[_0x3eaa('0x4e')]));}return getConnection(_0x284166)[_0x3eaa('0x1c')](function(_0xe82a85){_0x298886=_0xe82a85;return getUser(_0x284166,_0xe7a51e['email'],_0x298886);})[_0x3eaa('0x1c')](function(_0x36cf63){_0x33c60b=_0x36cf63;return getEndUser(_0x284166,_0xdc40c6,_0x66e44[_0x3eaa('0x5f')],_0x66e44['destcalleridnum'],_0x298886);})['then'](function(_0x22c806){_0x5f2ba7=_0x22c806;return getTicket(_0x284166,_0x33c60b,_0x5f2ba7,_0xdc40c6,_0x66e44,_0xdc40c6[_0x3eaa('0x60')],_0x298886,_0x3eaa('0x5b'));})['then'](function(_0x4ac61b){_0x3a93c1=_0x4ac61b;logger[_0x3eaa('0x1e')](_0x3eaa('0x61'),_0x3a93c1['id']);logger[_0x3eaa('0x1e')](_0x3eaa('0x62'),_0x3a93c1['id'],_0xe7a51e[_0x3eaa('0x3d')],_0x284166[_0x3eaa('0x34')]);switch(_0x284166['type']){case _0x3eaa('0x52'):emit(util[_0x3eaa('0x2e')]('user:%s',_0xe7a51e[_0x3eaa('0x3d')]),'trigger:salesforce:display',{'recordId':_0x3a93c1['id']});break;case'newTab':emit(util[_0x3eaa('0x2e')](_0x3eaa('0x53'),_0xe7a51e[_0x3eaa('0x3d')]),_0x3eaa('0x56'),{'uri':util[_0x3eaa('0x2e')](_0x3eaa('0x63'),_0x298886[_0x3eaa('0x64')],_0x3a93c1['id'])});break;default:logger[_0x3eaa('0x57')]('[OUTBOUND]',_0x3eaa('0x65'));}})[_0x3eaa('0x59')](function(_0x12f7cb){logger[_0x3eaa('0x57')](_0x3eaa('0x5e'),JSON[_0x3eaa('0x66')](_0x12f7cb));});};exports[_0x3eaa('0x67')]=function(_0x11b0d2,_0x2370ed,_0xf22026,_0x15f876,_0x3e652f,_0x2de488){var _0x5277aa,_0x55b736,_0x3189f1,_0x2aa795;_0x2de488[_0x3eaa('0x49')]=intUtil[_0x3eaa('0x4a')](_0x2de488[_0x3eaa('0x49')]);_0x2de488['remoteUri']=intUtil[_0x3eaa('0x4a')](_0x2de488[_0x3eaa('0x43')]);if(_0x3e652f&&_0x3e652f[_0x3eaa('0x4b')]){logger[_0x3eaa('0x1e')]('['+_0x2370ed[_0x3eaa('0x68')][_0x3eaa('0x69')]()+']',_0x3eaa('0x4c'));_0x2370ed[_0x3eaa('0x4f')]=util[_0x3eaa('0x2e')](_0x3eaa('0x4d'),_0x2de488[_0x3eaa('0x49')],_0x2370ed[_0x3eaa('0x4e')],md5(_0x2370ed[_0x3eaa('0x4e')]));}else{_0x2370ed['recordingURL']='';}return getConnection(_0x2de488)['then'](function(_0x265dd6){_0x2aa795=_0x265dd6;if(!_['isNil'](_0x15f876)){return getUser(_0x2de488,_0x15f876[_0x3eaa('0x3d')],_0x2aa795);}else{return getUser(_0x2de488,null,_0x2aa795);}})['then'](function(_0x32af81){_0x5277aa=_0x32af81;return getEndUser(_0x2de488,_0xf22026,_0x2370ed[_0x3eaa('0x6a')],_0x2370ed[_0x3eaa('0x51')],_0x2aa795);})[_0x3eaa('0x1c')](function(_0x3f801f){_0x55b736=_0x3f801f;return getTicket(_0x2de488,_0x5277aa,_0x55b736,_0xf22026,_0x2370ed,_0xf22026[_0x3eaa('0x60')],_0x2aa795);})[_0x3eaa('0x1c')](function(_0x41d2a3){_0x3189f1=_0x41d2a3;logger['info']('['+_0x2370ed[_0x3eaa('0x68')]['toUpperCase']()+_0x3eaa('0x6b'),_0x3189f1['id']);logger[_0x3eaa('0x1e')]('['+_0x2370ed['lastevent'][_0x3eaa('0x69')]()+_0x3eaa('0x6c'),_0x2de488[_0x3eaa('0x34')]);})['catch'](function(_0x22a788){logger[_0x3eaa('0x57')]('['+_0x2370ed['lastevent'][_0x3eaa('0x69')]()+']',JSON[_0x3eaa('0x66')](_0x22a788));});}; \ 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 966dacb..9787e86 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 _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x5cff32,_0x371623){var _0x5af039=function(_0x3326c8){while(--_0x3326c8){_0x5cff32['push'](_0x5cff32['shift']());}};_0x5af039(++_0x371623);}(_0x5fc3,0xa8));var _0x35fc=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x5fc3[_0x491cbe];return _0x59449d;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x1fe7e4,_0x5d39a4){var _0x4b3e54=function(_0x39fdf1){while(--_0x39fdf1){_0x1fe7e4['push'](_0x1fe7e4['shift']());}};_0x4b3e54(++_0x5d39a4);}(_0x1261,0x144));var _0x1126=function(_0x24b245,_0x1b3508){_0x24b245=_0x24b245-0x0;var _0x56f828=_0x1261[_0x24b245];return _0x56f828;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index e72895c..8933acd 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 _0x8101=['value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','format','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','trigger:browser:url','unmanaged','uri','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','push','idField','variableName','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','find','entry_list','name_value_list'];(function(_0x4ffe82,_0x162d5f){var _0x4b6169=function(_0x51c8f3){while(--_0x51c8f3){_0x4ffe82['push'](_0x4ffe82['shift']());}};_0x4b6169(++_0x162d5f);}(_0x8101,0xc0));var _0x1810=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x8101[_0x171fdc];return _0x3782ea;};'use strict';var _=require(_0x1810('0x0'));var rp=require(_0x1810('0x1'));var BPromise=require(_0x1810('0x2'));var md5=require(_0x1810('0x3'));var util=require(_0x1810('0x4'));var Redis=require(_0x1810('0x5'));var intUtil=require(_0x1810('0x6'));var config=require(_0x1810('0x7'));var logger=require(_0x1810('0x8'))('sugarcrm');config['redis']=_[_0x1810('0x9')](config[_0x1810('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x1810('0xb'))(new Redis(config[_0x1810('0xa')]));var def={'method':_0x1810('0xc'),'json':!![]};function emit(_0x33d690,_0x312a3c,_0x271738){io['to'](_0x33d690)[_0x1810('0xd')](_0x312a3c,_0x271738);}function getTicket(_0x2dde85,_0xaa4b05,_0x1e732c,_0x419324,_0x5126d2,_0x3a664b,_0x18bb2d,_0x4f4f4a){logger[_0x1810('0xe')]('Creating\x20new\x20ticket...');var _0x4ee397=new Date();var _0x3c8a9f=[{'name':_0x1810('0xf'),'value':intUtil[_0x1810('0x10')](_0x419324[_0x1810('0x11')],_0x5126d2,'\x20')},{'name':_0x1810('0x12'),'value':_0xaa4b05['id']},{'name':_0x1810('0x13'),'value':_0xaa4b05['id']},{'name':'description','value':intUtil[_0x1810('0x10')](_0x419324[_0x1810('0x14')],_0x5126d2,'\x0a')},{'name':'date_start','value':_0x4ee397['toISOString']()[_0x1810('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x1810('0x16'),'value':'0'},{'name':_0x1810('0x17'),'value':'15'},{'name':_0x1810('0x18'),'value':_0x1e732c['id']},{'name':_0x1810('0x19'),'value':_0x1810('0x1a')},{'name':_0x1810('0x1b'),'value':_0x1e732c[_0x1810('0xf')]},{'name':'direction','value':_0x4f4f4a}];if(_0x3a664b['length']){_['forEach'](_0x3a664b,function(_0x3491d8){if(_0x5126d2[_0x3491d8['variableName']]){_0x3c8a9f[_0x1810('0x1c')]({'name':_0x3491d8[_0x1810('0x1d')],'value':_0x5126d2[_0x3491d8[_0x1810('0x1e')]]});}});}return request({'form':{'method':_0x1810('0x1f'),'input_type':'JSON','response_type':_0x1810('0x20'),'rest_data':JSON['stringify']({'session':_0x18bb2d['id'],'module_name':_0x1810('0x21'),'name_value_list':_0x3c8a9f})}});}function getAuth(_0x116ea0){return util['format'](_0x1810('0x22'),new Buffer(_0x116ea0[_0x1810('0x23')]+':X')[_0x1810('0x24')](_0x1810('0x25')));}function getServerInfo(_0xe66600){return request({'form':{'method':_0x1810('0x26'),'input_type':'JSON','response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0xe66600['id']})}});}function getUser(_0x254062,_0x77b5ed,_0x53ca63){if(!_[_0x1810('0x28')](_0x77b5ed)){logger['info']('Getting\x20agent\x20with\x20name',_0x77b5ed);return request({'form':{'method':_0x1810('0x29'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0x53ca63['id'],'module_name':_0x1810('0x2a'),'query':util['format'](_0x1810('0x2b'),_0x77b5ed),'order_by':'','offset':'0','select_fields':['id',_0x1810('0xf'),_0x1810('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1810('0x2d')](function(_0x523bb2){if(_0x523bb2['entry_list'][_0x1810('0x2e')]){var _0x33f077=_[_0x1810('0x2f')](_0x523bb2[_0x1810('0x30')],function(_0x2d387a){return _0x2d387a[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]===_0x77b5ed;});if(_0x33f077){logger[_0x1810('0xe')](_0x1810('0x33'));return BPromise[_0x1810('0x34')]({'id':_0x33f077[_0x1810('0x31')]['id'][_0x1810('0x32')],'name':_0x33f077['name_value_list'][_0x1810('0xf')][_0x1810('0x32')]});}}logger[_0x1810('0xe')](_0x1810('0x35'));return BPromise[_0x1810('0x34')]({'id':_0x53ca63[_0x1810('0x31')]['user_id'][_0x1810('0x32')],'name':_0x53ca63[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]});});}else{logger[_0x1810('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1810('0x34')]({'id':_0x53ca63[_0x1810('0x31')][_0x1810('0x36')]['value'],'name':_0x53ca63[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]});}}function getEndUser(_0xb46b04,_0x3c3d0a,_0x287181,_0xaecd29){logger[_0x1810('0xe')](_0x1810('0x37'),_0x287181);return request({'form':{'method':_0x1810('0x29'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0xaecd29['id'],'module_name':_0x1810('0x1a'),'query':util[_0x1810('0x38')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x287181),'order_by':'','offset':'0','select_fields':['id',_0x1810('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xbb39c2){if(_0xbb39c2[_0x1810('0x30')]['length']){var _0x284b30=_[_0x1810('0x2f')](_0xbb39c2[_0x1810('0x30')],function(_0x345da0){return _0x345da0[_0x1810('0x31')][_0x1810('0x39')][_0x1810('0x32')]===_0x287181;});if(_0x284b30){logger['info'](_0x1810('0x3a'));return BPromise[_0x1810('0x34')]({'id':_0x284b30['name_value_list']['id']['value'],'name':_0x284b30[_0x1810('0x31')]['name'][_0x1810('0x32')],'phone':_0x284b30[_0x1810('0x31')][_0x1810('0x39')][_0x1810('0x32')]});}}else{logger[_0x1810('0xe')](_0x1810('0x3b'));return request({'form':{'method':_0x1810('0x1f'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON['stringify']({'session':_0xaecd29['id'],'module_name':_0x1810('0x1a'),'name_value_list':[{'name':'first_name','value':_0x3c3d0a!==_0x1810('0x3c')?_0x3c3d0a:util[_0x1810('0x38')](_0x1810('0x3d'),_0x287181)},{'name':_0x1810('0x39'),'value':_0x287181}]})}})[_0x1810('0x2d')](function(_0x41c0ab){logger[_0x1810('0xe')](_0x1810('0x3e'));return BPromise[_0x1810('0x34')]({'id':_0x41c0ab['id'],'name':_0x41c0ab[_0x1810('0x30')]['first_name'][_0x1810('0x32')],'phone':_0x41c0ab[_0x1810('0x30')][_0x1810('0x39')]['value']});});}});}function request(_0x368a37){logger[_0x1810('0x3f')](_0x1810('0x40'),JSON[_0x1810('0x27')](_0x368a37));return rp(_[_0x1810('0x41')](def,_0x368a37));}function getTags(_0x378582,_0x4d1de7){var _0x30372a=[];if(_0x378582&&_0x378582[_0x1810('0x2e')]>0x0){_0x30372a=_[_0x1810('0x42')](_0x378582,_0x4d1de7);}return _0x30372a;}function getCustomFields(_0x171190,_0x459570){var _0x4e63d9=[];var _0x358eda={'custom_fields':[]};if(_0x171190[_0x1810('0x2e')]>0x0){_[_0x1810('0x43')](_0x171190,function(_0x15ce70){if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x45')&&_0x15ce70[_0x1810('0x46')]&&!_0x15ce70[_0x1810('0x47')]){_0x358eda[_0x15ce70[_0x1810('0x46')][_0x1810('0x48')]()]=_0x15ce70[_0x1810('0x49')]['toString']();}else if(_0x15ce70[_0x1810('0x44')]==='string'&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70['customField']){_0x358eda[_0x1810('0x4a')][_0x1810('0x1c')]({'id':_0x15ce70[_0x1810('0x1d')],'value':_0x15ce70[_0x1810('0x49')][_0x1810('0x24')]()});}else if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x4b')&&_0x15ce70[_0x1810('0x1e')]&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70[_0x1810('0x47')]){_0x459570[_0x15ce70[_0x1810('0x1e')]]&&_0x358eda[_0x1810('0x4a')]['push']({'id':_0x15ce70['idField'],'value':_0x459570[_0x15ce70[_0x1810('0x1e')]]['toString']()});}else if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x4c')&&_0x15ce70['Variable']&&_0x15ce70['Variable'][_0x1810('0xf')]&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70[_0x1810('0x47')]){_0x459570[_0x15ce70[_0x1810('0x4d')][_0x1810('0xf')]['toLowerCase']()]&&_0x358eda[_0x1810('0x4a')][_0x1810('0x1c')]({'id':_0x15ce70[_0x1810('0x1d')],'value':_0x459570[_0x15ce70[_0x1810('0x4d')][_0x1810('0xf')][_0x1810('0x48')]()][_0x1810('0x24')]()});}});}return _0x358eda;}function getConnection(_0x25d609){return request({'method':_0x1810('0xc'),'form':{'method':_0x1810('0x4e'),'input_type':_0x1810('0x20'),'response_type':'JSON','rest_data':JSON[_0x1810('0x27')]({'user_auth':{'user_name':_0x25d609[_0x1810('0x4f')],'password':_0x25d609[_0x1810('0x50')],'encryption':_0x1810('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x1810('0x2d')](function(_0x126b0c){var _0x5f5763=_0x126b0c;if(_0x5f5763['id']){def[_0x1810('0x52')]=_0x5f5763['id'];return BPromise['resolve'](_0x5f5763);}else{throw new Error(util['format'](_0x1810('0x53'),_0x25d609['id']));}});}function setRelationship(_0x5f2735,_0x4207c4,_0x4628a7,_0xf895b1){return request({'form':{'method':_0x1810('0x54'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0x5f2735['id'],'module_name':_0x1810('0x21'),'module_id':_0x4628a7['id'],'link_field_name':_0xf895b1,'related_ids':[_0x4207c4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1810('0x55')]=function(_0x2c4c00,_0x73fef8,_0x4a71a8,_0x4f0f76,_0x498213,_0x3c51ec){var _0x1f2974,_0x358d17,_0x53bec7,_0x3337e2;_0x3c51ec[_0x1810('0x56')]=intUtil['stripTrailingSlash'](_0x3c51ec[_0x1810('0x56')]);_0x3c51ec[_0x1810('0x57')]=intUtil[_0x1810('0x58')](_0x3c51ec['serverUrl']);def['uri']=util[_0x1810('0x38')](_0x1810('0x59'),_0x3c51ec[_0x1810('0x56')]);if(_0x498213&&_0x498213[_0x1810('0x5a')]){logger[_0x1810('0xe')]('[QUEUE]',_0x1810('0x5b'));_0x73fef8['recordingURL']=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c51ec[_0x1810('0x57')],_0x73fef8[_0x1810('0x5c')],md5(_0x73fef8['uniqueid']));}else{_0x73fef8[_0x1810('0x5d')]='';}return getConnection(_0x3c51ec)['then'](function(_0x3b636e){_0x3337e2=_0x3b636e;return getUser(_0x3c51ec,_0x4f0f76[_0x1810('0xf')],_0x3337e2);})[_0x1810('0x2d')](function(_0x4638d2){_0x1f2974=_0x4638d2;logger[_0x1810('0xe')]('The\x20User\x20ID\x20is:',_0x1f2974['id']);return getEndUser(_0x3c51ec,_0x73fef8[_0x1810('0x5e')],_0x73fef8[_0x1810('0x5f')],_0x3337e2);})['then'](function(_0x37dbe1){_0x358d17=_0x37dbe1;logger['info'](_0x1810('0x60'),_0x358d17['id']);return getTicket(_0x3c51ec,_0x1f2974,_0x358d17,_0x4a71a8,_0x73fef8,_0x4a71a8[_0x1810('0x61')],_0x3337e2,_0x1810('0x62'));})[_0x1810('0x2d')](function(_0x1949a6){_0x53bec7=_0x1949a6;logger['info'](_0x1810('0x63'));logger[_0x1810('0xe')]('The\x20Ticket\x20ID\x20is:',_0x53bec7['id']);return setRelationship(_0x3337e2,_0x1f2974,_0x53bec7,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x3337e2,_0x358d17,_0x53bec7,_0x1810('0x65'));})[_0x1810('0x2d')](function(){return getServerInfo(_0x3337e2);})[_0x1810('0x2d')](function(_0x17e12b){var _0x40deb3=parseInt(_0x17e12b[_0x1810('0x66')][_0x1810('0x67')](0x0));var _0x41eaef=util[_0x1810('0x38')](_0x1810('0x68'),_0x3c51ec[_0x1810('0x56')],_0x53bec7['id']);if(_0x40deb3>0x6){_0x41eaef=util[_0x1810('0x38')](_0x1810('0x69'),_0x3c51ec['remoteUri'],_0x53bec7['id']);}logger[_0x1810('0xe')](_0x1810('0x6a'),_0x1810('0x6b'));emit(util[_0x1810('0x38')](_0x1810('0x6c'),_0x4f0f76[_0x1810('0xf')]),'trigger:browser:url',{'uri':_0x41eaef});})[_0x1810('0x6d')](function(_0x35c92a){logger[_0x1810('0x6e')]('[QUEUE]',JSON[_0x1810('0x27')](_0x35c92a));});};exports['outbound']=function(_0x27d55d,_0x4a13df,_0x425f4c,_0x24f731,_0x4b9858,_0x39051b,_0x771847){var _0x34fa25,_0x1346ed,_0x26af3a,_0x4264b4;_0x39051b[_0x1810('0x56')]=intUtil['stripTrailingSlash'](_0x39051b[_0x1810('0x56')]);_0x39051b['serverUrl']=intUtil['stripTrailingSlash'](_0x39051b[_0x1810('0x57')]);def['uri']=util[_0x1810('0x38')](_0x1810('0x59'),_0x39051b[_0x1810('0x56')]);if(_0x771847&&_0x771847[_0x1810('0x6f')]&&_0x771847[_0x1810('0x6f')]!=='none'){logger['info'](_0x1810('0x70'),_0x1810('0x5b'));_0x4a13df[_0x1810('0x5d')]=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39051b[_0x1810('0x57')],_0x4a13df[_0x1810('0x5c')],md5(_0x4a13df['uniqueid']));}return getConnection(_0x39051b)[_0x1810('0x2d')](function(_0x5c5761){_0x4264b4=_0x5c5761;return getUser(_0x39051b,_0x24f731[_0x1810('0xf')],_0x4264b4);})[_0x1810('0x2d')](function(_0x5c5efa){_0x34fa25=_0x5c5efa;logger['info']('The\x20User\x20ID\x20is:',_0x34fa25['id']);return getEndUser(_0x39051b,_0x4a13df[_0x1810('0x71')],_0x4a13df['destcalleridnum'],_0x4264b4);})[_0x1810('0x2d')](function(_0x57b877){_0x1346ed=_0x57b877;logger['info'](_0x1810('0x60'),_0x1346ed['id']);return getTicket(_0x39051b,_0x34fa25,_0x1346ed,_0x425f4c,_0x4a13df,_0x425f4c[_0x1810('0x61')],_0x4264b4,_0x1810('0x72'));})[_0x1810('0x2d')](function(_0x316b0b){_0x26af3a=_0x316b0b;logger[_0x1810('0xe')](_0x1810('0x63'));logger[_0x1810('0xe')]('The\x20Ticket\x20ID\x20is:',_0x26af3a['id']);return setRelationship(_0x4264b4,_0x34fa25,_0x26af3a,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x4264b4,_0x1346ed,_0x26af3a,'contacts');})[_0x1810('0x2d')](function(){return getServerInfo(_0x4264b4);})[_0x1810('0x2d')](function(_0x396601){var _0x24f812=parseInt(_0x396601['version'][_0x1810('0x67')](0x0));var _0x52928b=util[_0x1810('0x38')](_0x1810('0x68'),_0x39051b[_0x1810('0x56')],_0x26af3a['id']);if(_0x24f812>0x6){_0x52928b=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39051b[_0x1810('0x56')],_0x26af3a['id']);}logger[_0x1810('0xe')](_0x1810('0x70'),_0x1810('0x6b'));emit(util[_0x1810('0x38')](_0x1810('0x6c'),_0x24f731[_0x1810('0xf')]),_0x1810('0x73'),{'uri':_0x52928b});})[_0x1810('0x6d')](function(_0x17e02b){logger['error'](_0x1810('0x70'),JSON['stringify'](_0x17e02b));});};exports[_0x1810('0x74')]=function(_0xeb72e7,_0x26eb0e,_0x2525b0,_0x22d588,_0x2b1abe,_0x49df55){var _0xf6c9b7,_0x260cfc,_0x3b4bd1,_0x1bb59a;_0x49df55[_0x1810('0x56')]=intUtil[_0x1810('0x58')](_0x49df55[_0x1810('0x56')]);_0x49df55[_0x1810('0x57')]=intUtil[_0x1810('0x58')](_0x49df55[_0x1810('0x57')]);def[_0x1810('0x75')]=util[_0x1810('0x38')](_0x1810('0x59'),_0x49df55[_0x1810('0x56')]);if(_0x2b1abe&&_0x2b1abe[_0x1810('0x5a')]){logger[_0x1810('0xe')]('['+_0x26eb0e[_0x1810('0x76')][_0x1810('0x77')]()+']','Recording\x20is\x20enabled!');_0x26eb0e[_0x1810('0x5d')]=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49df55[_0x1810('0x57')],_0x26eb0e[_0x1810('0x5c')],md5(_0x26eb0e[_0x1810('0x5c')]));}else{_0x26eb0e['recordingURL']='';}return getConnection(_0x49df55)[_0x1810('0x2d')](function(_0x55b6b4){_0x1bb59a=_0x55b6b4;if(!_['isNil'](_0x22d588)){return getUser(_0x49df55,_0x22d588[_0x1810('0xf')],_0x1bb59a);}else{return getUser(_0x49df55,null,_0x1bb59a);}})[_0x1810('0x2d')](function(_0x53256c){_0xf6c9b7=_0x53256c;logger[_0x1810('0xe')]('The\x20User\x20ID\x20is:',_0xf6c9b7['id']);return getEndUser(_0x49df55,_0x26eb0e[_0x1810('0x5e')],_0x26eb0e[_0x1810('0x5f')],_0x1bb59a);})[_0x1810('0x2d')](function(_0x52da7b){_0x260cfc=_0x52da7b;logger['info'](_0x1810('0x60'),_0x260cfc['id']);return getTicket(_0x49df55,_0xf6c9b7,_0x260cfc,_0x2525b0,_0x26eb0e,_0x2525b0['Fields'],_0x1bb59a,_0x1810('0x62'));})[_0x1810('0x2d')](function(_0x5d578d){_0x3b4bd1=_0x5d578d;logger[_0x1810('0xe')](_0x1810('0x63'));logger[_0x1810('0xe')](_0x1810('0x78'),_0x3b4bd1['id']);return setRelationship(_0x1bb59a,_0xf6c9b7,_0x3b4bd1,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x1bb59a,_0x260cfc,_0x3b4bd1,'contacts');})[_0x1810('0x2d')](function(){return getServerInfo(_0x1bb59a);})[_0x1810('0x6d')](function(_0xfa6d8c){logger[_0x1810('0x6e')]('['+_0x26eb0e[_0x1810('0x76')][_0x1810('0x77')]()+']',JSON[_0x1810('0x27')](_0xfa6d8c));});}; \ No newline at end of file +var _0xd1eb=['Employees','then','entry_list','find','user_name','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','string','custom_fields','push','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Outbound','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','Inbound','lastevent','lodash','request-promise','bluebird','util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_type','Contacts','direction','length','forEach','variableName','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xd1eb,0xc3));var _0xbd1e=function(_0x253e56,_0xbb9299){_0x253e56=_0x253e56-0x0;var _0x28212e=_0xd1eb[_0x253e56];return _0x28212e;};'use strict';var _=require(_0xbd1e('0x0'));var rp=require(_0xbd1e('0x1'));var BPromise=require(_0xbd1e('0x2'));var md5=require('md5');var util=require(_0xbd1e('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbd1e('0x4'));var logger=require(_0xbd1e('0x5'))(_0xbd1e('0x6'));config[_0xbd1e('0x7')]=_[_0xbd1e('0x8')](config[_0xbd1e('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd1e('0x7')]));var def={'method':_0xbd1e('0x9'),'json':!![]};function emit(_0x36776c,_0x5d44e,_0x192c2b){io['to'](_0x36776c)[_0xbd1e('0xa')](_0x5d44e,_0x192c2b);}function getTicket(_0x221bf4,_0x500988,_0x55a78d,_0x5e998b,_0x4394f8,_0x13ddb3,_0x41de4e,_0x5dea35){logger[_0xbd1e('0xb')](_0xbd1e('0xc'));var _0x1f6afc=new Date();var _0x4252dc=[{'name':_0xbd1e('0xd'),'value':intUtil[_0xbd1e('0xe')](_0x5e998b[_0xbd1e('0xf')],_0x4394f8,'\x20')},{'name':_0xbd1e('0x10'),'value':_0x500988['id']},{'name':_0xbd1e('0x11'),'value':_0x500988['id']},{'name':_0xbd1e('0x12'),'value':intUtil[_0xbd1e('0xe')](_0x5e998b[_0xbd1e('0x13')],_0x4394f8,'\x0a')},{'name':_0xbd1e('0x14'),'value':_0x1f6afc[_0xbd1e('0x15')]()[_0xbd1e('0x16')](0x0,0x13)[_0xbd1e('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xbd1e('0x18'),'value':'15'},{'name':'parent_id','value':_0x55a78d['id']},{'name':_0xbd1e('0x19'),'value':_0xbd1e('0x1a')},{'name':'parent_name','value':_0x55a78d[_0xbd1e('0xd')]},{'name':_0xbd1e('0x1b'),'value':_0x5dea35}];if(_0x13ddb3[_0xbd1e('0x1c')]){_[_0xbd1e('0x1d')](_0x13ddb3,function(_0x55c126){if(_0x4394f8[_0x55c126[_0xbd1e('0x1e')]]){_0x4252dc['push']({'name':_0x55c126[_0xbd1e('0x1f')],'value':_0x4394f8[_0x55c126[_0xbd1e('0x1e')]]});}});}return request({'form':{'method':_0xbd1e('0x20'),'input_type':_0xbd1e('0x21'),'response_type':_0xbd1e('0x21'),'rest_data':JSON['stringify']({'session':_0x41de4e['id'],'module_name':_0xbd1e('0x22'),'name_value_list':_0x4252dc})}});}function getAuth(_0x3c8e6d){return util[_0xbd1e('0x23')](_0xbd1e('0x24'),new Buffer(_0x3c8e6d[_0xbd1e('0x25')]+':X')[_0xbd1e('0x26')](_0xbd1e('0x27')));}function getServerInfo(_0x20196f){return request({'form':{'method':_0xbd1e('0x28'),'input_type':_0xbd1e('0x21'),'response_type':_0xbd1e('0x21'),'rest_data':JSON[_0xbd1e('0x29')]({'session':_0x20196f['id']})}});}function getUser(_0x4bd84a,_0x499ec0,_0x389c79){if(!_[_0xbd1e('0x2a')](_0x499ec0)){logger[_0xbd1e('0xb')](_0xbd1e('0x2b'),_0x499ec0);return request({'form':{'method':_0xbd1e('0x2c'),'input_type':_0xbd1e('0x21'),'response_type':'JSON','rest_data':JSON[_0xbd1e('0x29')]({'session':_0x389c79['id'],'module_name':_0xbd1e('0x2d'),'query':util[_0xbd1e('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x499ec0),'order_by':'','offset':'0','select_fields':['id',_0xbd1e('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbd1e('0x2e')](function(_0x5b4a50){if(_0x5b4a50[_0xbd1e('0x2f')][_0xbd1e('0x1c')]){var _0x56d8a9=_[_0xbd1e('0x30')](_0x5b4a50[_0xbd1e('0x2f')],function(_0x3feb5e){return _0x3feb5e['name_value_list'][_0xbd1e('0x31')]['value']===_0x499ec0;});if(_0x56d8a9){logger[_0xbd1e('0xb')]('Agent\x20found!');return BPromise[_0xbd1e('0x32')]({'id':_0x56d8a9[_0xbd1e('0x33')]['id'][_0xbd1e('0x34')],'name':_0x56d8a9[_0xbd1e('0x33')][_0xbd1e('0xd')][_0xbd1e('0x34')]});}}logger[_0xbd1e('0xb')](_0xbd1e('0x35'));return BPromise[_0xbd1e('0x32')]({'id':_0x389c79[_0xbd1e('0x33')][_0xbd1e('0x36')][_0xbd1e('0x34')],'name':_0x389c79[_0xbd1e('0x33')]['user_name'][_0xbd1e('0x34')]});});}else{logger[_0xbd1e('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbd1e('0x32')]({'id':_0x389c79['name_value_list']['user_id'][_0xbd1e('0x34')],'name':_0x389c79[_0xbd1e('0x33')][_0xbd1e('0x31')][_0xbd1e('0x34')]});}}function getEndUser(_0x5ae57f,_0x3d3d16,_0x1c7913,_0x23ba07){logger[_0xbd1e('0xb')](_0xbd1e('0x37'),_0x1c7913);return request({'form':{'method':'get_entry_list','input_type':_0xbd1e('0x21'),'response_type':_0xbd1e('0x21'),'rest_data':JSON[_0xbd1e('0x29')]({'session':_0x23ba07['id'],'module_name':_0xbd1e('0x1a'),'query':util[_0xbd1e('0x23')](_0xbd1e('0x38'),_0x1c7913),'order_by':'','offset':'0','select_fields':['id',_0xbd1e('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x57604c){if(_0x57604c['entry_list'][_0xbd1e('0x1c')]){var _0x552c83=_[_0xbd1e('0x30')](_0x57604c[_0xbd1e('0x2f')],function(_0x1e2ef4){return _0x1e2ef4[_0xbd1e('0x33')][_0xbd1e('0x39')][_0xbd1e('0x34')]===_0x1c7913;});if(_0x552c83){logger[_0xbd1e('0xb')](_0xbd1e('0x3a'));return BPromise[_0xbd1e('0x32')]({'id':_0x552c83[_0xbd1e('0x33')]['id'][_0xbd1e('0x34')],'name':_0x552c83[_0xbd1e('0x33')]['name'][_0xbd1e('0x34')],'phone':_0x552c83[_0xbd1e('0x33')][_0xbd1e('0x39')][_0xbd1e('0x34')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xbd1e('0x21'),'rest_data':JSON[_0xbd1e('0x29')]({'session':_0x23ba07['id'],'module_name':'Contacts','name_value_list':[{'name':_0xbd1e('0x3b'),'value':_0x3d3d16!==_0xbd1e('0x3c')?_0x3d3d16:util[_0xbd1e('0x23')](_0xbd1e('0x3d'),_0x1c7913)},{'name':_0xbd1e('0x39'),'value':_0x1c7913}]})}})['then'](function(_0x5e8b77){logger['info'](_0xbd1e('0x3e'));return BPromise[_0xbd1e('0x32')]({'id':_0x5e8b77['id'],'name':_0x5e8b77[_0xbd1e('0x2f')]['first_name'][_0xbd1e('0x34')],'phone':_0x5e8b77['entry_list'][_0xbd1e('0x39')]['value']});});}});}function request(_0x1ab70b){logger[_0xbd1e('0x3f')](_0xbd1e('0x40'),JSON['stringify'](_0x1ab70b));return rp(_[_0xbd1e('0x41')](def,_0x1ab70b));}function getTags(_0x63e762,_0x2a7a1b){var _0x108840=[];if(_0x63e762&&_0x63e762[_0xbd1e('0x1c')]>0x0){_0x108840=_[_0xbd1e('0x42')](_0x63e762,_0x2a7a1b);}return _0x108840;}function getCustomFields(_0x5998c0,_0x3165ad){var _0x1c6e5c=[];var _0x54dddf={'custom_fields':[]};if(_0x5998c0['length']>0x0){_['forEach'](_0x5998c0,function(_0x1c79b4){if(_0x1c79b4[_0xbd1e('0x43')]==='string'&&_0x1c79b4[_0xbd1e('0x44')]&&!_0x1c79b4[_0xbd1e('0x45')]){_0x54dddf[_0x1c79b4[_0xbd1e('0x44')][_0xbd1e('0x46')]()]=_0x1c79b4[_0xbd1e('0x47')][_0xbd1e('0x26')]();}else if(_0x1c79b4['type']===_0xbd1e('0x48')&&_0x1c79b4[_0xbd1e('0x1f')]&&_0x1c79b4[_0xbd1e('0x45')]){_0x54dddf[_0xbd1e('0x49')][_0xbd1e('0x4a')]({'id':_0x1c79b4['idField'],'value':_0x1c79b4[_0xbd1e('0x47')]['toString']()});}else if(_0x1c79b4[_0xbd1e('0x43')]==='variable'&&_0x1c79b4['variableName']&&_0x1c79b4[_0xbd1e('0x1f')]&&_0x1c79b4[_0xbd1e('0x45')]){_0x3165ad[_0x1c79b4[_0xbd1e('0x1e')]]&&_0x54dddf[_0xbd1e('0x49')][_0xbd1e('0x4a')]({'id':_0x1c79b4[_0xbd1e('0x1f')],'value':_0x3165ad[_0x1c79b4[_0xbd1e('0x1e')]][_0xbd1e('0x26')]()});}else if(_0x1c79b4['type']===_0xbd1e('0x4b')&&_0x1c79b4[_0xbd1e('0x4c')]&&_0x1c79b4['Variable'][_0xbd1e('0xd')]&&_0x1c79b4[_0xbd1e('0x1f')]&&_0x1c79b4[_0xbd1e('0x45')]){_0x3165ad[_0x1c79b4[_0xbd1e('0x4c')][_0xbd1e('0xd')]['toLowerCase']()]&&_0x54dddf[_0xbd1e('0x49')][_0xbd1e('0x4a')]({'id':_0x1c79b4['idField'],'value':_0x3165ad[_0x1c79b4['Variable'][_0xbd1e('0xd')][_0xbd1e('0x46')]()][_0xbd1e('0x26')]()});}});}return _0x54dddf;}function getConnection(_0x5084e5){return request({'method':_0xbd1e('0x9'),'form':{'method':_0xbd1e('0x4d'),'input_type':'JSON','response_type':_0xbd1e('0x21'),'rest_data':JSON[_0xbd1e('0x29')]({'user_auth':{'user_name':_0x5084e5[_0xbd1e('0x4e')],'password':_0x5084e5['password'],'encryption':_0xbd1e('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xbd1e('0x2e')](function(_0x156bbd){var _0xc855a0=_0x156bbd;if(_0xc855a0['id']){def[_0xbd1e('0x50')]=_0xc855a0['id'];return BPromise['resolve'](_0xc855a0);}else{throw new Error(util['format'](_0xbd1e('0x51'),_0x5084e5['id']));}});}function setRelationship(_0x283ac4,_0x17899c,_0x5b70fb,_0x434716){return request({'form':{'method':_0xbd1e('0x52'),'input_type':'JSON','response_type':_0xbd1e('0x21'),'rest_data':JSON[_0xbd1e('0x29')]({'session':_0x283ac4['id'],'module_name':_0xbd1e('0x22'),'module_id':_0x5b70fb['id'],'link_field_name':_0x434716,'related_ids':[_0x17899c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbd1e('0x53')]=function(_0x438132,_0x317e11,_0x391b55,_0x3be9ba,_0x5ed741,_0x3e1f12){var _0x2bf79e,_0x45a152,_0x28a432,_0x555dd0;_0x3e1f12[_0xbd1e('0x54')]=intUtil[_0xbd1e('0x55')](_0x3e1f12['remoteUri']);_0x3e1f12[_0xbd1e('0x56')]=intUtil[_0xbd1e('0x55')](_0x3e1f12[_0xbd1e('0x56')]);def[_0xbd1e('0x57')]=util[_0xbd1e('0x23')](_0xbd1e('0x58'),_0x3e1f12[_0xbd1e('0x54')]);if(_0x5ed741&&_0x5ed741['monitor_format']){logger[_0xbd1e('0xb')](_0xbd1e('0x59'),_0xbd1e('0x5a'));_0x317e11['recordingURL']=util[_0xbd1e('0x23')](_0xbd1e('0x5b'),_0x3e1f12[_0xbd1e('0x56')],_0x317e11[_0xbd1e('0x5c')],md5(_0x317e11[_0xbd1e('0x5c')]));}else{_0x317e11[_0xbd1e('0x5d')]='';}return getConnection(_0x3e1f12)[_0xbd1e('0x2e')](function(_0x453540){_0x555dd0=_0x453540;return getUser(_0x3e1f12,_0x3be9ba[_0xbd1e('0xd')],_0x555dd0);})[_0xbd1e('0x2e')](function(_0x13617b){_0x2bf79e=_0x13617b;logger[_0xbd1e('0xb')](_0xbd1e('0x5e'),_0x2bf79e['id']);return getEndUser(_0x3e1f12,_0x317e11[_0xbd1e('0x5f')],_0x317e11[_0xbd1e('0x60')],_0x555dd0);})[_0xbd1e('0x2e')](function(_0x3d9c1b){_0x45a152=_0x3d9c1b;logger[_0xbd1e('0xb')](_0xbd1e('0x61'),_0x45a152['id']);return getTicket(_0x3e1f12,_0x2bf79e,_0x45a152,_0x391b55,_0x317e11,_0x391b55[_0xbd1e('0x62')],_0x555dd0,'Inbound');})[_0xbd1e('0x2e')](function(_0x661cf5){_0x28a432=_0x661cf5;logger[_0xbd1e('0xb')](_0xbd1e('0x63'));logger[_0xbd1e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x28a432['id']);return setRelationship(_0x555dd0,_0x2bf79e,_0x28a432,_0xbd1e('0x64'));})['then'](function(){return setRelationship(_0x555dd0,_0x45a152,_0x28a432,_0xbd1e('0x65'));})['then'](function(){return getServerInfo(_0x555dd0);})[_0xbd1e('0x2e')](function(_0x17e892){var _0x58fbc7=parseInt(_0x17e892['version'][_0xbd1e('0x66')](0x0));var _0x579bc4=util[_0xbd1e('0x23')](_0xbd1e('0x67'),_0x3e1f12['remoteUri'],_0x28a432['id']);if(_0x58fbc7>0x6){_0x579bc4=util[_0xbd1e('0x23')](_0xbd1e('0x68'),_0x3e1f12[_0xbd1e('0x54')],_0x28a432['id']);}logger['info'](_0xbd1e('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbd1e('0x23')](_0xbd1e('0x69'),_0x3be9ba[_0xbd1e('0xd')]),_0xbd1e('0x6a'),{'uri':_0x579bc4});})[_0xbd1e('0x6b')](function(_0x4466bf){logger[_0xbd1e('0x6c')](_0xbd1e('0x59'),JSON['stringify'](_0x4466bf));});};exports[_0xbd1e('0x6d')]=function(_0x7d90a7,_0x6d7486,_0x41b272,_0xddf89f,_0x5bf4cc,_0x19f8f5,_0x11aa66){var _0x2a3e98,_0x4ff2b3,_0x374dd7,_0x50729b;_0x19f8f5['remoteUri']=intUtil[_0xbd1e('0x55')](_0x19f8f5[_0xbd1e('0x54')]);_0x19f8f5['serverUrl']=intUtil[_0xbd1e('0x55')](_0x19f8f5[_0xbd1e('0x56')]);def['uri']=util[_0xbd1e('0x23')](_0xbd1e('0x58'),_0x19f8f5[_0xbd1e('0x54')]);if(_0x11aa66&&_0x11aa66['recordingFormat']&&_0x11aa66[_0xbd1e('0x6e')]!==_0xbd1e('0x6f')){logger[_0xbd1e('0xb')]('[OUTBOUND]',_0xbd1e('0x5a'));_0x6d7486[_0xbd1e('0x5d')]=util['format'](_0xbd1e('0x5b'),_0x19f8f5[_0xbd1e('0x56')],_0x6d7486[_0xbd1e('0x5c')],md5(_0x6d7486[_0xbd1e('0x5c')]));}return getConnection(_0x19f8f5)['then'](function(_0x4811b3){_0x50729b=_0x4811b3;return getUser(_0x19f8f5,_0xddf89f[_0xbd1e('0xd')],_0x50729b);})[_0xbd1e('0x2e')](function(_0x5a2421){_0x2a3e98=_0x5a2421;logger['info'](_0xbd1e('0x5e'),_0x2a3e98['id']);return getEndUser(_0x19f8f5,_0x6d7486['destcalleridname'],_0x6d7486['destcalleridnum'],_0x50729b);})[_0xbd1e('0x2e')](function(_0x406924){_0x4ff2b3=_0x406924;logger['info'](_0xbd1e('0x61'),_0x4ff2b3['id']);return getTicket(_0x19f8f5,_0x2a3e98,_0x4ff2b3,_0x41b272,_0x6d7486,_0x41b272[_0xbd1e('0x62')],_0x50729b,_0xbd1e('0x70'));})[_0xbd1e('0x2e')](function(_0x45f89d){_0x374dd7=_0x45f89d;logger[_0xbd1e('0xb')](_0xbd1e('0x63'));logger[_0xbd1e('0xb')](_0xbd1e('0x71'),_0x374dd7['id']);return setRelationship(_0x50729b,_0x2a3e98,_0x374dd7,_0xbd1e('0x64'));})[_0xbd1e('0x2e')](function(){return setRelationship(_0x50729b,_0x4ff2b3,_0x374dd7,_0xbd1e('0x65'));})[_0xbd1e('0x2e')](function(){return getServerInfo(_0x50729b);})[_0xbd1e('0x2e')](function(_0x235faa){var _0x407b79=parseInt(_0x235faa['version'][_0xbd1e('0x66')](0x0));var _0x5002cb=util[_0xbd1e('0x23')](_0xbd1e('0x67'),_0x19f8f5['remoteUri'],_0x374dd7['id']);if(_0x407b79>0x6){_0x5002cb=util[_0xbd1e('0x23')](_0xbd1e('0x68'),_0x19f8f5[_0xbd1e('0x54')],_0x374dd7['id']);}logger[_0xbd1e('0xb')](_0xbd1e('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbd1e('0x23')]('user:%s',_0xddf89f[_0xbd1e('0xd')]),_0xbd1e('0x6a'),{'uri':_0x5002cb});})['catch'](function(_0x5a4540){logger[_0xbd1e('0x6c')](_0xbd1e('0x72'),JSON[_0xbd1e('0x29')](_0x5a4540));});};exports[_0xbd1e('0x73')]=function(_0x1ff3bf,_0x34ca47,_0x3ca2d4,_0xeb731a,_0x3e65ee,_0x4bc971){var _0x53a222,_0xc154c6,_0xa0d240,_0x5d5f63;_0x4bc971[_0xbd1e('0x54')]=intUtil[_0xbd1e('0x55')](_0x4bc971[_0xbd1e('0x54')]);_0x4bc971['serverUrl']=intUtil['stripTrailingSlash'](_0x4bc971[_0xbd1e('0x56')]);def[_0xbd1e('0x57')]=util[_0xbd1e('0x23')](_0xbd1e('0x58'),_0x4bc971[_0xbd1e('0x54')]);if(_0x3e65ee&&_0x3e65ee[_0xbd1e('0x74')]){logger[_0xbd1e('0xb')]('['+_0x34ca47['lastevent'][_0xbd1e('0x75')]()+']','Recording\x20is\x20enabled!');_0x34ca47[_0xbd1e('0x5d')]=util[_0xbd1e('0x23')](_0xbd1e('0x5b'),_0x4bc971[_0xbd1e('0x56')],_0x34ca47[_0xbd1e('0x5c')],md5(_0x34ca47[_0xbd1e('0x5c')]));}else{_0x34ca47[_0xbd1e('0x5d')]='';}return getConnection(_0x4bc971)[_0xbd1e('0x2e')](function(_0x4d931d){_0x5d5f63=_0x4d931d;if(!_['isNil'](_0xeb731a)){return getUser(_0x4bc971,_0xeb731a[_0xbd1e('0xd')],_0x5d5f63);}else{return getUser(_0x4bc971,null,_0x5d5f63);}})[_0xbd1e('0x2e')](function(_0x50a809){_0x53a222=_0x50a809;logger[_0xbd1e('0xb')]('The\x20User\x20ID\x20is:',_0x53a222['id']);return getEndUser(_0x4bc971,_0x34ca47[_0xbd1e('0x5f')],_0x34ca47[_0xbd1e('0x60')],_0x5d5f63);})[_0xbd1e('0x2e')](function(_0x1c7b3d){_0xc154c6=_0x1c7b3d;logger[_0xbd1e('0xb')](_0xbd1e('0x61'),_0xc154c6['id']);return getTicket(_0x4bc971,_0x53a222,_0xc154c6,_0x3ca2d4,_0x34ca47,_0x3ca2d4[_0xbd1e('0x62')],_0x5d5f63,_0xbd1e('0x76'));})['then'](function(_0x2e24b2){_0xa0d240=_0x2e24b2;logger[_0xbd1e('0xb')](_0xbd1e('0x63'));logger[_0xbd1e('0xb')](_0xbd1e('0x71'),_0xa0d240['id']);return setRelationship(_0x5d5f63,_0x53a222,_0xa0d240,'users');})[_0xbd1e('0x2e')](function(){return setRelationship(_0x5d5f63,_0xc154c6,_0xa0d240,_0xbd1e('0x65'));})[_0xbd1e('0x2e')](function(){return getServerInfo(_0x5d5f63);})[_0xbd1e('0x6b')](function(_0x1cea0e){logger['error']('['+_0x34ca47[_0xbd1e('0x77')][_0xbd1e('0x75')]()+']',JSON['stringify'](_0x1cea0e));});}; \ 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 ae43abd..d06d1f9 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 _0x801e=['customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','variable','variableName','push','toString'];(function(_0x1711fa,_0xcc2e28){var _0x4c615c=function(_0x138f60){while(--_0x138f60){_0x1711fa['push'](_0x1711fa['shift']());}};_0x4c615c(++_0xcc2e28);}(_0x801e,0x13b));var _0xe801=function(_0x520557,_0x249a78){_0x520557=_0x520557-0x0;var _0x37a49a=_0x801e[_0x520557];return _0x37a49a;};'use strict';var _=require(_0xe801('0x0'));var util=require(_0xe801('0x1'));exports[_0xe801('0x2')]=function(_0x317844,_0x6ed08c,_0x1eb180){var _0x2d6d6a=[];if(_0x317844[_0xe801('0x3')]>0x0){var _0x339c62=_['sortBy'](_0x317844,['id']);for(var _0x3d9dd3=0x0;_0x3d9dd3<_0x339c62[_0xe801('0x3')];_0x3d9dd3++){var _0x547049=_0x339c62[_0x3d9dd3];if(_0x547049[_0xe801('0x4')]===_0xe801('0x5')){_0x2d6d6a['push'](_0x547049['content']);}else if(_0x547049[_0xe801('0x4')]===_0xe801('0x6')&&_0x547049[_0xe801('0x7')]){_0x6ed08c[_0x547049[_0xe801('0x7')]]&&_0x2d6d6a[_0xe801('0x8')](_0x6ed08c[_0x547049[_0xe801('0x7')]][_0xe801('0x9')]());}else if(_0x547049[_0xe801('0x4')]===_0xe801('0xa')&&_0x547049[_0xe801('0xb')]&&_0x547049[_0xe801('0xb')]['name']){_0x6ed08c[_0x547049[_0xe801('0xb')][_0xe801('0xc')][_0xe801('0xd')]()]&&_0x2d6d6a['push'](_0x6ed08c[_0x547049[_0xe801('0xb')]['name'][_0xe801('0xd')]()][_0xe801('0x9')]());}else if(_0x547049[_0xe801('0x4')]===_0xe801('0xe')){if(_0x547049[_0xe801('0xf')]===_0xe801('0x5')&&_0x547049[_0xe801('0x10')]){_0x2d6d6a[_0xe801('0x8')](util['format'](_0xe801('0x11'),_0x547049['key'],_0x547049['keyContent']));}else if(_0x547049[_0xe801('0xf')]===_0xe801('0x6')&&_0x547049['variableName']&&_0x547049[_0xe801('0x10')]){_0x6ed08c[_0x547049[_0xe801('0x7')]]&&_0x2d6d6a[_0xe801('0x8')](util[_0xe801('0x12')](_0xe801('0x11'),_0x547049[_0xe801('0x10')],_0x6ed08c[_0x547049[_0xe801('0x7')]]));}else if(_0x547049[_0xe801('0xf')]===_0xe801('0xa')&&_0x547049['Variable']&&_0x547049['Variable'][_0xe801('0xc')]&&_0x547049['key']){_0x6ed08c[_0x547049['Variable'][_0xe801('0xc')][_0xe801('0xd')]()]&&_0x2d6d6a[_0xe801('0x8')](util[_0xe801('0x12')](_0xe801('0x11'),_0x547049[_0xe801('0x10')],_0x6ed08c[_0x547049[_0xe801('0xb')][_0xe801('0xc')]['toLowerCase']()]));}}}}return _0x2d6d6a['join'](_0x1eb180);};exports[_0xe801('0x13')]=function(_0x8916f5){var _0x4455c8=_0x8916f5[_0xe801('0x14')](-0x1);if(_0x4455c8==='/'){_0x8916f5=_0x8916f5[_0xe801('0x15')](0x0,_0x8916f5[_0xe801('0x16')](_0x4455c8));}return _0x8916f5;};exports[_0xe801('0x17')]=function(_0x4003c3){if(!_[_0xe801('0x18')](_0x4003c3)&&_0x4003c3!==''){var _0x41dd97=/^(([^<>()\[\]\\.,;:\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 _0x41dd97['test'](String(_0x4003c3)[_0xe801('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x9941=['getString','length','sortBy','type','string','push','variable','variableName','toString','Variable','name','toLowerCase','keyValue','%s:\x20%s','key','keyContent','format','keyType','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','lodash','util'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x9941,0x11c));var _0x1994=function(_0x1121b1,_0x4e40f2){_0x1121b1=_0x1121b1-0x0;var _0x5bf648=_0x9941[_0x1121b1];return _0x5bf648;};'use strict';var _=require(_0x1994('0x0'));var util=require(_0x1994('0x1'));exports[_0x1994('0x2')]=function(_0xfff80,_0x211592,_0x4d60d6){var _0x316107=[];if(_0xfff80[_0x1994('0x3')]>0x0){var _0x1d2094=_[_0x1994('0x4')](_0xfff80,['id']);for(var _0x7864f=0x0;_0x7864f<_0x1d2094['length'];_0x7864f++){var _0x300182=_0x1d2094[_0x7864f];if(_0x300182[_0x1994('0x5')]===_0x1994('0x6')){_0x316107[_0x1994('0x7')](_0x300182['content']);}else if(_0x300182[_0x1994('0x5')]===_0x1994('0x8')&&_0x300182[_0x1994('0x9')]){_0x211592[_0x300182[_0x1994('0x9')]]&&_0x316107[_0x1994('0x7')](_0x211592[_0x300182[_0x1994('0x9')]][_0x1994('0xa')]());}else if(_0x300182[_0x1994('0x5')]==='customVariable'&&_0x300182[_0x1994('0xb')]&&_0x300182[_0x1994('0xb')][_0x1994('0xc')]){_0x211592[_0x300182[_0x1994('0xb')][_0x1994('0xc')][_0x1994('0xd')]()]&&_0x316107[_0x1994('0x7')](_0x211592[_0x300182['Variable'][_0x1994('0xc')][_0x1994('0xd')]()][_0x1994('0xa')]());}else if(_0x300182[_0x1994('0x5')]===_0x1994('0xe')){if(_0x300182['keyType']==='string'&&_0x300182['key']){_0x316107[_0x1994('0x7')](util['format'](_0x1994('0xf'),_0x300182[_0x1994('0x10')],_0x300182[_0x1994('0x11')]));}else if(_0x300182['keyType']==='variable'&&_0x300182[_0x1994('0x9')]&&_0x300182[_0x1994('0x10')]){_0x211592[_0x300182[_0x1994('0x9')]]&&_0x316107['push'](util[_0x1994('0x12')](_0x1994('0xf'),_0x300182[_0x1994('0x10')],_0x211592[_0x300182['variableName']]));}else if(_0x300182[_0x1994('0x13')]==='customVariable'&&_0x300182[_0x1994('0xb')]&&_0x300182['Variable']['name']&&_0x300182[_0x1994('0x10')]){_0x211592[_0x300182[_0x1994('0xb')]['name'][_0x1994('0xd')]()]&&_0x316107['push'](util[_0x1994('0x12')]('%s:\x20%s',_0x300182[_0x1994('0x10')],_0x211592[_0x300182[_0x1994('0xb')]['name'][_0x1994('0xd')]()]));}}}}return _0x316107[_0x1994('0x14')](_0x4d60d6);};exports[_0x1994('0x15')]=function(_0x3f7acd){var _0x1e9aee=_0x3f7acd['slice'](-0x1);if(_0x1e9aee==='/'){_0x3f7acd=_0x3f7acd['substring'](0x0,_0x3f7acd[_0x1994('0x16')](_0x1e9aee));}return _0x3f7acd;};exports[_0x1994('0x17')]=function(_0x2e0450){if(!_[_0x1994('0x18')](_0x2e0450)&&_0x2e0450!==''){var _0x37578e=/^(([^<>()\[\]\\.,;:\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 _0x37578e[_0x1994('0x19')](String(_0x2e0450)[_0x1994('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index be3ab8f..fc04f3c 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 _0xde1a=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','toUpperCase','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Open','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x3a6f2a,_0x4fe258){var _0x5c3430=function(_0x360e92){while(--_0x360e92){_0x3a6f2a['push'](_0x3a6f2a['shift']());}};_0x5c3430(++_0x4fe258);}(_0xde1a,0x74));var _0xade1=function(_0xa9111b,_0x405a1a){_0xa9111b=_0xa9111b-0x0;var _0x5f5067=_0xde1a[_0xa9111b];return _0x5f5067;};'use strict';var _=require(_0xade1('0x0'));var rp=require(_0xade1('0x1'));var BPromise=require(_0xade1('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0xade1('0x3'));var intUtil=require('./util');var config=require(_0xade1('0x4'));var logger=require('../../../../config/logger')(_0xade1('0x5'));config[_0xade1('0x6')]=_[_0xade1('0x7')](config[_0xade1('0x6')],{'host':_0xade1('0x8'),'port':0x18eb});var io=require(_0xade1('0x9'))(new Redis(config[_0xade1('0x6')]));function emit(_0x478fd5,_0x3bd4a9,_0x1cd361){io['to'](_0x478fd5)['emit'](_0x3bd4a9,_0x1cd361);}function getCustomFields(_0x25a033,_0xc66051){var _0x517e6c={};if(_0x25a033[_0xade1('0xa')]>0x0){_[_0xade1('0xb')](_0x25a033,function(_0x428544){if(_0x428544[_0xade1('0xc')]===_0xade1('0xd')&&_0x428544[_0xade1('0xe')]){_0x517e6c[_0x428544[_0xade1('0xe')]]=_0x428544['content'][_0xade1('0xf')]();}else if(_0x428544[_0xade1('0xc')]===_0xade1('0x10')&&_0x428544[_0xade1('0x11')]&&_0x428544[_0xade1('0xe')]&&_0xc66051[_0x428544[_0xade1('0x11')]]){_0x517e6c[_0x428544[_0xade1('0xe')]]=_0xc66051[_0x428544['variableName']]['toString']();}else if(_0x428544[_0xade1('0xc')]===_0xade1('0x12')&&_0x428544[_0xade1('0x13')]&&_0x428544[_0xade1('0x13')][_0xade1('0x14')]&&_0x428544[_0xade1('0xe')]&&_0xc66051[_0x428544[_0xade1('0x13')][_0xade1('0x14')][_0xade1('0x15')]()]){_0x517e6c[_0x428544[_0xade1('0xe')]]=_0xc66051[_0x428544[_0xade1('0x13')][_0xade1('0x14')][_0xade1('0x15')]()][_0xade1('0xf')]();}});}return _0x517e6c;}function createTicket(_0x4c5c0e,_0x1877c1,_0x15760e,_0x567698,_0x115b54,_0x42d104,_0x2f5895){logger[_0xade1('0x16')]('Creating\x20new\x20ticket...');var _0x270cbd=_[_0xade1('0x17')]({'parent_id':'','assigned_user_id':_0x1877c1['id'],'ticketpriorities':'Normal','ticketstatus':_0xade1('0x18'),'ticket_title':intUtil['getString'](_0x567698[_0xade1('0x19')],_0x115b54,'\x20'),'description':intUtil['getString'](_0x567698[_0xade1('0x1a')],_0x115b54,'\x0a'),'contact_id':_0x15760e['id']},getCustomFields(_0x42d104,_0x115b54));var _0x40f05c={'method':_0xade1('0x1b'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0x4c5c0e[_0xade1('0x1e')]),'form':{'operation':_0xade1('0x1f'),'username':_0x4c5c0e[_0xade1('0x20')],'sessionName':_0x2f5895[_0xade1('0x21')],'elementType':_0xade1('0x22'),'element':JSON[_0xade1('0x23')](_0x270cbd)},'json':!![]};return request(_0x40f05c)[_0xade1('0x24')](function(_0xbe97bc){if(_0xbe97bc[_0xade1('0x25')]){return BPromise[_0xade1('0x26')]({'id':_0xbe97bc[_0xade1('0x27')]['id']});}else{throw new Error(util['format'](_0xade1('0x28'),JSON[_0xade1('0x23')](_0xbe97bc[_0xade1('0x29')])));}})[_0xade1('0x2a')](function(_0x56d5b1){var _0x1bbccf=_0x56d5b1[_0xade1('0x2b')]||0x1f4;logger['error'](_0xade1('0x2c'),'createTicket',_0x1bbccf,JSON[_0xade1('0x23')](_0x56d5b1));});}function getUser(_0xb8919,_0x10e83a,_0x544c1b){if(intUtil[_0xade1('0x2d')](_0x10e83a)){logger[_0xade1('0x16')](_0xade1('0x2e'),_0x10e83a);return request({'method':_0xade1('0x2f'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0xb8919[_0xade1('0x1e')]),'qs':{'operation':_0xade1('0x30'),'username':_0xb8919[_0xade1('0x20')],'sessionName':_0x544c1b['sessionName'],'query':util[_0xade1('0x1c')](_0xade1('0x31'),_0x10e83a)},'json':!![]})[_0xade1('0x24')](function(_0x1d1fd0){if(_0x1d1fd0[_0xade1('0x25')]&&_0x1d1fd0[_0xade1('0x27')][_0xade1('0xa')]){logger[_0xade1('0x16')](_0xade1('0x32'));return BPromise[_0xade1('0x26')]({'id':_0x1d1fd0[_0xade1('0x27')][0x0]['id'],'email':_0x1d1fd0[_0xade1('0x27')][0x0]['email1'],'name':_0x1d1fd0[_0xade1('0x27')][0x0]['first_name']+'\x20'+_0x1d1fd0['result'][_0xade1('0x33')]});}else{logger['info'](_0xade1('0x34'));return BPromise['resolve']({'id':_0x544c1b[_0xade1('0x35')],'email':_0xb8919[_0xade1('0x20')],'name':_0xade1('0x36')});}})[_0xade1('0x2a')](function(_0x427a30){var _0x11d77c=_0x427a30['statusCode']||0x1f4;logger[_0xade1('0x29')](_0xade1('0x2c'),_0xade1('0x37'),_0x11d77c,JSON[_0xade1('0x23')](_0x427a30));});}else{logger[_0xade1('0x16')](_0xade1('0x34'));return BPromise['resolve']({'id':_0x544c1b[_0xade1('0x35')],'email':_0xb8919[_0xade1('0x20')],'name':_0xade1('0x36')})[_0xade1('0x2a')](function(_0x451a35){var _0x5ec68a=_0x451a35[_0xade1('0x2b')]||0x1f4;logger['error'](_0xade1('0x2c'),_0xade1('0x37'),_0x5ec68a,JSON['stringify'](_0x451a35));});}}function getEndUser(_0x219836,_0xc7b5cd,_0x4a7375,_0x2121f8){logger[_0xade1('0x16')](_0xade1('0x38'),_0x4a7375);return request({'method':_0xade1('0x2f'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0x219836[_0xade1('0x1e')]),'qs':{'operation':_0xade1('0x30'),'username':_0x219836['username'],'sessionName':_0x2121f8[_0xade1('0x21')],'query':util[_0xade1('0x1c')](_0xade1('0x39'),_0x4a7375,_0x4a7375,_0x4a7375,_0x4a7375,_0x4a7375)},'json':!![]})[_0xade1('0x24')](function(_0x511487){if(_0x511487['success']&&_0x511487[_0xade1('0x27')][_0xade1('0xa')]){logger[_0xade1('0x16')](_0xade1('0x3a'));return BPromise[_0xade1('0x26')]({'id':_0x511487['result'][0x0]['id'],'name':_0x511487[_0xade1('0x27')][0x0][_0xade1('0x3b')]+'\x20'+_0x511487['result'][0x0][_0xade1('0x3c')],'phone':_0x4a7375});}else{logger['info'](_0xade1('0x3d'));return request({'method':_0xade1('0x1b'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0x219836['remoteUri']),'form':{'operation':'create','sessionName':_0x2121f8[_0xade1('0x21')],'elementType':_0xade1('0x3e'),'element':JSON['stringify']({'lastname':_0xc7b5cd,'phone':_0x4a7375,'assigned_user_id':'\x20'})},'json':!![]})[_0xade1('0x24')](function(_0x3b0abc){logger['info'](_0xade1('0x3f'));return BPromise[_0xade1('0x26')]({'id':_0x3b0abc['result']['id'],'name':_0x3b0abc[_0xade1('0x27')][_0xade1('0x3c')],'phone':_0x3b0abc[_0xade1('0x27')][_0xade1('0x40')]});})[_0xade1('0x2a')](function(_0x23a36b){var _0x41884a=_0x23a36b[_0xade1('0x2b')]||0x1f4;logger[_0xade1('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xade1('0x41'),_0x41884a,JSON[_0xade1('0x23')](_0x23a36b));});}});}function getConnection(_0xa3fc28){var _0x1a4c6f=_0xa3fc28['username'];var _0x2a3249=_0xa3fc28[_0xade1('0x42')];return request({'method':'GET','uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0xa3fc28[_0xade1('0x1e')]),'qs':{'operation':_0xade1('0x43'),'username':_0x1a4c6f},'json':!![]})['then'](function(_0x3d7378){if(_0x3d7378[_0xade1('0x25')]){return request({'method':_0xade1('0x1b'),'uri':util[_0xade1('0x1c')]('%s/webservice.php',_0xa3fc28[_0xade1('0x1e')]),'form':{'operation':_0xade1('0x44'),'username':_0x1a4c6f,'accessKey':md5(_0x3d7378[_0xade1('0x27')]['token']+_0x2a3249)},'json':!![]});}})[_0xade1('0x24')](function(_0x48b5e5){if(_0x48b5e5[_0xade1('0x25')]){return BPromise[_0xade1('0x26')](_0x48b5e5[_0xade1('0x27')]);}else{throw new Error(util[_0xade1('0x1c')]('Account\x20%d\x20is\x20not\x20valid',_0xa3fc28['id']));}})[_0xade1('0x2a')](function(_0x5f04cb){var _0x569a1e=_0x5f04cb[_0xade1('0x2b')]||0x1f4;logger[_0xade1('0x29')](_0xade1('0x2c'),_0xade1('0x45'),_0x569a1e,JSON['stringify'](_0x5f04cb));});}function request(_0x1160e9){logger['info'](_0xade1('0x46'),JSON['stringify'](_0x1160e9));return rp(_0x1160e9);}exports[_0xade1('0x47')]=function(_0x2e4dec,_0x2959ba,_0x5eafac,_0x47998b,_0x581825,_0x5072fe){var _0x1d01b6,_0x48f1ad,_0x2b74b6,_0x6a199c;_0x5072fe[_0xade1('0x1e')]=intUtil[_0xade1('0x48')](_0x5072fe[_0xade1('0x1e')]);if(_0x581825&&_0x581825['monitor_format']){logger['info'](_0xade1('0x49'),_0xade1('0x4a'));_0x2959ba[_0xade1('0x4b')]=util[_0xade1('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5072fe[_0xade1('0x4c')],_0x2959ba[_0xade1('0x4d')],md5(_0x2959ba['uniqueid']));}else{_0x2959ba[_0xade1('0x4b')]='';}return getConnection(_0x5072fe)[_0xade1('0x24')](function(_0x4adb93){_0x6a199c=_0x4adb93;return getUser(_0x5072fe,_0x47998b[_0xade1('0x4e')],_0x6a199c);})['then'](function(_0x171ca6){_0x1d01b6=_0x171ca6;logger[_0xade1('0x16')](_0xade1('0x4f'),_0x1d01b6['id']);return getEndUser(_0x5072fe,_0x2959ba['calleridname'],_0x2959ba[_0xade1('0x50')],_0x6a199c);})[_0xade1('0x24')](function(_0xc1f047){_0x48f1ad=_0xc1f047;logger[_0xade1('0x16')](_0xade1('0x51'),_0x48f1ad['id']);return createTicket(_0x5072fe,_0x1d01b6,_0x48f1ad,_0x5eafac,_0x2959ba,_0x5eafac['Fields'],_0x6a199c);})[_0xade1('0x24')](function(_0x4fb8c5){_0x2b74b6=_0x4fb8c5;logger[_0xade1('0x16')](_0xade1('0x52'));logger[_0xade1('0x16')](_0xade1('0x53'),_0x2b74b6['id']);var _0x28b00b=util[_0xade1('0x1c')](_0xade1('0x54'),_0x5072fe['remoteUri'],_[_0xade1('0x55')](_0x2b74b6['id'],'x')[0x1]);logger[_0xade1('0x16')](_0xade1('0x49'),_0xade1('0x56'));emit(util['format'](_0xade1('0x57'),_0x47998b[_0xade1('0x14')]),_0xade1('0x58'),{'uri':_0x28b00b});})[_0xade1('0x2a')](function(_0x453c24){logger[_0xade1('0x29')](_0xade1('0x49'),JSON[_0xade1('0x23')](_0x453c24));});};exports[_0xade1('0x59')]=function(_0x92bb29,_0x29797d,_0x4a03c2,_0x249c09,_0x535c7f,_0x168f79,_0x533f5d){var _0x14dcc8,_0x2842b8,_0x589fb3,_0x2c93de;_0x168f79[_0xade1('0x1e')]=intUtil[_0xade1('0x48')](_0x168f79['remoteUri']);_0x168f79[_0xade1('0x4c')]=intUtil[_0xade1('0x48')](_0x168f79[_0xade1('0x4c')]);if(_0x533f5d&&_0x533f5d[_0xade1('0x5a')]&&_0x533f5d[_0xade1('0x5a')]!==_0xade1('0x5b')){logger['info'](_0xade1('0x5c'),'Recording\x20is\x20enabled!');_0x29797d['recordingURL']=util[_0xade1('0x1c')](_0xade1('0x5d'),_0x168f79[_0xade1('0x4c')],_0x29797d[_0xade1('0x4d')],md5(_0x29797d[_0xade1('0x4d')]));}return getConnection(_0x168f79)[_0xade1('0x24')](function(_0x3ba6f7){_0x2c93de=_0x3ba6f7;return getUser(_0x168f79,_0x249c09['email'],_0x2c93de);})[_0xade1('0x24')](function(_0x7605aa){_0x14dcc8=_0x7605aa;logger[_0xade1('0x16')](_0xade1('0x4f'),_0x14dcc8['id']);return getEndUser(_0x168f79,_0x29797d[_0xade1('0x5e')],_0x29797d[_0xade1('0x5f')],_0x2c93de);})[_0xade1('0x24')](function(_0x3d071c){_0x2842b8=_0x3d071c;logger[_0xade1('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2842b8['id']);return createTicket(_0x168f79,_0x14dcc8,_0x2842b8,_0x4a03c2,_0x29797d,_0x4a03c2[_0xade1('0x60')],_0x2c93de);})[_0xade1('0x24')](function(_0x41f808){_0x589fb3=_0x41f808;logger['info'](_0xade1('0x52'));logger['info'](_0xade1('0x53'),_0x589fb3['id']);var _0x3c5267=util[_0xade1('0x1c')](_0xade1('0x54'),_0x168f79['remoteUri'],_[_0xade1('0x55')](_0x589fb3['id'],'x')[0x1]);logger[_0xade1('0x16')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xade1('0x1c')](_0xade1('0x57'),_0x249c09[_0xade1('0x14')]),_0xade1('0x58'),{'uri':_0x3c5267});})[_0xade1('0x2a')](function(_0x257e78){logger['error']('[OUTBOUND]',JSON['stringify'](_0x257e78));});};exports['unmanaged']=function(_0xbb312c,_0x41ee98,_0x1cc867,_0x5edc9f,_0x32f857,_0x3f6d3f){var _0x2f1c26,_0x52ece2,_0x3ed11f,_0xde158f;_0x3f6d3f['remoteUri']=intUtil[_0xade1('0x48')](_0x3f6d3f[_0xade1('0x1e')]);_0x3f6d3f[_0xade1('0x4c')]=intUtil[_0xade1('0x48')](_0x3f6d3f[_0xade1('0x4c')]);if(_0x32f857&&_0x32f857['monitor_format']){logger[_0xade1('0x16')]('['+_0x41ee98['lastevent'][_0xade1('0x61')]()+']','Recording\x20is\x20enabled!');_0x41ee98[_0xade1('0x4b')]=util[_0xade1('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f6d3f['serverUrl'],_0x41ee98['uniqueid'],md5(_0x41ee98[_0xade1('0x4d')]));}else{_0x41ee98['recordingURL']='';}return getConnection(_0x3f6d3f)['then'](function(_0x514ae9){_0xde158f=_0x514ae9;return getUser(_0x3f6d3f,'',_0xde158f);})['then'](function(_0x358eb0){_0x2f1c26=_0x358eb0;logger[_0xade1('0x16')]('The\x20User\x20ID\x20is:',_0x2f1c26['id']);return getEndUser(_0x3f6d3f,_0x41ee98['calleridname'],_0x41ee98['calleridnum'],_0xde158f);})[_0xade1('0x24')](function(_0x289ac2){_0x52ece2=_0x289ac2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x52ece2['id']);return createTicket(_0x3f6d3f,_0x2f1c26,_0x52ece2,_0x1cc867,_0x41ee98,_0x1cc867[_0xade1('0x60')],_0xde158f);})[_0xade1('0x24')](function(_0x29f057){_0x3ed11f=_0x29f057;logger[_0xade1('0x16')](_0xade1('0x52'));logger[_0xade1('0x16')]('The\x20Ticket\x20ID\x20is:',_0x3ed11f['id']);})[_0xade1('0x2a')](function(_0x1031cb){logger[_0xade1('0x29')]('['+_0x41ee98[_0xade1('0x62')]['toUpperCase']()+']',JSON[_0xade1('0x23')](_0x1031cb));});}; \ No newline at end of file +var _0xbd1f=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','email','lastevent','toUpperCase','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','emit','length','type','string','idField','content','toString','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','statusCode','getUser','admin','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!','Contacts','Enduser\x20created.','phone','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields'];(function(_0x2bd0f3,_0x259957){var _0x1aad5a=function(_0xc2ee62){while(--_0xc2ee62){_0x2bd0f3['push'](_0x2bd0f3['shift']());}};_0x1aad5a(++_0x259957);}(_0xbd1f,0xd2));var _0xfbd1=function(_0x1f5169,_0x50224c){_0x1f5169=_0x1f5169-0x0;var _0x28989f=_0xbd1f[_0x1f5169];return _0x28989f;};'use strict';var _=require('lodash');var rp=require(_0xfbd1('0x0'));var BPromise=require(_0xfbd1('0x1'));var md5=require('md5');var util=require(_0xfbd1('0x2'));var Redis=require(_0xfbd1('0x3'));var intUtil=require(_0xfbd1('0x4'));var config=require(_0xfbd1('0x5'));var logger=require('../../../../config/logger')(_0xfbd1('0x6'));config[_0xfbd1('0x7')]=_[_0xfbd1('0x8')](config[_0xfbd1('0x7')],{'host':_0xfbd1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfbd1('0x7')]));function emit(_0x1f2078,_0x4dcbf1,_0x4068d3){io['to'](_0x1f2078)[_0xfbd1('0xa')](_0x4dcbf1,_0x4068d3);}function getCustomFields(_0x301e51,_0x2893e1){var _0x131a6a={};if(_0x301e51[_0xfbd1('0xb')]>0x0){_['forEach'](_0x301e51,function(_0x2b0c54){if(_0x2b0c54[_0xfbd1('0xc')]===_0xfbd1('0xd')&&_0x2b0c54[_0xfbd1('0xe')]){_0x131a6a[_0x2b0c54[_0xfbd1('0xe')]]=_0x2b0c54[_0xfbd1('0xf')][_0xfbd1('0x10')]();}else if(_0x2b0c54[_0xfbd1('0xc')]===_0xfbd1('0x11')&&_0x2b0c54[_0xfbd1('0x12')]&&_0x2b0c54['idField']&&_0x2893e1[_0x2b0c54[_0xfbd1('0x12')]]){_0x131a6a[_0x2b0c54['idField']]=_0x2893e1[_0x2b0c54[_0xfbd1('0x12')]][_0xfbd1('0x10')]();}else if(_0x2b0c54['type']==='customVariable'&&_0x2b0c54[_0xfbd1('0x13')]&&_0x2b0c54[_0xfbd1('0x13')][_0xfbd1('0x14')]&&_0x2b0c54[_0xfbd1('0xe')]&&_0x2893e1[_0x2b0c54[_0xfbd1('0x13')][_0xfbd1('0x14')][_0xfbd1('0x15')]()]){_0x131a6a[_0x2b0c54[_0xfbd1('0xe')]]=_0x2893e1[_0x2b0c54[_0xfbd1('0x13')][_0xfbd1('0x14')][_0xfbd1('0x15')]()][_0xfbd1('0x10')]();}});}return _0x131a6a;}function createTicket(_0x282d54,_0x31284b,_0x418dcb,_0x1b4efa,_0x4a6609,_0x462d50,_0x12b11f){logger[_0xfbd1('0x16')](_0xfbd1('0x17'));var _0x5639c3=_['merge']({'parent_id':'','assigned_user_id':_0x31284b['id'],'ticketpriorities':_0xfbd1('0x18'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x1b4efa[_0xfbd1('0x19')],_0x4a6609,'\x20'),'description':intUtil['getString'](_0x1b4efa['Descriptions'],_0x4a6609,'\x0a'),'contact_id':_0x418dcb['id']},getCustomFields(_0x462d50,_0x4a6609));var _0x542665={'method':_0xfbd1('0x1a'),'uri':util[_0xfbd1('0x1b')](_0xfbd1('0x1c'),_0x282d54[_0xfbd1('0x1d')]),'form':{'operation':_0xfbd1('0x1e'),'username':_0x282d54[_0xfbd1('0x1f')],'sessionName':_0x12b11f[_0xfbd1('0x20')],'elementType':'HelpDesk','element':JSON[_0xfbd1('0x21')](_0x5639c3)},'json':!![]};return request(_0x542665)[_0xfbd1('0x22')](function(_0x1bacee){if(_0x1bacee[_0xfbd1('0x23')]){return BPromise[_0xfbd1('0x24')]({'id':_0x1bacee[_0xfbd1('0x25')]['id']});}else{throw new Error(util[_0xfbd1('0x1b')](_0xfbd1('0x26'),JSON[_0xfbd1('0x21')](_0x1bacee[_0xfbd1('0x27')])));}})['catch'](function(_0x1dc145){var _0x320e0d=_0x1dc145['statusCode']||0x1f4;logger[_0xfbd1('0x27')](_0xfbd1('0x28'),_0xfbd1('0x29'),_0x320e0d,JSON[_0xfbd1('0x21')](_0x1dc145));});}function getUser(_0x1af25f,_0x5a7170,_0x5e38dd){if(intUtil[_0xfbd1('0x2a')](_0x5a7170)){logger[_0xfbd1('0x16')](_0xfbd1('0x2b'),_0x5a7170);return request({'method':'GET','uri':util[_0xfbd1('0x1b')](_0xfbd1('0x1c'),_0x1af25f['remoteUri']),'qs':{'operation':_0xfbd1('0x2c'),'username':_0x1af25f['username'],'sessionName':_0x5e38dd['sessionName'],'query':util[_0xfbd1('0x1b')](_0xfbd1('0x2d'),_0x5a7170)},'json':!![]})[_0xfbd1('0x22')](function(_0x1d2272){if(_0x1d2272[_0xfbd1('0x23')]&&_0x1d2272[_0xfbd1('0x25')]['length']){logger['info'](_0xfbd1('0x2e'));return BPromise[_0xfbd1('0x24')]({'id':_0x1d2272['result'][0x0]['id'],'email':_0x1d2272[_0xfbd1('0x25')][0x0][_0xfbd1('0x2f')],'name':_0x1d2272[_0xfbd1('0x25')][0x0][_0xfbd1('0x30')]+'\x20'+_0x1d2272[_0xfbd1('0x25')][_0xfbd1('0x31')]});}else{logger[_0xfbd1('0x16')](_0xfbd1('0x32'));return BPromise[_0xfbd1('0x24')]({'id':_0x5e38dd[_0xfbd1('0x33')],'email':_0x1af25f[_0xfbd1('0x1f')],'name':'admin'});}})[_0xfbd1('0x34')](function(_0x22cf99){var _0xb67e36=_0x22cf99[_0xfbd1('0x35')]||0x1f4;logger[_0xfbd1('0x27')](_0xfbd1('0x28'),_0xfbd1('0x36'),_0xb67e36,JSON[_0xfbd1('0x21')](_0x22cf99));});}else{logger[_0xfbd1('0x16')](_0xfbd1('0x32'));return BPromise[_0xfbd1('0x24')]({'id':_0x5e38dd['userId'],'email':_0x1af25f[_0xfbd1('0x1f')],'name':_0xfbd1('0x37')})[_0xfbd1('0x34')](function(_0x3900d1){var _0x13c965=_0x3900d1[_0xfbd1('0x35')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x13c965,JSON[_0xfbd1('0x21')](_0x3900d1));});}}function getEndUser(_0x1d7a3e,_0x3e241a,_0x1fbc4c,_0x4b9f2c){logger[_0xfbd1('0x16')](_0xfbd1('0x38'),_0x1fbc4c);return request({'method':_0xfbd1('0x39'),'uri':util['format'](_0xfbd1('0x1c'),_0x1d7a3e[_0xfbd1('0x1d')]),'qs':{'operation':_0xfbd1('0x2c'),'username':_0x1d7a3e[_0xfbd1('0x1f')],'sessionName':_0x4b9f2c[_0xfbd1('0x20')],'query':util[_0xfbd1('0x1b')](_0xfbd1('0x3a'),_0x1fbc4c,_0x1fbc4c,_0x1fbc4c,_0x1fbc4c,_0x1fbc4c)},'json':!![]})[_0xfbd1('0x22')](function(_0x3613c8){if(_0x3613c8[_0xfbd1('0x23')]&&_0x3613c8[_0xfbd1('0x25')]['length']){logger[_0xfbd1('0x16')](_0xfbd1('0x3b'));return BPromise[_0xfbd1('0x24')]({'id':_0x3613c8[_0xfbd1('0x25')][0x0]['id'],'name':_0x3613c8[_0xfbd1('0x25')][0x0][_0xfbd1('0x3c')]+'\x20'+_0x3613c8[_0xfbd1('0x25')][0x0][_0xfbd1('0x3d')],'phone':_0x1fbc4c});}else{logger['info'](_0xfbd1('0x3e'));return request({'method':'POST','uri':util[_0xfbd1('0x1b')](_0xfbd1('0x1c'),_0x1d7a3e[_0xfbd1('0x1d')]),'form':{'operation':_0xfbd1('0x1e'),'sessionName':_0x4b9f2c[_0xfbd1('0x20')],'elementType':_0xfbd1('0x3f'),'element':JSON['stringify']({'lastname':_0x3e241a,'phone':_0x1fbc4c,'assigned_user_id':'\x20'})},'json':!![]})[_0xfbd1('0x22')](function(_0x5d21e1){logger[_0xfbd1('0x16')](_0xfbd1('0x40'));return BPromise['resolve']({'id':_0x5d21e1[_0xfbd1('0x25')]['id'],'name':_0x5d21e1['result'][_0xfbd1('0x3d')],'phone':_0x5d21e1[_0xfbd1('0x25')][_0xfbd1('0x41')]});})[_0xfbd1('0x34')](function(_0x253972){var _0x4f2de7=_0x253972[_0xfbd1('0x35')]||0x1f4;logger[_0xfbd1('0x27')](_0xfbd1('0x28'),'getEndUser',_0x4f2de7,JSON[_0xfbd1('0x21')](_0x253972));});}});}function getConnection(_0x5d4451){var _0x444ced=_0x5d4451[_0xfbd1('0x1f')];var _0x5b4aed=_0x5d4451['accessKey'];return request({'method':_0xfbd1('0x39'),'uri':util[_0xfbd1('0x1b')](_0xfbd1('0x1c'),_0x5d4451[_0xfbd1('0x1d')]),'qs':{'operation':_0xfbd1('0x42'),'username':_0x444ced},'json':!![]})[_0xfbd1('0x22')](function(_0x1c8bc0){if(_0x1c8bc0['success']){return request({'method':_0xfbd1('0x1a'),'uri':util[_0xfbd1('0x1b')](_0xfbd1('0x1c'),_0x5d4451['remoteUri']),'form':{'operation':_0xfbd1('0x43'),'username':_0x444ced,'accessKey':md5(_0x1c8bc0[_0xfbd1('0x25')][_0xfbd1('0x44')]+_0x5b4aed)},'json':!![]});}})[_0xfbd1('0x22')](function(_0x3daa06){if(_0x3daa06[_0xfbd1('0x23')]){return BPromise[_0xfbd1('0x24')](_0x3daa06[_0xfbd1('0x25')]);}else{throw new Error(util[_0xfbd1('0x1b')](_0xfbd1('0x45'),_0x5d4451['id']));}})[_0xfbd1('0x34')](function(_0x23cc7c){var _0x1f6c86=_0x23cc7c[_0xfbd1('0x35')]||0x1f4;logger[_0xfbd1('0x27')](_0xfbd1('0x28'),_0xfbd1('0x46'),_0x1f6c86,JSON[_0xfbd1('0x21')](_0x23cc7c));});}function request(_0x12bad5){logger[_0xfbd1('0x16')](_0xfbd1('0x47'),JSON[_0xfbd1('0x21')](_0x12bad5));return rp(_0x12bad5);}exports[_0xfbd1('0x48')]=function(_0x685879,_0x26095e,_0x535057,_0x3873bd,_0x370446,_0x33a311){var _0x4b3c10,_0x2fcc16,_0x1aba70,_0x2cfe5e;_0x33a311[_0xfbd1('0x1d')]=intUtil[_0xfbd1('0x49')](_0x33a311[_0xfbd1('0x1d')]);if(_0x370446&&_0x370446['monitor_format']){logger[_0xfbd1('0x16')]('[QUEUE]',_0xfbd1('0x4a'));_0x26095e[_0xfbd1('0x4b')]=util[_0xfbd1('0x1b')](_0xfbd1('0x4c'),_0x33a311[_0xfbd1('0x4d')],_0x26095e[_0xfbd1('0x4e')],md5(_0x26095e[_0xfbd1('0x4e')]));}else{_0x26095e['recordingURL']='';}return getConnection(_0x33a311)[_0xfbd1('0x22')](function(_0x1c6490){_0x2cfe5e=_0x1c6490;return getUser(_0x33a311,_0x3873bd['email'],_0x2cfe5e);})[_0xfbd1('0x22')](function(_0xbce457){_0x4b3c10=_0xbce457;logger[_0xfbd1('0x16')](_0xfbd1('0x4f'),_0x4b3c10['id']);return getEndUser(_0x33a311,_0x26095e[_0xfbd1('0x50')],_0x26095e[_0xfbd1('0x51')],_0x2cfe5e);})['then'](function(_0x112f8c){_0x2fcc16=_0x112f8c;logger['info'](_0xfbd1('0x52'),_0x2fcc16['id']);return createTicket(_0x33a311,_0x4b3c10,_0x2fcc16,_0x535057,_0x26095e,_0x535057[_0xfbd1('0x53')],_0x2cfe5e);})[_0xfbd1('0x22')](function(_0x1efca8){_0x1aba70=_0x1efca8;logger[_0xfbd1('0x16')](_0xfbd1('0x54'));logger[_0xfbd1('0x16')](_0xfbd1('0x55'),_0x1aba70['id']);var _0x18ebbc=util[_0xfbd1('0x1b')](_0xfbd1('0x56'),_0x33a311[_0xfbd1('0x1d')],_[_0xfbd1('0x57')](_0x1aba70['id'],'x')[0x1]);logger[_0xfbd1('0x16')](_0xfbd1('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfbd1('0x1b')](_0xfbd1('0x59'),_0x3873bd['name']),_0xfbd1('0x5a'),{'uri':_0x18ebbc});})[_0xfbd1('0x34')](function(_0x164218){logger[_0xfbd1('0x27')](_0xfbd1('0x58'),JSON[_0xfbd1('0x21')](_0x164218));});};exports[_0xfbd1('0x5b')]=function(_0xebd7e9,_0x4c4521,_0x212514,_0x4f9062,_0x25491c,_0x20ab49,_0x3039ab){var _0x5e0f5c,_0x328b23,_0x37598b,_0x120d8e;_0x20ab49[_0xfbd1('0x1d')]=intUtil[_0xfbd1('0x49')](_0x20ab49['remoteUri']);_0x20ab49[_0xfbd1('0x4d')]=intUtil[_0xfbd1('0x49')](_0x20ab49[_0xfbd1('0x4d')]);if(_0x3039ab&&_0x3039ab[_0xfbd1('0x5c')]&&_0x3039ab[_0xfbd1('0x5c')]!==_0xfbd1('0x5d')){logger['info'](_0xfbd1('0x5e'),_0xfbd1('0x4a'));_0x4c4521[_0xfbd1('0x4b')]=util[_0xfbd1('0x1b')](_0xfbd1('0x4c'),_0x20ab49[_0xfbd1('0x4d')],_0x4c4521[_0xfbd1('0x4e')],md5(_0x4c4521['uniqueid']));}return getConnection(_0x20ab49)[_0xfbd1('0x22')](function(_0xf528a6){_0x120d8e=_0xf528a6;return getUser(_0x20ab49,_0x4f9062[_0xfbd1('0x5f')],_0x120d8e);})[_0xfbd1('0x22')](function(_0x7d2aa0){_0x5e0f5c=_0x7d2aa0;logger[_0xfbd1('0x16')](_0xfbd1('0x4f'),_0x5e0f5c['id']);return getEndUser(_0x20ab49,_0x4c4521['destcalleridname'],_0x4c4521['destcalleridnum'],_0x120d8e);})['then'](function(_0x3ddd11){_0x328b23=_0x3ddd11;logger[_0xfbd1('0x16')](_0xfbd1('0x52'),_0x328b23['id']);return createTicket(_0x20ab49,_0x5e0f5c,_0x328b23,_0x212514,_0x4c4521,_0x212514[_0xfbd1('0x53')],_0x120d8e);})[_0xfbd1('0x22')](function(_0x17e088){_0x37598b=_0x17e088;logger[_0xfbd1('0x16')](_0xfbd1('0x54'));logger[_0xfbd1('0x16')](_0xfbd1('0x55'),_0x37598b['id']);var _0x9ba170=util[_0xfbd1('0x1b')](_0xfbd1('0x56'),_0x20ab49[_0xfbd1('0x1d')],_[_0xfbd1('0x57')](_0x37598b['id'],'x')[0x1]);logger[_0xfbd1('0x16')](_0xfbd1('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfbd1('0x1b')](_0xfbd1('0x59'),_0x4f9062[_0xfbd1('0x14')]),_0xfbd1('0x5a'),{'uri':_0x9ba170});})[_0xfbd1('0x34')](function(_0x4918f3){logger[_0xfbd1('0x27')]('[OUTBOUND]',JSON['stringify'](_0x4918f3));});};exports['unmanaged']=function(_0x4d5d6d,_0x4540ee,_0x35477e,_0x243613,_0xa301fc,_0x38336f){var _0x540686,_0x1a8543,_0x2287e5,_0x44fa1e;_0x38336f[_0xfbd1('0x1d')]=intUtil[_0xfbd1('0x49')](_0x38336f[_0xfbd1('0x1d')]);_0x38336f[_0xfbd1('0x4d')]=intUtil[_0xfbd1('0x49')](_0x38336f[_0xfbd1('0x4d')]);if(_0xa301fc&&_0xa301fc['monitor_format']){logger[_0xfbd1('0x16')]('['+_0x4540ee[_0xfbd1('0x60')]['toUpperCase']()+']',_0xfbd1('0x4a'));_0x4540ee[_0xfbd1('0x4b')]=util['format'](_0xfbd1('0x4c'),_0x38336f[_0xfbd1('0x4d')],_0x4540ee[_0xfbd1('0x4e')],md5(_0x4540ee[_0xfbd1('0x4e')]));}else{_0x4540ee[_0xfbd1('0x4b')]='';}return getConnection(_0x38336f)[_0xfbd1('0x22')](function(_0x2207d2){_0x44fa1e=_0x2207d2;return getUser(_0x38336f,'',_0x44fa1e);})[_0xfbd1('0x22')](function(_0x12be3d){_0x540686=_0x12be3d;logger[_0xfbd1('0x16')]('The\x20User\x20ID\x20is:',_0x540686['id']);return getEndUser(_0x38336f,_0x4540ee[_0xfbd1('0x50')],_0x4540ee['calleridnum'],_0x44fa1e);})[_0xfbd1('0x22')](function(_0xca6d5f){_0x1a8543=_0xca6d5f;logger[_0xfbd1('0x16')]('The\x20Enduser\x20ID\x20is:',_0x1a8543['id']);return createTicket(_0x38336f,_0x540686,_0x1a8543,_0x35477e,_0x4540ee,_0x35477e['Fields'],_0x44fa1e);})[_0xfbd1('0x22')](function(_0x448bc7){_0x2287e5=_0x448bc7;logger[_0xfbd1('0x16')](_0xfbd1('0x54'));logger[_0xfbd1('0x16')]('The\x20Ticket\x20ID\x20is:',_0x2287e5['id']);})[_0xfbd1('0x34')](function(_0x5b725b){logger[_0xfbd1('0x27')]('['+_0x4540ee[_0xfbd1('0x60')][_0xfbd1('0x61')]()+']',JSON[_0xfbd1('0x21')](_0x5b725b));});}; \ 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 0d885dc..89cc251 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 _0xcb6a=['merge','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','nameField','toLowerCase','content','type','string','idField','customField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%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','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','calleridnum','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST'];(function(_0x30eefa,_0x31c8e3){var _0x33d130=function(_0x4edf14){while(--_0x4edf14){_0x30eefa['push'](_0x30eefa['shift']());}};_0x33d130(++_0x31c8e3);}(_0xcb6a,0x1b1));var _0xacb6=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xcb6a[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0xacb6('0x0'));var rp=require(_0xacb6('0x1'));var md5=require(_0xacb6('0x2'));var util=require('util');var Redis=require(_0xacb6('0x3'));var intUtil=require(_0xacb6('0x4'));var config=require(_0xacb6('0x5'));var logger=require(_0xacb6('0x6'))(_0xacb6('0x7'));config[_0xacb6('0x8')]=_[_0xacb6('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xacb6('0xa'))(new Redis(config[_0xacb6('0x8')]));function emit(_0x1efe14,_0x2fd79b,_0x45e398){io['to'](_0x1efe14)[_0xacb6('0xb')](_0x2fd79b,_0x45e398);}var headers={'Content-Type':'application/json','Accept':_0xacb6('0xc')};function getTicket(_0x491707,_0x346e6e,_0x189407,_0x218d73,_0x509cbb){logger[_0xacb6('0xd')](_0xacb6('0xe'));return request({'uri':util[_0xacb6('0xf')](_0xacb6('0x10'),_0x491707[_0xacb6('0x11')]),'method':_0xacb6('0x12'),'body':{'ticket':_[_0xacb6('0x13')]({'requester_id':_0x189407['id'],'submitter_id':_0x346e6e?_0x346e6e['id']:undefined,'assignee_id':_0x346e6e?_0x346e6e['id']:undefined,'tags':getTags(_0x218d73['Tags'],_0xacb6('0x14')),'subject':intUtil[_0xacb6('0x15')](_0x218d73[_0xacb6('0x16')],_0x509cbb,'\x20'),'description':intUtil[_0xacb6('0x15')](_0x218d73[_0xacb6('0x17')],_0x509cbb,'\x0a'),'comment':{'public':![],'body':intUtil[_0xacb6('0x15')](_0x218d73[_0xacb6('0x17')],_0x509cbb,'\x0a')}},getCustomFields(_0x218d73['Fields'],_0x509cbb))}})[_0xacb6('0x18')](function(_0x1164f5){logger[_0xacb6('0xd')](_0xacb6('0x19'));return _0x1164f5[_0xacb6('0x1a')];});}function getUser(_0x213ec4,_0x4702da){if(intUtil[_0xacb6('0x1b')](_0x4702da)){logger['info'](_0xacb6('0x1c'),_0x4702da);return request({'uri':util[_0xacb6('0xf')](_0xacb6('0x1d'),_0x213ec4[_0xacb6('0x11')]),'qs':{'query':util['format'](_0xacb6('0x1e'),_0x4702da)}})[_0xacb6('0x18')](function(_0x6c5332){if(_0x6c5332[_0xacb6('0x1f')]){logger['info'](_0xacb6('0x20'));return _['find'](_0x6c5332[_0xacb6('0x21')],{'email':_0x4702da,'role':_0xacb6('0x22')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xacb6('0x23'),_0x213ec4[_0xacb6('0x11')])})['then'](function(_0x42433d){logger[_0xacb6('0xd')](_0xacb6('0x24'));return _0x42433d[_0xacb6('0x25')];});}});}else{logger[_0xacb6('0xd')](_0xacb6('0x26'));return request({'uri':util['format'](_0xacb6('0x23'),_0x213ec4['remoteUri'])})[_0xacb6('0x18')](function(_0x5585ef){logger['info'](_0xacb6('0x24'));return _0x5585ef[_0xacb6('0x25')];});}}function getEndUser(_0x15fc9,_0x470dba,_0x408be3){logger[_0xacb6('0xd')](_0xacb6('0x27'),_0x408be3);return request({'uri':util['format']('%s/search.json',_0x15fc9['remoteUri']),'qs':{'query':util['format'](_0xacb6('0x28'),_0x408be3)}})[_0xacb6('0x18')](function(_0x4aba66){var _0x352402;if(_0x4aba66[_0xacb6('0x21')][_0xacb6('0x29')]){_0x4aba66[_0xacb6('0x21')]=_[_0xacb6('0x2a')](_0x4aba66[_0xacb6('0x21')],{'suspended':![],'role':'end-user'});if(_0x4aba66[_0xacb6('0x21')][_0xacb6('0x29')]){_0x352402=_[_0xacb6('0x2b')](_0x4aba66[_0xacb6('0x21')]);}}if(_0x352402){logger[_0xacb6('0xd')](_0xacb6('0x2c'));return _0x352402;}else{logger[_0xacb6('0xd')](_0xacb6('0x2d'));return request({'uri':util[_0xacb6('0xf')]('%s/users.json',_0x15fc9[_0xacb6('0x11')]),'method':_0xacb6('0x12'),'body':{'user':{'role':_0xacb6('0x2e'),'name':util['format'](_0xacb6('0x2f'),_0x470dba||_0x408be3),'phone':_0x408be3}}})[_0xacb6('0x18')](function(_0x505c8){logger[_0xacb6('0xd')](_0xacb6('0x30'));return _0x505c8['user'];});}});}function getAuth(_0x513eaa){var _0x38d89b;if(_0x513eaa['authType']==='password'){_0x38d89b=util[_0xacb6('0xf')]('%s:%s',_0x513eaa['username'],_0x513eaa['password']);}else if(_0x513eaa[_0xacb6('0x31')]===_0xacb6('0x32')){_0x38d89b=util[_0xacb6('0xf')](_0xacb6('0x33'),_0x513eaa[_0xacb6('0x34')],_0x513eaa[_0xacb6('0x32')]);}return util[_0xacb6('0xf')](_0xacb6('0x35'),new Buffer(_0x38d89b)[_0xacb6('0x36')](_0xacb6('0x37')));}function request(_0x5153ea){logger['debug'](_0xacb6('0x38'),JSON[_0xacb6('0x39')](_0x5153ea));return rp(_[_0xacb6('0x9')](_0x5153ea,{'method':_0xacb6('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x5e77d9,_0x42de52){var _0x491a8f=[];if(_0x5e77d9&&_0x5e77d9[_0xacb6('0x29')]>0x0){_0x491a8f=_[_0xacb6('0x3b')](_0x5e77d9,_0x42de52);}return _0x491a8f;}function getCustomFields(_0x24be59,_0x3afaa6){var _0x2492eb=[];var _0x4fc2f7={'custom_fields':[]};if(_0x24be59[_0xacb6('0x29')]>0x0){_[_0xacb6('0x3c')](_0x24be59,function(_0x5caafa){if(_0x5caafa['type']==='string'&&_0x5caafa[_0xacb6('0x3d')]&&!_0x5caafa['customField']){_0x4fc2f7[_0x5caafa[_0xacb6('0x3d')][_0xacb6('0x3e')]()]=_0x5caafa[_0xacb6('0x3f')][_0xacb6('0x36')]();}else if(_0x5caafa[_0xacb6('0x40')]===_0xacb6('0x41')&&_0x5caafa[_0xacb6('0x42')]&&_0x5caafa[_0xacb6('0x43')]){_0x4fc2f7[_0xacb6('0x44')]['push']({'id':_0x5caafa['idField'],'value':_0x5caafa['content']['toString']()});}else if(_0x5caafa['type']===_0xacb6('0x45')&&_0x5caafa['variableName']&&_0x5caafa[_0xacb6('0x42')]&&_0x5caafa[_0xacb6('0x43')]){_0x3afaa6[_0x5caafa[_0xacb6('0x46')]]&&_0x4fc2f7[_0xacb6('0x44')][_0xacb6('0x47')]({'id':_0x5caafa['idField'],'value':_0x3afaa6[_0x5caafa[_0xacb6('0x46')]]['toString']()});}else if(_0x5caafa[_0xacb6('0x40')]===_0xacb6('0x48')&&_0x5caafa['Variable']&&_0x5caafa[_0xacb6('0x49')][_0xacb6('0x14')]&&_0x5caafa[_0xacb6('0x42')]&&_0x5caafa['customField']){_0x3afaa6[_0x5caafa[_0xacb6('0x49')][_0xacb6('0x14')]['toLowerCase']()]&&_0x4fc2f7[_0xacb6('0x44')][_0xacb6('0x47')]({'id':_0x5caafa['idField'],'value':_0x3afaa6[_0x5caafa[_0xacb6('0x49')][_0xacb6('0x14')][_0xacb6('0x3e')]()][_0xacb6('0x36')]()});}});}return _0x4fc2f7;}exports[_0xacb6('0x4a')]=function(_0x463431,_0x96058c,_0xc364d4,_0xbc2dca,_0x59a57e,_0x229556){var _0x149b26,_0x30a010;_0x229556['remoteUri']=intUtil[_0xacb6('0x4b')](_0x229556[_0xacb6('0x11')]);_0x229556['serverUrl']=intUtil[_0xacb6('0x4b')](_0x229556[_0xacb6('0x4c')]);if(_0x59a57e&&_0x59a57e[_0xacb6('0x4d')]){logger['info'](_0xacb6('0x4e'),_0xacb6('0x4f'));_0x96058c['recordingURL']=util[_0xacb6('0xf')](_0xacb6('0x50'),_0x229556['serverUrl'],_0x96058c[_0xacb6('0x51')],md5(_0x96058c[_0xacb6('0x51')]));}else{_0x96058c[_0xacb6('0x52')]='';}headers[_0xacb6('0x53')]=getAuth(_0x229556);return getUser(_0x229556,_0xbc2dca[_0xacb6('0x54')])[_0xacb6('0x18')](function(_0x5d0d0f){_0x149b26=_0x5d0d0f;logger[_0xacb6('0xd')]('The\x20User\x20ID\x20is:',_0x149b26['id']);return getEndUser(_0x229556,_0x96058c[_0xacb6('0x55')],_0x96058c['calleridnum']);})[_0xacb6('0x18')](function(_0x3fed27){_0x30a010=_0x3fed27;logger['info'](_0xacb6('0x56'),_0x30a010['id']);return getTicket(_0x229556,_0x149b26,_0x30a010,_0xc364d4,_0x96058c);})['then'](function(_0x1fbcfb){if(_0x1fbcfb){logger[_0xacb6('0xd')](_0xacb6('0x57'),_0x1fbcfb['id']);switch(_0x229556['type']){case _0xacb6('0x58'):logger['info'](_0xacb6('0x4e'),_0xacb6('0x59'));return request({'uri':util[_0xacb6('0xf')](_0xacb6('0x5a'),_0x229556['remoteUri'],_0x149b26['id'],_0x1fbcfb['id']),'method':'POST'});case _0xacb6('0x5b'):logger[_0xacb6('0xd')](_0xacb6('0x4e'),_0xacb6('0x5c'));emit(util[_0xacb6('0xf')](_0xacb6('0x5d'),_0xbc2dca[_0xacb6('0x14')]),_0xacb6('0x5e'),{'uri':util[_0xacb6('0xf')](_0xacb6('0x5f'),_0x229556[_0xacb6('0x11')][_0xacb6('0x60')](_0xacb6('0x61'),''),_0x1fbcfb['id'])});break;default:logger[_0xacb6('0x62')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xacb6('0x63')](function(_0x22ddf5){logger[_0xacb6('0x62')](_0xacb6('0x64'),util['inspect'](_0x22ddf5,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x261a72,_0x43677a,_0x395766,_0x9e74f1,_0x5e53bf,_0xe33968,_0x5879c2){var _0xb6fa3e,_0x132462;_0xe33968[_0xacb6('0x11')]=intUtil['stripTrailingSlash'](_0xe33968[_0xacb6('0x11')]);_0xe33968[_0xacb6('0x4c')]=intUtil[_0xacb6('0x4b')](_0xe33968[_0xacb6('0x4c')]);if(_0x5879c2&&_0x5879c2[_0xacb6('0x65')]&&_0x5879c2['recordingFormat']!==_0xacb6('0x66')){logger['info'](_0xacb6('0x67'),_0xacb6('0x4f'));_0x43677a[_0xacb6('0x52')]=util[_0xacb6('0xf')](_0xacb6('0x50'),_0xe33968['serverUrl'],_0x43677a['uniqueid'],md5(_0x43677a[_0xacb6('0x51')]));}headers[_0xacb6('0x53')]=getAuth(_0xe33968);return getUser(_0xe33968,_0x9e74f1['email'])[_0xacb6('0x18')](function(_0x5c8fdf){_0xb6fa3e=_0x5c8fdf;logger[_0xacb6('0xd')](_0xacb6('0x68'),_0xb6fa3e['id']);return getEndUser(_0xe33968,_0x43677a[_0xacb6('0x69')],_0x43677a[_0xacb6('0x6a')]);})[_0xacb6('0x18')](function(_0xcecac4){_0x132462=_0xcecac4;logger[_0xacb6('0xd')](_0xacb6('0x56'),_0x132462['id']);return getTicket(_0xe33968,_0xb6fa3e,_0x132462,_0x395766,_0x43677a);})[_0xacb6('0x18')](function(_0x40d527){if(_0x40d527){logger[_0xacb6('0xd')](_0xacb6('0x57'),_0x40d527['id']);switch(_0xe33968[_0xacb6('0x40')]){case _0xacb6('0x58'):logger[_0xacb6('0xd')](_0xacb6('0x67'),_0xacb6('0x59'));return request({'uri':util['format'](_0xacb6('0x5a'),_0xe33968[_0xacb6('0x11')],_0xb6fa3e['id'],_0x40d527['id']),'method':_0xacb6('0x12')});case'newTab':logger['info'](_0xacb6('0x67'),_0xacb6('0x5c'));emit(util[_0xacb6('0xf')](_0xacb6('0x5d'),_0x9e74f1[_0xacb6('0x14')]),_0xacb6('0x5e'),{'uri':util[_0xacb6('0xf')](_0xacb6('0x5f'),_0xe33968[_0xacb6('0x11')][_0xacb6('0x60')](_0xacb6('0x61'),''),_0x40d527['id'])});break;default:logger[_0xacb6('0x62')]('[OUTBOUND]',_0xacb6('0x6b'));}}})[_0xacb6('0x63')](function(_0x2d2a3f){logger[_0xacb6('0x62')](_0xacb6('0x6c'),util[_0xacb6('0x6d')](_0x2d2a3f,{'showHidden':!![],'depth':null}));});};exports[_0xacb6('0x6e')]=function(_0x5096d3,_0x38956d,_0x16aa5c,_0x1bada0,_0x20c9ec,_0x2fc51e){var _0x452d1a,_0x595172;_0x2fc51e[_0xacb6('0x11')]=intUtil[_0xacb6('0x4b')](_0x2fc51e[_0xacb6('0x11')]);_0x2fc51e[_0xacb6('0x4c')]=intUtil['stripTrailingSlash'](_0x2fc51e['serverUrl']);if(_0x20c9ec&&_0x20c9ec[_0xacb6('0x4d')]){logger[_0xacb6('0xd')]('['+_0x38956d[_0xacb6('0x6f')]['toUpperCase']()+']',_0xacb6('0x4f'));_0x38956d[_0xacb6('0x52')]=util['format'](_0xacb6('0x50'),_0x2fc51e[_0xacb6('0x4c')],_0x38956d['uniqueid'],md5(_0x38956d['uniqueid']));}else{_0x38956d[_0xacb6('0x52')]='';}headers[_0xacb6('0x53')]=getAuth(_0x2fc51e);return getUser(_0x2fc51e)[_0xacb6('0x18')](function(_0x1a70ac){_0x452d1a=_0x1a70ac;logger[_0xacb6('0xd')]('The\x20User\x20ID\x20is:',_0x452d1a['id']);return getEndUser(_0x2fc51e,_0x38956d[_0xacb6('0x55')],_0x38956d[_0xacb6('0x70')]);})['then'](function(_0x2025f1){_0x595172=_0x2025f1;logger[_0xacb6('0xd')](_0xacb6('0x56'),_0x595172['id']);return getTicket(_0x2fc51e,_0x452d1a,_0x595172,_0x16aa5c,_0x38956d);})[_0xacb6('0x18')](function(_0x1e504d){if(_0x1e504d){logger[_0xacb6('0xd')](_0xacb6('0x57'),_0x1e504d['id']);}})['catch'](function(_0x2d3d45){logger['error']('['+_0x38956d['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xacb6('0x6d')](_0x2d3d45,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdb1b=['results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','type','string','nameField','customField','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','name','getString','Descriptions','Fields','then','info','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find'];(function(_0xa5f9e8,_0x1af80f){var _0x1203e7=function(_0x501535){while(--_0x501535){_0xa5f9e8['push'](_0xa5f9e8['shift']());}};_0x1203e7(++_0x1af80f);}(_0xdb1b,0x139));var _0xbdb1=function(_0x2c30c0,_0x584c13){_0x2c30c0=_0x2c30c0-0x0;var _0x5f12f7=_0xdb1b[_0x2c30c0];return _0x5f12f7;};'use strict';var _=require(_0xbdb1('0x0'));var rp=require(_0xbdb1('0x1'));var md5=require(_0xbdb1('0x2'));var util=require(_0xbdb1('0x3'));var Redis=require('ioredis');var intUtil=require(_0xbdb1('0x4'));var config=require(_0xbdb1('0x5'));var logger=require(_0xbdb1('0x6'))(_0xbdb1('0x7'));config[_0xbdb1('0x8')]=_[_0xbdb1('0x9')](config[_0xbdb1('0x8')],{'host':_0xbdb1('0xa'),'port':0x18eb});var io=require(_0xbdb1('0xb'))(new Redis(config[_0xbdb1('0x8')]));function emit(_0x4fc226,_0x55ec15,_0x4040f5){io['to'](_0x4fc226)[_0xbdb1('0xc')](_0x55ec15,_0x4040f5);}var headers={'Content-Type':_0xbdb1('0xd'),'Accept':_0xbdb1('0xd')};function getTicket(_0x38904c,_0x28e0ed,_0x29c519,_0x23b0c8,_0x148d86){logger['info'](_0xbdb1('0xe'));return request({'uri':util[_0xbdb1('0xf')](_0xbdb1('0x10'),_0x38904c[_0xbdb1('0x11')]),'method':_0xbdb1('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x29c519['id'],'submitter_id':_0x28e0ed?_0x28e0ed['id']:undefined,'assignee_id':_0x28e0ed?_0x28e0ed['id']:undefined,'tags':getTags(_0x23b0c8['Tags'],_0xbdb1('0x13')),'subject':intUtil['getString'](_0x23b0c8['Subjects'],_0x148d86,'\x20'),'description':intUtil[_0xbdb1('0x14')](_0x23b0c8[_0xbdb1('0x15')],_0x148d86,'\x0a'),'comment':{'public':![],'body':intUtil[_0xbdb1('0x14')](_0x23b0c8['Descriptions'],_0x148d86,'\x0a')}},getCustomFields(_0x23b0c8[_0xbdb1('0x16')],_0x148d86))}})[_0xbdb1('0x17')](function(_0x1f0ee6){logger[_0xbdb1('0x18')]('Ticket\x20created!');return _0x1f0ee6['ticket'];});}function getUser(_0x2bf5c7,_0x3d678e){if(intUtil[_0xbdb1('0x19')](_0x3d678e)){logger[_0xbdb1('0x18')](_0xbdb1('0x1a'),_0x3d678e);return request({'uri':util[_0xbdb1('0xf')](_0xbdb1('0x1b'),_0x2bf5c7[_0xbdb1('0x11')]),'qs':{'query':util[_0xbdb1('0xf')](_0xbdb1('0x1c'),_0x3d678e)}})['then'](function(_0x47f2c2){if(_0x47f2c2[_0xbdb1('0x1d')]){logger[_0xbdb1('0x18')](_0xbdb1('0x1e'));return _[_0xbdb1('0x1f')](_0x47f2c2[_0xbdb1('0x20')],{'email':_0x3d678e,'role':_0xbdb1('0x21')});}else{logger[_0xbdb1('0x18')](_0xbdb1('0x22'));return request({'uri':util['format'](_0xbdb1('0x23'),_0x2bf5c7[_0xbdb1('0x11')])})[_0xbdb1('0x17')](function(_0x4aa6d5){logger[_0xbdb1('0x18')](_0xbdb1('0x24'));return _0x4aa6d5[_0xbdb1('0x25')];});}});}else{logger[_0xbdb1('0x18')](_0xbdb1('0x22'));return request({'uri':util[_0xbdb1('0xf')](_0xbdb1('0x23'),_0x2bf5c7['remoteUri'])})[_0xbdb1('0x17')](function(_0x943f85){logger[_0xbdb1('0x18')](_0xbdb1('0x24'));return _0x943f85[_0xbdb1('0x25')];});}}function getEndUser(_0x4c2da2,_0x4b58ee,_0x4b5ec7){logger[_0xbdb1('0x18')](_0xbdb1('0x26'),_0x4b5ec7);return request({'uri':util[_0xbdb1('0xf')](_0xbdb1('0x1b'),_0x4c2da2[_0xbdb1('0x11')]),'qs':{'query':util[_0xbdb1('0xf')](_0xbdb1('0x27'),_0x4b5ec7)}})['then'](function(_0x5e88a6){var _0x4d4941;if(_0x5e88a6[_0xbdb1('0x20')][_0xbdb1('0x28')]){_0x5e88a6[_0xbdb1('0x20')]=_[_0xbdb1('0x29')](_0x5e88a6[_0xbdb1('0x20')],{'suspended':![],'role':_0xbdb1('0x2a')});if(_0x5e88a6[_0xbdb1('0x20')][_0xbdb1('0x28')]){_0x4d4941=_[_0xbdb1('0x2b')](_0x5e88a6[_0xbdb1('0x20')]);}}if(_0x4d4941){logger['info'](_0xbdb1('0x2c'));return _0x4d4941;}else{logger[_0xbdb1('0x18')](_0xbdb1('0x2d'));return request({'uri':util[_0xbdb1('0xf')](_0xbdb1('0x2e'),_0x4c2da2[_0xbdb1('0x11')]),'method':'POST','body':{'user':{'role':_0xbdb1('0x2a'),'name':util[_0xbdb1('0xf')](_0xbdb1('0x2f'),_0x4b58ee||_0x4b5ec7),'phone':_0x4b5ec7}}})[_0xbdb1('0x17')](function(_0xf5dc6f){logger[_0xbdb1('0x18')](_0xbdb1('0x30'));return _0xf5dc6f[_0xbdb1('0x25')];});}});}function getAuth(_0x50b2b8){var _0x145f79;if(_0x50b2b8[_0xbdb1('0x31')]==='password'){_0x145f79=util[_0xbdb1('0xf')](_0xbdb1('0x32'),_0x50b2b8[_0xbdb1('0x33')],_0x50b2b8[_0xbdb1('0x34')]);}else if(_0x50b2b8[_0xbdb1('0x31')]===_0xbdb1('0x35')){_0x145f79=util[_0xbdb1('0xf')](_0xbdb1('0x36'),_0x50b2b8[_0xbdb1('0x33')],_0x50b2b8[_0xbdb1('0x35')]);}return util[_0xbdb1('0xf')](_0xbdb1('0x37'),new Buffer(_0x145f79)[_0xbdb1('0x38')](_0xbdb1('0x39')));}function request(_0x573de6){logger[_0xbdb1('0x3a')](_0xbdb1('0x3b'),JSON['stringify'](_0x573de6));return rp(_[_0xbdb1('0x9')](_0x573de6,{'method':_0xbdb1('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x2a6c61,_0x4c273a){var _0x28e8d8=[];if(_0x2a6c61&&_0x2a6c61['length']>0x0){_0x28e8d8=_[_0xbdb1('0x3d')](_0x2a6c61,_0x4c273a);}return _0x28e8d8;}function getCustomFields(_0x2983be,_0x933426){var _0x470843=[];var _0x3c9778={'custom_fields':[]};if(_0x2983be[_0xbdb1('0x28')]>0x0){_[_0xbdb1('0x3e')](_0x2983be,function(_0x220fd9){if(_0x220fd9[_0xbdb1('0x3f')]===_0xbdb1('0x40')&&_0x220fd9[_0xbdb1('0x41')]&&!_0x220fd9[_0xbdb1('0x42')]){_0x3c9778[_0x220fd9['nameField']['toLowerCase']()]=_0x220fd9[_0xbdb1('0x43')][_0xbdb1('0x38')]();}else if(_0x220fd9[_0xbdb1('0x3f')]==='string'&&_0x220fd9[_0xbdb1('0x44')]&&_0x220fd9[_0xbdb1('0x42')]){_0x3c9778[_0xbdb1('0x45')][_0xbdb1('0x46')]({'id':_0x220fd9[_0xbdb1('0x44')],'value':_0x220fd9[_0xbdb1('0x43')][_0xbdb1('0x38')]()});}else if(_0x220fd9[_0xbdb1('0x3f')]===_0xbdb1('0x47')&&_0x220fd9[_0xbdb1('0x48')]&&_0x220fd9['idField']&&_0x220fd9[_0xbdb1('0x42')]){_0x933426[_0x220fd9[_0xbdb1('0x48')]]&&_0x3c9778[_0xbdb1('0x45')][_0xbdb1('0x46')]({'id':_0x220fd9[_0xbdb1('0x44')],'value':_0x933426[_0x220fd9[_0xbdb1('0x48')]][_0xbdb1('0x38')]()});}else if(_0x220fd9['type']===_0xbdb1('0x49')&&_0x220fd9[_0xbdb1('0x4a')]&&_0x220fd9[_0xbdb1('0x4a')][_0xbdb1('0x13')]&&_0x220fd9[_0xbdb1('0x44')]&&_0x220fd9[_0xbdb1('0x42')]){_0x933426[_0x220fd9[_0xbdb1('0x4a')][_0xbdb1('0x13')][_0xbdb1('0x4b')]()]&&_0x3c9778[_0xbdb1('0x45')][_0xbdb1('0x46')]({'id':_0x220fd9[_0xbdb1('0x44')],'value':_0x933426[_0x220fd9[_0xbdb1('0x4a')][_0xbdb1('0x13')][_0xbdb1('0x4b')]()][_0xbdb1('0x38')]()});}});}return _0x3c9778;}exports[_0xbdb1('0x4c')]=function(_0x623bbf,_0x4502ae,_0x285ec3,_0x57156a,_0xae3e03,_0x2105f1){var _0x3c536b,_0x1e1158;_0x2105f1[_0xbdb1('0x11')]=intUtil[_0xbdb1('0x4d')](_0x2105f1[_0xbdb1('0x11')]);_0x2105f1['serverUrl']=intUtil[_0xbdb1('0x4d')](_0x2105f1[_0xbdb1('0x4e')]);if(_0xae3e03&&_0xae3e03[_0xbdb1('0x4f')]){logger[_0xbdb1('0x18')](_0xbdb1('0x50'),'Recording\x20is\x20enabled!');_0x4502ae[_0xbdb1('0x51')]=util['format'](_0xbdb1('0x52'),_0x2105f1[_0xbdb1('0x4e')],_0x4502ae[_0xbdb1('0x53')],md5(_0x4502ae[_0xbdb1('0x53')]));}else{_0x4502ae['recordingURL']='';}headers[_0xbdb1('0x54')]=getAuth(_0x2105f1);return getUser(_0x2105f1,_0x57156a[_0xbdb1('0x55')])[_0xbdb1('0x17')](function(_0x3ec0a7){_0x3c536b=_0x3ec0a7;logger['info'](_0xbdb1('0x56'),_0x3c536b['id']);return getEndUser(_0x2105f1,_0x4502ae[_0xbdb1('0x57')],_0x4502ae['calleridnum']);})[_0xbdb1('0x17')](function(_0x4d79b4){_0x1e1158=_0x4d79b4;logger[_0xbdb1('0x18')](_0xbdb1('0x58'),_0x1e1158['id']);return getTicket(_0x2105f1,_0x3c536b,_0x1e1158,_0x285ec3,_0x4502ae);})[_0xbdb1('0x17')](function(_0x54f8fe){if(_0x54f8fe){logger[_0xbdb1('0x18')]('The\x20Ticket\x20ID\x20is:',_0x54f8fe['id']);switch(_0x2105f1[_0xbdb1('0x3f')]){case _0xbdb1('0x59'):logger['info'](_0xbdb1('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xbdb1('0xf')](_0xbdb1('0x5a'),_0x2105f1[_0xbdb1('0x11')],_0x3c536b['id'],_0x54f8fe['id']),'method':_0xbdb1('0x12')});case _0xbdb1('0x5b'):logger[_0xbdb1('0x18')](_0xbdb1('0x50'),_0xbdb1('0x5c'));emit(util[_0xbdb1('0xf')]('user:%s',_0x57156a[_0xbdb1('0x13')]),_0xbdb1('0x5d'),{'uri':util['format'](_0xbdb1('0x5e'),_0x2105f1[_0xbdb1('0x11')]['replace'](_0xbdb1('0x5f'),''),_0x54f8fe['id'])});break;default:logger[_0xbdb1('0x60')](_0xbdb1('0x50'),_0xbdb1('0x61'));}}})['catch'](function(_0x2df328){logger[_0xbdb1('0x60')](_0xbdb1('0x62'),util[_0xbdb1('0x63')](_0x2df328,{'showHidden':!![],'depth':null}));});};exports[_0xbdb1('0x64')]=function(_0x42d4f8,_0x5eda86,_0x5697dc,_0x53a7b1,_0x4134bd,_0x1a3912,_0x748dcf){var _0x44d9c6,_0x1f5d04;_0x1a3912['remoteUri']=intUtil['stripTrailingSlash'](_0x1a3912[_0xbdb1('0x11')]);_0x1a3912[_0xbdb1('0x4e')]=intUtil[_0xbdb1('0x4d')](_0x1a3912['serverUrl']);if(_0x748dcf&&_0x748dcf[_0xbdb1('0x65')]&&_0x748dcf['recordingFormat']!=='none'){logger[_0xbdb1('0x18')](_0xbdb1('0x66'),'Recording\x20is\x20enabled!');_0x5eda86[_0xbdb1('0x51')]=util[_0xbdb1('0xf')](_0xbdb1('0x52'),_0x1a3912['serverUrl'],_0x5eda86[_0xbdb1('0x53')],md5(_0x5eda86[_0xbdb1('0x53')]));}headers[_0xbdb1('0x54')]=getAuth(_0x1a3912);return getUser(_0x1a3912,_0x53a7b1[_0xbdb1('0x55')])[_0xbdb1('0x17')](function(_0x5d6d29){_0x44d9c6=_0x5d6d29;logger[_0xbdb1('0x18')]('The\x20User\x20ID\x20is:',_0x44d9c6['id']);return getEndUser(_0x1a3912,_0x5eda86[_0xbdb1('0x67')],_0x5eda86[_0xbdb1('0x68')]);})[_0xbdb1('0x17')](function(_0x240c87){_0x1f5d04=_0x240c87;logger[_0xbdb1('0x18')]('The\x20Enduser\x20ID\x20is:',_0x1f5d04['id']);return getTicket(_0x1a3912,_0x44d9c6,_0x1f5d04,_0x5697dc,_0x5eda86);})[_0xbdb1('0x17')](function(_0x4d4a36){if(_0x4d4a36){logger[_0xbdb1('0x18')](_0xbdb1('0x69'),_0x4d4a36['id']);switch(_0x1a3912['type']){case'integrationTab':logger[_0xbdb1('0x18')](_0xbdb1('0x66'),_0xbdb1('0x6a'));return request({'uri':util[_0xbdb1('0xf')](_0xbdb1('0x5a'),_0x1a3912[_0xbdb1('0x11')],_0x44d9c6['id'],_0x4d4a36['id']),'method':_0xbdb1('0x12')});case'newTab':logger[_0xbdb1('0x18')](_0xbdb1('0x66'),_0xbdb1('0x5c'));emit(util[_0xbdb1('0xf')](_0xbdb1('0x6b'),_0x53a7b1[_0xbdb1('0x13')]),'trigger:browser:url',{'uri':util[_0xbdb1('0xf')](_0xbdb1('0x5e'),_0x1a3912[_0xbdb1('0x11')][_0xbdb1('0x6c')](_0xbdb1('0x5f'),''),_0x4d4a36['id'])});break;default:logger[_0xbdb1('0x60')](_0xbdb1('0x66'),_0xbdb1('0x61'));}}})[_0xbdb1('0x6d')](function(_0x3bb5d3){logger['error'](_0xbdb1('0x6e'),util[_0xbdb1('0x63')](_0x3bb5d3,{'showHidden':!![],'depth':null}));});};exports[_0xbdb1('0x6f')]=function(_0x35849b,_0x4a5180,_0x34669f,_0x48d7ac,_0x39456a,_0x3468b4){var _0x24222f,_0x17eade;_0x3468b4[_0xbdb1('0x11')]=intUtil['stripTrailingSlash'](_0x3468b4[_0xbdb1('0x11')]);_0x3468b4['serverUrl']=intUtil[_0xbdb1('0x4d')](_0x3468b4['serverUrl']);if(_0x39456a&&_0x39456a['monitor_format']){logger['info']('['+_0x4a5180[_0xbdb1('0x70')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4a5180[_0xbdb1('0x51')]=util[_0xbdb1('0xf')](_0xbdb1('0x52'),_0x3468b4['serverUrl'],_0x4a5180[_0xbdb1('0x53')],md5(_0x4a5180[_0xbdb1('0x53')]));}else{_0x4a5180['recordingURL']='';}headers['Authorization']=getAuth(_0x3468b4);return getUser(_0x3468b4)['then'](function(_0x1a2df6){_0x24222f=_0x1a2df6;logger[_0xbdb1('0x18')]('The\x20User\x20ID\x20is:',_0x24222f['id']);return getEndUser(_0x3468b4,_0x4a5180[_0xbdb1('0x57')],_0x4a5180['calleridnum']);})['then'](function(_0x3ac3e2){_0x17eade=_0x3ac3e2;logger[_0xbdb1('0x18')](_0xbdb1('0x58'),_0x17eade['id']);return getTicket(_0x3468b4,_0x24222f,_0x17eade,_0x34669f,_0x4a5180);})['then'](function(_0x32c886){if(_0x32c886){logger['info'](_0xbdb1('0x69'),_0x32c886['id']);}})[_0xbdb1('0x6d')](function(_0xc9c33b){logger[_0xbdb1('0x60')]('['+_0x4a5180['lastevent'][_0xbdb1('0x71')]()+']'+_0xbdb1('0x72'),util[_0xbdb1('0x63')](_0xc9c33b,{'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 e413cf3..e46813f 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 _0x47c5=['mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','[OUTBOUND]','/api/voice/recordings/','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x47c5,0x165));var _0x547c=function(_0x4d7285,_0x49c65f){_0x4d7285=_0x4d7285-0x0;var _0x2dac6c=_0x47c5[_0x4d7285];return _0x2dac6c;};'use strict';var _=require(_0x547c('0x0'));var rp=require(_0x547c('0x1'));var md5=require(_0x547c('0x2'));var util=require(_0x547c('0x3'));var intUtil=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var Redis=require('ioredis');var BPromise=require(_0x547c('0x6'));var config=require(_0x547c('0x7'));var logger=require('../../../../config/logger')(_0x547c('0x8'));config[_0x547c('0x9')]=_['defaults'](config[_0x547c('0x9')],{'host':_0x547c('0xa'),'port':0x18eb});var io=require(_0x547c('0xb'))(new Redis(config[_0x547c('0x9')]));function emit(_0x12fb7d,_0x4ef079,_0x3e2279){io['to'](_0x12fb7d)[_0x547c('0xc')](_0x4ef079,_0x3e2279);}function request(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),JSON[_0x547c('0xf')](_0x10dec9));return rp(_0x10dec9);}function getCustomFields(_0x111457,_0x2455e9){var _0x386e2c={};if(_0x111457[_0x547c('0x10')]>0x0){_[_0x547c('0x11')](_0x111457,function(_0x549bf0){if(_0x549bf0[_0x547c('0x12')]===_0x547c('0x13')&&_0x549bf0['idField']){_0x386e2c[_0x549bf0[_0x547c('0x14')]]=_0x549bf0[_0x547c('0x15')][_0x547c('0x16')]();}else if(_0x549bf0[_0x547c('0x12')]===_0x547c('0x17')&&_0x549bf0[_0x547c('0x18')]&&_0x549bf0[_0x547c('0x14')]&&_0x2455e9[_0x549bf0[_0x547c('0x18')]]){_0x386e2c[_0x549bf0[_0x547c('0x14')]]=_0x2455e9[_0x549bf0[_0x547c('0x18')]][_0x547c('0x16')]();}else if(_0x549bf0[_0x547c('0x12')]===_0x547c('0x19')&&_0x549bf0[_0x547c('0x1a')]&&_0x549bf0[_0x547c('0x1a')][_0x547c('0x1b')]&&_0x549bf0[_0x547c('0x14')]&&_0x2455e9[_0x549bf0[_0x547c('0x1a')]['name']['toLowerCase']()]){_0x386e2c[_0x549bf0[_0x547c('0x14')]]=_0x2455e9[_0x549bf0[_0x547c('0x1a')][_0x547c('0x1b')]['toLowerCase']()][_0x547c('0x16')]();}});}return _0x386e2c;}function getName(_0x18ef77){if(_0x18ef77[_0x547c('0x1c')]('\x20')>0x0){var _0x58ddc9=_0x18ef77[_0x547c('0x1d')](/ (.+)/);if(_0x58ddc9[0x1]){return _0x58ddc9;}}return[_0x18ef77,_0x18ef77];}var accountsTokens={};function getAccessToken(_0x41149f){return new Promise(function(_0x496c38,_0x5453f9){if(!_[_0x547c('0x1e')](accountsTokens[_0x41149f['id']])&&!_[_0x547c('0x1e')](accountsTokens[_0x41149f['id']]['access_token'])){if(moment()[_0x547c('0x1f')](accountsTokens[_0x41149f['id']][_0x547c('0x20')])){_0x496c38(accountsTokens[_0x41149f['id']]['access_token']);}}var _0x2e317a;switch(_0x41149f[_0x547c('0x21')]){case'US':_0x2e317a=_0x547c('0x22');break;case'AU':_0x2e317a='https://accounts.zoho.com.au';break;case'EU':_0x2e317a=_0x547c('0x23');break;case'IN':_0x2e317a=_0x547c('0x24');break;case'CN':_0x2e317a=_0x547c('0x25');break;default:_0x2e317a=_0x547c('0x23');break;}var _0x1f3581={'method':_0x547c('0x26'),'uri':_0x2e317a+_0x547c('0x27'),'qs':{'refresh_token':_0x41149f[_0x547c('0x28')],'client_id':_0x41149f['clientId'],'client_secret':_0x41149f[_0x547c('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1f3581)['then'](function(_0x4855fd){accountsTokens[_0x41149f['id']]={'access_token':_0x4855fd['access_token'],'expires_in':moment()[_0x547c('0x2a')](_0x4855fd['expires_in'],_0x547c('0x2b'))};_0x496c38(_0x4855fd['access_token']);})[_0x547c('0x2c')](function(_0x486216){logger[_0x547c('0x2d')](_0x547c('0x2e'),_0x486216[_0x547c('0x2f')]);_0x5453f9(_0x486216);});});}function getUser(_0x30a96c,_0x198afb,_0x569924,_0x575c74){logger[_0x547c('0x30')]('Search\x20user');return request({'method':_0x547c('0x31'),'uri':util[_0x547c('0x32')](_0x547c('0x33'),_0x198afb),'qs':{'type':_0x547c('0x34')},'headers':{'Authorization':_0x547c('0x35')+_0x30a96c},'json':!![]})[_0x547c('0x36')](function(_0x342c10){if(_0x342c10['users']){var _0x54f6a8=-0x1;if(_[_0x547c('0x37')](_0x342c10[_0x547c('0x38')])){if(!_[_0x547c('0x1e')](_0x575c74)){_0x54f6a8=_[_0x547c('0x39')](_0x342c10[_0x547c('0x38')],function(_0x18d7c1){return _0x18d7c1[_0x547c('0x3a')]===_0x575c74;});}if(_0x54f6a8>=0x0){logger[_0x547c('0x30')](_0x547c('0x3b'));}else{logger[_0x547c('0x30')](_0x547c('0x3c'));_0x54f6a8=_[_0x547c('0x39')](_0x342c10[_0x547c('0x38')],function(_0x385275){return _0x385275['profile'][_0x547c('0x1b')]==='Administrator';});}return _0x342c10['users'][_0x54f6a8];}else{if(_0x342c10['user'][_0x547c('0x3d')][_0x547c('0x1b')]===_0x547c('0x3e')){logger[_0x547c('0x30')](_0x547c('0x3c'));user=_0x342c10[_0x547c('0x3f')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x342c10));throw new Error(_0x547c('0x40')+JSON[_0x547c('0xf')](_0x342c10));}}}else{logger[_0x547c('0x2d')](_0x547c('0x41'),JSON[_0x547c('0xf')](_0x342c10));throw new Error(_0x547c('0x40')+JSON['stringify'](_0x342c10));}})[_0x547c('0x2c')](function(_0x4e2e52){console[_0x547c('0x2d')](_0x4e2e52);});}function getZohoUser(_0x18fcc5,_0x5b80f4){return new BPromise(function(_0x380705,_0x5c57ae){request(_0x18fcc5)['then'](function(_0x3137e0){var _0x281d52=null;if(_0x3137e0){_0x281d52=_0x3137e0[_0x547c('0x42')][0x0];_0x281d52[_0x547c('0x43')]=_0x5b80f4;}_0x380705(_0x281d52);})['catch'](function(_0x52b962){_0x5c57ae(_0x52b962);});});}function createEndUser(_0xe5f1b9,_0x1e8dd0,_0x411c6f,_0x5c8ed0,_0x3886ae,_0x21838a){var _0x411c6f=getName(_0x411c6f);return request({'method':'POST','uri':_0x547c('0x44')+_0x1e8dd0+_0x547c('0x45')+_[_0x547c('0x46')](_0x21838a['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x411c6f[0x1],'First_Name':_0x411c6f[0x0],'Phone':_0x5c8ed0,'Owner':{'name':!_[_0x547c('0x1e')](_0x3886ae[_0x547c('0x47')]['name'])?_0x3886ae[_0x547c('0x47')][_0x547c('0x1b')]:!_[_0x547c('0x1e')](_0x3886ae['first_name'])?_0x3886ae[_0x547c('0x48')]+'\x20'+_0x3886ae['last_name']:_0x3886ae[_0x547c('0x49')],'id':_0x3886ae['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xe5f1b9},'json':!![]})[_0x547c('0x36')](function(_0x414b9d){if(_0x414b9d&&_0x414b9d[_0x547c('0x42')][0x0][_0x547c('0x4a')]===_0x547c('0x4b')){var _0x3a2508=_0x414b9d['data'][0x0]['details'];_0x3a2508[_0x547c('0x43')]=_[_0x547c('0x46')](_0x21838a[_0x547c('0x4c')])+'s';return _0x3a2508;}logger['error'](_0x547c('0x41'),JSON[_0x547c('0xf')](data));throw new Error(_0x547c('0x4d')+JSON[_0x547c('0xf')](data));})[_0x547c('0x2c')](function(_0x41ca7f){console['log'](_0x547c('0x4e'),_0x41ca7f);});}function getEndUser(_0x3ae2c2,_0x3d7088,_0x4c4287,_0x291302,_0x478320,_0xebf295,_0x3167d0){var _0x5f40eb={'method':_0x547c('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3ae2c2},'json':!![]};switch(_0x3167d0[_0x547c('0x4f')]){case'contact_lead':_0x5f40eb[_0x547c('0x50')]=_0x547c('0x44')+_0x3d7088+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x478320+'))';return getZohoUser(_0x5f40eb,_0x547c('0x51'))[_0x547c('0x36')](function(_0xa005cc){if(_0xa005cc)return _0xa005cc;_0x5f40eb[_0x547c('0x50')]='https://www.zohoapis.'+_0x3d7088+_0x547c('0x52')+_0x478320+'))';return getZohoUser(_0x5f40eb,'Leads')['then'](function(_0x4d4a92){if(_0x4d4a92)return _0x4d4a92;if(_0x3167d0[_0x547c('0x4c')]!=_0x547c('0x53')){return createEndUser(_0x3ae2c2,_0x3d7088,_0x291302,_0x478320,_0xebf295,_0x3167d0);}else{return{};}});});break;case _0x547c('0x54'):_0x5f40eb[_0x547c('0x50')]=_0x547c('0x44')+_0x3d7088+_0x547c('0x55')+_0x478320+'))';return getZohoUser(_0x5f40eb,_0x547c('0x51'))[_0x547c('0x36')](function(_0x31a262){if(_0x31a262)return _0x31a262;if(_0x3167d0[_0x547c('0x4c')]!=_0x547c('0x53')){return createEndUser(_0x3ae2c2,_0x3d7088,_0x291302,_0x478320,_0xebf295,_0x3167d0);}else{return{};}});break;case'lead':_0x5f40eb['uri']=_0x547c('0x44')+_0x3d7088+_0x547c('0x52')+_0x478320+'))';return getZohoUser(_0x5f40eb,'Leads')[_0x547c('0x36')](function(_0x3e42a2){if(_0x3e42a2)return _0x3e42a2;if(_0x3167d0[_0x547c('0x4c')]!=_0x547c('0x53')){return createEndUser(_0x3ae2c2,_0x3d7088,_0x291302,_0x478320,_0xebf295,_0x3167d0);}else{return{};}});break;}}function getCall(_0x30680d,_0x2bb808,_0x4d4cf9,_0x152982,_0x5258cf,_0x2e5c9f,_0x1c40e2,_0x1bdaf0){logger['info'](_0x547c('0x56'));var _0x5abce0={};_0x5abce0[_0x547c('0x57')]={'name':!_[_0x547c('0x1e')](_0x152982['role'][_0x547c('0x1b')])&&!_[_0x547c('0x1e')](_0x152982[_0x547c('0x3d')][_0x547c('0x1b')])&&_0x152982[_0x547c('0x3d')][_0x547c('0x1b')]===_0x547c('0x58')?_0x152982['role'][_0x547c('0x1b')]:!_['isNil'](_0x152982[_0x547c('0x48')])?_0x152982[_0x547c('0x48')]+'\x20'+_0x152982[_0x547c('0x49')]:_0x152982[_0x547c('0x49')],'id':_0x152982['id']};_0x5abce0[_0x547c('0x59')]=intUtil['getString'](_0x2e5c9f[_0x547c('0x5a')],_0x1c40e2,'\x20');_0x5abce0['Description']=intUtil[_0x547c('0x5b')](_0x2e5c9f[_0x547c('0x5c')],_0x1c40e2,'\x0a');if(_0x5258cf[_0x547c('0x43')]===_0x547c('0x51')){_0x5abce0[_0x547c('0x5d')]={'name':!_['isNil'](_0x5258cf[_0x547c('0x5e')])?_0x5258cf[_0x547c('0x5e')]:!_['isNil'](_0x5258cf[_0x547c('0x5f')])?_0x5258cf[_0x547c('0x5f')]+'\x20'+_0x5258cf[_0x547c('0x60')]:_0x5258cf[_0x547c('0x60')],'id':_0x5258cf['id']};}if(_0x5258cf['enduserType']==='Leads'){_0x5abce0['What_Id']={'name':!_[_0x547c('0x1e')](_0x5258cf[_0x547c('0x5e')])?_0x5258cf['Full_Name']:!_[_0x547c('0x1e')](_0x5258cf['First_Name'])?_0x5258cf[_0x547c('0x5f')]+'\x20'+_0x5258cf[_0x547c('0x60')]:_0x5258cf[_0x547c('0x60')],'id':_0x5258cf['id']};_0x5abce0[_0x547c('0x61')]=_[_0x547c('0x46')](_0x5258cf[_0x547c('0x43')]);}if(_0x1c40e2[_0x547c('0x62')]){_0x5abce0['Call_Duration']=moment['utc'](parseInt(_0x1c40e2[_0x547c('0x62')])*0x3e8)[_0x547c('0x32')](_0x547c('0x63'));}else if(_0x1c40e2[_0x547c('0x64')]&&_0x1c40e2[_0x547c('0x65')]){_0x5abce0['Call_Duration']=moment['utc'](moment(_0x1c40e2['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x1c40e2[_0x547c('0x66')],_0x547c('0x67'))))[_0x547c('0x32')]('mm:ss');}switch(_0x1c40e2[_0x547c('0x68')]){case _0x547c('0x69'):_0x5abce0[_0x547c('0x6a')]=_0x547c('0x6b');break;case'complete':case'connect':_0x5abce0['Call_Result']=_0x547c('0x6c');break;case _0x547c('0x6d'):_0x5abce0[_0x547c('0x6a')]=_0x547c('0x6e');break;case _0x547c('0x6f'):_0x5abce0['Call_Result']='Abandoned';break;case _0x547c('0x70'):_0x5abce0[_0x547c('0x6a')]=_0x547c('0x71');default:}_0x5abce0[_0x547c('0x72')]=(_0x1bdaf0===_0x547c('0x73')?moment(_0x1c40e2['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x1c40e2[_0x547c('0x74')])['format'](_0x547c('0x67')))||moment()[_0x547c('0x32')](_0x547c('0x67'));_0x5abce0['Call_Type']=_0x1bdaf0||'Inbound';_0x5abce0=_[_0x547c('0x75')](_0x5abce0,getCustomFields(_0x2e5c9f[_0x547c('0x76')],_0x1c40e2));return request({'method':_0x547c('0x26'),'uri':_0x547c('0x44')+_0x2bb808+_0x547c('0x77'),'headers':{'Authorization':_0x547c('0x35')+_0x30680d},'body':{'data':[_0x5abce0]},'json':!![]})[_0x547c('0x36')](function(_0x5e2e8c){if(_0x5e2e8c&&_0x5e2e8c[_0x547c('0x42')][0x0][_0x547c('0x4a')]===_0x547c('0x4b')){logger[_0x547c('0x30')](_0x547c('0x78'));return{'id':_0x5e2e8c[_0x547c('0x42')][0x0][_0x547c('0x79')]['id']};}})[_0x547c('0x2c')](function(_0x49dc3c){logger[_0x547c('0x30')](_0x547c('0x7a'),_0x49dc3c[_0x547c('0x2f')]);console[_0x547c('0x7b')]('err',_0x49dc3c);});}exports[_0x547c('0x7c')]=function(_0x14f39c,_0xf343a9,_0x4e2acc,_0x52cccd,_0x52ea50,_0xd2c027){var _0x42a2a0,_0x2648bc,_0x5d6d46;_0xd2c027[_0x547c('0x7d')]=intUtil[_0x547c('0x7e')](_0xd2c027[_0x547c('0x7d')]);_0xd2c027[_0x547c('0x7f')]=intUtil['stripTrailingSlash'](_0xd2c027['serverUrl']);if(_0x52ea50&&_0x52ea50[_0x547c('0x80')]){logger['info'](_0x547c('0x81'),_0x547c('0x82'));_0xf343a9['recordingURL']=_0xd2c027[_0x547c('0x7f')]+'/api/voice/recordings/'+_0xf343a9[_0x547c('0x83')]+_0x547c('0x84')+md5(_0xf343a9['uniqueid']);}else{_0xf343a9[_0x547c('0x85')]='';}var _0x1b3f94=_0xd2c027[_0x547c('0x7d')]===_0x547c('0x86')?'eu':'com';return getAccessToken(_0xd2c027)['then'](function(_0xa222f4){_0x5d6d46=_0xa222f4;return getUser(_0x5d6d46,_0x1b3f94,_0xd2c027,_0x52cccd[_0x547c('0x3a')]);})[_0x547c('0x36')](function(_0x3378a3){_0x42a2a0=_0x3378a3;logger['info']('The\x20User\x20ID\x20is:',_0x42a2a0['id']);return getEndUser(_0x5d6d46,_0x1b3f94,_0xd2c027,_0xf343a9[_0x547c('0x87')],_0xf343a9[_0x547c('0x88')],_0x42a2a0,_0x4e2acc);})[_0x547c('0x36')](function(_0x43d9a2){_0x2648bc=_0x43d9a2;return getCall(_0x5d6d46,_0x1b3f94,_0xd2c027,_0x42a2a0,_0x2648bc,_0x4e2acc,_0xf343a9,_0x547c('0x89'));})[_0x547c('0x36')](function(_0x1e9026){if(_0x1e9026){logger[_0x547c('0x30')](_0x547c('0x8a'),_0x1e9026['id']);logger[_0x547c('0x30')](_0x547c('0x81'),_0x547c('0x8b'));emit(util[_0x547c('0x32')]('user:%s',_0x52cccd['name']),'trigger:browser:url',{'uri':_0x547c('0x8c')+_0xd2c027['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1e9026['id']});}})[_0x547c('0x2c')](function(_0x5cbef2){logger['error'](_0x547c('0x81'),JSON[_0x547c('0xf')](_0x5cbef2));});};exports[_0x547c('0x73')]=function(_0x1c8fcd,_0x500ab7,_0x28213b,_0xf9c96,_0x480c8a,_0x5c4907,_0x33262e){var _0x1a5128,_0x2fecce,_0x38a01a;_0x5c4907[_0x547c('0x7d')]=intUtil[_0x547c('0x7e')](_0x5c4907[_0x547c('0x7d')]);_0x5c4907[_0x547c('0x7f')]=intUtil['stripTrailingSlash'](_0x5c4907[_0x547c('0x7f')]);if(_0x33262e&&_0x33262e[_0x547c('0x8d')]&&_0x33262e[_0x547c('0x8d')]!=='none'){logger[_0x547c('0x30')](_0x547c('0x8e'),_0x547c('0x82'));_0x500ab7[_0x547c('0x85')]=_0x5c4907[_0x547c('0x7f')]+_0x547c('0x8f')+_0x500ab7[_0x547c('0x83')]+_0x547c('0x84')+md5(_0x500ab7[_0x547c('0x83')]);}var _0x7a72fd=_0x5c4907[_0x547c('0x7d')]===_0x547c('0x86')?'eu':_0x547c('0x90');return getAccessToken(_0x5c4907)[_0x547c('0x36')](function(_0x5146a6){_0x38a01a=_0x5146a6;return getUser(_0x38a01a,_0x7a72fd,_0x5c4907,_0xf9c96[_0x547c('0x3a')]);})[_0x547c('0x36')](function(_0x133724){_0x1a5128=_0x133724;logger['info'](_0x547c('0x91'),_0x1a5128['id']);return getEndUser(_0x38a01a,_0x7a72fd,_0x5c4907,_0x500ab7[_0x547c('0x92')],_0x500ab7[_0x547c('0x93')],_0x1a5128,_0x28213b);})[_0x547c('0x36')](function(_0x427358){_0x2fecce=_0x427358;return getCall(_0x38a01a,_0x7a72fd,_0x5c4907,_0x1a5128,_0x2fecce,_0x28213b,_0x500ab7,_0x547c('0x94'));})[_0x547c('0x36')](function(_0x8dd0f9){if(_0x8dd0f9){logger[_0x547c('0x30')](_0x547c('0x8a'),_0x8dd0f9['id']);logger[_0x547c('0x30')](_0x547c('0x8e'),_0x547c('0x8b'));emit(util['format']('user:%s',_0xf9c96['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x5c4907['host']+_0x547c('0x95')+_0x8dd0f9['id']});}})[_0x547c('0x2c')](function(_0x813437){logger[_0x547c('0x2d')]('[OUTBOUND]',JSON[_0x547c('0xf')](_0x813437));});};exports[_0x547c('0x96')]=function(_0x27410e,_0x507ecb,_0x4607f4,_0x3ac70e,_0x387fa7,_0x53a0a7){var _0x51f200,_0x571c95,_0x1a5445;_0x53a0a7['host']=intUtil[_0x547c('0x7e')](_0x53a0a7[_0x547c('0x7d')]);_0x53a0a7['serverUrl']=intUtil[_0x547c('0x7e')](_0x53a0a7[_0x547c('0x7f')]);if(_0x387fa7&&_0x387fa7[_0x547c('0x80')]){logger[_0x547c('0x30')]('['+_0x507ecb[_0x547c('0x68')]['toUpperCase']()+']',_0x547c('0x82'));_0x507ecb['recordingURL']=_0x53a0a7[_0x547c('0x7f')]+_0x547c('0x8f')+_0x507ecb[_0x547c('0x83')]+_0x547c('0x84')+md5(_0x507ecb['uniqueid']);}else{_0x507ecb[_0x547c('0x85')]='';}var _0x53d6d9=_0x53a0a7[_0x547c('0x7d')]===_0x547c('0x86')?'eu':'com';return getAccessToken(_0x53a0a7)[_0x547c('0x36')](function(_0x542c3c){_0x1a5445=_0x542c3c;return getUser(_0x1a5445,_0x53d6d9,_0x53a0a7);})[_0x547c('0x36')](function(_0x1057f9){_0x51f200=_0x1057f9;logger[_0x547c('0x30')](_0x547c('0x91'),_0x51f200['id']);return getEndUser(_0x1a5445,_0x53d6d9,_0x53a0a7,_0x507ecb['calleridname'],_0x507ecb[_0x547c('0x88')],_0x51f200,_0x4607f4);})[_0x547c('0x36')](function(_0xea441b){_0x571c95=_0xea441b;return getCall(_0x1a5445,_0x53d6d9,_0x53a0a7,_0x51f200,_0x571c95,_0x4607f4,_0x507ecb,_0x547c('0x89'));})[_0x547c('0x36')](function(_0x4b8286){if(_0x4b8286){logger[_0x547c('0x30')](_0x547c('0x8a'),_0x4b8286['id']);}})[_0x547c('0x2c')](function(_0x5337d5){logger[_0x547c('0x2d')]('['+_0x507ecb[_0x547c('0x68')][_0x547c('0x97')]()+']',JSON[_0x547c('0xf')](_0x5337d5));});}; \ No newline at end of file +var _0x8048=['diff','mm:ss','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','log','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','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=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','https://crm.','unmanaged','monitor_format','toUpperCase','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','idField','content','toString','type','variable','variableName','Variable','name','indexOf','isNil','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','SUCCESS','details','enduserType','Error:\x20','CREATE\x20ERROR','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','endtime','YYYY-MM-DDTHH:mm:ss'];(function(_0x463812,_0x202adf){var _0x5e2680=function(_0x1609a3){while(--_0x1609a3){_0x463812['push'](_0x463812['shift']());}};_0x5e2680(++_0x202adf);}(_0x8048,0x166));var _0x8804=function(_0x11239b,_0xdfd2b0){_0x11239b=_0x11239b-0x0;var _0x1d51c4=_0x8048[_0x11239b];return _0x1d51c4;};'use strict';var _=require('lodash');var rp=require(_0x8804('0x0'));var md5=require(_0x8804('0x1'));var util=require(_0x8804('0x2'));var intUtil=require('./util');var moment=require(_0x8804('0x3'));var Redis=require(_0x8804('0x4'));var BPromise=require(_0x8804('0x5'));var config=require(_0x8804('0x6'));var logger=require('../../../../config/logger')(_0x8804('0x7'));config['redis']=_['defaults'](config[_0x8804('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8804('0x9'))(new Redis(config[_0x8804('0x8')]));function emit(_0x35eb20,_0x37d836,_0x3f3f7c){io['to'](_0x35eb20)[_0x8804('0xa')](_0x37d836,_0x3f3f7c);}function request(_0x317c4d){logger[_0x8804('0xb')](_0x8804('0xc'),JSON[_0x8804('0xd')](_0x317c4d));return rp(_0x317c4d);}function getCustomFields(_0x485f44,_0x1bfea0){var _0x54f6d6={};if(_0x485f44[_0x8804('0xe')]>0x0){_[_0x8804('0xf')](_0x485f44,function(_0xc133a3){if(_0xc133a3['type']===_0x8804('0x10')&&_0xc133a3[_0x8804('0x11')]){_0x54f6d6[_0xc133a3['idField']]=_0xc133a3[_0x8804('0x12')][_0x8804('0x13')]();}else if(_0xc133a3[_0x8804('0x14')]===_0x8804('0x15')&&_0xc133a3['variableName']&&_0xc133a3[_0x8804('0x11')]&&_0x1bfea0[_0xc133a3[_0x8804('0x16')]]){_0x54f6d6[_0xc133a3[_0x8804('0x11')]]=_0x1bfea0[_0xc133a3[_0x8804('0x16')]][_0x8804('0x13')]();}else if(_0xc133a3['type']==='customVariable'&&_0xc133a3[_0x8804('0x17')]&&_0xc133a3[_0x8804('0x17')][_0x8804('0x18')]&&_0xc133a3['idField']&&_0x1bfea0[_0xc133a3[_0x8804('0x17')]['name']['toLowerCase']()]){_0x54f6d6[_0xc133a3[_0x8804('0x11')]]=_0x1bfea0[_0xc133a3[_0x8804('0x17')][_0x8804('0x18')]['toLowerCase']()][_0x8804('0x13')]();}});}return _0x54f6d6;}function getName(_0x2a5aa6){if(_0x2a5aa6[_0x8804('0x19')]('\x20')>0x0){var _0x4c10f7=_0x2a5aa6['split'](/ (.+)/);if(_0x4c10f7[0x1]){return _0x4c10f7;}}return[_0x2a5aa6,_0x2a5aa6];}var accountsTokens={};function getAccessToken(_0x1df795){return new Promise(function(_0xd30584,_0x1f45dd){if(!_['isNil'](accountsTokens[_0x1df795['id']])&&!_[_0x8804('0x1a')](accountsTokens[_0x1df795['id']][_0x8804('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x1df795['id']]['expires_in'])){_0xd30584(accountsTokens[_0x1df795['id']]['access_token']);}}var _0x2b259c;switch(_0x1df795[_0x8804('0x1c')]){case'US':_0x2b259c='https://accounts.zoho.com';break;case'AU':_0x2b259c=_0x8804('0x1d');break;case'EU':_0x2b259c=_0x8804('0x1e');break;case'IN':_0x2b259c='https://accounts.zoho.in';break;case'CN':_0x2b259c=_0x8804('0x1f');break;default:_0x2b259c=_0x8804('0x1e');break;}var _0x165e16={'method':_0x8804('0x20'),'uri':_0x2b259c+_0x8804('0x21'),'qs':{'refresh_token':_0x1df795[_0x8804('0x22')],'client_id':_0x1df795[_0x8804('0x23')],'client_secret':_0x1df795[_0x8804('0x24')],'grant_type':_0x8804('0x25')},'json':!![]};return rp(_0x165e16)[_0x8804('0x26')](function(_0x532991){accountsTokens[_0x1df795['id']]={'access_token':_0x532991['access_token'],'expires_in':moment()[_0x8804('0x27')](_0x532991[_0x8804('0x28')],_0x8804('0x29'))};_0xd30584(_0x532991[_0x8804('0x1b')]);})[_0x8804('0x2a')](function(_0x7d1f99){logger[_0x8804('0x2b')](_0x8804('0x2c'),_0x7d1f99[_0x8804('0x2d')]);_0x1f45dd(_0x7d1f99);});});}function getUser(_0x32b4a8,_0x437b4d,_0x40ddbe,_0x3a7fee){logger[_0x8804('0x2e')]('Search\x20user');return request({'method':_0x8804('0x2f'),'uri':util[_0x8804('0x30')](_0x8804('0x31'),_0x437b4d),'qs':{'type':_0x8804('0x32')},'headers':{'Authorization':_0x8804('0x33')+_0x32b4a8},'json':!![]})['then'](function(_0x3fe5c0){if(_0x3fe5c0[_0x8804('0x34')]){var _0x9db5cc=-0x1;if(_[_0x8804('0x35')](_0x3fe5c0[_0x8804('0x34')])){if(!_['isNil'](_0x3a7fee)){_0x9db5cc=_['findIndex'](_0x3fe5c0[_0x8804('0x34')],function(_0x4f471d){return _0x4f471d[_0x8804('0x36')]===_0x3a7fee;});}if(_0x9db5cc>=0x0){logger[_0x8804('0x2e')](_0x8804('0x37'));}else{logger['info'](_0x8804('0x38'));_0x9db5cc=_['findIndex'](_0x3fe5c0['users'],function(_0x1aa067){return _0x1aa067[_0x8804('0x39')][_0x8804('0x18')]===_0x8804('0x3a');});}return _0x3fe5c0[_0x8804('0x34')][_0x9db5cc];}else{if(_0x3fe5c0[_0x8804('0x3b')]['profile'][_0x8804('0x18')]==='Administrator'){logger['info'](_0x8804('0x38'));user=_0x3fe5c0['user'];return user;}else{logger['error'](_0x8804('0x3c'),JSON[_0x8804('0xd')](_0x3fe5c0));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x8804('0xd')](_0x3fe5c0));}}}else{logger[_0x8804('0x2b')](_0x8804('0x3c'),JSON[_0x8804('0xd')](_0x3fe5c0));throw new Error(_0x8804('0x3d')+JSON[_0x8804('0xd')](_0x3fe5c0));}})[_0x8804('0x2a')](function(_0x56b2e2){console['error'](_0x56b2e2);});}function getZohoUser(_0x3de206,_0x111fea){return new BPromise(function(_0x4c1cd4,_0x2a62be){request(_0x3de206)['then'](function(_0x5cda19){var _0x5bf482=null;if(_0x5cda19){_0x5bf482=_0x5cda19['data'][0x0];_0x5bf482['enduserType']=_0x111fea;}_0x4c1cd4(_0x5bf482);})[_0x8804('0x2a')](function(_0x1af698){_0x2a62be(_0x1af698);});});}function createEndUser(_0x210253,_0x3a5641,_0x24acd3,_0x450696,_0x4b5b21,_0x32b668){var _0x24acd3=getName(_0x24acd3);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x3a5641+_0x8804('0x3e')+_[_0x8804('0x3f')](_0x32b668[_0x8804('0x40')])+'s','body':{'data':[{'Last_Name':_0x24acd3[0x1],'First_Name':_0x24acd3[0x0],'Phone':_0x450696,'Owner':{'name':!_[_0x8804('0x1a')](_0x4b5b21[_0x8804('0x41')][_0x8804('0x18')])?_0x4b5b21[_0x8804('0x41')][_0x8804('0x18')]:!_['isNil'](_0x4b5b21[_0x8804('0x42')])?_0x4b5b21[_0x8804('0x42')]+'\x20'+_0x4b5b21['last_name']:_0x4b5b21[_0x8804('0x43')],'id':_0x4b5b21['id']}}]},'headers':{'Authorization':_0x8804('0x33')+_0x210253},'json':!![]})[_0x8804('0x26')](function(_0x3ac530){if(_0x3ac530&&_0x3ac530[_0x8804('0x44')][0x0]['code']===_0x8804('0x45')){var _0x9bf8a2=_0x3ac530[_0x8804('0x44')][0x0][_0x8804('0x46')];_0x9bf8a2[_0x8804('0x47')]=_[_0x8804('0x3f')](_0x32b668[_0x8804('0x40')])+'s';return _0x9bf8a2;}logger[_0x8804('0x2b')](_0x8804('0x3c'),JSON[_0x8804('0xd')](data));throw new Error(_0x8804('0x48')+JSON[_0x8804('0xd')](data));})['catch'](function(_0x2b3e12){console['log'](_0x8804('0x49'),_0x2b3e12);});}function getEndUser(_0x425e7a,_0x4680cf,_0x35003b,_0x2dc529,_0x3531ef,_0x427e97,_0x11627b){var _0x58d7e8={'method':_0x8804('0x2f'),'uri':'','headers':{'Authorization':_0x8804('0x33')+_0x425e7a},'json':!![]};switch(_0x11627b['moduleSearch']){case _0x8804('0x4a'):_0x58d7e8['uri']=_0x8804('0x4b')+_0x4680cf+_0x8804('0x4c')+_0x3531ef+'))';return getZohoUser(_0x58d7e8,_0x8804('0x4d'))['then'](function(_0x2de8c6){if(_0x2de8c6)return _0x2de8c6;_0x58d7e8[_0x8804('0x4e')]=_0x8804('0x4b')+_0x4680cf+_0x8804('0x4f')+_0x3531ef+'))';return getZohoUser(_0x58d7e8,_0x8804('0x50'))['then'](function(_0x43bbb8){if(_0x43bbb8)return _0x43bbb8;if(_0x11627b[_0x8804('0x40')]!=_0x8804('0x51')){return createEndUser(_0x425e7a,_0x4680cf,_0x2dc529,_0x3531ef,_0x427e97,_0x11627b);}else{return{};}});});break;case _0x8804('0x52'):_0x58d7e8[_0x8804('0x4e')]=_0x8804('0x4b')+_0x4680cf+_0x8804('0x4c')+_0x3531ef+'))';return getZohoUser(_0x58d7e8,_0x8804('0x4d'))[_0x8804('0x26')](function(_0x4e35d0){if(_0x4e35d0)return _0x4e35d0;if(_0x11627b[_0x8804('0x40')]!=_0x8804('0x51')){return createEndUser(_0x425e7a,_0x4680cf,_0x2dc529,_0x3531ef,_0x427e97,_0x11627b);}else{return{};}});break;case'lead':_0x58d7e8[_0x8804('0x4e')]=_0x8804('0x4b')+_0x4680cf+_0x8804('0x4f')+_0x3531ef+'))';return getZohoUser(_0x58d7e8,_0x8804('0x50'))['then'](function(_0x1a10f0){if(_0x1a10f0)return _0x1a10f0;if(_0x11627b['moduleCreate']!=_0x8804('0x51')){return createEndUser(_0x425e7a,_0x4680cf,_0x2dc529,_0x3531ef,_0x427e97,_0x11627b);}else{return{};}});break;}}function getCall(_0x507d66,_0x125f65,_0x36ede7,_0x422532,_0x5ed9e2,_0x1085a0,_0x5c42b1,_0x1a1ac6){logger[_0x8804('0x2e')](_0x8804('0x53'));var _0x5f3c0c={};_0x5f3c0c['Owner']={'name':!_['isNil'](_0x422532[_0x8804('0x41')]['name'])&&!_[_0x8804('0x1a')](_0x422532[_0x8804('0x39')][_0x8804('0x18')])&&_0x422532['profile']['name']===_0x8804('0x54')?_0x422532[_0x8804('0x41')][_0x8804('0x18')]:!_[_0x8804('0x1a')](_0x422532['first_name'])?_0x422532[_0x8804('0x42')]+'\x20'+_0x422532[_0x8804('0x43')]:_0x422532[_0x8804('0x43')],'id':_0x422532['id']};_0x5f3c0c[_0x8804('0x55')]=intUtil['getString'](_0x1085a0[_0x8804('0x56')],_0x5c42b1,'\x20');_0x5f3c0c[_0x8804('0x57')]=intUtil[_0x8804('0x58')](_0x1085a0[_0x8804('0x59')],_0x5c42b1,'\x0a');if(_0x5ed9e2[_0x8804('0x47')]==='Contacts'){_0x5f3c0c[_0x8804('0x5a')]={'name':!_[_0x8804('0x1a')](_0x5ed9e2[_0x8804('0x5b')])?_0x5ed9e2['Full_Name']:!_[_0x8804('0x1a')](_0x5ed9e2['First_Name'])?_0x5ed9e2[_0x8804('0x5c')]+'\x20'+_0x5ed9e2[_0x8804('0x5d')]:_0x5ed9e2[_0x8804('0x5d')],'id':_0x5ed9e2['id']};}if(_0x5ed9e2[_0x8804('0x47')]===_0x8804('0x50')){_0x5f3c0c[_0x8804('0x5e')]={'name':!_[_0x8804('0x1a')](_0x5ed9e2[_0x8804('0x5b')])?_0x5ed9e2[_0x8804('0x5b')]:!_[_0x8804('0x1a')](_0x5ed9e2[_0x8804('0x5c')])?_0x5ed9e2[_0x8804('0x5c')]+'\x20'+_0x5ed9e2[_0x8804('0x5d')]:_0x5ed9e2[_0x8804('0x5d')],'id':_0x5ed9e2['id']};_0x5f3c0c[_0x8804('0x5f')]=_['startCase'](_0x5ed9e2[_0x8804('0x47')]);}if(_0x5c42b1['talktime']){_0x5f3c0c[_0x8804('0x60')]=moment[_0x8804('0x61')](parseInt(_0x5c42b1[_0x8804('0x62')])*0x3e8)[_0x8804('0x30')]('mm:ss');}else if(_0x5c42b1['answertime']&&_0x5c42b1[_0x8804('0x63')]){_0x5f3c0c[_0x8804('0x60')]=moment['utc'](moment(_0x5c42b1[_0x8804('0x63')],_0x8804('0x64'))[_0x8804('0x65')](moment(_0x5c42b1['starttime'],_0x8804('0x64'))))[_0x8804('0x30')](_0x8804('0x66'));}switch(_0x5c42b1[_0x8804('0x67')]){case _0x8804('0x68'):_0x5f3c0c[_0x8804('0x69')]='Called';break;case _0x8804('0x6a'):case _0x8804('0x6b'):_0x5f3c0c[_0x8804('0x69')]=_0x8804('0x6c');break;case _0x8804('0x6d'):_0x5f3c0c[_0x8804('0x69')]=_0x8804('0x6e');break;case _0x8804('0x6f'):_0x5f3c0c[_0x8804('0x69')]=_0x8804('0x70');break;case'timeout':_0x5f3c0c[_0x8804('0x69')]=_0x8804('0x71');default:}_0x5f3c0c['Call_Start_Time']=(_0x1a1ac6===_0x8804('0x72')?moment(_0x5c42b1['starttime'])['format'](_0x8804('0x64')):moment(_0x5c42b1[_0x8804('0x73')])[_0x8804('0x30')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x8804('0x64'));_0x5f3c0c['Call_Type']=_0x1a1ac6||_0x8804('0x74');_0x5f3c0c=_[_0x8804('0x75')](_0x5f3c0c,getCustomFields(_0x1085a0[_0x8804('0x76')],_0x5c42b1));return request({'method':'POST','uri':_0x8804('0x4b')+_0x125f65+_0x8804('0x77'),'headers':{'Authorization':_0x8804('0x33')+_0x507d66},'body':{'data':[_0x5f3c0c]},'json':!![]})[_0x8804('0x26')](function(_0x243fe9){if(_0x243fe9&&_0x243fe9[_0x8804('0x44')][0x0][_0x8804('0x78')]===_0x8804('0x45')){logger[_0x8804('0x2e')](_0x8804('0x79'));return{'id':_0x243fe9[_0x8804('0x44')][0x0][_0x8804('0x46')]['id']};}})[_0x8804('0x2a')](function(_0x17f9eb){logger[_0x8804('0x2e')](_0x8804('0x7a'),_0x17f9eb[_0x8804('0x2d')]);console[_0x8804('0x7b')](_0x8804('0x7a'),_0x17f9eb);});}exports[_0x8804('0x7c')]=function(_0x2219d2,_0xeadb91,_0x5b3b52,_0x1af516,_0x19b2bd,_0x58d449){var _0x7f4053,_0x5d1c7e,_0x304b99;_0x58d449['host']=intUtil[_0x8804('0x7d')](_0x58d449[_0x8804('0x7e')]);_0x58d449['serverUrl']=intUtil['stripTrailingSlash'](_0x58d449[_0x8804('0x7f')]);if(_0x19b2bd&&_0x19b2bd['monitor_format']){logger[_0x8804('0x2e')](_0x8804('0x80'),_0x8804('0x81'));_0xeadb91['recordingURL']=_0x58d449[_0x8804('0x7f')]+_0x8804('0x82')+_0xeadb91['uniqueid']+_0x8804('0x83')+md5(_0xeadb91[_0x8804('0x84')]);}else{_0xeadb91[_0x8804('0x85')]='';}var _0x245ed1=_0x58d449[_0x8804('0x7e')]===_0x8804('0x86')?'eu':_0x8804('0x87');return getAccessToken(_0x58d449)[_0x8804('0x26')](function(_0x32887a){_0x304b99=_0x32887a;return getUser(_0x304b99,_0x245ed1,_0x58d449,_0x1af516[_0x8804('0x36')]);})[_0x8804('0x26')](function(_0x1c7247){_0x7f4053=_0x1c7247;logger[_0x8804('0x2e')](_0x8804('0x88'),_0x7f4053['id']);return getEndUser(_0x304b99,_0x245ed1,_0x58d449,_0xeadb91[_0x8804('0x89')],_0xeadb91[_0x8804('0x8a')],_0x7f4053,_0x5b3b52);})[_0x8804('0x26')](function(_0x14d8a5){_0x5d1c7e=_0x14d8a5;return getCall(_0x304b99,_0x245ed1,_0x58d449,_0x7f4053,_0x5d1c7e,_0x5b3b52,_0xeadb91,'Inbound');})[_0x8804('0x26')](function(_0x534af6){if(_0x534af6){logger[_0x8804('0x2e')](_0x8804('0x8b'),_0x534af6['id']);logger[_0x8804('0x2e')](_0x8804('0x80'),_0x8804('0x8c'));emit(util[_0x8804('0x30')]('user:%s',_0x1af516[_0x8804('0x18')]),_0x8804('0x8d'),{'uri':'https://crm.'+_0x58d449[_0x8804('0x7e')]+_0x8804('0x8e')+_0x534af6['id']});}})[_0x8804('0x2a')](function(_0x51bc8b){logger[_0x8804('0x2b')](_0x8804('0x80'),JSON[_0x8804('0xd')](_0x51bc8b));});};exports[_0x8804('0x72')]=function(_0xbaf3f1,_0x35d668,_0x3691c4,_0x53e857,_0x25ec65,_0x45d714,_0x3e31d7){var _0x4f768e,_0x32379d,_0x32325a;_0x45d714[_0x8804('0x7e')]=intUtil[_0x8804('0x7d')](_0x45d714[_0x8804('0x7e')]);_0x45d714[_0x8804('0x7f')]=intUtil['stripTrailingSlash'](_0x45d714[_0x8804('0x7f')]);if(_0x3e31d7&&_0x3e31d7[_0x8804('0x8f')]&&_0x3e31d7['recordingFormat']!==_0x8804('0x90')){logger[_0x8804('0x2e')](_0x8804('0x91'),'Recording\x20is\x20enabled!');_0x35d668[_0x8804('0x85')]=_0x45d714[_0x8804('0x7f')]+'/api/voice/recordings/'+_0x35d668['uniqueid']+_0x8804('0x83')+md5(_0x35d668['uniqueid']);}var _0x525d7e=_0x45d714[_0x8804('0x7e')]===_0x8804('0x86')?'eu':_0x8804('0x87');return getAccessToken(_0x45d714)[_0x8804('0x26')](function(_0x3dd3ef){_0x32325a=_0x3dd3ef;return getUser(_0x32325a,_0x525d7e,_0x45d714,_0x53e857['email']);})[_0x8804('0x26')](function(_0x44e587){_0x4f768e=_0x44e587;logger[_0x8804('0x2e')]('The\x20User\x20ID\x20is:',_0x4f768e['id']);return getEndUser(_0x32325a,_0x525d7e,_0x45d714,_0x35d668[_0x8804('0x92')],_0x35d668[_0x8804('0x93')],_0x4f768e,_0x3691c4);})[_0x8804('0x26')](function(_0x48f247){_0x32379d=_0x48f247;return getCall(_0x32325a,_0x525d7e,_0x45d714,_0x4f768e,_0x32379d,_0x3691c4,_0x35d668,_0x8804('0x94'));})[_0x8804('0x26')](function(_0x260e2d){if(_0x260e2d){logger['info'](_0x8804('0x8b'),_0x260e2d['id']);logger[_0x8804('0x2e')](_0x8804('0x91'),_0x8804('0x8c'));emit(util['format']('user:%s',_0x53e857[_0x8804('0x18')]),_0x8804('0x8d'),{'uri':_0x8804('0x95')+_0x45d714[_0x8804('0x7e')]+_0x8804('0x8e')+_0x260e2d['id']});}})[_0x8804('0x2a')](function(_0x93ce13){logger['error']('[OUTBOUND]',JSON['stringify'](_0x93ce13));});};exports[_0x8804('0x96')]=function(_0x42febe,_0x3b50f0,_0x20724d,_0x23c348,_0x4a2c88,_0x4b6bc3){var _0x24d09b,_0x6b6ccc,_0x3948cd;_0x4b6bc3[_0x8804('0x7e')]=intUtil[_0x8804('0x7d')](_0x4b6bc3[_0x8804('0x7e')]);_0x4b6bc3[_0x8804('0x7f')]=intUtil['stripTrailingSlash'](_0x4b6bc3[_0x8804('0x7f')]);if(_0x4a2c88&&_0x4a2c88[_0x8804('0x97')]){logger[_0x8804('0x2e')]('['+_0x3b50f0['lastevent'][_0x8804('0x98')]()+']','Recording\x20is\x20enabled!');_0x3b50f0['recordingURL']=_0x4b6bc3[_0x8804('0x7f')]+_0x8804('0x82')+_0x3b50f0['uniqueid']+_0x8804('0x83')+md5(_0x3b50f0['uniqueid']);}else{_0x3b50f0[_0x8804('0x85')]='';}var _0x53b8fb=_0x4b6bc3[_0x8804('0x7e')]===_0x8804('0x86')?'eu':_0x8804('0x87');return getAccessToken(_0x4b6bc3)[_0x8804('0x26')](function(_0x4e968b){_0x3948cd=_0x4e968b;return getUser(_0x3948cd,_0x53b8fb,_0x4b6bc3);})['then'](function(_0x593566){_0x24d09b=_0x593566;logger[_0x8804('0x2e')](_0x8804('0x88'),_0x24d09b['id']);return getEndUser(_0x3948cd,_0x53b8fb,_0x4b6bc3,_0x3b50f0[_0x8804('0x89')],_0x3b50f0[_0x8804('0x8a')],_0x24d09b,_0x20724d);})[_0x8804('0x26')](function(_0x215fef){_0x6b6ccc=_0x215fef;return getCall(_0x3948cd,_0x53b8fb,_0x4b6bc3,_0x24d09b,_0x6b6ccc,_0x20724d,_0x3b50f0,_0x8804('0x74'));})['then'](function(_0x4f82c9){if(_0x4f82c9){logger[_0x8804('0x2e')]('The\x20Call\x20ID\x20is:',_0x4f82c9['id']);}})['catch'](function(_0x1d01aa){logger[_0x8804('0x2b')]('['+_0x3b50f0[_0x8804('0x67')][_0x8804('0x98')]()+']',JSON[_0x8804('0xd')](_0x1d01aa));});}; \ 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 3d80aac..7cf6879 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(_0x1aec2f,_0x58c67a){var _0xfe3d9e=function(_0x1d59fb){while(--_0x1d59fb){_0x1aec2f['push'](_0x1aec2f['shift']());}};_0xfe3d9e(++_0x58c67a);}(_0x7a54,0x106));var _0x47a5=function(_0x18840f,_0x44a12d){_0x18840f=_0x18840f-0x0;var _0x53f0c4=_0x7a54[_0x18840f];return _0x53f0c4;};'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(_0x4060c3,_0x36ef66){var _0x586a6b=function(_0x1d2809){while(--_0x1d2809){_0x4060c3['push'](_0x4060c3['shift']());}};_0x586a6b(++_0x36ef66);}(_0x7a54,0x106));var _0x47a5=function(_0x3d977b,_0x17190d){_0x3d977b=_0x3d977b-0x0;var _0x10e9d2=_0x7a54[_0x3d977b];return _0x10e9d2;};'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 ec4bf56..2335806 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x106819,_0x24f9ef){var _0xb44208=function(_0x8c688a){while(--_0x8c688a){_0x106819['push'](_0x106819['shift']());}};_0xb44208(++_0x24f9ef);}(_0x7a54,0x106));var _0x47a5=function(_0x241369,_0x11d952){_0x241369=_0x241369-0x0;var _0x22a020=_0x7a54[_0x241369];return _0x22a020;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _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(_0x30ae33,_0x4739d1){var _0x5065aa=function(_0x48472d){while(--_0x48472d){_0x30ae33['push'](_0x30ae33['shift']());}};_0x5065aa(++_0x4739d1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d586d,_0x3fcc44){_0x1d586d=_0x1d586d-0x0;var _0x5a0a3e=_0x5f2f[_0x1d586d];return _0x5a0a3e;};'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 7fb04dd..cdd0240 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 _0x3685=['exports','jayson/promise','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result'];(function(_0x19c7cc,_0x2a61b7){var _0x482a72=function(_0xf413fd){while(--_0xf413fd){_0x19c7cc['push'](_0x19c7cc['shift']());}};_0x482a72(++_0x2a61b7);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x5368('0x0'));var BPromise=require('bluebird');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var client=jayson[_0x5368('0x3')][_0x5368('0x4')]({'port':0x2329});client[_0x5368('0x5')]=function(_0xf0428a,_0x271e21){return new BPromise(function(_0x2c9c35,_0x3bf968){return client[_0x5368('0x6')](_0xf0428a,_0x271e21)['then'](function(_0x1a4450){logger[_0x5368('0x7')](_0x5368('0x8'),_0x5368('0x2'),_0xf0428a,_0x271e21,_0x1a4450);if(_0x1a4450['error']){logger[_0x5368('0x9')](_0x5368('0x8'),_0x5368('0x2'),_0xf0428a,_0x1a4450[_0x5368('0x9')][_0x5368('0xa')],_0x271e21);return _0x3bf968(_0x1a4450[_0x5368('0x9')][_0x5368('0xa')]);}else{return _0x2c9c35(_0x1a4450[_0x5368('0xb')]);}})['catch'](function(_0x3d9625){logger[_0x5368('0x9')](_0x5368('0x8'),'routing',_0xf0428a,_0x3d9625,_0x271e21);return _0x3bf968(_0x3d9625);});});};module[_0x5368('0xc')]=client; \ No newline at end of file +var _0x1928=['routing','error','message','catch','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1928,0x138));var _0x8192=function(_0x5d33a8,_0x47348c){_0x5d33a8=_0x5d33a8-0x0;var _0x23d9e5=_0x1928[_0x5d33a8];return _0x23d9e5;};'use strict';var jayson=require(_0x8192('0x0'));var BPromise=require(_0x8192('0x1'));var logger=require(_0x8192('0x2'))('routing');var client=jayson[_0x8192('0x3')][_0x8192('0x4')]({'port':0x2329});client[_0x8192('0x5')]=function(_0x1a193a,_0x16f410){return new BPromise(function(_0x11fa71,_0x11c753){return client[_0x8192('0x6')](_0x1a193a,_0x16f410)[_0x8192('0x7')](function(_0x25f90e){logger[_0x8192('0x8')](_0x8192('0x9'),_0x8192('0xa'),_0x1a193a,_0x16f410,_0x25f90e);if(_0x25f90e[_0x8192('0xb')]){logger['error'](_0x8192('0x9'),'routing',_0x1a193a,_0x25f90e[_0x8192('0xb')][_0x8192('0xc')],_0x16f410);return _0x11c753(_0x25f90e[_0x8192('0xb')][_0x8192('0xc')]);}else{return _0x11fa71(_0x25f90e['result']);}})[_0x8192('0xd')](function(_0xab012a){logger[_0x8192('0xb')](_0x8192('0x9'),_0x8192('0xa'),_0x1a193a,_0xab012a,_0x16f410);return _0x11c753(_0xab012a);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d005c2c..613b982 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 _0xb7b6=['log','bluebird','./server','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x2f1adb,_0x5c1ce0){var _0x52fbd8=function(_0x595f17){while(--_0x595f17){_0x2f1adb['push'](_0x2f1adb['shift']());}};_0x52fbd8(++_0x5c1ce0);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x5b6011,_0x3e94f0){_0x5b6011=_0x5b6011-0x0;var _0x5ad7e4=_0xb7b6[_0x5b6011];return _0x5ad7e4;};'use strict';var BPromise=require(_0x6b7b('0x0'));var server=require(_0x6b7b('0x1'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x6b7b('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x6b7b('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0x6b7b('0x4')](mailAccount[_0x6b7b('0x5')]())['then'](realtime['initMailAccounts']())[_0x6b7b('0x4')](function(){email[_0x6b7b('0x6')](realtime[_0x6b7b('0x7')]);return realtime;});}function main(){return server[_0x6b7b('0x8')](realtime,email)[_0x6b7b('0x4')](function(_0x483b9c){return initRealtime();})['then'](function(_0x2bb86d){return db[_0x6b7b('0x9')][_0x6b7b('0xa')]({'attributes':['id',_0x6b7b('0xb')],'raw':!![]});})['then'](function(_0x4ac78d){return setInterval(initRealtime,_0x4ac78d['loginMailFrequency']*0x3e8);})[_0x6b7b('0xc')](function(_0x4223d9){console[_0x6b7b('0xd')](_0x4223d9);});}main(); \ No newline at end of file +var _0x510e=['mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x41159b,_0x18ae88){var _0x5bea4e=function(_0x95177e){while(--_0x95177e){_0x41159b['push'](_0x41159b['shift']());}};_0x5bea4e(++_0x18ae88);}(_0x510e,0x1ed));var _0xe510=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x510e[_0x3b231a];return _0x18d67a;};'use strict';var BPromise=require(_0xe510('0x0'));var server=require(_0xe510('0x1'));var Realtime=require(_0xe510('0x2'));var EmailChannel=require(_0xe510('0x3'));var mailAccount=require(_0xe510('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xe510('0x5'))['db'];function initRealtime(){return BPromise[_0xe510('0x6')]()[_0xe510('0x7')](mailAccount[_0xe510('0x8')]())['then'](realtime[_0xe510('0x9')]())[_0xe510('0x7')](function(){email[_0xe510('0xa')](realtime[_0xe510('0xb')]);return realtime;});}function main(){return server[_0xe510('0xc')](realtime,email)[_0xe510('0x7')](function(_0x27ca15){return initRealtime();})[_0xe510('0x7')](function(_0x2f5db7){return db[_0xe510('0xd')][_0xe510('0xe')]({'attributes':['id',_0xe510('0xf')],'raw':!![]});})[_0xe510('0x7')](function(_0x149f35){return setInterval(initRealtime,_0x149f35['loginMailFrequency']*0x3e8);})[_0xe510('0x10')](function(_0x34ee7d){console[_0xe510('0x11')](_0x34ee7d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6cb4493..b3b0a5b 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 _0x7b9b=['info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','active','status','Imap','total','isNil','emit','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','moment','bluebird','md5','ioredis','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter'];(function(_0x4d9d1e,_0x3c2d20){var _0x1b9d54=function(_0x373c21){while(--_0x373c21){_0x4d9d1e['push'](_0x4d9d1e['shift']());}};_0x1b9d54(++_0x3c2d20);}(_0x7b9b,0xeb));var _0xb7b9=function(_0x21bdd9,_0x48e25b){_0x21bdd9=_0x21bdd9-0x0;var _0x46a9fa=_0x7b9b[_0x21bdd9];return _0x46a9fa;};'use strict';var _=require('lodash');var moment=require(_0xb7b9('0x0'));var BPromise=require(_0xb7b9('0x1'));var md5=require(_0xb7b9('0x2'));var Redis=require(_0xb7b9('0x3'));var config=require('../../../config/environment');var logger=require(_0xb7b9('0x4'))(_0xb7b9('0x5'));config['redis']=_[_0xb7b9('0x6')](config[_0xb7b9('0x7')],{'host':_0xb7b9('0x8'),'port':0x18eb});var io=require(_0xb7b9('0x9'))(new Redis(config[_0xb7b9('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x140477){logger[_0xb7b9('0xa')](_0xb7b9('0xb'));this[_0xb7b9('0xc')]=_0x140477[_0xb7b9('0xc')];this['imapAccounts']={};this[_0xb7b9('0xd')]=new EmailSmtp();}EmailChannel[_0xb7b9('0xe')]['emit']=function(_0xe0d934){var _0x2f4c25=this[_0xb7b9('0xc')][_0xe0d934];var _0x47d633={'id':_0x2f4c25['id'],'name':_0x2f4c25[_0xb7b9('0xf')],'key':_0x2f4c25['key'],'active':_0x2f4c25[_0xb7b9('0x10')],'Imap':{'status':_0x2f4c25['Imap'][_0xb7b9('0x11')],'messageStatus':_0x2f4c25[_0xb7b9('0x12')]['messageStatus'],'total':_0x2f4c25[_0xb7b9('0x12')][_0xb7b9('0x13')]}};if(_[_0xb7b9('0x14')](md5Accounts[_0xe0d934])){md5Accounts[_0xe0d934]={};}var _0x4bf8f6=md5(JSON['stringify'](_0x47d633));if(md5Accounts[_0xe0d934][_0xb7b9('0x2')]!==_0x4bf8f6){md5Accounts[_0xe0d934][_0xb7b9('0x2')]=_0x4bf8f6;io[_0xb7b9('0x15')](_0xb7b9('0x16'),_0x47d633);}};EmailChannel[_0xb7b9('0xe')][_0xb7b9('0x17')]=function(_0x381037){for(var _0x2e5843 in _0x381037){if(_0x381037[_0xb7b9('0x18')](_0x2e5843)){if(_0x381037[_0x2e5843][_0xb7b9('0x12')]&&_0x381037[_0x2e5843][_0xb7b9('0x10')]){var _0x7668e9=_0x381037[_0x2e5843][_0xb7b9('0x12')];if(!this['imapAccounts'][_0xb7b9('0x18')](_0x7668e9['id'])){this['imapAccounts'][_0x7668e9['id']]=new EmailImap(_0x7668e9,_0x381037[_0x2e5843]['email']);this[_0xb7b9('0x19')][_0x7668e9['id']]['on'](_0xb7b9('0x1a'),this[_0xb7b9('0x1b')][_0xb7b9('0x1c')](this,_0x2e5843));this[_0xb7b9('0x19')][_0x7668e9['id']]['on']('email',this['handleImapEmail'][_0xb7b9('0x1c')](this,_0x2e5843));this['imapAccounts'][_0x7668e9['id']]['on'](_0xb7b9('0x1d'),this[_0xb7b9('0x1e')][_0xb7b9('0x1c')](this,_0x2e5843));this[_0xb7b9('0x19')][_0x7668e9['id']]['on'](_0xb7b9('0x1f'),this[_0xb7b9('0x20')][_0xb7b9('0x1c')](this,_0x2e5843));}}else{if(_[_0xb7b9('0x14')](this[_0xb7b9('0xc')][_0x2e5843][_0xb7b9('0x12')])){this['mailAccounts'][_0x2e5843][_0xb7b9('0x12')]={};}this[_0xb7b9('0xc')][_0x2e5843][_0xb7b9('0x12')][_0xb7b9('0x11')]=_0xb7b9('0x21');this['mailAccounts'][_0x2e5843][_0xb7b9('0x12')][_0xb7b9('0x22')]='';this[_0xb7b9('0x15')](_0x2e5843);}}}};EmailChannel[_0xb7b9('0xe')][_0xb7b9('0x1b')]=function(_0x51796d,_0x124e7d){if(this[_0xb7b9('0xc')][_0x51796d]){this[_0xb7b9('0xc')][_0x51796d][_0xb7b9('0x12')]['status']=_0xb7b9('0x23');this['mailAccounts'][_0x51796d][_0xb7b9('0x12')][_0xb7b9('0x22')]=_0x124e7d[_0xb7b9('0xf')];if(_0x124e7d[_0xb7b9('0x24')]){this[_0xb7b9('0xc')][_0x51796d]['Imap']['total']=_0x124e7d[_0xb7b9('0x24')][_0xb7b9('0x13')];}return this['emit'](_0x51796d);}};EmailChannel['prototype']['handleImapEmail']=function(_0x1aaebd,_0x3d2537){logger[_0xb7b9('0xa')](_0xb7b9('0x25'),_0x3d2537['firstName'],_0x3d2537['lastName'],_0x3d2537['from'],_0x1aaebd);if(this[_0xb7b9('0xc')][_0x1aaebd]){return mailAccount['notify'](_0x1aaebd,_0x3d2537)[_0xb7b9('0x26')](function(_0x1d9ac5){if(_0x1d9ac5){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x3b5d4a){logger[_0xb7b9('0x1f')](_0xb7b9('0x27'),JSON[_0xb7b9('0x28')](_0x3b5d4a));});}};EmailChannel[_0xb7b9('0xe')]['handleImapEnd']=function(_0x53bb0e){if(this[_0xb7b9('0xc')][_0x53bb0e]&&this['mailAccounts'][_0x53bb0e][_0xb7b9('0x12')]){if(this[_0xb7b9('0x19')][this[_0xb7b9('0xc')][_0x53bb0e][_0xb7b9('0x12')]['id']]){delete this[_0xb7b9('0x19')][this[_0xb7b9('0xc')][_0x53bb0e][_0xb7b9('0x12')]['id']];}this['mailAccounts'][_0x53bb0e][_0xb7b9('0x12')][_0xb7b9('0x29')]=moment();this[_0xb7b9('0x15')](_0x53bb0e);}};EmailChannel[_0xb7b9('0xe')]['handleImapError']=function(_0x5d7209,_0x18bd50){if(this[_0xb7b9('0xc')][_0x5d7209]){this[_0xb7b9('0xc')][_0x5d7209][_0xb7b9('0x12')][_0xb7b9('0x11')]=_0xb7b9('0x1f');this['mailAccounts'][_0x5d7209][_0xb7b9('0x12')][_0xb7b9('0x22')]=_0x18bd50;return this[_0xb7b9('0x15')](_0x5d7209);}};EmailChannel[_0xb7b9('0xe')][_0xb7b9('0x2a')]=function(_0x440f34,_0x3930a1){return this[_0xb7b9('0xd')][_0xb7b9('0x2b')](_0x440f34,_0x3930a1);};EmailChannel['prototype'][_0xb7b9('0x2c')]=function(_0x133cc2){var _0x51870b=this;if(this[_0xb7b9('0xc')][_0x133cc2['id']]){if(_[_0xb7b9('0x14')](this[_0xb7b9('0xc')][_0x133cc2['id']][_0xb7b9('0x2d')])){this[_0xb7b9('0xc')][_0x133cc2['id']]['Smtp']={};}this[_0xb7b9('0xc')][_0x133cc2['id']]['Smtp'][_0xb7b9('0x29')]=moment();return new BPromise(function(_0x366688,_0x282e13){return _0x51870b[_0xb7b9('0xd')][_0xb7b9('0x2e')](_0x133cc2)[_0xb7b9('0x26')](function(_0x1ce669){_0x51870b['mailAccounts'][_0x133cc2['id']][_0xb7b9('0x2d')][_0xb7b9('0x11')]=_0xb7b9('0x2f');_0x51870b['mailAccounts'][_0x133cc2['id']][_0xb7b9('0x2d')][_0xb7b9('0x22')]='';_0x51870b['emit'](_0x133cc2['id']);_0x366688(_0x1ce669);})[_0xb7b9('0x30')](function(_0x2ff291){_0x51870b['mailAccounts'][_0x133cc2['id']]['Smtp'][_0xb7b9('0x11')]=_0xb7b9('0x1f');_0x51870b[_0xb7b9('0xc')][_0x133cc2['id']][_0xb7b9('0x2d')][_0xb7b9('0x22')]=_0x2ff291;_0x51870b[_0xb7b9('0x15')](_0x133cc2['id']);_0x282e13(_0x2ff291);});});}return this['smtp'][_0xb7b9('0x2e')](_0x133cc2);};module['exports']=EmailChannel; \ No newline at end of file +var _0xa3cb=['sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','ioredis','../../../config/logger','email','redis','defaults','localhost','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','mailAccount:update','refresh','imapAccounts','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messageStatus','messages','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa3cb,0x14c));var _0xba3c=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xa3cb[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0xba3c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xba3c('0x1'));var config=require('../../../config/environment');var logger=require(_0xba3c('0x2'))(_0xba3c('0x3'));config[_0xba3c('0x4')]=_[_0xba3c('0x5')](config['redis'],{'host':_0xba3c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xba3c('0x4')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xba3c('0x7'));var mailAccount=require(_0xba3c('0x8'));var md5Accounts={};function EmailChannel(_0x961848){logger[_0xba3c('0x9')](_0xba3c('0xa'));this[_0xba3c('0xb')]=_0x961848[_0xba3c('0xb')];this['imapAccounts']={};this[_0xba3c('0xc')]=new EmailSmtp();}EmailChannel[_0xba3c('0xd')][_0xba3c('0xe')]=function(_0x1697fc){var _0x43bfac=this[_0xba3c('0xb')][_0x1697fc];var _0x471628={'id':_0x43bfac['id'],'name':_0x43bfac[_0xba3c('0xf')],'key':_0x43bfac[_0xba3c('0x10')],'active':_0x43bfac[_0xba3c('0x11')],'Imap':{'status':_0x43bfac[_0xba3c('0x12')][_0xba3c('0x13')],'messageStatus':_0x43bfac['Imap']['messageStatus'],'total':_0x43bfac['Imap'][_0xba3c('0x14')]}};if(_[_0xba3c('0x15')](md5Accounts[_0x1697fc])){md5Accounts[_0x1697fc]={};}var _0x5bd275=md5(JSON[_0xba3c('0x16')](_0x471628));if(md5Accounts[_0x1697fc]['md5']!==_0x5bd275){md5Accounts[_0x1697fc]['md5']=_0x5bd275;io['emit'](_0xba3c('0x17'),_0x471628);}};EmailChannel[_0xba3c('0xd')][_0xba3c('0x18')]=function(_0x3c97fc){for(var _0x120244 in _0x3c97fc){if(_0x3c97fc['hasOwnProperty'](_0x120244)){if(_0x3c97fc[_0x120244][_0xba3c('0x12')]&&_0x3c97fc[_0x120244][_0xba3c('0x11')]){var _0x436263=_0x3c97fc[_0x120244][_0xba3c('0x12')];if(!this[_0xba3c('0x19')][_0xba3c('0x1a')](_0x436263['id'])){this[_0xba3c('0x19')][_0x436263['id']]=new EmailImap(_0x436263,_0x3c97fc[_0x120244][_0xba3c('0x3')]);this[_0xba3c('0x19')][_0x436263['id']]['on'](_0xba3c('0x1b'),this[_0xba3c('0x1c')][_0xba3c('0x1d')](this,_0x120244));this[_0xba3c('0x19')][_0x436263['id']]['on'](_0xba3c('0x3'),this[_0xba3c('0x1e')][_0xba3c('0x1d')](this,_0x120244));this[_0xba3c('0x19')][_0x436263['id']]['on'](_0xba3c('0x1f'),this[_0xba3c('0x20')][_0xba3c('0x1d')](this,_0x120244));this[_0xba3c('0x19')][_0x436263['id']]['on'](_0xba3c('0x21'),this[_0xba3c('0x22')][_0xba3c('0x1d')](this,_0x120244));}}else{if(_['isNil'](this['mailAccounts'][_0x120244]['Imap'])){this['mailAccounts'][_0x120244]['Imap']={};}this[_0xba3c('0xb')][_0x120244][_0xba3c('0x12')]['status']=_0xba3c('0x23');this['mailAccounts'][_0x120244]['Imap']['messageStatus']='';this[_0xba3c('0xe')](_0x120244);}}}};EmailChannel[_0xba3c('0xd')][_0xba3c('0x1c')]=function(_0x2f0d49,_0xe9b9c5){if(this[_0xba3c('0xb')][_0x2f0d49]){this[_0xba3c('0xb')][_0x2f0d49][_0xba3c('0x12')][_0xba3c('0x13')]=_0xba3c('0x24');this[_0xba3c('0xb')][_0x2f0d49][_0xba3c('0x12')][_0xba3c('0x25')]=_0xe9b9c5[_0xba3c('0xf')];if(_0xe9b9c5[_0xba3c('0x26')]){this[_0xba3c('0xb')][_0x2f0d49][_0xba3c('0x12')]['total']=_0xe9b9c5[_0xba3c('0x26')][_0xba3c('0x14')];}return this[_0xba3c('0xe')](_0x2f0d49);}};EmailChannel[_0xba3c('0xd')]['handleImapEmail']=function(_0x3214d3,_0x156965){logger[_0xba3c('0x9')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x156965[_0xba3c('0x27')],_0x156965[_0xba3c('0x28')],_0x156965[_0xba3c('0x29')],_0x3214d3);if(this[_0xba3c('0xb')][_0x3214d3]){return mailAccount[_0xba3c('0x2a')](_0x3214d3,_0x156965)[_0xba3c('0x2b')](function(_0x3775f6){if(_0x3775f6){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0xba3c('0x2c')](function(_0x22707d){logger['error'](_0xba3c('0x2d'),JSON[_0xba3c('0x16')](_0x22707d));});}};EmailChannel[_0xba3c('0xd')][_0xba3c('0x20')]=function(_0x3b0b3a){if(this['mailAccounts'][_0x3b0b3a]&&this[_0xba3c('0xb')][_0x3b0b3a][_0xba3c('0x12')]){if(this[_0xba3c('0x19')][this[_0xba3c('0xb')][_0x3b0b3a][_0xba3c('0x12')]['id']]){delete this[_0xba3c('0x19')][this[_0xba3c('0xb')][_0x3b0b3a][_0xba3c('0x12')]['id']];}this['mailAccounts'][_0x3b0b3a][_0xba3c('0x12')]['lastSync']=moment();this[_0xba3c('0xe')](_0x3b0b3a);}};EmailChannel['prototype'][_0xba3c('0x22')]=function(_0x4ed439,_0x344371){if(this[_0xba3c('0xb')][_0x4ed439]){this[_0xba3c('0xb')][_0x4ed439][_0xba3c('0x12')][_0xba3c('0x13')]=_0xba3c('0x21');this[_0xba3c('0xb')][_0x4ed439][_0xba3c('0x12')]['messageStatus']=_0x344371;return this[_0xba3c('0xe')](_0x4ed439);}};EmailChannel[_0xba3c('0xd')][_0xba3c('0x2e')]=function(_0x95b88f,_0x165a94){return this[_0xba3c('0xc')][_0xba3c('0x2f')](_0x95b88f,_0x165a94);};EmailChannel[_0xba3c('0xd')][_0xba3c('0x30')]=function(_0x44e242){var _0x27e32a=this;if(this[_0xba3c('0xb')][_0x44e242['id']]){if(_[_0xba3c('0x15')](this[_0xba3c('0xb')][_0x44e242['id']][_0xba3c('0x31')])){this[_0xba3c('0xb')][_0x44e242['id']][_0xba3c('0x31')]={};}this[_0xba3c('0xb')][_0x44e242['id']][_0xba3c('0x31')][_0xba3c('0x32')]=moment();return new BPromise(function(_0x56b4ee,_0x4a2de2){return _0x27e32a[_0xba3c('0xc')][_0xba3c('0x33')](_0x44e242)['then'](function(_0x1a8332){_0x27e32a[_0xba3c('0xb')][_0x44e242['id']][_0xba3c('0x31')][_0xba3c('0x13')]=_0xba3c('0x34');_0x27e32a[_0xba3c('0xb')][_0x44e242['id']][_0xba3c('0x31')][_0xba3c('0x25')]='';_0x27e32a['emit'](_0x44e242['id']);_0x56b4ee(_0x1a8332);})[_0xba3c('0x2c')](function(_0x34cd78){_0x27e32a[_0xba3c('0xb')][_0x44e242['id']][_0xba3c('0x31')][_0xba3c('0x13')]=_0xba3c('0x21');_0x27e32a[_0xba3c('0xb')][_0x44e242['id']]['Smtp']['messageStatus']=_0x34cd78;_0x27e32a['emit'](_0x44e242['id']);_0x4a2de2(_0x34cd78);});});}return this[_0xba3c('0xc')][_0xba3c('0x33')](_0x44e242);};module[_0xba3c('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4da56ed..a551c1a 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 _0x2a58=['randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','imap','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','openBox','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','account','emit','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','lodash'];(function(_0x21c926,_0x563c30){var _0x2a46ed=function(_0x24aff8){while(--_0x24aff8){_0x21c926['push'](_0x21c926['shift']());}};_0x2a46ed(++_0x563c30);}(_0x2a58,0x102));var _0x82a5=function(_0x4c4959,_0x342e6a){_0x4c4959=_0x4c4959-0x0;var _0x5a6582=_0x2a58[_0x4c4959];return _0x5a6582;};'use strict';var fs=require('fs');var path=require(_0x82a5('0x0'));var util=require('util');var Imap=require('imap');var _=require(_0x82a5('0x1'));var rs=require(_0x82a5('0x2'));var simpleParser=require(_0x82a5('0x3'))[_0x82a5('0x4')];var Iconv=require('iconv')[_0x82a5('0x5')];var EventEmitter=require(_0x82a5('0x6'))[_0x82a5('0x7')];var utils=require(_0x82a5('0x8'));var logger=require(_0x82a5('0x9'))(_0x82a5('0xa'));function EmailImap(_0x4f0031,_0x2a8867){this[_0x82a5('0xb')]=_0x82a5('0xc');this['account']=this['getAccount'](_0x4f0031,_0x2a8867);this[_0x82a5('0xd')]=new Imap(this['account']);this[_0x82a5('0xd')]['once'](_0x82a5('0xe'),this[_0x82a5('0xf')][_0x82a5('0x10')](this));this[_0x82a5('0xd')][_0x82a5('0x11')](_0x82a5('0x12'),this[_0x82a5('0x13')][_0x82a5('0x10')](this));this['imap']['on'](_0x82a5('0x14'),this[_0x82a5('0x15')][_0x82a5('0x10')](this));this['imap'][_0x82a5('0x16')]();}util[_0x82a5('0x17')](EmailImap,EventEmitter);EmailImap[_0x82a5('0x18')][_0x82a5('0x19')]=function(_0x4ba5b0,_0x35333b){var _0x4e1343={'connTimeout':_0x4ba5b0[_0x82a5('0x1a')]?_0x4ba5b0[_0x82a5('0x1a')]*0x3e8:0x2710,'authTimeout':_0x4ba5b0[_0x82a5('0x1b')]?_0x4ba5b0['authTimeout']*0x3e8:0x1388};if(_[_0x82a5('0x1c')](_0x4ba5b0['service'])){if(_0x4ba5b0[_0x82a5('0x1d')]){_0x4e1343[_0x82a5('0x1e')]=_0x4ba5b0[_0x82a5('0x1e')];_0x4e1343[_0x82a5('0x1f')]=_0x4ba5b0[_0x82a5('0x1f')];}_0x4e1343[_0x82a5('0x20')]=_0x4ba5b0[_0x82a5('0x20')];_0x4e1343[_0x82a5('0x21')]=_0x4ba5b0['port']||0x3e1;if(_0x4ba5b0[_0x82a5('0x22')]){_0x4e1343[_0x82a5('0x22')]=!![];}else{_0x4e1343[_0x82a5('0x22')]=![];_0x4e1343[_0x82a5('0x23')]=_0x82a5('0x24');}}else{_0x4e1343[_0x82a5('0x1e')]=_0x4ba5b0['user'];_0x4e1343[_0x82a5('0x1f')]=_0x4ba5b0[_0x82a5('0x1f')];_0x4e1343[_0x82a5('0x20')]=utils[_0x82a5('0x25')](_0x4ba5b0[_0x82a5('0x26')]);_0x4e1343['port']=0x3e1;_0x4e1343[_0x82a5('0x22')]=!![];}_0x4e1343[_0x82a5('0xa')]=_0x35333b||_0x4ba5b0[_0x82a5('0x1e')]||_0x82a5('0x27');return _0x4e1343;};EmailImap['prototype'][_0x82a5('0xf')]=function(){this['imap'][_0x82a5('0x28')](this[_0x82a5('0xb')],![],this['handleOpenBox'][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')]['handleOpenBox']=function(_0x4d3c2b,_0x466929){if(_0x4d3c2b){this[_0x82a5('0x15')](_0x4d3c2b,!![]);}else{this['emit']('box',_0x466929);this[_0x82a5('0x29')]();}};EmailImap[_0x82a5('0x18')][_0x82a5('0x2a')]=function(_0x422e58){if(_0x422e58){this[_0x82a5('0x15')](_0x422e58,!![]);}else{this[_0x82a5('0xd')][_0x82a5('0x12')]();}};EmailImap[_0x82a5('0x18')][_0x82a5('0x29')]=function(){this['imap']['search']([_0x82a5('0x2b')],this[_0x82a5('0x2c')][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x2c')]=function(_0xf2f980,_0x3e6470){if(_0xf2f980){this[_0x82a5('0x15')](_0xf2f980,!![]);}else{if(_0x3e6470[_0x82a5('0x2d')]){try{var _0x479bfd=this[_0x82a5('0xd')][_0x82a5('0x2e')](_0x3e6470,{'bodies':'','markSeen':!![]});_0x479bfd['on'](_0x82a5('0x2f'),this['handleFetchMessage'][_0x82a5('0x10')](this));_0x479bfd[_0x82a5('0x11')]('error',this[_0x82a5('0x30')][_0x82a5('0x10')](this));_0x479bfd[_0x82a5('0x11')](_0x82a5('0x12'),this['handleFetchEnd']['bind'](this));}catch(_0x2af823){logger['error'](_0x2af823);}}else{this[_0x82a5('0xd')][_0x82a5('0x31')](!![],this[_0x82a5('0x2a')][_0x82a5('0x10')](this));}}};EmailImap[_0x82a5('0x18')][_0x82a5('0x32')]=function(_0x1a5f81,_0x300288){_0x1a5f81['on'](_0x82a5('0x33'),this[_0x82a5('0x34')][_0x82a5('0x10')](this));_0x1a5f81['once'](_0x82a5('0x35'),this[_0x82a5('0x36')][_0x82a5('0x10')](this));_0x1a5f81[_0x82a5('0x11')](_0x82a5('0x12'),this[_0x82a5('0x37')]['bind'](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x34')]=function(_0x49f099,_0xb2a40a){simpleParser(_0x49f099,{'Iconv':Iconv},this[_0x82a5('0x38')][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x36')]=function(_0x2f9804){};EmailImap[_0x82a5('0x18')][_0x82a5('0x37')]=function(){};EmailImap[_0x82a5('0x18')][_0x82a5('0x38')]=function(_0x2f6af9,_0x3328ac){if(_0x2f6af9){logger[_0x82a5('0x14')](_0x2f6af9);}else{var _0x4b9662=this;utils['parser'](this[_0x82a5('0x39')],_0x3328ac,function(_0x23823a){_0x4b9662[_0x82a5('0x3a')](_0x82a5('0xa'),_0x23823a);});}};EmailImap[_0x82a5('0x18')][_0x82a5('0x3b')]=function(){this['imap'][_0x82a5('0x31')](!![],this[_0x82a5('0x2a')][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x30')]=function(_0x26fef5){this['handleError'](_0x26fef5);this['imap'][_0x82a5('0x31')](!![],this['handleCloseBox'][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')]['handleEnd']=function(){this[_0x82a5('0x3a')](_0x82a5('0x12'));};EmailImap['prototype'][_0x82a5('0x15')]=function(_0x216b2c,_0x58c7f5){logger[_0x82a5('0x14')](_0x82a5('0x15'),this[_0x82a5('0x39')][_0x82a5('0xa')],JSON[_0x82a5('0x3c')](_0x216b2c));var _0x2a22d0='';if(_0x216b2c){if(_0x216b2c[_0x82a5('0x3d')]){_0x2a22d0=_0x216b2c[_0x82a5('0x3d')];}else{for(var _0x344587 in _0x216b2c){if(_0x216b2c[_0x82a5('0x3e')](_0x344587)){_0x2a22d0+=_[_0x82a5('0x3f')](_0x344587)+':\x20'+_0x216b2c[_0x344587]+'\x0a';}}}}if(_0x58c7f5){this[_0x82a5('0xd')]['end']();}else{this['emit']('error',_0x2a22d0);this['emit'](_0x82a5('0x12'));}};module[_0x82a5('0x40')]=EmailImap; \ No newline at end of file +var _0xee69=['handleCloseBox','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','mailbox','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox'];(function(_0x41518f,_0x39f7e7){var _0x2d4051=function(_0x5f5b00){while(--_0x5f5b00){_0x41518f['push'](_0x41518f['shift']());}};_0x2d4051(++_0x39f7e7);}(_0xee69,0x107));var _0x9ee6=function(_0x5b69f8,_0x374690){_0x5b69f8=_0x5b69f8-0x0;var _0x28f138=_0xee69[_0x5b69f8];return _0x28f138;};'use strict';var fs=require('fs');var path=require(_0x9ee6('0x0'));var util=require(_0x9ee6('0x1'));var Imap=require(_0x9ee6('0x2'));var _=require(_0x9ee6('0x3'));var rs=require('randomstring');var simpleParser=require(_0x9ee6('0x4'))[_0x9ee6('0x5')];var Iconv=require(_0x9ee6('0x6'))[_0x9ee6('0x7')];var EventEmitter=require(_0x9ee6('0x8'))[_0x9ee6('0x9')];var utils=require('./utils');var logger=require(_0x9ee6('0xa'))(_0x9ee6('0xb'));function EmailImap(_0x4c288e,_0x18a3cd){this['mailbox']='INBOX';this[_0x9ee6('0xc')]=this[_0x9ee6('0xd')](_0x4c288e,_0x18a3cd);this[_0x9ee6('0x2')]=new Imap(this[_0x9ee6('0xc')]);this['imap'][_0x9ee6('0xe')](_0x9ee6('0xf'),this[_0x9ee6('0x10')][_0x9ee6('0x11')](this));this[_0x9ee6('0x2')][_0x9ee6('0xe')](_0x9ee6('0x12'),this[_0x9ee6('0x13')][_0x9ee6('0x11')](this));this['imap']['on'](_0x9ee6('0x14'),this[_0x9ee6('0x15')]['bind'](this));this[_0x9ee6('0x2')][_0x9ee6('0x16')]();}util[_0x9ee6('0x17')](EmailImap,EventEmitter);EmailImap[_0x9ee6('0x18')][_0x9ee6('0xd')]=function(_0x1537c2,_0x37aaa3){var _0x3b2cdd={'connTimeout':_0x1537c2[_0x9ee6('0x19')]?_0x1537c2[_0x9ee6('0x19')]*0x3e8:0x2710,'authTimeout':_0x1537c2[_0x9ee6('0x1a')]?_0x1537c2[_0x9ee6('0x1a')]*0x3e8:0x1388};if(_[_0x9ee6('0x1b')](_0x1537c2[_0x9ee6('0x1c')])){if(_0x1537c2[_0x9ee6('0x1d')]){_0x3b2cdd[_0x9ee6('0x1e')]=_0x1537c2[_0x9ee6('0x1e')];_0x3b2cdd[_0x9ee6('0x1f')]=_0x1537c2[_0x9ee6('0x1f')];}_0x3b2cdd['host']=_0x1537c2[_0x9ee6('0x20')];_0x3b2cdd[_0x9ee6('0x21')]=_0x1537c2[_0x9ee6('0x21')]||0x3e1;if(_0x1537c2[_0x9ee6('0x22')]){_0x3b2cdd[_0x9ee6('0x22')]=!![];}else{_0x3b2cdd['tls']=![];_0x3b2cdd[_0x9ee6('0x23')]=_0x9ee6('0x24');}}else{_0x3b2cdd[_0x9ee6('0x1e')]=_0x1537c2[_0x9ee6('0x1e')];_0x3b2cdd[_0x9ee6('0x1f')]=_0x1537c2[_0x9ee6('0x1f')];_0x3b2cdd[_0x9ee6('0x20')]=utils[_0x9ee6('0x25')](_0x1537c2[_0x9ee6('0x1c')]);_0x3b2cdd[_0x9ee6('0x21')]=0x3e1;_0x3b2cdd['tls']=!![];}_0x3b2cdd[_0x9ee6('0xb')]=_0x37aaa3||_0x1537c2[_0x9ee6('0x1e')]||'anonymous@xcally.com';return _0x3b2cdd;};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x10')]=function(){this[_0x9ee6('0x2')]['openBox'](this[_0x9ee6('0x26')],![],this[_0x9ee6('0x27')][_0x9ee6('0x11')](this));};EmailImap[_0x9ee6('0x18')]['handleOpenBox']=function(_0x1ef854,_0x52f6c1){if(_0x1ef854){this[_0x9ee6('0x15')](_0x1ef854,!![]);}else{this[_0x9ee6('0x28')]('box',_0x52f6c1);this[_0x9ee6('0x29')]();}};EmailImap[_0x9ee6('0x18')]['handleCloseBox']=function(_0x55027a){if(_0x55027a){this[_0x9ee6('0x15')](_0x55027a,!![]);}else{this[_0x9ee6('0x2')][_0x9ee6('0x12')]();}};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x29')]=function(){this['imap'][_0x9ee6('0x2a')]([_0x9ee6('0x2b')],this['handleReadUnseen'][_0x9ee6('0x11')](this));};EmailImap['prototype'][_0x9ee6('0x2c')]=function(_0x128a2a,_0x46dd73){if(_0x128a2a){this['handleError'](_0x128a2a,!![]);}else{if(_0x46dd73[_0x9ee6('0x2d')]){try{var _0x3efa15=this[_0x9ee6('0x2')][_0x9ee6('0x2e')](_0x46dd73,{'bodies':'','markSeen':!![]});_0x3efa15['on'](_0x9ee6('0x2f'),this[_0x9ee6('0x30')][_0x9ee6('0x11')](this));_0x3efa15[_0x9ee6('0xe')](_0x9ee6('0x14'),this[_0x9ee6('0x31')][_0x9ee6('0x11')](this));_0x3efa15[_0x9ee6('0xe')](_0x9ee6('0x12'),this[_0x9ee6('0x32')][_0x9ee6('0x11')](this));}catch(_0xf60134){logger['error'](_0xf60134);}}else{this[_0x9ee6('0x2')][_0x9ee6('0x33')](!![],this[_0x9ee6('0x34')]['bind'](this));}}};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x30')]=function(_0x23bc98,_0x284b75){_0x23bc98['on']('body',this['handleMessageBody'][_0x9ee6('0x11')](this));_0x23bc98[_0x9ee6('0xe')](_0x9ee6('0x35'),this[_0x9ee6('0x36')][_0x9ee6('0x11')](this));_0x23bc98[_0x9ee6('0xe')](_0x9ee6('0x12'),this['handleMessageEnd'][_0x9ee6('0x11')](this));};EmailImap[_0x9ee6('0x18')]['handleMessageBody']=function(_0x2beed6,_0x20d8a4){simpleParser(_0x2beed6,{'Iconv':Iconv},this[_0x9ee6('0x37')][_0x9ee6('0x11')](this));};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x36')]=function(_0x1781c2){};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x38')]=function(){};EmailImap['prototype'][_0x9ee6('0x37')]=function(_0x1d06ab,_0x447e65){if(_0x1d06ab){logger[_0x9ee6('0x14')](_0x1d06ab);}else{var _0x31c952=this;utils[_0x9ee6('0x39')](this[_0x9ee6('0xc')],_0x447e65,function(_0x4d2885){_0x31c952[_0x9ee6('0x28')](_0x9ee6('0xb'),_0x4d2885);});}};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x32')]=function(){this[_0x9ee6('0x2')][_0x9ee6('0x33')](!![],this['handleCloseBox'][_0x9ee6('0x11')](this));};EmailImap['prototype'][_0x9ee6('0x31')]=function(_0x70d740){this[_0x9ee6('0x15')](_0x70d740);this[_0x9ee6('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x9ee6('0x11')](this));};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x13')]=function(){this['emit'](_0x9ee6('0x12'));};EmailImap[_0x9ee6('0x18')][_0x9ee6('0x15')]=function(_0xe79fc5,_0x2d6d9f){logger['error'](_0x9ee6('0x15'),this[_0x9ee6('0xc')][_0x9ee6('0xb')],JSON[_0x9ee6('0x3a')](_0xe79fc5));var _0x3368f8='';if(_0xe79fc5){if(_0xe79fc5[_0x9ee6('0x3b')]){_0x3368f8=_0xe79fc5[_0x9ee6('0x3b')];}else{for(var _0x15cdc9 in _0xe79fc5){if(_0xe79fc5[_0x9ee6('0x3c')](_0x15cdc9)){_0x3368f8+=_[_0x9ee6('0x3d')](_0x15cdc9)+':\x20'+_0xe79fc5[_0x15cdc9]+'\x0a';}}}}if(_0x2d6d9f){this[_0x9ee6('0x2')][_0x9ee6('0x12')]();}else{this[_0x9ee6('0x28')](_0x9ee6('0x14'),_0x3368f8);this['emit']('end');}};module[_0x9ee6('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 98fb8dd..4be75c3 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 _0x10a2=['verify','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','send','createTransport','use','sendMail','toString','prototype'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x10a2,0x137));var _0x210a=function(_0x128346,_0x2f3d43){_0x128346=_0x128346-0x0;var _0xd9e2e3=_0x10a2[_0x128346];return _0xd9e2e3;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x210a('0x0'));var inlineBase64=require(_0x210a('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x210a('0x2')]=function(_0x5d3cc9,_0x32259a){return new BPromise(function(_0x21407e,_0x325350){var _0xed5264=nodemailer[_0x210a('0x3')](_0x5d3cc9);_0xed5264[_0x210a('0x4')]('compile',inlineBase64());_0xed5264[_0x210a('0x5')](_0x32259a,function(_0x2ffbe8,_0x210a25){if(_0x2ffbe8){_0x325350(_0x2ffbe8[_0x210a('0x6')]());}else{_0x21407e(_0x210a25);}});});};EmailSmtp[_0x210a('0x7')][_0x210a('0x8')]=function(_0xf869f5){return new BPromise(function(_0x35eab5,_0x1b81ad){var _0x6f1400=nodemailer['createTransport'](_0xf869f5);_0x6f1400[_0x210a('0x8')](function(_0x218d07,_0x1e42eb){if(_0x218d07){_0x1b81ad(_0x218d07[_0x210a('0x6')]());}else{if(_0x1e42eb){_0x35eab5(_0x1e42eb);}else{_0x1b81ad(_0x210a('0x9'));}}});});};module[_0x210a('0xa')]=EmailSmtp; \ No newline at end of file +var _0x5ddd=['nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail','toString','prototype','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x567994,_0x1c3f75){var _0x4016e4=function(_0x2b5107){while(--_0x2b5107){_0x567994['push'](_0x567994['shift']());}};_0x4016e4(++_0x1c3f75);}(_0x5ddd,0x191));var _0xd5dd=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0x5ddd[_0x426076];return _0x1e9565;};'use strict';var nodemailer=require(_0xd5dd('0x0'));var BPromise=require(_0xd5dd('0x1'));var inlineBase64=require(_0xd5dd('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0xd5dd('0x3')]=function(_0x52a580,_0x1f40e6){return new BPromise(function(_0x22d20e,_0x2a08e3){var _0x3d5032=nodemailer[_0xd5dd('0x4')](_0x52a580);_0x3d5032[_0xd5dd('0x5')](_0xd5dd('0x6'),inlineBase64());_0x3d5032[_0xd5dd('0x7')](_0x1f40e6,function(_0x18f05f,_0x42b030){if(_0x18f05f){_0x2a08e3(_0x18f05f[_0xd5dd('0x8')]());}else{_0x22d20e(_0x42b030);}});});};EmailSmtp[_0xd5dd('0x9')][_0xd5dd('0xa')]=function(_0x4bf8e3){return new BPromise(function(_0x3ca738,_0x34c830){var _0x446c2b=nodemailer[_0xd5dd('0x4')](_0x4bf8e3);_0x446c2b[_0xd5dd('0xa')](function(_0x164a1d,_0x1a4cc8){if(_0x164a1d){_0x34c830(_0x164a1d[_0xd5dd('0x8')]());}else{if(_0x1a4cc8){_0x3ca738(_0x1a4cc8);}else{_0x34c830(_0xd5dd('0xb'));}}});});};module[_0xd5dd('0xc')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 252b835..d0df0b8 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 _0xda0f=['format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','push','Title','Data','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','127.0.0.1','lodash','moment','path','node-tnef','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','split','slice','join','Anonymous','length','pop','isEmpty','html','body','textAsHtml','replace','0x1?_0x17591d[_0xfda0('0x11')]():'';}return'';}function getMails(_0x24632d,_0x94e8f5){var _0x4021cc='';for(var _0x3b8d69=0x0;_0x3b8d69<_0x94e8f5[_0xfda0('0x5')]['length'];_0x3b8d69+=0x1){if(_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]!==_0x24632d){if(!_[_0xfda0('0x12')](_0x4021cc)){_0x4021cc+=',';}_0x4021cc+=_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0xb')]||_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]||'';_0x4021cc+='\x20<';_0x4021cc+=_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]?_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]:_0xfda0('0x7')+random[_0xfda0('0x8')](0x6)+_0xfda0('0x9');_0x4021cc+='>';}}return _0x4021cc;}function parseEmail(_0x1d438f,_0x39ef23,_0x58f731){if(_0x39ef23[_0xfda0('0x13')]){var _0x5338ac=/)<[^<]*)*<\/script>/gi;while(_0x5338ac['test'](_0x39ef23['html'])){_0x39ef23[_0xfda0('0x13')]=_0x39ef23['html']['replace'](_0x5338ac,'');}_0x58f731['body']=_0x39ef23[_0xfda0('0x13')];}else{_0x58f731[_0xfda0('0x14')]=_0x39ef23[_0xfda0('0x15')];}if(_0x58f731['body']){_0x58f731[_0xfda0('0x14')]=_0x58f731[_0xfda0('0x14')][_0xfda0('0x16')](/Empty\x20message

','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous'];(function(_0x39b83e,_0x3c3a67){var _0x143464=function(_0x40aaa1){while(--_0x40aaa1){_0x39b83e['push'](_0x39b83e['shift']());}};_0x143464(++_0x3c3a67);}(_0xec2f,0xb0));var _0xfec2=function(_0x40c408,_0x1c501a){_0x40c408=_0x40c408-0x0;var _0x41eec4=_0xec2f[_0x40c408];return _0x41eec4;};'use strict';var _=require(_0xfec2('0x0'));var moment=require(_0xfec2('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0xfec2('0x2'));var logger=require(_0xfec2('0x3'))(_0xfec2('0x4'));var config=require(_0xfec2('0x5'));function getAddress(_0x5ad735){var _0x25933e=_[_0xfec2('0x6')](_0x5ad735[_0xfec2('0x7')]);return _0x25933e&&_0x25933e['address']?_0x25933e[_0xfec2('0x8')]:_0xfec2('0x9')+random[_0xfec2('0xa')](0x6)+_0xfec2('0xb');}function getFirstName(_0x3e0249){var _0x2df788=_[_0xfec2('0x6')](_0x3e0249[_0xfec2('0x7')]);if(_0x2df788&&_0x2df788[_0xfec2('0xc')]){var _0x4a5ed1=_0x2df788['name']['split'](/\s+/);return _0x4a5ed1[_0xfec2('0xd')]?_0x4a5ed1[_0xfec2('0xe')](0x0,-0x1)[_0xfec2('0xf')]('\x20'):_0x2df788['name'];}return _0xfec2('0x10');}function getLastName(_0x3fc240){var _0x19b62b=_['head'](_0x3fc240[_0xfec2('0x7')]);if(_0x19b62b&&_0x19b62b[_0xfec2('0xc')]){var _0x1b2c82=_0x19b62b[_0xfec2('0xc')]['split'](/\s+/);return _0x1b2c82['length']>0x1?_0x1b2c82[_0xfec2('0x11')]():'';}return'';}function getMails(_0x10f00a,_0x3c40ac){var _0xdaeae2='';for(var _0x4977e3=0x0;_0x4977e3<_0x3c40ac['value'][_0xfec2('0xd')];_0x4977e3+=0x1){if(_0x3c40ac['value'][_0x4977e3][_0xfec2('0x8')]!==_0x10f00a){if(!_['isEmpty'](_0xdaeae2)){_0xdaeae2+=',';}_0xdaeae2+=_0x3c40ac[_0xfec2('0x7')][_0x4977e3][_0xfec2('0xc')]||_0x3c40ac[_0xfec2('0x7')][_0x4977e3][_0xfec2('0x8')]||'';_0xdaeae2+='\x20<';_0xdaeae2+=_0x3c40ac['value'][_0x4977e3]['address']?_0x3c40ac['value'][_0x4977e3][_0xfec2('0x8')]:_0xfec2('0x9')+random[_0xfec2('0xa')](0x6)+'@xcally.com';_0xdaeae2+='>';}}return _0xdaeae2;}function parseEmail(_0x486c72,_0x247abc,_0x245591){if(_0x247abc[_0xfec2('0x12')]){var _0x5689b5=/)<[^<]*)*<\/script>/gi;while(_0x5689b5['test'](_0x247abc[_0xfec2('0x12')])){_0x247abc[_0xfec2('0x12')]=_0x247abc[_0xfec2('0x12')][_0xfec2('0x13')](_0x5689b5,'');}_0x245591[_0xfec2('0x14')]=_0x247abc[_0xfec2('0x12')];}else{_0x245591[_0xfec2('0x14')]=_0x247abc['textAsHtml'];}if(_0x245591[_0xfec2('0x14')]){_0x245591['body']=_0x245591[_0xfec2('0x14')][_0xfec2('0x13')](/Empty\x20message

';if(_0x1695bc[_0xfec2('0x34')]){for(var _0x4cec2a=0x0;_0x4cec2a<_0x1695bc[_0xfec2('0x34')][_0xfec2('0xd')];_0x4cec2a++){var _0x36b474=_0x1695bc['Attachments'][_0x4cec2a];_0x1f7f8f['message'][_0xfec2('0x1b')][_0xfec2('0x26')]({'filename':_0x36b474[_0xfec2('0x35')],'content':new Buffer(_0x36b474[_0xfec2('0x36')])});}}}_0xba3a4f(parseEmail(_0xb44247,_0x3d8606,_0x1f7f8f));});}else{_0x3d8606[_0xfec2('0x12')]=_0xfec2('0x37');_0xba3a4f(parseEmail(_0xb44247,_0x3d8606,_0x1f7f8f));}}else{_0xba3a4f(parseEmail(_0xb44247,_0x3d8606,_0x1f7f8f));}};exports['getHost']=function(_0x3ed51d){switch(_0x3ed51d){case _0xfec2('0x38'):return _0xfec2('0x39');case'yahoo':return'imap.mail.yahoo.com';case _0xfec2('0x3a'):return _0xfec2('0x3b');case _0xfec2('0x3c'):return _0xfec2('0x3d');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b05df87..55f6c21 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa92=['SERV','active','Imap','Smtp','exports','name','Service','key'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0xfa92,0xcd));var _0x2fa9=function(_0x3d5905,_0x37e78a){_0x3d5905=_0x3d5905-0x0;var _0x211362=_0xfa92[_0x3d5905];return _0x211362;};'use strict';var _=require('lodash');function MailAccount(_0x5af03d){this['id']=_0x5af03d['id']||0x0;this[_0x2fa9('0x0')]=_0x5af03d[_0x2fa9('0x0')]||_0x2fa9('0x1');this[_0x2fa9('0x2')]=_0x5af03d['key']||_0x2fa9('0x3');this[_0x2fa9('0x4')]=_0x5af03d[_0x2fa9('0x4')]||![];this[_0x2fa9('0x5')]=_0x5af03d['Imap']||[];this[_0x2fa9('0x6')]=_0x5af03d[_0x2fa9('0x6')]||[];}module[_0x2fa9('0x7')]=MailAccount; \ No newline at end of file +var _0xf6bd=['name','Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x55a0cf,_0x5b2007){var _0x1369b2=function(_0x7b00a5){while(--_0x7b00a5){_0x55a0cf['push'](_0x55a0cf['shift']());}};_0x1369b2(++_0x5b2007);}(_0xf6bd,0x6f));var _0xdf6b=function(_0x187ba9,_0x5ee96c){_0x187ba9=_0x187ba9-0x0;var _0x4279ac=_0xf6bd[_0x187ba9];return _0x4279ac;};'use strict';var _=require(_0xdf6b('0x0'));function MailAccount(_0x32c742){this['id']=_0x32c742['id']||0x0;this[_0xdf6b('0x1')]=_0x32c742[_0xdf6b('0x1')]||_0xdf6b('0x2');this[_0xdf6b('0x3')]=_0x32c742[_0xdf6b('0x3')]||_0xdf6b('0x4');this[_0xdf6b('0x5')]=_0x32c742[_0xdf6b('0x5')]||![];this[_0xdf6b('0x6')]=_0x32c742[_0xdf6b('0x6')]||[];this[_0xdf6b('0x7')]=_0x32c742[_0xdf6b('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c212f3e..a409d17 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe93e=['isUndefined','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xe93e,0x64));var _0xee93=function(_0x4e7cc3,_0x47ff4){_0x4e7cc3=_0x4e7cc3-0x0;var _0x42e46d=_0xe93e[_0x4e7cc3];return _0x42e46d;};'use strict';var _=require('lodash');var MailAccount=require(_0xee93('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x198169,_0xe4bba6,_0x274b4e){var _0x57b9e9=_[_0xee93('0x1')](_0x198169,function(_0x28545c,_0x172236){return _0x28545c[_0x274b4e];});for(var _0x45ef81 in _0xe4bba6){if(_0xe4bba6[_0xee93('0x2')](_0x45ef81)){if(!_0x57b9e9[_0x45ef81]){delete _0xe4bba6[_0x45ef81];}}}}Realtime[_0xee93('0x3')][_0xee93('0x4')]=function(_0x5e6aeb,_0x39ca5e){for(var _0x5e46d3 in _0x39ca5e){if(_0x5e6aeb[_0xee93('0x2')](_0x5e46d3)){_0x5e6aeb[_0x5e46d3]=_0x39ca5e[_0x5e46d3];}}};Realtime[_0xee93('0x3')][_0xee93('0x5')]=function(){var _0x58aee3=this;return function(_0x14783e){if(_0x14783e){freeIsNotKey(_0x14783e,_0x58aee3[_0xee93('0x6')],'id');for(var _0x599af0=0x0,_0x1557e7={},_0x536cc0={};_0x599af0<_0x14783e[_0xee93('0x7')];_0x599af0+=0x1){_0x1557e7=_0x14783e[_0x599af0];if(_[_0xee93('0x8')](_0x58aee3[_0xee93('0x6')][_0x1557e7['id']])){_0x58aee3[_0xee93('0x6')][_0x1557e7['id']]=new MailAccount(_0x1557e7);}else{_['merge'](_0x58aee3[_0xee93('0x6')][_0x1557e7['id']],_0x1557e7);}}}return _0x58aee3[_0xee93('0x6')];};};module['exports']=Realtime; \ No newline at end of file +var _0x4eaf=['hasOwnProperty','initMailAccounts','merge','exports','lodash','../model/mailAccount','mailAccounts','prototype','mergeFromDatabase'];(function(_0x102c90,_0x40f09b){var _0x72486f=function(_0x7b34a4){while(--_0x7b34a4){_0x102c90['push'](_0x102c90['shift']());}};_0x72486f(++_0x40f09b);}(_0x4eaf,0x199));var _0xf4ea=function(_0x440d35,_0x46fe8c){_0x440d35=_0x440d35-0x0;var _0x9289e4=_0x4eaf[_0x440d35];return _0x9289e4;};'use strict';var _=require(_0xf4ea('0x0'));var MailAccount=require(_0xf4ea('0x1'));var Realtime=function(){this[_0xf4ea('0x2')]={};};function freeIsNotKey(_0x3bc6ae,_0x560a28,_0x19536b){var _0x4977de=_['mapKeys'](_0x3bc6ae,function(_0x581c6e,_0xbdb787){return _0x581c6e[_0x19536b];});for(var _0x72a12e in _0x560a28){if(_0x560a28['hasOwnProperty'](_0x72a12e)){if(!_0x4977de[_0x72a12e]){delete _0x560a28[_0x72a12e];}}}}Realtime[_0xf4ea('0x3')][_0xf4ea('0x4')]=function(_0x66bcfe,_0x168e4b){for(var _0x5744c9 in _0x168e4b){if(_0x66bcfe[_0xf4ea('0x5')](_0x5744c9)){_0x66bcfe[_0x5744c9]=_0x168e4b[_0x5744c9];}}};Realtime['prototype'][_0xf4ea('0x6')]=function(){var _0x221c03=this;return function(_0x482d78){if(_0x482d78){freeIsNotKey(_0x482d78,_0x221c03['mailAccounts'],'id');for(var _0x47991d=0x0,_0x7c237f={},_0x237b9b={};_0x47991d<_0x482d78['length'];_0x47991d+=0x1){_0x7c237f=_0x482d78[_0x47991d];if(_['isUndefined'](_0x221c03[_0xf4ea('0x2')][_0x7c237f['id']])){_0x221c03[_0xf4ea('0x2')][_0x7c237f['id']]=new MailAccount(_0x7c237f);}else{_[_0xf4ea('0x7')](_0x221c03[_0xf4ea('0x2')][_0x7c237f['id']],_0x7c237f);}}}return _0x221c03[_0xf4ea('0x2')];};};module[_0xf4ea('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9c7db0b..532de80 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6596=['Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service','email','active','key','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x6596,0x1d3));var _0x6659=function(_0x450e61,_0x1e1911){_0x450e61=_0x450e61-0x0;var _0x1b4d43=_0x6596[_0x450e61];return _0x1b4d43;};'use strict';var client=require(_0x6659('0x0'));exports[_0x6659('0x1')]=function(){return function(){return client['Request'](_0x6659('0x2'),{'options':{'attributes':['id',_0x6659('0x3'),_0x6659('0x4'),_0x6659('0x5'),_0x6659('0x6'),_0x6659('0x7'),'ListId','TemplateId'],'raw':![],'include':[{'model':_0x6659('0x8'),'as':_0x6659('0x9')},{'model':_0x6659('0xa'),'as':_0x6659('0xb')}]},'log':_0x6659('0xc')});};};exports['notify']=function(_0x485ea0,_0x24bfdf){return client[_0x6659('0xd')](_0x6659('0xe'),{'account':{'id':_0x485ea0},'body':_0x24bfdf,'log':_0x6659('0xe')});}; \ No newline at end of file +var _0x52ad=['ListId','TemplateId','MailServerIn','Imap','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','service','email','active','key'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x52ad,0x1d8));var _0xd52a=function(_0x885fd9,_0x21c3cc){_0x885fd9=_0x885fd9-0x0;var _0x3ddc40=_0x52ad[_0x885fd9];return _0x3ddc40;};'use strict';var client=require(_0xd52a('0x0'));exports[_0xd52a('0x1')]=function(){return function(){return client[_0xd52a('0x2')](_0xd52a('0x3'),{'options':{'attributes':['id','name',_0xd52a('0x4'),_0xd52a('0x5'),_0xd52a('0x6'),_0xd52a('0x7'),_0xd52a('0x8'),_0xd52a('0x9')],'raw':![],'include':[{'model':_0xd52a('0xa'),'as':_0xd52a('0xb')},{'model':_0xd52a('0xc'),'as':'Smtp'}]},'log':_0xd52a('0xd')});};};exports[_0xd52a('0xe')]=function(_0x20b817,_0x3df9d4){return client['Request'](_0xd52a('0xf'),{'account':{'id':_0x20b817},'body':_0x3df9d4,'log':_0xd52a('0xf')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 77903e0..90a3048 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbbc=['http','stringify','127.0.0.1','RPC\x20listening\x20on\x20port:','bluebird','email','listen','sendMail','account','then','catch','error','verifySmtp','Verified','values','Imap','Smtp','pass','length'];(function(_0x486640,_0x56d7d5){var _0x38c286=function(_0x5e1642){while(--_0x5e1642){_0x486640['push'](_0x486640['shift']());}};_0x38c286(++_0x56d7d5);}(_0xdbbc,0x147));var _0xcdbb=function(_0x1adb96,_0x5c8a81){_0x1adb96=_0x1adb96-0x0;var _0x13ab64=_0xdbbc[_0x1adb96];return _0x13ab64;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xcdbb('0x0'));var _=require('lodash');var logger=require('../../../config/logger')(_0xcdbb('0x1'));exports[_0xcdbb('0x2')]=function(_0x449232,_0x5c2d1b){return new BPromise(function(_0x399ec9,_0x3e711e){var _0x54c553={'SendMail':function(_0xf4ea5f){var _0x8673a=this;return new Promise(function(_0x5dfa16,_0x5e4f93){_0x5c2d1b[_0xcdbb('0x3')](_0xf4ea5f[_0xcdbb('0x4')],_0xf4ea5f['message'])[_0xcdbb('0x5')](function(_0x5cbf48){_0x5dfa16({'code':0xc8,'message':_0x5cbf48});})[_0xcdbb('0x6')](function(_0x2f92ac){_0x5e4f93(_0x8673a[_0xcdbb('0x7')](0x1f4,_0x2f92ac));});});},'VerifySmtp':function(_0x3c74b4){var _0x8a7a43=this;return new Promise(function(_0x285877,_0x409eda){_0x5c2d1b[_0xcdbb('0x8')](_0x3c74b4[_0xcdbb('0x4')])[_0xcdbb('0x5')](function(_0x5f2ca9){_0x285877({'code':0xc8,'message':_0xcdbb('0x9')});})[_0xcdbb('0x6')](function(_0x5389fc){_0x409eda(_0x8a7a43[_0xcdbb('0x7')](0x1f4,_0x5389fc));});});},'MailAccounts':function(_0x308c68){return new Promise(function(_0x25946e,_0x3e31a3){var _0x522a69=_[_0xcdbb('0xa')](_0x449232['mailAccounts']);for(var _0x2a6904=0x0;_0x2a6904<_0x522a69['length'];_0x2a6904+=0x1){if(_0x522a69[_0x2a6904][_0xcdbb('0xb')]&&_0x522a69[_0x2a6904][_0xcdbb('0xb')]['password']){delete _0x522a69[_0x2a6904][_0xcdbb('0xb')]['password'];}if(_0x522a69[_0x2a6904][_0xcdbb('0xc')]&&_0x522a69[_0x2a6904][_0xcdbb('0xc')][_0xcdbb('0xd')]){delete _0x522a69[_0x2a6904]['Smtp'][_0xcdbb('0xd')];}}_0x25946e({'count':_0x522a69[_0xcdbb('0xe')],'rows':_0x522a69});});}};var _0x1f99f2=jayson['server'](_0x54c553)[_0xcdbb('0xf')]();_0x1f99f2['on'](_0xcdbb('0x7'),function(_0x2d0ac2){logger['error'](JSON[_0xcdbb('0x10')](_0x2d0ac2));return _0x3e711e(_0x2d0ac2);});_0x1f99f2[_0xcdbb('0x2')](0x232b,_0xcdbb('0x11'),function(){console['log']('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x399ec9(_0xcdbb('0x12')+0x232b);});});}; \ No newline at end of file +var _0xe618=['error','verifySmtp','Verified','values','mailAccounts','Imap','password','Smtp','pass','length','server','http','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','account','message','then','catch'];(function(_0x4d8782,_0x40cb35){var _0x396f75=function(_0x255e72){while(--_0x255e72){_0x4d8782['push'](_0x4d8782['shift']());}};_0x396f75(++_0x40cb35);}(_0xe618,0xac));var _0x8e61=function(_0x281e76,_0x8bde50){_0x281e76=_0x281e76-0x0;var _0x5ecce5=_0xe618[_0x281e76];return _0x5ecce5;};'use strict';var jayson=require(_0x8e61('0x0'));var BPromise=require(_0x8e61('0x1'));var _=require(_0x8e61('0x2'));var logger=require(_0x8e61('0x3'))(_0x8e61('0x4'));exports[_0x8e61('0x5')]=function(_0x399c3e,_0x4bf76f){return new BPromise(function(_0x3678d0,_0x95419){var _0x578d29={'SendMail':function(_0x530e7c){var _0x207973=this;return new Promise(function(_0x541daf,_0x2498a2){_0x4bf76f['sendMail'](_0x530e7c[_0x8e61('0x6')],_0x530e7c[_0x8e61('0x7')])[_0x8e61('0x8')](function(_0x30eec0){_0x541daf({'code':0xc8,'message':_0x30eec0});})[_0x8e61('0x9')](function(_0xc01e64){_0x2498a2(_0x207973[_0x8e61('0xa')](0x1f4,_0xc01e64));});});},'VerifySmtp':function(_0x4adfdc){var _0x4107f6=this;return new Promise(function(_0x4c937a,_0x264456){_0x4bf76f[_0x8e61('0xb')](_0x4adfdc['account'])[_0x8e61('0x8')](function(_0x413ab1){_0x4c937a({'code':0xc8,'message':_0x8e61('0xc')});})[_0x8e61('0x9')](function(_0x40bd03){_0x264456(_0x4107f6[_0x8e61('0xa')](0x1f4,_0x40bd03));});});},'MailAccounts':function(_0x689944){return new Promise(function(_0x585d0a,_0x14069f){var _0x13efb4=_[_0x8e61('0xd')](_0x399c3e[_0x8e61('0xe')]);for(var _0x5dc938=0x0;_0x5dc938<_0x13efb4['length'];_0x5dc938+=0x1){if(_0x13efb4[_0x5dc938][_0x8e61('0xf')]&&_0x13efb4[_0x5dc938]['Imap'][_0x8e61('0x10')]){delete _0x13efb4[_0x5dc938][_0x8e61('0xf')]['password'];}if(_0x13efb4[_0x5dc938][_0x8e61('0x11')]&&_0x13efb4[_0x5dc938][_0x8e61('0x11')][_0x8e61('0x12')]){delete _0x13efb4[_0x5dc938]['Smtp'][_0x8e61('0x12')];}}_0x585d0a({'count':_0x13efb4[_0x8e61('0x13')],'rows':_0x13efb4});});}};var _0x1930ed=jayson[_0x8e61('0x14')](_0x578d29)[_0x8e61('0x15')]();_0x1930ed['on'](_0x8e61('0xa'),function(_0x3f8e67){logger['error'](JSON['stringify'](_0x3f8e67));return _0x95419(_0x3f8e67);});_0x1930ed[_0x8e61('0x5')](0x232b,_0x8e61('0x16'),function(){console[_0x8e61('0x17')](_0x8e61('0x18'),0x232b);return _0x3678d0(_0x8e61('0x19')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 2d83b5a..ad999ea 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb05=['exports','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','socket.io-redis','../../config/triggers','default','once','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x1cb128,_0x2770eb){var _0x4843e2=function(_0xc5c6b3){while(--_0xc5c6b3){_0x1cb128['push'](_0x1cb128['shift']());}};_0x4843e2(++_0x2770eb);}(_0xcb05,0x100));var _0x5cb0=function(_0x3ba77e,_0x5b768f){_0x3ba77e=_0x3ba77e-0x0;var _0x20544e=_0xcb05[_0x3ba77e];return _0x20544e;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x5cb0('0x0'));var config=require(_0x5cb0('0x1'));var app=express();var server=http[_0x5cb0('0x2')](app);server[_0x5cb0('0x3')]=0xdbba0;if(sticky[_0x5cb0('0x4')](server,config[_0x5cb0('0x5')])){var socketio=require(_0x5cb0('0x6'))(server,{'transports':['websocket',_0x5cb0('0x7')]});config[_0x5cb0('0x8')]=_['defaults'](config[_0x5cb0('0x8')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x5cb0('0x9'))({'pubClient':new Redis(config[_0x5cb0('0x8')]),'subClient':new Redis(config[_0x5cb0('0x8')])}));require(_0x5cb0('0xa'))[_0x5cb0('0xb')]();require('../../config/socketio')[_0x5cb0('0xb')](socketio);require('../../config/express')[_0x5cb0('0xb')](app);require('../../routes')[_0x5cb0('0xb')](app);}else{server[_0x5cb0('0xc')]('listening',function(){console['log'](_0x5cb0('0xd'),config[_0x5cb0('0x5')]);});}exports=module[_0x5cb0('0xe')]=app; \ No newline at end of file +var _0x3d79=['websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','../../config/express','default','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','../../config/environment','timeout','listen','port','socket.io'];(function(_0x161c20,_0x3db8d1){var _0x32d140=function(_0xf506b2){while(--_0xf506b2){_0x161c20['push'](_0x161c20['shift']());}};_0x32d140(++_0x3db8d1);}(_0x3d79,0x155));var _0x93d7=function(_0x5dd53c,_0x2eba37){_0x5dd53c=_0x5dd53c-0x0;var _0x426f92=_0x3d79[_0x5dd53c];return _0x426f92;};'use strict';var _=require(_0x93d7('0x0'));var http=require(_0x93d7('0x1'));var express=require(_0x93d7('0x2'));var sticky=require(_0x93d7('0x3'));var Redis=require('ioredis');var config=require(_0x93d7('0x4'));var app=express();var server=http['createServer'](app);server[_0x93d7('0x5')]=0xdbba0;if(sticky[_0x93d7('0x6')](server,config[_0x93d7('0x7')])){var socketio=require(_0x93d7('0x8'))(server,{'transports':[_0x93d7('0x9'),_0x93d7('0xa')]});config[_0x93d7('0xb')]=_[_0x93d7('0xc')](config[_0x93d7('0xb')],{'host':_0x93d7('0xd'),'port':0x18eb});socketio[_0x93d7('0xe')](require(_0x93d7('0xf'))({'pubClient':new Redis(config[_0x93d7('0xb')]),'subClient':new Redis(config[_0x93d7('0xb')])}));require(_0x93d7('0x10'))['default']();require(_0x93d7('0x11'))['default'](socketio);require(_0x93d7('0x12'))[_0x93d7('0x13')](app);require(_0x93d7('0x14'))[_0x93d7('0x13')](app);}else{server['once'](_0x93d7('0x15'),function(){console[_0x93d7('0x16')](_0x93d7('0x17'),config[_0x93d7('0x7')]);});}exports=module[_0x93d7('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index a1638ea..c0063cc 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x873a=['jayson/promise','bluebird','../../config/logger','client','request','rpc','routing','error','message','result'];(function(_0x386c12,_0x378952){var _0x2c9023=function(_0x3e2c82){while(--_0x3e2c82){_0x386c12['push'](_0x386c12['shift']());}};_0x2c9023(++_0x378952);}(_0x873a,0x1c2));var _0xa873=function(_0x592a1e,_0x5425b1){_0x592a1e=_0x592a1e-0x0;var _0x1d1b99=_0x873a[_0x592a1e];return _0x1d1b99;};'use strict';var jayson=require(_0xa873('0x0'));var BPromise=require(_0xa873('0x1'));var logger=require(_0xa873('0x2'))('routing');var client=jayson[_0xa873('0x3')]['http']({'port':0x2329});client['Request']=function(_0x423a1a,_0x46971d){return new BPromise(function(_0x5a0d23,_0x3dc07e){return client[_0xa873('0x4')](_0x423a1a,_0x46971d)['then'](function(_0x370b8a){logger['debug'](_0xa873('0x5'),_0xa873('0x6'),_0x423a1a,_0x46971d,_0x370b8a);if(_0x370b8a[_0xa873('0x7')]){logger[_0xa873('0x7')](_0xa873('0x5'),_0xa873('0x6'),_0x423a1a,_0x370b8a[_0xa873('0x7')][_0xa873('0x8')],_0x46971d);return _0x3dc07e(_0x370b8a[_0xa873('0x7')][_0xa873('0x8')]);}else{return _0x5a0d23(_0x370b8a[_0xa873('0x9')]);}})['catch'](function(_0x46e6f7){logger['error'](_0xa873('0x5'),'routing',_0x423a1a,_0x46e6f7,_0x46971d);return _0x3dc07e(_0x46e6f7);});});};module['exports']=client; \ No newline at end of file +var _0xa276=['client','http','request','then','rpc','routing','error','message','result','catch','exports','bluebird','../../config/logger'];(function(_0x5db5bc,_0x49dce8){var _0x505ac9=function(_0x396c55){while(--_0x396c55){_0x5db5bc['push'](_0x5db5bc['shift']());}};_0x505ac9(++_0x49dce8);}(_0xa276,0x9a));var _0x6a27=function(_0x307691,_0x47776a){_0x307691=_0x307691-0x0;var _0x16d829=_0xa276[_0x307691];return _0x16d829;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6a27('0x0'));var logger=require(_0x6a27('0x1'))('routing');var client=jayson[_0x6a27('0x2')][_0x6a27('0x3')]({'port':0x2329});client['Request']=function(_0x15b2e6,_0x431d9c){return new BPromise(function(_0x18289f,_0x5c9089){return client[_0x6a27('0x4')](_0x15b2e6,_0x431d9c)[_0x6a27('0x5')](function(_0x41c595){logger['debug'](_0x6a27('0x6'),'routing',_0x15b2e6,_0x431d9c,_0x41c595);if(_0x41c595['error']){logger['error']('rpc',_0x6a27('0x7'),_0x15b2e6,_0x41c595[_0x6a27('0x8')][_0x6a27('0x9')],_0x431d9c);return _0x5c9089(_0x41c595['error']['message']);}else{return _0x18289f(_0x41c595[_0x6a27('0xa')]);}})[_0x6a27('0xb')](function(_0x15f5bf){logger[_0x6a27('0x8')](_0x6a27('0x6'),_0x6a27('0x7'),_0x15b2e6,_0x15f5bf,_0x431d9c);return _0x5c9089(_0x15f5bf);});});};module[_0x6a27('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 46332f1..151f09c 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e84=['./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server'];(function(_0x149980,_0xeb67c8){var _0x3aacce=function(_0x276700){while(--_0x276700){_0x149980['push'](_0x149980['shift']());}};_0x3aacce(++_0xeb67c8);}(_0x6e84,0x104));var _0x46e8=function(_0x5aed9d,_0x3b35dc){_0x5aed9d=_0x5aed9d-0x0;var _0x18c9f9=_0x6e84[_0x5aed9d];return _0x18c9f9;};'use strict';var BPromise=require('bluebird');var server=require(_0x46e8('0x0'));var Realtime=require(_0x46e8('0x1'));var user=require(_0x46e8('0x2'));var interval=require(_0x46e8('0x3'));var openchannelQueue=require(_0x46e8('0x4'));var chatQueue=require(_0x46e8('0x5'));var smsQueue=require(_0x46e8('0x6'));var mailQueue=require(_0x46e8('0x7'));var faxQueue=require(_0x46e8('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x46e8('0x9')]()['then'](user['getAgents']())[_0x46e8('0xa')](realtime[_0x46e8('0xb')]())[_0x46e8('0xa')](interval[_0x46e8('0xc')]())[_0x46e8('0xa')](realtime[_0x46e8('0xd')]())[_0x46e8('0xa')](openchannelQueue[_0x46e8('0xe')]())['then'](realtime[_0x46e8('0xf')]())[_0x46e8('0xa')](chatQueue[_0x46e8('0x10')]())[_0x46e8('0xa')](realtime[_0x46e8('0x11')]())[_0x46e8('0xa')](smsQueue[_0x46e8('0x12')]())['then'](realtime[_0x46e8('0x13')]())[_0x46e8('0xa')](mailQueue[_0x46e8('0x14')]())[_0x46e8('0xa')](realtime[_0x46e8('0x15')]())[_0x46e8('0xa')](faxQueue[_0x46e8('0x16')]())['then'](realtime[_0x46e8('0x17')]())[_0x46e8('0xa')](whatsappQueue[_0x46e8('0x18')]())['then'](realtime[_0x46e8('0x19')]())['then'](function(){return realtime;});}function main(){return server[_0x46e8('0x1a')](realtime)[_0x46e8('0xa')](function(_0x3b96ec){return initRealtime();})['then'](function(_0x5cabfa){return setInterval(initRealtime,0x1388);})[_0x46e8('0x1b')](function(_0x2bb987){console[_0x46e8('0x1c')](_0x2bb987);});}main(); \ No newline at end of file +var _0x0b4d=['bluebird','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log'];(function(_0x4e54dd,_0xcdc7ff){var _0x13ba18=function(_0x2f63fa){while(--_0x2f63fa){_0x4e54dd['push'](_0x4e54dd['shift']());}};_0x13ba18(++_0xcdc7ff);}(_0x0b4d,0x7d));var _0xd0b4=function(_0xf39859,_0x28fb72){_0xf39859=_0xf39859-0x0;var _0x5e64fa=_0x0b4d[_0xf39859];return _0x5e64fa;};'use strict';var BPromise=require(_0xd0b4('0x0'));var server=require('./server');var Realtime=require(_0xd0b4('0x1'));var user=require('./rpc/user');var interval=require(_0xd0b4('0x2'));var openchannelQueue=require(_0xd0b4('0x3'));var chatQueue=require(_0xd0b4('0x4'));var smsQueue=require(_0xd0b4('0x5'));var mailQueue=require(_0xd0b4('0x6'));var faxQueue=require(_0xd0b4('0x7'));var whatsappQueue=require(_0xd0b4('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xd0b4('0x9')](user[_0xd0b4('0xa')]())['then'](realtime[_0xd0b4('0xb')]())[_0xd0b4('0x9')](interval[_0xd0b4('0xc')]())['then'](realtime[_0xd0b4('0xd')]())[_0xd0b4('0x9')](openchannelQueue['getOpenchannelQueues']())[_0xd0b4('0x9')](realtime[_0xd0b4('0xe')]())[_0xd0b4('0x9')](chatQueue[_0xd0b4('0xf')]())[_0xd0b4('0x9')](realtime[_0xd0b4('0x10')]())[_0xd0b4('0x9')](smsQueue['getSmsQueues']())[_0xd0b4('0x9')](realtime['initSmsQueues']())[_0xd0b4('0x9')](mailQueue[_0xd0b4('0x11')]())[_0xd0b4('0x9')](realtime[_0xd0b4('0x12')]())[_0xd0b4('0x9')](faxQueue[_0xd0b4('0x13')]())[_0xd0b4('0x9')](realtime['initFaxQueues']())[_0xd0b4('0x9')](whatsappQueue[_0xd0b4('0x14')]())[_0xd0b4('0x9')](realtime[_0xd0b4('0x15')]())[_0xd0b4('0x9')](function(){return realtime;});}function main(){return server[_0xd0b4('0x16')](realtime)[_0xd0b4('0x9')](function(_0x236e10){return initRealtime();})[_0xd0b4('0x9')](function(_0x3249d3){return setInterval(initRealtime,0x1388);})[_0xd0b4('0x17')](function(_0x1cd7ad){console[_0xd0b4('0x18')](_0x1cd7ad);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index ffff2ca..b458685 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ab9=['register','ignoreFactChanges','inherits','prototype','activeRules','isArray','concat','rules','push','sync','filter','orderBy','asc','execute','clone','ruleRef','name','nextTick','call','next','isEqual','restart','condition','matchPath','noop','findRules','matches','turn','prioritize','length','priority','toJSON','map','toString','consequence','fromJSON','parse','exports','events','EventEmitter','init','isNil'];(function(_0x3aaccc,_0x29226e){var _0x182acc=function(_0x4aca83){while(--_0x4aca83){_0x3aaccc['push'](_0x3aaccc['shift']());}};_0x182acc(++_0x29226e);}(_0x4ab9,0x122));var _0x94ab=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4ab9[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var EventEmitter=require(_0x94ab('0x0'))[_0x94ab('0x1')];function RuleEngine(_0x4f5629,_0x20c140){this[_0x94ab('0x2')]();if(!_[_0x94ab('0x3')](_0x4f5629)){this[_0x94ab('0x4')](_0x4f5629);}if(_0x20c140){this[_0x94ab('0x5')]=_0x20c140[_0x94ab('0x5')];}return this;}util[_0x94ab('0x6')](RuleEngine,EventEmitter);RuleEngine[_0x94ab('0x7')]['init']=function(_0x1f79ff){this['rules']=[];this[_0x94ab('0x8')]=[];};RuleEngine[_0x94ab('0x7')]['register']=function(_0x5ead39){if(Array[_0x94ab('0x9')](_0x5ead39)){this['rules']=this['rules'][_0x94ab('0xa')](_0x5ead39);}else if(_0x5ead39!==null&&_['isObject'](_0x5ead39)){this[_0x94ab('0xb')][_0x94ab('0xc')](_0x5ead39);}this[_0x94ab('0xd')]();};RuleEngine[_0x94ab('0x7')]['sync']=function(){this['activeRules']=this['rules'][_0x94ab('0xe')](function(_0x2c9c73){if(_[_0x94ab('0x3')](_0x2c9c73['on'])){_0x2c9c73['on']=!![];}if(_0x2c9c73['on']===!![]){return _0x2c9c73;}});this[_0x94ab('0x8')]=_[_0x94ab('0xf')](this['activeRules'],['p'],[_0x94ab('0x10')]);};RuleEngine['prototype'][_0x94ab('0x11')]=function(_0x36c54d,_0xb54b31){var _0x938516=![];_0x36c54d['result']=!![];var _0x523315=_['clone'](_0x36c54d);var _0x2ffb5e=_[_0x94ab('0x12')](_0x36c54d);var _0xc5f223=this[_0x94ab('0x8')];var _0x2e9121=[];var _0x321230=this[_0x94ab('0x5')];(function FnRuleLoop(_0x33d3d5){var _0x335c0f={'rules':function(){return _0xc5f223;},'rule':function(){return _0xc5f223[_0x33d3d5];},'when':function(_0xb5d252){if(_0xb5d252){var _0xaf8368=_0xc5f223[_0x33d3d5]['consequence'];_0xaf8368[_0x94ab('0x13')]=_0xc5f223[_0x33d3d5]['id']||_0xc5f223[_0x33d3d5][_0x94ab('0x14')]||'index_'+_0x33d3d5;process[_0x94ab('0x15')](function(){_0x2e9121['push'](_0xaf8368[_0x94ab('0x13')]);_0xaf8368[_0x94ab('0x16')](_0x523315,_0x335c0f);});}else{process[_0x94ab('0x15')](function(){_0x335c0f[_0x94ab('0x17')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x938516=!![];return FnRuleLoop(0x0);},'next':function(_0x5726f7){if(!_0x321230&&!_[_0x94ab('0x18')](_0x2ffb5e,_0x523315)){_0x2ffb5e=_[_0x94ab('0x12')](_0x523315);process[_0x94ab('0x15')](function(){_0x335c0f[_0x94ab('0x19')]();});}else{process[_0x94ab('0x15')](function(){if(_[_0x94ab('0x3')](_0x5726f7)){return FnRuleLoop(_0x33d3d5+0x1);}else{return FnRuleLoop(_0x5726f7);}});}}};if(_0x33d3d5<_0xc5f223['length']&&_0x938516===![]){var _0x3524c1=_0xc5f223[_0x33d3d5][_0x94ab('0x1a')];_0x3524c1[_0x94ab('0x16')](_0x523315,_0x335c0f);}else{process[_0x94ab('0x15')](function(){_0x523315[_0x94ab('0x1b')]=_0x2e9121;return _0xb54b31?_0xb54b31(_0x523315):_[_0x94ab('0x1c')]();});}}(0x0));};RuleEngine[_0x94ab('0x7')][_0x94ab('0x1d')]=function(_0x33bb2d){if(_[_0x94ab('0x3')](_0x33bb2d)){return this[_0x94ab('0xb')];}else{var _0x3d0ee6=_[_0x94ab('0x1e')](_0x33bb2d);return _[_0x94ab('0xe')](this[_0x94ab('0xb')],_0x3d0ee6);}};RuleEngine['prototype'][_0x94ab('0x1f')]=function(_0x3358b9,_0xf0ea7f){var _0x3cc7e0=_0x3358b9==='on'||_0x3358b9==='ON'?!![]:![];var _0x46cc9f=this[_0x94ab('0x1d')](_0xf0ea7f);for(var _0x211847=0x0,_0x3231e0=_0x46cc9f['length'];_0x211847<_0x3231e0;_0x211847+=0x1){_0x46cc9f[_0x211847]['on']=_0x3cc7e0;}this[_0x94ab('0xd')]();};RuleEngine[_0x94ab('0x7')][_0x94ab('0x20')]=function(_0x3fba61,_0x1771e7){_0x3fba61=parseInt(_0x3fba61,0xa);var _0x481d5e=this[_0x94ab('0x1d')](_0x1771e7);for(var _0x5c8685=0x0,_0x43a32d=_0x481d5e[_0x94ab('0x21')];_0x5c8685<_0x43a32d;_0x5c8685+=0x1){_0x481d5e[_0x5c8685][_0x94ab('0x22')]=_0x3fba61;}this[_0x94ab('0xd')]();};RuleEngine['prototype'][_0x94ab('0x23')]=function(){var _0x14f554=this[_0x94ab('0xb')];if(_0x14f554 instanceof Array){_0x14f554=_0x14f554[_0x94ab('0x24')](function(_0x58485c){_0x58485c[_0x94ab('0x1a')]=_0x58485c[_0x94ab('0x1a')][_0x94ab('0x25')]();_0x58485c['consequence']=_0x58485c[_0x94ab('0x26')][_0x94ab('0x25')]();return _0x58485c;});}else if(!_[_0x94ab('0x3')](_0x14f554)){_0x14f554[_0x94ab('0x1a')]=_0x14f554['condition'][_0x94ab('0x25')]();_0x14f554['consequence']=_0x14f554['consequence'][_0x94ab('0x25')]();}return _0x14f554;};RuleEngine[_0x94ab('0x7')][_0x94ab('0x27')]=function(_0x590254){this[_0x94ab('0x2')]();if(_['isString'](_0x590254)){_0x590254=JSON[_0x94ab('0x28')](_0x590254);}if(_0x590254 instanceof Array){_0x590254=_0x590254['map'](function(_0x80b0c0){_0x80b0c0[_0x94ab('0x1a')]=eval('('+_0x80b0c0['condition']+')');_0x80b0c0['consequence']=eval('('+_0x80b0c0[_0x94ab('0x26')]+')');return _0x80b0c0;});}else if(_0x590254!==null&&typeof _0x590254=='object'){_0x590254[_0x94ab('0x1a')]=eval('('+_0x590254['condition']+')');_0x590254[_0x94ab('0x26')]=eval('('+_0x590254[_0x94ab('0x26')]+')');}this[_0x94ab('0x4')](_0x590254);};module[_0x94ab('0x29')]=RuleEngine; \ No newline at end of file +var _0x316b=['prioritize','toJSON','condition','toString','fromJSON','isString','parse','map','object','lodash','util','init','isNil','register','ignoreFactChanges','prototype','rules','isArray','concat','isObject','sync','filter','activeRules','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','push','call','next','isEqual','restart','matchPath','noop','findRules','matches','turn','length'];(function(_0x25e0a7,_0x213e9e){var _0x50b2df=function(_0x2ad49a){while(--_0x2ad49a){_0x25e0a7['push'](_0x25e0a7['shift']());}};_0x50b2df(++_0x213e9e);}(_0x316b,0x8d));var _0xb316=function(_0x416a0a,_0x24f91f){_0x416a0a=_0x416a0a-0x0;var _0x574c9f=_0x316b[_0x416a0a];return _0x574c9f;};'use strict';var _=require(_0xb316('0x0'));var util=require(_0xb316('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x246919,_0x224b86){this[_0xb316('0x2')]();if(!_[_0xb316('0x3')](_0x246919)){this[_0xb316('0x4')](_0x246919);}if(_0x224b86){this[_0xb316('0x5')]=_0x224b86[_0xb316('0x5')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0xb316('0x6')][_0xb316('0x2')]=function(_0x314ea7){this[_0xb316('0x7')]=[];this['activeRules']=[];};RuleEngine[_0xb316('0x6')][_0xb316('0x4')]=function(_0x5799e0){if(Array[_0xb316('0x8')](_0x5799e0)){this[_0xb316('0x7')]=this[_0xb316('0x7')][_0xb316('0x9')](_0x5799e0);}else if(_0x5799e0!==null&&_[_0xb316('0xa')](_0x5799e0)){this['rules']['push'](_0x5799e0);}this[_0xb316('0xb')]();};RuleEngine['prototype']['sync']=function(){this['activeRules']=this[_0xb316('0x7')][_0xb316('0xc')](function(_0x2de6d4){if(_[_0xb316('0x3')](_0x2de6d4['on'])){_0x2de6d4['on']=!![];}if(_0x2de6d4['on']===!![]){return _0x2de6d4;}});this[_0xb316('0xd')]=_[_0xb316('0xe')](this['activeRules'],['p'],[_0xb316('0xf')]);};RuleEngine['prototype'][_0xb316('0x10')]=function(_0x4156da,_0x2eb303){var _0x9c37fe=![];_0x4156da[_0xb316('0x11')]=!![];var _0x22c82a=_[_0xb316('0x12')](_0x4156da);var _0x4cbe43=_[_0xb316('0x12')](_0x4156da);var _0x46352d=this[_0xb316('0xd')];var _0x49505a=[];var _0x1714e0=this[_0xb316('0x5')];(function FnRuleLoop(_0x5eb164){var _0x130794={'rules':function(){return _0x46352d;},'rule':function(){return _0x46352d[_0x5eb164];},'when':function(_0x3dd06e){if(_0x3dd06e){var _0x1679cb=_0x46352d[_0x5eb164][_0xb316('0x13')];_0x1679cb[_0xb316('0x14')]=_0x46352d[_0x5eb164]['id']||_0x46352d[_0x5eb164][_0xb316('0x15')]||_0xb316('0x16')+_0x5eb164;process[_0xb316('0x17')](function(){_0x49505a[_0xb316('0x18')](_0x1679cb[_0xb316('0x14')]);_0x1679cb[_0xb316('0x19')](_0x22c82a,_0x130794);});}else{process[_0xb316('0x17')](function(){_0x130794[_0xb316('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x9c37fe=!![];return FnRuleLoop(0x0);},'next':function(_0x1b2c04){if(!_0x1714e0&&!_[_0xb316('0x1b')](_0x4cbe43,_0x22c82a)){_0x4cbe43=_[_0xb316('0x12')](_0x22c82a);process['nextTick'](function(){_0x130794[_0xb316('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xb316('0x3')](_0x1b2c04)){return FnRuleLoop(_0x5eb164+0x1);}else{return FnRuleLoop(_0x1b2c04);}});}}};if(_0x5eb164<_0x46352d['length']&&_0x9c37fe===![]){var _0x48c4e1=_0x46352d[_0x5eb164]['condition'];_0x48c4e1[_0xb316('0x19')](_0x22c82a,_0x130794);}else{process['nextTick'](function(){_0x22c82a[_0xb316('0x1d')]=_0x49505a;return _0x2eb303?_0x2eb303(_0x22c82a):_[_0xb316('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0xb316('0x1f')]=function(_0x41bbe9){if(_[_0xb316('0x3')](_0x41bbe9)){return this[_0xb316('0x7')];}else{var _0x4099b7=_[_0xb316('0x20')](_0x41bbe9);return _[_0xb316('0xc')](this[_0xb316('0x7')],_0x4099b7);}};RuleEngine['prototype'][_0xb316('0x21')]=function(_0x276087,_0x35abae){var _0xe8b108=_0x276087==='on'||_0x276087==='ON'?!![]:![];var _0x2a4339=this[_0xb316('0x1f')](_0x35abae);for(var _0x557091=0x0,_0x27a840=_0x2a4339[_0xb316('0x22')];_0x557091<_0x27a840;_0x557091+=0x1){_0x2a4339[_0x557091]['on']=_0xe8b108;}this[_0xb316('0xb')]();};RuleEngine['prototype'][_0xb316('0x23')]=function(_0x383d5a,_0x53a2b0){_0x383d5a=parseInt(_0x383d5a,0xa);var _0x30232b=this[_0xb316('0x1f')](_0x53a2b0);for(var _0xa746c3=0x0,_0x294d00=_0x30232b[_0xb316('0x22')];_0xa746c3<_0x294d00;_0xa746c3+=0x1){_0x30232b[_0xa746c3]['priority']=_0x383d5a;}this[_0xb316('0xb')]();};RuleEngine['prototype'][_0xb316('0x24')]=function(){var _0x322391=this[_0xb316('0x7')];if(_0x322391 instanceof Array){_0x322391=_0x322391['map'](function(_0x1e3fd0){_0x1e3fd0[_0xb316('0x25')]=_0x1e3fd0[_0xb316('0x25')][_0xb316('0x26')]();_0x1e3fd0['consequence']=_0x1e3fd0[_0xb316('0x13')][_0xb316('0x26')]();return _0x1e3fd0;});}else if(!_[_0xb316('0x3')](_0x322391)){_0x322391['condition']=_0x322391['condition']['toString']();_0x322391[_0xb316('0x13')]=_0x322391['consequence'][_0xb316('0x26')]();}return _0x322391;};RuleEngine[_0xb316('0x6')][_0xb316('0x27')]=function(_0x3cc6dc){this[_0xb316('0x2')]();if(_[_0xb316('0x28')](_0x3cc6dc)){_0x3cc6dc=JSON[_0xb316('0x29')](_0x3cc6dc);}if(_0x3cc6dc instanceof Array){_0x3cc6dc=_0x3cc6dc[_0xb316('0x2a')](function(_0x3480d9){_0x3480d9[_0xb316('0x25')]=eval('('+_0x3480d9['condition']+')');_0x3480d9[_0xb316('0x13')]=eval('('+_0x3480d9['consequence']+')');return _0x3480d9;});}else if(_0x3cc6dc!==null&&typeof _0x3cc6dc==_0xb316('0x2b')){_0x3cc6dc['condition']=eval('('+_0x3cc6dc[_0xb316('0x25')]+')');_0x3cc6dc[_0xb316('0x13')]=eval('('+_0x3cc6dc[_0xb316('0x13')]+')');}this[_0xb316('0x4')](_0x3cc6dc);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b39e6e6..de3fee5 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x36dce0,_0x2f2610){var _0x175c11=function(_0x274588){while(--_0x274588){_0x36dce0['push'](_0x36dce0['shift']());}};_0x175c11(++_0x2f2610);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x4fcdf0,_0x538d3e){var _0xfb4533=function(_0x77c67b){while(--_0x77c67b){_0x4fcdf0['push'](_0x4fcdf0['shift']());}};_0xfb4533(++_0x538d3e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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/routing/model/agent.js b/server/services/routing/model/agent.js index a322895..5e10274 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7072=['faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','fax','sms','whatsapp','Status','StatusTime','toNumber','whatsappStatusTime','stringify','emit','user:save','moment','md5','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime'];(function(_0x7460d8,_0x2fc1a1){var _0x338f82=function(_0x1cec50){while(--_0x1cec50){_0x7460d8['push'](_0x7460d8['shift']());}};_0x338f82(++_0x2fc1a1);}(_0x7072,0x138));var _0x2707=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7072[_0x15c421];return _0x5e5ed5;};'use strict';var _=require('lodash');var moment=require(_0x2707('0x0'));var md5=require(_0x2707('0x1'));var Redis=require(_0x2707('0x2'));var config=require(_0x2707('0x3'));config[_0x2707('0x4')]=_['defaults'](config['redis'],{'host':_0x2707('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2707('0x4')]));function Agent(_0x3572cf){this['id']=_0x3572cf['id']||0x0;this[_0x2707('0x6')]=_0x3572cf[_0x2707('0x6')]||'';this[_0x2707('0x7')]=_0x3572cf[_0x2707('0x7')]||!![];this[_0x2707('0x8')]=_0x3572cf[_0x2707('0x8')]||![];this[_0x2707('0x9')]=_0x3572cf[_0x2707('0x9')]||![];this['mailPause']=_0x3572cf['mailPause']||![];this[_0x2707('0xa')]=_0x3572cf[_0x2707('0xa')]||![];this[_0x2707('0xb')]=_0x3572cf[_0x2707('0xb')]||![];this[_0x2707('0xc')]=_0x3572cf[_0x2707('0xc')]||![];this[_0x2707('0xd')]=_0x2707('0xe');this[_0x2707('0xf')]=0x0;this[_0x2707('0x10')]=_0x3572cf[_0x2707('0x10')]||0x0;this[_0x2707('0x11')]=0x0;this[_0x2707('0x12')]='unknown';this[_0x2707('0x13')]=0x0;this['mailCapacity']=_0x3572cf[_0x2707('0x14')]||0x0;this[_0x2707('0x15')]=0x0;this[_0x2707('0x16')]=_0x2707('0xe');this[_0x2707('0x17')]=0x0;this['faxCapacity']=_0x3572cf[_0x2707('0x18')]||0x0;this[_0x2707('0x19')]=0x0;this[_0x2707('0x1a')]='unknown';this[_0x2707('0x1b')]=0x0;this[_0x2707('0x1c')]=_0x3572cf[_0x2707('0x1c')]||0x0;this[_0x2707('0x1d')]=0x0;this[_0x2707('0x1e')]=_0x2707('0xe');this['whatsappStatusTime']=0x0;this[_0x2707('0x1f')]=_0x3572cf[_0x2707('0x1f')]||0x0;this[_0x2707('0x20')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x2707('0x21')]=_0x3572cf[_0x2707('0x21')]||0x0;this[_0x2707('0x22')]=0x0;this[_0x2707('0x23')]=![];this[_0x2707('0x24')]=undefined;this[_0x2707('0x1')]='';this[_0x2707('0x25')]();}Agent[_0x2707('0x26')][_0x2707('0x27')]=function(_0x2c0cb7){if(this[_0x2c0cb7+_0x2707('0x28')]>0x0){if(this[_0x2c0cb7+_0x2707('0x29')]>0x0&&this[_0x2c0cb7+_0x2707('0x28')]>=this[_0x2c0cb7+_0x2707('0x29')]){return'maxcapacity';}else{return _0x2707('0x2a');}}else{return _0x2707('0x2b');}};Agent[_0x2707('0x26')][_0x2707('0x25')]=function(){var _0x378ca4=[_0x2707('0x2c'),'chat',_0x2707('0x2d'),_0x2707('0x2e'),_0x2707('0x2f'),_0x2707('0x30')];for(var _0x5b763f=0x0;_0x5b763f<_0x378ca4['length'];_0x5b763f+=0x1){var _0x2dce16=this['getChannelStatus'](_0x378ca4[_0x5b763f]);if(this[_0x378ca4[_0x5b763f]+_0x2707('0x31')]!==_0x2dce16){this[_0x378ca4[_0x5b763f]+_0x2707('0x32')]=_[_0x2707('0x33')](moment()['format']('x'));}this[_0x378ca4[_0x5b763f]+_0x2707('0x31')]=_0x2dce16;}var _0x14daf8={'id':this['id'],'name':this[_0x2707('0x6')],'online':this['online'],'voicePause':this[_0x2707('0x8')],'chatPause':this[_0x2707('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x2707('0xb')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x2707('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x2707('0x10')],'chatCurrentCapacity':this[_0x2707('0x11')],'mailStatus':this[_0x2707('0x12')],'mailStatusTime':this[_0x2707('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x2707('0x15')],'faxStatus':this[_0x2707('0x16')],'faxStatusTime':this[_0x2707('0x17')],'faxCapacity':this[_0x2707('0x18')],'faxCurrentCapacity':this[_0x2707('0x19')],'smsStatus':this[_0x2707('0x1a')],'smsStatusTime':this[_0x2707('0x1b')],'smsCapacity':this[_0x2707('0x1c')],'smsCurrentCapacity':this[_0x2707('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x2707('0x34')],'whatsappCapacity':this[_0x2707('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2707('0x23')],'busyQueue':this['busyQueue']};var _0x56280c=md5(JSON[_0x2707('0x35')](_0x14daf8));if(this[_0x2707('0x1')]!==_0x56280c){this['md5']=_0x56280c;io[_0x2707('0x36')](_0x2707('0x37'),_0x14daf8);}};module['exports']=Agent; \ No newline at end of file +var _0x60e1=['mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','updateRealtime','getChannelStatus','CurrentCapacity','maxcapacity','working','prototype','chat','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','faxCapacity','faxCurrentCapacity','openchannelCurrentCapacity','stringify','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime'];(function(_0x5af9b3,_0x516c90){var _0x129f28=function(_0x1a8fe6){while(--_0x1a8fe6){_0x5af9b3['push'](_0x5af9b3['shift']());}};_0x129f28(++_0x516c90);}(_0x60e1,0x14c));var _0x160e=function(_0x21f795,_0x35c2dd){_0x21f795=_0x21f795-0x0;var _0x5a9806=_0x60e1[_0x21f795];return _0x5a9806;};'use strict';var _=require(_0x160e('0x0'));var moment=require('moment');var md5=require(_0x160e('0x1'));var Redis=require(_0x160e('0x2'));var config=require(_0x160e('0x3'));config[_0x160e('0x4')]=_[_0x160e('0x5')](config[_0x160e('0x4')],{'host':_0x160e('0x6'),'port':0x18eb});var io=require(_0x160e('0x7'))(new Redis(config[_0x160e('0x4')]));function Agent(_0x4104e2){this['id']=_0x4104e2['id']||0x0;this['name']=_0x4104e2[_0x160e('0x8')]||'';this['online']=_0x4104e2[_0x160e('0x9')]||!![];this[_0x160e('0xa')]=_0x4104e2[_0x160e('0xa')]||![];this['chatPause']=_0x4104e2[_0x160e('0xb')]||![];this[_0x160e('0xc')]=_0x4104e2[_0x160e('0xc')]||![];this[_0x160e('0xd')]=_0x4104e2[_0x160e('0xd')]||![];this[_0x160e('0xe')]=_0x4104e2['smsPause']||![];this[_0x160e('0xf')]=_0x4104e2[_0x160e('0xf')]||![];this[_0x160e('0x10')]=_0x160e('0x11');this[_0x160e('0x12')]=0x0;this[_0x160e('0x13')]=_0x4104e2[_0x160e('0x13')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x160e('0x14')]=_0x160e('0x11');this[_0x160e('0x15')]=0x0;this[_0x160e('0x16')]=_0x4104e2['mailCapacity']||0x0;this[_0x160e('0x17')]=0x0;this[_0x160e('0x18')]=_0x160e('0x11');this[_0x160e('0x19')]=0x0;this['faxCapacity']=_0x4104e2['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x160e('0x11');this[_0x160e('0x1a')]=0x0;this[_0x160e('0x1b')]=_0x4104e2[_0x160e('0x1b')]||0x0;this[_0x160e('0x1c')]=0x0;this[_0x160e('0x1d')]='unknown';this[_0x160e('0x1e')]=0x0;this[_0x160e('0x1f')]=_0x4104e2['whatsappCapacity']||0x0;this[_0x160e('0x20')]=0x0;this[_0x160e('0x21')]=_0x160e('0x11');this[_0x160e('0x22')]=0x0;this[_0x160e('0x23')]=_0x4104e2[_0x160e('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x160e('0x24')]=![];this['busyQueue']=undefined;this[_0x160e('0x1')]='';this[_0x160e('0x25')]();}Agent['prototype'][_0x160e('0x26')]=function(_0x5b6df0){if(this[_0x5b6df0+_0x160e('0x27')]>0x0){if(this[_0x5b6df0+'Capacity']>0x0&&this[_0x5b6df0+_0x160e('0x27')]>=this[_0x5b6df0+'Capacity']){return _0x160e('0x28');}else{return _0x160e('0x29');}}else{return'idle';}};Agent[_0x160e('0x2a')]['updateRealtime']=function(){var _0x2aaa6f=['mail',_0x160e('0x2b'),'openchannel','fax',_0x160e('0x2c'),_0x160e('0x2d')];for(var _0x1818d4=0x0;_0x1818d4<_0x2aaa6f[_0x160e('0x2e')];_0x1818d4+=0x1){var _0x3e8856=this[_0x160e('0x26')](_0x2aaa6f[_0x1818d4]);if(this[_0x2aaa6f[_0x1818d4]+_0x160e('0x2f')]!==_0x3e8856){this[_0x2aaa6f[_0x1818d4]+_0x160e('0x30')]=_[_0x160e('0x31')](moment()[_0x160e('0x32')]('x'));}this[_0x2aaa6f[_0x1818d4]+_0x160e('0x2f')]=_0x3e8856;}var _0x3bbc77={'id':this['id'],'name':this['name'],'online':this[_0x160e('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x160e('0xb')],'mailPause':this[_0x160e('0xc')],'smsPause':this[_0x160e('0xe')],'faxPause':this[_0x160e('0xd')],'openchannelPause':this[_0x160e('0xf')],'chatStatus':this[_0x160e('0x10')],'chatStatusTime':this[_0x160e('0x12')],'chatCapacity':this[_0x160e('0x13')],'chatCurrentCapacity':this[_0x160e('0x33')],'mailStatus':this[_0x160e('0x14')],'mailStatusTime':this[_0x160e('0x15')],'mailCapacity':this[_0x160e('0x16')],'mailCurrentCapacity':this[_0x160e('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x160e('0x19')],'faxCapacity':this[_0x160e('0x34')],'faxCurrentCapacity':this[_0x160e('0x35')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x160e('0x1a')],'smsCapacity':this[_0x160e('0x1b')],'smsCurrentCapacity':this[_0x160e('0x1c')],'whatsappStatus':this[_0x160e('0x1d')],'whatsappStatusTime':this[_0x160e('0x1e')],'whatsappCapacity':this[_0x160e('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x160e('0x21')],'openchannelStatusTime':this[_0x160e('0x22')],'openchannelCapacity':this[_0x160e('0x23')],'openchannelCurrentCapacity':this[_0x160e('0x36')],'busy':this[_0x160e('0x24')],'busyQueue':this['busyQueue']};var _0x19124d=md5(JSON[_0x160e('0x37')](_0x3bbc77));if(this[_0x160e('0x1')]!==_0x19124d){this[_0x160e('0x1')]=_0x19124d;io[_0x160e('0x38')](_0x160e('0x39'),_0x3bbc77);}};module[_0x160e('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 e5c2a2d..00dd0d3 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 _0x3152=['online','paused','available','name','stringify','format','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','loggedIn','length'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x3152,0x1c9));var _0x2315=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x3152[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x2315('0x0'));var md5=require('md5');var util=require(_0x2315('0x1'));var Redis=require(_0x2315('0x2'));var config=require(_0x2315('0x3'));config['redis']=_[_0x2315('0x4')](config[_0x2315('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2315('0x5')]));function ChatQueue(_0x3206b5){this['id']=_0x3206b5['id']||0x0;this['name']=_0x3206b5['name']||'';this['timeout']=_0x3206b5[_0x2315('0x6')]||0xa;this[_0x2315('0x7')]=_0x3206b5['strategy']||_0x2315('0x8');this[_0x2315('0x9')]=_0x3206b5[_0x2315('0x9')];this[_0x2315('0xa')]={};this[_0x2315('0xb')]=0x0;this[_0x2315('0xc')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x2315('0xd')][_0x2315('0xe')]=function(){var _0x3e1ff3=this[_0x2315('0xa')][_0x2315('0xf')];this[_0x2315('0xa')]=_[_0x2315('0x10')](this[_0x2315('0x9')],'id');this['mapAgentsId'][_0x2315('0xf')]=_0x3e1ff3;};ChatQueue[_0x2315('0xd')]['updateRealtime']=function(){this[_0x2315('0x11')]=0x0;this['paused']=0x0;for(var _0x158520=0x0;_0x158520=0x0?this[_0x2315('0x15')]:0x0;var _0x30881e={'id':this['id'],'available':this[_0x2315('0x15')],'loggedIn':this[_0x2315('0x11')],'name':this[_0x2315('0x16')],'paused':this[_0x2315('0x14')],'waiting':this[_0x2315('0xb')]};var _0x4f08ca=md5(JSON[_0x2315('0x17')](_0x30881e));if(this[_0x2315('0xc')]!==_0x4f08ca){this[_0x2315('0xc')]=_0x4f08ca;io['to'](util[_0x2315('0x18')]('chat:queue:%s',_0x30881e[_0x2315('0x16')]))[_0x2315('0x19')](_0x2315('0x1a'),_0x30881e);}};module[_0x2315('0x1b')]=ChatQueue; \ No newline at end of file +var _0xdac8=['../../../config/environment','redis','defaults','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','chatPause','available','loggedIn','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x55d420,_0x103084){var _0x26699e=function(_0x13666b){while(--_0x13666b){_0x55d420['push'](_0x55d420['shift']());}};_0x26699e(++_0x103084);}(_0xdac8,0xb6));var _0x8dac=function(_0x1fada8,_0x1d47c7){_0x1fada8=_0x1fada8-0x0;var _0x374425=_0xdac8[_0x1fada8];return _0x374425;};'use strict';var _=require(_0x8dac('0x0'));var md5=require(_0x8dac('0x1'));var util=require(_0x8dac('0x2'));var Redis=require(_0x8dac('0x3'));var config=require(_0x8dac('0x4'));config[_0x8dac('0x5')]=_[_0x8dac('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8dac('0x7'))(new Redis(config[_0x8dac('0x5')]));function ChatQueue(_0x503298){this['id']=_0x503298['id']||0x0;this[_0x8dac('0x8')]=_0x503298['name']||'';this['timeout']=_0x503298['timeout']||0xa;this[_0x8dac('0x9')]=_0x503298['strategy']||_0x8dac('0xa');this[_0x8dac('0xb')]=_0x503298[_0x8dac('0xb')];this[_0x8dac('0xc')]={};this[_0x8dac('0xd')]=0x0;this[_0x8dac('0x1')]='';this[_0x8dac('0xe')]();this[_0x8dac('0xf')]();}ChatQueue[_0x8dac('0x10')]['updateRouting']=function(){var _0x1519fe=this[_0x8dac('0xc')][_0x8dac('0x11')];this[_0x8dac('0xc')]=_[_0x8dac('0x12')](this[_0x8dac('0xb')],'id');this[_0x8dac('0xc')][_0x8dac('0x11')]=_0x1519fe;};ChatQueue[_0x8dac('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x8dac('0x13')]=0x0;for(var _0x248636=0x0;_0x248636=0x0?this['available']:0x0;var _0x1b0f6e={'id':this['id'],'available':this[_0x8dac('0x17')],'loggedIn':this[_0x8dac('0x18')],'name':this[_0x8dac('0x8')],'paused':this[_0x8dac('0x13')],'waiting':this['waiting']};var _0x49f952=md5(JSON[_0x8dac('0x19')](_0x1b0f6e));if(this[_0x8dac('0x1')]!==_0x49f952){this['md5']=_0x49f952;io['to'](util[_0x8dac('0x1a')](_0x8dac('0x1b'),_0x1b0f6e[_0x8dac('0x8')]))[_0x8dac('0x1c')](_0x8dac('0x1d'),_0x1b0f6e);}};module[_0x8dac('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 175edd2..e07908a 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(_0x225891,_0x1b4e69){var _0x279ddf=function(_0xff4ac5){while(--_0xff4ac5){_0x225891['push'](_0x225891['shift']());}};_0x279ddf(++_0x1b4e69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x51a8c9,_0xaa1c7c){var _0x1547ca=function(_0x15ac23){while(--_0x15ac23){_0x51a8c9['push'](_0x51a8c9['shift']());}};_0x1547ca(++_0xaa1c7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 bfe44b9..8deacb0 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 _0xb350=['exports','name'];(function(_0x314b9d,_0x1e8c96){var _0x1cb731=function(_0x37055c){while(--_0x37055c){_0x314b9d['push'](_0x314b9d['shift']());}};_0x1cb731(++_0x1e8c96);}(_0xb350,0x143));var _0x0b35=function(_0x231cf4,_0x59464f){_0x231cf4=_0x231cf4-0x0;var _0x2ed93f=_0xb350[_0x231cf4];return _0x2ed93f;};'use strict';function Interval(_0x1de81c){this['id']=_0x1de81c['id']||0x0;this[_0x0b35('0x0')]=_0x1de81c[_0x0b35('0x0')]||'';this['Intervals']=_0x1de81c['Intervals']||{};}module[_0x0b35('0x1')]=Interval; \ No newline at end of file +var _0x421a=['exports','name','Intervals'];(function(_0x1bf996,_0x4b8acb){var _0xaf0cd9=function(_0x460308){while(--_0x460308){_0x1bf996['push'](_0x1bf996['shift']());}};_0xaf0cd9(++_0x4b8acb);}(_0x421a,0x91));var _0xa421=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x421a[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x3f1a11){this['id']=_0x3f1a11['id']||0x0;this[_0xa421('0x0')]=_0x3f1a11[_0xa421('0x0')]||'';this[_0xa421('0x1')]=_0x3f1a11[_0xa421('0x1')]||{};}module[_0xa421('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 e18c13f..f5c06ed 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 _0x8861=['defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','mailPause','available','loggedIn','name','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x26bb62,_0x1db96b){var _0xfe1168=function(_0x5a32d4){while(--_0x5a32d4){_0x26bb62['push'](_0x26bb62['shift']());}};_0xfe1168(++_0x1db96b);}(_0x8861,0x1eb));var _0x1886=function(_0xb59078,_0x2aff7a){_0xb59078=_0xb59078-0x0;var _0x26e5b3=_0x8861[_0xb59078];return _0x26e5b3;};'use strict';var _=require(_0x1886('0x0'));var md5=require(_0x1886('0x1'));var util=require(_0x1886('0x2'));var Redis=require(_0x1886('0x3'));var config=require('../../../config/environment');config[_0x1886('0x4')]=_[_0x1886('0x5')](config['redis'],{'host':_0x1886('0x6'),'port':0x18eb});var io=require(_0x1886('0x7'))(new Redis(config['redis']));function MailQueue(_0x146095){this['id']=_0x146095['id']||0x0;this['name']=_0x146095['name']||'';this[_0x1886('0x8')]=_0x146095[_0x1886('0x8')]||0xa;this[_0x1886('0x9')]=_0x146095[_0x1886('0x9')]||_0x1886('0xa');this['Agents']=_0x146095[_0x1886('0xb')];this[_0x1886('0xc')]={};this[_0x1886('0xd')]=0x0;this['md5']='';this[_0x1886('0xe')]();this[_0x1886('0xf')]();}MailQueue[_0x1886('0x10')][_0x1886('0xe')]=function(){var _0x3c2ce2=this[_0x1886('0xc')]['_rr'];this[_0x1886('0xc')]=_['map'](this['Agents'],'id');this[_0x1886('0xc')][_0x1886('0x11')]=_0x3c2ce2;};MailQueue['prototype'][_0x1886('0xf')]=function(){this['loggedIn']=0x0;this[_0x1886('0x12')]=0x0;for(var _0x129ef7=0x0;_0x129ef7=0x0?this[_0x1886('0x16')]:0x0;var _0x2e714a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1886('0x17')],'name':this[_0x1886('0x18')],'paused':this[_0x1886('0x12')],'waiting':this[_0x1886('0xd')]};var _0xfe42fa=md5(JSON[_0x1886('0x19')](_0x2e714a));if(this[_0x1886('0x1')]!==_0xfe42fa){this['md5']=_0xfe42fa;io['to'](util[_0x1886('0x1a')](_0x1886('0x1b'),_0x2e714a[_0x1886('0x18')]))[_0x1886('0x1c')](_0x1886('0x1d'),_0x2e714a);}};module[_0x1886('0x1e')]=MailQueue; \ No newline at end of file +var _0xf54a=['paused','available','emit','mail_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','mailPause'];(function(_0x5a0dc1,_0x517c34){var _0xc590de=function(_0x25845c){while(--_0x25845c){_0x5a0dc1['push'](_0x5a0dc1['shift']());}};_0xc590de(++_0x517c34);}(_0xf54a,0x13d));var _0xaf54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf54a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaf54('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xaf54('0x1'));var config=require(_0xaf54('0x2'));config[_0xaf54('0x3')]=_[_0xaf54('0x4')](config['redis'],{'host':_0xaf54('0x5'),'port':0x18eb});var io=require(_0xaf54('0x6'))(new Redis(config[_0xaf54('0x3')]));function MailQueue(_0x125644){this['id']=_0x125644['id']||0x0;this[_0xaf54('0x7')]=_0x125644[_0xaf54('0x7')]||'';this[_0xaf54('0x8')]=_0x125644[_0xaf54('0x8')]||0xa;this[_0xaf54('0x9')]=_0x125644['strategy']||_0xaf54('0xa');this[_0xaf54('0xb')]=_0x125644[_0xaf54('0xb')];this[_0xaf54('0xc')]={};this[_0xaf54('0xd')]=0x0;this[_0xaf54('0xe')]='';this[_0xaf54('0xf')]();this[_0xaf54('0x10')]();}MailQueue[_0xaf54('0x11')]['updateRouting']=function(){var _0x5df6b1=this[_0xaf54('0xc')][_0xaf54('0x12')];this['mapAgentsId']=_['map'](this[_0xaf54('0xb')],'id');this['mapAgentsId'][_0xaf54('0x12')]=_0x5df6b1;};MailQueue[_0xaf54('0x11')][_0xaf54('0x10')]=function(){this[_0xaf54('0x13')]=0x0;this['paused']=0x0;for(var _0x47d9ce=0x0;_0x47d9ce=0x0?this['available']:0x0;var _0x217192={'id':this['id'],'available':this[_0xaf54('0x16')],'loggedIn':this[_0xaf54('0x13')],'name':this[_0xaf54('0x7')],'paused':this[_0xaf54('0x15')],'waiting':this['waiting']};var _0x320815=md5(JSON['stringify'](_0x217192));if(this[_0xaf54('0xe')]!==_0x320815){this[_0xaf54('0xe')]=_0x320815;io['to'](util['format']('mail:queue:%s',_0x217192[_0xaf54('0x7')]))[_0xaf54('0x17')](_0xaf54('0x18'),_0x217192);}};module[_0xaf54('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 32b5597..2827e6f 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 _0x5dcc=['openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','paused','length','online','loggedIn','openchannelPause','available','waiting','stringify','format','openchannel:queue:%s','emit'];(function(_0xf7d47e,_0x7222c8){var _0x31733c=function(_0x1efa27){while(--_0x1efa27){_0xf7d47e['push'](_0xf7d47e['shift']());}};_0x31733c(++_0x7222c8);}(_0x5dcc,0x7a));var _0xc5dc=function(_0x5d56df,_0x5830d0){_0x5d56df=_0x5d56df-0x0;var _0x1fed50=_0x5dcc[_0x5d56df];return _0x1fed50;};'use strict';var _=require(_0xc5dc('0x0'));var md5=require(_0xc5dc('0x1'));var util=require('util');var Redis=require(_0xc5dc('0x2'));var config=require(_0xc5dc('0x3'));config['redis']=_[_0xc5dc('0x4')](config[_0xc5dc('0x5')],{'host':_0xc5dc('0x6'),'port':0x18eb});var io=require(_0xc5dc('0x7'))(new Redis(config[_0xc5dc('0x5')]));function OpenchannelQueue(_0x559323){this['id']=_0x559323['id']||0x0;this[_0xc5dc('0x8')]=_0x559323[_0xc5dc('0x8')]||'';this[_0xc5dc('0x9')]=_0x559323[_0xc5dc('0x9')]||0xa;this['strategy']=_0x559323['strategy']||_0xc5dc('0xa');this[_0xc5dc('0xb')]=_0x559323[_0xc5dc('0xb')];this[_0xc5dc('0xc')]={};this['waiting']=0x0;this[_0xc5dc('0x1')]='';this[_0xc5dc('0xd')]();this['updateRealtime']();}OpenchannelQueue[_0xc5dc('0xe')][_0xc5dc('0xd')]=function(){var _0x52d35d=this[_0xc5dc('0xc')]['_rr'];this['mapAgentsId']=_[_0xc5dc('0xf')](this[_0xc5dc('0xb')],'id');this[_0xc5dc('0xc')]['_rr']=_0x52d35d;};OpenchannelQueue[_0xc5dc('0xe')][_0xc5dc('0x10')]=function(){this['loggedIn']=0x0;this[_0xc5dc('0x11')]=0x0;for(var _0x36239b=0x0;_0x36239b=0x0?this[_0xc5dc('0x16')]:0x0;var _0x56d926={'id':this['id'],'available':this[_0xc5dc('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xc5dc('0x8')],'paused':this[_0xc5dc('0x11')],'waiting':this[_0xc5dc('0x17')]};var _0x4c7470=md5(JSON[_0xc5dc('0x18')](_0x56d926));if(this[_0xc5dc('0x1')]!==_0x4c7470){this[_0xc5dc('0x1')]=_0x4c7470;io['to'](util[_0xc5dc('0x19')](_0xc5dc('0x1a'),_0x56d926[_0xc5dc('0x8')]))[_0xc5dc('0x1b')](_0xc5dc('0x1c'),_0x56d926);}};module[_0xc5dc('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x02e9=['beepall','updateRouting','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','paused','Agents','length','online','available','waiting','stringify','format','openchannel:queue:%s','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy'];(function(_0x12c46f,_0x3d9640){var _0xc1029b=function(_0x86e93e){while(--_0x86e93e){_0x12c46f['push'](_0x12c46f['shift']());}};_0xc1029b(++_0x3d9640);}(_0x02e9,0x171));var _0x902e=function(_0x3c3ed5,_0x37449d){_0x3c3ed5=_0x3c3ed5-0x0;var _0x30d765=_0x02e9[_0x3c3ed5];return _0x30d765;};'use strict';var _=require(_0x902e('0x0'));var md5=require(_0x902e('0x1'));var util=require('util');var Redis=require(_0x902e('0x2'));var config=require('../../../config/environment');config[_0x902e('0x3')]=_[_0x902e('0x4')](config['redis'],{'host':_0x902e('0x5'),'port':0x18eb});var io=require(_0x902e('0x6'))(new Redis(config[_0x902e('0x3')]));function OpenchannelQueue(_0x380a49){this['id']=_0x380a49['id']||0x0;this[_0x902e('0x7')]=_0x380a49[_0x902e('0x7')]||'';this['timeout']=_0x380a49['timeout']||0xa;this[_0x902e('0x8')]=_0x380a49[_0x902e('0x8')]||_0x902e('0x9');this['Agents']=_0x380a49['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x902e('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x902e('0xa')]=function(){var _0x1f46d1=this[_0x902e('0xb')][_0x902e('0xc')];this[_0x902e('0xb')]=_[_0x902e('0xd')](this['Agents'],'id');this[_0x902e('0xb')]['_rr']=_0x1f46d1;};OpenchannelQueue[_0x902e('0xe')][_0x902e('0xf')]=function(){this[_0x902e('0x10')]=0x0;this[_0x902e('0x11')]=0x0;for(var _0xe7cdfd=0x0;_0xe7cdfd=0x0?this[_0x902e('0x15')]:0x0;var _0x13e668={'id':this['id'],'available':this[_0x902e('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x902e('0x11')],'waiting':this[_0x902e('0x16')]};var _0x33fa3c=md5(JSON[_0x902e('0x17')](_0x13e668));if(this[_0x902e('0x1')]!==_0x33fa3c){this['md5']=_0x33fa3c;io['to'](util[_0x902e('0x18')](_0x902e('0x19'),_0x13e668[_0x902e('0x7')]))['emit']('openchannel_queue:save',_0x13e668);}};module[_0x902e('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a1d8e90..6bad8d0 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 _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x1fbb15,_0x52da6c){var _0x54b3dd=function(_0x4cc802){while(--_0x4cc802){_0x1fbb15['push'](_0x1fbb15['shift']());}};_0x54b3dd(++_0x52da6c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x5a427c,_0x1c7b6f){var _0xc17e0d=function(_0x3b82a7){while(--_0x3b82a7){_0x5a427c['push'](_0x5a427c['shift']());}};_0xc17e0d(++_0x1c7b6f);}(_0x757a,0xde));var _0xa757=function(_0x4c5e82,_0x473dd8){_0x4c5e82=_0x4c5e82-0x0;var _0x48ef8c=_0x757a[_0x4c5e82];return _0x48ef8c;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index dc71546..096210f 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 _0x4a7c=['md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','length','online','loggedIn','whatsappPause','paused','available','format','whatsapp:queue:%s','emit'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x4a7c,0x12c));var _0xc4a7=function(_0x46519f,_0x1126d2){_0x46519f=_0x46519f-0x0;var _0x3944f2=_0x4a7c[_0x46519f];return _0x3944f2;};'use strict';var _=require('lodash');var md5=require(_0xc4a7('0x0'));var util=require(_0xc4a7('0x1'));var Redis=require(_0xc4a7('0x2'));var config=require('../../../config/environment');config[_0xc4a7('0x3')]=_[_0xc4a7('0x4')](config['redis'],{'host':_0xc4a7('0x5'),'port':0x18eb});var io=require(_0xc4a7('0x6'))(new Redis(config[_0xc4a7('0x3')]));function WhatsappQueue(_0x18a9f6){this['id']=_0x18a9f6['id']||0x0;this[_0xc4a7('0x7')]=_0x18a9f6[_0xc4a7('0x7')]||'';this['timeout']=_0x18a9f6[_0xc4a7('0x8')]||0xa;this[_0xc4a7('0x9')]=_0x18a9f6['strategy']||'beepall';this[_0xc4a7('0xa')]=_0x18a9f6[_0xc4a7('0xa')];this[_0xc4a7('0xb')]={};this[_0xc4a7('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xc4a7('0xd')]();}WhatsappQueue[_0xc4a7('0xe')]['updateRouting']=function(){var _0x3f8e9b=this[_0xc4a7('0xb')][_0xc4a7('0xf')];this['mapAgentsId']=_['map'](this[_0xc4a7('0xa')],'id');this['mapAgentsId'][_0xc4a7('0xf')]=_0x3f8e9b;};WhatsappQueue[_0xc4a7('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3c19ef=0x0;_0x3c19ef=0x0?this[_0xc4a7('0x15')]:0x0;var _0x3bdb3c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc4a7('0x7')],'paused':this[_0xc4a7('0x14')],'waiting':this[_0xc4a7('0xc')]};var _0x41ffd7=md5(JSON['stringify'](_0x3bdb3c));if(this[_0xc4a7('0x0')]!==_0x41ffd7){this[_0xc4a7('0x0')]=_0x41ffd7;io['to'](util[_0xc4a7('0x16')](_0xc4a7('0x17'),_0x3bdb3c[_0xc4a7('0x7')]))[_0xc4a7('0x18')]('whatsapp_queue:save',_0x3bdb3c);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xc5ca=['ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0xc5ca,0x94));var _0xac5c=function(_0x434b5f,_0x4dc968){_0x434b5f=_0x434b5f-0x0;var _0x1ac066=_0xc5ca[_0x434b5f];return _0x1ac066;};'use strict';var _=require(_0xac5c('0x0'));var md5=require(_0xac5c('0x1'));var util=require('util');var Redis=require(_0xac5c('0x2'));var config=require(_0xac5c('0x3'));config['redis']=_[_0xac5c('0x4')](config['redis'],{'host':_0xac5c('0x5'),'port':0x18eb});var io=require(_0xac5c('0x6'))(new Redis(config[_0xac5c('0x7')]));function WhatsappQueue(_0x270285){this['id']=_0x270285['id']||0x0;this[_0xac5c('0x8')]=_0x270285[_0xac5c('0x8')]||'';this[_0xac5c('0x9')]=_0x270285[_0xac5c('0x9')]||0xa;this[_0xac5c('0xa')]=_0x270285[_0xac5c('0xa')]||_0xac5c('0xb');this[_0xac5c('0xc')]=_0x270285[_0xac5c('0xc')];this[_0xac5c('0xd')]={};this[_0xac5c('0xe')]=0x0;this[_0xac5c('0x1')]='';this[_0xac5c('0xf')]();this[_0xac5c('0x10')]();}WhatsappQueue[_0xac5c('0x11')][_0xac5c('0xf')]=function(){var _0x1959a8=this[_0xac5c('0xd')][_0xac5c('0x12')];this['mapAgentsId']=_[_0xac5c('0x13')](this[_0xac5c('0xc')],'id');this[_0xac5c('0xd')][_0xac5c('0x12')]=_0x1959a8;};WhatsappQueue[_0xac5c('0x11')][_0xac5c('0x10')]=function(){this[_0xac5c('0x14')]=0x0;this[_0xac5c('0x15')]=0x0;for(var _0x376ae4=0x0;_0x376ae4=0x0?this[_0xac5c('0x18')]:0x0;var _0x4e1b71={'id':this['id'],'available':this[_0xac5c('0x18')],'loggedIn':this[_0xac5c('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xac5c('0xe')]};var _0x418137=md5(JSON[_0xac5c('0x19')](_0x4e1b71));if(this[_0xac5c('0x1')]!==_0x418137){this[_0xac5c('0x1')]=_0x418137;io['to'](util[_0xac5c('0x1a')]('whatsapp:queue:%s',_0x4e1b71[_0xac5c('0x8')]))[_0xac5c('0x1b')](_0xac5c('0x1c'),_0x4e1b71);}};module[_0xac5c('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index d7207ca..2b16e71 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 _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x259ad3,_0x5ef775){var _0x2fa2a9=function(_0x2f7997){while(--_0x2f7997){_0x259ad3['push'](_0x259ad3['shift']());}};_0x2fa2a9(++_0x5ef775);}(_0xa41a,0x6b));var _0xaa41=function(_0x1e8c6a,_0x1666c3){_0x1e8c6a=_0x1e8c6a-0x0;var _0x51806f=_0xa41a[_0x1e8c6a];return _0x51806f;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9957=['../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue'];(function(_0x3f2ff4,_0x17158a){var _0x2a8e4c=function(_0x2247f4){while(--_0x2247f4){_0x3f2ff4['push'](_0x3f2ff4['shift']());}};_0x2a8e4c(++_0x17158a);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Interval=require(_0x7995('0x4'));var OpenchannelQueue=require(_0x7995('0x5'));var ChatQueue=require(_0x7995('0x6'));var SmsQueue=require(_0x7995('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x7995('0x8'));var WhatsappQueue=require(_0x7995('0x9'));var Realtime=function(){this[_0x7995('0xa')]={};this[_0x7995('0xb')]={};this[_0x7995('0xc')]={};this[_0x7995('0xd')]={};this['smsQueues']={};this[_0x7995('0xe')]={};this[_0x7995('0xf')]={};this['whatsappQueues']={};this[_0x7995('0x10')]={};this[_0x7995('0x11')]={};this[_0x7995('0x12')]={};this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};};function freeIsNotKey(_0x341672,_0x524f7b,_0x245143){var _0x41c652=_['mapKeys'](_0x341672,function(_0xb0c872,_0x2cb37a){return _0xb0c872[_0x245143];});for(var _0x19a27e in _0x524f7b){if(_0x524f7b[_0x7995('0x16')](_0x19a27e)){if(!_0x41c652[_0x19a27e]){delete _0x524f7b[_0x19a27e];}}}}Realtime[_0x7995('0x17')][_0x7995('0x18')]=function(_0x2bbe7a,_0x4cc004){for(var _0x58f5ad in _0x4cc004){if(_0x2bbe7a[_0x7995('0x16')](_0x58f5ad)){_0x2bbe7a[_0x58f5ad]=_0x4cc004[_0x58f5ad];}}};Realtime[_0x7995('0x17')][_0x7995('0x19')]=function(){var _0x321ae8=this;return function(_0x3f1d3e){if(_0x3f1d3e){freeIsNotKey(_0x3f1d3e,_0x321ae8[_0x7995('0xa')],'id');for(var _0x2202ce=0x0,_0x41cbf0={},_0x5377e5={};_0x2202ce<_0x3f1d3e[_0x7995('0x1a')];_0x2202ce+=0x1){_0x41cbf0=_0x3f1d3e[_0x2202ce];if(_['isUndefined'](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']])){_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']]=new Agent(_0x41cbf0);}else{_0x321ae8[_0x7995('0x18')](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']],_0x41cbf0);}}}return _0x321ae8[_0x7995('0xa')];};};Realtime[_0x7995('0x17')]['initIntervals']=function(){var _0x54c9ae=this;return function(_0x2536c8){if(_0x2536c8){freeIsNotKey(_0x2536c8,_0x54c9ae['intervals'],'id');for(var _0x555f74=0x0,_0x3ec178={},_0x3d463e={};_0x555f74<_0x2536c8['length'];_0x555f74+=0x1){_0x3ec178=_0x2536c8[_0x555f74];if(_[_0x7995('0x1b')](_0x54c9ae['intervals'][_0x3ec178['id']])){_0x54c9ae['intervals'][_0x3ec178['id']]=new Interval(_0x3ec178);}else{_0x54c9ae[_0x7995('0x18')](_0x54c9ae[_0x7995('0xb')][_0x3ec178['id']],_0x3ec178);}}}return _0x54c9ae[_0x7995('0xb')];};};Realtime[_0x7995('0x17')][_0x7995('0x1c')]=function(){var _0x1c278a=this;return function(_0x5d40ae){if(_0x5d40ae){freeIsNotKey(_0x5d40ae,_0x1c278a[_0x7995('0xc')],'id');for(var _0x46ee4b=0x0,_0x204507={},_0x285437={};_0x46ee4b<_0x5d40ae[_0x7995('0x1a')];_0x46ee4b+=0x1){_0x204507=_0x5d40ae[_0x46ee4b];if(_[_0x7995('0x1b')](_0x1c278a[_0x7995('0xc')][_0x204507['id']])){_0x1c278a[_0x7995('0xc')][_0x204507['id']]=new OpenchannelQueue(_0x204507);}else{_0x1c278a['mergeFromDatabase'](_0x1c278a[_0x7995('0xc')][_0x204507['id']],_0x204507);}_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1d')]();_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1e')]();}}return _0x1c278a[_0x7995('0xc')];};};Realtime['prototype'][_0x7995('0x1f')]=function(){var _0x5911c3=this;return function(_0x229742){if(_0x229742){freeIsNotKey(_0x229742,_0x5911c3[_0x7995('0xd')],'id');for(var _0xf16cc2=0x0,_0x132a42={},_0x11c1eb={};_0xf16cc2<_0x229742['length'];_0xf16cc2+=0x1){_0x132a42=_0x229742[_0xf16cc2];if(_[_0x7995('0x1b')](_0x5911c3['chatQueues'][_0x132a42['id']])){_0x5911c3[_0x7995('0xd')][_0x132a42['id']]=new ChatQueue(_0x132a42);}else{_0x5911c3[_0x7995('0x18')](_0x5911c3[_0x7995('0xd')][_0x132a42['id']],_0x132a42);}_0x5911c3['chatQueues'][_0x132a42['id']]['updateRouting']();_0x5911c3['chatQueues'][_0x132a42['id']][_0x7995('0x1e')]();}}return _0x5911c3[_0x7995('0xd')];};};Realtime[_0x7995('0x17')][_0x7995('0x20')]=function(){var _0x2e3493=this;return function(_0x1ca460){if(_0x1ca460){freeIsNotKey(_0x1ca460,_0x2e3493['smsQueues'],'id');for(var _0x481c74=0x0,_0xfa8f15={},_0x5524af={};_0x481c74<_0x1ca460[_0x7995('0x1a')];_0x481c74+=0x1){_0xfa8f15=_0x1ca460[_0x481c74];if(_[_0x7995('0x1b')](_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']])){_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']]=new SmsQueue(_0xfa8f15);}else{_0x2e3493[_0x7995('0x18')](_0x2e3493['smsQueues'][_0xfa8f15['id']],_0xfa8f15);}_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']][_0x7995('0x1d')]();_0x2e3493['smsQueues'][_0xfa8f15['id']]['updateRealtime']();}}return _0x2e3493['smsQueues'];};};Realtime[_0x7995('0x17')][_0x7995('0x22')]=function(){var _0x4a176f=this;return function(_0x3e7020){if(_0x3e7020){freeIsNotKey(_0x3e7020,_0x4a176f['mailQueues'],'id');for(var _0x37917b=0x0,_0x1cb058={},_0x177cb4={};_0x37917b<_0x3e7020['length'];_0x37917b+=0x1){_0x1cb058=_0x3e7020[_0x37917b];if(_['isUndefined'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']])){_0x4a176f['mailQueues'][_0x1cb058['id']]=new MailQueue(_0x1cb058);}else{_0x4a176f['mergeFromDatabase'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']],_0x1cb058);}_0x4a176f[_0x7995('0xe')][_0x1cb058['id']]['updateRouting']();_0x4a176f[_0x7995('0xe')][_0x1cb058['id']][_0x7995('0x1e')]();}}return _0x4a176f[_0x7995('0xe')];};};Realtime[_0x7995('0x17')][_0x7995('0x23')]=function(){var _0x53002a=this;return function(_0x2d4285){if(_0x2d4285){freeIsNotKey(_0x2d4285,_0x53002a[_0x7995('0xf')],'id');for(var _0xf612e6=0x0,_0x1d60b8={},_0x4b1541={};_0xf612e6<_0x2d4285[_0x7995('0x1a')];_0xf612e6+=0x1){_0x1d60b8=_0x2d4285[_0xf612e6];if(_[_0x7995('0x1b')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']])){_0x53002a[_0x7995('0xf')][_0x1d60b8['id']]=new FaxQueue(_0x1d60b8);}else{_0x53002a[_0x7995('0x18')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']],_0x1d60b8);}_0x53002a['faxQueues'][_0x1d60b8['id']][_0x7995('0x1d')]();_0x53002a[_0x7995('0xf')][_0x1d60b8['id']][_0x7995('0x1e')]();}}return _0x53002a[_0x7995('0xf')];};};Realtime[_0x7995('0x17')][_0x7995('0x24')]=function(){var _0x14d638=this;return function(_0x270c0e){if(_0x270c0e){freeIsNotKey(_0x270c0e,_0x14d638[_0x7995('0x25')],'id');for(var _0x447981=0x0,_0x6fe77b={},_0x270d52={};_0x447981<_0x270c0e[_0x7995('0x1a')];_0x447981+=0x1){_0x6fe77b=_0x270c0e[_0x447981];if(_['isUndefined'](_0x14d638['whatsappQueues'][_0x6fe77b['id']])){_0x14d638[_0x7995('0x25')][_0x6fe77b['id']]=new WhatsappQueue(_0x6fe77b);}else{_0x14d638[_0x7995('0x18')](_0x14d638['whatsappQueues'][_0x6fe77b['id']],_0x6fe77b);}_0x14d638['whatsappQueues'][_0x6fe77b['id']][_0x7995('0x1d')]();_0x14d638['whatsappQueues'][_0x6fe77b['id']]['updateRealtime']();}}return _0x14d638[_0x7995('0x25')];};};module[_0x7995('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 2abcb46..2226239 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 _0xa5b2=['addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x31b137,_0xa54c07){var _0x35a4f8=function(_0x28e248){while(--_0x28e248){_0x31b137['push'](_0x31b137['shift']());}};_0x35a4f8(++_0xa54c07);}(_0xa5b2,0x129));var _0x2a5b=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xa5b2[_0x4ea413];return _0x51cf25;};'use strict';var client=require('../client');exports['update']=function(_0x465b99,_0x2d1d46){return client[_0x2a5b('0x0')](_0x2a5b('0x1'),{'body':_0x2d1d46,'options':{'where':{'id':_0x465b99}},'log':_0x2a5b('0x2')});};exports['addTags']=function(_0x3b92e9,_0x178c8d){return client[_0x2a5b('0x0')]('AddTagsToChatInteraction',{'body':_0x178c8d,'options':{'where':{'id':_0x3b92e9}},'log':_0x2a5b('0x3')});}; \ No newline at end of file +var _0xa3b3=['update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x8a53e5,_0x5d04cb){var _0xab3b9b=function(_0x2db5b5){while(--_0x2db5b5){_0x8a53e5['push'](_0x8a53e5['shift']());}};_0xab3b9b(++_0x5d04cb);}(_0xa3b3,0xef));var _0x3a3b=function(_0x14e3e0,_0x25bccb){_0x14e3e0=_0x14e3e0-0x0;var _0x2c6185=_0xa3b3[_0x14e3e0];return _0x2c6185;};'use strict';var client=require(_0x3a3b('0x0'));exports[_0x3a3b('0x1')]=function(_0x3ddd58,_0x569fb9){return client[_0x3a3b('0x2')](_0x3a3b('0x3'),{'body':_0x569fb9,'options':{'where':{'id':_0x3ddd58}},'log':'updateChatInteraction'});};exports[_0x3a3b('0x4')]=function(_0x43627b,_0x5b116f){return client[_0x3a3b('0x2')](_0x3a3b('0x5'),{'body':_0x5b116f,'options':{'where':{'id':_0x43627b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2bfce86..caad87f 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 _0xab16=['Request','CreateChatMessage','../client'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xab16,0x158));var _0x6ab1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab16[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x6ab1('0x0'));exports['create']=function(_0x1b9dc4){return client[_0x6ab1('0x1')](_0x6ab1('0x2'),{'body':_0x1b9dc4,'log':'createChatMessage'});}; \ No newline at end of file +var _0x5f3c=['../client','CreateChatMessage'];(function(_0x551ee2,_0x17bd14){var _0x164a33=function(_0x6f4acd){while(--_0x6f4acd){_0x551ee2['push'](_0x551ee2['shift']());}};_0x164a33(++_0x17bd14);}(_0x5f3c,0x10c));var _0xc5f3=function(_0x53c8c7,_0x348f83){_0x53c8c7=_0x53c8c7-0x0;var _0x4f9626=_0x5f3c[_0x53c8c7];return _0x4f9626;};'use strict';var client=require(_0xc5f3('0x0'));exports['create']=function(_0x412ccd){return client['Request'](_0xc5f3('0x1'),{'body':_0x412ccd,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 40f218b..3408724 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 _0x266c=['User','Agents','online','getChatQueues','Request','name','timeout'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x266c,0x1f4));var _0xc266=function(_0x575b2b,_0x56d131){_0x575b2b=_0x575b2b-0x0;var _0x107020=_0x266c[_0x575b2b];return _0x107020;};'use strict';var client=require('../client');exports[_0xc266('0x0')]=function(){return function(){return client[_0xc266('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xc266('0x2'),_0xc266('0x3'),'strategy'],'include':[{'model':_0xc266('0x4'),'as':_0xc266('0x5'),'attributes':['id',_0xc266('0x2'),_0xc266('0x6'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x9563=['timeout','strategy','online','chatPause','../client','getChatQueues','GetChatQueue','name'];(function(_0x3188bc,_0x5a655f){var _0x2e7c8c=function(_0x408971){while(--_0x408971){_0x3188bc['push'](_0x3188bc['shift']());}};_0x2e7c8c(++_0x5a655f);}(_0x9563,0x1f4));var _0x3956=function(_0x3416ad,_0x29e194){_0x3416ad=_0x3416ad-0x0;var _0x265a91=_0x9563[_0x3416ad];return _0x265a91;};'use strict';var client=require(_0x3956('0x0'));exports[_0x3956('0x1')]=function(){return function(){return client['Request'](_0x3956('0x2'),{'options':{'raw':![],'attributes':['id',_0x3956('0x3'),_0x3956('0x4'),_0x3956('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x3956('0x3'),_0x3956('0x6'),_0x3956('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 57c5312..a0230d6 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 _0x3c7b=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x10fcc2,_0x39be04){_0x10fcc2=_0x10fcc2-0x0;var _0x31ee73=_0x3c7b[_0x10fcc2];return _0x31ee73;};'use strict';var client=require(_0xb3c7('0x0'));exports[_0xb3c7('0x1')]=function(_0xc43ced){return client[_0xb3c7('0x2')](_0xb3c7('0x3'),{'body':_0xc43ced,'log':'CreateChatQueueReport'});};exports['update']=function(_0x500bea,_0x5b34ef){return client[_0xb3c7('0x2')](_0xb3c7('0x4'),{'body':_0x5b34ef,'options':{'where':{'uniqueid':_0x500bea},'order':[['id','DESC']],'limit':0x1},'log':_0xb3c7('0x4')});}; \ No newline at end of file +var _0xf9bc=['UpdateChatQueueReport','create','Request','CreateChatQueueReport','update'];(function(_0x437d40,_0x1cecc4){var _0x356aec=function(_0x589fd2){while(--_0x589fd2){_0x437d40['push'](_0x437d40['shift']());}};_0x356aec(++_0x1cecc4);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x415278,_0x5ef93f){_0x415278=_0x415278-0x0;var _0x4ed984=_0xf9bc[_0x415278];return _0x4ed984;};'use strict';var client=require('../client');exports[_0xcf9b('0x0')]=function(_0x46d970){return client[_0xcf9b('0x1')](_0xcf9b('0x2'),{'body':_0x46d970,'log':_0xcf9b('0x2')});};exports[_0xcf9b('0x3')]=function(_0x37df90,_0x373f46){return client[_0xcf9b('0x1')](_0xcf9b('0x4'),{'body':_0x373f46,'options':{'where':{'uniqueid':_0x37df90},'order':[['id','DESC']],'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 c21b055..64bdade 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 _0x5de0=['addTagsToFaxInteraction','update','UpdateFaxInteraction','updateFaxInteraction','Request'];(function(_0x5a532a,_0x3eaad1){var _0x41a89b=function(_0x2f6dfe){while(--_0x2f6dfe){_0x5a532a['push'](_0x5a532a['shift']());}};_0x41a89b(++_0x3eaad1);}(_0x5de0,0x1aa));var _0x05de=function(_0x1c28a6,_0xda987){_0x1c28a6=_0x1c28a6-0x0;var _0x46a76a=_0x5de0[_0x1c28a6];return _0x46a76a;};'use strict';var client=require('../client');exports[_0x05de('0x0')]=function(_0x378dba,_0x129afa){return client['Request'](_0x05de('0x1'),{'body':_0x129afa,'options':{'where':{'id':_0x378dba}},'log':_0x05de('0x2')});};exports['addTags']=function(_0x3dc42f,_0x40694e){return client[_0x05de('0x3')]('AddTagsToFaxInteraction',{'body':_0x40694e,'options':{'where':{'id':_0x3dc42f}},'log':_0x05de('0x4')});}; \ No newline at end of file +var _0x0b62=['../client','UpdateFaxInteraction','addTags','addTagsToFaxInteraction'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0x0b62,0x1a0));var _0x20b6=function(_0xd7d03b,_0x891b7c){_0xd7d03b=_0xd7d03b-0x0;var _0x5158e6=_0x0b62[_0xd7d03b];return _0x5158e6;};'use strict';var client=require(_0x20b6('0x0'));exports['update']=function(_0x28923d,_0x2bf215){return client['Request'](_0x20b6('0x1'),{'body':_0x2bf215,'options':{'where':{'id':_0x28923d}},'log':'updateFaxInteraction'});};exports[_0x20b6('0x2')]=function(_0xf23d91,_0x2b4b77){return client['Request']('AddTagsToFaxInteraction',{'body':_0x2b4b77,'options':{'where':{'id':_0xf23d91}},'log':_0x20b6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index b2fd4a2..37e572f 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 _0xd069=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x2e7ba5,_0x4d6b62){var _0x346b05=function(_0x57302d){while(--_0x57302d){_0x2e7ba5['push'](_0x2e7ba5['shift']());}};_0x346b05(++_0x4d6b62);}(_0xd069,0x1cc));var _0x9d06=function(_0x59659b,_0x38a9a7){_0x59659b=_0x59659b-0x0;var _0x5db166=_0xd069[_0x59659b];return _0x5db166;};'use strict';var client=require(_0x9d06('0x0'));exports['create']=function(_0x464f6f){return client[_0x9d06('0x1')](_0x9d06('0x2'),{'body':_0x464f6f,'log':_0x9d06('0x3')});}; \ No newline at end of file +var _0x91e3=['CreateFaxMessage','../client','create'];(function(_0xa22981,_0x2a7cc8){var _0x425b3c=function(_0x5c825b){while(--_0x5c825b){_0xa22981['push'](_0xa22981['shift']());}};_0x425b3c(++_0x2a7cc8);}(_0x91e3,0x1a8));var _0x391e=function(_0x3fea87,_0x5917e4){_0x3fea87=_0x3fea87-0x0;var _0x5c5a53=_0x91e3[_0x3fea87];return _0x5c5a53;};'use strict';var client=require(_0x391e('0x0'));exports[_0x391e('0x1')]=function(_0x17ebd8){return client['Request'](_0x391e('0x2'),{'body':_0x17ebd8,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f171088..714994a 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 _0xae52=['User','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0xf852,_0x4ddd76){var _0x5b2550=function(_0x4811b1){while(--_0x4811b1){_0xf852['push'](_0xf852['shift']());}};_0x5b2550(++_0x4ddd76);}(_0xae52,0xca));var _0x2ae5=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xae52[_0x37a79c];return _0x561d89;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x2ae5('0x0')](_0x2ae5('0x1'),{'options':{'raw':![],'attributes':['id',_0x2ae5('0x2'),_0x2ae5('0x3'),_0x2ae5('0x4')],'include':[{'model':_0x2ae5('0x5'),'as':'Agents','attributes':['id',_0x2ae5('0x2'),_0x2ae5('0x6'),_0x2ae5('0x7')]}]},'log':_0x2ae5('0x8')});};}; \ No newline at end of file +var _0x93e4=['Request','name','timeout','strategy','User','Agents','online','faxPause','getFaxQueues'];(function(_0x2cb5b9,_0x565939){var _0x2c09d2=function(_0x24dc28){while(--_0x24dc28){_0x2cb5b9['push'](_0x2cb5b9['shift']());}};_0x2c09d2(++_0x565939);}(_0x93e4,0x116));var _0x493e=function(_0x2c8b13,_0x12aeb2){_0x2c8b13=_0x2c8b13-0x0;var _0x4df8a7=_0x93e4[_0x2c8b13];return _0x4df8a7;};'use strict';var client=require('../client');exports[_0x493e('0x0')]=function(){return function(){return client[_0x493e('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x493e('0x2'),_0x493e('0x3'),_0x493e('0x4')],'include':[{'model':_0x493e('0x5'),'as':_0x493e('0x6'),'attributes':['id',_0x493e('0x2'),_0x493e('0x7'),_0x493e('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 57d5136..9c2b43d 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 _0xfeb3=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','Request'];(function(_0x201aa6,_0x387b57){var _0x2b7323=function(_0x39c9b2){while(--_0x39c9b2){_0x201aa6['push'](_0x201aa6['shift']());}};_0x2b7323(++_0x387b57);}(_0xfeb3,0x11c));var _0x3feb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfeb3[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports['create']=function(_0x29b795){return client[_0x3feb('0x0')](_0x3feb('0x1'),{'body':_0x29b795,'log':_0x3feb('0x1')});};exports[_0x3feb('0x2')]=function(_0x390ebf,_0x384288){return client[_0x3feb('0x0')](_0x3feb('0x3'),{'body':_0x384288,'options':{'where':{'uniqueid':_0x390ebf},'order':[['id',_0x3feb('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x15d2=['create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x4039e7,_0x1dbd5a){var _0x2a2a4f=function(_0x3bf453){while(--_0x3bf453){_0x4039e7['push'](_0x4039e7['shift']());}};_0x2a2a4f(++_0x1dbd5a);}(_0x15d2,0x163));var _0x215d=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0x15d2[_0x5235dd];return _0x13059d;};'use strict';var client=require('../client');exports[_0x215d('0x0')]=function(_0x5e11c0){return client[_0x215d('0x1')]('CreateFaxQueueReport',{'body':_0x5e11c0,'log':_0x215d('0x2')});};exports['update']=function(_0x5d5ac3,_0x4c53b3){return client['Request'](_0x215d('0x3'),{'body':_0x4c53b3,'options':{'where':{'uniqueid':_0x5d5ac3},'order':[['id',_0x215d('0x4')]],'limit':0x1},'log':_0x215d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2c8c731..d71aca0 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 _0x6017=['getIntervals','Request','name','Interval','../client'];(function(_0x183d0e,_0x1f520f){var _0x278ff8=function(_0x49b6d1){while(--_0x49b6d1){_0x183d0e['push'](_0x183d0e['shift']());}};_0x278ff8(++_0x1f520f);}(_0x6017,0xae));var _0x7601=function(_0x1a7b57,_0x58320e){_0x1a7b57=_0x1a7b57-0x0;var _0x217b5c=_0x6017[_0x1a7b57];return _0x217b5c;};'use strict';var client=require(_0x7601('0x0'));exports[_0x7601('0x1')]=function(){return function(){return client[_0x7601('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7601('0x3')],'include':[{'model':_0x7601('0x4'),'as':'Intervals','attributes':['id',_0x7601('0x3'),'interval']}]},'log':_0x7601('0x1')});};}; \ No newline at end of file +var _0xc901=['interval','getIntervals','../client','Interval','Intervals'];(function(_0xec155c,_0x96cee0){var _0x57b458=function(_0x4ca652){while(--_0x4ca652){_0xec155c['push'](_0xec155c['shift']());}};_0x57b458(++_0x96cee0);}(_0xc901,0x142));var _0x1c90=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc901[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x1c90('0x0'));exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1c90('0x1'),'as':_0x1c90('0x2'),'attributes':['id','name',_0x1c90('0x3')]}]},'log':_0x1c90('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 034d398..41008f2 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 _0x6b37=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','../client'];(function(_0x3d95dd,_0xe01cf3){var _0x53632c=function(_0x23424a){while(--_0x23424a){_0x3d95dd['push'](_0x3d95dd['shift']());}};_0x53632c(++_0xe01cf3);}(_0x6b37,0xa7));var _0x76b3=function(_0x3593aa,_0x2c44fe){_0x3593aa=_0x3593aa-0x0;var _0x3f2dd5=_0x6b37[_0x3593aa];return _0x3f2dd5;};'use strict';var client=require(_0x76b3('0x0'));exports[_0x76b3('0x1')]=function(_0x3e1b74,_0x3e59be){return client[_0x76b3('0x2')](_0x76b3('0x3'),{'body':_0x3e59be,'options':{'where':{'id':_0x3e1b74}},'log':_0x76b3('0x4')});};exports['addTags']=function(_0x463428,_0x581dfa){return client['Request'](_0x76b3('0x5'),{'body':_0x581dfa,'options':{'where':{'id':_0x463428}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x5691=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','../client'];(function(_0x5400df,_0x3f8bce){var _0x4e5f77=function(_0xcd2eec){while(--_0xcd2eec){_0x5400df['push'](_0x5400df['shift']());}};_0x4e5f77(++_0x3f8bce);}(_0x5691,0x19d));var _0x1569=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5691[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1569('0x0'));exports[_0x1569('0x1')]=function(_0x18f345,_0x352c82){return client[_0x1569('0x2')](_0x1569('0x3'),{'body':_0x352c82,'options':{'where':{'id':_0x18f345}},'log':_0x1569('0x4')});};exports['addTags']=function(_0x52c552,_0x1fcc42){return client[_0x1569('0x2')](_0x1569('0x5'),{'body':_0x1fcc42,'options':{'where':{'id':_0x52c552}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2273ea3..d5965db 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 _0xf3e1=['create','createMailMessage','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3e1,0x83));var _0x1f3e=function(_0x57d311,_0x1d4157){_0x57d311=_0x57d311-0x0;var _0x23ae1b=_0xf3e1[_0x57d311];return _0x23ae1b;};'use strict';var client=require(_0x1f3e('0x0'));exports[_0x1f3e('0x1')]=function(_0x5eaa2b){return client['Request']('CreateMailMessage',{'body':_0x5eaa2b,'log':_0x1f3e('0x2')});}; \ No newline at end of file +var _0x121a=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x46d43f,_0x16ec5e){var _0x21d4c0=function(_0x5620f6){while(--_0x5620f6){_0x46d43f['push'](_0x46d43f['shift']());}};_0x21d4c0(++_0x16ec5e);}(_0x121a,0x148));var _0xa121=function(_0x27c7af,_0xf08b4c){_0x27c7af=_0x27c7af-0x0;var _0x5d1322=_0x121a[_0x27c7af];return _0x5d1322;};'use strict';var client=require('../client');exports[_0xa121('0x0')]=function(_0x43c021){return client[_0xa121('0x1')](_0xa121('0x2'),{'body':_0x43c021,'log':_0xa121('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7988509..bb4653b 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 _0x0593=['name','timeout','mailPause','../client','getMailQueues','Request'];(function(_0x1b2a77,_0x312098){var _0x4d78b6=function(_0x27da8a){while(--_0x27da8a){_0x1b2a77['push'](_0x1b2a77['shift']());}};_0x4d78b6(++_0x312098);}(_0x0593,0x189));var _0x3059=function(_0x2addec,_0x469ad0){_0x2addec=_0x2addec-0x0;var _0x361042=_0x0593[_0x2addec];return _0x361042;};'use strict';var client=require(_0x3059('0x0'));exports[_0x3059('0x1')]=function(){return function(){return client[_0x3059('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x3059('0x3'),_0x3059('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x3059('0x3'),'online',_0x3059('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x278f=['GetMailQueue','name','strategy','User','online','mailPause','../client','getMailQueues','Request'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x278f,0x126));var _0xf278=function(_0x2a83de,_0x51d41d){_0x2a83de=_0x2a83de-0x0;var _0x421de0=_0x278f[_0x2a83de];return _0x421de0;};'use strict';var client=require(_0xf278('0x0'));exports[_0xf278('0x1')]=function(){return function(){return client[_0xf278('0x2')](_0xf278('0x3'),{'options':{'raw':![],'attributes':['id',_0xf278('0x4'),'timeout',_0xf278('0x5')],'include':[{'model':_0xf278('0x6'),'as':'Agents','attributes':['id',_0xf278('0x4'),_0xf278('0x7'),_0xf278('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 702f864..9836800 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 _0xcfa3=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xcfa3,0x112));var _0x3cfa=function(_0x219297,_0x32b851){_0x219297=_0x219297-0x0;var _0x1a1a85=_0xcfa3[_0x219297];return _0x1a1a85;};'use strict';var client=require(_0x3cfa('0x0'));exports[_0x3cfa('0x1')]=function(_0x2e1989){return client[_0x3cfa('0x2')]('CreateMailQueueReport',{'body':_0x2e1989,'log':_0x3cfa('0x3')});};exports[_0x3cfa('0x4')]=function(_0x2bd33c,_0x56300d){return client[_0x3cfa('0x2')](_0x3cfa('0x5'),{'body':_0x56300d,'options':{'where':{'uniqueid':_0x2bd33c},'order':[['id',_0x3cfa('0x6')]],'limit':0x1},'log':_0x3cfa('0x5')});}; \ No newline at end of file +var _0xb203=['DESC','../client','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb203,0xbf));var _0x3b20=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb203[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0x3b20('0x0'));exports['create']=function(_0x3f171f){return client['Request'](_0x3b20('0x1'),{'body':_0x3f171f,'log':_0x3b20('0x1')});};exports[_0x3b20('0x2')]=function(_0x82be1b,_0x4fbbd2){return client['Request'](_0x3b20('0x3'),{'body':_0x4fbbd2,'options':{'where':{'uniqueid':_0x82be1b},'order':[['id',_0x3b20('0x4')]],'limit':0x1},'log':_0x3b20('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e8c01d6..9edc27e 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 _0x990d=['../client','update','UpdateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x990d,0x16c));var _0xd990=function(_0xe326ae,_0x49dd64){_0xe326ae=_0xe326ae-0x0;var _0x2bde3c=_0x990d[_0xe326ae];return _0x2bde3c;};'use strict';var client=require(_0xd990('0x0'));exports[_0xd990('0x1')]=function(_0x1b6648,_0x18e8b4){return client['Request'](_0xd990('0x2'),{'body':_0x18e8b4,'options':{'where':{'id':_0x1b6648}},'log':'updateOpenchannelInteraction'});};exports[_0xd990('0x3')]=function(_0x2cd5da,_0x4e3ee4){return client[_0xd990('0x4')](_0xd990('0x5'),{'body':_0x4e3ee4,'options':{'where':{'id':_0x2cd5da}},'log':_0xd990('0x6')});}; \ No newline at end of file +var _0xb25f=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xb25f,0x69));var _0xfb25=function(_0x3421a3,_0x420907){_0x3421a3=_0x3421a3-0x0;var _0x43938a=_0xb25f[_0x3421a3];return _0x43938a;};'use strict';var client=require('../client');exports[_0xfb25('0x0')]=function(_0x4c75d7,_0x43d3ff){return client[_0xfb25('0x1')](_0xfb25('0x2'),{'body':_0x43d3ff,'options':{'where':{'id':_0x4c75d7}},'log':_0xfb25('0x3')});};exports[_0xfb25('0x4')]=function(_0x44fefd,_0x291c1a){return client[_0xfb25('0x1')](_0xfb25('0x5'),{'body':_0x291c1a,'options':{'where':{'id':_0x44fefd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 06b5cfc..1cb7333 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 _0x5b02=['create','Request','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x558d3c,_0xe9e9f8){_0x558d3c=_0x558d3c-0x0;var _0x1d7694=_0x5b02[_0x558d3c];return _0x1d7694;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(_0x428458){return client[_0x25b0('0x2')]('CreateOpenchannelMessage',{'body':_0x428458,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xdace=['Request','CreateOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xc5));var _0xedac=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0xdace[_0x58175c];return _0x55b88f;};'use strict';var client=require(_0xedac('0x0'));exports['create']=function(_0x1c76b2){return client[_0xedac('0x1')](_0xedac('0x2'),{'body':_0x1c76b2,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index bfd8637..d925e20 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 _0x757e=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x40ac95,_0x3ddaf7){var _0x3b1c1c=function(_0x5054a4){while(--_0x5054a4){_0x40ac95['push'](_0x40ac95['shift']());}};_0x3b1c1c(++_0x3ddaf7);}(_0x757e,0xf0));var _0xe757=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x757e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe757('0x0'));exports[_0xe757('0x1')]=function(){return function(){return client[_0xe757('0x2')](_0xe757('0x3'),{'options':{'raw':![],'attributes':['id',_0xe757('0x4'),_0xe757('0x5'),_0xe757('0x6')],'include':[{'model':_0xe757('0x7'),'as':_0xe757('0x8'),'attributes':['id',_0xe757('0x4'),_0xe757('0x9'),_0xe757('0xa')]}]},'log':_0xe757('0x1')});};}; \ No newline at end of file +var _0xecf3=['Request','name','timeout','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0xecf3,0x1d6));var _0x3ecf=function(_0x1a72de,_0x374618){_0x1a72de=_0x1a72de-0x0;var _0x84d48=_0xecf3[_0x1a72de];return _0x84d48;};'use strict';var client=require(_0x3ecf('0x0'));exports[_0x3ecf('0x1')]=function(){return function(){return client[_0x3ecf('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x3ecf('0x3'),_0x3ecf('0x4'),'strategy'],'include':[{'model':'User','as':_0x3ecf('0x5'),'attributes':['id',_0x3ecf('0x3'),_0x3ecf('0x6'),_0x3ecf('0x7')]}]},'log':_0x3ecf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9961cfb..39894f5 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 _0x1359=['update','UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1359,0x1e9));var _0x9135=function(_0x1b7a1e,_0x5306ac){_0x1b7a1e=_0x1b7a1e-0x0;var _0x146d2e=_0x1359[_0x1b7a1e];return _0x146d2e;};'use strict';var client=require('../client');exports[_0x9135('0x0')]=function(_0x2bff72){return client[_0x9135('0x1')](_0x9135('0x2'),{'body':_0x2bff72,'log':_0x9135('0x2')});};exports[_0x9135('0x3')]=function(_0x5c6e3f,_0x511b01){return client['Request'](_0x9135('0x4'),{'body':_0x511b01,'options':{'where':{'uniqueid':_0x5c6e3f},'order':[['id',_0x9135('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xc480=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0xc480,0xe9));var _0x0c48=function(_0x599405,_0x1ab5d2){_0x599405=_0x599405-0x0;var _0x300afb=_0xc480[_0x599405];return _0x300afb;};'use strict';var client=require(_0x0c48('0x0'));exports[_0x0c48('0x1')]=function(_0x2ce0b5){return client[_0x0c48('0x2')]('CreateOpenchannelQueueReport',{'body':_0x2ce0b5,'log':_0x0c48('0x3')});};exports[_0x0c48('0x4')]=function(_0x8f4266,_0xbe073e){return client[_0x0c48('0x2')](_0x0c48('0x5'),{'body':_0xbe073e,'options':{'where':{'uniqueid':_0x8f4266},'order':[['id','DESC']],'limit':0x1},'log':_0x0c48('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 74822ec..c5b7a48 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 _0xc023=['updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc023,0x162));var _0x3c02=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0xc023[_0x1a7edf];return _0x56c1d9;};'use strict';var client=require('../client');exports['update']=function(_0x185088,_0x44bea7){return client['Request']('UpdateSmsInteraction',{'body':_0x44bea7,'options':{'where':{'id':_0x185088}},'log':_0x3c02('0x0')});};exports[_0x3c02('0x1')]=function(_0x2808d1,_0xd7ca63){return client['Request']('AddTagsToSmsInteraction',{'body':_0xd7ca63,'options':{'where':{'id':_0x2808d1}},'log':_0x3c02('0x2')});}; \ No newline at end of file +var _0xabf8=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x5c0b82,_0x458661){var _0x360c5e=function(_0x1a72c3){while(--_0x1a72c3){_0x5c0b82['push'](_0x5c0b82['shift']());}};_0x360c5e(++_0x458661);}(_0xabf8,0x197));var _0x8abf=function(_0x2b057f,_0x15991c){_0x2b057f=_0x2b057f-0x0;var _0x51c776=_0xabf8[_0x2b057f];return _0x51c776;};'use strict';var client=require('../client');exports[_0x8abf('0x0')]=function(_0x1fbd02,_0x16f66a){return client[_0x8abf('0x1')](_0x8abf('0x2'),{'body':_0x16f66a,'options':{'where':{'id':_0x1fbd02}},'log':_0x8abf('0x3')});};exports[_0x8abf('0x4')]=function(_0x4ad113,_0x4efa4a){return client[_0x8abf('0x1')](_0x8abf('0x5'),{'body':_0x4efa4a,'options':{'where':{'id':_0x4ad113}},'log':_0x8abf('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 6a63cea..c5d5ff9 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 _0x28a1=['create','CreateSmsMessage','createSmsMessage','../client'];(function(_0x304107,_0xa47eaf){var _0x43d4af=function(_0x1d88b8){while(--_0x1d88b8){_0x304107['push'](_0x304107['shift']());}};_0x43d4af(++_0xa47eaf);}(_0x28a1,0x7b));var _0x128a=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x28a1[_0x2ca616];return _0x53155f;};'use strict';var client=require(_0x128a('0x0'));exports[_0x128a('0x1')]=function(_0x4decd1){return client['Request'](_0x128a('0x2'),{'body':_0x4decd1,'log':_0x128a('0x3')});}; \ No newline at end of file +var _0x4bd7=['create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4bd7,0x13e));var _0x74bd=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x4bd7[_0x42bb6d];return _0x1db89b;};'use strict';var client=require('../client');exports[_0x74bd('0x0')]=function(_0x1554f1){return client['Request']('CreateSmsMessage',{'body':_0x1554f1,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2dbe836..4461794 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 _0x0a9f=['name','strategy','online','smsPause','../client','getSmsQueues','GetSmsQueue'];(function(_0x200d3e,_0x34149b){var _0x2dc8b4=function(_0x311d2e){while(--_0x311d2e){_0x200d3e['push'](_0x200d3e['shift']());}};_0x2dc8b4(++_0x34149b);}(_0x0a9f,0x169));var _0xf0a9=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x0a9f[_0x68c979];return _0x4f0001;};'use strict';var client=require(_0xf0a9('0x0'));exports[_0xf0a9('0x1')]=function(){return function(){return client['Request'](_0xf0a9('0x2'),{'options':{'raw':![],'attributes':['id',_0xf0a9('0x3'),'timeout',_0xf0a9('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xf0a9('0x5'),_0xf0a9('0x6')]}]},'log':_0xf0a9('0x1')});};}; \ No newline at end of file +var _0x8745=['../client','getSmsQueues','GetSmsQueue','name','strategy','User','online','smsPause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8745,0xc8));var _0x5874=function(_0x327a9d,_0x3b3004){_0x327a9d=_0x327a9d-0x0;var _0x5dba47=_0x8745[_0x327a9d];return _0x5dba47;};'use strict';var client=require(_0x5874('0x0'));exports[_0x5874('0x1')]=function(){return function(){return client['Request'](_0x5874('0x2'),{'options':{'raw':![],'attributes':['id',_0x5874('0x3'),'timeout',_0x5874('0x4')],'include':[{'model':_0x5874('0x5'),'as':'Agents','attributes':['id',_0x5874('0x3'),_0x5874('0x6'),_0x5874('0x7')]}]},'log':_0x5874('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f85c4a9..9dbce96 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 _0x68a5=['update','UpdateSmsQueueReport','../client','Request','CreateSmsQueueReport'];(function(_0x2ffee5,_0x4ce03c){var _0x41ee45=function(_0x4a3b44){while(--_0x4a3b44){_0x2ffee5['push'](_0x2ffee5['shift']());}};_0x41ee45(++_0x4ce03c);}(_0x68a5,0xfc));var _0x568a=function(_0x145a90,_0x3e5817){_0x145a90=_0x145a90-0x0;var _0x1ae743=_0x68a5[_0x145a90];return _0x1ae743;};'use strict';var client=require(_0x568a('0x0'));exports['create']=function(_0x21e4e6){return client[_0x568a('0x1')]('CreateSmsQueueReport',{'body':_0x21e4e6,'log':_0x568a('0x2')});};exports[_0x568a('0x3')]=function(_0x2f3a02,_0x2d4dce){return client['Request'](_0x568a('0x4'),{'body':_0x2d4dce,'options':{'where':{'uniqueid':_0x2f3a02},'order':[['id','DESC']],'limit':0x1},'log':_0x568a('0x4')});}; \ No newline at end of file +var _0xd65c=['update','Request','UpdateSmsQueueReport','../client','create','CreateSmsQueueReport'];(function(_0x3fd275,_0xf0cd7){var _0xe4f14f=function(_0x23971d){while(--_0x23971d){_0x3fd275['push'](_0x3fd275['shift']());}};_0xe4f14f(++_0xf0cd7);}(_0xd65c,0x177));var _0xcd65=function(_0x1e9f71,_0x156d9c){_0x1e9f71=_0x1e9f71-0x0;var _0x4f43ef=_0xd65c[_0x1e9f71];return _0x4f43ef;};'use strict';var client=require(_0xcd65('0x0'));exports[_0xcd65('0x1')]=function(_0x4fa1f4){return client['Request'](_0xcd65('0x2'),{'body':_0x4fa1f4,'log':_0xcd65('0x2')});};exports[_0xcd65('0x3')]=function(_0x445a71,_0x3d5811){return client[_0xcd65('0x4')](_0xcd65('0x5'),{'body':_0x3d5811,'options':{'where':{'uniqueid':_0x445a71},'order':[['id','DESC']],'limit':0x1},'log':_0xcd65('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5c5b942..68442af 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 _0x7211=['online','lastPauseAt','chatPause','faxPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','GetUser','agent','name'];(function(_0x59f977,_0x43a7c2){var _0x372f8a=function(_0x53e42c){while(--_0x53e42c){_0x59f977['push'](_0x59f977['shift']());}};_0x372f8a(++_0x43a7c2);}(_0x7211,0xbe));var _0x1721=function(_0x2df20f,_0x3b2c0e){_0x2df20f=_0x2df20f-0x0;var _0x4fa98b=_0x7211[_0x2df20f];return _0x4fa98b;};'use strict';var client=require(_0x1721('0x0'));exports[_0x1721('0x1')]=function(){return function(){return client['Request'](_0x1721('0x2'),{'options':{'raw':!![],'where':{'role':_0x1721('0x3')},'attributes':['id',_0x1721('0x4'),_0x1721('0x5'),'pauseType',_0x1721('0x6'),'voicePause',_0x1721('0x7'),'mailPause',_0x1721('0x8'),'smsPause',_0x1721('0x9'),_0x1721('0xa'),_0x1721('0xb'),'mailCapacity',_0x1721('0xc'),'smsCapacity',_0x1721('0xd'),_0x1721('0xe')]},'log':'getAgents'});};}; \ No newline at end of file +var _0xb3c9=['faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','agent','name','online','pauseType','voicePause','faxPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity'];(function(_0x114356,_0x561b7a){var _0xd46fa7=function(_0x4b93ef){while(--_0x4b93ef){_0x114356['push'](_0x114356['shift']());}};_0xd46fa7(++_0x561b7a);}(_0xb3c9,0xae));var _0x9b3c=function(_0x132287,_0x18a07a){_0x132287=_0x132287-0x0;var _0x30d15f=_0xb3c9[_0x132287];return _0x30d15f;};'use strict';var client=require(_0x9b3c('0x0'));exports[_0x9b3c('0x1')]=function(){return function(){return client[_0x9b3c('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x9b3c('0x3')},'attributes':['id',_0x9b3c('0x4'),_0x9b3c('0x5'),_0x9b3c('0x6'),'lastPauseAt',_0x9b3c('0x7'),'chatPause','mailPause',_0x9b3c('0x8'),'smsPause',_0x9b3c('0x9'),_0x9b3c('0xa'),_0x9b3c('0xb'),_0x9b3c('0xc'),_0x9b3c('0xd'),_0x9b3c('0xe'),_0x9b3c('0xf'),_0x9b3c('0x10')]},'log':_0x9b3c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 43a8d46..bc34159 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 _0xb0d9=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x26a1dc,_0x380fb3){var _0x529678=function(_0x2c8c14){while(--_0x2c8c14){_0x26a1dc['push'](_0x26a1dc['shift']());}};_0x529678(++_0x380fb3);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x255e48,_0x26f5b8){_0x255e48=_0x255e48-0x0;var _0x11c1a1=_0xb0d9[_0x255e48];return _0x11c1a1;};'use strict';var client=require(_0x9b0d('0x0'));exports[_0x9b0d('0x1')]=function(_0x42b875,_0x36bf09){return client[_0x9b0d('0x2')](_0x9b0d('0x3'),{'body':_0x36bf09,'options':{'where':{'id':_0x42b875}},'log':'updateWhatsappInteraction'});};exports[_0x9b0d('0x4')]=function(_0x5dd128,_0x4d327a){return client['Request'](_0x9b0d('0x5'),{'body':_0x4d327a,'options':{'where':{'id':_0x5dd128}},'log':_0x9b0d('0x6')});}; \ No newline at end of file +var _0xb7cf=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x57e7e2,_0x572a5f){var _0x158276=function(_0x368206){while(--_0x368206){_0x57e7e2['push'](_0x57e7e2['shift']());}};_0x158276(++_0x572a5f);}(_0xb7cf,0xca));var _0xfb7c=function(_0x379a70,_0x367de6){_0x379a70=_0x379a70-0x0;var _0x3ddaa4=_0xb7cf[_0x379a70];return _0x3ddaa4;};'use strict';var client=require(_0xfb7c('0x0'));exports[_0xfb7c('0x1')]=function(_0x3baed3,_0x2c52ed){return client[_0xfb7c('0x2')]('UpdateWhatsappInteraction',{'body':_0x2c52ed,'options':{'where':{'id':_0x3baed3}},'log':_0xfb7c('0x3')});};exports[_0xfb7c('0x4')]=function(_0xf6b92f,_0xf47c1d){return client[_0xfb7c('0x2')](_0xfb7c('0x5'),{'body':_0xf47c1d,'options':{'where':{'id':_0xf6b92f}},'log':_0xfb7c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 701ce44..1d226a5 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 _0x16da=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0xdfcb16,_0x5ef1fb){var _0x2d1f6d=function(_0x456e7a){while(--_0x456e7a){_0xdfcb16['push'](_0xdfcb16['shift']());}};_0x2d1f6d(++_0x5ef1fb);}(_0x16da,0x7b));var _0xa16d=function(_0x1c09c3,_0xe71cf0){_0x1c09c3=_0x1c09c3-0x0;var _0x5be371=_0x16da[_0x1c09c3];return _0x5be371;};'use strict';var client=require('../client');exports[_0xa16d('0x0')]=function(_0x3afb30){return client[_0xa16d('0x1')](_0xa16d('0x2'),{'body':_0x3afb30,'log':_0xa16d('0x3')});}; \ No newline at end of file +var _0x9735=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x156fa7,_0x1cd43e){var _0x2c5611=function(_0x549ce2){while(--_0x549ce2){_0x156fa7['push'](_0x156fa7['shift']());}};_0x2c5611(++_0x1cd43e);}(_0x9735,0x66));var _0x5973=function(_0x3424a6,_0x408497){_0x3424a6=_0x3424a6-0x0;var _0x4f9435=_0x9735[_0x3424a6];return _0x4f9435;};'use strict';var client=require(_0x5973('0x0'));exports[_0x5973('0x1')]=function(_0x32e579){return client[_0x5973('0x2')](_0x5973('0x3'),{'body':_0x32e579,'log':_0x5973('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 4bb9825..fbc2f69 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 _0xe1e3=['name','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','strategy','Agents'];(function(_0xface3,_0x2dc754){var _0x554771=function(_0x529416){while(--_0x529416){_0xface3['push'](_0xface3['shift']());}};_0x554771(++_0x2dc754);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x2938c9,_0x1ccaa2){_0x2938c9=_0x2938c9-0x0;var _0x38937c=_0xe1e3[_0x2938c9];return _0x38937c;};'use strict';var client=require(_0x3e1e('0x0'));exports[_0x3e1e('0x1')]=function(){return function(){return client['Request'](_0x3e1e('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x3e1e('0x3')],'include':[{'model':'User','as':_0x3e1e('0x4'),'attributes':['id',_0x3e1e('0x5'),_0x3e1e('0x6'),_0x3e1e('0x7')]}]},'log':_0x3e1e('0x1')});};}; \ No newline at end of file +var _0x4213=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause','../client'];(function(_0x178a53,_0x40fb5f){var _0x527ef1=function(_0x10da52){while(--_0x10da52){_0x178a53['push'](_0x178a53['shift']());}};_0x527ef1(++_0x40fb5f);}(_0x4213,0x77));var _0x3421=function(_0x571c2b,_0x222591){_0x571c2b=_0x571c2b-0x0;var _0x1163b5=_0x4213[_0x571c2b];return _0x1163b5;};'use strict';var client=require(_0x3421('0x0'));exports[_0x3421('0x1')]=function(){return function(){return client[_0x3421('0x2')](_0x3421('0x3'),{'options':{'raw':![],'attributes':['id',_0x3421('0x4'),_0x3421('0x5'),_0x3421('0x6')],'include':[{'model':'User','as':_0x3421('0x7'),'attributes':['id','name',_0x3421('0x8'),_0x3421('0x9')]}]},'log':_0x3421('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c9eff34..1566720 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 _0xf2ac=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0xf2ac,0x9e));var _0xcf2a=function(_0x30f47f,_0x4a77b4){_0x30f47f=_0x30f47f-0x0;var _0x14af65=_0xf2ac[_0x30f47f];return _0x14af65;};'use strict';var client=require(_0xcf2a('0x0'));exports[_0xcf2a('0x1')]=function(_0x283d53){return client[_0xcf2a('0x2')](_0xcf2a('0x3'),{'body':_0x283d53,'log':_0xcf2a('0x3')});};exports[_0xcf2a('0x4')]=function(_0x392593,_0x82f9bb){return client[_0xcf2a('0x2')](_0xcf2a('0x5'),{'body':_0x82f9bb,'options':{'where':{'uniqueid':_0x392593},'order':[['id',_0xcf2a('0x6')]],'limit':0x1},'log':_0xcf2a('0x5')});}; \ No newline at end of file +var _0x3af6=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','Request'];(function(_0x5a89ea,_0x436388){var _0x21193d=function(_0x1a9118){while(--_0x1a9118){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x21193d(++_0x436388);}(_0x3af6,0x144));var _0x63af=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3af6[_0x2b4411];return _0x8e41ef;};'use strict';var client=require('../client');exports['create']=function(_0x3e20aa){return client[_0x63af('0x0')](_0x63af('0x1'),{'body':_0x3e20aa,'log':'CreateWhatsappQueueReport'});};exports[_0x63af('0x2')]=function(_0x17220e,_0x2a1297){return client[_0x63af('0x0')](_0x63af('0x3'),{'body':_0x2a1297,'options':{'where':{'uniqueid':_0x17220e},'order':[['id',_0x63af('0x4')]],'limit':0x1},'log':_0x63af('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 2ecb8c5..8285cb6 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 _0xd4ef=['validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','find','agents','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','info','[%s][AGENT]\x20ROUTING\x20END','agent','log','[%s][QUEUE]\x20%s','stack'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4ef,0xfc));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xfd4e('0x0'));var _=require(_0xfd4e('0x1'));var util=require('util');var seqqueue=require(_0xfd4e('0x2'));var logger=require(_0xfd4e('0x3'))(_0xfd4e('0x4'));var strategy=require(_0xfd4e('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xfd4e('0x6')},'timeout':{'type':_0xfd4e('0x7'),'message':_0xfd4e('0x8')}});function writeLog(_0x2f7f04,_0x37460d,_0x259026){return logger['info'](util[_0xfd4e('0x9')](_0xfd4e('0xa'),_0x2f7f04,_0x37460d[_0xfd4e('0xb')],_0x259026));}function handleFindAgent(_0x3fb509){return function(_0x30985d){return _0x30985d[_0xfd4e('0xb')][_0xfd4e('0xc')]()===_0x3fb509[_0xfd4e('0xc')]();};}exports['consequence']=function(_0x202bfe,_0x224c1a,_0x56423e,_0x454b45){return function(_0x128e65){try{var _0x36d037={'name':_0x224c1a[0x0],'timeout':_0x224c1a[0x1]};var _0x5165da=queue['validate'](_0x36d037,{'typecast':!![]});if(_0x5165da[_0xfd4e('0xd')]){logger['error'](_0xfd4e('0xe'),_0x202bfe,_[_0xfd4e('0xf')](_0x5165da,_0xfd4e('0x10'))[_0xfd4e('0x11')](',\x20'));_0x128e65['stop']();}else{var _0x526275=_[_0xfd4e('0x12')](_0x56423e[_0xfd4e('0x13')],handleFindAgent(_0x36d037[_0xfd4e('0xb')]));if(_0x526275){var _0x45c5d5=(_0x36d037['timeout']||0xa)*0x3e8;var _0x32cd33,_0xa63981;var _0x2c7b6f=seqqueue[_0xfd4e('0x14')](_0x45c5d5);_0x2c7b6f['id']=_0x202bfe;_0x2c7b6f[_0xfd4e('0x15')]=_0x45c5d5;_0x2c7b6f[_0xfd4e('0x16')]=_0x454b45['channel'];writeLog(_0x202bfe,_0x526275,util[_0xfd4e('0x9')](_0xfd4e('0x17'),_0x45c5d5));_0x56423e['rules'][_0x202bfe]['on'](_0xfd4e('0x18'),function(){logger['info'](_0xfd4e('0x19'),_0x202bfe);clearTimeout(_0xa63981);_0xa63981=undefined;_0x2c7b6f[_0xfd4e('0x1a')]();if(_0x56423e[_0xfd4e('0x1b')][_0x202bfe]){delete _0x56423e['rules'][_0x202bfe];}_0x128e65[_0xfd4e('0x1c')]();});_0x56423e[_0xfd4e('0x1b')][_0x202bfe]['on'](_0xfd4e('0x1d'),function(){if(_0x56423e['rules'][_0x202bfe]){delete _0x56423e[_0xfd4e('0x1b')][_0x202bfe];}});_0xa63981=setTimeout(function(){logger[_0xfd4e('0x1e')](_0xfd4e('0x1f'),_0x202bfe);clearTimeout(_0xa63981);_0x2c7b6f[_0xfd4e('0x1a')]();_0x128e65['next']();},_0x45c5d5);strategy[_0xfd4e('0x20')](_0x2c7b6f,_0x526275,_0x56423e,_0x454b45);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x202bfe,_0x36d037[_0xfd4e('0xb')]);_0x128e65[_0xfd4e('0x1c')]();}}}catch(_0x13996c){console[_0xfd4e('0x21')](_0x13996c);logger['error'](_0xfd4e('0x22'),_0x202bfe,_0x13996c[_0xfd4e('0x23')]);_0x128e65[_0xfd4e('0x1c')]();}};}; \ No newline at end of file +var _0x897c=['find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','join'];(function(_0x58c8e6,_0x5058ab){var _0xc26b2c=function(_0x2ddb62){while(--_0x2ddb62){_0x58c8e6['push'](_0x58c8e6['shift']());}};_0xc26b2c(++_0x5058ab);}(_0x897c,0x79));var _0xc897=function(_0x34bb7e,_0x4515d0){_0x34bb7e=_0x34bb7e-0x0;var _0x222d89=_0x897c[_0x34bb7e];return _0x222d89;};'use strict';var schema=require(_0xc897('0x0'));var _=require(_0xc897('0x1'));var util=require(_0xc897('0x2'));var seqqueue=require(_0xc897('0x3'));var logger=require(_0xc897('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xc897('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2f6d36,_0x3559ff,_0xfe4241){return logger[_0xc897('0x6')](util['format'](_0xc897('0x7'),_0x2f6d36,_0x3559ff[_0xc897('0x8')],_0xfe4241));}function handleFindAgent(_0x2d4727){return function(_0x55d2a7){return _0x55d2a7['name'][_0xc897('0x9')]()===_0x2d4727[_0xc897('0x9')]();};}exports[_0xc897('0xa')]=function(_0x3e02d1,_0x277e33,_0x3b4c1a,_0x51265b){return function(_0x1f8395){try{var _0x7a9552={'name':_0x277e33[0x0],'timeout':_0x277e33[0x1]};var _0x247dbd=queue[_0xc897('0x0')](_0x7a9552,{'typecast':!![]});if(_0x247dbd[_0xc897('0xb')]){logger[_0xc897('0xc')]('[%s][AGENT]\x20%s',_0x3e02d1,_[_0xc897('0xd')](_0x247dbd,'message')[_0xc897('0xe')](',\x20'));_0x1f8395['stop']();}else{var _0x1e9a0e=_[_0xc897('0xf')](_0x3b4c1a[_0xc897('0x10')],handleFindAgent(_0x7a9552['name']));if(_0x1e9a0e){var _0x1038f2=(_0x7a9552[_0xc897('0x11')]||0xa)*0x3e8;var _0x42fff5,_0x4d1e71;var _0x9b19d=seqqueue[_0xc897('0x12')](_0x1038f2);_0x9b19d['id']=_0x3e02d1;_0x9b19d[_0xc897('0x13')]=_0x1038f2;_0x9b19d[_0xc897('0x14')]=_0x51265b[_0xc897('0x14')];writeLog(_0x3e02d1,_0x1e9a0e,util[_0xc897('0x15')](_0xc897('0x16'),_0x1038f2));_0x3b4c1a[_0xc897('0x17')][_0x3e02d1]['on'](_0xc897('0x18'),function(){logger[_0xc897('0x6')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3e02d1);clearTimeout(_0x4d1e71);_0x4d1e71=undefined;_0x9b19d[_0xc897('0x19')]();if(_0x3b4c1a[_0xc897('0x17')][_0x3e02d1]){delete _0x3b4c1a[_0xc897('0x17')][_0x3e02d1];}_0x1f8395[_0xc897('0x1a')]();});_0x3b4c1a[_0xc897('0x17')][_0x3e02d1]['on'](_0xc897('0x1b'),function(){if(_0x3b4c1a[_0xc897('0x17')][_0x3e02d1]){delete _0x3b4c1a[_0xc897('0x17')][_0x3e02d1];}});_0x4d1e71=setTimeout(function(){logger['info'](_0xc897('0x1c'),_0x3e02d1);clearTimeout(_0x4d1e71);_0x9b19d[_0xc897('0x19')]();_0x1f8395[_0xc897('0x1d')]();},_0x1038f2);strategy[_0xc897('0x1e')](_0x9b19d,_0x1e9a0e,_0x3b4c1a,_0x51265b);}else{logger['error'](_0xc897('0x1f'),_0x3e02d1,_0x7a9552['name']);_0x1f8395[_0xc897('0x1a')]();}}}catch(_0x180826){console[_0xc897('0x20')](_0x180826);logger['error']('[%s][QUEUE]\x20%s',_0x3e02d1,_0x180826[_0xc897('0x21')]);_0x1f8395['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 96ae4da..9c2b7d5 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 _0x6acd=['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','out','channel','sms','whatsapp','phone','chat','account','AccountId','InteractionId','created','isEmpty','body','Message','create','then','catch','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','error','message','amazonlex','providerName','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0xd0758d,_0x4f18ce){var _0x4cb907=function(_0x3c2edd){while(--_0x3c2edd){_0xd0758d['push'](_0xd0758d['shift']());}};_0x4cb907(++_0x4f18ce);}(_0x6acd,0x1bf));var _0xd6ac=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6acd[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd6ac('0x0'));var moment=require(_0xd6ac('0x1'));var AWS=require(_0xd6ac('0x2'));var utils=require(_0xd6ac('0x3'));var logger=require('../../../../config/logger')(_0xd6ac('0x4'));var rpc={'chatMessage':require(_0xd6ac('0x5')),'openchannelMessage':require(_0xd6ac('0x6')),'mailMessage':require(_0xd6ac('0x7')),'smsMessage':require(_0xd6ac('0x8')),'faxMessage':require(_0xd6ac('0x9')),'whatsappMessage':require(_0xd6ac('0xa'))};exports[_0xd6ac('0xb')]=function(_0x5b7a07,_0x2c9a7a){return function(_0x5e3460){try{if(!_['isNil'](this[_0xd6ac('0xc')][_0xd6ac('0xd')])){logger[_0xd6ac('0xe')](_0xd6ac('0xf'),_0x5b7a07,_0xd6ac('0x10'));return _0x5e3460[_0xd6ac('0x11')]();}var _0x362dc5={'ContactId':this[_0xd6ac('0x12')]['id'],'sentAt':moment()[_0xd6ac('0x13')](_0xd6ac('0x14')),'direction':_0xd6ac('0x15')};if(this[_0xd6ac('0x16')]===_0xd6ac('0x17')||this['channel']===_0xd6ac('0x18')){_0x362dc5[_0xd6ac('0x19')]=this['interaction'][_0xd6ac('0x19')];}var _0x2fc80c=this[_0xd6ac('0x16')];if(_0x2fc80c===_0xd6ac('0x1a')){_0x362dc5['ChatWebsiteId']=this[_0xd6ac('0x1b')]['id'];}else{_0x362dc5[_['upperFirst'](_0x2fc80c)+_0xd6ac('0x1c')]=this['account']['id'];}_0x362dc5[_['upperFirst'](_0x2fc80c)+_0xd6ac('0x1d')]=this[_0xd6ac('0xc')]['id'];if(this['interaction'][_0xd6ac('0x1e')]){var _0x4d22b1=_0x2c9a7a[0x4];if(!_[_0xd6ac('0x1f')](_0x4d22b1)){_0x362dc5[_0xd6ac('0x20')]=utils['getMustacheRender'](_0x4d22b1,this);return rpc[_0x2fc80c+_0xd6ac('0x21')][_0xd6ac('0x22')](_0x362dc5)[_0xd6ac('0x23')](function(_0x474c52){logger['info'](_0xd6ac('0xf'),_0x5b7a07,_0x362dc5[_0xd6ac('0x20')]);})[_0xd6ac('0x24')](function(_0x306a85){logger['error'](_0xd6ac('0xf'),_0x5b7a07,JSON[_0xd6ac('0x25')](_0x306a85));})['finally'](function(){logger[_0xd6ac('0xe')](_0xd6ac('0x26'),_0x5b7a07);_0x5e3460[_0xd6ac('0x27')]();});}else{logger[_0xd6ac('0xe')](_0xd6ac('0x28'),_0x5b7a07);_0x5e3460[_0xd6ac('0x27')]();}}else{var _0x2aa848=this;var _0x323682=new AWS[(_0xd6ac('0x29'))]({'accessKeyId':_0x2c9a7a[0x0],'secretAccessKey':_0x2c9a7a[0x1],'region':_0x2c9a7a[0x2]});var _0xd7a6fd={'botAlias':_0xd6ac('0x2a'),'botName':_0x2c9a7a[0x3],'inputText':this['message']['body'],'userId':this[_0xd6ac('0x16')]+':'+this['interaction']['id'][_0xd6ac('0x2b')]()};_0x323682[_0xd6ac('0x2c')](_0xd7a6fd,function(_0x112350,_0x381f7f){if(_0x112350){logger[_0xd6ac('0x2d')](_0xd6ac('0xf'),_0x5b7a07,_0x112350['message']);_0x5e3460[_0xd6ac('0x11')]();}else if(_0x381f7f&&_0x381f7f[_0xd6ac('0x2e')]){_0x2aa848[_0xd6ac('0x20')][_0xd6ac('0x2f')]=_0x381f7f;_0x362dc5[_0xd6ac('0x20')]=_0x381f7f['message'];_0x362dc5[_0xd6ac('0x30')]=_0xd6ac('0x2f');_0x362dc5['providerResponse']=JSON[_0xd6ac('0x25')](_0x381f7f);return rpc[_0x2fc80c+_0xd6ac('0x21')][_0xd6ac('0x22')](_0x362dc5)['then'](function(_0x106d9f){logger['info'](_0xd6ac('0xf'),_0x5b7a07,_0x362dc5[_0xd6ac('0x20')]);if(_0x381f7f[_0xd6ac('0x31')]==_0xd6ac('0x32')){_0x5e3460[_0xd6ac('0x11')]();}else{_0x5e3460['stop']();}})['catch'](function(_0x12f662){logger[_0xd6ac('0x2d')](_0xd6ac('0xf'),_0x5b7a07,JSON[_0xd6ac('0x25')](_0x12f662));_0x5e3460[_0xd6ac('0x11')]();});}else{_0x5e3460[_0xd6ac('0x11')]();}});}}catch(_0x42d27e){logger['error'](_0xd6ac('0xf'),_0x5b7a07,JSON[_0xd6ac('0x25')](_0x42d27e));_0x5e3460[_0xd6ac('0x27')]();}};}; \ No newline at end of file +var _0xe9bb=['message','toString','postText','amazonlex','providerName','stringify','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','catch','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe9bb,0x151));var _0xbe9b=function(_0xddf136,_0x1974ad){_0xddf136=_0xddf136-0x0;var _0x16e835=_0xe9bb[_0xddf136];return _0x16e835;};'use strict';var _=require(_0xbe9b('0x0'));var moment=require(_0xbe9b('0x1'));var AWS=require(_0xbe9b('0x2'));var utils=require('./utils');var logger=require(_0xbe9b('0x3'))(_0xbe9b('0x4'));var rpc={'chatMessage':require(_0xbe9b('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbe9b('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xbe9b('0x7'))};exports[_0xbe9b('0x8')]=function(_0x34a1bb,_0x124b9b){return function(_0x35efe7){try{if(!_['isNil'](this[_0xbe9b('0x9')][_0xbe9b('0xa')])){logger['info'](_0xbe9b('0xb'),_0x34a1bb,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x35efe7[_0xbe9b('0xc')]();}var _0x1ae39a={'ContactId':this[_0xbe9b('0xd')]['id'],'sentAt':moment()[_0xbe9b('0xe')](_0xbe9b('0xf')),'direction':_0xbe9b('0x10')};if(this['channel']===_0xbe9b('0x11')||this[_0xbe9b('0x12')]==='whatsapp'){_0x1ae39a[_0xbe9b('0x13')]=this[_0xbe9b('0x9')]['phone'];}var _0xe7fdde=this[_0xbe9b('0x12')];if(_0xe7fdde===_0xbe9b('0x14')){_0x1ae39a[_0xbe9b('0x15')]=this['account']['id'];}else{_0x1ae39a[_['upperFirst'](_0xe7fdde)+_0xbe9b('0x16')]=this['account']['id'];}_0x1ae39a[_[_0xbe9b('0x17')](_0xe7fdde)+_0xbe9b('0x18')]=this[_0xbe9b('0x9')]['id'];if(this[_0xbe9b('0x9')][_0xbe9b('0x19')]){var _0x195ed8=_0x124b9b[0x4];if(!_[_0xbe9b('0x1a')](_0x195ed8)){_0x1ae39a[_0xbe9b('0x1b')]=utils[_0xbe9b('0x1c')](_0x195ed8,this);return rpc[_0xe7fdde+'Message'][_0xbe9b('0x1d')](_0x1ae39a)[_0xbe9b('0x1e')](function(_0x40fa5e){logger[_0xbe9b('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x34a1bb,_0x1ae39a[_0xbe9b('0x1b')]);})[_0xbe9b('0x20')](function(_0x4fe0ea){logger[_0xbe9b('0x21')](_0xbe9b('0xb'),_0x34a1bb,JSON['stringify'](_0x4fe0ea));})[_0xbe9b('0x22')](function(){logger[_0xbe9b('0x1f')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x34a1bb);_0x35efe7[_0xbe9b('0x23')]();});}else{logger[_0xbe9b('0x1f')](_0xbe9b('0x24'),_0x34a1bb);_0x35efe7[_0xbe9b('0x23')]();}}else{var _0x194f52=this;var _0x5b6e69=new AWS[(_0xbe9b('0x25'))]({'accessKeyId':_0x124b9b[0x0],'secretAccessKey':_0x124b9b[0x1],'region':_0x124b9b[0x2]});var _0x150b7e={'botAlias':_0xbe9b('0x26'),'botName':_0x124b9b[0x3],'inputText':this[_0xbe9b('0x27')][_0xbe9b('0x1b')],'userId':this[_0xbe9b('0x12')]+':'+this['interaction']['id'][_0xbe9b('0x28')]()};_0x5b6e69[_0xbe9b('0x29')](_0x150b7e,function(_0x4f982b,_0x1f9f13){if(_0x4f982b){logger[_0xbe9b('0x21')](_0xbe9b('0xb'),_0x34a1bb,_0x4f982b[_0xbe9b('0x27')]);_0x35efe7['next']();}else if(_0x1f9f13&&_0x1f9f13['message']){_0x194f52['body'][_0xbe9b('0x2a')]=_0x1f9f13;_0x1ae39a[_0xbe9b('0x1b')]=_0x1f9f13[_0xbe9b('0x27')];_0x1ae39a[_0xbe9b('0x2b')]=_0xbe9b('0x2a');_0x1ae39a['providerResponse']=JSON[_0xbe9b('0x2c')](_0x1f9f13);return rpc[_0xe7fdde+'Message'][_0xbe9b('0x1d')](_0x1ae39a)[_0xbe9b('0x1e')](function(_0x5633ef){logger[_0xbe9b('0x1f')](_0xbe9b('0xb'),_0x34a1bb,_0x1ae39a['body']);if(_0x1f9f13[_0xbe9b('0x2d')]==_0xbe9b('0x2e')){_0x35efe7['next']();}else{_0x35efe7['stop']();}})[_0xbe9b('0x20')](function(_0x48d0d2){logger['error'](_0xbe9b('0xb'),_0x34a1bb,JSON[_0xbe9b('0x2c')](_0x48d0d2));_0x35efe7['next']();});}else{_0x35efe7['next']();}});}}catch(_0x5efbff){logger[_0xbe9b('0x21')](_0xbe9b('0xb'),_0x34a1bb,JSON[_0xbe9b('0x2c')](_0x5efbff));_0x35efe7['stop']();}};}; \ 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 f2d20d5..242dda1 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 _0xcd58=['../../mailRpc','consequence','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','Re:\x20','chat','upperFirst','account','InteractionId','Message','mail','Smtp','service','host','secure','authentication','auth','user','inReplyTo','messageId','html','replace','body','','headers','auto-replied','All','auto_reply','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','moment','./utils','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xcd58,0x125));var _0x8cd5=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0xcd58[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0x8cd5('0x0'));var moment=require(_0x8cd5('0x1'));var utils=require(_0x8cd5('0x2'));var logger=require('../../../../config/logger')(_0x8cd5('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8cd5('0x4')),'faxMessage':require(_0x8cd5('0x5')),'whatsappMessage':require(_0x8cd5('0x6'))};var mailRpc=require(_0x8cd5('0x7'));exports[_0x8cd5('0x8')]=function(_0x47ca4a,_0x24a8f6){return function(_0x1c43a1){try{if(_0x24a8f6[0x0]==='1'&&(_[_0x8cd5('0x9')](this[_0x8cd5('0xa')][_0x8cd5('0xb')])||!this[_0x8cd5('0xa')][_0x8cd5('0xb')])){logger['info'](_0x8cd5('0xc'),_0x47ca4a,_0x8cd5('0xd'));return _0x1c43a1[_0x8cd5('0xe')]();}var _0x4199a9=this[_0x8cd5('0xf')];var _0x2d9dca={'body':utils['getMustacheRender'](_0x24a8f6[0x1],this),'ContactId':this[_0x8cd5('0x10')]['id'],'sentAt':moment()[_0x8cd5('0x11')](_0x8cd5('0x12')),'direction':_0x8cd5('0x13')};if(this[_0x8cd5('0x14')]){_0x2d9dca['to']=this[_0x8cd5('0x14')]['from']||'';_0x2d9dca['cc']=this[_0x8cd5('0x14')]['cc']||'';_0x2d9dca[_0x8cd5('0x15')]=this[_0x8cd5('0x14')]['to']||'';_0x2d9dca[_0x8cd5('0x16')]=this[_0x8cd5('0x14')]['phone']||'';_0x2d9dca['read']=!![];if(this[_0x8cd5('0x14')]['subject']){_0x2d9dca[_0x8cd5('0x17')]='';_0x2d9dca[_0x8cd5('0x17')]+=_['startsWith'](this[_0x8cd5('0x14')][_0x8cd5('0x17')],'Re:')?'':_0x8cd5('0x18');_0x2d9dca['subject']+=this[_0x8cd5('0x14')][_0x8cd5('0x17')];}}if(this[_0x8cd5('0xf')]===_0x8cd5('0x19')){_0x2d9dca['ChatWebsiteId']=this['account']['id'];}else{_0x2d9dca[_[_0x8cd5('0x1a')](this[_0x8cd5('0xf')])+'AccountId']=this[_0x8cd5('0x1b')]['id'];}_0x2d9dca[_[_0x8cd5('0x1a')](this[_0x8cd5('0xf')])+_0x8cd5('0x1c')]=this[_0x8cd5('0xa')]['id'];if(rpc[this[_0x8cd5('0xf')]+_0x8cd5('0x1d')]){if(this['channel']===_0x8cd5('0x1e')){var _0x48a1c7={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x8cd5('0x1f')][_0x8cd5('0x20')]){_0x48a1c7[_0x8cd5('0x20')]=this['account']['Smtp'][_0x8cd5('0x20')];}else{_0x48a1c7[_0x8cd5('0x21')]=this[_0x8cd5('0x1b')]['Smtp'][_0x8cd5('0x21')];_0x48a1c7['port']=this['account']['Smtp']['port'];_0x48a1c7[_0x8cd5('0x22')]=this[_0x8cd5('0x1b')]['Smtp'][_0x8cd5('0x22')];}if(this[_0x8cd5('0x1b')][_0x8cd5('0x1f')][_0x8cd5('0x23')]){_0x48a1c7[_0x8cd5('0x24')]={'user':this[_0x8cd5('0x1b')][_0x8cd5('0x1f')][_0x8cd5('0x25')],'pass':this[_0x8cd5('0x1b')][_0x8cd5('0x1f')]['pass']};}_0x2d9dca[_0x8cd5('0x26')]=this[_0x8cd5('0x14')][_0x8cd5('0x27')];_0x2d9dca[_0x8cd5('0x28')]=''+_[_0x8cd5('0x29')](_0x2d9dca[_0x8cd5('0x2a')],'','body','','headers','auto-replied','All','auto_reply','sendMailMessage','then','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','created','interaction','info','Autoreply\x20already\x20sent','next','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','message','from','read','startsWith','subject','Re:','Re:\x20','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail'];(function(_0x2a5b15,_0x5aeb58){var _0x3d57c0=function(_0x381693){while(--_0x381693){_0x2a5b15['push'](_0x2a5b15['shift']());}};_0x3d57c0(++_0x5aeb58);}(_0x00dc,0xd1));var _0xc00d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00dc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc00d('0x0'));var moment=require(_0xc00d('0x1'));var utils=require(_0xc00d('0x2'));var logger=require(_0xc00d('0x3'))('routing');var rpc={'chatMessage':require(_0xc00d('0x4')),'openchannelMessage':require(_0xc00d('0x5')),'mailMessage':require(_0xc00d('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc00d('0x7')),'whatsappMessage':require(_0xc00d('0x8'))};var mailRpc=require(_0xc00d('0x9'));exports[_0xc00d('0xa')]=function(_0x482947,_0x3a1916){return function(_0x4fb195){try{if(_0x3a1916[0x0]==='1'&&(_['isNil'](this['interaction'][_0xc00d('0xb')])||!this[_0xc00d('0xc')][_0xc00d('0xb')])){logger[_0xc00d('0xd')]('[%s][AUTOREPLY]\x20%s',_0x482947,_0xc00d('0xe'));return _0x4fb195[_0xc00d('0xf')]();}var _0x5b914a=this['channel'];var _0x4153ed={'body':utils[_0xc00d('0x10')](_0x3a1916[0x1],this),'ContactId':this[_0xc00d('0x11')]['id'],'sentAt':moment()[_0xc00d('0x12')](_0xc00d('0x13')),'direction':'out'};if(this[_0xc00d('0x14')]){_0x4153ed['to']=this[_0xc00d('0x14')][_0xc00d('0x15')]||'';_0x4153ed['cc']=this['message']['cc']||'';_0x4153ed[_0xc00d('0x15')]=this['message']['to']||'';_0x4153ed['phone']=this['message']['phone']||'';_0x4153ed[_0xc00d('0x16')]=!![];if(this[_0xc00d('0x14')]['subject']){_0x4153ed['subject']='';_0x4153ed['subject']+=_[_0xc00d('0x17')](this[_0xc00d('0x14')][_0xc00d('0x18')],_0xc00d('0x19'))?'':_0xc00d('0x1a');_0x4153ed[_0xc00d('0x18')]+=this['message']['subject'];}}if(this[_0xc00d('0x1b')]==='chat'){_0x4153ed[_0xc00d('0x1c')]=this[_0xc00d('0x1d')]['id'];}else{_0x4153ed[_[_0xc00d('0x1e')](this[_0xc00d('0x1b')])+_0xc00d('0x1f')]=this[_0xc00d('0x1d')]['id'];}_0x4153ed[_[_0xc00d('0x1e')](this[_0xc00d('0x1b')])+_0xc00d('0x20')]=this[_0xc00d('0xc')]['id'];if(rpc[this[_0xc00d('0x1b')]+_0xc00d('0x21')]){if(this[_0xc00d('0x1b')]===_0xc00d('0x22')){var _0x152910={'tls':{'rejectUnauthorized':![]}};if(this[_0xc00d('0x1d')][_0xc00d('0x23')]['service']){_0x152910[_0xc00d('0x24')]=this[_0xc00d('0x1d')]['Smtp'][_0xc00d('0x24')];}else{_0x152910[_0xc00d('0x25')]=this[_0xc00d('0x1d')]['Smtp']['host'];_0x152910[_0xc00d('0x26')]=this['account'][_0xc00d('0x23')][_0xc00d('0x26')];_0x152910[_0xc00d('0x27')]=this[_0xc00d('0x1d')][_0xc00d('0x23')]['secure'];}if(this[_0xc00d('0x1d')][_0xc00d('0x23')]['authentication']){_0x152910[_0xc00d('0x28')]={'user':this[_0xc00d('0x1d')][_0xc00d('0x23')]['user'],'pass':this[_0xc00d('0x1d')][_0xc00d('0x23')][_0xc00d('0x29')]};}_0x4153ed['inReplyTo']=this[_0xc00d('0x14')][_0xc00d('0x2a')];_0x4153ed[_0xc00d('0x2b')]=_0xc00d('0x2c')+_['replace'](_0x4153ed[_0xc00d('0x2d')],_0xc00d('0x2e'),']+(>|$)/g,''),'priorityTrue':_0x239010[0x1],'priorityFalse':_0x239010[0x2]};var _0x1d0d2f=gotoif[_0xe5ff('0x8')](_0x1ab8b5,{'typecast':!![]});if(_0x1d0d2f[_0xe5ff('0x9')]){logger[_0xe5ff('0xa')](_0xe5ff('0xb'),_0x43d0bf,_[_0xe5ff('0xc')](_0x1d0d2f,_0xe5ff('0xd'))[_0xe5ff('0xe')](',\x20'));_0x469f04[_0xe5ff('0xf')]();}else{try{var _0x285057=eval('('+_0x1ab8b5['condition']+')');var _0x578f72=_0x285057?_0x1ab8b5[_0xe5ff('0x10')]:_0x1ab8b5[_0xe5ff('0x11')];logger['info'](_0xe5ff('0x12'),_0x43d0bf,_0x1ab8b5[_0xe5ff('0x13')],_0x285057,_0x578f72||_0xe5ff('0x14'));if(_0x578f72){var _0x1ec69b=_['findIndex'](_0x469f04[_0xe5ff('0x15')](),{'p':_0x578f72});if(_0x1ec69b>=0x0){logger[_0xe5ff('0x16')](_0xe5ff('0x17'),_0x43d0bf,_0x578f72||_0xe5ff('0x14'),_0x1ec69b);_0x469f04['next'](_0x1ec69b);}else{logger[_0xe5ff('0x16')](_0xe5ff('0x18'),_0x43d0bf,_0x578f72||_0xe5ff('0x14'));_0x469f04[_0xe5ff('0xf')]();}}else{_0x469f04[_0xe5ff('0x14')]();}}catch(_0x4bb8ce){logger['error'](_0xe5ff('0x19'),_0x43d0bf,_0x4bb8ce['message']);_0x469f04['stop']();}}}catch(_0x305980){logger[_0xe5ff('0xa')](_0xe5ff('0xb'),_0x43d0bf,JSON[_0xe5ff('0x1a')](_0x305980));_0x469f04[_0xe5ff('0xf')]();}};}; \ No newline at end of file +var _0xcf75=['join','stop','condition','priorityTrue','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','consequence','getMustacheRender','validate','length','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xcf75,0x19a));var _0x5cf7=function(_0x2bb7d7,_0x2d024e){_0x2bb7d7=_0x2bb7d7-0x0;var _0x480ae3=_0xcf75[_0x2bb7d7];return _0x480ae3;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x5cf7('0x0'));var utils=require(_0x5cf7('0x1'));var logger=require(_0x5cf7('0x2'))(_0x5cf7('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x5cf7('0x4')},'priorityTrue':{'type':'number','message':_0x5cf7('0x5')},'priorityFalse':{'type':_0x5cf7('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x5cf7('0x7')]=function(_0x3b8667,_0x32a704){return function(_0x25b4d7){try{var _0x5d28cd={'condition':htmlToText['fromString'](utils[_0x5cf7('0x8')](_0x32a704[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x32a704[0x1],'priorityFalse':_0x32a704[0x2]};var _0x2a629c=gotoif[_0x5cf7('0x9')](_0x5d28cd,{'typecast':!![]});if(_0x2a629c[_0x5cf7('0xa')]){logger[_0x5cf7('0xb')](_0x5cf7('0xc'),_0x3b8667,_[_0x5cf7('0xd')](_0x2a629c,_0x5cf7('0xe'))[_0x5cf7('0xf')](',\x20'));_0x25b4d7[_0x5cf7('0x10')]();}else{try{var _0x4e915f=eval('('+_0x5d28cd[_0x5cf7('0x11')]+')');var _0x40b172=_0x4e915f?_0x5d28cd[_0x5cf7('0x12')]:_0x5d28cd['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3b8667,_0x5d28cd[_0x5cf7('0x11')],_0x4e915f,_0x40b172||_0x5cf7('0x13'));if(_0x40b172){var _0x106b64=_[_0x5cf7('0x14')](_0x25b4d7['rules'](),{'p':_0x40b172});if(_0x106b64>=0x0){logger['info'](_0x5cf7('0x15'),_0x3b8667,_0x40b172||'next',_0x106b64);_0x25b4d7[_0x5cf7('0x13')](_0x106b64);}else{logger[_0x5cf7('0x16')](_0x5cf7('0x17'),_0x3b8667,_0x40b172||_0x5cf7('0x13'));_0x25b4d7[_0x5cf7('0x10')]();}}else{_0x25b4d7[_0x5cf7('0x13')]();}}catch(_0x2af578){logger['error'](_0x5cf7('0x18'),_0x3b8667,_0x2af578[_0x5cf7('0xe')]);_0x25b4d7[_0x5cf7('0x10')]();}}}catch(_0x18ae17){logger[_0x5cf7('0xb')]('[%s][GOTOIF]\x20%s',_0x3b8667,JSON['stringify'](_0x18ae17));_0x25b4d7[_0x5cf7('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 22df080..ffad001 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 _0xca9d=['lodash','../../../../config/logger','routing','consequence','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x1c0a79,_0x3494dd){var _0x16d4b4=function(_0x3b6505){while(--_0x3b6505){_0x1c0a79['push'](_0x1c0a79['shift']());}};_0x16d4b4(++_0x3494dd);}(_0xca9d,0xbb));var _0xdca9=function(_0x518de4,_0x25a6ba){_0x518de4=_0x518de4-0x0;var _0x56cc8d=_0xca9d[_0x518de4];return _0x56cc8d;};'use strict';var schema=require('validate');var _=require(_0xdca9('0x0'));var logger=require(_0xdca9('0x1'))(_0xdca9('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xdca9('0x3')]=function(_0x21d4ef,_0x358d9d){return function(_0x1db9af){try{var _0x1f67ed={'priority':_0x358d9d[0x0]};var _0x570e94=gotop['validate'](_0x1f67ed,{'typecast':!![]});if(_0x570e94[_0xdca9('0x4')]){logger[_0xdca9('0x5')](_0xdca9('0x6'),_0x21d4ef,_[_0xdca9('0x7')](_0x570e94,'message')[_0xdca9('0x8')](',\x20'));_0x1db9af[_0xdca9('0x9')]();}else{logger[_0xdca9('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x21d4ef,_0x1f67ed['priority']);if(_0x1f67ed[_0xdca9('0xb')]){var _0xe9a68e=_[_0xdca9('0xc')](_0x1db9af[_0xdca9('0xd')](),{'p':_0x1f67ed[_0xdca9('0xb')]});if(_0xe9a68e>=0x0){logger[_0xdca9('0xa')](_0xdca9('0xe'),_0x21d4ef,_0x1f67ed[_0xdca9('0xb')]||_0xdca9('0xf'),_0xe9a68e);_0x1db9af[_0xdca9('0xf')](_0xe9a68e);}else{logger['info'](_0xdca9('0x10'),_0x21d4ef,_0x1f67ed[_0xdca9('0xb')]||_0xdca9('0xf'));_0x1db9af[_0xdca9('0x9')]();}}else{_0x1db9af[_0xdca9('0xf')]();}}}catch(_0x494434){logger[_0xdca9('0x5')](_0xdca9('0x6'),_0x21d4ef,JSON['stringify'](_0x494434));_0x1db9af[_0xdca9('0x9')]();}};}; \ No newline at end of file +var _0x7dce=['map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s'];(function(_0x28d7b4,_0x3b1adf){var _0x4d5cde=function(_0x336ad5){while(--_0x336ad5){_0x28d7b4['push'](_0x28d7b4['shift']());}};_0x4d5cde(++_0x3b1adf);}(_0x7dce,0x15e));var _0xe7dc=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x7dce[_0x368bba];return _0x409f8f;};'use strict';var schema=require(_0xe7dc('0x0'));var _=require(_0xe7dc('0x1'));var logger=require(_0xe7dc('0x2'))(_0xe7dc('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xe7dc('0x4')}});exports['consequence']=function(_0x29be95,_0x586dc9){return function(_0x59b727){try{var _0xd833bd={'priority':_0x586dc9[0x0]};var _0x2c05db=gotop[_0xe7dc('0x0')](_0xd833bd,{'typecast':!![]});if(_0x2c05db['length']){logger[_0xe7dc('0x5')](_0xe7dc('0x6'),_0x29be95,_[_0xe7dc('0x7')](_0x2c05db,'message')[_0xe7dc('0x8')](',\x20'));_0x59b727[_0xe7dc('0x9')]();}else{logger[_0xe7dc('0xa')](_0xe7dc('0xb'),_0x29be95,_0xd833bd[_0xe7dc('0xc')]);if(_0xd833bd['priority']){var _0x36dde0=_[_0xe7dc('0xd')](_0x59b727['rules'](),{'p':_0xd833bd[_0xe7dc('0xc')]});if(_0x36dde0>=0x0){logger[_0xe7dc('0xa')](_0xe7dc('0xe'),_0x29be95,_0xd833bd[_0xe7dc('0xc')]||'next',_0x36dde0);_0x59b727['next'](_0x36dde0);}else{logger[_0xe7dc('0xa')](_0xe7dc('0xf'),_0x29be95,_0xd833bd[_0xe7dc('0xc')]||_0xe7dc('0x10'));_0x59b727[_0xe7dc('0x9')]();}}else{_0x59b727['next']();}}}catch(_0x303f78){logger[_0xe7dc('0x5')](_0xe7dc('0x6'),_0x29be95,JSON['stringify'](_0x303f78));_0x59b727[_0xe7dc('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 6e71833..1d542d9 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 _0xdcb3=['next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','account','upperFirst','channel','Message','create','info','body'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xdcb3,0x6a));var _0x3dcb=function(_0x10a622,_0x1804be){_0x10a622=_0x10a622-0x0;var _0x707210=_0xdcb3[_0x10a622];return _0x707210;};'use strict';var _=require(_0x3dcb('0x0'));var utils=require(_0x3dcb('0x1'));var logger=require(_0x3dcb('0x2'))(_0x3dcb('0x3'));var rpc={'chatMessage':require(_0x3dcb('0x4')),'openchannelMessage':require(_0x3dcb('0x5')),'mailMessage':require(_0x3dcb('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3dcb('0x7'))};exports[_0x3dcb('0x8')]=function(_0x4e2b4e,_0xea9d6a){return function(_0x588ec9){try{var _0x410a13={'body':utils[_0x3dcb('0x9')](_0xea9d6a[0x0],this),'ContactId':this[_0x3dcb('0xa')]['id']};if(this['channel']===_0x3dcb('0xb')){_0x410a13['ChatWebsiteId']=this[_0x3dcb('0xc')]['id'];}else{_0x410a13[_[_0x3dcb('0xd')](this['channel'])+'AccountId']=this[_0x3dcb('0xc')]['id'];}_0x410a13[_['upperFirst'](this[_0x3dcb('0xe')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x3dcb('0xe')]+'Message']){return rpc[this['channel']+_0x3dcb('0xf')][_0x3dcb('0x10')](_0x410a13)['then'](function(_0x295093){logger[_0x3dcb('0x11')]('[%s][MESSAGE]\x20%s',_0x4e2b4e,_0x410a13[_0x3dcb('0x12')]);_0x588ec9[_0x3dcb('0x13')]();})[_0x3dcb('0x14')](function(_0xdd3bdd){logger[_0x3dcb('0x15')](_0x3dcb('0x16'),_0x4e2b4e,JSON['stringify'](_0xdd3bdd));_0x588ec9[_0x3dcb('0x17')]();});}}catch(_0x221eb8){logger[_0x3dcb('0x15')]('[%s][MESSAGE]\x20%s',_0x4e2b4e,JSON[_0x3dcb('0x18')](_0x221eb8));_0x588ec9['stop']();}};}; \ No newline at end of file +var _0xb36a=['InteractionId','Message','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId'];(function(_0x1cbdc1,_0x1100ba){var _0x5dd3d2=function(_0x1e9c58){while(--_0x1e9c58){_0x1cbdc1['push'](_0x1cbdc1['shift']());}};_0x5dd3d2(++_0x1100ba);}(_0xb36a,0x8d));var _0xab36=function(_0x51407a,_0x2dd131){_0x51407a=_0x51407a-0x0;var _0x516aae=_0xb36a[_0x51407a];return _0x516aae;};'use strict';var _=require(_0xab36('0x0'));var utils=require('./utils');var logger=require(_0xab36('0x1'))(_0xab36('0x2'));var rpc={'chatMessage':require(_0xab36('0x3')),'openchannelMessage':require(_0xab36('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xab36('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xab36('0x6'))};exports[_0xab36('0x7')]=function(_0x538d73,_0x1ead81){return function(_0x522dbd){try{var _0x4e8e47={'body':utils[_0xab36('0x8')](_0x1ead81[0x0],this),'ContactId':this[_0xab36('0x9')]['id']};if(this[_0xab36('0xa')]===_0xab36('0xb')){_0x4e8e47['ChatWebsiteId']=this[_0xab36('0xc')]['id'];}else{_0x4e8e47[_[_0xab36('0xd')](this[_0xab36('0xa')])+_0xab36('0xe')]=this[_0xab36('0xc')]['id'];}_0x4e8e47[_[_0xab36('0xd')](this[_0xab36('0xa')])+_0xab36('0xf')]=this['interaction']['id'];if(rpc[this[_0xab36('0xa')]+_0xab36('0x10')]){return rpc[this[_0xab36('0xa')]+_0xab36('0x10')]['create'](_0x4e8e47)[_0xab36('0x11')](function(_0x2bd7d9){logger[_0xab36('0x12')]('[%s][MESSAGE]\x20%s',_0x538d73,_0x4e8e47[_0xab36('0x13')]);_0x522dbd[_0xab36('0x14')]();})[_0xab36('0x15')](function(_0x3b3065){logger[_0xab36('0x16')](_0xab36('0x17'),_0x538d73,JSON[_0xab36('0x18')](_0x3b3065));_0x522dbd[_0xab36('0x19')]();});}}catch(_0xbbe758){logger[_0xab36('0x16')]('[%s][MESSAGE]\x20%s',_0x538d73,JSON[_0xab36('0x18')](_0xbbe758));_0x522dbd['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 a721120..c5c6131 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 _0xfda1=['./utils','info','[%s][NOOP]\x20%s','next','stop'];(function(_0x4237fa,_0x4e4e43){var _0x24a1e7=function(_0x412952){while(--_0x412952){_0x4237fa['push'](_0x4237fa['shift']());}};_0x24a1e7(++_0x4e4e43);}(_0xfda1,0x11d));var _0x1fda=function(_0x47e36f,_0x2079f2){_0x47e36f=_0x47e36f-0x0;var _0x5ddd14=_0xfda1[_0x47e36f];return _0x5ddd14;};'use strict';var utils=require(_0x1fda('0x0'));var logger=require('../../../../config/logger')('routing');exports['consequence']=function(_0x2fe245,_0x27e0ac){return function(_0x5a18ac){try{logger[_0x1fda('0x1')](_0x1fda('0x2'),_0x2fe245,utils['getMustacheRender'](_0x27e0ac[0x0],this));_0x5a18ac[_0x1fda('0x3')]();}catch(_0x2ad416){logger['error'](_0x1fda('0x2'),_0x2fe245,JSON['stringify'](_0x2ad416));_0x5a18ac[_0x1fda('0x4')]();}};}; \ No newline at end of file +var _0xbdf2=['next','stringify','./utils','../../../../config/logger','routing','consequence'];(function(_0x4b73d0,_0x5f3388){var _0x216799=function(_0x52f1c3){while(--_0x52f1c3){_0x4b73d0['push'](_0x4b73d0['shift']());}};_0x216799(++_0x5f3388);}(_0xbdf2,0xda));var _0x2bdf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbdf2[_0x126558];return _0x1f6d14;};'use strict';var utils=require(_0x2bdf('0x0'));var logger=require(_0x2bdf('0x1'))(_0x2bdf('0x2'));exports[_0x2bdf('0x3')]=function(_0x5ce266,_0xeafb51){return function(_0x243da1){try{logger['info']('[%s][NOOP]\x20%s',_0x5ce266,utils['getMustacheRender'](_0xeafb51[0x0],this));_0x243da1[_0x2bdf('0x4')]();}catch(_0x545baa){logger['error']('[%s][NOOP]\x20%s',_0x5ce266,JSON[_0x2bdf('0x5')](_0x545baa));_0x243da1['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2dafb7f..3945de2 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 _0x34e8=['../../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','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x4d3cce,_0x22aeee){var _0x2a3e5e=function(_0x218c7c){while(--_0x218c7c){_0x4d3cce['push'](_0x4d3cce['shift']());}};_0x2a3e5e(++_0x22aeee);}(_0x34e8,0x12c));var _0x834e=function(_0x2386fa,_0x395dab){_0x2386fa=_0x2386fa-0x0;var _0x10eb7c=_0x34e8[_0x2386fa];return _0x10eb7c;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ 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(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x3e74,0x175));var _0x43e7=function(_0x855a9e,_0x7a05d2){_0x855a9e=_0x855a9e-0x0;var _0x1636c1=_0x3e74[_0x855a9e];return _0x1636c1;};'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 acddbae..113d672 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 _0xe6ce=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents'];(function(_0x5d84e2,_0x281f7e){var _0x4c789c=function(_0x1e8d72){while(--_0x1e8d72){_0x5d84e2['push'](_0x5d84e2['shift']());}};_0x4c789c(++_0x281f7e);}(_0xe6ce,0xe7));var _0xee6c=function(_0x29f0b4,_0x131d67){_0x29f0b4=_0x29f0b4-0x0;var _0x50451e=_0xe6ce[_0x29f0b4];return _0x50451e;};'use strict';var _=require('lodash');var uuid=require(_0xee6c('0x0'));var util=require('./util');var logger=require(_0xee6c('0x1'))(_0xee6c('0x2'));var Agent=function(_0x384ba9,_0x33ef6e,_0xfb9eab,_0x5aaecc){this[_0xee6c('0x3')]=uuid['v4']();this[_0xee6c('0x4')]=_0x384ba9;this[_0xee6c('0x5')]=_0x33ef6e;this['realtime']=_0xfb9eab;this[_0xee6c('0x2')]=_0x5aaecc;this[_0xee6c('0x4')][_0xee6c('0x6')](this[_0xee6c('0x7')]['bind'](this),this[_0xee6c('0x8')][_0xee6c('0x9')](this));this[_0xee6c('0x4')]['on']('timeout',this[_0xee6c('0x8')][_0xee6c('0x9')](this));this[_0xee6c('0x4')]['on'](_0xee6c('0xa'),this[_0xee6c('0xb')][_0xee6c('0x9')](this));};Agent[_0xee6c('0xc')][_0xee6c('0x6')]=function(){this['squeue']['push'](this['handleRun'][_0xee6c('0x9')](this),this[_0xee6c('0x8')][_0xee6c('0x9')](this));};Agent[_0xee6c('0xc')][_0xee6c('0xb')]=function(){this[_0xee6c('0x8')](!![]);};Agent[_0xee6c('0xc')][_0xee6c('0x7')]=function(_0x5f544c){logger[_0xee6c('0xd')](_0xee6c('0xe'),this[_0xee6c('0x4')]['id'],this[_0xee6c('0x5')]['id']);if(_[_0xee6c('0xf')](this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']])){logger['info'](_0xee6c('0x11'),this[_0xee6c('0x4')]['id'],this[_0xee6c('0x5')]['id']);setTimeout(this[_0xee6c('0x6')][_0xee6c('0x9')](this),0x3e8);}else{if(this[_0xee6c('0x2')][_0xee6c('0x12')]||util[_0xee6c('0x13')](this[_0xee6c('0x4')]['id'],this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],this[_0xee6c('0x4')][_0xee6c('0x15')],![])){this['realtime']['agents'][this[_0xee6c('0x5')]['id']][_0xee6c('0x16')]=!![];this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']][_0xee6c('0x17')]=undefined;util['showNotification'](this[_0xee6c('0x3')],this[_0xee6c('0x4')]['id'],this[_0xee6c('0x14')][_0xee6c('0x10')][this['agent']['id']],null,this[_0xee6c('0x2')]);util[_0xee6c('0x18')](this[_0xee6c('0x4')]['id'],this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],_0xee6c('0x19')+(this[_0xee6c('0x2')][_0xee6c('0x12')]?_0xee6c('0x1a'):''));}else{logger[_0xee6c('0xd')](_0xee6c('0x1b'),this[_0xee6c('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xee6c('0x6')][_0xee6c('0x9')](this),0x3e8);}}};Agent[_0xee6c('0xc')][_0xee6c('0x8')]=function(_0x22c6d2){if(_[_0xee6c('0xf')](this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']])){return logger[_0xee6c('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xee6c('0x4')]['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xee6c('0x4')]['id'],this[_0xee6c('0x5')]['id']);util[_0xee6c('0x1c')](this[_0xee6c('0x3')],this['squeue']['id'],this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],null,this[_0xee6c('0x2')]);this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']]['busy']=![];this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']][_0xee6c('0x17')]=undefined;util[_0xee6c('0x18')](this[_0xee6c('0x4')]['id'],this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],_0x22c6d2?'STOP':_0xee6c('0x1d'));}if(!_0x22c6d2){setTimeout(this['push'][_0xee6c('0x9')](this),0x3e8);}};function agent(_0x32697d,_0x349b19,_0x34560d,_0x575b9a){return new Agent(_0x32697d,_0x349b19,_0x34560d,_0x575b9a);}module[_0xee6c('0x1e')]=agent; \ No newline at end of file +var _0x51d7=['TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleTimeout','bind','timeout','handleDrained','prototype','handleRun','info','isNil','agents','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','STOP'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x51d7,0x133));var _0x751d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x51d7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x751d('0x0'));var uuid=require(_0x751d('0x1'));var util=require(_0x751d('0x2'));var logger=require(_0x751d('0x3'))(_0x751d('0x4'));var Agent=function(_0x4e9901,_0x3003c0,_0x1c139c,_0x1f1ccb){this['notificationId']=uuid['v4']();this[_0x751d('0x5')]=_0x4e9901;this[_0x751d('0x6')]=_0x3003c0;this[_0x751d('0x7')]=_0x1c139c;this[_0x751d('0x4')]=_0x1f1ccb;this[_0x751d('0x5')][_0x751d('0x8')](this['handleRun']['bind'](this),this[_0x751d('0x9')][_0x751d('0xa')](this));this[_0x751d('0x5')]['on'](_0x751d('0xb'),this[_0x751d('0x9')][_0x751d('0xa')](this));this[_0x751d('0x5')]['on']('drained',this[_0x751d('0xc')][_0x751d('0xa')](this));};Agent[_0x751d('0xd')][_0x751d('0x8')]=function(){this[_0x751d('0x5')][_0x751d('0x8')](this[_0x751d('0xe')][_0x751d('0xa')](this),this[_0x751d('0x9')][_0x751d('0xa')](this));};Agent[_0x751d('0xd')][_0x751d('0xc')]=function(){this[_0x751d('0x9')](!![]);};Agent[_0x751d('0xd')][_0x751d('0xe')]=function(_0x202e00){logger[_0x751d('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x751d('0x5')]['id'],this[_0x751d('0x6')]['id']);if(_[_0x751d('0x10')](this['realtime'][_0x751d('0x11')][this[_0x751d('0x6')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x751d('0x5')]['id'],this[_0x751d('0x6')]['id']);setTimeout(this[_0x751d('0x8')][_0x751d('0xa')](this),0x3e8);}else{if(this[_0x751d('0x4')]['forcedOwnership']||util[_0x751d('0x12')](this[_0x751d('0x5')]['id'],this[_0x751d('0x7')][_0x751d('0x11')][this[_0x751d('0x6')]['id']],this[_0x751d('0x5')][_0x751d('0x13')],![])){this['realtime']['agents'][this[_0x751d('0x6')]['id']][_0x751d('0x14')]=!![];this[_0x751d('0x7')]['agents'][this[_0x751d('0x6')]['id']][_0x751d('0x15')]=undefined;util[_0x751d('0x16')](this['notificationId'],this[_0x751d('0x5')]['id'],this[_0x751d('0x7')]['agents'][this[_0x751d('0x6')]['id']],null,this[_0x751d('0x4')]);util[_0x751d('0x17')](this['squeue']['id'],this['realtime'][_0x751d('0x11')][this[_0x751d('0x6')]['id']],_0x751d('0x18')+(this['routing'][_0x751d('0x19')]?_0x751d('0x1a'):''));}else{logger['info'](_0x751d('0x1b'),this['squeue']['id'],this[_0x751d('0x6')]['id']);setTimeout(this[_0x751d('0x8')][_0x751d('0xa')](this),0x3e8);}}};Agent[_0x751d('0xd')][_0x751d('0x9')]=function(_0x2476c8){if(_[_0x751d('0x10')](this[_0x751d('0x7')][_0x751d('0x11')][this[_0x751d('0x6')]['id']])){return logger[_0x751d('0xf')](_0x751d('0x1c'),this[_0x751d('0x5')]['id'],this[_0x751d('0x6')]['id']);}else{logger['info'](_0x751d('0x1d'),this[_0x751d('0x5')]['id'],this[_0x751d('0x6')]['id']);util[_0x751d('0x1e')](this[_0x751d('0x1f')],this[_0x751d('0x5')]['id'],this[_0x751d('0x7')][_0x751d('0x11')][this[_0x751d('0x6')]['id']],null,this[_0x751d('0x4')]);this[_0x751d('0x7')][_0x751d('0x11')][this[_0x751d('0x6')]['id']][_0x751d('0x14')]=![];this['realtime'][_0x751d('0x11')][this[_0x751d('0x6')]['id']]['busyQueue']=undefined;util[_0x751d('0x17')](this[_0x751d('0x5')]['id'],this[_0x751d('0x7')][_0x751d('0x11')][this['agent']['id']],_0x2476c8?_0x751d('0x20'):_0x751d('0x21'));}if(!_0x2476c8){setTimeout(this['push'][_0x751d('0xa')](this),0x3e8);}};function agent(_0x292eb7,_0x35e34e,_0x15a398,_0x1e225e){return new Agent(_0x292eb7,_0x35e34e,_0x15a398,_0x1e225e);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index dd14232..cecf9ae 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 _0xc5f6=['push','handleDrained','isNil','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','handleRun','bind','handleTimeout','timeout','drained','prototype'];(function(_0x2ea042,_0x1168e3){var _0x21e517=function(_0x575b30){while(--_0x575b30){_0x2ea042['push'](_0x2ea042['shift']());}};_0x21e517(++_0x1168e3);}(_0xc5f6,0x13d));var _0x6c5f=function(_0x78d7c8,_0x58b406){_0x78d7c8=_0x78d7c8-0x0;var _0x46cd3f=_0xc5f6[_0x78d7c8];return _0x46cd3f;};'use strict';var _=require('lodash');var uuid=require(_0x6c5f('0x0'));var util=require(_0x6c5f('0x1'));var logger=require(_0x6c5f('0x2'))(_0x6c5f('0x3'));var Beepall=function(_0xbfb4fa,_0x58cbfe,_0xfe9914,_0x4fec8f){this[_0x6c5f('0x4')]=uuid['v4']();this[_0x6c5f('0x5')]=_0xbfb4fa;this[_0x6c5f('0x6')]=_0x58cbfe;this['realtime']=_0xfe9914;this[_0x6c5f('0x3')]=_0x4fec8f;this[_0x6c5f('0x5')]['push'](this[_0x6c5f('0x7')][_0x6c5f('0x8')](this),this[_0x6c5f('0x9')][_0x6c5f('0x8')](this));this[_0x6c5f('0x5')]['on'](_0x6c5f('0xa'),this[_0x6c5f('0x9')][_0x6c5f('0x8')](this));this[_0x6c5f('0x5')]['on'](_0x6c5f('0xb'),this['handleDrained'][_0x6c5f('0x8')](this));};Beepall[_0x6c5f('0xc')]['push']=function(){this[_0x6c5f('0x5')][_0x6c5f('0xd')](this[_0x6c5f('0x7')][_0x6c5f('0x8')](this),this[_0x6c5f('0x9')][_0x6c5f('0x8')](this));};Beepall[_0x6c5f('0xc')][_0x6c5f('0xe')]=function(_0x2d0df2){this[_0x6c5f('0x9')](!![]);};Beepall[_0x6c5f('0xc')][_0x6c5f('0x7')]=function(_0x52cab9){var _0x131266=!![];if(!_[_0x6c5f('0xf')](this[_0x6c5f('0x6')])&&!_[_0x6c5f('0xf')](this[_0x6c5f('0x6')][_0x6c5f('0x10')])&&this[_0x6c5f('0x6')][_0x6c5f('0x10')][_0x6c5f('0x11')]>0x0){for(var _0x1565a1=0x0,_0x532a8a;_0x1565a10x0){for(var _0x36225a=0x0,_0x351bfe;_0x36225a0x0&&_0x53c7de[_0x4497d4+'CurrentCapacity']>=_0x53c7de[_0x4497d4+'Capacity']){writeLog(_0x27fa4e,_0x53c7de,_0x4497d4[_0x20f9('0x28')]()+_0x20f9('0x29'));return![];}}return!![];};exports[_0x20f9('0x2a')]=function(_0x3b94e3,_0x11d2ed,_0x190cc8,_0x64e240,_0x21bf24){return sendNotification(!![],_0x3b94e3,_0x11d2ed,_0x190cc8,_0x64e240,_0x21bf24);};exports['hideNotification']=function(_0x4c1109,_0x3604af,_0x57999e,_0x419dc6,_0x262dc4){return sendNotification(![],_0x4c1109,_0x3604af,_0x57999e,_0x419dc6,_0x262dc4);};exports[_0x20f9('0x2b')]=writeLog; \ No newline at end of file +var _0xc540=['../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','name','user:save','split','\x20interaction','account','notificationSound','body','queue','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','user:%s','notification:%s','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','mustache','../../../../../config/environment'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xc540,0x184));var _0x0c54=function(_0x2ae50b,_0x7361d4){_0x2ae50b=_0x2ae50b-0x0;var _0x1e91a4=_0xc540[_0x2ae50b];return _0x1e91a4;};'use strict';var _=require('lodash');var util=require('util');var utils=require('../utils');var Mustache=require(_0x0c54('0x0'));var Redis=require('ioredis');var config=require(_0x0c54('0x1'));var logger=require(_0x0c54('0x2'))(_0x0c54('0x3'));config[_0x0c54('0x4')]=_[_0x0c54('0x5')](config['redis'],{'host':_0x0c54('0x6'),'port':0x18eb});var io=require(_0x0c54('0x7'))(new Redis(config[_0x0c54('0x4')]));function emit(_0xd1bfc5,_0x2eee8f,_0x90e1b0){io['to'](_0xd1bfc5)[_0x0c54('0x8')](_0x2eee8f,_0x90e1b0);}function sendNotification(_0x32664a,_0x17caf3,_0x29af56,_0x10a76a,_0x42a7ff,_0x4e31ea){io['to'](util[_0x0c54('0x9')]('user:%s',_0x10a76a[_0x0c54('0xa')]))[_0x0c54('0x8')](_0x0c54('0xb'),_0x10a76a);var _0x4884f9=_0x4e31ea||{};var _0x4a6c00=_0x29af56[_0x0c54('0xc')]('.');var _0x2abc11={'uniqueid':_0x17caf3,'channel':_0x4a6c00[0x0],'id':_0x4a6c00[0x1],'title':_0x4a6c00[0x0]+_0x0c54('0xd'),'interactionId':_0x4a6c00[0x2],'queue':_0x42a7ff?_0x42a7ff[_0x0c54('0xa')]:null,'sound':_0x4884f9[_0x0c54('0xe')][_0x0c54('0xf')],'shake':_0x4884f9['account']['notificationShake']};try{if(!_0x4884f9[_0x0c54('0x10')]){_0x4884f9[_0x0c54('0x10')]={};}if(_0x42a7ff){_0x4884f9['body']['queue']=_0x42a7ff;}else if(_0x4884f9[_0x0c54('0x10')][_0x0c54('0x11')]){delete _0x4884f9[_0x0c54('0x10')][_0x0c54('0x11')];}_0x2abc11['msg']=utils[_0x0c54('0x12')](_0x4884f9['account'][_0x0c54('0x13')],_0x4884f9);}catch(_0x2d9a70){_0x2abc11['msg']=_0x0c54('0x14');logger[_0x0c54('0x15')](util[_0x0c54('0x9')]('[%s][QUEUE]\x20%s',_0x17caf3,_0x2d9a70[_0x0c54('0x16')]));}io['to'](util[_0x0c54('0x9')](_0x0c54('0x17'),_0x10a76a[_0x0c54('0xa')]))[_0x0c54('0x8')](util[_0x0c54('0x9')](_0x0c54('0x18'),_0x32664a?'save':'remove'),_0x2abc11);}function writeLog(_0x11c420,_0x315c8b,_0x4482c7){return logger['info'](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x11c420,_0x315c8b[_0x0c54('0xa')],_0x4482c7));}exports[_0x0c54('0x19')]=function(_0x1cee4a,_0x113a0f,_0x5765f9,_0x3eeb4a){if(_0x113a0f[_0x0c54('0x1a')]){writeLog(_0x1cee4a,_0x113a0f,_0x0c54('0x1b'));return![];}if(!_0x113a0f[_0x0c54('0x1c')]){writeLog(_0x1cee4a,_0x113a0f,'OFFLINE');return![];}if(_0x113a0f[_0x5765f9+_0x0c54('0x1d')]){writeLog(_0x1cee4a,_0x113a0f,_0x0c54('0x1e'));return![];}if(_0x3eeb4a&&_0x113a0f[_0x0c54('0x1f')](_0x5765f9+_0x0c54('0x20'))&&_0x113a0f[_0x0c54('0x1f')](_0x5765f9+_0x0c54('0x21'))){if(_0x113a0f[_0x5765f9+_0x0c54('0x20')]>0x0&&_0x113a0f[_0x5765f9+_0x0c54('0x21')]>=_0x113a0f[_0x5765f9+_0x0c54('0x20')]){writeLog(_0x1cee4a,_0x113a0f,_0x5765f9[_0x0c54('0x22')]()+_0x0c54('0x23'));return![];}}return!![];};exports[_0x0c54('0x24')]=function(_0x2b265b,_0x2d5d1b,_0x102781,_0x225770,_0x39a6da){return sendNotification(!![],_0x2b265b,_0x2d5d1b,_0x102781,_0x225770,_0x39a6da);};exports[_0x0c54('0x25')]=function(_0x3ef5e8,_0x37ab64,_0x344a14,_0x46c1b6,_0x3be2ce){return sendNotification(![],_0x3ef5e8,_0x37ab64,_0x344a14,_0x46c1b6,_0x3be2ce);};exports[_0x0c54('0x26')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 729e424..48b20dc 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 _0xd081=['../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs'];(function(_0xee3846,_0x107485){var _0x3f65e3=function(_0x1d29a8){while(--_0x1d29a8){_0xee3846['push'](_0xee3846['shift']());}};_0x3f65e3(++_0x107485);}(_0xd081,0xa0));var _0x1d08=function(_0x250ef6,_0x5826c3){_0x250ef6=_0x250ef6-0x0;var _0x5628c0=_0xd081[_0x250ef6];return _0x5628c0;};'use strict';var schema=require(_0x1d08('0x0'));var sh=require(_0x1d08('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x1d08('0x2'))(_0x1d08('0x3'));var system=schema({'command':{'type':_0x1d08('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1d08('0x5')]=function(_0x34b01b,_0xc26dbf){return function(_0x87f759){try{var _0x31346d={'command':_0xc26dbf[0x0]};var _0x256ecf=system['validate'](_0x31346d,{'typecast':!![]});if(_0x256ecf[_0x1d08('0x6')]){logger[_0x1d08('0x7')](_0x1d08('0x8'),_0x34b01b,_['map'](_0x256ecf,_0x1d08('0x9'))[_0x1d08('0xa')](',\x20'));logger[_0x1d08('0xb')](_0x1d08('0xc'),_0x34b01b);_0x87f759[_0x1d08('0xd')]();}else{var _0x18569a=this;var _0x1e70e5=utils[_0x1d08('0xe')](_0xc26dbf[0x0],this);logger[_0x1d08('0xb')](_0x1d08('0xf'),_0x34b01b,_0x1e70e5);sh[_0x1d08('0x10')](_[_0x1d08('0x11')](_0x1e70e5),function(_0x2aae9e,_0x3d9cd7){logger[_0x1d08('0xb')](_0x1d08('0x12'),_0x34b01b,_0x2aae9e);if(_0x2aae9e==0x0){var _0x2f504a=_0x3d9cd7[_0x1d08('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x1d08('0x14')](_0xc26dbf[0x1])||_[_0x1d08('0x15')](_0xc26dbf[0x1])){logger[_0x1d08('0xb')](_0x1d08('0x16'),_0x34b01b);_0x18569a[_0x1d08('0x17')][_0xc26dbf[0x1]]=_0x2f504a;}else{logger['info'](_0x1d08('0x18'),_0x34b01b,_0xc26dbf[0x1],_0x2f504a);_0x18569a[_0x1d08('0x17')][_0xc26dbf[0x1]]=_0x2f504a;}}_0x87f759[_0x1d08('0xd')]();});}}catch(_0x2e4ac3){logger[_0x1d08('0x7')](_0x1d08('0x8'),_0x34b01b,_[_0x1d08('0x19')](_0x2e4ac3)?JSON[_0x1d08('0x1a')](_0x2e4ac3):_0x2e4ac3);logger[_0x1d08('0xb')](_0x1d08('0xc'),_0x34b01b);_0x87f759[_0x1d08('0xd')]();}};}; \ No newline at end of file +var _0x6e3a=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','info','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs'];(function(_0x3979bc,_0x5a784b){var _0x19c06b=function(_0x4f7dfe){while(--_0x4f7dfe){_0x3979bc['push'](_0x3979bc['shift']());}};_0x19c06b(++_0x5a784b);}(_0x6e3a,0xcd));var _0xa6e3=function(_0x4c97ce,_0x39ecdc){_0x4c97ce=_0x4c97ce-0x0;var _0x25f956=_0x6e3a[_0x4c97ce];return _0x25f956;};'use strict';var schema=require(_0xa6e3('0x0'));var sh=require(_0xa6e3('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xa6e3('0x2'))(_0xa6e3('0x3'));var system=schema({'command':{'type':_0xa6e3('0x4'),'required':!![],'message':_0xa6e3('0x5')}});exports[_0xa6e3('0x6')]=function(_0x1ccaa0,_0x267666){return function(_0x31b0ea){try{var _0xb5550c={'command':_0x267666[0x0]};var _0x488ba0=system['validate'](_0xb5550c,{'typecast':!![]});if(_0x488ba0['length']){logger['error'](_0xa6e3('0x7'),_0x1ccaa0,_[_0xa6e3('0x8')](_0x488ba0,_0xa6e3('0x9'))[_0xa6e3('0xa')](',\x20'));logger['info'](_0xa6e3('0xb'),_0x1ccaa0);_0x31b0ea[_0xa6e3('0xc')]();}else{var _0x3ff5ef=this;var _0x225c8b=utils[_0xa6e3('0xd')](_0x267666[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x1ccaa0,_0x225c8b);sh[_0xa6e3('0xe')](_['trim'](_0x225c8b),function(_0x2f9363,_0x59f65c){logger[_0xa6e3('0xf')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1ccaa0,_0x2f9363);if(_0x2f9363==0x0){var _0x1b9c7c=_0x59f65c['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa6e3('0x10')](_0x267666[0x1])||_[_0xa6e3('0x11')](_0x267666[0x1])){logger[_0xa6e3('0xf')](_0xa6e3('0x12'),_0x1ccaa0);_0x3ff5ef[_0xa6e3('0x13')][_0x267666[0x1]]=_0x1b9c7c;}else{logger[_0xa6e3('0xf')](_0xa6e3('0x14'),_0x1ccaa0,_0x267666[0x1],_0x1b9c7c);_0x3ff5ef[_0xa6e3('0x13')][_0x267666[0x1]]=_0x1b9c7c;}}_0x31b0ea[_0xa6e3('0xc')]();});}}catch(_0x2573b4){logger['error'](_0xa6e3('0x7'),_0x1ccaa0,_[_0xa6e3('0x15')](_0x2573b4)?JSON[_0xa6e3('0x16')](_0x2573b4):_0x2573b4);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1ccaa0);_0x31b0ea[_0xa6e3('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 90831a8..c91daa7 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 _0x880a=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','error','isObject','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','map','message','join','info','next','Interaction','addTags','interaction','channel','catch','[%s][TAG]\x20%s'];(function(_0x21e2ba,_0x398f94){var _0xd398a8=function(_0x1233a3){while(--_0x1233a3){_0x21e2ba['push'](_0x21e2ba['shift']());}};_0xd398a8(++_0x398f94);}(_0x880a,0x17c));var _0xa880=function(_0x2f0c25,_0x2ac930){_0x2f0c25=_0x2f0c25-0x0;var _0xf374f2=_0x880a[_0x2f0c25];return _0xf374f2;};'use strict';var schema=require('validate');var _=require(_0xa880('0x0'));var rpc={'chatInteraction':require(_0xa880('0x1')),'openchannelInteraction':require(_0xa880('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xa880('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa880('0x4'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xa880('0x5'),'required':!![],'message':_0xa880('0x6')}});exports[_0xa880('0x7')]=function(_0x3a3643,_0x4d73ec,_0x2497dd,_0x1eb7fb){return function(_0x5b1692){try{var _0x3cc73c={'tag':_0x4d73ec[0x0]};var _0x4d76f0=tag[_0xa880('0x8')](_0x3cc73c,{'typecast':!![]});if(_0x4d76f0['length']){logger['error']('[%s][TAG]\x20%s',_0x3a3643,_[_0xa880('0x9')](_0x4d76f0,_0xa880('0xa'))[_0xa880('0xb')](',\x20'));logger[_0xa880('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a3643);_0x5b1692[_0xa880('0xd')]();}else{var _0x83c8e2={'ids':[_0x4d73ec[0x0]]};if(rpc[_0x1eb7fb['channel']+_0xa880('0xe')]){rpc[_0x1eb7fb['channel']+_0xa880('0xe')][_0xa880('0xf')](_0x1eb7fb[_0xa880('0x10')]['id'],_0x83c8e2)['then'](function(_0x5707f5){logger[_0xa880('0xc')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3a3643,_0x4d73ec[0x1],_0x1eb7fb[_0xa880('0x11')],_0x1eb7fb['interaction']['id']);})[_0xa880('0x12')](function(_0x5bc5d1){logger['error'](_0xa880('0x13'),_0x3a3643,JSON['stringify'](_0x5bc5d1));logger['info'](_0xa880('0x14'),_0x3a3643);})[_0xa880('0x15')](function(){_0x5b1692[_0xa880('0xd')]();});}}}catch(_0xffcaf2){logger[_0xa880('0x16')](_0xa880('0x13'),_0x3a3643,_[_0xa880('0x17')](_0xffcaf2)?JSON[_0xa880('0x18')](_0xffcaf2):_0xffcaf2);logger[_0xa880('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a3643);_0x5b1692[_0xa880('0xd')]();}};}; \ No newline at end of file +var _0x660f=['finally','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','catch','stringify'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x660f,0xd0));var _0xf660=function(_0x2708c7,_0x518322){_0x2708c7=_0x2708c7-0x0;var _0x52c498=_0x660f[_0x2708c7];return _0x52c498;};'use strict';var schema=require('validate');var _=require(_0xf660('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf660('0x1')),'smsInteraction':require(_0xf660('0x2')),'mailInteraction':require(_0xf660('0x3')),'faxInteraction':require(_0xf660('0x4')),'whatsappInteraction':require(_0xf660('0x5'))};var logger=require(_0xf660('0x6'))(_0xf660('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf660('0x8')]=function(_0x30f42e,_0xc9e81b,_0x5bfd15,_0x2027b1){return function(_0x5f2eab){try{var _0x36f28e={'tag':_0xc9e81b[0x0]};var _0x1d6ad1=tag['validate'](_0x36f28e,{'typecast':!![]});if(_0x1d6ad1[_0xf660('0x9')]){logger[_0xf660('0xa')](_0xf660('0xb'),_0x30f42e,_['map'](_0x1d6ad1,_0xf660('0xc'))[_0xf660('0xd')](',\x20'));logger[_0xf660('0xe')](_0xf660('0xf'),_0x30f42e);_0x5f2eab[_0xf660('0x10')]();}else{var _0x38ab5a={'ids':[_0xc9e81b[0x0]]};if(rpc[_0x2027b1[_0xf660('0x11')]+_0xf660('0x12')]){rpc[_0x2027b1[_0xf660('0x11')]+'Interaction'][_0xf660('0x13')](_0x2027b1['interaction']['id'],_0x38ab5a)['then'](function(_0x456734){logger[_0xf660('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x30f42e,_0xc9e81b[0x1],_0x2027b1[_0xf660('0x11')],_0x2027b1['interaction']['id']);})[_0xf660('0x14')](function(_0xf23c3b){logger[_0xf660('0xa')]('[%s][TAG]\x20%s',_0x30f42e,JSON[_0xf660('0x15')](_0xf23c3b));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x30f42e);})[_0xf660('0x16')](function(){_0x5f2eab[_0xf660('0x10')]();});}}}catch(_0x456b61){logger[_0xf660('0xa')](_0xf660('0xb'),_0x30f42e,_['isObject'](_0x456b61)?JSON[_0xf660('0x15')](_0x456b61):_0x456b61);logger['info'](_0xf660('0xf'),_0x30f42e);_0x5f2eab['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 74546f6..b9a972b 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 _0x5ed2=['contact','message','account','interaction','mustache','exports','render','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ed2,0x114));var _0x25ed=function(_0xfbceb4,_0x392f3b){_0xfbceb4=_0xfbceb4-0x0;var _0x563dbe=_0x5ed2[_0xfbceb4];return _0x563dbe;};'use strict';var Mustache=require(_0x25ed('0x0'));var _=require('lodash');module[_0x25ed('0x1')]={'getMustacheRender':function(_0x106489,_0x5330f1){return Mustache[_0x25ed('0x2')](_0x106489,_[_0x25ed('0x3')](_0x5330f1['body'],{'contact':_0x5330f1[_0x25ed('0x4')],'message':_0x5330f1[_0x25ed('0x5')],'account':_0x5330f1[_0x25ed('0x6')],'interaction':_0x5330f1[_0x25ed('0x7')],'list':_0x5330f1['list']}))||'';}}; \ No newline at end of file +var _0xc3fe=['lodash','exports','render','merge','contact','message','account','mustache'];(function(_0x2eb596,_0x3b1f59){var _0x5e7a96=function(_0x2df67e){while(--_0x2df67e){_0x2eb596['push'](_0x2eb596['shift']());}};_0x5e7a96(++_0x3b1f59);}(_0xc3fe,0xff));var _0xec3f=function(_0x4760a6,_0x256830){_0x4760a6=_0x4760a6-0x0;var _0x2d0799=_0xc3fe[_0x4760a6];return _0x2d0799;};'use strict';var Mustache=require(_0xec3f('0x0'));var _=require(_0xec3f('0x1'));module[_0xec3f('0x2')]={'getMustacheRender':function(_0x4d38a1,_0x15ddf0){return Mustache[_0xec3f('0x3')](_0x4d38a1,_[_0xec3f('0x4')](_0x15ddf0['body'],{'contact':_0x15ddf0[_0xec3f('0x5')],'message':_0x15ddf0[_0xec3f('0x6')],'account':_0x15ddf0[_0xec3f('0x7')],'interaction':_0x15ddf0['interaction'],'list':_0x15ddf0['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 909d374..dc1d992 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 _0xce7c=['error','info','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','format','./interval','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval'];(function(_0x40d054,_0x2ec708){var _0xc4626b=function(_0x93a3f6){while(--_0x93a3f6){_0x40d054['push'](_0x40d054['shift']());}};_0xc4626b(++_0x2ec708);}(_0xce7c,0x85));var _0xcce7=function(_0x238bce,_0x1fa37a){_0x238bce=_0x238bce-0x0;var _0x127fc9=_0xce7c[_0x238bce];return _0x127fc9;};'use strict';var _=require(_0xcce7('0x0'));var util=require(_0xcce7('0x1'));var path=require(_0xcce7('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xcce7('0x3'));var uuid=require(_0xcce7('0x4'));var config=require(_0xcce7('0x5'));var logger=require(_0xcce7('0x6'))(_0xcce7('0x7'));var rpc={'openchannelQueueReport':require(_0xcce7('0x8')),'mailQueueReport':require(_0xcce7('0x9')),'chatQueueReport':require(_0xcce7('0xa')),'smsQueueReport':require(_0xcce7('0xb')),'faxQueueReport':require(_0xcce7('0xc')),'whatsappQueueReport':require(_0xcce7('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3d57fc,_0x50da60,_0x55e33c){return util['format'](_0xcce7('0xe'),_0x3d57fc,_0x50da60||0x0,_0x55e33c||0x0);}function getIntervals(_0x46d1c4,_0xb367cf){var _0x2e4389=[];if(!_[_0xcce7('0xf')](_0xb367cf[_0xcce7('0x10')])&&!_['isNil'](_0x46d1c4[_0xb367cf['IntervalId']])&&!_[_0xcce7('0xf')](_0x46d1c4[_0xb367cf['IntervalId']][_0xcce7('0x11')])){_0x2e4389=_[_0xcce7('0x12')](_0x46d1c4[_0xb367cf[_0xcce7('0x10')]][_0xcce7('0x11')],'interval');}else if(!_[_0xcce7('0xf')](_0xb367cf[_0xcce7('0x13')])){_0x2e4389=[_0xb367cf[_0xcce7('0x13')]];}return _0x2e4389;}exports[_0xcce7('0x14')]=function(_0x5ca488){_0x5ca488[_0xcce7('0x15')]={};return new BPromise(function(_0x2f722a,_0xfa0468){var _0x3232ad={'Start':function(_0xcb42b1){var _0x3c4454=this;return new Promise(function(_0x25dab9,_0x3200f9){if(_0xcb42b1){try{var _0x2c2b55=[];var _0x52aa17=getId(_0xcb42b1[_0xcce7('0x16')],_0xcb42b1[_0xcce7('0x17')]?_0xcb42b1[_0xcce7('0x17')]['id']:0x0,_0xcb42b1['interaction']?_0xcb42b1[_0xcce7('0x18')]['id']:0x0);if(_0xcb42b1[_0xcce7('0x19')]&&_[_0xcce7('0x1a')](_0xcb42b1[_0xcce7('0x19')])&&_0xcb42b1['applications'][_0xcce7('0x1b')]){for(var _0x4020e5=0x0;_0x4020e5<_0xcb42b1[_0xcce7('0x19')][_0xcce7('0x1b')];_0x4020e5+=0x1){var _0x790daa=_0xcb42b1[_0xcce7('0x19')][_0x4020e5];if(fs[_0xcce7('0x1c')](path[_0xcce7('0x1d')](__dirname,_0xcce7('0x19'),_0x790daa['app']+_0xcce7('0x1e')))){var _0x258442=[];switch(_0x790daa[_0xcce7('0x1f')][_0xcce7('0x20')]()){case _0xcce7('0x21'):var _0x514652=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x514652[0x0]);_0x258442[_0xcce7('0x24')](_0x514652[_0xcce7('0x25')](0x1,_0x514652[_0xcce7('0x1b')])[_0xcce7('0x1d')](','));break;case _0xcce7('0x26'):var _0x304b24=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x304b24[0x0]);_0x258442[_0xcce7('0x24')](_0x304b24[0x1]);_0x258442[_0xcce7('0x24')](_0x304b24[_0xcce7('0x25')](0x2,_0x304b24[_0xcce7('0x1b')])['join'](','));break;case'dialogflowv2':var _0x1e205c=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x1e205c[0x0]);_0x258442[_0xcce7('0x24')](_0x1e205c[0x1]);_0x258442['push'](_0x1e205c[0x2]);_0x258442[_0xcce7('0x24')](_0x1e205c[0x3]);_0x258442['push'](_0x1e205c[_0xcce7('0x25')](0x4,_0x1e205c[_0xcce7('0x1b')])['join'](','));break;case _0xcce7('0x27'):var _0x32ea66=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x32ea66[0x0]);_0x258442[_0xcce7('0x24')](_0x32ea66[0x1]);_0x258442[_0xcce7('0x24')](_0x32ea66[0x2]);_0x258442[_0xcce7('0x24')](_0x32ea66[0x3]);_0x258442[_0xcce7('0x24')](_0x32ea66[_0xcce7('0x25')](0x4,_0x32ea66[_0xcce7('0x1b')])[_0xcce7('0x1d')](','));break;case _0xcce7('0x17'):_0x258442[_0xcce7('0x24')](_0x790daa[_0xcce7('0x22')]);break;case _0xcce7('0x28'):_0x258442[_0xcce7('0x24')](_0x790daa['TagId']);_0x258442[_0xcce7('0x24')](_0x790daa[_0xcce7('0x22')]);break;default:_0x258442=_[_0xcce7('0xf')](_0x790daa[_0xcce7('0x22')])?[]:_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');}var _0x13caf7={'id':util[_0xcce7('0x29')]('%s:%s:%s',_0x52aa17,_0x790daa['id'],_0x790daa[_0xcce7('0x1f')]),'condition':require(_0xcce7('0x2a'))[_0xcce7('0x2b')](_0x52aa17,getIntervals(_0x5ca488[_0xcce7('0x2c')],_0x790daa),_0x5ca488),'consequence':require(_0xcce7('0x2d')+_0x790daa['app'])['consequence'](_0x52aa17,_0x258442,_0x5ca488,_0xcb42b1),'p':_0x790daa[_0xcce7('0x2e')]||0x0};logger['info'](_0xcce7('0x2f'),_0x13caf7['id'],_0xcce7('0x30'),getIntervals(_0x5ca488[_0xcce7('0x2c')],_0x790daa)[_0xcce7('0x1d')]('\x20|\x20'));_0x2c2b55[_0xcce7('0x24')](_0x13caf7);}else{logger[_0xcce7('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xcce7('0x1d')](__dirname,_0xcce7('0x19'),_0x790daa[_0xcce7('0x1f')]+_0xcce7('0x1e')));}}_0x5ca488['rules'][_0x52aa17]=new RuleEngine(_0x2c2b55);_0x5ca488[_0xcce7('0x15')][_0x52aa17]['execute'](_0xcb42b1,function(_0x502cca){logger[_0xcce7('0x32')]('Applications\x20executed',JSON[_0xcce7('0x33')](_0x502cca[_0xcce7('0x34')]));if(_0x5ca488[_0xcce7('0x15')][_0x52aa17]){_0x5ca488[_0xcce7('0x15')][_0x52aa17][_0xcce7('0x35')](_0xcce7('0x36'));}});return _0x25dab9({'code':0xc8,'message':_0xcb42b1});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x25dab9({'code':0xc8,'message':_0xcb42b1});}}catch(_0x58969b){logger[_0xcce7('0x31')](_0x58969b[_0xcce7('0x37')]);return _0x3200f9(_0x3c4454['error'](0x1f4,_0x58969b));}}return _0x3200f9(_0xcce7('0x38'));});},'AcceptMessage':function(_0x5e1a37){var _0x1fb3c3=this;return new Promise(function(_0x2d3e2b,_0x13a97c){if(_0x5e1a37['message']&&_0x5e1a37[_0xcce7('0x17')]['id']){try{var _0x227791=getId(_0x5e1a37[_0xcce7('0x16')],_0x5e1a37[_0xcce7('0x17')]?_0x5e1a37[_0xcce7('0x17')]['id']:0x0,_0x5e1a37[_0xcce7('0x18')]?_0x5e1a37[_0xcce7('0x18')]['id']:0x0);if(_0x5ca488[_0xcce7('0x15')][_0x227791]){_0x5ca488['rules'][_0x227791][_0xcce7('0x35')](_0xcce7('0x39'));if(rpc[_0x5e1a37[_0xcce7('0x16')]+_0xcce7('0x3a')]){rpc[_0x5e1a37[_0xcce7('0x16')]+_0xcce7('0x3a')][_0xcce7('0x3b')](_0x227791,{'UserId':_0x5e1a37[_0xcce7('0x17')][_0xcce7('0x3c')]})[_0xcce7('0x3d')](function(_0xfb3348){logger[_0xcce7('0x31')]('error\x20update\x20queue\x20report');});}}return _0x2d3e2b({'code':0xc8,'message':_0x5e1a37});}catch(_0x224b69){logger[_0xcce7('0x31')](_0x224b69[_0xcce7('0x37')]);return _0x13a97c(_0x1fb3c3[_0xcce7('0x31')](0x1f4,_0x224b69));}}logger['error']('message\x20is\x20empty');return _0x13a97c(_0x1fb3c3['error'](0x1f4,_0xcce7('0x3e')));});},'RejectMessage':function(_0x4fd16e){var _0x238240=this;return new Promise(function(_0x30d3fd,_0x497f16){if(_0x4fd16e[_0xcce7('0x3f')]&&_0x4fd16e['agent']['id']){try{if(_0x5ca488[_0xcce7('0x40')][_0x4fd16e['agent']['id']]){_0x5ca488['agents'][_0x4fd16e[_0xcce7('0x3f')]['id']]['busy']=![];_0x5ca488['agents'][_0x4fd16e[_0xcce7('0x3f')]['id']][_0xcce7('0x41')]=undefined;}return _0x30d3fd({'code':0xc8,'message':_0x4fd16e});}catch(_0x449a58){logger['error'](_0x449a58['stack']);return _0x497f16(_0x238240[_0xcce7('0x31')](0x1f4,_0x449a58));}}logger[_0xcce7('0x31')](_0xcce7('0x3e'));return _0x497f16(_0x238240['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1a2c54){var _0x1b1c84=this;return new Promise(function(_0x2280c6,_0x470489){if(_0x1a2c54['channel']&&_0x1a2c54[_0xcce7('0x18')]&&_0x1a2c54[_0xcce7('0x18')]['id']){try{var _0x195a9d=getId(_0x1a2c54['channel'],_0x1a2c54['message']?_0x1a2c54[_0xcce7('0x17')]['id']:0x0,_0x1a2c54[_0xcce7('0x18')]?_0x1a2c54[_0xcce7('0x18')]['id']:0x0);if(_0x5ca488[_0xcce7('0x15')][_0x195a9d]){_0x5ca488[_0xcce7('0x15')][_0x195a9d][_0xcce7('0x35')](_0xcce7('0x39'));}return _0x2280c6({'code':0xc8,'message':_0x1a2c54});}catch(_0x1c7cde){logger[_0xcce7('0x31')](_0x1c7cde[_0xcce7('0x37')]);return _0x470489(_0x1b1c84[_0xcce7('0x31')](0x1f4,_0x1c7cde));}}logger[_0xcce7('0x31')]('message\x20is\x20empty');return _0x470489(_0x1b1c84[_0xcce7('0x31')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5bd7fa){var _0x1305a7=this;return new Promise(function(_0x30246c,_0x2376ba){if(_0x5ca488[_0xcce7('0x40')][_0xcce7('0x42')](_0x5bd7fa['id'])){for(var _0x5abf7d in _0x5bd7fa[_0xcce7('0x43')]){if(_0x5bd7fa[_0xcce7('0x43')][_0xcce7('0x42')](_0x5abf7d)){if(_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']][_0xcce7('0x42')](_0x5abf7d+_0xcce7('0x44'))){_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']][_0x5abf7d+_0xcce7('0x44')]=parseInt(_0x5bd7fa[_0xcce7('0x43')][_0x5abf7d],0xa);}}}_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']][_0xcce7('0x45')]();return _0x30246c({'code':0xc8,'message':_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']]});}else{return _0x2376ba(_0x1305a7['error'](0x1f4,_0xcce7('0x46')));}});},'Agents':function(_0x702dbe){return new Promise(function(_0x50085e,_0x32b35e){var _0x279c4a=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x40')]);_0x50085e({'count':_0x279c4a[_0xcce7('0x1b')],'rows':_0x279c4a});});},'ChatQueues':function(_0x4f4021){return new Promise(function(_0x4a6768,_0x5e0da7){var _0x55ef38=[];for(var _0x333eb5 in _0x5ca488['chatQueues']){if(_0x5ca488[_0xcce7('0x48')]['hasOwnProperty'](_0x333eb5)){var _0x108f83=_0x5ca488[_0xcce7('0x48')][_0x333eb5];var _0x1d1773={'id':_0x108f83['id'],'available':_0x108f83[_0xcce7('0x49')],'loggedIn':_0x108f83['loggedIn'],'name':_0x108f83[_0xcce7('0x4a')],'paused':_0x108f83[_0xcce7('0x4b')],'waiting':_0x108f83[_0xcce7('0x4c')]};_0x55ef38[_0xcce7('0x24')](_0x1d1773);}}_0x4a6768({'count':_0x55ef38[_0xcce7('0x1b')],'rows':_0x55ef38});});},'MailQueues':function(_0x130eed){return new Promise(function(_0x3bf668,_0x25db98){var _0x5129ba=[];for(var _0x1f779f in _0x5ca488[_0xcce7('0x4d')]){if(_0x5ca488['mailQueues'][_0xcce7('0x42')](_0x1f779f)){var _0x5a925f=_0x5ca488[_0xcce7('0x4d')][_0x1f779f];var _0x520334={'id':_0x5a925f['id'],'available':_0x5a925f[_0xcce7('0x49')],'loggedIn':_0x5a925f[_0xcce7('0x4e')],'name':_0x5a925f[_0xcce7('0x4a')],'paused':_0x5a925f['paused'],'waiting':_0x5a925f[_0xcce7('0x4c')]};_0x5129ba[_0xcce7('0x24')](_0x520334);}}_0x3bf668({'count':_0x5129ba['length'],'rows':_0x5129ba});});},'OpenchannelQueues':function(_0x57e651){return new Promise(function(_0x2ab645,_0x33f48a){var _0x1cd3e7=[];for(var _0x22ae47 in _0x5ca488[_0xcce7('0x4f')]){if(_0x5ca488[_0xcce7('0x4f')][_0xcce7('0x42')](_0x22ae47)){var _0x10db9b=_0x5ca488[_0xcce7('0x4f')][_0x22ae47];var _0x476895={'id':_0x10db9b['id'],'available':_0x10db9b[_0xcce7('0x49')],'loggedIn':_0x10db9b[_0xcce7('0x4e')],'name':_0x10db9b[_0xcce7('0x4a')],'paused':_0x10db9b[_0xcce7('0x4b')],'waiting':_0x10db9b[_0xcce7('0x4c')]};_0x1cd3e7[_0xcce7('0x24')](_0x476895);}}_0x2ab645({'count':_0x1cd3e7[_0xcce7('0x1b')],'rows':_0x1cd3e7});});},'SmsQueues':function(_0x32fd47){return new Promise(function(_0x2f5d5e,_0x263df6){var _0x21b707=[];for(var _0x5b3af3 in _0x5ca488['smsQueues']){if(_0x5ca488['smsQueues'][_0xcce7('0x42')](_0x5b3af3)){var _0x58d67c=_0x5ca488['smsQueues'][_0x5b3af3];var _0x5ea273={'id':_0x58d67c['id'],'available':_0x58d67c[_0xcce7('0x49')],'loggedIn':_0x58d67c['loggedIn'],'name':_0x58d67c[_0xcce7('0x4a')],'paused':_0x58d67c[_0xcce7('0x4b')],'waiting':_0x58d67c[_0xcce7('0x4c')]};_0x21b707['push'](_0x5ea273);}}_0x2f5d5e({'count':_0x21b707['length'],'rows':_0x21b707});});},'FaxQueues':function(_0x5a5f89){return new Promise(function(_0x5876c3,_0x51f28d){var _0x48ecbd=[];for(var _0x3688d3 in _0x5ca488[_0xcce7('0x50')]){if(_0x5ca488['faxQueues'][_0xcce7('0x42')](_0x3688d3)){var _0x3622f6=_0x5ca488[_0xcce7('0x50')][_0x3688d3];var _0x3d18c3={'id':_0x3622f6['id'],'available':_0x3622f6[_0xcce7('0x49')],'loggedIn':_0x3622f6['loggedIn'],'name':_0x3622f6[_0xcce7('0x4a')],'paused':_0x3622f6[_0xcce7('0x4b')],'waiting':_0x3622f6[_0xcce7('0x4c')]};_0x48ecbd[_0xcce7('0x24')](_0x3d18c3);}}_0x5876c3({'count':_0x48ecbd[_0xcce7('0x1b')],'rows':_0x48ecbd});});},'WhatsappQueues':function(_0xaf3670){return new Promise(function(_0x57cb3c,_0xf4faee){var _0x2e59fe=[];for(var _0x407160 in _0x5ca488[_0xcce7('0x51')]){if(_0x5ca488['whatsappQueues'][_0xcce7('0x42')](_0x407160)){var _0x11bc12=_0x5ca488[_0xcce7('0x51')][_0x407160];var _0x51773d={'id':_0x11bc12['id'],'available':_0x11bc12[_0xcce7('0x49')],'loggedIn':_0x11bc12[_0xcce7('0x4e')],'name':_0x11bc12[_0xcce7('0x4a')],'paused':_0x11bc12[_0xcce7('0x4b')],'waiting':_0x11bc12['waiting']};_0x2e59fe['push'](_0x51773d);}}_0x57cb3c({'count':_0x2e59fe[_0xcce7('0x1b')],'rows':_0x2e59fe});});},'ChatQueuesWaitingInteractions':function(_0x36d66e){return new Promise(function(_0x52d752,_0x1e1000){var _0x2e23ae=_['values'](_0x5ca488[_0xcce7('0x52')]);_0x52d752({'count':_0x2e23ae['length'],'rows':_0x2e23ae});});},'MailQueuesWaitingInteractions':function(_0x327722){return new Promise(function(_0x9f5094,_0x4bbaa7){var _0x5169a0=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x53')]);_0x9f5094({'count':_0x5169a0['length'],'rows':_0x5169a0});});},'OpenchannelQueuesWaitingInteractions':function(_0x5e32c8){return new Promise(function(_0x3c90b2,_0x3a54c3){var _0x43a3b9=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x54')]);_0x3c90b2({'count':_0x43a3b9['length'],'rows':_0x43a3b9});});},'SmsQueuesWaitingInteractions':function(_0x1b1b64){return new Promise(function(_0x2c9000,_0xf9c8f3){var _0x17c5a4=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x55')]);_0x2c9000({'count':_0x17c5a4[_0xcce7('0x1b')],'rows':_0x17c5a4});});},'FaxQueuesWaitingInteractions':function(_0x5f3be2){return new Promise(function(_0x4b1f9e,_0x2df512){var _0x56677d=_[_0xcce7('0x47')](_0x5ca488['faxQueuesWaitingInteractions']);_0x4b1f9e({'count':_0x56677d['length'],'rows':_0x56677d});});},'WhatsappQueuesWaitingInteractions':function(_0x19317d){return new Promise(function(_0x54c14d,_0x17a3c5){var _0x296adb=_['values'](_0x5ca488[_0xcce7('0x56')]);_0x54c14d({'count':_0x296adb[_0xcce7('0x1b')],'rows':_0x296adb});});}};var _0xcc015e=jayson[_0xcce7('0x57')](_0x3232ad)[_0xcce7('0x58')]();_0xcc015e['on'](_0xcce7('0x31'),function(_0x350173){logger['error'](JSON[_0xcce7('0x33')](_0x350173));return _0xfa0468(_0x350173);});_0xcc015e['listen'](0x232c,'127.0.0.1',function(){console[_0xcce7('0x59')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2f722a(_0xcce7('0x5a')+0x232c);});});}; \ No newline at end of file +var _0x883a=['message','interaction','applications','isArray','length','existsSync','join','.js','toLowerCase','autoreply','split','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','%s:%s:%s','app','./interval','condition','intervals','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','end','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel'];(function(_0x296187,_0x66707b){var _0x4565d2=function(_0xb3f7cb){while(--_0xb3f7cb){_0x296187['push'](_0x296187['shift']());}};_0x4565d2(++_0x66707b);}(_0x883a,0xa9));var _0xa883=function(_0x117e35,_0x5d5b21){_0x117e35=_0x117e35-0x0;var _0x527412=_0x883a[_0x117e35];return _0x527412;};'use strict';var _=require(_0xa883('0x0'));var util=require(_0xa883('0x1'));var path=require(_0xa883('0x2'));var fs=require('fs');var jayson=require(_0xa883('0x3'));var BPromise=require(_0xa883('0x4'));var uuid=require(_0xa883('0x5'));var config=require(_0xa883('0x6'));var logger=require(_0xa883('0x7'))(_0xa883('0x8'));var rpc={'openchannelQueueReport':require(_0xa883('0x9')),'mailQueueReport':require(_0xa883('0xa')),'chatQueueReport':require(_0xa883('0xb')),'smsQueueReport':require(_0xa883('0xc')),'faxQueueReport':require(_0xa883('0xd')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xa883('0xe'));function getId(_0x4244fa,_0x53040f,_0x3a389e){return util[_0xa883('0xf')](_0xa883('0x10'),_0x4244fa,_0x53040f||0x0,_0x3a389e||0x0);}function getIntervals(_0x567ee0,_0x2fd1e4){var _0x3b0250=[];if(!_[_0xa883('0x11')](_0x2fd1e4[_0xa883('0x12')])&&!_[_0xa883('0x11')](_0x567ee0[_0x2fd1e4['IntervalId']])&&!_[_0xa883('0x11')](_0x567ee0[_0x2fd1e4[_0xa883('0x12')]][_0xa883('0x13')])){_0x3b0250=_[_0xa883('0x14')](_0x567ee0[_0x2fd1e4[_0xa883('0x12')]]['Intervals'],_0xa883('0x15'));}else if(!_[_0xa883('0x11')](_0x2fd1e4[_0xa883('0x15')])){_0x3b0250=[_0x2fd1e4[_0xa883('0x15')]];}return _0x3b0250;}exports[_0xa883('0x16')]=function(_0x4febfb){_0x4febfb[_0xa883('0x17')]={};return new BPromise(function(_0x372bb5,_0x3badac){var _0x3ab6ce={'Start':function(_0x591505){var _0x33f326=this;return new Promise(function(_0x524067,_0x550030){if(_0x591505){try{var _0x524b82=[];var _0xff598a=getId(_0x591505[_0xa883('0x18')],_0x591505[_0xa883('0x19')]?_0x591505[_0xa883('0x19')]['id']:0x0,_0x591505['interaction']?_0x591505[_0xa883('0x1a')]['id']:0x0);if(_0x591505[_0xa883('0x1b')]&&_[_0xa883('0x1c')](_0x591505[_0xa883('0x1b')])&&_0x591505[_0xa883('0x1b')]['length']){for(var _0x348df0=0x0;_0x348df0<_0x591505['applications'][_0xa883('0x1d')];_0x348df0+=0x1){var _0x500b58=_0x591505[_0xa883('0x1b')][_0x348df0];if(fs[_0xa883('0x1e')](path[_0xa883('0x1f')](__dirname,_0xa883('0x1b'),_0x500b58['app']+_0xa883('0x20')))){var _0x114781=[];switch(_0x500b58['app'][_0xa883('0x21')]()){case _0xa883('0x22'):var _0x2e3baa=_0x500b58['appdata'][_0xa883('0x23')](',');_0x114781['push'](_0x2e3baa[0x0]);_0x114781[_0xa883('0x24')](_0x2e3baa[_0xa883('0x25')](0x1,_0x2e3baa['length'])[_0xa883('0x1f')](','));break;case _0xa883('0x26'):var _0x2a6b72=_0x500b58[_0xa883('0x27')][_0xa883('0x23')](',');_0x114781[_0xa883('0x24')](_0x2a6b72[0x0]);_0x114781[_0xa883('0x24')](_0x2a6b72[0x1]);_0x114781[_0xa883('0x24')](_0x2a6b72['slice'](0x2,_0x2a6b72[_0xa883('0x1d')])[_0xa883('0x1f')](','));break;case _0xa883('0x28'):var _0x2f8d2b=_0x500b58[_0xa883('0x27')][_0xa883('0x23')](',');_0x114781[_0xa883('0x24')](_0x2f8d2b[0x0]);_0x114781['push'](_0x2f8d2b[0x1]);_0x114781['push'](_0x2f8d2b[0x2]);_0x114781[_0xa883('0x24')](_0x2f8d2b[0x3]);_0x114781[_0xa883('0x24')](_0x2f8d2b[_0xa883('0x25')](0x4,_0x2f8d2b[_0xa883('0x1d')])[_0xa883('0x1f')](','));break;case _0xa883('0x29'):var _0x2e2727=_0x500b58['appdata']['split'](',');_0x114781[_0xa883('0x24')](_0x2e2727[0x0]);_0x114781[_0xa883('0x24')](_0x2e2727[0x1]);_0x114781[_0xa883('0x24')](_0x2e2727[0x2]);_0x114781[_0xa883('0x24')](_0x2e2727[0x3]);_0x114781[_0xa883('0x24')](_0x2e2727['slice'](0x4,_0x2e2727['length'])[_0xa883('0x1f')](','));break;case _0xa883('0x19'):_0x114781[_0xa883('0x24')](_0x500b58['appdata']);break;case _0xa883('0x2a'):_0x114781[_0xa883('0x24')](_0x500b58['TagId']);_0x114781[_0xa883('0x24')](_0x500b58[_0xa883('0x27')]);break;default:_0x114781=_[_0xa883('0x11')](_0x500b58[_0xa883('0x27')])?[]:_0x500b58['appdata'][_0xa883('0x23')](',');}var _0xfde1de={'id':util[_0xa883('0xf')](_0xa883('0x2b'),_0xff598a,_0x500b58['id'],_0x500b58[_0xa883('0x2c')]),'condition':require(_0xa883('0x2d'))[_0xa883('0x2e')](_0xff598a,getIntervals(_0x4febfb[_0xa883('0x2f')],_0x500b58),_0x4febfb),'consequence':require('./applications/'+_0x500b58[_0xa883('0x2c')])['consequence'](_0xff598a,_0x114781,_0x4febfb,_0x591505),'p':_0x500b58[_0xa883('0x30')]||0x0};logger[_0xa883('0x31')](_0xa883('0x32'),_0xfde1de['id'],_0xa883('0x33'),getIntervals(_0x4febfb['intervals'],_0x500b58)[_0xa883('0x1f')](_0xa883('0x34')));_0x524b82[_0xa883('0x24')](_0xfde1de);}else{logger[_0xa883('0x35')](_0xa883('0x36'),path[_0xa883('0x1f')](__dirname,_0xa883('0x1b'),_0x500b58[_0xa883('0x2c')]+_0xa883('0x20')));}}_0x4febfb['rules'][_0xff598a]=new RuleEngine(_0x524b82);_0x4febfb[_0xa883('0x17')][_0xff598a][_0xa883('0x37')](_0x591505,function(_0x26271e){logger['info'](_0xa883('0x38'),JSON[_0xa883('0x39')](_0x26271e['matchPath']));if(_0x4febfb[_0xa883('0x17')][_0xff598a]){_0x4febfb[_0xa883('0x17')][_0xff598a][_0xa883('0x3a')](_0xa883('0x3b'));}});return _0x524067({'code':0xc8,'message':_0x591505});}else{logger[_0xa883('0x31')](_0xa883('0x3c'));return _0x524067({'code':0xc8,'message':_0x591505});}}catch(_0x38efd0){logger[_0xa883('0x35')](_0x38efd0['stack']);return _0x550030(_0x33f326[_0xa883('0x35')](0x1f4,_0x38efd0));}}return _0x550030('routing\x20is\x20empty');});},'AcceptMessage':function(_0x56f784){var _0x57cd15=this;return new Promise(function(_0x264d75,_0x203611){if(_0x56f784[_0xa883('0x19')]&&_0x56f784[_0xa883('0x19')]['id']){try{var _0x49dbec=getId(_0x56f784['channel'],_0x56f784['message']?_0x56f784[_0xa883('0x19')]['id']:0x0,_0x56f784[_0xa883('0x1a')]?_0x56f784[_0xa883('0x1a')]['id']:0x0);if(_0x4febfb[_0xa883('0x17')][_0x49dbec]){_0x4febfb[_0xa883('0x17')][_0x49dbec]['emit'](_0xa883('0x3d'));if(rpc[_0x56f784[_0xa883('0x18')]+'QueueReport']){rpc[_0x56f784[_0xa883('0x18')]+'QueueReport'][_0xa883('0x3e')](_0x49dbec,{'UserId':_0x56f784[_0xa883('0x19')][_0xa883('0x3f')]})[_0xa883('0x40')](function(_0x48e68c){logger[_0xa883('0x35')](_0xa883('0x41'));});}}return _0x264d75({'code':0xc8,'message':_0x56f784});}catch(_0x20ea75){logger['error'](_0x20ea75[_0xa883('0x42')]);return _0x203611(_0x57cd15['error'](0x1f4,_0x20ea75));}}logger[_0xa883('0x35')](_0xa883('0x43'));return _0x203611(_0x57cd15[_0xa883('0x35')](0x1f4,_0xa883('0x43')));});},'RejectMessage':function(_0x273435){var _0x39162b=this;return new Promise(function(_0x4a3fd5,_0x27cb00){if(_0x273435[_0xa883('0x44')]&&_0x273435[_0xa883('0x44')]['id']){try{if(_0x4febfb[_0xa883('0x45')][_0x273435[_0xa883('0x44')]['id']]){_0x4febfb[_0xa883('0x45')][_0x273435[_0xa883('0x44')]['id']]['busy']=![];_0x4febfb[_0xa883('0x45')][_0x273435[_0xa883('0x44')]['id']][_0xa883('0x46')]=undefined;}return _0x4a3fd5({'code':0xc8,'message':_0x273435});}catch(_0x4c06b3){logger[_0xa883('0x35')](_0x4c06b3[_0xa883('0x42')]);return _0x27cb00(_0x39162b['error'](0x1f4,_0x4c06b3));}}logger[_0xa883('0x35')]('message\x20is\x20empty');return _0x27cb00(_0x39162b[_0xa883('0x35')](0x1f4,_0xa883('0x43')));});},'AbandonInteraction':function(_0x357000){var _0x195c1d=this;return new Promise(function(_0x29288a,_0x53eec3){if(_0x357000['channel']&&_0x357000['interaction']&&_0x357000[_0xa883('0x1a')]['id']){try{var _0x1cde8c=getId(_0x357000['channel'],_0x357000['message']?_0x357000[_0xa883('0x19')]['id']:0x0,_0x357000[_0xa883('0x1a')]?_0x357000['interaction']['id']:0x0);if(_0x4febfb[_0xa883('0x17')][_0x1cde8c]){_0x4febfb[_0xa883('0x17')][_0x1cde8c][_0xa883('0x3a')](_0xa883('0x3d'));}return _0x29288a({'code':0xc8,'message':_0x357000});}catch(_0x238fd7){logger[_0xa883('0x35')](_0x238fd7[_0xa883('0x42')]);return _0x53eec3(_0x195c1d[_0xa883('0x35')](0x1f4,_0x238fd7));}}logger[_0xa883('0x35')](_0xa883('0x43'));return _0x53eec3(_0x195c1d['error'](0x1f4,_0xa883('0x43')));});},'AgentCapacity':function(_0x3a2b7b){var _0x7a8186=this;return new Promise(function(_0x1d0bd2,_0x68baf9){if(_0x4febfb[_0xa883('0x45')][_0xa883('0x47')](_0x3a2b7b['id'])){for(var _0x3f8a54 in _0x3a2b7b['capacity']){if(_0x3a2b7b['capacity'][_0xa883('0x47')](_0x3f8a54)){if(_0x4febfb[_0xa883('0x45')][_0x3a2b7b['id']][_0xa883('0x47')](_0x3f8a54+'CurrentCapacity')){_0x4febfb[_0xa883('0x45')][_0x3a2b7b['id']][_0x3f8a54+_0xa883('0x48')]=parseInt(_0x3a2b7b[_0xa883('0x49')][_0x3f8a54],0xa);}}}_0x4febfb['agents'][_0x3a2b7b['id']][_0xa883('0x4a')]();return _0x1d0bd2({'code':0xc8,'message':_0x4febfb[_0xa883('0x45')][_0x3a2b7b['id']]});}else{return _0x68baf9(_0x7a8186[_0xa883('0x35')](0x1f4,_0xa883('0x4b')));}});},'Agents':function(_0x51938d){return new Promise(function(_0xd3a3f0,_0x49c613){var _0x36091e=_[_0xa883('0x4c')](_0x4febfb[_0xa883('0x45')]);_0xd3a3f0({'count':_0x36091e[_0xa883('0x1d')],'rows':_0x36091e});});},'ChatQueues':function(_0x3e9fcb){return new Promise(function(_0x5af213,_0x28c8cd){var _0x6e8a00=[];for(var _0x3906d8 in _0x4febfb[_0xa883('0x4d')]){if(_0x4febfb[_0xa883('0x4d')][_0xa883('0x47')](_0x3906d8)){var _0x422c78=_0x4febfb['chatQueues'][_0x3906d8];var _0x303ca8={'id':_0x422c78['id'],'available':_0x422c78[_0xa883('0x4e')],'loggedIn':_0x422c78[_0xa883('0x4f')],'name':_0x422c78[_0xa883('0x50')],'paused':_0x422c78[_0xa883('0x51')],'waiting':_0x422c78[_0xa883('0x52')]};_0x6e8a00[_0xa883('0x24')](_0x303ca8);}}_0x5af213({'count':_0x6e8a00[_0xa883('0x1d')],'rows':_0x6e8a00});});},'MailQueues':function(_0x4bf507){return new Promise(function(_0x17c1ea,_0x4cf9b){var _0x2f4173=[];for(var _0x465dcd in _0x4febfb['mailQueues']){if(_0x4febfb['mailQueues'][_0xa883('0x47')](_0x465dcd)){var _0x4fd982=_0x4febfb[_0xa883('0x53')][_0x465dcd];var _0x5a5c4e={'id':_0x4fd982['id'],'available':_0x4fd982[_0xa883('0x4e')],'loggedIn':_0x4fd982[_0xa883('0x4f')],'name':_0x4fd982[_0xa883('0x50')],'paused':_0x4fd982['paused'],'waiting':_0x4fd982[_0xa883('0x52')]};_0x2f4173['push'](_0x5a5c4e);}}_0x17c1ea({'count':_0x2f4173[_0xa883('0x1d')],'rows':_0x2f4173});});},'OpenchannelQueues':function(_0x32e35e){return new Promise(function(_0xd5ed13,_0x42730f){var _0x3cbe46=[];for(var _0xaa1468 in _0x4febfb[_0xa883('0x54')]){if(_0x4febfb[_0xa883('0x54')][_0xa883('0x47')](_0xaa1468)){var _0x100a63=_0x4febfb[_0xa883('0x54')][_0xaa1468];var _0x4742ac={'id':_0x100a63['id'],'available':_0x100a63[_0xa883('0x4e')],'loggedIn':_0x100a63['loggedIn'],'name':_0x100a63['name'],'paused':_0x100a63[_0xa883('0x51')],'waiting':_0x100a63[_0xa883('0x52')]};_0x3cbe46[_0xa883('0x24')](_0x4742ac);}}_0xd5ed13({'count':_0x3cbe46['length'],'rows':_0x3cbe46});});},'SmsQueues':function(_0x5bf277){return new Promise(function(_0x37c81a,_0x196d54){var _0x4aa2a9=[];for(var _0x2a2908 in _0x4febfb[_0xa883('0x55')]){if(_0x4febfb[_0xa883('0x55')]['hasOwnProperty'](_0x2a2908)){var _0x13a9c7=_0x4febfb[_0xa883('0x55')][_0x2a2908];var _0x35c2f6={'id':_0x13a9c7['id'],'available':_0x13a9c7['available'],'loggedIn':_0x13a9c7[_0xa883('0x4f')],'name':_0x13a9c7[_0xa883('0x50')],'paused':_0x13a9c7['paused'],'waiting':_0x13a9c7[_0xa883('0x52')]};_0x4aa2a9[_0xa883('0x24')](_0x35c2f6);}}_0x37c81a({'count':_0x4aa2a9[_0xa883('0x1d')],'rows':_0x4aa2a9});});},'FaxQueues':function(_0x3d4825){return new Promise(function(_0x40c4d6,_0x2052df){var _0x460991=[];for(var _0x59259e in _0x4febfb[_0xa883('0x56')]){if(_0x4febfb['faxQueues'][_0xa883('0x47')](_0x59259e)){var _0xc253c1=_0x4febfb[_0xa883('0x56')][_0x59259e];var _0x1a1077={'id':_0xc253c1['id'],'available':_0xc253c1[_0xa883('0x4e')],'loggedIn':_0xc253c1[_0xa883('0x4f')],'name':_0xc253c1[_0xa883('0x50')],'paused':_0xc253c1[_0xa883('0x51')],'waiting':_0xc253c1[_0xa883('0x52')]};_0x460991['push'](_0x1a1077);}}_0x40c4d6({'count':_0x460991[_0xa883('0x1d')],'rows':_0x460991});});},'WhatsappQueues':function(_0x4a7cb4){return new Promise(function(_0x6bb592,_0x360121){var _0x50c44a=[];for(var _0x571919 in _0x4febfb[_0xa883('0x57')]){if(_0x4febfb[_0xa883('0x57')][_0xa883('0x47')](_0x571919)){var _0x3c2344=_0x4febfb[_0xa883('0x57')][_0x571919];var _0x5b5761={'id':_0x3c2344['id'],'available':_0x3c2344[_0xa883('0x4e')],'loggedIn':_0x3c2344['loggedIn'],'name':_0x3c2344['name'],'paused':_0x3c2344[_0xa883('0x51')],'waiting':_0x3c2344['waiting']};_0x50c44a[_0xa883('0x24')](_0x5b5761);}}_0x6bb592({'count':_0x50c44a[_0xa883('0x1d')],'rows':_0x50c44a});});},'ChatQueuesWaitingInteractions':function(_0x40e24a){return new Promise(function(_0x1f4a63,_0x5b0a3b){var _0x14b9e2=_[_0xa883('0x4c')](_0x4febfb[_0xa883('0x58')]);_0x1f4a63({'count':_0x14b9e2[_0xa883('0x1d')],'rows':_0x14b9e2});});},'MailQueuesWaitingInteractions':function(_0x2bd638){return new Promise(function(_0x4b48d8,_0x3db22b){var _0x49310c=_['values'](_0x4febfb[_0xa883('0x59')]);_0x4b48d8({'count':_0x49310c[_0xa883('0x1d')],'rows':_0x49310c});});},'OpenchannelQueuesWaitingInteractions':function(_0x34db77){return new Promise(function(_0x1da8b7,_0x5473bf){var _0x47e275=_['values'](_0x4febfb['openchannelQueuesWaitingInteractions']);_0x1da8b7({'count':_0x47e275['length'],'rows':_0x47e275});});},'SmsQueuesWaitingInteractions':function(_0xe3cfd2){return new Promise(function(_0xed5972,_0x2daf7c){var _0x161fa7=_[_0xa883('0x4c')](_0x4febfb[_0xa883('0x5a')]);_0xed5972({'count':_0x161fa7[_0xa883('0x1d')],'rows':_0x161fa7});});},'FaxQueuesWaitingInteractions':function(_0x420f6c){return new Promise(function(_0x35d4a7,_0x4e4e76){var _0x243a20=_['values'](_0x4febfb[_0xa883('0x5b')]);_0x35d4a7({'count':_0x243a20[_0xa883('0x1d')],'rows':_0x243a20});});},'WhatsappQueuesWaitingInteractions':function(_0x344eb5){return new Promise(function(_0x22e569,_0x3eb377){var _0x6849ff=_[_0xa883('0x4c')](_0x4febfb['whatsappQueuesWaitingInteractions']);_0x22e569({'count':_0x6849ff[_0xa883('0x1d')],'rows':_0x6849ff});});}};var _0x269221=jayson['server'](_0x3ab6ce)[_0xa883('0x5c')]();_0x269221['on']('error',function(_0x4b2b0e){logger['error'](JSON['stringify'](_0x4b2b0e));return _0x3badac(_0x4b2b0e);});_0x269221[_0xa883('0x16')](0x232c,_0xa883('0x5d'),function(){console[_0xa883('0x5e')](_0xa883('0x5f'),0x232c);return _0x372bb5(_0xa883('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9647db5..5d382cd 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 _0x8251=['log','stack','util','bluebird','jayson/promise','lodash','routing','client','http','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','iftime\x20%s','then','message','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x1076c0,_0x172051){var _0x47881b=function(_0x4d9a70){while(--_0x4d9a70){_0x1076c0['push'](_0x1076c0['shift']());}};_0x47881b(++_0x172051);}(_0x8251,0x107));var _0x1825=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8251[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0x1825('0x0'));var BPromise=require(_0x1825('0x1'));var jayson=require(_0x1825('0x2'));var _=require(_0x1825('0x3'));var logger=require('../../../config/logger')(_0x1825('0x4'));var client=jayson[_0x1825('0x5')][_0x1825('0x6')]({'port':0x232a});function request(_0x2b86fa,_0x1920ce){return new BPromise(function(_0xffed9,_0x1b676f){return client['request'](_0x2b86fa,_0x1920ce)['then'](function(_0x153f41){if(_0x153f41[_0x1825('0x7')]){return _0x1b676f(_0x153f41[_0x1825('0x7')]['message']);}else{return _0xffed9(_0x153f41[_0x1825('0x8')]);}})[_0x1825('0x9')](function(_0x55644d){return _0x1b676f(_0x55644d);});});}exports['condition']=function(_0x4a4126,_0x62d6f0,_0x155352){return function(_0xa28205){if(_0x155352[_0x1825('0xa')]&&!_0x155352['rules'][_0x4a4126]){logger[_0x1825('0xb')](_0x1825('0xc'),_0x4a4126);return _0xa28205[_0x1825('0xd')]();}var _0x11003d=[];for(var _0x46509a=0x0;_0x46509a<_0x62d6f0['length'];_0x46509a+=0x1){_0x11003d[_0x1825('0xe')](request('Command',{'command':util[_0x1825('0xf')](_0x1825('0x10'),_0x62d6f0[_0x46509a])})[_0x1825('0x11')](function(_0x43006b){return _0x43006b&&_0x43006b[_0x1825('0x12')]&&_0x43006b[_0x1825('0x12')][_0x1825('0x13')]('true')>=0x0?!![]:![];})[_0x1825('0x9')](function(_0x407f53){logger[_0x1825('0x7')](_0x1825('0x14'),_0x4a4126,_0x62d6f0[_0x46509a]);}));}BPromise[_0x1825('0x15')](_0x11003d)[_0x1825('0x11')](function(_0x387719){var _0x218d01=_[_0x1825('0x16')](_0x387719);logger['info'](_0x1825('0x17'),_0x4a4126,_0x62d6f0[_0x1825('0x18')](_0x1825('0x19')),_0x218d01);_0xa28205[_0x1825('0x1a')](_0x218d01);})[_0x1825('0x9')](function(_0x97828){console[_0x1825('0x1b')](_0x97828);logger[_0x1825('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x4a4126,_0x62d6f0['join']('\x20|\x20'),_0x97828[_0x1825('0x1c')]);_0xa28205[_0x1825('0xd')]();});};}; \ No newline at end of file +var _0xa16d=['join','when','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','length','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x1450ee,_0x35644c){var _0x3d02a7=function(_0xd0908a){while(--_0xd0908a){_0x1450ee['push'](_0x1450ee['shift']());}};_0x3d02a7(++_0x35644c);}(_0xa16d,0x18a));var _0xda16=function(_0x2b78e5,_0x3126f8){_0x2b78e5=_0x2b78e5-0x0;var _0xa8d52d=_0xa16d[_0x2b78e5];return _0xa8d52d;};'use strict';var util=require(_0xda16('0x0'));var BPromise=require(_0xda16('0x1'));var jayson=require(_0xda16('0x2'));var _=require(_0xda16('0x3'));var logger=require(_0xda16('0x4'))(_0xda16('0x5'));var client=jayson[_0xda16('0x6')][_0xda16('0x7')]({'port':0x232a});function request(_0x5ad14c,_0x1aac6c){return new BPromise(function(_0x2a8340,_0x5c697c){return client[_0xda16('0x8')](_0x5ad14c,_0x1aac6c)[_0xda16('0x9')](function(_0x937248){if(_0x937248[_0xda16('0xa')]){return _0x5c697c(_0x937248[_0xda16('0xa')][_0xda16('0xb')]);}else{return _0x2a8340(_0x937248[_0xda16('0xc')]);}})[_0xda16('0xd')](function(_0x4cad5e){return _0x5c697c(_0x4cad5e);});});}exports[_0xda16('0xe')]=function(_0x1ba7ae,_0x320561,_0x26c516){return function(_0x2b216f){if(_0x26c516[_0xda16('0xf')]&&!_0x26c516[_0xda16('0xf')][_0x1ba7ae]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1ba7ae);return _0x2b216f['stop']();}var _0x286aa9=[];for(var _0x13c6ce=0x0;_0x13c6ce<_0x320561[_0xda16('0x10')];_0x13c6ce+=0x1){_0x286aa9['push'](request(_0xda16('0x11'),{'command':util['format'](_0xda16('0x12'),_0x320561[_0x13c6ce])})[_0xda16('0x9')](function(_0x136022){return _0x136022&&_0x136022[_0xda16('0xb')]&&_0x136022[_0xda16('0xb')][_0xda16('0x13')](_0xda16('0x14'))>=0x0?!![]:![];})['catch'](function(_0x5a2613){logger[_0xda16('0xa')](_0xda16('0x15'),_0x1ba7ae,_0x320561[_0x13c6ce]);}));}BPromise[_0xda16('0x16')](_0x286aa9)['then'](function(_0x4f992e){var _0x427a81=_[_0xda16('0x17')](_0x4f992e);logger[_0xda16('0x18')](_0xda16('0x19'),_0x1ba7ae,_0x320561[_0xda16('0x1a')]('\x20|\x20'),_0x427a81);_0x2b216f[_0xda16('0x1b')](_0x427a81);})['catch'](function(_0x332f12){console['log'](_0x332f12);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x1ba7ae,_0x320561[_0xda16('0x1a')]('\x20|\x20'),_0x332f12['stack']);_0x2b216f['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 34392f2..2603ff4 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 _0x14b4=['debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','push','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','reason','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertype','transferexten','secondtransfererexten','transfertargetuniqueid','calleridnum','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','complete','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','type','agentacw','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','agentcalled'];(function(_0xfd3e58,_0x2276f0){var _0x5aac07=function(_0x5d5b67){while(--_0x5d5b67){_0xfd3e58['push'](_0xfd3e58['shift']());}};_0x5aac07(++_0x2276f0);}(_0x14b4,0x97));var _0x414b=function(_0x275e03,_0x49e067){_0x275e03=_0x275e03-0x0;var _0x2ea2b0=_0x14b4[_0x275e03];return _0x2ea2b0;};'use strict';var _=require(_0x414b('0x0'));var util=require(_0x414b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1f23d7,_0x44c0ff){utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x4'),_0x1f23d7['uniqueid'],_0x1f23d7['channel'],_0x1f23d7[_0x414b('0x5')],_0x1f23d7[_0x414b('0x6')],_0x1f23d7[_0x414b('0x7')],_0x1f23d7['calleridnum'],_0x1f23d7[_0x414b('0x8')],_0x1f23d7['lastevent']));if(_0x1f23d7[_0x414b('0x5')]){utils['getVoiceQueueByName'](_0x1f23d7['queue'])['then'](function(_0x487de2){if(_0x487de2){_0x1f23d7[_0x414b('0x9')]=_0x487de2['type'];_0x1f23d7[_0x414b('0xa')]=_0x1f23d7['agentcomplete']?_0x487de2[_0x414b('0xb')]:![];_0x1f23d7[_0x414b('0xc')]=_0x1f23d7[_0x414b('0xa')]?_0x487de2['acwTimeout']:0x0;}utils[_0x414b('0xd')](_0x414b('0xe'),_0x1f23d7);});}else{utils['request'](_0x414b('0xe'),_0x1f23d7);}if(_0x44c0ff){delete transfers[_0x1f23d7[_0x414b('0xf')]];}else{delete agents[_0x1f23d7['destuniqueid']];}}exports[_0x414b('0x10')]=function(_0x236e62){try{utils[_0x414b('0x11')](util[_0x414b('0x3')](_0x414b('0x12'),_0x236e62[_0x414b('0xf')]),_0x236e62);agents[_0x236e62[_0x414b('0x13')]]=_0x236e62;agents[_0x236e62[_0x414b('0x13')]][_0x414b('0x14')]=utils[_0x414b('0x15')]();agents[_0x236e62[_0x414b('0x13')]][_0x414b('0x16')]=_0x414b('0x17');agents[_0x236e62['destuniqueid']][_0x414b('0x8')]=null;agents[_0x236e62['destuniqueid']]['connectedlinename']=null;utils[_0x414b('0x2')](util[_0x414b('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x236e62[_0x414b('0xf')],agents[_0x236e62[_0x414b('0x13')]][_0x414b('0x6')],_0x236e62[_0x414b('0x13')]));}catch(_0xab516e){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x12'),_0x236e62[_0x414b('0xf')]),_0xab516e);}};exports['agentringnoanswer']=function(_0x2fa240){try{if(!_[_0x414b('0x19')](agents[_0x2fa240[_0x414b('0x13')]])){utils[_0x414b('0x11')](util[_0x414b('0x3')](_0x414b('0x1a'),_0x2fa240['uniqueid']),_0x2fa240);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x1b'),_0x2fa240[_0x414b('0xf')],agents[_0x2fa240[_0x414b('0x13')]]['membername'],_0x2fa240[_0x414b('0x13')]));agents[_0x2fa240[_0x414b('0x13')]][_0x414b('0x1c')]=!![];agents[_0x2fa240['destuniqueid']][_0x414b('0x1d')]=utils[_0x414b('0x15')]();agents[_0x2fa240[_0x414b('0x13')]][_0x414b('0x16')]=_0x414b('0x1e');agents[_0x2fa240[_0x414b('0x13')]]['reason']=_0x414b('0x1e');agents[_0x2fa240[_0x414b('0x13')]][_0x414b('0x1f')]=_0x2fa240[_0x414b('0x20')]?parseInt(_0x2fa240[_0x414b('0x20')])/0x3e8:0x0;agents[_0x2fa240[_0x414b('0x13')]]['talktime']=0x0;unanswered[_0x414b('0x21')](_0x2fa240[_0x414b('0x13')]);}}catch(_0x4228dc){utils['error'](util[_0x414b('0x3')](_0x414b('0x1a'),_0x2fa240[_0x414b('0xf')]),_0x4228dc);}};exports['queuecallerabandon']=function(_0x4c59b2){try{_['forIn'](agents,function(_0x299355,_0x349454){if(_0x299355['uniqueid']==_0x4c59b2['uniqueid']&&!_[_0x414b('0x22')](unanswered,_0x299355[_0x414b('0x13')])){utils['debug'](util[_0x414b('0x3')](_0x414b('0x23'),_0x4c59b2[_0x414b('0xf')]),_0x4c59b2);utils[_0x414b('0x2')](util['format'](_0x414b('0x24'),_0x4c59b2[_0x414b('0xf')],_0x299355['membername'],_0x299355[_0x414b('0x13')]));_0x299355['agentringnoanswer']=!![];_0x299355[_0x414b('0x1d')]=utils[_0x414b('0x15')]();_0x299355[_0x414b('0x16')]='abandoned';_0x299355['reason']=_0x414b('0x25');_0x299355[_0x414b('0x1f')]=_0x4c59b2['holdtime'];_0x299355[_0x414b('0x26')]=0x0;writeDB(_0x299355);}});}catch(_0xc486d1){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x23'),_0x4c59b2['uniqueid']),_0xc486d1);}};exports[_0x414b('0x27')]=function(_0x37eec3){try{if(agents[_0x37eec3[_0x414b('0x13')]]){utils[_0x414b('0x11')](util['format'](_0x414b('0x28'),_0x37eec3[_0x414b('0xf')]),_0x37eec3);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x29'),_0x37eec3[_0x414b('0xf')],agents[_0x37eec3['destuniqueid']][_0x414b('0x6')],_0x37eec3['destuniqueid']));agents[_0x37eec3['destuniqueid']][_0x414b('0x2a')]=utils['now']();agents[_0x37eec3[_0x414b('0x13')]]['connectedlinenum']=_0x37eec3['connectedlinenum'];agents[_0x37eec3['destuniqueid']][_0x414b('0x2b')]=_0x37eec3[_0x414b('0x2b')];agents[_0x37eec3[_0x414b('0x13')]][_0x414b('0x1f')]=_0x37eec3[_0x414b('0x20')];agents[_0x37eec3[_0x414b('0x13')]][_0x414b('0x16')]='connect';_[_0x414b('0x2c')](agents,function(_0x4b53e7,_0x19e232){if(_0x4b53e7[_0x414b('0x13')]!=_0x37eec3['destuniqueid']&&_0x4b53e7[_0x414b('0xf')]==_0x37eec3['uniqueid']){_0x4b53e7[_0x414b('0x26')]=0x0;_0x4b53e7['holdtime']=_0x37eec3[_0x414b('0x20')];_0x4b53e7['agentringnoanswer']=!![];_0x4b53e7['agentringnoanswerAt']=utils[_0x414b('0x15')]();_0x4b53e7[_0x414b('0x16')]=_0x414b('0x2d');_0x4b53e7['reason']=_0x414b('0x2d');_0x4b53e7[_0x414b('0x2e')]=_0x37eec3['destuniqueid'];_0x4b53e7['answeredelsewheremembername']=_0x37eec3[_0x414b('0x6')];writeDB(_0x4b53e7);}});}}catch(_0x563e6f){utils['error'](util['format']('[%s][agents][agentconnect]',_0x37eec3['uniqueid']),_0x563e6f);}};exports[_0x414b('0x2f')]=function(_0x5df450){try{if(!_[_0x414b('0x19')](agents[_0x5df450[_0x414b('0x13')]])){utils[_0x414b('0x11')](util['format'](_0x414b('0x30'),_0x5df450[_0x414b('0xf')]),_0x5df450);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x31'),_0x5df450['uniqueid'],agents[_0x5df450['destuniqueid']]['membername'],_0x5df450[_0x414b('0x13')]));agents[_0x5df450[_0x414b('0x13')]]['agentcomplete']=!![];agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x32')]=utils[_0x414b('0x15')]();agents[_0x5df450[_0x414b('0x13')]]['talktime']=utils['diffTime'](agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x32')],agents[_0x5df450[_0x414b('0x13')]]['agentconnectAt']);agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x33')]=_0x5df450['reason'];agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x16')]='complete';writeDB(agents[_0x5df450[_0x414b('0x13')]]);}}catch(_0xfa4e1f){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x30'),_0x5df450['uniqueid']),_0xfa4e1f);}};exports[_0x414b('0x34')]=function(_0x32674a){try{if(!_[_0x414b('0x19')](agents[_0x32674a[_0x414b('0x35')]])){utils[_0x414b('0x11')](util['format'](_0x414b('0x36'),_0x32674a[_0x414b('0xf')]),_0x32674a);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x37'),_0x32674a[_0x414b('0xf')],agents[_0x32674a['transfereruniqueid']]['membername'],agents[_0x32674a[_0x414b('0x35')]][_0x414b('0xf')]));agents[_0x32674a[_0x414b('0x35')]]['transfer']=!![];agents[_0x32674a[_0x414b('0x35')]]['transfertype']='blind';agents[_0x32674a[_0x414b('0x35')]]['transferexten']=_0x32674a[_0x414b('0x38')];agents[_0x32674a['transfereruniqueid']][_0x414b('0x39')]=agents[_0x32674a[_0x414b('0x35')]][_0x414b('0xf')];}}catch(_0x1f9ccb){utils['error'](util['format']('[%s][agents][blindtransfer]',_0x32674a[_0x414b('0xf')]),_0x1f9ccb);}};exports[_0x414b('0x3a')]=function(_0x23cfba){try{utils[_0x414b('0x11')](util[_0x414b('0x3')]('[%s][agents][attendedtransfer]',_0x23cfba[_0x414b('0x3b')]),_0x23cfba);if(_0x23cfba[_0x414b('0x3b')]==_0x23cfba['origtransfererlinkedid']){if(!_[_0x414b('0x19')](agents[_0x23cfba[_0x414b('0x3c')]])){utils['info'](util[_0x414b('0x3')](_0x414b('0x3d'),_0x23cfba[_0x414b('0x3b')],agents[_0x23cfba['secondtransfereruniqueid']][_0x414b('0x6')]));agents[_0x23cfba[_0x414b('0x3c')]][_0x414b('0x3e')]=!![];agents[_0x23cfba[_0x414b('0x3c')]]['transfertype']=_0x414b('0x3f');agents[_0x23cfba[_0x414b('0x3c')]]['transferexten']=_0x23cfba[_0x414b('0x40')];agents[_0x23cfba[_0x414b('0x3c')]]['transferuniqueid']=_0x23cfba['origtransfereruniqueid'];}if(_0x23cfba[_0x414b('0x41')]&&agents[_0x23cfba[_0x414b('0x41')]]){agents[_0x23cfba['transfereeuniqueid']][_0x414b('0x42')]=0x1;transfers[_0x23cfba[_0x414b('0x41')]]=_[_0x414b('0x43')](agents[_0x23cfba[_0x414b('0x41')]]);transfers[_0x23cfba[_0x414b('0x41')]]['calleridnum']=agents[_0x23cfba[_0x414b('0x3c')]]['calleridnum'];transfers[_0x23cfba[_0x414b('0x41')]][_0x414b('0x44')]=agents[_0x23cfba['secondtransfereruniqueid']][_0x414b('0x44')];transfers[_0x23cfba[_0x414b('0x41')]][_0x414b('0x14')]=utils[_0x414b('0x15')]();transfers[_0x23cfba['transfereeuniqueid']]['agentconnectAt']=utils[_0x414b('0x15')]();transfers[_0x23cfba[_0x414b('0x41')]][_0x414b('0x1f')]=0x0;transfers[_0x23cfba['transfereeuniqueid']][_0x414b('0x42')]=0x2;}}else if(_0x23cfba['secondtransfereruniqueid']==_0x23cfba['secondtransfererlinkedid']){if(!_[_0x414b('0x19')](agents[_0x23cfba[_0x414b('0x3b')]])){utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x3d'),_0x23cfba[_0x414b('0x3b')],agents[_0x23cfba['origtransfereruniqueid']]['membername']));agents[_0x23cfba['origtransfereruniqueid']][_0x414b('0x3e')]=!![];agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x45')]=_0x414b('0x3f');agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x46')]=_0x23cfba[_0x414b('0x47')];agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x39')]=_0x23cfba[_0x414b('0x3c')];}if(_0x23cfba['transfertargetuniqueid']&&agents[_0x23cfba[_0x414b('0x48')]]){agents[_0x23cfba[_0x414b('0x48')]][_0x414b('0x42')]=0x1;transfers[_0x23cfba['transfertargetuniqueid']]=_[_0x414b('0x43')](agents[_0x23cfba['transfertargetuniqueid']]);transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x49')]=agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x49')];transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x44')]=agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x44')];transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x14')]=utils['now']();transfers[_0x23cfba['transfertargetuniqueid']]['agentconnectAt']=utils[_0x414b('0x15')]();transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x1f')]=0x0;transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x42')]=0x2;}}}catch(_0x20c328){utils['error'](util[_0x414b('0x3')](_0x414b('0x4a'),_0x23cfba[_0x414b('0x3b')]),_0x20c328);}};exports[_0x414b('0x4b')]=function(_0x49eb8c){try{utils[_0x414b('0x11')](util['format'](_0x414b('0x4c'),_0x49eb8c[_0x414b('0xf')]),_0x49eb8c);if(agents[_0x49eb8c[_0x414b('0xf')]]&&agents[_0x49eb8c['uniqueid']][_0x414b('0x33')]==='timeout'){if(_0x49eb8c[_0x414b('0x4d')]==='21'){agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')]=_0x414b('0x4e');agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]=_0x414b('0x4e');}utils[_0x414b('0x2')](util['format'](_0x414b('0x4f'),_0x49eb8c[_0x414b('0xf')],agents[_0x49eb8c[_0x414b('0xf')]]['membername'],agents[_0x49eb8c['uniqueid']][_0x414b('0x33')],agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]));writeDB(agents[_0x49eb8c[_0x414b('0xf')]]);var _0x2e4a7a=unanswered[_0x414b('0x50')](_0x49eb8c[_0x414b('0xf')]);if(_0x2e4a7a>-0x1){unanswered['splice'](_0x2e4a7a,0x1);}}if(transfers[_0x49eb8c[_0x414b('0xf')]]){transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x2f')]=!![];transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x32')]=utils[_0x414b('0x15')]();transfers[_0x49eb8c['uniqueid']][_0x414b('0x26')]=utils[_0x414b('0x51')](transfers[_0x49eb8c['uniqueid']]['agentcompleteAt'],transfers[_0x49eb8c[_0x414b('0xf')]]['agentconnectAt']);transfers[_0x49eb8c['uniqueid']][_0x414b('0x33')]=_0x414b('0x52');transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]=_0x414b('0x53');utils[_0x414b('0x2')](util[_0x414b('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x49eb8c[_0x414b('0xf')],transfers[_0x49eb8c['uniqueid']][_0x414b('0x6')],transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')],transfers[_0x49eb8c['uniqueid']][_0x414b('0x16')]));writeDB(transfers[_0x49eb8c[_0x414b('0xf')]],!![]);}if(agents[_0x49eb8c[_0x414b('0xf')]]&&agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x2a')]){agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x2f')]=!![];agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x32')]=utils['now']();agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x26')]=utils[_0x414b('0x51')](agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x32')],agents[_0x49eb8c['uniqueid']][_0x414b('0x2a')]);agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')]=agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x3e')]?_0x414b('0x3e'):_0x414b('0x52');agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]='complete';utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x4f'),_0x49eb8c[_0x414b('0xf')],agents[_0x49eb8c[_0x414b('0xf')]]['membername'],agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')],agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]));writeDB(agents[_0x49eb8c[_0x414b('0xf')]]);}}catch(_0x47f9ba){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x4c'),_0x49eb8c['uniqueid']),_0x47f9ba);}}; \ No newline at end of file +var _0xf222=['type','agentacw','acw','acwtime','CreateVoiceAgentReport','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','forIn','includes','[%s][agents][queuecallerabandon]','reason','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','then'];(function(_0x575194,_0x3881a3){var _0x832aff=function(_0x43b847){while(--_0x43b847){_0x575194['push'](_0x575194['shift']());}};_0x832aff(++_0x3881a3);}(_0xf222,0x18c));var _0x2f22=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf222[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2f22('0x0'));var util=require(_0x2f22('0x1'));var utils=require(_0x2f22('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2e10c4,_0x5c95c8){utils[_0x2f22('0x3')](util[_0x2f22('0x4')](_0x2f22('0x5'),_0x2e10c4[_0x2f22('0x6')],_0x2e10c4[_0x2f22('0x7')],_0x2e10c4[_0x2f22('0x8')],_0x2e10c4[_0x2f22('0x9')],_0x2e10c4[_0x2f22('0xa')],_0x2e10c4[_0x2f22('0xb')],_0x2e10c4[_0x2f22('0xc')],_0x2e10c4['lastevent']));if(_0x2e10c4[_0x2f22('0x8')]){utils['getVoiceQueueByName'](_0x2e10c4[_0x2f22('0x8')])[_0x2f22('0xd')](function(_0x517e45){if(_0x517e45){_0x2e10c4['type']=_0x517e45[_0x2f22('0xe')];_0x2e10c4[_0x2f22('0xf')]=_0x2e10c4['agentcomplete']?_0x517e45[_0x2f22('0x10')]:![];_0x2e10c4[_0x2f22('0x11')]=_0x2e10c4[_0x2f22('0xf')]?_0x517e45['acwTimeout']:0x0;}utils['request'](_0x2f22('0x12'),_0x2e10c4);});}else{utils['request'](_0x2f22('0x12'),_0x2e10c4);}if(_0x5c95c8){delete transfers[_0x2e10c4['uniqueid']];}else{delete agents[_0x2e10c4['destuniqueid']];}}exports['agentcalled']=function(_0x2e0b75){try{utils[_0x2f22('0x13')](util[_0x2f22('0x4')](_0x2f22('0x14'),_0x2e0b75[_0x2f22('0x6')]),_0x2e0b75);agents[_0x2e0b75[_0x2f22('0x15')]]=_0x2e0b75;agents[_0x2e0b75[_0x2f22('0x15')]][_0x2f22('0x16')]=utils[_0x2f22('0x17')]();agents[_0x2e0b75[_0x2f22('0x15')]][_0x2f22('0x18')]=_0x2f22('0x19');agents[_0x2e0b75[_0x2f22('0x15')]][_0x2f22('0xc')]=null;agents[_0x2e0b75[_0x2f22('0x15')]][_0x2f22('0x1a')]=null;utils[_0x2f22('0x3')](util[_0x2f22('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2e0b75[_0x2f22('0x6')],agents[_0x2e0b75[_0x2f22('0x15')]][_0x2f22('0x9')],_0x2e0b75[_0x2f22('0x15')]));}catch(_0x8cc402){utils[_0x2f22('0x1b')](util[_0x2f22('0x4')](_0x2f22('0x14'),_0x2e0b75[_0x2f22('0x6')]),_0x8cc402);}};exports['agentringnoanswer']=function(_0x50a81f){try{if(!_[_0x2f22('0x1c')](agents[_0x50a81f[_0x2f22('0x15')]])){utils[_0x2f22('0x13')](util[_0x2f22('0x4')](_0x2f22('0x1d'),_0x50a81f[_0x2f22('0x6')]),_0x50a81f);utils[_0x2f22('0x3')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x50a81f['uniqueid'],agents[_0x50a81f[_0x2f22('0x15')]][_0x2f22('0x9')],_0x50a81f[_0x2f22('0x15')]));agents[_0x50a81f[_0x2f22('0x15')]][_0x2f22('0x1e')]=!![];agents[_0x50a81f[_0x2f22('0x15')]][_0x2f22('0x1f')]=utils[_0x2f22('0x17')]();agents[_0x50a81f[_0x2f22('0x15')]][_0x2f22('0x18')]=_0x2f22('0x20');agents[_0x50a81f[_0x2f22('0x15')]]['reason']=_0x2f22('0x20');agents[_0x50a81f[_0x2f22('0x15')]][_0x2f22('0x21')]=_0x50a81f['ringtime']?parseInt(_0x50a81f[_0x2f22('0x22')])/0x3e8:0x0;agents[_0x50a81f['destuniqueid']]['talktime']=0x0;unanswered['push'](_0x50a81f['destuniqueid']);}}catch(_0x58aa3d){utils[_0x2f22('0x1b')](util['format'](_0x2f22('0x1d'),_0x50a81f[_0x2f22('0x6')]),_0x58aa3d);}};exports['queuecallerabandon']=function(_0x48266a){try{_[_0x2f22('0x23')](agents,function(_0x22e991,_0x2b8421){if(_0x22e991[_0x2f22('0x6')]==_0x48266a[_0x2f22('0x6')]&&!_[_0x2f22('0x24')](unanswered,_0x22e991[_0x2f22('0x15')])){utils[_0x2f22('0x13')](util[_0x2f22('0x4')](_0x2f22('0x25'),_0x48266a[_0x2f22('0x6')]),_0x48266a);utils[_0x2f22('0x3')](util[_0x2f22('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x48266a[_0x2f22('0x6')],_0x22e991[_0x2f22('0x9')],_0x22e991[_0x2f22('0x15')]));_0x22e991[_0x2f22('0x1e')]=!![];_0x22e991[_0x2f22('0x1f')]=utils[_0x2f22('0x17')]();_0x22e991[_0x2f22('0x18')]='abandoned';_0x22e991[_0x2f22('0x26')]='abandoned';_0x22e991[_0x2f22('0x21')]=_0x48266a[_0x2f22('0x21')];_0x22e991['talktime']=0x0;writeDB(_0x22e991);}});}catch(_0x45c682){utils[_0x2f22('0x1b')](util[_0x2f22('0x4')](_0x2f22('0x25'),_0x48266a[_0x2f22('0x6')]),_0x45c682);}};exports['agentconnect']=function(_0x98dc7c){try{if(agents[_0x98dc7c['destuniqueid']]){utils[_0x2f22('0x13')](util['format'](_0x2f22('0x27'),_0x98dc7c['uniqueid']),_0x98dc7c);utils['info'](util[_0x2f22('0x4')](_0x2f22('0x28'),_0x98dc7c[_0x2f22('0x6')],agents[_0x98dc7c['destuniqueid']][_0x2f22('0x9')],_0x98dc7c[_0x2f22('0x15')]));agents[_0x98dc7c[_0x2f22('0x15')]][_0x2f22('0x29')]=utils[_0x2f22('0x17')]();agents[_0x98dc7c[_0x2f22('0x15')]][_0x2f22('0xc')]=_0x98dc7c[_0x2f22('0xc')];agents[_0x98dc7c['destuniqueid']]['connectedlinename']=_0x98dc7c[_0x2f22('0x1a')];agents[_0x98dc7c[_0x2f22('0x15')]][_0x2f22('0x21')]=_0x98dc7c[_0x2f22('0x22')];agents[_0x98dc7c['destuniqueid']][_0x2f22('0x18')]=_0x2f22('0x2a');_['forIn'](agents,function(_0x4afe87,_0x372f9f){if(_0x4afe87[_0x2f22('0x15')]!=_0x98dc7c[_0x2f22('0x15')]&&_0x4afe87[_0x2f22('0x6')]==_0x98dc7c['uniqueid']){_0x4afe87[_0x2f22('0x2b')]=0x0;_0x4afe87[_0x2f22('0x21')]=_0x98dc7c[_0x2f22('0x22')];_0x4afe87[_0x2f22('0x1e')]=!![];_0x4afe87[_0x2f22('0x1f')]=utils[_0x2f22('0x17')]();_0x4afe87[_0x2f22('0x18')]=_0x2f22('0x2c');_0x4afe87[_0x2f22('0x26')]='answered_elsewhere';_0x4afe87['answeredelsewheredestinationuniqueid']=_0x98dc7c[_0x2f22('0x15')];_0x4afe87[_0x2f22('0x2d')]=_0x98dc7c[_0x2f22('0x9')];writeDB(_0x4afe87);}});}}catch(_0x2cc3e8){utils[_0x2f22('0x1b')](util[_0x2f22('0x4')]('[%s][agents][agentconnect]',_0x98dc7c[_0x2f22('0x6')]),_0x2cc3e8);}};exports[_0x2f22('0x2e')]=function(_0x2f5444){try{if(!_[_0x2f22('0x1c')](agents[_0x2f5444[_0x2f22('0x15')]])){utils[_0x2f22('0x13')](util[_0x2f22('0x4')](_0x2f22('0x2f'),_0x2f5444[_0x2f22('0x6')]),_0x2f5444);utils[_0x2f22('0x3')](util[_0x2f22('0x4')](_0x2f22('0x30'),_0x2f5444['uniqueid'],agents[_0x2f5444[_0x2f22('0x15')]][_0x2f22('0x9')],_0x2f5444['destuniqueid']));agents[_0x2f5444[_0x2f22('0x15')]][_0x2f22('0x2e')]=!![];agents[_0x2f5444[_0x2f22('0x15')]][_0x2f22('0x31')]=utils[_0x2f22('0x17')]();agents[_0x2f5444[_0x2f22('0x15')]]['talktime']=utils[_0x2f22('0x32')](agents[_0x2f5444[_0x2f22('0x15')]]['agentcompleteAt'],agents[_0x2f5444['destuniqueid']]['agentconnectAt']);agents[_0x2f5444['destuniqueid']]['reason']=_0x2f5444['reason'];agents[_0x2f5444[_0x2f22('0x15')]][_0x2f22('0x18')]=_0x2f22('0x33');writeDB(agents[_0x2f5444[_0x2f22('0x15')]]);}}catch(_0x4c38f7){utils[_0x2f22('0x1b')](util[_0x2f22('0x4')]('[%s][agents][agentcomplete]',_0x2f5444[_0x2f22('0x6')]),_0x4c38f7);}};exports['blindtransfer']=function(_0x3f60c3){try{if(!_[_0x2f22('0x1c')](agents[_0x3f60c3[_0x2f22('0x34')]])){utils[_0x2f22('0x13')](util['format'](_0x2f22('0x35'),_0x3f60c3[_0x2f22('0x6')]),_0x3f60c3);utils[_0x2f22('0x3')](util[_0x2f22('0x4')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x3f60c3[_0x2f22('0x6')],agents[_0x3f60c3[_0x2f22('0x34')]]['membername'],agents[_0x3f60c3[_0x2f22('0x34')]][_0x2f22('0x6')]));agents[_0x3f60c3[_0x2f22('0x34')]][_0x2f22('0x36')]=!![];agents[_0x3f60c3[_0x2f22('0x34')]][_0x2f22('0x37')]=_0x2f22('0x38');agents[_0x3f60c3['transfereruniqueid']][_0x2f22('0x39')]=_0x3f60c3[_0x2f22('0x3a')];agents[_0x3f60c3[_0x2f22('0x34')]][_0x2f22('0x3b')]=agents[_0x3f60c3[_0x2f22('0x34')]]['uniqueid'];}}catch(_0x21380d){utils[_0x2f22('0x1b')](util[_0x2f22('0x4')](_0x2f22('0x35'),_0x3f60c3['uniqueid']),_0x21380d);}};exports[_0x2f22('0x3c')]=function(_0x3a82e8){try{utils[_0x2f22('0x13')](util[_0x2f22('0x4')](_0x2f22('0x3d'),_0x3a82e8[_0x2f22('0x3e')]),_0x3a82e8);if(_0x3a82e8[_0x2f22('0x3e')]==_0x3a82e8[_0x2f22('0x3f')]){if(!_[_0x2f22('0x1c')](agents[_0x3a82e8[_0x2f22('0x40')]])){utils[_0x2f22('0x3')](util[_0x2f22('0x4')](_0x2f22('0x41'),_0x3a82e8[_0x2f22('0x3e')],agents[_0x3a82e8[_0x2f22('0x40')]][_0x2f22('0x9')]));agents[_0x3a82e8[_0x2f22('0x40')]]['transfer']=!![];agents[_0x3a82e8['secondtransfereruniqueid']][_0x2f22('0x37')]=_0x2f22('0x42');agents[_0x3a82e8[_0x2f22('0x40')]][_0x2f22('0x39')]=_0x3a82e8[_0x2f22('0x43')];agents[_0x3a82e8[_0x2f22('0x40')]][_0x2f22('0x3b')]=_0x3a82e8[_0x2f22('0x3e')];}if(_0x3a82e8['transfereeuniqueid']&&agents[_0x3a82e8[_0x2f22('0x44')]]){agents[_0x3a82e8[_0x2f22('0x44')]][_0x2f22('0x45')]=0x1;transfers[_0x3a82e8[_0x2f22('0x44')]]=_[_0x2f22('0x46')](agents[_0x3a82e8[_0x2f22('0x44')]]);transfers[_0x3a82e8[_0x2f22('0x44')]][_0x2f22('0xb')]=agents[_0x3a82e8[_0x2f22('0x40')]][_0x2f22('0xb')];transfers[_0x3a82e8['transfereeuniqueid']][_0x2f22('0x47')]=agents[_0x3a82e8['secondtransfereruniqueid']][_0x2f22('0x47')];transfers[_0x3a82e8[_0x2f22('0x44')]]['agentcalledAt']=utils['now']();transfers[_0x3a82e8[_0x2f22('0x44')]][_0x2f22('0x29')]=utils[_0x2f22('0x17')]();transfers[_0x3a82e8['transfereeuniqueid']][_0x2f22('0x21')]=0x0;transfers[_0x3a82e8['transfereeuniqueid']][_0x2f22('0x45')]=0x2;}}else if(_0x3a82e8[_0x2f22('0x40')]==_0x3a82e8[_0x2f22('0x48')]){if(!_[_0x2f22('0x1c')](agents[_0x3a82e8[_0x2f22('0x3e')]])){utils[_0x2f22('0x3')](util[_0x2f22('0x4')](_0x2f22('0x41'),_0x3a82e8['origtransfereruniqueid'],agents[_0x3a82e8[_0x2f22('0x3e')]][_0x2f22('0x9')]));agents[_0x3a82e8['origtransfereruniqueid']][_0x2f22('0x36')]=!![];agents[_0x3a82e8[_0x2f22('0x3e')]]['transfertype']='ATTENDED';agents[_0x3a82e8[_0x2f22('0x3e')]][_0x2f22('0x39')]=_0x3a82e8['secondtransfererexten'];agents[_0x3a82e8[_0x2f22('0x3e')]]['transferuniqueid']=_0x3a82e8['secondtransfereruniqueid'];}if(_0x3a82e8['transfertargetuniqueid']&&agents[_0x3a82e8[_0x2f22('0x49')]]){agents[_0x3a82e8[_0x2f22('0x49')]][_0x2f22('0x45')]=0x1;transfers[_0x3a82e8[_0x2f22('0x49')]]=_[_0x2f22('0x46')](agents[_0x3a82e8[_0x2f22('0x49')]]);transfers[_0x3a82e8[_0x2f22('0x49')]][_0x2f22('0xb')]=agents[_0x3a82e8[_0x2f22('0x3e')]][_0x2f22('0xb')];transfers[_0x3a82e8[_0x2f22('0x49')]][_0x2f22('0x47')]=agents[_0x3a82e8[_0x2f22('0x3e')]]['calleridname'];transfers[_0x3a82e8['transfertargetuniqueid']][_0x2f22('0x16')]=utils[_0x2f22('0x17')]();transfers[_0x3a82e8[_0x2f22('0x49')]][_0x2f22('0x29')]=utils[_0x2f22('0x17')]();transfers[_0x3a82e8[_0x2f22('0x49')]][_0x2f22('0x21')]=0x0;transfers[_0x3a82e8[_0x2f22('0x49')]][_0x2f22('0x45')]=0x2;}}}catch(_0x234b2b){utils[_0x2f22('0x1b')](util['format']('[%s][agents][attendedtransfer]',_0x3a82e8[_0x2f22('0x3e')]),_0x234b2b);}};exports[_0x2f22('0x4a')]=function(_0x2e1385){try{utils[_0x2f22('0x13')](util[_0x2f22('0x4')]('[%s][agents][hangup]',_0x2e1385[_0x2f22('0x6')]),_0x2e1385);if(agents[_0x2e1385[_0x2f22('0x6')]]&&agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x26')]===_0x2f22('0x20')){if(_0x2e1385[_0x2f22('0x4b')]==='21'){agents[_0x2e1385[_0x2f22('0x6')]]['reason']=_0x2f22('0x4c');agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x18')]='rejected';}utils['info'](util[_0x2f22('0x4')](_0x2f22('0x4d'),_0x2e1385[_0x2f22('0x6')],agents[_0x2e1385[_0x2f22('0x6')]]['membername'],agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x26')],agents[_0x2e1385['uniqueid']][_0x2f22('0x18')]));writeDB(agents[_0x2e1385['uniqueid']]);var _0x377eed=unanswered[_0x2f22('0x4e')](_0x2e1385['uniqueid']);if(_0x377eed>-0x1){unanswered[_0x2f22('0x4f')](_0x377eed,0x1);}}if(transfers[_0x2e1385[_0x2f22('0x6')]]){transfers[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x2e')]=!![];transfers[_0x2e1385['uniqueid']][_0x2f22('0x31')]=utils['now']();transfers[_0x2e1385[_0x2f22('0x6')]]['talktime']=utils[_0x2f22('0x32')](transfers[_0x2e1385[_0x2f22('0x6')]]['agentcompleteAt'],transfers[_0x2e1385['uniqueid']]['agentconnectAt']);transfers[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x26')]=_0x2f22('0x50');transfers[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x18')]=_0x2f22('0x33');utils[_0x2f22('0x3')](util[_0x2f22('0x4')](_0x2f22('0x4d'),_0x2e1385[_0x2f22('0x6')],transfers[_0x2e1385['uniqueid']][_0x2f22('0x9')],transfers[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x26')],transfers[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x18')]));writeDB(transfers[_0x2e1385[_0x2f22('0x6')]],!![]);}if(agents[_0x2e1385[_0x2f22('0x6')]]&&agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x29')]){agents[_0x2e1385['uniqueid']]['agentcomplete']=!![];agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x31')]=utils[_0x2f22('0x17')]();agents[_0x2e1385['uniqueid']][_0x2f22('0x2b')]=utils['diffTime'](agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x31')],agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x29')]);agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x26')]=agents[_0x2e1385['uniqueid']][_0x2f22('0x36')]?'transfer':_0x2f22('0x50');agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x18')]=_0x2f22('0x33');utils[_0x2f22('0x3')](util['format'](_0x2f22('0x4d'),_0x2e1385['uniqueid'],agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x9')],agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x26')],agents[_0x2e1385[_0x2f22('0x6')]][_0x2f22('0x18')]));writeDB(agents[_0x2e1385['uniqueid']]);}}catch(_0x3172c4){utils['error'](util[_0x2f22('0x4')](_0x2f22('0x51'),_0x2e1385[_0x2f22('0x6')]),_0x3172c4);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4fc8fbc..9699502 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 _0x5129=['ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','includes','noop','gotoif','lastdata','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','queue','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','systemanswertime','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','duration','diffTime','billableseconds','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-phone','value','destination','\x22\x20<','xmd-callerid-preview','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','xmd-contactid'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5129,0x1b2));var _0x9512=function(_0x35ad2a,_0x3dcca){_0x35ad2a=_0x35ad2a-0x0;var _0x4b618a=_0x5129[_0x35ad2a];return _0x4b618a;};'use strict';var _=require(_0x9512('0x0'));var util=require(_0x9512('0x1'));var utils=require('./utils');var dispositions=[_0x9512('0x2'),_0x9512('0x3'),_0x9512('0x3'),'NO\x20ANSWER',_0x9512('0x2'),'NO\x20ANSWER',_0x9512('0x4'),_0x9512('0x5'),'FAILED',_0x9512('0x3'),_0x9512('0x3')];var channels={};function writeDB(_0x5cafc5){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x8'),_0x5cafc5[_0x9512('0x9')],_0x5cafc5[_0x9512('0xa')],_0x5cafc5[_0x9512('0xb')],_0x5cafc5[_0x9512('0xc')],_0x5cafc5[_0x9512('0xd')],_0x5cafc5[_0x9512('0xe')],_0x5cafc5[_0x9512('0xf')],_0x5cafc5['lastevent']));if(_0x5cafc5[_0x9512('0x10')]){utils['getUserByInternal'](_0x5cafc5[_0x9512('0x10')])[_0x9512('0x11')](function(_0x402a2e){if(_0x402a2e){_0x5cafc5[_0x9512('0x12')]=_0x402a2e['id'];}utils[_0x9512('0x13')](_0x9512('0x14'),_0x5cafc5);});}else{utils[_0x9512('0x13')](_0x9512('0x14'),_0x5cafc5);}if(channels[_0x5cafc5['uniqueid']]){delete channels[_0x5cafc5['uniqueid']];}}exports[_0x9512('0x15')]=function(_0x4e8db9){try{utils['debug'](util[_0x9512('0x7')](_0x9512('0x16'),_0x4e8db9['uniqueid']),_0x4e8db9);if(_0x4e8db9[_0x9512('0x9')]==_0x4e8db9[_0x9512('0x17')]&&_0x4e8db9[_0x9512('0xa')]!=_0x9512('0x18')){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x19'),_0x4e8db9[_0x9512('0x9')],_0x4e8db9[_0x9512('0x1a')],_0x4e8db9[_0x9512('0x1b')]));channels[_0x4e8db9[_0x9512('0x9')]]={'uniqueid':_0x4e8db9[_0x9512('0x9')],'accountcode':_0x4e8db9[_0x9512('0x10')],'source':_0x4e8db9[_0x9512('0xe')],'destination':_0x4e8db9['exten'],'destinationcontext':_0x4e8db9[_0x9512('0x1a')],'channel':_0x4e8db9[_0x9512('0xa')],'starttime':utils[_0x9512('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9512('0x2'),'amaflags':_0x9512('0x1d')};}}catch(_0x22f18a){utils[_0x9512('0x1e')](util[_0x9512('0x7')]('[%s][calls][newchannel]',_0x4e8db9[_0x9512('0x9')]),_0x22f18a);}};exports[_0x9512('0x1f')]=function(_0x3510fe){try{utils[_0x9512('0x20')](util['format'](_0x9512('0x21'),_0x3510fe[_0x9512('0x9')]),_0x3510fe);if(!_[_0x9512('0x22')](channels[_0x3510fe[_0x9512('0x9')]])&&_0x3510fe['channelstate']==0x6){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3510fe[_0x9512('0x9')],_0x3510fe[_0x9512('0x1a')],_0x3510fe[_0x9512('0xa')]));if(_['isNil'](channels[_0x3510fe[_0x9512('0x9')]][_0x9512('0x23')])){channels[_0x3510fe[_0x9512('0x9')]][_0x9512('0x23')]=utils[_0x9512('0x1c')]();}}else if(!_['isNil'](channels[_0x3510fe[_0x9512('0x17')]])&&_0x3510fe[_0x9512('0x24')]==0x6&&_0x3510fe['context']!='transfer'){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x25'),_0x3510fe[_0x9512('0x9')],_0x3510fe[_0x9512('0x17')],_0x3510fe[_0x9512('0x1a')],_0x3510fe[_0x9512('0xa')]));channels[_0x3510fe['linkedid']][_0x9512('0x10')]=_0x3510fe[_0x9512('0x10')];channels[_0x3510fe[_0x9512('0x17')]][_0x9512('0x26')]=_0x3510fe[_0x9512('0xa')];if(_['isNil'](channels[_0x3510fe[_0x9512('0x17')]]['answertime'])){channels[_0x3510fe['linkedid']][_0x9512('0x27')]=utils[_0x9512('0x1c')]();}channels[_0x3510fe['linkedid']]['disposition']=dispositions[_[_0x9512('0x28')](_0x3510fe[_0x9512('0x24')])]||_0x9512('0x4');}}catch(_0x368279){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x21'),_0x3510fe[_0x9512('0x9')]),_0x368279);}};exports[_0x9512('0x29')]=function(_0x1e9716){try{if(!_[_0x9512('0x22')](channels[_0x1e9716['uniqueid']])){utils['debug'](util[_0x9512('0x7')](_0x9512('0x2a'),_0x1e9716[_0x9512('0x9')]),_0x1e9716);if(_[_0x9512('0x22')](channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x2b')])){channels[_0x1e9716[_0x9512('0x9')]]['callerid']=_0x1e9716[_0x9512('0x2c')]+'\x20<'+_0x1e9716[_0x9512('0xe')]+'>';}utils[_0x9512('0x6')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1e9716[_0x9512('0x9')],channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x2b')],_0x1e9716[_0x9512('0x2d')]));channels[_0x1e9716[_0x9512('0x9')]]['endtime']=utils['now']();channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x2e')]=utils[_0x9512('0x2f')](channels[_0x1e9716[_0x9512('0x9')]]['endtime'],channels[_0x1e9716['uniqueid']]['starttime']);channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x30')]=channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x27')]?utils[_0x9512('0x2f')](channels[_0x1e9716[_0x9512('0x9')]]['endtime'],channels[_0x1e9716['uniqueid']][_0x9512('0x27')]):0x0;writeDB(channels[_0x1e9716[_0x9512('0x9')]]);}}catch(_0x53efa0){utils[_0x9512('0x1e')](util['format'](_0x9512('0x2a'),_0x1e9716[_0x9512('0x9')]),_0x53efa0);}};exports['attendedtransfer']=function(_0x2bb1bf){try{if(!_[_0x9512('0x22')](channels[_0x2bb1bf['localtwolinkedid']])){utils['debug'](util[_0x9512('0x7')](_0x9512('0x31'),_0x2bb1bf['origtransfereruniqueid']),_0x2bb1bf);if(channels[_0x2bb1bf[_0x9512('0x32')]]['channel']==_0x2bb1bf[_0x9512('0x33')]){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x34'),_0x2bb1bf[_0x9512('0x35')],_0x2bb1bf[_0x9512('0x32')],_0x2bb1bf['secondtransfererchannel']));channels[_0x2bb1bf[_0x9512('0x32')]]['destinationchannel']=_0x2bb1bf[_0x9512('0x36')];channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0x37')]=_0x9512('0x38');}else if(channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0xa')]=_0x2bb1bf[_0x9512('0x39')]){utils[_0x9512('0x6')](util['format'](_0x9512('0x34'),_0x2bb1bf[_0x9512('0x35')],_0x2bb1bf['localtwolinkedid'],_0x2bb1bf[_0x9512('0x3a')]));channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0x26')]=_0x2bb1bf[_0x9512('0x3a')];channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0x37')]=_0x9512('0x38');}}}catch(_0x3cc5ca){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x31'),_0x2bb1bf['origtransfereruniqueid']),_0x3cc5ca);}};exports['musiconholdstart']=function(_0x30307d){try{if(!_['isNil'](channels[_0x30307d[_0x9512('0x9')]])){utils[_0x9512('0x20')](util[_0x9512('0x7')](_0x9512('0x3b'),_0x30307d[_0x9512('0x9')]),_0x30307d);channels[_0x30307d[_0x9512('0x9')]][_0x9512('0x3c')]=utils[_0x9512('0x1c')]();utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x3d'),_0x30307d[_0x9512('0x9')],channels[_0x30307d[_0x9512('0x9')]]['musiconholdstartAt']));}}catch(_0x53780f){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x3b'),_0x30307d['uniqueid']),_0x53780f);}};exports[_0x9512('0x3e')]=function(_0x1dd602){try{if(!_['isNil'](channels[_0x1dd602['uniqueid']])){utils[_0x9512('0x20')](util[_0x9512('0x7')]('[%s][calls][musiconholdstop]',_0x1dd602[_0x9512('0x9')]),_0x1dd602);if(!_['isNil'](channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3c')])){channels[_0x1dd602[_0x9512('0x9')]]['mohtime']+=utils[_0x9512('0x2f')](utils[_0x9512('0x1c')](),channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3c')]);utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1dd602[_0x9512('0x9')],channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3f')]));delete channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3c')];}}}catch(_0x40376f){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x40'),_0x1dd602[_0x9512('0x9')]),_0x40376f);}};exports[_0x9512('0x41')]=function(_0xcaf2cc){try{if(!_['isNil'](channels[_0xcaf2cc[_0x9512('0x9')]])){utils[_0x9512('0x20')](util[_0x9512('0x7')]('[%s][calls][varset]',_0xcaf2cc[_0x9512('0x9')]),_0xcaf2cc);if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x42')])){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x43'),_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc['value']));channels[_0xcaf2cc['uniqueid']]['source']=_0xcaf2cc['value'];}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x44')])){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc['uniqueid']][_0x9512('0x46')]=_0xcaf2cc['value'];channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x2b')]='\x22'+_0xcaf2cc[_0x9512('0x45')]+_0x9512('0x47')+_0xcaf2cc[_0x9512('0x45')]+'>';}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x48')])||!_['isNil'](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x4a')])){utils[_0x9512('0x6')](util['format'](_0x9512('0x4b'),_0xcaf2cc[_0x9512('0x9')],!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x48')])?'xmd-callerid-preview':'xmd-callerid',_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x2b')]=_0xcaf2cc[_0x9512('0x45')];}if(!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')]['xmd-queue'])||!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x4c')])){utils[_0x9512('0x6')](util['format'](_0x9512('0x4b'),_0xcaf2cc[_0x9512('0x9')],!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x4d')])?_0x9512('0x4d'):_0x9512('0x4c'),_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x4e')]=_0x9512('0x4f');channels[_0xcaf2cc['uniqueid']]['lastdata']=_0xcaf2cc[_0x9512('0x45')];channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0xb')]=!![];}if(!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x50')])){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xcaf2cc['uniqueid'],_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x51')]=_0xcaf2cc['value'];}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x52')])){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x53'),_0xcaf2cc['uniqueid'],_0xcaf2cc['value']));channels[_0xcaf2cc['uniqueid']]['type']=_0xcaf2cc['value'];}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x54')])){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x55')]=_0xcaf2cc[_0x9512('0x45')];}if(!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x56')])){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x57'),_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc['value']));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x56')]=_0xcaf2cc[_0x9512('0x45')];}}}catch(_0x55686c){utils[_0x9512('0x1e')](util[_0x9512('0x7')]('[%s][calls][varset]',_0xcaf2cc[_0x9512('0x9')]),_0x55686c);}};exports[_0x9512('0x58')]=function(_0x1f00a4){try{if(!_['isNil'](channels[_0x1f00a4[_0x9512('0x9')]])){utils['debug'](util[_0x9512('0x7')](_0x9512('0x59'),_0x1f00a4['uniqueid']),_0x1f00a4);utils['info'](util[_0x9512('0x7')](_0x9512('0x5a'),_0x1f00a4[_0x9512('0x9')],_0x1f00a4[_0x9512('0x5b')],_0x1f00a4['appdata']));if(_0x1f00a4[_0x9512('0x5b')][_0x9512('0x5c')]()==_0x9512('0x5d')&&_[_0x9512('0x5e')](_0x1f00a4[_0x9512('0x5f')][_0x9512('0x5c')](),_0x9512('0x60'))){var _0x4a7a2c=_0x1f00a4[_0x9512('0x5f')]['split']('=');var _0x221ef4=_0x4a7a2c[0x0][_0x9512('0x61')](_0x4a7a2c[0x0][_0x9512('0x62')]('(')+0x1,_0x4a7a2c[0x0][_0x9512('0x62')](')'));var _0x401556=_0x4a7a2c[0x1];channels[_0x1f00a4[_0x9512('0x9')]][_0x221ef4]=_0x401556;}if(!_[_0x9512('0x63')]([_0x9512('0x29'),_0x9512('0x64'),'execif',_0x9512('0x5d'),_0x9512('0x65')],_0x1f00a4['application']['toLowerCase']())){channels[_0x1f00a4[_0x9512('0x9')]]['lastapplication']=_0x1f00a4[_0x9512('0x5b')];channels[_0x1f00a4[_0x9512('0x9')]][_0x9512('0x66')]=_0x1f00a4[_0x9512('0x5f')];}}}catch(_0x18bfa8){utils['error'](util[_0x9512('0x7')](_0x9512('0x59'),_0x1f00a4[_0x9512('0x9')]),_0x18bfa8);}}; \ No newline at end of file +var _0xbeea=['newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','set','gotoif','[%s][calls][newexten]','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','info','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','destinationchannel','answertime','disposition','toNumber','hangup','debug','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','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','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xbeea,0x1b6));var _0xabee=function(_0xbe41ba,_0x384563){_0xbe41ba=_0xbe41ba-0x0;var _0x2c2085=_0xbeea[_0xbe41ba];return _0x2c2085;};'use strict';var _=require('lodash');var util=require(_0xabee('0x0'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0xabee('0x1'),_0xabee('0x1'),_0xabee('0x2'),'NO\x20ANSWER',_0xabee('0x2'),_0xabee('0x3'),_0xabee('0x4'),_0xabee('0x1'),'FAILED','FAILED'];var channels={};function writeDB(_0xfbc472){utils['info'](util[_0xabee('0x5')](_0xabee('0x6'),_0xfbc472[_0xabee('0x7')],_0xfbc472['channel'],_0xfbc472['queue'],_0xfbc472['membername'],_0xfbc472['interface'],_0xfbc472[_0xabee('0x8')],_0xfbc472[_0xabee('0x9')],_0xfbc472[_0xabee('0xa')]));if(_0xfbc472[_0xabee('0xb')]){utils[_0xabee('0xc')](_0xfbc472['accountcode'])[_0xabee('0xd')](function(_0x309e10){if(_0x309e10){_0xfbc472[_0xabee('0xe')]=_0x309e10['id'];}utils[_0xabee('0xf')](_0xabee('0x10'),_0xfbc472);});}else{utils['request'](_0xabee('0x10'),_0xfbc472);}if(channels[_0xfbc472['uniqueid']]){delete channels[_0xfbc472[_0xabee('0x7')]];}}exports['newchannel']=function(_0x27df39){try{utils['debug'](util[_0xabee('0x5')](_0xabee('0x11'),_0x27df39[_0xabee('0x7')]),_0x27df39);if(_0x27df39[_0xabee('0x7')]==_0x27df39[_0xabee('0x12')]&&_0x27df39[_0xabee('0x13')]!=_0xabee('0x14')){utils[_0xabee('0x15')](util[_0xabee('0x5')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x27df39[_0xabee('0x7')],_0x27df39[_0xabee('0x16')],_0x27df39[_0xabee('0x17')]));channels[_0x27df39['uniqueid']]={'uniqueid':_0x27df39[_0xabee('0x7')],'accountcode':_0x27df39[_0xabee('0xb')],'source':_0x27df39[_0xabee('0x8')],'destination':_0x27df39[_0xabee('0x17')],'destinationcontext':_0x27df39[_0xabee('0x16')],'channel':_0x27df39['channel'],'starttime':utils[_0xabee('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xabee('0x2'),'amaflags':_0xabee('0x19')};}}catch(_0x877d05){utils[_0xabee('0x1a')](util['format'](_0xabee('0x11'),_0x27df39[_0xabee('0x7')]),_0x877d05);}};exports['newstate']=function(_0x4c88a2){try{utils['debug'](util['format'](_0xabee('0x1b'),_0x4c88a2[_0xabee('0x7')]),_0x4c88a2);if(!_[_0xabee('0x1c')](channels[_0x4c88a2[_0xabee('0x7')]])&&_0x4c88a2['channelstate']==0x6){utils['info'](util[_0xabee('0x5')](_0xabee('0x1d'),_0x4c88a2[_0xabee('0x7')],_0x4c88a2['context'],_0x4c88a2[_0xabee('0x13')]));if(_['isNil'](channels[_0x4c88a2['uniqueid']][_0xabee('0x1e')])){channels[_0x4c88a2[_0xabee('0x7')]]['systemanswertime']=utils[_0xabee('0x18')]();}}else if(!_['isNil'](channels[_0x4c88a2[_0xabee('0x12')]])&&_0x4c88a2[_0xabee('0x1f')]==0x6&&_0x4c88a2[_0xabee('0x16')]!=_0xabee('0x20')){utils[_0xabee('0x15')](util[_0xabee('0x5')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4c88a2[_0xabee('0x7')],_0x4c88a2[_0xabee('0x12')],_0x4c88a2['context'],_0x4c88a2['channel']));channels[_0x4c88a2[_0xabee('0x12')]][_0xabee('0xb')]=_0x4c88a2['accountcode'];channels[_0x4c88a2[_0xabee('0x12')]][_0xabee('0x21')]=_0x4c88a2[_0xabee('0x13')];if(_['isNil'](channels[_0x4c88a2[_0xabee('0x12')]][_0xabee('0x22')])){channels[_0x4c88a2['linkedid']][_0xabee('0x22')]=utils[_0xabee('0x18')]();}channels[_0x4c88a2[_0xabee('0x12')]][_0xabee('0x23')]=dispositions[_[_0xabee('0x24')](_0x4c88a2[_0xabee('0x1f')])]||'ANSWERED';}}catch(_0x50cd4f){utils[_0xabee('0x1a')](util['format'](_0xabee('0x1b'),_0x4c88a2[_0xabee('0x7')]),_0x50cd4f);}};exports[_0xabee('0x25')]=function(_0x515d97){try{if(!_[_0xabee('0x1c')](channels[_0x515d97[_0xabee('0x7')]])){utils[_0xabee('0x26')](util[_0xabee('0x5')]('[%s][calls][hangup]',_0x515d97[_0xabee('0x7')]),_0x515d97);if(_['isNil'](channels[_0x515d97[_0xabee('0x7')]][_0xabee('0x27')])){channels[_0x515d97[_0xabee('0x7')]]['callerid']=_0x515d97[_0xabee('0x28')]+'\x20<'+_0x515d97[_0xabee('0x8')]+'>';}utils[_0xabee('0x15')](util[_0xabee('0x5')](_0xabee('0x29'),_0x515d97[_0xabee('0x7')],channels[_0x515d97['uniqueid']][_0xabee('0x27')],_0x515d97[_0xabee('0x2a')]));channels[_0x515d97[_0xabee('0x7')]][_0xabee('0x2b')]=utils[_0xabee('0x18')]();channels[_0x515d97[_0xabee('0x7')]][_0xabee('0x2c')]=utils['diffTime'](channels[_0x515d97[_0xabee('0x7')]]['endtime'],channels[_0x515d97[_0xabee('0x7')]][_0xabee('0x2d')]);channels[_0x515d97[_0xabee('0x7')]]['billableseconds']=channels[_0x515d97[_0xabee('0x7')]][_0xabee('0x22')]?utils[_0xabee('0x2e')](channels[_0x515d97[_0xabee('0x7')]][_0xabee('0x2b')],channels[_0x515d97['uniqueid']][_0xabee('0x22')]):0x0;writeDB(channels[_0x515d97[_0xabee('0x7')]]);}}catch(_0x28b3cb){utils[_0xabee('0x1a')](util['format'](_0xabee('0x2f'),_0x515d97[_0xabee('0x7')]),_0x28b3cb);}};exports[_0xabee('0x30')]=function(_0x226751){try{if(!_[_0xabee('0x1c')](channels[_0x226751[_0xabee('0x31')]])){utils[_0xabee('0x26')](util[_0xabee('0x5')](_0xabee('0x32'),_0x226751[_0xabee('0x33')]),_0x226751);if(channels[_0x226751[_0xabee('0x31')]]['channel']==_0x226751[_0xabee('0x34')]){utils[_0xabee('0x15')](util[_0xabee('0x5')](_0xabee('0x35'),_0x226751[_0xabee('0x33')],_0x226751[_0xabee('0x31')],_0x226751[_0xabee('0x36')]));channels[_0x226751[_0xabee('0x31')]]['destinationchannel']=_0x226751[_0xabee('0x36')];channels[_0x226751['localtwolinkedid']][_0xabee('0x37')]=_0xabee('0x38');}else if(channels[_0x226751[_0xabee('0x31')]][_0xabee('0x13')]=_0x226751[_0xabee('0x39')]){utils[_0xabee('0x15')](util[_0xabee('0x5')](_0xabee('0x35'),_0x226751['origtransfereruniqueid'],_0x226751['localtwolinkedid'],_0x226751['origtransfererchannel']));channels[_0x226751['localtwolinkedid']]['destinationchannel']=_0x226751[_0xabee('0x3a')];channels[_0x226751[_0xabee('0x31')]]['userfield']=_0xabee('0x38');}}}catch(_0x2a611c){utils['error'](util[_0xabee('0x5')](_0xabee('0x32'),_0x226751['origtransfereruniqueid']),_0x2a611c);}};exports['musiconholdstart']=function(_0x20372f){try{if(!_[_0xabee('0x1c')](channels[_0x20372f[_0xabee('0x7')]])){utils[_0xabee('0x26')](util[_0xabee('0x5')]('[%s][calls][musiconholdstart]',_0x20372f[_0xabee('0x7')]),_0x20372f);channels[_0x20372f['uniqueid']][_0xabee('0x3b')]=utils[_0xabee('0x18')]();utils[_0xabee('0x15')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x20372f[_0xabee('0x7')],channels[_0x20372f[_0xabee('0x7')]][_0xabee('0x3b')]));}}catch(_0x33b934){utils['error'](util['format']('[%s][calls][musiconholdstart]',_0x20372f[_0xabee('0x7')]),_0x33b934);}};exports[_0xabee('0x3c')]=function(_0x92f89b){try{if(!_[_0xabee('0x1c')](channels[_0x92f89b[_0xabee('0x7')]])){utils[_0xabee('0x26')](util[_0xabee('0x5')](_0xabee('0x3d'),_0x92f89b[_0xabee('0x7')]),_0x92f89b);if(!_[_0xabee('0x1c')](channels[_0x92f89b[_0xabee('0x7')]][_0xabee('0x3b')])){channels[_0x92f89b[_0xabee('0x7')]][_0xabee('0x3e')]+=utils['diffTime'](utils[_0xabee('0x18')](),channels[_0x92f89b[_0xabee('0x7')]]['musiconholdstartAt']);utils['info'](util[_0xabee('0x5')](_0xabee('0x3f'),_0x92f89b['uniqueid'],channels[_0x92f89b[_0xabee('0x7')]]['mohtime']));delete channels[_0x92f89b[_0xabee('0x7')]]['musiconholdstartAt'];}}}catch(_0x25dd20){utils[_0xabee('0x1a')](util[_0xabee('0x5')]('[%s][calls][musiconholdstop]',_0x92f89b[_0xabee('0x7')]),_0x25dd20);}};exports[_0xabee('0x40')]=function(_0x52ce9c){try{if(!_[_0xabee('0x1c')](channels[_0x52ce9c[_0xabee('0x7')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x52ce9c[_0xabee('0x7')]),_0x52ce9c);if(!_['isNil'](_0x52ce9c['variable'][_0xabee('0x41')])){utils[_0xabee('0x15')](util[_0xabee('0x5')](_0xabee('0x42'),_0x52ce9c[_0xabee('0x7')],_0x52ce9c[_0xabee('0x43')]));channels[_0x52ce9c[_0xabee('0x7')]][_0xabee('0x44')]=_0x52ce9c[_0xabee('0x43')];}if(!_['isNil'](_0x52ce9c[_0xabee('0x45')][_0xabee('0x46')])){utils[_0xabee('0x15')](util['format'](_0xabee('0x47'),_0x52ce9c['uniqueid'],_0x52ce9c['value']));channels[_0x52ce9c['uniqueid']][_0xabee('0x48')]=_0x52ce9c['value'];channels[_0x52ce9c[_0xabee('0x7')]][_0xabee('0x27')]='\x22'+_0x52ce9c[_0xabee('0x43')]+_0xabee('0x49')+_0x52ce9c['value']+'>';}if(!_[_0xabee('0x1c')](_0x52ce9c[_0xabee('0x45')][_0xabee('0x4a')])||!_['isNil'](_0x52ce9c[_0xabee('0x45')][_0xabee('0x4b')])){utils['info'](util[_0xabee('0x5')](_0xabee('0x4c'),_0x52ce9c[_0xabee('0x7')],!_['isNil'](_0x52ce9c[_0xabee('0x45')]['xmd-callerid-preview'])?_0xabee('0x4a'):_0xabee('0x4b'),_0x52ce9c[_0xabee('0x43')]));channels[_0x52ce9c[_0xabee('0x7')]]['callerid']=_0x52ce9c[_0xabee('0x43')];}if(!_[_0xabee('0x1c')](_0x52ce9c[_0xabee('0x45')][_0xabee('0x4d')])||!_['isNil'](_0x52ce9c['variable']['xmcs-queue'])){utils[_0xabee('0x15')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x52ce9c['uniqueid'],!_[_0xabee('0x1c')](_0x52ce9c['variable']['xmd-queue'])?_0xabee('0x4d'):_0xabee('0x4e'),_0x52ce9c['value']));channels[_0x52ce9c[_0xabee('0x7')]][_0xabee('0x4f')]=_0xabee('0x50');channels[_0x52ce9c[_0xabee('0x7')]][_0xabee('0x51')]=_0x52ce9c[_0xabee('0x43')];channels[_0x52ce9c[_0xabee('0x7')]][_0xabee('0x52')]=!![];}if(!_[_0xabee('0x1c')](_0x52ce9c[_0xabee('0x45')][_0xabee('0x53')])){utils[_0xabee('0x15')](util[_0xabee('0x5')](_0xabee('0x54'),_0x52ce9c[_0xabee('0x7')],_0x52ce9c[_0xabee('0x43')]));channels[_0x52ce9c[_0xabee('0x7')]][_0xabee('0x55')]=_0x52ce9c['value'];}if(!_[_0xabee('0x1c')](_0x52ce9c[_0xabee('0x45')]['xmd-cdrtype'])){utils[_0xabee('0x15')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x52ce9c[_0xabee('0x7')],_0x52ce9c[_0xabee('0x43')]));channels[_0x52ce9c[_0xabee('0x7')]]['type']=_0x52ce9c[_0xabee('0x43')];}if(!_[_0xabee('0x1c')](_0x52ce9c[_0xabee('0x45')][_0xabee('0x56')])){utils['info'](util[_0xabee('0x5')](_0xabee('0x57'),_0x52ce9c[_0xabee('0x7')],_0x52ce9c[_0xabee('0x43')]));channels[_0x52ce9c['uniqueid']][_0xabee('0x58')]=_0x52ce9c['value'];}if(!_[_0xabee('0x1c')](_0x52ce9c['variable'][_0xabee('0x59')])){utils[_0xabee('0x15')](util[_0xabee('0x5')](_0xabee('0x5a'),_0x52ce9c[_0xabee('0x7')],_0x52ce9c[_0xabee('0x43')]));channels[_0x52ce9c[_0xabee('0x7')]][_0xabee('0x59')]=_0x52ce9c[_0xabee('0x43')];}}}catch(_0x1087da){utils[_0xabee('0x1a')](util['format'](_0xabee('0x5b'),_0x52ce9c[_0xabee('0x7')]),_0x1087da);}};exports[_0xabee('0x5c')]=function(_0x75996){try{if(!_[_0xabee('0x1c')](channels[_0x75996[_0xabee('0x7')]])){utils[_0xabee('0x26')](util['format']('[%s][calls][newexten]',_0x75996[_0xabee('0x7')]),_0x75996);utils[_0xabee('0x15')](util[_0xabee('0x5')](_0xabee('0x5d'),_0x75996[_0xabee('0x7')],_0x75996[_0xabee('0x5e')],_0x75996[_0xabee('0x5f')]));if(_0x75996[_0xabee('0x5e')][_0xabee('0x60')]()=='set'&&_['startsWith'](_0x75996[_0xabee('0x5f')][_0xabee('0x60')](),_0xabee('0x61'))){var _0x4195c5=_0x75996['appdata'][_0xabee('0x62')]('=');var _0x227327=_0x4195c5[0x0][_0xabee('0x63')](_0x4195c5[0x0][_0xabee('0x64')]('(')+0x1,_0x4195c5[0x0][_0xabee('0x64')](')'));var _0x5d48f0=_0x4195c5[0x1];channels[_0x75996[_0xabee('0x7')]][_0x227327]=_0x5d48f0;}if(!_[_0xabee('0x65')]([_0xabee('0x25'),_0xabee('0x66'),'execif',_0xabee('0x67'),_0xabee('0x68')],_0x75996['application'][_0xabee('0x60')]())){channels[_0x75996['uniqueid']]['lastapplication']=_0x75996['application'];channels[_0x75996[_0xabee('0x7')]]['lastdata']=_0x75996[_0xabee('0x5f')];}}}catch(_0x542b26){utils[_0xabee('0x1a')](util[_0xabee('0x5')](_0xabee('0x69'),_0x75996[_0xabee('0x7')]),_0x542b26);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d5fff9b..9f95319 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 _0xb4c7=['[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','[core]\x20connected','shutdown','info'];(function(_0x5df0af,_0x5ecc92){var _0x1ce467=function(_0x32cf3c){while(--_0x32cf3c){_0x5df0af['push'](_0x5df0af['shift']());}};_0x1ce467(++_0x5ecc92);}(_0xb4c7,0x7e));var _0x7b4c=function(_0x5f4483,_0x346fbb){_0x5f4483=_0x5f4483-0x0;var _0x315e80=_0xb4c7[_0x5f4483];return _0x315e80;};'use strict';var utils=require(_0x7b4c('0x0'));exports['connect']=function(){utils['info'](_0x7b4c('0x1'));};exports[_0x7b4c('0x2')]=function(){utils[_0x7b4c('0x3')](_0x7b4c('0x4'));};exports[_0x7b4c('0x5')]=function(){utils[_0x7b4c('0x3')]('[core]\x20fullybooted');};exports[_0x7b4c('0x6')]=function(_0xa31892){utils[_0x7b4c('0x6')](_0x7b4c('0x7'),_0xa31892);};exports[_0x7b4c('0x8')]=function(){utils['info'](_0x7b4c('0x9'));};exports['managerevent']=function(_0x234345){}; \ No newline at end of file +var _0x9515=['./utils','connect','info','[core]\x20connected','shutdown','error','[core]\x20close'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9515,0x181));var _0x5951=function(_0x765c9b,_0x24fe19){_0x765c9b=_0x765c9b-0x0;var _0xb73e35=_0x9515[_0x765c9b];return _0xb73e35;};'use strict';var utils=require(_0x5951('0x0'));exports[_0x5951('0x1')]=function(){utils[_0x5951('0x2')](_0x5951('0x3'));};exports[_0x5951('0x4')]=function(){utils[_0x5951('0x2')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x5951('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x4f0b0b){utils[_0x5951('0x5')]('[core]\x20error',_0x4f0b0b);};exports['close']=function(){utils[_0x5951('0x2')](_0x5951('0x6'));};exports['managerevent']=function(_0x2e158d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f8e039c..5524467 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 _0x30ae=['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','endtime','billableseconds','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','format','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','error','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','assign'];(function(_0x2fb2d6,_0x1b28c1){var _0x1600df=function(_0xdfae86){while(--_0xdfae86){_0x2fb2d6['push'](_0x2fb2d6['shift']());}};_0x1600df(++_0x1b28c1);}(_0x30ae,0x1b4));var _0xe30a=function(_0x4c8ed4,_0x109424){_0x4c8ed4=_0x4c8ed4-0x0;var _0x1ed21d=_0x30ae[_0x4c8ed4];return _0x1ed21d;};'use strict';var _=require(_0xe30a('0x0'));var util=require('util');var utils=require(_0xe30a('0x1'));var dials={};function writeDB(_0x23ee19){utils[_0xe30a('0x2')](util['format'](_0xe30a('0x3'),_0x23ee19[_0xe30a('0x4')],_0x23ee19[_0xe30a('0x5')],_0x23ee19[_0xe30a('0x6')],_0x23ee19[_0xe30a('0x7')],_0x23ee19[_0xe30a('0x8')],_0x23ee19[_0xe30a('0x9')]));utils[_0xe30a('0xa')](_0xe30a('0xb'),_0x23ee19);delete dials[_0x23ee19[_0xe30a('0x4')]];}exports[_0xe30a('0xc')]=function(_0x5563cf){try{utils[_0xe30a('0xd')](util['format'](_0xe30a('0xe'),_0x5563cf[_0xe30a('0x4')]),_0x5563cf);utils['info'](util['format'](_0xe30a('0xf'),_0x5563cf[_0xe30a('0x4')],_0x5563cf[_0xe30a('0x10')],_0x5563cf[_0xe30a('0x11')]));if(_0x5563cf[_0xe30a('0x10')][_0xe30a('0x12')]()==_0xe30a('0x13')&&_['startsWith'](_0x5563cf[_0xe30a('0x11')][_0xe30a('0x12')](),'cdr(routeid)')){var _0x2e7c04=_0x5563cf[_0xe30a('0x11')][_0xe30a('0x14')]('=');dials[_0x5563cf[_0xe30a('0x4')]]={'routeId':_0x2e7c04[0x1]};}}catch(_0x28a716){utils['error'](util[_0xe30a('0x15')]('[%s][dials][newexten]',_0x5563cf[_0xe30a('0x4')]),_0x28a716);}};exports[_0xe30a('0x16')]=function(_0x4e0ea2){try{utils[_0xe30a('0xd')](util['format'](_0xe30a('0x17'),_0x4e0ea2[_0xe30a('0x4')]),_0x4e0ea2);if(!_[_0xe30a('0x18')](_0x4e0ea2[_0xe30a('0x19')][_0xe30a('0x1a')])){utils[_0xe30a('0x2')](util['format'](_0xe30a('0x1b'),_0x4e0ea2[_0xe30a('0x4')],_0x4e0ea2[_0xe30a('0x1c')]));dials[_0x4e0ea2['uniqueid']]={'routeId':_0x4e0ea2[_0xe30a('0x1c')]};}}catch(_0x3a4d5a){utils['error'](util['format']('[%s][dials][varset]',_0x4e0ea2[_0xe30a('0x4')]),_0x3a4d5a);}};exports[_0xe30a('0x1d')]=function(_0x45db68){try{if(!_[_0xe30a('0x18')](dials[_0x45db68[_0xe30a('0x4')]])){utils[_0xe30a('0xd')](util['format']('[%s][dials][dialbegin]',_0x45db68[_0xe30a('0x4')]),_0x45db68);dials[_0x45db68[_0xe30a('0x4')]]=_['assign'](dials[_0x45db68['uniqueid']],_0x45db68);dials[_0x45db68[_0xe30a('0x4')]]['starttime']=utils[_0xe30a('0x1e')]();dials[_0x45db68['uniqueid']][_0xe30a('0x1f')]=_0xe30a('0x20');utils[_0xe30a('0x2')](util[_0xe30a('0x15')](_0xe30a('0x21'),_0x45db68['uniqueid'],dials[_0x45db68[_0xe30a('0x4')]][_0xe30a('0x22')]));}}catch(_0x10afd0){utils[_0xe30a('0x23')](util[_0xe30a('0x15')](_0xe30a('0x24'),_0x45db68[_0xe30a('0x4')]),_0x10afd0);}};exports[_0xe30a('0x25')]=function(_0x48c442){try{if(!_['isNil'](dials[_0x48c442['uniqueid']])){utils[_0xe30a('0xd')](util[_0xe30a('0x15')](_0xe30a('0x26'),_0x48c442[_0xe30a('0x4')]),_0x48c442);dials[_0x48c442[_0xe30a('0x4')]][_0xe30a('0x9')]=_0x48c442[_0xe30a('0x9')];if(_0x48c442[_0xe30a('0x9')]==_0xe30a('0x27')){dials[_0x48c442[_0xe30a('0x4')]]=_[_0xe30a('0x28')](dials[_0x48c442[_0xe30a('0x4')]],_0x48c442);dials[_0x48c442[_0xe30a('0x4')]][_0xe30a('0x29')]=utils[_0xe30a('0x1e')]();dials[_0x48c442[_0xe30a('0x4')]][_0xe30a('0x1f')]=_0xe30a('0x2a');utils[_0xe30a('0x2')](util[_0xe30a('0x15')](_0xe30a('0x2b'),_0x48c442[_0xe30a('0x4')],_0x48c442[_0xe30a('0x9')],dials[_0x48c442['uniqueid']]['answertime']));}else{utils['info'](util[_0xe30a('0x15')]('[%s][dials][dialend]\x20dialstatus:%s',_0x48c442[_0xe30a('0x4')],_0x48c442['dialstatus']));}}}catch(_0x214a5f){utils['error'](util[_0xe30a('0x15')](_0xe30a('0x26'),_0x48c442[_0xe30a('0x4')]),_0x214a5f);}};exports[_0xe30a('0x2c')]=function(_0x21bd78){try{if(!_['isNil'](dials[_0x21bd78[_0xe30a('0x4')]])){utils[_0xe30a('0xd')](util[_0xe30a('0x15')](_0xe30a('0x2d'),_0x21bd78[_0xe30a('0x4')]),_0x21bd78);utils[_0xe30a('0x2')](util['format'](_0xe30a('0x2e'),_0x21bd78[_0xe30a('0x4')],_0x21bd78[_0xe30a('0x7')],_0x21bd78[_0xe30a('0x2f')],_0x21bd78[_0xe30a('0x30')]));dials[_0x21bd78[_0xe30a('0x4')]]=_[_0xe30a('0x28')](dials[_0x21bd78['uniqueid']],{'endtime':utils[_0xe30a('0x1e')](),'lastevent':_0xe30a('0x31')});dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x32')]=utils['diffTime'](dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x33')],dials[_0x21bd78[_0xe30a('0x4')]]['starttime']);dials[_0x21bd78[_0xe30a('0x4')]]['holdtime']=utils['diffTime'](dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x29')]||dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x33')],dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x22')]);dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x34')]=dials[_0x21bd78['uniqueid']][_0xe30a('0x29')]?utils['diffTime'](dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x33')],dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x29')]):0x0;writeDB(dials[_0x21bd78[_0xe30a('0x4')]]);}}catch(_0xa4fed6){utils[_0xe30a('0x23')](util[_0xe30a('0x15')]('[%s][dials][hangup]',_0x21bd78[_0xe30a('0x4')]),_0xa4fed6);}}; \ No newline at end of file +var _0x7f10=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','format','varset','debug','[%s][dials][varset]','isNil','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','starttime','lastevent','called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','assign','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils'];(function(_0xcb537a,_0x15ca9b){var _0x5dcba0=function(_0x155cfb){while(--_0x155cfb){_0xcb537a['push'](_0xcb537a['shift']());}};_0x5dcba0(++_0x15ca9b);}(_0x7f10,0x1d1));var _0x07f1=function(_0x1a8d4a,_0x374281){_0x1a8d4a=_0x1a8d4a-0x0;var _0x5242ff=_0x7f10[_0x1a8d4a];return _0x5242ff;};'use strict';var _=require(_0x07f1('0x0'));var util=require(_0x07f1('0x1'));var utils=require(_0x07f1('0x2'));var dials={};function writeDB(_0x54b44d){utils['info'](util['format'](_0x07f1('0x3'),_0x54b44d[_0x07f1('0x4')],_0x54b44d[_0x07f1('0x5')],_0x54b44d['dialstring'],_0x54b44d[_0x07f1('0x6')],_0x54b44d[_0x07f1('0x7')],_0x54b44d['dialstatus']));utils[_0x07f1('0x8')](_0x07f1('0x9'),_0x54b44d);delete dials[_0x54b44d[_0x07f1('0x4')]];}exports[_0x07f1('0xa')]=function(_0x36ef4d){try{utils['debug'](util['format'](_0x07f1('0xb'),_0x36ef4d[_0x07f1('0x4')]),_0x36ef4d);utils['info'](util['format'](_0x07f1('0xc'),_0x36ef4d[_0x07f1('0x4')],_0x36ef4d[_0x07f1('0xd')],_0x36ef4d[_0x07f1('0xe')]));if(_0x36ef4d[_0x07f1('0xd')]['toLowerCase']()==_0x07f1('0xf')&&_[_0x07f1('0x10')](_0x36ef4d[_0x07f1('0xe')][_0x07f1('0x11')](),_0x07f1('0x12'))){var _0x210eac=_0x36ef4d[_0x07f1('0xe')][_0x07f1('0x13')]('=');dials[_0x36ef4d[_0x07f1('0x4')]]={'routeId':_0x210eac[0x1]};}}catch(_0x18890c){utils[_0x07f1('0x14')](util[_0x07f1('0x15')](_0x07f1('0xb'),_0x36ef4d[_0x07f1('0x4')]),_0x18890c);}};exports[_0x07f1('0x16')]=function(_0x58f82c){try{utils[_0x07f1('0x17')](util[_0x07f1('0x15')](_0x07f1('0x18'),_0x58f82c['uniqueid']),_0x58f82c);if(!_[_0x07f1('0x19')](_0x58f82c['variable']['outboundrouteid'])){utils[_0x07f1('0x1a')](util['format'](_0x07f1('0x1b'),_0x58f82c[_0x07f1('0x4')],_0x58f82c['value']));dials[_0x58f82c[_0x07f1('0x4')]]={'routeId':_0x58f82c[_0x07f1('0x1c')]};}}catch(_0x5164dc){utils[_0x07f1('0x14')](util[_0x07f1('0x15')]('[%s][dials][varset]',_0x58f82c[_0x07f1('0x4')]),_0x5164dc);}};exports['dialbegin']=function(_0x2c7b5a){try{if(!_['isNil'](dials[_0x2c7b5a['uniqueid']])){utils[_0x07f1('0x17')](util[_0x07f1('0x15')](_0x07f1('0x1d'),_0x2c7b5a[_0x07f1('0x4')]),_0x2c7b5a);dials[_0x2c7b5a[_0x07f1('0x4')]]=_['assign'](dials[_0x2c7b5a['uniqueid']],_0x2c7b5a);dials[_0x2c7b5a[_0x07f1('0x4')]][_0x07f1('0x1e')]=utils['now']();dials[_0x2c7b5a[_0x07f1('0x4')]][_0x07f1('0x1f')]=_0x07f1('0x20');utils[_0x07f1('0x1a')](util[_0x07f1('0x15')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2c7b5a[_0x07f1('0x4')],dials[_0x2c7b5a['uniqueid']][_0x07f1('0x1e')]));}}catch(_0x3cd293){utils['error'](util[_0x07f1('0x15')](_0x07f1('0x1d'),_0x2c7b5a[_0x07f1('0x4')]),_0x3cd293);}};exports[_0x07f1('0x21')]=function(_0xd0c9e2){try{if(!_['isNil'](dials[_0xd0c9e2[_0x07f1('0x4')]])){utils['debug'](util[_0x07f1('0x15')](_0x07f1('0x22'),_0xd0c9e2[_0x07f1('0x4')]),_0xd0c9e2);dials[_0xd0c9e2['uniqueid']][_0x07f1('0x23')]=_0xd0c9e2[_0x07f1('0x23')];if(_0xd0c9e2['dialstatus']==_0x07f1('0x24')){dials[_0xd0c9e2['uniqueid']]=_['assign'](dials[_0xd0c9e2[_0x07f1('0x4')]],_0xd0c9e2);dials[_0xd0c9e2[_0x07f1('0x4')]][_0x07f1('0x25')]=utils[_0x07f1('0x26')]();dials[_0xd0c9e2[_0x07f1('0x4')]]['lastevent']=_0x07f1('0x27');utils[_0x07f1('0x1a')](util[_0x07f1('0x15')](_0x07f1('0x28'),_0xd0c9e2['uniqueid'],_0xd0c9e2[_0x07f1('0x23')],dials[_0xd0c9e2[_0x07f1('0x4')]]['answertime']));}else{utils[_0x07f1('0x1a')](util[_0x07f1('0x15')](_0x07f1('0x29'),_0xd0c9e2[_0x07f1('0x4')],_0xd0c9e2[_0x07f1('0x23')]));}}}catch(_0x423e37){utils['error'](util[_0x07f1('0x15')](_0x07f1('0x22'),_0xd0c9e2[_0x07f1('0x4')]),_0x423e37);}};exports[_0x07f1('0x2a')]=function(_0x3feadf){try{if(!_[_0x07f1('0x19')](dials[_0x3feadf[_0x07f1('0x4')]])){utils[_0x07f1('0x17')](util['format'](_0x07f1('0x2b'),_0x3feadf[_0x07f1('0x4')]),_0x3feadf);utils[_0x07f1('0x1a')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3feadf['uniqueid'],_0x3feadf[_0x07f1('0x6')],_0x3feadf[_0x07f1('0x2c')],_0x3feadf[_0x07f1('0x2d')]));dials[_0x3feadf[_0x07f1('0x4')]]=_[_0x07f1('0x2e')](dials[_0x3feadf['uniqueid']],{'endtime':utils[_0x07f1('0x26')](),'lastevent':_0x07f1('0x2f')});dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x30')]=utils[_0x07f1('0x31')](dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x32')],dials[_0x3feadf[_0x07f1('0x4')]]['starttime']);dials[_0x3feadf[_0x07f1('0x4')]]['holdtime']=utils[_0x07f1('0x31')](dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x25')]||dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x32')],dials[_0x3feadf['uniqueid']][_0x07f1('0x1e')]);dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x33')]=dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x25')]?utils['diffTime'](dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x32')],dials[_0x3feadf[_0x07f1('0x4')]][_0x07f1('0x25')]):0x0;writeDB(dials[_0x3feadf['uniqueid']]);}}catch(_0x4aa854){utils[_0x07f1('0x14')](util[_0x07f1('0x15')]('[%s][dials][hangup]',_0x3feadf['uniqueid']),_0x4aa854);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e5bc69d..1e34a78 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 _0x09d1=['./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED'];(function(_0x30f8a2,_0x23b1f7){var _0x38b4d7=function(_0x22dec6){while(--_0x22dec6){_0x30f8a2['push'](_0x30f8a2['shift']());}};_0x38b4d7(++_0x23b1f7);}(_0x09d1,0xb2));var _0x109d=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x09d1[_0x4ca333];return _0x13b2e1;};var AsteriskManager=require(_0x109d('0x0'));var config=require(_0x109d('0x1'));var utils=require(_0x109d('0x2'));var util=require(_0x109d('0x3'));var ami=new AsteriskManager(config[_0x109d('0x4')]['port'],config[_0x109d('0x4')]['ip'],config[_0x109d('0x4')][_0x109d('0x5')],config[_0x109d('0x4')][_0x109d('0x6')],!![]);ami[_0x109d('0x7')]();if(config['xdr']&&config[_0x109d('0x8')][_0x109d('0x9')]){utils['info'](_0x109d('0xa'));}else{var agents=require(_0x109d('0xb'));var calls=require(_0x109d('0xc'));var queues=require(_0x109d('0xd'));var recordings=require(_0x109d('0xe'));var members=require(_0x109d('0xf'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x109d('0x10'));ami['on'](_0x109d('0x11'),core['connect']);ami['on']('shutdown',core['shutdown']);ami['on'](_0x109d('0x12'),core[_0x109d('0x12')]);ami['on'](_0x109d('0x13'),core['error']);ami['on'](_0x109d('0x14'),core[_0x109d('0x14')]);ami['on'](_0x109d('0x15'),core['managerevent']);ami['on'](_0x109d('0x16'),function(_0x3c4902){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x18'),_0x3c4902[_0x109d('0x19')]),_0x3c4902);members[_0x109d('0x16')](_0x3c4902);}catch(_0x1599f0){utils['error'](util[_0x109d('0x1a')](_0x109d('0x18'),_0x3c4902[_0x109d('0x19')]),_0x1599f0);}});ami['on'](_0x109d('0x1b'),function(_0x560fce){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')]('[%s][index][agentcalled]',_0x560fce['uniqueid']),_0x560fce);agents[_0x109d('0x1b')](_0x560fce);}catch(_0x20993b){utils[_0x109d('0x13')](util['format'](_0x109d('0x1c'),_0x560fce['uniqueid']),_0x20993b);}});ami['on']('agentringnoanswer',function(_0x27d966){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x1d'),_0x27d966[_0x109d('0x1e')]),_0x27d966);agents[_0x109d('0x1f')](_0x27d966);}catch(_0x787d1c){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x1d'),_0x27d966[_0x109d('0x1e')]),_0x787d1c);}});ami['on'](_0x109d('0x20'),function(_0xb2c4c9){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x21'),_0xb2c4c9[_0x109d('0x1e')]),_0xb2c4c9);agents[_0x109d('0x20')](_0xb2c4c9);queues['agentconnect'](_0xb2c4c9);}catch(_0xcb3dd0){utils['error'](util[_0x109d('0x1a')](_0x109d('0x21'),_0xb2c4c9[_0x109d('0x1e')]),_0xcb3dd0);}});ami['on'](_0x109d('0x22'),function(_0x4a013e){try{utils['debug'](util[_0x109d('0x1a')](_0x109d('0x23'),_0x4a013e[_0x109d('0x1e')]),_0x4a013e);agents[_0x109d('0x22')](_0x4a013e);queues[_0x109d('0x22')](_0x4a013e);members[_0x109d('0x22')](_0x4a013e);}catch(_0x805124){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x23'),_0x4a013e[_0x109d('0x1e')]),_0x805124);}});ami['on'](_0x109d('0x24'),function(_0x373664){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x25'),_0x373664[_0x109d('0x1e')]),_0x373664);agents['queuecallerabandon'](_0x373664);queues[_0x109d('0x24')](_0x373664);}catch(_0x41e149){utils['error'](util['format'](_0x109d('0x25'),_0x373664[_0x109d('0x1e')]),_0x41e149);}});ami['on'](_0x109d('0x26'),function(_0x924e5d){try{utils['debug'](util[_0x109d('0x1a')]('[%s][index][queuecallerjoin]',_0x924e5d['uniqueid']),_0x924e5d);queues['queuecallerjoin'](_0x924e5d);recordings[_0x109d('0x26')](_0x924e5d);}catch(_0x2e5778){utils['error'](util['format']('[%s][index][queuecallerjoin]',_0x924e5d[_0x109d('0x1e')]),_0x2e5778);}});ami['on'](_0x109d('0x27'),function(_0x296a03){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x28'),_0x296a03[_0x109d('0x1e')]),_0x296a03);queues[_0x109d('0x27')](_0x296a03);}catch(_0x2db3ce){utils[_0x109d('0x13')](util[_0x109d('0x1a')]('[%s][index][queuecallerleave]',_0x296a03['uniqueid']),_0x2db3ce);}});ami['on'](_0x109d('0x29'),function(_0x36279b){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x2a'),_0x36279b[_0x109d('0x1e')]),_0x36279b);queues[_0x109d('0x29')](_0x36279b);calls[_0x109d('0x29')](_0x36279b);}catch(_0x4ea931){utils['error'](util[_0x109d('0x1a')](_0x109d('0x2a'),_0x36279b[_0x109d('0x1e')]),_0x4ea931);}});ami['on']('musiconholdstop',function(_0x4c2f83){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x2b'),_0x4c2f83[_0x109d('0x1e')]),_0x4c2f83);queues[_0x109d('0x2c')](_0x4c2f83);calls['musiconholdstop'](_0x4c2f83);}catch(_0x1b9008){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x2b'),_0x4c2f83['uniqueid']),_0x1b9008);}});ami['on'](_0x109d('0x2d'),function(_0x5c1b4b){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x2e'),_0x5c1b4b[_0x109d('0x1e')]),_0x5c1b4b);calls[_0x109d('0x2d')](_0x5c1b4b);recordings['newstate'](_0x5c1b4b);}catch(_0x20431e){utils['error'](util[_0x109d('0x1a')](_0x109d('0x2e'),_0x5c1b4b[_0x109d('0x1e')]),_0x20431e);}});ami['on'](_0x109d('0x2f'),function(_0x8818a){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')]('[%s][index][hangup]',_0x8818a[_0x109d('0x1e')]),_0x8818a);calls[_0x109d('0x2f')](_0x8818a);recordings[_0x109d('0x2f')](_0x8818a);dials[_0x109d('0x2f')](_0x8818a);agents['hangup'](_0x8818a);queues[_0x109d('0x2f')](_0x8818a);}catch(_0x28bd28){utils[_0x109d('0x13')](util['format'](_0x109d('0x30'),_0x8818a[_0x109d('0x1e')]),_0x28bd28);}});ami['on']('cdr',function(_0x2f552f){try{utils['debug'](util[_0x109d('0x1a')]('[%s][index][cdr]',_0x2f552f[_0x109d('0x1e')]),_0x2f552f);members['cdr'](_0x2f552f);}catch(_0x278f4b){utils[_0x109d('0x13')](util[_0x109d('0x1a')]('[%s][index][cdr]',_0x2f552f[_0x109d('0x1e')]),_0x278f4b);}});ami['on'](_0x109d('0x31'),function(_0x4527e1){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x32'),_0x4527e1[_0x109d('0x1e')]),_0x4527e1);queues[_0x109d('0x31')](_0x4527e1);agents['blindtransfer'](_0x4527e1);transfers['blindtransfer'](_0x4527e1);}catch(_0x49e232){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x32'),_0x4527e1['uniqueid']),_0x49e232);}});ami['on'](_0x109d('0x33'),function(_0x4cd055){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x34'),_0x4cd055[_0x109d('0x35')]),_0x4cd055);queues[_0x109d('0x33')](_0x4cd055);transfers['attendedtransfer'](_0x4cd055);agents[_0x109d('0x33')](_0x4cd055);calls[_0x109d('0x33')](_0x4cd055);}catch(_0x35642c){utils['error'](util[_0x109d('0x1a')](_0x109d('0x34'),_0x4cd055['origtransfereruniqueid']),_0x35642c);}});ami['on'](_0x109d('0x36'),function(_0x4b2ba1){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x37'),_0x4b2ba1[_0x109d('0x1e')]),_0x4b2ba1);queues['varset'](_0x4b2ba1);recordings[_0x109d('0x36')](_0x4b2ba1);calls['varset'](_0x4b2ba1);dials[_0x109d('0x36')](_0x4b2ba1);}catch(_0xc9735c){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x37'),_0x4b2ba1['uniqueid']),_0xc9735c);}});ami['on'](_0x109d('0x38'),function(_0x3eb191){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x39'),_0x3eb191[_0x109d('0x1e')]),_0x3eb191);calls[_0x109d('0x38')](_0x3eb191);recordings[_0x109d('0x38')](_0x3eb191);dials['newexten'](_0x3eb191);}catch(_0x2e9dde){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x39'),_0x3eb191[_0x109d('0x1e')]),_0x2e9dde);}});ami['on']('newchannel',function(_0x1fc0bd){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x3a'),_0x1fc0bd[_0x109d('0x1e')]),_0x1fc0bd);calls['newchannel'](_0x1fc0bd);recordings[_0x109d('0x3b')](_0x1fc0bd);}catch(_0x5d3aaa){utils[_0x109d('0x13')](util[_0x109d('0x1a')]('[%s][index][newchannel]',_0x1fc0bd[_0x109d('0x1e')]),_0x5d3aaa);}});ami['on']('dialbegin',function(_0x7e3587){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x3c'),_0x7e3587[_0x109d('0x1e')]),_0x7e3587);dials['dialbegin'](_0x7e3587);}catch(_0x481104){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x3d'),_0x7e3587[_0x109d('0x1e')]),_0x481104);}});ami['on'](_0x109d('0x3e'),function(_0x489d4c){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')]('[%s][index][dialend]',_0x489d4c[_0x109d('0x1e')]),_0x489d4c);dials[_0x109d('0x3e')](_0x489d4c);}catch(_0x5ca589){utils['error'](util[_0x109d('0x1a')]('[%s][index][dialend]',_0x489d4c[_0x109d('0x1e')]),_0x5ca589);}});} \ No newline at end of file +var _0x05a7=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','asterisk-manager','../../config/environment','./utils','asterisk','password','xdr','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x05a7,0x108));var _0x705a=function(_0x285a14,_0x394a27){_0x285a14=_0x285a14-0x0;var _0x3430cc=_0x05a7[_0x285a14];return _0x3430cc;};var AsteriskManager=require(_0x705a('0x0'));var config=require(_0x705a('0x1'));var utils=require(_0x705a('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk']['port'],config[_0x705a('0x3')]['ip'],config[_0x705a('0x3')]['username'],config['asterisk'][_0x705a('0x4')],!![]);ami['keepConnected']();if(config[_0x705a('0x5')]&&config[_0x705a('0x5')]['disabled']){utils['info'](_0x705a('0x6'));}else{var agents=require('./agents.controller');var calls=require(_0x705a('0x7'));var queues=require('./queues.controller');var recordings=require(_0x705a('0x8'));var members=require(_0x705a('0x9'));var dials=require(_0x705a('0xa'));var transfers=require('./transfers.controller');var core=require(_0x705a('0xb'));ami['on']('connect',core['connect']);ami['on'](_0x705a('0xc'),core[_0x705a('0xc')]);ami['on'](_0x705a('0xd'),core['fullybooted']);ami['on'](_0x705a('0xe'),core[_0x705a('0xe')]);ami['on'](_0x705a('0xf'),core['close']);ami['on'](_0x705a('0x10'),core[_0x705a('0x10')]);ami['on'](_0x705a('0x11'),function(_0x8d63bf){try{utils['debug'](util[_0x705a('0x12')]('[%s][index][devicestatechange]',_0x8d63bf['device']),_0x8d63bf);members[_0x705a('0x11')](_0x8d63bf);}catch(_0x2fa3d8){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x13'),_0x8d63bf['device']),_0x2fa3d8);}});ami['on'](_0x705a('0x14'),function(_0x4a2da8){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x16'),_0x4a2da8['uniqueid']),_0x4a2da8);agents[_0x705a('0x14')](_0x4a2da8);}catch(_0x3b7c84){utils[_0x705a('0xe')](util[_0x705a('0x12')]('[%s][index][agentcalled]',_0x4a2da8['uniqueid']),_0x3b7c84);}});ami['on'](_0x705a('0x17'),function(_0x1ff2c2){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x18'),_0x1ff2c2['uniqueid']),_0x1ff2c2);agents[_0x705a('0x17')](_0x1ff2c2);}catch(_0x2de39c){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x18'),_0x1ff2c2[_0x705a('0x19')]),_0x2de39c);}});ami['on'](_0x705a('0x1a'),function(_0x144039){try{utils['debug'](util[_0x705a('0x12')]('[%s][index][agentconnect]',_0x144039['uniqueid']),_0x144039);agents[_0x705a('0x1a')](_0x144039);queues[_0x705a('0x1a')](_0x144039);}catch(_0xf2c1b3){utils[_0x705a('0xe')](util['format'](_0x705a('0x1b'),_0x144039[_0x705a('0x19')]),_0xf2c1b3);}});ami['on'](_0x705a('0x1c'),function(_0x4347ae){try{utils[_0x705a('0x15')](util[_0x705a('0x12')]('[%s][index][agentcomplete]',_0x4347ae[_0x705a('0x19')]),_0x4347ae);agents[_0x705a('0x1c')](_0x4347ae);queues[_0x705a('0x1c')](_0x4347ae);members['agentcomplete'](_0x4347ae);}catch(_0x44eaa6){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x1d'),_0x4347ae['uniqueid']),_0x44eaa6);}});ami['on']('queuecallerabandon',function(_0x3ffd4c){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x1e'),_0x3ffd4c[_0x705a('0x19')]),_0x3ffd4c);agents[_0x705a('0x1f')](_0x3ffd4c);queues['queuecallerabandon'](_0x3ffd4c);}catch(_0x4af3c8){utils[_0x705a('0xe')](util['format'](_0x705a('0x1e'),_0x3ffd4c[_0x705a('0x19')]),_0x4af3c8);}});ami['on']('queuecallerjoin',function(_0x4a3173){try{utils['debug'](util[_0x705a('0x12')](_0x705a('0x20'),_0x4a3173[_0x705a('0x19')]),_0x4a3173);queues[_0x705a('0x21')](_0x4a3173);recordings[_0x705a('0x21')](_0x4a3173);}catch(_0x54ad4f){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x20'),_0x4a3173['uniqueid']),_0x54ad4f);}});ami['on'](_0x705a('0x22'),function(_0xce4293){try{utils['debug'](util[_0x705a('0x12')](_0x705a('0x23'),_0xce4293['uniqueid']),_0xce4293);queues[_0x705a('0x22')](_0xce4293);}catch(_0x424a6b){utils['error'](util[_0x705a('0x12')](_0x705a('0x23'),_0xce4293['uniqueid']),_0x424a6b);}});ami['on'](_0x705a('0x24'),function(_0x4f5e54){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x25'),_0x4f5e54[_0x705a('0x19')]),_0x4f5e54);queues[_0x705a('0x24')](_0x4f5e54);calls[_0x705a('0x24')](_0x4f5e54);}catch(_0x40b2d6){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x25'),_0x4f5e54[_0x705a('0x19')]),_0x40b2d6);}});ami['on'](_0x705a('0x26'),function(_0xbe572b){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x27'),_0xbe572b[_0x705a('0x19')]),_0xbe572b);queues['musiconholdstop'](_0xbe572b);calls[_0x705a('0x26')](_0xbe572b);}catch(_0xf6e8eb){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x27'),_0xbe572b['uniqueid']),_0xf6e8eb);}});ami['on'](_0x705a('0x28'),function(_0x2710bf){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x29'),_0x2710bf[_0x705a('0x19')]),_0x2710bf);calls[_0x705a('0x28')](_0x2710bf);recordings[_0x705a('0x28')](_0x2710bf);}catch(_0x120578){utils[_0x705a('0xe')](util['format'](_0x705a('0x29'),_0x2710bf[_0x705a('0x19')]),_0x120578);}});ami['on'](_0x705a('0x2a'),function(_0x34451a){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x2b'),_0x34451a['uniqueid']),_0x34451a);calls['hangup'](_0x34451a);recordings[_0x705a('0x2a')](_0x34451a);dials[_0x705a('0x2a')](_0x34451a);agents[_0x705a('0x2a')](_0x34451a);queues[_0x705a('0x2a')](_0x34451a);}catch(_0x579f51){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x2b'),_0x34451a[_0x705a('0x19')]),_0x579f51);}});ami['on'](_0x705a('0x2c'),function(_0x2bd81e){try{utils['debug'](util[_0x705a('0x12')]('[%s][index][cdr]',_0x2bd81e['uniqueid']),_0x2bd81e);members[_0x705a('0x2c')](_0x2bd81e);}catch(_0x1df9f3){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x2d'),_0x2bd81e[_0x705a('0x19')]),_0x1df9f3);}});ami['on'](_0x705a('0x2e'),function(_0x388624){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0x388624[_0x705a('0x19')]),_0x388624);queues[_0x705a('0x2e')](_0x388624);agents['blindtransfer'](_0x388624);transfers[_0x705a('0x2e')](_0x388624);}catch(_0x42a0a2){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x2f'),_0x388624['uniqueid']),_0x42a0a2);}});ami['on'](_0x705a('0x30'),function(_0x5a92cb){try{utils[_0x705a('0x15')](util['format'](_0x705a('0x31'),_0x5a92cb[_0x705a('0x32')]),_0x5a92cb);queues[_0x705a('0x30')](_0x5a92cb);transfers[_0x705a('0x30')](_0x5a92cb);agents[_0x705a('0x30')](_0x5a92cb);calls[_0x705a('0x30')](_0x5a92cb);}catch(_0x5ce7b4){utils['error'](util['format']('[%s][index][attendedtransfer]',_0x5a92cb[_0x705a('0x32')]),_0x5ce7b4);}});ami['on'](_0x705a('0x33'),function(_0x3ccc00){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x34'),_0x3ccc00[_0x705a('0x19')]),_0x3ccc00);queues[_0x705a('0x33')](_0x3ccc00);recordings[_0x705a('0x33')](_0x3ccc00);calls[_0x705a('0x33')](_0x3ccc00);dials[_0x705a('0x33')](_0x3ccc00);}catch(_0x5a854a){utils[_0x705a('0xe')](util['format']('[%s][index][varset]',_0x3ccc00[_0x705a('0x19')]),_0x5a854a);}});ami['on'](_0x705a('0x35'),function(_0x386b45){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x36'),_0x386b45[_0x705a('0x19')]),_0x386b45);calls[_0x705a('0x35')](_0x386b45);recordings['newexten'](_0x386b45);dials['newexten'](_0x386b45);}catch(_0x4d0dc1){utils[_0x705a('0xe')](util[_0x705a('0x12')](_0x705a('0x36'),_0x386b45[_0x705a('0x19')]),_0x4d0dc1);}});ami['on'](_0x705a('0x37'),function(_0xbde9b8){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x38'),_0xbde9b8[_0x705a('0x19')]),_0xbde9b8);calls[_0x705a('0x37')](_0xbde9b8);recordings[_0x705a('0x37')](_0xbde9b8);}catch(_0x54a336){utils[_0x705a('0xe')](util['format'](_0x705a('0x38'),_0xbde9b8[_0x705a('0x19')]),_0x54a336);}});ami['on'](_0x705a('0x39'),function(_0x265010){try{utils[_0x705a('0x15')](util[_0x705a('0x12')](_0x705a('0x3a'),_0x265010[_0x705a('0x19')]),_0x265010);dials['dialbegin'](_0x265010);}catch(_0x135727){utils[_0x705a('0xe')](util[_0x705a('0x12')]('[%s]dialbegin',_0x265010[_0x705a('0x19')]),_0x135727);}});ami['on'](_0x705a('0x3b'),function(_0x4144e3){try{utils[_0x705a('0x15')](util[_0x705a('0x12')]('[%s][index][dialend]',_0x4144e3['uniqueid']),_0x4144e3);dials['dialend'](_0x4144e3);}catch(_0x241400){utils['error'](util[_0x705a('0x12')]('[%s][index][dialend]',_0x4144e3[_0x705a('0x19')]),_0x241400);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 313f180..e1fddf1 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 _0x7eaf=['channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','split','catch','error','[%s][members][writeDB]','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','info','format','uniqueid'];(function(_0x5ab81a,_0x2aa55c){var _0x526e2c=function(_0x5e5bf9){while(--_0x5e5bf9){_0x5ab81a['push'](_0x5ab81a['shift']());}};_0x526e2c(++_0x2aa55c);}(_0x7eaf,0x189));var _0xf7ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eaf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf7ea('0x0'));var util=require(_0xf7ea('0x1'));var utils=require(_0xf7ea('0x2'));var members={};var exclude=[_0xf7ea('0x3'),'Queue:'];function writeDB(_0x49f78e){utils[_0xf7ea('0x4')](util[_0xf7ea('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x49f78e[_0xf7ea('0x6')],_0x49f78e['interface'],_0x49f78e[_0xf7ea('0x7')],_0x49f78e[_0xf7ea('0x8')],_0x49f78e[_0xf7ea('0x9')],_0x49f78e[_0xf7ea('0xa')]));if(_0x49f78e[_0xf7ea('0xb')]){utils[_0xf7ea('0xc')](_0x49f78e[_0xf7ea('0xb')])[_0xf7ea('0xd')](function(_0x368ecd){if(_0x368ecd){_0x49f78e[_0xf7ea('0x9')]=_0x368ecd[_0xf7ea('0xe')];_0x49f78e['internal']=_0x368ecd[_0xf7ea('0xf')];utils[_0xf7ea('0x10')]('CreateMemberReport',_0x49f78e);}else{utils['getUserByName'](_0x49f78e[_0xf7ea('0xb')][_0xf7ea('0x11')]('/')[0x1])[_0xf7ea('0xd')](function(_0x19d1ae){if(_0x19d1ae){_0x49f78e['membername']=_0x19d1ae[_0xf7ea('0xe')];_0x49f78e[_0xf7ea('0xf')]=_0x19d1ae['internal'];utils[_0xf7ea('0x10')]('CreateMemberReport',_0x49f78e);}});}})[_0xf7ea('0x12')](function(_0x485e87){utils[_0xf7ea('0x13')](util['format'](_0xf7ea('0x14'),_0x49f78e['uniqueid']),_0x485e87);});}delete members[_0x49f78e[_0xf7ea('0xb')]];}function startsWith(_0x229da8,_0x34ec63){return _['some'](_0x229da8,function(_0x9563b6){return _[_0xf7ea('0x15')](_0x34ec63,_0x9563b6);});}exports['devicestatechange']=function(_0x44b164){try{utils[_0xf7ea('0x16')](util[_0xf7ea('0x5')](_0xf7ea('0x17'),members[_0x44b164[_0xf7ea('0x18')]]?members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x6')]:_0x44b164[_0xf7ea('0x18')]),_0x44b164);utils['info'](util[_0xf7ea('0x5')](_0xf7ea('0x19'),members[_0x44b164['device']]?members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x6')]:_0x44b164['device'],_0x44b164[_0xf7ea('0x1a')],_0x44b164[_0xf7ea('0x18')]));switch(_0x44b164[_0xf7ea('0x1a')]){case _0xf7ea('0x1b'):case _0xf7ea('0x1c'):if(!startsWith(exclude,_0x44b164[_0xf7ea('0x18')])){members[_0x44b164[_0xf7ea('0x18')]]={'channel':'voice','interface':_0x44b164[_0xf7ea('0x18')],'type':_0xf7ea('0x1d'),'enterAt':utils[_0xf7ea('0x1e')](),'role':_0xf7ea('0x1f')};}break;case _0xf7ea('0x20'):if(!_[_0xf7ea('0x21')](members[_0x44b164[_0xf7ea('0x18')]])){members[_0x44b164['device']][_0xf7ea('0x22')]=utils[_0xf7ea('0x1e')]();members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x23')]=utils[_0xf7ea('0x24')](members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x22')],members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x25')]);if(members[_0x44b164[_0xf7ea('0x18')]]['uniqueid']){writeDB(members[_0x44b164[_0xf7ea('0x18')]]);}}break;default:break;}}catch(_0x3c59e2){utils[_0xf7ea('0x13')](util[_0xf7ea('0x5')](_0xf7ea('0x17'),members[_0x44b164[_0xf7ea('0x18')]]?members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x6')]:_0x44b164[_0xf7ea('0x18')]),_0x3c59e2);}};exports['agentcomplete']=function(_0x43da67){try{if(!_[_0xf7ea('0x21')](members[_0x43da67[_0xf7ea('0xb')]])){utils[_0xf7ea('0x16')](util[_0xf7ea('0x5')](_0xf7ea('0x26'),_0x43da67[_0xf7ea('0x6')]),_0x43da67);utils['info'](util[_0xf7ea('0x5')](_0xf7ea('0x27'),_0x43da67[_0xf7ea('0x6')],_0x43da67[_0xf7ea('0xb')],_0x43da67[_0xf7ea('0x28')]));members[_0x43da67[_0xf7ea('0xb')]]=_['assign'](members[_0x43da67[_0xf7ea('0xb')]],{'data4':_0x43da67[_0xf7ea('0x28')],'uniqueid':_0x43da67['uniqueid']});}}catch(_0x2edf01){utils[_0xf7ea('0x13')](util[_0xf7ea('0x5')](_0xf7ea('0x26'),_0x43da67[_0xf7ea('0x6')]),_0x2edf01);}};exports[_0xf7ea('0x29')]=function(_0x2e6344){try{utils[_0xf7ea('0x16')](util['format'](_0xf7ea('0x2a'),_0x2e6344[_0xf7ea('0x6')]),_0x2e6344);if(_0x2e6344[_0xf7ea('0x7')]){var _0x227715=_0x2e6344['channel'][_0xf7ea('0x11')]('-')[0x0];if(!_[_0xf7ea('0x21')](members[_0x227715])){members[_0x227715]=_[_0xf7ea('0x2b')](members[_0x227715],{'data1':members[_0x227715][_0xf7ea('0x2c')]||_0x2e6344[_0xf7ea('0xa')],'data2':members[_0x227715][_0xf7ea('0x8')]||_0x2e6344[_0xf7ea('0x2d')],'data3':members[_0x227715]['data3']||_0x2e6344[_0xf7ea('0x2e')],'uniqueid':members[_0x227715]['uniqueid']||_0x2e6344[_0xf7ea('0x6')]});utils[_0xf7ea('0x4')](util['format'](_0xf7ea('0x2f'),_0x2e6344['uniqueid'],members[_0x227715]['data1'],members[_0x227715][_0xf7ea('0x8')],members[_0x227715][_0xf7ea('0x30')]));if(members[_0x227715][_0xf7ea('0x22')]){writeDB(members[_0x227715]);}}}if(_0x2e6344[_0xf7ea('0x31')]){var _0x5d327e=_0x2e6344['destinationchannel'][_0xf7ea('0x11')]('-')[0x0];if(!_[_0xf7ea('0x21')](members[_0x5d327e])){members[_0x5d327e]=_[_0xf7ea('0x2b')](members[_0x5d327e],{'data1':members[_0x5d327e][_0xf7ea('0x2c')]||_0x2e6344[_0xf7ea('0xa')],'data2':members[_0x5d327e]['data2']||_0x2e6344[_0xf7ea('0x2d')],'data3':members[_0x5d327e]['data3']||_0x2e6344[_0xf7ea('0x2e')],'uniqueid':members[_0x5d327e][_0xf7ea('0x6')]||_0x2e6344[_0xf7ea('0x6')]});utils[_0xf7ea('0x4')](util['format'](_0xf7ea('0x2f'),_0x2e6344[_0xf7ea('0x6')],members[_0x5d327e][_0xf7ea('0x2c')],members[_0x5d327e][_0xf7ea('0x8')],members[_0x5d327e]['data3']));if(members[_0x5d327e]['exitAt']){writeDB(members[_0x5d327e]);}}}}catch(_0x424916){utils['error'](util[_0xf7ea('0x5')](_0xf7ea('0x2a'),_0x2e6344[_0xf7ea('0x6')]),_0x424916);}}; \ No newline at end of file +var _0x3324=['BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','type','source','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','name','internal','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x3324,0x1da));var _0x4332=function(_0x174e6a,_0x17db83){_0x174e6a=_0x174e6a-0x0;var _0x383782=_0x3324[_0x174e6a];return _0x383782;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x4332('0x0'),_0x4332('0x1')];function writeDB(_0x36c7a2){utils[_0x4332('0x2')](util[_0x4332('0x3')](_0x4332('0x4'),_0x36c7a2[_0x4332('0x5')],_0x36c7a2[_0x4332('0x6')],_0x36c7a2[_0x4332('0x7')],_0x36c7a2[_0x4332('0x8')],_0x36c7a2[_0x4332('0x9')],_0x36c7a2['type']));if(_0x36c7a2[_0x4332('0x6')]){utils[_0x4332('0xa')](_0x36c7a2[_0x4332('0x6')])['then'](function(_0x44ac6a){if(_0x44ac6a){_0x36c7a2[_0x4332('0x9')]=_0x44ac6a[_0x4332('0xb')];_0x36c7a2[_0x4332('0xc')]=_0x44ac6a['internal'];utils['request'](_0x4332('0xd'),_0x36c7a2);}else{utils[_0x4332('0xe')](_0x36c7a2[_0x4332('0x6')][_0x4332('0xf')]('/')[0x1])['then'](function(_0x26b5e9){if(_0x26b5e9){_0x36c7a2[_0x4332('0x9')]=_0x26b5e9['name'];_0x36c7a2[_0x4332('0xc')]=_0x26b5e9[_0x4332('0xc')];utils['request']('CreateMemberReport',_0x36c7a2);}});}})[_0x4332('0x10')](function(_0x114ddc){utils[_0x4332('0x11')](util[_0x4332('0x3')]('[%s][members][writeDB]',_0x36c7a2['uniqueid']),_0x114ddc);});}delete members[_0x36c7a2[_0x4332('0x6')]];}function startsWith(_0x341ac7,_0x5511f0){return _[_0x4332('0x12')](_0x341ac7,function(_0x270ce7){return _[_0x4332('0x13')](_0x5511f0,_0x270ce7);});}exports[_0x4332('0x14')]=function(_0x31827b){try{utils['debug'](util[_0x4332('0x3')](_0x4332('0x15'),members[_0x31827b['device']]?members[_0x31827b[_0x4332('0x16')]]['uniqueid']:_0x31827b[_0x4332('0x16')]),_0x31827b);utils['info'](util[_0x4332('0x3')](_0x4332('0x17'),members[_0x31827b[_0x4332('0x16')]]?members[_0x31827b[_0x4332('0x16')]]['uniqueid']:_0x31827b[_0x4332('0x16')],_0x31827b[_0x4332('0x18')],_0x31827b[_0x4332('0x16')]));switch(_0x31827b[_0x4332('0x18')]){case _0x4332('0x19'):case _0x4332('0x1a'):if(!startsWith(exclude,_0x31827b[_0x4332('0x16')])){members[_0x31827b[_0x4332('0x16')]]={'channel':_0x4332('0x1b'),'interface':_0x31827b[_0x4332('0x16')],'type':'TALKING','enterAt':utils[_0x4332('0x1c')](),'role':_0x4332('0x1d')};}break;case _0x4332('0x1e'):if(!_[_0x4332('0x1f')](members[_0x31827b[_0x4332('0x16')]])){members[_0x31827b[_0x4332('0x16')]][_0x4332('0x20')]=utils[_0x4332('0x1c')]();members[_0x31827b[_0x4332('0x16')]][_0x4332('0x21')]=utils[_0x4332('0x22')](members[_0x31827b[_0x4332('0x16')]][_0x4332('0x20')],members[_0x31827b['device']][_0x4332('0x23')]);if(members[_0x31827b[_0x4332('0x16')]][_0x4332('0x5')]){writeDB(members[_0x31827b[_0x4332('0x16')]]);}}break;default:break;}}catch(_0x3237f8){utils[_0x4332('0x11')](util['format']('[%s][members][devicestatechange]',members[_0x31827b[_0x4332('0x16')]]?members[_0x31827b[_0x4332('0x16')]][_0x4332('0x5')]:_0x31827b[_0x4332('0x16')]),_0x3237f8);}};exports['agentcomplete']=function(_0x37ac77){try{if(!_[_0x4332('0x1f')](members[_0x37ac77[_0x4332('0x6')]])){utils[_0x4332('0x24')](util['format'](_0x4332('0x25'),_0x37ac77[_0x4332('0x5')]),_0x37ac77);utils[_0x4332('0x2')](util[_0x4332('0x3')](_0x4332('0x26'),_0x37ac77[_0x4332('0x5')],_0x37ac77[_0x4332('0x6')],_0x37ac77[_0x4332('0x27')]));members[_0x37ac77['interface']]=_['assign'](members[_0x37ac77[_0x4332('0x6')]],{'data4':_0x37ac77[_0x4332('0x27')],'uniqueid':_0x37ac77[_0x4332('0x5')]});}}catch(_0xa77d2e){utils[_0x4332('0x11')](util['format'](_0x4332('0x25'),_0x37ac77[_0x4332('0x5')]),_0xa77d2e);}};exports[_0x4332('0x28')]=function(_0x3895eb){try{utils[_0x4332('0x24')](util[_0x4332('0x3')](_0x4332('0x29'),_0x3895eb[_0x4332('0x5')]),_0x3895eb);if(_0x3895eb[_0x4332('0x7')]){var _0xb0362a=_0x3895eb[_0x4332('0x7')][_0x4332('0xf')]('-')[0x0];if(!_['isNil'](members[_0xb0362a])){members[_0xb0362a]=_[_0x4332('0x2a')](members[_0xb0362a],{'data1':members[_0xb0362a][_0x4332('0x2b')]||_0x3895eb[_0x4332('0x2c')],'data2':members[_0xb0362a][_0x4332('0x8')]||_0x3895eb[_0x4332('0x2d')],'data3':members[_0xb0362a]['data3']||_0x3895eb[_0x4332('0x2e')],'uniqueid':members[_0xb0362a][_0x4332('0x5')]||_0x3895eb[_0x4332('0x5')]});utils['info'](util[_0x4332('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3895eb[_0x4332('0x5')],members[_0xb0362a][_0x4332('0x2b')],members[_0xb0362a][_0x4332('0x8')],members[_0xb0362a]['data3']));if(members[_0xb0362a][_0x4332('0x20')]){writeDB(members[_0xb0362a]);}}}if(_0x3895eb[_0x4332('0x2f')]){var _0x5cd385=_0x3895eb['destinationchannel'][_0x4332('0xf')]('-')[0x0];if(!_[_0x4332('0x1f')](members[_0x5cd385])){members[_0x5cd385]=_[_0x4332('0x2a')](members[_0x5cd385],{'data1':members[_0x5cd385][_0x4332('0x2b')]||_0x3895eb[_0x4332('0x2c')],'data2':members[_0x5cd385][_0x4332('0x8')]||_0x3895eb[_0x4332('0x2d')],'data3':members[_0x5cd385]['data3']||_0x3895eb['destination'],'uniqueid':members[_0x5cd385][_0x4332('0x5')]||_0x3895eb[_0x4332('0x5')]});utils['info'](util[_0x4332('0x3')](_0x4332('0x30'),_0x3895eb[_0x4332('0x5')],members[_0x5cd385][_0x4332('0x2b')],members[_0x5cd385][_0x4332('0x8')],members[_0x5cd385][_0x4332('0x31')]));if(members[_0x5cd385][_0x4332('0x20')]){writeDB(members[_0x5cd385]);}}}}catch(_0x588390){utils['error'](util[_0x4332('0x3')](_0x4332('0x29'),_0x3895eb[_0x4332('0x5')]),_0x588390);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 74f13c5..fb47d64 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 _0x5713=['EXITWITHKEY','[%s][queues][varset]','[%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','holdtime','diffTime','count','connectedlinename','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentconnect]','reason','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfer','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','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','transfertargetlinkedid','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','variable','value','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5713,0x1c7));var _0x3571=function(_0x40dc32,_0x1e8034){_0x40dc32=_0x40dc32-0x0;var _0x2bfb0=_0x5713[_0x40dc32];return _0x2bfb0;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x2d28f5){utils['info'](util[_0x3571('0x2')](_0x3571('0x3'),_0x2d28f5[_0x3571('0x4')],_0x2d28f5[_0x3571('0x5')],_0x2d28f5['queue'],_0x2d28f5['lastAssignedTo'],_0x2d28f5[_0x3571('0x6')],_0x2d28f5[_0x3571('0x7')],_0x2d28f5[_0x3571('0x8')]));if(_0x2d28f5[_0x3571('0x9')]){utils[_0x3571('0xa')](_0x2d28f5[_0x3571('0x9')])['then'](function(_0x358ba1){if(_0x358ba1){_0x2d28f5[_0x3571('0xb')]=_0x358ba1[_0x3571('0xb')];}utils[_0x3571('0xc')](_0x3571('0xd'),_0x2d28f5);});}else{utils['request']('CreateVoiceQueueReport',_0x2d28f5);}if(_0x2d28f5[_0x3571('0xe')]){delete queues[_0x2d28f5[_0x3571('0xe')]];}else{delete queues[_0x2d28f5[_0x3571('0x4')]];}}exports['queuecallerjoin']=function(_0x57573f){try{utils['debug'](util['format'](_0x3571('0xf'),_0x57573f[_0x3571('0x4')]),_0x57573f);utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x11'),_0x57573f[_0x3571('0x4')],_0x57573f[_0x3571('0x9')],_0x57573f[_0x3571('0x12')]));queues[_0x57573f[_0x3571('0x4')]]=_[_0x3571('0x13')](_0x57573f,{'originalposition':_0x57573f[_0x3571('0x12')],'queuecallerjoinAt':utils[_0x3571('0x14')](),'mohtime':0x0});}catch(_0x17cf63){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0xf'),_0x57573f['uniqueid']),_0x17cf63);}};exports['hangup']=function(_0x48c77e){try{if(!_[_0x3571('0x16')](queues[_0x48c77e['uniqueid']])){utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][hangup]',_0x48c77e[_0x3571('0x4')]),_0x48c77e);if(queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x18')]){if(!queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x19')]&&!queues[_0x48c77e[_0x3571('0x4')]]['queuecallerexit']){queues[_0x48c77e[_0x3571('0x4')]]['queuecallercomplete']=!![];queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x1a')]=utils['now']();queues[_0x48c77e['uniqueid']]['queuecallerexitreason']=_0x3571('0x1b');}utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x1c'),_0x48c77e[_0x3571('0x4')],queues[_0x48c77e['uniqueid']][_0x3571('0x1d')],queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x8')]));writeDB(queues[_0x48c77e[_0x3571('0x4')]]);}else if(queues[_0x48c77e[_0x3571('0x4')]]['transfereduniqueid']){utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x48c77e[_0x3571('0x4')],queues[_0x48c77e['uniqueid']][_0x3571('0x1d')],queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0xe')]));queues[queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0xe')]]=queues[_0x48c77e[_0x3571('0x4')]];queues[queues[_0x48c77e[_0x3571('0x4')]]['transfereduniqueid']][_0x3571('0x1e')]=0x2;delete queues[_0x48c77e[_0x3571('0x4')]];}}}catch(_0x7341f0){utils['error'](util['format']('[%s][queues][hangup]',_0x48c77e[_0x3571('0x4')]),_0x7341f0);}};exports['varset']=function(_0x288191){try{utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][varset]',_0x288191['uniqueid']),_0x288191);if(!_[_0x3571('0x16')](_0x288191[_0x3571('0x1f')]['queuestatus'])&&_0x288191[_0x3571('0x20')]['toUpperCase']()!==_0x3571('0x21')){if(!_[_0x3571('0x16')](queues[_0x288191[_0x3571('0x4')]])){queues[_0x288191[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x288191[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x288191['uniqueid']][_0x3571('0x23')]=!![];queues[_0x288191[_0x3571('0x4')]][_0x3571('0x24')]=utils[_0x3571('0x14')]();queues[_0x288191['uniqueid']][_0x3571('0x8')]=_0x288191['value'][_0x3571('0x25')]();utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x26'),_0x288191[_0x3571('0x4')],queues[_0x288191['uniqueid']]['name'],_0x288191['value'],queues[_0x288191['uniqueid']][_0x3571('0x8')]));writeDB(queues[_0x288191['uniqueid']]);}}else if(!_[_0x3571('0x16')](_0x288191[_0x3571('0x1f')][_0x3571('0x27')])){if(!_[_0x3571('0x16')](queues[_0x288191[_0x3571('0x4')]])&&!queues[_0x288191[_0x3571('0x4')]][_0x3571('0x19')]){queues[_0x288191['uniqueid']][_0x3571('0x19')]=![];queues[_0x288191[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x288191[_0x3571('0x4')]][_0x3571('0x23')]=!![];queues[_0x288191['uniqueid']][_0x3571('0x24')]=utils[_0x3571('0x14')]();queues[_0x288191[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x28');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x288191[_0x3571('0x4')],queues[_0x288191['uniqueid']][_0x3571('0x1d')],_0x288191[_0x3571('0x20')],queues[_0x288191[_0x3571('0x4')]][_0x3571('0x8')]));}}}catch(_0x22c207){utils[_0x3571('0x15')](util['format'](_0x3571('0x29'),_0x288191[_0x3571('0x4')]),_0x22c207);}};exports['queuecallerabandon']=function(_0x4a7d4e){try{if(!_[_0x3571('0x16')](queues[_0x4a7d4e[_0x3571('0x4')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')](_0x3571('0x2a'),_0x4a7d4e[_0x3571('0x4')]),_0x4a7d4e);queues[_0x4a7d4e['uniqueid']][_0x3571('0x23')]=![];queues[_0x4a7d4e[_0x3571('0x4')]][_0x3571('0x24')]=null;queues[_0x4a7d4e['uniqueid']][_0x3571('0x19')]=!![];queues[_0x4a7d4e['uniqueid']][_0x3571('0x22')]=utils['now']();queues[_0x4a7d4e[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x2b');utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x2c'),_0x4a7d4e[_0x3571('0x4')],queues[_0x4a7d4e[_0x3571('0x4')]]['name'],queues[_0x4a7d4e['uniqueid']][_0x3571('0x8')]));}}catch(_0x4091c2){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x2a'),_0x4a7d4e[_0x3571('0x4')]),_0x4091c2);}};exports[_0x3571('0x2d')]=function(_0x48813c){try{if(!_['isNil'](queues[_0x48813c[_0x3571('0x4')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')](_0x3571('0x2e'),_0x48813c[_0x3571('0x4')]),_0x48813c);utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x2f'),_0x48813c[_0x3571('0x4')],queues[_0x48813c[_0x3571('0x4')]]['name'],_0x48813c[_0x3571('0x30')],_0x48813c['connectedlinename']));queues[_0x48813c[_0x3571('0x4')]][_0x3571('0x2d')]=!![];queues[_0x48813c[_0x3571('0x4')]]['queuecallerleaveAt']=utils[_0x3571('0x14')]();queues[_0x48813c[_0x3571('0x4')]][_0x3571('0x31')]=utils[_0x3571('0x32')](queues[_0x48813c[_0x3571('0x4')]][_0x3571('0x18')],queues[_0x48813c[_0x3571('0x4')]]['queuecallerjoinAt']);queues[_0x48813c[_0x3571('0x4')]]['position']=_0x48813c[_0x3571('0x12')];queues[_0x48813c['uniqueid']][_0x3571('0x33')]=_0x48813c[_0x3571('0x33')];queues[_0x48813c['uniqueid']][_0x3571('0x30')]=_0x48813c[_0x3571('0x30')];queues[_0x48813c['uniqueid']]['connectedlinename']=_0x48813c[_0x3571('0x34')];}}catch(_0x311834){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x2e'),_0x48813c[_0x3571('0x4')]),_0x311834);}};exports['agentconnect']=function(_0x382d88){try{if(!_[_0x3571('0x16')](queues[_0x382d88[_0x3571('0x4')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][agentconnect]',_0x382d88[_0x3571('0x4')]),_0x382d88);utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x35'),_0x382d88[_0x3571('0x4')],queues[_0x382d88[_0x3571('0x4')]]['name'],_0x382d88[_0x3571('0x36')],_0x382d88[_0x3571('0x37')]));queues[_0x382d88[_0x3571('0x4')]]['queuecallerabandon']=![];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x382d88['uniqueid']]['queuecallerexit']=![];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x8')]=null;queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x24')]=null;queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x38')]=!![];queues[_0x382d88['uniqueid']]['accountcode']=_0x382d88[_0x3571('0x37')];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x39')]=_0x382d88[_0x3571('0x36')];}}catch(_0x3d6e18){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x3a'),_0x382d88[_0x3571('0x4')]),_0x3d6e18);}};exports['agentcomplete']=function(_0x1e35c8){try{if(!_[_0x3571('0x16')](queues[_0x1e35c8[_0x3571('0x4')]])){if(queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x18')]){utils[_0x3571('0x17')](util['format']('[%s][queues][agentcomplete]',_0x1e35c8['uniqueid']),_0x1e35c8);queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x23')]=![];queues[_0x1e35c8['uniqueid']][_0x3571('0x24')]=null;queues[_0x1e35c8['uniqueid']]['assigned']=!![];queues[_0x1e35c8[_0x3571('0x4')]]['lastAssignedTo']=_0x1e35c8['membername'];queues[_0x1e35c8[_0x3571('0x4')]]['queuecallercomplete']=!![];queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x1a')]=utils[_0x3571('0x14')]();if(_0x1e35c8[_0x3571('0x3b')]=='transfer'){if(!queues[_0x1e35c8[_0x3571('0x4')]]['transfer']){queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x3c');}}else{queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x3d')+_0x1e35c8[_0x3571('0x3b')][_0x3571('0x25')]();}utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1e35c8[_0x3571('0x4')],queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x1d')],_0x1e35c8[_0x3571('0x36')],queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x8')]));writeDB(queues[_0x1e35c8['uniqueid']]);}}}catch(_0x1a5b29){utils['error'](util[_0x3571('0x2')](_0x3571('0x3e'),_0x1e35c8[_0x3571('0x4')]),_0x1a5b29);}};exports[_0x3571('0x3f')]=function(_0x1c817a){try{if(!_['isNil'](queues[_0x1c817a[_0x3571('0x40')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][blindtransfer]',_0x1c817a[_0x3571('0x4')]),_0x1c817a);queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x41')]=!![];queues[_0x1c817a[_0x3571('0x40')]]['transfertype']=_0x3571('0x42');queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x43')]=_0x1c817a[_0x3571('0x44')];queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x45')]=_0x1c817a[_0x3571('0x40')];queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x8')]=_0x3571('0x46');utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x47'),_0x1c817a[_0x3571('0x4')],queues[_0x1c817a[_0x3571('0x40')]]['name'],_0x1c817a[_0x3571('0x40')],_0x1c817a['extension']));}}catch(_0x1b6021){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x48'),_0x1c817a[_0x3571('0x4')]),_0x1b6021);}};exports[_0x3571('0x49')]=function(_0x5429ac){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x5429ac['origtransfereruniqueid']),_0x5429ac);if(_0x5429ac[_0x3571('0x4a')]==_0x5429ac['origtransfererlinkedid']){if(!_['isNil'](queues[_0x5429ac[_0x3571('0x4b')]])){utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x4c'),_0x5429ac['origtransfereruniqueid'],queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x1d')],_0x5429ac['origtransfererexten']));queues[_0x5429ac['secondtransfererlinkedid']][_0x3571('0x41')]=!![];queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x4d')]=_0x3571('0x4e');queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x43')]=_0x5429ac['origtransfererexten'];queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x45')]=_0x5429ac['origtransfereruniqueid'];queues[_0x5429ac['secondtransfererlinkedid']]['queuecallerexitreason']=_0x3571('0x4f');}if(!_[_0x3571('0x16')](queues[_0x5429ac[_0x3571('0x50')]])){if(_0x5429ac[_0x3571('0x51')]&&queues[_0x5429ac['transfereelinkedid']]){queues[_0x5429ac[_0x3571('0x51')]]['queuecallerenterreason']=0x1;queues[_0x5429ac['transfereeuniqueid']]=_[_0x3571('0x52')](queues[_0x5429ac['transfereelinkedid']]);queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0xe')]=_0x5429ac[_0x3571('0x53')];queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x1e')]=0x2;queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x6')]=queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x6')];queues[_0x5429ac['transfereeuniqueid']]['calleridname']=queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x54')];queues[_0x5429ac['transfereeuniqueid']][_0x3571('0x55')]=utils[_0x3571('0x14')]();queues[_0x5429ac['transfereeuniqueid']][_0x3571('0x18')]=utils['now']();queues[_0x5429ac['transfereeuniqueid']]['holdtime']=0x0;queues[_0x5429ac['transfereeuniqueid']][_0x3571('0x56')]=0x0;utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x57'),_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x1d')],queues[_0x5429ac[_0x3571('0x40')]]['calleridnum'],queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x54')]));}else{utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x1d')],_0x5429ac[_0x3571('0x4b')]));queues[_0x5429ac['origtransfererlinkedid']][_0x3571('0xe')]=_0x5429ac[_0x3571('0x4b')];}}}else if(_0x5429ac[_0x3571('0x58')]==_0x5429ac[_0x3571('0x4b')]){if(!_[_0x3571('0x16')](queues[_0x5429ac['origtransfererlinkedid']])){utils[_0x3571('0x10')](util['format'](_0x3571('0x59'),_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x1d')],_0x5429ac['secondtransfereruniqueid'],_0x5429ac[_0x3571('0x5a')]));queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x41')]=!![];queues[_0x5429ac['origtransfererlinkedid']][_0x3571('0x4d')]='ATTENDED';queues[_0x5429ac[_0x3571('0x50')]]['transferexten']=_0x5429ac[_0x3571('0x5a')];queues[_0x5429ac[_0x3571('0x50')]]['transferuniqueid']=_0x5429ac['secondtransfereruniqueid'];queues[_0x5429ac['origtransfererlinkedid']][_0x3571('0x8')]=_0x3571('0x4f');}if(!_['isNil'](queues[_0x5429ac[_0x3571('0x4b')]])){if(_0x5429ac[_0x3571('0x5b')]&&queues[_0x5429ac[_0x3571('0x5b')]]){queues[_0x5429ac[_0x3571('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x5429ac[_0x3571('0x53')]]=_['clone'](queues[_0x5429ac[_0x3571('0x5b')]]);queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0xe')]=_0x5429ac[_0x3571('0x53')];queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x1e')]=0x2;queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x6')]=queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x6')];queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x54')]=queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x54')];queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x55')]=utils[_0x3571('0x14')]();queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x18')]=utils[_0x3571('0x14')]();queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x31')]=0x0;queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x56')]=0x0;utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac['transfertargetuniqueid']][_0x3571('0x1d')],queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0xe')],queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x6')],queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x54')]));}else{utils[_0x3571('0x10')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x4b')]]['name'],_0x5429ac[_0x3571('0x50')]));queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0xe')]=_0x5429ac[_0x3571('0x50')];}}}}catch(_0x39b950){utils['error'](util['format'](_0x3571('0x5c'),_0x5429ac[_0x3571('0x4a')]),_0x39b950);}};exports[_0x3571('0x5d')]=function(_0x4496a7){try{if(!_[_0x3571('0x16')](queues[_0x4496a7['uniqueid']])){utils[_0x3571('0x17')](util['format'](_0x3571('0x5e'),_0x4496a7[_0x3571('0x4')]),_0x4496a7);queues[_0x4496a7['uniqueid']][_0x3571('0x5f')]=utils[_0x3571('0x14')]();utils['info'](util[_0x3571('0x2')](_0x3571('0x60'),_0x4496a7[_0x3571('0x4')],queues[_0x4496a7['uniqueid']][_0x3571('0x1d')],queues[_0x4496a7['uniqueid']][_0x3571('0x5f')]));}}catch(_0x3ac00f){utils['error'](util['format'](_0x3571('0x5e'),_0x4496a7['uniqueid']),_0x3ac00f);}};exports[_0x3571('0x61')]=function(_0x4e4cab){try{if(!_['isNil'](queues[_0x4e4cab[_0x3571('0x4')]])){if(!_[_0x3571('0x16')](queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x5f')])){utils[_0x3571('0x17')](util['format'](_0x3571('0x62'),_0x4e4cab[_0x3571('0x4')]),_0x4e4cab);queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x56')]+=utils[_0x3571('0x32')](utils[_0x3571('0x14')](),queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x5f')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4e4cab['uniqueid'],queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x1d')],queues[_0x4e4cab['uniqueid']][_0x3571('0x56')]));delete queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x5f')];}}}catch(_0x580f66){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x62'),_0x4e4cab[_0x3571('0x4')]),_0x580f66);}}; \ No newline at end of file +var _0x8cda=['EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleaveAt','holdtime','diffTime','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','debug','[%s][queues][varset]','variable','CONTINUE','queuecallerexitAt','now','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var utils=require(_0xa8cd('0x1'));var queues={};function writeDB(_0x43ea86){utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x4'),_0x43ea86['uniqueid'],_0x43ea86[_0xa8cd('0x5')],_0x43ea86[_0xa8cd('0x6')],_0x43ea86[_0xa8cd('0x7')],_0x43ea86['calleridnum'],_0x43ea86[_0xa8cd('0x8')],_0x43ea86[_0xa8cd('0x9')]));if(_0x43ea86[_0xa8cd('0x6')]){utils[_0xa8cd('0xa')](_0x43ea86[_0xa8cd('0x6')])[_0xa8cd('0xb')](function(_0x13f394){if(_0x13f394){_0x43ea86[_0xa8cd('0xc')]=_0x13f394['type'];}utils['request']('CreateVoiceQueueReport',_0x43ea86);});}else{utils[_0xa8cd('0xd')]('CreateVoiceQueueReport',_0x43ea86);}if(_0x43ea86[_0xa8cd('0xe')]){delete queues[_0x43ea86[_0xa8cd('0xe')]];}else{delete queues[_0x43ea86['uniqueid']];}}exports[_0xa8cd('0xf')]=function(_0x2221c1){try{utils['debug'](util['format'](_0xa8cd('0x10'),_0x2221c1[_0xa8cd('0x11')]),_0x2221c1);utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x12'),_0x2221c1['uniqueid'],_0x2221c1[_0xa8cd('0x6')],_0x2221c1['position']));queues[_0x2221c1[_0xa8cd('0x11')]]=_['assign'](_0x2221c1,{'originalposition':_0x2221c1[_0xa8cd('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x1970c1){utils[_0xa8cd('0x14')](util[_0xa8cd('0x3')]('[%s][queues][queuecallerjoin]',_0x2221c1['uniqueid']),_0x1970c1);}};exports[_0xa8cd('0x15')]=function(_0x6d5f40){try{if(!_[_0xa8cd('0x16')](queues[_0x6d5f40[_0xa8cd('0x11')]])){utils['debug'](util[_0xa8cd('0x3')]('[%s][queues][hangup]',_0x6d5f40[_0xa8cd('0x11')]),_0x6d5f40);if(queues[_0x6d5f40[_0xa8cd('0x11')]]['queuecallerleaveAt']){if(!queues[_0x6d5f40[_0xa8cd('0x11')]][_0xa8cd('0x17')]&&!queues[_0x6d5f40['uniqueid']][_0xa8cd('0x18')]){queues[_0x6d5f40[_0xa8cd('0x11')]][_0xa8cd('0x19')]=!![];queues[_0x6d5f40[_0xa8cd('0x11')]][_0xa8cd('0x1a')]=utils['now']();queues[_0x6d5f40[_0xa8cd('0x11')]][_0xa8cd('0x9')]=_0xa8cd('0x1b');}utils[_0xa8cd('0x2')](util['format'](_0xa8cd('0x1c'),_0x6d5f40['uniqueid'],queues[_0x6d5f40['uniqueid']][_0xa8cd('0x1d')],queues[_0x6d5f40[_0xa8cd('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x6d5f40[_0xa8cd('0x11')]]);}else if(queues[_0x6d5f40[_0xa8cd('0x11')]][_0xa8cd('0xe')]){utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x1e'),_0x6d5f40[_0xa8cd('0x11')],queues[_0x6d5f40['uniqueid']][_0xa8cd('0x1d')],queues[_0x6d5f40[_0xa8cd('0x11')]][_0xa8cd('0xe')]));queues[queues[_0x6d5f40[_0xa8cd('0x11')]][_0xa8cd('0xe')]]=queues[_0x6d5f40[_0xa8cd('0x11')]];queues[queues[_0x6d5f40['uniqueid']][_0xa8cd('0xe')]][_0xa8cd('0x1f')]=0x2;delete queues[_0x6d5f40[_0xa8cd('0x11')]];}}}catch(_0x16997c){utils[_0xa8cd('0x14')](util[_0xa8cd('0x3')](_0xa8cd('0x20'),_0x6d5f40[_0xa8cd('0x11')]),_0x16997c);}};exports[_0xa8cd('0x21')]=function(_0x22cf82){try{utils[_0xa8cd('0x22')](util[_0xa8cd('0x3')](_0xa8cd('0x23'),_0x22cf82[_0xa8cd('0x11')]),_0x22cf82);if(!_[_0xa8cd('0x16')](_0x22cf82[_0xa8cd('0x24')]['queuestatus'])&&_0x22cf82['value']['toUpperCase']()!==_0xa8cd('0x25')){if(!_[_0xa8cd('0x16')](queues[_0x22cf82[_0xa8cd('0x11')]])){queues[_0x22cf82[_0xa8cd('0x11')]][_0xa8cd('0x17')]=![];queues[_0x22cf82[_0xa8cd('0x11')]]['queuecallerabandonAt']=null;queues[_0x22cf82['uniqueid']]['queuecallerexit']=!![];queues[_0x22cf82[_0xa8cd('0x11')]][_0xa8cd('0x26')]=utils[_0xa8cd('0x27')]();queues[_0x22cf82[_0xa8cd('0x11')]][_0xa8cd('0x9')]=_0x22cf82[_0xa8cd('0x28')][_0xa8cd('0x29')]();utils['info'](util[_0xa8cd('0x3')](_0xa8cd('0x2a'),_0x22cf82['uniqueid'],queues[_0x22cf82[_0xa8cd('0x11')]][_0xa8cd('0x1d')],_0x22cf82[_0xa8cd('0x28')],queues[_0x22cf82[_0xa8cd('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x22cf82[_0xa8cd('0x11')]]);}}else if(!_[_0xa8cd('0x16')](_0x22cf82['variable'][_0xa8cd('0x2b')])){if(!_[_0xa8cd('0x16')](queues[_0x22cf82[_0xa8cd('0x11')]])&&!queues[_0x22cf82[_0xa8cd('0x11')]]['queuecallerabandon']){queues[_0x22cf82['uniqueid']][_0xa8cd('0x17')]=![];queues[_0x22cf82['uniqueid']][_0xa8cd('0x2c')]=null;queues[_0x22cf82['uniqueid']][_0xa8cd('0x18')]=!![];queues[_0x22cf82[_0xa8cd('0x11')]]['queuecallerexitAt']=utils[_0xa8cd('0x27')]();queues[_0x22cf82[_0xa8cd('0x11')]][_0xa8cd('0x9')]=_0xa8cd('0x2d');utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x2e'),_0x22cf82['uniqueid'],queues[_0x22cf82[_0xa8cd('0x11')]][_0xa8cd('0x1d')],_0x22cf82['value'],queues[_0x22cf82['uniqueid']][_0xa8cd('0x9')]));}}}catch(_0x3da42e){utils[_0xa8cd('0x14')](util[_0xa8cd('0x3')](_0xa8cd('0x23'),_0x22cf82[_0xa8cd('0x11')]),_0x3da42e);}};exports[_0xa8cd('0x17')]=function(_0x43d105){try{if(!_['isNil'](queues[_0x43d105[_0xa8cd('0x11')]])){utils['debug'](util[_0xa8cd('0x3')]('[%s][queues][queuecallerabandon]',_0x43d105[_0xa8cd('0x11')]),_0x43d105);queues[_0x43d105[_0xa8cd('0x11')]][_0xa8cd('0x18')]=![];queues[_0x43d105[_0xa8cd('0x11')]]['queuecallerexitAt']=null;queues[_0x43d105['uniqueid']]['queuecallerabandon']=!![];queues[_0x43d105['uniqueid']][_0xa8cd('0x2c')]=utils[_0xa8cd('0x27')]();queues[_0x43d105['uniqueid']][_0xa8cd('0x9')]=_0xa8cd('0x2f');utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x30'),_0x43d105[_0xa8cd('0x11')],queues[_0x43d105['uniqueid']]['name'],queues[_0x43d105[_0xa8cd('0x11')]][_0xa8cd('0x9')]));}}catch(_0xdedfad){utils[_0xa8cd('0x14')](util['format'](_0xa8cd('0x31'),_0x43d105[_0xa8cd('0x11')]),_0xdedfad);}};exports[_0xa8cd('0x32')]=function(_0x28cda4){try{if(!_['isNil'](queues[_0x28cda4['uniqueid']])){utils['debug'](util[_0xa8cd('0x3')](_0xa8cd('0x33'),_0x28cda4['uniqueid']),_0x28cda4);utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x34'),_0x28cda4[_0xa8cd('0x11')],queues[_0x28cda4[_0xa8cd('0x11')]][_0xa8cd('0x1d')],_0x28cda4['connectedlinenum'],_0x28cda4['connectedlinename']));queues[_0x28cda4['uniqueid']][_0xa8cd('0x32')]=!![];queues[_0x28cda4[_0xa8cd('0x11')]][_0xa8cd('0x35')]=utils[_0xa8cd('0x27')]();queues[_0x28cda4[_0xa8cd('0x11')]][_0xa8cd('0x36')]=utils[_0xa8cd('0x37')](queues[_0x28cda4[_0xa8cd('0x11')]][_0xa8cd('0x35')],queues[_0x28cda4['uniqueid']]['queuecallerjoinAt']);queues[_0x28cda4[_0xa8cd('0x11')]]['position']=_0x28cda4[_0xa8cd('0x13')];queues[_0x28cda4[_0xa8cd('0x11')]][_0xa8cd('0x38')]=_0x28cda4[_0xa8cd('0x38')];queues[_0x28cda4[_0xa8cd('0x11')]]['connectedlinenum']=_0x28cda4[_0xa8cd('0x39')];queues[_0x28cda4['uniqueid']][_0xa8cd('0x3a')]=_0x28cda4[_0xa8cd('0x3a')];}}catch(_0x2114f2){utils[_0xa8cd('0x14')](util[_0xa8cd('0x3')](_0xa8cd('0x33'),_0x28cda4[_0xa8cd('0x11')]),_0x2114f2);}};exports[_0xa8cd('0x3b')]=function(_0x101d4d){try{if(!_[_0xa8cd('0x16')](queues[_0x101d4d[_0xa8cd('0x11')]])){utils[_0xa8cd('0x22')](util[_0xa8cd('0x3')](_0xa8cd('0x3c'),_0x101d4d[_0xa8cd('0x11')]),_0x101d4d);utils['info'](util['format'](_0xa8cd('0x3d'),_0x101d4d[_0xa8cd('0x11')],queues[_0x101d4d['uniqueid']][_0xa8cd('0x1d')],_0x101d4d[_0xa8cd('0x3e')],_0x101d4d['destaccountcode']));queues[_0x101d4d[_0xa8cd('0x11')]][_0xa8cd('0x17')]=![];queues[_0x101d4d[_0xa8cd('0x11')]]['queuecallerabandon']=![];queues[_0x101d4d[_0xa8cd('0x11')]][_0xa8cd('0x2c')]=null;queues[_0x101d4d[_0xa8cd('0x11')]][_0xa8cd('0x18')]=![];queues[_0x101d4d[_0xa8cd('0x11')]][_0xa8cd('0x9')]=null;queues[_0x101d4d['uniqueid']][_0xa8cd('0x26')]=null;queues[_0x101d4d[_0xa8cd('0x11')]][_0xa8cd('0x3f')]=!![];queues[_0x101d4d[_0xa8cd('0x11')]][_0xa8cd('0x8')]=_0x101d4d['destaccountcode'];queues[_0x101d4d[_0xa8cd('0x11')]]['lastAssignedTo']=_0x101d4d[_0xa8cd('0x3e')];}}catch(_0x3c6fbc){utils['error'](util[_0xa8cd('0x3')](_0xa8cd('0x3c'),_0x101d4d[_0xa8cd('0x11')]),_0x3c6fbc);}};exports[_0xa8cd('0x40')]=function(_0x4c7334){try{if(!_[_0xa8cd('0x16')](queues[_0x4c7334[_0xa8cd('0x11')]])){if(queues[_0x4c7334[_0xa8cd('0x11')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0xa8cd('0x41'),_0x4c7334[_0xa8cd('0x11')]),_0x4c7334);queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x17')]=![];queues[_0x4c7334[_0xa8cd('0x11')]]['queuecallerabandon']=![];queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x2c')]=null;queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x18')]=![];queues[_0x4c7334[_0xa8cd('0x11')]]['queuecallerexitAt']=null;queues[_0x4c7334['uniqueid']]['assigned']=!![];queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x7')]=_0x4c7334[_0xa8cd('0x3e')];queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x19')]=!![];queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x1a')]=utils[_0xa8cd('0x27')]();if(_0x4c7334['reason']==_0xa8cd('0x42')){if(!queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x42')]){queues[_0x4c7334[_0xa8cd('0x11')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x4c7334['uniqueid']][_0xa8cd('0x9')]='COMPLETEDBY'+_0x4c7334[_0xa8cd('0x43')][_0xa8cd('0x29')]();}utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x44'),_0x4c7334[_0xa8cd('0x11')],queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x1d')],_0x4c7334['membername'],queues[_0x4c7334[_0xa8cd('0x11')]][_0xa8cd('0x9')]));writeDB(queues[_0x4c7334[_0xa8cd('0x11')]]);}}}catch(_0x185d80){utils['error'](util['format'](_0xa8cd('0x41'),_0x4c7334['uniqueid']),_0x185d80);}};exports[_0xa8cd('0x45')]=function(_0x1e0b1d){try{if(!_[_0xa8cd('0x16')](queues[_0x1e0b1d[_0xa8cd('0x46')]])){utils[_0xa8cd('0x22')](util['format'](_0xa8cd('0x47'),_0x1e0b1d[_0xa8cd('0x11')]),_0x1e0b1d);queues[_0x1e0b1d[_0xa8cd('0x46')]][_0xa8cd('0x42')]=!![];queues[_0x1e0b1d[_0xa8cd('0x46')]][_0xa8cd('0x48')]=_0xa8cd('0x49');queues[_0x1e0b1d['transfereeuniqueid']]['transferexten']=_0x1e0b1d[_0xa8cd('0x4a')];queues[_0x1e0b1d[_0xa8cd('0x46')]][_0xa8cd('0x4b')]=_0x1e0b1d[_0xa8cd('0x46')];queues[_0x1e0b1d[_0xa8cd('0x46')]]['queuecallerexitreason']=_0xa8cd('0x4c');utils['info'](util['format'](_0xa8cd('0x4d'),_0x1e0b1d['uniqueid'],queues[_0x1e0b1d[_0xa8cd('0x46')]][_0xa8cd('0x1d')],_0x1e0b1d[_0xa8cd('0x46')],_0x1e0b1d[_0xa8cd('0x4a')]));}}catch(_0x40f204){utils['error'](util[_0xa8cd('0x3')]('[%s][queues][blindtransfer]',_0x1e0b1d['uniqueid']),_0x40f204);}};exports[_0xa8cd('0x4e')]=function(_0x20ff08){try{utils[_0xa8cd('0x22')](util[_0xa8cd('0x3')]('[%s][queues][attendedtransfer]',_0x20ff08[_0xa8cd('0x4f')]),_0x20ff08);if(_0x20ff08['origtransfereruniqueid']==_0x20ff08[_0xa8cd('0x50')]){if(!_[_0xa8cd('0x16')](queues[_0x20ff08['secondtransfererlinkedid']])){utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x51'),_0x20ff08[_0xa8cd('0x4f')],queues[_0x20ff08[_0xa8cd('0x52')]][_0xa8cd('0x1d')],_0x20ff08[_0xa8cd('0x53')]));queues[_0x20ff08[_0xa8cd('0x52')]]['transfer']=!![];queues[_0x20ff08[_0xa8cd('0x52')]]['transfertype']=_0xa8cd('0x54');queues[_0x20ff08['secondtransfererlinkedid']][_0xa8cd('0x55')]=_0x20ff08[_0xa8cd('0x53')];queues[_0x20ff08[_0xa8cd('0x52')]]['transferuniqueid']=_0x20ff08[_0xa8cd('0x4f')];queues[_0x20ff08['secondtransfererlinkedid']][_0xa8cd('0x9')]=_0xa8cd('0x56');}if(!_[_0xa8cd('0x16')](queues[_0x20ff08[_0xa8cd('0x50')]])){if(_0x20ff08['transfereelinkedid']&&queues[_0x20ff08['transfereelinkedid']]){queues[_0x20ff08['transfereelinkedid']][_0xa8cd('0x1f')]=0x1;queues[_0x20ff08['transfereeuniqueid']]=_['clone'](queues[_0x20ff08[_0xa8cd('0x57')]]);queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0xe')]=_0x20ff08[_0xa8cd('0x58')];queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x1f')]=0x2;queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x59')]=queues[_0x20ff08[_0xa8cd('0x52')]]['calleridnum'];queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x5a')]=queues[_0x20ff08['secondtransfererlinkedid']][_0xa8cd('0x5a')];queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x5b')]=utils[_0xa8cd('0x27')]();queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x35')]=utils[_0xa8cd('0x27')]();queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x36')]=0x0;queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x5c')]=0x0;utils['info'](util[_0xa8cd('0x3')](_0xa8cd('0x5d'),_0x20ff08[_0xa8cd('0x4f')],queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x1d')],queues[_0x20ff08[_0xa8cd('0x46')]][_0xa8cd('0x59')],queues[_0x20ff08['transfereeuniqueid']]['calleridname']));}else{utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')](_0xa8cd('0x5e'),_0x20ff08[_0xa8cd('0x4f')],queues[_0x20ff08['origtransfererlinkedid']][_0xa8cd('0x1d')],_0x20ff08[_0xa8cd('0x52')]));queues[_0x20ff08['origtransfererlinkedid']][_0xa8cd('0xe')]=_0x20ff08[_0xa8cd('0x52')];}}}else if(_0x20ff08[_0xa8cd('0x5f')]==_0x20ff08[_0xa8cd('0x52')]){if(!_[_0xa8cd('0x16')](queues[_0x20ff08[_0xa8cd('0x50')]])){utils['info'](util[_0xa8cd('0x3')](_0xa8cd('0x60'),_0x20ff08[_0xa8cd('0x4f')],queues[_0x20ff08[_0xa8cd('0x50')]][_0xa8cd('0x1d')],_0x20ff08[_0xa8cd('0x5f')],_0x20ff08[_0xa8cd('0x61')]));queues[_0x20ff08[_0xa8cd('0x50')]][_0xa8cd('0x42')]=!![];queues[_0x20ff08[_0xa8cd('0x50')]][_0xa8cd('0x48')]='ATTENDED';queues[_0x20ff08[_0xa8cd('0x50')]][_0xa8cd('0x55')]=_0x20ff08[_0xa8cd('0x61')];queues[_0x20ff08[_0xa8cd('0x50')]][_0xa8cd('0x4b')]=_0x20ff08[_0xa8cd('0x5f')];queues[_0x20ff08['origtransfererlinkedid']][_0xa8cd('0x9')]=_0xa8cd('0x56');}if(!_[_0xa8cd('0x16')](queues[_0x20ff08[_0xa8cd('0x52')]])){if(_0x20ff08[_0xa8cd('0x62')]&&queues[_0x20ff08['transfertargetlinkedid']]){queues[_0x20ff08[_0xa8cd('0x62')]][_0xa8cd('0x1f')]=0x1;queues[_0x20ff08[_0xa8cd('0x58')]]=_['clone'](queues[_0x20ff08[_0xa8cd('0x62')]]);queues[_0x20ff08[_0xa8cd('0x58')]]['transfereduniqueid']=_0x20ff08['transfertargetuniqueid'];queues[_0x20ff08[_0xa8cd('0x58')]][_0xa8cd('0x1f')]=0x2;queues[_0x20ff08[_0xa8cd('0x58')]]['calleridnum']=queues[_0x20ff08[_0xa8cd('0x50')]][_0xa8cd('0x59')];queues[_0x20ff08[_0xa8cd('0x58')]]['calleridname']=queues[_0x20ff08[_0xa8cd('0x50')]][_0xa8cd('0x5a')];queues[_0x20ff08[_0xa8cd('0x58')]][_0xa8cd('0x5b')]=utils[_0xa8cd('0x27')]();queues[_0x20ff08[_0xa8cd('0x58')]][_0xa8cd('0x35')]=utils[_0xa8cd('0x27')]();queues[_0x20ff08[_0xa8cd('0x58')]]['holdtime']=0x0;queues[_0x20ff08['transfertargetuniqueid']][_0xa8cd('0x5c')]=0x0;utils[_0xa8cd('0x2')](util[_0xa8cd('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x20ff08[_0xa8cd('0x4f')],queues[_0x20ff08[_0xa8cd('0x58')]][_0xa8cd('0x1d')],queues[_0x20ff08[_0xa8cd('0x58')]][_0xa8cd('0xe')],queues[_0x20ff08[_0xa8cd('0x58')]][_0xa8cd('0x59')],queues[_0x20ff08[_0xa8cd('0x58')]][_0xa8cd('0x5a')]));}else{utils['info'](util[_0xa8cd('0x3')](_0xa8cd('0x5e'),_0x20ff08[_0xa8cd('0x4f')],queues[_0x20ff08[_0xa8cd('0x52')]]['name'],_0x20ff08[_0xa8cd('0x50')]));queues[_0x20ff08['secondtransfererlinkedid']][_0xa8cd('0xe')]=_0x20ff08[_0xa8cd('0x50')];}}}}catch(_0x5c9942){utils[_0xa8cd('0x14')](util[_0xa8cd('0x3')]('[%s][queues][attendedtransfer]',_0x20ff08[_0xa8cd('0x4f')]),_0x5c9942);}};exports['musiconholdstart']=function(_0x3ef5fc){try{if(!_[_0xa8cd('0x16')](queues[_0x3ef5fc[_0xa8cd('0x11')]])){utils[_0xa8cd('0x22')](util[_0xa8cd('0x3')](_0xa8cd('0x63'),_0x3ef5fc[_0xa8cd('0x11')]),_0x3ef5fc);queues[_0x3ef5fc[_0xa8cd('0x11')]]['musiconholdstartAt']=utils[_0xa8cd('0x27')]();utils[_0xa8cd('0x2')](util['format'](_0xa8cd('0x64'),_0x3ef5fc[_0xa8cd('0x11')],queues[_0x3ef5fc[_0xa8cd('0x11')]][_0xa8cd('0x1d')],queues[_0x3ef5fc['uniqueid']][_0xa8cd('0x65')]));}}catch(_0x3ac1e7){utils[_0xa8cd('0x14')](util[_0xa8cd('0x3')](_0xa8cd('0x63'),_0x3ef5fc[_0xa8cd('0x11')]),_0x3ac1e7);}};exports['musiconholdstop']=function(_0x2fff05){try{if(!_['isNil'](queues[_0x2fff05[_0xa8cd('0x11')]])){if(!_['isNil'](queues[_0x2fff05['uniqueid']][_0xa8cd('0x65')])){utils[_0xa8cd('0x22')](util[_0xa8cd('0x3')](_0xa8cd('0x66'),_0x2fff05[_0xa8cd('0x11')]),_0x2fff05);queues[_0x2fff05[_0xa8cd('0x11')]][_0xa8cd('0x5c')]+=utils['diffTime'](utils[_0xa8cd('0x27')](),queues[_0x2fff05[_0xa8cd('0x11')]][_0xa8cd('0x65')]);utils[_0xa8cd('0x2')](util['format'](_0xa8cd('0x67'),_0x2fff05['uniqueid'],queues[_0x2fff05['uniqueid']][_0xa8cd('0x1d')],queues[_0x2fff05[_0xa8cd('0x11')]]['mohtime']));delete queues[_0x2fff05[_0xa8cd('0x11')]][_0xa8cd('0x65')];}}}catch(_0x10dc4e){utils[_0xa8cd('0x14')](util['format'](_0xa8cd('0x66'),_0x2fff05['uniqueid']),_0x10dc4e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6b137e2..be15e36 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 _0x9ddd=['util','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','application','appdata','set','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash'];(function(_0x2445f4,_0x5bc366){var _0x3e5674=function(_0x411653){while(--_0x411653){_0x2445f4['push'](_0x2445f4['shift']());}};_0x3e5674(++_0x5bc366);}(_0x9ddd,0xbc));var _0xd9dd=function(_0x5e9792,_0xf4b6b){_0x5e9792=_0x5e9792-0x0;var _0x1134dc=_0x9ddd[_0x5e9792];return _0x1134dc;};'use strict';var _=require(_0xd9dd('0x0'));var util=require(_0xd9dd('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x1cf37d){utils[_0xd9dd('0x2')](util['format'](_0xd9dd('0x3'),_0x1cf37d['uniqueid']));if(_0x1cf37d[_0xd9dd('0x4')]){utils[_0xd9dd('0x5')](_0x1cf37d[_0xd9dd('0x4')])[_0xd9dd('0x6')](function(_0x18dc2b){if(_0x18dc2b){_0x1cf37d[_0xd9dd('0x7')]=_0x18dc2b[_0xd9dd('0x8')];_0x1cf37d[_0xd9dd('0x9')]=_0x18dc2b['id'];}utils['request'](_0xd9dd('0xa'),_0x1cf37d);});}else{utils[_0xd9dd('0xb')](_0xd9dd('0xa'),_0x1cf37d);}}exports[_0xd9dd('0xc')]=function(_0x412b94){try{utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0xf'),_0x412b94[_0xd9dd('0x10')]),_0x412b94);if(_0x412b94[_0xd9dd('0x10')]==_0x412b94['linkedid']){utils['info'](util['format'](_0xd9dd('0x11'),_0x412b94[_0xd9dd('0x10')],_0x412b94[_0xd9dd('0x12')],_0x412b94[_0xd9dd('0x13')]));recordings[_0x412b94[_0xd9dd('0x10')]]={'uniqueid':_0x412b94[_0xd9dd('0x10')],'accountcode':_0x412b94['accountcode'],'exten':_0x412b94[_0xd9dd('0x13')],'context':_0x412b94[_0xd9dd('0x12')],'channel':_0x412b94[_0xd9dd('0x14')],'monitors':[]};}}catch(_0x4d8a5e){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')]('[%s][recordings][newchannel]',_0x412b94['uniqueid']),_0x4d8a5e);}};exports[_0xd9dd('0x16')]=function(_0x141190){try{utils['debug'](util[_0xd9dd('0xe')](_0xd9dd('0x17'),_0x141190['uniqueid']),_0x141190);if(!_[_0xd9dd('0x18')](recordings[_0x141190[_0xd9dd('0x10')]])&&_0x141190[_0xd9dd('0x19')]==0x6){utils[_0xd9dd('0x2')](util['format'](_0xd9dd('0x1a'),_0x141190[_0xd9dd('0x10')],_0x141190[_0xd9dd('0x12')],_0x141190[_0xd9dd('0x14')]));}else if(!_['isNil'](recordings[_0x141190[_0xd9dd('0x1b')]])&&_0x141190['channelstate']==0x6&&_0x141190[_0xd9dd('0x12')]!=_0xd9dd('0x1c')){utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x1d'),_0x141190['uniqueid'],_0x141190[_0xd9dd('0x1b')],_0x141190[_0xd9dd('0x12')],_0x141190['channel']));recordings[_0x141190[_0xd9dd('0x1b')]]['accountcode']=_0x141190[_0xd9dd('0x4')];}}catch(_0x5f5091){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')]('[%s][recordings][newstate]',_0x141190[_0xd9dd('0x10')]),_0x5f5091);}};exports[_0xd9dd('0x1e')]=function(_0x5a2938){try{if(!_['isNil'](_0x5a2938[_0xd9dd('0x1f')])&&!_['isNil'](_0x5a2938[_0xd9dd('0x1f')][_0xd9dd('0x20')])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0x21'),_0x5a2938[_0xd9dd('0x10')]),_0x5a2938);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x22'),_0x5a2938[_0xd9dd('0x10')],_0x5a2938[_0xd9dd('0x1f')],_0x5a2938[_0xd9dd('0x23')]));if(_[_0xd9dd('0x24')](_0x5a2938[_0xd9dd('0x23')],_0xd9dd('0x25'))){_0x5a2938['value']=_0x5a2938[_0xd9dd('0x23')]['replace'](_0xd9dd('0x25'),_0xd9dd('0x26'));}if(recordings[_0x5a2938[_0xd9dd('0x1b')]]){var _0x3ed9c1=_[_0xd9dd('0x27')](recordings[_0x5a2938['linkedid']][_0xd9dd('0x28')],{'value':_0x5a2938[_0xd9dd('0x23')]});if(_[_0xd9dd('0x18')](_0x3ed9c1)){recordings[_0x5a2938[_0xd9dd('0x1b')]][_0xd9dd('0x28')][_0xd9dd('0x29')]({'value':_0x5a2938['value']});}}}}catch(_0x4aa64e){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')](_0xd9dd('0x21'),_0x5a2938['uniqueid']),_0x4aa64e);}};exports[_0xd9dd('0x2a')]=function(_0x530bbd){try{if(!_[_0xd9dd('0x18')](recordings[_0x530bbd['uniqueid']])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0x2b'),_0x530bbd[_0xd9dd('0x10')]),_0x530bbd);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x2c'),_0x530bbd['uniqueid'],_0x530bbd['calleridnum'],_0x530bbd[_0xd9dd('0x2d')],_0x530bbd['cause-txt']));recordings[_0x530bbd['uniqueid']][_0xd9dd('0x2e')]=_0x530bbd['calleridnum'];recordings[_0x530bbd['uniqueid']][_0xd9dd('0x2d')]=_0x530bbd[_0xd9dd('0x2d')];recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x2f')]=_0x530bbd[_0xd9dd('0x2f')];recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x30')]=_0x530bbd[_0xd9dd('0x30')];if(recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x31')]==_0xd9dd('0x32')&&recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x4')]){recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x2f')]=recordings[_0x530bbd[_0xd9dd('0x10')]]['accountcode'];recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x30')]='';}recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x28')][_0xd9dd('0x33')](function(_0x11157b){var _0x1bdd03=_[_0xd9dd('0x34')](recordings[_0x530bbd[_0xd9dd('0x10')]]);_0x1bdd03[_0xd9dd('0x23')]=_0x11157b[_0xd9dd('0x23')];writeDB(_0x1bdd03);});delete recordings[_0x530bbd[_0xd9dd('0x10')]];}}catch(_0x2828bb){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')](_0xd9dd('0x2b'),_0x530bbd[_0xd9dd('0x10')]),_0x2828bb);}};exports[_0xd9dd('0x35')]=function(_0x137495){try{if(!_[_0xd9dd('0x18')](recordings[_0x137495['uniqueid']])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')]('[%s][recordings][newexten]',_0x137495['uniqueid']),_0x137495);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x137495[_0xd9dd('0x10')],_0x137495[_0xd9dd('0x36')],_0x137495[_0xd9dd('0x37')]));if(_0x137495[_0xd9dd('0x36')]['toLowerCase']()==_0xd9dd('0x38')&&_['startsWith'](_0x137495['appdata']['toLowerCase'](),'cdr')){var _0x3dbc5e=_0x137495[_0xd9dd('0x37')]['split']('=');var _0x5b2e43=_0x3dbc5e[0x0][_0xd9dd('0x39')](_0x3dbc5e[0x0]['lastIndexOf']('(')+0x1,_0x3dbc5e[0x0][_0xd9dd('0x3a')](')'));var _0xa0e39d=_0x3dbc5e[0x1];recordings[_0x137495[_0xd9dd('0x10')]][_0x5b2e43]=_0xa0e39d;}}}catch(_0xf9faf9){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')](_0xd9dd('0x3b'),_0x137495['uniqueid']),_0xf9faf9);}};exports['queuecallerjoin']=function(_0xe76b48){try{if(!_[_0xd9dd('0x18')](recordings[_0xe76b48[_0xd9dd('0x10')]])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0x3c'),_0xe76b48['uniqueid']),_0xe76b48);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x3d'),_0xe76b48[_0xd9dd('0x10')],_0xe76b48[_0xd9dd('0x3e')]));recordings[_0xe76b48['uniqueid']]['queue']=_0xe76b48[_0xd9dd('0x3e')];}}catch(_0x123ff2){utils[_0xd9dd('0x15')](util['format']('[%s][recordings][queuecallerjoin]',_0xe76b48['uniqueid']),_0x123ff2);}}; \ No newline at end of file +var _0xb0de=['newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','error','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','uniqueid','accountcode','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel'];(function(_0x527372,_0x173b25){var _0x4f88b2=function(_0x1d0bb6){while(--_0x1d0bb6){_0x527372['push'](_0x527372['shift']());}};_0x4f88b2(++_0x173b25);}(_0xb0de,0x1de));var _0xeb0d=function(_0x342317,_0x4c7ba3){_0x342317=_0x342317-0x0;var _0x423233=_0xb0de[_0x342317];return _0x423233;};'use strict';var _=require(_0xeb0d('0x0'));var util=require(_0xeb0d('0x1'));var utils=require(_0xeb0d('0x2'));var recordings={};function writeDB(_0x33c27a){utils[_0xeb0d('0x3')](util[_0xeb0d('0x4')]('[%s][recordings][writeDB]',_0x33c27a[_0xeb0d('0x5')]));if(_0x33c27a[_0xeb0d('0x6')]){utils['getUserByInternal'](_0x33c27a[_0xeb0d('0x6')])['then'](function(_0x34f75a){if(_0x34f75a){_0x33c27a[_0xeb0d('0x7')]=_0x34f75a[_0xeb0d('0x8')];_0x33c27a[_0xeb0d('0x9')]=_0x34f75a['id'];}utils[_0xeb0d('0xa')](_0xeb0d('0xb'),_0x33c27a);});}else{utils[_0xeb0d('0xa')](_0xeb0d('0xb'),_0x33c27a);}}exports['newchannel']=function(_0x246c50){try{utils[_0xeb0d('0xc')](util[_0xeb0d('0x4')](_0xeb0d('0xd'),_0x246c50['uniqueid']),_0x246c50);if(_0x246c50[_0xeb0d('0x5')]==_0x246c50['linkedid']){utils['info'](util[_0xeb0d('0x4')](_0xeb0d('0xe'),_0x246c50['uniqueid'],_0x246c50[_0xeb0d('0xf')],_0x246c50[_0xeb0d('0x10')]));recordings[_0x246c50[_0xeb0d('0x5')]]={'uniqueid':_0x246c50[_0xeb0d('0x5')],'accountcode':_0x246c50[_0xeb0d('0x6')],'exten':_0x246c50[_0xeb0d('0x10')],'context':_0x246c50[_0xeb0d('0xf')],'channel':_0x246c50[_0xeb0d('0x11')],'monitors':[]};}}catch(_0x247d0e){utils['error'](util[_0xeb0d('0x4')](_0xeb0d('0xd'),_0x246c50[_0xeb0d('0x5')]),_0x247d0e);}};exports[_0xeb0d('0x12')]=function(_0x5955dc){try{utils['debug'](util[_0xeb0d('0x4')](_0xeb0d('0x13'),_0x5955dc[_0xeb0d('0x5')]),_0x5955dc);if(!_['isNil'](recordings[_0x5955dc[_0xeb0d('0x5')]])&&_0x5955dc[_0xeb0d('0x14')]==0x6){utils[_0xeb0d('0x3')](util[_0xeb0d('0x4')](_0xeb0d('0x15'),_0x5955dc['uniqueid'],_0x5955dc[_0xeb0d('0xf')],_0x5955dc['channel']));}else if(!_[_0xeb0d('0x16')](recordings[_0x5955dc[_0xeb0d('0x17')]])&&_0x5955dc['channelstate']==0x6&&_0x5955dc[_0xeb0d('0xf')]!=_0xeb0d('0x18')){utils['info'](util[_0xeb0d('0x4')](_0xeb0d('0x19'),_0x5955dc['uniqueid'],_0x5955dc[_0xeb0d('0x17')],_0x5955dc['context'],_0x5955dc[_0xeb0d('0x11')]));recordings[_0x5955dc[_0xeb0d('0x17')]][_0xeb0d('0x6')]=_0x5955dc['accountcode'];}}catch(_0x5ab5e9){utils['error'](util[_0xeb0d('0x4')](_0xeb0d('0x13'),_0x5955dc[_0xeb0d('0x5')]),_0x5ab5e9);}};exports[_0xeb0d('0x1a')]=function(_0x24db2f){try{if(!_[_0xeb0d('0x16')](_0x24db2f[_0xeb0d('0x1b')])&&!_[_0xeb0d('0x16')](_0x24db2f['variable']['mixmonitor_filename'])){utils['debug'](util[_0xeb0d('0x4')](_0xeb0d('0x1c'),_0x24db2f[_0xeb0d('0x5')]),_0x24db2f);utils[_0xeb0d('0x3')](util[_0xeb0d('0x4')](_0xeb0d('0x1d'),_0x24db2f[_0xeb0d('0x5')],_0x24db2f[_0xeb0d('0x1b')],_0x24db2f[_0xeb0d('0x1e')]));if(_[_0xeb0d('0x1f')](_0x24db2f['value'],_0xeb0d('0x20'))){_0x24db2f['value']=_0x24db2f[_0xeb0d('0x1e')][_0xeb0d('0x21')](_0xeb0d('0x20'),_0xeb0d('0x22'));}if(recordings[_0x24db2f[_0xeb0d('0x17')]]){var _0x44158a=_[_0xeb0d('0x23')](recordings[_0x24db2f[_0xeb0d('0x17')]][_0xeb0d('0x24')],{'value':_0x24db2f[_0xeb0d('0x1e')]});if(_['isNil'](_0x44158a)){recordings[_0x24db2f[_0xeb0d('0x17')]][_0xeb0d('0x24')]['push']({'value':_0x24db2f[_0xeb0d('0x1e')]});}}}}catch(_0x2bd258){utils[_0xeb0d('0x25')](util[_0xeb0d('0x4')](_0xeb0d('0x1c'),_0x24db2f['uniqueid']),_0x2bd258);}};exports[_0xeb0d('0x26')]=function(_0x1af744){try{if(!_[_0xeb0d('0x16')](recordings[_0x1af744[_0xeb0d('0x5')]])){utils['debug'](util[_0xeb0d('0x4')](_0xeb0d('0x27'),_0x1af744['uniqueid']),_0x1af744);utils['info'](util[_0xeb0d('0x4')](_0xeb0d('0x28'),_0x1af744[_0xeb0d('0x5')],_0x1af744['calleridnum'],_0x1af744[_0xeb0d('0x29')],_0x1af744[_0xeb0d('0x2a')]));recordings[_0x1af744[_0xeb0d('0x5')]][_0xeb0d('0x2b')]=_0x1af744[_0xeb0d('0x2b')];recordings[_0x1af744[_0xeb0d('0x5')]][_0xeb0d('0x29')]=_0x1af744[_0xeb0d('0x29')];recordings[_0x1af744[_0xeb0d('0x5')]][_0xeb0d('0x2c')]=_0x1af744['connectedlinenum'];recordings[_0x1af744['uniqueid']][_0xeb0d('0x2d')]=_0x1af744['connectedlinename'];if(recordings[_0x1af744[_0xeb0d('0x5')]]['type']=='outbound'&&recordings[_0x1af744[_0xeb0d('0x5')]]['accountcode']){recordings[_0x1af744[_0xeb0d('0x5')]][_0xeb0d('0x2c')]=recordings[_0x1af744[_0xeb0d('0x5')]][_0xeb0d('0x6')];recordings[_0x1af744[_0xeb0d('0x5')]][_0xeb0d('0x2d')]='';}recordings[_0x1af744[_0xeb0d('0x5')]][_0xeb0d('0x24')][_0xeb0d('0x2e')](function(_0x44db9b){var _0x95f9bc=_[_0xeb0d('0x2f')](recordings[_0x1af744['uniqueid']]);_0x95f9bc[_0xeb0d('0x1e')]=_0x44db9b[_0xeb0d('0x1e')];writeDB(_0x95f9bc);});delete recordings[_0x1af744['uniqueid']];}}catch(_0x5e357f){utils['error'](util[_0xeb0d('0x4')](_0xeb0d('0x27'),_0x1af744['uniqueid']),_0x5e357f);}};exports[_0xeb0d('0x30')]=function(_0xefed30){try{if(!_[_0xeb0d('0x16')](recordings[_0xefed30[_0xeb0d('0x5')]])){utils['debug'](util['format']('[%s][recordings][newexten]',_0xefed30[_0xeb0d('0x5')]),_0xefed30);utils[_0xeb0d('0x3')](util['format'](_0xeb0d('0x31'),_0xefed30['uniqueid'],_0xefed30[_0xeb0d('0x32')],_0xefed30[_0xeb0d('0x33')]));if(_0xefed30['application'][_0xeb0d('0x34')]()==_0xeb0d('0x35')&&_[_0xeb0d('0x36')](_0xefed30['appdata'][_0xeb0d('0x34')](),_0xeb0d('0x37'))){var _0x2ad6a2=_0xefed30[_0xeb0d('0x33')]['split']('=');var _0x358d5e=_0x2ad6a2[0x0][_0xeb0d('0x38')](_0x2ad6a2[0x0][_0xeb0d('0x39')]('(')+0x1,_0x2ad6a2[0x0][_0xeb0d('0x39')](')'));var _0x267e04=_0x2ad6a2[0x1];recordings[_0xefed30[_0xeb0d('0x5')]][_0x358d5e]=_0x267e04;}}}catch(_0x5271fc){utils[_0xeb0d('0x25')](util['format'](_0xeb0d('0x3a'),_0xefed30[_0xeb0d('0x5')]),_0x5271fc);}};exports[_0xeb0d('0x3b')]=function(_0x4017af){try{if(!_[_0xeb0d('0x16')](recordings[_0x4017af[_0xeb0d('0x5')]])){utils['debug'](util[_0xeb0d('0x4')](_0xeb0d('0x3c'),_0x4017af['uniqueid']),_0x4017af);utils[_0xeb0d('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x4017af[_0xeb0d('0x5')],_0x4017af['queue']));recordings[_0x4017af['uniqueid']][_0xeb0d('0x3d')]=_0x4017af[_0xeb0d('0x3d')];}}catch(_0x21e32b){utils['error'](util[_0xeb0d('0x4')](_0xeb0d('0x3c'),_0x4017af[_0xeb0d('0x5')]),_0x21e32b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c638faf..115f811 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 _0x3813=['blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetexten','error','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','format','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname'];(function(_0xbafd8c,_0x4c1145){var _0xae7c95=function(_0x2c1361){while(--_0x2c1361){_0xbafd8c['push'](_0xbafd8c['shift']());}};_0xae7c95(++_0x4c1145);}(_0x3813,0xa2));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3381('0x0'));var util=require('util');var utils=require(_0x3381('0x1'));function writeDB(_0x2d1aad){utils[_0x3381('0x2')](util['format'](_0x3381('0x3'),_0x2d1aad['type']===_0x3381('0x4')?_0x2d1aad[_0x3381('0x5')]:_0x2d1aad[_0x3381('0x6')],_0x2d1aad[_0x3381('0x7')]));utils[_0x3381('0x8')](_0x3381('0x9'),_0x2d1aad);}exports[_0x3381('0xa')]=function(_0x46578a){try{utils[_0x3381('0xb')](util['format'](_0x3381('0xc'),_0x46578a[_0x3381('0x6')]),_0x46578a);utils[_0x3381('0x2')](util[_0x3381('0xd')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x46578a[_0x3381('0x6')],_0x46578a[_0x3381('0xe')],_0x46578a[_0x3381('0xf')],_0x46578a[_0x3381('0x10')],_0x46578a[_0x3381('0x11')]));_0x46578a[_0x3381('0x7')]=_0x3381('0x12');writeDB(_0x46578a);}catch(_0x160e0e){utils['error'](util[_0x3381('0xd')](_0x3381('0xc'),_0x46578a[_0x3381('0x6')]),_0x160e0e);}};exports[_0x3381('0x13')]=function(_0x1ccaf7){try{utils[_0x3381('0xb')](util[_0x3381('0xd')](_0x3381('0x14'),_0x1ccaf7[_0x3381('0x5')]),_0x1ccaf7);utils[_0x3381('0x2')](util[_0x3381('0xd')](_0x3381('0x15'),_0x1ccaf7[_0x3381('0x5')],_0x1ccaf7[_0x3381('0x16')],_0x1ccaf7[_0x3381('0x17')],_0x1ccaf7[_0x3381('0x18')],_0x1ccaf7['transfertargetcalleridname']));_0x1ccaf7=_[_0x3381('0x19')](_0x1ccaf7,{'transfererchannel':_0x1ccaf7['origtransfererchannel'],'transferercalleridnum':_0x1ccaf7['origtransferercalleridnum'],'transferercalleridname':_0x1ccaf7[_0x3381('0x17')],'transfererconnectedlinenum':_0x1ccaf7['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1ccaf7[_0x3381('0x1a')],'transfereraccountcode':_0x1ccaf7['origtransfereraccountcode'],'transferercontext':_0x1ccaf7[_0x3381('0x1b')],'transfererexten':_0x1ccaf7[_0x3381('0x1c')],'transfererlinkedid':_0x1ccaf7[_0x3381('0x1d')],'context':_0x1ccaf7[_0x3381('0x1e')],'extension':_0x1ccaf7[_0x3381('0x1f')],'type':_0x3381('0x4')});if(_['isNil'](_0x1ccaf7['transfereechannel'])){_0x1ccaf7=_[_0x3381('0x19')](_0x1ccaf7,{'transfereechannel':_0x1ccaf7[_0x3381('0x20')],'transfereecalleridnum':_0x1ccaf7[_0x3381('0x18')],'transfereecalleridname':_0x1ccaf7[_0x3381('0x21')],'transfereeconnectedlinenum':_0x1ccaf7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1ccaf7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1ccaf7['transfertargetaccountcode'],'transfereecontext':_0x1ccaf7['transfertargetcontext'],'transfereeexten':_0x1ccaf7[_0x3381('0x22')],'transfereelinkedid':_0x1ccaf7['transfertargetlinkedid']});}writeDB(_0x1ccaf7);}catch(_0x34c736){utils[_0x3381('0x23')](util[_0x3381('0xd')](_0x3381('0x14'),_0x1ccaf7['origtransfereruniqueid']),_0x34c736);}}; \ No newline at end of file +var _0xf8fb=['format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','transferercalleridnum','blind','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','error','./utils','info'];(function(_0x30121e,_0x240c86){var _0x4ba328=function(_0x2601c1){while(--_0x2601c1){_0x30121e['push'](_0x30121e['shift']());}};_0x4ba328(++_0x240c86);}(_0xf8fb,0x1cc));var _0xbf8f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf8fb[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xbf8f('0x0'));function writeDB(_0x133dd3){utils[_0xbf8f('0x1')](util[_0xbf8f('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x133dd3[_0xbf8f('0x3')]===_0xbf8f('0x4')?_0x133dd3[_0xbf8f('0x5')]:_0x133dd3[_0xbf8f('0x6')],_0x133dd3[_0xbf8f('0x3')]));utils[_0xbf8f('0x7')](_0xbf8f('0x8'),_0x133dd3);}exports['blindtransfer']=function(_0x33eca6){try{utils['debug'](util[_0xbf8f('0x2')](_0xbf8f('0x9'),_0x33eca6['uniqueid']),_0x33eca6);utils[_0xbf8f('0x1')](util[_0xbf8f('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x33eca6[_0xbf8f('0x6')],_0x33eca6[_0xbf8f('0xa')],_0x33eca6['transferercalleridname'],_0x33eca6['transfereecalleridnum'],_0x33eca6['transfereecalleridname']));_0x33eca6['type']=_0xbf8f('0xb');writeDB(_0x33eca6);}catch(_0x34ced3){utils['error'](util[_0xbf8f('0x2')](_0xbf8f('0x9'),_0x33eca6[_0xbf8f('0x6')]),_0x34ced3);}};exports['attendedtransfer']=function(_0x158a8b){try{utils[_0xbf8f('0xc')](util[_0xbf8f('0x2')](_0xbf8f('0xd'),_0x158a8b[_0xbf8f('0x5')]),_0x158a8b);utils['info'](util[_0xbf8f('0x2')](_0xbf8f('0xe'),_0x158a8b[_0xbf8f('0x5')],_0x158a8b[_0xbf8f('0xf')],_0x158a8b[_0xbf8f('0x10')],_0x158a8b[_0xbf8f('0x11')],_0x158a8b[_0xbf8f('0x12')]));_0x158a8b=_[_0xbf8f('0x13')](_0x158a8b,{'transfererchannel':_0x158a8b[_0xbf8f('0x14')],'transferercalleridnum':_0x158a8b[_0xbf8f('0xf')],'transferercalleridname':_0x158a8b[_0xbf8f('0x10')],'transfererconnectedlinenum':_0x158a8b[_0xbf8f('0x15')],'transfererconnectedlinename':_0x158a8b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x158a8b[_0xbf8f('0x16')],'transferercontext':_0x158a8b['secondtransferercontext'],'transfererexten':_0x158a8b[_0xbf8f('0x17')],'transfererlinkedid':_0x158a8b[_0xbf8f('0x18')],'context':_0x158a8b[_0xbf8f('0x19')],'extension':_0x158a8b['origtransfererexten'],'type':'attended'});if(_['isNil'](_0x158a8b[_0xbf8f('0x1a')])){_0x158a8b=_[_0xbf8f('0x13')](_0x158a8b,{'transfereechannel':_0x158a8b[_0xbf8f('0x1b')],'transfereecalleridnum':_0x158a8b['transfertargetcalleridnum'],'transfereecalleridname':_0x158a8b[_0xbf8f('0x12')],'transfereeconnectedlinenum':_0x158a8b[_0xbf8f('0x1c')],'transfereeconnectedlinename':_0x158a8b[_0xbf8f('0x1d')],'transfereeaccountcode':_0x158a8b[_0xbf8f('0x1e')],'transfereecontext':_0x158a8b['transfertargetcontext'],'transfereeexten':_0x158a8b['transfertargetexten'],'transfereelinkedid':_0x158a8b[_0xbf8f('0x1f')]});}writeDB(_0x158a8b);}catch(_0x28aeca){utils[_0xbf8f('0x20')](util[_0xbf8f('0x2')](_0xbf8f('0xd'),_0x158a8b['origtransfereruniqueid']),_0x28aeca);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 723fe28..d7ab33f 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(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0x7a54,0x106));var _0x47a5=function(_0x108317,_0xc8c3a8){_0x108317=_0x108317-0x0;var _0x25634d=_0x7a54[_0x108317];return _0x25634d;};'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 _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(_0x4b1c73,_0x1a4207){var _0xfab919=function(_0x423a33){while(--_0x423a33){_0x4b1c73['push'](_0x4b1c73['shift']());}};_0xfab919(++_0x1a4207);}(_0x7a54,0x106));var _0x47a5=function(_0x8b4a8f,_0x149b9b){_0x8b4a8f=_0x8b4a8f-0x0;var _0x470324=_0x7a54[_0x8b4a8f];return _0x470324;};'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